From: support Date: Tue, 31 Jan 2023 17:02:08 +0000 (+0000) Subject: Built motion from commit d69f4380.|2.6.29 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22?a=commitdiff_plain;h=529af6dbda8686adf0db959094d64bc163e15395;p=motion2.git Built motion from commit d69f4380.|2.6.29 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 184eff1..08178dc 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-31T11:46:28.617Z", + "time": "2023-01-31T16:54:25.985Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index c1b14bc..ffc2a3a 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2023-01-31T11:46:28.617Z", + "time": "2023-01-31T16:54:25.985Z", "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 c6e355c..604c4c2 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 _0xb3f0=['getDataValue','action','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','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]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','exports','VIRTUAL'];(function(_0x347cbb,_0x5708f5){var _0x4352bd=function(_0x3638f0){while(--_0x3638f0){_0x347cbb['push'](_0x347cbb['shift']());}};_0x4352bd(++_0x5708f5);}(_0xb3f0,0x96));var _0x0b3f=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xb3f0[_0x3054be];return _0x3df150;};'use strict';var Sequelize=require('sequelize');module[_0x0b3f('0x0')]={'name':{'type':Sequelize[_0x0b3f('0x1')],'get':function(_0x483280){return this[_0x0b3f('0x2')](_0x0b3f('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x0b3f('0x4'),_0x0b3f('0x5'),_0x0b3f('0x6'),_0x0b3f('0x7'),_0x0b3f('0x8'),_0x0b3f('0x9'),_0x0b3f('0xa'),'script']],'msg':_0x0b3f('0xb')}},'comment':_0x0b3f('0xb')},'data1':{'type':Sequelize[_0x0b3f('0xc')](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[_0x0b3f('0xc')](0x1000),'comment':'contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]'},'data3':{'type':Sequelize[_0x0b3f('0xc')](0x1000),'comment':_0x0b3f('0xd')},'data4':{'type':Sequelize[_0x0b3f('0xc')](0x1000),'comments':_0x0b3f('0xe')},'data5':{'type':Sequelize['STRING'](0x1000),'comments':_0x0b3f('0xf')},'data6':{'type':Sequelize[_0x0b3f('0xc')],'comments':_0x0b3f('0x10')},'data7':{'type':Sequelize[_0x0b3f('0x11')],'comments':_0x0b3f('0x12')}}; \ No newline at end of file +var _0xe2fa=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','VIRTUAL','getDataValue','action','STRING','contactManager','integration','jscripty','urlForward','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)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'];(function(_0x24c940,_0x546a7c){var _0x257afe=function(_0x2063af){while(--_0x2063af){_0x24c940['push'](_0x24c940['shift']());}};_0x257afe(++_0x546a7c);}(_0xe2fa,0x6f));var _0xae2f=function(_0x32f86c,_0x601e54){_0x32f86c=_0x32f86c-0x0;var _0x461db5=_0xe2fa[_0x32f86c];return _0x461db5;};'use strict';var Sequelize=require(_0xae2f('0x0'));module['exports']={'name':{'type':Sequelize[_0xae2f('0x1')],'get':function(_0x1bd78f){return this[_0xae2f('0x2')](_0xae2f('0x3'));}},'action':{'type':Sequelize[_0xae2f('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0xae2f('0x5'),_0xae2f('0x6'),'motionbar',_0xae2f('0x7'),_0xae2f('0x8'),'browser',_0xae2f('0x9'),_0xae2f('0xa')]],'msg':_0xae2f('0xb')}},'comment':_0xae2f('0xb')},'data1':{'type':Sequelize[_0xae2f('0x4')](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[_0xae2f('0x4')](0x1000),'comment':_0xae2f('0xc')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':_0xae2f('0xd')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xae2f('0xe')},'data5':{'type':Sequelize[_0xae2f('0x4')](0x1000),'comments':_0xae2f('0xf')},'data6':{'type':Sequelize['STRING'],'comments':_0xae2f('0x10')},'data7':{'type':Sequelize[_0xae2f('0x11')],'comments':'urlForward[body]'}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index e3fe93b..cc7c88c 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 _0x2dc6=['limit','count','set','Content-Range','json','apply','reject','update','then','destroy','error','name','body','Action','find','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined'];(function(_0x12fcbd,_0x884804){var _0x28ec2a=function(_0xa5ff99){while(--_0xa5ff99){_0x12fcbd['push'](_0x12fcbd['shift']());}};_0x28ec2a(++_0x884804);}(_0x2dc6,0x179));var _0x62dc=function(_0x1d74dd,_0x119353){_0x1d74dd=_0x1d74dd-0x0;var _0x314b21=_0x2dc6[_0x1d74dd];return _0x314b21;};'use strict';var emlformat=require(_0x62dc('0x0'));var rimraf=require(_0x62dc('0x1'));var zipdir=require(_0x62dc('0x2'));var jsonpatch=require(_0x62dc('0x3'));var rp=require(_0x62dc('0x4'));var moment=require(_0x62dc('0x5'));var BPromise=require(_0x62dc('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x62dc('0x7'));var sox=require(_0x62dc('0x8'));var csv=require(_0x62dc('0x9'));var ejs=require(_0x62dc('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x62dc('0xb'));var squel=require(_0x62dc('0xc'));var crypto=require(_0x62dc('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x62dc('0xe'));var Papa=require(_0x62dc('0xf'));var Redis=require(_0x62dc('0x10'));var authService=require(_0x62dc('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x62dc('0x12'))(_0x62dc('0x13'));var utils=require(_0x62dc('0x14'));var config=require(_0x62dc('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x62dc('0x16'))['db'];function respondWithStatusCode(_0x5bb4b0,_0x40f535){_0x40f535=_0x40f535||0xcc;return function(_0x259da6){if(_0x259da6){return _0x5bb4b0[_0x62dc('0x17')](_0x40f535);}return _0x5bb4b0[_0x62dc('0x18')](_0x40f535)[_0x62dc('0x19')]();};}function respondWithResult(_0x585e56,_0x1b2233){_0x1b2233=_0x1b2233||0xc8;return function(_0x3c3704){if(_0x3c3704){return _0x585e56[_0x62dc('0x18')](_0x1b2233)['json'](_0x3c3704);}};}function respondWithFilteredResult(_0x3d6ae2,_0x22d94b){return function(_0x1f1aab){if(_0x1f1aab){var _0x5e938a=typeof _0x22d94b[_0x62dc('0x1a')]===_0x62dc('0x1b')&&typeof _0x22d94b[_0x62dc('0x1c')]===_0x62dc('0x1b');var _0x5015a8=_0x1f1aab[_0x62dc('0x1d')];var _0x30a162=_0x5e938a?0x0:_0x22d94b[_0x62dc('0x1a')];var _0x2957f2=_0x5e938a?_0x1f1aab[_0x62dc('0x1d')]:_0x22d94b[_0x62dc('0x1a')]+_0x22d94b[_0x62dc('0x1c')];var _0x383e39;if(_0x2957f2>=_0x5015a8){_0x2957f2=_0x5015a8;_0x383e39=0xc8;}else{_0x383e39=0xce;}_0x3d6ae2[_0x62dc('0x18')](_0x383e39);return _0x3d6ae2[_0x62dc('0x1e')](_0x62dc('0x1f'),_0x30a162+'-'+_0x2957f2+'/'+_0x5015a8)[_0x62dc('0x20')](_0x1f1aab);}return null;};}function patchUpdates(_0x2fd060){return function(_0x7c9f5e){try{jsonpatch[_0x62dc('0x21')](_0x7c9f5e,_0x2fd060,!![]);}catch(_0x3bb19e){return BPromise[_0x62dc('0x22')](_0x3bb19e);}return _0x7c9f5e['save']();};}function saveUpdates(_0x2e1ef9,_0x26c268){return function(_0xfbd297){if(_0xfbd297){return _0xfbd297[_0x62dc('0x23')](_0x2e1ef9)[_0x62dc('0x24')](function(_0x16dbf3){return _0x16dbf3;});}return null;};}function removeEntity(_0x22081e,_0x50be5b){return function(_0x543aa2){if(_0x543aa2){return _0x543aa2[_0x62dc('0x25')]()[_0x62dc('0x24')](function(){_0x22081e[_0x62dc('0x18')](0xcc)[_0x62dc('0x19')]();});}};}function handleEntityNotFound(_0x5bcbcb,_0x257c4c){return function(_0x143d39){if(!_0x143d39){_0x5bcbcb[_0x62dc('0x17')](0x194);}return _0x143d39;};}function handleError(_0x1b44d7,_0x4cc759){_0x4cc759=_0x4cc759||0x1f4;return function(_0x2d08a7){logger[_0x62dc('0x26')](_0x2d08a7['stack']);if(_0x2d08a7[_0x62dc('0x27')]){delete _0x2d08a7[_0x62dc('0x27')];}_0x1b44d7[_0x62dc('0x18')](_0x4cc759)['send'](_0x2d08a7);};}exports[_0x62dc('0x23')]=function(_0x4efff5,_0x3d79e8){if(_0x4efff5[_0x62dc('0x28')]['id']){delete _0x4efff5[_0x62dc('0x28')]['id'];}return db[_0x62dc('0x29')][_0x62dc('0x2a')]({'where':{'id':_0x4efff5['params']['id']}})[_0x62dc('0x24')](handleEntityNotFound(_0x3d79e8,null))['then'](saveUpdates(_0x4efff5[_0x62dc('0x28')],null))['then'](respondWithResult(_0x3d79e8,null))[_0x62dc('0x2b')](handleError(_0x3d79e8,null));};exports[_0x62dc('0x25')]=function(_0x2b55f3,_0xc90d5b){return db[_0x62dc('0x29')]['find']({'where':{'id':_0x2b55f3[_0x62dc('0x2c')]['id']}})[_0x62dc('0x24')](handleEntityNotFound(_0xc90d5b,null))[_0x62dc('0x24')](removeEntity(_0xc90d5b,null))['catch'](handleError(_0xc90d5b,null));}; \ No newline at end of file +var _0xc025=['util','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/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','offset','limit','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','body','find','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x372a8e,_0x16a38d){var _0x39aa2d=function(_0x5e7ba7){while(--_0x5e7ba7){_0x372a8e['push'](_0x372a8e['shift']());}};_0x39aa2d(++_0x16a38d);}(_0xc025,0x156));var _0x5c02=function(_0x2fe4b5,_0x439480){_0x2fe4b5=_0x2fe4b5-0x0;var _0x2b9c0b=_0xc025[_0x2fe4b5];return _0x2b9c0b;};'use strict';var emlformat=require(_0x5c02('0x0'));var rimraf=require(_0x5c02('0x1'));var zipdir=require(_0x5c02('0x2'));var jsonpatch=require(_0x5c02('0x3'));var rp=require(_0x5c02('0x4'));var moment=require(_0x5c02('0x5'));var BPromise=require(_0x5c02('0x6'));var Mustache=require(_0x5c02('0x7'));var util=require(_0x5c02('0x8'));var path=require('path');var sox=require(_0x5c02('0x9'));var csv=require(_0x5c02('0xa'));var ejs=require(_0x5c02('0xb'));var fs=require('fs');var fs_extra=require(_0x5c02('0xc'));var _=require(_0x5c02('0xd'));var squel=require(_0x5c02('0xe'));var crypto=require(_0x5c02('0xf'));var jsforce=require(_0x5c02('0x10'));var deskjs=require(_0x5c02('0x11'));var toCsv=require(_0x5c02('0xa'));var querystring=require(_0x5c02('0x12'));var Papa=require(_0x5c02('0x13'));var Redis=require(_0x5c02('0x14'));var authService=require(_0x5c02('0x15'));var qs=require(_0x5c02('0x16'));var as=require(_0x5c02('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5c02('0x18'))(_0x5c02('0x19'));var utils=require(_0x5c02('0x1a'));var config=require(_0x5c02('0x1b'));var licenseUtil=require(_0x5c02('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4565ef,_0x28e32e){_0x28e32e=_0x28e32e||0xcc;return function(_0x378ae1){if(_0x378ae1){return _0x4565ef[_0x5c02('0x1d')](_0x28e32e);}return _0x4565ef[_0x5c02('0x1e')](_0x28e32e)[_0x5c02('0x1f')]();};}function respondWithResult(_0xc119d5,_0x94cf84){_0x94cf84=_0x94cf84||0xc8;return function(_0x15fb2d){if(_0x15fb2d){return _0xc119d5[_0x5c02('0x1e')](_0x94cf84)[_0x5c02('0x20')](_0x15fb2d);}};}function respondWithFilteredResult(_0x38be45,_0x3d8265){return function(_0x1a02b5){if(_0x1a02b5){var _0x2ce57b=typeof _0x3d8265['offset']===_0x5c02('0x21')&&typeof _0x3d8265['limit']===_0x5c02('0x21');var _0x179c91=_0x1a02b5['count'];var _0x1f43c5=_0x2ce57b?0x0:_0x3d8265[_0x5c02('0x22')];var _0x12cb7f=_0x2ce57b?_0x1a02b5['count']:_0x3d8265[_0x5c02('0x22')]+_0x3d8265[_0x5c02('0x23')];var _0x27ffe6;if(_0x12cb7f>=_0x179c91){_0x12cb7f=_0x179c91;_0x27ffe6=0xc8;}else{_0x27ffe6=0xce;}_0x38be45[_0x5c02('0x1e')](_0x27ffe6);return _0x38be45['set'](_0x5c02('0x24'),_0x1f43c5+'-'+_0x12cb7f+'/'+_0x179c91)[_0x5c02('0x20')](_0x1a02b5);}return null;};}function patchUpdates(_0x3594a6){return function(_0x264f08){try{jsonpatch[_0x5c02('0x25')](_0x264f08,_0x3594a6,!![]);}catch(_0x59fade){return BPromise[_0x5c02('0x26')](_0x59fade);}return _0x264f08[_0x5c02('0x27')]();};}function saveUpdates(_0x38d305,_0x5968a4){return function(_0x12afdd){if(_0x12afdd){return _0x12afdd[_0x5c02('0x28')](_0x38d305)[_0x5c02('0x29')](function(_0x59b8ad){return _0x59b8ad;});}return null;};}function removeEntity(_0x4c3258,_0x583e8e){return function(_0x948d48){if(_0x948d48){return _0x948d48[_0x5c02('0x2a')]()[_0x5c02('0x29')](function(){_0x4c3258['status'](0xcc)[_0x5c02('0x1f')]();});}};}function handleEntityNotFound(_0x424720,_0x148df8){return function(_0x558e1a){if(!_0x558e1a){_0x424720['sendStatus'](0x194);}return _0x558e1a;};}function handleError(_0x2dc3f3,_0x3bd7bf){_0x3bd7bf=_0x3bd7bf||0x1f4;return function(_0xded84b){logger[_0x5c02('0x2b')](_0xded84b[_0x5c02('0x2c')]);if(_0xded84b['name']){delete _0xded84b[_0x5c02('0x2d')];}_0x2dc3f3[_0x5c02('0x1e')](_0x3bd7bf)['send'](_0xded84b);};}exports['update']=function(_0x1fda31,_0x2afd72){if(_0x1fda31[_0x5c02('0x2e')]['id']){delete _0x1fda31['body']['id'];}return db['Action'][_0x5c02('0x2f')]({'where':{'id':_0x1fda31['params']['id']}})[_0x5c02('0x29')](handleEntityNotFound(_0x2afd72,null))[_0x5c02('0x29')](saveUpdates(_0x1fda31[_0x5c02('0x2e')],null))[_0x5c02('0x29')](respondWithResult(_0x2afd72,null))[_0x5c02('0x30')](handleError(_0x2afd72,null));};exports[_0x5c02('0x2a')]=function(_0x5dad99,_0x46d18c){return db['Action'][_0x5c02('0x2f')]({'where':{'id':_0x5dad99[_0x5c02('0x31')]['id']}})[_0x5c02('0x29')](handleEntityNotFound(_0x46d18c,null))[_0x5c02('0x29')](removeEntity(_0x46d18c,null))[_0x5c02('0x30')](handleError(_0x46d18c,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 1674387..024ce73 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 _0xc292=['../../config/environment','./action.attributes','exports','define','tools_actions','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf'];(function(_0x57402a,_0x392635){var _0x578f73=function(_0x3bae3e){while(--_0x3bae3e){_0x57402a['push'](_0x57402a['shift']());}};_0x578f73(++_0x392635);}(_0xc292,0x18b));var _0x2c29=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0xc292[_0x51c819];return _0x15c5d2;};'use strict';var _=require(_0x2c29('0x0'));var util=require(_0x2c29('0x1'));var logger=require(_0x2c29('0x2'))(_0x2c29('0x3'));var moment=require(_0x2c29('0x4'));var BPromise=require('bluebird');var rp=require(_0x2c29('0x5'));var fs=require('fs');var path=require(_0x2c29('0x6'));var rimraf=require(_0x2c29('0x7'));var config=require(_0x2c29('0x8'));var attributes=require(_0x2c29('0x9'));module[_0x2c29('0xa')]=function(_0x570c43,_0x213b52){return _0x570c43[_0x2c29('0xb')]('Action',attributes,{'tableName':_0x2c29('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd0be=['moment','bluebird','request-promise','path','exports','define','Action','tools_actions','lodash','util','../../config/logger','api'];(function(_0x491bdf,_0x21701b){var _0x492af7=function(_0x57a2bd){while(--_0x57a2bd){_0x491bdf['push'](_0x491bdf['shift']());}};_0x492af7(++_0x21701b);}(_0xd0be,0x1a0));var _0xed0b=function(_0x109946,_0x3494b7){_0x109946=_0x109946-0x0;var _0x4ed20b=_0xd0be[_0x109946];return _0x4ed20b;};'use strict';var _=require(_0xed0b('0x0'));var util=require(_0xed0b('0x1'));var logger=require(_0xed0b('0x2'))(_0xed0b('0x3'));var moment=require(_0xed0b('0x4'));var BPromise=require(_0xed0b('0x5'));var rp=require(_0xed0b('0x6'));var fs=require('fs');var path=require(_0xed0b('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./action.attributes');module[_0xed0b('0x8')]=function(_0x12e73f,_0x160d7a){return _0x12e73f[_0xed0b('0x9')](_0xed0b('0xa'),attributes,{'tableName':_0xed0b('0xb'),'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 f7454d3..464a845 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 _0x1261=['then','info','Action,\x20%s,\x20%s','request\x20sent','Action,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x4f4e5b,_0x3b8b9b){var _0x326141=function(_0x186173){while(--_0x186173){_0x4f4e5b['push'](_0x4f4e5b['shift']());}};_0x326141(++_0x3b8b9b);}(_0x1261,0x144));var _0x1126=function(_0x2cc017,_0x25b198){_0x2cc017=_0x2cc017-0x0;var _0x509276=_0x1261[_0x2cc017];return _0x509276;};'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')]('Action,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ 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(_0x160b36,_0x31321f){var _0x21d2e4=function(_0x2185b4){while(--_0x2185b4){_0x160b36['push'](_0x160b36['shift']());}};_0x21d2e4(++_0x31321f);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x247ca4,_0x1e7ec5){_0x247ca4=_0x247ca4-0x0;var _0x432c92=_0x7fbe[_0x247ca4];return _0x432c92;};'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 928f140..6fd0079 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 _0xb61a=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','put','/:id','isAuthenticated','update','exports'];(function(_0x1c0e51,_0x2b42b8){var _0x422c25=function(_0x276431){while(--_0x276431){_0x1c0e51['push'](_0x1c0e51['shift']());}};_0x422c25(++_0x2b42b8);}(_0xb61a,0x122));var _0xab61=function(_0x7614e3,_0x294090){_0x7614e3=_0x7614e3-0x0;var _0x2fd016=_0xb61a[_0x7614e3];return _0x2fd016;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xab61('0x0'));var timeout=require(_0xab61('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xab61('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xab61('0x3'));var config=require(_0xab61('0x4'));var controller=require('./action.controller');router[_0xab61('0x5')](_0xab61('0x6'),auth[_0xab61('0x7')](),controller[_0xab61('0x8')]);router['delete'](_0xab61('0x6'),auth[_0xab61('0x7')](),controller['destroy']);module[_0xab61('0x9')]=router; \ No newline at end of file +var _0x0905=['multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','isAuthenticated','update','delete','/:id','destroy','exports'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x0905,0x177));var _0x5090=function(_0x149f91,_0x114519){_0x149f91=_0x149f91-0x0;var _0x1ed87b=_0x0905[_0x149f91];return _0x1ed87b;};'use strict';var multer=require(_0x5090('0x0'));var util=require('util');var path=require(_0x5090('0x1'));var timeout=require(_0x5090('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5090('0x3'));var auth=require(_0x5090('0x4'));var interaction=require(_0x5090('0x5'));var config=require(_0x5090('0x6'));var controller=require(_0x5090('0x7'));router[_0x5090('0x8')]('/:id',auth[_0x5090('0x9')](),controller[_0x5090('0xa')]);router[_0x5090('0xb')](_0x5090('0xc'),auth['isAuthenticated'](),controller[_0x5090('0xd')]);module[_0x5090('0xe')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 25ac0d5..aa52a8a 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 _0x7c09=['exports','STRING','TEXT'];(function(_0x293635,_0x273b54){var _0x153e02=function(_0x4e6361){while(--_0x4e6361){_0x293635['push'](_0x293635['shift']());}};_0x153e02(++_0x273b54);}(_0x7c09,0x102));var _0x97c0=function(_0x45407d,_0x2c79e7){_0x45407d=_0x45407d-0x0;var _0x328fad=_0x7c09[_0x45407d];return _0x328fad;};'use strict';var Sequelize=require('sequelize');module[_0x97c0('0x0')]={'name':{'type':Sequelize[_0x97c0('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x97c0('0x1')]},'table':{'type':Sequelize[_0x97c0('0x1')]},'conditions':{'type':Sequelize[_0x97c0('0x2')]},'joins':{'type':Sequelize[_0x97c0('0x2')]}}; \ No newline at end of file +var _0x8958=['TEXT','exports'];(function(_0x1a422a,_0x3468fd){var _0x4dcab4=function(_0x24b700){while(--_0x24b700){_0x1a422a['push'](_0x1a422a['shift']());}};_0x4dcab4(++_0x3468fd);}(_0x8958,0x93));var _0x8895=function(_0x2a281a,_0x5007cf){_0x2a281a=_0x2a281a-0x0;var _0x4fc65c=_0x8958[_0x2a281a];return _0x4fc65c;};'use strict';var Sequelize=require('sequelize');module[_0x8895('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x8895('0x1')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index f107427..a6089bc 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 _0xfc6b=['cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','Please\x20insert\x20at\x20least\x20one\x20field','replace','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','info','fork','../../components/export/','savename','countTable','COUNT(*)','SELECT','runReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','get','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','where','merge','VIRTUAL','filter','options','AnalyticCustomReport','findAll','rows','catch','params','intersection','includeAll','include','create','body','user','role','Reports','UserProfileSection','userProfileId','UserProfileResource','CustomReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','find','preview','join','left_join','right_join'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0xfc6b,0x194));var _0xbfc6=function(_0x22eb1a,_0xcc656e){_0x22eb1a=_0x22eb1a-0x0;var _0x3787d2=_0xfc6b[_0x22eb1a];return _0x3787d2;};'use strict';var emlformat=require(_0xbfc6('0x0'));var rimraf=require(_0xbfc6('0x1'));var zipdir=require(_0xbfc6('0x2'));var jsonpatch=require(_0xbfc6('0x3'));var rp=require(_0xbfc6('0x4'));var moment=require(_0xbfc6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbfc6('0x6'));var util=require('util');var path=require(_0xbfc6('0x7'));var sox=require(_0xbfc6('0x8'));var csv=require(_0xbfc6('0x9'));var ejs=require(_0xbfc6('0xa'));var fs=require('fs');var fs_extra=require(_0xbfc6('0xb'));var _=require(_0xbfc6('0xc'));var squel=require(_0xbfc6('0xd'));var crypto=require('crypto');var jsforce=require(_0xbfc6('0xe'));var deskjs=require(_0xbfc6('0xf'));var toCsv=require(_0xbfc6('0x9'));var querystring=require('querystring');var Papa=require(_0xbfc6('0x10'));var Redis=require(_0xbfc6('0x11'));var authService=require(_0xbfc6('0x12'));var qs=require(_0xbfc6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbfc6('0x14'));var logger=require(_0xbfc6('0x15'))('api');var utils=require(_0xbfc6('0x16'));var config=require(_0xbfc6('0x17'));var licenseUtil=require(_0xbfc6('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0xbfc6('0x19'))[_0xbfc6('0x1a')];function respondWithStatusCode(_0x41094a,_0x412b34){_0x412b34=_0x412b34||0xcc;return function(_0x12dd3a){if(_0x12dd3a){return _0x41094a['sendStatus'](_0x412b34);}return _0x41094a[_0xbfc6('0x1b')](_0x412b34)[_0xbfc6('0x1c')]();};}function respondWithResult(_0x1cae0c,_0x369d59){_0x369d59=_0x369d59||0xc8;return function(_0x3df15f){if(_0x3df15f){return _0x1cae0c['status'](_0x369d59)['json'](_0x3df15f);}};}function respondWithFilteredResult(_0x2e6dc2,_0xcaaa5a){return function(_0x28b94b){if(_0x28b94b){var _0x4f2cf6=typeof _0xcaaa5a[_0xbfc6('0x1d')]===_0xbfc6('0x1e')&&typeof _0xcaaa5a[_0xbfc6('0x1f')]===_0xbfc6('0x1e');var _0x3cbef0=_0x28b94b[_0xbfc6('0x20')];var _0x196123=_0x4f2cf6?0x0:_0xcaaa5a['offset'];var _0x3c01b3=_0x4f2cf6?_0x28b94b[_0xbfc6('0x20')]:_0xcaaa5a[_0xbfc6('0x1d')]+_0xcaaa5a[_0xbfc6('0x1f')];var _0x43d030;if(_0x3c01b3>=_0x3cbef0){_0x3c01b3=_0x3cbef0;_0x43d030=0xc8;}else{_0x43d030=0xce;}_0x2e6dc2[_0xbfc6('0x1b')](_0x43d030);return _0x2e6dc2[_0xbfc6('0x21')](_0xbfc6('0x22'),_0x196123+'-'+_0x3c01b3+'/'+_0x3cbef0)[_0xbfc6('0x23')](_0x28b94b);}return null;};}function patchUpdates(_0x2a56b2){return function(_0x43f2e4){try{jsonpatch[_0xbfc6('0x24')](_0x43f2e4,_0x2a56b2,!![]);}catch(_0x4188bc){return BPromise[_0xbfc6('0x25')](_0x4188bc);}return _0x43f2e4['save']();};}function saveUpdates(_0x4b804a,_0x5abc6d){return function(_0x128b7b){if(_0x128b7b){return _0x128b7b[_0xbfc6('0x26')](_0x4b804a)['then'](function(_0x53fe9d){return _0x53fe9d;});}return null;};}function removeEntity(_0x5e5c7b,_0x20cd22){return function(_0x3e0de4){if(_0x3e0de4){return _0x3e0de4['destroy']()[_0xbfc6('0x27')](function(){var _0x289cb2=_0x3e0de4[_0xbfc6('0x28')]({'plain':!![]});var _0x53e810='CustomReports';return db['UserProfileResource']['destroy']({'where':{'type':_0x53e810,'resourceId':_0x289cb2['id']}})[_0xbfc6('0x27')](function(){return _0x3e0de4;});})[_0xbfc6('0x27')](function(){_0x5e5c7b[_0xbfc6('0x1b')](0xcc)[_0xbfc6('0x1c')]();});}};}function handleEntityNotFound(_0x6035e2,_0x2b1148){return function(_0x3affb6){if(!_0x3affb6){_0x6035e2['sendStatus'](0x194);}return _0x3affb6;};}function handleError(_0x406851,_0x18f145){_0x18f145=_0x18f145||0x1f4;return function(_0xa11c65){logger[_0xbfc6('0x29')](_0xa11c65['stack']);if(_0xa11c65['name']){delete _0xa11c65[_0xbfc6('0x2a')];}_0x406851[_0xbfc6('0x1b')](_0x18f145)[_0xbfc6('0x2b')](_0xa11c65);};}exports[_0xbfc6('0x2c')]=function(_0x3d67f3,_0xb40e62){var _0x3f5383={},_0x18a470={},_0x56a9fc={'count':0x0,'rows':[]};var _0x1da590=_['map'](db['AnalyticCustomReport'][_0xbfc6('0x2d')],function(_0x332a78){return{'name':_0x332a78[_0xbfc6('0x2e')],'type':_0x332a78[_0xbfc6('0x2f')][_0xbfc6('0x30')]};});_0x18a470[_0xbfc6('0x31')]=_[_0xbfc6('0x32')](_0x1da590,_0xbfc6('0x2a'));_0x18a470[_0xbfc6('0x33')]=_[_0xbfc6('0x34')](_0x3d67f3[_0xbfc6('0x33')]);_0x18a470['filters']=_['intersection'](_0x18a470[_0xbfc6('0x31')],_0x18a470[_0xbfc6('0x33')]);_0x3f5383['attributes']=_['intersection'](_0x18a470['model'],qs['fields'](_0x3d67f3[_0xbfc6('0x33')][_0xbfc6('0x35')]));_0x3f5383[_0xbfc6('0x36')]=_0x3f5383[_0xbfc6('0x36')][_0xbfc6('0x37')]?_0x3f5383[_0xbfc6('0x36')]:_0x18a470[_0xbfc6('0x31')];if(!_0x3d67f3[_0xbfc6('0x33')][_0xbfc6('0x38')](_0xbfc6('0x39'))){_0x3f5383[_0xbfc6('0x1f')]=qs[_0xbfc6('0x1f')](_0x3d67f3['query'][_0xbfc6('0x1f')]);_0x3f5383[_0xbfc6('0x1d')]=qs[_0xbfc6('0x1d')](_0x3d67f3[_0xbfc6('0x33')][_0xbfc6('0x1d')]);}_0x3f5383[_0xbfc6('0x3a')]=qs['sort'](_0x3d67f3[_0xbfc6('0x33')][_0xbfc6('0x3b')]);_0x3f5383['where']=qs[_0xbfc6('0x3c')](_[_0xbfc6('0x3d')](_0x3d67f3[_0xbfc6('0x33')],_0x18a470[_0xbfc6('0x3c')]),_0x1da590);if(_0x3d67f3[_0xbfc6('0x33')]['filter']){_0x3f5383[_0xbfc6('0x3e')]=_[_0xbfc6('0x3f')](_0x3f5383[_0xbfc6('0x3e')],{'$or':_['map'](_0x1da590,function(_0x35c32a){if(_0x35c32a['type']!==_0xbfc6('0x40')){var _0x244b8c={};_0x244b8c[_0x35c32a['name']]={'$like':'%'+_0x3d67f3['query'][_0xbfc6('0x41')]+'%'};return _0x244b8c;}})});}_0x3f5383=_[_0xbfc6('0x3f')]({},_0x3f5383,_0x3d67f3[_0xbfc6('0x42')]);var _0x55644d={'where':_0x3f5383[_0xbfc6('0x3e')]};return db[_0xbfc6('0x43')][_0xbfc6('0x20')](_0x55644d)[_0xbfc6('0x27')](function(_0xe21e0a){_0x56a9fc[_0xbfc6('0x20')]=_0xe21e0a;if(_0x3d67f3[_0xbfc6('0x33')]['includeAll']){_0x3f5383['include']=[{'all':!![]}];}return db[_0xbfc6('0x43')][_0xbfc6('0x44')](_0x3f5383);})[_0xbfc6('0x27')](function(_0x1d8a7d){_0x56a9fc[_0xbfc6('0x45')]=_0x1d8a7d;return _0x56a9fc;})[_0xbfc6('0x27')](respondWithFilteredResult(_0xb40e62,_0x3f5383))[_0xbfc6('0x46')](handleError(_0xb40e62,null));};exports['show']=function(_0x35b1d3,_0xd91e8a){var _0x5e894d={'raw':![],'where':{'id':_0x35b1d3[_0xbfc6('0x47')]['id']}},_0x277719={};_0x277719[_0xbfc6('0x31')]=_[_0xbfc6('0x34')](db['AnalyticCustomReport'][_0xbfc6('0x2d')]);_0x277719['query']=_[_0xbfc6('0x34')](_0x35b1d3[_0xbfc6('0x33')]);_0x277719[_0xbfc6('0x3c')]=_[_0xbfc6('0x48')](_0x277719[_0xbfc6('0x31')],_0x277719[_0xbfc6('0x33')]);_0x5e894d[_0xbfc6('0x36')]=_[_0xbfc6('0x48')](_0x277719['model'],qs[_0xbfc6('0x35')](_0x35b1d3[_0xbfc6('0x33')][_0xbfc6('0x35')]));_0x5e894d[_0xbfc6('0x36')]=_0x5e894d[_0xbfc6('0x36')][_0xbfc6('0x37')]?_0x5e894d['attributes']:_0x277719[_0xbfc6('0x31')];if(_0x35b1d3[_0xbfc6('0x33')][_0xbfc6('0x49')]){_0x5e894d[_0xbfc6('0x4a')]=[{'all':!![]}];}_0x5e894d=_[_0xbfc6('0x3f')]({},_0x5e894d,_0x35b1d3[_0xbfc6('0x42')]);return db[_0xbfc6('0x43')]['find'](_0x5e894d)[_0xbfc6('0x27')](handleEntityNotFound(_0xd91e8a,null))['then'](respondWithResult(_0xd91e8a,null))[_0xbfc6('0x46')](handleError(_0xd91e8a,null));};exports[_0xbfc6('0x4b')]=function(_0x3a5831,_0x6c4ae9){return db[_0xbfc6('0x43')][_0xbfc6('0x4b')](_0x3a5831[_0xbfc6('0x4c')],{})[_0xbfc6('0x27')](function(_0x49a687){var _0x5a5453=_0x3a5831[_0xbfc6('0x4d')]['get']({'plain':!![]});if(!_0x5a5453)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a5453[_0xbfc6('0x4e')]===_0xbfc6('0x4d')){var _0x1416a8=_0x49a687['get']({'plain':!![]});var _0x5e5e76=_0xbfc6('0x4f');return db[_0xbfc6('0x50')]['find']({'where':{'name':_0x5e5e76,'userProfileId':_0x5a5453[_0xbfc6('0x51')]},'raw':!![]})['then'](function(_0x1815b5){if(_0x1815b5&&_0x1815b5['autoAssociation']===0x0){return db[_0xbfc6('0x52')]['create']({'name':_0x1416a8[_0xbfc6('0x2a')],'resourceId':_0x1416a8['id'],'type':_0xbfc6('0x53'),'sectionId':_0x1815b5['id']},{})[_0xbfc6('0x27')](function(){return _0x49a687;});}else{return _0x49a687;}})['catch'](function(_0x368330){logger[_0xbfc6('0x29')](_0xbfc6('0x54'),_0x368330);throw _0x368330;});}return _0x49a687;})[_0xbfc6('0x27')](respondWithResult(_0x6c4ae9,0xc9))['catch'](handleError(_0x6c4ae9,null));};exports['update']=function(_0x13f984,_0x43e8b8){if(_0x13f984[_0xbfc6('0x4c')]['id']){delete _0x13f984[_0xbfc6('0x4c')]['id'];}return db[_0xbfc6('0x43')]['find']({'where':{'id':_0x13f984['params']['id']}})[_0xbfc6('0x27')](handleEntityNotFound(_0x43e8b8,null))[_0xbfc6('0x27')](saveUpdates(_0x13f984[_0xbfc6('0x4c')],null))['then'](respondWithResult(_0x43e8b8,null))[_0xbfc6('0x46')](handleError(_0x43e8b8,null));};exports[_0xbfc6('0x55')]=function(_0x1767d2,_0x24ede0){return db[_0xbfc6('0x43')][_0xbfc6('0x56')]({'where':{'id':_0x1767d2[_0xbfc6('0x47')]['id']}})['then'](handleEntityNotFound(_0x24ede0,null))[_0xbfc6('0x27')](removeEntity(_0x24ede0,null))[_0xbfc6('0x46')](handleError(_0x24ede0,null));};exports[_0xbfc6('0x57')]=function(_0x206278,_0x26a376){var _0x20e6dc=0xa;var _0x1fae95=[_0xbfc6('0x58'),_0xbfc6('0x59'),_0xbfc6('0x5a'),_0xbfc6('0x5b')];var _0x1286b7={'SUM':_0xbfc6('0x5c'),'COUNT':_0xbfc6('0x5d'),'COUNT DISTINCT':_0xbfc6('0x5e'),'MAX':'MAX(%s)','MIN':_0xbfc6('0x5f'),'AVG':'AVG(%s)','GROUP_CONCAT':_0xbfc6('0x60'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xbfc6('0x61')};var _0x3810ba={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xbfc6('0x62'),'HOUR':_0xbfc6('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbfc6('0x64')};var _0x109a17=function(_0x2ac7de){return!_[_0xbfc6('0x65')]([_0xbfc6('0x66'),_0xbfc6('0x67'),_0xbfc6('0x68'),_0xbfc6('0x69')],_0x2ac7de);};var _0x437749=function(_0x4312b3){if(!_0x4312b3||!_0x4312b3[_0xbfc6('0x6a')][_0xbfc6('0x37')]){return'';}for(var _0x133408='(',_0x3a0b3c=0x0;_0x3a0b3c<_0x4312b3['rules'][_0xbfc6('0x37')];_0x3a0b3c+=0x1){_0x3a0b3c>0x0&&(_0x133408+='\x20'+_0x4312b3[_0xbfc6('0x6b')]+'\x20');_0x133408+=_0x4312b3[_0xbfc6('0x6a')][_0x3a0b3c]['group']?_0x437749(_0x4312b3[_0xbfc6('0x6a')][_0x3a0b3c][_0xbfc6('0x6c')]):_0x4312b3[_0xbfc6('0x6a')][_0x3a0b3c]['field']+'\x20'+_0x4312b3[_0xbfc6('0x6a')][_0x3a0b3c][_0xbfc6('0x6d')]+(_0x109a17(_0x4312b3[_0xbfc6('0x6a')][_0x3a0b3c][_0xbfc6('0x6d')])?'\x20'+_0x4312b3[_0xbfc6('0x6a')][_0x3a0b3c][_0xbfc6('0x6e')]:'');}return _0x133408+')';};var _0x3aeae2={'where':{'id':_0x206278['params']['id']}},_0x3fac03,_0x32d939,_0x315fdb,_0x47ed9c,_0x4782f3;_0x3aeae2=_['merge']({},_0x3aeae2,_0x206278['options']);return db[_0xbfc6('0x43')][_0xbfc6('0x56')](_0x3aeae2)[_0xbfc6('0x27')](function(_0x19debe){if(_0x19debe){_0x3fac03=_0x19debe;return _0x19debe[_0xbfc6('0x6f')]();}return null;})[_0xbfc6('0x27')](function(_0x39389e){if(_0x39389e){if(!_0x39389e['length']){throw new db[(_0xbfc6('0x70'))][(_0xbfc6('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x32d939=_0x39389e;return db[_0xbfc6('0x72')][_0xbfc6('0x44')]({'raw':!![]});}return null;})['then'](function(_0x3b58b4){if(_0x3b58b4){_0x315fdb=_[_0xbfc6('0x73')](_0x3b58b4,'id');var _0x2be7f5;var _0x797045=squel[_0xbfc6('0x74')]();_0x797045[_0xbfc6('0x75')](_0x3fac03[_0xbfc6('0x76')]);for(var _0x24830c=0x0;_0x24830c<_0x32d939[_0xbfc6('0x37')];_0x24830c+=0x1){_0x2be7f5=_0x32d939[_0x24830c][_0xbfc6('0x77')]?_0x315fdb[_0x32d939[_0x24830c][_0xbfc6('0x77')]][_0xbfc6('0x78')]:_0x32d939[_0x24830c][_0xbfc6('0x79')];_0x2be7f5=_0x32d939[_0x24830c][_0xbfc6('0x7a')]?_['replace'](_0x1286b7[_0x32d939[_0x24830c]['function']],'%s',_0x2be7f5):_0x2be7f5;_0x2be7f5=_0x32d939[_0x24830c][_0xbfc6('0x7b')]?_['replace'](_0x3810ba[_0x32d939[_0x24830c][_0xbfc6('0x7b')]],'%s',_0x2be7f5):_0x2be7f5;if(_0x32d939[_0x24830c][_0xbfc6('0x7c')]){_0x797045[_0xbfc6('0x6c')](_0x2be7f5);}_0x32d939[_0x24830c]['orderBy']&&_0x797045[_0xbfc6('0x3a')](_0x2be7f5,_0x32d939[_0x24830c][_0xbfc6('0x7d')]===_0xbfc6('0x7e')?![]:!![]);_0x797045[_0xbfc6('0x79')](_0x2be7f5,_0x32d939[_0x24830c][_0xbfc6('0x7f')]||_0x2be7f5);}if(_0x3fac03[_0xbfc6('0x80')]){_0x3fac03['joins']=JSON[_0xbfc6('0x81')](_0x3fac03[_0xbfc6('0x80')]);for(var _0x3b17cf=0x0;_0x3b17cf<_0x3fac03[_0xbfc6('0x80')][_0xbfc6('0x37')];_0x3b17cf+=0x1){if(_0x3fac03[_0xbfc6('0x80')][_0x3b17cf][_0xbfc6('0x2f')]&&_['includes'](_0x1fae95,_0x3fac03[_0xbfc6('0x80')][_0x3b17cf][_0xbfc6('0x2f')])&&_0x3fac03[_0xbfc6('0x80')][_0x3b17cf][_0xbfc6('0x82')]&&_0x3fac03['joins'][_0x3b17cf]['foreignTable']&&_0x3fac03[_0xbfc6('0x80')][_0x3b17cf][_0xbfc6('0x83')]){_0x797045[_0x3fac03[_0xbfc6('0x80')][_0x3b17cf][_0xbfc6('0x2f')]](_0x3fac03[_0xbfc6('0x80')][_0x3b17cf][_0xbfc6('0x84')],null,util[_0xbfc6('0x7b')](_0xbfc6('0x85'),_0x3fac03['table'],_0x3fac03['joins'][_0x3b17cf][_0xbfc6('0x82')],_0x3fac03[_0xbfc6('0x80')][_0x3b17cf]['foreignTable'],_0x3fac03[_0xbfc6('0x80')][_0x3b17cf][_0xbfc6('0x83')]));}}}if(_0x3fac03['conditions']){_0x3fac03[_0xbfc6('0x86')]=JSON[_0xbfc6('0x81')](_0x3fac03['conditions']);_0x797045[_0xbfc6('0x3e')](_0x437749(_0x3fac03['conditions'][_0xbfc6('0x6c')]));}_0x4782f3=_0x797045['clone']();_0x797045[_0xbfc6('0x1f')](_0x20e6dc);_0x797045[_0xbfc6('0x1d')](0x0);logger[_0xbfc6('0x87')](_0xbfc6('0x88'),_0x797045[_0xbfc6('0x89')]());return dbH[_0xbfc6('0x8a')]['query'](_0x797045['toString'](),{'type':dbH[_0xbfc6('0x8a')][_0xbfc6('0x8b')]['SELECT']});}})['then'](respondWithResult(_0x26a376,null))[_0xbfc6('0x46')](handleError(_0x26a376,null));};function runReport(_0xd59e15,_0xed2d4a,_0x3304df){var _0x41d11f=_0xed2d4a[_0xbfc6('0x2a')];var _0x178147=0xa;var _0x23ce9f=[_0xbfc6('0x58'),_0xbfc6('0x59'),_0xbfc6('0x5a'),_0xbfc6('0x5b')];var _0x22472e={'SUM':_0xbfc6('0x5c'),'COUNT':_0xbfc6('0x5d'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xbfc6('0x8c'),'MIN':_0xbfc6('0x5f'),'AVG':_0xbfc6('0x8d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xbfc6('0x8e'),'GROUP_CONCAT DESC':_0xbfc6('0x61')};var _0x331e4b={'SEC_TO_TIME':_0xbfc6('0x8f'),'DATE':_0xbfc6('0x62'),'HOUR':_0xbfc6('0x63'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbfc6('0x64')};var _0x2359af=function(_0x11aee5){return!_[_0xbfc6('0x65')]([_0xbfc6('0x66'),'IS\x20NOT\x20NULL',_0xbfc6('0x68'),_0xbfc6('0x69')],_0x11aee5);};var _0x104808=function(_0x3c73ed){if(!_0x3c73ed||!_0x3c73ed[_0xbfc6('0x6a')]['length']){return'';}for(var _0x16f0f8='(',_0x50772c=0x0;_0x50772c<_0x3c73ed['rules'][_0xbfc6('0x37')];_0x50772c+=0x1){_0x50772c>0x0&&(_0x16f0f8+='\x20'+_0x3c73ed['operator']+'\x20');_0x16f0f8+=_0x3c73ed[_0xbfc6('0x6a')][_0x50772c][_0xbfc6('0x6c')]?_0x104808(_0x3c73ed[_0xbfc6('0x6a')][_0x50772c]['group']):_0x3c73ed[_0xbfc6('0x6a')][_0x50772c][_0xbfc6('0x79')]+'\x20'+_0x3c73ed[_0xbfc6('0x6a')][_0x50772c][_0xbfc6('0x6d')]+(_0x2359af(_0x3c73ed[_0xbfc6('0x6a')][_0x50772c][_0xbfc6('0x6d')])?'\x20'+_0x3c73ed['rules'][_0x50772c][_0xbfc6('0x6e')]:'');}return _0x16f0f8+')';};var _0x16bee6={'where':{'id':_0xd59e15['id']}},_0x4e14a4,_0x4abd83,_0x497dba,_0x268bff,_0x377494;_0x16bee6=_[_0xbfc6('0x3f')]({},_0x16bee6,_0x3304df);return db[_0xbfc6('0x43')][_0xbfc6('0x56')](_0x16bee6)[_0xbfc6('0x27')](function(_0xeb77af){if(_0xeb77af){_0x4e14a4=_0xeb77af;return _0xeb77af['getFields']();}return null;})[_0xbfc6('0x27')](function(_0x13a53c){if(_0x13a53c){if(!_0x13a53c[_0xbfc6('0x37')]){throw new db[(_0xbfc6('0x70'))][(_0xbfc6('0x71'))](_0xbfc6('0x90'),0x193);}_0x4abd83=_0x13a53c;return db[_0xbfc6('0x72')][_0xbfc6('0x44')]({'raw':!![]});}return null;})['then'](function(_0x146b09){if(_0x146b09){_0x497dba=_[_0xbfc6('0x73')](_0x146b09,'id');var _0x335746;var _0x3b00fd=squel[_0xbfc6('0x74')]();_0x3b00fd[_0xbfc6('0x75')](_0x4e14a4[_0xbfc6('0x76')]);for(var _0xbcabc=0x0;_0xbcabc<_0x4abd83[_0xbfc6('0x37')];_0xbcabc+=0x1){_0x335746=_0x4abd83[_0xbcabc][_0xbfc6('0x77')]?_0x497dba[_0x4abd83[_0xbcabc][_0xbfc6('0x77')]][_0xbfc6('0x78')]:_0x4abd83[_0xbcabc][_0xbfc6('0x79')];_0x335746=_0x4abd83[_0xbcabc][_0xbfc6('0x7a')]?_[_0xbfc6('0x91')](_0x22472e[_0x4abd83[_0xbcabc]['function']],'%s',_0x335746):_0x335746;_0x335746=_0x4abd83[_0xbcabc][_0xbfc6('0x7b')]?_[_0xbfc6('0x91')](_0x331e4b[_0x4abd83[_0xbcabc][_0xbfc6('0x7b')]],'%s',_0x335746):_0x335746;if(_0x4abd83[_0xbcabc][_0xbfc6('0x7c')]){_0x3b00fd[_0xbfc6('0x6c')](_0x335746);}_0x4abd83[_0xbcabc]['orderBy']&&_0x3b00fd[_0xbfc6('0x3a')](_0x335746,_0x4abd83[_0xbcabc][_0xbfc6('0x7d')]===_0xbfc6('0x7e')?![]:!![]);_0x3b00fd[_0xbfc6('0x79')](_0x335746,_0x4abd83[_0xbcabc]['alias']||_0x335746);}if(_0x4e14a4[_0xbfc6('0x80')]){_0x4e14a4[_0xbfc6('0x80')]=JSON['parse'](_0x4e14a4[_0xbfc6('0x80')]);for(var _0x360a7a=0x0;_0x360a7a<_0x4e14a4[_0xbfc6('0x80')]['length'];_0x360a7a+=0x1){if(_0x4e14a4[_0xbfc6('0x80')][_0x360a7a][_0xbfc6('0x2f')]&&_[_0xbfc6('0x65')](_0x23ce9f,_0x4e14a4['joins'][_0x360a7a][_0xbfc6('0x2f')])&&_0x4e14a4[_0xbfc6('0x80')][_0x360a7a]['parentKey']&&_0x4e14a4['joins'][_0x360a7a][_0xbfc6('0x84')]&&_0x4e14a4[_0xbfc6('0x80')][_0x360a7a]['foreignKey']){_0x3b00fd[_0x4e14a4['joins'][_0x360a7a][_0xbfc6('0x2f')]](_0x4e14a4[_0xbfc6('0x80')][_0x360a7a][_0xbfc6('0x84')],null,util[_0xbfc6('0x7b')](_0xbfc6('0x85'),_0x4e14a4[_0xbfc6('0x76')],_0x4e14a4[_0xbfc6('0x80')][_0x360a7a][_0xbfc6('0x82')],_0x4e14a4[_0xbfc6('0x80')][_0x360a7a]['foreignTable'],_0x4e14a4[_0xbfc6('0x80')][_0x360a7a]['foreignKey']));}}}if(_0x4e14a4[_0xbfc6('0x86')]){_0x4e14a4[_0xbfc6('0x86')]=JSON[_0xbfc6('0x81')](_0x4e14a4[_0xbfc6('0x86')]);_0x3b00fd['where'](_0x104808(_0x4e14a4[_0xbfc6('0x86')][_0xbfc6('0x6c')]));}_0x377494=_0x3b00fd[_0xbfc6('0x92')]();_0x3b00fd[_0xbfc6('0x1f')](_0x178147);_0x3b00fd[_0xbfc6('0x1d')](0x0);return;}})[_0xbfc6('0x27')](function(){if(_0xed2d4a[_0xbfc6('0x93')]===_0xbfc6('0x94')){return null;}var _0x5dbebd=_['merge'](_0xed2d4a,{'name':_0xed2d4a[_0xbfc6('0x95')]||_0xed2d4a['name']||_0x4e14a4[_0xbfc6('0x2a')],'basename':_0x41d11f,'savename':util['format'](_0xbfc6('0x96'),_0xed2d4a[_0xbfc6('0x2a')]||_0x4e14a4[_0xbfc6('0x2a')],require(_0xbfc6('0x97'))[_0xbfc6('0x98')](0x4),_0xed2d4a[_0xbfc6('0x93')]||_0xbfc6('0x99')),'reportId':_0x4e14a4['id'],'reportType':'custom'});return db[_0xbfc6('0x9a')][_0xbfc6('0x4b')](_0x5dbebd,{'raw':!![]});})[_0xbfc6('0x27')](function(_0x254b9e){if(_0x4e14a4['table']==='cdr'){_0x377494[_0xbfc6('0x3e')](_0x4e14a4[_0xbfc6('0x76')]+_0xbfc6('0x9b'),_0xed2d4a[_0xbfc6('0x9c')],_0xed2d4a['endDate']);}else{_0x377494[_0xbfc6('0x3e')](_0x4e14a4[_0xbfc6('0x76')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xed2d4a[_0xbfc6('0x9c')],_0xed2d4a['endDate']);}if(_0x254b9e){logger[_0xbfc6('0x9d')]('Run\x20Query:',_0x377494[_0xbfc6('0x89')]());require('child_process')[_0xbfc6('0x9e')](path[_0xbfc6('0x58')](__dirname,_0xbfc6('0x9f'),_0x254b9e[_0xbfc6('0x93')]),[_0x254b9e['id'],_0x377494[_0xbfc6('0x89')](),path['join'](__dirname,'../../files/reports',_0x254b9e[_0xbfc6('0xa0')]),_0x41d11f]);return _0x254b9e;}else{var _0x512405=squel[_0xbfc6('0x74')]();_0x512405[_0xbfc6('0x75')]('('+_0x377494[_0xbfc6('0x89')]()+')',_0xbfc6('0xa1'));_0x512405['field'](_0xbfc6('0xa2'),_0xbfc6('0x20'));_0x377494[_0xbfc6('0x1f')](_0xed2d4a[_0xbfc6('0x1f')]||_0x178147);_0x377494[_0xbfc6('0x1d')](_0xed2d4a[_0xbfc6('0x1d')]||0x0);return dbH['sequelize'][_0xbfc6('0x33')](_0x512405[_0xbfc6('0x89')](),{'type':dbH[_0xbfc6('0x8a')]['QueryTypes']['SELECT']})[_0xbfc6('0x27')](function(_0xf989c2){if(!_0xf989c2[_0xbfc6('0x37')]){_0x268bff=0x0;}else{_0x268bff=_0xf989c2[0x0][_0xbfc6('0x20')]||0x0;}return dbH['sequelize'][_0xbfc6('0x33')](_0x377494[_0xbfc6('0x89')](),{'type':dbH['sequelize'][_0xbfc6('0x8b')][_0xbfc6('0xa3')]});})[_0xbfc6('0x27')](function(_0x21395){return{'rows':_0x21395||[],'count':_0x268bff};});}});}exports['run']=function(_0x14ccca,_0x4158d6){return runReport(_0x14ccca[_0xbfc6('0x47')],_0x14ccca[_0xbfc6('0x33')],_0x14ccca[_0xbfc6('0x42')])['then'](respondWithResult(_0x4158d6,null))[_0xbfc6('0x46')](handleError(_0x4158d6,null));};exports[_0xbfc6('0xa4')]=runReport;exports[_0xbfc6('0x33')]=function(_0x56a475,_0x2a7435){var _0x4bbbd0=0xa;var _0x66a0b1=[_0xbfc6('0x58'),_0xbfc6('0x59'),'right_join','cross_join'];var _0x2a55e5={'SUM':'SUM(%s)','COUNT':_0xbfc6('0x5d'),'COUNT DISTINCT':_0xbfc6('0x5e'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xbfc6('0x8d'),'GROUP_CONCAT':_0xbfc6('0x60'),'GROUP_CONCAT ASC':_0xbfc6('0x8e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5802a0={'SEC_TO_TIME':_0xbfc6('0x8f'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xbfc6('0x64')};var _0x40bc41=function(_0x2bf6ff){return!_[_0xbfc6('0x65')](['IS\x20NULL',_0xbfc6('0x67'),_0xbfc6('0x68'),'IS\x20NOT\x20EMPTY'],_0x2bf6ff);};var _0x103c8a=function(_0x45930b){if(!_0x45930b||!_0x45930b[_0xbfc6('0x6a')][_0xbfc6('0x37')]){return'';}for(var _0x4410ee='(',_0x544cab=0x0;_0x544cab<_0x45930b[_0xbfc6('0x6a')]['length'];_0x544cab+=0x1){_0x544cab>0x0&&(_0x4410ee+='\x20'+_0x45930b['operator']+'\x20');_0x4410ee+=_0x45930b[_0xbfc6('0x6a')][_0x544cab][_0xbfc6('0x6c')]?_0x103c8a(_0x45930b[_0xbfc6('0x6a')][_0x544cab][_0xbfc6('0x6c')]):_0x45930b[_0xbfc6('0x6a')][_0x544cab][_0xbfc6('0x79')]+'\x20'+_0x45930b[_0xbfc6('0x6a')][_0x544cab]['condition']+(_0x40bc41(_0x45930b[_0xbfc6('0x6a')][_0x544cab][_0xbfc6('0x6d')])?'\x20'+_0x45930b['rules'][_0x544cab][_0xbfc6('0x6e')]:'');}return _0x4410ee+')';};var _0x3c2bb0={'where':{'id':_0x56a475[_0xbfc6('0x47')]['id']}},_0x2673cb,_0x4d33bf,_0x18db1d,_0x34d62c,_0x198f4b;_0x3c2bb0=_[_0xbfc6('0x3f')]({},_0x3c2bb0,_0x56a475['options']);return db['AnalyticCustomReport'][_0xbfc6('0x56')](_0x3c2bb0)['then'](function(_0x49b54c){if(_0x49b54c){_0x2673cb=_0x49b54c;return _0x49b54c[_0xbfc6('0x6f')]();}return null;})[_0xbfc6('0x27')](function(_0x5b1c26){if(_0x5b1c26){if(!_0x5b1c26['length']){throw new db[(_0xbfc6('0x70'))][(_0xbfc6('0x71'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4d33bf=_0x5b1c26;return db[_0xbfc6('0x72')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x5eb10b){if(_0x5eb10b){_0x18db1d=_[_0xbfc6('0x73')](_0x5eb10b,'id');var _0x49ac22;var _0x31a7bc=squel[_0xbfc6('0x74')]();_0x31a7bc[_0xbfc6('0x75')](_0x2673cb[_0xbfc6('0x76')]);for(var _0x6fb2bd=0x0;_0x6fb2bd<_0x4d33bf['length'];_0x6fb2bd+=0x1){_0x49ac22=_0x4d33bf[_0x6fb2bd][_0xbfc6('0x77')]?_0x18db1d[_0x4d33bf[_0x6fb2bd][_0xbfc6('0x77')]][_0xbfc6('0x78')]:_0x4d33bf[_0x6fb2bd]['field'];_0x49ac22=_0x4d33bf[_0x6fb2bd][_0xbfc6('0x7a')]?_[_0xbfc6('0x91')](_0x2a55e5[_0x4d33bf[_0x6fb2bd]['function']],'%s',_0x49ac22):_0x49ac22;_0x49ac22=_0x4d33bf[_0x6fb2bd][_0xbfc6('0x7b')]?_[_0xbfc6('0x91')](_0x5802a0[_0x4d33bf[_0x6fb2bd][_0xbfc6('0x7b')]],'%s',_0x49ac22):_0x49ac22;if(_0x4d33bf[_0x6fb2bd][_0xbfc6('0x7c')]){_0x31a7bc[_0xbfc6('0x6c')](_0x49ac22);}_0x4d33bf[_0x6fb2bd]['orderBy']&&_0x31a7bc['order'](_0x49ac22,_0x4d33bf[_0x6fb2bd]['orderBy']==='DESC'?![]:!![]);_0x31a7bc['field'](_0x49ac22,_0x4d33bf[_0x6fb2bd][_0xbfc6('0x7f')]||_0x49ac22);}if(_0x2673cb[_0xbfc6('0x80')]){_0x2673cb[_0xbfc6('0x80')]=JSON['parse'](_0x2673cb['joins']);for(var _0x430831=0x0;_0x430831<_0x2673cb[_0xbfc6('0x80')]['length'];_0x430831+=0x1){if(_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x2f')]&&_[_0xbfc6('0x65')](_0x66a0b1,_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x2f')])&&_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x82')]&&_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x84')]&&_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x83')]){_0x31a7bc[_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x2f')]](_0x2673cb[_0xbfc6('0x80')][_0x430831]['foreignTable'],null,util[_0xbfc6('0x7b')]('%s.%s\x20=\x20%s.%s',_0x2673cb[_0xbfc6('0x76')],_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x82')],_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x84')],_0x2673cb[_0xbfc6('0x80')][_0x430831][_0xbfc6('0x83')]));}}}if(_0x2673cb[_0xbfc6('0x86')]){_0x2673cb['conditions']=JSON[_0xbfc6('0x81')](_0x2673cb['conditions']);_0x31a7bc['where'](_0x103c8a(_0x2673cb['conditions'][_0xbfc6('0x6c')]));}_0x198f4b=_0x31a7bc[_0xbfc6('0x92')]();_0x31a7bc['limit'](_0x4bbbd0);_0x31a7bc[_0xbfc6('0x1d')](0x0);logger[_0xbfc6('0x87')](_0xbfc6('0x88'),_0x31a7bc[_0xbfc6('0x89')]());return dbH[_0xbfc6('0x8a')]['query'](_0x31a7bc['toString'](),{'type':dbH[_0xbfc6('0x8a')]['QueryTypes'][_0xbfc6('0xa3')]});}})[_0xbfc6('0x27')](function(){return{'sql':_0x198f4b[_0xbfc6('0x89')]()};})[_0xbfc6('0x27')](respondWithResult(_0x2a7435,null))[_0xbfc6('0x46')](handleError(_0x2a7435,null));}; \ No newline at end of file +var _0xd5b0=['output','web','fullPath','%s-%s.%s','randomstring','generate','csv','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','fork','../../components/export/','../../files/reports','countTable','QueryTypes','SELECT','run','runReport','left_join','COUNT(%s)','COUNT(DISTINCT\x20%s)','getFields','debug','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','CustomReports','UserProfileResource','destroy','error','name','send','index','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','count','includeAll','include','findAll','rows','catch','rawAttributes','length','create','user','get','role','Reports','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','find','params','preview','SUM(%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%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\x20NULL','IS\x20EMPTY','operator','rules','group','field','condition','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','joins','parse','type','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','Limited\x20Query:','toString','sequelize','join','right_join','cross_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','IS\x20NOT\x20EMPTY','value','ValidationErrorItem','select','alias'];(function(_0x2b2f03,_0x5d1bf9){var _0x2ebb53=function(_0x4ba391){while(--_0x4ba391){_0x2b2f03['push'](_0x2b2f03['shift']());}};_0x2ebb53(++_0x5d1bf9);}(_0xd5b0,0x16e));var _0x0d5b=function(_0x1adde8,_0x5c21f4){_0x1adde8=_0x1adde8-0x0;var _0x130c0c=_0xd5b0[_0x1adde8];return _0x130c0c;};'use strict';var emlformat=require(_0x0d5b('0x0'));var rimraf=require(_0x0d5b('0x1'));var zipdir=require(_0x0d5b('0x2'));var jsonpatch=require(_0x0d5b('0x3'));var rp=require('request-promise');var moment=require(_0x0d5b('0x4'));var BPromise=require(_0x0d5b('0x5'));var Mustache=require(_0x0d5b('0x6'));var util=require(_0x0d5b('0x7'));var path=require(_0x0d5b('0x8'));var sox=require(_0x0d5b('0x9'));var csv=require(_0x0d5b('0xa'));var ejs=require(_0x0d5b('0xb'));var fs=require('fs');var fs_extra=require(_0x0d5b('0xc'));var _=require(_0x0d5b('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0d5b('0xe'));var deskjs=require(_0x0d5b('0xf'));var toCsv=require(_0x0d5b('0xa'));var querystring=require(_0x0d5b('0x10'));var Papa=require(_0x0d5b('0x11'));var Redis=require(_0x0d5b('0x12'));var authService=require(_0x0d5b('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x0d5b('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0d5b('0x15'))(_0x0d5b('0x16'));var utils=require(_0x0d5b('0x17'));var config=require(_0x0d5b('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0d5b('0x19'))['db'];var dbH=require(_0x0d5b('0x19'))[_0x0d5b('0x1a')];function respondWithStatusCode(_0x492fee,_0x27a607){_0x27a607=_0x27a607||0xcc;return function(_0x4d5318){if(_0x4d5318){return _0x492fee[_0x0d5b('0x1b')](_0x27a607);}return _0x492fee['status'](_0x27a607)['end']();};}function respondWithResult(_0x54f76a,_0x141e6d){_0x141e6d=_0x141e6d||0xc8;return function(_0x4a14dc){if(_0x4a14dc){return _0x54f76a[_0x0d5b('0x1c')](_0x141e6d)[_0x0d5b('0x1d')](_0x4a14dc);}};}function respondWithFilteredResult(_0x981056,_0x12bb02){return function(_0x26541f){if(_0x26541f){var _0x115c11=typeof _0x12bb02[_0x0d5b('0x1e')]===_0x0d5b('0x1f')&&typeof _0x12bb02[_0x0d5b('0x20')]===_0x0d5b('0x1f');var _0x2eeb00=_0x26541f['count'];var _0x5414e7=_0x115c11?0x0:_0x12bb02[_0x0d5b('0x1e')];var _0x142bf5=_0x115c11?_0x26541f['count']:_0x12bb02[_0x0d5b('0x1e')]+_0x12bb02[_0x0d5b('0x20')];var _0x12f491;if(_0x142bf5>=_0x2eeb00){_0x142bf5=_0x2eeb00;_0x12f491=0xc8;}else{_0x12f491=0xce;}_0x981056[_0x0d5b('0x1c')](_0x12f491);return _0x981056[_0x0d5b('0x21')](_0x0d5b('0x22'),_0x5414e7+'-'+_0x142bf5+'/'+_0x2eeb00)[_0x0d5b('0x1d')](_0x26541f);}return null;};}function patchUpdates(_0x3b82bb){return function(_0x3d92ae){try{jsonpatch[_0x0d5b('0x23')](_0x3d92ae,_0x3b82bb,!![]);}catch(_0x16738b){return BPromise[_0x0d5b('0x24')](_0x16738b);}return _0x3d92ae[_0x0d5b('0x25')]();};}function saveUpdates(_0xe3a6a1,_0x27da74){return function(_0x44c1c3){if(_0x44c1c3){return _0x44c1c3['update'](_0xe3a6a1)[_0x0d5b('0x26')](function(_0x18bfef){return _0x18bfef;});}return null;};}function removeEntity(_0x17dae9,_0x1a218b){return function(_0xef6611){if(_0xef6611){return _0xef6611['destroy']()[_0x0d5b('0x26')](function(){var _0x3401c4=_0xef6611['get']({'plain':!![]});var _0x41acbd=_0x0d5b('0x27');return db[_0x0d5b('0x28')][_0x0d5b('0x29')]({'where':{'type':_0x41acbd,'resourceId':_0x3401c4['id']}})[_0x0d5b('0x26')](function(){return _0xef6611;});})[_0x0d5b('0x26')](function(){_0x17dae9[_0x0d5b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e95c6,_0x35a027){return function(_0x46a59a){if(!_0x46a59a){_0x3e95c6[_0x0d5b('0x1b')](0x194);}return _0x46a59a;};}function handleError(_0x203ba7,_0x2a1ec9){_0x2a1ec9=_0x2a1ec9||0x1f4;return function(_0x599e22){logger[_0x0d5b('0x2a')](_0x599e22['stack']);if(_0x599e22[_0x0d5b('0x2b')]){delete _0x599e22[_0x0d5b('0x2b')];}_0x203ba7[_0x0d5b('0x1c')](_0x2a1ec9)[_0x0d5b('0x2c')](_0x599e22);};}exports[_0x0d5b('0x2d')]=function(_0x3d1cf0,_0x238f63){var _0x94f2c3={},_0x48d78e={},_0x3efe2e={'count':0x0,'rows':[]};var _0x364a7a=_[_0x0d5b('0x2e')](db['AnalyticCustomReport']['rawAttributes'],function(_0x58f84e){return{'name':_0x58f84e[_0x0d5b('0x2f')],'type':_0x58f84e['type'][_0x0d5b('0x30')]};});_0x48d78e[_0x0d5b('0x31')]=_[_0x0d5b('0x2e')](_0x364a7a,'name');_0x48d78e[_0x0d5b('0x32')]=_[_0x0d5b('0x33')](_0x3d1cf0[_0x0d5b('0x32')]);_0x48d78e[_0x0d5b('0x34')]=_[_0x0d5b('0x35')](_0x48d78e[_0x0d5b('0x31')],_0x48d78e[_0x0d5b('0x32')]);_0x94f2c3[_0x0d5b('0x36')]=_[_0x0d5b('0x35')](_0x48d78e[_0x0d5b('0x31')],qs['fields'](_0x3d1cf0['query'][_0x0d5b('0x37')]));_0x94f2c3['attributes']=_0x94f2c3['attributes']['length']?_0x94f2c3[_0x0d5b('0x36')]:_0x48d78e[_0x0d5b('0x31')];if(!_0x3d1cf0[_0x0d5b('0x32')][_0x0d5b('0x38')](_0x0d5b('0x39'))){_0x94f2c3[_0x0d5b('0x20')]=qs[_0x0d5b('0x20')](_0x3d1cf0[_0x0d5b('0x32')][_0x0d5b('0x20')]);_0x94f2c3['offset']=qs[_0x0d5b('0x1e')](_0x3d1cf0[_0x0d5b('0x32')][_0x0d5b('0x1e')]);}_0x94f2c3[_0x0d5b('0x3a')]=qs[_0x0d5b('0x3b')](_0x3d1cf0['query'][_0x0d5b('0x3b')]);_0x94f2c3[_0x0d5b('0x3c')]=qs[_0x0d5b('0x34')](_[_0x0d5b('0x3d')](_0x3d1cf0[_0x0d5b('0x32')],_0x48d78e['filters']),_0x364a7a);if(_0x3d1cf0['query'][_0x0d5b('0x3e')]){_0x94f2c3[_0x0d5b('0x3c')]=_[_0x0d5b('0x3f')](_0x94f2c3[_0x0d5b('0x3c')],{'$or':_[_0x0d5b('0x2e')](_0x364a7a,function(_0x32bc2f){if(_0x32bc2f['type']!==_0x0d5b('0x40')){var _0x38f975={};_0x38f975[_0x32bc2f[_0x0d5b('0x2b')]]={'$like':'%'+_0x3d1cf0[_0x0d5b('0x32')][_0x0d5b('0x3e')]+'%'};return _0x38f975;}})});}_0x94f2c3=_[_0x0d5b('0x3f')]({},_0x94f2c3,_0x3d1cf0[_0x0d5b('0x41')]);var _0x1fa9b2={'where':_0x94f2c3['where']};return db[_0x0d5b('0x42')][_0x0d5b('0x43')](_0x1fa9b2)[_0x0d5b('0x26')](function(_0x5550d0){_0x3efe2e[_0x0d5b('0x43')]=_0x5550d0;if(_0x3d1cf0[_0x0d5b('0x32')][_0x0d5b('0x44')]){_0x94f2c3[_0x0d5b('0x45')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x0d5b('0x46')](_0x94f2c3);})[_0x0d5b('0x26')](function(_0x33afd2){_0x3efe2e[_0x0d5b('0x47')]=_0x33afd2;return _0x3efe2e;})['then'](respondWithFilteredResult(_0x238f63,_0x94f2c3))[_0x0d5b('0x48')](handleError(_0x238f63,null));};exports['show']=function(_0x88302c,_0x1ea931){var _0x4d9740={'raw':![],'where':{'id':_0x88302c['params']['id']}},_0x3df094={};_0x3df094[_0x0d5b('0x31')]=_[_0x0d5b('0x33')](db[_0x0d5b('0x42')][_0x0d5b('0x49')]);_0x3df094[_0x0d5b('0x32')]=_[_0x0d5b('0x33')](_0x88302c[_0x0d5b('0x32')]);_0x3df094[_0x0d5b('0x34')]=_[_0x0d5b('0x35')](_0x3df094[_0x0d5b('0x31')],_0x3df094[_0x0d5b('0x32')]);_0x4d9740[_0x0d5b('0x36')]=_[_0x0d5b('0x35')](_0x3df094[_0x0d5b('0x31')],qs['fields'](_0x88302c[_0x0d5b('0x32')][_0x0d5b('0x37')]));_0x4d9740[_0x0d5b('0x36')]=_0x4d9740[_0x0d5b('0x36')][_0x0d5b('0x4a')]?_0x4d9740[_0x0d5b('0x36')]:_0x3df094[_0x0d5b('0x31')];if(_0x88302c[_0x0d5b('0x32')][_0x0d5b('0x44')]){_0x4d9740[_0x0d5b('0x45')]=[{'all':!![]}];}_0x4d9740=_[_0x0d5b('0x3f')]({},_0x4d9740,_0x88302c[_0x0d5b('0x41')]);return db[_0x0d5b('0x42')]['find'](_0x4d9740)[_0x0d5b('0x26')](handleEntityNotFound(_0x1ea931,null))[_0x0d5b('0x26')](respondWithResult(_0x1ea931,null))[_0x0d5b('0x48')](handleError(_0x1ea931,null));};exports[_0x0d5b('0x4b')]=function(_0x4a5aec,_0x2e6a1b){return db[_0x0d5b('0x42')]['create'](_0x4a5aec['body'],{})[_0x0d5b('0x26')](function(_0x7bec64){var _0x5018d0=_0x4a5aec[_0x0d5b('0x4c')][_0x0d5b('0x4d')]({'plain':!![]});if(!_0x5018d0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5018d0[_0x0d5b('0x4e')]===_0x0d5b('0x4c')){var _0x4fccc2=_0x7bec64[_0x0d5b('0x4d')]({'plain':!![]});var _0x3390bf=_0x0d5b('0x4f');return db[_0x0d5b('0x50')]['find']({'where':{'name':_0x3390bf,'userProfileId':_0x5018d0[_0x0d5b('0x51')]},'raw':!![]})[_0x0d5b('0x26')](function(_0x2f304a){if(_0x2f304a&&_0x2f304a[_0x0d5b('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0x4fccc2['name'],'resourceId':_0x4fccc2['id'],'type':'CustomReports','sectionId':_0x2f304a['id']},{})['then'](function(){return _0x7bec64;});}else{return _0x7bec64;}})[_0x0d5b('0x48')](function(_0x46b42f){logger['error'](_0x0d5b('0x53'),_0x46b42f);throw _0x46b42f;});}return _0x7bec64;})['then'](respondWithResult(_0x2e6a1b,0xc9))[_0x0d5b('0x48')](handleError(_0x2e6a1b,null));};exports[_0x0d5b('0x54')]=function(_0x1cce54,_0x489fa0){if(_0x1cce54[_0x0d5b('0x55')]['id']){delete _0x1cce54[_0x0d5b('0x55')]['id'];}return db[_0x0d5b('0x42')][_0x0d5b('0x56')]({'where':{'id':_0x1cce54[_0x0d5b('0x57')]['id']}})[_0x0d5b('0x26')](handleEntityNotFound(_0x489fa0,null))['then'](saveUpdates(_0x1cce54[_0x0d5b('0x55')],null))[_0x0d5b('0x26')](respondWithResult(_0x489fa0,null))['catch'](handleError(_0x489fa0,null));};exports[_0x0d5b('0x29')]=function(_0x1c2f3e,_0x2b2f81){return db[_0x0d5b('0x42')][_0x0d5b('0x56')]({'where':{'id':_0x1c2f3e[_0x0d5b('0x57')]['id']}})['then'](handleEntityNotFound(_0x2b2f81,null))['then'](removeEntity(_0x2b2f81,null))['catch'](handleError(_0x2b2f81,null));};exports[_0x0d5b('0x58')]=function(_0x59e308,_0x40e915){var _0x4c40e6=0xa;var _0x84f091=['join','left_join','right_join','cross_join'];var _0x362c8a={'SUM':_0x0d5b('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x0d5b('0x5a'),'MIN':_0x0d5b('0x5b'),'AVG':_0x0d5b('0x5c'),'GROUP_CONCAT':_0x0d5b('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0d5b('0x5e')};var _0x84c09={'SEC_TO_TIME':_0x0d5b('0x5f'),'DATE':_0x0d5b('0x60'),'HOUR':'HOUR(%s)','ROUND':_0x0d5b('0x61'),'UNIX_TIMESTAMP':_0x0d5b('0x62')};var _0x296779=function(_0x235186){return!_[_0x0d5b('0x63')]([_0x0d5b('0x64'),_0x0d5b('0x65'),_0x0d5b('0x66'),'IS\x20NOT\x20EMPTY'],_0x235186);};var _0xe7a090=function(_0x472f4d){if(!_0x472f4d||!_0x472f4d['rules'][_0x0d5b('0x4a')]){return'';}for(var _0x45998b='(',_0x1a6b9b=0x0;_0x1a6b9b<_0x472f4d['rules'][_0x0d5b('0x4a')];_0x1a6b9b+=0x1){_0x1a6b9b>0x0&&(_0x45998b+='\x20'+_0x472f4d[_0x0d5b('0x67')]+'\x20');_0x45998b+=_0x472f4d[_0x0d5b('0x68')][_0x1a6b9b][_0x0d5b('0x69')]?_0xe7a090(_0x472f4d[_0x0d5b('0x68')][_0x1a6b9b][_0x0d5b('0x69')]):_0x472f4d[_0x0d5b('0x68')][_0x1a6b9b][_0x0d5b('0x6a')]+'\x20'+_0x472f4d[_0x0d5b('0x68')][_0x1a6b9b][_0x0d5b('0x6b')]+(_0x296779(_0x472f4d[_0x0d5b('0x68')][_0x1a6b9b][_0x0d5b('0x6b')])?'\x20'+_0x472f4d[_0x0d5b('0x68')][_0x1a6b9b]['value']:'');}return _0x45998b+')';};var _0x20aa2d={'where':{'id':_0x59e308['params']['id']}},_0x21a5ec,_0x1a62d6,_0x261e51,_0x5efcaa,_0x21cdf9;_0x20aa2d=_[_0x0d5b('0x3f')]({},_0x20aa2d,_0x59e308[_0x0d5b('0x41')]);return db[_0x0d5b('0x42')][_0x0d5b('0x56')](_0x20aa2d)['then'](function(_0x53a252){if(_0x53a252){_0x21a5ec=_0x53a252;return _0x53a252['getFields']();}return null;})[_0x0d5b('0x26')](function(_0x3f2cc9){if(_0x3f2cc9){if(!_0x3f2cc9[_0x0d5b('0x4a')]){throw new db[(_0x0d5b('0x6c'))]['ValidationErrorItem'](_0x0d5b('0x6d'),0x193);}_0x1a62d6=_0x3f2cc9;return db[_0x0d5b('0x6e')][_0x0d5b('0x46')]({'raw':!![]});}return null;})['then'](function(_0x16d3bd){if(_0x16d3bd){_0x261e51=_[_0x0d5b('0x6f')](_0x16d3bd,'id');var _0x1b6123;var _0x3ac2e5=squel['select']();_0x3ac2e5[_0x0d5b('0x70')](_0x21a5ec[_0x0d5b('0x71')]);for(var _0xef2771=0x0;_0xef2771<_0x1a62d6['length'];_0xef2771+=0x1){_0x1b6123=_0x1a62d6[_0xef2771][_0x0d5b('0x72')]?_0x261e51[_0x1a62d6[_0xef2771][_0x0d5b('0x72')]][_0x0d5b('0x73')]:_0x1a62d6[_0xef2771][_0x0d5b('0x6a')];_0x1b6123=_0x1a62d6[_0xef2771][_0x0d5b('0x74')]?_[_0x0d5b('0x75')](_0x362c8a[_0x1a62d6[_0xef2771]['function']],'%s',_0x1b6123):_0x1b6123;_0x1b6123=_0x1a62d6[_0xef2771][_0x0d5b('0x76')]?_[_0x0d5b('0x75')](_0x84c09[_0x1a62d6[_0xef2771][_0x0d5b('0x76')]],'%s',_0x1b6123):_0x1b6123;if(_0x1a62d6[_0xef2771][_0x0d5b('0x77')]){_0x3ac2e5[_0x0d5b('0x69')](_0x1b6123);}_0x1a62d6[_0xef2771][_0x0d5b('0x78')]&&_0x3ac2e5['order'](_0x1b6123,_0x1a62d6[_0xef2771][_0x0d5b('0x78')]===_0x0d5b('0x79')?![]:!![]);_0x3ac2e5['field'](_0x1b6123,_0x1a62d6[_0xef2771]['alias']||_0x1b6123);}if(_0x21a5ec[_0x0d5b('0x7a')]){_0x21a5ec[_0x0d5b('0x7a')]=JSON[_0x0d5b('0x7b')](_0x21a5ec[_0x0d5b('0x7a')]);for(var _0x49c8df=0x0;_0x49c8df<_0x21a5ec[_0x0d5b('0x7a')]['length'];_0x49c8df+=0x1){if(_0x21a5ec['joins'][_0x49c8df][_0x0d5b('0x7c')]&&_[_0x0d5b('0x63')](_0x84f091,_0x21a5ec['joins'][_0x49c8df][_0x0d5b('0x7c')])&&_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df][_0x0d5b('0x7d')]&&_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df][_0x0d5b('0x7e')]&&_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df][_0x0d5b('0x7f')]){_0x3ac2e5[_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df]['type']](_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df][_0x0d5b('0x7e')],null,util[_0x0d5b('0x76')](_0x0d5b('0x80'),_0x21a5ec['table'],_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df]['parentKey'],_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df]['foreignTable'],_0x21a5ec[_0x0d5b('0x7a')][_0x49c8df][_0x0d5b('0x7f')]));}}}if(_0x21a5ec[_0x0d5b('0x81')]){_0x21a5ec[_0x0d5b('0x81')]=JSON[_0x0d5b('0x7b')](_0x21a5ec[_0x0d5b('0x81')]);_0x3ac2e5[_0x0d5b('0x3c')](_0xe7a090(_0x21a5ec[_0x0d5b('0x81')][_0x0d5b('0x69')]));}_0x21cdf9=_0x3ac2e5[_0x0d5b('0x82')]();_0x3ac2e5[_0x0d5b('0x20')](_0x4c40e6);_0x3ac2e5['offset'](0x0);logger['debug'](_0x0d5b('0x83'),_0x3ac2e5[_0x0d5b('0x84')]());return dbH[_0x0d5b('0x85')]['query'](_0x3ac2e5[_0x0d5b('0x84')](),{'type':dbH[_0x0d5b('0x85')]['QueryTypes']['SELECT']});}})[_0x0d5b('0x26')](respondWithResult(_0x40e915,null))['catch'](handleError(_0x40e915,null));};function runReport(_0x228fab,_0x4bea7f,_0x30f175){var _0x6fee9a=_0x4bea7f[_0x0d5b('0x2b')];var _0x1a058a=0xa;var _0x3edfcf=[_0x0d5b('0x86'),'left_join',_0x0d5b('0x87'),_0x0d5b('0x88')];var _0x5a175a={'SUM':_0x0d5b('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x0d5b('0x5a'),'MIN':_0x0d5b('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x0d5b('0x5d'),'GROUP_CONCAT ASC':_0x0d5b('0x89'),'GROUP_CONCAT DESC':_0x0d5b('0x5e')};var _0x161602={'SEC_TO_TIME':_0x0d5b('0x5f'),'DATE':'DATE(%s)','HOUR':_0x0d5b('0x8a'),'ROUND':_0x0d5b('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x31198f=function(_0x57952d){return!_[_0x0d5b('0x63')]([_0x0d5b('0x64'),_0x0d5b('0x65'),'IS\x20EMPTY',_0x0d5b('0x8b')],_0x57952d);};var _0x4628d6=function(_0x38fbcd){if(!_0x38fbcd||!_0x38fbcd[_0x0d5b('0x68')][_0x0d5b('0x4a')]){return'';}for(var _0x13b923='(',_0x5bf374=0x0;_0x5bf374<_0x38fbcd[_0x0d5b('0x68')][_0x0d5b('0x4a')];_0x5bf374+=0x1){_0x5bf374>0x0&&(_0x13b923+='\x20'+_0x38fbcd['operator']+'\x20');_0x13b923+=_0x38fbcd[_0x0d5b('0x68')][_0x5bf374][_0x0d5b('0x69')]?_0x4628d6(_0x38fbcd['rules'][_0x5bf374]['group']):_0x38fbcd[_0x0d5b('0x68')][_0x5bf374][_0x0d5b('0x6a')]+'\x20'+_0x38fbcd[_0x0d5b('0x68')][_0x5bf374][_0x0d5b('0x6b')]+(_0x31198f(_0x38fbcd[_0x0d5b('0x68')][_0x5bf374][_0x0d5b('0x6b')])?'\x20'+_0x38fbcd[_0x0d5b('0x68')][_0x5bf374][_0x0d5b('0x8c')]:'');}return _0x13b923+')';};var _0x549718={'where':{'id':_0x228fab['id']}},_0x1a2624,_0x57ca00,_0x4c8277,_0x4b1c07,_0x4ecf3e;_0x549718=_[_0x0d5b('0x3f')]({},_0x549718,_0x30f175);return db[_0x0d5b('0x42')][_0x0d5b('0x56')](_0x549718)[_0x0d5b('0x26')](function(_0x4bde8e){if(_0x4bde8e){_0x1a2624=_0x4bde8e;return _0x4bde8e['getFields']();}return null;})[_0x0d5b('0x26')](function(_0x18b36d){if(_0x18b36d){if(!_0x18b36d[_0x0d5b('0x4a')]){throw new db['Sequelize'][(_0x0d5b('0x8d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x57ca00=_0x18b36d;return db['AnalyticMetric'][_0x0d5b('0x46')]({'raw':!![]});}return null;})['then'](function(_0x5771a0){if(_0x5771a0){_0x4c8277=_[_0x0d5b('0x6f')](_0x5771a0,'id');var _0x15d1b6;var _0x233fc9=squel[_0x0d5b('0x8e')]();_0x233fc9['from'](_0x1a2624[_0x0d5b('0x71')]);for(var _0x4a476f=0x0;_0x4a476f<_0x57ca00[_0x0d5b('0x4a')];_0x4a476f+=0x1){_0x15d1b6=_0x57ca00[_0x4a476f]['MetricId']?_0x4c8277[_0x57ca00[_0x4a476f][_0x0d5b('0x72')]][_0x0d5b('0x73')]:_0x57ca00[_0x4a476f][_0x0d5b('0x6a')];_0x15d1b6=_0x57ca00[_0x4a476f][_0x0d5b('0x74')]?_['replace'](_0x5a175a[_0x57ca00[_0x4a476f][_0x0d5b('0x74')]],'%s',_0x15d1b6):_0x15d1b6;_0x15d1b6=_0x57ca00[_0x4a476f][_0x0d5b('0x76')]?_[_0x0d5b('0x75')](_0x161602[_0x57ca00[_0x4a476f][_0x0d5b('0x76')]],'%s',_0x15d1b6):_0x15d1b6;if(_0x57ca00[_0x4a476f][_0x0d5b('0x77')]){_0x233fc9[_0x0d5b('0x69')](_0x15d1b6);}_0x57ca00[_0x4a476f][_0x0d5b('0x78')]&&_0x233fc9['order'](_0x15d1b6,_0x57ca00[_0x4a476f][_0x0d5b('0x78')]==='DESC'?![]:!![]);_0x233fc9['field'](_0x15d1b6,_0x57ca00[_0x4a476f][_0x0d5b('0x8f')]||_0x15d1b6);}if(_0x1a2624['joins']){_0x1a2624[_0x0d5b('0x7a')]=JSON['parse'](_0x1a2624['joins']);for(var _0x369711=0x0;_0x369711<_0x1a2624[_0x0d5b('0x7a')][_0x0d5b('0x4a')];_0x369711+=0x1){if(_0x1a2624['joins'][_0x369711][_0x0d5b('0x7c')]&&_[_0x0d5b('0x63')](_0x3edfcf,_0x1a2624['joins'][_0x369711][_0x0d5b('0x7c')])&&_0x1a2624['joins'][_0x369711][_0x0d5b('0x7d')]&&_0x1a2624[_0x0d5b('0x7a')][_0x369711]['foreignTable']&&_0x1a2624[_0x0d5b('0x7a')][_0x369711][_0x0d5b('0x7f')]){_0x233fc9[_0x1a2624['joins'][_0x369711][_0x0d5b('0x7c')]](_0x1a2624[_0x0d5b('0x7a')][_0x369711][_0x0d5b('0x7e')],null,util[_0x0d5b('0x76')](_0x0d5b('0x80'),_0x1a2624[_0x0d5b('0x71')],_0x1a2624[_0x0d5b('0x7a')][_0x369711][_0x0d5b('0x7d')],_0x1a2624[_0x0d5b('0x7a')][_0x369711][_0x0d5b('0x7e')],_0x1a2624[_0x0d5b('0x7a')][_0x369711][_0x0d5b('0x7f')]));}}}if(_0x1a2624[_0x0d5b('0x81')]){_0x1a2624['conditions']=JSON['parse'](_0x1a2624[_0x0d5b('0x81')]);_0x233fc9[_0x0d5b('0x3c')](_0x4628d6(_0x1a2624[_0x0d5b('0x81')][_0x0d5b('0x69')]));}_0x4ecf3e=_0x233fc9[_0x0d5b('0x82')]();_0x233fc9[_0x0d5b('0x20')](_0x1a058a);_0x233fc9[_0x0d5b('0x1e')](0x0);return;}})[_0x0d5b('0x26')](function(){if(_0x4bea7f[_0x0d5b('0x90')]===_0x0d5b('0x91')){return null;}var _0x55031b=_[_0x0d5b('0x3f')](_0x4bea7f,{'name':_0x4bea7f[_0x0d5b('0x92')]||_0x4bea7f['name']||_0x1a2624[_0x0d5b('0x2b')],'basename':_0x6fee9a,'savename':util[_0x0d5b('0x76')](_0x0d5b('0x93'),_0x4bea7f[_0x0d5b('0x2b')]||_0x1a2624[_0x0d5b('0x2b')],require(_0x0d5b('0x94'))[_0x0d5b('0x95')](0x4),_0x4bea7f[_0x0d5b('0x90')]||_0x0d5b('0x96')),'reportId':_0x1a2624['id'],'reportType':'custom'});return db['AnalyticExtractedReport'][_0x0d5b('0x4b')](_0x55031b,{'raw':!![]});})[_0x0d5b('0x26')](function(_0x32b69c){if(_0x1a2624['table']==='cdr'){_0x4ecf3e[_0x0d5b('0x3c')](_0x1a2624['table']+_0x0d5b('0x97'),_0x4bea7f[_0x0d5b('0x98')],_0x4bea7f[_0x0d5b('0x99')]);}else{_0x4ecf3e[_0x0d5b('0x3c')](_0x1a2624[_0x0d5b('0x71')]+_0x0d5b('0x9a'),_0x4bea7f[_0x0d5b('0x98')],_0x4bea7f[_0x0d5b('0x99')]);}if(_0x32b69c){logger[_0x0d5b('0x9b')]('Run\x20Query:',_0x4ecf3e[_0x0d5b('0x84')]());require(_0x0d5b('0x9c'))[_0x0d5b('0x9d')](path[_0x0d5b('0x86')](__dirname,_0x0d5b('0x9e'),_0x32b69c[_0x0d5b('0x90')]),[_0x32b69c['id'],_0x4ecf3e[_0x0d5b('0x84')](),path['join'](__dirname,_0x0d5b('0x9f'),_0x32b69c['savename']),_0x6fee9a]);return _0x32b69c;}else{var _0x3e13bf=squel[_0x0d5b('0x8e')]();_0x3e13bf[_0x0d5b('0x70')]('('+_0x4ecf3e[_0x0d5b('0x84')]()+')',_0x0d5b('0xa0'));_0x3e13bf[_0x0d5b('0x6a')]('COUNT(*)','count');_0x4ecf3e[_0x0d5b('0x20')](_0x4bea7f[_0x0d5b('0x20')]||_0x1a058a);_0x4ecf3e[_0x0d5b('0x1e')](_0x4bea7f[_0x0d5b('0x1e')]||0x0);return dbH[_0x0d5b('0x85')][_0x0d5b('0x32')](_0x3e13bf[_0x0d5b('0x84')](),{'type':dbH['sequelize'][_0x0d5b('0xa1')]['SELECT']})[_0x0d5b('0x26')](function(_0x290efc){if(!_0x290efc['length']){_0x4b1c07=0x0;}else{_0x4b1c07=_0x290efc[0x0]['count']||0x0;}return dbH['sequelize']['query'](_0x4ecf3e[_0x0d5b('0x84')](),{'type':dbH[_0x0d5b('0x85')]['QueryTypes'][_0x0d5b('0xa2')]});})[_0x0d5b('0x26')](function(_0x1dfaa7){return{'rows':_0x1dfaa7||[],'count':_0x4b1c07};});}});}exports[_0x0d5b('0xa3')]=function(_0x20a2f6,_0x574246){return runReport(_0x20a2f6[_0x0d5b('0x57')],_0x20a2f6['query'],_0x20a2f6[_0x0d5b('0x41')])['then'](respondWithResult(_0x574246,null))[_0x0d5b('0x48')](handleError(_0x574246,null));};exports[_0x0d5b('0xa4')]=runReport;exports[_0x0d5b('0x32')]=function(_0x11f67e,_0x57d77e){var _0x157424=0xa;var _0x1b8330=[_0x0d5b('0x86'),_0x0d5b('0xa5'),_0x0d5b('0x87'),_0x0d5b('0x88')];var _0x4f5708={'SUM':'SUM(%s)','COUNT':_0x0d5b('0xa6'),'COUNT DISTINCT':_0x0d5b('0xa7'),'MAX':_0x0d5b('0x5a'),'MIN':_0x0d5b('0x5b'),'AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x0d5b('0x5e')};var _0x783c61={'SEC_TO_TIME':_0x0d5b('0x5f'),'DATE':_0x0d5b('0x60'),'HOUR':_0x0d5b('0x8a'),'ROUND':_0x0d5b('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x30cd2a=function(_0x2e4173){return!_[_0x0d5b('0x63')]([_0x0d5b('0x64'),'IS\x20NOT\x20NULL',_0x0d5b('0x66'),'IS\x20NOT\x20EMPTY'],_0x2e4173);};var _0x12585f=function(_0x1de99f){if(!_0x1de99f||!_0x1de99f[_0x0d5b('0x68')][_0x0d5b('0x4a')]){return'';}for(var _0x3f299e='(',_0x1d9e58=0x0;_0x1d9e58<_0x1de99f[_0x0d5b('0x68')][_0x0d5b('0x4a')];_0x1d9e58+=0x1){_0x1d9e58>0x0&&(_0x3f299e+='\x20'+_0x1de99f[_0x0d5b('0x67')]+'\x20');_0x3f299e+=_0x1de99f[_0x0d5b('0x68')][_0x1d9e58][_0x0d5b('0x69')]?_0x12585f(_0x1de99f[_0x0d5b('0x68')][_0x1d9e58]['group']):_0x1de99f['rules'][_0x1d9e58][_0x0d5b('0x6a')]+'\x20'+_0x1de99f[_0x0d5b('0x68')][_0x1d9e58][_0x0d5b('0x6b')]+(_0x30cd2a(_0x1de99f[_0x0d5b('0x68')][_0x1d9e58][_0x0d5b('0x6b')])?'\x20'+_0x1de99f['rules'][_0x1d9e58][_0x0d5b('0x8c')]:'');}return _0x3f299e+')';};var _0x466f77={'where':{'id':_0x11f67e[_0x0d5b('0x57')]['id']}},_0x390552,_0x4d3072,_0x154afe,_0x41fa47,_0x209d60;_0x466f77=_[_0x0d5b('0x3f')]({},_0x466f77,_0x11f67e[_0x0d5b('0x41')]);return db[_0x0d5b('0x42')][_0x0d5b('0x56')](_0x466f77)[_0x0d5b('0x26')](function(_0x14261a){if(_0x14261a){_0x390552=_0x14261a;return _0x14261a[_0x0d5b('0xa8')]();}return null;})[_0x0d5b('0x26')](function(_0x540218){if(_0x540218){if(!_0x540218['length']){throw new db[(_0x0d5b('0x6c'))][(_0x0d5b('0x8d'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4d3072=_0x540218;return db[_0x0d5b('0x6e')][_0x0d5b('0x46')]({'raw':!![]});}return null;})[_0x0d5b('0x26')](function(_0x27636f){if(_0x27636f){_0x154afe=_[_0x0d5b('0x6f')](_0x27636f,'id');var _0x37b0d8;var _0x44ace2=squel['select']();_0x44ace2[_0x0d5b('0x70')](_0x390552[_0x0d5b('0x71')]);for(var _0x211695=0x0;_0x211695<_0x4d3072[_0x0d5b('0x4a')];_0x211695+=0x1){_0x37b0d8=_0x4d3072[_0x211695][_0x0d5b('0x72')]?_0x154afe[_0x4d3072[_0x211695]['MetricId']][_0x0d5b('0x73')]:_0x4d3072[_0x211695][_0x0d5b('0x6a')];_0x37b0d8=_0x4d3072[_0x211695][_0x0d5b('0x74')]?_[_0x0d5b('0x75')](_0x4f5708[_0x4d3072[_0x211695][_0x0d5b('0x74')]],'%s',_0x37b0d8):_0x37b0d8;_0x37b0d8=_0x4d3072[_0x211695]['format']?_[_0x0d5b('0x75')](_0x783c61[_0x4d3072[_0x211695]['format']],'%s',_0x37b0d8):_0x37b0d8;if(_0x4d3072[_0x211695][_0x0d5b('0x77')]){_0x44ace2[_0x0d5b('0x69')](_0x37b0d8);}_0x4d3072[_0x211695]['orderBy']&&_0x44ace2[_0x0d5b('0x3a')](_0x37b0d8,_0x4d3072[_0x211695][_0x0d5b('0x78')]==='DESC'?![]:!![]);_0x44ace2[_0x0d5b('0x6a')](_0x37b0d8,_0x4d3072[_0x211695][_0x0d5b('0x8f')]||_0x37b0d8);}if(_0x390552[_0x0d5b('0x7a')]){_0x390552[_0x0d5b('0x7a')]=JSON[_0x0d5b('0x7b')](_0x390552[_0x0d5b('0x7a')]);for(var _0xa214d4=0x0;_0xa214d4<_0x390552[_0x0d5b('0x7a')][_0x0d5b('0x4a')];_0xa214d4+=0x1){if(_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7c')]&&_['includes'](_0x1b8330,_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7c')])&&_0x390552['joins'][_0xa214d4][_0x0d5b('0x7d')]&&_0x390552['joins'][_0xa214d4][_0x0d5b('0x7e')]&&_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7f')]){_0x44ace2[_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7c')]](_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7e')],null,util[_0x0d5b('0x76')](_0x0d5b('0x80'),_0x390552[_0x0d5b('0x71')],_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7d')],_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7e')],_0x390552[_0x0d5b('0x7a')][_0xa214d4][_0x0d5b('0x7f')]));}}}if(_0x390552[_0x0d5b('0x81')]){_0x390552[_0x0d5b('0x81')]=JSON['parse'](_0x390552[_0x0d5b('0x81')]);_0x44ace2[_0x0d5b('0x3c')](_0x12585f(_0x390552[_0x0d5b('0x81')][_0x0d5b('0x69')]));}_0x209d60=_0x44ace2[_0x0d5b('0x82')]();_0x44ace2['limit'](_0x157424);_0x44ace2[_0x0d5b('0x1e')](0x0);logger[_0x0d5b('0xa9')]('Limited\x20Query:',_0x44ace2[_0x0d5b('0x84')]());return dbH[_0x0d5b('0x85')][_0x0d5b('0x32')](_0x44ace2[_0x0d5b('0x84')](),{'type':dbH[_0x0d5b('0x85')][_0x0d5b('0xa1')]['SELECT']});}})[_0x0d5b('0x26')](function(){return{'sql':_0x209d60['toString']()};})['then'](respondWithResult(_0x57d77e,null))['catch'](handleError(_0x57d77e,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 0c32ae7..fa2a4e9 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 _0x6788=['rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0xf1af27,_0x598bb1){var _0x46b274=function(_0x1dba43){while(--_0x1dba43){_0xf1af27['push'](_0xf1af27['shift']());}};_0x46b274(++_0x598bb1);}(_0x6788,0x132));var _0x8678=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x6788[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x8678('0x0'));var util=require(_0x8678('0x1'));var logger=require(_0x8678('0x2'))(_0x8678('0x3'));var moment=require(_0x8678('0x4'));var BPromise=require(_0x8678('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8678('0x6'));var config=require(_0x8678('0x7'));var attributes=require(_0x8678('0x8'));module[_0x8678('0x9')]=function(_0x2528a0,_0x5e7511){return _0x2528a0[_0x8678('0xa')](_0x8678('0xb'),attributes,{'tableName':_0x8678('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2e94=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash'];(function(_0x1b1462,_0x49a3b7){var _0x2d705a=function(_0x265c12){while(--_0x265c12){_0x1b1462['push'](_0x1b1462['shift']());}};_0x2d705a(++_0x49a3b7);}(_0x2e94,0x1b1));var _0x42e9=function(_0x513507,_0x1ea38d){_0x513507=_0x513507-0x0;var _0x3418c6=_0x2e94[_0x513507];return _0x3418c6;};'use strict';var _=require(_0x42e9('0x0'));var util=require(_0x42e9('0x1'));var logger=require(_0x42e9('0x2'))(_0x42e9('0x3'));var moment=require(_0x42e9('0x4'));var BPromise=require(_0x42e9('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x42e9('0x6'));var rimraf=require(_0x42e9('0x7'));var config=require(_0x42e9('0x8'));var attributes=require(_0x42e9('0x9'));module[_0x42e9('0xa')]=function(_0x47641d,_0x2d40fd){return _0x47641d[_0x42e9('0xb')](_0x42e9('0xc'),attributes,{'tableName':_0x42e9('0xd'),'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 422e1d1..235b505 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 _0xaab3=['result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x3877e8,_0x155bcb){var _0x552c52=function(_0x5a10bd){while(--_0x5a10bd){_0x3877e8['push'](_0x3877e8['shift']());}};_0x552c52(++_0x155bcb);}(_0xaab3,0x1e5));var _0x3aab=function(_0x26623d,_0x569817){_0x26623d=_0x26623d-0x0;var _0x1c86a4=_0xaab3[_0x26623d];return _0x1c86a4;};'use strict';var _=require(_0x3aab('0x0'));var util=require(_0x3aab('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3aab('0x2'));var fs=require('fs');var Redis=require(_0x3aab('0x3'));var db=require(_0x3aab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3aab('0x5'))(_0x3aab('0x6'));var config=require(_0x3aab('0x7'));var jayson=require(_0x3aab('0x8'));var client=jayson[_0x3aab('0x9')][_0x3aab('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34cd74,_0x3e0648,_0x2931d0){return new BPromise(function(_0x13e914,_0x59fbc5){return client[_0x3aab('0xb')](_0x34cd74,_0x2931d0)[_0x3aab('0xc')](function(_0x3fa4e6){logger['info'](_0x3aab('0xd'),_0x3e0648,_0x3aab('0xe'));logger['debug'](_0x3aab('0xf'),_0x3e0648,'request\x20sent',JSON[_0x3aab('0x10')](_0x3fa4e6));if(_0x3fa4e6['error']){if(_0x3fa4e6[_0x3aab('0x11')][_0x3aab('0x12')]===0x1f4){logger[_0x3aab('0x11')](_0x3aab('0xd'),_0x3e0648,_0x3fa4e6[_0x3aab('0x11')][_0x3aab('0x13')]);return _0x59fbc5(_0x3fa4e6['error'][_0x3aab('0x13')]);}logger[_0x3aab('0x11')](_0x3aab('0xd'),_0x3e0648,_0x3fa4e6[_0x3aab('0x11')][_0x3aab('0x13')]);return _0x13e914(_0x3fa4e6[_0x3aab('0x11')][_0x3aab('0x13')]);}else{logger[_0x3aab('0x14')](_0x3aab('0xd'),_0x3e0648,'request\x20sent');_0x13e914(_0x3fa4e6[_0x3aab('0x15')]['message']);}})[_0x3aab('0x16')](function(_0x2b6146){logger['error'](_0x3aab('0xd'),_0x3e0648,_0x2b6146);_0x59fbc5(_0x2b6146);});});} \ No newline at end of file +var _0x84f4=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http','info','AnalyticCustomReport,\x20%s,\x20%s','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result'];(function(_0x3bf925,_0x4dd8e4){var _0x2128a1=function(_0x4d2049){while(--_0x4d2049){_0x3bf925['push'](_0x3bf925['shift']());}};_0x2128a1(++_0x4dd8e4);}(_0x84f4,0xc8));var _0x484f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x84f4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x484f('0x0'));var util=require(_0x484f('0x1'));var moment=require(_0x484f('0x2'));var BPromise=require('bluebird');var rs=require(_0x484f('0x3'));var fs=require('fs');var Redis=require(_0x484f('0x4'));var db=require(_0x484f('0x5'))['db'];var utils=require(_0x484f('0x6'));var logger=require('../../config/logger')(_0x484f('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x484f('0x8')][_0x484f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x43202a,_0x2b0931,_0x4836f6){return new BPromise(function(_0x4c7f13,_0x24270d){return client['request'](_0x43202a,_0x4836f6)['then'](function(_0x506551){logger[_0x484f('0xa')](_0x484f('0xb'),_0x2b0931,'request\x20sent');logger[_0x484f('0xc')](_0x484f('0xd'),_0x2b0931,'request\x20sent',JSON[_0x484f('0xe')](_0x506551));if(_0x506551['error']){if(_0x506551['error'][_0x484f('0xf')]===0x1f4){logger[_0x484f('0x10')](_0x484f('0xb'),_0x2b0931,_0x506551[_0x484f('0x10')][_0x484f('0x11')]);return _0x24270d(_0x506551['error']['message']);}logger[_0x484f('0x10')](_0x484f('0xb'),_0x2b0931,_0x506551['error'][_0x484f('0x11')]);return _0x4c7f13(_0x506551[_0x484f('0x10')][_0x484f('0x11')]);}else{logger[_0x484f('0xa')](_0x484f('0xb'),_0x2b0931,_0x484f('0x12'));_0x4c7f13(_0x506551[_0x484f('0x13')][_0x484f('0x11')]);}})['catch'](function(_0x4d7313){logger['error'](_0x484f('0xb'),_0x2b0931,_0x4d7313);_0x24270d(_0x4d7313);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 94c31e7..a1ff239 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 _0x5588=['index','/:id','/:id/preview','isAuthenticated','/:id/run','run','query','post','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get'];(function(_0xfc342f,_0x2f339a){var _0x52e1b5=function(_0x57a460){while(--_0x57a460){_0xfc342f['push'](_0xfc342f['shift']());}};_0x52e1b5(++_0x2f339a);}(_0x5588,0x1c3));var _0x8558=function(_0x2cee80,_0xe8d160){_0x2cee80=_0x2cee80-0x0;var _0x32e7b2=_0x5588[_0x2cee80];return _0x32e7b2;};'use strict';var multer=require(_0x8558('0x0'));var util=require(_0x8558('0x1'));var path=require(_0x8558('0x2'));var timeout=require(_0x8558('0x3'));var express=require('express');var router=express[_0x8558('0x4')]();var fs_extra=require(_0x8558('0x5'));var auth=require(_0x8558('0x6'));var interaction=require(_0x8558('0x7'));var config=require(_0x8558('0x8'));var controller=require(_0x8558('0x9'));router[_0x8558('0xa')]('/',auth['isAuthenticated'](),controller[_0x8558('0xb')]);router['get'](_0x8558('0xc'),auth['isAuthenticated'](),controller['show']);router['get'](_0x8558('0xd'),auth[_0x8558('0xe')](),controller['preview']);router[_0x8558('0xa')](_0x8558('0xf'),auth[_0x8558('0xe')](),controller[_0x8558('0x10')]);router['get']('/:id/query',auth['isAuthenticated'](),controller[_0x8558('0x11')]);router[_0x8558('0x12')]('/',auth[_0x8558('0xe')](),controller['create']);router['put'](_0x8558('0xc'),auth[_0x8558('0xe')](),controller[_0x8558('0x13')]);router[_0x8558('0x14')](_0x8558('0xc'),auth[_0x8558('0xe')](),controller['destroy']);module[_0x8558('0x15')]=router; \ No newline at end of file +var _0xecf9=['post','create','put','update','exports','multer','path','express','Router','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','/:id','/:id/preview','preview','/:id/run','run','/:id/query'];(function(_0x7d293c,_0x3e8749){var _0x170c93=function(_0x169089){while(--_0x169089){_0x7d293c['push'](_0x7d293c['shift']());}};_0x170c93(++_0x3e8749);}(_0xecf9,0x64));var _0x9ecf=function(_0x865ddc,_0x39b273){_0x865ddc=_0x865ddc-0x0;var _0x5c6527=_0xecf9[_0x865ddc];return _0x5c6527;};'use strict';var multer=require(_0x9ecf('0x0'));var util=require('util');var path=require(_0x9ecf('0x1'));var timeout=require('connect-timeout');var express=require(_0x9ecf('0x2'));var router=express[_0x9ecf('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9ecf('0x4'));var controller=require(_0x9ecf('0x5'));router[_0x9ecf('0x6')]('/',auth[_0x9ecf('0x7')](),controller['index']);router[_0x9ecf('0x6')](_0x9ecf('0x8'),auth['isAuthenticated'](),controller['show']);router['get'](_0x9ecf('0x9'),auth[_0x9ecf('0x7')](),controller[_0x9ecf('0xa')]);router[_0x9ecf('0x6')](_0x9ecf('0xb'),auth['isAuthenticated'](),controller[_0x9ecf('0xc')]);router[_0x9ecf('0x6')](_0x9ecf('0xd'),auth[_0x9ecf('0x7')](),controller['query']);router[_0x9ecf('0xe')]('/',auth[_0x9ecf('0x7')](),controller[_0x9ecf('0xf')]);router[_0x9ecf('0x10')](_0x9ecf('0x8'),auth[_0x9ecf('0x7')](),controller[_0x9ecf('0x11')]);router['delete'](_0x9ecf('0x8'),auth[_0x9ecf('0x7')](),controller['destroy']);module[_0x9ecf('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 97b8814..c4678ad 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 _0xa630=['STRING','TEXT','sequelize','exports'];(function(_0x246a2d,_0x295e02){var _0x5457e7=function(_0x44bba1){while(--_0x44bba1){_0x246a2d['push'](_0x246a2d['shift']());}};_0x5457e7(++_0x295e02);}(_0xa630,0xbe));var _0x0a63=function(_0x367363,_0x14886b){_0x367363=_0x367363-0x0;var _0x3351b0=_0xa630[_0x367363];return _0x3351b0;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x0a63('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x0a63('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x7dfd=['STRING','TEXT','sequelize','exports'];(function(_0x120ea,_0x42f799){var _0xd2ddaf=function(_0x4cbc7c){while(--_0x4cbc7c){_0x120ea['push'](_0x120ea['shift']());}};_0xd2ddaf(++_0x42f799);}(_0x7dfd,0x1c2));var _0xd7df=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7dfd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7df('0x0'));module[_0xd7df('0x1')]={'name':{'type':Sequelize[_0xd7df('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xd7df('0x2')]},'parent':{'type':Sequelize[_0xd7df('0x2')]},'table':{'type':Sequelize[_0xd7df('0x2')]},'conditions':{'type':Sequelize[_0xd7df('0x3')]},'joins':{'type':Sequelize[_0xd7df('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 0c51667..628a148 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 _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','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','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x101504,_0x4598b0){var _0x1b7547=function(_0x24432c){while(--_0x24432c){_0x101504['push'](_0x101504['shift']());}};_0x1b7547(++_0x4598b0);}(_0x53ec,0x192));var _0xc53e=function(_0x4c79aa,_0x456fcd){_0x4c79aa=_0x4c79aa-0x0;var _0x28e73a=_0x53ec[_0x4c79aa];return _0x28e73a;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file +var _0xda19=['ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','function','replace','groupBy','orderBy','order','alias','joins','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20EMPTY','operator','Sequelize','metric','format','DESC','parse','parentKey','web','output','csv','default','AnalyticExtractedReport','cdr','startDate','endDate','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','run','runReport','rimraf','zip-dir','request-promise','bluebird','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/utils','../../mysqldb','dbH','status','json','offset','undefined','limit','count','set','apply','update','then','DefaultReports','destroy','end','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','type','VIRTUAL','merge','includeAll','include','findAll','show','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','group','condition','value','options','find','getFields'];(function(_0x320f33,_0x1db212){var _0x217d1e=function(_0x3c068){while(--_0x3c068){_0x320f33['push'](_0x320f33['shift']());}};_0x217d1e(++_0x1db212);}(_0xda19,0xd5));var _0x9da1=function(_0x1624f4,_0x5e19e6){_0x1624f4=_0x1624f4-0x0;var _0x1d4c97=_0xda19[_0x1624f4];return _0x1d4c97;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9da1('0x0'));var zipdir=require(_0x9da1('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9da1('0x2'));var moment=require('moment');var BPromise=require(_0x9da1('0x3'));var Mustache=require('mustache');var util=require(_0x9da1('0x4'));var path=require(_0x9da1('0x5'));var sox=require(_0x9da1('0x6'));var csv=require(_0x9da1('0x7'));var ejs=require(_0x9da1('0x8'));var fs=require('fs');var fs_extra=require(_0x9da1('0x9'));var _=require(_0x9da1('0xa'));var squel=require(_0x9da1('0xb'));var crypto=require(_0x9da1('0xc'));var jsforce=require(_0x9da1('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9da1('0xe'));var Redis=require('ioredis');var authService=require(_0x9da1('0xf'));var qs=require(_0x9da1('0x10'));var as=require(_0x9da1('0x11'));var hardwareService=require(_0x9da1('0x12'));var logger=require(_0x9da1('0x13'))(_0x9da1('0x14'));var utils=require(_0x9da1('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9da1('0x16'))['db'];var dbH=require('../../mysqldb')[_0x9da1('0x17')];function respondWithStatusCode(_0x1d93f8,_0xd2d225){_0xd2d225=_0xd2d225||0xcc;return function(_0x1ffa2a){if(_0x1ffa2a){return _0x1d93f8['sendStatus'](_0xd2d225);}return _0x1d93f8[_0x9da1('0x18')](_0xd2d225)['end']();};}function respondWithResult(_0x4d17e1,_0x40ba9d){_0x40ba9d=_0x40ba9d||0xc8;return function(_0x479ccd){if(_0x479ccd){return _0x4d17e1[_0x9da1('0x18')](_0x40ba9d)[_0x9da1('0x19')](_0x479ccd);}};}function respondWithFilteredResult(_0x37653d,_0x1a1a6b){return function(_0x7f1a64){if(_0x7f1a64){var _0x514d8e=typeof _0x1a1a6b[_0x9da1('0x1a')]===_0x9da1('0x1b')&&typeof _0x1a1a6b[_0x9da1('0x1c')]===_0x9da1('0x1b');var _0xfb278d=_0x7f1a64[_0x9da1('0x1d')];var _0x497676=_0x514d8e?0x0:_0x1a1a6b['offset'];var _0x17205d=_0x514d8e?_0x7f1a64[_0x9da1('0x1d')]:_0x1a1a6b[_0x9da1('0x1a')]+_0x1a1a6b[_0x9da1('0x1c')];var _0x40a967;if(_0x17205d>=_0xfb278d){_0x17205d=_0xfb278d;_0x40a967=0xc8;}else{_0x40a967=0xce;}_0x37653d[_0x9da1('0x18')](_0x40a967);return _0x37653d[_0x9da1('0x1e')]('Content-Range',_0x497676+'-'+_0x17205d+'/'+_0xfb278d)[_0x9da1('0x19')](_0x7f1a64);}return null;};}function patchUpdates(_0x554845){return function(_0x9c3b37){try{jsonpatch[_0x9da1('0x1f')](_0x9c3b37,_0x554845,!![]);}catch(_0x1fc065){return BPromise['reject'](_0x1fc065);}return _0x9c3b37['save']();};}function saveUpdates(_0x14793b,_0x3e6f85){return function(_0x16ee0c){if(_0x16ee0c){return _0x16ee0c[_0x9da1('0x20')](_0x14793b)[_0x9da1('0x21')](function(_0x165b73){return _0x165b73;});}return null;};}function removeEntity(_0x4c60aa,_0x2413fe){return function(_0x3bfa40){if(_0x3bfa40){return _0x3bfa40['destroy']()[_0x9da1('0x21')](function(){var _0x3f5680=_0x3bfa40['get']({'plain':!![]});var _0x2fd49c=_0x9da1('0x22');return db['UserProfileResource'][_0x9da1('0x23')]({'where':{'type':_0x2fd49c,'resourceId':_0x3f5680['id']}})[_0x9da1('0x21')](function(){return _0x3bfa40;});})['then'](function(){_0x4c60aa['status'](0xcc)[_0x9da1('0x24')]();});}};}function handleEntityNotFound(_0x47055e,_0x5eca5b){return function(_0x27c6e2){if(!_0x27c6e2){_0x47055e['sendStatus'](0x194);}return _0x27c6e2;};}function handleError(_0x5a6f2d,_0x5a59c2){_0x5a59c2=_0x5a59c2||0x1f4;return function(_0x31b826){logger[_0x9da1('0x25')](_0x31b826[_0x9da1('0x26')]);if(_0x31b826[_0x9da1('0x27')]){delete _0x31b826[_0x9da1('0x27')];}_0x5a6f2d['status'](_0x5a59c2)[_0x9da1('0x28')](_0x31b826);};}exports['index']=function(_0x1feae0,_0x235ced){var _0x5b38b3={},_0xc29ba8={},_0x2eb48f={'count':0x0,'rows':[]};var _0x4f318b=_[_0x9da1('0x29')](db[_0x9da1('0x2a')][_0x9da1('0x2b')],function(_0x2b2b48){return{'name':_0x2b2b48['fieldName'],'type':_0x2b2b48['type'][_0x9da1('0x2c')]};});_0xc29ba8[_0x9da1('0x2d')]=_[_0x9da1('0x29')](_0x4f318b,_0x9da1('0x27'));_0xc29ba8[_0x9da1('0x2e')]=_['keys'](_0x1feae0[_0x9da1('0x2e')]);_0xc29ba8[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xc29ba8[_0x9da1('0x2d')],_0xc29ba8[_0x9da1('0x2e')]);_0x5b38b3[_0x9da1('0x31')]=_['intersection'](_0xc29ba8[_0x9da1('0x2d')],qs['fields'](_0x1feae0['query'][_0x9da1('0x32')]));_0x5b38b3['attributes']=_0x5b38b3[_0x9da1('0x31')][_0x9da1('0x33')]?_0x5b38b3[_0x9da1('0x31')]:_0xc29ba8[_0x9da1('0x2d')];if(!_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x34')](_0x9da1('0x35'))){_0x5b38b3[_0x9da1('0x1c')]=qs['limit'](_0x1feae0[_0x9da1('0x2e')]['limit']);_0x5b38b3[_0x9da1('0x1a')]=qs['offset'](_0x1feae0['query'][_0x9da1('0x1a')]);}_0x5b38b3['order']=qs[_0x9da1('0x36')](_0x1feae0[_0x9da1('0x2e')]['sort']);_0x5b38b3[_0x9da1('0x37')]=qs[_0x9da1('0x2f')](_[_0x9da1('0x38')](_0x1feae0[_0x9da1('0x2e')],_0xc29ba8['filters']),_0x4f318b);if(_0x1feae0[_0x9da1('0x2e')]['filter']){_0x5b38b3[_0x9da1('0x37')]=_['merge'](_0x5b38b3[_0x9da1('0x37')],{'$or':_[_0x9da1('0x29')](_0x4f318b,function(_0x58e165){if(_0x58e165[_0x9da1('0x39')]!==_0x9da1('0x3a')){var _0x394acf={};_0x394acf[_0x58e165['name']]={'$like':'%'+_0x1feae0['query']['filter']+'%'};return _0x394acf;}})});}_0x5b38b3=_[_0x9da1('0x3b')]({},_0x5b38b3,_0x1feae0['options']);var _0x5b215c={'where':_0x5b38b3[_0x9da1('0x37')]};return db[_0x9da1('0x2a')][_0x9da1('0x1d')](_0x5b215c)['then'](function(_0x42dbd8){_0x2eb48f[_0x9da1('0x1d')]=_0x42dbd8;if(_0x1feae0[_0x9da1('0x2e')][_0x9da1('0x3c')]){_0x5b38b3[_0x9da1('0x3d')]=[{'all':!![]}];}return db[_0x9da1('0x2a')][_0x9da1('0x3e')](_0x5b38b3);})['then'](function(_0x467350){_0x2eb48f['rows']=_0x467350;return _0x2eb48f;})[_0x9da1('0x21')](respondWithFilteredResult(_0x235ced,_0x5b38b3))['catch'](handleError(_0x235ced,null));};exports[_0x9da1('0x3f')]=function(_0x40d848,_0x599211){var _0x265366={'raw':!![],'where':{'id':_0x40d848['params']['id']}},_0xfeec5f={};_0xfeec5f[_0x9da1('0x2d')]=_['keys'](db[_0x9da1('0x2a')][_0x9da1('0x2b')]);_0xfeec5f['query']=_['keys'](_0x40d848[_0x9da1('0x2e')]);_0xfeec5f[_0x9da1('0x2f')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],_0xfeec5f[_0x9da1('0x2e')]);_0x265366[_0x9da1('0x31')]=_[_0x9da1('0x30')](_0xfeec5f[_0x9da1('0x2d')],qs['fields'](_0x40d848[_0x9da1('0x2e')][_0x9da1('0x32')]));_0x265366[_0x9da1('0x31')]=_0x265366['attributes'][_0x9da1('0x33')]?_0x265366[_0x9da1('0x31')]:_0xfeec5f[_0x9da1('0x2d')];if(_0x40d848['query'][_0x9da1('0x3c')]){_0x265366[_0x9da1('0x3d')]=[{'all':!![]}];}_0x265366=_[_0x9da1('0x3b')]({},_0x265366,_0x40d848['options']);return db[_0x9da1('0x2a')]['find'](_0x265366)['then'](handleEntityNotFound(_0x599211,null))[_0x9da1('0x21')](respondWithResult(_0x599211,null))[_0x9da1('0x40')](handleError(_0x599211,null));};exports['create']=function(_0x712d10,_0x2066d2){return db['AnalyticDefaultReport'][_0x9da1('0x41')](_0x712d10[_0x9da1('0x42')],{})[_0x9da1('0x21')](function(_0x3a529d){var _0x4780ca=_0x712d10[_0x9da1('0x43')][_0x9da1('0x44')]({'plain':!![]});if(!_0x4780ca)throw new Error(_0x9da1('0x45'));if(_0x4780ca[_0x9da1('0x46')]==='user'){var _0x147c65=_0x3a529d[_0x9da1('0x44')]({'plain':!![]});var _0x34a203=_0x9da1('0x47');return db['UserProfileSection']['find']({'where':{'name':_0x34a203,'userProfileId':_0x4780ca[_0x9da1('0x48')]},'raw':!![]})[_0x9da1('0x21')](function(_0x3870dd){if(_0x3870dd&&_0x3870dd[_0x9da1('0x49')]===0x0){return db[_0x9da1('0x4a')][_0x9da1('0x41')]({'name':_0x147c65[_0x9da1('0x27')],'resourceId':_0x147c65['id'],'type':_0x9da1('0x22'),'sectionId':_0x3870dd['id']},{})[_0x9da1('0x21')](function(){return _0x3a529d;});}else{return _0x3a529d;}})[_0x9da1('0x40')](function(_0x868167){logger[_0x9da1('0x25')](_0x9da1('0x4b'),_0x868167);throw _0x868167;});}return _0x3a529d;})[_0x9da1('0x21')](respondWithResult(_0x2066d2,0xc9))['catch'](handleError(_0x2066d2,null));};exports[_0x9da1('0x20')]=function(_0x1fbb5d,_0x4d241a){if(_0x1fbb5d[_0x9da1('0x42')]['id']){delete _0x1fbb5d['body']['id'];}return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x1fbb5d[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x4d241a,null))[_0x9da1('0x21')](saveUpdates(_0x1fbb5d[_0x9da1('0x42')],null))[_0x9da1('0x21')](respondWithResult(_0x4d241a,null))[_0x9da1('0x40')](handleError(_0x4d241a,null));};exports[_0x9da1('0x23')]=function(_0x343b05,_0x170351){return db[_0x9da1('0x2a')]['find']({'where':{'id':_0x343b05[_0x9da1('0x4c')]['id']}})[_0x9da1('0x21')](handleEntityNotFound(_0x170351,null))[_0x9da1('0x21')](removeEntity(_0x170351,null))[_0x9da1('0x40')](handleError(_0x170351,null));};exports[_0x9da1('0x4d')]=function(_0x4607a9,_0x2020d0){var _0x3c01c3=0xa;var _0xfa8d3f=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),_0x9da1('0x50')];var _0x5bda2a={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0xc27b00={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x27ac84=function(_0x10ebc9){return!_[_0x9da1('0x5c')]([_0x9da1('0x5d'),_0x9da1('0x5e'),_0x9da1('0x5f'),'IS\x20NOT\x20EMPTY'],_0x10ebc9);};var _0x5f5dc2=function(_0x454a68){if(!_0x454a68||!_0x454a68['rules']['length']){return'';}for(var _0x5b4a05='(',_0x6f86c3=0x0;_0x6f86c3<_0x454a68['rules'][_0x9da1('0x33')];_0x6f86c3+=0x1){_0x6f86c3>0x0&&(_0x5b4a05+='\x20'+_0x454a68['operator']+'\x20');_0x5b4a05+=_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x61')]?_0x5f5dc2(_0x454a68['rules'][_0x6f86c3][_0x9da1('0x61')]):_0x454a68[_0x9da1('0x60')][_0x6f86c3]['field']+'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x62')]+(_0x27ac84(_0x454a68['rules'][_0x6f86c3]['condition'])?'\x20'+_0x454a68[_0x9da1('0x60')][_0x6f86c3][_0x9da1('0x63')]:'');}return _0x5b4a05+')';};var _0x21d00c={'where':{'id':_0x4607a9['params']['id']}},_0x3ca531,_0x236b01,_0x44d7fe,_0x5cb102,_0x3d2c25;_0x21d00c=_['merge']({},_0x21d00c,_0x4607a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0x21d00c)[_0x9da1('0x21')](function(_0x3382b1){if(_0x3382b1){_0x3ca531=_0x3382b1;return _0x3382b1[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x1f2a4b){if(_0x1f2a4b){if(!_0x1f2a4b[_0x9da1('0x33')]){throw new db['Sequelize'][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x236b01=_0x1f2a4b;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x491fcb){if(_0x491fcb){_0x44d7fe=_[_0x9da1('0x6a')](_0x491fcb,'id');var _0x13fadd;var _0x419f78=squel[_0x9da1('0x6b')]();_0x419f78[_0x9da1('0x6c')](_0x3ca531[_0x9da1('0x6d')]);for(var _0x55a6d2=0x0;_0x55a6d2<_0x236b01[_0x9da1('0x33')];_0x55a6d2+=0x1){_0x13fadd=_0x236b01[_0x55a6d2]['MetricId']?_0x44d7fe[_0x236b01[_0x55a6d2][_0x9da1('0x6e')]]['metric']:_0x236b01[_0x55a6d2][_0x9da1('0x6f')];_0x13fadd=_0x236b01[_0x55a6d2][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x5bda2a[_0x236b01[_0x55a6d2][_0x9da1('0x70')]],'%s',_0x13fadd):_0x13fadd;_0x13fadd=_0x236b01[_0x55a6d2]['format']?_['replace'](_0xc27b00[_0x236b01[_0x55a6d2]['format']],'%s',_0x13fadd):_0x13fadd;if(_0x236b01[_0x55a6d2][_0x9da1('0x72')]){_0x419f78[_0x9da1('0x61')](_0x13fadd);}_0x236b01[_0x55a6d2][_0x9da1('0x73')]&&_0x419f78[_0x9da1('0x74')](_0x13fadd,_0x236b01[_0x55a6d2]['orderBy']==='DESC'?![]:!![]);_0x419f78[_0x9da1('0x6f')](_0x13fadd,_0x236b01[_0x55a6d2][_0x9da1('0x75')]||_0x13fadd);}if(_0x3ca531[_0x9da1('0x76')]){_0x3ca531['joins']=JSON['parse'](_0x3ca531[_0x9da1('0x76')]);for(var _0x1deb93=0x0;_0x1deb93<_0x3ca531[_0x9da1('0x76')]['length'];_0x1deb93+=0x1){if(_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0xfa8d3f,_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x39')])&&_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey']&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')]&&_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x78')]){_0x419f78[_0x3ca531['joins'][_0x1deb93][_0x9da1('0x39')]](_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0x3ca531[_0x9da1('0x6d')],_0x3ca531[_0x9da1('0x76')][_0x1deb93]['parentKey'],_0x3ca531[_0x9da1('0x76')][_0x1deb93][_0x9da1('0x77')],_0x3ca531['joins'][_0x1deb93][_0x9da1('0x78')]));}}}if(_0x3ca531['conditions']){_0x3ca531[_0x9da1('0x7a')]=JSON['parse'](_0x3ca531[_0x9da1('0x7a')]);_0x419f78[_0x9da1('0x37')](_0x5f5dc2(_0x3ca531[_0x9da1('0x7a')][_0x9da1('0x61')]));}_0x3d2c25=_0x419f78[_0x9da1('0x7b')]();_0x419f78[_0x9da1('0x1c')](_0x3c01c3);_0x419f78[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x419f78[_0x9da1('0x7e')]());return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x419f78[_0x9da1('0x7e')](),{'type':dbH['sequelize'][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](respondWithResult(_0x2020d0,null))[_0x9da1('0x40')](handleError(_0x2020d0,null));};function runReport(_0x162597,_0x4f39bc,_0x1ca102){var _0x2eb5e6=_0x4f39bc['name'];var _0x4a4cda=0xa;var _0x84f8d8=[_0x9da1('0x4e'),_0x9da1('0x82'),_0x9da1('0x4f'),_0x9da1('0x50')];var _0x4701b3={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x3a0a84={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':_0x9da1('0x5a'),'HOUR':_0x9da1('0x83'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x9da1('0x84')};var _0x354c5a=function(_0x53ab6a){return!_[_0x9da1('0x5c')](['IS\x20NULL',_0x9da1('0x5e'),'IS\x20EMPTY',_0x9da1('0x85')],_0x53ab6a);};var _0x106bd9=function(_0x347cb8){if(!_0x347cb8||!_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x3e331a='(',_0x1f785c=0x0;_0x1f785c<_0x347cb8[_0x9da1('0x60')][_0x9da1('0x33')];_0x1f785c+=0x1){_0x1f785c>0x0&&(_0x3e331a+='\x20'+_0x347cb8[_0x9da1('0x86')]+'\x20');_0x3e331a+=_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x61')]?_0x106bd9(_0x347cb8['rules'][_0x1f785c][_0x9da1('0x61')]):_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x6f')]+'\x20'+_0x347cb8[_0x9da1('0x60')][_0x1f785c][_0x9da1('0x62')]+(_0x354c5a(_0x347cb8[_0x9da1('0x60')][_0x1f785c]['condition'])?'\x20'+_0x347cb8['rules'][_0x1f785c][_0x9da1('0x63')]:'');}return _0x3e331a+')';};var _0xdecc82={'where':{'id':_0x162597['id']}},_0xe12dd7,_0x4cd85f,_0x4bf74c,_0x28335d,_0x175b4b;_0xdecc82=_[_0x9da1('0x3b')]({},_0xdecc82,_0x1ca102);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xdecc82)[_0x9da1('0x21')](function(_0x5561f0){if(_0x5561f0){_0xe12dd7=_0x5561f0;return _0x5561f0[_0x9da1('0x66')]();}return null;})[_0x9da1('0x21')](function(_0x5a64fd){if(_0x5a64fd){if(!_0x5a64fd['length']){throw new db[(_0x9da1('0x87'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x4cd85f=_0x5a64fd;return db[_0x9da1('0x69')][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x18ae08){if(_0x18ae08){_0x4bf74c=_[_0x9da1('0x6a')](_0x18ae08,'id');var _0x30065d;var _0x40a2ef=squel[_0x9da1('0x6b')]();_0x40a2ef['from'](_0xe12dd7['table']);for(var _0xd10ba4=0x0;_0xd10ba4<_0x4cd85f[_0x9da1('0x33')];_0xd10ba4+=0x1){_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]?_0x4bf74c[_0x4cd85f[_0xd10ba4][_0x9da1('0x6e')]][_0x9da1('0x88')]:_0x4cd85f[_0xd10ba4][_0x9da1('0x6f')];_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x70')]?_[_0x9da1('0x71')](_0x4701b3[_0x4cd85f[_0xd10ba4]['function']],'%s',_0x30065d):_0x30065d;_0x30065d=_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]?_['replace'](_0x3a0a84[_0x4cd85f[_0xd10ba4][_0x9da1('0x89')]],'%s',_0x30065d):_0x30065d;if(_0x4cd85f[_0xd10ba4][_0x9da1('0x72')]){_0x40a2ef[_0x9da1('0x61')](_0x30065d);}_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]&&_0x40a2ef[_0x9da1('0x74')](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x73')]===_0x9da1('0x8a')?![]:!![]);_0x40a2ef['field'](_0x30065d,_0x4cd85f[_0xd10ba4][_0x9da1('0x75')]||_0x30065d);}if(_0xe12dd7['joins']){_0xe12dd7[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0xe12dd7[_0x9da1('0x76')]);for(var _0x22b679=0x0;_0x22b679<_0xe12dd7['joins'][_0x9da1('0x33')];_0x22b679+=0x1){if(_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]&&_[_0x9da1('0x5c')](_0x84f8d8,_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')])&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')]&&_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]){_0x40a2ef[_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x39')]](_0xe12dd7['joins'][_0x22b679][_0x9da1('0x77')],null,util['format'](_0x9da1('0x79'),_0xe12dd7['table'],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x8c')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x77')],_0xe12dd7[_0x9da1('0x76')][_0x22b679][_0x9da1('0x78')]));}}}if(_0xe12dd7[_0x9da1('0x7a')]){_0xe12dd7[_0x9da1('0x7a')]=JSON['parse'](_0xe12dd7[_0x9da1('0x7a')]);_0x40a2ef[_0x9da1('0x37')](_0x106bd9(_0xe12dd7['conditions'][_0x9da1('0x61')]));}_0x175b4b=_0x40a2ef[_0x9da1('0x7b')]();_0x40a2ef[_0x9da1('0x1c')](_0x4a4cda);_0x40a2ef['offset'](0x0);return;}})['then'](function(){if(_0x4f39bc['output']===_0x9da1('0x8d')){return null;}var _0x3b17aa=_[_0x9da1('0x3b')](_0x4f39bc,{'name':_0x4f39bc['fullPath']||_0x4f39bc['name']||_0xe12dd7[_0x9da1('0x27')],'basename':_0x2eb5e6,'savename':util[_0x9da1('0x89')]('%s-%s.%s',_0x4f39bc[_0x9da1('0x27')]||_0xe12dd7['name'],require('randomstring')['generate'](0x4),_0x4f39bc[_0x9da1('0x8e')]||_0x9da1('0x8f')),'reportId':_0xe12dd7['id'],'reportType':_0x9da1('0x90')});return db[_0x9da1('0x91')][_0x9da1('0x41')](_0x3b17aa,{'raw':!![]});})[_0x9da1('0x21')](function(_0x2aac99){if(_0xe12dd7[_0x9da1('0x6d')]===_0x9da1('0x92')){_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc['startDate'],_0x4f39bc['endDate']);}else{_0x175b4b[_0x9da1('0x37')](_0xe12dd7[_0x9da1('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4f39bc[_0x9da1('0x93')],_0x4f39bc[_0x9da1('0x94')]);}if(_0x2aac99){logger[_0x9da1('0x95')](_0x9da1('0x96'),_0x175b4b[_0x9da1('0x7e')]());require(_0x9da1('0x97'))[_0x9da1('0x98')](path[_0x9da1('0x4e')](__dirname,'../../components/export/',_0x2aac99[_0x9da1('0x8e')]),[_0x2aac99['id'],_0x175b4b[_0x9da1('0x7e')](),path[_0x9da1('0x4e')](__dirname,_0x9da1('0x99'),_0x2aac99[_0x9da1('0x9a')]),_0x2eb5e6]);return _0x2aac99;}else{var _0x5ad3f8=squel[_0x9da1('0x6b')]();_0x5ad3f8['from']('('+_0x175b4b[_0x9da1('0x7e')]()+')',_0x9da1('0x9b'));_0x5ad3f8[_0x9da1('0x6f')]('COUNT(*)','count');_0x175b4b[_0x9da1('0x1c')](_0x4f39bc[_0x9da1('0x1c')]||_0x4a4cda);_0x175b4b[_0x9da1('0x1a')](_0x4f39bc['offset']||0x0);return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x5ad3f8['toString'](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')]['SELECT']})['then'](function(_0x489b3f){if(!_0x489b3f[_0x9da1('0x33')]){_0x28335d=0x0;}else{_0x28335d=_0x489b3f[0x0]['count']||0x0;}return dbH[_0x9da1('0x7f')][_0x9da1('0x2e')](_0x175b4b[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});})['then'](function(_0x355a71){return{'rows':_0x355a71||[],'count':_0x28335d};});}});}exports[_0x9da1('0x9c')]=function(_0x492e1a,_0x449a17){return runReport(_0x492e1a[_0x9da1('0x4c')],_0x492e1a[_0x9da1('0x2e')],_0x492e1a[_0x9da1('0x64')])['then'](respondWithResult(_0x449a17,null))[_0x9da1('0x40')](handleError(_0x449a17,null));};exports[_0x9da1('0x9d')]=runReport;exports[_0x9da1('0x2e')]=function(_0x8280a9,_0x374754){var _0x1e466a=0xa;var _0x3f9133=[_0x9da1('0x4e'),'left_join',_0x9da1('0x4f'),'cross_join'];var _0x3dd3e0={'SUM':_0x9da1('0x51'),'COUNT':_0x9da1('0x52'),'COUNT DISTINCT':_0x9da1('0x53'),'MAX':_0x9da1('0x54'),'MIN':_0x9da1('0x55'),'AVG':_0x9da1('0x56'),'GROUP_CONCAT':_0x9da1('0x57'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9da1('0x58')};var _0x52e4a6={'SEC_TO_TIME':_0x9da1('0x59'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x9da1('0x5b'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x4aa903=function(_0x55d7f2){return!_['includes'](['IS\x20NULL',_0x9da1('0x5e'),_0x9da1('0x5f'),_0x9da1('0x85')],_0x55d7f2);};var _0x3212ad=function(_0x5ac65b){if(!_0x5ac65b||!_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')]){return'';}for(var _0x21a99d='(',_0xd19a7c=0x0;_0xd19a7c<_0x5ac65b[_0x9da1('0x60')][_0x9da1('0x33')];_0xd19a7c+=0x1){_0xd19a7c>0x0&&(_0x21a99d+='\x20'+_0x5ac65b[_0x9da1('0x86')]+'\x20');_0x21a99d+=_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]?_0x3212ad(_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x61')]):_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x6f')]+'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c]['condition']+(_0x4aa903(_0x5ac65b['rules'][_0xd19a7c][_0x9da1('0x62')])?'\x20'+_0x5ac65b[_0x9da1('0x60')][_0xd19a7c][_0x9da1('0x63')]:'');}return _0x21a99d+')';};var _0xb14af1={'where':{'id':_0x8280a9[_0x9da1('0x4c')]['id']}},_0x245566,_0x5b2591,_0x3c51e3,_0x54b83d,_0x23bf86;_0xb14af1=_['merge']({},_0xb14af1,_0x8280a9[_0x9da1('0x64')]);return db[_0x9da1('0x2a')][_0x9da1('0x65')](_0xb14af1)[_0x9da1('0x21')](function(_0x4bb140){if(_0x4bb140){_0x245566=_0x4bb140;return _0x4bb140[_0x9da1('0x66')]();}return null;})['then'](function(_0x47cbdd){if(_0x47cbdd){if(!_0x47cbdd['length']){throw new db[(_0x9da1('0x87'))][(_0x9da1('0x67'))](_0x9da1('0x68'),0x193);}_0x5b2591=_0x47cbdd;return db['AnalyticMetric'][_0x9da1('0x3e')]({'raw':!![]});}return null;})[_0x9da1('0x21')](function(_0x5e1e24){if(_0x5e1e24){_0x3c51e3=_[_0x9da1('0x6a')](_0x5e1e24,'id');var _0x49ddec;var _0x407218=squel['select']();_0x407218['from'](_0x245566['table']);for(var _0x316fee=0x0;_0x316fee<_0x5b2591['length'];_0x316fee+=0x1){_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x6e')]?_0x3c51e3[_0x5b2591[_0x316fee][_0x9da1('0x6e')]]['metric']:_0x5b2591[_0x316fee]['field'];_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x70')]?_['replace'](_0x3dd3e0[_0x5b2591[_0x316fee][_0x9da1('0x70')]],'%s',_0x49ddec):_0x49ddec;_0x49ddec=_0x5b2591[_0x316fee][_0x9da1('0x89')]?_['replace'](_0x52e4a6[_0x5b2591[_0x316fee]['format']],'%s',_0x49ddec):_0x49ddec;if(_0x5b2591[_0x316fee][_0x9da1('0x72')]){_0x407218[_0x9da1('0x61')](_0x49ddec);}_0x5b2591[_0x316fee][_0x9da1('0x73')]&&_0x407218[_0x9da1('0x74')](_0x49ddec,_0x5b2591[_0x316fee]['orderBy']==='DESC'?![]:!![]);_0x407218[_0x9da1('0x6f')](_0x49ddec,_0x5b2591[_0x316fee][_0x9da1('0x75')]||_0x49ddec);}if(_0x245566[_0x9da1('0x76')]){_0x245566[_0x9da1('0x76')]=JSON[_0x9da1('0x8b')](_0x245566['joins']);for(var _0x56ec7d=0x0;_0x56ec7d<_0x245566[_0x9da1('0x76')][_0x9da1('0x33')];_0x56ec7d+=0x1){if(_0x245566['joins'][_0x56ec7d][_0x9da1('0x39')]&&_['includes'](_0x3f9133,_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')])&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x8c')]&&_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')]&&_0x245566['joins'][_0x56ec7d][_0x9da1('0x78')]){_0x407218[_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x39')]](_0x245566[_0x9da1('0x76')][_0x56ec7d]['foreignTable'],null,util[_0x9da1('0x89')](_0x9da1('0x79'),_0x245566[_0x9da1('0x6d')],_0x245566['joins'][_0x56ec7d]['parentKey'],_0x245566[_0x9da1('0x76')][_0x56ec7d][_0x9da1('0x77')],_0x245566['joins'][_0x56ec7d]['foreignKey']));}}}if(_0x245566[_0x9da1('0x7a')]){_0x245566[_0x9da1('0x7a')]=JSON[_0x9da1('0x8b')](_0x245566[_0x9da1('0x7a')]);_0x407218[_0x9da1('0x37')](_0x3212ad(_0x245566['conditions'][_0x9da1('0x61')]));}_0x23bf86=_0x407218['clone']();_0x407218[_0x9da1('0x1c')](_0x1e466a);_0x407218[_0x9da1('0x1a')](0x0);logger[_0x9da1('0x7c')](_0x9da1('0x7d'),_0x407218['toString']());return dbH['sequelize'][_0x9da1('0x2e')](_0x407218[_0x9da1('0x7e')](),{'type':dbH[_0x9da1('0x7f')][_0x9da1('0x80')][_0x9da1('0x81')]});}})[_0x9da1('0x21')](function(){return{'sql':_0x23bf86['toString']()};})[_0x9da1('0x21')](respondWithResult(_0x374754,null))[_0x9da1('0x40')](handleError(_0x374754,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index d38a9a4..fa39dee 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 _0x715c=['./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x4a6d5f,_0x40ebfe){var _0x3aeb0d=function(_0x1a955b){while(--_0x1a955b){_0x4a6d5f['push'](_0x4a6d5f['shift']());}};_0x3aeb0d(++_0x40ebfe);}(_0x715c,0x1b2));var _0xc715=function(_0x1ae9ad,_0x2e761d){_0x1ae9ad=_0x1ae9ad-0x0;var _0x4f6f49=_0x715c[_0x1ae9ad];return _0x4f6f49;};'use strict';var _=require(_0xc715('0x0'));var util=require(_0xc715('0x1'));var logger=require(_0xc715('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc715('0x3'));var rp=require(_0xc715('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc715('0x5'));var config=require('../../config/environment');var attributes=require(_0xc715('0x6'));module[_0xc715('0x7')]=function(_0x19f1de,_0x1c6924){return _0x19f1de[_0xc715('0x8')](_0xc715('0x9'),attributes,{'tableName':_0xc715('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6f3=['api','moment','bluebird','request-promise','path','exports','define','analytics_default_reports','lodash','util','../../config/logger'];(function(_0x4cea63,_0x2cc3c2){var _0x3a4698=function(_0x1370ee){while(--_0x1370ee){_0x4cea63['push'](_0x4cea63['shift']());}};_0x3a4698(++_0x2cc3c2);}(_0xc6f3,0x189));var _0x3c6f=function(_0x83e917,_0x1791a1){_0x83e917=_0x83e917-0x0;var _0x40af5a=_0xc6f3[_0x83e917];return _0x40af5a;};'use strict';var _=require(_0x3c6f('0x0'));var util=require(_0x3c6f('0x1'));var logger=require(_0x3c6f('0x2'))(_0x3c6f('0x3'));var moment=require(_0x3c6f('0x4'));var BPromise=require(_0x3c6f('0x5'));var rp=require(_0x3c6f('0x6'));var fs=require('fs');var path=require(_0x3c6f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./analyticDefaultReport.attributes');module[_0x3c6f('0x8')]=function(_0x4031e5,_0x15f7cd){return _0x4031e5[_0x3c6f('0x9')]('AnalyticDefaultReport',attributes,{'tableName':_0x3c6f('0xa'),'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 3b41bf3..2f5b3ca 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 _0x421b=['result','catch','util','../../config/utils','../../config/logger','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x98e46e,_0x2319b4){var _0x16e2a8=function(_0x1658f1){while(--_0x1658f1){_0x98e46e['push'](_0x98e46e['shift']());}};_0x16e2a8(++_0x2319b4);}(_0x421b,0x1cd));var _0xb421=function(_0xb55bf0,_0x3bc96b){_0xb55bf0=_0xb55bf0-0x0;var _0x1cd7e2=_0x421b[_0xb55bf0];return _0x1cd7e2;};'use strict';var _=require('lodash');var util=require(_0xb421('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb421('0x1'));var logger=require(_0xb421('0x2'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb421('0x3')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4caaf8,_0x4d5d99,_0x194876){return new BPromise(function(_0xcb28eb,_0x5e5f99){return client[_0xb421('0x4')](_0x4caaf8,_0x194876)[_0xb421('0x5')](function(_0x24fb3a){logger[_0xb421('0x6')](_0xb421('0x7'),_0x4d5d99,_0xb421('0x8'));logger[_0xb421('0x9')](_0xb421('0xa'),_0x4d5d99,'request\x20sent',JSON[_0xb421('0xb')](_0x24fb3a));if(_0x24fb3a[_0xb421('0xc')]){if(_0x24fb3a[_0xb421('0xc')][_0xb421('0xd')]===0x1f4){logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x4d5d99,_0x24fb3a[_0xb421('0xc')][_0xb421('0xe')]);return _0x5e5f99(_0x24fb3a[_0xb421('0xc')][_0xb421('0xe')]);}logger[_0xb421('0xc')](_0xb421('0x7'),_0x4d5d99,_0x24fb3a['error']['message']);return _0xcb28eb(_0x24fb3a['error'][_0xb421('0xe')]);}else{logger[_0xb421('0x6')](_0xb421('0x7'),_0x4d5d99,_0xb421('0x8'));_0xcb28eb(_0x24fb3a[_0xb421('0xf')]['message']);}})[_0xb421('0x10')](function(_0x13d841){logger['error'](_0xb421('0x7'),_0x4d5d99,_0x13d841);_0x5e5f99(_0x13d841);});});} \ No newline at end of file +var _0xa36a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x54fba3,_0x25b7b9){var _0x58bc3a=function(_0x3fbe51){while(--_0x3fbe51){_0x54fba3['push'](_0x54fba3['shift']());}};_0x58bc3a(++_0x25b7b9);}(_0xa36a,0x10f));var _0xaa36=function(_0xbf6d36,_0x1eede8){_0xbf6d36=_0xbf6d36-0x0;var _0x149745=_0xa36a[_0xbf6d36];return _0x149745;};'use strict';var _=require('lodash');var util=require(_0xaa36('0x0'));var moment=require(_0xaa36('0x1'));var BPromise=require(_0xaa36('0x2'));var rs=require(_0xaa36('0x3'));var fs=require('fs');var Redis=require(_0xaa36('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xaa36('0x5'));var logger=require(_0xaa36('0x6'))(_0xaa36('0x7'));var config=require(_0xaa36('0x8'));var jayson=require(_0xaa36('0x9'));var client=jayson[_0xaa36('0xa')][_0xaa36('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x42bb56,_0x5705ee,_0xffd647){return new BPromise(function(_0x588f1c,_0x4abc3b){return client[_0xaa36('0xc')](_0x42bb56,_0xffd647)[_0xaa36('0xd')](function(_0x4acd15){logger[_0xaa36('0xe')](_0xaa36('0xf'),_0x5705ee,_0xaa36('0x10'));logger[_0xaa36('0x11')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x5705ee,_0xaa36('0x10'),JSON['stringify'](_0x4acd15));if(_0x4acd15[_0xaa36('0x12')]){if(_0x4acd15[_0xaa36('0x12')][_0xaa36('0x13')]===0x1f4){logger[_0xaa36('0x12')](_0xaa36('0xf'),_0x5705ee,_0x4acd15['error'][_0xaa36('0x14')]);return _0x4abc3b(_0x4acd15['error']['message']);}logger['error'](_0xaa36('0xf'),_0x5705ee,_0x4acd15[_0xaa36('0x12')][_0xaa36('0x14')]);return _0x588f1c(_0x4acd15[_0xaa36('0x12')][_0xaa36('0x14')]);}else{logger[_0xaa36('0xe')](_0xaa36('0xf'),_0x5705ee,_0xaa36('0x10'));_0x588f1c(_0x4acd15[_0xaa36('0x15')]['message']);}})[_0xaa36('0x16')](function(_0x31412a){logger[_0xaa36('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x5705ee,_0x31412a);_0x4abc3b(_0x31412a);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index cc736da..5e7e21a 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 _0xea5f=['update','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','isAuthenticated','get','/:id','show','/:id/preview','preview','run','/:id/query','query','post'];(function(_0xf05156,_0x1375f5){var _0x36a0dd=function(_0x2eef72){while(--_0x2eef72){_0xf05156['push'](_0xf05156['shift']());}};_0x36a0dd(++_0x1375f5);}(_0xea5f,0x156));var _0xfea5=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xea5f[_0x13b02f];return _0x12e9a6;};'use strict';var multer=require(_0xfea5('0x0'));var util=require('util');var path=require(_0xfea5('0x1'));var timeout=require('connect-timeout');var express=require(_0xfea5('0x2'));var router=express[_0xfea5('0x3')]();var fs_extra=require(_0xfea5('0x4'));var auth=require(_0xfea5('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xfea5('0x6'));var controller=require(_0xfea5('0x7'));router['get']('/',auth[_0xfea5('0x8')](),controller['index']);router[_0xfea5('0x9')](_0xfea5('0xa'),auth['isAuthenticated'](),controller[_0xfea5('0xb')]);router[_0xfea5('0x9')](_0xfea5('0xc'),auth[_0xfea5('0x8')](),controller[_0xfea5('0xd')]);router[_0xfea5('0x9')]('/:id/run',auth['isAuthenticated'](),controller[_0xfea5('0xe')]);router['get'](_0xfea5('0xf'),auth['isAuthenticated'](),controller[_0xfea5('0x10')]);router[_0xfea5('0x11')]('/',auth[_0xfea5('0x8')](),controller['create']);router['put'](_0xfea5('0xa'),auth[_0xfea5('0x8')](),controller[_0xfea5('0x12')]);router['delete'](_0xfea5('0xa'),auth[_0xfea5('0x8')](),controller['destroy']);module[_0xfea5('0x13')]=router; \ No newline at end of file +var _0x6798=['show','/:id/preview','isAuthenticated','preview','/:id/run','run','/:id/query','query','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','index','/:id'];(function(_0x429758,_0x93e7fa){var _0x352eda=function(_0x1a4c9f){while(--_0x1a4c9f){_0x429758['push'](_0x429758['shift']());}};_0x352eda(++_0x93e7fa);}(_0x6798,0x1a5));var _0x8679=function(_0x2df67c,_0x5eaa2e){_0x2df67c=_0x2df67c-0x0;var _0x4abed7=_0x6798[_0x2df67c];return _0x4abed7;};'use strict';var multer=require(_0x8679('0x0'));var util=require(_0x8679('0x1'));var path=require(_0x8679('0x2'));var timeout=require(_0x8679('0x3'));var express=require(_0x8679('0x4'));var router=express[_0x8679('0x5')]();var fs_extra=require(_0x8679('0x6'));var auth=require(_0x8679('0x7'));var interaction=require(_0x8679('0x8'));var config=require(_0x8679('0x9'));var controller=require(_0x8679('0xa'));router[_0x8679('0xb')]('/',auth['isAuthenticated'](),controller[_0x8679('0xc')]);router['get'](_0x8679('0xd'),auth['isAuthenticated'](),controller[_0x8679('0xe')]);router[_0x8679('0xb')](_0x8679('0xf'),auth[_0x8679('0x10')](),controller[_0x8679('0x11')]);router[_0x8679('0xb')](_0x8679('0x12'),auth[_0x8679('0x10')](),controller[_0x8679('0x13')]);router['get'](_0x8679('0x14'),auth[_0x8679('0x10')](),controller[_0x8679('0x15')]);router[_0x8679('0x16')]('/',auth[_0x8679('0x10')](),controller[_0x8679('0x17')]);router[_0x8679('0x18')](_0x8679('0xd'),auth['isAuthenticated'](),controller[_0x8679('0x19')]);router[_0x8679('0x1a')](_0x8679('0xd'),auth['isAuthenticated'](),controller[_0x8679('0x1b')]);module[_0x8679('0x1c')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index b2ea885..55eef48 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 _0xa5e0=['STRING','ENUM','csv','pdf','xlsx','DATE','manual','scheduled','INTEGER','UNSIGNED','sequelize','moment'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0xa5e0,0x14e));var _0x0a5e=function(_0x1886d1,_0x55ff51){_0x1886d1=_0x1886d1-0x0;var _0x43dfc5=_0xa5e0[_0x1886d1];return _0x43dfc5;};'use strict';var Sequelize=require(_0x0a5e('0x0'));var moment=require(_0x0a5e('0x1'));module['exports']={'name':{'type':Sequelize[_0x0a5e('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x0a5e('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x0a5e('0x3')](_0x0a5e('0x4'),_0x0a5e('0x5'),_0x0a5e('0x6')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x0a5e('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x0a5e('0x7')]},'endDate':{'type':Sequelize[_0x0a5e('0x7')]},'status':{'type':Sequelize[_0x0a5e('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize[_0x0a5e('0x3')](_0x0a5e('0x8'),_0x0a5e('0x9')),'allowNull':![],'defaultValue':_0x0a5e('0x8')},'reportId':{'type':Sequelize[_0x0a5e('0xa')](0xb)[_0x0a5e('0xb')]},'reportType':{'type':Sequelize[_0x0a5e('0x2')]}}; \ No newline at end of file +var _0x4b05=['DATE','Loading','scheduled','manual','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM','xlsx'];(function(_0x1a7c3f,_0x259e8a){var _0x49f75c=function(_0x5cfe75){while(--_0x5cfe75){_0x1a7c3f['push'](_0x1a7c3f['shift']());}};_0x49f75c(++_0x259e8a);}(_0x4b05,0x1d4));var _0x54b0=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4b05[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x54b0('0x0'));var moment=require('moment');module[_0x54b0('0x1')]={'name':{'type':Sequelize[_0x54b0('0x2')],'allowNull':![]},'basename':{'type':Sequelize[_0x54b0('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x54b0('0x3')]('csv','pdf',_0x54b0('0x4')),'allowNull':![],'defaultValue':'csv'},'savename':{'type':Sequelize[_0x54b0('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x54b0('0x5')]},'status':{'type':Sequelize['STRING'],'defaultValue':_0x54b0('0x6')},'type':{'type':Sequelize[_0x54b0('0x3')]('manual',_0x54b0('0x7')),'allowNull':![],'defaultValue':_0x54b0('0x8')},'reportId':{'type':Sequelize[_0x54b0('0x9')](0xb)[_0x54b0('0xa')]},'reportType':{'type':Sequelize[_0x54b0('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index bdb739f..fd839f4 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 _0x2480=['json','offset','undefined','count','limit','set','Content-Range','reject','update','then','get','ExtractedReports','destroy','error','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','AnalyticExtractedReport','include','findAll','rows','catch','show','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','basename','savename','output','existsSync','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end'];(function(_0x552fce,_0x3f24bc){var _0x3e27a2=function(_0xc91154){while(--_0xc91154){_0x552fce['push'](_0x552fce['shift']());}};_0x3e27a2(++_0x3f24bc);}(_0x2480,0xf9));var _0x0248=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x2480[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x0248('0x0'));var rimraf=require(_0x0248('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0248('0x2'));var rp=require('request-promise');var moment=require(_0x0248('0x3'));var BPromise=require(_0x0248('0x4'));var Mustache=require(_0x0248('0x5'));var util=require(_0x0248('0x6'));var path=require('path');var sox=require(_0x0248('0x7'));var csv=require(_0x0248('0x8'));var ejs=require(_0x0248('0x9'));var fs=require('fs');var fs_extra=require(_0x0248('0xa'));var _=require(_0x0248('0xb'));var squel=require('squel');var crypto=require(_0x0248('0xc'));var jsforce=require(_0x0248('0xd'));var deskjs=require(_0x0248('0xe'));var toCsv=require(_0x0248('0x8'));var querystring=require('querystring');var Papa=require(_0x0248('0xf'));var Redis=require(_0x0248('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0248('0x11'))('api');var utils=require(_0x0248('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0248('0x13'));var db=require(_0x0248('0x14'))['db'];function respondWithStatusCode(_0xe214ab,_0x19c3a4){_0x19c3a4=_0x19c3a4||0xcc;return function(_0x2f3ba2){if(_0x2f3ba2){return _0xe214ab[_0x0248('0x15')](_0x19c3a4);}return _0xe214ab[_0x0248('0x16')](_0x19c3a4)[_0x0248('0x17')]();};}function respondWithResult(_0x248ec3,_0x72c384){_0x72c384=_0x72c384||0xc8;return function(_0xf6f283){if(_0xf6f283){return _0x248ec3[_0x0248('0x16')](_0x72c384)[_0x0248('0x18')](_0xf6f283);}};}function respondWithFilteredResult(_0xd1eb9,_0x4b6132){return function(_0x4db360){if(_0x4db360){var _0x1048f2=typeof _0x4b6132[_0x0248('0x19')]===_0x0248('0x1a')&&typeof _0x4b6132['limit']===_0x0248('0x1a');var _0x39e626=_0x4db360[_0x0248('0x1b')];var _0x3b74c3=_0x1048f2?0x0:_0x4b6132[_0x0248('0x19')];var _0x368a65=_0x1048f2?_0x4db360[_0x0248('0x1b')]:_0x4b6132['offset']+_0x4b6132[_0x0248('0x1c')];var _0x972725;if(_0x368a65>=_0x39e626){_0x368a65=_0x39e626;_0x972725=0xc8;}else{_0x972725=0xce;}_0xd1eb9[_0x0248('0x16')](_0x972725);return _0xd1eb9[_0x0248('0x1d')](_0x0248('0x1e'),_0x3b74c3+'-'+_0x368a65+'/'+_0x39e626)[_0x0248('0x18')](_0x4db360);}return null;};}function patchUpdates(_0xb2a949){return function(_0x52113a){try{jsonpatch['apply'](_0x52113a,_0xb2a949,!![]);}catch(_0x46090b){return BPromise[_0x0248('0x1f')](_0x46090b);}return _0x52113a['save']();};}function saveUpdates(_0x3e5374,_0x512ae4){return function(_0x367127){if(_0x367127){return _0x367127[_0x0248('0x20')](_0x3e5374)[_0x0248('0x21')](function(_0x3d5c7b){return _0x3d5c7b;});}return null;};}function removeEntity(_0x36f5aa,_0xfc0fff){return function(_0x390086){if(_0x390086){return _0x390086['destroy']()[_0x0248('0x21')](function(){var _0x45ae17=_0x390086[_0x0248('0x22')]({'plain':!![]});var _0x458c80=_0x0248('0x23');return db['UserProfileResource'][_0x0248('0x24')]({'where':{'type':_0x458c80,'resourceId':_0x45ae17['id']}})[_0x0248('0x21')](function(){return _0x390086;});})[_0x0248('0x21')](function(){_0x36f5aa['status'](0xcc)[_0x0248('0x17')]();});}};}function handleEntityNotFound(_0x1e1793,_0x19a040){return function(_0x4a5e86){if(!_0x4a5e86){_0x1e1793[_0x0248('0x15')](0x194);}return _0x4a5e86;};}function handleError(_0x372ac5,_0x5ab758){_0x5ab758=_0x5ab758||0x1f4;return function(_0x21814d){logger[_0x0248('0x25')](_0x21814d['stack']);if(_0x21814d[_0x0248('0x26')]){delete _0x21814d[_0x0248('0x26')];}_0x372ac5['status'](_0x5ab758)[_0x0248('0x27')](_0x21814d);};}exports[_0x0248('0x28')]=function(_0x2ab0aa,_0x4e9781){var _0x45fe37={},_0xc7bdc3={},_0x16bcb6={'count':0x0,'rows':[]};var _0x336cec=_['map'](db['AnalyticExtractedReport'][_0x0248('0x29')],function(_0x18d73b){return{'name':_0x18d73b['fieldName'],'type':_0x18d73b[_0x0248('0x2a')][_0x0248('0x2b')]};});_0xc7bdc3[_0x0248('0x2c')]=_[_0x0248('0x2d')](_0x336cec,_0x0248('0x26'));_0xc7bdc3[_0x0248('0x2e')]=_[_0x0248('0x2f')](_0x2ab0aa[_0x0248('0x2e')]);_0xc7bdc3[_0x0248('0x30')]=_[_0x0248('0x31')](_0xc7bdc3['model'],_0xc7bdc3['query']);_0x45fe37[_0x0248('0x32')]=_[_0x0248('0x31')](_0xc7bdc3[_0x0248('0x2c')],qs[_0x0248('0x33')](_0x2ab0aa[_0x0248('0x2e')][_0x0248('0x33')]));_0x45fe37[_0x0248('0x32')]=_0x45fe37[_0x0248('0x32')][_0x0248('0x34')]?_0x45fe37[_0x0248('0x32')]:_0xc7bdc3[_0x0248('0x2c')];if(!_0x2ab0aa[_0x0248('0x2e')][_0x0248('0x35')](_0x0248('0x36'))){_0x45fe37[_0x0248('0x1c')]=qs['limit'](_0x2ab0aa[_0x0248('0x2e')][_0x0248('0x1c')]);_0x45fe37['offset']=qs[_0x0248('0x19')](_0x2ab0aa[_0x0248('0x2e')][_0x0248('0x19')]);}_0x45fe37[_0x0248('0x37')]=qs['sort'](_0x2ab0aa['query'][_0x0248('0x38')]);_0x45fe37['where']=qs[_0x0248('0x30')](_[_0x0248('0x39')](_0x2ab0aa['query'],_0xc7bdc3[_0x0248('0x30')]),_0x336cec);if(_0x2ab0aa[_0x0248('0x2e')][_0x0248('0x3a')]){_0x45fe37[_0x0248('0x3b')]=_[_0x0248('0x3c')](_0x45fe37[_0x0248('0x3b')],{'$or':_[_0x0248('0x2d')](_0x336cec,function(_0x31eedf){if(_0x31eedf[_0x0248('0x2a')]!==_0x0248('0x3d')){var _0x24cd20={};_0x24cd20[_0x31eedf[_0x0248('0x26')]]={'$like':'%'+_0x2ab0aa[_0x0248('0x2e')][_0x0248('0x3a')]+'%'};return _0x24cd20;}})});}_0x45fe37=_['merge']({},_0x45fe37,_0x2ab0aa['options']);var _0x18d078={'where':_0x45fe37[_0x0248('0x3b')]};return db[_0x0248('0x3e')][_0x0248('0x1b')](_0x18d078)['then'](function(_0x597f82){_0x16bcb6[_0x0248('0x1b')]=_0x597f82;if(_0x2ab0aa[_0x0248('0x2e')]['includeAll']){_0x45fe37[_0x0248('0x3f')]=[{'all':!![]}];}return db[_0x0248('0x3e')][_0x0248('0x40')](_0x45fe37);})[_0x0248('0x21')](function(_0x1876f9){_0x16bcb6[_0x0248('0x41')]=_0x1876f9;return _0x16bcb6;})[_0x0248('0x21')](respondWithFilteredResult(_0x4e9781,_0x45fe37))[_0x0248('0x42')](handleError(_0x4e9781,null));};exports[_0x0248('0x43')]=function(_0x57fd34,_0x2e8ffd){var _0x3eea91={'raw':!![],'where':{'id':_0x57fd34['params']['id']}},_0x540964={};_0x540964['model']=_['keys'](db[_0x0248('0x3e')][_0x0248('0x29')]);_0x540964[_0x0248('0x2e')]=_[_0x0248('0x2f')](_0x57fd34[_0x0248('0x2e')]);_0x540964[_0x0248('0x30')]=_['intersection'](_0x540964[_0x0248('0x2c')],_0x540964[_0x0248('0x2e')]);_0x3eea91['attributes']=_[_0x0248('0x31')](_0x540964[_0x0248('0x2c')],qs[_0x0248('0x33')](_0x57fd34[_0x0248('0x2e')][_0x0248('0x33')]));_0x3eea91['attributes']=_0x3eea91[_0x0248('0x32')][_0x0248('0x34')]?_0x3eea91[_0x0248('0x32')]:_0x540964[_0x0248('0x2c')];if(_0x57fd34[_0x0248('0x2e')][_0x0248('0x44')]){_0x3eea91[_0x0248('0x3f')]=[{'all':!![]}];}_0x3eea91=_[_0x0248('0x3c')]({},_0x3eea91,_0x57fd34[_0x0248('0x45')]);return db[_0x0248('0x3e')][_0x0248('0x46')](_0x3eea91)[_0x0248('0x21')](handleEntityNotFound(_0x2e8ffd,null))['then'](respondWithResult(_0x2e8ffd,null))[_0x0248('0x42')](handleError(_0x2e8ffd,null));};exports[_0x0248('0x47')]=function(_0x5501fa,_0x54b169){return db[_0x0248('0x3e')][_0x0248('0x47')](_0x5501fa[_0x0248('0x48')],{})['then'](function(_0x13cd61){var _0x600898=_0x5501fa[_0x0248('0x49')]['get']({'plain':!![]});if(!_0x600898)throw new Error(_0x0248('0x4a'));if(_0x600898[_0x0248('0x4b')]===_0x0248('0x49')){var _0x78aeeb=_0x13cd61[_0x0248('0x22')]({'plain':!![]});var _0x5a4a00='ExtractedReports';return db[_0x0248('0x4c')][_0x0248('0x46')]({'where':{'name':_0x5a4a00,'userProfileId':_0x600898['userProfileId']},'raw':!![]})['then'](function(_0x91edfa){if(_0x91edfa&&_0x91edfa[_0x0248('0x4d')]===0x0){return db[_0x0248('0x4e')]['create']({'name':_0x78aeeb[_0x0248('0x26')],'resourceId':_0x78aeeb['id'],'type':_0x91edfa[_0x0248('0x26')],'sectionId':_0x91edfa['id']},{})[_0x0248('0x21')](function(){return _0x13cd61;});}else{return _0x13cd61;}})[_0x0248('0x42')](function(_0xf5d7b3){logger[_0x0248('0x25')](_0x0248('0x4f'),_0xf5d7b3);throw _0xf5d7b3;});}return _0x13cd61;})[_0x0248('0x21')](respondWithResult(_0x54b169,0xc9))[_0x0248('0x42')](handleError(_0x54b169,null));};exports[_0x0248('0x20')]=function(_0x165668,_0x252f03){if(_0x165668['body']['id']){delete _0x165668[_0x0248('0x48')]['id'];}return db[_0x0248('0x3e')][_0x0248('0x46')]({'where':{'id':_0x165668[_0x0248('0x50')]['id']}})['then'](handleEntityNotFound(_0x252f03,null))[_0x0248('0x21')](saveUpdates(_0x165668[_0x0248('0x48')],null))['then'](respondWithResult(_0x252f03,null))[_0x0248('0x42')](handleError(_0x252f03,null));};exports[_0x0248('0x24')]=function(_0x242685,_0x34f9f3){return db[_0x0248('0x3e')][_0x0248('0x46')]({'where':{'id':_0x242685[_0x0248('0x50')]['id']}})[_0x0248('0x21')](handleEntityNotFound(_0x34f9f3,null))[_0x0248('0x21')](removeEntity(_0x34f9f3,null))[_0x0248('0x42')](handleError(_0x34f9f3,null));};exports['download']=function(_0x5759bb,_0x171be8,_0x1c555e){return db['AnalyticExtractedReport'][_0x0248('0x46')]({'where':{'id':_0x5759bb[_0x0248('0x50')]['id']},'attributes':['name',_0x0248('0x51'),_0x0248('0x52'),_0x0248('0x53')],'raw':!![]})[_0x0248('0x21')](handleEntityNotFound(_0x171be8,null))[_0x0248('0x21')](function(_0x31f19d){if(_0x31f19d){if(!fs[_0x0248('0x54')](path['join'](config['root'],_0x0248('0x55'),_0x31f19d[_0x0248('0x52')]))){throw new db[(_0x0248('0x56'))][(_0x0248('0x57'))](_0x0248('0x58'));}if(_0x5759bb[_0x0248('0x2e')][_0x0248('0x59')]){return _0x171be8['sendStatus'](0xc8);}return _0x171be8['download'](path['join'](config['root'],'server/files/reports',_0x31f19d[_0x0248('0x52')]),util[_0x0248('0x5a')]('%s.%s',_0x31f19d[_0x0248('0x51')]||_0x31f19d[_0x0248('0x26')],_0x31f19d[_0x0248('0x53')]['toLowerCase']()));}})[_0x0248('0x42')](handleError(_0x171be8,null));}; \ No newline at end of file +var _0x1111=['squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','ExtractedReports','UserProfileResource','status','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','type','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','VIRTUAL','options','include','findAll','catch','params','length','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','basename','savename','existsSync','root','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','join','format','%s.%s','output','toLowerCase','eml-format','zip-dir','request-promise','util','path','to-csv','ejs','lodash'];(function(_0x48ecd2,_0x481ad3){var _0x5a4457=function(_0xdd9abd){while(--_0xdd9abd){_0x48ecd2['push'](_0x48ecd2['shift']());}};_0x5a4457(++_0x481ad3);}(_0x1111,0xb0));var _0x1111=function(_0xc4abcf,_0x1fd9bc){_0xc4abcf=_0xc4abcf-0x0;var _0x45164c=_0x1111[_0xc4abcf];return _0x45164c;};'use strict';var emlformat=require(_0x1111('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1111('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1111('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1111('0x3'));var path=require(_0x1111('0x4'));var sox=require('sox');var csv=require(_0x1111('0x5'));var ejs=require(_0x1111('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1111('0x7'));var squel=require(_0x1111('0x8'));var crypto=require(_0x1111('0x9'));var jsforce=require(_0x1111('0xa'));var deskjs=require(_0x1111('0xb'));var toCsv=require(_0x1111('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x1111('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0x1111('0xd'));var hardwareService=require(_0x1111('0xe'));var logger=require(_0x1111('0xf'))(_0x1111('0x10'));var utils=require(_0x1111('0x11'));var config=require(_0x1111('0x12'));var licenseUtil=require(_0x1111('0x13'));var db=require(_0x1111('0x14'))['db'];function respondWithStatusCode(_0x48bd46,_0x8e36b1){_0x8e36b1=_0x8e36b1||0xcc;return function(_0x5c1bbb){if(_0x5c1bbb){return _0x48bd46[_0x1111('0x15')](_0x8e36b1);}return _0x48bd46['status'](_0x8e36b1)[_0x1111('0x16')]();};}function respondWithResult(_0x150444,_0x360061){_0x360061=_0x360061||0xc8;return function(_0x433f75){if(_0x433f75){return _0x150444['status'](_0x360061)[_0x1111('0x17')](_0x433f75);}};}function respondWithFilteredResult(_0x7144b2,_0x5e6250){return function(_0x180299){if(_0x180299){var _0x26bb88=typeof _0x5e6250[_0x1111('0x18')]===_0x1111('0x19')&&typeof _0x5e6250[_0x1111('0x1a')]==='undefined';var _0xf652f1=_0x180299[_0x1111('0x1b')];var _0x5c0b14=_0x26bb88?0x0:_0x5e6250[_0x1111('0x18')];var _0x538f46=_0x26bb88?_0x180299[_0x1111('0x1b')]:_0x5e6250[_0x1111('0x18')]+_0x5e6250[_0x1111('0x1a')];var _0x5c975d;if(_0x538f46>=_0xf652f1){_0x538f46=_0xf652f1;_0x5c975d=0xc8;}else{_0x5c975d=0xce;}_0x7144b2['status'](_0x5c975d);return _0x7144b2[_0x1111('0x1c')](_0x1111('0x1d'),_0x5c0b14+'-'+_0x538f46+'/'+_0xf652f1)[_0x1111('0x17')](_0x180299);}return null;};}function patchUpdates(_0x338d26){return function(_0x554aff){try{jsonpatch['apply'](_0x554aff,_0x338d26,!![]);}catch(_0x3aa386){return BPromise[_0x1111('0x1e')](_0x3aa386);}return _0x554aff[_0x1111('0x1f')]();};}function saveUpdates(_0x495d4c,_0x1a1577){return function(_0x257d44){if(_0x257d44){return _0x257d44[_0x1111('0x20')](_0x495d4c)[_0x1111('0x21')](function(_0x4231c0){return _0x4231c0;});}return null;};}function removeEntity(_0x5ca17c,_0x10716f){return function(_0x26c6e4){if(_0x26c6e4){return _0x26c6e4[_0x1111('0x22')]()['then'](function(){var _0x26dd3e=_0x26c6e4['get']({'plain':!![]});var _0x211078=_0x1111('0x23');return db[_0x1111('0x24')][_0x1111('0x22')]({'where':{'type':_0x211078,'resourceId':_0x26dd3e['id']}})[_0x1111('0x21')](function(){return _0x26c6e4;});})[_0x1111('0x21')](function(){_0x5ca17c[_0x1111('0x25')](0xcc)[_0x1111('0x16')]();});}};}function handleEntityNotFound(_0x1195b5,_0x584477){return function(_0x4feaec){if(!_0x4feaec){_0x1195b5['sendStatus'](0x194);}return _0x4feaec;};}function handleError(_0x1ed4f2,_0x1206d9){_0x1206d9=_0x1206d9||0x1f4;return function(_0x5af580){logger[_0x1111('0x26')](_0x5af580[_0x1111('0x27')]);if(_0x5af580[_0x1111('0x28')]){delete _0x5af580[_0x1111('0x28')];}_0x1ed4f2[_0x1111('0x25')](_0x1206d9)[_0x1111('0x29')](_0x5af580);};}exports[_0x1111('0x2a')]=function(_0x10b2c7,_0x216b7e){var _0xf465c5={},_0x56e774={},_0x35ce36={'count':0x0,'rows':[]};var _0x96691e=_[_0x1111('0x2b')](db[_0x1111('0x2c')][_0x1111('0x2d')],function(_0x59b59){return{'name':_0x59b59['fieldName'],'type':_0x59b59[_0x1111('0x2e')]['key']};});_0x56e774[_0x1111('0x2f')]=_['map'](_0x96691e,_0x1111('0x28'));_0x56e774['query']=_[_0x1111('0x30')](_0x10b2c7[_0x1111('0x31')]);_0x56e774['filters']=_[_0x1111('0x32')](_0x56e774[_0x1111('0x2f')],_0x56e774[_0x1111('0x31')]);_0xf465c5[_0x1111('0x33')]=_[_0x1111('0x32')](_0x56e774[_0x1111('0x2f')],qs[_0x1111('0x34')](_0x10b2c7['query']['fields']));_0xf465c5[_0x1111('0x33')]=_0xf465c5[_0x1111('0x33')]['length']?_0xf465c5[_0x1111('0x33')]:_0x56e774[_0x1111('0x2f')];if(!_0x10b2c7[_0x1111('0x31')][_0x1111('0x35')](_0x1111('0x36'))){_0xf465c5[_0x1111('0x1a')]=qs[_0x1111('0x1a')](_0x10b2c7['query'][_0x1111('0x1a')]);_0xf465c5[_0x1111('0x18')]=qs['offset'](_0x10b2c7['query']['offset']);}_0xf465c5[_0x1111('0x37')]=qs['sort'](_0x10b2c7['query']['sort']);_0xf465c5[_0x1111('0x38')]=qs[_0x1111('0x39')](_[_0x1111('0x3a')](_0x10b2c7[_0x1111('0x31')],_0x56e774[_0x1111('0x39')]),_0x96691e);if(_0x10b2c7[_0x1111('0x31')][_0x1111('0x3b')]){_0xf465c5['where']=_[_0x1111('0x3c')](_0xf465c5[_0x1111('0x38')],{'$or':_['map'](_0x96691e,function(_0x13ede2){if(_0x13ede2[_0x1111('0x2e')]!==_0x1111('0x3d')){var _0x4ea504={};_0x4ea504[_0x13ede2[_0x1111('0x28')]]={'$like':'%'+_0x10b2c7[_0x1111('0x31')][_0x1111('0x3b')]+'%'};return _0x4ea504;}})});}_0xf465c5=_[_0x1111('0x3c')]({},_0xf465c5,_0x10b2c7[_0x1111('0x3e')]);var _0x51f8e4={'where':_0xf465c5[_0x1111('0x38')]};return db[_0x1111('0x2c')][_0x1111('0x1b')](_0x51f8e4)[_0x1111('0x21')](function(_0x298ee7){_0x35ce36[_0x1111('0x1b')]=_0x298ee7;if(_0x10b2c7['query']['includeAll']){_0xf465c5[_0x1111('0x3f')]=[{'all':!![]}];}return db[_0x1111('0x2c')][_0x1111('0x40')](_0xf465c5);})[_0x1111('0x21')](function(_0x34d82b){_0x35ce36['rows']=_0x34d82b;return _0x35ce36;})[_0x1111('0x21')](respondWithFilteredResult(_0x216b7e,_0xf465c5))[_0x1111('0x41')](handleError(_0x216b7e,null));};exports['show']=function(_0x53db32,_0x3a926e){var _0x40b216={'raw':!![],'where':{'id':_0x53db32[_0x1111('0x42')]['id']}},_0x7d5305={};_0x7d5305[_0x1111('0x2f')]=_['keys'](db[_0x1111('0x2c')][_0x1111('0x2d')]);_0x7d5305[_0x1111('0x31')]=_[_0x1111('0x30')](_0x53db32[_0x1111('0x31')]);_0x7d5305[_0x1111('0x39')]=_[_0x1111('0x32')](_0x7d5305['model'],_0x7d5305[_0x1111('0x31')]);_0x40b216[_0x1111('0x33')]=_[_0x1111('0x32')](_0x7d5305[_0x1111('0x2f')],qs[_0x1111('0x34')](_0x53db32[_0x1111('0x31')][_0x1111('0x34')]));_0x40b216[_0x1111('0x33')]=_0x40b216['attributes'][_0x1111('0x43')]?_0x40b216[_0x1111('0x33')]:_0x7d5305[_0x1111('0x2f')];if(_0x53db32[_0x1111('0x31')][_0x1111('0x44')]){_0x40b216['include']=[{'all':!![]}];}_0x40b216=_[_0x1111('0x3c')]({},_0x40b216,_0x53db32['options']);return db[_0x1111('0x2c')][_0x1111('0x45')](_0x40b216)[_0x1111('0x21')](handleEntityNotFound(_0x3a926e,null))[_0x1111('0x21')](respondWithResult(_0x3a926e,null))[_0x1111('0x41')](handleError(_0x3a926e,null));};exports[_0x1111('0x46')]=function(_0x209c84,_0x458692){return db[_0x1111('0x2c')][_0x1111('0x46')](_0x209c84[_0x1111('0x47')],{})['then'](function(_0x32bda3){var _0x9ea314=_0x209c84[_0x1111('0x48')][_0x1111('0x49')]({'plain':!![]});if(!_0x9ea314)throw new Error(_0x1111('0x4a'));if(_0x9ea314['role']===_0x1111('0x48')){var _0x1f3fca=_0x32bda3[_0x1111('0x49')]({'plain':!![]});var _0x133c81='ExtractedReports';return db[_0x1111('0x4b')][_0x1111('0x45')]({'where':{'name':_0x133c81,'userProfileId':_0x9ea314['userProfileId']},'raw':!![]})[_0x1111('0x21')](function(_0x4f039c){if(_0x4f039c&&_0x4f039c[_0x1111('0x4c')]===0x0){return db[_0x1111('0x24')]['create']({'name':_0x1f3fca[_0x1111('0x28')],'resourceId':_0x1f3fca['id'],'type':_0x4f039c[_0x1111('0x28')],'sectionId':_0x4f039c['id']},{})[_0x1111('0x21')](function(){return _0x32bda3;});}else{return _0x32bda3;}})['catch'](function(_0x5666f1){logger[_0x1111('0x26')](_0x1111('0x4d'),_0x5666f1);throw _0x5666f1;});}return _0x32bda3;})[_0x1111('0x21')](respondWithResult(_0x458692,0xc9))[_0x1111('0x41')](handleError(_0x458692,null));};exports['update']=function(_0x2d598f,_0x48a35d){if(_0x2d598f[_0x1111('0x47')]['id']){delete _0x2d598f[_0x1111('0x47')]['id'];}return db[_0x1111('0x2c')]['find']({'where':{'id':_0x2d598f['params']['id']}})[_0x1111('0x21')](handleEntityNotFound(_0x48a35d,null))['then'](saveUpdates(_0x2d598f[_0x1111('0x47')],null))[_0x1111('0x21')](respondWithResult(_0x48a35d,null))[_0x1111('0x41')](handleError(_0x48a35d,null));};exports[_0x1111('0x22')]=function(_0x5cb1f6,_0x4763da){return db[_0x1111('0x2c')][_0x1111('0x45')]({'where':{'id':_0x5cb1f6[_0x1111('0x42')]['id']}})['then'](handleEntityNotFound(_0x4763da,null))['then'](removeEntity(_0x4763da,null))[_0x1111('0x41')](handleError(_0x4763da,null));};exports['download']=function(_0x57ae2d,_0x2129df,_0x2c89b2){return db[_0x1111('0x2c')]['find']({'where':{'id':_0x57ae2d[_0x1111('0x42')]['id']},'attributes':['name',_0x1111('0x4e'),_0x1111('0x4f'),'output'],'raw':!![]})[_0x1111('0x21')](handleEntityNotFound(_0x2129df,null))[_0x1111('0x21')](function(_0x19305e){if(_0x19305e){if(!fs[_0x1111('0x50')](path['join'](config[_0x1111('0x51')],_0x1111('0x52'),_0x19305e[_0x1111('0x4f')]))){throw new db['Sequelize'][(_0x1111('0x53'))](_0x1111('0x54'));}if(_0x57ae2d[_0x1111('0x31')][_0x1111('0x55')]){return _0x2129df[_0x1111('0x15')](0xc8);}return _0x2129df[_0x1111('0x56')](path[_0x1111('0x57')](config[_0x1111('0x51')],_0x1111('0x52'),_0x19305e[_0x1111('0x4f')]),util[_0x1111('0x58')](_0x1111('0x59'),_0x19305e[_0x1111('0x4e')]||_0x19305e['name'],_0x19305e[_0x1111('0x5a')][_0x1111('0x5b')]()));}})[_0x1111('0x41')](handleError(_0x2129df,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index 195c4ce..e3aac59 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 _0x9b90=['rimraf','../../config/environment','exports','define','AnalyticExtractedReport','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x247cf7,_0x2abdc8){var _0x543e9a=function(_0x48c933){while(--_0x48c933){_0x247cf7['push'](_0x247cf7['shift']());}};_0x543e9a(++_0x2abdc8);}(_0x9b90,0x119));var _0x09b9=function(_0x4b47af,_0x2bc976){_0x4b47af=_0x4b47af-0x0;var _0x33a8ff=_0x9b90[_0x4b47af];return _0x33a8ff;};'use strict';var _=require(_0x09b9('0x0'));var util=require(_0x09b9('0x1'));var logger=require(_0x09b9('0x2'))('api');var moment=require(_0x09b9('0x3'));var BPromise=require(_0x09b9('0x4'));var rp=require(_0x09b9('0x5'));var fs=require('fs');var path=require(_0x09b9('0x6'));var rimraf=require(_0x09b9('0x7'));var config=require(_0x09b9('0x8'));var attributes=require('./analyticExtractedReport.attributes');module[_0x09b9('0x9')]=function(_0x3da87d,_0x465603){return _0x3da87d[_0x09b9('0xa')](_0x09b9('0xb'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe78d=['./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','lodash','util','../../config/logger','request-promise'];(function(_0x5bc204,_0x4c5881){var _0x3eadd9=function(_0x23320d){while(--_0x23320d){_0x5bc204['push'](_0x5bc204['shift']());}};_0x3eadd9(++_0x4c5881);}(_0xe78d,0xcc));var _0xde78=function(_0x648163,_0x241576){_0x648163=_0x648163-0x0;var _0x199d4d=_0xe78d[_0x648163];return _0x199d4d;};'use strict';var _=require(_0xde78('0x0'));var util=require(_0xde78('0x1'));var logger=require(_0xde78('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xde78('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xde78('0x4'));module[_0xde78('0x5')]=function(_0x56e1cd,_0x39deae){return _0x56e1cd['define'](_0xde78('0x6'),attributes,{'tableName':_0xde78('0x7'),'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 445b97b..e0d80e1 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 _0x8226=['randomstring','ioredis','../../mysqldb','../../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','stringify','error','code','message','result','catch','lodash','moment','bluebird'];(function(_0x56242d,_0x1dd061){var _0x5d7033=function(_0x11c707){while(--_0x11c707){_0x56242d['push'](_0x56242d['shift']());}};_0x5d7033(++_0x1dd061);}(_0x8226,0xe7));var _0x6822=function(_0x9e05d1,_0x3cef4a){_0x9e05d1=_0x9e05d1-0x0;var _0x4f7e97=_0x8226[_0x9e05d1];return _0x4f7e97;};'use strict';var _=require(_0x6822('0x0'));var util=require('util');var moment=require(_0x6822('0x1'));var BPromise=require(_0x6822('0x2'));var rs=require(_0x6822('0x3'));var fs=require('fs');var Redis=require(_0x6822('0x4'));var db=require(_0x6822('0x5'))['db'];var utils=require(_0x6822('0x6'));var logger=require(_0x6822('0x7'))(_0x6822('0x8'));var config=require(_0x6822('0x9'));var jayson=require(_0x6822('0xa'));var client=jayson[_0x6822('0xb')][_0x6822('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x48dfd0,_0x2c7ea5,_0x4fbf59){return new BPromise(function(_0x56a7fe,_0x2c94cf){return client[_0x6822('0xd')](_0x48dfd0,_0x4fbf59)[_0x6822('0xe')](function(_0x28e7e9){logger[_0x6822('0xf')](_0x6822('0x10'),_0x2c7ea5,_0x6822('0x11'));logger[_0x6822('0x12')](_0x6822('0x13'),_0x2c7ea5,'request\x20sent',JSON[_0x6822('0x14')](_0x28e7e9));if(_0x28e7e9[_0x6822('0x15')]){if(_0x28e7e9[_0x6822('0x15')][_0x6822('0x16')]===0x1f4){logger['error'](_0x6822('0x10'),_0x2c7ea5,_0x28e7e9['error'][_0x6822('0x17')]);return _0x2c94cf(_0x28e7e9[_0x6822('0x15')][_0x6822('0x17')]);}logger[_0x6822('0x15')](_0x6822('0x10'),_0x2c7ea5,_0x28e7e9[_0x6822('0x15')][_0x6822('0x17')]);return _0x56a7fe(_0x28e7e9[_0x6822('0x15')][_0x6822('0x17')]);}else{logger[_0x6822('0xf')](_0x6822('0x10'),_0x2c7ea5,_0x6822('0x11'));_0x56a7fe(_0x28e7e9[_0x6822('0x18')][_0x6822('0x17')]);}})[_0x6822('0x19')](function(_0xb363a){logger[_0x6822('0x15')](_0x6822('0x10'),_0x2c7ea5,_0xb363a);_0x2c94cf(_0xb363a);});});} \ No newline at end of file +var _0x6084=['randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticExtractedReport,\x20%s,\x20%s','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','bluebird'];(function(_0x534be4,_0x6b028d){var _0x24aece=function(_0x3505fb){while(--_0x3505fb){_0x534be4['push'](_0x534be4['shift']());}};_0x24aece(++_0x6b028d);}(_0x6084,0x155));var _0x4608=function(_0x184493,_0x140a20){_0x184493=_0x184493-0x0;var _0x1faa06=_0x6084[_0x184493];return _0x1faa06;};'use strict';var _=require(_0x4608('0x0'));var util=require(_0x4608('0x1'));var moment=require(_0x4608('0x2'));var BPromise=require(_0x4608('0x3'));var rs=require(_0x4608('0x4'));var fs=require('fs');var Redis=require(_0x4608('0x5'));var db=require(_0x4608('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4608('0x7'));var config=require(_0x4608('0x8'));var jayson=require(_0x4608('0x9'));var client=jayson[_0x4608('0xa')][_0x4608('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x443408,_0x260997,_0xf6b619){return new BPromise(function(_0x20deef,_0x59b3ad){return client['request'](_0x443408,_0xf6b619)['then'](function(_0x485d22){logger[_0x4608('0xc')](_0x4608('0xd'),_0x260997,'request\x20sent');logger[_0x4608('0xe')](_0x4608('0xf'),_0x260997,'request\x20sent',JSON[_0x4608('0x10')](_0x485d22));if(_0x485d22[_0x4608('0x11')]){if(_0x485d22[_0x4608('0x11')][_0x4608('0x12')]===0x1f4){logger[_0x4608('0x11')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x260997,_0x485d22[_0x4608('0x11')][_0x4608('0x13')]);return _0x59b3ad(_0x485d22[_0x4608('0x11')][_0x4608('0x13')]);}logger[_0x4608('0x11')](_0x4608('0xd'),_0x260997,_0x485d22['error'][_0x4608('0x13')]);return _0x20deef(_0x485d22[_0x4608('0x11')][_0x4608('0x13')]);}else{logger[_0x4608('0xc')](_0x4608('0xd'),_0x260997,_0x4608('0x14'));_0x20deef(_0x485d22[_0x4608('0x15')][_0x4608('0x13')]);}})[_0x4608('0x16')](function(_0x1eb348){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x260997,_0x1eb348);_0x59b3ad(_0x1eb348);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 8284c37..99ab568 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 _0xfb4f=['../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service'];(function(_0x541260,_0x4c7f2e){var _0x1dd2b5=function(_0x4140de){while(--_0x4140de){_0x541260['push'](_0x541260['shift']());}};_0x1dd2b5(++_0x4c7f2e);}(_0xfb4f,0x113));var _0xffb4=function(_0x4e7280,_0x3dd19c){_0x4e7280=_0x4e7280-0x0;var _0x4dcc3a=_0xfb4f[_0x4e7280];return _0x4dcc3a;};'use strict';var multer=require(_0xffb4('0x0'));var util=require('util');var path=require(_0xffb4('0x1'));var timeout=require(_0xffb4('0x2'));var express=require('express');var router=express[_0xffb4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xffb4('0x4'));var interaction=require(_0xffb4('0x5'));var config=require(_0xffb4('0x6'));var controller=require('./analyticExtractedReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xffb4('0x7')]);router[_0xffb4('0x8')](_0xffb4('0x9'),auth[_0xffb4('0xa')](),controller[_0xffb4('0xb')]);router['get'](_0xffb4('0xc'),auth[_0xffb4('0xa')](),controller[_0xffb4('0xd')]);router[_0xffb4('0xe')]('/',auth[_0xffb4('0xa')](),controller[_0xffb4('0xf')]);router[_0xffb4('0x10')]('/:id',auth[_0xffb4('0xa')](),controller[_0xffb4('0x11')]);router[_0xffb4('0x12')](_0xffb4('0x9'),auth[_0xffb4('0xa')](),controller[_0xffb4('0x13')]);module['exports']=router; \ No newline at end of file +var _0xdda9=['post','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','/:id','show','/:id/download'];(function(_0x176329,_0x568c84){var _0x31997c=function(_0x3d64df){while(--_0x3d64df){_0x176329['push'](_0x176329['shift']());}};_0x31997c(++_0x568c84);}(_0xdda9,0x1aa));var _0x9dda=function(_0x345b6f,_0x54e0b7){_0x345b6f=_0x345b6f-0x0;var _0x719a56=_0xdda9[_0x345b6f];return _0x719a56;};'use strict';var multer=require(_0x9dda('0x0'));var util=require(_0x9dda('0x1'));var path=require(_0x9dda('0x2'));var timeout=require('connect-timeout');var express=require(_0x9dda('0x3'));var router=express[_0x9dda('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9dda('0x5'));var interaction=require(_0x9dda('0x6'));var config=require(_0x9dda('0x7'));var controller=require(_0x9dda('0x8'));router[_0x9dda('0x9')]('/',auth[_0x9dda('0xa')](),controller['index']);router[_0x9dda('0x9')](_0x9dda('0xb'),auth[_0x9dda('0xa')](),controller[_0x9dda('0xc')]);router[_0x9dda('0x9')](_0x9dda('0xd'),auth[_0x9dda('0xa')](),controller['download']);router[_0x9dda('0xe')]('/',auth['isAuthenticated'](),controller[_0x9dda('0xf')]);router[_0x9dda('0x10')](_0x9dda('0xb'),auth[_0x9dda('0xa')](),controller[_0x9dda('0x11')]);router[_0x9dda('0x12')](_0x9dda('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x9dda('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 4a66c21..af6a359 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 _0x502b=['TEXT','STRING','BOOLEAN','sequelize','exports'];(function(_0x32bfd4,_0x52f0eb){var _0x36ed14=function(_0xdbc892){while(--_0xdbc892){_0x32bfd4['push'](_0x32bfd4['shift']());}};_0x36ed14(++_0x52f0eb);}(_0x502b,0xda));var _0xb502=function(_0x340380,_0x4bd2a8){_0x340380=_0x340380-0x0;var _0x49ce1c=_0x502b[_0x340380];return _0x49ce1c;};'use strict';var Sequelize=require(_0xb502('0x0'));module[_0xb502('0x1')]={'field':{'type':Sequelize[_0xb502('0x2')]},'alias':{'type':Sequelize[_0xb502('0x3')]},'function':{'type':Sequelize[_0xb502('0x3')]},'format':{'type':Sequelize[_0xb502('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xb502('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x6388=['BOOLEAN','exports','STRING'];(function(_0x305821,_0x46c446){var _0x53795d=function(_0x4c5873){while(--_0x4c5873){_0x305821['push'](_0x305821['shift']());}};_0x53795d(++_0x46c446);}(_0x6388,0x79));var _0x8638=function(_0x2081a7,_0x4f4eee){_0x2081a7=_0x2081a7-0x0;var _0x538f4e=_0x6388[_0x2081a7];return _0x538f4e;};'use strict';var Sequelize=require('sequelize');module[_0x8638('0x0')]={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0x8638('0x1')]},'function':{'type':Sequelize[_0x8638('0x1')]},'format':{'type':Sequelize[_0x8638('0x1')]},'groupBy':{'type':Sequelize[_0x8638('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x8638('0x1')]},'custom':{'type':Sequelize[_0x8638('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index 73bbcac..a82ef01 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 _0x52ae=['zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','fields','find','body','bulkCreate','update','destroy','findOne','sequelize','transaction','CustomReportId','findAll','rimraf'];(function(_0x2f5cb6,_0x2b2e01){var _0x486018=function(_0x5db0b0){while(--_0x5db0b0){_0x2f5cb6['push'](_0x2f5cb6['shift']());}};_0x486018(++_0x2b2e01);}(_0x52ae,0x1bb));var _0xe52a=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0x52ae[_0x2e6c19];return _0x52885d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe52a('0x0'));var zipdir=require(_0xe52a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xe52a('0x2'));var BPromise=require(_0xe52a('0x3'));var Mustache=require(_0xe52a('0x4'));var util=require('util');var path=require(_0xe52a('0x5'));var sox=require(_0xe52a('0x6'));var csv=require(_0xe52a('0x7'));var ejs=require(_0xe52a('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe52a('0x9'));var squel=require(_0xe52a('0xa'));var crypto=require(_0xe52a('0xb'));var jsforce=require(_0xe52a('0xc'));var deskjs=require(_0xe52a('0xd'));var toCsv=require(_0xe52a('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe52a('0xe'));var qs=require(_0xe52a('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe52a('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xe52a('0x11'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2aa35a,_0x84db2e){_0x84db2e=_0x84db2e||0xcc;return function(_0x4b8e3d){if(_0x4b8e3d){return _0x2aa35a[_0xe52a('0x12')](_0x84db2e);}return _0x2aa35a[_0xe52a('0x13')](_0x84db2e)[_0xe52a('0x14')]();};}function respondWithResult(_0x5e9fc5,_0x4453a1){_0x4453a1=_0x4453a1||0xc8;return function(_0x467fa3){if(_0x467fa3){return _0x5e9fc5['status'](_0x4453a1)[_0xe52a('0x15')](_0x467fa3);}};}function respondWithFilteredResult(_0x42910a,_0x2c34ef){return function(_0x3716ca){if(_0x3716ca){var _0x363f77=typeof _0x2c34ef[_0xe52a('0x16')]===_0xe52a('0x17')&&typeof _0x2c34ef[_0xe52a('0x18')]==='undefined';var _0x1538ab=_0x3716ca[_0xe52a('0x19')];var _0x25fe5f=_0x363f77?0x0:_0x2c34ef[_0xe52a('0x16')];var _0x5e97ff=_0x363f77?_0x3716ca['count']:_0x2c34ef[_0xe52a('0x16')]+_0x2c34ef['limit'];var _0x37c3cc;if(_0x5e97ff>=_0x1538ab){_0x5e97ff=_0x1538ab;_0x37c3cc=0xc8;}else{_0x37c3cc=0xce;}_0x42910a[_0xe52a('0x13')](_0x37c3cc);return _0x42910a['set'](_0xe52a('0x1a'),_0x25fe5f+'-'+_0x5e97ff+'/'+_0x1538ab)[_0xe52a('0x15')](_0x3716ca);}return null;};}function patchUpdates(_0x20ba2c){return function(_0x1bf125){try{jsonpatch[_0xe52a('0x1b')](_0x1bf125,_0x20ba2c,!![]);}catch(_0x228aa4){return BPromise[_0xe52a('0x1c')](_0x228aa4);}return _0x1bf125[_0xe52a('0x1d')]();};}function saveUpdates(_0x431688,_0x64ea55){return function(_0xa3790){if(_0xa3790){return _0xa3790['update'](_0x431688)[_0xe52a('0x1e')](function(_0x3acb17){return _0x3acb17;});}return null;};}function removeEntity(_0x19c282,_0x120c02){return function(_0x236816){if(_0x236816){return _0x236816['destroy']()[_0xe52a('0x1e')](function(){_0x19c282[_0xe52a('0x13')](0xcc)[_0xe52a('0x14')]();});}};}function handleEntityNotFound(_0x476703,_0x538599){return function(_0x5a3145){if(!_0x5a3145){_0x476703[_0xe52a('0x12')](0x194);}return _0x5a3145;};}function handleError(_0x49cc61,_0x24bb07){_0x24bb07=_0x24bb07||0x1f4;return function(_0x464e0a){logger['error'](_0x464e0a[_0xe52a('0x1f')]);if(_0x464e0a[_0xe52a('0x20')]){delete _0x464e0a[_0xe52a('0x20')];}_0x49cc61[_0xe52a('0x13')](_0x24bb07)[_0xe52a('0x21')](_0x464e0a);};}exports[_0xe52a('0x22')]=function(_0x15eb1a,_0x234abb){var _0x4fe3fa={},_0x57bac1={},_0x5588ae={'count':0x0,'rows':[]};var _0x32c366=_[_0xe52a('0x23')](db[_0xe52a('0x24')][_0xe52a('0x25')],function(_0x4e0b5a){return{'name':_0x4e0b5a[_0xe52a('0x26')],'type':_0x4e0b5a[_0xe52a('0x27')][_0xe52a('0x28')]};});_0x57bac1[_0xe52a('0x29')]=_['map'](_0x32c366,_0xe52a('0x20'));_0x57bac1[_0xe52a('0x2a')]=_[_0xe52a('0x2b')](_0x15eb1a[_0xe52a('0x2a')]);_0x57bac1[_0xe52a('0x2c')]=_[_0xe52a('0x2d')](_0x57bac1[_0xe52a('0x29')],_0x57bac1['query']);_0x4fe3fa[_0xe52a('0x2e')]=_[_0xe52a('0x2d')](_0x57bac1[_0xe52a('0x29')],qs['fields'](_0x15eb1a[_0xe52a('0x2a')]['fields']));_0x4fe3fa[_0xe52a('0x2e')]=_0x4fe3fa[_0xe52a('0x2e')][_0xe52a('0x2f')]?_0x4fe3fa['attributes']:_0x57bac1[_0xe52a('0x29')];if(!_0x15eb1a[_0xe52a('0x2a')][_0xe52a('0x30')](_0xe52a('0x31'))){_0x4fe3fa[_0xe52a('0x18')]=qs[_0xe52a('0x18')](_0x15eb1a['query'][_0xe52a('0x18')]);_0x4fe3fa[_0xe52a('0x16')]=qs[_0xe52a('0x16')](_0x15eb1a[_0xe52a('0x2a')][_0xe52a('0x16')]);}_0x4fe3fa[_0xe52a('0x32')]=qs[_0xe52a('0x33')](_0x15eb1a[_0xe52a('0x2a')][_0xe52a('0x33')]);_0x4fe3fa['where']=qs[_0xe52a('0x2c')](_[_0xe52a('0x34')](_0x15eb1a['query'],_0x57bac1[_0xe52a('0x2c')]),_0x32c366);if(_0x15eb1a['query'][_0xe52a('0x35')]){_0x4fe3fa['where']=_['merge'](_0x4fe3fa['where'],{'$or':_[_0xe52a('0x23')](_0x32c366,function(_0x2c8e88){if(_0x2c8e88[_0xe52a('0x27')]!==_0xe52a('0x36')){var _0x5402ef={};_0x5402ef[_0x2c8e88[_0xe52a('0x20')]]={'$like':'%'+_0x15eb1a[_0xe52a('0x2a')][_0xe52a('0x35')]+'%'};return _0x5402ef;}})});}_0x4fe3fa=_[_0xe52a('0x37')]({},_0x4fe3fa,_0x15eb1a[_0xe52a('0x38')]);var _0x2f9478={'where':_0x4fe3fa['where']};return db['AnalyticFieldReport'][_0xe52a('0x19')](_0x2f9478)[_0xe52a('0x1e')](function(_0x2a9c34){_0x5588ae['count']=_0x2a9c34;if(_0x15eb1a['query'][_0xe52a('0x39')]){_0x4fe3fa[_0xe52a('0x3a')]=[{'all':!![]}];}return db[_0xe52a('0x24')]['findAll'](_0x4fe3fa);})[_0xe52a('0x1e')](function(_0x92a5a5){_0x5588ae[_0xe52a('0x3b')]=_0x92a5a5;return _0x5588ae;})[_0xe52a('0x1e')](respondWithFilteredResult(_0x234abb,_0x4fe3fa))[_0xe52a('0x3c')](handleError(_0x234abb,null));};exports[_0xe52a('0x3d')]=function(_0xe9f6a5,_0x227e79){var _0x1ba571={'raw':![],'where':{'id':_0xe9f6a5[_0xe52a('0x3e')]['id']}},_0x299ae0={};_0x299ae0['model']=_['keys'](db['AnalyticFieldReport']['rawAttributes']);_0x299ae0[_0xe52a('0x2a')]=_[_0xe52a('0x2b')](_0xe9f6a5[_0xe52a('0x2a')]);_0x299ae0[_0xe52a('0x2c')]=_['intersection'](_0x299ae0['model'],_0x299ae0[_0xe52a('0x2a')]);_0x1ba571[_0xe52a('0x2e')]=_[_0xe52a('0x2d')](_0x299ae0['model'],qs[_0xe52a('0x3f')](_0xe9f6a5['query'][_0xe52a('0x3f')]));_0x1ba571['attributes']=_0x1ba571[_0xe52a('0x2e')]['length']?_0x1ba571[_0xe52a('0x2e')]:_0x299ae0[_0xe52a('0x29')];if(_0xe9f6a5['query']['includeAll']){_0x1ba571[_0xe52a('0x3a')]=[{'all':!![]}];}_0x1ba571=_[_0xe52a('0x37')]({},_0x1ba571,_0xe9f6a5[_0xe52a('0x38')]);return db[_0xe52a('0x24')][_0xe52a('0x40')](_0x1ba571)[_0xe52a('0x1e')](handleEntityNotFound(_0x227e79,null))[_0xe52a('0x1e')](respondWithResult(_0x227e79,null))['catch'](handleError(_0x227e79,null));};exports['create']=function(_0x5792a1,_0xb63ac6){return db[_0xe52a('0x24')]['create'](_0x5792a1[_0xe52a('0x41')],{})[_0xe52a('0x1e')](respondWithResult(_0xb63ac6,0xc9))[_0xe52a('0x3c')](handleError(_0xb63ac6,null));};exports['bulkCreate']=function(_0x13f7ce,_0x164b50){return db[_0xe52a('0x24')][_0xe52a('0x42')](_0x13f7ce['body'],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x164b50,0xc9))['catch'](handleError(_0x164b50,null));};exports[_0xe52a('0x43')]=function(_0x152546,_0x1dcc5e){if(_0x152546[_0xe52a('0x41')]['id']){delete _0x152546[_0xe52a('0x41')]['id'];}return db[_0xe52a('0x24')][_0xe52a('0x40')]({'where':{'id':_0x152546[_0xe52a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1dcc5e,null))[_0xe52a('0x1e')](saveUpdates(_0x152546[_0xe52a('0x41')],null))[_0xe52a('0x1e')](respondWithResult(_0x1dcc5e,null))[_0xe52a('0x3c')](handleError(_0x1dcc5e,null));};exports['destroy']=function(_0xb66fdf,_0x3c4f6a){return db[_0xe52a('0x24')][_0xe52a('0x40')]({'where':{'id':_0xb66fdf[_0xe52a('0x3e')]['id']}})[_0xe52a('0x1e')](handleEntityNotFound(_0x3c4f6a,null))[_0xe52a('0x1e')](removeEntity(_0x3c4f6a,null))[_0xe52a('0x3c')](handleError(_0x3c4f6a,null));};exports['bulkDestroy']=function(_0x1abb9b,_0x518403){return db[_0xe52a('0x24')][_0xe52a('0x44')]({'where':{'id':_0x1abb9b['query']['ids']||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x518403,0xcc))[_0xe52a('0x3c')](handleError(_0x518403,null));};exports['addFields']=function(_0x5aef20,_0x37eb47,_0x4ecb4e){return db['AnalyticCustomReport'][_0xe52a('0x45')]({'where':{'id':_0x5aef20[_0xe52a('0x3e')]['id']}})[_0xe52a('0x1e')](handleEntityNotFound(_0x37eb47,null))[_0xe52a('0x1e')](function(_0xaae6e1){if(_0xaae6e1){return db[_0xe52a('0x46')][_0xe52a('0x47')](function(_0x10ec67){return db[_0xe52a('0x24')][_0xe52a('0x44')]({'where':{'CustomReportId':_0x5aef20[_0xe52a('0x3e')]['id']},'transaction':_0x10ec67})[_0xe52a('0x1e')](function(_0x3264ae){var _0x3fbf90=_['map'](_0x5aef20[_0xe52a('0x41')],function(_0x50b677){delete _0x50b677['id'];_0x50b677[_0xe52a('0x48')]=_0x5aef20[_0xe52a('0x3e')]['id'];return _0x50b677;});return db[_0xe52a('0x24')][_0xe52a('0x42')](_0x3fbf90,{'transaction':_0x10ec67});});})['then'](function(){return db[_0xe52a('0x24')][_0xe52a('0x49')]({'where':{'CustomReportId':_0x5aef20[_0xe52a('0x3e')]['id']}});});}})[_0xe52a('0x1e')](respondWithResult(_0x37eb47,null))['catch'](handleError(_0x37eb47,null));}; \ No newline at end of file +var _0x2797=['bulkDestroy','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','fs-extra','lodash','crypto','jsforce','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','reject','then','destroy','end','error','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','rows','show','params','find','body','bulkCreate','catch','update'];(function(_0x1a4203,_0x3593b7){var _0x450540=function(_0x2eaf0b){while(--_0x2eaf0b){_0x1a4203['push'](_0x1a4203['shift']());}};_0x450540(++_0x3593b7);}(_0x2797,0x1cf));var _0x7279=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x2797[_0x2f5ac5];return _0x37c9a8;};'use strict';var emlformat=require(_0x7279('0x0'));var rimraf=require(_0x7279('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7279('0x2'));var rp=require(_0x7279('0x3'));var moment=require(_0x7279('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7279('0x5'));var path=require(_0x7279('0x6'));var sox=require('sox');var csv=require(_0x7279('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7279('0x8'));var _=require(_0x7279('0x9'));var squel=require('squel');var crypto=require(_0x7279('0xa'));var jsforce=require(_0x7279('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7279('0xc'));var Papa=require(_0x7279('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7279('0xe'));var as=require(_0x7279('0xf'));var hardwareService=require(_0x7279('0x10'));var logger=require(_0x7279('0x11'))('api');var utils=require(_0x7279('0x12'));var config=require(_0x7279('0x13'));var licenseUtil=require(_0x7279('0x14'));var db=require(_0x7279('0x15'))['db'];function respondWithStatusCode(_0x565029,_0x1384d3){_0x1384d3=_0x1384d3||0xcc;return function(_0x406da0){if(_0x406da0){return _0x565029[_0x7279('0x16')](_0x1384d3);}return _0x565029[_0x7279('0x17')](_0x1384d3)['end']();};}function respondWithResult(_0x3534b3,_0x220c72){_0x220c72=_0x220c72||0xc8;return function(_0x2b7352){if(_0x2b7352){return _0x3534b3['status'](_0x220c72)[_0x7279('0x18')](_0x2b7352);}};}function respondWithFilteredResult(_0x434cad,_0x2037ad){return function(_0x167586){if(_0x167586){var _0x4aaac3=typeof _0x2037ad[_0x7279('0x19')]==='undefined'&&typeof _0x2037ad[_0x7279('0x1a')]===_0x7279('0x1b');var _0x495a7e=_0x167586['count'];var _0x5e34ed=_0x4aaac3?0x0:_0x2037ad[_0x7279('0x19')];var _0x285959=_0x4aaac3?_0x167586[_0x7279('0x1c')]:_0x2037ad[_0x7279('0x19')]+_0x2037ad[_0x7279('0x1a')];var _0x5e1167;if(_0x285959>=_0x495a7e){_0x285959=_0x495a7e;_0x5e1167=0xc8;}else{_0x5e1167=0xce;}_0x434cad[_0x7279('0x17')](_0x5e1167);return _0x434cad[_0x7279('0x1d')]('Content-Range',_0x5e34ed+'-'+_0x285959+'/'+_0x495a7e)[_0x7279('0x18')](_0x167586);}return null;};}function patchUpdates(_0x4950a6){return function(_0x105aa4){try{jsonpatch['apply'](_0x105aa4,_0x4950a6,!![]);}catch(_0x16ddce){return BPromise[_0x7279('0x1e')](_0x16ddce);}return _0x105aa4['save']();};}function saveUpdates(_0x19eb87,_0x3aa4b2){return function(_0x3f299f){if(_0x3f299f){return _0x3f299f['update'](_0x19eb87)[_0x7279('0x1f')](function(_0x2bf232){return _0x2bf232;});}return null;};}function removeEntity(_0x17d23a,_0x3e2503){return function(_0x4af7d5){if(_0x4af7d5){return _0x4af7d5[_0x7279('0x20')]()[_0x7279('0x1f')](function(){_0x17d23a[_0x7279('0x17')](0xcc)[_0x7279('0x21')]();});}};}function handleEntityNotFound(_0x566d61,_0x2b52df){return function(_0x85048e){if(!_0x85048e){_0x566d61[_0x7279('0x16')](0x194);}return _0x85048e;};}function handleError(_0x7509e2,_0x5ab212){_0x5ab212=_0x5ab212||0x1f4;return function(_0x4cde72){logger[_0x7279('0x22')](_0x4cde72['stack']);if(_0x4cde72[_0x7279('0x23')]){delete _0x4cde72[_0x7279('0x23')];}_0x7509e2[_0x7279('0x17')](_0x5ab212)[_0x7279('0x24')](_0x4cde72);};}exports[_0x7279('0x25')]=function(_0x3bd8db,_0x3259b2){var _0x14a90d={},_0xe03af={},_0x565d51={'count':0x0,'rows':[]};var _0x48c50c=_[_0x7279('0x26')](db[_0x7279('0x27')][_0x7279('0x28')],function(_0x49d7c8){return{'name':_0x49d7c8[_0x7279('0x29')],'type':_0x49d7c8[_0x7279('0x2a')][_0x7279('0x2b')]};});_0xe03af[_0x7279('0x2c')]=_[_0x7279('0x26')](_0x48c50c,_0x7279('0x23'));_0xe03af[_0x7279('0x2d')]=_[_0x7279('0x2e')](_0x3bd8db[_0x7279('0x2d')]);_0xe03af[_0x7279('0x2f')]=_[_0x7279('0x30')](_0xe03af[_0x7279('0x2c')],_0xe03af[_0x7279('0x2d')]);_0x14a90d['attributes']=_[_0x7279('0x30')](_0xe03af[_0x7279('0x2c')],qs[_0x7279('0x31')](_0x3bd8db[_0x7279('0x2d')][_0x7279('0x31')]));_0x14a90d[_0x7279('0x32')]=_0x14a90d[_0x7279('0x32')][_0x7279('0x33')]?_0x14a90d[_0x7279('0x32')]:_0xe03af[_0x7279('0x2c')];if(!_0x3bd8db[_0x7279('0x2d')][_0x7279('0x34')](_0x7279('0x35'))){_0x14a90d[_0x7279('0x1a')]=qs[_0x7279('0x1a')](_0x3bd8db['query'][_0x7279('0x1a')]);_0x14a90d[_0x7279('0x19')]=qs['offset'](_0x3bd8db[_0x7279('0x2d')]['offset']);}_0x14a90d['order']=qs[_0x7279('0x36')](_0x3bd8db[_0x7279('0x2d')][_0x7279('0x36')]);_0x14a90d[_0x7279('0x37')]=qs[_0x7279('0x2f')](_['pick'](_0x3bd8db['query'],_0xe03af[_0x7279('0x2f')]),_0x48c50c);if(_0x3bd8db[_0x7279('0x2d')][_0x7279('0x38')]){_0x14a90d[_0x7279('0x37')]=_[_0x7279('0x39')](_0x14a90d[_0x7279('0x37')],{'$or':_['map'](_0x48c50c,function(_0x1df610){if(_0x1df610[_0x7279('0x2a')]!=='VIRTUAL'){var _0x356e36={};_0x356e36[_0x1df610[_0x7279('0x23')]]={'$like':'%'+_0x3bd8db[_0x7279('0x2d')]['filter']+'%'};return _0x356e36;}})});}_0x14a90d=_[_0x7279('0x39')]({},_0x14a90d,_0x3bd8db[_0x7279('0x3a')]);var _0x3f3471={'where':_0x14a90d['where']};return db[_0x7279('0x27')][_0x7279('0x1c')](_0x3f3471)[_0x7279('0x1f')](function(_0x13ba96){_0x565d51['count']=_0x13ba96;if(_0x3bd8db[_0x7279('0x2d')][_0x7279('0x3b')]){_0x14a90d['include']=[{'all':!![]}];}return db[_0x7279('0x27')][_0x7279('0x3c')](_0x14a90d);})[_0x7279('0x1f')](function(_0x2971b7){_0x565d51[_0x7279('0x3d')]=_0x2971b7;return _0x565d51;})[_0x7279('0x1f')](respondWithFilteredResult(_0x3259b2,_0x14a90d))['catch'](handleError(_0x3259b2,null));};exports[_0x7279('0x3e')]=function(_0x7defeb,_0x52f817){var _0x14a369={'raw':![],'where':{'id':_0x7defeb[_0x7279('0x3f')]['id']}},_0x2dbbb2={};_0x2dbbb2['model']=_[_0x7279('0x2e')](db['AnalyticFieldReport'][_0x7279('0x28')]);_0x2dbbb2[_0x7279('0x2d')]=_[_0x7279('0x2e')](_0x7defeb['query']);_0x2dbbb2[_0x7279('0x2f')]=_[_0x7279('0x30')](_0x2dbbb2['model'],_0x2dbbb2[_0x7279('0x2d')]);_0x14a369[_0x7279('0x32')]=_['intersection'](_0x2dbbb2[_0x7279('0x2c')],qs[_0x7279('0x31')](_0x7defeb[_0x7279('0x2d')][_0x7279('0x31')]));_0x14a369[_0x7279('0x32')]=_0x14a369['attributes']['length']?_0x14a369[_0x7279('0x32')]:_0x2dbbb2[_0x7279('0x2c')];if(_0x7defeb[_0x7279('0x2d')]['includeAll']){_0x14a369['include']=[{'all':!![]}];}_0x14a369=_[_0x7279('0x39')]({},_0x14a369,_0x7defeb[_0x7279('0x3a')]);return db['AnalyticFieldReport'][_0x7279('0x40')](_0x14a369)[_0x7279('0x1f')](handleEntityNotFound(_0x52f817,null))[_0x7279('0x1f')](respondWithResult(_0x52f817,null))['catch'](handleError(_0x52f817,null));};exports['create']=function(_0x1ba3ad,_0x4e4f33){return db[_0x7279('0x27')]['create'](_0x1ba3ad[_0x7279('0x41')],{})['then'](respondWithResult(_0x4e4f33,0xc9))['catch'](handleError(_0x4e4f33,null));};exports[_0x7279('0x42')]=function(_0x51bc41,_0x9f83f3){return db['AnalyticFieldReport'][_0x7279('0x42')](_0x51bc41[_0x7279('0x41')],{'raw':![],'individualHooks':!![]})[_0x7279('0x1f')](respondWithResult(_0x9f83f3,0xc9))[_0x7279('0x43')](handleError(_0x9f83f3,null));};exports[_0x7279('0x44')]=function(_0x103bc7,_0x4eb919){if(_0x103bc7[_0x7279('0x41')]['id']){delete _0x103bc7[_0x7279('0x41')]['id'];}return db[_0x7279('0x27')]['find']({'where':{'id':_0x103bc7['params']['id']}})['then'](handleEntityNotFound(_0x4eb919,null))[_0x7279('0x1f')](saveUpdates(_0x103bc7[_0x7279('0x41')],null))['then'](respondWithResult(_0x4eb919,null))['catch'](handleError(_0x4eb919,null));};exports[_0x7279('0x20')]=function(_0x5ebdce,_0x4b5bad){return db[_0x7279('0x27')][_0x7279('0x40')]({'where':{'id':_0x5ebdce['params']['id']}})['then'](handleEntityNotFound(_0x4b5bad,null))[_0x7279('0x1f')](removeEntity(_0x4b5bad,null))[_0x7279('0x43')](handleError(_0x4b5bad,null));};exports[_0x7279('0x45')]=function(_0x557549,_0x537612){return db['AnalyticFieldReport']['destroy']({'where':{'id':_0x557549[_0x7279('0x2d')]['ids']||[]},'raw':![],'individualHooks':!![]})[_0x7279('0x1f')](respondWithResult(_0x537612,0xcc))[_0x7279('0x43')](handleError(_0x537612,null));};exports[_0x7279('0x46')]=function(_0x298ffa,_0x49f596,_0x56e736){return db[_0x7279('0x47')][_0x7279('0x48')]({'where':{'id':_0x298ffa[_0x7279('0x3f')]['id']}})[_0x7279('0x1f')](handleEntityNotFound(_0x49f596,null))[_0x7279('0x1f')](function(_0xf1a567){if(_0xf1a567){return db[_0x7279('0x49')][_0x7279('0x4a')](function(_0x29c818){return db[_0x7279('0x27')][_0x7279('0x20')]({'where':{'CustomReportId':_0x298ffa[_0x7279('0x3f')]['id']},'transaction':_0x29c818})['then'](function(_0x10da7d){var _0x197700=_[_0x7279('0x26')](_0x298ffa[_0x7279('0x41')],function(_0x43c5df){delete _0x43c5df['id'];_0x43c5df[_0x7279('0x4b')]=_0x298ffa[_0x7279('0x3f')]['id'];return _0x43c5df;});return db['AnalyticFieldReport']['bulkCreate'](_0x197700,{'transaction':_0x29c818});});})[_0x7279('0x1f')](function(){return db[_0x7279('0x27')][_0x7279('0x3c')]({'where':{'CustomReportId':_0x298ffa[_0x7279('0x3f')]['id']}});});}})[_0x7279('0x1f')](respondWithResult(_0x49f596,null))[_0x7279('0x43')](handleError(_0x49f596,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index af04e32..c436f68 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 _0x4e2a=['path','rimraf','../../config/environment','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x52774f,_0x3c8b8a){var _0x255cab=function(_0x1900c1){while(--_0x1900c1){_0x52774f['push'](_0x52774f['shift']());}};_0x255cab(++_0x3c8b8a);}(_0x4e2a,0x18d));var _0xa4e2=function(_0x3130ef,_0x413941){_0x3130ef=_0x3130ef-0x0;var _0xab4e77=_0x4e2a[_0x3130ef];return _0xab4e77;};'use strict';var _=require(_0xa4e2('0x0'));var util=require('util');var logger=require(_0xa4e2('0x1'))(_0xa4e2('0x2'));var moment=require(_0xa4e2('0x3'));var BPromise=require(_0xa4e2('0x4'));var rp=require(_0xa4e2('0x5'));var fs=require('fs');var path=require(_0xa4e2('0x6'));var rimraf=require(_0xa4e2('0x7'));var config=require(_0xa4e2('0x8'));var attributes=require('./analyticFieldReport.attributes');module[_0xa4e2('0x9')]=function(_0x139643,_0x2f49c5){return _0x139643[_0xa4e2('0xa')](_0xa4e2('0xb'),attributes,{'tableName':_0xa4e2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd26b=['exports','define','AnalyticFieldReport','analytics_report_fields','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticFieldReport.attributes'];(function(_0x2dd293,_0x1afb28){var _0x43db4e=function(_0x128142){while(--_0x128142){_0x2dd293['push'](_0x2dd293['shift']());}};_0x43db4e(++_0x1afb28);}(_0xd26b,0x1e5));var _0xbd26=function(_0x35fc62,_0x2b5f7){_0x35fc62=_0x35fc62-0x0;var _0xd54e91=_0xd26b[_0x35fc62];return _0xd54e91;};'use strict';var _=require('lodash');var util=require(_0xbd26('0x0'));var logger=require(_0xbd26('0x1'))(_0xbd26('0x2'));var moment=require(_0xbd26('0x3'));var BPromise=require(_0xbd26('0x4'));var rp=require(_0xbd26('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbd26('0x6'));var config=require(_0xbd26('0x7'));var attributes=require(_0xbd26('0x8'));module[_0xbd26('0x9')]=function(_0x419ea9,_0x41dea9){return _0x419ea9[_0xbd26('0xa')](_0xbd26('0xb'),attributes,{'tableName':_0xbd26('0xc'),'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 d38e776..44cbddd 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 _0xc066=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','info','AnalyticFieldReport,\x20%s,\x20%s','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x3a942d,_0x46b05d){var _0x3c84af=function(_0x1d4511){while(--_0x1d4511){_0x3a942d['push'](_0x3a942d['shift']());}};_0x3c84af(++_0x46b05d);}(_0xc066,0x19f));var _0x6c06=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc066[_0x42cae2];return _0x5f256f;};'use strict';var _=require('lodash');var util=require(_0x6c06('0x0'));var moment=require(_0x6c06('0x1'));var BPromise=require(_0x6c06('0x2'));var rs=require(_0x6c06('0x3'));var fs=require('fs');var Redis=require(_0x6c06('0x4'));var db=require(_0x6c06('0x5'))['db'];var utils=require(_0x6c06('0x6'));var logger=require(_0x6c06('0x7'))('rpc');var config=require(_0x6c06('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6c06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7ad747,_0x4ba95e,_0x57c59f){return new BPromise(function(_0x4806fc,_0x462966){return client[_0x6c06('0xa')](_0x7ad747,_0x57c59f)['then'](function(_0x1dbc4b){logger[_0x6c06('0xb')](_0x6c06('0xc'),_0x4ba95e,'request\x20sent');logger[_0x6c06('0xd')](_0x6c06('0xe'),_0x4ba95e,'request\x20sent',JSON[_0x6c06('0xf')](_0x1dbc4b));if(_0x1dbc4b[_0x6c06('0x10')]){if(_0x1dbc4b[_0x6c06('0x10')][_0x6c06('0x11')]===0x1f4){logger[_0x6c06('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x4ba95e,_0x1dbc4b[_0x6c06('0x10')][_0x6c06('0x12')]);return _0x462966(_0x1dbc4b[_0x6c06('0x10')]['message']);}logger['error'](_0x6c06('0xc'),_0x4ba95e,_0x1dbc4b['error'][_0x6c06('0x12')]);return _0x4806fc(_0x1dbc4b[_0x6c06('0x10')][_0x6c06('0x12')]);}else{logger[_0x6c06('0xb')](_0x6c06('0xc'),_0x4ba95e,'request\x20sent');_0x4806fc(_0x1dbc4b[_0x6c06('0x13')][_0x6c06('0x12')]);}})[_0x6c06('0x14')](function(_0x4fed7a){logger['error'](_0x6c06('0xc'),_0x4ba95e,_0x4fed7a);_0x462966(_0x4fed7a);});});} \ No newline at end of file +var _0x301c=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s','message','request\x20sent','catch','util'];(function(_0x211fef,_0x4ab716){var _0x5447bf=function(_0x306ea3){while(--_0x306ea3){_0x211fef['push'](_0x211fef['shift']());}};_0x5447bf(++_0x4ab716);}(_0x301c,0x1a3));var _0xc301=function(_0x23b3e0,_0x802d57){_0x23b3e0=_0x23b3e0-0x0;var _0x122558=_0x301c[_0x23b3e0];return _0x122558;};'use strict';var _=require('lodash');var util=require(_0xc301('0x0'));var moment=require(_0xc301('0x1'));var BPromise=require('bluebird');var rs=require(_0xc301('0x2'));var fs=require('fs');var Redis=require(_0xc301('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc301('0x4'));var logger=require(_0xc301('0x5'))('rpc');var config=require(_0xc301('0x6'));var jayson=require(_0xc301('0x7'));var client=jayson[_0xc301('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34854f,_0x1566a5,_0x22fe60){return new BPromise(function(_0x52ca25,_0x1aa4a2){return client[_0xc301('0x9')](_0x34854f,_0x22fe60)[_0xc301('0xa')](function(_0x106e91){logger[_0xc301('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x1566a5,'request\x20sent');logger[_0xc301('0xc')](_0xc301('0xd'),_0x1566a5,'request\x20sent',JSON[_0xc301('0xe')](_0x106e91));if(_0x106e91[_0xc301('0xf')]){if(_0x106e91[_0xc301('0xf')][_0xc301('0x10')]===0x1f4){logger[_0xc301('0xf')](_0xc301('0x11'),_0x1566a5,_0x106e91['error'][_0xc301('0x12')]);return _0x1aa4a2(_0x106e91['error'][_0xc301('0x12')]);}logger['error'](_0xc301('0x11'),_0x1566a5,_0x106e91[_0xc301('0xf')][_0xc301('0x12')]);return _0x52ca25(_0x106e91[_0xc301('0xf')][_0xc301('0x12')]);}else{logger[_0xc301('0xb')](_0xc301('0x11'),_0x1566a5,_0xc301('0x13'));_0x52ca25(_0x106e91['result']['message']);}})[_0xc301('0x14')](function(_0x53cd74){logger[_0xc301('0xf')](_0xc301('0x11'),_0x1566a5,_0x53cd74);_0x1aa4a2(_0x53cd74);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index 1886faa..cf25bdb 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(_0x2fdd18,_0x21f7cb){var _0x1c0217=function(_0x3c223d){while(--_0x3c223d){_0x2fdd18['push'](_0x2fdd18['shift']());}};_0x1c0217(++_0x21f7cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xa9e0[_0xf50820];return _0x2a9b10;};'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(_0x33e293,_0x44ff9c){var _0x546165=function(_0x3b2354){while(--_0x3b2354){_0x33e293['push'](_0x33e293['shift']());}};_0x546165(++_0x44ff9c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b78e8,_0x55096b){_0x5b78e8=_0x5b78e8-0x0;var _0xf2c321=_0xa9e0[_0x5b78e8];return _0xf2c321;};'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 218b10a..656e78a 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 _0x7d5a=['exports','STRING','name','TEXT','sequelize'];(function(_0x273463,_0x32626a){var _0x51bdb2=function(_0xf10645){while(--_0xf10645){_0x273463['push'](_0x273463['shift']());}};_0x51bdb2(++_0x32626a);}(_0x7d5a,0x17b));var _0xa7d5=function(_0x57cbee,_0xc8b1ad){_0x57cbee=_0x57cbee-0x0;var _0x53ef20=_0x7d5a[_0x57cbee];return _0x53ef20;};'use strict';var Sequelize=require(_0xa7d5('0x0'));module[_0xa7d5('0x1')]={'name':{'type':Sequelize[_0xa7d5('0x2')],'allowNull':![],'unique':_0xa7d5('0x3')},'table':{'type':Sequelize[_0xa7d5('0x2')]},'metric':{'type':Sequelize[_0xa7d5('0x4')]},'description':{'type':Sequelize[_0xa7d5('0x2')]}}; \ No newline at end of file +var _0xfb3f=['STRING','sequelize','exports','name'];(function(_0x5d1af0,_0x5f125d){var _0x1187d1=function(_0x552a45){while(--_0x552a45){_0x5d1af0['push'](_0x5d1af0['shift']());}};_0x1187d1(++_0x5f125d);}(_0xfb3f,0xd9));var _0xffb3=function(_0x206145,_0x1cb5d6){_0x206145=_0x206145-0x0;var _0x453b55=_0xfb3f[_0x206145];return _0x453b55;};'use strict';var Sequelize=require(_0xffb3('0x0'));module[_0xffb3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xffb3('0x2')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xffb3('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index dab379b..41978dd 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 _0x46ed=['where','pick','filter','merge','map','type','options','count','includeAll','include','findAll','rows','params','keys','find','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','Metrics','UserProfileResource','destroy','error','stack','name','send','index','AnalyticMetric','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort'];(function(_0x40dc06,_0x48dd40){var _0x92d868=function(_0x1a8636){while(--_0x1a8636){_0x40dc06['push'](_0x40dc06['shift']());}};_0x92d868(++_0x48dd40);}(_0x46ed,0x168));var _0xd46e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x46ed[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){var _0x5424e5=_0x62dea5['get']({'plain':!![]});var _0x371054=_0xd46e('0x26');return db[_0xd46e('0x27')][_0xd46e('0x28')]({'where':{'type':_0x371054,'resourceId':_0x5424e5['id']}})[_0xd46e('0x25')](function(){return _0x62dea5;});})[_0xd46e('0x25')](function(){_0x33c2e0[_0xd46e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x45d789,_0x3c301a){return function(_0xddbce9){if(!_0xddbce9){_0x45d789[_0xd46e('0x1a')](0x194);}return _0xddbce9;};}function handleError(_0x96f15c,_0x16e941){_0x16e941=_0x16e941||0x1f4;return function(_0x58aeef){logger[_0xd46e('0x29')](_0x58aeef[_0xd46e('0x2a')]);if(_0x58aeef[_0xd46e('0x2b')]){delete _0x58aeef[_0xd46e('0x2b')];}_0x96f15c[_0xd46e('0x1b')](_0x16e941)[_0xd46e('0x2c')](_0x58aeef);};}exports[_0xd46e('0x2d')]=function(_0x2c5ec7,_0x18f060){var _0x45ea47={},_0x2ff785={},_0x504324={'count':0x0,'rows':[]};var _0x2f4a1b=_['map'](db[_0xd46e('0x2e')][_0xd46e('0x2f')],function(_0x4f5718){return{'name':_0x4f5718[_0xd46e('0x30')],'type':_0x4f5718['type'][_0xd46e('0x31')]};});_0x2ff785[_0xd46e('0x32')]=_['map'](_0x2f4a1b,_0xd46e('0x2b'));_0x2ff785[_0xd46e('0x33')]=_['keys'](_0x2c5ec7[_0xd46e('0x33')]);_0x2ff785[_0xd46e('0x34')]=_[_0xd46e('0x35')](_0x2ff785['model'],_0x2ff785['query']);_0x45ea47[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x2ff785[_0xd46e('0x32')],qs[_0xd46e('0x37')](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x37')]));_0x45ea47[_0xd46e('0x36')]=_0x45ea47[_0xd46e('0x36')]['length']?_0x45ea47[_0xd46e('0x36')]:_0x2ff785[_0xd46e('0x32')];if(!_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x38')](_0xd46e('0x39'))){_0x45ea47[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x2c5ec7['query'][_0xd46e('0x1d')]);_0x45ea47[_0xd46e('0x1c')]=qs['offset'](_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x1c')]);}_0x45ea47[_0xd46e('0x3a')]=qs[_0xd46e('0x3b')](_0x2c5ec7['query'][_0xd46e('0x3b')]);_0x45ea47[_0xd46e('0x3c')]=qs[_0xd46e('0x34')](_[_0xd46e('0x3d')](_0x2c5ec7[_0xd46e('0x33')],_0x2ff785[_0xd46e('0x34')]),_0x2f4a1b);if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x3e')]){_0x45ea47['where']=_[_0xd46e('0x3f')](_0x45ea47[_0xd46e('0x3c')],{'$or':_[_0xd46e('0x40')](_0x2f4a1b,function(_0x25657a){if(_0x25657a[_0xd46e('0x41')]!=='VIRTUAL'){var _0x964c66={};_0x964c66[_0x25657a['name']]={'$like':'%'+_0x2c5ec7['query']['filter']+'%'};return _0x964c66;}})});}_0x45ea47=_['merge']({},_0x45ea47,_0x2c5ec7[_0xd46e('0x42')]);var _0x54949f={'where':_0x45ea47[_0xd46e('0x3c')]};return db[_0xd46e('0x2e')]['count'](_0x54949f)[_0xd46e('0x25')](function(_0x4114e6){_0x504324[_0xd46e('0x43')]=_0x4114e6;if(_0x2c5ec7[_0xd46e('0x33')][_0xd46e('0x44')]){_0x45ea47[_0xd46e('0x45')]=[{'all':!![]}];}return db[_0xd46e('0x2e')][_0xd46e('0x46')](_0x45ea47);})[_0xd46e('0x25')](function(_0xec367d){_0x504324[_0xd46e('0x47')]=_0xec367d;return _0x504324;})['then'](respondWithFilteredResult(_0x18f060,_0x45ea47))['catch'](handleError(_0x18f060,null));};exports['show']=function(_0x2b4a5a,_0x4e1d94){var _0x168d35={'raw':!![],'where':{'id':_0x2b4a5a[_0xd46e('0x48')]['id']}},_0x272f5f={};_0x272f5f[_0xd46e('0x32')]=_[_0xd46e('0x49')](db[_0xd46e('0x2e')][_0xd46e('0x2f')]);_0x272f5f[_0xd46e('0x33')]=_['keys'](_0x2b4a5a[_0xd46e('0x33')]);_0x272f5f['filters']=_[_0xd46e('0x35')](_0x272f5f[_0xd46e('0x32')],_0x272f5f[_0xd46e('0x33')]);_0x168d35[_0xd46e('0x36')]=_[_0xd46e('0x35')](_0x272f5f['model'],qs[_0xd46e('0x37')](_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x37')]));_0x168d35[_0xd46e('0x36')]=_0x168d35[_0xd46e('0x36')]['length']?_0x168d35[_0xd46e('0x36')]:_0x272f5f[_0xd46e('0x32')];if(_0x2b4a5a[_0xd46e('0x33')][_0xd46e('0x44')]){_0x168d35[_0xd46e('0x45')]=[{'all':!![]}];}_0x168d35=_['merge']({},_0x168d35,_0x2b4a5a[_0xd46e('0x42')]);return db[_0xd46e('0x2e')][_0xd46e('0x4a')](_0x168d35)[_0xd46e('0x25')](handleEntityNotFound(_0x4e1d94,null))[_0xd46e('0x25')](respondWithResult(_0x4e1d94,null))[_0xd46e('0x4b')](handleError(_0x4e1d94,null));};exports[_0xd46e('0x4c')]=function(_0x440dcc,_0x5188f6){return db[_0xd46e('0x2e')][_0xd46e('0x4c')](_0x440dcc[_0xd46e('0x4d')],{})[_0xd46e('0x25')](function(_0x1f1941){var _0x4e84c8=_0x440dcc['user'][_0xd46e('0x4e')]({'plain':!![]});if(!_0x4e84c8)throw new Error(_0xd46e('0x4f'));if(_0x4e84c8[_0xd46e('0x50')]==='user'){var _0x479711=_0x1f1941[_0xd46e('0x4e')]({'plain':!![]});var _0x9d8638='Metrics';return db[_0xd46e('0x51')][_0xd46e('0x4a')]({'where':{'name':_0x9d8638,'userProfileId':_0x4e84c8[_0xd46e('0x52')]},'raw':!![]})[_0xd46e('0x25')](function(_0x1bd8a5){if(_0x1bd8a5&&_0x1bd8a5[_0xd46e('0x53')]===0x0){return db[_0xd46e('0x27')][_0xd46e('0x4c')]({'name':_0x479711['name'],'resourceId':_0x479711['id'],'type':_0x1bd8a5[_0xd46e('0x2b')],'sectionId':_0x1bd8a5['id']},{})[_0xd46e('0x25')](function(){return _0x1f1941;});}else{return _0x1f1941;}})[_0xd46e('0x4b')](function(_0x63ee74){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x63ee74);throw _0x63ee74;});}return _0x1f1941;})[_0xd46e('0x25')](respondWithResult(_0x5188f6,0xc9))['catch'](handleError(_0x5188f6,null));};exports[_0xd46e('0x24')]=function(_0x2af20b,_0x393cb9){if(_0x2af20b[_0xd46e('0x4d')]['id']){delete _0x2af20b[_0xd46e('0x4d')]['id'];}return db[_0xd46e('0x2e')]['find']({'where':{'id':_0x2af20b[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x393cb9,null))[_0xd46e('0x25')](saveUpdates(_0x2af20b['body'],null))[_0xd46e('0x25')](respondWithResult(_0x393cb9,null))[_0xd46e('0x4b')](handleError(_0x393cb9,null));};exports[_0xd46e('0x28')]=function(_0x2042d4,_0x1886e6){return db[_0xd46e('0x2e')][_0xd46e('0x4a')]({'where':{'id':_0x2042d4[_0xd46e('0x48')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x1886e6,null))[_0xd46e('0x25')](removeEntity(_0x1886e6,null))[_0xd46e('0x4b')](handleError(_0x1886e6,null));}; \ No newline at end of file +var _0x8ef6=['../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','index','map','fieldName','key','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','filter','merge','type','VIRTUAL','options','AnalyticMetric','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xe20ac4,_0x3b9e32){var _0x1ccb8f=function(_0x235ce0){while(--_0x235ce0){_0xe20ac4['push'](_0xe20ac4['shift']());}};_0x1ccb8f(++_0x3b9e32);}(_0x8ef6,0xf2));var _0x68ef=function(_0x5aa70e,_0x194819){_0x5aa70e=_0x5aa70e-0x0;var _0x484723=_0x8ef6[_0x5aa70e];return _0x484723;};'use strict';var emlformat=require(_0x68ef('0x0'));var rimraf=require(_0x68ef('0x1'));var zipdir=require(_0x68ef('0x2'));var jsonpatch=require(_0x68ef('0x3'));var rp=require(_0x68ef('0x4'));var moment=require(_0x68ef('0x5'));var BPromise=require(_0x68ef('0x6'));var Mustache=require('mustache');var util=require(_0x68ef('0x7'));var path=require(_0x68ef('0x8'));var sox=require(_0x68ef('0x9'));var csv=require(_0x68ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x68ef('0xb'));var squel=require(_0x68ef('0xc'));var crypto=require(_0x68ef('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x68ef('0xe'));var toCsv=require(_0x68ef('0xa'));var querystring=require(_0x68ef('0xf'));var Papa=require(_0x68ef('0x10'));var Redis=require(_0x68ef('0x11'));var authService=require(_0x68ef('0x12'));var qs=require(_0x68ef('0x13'));var as=require(_0x68ef('0x14'));var hardwareService=require(_0x68ef('0x15'));var logger=require(_0x68ef('0x16'))(_0x68ef('0x17'));var utils=require(_0x68ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x68ef('0x19'));var db=require(_0x68ef('0x1a'))['db'];function respondWithStatusCode(_0x1e117a,_0x454ef4){_0x454ef4=_0x454ef4||0xcc;return function(_0x40f253){if(_0x40f253){return _0x1e117a[_0x68ef('0x1b')](_0x454ef4);}return _0x1e117a['status'](_0x454ef4)[_0x68ef('0x1c')]();};}function respondWithResult(_0xc50cce,_0x2657c5){_0x2657c5=_0x2657c5||0xc8;return function(_0x47fbb5){if(_0x47fbb5){return _0xc50cce[_0x68ef('0x1d')](_0x2657c5)[_0x68ef('0x1e')](_0x47fbb5);}};}function respondWithFilteredResult(_0x24682d,_0x5005ba){return function(_0x35493d){if(_0x35493d){var _0x37c4cc=typeof _0x5005ba[_0x68ef('0x1f')]===_0x68ef('0x20')&&typeof _0x5005ba['limit']===_0x68ef('0x20');var _0x54139e=_0x35493d['count'];var _0x2633c1=_0x37c4cc?0x0:_0x5005ba[_0x68ef('0x1f')];var _0x4ade0d=_0x37c4cc?_0x35493d['count']:_0x5005ba[_0x68ef('0x1f')]+_0x5005ba[_0x68ef('0x21')];var _0x318514;if(_0x4ade0d>=_0x54139e){_0x4ade0d=_0x54139e;_0x318514=0xc8;}else{_0x318514=0xce;}_0x24682d['status'](_0x318514);return _0x24682d[_0x68ef('0x22')](_0x68ef('0x23'),_0x2633c1+'-'+_0x4ade0d+'/'+_0x54139e)[_0x68ef('0x1e')](_0x35493d);}return null;};}function patchUpdates(_0x5b246b){return function(_0x3c46d4){try{jsonpatch[_0x68ef('0x24')](_0x3c46d4,_0x5b246b,!![]);}catch(_0x5af19f){return BPromise[_0x68ef('0x25')](_0x5af19f);}return _0x3c46d4[_0x68ef('0x26')]();};}function saveUpdates(_0x19aa3d,_0x5ddec7){return function(_0x59723c){if(_0x59723c){return _0x59723c['update'](_0x19aa3d)[_0x68ef('0x27')](function(_0x2023f2){return _0x2023f2;});}return null;};}function removeEntity(_0x312cc9,_0x2e6e39){return function(_0x438b4c){if(_0x438b4c){return _0x438b4c[_0x68ef('0x28')]()[_0x68ef('0x27')](function(){var _0x49374f=_0x438b4c[_0x68ef('0x29')]({'plain':!![]});var _0x13280b='Metrics';return db[_0x68ef('0x2a')]['destroy']({'where':{'type':_0x13280b,'resourceId':_0x49374f['id']}})['then'](function(){return _0x438b4c;});})['then'](function(){_0x312cc9[_0x68ef('0x1d')](0xcc)[_0x68ef('0x1c')]();});}};}function handleEntityNotFound(_0x123041,_0x29518e){return function(_0x52e67e){if(!_0x52e67e){_0x123041['sendStatus'](0x194);}return _0x52e67e;};}function handleError(_0x1cbe4f,_0x28907a){_0x28907a=_0x28907a||0x1f4;return function(_0x7bf96){logger[_0x68ef('0x2b')](_0x7bf96[_0x68ef('0x2c')]);if(_0x7bf96[_0x68ef('0x2d')]){delete _0x7bf96[_0x68ef('0x2d')];}_0x1cbe4f[_0x68ef('0x1d')](_0x28907a)['send'](_0x7bf96);};}exports[_0x68ef('0x2e')]=function(_0x4314bd,_0x132d9e){var _0x4c25aa={},_0x370a8f={},_0x523120={'count':0x0,'rows':[]};var _0x133788=_[_0x68ef('0x2f')](db['AnalyticMetric']['rawAttributes'],function(_0x159395){return{'name':_0x159395[_0x68ef('0x30')],'type':_0x159395['type'][_0x68ef('0x31')]};});_0x370a8f[_0x68ef('0x32')]=_[_0x68ef('0x2f')](_0x133788,_0x68ef('0x2d'));_0x370a8f['query']=_[_0x68ef('0x33')](_0x4314bd[_0x68ef('0x34')]);_0x370a8f['filters']=_[_0x68ef('0x35')](_0x370a8f['model'],_0x370a8f[_0x68ef('0x34')]);_0x4c25aa[_0x68ef('0x36')]=_['intersection'](_0x370a8f[_0x68ef('0x32')],qs['fields'](_0x4314bd[_0x68ef('0x34')]['fields']));_0x4c25aa[_0x68ef('0x36')]=_0x4c25aa[_0x68ef('0x36')][_0x68ef('0x37')]?_0x4c25aa['attributes']:_0x370a8f[_0x68ef('0x32')];if(!_0x4314bd['query'][_0x68ef('0x38')]('nolimit')){_0x4c25aa[_0x68ef('0x21')]=qs[_0x68ef('0x21')](_0x4314bd[_0x68ef('0x34')][_0x68ef('0x21')]);_0x4c25aa[_0x68ef('0x1f')]=qs[_0x68ef('0x1f')](_0x4314bd['query'][_0x68ef('0x1f')]);}_0x4c25aa[_0x68ef('0x39')]=qs[_0x68ef('0x3a')](_0x4314bd['query'][_0x68ef('0x3a')]);_0x4c25aa[_0x68ef('0x3b')]=qs[_0x68ef('0x3c')](_['pick'](_0x4314bd['query'],_0x370a8f[_0x68ef('0x3c')]),_0x133788);if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x3d')]){_0x4c25aa[_0x68ef('0x3b')]=_[_0x68ef('0x3e')](_0x4c25aa[_0x68ef('0x3b')],{'$or':_[_0x68ef('0x2f')](_0x133788,function(_0x5b1246){if(_0x5b1246[_0x68ef('0x3f')]!==_0x68ef('0x40')){var _0x2f6ee0={};_0x2f6ee0[_0x5b1246[_0x68ef('0x2d')]]={'$like':'%'+_0x4314bd['query'][_0x68ef('0x3d')]+'%'};return _0x2f6ee0;}})});}_0x4c25aa=_[_0x68ef('0x3e')]({},_0x4c25aa,_0x4314bd[_0x68ef('0x41')]);var _0x410c10={'where':_0x4c25aa[_0x68ef('0x3b')]};return db[_0x68ef('0x42')]['count'](_0x410c10)[_0x68ef('0x27')](function(_0x3f7699){_0x523120[_0x68ef('0x43')]=_0x3f7699;if(_0x4314bd[_0x68ef('0x34')][_0x68ef('0x44')]){_0x4c25aa[_0x68ef('0x45')]=[{'all':!![]}];}return db[_0x68ef('0x42')][_0x68ef('0x46')](_0x4c25aa);})[_0x68ef('0x27')](function(_0x531096){_0x523120[_0x68ef('0x47')]=_0x531096;return _0x523120;})[_0x68ef('0x27')](respondWithFilteredResult(_0x132d9e,_0x4c25aa))[_0x68ef('0x48')](handleError(_0x132d9e,null));};exports[_0x68ef('0x49')]=function(_0xdeacf2,_0x183377){var _0xcac58f={'raw':!![],'where':{'id':_0xdeacf2[_0x68ef('0x4a')]['id']}},_0x576767={};_0x576767['model']=_[_0x68ef('0x33')](db[_0x68ef('0x42')][_0x68ef('0x4b')]);_0x576767[_0x68ef('0x34')]=_['keys'](_0xdeacf2[_0x68ef('0x34')]);_0x576767['filters']=_[_0x68ef('0x35')](_0x576767['model'],_0x576767[_0x68ef('0x34')]);_0xcac58f[_0x68ef('0x36')]=_[_0x68ef('0x35')](_0x576767['model'],qs['fields'](_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x4c')]));_0xcac58f['attributes']=_0xcac58f['attributes']['length']?_0xcac58f[_0x68ef('0x36')]:_0x576767[_0x68ef('0x32')];if(_0xdeacf2[_0x68ef('0x34')][_0x68ef('0x44')]){_0xcac58f[_0x68ef('0x45')]=[{'all':!![]}];}_0xcac58f=_['merge']({},_0xcac58f,_0xdeacf2['options']);return db[_0x68ef('0x42')][_0x68ef('0x4d')](_0xcac58f)[_0x68ef('0x27')](handleEntityNotFound(_0x183377,null))[_0x68ef('0x27')](respondWithResult(_0x183377,null))['catch'](handleError(_0x183377,null));};exports[_0x68ef('0x4e')]=function(_0x474e5a,_0x1c9b6f){return db[_0x68ef('0x42')]['create'](_0x474e5a['body'],{})[_0x68ef('0x27')](function(_0x3c3074){var _0x566e7c=_0x474e5a[_0x68ef('0x4f')][_0x68ef('0x29')]({'plain':!![]});if(!_0x566e7c)throw new Error(_0x68ef('0x50'));if(_0x566e7c[_0x68ef('0x51')]===_0x68ef('0x4f')){var _0x4f0f77=_0x3c3074[_0x68ef('0x29')]({'plain':!![]});var _0x3984ca=_0x68ef('0x52');return db['UserProfileSection'][_0x68ef('0x4d')]({'where':{'name':_0x3984ca,'userProfileId':_0x566e7c[_0x68ef('0x53')]},'raw':!![]})[_0x68ef('0x27')](function(_0x50ef1f){if(_0x50ef1f&&_0x50ef1f[_0x68ef('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x4f0f77[_0x68ef('0x2d')],'resourceId':_0x4f0f77['id'],'type':_0x50ef1f['name'],'sectionId':_0x50ef1f['id']},{})[_0x68ef('0x27')](function(){return _0x3c3074;});}else{return _0x3c3074;}})[_0x68ef('0x48')](function(_0x53ebd){logger[_0x68ef('0x2b')](_0x68ef('0x55'),_0x53ebd);throw _0x53ebd;});}return _0x3c3074;})[_0x68ef('0x27')](respondWithResult(_0x1c9b6f,0xc9))[_0x68ef('0x48')](handleError(_0x1c9b6f,null));};exports[_0x68ef('0x56')]=function(_0x2b35f4,_0x247915){if(_0x2b35f4['body']['id']){delete _0x2b35f4['body']['id'];}return db[_0x68ef('0x42')][_0x68ef('0x4d')]({'where':{'id':_0x2b35f4[_0x68ef('0x4a')]['id']}})[_0x68ef('0x27')](handleEntityNotFound(_0x247915,null))[_0x68ef('0x27')](saveUpdates(_0x2b35f4[_0x68ef('0x57')],null))[_0x68ef('0x27')](respondWithResult(_0x247915,null))[_0x68ef('0x48')](handleError(_0x247915,null));};exports[_0x68ef('0x28')]=function(_0x4c2e9c,_0x5685bb){return db[_0x68ef('0x42')]['find']({'where':{'id':_0x4c2e9c[_0x68ef('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5685bb,null))[_0x68ef('0x27')](removeEntity(_0x5685bb,null))[_0x68ef('0x48')](handleError(_0x5685bb,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index a7f0b81..a469812 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 _0x7c09=['rimraf','../../config/environment','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x31ff78,_0x423e2c){var _0x484272=function(_0x33783a){while(--_0x33783a){_0x31ff78['push'](_0x31ff78['shift']());}};_0x484272(++_0x423e2c);}(_0x7c09,0x102));var _0x97c0=function(_0x22a2c1,_0x4a0754){_0x22a2c1=_0x22a2c1-0x0;var _0x139c01=_0x7c09[_0x22a2c1];return _0x139c01;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var logger=require(_0x97c0('0x1'))('api');var moment=require(_0x97c0('0x2'));var BPromise=require(_0x97c0('0x3'));var rp=require(_0x97c0('0x4'));var fs=require('fs');var path=require(_0x97c0('0x5'));var rimraf=require(_0x97c0('0x6'));var config=require(_0x97c0('0x7'));var attributes=require(_0x97c0('0x8'));module['exports']=function(_0x4b2f81,_0x590368){return _0x4b2f81[_0x97c0('0x9')](_0x97c0('0xa'),attributes,{'tableName':_0x97c0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x86b8=['moment','request-promise','path','rimraf','./analyticMetric.attributes','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger'];(function(_0x2c476f,_0x3e9821){var _0x2724d6=function(_0x116945){while(--_0x116945){_0x2c476f['push'](_0x2c476f['shift']());}};_0x2724d6(++_0x3e9821);}(_0x86b8,0x15d));var _0x886b=function(_0xb98a59,_0x216efe){_0xb98a59=_0xb98a59-0x0;var _0x471b3c=_0x86b8[_0xb98a59];return _0x471b3c;};'use strict';var _=require(_0x886b('0x0'));var util=require(_0x886b('0x1'));var logger=require(_0x886b('0x2'))('api');var moment=require(_0x886b('0x3'));var BPromise=require('bluebird');var rp=require(_0x886b('0x4'));var fs=require('fs');var path=require(_0x886b('0x5'));var rimraf=require(_0x886b('0x6'));var config=require('../../config/environment');var attributes=require(_0x886b('0x7'));module['exports']=function(_0x5b5ff5,_0x2c32bc){return _0x5b5ff5[_0x886b('0x8')](_0x886b('0x9'),attributes,{'tableName':_0x886b('0xa'),'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 8d17cb5..010b145 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 _0xe3e6=['client','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x35eb63,_0x280dcb){var _0x3b07c2=function(_0x35b019){while(--_0x35b019){_0x35eb63['push'](_0x35eb63['shift']());}};_0x3b07c2(++_0x280dcb);}(_0xe3e6,0x84));var _0x6e3e=function(_0x31e5cb,_0x2f5adf){_0x31e5cb=_0x31e5cb-0x0;var _0x4170df=_0xe3e6[_0x31e5cb];return _0x4170df;};'use strict';var _=require('lodash');var util=require(_0x6e3e('0x0'));var moment=require(_0x6e3e('0x1'));var BPromise=require(_0x6e3e('0x2'));var rs=require(_0x6e3e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6e3e('0x4'));var logger=require(_0x6e3e('0x5'))(_0x6e3e('0x6'));var config=require('../../config/environment');var jayson=require(_0x6e3e('0x7'));var client=jayson[_0x6e3e('0x8')][_0x6e3e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2aed2d,_0x4d9e77,_0x1c69f0){return new BPromise(function(_0x5e1a0c,_0x688ab9){return client[_0x6e3e('0xa')](_0x2aed2d,_0x1c69f0)['then'](function(_0x54418d){logger[_0x6e3e('0xb')](_0x6e3e('0xc'),_0x4d9e77,_0x6e3e('0xd'));logger['debug'](_0x6e3e('0xe'),_0x4d9e77,_0x6e3e('0xd'),JSON[_0x6e3e('0xf')](_0x54418d));if(_0x54418d[_0x6e3e('0x10')]){if(_0x54418d['error'][_0x6e3e('0x11')]===0x1f4){logger['error'](_0x6e3e('0xc'),_0x4d9e77,_0x54418d[_0x6e3e('0x10')][_0x6e3e('0x12')]);return _0x688ab9(_0x54418d[_0x6e3e('0x10')][_0x6e3e('0x12')]);}logger[_0x6e3e('0x10')](_0x6e3e('0xc'),_0x4d9e77,_0x54418d[_0x6e3e('0x10')][_0x6e3e('0x12')]);return _0x5e1a0c(_0x54418d['error'][_0x6e3e('0x12')]);}else{logger['info']('AnalyticMetric,\x20%s,\x20%s',_0x4d9e77,_0x6e3e('0xd'));_0x5e1a0c(_0x54418d[_0x6e3e('0x13')][_0x6e3e('0x12')]);}})['catch'](function(_0x11cf45){logger['error'](_0x6e3e('0xc'),_0x4d9e77,_0x11cf45);_0x688ab9(_0x11cf45);});});} \ No newline at end of file +var _0x2848=['http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x2848,0x1c5));var _0x8284=function(_0x307f2e,_0x1f6354){_0x307f2e=_0x307f2e-0x0;var _0x53f860=_0x2848[_0x307f2e];return _0x53f860;};'use strict';var _=require(_0x8284('0x0'));var util=require(_0x8284('0x1'));var moment=require(_0x8284('0x2'));var BPromise=require('bluebird');var rs=require(_0x8284('0x3'));var fs=require('fs');var Redis=require(_0x8284('0x4'));var db=require(_0x8284('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x8284('0x6'));var jayson=require(_0x8284('0x7'));var client=jayson[_0x8284('0x8')][_0x8284('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x18a667,_0x1329bb,_0x4aaf46){return new BPromise(function(_0xf7caa9,_0x410624){return client[_0x8284('0xa')](_0x18a667,_0x4aaf46)[_0x8284('0xb')](function(_0x247bc2){logger['info'](_0x8284('0xc'),_0x1329bb,_0x8284('0xd'));logger[_0x8284('0xe')](_0x8284('0xf'),_0x1329bb,'request\x20sent',JSON['stringify'](_0x247bc2));if(_0x247bc2[_0x8284('0x10')]){if(_0x247bc2['error'][_0x8284('0x11')]===0x1f4){logger[_0x8284('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x1329bb,_0x247bc2[_0x8284('0x10')][_0x8284('0x12')]);return _0x410624(_0x247bc2[_0x8284('0x10')][_0x8284('0x12')]);}logger['error']('AnalyticMetric,\x20%s,\x20%s',_0x1329bb,_0x247bc2[_0x8284('0x10')][_0x8284('0x12')]);return _0xf7caa9(_0x247bc2[_0x8284('0x10')]['message']);}else{logger[_0x8284('0x13')](_0x8284('0xc'),_0x1329bb,_0x8284('0xd'));_0xf7caa9(_0x247bc2[_0x8284('0x14')][_0x8284('0x12')]);}})[_0x8284('0x15')](function(_0x24f353){logger['error'](_0x8284('0xc'),_0x1329bb,_0x24f353);_0x410624(_0x24f353);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 790d8c8..f860651 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 _0x0650=['../../config/environment','./analyticMetric.controller','index','post','create','put','isAuthenticated','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service'];(function(_0x3cf5c7,_0x1eb319){var _0xf3d981=function(_0x3521ef){while(--_0x3521ef){_0x3cf5c7['push'](_0x3cf5c7['shift']());}};_0xf3d981(++_0x1eb319);}(_0x0650,0x1aa));var _0x0065=function(_0x309df4,_0x3391db){_0x309df4=_0x309df4-0x0;var _0x4be8fc=_0x0650[_0x309df4];return _0x4be8fc;};'use strict';var multer=require(_0x0065('0x0'));var util=require(_0x0065('0x1'));var path=require(_0x0065('0x2'));var timeout=require(_0x0065('0x3'));var express=require('express');var router=express[_0x0065('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0065('0x5'));var config=require(_0x0065('0x6'));var controller=require(_0x0065('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0065('0x8')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x0065('0x9')]('/',auth['isAuthenticated'](),controller[_0x0065('0xa')]);router[_0x0065('0xb')]('/:id',auth[_0x0065('0xc')](),controller[_0x0065('0xd')]);router['delete']('/:id',auth[_0x0065('0xc')](),controller[_0x0065('0xe')]);module[_0x0065('0xf')]=router; \ No newline at end of file +var _0x7d10=['create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post'];(function(_0x5729f4,_0x1bfce9){var _0x267ebc=function(_0x219bfd){while(--_0x219bfd){_0x5729f4['push'](_0x5729f4['shift']());}};_0x267ebc(++_0x1bfce9);}(_0x7d10,0x1ce));var _0x07d1=function(_0x5d8875,_0x7ee30){_0x5d8875=_0x5d8875-0x0;var _0x4b2d42=_0x7d10[_0x5d8875];return _0x4b2d42;};'use strict';var multer=require('multer');var util=require(_0x07d1('0x0'));var path=require(_0x07d1('0x1'));var timeout=require('connect-timeout');var express=require(_0x07d1('0x2'));var router=express[_0x07d1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x07d1('0x4'));var interaction=require(_0x07d1('0x5'));var config=require('../../config/environment');var controller=require(_0x07d1('0x6'));router[_0x07d1('0x7')]('/',auth[_0x07d1('0x8')](),controller[_0x07d1('0x9')]);router['get'](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0xb')]);router[_0x07d1('0xc')]('/',auth[_0x07d1('0x8')](),controller[_0x07d1('0xd')]);router[_0x07d1('0xe')](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0xf')]);router[_0x07d1('0x10')](_0x07d1('0xa'),auth[_0x07d1('0x8')](),controller[_0x07d1('0x11')]);module[_0x07d1('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index f722b83..3df5d1b 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 _0x3d48=['TEXT','exports'];(function(_0x515c44,_0x1540de){var _0x49c4fa=function(_0x437b62){while(--_0x437b62){_0x515c44['push'](_0x515c44['shift']());}};_0x49c4fa(++_0x1540de);}(_0x3d48,0x151));var _0x83d4=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x3d48[_0x4565bf];return _0x5610ba;};'use strict';var Sequelize=require('sequelize');module[_0x83d4('0x0')]={'tree':{'type':Sequelize[_0x83d4('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb6f6=['exports','TEXT','sequelize'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xb6f6,0x18e));var _0x6b6f=function(_0x4d3c2b,_0x452139){_0x4d3c2b=_0x4d3c2b-0x0;var _0x42df4d=_0xb6f6[_0x4d3c2b];return _0x42df4d;};'use strict';var Sequelize=require(_0x6b6f('0x0'));module[_0x6b6f('0x1')]={'tree':{'type':Sequelize[_0x6b6f('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 3ce56ae..fba43d1 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 _0xb202=['params','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','set','Content-Range','reject','save','update','then','destroy','end','sendStatus','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','pick','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xb202,0x120));var _0x2b20=function(_0x5d4607,_0x6b5e7b){_0x5d4607=_0x5d4607-0x0;var _0x5e4a86=_0xb202[_0x5d4607];return _0x5e4a86;};'use strict';var emlformat=require(_0x2b20('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2b20('0x1'));var jsonpatch=require(_0x2b20('0x2'));var rp=require(_0x2b20('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2b20('0x4'));var util=require(_0x2b20('0x5'));var path=require(_0x2b20('0x6'));var sox=require(_0x2b20('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b20('0x8'));var _=require('lodash');var squel=require(_0x2b20('0x9'));var crypto=require('crypto');var jsforce=require(_0x2b20('0xa'));var deskjs=require(_0x2b20('0xb'));var toCsv=require('to-csv');var querystring=require(_0x2b20('0xc'));var Papa=require(_0x2b20('0xd'));var Redis=require(_0x2b20('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b20('0xf'));var logger=require(_0x2b20('0x10'))('api');var utils=require(_0x2b20('0x11'));var config=require(_0x2b20('0x12'));var licenseUtil=require(_0x2b20('0x13'));var db=require(_0x2b20('0x14'))['db'];function respondWithStatusCode(_0x52f06a,_0x1d84ca){_0x1d84ca=_0x1d84ca||0xcc;return function(_0x44ce10){if(_0x44ce10){return _0x52f06a['sendStatus'](_0x1d84ca);}return _0x52f06a[_0x2b20('0x15')](_0x1d84ca)['end']();};}function respondWithResult(_0x468c78,_0x4fe4c2){_0x4fe4c2=_0x4fe4c2||0xc8;return function(_0x2b53e7){if(_0x2b53e7){return _0x468c78[_0x2b20('0x15')](_0x4fe4c2)[_0x2b20('0x16')](_0x2b53e7);}};}function respondWithFilteredResult(_0xdcf66c,_0x2921cf){return function(_0xb3ee8c){if(_0xb3ee8c){var _0x343720=typeof _0x2921cf['offset']===_0x2b20('0x17')&&typeof _0x2921cf[_0x2b20('0x18')]===_0x2b20('0x17');var _0x4d3589=_0xb3ee8c['count'];var _0x15f4af=_0x343720?0x0:_0x2921cf[_0x2b20('0x19')];var _0x4c5676=_0x343720?_0xb3ee8c['count']:_0x2921cf[_0x2b20('0x19')]+_0x2921cf[_0x2b20('0x18')];var _0xd931ac;if(_0x4c5676>=_0x4d3589){_0x4c5676=_0x4d3589;_0xd931ac=0xc8;}else{_0xd931ac=0xce;}_0xdcf66c[_0x2b20('0x15')](_0xd931ac);return _0xdcf66c[_0x2b20('0x1a')](_0x2b20('0x1b'),_0x15f4af+'-'+_0x4c5676+'/'+_0x4d3589)[_0x2b20('0x16')](_0xb3ee8c);}return null;};}function patchUpdates(_0x2b5a7e){return function(_0x143d53){try{jsonpatch['apply'](_0x143d53,_0x2b5a7e,!![]);}catch(_0x13d3b7){return BPromise[_0x2b20('0x1c')](_0x13d3b7);}return _0x143d53[_0x2b20('0x1d')]();};}function saveUpdates(_0xe6c59c,_0x562694){return function(_0x19fae6){if(_0x19fae6){return _0x19fae6[_0x2b20('0x1e')](_0xe6c59c)[_0x2b20('0x1f')](function(_0x2d79f1){return _0x2d79f1;});}return null;};}function removeEntity(_0x40cf85,_0x138942){return function(_0x467339){if(_0x467339){return _0x467339[_0x2b20('0x20')]()[_0x2b20('0x1f')](function(){_0x40cf85[_0x2b20('0x15')](0xcc)[_0x2b20('0x21')]();});}};}function handleEntityNotFound(_0x40335f,_0x37c958){return function(_0x158903){if(!_0x158903){_0x40335f[_0x2b20('0x22')](0x194);}return _0x158903;};}function handleError(_0x305d7e,_0x5289a4){_0x5289a4=_0x5289a4||0x1f4;return function(_0x118e20){logger[_0x2b20('0x23')](_0x118e20[_0x2b20('0x24')]);if(_0x118e20[_0x2b20('0x25')]){delete _0x118e20['name'];}_0x305d7e[_0x2b20('0x15')](_0x5289a4)['send'](_0x118e20);};}exports[_0x2b20('0x26')]=function(_0x44c035,_0x5164f5){var _0x37de99={},_0x3e11d6={},_0x5d17db={'count':0x0,'rows':[]};var _0x311dde=_[_0x2b20('0x27')](db[_0x2b20('0x28')][_0x2b20('0x29')],function(_0x26ab46){return{'name':_0x26ab46[_0x2b20('0x2a')],'type':_0x26ab46[_0x2b20('0x2b')][_0x2b20('0x2c')]};});_0x3e11d6['model']=_['map'](_0x311dde,_0x2b20('0x25'));_0x3e11d6[_0x2b20('0x2d')]=_[_0x2b20('0x2e')](_0x44c035['query']);_0x3e11d6[_0x2b20('0x2f')]=_['intersection'](_0x3e11d6[_0x2b20('0x30')],_0x3e11d6[_0x2b20('0x2d')]);_0x37de99[_0x2b20('0x31')]=_[_0x2b20('0x32')](_0x3e11d6[_0x2b20('0x30')],qs[_0x2b20('0x33')](_0x44c035[_0x2b20('0x2d')][_0x2b20('0x33')]));_0x37de99[_0x2b20('0x31')]=_0x37de99[_0x2b20('0x31')][_0x2b20('0x34')]?_0x37de99[_0x2b20('0x31')]:_0x3e11d6[_0x2b20('0x30')];if(!_0x44c035['query'][_0x2b20('0x35')]('nolimit')){_0x37de99[_0x2b20('0x18')]=qs[_0x2b20('0x18')](_0x44c035['query']['limit']);_0x37de99['offset']=qs[_0x2b20('0x19')](_0x44c035['query'][_0x2b20('0x19')]);}_0x37de99[_0x2b20('0x36')]=qs['sort'](_0x44c035[_0x2b20('0x2d')]['sort']);_0x37de99['where']=qs[_0x2b20('0x2f')](_[_0x2b20('0x37')](_0x44c035[_0x2b20('0x2d')],_0x3e11d6[_0x2b20('0x2f')]),_0x311dde);if(_0x44c035[_0x2b20('0x2d')]['filter']){_0x37de99[_0x2b20('0x38')]=_['merge'](_0x37de99[_0x2b20('0x38')],{'$or':_[_0x2b20('0x27')](_0x311dde,function(_0x295a25){if(_0x295a25[_0x2b20('0x2b')]!=='VIRTUAL'){var _0x1ab468={};_0x1ab468[_0x295a25[_0x2b20('0x25')]]={'$like':'%'+_0x44c035['query'][_0x2b20('0x39')]+'%'};return _0x1ab468;}})});}_0x37de99=_[_0x2b20('0x3a')]({},_0x37de99,_0x44c035[_0x2b20('0x3b')]);var _0x1bf63e={'where':_0x37de99['where']};return db['AnalyticTreeReport'][_0x2b20('0x3c')](_0x1bf63e)[_0x2b20('0x1f')](function(_0xc2b80a){_0x5d17db[_0x2b20('0x3c')]=_0xc2b80a;if(_0x44c035[_0x2b20('0x2d')][_0x2b20('0x3d')]){_0x37de99[_0x2b20('0x3e')]=[{'all':!![]}];}return db[_0x2b20('0x28')][_0x2b20('0x3f')](_0x37de99);})[_0x2b20('0x1f')](function(_0x2b93e4){_0x5d17db[_0x2b20('0x40')]=_0x2b93e4;return _0x5d17db;})[_0x2b20('0x1f')](respondWithFilteredResult(_0x5164f5,_0x37de99))[_0x2b20('0x41')](handleError(_0x5164f5,null));};exports[_0x2b20('0x42')]=function(_0x43caee,_0x599886){var _0x466828={'raw':!![],'where':{'id':_0x43caee[_0x2b20('0x43')]['id']}},_0x2f1d45={};_0x2f1d45['model']=_['keys'](db['AnalyticTreeReport'][_0x2b20('0x29')]);_0x2f1d45[_0x2b20('0x2d')]=_['keys'](_0x43caee[_0x2b20('0x2d')]);_0x2f1d45[_0x2b20('0x2f')]=_[_0x2b20('0x32')](_0x2f1d45[_0x2b20('0x30')],_0x2f1d45[_0x2b20('0x2d')]);_0x466828[_0x2b20('0x31')]=_[_0x2b20('0x32')](_0x2f1d45[_0x2b20('0x30')],qs[_0x2b20('0x33')](_0x43caee[_0x2b20('0x2d')][_0x2b20('0x33')]));_0x466828['attributes']=_0x466828[_0x2b20('0x31')][_0x2b20('0x34')]?_0x466828[_0x2b20('0x31')]:_0x2f1d45[_0x2b20('0x30')];if(_0x43caee['query']['includeAll']){_0x466828[_0x2b20('0x3e')]=[{'all':!![]}];}_0x466828=_[_0x2b20('0x3a')]({},_0x466828,_0x43caee['options']);return db['AnalyticTreeReport'][_0x2b20('0x44')](_0x466828)[_0x2b20('0x1f')](handleEntityNotFound(_0x599886,null))[_0x2b20('0x1f')](respondWithResult(_0x599886,null))['catch'](handleError(_0x599886,null));};exports[_0x2b20('0x45')]=function(_0x5696d3,_0x1f5ba0){return db[_0x2b20('0x28')][_0x2b20('0x45')](_0x5696d3['body'],{})['then'](respondWithResult(_0x1f5ba0,0xc9))['catch'](handleError(_0x1f5ba0,null));};exports['update']=function(_0x278dd6,_0x424ada){if(_0x278dd6[_0x2b20('0x46')]['id']){delete _0x278dd6['body']['id'];}return db['AnalyticTreeReport'][_0x2b20('0x44')]({'where':{'id':_0x278dd6[_0x2b20('0x43')]['id']}})[_0x2b20('0x1f')](handleEntityNotFound(_0x424ada,null))['then'](saveUpdates(_0x278dd6['body'],null))[_0x2b20('0x1f')](respondWithResult(_0x424ada,null))[_0x2b20('0x41')](handleError(_0x424ada,null));};exports['destroy']=function(_0x44eec2,_0x385060){return db[_0x2b20('0x28')][_0x2b20('0x44')]({'where':{'id':_0x44eec2['params']['id']}})['then'](handleEntityNotFound(_0x385060,null))[_0x2b20('0x1f')](removeEntity(_0x385060,null))['catch'](handleError(_0x385060,null));}; \ No newline at end of file +var _0x4e65=['apply','reject','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','VIRTUAL','merge','include','findAll','catch','show','params','keys','includeAll','options','find','create','body','request-promise','moment','bluebird','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','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4e65,0x19b));var _0x54e6=function(_0x25442e,_0x5844c3){_0x25442e=_0x25442e-0x0;var _0x15077d=_0x4e65[_0x25442e];return _0x15077d;};'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(_0x54e6('0x0'));var moment=require(_0x54e6('0x1'));var BPromise=require(_0x54e6('0x2'));var Mustache=require('mustache');var util=require('util');var path=require(_0x54e6('0x3'));var sox=require(_0x54e6('0x4'));var csv=require(_0x54e6('0x5'));var ejs=require(_0x54e6('0x6'));var fs=require('fs');var fs_extra=require(_0x54e6('0x7'));var _=require(_0x54e6('0x8'));var squel=require(_0x54e6('0x9'));var crypto=require(_0x54e6('0xa'));var jsforce=require(_0x54e6('0xb'));var deskjs=require(_0x54e6('0xc'));var toCsv=require(_0x54e6('0x5'));var querystring=require(_0x54e6('0xd'));var Papa=require(_0x54e6('0xe'));var Redis=require(_0x54e6('0xf'));var authService=require(_0x54e6('0x10'));var qs=require(_0x54e6('0x11'));var as=require(_0x54e6('0x12'));var hardwareService=require(_0x54e6('0x13'));var logger=require(_0x54e6('0x14'))('api');var utils=require(_0x54e6('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x54e6('0x16'));var db=require(_0x54e6('0x17'))['db'];function respondWithStatusCode(_0x455224,_0x51ce76){_0x51ce76=_0x51ce76||0xcc;return function(_0x5c4655){if(_0x5c4655){return _0x455224[_0x54e6('0x18')](_0x51ce76);}return _0x455224[_0x54e6('0x19')](_0x51ce76)[_0x54e6('0x1a')]();};}function respondWithResult(_0x26f76c,_0x466248){_0x466248=_0x466248||0xc8;return function(_0x4295b8){if(_0x4295b8){return _0x26f76c[_0x54e6('0x19')](_0x466248)[_0x54e6('0x1b')](_0x4295b8);}};}function respondWithFilteredResult(_0x1ac10d,_0x375bbc){return function(_0x3d98dc){if(_0x3d98dc){var _0x5c88a2=typeof _0x375bbc[_0x54e6('0x1c')]===_0x54e6('0x1d')&&typeof _0x375bbc[_0x54e6('0x1e')]===_0x54e6('0x1d');var _0x2a3a35=_0x3d98dc[_0x54e6('0x1f')];var _0x59422a=_0x5c88a2?0x0:_0x375bbc[_0x54e6('0x1c')];var _0x513a43=_0x5c88a2?_0x3d98dc[_0x54e6('0x1f')]:_0x375bbc[_0x54e6('0x1c')]+_0x375bbc[_0x54e6('0x1e')];var _0x338d42;if(_0x513a43>=_0x2a3a35){_0x513a43=_0x2a3a35;_0x338d42=0xc8;}else{_0x338d42=0xce;}_0x1ac10d[_0x54e6('0x19')](_0x338d42);return _0x1ac10d['set'](_0x54e6('0x20'),_0x59422a+'-'+_0x513a43+'/'+_0x2a3a35)['json'](_0x3d98dc);}return null;};}function patchUpdates(_0x5144b7){return function(_0x20606b){try{jsonpatch[_0x54e6('0x21')](_0x20606b,_0x5144b7,!![]);}catch(_0x373de3){return BPromise[_0x54e6('0x22')](_0x373de3);}return _0x20606b[_0x54e6('0x23')]();};}function saveUpdates(_0x36a8b4,_0x3fbae1){return function(_0x49c315){if(_0x49c315){return _0x49c315[_0x54e6('0x24')](_0x36a8b4)[_0x54e6('0x25')](function(_0x245a38){return _0x245a38;});}return null;};}function removeEntity(_0x36ff3d,_0x28f674){return function(_0x2d3912){if(_0x2d3912){return _0x2d3912[_0x54e6('0x26')]()[_0x54e6('0x25')](function(){_0x36ff3d[_0x54e6('0x19')](0xcc)[_0x54e6('0x1a')]();});}};}function handleEntityNotFound(_0x5b1e65,_0x1eb9cd){return function(_0x25825c){if(!_0x25825c){_0x5b1e65[_0x54e6('0x18')](0x194);}return _0x25825c;};}function handleError(_0x4227c2,_0x4ed08b){_0x4ed08b=_0x4ed08b||0x1f4;return function(_0x5cf126){logger[_0x54e6('0x27')](_0x5cf126[_0x54e6('0x28')]);if(_0x5cf126[_0x54e6('0x29')]){delete _0x5cf126[_0x54e6('0x29')];}_0x4227c2[_0x54e6('0x19')](_0x4ed08b)[_0x54e6('0x2a')](_0x5cf126);};}exports[_0x54e6('0x2b')]=function(_0x4256bf,_0x27c09d){var _0x1be29e={},_0x966fc4={},_0x4a775b={'count':0x0,'rows':[]};var _0x28f4b4=_[_0x54e6('0x2c')](db[_0x54e6('0x2d')][_0x54e6('0x2e')],function(_0x5011e6){return{'name':_0x5011e6['fieldName'],'type':_0x5011e6[_0x54e6('0x2f')][_0x54e6('0x30')]};});_0x966fc4[_0x54e6('0x31')]=_[_0x54e6('0x2c')](_0x28f4b4,_0x54e6('0x29'));_0x966fc4[_0x54e6('0x32')]=_['keys'](_0x4256bf[_0x54e6('0x32')]);_0x966fc4[_0x54e6('0x33')]=_[_0x54e6('0x34')](_0x966fc4[_0x54e6('0x31')],_0x966fc4[_0x54e6('0x32')]);_0x1be29e['attributes']=_[_0x54e6('0x34')](_0x966fc4[_0x54e6('0x31')],qs[_0x54e6('0x35')](_0x4256bf[_0x54e6('0x32')][_0x54e6('0x35')]));_0x1be29e[_0x54e6('0x36')]=_0x1be29e[_0x54e6('0x36')][_0x54e6('0x37')]?_0x1be29e[_0x54e6('0x36')]:_0x966fc4['model'];if(!_0x4256bf[_0x54e6('0x32')][_0x54e6('0x38')]('nolimit')){_0x1be29e['limit']=qs['limit'](_0x4256bf[_0x54e6('0x32')]['limit']);_0x1be29e[_0x54e6('0x1c')]=qs[_0x54e6('0x1c')](_0x4256bf[_0x54e6('0x32')][_0x54e6('0x1c')]);}_0x1be29e[_0x54e6('0x39')]=qs[_0x54e6('0x3a')](_0x4256bf['query']['sort']);_0x1be29e[_0x54e6('0x3b')]=qs[_0x54e6('0x33')](_[_0x54e6('0x3c')](_0x4256bf['query'],_0x966fc4[_0x54e6('0x33')]),_0x28f4b4);if(_0x4256bf[_0x54e6('0x32')]['filter']){_0x1be29e[_0x54e6('0x3b')]=_['merge'](_0x1be29e[_0x54e6('0x3b')],{'$or':_[_0x54e6('0x2c')](_0x28f4b4,function(_0x46b39b){if(_0x46b39b[_0x54e6('0x2f')]!==_0x54e6('0x3d')){var _0x33eadd={};_0x33eadd[_0x46b39b[_0x54e6('0x29')]]={'$like':'%'+_0x4256bf['query']['filter']+'%'};return _0x33eadd;}})});}_0x1be29e=_[_0x54e6('0x3e')]({},_0x1be29e,_0x4256bf['options']);var _0x205d74={'where':_0x1be29e[_0x54e6('0x3b')]};return db[_0x54e6('0x2d')]['count'](_0x205d74)[_0x54e6('0x25')](function(_0x155ba0){_0x4a775b['count']=_0x155ba0;if(_0x4256bf[_0x54e6('0x32')]['includeAll']){_0x1be29e[_0x54e6('0x3f')]=[{'all':!![]}];}return db[_0x54e6('0x2d')][_0x54e6('0x40')](_0x1be29e);})[_0x54e6('0x25')](function(_0x12c914){_0x4a775b['rows']=_0x12c914;return _0x4a775b;})[_0x54e6('0x25')](respondWithFilteredResult(_0x27c09d,_0x1be29e))[_0x54e6('0x41')](handleError(_0x27c09d,null));};exports[_0x54e6('0x42')]=function(_0x1a411f,_0xd514fa){var _0x582902={'raw':!![],'where':{'id':_0x1a411f[_0x54e6('0x43')]['id']}},_0x281b47={};_0x281b47[_0x54e6('0x31')]=_[_0x54e6('0x44')](db[_0x54e6('0x2d')][_0x54e6('0x2e')]);_0x281b47[_0x54e6('0x32')]=_[_0x54e6('0x44')](_0x1a411f[_0x54e6('0x32')]);_0x281b47[_0x54e6('0x33')]=_[_0x54e6('0x34')](_0x281b47[_0x54e6('0x31')],_0x281b47[_0x54e6('0x32')]);_0x582902[_0x54e6('0x36')]=_[_0x54e6('0x34')](_0x281b47[_0x54e6('0x31')],qs[_0x54e6('0x35')](_0x1a411f[_0x54e6('0x32')][_0x54e6('0x35')]));_0x582902[_0x54e6('0x36')]=_0x582902['attributes'][_0x54e6('0x37')]?_0x582902[_0x54e6('0x36')]:_0x281b47['model'];if(_0x1a411f[_0x54e6('0x32')][_0x54e6('0x45')]){_0x582902[_0x54e6('0x3f')]=[{'all':!![]}];}_0x582902=_[_0x54e6('0x3e')]({},_0x582902,_0x1a411f[_0x54e6('0x46')]);return db[_0x54e6('0x2d')][_0x54e6('0x47')](_0x582902)[_0x54e6('0x25')](handleEntityNotFound(_0xd514fa,null))[_0x54e6('0x25')](respondWithResult(_0xd514fa,null))[_0x54e6('0x41')](handleError(_0xd514fa,null));};exports[_0x54e6('0x48')]=function(_0x1601f1,_0x190b2e){return db['AnalyticTreeReport']['create'](_0x1601f1[_0x54e6('0x49')],{})['then'](respondWithResult(_0x190b2e,0xc9))[_0x54e6('0x41')](handleError(_0x190b2e,null));};exports['update']=function(_0x3e3aa3,_0x21829a){if(_0x3e3aa3['body']['id']){delete _0x3e3aa3['body']['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x3e3aa3['params']['id']}})[_0x54e6('0x25')](handleEntityNotFound(_0x21829a,null))['then'](saveUpdates(_0x3e3aa3['body'],null))[_0x54e6('0x25')](respondWithResult(_0x21829a,null))[_0x54e6('0x41')](handleError(_0x21829a,null));};exports[_0x54e6('0x26')]=function(_0x347373,_0x169714){return db[_0x54e6('0x2d')][_0x54e6('0x47')]({'where':{'id':_0x347373[_0x54e6('0x43')]['id']}})['then'](handleEntityNotFound(_0x169714,null))[_0x54e6('0x25')](removeEntity(_0x169714,null))[_0x54e6('0x41')](handleError(_0x169714,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index a79d97e..22ecec6 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 _0xb83d=['rimraf','../../config/environment','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xb83d,0x1a5));var _0xdb83=function(_0x2e808,_0x20303e){_0x2e808=_0x2e808-0x0;var _0x1b3cfd=_0xb83d[_0x2e808];return _0x1b3cfd;};'use strict';var _=require(_0xdb83('0x0'));var util=require(_0xdb83('0x1'));var logger=require(_0xdb83('0x2'))(_0xdb83('0x3'));var moment=require(_0xdb83('0x4'));var BPromise=require(_0xdb83('0x5'));var rp=require(_0xdb83('0x6'));var fs=require('fs');var path=require(_0xdb83('0x7'));var rimraf=require(_0xdb83('0x8'));var config=require(_0xdb83('0x9'));var attributes=require('./analyticTreeReport.attributes');module['exports']=function(_0x5ababe,_0x3ee45f){return _0x5ababe[_0xdb83('0xa')](_0xdb83('0xb'),attributes,{'tableName':_0xdb83('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18f3=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees'];(function(_0x100f05,_0x2de0fa){var _0x2bcde1=function(_0x1e564d){while(--_0x1e564d){_0x100f05['push'](_0x100f05['shift']());}};_0x2bcde1(++_0x2de0fa);}(_0x18f3,0x7e));var _0x318f=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x18f3[_0x513aa5];return _0x1a1a7c;};'use strict';var _=require(_0x318f('0x0'));var util=require(_0x318f('0x1'));var logger=require(_0x318f('0x2'))(_0x318f('0x3'));var moment=require(_0x318f('0x4'));var BPromise=require(_0x318f('0x5'));var rp=require(_0x318f('0x6'));var fs=require('fs');var path=require(_0x318f('0x7'));var rimraf=require('rimraf');var config=require(_0x318f('0x8'));var attributes=require(_0x318f('0x9'));module[_0x318f('0xa')]=function(_0x5df83b,_0x55e201){return _0x5df83b[_0x318f('0xb')](_0x318f('0xc'),attributes,{'tableName':_0x318f('0xd'),'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 4e890a3..94a752f 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x58e39a,_0x474e33){var _0x5233f4=function(_0x3fa875){while(--_0x3fa875){_0x58e39a['push'](_0x58e39a['shift']());}};_0x5233f4(++_0x474e33);}(_0x2ef3,0xba));var _0x32ef=function(_0x3e4656,_0x43a613){_0x3e4656=_0x3e4656-0x0;var _0x5b5fec=_0x2ef3[_0x3e4656];return _0x5b5fec;};'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')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x116ff8,_0x3b830c){var _0x2d5f4b=function(_0x59cdbd){while(--_0x59cdbd){_0x116ff8['push'](_0x116ff8['shift']());}};_0x2d5f4b(++_0x3b830c);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xc4aa[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 8bce226..3df6a01 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 _0x8bc4=['../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','/:id','post','create','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x810025,_0x34bb04){var _0x4dbc81=function(_0x2c3907){while(--_0x2c3907){_0x810025['push'](_0x810025['shift']());}};_0x4dbc81(++_0x34bb04);}(_0x8bc4,0x19b));var _0x48bc=function(_0xec1b66,_0xa6760c){_0xec1b66=_0xec1b66-0x0;var _0x1fca6f=_0x8bc4[_0xec1b66];return _0x1fca6f;};'use strict';var multer=require(_0x48bc('0x0'));var util=require(_0x48bc('0x1'));var path=require('path');var timeout=require(_0x48bc('0x2'));var express=require(_0x48bc('0x3'));var router=express[_0x48bc('0x4')]();var fs_extra=require(_0x48bc('0x5'));var auth=require(_0x48bc('0x6'));var interaction=require(_0x48bc('0x7'));var config=require(_0x48bc('0x8'));var controller=require(_0x48bc('0x9'));router[_0x48bc('0xa')]('/',auth[_0x48bc('0xb')](),controller[_0x48bc('0xc')]);router[_0x48bc('0xa')](_0x48bc('0xd'),auth[_0x48bc('0xb')](),controller['show']);router[_0x48bc('0xe')]('/',auth[_0x48bc('0xb')](),controller[_0x48bc('0xf')]);router[_0x48bc('0x10')](_0x48bc('0xd'),auth[_0x48bc('0xb')](),controller['update']);router[_0x48bc('0x11')](_0x48bc('0xd'),auth[_0x48bc('0xb')](),controller['destroy']);module[_0x48bc('0x12')]=router; \ No newline at end of file +var _0x497c=['get','isAuthenticated','index','/:id','show','create','put','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1e4991,_0x5073ee){var _0x36b6b7=function(_0xbb056c){while(--_0xbb056c){_0x1e4991['push'](_0x1e4991['shift']());}};_0x36b6b7(++_0x5073ee);}(_0x497c,0x15d));var _0xc497=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x497c[_0x42bdad];return _0x122626;};'use strict';var multer=require(_0xc497('0x0'));var util=require(_0xc497('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xc497('0x2'));var router=express[_0xc497('0x3')]();var fs_extra=require(_0xc497('0x4'));var auth=require(_0xc497('0x5'));var interaction=require(_0xc497('0x6'));var config=require(_0xc497('0x7'));var controller=require('./analyticTreeReport.controller');router[_0xc497('0x8')]('/',auth[_0xc497('0x9')](),controller[_0xc497('0xa')]);router[_0xc497('0x8')](_0xc497('0xb'),auth[_0xc497('0x9')](),controller[_0xc497('0xc')]);router['post']('/',auth[_0xc497('0x9')](),controller[_0xc497('0xd')]);router[_0xc497('0xe')](_0xc497('0xb'),auth[_0xc497('0x9')](),controller['update']);router[_0xc497('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xc497('0x10')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 3d05f3f..0ec2867 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 _0x7b83=['exports','STRING','sequelize'];(function(_0x43c1fa,_0x52253b){var _0x1dbfa8=function(_0x3a874c){while(--_0x3a874c){_0x43c1fa['push'](_0x43c1fa['shift']());}};_0x1dbfa8(++_0x52253b);}(_0x7b83,0xa1));var _0x37b8=function(_0x3dac92,_0x199145){_0x3dac92=_0x3dac92-0x0;var _0x134ae2=_0x7b83[_0x3dac92];return _0x134ae2;};'use strict';var Sequelize=require(_0x37b8('0x0'));module[_0x37b8('0x1')]={'name':{'type':Sequelize[_0x37b8('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x85d8=['sequelize','exports','STRING'];(function(_0x2dca9b,_0x1af4d9){var _0x464de8=function(_0x25c125){while(--_0x25c125){_0x2dca9b['push'](_0x2dca9b['shift']());}};_0x464de8(++_0x1af4d9);}(_0x85d8,0x1b0));var _0x885d=function(_0x1c076a,_0x132502){_0x1c076a=_0x1c076a-0x0;var _0x400bec=_0x85d8[_0x1c076a];return _0x400bec;};'use strict';var Sequelize=require(_0x885d('0x0'));module[_0x885d('0x1')]={'name':{'type':Sequelize[_0x885d('0x2')]},'basename':{'type':Sequelize[_0x885d('0x2')]},'type':{'type':Sequelize[_0x885d('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 008e272..ab4a89c 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 _0xc965=['includeAll','include','rows','catch','show','length','find','params','get','omit','createdAt','updatedAt','body','create','file','basename','mimetype','download','findOne','ChatOfflineMessageId','join','root','offline-chat/','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/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','fields','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x58dbee,_0x4be613){var _0x3fdc98=function(_0x416171){while(--_0x416171){_0x58dbee['push'](_0x58dbee['shift']());}};_0x3fdc98(++_0x4be613);}(_0xc965,0x12b));var _0x5c96=function(_0x1d29f6,_0x45f6a0){_0x1d29f6=_0x1d29f6-0x0;var _0x491093=_0xc965[_0x1d29f6];return _0x491093;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5c96('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5c96('0x1'));var rp=require(_0x5c96('0x2'));var moment=require(_0x5c96('0x3'));var BPromise=require(_0x5c96('0x4'));var Mustache=require('mustache');var util=require(_0x5c96('0x5'));var path=require(_0x5c96('0x6'));var sox=require(_0x5c96('0x7'));var csv=require(_0x5c96('0x8'));var ejs=require(_0x5c96('0x9'));var fs=require('fs');var fs_extra=require(_0x5c96('0xa'));var _=require('lodash');var squel=require(_0x5c96('0xb'));var crypto=require(_0x5c96('0xc'));var jsforce=require(_0x5c96('0xd'));var deskjs=require(_0x5c96('0xe'));var toCsv=require(_0x5c96('0x8'));var querystring=require(_0x5c96('0xf'));var Papa=require(_0x5c96('0x10'));var Redis=require(_0x5c96('0x11'));var authService=require(_0x5c96('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x5c96('0x13'));var hardwareService=require(_0x5c96('0x14'));var logger=require(_0x5c96('0x15'))(_0x5c96('0x16'));var utils=require(_0x5c96('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x5c96('0x18'));var db=require(_0x5c96('0x19'))['db'];function respondWithStatusCode(_0x50d33e,_0xf08ac0){_0xf08ac0=_0xf08ac0||0xcc;return function(_0x5bbe57){if(_0x5bbe57){return _0x50d33e['sendStatus'](_0xf08ac0);}return _0x50d33e[_0x5c96('0x1a')](_0xf08ac0)[_0x5c96('0x1b')]();};}function respondWithResult(_0x44c91d,_0x295749){_0x295749=_0x295749||0xc8;return function(_0x1b4ea0){if(_0x1b4ea0){return _0x44c91d[_0x5c96('0x1a')](_0x295749)[_0x5c96('0x1c')](_0x1b4ea0);}};}function respondWithFilteredResult(_0x23b18f,_0xb19404){return function(_0x45564d){if(_0x45564d){var _0x13c919=typeof _0xb19404[_0x5c96('0x1d')]==='undefined'&&typeof _0xb19404['limit']===_0x5c96('0x1e');var _0x42dd96=_0x45564d['count'];var _0x3c5405=_0x13c919?0x0:_0xb19404['offset'];var _0xd70605=_0x13c919?_0x45564d[_0x5c96('0x1f')]:_0xb19404[_0x5c96('0x1d')]+_0xb19404[_0x5c96('0x20')];var _0x40d9ce;if(_0xd70605>=_0x42dd96){_0xd70605=_0x42dd96;_0x40d9ce=0xc8;}else{_0x40d9ce=0xce;}_0x23b18f['status'](_0x40d9ce);return _0x23b18f[_0x5c96('0x21')](_0x5c96('0x22'),_0x3c5405+'-'+_0xd70605+'/'+_0x42dd96)[_0x5c96('0x1c')](_0x45564d);}return null;};}function patchUpdates(_0x55a339){return function(_0x16a3f3){try{jsonpatch[_0x5c96('0x23')](_0x16a3f3,_0x55a339,!![]);}catch(_0x226995){return BPromise[_0x5c96('0x24')](_0x226995);}return _0x16a3f3[_0x5c96('0x25')]();};}function saveUpdates(_0x49219c,_0x456926){return function(_0x4a595c){if(_0x4a595c){return _0x4a595c[_0x5c96('0x26')](_0x49219c)[_0x5c96('0x27')](function(_0x5aa6cf){return _0x5aa6cf;});}return null;};}function removeEntity(_0x19339e,_0x2f7f0e){return function(_0x5b98f2){if(_0x5b98f2){return _0x5b98f2[_0x5c96('0x28')]()[_0x5c96('0x27')](function(){_0x19339e[_0x5c96('0x1a')](0xcc)[_0x5c96('0x1b')]();});}};}function handleEntityNotFound(_0x453d30,_0xb8d00c){return function(_0x19b5e2){if(!_0x19b5e2){_0x453d30[_0x5c96('0x29')](0x194);}return _0x19b5e2;};}function handleError(_0x33015c,_0x36a7ea){_0x36a7ea=_0x36a7ea||0x1f4;return function(_0x59dc7d){logger[_0x5c96('0x2a')](_0x59dc7d[_0x5c96('0x2b')]);if(_0x59dc7d[_0x5c96('0x2c')]){delete _0x59dc7d[_0x5c96('0x2c')];}_0x33015c[_0x5c96('0x1a')](_0x36a7ea)[_0x5c96('0x2d')](_0x59dc7d);};}exports[_0x5c96('0x2e')]=function(_0x190404,_0x2fd328){var _0x44927f={},_0x110749={},_0x866664={'count':0x0,'rows':[]};var _0x1af09b=_[_0x5c96('0x2f')](db[_0x5c96('0x30')][_0x5c96('0x31')],function(_0x18e217){return{'name':_0x18e217[_0x5c96('0x32')],'type':_0x18e217[_0x5c96('0x33')][_0x5c96('0x34')]};});_0x110749['model']=_[_0x5c96('0x2f')](_0x1af09b,_0x5c96('0x2c'));_0x110749[_0x5c96('0x35')]=_[_0x5c96('0x36')](_0x190404[_0x5c96('0x35')]);_0x110749[_0x5c96('0x37')]=_[_0x5c96('0x38')](_0x110749['model'],_0x110749[_0x5c96('0x35')]);_0x44927f[_0x5c96('0x39')]=_['intersection'](_0x110749['model'],qs[_0x5c96('0x3a')](_0x190404[_0x5c96('0x35')][_0x5c96('0x3a')]));_0x44927f[_0x5c96('0x39')]=_0x44927f[_0x5c96('0x39')]['length']?_0x44927f[_0x5c96('0x39')]:_0x110749[_0x5c96('0x3b')];if(!_0x190404['query'][_0x5c96('0x3c')](_0x5c96('0x3d'))){_0x44927f['limit']=qs[_0x5c96('0x20')](_0x190404[_0x5c96('0x35')][_0x5c96('0x20')]);_0x44927f[_0x5c96('0x1d')]=qs['offset'](_0x190404[_0x5c96('0x35')][_0x5c96('0x1d')]);}_0x44927f[_0x5c96('0x3e')]=qs[_0x5c96('0x3f')](_0x190404['query'][_0x5c96('0x3f')]);_0x44927f[_0x5c96('0x40')]=qs[_0x5c96('0x37')](_[_0x5c96('0x41')](_0x190404[_0x5c96('0x35')],_0x110749[_0x5c96('0x37')]),_0x1af09b);if(_0x190404[_0x5c96('0x35')][_0x5c96('0x42')]){_0x44927f['where']=_[_0x5c96('0x43')](_0x44927f['where'],{'$or':_[_0x5c96('0x2f')](_0x1af09b,function(_0x1f33da){if(_0x1f33da[_0x5c96('0x33')]!=='VIRTUAL'){var _0x178910={};_0x178910[_0x1f33da[_0x5c96('0x2c')]]={'$like':'%'+_0x190404[_0x5c96('0x35')][_0x5c96('0x42')]+'%'};return _0x178910;}})});}_0x44927f=_[_0x5c96('0x43')]({},_0x44927f,_0x190404[_0x5c96('0x44')]);var _0x160bed={'where':_0x44927f['where']};return db['Attachment'][_0x5c96('0x1f')](_0x160bed)[_0x5c96('0x27')](function(_0x5163e6){_0x866664[_0x5c96('0x1f')]=_0x5163e6;if(_0x190404['query'][_0x5c96('0x45')]){_0x44927f[_0x5c96('0x46')]=[{'all':!![]}];}return db[_0x5c96('0x30')]['findAll'](_0x44927f);})[_0x5c96('0x27')](function(_0x176c1d){_0x866664[_0x5c96('0x47')]=_0x176c1d;return _0x866664;})['then'](respondWithFilteredResult(_0x2fd328,_0x44927f))[_0x5c96('0x48')](handleError(_0x2fd328,null));};exports[_0x5c96('0x49')]=function(_0x1091b8,_0x39262a){var _0x45b162={'raw':!![],'where':{'id':_0x1091b8['params']['id']}},_0xa9d092={};_0xa9d092[_0x5c96('0x3b')]=_[_0x5c96('0x36')](db[_0x5c96('0x30')][_0x5c96('0x31')]);_0xa9d092['query']=_['keys'](_0x1091b8['query']);_0xa9d092['filters']=_['intersection'](_0xa9d092[_0x5c96('0x3b')],_0xa9d092[_0x5c96('0x35')]);_0x45b162[_0x5c96('0x39')]=_[_0x5c96('0x38')](_0xa9d092[_0x5c96('0x3b')],qs[_0x5c96('0x3a')](_0x1091b8['query'][_0x5c96('0x3a')]));_0x45b162[_0x5c96('0x39')]=_0x45b162[_0x5c96('0x39')][_0x5c96('0x4a')]?_0x45b162['attributes']:_0xa9d092[_0x5c96('0x3b')];if(_0x1091b8['query'][_0x5c96('0x45')]){_0x45b162[_0x5c96('0x46')]=[{'all':!![]}];}_0x45b162=_['merge']({},_0x45b162,_0x1091b8[_0x5c96('0x44')]);return db[_0x5c96('0x30')][_0x5c96('0x4b')](_0x45b162)[_0x5c96('0x27')](handleEntityNotFound(_0x39262a,null))[_0x5c96('0x27')](respondWithResult(_0x39262a,null))[_0x5c96('0x48')](handleError(_0x39262a,null));};exports['clone']=function(_0x50da84,_0x430226){var _0x54ca57={'where':{'id':_0x50da84[_0x5c96('0x4c')]['id']}},_0x40df47={};_0x40df47['model']=_[_0x5c96('0x36')](db[_0x5c96('0x30')][_0x5c96('0x31')]);_0x54ca57[_0x5c96('0x39')]=_[_0x5c96('0x38')](_0x40df47[_0x5c96('0x3b')],qs[_0x5c96('0x3a')](_0x50da84[_0x5c96('0x35')][_0x5c96('0x3a')]));_0x54ca57[_0x5c96('0x39')]=_0x54ca57['attributes'][_0x5c96('0x4a')]?_0x54ca57[_0x5c96('0x39')]:_0x40df47[_0x5c96('0x3b')];if(_0x50da84[_0x5c96('0x35')]['includeAll']){_0x54ca57[_0x5c96('0x46')]=[{'all':!![]}];}_0x54ca57=_[_0x5c96('0x43')]({},_0x54ca57,_0x50da84[_0x5c96('0x44')]);return db[_0x5c96('0x30')][_0x5c96('0x4b')](_0x54ca57)[_0x5c96('0x27')](handleEntityNotFound(_0x430226,null))['then'](function(_0x350529){if(_0x350529){var _0x44cd56=_0x350529[_0x5c96('0x4d')]({'plain':!![]});_0x44cd56=qs[_0x5c96('0x4e')](_0x44cd56,['id',_0x5c96('0x4f'),_0x5c96('0x50')]);_0x50da84[_0x5c96('0x51')]=_[_0x5c96('0x4e')](_0x50da84[_0x5c96('0x51')],['id','createdAt',_0x5c96('0x50')]);return db[_0x5c96('0x30')][_0x5c96('0x52')](_[_0x5c96('0x43')](_0x44cd56,_0x50da84['body']),{'include':_0x50da84['query'][_0x5c96('0x45')]?[{'all':!![]}]:undefined});}})[_0x5c96('0x27')](respondWithResult(_0x430226,0xc9))['catch'](handleError(_0x430226,null));};exports['update']=function(_0x34f29d,_0x5d5986){if(_0x34f29d['body']['id']){delete _0x34f29d[_0x5c96('0x51')]['id'];}return db[_0x5c96('0x30')][_0x5c96('0x4b')]({'where':{'id':_0x34f29d[_0x5c96('0x4c')]['id']}})[_0x5c96('0x27')](handleEntityNotFound(_0x5d5986,null))[_0x5c96('0x27')](saveUpdates(_0x34f29d[_0x5c96('0x51')],null))[_0x5c96('0x27')](respondWithResult(_0x5d5986,null))[_0x5c96('0x48')](handleError(_0x5d5986,null));};exports[_0x5c96('0x28')]=function(_0x52b4ca,_0x48d915){return db[_0x5c96('0x30')][_0x5c96('0x4b')]({'where':{'id':_0x52b4ca[_0x5c96('0x4c')]['id']}})[_0x5c96('0x27')](handleEntityNotFound(_0x48d915,null))[_0x5c96('0x27')](removeEntity(_0x48d915,null))[_0x5c96('0x48')](handleError(_0x48d915,null));};exports[_0x5c96('0x52')]=function(_0x3ad19c,_0x247463,_0x3be67d){_0x3ad19c[_0x5c96('0x51')][_0x5c96('0x2c')]=_0x3ad19c[_0x5c96('0x53')]['originalname'];_0x3ad19c['body'][_0x5c96('0x54')]=_0x3ad19c['file']['filename'];_0x3ad19c['body']['type']=_0x3ad19c['file'][_0x5c96('0x55')];return db[_0x5c96('0x30')][_0x5c96('0x52')](_0x3ad19c['body'])[_0x5c96('0x27')](respondWithResult(_0x247463,0xc9))[_0x5c96('0x48')](handleError(_0x247463,null));};exports[_0x5c96('0x56')]=function(_0x17daf6,_0x2e52ad,_0x131142){return db[_0x5c96('0x30')][_0x5c96('0x57')]({'where':{'id':_0x17daf6[_0x5c96('0x4c')]['id']},'raw':!![]})[_0x5c96('0x27')](handleEntityNotFound(_0x2e52ad,null))['then'](function(_0x5d911e){if(_0x5d911e){var _0x412f1a=_0x5d911e[_0x5c96('0x58')]!==null;var _0x2a7200=path[_0x5c96('0x59')](config[_0x5c96('0x5a')],'server/files/attachments/');if(_0x412f1a){_0x2a7200=path[_0x5c96('0x59')](_0x2a7200,_0x5c96('0x5b'));}var _0x434269=path['join'](_0x2a7200,_0x5d911e[_0x5c96('0x54')]);return _0x2e52ad['download'](_0x434269);}})[_0x5c96('0x48')](handleError(_0x2e52ad,null));}; \ No newline at end of file +var _0x0ddb=['omit','updatedAt','body','createdAt','find','create','file','originalname','basename','filename','findOne','join','root','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','stack','name','send','index','map','Attachment','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','show','params','options','clone','get'];(function(_0x2a029c,_0x4ccbb5){var _0x92750c=function(_0x4959f9){while(--_0x4959f9){_0x2a029c['push'](_0x2a029c['shift']());}};_0x92750c(++_0x4ccbb5);}(_0x0ddb,0x110));var _0xb0dd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0ddb[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0xb0dd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb0dd('0x1'));var jsonpatch=require(_0xb0dd('0x2'));var rp=require(_0xb0dd('0x3'));var moment=require(_0xb0dd('0x4'));var BPromise=require(_0xb0dd('0x5'));var Mustache=require(_0xb0dd('0x6'));var util=require(_0xb0dd('0x7'));var path=require(_0xb0dd('0x8'));var sox=require(_0xb0dd('0x9'));var csv=require(_0xb0dd('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb0dd('0xb'));var _=require(_0xb0dd('0xc'));var squel=require(_0xb0dd('0xd'));var crypto=require(_0xb0dd('0xe'));var jsforce=require(_0xb0dd('0xf'));var deskjs=require(_0xb0dd('0x10'));var toCsv=require(_0xb0dd('0xa'));var querystring=require(_0xb0dd('0x11'));var Papa=require(_0xb0dd('0x12'));var Redis=require(_0xb0dd('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb0dd('0x14'));var as=require(_0xb0dd('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb0dd('0x16'))(_0xb0dd('0x17'));var utils=require(_0xb0dd('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xb0dd('0x19'));var db=require(_0xb0dd('0x1a'))['db'];function respondWithStatusCode(_0xcf7191,_0x24feb6){_0x24feb6=_0x24feb6||0xcc;return function(_0x4a9c41){if(_0x4a9c41){return _0xcf7191[_0xb0dd('0x1b')](_0x24feb6);}return _0xcf7191[_0xb0dd('0x1c')](_0x24feb6)[_0xb0dd('0x1d')]();};}function respondWithResult(_0x787d64,_0x1d804b){_0x1d804b=_0x1d804b||0xc8;return function(_0xeaacb1){if(_0xeaacb1){return _0x787d64[_0xb0dd('0x1c')](_0x1d804b)[_0xb0dd('0x1e')](_0xeaacb1);}};}function respondWithFilteredResult(_0xb5a38c,_0x3363a5){return function(_0x7a6eec){if(_0x7a6eec){var _0x2ed655=typeof _0x3363a5[_0xb0dd('0x1f')]===_0xb0dd('0x20')&&typeof _0x3363a5[_0xb0dd('0x21')]===_0xb0dd('0x20');var _0x5b4d1e=_0x7a6eec[_0xb0dd('0x22')];var _0x593010=_0x2ed655?0x0:_0x3363a5[_0xb0dd('0x1f')];var _0x290d7d=_0x2ed655?_0x7a6eec[_0xb0dd('0x22')]:_0x3363a5[_0xb0dd('0x1f')]+_0x3363a5[_0xb0dd('0x21')];var _0x336751;if(_0x290d7d>=_0x5b4d1e){_0x290d7d=_0x5b4d1e;_0x336751=0xc8;}else{_0x336751=0xce;}_0xb5a38c[_0xb0dd('0x1c')](_0x336751);return _0xb5a38c[_0xb0dd('0x23')](_0xb0dd('0x24'),_0x593010+'-'+_0x290d7d+'/'+_0x5b4d1e)[_0xb0dd('0x1e')](_0x7a6eec);}return null;};}function patchUpdates(_0x5d5507){return function(_0x4c8efe){try{jsonpatch['apply'](_0x4c8efe,_0x5d5507,!![]);}catch(_0x3a4cb3){return BPromise['reject'](_0x3a4cb3);}return _0x4c8efe['save']();};}function saveUpdates(_0x5ecfe7,_0x361a1e){return function(_0x554de3){if(_0x554de3){return _0x554de3[_0xb0dd('0x25')](_0x5ecfe7)[_0xb0dd('0x26')](function(_0x4f6661){return _0x4f6661;});}return null;};}function removeEntity(_0x2081a8,_0x20c197){return function(_0x1ad31c){if(_0x1ad31c){return _0x1ad31c['destroy']()[_0xb0dd('0x26')](function(){_0x2081a8[_0xb0dd('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x46d9da,_0x1fc9fd){return function(_0x187a18){if(!_0x187a18){_0x46d9da[_0xb0dd('0x1b')](0x194);}return _0x187a18;};}function handleError(_0x51ac1b,_0x394898){_0x394898=_0x394898||0x1f4;return function(_0x5365d6){logger['error'](_0x5365d6[_0xb0dd('0x27')]);if(_0x5365d6[_0xb0dd('0x28')]){delete _0x5365d6[_0xb0dd('0x28')];}_0x51ac1b[_0xb0dd('0x1c')](_0x394898)[_0xb0dd('0x29')](_0x5365d6);};}exports[_0xb0dd('0x2a')]=function(_0x38f416,_0x50425e){var _0x106c9b={},_0x463c34={},_0x3b2907={'count':0x0,'rows':[]};var _0x55d9cc=_[_0xb0dd('0x2b')](db[_0xb0dd('0x2c')][_0xb0dd('0x2d')],function(_0x4df711){return{'name':_0x4df711[_0xb0dd('0x2e')],'type':_0x4df711[_0xb0dd('0x2f')][_0xb0dd('0x30')]};});_0x463c34[_0xb0dd('0x31')]=_[_0xb0dd('0x2b')](_0x55d9cc,_0xb0dd('0x28'));_0x463c34['query']=_[_0xb0dd('0x32')](_0x38f416[_0xb0dd('0x33')]);_0x463c34[_0xb0dd('0x34')]=_[_0xb0dd('0x35')](_0x463c34['model'],_0x463c34['query']);_0x106c9b[_0xb0dd('0x36')]=_[_0xb0dd('0x35')](_0x463c34[_0xb0dd('0x31')],qs['fields'](_0x38f416[_0xb0dd('0x33')][_0xb0dd('0x37')]));_0x106c9b['attributes']=_0x106c9b[_0xb0dd('0x36')][_0xb0dd('0x38')]?_0x106c9b[_0xb0dd('0x36')]:_0x463c34[_0xb0dd('0x31')];if(!_0x38f416['query']['hasOwnProperty']('nolimit')){_0x106c9b[_0xb0dd('0x21')]=qs['limit'](_0x38f416['query'][_0xb0dd('0x21')]);_0x106c9b[_0xb0dd('0x1f')]=qs[_0xb0dd('0x1f')](_0x38f416[_0xb0dd('0x33')][_0xb0dd('0x1f')]);}_0x106c9b[_0xb0dd('0x39')]=qs['sort'](_0x38f416[_0xb0dd('0x33')][_0xb0dd('0x3a')]);_0x106c9b[_0xb0dd('0x3b')]=qs['filters'](_[_0xb0dd('0x3c')](_0x38f416[_0xb0dd('0x33')],_0x463c34['filters']),_0x55d9cc);if(_0x38f416[_0xb0dd('0x33')][_0xb0dd('0x3d')]){_0x106c9b[_0xb0dd('0x3b')]=_[_0xb0dd('0x3e')](_0x106c9b['where'],{'$or':_['map'](_0x55d9cc,function(_0x30b6d7){if(_0x30b6d7['type']!==_0xb0dd('0x3f')){var _0x56a240={};_0x56a240[_0x30b6d7[_0xb0dd('0x28')]]={'$like':'%'+_0x38f416['query'][_0xb0dd('0x3d')]+'%'};return _0x56a240;}})});}_0x106c9b=_[_0xb0dd('0x3e')]({},_0x106c9b,_0x38f416['options']);var _0x561f7a={'where':_0x106c9b[_0xb0dd('0x3b')]};return db[_0xb0dd('0x2c')][_0xb0dd('0x22')](_0x561f7a)['then'](function(_0x1dced4){_0x3b2907[_0xb0dd('0x22')]=_0x1dced4;if(_0x38f416['query'][_0xb0dd('0x40')]){_0x106c9b[_0xb0dd('0x41')]=[{'all':!![]}];}return db[_0xb0dd('0x2c')]['findAll'](_0x106c9b);})[_0xb0dd('0x26')](function(_0x11dc9f){_0x3b2907['rows']=_0x11dc9f;return _0x3b2907;})['then'](respondWithFilteredResult(_0x50425e,_0x106c9b))[_0xb0dd('0x42')](handleError(_0x50425e,null));};exports[_0xb0dd('0x43')]=function(_0xd8b59e,_0x2a108b){var _0x350601={'raw':!![],'where':{'id':_0xd8b59e[_0xb0dd('0x44')]['id']}},_0x2e6971={};_0x2e6971[_0xb0dd('0x31')]=_[_0xb0dd('0x32')](db['Attachment'][_0xb0dd('0x2d')]);_0x2e6971[_0xb0dd('0x33')]=_[_0xb0dd('0x32')](_0xd8b59e[_0xb0dd('0x33')]);_0x2e6971[_0xb0dd('0x34')]=_[_0xb0dd('0x35')](_0x2e6971[_0xb0dd('0x31')],_0x2e6971[_0xb0dd('0x33')]);_0x350601[_0xb0dd('0x36')]=_[_0xb0dd('0x35')](_0x2e6971[_0xb0dd('0x31')],qs['fields'](_0xd8b59e[_0xb0dd('0x33')][_0xb0dd('0x37')]));_0x350601[_0xb0dd('0x36')]=_0x350601['attributes'][_0xb0dd('0x38')]?_0x350601[_0xb0dd('0x36')]:_0x2e6971['model'];if(_0xd8b59e[_0xb0dd('0x33')][_0xb0dd('0x40')]){_0x350601['include']=[{'all':!![]}];}_0x350601=_[_0xb0dd('0x3e')]({},_0x350601,_0xd8b59e[_0xb0dd('0x45')]);return db[_0xb0dd('0x2c')]['find'](_0x350601)[_0xb0dd('0x26')](handleEntityNotFound(_0x2a108b,null))[_0xb0dd('0x26')](respondWithResult(_0x2a108b,null))['catch'](handleError(_0x2a108b,null));};exports[_0xb0dd('0x46')]=function(_0x1811a7,_0x3bfae1){var _0x50a175={'where':{'id':_0x1811a7[_0xb0dd('0x44')]['id']}},_0x401cd6={};_0x401cd6[_0xb0dd('0x31')]=_['keys'](db[_0xb0dd('0x2c')][_0xb0dd('0x2d')]);_0x50a175[_0xb0dd('0x36')]=_[_0xb0dd('0x35')](_0x401cd6[_0xb0dd('0x31')],qs[_0xb0dd('0x37')](_0x1811a7[_0xb0dd('0x33')][_0xb0dd('0x37')]));_0x50a175['attributes']=_0x50a175[_0xb0dd('0x36')][_0xb0dd('0x38')]?_0x50a175[_0xb0dd('0x36')]:_0x401cd6[_0xb0dd('0x31')];if(_0x1811a7[_0xb0dd('0x33')][_0xb0dd('0x40')]){_0x50a175[_0xb0dd('0x41')]=[{'all':!![]}];}_0x50a175=_['merge']({},_0x50a175,_0x1811a7[_0xb0dd('0x45')]);return db[_0xb0dd('0x2c')]['find'](_0x50a175)['then'](handleEntityNotFound(_0x3bfae1,null))[_0xb0dd('0x26')](function(_0x8f8895){if(_0x8f8895){var _0x231155=_0x8f8895[_0xb0dd('0x47')]({'plain':!![]});_0x231155=qs[_0xb0dd('0x48')](_0x231155,['id','createdAt',_0xb0dd('0x49')]);_0x1811a7[_0xb0dd('0x4a')]=_[_0xb0dd('0x48')](_0x1811a7[_0xb0dd('0x4a')],['id',_0xb0dd('0x4b'),_0xb0dd('0x49')]);return db[_0xb0dd('0x2c')]['create'](_[_0xb0dd('0x3e')](_0x231155,_0x1811a7[_0xb0dd('0x4a')]),{'include':_0x1811a7[_0xb0dd('0x33')][_0xb0dd('0x40')]?[{'all':!![]}]:undefined});}})[_0xb0dd('0x26')](respondWithResult(_0x3bfae1,0xc9))[_0xb0dd('0x42')](handleError(_0x3bfae1,null));};exports[_0xb0dd('0x25')]=function(_0x37b954,_0x5c0c24){if(_0x37b954[_0xb0dd('0x4a')]['id']){delete _0x37b954['body']['id'];}return db['Attachment'][_0xb0dd('0x4c')]({'where':{'id':_0x37b954['params']['id']}})[_0xb0dd('0x26')](handleEntityNotFound(_0x5c0c24,null))['then'](saveUpdates(_0x37b954[_0xb0dd('0x4a')],null))['then'](respondWithResult(_0x5c0c24,null))[_0xb0dd('0x42')](handleError(_0x5c0c24,null));};exports['destroy']=function(_0x2345af,_0x466f2a){return db[_0xb0dd('0x2c')][_0xb0dd('0x4c')]({'where':{'id':_0x2345af[_0xb0dd('0x44')]['id']}})[_0xb0dd('0x26')](handleEntityNotFound(_0x466f2a,null))[_0xb0dd('0x26')](removeEntity(_0x466f2a,null))[_0xb0dd('0x42')](handleError(_0x466f2a,null));};exports[_0xb0dd('0x4d')]=function(_0xbae9f8,_0x4f33ed,_0x3cf542){_0xbae9f8['body']['name']=_0xbae9f8[_0xb0dd('0x4e')][_0xb0dd('0x4f')];_0xbae9f8[_0xb0dd('0x4a')][_0xb0dd('0x50')]=_0xbae9f8['file'][_0xb0dd('0x51')];_0xbae9f8['body']['type']=_0xbae9f8[_0xb0dd('0x4e')]['mimetype'];return db[_0xb0dd('0x2c')][_0xb0dd('0x4d')](_0xbae9f8[_0xb0dd('0x4a')])['then'](respondWithResult(_0x4f33ed,0xc9))['catch'](handleError(_0x4f33ed,null));};exports['download']=function(_0x27fcef,_0x387f81,_0xca3c3f){return db[_0xb0dd('0x2c')][_0xb0dd('0x52')]({'where':{'id':_0x27fcef[_0xb0dd('0x44')]['id']},'raw':!![]})[_0xb0dd('0x26')](handleEntityNotFound(_0x387f81,null))[_0xb0dd('0x26')](function(_0x4c18a3){if(_0x4c18a3){var _0x41bc64=_0x4c18a3['ChatOfflineMessageId']!==null;var _0x1b30ed=path[_0xb0dd('0x53')](config[_0xb0dd('0x54')],'server/files/attachments/');if(_0x41bc64){_0x1b30ed=path[_0xb0dd('0x53')](_0x1b30ed,'offline-chat/');}var _0x18bfa9=path['join'](_0x1b30ed,_0x4c18a3[_0xb0dd('0x50')]);return _0x387f81[_0xb0dd('0x55')](_0x18bfa9);}})[_0xb0dd('0x42')](handleError(_0x387f81,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 810f201..fb83db8 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 _0x3a0e=['attachments','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','Attachment'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3a0e,0xcd));var _0xe3a0=function(_0x1b5580,_0x59cf83){_0x1b5580=_0x1b5580-0x0;var _0x1c5c00=_0x3a0e[_0x1b5580];return _0x1c5c00;};'use strict';var _=require(_0xe3a0('0x0'));var util=require(_0xe3a0('0x1'));var logger=require('../../config/logger')(_0xe3a0('0x2'));var moment=require(_0xe3a0('0x3'));var BPromise=require(_0xe3a0('0x4'));var rp=require(_0xe3a0('0x5'));var fs=require('fs');var path=require(_0xe3a0('0x6'));var rimraf=require(_0xe3a0('0x7'));var config=require(_0xe3a0('0x8'));var attributes=require('./attachment.attributes');module[_0xe3a0('0x9')]=function(_0x3648a2,_0x9ff6a2){return _0x3648a2['define'](_0xe3a0('0xa'),attributes,{'tableName':_0xe3a0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf747=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','Attachment'];(function(_0x2c725b,_0x13d632){var _0x5975d1=function(_0x11e028){while(--_0x11e028){_0x2c725b['push'](_0x2c725b['shift']());}};_0x5975d1(++_0x13d632);}(_0xf747,0x1b8));var _0x7f74=function(_0xa5e586,_0x5ba4f8){_0xa5e586=_0xa5e586-0x0;var _0x45f86f=_0xf747[_0xa5e586];return _0x45f86f;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7f74('0x0'))(_0x7f74('0x1'));var moment=require(_0x7f74('0x2'));var BPromise=require(_0x7f74('0x3'));var rp=require(_0x7f74('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7f74('0x5'));var config=require(_0x7f74('0x6'));var attributes=require(_0x7f74('0x7'));module[_0x7f74('0x8')]=function(_0xcda41d,_0x13b560){return _0xcda41d['define'](_0x7f74('0x9'),attributes,{'tableName':'attachments','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 cea44d4..d8b161c 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 _0x8e0d=['CreateAttachment','Attachment','body','options','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','Attachment,\x20%s,\x20%s','debug','stringify','error','message','info','request\x20sent','result','catch'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x8e0d,0x82));var _0xd8e0=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x8e0d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd8e0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd8e0('0x1'));var rs=require(_0xd8e0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8e0('0x3'))['db'];var utils=require(_0xd8e0('0x4'));var logger=require(_0xd8e0('0x5'))(_0xd8e0('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd8e0('0x7')][_0xd8e0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x42d42b,_0x1e4616,_0x5e9735){return new BPromise(function(_0xd0c45c,_0x144a8a){return client[_0xd8e0('0x9')](_0x42d42b,_0x5e9735)[_0xd8e0('0xa')](function(_0x127a32){logger['info'](_0xd8e0('0xb'),_0x1e4616,'request\x20sent');logger[_0xd8e0('0xc')]('Attachment,\x20%s,\x20%s,\x20%s',_0x1e4616,'request\x20sent',JSON[_0xd8e0('0xd')](_0x127a32));if(_0x127a32[_0xd8e0('0xe')]){if(_0x127a32[_0xd8e0('0xe')]['code']===0x1f4){logger['error'](_0xd8e0('0xb'),_0x1e4616,_0x127a32['error'][_0xd8e0('0xf')]);return _0x144a8a(_0x127a32['error']['message']);}logger['error'](_0xd8e0('0xb'),_0x1e4616,_0x127a32['error'][_0xd8e0('0xf')]);return _0xd0c45c(_0x127a32[_0xd8e0('0xe')][_0xd8e0('0xf')]);}else{logger[_0xd8e0('0x10')](_0xd8e0('0xb'),_0x1e4616,_0xd8e0('0x11'));_0xd0c45c(_0x127a32[_0xd8e0('0x12')][_0xd8e0('0xf')]);}})[_0xd8e0('0x13')](function(_0x488ed9){logger[_0xd8e0('0xe')](_0xd8e0('0xb'),_0x1e4616,_0x488ed9);_0x144a8a(_0x488ed9);});});}exports[_0xd8e0('0x14')]=function(_0x42586f){var _0x3b28bc=this;return new Promise(function(_0x2bf195,_0x2c4eaf){return db[_0xd8e0('0x15')]['create'](_0x42586f[_0xd8e0('0x16')],{'raw':_0x42586f[_0xd8e0('0x17')]?_0x42586f['options'][_0xd8e0('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55ce9b){logger['info'](_0xd8e0('0x14'),_0x42586f);logger[_0xd8e0('0xc')]('CreateAttachment',_0x42586f,JSON[_0xd8e0('0xd')](_0x55ce9b));_0x2bf195(_0x55ce9b);})[_0xd8e0('0x13')](function(_0x1d31de){logger[_0xd8e0('0xe')](_0xd8e0('0x14'),_0x1d31de[_0xd8e0('0xf')],_0x42586f);_0x2c4eaf(_0x3b28bc['error'](0x1f4,_0x1d31de[_0xd8e0('0xf')]));});});}; \ No newline at end of file +var _0xb469=['options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','Attachment,\x20%s,\x20%s','debug','request\x20sent','error','message','info','result','CreateAttachment','create','body'];(function(_0x38d0f5,_0x1457c2){var _0x5b91d1=function(_0x28c2dd){while(--_0x28c2dd){_0x38d0f5['push'](_0x38d0f5['shift']());}};_0x5b91d1(++_0x1457c2);}(_0xb469,0x13b));var _0x9b46=function(_0x21fac4,_0x10896e){_0x21fac4=_0x21fac4-0x0;var _0x1a13e3=_0xb469[_0x21fac4];return _0x1a13e3;};'use strict';var _=require(_0x9b46('0x0'));var util=require(_0x9b46('0x1'));var moment=require(_0x9b46('0x2'));var BPromise=require(_0x9b46('0x3'));var rs=require(_0x9b46('0x4'));var fs=require('fs');var Redis=require(_0x9b46('0x5'));var db=require(_0x9b46('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b46('0x7'))(_0x9b46('0x8'));var config=require('../../config/environment');var jayson=require(_0x9b46('0x9'));var client=jayson[_0x9b46('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b2dd3,_0x5bd834,_0x4c1ed9){return new BPromise(function(_0x34c0de,_0x545b6c){return client[_0x9b46('0xb')](_0x1b2dd3,_0x4c1ed9)[_0x9b46('0xc')](function(_0x43a112){logger['info'](_0x9b46('0xd'),_0x5bd834,'request\x20sent');logger[_0x9b46('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x5bd834,_0x9b46('0xf'),JSON['stringify'](_0x43a112));if(_0x43a112[_0x9b46('0x10')]){if(_0x43a112[_0x9b46('0x10')]['code']===0x1f4){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112['error'][_0x9b46('0x11')]);return _0x545b6c(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);return _0x34c0de(_0x43a112[_0x9b46('0x10')][_0x9b46('0x11')]);}else{logger[_0x9b46('0x12')](_0x9b46('0xd'),_0x5bd834,_0x9b46('0xf'));_0x34c0de(_0x43a112[_0x9b46('0x13')]['message']);}})['catch'](function(_0x52c1b8){logger[_0x9b46('0x10')](_0x9b46('0xd'),_0x5bd834,_0x52c1b8);_0x545b6c(_0x52c1b8);});});}exports[_0x9b46('0x14')]=function(_0x5c5cc9){var _0x5dd7bd=this;return new Promise(function(_0x3d9efa,_0x4ccfd0){return db['Attachment'][_0x9b46('0x15')](_0x5c5cc9[_0x9b46('0x16')],{'raw':_0x5c5cc9['options']?_0x5c5cc9[_0x9b46('0x17')][_0x9b46('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x55aece){logger[_0x9b46('0x12')](_0x9b46('0x14'),_0x5c5cc9);logger[_0x9b46('0xe')]('CreateAttachment',_0x5c5cc9,JSON['stringify'](_0x55aece));_0x3d9efa(_0x55aece);})[_0x9b46('0x19')](function(_0x51d2ca){logger[_0x9b46('0x10')](_0x9b46('0x14'),_0x51d2ca['message'],_0x5c5cc9);_0x4ccfd0(_0x5dd7bd[_0x9b46('0x10')](0x1f4,_0x51d2ca['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 9c0d0d0..8c28784 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 _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0x276e04,_0x5cfa86){var _0x44a8d7=function(_0x2622c5){while(--_0x2622c5){_0x276e04['push'](_0x276e04['shift']());}};_0x44a8d7(++_0x5cfa86);}(_0x5f2f,0x73));var _0xf5f2=function(_0x195cf9,_0xea46ec){_0x195cf9=_0x195cf9-0x0;var _0x5ba45e=_0x5f2f[_0x195cf9];return _0x5ba45e;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('0x1f')]=router; \ No newline at end of file +var _0x5f2f=['show','/:id/download','download','post','/:id/clone','clone','root','server/files/attachments/','format','now','originalname','replace','single','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./attachment.controller','get','isAuthenticated','index','/:id'];(function(_0xf33958,_0x28f389){var _0x48b29d=function(_0x915198){while(--_0x915198){_0xf33958['push'](_0xf33958['shift']());}};_0x48b29d(++_0x28f389);}(_0x5f2f,0x73));var _0xf5f2=function(_0x322529,_0x3156c1){_0x322529=_0x322529-0x0;var _0x44d4b5=_0x5f2f[_0x322529];return _0x44d4b5;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x10')](_0xf5f2('0x11'),auth['isAuthenticated'](),controller[_0xf5f2('0x12')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53fb33,_0xa7e1a6,_0x151aba){_0x151aba(null,path['join'](config[_0xf5f2('0x13')],_0xf5f2('0x14')));},'filename':function(_0x331482,_0x3f2997,_0x59bb6c){_0x59bb6c(null,util[_0xf5f2('0x15')]('%s-%s',Date[_0xf5f2('0x16')](),_0x3f2997[_0xf5f2('0x17')][_0xf5f2('0x18')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf5f2('0x10')]('/',upload[_0xf5f2('0x19')]('file'),controller[_0xf5f2('0x1a')]);router[_0xf5f2('0x1b')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1c')]);router[_0xf5f2('0x1d')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x1e')]);module[_0xf5f2('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 b4bcae7..dc58243 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 _0xdacc=['blocked','online','admin','agent','minutes','getLicense','catch','send','message','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','use','User','passport','passport-local','moment','bluebird','util','../../mysqldb','../../config/environment','api','activedirectory','undefined','baseDN','url','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','disabled'];(function(_0x4848d,_0x2f98be){var _0x2d2462=function(_0x2e4d05){while(--_0x2e4d05){_0x4848d['push'](_0x4848d['shift']());}};_0x2d2462(++_0x2f98be);}(_0xdacc,0x1d0));var _0xcdac=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdacc[_0xa464c9];return _0x3d73c4;};'use strict';var passport=require(_0xcdac('0x0'));var LocalStrategy=require(_0xcdac('0x1'))['Strategy'];var moment=require(_0xcdac('0x2'));var ActiveDirectory=require('activedirectory2');var BPromise=require(_0xcdac('0x3'));var util=require(_0xcdac('0x4'));var db=require(_0xcdac('0x5'))['db'];var authService=require('../../components/auth/service');var utils=require('../../config/utils');var config=require(_0xcdac('0x6'));var logger=require('../../config/logger')(_0xcdac('0x7'));function isActiveDirectoryConfigured(_0xbafb23){var _0x253536=![];if(typeof _0xbafb23[_0xcdac('0x8')]!==_0xcdac('0x9')){_0x253536=_0xbafb23['activedirectory'][_0xcdac('0xa')]&&_0xbafb23[_0xcdac('0x8')][_0xcdac('0xb')]&&_0xbafb23[_0xcdac('0x8')]['domain'];}return _0x253536;}function adAuthenticate(_0x79c30a,_0x50ec79,_0x44a0af){return new BPromise(function(_0x5a2556,_0x2c761a){try{var _0x462acd=new ActiveDirectory(_0x79c30a);_0x462acd[_0xcdac('0xc')](_0x50ec79,_0x44a0af,function(_0x221435,_0x3b364c){if(_0x221435){logger[_0xcdac('0xd')](_0xcdac('0xe'),_0x50ec79,util[_0xcdac('0xf')](_0x221435,{'showHidden':![],'depth':null}));_0x2c761a(_0xcdac('0x10'));}else if(!_0x3b364c){logger[_0xcdac('0xd')](_0xcdac('0x11'),_0x50ec79);_0x2c761a(_0xcdac('0x10'));}else{_0x5a2556(_0x3b364c);}});}catch(_0x1b18f4){_0x2c761a(_0x1b18f4);}});}function ActiveDirectoryAuthenticate(_0x479128,_0x5a070f,_0x322e23,_0x4d78c2){var _0x138d77,_0x5e56e7;if(!isActiveDirectoryConfigured(config)){logger[_0xcdac('0xd')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x5a070f);return _0x4d78c2(null,![],{'message':_0xcdac('0x10')});}return db[_0xcdac('0x12')][_0xcdac('0x13')]({'where':{'id':0x1},'attributes':[_0xcdac('0x14'),_0xcdac('0x15')],'raw':!![]})[_0xcdac('0x16')](function(_0xd2c7a8){_0x138d77=_0xd2c7a8;if(!_0x138d77[_0xcdac('0x14')]){logger[_0xcdac('0xd')](_0xcdac('0x17'),_0x5a070f);throw new Error(_0xcdac('0x10'));}return _0x479128[_0xcdac('0x13')]({'attributes':['id',_0xcdac('0x18'),_0xcdac('0x19'),_0xcdac('0x1a'),'role',_0xcdac('0x1b'),_0xcdac('0x1c'),'blockedAt',_0xcdac('0x1d')],'where':{'name':_0x5a070f,'role':{'$or':[_0xcdac('0x1e'),'user',_0xcdac('0x1f')]},'adSsoEnabled':!![]}});})['then'](function(_0x3504a7){if(!_0x3504a7||_0x3504a7&&_0x3504a7['name']!==_0x5a070f){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x5e56e7=_0x3504a7;var _0x3dee9a=_0x5e56e7['name']+'@'+config[_0xcdac('0x8')]['domain'];return adAuthenticate(config[_0xcdac('0x8')],_0x3dee9a,_0x322e23);})['then'](function(_0x26ec94){if(_0x5e56e7[_0xcdac('0x1b')]){throw new Error(_0xcdac('0x10'));}if(_0x138d77['blockDuration']>0x0){if(_0x5e56e7[_0xcdac('0x1c')]){if(moment(_0x5e56e7['blockedAt'])['add'](_0x138d77[_0xcdac('0x15')],_0xcdac('0x20'))>moment()){throw new Error(_0xcdac('0x10'));}return utils['clearBlockUser'](_0x5e56e7,0x0,![],null)[_0xcdac('0x16')](function(){return utils[_0xcdac('0x21')](_0x5e56e7);})['then'](function(){return _0x4d78c2(null,_0x5e56e7);});}else{return utils[_0xcdac('0x21')](_0x5e56e7)[_0xcdac('0x16')](function(){return _0x4d78c2(null,_0x5e56e7);});}}else{return utils['getLicense'](_0x5e56e7)['then'](function(){return _0x4d78c2(null,_0x5e56e7);});}})[_0xcdac('0x22')](function(_0x3b7d9b){return _0x4d78c2(null,![],_0x3b7d9b);});}function handleError(_0x1dbcc9,_0xe6997,_0x1b8542){return _0x1dbcc9['status'](_0xe6997||0x1f4)[_0xcdac('0x23')]({'message':_0x1b8542?_0x1b8542[_0xcdac('0x24')]||_0x1b8542:''});}exports['login']=function(_0x504b54,_0x52aecf,_0x3449f2){passport[_0xcdac('0xc')](_0xcdac('0x25'),function(_0x1f5da6,_0x1c060b,_0x19c3ff){var _0x4cddab=_0x1f5da6||_0x19c3ff;if(_0x4cddab){return handleError(_0x52aecf,0x191,_0x4cddab);}if(!_0x1c060b){return handleError(_0x52aecf,0x194,{'message':_0xcdac('0x26')});}else{var _0x173e19={'payload':{'id':_0x1c060b['id'],'role':_0x1c060b['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x173e19)[_0xcdac('0x16')](function(_0x579fb7){_0x52aecf['json']({'id':_0x1c060b['id'],'token':_0x579fb7,'statusCall':'','isAlreadyLogged':_0x1c060b[_0xcdac('0x1d')]});});}})(_0x504b54,_0x52aecf,_0x3449f2);};passport[_0xcdac('0x27')](_0xcdac('0x25'),new LocalStrategy({'usernameField':'name','passwordField':_0xcdac('0x19')},function(_0x3ccb74,_0xc009b1,_0x8d765a){return ActiveDirectoryAuthenticate(db[_0xcdac('0x28')],_0x3ccb74,_0xc009b1,_0x8d765a);})); \ No newline at end of file +var _0xc986=['use','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../mysqldb','../../components/auth/service','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','error','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Setting','adSsoEnabled','blockDuration','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','disabled','blocked','blockedAt','online','admin','user','agent','domain','then','add','minutes','clearBlockUser','getLicense','catch','status','login','authenticate','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc986,0xce));var _0x6c98=function(_0x4311cb,_0x31de6e){_0x4311cb=_0x4311cb-0x0;var _0x24e041=_0xc986[_0x4311cb];return _0x24e041;};'use strict';var passport=require(_0x6c98('0x0'));var LocalStrategy=require(_0x6c98('0x1'))[_0x6c98('0x2')];var moment=require(_0x6c98('0x3'));var ActiveDirectory=require(_0x6c98('0x4'));var BPromise=require(_0x6c98('0x5'));var util=require(_0x6c98('0x6'));var db=require(_0x6c98('0x7'))['db'];var authService=require(_0x6c98('0x8'));var utils=require('../../config/utils');var config=require(_0x6c98('0x9'));var logger=require(_0x6c98('0xa'))(_0x6c98('0xb'));function isActiveDirectoryConfigured(_0x36212f){var _0x22f884=![];if(typeof _0x36212f[_0x6c98('0xc')]!==_0x6c98('0xd')){_0x22f884=_0x36212f[_0x6c98('0xc')][_0x6c98('0xe')]&&_0x36212f['activedirectory'][_0x6c98('0xf')]&&_0x36212f[_0x6c98('0xc')]['domain'];}return _0x22f884;}function adAuthenticate(_0x375764,_0x49d6f6,_0x2a10ab){return new BPromise(function(_0x5613ab,_0x434fa5){try{var _0x1f0e55=new ActiveDirectory(_0x375764);_0x1f0e55['authenticate'](_0x49d6f6,_0x2a10ab,function(_0x5901d1,_0x3a1eac){if(_0x5901d1){logger[_0x6c98('0x10')]('Error\x20authenticate\x20%s:\x20%s',_0x49d6f6,util['inspect'](_0x5901d1,{'showHidden':![],'depth':null}));_0x434fa5(_0x6c98('0x11'));}else if(!_0x3a1eac){logger['error']('Error\x20authenticate\x20%s:\x20Wrong\x20credentials',_0x49d6f6);_0x434fa5('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x5613ab(_0x3a1eac);}});}catch(_0x39d8b1){_0x434fa5(_0x39d8b1);}});}function ActiveDirectoryAuthenticate(_0x5e5af4,_0x1c9b6d,_0x29f04c,_0x56981c){var _0x400deb,_0x21f790;if(!isActiveDirectoryConfigured(config)){logger['error'](_0x6c98('0x12'),_0x1c9b6d);return _0x56981c(null,![],{'message':_0x6c98('0x11')});}return db[_0x6c98('0x13')]['findOne']({'where':{'id':0x1},'attributes':[_0x6c98('0x14'),_0x6c98('0x15')],'raw':!![]})['then'](function(_0x1a5f29){_0x400deb=_0x1a5f29;if(!_0x400deb[_0x6c98('0x14')]){logger[_0x6c98('0x10')](_0x6c98('0x16'),_0x1c9b6d);throw new Error(_0x6c98('0x11'));}return _0x5e5af4[_0x6c98('0x17')]({'attributes':['id',_0x6c98('0x18'),_0x6c98('0x19'),_0x6c98('0x1a'),_0x6c98('0x1b'),_0x6c98('0x1c'),_0x6c98('0x1d'),_0x6c98('0x1e'),_0x6c98('0x1f')],'where':{'name':_0x1c9b6d,'role':{'$or':[_0x6c98('0x20'),_0x6c98('0x21'),_0x6c98('0x22')]},'adSsoEnabled':!![]}});})['then'](function(_0x4b41c2){if(!_0x4b41c2||_0x4b41c2&&_0x4b41c2[_0x6c98('0x18')]!==_0x1c9b6d){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}_0x21f790=_0x4b41c2;var _0x432734=_0x21f790['name']+'@'+config['activedirectory'][_0x6c98('0x23')];return adAuthenticate(config[_0x6c98('0xc')],_0x432734,_0x29f04c);})[_0x6c98('0x24')](function(_0x2e92aa){if(_0x21f790['disabled']){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}if(_0x400deb[_0x6c98('0x15')]>0x0){if(_0x21f790[_0x6c98('0x1d')]){if(moment(_0x21f790[_0x6c98('0x1e')])[_0x6c98('0x25')](_0x400deb['blockDuration'],_0x6c98('0x26'))>moment()){throw new Error(_0x6c98('0x11'));}return utils[_0x6c98('0x27')](_0x21f790,0x0,![],null)['then'](function(){return utils['getLicense'](_0x21f790);})[_0x6c98('0x24')](function(){return _0x56981c(null,_0x21f790);});}else{return utils[_0x6c98('0x28')](_0x21f790)[_0x6c98('0x24')](function(){return _0x56981c(null,_0x21f790);});}}else{return utils[_0x6c98('0x28')](_0x21f790)[_0x6c98('0x24')](function(){return _0x56981c(null,_0x21f790);});}})[_0x6c98('0x29')](function(_0x3ee555){return _0x56981c(null,![],_0x3ee555);});}function handleError(_0x2a9655,_0x18887c,_0x5f0706){return _0x2a9655[_0x6c98('0x2a')](_0x18887c||0x1f4)['send']({'message':_0x5f0706?_0x5f0706['message']||_0x5f0706:''});}exports[_0x6c98('0x2b')]=function(_0x27ea10,_0x2713c1,_0x5da8b2){passport[_0x6c98('0x2c')](_0x6c98('0x2d'),function(_0x56cb73,_0x219906,_0xe21e03){var _0x37d031=_0x56cb73||_0xe21e03;if(_0x37d031){return handleError(_0x2713c1,0x191,_0x37d031);}if(!_0x219906){return handleError(_0x2713c1,0x194,{'message':_0x6c98('0x2e')});}else{var _0x371364={'payload':{'id':_0x219906['id'],'role':_0x219906[_0x6c98('0x1b')]},'options':{'expiresIn':0x15180}};return authService[_0x6c98('0x2f')](_0x371364)[_0x6c98('0x24')](function(_0xe7dd02){_0x2713c1[_0x6c98('0x30')]({'id':_0x219906['id'],'token':_0xe7dd02,'statusCall':'','isAlreadyLogged':_0x219906[_0x6c98('0x1f')]});});}})(_0x27ea10,_0x2713c1,_0x5da8b2);};passport[_0x6c98('0x31')](_0x6c98('0x2d'),new LocalStrategy({'usernameField':_0x6c98('0x18'),'passwordField':_0x6c98('0x19')},function(_0x5419b5,_0xfd614d,_0x4e3d94){return ActiveDirectoryAuthenticate(db[_0x6c98('0x32')],_0x5419b5,_0xfd614d,_0x4e3d94);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index 7c71682..df0efb4 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 _0xaa60=['./authActiveDirectory.controller','post','login','exports','express','Router'];(function(_0x491cf8,_0x8b5453){var _0x48a17d=function(_0x2f9eec){while(--_0x2f9eec){_0x491cf8['push'](_0x491cf8['shift']());}};_0x48a17d(++_0x8b5453);}(_0xaa60,0xd0));var _0x0aa6=function(_0x4ecbed,_0x1d672f){_0x4ecbed=_0x4ecbed-0x0;var _0x364b4c=_0xaa60[_0x4ecbed];return _0x364b4c;};'use strict';var express=require(_0x0aa6('0x0'));var router=express[_0x0aa6('0x1')]();var controller=require(_0x0aa6('0x2'));router[_0x0aa6('0x3')]('/',controller[_0x0aa6('0x4')]);module[_0x0aa6('0x5')]=router; \ No newline at end of file +var _0x8c91=['./authActiveDirectory.controller','post','login','express'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0x8c91,0x107));var _0x18c9=function(_0x46a977,_0x51abc2){_0x46a977=_0x46a977-0x0;var _0x43f9d1=_0x8c91[_0x46a977];return _0x43f9d1;};'use strict';var express=require(_0x18c9('0x0'));var router=express['Router']();var controller=require(_0x18c9('0x1'));router[_0x18c9('0x2')]('/',controller[_0x18c9('0x3')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 5d52719..c7032d5 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 _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x7a54,0x106));var _0x47a5=function(_0x5a6955,_0x1d0864){_0x5a6955=_0x5a6955-0x0;var _0x5df2a1=_0x7a54[_0x5a6955];return _0x5df2a1;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ 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(_0x148da8,_0x24f110){var _0xa1d647=function(_0x22951d){while(--_0x22951d){_0x148da8['push'](_0x148da8['shift']());}};_0xa1d647(++_0x24f110);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'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 1f2ef7e..33dc23e 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 _0x12b3=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','exports','express','passport'];(function(_0x5ba714,_0x2bb306){var _0x417277=function(_0x63751d){while(--_0x63751d){_0x5ba714['push'](_0x5ba714['shift']());}};_0x417277(++_0x2bb306);}(_0x12b3,0xf0));var _0x312b=function(_0x1db321,_0x2a3ca7){_0x1db321=_0x1db321-0x0;var _0x53670f=_0x12b3[_0x1db321];return _0x53670f;};'use strict';var express=require(_0x312b('0x0'));var passport=require(_0x312b('0x1'));var router=express['Router']();var controller=require(_0x312b('0x2'));var userController=require(_0x312b('0x3'));var authService=require(_0x312b('0x4'));router[_0x312b('0x5')]('/',controller[_0x312b('0x6')]);router[_0x312b('0x5')](_0x312b('0x7'),controller[_0x312b('0x8')],authService[_0x312b('0x9')],userController[_0x312b('0x6')],authService['setTokenCookie']);module[_0x312b('0xa')]=router; \ No newline at end of file +var _0xd2bb=['callback','isMiddleware','setTokenCookie','exports','passport','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login'];(function(_0x18fbfd,_0x1f0d8a){var _0xc546bc=function(_0xff0b28){while(--_0xff0b28){_0x18fbfd['push'](_0x18fbfd['shift']());}};_0xc546bc(++_0x1f0d8a);}(_0xd2bb,0x9a));var _0xbd2b=function(_0x54362f,_0x58cef5){_0x54362f=_0x54362f-0x0;var _0x58d5f6=_0xd2bb[_0x54362f];return _0x58d5f6;};'use strict';var express=require('express');var passport=require(_0xbd2b('0x0'));var router=express['Router']();var controller=require(_0xbd2b('0x1'));var userController=require(_0xbd2b('0x2'));var authService=require(_0xbd2b('0x3'));router[_0xbd2b('0x4')]('/',controller[_0xbd2b('0x5')]);router[_0xbd2b('0x4')]('/callback',controller[_0xbd2b('0x6')],authService[_0xbd2b('0x7')],userController[_0xbd2b('0x5')],authService[_0xbd2b('0x8')]);module[_0xbd2b('0x9')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 5dfbc20..2dcfc34 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 _0x64e6=['../../config/utils','client','http','Setting','allowedLoginAttempts','findOne','name','password','salt','blocked','blockedAt','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','then','authenticate','loginAttempts','disabled','blockDuration','add','clearBlockUser','minutes','getLicense','catch','MailAccount','email','MailServerOut','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','merge','format','\x22%s\x22\x20<%s>','Smtp','user','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','Email\x20parameter\x20is\x20missing','generate','body','trim','User','find','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','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','https://','host','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','Password\x20reset!','use','passport','Strategy','jayson/promise','randomstring','moment','../../mysqldb','../../components/auth/service'];(function(_0x46e208,_0x95cd01){var _0x466942=function(_0x13ad96){while(--_0x13ad96){_0x46e208['push'](_0x46e208['shift']());}};_0x466942(++_0x95cd01);}(_0x64e6,0x1e5));var _0x664e=function(_0x34a3fc,_0x3577eb){_0x34a3fc=_0x34a3fc-0x0;var _0x322531=_0x64e6[_0x34a3fc];return _0x322531;};'use strict';var util=require('util');var passport=require(_0x664e('0x0'));var LocalStrategy=require('passport-local')[_0x664e('0x1')];var jayson=require(_0x664e('0x2'));var _=require('lodash');var rs=require(_0x664e('0x3'));var moment=require(_0x664e('0x4'));var db=require(_0x664e('0x5'))['db'];var authService=require(_0x664e('0x6'));var utils=require(_0x664e('0x7'));var client=jayson[_0x664e('0x8')][_0x664e('0x9')]({'port':0x232b});function localAuthenticate(_0x41daa9,_0x8f9308,_0x566799,_0x39bf10){var _0x289581,_0x591fd7;return db[_0x664e('0xa')]['findOne']({'where':{'id':0x1},'attributes':[_0x664e('0xb'),'blockDuration'],'raw':!![]})['then'](function(_0x1fe3ac){_0x289581=_0x1fe3ac;return _0x41daa9[_0x664e('0xc')]({'attributes':['id',_0x664e('0xd'),_0x664e('0xe'),_0x664e('0xf'),'role','disabled',_0x664e('0x10'),_0x664e('0x11'),'loginAttempts'],'where':{'name':_0x8f9308,'role':{'$or':[_0x664e('0x12'),'user',_0x664e('0x13')]}}});})['then'](function(_0x5cfa11){if(!_0x5cfa11||_0x5cfa11&&_0x5cfa11[_0x664e('0xd')]!==_0x8f9308){throw new Error(_0x664e('0x14'));}else{_0x591fd7=_0x5cfa11;return _0x591fd7;}})[_0x664e('0x15')](function(){_0x591fd7[_0x664e('0x16')](_0x566799,function(_0x1a10f3,_0x3c2d53){var _0x4bfacc=_0x591fd7[_0x664e('0x17')]+0x1;if(_0x1a10f3){return _0x39bf10(_0x1a10f3);}else if(!_0x3c2d53){if(_0x591fd7[_0x664e('0x18')]){return _0x39bf10(null,![],{'message':_0x664e('0x14')});}else if(_0x289581[_0x664e('0xb')]>0x0){if(_0x591fd7[_0x664e('0x10')]){if(_0x289581[_0x664e('0x19')]>0x0){if(moment(_0x591fd7[_0x664e('0x11')])[_0x664e('0x1a')](_0x289581[_0x664e('0x19')],'minutes')>moment()){return _0x39bf10(null,![],{'message':_0x664e('0x14')});}else{return utils['clearBlockUser'](_0x591fd7,_0x4bfacc,![],null)['then'](function(){return _0x39bf10(null,![],{'message':_0x664e('0x14')});});}}else{return _0x39bf10(null,![],{'message':_0x664e('0x14')});}}else{if(_0x4bfacc>=_0x289581[_0x664e('0xb')]){return utils['clearBlockUser'](_0x591fd7,0x0,!![],moment())[_0x664e('0x15')](function(){return _0x39bf10(null,![],{'message':_0x664e('0x14')});});}else{return utils[_0x664e('0x1b')](_0x591fd7,_0x4bfacc,![],null)[_0x664e('0x15')](function(){return _0x39bf10(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x39bf10(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x591fd7[_0x664e('0x18')]){return _0x39bf10(null,![],{'message':_0x664e('0x14')});}else if(_0x289581[_0x664e('0xb')]>0x0){if(_0x591fd7[_0x664e('0x10')]){if(_0x289581[_0x664e('0x19')]>0x0){if(moment(_0x591fd7[_0x664e('0x11')])[_0x664e('0x1a')](_0x289581[_0x664e('0x19')],_0x664e('0x1c'))>moment()){return _0x39bf10(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x664e('0x1b')](_0x591fd7,0x0,![],null)[_0x664e('0x15')](function(){return utils[_0x664e('0x1d')](_0x591fd7);})[_0x664e('0x15')](function(){return _0x39bf10(null,_0x591fd7);});}}else{return _0x39bf10(null,![],{'message':_0x664e('0x14')});}}else{return utils[_0x664e('0x1b')](_0x591fd7,0x0,![],null)[_0x664e('0x15')](function(){return utils[_0x664e('0x1d')](_0x591fd7);})['then'](function(){return _0x39bf10(null,_0x591fd7);})[_0x664e('0x1e')](function(_0x4f56b0){return _0x39bf10(null,![],_0x4f56b0);});}}else{if(_0x591fd7[_0x664e('0x10')]){return _0x39bf10(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils[_0x664e('0x1d')](_0x591fd7)['then'](function(){return _0x39bf10(null,_0x591fd7);});}}}});})[_0x664e('0x1e')](function(_0x399278){return _0x39bf10(null,![],_0x399278);});}function sendServiceMail(_0x589fb1){return db[_0x664e('0x1f')]['find']({'where':{'service':!![]},'attributes':['id',_0x664e('0xd'),_0x664e('0x20')],'include':[{'model':db[_0x664e('0x21')],'as':'Smtp','include':[{'model':db[_0x664e('0x22')],'as':_0x664e('0x22')}]}]})[_0x664e('0x15')](function(_0x1d7c56){if(!_0x1d7c56){throw new Error(_0x664e('0x23'));}var _0x4a258f=_0x1d7c56[_0x664e('0x24')]();var _0xbe582b={'account':_0x4a258f,'message':_[_0x664e('0x25')]({'from':util[_0x664e('0x26')](_0x664e('0x27'),_0x1d7c56[_0x664e('0xd')],_0x1d7c56['email']||_0x1d7c56[_0x664e('0x28')][_0x664e('0x29')])},_0x589fb1)};return client[_0x664e('0x2a')](_0x664e('0x2b'),_0xbe582b);})[_0x664e('0x15')](function(_0x35cd6f){if(_0x35cd6f[_0x664e('0x2c')]){throw new Error(util[_0x664e('0x26')](_0x664e('0x2d'),_0x35cd6f[_0x664e('0x2c')][_0x664e('0x2e')]||JSON[_0x664e('0x2f')](_0x35cd6f[_0x664e('0x2c')])));}return!![];});}function handleError(_0x4adc9d,_0x569a6d,_0xb2bd2){return _0x4adc9d[_0x664e('0x30')](_0x569a6d||0x1f4)[_0x664e('0x31')]({'message':_0xb2bd2?_0xb2bd2[_0x664e('0x2e')]||_0xb2bd2:''});}exports[_0x664e('0x32')]=function(_0x216130,_0x5e02a1,_0x3b5a00){passport[_0x664e('0x16')](_0x664e('0x33'),function(_0x58bd05,_0x5d8305,_0x1665c3){var _0x55f15c=_0x58bd05||_0x1665c3;if(_0x55f15c){return handleError(_0x5e02a1,0x191,_0x55f15c);}if(!_0x5d8305){return handleError(_0x5e02a1,0x194,{'message':_0x664e('0x34')});}else{var _0x4d5d14={'payload':{'id':_0x5d8305['id'],'role':_0x5d8305['role']},'options':{'expiresIn':0x15180}};return authService[_0x664e('0x35')](_0x4d5d14)[_0x664e('0x15')](function(_0x5891b9){_0x5e02a1[_0x664e('0x36')]({'id':_0x5d8305['id'],'token':_0x5891b9,'statusCall':'','isAlreadyLogged':_0x5d8305['online']});});}})(_0x216130,_0x5e02a1,_0x3b5a00);};exports['forgot']=function(_0x5165f9,_0x2fcd07){if(!_0x5165f9['body']['email']){return handleError(_0x2fcd07,0x1f4,{'message':_0x664e('0x37')});}var _0x39e2c1=rs[_0x664e('0x38')]();_0x5165f9['body'][_0x664e('0x20')]=_0x5165f9[_0x664e('0x39')][_0x664e('0x20')][_0x664e('0x3a')]()['toLowerCase']();var _0x4484b2;return db[_0x664e('0xa')][_0x664e('0xc')]({'where':{'id':0x1},'attributes':[_0x664e('0xb'),'blockDuration'],'raw':!![]})[_0x664e('0x15')](function(_0x122f49){_0x4484b2=_0x122f49;return db[_0x664e('0x3b')][_0x664e('0x3c')]({'where':{'email':_0x5165f9['body'][_0x664e('0x20')]}});})[_0x664e('0x15')](function(_0x575e33){if(!_0x575e33){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x575e33['disabled']){throw new Error(_0x664e('0x3d'));}if(_0x575e33[_0x664e('0x10')]){if(moment(_0x575e33[_0x664e('0x11')])[_0x664e('0x1a')](_0x4484b2[_0x664e('0x19')],_0x664e('0x1c'))>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x575e33[_0x664e('0x10')]=![];_0x575e33[_0x664e('0x11')]=null;}}_0x575e33[_0x664e('0x3e')]=_0x39e2c1;_0x575e33[_0x664e('0x3f')]=Date['now']()+0x36ee80;return _0x575e33[_0x664e('0x40')]();})[_0x664e('0x15')](function(){return sendServiceMail({'to':_0x5165f9[_0x664e('0x39')][_0x664e('0x20')],'subject':_0x664e('0x41'),'text':_0x664e('0x42')+_0x664e('0x43')+_0x664e('0x44')+_0x5165f9['headers'][_0x664e('0x45')]+'/reset/'+_0x39e2c1+'\x0a\x0a'+_0x664e('0x46')});})[_0x664e('0x15')](function(){_0x2fcd07['status'](0xc8)[_0x664e('0x31')]({'message':'Reset\x20Email\x20sent!'});})[_0x664e('0x1e')](function(_0x37485d){return handleError(_0x2fcd07,0x1f4,_0x37485d);});};exports[_0x664e('0x47')]=function(_0x2914ba,_0x15380c){return db[_0x664e('0x3b')][_0x664e('0x3c')]({'where':{'resetPasswordToken':_0x2914ba[_0x664e('0x48')]['token'],'resetPasswordExpires':{'$gt':Date[_0x664e('0x49')]()}}})[_0x664e('0x15')](function(_0x218752){if(!_0x218752){throw new Error(_0x664e('0x4a'));}return db[_0x664e('0xa')][_0x664e('0xc')]({'attributes':['id',_0x664e('0x4b'),_0x664e('0x4c'),'passwordHistoryLimit']})[_0x664e('0x15')](function(_0xc3574a){if(_0xc3574a[_0x664e('0x4b')])authService['validatePasswordPattern'](_0x2914ba[_0x664e('0x39')][_0x664e('0xe')]);if(!_0xc3574a[_0x664e('0x4c')]||!_0x218752[_0x664e('0x4d')])return _0x218752;authService[_0x664e('0x4e')](_0x2914ba[_0x664e('0x39')][_0x664e('0xe')],_0x218752[_0x664e('0x4d')],_0xc3574a[_0x664e('0x4f')]);return _0x218752;})[_0x664e('0x15')](function(){_0x218752[_0x664e('0xe')]=_0x2914ba[_0x664e('0x39')]['password'];_0x218752[_0x664e('0x3e')]=null;_0x218752['resetPasswordExpires']=null;return _0x218752[_0x664e('0x40')]();});})[_0x664e('0x15')](function(){_0x15380c[_0x664e('0x30')](0xc8)[_0x664e('0x31')]({'message':_0x664e('0x50')});})[_0x664e('0x1e')](function(_0x45849c){return handleError(_0x15380c,0x1f4,_0x45849c);});};passport[_0x664e('0x51')]('local-login',new LocalStrategy({'usernameField':'name','passwordField':_0x664e('0xe')},function(_0x248b42,_0x1d2a47,_0x5a3dfd){return localAuthenticate(db['User'],_0x248b42,_0x1d2a47,_0x5a3dfd);})); \ No newline at end of file +var _0xd268=['salt','disabled','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blocked','add','minutes','clearBlockUser','getLicense','catch','MailAccount','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','\x22%s\x22\x20<%s>','request','SendMail','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','error','status','send','login','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','role','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','find','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','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','https://','host','/reset/','Reset\x20Email\x20sent!','reset','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','moment','../../mysqldb','../../components/auth/service','../../config/utils','client','http','Setting','allowedLoginAttempts','blockDuration','then','findOne','name','password'];(function(_0x25751d,_0x424de6){var _0x2ce2e4=function(_0x2d36d3){while(--_0x2d36d3){_0x25751d['push'](_0x25751d['shift']());}};_0x2ce2e4(++_0x424de6);}(_0xd268,0xf6));var _0x8d26=function(_0x3306f3,_0x18e885){_0x3306f3=_0x3306f3-0x0;var _0x3424c=_0xd268[_0x3306f3];return _0x3424c;};'use strict';var util=require(_0x8d26('0x0'));var passport=require(_0x8d26('0x1'));var LocalStrategy=require(_0x8d26('0x2'))[_0x8d26('0x3')];var jayson=require(_0x8d26('0x4'));var _=require('lodash');var rs=require('randomstring');var moment=require(_0x8d26('0x5'));var db=require(_0x8d26('0x6'))['db'];var authService=require(_0x8d26('0x7'));var utils=require(_0x8d26('0x8'));var client=jayson[_0x8d26('0x9')][_0x8d26('0xa')]({'port':0x232b});function localAuthenticate(_0xf007ff,_0xa2a925,_0x4f7875,_0x3f73f4){var _0x38a036,_0x5a076b;return db[_0x8d26('0xb')]['findOne']({'where':{'id':0x1},'attributes':[_0x8d26('0xc'),_0x8d26('0xd')],'raw':!![]})[_0x8d26('0xe')](function(_0x1a7a63){_0x38a036=_0x1a7a63;return _0xf007ff[_0x8d26('0xf')]({'attributes':['id',_0x8d26('0x10'),_0x8d26('0x11'),_0x8d26('0x12'),'role',_0x8d26('0x13'),'blocked',_0x8d26('0x14'),_0x8d26('0x15')],'where':{'name':_0xa2a925,'role':{'$or':[_0x8d26('0x16'),_0x8d26('0x17'),_0x8d26('0x18')]}}});})[_0x8d26('0xe')](function(_0x35c4c4){if(!_0x35c4c4||_0x35c4c4&&_0x35c4c4[_0x8d26('0x10')]!==_0xa2a925){throw new Error(_0x8d26('0x19'));}else{_0x5a076b=_0x35c4c4;return _0x5a076b;}})[_0x8d26('0xe')](function(){_0x5a076b[_0x8d26('0x1a')](_0x4f7875,function(_0x2eba40,_0x1a9e60){var _0x1a338e=_0x5a076b[_0x8d26('0x15')]+0x1;if(_0x2eba40){return _0x3f73f4(_0x2eba40);}else if(!_0x1a9e60){if(_0x5a076b[_0x8d26('0x13')]){return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});}else if(_0x38a036[_0x8d26('0xc')]>0x0){if(_0x5a076b[_0x8d26('0x1b')]){if(_0x38a036['blockDuration']>0x0){if(moment(_0x5a076b[_0x8d26('0x14')])[_0x8d26('0x1c')](_0x38a036['blockDuration'],_0x8d26('0x1d'))>moment()){return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});}else{return utils[_0x8d26('0x1e')](_0x5a076b,_0x1a338e,![],null)['then'](function(){return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});});}}else{return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});}}else{if(_0x1a338e>=_0x38a036[_0x8d26('0xc')]){return utils[_0x8d26('0x1e')](_0x5a076b,0x0,!![],moment())[_0x8d26('0xe')](function(){return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});});}else{return utils[_0x8d26('0x1e')](_0x5a076b,_0x1a338e,![],null)[_0x8d26('0xe')](function(){return _0x3f73f4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});}}else{if(_0x5a076b[_0x8d26('0x13')]){return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});}else if(_0x38a036['allowedLoginAttempts']>0x0){if(_0x5a076b[_0x8d26('0x1b')]){if(_0x38a036[_0x8d26('0xd')]>0x0){if(moment(_0x5a076b[_0x8d26('0x14')])[_0x8d26('0x1c')](_0x38a036[_0x8d26('0xd')],_0x8d26('0x1d'))>moment()){return _0x3f73f4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x5a076b,0x0,![],null)[_0x8d26('0xe')](function(){return utils[_0x8d26('0x1f')](_0x5a076b);})[_0x8d26('0xe')](function(){return _0x3f73f4(null,_0x5a076b);});}}else{return _0x3f73f4(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils[_0x8d26('0x1e')](_0x5a076b,0x0,![],null)[_0x8d26('0xe')](function(){return utils['getLicense'](_0x5a076b);})['then'](function(){return _0x3f73f4(null,_0x5a076b);})[_0x8d26('0x20')](function(_0x27aa72){return _0x3f73f4(null,![],_0x27aa72);});}}else{if(_0x5a076b['blocked']){return _0x3f73f4(null,![],{'message':_0x8d26('0x19')});}else{return utils[_0x8d26('0x1f')](_0x5a076b)[_0x8d26('0xe')](function(){return _0x3f73f4(null,_0x5a076b);});}}}});})[_0x8d26('0x20')](function(_0x342f4a){return _0x3f73f4(null,![],_0x342f4a);});}function sendServiceMail(_0x1869ff){return db[_0x8d26('0x21')]['find']({'where':{'service':!![]},'attributes':['id',_0x8d26('0x10'),_0x8d26('0x22')],'include':[{'model':db[_0x8d26('0x23')],'as':_0x8d26('0x24'),'include':[{'model':db[_0x8d26('0x25')],'as':_0x8d26('0x25')}]}]})[_0x8d26('0xe')](function(_0x309bb9){if(!_0x309bb9){throw new Error(_0x8d26('0x26'));}var _0x53654b=_0x309bb9[_0x8d26('0x27')]();var _0x16b6e8={'account':_0x53654b,'message':_['merge']({'from':util[_0x8d26('0x28')](_0x8d26('0x29'),_0x309bb9['name'],_0x309bb9[_0x8d26('0x22')]||_0x309bb9[_0x8d26('0x24')][_0x8d26('0x17')])},_0x1869ff)};return client[_0x8d26('0x2a')](_0x8d26('0x2b'),_0x16b6e8);})[_0x8d26('0xe')](function(_0x6ee775){if(_0x6ee775['error']){throw new Error(util[_0x8d26('0x28')](_0x8d26('0x2c'),_0x6ee775['error'][_0x8d26('0x2d')]||JSON[_0x8d26('0x2e')](_0x6ee775[_0x8d26('0x2f')])));}return!![];});}function handleError(_0x5730df,_0x26e2be,_0xca0756){return _0x5730df[_0x8d26('0x30')](_0x26e2be||0x1f4)[_0x8d26('0x31')]({'message':_0xca0756?_0xca0756[_0x8d26('0x2d')]||_0xca0756:''});}exports[_0x8d26('0x32')]=function(_0x407eb1,_0x204405,_0x58f412){passport[_0x8d26('0x1a')](_0x8d26('0x33'),function(_0x19582a,_0x5b53d9,_0x12f2e0){var _0x43aba6=_0x19582a||_0x12f2e0;if(_0x43aba6){return handleError(_0x204405,0x191,_0x43aba6);}if(!_0x5b53d9){return handleError(_0x204405,0x194,{'message':_0x8d26('0x34')});}else{var _0x1b738e={'payload':{'id':_0x5b53d9['id'],'role':_0x5b53d9[_0x8d26('0x35')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x1b738e)['then'](function(_0x22a351){_0x204405[_0x8d26('0x36')]({'id':_0x5b53d9['id'],'token':_0x22a351,'statusCall':'','isAlreadyLogged':_0x5b53d9[_0x8d26('0x37')]});});}})(_0x407eb1,_0x204405,_0x58f412);};exports[_0x8d26('0x38')]=function(_0x539bb6,_0x309bcc){if(!_0x539bb6[_0x8d26('0x39')][_0x8d26('0x22')]){return handleError(_0x309bcc,0x1f4,{'message':_0x8d26('0x3a')});}var _0x2d392b=rs[_0x8d26('0x3b')]();_0x539bb6['body'][_0x8d26('0x22')]=_0x539bb6['body'][_0x8d26('0x22')][_0x8d26('0x3c')]()[_0x8d26('0x3d')]();var _0x55290c;return db[_0x8d26('0xb')][_0x8d26('0xf')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts','blockDuration'],'raw':!![]})[_0x8d26('0xe')](function(_0x44599c){_0x55290c=_0x44599c;return db[_0x8d26('0x3e')][_0x8d26('0x3f')]({'where':{'email':_0x539bb6[_0x8d26('0x39')][_0x8d26('0x22')]}});})[_0x8d26('0xe')](function(_0x407a61){if(!_0x407a61){throw new Error(_0x8d26('0x40'));}if(_0x407a61[_0x8d26('0x13')]){throw new Error(_0x8d26('0x41'));}if(_0x407a61['blocked']){if(moment(_0x407a61['blockedAt'])[_0x8d26('0x1c')](_0x55290c[_0x8d26('0xd')],'minutes')>moment()){throw new Error(_0x8d26('0x42'));}else{_0x407a61[_0x8d26('0x1b')]=![];_0x407a61[_0x8d26('0x14')]=null;}}_0x407a61[_0x8d26('0x43')]=_0x2d392b;_0x407a61['resetPasswordExpires']=Date[_0x8d26('0x44')]()+0x36ee80;return _0x407a61[_0x8d26('0x45')]();})[_0x8d26('0xe')](function(){return sendServiceMail({'to':_0x539bb6[_0x8d26('0x39')][_0x8d26('0x22')],'subject':_0x8d26('0x46'),'text':_0x8d26('0x47')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0x8d26('0x48')+_0x539bb6['headers'][_0x8d26('0x49')]+_0x8d26('0x4a')+_0x2d392b+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x8d26('0xe')](function(){_0x309bcc[_0x8d26('0x30')](0xc8)[_0x8d26('0x31')]({'message':_0x8d26('0x4b')});})['catch'](function(_0x3878d1){return handleError(_0x309bcc,0x1f4,_0x3878d1);});};exports[_0x8d26('0x4c')]=function(_0x2be56e,_0x386db7){return db[_0x8d26('0x3e')]['find']({'where':{'resetPasswordToken':_0x2be56e[_0x8d26('0x4d')][_0x8d26('0x4e')],'resetPasswordExpires':{'$gt':Date[_0x8d26('0x44')]()}}})[_0x8d26('0xe')](function(_0x5d387b){if(!_0x5d387b){throw new Error(_0x8d26('0x4f'));}return db[_0x8d26('0xb')][_0x8d26('0xf')]({'attributes':['id',_0x8d26('0x50'),_0x8d26('0x51'),_0x8d26('0x52')]})[_0x8d26('0xe')](function(_0x5a145e){if(_0x5a145e[_0x8d26('0x50')])authService[_0x8d26('0x53')](_0x2be56e[_0x8d26('0x39')][_0x8d26('0x11')]);if(!_0x5a145e[_0x8d26('0x51')]||!_0x5d387b['previousPasswords'])return _0x5d387b;authService[_0x8d26('0x54')](_0x2be56e[_0x8d26('0x39')][_0x8d26('0x11')],_0x5d387b['previousPasswords'],_0x5a145e['passwordHistoryLimit']);return _0x5d387b;})[_0x8d26('0xe')](function(){_0x5d387b['password']=_0x2be56e[_0x8d26('0x39')][_0x8d26('0x11')];_0x5d387b['resetPasswordToken']=null;_0x5d387b[_0x8d26('0x55')]=null;return _0x5d387b[_0x8d26('0x45')]();});})[_0x8d26('0xe')](function(){_0x386db7['status'](0xc8)[_0x8d26('0x31')]({'message':_0x8d26('0x56')});})[_0x8d26('0x20')](function(_0x10f08c){return handleError(_0x386db7,0x1f4,_0x10f08c);});};passport[_0x8d26('0x57')](_0x8d26('0x33'),new LocalStrategy({'usernameField':_0x8d26('0x10'),'passwordField':_0x8d26('0x11')},function(_0x1941aa,_0x1fe4d9,_0x1e5cdb){return localAuthenticate(db[_0x8d26('0x3e')],_0x1941aa,_0x1fe4d9,_0x1e5cdb);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 1b5a9c9..d282579 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 _0xdab6=['post','login','/forgot','/reset/:token','reset','express','Router','./authLocal.controller'];(function(_0x10e7ac,_0x4e29d2){var _0x2726da=function(_0x44f6cb){while(--_0x44f6cb){_0x10e7ac['push'](_0x10e7ac['shift']());}};_0x2726da(++_0x4e29d2);}(_0xdab6,0x10d));var _0x6dab=function(_0x47fe98,_0x7d0e8b){_0x47fe98=_0x47fe98-0x0;var _0x53b435=_0xdab6[_0x47fe98];return _0x53b435;};'use strict';var express=require(_0x6dab('0x0'));var router=express[_0x6dab('0x1')]();var controller=require(_0x6dab('0x2'));router[_0x6dab('0x3')]('/',controller[_0x6dab('0x4')]);router[_0x6dab('0x3')](_0x6dab('0x5'),controller['forgot']);router['post'](_0x6dab('0x6'),controller[_0x6dab('0x7')]);module['exports']=router; \ No newline at end of file +var _0xa539=['Router','./authLocal.controller','post','login','forgot','reset','express'];(function(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0xa539,0x1e9));var _0x9a53=function(_0x26befe,_0x4d1ed0){_0x26befe=_0x26befe-0x0;var _0xce4d34=_0xa539[_0x26befe];return _0xce4d34;};'use strict';var express=require(_0x9a53('0x0'));var router=express[_0x9a53('0x1')]();var controller=require(_0x9a53('0x2'));router[_0x9a53('0x3')]('/',controller[_0x9a53('0x4')]);router[_0x9a53('0x3')]('/forgot',controller[_0x9a53('0x5')]);router['post']('/reset/:token',controller[_0x9a53('0x6')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index d13901b..a467096 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 _0x720e=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x466410,_0x523499){var _0x344596=function(_0xbae55b){while(--_0xbae55b){_0x466410['push'](_0x466410['shift']());}};_0x344596(++_0x523499);}(_0x720e,0xde));var _0xe720=function(_0x3ae4bf,_0x554978){_0x3ae4bf=_0x3ae4bf-0x0;var _0x27f7dd=_0x720e[_0x3ae4bf];return _0x27f7dd;};'use strict';var Sequelize=require('sequelize');module[_0xe720('0x0')]={'name':{'type':Sequelize[_0xe720('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xe720('0x1')]},'description':{'type':Sequelize[_0xe720('0x1')]},'status':{'type':Sequelize[_0xe720('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xe720('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x607d=['sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x28726b,_0xf6c945){var _0x3e19c9=function(_0x5505f4){while(--_0x5505f4){_0x28726b['push'](_0x28726b['shift']());}};_0x3e19c9(++_0xf6c945);}(_0x607d,0x159));var _0xd607=function(_0x12e9fe,_0x69b722){_0x12e9fe=_0x12e9fe-0x0;var _0x39ff19=_0x607d[_0x12e9fe];return _0x39ff19;};'use strict';var Sequelize=require(_0xd607('0x0'));module[_0xd607('0x1')]={'name':{'type':Sequelize[_0xd607('0x2')],'allowNull':![]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd607('0x2')]},'status':{'type':Sequelize[_0xd607('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xd607('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 7e63ba6..020b050 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 _0x08eb=['find','create','body','Condition','ids','omit','getConditions','addActions','Action','getActions','findOne','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','path','fs-extra','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','update','then','error','stack','name','send','index','map','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','Automation','findAll','rows','catch','show','params','rawAttributes','include'];(function(_0x2a4a99,_0x64b4a){var _0x1cef2f=function(_0x43beef){while(--_0x43beef){_0x2a4a99['push'](_0x2a4a99['shift']());}};_0x1cef2f(++_0x64b4a);}(_0x08eb,0xa7));var _0xb08e=function(_0x5d931a,_0x498a79){_0x5d931a=_0x5d931a-0x0;var _0x2c570e=_0x08eb[_0x5d931a];return _0x2c570e;};'use strict';var emlformat=require(_0xb08e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb08e('0x1'));var jsonpatch=require(_0xb08e('0x2'));var rp=require(_0xb08e('0x3'));var moment=require('moment');var BPromise=require(_0xb08e('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xb08e('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb08e('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb08e('0x7'));var deskjs=require(_0xb08e('0x8'));var toCsv=require(_0xb08e('0x9'));var querystring=require('querystring');var Papa=require(_0xb08e('0xa'));var Redis=require(_0xb08e('0xb'));var authService=require(_0xb08e('0xc'));var qs=require(_0xb08e('0xd'));var as=require(_0xb08e('0xe'));var hardwareService=require(_0xb08e('0xf'));var logger=require(_0xb08e('0x10'))(_0xb08e('0x11'));var utils=require(_0xb08e('0x12'));var config=require(_0xb08e('0x13'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4e3c11,_0xcf2c6b){_0xcf2c6b=_0xcf2c6b||0xcc;return function(_0x33472){if(_0x33472){return _0x4e3c11[_0xb08e('0x14')](_0xcf2c6b);}return _0x4e3c11[_0xb08e('0x15')](_0xcf2c6b)[_0xb08e('0x16')]();};}function respondWithResult(_0x3f7235,_0x3ee92c){_0x3ee92c=_0x3ee92c||0xc8;return function(_0x39c986){if(_0x39c986){return _0x3f7235[_0xb08e('0x15')](_0x3ee92c)[_0xb08e('0x17')](_0x39c986);}};}function respondWithFilteredResult(_0x2e243f,_0xe03746){return function(_0x1efb3b){if(_0x1efb3b){var _0x2bf7c6=typeof _0xe03746['offset']===_0xb08e('0x18')&&typeof _0xe03746[_0xb08e('0x19')]==='undefined';var _0x9b7e47=_0x1efb3b[_0xb08e('0x1a')];var _0x466b8e=_0x2bf7c6?0x0:_0xe03746[_0xb08e('0x1b')];var _0x9e8fd=_0x2bf7c6?_0x1efb3b[_0xb08e('0x1a')]:_0xe03746[_0xb08e('0x1b')]+_0xe03746[_0xb08e('0x19')];var _0x383211;if(_0x9e8fd>=_0x9b7e47){_0x9e8fd=_0x9b7e47;_0x383211=0xc8;}else{_0x383211=0xce;}_0x2e243f[_0xb08e('0x15')](_0x383211);return _0x2e243f[_0xb08e('0x1c')]('Content-Range',_0x466b8e+'-'+_0x9e8fd+'/'+_0x9b7e47)[_0xb08e('0x17')](_0x1efb3b);}return null;};}function patchUpdates(_0x47b7f6){return function(_0x34fd62){try{jsonpatch[_0xb08e('0x1d')](_0x34fd62,_0x47b7f6,!![]);}catch(_0x4af222){return BPromise[_0xb08e('0x1e')](_0x4af222);}return _0x34fd62[_0xb08e('0x1f')]();};}function saveUpdates(_0x5effa4,_0x473ce0){return function(_0x4bfa77){if(_0x4bfa77){return _0x4bfa77[_0xb08e('0x20')](_0x5effa4)[_0xb08e('0x21')](function(_0x19579e){return _0x19579e;});}return null;};}function removeEntity(_0x1e5a97,_0x5c624b){return function(_0x38ebe2){if(_0x38ebe2){return _0x38ebe2['destroy']()[_0xb08e('0x21')](function(){_0x1e5a97[_0xb08e('0x15')](0xcc)[_0xb08e('0x16')]();});}};}function handleEntityNotFound(_0xaa84f1,_0x1d9932){return function(_0x4d37dc){if(!_0x4d37dc){_0xaa84f1[_0xb08e('0x14')](0x194);}return _0x4d37dc;};}function handleError(_0x4e504e,_0x110620){_0x110620=_0x110620||0x1f4;return function(_0x18be02){logger[_0xb08e('0x22')](_0x18be02[_0xb08e('0x23')]);if(_0x18be02[_0xb08e('0x24')]){delete _0x18be02['name'];}_0x4e504e[_0xb08e('0x15')](_0x110620)[_0xb08e('0x25')](_0x18be02);};}exports[_0xb08e('0x26')]=function(_0x635cff,_0x132651){var _0x21603f={},_0x4f51d5={},_0x1c3bdd={'count':0x0,'rows':[]};var _0x2831c4=_[_0xb08e('0x27')](db['Automation']['rawAttributes'],function(_0x40deb0){return{'name':_0x40deb0['fieldName'],'type':_0x40deb0['type'][_0xb08e('0x28')]};});_0x4f51d5[_0xb08e('0x29')]=_[_0xb08e('0x27')](_0x2831c4,_0xb08e('0x24'));_0x4f51d5[_0xb08e('0x2a')]=_[_0xb08e('0x2b')](_0x635cff['query']);_0x4f51d5['filters']=_[_0xb08e('0x2c')](_0x4f51d5['model'],_0x4f51d5['query']);_0x21603f['attributes']=_[_0xb08e('0x2c')](_0x4f51d5[_0xb08e('0x29')],qs['fields'](_0x635cff[_0xb08e('0x2a')][_0xb08e('0x2d')]));_0x21603f[_0xb08e('0x2e')]=_0x21603f[_0xb08e('0x2e')][_0xb08e('0x2f')]?_0x21603f[_0xb08e('0x2e')]:_0x4f51d5[_0xb08e('0x29')];if(!_0x635cff[_0xb08e('0x2a')][_0xb08e('0x30')](_0xb08e('0x31'))){_0x21603f[_0xb08e('0x19')]=qs['limit'](_0x635cff['query']['limit']);_0x21603f[_0xb08e('0x1b')]=qs[_0xb08e('0x1b')](_0x635cff[_0xb08e('0x2a')][_0xb08e('0x1b')]);}_0x21603f[_0xb08e('0x32')]=qs[_0xb08e('0x33')](_0x635cff['query']['sort']);_0x21603f['where']=qs[_0xb08e('0x34')](_[_0xb08e('0x35')](_0x635cff[_0xb08e('0x2a')],_0x4f51d5[_0xb08e('0x34')]),_0x2831c4);if(_0x635cff[_0xb08e('0x2a')][_0xb08e('0x36')]){_0x21603f[_0xb08e('0x37')]=_[_0xb08e('0x38')](_0x21603f[_0xb08e('0x37')],{'$or':_[_0xb08e('0x27')](_0x2831c4,function(_0x121590){if(_0x121590['type']!=='VIRTUAL'){var _0xbee87a={};_0xbee87a[_0x121590[_0xb08e('0x24')]]={'$like':'%'+_0x635cff['query'][_0xb08e('0x36')]+'%'};return _0xbee87a;}})});}_0x21603f=_[_0xb08e('0x38')]({},_0x21603f,_0x635cff[_0xb08e('0x39')]);var _0x5c03ad={'where':_0x21603f[_0xb08e('0x37')]};return db['Automation'][_0xb08e('0x1a')](_0x5c03ad)[_0xb08e('0x21')](function(_0x154421){_0x1c3bdd['count']=_0x154421;if(_0x635cff['query'][_0xb08e('0x3a')]){_0x21603f['include']=[{'all':!![]}];}return db[_0xb08e('0x3b')][_0xb08e('0x3c')](_0x21603f);})['then'](function(_0xd3ae22){_0x1c3bdd[_0xb08e('0x3d')]=_0xd3ae22;return _0x1c3bdd;})['then'](respondWithFilteredResult(_0x132651,_0x21603f))[_0xb08e('0x3e')](handleError(_0x132651,null));};exports[_0xb08e('0x3f')]=function(_0x3ef421,_0x9b4b97){var _0x12a029={'raw':![],'where':{'id':_0x3ef421[_0xb08e('0x40')]['id']}},_0x3a8a6d={};_0x3a8a6d[_0xb08e('0x29')]=_[_0xb08e('0x2b')](db[_0xb08e('0x3b')][_0xb08e('0x41')]);_0x3a8a6d['query']=_[_0xb08e('0x2b')](_0x3ef421[_0xb08e('0x2a')]);_0x3a8a6d[_0xb08e('0x34')]=_[_0xb08e('0x2c')](_0x3a8a6d[_0xb08e('0x29')],_0x3a8a6d['query']);_0x12a029[_0xb08e('0x2e')]=_[_0xb08e('0x2c')](_0x3a8a6d[_0xb08e('0x29')],qs[_0xb08e('0x2d')](_0x3ef421[_0xb08e('0x2a')][_0xb08e('0x2d')]));_0x12a029[_0xb08e('0x2e')]=_0x12a029[_0xb08e('0x2e')][_0xb08e('0x2f')]?_0x12a029[_0xb08e('0x2e')]:_0x3a8a6d[_0xb08e('0x29')];if(_0x3ef421[_0xb08e('0x2a')][_0xb08e('0x3a')]){_0x12a029[_0xb08e('0x42')]=[{'all':!![]}];}_0x12a029=_[_0xb08e('0x38')]({},_0x12a029,_0x3ef421['options']);return db[_0xb08e('0x3b')][_0xb08e('0x43')](_0x12a029)['then'](handleEntityNotFound(_0x9b4b97,null))['then'](respondWithResult(_0x9b4b97,null))['catch'](handleError(_0x9b4b97,null));};exports[_0xb08e('0x44')]=function(_0x44f206,_0x28ae68){return db[_0xb08e('0x3b')][_0xb08e('0x44')](_0x44f206[_0xb08e('0x45')],{})[_0xb08e('0x21')](respondWithResult(_0x28ae68,0xc9))[_0xb08e('0x3e')](handleError(_0x28ae68,null));};exports['update']=function(_0x5b021f,_0x219f2a){if(_0x5b021f[_0xb08e('0x45')]['id']){delete _0x5b021f[_0xb08e('0x45')]['id'];}return db[_0xb08e('0x3b')]['find']({'where':{'id':_0x5b021f[_0xb08e('0x40')]['id']}})[_0xb08e('0x21')](handleEntityNotFound(_0x219f2a,null))['then'](saveUpdates(_0x5b021f[_0xb08e('0x45')],null))['then'](respondWithResult(_0x219f2a,null))[_0xb08e('0x3e')](handleError(_0x219f2a,null));};exports['destroy']=function(_0x454ae7,_0x27afb7){return db[_0xb08e('0x3b')]['find']({'where':{'id':_0x454ae7[_0xb08e('0x40')]['id']}})[_0xb08e('0x21')](handleEntityNotFound(_0x27afb7,null))[_0xb08e('0x21')](removeEntity(_0x27afb7,null))[_0xb08e('0x3e')](handleError(_0x27afb7,null));};exports['addConditions']=function(_0xc93a92,_0x4cf6f6,_0x248212){return db[_0xb08e('0x46')][_0xb08e('0x43')]({'where':{'id':_0xc93a92[_0xb08e('0x40')]['id']}})[_0xb08e('0x21')](handleEntityNotFound(_0x4cf6f6,null))[_0xb08e('0x21')](function(_0x2a024a){if(_0x2a024a){return _0x2a024a['addConditions'](_0xc93a92['body'][_0xb08e('0x47')],_[_0xb08e('0x48')](_0xc93a92[_0xb08e('0x45')],['ids','id'])||{});}})[_0xb08e('0x21')](respondWithResult(_0x4cf6f6,null))[_0xb08e('0x3e')](handleError(_0x4cf6f6,null));};exports['getConditions']=function(_0x19c354,_0x231fd3,_0x2a4a27){var _0x1bb7f8={};var _0x5f4e81={};var _0x46c406;var _0x54e732;return db[_0xb08e('0x3b')]['findOne']({'where':{'id':_0x19c354[_0xb08e('0x40')]['id']}})['then'](handleEntityNotFound(_0x231fd3,null))[_0xb08e('0x21')](function(_0x1f42ac){if(_0x1f42ac){_0x46c406=_0x1f42ac;_0x5f4e81['model']=_[_0xb08e('0x2b')](db[_0xb08e('0x46')][_0xb08e('0x41')]);_0x5f4e81[_0xb08e('0x2a')]=_['keys'](_0x19c354['query']);_0x5f4e81[_0xb08e('0x34')]=_[_0xb08e('0x2c')](_0x5f4e81[_0xb08e('0x29')],_0x5f4e81['query']);_0x1bb7f8['attributes']=_[_0xb08e('0x2c')](_0x5f4e81[_0xb08e('0x29')],qs['fields'](_0x19c354['query']['fields']));_0x1bb7f8['attributes']=_0x1bb7f8[_0xb08e('0x2e')][_0xb08e('0x2f')]?_0x1bb7f8['attributes']:_0x5f4e81[_0xb08e('0x29')];_0x1bb7f8[_0xb08e('0x32')]=qs['sort'](_0x19c354['query'][_0xb08e('0x33')]);_0x1bb7f8[_0xb08e('0x37')]=qs[_0xb08e('0x34')](_['pick'](_0x19c354[_0xb08e('0x2a')],_0x5f4e81[_0xb08e('0x34')]));if(_0x19c354[_0xb08e('0x2a')][_0xb08e('0x36')]){_0x1bb7f8['where']=_['merge'](_0x1bb7f8[_0xb08e('0x37')],{'$or':_[_0xb08e('0x27')](_0x1bb7f8['attributes'],function(_0x578f5f){var _0x5913c3={};_0x5913c3[_0x578f5f]={'$like':'%'+_0x19c354[_0xb08e('0x2a')][_0xb08e('0x36')]+'%'};return _0x5913c3;})});}_0x1bb7f8=_[_0xb08e('0x38')]({},_0x1bb7f8,_0x19c354[_0xb08e('0x39')]);return _0x46c406[_0xb08e('0x49')](_0x1bb7f8);}})[_0xb08e('0x21')](function(_0x1247ba){if(_0x1247ba){_0x54e732=_0x1247ba[_0xb08e('0x2f')];if(!_0x19c354[_0xb08e('0x2a')]['hasOwnProperty'](_0xb08e('0x31'))){_0x1bb7f8['limit']=qs[_0xb08e('0x19')](_0x19c354[_0xb08e('0x2a')][_0xb08e('0x19')]);_0x1bb7f8[_0xb08e('0x1b')]=qs[_0xb08e('0x1b')](_0x19c354['query'][_0xb08e('0x1b')]);}return _0x46c406[_0xb08e('0x49')](_0x1bb7f8);}})[_0xb08e('0x21')](function(_0x2faf5b){if(_0x2faf5b){return _0x2faf5b?{'count':_0x54e732,'rows':_0x2faf5b}:null;}})[_0xb08e('0x21')](respondWithResult(_0x231fd3,null))['catch'](handleError(_0x231fd3,null));};exports[_0xb08e('0x4a')]=function(_0x4588fa,_0x1db6fd,_0xe345c3){return db[_0xb08e('0x4b')]['find']({'where':{'id':_0x4588fa[_0xb08e('0x40')]['id']}})[_0xb08e('0x21')](handleEntityNotFound(_0x1db6fd,null))[_0xb08e('0x21')](function(_0x254eb4){if(_0x254eb4){return _0x254eb4[_0xb08e('0x4a')](_0x4588fa[_0xb08e('0x45')][_0xb08e('0x47')],_['omit'](_0x4588fa[_0xb08e('0x45')],[_0xb08e('0x47'),'id'])||{});}})[_0xb08e('0x21')](respondWithResult(_0x1db6fd,null))[_0xb08e('0x3e')](handleError(_0x1db6fd,null));};exports[_0xb08e('0x4c')]=function(_0x2476bd,_0x2dbc49,_0x259b31){var _0x5b79bd={};var _0x4b576c={};var _0x39e1fb;var _0x26d15c;return db['Automation'][_0xb08e('0x4d')]({'where':{'id':_0x2476bd[_0xb08e('0x40')]['id']}})[_0xb08e('0x21')](handleEntityNotFound(_0x2dbc49,null))[_0xb08e('0x21')](function(_0x5e9e21){if(_0x5e9e21){_0x39e1fb=_0x5e9e21;_0x4b576c[_0xb08e('0x29')]=_[_0xb08e('0x2b')](db['Action'][_0xb08e('0x41')]);_0x4b576c[_0xb08e('0x2a')]=_['keys'](_0x2476bd[_0xb08e('0x2a')]);_0x4b576c[_0xb08e('0x34')]=_[_0xb08e('0x2c')](_0x4b576c[_0xb08e('0x29')],_0x4b576c[_0xb08e('0x2a')]);_0x5b79bd['attributes']=_[_0xb08e('0x2c')](_0x4b576c['model'],qs['fields'](_0x2476bd[_0xb08e('0x2a')][_0xb08e('0x2d')]));_0x5b79bd['attributes']=_0x5b79bd['attributes'][_0xb08e('0x2f')]?_0x5b79bd[_0xb08e('0x2e')]:_0x4b576c[_0xb08e('0x29')];_0x5b79bd['order']=qs[_0xb08e('0x33')](_0x2476bd[_0xb08e('0x2a')]['sort']);_0x5b79bd[_0xb08e('0x37')]=qs['filters'](_[_0xb08e('0x35')](_0x2476bd['query'],_0x4b576c[_0xb08e('0x34')]));if(_0x2476bd['query'][_0xb08e('0x36')]){_0x5b79bd['where']=_['merge'](_0x5b79bd[_0xb08e('0x37')],{'$or':_[_0xb08e('0x27')](_0x5b79bd[_0xb08e('0x2e')],function(_0xbd2e52){var _0x2bf8b7={};_0x2bf8b7[_0xbd2e52]={'$like':'%'+_0x2476bd[_0xb08e('0x2a')]['filter']+'%'};return _0x2bf8b7;})});}_0x5b79bd=_[_0xb08e('0x38')]({},_0x5b79bd,_0x2476bd[_0xb08e('0x39')]);return _0x39e1fb['getActions'](_0x5b79bd);}})[_0xb08e('0x21')](function(_0x350fb8){if(_0x350fb8){_0x26d15c=_0x350fb8[_0xb08e('0x2f')];if(!_0x2476bd[_0xb08e('0x2a')]['hasOwnProperty']('nolimit')){_0x5b79bd[_0xb08e('0x19')]=qs[_0xb08e('0x19')](_0x2476bd[_0xb08e('0x2a')][_0xb08e('0x19')]);_0x5b79bd['offset']=qs[_0xb08e('0x1b')](_0x2476bd['query'][_0xb08e('0x1b')]);}return _0x39e1fb[_0xb08e('0x4c')](_0x5b79bd);}})[_0xb08e('0x21')](function(_0x530097){if(_0x530097){return _0x530097?{'count':_0x26d15c,'rows':_0x530097}:null;}})[_0xb08e('0x21')](respondWithResult(_0x2dbc49,null))[_0xb08e('0x3e')](handleError(_0x2dbc49,null));}; \ No newline at end of file +var _0x1a43=['key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','pick','nolimit','addActions','getActions','Action','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','save','update','destroy','then','error','stack','name','send','map','Automation','rawAttributes'];(function(_0x2c9a1a,_0x9f98e6){var _0x193560=function(_0x1d98fe){while(--_0x1d98fe){_0x2c9a1a['push'](_0x2c9a1a['shift']());}};_0x193560(++_0x9f98e6);}(_0x1a43,0x16f));var _0x31a4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1a43[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31a4('0x0'));var zipdir=require(_0x31a4('0x1'));var jsonpatch=require(_0x31a4('0x2'));var rp=require(_0x31a4('0x3'));var moment=require(_0x31a4('0x4'));var BPromise=require(_0x31a4('0x5'));var Mustache=require(_0x31a4('0x6'));var util=require('util');var path=require(_0x31a4('0x7'));var sox=require(_0x31a4('0x8'));var csv=require('to-csv');var ejs=require(_0x31a4('0x9'));var fs=require('fs');var fs_extra=require(_0x31a4('0xa'));var _=require(_0x31a4('0xb'));var squel=require(_0x31a4('0xc'));var crypto=require(_0x31a4('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x31a4('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x31a4('0xf'));var qs=require(_0x31a4('0x10'));var as=require(_0x31a4('0x11'));var hardwareService=require(_0x31a4('0x12'));var logger=require(_0x31a4('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x31a4('0x14'));var licenseUtil=require(_0x31a4('0x15'));var db=require(_0x31a4('0x16'))['db'];function respondWithStatusCode(_0x23ff56,_0x551f6b){_0x551f6b=_0x551f6b||0xcc;return function(_0x1aa52b){if(_0x1aa52b){return _0x23ff56[_0x31a4('0x17')](_0x551f6b);}return _0x23ff56[_0x31a4('0x18')](_0x551f6b)[_0x31a4('0x19')]();};}function respondWithResult(_0x2cd40a,_0x3b6006){_0x3b6006=_0x3b6006||0xc8;return function(_0x4a5df1){if(_0x4a5df1){return _0x2cd40a[_0x31a4('0x18')](_0x3b6006)[_0x31a4('0x1a')](_0x4a5df1);}};}function respondWithFilteredResult(_0x592502,_0x2f2417){return function(_0xbe5291){if(_0xbe5291){var _0x5b1366=typeof _0x2f2417[_0x31a4('0x1b')]==='undefined'&&typeof _0x2f2417[_0x31a4('0x1c')]===_0x31a4('0x1d');var _0x1210de=_0xbe5291['count'];var _0x17c1b8=_0x5b1366?0x0:_0x2f2417[_0x31a4('0x1b')];var _0x422a94=_0x5b1366?_0xbe5291[_0x31a4('0x1e')]:_0x2f2417[_0x31a4('0x1b')]+_0x2f2417[_0x31a4('0x1c')];var _0x176229;if(_0x422a94>=_0x1210de){_0x422a94=_0x1210de;_0x176229=0xc8;}else{_0x176229=0xce;}_0x592502[_0x31a4('0x18')](_0x176229);return _0x592502[_0x31a4('0x1f')]('Content-Range',_0x17c1b8+'-'+_0x422a94+'/'+_0x1210de)['json'](_0xbe5291);}return null;};}function patchUpdates(_0x2f6628){return function(_0x6efbe8){try{jsonpatch['apply'](_0x6efbe8,_0x2f6628,!![]);}catch(_0x4c90f8){return BPromise['reject'](_0x4c90f8);}return _0x6efbe8[_0x31a4('0x20')]();};}function saveUpdates(_0x544a72,_0x26bd7f){return function(_0x9e47fd){if(_0x9e47fd){return _0x9e47fd[_0x31a4('0x21')](_0x544a72)['then'](function(_0x1b2fdd){return _0x1b2fdd;});}return null;};}function removeEntity(_0x1a98ee,_0x493a79){return function(_0x40d5dc){if(_0x40d5dc){return _0x40d5dc[_0x31a4('0x22')]()[_0x31a4('0x23')](function(){_0x1a98ee[_0x31a4('0x18')](0xcc)[_0x31a4('0x19')]();});}};}function handleEntityNotFound(_0x4fe565,_0x5df76f){return function(_0x274605){if(!_0x274605){_0x4fe565['sendStatus'](0x194);}return _0x274605;};}function handleError(_0x250dfd,_0x35a41c){_0x35a41c=_0x35a41c||0x1f4;return function(_0x363552){logger[_0x31a4('0x24')](_0x363552[_0x31a4('0x25')]);if(_0x363552[_0x31a4('0x26')]){delete _0x363552['name'];}_0x250dfd[_0x31a4('0x18')](_0x35a41c)[_0x31a4('0x27')](_0x363552);};}exports['index']=function(_0x607c95,_0x3e5972){var _0x45e59d={},_0x369812={},_0xfaddb={'count':0x0,'rows':[]};var _0x229ee4=_[_0x31a4('0x28')](db[_0x31a4('0x29')][_0x31a4('0x2a')],function(_0x1db709){return{'name':_0x1db709['fieldName'],'type':_0x1db709['type'][_0x31a4('0x2b')]};});_0x369812[_0x31a4('0x2c')]=_[_0x31a4('0x28')](_0x229ee4,'name');_0x369812[_0x31a4('0x2d')]=_[_0x31a4('0x2e')](_0x607c95[_0x31a4('0x2d')]);_0x369812[_0x31a4('0x2f')]=_[_0x31a4('0x30')](_0x369812[_0x31a4('0x2c')],_0x369812[_0x31a4('0x2d')]);_0x45e59d[_0x31a4('0x31')]=_['intersection'](_0x369812[_0x31a4('0x2c')],qs['fields'](_0x607c95[_0x31a4('0x2d')][_0x31a4('0x32')]));_0x45e59d[_0x31a4('0x31')]=_0x45e59d[_0x31a4('0x31')][_0x31a4('0x33')]?_0x45e59d[_0x31a4('0x31')]:_0x369812[_0x31a4('0x2c')];if(!_0x607c95[_0x31a4('0x2d')][_0x31a4('0x34')]('nolimit')){_0x45e59d[_0x31a4('0x1c')]=qs[_0x31a4('0x1c')](_0x607c95[_0x31a4('0x2d')][_0x31a4('0x1c')]);_0x45e59d['offset']=qs['offset'](_0x607c95[_0x31a4('0x2d')][_0x31a4('0x1b')]);}_0x45e59d[_0x31a4('0x35')]=qs['sort'](_0x607c95[_0x31a4('0x2d')][_0x31a4('0x36')]);_0x45e59d[_0x31a4('0x37')]=qs[_0x31a4('0x2f')](_['pick'](_0x607c95[_0x31a4('0x2d')],_0x369812[_0x31a4('0x2f')]),_0x229ee4);if(_0x607c95[_0x31a4('0x2d')][_0x31a4('0x38')]){_0x45e59d['where']=_[_0x31a4('0x39')](_0x45e59d[_0x31a4('0x37')],{'$or':_[_0x31a4('0x28')](_0x229ee4,function(_0x137b82){if(_0x137b82[_0x31a4('0x3a')]!==_0x31a4('0x3b')){var _0x29de97={};_0x29de97[_0x137b82['name']]={'$like':'%'+_0x607c95[_0x31a4('0x2d')][_0x31a4('0x38')]+'%'};return _0x29de97;}})});}_0x45e59d=_['merge']({},_0x45e59d,_0x607c95[_0x31a4('0x3c')]);var _0x3bbdb7={'where':_0x45e59d[_0x31a4('0x37')]};return db[_0x31a4('0x29')][_0x31a4('0x1e')](_0x3bbdb7)[_0x31a4('0x23')](function(_0x44d8aa){_0xfaddb['count']=_0x44d8aa;if(_0x607c95[_0x31a4('0x2d')][_0x31a4('0x3d')]){_0x45e59d[_0x31a4('0x3e')]=[{'all':!![]}];}return db[_0x31a4('0x29')][_0x31a4('0x3f')](_0x45e59d);})[_0x31a4('0x23')](function(_0x120f9d){_0xfaddb[_0x31a4('0x40')]=_0x120f9d;return _0xfaddb;})[_0x31a4('0x23')](respondWithFilteredResult(_0x3e5972,_0x45e59d))[_0x31a4('0x41')](handleError(_0x3e5972,null));};exports[_0x31a4('0x42')]=function(_0x1e93e6,_0x57d9a7){var _0x1e9278={'raw':![],'where':{'id':_0x1e93e6[_0x31a4('0x43')]['id']}},_0x27b491={};_0x27b491[_0x31a4('0x2c')]=_[_0x31a4('0x2e')](db[_0x31a4('0x29')]['rawAttributes']);_0x27b491['query']=_[_0x31a4('0x2e')](_0x1e93e6['query']);_0x27b491[_0x31a4('0x2f')]=_[_0x31a4('0x30')](_0x27b491[_0x31a4('0x2c')],_0x27b491[_0x31a4('0x2d')]);_0x1e9278['attributes']=_['intersection'](_0x27b491['model'],qs[_0x31a4('0x32')](_0x1e93e6[_0x31a4('0x2d')][_0x31a4('0x32')]));_0x1e9278['attributes']=_0x1e9278['attributes'][_0x31a4('0x33')]?_0x1e9278[_0x31a4('0x31')]:_0x27b491[_0x31a4('0x2c')];if(_0x1e93e6['query'][_0x31a4('0x3d')]){_0x1e9278[_0x31a4('0x3e')]=[{'all':!![]}];}_0x1e9278=_[_0x31a4('0x39')]({},_0x1e9278,_0x1e93e6[_0x31a4('0x3c')]);return db[_0x31a4('0x29')][_0x31a4('0x44')](_0x1e9278)[_0x31a4('0x23')](handleEntityNotFound(_0x57d9a7,null))[_0x31a4('0x23')](respondWithResult(_0x57d9a7,null))[_0x31a4('0x41')](handleError(_0x57d9a7,null));};exports[_0x31a4('0x45')]=function(_0xfff068,_0x516b65){return db[_0x31a4('0x29')][_0x31a4('0x45')](_0xfff068[_0x31a4('0x46')],{})['then'](respondWithResult(_0x516b65,0xc9))[_0x31a4('0x41')](handleError(_0x516b65,null));};exports['update']=function(_0x477517,_0xf8d58a){if(_0x477517[_0x31a4('0x46')]['id']){delete _0x477517['body']['id'];}return db[_0x31a4('0x29')][_0x31a4('0x44')]({'where':{'id':_0x477517[_0x31a4('0x43')]['id']}})[_0x31a4('0x23')](handleEntityNotFound(_0xf8d58a,null))[_0x31a4('0x23')](saveUpdates(_0x477517[_0x31a4('0x46')],null))[_0x31a4('0x23')](respondWithResult(_0xf8d58a,null))[_0x31a4('0x41')](handleError(_0xf8d58a,null));};exports['destroy']=function(_0x19c3a2,_0x503224){return db['Automation'][_0x31a4('0x44')]({'where':{'id':_0x19c3a2[_0x31a4('0x43')]['id']}})[_0x31a4('0x23')](handleEntityNotFound(_0x503224,null))[_0x31a4('0x23')](removeEntity(_0x503224,null))[_0x31a4('0x41')](handleError(_0x503224,null));};exports[_0x31a4('0x47')]=function(_0x5e02e0,_0x119728,_0x4dbbe0){return db[_0x31a4('0x48')]['find']({'where':{'id':_0x5e02e0[_0x31a4('0x43')]['id']}})[_0x31a4('0x23')](handleEntityNotFound(_0x119728,null))['then'](function(_0x4ffa2f){if(_0x4ffa2f){return _0x4ffa2f[_0x31a4('0x47')](_0x5e02e0[_0x31a4('0x46')][_0x31a4('0x49')],_[_0x31a4('0x4a')](_0x5e02e0[_0x31a4('0x46')],[_0x31a4('0x49'),'id'])||{});}})['then'](respondWithResult(_0x119728,null))['catch'](handleError(_0x119728,null));};exports[_0x31a4('0x4b')]=function(_0x1e3df4,_0x45bcd5,_0xbb0a67){var _0x21214e={};var _0x444753={};var _0x1f3f3d;var _0x45d897;return db[_0x31a4('0x29')][_0x31a4('0x4c')]({'where':{'id':_0x1e3df4[_0x31a4('0x43')]['id']}})[_0x31a4('0x23')](handleEntityNotFound(_0x45bcd5,null))['then'](function(_0x1f6788){if(_0x1f6788){_0x1f3f3d=_0x1f6788;_0x444753['model']=_[_0x31a4('0x2e')](db[_0x31a4('0x48')][_0x31a4('0x2a')]);_0x444753[_0x31a4('0x2d')]=_[_0x31a4('0x2e')](_0x1e3df4[_0x31a4('0x2d')]);_0x444753['filters']=_[_0x31a4('0x30')](_0x444753[_0x31a4('0x2c')],_0x444753[_0x31a4('0x2d')]);_0x21214e[_0x31a4('0x31')]=_[_0x31a4('0x30')](_0x444753[_0x31a4('0x2c')],qs[_0x31a4('0x32')](_0x1e3df4[_0x31a4('0x2d')][_0x31a4('0x32')]));_0x21214e[_0x31a4('0x31')]=_0x21214e['attributes']['length']?_0x21214e[_0x31a4('0x31')]:_0x444753['model'];_0x21214e[_0x31a4('0x35')]=qs[_0x31a4('0x36')](_0x1e3df4[_0x31a4('0x2d')][_0x31a4('0x36')]);_0x21214e[_0x31a4('0x37')]=qs[_0x31a4('0x2f')](_[_0x31a4('0x4d')](_0x1e3df4['query'],_0x444753[_0x31a4('0x2f')]));if(_0x1e3df4[_0x31a4('0x2d')][_0x31a4('0x38')]){_0x21214e[_0x31a4('0x37')]=_[_0x31a4('0x39')](_0x21214e[_0x31a4('0x37')],{'$or':_[_0x31a4('0x28')](_0x21214e['attributes'],function(_0x5dcbda){var _0x259527={};_0x259527[_0x5dcbda]={'$like':'%'+_0x1e3df4[_0x31a4('0x2d')][_0x31a4('0x38')]+'%'};return _0x259527;})});}_0x21214e=_[_0x31a4('0x39')]({},_0x21214e,_0x1e3df4[_0x31a4('0x3c')]);return _0x1f3f3d['getConditions'](_0x21214e);}})['then'](function(_0x556df9){if(_0x556df9){_0x45d897=_0x556df9[_0x31a4('0x33')];if(!_0x1e3df4[_0x31a4('0x2d')][_0x31a4('0x34')](_0x31a4('0x4e'))){_0x21214e['limit']=qs[_0x31a4('0x1c')](_0x1e3df4[_0x31a4('0x2d')]['limit']);_0x21214e[_0x31a4('0x1b')]=qs['offset'](_0x1e3df4[_0x31a4('0x2d')][_0x31a4('0x1b')]);}return _0x1f3f3d[_0x31a4('0x4b')](_0x21214e);}})[_0x31a4('0x23')](function(_0x550d39){if(_0x550d39){return _0x550d39?{'count':_0x45d897,'rows':_0x550d39}:null;}})[_0x31a4('0x23')](respondWithResult(_0x45bcd5,null))[_0x31a4('0x41')](handleError(_0x45bcd5,null));};exports[_0x31a4('0x4f')]=function(_0x14a61d,_0x4cf52e,_0x47683b){return db['Action'][_0x31a4('0x44')]({'where':{'id':_0x14a61d[_0x31a4('0x43')]['id']}})[_0x31a4('0x23')](handleEntityNotFound(_0x4cf52e,null))[_0x31a4('0x23')](function(_0x5efc30){if(_0x5efc30){return _0x5efc30[_0x31a4('0x4f')](_0x14a61d[_0x31a4('0x46')][_0x31a4('0x49')],_[_0x31a4('0x4a')](_0x14a61d['body'],[_0x31a4('0x49'),'id'])||{});}})['then'](respondWithResult(_0x4cf52e,null))[_0x31a4('0x41')](handleError(_0x4cf52e,null));};exports[_0x31a4('0x50')]=function(_0x151154,_0x374e95,_0x45f60f){var _0x5c603c={};var _0xee09d6={};var _0x2da7a2;var _0x4ec002;return db[_0x31a4('0x29')][_0x31a4('0x4c')]({'where':{'id':_0x151154[_0x31a4('0x43')]['id']}})[_0x31a4('0x23')](handleEntityNotFound(_0x374e95,null))[_0x31a4('0x23')](function(_0x3d8db1){if(_0x3d8db1){_0x2da7a2=_0x3d8db1;_0xee09d6[_0x31a4('0x2c')]=_[_0x31a4('0x2e')](db[_0x31a4('0x51')][_0x31a4('0x2a')]);_0xee09d6[_0x31a4('0x2d')]=_[_0x31a4('0x2e')](_0x151154[_0x31a4('0x2d')]);_0xee09d6[_0x31a4('0x2f')]=_[_0x31a4('0x30')](_0xee09d6[_0x31a4('0x2c')],_0xee09d6[_0x31a4('0x2d')]);_0x5c603c[_0x31a4('0x31')]=_[_0x31a4('0x30')](_0xee09d6[_0x31a4('0x2c')],qs[_0x31a4('0x32')](_0x151154[_0x31a4('0x2d')][_0x31a4('0x32')]));_0x5c603c['attributes']=_0x5c603c[_0x31a4('0x31')][_0x31a4('0x33')]?_0x5c603c[_0x31a4('0x31')]:_0xee09d6[_0x31a4('0x2c')];_0x5c603c[_0x31a4('0x35')]=qs[_0x31a4('0x36')](_0x151154[_0x31a4('0x2d')][_0x31a4('0x36')]);_0x5c603c['where']=qs[_0x31a4('0x2f')](_[_0x31a4('0x4d')](_0x151154['query'],_0xee09d6[_0x31a4('0x2f')]));if(_0x151154['query'][_0x31a4('0x38')]){_0x5c603c['where']=_['merge'](_0x5c603c['where'],{'$or':_[_0x31a4('0x28')](_0x5c603c[_0x31a4('0x31')],function(_0x3968a7){var _0x389b48={};_0x389b48[_0x3968a7]={'$like':'%'+_0x151154[_0x31a4('0x2d')][_0x31a4('0x38')]+'%'};return _0x389b48;})});}_0x5c603c=_['merge']({},_0x5c603c,_0x151154[_0x31a4('0x3c')]);return _0x2da7a2[_0x31a4('0x50')](_0x5c603c);}})[_0x31a4('0x23')](function(_0x1c4c12){if(_0x1c4c12){_0x4ec002=_0x1c4c12[_0x31a4('0x33')];if(!_0x151154['query'][_0x31a4('0x34')](_0x31a4('0x4e'))){_0x5c603c[_0x31a4('0x1c')]=qs['limit'](_0x151154[_0x31a4('0x2d')][_0x31a4('0x1c')]);_0x5c603c[_0x31a4('0x1b')]=qs[_0x31a4('0x1b')](_0x151154[_0x31a4('0x2d')][_0x31a4('0x1b')]);}return _0x2da7a2[_0x31a4('0x50')](_0x5c603c);}})[_0x31a4('0x23')](function(_0x46cd77){if(_0x46cd77){return _0x46cd77?{'count':_0x4ec002,'rows':_0x46cd77}:null;}})[_0x31a4('0x23')](respondWithResult(_0x374e95,null))[_0x31a4('0x41')](handleError(_0x374e95,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index cd630f2..43366d0 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 _0x93c8=['bluebird','request-promise','../../config/environment','define','tools_automations','util','api','moment'];(function(_0x4666c5,_0x3ff2f2){var _0x5a0a31=function(_0x4aea95){while(--_0x4aea95){_0x4666c5['push'](_0x4666c5['shift']());}};_0x5a0a31(++_0x3ff2f2);}(_0x93c8,0x65));var _0x893c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x93c8[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x893c('0x0'));var logger=require('../../config/logger')(_0x893c('0x1'));var moment=require(_0x893c('0x2'));var BPromise=require(_0x893c('0x3'));var rp=require(_0x893c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x893c('0x5'));var attributes=require('./automation.attributes');module['exports']=function(_0x20f006,_0xa22082){return _0x20f006[_0x893c('0x6')]('Automation',attributes,{'tableName':_0x893c('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8f94=['exports','define','Automation','lodash','util','api','request-promise','path','rimraf','../../config/environment','./automation.attributes'];(function(_0x366af1,_0x28ca1a){var _0x112627=function(_0xe0bebc){while(--_0xe0bebc){_0x366af1['push'](_0x366af1['shift']());}};_0x112627(++_0x28ca1a);}(_0x8f94,0x1bb));var _0x48f9=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x8f94[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x48f9('0x0'));var util=require(_0x48f9('0x1'));var logger=require('../../config/logger')(_0x48f9('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x48f9('0x3'));var fs=require('fs');var path=require(_0x48f9('0x4'));var rimraf=require(_0x48f9('0x5'));var config=require(_0x48f9('0x6'));var attributes=require(_0x48f9('0x7'));module[_0x48f9('0x8')]=function(_0x515a81,_0x3f466f){return _0x515a81[_0x48f9('0x9')](_0x48f9('0xa'),attributes,{'tableName':'tools_automations','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 63d4f80..294923d 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 _0xdef9=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x2ee20d,_0x354e70){var _0xade530=function(_0x1db7cc){while(--_0x1db7cc){_0x2ee20d['push'](_0x2ee20d['shift']());}};_0xade530(++_0x354e70);}(_0xdef9,0x1ed));var _0x9def=function(_0x2e7025,_0x187270){_0x2e7025=_0x2e7025-0x0;var _0x5373ed=_0xdef9[_0x2e7025];return _0x5373ed;};'use strict';var _=require(_0x9def('0x0'));var util=require(_0x9def('0x1'));var moment=require(_0x9def('0x2'));var BPromise=require(_0x9def('0x3'));var rs=require(_0x9def('0x4'));var fs=require('fs');var Redis=require(_0x9def('0x5'));var db=require(_0x9def('0x6'))['db'];var utils=require(_0x9def('0x7'));var logger=require(_0x9def('0x8'))(_0x9def('0x9'));var config=require(_0x9def('0xa'));var jayson=require(_0x9def('0xb'));var client=jayson[_0x9def('0xc')][_0x9def('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x40c607,_0x25a03e,_0x42296c){return new BPromise(function(_0x1efce0,_0x8262f1){return client['request'](_0x40c607,_0x42296c)[_0x9def('0xe')](function(_0x4f0a0d){logger['info'](_0x9def('0xf'),_0x25a03e,_0x9def('0x10'));logger[_0x9def('0x11')](_0x9def('0x12'),_0x25a03e,'request\x20sent',JSON[_0x9def('0x13')](_0x4f0a0d));if(_0x4f0a0d[_0x9def('0x14')]){if(_0x4f0a0d[_0x9def('0x14')][_0x9def('0x15')]===0x1f4){logger['error'](_0x9def('0xf'),_0x25a03e,_0x4f0a0d[_0x9def('0x14')]['message']);return _0x8262f1(_0x4f0a0d[_0x9def('0x14')]['message']);}logger['error'](_0x9def('0xf'),_0x25a03e,_0x4f0a0d[_0x9def('0x14')][_0x9def('0x16')]);return _0x1efce0(_0x4f0a0d['error'][_0x9def('0x16')]);}else{logger['info']('Automation,\x20%s,\x20%s',_0x25a03e,_0x9def('0x10'));_0x1efce0(_0x4f0a0d[_0x9def('0x17')][_0x9def('0x16')]);}})[_0x9def('0x18')](function(_0x463520){logger[_0x9def('0x14')](_0x9def('0xf'),_0x25a03e,_0x463520);_0x8262f1(_0x463520);});});} \ No newline at end of file +var _0xad07=['util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','request','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x3062d3,_0x148b2f){var _0x388b0e=function(_0x233451){while(--_0x233451){_0x3062d3['push'](_0x3062d3['shift']());}};_0x388b0e(++_0x148b2f);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7ad0('0x0'));var util=require(_0x7ad0('0x1'));var moment=require('moment');var BPromise=require(_0x7ad0('0x2'));var rs=require(_0x7ad0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7ad0('0x4'));var logger=require(_0x7ad0('0x5'))(_0x7ad0('0x6'));var config=require('../../config/environment');var jayson=require(_0x7ad0('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2d09f9,_0x458ffd,_0x533282){return new BPromise(function(_0x50b4e7,_0x8684e2){return client[_0x7ad0('0x8')](_0x2d09f9,_0x533282)['then'](function(_0x5afa7c){logger[_0x7ad0('0x9')](_0x7ad0('0xa'),_0x458ffd,_0x7ad0('0xb'));logger['debug'](_0x7ad0('0xc'),_0x458ffd,_0x7ad0('0xb'),JSON[_0x7ad0('0xd')](_0x5afa7c));if(_0x5afa7c[_0x7ad0('0xe')]){if(_0x5afa7c[_0x7ad0('0xe')][_0x7ad0('0xf')]===0x1f4){logger[_0x7ad0('0xe')](_0x7ad0('0xa'),_0x458ffd,_0x5afa7c[_0x7ad0('0xe')]['message']);return _0x8684e2(_0x5afa7c[_0x7ad0('0xe')][_0x7ad0('0x10')]);}logger[_0x7ad0('0xe')](_0x7ad0('0xa'),_0x458ffd,_0x5afa7c['error']['message']);return _0x50b4e7(_0x5afa7c[_0x7ad0('0xe')][_0x7ad0('0x10')]);}else{logger[_0x7ad0('0x9')](_0x7ad0('0xa'),_0x458ffd,_0x7ad0('0xb'));_0x50b4e7(_0x5afa7c[_0x7ad0('0x11')][_0x7ad0('0x10')]);}})[_0x7ad0('0x12')](function(_0x52c802){logger[_0x7ad0('0xe')](_0x7ad0('0xa'),_0x458ffd,_0x52c802);_0x8684e2(_0x52c802);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index f1b6848..38f0345 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 _0x9224=['/:id/actions','getActions','post','create','addActions','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','./automation.controller','isAuthenticated','index','get','/:id','show','/:id/conditions'];(function(_0x70539e,_0x31793b){var _0x10fbeb=function(_0x5e52cf){while(--_0x5e52cf){_0x70539e['push'](_0x70539e['shift']());}};_0x10fbeb(++_0x31793b);}(_0x9224,0xa3));var _0x4922=function(_0x5d836e,_0x51fcb2){_0x5d836e=_0x5d836e-0x0;var _0x33d831=_0x9224[_0x5d836e];return _0x33d831;};'use strict';var multer=require('multer');var util=require(_0x4922('0x0'));var path=require(_0x4922('0x1'));var timeout=require(_0x4922('0x2'));var express=require(_0x4922('0x3'));var router=express[_0x4922('0x4')]();var fs_extra=require(_0x4922('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4922('0x6'));router['get']('/',auth[_0x4922('0x7')](),controller[_0x4922('0x8')]);router[_0x4922('0x9')](_0x4922('0xa'),auth[_0x4922('0x7')](),controller[_0x4922('0xb')]);router['get'](_0x4922('0xc'),auth[_0x4922('0x7')](),controller['getConditions']);router[_0x4922('0x9')](_0x4922('0xd'),auth[_0x4922('0x7')](),controller[_0x4922('0xe')]);router[_0x4922('0xf')]('/',auth[_0x4922('0x7')](),controller[_0x4922('0x10')]);router[_0x4922('0xf')]('/:id/conditions',auth[_0x4922('0x7')](),controller['addConditions']);router[_0x4922('0xf')](_0x4922('0xd'),auth[_0x4922('0x7')](),controller[_0x4922('0x11')]);router[_0x4922('0x12')]('/:id',auth[_0x4922('0x7')](),controller[_0x4922('0x13')]);router['delete'](_0x4922('0xa'),auth[_0x4922('0x7')](),controller[_0x4922('0x14')]);module[_0x4922('0x15')]=router; \ No newline at end of file +var _0xc9df=['exports','util','path','connect-timeout','get','isAuthenticated','index','/:id','/:id/conditions','getConditions','/:id/actions','getActions','post','create','addConditions','put','update','delete'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xc9df,0x121));var _0xfc9d=function(_0x1b7541,_0x222c38){_0x1b7541=_0x1b7541-0x0;var _0x2b8e5a=_0xc9df[_0x1b7541];return _0x2b8e5a;};'use strict';var multer=require('multer');var util=require(_0xfc9d('0x0'));var path=require(_0xfc9d('0x1'));var timeout=require(_0xfc9d('0x2'));var express=require('express');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('../../config/environment');var controller=require('./automation.controller');router[_0xfc9d('0x3')]('/',auth[_0xfc9d('0x4')](),controller[_0xfc9d('0x5')]);router[_0xfc9d('0x3')](_0xfc9d('0x6'),auth[_0xfc9d('0x4')](),controller['show']);router[_0xfc9d('0x3')](_0xfc9d('0x7'),auth[_0xfc9d('0x4')](),controller[_0xfc9d('0x8')]);router[_0xfc9d('0x3')](_0xfc9d('0x9'),auth[_0xfc9d('0x4')](),controller[_0xfc9d('0xa')]);router[_0xfc9d('0xb')]('/',auth[_0xfc9d('0x4')](),controller[_0xfc9d('0xc')]);router[_0xfc9d('0xb')](_0xfc9d('0x7'),auth[_0xfc9d('0x4')](),controller[_0xfc9d('0xd')]);router[_0xfc9d('0xb')]('/:id/actions',auth[_0xfc9d('0x4')](),controller['addActions']);router[_0xfc9d('0xe')]('/:id',auth[_0xfc9d('0x4')](),controller[_0xfc9d('0xf')]);router[_0xfc9d('0x10')](_0xfc9d('0x6'),auth[_0xfc9d('0x4')](),controller['destroy']);module[_0xfc9d('0x11')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 8f509aa..147a20b 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 _0x83d2=['BOOLEAN','Active/Disactive\x20Campaign','UNSIGNED','Max\x20200\x20calls.','INTEGER','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','never','onlyIfOpen','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\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\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)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x83d2,0x1f2));var _0x283d=function(_0xb06c82,_0x2017c8){_0xb06c82=_0xb06c82-0x0;var _0x40f219=_0x83d2[_0xb06c82];return _0x40f219;};'use strict';var Sequelize=require(_0x283d('0x0'));module[_0x283d('0x1')]={'name':{'type':Sequelize[_0x283d('0x2')],'unique':_0x283d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x283d('0x4')](_0x283d('0x5')),'allowNull':![],'defaultValue':_0x283d('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x283d('0x6')],'defaultValue':0x0,'comment':_0x283d('0x7')},'limitCalls':{'type':Sequelize['INTEGER'](0x4)[_0x283d('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x283d('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x283d('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x283d('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x283d('0xa')](0x3)[_0x283d('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x283d('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x283d('0xa')](0x3)[_0x283d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x283d('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x283d('0xd')},'dialBusyRetryFrequency':{'type':Sequelize[_0x283d('0xa')](0x5)[_0x283d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x283d('0xe')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x283d('0xa')](0x3)[_0x283d('0x8')],'defaultValue':0x3,'comment':_0x283d('0xf')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x283d('0xa')](0x5)[_0x283d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x283d('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x283d('0x10')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x283d('0x2')],'defaultValue':_0x283d('0x11')},'dialCheckDuplicateType':{'type':Sequelize[_0x283d('0x4')]('always',_0x283d('0x12'),_0x283d('0x13')),'defaultValue':_0x283d('0x14')},'dialAMDActive':{'type':Sequelize[_0x283d('0x6')],'defaultValue':0x0,'comment':_0x283d('0x15')},'dialAMDInitialSilence':{'type':Sequelize[_0x283d('0xa')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x283d('0x16')},'dialAMDGreeting':{'type':Sequelize[_0x283d('0xa')](0x9)[_0x283d('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x283d('0x17')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x283d('0x18')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x283d('0xa')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x283d('0x19')},'dialAMDMinWordLength':{'type':Sequelize[_0x283d('0xa')](0x9)[_0x283d('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x283d('0x1a')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x283d('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x283d('0x1b')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x283d('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x283d('0x1c')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x283d('0x1d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x283d('0xa')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x283d('0x1e')},'dialOrderByScheduledAt':{'type':Sequelize[_0x283d('0x4')](_0x283d('0x1f'),_0x283d('0x20')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x283d('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0x283d('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x283d('0x21')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x283d('0xa')](0x3)[_0x283d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x283d('0x22')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x283d('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x283d('0x23')},'dialDropMaxRetry':{'type':Sequelize[_0x283d('0xa')](0x3)[_0x283d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x283d('0x24')},'dialDropRetryFrequency':{'type':Sequelize[_0x283d('0xa')](0x5)[_0x283d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x283d('0x25')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x283d('0xa')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x283d('0xa')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x283d('0x26')},'dialMachineMaxRetry':{'type':Sequelize[_0x283d('0xa')](0x3)[_0x283d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x283d('0x27')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x283d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x283d('0x28')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x283d('0xa')](0x3)[_0x283d('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#AgentReject\x20Retry\x20(min:1,\x20max:999)'},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x283d('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x283d('0x29')}}; \ No newline at end of file +var _0x9632=['Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\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)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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)'];(function(_0x30c38d,_0x4a57c4){var _0xd3d6b3=function(_0x5c359b){while(--_0x5c359b){_0x30c38d['push'](_0x30c38d['shift']());}};_0xd3d6b3(++_0x4a57c4);}(_0x9632,0x109));var _0x2963=function(_0x5d1c9d,_0x10c32b){_0x5d1c9d=_0x5d1c9d-0x0;var _0x182740=_0x9632[_0x5d1c9d];return _0x182740;};'use strict';var Sequelize=require(_0x2963('0x0'));module[_0x2963('0x1')]={'name':{'type':Sequelize[_0x2963('0x2')],'unique':_0x2963('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x2963('0x4')](_0x2963('0x5')),'allowNull':![],'defaultValue':_0x2963('0x5')},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2963('0x6')},'limitCalls':{'type':Sequelize[_0x2963('0x7')](0x4)[_0x2963('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x2963('0x9')},'dialOriginateCallerIdName':{'type':Sequelize[_0x2963('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x2963('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x2963('0x7')](0x3)[_0x2963('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2963('0xa')},'dialCongestionMaxRetry':{'type':Sequelize[_0x2963('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x2963('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x2963('0x7')](0x3)[_0x2963('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x2963('0x7')](0x5)[_0x2963('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2963('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x2963('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x2963('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2963('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2963('0xd')},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2963('0x8')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x2963('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x2963('0x2')],'defaultValue':_0x2963('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0x2963('0x4')](_0x2963('0xf'),_0x2963('0x10'),_0x2963('0x11')),'defaultValue':_0x2963('0xf')},'dialAMDActive':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x2963('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x2963('0x7')](0x9)[_0x2963('0x8')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':'#AMD\x20Initial\x20Silence'},'dialAMDGreeting':{'type':Sequelize[_0x2963('0x7')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x2963('0x7')](0x9)[_0x2963('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x2963('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x2963('0x7')](0x9)[_0x2963('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2963('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0x2963('0x7')](0x9)[_0x2963('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x2963('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x2963('0x7')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x2963('0x16')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x2963('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x2963('0x17')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x2963('0x7')](0x9)[_0x2963('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x2963('0x18')},'dialOrderByScheduledAt':{'type':Sequelize[_0x2963('0x4')]('DESC',_0x2963('0x19')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0x2963('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x2963('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2963('0x1a')},'dialCutDigit':{'type':Sequelize[_0x2963('0x7')](0x3)[_0x2963('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x2963('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x2963('0x7')](0x3)[_0x2963('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2963('0x1c')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x2963('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2963('0x1d')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2963('0x1e')},'dialDropRetryFrequency':{'type':Sequelize[_0x2963('0x7')](0x5)[_0x2963('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2963('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x2963('0x7')](0x3)[_0x2963('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x2963('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2963('0x20')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2963('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2963('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0x2963('0x7')](0x5)[_0x2963('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2963('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x2963('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x2963('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x2963('0x7')](0x5)[_0x2963('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x2963('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index ba6fc63..86d944a 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 _0xfbe2=['h.ListId\x20=\x20?','h.CampaignId=?','h.createdAt\x20=\x20?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','then','destroy','get','UserProfileResource','sendStatus','stack','name','send','index','Campaign','rawAttributes','key','map','query','keys','intersection','model','fields','length','attributes','hasOwnProperty','nolimit','order','sort','filters','filter','where','type','VIRTUAL','options','includeAll','findAll','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','IvrCampaigns','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','merge','createdAt','omit','updatedAt','UserProfileSection','update','getHoppers','findOne','CmHopper','pick','CampaignId','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','select','field','phone','toString','ListId','from','cm_contacts','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','NOW()','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','cmHopperId','OrderBy','h.id','ci.item','ci.OrderBY','cm_contact_has_items'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0xfbe2,0x1da));var _0x2fbe=function(_0xec1618,_0xd97de8){_0xec1618=_0xec1618-0x0;var _0x4aad57=_0xfbe2[_0xec1618];return _0x4aad57;};'use strict';var emlformat=require(_0x2fbe('0x0'));var rimraf=require(_0x2fbe('0x1'));var zipdir=require(_0x2fbe('0x2'));var jsonpatch=require(_0x2fbe('0x3'));var rp=require('request-promise');var moment=require(_0x2fbe('0x4'));var BPromise=require(_0x2fbe('0x5'));var Mustache=require(_0x2fbe('0x6'));var util=require('util');var path=require(_0x2fbe('0x7'));var sox=require(_0x2fbe('0x8'));var csv=require(_0x2fbe('0x9'));var ejs=require(_0x2fbe('0xa'));var fs=require('fs');var fs_extra=require(_0x2fbe('0xb'));var _=require(_0x2fbe('0xc'));var squel=require(_0x2fbe('0xd'));var crypto=require(_0x2fbe('0xe'));var jsforce=require(_0x2fbe('0xf'));var deskjs=require(_0x2fbe('0x10'));var toCsv=require(_0x2fbe('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x2fbe('0x11'));var authService=require(_0x2fbe('0x12'));var qs=require(_0x2fbe('0x13'));var as=require(_0x2fbe('0x14'));var hardwareService=require(_0x2fbe('0x15'));var logger=require(_0x2fbe('0x16'))(_0x2fbe('0x17'));var utils=require(_0x2fbe('0x18'));var config=require(_0x2fbe('0x19'));var licenseUtil=require(_0x2fbe('0x1a'));var db=require(_0x2fbe('0x1b'))['db'];function respondWithStatusCode(_0x19dd72,_0x421387){_0x421387=_0x421387||0xcc;return function(_0x12be84){if(_0x12be84){return _0x19dd72['sendStatus'](_0x421387);}return _0x19dd72[_0x2fbe('0x1c')](_0x421387)[_0x2fbe('0x1d')]();};}function respondWithResult(_0xfd78c7,_0x2dcfbb){_0x2dcfbb=_0x2dcfbb||0xc8;return function(_0x19777a){if(_0x19777a){return _0xfd78c7[_0x2fbe('0x1c')](_0x2dcfbb)['json'](_0x19777a);}};}function respondWithFilteredResult(_0x40a968,_0x312970){return function(_0x556a98){if(_0x556a98){var _0x19d8fd=typeof _0x312970['offset']==='undefined'&&typeof _0x312970[_0x2fbe('0x1e')]===_0x2fbe('0x1f');var _0x2df01f=_0x556a98[_0x2fbe('0x20')];var _0xdce174=_0x19d8fd?0x0:_0x312970[_0x2fbe('0x21')];var _0x5dcb09=_0x19d8fd?_0x556a98[_0x2fbe('0x20')]:_0x312970[_0x2fbe('0x21')]+_0x312970[_0x2fbe('0x1e')];var _0x258f10;if(_0x5dcb09>=_0x2df01f){_0x5dcb09=_0x2df01f;_0x258f10=0xc8;}else{_0x258f10=0xce;}_0x40a968['status'](_0x258f10);return _0x40a968[_0x2fbe('0x22')](_0x2fbe('0x23'),_0xdce174+'-'+_0x5dcb09+'/'+_0x2df01f)[_0x2fbe('0x24')](_0x556a98);}return null;};}function patchUpdates(_0x4f5b93){return function(_0x4c8f8f){try{jsonpatch[_0x2fbe('0x25')](_0x4c8f8f,_0x4f5b93,!![]);}catch(_0x1620ae){return BPromise[_0x2fbe('0x26')](_0x1620ae);}return _0x4c8f8f['save']();};}function saveUpdates(_0x227ca2,_0x1e3462){return function(_0x30e978){if(_0x30e978){return _0x30e978['update'](_0x227ca2)[_0x2fbe('0x27')](function(_0x1b1f5b){return _0x1b1f5b;});}return null;};}function removeEntity(_0x5c1315,_0x41f262){return function(_0x5ba00e){if(_0x5ba00e){return _0x5ba00e[_0x2fbe('0x28')]()[_0x2fbe('0x27')](function(){var _0x2b17c7=_0x5ba00e[_0x2fbe('0x29')]({'plain':!![]});var _0x5a93a6='IvrCampaigns';return db[_0x2fbe('0x2a')][_0x2fbe('0x28')]({'where':{'type':_0x5a93a6,'resourceId':_0x2b17c7['id']}})[_0x2fbe('0x27')](function(){return _0x5ba00e;});})[_0x2fbe('0x27')](function(){_0x5c1315[_0x2fbe('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49231f,_0xc2f521){return function(_0x3da236){if(!_0x3da236){_0x49231f[_0x2fbe('0x2b')](0x194);}return _0x3da236;};}function handleError(_0x37c090,_0x537d4e){_0x537d4e=_0x537d4e||0x1f4;return function(_0x2c954d){logger['error'](_0x2c954d[_0x2fbe('0x2c')]);if(_0x2c954d[_0x2fbe('0x2d')]){delete _0x2c954d[_0x2fbe('0x2d')];}_0x37c090[_0x2fbe('0x1c')](_0x537d4e)[_0x2fbe('0x2e')](_0x2c954d);};}exports[_0x2fbe('0x2f')]=function(_0x3fe655,_0x3b6988){var _0xccf503={},_0xef4fd={},_0x1a6312={'count':0x0,'rows':[]};var _0x280d21=_['map'](db[_0x2fbe('0x30')][_0x2fbe('0x31')],function(_0x41e769){return{'name':_0x41e769['fieldName'],'type':_0x41e769['type'][_0x2fbe('0x32')]};});_0xef4fd['model']=_[_0x2fbe('0x33')](_0x280d21,_0x2fbe('0x2d'));_0xef4fd[_0x2fbe('0x34')]=_[_0x2fbe('0x35')](_0x3fe655[_0x2fbe('0x34')]);_0xef4fd['filters']=_[_0x2fbe('0x36')](_0xef4fd[_0x2fbe('0x37')],_0xef4fd['query']);_0xccf503['attributes']=_['intersection'](_0xef4fd[_0x2fbe('0x37')],qs[_0x2fbe('0x38')](_0x3fe655['query']['fields']));_0xccf503['attributes']=_0xccf503['attributes'][_0x2fbe('0x39')]?_0xccf503[_0x2fbe('0x3a')]:_0xef4fd[_0x2fbe('0x37')];if(!_0x3fe655[_0x2fbe('0x34')][_0x2fbe('0x3b')](_0x2fbe('0x3c'))){_0xccf503[_0x2fbe('0x1e')]=qs[_0x2fbe('0x1e')](_0x3fe655[_0x2fbe('0x34')]['limit']);_0xccf503[_0x2fbe('0x21')]=qs[_0x2fbe('0x21')](_0x3fe655[_0x2fbe('0x34')][_0x2fbe('0x21')]);}_0xccf503[_0x2fbe('0x3d')]=qs[_0x2fbe('0x3e')](_0x3fe655[_0x2fbe('0x34')][_0x2fbe('0x3e')]);_0xccf503['where']=qs[_0x2fbe('0x3f')](_['pick'](_0x3fe655[_0x2fbe('0x34')],_0xef4fd[_0x2fbe('0x3f')]),_0x280d21);if(_0x3fe655[_0x2fbe('0x34')][_0x2fbe('0x40')]){_0xccf503[_0x2fbe('0x41')]=_['merge'](_0xccf503[_0x2fbe('0x41')],{'$or':_[_0x2fbe('0x33')](_0x280d21,function(_0x34127d){if(_0x34127d[_0x2fbe('0x42')]!==_0x2fbe('0x43')){var _0x371f87={};_0x371f87[_0x34127d[_0x2fbe('0x2d')]]={'$like':'%'+_0x3fe655[_0x2fbe('0x34')][_0x2fbe('0x40')]+'%'};return _0x371f87;}})});}_0xccf503=_['merge']({},_0xccf503,_0x3fe655[_0x2fbe('0x44')]);var _0x380a3b={'where':_0xccf503[_0x2fbe('0x41')]};return db[_0x2fbe('0x30')][_0x2fbe('0x20')](_0x380a3b)[_0x2fbe('0x27')](function(_0x3f9235){_0x1a6312[_0x2fbe('0x20')]=_0x3f9235;if(_0x3fe655[_0x2fbe('0x34')][_0x2fbe('0x45')]){_0xccf503['include']=[{'all':!![]}];}return db[_0x2fbe('0x30')][_0x2fbe('0x46')](_0xccf503);})[_0x2fbe('0x27')](function(_0x414c0c){_0x1a6312['rows']=_0x414c0c;return _0x1a6312;})[_0x2fbe('0x27')](respondWithFilteredResult(_0x3b6988,_0xccf503))[_0x2fbe('0x47')](handleError(_0x3b6988,null));};exports[_0x2fbe('0x48')]=function(_0x341635,_0x357edf){var _0x53b788={'raw':![],'where':{'id':_0x341635[_0x2fbe('0x49')]['id']}},_0x1b6829={};_0x1b6829[_0x2fbe('0x37')]=_[_0x2fbe('0x35')](db[_0x2fbe('0x30')][_0x2fbe('0x31')]);_0x1b6829[_0x2fbe('0x34')]=_[_0x2fbe('0x35')](_0x341635[_0x2fbe('0x34')]);_0x1b6829[_0x2fbe('0x3f')]=_['intersection'](_0x1b6829['model'],_0x1b6829['query']);_0x53b788[_0x2fbe('0x3a')]=_[_0x2fbe('0x36')](_0x1b6829[_0x2fbe('0x37')],qs['fields'](_0x341635['query']['fields']));_0x53b788[_0x2fbe('0x3a')]=_0x53b788[_0x2fbe('0x3a')][_0x2fbe('0x39')]?_0x53b788[_0x2fbe('0x3a')]:_0x1b6829[_0x2fbe('0x37')];if(_0x341635[_0x2fbe('0x34')][_0x2fbe('0x45')]){_0x53b788[_0x2fbe('0x4a')]=[{'all':!![]}];}_0x53b788=_['merge']({},_0x53b788,_0x341635[_0x2fbe('0x44')]);return db[_0x2fbe('0x30')][_0x2fbe('0x4b')](_0x53b788)[_0x2fbe('0x27')](handleEntityNotFound(_0x357edf,null))['then'](respondWithResult(_0x357edf,null))[_0x2fbe('0x47')](handleError(_0x357edf,null));};exports[_0x2fbe('0x4c')]=function(_0x47bccc,_0x4a213c){return db[_0x2fbe('0x30')]['create'](_0x47bccc[_0x2fbe('0x4d')],{})[_0x2fbe('0x27')](function(_0x55a465){var _0x5da481=_0x47bccc[_0x2fbe('0x4e')][_0x2fbe('0x29')]({'plain':!![]});if(!_0x5da481)throw new Error(_0x2fbe('0x4f'));if(_0x5da481['role']==='user'){var _0x464c48=_0x55a465[_0x2fbe('0x29')]({'plain':!![]});var _0x1dc755=_0x2fbe('0x50');return db['UserProfileSection'][_0x2fbe('0x4b')]({'where':{'name':_0x1dc755,'userProfileId':_0x5da481[_0x2fbe('0x51')]},'raw':!![]})['then'](function(_0x463b25){if(_0x463b25&&_0x463b25[_0x2fbe('0x52')]===0x0){return db[_0x2fbe('0x2a')]['create']({'name':_0x464c48[_0x2fbe('0x2d')],'resourceId':_0x464c48['id'],'type':_0x463b25['name'],'sectionId':_0x463b25['id']},{})[_0x2fbe('0x27')](function(){return _0x55a465;});}else{return _0x55a465;}})[_0x2fbe('0x47')](function(_0x2bdfb0){logger[_0x2fbe('0x53')](_0x2fbe('0x54'),_0x2bdfb0);throw _0x2bdfb0;});}return _0x55a465;})[_0x2fbe('0x27')](respondWithResult(_0x4a213c,0xc9))['catch'](handleError(_0x4a213c,null));};exports[_0x2fbe('0x55')]=function(_0x5d5a5f,_0x354369){var _0x1bf4f5={'where':{'id':_0x5d5a5f[_0x2fbe('0x49')]['id']}},_0x5f07cd={};_0x5f07cd[_0x2fbe('0x37')]=_['keys'](db['Campaign'][_0x2fbe('0x31')]);_0x1bf4f5[_0x2fbe('0x3a')]=_[_0x2fbe('0x36')](_0x5f07cd[_0x2fbe('0x37')],qs[_0x2fbe('0x38')](_0x5d5a5f[_0x2fbe('0x34')]['fields']));_0x1bf4f5['attributes']=_0x1bf4f5['attributes'][_0x2fbe('0x39')]?_0x1bf4f5[_0x2fbe('0x3a')]:_0x5f07cd[_0x2fbe('0x37')];if(_0x5d5a5f[_0x2fbe('0x34')][_0x2fbe('0x45')]){_0x1bf4f5[_0x2fbe('0x4a')]=[{'all':!![]}];}_0x1bf4f5=_[_0x2fbe('0x56')]({},_0x1bf4f5,_0x5d5a5f[_0x2fbe('0x44')]);return db[_0x2fbe('0x30')]['find'](_0x1bf4f5)[_0x2fbe('0x27')](handleEntityNotFound(_0x354369,null))[_0x2fbe('0x27')](function(_0x2b909d){if(_0x2b909d){var _0x2bbc5e=_0x2b909d[_0x2fbe('0x29')]({'plain':!![]});_0x2bbc5e=qs['omit'](_0x2bbc5e,['id',_0x2fbe('0x57'),'updatedAt']);_0x5d5a5f['body']=_[_0x2fbe('0x58')](_0x5d5a5f[_0x2fbe('0x4d')],['id',_0x2fbe('0x57'),_0x2fbe('0x59')]);return db[_0x2fbe('0x30')][_0x2fbe('0x4c')](_[_0x2fbe('0x56')](_0x2bbc5e,_0x5d5a5f[_0x2fbe('0x4d')]),{'include':_0x5d5a5f[_0x2fbe('0x34')][_0x2fbe('0x45')]?[{'all':!![]}]:undefined})[_0x2fbe('0x27')](function(_0x247c68){var _0x3da3d3=_0x5d5a5f[_0x2fbe('0x4e')][_0x2fbe('0x29')]({'plain':!![]});if(!_0x3da3d3)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3da3d3['role']===_0x2fbe('0x4e')){var _0x538207=_0x247c68[_0x2fbe('0x29')]({'plain':!![]});var _0x13f9e8='IvrCampaigns';return db[_0x2fbe('0x5a')]['find']({'where':{'name':_0x13f9e8,'userProfileId':_0x3da3d3[_0x2fbe('0x51')]},'raw':!![]})[_0x2fbe('0x27')](function(_0x415e76){if(_0x415e76&&_0x415e76[_0x2fbe('0x52')]===0x0){return db[_0x2fbe('0x2a')][_0x2fbe('0x4c')]({'name':_0x538207['name'],'resourceId':_0x538207['id'],'type':_0x415e76['name'],'sectionId':_0x415e76['id']},{})[_0x2fbe('0x27')](function(){return _0x247c68;});}else{return _0x247c68;}})[_0x2fbe('0x47')](function(_0x33a2f9){logger[_0x2fbe('0x53')](_0x2fbe('0x54'),_0x33a2f9);throw _0x33a2f9;});}return _0x247c68;});}})[_0x2fbe('0x27')](respondWithResult(_0x354369,0xc9))['catch'](handleError(_0x354369,null));};exports[_0x2fbe('0x5b')]=function(_0x451626,_0x44c18a){if(_0x451626[_0x2fbe('0x4d')]['id']){delete _0x451626['body']['id'];}return db['Campaign'][_0x2fbe('0x4b')]({'where':{'id':_0x451626['params']['id']}})['then'](handleEntityNotFound(_0x44c18a,null))[_0x2fbe('0x27')](saveUpdates(_0x451626['body'],null))[_0x2fbe('0x27')](respondWithResult(_0x44c18a,null))[_0x2fbe('0x47')](handleError(_0x44c18a,null));};exports['destroy']=function(_0x3be2b0,_0x238717){return db[_0x2fbe('0x30')][_0x2fbe('0x4b')]({'where':{'id':_0x3be2b0[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0x238717,null))[_0x2fbe('0x27')](removeEntity(_0x238717,null))[_0x2fbe('0x47')](handleError(_0x238717,null));};exports[_0x2fbe('0x5c')]=function(_0x2928e7,_0x406993,_0x3a61f6){var _0x48d0b3={'raw':!![],'where':{}};var _0x4a4f7d={};var _0x48f2cc={'count':0x0,'rows':[]};return db[_0x2fbe('0x30')][_0x2fbe('0x5d')]({'where':{'id':_0x2928e7[_0x2fbe('0x49')]['id']}})['then'](handleEntityNotFound(_0x406993,null))[_0x2fbe('0x27')](function(_0x2ab4e6){if(_0x2ab4e6){_0x4a4f7d[_0x2fbe('0x37')]=_['keys'](db[_0x2fbe('0x5e')][_0x2fbe('0x31')]);_0x4a4f7d[_0x2fbe('0x34')]=_[_0x2fbe('0x35')](_0x2928e7[_0x2fbe('0x34')]);_0x4a4f7d[_0x2fbe('0x3f')]=_[_0x2fbe('0x36')](_0x4a4f7d[_0x2fbe('0x37')],_0x4a4f7d[_0x2fbe('0x34')]);_0x48d0b3[_0x2fbe('0x3a')]=_[_0x2fbe('0x36')](_0x4a4f7d[_0x2fbe('0x37')],qs[_0x2fbe('0x38')](_0x2928e7[_0x2fbe('0x34')][_0x2fbe('0x38')]));_0x48d0b3[_0x2fbe('0x3a')]=_0x48d0b3['attributes']['length']?_0x48d0b3['attributes']:_0x4a4f7d['model'];if(!_0x2928e7[_0x2fbe('0x34')][_0x2fbe('0x3b')](_0x2fbe('0x3c'))){_0x48d0b3[_0x2fbe('0x1e')]=qs[_0x2fbe('0x1e')](_0x2928e7['query'][_0x2fbe('0x1e')]);_0x48d0b3[_0x2fbe('0x21')]=qs[_0x2fbe('0x21')](_0x2928e7[_0x2fbe('0x34')][_0x2fbe('0x21')]);}_0x48d0b3[_0x2fbe('0x3d')]=qs[_0x2fbe('0x3e')](_0x2928e7['query'][_0x2fbe('0x3e')]);_0x48d0b3[_0x2fbe('0x41')]=qs['filters'](_[_0x2fbe('0x5f')](_0x2928e7['query'],_0x4a4f7d[_0x2fbe('0x3f')]));_0x48d0b3[_0x2fbe('0x41')][_0x2fbe('0x60')]=_0x2ab4e6['id'];if(_0x2928e7[_0x2fbe('0x34')][_0x2fbe('0x40')]){_0x48d0b3[_0x2fbe('0x41')]=_['merge'](_0x48d0b3[_0x2fbe('0x41')],{'$or':_[_0x2fbe('0x33')](_0x48d0b3[_0x2fbe('0x3a')],function(_0x5ea343){var _0x145bb1={};_0x145bb1[_0x5ea343]={'$like':'%'+_0x2928e7[_0x2fbe('0x34')][_0x2fbe('0x40')]+'%'};return _0x145bb1;})});}_0x48d0b3=_[_0x2fbe('0x56')]({},_0x48d0b3,_0x2928e7[_0x2fbe('0x44')]);return db[_0x2fbe('0x5e')][_0x2fbe('0x20')]({'where':_0x48d0b3[_0x2fbe('0x41')]})['then'](function(_0x359e19){_0x48f2cc[_0x2fbe('0x20')]=_0x359e19;if(_0x2928e7[_0x2fbe('0x34')][_0x2fbe('0x45')]){_0x48d0b3[_0x2fbe('0x4a')]=[{'all':!![]}];}return db[_0x2fbe('0x5e')]['findAll'](_0x48d0b3);})[_0x2fbe('0x27')](function(_0x217bfc){_0x48f2cc[_0x2fbe('0x61')]=_0x217bfc;return _0x48f2cc;});}})[_0x2fbe('0x27')](respondWithFilteredResult(_0x406993,_0x48d0b3))['catch'](handleError(_0x406993,null));};exports[_0x2fbe('0x62')]=function(_0x2b684f,_0x31d544,_0x178468){var _0x13ccef={'raw':!![],'where':{}};var _0x166cb1={};var _0x48eab8={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x2b684f['params']['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0x31d544,null))[_0x2fbe('0x27')](function(_0x450b44){if(_0x450b44){_0x166cb1[_0x2fbe('0x37')]=_[_0x2fbe('0x35')](db[_0x2fbe('0x63')][_0x2fbe('0x31')]);_0x166cb1[_0x2fbe('0x34')]=_[_0x2fbe('0x35')](_0x2b684f[_0x2fbe('0x34')]);_0x166cb1[_0x2fbe('0x3f')]=_[_0x2fbe('0x36')](_0x166cb1[_0x2fbe('0x37')],_0x166cb1[_0x2fbe('0x34')]);_0x13ccef[_0x2fbe('0x3a')]=_['intersection'](_0x166cb1[_0x2fbe('0x37')],qs[_0x2fbe('0x38')](_0x2b684f['query'][_0x2fbe('0x38')]));_0x13ccef[_0x2fbe('0x3a')]=_0x13ccef[_0x2fbe('0x3a')][_0x2fbe('0x39')]?_0x13ccef['attributes']:_0x166cb1['model'];if(!_0x2b684f[_0x2fbe('0x34')]['hasOwnProperty'](_0x2fbe('0x3c'))){_0x13ccef[_0x2fbe('0x1e')]=qs[_0x2fbe('0x1e')](_0x2b684f[_0x2fbe('0x34')]['limit']);_0x13ccef[_0x2fbe('0x21')]=qs['offset'](_0x2b684f[_0x2fbe('0x34')][_0x2fbe('0x21')]);}_0x13ccef['order']=qs['sort'](_0x2b684f[_0x2fbe('0x34')][_0x2fbe('0x3e')]);_0x13ccef[_0x2fbe('0x41')]=qs[_0x2fbe('0x3f')](_[_0x2fbe('0x5f')](_0x2b684f[_0x2fbe('0x34')],_0x166cb1[_0x2fbe('0x3f')]));_0x13ccef[_0x2fbe('0x41')][_0x2fbe('0x60')]=_0x450b44['id'];if(_0x2b684f[_0x2fbe('0x34')]['filter']){_0x13ccef[_0x2fbe('0x41')]=_[_0x2fbe('0x56')](_0x13ccef['where'],{'$or':_[_0x2fbe('0x33')](_0x13ccef[_0x2fbe('0x3a')],function(_0x44da3f){var _0x120256={};_0x120256[_0x44da3f]={'$like':'%'+_0x2b684f[_0x2fbe('0x34')]['filter']+'%'};return _0x120256;})});}_0x13ccef=_['merge']({},_0x13ccef,_0x2b684f[_0x2fbe('0x44')]);return db[_0x2fbe('0x63')]['count']({'where':_0x13ccef[_0x2fbe('0x41')]})['then'](function(_0x15c5d3){_0x48eab8[_0x2fbe('0x20')]=_0x15c5d3;if(_0x2b684f['query'][_0x2fbe('0x45')]){_0x13ccef[_0x2fbe('0x4a')]=[{'all':!![]}];}return db[_0x2fbe('0x63')][_0x2fbe('0x46')](_0x13ccef);})['then'](function(_0x16fa0e){_0x48eab8[_0x2fbe('0x61')]=_0x16fa0e;return _0x48eab8;});}})[_0x2fbe('0x27')](respondWithFilteredResult(_0x31d544,_0x13ccef))[_0x2fbe('0x47')](handleError(_0x31d544,null));};exports[_0x2fbe('0x64')]=function(_0xfac619,_0xb677c6,_0x3cce1b){var _0x49a352={'raw':!![],'where':{}};var _0x1a9758={};var _0x1ce9ec={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xfac619[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0xb677c6,null))[_0x2fbe('0x27')](function(_0x18edec){if(_0x18edec){_0x1a9758[_0x2fbe('0x37')]=_['keys'](db[_0x2fbe('0x65')]['rawAttributes']);_0x1a9758['query']=_[_0x2fbe('0x35')](_0xfac619[_0x2fbe('0x34')]);_0x1a9758[_0x2fbe('0x3f')]=_[_0x2fbe('0x36')](_0x1a9758[_0x2fbe('0x37')],_0x1a9758[_0x2fbe('0x34')]);_0x49a352[_0x2fbe('0x3a')]=_[_0x2fbe('0x36')](_0x1a9758[_0x2fbe('0x37')],qs[_0x2fbe('0x38')](_0xfac619[_0x2fbe('0x34')][_0x2fbe('0x38')]));_0x49a352['attributes']=_0x49a352[_0x2fbe('0x3a')][_0x2fbe('0x39')]?_0x49a352[_0x2fbe('0x3a')]:_0x1a9758['model'];if(!_0xfac619['query'][_0x2fbe('0x3b')](_0x2fbe('0x3c'))){_0x49a352[_0x2fbe('0x1e')]=qs[_0x2fbe('0x1e')](_0xfac619['query'][_0x2fbe('0x1e')]);_0x49a352[_0x2fbe('0x21')]=qs[_0x2fbe('0x21')](_0xfac619['query'][_0x2fbe('0x21')]);}_0x49a352[_0x2fbe('0x3d')]=qs[_0x2fbe('0x3e')](_0xfac619['query']['sort']);_0x49a352['where']=qs[_0x2fbe('0x3f')](_[_0x2fbe('0x5f')](_0xfac619['query'],_0x1a9758['filters']));_0x49a352['where']['CampaignId']=_0x18edec['id'];if(_0xfac619['query']['filter']){_0x49a352[_0x2fbe('0x41')]=_[_0x2fbe('0x56')](_0x49a352['where'],{'$or':_[_0x2fbe('0x33')](_0x49a352[_0x2fbe('0x3a')],function(_0x383e7f){var _0x34fc88={};_0x34fc88[_0x383e7f]={'$like':'%'+_0xfac619['query'][_0x2fbe('0x40')]+'%'};return _0x34fc88;})});}_0x49a352=_[_0x2fbe('0x56')]({},_0x49a352,_0xfac619[_0x2fbe('0x44')]);return db[_0x2fbe('0x65')][_0x2fbe('0x20')]({'where':_0x49a352[_0x2fbe('0x41')]})['then'](function(_0x5bd0b8){_0x1ce9ec[_0x2fbe('0x20')]=_0x5bd0b8;if(_0xfac619[_0x2fbe('0x34')][_0x2fbe('0x45')]){_0x49a352[_0x2fbe('0x4a')]=[{'all':!![]}];}return db[_0x2fbe('0x65')][_0x2fbe('0x46')](_0x49a352);})[_0x2fbe('0x27')](function(_0x235538){_0x1ce9ec[_0x2fbe('0x61')]=_0x235538;return _0x1ce9ec;});}})[_0x2fbe('0x27')](respondWithFilteredResult(_0xb677c6,_0x49a352))[_0x2fbe('0x47')](handleError(_0xb677c6,null));};exports[_0x2fbe('0x66')]=function(_0x1820ad,_0x107e5e,_0x390e23){var _0x57036a={'raw':!![],'where':{}};var _0x2e5dc2={};var _0x2d078d={'count':0x0,'rows':[]};return db[_0x2fbe('0x30')][_0x2fbe('0x5d')]({'where':{'id':_0x1820ad[_0x2fbe('0x49')]['id']}})['then'](handleEntityNotFound(_0x107e5e,null))[_0x2fbe('0x27')](function(_0x4afad3){if(_0x4afad3){_0x2e5dc2[_0x2fbe('0x37')]=_[_0x2fbe('0x35')](db['CmHopperBlack'][_0x2fbe('0x31')]);_0x2e5dc2[_0x2fbe('0x34')]=_[_0x2fbe('0x35')](_0x1820ad[_0x2fbe('0x34')]);_0x2e5dc2['filters']=_[_0x2fbe('0x36')](_0x2e5dc2[_0x2fbe('0x37')],_0x2e5dc2['query']);_0x57036a[_0x2fbe('0x3a')]=_['intersection'](_0x2e5dc2[_0x2fbe('0x37')],qs['fields'](_0x1820ad[_0x2fbe('0x34')][_0x2fbe('0x38')]));_0x57036a[_0x2fbe('0x3a')]=_0x57036a[_0x2fbe('0x3a')][_0x2fbe('0x39')]?_0x57036a[_0x2fbe('0x3a')]:_0x2e5dc2[_0x2fbe('0x37')];if(!_0x1820ad[_0x2fbe('0x34')][_0x2fbe('0x3b')](_0x2fbe('0x3c'))){_0x57036a[_0x2fbe('0x1e')]=qs['limit'](_0x1820ad[_0x2fbe('0x34')][_0x2fbe('0x1e')]);_0x57036a[_0x2fbe('0x21')]=qs[_0x2fbe('0x21')](_0x1820ad[_0x2fbe('0x34')][_0x2fbe('0x21')]);}_0x57036a[_0x2fbe('0x3d')]=qs[_0x2fbe('0x3e')](_0x1820ad['query'][_0x2fbe('0x3e')]);_0x57036a[_0x2fbe('0x41')]=qs[_0x2fbe('0x3f')](_['pick'](_0x1820ad[_0x2fbe('0x34')],_0x2e5dc2['filters']));_0x57036a[_0x2fbe('0x41')][_0x2fbe('0x60')]=_0x4afad3['id'];if(_0x1820ad[_0x2fbe('0x34')]['filter']){_0x57036a[_0x2fbe('0x41')]=_[_0x2fbe('0x56')](_0x57036a['where'],{'$or':_[_0x2fbe('0x33')](_0x57036a[_0x2fbe('0x3a')],function(_0x1c31cf){var _0x35f033={};_0x35f033[_0x1c31cf]={'$like':'%'+_0x1820ad['query'][_0x2fbe('0x40')]+'%'};return _0x35f033;})});}_0x57036a=_[_0x2fbe('0x56')]({},_0x57036a,_0x1820ad['options']);return db[_0x2fbe('0x67')][_0x2fbe('0x20')]({'where':_0x57036a['where']})[_0x2fbe('0x27')](function(_0x4b8264){_0x2d078d[_0x2fbe('0x20')]=_0x4b8264;if(_0x1820ad[_0x2fbe('0x34')]['includeAll']){_0x57036a[_0x2fbe('0x4a')]=[{'all':!![]}];}return db[_0x2fbe('0x67')][_0x2fbe('0x46')](_0x57036a);})[_0x2fbe('0x27')](function(_0x23f848){_0x2d078d[_0x2fbe('0x61')]=_0x23f848;return _0x2d078d;});}})[_0x2fbe('0x27')](respondWithFilteredResult(_0x107e5e,_0x57036a))[_0x2fbe('0x47')](handleError(_0x107e5e,null));};exports[_0x2fbe('0x68')]=function(_0x18cb00,_0x12c3af,_0x3f76ba){var _0x2f0ad3={};var _0x5c91e5={};var _0x3db637;var _0x48870e;return db[_0x2fbe('0x30')][_0x2fbe('0x5d')]({'where':{'id':_0x18cb00[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0x12c3af,null))[_0x2fbe('0x27')](function(_0x489b68){if(_0x489b68){_0x3db637=_0x489b68;_0x5c91e5[_0x2fbe('0x37')]=_[_0x2fbe('0x35')](db[_0x2fbe('0x69')][_0x2fbe('0x31')]);_0x5c91e5['query']=_[_0x2fbe('0x35')](_0x18cb00[_0x2fbe('0x34')]);_0x5c91e5[_0x2fbe('0x3f')]=_[_0x2fbe('0x36')](_0x5c91e5[_0x2fbe('0x37')],_0x5c91e5[_0x2fbe('0x34')]);_0x2f0ad3[_0x2fbe('0x3a')]=_['intersection'](_0x5c91e5[_0x2fbe('0x37')],qs[_0x2fbe('0x38')](_0x18cb00[_0x2fbe('0x34')][_0x2fbe('0x38')]));_0x2f0ad3[_0x2fbe('0x3a')]=_0x2f0ad3[_0x2fbe('0x3a')][_0x2fbe('0x39')]?_0x2f0ad3['attributes']:_0x5c91e5[_0x2fbe('0x37')];_0x2f0ad3[_0x2fbe('0x3d')]=qs[_0x2fbe('0x3e')](_0x18cb00[_0x2fbe('0x34')][_0x2fbe('0x3e')]);_0x2f0ad3['where']=qs[_0x2fbe('0x3f')](_[_0x2fbe('0x5f')](_0x18cb00[_0x2fbe('0x34')],_0x5c91e5[_0x2fbe('0x3f')]));if(_0x18cb00[_0x2fbe('0x34')][_0x2fbe('0x40')]){_0x2f0ad3[_0x2fbe('0x41')]=_[_0x2fbe('0x56')](_0x2f0ad3['where'],{'$or':_['map'](_0x2f0ad3[_0x2fbe('0x3a')],function(_0x581469){var _0xfbe1c6={};_0xfbe1c6[_0x581469]={'$like':'%'+_0x18cb00[_0x2fbe('0x34')][_0x2fbe('0x40')]+'%'};return _0xfbe1c6;})});}_0x2f0ad3=_[_0x2fbe('0x56')]({},_0x2f0ad3,_0x18cb00[_0x2fbe('0x44')]);return _0x3db637[_0x2fbe('0x68')](_0x2f0ad3);}})[_0x2fbe('0x27')](function(_0x4d07fa){if(_0x4d07fa){_0x48870e=_0x4d07fa['length'];if(!_0x18cb00['query'][_0x2fbe('0x3b')](_0x2fbe('0x3c'))){_0x2f0ad3[_0x2fbe('0x1e')]=qs['limit'](_0x18cb00['query'][_0x2fbe('0x1e')]);_0x2f0ad3[_0x2fbe('0x21')]=qs['offset'](_0x18cb00[_0x2fbe('0x34')]['offset']);}return _0x3db637[_0x2fbe('0x68')](_0x2f0ad3);}})['then'](function(_0x54b29){if(_0x54b29){return _0x54b29?{'count':_0x48870e,'rows':_0x54b29}:null;}})[_0x2fbe('0x27')](respondWithResult(_0x12c3af,null))[_0x2fbe('0x47')](handleError(_0x12c3af,null));};exports['addLists']=function(_0x330f1c,_0x70d4ff,_0x59e5dd){var _0x363c0c,_0x49286a;var _0x36baed=[];var _0x110e46=moment()[_0x2fbe('0x6a')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x2fbe('0x30')][_0x2fbe('0x4b')]({'where':{'id':_0x330f1c[_0x2fbe('0x49')]['id']}})['then'](handleEntityNotFound(_0x70d4ff,null))[_0x2fbe('0x27')](function(_0x5129ef){if(_0x5129ef){_0x49286a=_0x5129ef;return _0x5129ef[_0x2fbe('0x6b')](_0x330f1c[_0x2fbe('0x4d')][_0x2fbe('0x6c')],_[_0x2fbe('0x58')](_0x330f1c[_0x2fbe('0x4d')],[_0x2fbe('0x6c'),'id'])||{});}return null;})[_0x2fbe('0x6d')](function(_0x9b3edb){var _0xa9bef6;var _0x24fa09;_0x363c0c=_0x9b3edb||[];var _0x4e704c=[];if(_0x9b3edb){for(var _0x604c0=0x0;_0x604c0<_0x9b3edb['length'];_0x604c0+=0x1){var _0x48f779=_0x9b3edb[_0x604c0][_0x2fbe('0x29')]({'plain':!![]});_0x49286a[_0x2fbe('0x6e')]=_0x330f1c['body'][_0x2fbe('0x6e')]?_0x330f1c[_0x2fbe('0x4d')][_0x2fbe('0x6e')]:_0x49286a['dialCheckDuplicateType'];switch(_0x49286a[_0x2fbe('0x6e')]){case _0x2fbe('0x6f'):_0xa9bef6=squel[_0x2fbe('0x70')]()[_0x2fbe('0x71')](_0x2fbe('0x72'))[_0x2fbe('0x73')](['phone',_0x2fbe('0x74'),_0x2fbe('0x75'),'ListId',_0x2fbe('0x60'),'createdAt','updatedAt'],squel[_0x2fbe('0x76')]()[_0x2fbe('0x77')]('phone',_0x2fbe('0x78'))[_0x2fbe('0x77')]('NOW()',_0x2fbe('0x74'))[_0x2fbe('0x77')]('id',_0x2fbe('0x75'))[_0x2fbe('0x77')](_0x48f779['CmListId'][_0x2fbe('0x79')](),_0x2fbe('0x7a'))[_0x2fbe('0x77')](_0x330f1c[_0x2fbe('0x49')]['id'][_0x2fbe('0x79')](),_0x2fbe('0x60'))[_0x2fbe('0x77')]('\x27'+_0x110e46+'\x27','createdAt')['field']('\x27'+_0x110e46+'\x27',_0x2fbe('0x59'))[_0x2fbe('0x7b')](_0x2fbe('0x7c'))[_0x2fbe('0x41')]('deletedAt\x20IS\x20NULL')[_0x2fbe('0x41')](_0x2fbe('0x7d'),_0x48f779[_0x2fbe('0x7e')][_0x2fbe('0x79')]())['where'](_0x2fbe('0x7f'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x2fbe('0x76')]()['field'](_0x2fbe('0x80'))['from']('cm_hopper_final')[_0x2fbe('0x41')](_0x2fbe('0x81'),_0x330f1c['params']['id'][_0x2fbe('0x79')]()))[_0x2fbe('0x41')](_0x2fbe('0x82'),squel[_0x2fbe('0x76')]()[_0x2fbe('0x77')](_0x2fbe('0x83'))[_0x2fbe('0x7b')](_0x2fbe('0x72'))[_0x2fbe('0x41')](_0x2fbe('0x81'),_0x330f1c[_0x2fbe('0x49')]['id'][_0x2fbe('0x79')]())))[_0x2fbe('0x79')]();break;case _0x2fbe('0x84'):_0xa9bef6=squel[_0x2fbe('0x70')]()[_0x2fbe('0x71')]('cm_hopper')[_0x2fbe('0x73')]([_0x2fbe('0x78'),'scheduledAt',_0x2fbe('0x75'),_0x2fbe('0x7a'),_0x2fbe('0x60'),_0x2fbe('0x57'),_0x2fbe('0x59')],squel[_0x2fbe('0x76')]()[_0x2fbe('0x77')]('phone','phone')[_0x2fbe('0x77')](_0x2fbe('0x85'),_0x2fbe('0x74'))[_0x2fbe('0x77')]('id','ContactId')['field'](_0x48f779['CmListId'][_0x2fbe('0x79')](),_0x2fbe('0x7a'))['field'](_0x330f1c[_0x2fbe('0x49')]['id'][_0x2fbe('0x79')](),_0x2fbe('0x60'))[_0x2fbe('0x77')]('\x27'+_0x110e46+'\x27','createdAt')[_0x2fbe('0x77')]('\x27'+_0x110e46+'\x27',_0x2fbe('0x59'))[_0x2fbe('0x7b')](_0x2fbe('0x7c'))[_0x2fbe('0x41')](_0x2fbe('0x86'))['where'](_0x2fbe('0x7d'),_0x48f779[_0x2fbe('0x7e')][_0x2fbe('0x79')]())[_0x2fbe('0x41')](_0x2fbe('0x7f'))[_0x2fbe('0x41')](_0x2fbe('0x82'),squel[_0x2fbe('0x76')]()[_0x2fbe('0x77')]('COALESCE(phone,\x27\x27)')[_0x2fbe('0x7b')](_0x2fbe('0x72'))[_0x2fbe('0x41')](_0x2fbe('0x81'),_0x330f1c[_0x2fbe('0x49')]['id']['toString']())))[_0x2fbe('0x79')]();break;default:_0xa9bef6=squel[_0x2fbe('0x70')]()[_0x2fbe('0x71')](_0x2fbe('0x72'))[_0x2fbe('0x73')]([_0x2fbe('0x78'),_0x2fbe('0x74'),'ContactId',_0x2fbe('0x7a'),_0x2fbe('0x60'),_0x2fbe('0x57'),_0x2fbe('0x59')],squel[_0x2fbe('0x76')]()[_0x2fbe('0x77')](_0x2fbe('0x78'),_0x2fbe('0x78'))[_0x2fbe('0x77')](_0x2fbe('0x85'),_0x2fbe('0x74'))[_0x2fbe('0x77')]('id',_0x2fbe('0x75'))[_0x2fbe('0x77')](_0x48f779[_0x2fbe('0x7e')][_0x2fbe('0x79')](),'ListId')['field'](_0x330f1c[_0x2fbe('0x49')]['id'][_0x2fbe('0x79')](),_0x2fbe('0x60'))[_0x2fbe('0x77')]('\x27'+_0x110e46+'\x27',_0x2fbe('0x57'))[_0x2fbe('0x77')]('\x27'+_0x110e46+'\x27',_0x2fbe('0x59'))['from'](_0x2fbe('0x7c'))[_0x2fbe('0x41')](_0x2fbe('0x86'))[_0x2fbe('0x41')](_0x2fbe('0x7d'),_0x48f779[_0x2fbe('0x7e')][_0x2fbe('0x79')]())[_0x2fbe('0x41')](_0x2fbe('0x7f')))[_0x2fbe('0x79')]();}_0x24fa09=squel[_0x2fbe('0x70')]()[_0x2fbe('0x71')](_0x2fbe('0x87'))['fromQuery']([_0x2fbe('0x88'),_0x2fbe('0x74'),_0x2fbe('0x78'),_0x2fbe('0x89'),_0x2fbe('0x57'),_0x2fbe('0x59')],squel[_0x2fbe('0x76')]()[_0x2fbe('0x77')](_0x2fbe('0x8a'),'id')['field'](_0x2fbe('0x85'),'scheduledAt')[_0x2fbe('0x77')](_0x2fbe('0x8b'),'phone')['field'](_0x2fbe('0x8c'),_0x2fbe('0x89'))[_0x2fbe('0x77')]('\x27'+_0x110e46+'\x27',_0x2fbe('0x57'))[_0x2fbe('0x77')]('\x27'+_0x110e46+'\x27',_0x2fbe('0x59'))['from'](_0x2fbe('0x8d'),'ci')['join'](_0x2fbe('0x72'),'h','h.ContactId\x20=\x20ci.CmContactId')[_0x2fbe('0x41')](_0x2fbe('0x8e'),_0x48f779[_0x2fbe('0x7e')]['toString']())[_0x2fbe('0x41')](_0x2fbe('0x8f'),_0x330f1c[_0x2fbe('0x49')]['id'][_0x2fbe('0x79')]())[_0x2fbe('0x41')](_0x2fbe('0x90'),_0x110e46))[_0x2fbe('0x79')]();_0x4e704c[_0x2fbe('0x91')](db[_0x2fbe('0x92')][_0x2fbe('0x34')](_0xa9bef6));_0x36baed[_0x2fbe('0x91')](db[_0x2fbe('0x92')]['query'](_0x24fa09));}return BPromise['all'](_0x4e704c);}})[_0x2fbe('0x27')](function(){return BPromise[_0x2fbe('0x93')](_0x36baed);})['then'](function(){return _0x363c0c;})[_0x2fbe('0x27')](respondWithResult(_0x70d4ff,null))[_0x2fbe('0x47')](handleError(_0x70d4ff,null));};exports[_0x2fbe('0x94')]=function(_0x201a9a,_0x30436f,_0x20c964){return db['Campaign'][_0x2fbe('0x4b')]({'where':{'id':_0x201a9a[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0x30436f,null))[_0x2fbe('0x27')](function(_0x430e2c){if(_0x430e2c){return _0x430e2c[_0x2fbe('0x94')](_0x201a9a[_0x2fbe('0x34')][_0x2fbe('0x6c')]);}})[_0x2fbe('0x27')](function(_0x4b5b61){if(_0x4b5b61){return db[_0x2fbe('0x5e')]['destroy']({'where':{'ListId':_0x201a9a[_0x2fbe('0x34')][_0x2fbe('0x6c')],'CampaignId':_0x201a9a[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](function(){return _0x4b5b61;});}})[_0x2fbe('0x27')](respondWithStatusCode(_0x30436f,null))['catch'](handleError(_0x30436f,null));};exports[_0x2fbe('0x95')]=function(_0x5554de,_0x215056,_0x5cbdab){var _0x3a4431={};var _0x5447cc={};var _0x5db802;var _0x3b30d9;return db[_0x2fbe('0x30')][_0x2fbe('0x5d')]({'where':{'id':_0x5554de[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0x215056,null))[_0x2fbe('0x27')](function(_0x25bb48){if(_0x25bb48){_0x5db802=_0x25bb48;_0x5447cc[_0x2fbe('0x37')]=_[_0x2fbe('0x35')](db[_0x2fbe('0x69')][_0x2fbe('0x31')]);_0x5447cc[_0x2fbe('0x34')]=_['keys'](_0x5554de[_0x2fbe('0x34')]);_0x5447cc['filters']=_[_0x2fbe('0x36')](_0x5447cc[_0x2fbe('0x37')],_0x5447cc[_0x2fbe('0x34')]);_0x3a4431[_0x2fbe('0x3a')]=_['intersection'](_0x5447cc[_0x2fbe('0x37')],qs[_0x2fbe('0x38')](_0x5554de[_0x2fbe('0x34')][_0x2fbe('0x38')]));_0x3a4431[_0x2fbe('0x3a')]=_0x3a4431[_0x2fbe('0x3a')][_0x2fbe('0x39')]?_0x3a4431[_0x2fbe('0x3a')]:_0x5447cc[_0x2fbe('0x37')];_0x3a4431[_0x2fbe('0x3d')]=qs[_0x2fbe('0x3e')](_0x5554de[_0x2fbe('0x34')]['sort']);_0x3a4431['where']=qs['filters'](_[_0x2fbe('0x5f')](_0x5554de[_0x2fbe('0x34')],_0x5447cc[_0x2fbe('0x3f')]));if(_0x5554de[_0x2fbe('0x34')][_0x2fbe('0x40')]){_0x3a4431[_0x2fbe('0x41')]=_[_0x2fbe('0x56')](_0x3a4431[_0x2fbe('0x41')],{'$or':_[_0x2fbe('0x33')](_0x3a4431[_0x2fbe('0x3a')],function(_0x27fa67){var _0x5086c1={};_0x5086c1[_0x27fa67]={'$like':'%'+_0x5554de[_0x2fbe('0x34')][_0x2fbe('0x40')]+'%'};return _0x5086c1;})});}_0x3a4431=_[_0x2fbe('0x56')]({},_0x3a4431,_0x5554de[_0x2fbe('0x44')]);return _0x5db802[_0x2fbe('0x95')](_0x3a4431);}})[_0x2fbe('0x27')](function(_0x21f1d7){if(_0x21f1d7){_0x3b30d9=_0x21f1d7[_0x2fbe('0x39')];if(!_0x5554de[_0x2fbe('0x34')][_0x2fbe('0x3b')](_0x2fbe('0x3c'))){_0x3a4431[_0x2fbe('0x1e')]=qs[_0x2fbe('0x1e')](_0x5554de[_0x2fbe('0x34')][_0x2fbe('0x1e')]);_0x3a4431['offset']=qs[_0x2fbe('0x21')](_0x5554de[_0x2fbe('0x34')][_0x2fbe('0x21')]);}return _0x5db802[_0x2fbe('0x95')](_0x3a4431);}})['then'](function(_0x566f45){if(_0x566f45){return _0x566f45?{'count':_0x3b30d9,'rows':_0x566f45}:null;}})[_0x2fbe('0x27')](respondWithResult(_0x215056,null))[_0x2fbe('0x47')](handleError(_0x215056,null));};exports[_0x2fbe('0x96')]=function(_0x19275e,_0x527f64,_0x395da3){var _0x34bf2c,_0x53eed9;var _0x68cec0=[];var _0x23f763=moment()['format'](_0x2fbe('0x97'));return db[_0x2fbe('0x30')][_0x2fbe('0x4b')]({'where':{'id':_0x19275e['params']['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0x527f64,null))['then'](function(_0x5062e3){if(_0x5062e3){_0x53eed9=_0x5062e3;return _0x5062e3['addBlackLists'](_0x19275e[_0x2fbe('0x4d')][_0x2fbe('0x6c')],_[_0x2fbe('0x58')](_0x19275e[_0x2fbe('0x4d')],[_0x2fbe('0x6c'),'id'])||{});}return null;})[_0x2fbe('0x6d')](function(_0x5b2836){var _0x20cc60;var _0x313a6c;_0x34bf2c=_0x5b2836||[];var _0x3b56ef=[];if(_0x5b2836){for(var _0x346897=0x0;_0x346897<_0x5b2836[_0x2fbe('0x39')];_0x346897+=0x1){var _0x3cfd5f=_0x5b2836[_0x346897][_0x2fbe('0x29')]({'plain':!![]});_0x20cc60=squel[_0x2fbe('0x70')]()[_0x2fbe('0x71')](_0x2fbe('0x98'))[_0x2fbe('0x73')](['phone','ContactId',_0x2fbe('0x7a'),_0x2fbe('0x60'),_0x2fbe('0x57'),_0x2fbe('0x59')],squel[_0x2fbe('0x76')]()[_0x2fbe('0x77')](_0x2fbe('0x78'),_0x2fbe('0x78'))['field']('id',_0x2fbe('0x75'))['field'](_0x3cfd5f[_0x2fbe('0x7e')][_0x2fbe('0x79')](),'ListId')[_0x2fbe('0x77')](_0x19275e['params']['id'][_0x2fbe('0x79')](),_0x2fbe('0x60'))[_0x2fbe('0x77')](_0x2fbe('0x85'),_0x2fbe('0x57'))['field'](_0x2fbe('0x85'),_0x2fbe('0x59'))[_0x2fbe('0x7b')](_0x2fbe('0x7c'))[_0x2fbe('0x41')]('deletedAt\x20IS\x20NULL')[_0x2fbe('0x41')](_0x2fbe('0x7d'),_0x3cfd5f['CmListId'][_0x2fbe('0x79')]())[_0x2fbe('0x41')](_0x2fbe('0x7f')))[_0x2fbe('0x79')]();_0x3b56ef[_0x2fbe('0x91')](db[_0x2fbe('0x92')][_0x2fbe('0x34')](_0x20cc60));}return BPromise[_0x2fbe('0x93')](_0x3b56ef);}})['then'](function(){return _0x34bf2c;})[_0x2fbe('0x27')](respondWithResult(_0x527f64,null))['catch'](handleError(_0x527f64,null));};exports[_0x2fbe('0x99')]=function(_0x4b10e9,_0x5e34e3,_0x1648f9){return db[_0x2fbe('0x30')][_0x2fbe('0x4b')]({'where':{'id':_0x4b10e9[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](handleEntityNotFound(_0x5e34e3,null))[_0x2fbe('0x27')](function(_0x46a67b){if(_0x46a67b){return _0x46a67b[_0x2fbe('0x99')](_0x4b10e9[_0x2fbe('0x34')]['ids']);}})[_0x2fbe('0x27')](function(_0x3846a8){if(_0x3846a8){return db[_0x2fbe('0x67')]['destroy']({'where':{'ListId':_0x4b10e9[_0x2fbe('0x34')][_0x2fbe('0x6c')],'CampaignId':_0x4b10e9[_0x2fbe('0x49')]['id']}})[_0x2fbe('0x27')](function(){return _0x3846a8;});}})[_0x2fbe('0x27')](respondWithStatusCode(_0x5e34e3,null))[_0x2fbe('0x47')](handleError(_0x5e34e3,null));}; \ No newline at end of file +var _0xaf4c=['insert','into','cm_hopper','fromQuery','phone','ContactId','ListId','select','field','NOW()','scheduledAt','CmListId','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','toString','onlyIfOpen','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','removeLists','getBlackLists','CmList','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','all','removeBlackLists','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','count','set','Content-Range','json','apply','save','update','destroy','then','get','IvrCampaigns','UserProfileResource','end','stack','name','send','index','Campaign','type','key','model','map','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','fields','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','error','getHoppers','CmHopper','order','CampaignId','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','format','addLists','ids','spread','dialCheckDuplicateType','always'];(function(_0x7c231a,_0x23595c){var _0x33fcaa=function(_0x1708a2){while(--_0x1708a2){_0x7c231a['push'](_0x7c231a['shift']());}};_0x33fcaa(++_0x23595c);}(_0xaf4c,0x1ed));var _0xcaf4=function(_0x2aa517,_0x438f4e){_0x2aa517=_0x2aa517-0x0;var _0xe57d50=_0xaf4c[_0x2aa517];return _0xe57d50;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcaf4('0x0'));var zipdir=require(_0xcaf4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcaf4('0x2'));var moment=require(_0xcaf4('0x3'));var BPromise=require(_0xcaf4('0x4'));var Mustache=require('mustache');var util=require(_0xcaf4('0x5'));var path=require(_0xcaf4('0x6'));var sox=require(_0xcaf4('0x7'));var csv=require('to-csv');var ejs=require(_0xcaf4('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcaf4('0x9'));var squel=require(_0xcaf4('0xa'));var crypto=require(_0xcaf4('0xb'));var jsforce=require(_0xcaf4('0xc'));var deskjs=require(_0xcaf4('0xd'));var toCsv=require(_0xcaf4('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcaf4('0xf'));var authService=require(_0xcaf4('0x10'));var qs=require(_0xcaf4('0x11'));var as=require(_0xcaf4('0x12'));var hardwareService=require(_0xcaf4('0x13'));var logger=require(_0xcaf4('0x14'))(_0xcaf4('0x15'));var utils=require(_0xcaf4('0x16'));var config=require(_0xcaf4('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xcaf4('0x18'))['db'];function respondWithStatusCode(_0x41486c,_0x4d270c){_0x4d270c=_0x4d270c||0xcc;return function(_0x308173){if(_0x308173){return _0x41486c[_0xcaf4('0x19')](_0x4d270c);}return _0x41486c[_0xcaf4('0x1a')](_0x4d270c)['end']();};}function respondWithResult(_0x3738b7,_0x2ad48b){_0x2ad48b=_0x2ad48b||0xc8;return function(_0x593c44){if(_0x593c44){return _0x3738b7[_0xcaf4('0x1a')](_0x2ad48b)['json'](_0x593c44);}};}function respondWithFilteredResult(_0x2a1243,_0x191f38){return function(_0x67532a){if(_0x67532a){var _0x1ec93e=typeof _0x191f38[_0xcaf4('0x1b')]===_0xcaf4('0x1c')&&typeof _0x191f38['limit']===_0xcaf4('0x1c');var _0x488bac=_0x67532a[_0xcaf4('0x1d')];var _0x5bb3b5=_0x1ec93e?0x0:_0x191f38[_0xcaf4('0x1b')];var _0x36c34c=_0x1ec93e?_0x67532a[_0xcaf4('0x1d')]:_0x191f38['offset']+_0x191f38['limit'];var _0x1ddae3;if(_0x36c34c>=_0x488bac){_0x36c34c=_0x488bac;_0x1ddae3=0xc8;}else{_0x1ddae3=0xce;}_0x2a1243[_0xcaf4('0x1a')](_0x1ddae3);return _0x2a1243[_0xcaf4('0x1e')](_0xcaf4('0x1f'),_0x5bb3b5+'-'+_0x36c34c+'/'+_0x488bac)[_0xcaf4('0x20')](_0x67532a);}return null;};}function patchUpdates(_0x596997){return function(_0x42d129){try{jsonpatch[_0xcaf4('0x21')](_0x42d129,_0x596997,!![]);}catch(_0x3f6172){return BPromise['reject'](_0x3f6172);}return _0x42d129[_0xcaf4('0x22')]();};}function saveUpdates(_0x2b500b,_0x39ff5d){return function(_0x5b6525){if(_0x5b6525){return _0x5b6525[_0xcaf4('0x23')](_0x2b500b)['then'](function(_0x2be740){return _0x2be740;});}return null;};}function removeEntity(_0x3fb28a,_0x1d9f77){return function(_0x5e4af3){if(_0x5e4af3){return _0x5e4af3[_0xcaf4('0x24')]()[_0xcaf4('0x25')](function(){var _0x116349=_0x5e4af3[_0xcaf4('0x26')]({'plain':!![]});var _0x4c3485=_0xcaf4('0x27');return db[_0xcaf4('0x28')]['destroy']({'where':{'type':_0x4c3485,'resourceId':_0x116349['id']}})[_0xcaf4('0x25')](function(){return _0x5e4af3;});})[_0xcaf4('0x25')](function(){_0x3fb28a[_0xcaf4('0x1a')](0xcc)[_0xcaf4('0x29')]();});}};}function handleEntityNotFound(_0x25beed,_0x1dbe80){return function(_0x10765c){if(!_0x10765c){_0x25beed['sendStatus'](0x194);}return _0x10765c;};}function handleError(_0x4183e2,_0x16b3b8){_0x16b3b8=_0x16b3b8||0x1f4;return function(_0x237077){logger['error'](_0x237077[_0xcaf4('0x2a')]);if(_0x237077[_0xcaf4('0x2b')]){delete _0x237077[_0xcaf4('0x2b')];}_0x4183e2[_0xcaf4('0x1a')](_0x16b3b8)[_0xcaf4('0x2c')](_0x237077);};}exports[_0xcaf4('0x2d')]=function(_0x31322d,_0x52ee2a){var _0x8126a7={},_0x5c355e={},_0x5af341={'count':0x0,'rows':[]};var _0x6f6cae=_['map'](db[_0xcaf4('0x2e')]['rawAttributes'],function(_0xf616c7){return{'name':_0xf616c7['fieldName'],'type':_0xf616c7[_0xcaf4('0x2f')][_0xcaf4('0x30')]};});_0x5c355e[_0xcaf4('0x31')]=_[_0xcaf4('0x32')](_0x6f6cae,_0xcaf4('0x2b'));_0x5c355e[_0xcaf4('0x33')]=_[_0xcaf4('0x34')](_0x31322d[_0xcaf4('0x33')]);_0x5c355e['filters']=_[_0xcaf4('0x35')](_0x5c355e[_0xcaf4('0x31')],_0x5c355e[_0xcaf4('0x33')]);_0x8126a7[_0xcaf4('0x36')]=_[_0xcaf4('0x35')](_0x5c355e['model'],qs['fields'](_0x31322d['query']['fields']));_0x8126a7['attributes']=_0x8126a7[_0xcaf4('0x36')][_0xcaf4('0x37')]?_0x8126a7[_0xcaf4('0x36')]:_0x5c355e['model'];if(!_0x31322d[_0xcaf4('0x33')][_0xcaf4('0x38')](_0xcaf4('0x39'))){_0x8126a7[_0xcaf4('0x3a')]=qs['limit'](_0x31322d['query']['limit']);_0x8126a7['offset']=qs['offset'](_0x31322d[_0xcaf4('0x33')][_0xcaf4('0x1b')]);}_0x8126a7['order']=qs[_0xcaf4('0x3b')](_0x31322d[_0xcaf4('0x33')]['sort']);_0x8126a7[_0xcaf4('0x3c')]=qs[_0xcaf4('0x3d')](_[_0xcaf4('0x3e')](_0x31322d['query'],_0x5c355e['filters']),_0x6f6cae);if(_0x31322d[_0xcaf4('0x33')][_0xcaf4('0x3f')]){_0x8126a7[_0xcaf4('0x3c')]=_[_0xcaf4('0x40')](_0x8126a7['where'],{'$or':_[_0xcaf4('0x32')](_0x6f6cae,function(_0x23c725){if(_0x23c725[_0xcaf4('0x2f')]!=='VIRTUAL'){var _0x3c4d63={};_0x3c4d63[_0x23c725[_0xcaf4('0x2b')]]={'$like':'%'+_0x31322d[_0xcaf4('0x33')][_0xcaf4('0x3f')]+'%'};return _0x3c4d63;}})});}_0x8126a7=_[_0xcaf4('0x40')]({},_0x8126a7,_0x31322d[_0xcaf4('0x41')]);var _0x4dccd1={'where':_0x8126a7['where']};return db[_0xcaf4('0x2e')][_0xcaf4('0x1d')](_0x4dccd1)['then'](function(_0xda0fde){_0x5af341[_0xcaf4('0x1d')]=_0xda0fde;if(_0x31322d[_0xcaf4('0x33')][_0xcaf4('0x42')]){_0x8126a7[_0xcaf4('0x43')]=[{'all':!![]}];}return db['Campaign'][_0xcaf4('0x44')](_0x8126a7);})[_0xcaf4('0x25')](function(_0x340566){_0x5af341[_0xcaf4('0x45')]=_0x340566;return _0x5af341;})[_0xcaf4('0x25')](respondWithFilteredResult(_0x52ee2a,_0x8126a7))['catch'](handleError(_0x52ee2a,null));};exports[_0xcaf4('0x46')]=function(_0x35962e,_0x26c963){var _0x5bc6e2={'raw':![],'where':{'id':_0x35962e[_0xcaf4('0x47')]['id']}},_0x34d8ea={};_0x34d8ea['model']=_[_0xcaf4('0x34')](db[_0xcaf4('0x2e')][_0xcaf4('0x48')]);_0x34d8ea['query']=_[_0xcaf4('0x34')](_0x35962e[_0xcaf4('0x33')]);_0x34d8ea[_0xcaf4('0x3d')]=_[_0xcaf4('0x35')](_0x34d8ea[_0xcaf4('0x31')],_0x34d8ea[_0xcaf4('0x33')]);_0x5bc6e2[_0xcaf4('0x36')]=_['intersection'](_0x34d8ea[_0xcaf4('0x31')],qs[_0xcaf4('0x49')](_0x35962e[_0xcaf4('0x33')][_0xcaf4('0x49')]));_0x5bc6e2[_0xcaf4('0x36')]=_0x5bc6e2[_0xcaf4('0x36')][_0xcaf4('0x37')]?_0x5bc6e2[_0xcaf4('0x36')]:_0x34d8ea[_0xcaf4('0x31')];if(_0x35962e['query']['includeAll']){_0x5bc6e2[_0xcaf4('0x43')]=[{'all':!![]}];}_0x5bc6e2=_[_0xcaf4('0x40')]({},_0x5bc6e2,_0x35962e[_0xcaf4('0x41')]);return db[_0xcaf4('0x2e')]['find'](_0x5bc6e2)['then'](handleEntityNotFound(_0x26c963,null))[_0xcaf4('0x25')](respondWithResult(_0x26c963,null))[_0xcaf4('0x4a')](handleError(_0x26c963,null));};exports['create']=function(_0x179d26,_0x37a2ba){return db[_0xcaf4('0x2e')][_0xcaf4('0x4b')](_0x179d26[_0xcaf4('0x4c')],{})[_0xcaf4('0x25')](function(_0x6efd8d){var _0x3f32a5=_0x179d26['user']['get']({'plain':!![]});if(!_0x3f32a5)throw new Error(_0xcaf4('0x4d'));if(_0x3f32a5[_0xcaf4('0x4e')]===_0xcaf4('0x4f')){var _0x4f2e01=_0x6efd8d[_0xcaf4('0x26')]({'plain':!![]});var _0x2d35be='IvrCampaigns';return db[_0xcaf4('0x50')][_0xcaf4('0x51')]({'where':{'name':_0x2d35be,'userProfileId':_0x3f32a5[_0xcaf4('0x52')]},'raw':!![]})[_0xcaf4('0x25')](function(_0x403922){if(_0x403922&&_0x403922[_0xcaf4('0x53')]===0x0){return db['UserProfileResource'][_0xcaf4('0x4b')]({'name':_0x4f2e01[_0xcaf4('0x2b')],'resourceId':_0x4f2e01['id'],'type':_0x403922['name'],'sectionId':_0x403922['id']},{})[_0xcaf4('0x25')](function(){return _0x6efd8d;});}else{return _0x6efd8d;}})['catch'](function(_0x51c928){logger['error'](_0xcaf4('0x54'),_0x51c928);throw _0x51c928;});}return _0x6efd8d;})[_0xcaf4('0x25')](respondWithResult(_0x37a2ba,0xc9))[_0xcaf4('0x4a')](handleError(_0x37a2ba,null));};exports[_0xcaf4('0x55')]=function(_0x35de1f,_0x2b1ee7){var _0x5d5b92={'where':{'id':_0x35de1f[_0xcaf4('0x47')]['id']}},_0x561864={};_0x561864[_0xcaf4('0x31')]=_['keys'](db[_0xcaf4('0x2e')][_0xcaf4('0x48')]);_0x5d5b92[_0xcaf4('0x36')]=_[_0xcaf4('0x35')](_0x561864[_0xcaf4('0x31')],qs[_0xcaf4('0x49')](_0x35de1f['query'][_0xcaf4('0x49')]));_0x5d5b92['attributes']=_0x5d5b92['attributes'][_0xcaf4('0x37')]?_0x5d5b92['attributes']:_0x561864[_0xcaf4('0x31')];if(_0x35de1f['query'][_0xcaf4('0x42')]){_0x5d5b92[_0xcaf4('0x43')]=[{'all':!![]}];}_0x5d5b92=_[_0xcaf4('0x40')]({},_0x5d5b92,_0x35de1f['options']);return db[_0xcaf4('0x2e')][_0xcaf4('0x51')](_0x5d5b92)[_0xcaf4('0x25')](handleEntityNotFound(_0x2b1ee7,null))[_0xcaf4('0x25')](function(_0x3ead01){if(_0x3ead01){var _0xae6cbc=_0x3ead01[_0xcaf4('0x26')]({'plain':!![]});_0xae6cbc=qs[_0xcaf4('0x56')](_0xae6cbc,['id',_0xcaf4('0x57'),'updatedAt']);_0x35de1f[_0xcaf4('0x4c')]=_['omit'](_0x35de1f[_0xcaf4('0x4c')],['id',_0xcaf4('0x57'),_0xcaf4('0x58')]);return db[_0xcaf4('0x2e')][_0xcaf4('0x4b')](_[_0xcaf4('0x40')](_0xae6cbc,_0x35de1f[_0xcaf4('0x4c')]),{'include':_0x35de1f[_0xcaf4('0x33')]['includeAll']?[{'all':!![]}]:undefined})[_0xcaf4('0x25')](function(_0x20448){var _0xb26e05=_0x35de1f[_0xcaf4('0x4f')][_0xcaf4('0x26')]({'plain':!![]});if(!_0xb26e05)throw new Error(_0xcaf4('0x4d'));if(_0xb26e05[_0xcaf4('0x4e')]===_0xcaf4('0x4f')){var _0x568e8c=_0x20448[_0xcaf4('0x26')]({'plain':!![]});var _0x386f09=_0xcaf4('0x27');return db[_0xcaf4('0x50')][_0xcaf4('0x51')]({'where':{'name':_0x386f09,'userProfileId':_0xb26e05[_0xcaf4('0x52')]},'raw':!![]})[_0xcaf4('0x25')](function(_0x2449d8){if(_0x2449d8&&_0x2449d8[_0xcaf4('0x53')]===0x0){return db[_0xcaf4('0x28')][_0xcaf4('0x4b')]({'name':_0x568e8c[_0xcaf4('0x2b')],'resourceId':_0x568e8c['id'],'type':_0x2449d8['name'],'sectionId':_0x2449d8['id']},{})[_0xcaf4('0x25')](function(){return _0x20448;});}else{return _0x20448;}})[_0xcaf4('0x4a')](function(_0x1b000b){logger[_0xcaf4('0x59')](_0xcaf4('0x54'),_0x1b000b);throw _0x1b000b;});}return _0x20448;});}})['then'](respondWithResult(_0x2b1ee7,0xc9))[_0xcaf4('0x4a')](handleError(_0x2b1ee7,null));};exports[_0xcaf4('0x23')]=function(_0x429b7a,_0x1a6f19){if(_0x429b7a[_0xcaf4('0x4c')]['id']){delete _0x429b7a['body']['id'];}return db['Campaign'][_0xcaf4('0x51')]({'where':{'id':_0x429b7a[_0xcaf4('0x47')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x1a6f19,null))['then'](saveUpdates(_0x429b7a[_0xcaf4('0x4c')],null))[_0xcaf4('0x25')](respondWithResult(_0x1a6f19,null))['catch'](handleError(_0x1a6f19,null));};exports[_0xcaf4('0x24')]=function(_0x4b50e0,_0x3e6417){return db['Campaign'][_0xcaf4('0x51')]({'where':{'id':_0x4b50e0[_0xcaf4('0x47')]['id']}})['then'](handleEntityNotFound(_0x3e6417,null))[_0xcaf4('0x25')](removeEntity(_0x3e6417,null))['catch'](handleError(_0x3e6417,null));};exports[_0xcaf4('0x5a')]=function(_0x29eede,_0x23cac1,_0x5483e0){var _0x43a6a8={'raw':!![],'where':{}};var _0x492310={};var _0x435b23={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x29eede['params']['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x23cac1,null))[_0xcaf4('0x25')](function(_0x3c00b1){if(_0x3c00b1){_0x492310['model']=_[_0xcaf4('0x34')](db[_0xcaf4('0x5b')][_0xcaf4('0x48')]);_0x492310[_0xcaf4('0x33')]=_[_0xcaf4('0x34')](_0x29eede['query']);_0x492310['filters']=_[_0xcaf4('0x35')](_0x492310[_0xcaf4('0x31')],_0x492310[_0xcaf4('0x33')]);_0x43a6a8[_0xcaf4('0x36')]=_['intersection'](_0x492310[_0xcaf4('0x31')],qs[_0xcaf4('0x49')](_0x29eede[_0xcaf4('0x33')][_0xcaf4('0x49')]));_0x43a6a8[_0xcaf4('0x36')]=_0x43a6a8['attributes'][_0xcaf4('0x37')]?_0x43a6a8[_0xcaf4('0x36')]:_0x492310['model'];if(!_0x29eede[_0xcaf4('0x33')]['hasOwnProperty']('nolimit')){_0x43a6a8[_0xcaf4('0x3a')]=qs[_0xcaf4('0x3a')](_0x29eede[_0xcaf4('0x33')][_0xcaf4('0x3a')]);_0x43a6a8[_0xcaf4('0x1b')]=qs[_0xcaf4('0x1b')](_0x29eede[_0xcaf4('0x33')][_0xcaf4('0x1b')]);}_0x43a6a8[_0xcaf4('0x5c')]=qs['sort'](_0x29eede[_0xcaf4('0x33')][_0xcaf4('0x3b')]);_0x43a6a8['where']=qs[_0xcaf4('0x3d')](_[_0xcaf4('0x3e')](_0x29eede[_0xcaf4('0x33')],_0x492310[_0xcaf4('0x3d')]));_0x43a6a8[_0xcaf4('0x3c')][_0xcaf4('0x5d')]=_0x3c00b1['id'];if(_0x29eede['query'][_0xcaf4('0x3f')]){_0x43a6a8[_0xcaf4('0x3c')]=_[_0xcaf4('0x40')](_0x43a6a8[_0xcaf4('0x3c')],{'$or':_['map'](_0x43a6a8['attributes'],function(_0x418b8f){var _0x3c0a35={};_0x3c0a35[_0x418b8f]={'$like':'%'+_0x29eede[_0xcaf4('0x33')][_0xcaf4('0x3f')]+'%'};return _0x3c0a35;})});}_0x43a6a8=_[_0xcaf4('0x40')]({},_0x43a6a8,_0x29eede['options']);return db[_0xcaf4('0x5b')]['count']({'where':_0x43a6a8[_0xcaf4('0x3c')]})[_0xcaf4('0x25')](function(_0x207eb0){_0x435b23['count']=_0x207eb0;if(_0x29eede[_0xcaf4('0x33')][_0xcaf4('0x42')]){_0x43a6a8[_0xcaf4('0x43')]=[{'all':!![]}];}return db[_0xcaf4('0x5b')][_0xcaf4('0x44')](_0x43a6a8);})[_0xcaf4('0x25')](function(_0xe0196f){_0x435b23[_0xcaf4('0x45')]=_0xe0196f;return _0x435b23;});}})[_0xcaf4('0x25')](respondWithFilteredResult(_0x23cac1,_0x43a6a8))[_0xcaf4('0x4a')](handleError(_0x23cac1,null));};exports[_0xcaf4('0x5e')]=function(_0x2cc17d,_0x46f320,_0x59d266){var _0x149e4a={'raw':!![],'where':{}};var _0x1ecdb6={};var _0x4d7668={'count':0x0,'rows':[]};return db[_0xcaf4('0x2e')][_0xcaf4('0x5f')]({'where':{'id':_0x2cc17d['params']['id']}})['then'](handleEntityNotFound(_0x46f320,null))[_0xcaf4('0x25')](function(_0x21644f){if(_0x21644f){_0x1ecdb6[_0xcaf4('0x31')]=_['keys'](db[_0xcaf4('0x60')][_0xcaf4('0x48')]);_0x1ecdb6[_0xcaf4('0x33')]=_[_0xcaf4('0x34')](_0x2cc17d[_0xcaf4('0x33')]);_0x1ecdb6[_0xcaf4('0x3d')]=_[_0xcaf4('0x35')](_0x1ecdb6[_0xcaf4('0x31')],_0x1ecdb6[_0xcaf4('0x33')]);_0x149e4a[_0xcaf4('0x36')]=_[_0xcaf4('0x35')](_0x1ecdb6[_0xcaf4('0x31')],qs['fields'](_0x2cc17d[_0xcaf4('0x33')][_0xcaf4('0x49')]));_0x149e4a[_0xcaf4('0x36')]=_0x149e4a[_0xcaf4('0x36')][_0xcaf4('0x37')]?_0x149e4a[_0xcaf4('0x36')]:_0x1ecdb6[_0xcaf4('0x31')];if(!_0x2cc17d[_0xcaf4('0x33')][_0xcaf4('0x38')](_0xcaf4('0x39'))){_0x149e4a[_0xcaf4('0x3a')]=qs[_0xcaf4('0x3a')](_0x2cc17d[_0xcaf4('0x33')][_0xcaf4('0x3a')]);_0x149e4a[_0xcaf4('0x1b')]=qs[_0xcaf4('0x1b')](_0x2cc17d['query']['offset']);}_0x149e4a['order']=qs[_0xcaf4('0x3b')](_0x2cc17d['query'][_0xcaf4('0x3b')]);_0x149e4a['where']=qs[_0xcaf4('0x3d')](_[_0xcaf4('0x3e')](_0x2cc17d[_0xcaf4('0x33')],_0x1ecdb6['filters']));_0x149e4a[_0xcaf4('0x3c')][_0xcaf4('0x5d')]=_0x21644f['id'];if(_0x2cc17d[_0xcaf4('0x33')][_0xcaf4('0x3f')]){_0x149e4a['where']=_[_0xcaf4('0x40')](_0x149e4a[_0xcaf4('0x3c')],{'$or':_[_0xcaf4('0x32')](_0x149e4a[_0xcaf4('0x36')],function(_0x55dbdd){var _0x3cf7ea={};_0x3cf7ea[_0x55dbdd]={'$like':'%'+_0x2cc17d['query'][_0xcaf4('0x3f')]+'%'};return _0x3cf7ea;})});}_0x149e4a=_['merge']({},_0x149e4a,_0x2cc17d[_0xcaf4('0x41')]);return db[_0xcaf4('0x60')][_0xcaf4('0x1d')]({'where':_0x149e4a[_0xcaf4('0x3c')]})[_0xcaf4('0x25')](function(_0x176a40){_0x4d7668['count']=_0x176a40;if(_0x2cc17d[_0xcaf4('0x33')][_0xcaf4('0x42')]){_0x149e4a['include']=[{'all':!![]}];}return db[_0xcaf4('0x60')][_0xcaf4('0x44')](_0x149e4a);})[_0xcaf4('0x25')](function(_0x15db07){_0x4d7668[_0xcaf4('0x45')]=_0x15db07;return _0x4d7668;});}})['then'](respondWithFilteredResult(_0x46f320,_0x149e4a))[_0xcaf4('0x4a')](handleError(_0x46f320,null));};exports[_0xcaf4('0x61')]=function(_0x1b8535,_0x2fa962,_0x1750b6){var _0x5b2008={'raw':!![],'where':{}};var _0xe12ec9={};var _0x381b84={'count':0x0,'rows':[]};return db[_0xcaf4('0x2e')]['findOne']({'where':{'id':_0x1b8535[_0xcaf4('0x47')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x2fa962,null))[_0xcaf4('0x25')](function(_0x3bdf46){if(_0x3bdf46){_0xe12ec9[_0xcaf4('0x31')]=_['keys'](db[_0xcaf4('0x62')][_0xcaf4('0x48')]);_0xe12ec9[_0xcaf4('0x33')]=_['keys'](_0x1b8535[_0xcaf4('0x33')]);_0xe12ec9['filters']=_['intersection'](_0xe12ec9[_0xcaf4('0x31')],_0xe12ec9[_0xcaf4('0x33')]);_0x5b2008[_0xcaf4('0x36')]=_[_0xcaf4('0x35')](_0xe12ec9[_0xcaf4('0x31')],qs[_0xcaf4('0x49')](_0x1b8535['query'][_0xcaf4('0x49')]));_0x5b2008[_0xcaf4('0x36')]=_0x5b2008[_0xcaf4('0x36')]['length']?_0x5b2008[_0xcaf4('0x36')]:_0xe12ec9[_0xcaf4('0x31')];if(!_0x1b8535[_0xcaf4('0x33')][_0xcaf4('0x38')](_0xcaf4('0x39'))){_0x5b2008[_0xcaf4('0x3a')]=qs[_0xcaf4('0x3a')](_0x1b8535['query'][_0xcaf4('0x3a')]);_0x5b2008[_0xcaf4('0x1b')]=qs[_0xcaf4('0x1b')](_0x1b8535[_0xcaf4('0x33')]['offset']);}_0x5b2008[_0xcaf4('0x5c')]=qs[_0xcaf4('0x3b')](_0x1b8535[_0xcaf4('0x33')][_0xcaf4('0x3b')]);_0x5b2008['where']=qs[_0xcaf4('0x3d')](_['pick'](_0x1b8535[_0xcaf4('0x33')],_0xe12ec9['filters']));_0x5b2008[_0xcaf4('0x3c')]['CampaignId']=_0x3bdf46['id'];if(_0x1b8535[_0xcaf4('0x33')][_0xcaf4('0x3f')]){_0x5b2008[_0xcaf4('0x3c')]=_[_0xcaf4('0x40')](_0x5b2008[_0xcaf4('0x3c')],{'$or':_['map'](_0x5b2008[_0xcaf4('0x36')],function(_0x4bd8a2){var _0x90f42e={};_0x90f42e[_0x4bd8a2]={'$like':'%'+_0x1b8535[_0xcaf4('0x33')]['filter']+'%'};return _0x90f42e;})});}_0x5b2008=_[_0xcaf4('0x40')]({},_0x5b2008,_0x1b8535[_0xcaf4('0x41')]);return db[_0xcaf4('0x62')][_0xcaf4('0x1d')]({'where':_0x5b2008['where']})[_0xcaf4('0x25')](function(_0x4edae1){_0x381b84[_0xcaf4('0x1d')]=_0x4edae1;if(_0x1b8535[_0xcaf4('0x33')][_0xcaf4('0x42')]){_0x5b2008[_0xcaf4('0x43')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xcaf4('0x44')](_0x5b2008);})[_0xcaf4('0x25')](function(_0x530431){_0x381b84[_0xcaf4('0x45')]=_0x530431;return _0x381b84;});}})[_0xcaf4('0x25')](respondWithFilteredResult(_0x2fa962,_0x5b2008))[_0xcaf4('0x4a')](handleError(_0x2fa962,null));};exports['getHopperBlacks']=function(_0x138958,_0x431e0e,_0x402f02){var _0xc96ebc={'raw':!![],'where':{}};var _0x2cd15b={};var _0x54d692={'count':0x0,'rows':[]};return db[_0xcaf4('0x2e')]['findOne']({'where':{'id':_0x138958[_0xcaf4('0x47')]['id']}})['then'](handleEntityNotFound(_0x431e0e,null))[_0xcaf4('0x25')](function(_0x252da0){if(_0x252da0){_0x2cd15b[_0xcaf4('0x31')]=_['keys'](db['CmHopperBlack'][_0xcaf4('0x48')]);_0x2cd15b['query']=_[_0xcaf4('0x34')](_0x138958[_0xcaf4('0x33')]);_0x2cd15b['filters']=_['intersection'](_0x2cd15b['model'],_0x2cd15b[_0xcaf4('0x33')]);_0xc96ebc[_0xcaf4('0x36')]=_[_0xcaf4('0x35')](_0x2cd15b[_0xcaf4('0x31')],qs['fields'](_0x138958[_0xcaf4('0x33')][_0xcaf4('0x49')]));_0xc96ebc[_0xcaf4('0x36')]=_0xc96ebc['attributes'][_0xcaf4('0x37')]?_0xc96ebc[_0xcaf4('0x36')]:_0x2cd15b['model'];if(!_0x138958[_0xcaf4('0x33')][_0xcaf4('0x38')](_0xcaf4('0x39'))){_0xc96ebc[_0xcaf4('0x3a')]=qs['limit'](_0x138958['query'][_0xcaf4('0x3a')]);_0xc96ebc['offset']=qs[_0xcaf4('0x1b')](_0x138958['query'][_0xcaf4('0x1b')]);}_0xc96ebc[_0xcaf4('0x5c')]=qs[_0xcaf4('0x3b')](_0x138958['query']['sort']);_0xc96ebc[_0xcaf4('0x3c')]=qs[_0xcaf4('0x3d')](_[_0xcaf4('0x3e')](_0x138958[_0xcaf4('0x33')],_0x2cd15b[_0xcaf4('0x3d')]));_0xc96ebc[_0xcaf4('0x3c')]['CampaignId']=_0x252da0['id'];if(_0x138958[_0xcaf4('0x33')]['filter']){_0xc96ebc['where']=_[_0xcaf4('0x40')](_0xc96ebc[_0xcaf4('0x3c')],{'$or':_[_0xcaf4('0x32')](_0xc96ebc[_0xcaf4('0x36')],function(_0x46b4bf){var _0x4e0d2c={};_0x4e0d2c[_0x46b4bf]={'$like':'%'+_0x138958[_0xcaf4('0x33')][_0xcaf4('0x3f')]+'%'};return _0x4e0d2c;})});}_0xc96ebc=_[_0xcaf4('0x40')]({},_0xc96ebc,_0x138958[_0xcaf4('0x41')]);return db['CmHopperBlack']['count']({'where':_0xc96ebc['where']})[_0xcaf4('0x25')](function(_0x29e138){_0x54d692[_0xcaf4('0x1d')]=_0x29e138;if(_0x138958[_0xcaf4('0x33')][_0xcaf4('0x42')]){_0xc96ebc[_0xcaf4('0x43')]=[{'all':!![]}];}return db[_0xcaf4('0x63')]['findAll'](_0xc96ebc);})['then'](function(_0x590d2b){_0x54d692[_0xcaf4('0x45')]=_0x590d2b;return _0x54d692;});}})[_0xcaf4('0x25')](respondWithFilteredResult(_0x431e0e,_0xc96ebc))[_0xcaf4('0x4a')](handleError(_0x431e0e,null));};exports[_0xcaf4('0x64')]=function(_0x5c4171,_0x32cfb2,_0x1487b9){var _0x309191={};var _0x53bdb9={};var _0x308a7c;var _0x148716;return db['Campaign']['findOne']({'where':{'id':_0x5c4171[_0xcaf4('0x47')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x32cfb2,null))[_0xcaf4('0x25')](function(_0x44b2e4){if(_0x44b2e4){_0x308a7c=_0x44b2e4;_0x53bdb9[_0xcaf4('0x31')]=_[_0xcaf4('0x34')](db['CmList'][_0xcaf4('0x48')]);_0x53bdb9[_0xcaf4('0x33')]=_['keys'](_0x5c4171[_0xcaf4('0x33')]);_0x53bdb9[_0xcaf4('0x3d')]=_[_0xcaf4('0x35')](_0x53bdb9[_0xcaf4('0x31')],_0x53bdb9[_0xcaf4('0x33')]);_0x309191[_0xcaf4('0x36')]=_['intersection'](_0x53bdb9[_0xcaf4('0x31')],qs['fields'](_0x5c4171[_0xcaf4('0x33')][_0xcaf4('0x49')]));_0x309191[_0xcaf4('0x36')]=_0x309191[_0xcaf4('0x36')][_0xcaf4('0x37')]?_0x309191[_0xcaf4('0x36')]:_0x53bdb9[_0xcaf4('0x31')];_0x309191[_0xcaf4('0x5c')]=qs[_0xcaf4('0x3b')](_0x5c4171[_0xcaf4('0x33')][_0xcaf4('0x3b')]);_0x309191[_0xcaf4('0x3c')]=qs['filters'](_['pick'](_0x5c4171[_0xcaf4('0x33')],_0x53bdb9['filters']));if(_0x5c4171[_0xcaf4('0x33')]['filter']){_0x309191[_0xcaf4('0x3c')]=_[_0xcaf4('0x40')](_0x309191[_0xcaf4('0x3c')],{'$or':_['map'](_0x309191[_0xcaf4('0x36')],function(_0x2245e4){var _0x5dc7b2={};_0x5dc7b2[_0x2245e4]={'$like':'%'+_0x5c4171[_0xcaf4('0x33')][_0xcaf4('0x3f')]+'%'};return _0x5dc7b2;})});}_0x309191=_['merge']({},_0x309191,_0x5c4171[_0xcaf4('0x41')]);return _0x308a7c[_0xcaf4('0x64')](_0x309191);}})[_0xcaf4('0x25')](function(_0x1b80b7){if(_0x1b80b7){_0x148716=_0x1b80b7[_0xcaf4('0x37')];if(!_0x5c4171['query'][_0xcaf4('0x38')](_0xcaf4('0x39'))){_0x309191[_0xcaf4('0x3a')]=qs[_0xcaf4('0x3a')](_0x5c4171[_0xcaf4('0x33')][_0xcaf4('0x3a')]);_0x309191[_0xcaf4('0x1b')]=qs[_0xcaf4('0x1b')](_0x5c4171[_0xcaf4('0x33')]['offset']);}return _0x308a7c['getLists'](_0x309191);}})[_0xcaf4('0x25')](function(_0x40501e){if(_0x40501e){return _0x40501e?{'count':_0x148716,'rows':_0x40501e}:null;}})[_0xcaf4('0x25')](respondWithResult(_0x32cfb2,null))[_0xcaf4('0x4a')](handleError(_0x32cfb2,null));};exports['addLists']=function(_0x4883a7,_0x50a084,_0x5c637a){var _0x30dbc4,_0x8ecf2b;var _0x5d0083=[];var _0x347677=moment()[_0xcaf4('0x65')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xcaf4('0x2e')][_0xcaf4('0x51')]({'where':{'id':_0x4883a7[_0xcaf4('0x47')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x50a084,null))[_0xcaf4('0x25')](function(_0x13f732){if(_0x13f732){_0x8ecf2b=_0x13f732;return _0x13f732[_0xcaf4('0x66')](_0x4883a7['body'][_0xcaf4('0x67')],_[_0xcaf4('0x56')](_0x4883a7[_0xcaf4('0x4c')],[_0xcaf4('0x67'),'id'])||{});}return null;})[_0xcaf4('0x68')](function(_0x254e96){var _0x20c0ba;var _0x4b5a90;_0x30dbc4=_0x254e96||[];var _0x45a62f=[];if(_0x254e96){for(var _0x147637=0x0;_0x147637<_0x254e96[_0xcaf4('0x37')];_0x147637+=0x1){var _0x2a0b3c=_0x254e96[_0x147637][_0xcaf4('0x26')]({'plain':!![]});_0x8ecf2b[_0xcaf4('0x69')]=_0x4883a7[_0xcaf4('0x4c')][_0xcaf4('0x69')]?_0x4883a7[_0xcaf4('0x4c')][_0xcaf4('0x69')]:_0x8ecf2b[_0xcaf4('0x69')];switch(_0x8ecf2b['dialCheckDuplicateType']){case _0xcaf4('0x6a'):_0x20c0ba=squel[_0xcaf4('0x6b')]()[_0xcaf4('0x6c')](_0xcaf4('0x6d'))[_0xcaf4('0x6e')]([_0xcaf4('0x6f'),'scheduledAt',_0xcaf4('0x70'),_0xcaf4('0x71'),_0xcaf4('0x5d'),_0xcaf4('0x57'),_0xcaf4('0x58')],squel[_0xcaf4('0x72')]()[_0xcaf4('0x73')](_0xcaf4('0x6f'),_0xcaf4('0x6f'))[_0xcaf4('0x73')](_0xcaf4('0x74'),_0xcaf4('0x75'))[_0xcaf4('0x73')]('id','ContactId')[_0xcaf4('0x73')](_0x2a0b3c[_0xcaf4('0x76')]['toString'](),_0xcaf4('0x71'))['field'](_0x4883a7[_0xcaf4('0x47')]['id']['toString'](),'CampaignId')[_0xcaf4('0x73')]('\x27'+_0x347677+'\x27',_0xcaf4('0x57'))['field']('\x27'+_0x347677+'\x27',_0xcaf4('0x58'))[_0xcaf4('0x77')](_0xcaf4('0x78'))['where'](_0xcaf4('0x79'))[_0xcaf4('0x3c')](_0xcaf4('0x7a'),_0x2a0b3c['CmListId']['toString']())[_0xcaf4('0x3c')](_0xcaf4('0x7b'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0xcaf4('0x72')]()['field'](_0xcaf4('0x7c'))[_0xcaf4('0x77')]('cm_hopper_final')[_0xcaf4('0x3c')](_0xcaf4('0x7d'),_0x4883a7['params']['id']['toString']()))[_0xcaf4('0x3c')](_0xcaf4('0x7e'),squel[_0xcaf4('0x72')]()['field'](_0xcaf4('0x7f'))['from'](_0xcaf4('0x6d'))[_0xcaf4('0x3c')]('CampaignId\x20=\x20?',_0x4883a7[_0xcaf4('0x47')]['id'][_0xcaf4('0x80')]())))[_0xcaf4('0x80')]();break;case _0xcaf4('0x81'):_0x20c0ba=squel[_0xcaf4('0x6b')]()['into']('cm_hopper')[_0xcaf4('0x6e')]([_0xcaf4('0x6f'),'scheduledAt','ContactId',_0xcaf4('0x71'),'CampaignId',_0xcaf4('0x57'),'updatedAt'],squel[_0xcaf4('0x72')]()[_0xcaf4('0x73')]('phone',_0xcaf4('0x6f'))[_0xcaf4('0x73')](_0xcaf4('0x74'),'scheduledAt')[_0xcaf4('0x73')]('id',_0xcaf4('0x70'))[_0xcaf4('0x73')](_0x2a0b3c['CmListId'][_0xcaf4('0x80')](),'ListId')[_0xcaf4('0x73')](_0x4883a7[_0xcaf4('0x47')]['id'][_0xcaf4('0x80')](),_0xcaf4('0x5d'))['field']('\x27'+_0x347677+'\x27',_0xcaf4('0x57'))[_0xcaf4('0x73')]('\x27'+_0x347677+'\x27','updatedAt')['from'](_0xcaf4('0x78'))[_0xcaf4('0x3c')](_0xcaf4('0x79'))['where'](_0xcaf4('0x7a'),_0x2a0b3c[_0xcaf4('0x76')]['toString']())[_0xcaf4('0x3c')](_0xcaf4('0x7b'))[_0xcaf4('0x3c')](_0xcaf4('0x7e'),squel[_0xcaf4('0x72')]()[_0xcaf4('0x73')](_0xcaf4('0x7f'))[_0xcaf4('0x77')](_0xcaf4('0x6d'))[_0xcaf4('0x3c')](_0xcaf4('0x7d'),_0x4883a7[_0xcaf4('0x47')]['id']['toString']())))[_0xcaf4('0x80')]();break;default:_0x20c0ba=squel[_0xcaf4('0x6b')]()[_0xcaf4('0x6c')](_0xcaf4('0x6d'))[_0xcaf4('0x6e')]([_0xcaf4('0x6f'),_0xcaf4('0x75'),_0xcaf4('0x70'),_0xcaf4('0x71'),'CampaignId','createdAt',_0xcaf4('0x58')],squel[_0xcaf4('0x72')]()[_0xcaf4('0x73')](_0xcaf4('0x6f'),'phone')['field']('NOW()',_0xcaf4('0x75'))['field']('id',_0xcaf4('0x70'))['field'](_0x2a0b3c['CmListId'][_0xcaf4('0x80')](),_0xcaf4('0x71'))[_0xcaf4('0x73')](_0x4883a7[_0xcaf4('0x47')]['id'][_0xcaf4('0x80')](),_0xcaf4('0x5d'))[_0xcaf4('0x73')]('\x27'+_0x347677+'\x27','createdAt')[_0xcaf4('0x73')]('\x27'+_0x347677+'\x27',_0xcaf4('0x58'))[_0xcaf4('0x77')]('cm_contacts')[_0xcaf4('0x3c')](_0xcaf4('0x79'))[_0xcaf4('0x3c')](_0xcaf4('0x7a'),_0x2a0b3c['CmListId'][_0xcaf4('0x80')]())[_0xcaf4('0x3c')](_0xcaf4('0x7b')))[_0xcaf4('0x80')]();}_0x4b5a90=squel[_0xcaf4('0x6b')]()['into']('cm_hopper_additional_phones')[_0xcaf4('0x6e')]([_0xcaf4('0x82'),_0xcaf4('0x75'),_0xcaf4('0x6f'),_0xcaf4('0x83'),_0xcaf4('0x57'),_0xcaf4('0x58')],squel['select']()['field'](_0xcaf4('0x84'),'id')[_0xcaf4('0x73')](_0xcaf4('0x74'),_0xcaf4('0x75'))['field'](_0xcaf4('0x85'),_0xcaf4('0x6f'))['field'](_0xcaf4('0x86'),_0xcaf4('0x83'))[_0xcaf4('0x73')]('\x27'+_0x347677+'\x27',_0xcaf4('0x57'))[_0xcaf4('0x73')]('\x27'+_0x347677+'\x27','updatedAt')[_0xcaf4('0x77')](_0xcaf4('0x87'),'ci')[_0xcaf4('0x88')]('cm_hopper','h',_0xcaf4('0x89'))[_0xcaf4('0x3c')](_0xcaf4('0x8a'),_0x2a0b3c['CmListId'][_0xcaf4('0x80')]())[_0xcaf4('0x3c')](_0xcaf4('0x8b'),_0x4883a7[_0xcaf4('0x47')]['id'][_0xcaf4('0x80')]())[_0xcaf4('0x3c')](_0xcaf4('0x8c'),_0x347677))['toString']();_0x45a62f[_0xcaf4('0x8d')](db[_0xcaf4('0x8e')][_0xcaf4('0x33')](_0x20c0ba));_0x5d0083['push'](db[_0xcaf4('0x8e')][_0xcaf4('0x33')](_0x4b5a90));}return BPromise['all'](_0x45a62f);}})[_0xcaf4('0x25')](function(){return BPromise['all'](_0x5d0083);})[_0xcaf4('0x25')](function(){return _0x30dbc4;})[_0xcaf4('0x25')](respondWithResult(_0x50a084,null))[_0xcaf4('0x4a')](handleError(_0x50a084,null));};exports['removeLists']=function(_0x1edfa8,_0x1b3b10,_0x1aae7e){return db[_0xcaf4('0x2e')]['find']({'where':{'id':_0x1edfa8[_0xcaf4('0x47')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x1b3b10,null))[_0xcaf4('0x25')](function(_0x391fbd){if(_0x391fbd){return _0x391fbd[_0xcaf4('0x8f')](_0x1edfa8[_0xcaf4('0x33')][_0xcaf4('0x67')]);}})[_0xcaf4('0x25')](function(_0x4fbb96){if(_0x4fbb96){return db[_0xcaf4('0x5b')][_0xcaf4('0x24')]({'where':{'ListId':_0x1edfa8['query']['ids'],'CampaignId':_0x1edfa8[_0xcaf4('0x47')]['id']}})[_0xcaf4('0x25')](function(){return _0x4fbb96;});}})[_0xcaf4('0x25')](respondWithStatusCode(_0x1b3b10,null))[_0xcaf4('0x4a')](handleError(_0x1b3b10,null));};exports[_0xcaf4('0x90')]=function(_0x1c94ee,_0x243a7e,_0x499e6b){var _0x1fe7da={};var _0x425cf0={};var _0x4e574b;var _0x286ada;return db['Campaign'][_0xcaf4('0x5f')]({'where':{'id':_0x1c94ee[_0xcaf4('0x47')]['id']}})[_0xcaf4('0x25')](handleEntityNotFound(_0x243a7e,null))[_0xcaf4('0x25')](function(_0x543888){if(_0x543888){_0x4e574b=_0x543888;_0x425cf0[_0xcaf4('0x31')]=_['keys'](db[_0xcaf4('0x91')]['rawAttributes']);_0x425cf0[_0xcaf4('0x33')]=_[_0xcaf4('0x34')](_0x1c94ee[_0xcaf4('0x33')]);_0x425cf0[_0xcaf4('0x3d')]=_[_0xcaf4('0x35')](_0x425cf0[_0xcaf4('0x31')],_0x425cf0[_0xcaf4('0x33')]);_0x1fe7da[_0xcaf4('0x36')]=_[_0xcaf4('0x35')](_0x425cf0['model'],qs[_0xcaf4('0x49')](_0x1c94ee[_0xcaf4('0x33')][_0xcaf4('0x49')]));_0x1fe7da['attributes']=_0x1fe7da[_0xcaf4('0x36')][_0xcaf4('0x37')]?_0x1fe7da['attributes']:_0x425cf0['model'];_0x1fe7da[_0xcaf4('0x5c')]=qs['sort'](_0x1c94ee[_0xcaf4('0x33')][_0xcaf4('0x3b')]);_0x1fe7da['where']=qs[_0xcaf4('0x3d')](_[_0xcaf4('0x3e')](_0x1c94ee['query'],_0x425cf0['filters']));if(_0x1c94ee[_0xcaf4('0x33')]['filter']){_0x1fe7da[_0xcaf4('0x3c')]=_[_0xcaf4('0x40')](_0x1fe7da[_0xcaf4('0x3c')],{'$or':_['map'](_0x1fe7da[_0xcaf4('0x36')],function(_0x185212){var _0x1dd862={};_0x1dd862[_0x185212]={'$like':'%'+_0x1c94ee[_0xcaf4('0x33')][_0xcaf4('0x3f')]+'%'};return _0x1dd862;})});}_0x1fe7da=_[_0xcaf4('0x40')]({},_0x1fe7da,_0x1c94ee[_0xcaf4('0x41')]);return _0x4e574b[_0xcaf4('0x90')](_0x1fe7da);}})[_0xcaf4('0x25')](function(_0x592e3e){if(_0x592e3e){_0x286ada=_0x592e3e[_0xcaf4('0x37')];if(!_0x1c94ee['query'][_0xcaf4('0x38')]('nolimit')){_0x1fe7da[_0xcaf4('0x3a')]=qs[_0xcaf4('0x3a')](_0x1c94ee[_0xcaf4('0x33')][_0xcaf4('0x3a')]);_0x1fe7da[_0xcaf4('0x1b')]=qs[_0xcaf4('0x1b')](_0x1c94ee[_0xcaf4('0x33')][_0xcaf4('0x1b')]);}return _0x4e574b[_0xcaf4('0x90')](_0x1fe7da);}})[_0xcaf4('0x25')](function(_0xd418f2){if(_0xd418f2){return _0xd418f2?{'count':_0x286ada,'rows':_0xd418f2}:null;}})['then'](respondWithResult(_0x243a7e,null))['catch'](handleError(_0x243a7e,null));};exports[_0xcaf4('0x92')]=function(_0x2e1e65,_0x26215b,_0x529a83){var _0x40b539,_0x5bfdf3;var _0x516eab=[];var _0x44a7e2=moment()[_0xcaf4('0x65')](_0xcaf4('0x93'));return db[_0xcaf4('0x2e')][_0xcaf4('0x51')]({'where':{'id':_0x2e1e65[_0xcaf4('0x47')]['id']}})['then'](handleEntityNotFound(_0x26215b,null))['then'](function(_0x696778){if(_0x696778){_0x5bfdf3=_0x696778;return _0x696778['addBlackLists'](_0x2e1e65[_0xcaf4('0x4c')][_0xcaf4('0x67')],_[_0xcaf4('0x56')](_0x2e1e65[_0xcaf4('0x4c')],[_0xcaf4('0x67'),'id'])||{});}return null;})['spread'](function(_0x2b4492){var _0x5974a5;var _0x797c4e;_0x40b539=_0x2b4492||[];var _0x37cdd6=[];if(_0x2b4492){for(var _0x1f53d5=0x0;_0x1f53d5<_0x2b4492[_0xcaf4('0x37')];_0x1f53d5+=0x1){var _0x2e1246=_0x2b4492[_0x1f53d5][_0xcaf4('0x26')]({'plain':!![]});_0x5974a5=squel['insert']()[_0xcaf4('0x6c')]('cm_hopper_black')['fromQuery']([_0xcaf4('0x6f'),'ContactId','ListId',_0xcaf4('0x5d'),'createdAt',_0xcaf4('0x58')],squel[_0xcaf4('0x72')]()[_0xcaf4('0x73')](_0xcaf4('0x6f'),'phone')[_0xcaf4('0x73')]('id',_0xcaf4('0x70'))[_0xcaf4('0x73')](_0x2e1246['CmListId']['toString'](),_0xcaf4('0x71'))[_0xcaf4('0x73')](_0x2e1e65[_0xcaf4('0x47')]['id'][_0xcaf4('0x80')](),_0xcaf4('0x5d'))[_0xcaf4('0x73')](_0xcaf4('0x74'),_0xcaf4('0x57'))[_0xcaf4('0x73')](_0xcaf4('0x74'),_0xcaf4('0x58'))[_0xcaf4('0x77')](_0xcaf4('0x78'))['where'](_0xcaf4('0x79'))[_0xcaf4('0x3c')](_0xcaf4('0x7a'),_0x2e1246[_0xcaf4('0x76')][_0xcaf4('0x80')]())[_0xcaf4('0x3c')](_0xcaf4('0x7b')))[_0xcaf4('0x80')]();_0x37cdd6[_0xcaf4('0x8d')](db[_0xcaf4('0x8e')]['query'](_0x5974a5));}return BPromise[_0xcaf4('0x94')](_0x37cdd6);}})[_0xcaf4('0x25')](function(){return _0x40b539;})[_0xcaf4('0x25')](respondWithResult(_0x26215b,null))[_0xcaf4('0x4a')](handleError(_0x26215b,null));};exports['removeBlackLists']=function(_0xb8de73,_0x186b59,_0x933066){return db[_0xcaf4('0x2e')][_0xcaf4('0x51')]({'where':{'id':_0xb8de73[_0xcaf4('0x47')]['id']}})['then'](handleEntityNotFound(_0x186b59,null))[_0xcaf4('0x25')](function(_0x596f41){if(_0x596f41){return _0x596f41[_0xcaf4('0x95')](_0xb8de73[_0xcaf4('0x33')][_0xcaf4('0x67')]);}})[_0xcaf4('0x25')](function(_0x264222){if(_0x264222){return db[_0xcaf4('0x63')]['destroy']({'where':{'ListId':_0xb8de73[_0xcaf4('0x33')][_0xcaf4('0x67')],'CampaignId':_0xb8de73['params']['id']}})[_0xcaf4('0x25')](function(){return _0x264222;});}})[_0xcaf4('0x25')](respondWithStatusCode(_0x186b59,null))[_0xcaf4('0x4a')](handleError(_0x186b59,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 9cc9813..579172e 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(_0x56916d,_0x37b935){var _0x2b7f1f=function(_0x206eb1){while(--_0x206eb1){_0x56916d['push'](_0x56916d['shift']());}};_0x2b7f1f(++_0x37b935);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x169ed3,_0x113a9f){var _0x5b35b0=function(_0x165cbd){while(--_0x165cbd){_0x169ed3['push'](_0x169ed3['shift']());}};_0x5b35b0(++_0x113a9f);}(_0x7a54,0x106));var _0x47a5=function(_0x4d5714,_0x548170){_0x4d5714=_0x4d5714-0x0;var _0x5be678=_0x7a54[_0x4d5714];return _0x5be678;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 0abdf09..9e54efd 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 _0xb575=['jayson/promise','client','http','request','then','info','Campaign,\x20%s,\x20%s','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','Campaign','findAll','options','raw','attributes','limit','include','map','model','GetCampaign','debug','stringify','lodash','util','bluebird','../../config/utils','../../config/logger','../../config/environment'];(function(_0x489dd6,_0x2ff564){var _0x22e0ee=function(_0x5110a3){while(--_0x5110a3){_0x489dd6['push'](_0x489dd6['shift']());}};_0x22e0ee(++_0x2ff564);}(_0xb575,0xda));var _0x5b57=function(_0xfb6d53,_0x355c5a){_0xfb6d53=_0xfb6d53-0x0;var _0x32f9e9=_0xb575[_0xfb6d53];return _0x32f9e9;};'use strict';var _=require(_0x5b57('0x0'));var util=require(_0x5b57('0x1'));var moment=require('moment');var BPromise=require(_0x5b57('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5b57('0x3'));var logger=require(_0x5b57('0x4'))('rpc');var config=require(_0x5b57('0x5'));var jayson=require(_0x5b57('0x6'));var client=jayson[_0x5b57('0x7')][_0x5b57('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x672beb,_0x5d223d,_0x4232d0){return new BPromise(function(_0x5dd0c7,_0x2f9789){return client[_0x5b57('0x9')](_0x672beb,_0x4232d0)[_0x5b57('0xa')](function(_0x49ce3a){logger[_0x5b57('0xb')](_0x5b57('0xc'),_0x5d223d,_0x5b57('0xd'));logger['debug'](_0x5b57('0xe'),_0x5d223d,_0x5b57('0xd'),JSON['stringify'](_0x49ce3a));if(_0x49ce3a['error']){if(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x10')]===0x1f4){logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);return _0x2f9789(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);}logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x49ce3a['error'][_0x5b57('0x11')]);return _0x5dd0c7(_0x49ce3a[_0x5b57('0xf')][_0x5b57('0x11')]);}else{logger['info'](_0x5b57('0xc'),_0x5d223d,_0x5b57('0xd'));_0x5dd0c7(_0x49ce3a[_0x5b57('0x12')][_0x5b57('0x11')]);}})[_0x5b57('0x13')](function(_0x1e7cc0){logger[_0x5b57('0xf')](_0x5b57('0xc'),_0x5d223d,_0x1e7cc0);_0x2f9789(_0x1e7cc0);});});}exports['GetCampaign']=function(_0x336db6){var _0x1e316f=this;return new Promise(function(_0x2cb809,_0x137899){return db[_0x5b57('0x14')][_0x5b57('0x15')]({'raw':_0x336db6['options']?_0x336db6[_0x5b57('0x16')][_0x5b57('0x17')]===undefined?!![]:![]:!![],'where':_0x336db6[_0x5b57('0x16')]?_0x336db6[_0x5b57('0x16')]['where']||null:null,'attributes':_0x336db6[_0x5b57('0x16')]?_0x336db6[_0x5b57('0x16')][_0x5b57('0x18')]||null:null,'limit':_0x336db6['options']?_0x336db6[_0x5b57('0x16')][_0x5b57('0x19')]||null:null,'include':_0x336db6[_0x5b57('0x16')]?_0x336db6[_0x5b57('0x16')][_0x5b57('0x1a')]?_[_0x5b57('0x1b')](_0x336db6['options'][_0x5b57('0x1a')],function(_0x50ea5f){return{'model':db[_0x50ea5f[_0x5b57('0x1c')]],'as':_0x50ea5f['as'],'attributes':_0x50ea5f[_0x5b57('0x18')],'include':_0x50ea5f['include']?_['map'](_0x50ea5f[_0x5b57('0x1a')],function(_0x5eab3d){return{'model':db[_0x5eab3d[_0x5b57('0x1c')]],'as':_0x5eab3d['as'],'attributes':_0x5eab3d[_0x5b57('0x18')],'include':_0x5eab3d[_0x5b57('0x1a')]?_[_0x5b57('0x1b')](_0x5eab3d[_0x5b57('0x1a')],function(_0x17ac8b){return{'model':db[_0x17ac8b[_0x5b57('0x1c')]],'as':_0x17ac8b['as'],'attributes':_0x17ac8b[_0x5b57('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5b57('0xa')](function(_0x31c4a5){logger[_0x5b57('0xb')](_0x5b57('0x1d'),_0x336db6);logger[_0x5b57('0x1e')](_0x5b57('0x1d'),_0x336db6,JSON[_0x5b57('0x1f')](_0x31c4a5));_0x2cb809(_0x31c4a5);})[_0x5b57('0x13')](function(_0x3e8bc6){logger['error'](_0x5b57('0x1d'),_0x3e8bc6['message'],_0x336db6);_0x137899(_0x1e316f[_0x5b57('0xf')](0x1f4,_0x3e8bc6[_0x5b57('0x11')]));});});}; \ No newline at end of file +var _0xeebe=['jayson/promise','client','http','request','then','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','message','Campaign,\x20%s,\x20%s','info','result','catch','GetCampaign','Campaign','findAll','options','attributes','limit','map','include','model','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5a1e54,_0x13dbf7){var _0x4fe1b2=function(_0x3a7133){while(--_0x3a7133){_0x5a1e54['push'](_0x5a1e54['shift']());}};_0x4fe1b2(++_0x13dbf7);}(_0xeebe,0xff));var _0xeeeb=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xeebe[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0xeeeb('0x0'));var util=require('util');var moment=require(_0xeeeb('0x1'));var BPromise=require('bluebird');var rs=require(_0xeeeb('0x2'));var fs=require('fs');var Redis=require(_0xeeeb('0x3'));var db=require(_0xeeeb('0x4'))['db'];var utils=require(_0xeeeb('0x5'));var logger=require(_0xeeeb('0x6'))(_0xeeeb('0x7'));var config=require(_0xeeeb('0x8'));var jayson=require(_0xeeeb('0x9'));var client=jayson[_0xeeeb('0xa')][_0xeeeb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x46c645,_0x3083ab,_0x41847e){return new BPromise(function(_0x1f88ea,_0xc3e1ba){return client[_0xeeeb('0xc')](_0x46c645,_0x41847e)[_0xeeeb('0xd')](function(_0x426a82){logger['info']('Campaign,\x20%s,\x20%s',_0x3083ab,_0xeeeb('0xe'));logger[_0xeeeb('0xf')](_0xeeeb('0x10'),_0x3083ab,'request\x20sent',JSON[_0xeeeb('0x11')](_0x426a82));if(_0x426a82[_0xeeeb('0x12')]){if(_0x426a82[_0xeeeb('0x12')]['code']===0x1f4){logger[_0xeeeb('0x12')]('Campaign,\x20%s,\x20%s',_0x3083ab,_0x426a82['error'][_0xeeeb('0x13')]);return _0xc3e1ba(_0x426a82[_0xeeeb('0x12')][_0xeeeb('0x13')]);}logger[_0xeeeb('0x12')](_0xeeeb('0x14'),_0x3083ab,_0x426a82[_0xeeeb('0x12')][_0xeeeb('0x13')]);return _0x1f88ea(_0x426a82[_0xeeeb('0x12')][_0xeeeb('0x13')]);}else{logger[_0xeeeb('0x15')](_0xeeeb('0x14'),_0x3083ab,_0xeeeb('0xe'));_0x1f88ea(_0x426a82[_0xeeeb('0x16')][_0xeeeb('0x13')]);}})[_0xeeeb('0x17')](function(_0x1b1d02){logger[_0xeeeb('0x12')](_0xeeeb('0x14'),_0x3083ab,_0x1b1d02);_0xc3e1ba(_0x1b1d02);});});}exports[_0xeeeb('0x18')]=function(_0x2db8b1){var _0x37efe6=this;return new Promise(function(_0x1af658,_0x2dba71){return db[_0xeeeb('0x19')][_0xeeeb('0x1a')]({'raw':_0x2db8b1[_0xeeeb('0x1b')]?_0x2db8b1[_0xeeeb('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x2db8b1[_0xeeeb('0x1b')]?_0x2db8b1['options']['where']||null:null,'attributes':_0x2db8b1['options']?_0x2db8b1['options'][_0xeeeb('0x1c')]||null:null,'limit':_0x2db8b1[_0xeeeb('0x1b')]?_0x2db8b1[_0xeeeb('0x1b')][_0xeeeb('0x1d')]||null:null,'include':_0x2db8b1[_0xeeeb('0x1b')]?_0x2db8b1['options']['include']?_[_0xeeeb('0x1e')](_0x2db8b1[_0xeeeb('0x1b')][_0xeeeb('0x1f')],function(_0x70ce3c){return{'model':db[_0x70ce3c[_0xeeeb('0x20')]],'as':_0x70ce3c['as'],'attributes':_0x70ce3c['attributes'],'include':_0x70ce3c[_0xeeeb('0x1f')]?_[_0xeeeb('0x1e')](_0x70ce3c['include'],function(_0x495a08){return{'model':db[_0x495a08[_0xeeeb('0x20')]],'as':_0x495a08['as'],'attributes':_0x495a08[_0xeeeb('0x1c')],'include':_0x495a08[_0xeeeb('0x1f')]?_[_0xeeeb('0x1e')](_0x495a08[_0xeeeb('0x1f')],function(_0x192698){return{'model':db[_0x192698[_0xeeeb('0x20')]],'as':_0x192698['as'],'attributes':_0x192698[_0xeeeb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xeeeb('0xd')](function(_0x25e359){logger[_0xeeeb('0x15')]('GetCampaign',_0x2db8b1);logger['debug'](_0xeeeb('0x18'),_0x2db8b1,JSON[_0xeeeb('0x11')](_0x25e359));_0x1af658(_0x25e359);})[_0xeeeb('0x17')](function(_0x49e349){logger[_0xeeeb('0x12')](_0xeeeb('0x18'),_0x49e349['message'],_0x2db8b1);_0x2dba71(_0x37efe6[_0xeeeb('0x12')](0x1f4,_0x49e349[_0xeeeb('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index be146dd..197a2e9 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 _0xa942=['removeBlackLists','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','clone','addLists','addBlackLists','put','update','delete','destroy','removeLists'];(function(_0x290354,_0x44e8a4){var _0x587db5=function(_0x5185fd){while(--_0x5185fd){_0x290354['push'](_0x290354['shift']());}};_0x587db5(++_0x44e8a4);}(_0xa942,0xc8));var _0x2a94=function(_0x31d9a6,_0x1b1bbd){_0x31d9a6=_0x31d9a6-0x0;var _0x376328=_0xa942[_0x31d9a6];return _0x376328;};'use strict';var multer=require(_0x2a94('0x0'));var util=require(_0x2a94('0x1'));var path=require(_0x2a94('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2a94('0x3')]();var fs_extra=require(_0x2a94('0x4'));var auth=require(_0x2a94('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2a94('0x6'));var controller=require('./campaign.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2a94('0x7')]);router[_0x2a94('0x8')](_0x2a94('0x9'),auth[_0x2a94('0xa')](),controller[_0x2a94('0xb')]);router[_0x2a94('0x8')](_0x2a94('0xc'),auth[_0x2a94('0xa')](),controller[_0x2a94('0xd')]);router[_0x2a94('0x8')](_0x2a94('0xe'),auth[_0x2a94('0xa')](),controller[_0x2a94('0xf')]);router['get']('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0x2a94('0x10')]);router[_0x2a94('0x8')](_0x2a94('0x11'),auth[_0x2a94('0xa')](),controller['getHopperBlacks']);router[_0x2a94('0x8')](_0x2a94('0x12'),auth[_0x2a94('0xa')](),controller[_0x2a94('0x13')]);router['get'](_0x2a94('0x14'),auth[_0x2a94('0xa')](),controller['getBlackLists']);router['post']('/',auth[_0x2a94('0xa')](),controller['create']);router[_0x2a94('0x15')](_0x2a94('0x16'),auth['isAuthenticated'](),controller[_0x2a94('0x17')]);router[_0x2a94('0x15')]('/:id/lists',auth['isAuthenticated'](),controller[_0x2a94('0x18')]);router[_0x2a94('0x15')](_0x2a94('0x14'),auth[_0x2a94('0xa')](),controller[_0x2a94('0x19')]);router[_0x2a94('0x1a')]('/:id',auth[_0x2a94('0xa')](),controller[_0x2a94('0x1b')]);router[_0x2a94('0x1c')]('/:id',auth[_0x2a94('0xa')](),controller[_0x2a94('0x1d')]);router[_0x2a94('0x1c')](_0x2a94('0x12'),auth[_0x2a94('0xa')](),controller[_0x2a94('0x1e')]);router['delete'](_0x2a94('0x14'),auth[_0x2a94('0xa')](),controller[_0x2a94('0x1f')]);module[_0x2a94('0x20')]=router; \ No newline at end of file +var _0x0a0b=['/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','clone','addLists','addBlackLists','update','delete','destroy','removeLists','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./campaign.controller','get','isAuthenticated','index'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x0a0b,0x71));var _0xb0a0=function(_0x7025b0,_0x9533f1){_0x7025b0=_0x7025b0-0x0;var _0x6e444c=_0x0a0b[_0x7025b0];return _0x6e444c;};'use strict';var multer=require(_0xb0a0('0x0'));var util=require(_0xb0a0('0x1'));var path=require(_0xb0a0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb0a0('0x3')]();var fs_extra=require(_0xb0a0('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xb0a0('0x5'));var config=require(_0xb0a0('0x6'));var controller=require(_0xb0a0('0x7'));router[_0xb0a0('0x8')]('/',auth[_0xb0a0('0x9')](),controller[_0xb0a0('0xa')]);router[_0xb0a0('0x8')](_0xb0a0('0xb'),auth['isAuthenticated'](),controller[_0xb0a0('0xc')]);router[_0xb0a0('0x8')]('/:id/hoppers',auth[_0xb0a0('0x9')](),controller[_0xb0a0('0xd')]);router[_0xb0a0('0x8')](_0xb0a0('0xe'),auth[_0xb0a0('0x9')](),controller[_0xb0a0('0xf')]);router[_0xb0a0('0x8')](_0xb0a0('0x10'),auth[_0xb0a0('0x9')](),controller['getHopperFinals']);router[_0xb0a0('0x8')](_0xb0a0('0x11'),auth['isAuthenticated'](),controller[_0xb0a0('0x12')]);router[_0xb0a0('0x8')](_0xb0a0('0x13'),auth['isAuthenticated'](),controller[_0xb0a0('0x14')]);router[_0xb0a0('0x8')](_0xb0a0('0x15'),auth[_0xb0a0('0x9')](),controller['getBlackLists']);router[_0xb0a0('0x16')]('/',auth[_0xb0a0('0x9')](),controller[_0xb0a0('0x17')]);router[_0xb0a0('0x16')]('/:id/clone',auth[_0xb0a0('0x9')](),controller[_0xb0a0('0x18')]);router[_0xb0a0('0x16')](_0xb0a0('0x13'),auth[_0xb0a0('0x9')](),controller[_0xb0a0('0x19')]);router[_0xb0a0('0x16')]('/:id/blacklists',auth[_0xb0a0('0x9')](),controller[_0xb0a0('0x1a')]);router['put'](_0xb0a0('0xb'),auth[_0xb0a0('0x9')](),controller[_0xb0a0('0x1b')]);router[_0xb0a0('0x1c')](_0xb0a0('0xb'),auth['isAuthenticated'](),controller[_0xb0a0('0x1d')]);router['delete'](_0xb0a0('0x13'),auth[_0xb0a0('0x9')](),controller[_0xb0a0('0x1e')]);router[_0xb0a0('0x1c')](_0xb0a0('0x15'),auth[_0xb0a0('0x9')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 7086e4d..c5db0af 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 _0xa04b=['sequelize','exports','STRING','TEXT','VIRTUAL','getDataValue','key'];(function(_0x5980cf,_0x807da8){var _0x110036=function(_0x45c225){while(--_0x45c225){_0x5980cf['push'](_0x5980cf['shift']());}};_0x110036(++_0x807da8);}(_0xa04b,0xc4));var _0xba04=function(_0x2bfb65,_0x3bfe1f){_0x2bfb65=_0x2bfb65-0x0;var _0x3c4250=_0xa04b[_0x2bfb65];return _0x3c4250;};'use strict';var Sequelize=require(_0xba04('0x0'));module[_0xba04('0x1')]={'key':{'type':Sequelize[_0xba04('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0xba04('0x3')],'length':'medium','allowNull':![]},'description':{'type':Sequelize[_0xba04('0x2')]},'name':{'type':Sequelize[_0xba04('0x4')],'get':function(){return this[_0xba04('0x5')](_0xba04('0x6'));}}}; \ No newline at end of file +var _0x8da5=['TEXT','medium','VIRTUAL','getDataValue','key','sequelize','exports','STRING'];(function(_0x102ff9,_0x907658){var _0x24fa97=function(_0x3622ff){while(--_0x3622ff){_0x102ff9['push'](_0x102ff9['shift']());}};_0x24fa97(++_0x907658);}(_0x8da5,0x1dd));var _0x58da=function(_0x114469,_0x235c48){_0x114469=_0x114469-0x0;var _0x216ac6=_0x8da5[_0x114469];return _0x216ac6;};'use strict';var Sequelize=require(_0x58da('0x0'));module[_0x58da('0x1')]={'key':{'type':Sequelize[_0x58da('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x58da('0x3')],'length':_0x58da('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x58da('0x5')],'get':function(){return this[_0x58da('0x6')](_0x58da('0x7'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 5d2cc88..e1f4d85 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 _0xc5ba=['api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','CannedAnswers','error','stack','name','send','index','map','CannedAnswer','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','findAll','catch','show','params','include','find','create','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x158c34,_0x304597){var _0x5290c8=function(_0xa2170f){while(--_0xa2170f){_0x158c34['push'](_0x158c34['shift']());}};_0x5290c8(++_0x304597);}(_0xc5ba,0x1b2));var _0xac5b=function(_0x2c4570,_0x21871d){_0x2c4570=_0x2c4570-0x0;var _0x26f4b0=_0xc5ba[_0x2c4570];return _0x26f4b0;};'use strict';var emlformat=require(_0xac5b('0x0'));var rimraf=require(_0xac5b('0x1'));var zipdir=require(_0xac5b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xac5b('0x3'));var BPromise=require(_0xac5b('0x4'));var Mustache=require(_0xac5b('0x5'));var util=require(_0xac5b('0x6'));var path=require(_0xac5b('0x7'));var sox=require('sox');var csv=require(_0xac5b('0x8'));var ejs=require(_0xac5b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xac5b('0xa'));var squel=require(_0xac5b('0xb'));var crypto=require(_0xac5b('0xc'));var jsforce=require(_0xac5b('0xd'));var deskjs=require(_0xac5b('0xe'));var toCsv=require(_0xac5b('0x8'));var querystring=require(_0xac5b('0xf'));var Papa=require('papaparse');var Redis=require(_0xac5b('0x10'));var authService=require(_0xac5b('0x11'));var qs=require(_0xac5b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xac5b('0x13'));var logger=require(_0xac5b('0x14'))(_0xac5b('0x15'));var utils=require(_0xac5b('0x16'));var config=require(_0xac5b('0x17'));var licenseUtil=require(_0xac5b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2076c6,_0x27634a){_0x27634a=_0x27634a||0xcc;return function(_0x2fd2d9){if(_0x2fd2d9){return _0x2076c6[_0xac5b('0x19')](_0x27634a);}return _0x2076c6['status'](_0x27634a)[_0xac5b('0x1a')]();};}function respondWithResult(_0x31c56c,_0xcd8537){_0xcd8537=_0xcd8537||0xc8;return function(_0x46addd){if(_0x46addd){return _0x31c56c[_0xac5b('0x1b')](_0xcd8537)[_0xac5b('0x1c')](_0x46addd);}};}function respondWithFilteredResult(_0x5f28dc,_0x20a19b){return function(_0x15f09b){if(_0x15f09b){var _0x2d13d4=typeof _0x20a19b[_0xac5b('0x1d')]==='undefined'&&typeof _0x20a19b['limit']===_0xac5b('0x1e');var _0x7bbf11=_0x15f09b['count'];var _0x37ab9f=_0x2d13d4?0x0:_0x20a19b['offset'];var _0x293ec3=_0x2d13d4?_0x15f09b[_0xac5b('0x1f')]:_0x20a19b[_0xac5b('0x1d')]+_0x20a19b[_0xac5b('0x20')];var _0x3a3500;if(_0x293ec3>=_0x7bbf11){_0x293ec3=_0x7bbf11;_0x3a3500=0xc8;}else{_0x3a3500=0xce;}_0x5f28dc[_0xac5b('0x1b')](_0x3a3500);return _0x5f28dc[_0xac5b('0x21')](_0xac5b('0x22'),_0x37ab9f+'-'+_0x293ec3+'/'+_0x7bbf11)[_0xac5b('0x1c')](_0x15f09b);}return null;};}function patchUpdates(_0x3e6d2d){return function(_0x256d76){try{jsonpatch[_0xac5b('0x23')](_0x256d76,_0x3e6d2d,!![]);}catch(_0xf6cb0d){return BPromise[_0xac5b('0x24')](_0xf6cb0d);}return _0x256d76[_0xac5b('0x25')]();};}function saveUpdates(_0x3e5e67,_0x41f5de){return function(_0x215a28){if(_0x215a28){return _0x215a28[_0xac5b('0x26')](_0x3e5e67)[_0xac5b('0x27')](function(_0x582716){return _0x582716;});}return null;};}function removeEntity(_0x14ac98,_0x3c9e7b){return function(_0x3a6562){if(_0x3a6562){return _0x3a6562[_0xac5b('0x28')]()[_0xac5b('0x27')](function(){var _0xaf03b=_0x3a6562['get']({'plain':!![]});var _0x3810e1=_0xac5b('0x29');return db['UserProfileResource'][_0xac5b('0x28')]({'where':{'type':_0x3810e1,'resourceId':_0xaf03b['id']}})[_0xac5b('0x27')](function(){return _0x3a6562;});})[_0xac5b('0x27')](function(){_0x14ac98[_0xac5b('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1df37c,_0x113432){return function(_0x371be2){if(!_0x371be2){_0x1df37c[_0xac5b('0x19')](0x194);}return _0x371be2;};}function handleError(_0x3d6bf9,_0x25608b){_0x25608b=_0x25608b||0x1f4;return function(_0x3f4c7b){logger[_0xac5b('0x2a')](_0x3f4c7b[_0xac5b('0x2b')]);if(_0x3f4c7b[_0xac5b('0x2c')]){delete _0x3f4c7b[_0xac5b('0x2c')];}_0x3d6bf9[_0xac5b('0x1b')](_0x25608b)[_0xac5b('0x2d')](_0x3f4c7b);};}exports[_0xac5b('0x2e')]=function(_0x5d397f,_0x2f5e34){var _0x56791e={},_0x3f308f={},_0x2cb5d2={'count':0x0,'rows':[]};var _0x19e669=_[_0xac5b('0x2f')](db[_0xac5b('0x30')][_0xac5b('0x31')],function(_0x534316){return{'name':_0x534316[_0xac5b('0x32')],'type':_0x534316['type'][_0xac5b('0x33')]};});_0x3f308f[_0xac5b('0x34')]=_[_0xac5b('0x2f')](_0x19e669,_0xac5b('0x2c'));_0x3f308f[_0xac5b('0x35')]=_[_0xac5b('0x36')](_0x5d397f[_0xac5b('0x35')]);_0x3f308f[_0xac5b('0x37')]=_[_0xac5b('0x38')](_0x3f308f['model'],_0x3f308f['query']);_0x56791e[_0xac5b('0x39')]=_[_0xac5b('0x38')](_0x3f308f[_0xac5b('0x34')],qs[_0xac5b('0x3a')](_0x5d397f[_0xac5b('0x35')][_0xac5b('0x3a')]));_0x56791e[_0xac5b('0x39')]=_0x56791e[_0xac5b('0x39')][_0xac5b('0x3b')]?_0x56791e[_0xac5b('0x39')]:_0x3f308f[_0xac5b('0x34')];if(!_0x5d397f[_0xac5b('0x35')][_0xac5b('0x3c')]('nolimit')){_0x56791e['limit']=qs[_0xac5b('0x20')](_0x5d397f[_0xac5b('0x35')]['limit']);_0x56791e[_0xac5b('0x1d')]=qs[_0xac5b('0x1d')](_0x5d397f[_0xac5b('0x35')][_0xac5b('0x1d')]);}_0x56791e[_0xac5b('0x3d')]=qs[_0xac5b('0x3e')](_0x5d397f[_0xac5b('0x35')][_0xac5b('0x3e')]);_0x56791e[_0xac5b('0x3f')]=qs[_0xac5b('0x37')](_[_0xac5b('0x40')](_0x5d397f[_0xac5b('0x35')],_0x3f308f['filters']),_0x19e669);if(_0x5d397f['query'][_0xac5b('0x41')]){_0x56791e['where']=_['merge'](_0x56791e['where'],{'$or':[{'key':{'$like':'%'+_0x5d397f['query'][_0xac5b('0x41')]+'%'}},{'value':{'$like':'%'+_0x5d397f['query'][_0xac5b('0x41')]+'%'}}]});}_0x56791e=_[_0xac5b('0x42')]({},_0x56791e,_0x5d397f[_0xac5b('0x43')]);var _0x355da3={'where':_0x56791e[_0xac5b('0x3f')]};return db['CannedAnswer'][_0xac5b('0x1f')](_0x355da3)[_0xac5b('0x27')](function(_0x100c02){_0x2cb5d2[_0xac5b('0x1f')]=_0x100c02;if(_0x5d397f[_0xac5b('0x35')][_0xac5b('0x44')]){_0x56791e['include']=[{'all':!![]}];}return db[_0xac5b('0x30')][_0xac5b('0x45')](_0x56791e);})[_0xac5b('0x27')](function(_0x5d2d85){_0x2cb5d2['rows']=_0x5d2d85;return _0x2cb5d2;})[_0xac5b('0x27')](respondWithFilteredResult(_0x2f5e34,_0x56791e))[_0xac5b('0x46')](handleError(_0x2f5e34,null));};exports[_0xac5b('0x47')]=function(_0x50ae71,_0x36fc6b){var _0x1f416d={'raw':!![],'where':{'id':_0x50ae71[_0xac5b('0x48')]['id']}},_0x313477={};_0x313477['model']=_[_0xac5b('0x36')](db[_0xac5b('0x30')]['rawAttributes']);_0x313477[_0xac5b('0x35')]=_[_0xac5b('0x36')](_0x50ae71[_0xac5b('0x35')]);_0x313477[_0xac5b('0x37')]=_['intersection'](_0x313477[_0xac5b('0x34')],_0x313477[_0xac5b('0x35')]);_0x1f416d['attributes']=_[_0xac5b('0x38')](_0x313477[_0xac5b('0x34')],qs[_0xac5b('0x3a')](_0x50ae71[_0xac5b('0x35')]['fields']));_0x1f416d[_0xac5b('0x39')]=_0x1f416d[_0xac5b('0x39')]['length']?_0x1f416d['attributes']:_0x313477['model'];if(_0x50ae71[_0xac5b('0x35')][_0xac5b('0x44')]){_0x1f416d[_0xac5b('0x49')]=[{'all':!![]}];}_0x1f416d=_['merge']({},_0x1f416d,_0x50ae71[_0xac5b('0x43')]);return db[_0xac5b('0x30')][_0xac5b('0x4a')](_0x1f416d)[_0xac5b('0x27')](handleEntityNotFound(_0x36fc6b,null))[_0xac5b('0x27')](respondWithResult(_0x36fc6b,null))[_0xac5b('0x46')](handleError(_0x36fc6b,null));};exports[_0xac5b('0x26')]=function(_0x3c35ab,_0xac5592){if(_0x3c35ab['body']['id']){delete _0x3c35ab['body']['id'];}return db['CannedAnswer']['find']({'where':{'id':_0x3c35ab[_0xac5b('0x48')]['id']}})[_0xac5b('0x27')](handleEntityNotFound(_0xac5592,null))['then'](saveUpdates(_0x3c35ab['body'],null))[_0xac5b('0x27')](respondWithResult(_0xac5592,null))['catch'](handleError(_0xac5592,null));};exports[_0xac5b('0x28')]=function(_0x1a3c71,_0x458ab9){return db['CannedAnswer']['find']({'where':{'id':_0x1a3c71[_0xac5b('0x48')]['id']}})[_0xac5b('0x27')](handleEntityNotFound(_0x458ab9,null))[_0xac5b('0x27')](removeEntity(_0x458ab9,null))[_0xac5b('0x46')](handleError(_0x458ab9,null));};exports[_0xac5b('0x4b')]=function(_0x199d3f,_0x731eb3){var _0x6d762d={'key':_0x199d3f['body'][_0xac5b('0x33')]};if(_0x199d3f[_0xac5b('0x4c')][_0xac5b('0x4d')]){_0x6d762d[_0xac5b('0x4d')]=_0x199d3f[_0xac5b('0x4c')]['MailAccountId'];}else if(_0x199d3f[_0xac5b('0x4c')][_0xac5b('0x4e')]){_0x6d762d[_0xac5b('0x4e')]=_0x199d3f[_0xac5b('0x4c')]['SmsAccountId'];}else if(_0x199d3f['body'][_0xac5b('0x4f')]){_0x6d762d['OpenchannelAccountId']=_0x199d3f[_0xac5b('0x4c')][_0xac5b('0x4f')];}else if(_0x199d3f[_0xac5b('0x4c')]['ChatWebsiteId']){_0x6d762d['ChatWebsiteId']=_0x199d3f[_0xac5b('0x4c')][_0xac5b('0x50')];}return db[_0xac5b('0x30')][_0xac5b('0x4a')]({'where':_0x6d762d})['then'](function(_0x5c0a7f){if(_0x5c0a7f){throw new db[(_0xac5b('0x51'))][(_0xac5b('0x52'))](_0xac5b('0x53'));}return db['CannedAnswer']['create'](_0x199d3f[_0xac5b('0x4c')]);})[_0xac5b('0x27')](function(_0x4cd187){var _0x2751fb=_0x199d3f[_0xac5b('0x54')][_0xac5b('0x55')]({'plain':!![]});if(!_0x2751fb)throw new Error(_0xac5b('0x56'));if(_0x2751fb[_0xac5b('0x57')]==='user'){var _0x57e5a4=_0x4cd187[_0xac5b('0x55')]({'plain':!![]});return db[_0xac5b('0x58')][_0xac5b('0x4a')]({'where':{'name':_0xac5b('0x29'),'userProfileId':_0x2751fb[_0xac5b('0x59')]},'raw':!![]})[_0xac5b('0x27')](function(_0x27e9bb){if(_0x27e9bb&&_0x27e9bb['autoAssociation']===0x0){return db[_0xac5b('0x5a')][_0xac5b('0x4b')]({'name':_0x57e5a4['name'],'resourceId':_0x57e5a4['id'],'type':_0x27e9bb[_0xac5b('0x2c')],'sectionId':_0x27e9bb['id']},{})[_0xac5b('0x27')](function(){return _0x4cd187;});}else{return _0x4cd187;}})['catch'](function(_0x2ac968){logger[_0xac5b('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ac968);throw _0x2ac968;});}return _0x4cd187;})['then'](respondWithResult(_0x731eb3,0xc9))[_0xac5b('0x46')](handleError(_0x731eb3,null));}; \ No newline at end of file +var _0xe18b=['SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','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','status','end','json','offset','undefined','limit','count','set','Content-Range','save','destroy','get','UserProfileResource','then','stack','name','send','index','map','CannedAnswer','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','options','where','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','update','body','create','key','MailAccountId'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0xe18b,0x1d9));var _0xbe18=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe18b[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xbe18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbe18('0x1'));var jsonpatch=require(_0xbe18('0x2'));var rp=require(_0xbe18('0x3'));var moment=require(_0xbe18('0x4'));var BPromise=require(_0xbe18('0x5'));var Mustache=require(_0xbe18('0x6'));var util=require(_0xbe18('0x7'));var path=require('path');var sox=require(_0xbe18('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbe18('0x9'));var _=require(_0xbe18('0xa'));var squel=require('squel');var crypto=require(_0xbe18('0xb'));var jsforce=require(_0xbe18('0xc'));var deskjs=require(_0xbe18('0xd'));var toCsv=require(_0xbe18('0xe'));var querystring=require('querystring');var Papa=require(_0xbe18('0xf'));var Redis=require('ioredis');var authService=require(_0xbe18('0x10'));var qs=require(_0xbe18('0x11'));var as=require(_0xbe18('0x12'));var hardwareService=require(_0xbe18('0x13'));var logger=require(_0xbe18('0x14'))(_0xbe18('0x15'));var utils=require(_0xbe18('0x16'));var config=require(_0xbe18('0x17'));var licenseUtil=require(_0xbe18('0x18'));var db=require(_0xbe18('0x19'))['db'];function respondWithStatusCode(_0x129c64,_0x25a310){_0x25a310=_0x25a310||0xcc;return function(_0x20f797){if(_0x20f797){return _0x129c64[_0xbe18('0x1a')](_0x25a310);}return _0x129c64[_0xbe18('0x1b')](_0x25a310)[_0xbe18('0x1c')]();};}function respondWithResult(_0xb8db17,_0x111675){_0x111675=_0x111675||0xc8;return function(_0x29b6ed){if(_0x29b6ed){return _0xb8db17['status'](_0x111675)[_0xbe18('0x1d')](_0x29b6ed);}};}function respondWithFilteredResult(_0x1eacb4,_0x45d98c){return function(_0xa4054f){if(_0xa4054f){var _0x48028b=typeof _0x45d98c[_0xbe18('0x1e')]===_0xbe18('0x1f')&&typeof _0x45d98c[_0xbe18('0x20')]===_0xbe18('0x1f');var _0x1555a3=_0xa4054f[_0xbe18('0x21')];var _0x4bfff0=_0x48028b?0x0:_0x45d98c['offset'];var _0x128830=_0x48028b?_0xa4054f[_0xbe18('0x21')]:_0x45d98c[_0xbe18('0x1e')]+_0x45d98c[_0xbe18('0x20')];var _0x5f0659;if(_0x128830>=_0x1555a3){_0x128830=_0x1555a3;_0x5f0659=0xc8;}else{_0x5f0659=0xce;}_0x1eacb4[_0xbe18('0x1b')](_0x5f0659);return _0x1eacb4[_0xbe18('0x22')](_0xbe18('0x23'),_0x4bfff0+'-'+_0x128830+'/'+_0x1555a3)[_0xbe18('0x1d')](_0xa4054f);}return null;};}function patchUpdates(_0x59a8ad){return function(_0xcbf855){try{jsonpatch['apply'](_0xcbf855,_0x59a8ad,!![]);}catch(_0x6d4cfd){return BPromise['reject'](_0x6d4cfd);}return _0xcbf855[_0xbe18('0x24')]();};}function saveUpdates(_0xd03aba,_0x1afc5a){return function(_0x34b489){if(_0x34b489){return _0x34b489['update'](_0xd03aba)['then'](function(_0x4d593d){return _0x4d593d;});}return null;};}function removeEntity(_0x1e6e42,_0x55821f){return function(_0x4a827b){if(_0x4a827b){return _0x4a827b[_0xbe18('0x25')]()['then'](function(){var _0x58c47d=_0x4a827b[_0xbe18('0x26')]({'plain':!![]});var _0x9ce77e='CannedAnswers';return db[_0xbe18('0x27')]['destroy']({'where':{'type':_0x9ce77e,'resourceId':_0x58c47d['id']}})[_0xbe18('0x28')](function(){return _0x4a827b;});})[_0xbe18('0x28')](function(){_0x1e6e42[_0xbe18('0x1b')](0xcc)[_0xbe18('0x1c')]();});}};}function handleEntityNotFound(_0x4dc5d5,_0x55a1a8){return function(_0x4cf71d){if(!_0x4cf71d){_0x4dc5d5[_0xbe18('0x1a')](0x194);}return _0x4cf71d;};}function handleError(_0x25aa7c,_0x230718){_0x230718=_0x230718||0x1f4;return function(_0x2c6588){logger['error'](_0x2c6588[_0xbe18('0x29')]);if(_0x2c6588[_0xbe18('0x2a')]){delete _0x2c6588[_0xbe18('0x2a')];}_0x25aa7c[_0xbe18('0x1b')](_0x230718)[_0xbe18('0x2b')](_0x2c6588);};}exports[_0xbe18('0x2c')]=function(_0x490986,_0x1f4e9f){var _0x52c0c1={},_0x108631={},_0x2c7f74={'count':0x0,'rows':[]};var _0x253063=_[_0xbe18('0x2d')](db[_0xbe18('0x2e')]['rawAttributes'],function(_0x3dad60){return{'name':_0x3dad60[_0xbe18('0x2f')],'type':_0x3dad60[_0xbe18('0x30')]['key']};});_0x108631[_0xbe18('0x31')]=_['map'](_0x253063,_0xbe18('0x2a'));_0x108631[_0xbe18('0x32')]=_[_0xbe18('0x33')](_0x490986[_0xbe18('0x32')]);_0x108631[_0xbe18('0x34')]=_['intersection'](_0x108631[_0xbe18('0x31')],_0x108631[_0xbe18('0x32')]);_0x52c0c1['attributes']=_[_0xbe18('0x35')](_0x108631[_0xbe18('0x31')],qs[_0xbe18('0x36')](_0x490986[_0xbe18('0x32')][_0xbe18('0x36')]));_0x52c0c1[_0xbe18('0x37')]=_0x52c0c1[_0xbe18('0x37')][_0xbe18('0x38')]?_0x52c0c1['attributes']:_0x108631['model'];if(!_0x490986['query'][_0xbe18('0x39')](_0xbe18('0x3a'))){_0x52c0c1[_0xbe18('0x20')]=qs[_0xbe18('0x20')](_0x490986[_0xbe18('0x32')]['limit']);_0x52c0c1[_0xbe18('0x1e')]=qs['offset'](_0x490986[_0xbe18('0x32')]['offset']);}_0x52c0c1[_0xbe18('0x3b')]=qs[_0xbe18('0x3c')](_0x490986[_0xbe18('0x32')][_0xbe18('0x3c')]);_0x52c0c1['where']=qs[_0xbe18('0x34')](_['pick'](_0x490986['query'],_0x108631[_0xbe18('0x34')]),_0x253063);if(_0x490986[_0xbe18('0x32')][_0xbe18('0x3d')]){_0x52c0c1['where']=_['merge'](_0x52c0c1['where'],{'$or':[{'key':{'$like':'%'+_0x490986['query'][_0xbe18('0x3d')]+'%'}},{'value':{'$like':'%'+_0x490986[_0xbe18('0x32')][_0xbe18('0x3d')]+'%'}}]});}_0x52c0c1=_[_0xbe18('0x3e')]({},_0x52c0c1,_0x490986[_0xbe18('0x3f')]);var _0x1c664d={'where':_0x52c0c1[_0xbe18('0x40')]};return db[_0xbe18('0x2e')][_0xbe18('0x21')](_0x1c664d)[_0xbe18('0x28')](function(_0x1ad5f6){_0x2c7f74['count']=_0x1ad5f6;if(_0x490986[_0xbe18('0x32')][_0xbe18('0x41')]){_0x52c0c1[_0xbe18('0x42')]=[{'all':!![]}];}return db[_0xbe18('0x2e')][_0xbe18('0x43')](_0x52c0c1);})[_0xbe18('0x28')](function(_0x4cbbc0){_0x2c7f74[_0xbe18('0x44')]=_0x4cbbc0;return _0x2c7f74;})[_0xbe18('0x28')](respondWithFilteredResult(_0x1f4e9f,_0x52c0c1))[_0xbe18('0x45')](handleError(_0x1f4e9f,null));};exports[_0xbe18('0x46')]=function(_0x46def4,_0x1fe281){var _0x7c3800={'raw':!![],'where':{'id':_0x46def4[_0xbe18('0x47')]['id']}},_0x10e4cf={};_0x10e4cf[_0xbe18('0x31')]=_[_0xbe18('0x33')](db[_0xbe18('0x2e')][_0xbe18('0x48')]);_0x10e4cf[_0xbe18('0x32')]=_[_0xbe18('0x33')](_0x46def4[_0xbe18('0x32')]);_0x10e4cf[_0xbe18('0x34')]=_[_0xbe18('0x35')](_0x10e4cf[_0xbe18('0x31')],_0x10e4cf['query']);_0x7c3800[_0xbe18('0x37')]=_[_0xbe18('0x35')](_0x10e4cf[_0xbe18('0x31')],qs['fields'](_0x46def4[_0xbe18('0x32')][_0xbe18('0x36')]));_0x7c3800['attributes']=_0x7c3800[_0xbe18('0x37')][_0xbe18('0x38')]?_0x7c3800[_0xbe18('0x37')]:_0x10e4cf[_0xbe18('0x31')];if(_0x46def4[_0xbe18('0x32')][_0xbe18('0x41')]){_0x7c3800[_0xbe18('0x42')]=[{'all':!![]}];}_0x7c3800=_[_0xbe18('0x3e')]({},_0x7c3800,_0x46def4[_0xbe18('0x3f')]);return db[_0xbe18('0x2e')][_0xbe18('0x49')](_0x7c3800)[_0xbe18('0x28')](handleEntityNotFound(_0x1fe281,null))[_0xbe18('0x28')](respondWithResult(_0x1fe281,null))[_0xbe18('0x45')](handleError(_0x1fe281,null));};exports[_0xbe18('0x4a')]=function(_0x2e5a39,_0x1e0afa){if(_0x2e5a39[_0xbe18('0x4b')]['id']){delete _0x2e5a39[_0xbe18('0x4b')]['id'];}return db[_0xbe18('0x2e')]['find']({'where':{'id':_0x2e5a39[_0xbe18('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e0afa,null))['then'](saveUpdates(_0x2e5a39[_0xbe18('0x4b')],null))[_0xbe18('0x28')](respondWithResult(_0x1e0afa,null))[_0xbe18('0x45')](handleError(_0x1e0afa,null));};exports[_0xbe18('0x25')]=function(_0x142ee5,_0x4d18c0){return db[_0xbe18('0x2e')][_0xbe18('0x49')]({'where':{'id':_0x142ee5['params']['id']}})[_0xbe18('0x28')](handleEntityNotFound(_0x4d18c0,null))[_0xbe18('0x28')](removeEntity(_0x4d18c0,null))['catch'](handleError(_0x4d18c0,null));};exports[_0xbe18('0x4c')]=function(_0x103b06,_0x2a7eab){var _0x1b1c1f={'key':_0x103b06['body'][_0xbe18('0x4d')]};if(_0x103b06[_0xbe18('0x4b')][_0xbe18('0x4e')]){_0x1b1c1f[_0xbe18('0x4e')]=_0x103b06[_0xbe18('0x4b')]['MailAccountId'];}else if(_0x103b06[_0xbe18('0x4b')][_0xbe18('0x4f')]){_0x1b1c1f['SmsAccountId']=_0x103b06[_0xbe18('0x4b')][_0xbe18('0x4f')];}else if(_0x103b06['body']['OpenchannelAccountId']){_0x1b1c1f[_0xbe18('0x50')]=_0x103b06[_0xbe18('0x4b')][_0xbe18('0x50')];}else if(_0x103b06[_0xbe18('0x4b')]['ChatWebsiteId']){_0x1b1c1f[_0xbe18('0x51')]=_0x103b06[_0xbe18('0x4b')][_0xbe18('0x51')];}return db[_0xbe18('0x2e')][_0xbe18('0x49')]({'where':_0x1b1c1f})[_0xbe18('0x28')](function(_0x3d189c){if(_0x3d189c){throw new db[(_0xbe18('0x52'))][(_0xbe18('0x53'))](_0xbe18('0x54'));}return db[_0xbe18('0x2e')][_0xbe18('0x4c')](_0x103b06['body']);})[_0xbe18('0x28')](function(_0x2fe3ad){var _0x2d729b=_0x103b06['user'][_0xbe18('0x26')]({'plain':!![]});if(!_0x2d729b)throw new Error(_0xbe18('0x55'));if(_0x2d729b[_0xbe18('0x56')]==='user'){var _0x30d33d=_0x2fe3ad[_0xbe18('0x26')]({'plain':!![]});return db[_0xbe18('0x57')][_0xbe18('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x2d729b[_0xbe18('0x58')]},'raw':!![]})['then'](function(_0x15605e){if(_0x15605e&&_0x15605e[_0xbe18('0x59')]===0x0){return db[_0xbe18('0x27')][_0xbe18('0x4c')]({'name':_0x30d33d[_0xbe18('0x2a')],'resourceId':_0x30d33d['id'],'type':_0x15605e[_0xbe18('0x2a')],'sectionId':_0x15605e['id']},{})[_0xbe18('0x28')](function(){return _0x2fe3ad;});}else{return _0x2fe3ad;}})[_0xbe18('0x45')](function(_0x5d8b82){logger[_0xbe18('0x5a')](_0xbe18('0x5b'),_0x5d8b82);throw _0x5d8b82;});}return _0x2fe3ad;})[_0xbe18('0x28')](respondWithResult(_0x2a7eab,0xc9))[_0xbe18('0x45')](handleError(_0x2a7eab,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 8b75575..2b7dbfb 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 _0x880a=['utf8mb4_unicode_ci','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4'];(function(_0x5678b5,_0x1c4aa8){var _0x4c09a5=function(_0x2aa89a){while(--_0x2aa89a){_0x5678b5['push'](_0x5678b5['shift']());}};_0x4c09a5(++_0x1c4aa8);}(_0x880a,0xe5));var _0xa880=function(_0x119fa6,_0x32a8ae){_0x119fa6=_0x119fa6-0x0;var _0x1e8732=_0x880a[_0x119fa6];return _0x1e8732;};'use strict';var _=require(_0xa880('0x0'));var util=require(_0xa880('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa880('0x2'));var rp=require(_0xa880('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa880('0x4'));var config=require(_0xa880('0x5'));var attributes=require(_0xa880('0x6'));module[_0xa880('0x7')]=function(_0x49a16c,_0x96355a){return _0x49a16c[_0xa880('0x8')]('CannedAnswer',attributes,{'tableName':_0xa880('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa880('0xa'),'collate':_0xa880('0xb')});}; \ No newline at end of file +var _0x6910=['exports','define','CannedAnswer','tools_canned_answers','utf8mb4','lodash','util','moment','bluebird','path','rimraf','../../config/environment','./cannedAnswer.attributes'];(function(_0x2283dc,_0x2fcfc5){var _0x16db90=function(_0x376c35){while(--_0x376c35){_0x2283dc['push'](_0x2283dc['shift']());}};_0x16db90(++_0x2fcfc5);}(_0x6910,0x1cc));var _0x0691=function(_0x39cd3c,_0xa21102){_0x39cd3c=_0x39cd3c-0x0;var _0x47a0ae=_0x6910[_0x39cd3c];return _0x47a0ae;};'use strict';var _=require(_0x0691('0x0'));var util=require(_0x0691('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0691('0x2'));var BPromise=require(_0x0691('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0691('0x4'));var rimraf=require(_0x0691('0x5'));var config=require(_0x0691('0x6'));var attributes=require(_0x0691('0x7'));module[_0x0691('0x8')]=function(_0x16f626,_0x1a8b82){return _0x16f626[_0x0691('0x9')](_0x0691('0xa'),attributes,{'tableName':_0x0691('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0691('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 b558a51..de0a5b6 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(_0x35997e,_0x1c724e){var _0x2effc4=function(_0x1a6148){while(--_0x1a6148){_0x35997e['push'](_0x35997e['shift']());}};_0x2effc4(++_0x1c724e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'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(_0x4b1bf7,_0x342159){var _0x402192=function(_0x4bfc15){while(--_0x4bfc15){_0x4b1bf7['push'](_0x4b1bf7['shift']());}};_0x402192(++_0x342159);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 3626c0b..bd7c16c 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 _0xfdd7=['fs-extra','../../components/interaction/service','./cannedAnswer.controller','get','isAuthenticated','index','show','post','put','/:id','delete','destroy','exports','multer','express','Router'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xfdd7,0x14d));var _0x7fdd=function(_0x356513,_0x2815b4){_0x356513=_0x356513-0x0;var _0x3e058b=_0xfdd7[_0x356513];return _0x3e058b;};'use strict';var multer=require(_0x7fdd('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7fdd('0x1'));var router=express[_0x7fdd('0x2')]();var fs_extra=require(_0x7fdd('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x7fdd('0x4'));var config=require('../../config/environment');var controller=require(_0x7fdd('0x5'));router[_0x7fdd('0x6')]('/',auth[_0x7fdd('0x7')](),controller[_0x7fdd('0x8')]);router[_0x7fdd('0x6')]('/:id',auth[_0x7fdd('0x7')](),controller[_0x7fdd('0x9')]);router[_0x7fdd('0xa')]('/',auth[_0x7fdd('0x7')](),controller['create']);router[_0x7fdd('0xb')](_0x7fdd('0xc'),auth[_0x7fdd('0x7')](),controller['update']);router[_0x7fdd('0xd')](_0x7fdd('0xc'),auth[_0x7fdd('0x7')](),controller[_0x7fdd('0xe')]);module[_0x7fdd('0xf')]=router; \ No newline at end of file +var _0x29d8=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','post','create','put','exports'];(function(_0x46ae74,_0x5ec39d){var _0x1e9860=function(_0x3f5bb9){while(--_0x3f5bb9){_0x46ae74['push'](_0x46ae74['shift']());}};_0x1e9860(++_0x5ec39d);}(_0x29d8,0xfc));var _0x829d=function(_0x3f602f,_0x56b053){_0x3f602f=_0x3f602f-0x0;var _0x41912c=_0x29d8[_0x3f602f];return _0x41912c;};'use strict';var multer=require('multer');var util=require(_0x829d('0x0'));var path=require(_0x829d('0x1'));var timeout=require(_0x829d('0x2'));var express=require(_0x829d('0x3'));var router=express[_0x829d('0x4')]();var fs_extra=require(_0x829d('0x5'));var auth=require(_0x829d('0x6'));var interaction=require(_0x829d('0x7'));var config=require(_0x829d('0x8'));var controller=require('./cannedAnswer.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x829d('0x9')]);router[_0x829d('0xa')](_0x829d('0xb'),auth[_0x829d('0xc')](),controller[_0x829d('0xd')]);router[_0x829d('0xe')]('/',auth[_0x829d('0xc')](),controller[_0x829d('0xf')]);router[_0x829d('0x10')](_0x829d('0xb'),auth[_0x829d('0xc')](),controller['update']);router['delete'](_0x829d('0xb'),auth[_0x829d('0xc')](),controller['destroy']);module[_0x829d('0x11')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 072bbe5..48f21d0 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 _0x62f8=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','exports'];(function(_0x210ac5,_0x397fd2){var _0x26978b=function(_0x400420){while(--_0x400420){_0x210ac5['push'](_0x210ac5['shift']());}};_0x26978b(++_0x397fd2);}(_0x62f8,0x13a));var _0x862f=function(_0x3496c4,_0x303861){_0x3496c4=_0x3496c4-0x0;var _0x4cf6e0=_0x62f8[_0x3496c4];return _0x4cf6e0;};'use strict';var Sequelize=require('sequelize');module[_0x862f('0x0')]={'calldate':{'type':Sequelize[_0x862f('0x1')],'allowNull':![],'defaultValue':_0x862f('0x2')},'clid':{'type':Sequelize[_0x862f('0x3')]},'src':{'type':Sequelize[_0x862f('0x3')]},'dst':{'type':Sequelize[_0x862f('0x3')]},'dcontext':{'type':Sequelize[_0x862f('0x3')]},'channel':{'type':Sequelize[_0x862f('0x3')]},'dstchannel':{'type':Sequelize[_0x862f('0x3')]},'lastapp':{'type':Sequelize[_0x862f('0x3')]},'lastdata':{'type':Sequelize[_0x862f('0x3')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x862f('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x862f('0x3')]},'amaflags':{'type':Sequelize[_0x862f('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x862f('0x3')]},'userfield':{'type':Sequelize[_0x862f('0x3')]},'uniqueid':{'type':Sequelize[_0x862f('0x3')]},'linkedid':{'type':Sequelize[_0x862f('0x3')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x862f('0x3')]},'type':{'type':Sequelize[_0x862f('0x3')]},'tag':{'type':Sequelize[_0x862f('0x3')]}}; \ No newline at end of file +var _0xbfcc=['INTEGER','sequelize','1970-01-01\x2000:00:01','STRING'];(function(_0xdb9a1b,_0x108ace){var _0x59082a=function(_0x301fe8){while(--_0x301fe8){_0xdb9a1b['push'](_0xdb9a1b['shift']());}};_0x59082a(++_0x108ace);}(_0xbfcc,0x1dd));var _0xcbfc=function(_0x382c73,_0x199cab){_0x382c73=_0x382c73-0x0;var _0x1dd0bf=_0xbfcc[_0x382c73];return _0x1dd0bf;};'use strict';var Sequelize=require(_0xcbfc('0x0'));module['exports']={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0xcbfc('0x1')},'clid':{'type':Sequelize[_0xcbfc('0x2')]},'src':{'type':Sequelize[_0xcbfc('0x2')]},'dst':{'type':Sequelize[_0xcbfc('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0xcbfc('0x2')]},'duration':{'type':Sequelize[_0xcbfc('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xcbfc('0x2')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0xcbfc('0x2')]},'userfield':{'type':Sequelize[_0xcbfc('0x2')]},'uniqueid':{'type':Sequelize[_0xcbfc('0x2')]},'linkedid':{'type':Sequelize[_0xcbfc('0x2')]},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0xcbfc('0x2')]},'type':{'type':Sequelize[_0xcbfc('0x2')]},'tag':{'type':Sequelize[_0xcbfc('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 1299690..7a5f1e6 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 _0xf072=['describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','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','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','Cdr','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','rawAttributes','merge','body','find','params'];(function(_0x1149f8,_0x3cb799){var _0x965be5=function(_0x2af5f6){while(--_0x2af5f6){_0x1149f8['push'](_0x1149f8['shift']());}};_0x965be5(++_0x3cb799);}(_0xf072,0x1cf));var _0x2f07=function(_0x529902,_0x1c9253){_0x529902=_0x529902-0x0;var _0x6f4be6=_0xf072[_0x529902];return _0x6f4be6;};'use strict';var emlformat=require(_0x2f07('0x0'));var rimraf=require(_0x2f07('0x1'));var zipdir=require(_0x2f07('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2f07('0x3'));var moment=require('moment');var BPromise=require(_0x2f07('0x4'));var Mustache=require(_0x2f07('0x5'));var util=require(_0x2f07('0x6'));var path=require('path');var sox=require(_0x2f07('0x7'));var csv=require(_0x2f07('0x8'));var ejs=require(_0x2f07('0x9'));var fs=require('fs');var fs_extra=require(_0x2f07('0xa'));var _=require(_0x2f07('0xb'));var squel=require(_0x2f07('0xc'));var crypto=require(_0x2f07('0xd'));var jsforce=require(_0x2f07('0xe'));var deskjs=require(_0x2f07('0xf'));var toCsv=require(_0x2f07('0x8'));var querystring=require(_0x2f07('0x10'));var Papa=require(_0x2f07('0x11'));var Redis=require(_0x2f07('0x12'));var authService=require(_0x2f07('0x13'));var qs=require(_0x2f07('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f07('0x15'));var logger=require(_0x2f07('0x16'))(_0x2f07('0x17'));var utils=require(_0x2f07('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2f07('0x19'))['db'];function respondWithStatusCode(_0x1e291d,_0x58549c){_0x58549c=_0x58549c||0xcc;return function(_0x6eb88a){if(_0x6eb88a){return _0x1e291d[_0x2f07('0x1a')](_0x58549c);}return _0x1e291d[_0x2f07('0x1b')](_0x58549c)['end']();};}function respondWithResult(_0x211514,_0x443fdc){_0x443fdc=_0x443fdc||0xc8;return function(_0x3596ea){if(_0x3596ea){return _0x211514[_0x2f07('0x1b')](_0x443fdc)[_0x2f07('0x1c')](_0x3596ea);}};}function respondWithFilteredResult(_0x309908,_0x5d32d6){return function(_0x8475cf){if(_0x8475cf){var _0x5a7b5c=typeof _0x5d32d6[_0x2f07('0x1d')]===_0x2f07('0x1e')&&typeof _0x5d32d6[_0x2f07('0x1f')]===_0x2f07('0x1e');var _0x1ec70d=_0x8475cf[_0x2f07('0x20')];var _0x1a6135=_0x5a7b5c?0x0:_0x5d32d6[_0x2f07('0x1d')];var _0x55bd60=_0x5a7b5c?_0x8475cf[_0x2f07('0x20')]:_0x5d32d6['offset']+_0x5d32d6[_0x2f07('0x1f')];var _0x2df6ed;if(_0x55bd60>=_0x1ec70d){_0x55bd60=_0x1ec70d;_0x2df6ed=0xc8;}else{_0x2df6ed=0xce;}_0x309908[_0x2f07('0x1b')](_0x2df6ed);return _0x309908[_0x2f07('0x21')](_0x2f07('0x22'),_0x1a6135+'-'+_0x55bd60+'/'+_0x1ec70d)['json'](_0x8475cf);}return null;};}function patchUpdates(_0x45df73){return function(_0x5a0146){try{jsonpatch['apply'](_0x5a0146,_0x45df73,!![]);}catch(_0x51ed43){return BPromise[_0x2f07('0x23')](_0x51ed43);}return _0x5a0146['save']();};}function saveUpdates(_0xb0c978,_0x5e6ac6){return function(_0x354ee2){if(_0x354ee2){return _0x354ee2[_0x2f07('0x24')](_0xb0c978)[_0x2f07('0x25')](function(_0x307888){return _0x307888;});}return null;};}function removeEntity(_0x49521b,_0x31be77){return function(_0x428d8c){if(_0x428d8c){return _0x428d8c[_0x2f07('0x26')]()['then'](function(){_0x49521b[_0x2f07('0x1b')](0xcc)[_0x2f07('0x27')]();});}};}function handleEntityNotFound(_0x522006,_0x1dcedc){return function(_0x1c9ca1){if(!_0x1c9ca1){_0x522006['sendStatus'](0x194);}return _0x1c9ca1;};}function handleError(_0x427e13,_0x562335){_0x562335=_0x562335||0x1f4;return function(_0x894cd4){logger[_0x2f07('0x28')](_0x894cd4[_0x2f07('0x29')]);if(_0x894cd4[_0x2f07('0x2a')]){delete _0x894cd4[_0x2f07('0x2a')];}_0x427e13[_0x2f07('0x1b')](_0x562335)[_0x2f07('0x2b')](_0x894cd4);};}exports[_0x2f07('0x2c')]=function(_0x3d7fff,_0x468cd8){var _0x3b4e2f={},_0x279eb3={},_0x4c607a={'count':0x0,'rows':[]};var _0x1accef=_[_0x2f07('0x2d')](db[_0x2f07('0x2e')]['rawAttributes'],function(_0x36d4b8){return{'name':_0x36d4b8[_0x2f07('0x2f')],'type':_0x36d4b8[_0x2f07('0x30')]['key']};});_0x279eb3[_0x2f07('0x31')]=_[_0x2f07('0x2d')](_0x1accef,_0x2f07('0x2a'));_0x279eb3[_0x2f07('0x32')]=_[_0x2f07('0x33')](_0x3d7fff[_0x2f07('0x32')]);_0x279eb3[_0x2f07('0x34')]=_['intersection'](_0x279eb3[_0x2f07('0x31')],_0x279eb3['query']);_0x3b4e2f[_0x2f07('0x35')]=_[_0x2f07('0x36')](_0x279eb3[_0x2f07('0x31')],qs[_0x2f07('0x37')](_0x3d7fff[_0x2f07('0x32')][_0x2f07('0x37')]));_0x3b4e2f[_0x2f07('0x35')]=_0x3b4e2f[_0x2f07('0x35')][_0x2f07('0x38')]?_0x3b4e2f[_0x2f07('0x35')]:_0x279eb3[_0x2f07('0x31')];if(!_0x3d7fff[_0x2f07('0x32')][_0x2f07('0x39')](_0x2f07('0x3a'))){_0x3b4e2f[_0x2f07('0x1f')]=qs[_0x2f07('0x1f')](_0x3d7fff['query']['limit']);_0x3b4e2f[_0x2f07('0x1d')]=qs[_0x2f07('0x1d')](_0x3d7fff[_0x2f07('0x32')]['offset']);}_0x3b4e2f['order']=qs[_0x2f07('0x3b')](_0x3d7fff['query'][_0x2f07('0x3b')]);_0x3b4e2f[_0x2f07('0x3c')]=qs[_0x2f07('0x34')](_[_0x2f07('0x3d')](_0x3d7fff[_0x2f07('0x32')],_0x279eb3['filters']),_0x1accef);if(_0x3d7fff[_0x2f07('0x32')]['filter']){_0x3b4e2f[_0x2f07('0x3c')]=_['merge'](_0x3b4e2f[_0x2f07('0x3c')],{'$or':_['map'](_0x1accef,function(_0x508f8a){if(_0x508f8a[_0x2f07('0x30')]!==_0x2f07('0x3e')){var _0x5e96b5={};_0x5e96b5[_0x508f8a[_0x2f07('0x2a')]]={'$like':'%'+_0x3d7fff[_0x2f07('0x32')][_0x2f07('0x3f')]+'%'};return _0x5e96b5;}})});}_0x3b4e2f=_['merge']({},_0x3b4e2f,_0x3d7fff[_0x2f07('0x40')]);var _0x185ef8={'where':_0x3b4e2f[_0x2f07('0x3c')]};return db[_0x2f07('0x2e')][_0x2f07('0x20')](_0x185ef8)[_0x2f07('0x25')](function(_0x1a0ef2){_0x4c607a[_0x2f07('0x20')]=_0x1a0ef2;if(_0x3d7fff['query'][_0x2f07('0x41')]){_0x3b4e2f[_0x2f07('0x42')]=[{'all':!![]}];}return db[_0x2f07('0x2e')][_0x2f07('0x43')](_0x3b4e2f);})[_0x2f07('0x25')](function(_0x2ded2e){_0x4c607a[_0x2f07('0x44')]=_0x2ded2e;return _0x4c607a;})['then'](respondWithFilteredResult(_0x468cd8,_0x3b4e2f))[_0x2f07('0x45')](handleError(_0x468cd8,null));};exports[_0x2f07('0x46')]=function(_0x32e3b0,_0x273c0f){var _0x3db7ad={'raw':!![],'where':{'id':_0x32e3b0['params']['id']}},_0xb6afe8={};_0xb6afe8[_0x2f07('0x31')]=_[_0x2f07('0x33')](db[_0x2f07('0x2e')][_0x2f07('0x47')]);_0xb6afe8['query']=_['keys'](_0x32e3b0[_0x2f07('0x32')]);_0xb6afe8[_0x2f07('0x34')]=_[_0x2f07('0x36')](_0xb6afe8[_0x2f07('0x31')],_0xb6afe8['query']);_0x3db7ad[_0x2f07('0x35')]=_[_0x2f07('0x36')](_0xb6afe8[_0x2f07('0x31')],qs[_0x2f07('0x37')](_0x32e3b0[_0x2f07('0x32')][_0x2f07('0x37')]));_0x3db7ad[_0x2f07('0x35')]=_0x3db7ad[_0x2f07('0x35')][_0x2f07('0x38')]?_0x3db7ad[_0x2f07('0x35')]:_0xb6afe8['model'];if(_0x32e3b0['query']['includeAll']){_0x3db7ad[_0x2f07('0x42')]=[{'all':!![]}];}_0x3db7ad=_[_0x2f07('0x48')]({},_0x3db7ad,_0x32e3b0['options']);return db[_0x2f07('0x2e')]['find'](_0x3db7ad)[_0x2f07('0x25')](handleEntityNotFound(_0x273c0f,null))[_0x2f07('0x25')](respondWithResult(_0x273c0f,null))[_0x2f07('0x45')](handleError(_0x273c0f,null));};exports['create']=function(_0x33f888,_0x350ace){return db['Cdr']['create'](_0x33f888[_0x2f07('0x49')],{})[_0x2f07('0x25')](respondWithResult(_0x350ace,0xc9))[_0x2f07('0x45')](handleError(_0x350ace,null));};exports[_0x2f07('0x24')]=function(_0x1596f8,_0x2f598b){if(_0x1596f8[_0x2f07('0x49')]['id']){delete _0x1596f8[_0x2f07('0x49')]['id'];}return db[_0x2f07('0x2e')][_0x2f07('0x4a')]({'where':{'id':_0x1596f8[_0x2f07('0x4b')]['id']}})[_0x2f07('0x25')](handleEntityNotFound(_0x2f598b,null))[_0x2f07('0x25')](saveUpdates(_0x1596f8[_0x2f07('0x49')],null))[_0x2f07('0x25')](respondWithResult(_0x2f598b,null))[_0x2f07('0x45')](handleError(_0x2f598b,null));};exports['destroy']=function(_0xec609d,_0x91e0e0){return db[_0x2f07('0x2e')][_0x2f07('0x4a')]({'where':{'id':_0xec609d[_0x2f07('0x4b')]['id']}})[_0x2f07('0x25')](handleEntityNotFound(_0x91e0e0,null))[_0x2f07('0x25')](removeEntity(_0x91e0e0,null))[_0x2f07('0x45')](handleError(_0x91e0e0,null));};exports[_0x2f07('0x4c')]=function(_0x5b920b,_0x3354e0){return db[_0x2f07('0x2e')][_0x2f07('0x4c')]()[_0x2f07('0x25')](respondWithResult(_0x3354e0,null))['catch'](handleError(_0x3354e0,null));}; \ No newline at end of file +var _0xab86=['fieldName','type','key','model','keys','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','order','sort','filters','pick','merge','filter','options','includeAll','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','then','destroy','sendStatus','stack','name','send','map','Cdr','rawAttributes'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xab86,0x13e));var _0x6ab8=function(_0x4ee744,_0x182161){_0x4ee744=_0x4ee744-0x0;var _0xd35f8=_0xab86[_0x4ee744];return _0xd35f8;};'use strict';var emlformat=require(_0x6ab8('0x0'));var rimraf=require(_0x6ab8('0x1'));var zipdir=require(_0x6ab8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6ab8('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6ab8('0x4'));var util=require('util');var path=require(_0x6ab8('0x5'));var sox=require(_0x6ab8('0x6'));var csv=require(_0x6ab8('0x7'));var ejs=require(_0x6ab8('0x8'));var fs=require('fs');var fs_extra=require(_0x6ab8('0x9'));var _=require(_0x6ab8('0xa'));var squel=require(_0x6ab8('0xb'));var crypto=require(_0x6ab8('0xc'));var jsforce=require(_0x6ab8('0xd'));var deskjs=require(_0x6ab8('0xe'));var toCsv=require(_0x6ab8('0x7'));var querystring=require(_0x6ab8('0xf'));var Papa=require(_0x6ab8('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6ab8('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ab8('0x12'));var logger=require(_0x6ab8('0x13'))(_0x6ab8('0x14'));var utils=require('../../config/utils');var config=require(_0x6ab8('0x15'));var licenseUtil=require(_0x6ab8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44d1d9,_0x1b9b34){_0x1b9b34=_0x1b9b34||0xcc;return function(_0x408ce1){if(_0x408ce1){return _0x44d1d9['sendStatus'](_0x1b9b34);}return _0x44d1d9[_0x6ab8('0x17')](_0x1b9b34)[_0x6ab8('0x18')]();};}function respondWithResult(_0x60b50,_0x968bac){_0x968bac=_0x968bac||0xc8;return function(_0x1c83a1){if(_0x1c83a1){return _0x60b50[_0x6ab8('0x17')](_0x968bac)[_0x6ab8('0x19')](_0x1c83a1);}};}function respondWithFilteredResult(_0x2043bb,_0x293389){return function(_0x5218e9){if(_0x5218e9){var _0x1f64a3=typeof _0x293389[_0x6ab8('0x1a')]===_0x6ab8('0x1b')&&typeof _0x293389['limit']===_0x6ab8('0x1b');var _0x35b790=_0x5218e9['count'];var _0x543726=_0x1f64a3?0x0:_0x293389[_0x6ab8('0x1a')];var _0x57cd18=_0x1f64a3?_0x5218e9[_0x6ab8('0x1c')]:_0x293389[_0x6ab8('0x1a')]+_0x293389[_0x6ab8('0x1d')];var _0x4e0fbd;if(_0x57cd18>=_0x35b790){_0x57cd18=_0x35b790;_0x4e0fbd=0xc8;}else{_0x4e0fbd=0xce;}_0x2043bb[_0x6ab8('0x17')](_0x4e0fbd);return _0x2043bb[_0x6ab8('0x1e')](_0x6ab8('0x1f'),_0x543726+'-'+_0x57cd18+'/'+_0x35b790)[_0x6ab8('0x19')](_0x5218e9);}return null;};}function patchUpdates(_0x5227c6){return function(_0x301004){try{jsonpatch[_0x6ab8('0x20')](_0x301004,_0x5227c6,!![]);}catch(_0x520cd8){return BPromise['reject'](_0x520cd8);}return _0x301004['save']();};}function saveUpdates(_0x190af2,_0x46cfdc){return function(_0xe2d5d8){if(_0xe2d5d8){return _0xe2d5d8['update'](_0x190af2)[_0x6ab8('0x21')](function(_0x433f37){return _0x433f37;});}return null;};}function removeEntity(_0x50fc50,_0x503f94){return function(_0x8af7e9){if(_0x8af7e9){return _0x8af7e9[_0x6ab8('0x22')]()['then'](function(){_0x50fc50[_0x6ab8('0x17')](0xcc)[_0x6ab8('0x18')]();});}};}function handleEntityNotFound(_0x24e400,_0x3d614b){return function(_0x3ddaeb){if(!_0x3ddaeb){_0x24e400[_0x6ab8('0x23')](0x194);}return _0x3ddaeb;};}function handleError(_0x2e098f,_0x1e26ed){_0x1e26ed=_0x1e26ed||0x1f4;return function(_0x5a1be3){logger['error'](_0x5a1be3[_0x6ab8('0x24')]);if(_0x5a1be3['name']){delete _0x5a1be3[_0x6ab8('0x25')];}_0x2e098f[_0x6ab8('0x17')](_0x1e26ed)[_0x6ab8('0x26')](_0x5a1be3);};}exports['index']=function(_0x525687,_0x4871e3){var _0x79dbd3={},_0x14e822={},_0x3723a7={'count':0x0,'rows':[]};var _0x2f14ea=_[_0x6ab8('0x27')](db[_0x6ab8('0x28')][_0x6ab8('0x29')],function(_0x4eda0b){return{'name':_0x4eda0b[_0x6ab8('0x2a')],'type':_0x4eda0b[_0x6ab8('0x2b')][_0x6ab8('0x2c')]};});_0x14e822[_0x6ab8('0x2d')]=_[_0x6ab8('0x27')](_0x2f14ea,'name');_0x14e822['query']=_[_0x6ab8('0x2e')](_0x525687['query']);_0x14e822['filters']=_[_0x6ab8('0x2f')](_0x14e822[_0x6ab8('0x2d')],_0x14e822['query']);_0x79dbd3[_0x6ab8('0x30')]=_['intersection'](_0x14e822[_0x6ab8('0x2d')],qs[_0x6ab8('0x31')](_0x525687['query']['fields']));_0x79dbd3[_0x6ab8('0x30')]=_0x79dbd3[_0x6ab8('0x30')][_0x6ab8('0x32')]?_0x79dbd3[_0x6ab8('0x30')]:_0x14e822[_0x6ab8('0x2d')];if(!_0x525687[_0x6ab8('0x33')][_0x6ab8('0x34')](_0x6ab8('0x35'))){_0x79dbd3['limit']=qs[_0x6ab8('0x1d')](_0x525687[_0x6ab8('0x33')][_0x6ab8('0x1d')]);_0x79dbd3[_0x6ab8('0x1a')]=qs[_0x6ab8('0x1a')](_0x525687[_0x6ab8('0x33')]['offset']);}_0x79dbd3[_0x6ab8('0x36')]=qs[_0x6ab8('0x37')](_0x525687[_0x6ab8('0x33')]['sort']);_0x79dbd3['where']=qs[_0x6ab8('0x38')](_[_0x6ab8('0x39')](_0x525687[_0x6ab8('0x33')],_0x14e822[_0x6ab8('0x38')]),_0x2f14ea);if(_0x525687[_0x6ab8('0x33')]['filter']){_0x79dbd3['where']=_[_0x6ab8('0x3a')](_0x79dbd3['where'],{'$or':_[_0x6ab8('0x27')](_0x2f14ea,function(_0x9ca6ed){if(_0x9ca6ed['type']!=='VIRTUAL'){var _0x8d76aa={};_0x8d76aa[_0x9ca6ed[_0x6ab8('0x25')]]={'$like':'%'+_0x525687[_0x6ab8('0x33')][_0x6ab8('0x3b')]+'%'};return _0x8d76aa;}})});}_0x79dbd3=_[_0x6ab8('0x3a')]({},_0x79dbd3,_0x525687[_0x6ab8('0x3c')]);var _0xef0ce5={'where':_0x79dbd3['where']};return db['Cdr'][_0x6ab8('0x1c')](_0xef0ce5)[_0x6ab8('0x21')](function(_0x146f43){_0x3723a7[_0x6ab8('0x1c')]=_0x146f43;if(_0x525687['query'][_0x6ab8('0x3d')]){_0x79dbd3['include']=[{'all':!![]}];}return db['Cdr'][_0x6ab8('0x3e')](_0x79dbd3);})[_0x6ab8('0x21')](function(_0x45735d){_0x3723a7[_0x6ab8('0x3f')]=_0x45735d;return _0x3723a7;})[_0x6ab8('0x21')](respondWithFilteredResult(_0x4871e3,_0x79dbd3))[_0x6ab8('0x40')](handleError(_0x4871e3,null));};exports[_0x6ab8('0x41')]=function(_0xf3abb8,_0x2494c3){var _0x45c70d={'raw':!![],'where':{'id':_0xf3abb8[_0x6ab8('0x42')]['id']}},_0xc32c6e={};_0xc32c6e['model']=_[_0x6ab8('0x2e')](db[_0x6ab8('0x28')][_0x6ab8('0x29')]);_0xc32c6e[_0x6ab8('0x33')]=_['keys'](_0xf3abb8[_0x6ab8('0x33')]);_0xc32c6e['filters']=_[_0x6ab8('0x2f')](_0xc32c6e[_0x6ab8('0x2d')],_0xc32c6e['query']);_0x45c70d[_0x6ab8('0x30')]=_[_0x6ab8('0x2f')](_0xc32c6e['model'],qs[_0x6ab8('0x31')](_0xf3abb8[_0x6ab8('0x33')][_0x6ab8('0x31')]));_0x45c70d[_0x6ab8('0x30')]=_0x45c70d[_0x6ab8('0x30')]['length']?_0x45c70d['attributes']:_0xc32c6e['model'];if(_0xf3abb8[_0x6ab8('0x33')][_0x6ab8('0x3d')]){_0x45c70d['include']=[{'all':!![]}];}_0x45c70d=_[_0x6ab8('0x3a')]({},_0x45c70d,_0xf3abb8[_0x6ab8('0x3c')]);return db[_0x6ab8('0x28')][_0x6ab8('0x43')](_0x45c70d)[_0x6ab8('0x21')](handleEntityNotFound(_0x2494c3,null))[_0x6ab8('0x21')](respondWithResult(_0x2494c3,null))['catch'](handleError(_0x2494c3,null));};exports[_0x6ab8('0x44')]=function(_0x74de32,_0x4b00cc){return db[_0x6ab8('0x28')][_0x6ab8('0x44')](_0x74de32[_0x6ab8('0x45')],{})['then'](respondWithResult(_0x4b00cc,0xc9))['catch'](handleError(_0x4b00cc,null));};exports[_0x6ab8('0x46')]=function(_0x4c27fa,_0x31965e){if(_0x4c27fa['body']['id']){delete _0x4c27fa[_0x6ab8('0x45')]['id'];}return db[_0x6ab8('0x28')][_0x6ab8('0x43')]({'where':{'id':_0x4c27fa[_0x6ab8('0x42')]['id']}})[_0x6ab8('0x21')](handleEntityNotFound(_0x31965e,null))[_0x6ab8('0x21')](saveUpdates(_0x4c27fa['body'],null))['then'](respondWithResult(_0x31965e,null))['catch'](handleError(_0x31965e,null));};exports[_0x6ab8('0x22')]=function(_0x54708b,_0xce83a3){return db[_0x6ab8('0x28')][_0x6ab8('0x43')]({'where':{'id':_0x54708b[_0x6ab8('0x42')]['id']}})[_0x6ab8('0x21')](handleEntityNotFound(_0xce83a3,null))[_0x6ab8('0x21')](removeEntity(_0xce83a3,null))[_0x6ab8('0x40')](handleError(_0xce83a3,null));};exports[_0x6ab8('0x47')]=function(_0x4d4e88,_0x1a372b){return db[_0x6ab8('0x28')][_0x6ab8('0x47')]()[_0x6ab8('0x21')](respondWithResult(_0x1a372b,null))['catch'](handleError(_0x1a372b,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 2d7eb32..791b121 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(_0x1633b8,_0x3244e9){var _0x34d717=function(_0x46def1){while(--_0x46def1){_0x1633b8['push'](_0x1633b8['shift']());}};_0x34d717(++_0x3244e9);}(_0x7a54,0x106));var _0x47a5=function(_0x4b12d6,_0x2e1f3f){_0x4b12d6=_0x4b12d6-0x0;var _0x25df4a=_0x7a54[_0x4b12d6];return _0x25df4a;};'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 _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x2144c5,_0x2c6a84){var _0x23b17c=function(_0x55110a){while(--_0x55110a){_0x2144c5['push'](_0x2144c5['shift']());}};_0x23b17c(++_0x2c6a84);}(_0x7a54,0x106));var _0x47a5=function(_0x4575fa,_0x43f15b){_0x4575fa=_0x4575fa-0x0;var _0x4194d3=_0x7a54[_0x4575fa];return _0x4194d3;};'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 diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 0975c64..9bec3c7 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 _0x787d=['info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x787d,0x1ab));var _0xd787=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0x787d[_0x5e6ea3];return _0x4048b5;};'use strict';var _=require(_0xd787('0x0'));var util=require(_0xd787('0x1'));var moment=require(_0xd787('0x2'));var BPromise=require(_0xd787('0x3'));var rs=require(_0xd787('0x4'));var fs=require('fs');var Redis=require(_0xd787('0x5'));var db=require(_0xd787('0x6'))['db'];var utils=require(_0xd787('0x7'));var logger=require(_0xd787('0x8'))('rpc');var config=require(_0xd787('0x9'));var jayson=require(_0xd787('0xa'));var client=jayson[_0xd787('0xb')][_0xd787('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3009a4,_0x2f9bd5,_0xd6e500){return new BPromise(function(_0x579a9c,_0x3414c6){return client[_0xd787('0xd')](_0x3009a4,_0xd6e500)[_0xd787('0xe')](function(_0x7d3c51){logger[_0xd787('0xf')](_0xd787('0x10'),_0x2f9bd5,_0xd787('0x11'));logger[_0xd787('0x12')](_0xd787('0x13'),_0x2f9bd5,_0xd787('0x11'),JSON[_0xd787('0x14')](_0x7d3c51));if(_0x7d3c51[_0xd787('0x15')]){if(_0x7d3c51[_0xd787('0x15')][_0xd787('0x16')]===0x1f4){logger[_0xd787('0x15')](_0xd787('0x10'),_0x2f9bd5,_0x7d3c51[_0xd787('0x15')][_0xd787('0x17')]);return _0x3414c6(_0x7d3c51['error'][_0xd787('0x17')]);}logger[_0xd787('0x15')]('Cdr,\x20%s,\x20%s',_0x2f9bd5,_0x7d3c51[_0xd787('0x15')][_0xd787('0x17')]);return _0x579a9c(_0x7d3c51[_0xd787('0x15')][_0xd787('0x17')]);}else{logger[_0xd787('0xf')](_0xd787('0x10'),_0x2f9bd5,_0xd787('0x11'));_0x579a9c(_0x7d3c51[_0xd787('0x18')][_0xd787('0x17')]);}})[_0xd787('0x19')](function(_0x100a36){logger[_0xd787('0x15')](_0xd787('0x10'),_0x2f9bd5,_0x100a36);_0x3414c6(_0x100a36);});});} \ No newline at end of file +var _0xfbc9=['message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','Cdr,\x20%s,\x20%s'];(function(_0x2801ce,_0x56a486){var _0x6b7f1d=function(_0x53b7f1){while(--_0x53b7f1){_0x2801ce['push'](_0x2801ce['shift']());}};_0x6b7f1d(++_0x56a486);}(_0xfbc9,0x137));var _0x9fbc=function(_0x51b5a2,_0x2f25ea){_0x51b5a2=_0x51b5a2-0x0;var _0x501cb1=_0xfbc9[_0x51b5a2];return _0x501cb1;};'use strict';var _=require('lodash');var util=require(_0x9fbc('0x0'));var moment=require(_0x9fbc('0x1'));var BPromise=require('bluebird');var rs=require(_0x9fbc('0x2'));var fs=require('fs');var Redis=require(_0x9fbc('0x3'));var db=require(_0x9fbc('0x4'))['db'];var utils=require(_0x9fbc('0x5'));var logger=require(_0x9fbc('0x6'))(_0x9fbc('0x7'));var config=require(_0x9fbc('0x8'));var jayson=require(_0x9fbc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a6fea,_0x365b23,_0x24659d){return new BPromise(function(_0x2d6ad5,_0x1c627e){return client[_0x9fbc('0xa')](_0x1a6fea,_0x24659d)[_0x9fbc('0xb')](function(_0x4a2bd3){logger[_0x9fbc('0xc')]('Cdr,\x20%s,\x20%s',_0x365b23,_0x9fbc('0xd'));logger[_0x9fbc('0xe')](_0x9fbc('0xf'),_0x365b23,_0x9fbc('0xd'),JSON[_0x9fbc('0x10')](_0x4a2bd3));if(_0x4a2bd3[_0x9fbc('0x11')]){if(_0x4a2bd3[_0x9fbc('0x11')]['code']===0x1f4){logger[_0x9fbc('0x11')](_0x9fbc('0x12'),_0x365b23,_0x4a2bd3[_0x9fbc('0x11')][_0x9fbc('0x13')]);return _0x1c627e(_0x4a2bd3[_0x9fbc('0x11')][_0x9fbc('0x13')]);}logger[_0x9fbc('0x11')](_0x9fbc('0x12'),_0x365b23,_0x4a2bd3['error'][_0x9fbc('0x13')]);return _0x2d6ad5(_0x4a2bd3[_0x9fbc('0x11')]['message']);}else{logger['info'](_0x9fbc('0x12'),_0x365b23,_0x9fbc('0xd'));_0x2d6ad5(_0x4a2bd3[_0x9fbc('0x14')]['message']);}})[_0x9fbc('0x15')](function(_0x263a31){logger[_0x9fbc('0x11')](_0x9fbc('0x12'),_0x365b23,_0x263a31);_0x1c627e(_0x263a31);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 7715d3c..2b31bd4 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(_0x151721,_0x20d5bc){var _0x2deaa7=function(_0x499812){while(--_0x499812){_0x151721['push'](_0x151721['shift']());}};_0x2deaa7(++_0x20d5bc);}(_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')](),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(_0x3a3afe,_0x15da25){var _0x262dab=function(_0x364a7f){while(--_0x364a7f){_0x3a3afe['push'](_0x3a3afe['shift']());}};_0x262dab(++_0x15da25);}(_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'));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 6af599e..61ffe17 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 _0x09c9=['TEXT','sequelize','exports','INTEGER','STRING','noop'];(function(_0x174a1b,_0x8a02a6){var _0x1dff64=function(_0x1ccf3e){while(--_0x1ccf3e){_0x174a1b['push'](_0x174a1b['shift']());}};_0x1dff64(++_0x8a02a6);}(_0x09c9,0xe5));var _0x909c=function(_0x69a12f,_0x352416){_0x69a12f=_0x69a12f-0x0;var _0x4ecc51=_0x09c9[_0x69a12f];return _0x4ecc51;};'use strict';var Sequelize=require(_0x909c('0x0'));module[_0x909c('0x1')]={'priority':{'type':Sequelize[_0x909c('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x909c('0x3')],'allowNull':![],'defaultValue':_0x909c('0x4')},'appdata':{'type':Sequelize[_0x909c('0x5')]()},'description':{'type':Sequelize[_0x909c('0x3')]},'interval':{'type':Sequelize[_0x909c('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xba30=['TEXT','STRING','*,*,*,*','sequelize','exports','noop'];(function(_0x5b35ee,_0xc2726b){var _0x54eb10=function(_0x2470f3){while(--_0x2470f3){_0x5b35ee['push'](_0x5b35ee['shift']());}};_0x54eb10(++_0xc2726b);}(_0xba30,0x189));var _0x0ba3=function(_0x4258c7,_0x3fec4c){_0x4258c7=_0x4258c7-0x0;var _0x3c5d58=_0xba30[_0x4258c7];return _0x3c5d58;};'use strict';var Sequelize=require(_0x0ba3('0x0'));module[_0x0ba3('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0ba3('0x2')},'appdata':{'type':Sequelize[_0x0ba3('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0ba3('0x4')],'defaultValue':_0x0ba3('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index bedf2ae..5e5c480 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 _0x2e21=['merge','options','find','catch','body','destroy','eml-format','rimraf','zip-dir','request-promise','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/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','error','stack','name','show','params','keys','ChatApplication','rawAttributes','query','intersection','model','attributes','fields','length','includeAll','include'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x2e21,0xba));var _0x12e2=function(_0x125fa1,_0x54d5b4){_0x125fa1=_0x125fa1-0x0;var _0x1bfa21=_0x2e21[_0x125fa1];return _0x1bfa21;};'use strict';var emlformat=require(_0x12e2('0x0'));var rimraf=require(_0x12e2('0x1'));var zipdir=require(_0x12e2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x12e2('0x3'));var moment=require('moment');var BPromise=require(_0x12e2('0x4'));var Mustache=require(_0x12e2('0x5'));var util=require(_0x12e2('0x6'));var path=require(_0x12e2('0x7'));var sox=require(_0x12e2('0x8'));var csv=require(_0x12e2('0x9'));var ejs=require(_0x12e2('0xa'));var fs=require('fs');var fs_extra=require(_0x12e2('0xb'));var _=require(_0x12e2('0xc'));var squel=require(_0x12e2('0xd'));var crypto=require(_0x12e2('0xe'));var jsforce=require(_0x12e2('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x12e2('0x9'));var querystring=require('querystring');var Papa=require(_0x12e2('0x10'));var Redis=require('ioredis');var authService=require(_0x12e2('0x11'));var qs=require(_0x12e2('0x12'));var as=require(_0x12e2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x12e2('0x14'))(_0x12e2('0x15'));var utils=require('../../config/utils');var config=require(_0x12e2('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x12e2('0x17'))['db'];function respondWithStatusCode(_0x4eaf75,_0x106015){_0x106015=_0x106015||0xcc;return function(_0x25edc8){if(_0x25edc8){return _0x4eaf75[_0x12e2('0x18')](_0x106015);}return _0x4eaf75[_0x12e2('0x19')](_0x106015)[_0x12e2('0x1a')]();};}function respondWithResult(_0x1c92de,_0x1cfa64){_0x1cfa64=_0x1cfa64||0xc8;return function(_0x3b936e){if(_0x3b936e){return _0x1c92de[_0x12e2('0x19')](_0x1cfa64)['json'](_0x3b936e);}};}function respondWithFilteredResult(_0x29c58e,_0x411049){return function(_0x44b3e0){if(_0x44b3e0){var _0x285ff7=typeof _0x411049[_0x12e2('0x1b')]===_0x12e2('0x1c')&&typeof _0x411049[_0x12e2('0x1d')]===_0x12e2('0x1c');var _0x1d3da5=_0x44b3e0[_0x12e2('0x1e')];var _0x210f5c=_0x285ff7?0x0:_0x411049[_0x12e2('0x1b')];var _0x298e64=_0x285ff7?_0x44b3e0[_0x12e2('0x1e')]:_0x411049[_0x12e2('0x1b')]+_0x411049[_0x12e2('0x1d')];var _0x3cf1e3;if(_0x298e64>=_0x1d3da5){_0x298e64=_0x1d3da5;_0x3cf1e3=0xc8;}else{_0x3cf1e3=0xce;}_0x29c58e[_0x12e2('0x19')](_0x3cf1e3);return _0x29c58e[_0x12e2('0x1f')](_0x12e2('0x20'),_0x210f5c+'-'+_0x298e64+'/'+_0x1d3da5)[_0x12e2('0x21')](_0x44b3e0);}return null;};}function patchUpdates(_0xd85795){return function(_0x475cab){try{jsonpatch['apply'](_0x475cab,_0xd85795,!![]);}catch(_0x2afa39){return BPromise[_0x12e2('0x22')](_0x2afa39);}return _0x475cab[_0x12e2('0x23')]();};}function saveUpdates(_0x34ce6f,_0x47be59){return function(_0x400d23){if(_0x400d23){return _0x400d23[_0x12e2('0x24')](_0x34ce6f)['then'](function(_0x4002db){return _0x4002db;});}return null;};}function removeEntity(_0x5dac82,_0xe5868a){return function(_0x33fed2){if(_0x33fed2){return _0x33fed2['destroy']()[_0x12e2('0x25')](function(){_0x5dac82[_0x12e2('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4936fb,_0x719371){return function(_0x461e2b){if(!_0x461e2b){_0x4936fb['sendStatus'](0x194);}return _0x461e2b;};}function handleError(_0x1cb0d1,_0x18639b){_0x18639b=_0x18639b||0x1f4;return function(_0x441c84){logger[_0x12e2('0x26')](_0x441c84[_0x12e2('0x27')]);if(_0x441c84[_0x12e2('0x28')]){delete _0x441c84[_0x12e2('0x28')];}_0x1cb0d1[_0x12e2('0x19')](_0x18639b)['send'](_0x441c84);};}exports[_0x12e2('0x29')]=function(_0x2a32a6,_0xdeff70){var _0x2f2a21={'raw':!![],'where':{'id':_0x2a32a6[_0x12e2('0x2a')]['id']}},_0xb62e62={};_0xb62e62['model']=_[_0x12e2('0x2b')](db[_0x12e2('0x2c')][_0x12e2('0x2d')]);_0xb62e62['query']=_[_0x12e2('0x2b')](_0x2a32a6[_0x12e2('0x2e')]);_0xb62e62['filters']=_[_0x12e2('0x2f')](_0xb62e62[_0x12e2('0x30')],_0xb62e62[_0x12e2('0x2e')]);_0x2f2a21[_0x12e2('0x31')]=_[_0x12e2('0x2f')](_0xb62e62['model'],qs[_0x12e2('0x32')](_0x2a32a6[_0x12e2('0x2e')][_0x12e2('0x32')]));_0x2f2a21[_0x12e2('0x31')]=_0x2f2a21[_0x12e2('0x31')][_0x12e2('0x33')]?_0x2f2a21[_0x12e2('0x31')]:_0xb62e62['model'];if(_0x2a32a6[_0x12e2('0x2e')][_0x12e2('0x34')]){_0x2f2a21[_0x12e2('0x35')]=[{'all':!![]}];}_0x2f2a21=_[_0x12e2('0x36')]({},_0x2f2a21,_0x2a32a6[_0x12e2('0x37')]);return db[_0x12e2('0x2c')][_0x12e2('0x38')](_0x2f2a21)[_0x12e2('0x25')](handleEntityNotFound(_0xdeff70,null))[_0x12e2('0x25')](respondWithResult(_0xdeff70,null))[_0x12e2('0x39')](handleError(_0xdeff70,null));};exports['update']=function(_0x5d00bf,_0x5e2246){if(_0x5d00bf[_0x12e2('0x3a')]['id']){delete _0x5d00bf[_0x12e2('0x3a')]['id'];}return db[_0x12e2('0x2c')][_0x12e2('0x38')]({'where':{'id':_0x5d00bf[_0x12e2('0x2a')]['id']}})[_0x12e2('0x25')](handleEntityNotFound(_0x5e2246,null))['then'](saveUpdates(_0x5d00bf[_0x12e2('0x3a')],null))[_0x12e2('0x25')](respondWithResult(_0x5e2246,null))[_0x12e2('0x39')](handleError(_0x5e2246,null));};exports[_0x12e2('0x3b')]=function(_0x4ab554,_0x34cbb7){return db[_0x12e2('0x2c')][_0x12e2('0x38')]({'where':{'id':_0x4ab554[_0x12e2('0x2a')]['id']}})['then'](handleEntityNotFound(_0x34cbb7,null))[_0x12e2('0x25')](removeEntity(_0x34cbb7,null))[_0x12e2('0x39')](handleError(_0x34cbb7,null));}; \ No newline at end of file +var _0x282b=['rawAttributes','query','filters','attributes','intersection','length','include','merge','find','body','ChatApplication','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','reject','save','update','then','destroy','end','error','name','send','params','model','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x282b,0xec));var _0xb282=function(_0x37474e,_0x463cad){_0x37474e=_0x37474e-0x0;var _0x200d1a=_0x282b[_0x37474e];return _0x200d1a;};'use strict';var emlformat=require(_0xb282('0x0'));var rimraf=require(_0xb282('0x1'));var zipdir=require(_0xb282('0x2'));var jsonpatch=require(_0xb282('0x3'));var rp=require(_0xb282('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xb282('0x5'));var util=require('util');var path=require(_0xb282('0x6'));var sox=require(_0xb282('0x7'));var csv=require(_0xb282('0x8'));var ejs=require(_0xb282('0x9'));var fs=require('fs');var fs_extra=require(_0xb282('0xa'));var _=require(_0xb282('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb282('0xc'));var deskjs=require(_0xb282('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb282('0xe'));var Papa=require(_0xb282('0xf'));var Redis=require(_0xb282('0x10'));var authService=require(_0xb282('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb282('0x12'));var logger=require(_0xb282('0x13'))(_0xb282('0x14'));var utils=require(_0xb282('0x15'));var config=require(_0xb282('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x338bdb,_0xc08746){_0xc08746=_0xc08746||0xcc;return function(_0x40d7b8){if(_0x40d7b8){return _0x338bdb[_0xb282('0x17')](_0xc08746);}return _0x338bdb[_0xb282('0x18')](_0xc08746)['end']();};}function respondWithResult(_0x34c595,_0x5adf7f){_0x5adf7f=_0x5adf7f||0xc8;return function(_0xe1d53){if(_0xe1d53){return _0x34c595[_0xb282('0x18')](_0x5adf7f)['json'](_0xe1d53);}};}function respondWithFilteredResult(_0x525cfa,_0x5bc7c3){return function(_0x13cea1){if(_0x13cea1){var _0x350676=typeof _0x5bc7c3[_0xb282('0x19')]===_0xb282('0x1a')&&typeof _0x5bc7c3[_0xb282('0x1b')]==='undefined';var _0x191a31=_0x13cea1[_0xb282('0x1c')];var _0xca5f12=_0x350676?0x0:_0x5bc7c3[_0xb282('0x19')];var _0x3f8a3f=_0x350676?_0x13cea1['count']:_0x5bc7c3['offset']+_0x5bc7c3[_0xb282('0x1b')];var _0x2cdeb1;if(_0x3f8a3f>=_0x191a31){_0x3f8a3f=_0x191a31;_0x2cdeb1=0xc8;}else{_0x2cdeb1=0xce;}_0x525cfa['status'](_0x2cdeb1);return _0x525cfa[_0xb282('0x1d')](_0xb282('0x1e'),_0xca5f12+'-'+_0x3f8a3f+'/'+_0x191a31)[_0xb282('0x1f')](_0x13cea1);}return null;};}function patchUpdates(_0x438dbe){return function(_0x1c3084){try{jsonpatch['apply'](_0x1c3084,_0x438dbe,!![]);}catch(_0x1de407){return BPromise[_0xb282('0x20')](_0x1de407);}return _0x1c3084[_0xb282('0x21')]();};}function saveUpdates(_0x4b79d7,_0x437d66){return function(_0x2a7ef8){if(_0x2a7ef8){return _0x2a7ef8[_0xb282('0x22')](_0x4b79d7)[_0xb282('0x23')](function(_0x680095){return _0x680095;});}return null;};}function removeEntity(_0x56645f,_0x4d624f){return function(_0x360f15){if(_0x360f15){return _0x360f15[_0xb282('0x24')]()['then'](function(){_0x56645f['status'](0xcc)[_0xb282('0x25')]();});}};}function handleEntityNotFound(_0x114f77,_0x3451e5){return function(_0x3c4018){if(!_0x3c4018){_0x114f77[_0xb282('0x17')](0x194);}return _0x3c4018;};}function handleError(_0x2b1303,_0x5b1d3d){_0x5b1d3d=_0x5b1d3d||0x1f4;return function(_0xa0d7fb){logger[_0xb282('0x26')](_0xa0d7fb['stack']);if(_0xa0d7fb[_0xb282('0x27')]){delete _0xa0d7fb[_0xb282('0x27')];}_0x2b1303[_0xb282('0x18')](_0x5b1d3d)[_0xb282('0x28')](_0xa0d7fb);};}exports['show']=function(_0x1520b1,_0x1fb89f){var _0xe337b8={'raw':!![],'where':{'id':_0x1520b1[_0xb282('0x29')]['id']}},_0x433ad5={};_0x433ad5[_0xb282('0x2a')]=_[_0xb282('0x2b')](db['ChatApplication'][_0xb282('0x2c')]);_0x433ad5[_0xb282('0x2d')]=_[_0xb282('0x2b')](_0x1520b1[_0xb282('0x2d')]);_0x433ad5[_0xb282('0x2e')]=_['intersection'](_0x433ad5[_0xb282('0x2a')],_0x433ad5['query']);_0xe337b8[_0xb282('0x2f')]=_[_0xb282('0x30')](_0x433ad5[_0xb282('0x2a')],qs['fields'](_0x1520b1[_0xb282('0x2d')]['fields']));_0xe337b8[_0xb282('0x2f')]=_0xe337b8[_0xb282('0x2f')][_0xb282('0x31')]?_0xe337b8[_0xb282('0x2f')]:_0x433ad5[_0xb282('0x2a')];if(_0x1520b1[_0xb282('0x2d')]['includeAll']){_0xe337b8[_0xb282('0x32')]=[{'all':!![]}];}_0xe337b8=_[_0xb282('0x33')]({},_0xe337b8,_0x1520b1['options']);return db['ChatApplication'][_0xb282('0x34')](_0xe337b8)[_0xb282('0x23')](handleEntityNotFound(_0x1fb89f,null))[_0xb282('0x23')](respondWithResult(_0x1fb89f,null))['catch'](handleError(_0x1fb89f,null));};exports['update']=function(_0x4ad54b,_0x27073b){if(_0x4ad54b[_0xb282('0x35')]['id']){delete _0x4ad54b[_0xb282('0x35')]['id'];}return db[_0xb282('0x36')][_0xb282('0x34')]({'where':{'id':_0x4ad54b[_0xb282('0x29')]['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x27073b,null))['then'](saveUpdates(_0x4ad54b[_0xb282('0x35')],null))['then'](respondWithResult(_0x27073b,null))[_0xb282('0x37')](handleError(_0x27073b,null));};exports[_0xb282('0x24')]=function(_0x3514cf,_0x4f6cf1){return db[_0xb282('0x36')]['find']({'where':{'id':_0x3514cf[_0xb282('0x29')]['id']}})[_0xb282('0x23')](handleEntityNotFound(_0x4f6cf1,null))[_0xb282('0x23')](removeEntity(_0x4f6cf1,null))[_0xb282('0x37')](handleError(_0x4f6cf1,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 4db8d96..c568c1e 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 _0x63f1=['rimraf','./chatApplication.attributes','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1bcb83,_0x51bc7a){var _0x5a83fa=function(_0x4576fa){while(--_0x4576fa){_0x1bcb83['push'](_0x1bcb83['shift']());}};_0x5a83fa(++_0x51bc7a);}(_0x63f1,0x71));var _0x163f=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x63f1[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0x163f('0x0'));var util=require(_0x163f('0x1'));var logger=require(_0x163f('0x2'))(_0x163f('0x3'));var moment=require(_0x163f('0x4'));var BPromise=require(_0x163f('0x5'));var rp=require(_0x163f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x163f('0x7'));var config=require('../../config/environment');var attributes=require(_0x163f('0x8'));module[_0x163f('0x9')]=function(_0x24de4b,_0x11cb90){return _0x24de4b[_0x163f('0xa')](_0x163f('0xb'),attributes,{'tableName':_0x163f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x163f('0xd'),'collate':_0x163f('0xe')});}; \ No newline at end of file +var _0x0c48=['utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatApplication.attributes','exports','define','ChatApplication','chat_applications'];(function(_0x15ce40,_0x3df9af){var _0xedf0d9=function(_0x37a96a){while(--_0x37a96a){_0x15ce40['push'](_0x15ce40['shift']());}};_0xedf0d9(++_0x3df9af);}(_0x0c48,0xd3));var _0x80c4=function(_0x3d35e5,_0x44b351){_0x3d35e5=_0x3d35e5-0x0;var _0xf9e901=_0x0c48[_0x3d35e5];return _0xf9e901;};'use strict';var _=require(_0x80c4('0x0'));var util=require(_0x80c4('0x1'));var logger=require(_0x80c4('0x2'))(_0x80c4('0x3'));var moment=require(_0x80c4('0x4'));var BPromise=require(_0x80c4('0x5'));var rp=require(_0x80c4('0x6'));var fs=require('fs');var path=require(_0x80c4('0x7'));var rimraf=require(_0x80c4('0x8'));var config=require('../../config/environment');var attributes=require(_0x80c4('0x9'));module[_0x80c4('0xa')]=function(_0x2ab2bc,_0x1c5753){return _0x2ab2bc[_0x80c4('0xb')](_0x80c4('0xc'),attributes,{'tableName':_0x80c4('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x80c4('0xe')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 8a8fac7..f62e448 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 _0xe3c8=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','ChatApplication,\x20%s,\x20%s','request\x20sent','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x31c3c8,_0x266f74){var _0x3ec8fb=function(_0x5bf0ae){while(--_0x5bf0ae){_0x31c3c8['push'](_0x31c3c8['shift']());}};_0x3ec8fb(++_0x266f74);}(_0xe3c8,0x10c));var _0x8e3c=function(_0x4dcc88,_0x4af25e){_0x4dcc88=_0x4dcc88-0x0;var _0x377ec8=_0xe3c8[_0x4dcc88];return _0x377ec8;};'use strict';var _=require(_0x8e3c('0x0'));var util=require(_0x8e3c('0x1'));var moment=require(_0x8e3c('0x2'));var BPromise=require(_0x8e3c('0x3'));var rs=require(_0x8e3c('0x4'));var fs=require('fs');var Redis=require(_0x8e3c('0x5'));var db=require(_0x8e3c('0x6'))['db'];var utils=require(_0x8e3c('0x7'));var logger=require(_0x8e3c('0x8'))(_0x8e3c('0x9'));var config=require(_0x8e3c('0xa'));var jayson=require(_0x8e3c('0xb'));var client=jayson['client'][_0x8e3c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x19a260,_0x1da666,_0x12b5ab){return new BPromise(function(_0x18f413,_0xd0ee6b){return client[_0x8e3c('0xd')](_0x19a260,_0x12b5ab)['then'](function(_0x190fc6){logger['info'](_0x8e3c('0xe'),_0x1da666,_0x8e3c('0xf'));logger['debug'](_0x8e3c('0x10'),_0x1da666,_0x8e3c('0xf'),JSON[_0x8e3c('0x11')](_0x190fc6));if(_0x190fc6[_0x8e3c('0x12')]){if(_0x190fc6[_0x8e3c('0x12')][_0x8e3c('0x13')]===0x1f4){logger[_0x8e3c('0x12')](_0x8e3c('0xe'),_0x1da666,_0x190fc6[_0x8e3c('0x12')][_0x8e3c('0x14')]);return _0xd0ee6b(_0x190fc6[_0x8e3c('0x12')][_0x8e3c('0x14')]);}logger[_0x8e3c('0x12')](_0x8e3c('0xe'),_0x1da666,_0x190fc6['error'][_0x8e3c('0x14')]);return _0x18f413(_0x190fc6[_0x8e3c('0x12')]['message']);}else{logger[_0x8e3c('0x15')](_0x8e3c('0xe'),_0x1da666,_0x8e3c('0xf'));_0x18f413(_0x190fc6[_0x8e3c('0x16')][_0x8e3c('0x14')]);}})['catch'](function(_0x28941e){logger['error']('ChatApplication,\x20%s,\x20%s',_0x1da666,_0x28941e);_0xd0ee6b(_0x28941e);});});} \ No newline at end of file +var _0x5df1=['../../config/utils','rpc','jayson/promise','http','request','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','message','ChatApplication,\x20%s,\x20%s','catch','bluebird','randomstring','ioredis'];(function(_0x594d9d,_0x264beb){var _0x483050=function(_0x533812){while(--_0x533812){_0x594d9d['push'](_0x594d9d['shift']());}};_0x483050(++_0x264beb);}(_0x5df1,0x140));var _0x15df=function(_0x566733,_0x490df8){_0x566733=_0x566733-0x0;var _0x4a3fe9=_0x5df1[_0x566733];return _0x4a3fe9;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x15df('0x0'));var rs=require(_0x15df('0x1'));var fs=require('fs');var Redis=require(_0x15df('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x15df('0x3'));var logger=require('../../config/logger')(_0x15df('0x4'));var config=require('../../config/environment');var jayson=require(_0x15df('0x5'));var client=jayson['client'][_0x15df('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3dedba,_0x40caec,_0xadcdfe){return new BPromise(function(_0xfb82f2,_0x305e26){return client[_0x15df('0x7')](_0x3dedba,_0xadcdfe)[_0x15df('0x8')](function(_0x278774){logger[_0x15df('0x9')]('ChatApplication,\x20%s,\x20%s',_0x40caec,_0x15df('0xa'));logger[_0x15df('0xb')](_0x15df('0xc'),_0x40caec,_0x15df('0xa'),JSON['stringify'](_0x278774));if(_0x278774[_0x15df('0xd')]){if(_0x278774[_0x15df('0xd')]['code']===0x1f4){logger[_0x15df('0xd')]('ChatApplication,\x20%s,\x20%s',_0x40caec,_0x278774[_0x15df('0xd')][_0x15df('0xe')]);return _0x305e26(_0x278774[_0x15df('0xd')]['message']);}logger['error'](_0x15df('0xf'),_0x40caec,_0x278774[_0x15df('0xd')][_0x15df('0xe')]);return _0xfb82f2(_0x278774[_0x15df('0xd')][_0x15df('0xe')]);}else{logger[_0x15df('0x9')](_0x15df('0xf'),_0x40caec,'request\x20sent');_0xfb82f2(_0x278774['result']['message']);}})[_0x15df('0x10')](function(_0xcbc58c){logger['error']('ChatApplication,\x20%s,\x20%s',_0x40caec,_0xcbc58c);_0x305e26(_0xcbc58c);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 231dc7e..61a9f17 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 _0xc6ac=['./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4733d3,_0x454290){var _0x1b9a44=function(_0x1a93bb){while(--_0x1a93bb){_0x4733d3['push'](_0x4733d3['shift']());}};_0x1b9a44(++_0x454290);}(_0xc6ac,0x1dd));var _0xcc6a=function(_0x45b9e7,_0x3862e5){_0x45b9e7=_0x45b9e7-0x0;var _0x26110a=_0xc6ac[_0x45b9e7];return _0x26110a;};'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('fs-extra');var auth=require(_0xcc6a('0x6'));var interaction=require(_0xcc6a('0x7'));var config=require(_0xcc6a('0x8'));var controller=require(_0xcc6a('0x9'));router[_0xcc6a('0xa')](_0xcc6a('0xb'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xd')]);router[_0xcc6a('0xe')](_0xcc6a('0xb'),auth[_0xcc6a('0xc')](),controller[_0xcc6a('0xf')]);router[_0xcc6a('0x10')](_0xcc6a('0xb'),auth[_0xcc6a('0xc')](),controller['destroy']);module[_0xcc6a('0x11')]=router; \ No newline at end of file +var _0x83ae=['delete','exports','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','show','put','update'];(function(_0x529abc,_0x17b97e){var _0x453afa=function(_0x536263){while(--_0x536263){_0x529abc['push'](_0x529abc['shift']());}};_0x453afa(++_0x17b97e);}(_0x83ae,0x13d));var _0xe83a=function(_0x44f1ad,_0xf7ddae){_0x44f1ad=_0x44f1ad-0x0;var _0x2cbc0f=_0x83ae[_0x44f1ad];return _0x2cbc0f;};'use strict';var multer=require('multer');var util=require(_0xe83a('0x0'));var path=require('path');var timeout=require(_0xe83a('0x1'));var express=require(_0xe83a('0x2'));var router=express[_0xe83a('0x3')]();var fs_extra=require(_0xe83a('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe83a('0x5'));var config=require(_0xe83a('0x6'));var controller=require('./chatApplication.controller');router[_0xe83a('0x7')](_0xe83a('0x8'),auth[_0xe83a('0x9')](),controller[_0xe83a('0xa')]);router[_0xe83a('0xb')](_0xe83a('0x8'),auth['isAuthenticated'](),controller[_0xe83a('0xc')]);router[_0xe83a('0xd')](_0xe83a('0x8'),auth[_0xe83a('0x9')](),controller['destroy']);module[_0xe83a('0xe')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 30c0c0e..b5e8d7c 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 _0xcdac=['STRING','BOOLEAN','sequelize','exports'];(function(_0x2aa227,_0x32f559){var _0x488c01=function(_0x6d9145){while(--_0x6d9145){_0x2aa227['push'](_0x2aa227['shift']());}};_0x488c01(++_0x32f559);}(_0xcdac,0xb6));var _0xccda=function(_0x151cbe,_0x40fa90){_0x151cbe=_0x151cbe-0x0;var _0x2adae9=_0xcdac[_0x151cbe];return _0x2adae9;};'use strict';var Sequelize=require(_0xccda('0x0'));module[_0xccda('0x1')]={'name':{'type':Sequelize[_0xccda('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xccda('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xc11e=['STRING','BOOLEAN','sequelize'];(function(_0x2dc96f,_0x459058){var _0xd012da=function(_0x38d032){while(--_0x38d032){_0x2dc96f['push'](_0x2dc96f['shift']());}};_0xd012da(++_0x459058);}(_0xc11e,0xf8));var _0xec11=function(_0x254761,_0x550307){_0x254761=_0x254761-0x0;var _0x4236de=_0xc11e[_0x254761];return _0x4236de;};'use strict';var Sequelize=require(_0xec11('0x0'));module['exports']={'name':{'type':Sequelize[_0xec11('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0xec11('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 89b1717..b42474d 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 _0xbd02=['getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','omit','User','order','hasOwnProperty','nolimit','getMembers','removeMembers','addMessage','findOne','$gte','split','format','getMessages','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','./chatGroup.socket','end','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','ChatGroup','rawAttributes','type','model','keys','query','filters','intersection','fields','attributes','length','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','params','create','body','find','describe'];(function(_0x6651c3,_0x13210f){var _0x3d1598=function(_0x53dc1c){while(--_0x53dc1c){_0x6651c3['push'](_0x6651c3['shift']());}};_0x3d1598(++_0x13210f);}(_0xbd02,0xcd));var _0x2bd0=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0xbd02[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0x2bd0('0x0'));var rimraf=require(_0x2bd0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2bd0('0x2'));var moment=require(_0x2bd0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2bd0('0x4'));var util=require(_0x2bd0('0x5'));var path=require(_0x2bd0('0x6'));var sox=require(_0x2bd0('0x7'));var csv=require('to-csv');var ejs=require(_0x2bd0('0x8'));var fs=require('fs');var fs_extra=require(_0x2bd0('0x9'));var _=require('lodash');var squel=require(_0x2bd0('0xa'));var crypto=require(_0x2bd0('0xb'));var jsforce=require(_0x2bd0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2bd0('0xd'));var querystring=require(_0x2bd0('0xe'));var Papa=require(_0x2bd0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2bd0('0x10'));var as=require(_0x2bd0('0x11'));var hardwareService=require(_0x2bd0('0x12'));var logger=require(_0x2bd0('0x13'))(_0x2bd0('0x14'));var utils=require(_0x2bd0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2bd0('0x16'));var db=require('../../mysqldb')['db'];config[_0x2bd0('0x17')]=_[_0x2bd0('0x18')](config[_0x2bd0('0x17')],{'host':_0x2bd0('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2bd0('0x17')]));require(_0x2bd0('0x1a'))['register'](socket);function respondWithStatusCode(_0x10aba5,_0x5088bb){_0x5088bb=_0x5088bb||0xcc;return function(_0x158a06){if(_0x158a06){return _0x10aba5['sendStatus'](_0x5088bb);}return _0x10aba5['status'](_0x5088bb)[_0x2bd0('0x1b')]();};}function respondWithResult(_0x25f79c,_0x20e975){_0x20e975=_0x20e975||0xc8;return function(_0x50df73){if(_0x50df73){return _0x25f79c[_0x2bd0('0x1c')](_0x20e975)[_0x2bd0('0x1d')](_0x50df73);}};}function respondWithFilteredResult(_0x54dc78,_0x52b4a3){return function(_0x411b38){if(_0x411b38){var _0x297d44=typeof _0x52b4a3[_0x2bd0('0x1e')]===_0x2bd0('0x1f')&&typeof _0x52b4a3[_0x2bd0('0x20')]===_0x2bd0('0x1f');var _0x1db952=_0x411b38[_0x2bd0('0x21')];var _0x472c33=_0x297d44?0x0:_0x52b4a3[_0x2bd0('0x1e')];var _0xbf0771=_0x297d44?_0x411b38[_0x2bd0('0x21')]:_0x52b4a3[_0x2bd0('0x1e')]+_0x52b4a3[_0x2bd0('0x20')];var _0x509efb;if(_0xbf0771>=_0x1db952){_0xbf0771=_0x1db952;_0x509efb=0xc8;}else{_0x509efb=0xce;}_0x54dc78[_0x2bd0('0x1c')](_0x509efb);return _0x54dc78[_0x2bd0('0x22')]('Content-Range',_0x472c33+'-'+_0xbf0771+'/'+_0x1db952)['json'](_0x411b38);}return null;};}function patchUpdates(_0x2c5f65){return function(_0x31722f){try{jsonpatch[_0x2bd0('0x23')](_0x31722f,_0x2c5f65,!![]);}catch(_0x991c5){return BPromise['reject'](_0x991c5);}return _0x31722f[_0x2bd0('0x24')]();};}function saveUpdates(_0x5e7fd0,_0x4b486e){return function(_0x1aa0c5){if(_0x1aa0c5){return _0x1aa0c5[_0x2bd0('0x25')](_0x5e7fd0)['then'](function(_0x4b9a90){return _0x4b9a90;});}return null;};}function removeEntity(_0x493985,_0x42c85e){return function(_0x233412){if(_0x233412){return _0x233412[_0x2bd0('0x26')]()[_0x2bd0('0x27')](function(){_0x493985[_0x2bd0('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34c5de,_0x3a6d55){return function(_0x404e05){if(!_0x404e05){_0x34c5de[_0x2bd0('0x28')](0x194);}return _0x404e05;};}function handleError(_0x2b4f29,_0x197ef4){_0x197ef4=_0x197ef4||0x1f4;return function(_0x5c49d3){logger[_0x2bd0('0x29')](_0x5c49d3[_0x2bd0('0x2a')]);if(_0x5c49d3[_0x2bd0('0x2b')]){delete _0x5c49d3['name'];}_0x2b4f29[_0x2bd0('0x1c')](_0x197ef4)[_0x2bd0('0x2c')](_0x5c49d3);};}exports[_0x2bd0('0x2d')]=function(_0x56124c,_0x45be09){var _0x1fb9b7={},_0x10abac={},_0x267c73={'count':0x0,'rows':[]};var _0x3fbc5f=_[_0x2bd0('0x2e')](db[_0x2bd0('0x2f')][_0x2bd0('0x30')],function(_0x57243e){return{'name':_0x57243e['fieldName'],'type':_0x57243e[_0x2bd0('0x31')]['key']};});_0x10abac[_0x2bd0('0x32')]=_[_0x2bd0('0x2e')](_0x3fbc5f,'name');_0x10abac['query']=_[_0x2bd0('0x33')](_0x56124c[_0x2bd0('0x34')]);_0x10abac[_0x2bd0('0x35')]=_[_0x2bd0('0x36')](_0x10abac[_0x2bd0('0x32')],_0x10abac[_0x2bd0('0x34')]);_0x1fb9b7['attributes']=_[_0x2bd0('0x36')](_0x10abac[_0x2bd0('0x32')],qs[_0x2bd0('0x37')](_0x56124c['query'][_0x2bd0('0x37')]));_0x1fb9b7[_0x2bd0('0x38')]=_0x1fb9b7['attributes'][_0x2bd0('0x39')]?_0x1fb9b7[_0x2bd0('0x38')]:_0x10abac[_0x2bd0('0x32')];if(!_0x56124c[_0x2bd0('0x34')]['hasOwnProperty']('nolimit')){_0x1fb9b7['limit']=qs['limit'](_0x56124c[_0x2bd0('0x34')][_0x2bd0('0x20')]);_0x1fb9b7[_0x2bd0('0x1e')]=qs['offset'](_0x56124c[_0x2bd0('0x34')][_0x2bd0('0x1e')]);}_0x1fb9b7['order']=qs[_0x2bd0('0x3a')](_0x56124c[_0x2bd0('0x34')][_0x2bd0('0x3a')]);_0x1fb9b7[_0x2bd0('0x3b')]=qs['filters'](_[_0x2bd0('0x3c')](_0x56124c[_0x2bd0('0x34')],_0x10abac[_0x2bd0('0x35')]),_0x3fbc5f);if(_0x56124c['query']['filter']){_0x1fb9b7[_0x2bd0('0x3b')]=_[_0x2bd0('0x3d')](_0x1fb9b7['where'],{'$or':_['map'](_0x3fbc5f,function(_0x279b97){if(_0x279b97[_0x2bd0('0x31')]!==_0x2bd0('0x3e')){var _0x4f88c3={};_0x4f88c3[_0x279b97['name']]={'$like':'%'+_0x56124c[_0x2bd0('0x34')][_0x2bd0('0x3f')]+'%'};return _0x4f88c3;}})});}_0x1fb9b7=_[_0x2bd0('0x3d')]({},_0x1fb9b7,_0x56124c[_0x2bd0('0x40')]);var _0x57c69d={'where':_0x1fb9b7[_0x2bd0('0x3b')]};return db[_0x2bd0('0x2f')][_0x2bd0('0x21')](_0x57c69d)[_0x2bd0('0x27')](function(_0x33e015){_0x267c73[_0x2bd0('0x21')]=_0x33e015;if(_0x56124c[_0x2bd0('0x34')][_0x2bd0('0x41')]){_0x1fb9b7[_0x2bd0('0x42')]=[{'all':!![]}];}return db[_0x2bd0('0x2f')][_0x2bd0('0x43')](_0x1fb9b7);})[_0x2bd0('0x27')](function(_0x4b8ee4){_0x267c73['rows']=_0x4b8ee4;return _0x267c73;})[_0x2bd0('0x27')](respondWithFilteredResult(_0x45be09,_0x1fb9b7))[_0x2bd0('0x44')](handleError(_0x45be09,null));};exports['show']=function(_0x35c505,_0x4aa966){var _0x598db7={'raw':!![],'where':{'id':_0x35c505[_0x2bd0('0x45')]['id']}},_0x2cd0b4={};_0x2cd0b4[_0x2bd0('0x32')]=_['keys'](db[_0x2bd0('0x2f')][_0x2bd0('0x30')]);_0x2cd0b4[_0x2bd0('0x34')]=_[_0x2bd0('0x33')](_0x35c505[_0x2bd0('0x34')]);_0x2cd0b4['filters']=_[_0x2bd0('0x36')](_0x2cd0b4[_0x2bd0('0x32')],_0x2cd0b4['query']);_0x598db7[_0x2bd0('0x38')]=_[_0x2bd0('0x36')](_0x2cd0b4['model'],qs[_0x2bd0('0x37')](_0x35c505[_0x2bd0('0x34')]['fields']));_0x598db7[_0x2bd0('0x38')]=_0x598db7[_0x2bd0('0x38')][_0x2bd0('0x39')]?_0x598db7[_0x2bd0('0x38')]:_0x2cd0b4[_0x2bd0('0x32')];if(_0x35c505[_0x2bd0('0x34')]['includeAll']){_0x598db7[_0x2bd0('0x42')]=[{'all':!![]}];}_0x598db7=_['merge']({},_0x598db7,_0x35c505[_0x2bd0('0x40')]);return db[_0x2bd0('0x2f')]['find'](_0x598db7)[_0x2bd0('0x27')](handleEntityNotFound(_0x4aa966,null))['then'](respondWithResult(_0x4aa966,null))[_0x2bd0('0x44')](handleError(_0x4aa966,null));};exports[_0x2bd0('0x46')]=function(_0x5819fe,_0x39297c){return db['ChatGroup'][_0x2bd0('0x46')](_0x5819fe[_0x2bd0('0x47')],{})[_0x2bd0('0x27')](respondWithResult(_0x39297c,0xc9))[_0x2bd0('0x44')](handleError(_0x39297c,null));};exports[_0x2bd0('0x25')]=function(_0x25e581,_0x37d712){if(_0x25e581[_0x2bd0('0x47')]['id']){delete _0x25e581[_0x2bd0('0x47')]['id'];}return db[_0x2bd0('0x2f')][_0x2bd0('0x48')]({'where':{'id':_0x25e581[_0x2bd0('0x45')]['id']}})[_0x2bd0('0x27')](handleEntityNotFound(_0x37d712,null))[_0x2bd0('0x27')](saveUpdates(_0x25e581['body'],null))[_0x2bd0('0x27')](respondWithResult(_0x37d712,null))[_0x2bd0('0x44')](handleError(_0x37d712,null));};exports['destroy']=function(_0x47a0c6,_0x1d5c27){return db[_0x2bd0('0x2f')][_0x2bd0('0x48')]({'where':{'id':_0x47a0c6[_0x2bd0('0x45')]['id']}})[_0x2bd0('0x27')](handleEntityNotFound(_0x1d5c27,null))[_0x2bd0('0x27')](removeEntity(_0x1d5c27,null))[_0x2bd0('0x44')](handleError(_0x1d5c27,null));};exports[_0x2bd0('0x49')]=function(_0x124fcf,_0x554253){return db[_0x2bd0('0x2f')]['describe']()[_0x2bd0('0x27')](respondWithResult(_0x554253,null))['catch'](handleError(_0x554253,null));};exports[_0x2bd0('0x4a')]=function(_0x469230,_0xabe037,_0x1bc2d3){return db[_0x2bd0('0x4b')][_0x2bd0('0x21')]({'where':{'ChatGroupId':_0x469230[_0x2bd0('0x45')]['id'],'ToId':_0x469230[_0x2bd0('0x4c')]['id'],'read':![]}})[_0x2bd0('0x27')](function(_0x1c2108){return{'id':_[_0x2bd0('0x4d')](_0x469230[_0x2bd0('0x45')]['id']),'count':_0x1c2108};})[_0x2bd0('0x27')](respondWithResult(_0xabe037,null))[_0x2bd0('0x44')](handleError(_0xabe037,null));};exports[_0x2bd0('0x4e')]=function(_0x3c1bfe,_0x191b9d,_0x3c7165){return db[_0x2bd0('0x2f')][_0x2bd0('0x48')]({'where':{'id':_0x3c1bfe[_0x2bd0('0x45')]['id']}})[_0x2bd0('0x27')](handleEntityNotFound(_0x191b9d,null))[_0x2bd0('0x27')](function(_0x53f3b9){if(_0x53f3b9){return _0x53f3b9['addMembers'](_0x3c1bfe[_0x2bd0('0x47')][_0x2bd0('0x4f')],_[_0x2bd0('0x50')](_0x3c1bfe[_0x2bd0('0x47')],[_0x2bd0('0x4f'),'id'])||{});}})[_0x2bd0('0x27')](respondWithResult(_0x191b9d,null))[_0x2bd0('0x44')](handleError(_0x191b9d,null));};exports['getMembers']=function(_0x106e20,_0x59fe59,_0x1ea6cb){var _0x2660a0={};var _0xee17cf={};var _0x3bf848;var _0x3832fe;return db[_0x2bd0('0x2f')]['findOne']({'where':{'id':_0x106e20[_0x2bd0('0x45')]['id']}})[_0x2bd0('0x27')](handleEntityNotFound(_0x59fe59,null))[_0x2bd0('0x27')](function(_0x5a269e){if(_0x5a269e){_0x3bf848=_0x5a269e;_0xee17cf[_0x2bd0('0x32')]=_[_0x2bd0('0x33')](db[_0x2bd0('0x51')][_0x2bd0('0x30')]);_0xee17cf[_0x2bd0('0x34')]=_[_0x2bd0('0x33')](_0x106e20[_0x2bd0('0x34')]);_0xee17cf[_0x2bd0('0x35')]=_[_0x2bd0('0x36')](_0xee17cf[_0x2bd0('0x32')],_0xee17cf['query']);_0x2660a0[_0x2bd0('0x38')]=_[_0x2bd0('0x36')](_0xee17cf['model'],qs[_0x2bd0('0x37')](_0x106e20[_0x2bd0('0x34')]['fields']));_0x2660a0[_0x2bd0('0x38')]=_0x2660a0[_0x2bd0('0x38')][_0x2bd0('0x39')]?_0x2660a0['attributes']:_0xee17cf[_0x2bd0('0x32')];_0x2660a0[_0x2bd0('0x52')]=qs['sort'](_0x106e20[_0x2bd0('0x34')][_0x2bd0('0x3a')]);_0x2660a0[_0x2bd0('0x3b')]=qs[_0x2bd0('0x35')](_[_0x2bd0('0x3c')](_0x106e20[_0x2bd0('0x34')],_0xee17cf[_0x2bd0('0x35')]));if(_0x106e20['query'][_0x2bd0('0x3f')]){_0x2660a0[_0x2bd0('0x3b')]=_[_0x2bd0('0x3d')](_0x2660a0[_0x2bd0('0x3b')],{'$or':_[_0x2bd0('0x2e')](_0x2660a0[_0x2bd0('0x38')],function(_0x30ba61){var _0x2b313d={};_0x2b313d[_0x30ba61]={'$like':'%'+_0x106e20['query'][_0x2bd0('0x3f')]+'%'};return _0x2b313d;})});}_0x2660a0=_['merge']({},_0x2660a0,_0x106e20[_0x2bd0('0x40')]);return _0x3bf848['getMembers'](_0x2660a0);}})[_0x2bd0('0x27')](function(_0x582e2a){if(_0x582e2a){_0x3832fe=_0x582e2a['length'];if(!_0x106e20[_0x2bd0('0x34')][_0x2bd0('0x53')](_0x2bd0('0x54'))){_0x2660a0[_0x2bd0('0x20')]=qs[_0x2bd0('0x20')](_0x106e20['query'][_0x2bd0('0x20')]);_0x2660a0[_0x2bd0('0x1e')]=qs['offset'](_0x106e20[_0x2bd0('0x34')][_0x2bd0('0x1e')]);}return _0x3bf848[_0x2bd0('0x55')](_0x2660a0);}})[_0x2bd0('0x27')](function(_0x1a8889){if(_0x1a8889){return _0x1a8889?{'count':_0x3832fe,'rows':_0x1a8889}:null;}})['then'](respondWithResult(_0x59fe59,null))[_0x2bd0('0x44')](handleError(_0x59fe59,null));};exports[_0x2bd0('0x56')]=function(_0x53845f,_0x4e8790,_0x2071fd){return db[_0x2bd0('0x2f')][_0x2bd0('0x48')]({'where':{'id':_0x53845f[_0x2bd0('0x45')]['id']}})[_0x2bd0('0x27')](handleEntityNotFound(_0x4e8790,null))[_0x2bd0('0x27')](function(_0x2ea2fe){if(_0x2ea2fe){return _0x2ea2fe[_0x2bd0('0x56')](_0x53845f[_0x2bd0('0x34')][_0x2bd0('0x4f')]);}})['then'](respondWithStatusCode(_0x4e8790,null))['catch'](handleError(_0x4e8790,null));};exports[_0x2bd0('0x57')]=function(_0x2be007,_0x194fb1,_0x4f420d){if(_0x2be007[_0x2bd0('0x47')]['id']){delete _0x2be007['body']['id'];}return db[_0x2bd0('0x2f')][_0x2bd0('0x48')]({'where':{'id':_0x2be007[_0x2bd0('0x45')]['id']}})[_0x2bd0('0x27')](handleEntityNotFound(_0x194fb1,null))[_0x2bd0('0x27')](function(_0x3648b2){if(_0x3648b2){_0x2be007[_0x2bd0('0x47')]['ChatGroupId']=_0x3648b2['id'];return db[_0x2bd0('0x4b')]['create'](_0x2be007[_0x2bd0('0x47')]);}})[_0x2bd0('0x27')](respondWithResult(_0x194fb1,null))[_0x2bd0('0x44')](handleError(_0x194fb1,null));};exports['getMessages']=function(_0x58c90c,_0x339aa7,_0xfbff77){var _0x524bfb={};var _0xea3039={};var _0x5e9640;var _0x42bf9f;return db[_0x2bd0('0x2f')][_0x2bd0('0x58')]({'where':{'id':_0x58c90c[_0x2bd0('0x45')]['id']}})['then'](handleEntityNotFound(_0x339aa7,null))[_0x2bd0('0x27')](function(_0x565ca7){if(_0x565ca7){_0x5e9640=_0x565ca7;_0xea3039[_0x2bd0('0x32')]=_[_0x2bd0('0x33')](db['ChatInternalMessage'][_0x2bd0('0x30')]);_0xea3039[_0x2bd0('0x34')]=_[_0x2bd0('0x33')](_0x58c90c[_0x2bd0('0x34')]);_0xea3039[_0x2bd0('0x35')]=_[_0x2bd0('0x36')](_0xea3039['model'],_0xea3039[_0x2bd0('0x34')]);_0x524bfb[_0x2bd0('0x38')]=_['intersection'](_0xea3039[_0x2bd0('0x32')],qs[_0x2bd0('0x37')](_0x58c90c[_0x2bd0('0x34')][_0x2bd0('0x37')]));_0x524bfb[_0x2bd0('0x38')]=_0x524bfb[_0x2bd0('0x38')]['length']?_0x524bfb[_0x2bd0('0x38')]:_0xea3039[_0x2bd0('0x32')];_0x524bfb['order']=qs[_0x2bd0('0x3a')](_0x58c90c['query'][_0x2bd0('0x3a')]);_0x524bfb[_0x2bd0('0x3b')]=qs['filters'](_['pick'](_0x58c90c['query'],_0xea3039['filters']));if(_0x58c90c['query'][_0x2bd0('0x3f')]){_0x524bfb[_0x2bd0('0x3b')]=_[_0x2bd0('0x3d')](_0x524bfb[_0x2bd0('0x3b')],{'$or':_[_0x2bd0('0x2e')](_0x524bfb[_0x2bd0('0x38')],function(_0x50e538){var _0x52a566={};_0x52a566[_0x50e538]={'$like':'%'+_0x58c90c[_0x2bd0('0x34')]['filter']+'%'};return _0x52a566;})});}if(_0x58c90c[_0x2bd0('0x34')][_0x2bd0('0x59')]){var _0x22f69c=_0x58c90c[_0x2bd0('0x34')]['$gte'][_0x2bd0('0x5a')](',');var _0x2eadaa={};_0x2eadaa[_0x22f69c[0x0]]={'$gte':moment(_0x22f69c[0x1])[_0x2bd0('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')};_0x524bfb[_0x2bd0('0x3b')]=_[_0x2bd0('0x3d')](_0x524bfb[_0x2bd0('0x3b')],_0x2eadaa);}_0x524bfb=_['merge']({},_0x524bfb,_0x58c90c[_0x2bd0('0x40')]);return _0x5e9640[_0x2bd0('0x5c')](_0x524bfb);}})['then'](function(_0x315a57){if(_0x315a57){_0x42bf9f=_0x315a57[_0x2bd0('0x39')];if(!_0x58c90c['query'][_0x2bd0('0x53')](_0x2bd0('0x54'))){_0x524bfb['limit']=qs[_0x2bd0('0x20')](_0x58c90c[_0x2bd0('0x34')][_0x2bd0('0x20')]);_0x524bfb['offset']=qs['offset'](_0x58c90c['query'][_0x2bd0('0x1e')]);}return _0x5e9640[_0x2bd0('0x5c')](_0x524bfb);}})[_0x2bd0('0x27')](function(_0x496cad){if(_0x496cad){return _0x496cad?{'count':_0x42bf9f,'rows':_0x496cad}:null;}})[_0x2bd0('0x27')](respondWithResult(_0x339aa7,null))[_0x2bd0('0x44')](handleError(_0x339aa7,null));}; \ No newline at end of file +var _0x9b7b=['util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./chatGroup.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','update','then','destroy','error','stack','name','index','map','ChatGroup','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','rows','catch','show','params','rawAttributes','includeAll','include','options','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','User','order','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','format','eml-format','zip-dir','request-promise','moment','bluebird','mustache'];(function(_0x44d134,_0x3102bc){var _0x491931=function(_0x58b5e1){while(--_0x58b5e1){_0x44d134['push'](_0x44d134['shift']());}};_0x491931(++_0x3102bc);}(_0x9b7b,0xbe));var _0xb9b7=function(_0x1e4c5a,_0x29719e){_0x1e4c5a=_0x1e4c5a-0x0;var _0x48ab55=_0x9b7b[_0x1e4c5a];return _0x48ab55;};'use strict';var emlformat=require(_0xb9b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb9b7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb9b7('0x2'));var moment=require(_0xb9b7('0x3'));var BPromise=require(_0xb9b7('0x4'));var Mustache=require(_0xb9b7('0x5'));var util=require(_0xb9b7('0x6'));var path=require('path');var sox=require(_0xb9b7('0x7'));var csv=require(_0xb9b7('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9b7('0x9'));var _=require(_0xb9b7('0xa'));var squel=require(_0xb9b7('0xb'));var crypto=require(_0xb9b7('0xc'));var jsforce=require(_0xb9b7('0xd'));var deskjs=require(_0xb9b7('0xe'));var toCsv=require(_0xb9b7('0x8'));var querystring=require('querystring');var Papa=require(_0xb9b7('0xf'));var Redis=require(_0xb9b7('0x10'));var authService=require(_0xb9b7('0x11'));var qs=require(_0xb9b7('0x12'));var as=require(_0xb9b7('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb9b7('0x14'))(_0xb9b7('0x15'));var utils=require('../../config/utils');var config=require(_0xb9b7('0x16'));var licenseUtil=require(_0xb9b7('0x17'));var db=require(_0xb9b7('0x18'))['db'];config[_0xb9b7('0x19')]=_[_0xb9b7('0x1a')](config[_0xb9b7('0x19')],{'host':_0xb9b7('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb9b7('0x19')]));require(_0xb9b7('0x1c'))[_0xb9b7('0x1d')](socket);function respondWithStatusCode(_0x58e134,_0x625150){_0x625150=_0x625150||0xcc;return function(_0x5d89ae){if(_0x5d89ae){return _0x58e134[_0xb9b7('0x1e')](_0x625150);}return _0x58e134[_0xb9b7('0x1f')](_0x625150)[_0xb9b7('0x20')]();};}function respondWithResult(_0x59a6a1,_0x1061a3){_0x1061a3=_0x1061a3||0xc8;return function(_0x381b47){if(_0x381b47){return _0x59a6a1[_0xb9b7('0x1f')](_0x1061a3)[_0xb9b7('0x21')](_0x381b47);}};}function respondWithFilteredResult(_0x2c9e9e,_0x5a5d75){return function(_0x1a15ca){if(_0x1a15ca){var _0x1b0038=typeof _0x5a5d75[_0xb9b7('0x22')]==='undefined'&&typeof _0x5a5d75[_0xb9b7('0x23')]===_0xb9b7('0x24');var _0x38945e=_0x1a15ca[_0xb9b7('0x25')];var _0x24ee53=_0x1b0038?0x0:_0x5a5d75[_0xb9b7('0x22')];var _0x57a479=_0x1b0038?_0x1a15ca[_0xb9b7('0x25')]:_0x5a5d75[_0xb9b7('0x22')]+_0x5a5d75[_0xb9b7('0x23')];var _0x2a0e41;if(_0x57a479>=_0x38945e){_0x57a479=_0x38945e;_0x2a0e41=0xc8;}else{_0x2a0e41=0xce;}_0x2c9e9e[_0xb9b7('0x1f')](_0x2a0e41);return _0x2c9e9e[_0xb9b7('0x26')]('Content-Range',_0x24ee53+'-'+_0x57a479+'/'+_0x38945e)[_0xb9b7('0x21')](_0x1a15ca);}return null;};}function patchUpdates(_0x2edab0){return function(_0x352410){try{jsonpatch[_0xb9b7('0x27')](_0x352410,_0x2edab0,!![]);}catch(_0x1b1e76){return BPromise[_0xb9b7('0x28')](_0x1b1e76);}return _0x352410[_0xb9b7('0x29')]();};}function saveUpdates(_0x778bc5,_0x4ee10e){return function(_0x124f39){if(_0x124f39){return _0x124f39[_0xb9b7('0x2a')](_0x778bc5)[_0xb9b7('0x2b')](function(_0x1f5050){return _0x1f5050;});}return null;};}function removeEntity(_0x2f974c,_0x5d544c){return function(_0x52f279){if(_0x52f279){return _0x52f279[_0xb9b7('0x2c')]()['then'](function(){_0x2f974c[_0xb9b7('0x1f')](0xcc)[_0xb9b7('0x20')]();});}};}function handleEntityNotFound(_0x1778cc,_0xd66f61){return function(_0x4d6ded){if(!_0x4d6ded){_0x1778cc[_0xb9b7('0x1e')](0x194);}return _0x4d6ded;};}function handleError(_0x33610c,_0x39f46b){_0x39f46b=_0x39f46b||0x1f4;return function(_0x19d1c6){logger[_0xb9b7('0x2d')](_0x19d1c6[_0xb9b7('0x2e')]);if(_0x19d1c6[_0xb9b7('0x2f')]){delete _0x19d1c6['name'];}_0x33610c[_0xb9b7('0x1f')](_0x39f46b)['send'](_0x19d1c6);};}exports[_0xb9b7('0x30')]=function(_0x22803d,_0x297cca){var _0x4b3f52={},_0x1d2132={},_0x3d6ae2={'count':0x0,'rows':[]};var _0xb4bc31=_[_0xb9b7('0x31')](db[_0xb9b7('0x32')]['rawAttributes'],function(_0x6f1bdf){return{'name':_0x6f1bdf[_0xb9b7('0x33')],'type':_0x6f1bdf[_0xb9b7('0x34')][_0xb9b7('0x35')]};});_0x1d2132[_0xb9b7('0x36')]=_[_0xb9b7('0x31')](_0xb4bc31,_0xb9b7('0x2f'));_0x1d2132['query']=_[_0xb9b7('0x37')](_0x22803d[_0xb9b7('0x38')]);_0x1d2132[_0xb9b7('0x39')]=_[_0xb9b7('0x3a')](_0x1d2132[_0xb9b7('0x36')],_0x1d2132['query']);_0x4b3f52[_0xb9b7('0x3b')]=_[_0xb9b7('0x3a')](_0x1d2132[_0xb9b7('0x36')],qs[_0xb9b7('0x3c')](_0x22803d['query']['fields']));_0x4b3f52['attributes']=_0x4b3f52[_0xb9b7('0x3b')][_0xb9b7('0x3d')]?_0x4b3f52['attributes']:_0x1d2132[_0xb9b7('0x36')];if(!_0x22803d[_0xb9b7('0x38')][_0xb9b7('0x3e')](_0xb9b7('0x3f'))){_0x4b3f52[_0xb9b7('0x23')]=qs[_0xb9b7('0x23')](_0x22803d['query'][_0xb9b7('0x23')]);_0x4b3f52[_0xb9b7('0x22')]=qs[_0xb9b7('0x22')](_0x22803d[_0xb9b7('0x38')][_0xb9b7('0x22')]);}_0x4b3f52['order']=qs[_0xb9b7('0x40')](_0x22803d[_0xb9b7('0x38')][_0xb9b7('0x40')]);_0x4b3f52[_0xb9b7('0x41')]=qs['filters'](_[_0xb9b7('0x42')](_0x22803d[_0xb9b7('0x38')],_0x1d2132[_0xb9b7('0x39')]),_0xb4bc31);if(_0x22803d[_0xb9b7('0x38')][_0xb9b7('0x43')]){_0x4b3f52['where']=_[_0xb9b7('0x44')](_0x4b3f52[_0xb9b7('0x41')],{'$or':_['map'](_0xb4bc31,function(_0x58eea1){if(_0x58eea1['type']!==_0xb9b7('0x45')){var _0x227391={};_0x227391[_0x58eea1['name']]={'$like':'%'+_0x22803d[_0xb9b7('0x38')][_0xb9b7('0x43')]+'%'};return _0x227391;}})});}_0x4b3f52=_[_0xb9b7('0x44')]({},_0x4b3f52,_0x22803d['options']);var _0x19f50e={'where':_0x4b3f52['where']};return db[_0xb9b7('0x32')][_0xb9b7('0x25')](_0x19f50e)[_0xb9b7('0x2b')](function(_0x4aacc8){_0x3d6ae2[_0xb9b7('0x25')]=_0x4aacc8;if(_0x22803d['query']['includeAll']){_0x4b3f52['include']=[{'all':!![]}];}return db[_0xb9b7('0x32')]['findAll'](_0x4b3f52);})[_0xb9b7('0x2b')](function(_0x416f24){_0x3d6ae2[_0xb9b7('0x46')]=_0x416f24;return _0x3d6ae2;})[_0xb9b7('0x2b')](respondWithFilteredResult(_0x297cca,_0x4b3f52))[_0xb9b7('0x47')](handleError(_0x297cca,null));};exports[_0xb9b7('0x48')]=function(_0x5b9d55,_0xdedb47){var _0x3d5c83={'raw':!![],'where':{'id':_0x5b9d55[_0xb9b7('0x49')]['id']}},_0x47679b={};_0x47679b[_0xb9b7('0x36')]=_['keys'](db[_0xb9b7('0x32')][_0xb9b7('0x4a')]);_0x47679b['query']=_[_0xb9b7('0x37')](_0x5b9d55[_0xb9b7('0x38')]);_0x47679b[_0xb9b7('0x39')]=_[_0xb9b7('0x3a')](_0x47679b['model'],_0x47679b['query']);_0x3d5c83[_0xb9b7('0x3b')]=_['intersection'](_0x47679b[_0xb9b7('0x36')],qs['fields'](_0x5b9d55[_0xb9b7('0x38')][_0xb9b7('0x3c')]));_0x3d5c83['attributes']=_0x3d5c83['attributes'][_0xb9b7('0x3d')]?_0x3d5c83[_0xb9b7('0x3b')]:_0x47679b[_0xb9b7('0x36')];if(_0x5b9d55['query'][_0xb9b7('0x4b')]){_0x3d5c83[_0xb9b7('0x4c')]=[{'all':!![]}];}_0x3d5c83=_[_0xb9b7('0x44')]({},_0x3d5c83,_0x5b9d55[_0xb9b7('0x4d')]);return db['ChatGroup'][_0xb9b7('0x4e')](_0x3d5c83)['then'](handleEntityNotFound(_0xdedb47,null))['then'](respondWithResult(_0xdedb47,null))['catch'](handleError(_0xdedb47,null));};exports[_0xb9b7('0x4f')]=function(_0x28a0dc,_0x1d0a11){return db[_0xb9b7('0x32')][_0xb9b7('0x4f')](_0x28a0dc[_0xb9b7('0x50')],{})[_0xb9b7('0x2b')](respondWithResult(_0x1d0a11,0xc9))[_0xb9b7('0x47')](handleError(_0x1d0a11,null));};exports[_0xb9b7('0x2a')]=function(_0x28280d,_0x392fa7){if(_0x28280d['body']['id']){delete _0x28280d[_0xb9b7('0x50')]['id'];}return db[_0xb9b7('0x32')]['find']({'where':{'id':_0x28280d[_0xb9b7('0x49')]['id']}})['then'](handleEntityNotFound(_0x392fa7,null))[_0xb9b7('0x2b')](saveUpdates(_0x28280d[_0xb9b7('0x50')],null))[_0xb9b7('0x2b')](respondWithResult(_0x392fa7,null))[_0xb9b7('0x47')](handleError(_0x392fa7,null));};exports[_0xb9b7('0x2c')]=function(_0x40c509,_0x1ba77c){return db[_0xb9b7('0x32')][_0xb9b7('0x4e')]({'where':{'id':_0x40c509[_0xb9b7('0x49')]['id']}})[_0xb9b7('0x2b')](handleEntityNotFound(_0x1ba77c,null))['then'](removeEntity(_0x1ba77c,null))[_0xb9b7('0x47')](handleError(_0x1ba77c,null));};exports[_0xb9b7('0x51')]=function(_0x29bc2a,_0x48c3c8){return db[_0xb9b7('0x32')][_0xb9b7('0x51')]()['then'](respondWithResult(_0x48c3c8,null))[_0xb9b7('0x47')](handleError(_0x48c3c8,null));};exports[_0xb9b7('0x52')]=function(_0x2c770d,_0xb04914,_0x8d67a2){return db[_0xb9b7('0x53')][_0xb9b7('0x25')]({'where':{'ChatGroupId':_0x2c770d[_0xb9b7('0x49')]['id'],'ToId':_0x2c770d[_0xb9b7('0x54')]['id'],'read':![]}})[_0xb9b7('0x2b')](function(_0x2efc4e){return{'id':_['toInteger'](_0x2c770d[_0xb9b7('0x49')]['id']),'count':_0x2efc4e};})['then'](respondWithResult(_0xb04914,null))[_0xb9b7('0x47')](handleError(_0xb04914,null));};exports[_0xb9b7('0x55')]=function(_0x2cae72,_0x37d219,_0x58c2f6){return db['ChatGroup'][_0xb9b7('0x4e')]({'where':{'id':_0x2cae72[_0xb9b7('0x49')]['id']}})['then'](handleEntityNotFound(_0x37d219,null))[_0xb9b7('0x2b')](function(_0x238fbb){if(_0x238fbb){return _0x238fbb[_0xb9b7('0x55')](_0x2cae72[_0xb9b7('0x50')][_0xb9b7('0x56')],_[_0xb9b7('0x57')](_0x2cae72[_0xb9b7('0x50')],[_0xb9b7('0x56'),'id'])||{});}})[_0xb9b7('0x2b')](respondWithResult(_0x37d219,null))[_0xb9b7('0x47')](handleError(_0x37d219,null));};exports[_0xb9b7('0x58')]=function(_0x4d6671,_0x180819,_0x2b6ea3){var _0x5c47b0={};var _0x3170c2={};var _0x38acf5;var _0x2404dc;return db[_0xb9b7('0x32')]['findOne']({'where':{'id':_0x4d6671['params']['id']}})[_0xb9b7('0x2b')](handleEntityNotFound(_0x180819,null))[_0xb9b7('0x2b')](function(_0x35ce39){if(_0x35ce39){_0x38acf5=_0x35ce39;_0x3170c2[_0xb9b7('0x36')]=_['keys'](db[_0xb9b7('0x59')][_0xb9b7('0x4a')]);_0x3170c2[_0xb9b7('0x38')]=_['keys'](_0x4d6671['query']);_0x3170c2['filters']=_[_0xb9b7('0x3a')](_0x3170c2[_0xb9b7('0x36')],_0x3170c2[_0xb9b7('0x38')]);_0x5c47b0[_0xb9b7('0x3b')]=_[_0xb9b7('0x3a')](_0x3170c2[_0xb9b7('0x36')],qs[_0xb9b7('0x3c')](_0x4d6671[_0xb9b7('0x38')][_0xb9b7('0x3c')]));_0x5c47b0[_0xb9b7('0x3b')]=_0x5c47b0[_0xb9b7('0x3b')][_0xb9b7('0x3d')]?_0x5c47b0['attributes']:_0x3170c2[_0xb9b7('0x36')];_0x5c47b0[_0xb9b7('0x5a')]=qs['sort'](_0x4d6671['query']['sort']);_0x5c47b0['where']=qs[_0xb9b7('0x39')](_[_0xb9b7('0x42')](_0x4d6671[_0xb9b7('0x38')],_0x3170c2[_0xb9b7('0x39')]));if(_0x4d6671[_0xb9b7('0x38')][_0xb9b7('0x43')]){_0x5c47b0['where']=_[_0xb9b7('0x44')](_0x5c47b0[_0xb9b7('0x41')],{'$or':_['map'](_0x5c47b0['attributes'],function(_0x427c03){var _0x5a5e8a={};_0x5a5e8a[_0x427c03]={'$like':'%'+_0x4d6671[_0xb9b7('0x38')][_0xb9b7('0x43')]+'%'};return _0x5a5e8a;})});}_0x5c47b0=_[_0xb9b7('0x44')]({},_0x5c47b0,_0x4d6671['options']);return _0x38acf5['getMembers'](_0x5c47b0);}})['then'](function(_0x4db6e9){if(_0x4db6e9){_0x2404dc=_0x4db6e9['length'];if(!_0x4d6671['query']['hasOwnProperty'](_0xb9b7('0x3f'))){_0x5c47b0[_0xb9b7('0x23')]=qs['limit'](_0x4d6671[_0xb9b7('0x38')][_0xb9b7('0x23')]);_0x5c47b0['offset']=qs[_0xb9b7('0x22')](_0x4d6671[_0xb9b7('0x38')][_0xb9b7('0x22')]);}return _0x38acf5[_0xb9b7('0x58')](_0x5c47b0);}})[_0xb9b7('0x2b')](function(_0x2447da){if(_0x2447da){return _0x2447da?{'count':_0x2404dc,'rows':_0x2447da}:null;}})[_0xb9b7('0x2b')](respondWithResult(_0x180819,null))[_0xb9b7('0x47')](handleError(_0x180819,null));};exports[_0xb9b7('0x5b')]=function(_0x328132,_0x484a95,_0x55d86f){return db[_0xb9b7('0x32')][_0xb9b7('0x4e')]({'where':{'id':_0x328132[_0xb9b7('0x49')]['id']}})[_0xb9b7('0x2b')](handleEntityNotFound(_0x484a95,null))[_0xb9b7('0x2b')](function(_0x321a41){if(_0x321a41){return _0x321a41[_0xb9b7('0x5b')](_0x328132[_0xb9b7('0x38')]['ids']);}})[_0xb9b7('0x2b')](respondWithStatusCode(_0x484a95,null))['catch'](handleError(_0x484a95,null));};exports[_0xb9b7('0x5c')]=function(_0x378435,_0x4137c3,_0x3cecea){if(_0x378435[_0xb9b7('0x50')]['id']){delete _0x378435['body']['id'];}return db['ChatGroup'][_0xb9b7('0x4e')]({'where':{'id':_0x378435[_0xb9b7('0x49')]['id']}})[_0xb9b7('0x2b')](handleEntityNotFound(_0x4137c3,null))[_0xb9b7('0x2b')](function(_0x8076b9){if(_0x8076b9){_0x378435[_0xb9b7('0x50')][_0xb9b7('0x5d')]=_0x8076b9['id'];return db[_0xb9b7('0x53')][_0xb9b7('0x4f')](_0x378435[_0xb9b7('0x50')]);}})[_0xb9b7('0x2b')](respondWithResult(_0x4137c3,null))[_0xb9b7('0x47')](handleError(_0x4137c3,null));};exports[_0xb9b7('0x5e')]=function(_0x3595b6,_0x1b2940,_0x4bf7c9){var _0x922a66={};var _0x5c1f1d={};var _0x4d0203;var _0x11c443;return db['ChatGroup'][_0xb9b7('0x5f')]({'where':{'id':_0x3595b6[_0xb9b7('0x49')]['id']}})[_0xb9b7('0x2b')](handleEntityNotFound(_0x1b2940,null))[_0xb9b7('0x2b')](function(_0x59daeb){if(_0x59daeb){_0x4d0203=_0x59daeb;_0x5c1f1d[_0xb9b7('0x36')]=_[_0xb9b7('0x37')](db[_0xb9b7('0x53')][_0xb9b7('0x4a')]);_0x5c1f1d[_0xb9b7('0x38')]=_[_0xb9b7('0x37')](_0x3595b6[_0xb9b7('0x38')]);_0x5c1f1d[_0xb9b7('0x39')]=_[_0xb9b7('0x3a')](_0x5c1f1d[_0xb9b7('0x36')],_0x5c1f1d[_0xb9b7('0x38')]);_0x922a66[_0xb9b7('0x3b')]=_[_0xb9b7('0x3a')](_0x5c1f1d[_0xb9b7('0x36')],qs[_0xb9b7('0x3c')](_0x3595b6['query'][_0xb9b7('0x3c')]));_0x922a66[_0xb9b7('0x3b')]=_0x922a66[_0xb9b7('0x3b')]['length']?_0x922a66['attributes']:_0x5c1f1d[_0xb9b7('0x36')];_0x922a66[_0xb9b7('0x5a')]=qs[_0xb9b7('0x40')](_0x3595b6[_0xb9b7('0x38')][_0xb9b7('0x40')]);_0x922a66[_0xb9b7('0x41')]=qs[_0xb9b7('0x39')](_[_0xb9b7('0x42')](_0x3595b6['query'],_0x5c1f1d[_0xb9b7('0x39')]));if(_0x3595b6['query'][_0xb9b7('0x43')]){_0x922a66[_0xb9b7('0x41')]=_[_0xb9b7('0x44')](_0x922a66[_0xb9b7('0x41')],{'$or':_[_0xb9b7('0x31')](_0x922a66['attributes'],function(_0x16aede){var _0x237585={};_0x237585[_0x16aede]={'$like':'%'+_0x3595b6['query'][_0xb9b7('0x43')]+'%'};return _0x237585;})});}if(_0x3595b6[_0xb9b7('0x38')][_0xb9b7('0x60')]){var _0x3fb764=_0x3595b6[_0xb9b7('0x38')][_0xb9b7('0x60')]['split'](',');var _0xc2b578={};_0xc2b578[_0x3fb764[0x0]]={'$gte':moment(_0x3fb764[0x1])[_0xb9b7('0x61')]('YYYY-MM-DD\x20HH:mm:ss')};_0x922a66[_0xb9b7('0x41')]=_[_0xb9b7('0x44')](_0x922a66['where'],_0xc2b578);}_0x922a66=_[_0xb9b7('0x44')]({},_0x922a66,_0x3595b6[_0xb9b7('0x4d')]);return _0x4d0203[_0xb9b7('0x5e')](_0x922a66);}})[_0xb9b7('0x2b')](function(_0x28c149){if(_0x28c149){_0x11c443=_0x28c149['length'];if(!_0x3595b6[_0xb9b7('0x38')]['hasOwnProperty'](_0xb9b7('0x3f'))){_0x922a66[_0xb9b7('0x23')]=qs[_0xb9b7('0x23')](_0x3595b6[_0xb9b7('0x38')][_0xb9b7('0x23')]);_0x922a66[_0xb9b7('0x22')]=qs['offset'](_0x3595b6[_0xb9b7('0x38')][_0xb9b7('0x22')]);}return _0x4d0203['getMessages'](_0x922a66);}})['then'](function(_0x4d87ce){if(_0x4d87ce){return _0x4d87ce?{'count':_0x11c443,'rows':_0x4d87ce}:null;}})[_0xb9b7('0x2b')](respondWithResult(_0x1b2940,null))['catch'](handleError(_0x1b2940,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index b72b3da..de0cf1c 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 _0x9f37=['../../mysqldb','setMaxListeners','remove','emit','hook','exports','events'];(function(_0x1aa2e4,_0x3e5637){var _0x11da92=function(_0x585f){while(--_0x585f){_0x1aa2e4['push'](_0x1aa2e4['shift']());}};_0x11da92(++_0x3e5637);}(_0x9f37,0xd1));var _0x79f3=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0x9f37[_0x2ec461];return _0x28603d;};'use strict';var EventEmitter=require(_0x79f3('0x0'));var ChatGroup=require(_0x79f3('0x1'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x79f3('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x79f3('0x3')};function emitEvent(_0x3c3d35){return function(_0x4b11da,_0x599d3a,_0x361808){ChatGroupEvents[_0x79f3('0x4')](_0x3c3d35+':'+_0x4b11da['id'],_0x4b11da);ChatGroupEvents['emit'](_0x3c3d35,_0x4b11da);_0x361808(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x79f3('0x5')](e,emitEvent(event));}}module[_0x79f3('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0x4877=['hasOwnProperty','exports','events','../../mysqldb','ChatGroup','setMaxListeners','save','remove','emit'];(function(_0xc18e64,_0x346648){var _0x32d487=function(_0x28775e){while(--_0x28775e){_0xc18e64['push'](_0xc18e64['shift']());}};_0x32d487(++_0x346648);}(_0x4877,0x80));var _0x7487=function(_0x2297d6,_0x44771d){_0x2297d6=_0x2297d6-0x0;var _0xcdb1a4=_0x4877[_0x2297d6];return _0xcdb1a4;};'use strict';var EventEmitter=require(_0x7487('0x0'));var ChatGroup=require(_0x7487('0x1'))['db'][_0x7487('0x2')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x7487('0x3')](0x0);var events={'afterCreate':_0x7487('0x4'),'afterUpdate':'update','afterDestroy':_0x7487('0x5')};function emitEvent(_0xc61f96){return function(_0x14efa2,_0x19a0d4,_0x2a3581){ChatGroupEvents[_0x7487('0x6')](_0xc61f96+':'+_0x14efa2['id'],_0x14efa2);ChatGroupEvents['emit'](_0xc61f96,_0x14efa2);_0x2a3581(null);};}for(var e in events){if(events[_0x7487('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0x7487('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index f9f0330..48236f4 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 _0xf8e5=['api','moment','bluebird','path','rimraf','exports','define','ChatGroup','chat_groups','lodash','util'];(function(_0x51151b,_0x5c7800){var _0x4d9b66=function(_0x41ab5a){while(--_0x41ab5a){_0x51151b['push'](_0x51151b['shift']());}};_0x4d9b66(++_0x5c7800);}(_0xf8e5,0xae));var _0x5f8e=function(_0x2e36bf,_0x5e575e){_0x2e36bf=_0x2e36bf-0x0;var _0x51c5a6=_0xf8e5[_0x2e36bf];return _0x51c5a6;};'use strict';var _=require(_0x5f8e('0x0'));var util=require(_0x5f8e('0x1'));var logger=require('../../config/logger')(_0x5f8e('0x2'));var moment=require(_0x5f8e('0x3'));var BPromise=require(_0x5f8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f8e('0x5'));var rimraf=require(_0x5f8e('0x6'));var config=require('../../config/environment');var attributes=require('./chatGroup.attributes');module[_0x5f8e('0x7')]=function(_0x5e396b,_0x2f7de5){return _0x5e396b[_0x5f8e('0x8')](_0x5f8e('0x9'),attributes,{'tableName':_0x5f8e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa034=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./chatGroup.attributes','define','ChatGroup','lodash'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xa034,0xe5));var _0x4a03=function(_0x2319bf,_0x1c0127){_0x2319bf=_0x2319bf-0x0;var _0x2f3ada=_0xa034[_0x2319bf];return _0x2f3ada;};'use strict';var _=require(_0x4a03('0x0'));var util=require('util');var logger=require(_0x4a03('0x1'))(_0x4a03('0x2'));var moment=require(_0x4a03('0x3'));var BPromise=require(_0x4a03('0x4'));var rp=require(_0x4a03('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4a03('0x6'));var attributes=require(_0x4a03('0x7'));module['exports']=function(_0x17e59c,_0x39987a){return _0x17e59c[_0x4a03('0x8')](_0x4a03('0x9'),attributes,{'tableName':'chat_groups','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 eae1d10..9760f39 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 _0x40c2=['info','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','then'];(function(_0x2ec7f2,_0xe24da3){var _0x29de00=function(_0x383338){while(--_0x383338){_0x2ec7f2['push'](_0x2ec7f2['shift']());}};_0x29de00(++_0xe24da3);}(_0x40c2,0x10d));var _0x240c=function(_0x1652b2,_0xebc432){_0x1652b2=_0x1652b2-0x0;var _0x45202c=_0x40c2[_0x1652b2];return _0x45202c;};'use strict';var _=require('lodash');var util=require(_0x240c('0x0'));var moment=require(_0x240c('0x1'));var BPromise=require(_0x240c('0x2'));var rs=require(_0x240c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x240c('0x4'));var logger=require(_0x240c('0x5'))(_0x240c('0x6'));var config=require(_0x240c('0x7'));var jayson=require(_0x240c('0x8'));var client=jayson[_0x240c('0x9')][_0x240c('0xa')]({'port':0x232a});config['redis']=_[_0x240c('0xb')](config[_0x240c('0xc')],{'host':_0x240c('0xd'),'port':0x18eb});var socket=require(_0x240c('0xe'))(new Redis(config[_0x240c('0xc')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x4305c6,_0x225111,_0x57a5df){return new BPromise(function(_0x586326,_0x51752a){return client[_0x240c('0xf')](_0x4305c6,_0x57a5df)[_0x240c('0x10')](function(_0xcb1aaf){logger[_0x240c('0x11')]('ChatGroup,\x20%s,\x20%s',_0x225111,'request\x20sent');logger[_0x240c('0x12')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x225111,'request\x20sent',JSON[_0x240c('0x13')](_0xcb1aaf));if(_0xcb1aaf[_0x240c('0x14')]){if(_0xcb1aaf[_0x240c('0x14')][_0x240c('0x15')]===0x1f4){logger[_0x240c('0x14')](_0x240c('0x16'),_0x225111,_0xcb1aaf['error'][_0x240c('0x17')]);return _0x51752a(_0xcb1aaf[_0x240c('0x14')][_0x240c('0x17')]);}logger[_0x240c('0x14')](_0x240c('0x16'),_0x225111,_0xcb1aaf[_0x240c('0x14')][_0x240c('0x17')]);return _0x586326(_0xcb1aaf[_0x240c('0x14')][_0x240c('0x17')]);}else{logger[_0x240c('0x11')](_0x240c('0x16'),_0x225111,'request\x20sent');_0x586326(_0xcb1aaf[_0x240c('0x18')]['message']);}})[_0x240c('0x19')](function(_0xfc1115){logger[_0x240c('0x14')](_0x240c('0x16'),_0x225111,_0xfc1115);_0x51752a(_0xfc1115);});});} \ No newline at end of file +var _0x14d8=['ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','request','then','info'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x14d8,0x19d));var _0x814d=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x14d8[_0x21a9d9];return _0x46adce;};'use strict';var _=require(_0x814d('0x0'));var util=require(_0x814d('0x1'));var moment=require('moment');var BPromise=require(_0x814d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x814d('0x3'));var db=require(_0x814d('0x4'))['db'];var utils=require(_0x814d('0x5'));var logger=require(_0x814d('0x6'))(_0x814d('0x7'));var config=require('../../config/environment');var jayson=require(_0x814d('0x8'));var client=jayson[_0x814d('0x9')][_0x814d('0xa')]({'port':0x232a});config[_0x814d('0xb')]=_[_0x814d('0xc')](config[_0x814d('0xb')],{'host':_0x814d('0xd'),'port':0x18eb});var socket=require(_0x814d('0xe'))(new Redis(config[_0x814d('0xb')]));require(_0x814d('0xf'))['register'](socket);function respondWithRpcPromise(_0x10771d,_0x2f2efc,_0x13d1f6){return new BPromise(function(_0x21d598,_0x1e3e4a){return client[_0x814d('0x10')](_0x10771d,_0x13d1f6)[_0x814d('0x11')](function(_0xec8c9){logger[_0x814d('0x12')](_0x814d('0x13'),_0x2f2efc,_0x814d('0x14'));logger[_0x814d('0x15')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2f2efc,_0x814d('0x14'),JSON['stringify'](_0xec8c9));if(_0xec8c9[_0x814d('0x16')]){if(_0xec8c9[_0x814d('0x16')][_0x814d('0x17')]===0x1f4){logger[_0x814d('0x16')](_0x814d('0x13'),_0x2f2efc,_0xec8c9[_0x814d('0x16')][_0x814d('0x18')]);return _0x1e3e4a(_0xec8c9['error'][_0x814d('0x18')]);}logger['error'](_0x814d('0x13'),_0x2f2efc,_0xec8c9['error']['message']);return _0x21d598(_0xec8c9[_0x814d('0x16')]['message']);}else{logger[_0x814d('0x12')](_0x814d('0x13'),_0x2f2efc,'request\x20sent');_0x21d598(_0xec8c9[_0x814d('0x19')]['message']);}})[_0x814d('0x1a')](function(_0x33097c){logger[_0x814d('0x16')](_0x814d('0x13'),_0x2f2efc,_0x33097c);_0x1e3e4a(_0x33097c);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 6b0a190..344a2e1 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 _0xc558=['chatGroup:','save','remove','update'];(function(_0x16faaf,_0x4dc066){var _0x4611ec=function(_0x128a60){while(--_0x128a60){_0x16faaf['push'](_0x16faaf['shift']());}};_0x4611ec(++_0x4dc066);}(_0xc558,0x85));var _0x8c55=function(_0x272f82,_0x1de220){_0x272f82=_0x272f82-0x0;var _0x58506d=_0xc558[_0x272f82];return _0x58506d;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x8c55('0x0'),_0x8c55('0x1'),_0x8c55('0x2')];function createListener(_0x95195f,_0x1bdbc3){return function(_0x41ca9e){_0x1bdbc3['emit'](_0x95195f,_0x41ca9e);};}function removeListener(_0x3da635,_0x4f9ffd){return function(){ChatGroupEvents['removeListener'](_0x3da635,_0x4f9ffd);};}exports['register']=function(_0x27ea7e){for(var _0x5c653e=0x0,_0x2e227a=events['length'];_0x5c653e<_0x2e227a;_0x5c653e++){var _0x27a182=events[_0x5c653e];var _0x3fc842=createListener(_0x8c55('0x3')+_0x27a182,_0x27ea7e);ChatGroupEvents['on'](_0x27a182,_0x3fc842);}}; \ No newline at end of file +var _0x598f=['length','chatGroup:','./chatGroup.events','save','update','emit','removeListener','register'];(function(_0x58965a,_0x2e71db){var _0x254efc=function(_0xf14fb4){while(--_0xf14fb4){_0x58965a['push'](_0x58965a['shift']());}};_0x254efc(++_0x2e71db);}(_0x598f,0x152));var _0xf598=function(_0x491443,_0x1fb679){_0x491443=_0x491443-0x0;var _0x3fd00a=_0x598f[_0x491443];return _0x3fd00a;};'use strict';var ChatGroupEvents=require(_0xf598('0x0'));var events=[_0xf598('0x1'),'remove',_0xf598('0x2')];function createListener(_0x16d29a,_0x2f3d6f){return function(_0x97148c){_0x2f3d6f[_0xf598('0x3')](_0x16d29a,_0x97148c);};}function removeListener(_0x4bd7cf,_0x3443bf){return function(){ChatGroupEvents[_0xf598('0x4')](_0x4bd7cf,_0x3443bf);};}exports[_0xf598('0x5')]=function(_0x11961f){for(var _0x1c3291=0x0,_0x430e44=events[_0xf598('0x6')];_0x1c3291<_0x430e44;_0x1c3291++){var _0xd53e5d=events[_0x1c3291];var _0x295043=createListener(_0xf598('0x7')+_0xd53e5d,_0x11961f);ChatGroupEvents['on'](_0xd53e5d,_0x295043);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index ddab109..e871078 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 _0x6422=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','util','connect-timeout'];(function(_0xacf8c,_0x1d484b){var _0x21fd7b=function(_0x10b1bf){while(--_0x10b1bf){_0xacf8c['push'](_0xacf8c['shift']());}};_0x21fd7b(++_0x1d484b);}(_0x6422,0x16a));var _0x2642=function(_0x3fd115,_0x57b144){_0x3fd115=_0x3fd115-0x0;var _0x22122f=_0x6422[_0x3fd115];return _0x22122f;};'use strict';var multer=require('multer');var util=require(_0x2642('0x0'));var path=require('path');var timeout=require(_0x2642('0x1'));var express=require(_0x2642('0x2'));var router=express[_0x2642('0x3')]();var fs_extra=require(_0x2642('0x4'));var auth=require(_0x2642('0x5'));var interaction=require(_0x2642('0x6'));var config=require(_0x2642('0x7'));var controller=require('./chatGroup.controller');router[_0x2642('0x8')]('/',auth[_0x2642('0x9')](),controller[_0x2642('0xa')]);router['get'](_0x2642('0xb'),auth[_0x2642('0x9')](),controller['describe']);router[_0x2642('0x8')](_0x2642('0xc'),auth[_0x2642('0x9')](),controller[_0x2642('0xd')]);router[_0x2642('0x8')]('/:id/unread',auth[_0x2642('0x9')](),controller[_0x2642('0xe')]);router[_0x2642('0x8')](_0x2642('0xf'),auth[_0x2642('0x9')](),controller[_0x2642('0x10')]);router[_0x2642('0x8')](_0x2642('0x11'),auth[_0x2642('0x9')](),controller['getMessages']);router[_0x2642('0x12')]('/',auth[_0x2642('0x9')](),controller[_0x2642('0x13')]);router[_0x2642('0x12')](_0x2642('0xf'),auth[_0x2642('0x9')](),controller[_0x2642('0x14')]);router[_0x2642('0x12')](_0x2642('0x11'),auth[_0x2642('0x9')](),controller[_0x2642('0x15')]);router[_0x2642('0x16')](_0x2642('0xc'),auth[_0x2642('0x9')](),controller[_0x2642('0x17')]);router[_0x2642('0x18')](_0x2642('0xc'),auth[_0x2642('0x9')](),controller[_0x2642('0x19')]);router['delete'](_0x2642('0xf'),auth[_0x2642('0x9')](),controller[_0x2642('0x1a')]);module[_0x2642('0x1b')]=router; \ No newline at end of file +var _0xe1ba=['../../components/auth/service','./chatGroup.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','/:id/messages','post','create','addMembers','addMessage','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x481317,_0xf38bda){var _0x18ae45=function(_0x48fe1a){while(--_0x48fe1a){_0x481317['push'](_0x481317['shift']());}};_0x18ae45(++_0xf38bda);}(_0xe1ba,0x1ab));var _0xae1b=function(_0x5db65f,_0xf89cc8){_0x5db65f=_0x5db65f-0x0;var _0x34fb4b=_0xe1ba[_0x5db65f];return _0x34fb4b;};'use strict';var multer=require(_0xae1b('0x0'));var util=require(_0xae1b('0x1'));var path=require('path');var timeout=require(_0xae1b('0x2'));var express=require('express');var router=express[_0xae1b('0x3')]();var fs_extra=require(_0xae1b('0x4'));var auth=require(_0xae1b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xae1b('0x6'));router[_0xae1b('0x7')]('/',auth[_0xae1b('0x8')](),controller[_0xae1b('0x9')]);router[_0xae1b('0x7')](_0xae1b('0xa'),auth[_0xae1b('0x8')](),controller['describe']);router['get'](_0xae1b('0xb'),auth['isAuthenticated'](),controller[_0xae1b('0xc')]);router[_0xae1b('0x7')](_0xae1b('0xd'),auth[_0xae1b('0x8')](),controller[_0xae1b('0xe')]);router['get'](_0xae1b('0xf'),auth[_0xae1b('0x8')](),controller[_0xae1b('0x10')]);router[_0xae1b('0x7')](_0xae1b('0x11'),auth[_0xae1b('0x8')](),controller['getMessages']);router[_0xae1b('0x12')]('/',auth[_0xae1b('0x8')](),controller[_0xae1b('0x13')]);router['post']('/:id/members',auth[_0xae1b('0x8')](),controller[_0xae1b('0x14')]);router[_0xae1b('0x12')](_0xae1b('0x11'),auth[_0xae1b('0x8')](),controller[_0xae1b('0x15')]);router[_0xae1b('0x16')](_0xae1b('0xb'),auth[_0xae1b('0x8')](),controller[_0xae1b('0x17')]);router[_0xae1b('0x18')](_0xae1b('0xb'),auth[_0xae1b('0x8')](),controller[_0xae1b('0x19')]);router[_0xae1b('0x18')](_0xae1b('0xf'),auth[_0xae1b('0x8')](),controller['removeMembers']);module[_0xae1b('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index 24136e7..de03b3e 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 _0x3613=['BOOLEAN','INTEGER','ENUM','star','thumb','TEXT','STRING','DATE','long','out','sequelize'];(function(_0x1920d3,_0x6599d3){var _0xd5d01c=function(_0x8a6ea9){while(--_0x8a6ea9){_0x1920d3['push'](_0x1920d3['shift']());}};_0xd5d01c(++_0x6599d3);}(_0x3613,0x1ee));var _0x3361=function(_0x4f5817,_0x3e7d5f){_0x4f5817=_0x4f5817-0x0;var _0x47b044=_0x3613[_0x4f5817];return _0x47b044;};'use strict';var Sequelize=require(_0x3361('0x0'));module['exports']={'closed':{'type':Sequelize[_0x3361('0x1')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x3361('0x2')]},'ratingType':{'type':Sequelize[_0x3361('0x3')](_0x3361('0x4'),_0x3361('0x5')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x3361('0x6')]},'pathTranscript':{'type':Sequelize[_0x3361('0x6')]},'mailTranscript':{'type':Sequelize[_0x3361('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x3361('0x8')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x3361('0x7')]},'thirdDisposition':{'type':Sequelize[_0x3361('0x7')]},'note':{'type':Sequelize['STRING']},'browserName':{'type':Sequelize[_0x3361('0x7')]},'browserVersion':{'type':Sequelize[_0x3361('0x7')]},'osName':{'type':Sequelize[_0x3361('0x7')]},'osVersion':{'type':Sequelize[_0x3361('0x7')]},'deviceModel':{'type':Sequelize[_0x3361('0x7')]},'deviceVendor':{'type':Sequelize[_0x3361('0x7')]},'deviceType':{'type':Sequelize[_0x3361('0x7')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0x3361('0x6')](_0x3361('0x9'))},'read1stAt':{'type':Sequelize[_0x3361('0x8')]},'lastMsgAt':{'type':Sequelize[_0x3361('0x8')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3361('0xa')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x3361('0x7')]},'customerPort':{'type':Sequelize[_0x3361('0x7')]},'vidaooSessionId':{'type':Sequelize[_0x3361('0x6')]},'autoreplyExecuted':{'type':Sequelize[_0x3361('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x3361('0x2')]}}; \ No newline at end of file +var _0x93c1=['INTEGER','ENUM','star','TEXT','STRING','long','DATE','out','BOOLEAN','sequelize'];(function(_0x4eb95d,_0x4a13f6){var _0x5ed323=function(_0x405e23){while(--_0x405e23){_0x4eb95d['push'](_0x4eb95d['shift']());}};_0x5ed323(++_0x4a13f6);}(_0x93c1,0x1f3));var _0x193c=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x93c1[_0x1abb09];return _0xea1c07;};'use strict';var Sequelize=require(_0x193c('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x193c('0x1')]},'ratingType':{'type':Sequelize[_0x193c('0x2')](_0x193c('0x3'),'thumb'),'defaultValue':_0x193c('0x3')},'ratingMessage':{'type':Sequelize[_0x193c('0x4')]},'pathTranscript':{'type':Sequelize[_0x193c('0x4')]},'mailTranscript':{'type':Sequelize[_0x193c('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x193c('0x5')]},'thirdDisposition':{'type':Sequelize[_0x193c('0x5')]},'note':{'type':Sequelize[_0x193c('0x5')]},'browserName':{'type':Sequelize[_0x193c('0x5')]},'browserVersion':{'type':Sequelize[_0x193c('0x5')]},'osName':{'type':Sequelize[_0x193c('0x5')]},'osVersion':{'type':Sequelize[_0x193c('0x5')]},'deviceModel':{'type':Sequelize[_0x193c('0x5')]},'deviceVendor':{'type':Sequelize[_0x193c('0x5')]},'deviceType':{'type':Sequelize[_0x193c('0x5')]},'referer':{'type':Sequelize[_0x193c('0x4')]},'customerIp':{'type':Sequelize[_0x193c('0x5')]},'formData':{'type':Sequelize['TEXT'](_0x193c('0x6'))},'read1stAt':{'type':Sequelize[_0x193c('0x7')]},'lastMsgAt':{'type':Sequelize[_0x193c('0x7')]},'lastMsgDirection':{'type':Sequelize[_0x193c('0x2')]('in',_0x193c('0x8')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x193c('0x5')]},'customerPort':{'type':Sequelize[_0x193c('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x193c('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x193c('0x9')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 5889cf9..9109d45 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 _0x65a6=['show','model','keys','filters','intersection','attributes','fields','includeAll','include','options','find','create','params','describe','createVidaooSession','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooNote','follow','isNull','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','join_url','out','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','CmContact','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','entity\x20not\x20found','sendStatus','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','originalname','basename','file','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','root','server/files/attachments/','offline-chat/','join','download','close','mailTranscript','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','ChatMessage','Messages','User','ContactId','length','%s%d','agentAlias','System','customer','Visitor','agent_alias','alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','nolimit','limit','order','sort','pick','where','ChatInteractionId','filter','merge','map','$gte','YYYY-MM-DD\x20HH:mm:ss','rows','getMyMessages','hasOwnProperty','includeAgent','addTags','omit','spread','Tag','color','emit','removeTags','server','files','tmp','attachments','transcript-%d-%s.zip','push','lastName','read','Account','get','mkdirSync','Chat','Owner','N.A.','toString','closedAt','browserName','referer','customerIp','customerPort','createReadStream','pipe','renderFile','views','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','request-promise','moment','bluebird','mustache','path','ejs','ioredis','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','client','http','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','undefined','count','set','Content-Range','update','destroy','stack','name','send','render','body','account','index','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','query','user'];(function(_0x4663bb,_0x1c2966){var _0x285df2=function(_0x48f7fc){while(--_0x48f7fc){_0x4663bb['push'](_0x4663bb['shift']());}};_0x285df2(++_0x1c2966);}(_0x65a6,0x16c));var _0x665a=function(_0xf51c06,_0x388e5b){_0xf51c06=_0xf51c06-0x0;var _0x1d5420=_0x65a6[_0xf51c06];return _0x1d5420;};'use strict';var rimraf=require(_0x665a('0x0'));var zipdir=require('zip-dir');var rp=require(_0x665a('0x1'));var moment=require(_0x665a('0x2'));var BPromise=require(_0x665a('0x3'));var Mustache=require(_0x665a('0x4'));var util=require('util');var path=require(_0x665a('0x5'));var ejs=require(_0x665a('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x665a('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x665a('0x8'));var pdf=require(_0x665a('0x9'));var logger=require(_0x665a('0xa'))(_0x665a('0xb'));var config=require(_0x665a('0xc'));var db=require(_0x665a('0xd'))['db'];config['redis']=_[_0x665a('0xe')](config[_0x665a('0xf')],{'host':_0x665a('0x10'),'port':0x18eb});var socket=require(_0x665a('0x11'))(new Redis(config[_0x665a('0xf')]));require(_0x665a('0x12'))[_0x665a('0x13')](socket);var jayson=require(_0x665a('0x14'));var client=jayson[_0x665a('0x15')][_0x665a('0x16')]({'port':0x232b});var client9004=jayson[_0x665a('0x15')]['http']({'port':0x232c});function respondWithRpcPromise(_0x454360,_0x17ef7b,_0x21b164,_0x2ebe0e){return new BPromise(function(_0x48da76,_0x4ffe3d){var _0x4fef67=_0x2ebe0e||client;return _0x4fef67['request'](_0x454360,_0x21b164)[_0x665a('0x17')](function(_0x13a71e){logger[_0x665a('0x18')](_0x665a('0x19'),_0x17ef7b,_0x665a('0x1a'));logger['debug'](_0x665a('0x1b'),_0x17ef7b,_0x665a('0x1a'),JSON[_0x665a('0x1c')](_0x13a71e));if(_0x13a71e[_0x665a('0x1d')]){if(_0x13a71e[_0x665a('0x1d')][_0x665a('0x1e')]===0x1f4){logger[_0x665a('0x1d')](_0x665a('0x19'),_0x17ef7b,_0x13a71e[_0x665a('0x1d')][_0x665a('0x1f')]);return _0x4ffe3d(_0x13a71e[_0x665a('0x1d')][_0x665a('0x1f')]);}logger['error']('ChatInteraction,\x20%s,\x20%s',_0x17ef7b,_0x13a71e[_0x665a('0x1d')][_0x665a('0x1f')]);return _0x48da76(_0x13a71e[_0x665a('0x1d')]['message']);}else{logger[_0x665a('0x18')]('ChatInteraction,\x20%s,\x20%s',_0x17ef7b,_0x665a('0x1a'));_0x48da76(_0x13a71e['result']['message']);}})[_0x665a('0x20')](function(_0x4def99){logger[_0x665a('0x1d')](_0x665a('0x19'),_0x17ef7b,_0x4def99);_0x4ffe3d(_0x4def99);});});}function respondWithStatusCode(_0x22be50,_0x5abca6){_0x5abca6=_0x5abca6||0xcc;return function(_0x25291e){if(_0x25291e){return _0x22be50['sendStatus'](_0x5abca6);}return _0x22be50[_0x665a('0x21')](_0x5abca6)['end']();};}function respondWithResult(_0xa7b307,_0x38dcd9){_0x38dcd9=_0x38dcd9||0xc8;return function(_0x5b5637){if(_0x5b5637){return _0xa7b307[_0x665a('0x21')](_0x38dcd9)[_0x665a('0x22')](_0x5b5637);}};}function respondWithFilteredResult(_0x2ab6e6,_0x3ad9e8){return function(_0x54574c){if(_0x54574c){var _0x261964=typeof _0x3ad9e8[_0x665a('0x23')]===_0x665a('0x24')&&typeof _0x3ad9e8['limit']===_0x665a('0x24');var _0x172736=_0x54574c[_0x665a('0x25')];var _0x405760=_0x261964?0x0:_0x3ad9e8[_0x665a('0x23')];var _0x59a2d2=_0x261964?_0x54574c[_0x665a('0x25')]:_0x3ad9e8[_0x665a('0x23')]+_0x3ad9e8['limit'];var _0x47ec0d;if(_0x59a2d2>=_0x172736){_0x59a2d2=_0x172736;_0x47ec0d=0xc8;}else{_0x47ec0d=0xce;}_0x2ab6e6[_0x665a('0x21')](_0x47ec0d);return _0x2ab6e6[_0x665a('0x26')](_0x665a('0x27'),_0x405760+'-'+_0x59a2d2+'/'+_0x172736)['json'](_0x54574c);}return null;};}function saveUpdates(_0x360398){return function(_0x574ebd){if(_0x574ebd){return _0x574ebd[_0x665a('0x28')](_0x360398)[_0x665a('0x17')](function(_0x48b46a){return _0x48b46a;});}return null;};}function removeEntity(_0x17137b){return function(_0x49786d){if(_0x49786d){return _0x49786d[_0x665a('0x29')]()[_0x665a('0x17')](function(){_0x17137b[_0x665a('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ab863){return function(_0x562f36){if(!_0x562f36){_0x4ab863['sendStatus'](0x194);}return _0x562f36;};}function handleError(_0x10333b,_0x2f5510){_0x2f5510=_0x2f5510||0x1f4;return function(_0x27c7f9){logger[_0x665a('0x1d')](_0x27c7f9[_0x665a('0x2a')]);if(_0x27c7f9[_0x665a('0x2b')]){delete _0x27c7f9['name'];}_0x10333b[_0x665a('0x21')](_0x2f5510)[_0x665a('0x2c')](_0x27c7f9);};}function getMustacheRender(_0x3c2e81,_0x393003){return Mustache[_0x665a('0x2d')](_0x3c2e81,_['merge'](_0x393003[_0x665a('0x2e')],{'contact':_0x393003['contact'],'message':_0x393003[_0x665a('0x1f')],'agent':_0x393003['agent'],'interaction':_0x393003['interaction'],'account':_0x393003[_0x665a('0x2f')]}))||'';}exports[_0x665a('0x30')]=function(_0x33b296,_0x3f0167){var _0x2cf609={};var _0x1604ff=_['map'](db[_0x665a('0x31')][_0x665a('0x32')],function(_0x4fb88a){return{'name':_0x4fb88a[_0x665a('0x33')],'type':_0x4fb88a[_0x665a('0x34')][_0x665a('0x35')]};});_0x2cf609=qs[_0x665a('0x36')](_0x1604ff,_0x33b296);return interaction[_0x665a('0x37')]('chat',_0x33b296[_0x665a('0x38')],_0x33b296[_0x665a('0x39')],_0x2cf609,_0x1604ff)['then'](respondWithFilteredResult(_0x3f0167,_0x2cf609))[_0x665a('0x20')](handleError(_0x3f0167,null));};exports[_0x665a('0x3a')]=function(_0x3cff6e,_0x200d78){var _0x30e1bc={'raw':![],'where':{'id':_0x3cff6e['params']['id']}},_0x28f2e0={};_0x28f2e0[_0x665a('0x3b')]=_[_0x665a('0x3c')](db['ChatInteraction'][_0x665a('0x32')]);_0x28f2e0[_0x665a('0x38')]=_['keys'](_0x3cff6e[_0x665a('0x38')]);_0x28f2e0[_0x665a('0x3d')]=_[_0x665a('0x3e')](_0x28f2e0[_0x665a('0x3b')],_0x28f2e0[_0x665a('0x38')]);_0x30e1bc[_0x665a('0x3f')]=_[_0x665a('0x3e')](_0x28f2e0['model'],qs[_0x665a('0x40')](_0x3cff6e[_0x665a('0x38')][_0x665a('0x40')]));_0x30e1bc[_0x665a('0x3f')]=_0x30e1bc[_0x665a('0x3f')]['length']?_0x30e1bc[_0x665a('0x3f')]:_0x28f2e0[_0x665a('0x3b')];if(_0x3cff6e[_0x665a('0x38')][_0x665a('0x41')]){_0x30e1bc[_0x665a('0x42')]=[{'all':!![]}];}_0x30e1bc=_['merge']({},_0x30e1bc,_0x3cff6e[_0x665a('0x43')]);return db[_0x665a('0x31')][_0x665a('0x44')](_0x30e1bc)[_0x665a('0x17')](handleEntityNotFound(_0x200d78,null))['then'](respondWithResult(_0x200d78,null))[_0x665a('0x20')](handleError(_0x200d78,null));};exports[_0x665a('0x45')]=function(_0x4c4fe8,_0x51305f){return db[_0x665a('0x31')][_0x665a('0x45')](_0x4c4fe8[_0x665a('0x2e')],{})['then'](respondWithResult(_0x51305f,0xc9))[_0x665a('0x20')](handleError(_0x51305f,null));};exports[_0x665a('0x28')]=function(_0x23c1d1,_0x1af583){if(_0x23c1d1[_0x665a('0x2e')]['id']){delete _0x23c1d1[_0x665a('0x2e')]['id'];}return db[_0x665a('0x31')][_0x665a('0x44')]({'where':{'id':_0x23c1d1[_0x665a('0x46')]['id']}})[_0x665a('0x17')](handleEntityNotFound(_0x1af583,null))['then'](saveUpdates(_0x23c1d1[_0x665a('0x2e')],null))[_0x665a('0x17')](respondWithResult(_0x1af583,null))[_0x665a('0x20')](handleError(_0x1af583,null));};exports['destroy']=function(_0x269042,_0x46fc83){return db[_0x665a('0x31')]['find']({'where':{'id':_0x269042[_0x665a('0x46')]['id']}})[_0x665a('0x17')](handleEntityNotFound(_0x46fc83,null))[_0x665a('0x17')](removeEntity(_0x46fc83,null))[_0x665a('0x20')](handleError(_0x46fc83,null));};exports[_0x665a('0x47')]=function(_0xc4a2c5,_0x365049){return db[_0x665a('0x31')]['describe']()['then'](respondWithResult(_0x365049,null))[_0x665a('0x20')](handleError(_0x365049,null));};exports[_0x665a('0x48')]=function(_0x49a546,_0xf1a106){var _0x4ed64c=_0x49a546[_0x665a('0x46')]['id'];var _0x390a4b;var _0x3d5c03;var _0x264da8;return db[_0x665a('0x31')][_0x665a('0x49')]({'where':{'id':_0x4ed64c}})['then'](function(_0x1f2b13){_0x390a4b=_0x1f2b13;return db[_0x665a('0x4a')][_0x665a('0x49')]({'where':{'id':_0x1f2b13[_0x665a('0x4b')]},'attributes':['id',_0x665a('0x4c'),_0x665a('0x4d'),_0x665a('0x4e'),'vidaooNote',_0x665a('0x4f')],'raw':!![]});})[_0x665a('0x17')](function(_0x1907fb){if(_0x1907fb&&_0x1907fb[_0x665a('0x4c')]&&_0x1907fb[_0x665a('0x4d')]){_0x3d5c03=_0x1907fb;var _0x55b998={'interaction':{'id':_0x4ed64c},'agent':{'id':_0x49a546[_0x665a('0x39')]['id'],'name':_0x49a546['user']['name'],'fullname':_0x49a546[_0x665a('0x39')]['fullname'],'email':_0x49a546[_0x665a('0x39')][_0x665a('0x50')]},'contact':_0x49a546['body'][_0x665a('0x51')],'account':_0x49a546[_0x665a('0x2e')][_0x665a('0x2f')]};var _0x4b0990={'rejectUnauthorized':![],'method':_0x665a('0x52'),'url':_0x665a('0x53'),'headers':{'X-APIKEY':_0x1907fb[_0x665a('0x4c')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x49a546['user']['email']],'buttons':null,'topic':_0x3d5c03['vidaooTopic'],'note':_['isNull'](_0x3d5c03[_0x665a('0x54')])?null:getMustacheRender(_0x3d5c03[_0x665a('0x54')],_0x55b998),'metadata':null},'redirect':_0x665a('0x55'),'json':!![]};try{if(!_[_0x665a('0x56')](_0x3d5c03[_0x665a('0x4f')])){var _0x2f5e20=getMustacheRender(_0x3d5c03[_0x665a('0x4f')],_0x55b998);var _0x2fadfa=JSON[_0x665a('0x57')](_0x2f5e20);_0x4b0990[_0x665a('0x2e')][_0x665a('0x58')]=_0x2fadfa;}}catch(_0x3837d6){throw new db['Sequelize'][(_0x665a('0x59'))](_0x665a('0x5a'));}return rp(_0x4b0990);}else{throw new db['Sequelize'][(_0x665a('0x59'))]('Error\x20in\x20Vidaoo\x20configuration');}})[_0x665a('0x17')](function(_0x2aa2a0){_0x264da8=_0x2aa2a0;if(_0x264da8['id']){var _0x23e638={'body':_0x264da8[_0x665a('0x5b')],'ChatWebsiteId':_0x3d5c03['id'],'ChatInteractionId':_0x390a4b['id'],'direction':_0x665a('0x5c'),'UserId':_0x49a546[_0x665a('0x39')]['id']};return db['ChatMessage'][_0x665a('0x45')](_0x23e638,{});}else{throw new db[(_0x665a('0x5d'))]['ValidationError'](_0x665a('0x5e'));}})[_0x665a('0x17')](function(){return _0x390a4b[_0x665a('0x5f')]({'vidaooSessionId':_0x264da8['id']});})[_0x665a('0x17')](respondWithResult(_0xf1a106,null))[_0x665a('0x20')](handleError(_0xf1a106,null));};exports[_0x665a('0x60')]=function(_0x41a007,_0x3b53ab){if(_0x41a007['body']['id']){delete _0x41a007['body']['id'];}return db[_0x665a('0x31')][_0x665a('0x44')]({'where':{'id':_0x41a007[_0x665a('0x46')]['id']},'include':[{'model':db[_0x665a('0x61')],'as':_0x665a('0x62')}]})['then'](handleEntityNotFound(_0x3b53ab,null))['then'](saveUpdates(_0x41a007[_0x665a('0x2e')],null))[_0x665a('0x17')](respondWithResult(_0x3b53ab,null))['catch'](handleError(_0x3b53ab,null));};exports['abandon']=function(_0x2c95c0,_0xde2649){if(_0x2c95c0[_0x665a('0x2e')]['id']){delete _0x2c95c0[_0x665a('0x2e')]['id'];}return db[_0x665a('0x31')][_0x665a('0x44')]({'where':{'id':_0x2c95c0[_0x665a('0x46')]['id']}})[_0x665a('0x17')](function(_0xa1aa17){if(!_0xa1aa17){logger[_0x665a('0x1d')](_0x665a('0x63'),_0x665a('0x64'),0x194,_0x665a('0x65'));_0xde2649[_0x665a('0x66')](0x194);}else{if(_0xa1aa17[_0x665a('0x67')]){throw new db[(_0x665a('0x5d'))][(_0x665a('0x59'))](_0x665a('0x68'));}}return _0xa1aa17;})[_0x665a('0x17')](function(_0x430110){if(_0x430110){return _0x430110[_0x665a('0x28')]({'closed':_0x2c95c0[_0x665a('0x2e')][_0x665a('0x69')],'disposition':_0x2c95c0[_0x665a('0x2e')][_0x665a('0x6a')]})[_0x665a('0x17')](function(_0x33051d){return _0x33051d;});}})[_0x665a('0x17')](function(){return respondWithRpcPromise(_0x665a('0x6b'),_0x665a('0x64'),_0x2c95c0[_0x665a('0x2e')],client9004);})['then'](respondWithResult(_0xde2649,null))[_0x665a('0x20')](handleError(_0xde2649,null));};exports[_0x665a('0x6c')]=function(_0x4b8004,_0x54c28a){_0x4b8004[_0x665a('0x2e')]['name']=_0x4b8004['file'][_0x665a('0x6d')];_0x4b8004[_0x665a('0x2e')][_0x665a('0x6e')]=_0x4b8004[_0x665a('0x6f')]['filename'];_0x4b8004[_0x665a('0x2e')][_0x665a('0x34')]=_0x4b8004[_0x665a('0x6f')][_0x665a('0x70')];return db[_0x665a('0x71')][_0x665a('0x45')](_0x4b8004[_0x665a('0x2e')])[_0x665a('0x17')](respondWithResult(_0x54c28a,0xc9))[_0x665a('0x20')](handleError(_0x54c28a,null));};exports[_0x665a('0x72')]=function(_0x48c59a,_0x43d4fd){return db[_0x665a('0x31')][_0x665a('0x49')]({'where':{'id':_0x48c59a[_0x665a('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x43d4fd,null))[_0x665a('0x17')](function(_0xe75721){if(_0xe75721){if(_0xe75721[_0x665a('0x69')]){return _0x43d4fd[_0x665a('0x21')](0x193)[_0x665a('0x22')]({'status':0x193,'message':_0x665a('0x73')});}return db[_0x665a('0x71')]['findOne']({'where':{'id':_0x48c59a[_0x665a('0x38')][_0x665a('0x74')]},'raw':!![]})[_0x665a('0x17')](handleEntityNotFound(_0x43d4fd,null));}})[_0x665a('0x17')](function(_0x16ddf1){if(_0x16ddf1){var _0x2c181c=_0x16ddf1['ChatOfflineMessageId']!==null;var _0xaab45b=path['join'](config[_0x665a('0x75')],_0x665a('0x76'));if(_0x2c181c){_0xaab45b=path['join'](_0xaab45b,_0x665a('0x77'));}var _0x417c07=path[_0x665a('0x78')](_0xaab45b,_0x16ddf1['basename']);return _0x43d4fd[_0x665a('0x79')](_0x417c07);}})['catch'](handleError(_0x43d4fd,null));};exports[_0x665a('0x7a')]=function(_0x1934cd,_0x30c455){var _0x3d97bb=null;var _0x37c537=null;var _0x2f2c72=null;if(_0x1934cd['body']['id']){delete _0x1934cd[_0x665a('0x2e')]['id'];}if(_0x1934cd[_0x665a('0x2e')][_0x665a('0x7b')]){_0x2f2c72=path[_0x665a('0x78')](config[_0x665a('0x75')],_0x665a('0x7c'),util[_0x665a('0x7d')](_0x665a('0x7e'),Date[_0x665a('0x7f')]()));_0x1934cd[_0x665a('0x2e')][_0x665a('0x80')]=_0x2f2c72;}return db['ChatInteraction'][_0x665a('0x44')]({'where':{'id':_0x1934cd[_0x665a('0x46')]['id']},'include':[{'model':db[_0x665a('0x81')],'as':_0x665a('0x82'),'include':[{'model':db['User'],'as':_0x665a('0x83')}]}]})[_0x665a('0x17')](handleEntityNotFound(_0x30c455,null))[_0x665a('0x17')](saveUpdates(_0x1934cd[_0x665a('0x2e')],null))[_0x665a('0x17')](function(_0x1dc6e2){if(_0x1dc6e2){_0x3d97bb=_0x1dc6e2;return db[_0x665a('0x4a')]['find']({'where':{'id':_0x3d97bb[_0x665a('0x4b')]}});}})[_0x665a('0x17')](function(_0x337826){if(_0x337826){_0x37c537=_0x337826;return db[_0x665a('0x61')]['find']({'where':{'id':_0x3d97bb[_0x665a('0x84')]}});}})[_0x665a('0x17')](function(_0x304b72){if(_0x304b72){if(_0x2f2c72){var _0xcee4c3=null;for(var _0x1f5e77=0x1;_0x1f5e77<_0x3d97bb[_0x665a('0x82')][_0x665a('0x85')];++_0x1f5e77){_0xcee4c3=_0x3d97bb[_0x665a('0x82')][_0x1f5e77];var _0x5d0bfd=_0xcee4c3[_0x665a('0x67')]?util[_0x665a('0x7d')](_0x665a('0x86'),_0x37c537[_0x665a('0x87')],_0xcee4c3[_0x665a('0x67')]):_0x665a('0x88');var _0x706d0=_0x1934cd['body'][_0x665a('0x89')]||util[_0x665a('0x7d')](_0x665a('0x86'),_0x665a('0x8a'),_0xcee4c3[_0x665a('0x84')]);switch(_0x37c537['agentIdentifier']){case'website_alias':_0x5d0bfd=_0xcee4c3[_0x665a('0x67')]?util['format'](_0x665a('0x86'),_0x37c537[_0x665a('0x87')],_0xcee4c3[_0x665a('0x67')]):_0x665a('0x88');break;case _0x665a('0x8b'):_0x5d0bfd=_0xcee4c3['UserId']?_0xcee4c3[_0x665a('0x83')][_0x665a('0x8c')]||_0xcee4c3['User'][_0x665a('0x8d')]:'System';break;case _0x665a('0x8e'):_0x5d0bfd=_0xcee4c3[_0x665a('0x67')]?_0xcee4c3[_0x665a('0x83')][_0x665a('0x8d')]:_0x665a('0x88');break;default:_0x5d0bfd=_0xcee4c3[_0x665a('0x67')]?util[_0x665a('0x7d')](_0x665a('0x86'),_0x37c537[_0x665a('0x87')],_0xcee4c3['UserId']):_0x665a('0x88');}var _0xe04002=util[_0x665a('0x7d')](_0x665a('0x8f'),moment(_0xcee4c3[_0x665a('0x90')])[_0x665a('0x7d')](_0x665a('0x91')),_0xcee4c3[_0x665a('0x92')]==='in'?_0x706d0:_0x5d0bfd,_0xcee4c3['body']);if(!_0xcee4c3[_0x665a('0x93')]){fs[_0x665a('0x94')](_0x2f2c72,_0xe04002);}}return db['MailAccount']['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x665a('0x95')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x665a('0x96')],'as':'CloudProvider','raw':!![]}]}]});}}})[_0x665a('0x17')](function(_0x15a85e){if(!_0x15a85e||!_0x15a85e[_0x665a('0x97')]||!_0x1934cd[_0x665a('0x2e')])return _0x3d97bb;var _0x149a8f=_0x15a85e[_0x665a('0x98')]();return respondWithRpcPromise(_0x665a('0x99'),_0x665a('0x9a'),{'account':_0x149a8f,'message':{'from':util[_0x665a('0x7d')](_0x665a('0x9b'),_0x15a85e['name'],_0x15a85e['email']||_0x15a85e[_0x665a('0x97')]['user']),'to':_0x1934cd[_0x665a('0x2e')]['mailTranscript'],'subject':'Mail\x20Transcript','text':util[_0x665a('0x7d')](_0x665a('0x9c'),_0x1934cd[_0x665a('0x2e')][_0x665a('0x7b')]),'attachments':[{'path':_0x2f2c72}]}})['then'](function(){return _0x3d97bb;})[_0x665a('0x20')](function(_0x409321){logger['error'](_0x409321);});})[_0x665a('0x17')](respondWithStatusCode(_0x30c455,0xc8))[_0x665a('0x20')](handleError(_0x30c455,null));};exports['addMessage']=function(_0x1d97f1,_0x1304fa){return db[_0x665a('0x81')]['find']({'where':{'id':_0x1d97f1['params']['id']}})[_0x665a('0x17')](handleEntityNotFound(_0x1304fa,null))[_0x665a('0x17')](function(_0x4294a0){if(_0x4294a0){return _0x4294a0[_0x665a('0x9d')](_0x1d97f1[_0x665a('0x2e')][_0x665a('0x9e')],_['omit'](_0x1d97f1['body'],[_0x665a('0x9e'),'id'])||{});}})['then'](respondWithResult(_0x1304fa,null))['catch'](handleError(_0x1304fa,null));};exports[_0x665a('0x9f')]=function(_0xcfc934,_0x74197d){var _0x5cddbf={'raw':![],'where':{}};var _0x18a40c={};var _0x32b752={'count':0x0,'rows':[]};return db[_0x665a('0x31')]['findOne']({'where':{'id':_0xcfc934[_0x665a('0x46')]['id']}})[_0x665a('0x17')](handleEntityNotFound(_0x74197d,null))['then'](function(_0x4b51d4){if(_0x4b51d4){_0x18a40c[_0x665a('0x3b')]=_[_0x665a('0x3c')](db[_0x665a('0x81')][_0x665a('0x32')]);_0x18a40c['query']=_[_0x665a('0x3c')](_0xcfc934[_0x665a('0x38')]);_0x18a40c[_0x665a('0x3d')]=_[_0x665a('0x3e')](_0x18a40c[_0x665a('0x3b')],_0x18a40c[_0x665a('0x38')]);_0x5cddbf['attributes']=_[_0x665a('0x3e')](_0x18a40c[_0x665a('0x3b')],qs['fields'](_0xcfc934['query'][_0x665a('0x40')]));_0x5cddbf[_0x665a('0x3f')]=_0x5cddbf[_0x665a('0x3f')]['length']?_0x5cddbf[_0x665a('0x3f')]:_0x18a40c[_0x665a('0x3b')];if(!_0xcfc934[_0x665a('0x38')]['hasOwnProperty'](_0x665a('0xa0'))){_0x5cddbf[_0x665a('0xa1')]=qs[_0x665a('0xa1')](_0xcfc934[_0x665a('0x38')][_0x665a('0xa1')]);_0x5cddbf['offset']=qs[_0x665a('0x23')](_0xcfc934[_0x665a('0x38')][_0x665a('0x23')]);}_0x5cddbf[_0x665a('0xa2')]=qs[_0x665a('0xa3')](_0xcfc934[_0x665a('0x38')][_0x665a('0xa3')]);_0x5cddbf['where']=qs['filters'](_[_0x665a('0xa4')](_0xcfc934[_0x665a('0x38')],_0x18a40c[_0x665a('0x3d')]));_0x5cddbf[_0x665a('0xa5')][_0x665a('0xa6')]=_0x4b51d4['id'];if(_0xcfc934['query'][_0x665a('0xa7')]){_0x5cddbf[_0x665a('0xa5')]=_[_0x665a('0xa8')](_0x5cddbf[_0x665a('0xa5')],{'$or':_[_0x665a('0xa9')](_0x5cddbf[_0x665a('0x3f')],function(_0x43f3e1){var _0x485178={};_0x485178[_0x43f3e1]={'$like':'%'+_0xcfc934[_0x665a('0x38')][_0x665a('0xa7')]+'%'};return _0x485178;})});}if(_0xcfc934['query'][_0x665a('0xaa')]){var _0x7837b9=_0xcfc934[_0x665a('0x38')][_0x665a('0xaa')]['split'](',');var _0xdbc1d6={};_0xdbc1d6[_0x7837b9[0x0]]={'$gte':moment(_0x7837b9[0x1])[_0x665a('0x7d')](_0x665a('0xab'))};_0x5cddbf['where']=_[_0x665a('0xa8')](_0x5cddbf[_0x665a('0xa5')],_0xdbc1d6);}_0x5cddbf=_[_0x665a('0xa8')]({},_0x5cddbf,_0xcfc934['options']);return db[_0x665a('0x81')][_0x665a('0x25')]({'where':_0x5cddbf[_0x665a('0xa5')]})['then'](function(_0x461e1a){_0x32b752[_0x665a('0x25')]=_0x461e1a;if(_0xcfc934[_0x665a('0x38')][_0x665a('0x41')]){_0x5cddbf[_0x665a('0x42')]=[{'all':!![]}];}return db['ChatMessage'][_0x665a('0x37')](_0x5cddbf);})['then'](function(_0x42e09a){_0x32b752[_0x665a('0xac')]=_0x42e09a;return _0x32b752;});}})[_0x665a('0x17')](respondWithFilteredResult(_0x74197d,_0x5cddbf))['catch'](handleError(_0x74197d,null));};exports[_0x665a('0xad')]=function(_0x92cb4,_0x59e970){var _0x17037c={'where':{}},_0x46bff3={},_0x6da8ff={'count':0x0,'rows':[]};return db[_0x665a('0x31')][_0x665a('0x49')]({'where':{'id':_0x92cb4['params']['id']}})[_0x665a('0x17')](handleEntityNotFound(_0x59e970,null))['then'](function(_0x15db41){if(_0x15db41){_0x46bff3['model']=_['keys'](db['ChatMessage'][_0x665a('0x32')]);_0x46bff3[_0x665a('0x38')]=_[_0x665a('0x3c')](_0x92cb4['query']);_0x46bff3[_0x665a('0x3d')]=_['intersection'](_0x46bff3[_0x665a('0x3b')],_0x46bff3[_0x665a('0x38')]);_0x17037c['attributes']=_[_0x665a('0x3e')](_0x46bff3[_0x665a('0x3b')],qs[_0x665a('0x40')](_0x92cb4[_0x665a('0x38')][_0x665a('0x40')]));_0x17037c['attributes']=_0x17037c['attributes'][_0x665a('0x85')]?_0x17037c[_0x665a('0x3f')]:_0x46bff3['model'];if(!_0x92cb4[_0x665a('0x38')][_0x665a('0xae')](_0x665a('0xa0'))){_0x17037c[_0x665a('0xa1')]=qs[_0x665a('0xa1')](_0x92cb4[_0x665a('0x38')]['limit']);_0x17037c[_0x665a('0x23')]=qs['offset'](_0x92cb4['query'][_0x665a('0x23')]);}_0x17037c['order']=qs[_0x665a('0xa3')](_0x92cb4['query'][_0x665a('0xa3')]);_0x17037c['where']=qs[_0x665a('0x3d')](_[_0x665a('0xa4')](_0x92cb4['query'],_0x46bff3[_0x665a('0x3d')]));_0x17037c[_0x665a('0xa5')][_0x665a('0xa6')]=_0x15db41['id'];if(_0x92cb4[_0x665a('0x38')][_0x665a('0xa7')]){_0x17037c[_0x665a('0xa5')]=_[_0x665a('0xa8')](_0x17037c[_0x665a('0xa5')],{'$or':_[_0x665a('0xa9')](_0x17037c['attributes'],function(_0x5519a3){var _0xf9dcac={};_0xf9dcac[_0x5519a3]={'$like':'%'+_0x92cb4['query'][_0x665a('0xa7')]+'%'};return _0xf9dcac;})});}_0x17037c[_0x665a('0xa5')][_0x665a('0x93')]=![];if(_0x92cb4[_0x665a('0x38')]['id']){_0x17037c[_0x665a('0xa5')]['id']={'$gt':_0x92cb4['query']['id']};}_0x17037c=_[_0x665a('0xa8')]({},_0x17037c,_0x92cb4[_0x665a('0x43')]);return db[_0x665a('0x81')][_0x665a('0x25')]({'where':_0x17037c['where']})[_0x665a('0x17')](function(_0x904027){_0x6da8ff[_0x665a('0x25')]=_0x904027;_0x17037c[_0x665a('0x42')]=[];if(_0x92cb4[_0x665a('0x38')][_0x665a('0xaf')]){_0x17037c[_0x665a('0x42')]['push']({'model':db['User'],'as':_0x665a('0x83'),'attributes':['id',_0x665a('0x8d'),_0x665a('0x8c')]});}if(_0x92cb4['query'][_0x665a('0x41')]){_0x17037c['include']=[{'all':!![]}];}return db[_0x665a('0x81')][_0x665a('0x37')](_0x17037c);})[_0x665a('0x17')](function(_0x53abfb){_0x6da8ff[_0x665a('0xac')]=_0x53abfb;return _0x6da8ff;});}})[_0x665a('0x17')](respondWithFilteredResult(_0x59e970,_0x17037c))[_0x665a('0x20')](handleError(_0x59e970,null));};exports[_0x665a('0xb0')]=function(_0x581bac,_0x51e019){return db[_0x665a('0x31')][_0x665a('0x44')]({'where':{'id':_0x581bac['params']['id']}})['then'](handleEntityNotFound(_0x51e019,null))[_0x665a('0x17')](function(_0x9b1e98){if(_0x9b1e98){return _0x9b1e98['setTags'](_0x581bac[_0x665a('0x2e')]['ids'],_[_0x665a('0xb1')](_0x581bac[_0x665a('0x2e')],[_0x665a('0x9e'),'id'])||{})[_0x665a('0xb2')](function(){return db[_0x665a('0xb3')][_0x665a('0x37')]({'attributes':['id',_0x665a('0x2b'),_0x665a('0xb4')],'where':{'id':_0x581bac[_0x665a('0x2e')][_0x665a('0x9e')]}});})[_0x665a('0x17')](function(_0x59166b){socket[_0x665a('0xb5')]('chatInteractionTags:save',{'id':Number(_0x581bac[_0x665a('0x46')]['id']),'tags':_0x59166b||[]});return{'id':Number(_0x581bac[_0x665a('0x46')]['id']),'tags':_0x59166b||[]};});}})[_0x665a('0x17')](respondWithResult(_0x51e019,null))[_0x665a('0x20')](handleError(_0x51e019,null));};exports[_0x665a('0xb6')]=function(_0x2b3863,_0x36dc74){return db['ChatInteraction'][_0x665a('0x44')]({'where':{'id':_0x2b3863['params']['id']}})['then'](handleEntityNotFound(_0x36dc74,null))[_0x665a('0x17')](function(_0x42a848){if(_0x42a848){return _0x42a848[_0x665a('0xb6')](_0x2b3863['query'][_0x665a('0x9e')]);}})[_0x665a('0x17')](respondWithStatusCode(_0x36dc74,null))[_0x665a('0x20')](handleError(_0x36dc74,null));};exports[_0x665a('0x79')]=function(_0x25b8d2,_0x5dca96){var _0x37c658=moment()['unix']()['toString']();var _0x4059ef=path['join'](config[_0x665a('0x75')],_0x665a('0xb7'),_0x665a('0xb8'),_0x665a('0xb9'));var _0x32a8cd=path[_0x665a('0x78')](config['root'],_0x665a('0xb7'),'files',_0x665a('0xba'));var _0x361e05=path[_0x665a('0x78')](_0x4059ef,_0x37c658);var _0x12529b=util[_0x665a('0x7d')](_0x665a('0xbb'),_0x25b8d2[_0x665a('0x46')]['id'],_0x37c658);var _0x9c8773=path['join'](_0x4059ef,_0x12529b);var _0xc9a3d2=[];_0xc9a3d2[_0x665a('0xbc')]({'model':db[_0x665a('0x83')],'as':_0x665a('0x83'),'attributes':['id',_0x665a('0x8d')],'raw':!![]});_0xc9a3d2[_0x665a('0xbc')]({'model':db[_0x665a('0x61')],'as':_0x665a('0x62'),'attributes':['id','firstName',_0x665a('0xbd')],'raw':!![]});if(_0x25b8d2[_0x665a('0x38')][_0x665a('0xba')]){_0xc9a3d2[_0x665a('0xbc')]({'model':db[_0x665a('0x71')],'as':_0x665a('0x71'),'raw':!![]});}var _0xc6a0d3=[{'model':db['ChatMessage'],'as':_0x665a('0x82'),'attributes':['id','body',_0x665a('0x90'),_0x665a('0x92'),_0x665a('0x93'),_0x665a('0xbe')],'include':_0xc9a3d2}];_0xc6a0d3[_0x665a('0xbc')]({'model':db['ChatWebsite'],'as':_0x665a('0xbf'),'attributes':['id',_0x665a('0x2b')]});_0xc6a0d3['push']({'model':db[_0x665a('0x83')],'as':'Owner','attributes':['id','fullname']});return db[_0x665a('0x31')][_0x665a('0x44')]({'where':{'id':_0x25b8d2['params']['id']},'include':_0xc6a0d3})['then'](handleEntityNotFound(_0x5dca96,null))['then'](function(_0x135dfd){if(_0x135dfd){var _0x5104e1=_0x135dfd[_0x665a('0xc0')]({'plain':!![]});fs[_0x665a('0xc1')](_0x361e05);var _0x51bcce={'channel':_0x665a('0xc2'),'account':_0x5104e1[_0x665a('0xbf')][_0x665a('0x2b')],'agent':_0x5104e1[_0x665a('0xc3')]?_0x5104e1[_0x665a('0xc3')][_0x665a('0x8d')]:_0x665a('0xc4'),'createdAt':moment(_0x5104e1[_0x665a('0x90')])[_0x665a('0x7d')](_0x665a('0xab'))[_0x665a('0xc5')](),'closedAt':_0x5104e1[_0x665a('0x69')]?moment(_0x5104e1[_0x665a('0xc6')])[_0x665a('0x7d')](_0x665a('0xab'))['toString']():'','disposition':_0x5104e1['disposition'],'chatInfo':{'browser':_0x5104e1[_0x665a('0xc7')],'os':_0x5104e1['osName'],'referer':_0x5104e1[_0x665a('0xc8')],'customerIp':_0x5104e1[_0x665a('0xc9')],'customerPort':_0x5104e1[_0x665a('0xca')]?_0x5104e1[_0x665a('0xca')]:_0x665a('0xc4')},'messages':_(_0x5104e1[_0x665a('0x82')])['tail']()[_0x665a('0xa7')]({'secret':![]})[_0x665a('0xa9')](function(_0xbe8cf0){if(_0xbe8cf0[_0x665a('0x71')]){var _0x2fe40c=path[_0x665a('0x78')](_0x32a8cd,_0xbe8cf0[_0x665a('0x71')][_0x665a('0x6e')]);if(fs['existsSync'](_0x2fe40c)){fs[_0x665a('0xcb')](_0x2fe40c)[_0x665a('0xcc')](fs['createWriteStream'](path[_0x665a('0x78')](_0x361e05,_0xbe8cf0['Attachment'][_0x665a('0x6e')])));}}return{'date':moment(_0xbe8cf0[_0x665a('0x90')])[_0x665a('0x7d')](_0x665a('0xab'))['toString'](),'sender':_0xbe8cf0[_0x665a('0x92')]===_0x665a('0x5c')?_0xbe8cf0['User']?_0xbe8cf0['User'][_0x665a('0x8d')]:'System':_0xbe8cf0[_0x665a('0x62')]['firstName']+(_0xbe8cf0[_0x665a('0x62')][_0x665a('0xbd')]?'\x20'+_0xbe8cf0['Contact'][_0x665a('0xbd')]:''),'body':_0xbe8cf0[_0x665a('0x71')]?_0xbe8cf0[_0x665a('0x71')][_0x665a('0x6e')]:_0xbe8cf0[_0x665a('0x2e')],'direction':_0xbe8cf0[_0x665a('0x92')]==='out'?'A':'C','secret':_0xbe8cf0[_0x665a('0x93')],'read':_0xbe8cf0[_0x665a('0xbe')],'attachment':_0xbe8cf0[_0x665a('0x71')]};})['value']()};return ejs[_0x665a('0xcd')](path['join'](config['root'],'server',_0x665a('0xce'),'downloadInteraction.ejs'),{'interaction':_0x51bcce})[_0x665a('0x17')](function(_0x5ad0d2){var _0x22c32a=path['join'](_0x361e05,'transcript-'+_0x5104e1['id']+'-'+_0x37c658+_0x665a('0xcf'));var _0x304ca8={'path':_0x22c32a,'channel':_0x665a('0xc2'),'interactionId':_0x5104e1['id']};return pdf[_0x665a('0xd0')](_0x5ad0d2,_0x304ca8);})['then'](function(){return new Promise(function(_0x40b8dd,_0x1c67fe){zipdir(_0x361e05,{'saveTo':_0x9c8773},function(_0x3df48c,_0x3002ba){if(_0x3df48c)return _0x1c67fe(_0x3df48c);return _0x40b8dd(_0x3002ba);});})[_0x665a('0x17')](function(){return new BPromise(function(_0x26f4fb,_0x1550db){rimraf(_0x361e05,function(_0x590922){if(_0x590922)_0x1550db(_0x590922);return _0x26f4fb();});});})[_0x665a('0x17')](function(){return _0x5dca96[_0x665a('0x79')](_0x9c8773,_0x12529b,function(_0x195fbb){if(_0x195fbb){logger[_0x665a('0x1d')](_0x665a('0xd1'),_0x195fbb);}else{fs[_0x665a('0xd2')](_0x9c8773);}});});});}else{return _0x5dca96['sendStatus'](0xc8);}})[_0x665a('0x20')](handleError(_0x5dca96,null));}; \ No newline at end of file +var _0x56f0=['spread','Tag','color','emit','chatInteractionTags:save','removeTags','unix','server','attachments','transcript-%d-%s.zip','firstName','lastName','direction','read','Owner','mkdirSync','Chat','Account','N.A.','toString','closedAt','browserName','osName','referer','customerIp','customerPort','existsSync','createReadStream','pipe','createWriteStream','value','renderFile','downloadInteraction.ejs','transcript-','err','rimraf','zip-dir','request-promise','moment','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','client','http','request','info','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','ChatInteraction,\x20%s,\x20%s','message','status','end','json','offset','limit','count','update','then','destroy','stack','name','send','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','query','catch','show','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','merge','find','create','describe','ChatWebsite','findOne','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','user','fullname','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Sequelize','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','UserId','Interaction\x20already\x20assigned','closed','disposition','AbandonInteraction','attachmentUpload','file','originalname','basename','filename','mimetype','attachmentDownload','Unauthorized','Attachment','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','download','close','mailTranscript','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsiteId','CmContact','format','%s%d','agentAlias','System','ContactId','agentIdentifier','website_alias','agent_alias','User','alias','createdAt','MM/DD/YYYY\x20HH:mm:ss','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','order','sort','where','ChatInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','getMyMessages','hasOwnProperty','pick','secret','options','includeAgent','push','rows','setTags'];(function(_0x590b63,_0x14debb){var _0x3c9380=function(_0x58fc67){while(--_0x58fc67){_0x590b63['push'](_0x590b63['shift']());}};_0x3c9380(++_0x14debb);}(_0x56f0,0xf3));var _0x056f=function(_0x166953,_0x214d3a){_0x166953=_0x166953-0x0;var _0x4a8baf=_0x56f0[_0x166953];return _0x4a8baf;};'use strict';var rimraf=require(_0x056f('0x0'));var zipdir=require(_0x056f('0x1'));var rp=require(_0x056f('0x2'));var moment=require(_0x056f('0x3'));var BPromise=require(_0x056f('0x4'));var Mustache=require('mustache');var util=require(_0x056f('0x5'));var path=require(_0x056f('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x056f('0x7'));var Redis=require(_0x056f('0x8'));var interaction=require(_0x056f('0x9'));var qs=require(_0x056f('0xa'));var pdf=require(_0x056f('0xb'));var logger=require(_0x056f('0xc'))('api');var config=require(_0x056f('0xd'));var db=require(_0x056f('0xe'))['db'];config['redis']=_[_0x056f('0xf')](config[_0x056f('0x10')],{'host':_0x056f('0x11'),'port':0x18eb});var socket=require(_0x056f('0x12'))(new Redis(config[_0x056f('0x10')]));require(_0x056f('0x13'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x056f('0x14')][_0x056f('0x15')]({'port':0x232b});var client9004=jayson[_0x056f('0x14')][_0x056f('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x337c19,_0x4915f4,_0x5adc36,_0xb4c2b9){return new BPromise(function(_0x82ec7,_0x5db0c4){var _0x378ed4=_0xb4c2b9||client;return _0x378ed4[_0x056f('0x16')](_0x337c19,_0x5adc36)['then'](function(_0x4524c2){logger[_0x056f('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x4915f4,_0x056f('0x18'));logger['debug'](_0x056f('0x19'),_0x4915f4,_0x056f('0x18'),JSON[_0x056f('0x1a')](_0x4524c2));if(_0x4524c2['error']){if(_0x4524c2['error']['code']===0x1f4){logger[_0x056f('0x1b')](_0x056f('0x1c'),_0x4915f4,_0x4524c2[_0x056f('0x1b')][_0x056f('0x1d')]);return _0x5db0c4(_0x4524c2[_0x056f('0x1b')][_0x056f('0x1d')]);}logger[_0x056f('0x1b')](_0x056f('0x1c'),_0x4915f4,_0x4524c2[_0x056f('0x1b')][_0x056f('0x1d')]);return _0x82ec7(_0x4524c2[_0x056f('0x1b')]['message']);}else{logger[_0x056f('0x17')](_0x056f('0x1c'),_0x4915f4,_0x056f('0x18'));_0x82ec7(_0x4524c2['result']['message']);}})['catch'](function(_0x14c016){logger[_0x056f('0x1b')]('ChatInteraction,\x20%s,\x20%s',_0x4915f4,_0x14c016);_0x5db0c4(_0x14c016);});});}function respondWithStatusCode(_0x5d8927,_0x498898){_0x498898=_0x498898||0xcc;return function(_0x5745af){if(_0x5745af){return _0x5d8927['sendStatus'](_0x498898);}return _0x5d8927[_0x056f('0x1e')](_0x498898)[_0x056f('0x1f')]();};}function respondWithResult(_0x3638fd,_0x17b4bd){_0x17b4bd=_0x17b4bd||0xc8;return function(_0x9be413){if(_0x9be413){return _0x3638fd['status'](_0x17b4bd)[_0x056f('0x20')](_0x9be413);}};}function respondWithFilteredResult(_0x56f8a9,_0x1eacbd){return function(_0x52817e){if(_0x52817e){var _0xd2dbaf=typeof _0x1eacbd[_0x056f('0x21')]==='undefined'&&typeof _0x1eacbd[_0x056f('0x22')]==='undefined';var _0x5161f4=_0x52817e[_0x056f('0x23')];var _0x2573c5=_0xd2dbaf?0x0:_0x1eacbd[_0x056f('0x21')];var _0x174752=_0xd2dbaf?_0x52817e[_0x056f('0x23')]:_0x1eacbd[_0x056f('0x21')]+_0x1eacbd[_0x056f('0x22')];var _0x215a76;if(_0x174752>=_0x5161f4){_0x174752=_0x5161f4;_0x215a76=0xc8;}else{_0x215a76=0xce;}_0x56f8a9[_0x056f('0x1e')](_0x215a76);return _0x56f8a9['set']('Content-Range',_0x2573c5+'-'+_0x174752+'/'+_0x5161f4)[_0x056f('0x20')](_0x52817e);}return null;};}function saveUpdates(_0x3dd29e){return function(_0x539f39){if(_0x539f39){return _0x539f39[_0x056f('0x24')](_0x3dd29e)[_0x056f('0x25')](function(_0x4bb68d){return _0x4bb68d;});}return null;};}function removeEntity(_0x58ef12){return function(_0x26274a){if(_0x26274a){return _0x26274a[_0x056f('0x26')]()['then'](function(){_0x58ef12['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2401df){return function(_0xa23765){if(!_0xa23765){_0x2401df['sendStatus'](0x194);}return _0xa23765;};}function handleError(_0x43ba59,_0x40b71c){_0x40b71c=_0x40b71c||0x1f4;return function(_0x38a1ec){logger['error'](_0x38a1ec[_0x056f('0x27')]);if(_0x38a1ec[_0x056f('0x28')]){delete _0x38a1ec[_0x056f('0x28')];}_0x43ba59[_0x056f('0x1e')](_0x40b71c)[_0x056f('0x29')](_0x38a1ec);};}function getMustacheRender(_0x25a34c,_0x2d52b0){return Mustache['render'](_0x25a34c,_['merge'](_0x2d52b0[_0x056f('0x2a')],{'contact':_0x2d52b0[_0x056f('0x2b')],'message':_0x2d52b0[_0x056f('0x1d')],'agent':_0x2d52b0[_0x056f('0x2c')],'interaction':_0x2d52b0[_0x056f('0x2d')],'account':_0x2d52b0[_0x056f('0x2e')]}))||'';}exports[_0x056f('0x2f')]=function(_0x20f2f8,_0x42e192){var _0x2ca8f0={};var _0x91114d=_[_0x056f('0x30')](db[_0x056f('0x31')][_0x056f('0x32')],function(_0x7cd0b5){return{'name':_0x7cd0b5[_0x056f('0x33')],'type':_0x7cd0b5[_0x056f('0x34')][_0x056f('0x35')]};});_0x2ca8f0=qs[_0x056f('0x36')](_0x91114d,_0x20f2f8);return interaction[_0x056f('0x37')](_0x056f('0x38'),_0x20f2f8[_0x056f('0x39')],_0x20f2f8['user'],_0x2ca8f0,_0x91114d)[_0x056f('0x25')](respondWithFilteredResult(_0x42e192,_0x2ca8f0))[_0x056f('0x3a')](handleError(_0x42e192,null));};exports[_0x056f('0x3b')]=function(_0x1c56a1,_0x9a05d8){var _0x545654={'raw':![],'where':{'id':_0x1c56a1[_0x056f('0x3c')]['id']}},_0x3909fe={};_0x3909fe[_0x056f('0x3d')]=_[_0x056f('0x3e')](db[_0x056f('0x31')][_0x056f('0x32')]);_0x3909fe[_0x056f('0x39')]=_['keys'](_0x1c56a1['query']);_0x3909fe[_0x056f('0x3f')]=_[_0x056f('0x40')](_0x3909fe['model'],_0x3909fe[_0x056f('0x39')]);_0x545654['attributes']=_[_0x056f('0x40')](_0x3909fe['model'],qs[_0x056f('0x41')](_0x1c56a1[_0x056f('0x39')][_0x056f('0x41')]));_0x545654[_0x056f('0x42')]=_0x545654[_0x056f('0x42')][_0x056f('0x43')]?_0x545654['attributes']:_0x3909fe[_0x056f('0x3d')];if(_0x1c56a1['query'][_0x056f('0x44')]){_0x545654[_0x056f('0x45')]=[{'all':!![]}];}_0x545654=_[_0x056f('0x46')]({},_0x545654,_0x1c56a1['options']);return db[_0x056f('0x31')][_0x056f('0x47')](_0x545654)[_0x056f('0x25')](handleEntityNotFound(_0x9a05d8,null))['then'](respondWithResult(_0x9a05d8,null))[_0x056f('0x3a')](handleError(_0x9a05d8,null));};exports[_0x056f('0x48')]=function(_0x2f612c,_0x35ea0d){return db[_0x056f('0x31')][_0x056f('0x48')](_0x2f612c[_0x056f('0x2a')],{})[_0x056f('0x25')](respondWithResult(_0x35ea0d,0xc9))[_0x056f('0x3a')](handleError(_0x35ea0d,null));};exports[_0x056f('0x24')]=function(_0x1d36ef,_0x2473c3){if(_0x1d36ef[_0x056f('0x2a')]['id']){delete _0x1d36ef['body']['id'];}return db[_0x056f('0x31')]['find']({'where':{'id':_0x1d36ef[_0x056f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2473c3,null))['then'](saveUpdates(_0x1d36ef[_0x056f('0x2a')],null))['then'](respondWithResult(_0x2473c3,null))[_0x056f('0x3a')](handleError(_0x2473c3,null));};exports[_0x056f('0x26')]=function(_0x41e50b,_0xf8c909){return db[_0x056f('0x31')][_0x056f('0x47')]({'where':{'id':_0x41e50b[_0x056f('0x3c')]['id']}})['then'](handleEntityNotFound(_0xf8c909,null))['then'](removeEntity(_0xf8c909,null))[_0x056f('0x3a')](handleError(_0xf8c909,null));};exports[_0x056f('0x49')]=function(_0x135c8c,_0xa660f6){return db[_0x056f('0x31')][_0x056f('0x49')]()['then'](respondWithResult(_0xa660f6,null))['catch'](handleError(_0xa660f6,null));};exports['createVidaooSession']=function(_0x3f0d69,_0x3a00d7){var _0x406b2e=_0x3f0d69[_0x056f('0x3c')]['id'];var _0x1577eb;var _0x2a58fb;var _0x401aea;return db[_0x056f('0x31')]['findOne']({'where':{'id':_0x406b2e}})[_0x056f('0x25')](function(_0x25f3d8){_0x1577eb=_0x25f3d8;return db[_0x056f('0x4a')][_0x056f('0x4b')]({'where':{'id':_0x25f3d8['ChatWebsiteId']},'attributes':['id',_0x056f('0x4c'),_0x056f('0x4d'),_0x056f('0x4e'),_0x056f('0x4f'),_0x056f('0x50')],'raw':!![]});})[_0x056f('0x25')](function(_0x25a8a3){if(_0x25a8a3&&_0x25a8a3['vidaooApiKey']&&_0x25a8a3['vidaooEscalation']){_0x2a58fb=_0x25a8a3;var _0x13fce2={'interaction':{'id':_0x406b2e},'agent':{'id':_0x3f0d69[_0x056f('0x51')]['id'],'name':_0x3f0d69[_0x056f('0x51')][_0x056f('0x28')],'fullname':_0x3f0d69[_0x056f('0x51')][_0x056f('0x52')],'email':_0x3f0d69[_0x056f('0x51')][_0x056f('0x53')]},'contact':_0x3f0d69[_0x056f('0x2a')][_0x056f('0x2b')],'account':_0x3f0d69[_0x056f('0x2a')][_0x056f('0x2e')]};var _0x2d4a54={'rejectUnauthorized':![],'method':_0x056f('0x54'),'url':_0x056f('0x55'),'headers':{'X-APIKEY':_0x25a8a3[_0x056f('0x4c')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x3f0d69[_0x056f('0x51')][_0x056f('0x53')]],'buttons':null,'topic':_0x2a58fb[_0x056f('0x4e')],'note':_[_0x056f('0x56')](_0x2a58fb[_0x056f('0x4f')])?null:getMustacheRender(_0x2a58fb[_0x056f('0x4f')],_0x13fce2),'metadata':null},'redirect':_0x056f('0x57'),'json':!![]};try{if(!_[_0x056f('0x56')](_0x2a58fb['vidaooMetadata'])){var _0x3d1f23=getMustacheRender(_0x2a58fb[_0x056f('0x50')],_0x13fce2);var _0x22747a=JSON['parse'](_0x3d1f23);_0x2d4a54[_0x056f('0x2a')][_0x056f('0x58')]=_0x22747a;}}catch(_0x41f031){throw new db['Sequelize'][(_0x056f('0x59'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x2d4a54);}else{throw new db['Sequelize'][(_0x056f('0x59'))](_0x056f('0x5a'));}})[_0x056f('0x25')](function(_0xa922ec){_0x401aea=_0xa922ec;if(_0x401aea['id']){var _0x57f9f4={'body':_0x401aea['join_url'],'ChatWebsiteId':_0x2a58fb['id'],'ChatInteractionId':_0x1577eb['id'],'direction':_0x056f('0x5b'),'UserId':_0x3f0d69[_0x056f('0x51')]['id']};return db[_0x056f('0x5c')][_0x056f('0x48')](_0x57f9f4,{});}else{throw new db[(_0x056f('0x5d'))]['ValidationError'](_0x056f('0x5e'));}})[_0x056f('0x25')](function(){return _0x1577eb[_0x056f('0x5f')]({'vidaooSessionId':_0x401aea['id']});})['then'](respondWithResult(_0x3a00d7,null))['catch'](handleError(_0x3a00d7,null));};exports[_0x056f('0x60')]=function(_0x4078d6,_0x66d7c5){if(_0x4078d6[_0x056f('0x2a')]['id']){delete _0x4078d6['body']['id'];}return db[_0x056f('0x31')][_0x056f('0x47')]({'where':{'id':_0x4078d6[_0x056f('0x3c')]['id']},'include':[{'model':db['CmContact'],'as':_0x056f('0x61')}]})[_0x056f('0x25')](handleEntityNotFound(_0x66d7c5,null))['then'](saveUpdates(_0x4078d6[_0x056f('0x2a')],null))[_0x056f('0x25')](respondWithResult(_0x66d7c5,null))['catch'](handleError(_0x66d7c5,null));};exports[_0x056f('0x62')]=function(_0x460efe,_0x2a10dc){if(_0x460efe[_0x056f('0x2a')]['id']){delete _0x460efe[_0x056f('0x2a')]['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x460efe[_0x056f('0x3c')]['id']}})[_0x056f('0x25')](function(_0x3c4375){if(!_0x3c4375){logger['error'](_0x056f('0x63'),_0x056f('0x62'),0x194,_0x056f('0x64'));_0x2a10dc[_0x056f('0x65')](0x194);}else{if(_0x3c4375[_0x056f('0x66')]){throw new db[(_0x056f('0x5d'))]['ValidationError'](_0x056f('0x67'));}}return _0x3c4375;})[_0x056f('0x25')](function(_0x94624e){if(_0x94624e){return _0x94624e[_0x056f('0x24')]({'closed':_0x460efe[_0x056f('0x2a')][_0x056f('0x68')],'disposition':_0x460efe[_0x056f('0x2a')][_0x056f('0x69')]})[_0x056f('0x25')](function(_0x575a71){return _0x575a71;});}})[_0x056f('0x25')](function(){return respondWithRpcPromise(_0x056f('0x6a'),_0x056f('0x62'),_0x460efe[_0x056f('0x2a')],client9004);})[_0x056f('0x25')](respondWithResult(_0x2a10dc,null))[_0x056f('0x3a')](handleError(_0x2a10dc,null));};exports[_0x056f('0x6b')]=function(_0x38fe3d,_0x24e615){_0x38fe3d[_0x056f('0x2a')]['name']=_0x38fe3d[_0x056f('0x6c')][_0x056f('0x6d')];_0x38fe3d[_0x056f('0x2a')][_0x056f('0x6e')]=_0x38fe3d['file'][_0x056f('0x6f')];_0x38fe3d[_0x056f('0x2a')][_0x056f('0x34')]=_0x38fe3d[_0x056f('0x6c')][_0x056f('0x70')];return db['Attachment'][_0x056f('0x48')](_0x38fe3d[_0x056f('0x2a')])[_0x056f('0x25')](respondWithResult(_0x24e615,0xc9))['catch'](handleError(_0x24e615,null));};exports[_0x056f('0x71')]=function(_0x52b1bf,_0x4db8c9){return db[_0x056f('0x31')][_0x056f('0x4b')]({'where':{'id':_0x52b1bf[_0x056f('0x3c')]['id']},'raw':!![]})[_0x056f('0x25')](handleEntityNotFound(_0x4db8c9,null))[_0x056f('0x25')](function(_0x51c231){if(_0x51c231){if(_0x51c231[_0x056f('0x68')]){return _0x4db8c9['status'](0x193)[_0x056f('0x20')]({'status':0x193,'message':_0x056f('0x72')});}return db[_0x056f('0x73')][_0x056f('0x4b')]({'where':{'id':_0x52b1bf[_0x056f('0x39')]['attachId']},'raw':!![]})['then'](handleEntityNotFound(_0x4db8c9,null));}})[_0x056f('0x25')](function(_0x428d14){if(_0x428d14){var _0x51ac9c=_0x428d14[_0x056f('0x74')]!==null;var _0x55a5de=path[_0x056f('0x75')](config[_0x056f('0x76')],_0x056f('0x77'));if(_0x51ac9c){_0x55a5de=path['join'](_0x55a5de,_0x056f('0x78'));}var _0x9c0e6a=path[_0x056f('0x75')](_0x55a5de,_0x428d14[_0x056f('0x6e')]);return _0x4db8c9[_0x056f('0x79')](_0x9c0e6a);}})[_0x056f('0x3a')](handleError(_0x4db8c9,null));};exports[_0x056f('0x7a')]=function(_0x40d0d3,_0x38216e){var _0x2a7969=null;var _0x3c721c=null;var _0x49ddff=null;if(_0x40d0d3[_0x056f('0x2a')]['id']){delete _0x40d0d3[_0x056f('0x2a')]['id'];}if(_0x40d0d3[_0x056f('0x2a')][_0x056f('0x7b')]){_0x49ddff=path['join'](config[_0x056f('0x76')],'server/files/chat/upload/',util['format'](_0x056f('0x7c'),Date[_0x056f('0x7d')]()));_0x40d0d3[_0x056f('0x2a')][_0x056f('0x7e')]=_0x49ddff;}return db[_0x056f('0x31')][_0x056f('0x47')]({'where':{'id':_0x40d0d3[_0x056f('0x3c')]['id']},'include':[{'model':db[_0x056f('0x5c')],'as':_0x056f('0x7f'),'include':[{'model':db['User'],'as':'User'}]}]})[_0x056f('0x25')](handleEntityNotFound(_0x38216e,null))['then'](saveUpdates(_0x40d0d3[_0x056f('0x2a')],null))[_0x056f('0x25')](function(_0x5c3634){if(_0x5c3634){_0x2a7969=_0x5c3634;return db[_0x056f('0x4a')]['find']({'where':{'id':_0x2a7969[_0x056f('0x80')]}});}})['then'](function(_0x57125f){if(_0x57125f){_0x3c721c=_0x57125f;return db[_0x056f('0x81')][_0x056f('0x47')]({'where':{'id':_0x2a7969['ContactId']}});}})[_0x056f('0x25')](function(_0x9b090e){if(_0x9b090e){if(_0x49ddff){var _0x2e2b20=null;for(var _0x521e6f=0x1;_0x521e6f<_0x2a7969[_0x056f('0x7f')][_0x056f('0x43')];++_0x521e6f){_0x2e2b20=_0x2a7969['Messages'][_0x521e6f];var _0x58cca8=_0x2e2b20['UserId']?util[_0x056f('0x82')](_0x056f('0x83'),_0x3c721c[_0x056f('0x84')],_0x2e2b20[_0x056f('0x66')]):_0x056f('0x85');var _0x379eb5=_0x40d0d3[_0x056f('0x2a')]['customer']||util[_0x056f('0x82')](_0x056f('0x83'),'Visitor',_0x2e2b20[_0x056f('0x86')]);switch(_0x3c721c[_0x056f('0x87')]){case _0x056f('0x88'):_0x58cca8=_0x2e2b20[_0x056f('0x66')]?util[_0x056f('0x82')](_0x056f('0x83'),_0x3c721c['agentAlias'],_0x2e2b20[_0x056f('0x66')]):'System';break;case _0x056f('0x89'):_0x58cca8=_0x2e2b20[_0x056f('0x66')]?_0x2e2b20[_0x056f('0x8a')][_0x056f('0x8b')]||_0x2e2b20[_0x056f('0x8a')][_0x056f('0x52')]:_0x056f('0x85');break;case'agent_fullname':_0x58cca8=_0x2e2b20['UserId']?_0x2e2b20[_0x056f('0x8a')][_0x056f('0x52')]:_0x056f('0x85');break;default:_0x58cca8=_0x2e2b20['UserId']?util[_0x056f('0x82')]('%s%d',_0x3c721c['agentAlias'],_0x2e2b20[_0x056f('0x66')]):_0x056f('0x85');}var _0x590ed4=util[_0x056f('0x82')]('[%s]\x20%s:\x20%s\x0a',moment(_0x2e2b20[_0x056f('0x8c')])[_0x056f('0x82')](_0x056f('0x8d')),_0x2e2b20['direction']==='in'?_0x379eb5:_0x58cca8,_0x2e2b20[_0x056f('0x2a')]);if(!_0x2e2b20['secret']){fs[_0x056f('0x8e')](_0x49ddff,_0x590ed4);}}return db[_0x056f('0x8f')][_0x056f('0x4b')]({'where':{'service':!![]},'include':[{'model':db[_0x056f('0x90')],'as':_0x056f('0x91'),'raw':!![],'include':[{'model':db[_0x056f('0x92')],'as':_0x056f('0x92'),'raw':!![]}]}]});}}})[_0x056f('0x25')](function(_0x50f680){if(!_0x50f680||!_0x50f680[_0x056f('0x91')]||!_0x40d0d3[_0x056f('0x2a')])return _0x2a7969;var _0x12b548=_0x50f680[_0x056f('0x93')]();return respondWithRpcPromise(_0x056f('0x94'),_0x056f('0x95'),{'account':_0x12b548,'message':{'from':util['format'](_0x056f('0x96'),_0x50f680[_0x056f('0x28')],_0x50f680[_0x056f('0x53')]||_0x50f680[_0x056f('0x91')]['user']),'to':_0x40d0d3[_0x056f('0x2a')][_0x056f('0x7b')],'subject':_0x056f('0x97'),'text':util['format'](_0x056f('0x98'),_0x40d0d3['body'][_0x056f('0x7b')]),'attachments':[{'path':_0x49ddff}]}})[_0x056f('0x25')](function(){return _0x2a7969;})[_0x056f('0x3a')](function(_0x18cc76){logger['error'](_0x18cc76);});})['then'](respondWithStatusCode(_0x38216e,0xc8))[_0x056f('0x3a')](handleError(_0x38216e,null));};exports[_0x056f('0x99')]=function(_0x4780ce,_0x2d826f){return db[_0x056f('0x5c')]['find']({'where':{'id':_0x4780ce['params']['id']}})[_0x056f('0x25')](handleEntityNotFound(_0x2d826f,null))[_0x056f('0x25')](function(_0x29c66a){if(_0x29c66a){return _0x29c66a[_0x056f('0x99')](_0x4780ce[_0x056f('0x2a')][_0x056f('0x9a')],_[_0x056f('0x9b')](_0x4780ce['body'],[_0x056f('0x9a'),'id'])||{});}})['then'](respondWithResult(_0x2d826f,null))[_0x056f('0x3a')](handleError(_0x2d826f,null));};exports[_0x056f('0x9c')]=function(_0x2de2a3,_0x39b4ff){var _0x503d7c={'raw':![],'where':{}};var _0x26629d={};var _0x5f143a={'count':0x0,'rows':[]};return db[_0x056f('0x31')][_0x056f('0x4b')]({'where':{'id':_0x2de2a3[_0x056f('0x3c')]['id']}})['then'](handleEntityNotFound(_0x39b4ff,null))[_0x056f('0x25')](function(_0x8c3a9f){if(_0x8c3a9f){_0x26629d['model']=_['keys'](db[_0x056f('0x5c')][_0x056f('0x32')]);_0x26629d['query']=_[_0x056f('0x3e')](_0x2de2a3[_0x056f('0x39')]);_0x26629d[_0x056f('0x3f')]=_['intersection'](_0x26629d[_0x056f('0x3d')],_0x26629d[_0x056f('0x39')]);_0x503d7c[_0x056f('0x42')]=_[_0x056f('0x40')](_0x26629d[_0x056f('0x3d')],qs[_0x056f('0x41')](_0x2de2a3['query'][_0x056f('0x41')]));_0x503d7c[_0x056f('0x42')]=_0x503d7c[_0x056f('0x42')]['length']?_0x503d7c['attributes']:_0x26629d[_0x056f('0x3d')];if(!_0x2de2a3[_0x056f('0x39')]['hasOwnProperty']('nolimit')){_0x503d7c[_0x056f('0x22')]=qs[_0x056f('0x22')](_0x2de2a3[_0x056f('0x39')][_0x056f('0x22')]);_0x503d7c[_0x056f('0x21')]=qs[_0x056f('0x21')](_0x2de2a3[_0x056f('0x39')][_0x056f('0x21')]);}_0x503d7c[_0x056f('0x9d')]=qs[_0x056f('0x9e')](_0x2de2a3[_0x056f('0x39')][_0x056f('0x9e')]);_0x503d7c[_0x056f('0x9f')]=qs['filters'](_['pick'](_0x2de2a3['query'],_0x26629d['filters']));_0x503d7c[_0x056f('0x9f')][_0x056f('0xa0')]=_0x8c3a9f['id'];if(_0x2de2a3[_0x056f('0x39')][_0x056f('0xa1')]){_0x503d7c[_0x056f('0x9f')]=_[_0x056f('0x46')](_0x503d7c[_0x056f('0x9f')],{'$or':_[_0x056f('0x30')](_0x503d7c[_0x056f('0x42')],function(_0x3f4110){var _0x5916c3={};_0x5916c3[_0x3f4110]={'$like':'%'+_0x2de2a3['query'][_0x056f('0xa1')]+'%'};return _0x5916c3;})});}if(_0x2de2a3[_0x056f('0x39')][_0x056f('0xa2')]){var _0xee1a5=_0x2de2a3[_0x056f('0x39')][_0x056f('0xa2')]['split'](',');var _0x263129={};_0x263129[_0xee1a5[0x0]]={'$gte':moment(_0xee1a5[0x1])[_0x056f('0x82')](_0x056f('0xa3'))};_0x503d7c[_0x056f('0x9f')]=_[_0x056f('0x46')](_0x503d7c[_0x056f('0x9f')],_0x263129);}_0x503d7c=_[_0x056f('0x46')]({},_0x503d7c,_0x2de2a3['options']);return db['ChatMessage']['count']({'where':_0x503d7c[_0x056f('0x9f')]})[_0x056f('0x25')](function(_0x2dc499){_0x5f143a[_0x056f('0x23')]=_0x2dc499;if(_0x2de2a3[_0x056f('0x39')][_0x056f('0x44')]){_0x503d7c[_0x056f('0x45')]=[{'all':!![]}];}return db[_0x056f('0x5c')][_0x056f('0x37')](_0x503d7c);})[_0x056f('0x25')](function(_0x32c21a){_0x5f143a['rows']=_0x32c21a;return _0x5f143a;});}})[_0x056f('0x25')](respondWithFilteredResult(_0x39b4ff,_0x503d7c))[_0x056f('0x3a')](handleError(_0x39b4ff,null));};exports[_0x056f('0xa4')]=function(_0x169286,_0x5ce4de){var _0x3b96c6={'where':{}},_0x746dd9={},_0x3f6ce7={'count':0x0,'rows':[]};return db[_0x056f('0x31')][_0x056f('0x4b')]({'where':{'id':_0x169286['params']['id']}})[_0x056f('0x25')](handleEntityNotFound(_0x5ce4de,null))[_0x056f('0x25')](function(_0x2da4bc){if(_0x2da4bc){_0x746dd9[_0x056f('0x3d')]=_[_0x056f('0x3e')](db[_0x056f('0x5c')][_0x056f('0x32')]);_0x746dd9[_0x056f('0x39')]=_[_0x056f('0x3e')](_0x169286['query']);_0x746dd9[_0x056f('0x3f')]=_[_0x056f('0x40')](_0x746dd9[_0x056f('0x3d')],_0x746dd9['query']);_0x3b96c6[_0x056f('0x42')]=_[_0x056f('0x40')](_0x746dd9['model'],qs[_0x056f('0x41')](_0x169286[_0x056f('0x39')][_0x056f('0x41')]));_0x3b96c6[_0x056f('0x42')]=_0x3b96c6[_0x056f('0x42')][_0x056f('0x43')]?_0x3b96c6[_0x056f('0x42')]:_0x746dd9[_0x056f('0x3d')];if(!_0x169286[_0x056f('0x39')][_0x056f('0xa5')]('nolimit')){_0x3b96c6[_0x056f('0x22')]=qs['limit'](_0x169286['query'][_0x056f('0x22')]);_0x3b96c6[_0x056f('0x21')]=qs[_0x056f('0x21')](_0x169286['query'][_0x056f('0x21')]);}_0x3b96c6['order']=qs['sort'](_0x169286[_0x056f('0x39')][_0x056f('0x9e')]);_0x3b96c6['where']=qs[_0x056f('0x3f')](_[_0x056f('0xa6')](_0x169286[_0x056f('0x39')],_0x746dd9[_0x056f('0x3f')]));_0x3b96c6[_0x056f('0x9f')]['ChatInteractionId']=_0x2da4bc['id'];if(_0x169286[_0x056f('0x39')][_0x056f('0xa1')]){_0x3b96c6[_0x056f('0x9f')]=_[_0x056f('0x46')](_0x3b96c6[_0x056f('0x9f')],{'$or':_[_0x056f('0x30')](_0x3b96c6[_0x056f('0x42')],function(_0xf3fa8){var _0x387cfa={};_0x387cfa[_0xf3fa8]={'$like':'%'+_0x169286[_0x056f('0x39')][_0x056f('0xa1')]+'%'};return _0x387cfa;})});}_0x3b96c6[_0x056f('0x9f')][_0x056f('0xa7')]=![];if(_0x169286['query']['id']){_0x3b96c6['where']['id']={'$gt':_0x169286[_0x056f('0x39')]['id']};}_0x3b96c6=_['merge']({},_0x3b96c6,_0x169286[_0x056f('0xa8')]);return db['ChatMessage']['count']({'where':_0x3b96c6[_0x056f('0x9f')]})[_0x056f('0x25')](function(_0x2a2f94){_0x3f6ce7[_0x056f('0x23')]=_0x2a2f94;_0x3b96c6[_0x056f('0x45')]=[];if(_0x169286[_0x056f('0x39')][_0x056f('0xa9')]){_0x3b96c6[_0x056f('0x45')][_0x056f('0xaa')]({'model':db[_0x056f('0x8a')],'as':'User','attributes':['id',_0x056f('0x52'),'alias']});}if(_0x169286['query'][_0x056f('0x44')]){_0x3b96c6[_0x056f('0x45')]=[{'all':!![]}];}return db[_0x056f('0x5c')][_0x056f('0x37')](_0x3b96c6);})[_0x056f('0x25')](function(_0x2414c3){_0x3f6ce7[_0x056f('0xab')]=_0x2414c3;return _0x3f6ce7;});}})[_0x056f('0x25')](respondWithFilteredResult(_0x5ce4de,_0x3b96c6))[_0x056f('0x3a')](handleError(_0x5ce4de,null));};exports['addTags']=function(_0x1d9890,_0x1fcc48){return db[_0x056f('0x31')][_0x056f('0x47')]({'where':{'id':_0x1d9890[_0x056f('0x3c')]['id']}})[_0x056f('0x25')](handleEntityNotFound(_0x1fcc48,null))['then'](function(_0x3ce3cf){if(_0x3ce3cf){return _0x3ce3cf[_0x056f('0xac')](_0x1d9890[_0x056f('0x2a')][_0x056f('0x9a')],_[_0x056f('0x9b')](_0x1d9890[_0x056f('0x2a')],[_0x056f('0x9a'),'id'])||{})[_0x056f('0xad')](function(){return db[_0x056f('0xae')]['findAll']({'attributes':['id','name',_0x056f('0xaf')],'where':{'id':_0x1d9890[_0x056f('0x2a')][_0x056f('0x9a')]}});})[_0x056f('0x25')](function(_0x32dd06){socket[_0x056f('0xb0')](_0x056f('0xb1'),{'id':Number(_0x1d9890['params']['id']),'tags':_0x32dd06||[]});return{'id':Number(_0x1d9890['params']['id']),'tags':_0x32dd06||[]};});}})[_0x056f('0x25')](respondWithResult(_0x1fcc48,null))[_0x056f('0x3a')](handleError(_0x1fcc48,null));};exports[_0x056f('0xb2')]=function(_0x37a9df,_0x585bfa){return db['ChatInteraction']['find']({'where':{'id':_0x37a9df['params']['id']}})['then'](handleEntityNotFound(_0x585bfa,null))[_0x056f('0x25')](function(_0x2f2641){if(_0x2f2641){return _0x2f2641[_0x056f('0xb2')](_0x37a9df[_0x056f('0x39')][_0x056f('0x9a')]);}})[_0x056f('0x25')](respondWithStatusCode(_0x585bfa,null))['catch'](handleError(_0x585bfa,null));};exports[_0x056f('0x79')]=function(_0x13b7f0,_0x2f8459){var _0x299918=moment()[_0x056f('0xb3')]()['toString']();var _0x21183b=path[_0x056f('0x75')](config[_0x056f('0x76')],_0x056f('0xb4'),'files','tmp');var _0x172a7d=path[_0x056f('0x75')](config[_0x056f('0x76')],'server','files',_0x056f('0xb5'));var _0x359f18=path[_0x056f('0x75')](_0x21183b,_0x299918);var _0x17502f=util[_0x056f('0x82')](_0x056f('0xb6'),_0x13b7f0[_0x056f('0x3c')]['id'],_0x299918);var _0x5acbe1=path[_0x056f('0x75')](_0x21183b,_0x17502f);var _0x54ac8d=[];_0x54ac8d[_0x056f('0xaa')]({'model':db['User'],'as':_0x056f('0x8a'),'attributes':['id',_0x056f('0x52')],'raw':!![]});_0x54ac8d[_0x056f('0xaa')]({'model':db['CmContact'],'as':_0x056f('0x61'),'attributes':['id',_0x056f('0xb7'),_0x056f('0xb8')],'raw':!![]});if(_0x13b7f0['query'][_0x056f('0xb5')]){_0x54ac8d[_0x056f('0xaa')]({'model':db[_0x056f('0x73')],'as':'Attachment','raw':!![]});}var _0x23b716=[{'model':db[_0x056f('0x5c')],'as':_0x056f('0x7f'),'attributes':['id','body',_0x056f('0x8c'),_0x056f('0xb9'),_0x056f('0xa7'),_0x056f('0xba')],'include':_0x54ac8d}];_0x23b716[_0x056f('0xaa')]({'model':db['ChatWebsite'],'as':'Account','attributes':['id',_0x056f('0x28')]});_0x23b716[_0x056f('0xaa')]({'model':db[_0x056f('0x8a')],'as':_0x056f('0xbb'),'attributes':['id',_0x056f('0x52')]});return db[_0x056f('0x31')][_0x056f('0x47')]({'where':{'id':_0x13b7f0[_0x056f('0x3c')]['id']},'include':_0x23b716})[_0x056f('0x25')](handleEntityNotFound(_0x2f8459,null))[_0x056f('0x25')](function(_0x44a04e){if(_0x44a04e){var _0x164cf1=_0x44a04e['get']({'plain':!![]});fs[_0x056f('0xbc')](_0x359f18);var _0x46e458={'channel':_0x056f('0xbd'),'account':_0x164cf1[_0x056f('0xbe')][_0x056f('0x28')],'agent':_0x164cf1[_0x056f('0xbb')]?_0x164cf1[_0x056f('0xbb')][_0x056f('0x52')]:_0x056f('0xbf'),'createdAt':moment(_0x164cf1[_0x056f('0x8c')])[_0x056f('0x82')]('YYYY-MM-DD\x20HH:mm:ss')[_0x056f('0xc0')](),'closedAt':_0x164cf1[_0x056f('0x68')]?moment(_0x164cf1[_0x056f('0xc1')])[_0x056f('0x82')](_0x056f('0xa3'))[_0x056f('0xc0')]():'','disposition':_0x164cf1[_0x056f('0x69')],'chatInfo':{'browser':_0x164cf1[_0x056f('0xc2')],'os':_0x164cf1[_0x056f('0xc3')],'referer':_0x164cf1[_0x056f('0xc4')],'customerIp':_0x164cf1[_0x056f('0xc5')],'customerPort':_0x164cf1['customerPort']?_0x164cf1[_0x056f('0xc6')]:_0x056f('0xbf')},'messages':_(_0x164cf1[_0x056f('0x7f')])['tail']()[_0x056f('0xa1')]({'secret':![]})[_0x056f('0x30')](function(_0x18c7a9){if(_0x18c7a9[_0x056f('0x73')]){var _0x334ced=path[_0x056f('0x75')](_0x172a7d,_0x18c7a9['Attachment'][_0x056f('0x6e')]);if(fs[_0x056f('0xc7')](_0x334ced)){fs[_0x056f('0xc8')](_0x334ced)[_0x056f('0xc9')](fs[_0x056f('0xca')](path[_0x056f('0x75')](_0x359f18,_0x18c7a9[_0x056f('0x73')][_0x056f('0x6e')])));}}return{'date':moment(_0x18c7a9[_0x056f('0x8c')])[_0x056f('0x82')](_0x056f('0xa3'))[_0x056f('0xc0')](),'sender':_0x18c7a9[_0x056f('0xb9')]==='out'?_0x18c7a9['User']?_0x18c7a9[_0x056f('0x8a')][_0x056f('0x52')]:_0x056f('0x85'):_0x18c7a9[_0x056f('0x61')][_0x056f('0xb7')]+(_0x18c7a9[_0x056f('0x61')][_0x056f('0xb8')]?'\x20'+_0x18c7a9[_0x056f('0x61')][_0x056f('0xb8')]:''),'body':_0x18c7a9[_0x056f('0x73')]?_0x18c7a9[_0x056f('0x73')][_0x056f('0x6e')]:_0x18c7a9[_0x056f('0x2a')],'direction':_0x18c7a9[_0x056f('0xb9')]===_0x056f('0x5b')?'A':'C','secret':_0x18c7a9['secret'],'read':_0x18c7a9[_0x056f('0xba')],'attachment':_0x18c7a9[_0x056f('0x73')]};})[_0x056f('0xcb')]()};return ejs[_0x056f('0xcc')](path[_0x056f('0x75')](config[_0x056f('0x76')],_0x056f('0xb4'),'views',_0x056f('0xcd')),{'interaction':_0x46e458})[_0x056f('0x25')](function(_0x29b62f){var _0x2c684b=path[_0x056f('0x75')](_0x359f18,_0x056f('0xce')+_0x164cf1['id']+'-'+_0x299918+'.pdf');var _0x2700c5={'path':_0x2c684b,'channel':'Chat','interactionId':_0x164cf1['id']};return pdf['createPdfFromHTML'](_0x29b62f,_0x2700c5);})[_0x056f('0x25')](function(){return new Promise(function(_0x31096b,_0x2dfe5a){zipdir(_0x359f18,{'saveTo':_0x5acbe1},function(_0x4c316c,_0x1027a4){if(_0x4c316c)return _0x2dfe5a(_0x4c316c);return _0x31096b(_0x1027a4);});})[_0x056f('0x25')](function(){return new BPromise(function(_0x390230,_0x575680){rimraf(_0x359f18,function(_0x32f7ef){if(_0x32f7ef)_0x575680(_0x32f7ef);return _0x390230();});});})[_0x056f('0x25')](function(){return _0x2f8459['download'](_0x5acbe1,_0x17502f,function(_0x495482){if(_0x495482){logger[_0x056f('0x1b')](_0x056f('0xcf'),_0x495482);}else{fs['unlinkSync'](_0x5acbe1);}});});});}else{return _0x2f8459['sendStatus'](0xc8);}})[_0x056f('0x3a')](handleError(_0x2f8459,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index e627590..77b37e5 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 _0xb6fa=['remove','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','events','../../mysqldb','ChatMessage','update'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0xb6fa,0x11c));var _0xab6f=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0xb6fa[_0x609988];return _0x159984;};'use strict';var EventEmitter=require(_0xab6f('0x0'));var ChatInteraction=require('../../mysqldb')['db']['ChatInteraction'];var ChatMessage=require(_0xab6f('0x1'))['db'][_0xab6f('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xab6f('0x3'),'afterDestroy':_0xab6f('0x4')};function emitEvent(_0x461f1){return function(_0x278eb1,_0x2e75ac,_0x17abcd){_0x278eb1['getUsers']({'attributes':['id'],'raw':!![]})[_0xab6f('0x5')](function(_0x786ad5){_0x278eb1[_0xab6f('0x6')](_0xab6f('0x7'),_0x786ad5[_0xab6f('0x8')](function(_0x135bb1){return{'id':_0x135bb1['id']};}));return ChatMessage[_0xab6f('0x9')]({'where':{'ChatInteractionId':_0x278eb1['id'],'direction':'in','read':![]},'raw':!![]});})[_0xab6f('0x5')](function(_0x36effe){_0x278eb1['setDataValue'](_0xab6f('0xa'),_0x36effe[_0xab6f('0xb')]);ChatInteractionEvents['emit'](_0x461f1+':'+_0x278eb1['id'],_0x278eb1);ChatInteractionEvents[_0xab6f('0xc')](_0x461f1,_0x278eb1);_0x17abcd(null);})[_0xab6f('0xd')](_0x17abcd(null));};}for(var e in events){if(events[_0xab6f('0xe')](e)){var event=events[e];ChatInteraction[_0xab6f('0xf')](e,emitEvent(event));}}module['exports']=ChatInteractionEvents; \ No newline at end of file +var _0xf8b1=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','ChatMessage','update','remove','getUsers','setDataValue','unreadMessages','length','catch'];(function(_0x3efeee,_0xc23a72){var _0x440224=function(_0x458066){while(--_0x458066){_0x3efeee['push'](_0x3efeee['shift']());}};_0x440224(++_0xc23a72);}(_0xf8b1,0xd5));var _0x1f8b=function(_0x53a36c,_0x406b76){_0x53a36c=_0x53a36c-0x0;var _0x461476=_0xf8b1[_0x53a36c];return _0x461476;};'use strict';var EventEmitter=require(_0x1f8b('0x0'));var ChatInteraction=require(_0x1f8b('0x1'))['db'][_0x1f8b('0x2')];var ChatMessage=require(_0x1f8b('0x1'))['db'][_0x1f8b('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1f8b('0x4'),'afterDestroy':_0x1f8b('0x5')};function emitEvent(_0x3ebe17){return function(_0x14f1bf,_0x4363ab,_0x35aab){_0x14f1bf[_0x1f8b('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1fc183){_0x14f1bf[_0x1f8b('0x7')]('Users',_0x1fc183['map'](function(_0x32bc53){return{'id':_0x32bc53['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x14f1bf['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x46abd1){_0x14f1bf[_0x1f8b('0x7')](_0x1f8b('0x8'),_0x46abd1[_0x1f8b('0x9')]);ChatInteractionEvents['emit'](_0x3ebe17+':'+_0x14f1bf['id'],_0x14f1bf);ChatInteractionEvents['emit'](_0x3ebe17,_0x14f1bf);_0x35aab(null);})[_0x1f8b('0xa')](_0x35aab(null));};}for(var e in events){if(events[_0x1f8b('0xb')](e)){var event=events[e];ChatInteraction[_0x1f8b('0xc')](e,emitEvent(event));}}module[_0x1f8b('0xd')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index f15160c..1d41ce8 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 _0xb221=['rimraf','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb221,0x6b));var _0x1b22=function(_0x2272d7,_0x694f20){_0x2272d7=_0x2272d7-0x0;var _0x42697c=_0xb221[_0x2272d7];return _0x42697c;};'use strict';var _=require(_0x1b22('0x0'));var util=require('util');var logger=require(_0x1b22('0x1'))(_0x1b22('0x2'));var moment=require(_0x1b22('0x3'));var BPromise=require(_0x1b22('0x4'));var rp=require(_0x1b22('0x5'));var fs=require('fs');var path=require(_0x1b22('0x6'));var rimraf=require(_0x1b22('0x7'));var config=require(_0x1b22('0x8'));var attributes=require(_0x1b22('0x9'));module[_0x1b22('0xa')]=function(_0x244daa,_0x35953b){return _0x244daa[_0x1b22('0xb')](_0x1b22('0xc'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1925a1,_0x3b003f,_0x58ff0b){if(_0x1925a1[_0x1b22('0xd')](_0x1b22('0xe'))){_0x1925a1[_0x1b22('0xf')]=moment()['format'](_0x1b22('0x10'));}_0x58ff0b(null,_0x1925a1);}},'charset':_0x1b22('0x11'),'collate':_0x1b22('0x12')});}; \ No newline at end of file +var _0x228a=['api','bluebird','request-promise','path','../../config/environment','./chatInteraction.attributes','exports','define','ChatInteraction','chat_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger'];(function(_0x5471ec,_0x1ce81a){var _0x121d4c=function(_0xefb655){while(--_0xefb655){_0x5471ec['push'](_0x5471ec['shift']());}};_0x121d4c(++_0x1ce81a);}(_0x228a,0x1d0));var _0xa228=function(_0x1295a2,_0x2ebafe){_0x1295a2=_0x1295a2-0x0;var _0x48124b=_0x228a[_0x1295a2];return _0x48124b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa228('0x0'))(_0xa228('0x1'));var moment=require('moment');var BPromise=require(_0xa228('0x2'));var rp=require(_0xa228('0x3'));var fs=require('fs');var path=require(_0xa228('0x4'));var rimraf=require('rimraf');var config=require(_0xa228('0x5'));var attributes=require(_0xa228('0x6'));module[_0xa228('0x7')]=function(_0x53bcf8,_0x3faaaa){return _0x53bcf8[_0xa228('0x8')](_0xa228('0x9'),attributes,{'tableName':_0xa228('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x410ba6,_0x115827,_0x41336c){if(_0x410ba6[_0xa228('0xb')](_0xa228('0xc'))){_0x410ba6['closedAt']=moment()[_0xa228('0xd')](_0xa228('0xe'));}_0x41336c(null,_0x410ba6);}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 96afa1f..0e53562 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 _0x89f0=['result','catch','UpdateChatInteraction','update','body','options','where','then','AddTagsToChatInteraction','ChatInteraction','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','register','request','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInteraction,\x20%s,\x20%s','message'];(function(_0x387583,_0x127b08){var _0x45d2f9=function(_0x1d82ac){while(--_0x1d82ac){_0x387583['push'](_0x387583['shift']());}};_0x45d2f9(++_0x127b08);}(_0x89f0,0xf8));var _0x089f=function(_0x572eb2,_0x12f42d){_0x572eb2=_0x572eb2-0x0;var _0x3de9b0=_0x89f0[_0x572eb2];return _0x3de9b0;};'use strict';var _=require(_0x089f('0x0'));var util=require('util');var moment=require(_0x089f('0x1'));var BPromise=require(_0x089f('0x2'));var rs=require(_0x089f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x089f('0x4'))['db'];var utils=require(_0x089f('0x5'));var logger=require(_0x089f('0x6'))(_0x089f('0x7'));var config=require('../../config/environment');var jayson=require(_0x089f('0x8'));var client=jayson['client'][_0x089f('0x9')]({'port':0x232a});config['redis']=_[_0x089f('0xa')](config[_0x089f('0xb')],{'host':_0x089f('0xc'),'port':0x18eb});var socket=require(_0x089f('0xd'))(new Redis(config[_0x089f('0xb')]));require('./chatInteraction.socket')[_0x089f('0xe')](socket);function respondWithRpcPromise(_0xa89bca,_0x534c26,_0x17f219){return new BPromise(function(_0x29a416,_0x448917){return client[_0x089f('0xf')](_0xa89bca,_0x17f219)['then'](function(_0x1fa6fd){logger[_0x089f('0x10')]('ChatInteraction,\x20%s,\x20%s',_0x534c26,_0x089f('0x11'));logger[_0x089f('0x12')](_0x089f('0x13'),_0x534c26,_0x089f('0x11'),JSON[_0x089f('0x14')](_0x1fa6fd));if(_0x1fa6fd[_0x089f('0x15')]){if(_0x1fa6fd[_0x089f('0x15')][_0x089f('0x16')]===0x1f4){logger[_0x089f('0x15')](_0x089f('0x17'),_0x534c26,_0x1fa6fd[_0x089f('0x15')][_0x089f('0x18')]);return _0x448917(_0x1fa6fd[_0x089f('0x15')][_0x089f('0x18')]);}logger[_0x089f('0x15')](_0x089f('0x17'),_0x534c26,_0x1fa6fd[_0x089f('0x15')][_0x089f('0x18')]);return _0x29a416(_0x1fa6fd[_0x089f('0x15')][_0x089f('0x18')]);}else{logger[_0x089f('0x10')](_0x089f('0x17'),_0x534c26,_0x089f('0x11'));_0x29a416(_0x1fa6fd[_0x089f('0x19')]['message']);}})[_0x089f('0x1a')](function(_0x5793c5){logger[_0x089f('0x15')](_0x089f('0x17'),_0x534c26,_0x5793c5);_0x448917(_0x5793c5);});});}exports[_0x089f('0x1b')]=function(_0x89ca37){var _0x22b676=this;return new Promise(function(_0x4b9af1,_0x4e40c4){return db['ChatInteraction'][_0x089f('0x1c')](_0x89ca37[_0x089f('0x1d')],{'raw':_0x89ca37['options']?_0x89ca37[_0x089f('0x1e')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x89ca37[_0x089f('0x1e')]?_0x89ca37[_0x089f('0x1e')][_0x089f('0x1f')]||null:null,'attributes':_0x89ca37[_0x089f('0x1e')]?_0x89ca37['options']['attributes']||null:null,'limit':_0x89ca37[_0x089f('0x1e')]?_0x89ca37[_0x089f('0x1e')]['limit']||null:null})[_0x089f('0x20')](function(_0x53f13a){logger['info'](_0x089f('0x1b'),_0x89ca37);logger[_0x089f('0x12')]('UpdateChatInteraction',_0x89ca37,JSON[_0x089f('0x14')](_0x53f13a));_0x4b9af1(_0x53f13a);})['catch'](function(_0x34b8b7){logger['error'](_0x089f('0x1b'),_0x34b8b7[_0x089f('0x18')],_0x89ca37);_0x4e40c4(_0x22b676[_0x089f('0x15')](0x1f4,_0x34b8b7[_0x089f('0x18')]));});});};exports[_0x089f('0x21')]=function(_0x5a0f58){return new Promise(function(_0x40282c,_0x4cca31){return db[_0x089f('0x22')]['find']({'where':_0x5a0f58[_0x089f('0x1e')]?_0x5a0f58[_0x089f('0x1e')][_0x089f('0x1f')]||null:null})[_0x089f('0x20')](function(_0xc633cb){if(_0xc633cb){return _0xc633cb['addTags'](_0x5a0f58['body'][_0x089f('0x23')],_[_0x089f('0x24')](_0x5a0f58['body'],[_0x089f('0x23'),'id'])||{});}})[_0x089f('0x25')](function(_0x48ad1b){logger[_0x089f('0x10')](_0x089f('0x26'),_0x5a0f58);logger['debug']('AddTags',_0x5a0f58,JSON['stringify'](_0x48ad1b));_0x40282c(_0x48ad1b);})[_0x089f('0x1a')](function(_0x330653){logger['error'](_0x089f('0x26'),_0x330653[_0x089f('0x18')],_0x5a0f58);_0x4cca31(_this['error'](0x1f4,_0x330653[_0x089f('0x18')]));});});}; \ No newline at end of file +var _0xc653=['find','addTags','ids','AddTags','lodash','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','attributes','limit','debug','AddTagsToChatInteraction'];(function(_0x23bd35,_0x412e54){var _0x572010=function(_0x51c935){while(--_0x51c935){_0x23bd35['push'](_0x23bd35['shift']());}};_0x572010(++_0x412e54);}(_0xc653,0x144));var _0x3c65=function(_0x42be10,_0x44767f){_0x42be10=_0x42be10-0x0;var _0x4322ce=_0xc653[_0x42be10];return _0x4322ce;};'use strict';var _=require(_0x3c65('0x0'));var util=require(_0x3c65('0x1'));var moment=require(_0x3c65('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c65('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3c65('0x4'))(_0x3c65('0x5'));var config=require(_0x3c65('0x6'));var jayson=require(_0x3c65('0x7'));var client=jayson['client'][_0x3c65('0x8')]({'port':0x232a});config['redis']=_[_0x3c65('0x9')](config[_0x3c65('0xa')],{'host':_0x3c65('0xb'),'port':0x18eb});var socket=require(_0x3c65('0xc'))(new Redis(config[_0x3c65('0xa')]));require(_0x3c65('0xd'))[_0x3c65('0xe')](socket);function respondWithRpcPromise(_0x4b40ad,_0x4de28d,_0x3752e3){return new BPromise(function(_0x3bcf55,_0x3f6dc4){return client[_0x3c65('0xf')](_0x4b40ad,_0x3752e3)[_0x3c65('0x10')](function(_0x505c32){logger[_0x3c65('0x11')](_0x3c65('0x12'),_0x4de28d,'request\x20sent');logger['debug'](_0x3c65('0x13'),_0x4de28d,_0x3c65('0x14'),JSON[_0x3c65('0x15')](_0x505c32));if(_0x505c32['error']){if(_0x505c32[_0x3c65('0x16')]['code']===0x1f4){logger[_0x3c65('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x4de28d,_0x505c32[_0x3c65('0x16')][_0x3c65('0x17')]);return _0x3f6dc4(_0x505c32[_0x3c65('0x16')][_0x3c65('0x17')]);}logger['error'](_0x3c65('0x12'),_0x4de28d,_0x505c32[_0x3c65('0x16')]['message']);return _0x3bcf55(_0x505c32['error'][_0x3c65('0x17')]);}else{logger[_0x3c65('0x11')](_0x3c65('0x12'),_0x4de28d,_0x3c65('0x14'));_0x3bcf55(_0x505c32['result'][_0x3c65('0x17')]);}})[_0x3c65('0x18')](function(_0x54b32f){logger[_0x3c65('0x16')](_0x3c65('0x12'),_0x4de28d,_0x54b32f);_0x3f6dc4(_0x54b32f);});});}exports[_0x3c65('0x19')]=function(_0x313eed){var _0x5b7fe9=this;return new Promise(function(_0x543638,_0x297744){return db[_0x3c65('0x1a')][_0x3c65('0x1b')](_0x313eed[_0x3c65('0x1c')],{'raw':_0x313eed[_0x3c65('0x1d')]?_0x313eed[_0x3c65('0x1d')][_0x3c65('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x313eed[_0x3c65('0x1d')]?_0x313eed[_0x3c65('0x1d')][_0x3c65('0x1f')]||null:null,'attributes':_0x313eed[_0x3c65('0x1d')]?_0x313eed[_0x3c65('0x1d')][_0x3c65('0x20')]||null:null,'limit':_0x313eed[_0x3c65('0x1d')]?_0x313eed[_0x3c65('0x1d')][_0x3c65('0x21')]||null:null})[_0x3c65('0x10')](function(_0x173cc7){logger[_0x3c65('0x11')](_0x3c65('0x19'),_0x313eed);logger[_0x3c65('0x22')](_0x3c65('0x19'),_0x313eed,JSON[_0x3c65('0x15')](_0x173cc7));_0x543638(_0x173cc7);})[_0x3c65('0x18')](function(_0x4cf1d4){logger[_0x3c65('0x16')]('UpdateChatInteraction',_0x4cf1d4[_0x3c65('0x17')],_0x313eed);_0x297744(_0x5b7fe9[_0x3c65('0x16')](0x1f4,_0x4cf1d4[_0x3c65('0x17')]));});});};exports[_0x3c65('0x23')]=function(_0x97fffc){return new Promise(function(_0x8c03ba,_0x248853){return db[_0x3c65('0x1a')][_0x3c65('0x24')]({'where':_0x97fffc[_0x3c65('0x1d')]?_0x97fffc[_0x3c65('0x1d')][_0x3c65('0x1f')]||null:null})[_0x3c65('0x10')](function(_0x2b073e){if(_0x2b073e){return _0x2b073e[_0x3c65('0x25')](_0x97fffc[_0x3c65('0x1c')][_0x3c65('0x26')],_['omit'](_0x97fffc[_0x3c65('0x1c')],[_0x3c65('0x26'),'id'])||{});}})['spread'](function(_0x3a9ab1){logger[_0x3c65('0x11')](_0x3c65('0x27'),_0x97fffc);logger[_0x3c65('0x22')](_0x3c65('0x27'),_0x97fffc,JSON[_0x3c65('0x15')](_0x3a9ab1));_0x8c03ba(_0x3a9ab1);})[_0x3c65('0x18')](function(_0xa35b90){logger[_0x3c65('0x16')](_0x3c65('0x27'),_0xa35b90[_0x3c65('0x17')],_0x97fffc);_0x248853(_this[_0x3c65('0x16')](0x1f4,_0xa35b90[_0x3c65('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 4c74f4e..b5935bc 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 _0x078c=['register','length','./chatInteraction.events','remove','update','emit','removeListener'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x078c,0x19f));var _0xc078=function(_0x326e79,_0x33dc91){_0x326e79=_0x326e79-0x0;var _0x37eb89=_0x078c[_0x326e79];return _0x37eb89;};'use strict';var ChatInteractionEvents=require(_0xc078('0x0'));var events=['save',_0xc078('0x1'),_0xc078('0x2')];function createListener(_0x503bd4,_0x82572){return function(_0x107624){_0x82572[_0xc078('0x3')](_0x503bd4,_0x107624);};}function removeListener(_0x217004,_0x56bf2e){return function(){ChatInteractionEvents[_0xc078('0x4')](_0x217004,_0x56bf2e);};}exports[_0xc078('0x5')]=function(_0x394068){for(var _0x24b241=0x0,_0x40e428=events[_0xc078('0x6')];_0x24b241<_0x40e428;_0x24b241++){var _0x22661e=events[_0x24b241];var _0x4030b1=createListener('chatInteraction:'+_0x22661e,_0x394068);ChatInteractionEvents['on'](_0x22661e,_0x4030b1);}}; \ No newline at end of file +var _0x422c=['removeListener','register','length','chatInteraction:','./chatInteraction.events','save','emit'];(function(_0x23d2a6,_0x2ca613){var _0x2beae9=function(_0x292e9a){while(--_0x292e9a){_0x23d2a6['push'](_0x23d2a6['shift']());}};_0x2beae9(++_0x2ca613);}(_0x422c,0x1ee));var _0xc422=function(_0x5bbcbe,_0x43078b){_0x5bbcbe=_0x5bbcbe-0x0;var _0xb77120=_0x422c[_0x5bbcbe];return _0xb77120;};'use strict';var ChatInteractionEvents=require(_0xc422('0x0'));var events=[_0xc422('0x1'),'remove','update'];function createListener(_0x55cdad,_0x2d88b5){return function(_0x2fb911){_0x2d88b5[_0xc422('0x2')](_0x55cdad,_0x2fb911);};}function removeListener(_0x588269,_0xf914c0){return function(){ChatInteractionEvents[_0xc422('0x3')](_0x588269,_0xf914c0);};}exports[_0xc422('0x4')]=function(_0x54ffc3){for(var _0x53757f=0x0,_0x564f0c=events[_0xc422('0x5')];_0x53757f<_0x564f0c;_0x53757f++){var _0x26a298=events[_0x53757f];var _0x43a2e1=createListener(_0xc422('0x6')+_0x26a298,_0x54ffc3);ChatInteractionEvents['on'](_0x26a298,_0x43a2e1);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 68767cf..39c0d96 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 _0xccf4=['format','%s-%s','originalname','file','attachmentUpload','/:id/messages','addMessage','/:id/tags','tracked','chat','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','chatinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./chatInteraction.controller','isAuthenticated','index','get','/describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','diskStorage','root'];(function(_0x20fbb6,_0x22f7d2){var _0x262e17=function(_0x1b4822){while(--_0x1b4822){_0x20fbb6['push'](_0x20fbb6['shift']());}};_0x262e17(++_0x22f7d2);}(_0xccf4,0x9f));var _0x4ccf=function(_0x592adc,_0x3bbb34){_0x592adc=_0x592adc-0x0;var _0x3609dc=_0xccf4[_0x592adc];return _0x3609dc;};'use strict';var multer=require(_0x4ccf('0x0'));var util=require(_0x4ccf('0x1'));var path=require(_0x4ccf('0x2'));var timeout=require(_0x4ccf('0x3'));var express=require('express');var router=express[_0x4ccf('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4ccf('0x5'));var config=require(_0x4ccf('0x6'));var controller=require(_0x4ccf('0x7'));router['get']('/',auth[_0x4ccf('0x8')](),controller[_0x4ccf('0x9')]);router[_0x4ccf('0xa')](_0x4ccf('0xb'),auth[_0x4ccf('0x8')](),controller['describe']);router['get'](_0x4ccf('0xc'),auth[_0x4ccf('0xd')](),controller['show']);router[_0x4ccf('0xa')](_0x4ccf('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x4ccf('0xf')]);router['get']('/:id/messages',auth[_0x4ccf('0x8')](),controller[_0x4ccf('0x10')]);router[_0x4ccf('0xa')](_0x4ccf('0x11'),auth['isChatInteractionAuthorized'](),controller[_0x4ccf('0x12')]);router[_0x4ccf('0xa')](_0x4ccf('0x13'),auth[_0x4ccf('0x8')](),controller[_0x4ccf('0x14')]);router[_0x4ccf('0x15')]('/',auth[_0x4ccf('0x8')](),controller[_0x4ccf('0x16')]);router[_0x4ccf('0x15')]('/:id/vidaoo',auth[_0x4ccf('0x8')](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0x4ccf('0x17')]({'destination':function(_0x4fec6c,_0x2abb56,_0x24562d){_0x24562d(null,path['join'](config[_0x4ccf('0x18')],'server/files/attachments/'));},'filename':function(_0xbf9c9a,_0x103ea0,_0x6c4596){_0x6c4596(null,util[_0x4ccf('0x19')](_0x4ccf('0x1a'),Date['now'](),_0x103ea0[_0x4ccf('0x1b')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router['post']('/:id/attachment_upload',upload['single'](_0x4ccf('0x1c')),controller[_0x4ccf('0x1d')]);router[_0x4ccf('0x15')](_0x4ccf('0x1e'),auth[_0x4ccf('0xd')](),controller[_0x4ccf('0x1f')]);router['post'](_0x4ccf('0x20'),auth[_0x4ccf('0x8')](),interaction[_0x4ccf('0x21')](_0x4ccf('0x22'),'chatinteraction:addtags'),controller[_0x4ccf('0x23')]);router[_0x4ccf('0x24')](_0x4ccf('0xc'),auth[_0x4ccf('0x8')](),interaction[_0x4ccf('0x21')](_0x4ccf('0x22'),_0x4ccf('0x25')),controller['update']);router['put'](_0x4ccf('0x26'),controller[_0x4ccf('0x27')]);router[_0x4ccf('0x24')](_0x4ccf('0x28'),auth[_0x4ccf('0xd')](),controller[_0x4ccf('0x29')]);router[_0x4ccf('0x24')](_0x4ccf('0x2a'),controller['close']);router['delete']('/:id',auth[_0x4ccf('0x8')](),interaction[_0x4ccf('0x21')]('chat',_0x4ccf('0x2b')),controller[_0x4ccf('0x2c')]);router['delete'](_0x4ccf('0x20'),auth[_0x4ccf('0x8')](),controller[_0x4ccf('0x2d')]);module['exports']=router; \ No newline at end of file +var _0xdece=['/:id/attachment_upload','file','attachmentUpload','/:id/tags','tracked','chatinteraction:addtags','addTags','/:id','chat','chatinteraction:update','update','put','/:id/custom_update','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','/:id/my_messages','download','post','create','/:id/vidaoo','diskStorage','join','root','server/files/attachments/','format','%s-%s','now'];(function(_0x194684,_0x23859b){var _0x508fd6=function(_0x2a6a56){while(--_0x2a6a56){_0x194684['push'](_0x194684['shift']());}};_0x508fd6(++_0x23859b);}(_0xdece,0x1c6));var _0xedec=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xdece[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xedec('0x0'));var util=require(_0xedec('0x1'));var path=require(_0xedec('0x2'));var timeout=require(_0xedec('0x3'));var express=require(_0xedec('0x4'));var router=express[_0xedec('0x5')]();var fs_extra=require(_0xedec('0x6'));var auth=require(_0xedec('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xedec('0x8'));var controller=require(_0xedec('0x9'));router[_0xedec('0xa')]('/',auth[_0xedec('0xb')](),controller[_0xedec('0xc')]);router[_0xedec('0xa')](_0xedec('0xd'),auth[_0xedec('0xb')](),controller[_0xedec('0xe')]);router[_0xedec('0xa')]('/:id',auth[_0xedec('0xf')](),controller[_0xedec('0x10')]);router[_0xedec('0xa')](_0xedec('0x11'),auth[_0xedec('0xf')](),controller[_0xedec('0x12')]);router[_0xedec('0xa')](_0xedec('0x13'),auth[_0xedec('0xb')](),controller['getMessages']);router[_0xedec('0xa')](_0xedec('0x14'),auth[_0xedec('0xf')](),controller['getMyMessages']);router[_0xedec('0xa')]('/:id/download',auth[_0xedec('0xb')](),controller[_0xedec('0x15')]);router[_0xedec('0x16')]('/',auth[_0xedec('0xb')](),controller[_0xedec('0x17')]);router[_0xedec('0x16')](_0xedec('0x18'),auth['isAuthenticated'](),controller['createVidaooSession']);var upload=multer({'storage':multer[_0xedec('0x19')]({'destination':function(_0x3cdab7,_0x3946a5,_0x34d310){_0x34d310(null,path[_0xedec('0x1a')](config[_0xedec('0x1b')],_0xedec('0x1c')));},'filename':function(_0x329a06,_0x436234,_0x5dbedd){_0x5dbedd(null,util[_0xedec('0x1d')](_0xedec('0x1e'),Date[_0xedec('0x1f')](),_0x436234['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xedec('0x16')](_0xedec('0x20'),upload['single'](_0xedec('0x21')),controller[_0xedec('0x22')]);router['post'](_0xedec('0x13'),auth['isChatInteractionAuthorized'](),controller['addMessage']);router[_0xedec('0x16')](_0xedec('0x23'),auth['isAuthenticated'](),interaction[_0xedec('0x24')]('chat',_0xedec('0x25')),controller[_0xedec('0x26')]);router['put'](_0xedec('0x27'),auth['isAuthenticated'](),interaction[_0xedec('0x24')](_0xedec('0x28'),_0xedec('0x29')),controller[_0xedec('0x2a')]);router[_0xedec('0x2b')](_0xedec('0x2c'),controller['customUpdate']);router['put'](_0xedec('0x2d'),auth['isChatInteractionAuthorized'](),controller[_0xedec('0x2e')]);router[_0xedec('0x2b')](_0xedec('0x2f'),controller[_0xedec('0x30')]);router[_0xedec('0x31')](_0xedec('0x27'),auth[_0xedec('0xb')](),interaction[_0xedec('0x24')](_0xedec('0x28'),_0xedec('0x32')),controller[_0xedec('0x33')]);router[_0xedec('0x31')](_0xedec('0x23'),auth[_0xedec('0xb')](),controller[_0xedec('0x34')]);module[_0xedec('0x35')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 8853b37..06513ea 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 _0x4312=['BOOLEAN','sequelize','medium'];(function(_0x5d375e,_0x13066f){var _0x564ce4=function(_0x1a8c20){while(--_0x1a8c20){_0x5d375e['push'](_0x5d375e['shift']());}};_0x564ce4(++_0x13066f);}(_0x4312,0xdc));var _0x2431=function(_0x55e631,_0x4e9bdb){_0x55e631=_0x55e631-0x0;var _0x1a0670=_0x4312[_0x55e631];return _0x1a0670;};'use strict';var Sequelize=require(_0x2431('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x2431('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x2431('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x46f6=['BOOLEAN','sequelize','exports','medium'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x46f6,0x1ad));var _0x646f=function(_0x37332e,_0x5f4812){_0x37332e=_0x37332e-0x0;var _0x5958e5=_0x46f6[_0x37332e];return _0x5958e5;};'use strict';var Sequelize=require(_0x646f('0x0'));module[_0x646f('0x1')]={'body':{'type':Sequelize['TEXT'](_0x646f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x646f('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index 8b65625..0501787 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 _0xe3c7=['error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','key','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','params','options','find','catch','create','body','describe','messages','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','findAll','admin','role','userpic','internal','online','-online','VoiceQueue','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Agents','userProfileId','UserProfileResource','agent','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./chatInternalMessage.socket','register','sendStatus','end','status','json','limit','undefined','count','offset','set','Content-Range','apply','update','then','destroy'];(function(_0x5dcb2f,_0x402ca3){var _0x2cf625=function(_0x3792e4){while(--_0x3792e4){_0x5dcb2f['push'](_0x5dcb2f['shift']());}};_0x2cf625(++_0x402ca3);}(_0xe3c7,0x114));var _0x7e3c=function(_0xe3e0af,_0x4564ed){_0xe3e0af=_0xe3e0af-0x0;var _0x4828e9=_0xe3c7[_0xe3e0af];return _0x4828e9;};'use strict';var emlformat=require(_0x7e3c('0x0'));var rimraf=require(_0x7e3c('0x1'));var zipdir=require(_0x7e3c('0x2'));var jsonpatch=require(_0x7e3c('0x3'));var rp=require(_0x7e3c('0x4'));var moment=require(_0x7e3c('0x5'));var BPromise=require(_0x7e3c('0x6'));var Mustache=require(_0x7e3c('0x7'));var util=require('util');var path=require(_0x7e3c('0x8'));var sox=require(_0x7e3c('0x9'));var csv=require(_0x7e3c('0xa'));var ejs=require(_0x7e3c('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7e3c('0xc'));var squel=require(_0x7e3c('0xd'));var crypto=require(_0x7e3c('0xe'));var jsforce=require(_0x7e3c('0xf'));var deskjs=require(_0x7e3c('0x10'));var toCsv=require('to-csv');var querystring=require(_0x7e3c('0x11'));var Papa=require(_0x7e3c('0x12'));var Redis=require('ioredis');var authService=require(_0x7e3c('0x13'));var qs=require(_0x7e3c('0x14'));var as=require(_0x7e3c('0x15'));var hardwareService=require(_0x7e3c('0x16'));var logger=require('../../config/logger')(_0x7e3c('0x17'));var utils=require(_0x7e3c('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x7e3c('0x19'))['db'];config[_0x7e3c('0x1a')]=_[_0x7e3c('0x1b')](config[_0x7e3c('0x1a')],{'host':_0x7e3c('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7e3c('0x1a')]));require(_0x7e3c('0x1d'))[_0x7e3c('0x1e')](socket);function respondWithStatusCode(_0x1a5cfd,_0xc83531){_0xc83531=_0xc83531||0xcc;return function(_0x2cf281){if(_0x2cf281){return _0x1a5cfd[_0x7e3c('0x1f')](_0xc83531);}return _0x1a5cfd['status'](_0xc83531)[_0x7e3c('0x20')]();};}function respondWithResult(_0x6d3eb0,_0x2917f4){_0x2917f4=_0x2917f4||0xc8;return function(_0x22211f){if(_0x22211f){return _0x6d3eb0[_0x7e3c('0x21')](_0x2917f4)[_0x7e3c('0x22')](_0x22211f);}};}function respondWithFilteredResult(_0x4437cf,_0x3dcb9b){return function(_0x5119cc){if(_0x5119cc){var _0x32c974=typeof _0x3dcb9b['offset']==='undefined'&&typeof _0x3dcb9b[_0x7e3c('0x23')]===_0x7e3c('0x24');var _0x37d951=_0x5119cc[_0x7e3c('0x25')];var _0x4f2abc=_0x32c974?0x0:_0x3dcb9b[_0x7e3c('0x26')];var _0x704525=_0x32c974?_0x5119cc[_0x7e3c('0x25')]:_0x3dcb9b['offset']+_0x3dcb9b[_0x7e3c('0x23')];var _0x298c86;if(_0x704525>=_0x37d951){_0x704525=_0x37d951;_0x298c86=0xc8;}else{_0x298c86=0xce;}_0x4437cf[_0x7e3c('0x21')](_0x298c86);return _0x4437cf[_0x7e3c('0x27')](_0x7e3c('0x28'),_0x4f2abc+'-'+_0x704525+'/'+_0x37d951)[_0x7e3c('0x22')](_0x5119cc);}return null;};}function patchUpdates(_0x1c7086){return function(_0x317547){try{jsonpatch[_0x7e3c('0x29')](_0x317547,_0x1c7086,!![]);}catch(_0x1e03e1){return BPromise['reject'](_0x1e03e1);}return _0x317547['save']();};}function saveUpdates(_0x153e66,_0x1b00e1){return function(_0x4aa8d9){if(_0x4aa8d9){return _0x4aa8d9[_0x7e3c('0x2a')](_0x153e66)[_0x7e3c('0x2b')](function(_0x29cd37){return _0x29cd37;});}return null;};}function removeEntity(_0x1be945,_0x47b1f8){return function(_0x3208bc){if(_0x3208bc){return _0x3208bc[_0x7e3c('0x2c')]()[_0x7e3c('0x2b')](function(){_0x1be945[_0x7e3c('0x21')](0xcc)[_0x7e3c('0x20')]();});}};}function handleEntityNotFound(_0x3fed03,_0x24f798){return function(_0x47ca01){if(!_0x47ca01){_0x3fed03[_0x7e3c('0x1f')](0x194);}return _0x47ca01;};}function handleError(_0x363adb,_0x2d0105){_0x2d0105=_0x2d0105||0x1f4;return function(_0x5d4543){logger[_0x7e3c('0x2d')](_0x5d4543[_0x7e3c('0x2e')]);if(_0x5d4543[_0x7e3c('0x2f')]){delete _0x5d4543[_0x7e3c('0x2f')];}_0x363adb[_0x7e3c('0x21')](_0x2d0105)['send'](_0x5d4543);};}exports[_0x7e3c('0x30')]=function(_0x401f60,_0x2e83e7){var _0x20c0be={},_0x36f407={},_0x3e42b2={'count':0x0,'rows':[]};var _0x1c91e0=_[_0x7e3c('0x31')](db[_0x7e3c('0x32')][_0x7e3c('0x33')],function(_0x46017a){return{'name':_0x46017a[_0x7e3c('0x34')],'type':_0x46017a[_0x7e3c('0x35')][_0x7e3c('0x36')]};});_0x36f407['model']=_[_0x7e3c('0x31')](_0x1c91e0,_0x7e3c('0x2f'));_0x36f407[_0x7e3c('0x37')]=_[_0x7e3c('0x38')](_0x401f60[_0x7e3c('0x37')]);_0x36f407[_0x7e3c('0x39')]=_['intersection'](_0x36f407[_0x7e3c('0x3a')],_0x36f407[_0x7e3c('0x37')]);_0x20c0be['attributes']=_[_0x7e3c('0x3b')](_0x36f407[_0x7e3c('0x3a')],qs['fields'](_0x401f60[_0x7e3c('0x37')][_0x7e3c('0x3c')]));_0x20c0be[_0x7e3c('0x3d')]=_0x20c0be[_0x7e3c('0x3d')][_0x7e3c('0x3e')]?_0x20c0be[_0x7e3c('0x3d')]:_0x36f407[_0x7e3c('0x3a')];if(!_0x401f60[_0x7e3c('0x37')][_0x7e3c('0x3f')]('nolimit')){_0x20c0be[_0x7e3c('0x23')]=qs['limit'](_0x401f60[_0x7e3c('0x37')][_0x7e3c('0x23')]);_0x20c0be[_0x7e3c('0x26')]=qs[_0x7e3c('0x26')](_0x401f60[_0x7e3c('0x37')]['offset']);}_0x20c0be['order']=qs[_0x7e3c('0x40')](_0x401f60[_0x7e3c('0x37')][_0x7e3c('0x40')]);_0x20c0be[_0x7e3c('0x41')]=qs['filters'](_[_0x7e3c('0x42')](_0x401f60[_0x7e3c('0x37')],_0x36f407[_0x7e3c('0x39')]),_0x1c91e0);if(_0x401f60[_0x7e3c('0x37')][_0x7e3c('0x43')]){_0x20c0be['where']=_['merge'](_0x20c0be[_0x7e3c('0x41')],{'$or':_[_0x7e3c('0x31')](_0x1c91e0,function(_0x409c72){if(_0x409c72[_0x7e3c('0x35')]!==_0x7e3c('0x44')){var _0x1514cc={};_0x1514cc[_0x409c72[_0x7e3c('0x2f')]]={'$like':'%'+_0x401f60[_0x7e3c('0x37')][_0x7e3c('0x43')]+'%'};return _0x1514cc;}})});}_0x20c0be=_[_0x7e3c('0x45')]({},_0x20c0be,_0x401f60['options']);var _0x585add={'where':_0x20c0be['where']};return db[_0x7e3c('0x32')][_0x7e3c('0x25')](_0x585add)['then'](function(_0x189b9f){_0x3e42b2[_0x7e3c('0x25')]=_0x189b9f;if(_0x401f60[_0x7e3c('0x37')][_0x7e3c('0x46')]){_0x20c0be[_0x7e3c('0x47')]=[{'all':!![]}];}return db[_0x7e3c('0x32')]['findAll'](_0x20c0be);})['then'](function(_0x4318b7){_0x3e42b2[_0x7e3c('0x48')]=_0x4318b7;return _0x3e42b2;})[_0x7e3c('0x2b')](respondWithFilteredResult(_0x2e83e7,_0x20c0be))['catch'](handleError(_0x2e83e7,null));};exports['show']=function(_0x121baf,_0x39fca5){var _0x58066e={'raw':!![],'where':{'id':_0x121baf[_0x7e3c('0x49')]['id']}},_0x42a935={};_0x42a935[_0x7e3c('0x3a')]=_['keys'](db[_0x7e3c('0x32')][_0x7e3c('0x33')]);_0x42a935[_0x7e3c('0x37')]=_[_0x7e3c('0x38')](_0x121baf[_0x7e3c('0x37')]);_0x42a935[_0x7e3c('0x39')]=_['intersection'](_0x42a935['model'],_0x42a935[_0x7e3c('0x37')]);_0x58066e[_0x7e3c('0x3d')]=_[_0x7e3c('0x3b')](_0x42a935[_0x7e3c('0x3a')],qs['fields'](_0x121baf[_0x7e3c('0x37')]['fields']));_0x58066e['attributes']=_0x58066e[_0x7e3c('0x3d')][_0x7e3c('0x3e')]?_0x58066e['attributes']:_0x42a935[_0x7e3c('0x3a')];if(_0x121baf[_0x7e3c('0x37')][_0x7e3c('0x46')]){_0x58066e[_0x7e3c('0x47')]=[{'all':!![]}];}_0x58066e=_[_0x7e3c('0x45')]({},_0x58066e,_0x121baf[_0x7e3c('0x4a')]);return db[_0x7e3c('0x32')][_0x7e3c('0x4b')](_0x58066e)[_0x7e3c('0x2b')](handleEntityNotFound(_0x39fca5,null))[_0x7e3c('0x2b')](respondWithResult(_0x39fca5,null))[_0x7e3c('0x4c')](handleError(_0x39fca5,null));};exports[_0x7e3c('0x4d')]=function(_0x5c8e2b,_0x3cfd5c){return db[_0x7e3c('0x32')][_0x7e3c('0x4d')](_0x5c8e2b['body'],{})['then'](respondWithResult(_0x3cfd5c,0xc9))[_0x7e3c('0x4c')](handleError(_0x3cfd5c,null));};exports[_0x7e3c('0x2a')]=function(_0xc7a58f,_0x55f978){if(_0xc7a58f[_0x7e3c('0x4e')]['id']){delete _0xc7a58f[_0x7e3c('0x4e')]['id'];}return db[_0x7e3c('0x32')][_0x7e3c('0x4b')]({'where':{'id':_0xc7a58f['params']['id']}})[_0x7e3c('0x2b')](handleEntityNotFound(_0x55f978,null))[_0x7e3c('0x2b')](saveUpdates(_0xc7a58f[_0x7e3c('0x4e')],null))[_0x7e3c('0x2b')](respondWithResult(_0x55f978,null))['catch'](handleError(_0x55f978,null));};exports[_0x7e3c('0x2c')]=function(_0x2e0af4,_0x47e20b){return db[_0x7e3c('0x32')]['find']({'where':{'id':_0x2e0af4[_0x7e3c('0x49')]['id']}})[_0x7e3c('0x2b')](handleEntityNotFound(_0x47e20b,null))[_0x7e3c('0x2b')](removeEntity(_0x47e20b,null))['catch'](handleError(_0x47e20b,null));};exports[_0x7e3c('0x4f')]=function(_0xf48846,_0x1fa426){return db[_0x7e3c('0x32')][_0x7e3c('0x4f')]()[_0x7e3c('0x2b')](respondWithResult(_0x1fa426,null))['catch'](handleError(_0x1fa426,null));};function wrapUser(_0x362cbb){return function(_0xe0f0a6){var _0x5c5de4=_0x362cbb['get']({'plain':!![]});_0x5c5de4[_0x7e3c('0x50')]=[];if(_0xe0f0a6){_0x5c5de4[_0x7e3c('0x51')]=_0xe0f0a6['createdAt'];_0x5c5de4['lastMessage']=_0xe0f0a6;}else{_0x5c5de4[_0x7e3c('0x51')]=moment(0x0)[_0x7e3c('0x52')](_0x7e3c('0x53'));_0x5c5de4['lastMessage']={};}return _0x5c5de4;};}exports[_0x7e3c('0x54')]=function(_0x7c5b59,_0x2c2cf8,_0x4a6193){var _0x1f024f=[];return db['User'][_0x7e3c('0x55')]({'where':{'role':['agent',_0x7e3c('0x56'),'user']},'attributes':['id','fullname','name',_0x7e3c('0x57'),_0x7e3c('0x58'),_0x7e3c('0x59'),_0x7e3c('0x5a'),'lastLoginAt','allowmessenger','showWebBar'],'order':qs[_0x7e3c('0x40')](_0x7e3c('0x5b')),'include':[{'model':db[_0x7e3c('0x5c')],'as':'VoiceQueues','attributes':['id','name',_0x7e3c('0x35')],'through':{'attributes':[]}}]})[_0x7e3c('0x2b')](function(_0x3dbe70){if(_0x3dbe70){var _0x316f9a=_0x7c5b59[_0x7e3c('0x5d')]['get']({'plain':!![]});if(!_0x316f9a)throw new Error(_0x7e3c('0x5e'));if(_0x316f9a['role']===_0x7e3c('0x5d')){return db['UserProfileSection'][_0x7e3c('0x4b')]({'where':{'name':_0x7e3c('0x5f'),'userProfileId':_0x316f9a[_0x7e3c('0x60')]},'raw':!![]})[_0x7e3c('0x2b')](function(_0x22e0a1){if(_0x22e0a1){if(_0x22e0a1['autoAssociation']===0x0){return db[_0x7e3c('0x61')][_0x7e3c('0x55')]({'where':{'sectionId':_0x22e0a1['id']},'raw':!![]})[_0x7e3c('0x2b')](function(_0x329989){var _0x443f2d=[];if(_['isEmpty'](_0x329989)){_0x443f2d=_['filter'](_0x3dbe70,function(_0x142407){if(_0x142407[_0x7e3c('0x57')]!==_0x7e3c('0x62')){return _0x142407;}});return _0x443f2d;}else{for(var _0x4f5df3=0x0;_0x4f5df3<_0x3dbe70[_0x7e3c('0x3e')];_0x4f5df3++){var _0xeb32c1=_0x3dbe70[_0x4f5df3];if(_0xeb32c1[_0x7e3c('0x57')]===_0x7e3c('0x62')){var _0x28fc30=_['find'](_0x329989,function(_0x2a54bb){return _0x2a54bb[_0x7e3c('0x63')]===_0xeb32c1['id'];});if(_0x28fc30)_0x443f2d[_0x7e3c('0x64')](_0xeb32c1);}else{_0x443f2d['push'](_0xeb32c1);}}return _0x443f2d;}});}else{return _0x3dbe70;}}else{var _0x57e68b=_[_0x7e3c('0x43')](_0x3dbe70,function(_0x194691){if(_0x194691['role']!=='agent'){return _0x194691;}});return _0x57e68b;}});}else{return _0x3dbe70;}}})['then'](function(_0xeae64e){var _0x566fa6=[];if(_0xeae64e){_0x1f024f=_0xeae64e;for(var _0x298fa8=0x0;_0x298fa8<_0xeae64e[_0x7e3c('0x3e')];_0x298fa8+=0x1){_0x1f024f[_0x298fa8][_0x7e3c('0x50')]=[];_0x566fa6[_0x7e3c('0x64')](db['ChatInternalMessage'][_0x7e3c('0x4b')]({'where':{'FromId':[_0x7c5b59['user']['id'],_0xeae64e[_0x298fa8]['id']],'ToId':[_0x7c5b59[_0x7e3c('0x5d')]['id'],_0xeae64e[_0x298fa8]['id']],'ChatGroupId':null},'attributes':['id',_0x7e3c('0x65'),_0x7e3c('0x66'),_0x7e3c('0x67'),_0x7e3c('0x68'),_0x7e3c('0x4e')],'order':qs[_0x7e3c('0x40')](_0x7e3c('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0xeae64e[_0x298fa8])));}return BPromise[_0x7e3c('0x6a')](_0x566fa6);}return[];})[_0x7e3c('0x2b')](function(_0x251d2b){return{'rows':_0x251d2b,'count':_0x251d2b[_0x7e3c('0x3e')]};})[_0x7e3c('0x2b')](respondWithResult(_0x2c2cf8,null))['catch'](handleError(_0x2c2cf8,null));}; \ No newline at end of file +var _0x06d4=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','stack','name','send','index','ChatInternalMessage','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','find','create','body','update','describe','get','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','agent','admin','user','role','userpic','internal','online','lastLoginAt','showWebBar','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','isEmpty','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x119d9e,_0x16d98f){var _0xc56ad=function(_0x11271e){while(--_0x11271e){_0x119d9e['push'](_0x119d9e['shift']());}};_0xc56ad(++_0x16d98f);}(_0x06d4,0x144));var _0x406d=function(_0x45b575,_0x432ab5){_0x45b575=_0x45b575-0x0;var _0x374a45=_0x06d4[_0x45b575];return _0x374a45;};'use strict';var emlformat=require(_0x406d('0x0'));var rimraf=require(_0x406d('0x1'));var zipdir=require(_0x406d('0x2'));var jsonpatch=require(_0x406d('0x3'));var rp=require(_0x406d('0x4'));var moment=require(_0x406d('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x406d('0x6'));var path=require(_0x406d('0x7'));var sox=require(_0x406d('0x8'));var csv=require(_0x406d('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x406d('0xa'));var _=require(_0x406d('0xb'));var squel=require(_0x406d('0xc'));var crypto=require('crypto');var jsforce=require(_0x406d('0xd'));var deskjs=require(_0x406d('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x406d('0xf'));var Redis=require(_0x406d('0x10'));var authService=require(_0x406d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x406d('0x12'));var hardwareService=require(_0x406d('0x13'));var logger=require(_0x406d('0x14'))(_0x406d('0x15'));var utils=require(_0x406d('0x16'));var config=require(_0x406d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x406d('0x18'))['db'];config[_0x406d('0x19')]=_[_0x406d('0x1a')](config[_0x406d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x406d('0x1b'))(new Redis(config[_0x406d('0x19')]));require(_0x406d('0x1c'))[_0x406d('0x1d')](socket);function respondWithStatusCode(_0x536e1d,_0x60e4a3){_0x60e4a3=_0x60e4a3||0xcc;return function(_0x334e15){if(_0x334e15){return _0x536e1d[_0x406d('0x1e')](_0x60e4a3);}return _0x536e1d[_0x406d('0x1f')](_0x60e4a3)[_0x406d('0x20')]();};}function respondWithResult(_0x3d9d4c,_0x23735d){_0x23735d=_0x23735d||0xc8;return function(_0x11037b){if(_0x11037b){return _0x3d9d4c['status'](_0x23735d)[_0x406d('0x21')](_0x11037b);}};}function respondWithFilteredResult(_0x54abde,_0x20bef8){return function(_0x3d36fb){if(_0x3d36fb){var _0x3b7aef=typeof _0x20bef8[_0x406d('0x22')]==='undefined'&&typeof _0x20bef8[_0x406d('0x23')]===_0x406d('0x24');var _0x56849a=_0x3d36fb[_0x406d('0x25')];var _0x5dd76f=_0x3b7aef?0x0:_0x20bef8['offset'];var _0x5f4d7e=_0x3b7aef?_0x3d36fb[_0x406d('0x25')]:_0x20bef8['offset']+_0x20bef8['limit'];var _0x5e7679;if(_0x5f4d7e>=_0x56849a){_0x5f4d7e=_0x56849a;_0x5e7679=0xc8;}else{_0x5e7679=0xce;}_0x54abde['status'](_0x5e7679);return _0x54abde[_0x406d('0x26')](_0x406d('0x27'),_0x5dd76f+'-'+_0x5f4d7e+'/'+_0x56849a)[_0x406d('0x21')](_0x3d36fb);}return null;};}function patchUpdates(_0x4e6d27){return function(_0x448019){try{jsonpatch['apply'](_0x448019,_0x4e6d27,!![]);}catch(_0x2907e1){return BPromise[_0x406d('0x28')](_0x2907e1);}return _0x448019[_0x406d('0x29')]();};}function saveUpdates(_0x58673e,_0x7ab3c7){return function(_0x1d6788){if(_0x1d6788){return _0x1d6788['update'](_0x58673e)[_0x406d('0x2a')](function(_0x530a41){return _0x530a41;});}return null;};}function removeEntity(_0x2dfda1,_0x1b023f){return function(_0x40e274){if(_0x40e274){return _0x40e274[_0x406d('0x2b')]()[_0x406d('0x2a')](function(){_0x2dfda1[_0x406d('0x1f')](0xcc)[_0x406d('0x20')]();});}};}function handleEntityNotFound(_0x40808e,_0x76cb64){return function(_0x1556cf){if(!_0x1556cf){_0x40808e[_0x406d('0x1e')](0x194);}return _0x1556cf;};}function handleError(_0x5b2c04,_0x55b4f8){_0x55b4f8=_0x55b4f8||0x1f4;return function(_0x403218){logger['error'](_0x403218[_0x406d('0x2c')]);if(_0x403218[_0x406d('0x2d')]){delete _0x403218['name'];}_0x5b2c04[_0x406d('0x1f')](_0x55b4f8)[_0x406d('0x2e')](_0x403218);};}exports[_0x406d('0x2f')]=function(_0x13ca04,_0x1fbf93){var _0xd4331={},_0x49424d={},_0xf04450={'count':0x0,'rows':[]};var _0x3ab101=_['map'](db[_0x406d('0x30')][_0x406d('0x31')],function(_0x5efab5){return{'name':_0x5efab5[_0x406d('0x32')],'type':_0x5efab5[_0x406d('0x33')][_0x406d('0x34')]};});_0x49424d[_0x406d('0x35')]=_['map'](_0x3ab101,_0x406d('0x2d'));_0x49424d[_0x406d('0x36')]=_[_0x406d('0x37')](_0x13ca04['query']);_0x49424d[_0x406d('0x38')]=_['intersection'](_0x49424d['model'],_0x49424d[_0x406d('0x36')]);_0xd4331[_0x406d('0x39')]=_[_0x406d('0x3a')](_0x49424d[_0x406d('0x35')],qs['fields'](_0x13ca04[_0x406d('0x36')][_0x406d('0x3b')]));_0xd4331[_0x406d('0x39')]=_0xd4331[_0x406d('0x39')][_0x406d('0x3c')]?_0xd4331['attributes']:_0x49424d[_0x406d('0x35')];if(!_0x13ca04['query'][_0x406d('0x3d')](_0x406d('0x3e'))){_0xd4331[_0x406d('0x23')]=qs[_0x406d('0x23')](_0x13ca04[_0x406d('0x36')][_0x406d('0x23')]);_0xd4331[_0x406d('0x22')]=qs['offset'](_0x13ca04[_0x406d('0x36')]['offset']);}_0xd4331[_0x406d('0x3f')]=qs[_0x406d('0x40')](_0x13ca04[_0x406d('0x36')][_0x406d('0x40')]);_0xd4331[_0x406d('0x41')]=qs[_0x406d('0x38')](_[_0x406d('0x42')](_0x13ca04['query'],_0x49424d['filters']),_0x3ab101);if(_0x13ca04[_0x406d('0x36')][_0x406d('0x43')]){_0xd4331[_0x406d('0x41')]=_[_0x406d('0x44')](_0xd4331[_0x406d('0x41')],{'$or':_[_0x406d('0x45')](_0x3ab101,function(_0x26acf3){if(_0x26acf3['type']!==_0x406d('0x46')){var _0x206490={};_0x206490[_0x26acf3[_0x406d('0x2d')]]={'$like':'%'+_0x13ca04[_0x406d('0x36')][_0x406d('0x43')]+'%'};return _0x206490;}})});}_0xd4331=_[_0x406d('0x44')]({},_0xd4331,_0x13ca04[_0x406d('0x47')]);var _0x272d77={'where':_0xd4331[_0x406d('0x41')]};return db['ChatInternalMessage'][_0x406d('0x25')](_0x272d77)[_0x406d('0x2a')](function(_0x153e6f){_0xf04450[_0x406d('0x25')]=_0x153e6f;if(_0x13ca04[_0x406d('0x36')][_0x406d('0x48')]){_0xd4331['include']=[{'all':!![]}];}return db[_0x406d('0x30')][_0x406d('0x49')](_0xd4331);})[_0x406d('0x2a')](function(_0x4b7d01){_0xf04450[_0x406d('0x4a')]=_0x4b7d01;return _0xf04450;})[_0x406d('0x2a')](respondWithFilteredResult(_0x1fbf93,_0xd4331))[_0x406d('0x4b')](handleError(_0x1fbf93,null));};exports[_0x406d('0x4c')]=function(_0x448d1f,_0x2669e6){var _0xf5c89f={'raw':!![],'where':{'id':_0x448d1f[_0x406d('0x4d')]['id']}},_0x226204={};_0x226204[_0x406d('0x35')]=_[_0x406d('0x37')](db[_0x406d('0x30')]['rawAttributes']);_0x226204[_0x406d('0x36')]=_[_0x406d('0x37')](_0x448d1f[_0x406d('0x36')]);_0x226204[_0x406d('0x38')]=_[_0x406d('0x3a')](_0x226204['model'],_0x226204[_0x406d('0x36')]);_0xf5c89f[_0x406d('0x39')]=_[_0x406d('0x3a')](_0x226204['model'],qs[_0x406d('0x3b')](_0x448d1f[_0x406d('0x36')][_0x406d('0x3b')]));_0xf5c89f[_0x406d('0x39')]=_0xf5c89f[_0x406d('0x39')][_0x406d('0x3c')]?_0xf5c89f[_0x406d('0x39')]:_0x226204[_0x406d('0x35')];if(_0x448d1f[_0x406d('0x36')]['includeAll']){_0xf5c89f['include']=[{'all':!![]}];}_0xf5c89f=_[_0x406d('0x44')]({},_0xf5c89f,_0x448d1f[_0x406d('0x47')]);return db[_0x406d('0x30')][_0x406d('0x4e')](_0xf5c89f)['then'](handleEntityNotFound(_0x2669e6,null))[_0x406d('0x2a')](respondWithResult(_0x2669e6,null))['catch'](handleError(_0x2669e6,null));};exports[_0x406d('0x4f')]=function(_0x1a7695,_0x1a9049){return db['ChatInternalMessage'][_0x406d('0x4f')](_0x1a7695[_0x406d('0x50')],{})[_0x406d('0x2a')](respondWithResult(_0x1a9049,0xc9))[_0x406d('0x4b')](handleError(_0x1a9049,null));};exports[_0x406d('0x51')]=function(_0x49c180,_0x412482){if(_0x49c180[_0x406d('0x50')]['id']){delete _0x49c180['body']['id'];}return db[_0x406d('0x30')][_0x406d('0x4e')]({'where':{'id':_0x49c180['params']['id']}})[_0x406d('0x2a')](handleEntityNotFound(_0x412482,null))[_0x406d('0x2a')](saveUpdates(_0x49c180[_0x406d('0x50')],null))[_0x406d('0x2a')](respondWithResult(_0x412482,null))[_0x406d('0x4b')](handleError(_0x412482,null));};exports[_0x406d('0x2b')]=function(_0x1ce485,_0x260c3a){return db[_0x406d('0x30')][_0x406d('0x4e')]({'where':{'id':_0x1ce485[_0x406d('0x4d')]['id']}})['then'](handleEntityNotFound(_0x260c3a,null))['then'](removeEntity(_0x260c3a,null))[_0x406d('0x4b')](handleError(_0x260c3a,null));};exports[_0x406d('0x52')]=function(_0x20aa41,_0x2b296a){return db[_0x406d('0x30')][_0x406d('0x52')]()[_0x406d('0x2a')](respondWithResult(_0x2b296a,null))['catch'](handleError(_0x2b296a,null));};function wrapUser(_0x2351a7){return function(_0xd52c32){var _0x978484=_0x2351a7[_0x406d('0x53')]({'plain':!![]});_0x978484['messages']=[];if(_0xd52c32){_0x978484['lastMessageAt']=_0xd52c32['createdAt'];_0x978484[_0x406d('0x54')]=_0xd52c32;}else{_0x978484[_0x406d('0x55')]=moment(0x0)[_0x406d('0x56')](_0x406d('0x57'));_0x978484[_0x406d('0x54')]={};}return _0x978484;};}exports[_0x406d('0x58')]=function(_0x3d7d1d,_0x3a410d,_0x249639){var _0x231e67=[];return db[_0x406d('0x59')][_0x406d('0x49')]({'where':{'role':[_0x406d('0x5a'),_0x406d('0x5b'),_0x406d('0x5c')]},'attributes':['id','fullname','name',_0x406d('0x5d'),_0x406d('0x5e'),_0x406d('0x5f'),_0x406d('0x60'),_0x406d('0x61'),'allowmessenger',_0x406d('0x62')],'order':qs[_0x406d('0x40')]('-online'),'include':[{'model':db[_0x406d('0x63')],'as':_0x406d('0x64'),'attributes':['id',_0x406d('0x2d'),_0x406d('0x33')],'through':{'attributes':[]}}]})[_0x406d('0x2a')](function(_0x4be8a0){if(_0x4be8a0){var _0x461f53=_0x3d7d1d[_0x406d('0x5c')][_0x406d('0x53')]({'plain':!![]});if(!_0x461f53)throw new Error(_0x406d('0x65'));if(_0x461f53[_0x406d('0x5d')]===_0x406d('0x5c')){return db[_0x406d('0x66')][_0x406d('0x4e')]({'where':{'name':_0x406d('0x67'),'userProfileId':_0x461f53[_0x406d('0x68')]},'raw':!![]})['then'](function(_0x5a86cc){if(_0x5a86cc){if(_0x5a86cc['autoAssociation']===0x0){return db['UserProfileResource'][_0x406d('0x49')]({'where':{'sectionId':_0x5a86cc['id']},'raw':!![]})[_0x406d('0x2a')](function(_0x21ea3a){var _0xd03e2b=[];if(_[_0x406d('0x69')](_0x21ea3a)){_0xd03e2b=_[_0x406d('0x43')](_0x4be8a0,function(_0x15f64b){if(_0x15f64b[_0x406d('0x5d')]!==_0x406d('0x5a')){return _0x15f64b;}});return _0xd03e2b;}else{for(var _0x579370=0x0;_0x579370<_0x4be8a0['length'];_0x579370++){var _0x20252c=_0x4be8a0[_0x579370];if(_0x20252c['role']===_0x406d('0x5a')){var _0x25650d=_[_0x406d('0x4e')](_0x21ea3a,function(_0x2633ab){return _0x2633ab[_0x406d('0x6a')]===_0x20252c['id'];});if(_0x25650d)_0xd03e2b[_0x406d('0x6b')](_0x20252c);}else{_0xd03e2b['push'](_0x20252c);}}return _0xd03e2b;}});}else{return _0x4be8a0;}}else{var _0x49bf29=_[_0x406d('0x43')](_0x4be8a0,function(_0x3bff06){if(_0x3bff06[_0x406d('0x5d')]!==_0x406d('0x5a')){return _0x3bff06;}});return _0x49bf29;}});}else{return _0x4be8a0;}}})[_0x406d('0x2a')](function(_0x3a7fe0){var _0x60ca91=[];if(_0x3a7fe0){_0x231e67=_0x3a7fe0;for(var _0x1541fa=0x0;_0x1541fa<_0x3a7fe0['length'];_0x1541fa+=0x1){_0x231e67[_0x1541fa]['messages']=[];_0x60ca91['push'](db['ChatInternalMessage'][_0x406d('0x4e')]({'where':{'FromId':[_0x3d7d1d['user']['id'],_0x3a7fe0[_0x1541fa]['id']],'ToId':[_0x3d7d1d[_0x406d('0x5c')]['id'],_0x3a7fe0[_0x1541fa]['id']],'ChatGroupId':null},'attributes':['id',_0x406d('0x6c'),_0x406d('0x6d'),_0x406d('0x6e'),_0x406d('0x6f'),_0x406d('0x50')],'order':qs['sort'](_0x406d('0x70')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x3a7fe0[_0x1541fa])));}return BPromise[_0x406d('0x71')](_0x60ca91);}return[];})[_0x406d('0x2a')](function(_0x102842){return{'rows':_0x102842,'count':_0x102842[_0x406d('0x3c')]};})[_0x406d('0x2a')](respondWithResult(_0x3a410d,null))[_0x406d('0x4b')](handleError(_0x3a410d,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 4b73ac8..16d26ad 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 _0x77e1=['exports','ChatInternalMessage','setMaxListeners','emit','hook'];(function(_0x461264,_0x4109e2){var _0x28cb91=function(_0x21ada0){while(--_0x21ada0){_0x461264['push'](_0x461264['shift']());}};_0x28cb91(++_0x4109e2);}(_0x77e1,0x1a0));var _0x177e=function(_0x1fc331,_0x2f7678){_0x1fc331=_0x1fc331-0x0;var _0x35ece7=_0x77e1[_0x1fc331];return _0x35ece7;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require('../../mysqldb')['db'][_0x177e('0x0')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x177e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5b826d){return function(_0x58dfe6,_0x5a7358,_0x131fd8){ChatInternalMessageEvents[_0x177e('0x2')](_0x5b826d+':'+_0x58dfe6['id'],_0x58dfe6);ChatInternalMessageEvents[_0x177e('0x2')](_0x5b826d,_0x58dfe6);_0x131fd8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x177e('0x3')](e,emitEvent(event));}}module[_0x177e('0x4')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xadbb=['setMaxListeners','update','emit','hasOwnProperty','hook','exports','events','ChatInternalMessage'];(function(_0x136835,_0xe1ee2a){var _0x5b0b13=function(_0x4bcedb){while(--_0x4bcedb){_0x136835['push'](_0x136835['shift']());}};_0x5b0b13(++_0xe1ee2a);}(_0xadbb,0x66));var _0xbadb=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xadbb[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0xbadb('0x0'));var ChatInternalMessage=require('../../mysqldb')['db'][_0xbadb('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xbadb('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbadb('0x3'),'afterDestroy':'remove'};function emitEvent(_0xd80010){return function(_0x115f32,_0x460a9e,_0x564684){ChatInternalMessageEvents[_0xbadb('0x4')](_0xd80010+':'+_0x115f32['id'],_0x115f32);ChatInternalMessageEvents[_0xbadb('0x4')](_0xd80010,_0x115f32);_0x564684(null);};}for(var e in events){if(events[_0xbadb('0x5')](e)){var event=events[e];ChatInternalMessage[_0xbadb('0x6')](e,emitEvent(event));}}module[_0xbadb('0x7')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 2ff7636..4bedd74 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 _0xe152=['ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x3f6499,_0x556b78){var _0x34ef56=function(_0x3bc4e7){while(--_0x3bc4e7){_0x3f6499['push'](_0x3f6499['shift']());}};_0x34ef56(++_0x556b78);}(_0xe152,0x1e4));var _0x2e15=function(_0x4a8773,_0x522735){_0x4a8773=_0x4a8773-0x0;var _0x38656b=_0xe152[_0x4a8773];return _0x38656b;};'use strict';var _=require('lodash');var util=require(_0x2e15('0x0'));var logger=require(_0x2e15('0x1'))(_0x2e15('0x2'));var moment=require(_0x2e15('0x3'));var BPromise=require(_0x2e15('0x4'));var rp=require(_0x2e15('0x5'));var fs=require('fs');var path=require(_0x2e15('0x6'));var rimraf=require(_0x2e15('0x7'));var config=require(_0x2e15('0x8'));var attributes=require('./chatInternalMessage.attributes');module[_0x2e15('0x9')]=function(_0x1f4e6c,_0x24d146){return _0x1f4e6c[_0x2e15('0xa')](_0x2e15('0xb'),attributes,{'tableName':_0x2e15('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2e15('0xd'),'collate':_0x2e15('0xe')});}; \ No newline at end of file +var _0x95d3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInternalMessage.attributes','ChatInternalMessage','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x95d3,0x1a0));var _0x395d=function(_0x168ecb,_0xd51f15){_0x168ecb=_0x168ecb-0x0;var _0x375aa8=_0x95d3[_0x168ecb];return _0x375aa8;};'use strict';var _=require(_0x395d('0x0'));var util=require(_0x395d('0x1'));var logger=require(_0x395d('0x2'))(_0x395d('0x3'));var moment=require(_0x395d('0x4'));var BPromise=require(_0x395d('0x5'));var rp=require(_0x395d('0x6'));var fs=require('fs');var path=require(_0x395d('0x7'));var rimraf=require(_0x395d('0x8'));var config=require(_0x395d('0x9'));var attributes=require(_0x395d('0xa'));module['exports']=function(_0x4021bc,_0x5006ba){return _0x4021bc['define'](_0x395d('0xb'),attributes,{'tableName':'chat_internal_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x395d('0xc'),'collate':_0x395d('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index a549800..689d54e 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 _0x220b=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','util','moment','bluebird'];(function(_0x173f10,_0x35db61){var _0x53142d=function(_0x37bbef){while(--_0x37bbef){_0x173f10['push'](_0x173f10['shift']());}};_0x53142d(++_0x35db61);}(_0x220b,0x1b7));var _0xb220=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0x220b[_0x2307fa];return _0x496486;};'use strict';var _=require('lodash');var util=require(_0xb220('0x0'));var moment=require(_0xb220('0x1'));var BPromise=require(_0xb220('0x2'));var rs=require(_0xb220('0x3'));var fs=require('fs');var Redis=require(_0xb220('0x4'));var db=require(_0xb220('0x5'))['db'];var utils=require(_0xb220('0x6'));var logger=require(_0xb220('0x7'))(_0xb220('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb220('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb220('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xb220('0xb'))(new Redis(config[_0xb220('0xa')]));require(_0xb220('0xc'))[_0xb220('0xd')](socket);function respondWithRpcPromise(_0x5517c7,_0x8314d4,_0x2c3a2d){return new BPromise(function(_0x332381,_0x1fba57){return client[_0xb220('0xe')](_0x5517c7,_0x2c3a2d)[_0xb220('0xf')](function(_0x504770){logger[_0xb220('0x10')]('ChatInternalMessage,\x20%s,\x20%s',_0x8314d4,_0xb220('0x11'));logger[_0xb220('0x12')](_0xb220('0x13'),_0x8314d4,_0xb220('0x11'),JSON['stringify'](_0x504770));if(_0x504770['error']){if(_0x504770[_0xb220('0x14')][_0xb220('0x15')]===0x1f4){logger[_0xb220('0x14')](_0xb220('0x16'),_0x8314d4,_0x504770[_0xb220('0x14')][_0xb220('0x17')]);return _0x1fba57(_0x504770[_0xb220('0x14')]['message']);}logger[_0xb220('0x14')](_0xb220('0x16'),_0x8314d4,_0x504770[_0xb220('0x14')][_0xb220('0x17')]);return _0x332381(_0x504770[_0xb220('0x14')][_0xb220('0x17')]);}else{logger[_0xb220('0x10')](_0xb220('0x16'),_0x8314d4,_0xb220('0x11'));_0x332381(_0x504770[_0xb220('0x18')][_0xb220('0x17')]);}})[_0xb220('0x19')](function(_0x40716e){logger[_0xb220('0x14')]('ChatInternalMessage,\x20%s,\x20%s',_0x8314d4,_0x40716e);_0x1fba57(_0x40716e);});});} \ No newline at end of file +var _0x9bef=['../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','request','then','info','ChatInternalMessage,\x20%s,\x20%s','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9bef,0x133));var _0xf9be=function(_0x28b2c2,_0x278d72){_0x28b2c2=_0x28b2c2-0x0;var _0x1957ea=_0x9bef[_0x28b2c2];return _0x1957ea;};'use strict';var _=require(_0xf9be('0x0'));var util=require(_0xf9be('0x1'));var moment=require('moment');var BPromise=require(_0xf9be('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf9be('0x3'));var db=require(_0xf9be('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9be('0x5'))('rpc');var config=require(_0xf9be('0x6'));var jayson=require(_0xf9be('0x7'));var client=jayson['client'][_0xf9be('0x8')]({'port':0x232a});config[_0xf9be('0x9')]=_[_0xf9be('0xa')](config[_0xf9be('0x9')],{'host':_0xf9be('0xb'),'port':0x18eb});var socket=require(_0xf9be('0xc'))(new Redis(config[_0xf9be('0x9')]));require(_0xf9be('0xd'))['register'](socket);function respondWithRpcPromise(_0x41a401,_0x5ec3e4,_0x471f02){return new BPromise(function(_0x33c615,_0x5ac324){return client[_0xf9be('0xe')](_0x41a401,_0x471f02)[_0xf9be('0xf')](function(_0x266245){logger[_0xf9be('0x10')](_0xf9be('0x11'),_0x5ec3e4,'request\x20sent');logger[_0xf9be('0x12')](_0xf9be('0x13'),_0x5ec3e4,_0xf9be('0x14'),JSON['stringify'](_0x266245));if(_0x266245[_0xf9be('0x15')]){if(_0x266245[_0xf9be('0x15')][_0xf9be('0x16')]===0x1f4){logger[_0xf9be('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x5ec3e4,_0x266245[_0xf9be('0x15')][_0xf9be('0x17')]);return _0x5ac324(_0x266245[_0xf9be('0x15')][_0xf9be('0x17')]);}logger['error'](_0xf9be('0x11'),_0x5ec3e4,_0x266245['error'][_0xf9be('0x17')]);return _0x33c615(_0x266245['error'][_0xf9be('0x17')]);}else{logger[_0xf9be('0x10')](_0xf9be('0x11'),_0x5ec3e4,'request\x20sent');_0x33c615(_0x266245[_0xf9be('0x18')][_0xf9be('0x17')]);}})[_0xf9be('0x19')](function(_0x20f3c3){logger[_0xf9be('0x15')]('ChatInternalMessage,\x20%s,\x20%s',_0x5ec3e4,_0x20f3c3);_0x5ac324(_0x20f3c3);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 409d762..df59716 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 _0xa3e0=['./chatInternalMessage.events','save','remove','update','emit','length','chatInternalMessage:'];(function(_0x1964e9,_0x1adade){var _0x35bffe=function(_0x29c150){while(--_0x29c150){_0x1964e9['push'](_0x1964e9['shift']());}};_0x35bffe(++_0x1adade);}(_0xa3e0,0x1b9));var _0x0a3e=function(_0x26dfd0,_0x404f9d){_0x26dfd0=_0x26dfd0-0x0;var _0x3e7507=_0xa3e0[_0x26dfd0];return _0x3e7507;};'use strict';var ChatInternalMessageEvents=require(_0x0a3e('0x0'));var events=[_0x0a3e('0x1'),_0x0a3e('0x2'),_0x0a3e('0x3')];function createListener(_0x7d65ae,_0x4377ad){return function(_0x214120){_0x4377ad[_0x0a3e('0x4')](_0x7d65ae,_0x214120);};}function removeListener(_0x517ee7,_0x547cd3){return function(){ChatInternalMessageEvents['removeListener'](_0x517ee7,_0x547cd3);};}exports['register']=function(_0x2d9a6b){for(var _0x2c2b8a=0x0,_0x1ef3ba=events[_0x0a3e('0x5')];_0x2c2b8a<_0x1ef3ba;_0x2c2b8a++){var _0x1c5435=events[_0x2c2b8a];var _0x1573b8=createListener(_0x0a3e('0x6')+_0x1c5435,_0x2d9a6b);ChatInternalMessageEvents['on'](_0x1c5435,_0x1573b8);}}; \ No newline at end of file +var _0xaba8=['emit','removeListener','length','./chatInternalMessage.events','save','update'];(function(_0x484e36,_0x4482d8){var _0xafc85d=function(_0xaba9c8){while(--_0xaba9c8){_0x484e36['push'](_0x484e36['shift']());}};_0xafc85d(++_0x4482d8);}(_0xaba8,0xf3));var _0x8aba=function(_0x31c78d,_0x594960){_0x31c78d=_0x31c78d-0x0;var _0x4fc2cb=_0xaba8[_0x31c78d];return _0x4fc2cb;};'use strict';var ChatInternalMessageEvents=require(_0x8aba('0x0'));var events=[_0x8aba('0x1'),'remove',_0x8aba('0x2')];function createListener(_0x4f7755,_0x3360a3){return function(_0x3b74fd){_0x3360a3[_0x8aba('0x3')](_0x4f7755,_0x3b74fd);};}function removeListener(_0x45b50e,_0x35bfd4){return function(){ChatInternalMessageEvents[_0x8aba('0x4')](_0x45b50e,_0x35bfd4);};}exports['register']=function(_0xbc255f){for(var _0x32da5d=0x0,_0x3f5a03=events[_0x8aba('0x5')];_0x32da5d<_0x3f5a03;_0x32da5d++){var _0x47ab86=events[_0x32da5d];var _0x4c053f=createListener('chatInternalMessage:'+_0x47ab86,_0xbc255f);ChatInternalMessageEvents['on'](_0x47ab86,_0x4c053f);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 809971c..8174caa 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 _0xdaa2=['express','fs-extra','../../components/interaction/service','./chatInternalMessage.controller','isAuthenticated','/describe','describe','get','/users','getUsers','/:id','show','post','create','update','delete','multer','path','connect-timeout'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xdaa2,0x18c));var _0x2daa=function(_0x524188,_0x270495){_0x524188=_0x524188-0x0;var _0x31ea2f=_0xdaa2[_0x524188];return _0x31ea2f;};'use strict';var multer=require(_0x2daa('0x0'));var util=require('util');var path=require(_0x2daa('0x1'));var timeout=require(_0x2daa('0x2'));var express=require(_0x2daa('0x3'));var router=express['Router']();var fs_extra=require(_0x2daa('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2daa('0x5'));var config=require('../../config/environment');var controller=require(_0x2daa('0x6'));router['get']('/',auth[_0x2daa('0x7')](),controller['index']);router['get'](_0x2daa('0x8'),auth['isAuthenticated'](),controller[_0x2daa('0x9')]);router[_0x2daa('0xa')](_0x2daa('0xb'),auth[_0x2daa('0x7')](),controller[_0x2daa('0xc')]);router['get'](_0x2daa('0xd'),auth[_0x2daa('0x7')](),controller[_0x2daa('0xe')]);router[_0x2daa('0xf')]('/',auth[_0x2daa('0x7')](),controller[_0x2daa('0x10')]);router['put'](_0x2daa('0xd'),controller[_0x2daa('0x11')]);router[_0x2daa('0x12')](_0x2daa('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc850=['create','put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','isAuthenticated','index','/describe','get','/users','getUsers','/:id'];(function(_0x2b76c9,_0x46eaee){var _0x230b98=function(_0x27b704){while(--_0x27b704){_0x2b76c9['push'](_0x2b76c9['shift']());}};_0x230b98(++_0x46eaee);}(_0xc850,0xe0));var _0x0c85=function(_0x32d999,_0x8a4ca9){_0x32d999=_0x32d999-0x0;var _0x280400=_0xc850[_0x32d999];return _0x280400;};'use strict';var multer=require(_0x0c85('0x0'));var util=require(_0x0c85('0x1'));var path=require(_0x0c85('0x2'));var timeout=require('connect-timeout');var express=require(_0x0c85('0x3'));var router=express[_0x0c85('0x4')]();var fs_extra=require(_0x0c85('0x5'));var auth=require(_0x0c85('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0c85('0x7'));var controller=require(_0x0c85('0x8'));router['get']('/',auth[_0x0c85('0x9')](),controller[_0x0c85('0xa')]);router['get'](_0x0c85('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x0c85('0xc')](_0x0c85('0xd'),auth[_0x0c85('0x9')](),controller[_0x0c85('0xe')]);router[_0x0c85('0xc')](_0x0c85('0xf'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x0c85('0x10')]);router[_0x0c85('0x11')](_0x0c85('0xf'),controller['update']);router[_0x0c85('0x12')](_0x0c85('0xf'),auth[_0x0c85('0x9')](),controller[_0x0c85('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index f02d683..3078ff5 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 _0xae60=['sequelize','exports','TEXT','BOOLEAN','ENUM','out','DATE'];(function(_0x54d4fe,_0x55e869){var _0x1ab5bb=function(_0x5b1af2){while(--_0x5b1af2){_0x54d4fe['push'](_0x54d4fe['shift']());}};_0x1ab5bb(++_0x55e869);}(_0xae60,0x1c7));var _0x0ae6=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xae60[_0x411017];return _0x2adeea;};'use strict';var Sequelize=require(_0x0ae6('0x0'));module[_0x0ae6('0x1')]={'body':{'type':Sequelize[_0x0ae6('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0x0ae6('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x0ae6('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0ae6('0x4')]('in','out'),'defaultValue':_0x0ae6('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x0ae6('0x6')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x0ae6('0x2')]}}; \ No newline at end of file +var _0xda3f=['DATE','exports','TEXT','ENUM','out'];(function(_0x3f6089,_0x224162){var _0x5df5fe=function(_0x40517f){while(--_0x40517f){_0x3f6089['push'](_0x3f6089['shift']());}};_0x5df5fe(++_0x224162);}(_0xda3f,0xec));var _0xfda3=function(_0x8b620d,_0x305311){_0x8b620d=_0x8b620d-0x0;var _0xc50733=_0xda3f[_0x8b620d];return _0xc50733;};'use strict';var Sequelize=require('sequelize');module[_0xfda3('0x0')]={'body':{'type':Sequelize[_0xfda3('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xfda3('0x2')]('in','out'),'defaultValue':_0xfda3('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0xfda3('0x4')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0xfda3('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 08f0743..5303829 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 _0x55ef=['stack','name','send','map','ChatMessage','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','params','find','create','body','describe','chat-interactions','accept','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteraction','ChatInteractionId','isNil','interaction','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','internal','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','reject','chat','RejectMessage','rejectMessage','QueryTypes','interface','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','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','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','jayson/promise','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','limit','count','offset','Content-Range','apply','save','update','destroy'];(function(_0x222dc5,_0xe61028){var _0x306259=function(_0x4efba6){while(--_0x4efba6){_0x222dc5['push'](_0x222dc5['shift']());}};_0x306259(++_0xe61028);}(_0x55ef,0x1d2));var _0xf55e=function(_0x226701,_0x14d1f9){_0x226701=_0x226701-0x0;var _0x4a56a6=_0x55ef[_0x226701];return _0x4a56a6;};'use strict';var emlformat=require(_0xf55e('0x0'));var rimraf=require(_0xf55e('0x1'));var zipdir=require(_0xf55e('0x2'));var jsonpatch=require(_0xf55e('0x3'));var rp=require(_0xf55e('0x4'));var moment=require(_0xf55e('0x5'));var BPromise=require(_0xf55e('0x6'));var Mustache=require(_0xf55e('0x7'));var util=require(_0xf55e('0x8'));var path=require(_0xf55e('0x9'));var sox=require(_0xf55e('0xa'));var csv=require(_0xf55e('0xb'));var ejs=require(_0xf55e('0xc'));var fs=require('fs');var fs_extra=require(_0xf55e('0xd'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf55e('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf55e('0xf'));var toCsv=require(_0xf55e('0xb'));var querystring=require(_0xf55e('0x10'));var Papa=require(_0xf55e('0x11'));var Redis=require(_0xf55e('0x12'));var authService=require(_0xf55e('0x13'));var qs=require(_0xf55e('0x14'));var as=require(_0xf55e('0x15'));var hardwareService=require(_0xf55e('0x16'));var logger=require(_0xf55e('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xf55e('0x18'));var licenseUtil=require(_0xf55e('0x19'));var db=require(_0xf55e('0x1a'))['db'];config['redis']=_[_0xf55e('0x1b')](config[_0xf55e('0x1c')],{'host':_0xf55e('0x1d'),'port':0x18eb});var socket=require(_0xf55e('0x1e'))(new Redis(config[_0xf55e('0x1c')]));require(_0xf55e('0x1f'))['register'](socket);var jayson=require(_0xf55e('0x20'));var client=jayson[_0xf55e('0x21')]['http']({'port':0x232c});var client9002=jayson[_0xf55e('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2719a6,_0x2b4f9b,_0x266d53,_0x485795){return new BPromise(function(_0x423088,_0x4bf816){var _0x2353e1=_0x485795||client;return _0x2353e1[_0xf55e('0x22')](_0x2719a6,_0x266d53)[_0xf55e('0x23')](function(_0x516522){logger[_0xf55e('0x24')](_0xf55e('0x25'),_0x2b4f9b,_0xf55e('0x26'));logger[_0xf55e('0x27')](_0xf55e('0x28'),_0x2b4f9b,_0xf55e('0x26'),JSON['stringify'](_0x516522));if(_0x516522['error']){if(_0x516522[_0xf55e('0x29')][_0xf55e('0x2a')]===0x1f4){logger[_0xf55e('0x29')]('ChatMessage,\x20%s,\x20%s',_0x2b4f9b,_0x516522[_0xf55e('0x29')][_0xf55e('0x2b')]);return _0x4bf816(_0x516522[_0xf55e('0x29')][_0xf55e('0x2b')]);}logger[_0xf55e('0x29')](_0xf55e('0x25'),_0x2b4f9b,_0x516522[_0xf55e('0x29')][_0xf55e('0x2b')]);return _0x423088(_0x516522[_0xf55e('0x29')][_0xf55e('0x2b')]);}else{logger[_0xf55e('0x24')](_0xf55e('0x25'),_0x2b4f9b,_0xf55e('0x26'));_0x423088(_0x516522[_0xf55e('0x2c')][_0xf55e('0x2b')]);}})[_0xf55e('0x2d')](function(_0x3f0d3f){logger[_0xf55e('0x29')](_0xf55e('0x25'),_0x2b4f9b,_0x3f0d3f);_0x4bf816(_0x3f0d3f);});});}function respondWithStatusCode(_0xd56f82,_0xe90daa){_0xe90daa=_0xe90daa||0xcc;return function(_0x337f8f){if(_0x337f8f){return _0xd56f82[_0xf55e('0x2e')](_0xe90daa);}return _0xd56f82[_0xf55e('0x2f')](_0xe90daa)[_0xf55e('0x30')]();};}function respondWithResult(_0x50ef95,_0x5565b8){_0x5565b8=_0x5565b8||0xc8;return function(_0x252c58){if(_0x252c58){return _0x50ef95[_0xf55e('0x2f')](_0x5565b8)[_0xf55e('0x31')](_0x252c58);}};}function respondWithFilteredResult(_0x337eee,_0x40eb35){return function(_0x202dcd){if(_0x202dcd){var _0x8bc4f8=typeof _0x40eb35['offset']==='undefined'&&typeof _0x40eb35[_0xf55e('0x32')]==='undefined';var _0x3e2a57=_0x202dcd[_0xf55e('0x33')];var _0x2196ae=_0x8bc4f8?0x0:_0x40eb35[_0xf55e('0x34')];var _0x3af3f5=_0x8bc4f8?_0x202dcd[_0xf55e('0x33')]:_0x40eb35[_0xf55e('0x34')]+_0x40eb35[_0xf55e('0x32')];var _0x5b1a92;if(_0x3af3f5>=_0x3e2a57){_0x3af3f5=_0x3e2a57;_0x5b1a92=0xc8;}else{_0x5b1a92=0xce;}_0x337eee['status'](_0x5b1a92);return _0x337eee['set'](_0xf55e('0x35'),_0x2196ae+'-'+_0x3af3f5+'/'+_0x3e2a57)[_0xf55e('0x31')](_0x202dcd);}return null;};}function patchUpdates(_0xdbf42a){return function(_0x4fa19e){try{jsonpatch[_0xf55e('0x36')](_0x4fa19e,_0xdbf42a,!![]);}catch(_0x1455a5){return BPromise['reject'](_0x1455a5);}return _0x4fa19e[_0xf55e('0x37')]();};}function saveUpdates(_0xb1cf74,_0x426385){return function(_0x634fc8){if(_0x634fc8){return _0x634fc8[_0xf55e('0x38')](_0xb1cf74)[_0xf55e('0x23')](function(_0x4843e1){return _0x4843e1;});}return null;};}function removeEntity(_0x237ab8,_0x53d897){return function(_0x2abf92){if(_0x2abf92){return _0x2abf92[_0xf55e('0x39')]()['then'](function(){_0x237ab8[_0xf55e('0x2f')](0xcc)[_0xf55e('0x30')]();});}};}function handleEntityNotFound(_0x5b5502,_0xdeb28a){return function(_0x12aaf4){if(!_0x12aaf4){_0x5b5502[_0xf55e('0x2e')](0x194);}return _0x12aaf4;};}function handleError(_0x276567,_0x40235c){_0x40235c=_0x40235c||0x1f4;return function(_0x5713dd){logger[_0xf55e('0x29')](_0x5713dd[_0xf55e('0x3a')]);if(_0x5713dd['name']){delete _0x5713dd[_0xf55e('0x3b')];}_0x276567['status'](_0x40235c)[_0xf55e('0x3c')](_0x5713dd);};}exports['index']=function(_0x51ca40,_0x4541fb){var _0x22662d={},_0x5f2cf9={},_0x54ae50={'count':0x0,'rows':[]};var _0x564923=_[_0xf55e('0x3d')](db[_0xf55e('0x3e')]['rawAttributes'],function(_0x13f1cc){return{'name':_0x13f1cc['fieldName'],'type':_0x13f1cc[_0xf55e('0x3f')]['key']};});_0x5f2cf9[_0xf55e('0x40')]=_[_0xf55e('0x3d')](_0x564923,_0xf55e('0x3b'));_0x5f2cf9[_0xf55e('0x41')]=_[_0xf55e('0x42')](_0x51ca40['query']);_0x5f2cf9[_0xf55e('0x43')]=_['intersection'](_0x5f2cf9['model'],_0x5f2cf9[_0xf55e('0x41')]);_0x22662d[_0xf55e('0x44')]=_[_0xf55e('0x45')](_0x5f2cf9['model'],qs[_0xf55e('0x46')](_0x51ca40[_0xf55e('0x41')]['fields']));_0x22662d['attributes']=_0x22662d['attributes'][_0xf55e('0x47')]?_0x22662d[_0xf55e('0x44')]:_0x5f2cf9[_0xf55e('0x40')];if(!_0x51ca40['query'][_0xf55e('0x48')](_0xf55e('0x49'))){_0x22662d[_0xf55e('0x32')]=qs[_0xf55e('0x32')](_0x51ca40['query']['limit']);_0x22662d[_0xf55e('0x34')]=qs['offset'](_0x51ca40['query'][_0xf55e('0x34')]);}_0x22662d['order']=qs[_0xf55e('0x4a')](_0x51ca40[_0xf55e('0x41')]['sort']);_0x22662d[_0xf55e('0x4b')]=qs[_0xf55e('0x43')](_[_0xf55e('0x4c')](_0x51ca40[_0xf55e('0x41')],_0x5f2cf9[_0xf55e('0x43')]),_0x564923);if(_0x51ca40['query'][_0xf55e('0x4d')]){_0x22662d[_0xf55e('0x4b')]=_['merge'](_0x22662d[_0xf55e('0x4b')],{'$or':_[_0xf55e('0x3d')](_0x564923,function(_0x3c9bcd){if(_0x3c9bcd[_0xf55e('0x3f')]!==_0xf55e('0x4e')){var _0x31bad8={};_0x31bad8[_0x3c9bcd[_0xf55e('0x3b')]]={'$like':'%'+_0x51ca40[_0xf55e('0x41')][_0xf55e('0x4d')]+'%'};return _0x31bad8;}})});}_0x22662d=_[_0xf55e('0x4f')]({},_0x22662d,_0x51ca40[_0xf55e('0x50')]);var _0x539771={'where':_0x22662d[_0xf55e('0x4b')]};return db[_0xf55e('0x3e')][_0xf55e('0x33')](_0x539771)[_0xf55e('0x23')](function(_0x285840){_0x54ae50[_0xf55e('0x33')]=_0x285840;if(_0x51ca40[_0xf55e('0x41')][_0xf55e('0x51')]){_0x22662d[_0xf55e('0x52')]=[{'all':!![]}];}return db[_0xf55e('0x3e')][_0xf55e('0x53')](_0x22662d);})[_0xf55e('0x23')](function(_0xd06884){_0x54ae50[_0xf55e('0x54')]=_0xd06884;return _0x54ae50;})[_0xf55e('0x23')](respondWithFilteredResult(_0x4541fb,_0x22662d))['catch'](handleError(_0x4541fb,null));};exports['show']=function(_0x42967e,_0x122050){var _0x509813={'raw':!![],'where':{'id':_0x42967e[_0xf55e('0x55')]['id']}},_0x503e8f={};_0x503e8f[_0xf55e('0x40')]=_[_0xf55e('0x42')](db['ChatMessage']['rawAttributes']);_0x503e8f['query']=_[_0xf55e('0x42')](_0x42967e['query']);_0x503e8f[_0xf55e('0x43')]=_[_0xf55e('0x45')](_0x503e8f['model'],_0x503e8f[_0xf55e('0x41')]);_0x509813[_0xf55e('0x44')]=_[_0xf55e('0x45')](_0x503e8f['model'],qs[_0xf55e('0x46')](_0x42967e['query'][_0xf55e('0x46')]));_0x509813[_0xf55e('0x44')]=_0x509813[_0xf55e('0x44')][_0xf55e('0x47')]?_0x509813[_0xf55e('0x44')]:_0x503e8f[_0xf55e('0x40')];if(_0x42967e[_0xf55e('0x41')][_0xf55e('0x51')]){_0x509813[_0xf55e('0x52')]=[{'all':!![]}];}_0x509813=_[_0xf55e('0x4f')]({},_0x509813,_0x42967e[_0xf55e('0x50')]);return db[_0xf55e('0x3e')][_0xf55e('0x56')](_0x509813)[_0xf55e('0x23')](handleEntityNotFound(_0x122050,null))[_0xf55e('0x23')](respondWithResult(_0x122050,null))[_0xf55e('0x2d')](handleError(_0x122050,null));};exports[_0xf55e('0x57')]=function(_0xee0215,_0x326e6a){return db[_0xf55e('0x3e')]['create'](_0xee0215[_0xf55e('0x58')],{})['then'](respondWithResult(_0x326e6a,0xc9))['catch'](handleError(_0x326e6a,null));};exports[_0xf55e('0x38')]=function(_0x11aa5f,_0x74f271){if(_0x11aa5f['body']['id']){delete _0x11aa5f[_0xf55e('0x58')]['id'];}return db[_0xf55e('0x3e')][_0xf55e('0x56')]({'where':{'id':_0x11aa5f[_0xf55e('0x55')]['id']}})['then'](handleEntityNotFound(_0x74f271,null))['then'](saveUpdates(_0x11aa5f[_0xf55e('0x58')],null))[_0xf55e('0x23')](respondWithResult(_0x74f271,null))['catch'](handleError(_0x74f271,null));};exports[_0xf55e('0x39')]=function(_0x61d10d,_0x56d5c9){return db[_0xf55e('0x3e')][_0xf55e('0x56')]({'where':{'id':_0x61d10d[_0xf55e('0x55')]['id']}})[_0xf55e('0x23')](handleEntityNotFound(_0x56d5c9,null))[_0xf55e('0x23')](removeEntity(_0x56d5c9,null))['catch'](handleError(_0x56d5c9,null));};exports['describe']=function(_0x59dce5,_0x65ccc3){return db[_0xf55e('0x3e')][_0xf55e('0x59')]()[_0xf55e('0x23')](respondWithResult(_0x65ccc3,null))[_0xf55e('0x2d')](handleError(_0x65ccc3,null));};var interaction_log=require(_0xf55e('0x17'))(_0xf55e('0x5a'));exports[_0xf55e('0x5b')]=function(_0x597f92,_0x3500e0,_0x3843fb){var _0xe7e5a4={'agent':{},'channel':'chat'};if(_0x597f92[_0xf55e('0x58')]['id']){delete _0x597f92[_0xf55e('0x58')]['id'];}_0x597f92['body']['read']=!![];_0x597f92[_0xf55e('0x58')]['readAt']=moment()[_0xf55e('0x5c')](_0xf55e('0x5d'));_0x597f92['body'][_0xf55e('0x5e')]=_0x597f92[_0xf55e('0x58')][_0xf55e('0x5e')]||_0x597f92['user']['id'];_0xe7e5a4[_0xf55e('0x5f')]['id']=_0x597f92[_0xf55e('0x58')][_0xf55e('0x5e')];return db[_0xf55e('0x3e')][_0xf55e('0x56')]({'where':{'id':_0x597f92[_0xf55e('0x55')]['id'],'UserId':null}})[_0xf55e('0x23')](handleEntityNotFound(_0x3500e0,null))[_0xf55e('0x23')](saveUpdates(_0x597f92[_0xf55e('0x58')],null))['then'](function(_0x4095be){if(_0x4095be){_0xe7e5a4['message']=_0x4095be[_0xf55e('0x60')]({'plain':!![]});return db[_0xf55e('0x61')][_0xf55e('0x56')]({'where':{'id':_0x4095be[_0xf55e('0x62')]}});}return null;})[_0xf55e('0x23')](handleEntityNotFound(_0x3500e0,null))['then'](function(_0x1e14ac){if(_0x1e14ac){return _0x1e14ac['update']({'UserId':_0x597f92[_0xf55e('0x58')][_0xf55e('0x5e')],'read1stAt':_[_0xf55e('0x63')](_0x1e14ac['read1stAt'])?moment()[_0xf55e('0x5c')](_0xf55e('0x5d')):undefined});}return null;})['then'](function(_0x360611){if(_0x360611){_0xe7e5a4[_0xf55e('0x64')]=_0x360611[_0xf55e('0x60')]({'plain':!![]});interaction_log[_0xf55e('0x24')]('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x597f92[_0xf55e('0x65')]['id'],_0x597f92[_0xf55e('0x65')][_0xf55e('0x3b')],_0x597f92['user'][_0xf55e('0x66')],_0xe7e5a4['interaction']['id'],_0x597f92['body']?JSON[_0xf55e('0x67')](_0x597f92[_0xf55e('0x58')]):_0xf55e('0x68'));return respondWithRpcPromise(_0xf55e('0x69'),_0xf55e('0x6a'),_0xe7e5a4);}return null;})[_0xf55e('0x23')](function(_0x8f81bf){var _0x565655=_0xf55e('0x6b')+_0x8f81bf[_0xf55e('0x2b')][_0xf55e('0x6c')];return db[_0xf55e('0x6d')][_0xf55e('0x41')](_0x565655,{'type':db[_0xf55e('0x6e')]['QueryTypes'][_0xf55e('0x6f')],'raw':!![]})['then'](function(_0x3ee333){return _0x3ee333;});})['then'](function(_0x1e39fe){if(_0x1e39fe){_0xe7e5a4[_0xf55e('0x2b')][_0xf55e('0x70')]=_0x1e39fe[0x0];if(!_0x597f92[_0xf55e('0x58')][_0xf55e('0x5e')])return;return db[_0xf55e('0x71')][_0xf55e('0x56')]({'where':{'id':_0x597f92[_0xf55e('0x58')][_0xf55e('0x5e')],'role':'agent'},'attributes':['id',_0xf55e('0x3b'),_0xf55e('0x72'),_0xf55e('0x73'),_0xf55e('0x74')],'raw':!![]});}return null;})[_0xf55e('0x23')](function(_0x3f38b6){if(!_0x3f38b6)return null;_0xe7e5a4[_0xf55e('0x2b')][_0xf55e('0x5f')]=_0x3f38b6;return _0xe7e5a4;})['then'](function(_0x4a363f){if(_0x4a363f){if(_0x597f92['body']['manual']){_0xe7e5a4['message']['interface']=util[_0xf55e('0x5c')]('SIP/%s',_0x597f92[_0xf55e('0x65')]['name']);_0xe7e5a4[_0xf55e('0x2b')][_0xf55e('0x75')]=_0xe7e5a4[_0xf55e('0x75')];_0xe7e5a4[_0xf55e('0x2b')][_0xf55e('0x76')]=_0xe7e5a4[_0xf55e('0x75')];_0xe7e5a4[_0xf55e('0x2b')][_0xf55e('0x77')]=_0xf55e('0x5b');return respondWithRpcPromise(_0xf55e('0x78'),'EventManager',{'event':_0xf55e('0x79'),'message':_[_0xf55e('0x4f')](_0xe7e5a4[_0xf55e('0x2b')],JSON[_0xf55e('0x7a')](_0xe7e5a4[_0xf55e('0x64')][_0xf55e('0x7b')]))},client9002)[_0xf55e('0x23')](function(){return _0xe7e5a4;});}return _0xe7e5a4;}return null;})[_0xf55e('0x23')](respondWithResult(_0x3500e0,null))['catch'](handleError(_0x3500e0,null));};var interaction_log=require(_0xf55e('0x17'))(_0xf55e('0x5a'));exports[_0xf55e('0x7c')]=function(_0x41d51d,_0x7318c9,_0x10dce5){var _0x436622={'agent':{},'channel':_0xf55e('0x7d')};if(_0x41d51d[_0xf55e('0x58')]['id']){delete _0x41d51d['body']['id'];}_0x41d51d[_0xf55e('0x58')]['UserId']=_0x41d51d[_0xf55e('0x58')]['UserId']||_0x41d51d[_0xf55e('0x65')]['id'];_0x436622[_0xf55e('0x5f')]['id']=_0x41d51d['body'][_0xf55e('0x5e')];return db[_0xf55e('0x3e')][_0xf55e('0x56')]({'where':{'id':_0x41d51d[_0xf55e('0x55')]['id'],'UserId':null}})[_0xf55e('0x23')](handleEntityNotFound(_0x7318c9,null))[_0xf55e('0x23')](function(_0x438844){if(_0x438844){_0x436622[_0xf55e('0x2b')]=_0x438844[_0xf55e('0x60')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x438844['ChatInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x7318c9,null))[_0xf55e('0x23')](function(_0x1d8cc7){if(_0x1d8cc7){_0x436622[_0xf55e('0x64')]=_0x1d8cc7['get']({'plain':!![]});interaction_log[_0xf55e('0x24')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x41d51d['user']['id'],_0x41d51d['user'][_0xf55e('0x3b')],_0x41d51d[_0xf55e('0x65')][_0xf55e('0x66')],_0x436622['interaction']['id'],_0x41d51d['body']?JSON[_0xf55e('0x67')](_0x41d51d[_0xf55e('0x58')]):_0xf55e('0x68'));return respondWithRpcPromise(_0xf55e('0x7e'),_0xf55e('0x7f'),_0x436622);}return null;})[_0xf55e('0x23')](function(_0x4f347d){var _0x33e734=_0xf55e('0x6b')+_0x4f347d[_0xf55e('0x2b')]['ContactId'];return db['sequelize'][_0xf55e('0x41')](_0x33e734,{'type':db[_0xf55e('0x6e')][_0xf55e('0x80')]['SELECT'],'raw':!![]})[_0xf55e('0x23')](function(_0x135c1c){return _0x135c1c;});})[_0xf55e('0x23')](function(_0x16cc30){if(_0x16cc30){_0x436622[_0xf55e('0x2b')][_0xf55e('0x70')]=_0x16cc30[0x0];if(!_0x41d51d[_0xf55e('0x58')][_0xf55e('0x5e')])return;return db[_0xf55e('0x71')][_0xf55e('0x56')]({'where':{'id':_0x41d51d[_0xf55e('0x58')][_0xf55e('0x5e')],'role':_0xf55e('0x5f')},'attributes':['id',_0xf55e('0x3b'),'fullname',_0xf55e('0x73'),_0xf55e('0x74')],'raw':!![]});}return null;})[_0xf55e('0x23')](function(_0x48642b){if(!_0x48642b)return null;_0x436622[_0xf55e('0x2b')][_0xf55e('0x5f')]=_0x48642b;return _0x436622;})['then'](function(_0x24ae1c){if(_0x24ae1c){_0x24ae1c[_0xf55e('0x2b')][_0xf55e('0x81')]=util[_0xf55e('0x5c')]('SIP/%s',_0x41d51d['user'][_0xf55e('0x3b')]);_0x24ae1c[_0xf55e('0x2b')][_0xf55e('0x75')]=_0x436622[_0xf55e('0x75')];_0x24ae1c['message'][_0xf55e('0x76')]=_0x436622[_0xf55e('0x75')];_0x24ae1c['message'][_0xf55e('0x77')]=_0xf55e('0x7c');respondWithRpcPromise(_0xf55e('0x78'),_0xf55e('0x78'),{'event':_0xf55e('0x82'),'message':_[_0xf55e('0x4f')](_0x436622[_0xf55e('0x2b')],JSON[_0xf55e('0x7a')](_0x436622[_0xf55e('0x64')][_0xf55e('0x7b')]))},client9002);return _0x436622;}return null;})[_0xf55e('0x23')](respondWithResult(_0x7318c9,null))[_0xf55e('0x2d')](handleError(_0x7318c9,null));}; \ No newline at end of file +var _0xae34=['findAll','rows','show','params','includeAll','find','create','body','destroy','describe','../../config/logger','chat-interactions','accept','chat','read','readAt','UserId','user','agent','get','ChatInteraction','ChatInteractionId','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','format','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','parse','formData','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','contact','rejectmessage','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','then','end','sendStatus','stack','name','send','index','map','ChatMessage','rawAttributes','type','key','model','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include'];(function(_0x4551f6,_0x48151b){var _0x581dc2=function(_0x1842af){while(--_0x1842af){_0x4551f6['push'](_0x4551f6['shift']());}};_0x581dc2(++_0x48151b);}(_0xae34,0xbe));var _0x4ae3=function(_0x2f1e5f,_0x2d9ca9){_0x2f1e5f=_0x2f1e5f-0x0;var _0x16328c=_0xae34[_0x2f1e5f];return _0x16328c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4ae3('0x0'));var zipdir=require(_0x4ae3('0x1'));var jsonpatch=require(_0x4ae3('0x2'));var rp=require('request-promise');var moment=require(_0x4ae3('0x3'));var BPromise=require(_0x4ae3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x4ae3('0x5'));var sox=require(_0x4ae3('0x6'));var csv=require('to-csv');var ejs=require(_0x4ae3('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4ae3('0x8'));var squel=require(_0x4ae3('0x9'));var crypto=require(_0x4ae3('0xa'));var jsforce=require(_0x4ae3('0xb'));var deskjs=require(_0x4ae3('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4ae3('0xd'));var Papa=require('papaparse');var Redis=require(_0x4ae3('0xe'));var authService=require(_0x4ae3('0xf'));var qs=require(_0x4ae3('0x10'));var as=require(_0x4ae3('0x11'));var hardwareService=require(_0x4ae3('0x12'));var logger=require('../../config/logger')(_0x4ae3('0x13'));var utils=require(_0x4ae3('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x4ae3('0x15'));var db=require(_0x4ae3('0x16'))['db'];config[_0x4ae3('0x17')]=_[_0x4ae3('0x18')](config[_0x4ae3('0x17')],{'host':_0x4ae3('0x19'),'port':0x18eb});var socket=require(_0x4ae3('0x1a'))(new Redis(config[_0x4ae3('0x17')]));require(_0x4ae3('0x1b'))[_0x4ae3('0x1c')](socket);var jayson=require(_0x4ae3('0x1d'));var client=jayson[_0x4ae3('0x1e')][_0x4ae3('0x1f')]({'port':0x232c});var client9002=jayson[_0x4ae3('0x1e')][_0x4ae3('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x56c7f3,_0x28bdd2,_0x29a6aa,_0x3e7836){return new BPromise(function(_0x32b06b,_0x1f44aa){var _0x4c0bfd=_0x3e7836||client;return _0x4c0bfd[_0x4ae3('0x20')](_0x56c7f3,_0x29a6aa)['then'](function(_0x23583e){logger[_0x4ae3('0x21')](_0x4ae3('0x22'),_0x28bdd2,_0x4ae3('0x23'));logger['debug']('ChatMessage,\x20%s,\x20%s,\x20%s',_0x28bdd2,'request\x20sent',JSON[_0x4ae3('0x24')](_0x23583e));if(_0x23583e[_0x4ae3('0x25')]){if(_0x23583e[_0x4ae3('0x25')]['code']===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x28bdd2,_0x23583e['error']['message']);return _0x1f44aa(_0x23583e[_0x4ae3('0x25')][_0x4ae3('0x26')]);}logger[_0x4ae3('0x25')](_0x4ae3('0x22'),_0x28bdd2,_0x23583e[_0x4ae3('0x25')][_0x4ae3('0x26')]);return _0x32b06b(_0x23583e[_0x4ae3('0x25')][_0x4ae3('0x26')]);}else{logger[_0x4ae3('0x21')](_0x4ae3('0x22'),_0x28bdd2,_0x4ae3('0x23'));_0x32b06b(_0x23583e[_0x4ae3('0x27')][_0x4ae3('0x26')]);}})[_0x4ae3('0x28')](function(_0x5469cf){logger['error']('ChatMessage,\x20%s,\x20%s',_0x28bdd2,_0x5469cf);_0x1f44aa(_0x5469cf);});});}function respondWithStatusCode(_0xc7a3d8,_0x40ce02){_0x40ce02=_0x40ce02||0xcc;return function(_0x40a069){if(_0x40a069){return _0xc7a3d8['sendStatus'](_0x40ce02);}return _0xc7a3d8[_0x4ae3('0x29')](_0x40ce02)['end']();};}function respondWithResult(_0x45a55e,_0x17e634){_0x17e634=_0x17e634||0xc8;return function(_0x479f31){if(_0x479f31){return _0x45a55e[_0x4ae3('0x29')](_0x17e634)[_0x4ae3('0x2a')](_0x479f31);}};}function respondWithFilteredResult(_0x107fe6,_0x2d9b16){return function(_0x312e00){if(_0x312e00){var _0xeed231=typeof _0x2d9b16['offset']==='undefined'&&typeof _0x2d9b16['limit']===_0x4ae3('0x2b');var _0x8221a6=_0x312e00[_0x4ae3('0x2c')];var _0x4d4ac8=_0xeed231?0x0:_0x2d9b16[_0x4ae3('0x2d')];var _0x3044f7=_0xeed231?_0x312e00['count']:_0x2d9b16[_0x4ae3('0x2d')]+_0x2d9b16[_0x4ae3('0x2e')];var _0x28efe8;if(_0x3044f7>=_0x8221a6){_0x3044f7=_0x8221a6;_0x28efe8=0xc8;}else{_0x28efe8=0xce;}_0x107fe6['status'](_0x28efe8);return _0x107fe6[_0x4ae3('0x2f')](_0x4ae3('0x30'),_0x4d4ac8+'-'+_0x3044f7+'/'+_0x8221a6)[_0x4ae3('0x2a')](_0x312e00);}return null;};}function patchUpdates(_0x9f0ef){return function(_0x5a99dc){try{jsonpatch[_0x4ae3('0x31')](_0x5a99dc,_0x9f0ef,!![]);}catch(_0x596cec){return BPromise[_0x4ae3('0x32')](_0x596cec);}return _0x5a99dc['save']();};}function saveUpdates(_0x35917b,_0x26e75f){return function(_0x3e206f){if(_0x3e206f){return _0x3e206f[_0x4ae3('0x33')](_0x35917b)['then'](function(_0x38529e){return _0x38529e;});}return null;};}function removeEntity(_0x2bf544,_0x21adb6){return function(_0x3f6f57){if(_0x3f6f57){return _0x3f6f57['destroy']()[_0x4ae3('0x34')](function(){_0x2bf544['status'](0xcc)[_0x4ae3('0x35')]();});}};}function handleEntityNotFound(_0x168d08,_0x3610ed){return function(_0x3aae99){if(!_0x3aae99){_0x168d08[_0x4ae3('0x36')](0x194);}return _0x3aae99;};}function handleError(_0xd45f1e,_0x5edb71){_0x5edb71=_0x5edb71||0x1f4;return function(_0x505adb){logger[_0x4ae3('0x25')](_0x505adb[_0x4ae3('0x37')]);if(_0x505adb[_0x4ae3('0x38')]){delete _0x505adb[_0x4ae3('0x38')];}_0xd45f1e[_0x4ae3('0x29')](_0x5edb71)[_0x4ae3('0x39')](_0x505adb);};}exports[_0x4ae3('0x3a')]=function(_0x2049d8,_0x41b64b){var _0x363bba={},_0x531cea={},_0x167db6={'count':0x0,'rows':[]};var _0x5d61a3=_[_0x4ae3('0x3b')](db[_0x4ae3('0x3c')][_0x4ae3('0x3d')],function(_0x71dba0){return{'name':_0x71dba0['fieldName'],'type':_0x71dba0[_0x4ae3('0x3e')][_0x4ae3('0x3f')]};});_0x531cea[_0x4ae3('0x40')]=_[_0x4ae3('0x3b')](_0x5d61a3,_0x4ae3('0x38'));_0x531cea['query']=_[_0x4ae3('0x41')](_0x2049d8['query']);_0x531cea[_0x4ae3('0x42')]=_[_0x4ae3('0x43')](_0x531cea['model'],_0x531cea['query']);_0x363bba['attributes']=_['intersection'](_0x531cea[_0x4ae3('0x40')],qs[_0x4ae3('0x44')](_0x2049d8[_0x4ae3('0x45')][_0x4ae3('0x44')]));_0x363bba[_0x4ae3('0x46')]=_0x363bba['attributes'][_0x4ae3('0x47')]?_0x363bba[_0x4ae3('0x46')]:_0x531cea[_0x4ae3('0x40')];if(!_0x2049d8[_0x4ae3('0x45')][_0x4ae3('0x48')](_0x4ae3('0x49'))){_0x363bba['limit']=qs[_0x4ae3('0x2e')](_0x2049d8['query'][_0x4ae3('0x2e')]);_0x363bba['offset']=qs[_0x4ae3('0x2d')](_0x2049d8[_0x4ae3('0x45')]['offset']);}_0x363bba['order']=qs['sort'](_0x2049d8[_0x4ae3('0x45')][_0x4ae3('0x4a')]);_0x363bba[_0x4ae3('0x4b')]=qs[_0x4ae3('0x42')](_[_0x4ae3('0x4c')](_0x2049d8[_0x4ae3('0x45')],_0x531cea[_0x4ae3('0x42')]),_0x5d61a3);if(_0x2049d8[_0x4ae3('0x45')][_0x4ae3('0x4d')]){_0x363bba[_0x4ae3('0x4b')]=_[_0x4ae3('0x4e')](_0x363bba['where'],{'$or':_[_0x4ae3('0x3b')](_0x5d61a3,function(_0x37466f){if(_0x37466f[_0x4ae3('0x3e')]!==_0x4ae3('0x4f')){var _0xb1377={};_0xb1377[_0x37466f[_0x4ae3('0x38')]]={'$like':'%'+_0x2049d8[_0x4ae3('0x45')][_0x4ae3('0x4d')]+'%'};return _0xb1377;}})});}_0x363bba=_[_0x4ae3('0x4e')]({},_0x363bba,_0x2049d8[_0x4ae3('0x50')]);var _0xe5e3ce={'where':_0x363bba[_0x4ae3('0x4b')]};return db[_0x4ae3('0x3c')][_0x4ae3('0x2c')](_0xe5e3ce)[_0x4ae3('0x34')](function(_0xf7ce81){_0x167db6['count']=_0xf7ce81;if(_0x2049d8['query']['includeAll']){_0x363bba[_0x4ae3('0x51')]=[{'all':!![]}];}return db['ChatMessage'][_0x4ae3('0x52')](_0x363bba);})[_0x4ae3('0x34')](function(_0x2aeed2){_0x167db6[_0x4ae3('0x53')]=_0x2aeed2;return _0x167db6;})['then'](respondWithFilteredResult(_0x41b64b,_0x363bba))['catch'](handleError(_0x41b64b,null));};exports[_0x4ae3('0x54')]=function(_0x25ac51,_0x49eb5f){var _0x2c9a37={'raw':!![],'where':{'id':_0x25ac51[_0x4ae3('0x55')]['id']}},_0x2d00b4={};_0x2d00b4[_0x4ae3('0x40')]=_[_0x4ae3('0x41')](db[_0x4ae3('0x3c')][_0x4ae3('0x3d')]);_0x2d00b4['query']=_['keys'](_0x25ac51[_0x4ae3('0x45')]);_0x2d00b4[_0x4ae3('0x42')]=_['intersection'](_0x2d00b4[_0x4ae3('0x40')],_0x2d00b4[_0x4ae3('0x45')]);_0x2c9a37[_0x4ae3('0x46')]=_['intersection'](_0x2d00b4[_0x4ae3('0x40')],qs[_0x4ae3('0x44')](_0x25ac51['query'][_0x4ae3('0x44')]));_0x2c9a37[_0x4ae3('0x46')]=_0x2c9a37[_0x4ae3('0x46')][_0x4ae3('0x47')]?_0x2c9a37[_0x4ae3('0x46')]:_0x2d00b4['model'];if(_0x25ac51[_0x4ae3('0x45')][_0x4ae3('0x56')]){_0x2c9a37[_0x4ae3('0x51')]=[{'all':!![]}];}_0x2c9a37=_[_0x4ae3('0x4e')]({},_0x2c9a37,_0x25ac51[_0x4ae3('0x50')]);return db[_0x4ae3('0x3c')][_0x4ae3('0x57')](_0x2c9a37)[_0x4ae3('0x34')](handleEntityNotFound(_0x49eb5f,null))['then'](respondWithResult(_0x49eb5f,null))[_0x4ae3('0x28')](handleError(_0x49eb5f,null));};exports[_0x4ae3('0x58')]=function(_0x2ac874,_0x53e9d6){return db[_0x4ae3('0x3c')][_0x4ae3('0x58')](_0x2ac874[_0x4ae3('0x59')],{})['then'](respondWithResult(_0x53e9d6,0xc9))[_0x4ae3('0x28')](handleError(_0x53e9d6,null));};exports[_0x4ae3('0x33')]=function(_0x23159e,_0x450bd3){if(_0x23159e[_0x4ae3('0x59')]['id']){delete _0x23159e[_0x4ae3('0x59')]['id'];}return db[_0x4ae3('0x3c')][_0x4ae3('0x57')]({'where':{'id':_0x23159e[_0x4ae3('0x55')]['id']}})[_0x4ae3('0x34')](handleEntityNotFound(_0x450bd3,null))[_0x4ae3('0x34')](saveUpdates(_0x23159e[_0x4ae3('0x59')],null))[_0x4ae3('0x34')](respondWithResult(_0x450bd3,null))[_0x4ae3('0x28')](handleError(_0x450bd3,null));};exports[_0x4ae3('0x5a')]=function(_0x3bd136,_0x7f1f35){return db[_0x4ae3('0x3c')][_0x4ae3('0x57')]({'where':{'id':_0x3bd136['params']['id']}})[_0x4ae3('0x34')](handleEntityNotFound(_0x7f1f35,null))['then'](removeEntity(_0x7f1f35,null))[_0x4ae3('0x28')](handleError(_0x7f1f35,null));};exports[_0x4ae3('0x5b')]=function(_0x529b56,_0x20f1f2){return db[_0x4ae3('0x3c')][_0x4ae3('0x5b')]()[_0x4ae3('0x34')](respondWithResult(_0x20f1f2,null))[_0x4ae3('0x28')](handleError(_0x20f1f2,null));};var interaction_log=require(_0x4ae3('0x5c'))(_0x4ae3('0x5d'));exports[_0x4ae3('0x5e')]=function(_0x30dea3,_0x22c7cf,_0x2d4599){var _0x5f277b={'agent':{},'channel':_0x4ae3('0x5f')};if(_0x30dea3[_0x4ae3('0x59')]['id']){delete _0x30dea3[_0x4ae3('0x59')]['id'];}_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x60')]=!![];_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x61')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x62')]=_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x62')]||_0x30dea3[_0x4ae3('0x63')]['id'];_0x5f277b[_0x4ae3('0x64')]['id']=_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x62')];return db['ChatMessage'][_0x4ae3('0x57')]({'where':{'id':_0x30dea3['params']['id'],'UserId':null}})[_0x4ae3('0x34')](handleEntityNotFound(_0x22c7cf,null))[_0x4ae3('0x34')](saveUpdates(_0x30dea3[_0x4ae3('0x59')],null))['then'](function(_0x37fece){if(_0x37fece){_0x5f277b[_0x4ae3('0x26')]=_0x37fece[_0x4ae3('0x65')]({'plain':!![]});return db[_0x4ae3('0x66')]['find']({'where':{'id':_0x37fece[_0x4ae3('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x22c7cf,null))[_0x4ae3('0x34')](function(_0xdc42d1){if(_0xdc42d1){return _0xdc42d1['update']({'UserId':_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x62')],'read1stAt':_['isNil'](_0xdc42d1[_0x4ae3('0x68')])?moment()['format'](_0x4ae3('0x69')):undefined});}return null;})[_0x4ae3('0x34')](function(_0x2048f9){if(_0x2048f9){_0x5f277b[_0x4ae3('0x6a')]=_0x2048f9['get']({'plain':!![]});interaction_log['info']('[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x30dea3['user']['id'],_0x30dea3[_0x4ae3('0x63')][_0x4ae3('0x38')],_0x30dea3[_0x4ae3('0x63')][_0x4ae3('0x6b')],_0x5f277b['interaction']['id'],_0x30dea3[_0x4ae3('0x59')]?JSON[_0x4ae3('0x24')](_0x30dea3['body']):'null');return respondWithRpcPromise(_0x4ae3('0x6c'),_0x4ae3('0x6d'),_0x5f277b);}return null;})[_0x4ae3('0x34')](function(_0x2fa4cf){var _0x42e636=_0x4ae3('0x6e')+_0x2fa4cf[_0x4ae3('0x26')][_0x4ae3('0x6f')];return db[_0x4ae3('0x70')][_0x4ae3('0x45')](_0x42e636,{'type':db[_0x4ae3('0x71')][_0x4ae3('0x72')][_0x4ae3('0x73')],'raw':!![]})[_0x4ae3('0x34')](function(_0x33529c){return _0x33529c;});})[_0x4ae3('0x34')](function(_0x3491b4){if(_0x3491b4){_0x5f277b[_0x4ae3('0x26')]['contact']=_0x3491b4[0x0];if(!_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x62')])return;return db[_0x4ae3('0x74')]['find']({'where':{'id':_0x30dea3[_0x4ae3('0x59')]['UserId'],'role':_0x4ae3('0x64')},'attributes':['id',_0x4ae3('0x38'),_0x4ae3('0x75'),_0x4ae3('0x76'),_0x4ae3('0x77')],'raw':!![]});}return null;})[_0x4ae3('0x34')](function(_0x67eb75){if(!_0x67eb75)return null;_0x5f277b[_0x4ae3('0x26')][_0x4ae3('0x64')]=_0x67eb75;return _0x5f277b;})['then'](function(_0x26ddf0){if(_0x26ddf0){if(_0x30dea3[_0x4ae3('0x59')][_0x4ae3('0x78')]){_0x5f277b['message'][_0x4ae3('0x79')]=util[_0x4ae3('0x7a')](_0x4ae3('0x7b'),_0x30dea3['user'][_0x4ae3('0x38')]);_0x5f277b[_0x4ae3('0x26')]['channel']=_0x5f277b[_0x4ae3('0x7c')];_0x5f277b['message'][_0x4ae3('0x7d')]=_0x5f277b[_0x4ae3('0x7c')];_0x5f277b[_0x4ae3('0x26')][_0x4ae3('0x7e')]=_0x4ae3('0x5e');return respondWithRpcPromise(_0x4ae3('0x7f'),_0x4ae3('0x7f'),{'event':_0x4ae3('0x80'),'message':_[_0x4ae3('0x4e')](_0x5f277b[_0x4ae3('0x26')],JSON[_0x4ae3('0x81')](_0x5f277b[_0x4ae3('0x6a')][_0x4ae3('0x82')]))},client9002)['then'](function(){return _0x5f277b;});}return _0x5f277b;}return null;})['then'](respondWithResult(_0x22c7cf,null))[_0x4ae3('0x28')](handleError(_0x22c7cf,null));};var interaction_log=require(_0x4ae3('0x5c'))(_0x4ae3('0x5d'));exports['reject']=function(_0x49920a,_0x875762,_0x34bdcc){var _0x3ee91a={'agent':{},'channel':_0x4ae3('0x5f')};if(_0x49920a[_0x4ae3('0x59')]['id']){delete _0x49920a[_0x4ae3('0x59')]['id'];}_0x49920a[_0x4ae3('0x59')][_0x4ae3('0x62')]=_0x49920a['body'][_0x4ae3('0x62')]||_0x49920a['user']['id'];_0x3ee91a[_0x4ae3('0x64')]['id']=_0x49920a[_0x4ae3('0x59')]['UserId'];return db[_0x4ae3('0x3c')][_0x4ae3('0x57')]({'where':{'id':_0x49920a[_0x4ae3('0x55')]['id'],'UserId':null}})[_0x4ae3('0x34')](handleEntityNotFound(_0x875762,null))[_0x4ae3('0x34')](function(_0x16344a){if(_0x16344a){_0x3ee91a[_0x4ae3('0x26')]=_0x16344a['get']({'plain':!![]});return db[_0x4ae3('0x66')][_0x4ae3('0x57')]({'where':{'id':_0x16344a[_0x4ae3('0x67')]}});}return null;})[_0x4ae3('0x34')](handleEntityNotFound(_0x875762,null))['then'](function(_0x41ab4f){if(_0x41ab4f){_0x3ee91a[_0x4ae3('0x6a')]=_0x41ab4f[_0x4ae3('0x65')]({'plain':!![]});interaction_log[_0x4ae3('0x21')](_0x4ae3('0x83'),_0x49920a[_0x4ae3('0x63')]['id'],_0x49920a[_0x4ae3('0x63')][_0x4ae3('0x38')],_0x49920a[_0x4ae3('0x63')][_0x4ae3('0x6b')],_0x3ee91a[_0x4ae3('0x6a')]['id'],_0x49920a[_0x4ae3('0x59')]?JSON['stringify'](_0x49920a[_0x4ae3('0x59')]):_0x4ae3('0x84'));return respondWithRpcPromise('RejectMessage',_0x4ae3('0x85'),_0x3ee91a);}return null;})[_0x4ae3('0x34')](function(_0x594fa1){var _0x4c5db7=_0x4ae3('0x6e')+_0x594fa1[_0x4ae3('0x26')][_0x4ae3('0x6f')];return db['sequelize'][_0x4ae3('0x45')](_0x4c5db7,{'type':db['Sequelize'][_0x4ae3('0x72')][_0x4ae3('0x73')],'raw':!![]})[_0x4ae3('0x34')](function(_0x3a9ddf){return _0x3a9ddf;});})[_0x4ae3('0x34')](function(_0x2315c6){if(_0x2315c6){_0x3ee91a[_0x4ae3('0x26')][_0x4ae3('0x86')]=_0x2315c6[0x0];if(!_0x49920a[_0x4ae3('0x59')][_0x4ae3('0x62')])return;return db[_0x4ae3('0x74')][_0x4ae3('0x57')]({'where':{'id':_0x49920a[_0x4ae3('0x59')]['UserId'],'role':_0x4ae3('0x64')},'attributes':['id',_0x4ae3('0x38'),_0x4ae3('0x75'),_0x4ae3('0x76'),_0x4ae3('0x77')],'raw':!![]});}return null;})[_0x4ae3('0x34')](function(_0x1eea37){if(!_0x1eea37)return null;_0x3ee91a[_0x4ae3('0x26')][_0x4ae3('0x64')]=_0x1eea37;return _0x3ee91a;})['then'](function(_0x2c1718){if(_0x2c1718){_0x2c1718[_0x4ae3('0x26')][_0x4ae3('0x79')]=util[_0x4ae3('0x7a')]('SIP/%s',_0x49920a[_0x4ae3('0x63')]['name']);_0x2c1718[_0x4ae3('0x26')][_0x4ae3('0x7c')]=_0x3ee91a[_0x4ae3('0x7c')];_0x2c1718[_0x4ae3('0x26')][_0x4ae3('0x7d')]=_0x3ee91a['channel'];_0x2c1718[_0x4ae3('0x26')][_0x4ae3('0x7e')]=_0x4ae3('0x32');respondWithRpcPromise(_0x4ae3('0x7f'),_0x4ae3('0x7f'),{'event':_0x4ae3('0x87'),'message':_[_0x4ae3('0x4e')](_0x3ee91a[_0x4ae3('0x26')],JSON[_0x4ae3('0x81')](_0x3ee91a['interaction'][_0x4ae3('0x82')]))},client9002);return _0x3ee91a;}return null;})['then'](respondWithResult(_0x875762,null))[_0x4ae3('0x28')](handleError(_0x875762,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5bf5c55..e36944f 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 _0x8caf=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','save'];(function(_0x1b767d,_0x3a5b43){var _0x1105d1=function(_0x390bd7){while(--_0x390bd7){_0x1b767d['push'](_0x1b767d['shift']());}};_0x1105d1(++_0x3a5b43);}(_0x8caf,0xba));var _0xf8ca=function(_0x464251,_0x41951f){_0x464251=_0x464251-0x0;var _0x47b041=_0x8caf[_0x464251];return _0x47b041;};'use strict';var EventEmitter=require(_0xf8ca('0x0'));var ChatMessage=require(_0xf8ca('0x1'))['db'][_0xf8ca('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf8ca('0x3'),'afterUpdate':_0xf8ca('0x4'),'afterDestroy':_0xf8ca('0x5')};function emitEvent(_0x29c085){return function(_0x58c33c,_0x249ac4,_0x556418){ChatMessageEvents[_0xf8ca('0x6')](_0x29c085+':'+_0x58c33c['id'],_0x58c33c);ChatMessageEvents[_0xf8ca('0x6')](_0x29c085,_0x58c33c);_0x556418(null);};}for(var e in events){if(events[_0xf8ca('0x7')](e)){var event=events[e];ChatMessage[_0xf8ca('0x8')](e,emitEvent(event));}}module[_0xf8ca('0x9')]=ChatMessageEvents; \ No newline at end of file +var _0x213b=['save','update','remove','emit','hasOwnProperty','exports','../../mysqldb','ChatMessage'];(function(_0x4ea6af,_0x4aa32e){var _0x4cb1e6=function(_0xc9edd0){while(--_0xc9edd0){_0x4ea6af['push'](_0x4ea6af['shift']());}};_0x4cb1e6(++_0x4aa32e);}(_0x213b,0x1a6));var _0xb213=function(_0x49bd2d,_0x249bea){_0x49bd2d=_0x49bd2d-0x0;var _0x740d0b=_0x213b[_0x49bd2d];return _0x740d0b;};'use strict';var EventEmitter=require('events');var ChatMessage=require(_0xb213('0x0'))['db'][_0xb213('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb213('0x2'),'afterUpdate':_0xb213('0x3'),'afterDestroy':_0xb213('0x4')};function emitEvent(_0xd891c5){return function(_0x352302,_0x54fdde,_0x3a43ab){ChatMessageEvents[_0xb213('0x5')](_0xd891c5+':'+_0x352302['id'],_0x352302);ChatMessageEvents[_0xb213('0x5')](_0xd891c5,_0x352302);_0x3a43ab(null);};}for(var e in events){if(events[_0xb213('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module[_0xb213('0x7')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index f551758..e9a69fe 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 _0x8c1a=['bluebird','request-promise','path','./chatMessage.attributes','ChatMessage','chat_messages','fti_chat_messages','body','get','direction','toLowerCase','out','UserId','ChatInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x8c1a,0x1ad));var _0xa8c1=function(_0x17730a,_0x362127){_0x17730a=_0x17730a-0x0;var _0x485db1=_0x8c1a[_0x17730a];return _0x485db1;};'use strict';var _=require(_0xa8c1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa8c1('0x1'));var moment=require(_0xa8c1('0x2'));var BPromise=require(_0xa8c1('0x3'));var rp=require(_0xa8c1('0x4'));var fs=require('fs');var path=require(_0xa8c1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa8c1('0x6'));module['exports']=function(_0x396c2e,_0x3d8943){return _0x396c2e['define'](_0xa8c1('0x7'),attributes,{'tableName':_0xa8c1('0x8'),'paranoid':![],'indexes':[{'name':_0xa8c1('0x9'),'fields':[_0xa8c1('0xa')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4892ab,_0xad239a,_0x305cd2){var _0x451e9e=_0x396c2e['models'];var _0x5db77e=_0x4892ab[_0xa8c1('0xb')]({'plain':!![]});if(_0x5db77e[_0xa8c1('0xc')][_0xa8c1('0xd')]()==='in'||_0x5db77e[_0xa8c1('0xc')][_0xa8c1('0xd')]()===_0xa8c1('0xe')&&!_0x5db77e['secret']&&!_['isNil'](_0x5db77e[_0xa8c1('0xf')])){_0x451e9e[_0xa8c1('0x10')][_0xa8c1('0x11')]({'where':{'id':_0x5db77e['ChatInteractionId']}})['then'](function(_0x5bc4a1){if(_0x5bc4a1){_0x5bc4a1[_0xa8c1('0x12')]({'lastMsgAt':_0x5db77e[_0xa8c1('0x13')],'lastMsgDirection':_0x5db77e[_0xa8c1('0xc')][_0xa8c1('0xd')]()});}})[_0xa8c1('0x14')](function(_0x105dc5){console[_0xa8c1('0x15')](_0x105dc5);});}_0x305cd2();}},'charset':_0xa8c1('0x16'),'collate':_0xa8c1('0x17')});}; \ No newline at end of file +var _0x3515=['exports','define','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','./chatMessage.attributes'];(function(_0x1f6112,_0x170dd9){var _0x1f696f=function(_0x191634){while(--_0x191634){_0x1f6112['push'](_0x1f6112['shift']());}};_0x1f696f(++_0x170dd9);}(_0x3515,0x1d9));var _0x5351=function(_0x468364,_0x1c9285){_0x468364=_0x468364-0x0;var _0x29efeb=_0x3515[_0x468364];return _0x29efeb;};'use strict';var _=require(_0x5351('0x0'));var util=require(_0x5351('0x1'));var logger=require(_0x5351('0x2'))('api');var moment=require(_0x5351('0x3'));var BPromise=require(_0x5351('0x4'));var rp=require(_0x5351('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x5351('0x6'));module[_0x5351('0x7')]=function(_0x6ae49,_0x3973df){return _0x6ae49[_0x5351('0x8')](_0x5351('0x9'),attributes,{'tableName':_0x5351('0xa'),'paranoid':![],'indexes':[{'name':_0x5351('0xb'),'fields':[_0x5351('0xc')],'type':_0x5351('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3677c9,_0xdb7118,_0x1a05dd){var _0x4c70c3=_0x6ae49[_0x5351('0xe')];var _0xe4fc91=_0x3677c9['get']({'plain':!![]});if(_0xe4fc91[_0x5351('0xf')]['toLowerCase']()==='in'||_0xe4fc91[_0x5351('0xf')][_0x5351('0x10')]()===_0x5351('0x11')&&!_0xe4fc91[_0x5351('0x12')]&&!_[_0x5351('0x13')](_0xe4fc91[_0x5351('0x14')])){_0x4c70c3[_0x5351('0x15')][_0x5351('0x16')]({'where':{'id':_0xe4fc91[_0x5351('0x17')]}})[_0x5351('0x18')](function(_0xc0ad54){if(_0xc0ad54){_0xc0ad54['update']({'lastMsgAt':_0xe4fc91[_0x5351('0x19')],'lastMsgDirection':_0xe4fc91[_0x5351('0xf')][_0x5351('0x10')]()});}})[_0x5351('0x1a')](function(_0x29133b){console[_0x5351('0x1b')](_0x29133b);});}_0x1a05dd();}},'charset':_0x5351('0x1c'),'collate':_0x5351('0x1d')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index f7f944f..57a5f7e 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 _0x8c9c=['catch','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatMessage.socket','register','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateChatMessage','ChatMessage','create','body','options','debug'];(function(_0x51ee07,_0x552e5c){var _0x30de31=function(_0x31d744){while(--_0x31d744){_0x51ee07['push'](_0x51ee07['shift']());}};_0x30de31(++_0x552e5c);}(_0x8c9c,0xf9));var _0xc8c9=function(_0x38ed84,_0x31718d){_0x38ed84=_0x38ed84-0x0;var _0x4bb181=_0x8c9c[_0x38ed84];return _0x4bb181;};'use strict';var _=require(_0xc8c9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc8c9('0x1'));var fs=require('fs');var Redis=require(_0xc8c9('0x2'));var db=require(_0xc8c9('0x3'))['db'];var utils=require(_0xc8c9('0x4'));var logger=require('../../config/logger')(_0xc8c9('0x5'));var config=require(_0xc8c9('0x6'));var jayson=require(_0xc8c9('0x7'));var client=jayson['client'][_0xc8c9('0x8')]({'port':0x232a});config[_0xc8c9('0x9')]=_[_0xc8c9('0xa')](config['redis'],{'host':_0xc8c9('0xb'),'port':0x18eb});var socket=require(_0xc8c9('0xc'))(new Redis(config[_0xc8c9('0x9')]));require(_0xc8c9('0xd'))[_0xc8c9('0xe')](socket);function respondWithRpcPromise(_0x2a1d66,_0x2fd9f1,_0x7de14a){return new BPromise(function(_0x31f530,_0x15d6bc){return client['request'](_0x2a1d66,_0x7de14a)[_0xc8c9('0xf')](function(_0x15988c){logger[_0xc8c9('0x10')](_0xc8c9('0x11'),_0x2fd9f1,_0xc8c9('0x12'));logger['debug'](_0xc8c9('0x13'),_0x2fd9f1,'request\x20sent',JSON[_0xc8c9('0x14')](_0x15988c));if(_0x15988c[_0xc8c9('0x15')]){if(_0x15988c[_0xc8c9('0x15')]['code']===0x1f4){logger['error'](_0xc8c9('0x11'),_0x2fd9f1,_0x15988c['error'][_0xc8c9('0x16')]);return _0x15d6bc(_0x15988c[_0xc8c9('0x15')][_0xc8c9('0x16')]);}logger['error'](_0xc8c9('0x11'),_0x2fd9f1,_0x15988c['error'][_0xc8c9('0x16')]);return _0x31f530(_0x15988c[_0xc8c9('0x15')][_0xc8c9('0x16')]);}else{logger[_0xc8c9('0x10')](_0xc8c9('0x11'),_0x2fd9f1,_0xc8c9('0x12'));_0x31f530(_0x15988c[_0xc8c9('0x17')][_0xc8c9('0x16')]);}})['catch'](function(_0x4c96e7){logger[_0xc8c9('0x15')](_0xc8c9('0x11'),_0x2fd9f1,_0x4c96e7);_0x15d6bc(_0x4c96e7);});});}exports[_0xc8c9('0x18')]=function(_0xbe10c5){var _0x2c45a6=this;return new Promise(function(_0x22d5fa,_0xbd65e7){return db[_0xc8c9('0x19')][_0xc8c9('0x1a')](_0xbe10c5[_0xc8c9('0x1b')],{'raw':_0xbe10c5[_0xc8c9('0x1c')]?_0xbe10c5[_0xc8c9('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0xc8c9('0xf')](function(_0xc7d63b){logger[_0xc8c9('0x10')](_0xc8c9('0x18'),_0xbe10c5);logger[_0xc8c9('0x1d')](_0xc8c9('0x18'),_0xbe10c5,JSON[_0xc8c9('0x14')](_0xc7d63b));_0x22d5fa(_0xc7d63b);})[_0xc8c9('0x1e')](function(_0x253f20){logger[_0xc8c9('0x15')](_0xc8c9('0x18'),_0x253f20['message'],_0xbe10c5);_0xbd65e7(_0x2c45a6['error'](0x1f4,_0x253f20[_0xc8c9('0x16')]));});});}; \ No newline at end of file +var _0xc03c=['localhost','socket.io-emitter','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateChatMessage','ChatMessage','create','body','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x548105,_0x42b075){var _0x14bf6a=function(_0x1972b6){while(--_0x1972b6){_0x548105['push'](_0x548105['shift']());}};_0x14bf6a(++_0x42b075);}(_0xc03c,0xae));var _0xcc03=function(_0xec034,_0x16c358){_0xec034=_0xec034-0x0;var _0x2c5a19=_0xc03c[_0xec034];return _0x2c5a19;};'use strict';var _=require(_0xcc03('0x0'));var util=require('util');var moment=require(_0xcc03('0x1'));var BPromise=require(_0xcc03('0x2'));var rs=require(_0xcc03('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcc03('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcc03('0x5'))(_0xcc03('0x6'));var config=require(_0xcc03('0x7'));var jayson=require(_0xcc03('0x8'));var client=jayson[_0xcc03('0x9')][_0xcc03('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xcc03('0xb')],{'host':_0xcc03('0xc'),'port':0x18eb});var socket=require(_0xcc03('0xd'))(new Redis(config[_0xcc03('0xb')]));require('./chatMessage.socket')[_0xcc03('0xe')](socket);function respondWithRpcPromise(_0x118b5b,_0x1d9aa2,_0x531544){return new BPromise(function(_0x196601,_0x4c51e1){return client[_0xcc03('0xf')](_0x118b5b,_0x531544)[_0xcc03('0x10')](function(_0x14d99e){logger[_0xcc03('0x11')](_0xcc03('0x12'),_0x1d9aa2,_0xcc03('0x13'));logger[_0xcc03('0x14')](_0xcc03('0x15'),_0x1d9aa2,'request\x20sent',JSON[_0xcc03('0x16')](_0x14d99e));if(_0x14d99e['error']){if(_0x14d99e[_0xcc03('0x17')]['code']===0x1f4){logger[_0xcc03('0x17')]('ChatMessage,\x20%s,\x20%s',_0x1d9aa2,_0x14d99e[_0xcc03('0x17')][_0xcc03('0x18')]);return _0x4c51e1(_0x14d99e[_0xcc03('0x17')][_0xcc03('0x18')]);}logger[_0xcc03('0x17')](_0xcc03('0x12'),_0x1d9aa2,_0x14d99e[_0xcc03('0x17')][_0xcc03('0x18')]);return _0x196601(_0x14d99e['error'][_0xcc03('0x18')]);}else{logger[_0xcc03('0x11')](_0xcc03('0x12'),_0x1d9aa2,_0xcc03('0x13'));_0x196601(_0x14d99e[_0xcc03('0x19')][_0xcc03('0x18')]);}})[_0xcc03('0x1a')](function(_0x41cf4a){logger['error'](_0xcc03('0x12'),_0x1d9aa2,_0x41cf4a);_0x4c51e1(_0x41cf4a);});});}exports[_0xcc03('0x1b')]=function(_0x5ed3d7){var _0x2ad5eb=this;return new Promise(function(_0x52faf7,_0x53ad01){return db[_0xcc03('0x1c')][_0xcc03('0x1d')](_0x5ed3d7[_0xcc03('0x1e')],{'raw':_0x5ed3d7['options']?_0x5ed3d7['options']['raw']===undefined?!![]:![]:!![]})[_0xcc03('0x10')](function(_0x32c93d){logger[_0xcc03('0x11')](_0xcc03('0x1b'),_0x5ed3d7);logger[_0xcc03('0x14')](_0xcc03('0x1b'),_0x5ed3d7,JSON[_0xcc03('0x16')](_0x32c93d));_0x52faf7(_0x32c93d);})['catch'](function(_0x32189c){logger[_0xcc03('0x17')]('CreateChatMessage',_0x32189c[_0xcc03('0x18')],_0x5ed3d7);_0x53ad01(_0x2ad5eb[_0xcc03('0x17')](0x1f4,_0x32189c[_0xcc03('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 8d4db73..6ba58ea 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 _0x3d6d=['update','emit','removeListener','length','./chatMessage.events','save','remove'];(function(_0x4d21b0,_0x54f2d1){var _0x3f1f1c=function(_0x2f31b4){while(--_0x2f31b4){_0x4d21b0['push'](_0x4d21b0['shift']());}};_0x3f1f1c(++_0x54f2d1);}(_0x3d6d,0xb3));var _0xd3d6=function(_0x1e6db3,_0x5643ac){_0x1e6db3=_0x1e6db3-0x0;var _0x1de886=_0x3d6d[_0x1e6db3];return _0x1de886;};'use strict';var ChatMessageEvents=require(_0xd3d6('0x0'));var events=[_0xd3d6('0x1'),_0xd3d6('0x2'),_0xd3d6('0x3')];function createListener(_0x380c09,_0x1e1915){return function(_0x366f41){_0x1e1915[_0xd3d6('0x4')](_0x380c09,_0x366f41);};}function removeListener(_0x297bd6,_0x3d5e37){return function(){ChatMessageEvents[_0xd3d6('0x5')](_0x297bd6,_0x3d5e37);};}exports['register']=function(_0x5400f8){for(var _0x3f36=0x0,_0x1f02f5=events[_0xd3d6('0x6')];_0x3f36<_0x1f02f5;_0x3f36++){var _0x3c2a9b=events[_0x3f36];var _0x4356b7=createListener('chatMessage:'+_0x3c2a9b,_0x5400f8);ChatMessageEvents['on'](_0x3c2a9b,_0x4356b7);}}; \ No newline at end of file +var _0xf3be=['chatMessage:','./chatMessage.events','save','remove','update','removeListener','register','length'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0xf3be,0x1e1));var _0xef3b=function(_0x3cdd6e,_0x576843){_0x3cdd6e=_0x3cdd6e-0x0;var _0x44d22d=_0xf3be[_0x3cdd6e];return _0x44d22d;};'use strict';var ChatMessageEvents=require(_0xef3b('0x0'));var events=[_0xef3b('0x1'),_0xef3b('0x2'),_0xef3b('0x3')];function createListener(_0x4d8b04,_0x373397){return function(_0x4ea3cf){_0x373397['emit'](_0x4d8b04,_0x4ea3cf);};}function removeListener(_0x55f249,_0x4bfc98){return function(){ChatMessageEvents[_0xef3b('0x4')](_0x55f249,_0x4bfc98);};}exports[_0xef3b('0x5')]=function(_0x48f499){for(var _0x3dfcc2=0x0,_0x3f7873=events[_0xef3b('0x6')];_0x3dfcc2<_0x3f7873;_0x3dfcc2++){var _0x19191a=events[_0x3dfcc2];var _0x47069a=createListener(_0xef3b('0x7')+_0x19191a,_0x48f499);ChatMessageEvents['on'](_0x19191a,_0x47069a);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index e4501b6..d53d9b4 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 _0xe5b4=['put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','isAuthenticated','index','get','/describe','/:id','show','chat','chatmessage:create','create'];(function(_0xb73009,_0x4b206f){var _0x272a63=function(_0x2109b2){while(--_0x2109b2){_0xb73009['push'](_0xb73009['shift']());}};_0x272a63(++_0x4b206f);}(_0xe5b4,0x117));var _0x4e5b=function(_0x535815,_0x1771a9){_0x535815=_0x535815-0x0;var _0x2e27e3=_0xe5b4[_0x535815];return _0x2e27e3;};'use strict';var multer=require('multer');var util=require(_0x4e5b('0x0'));var path=require(_0x4e5b('0x1'));var timeout=require(_0x4e5b('0x2'));var express=require('express');var router=express[_0x4e5b('0x3')]();var fs_extra=require(_0x4e5b('0x4'));var auth=require(_0x4e5b('0x5'));var interaction=require(_0x4e5b('0x6'));var config=require(_0x4e5b('0x7'));var controller=require(_0x4e5b('0x8'));router['get']('/',auth[_0x4e5b('0x9')](),controller[_0x4e5b('0xa')]);router[_0x4e5b('0xb')](_0x4e5b('0xc'),auth[_0x4e5b('0x9')](),controller['describe']);router[_0x4e5b('0xb')](_0x4e5b('0xd'),auth[_0x4e5b('0x9')](),controller[_0x4e5b('0xe')]);router['post']('/',auth[_0x4e5b('0x9')](),interaction['tracked'](_0x4e5b('0xf'),_0x4e5b('0x10')),controller[_0x4e5b('0x11')]);router[_0x4e5b('0x12')]('/:id',controller[_0x4e5b('0x13')]);router['put'](_0x4e5b('0x14'),auth[_0x4e5b('0x9')](),controller[_0x4e5b('0x15')]);router[_0x4e5b('0x12')](_0x4e5b('0x16'),auth['isAuthenticated'](),controller[_0x4e5b('0x17')]);router[_0x4e5b('0x18')]('/:id',auth[_0x4e5b('0x9')](),controller[_0x4e5b('0x19')]);module[_0x4e5b('0x1a')]=router; \ No newline at end of file +var _0xd689=['chatmessage:create','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','show','tracked','chat'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd689,0x142));var _0x9d68=function(_0xabd0bc,_0x203b56){_0xabd0bc=_0xabd0bc-0x0;var _0xdbde42=_0xd689[_0xabd0bc];return _0xdbde42;};'use strict';var multer=require(_0x9d68('0x0'));var util=require(_0x9d68('0x1'));var path=require(_0x9d68('0x2'));var timeout=require('connect-timeout');var express=require(_0x9d68('0x3'));var router=express[_0x9d68('0x4')]();var fs_extra=require(_0x9d68('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9d68('0x6'));var config=require('../../config/environment');var controller=require('./chatMessage.controller');router['get']('/',auth[_0x9d68('0x7')](),controller[_0x9d68('0x8')]);router[_0x9d68('0x9')](_0x9d68('0xa'),auth[_0x9d68('0x7')](),controller[_0x9d68('0xb')]);router[_0x9d68('0x9')](_0x9d68('0xc'),auth[_0x9d68('0x7')](),controller[_0x9d68('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x9d68('0xe')](_0x9d68('0xf'),_0x9d68('0x10')),controller['create']);router[_0x9d68('0x11')]('/:id',controller[_0x9d68('0x12')]);router[_0x9d68('0x11')](_0x9d68('0x13'),auth[_0x9d68('0x7')](),controller[_0x9d68('0x14')]);router['put'](_0x9d68('0x15'),auth[_0x9d68('0x7')](),controller[_0x9d68('0x16')]);router[_0x9d68('0x17')]('/:id',auth[_0x9d68('0x7')](),controller[_0x9d68('0x18')]);module[_0x9d68('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 51fcf75..9d021bc 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 _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x59ac19,_0x4fd450){var _0xe0daaa=function(_0xd6215e){while(--_0xd6215e){_0x59ac19['push'](_0x59ac19['shift']());}};_0xe0daaa(++_0x4fd450);}(_0x5f2f,0x73));var _0xf5f2=function(_0x44d909,_0x37a80c){_0x44d909=_0x44d909-0x0;var _0x44bd83=_0x5f2f[_0x44d909];return _0x44bd83;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file +var _0x5f66=['medium','TEXT','exports'];(function(_0xf7328,_0x310f3a){var _0x2591d8=function(_0x188c22){while(--_0x188c22){_0xf7328['push'](_0xf7328['shift']());}};_0x2591d8(++_0x310f3a);}(_0x5f66,0x1a0));var _0x65f6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x5f66[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require('sequelize');module[_0x65f6('0x0')]={'body':{'type':Sequelize['TEXT'](_0x65f6('0x1')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x65f6('0x2')](_0x65f6('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 3fd7cdb..a0dcf51 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 _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(_0x9df060,_0x253d33){var _0x338dfe=function(_0x17d9a5){while(--_0x17d9a5){_0x9df060['push'](_0x9df060['shift']());}};_0x338dfe(++_0x253d33);}(_0x7a54,0x106));var _0x47a5=function(_0x28e5a2,_0x457386){_0x28e5a2=_0x28e5a2-0x0;var _0x49d0bc=_0x7a54[_0x28e5a2];return _0x49d0bc;};'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 +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(_0x2555d0,_0x4150a6){var _0x3bb486=function(_0x1eb89f){while(--_0x1eb89f){_0x2555d0['push'](_0x2555d0['shift']());}};_0x3bb486(++_0x4150a6);}(_0x7a54,0x106));var _0x47a5=function(_0x5880e7,_0x42bd79){_0x5880e7=_0x5880e7-0x0;var _0x276be9=_0x7a54[_0x5880e7];return _0x276be9;};'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 bfc1124..77cd316 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 _0x170a=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage','save','remove','emit'];(function(_0x2e26b9,_0x213fca){var _0x24beb8=function(_0x402479){while(--_0x402479){_0x2e26b9['push'](_0x2e26b9['shift']());}};_0x24beb8(++_0x213fca);}(_0x170a,0xed));var _0xa170=function(_0x4cef91,_0x16b251){_0x4cef91=_0x4cef91-0x0;var _0x3fe1f6=_0x170a[_0x4cef91];return _0x3fe1f6;};'use strict';var EventEmitter=require(_0xa170('0x0'));var ChatOfflineMessage=require(_0xa170('0x1'))['db'][_0xa170('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa170('0x3'),'afterUpdate':'update','afterDestroy':_0xa170('0x4')};function emitEvent(_0x494b60){return function(_0x2ba277,_0x18866d,_0x1cf4b5){ChatOfflineMessageEvents[_0xa170('0x5')](_0x494b60+':'+_0x2ba277['id'],_0x2ba277);ChatOfflineMessageEvents[_0xa170('0x5')](_0x494b60,_0x2ba277);_0x1cf4b5(null);};}for(var e in events){if(events[_0xa170('0x6')](e)){var event=events[e];ChatOfflineMessage[_0xa170('0x7')](e,emitEvent(event));}}module[_0xa170('0x8')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xf1a0=['update','remove','emit','hasOwnProperty','ChatOfflineMessage','setMaxListeners'];(function(_0x56c75c,_0x51cece){var _0x51a8e6=function(_0x557b44){while(--_0x557b44){_0x56c75c['push'](_0x56c75c['shift']());}};_0x51a8e6(++_0x51cece);}(_0xf1a0,0x1a2));var _0x0f1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf1a0[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var ChatOfflineMessage=require('../../mysqldb')['db'][_0x0f1a('0x0')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x0f1a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x0f1a('0x2'),'afterDestroy':_0x0f1a('0x3')};function emitEvent(_0x191f4c){return function(_0x3130c4,_0x376586,_0x106cac){ChatOfflineMessageEvents[_0x0f1a('0x4')](_0x191f4c+':'+_0x3130c4['id'],_0x3130c4);ChatOfflineMessageEvents['emit'](_0x191f4c,_0x3130c4);_0x106cac(null);};}for(var e in events){if(events[_0x0f1a('0x5')](e)){var event=events[e];ChatOfflineMessage['hook'](e,emitEvent(event));}}module['exports']=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index f1d1041..fb185b1 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 _0x2787=['define','chat_offline_messages','utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports'];(function(_0x22d7f1,_0x1a3cab){var _0x4da1e0=function(_0x5a2392){while(--_0x5a2392){_0x22d7f1['push'](_0x22d7f1['shift']());}};_0x4da1e0(++_0x1a3cab);}(_0x2787,0xdf));var _0x7278=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x2787[_0x17d9e3];return _0x14192d;};'use strict';var attributes=require(_0x7278('0x0'));module[_0x7278('0x1')]=function(_0x21a0ce){return _0x21a0ce[_0x7278('0x2')]('ChatOfflineMessage',attributes,{'tableName':_0x7278('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x7278('0x4')});}; \ No newline at end of file +var _0x4915=['utf8mb4','utf8mb4_unicode_ci','exports','define'];(function(_0x11155f,_0x57b687){var _0xd07e48=function(_0x592615){while(--_0x592615){_0x11155f['push'](_0x11155f['shift']());}};_0xd07e48(++_0x57b687);}(_0x4915,0x11e));var _0x5491=function(_0x57f5a8,_0x3edbf0){_0x57f5a8=_0x57f5a8-0x0;var _0x116b7a=_0x4915[_0x57f5a8];return _0x116b7a;};'use strict';var attributes=require('./chatOfflineMessage.attributes');module[_0x5491('0x0')]=function(_0x6152c){return _0x6152c[_0x5491('0x1')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5491('0x2'),'collate':_0x5491('0x3')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 033a086..39e5005 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 _0x0f9a=['client','http','request','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3fa874,_0x5a725e){var _0xd5649b=function(_0x2e5540){while(--_0x2e5540){_0x3fa874['push'](_0x3fa874['shift']());}};_0xd5649b(++_0x5a725e);}(_0x0f9a,0x174));var _0xa0f9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x0f9a[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xa0f9('0x0'));var util=require(_0xa0f9('0x1'));var moment=require(_0xa0f9('0x2'));var BPromise=require(_0xa0f9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa0f9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xa0f9('0x5'))('rpc');var config=require(_0xa0f9('0x6'));var jayson=require(_0xa0f9('0x7'));var client=jayson[_0xa0f9('0x8')][_0xa0f9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x34a8f3,_0x167785,_0xbea873){return new BPromise(function(_0x4d7b7d,_0x52cd2f){return client[_0xa0f9('0xa')](_0x34a8f3,_0xbea873)['then'](function(_0x7b205f){logger[_0xa0f9('0xb')](_0xa0f9('0xc'),_0x167785,_0xa0f9('0xd'));logger[_0xa0f9('0xe')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x167785,'request\x20sent',JSON[_0xa0f9('0xf')](_0x7b205f));if(_0x7b205f[_0xa0f9('0x10')]){if(_0x7b205f['error'][_0xa0f9('0x11')]===0x1f4){logger[_0xa0f9('0x10')]('ChatOfflineMessage,\x20%s,\x20%s',_0x167785,_0x7b205f[_0xa0f9('0x10')][_0xa0f9('0x12')]);return _0x52cd2f(_0x7b205f[_0xa0f9('0x10')][_0xa0f9('0x12')]);}logger['error'](_0xa0f9('0xc'),_0x167785,_0x7b205f[_0xa0f9('0x10')]['message']);return _0x4d7b7d(_0x7b205f[_0xa0f9('0x10')][_0xa0f9('0x12')]);}else{logger[_0xa0f9('0xb')]('ChatOfflineMessage,\x20%s,\x20%s',_0x167785,_0xa0f9('0xd'));_0x4d7b7d(_0x7b205f[_0xa0f9('0x13')][_0xa0f9('0x12')]);}})['catch'](function(_0x5c22b3){logger[_0xa0f9('0x10')](_0xa0f9('0xc'),_0x167785,_0x5c22b3);_0x52cd2f(_0x5c22b3);});});} \ No newline at end of file +var _0xb81d=['code','error','message','result','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x9c0784,_0x5a69c5){var _0x4e35d7=function(_0x55d54a){while(--_0x55d54a){_0x9c0784['push'](_0x9c0784['shift']());}};_0x4e35d7(++_0x5a69c5);}(_0xb81d,0x14e));var _0xdb81=function(_0x3d12d7,_0xae281f){_0x3d12d7=_0x3d12d7-0x0;var _0x4b64ad=_0xb81d[_0x3d12d7];return _0x4b64ad;};'use strict';var _=require(_0xdb81('0x0'));var util=require('util');var moment=require(_0xdb81('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb81('0x2'));var db=require(_0xdb81('0x3'))['db'];var utils=require(_0xdb81('0x4'));var logger=require(_0xdb81('0x5'))(_0xdb81('0x6'));var config=require(_0xdb81('0x7'));var jayson=require(_0xdb81('0x8'));var client=jayson[_0xdb81('0x9')][_0xdb81('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ce56d,_0x597e43,_0x15c2e1){return new BPromise(function(_0x2103c1,_0x2cfd61){return client[_0xdb81('0xb')](_0x5ce56d,_0x15c2e1)[_0xdb81('0xc')](function(_0x339e9b){logger[_0xdb81('0xd')](_0xdb81('0xe'),_0x597e43,_0xdb81('0xf'));logger[_0xdb81('0x10')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x597e43,_0xdb81('0xf'),JSON[_0xdb81('0x11')](_0x339e9b));if(_0x339e9b['error']){if(_0x339e9b['error'][_0xdb81('0x12')]===0x1f4){logger[_0xdb81('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x597e43,_0x339e9b[_0xdb81('0x13')][_0xdb81('0x14')]);return _0x2cfd61(_0x339e9b[_0xdb81('0x13')][_0xdb81('0x14')]);}logger['error'](_0xdb81('0xe'),_0x597e43,_0x339e9b[_0xdb81('0x13')][_0xdb81('0x14')]);return _0x2103c1(_0x339e9b[_0xdb81('0x13')][_0xdb81('0x14')]);}else{logger[_0xdb81('0xd')]('ChatOfflineMessage,\x20%s,\x20%s',_0x597e43,'request\x20sent');_0x2103c1(_0x339e9b[_0xdb81('0x15')]['message']);}})['catch'](function(_0x219a5d){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x597e43,_0x219a5d);_0x2cfd61(_0x219a5d);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index f3dc138..3323ef5 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 _0x2296=['isAuthenticated','index','/:id','show','post','create','put','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get'];(function(_0x3ddd5a,_0x5dd179){var _0x4434a7=function(_0x3a0e99){while(--_0x3a0e99){_0x3ddd5a['push'](_0x3ddd5a['shift']());}};_0x4434a7(++_0x5dd179);}(_0x2296,0xfa));var _0x6229=function(_0x31d97d,_0x636901){_0x31d97d=_0x31d97d-0x0;var _0x15f7db=_0x2296[_0x31d97d];return _0x15f7db;};'use strict';var multer=require(_0x6229('0x0'));var util=require(_0x6229('0x1'));var path=require('path');var timeout=require(_0x6229('0x2'));var express=require('express');var router=express[_0x6229('0x3')]();var fs_extra=require(_0x6229('0x4'));var auth=require(_0x6229('0x5'));var interaction=require(_0x6229('0x6'));var config=require(_0x6229('0x7'));var controller=require(_0x6229('0x8'));router[_0x6229('0x9')]('/',auth[_0x6229('0xa')](),controller[_0x6229('0xb')]);router[_0x6229('0x9')]('/describe',auth[_0x6229('0xa')](),controller['describe']);router[_0x6229('0x9')](_0x6229('0xc'),auth['isAuthenticated'](),controller[_0x6229('0xd')]);router[_0x6229('0xe')]('/',auth[_0x6229('0xa')](),controller[_0x6229('0xf')]);router[_0x6229('0x10')](_0x6229('0xc'),auth[_0x6229('0xa')](),controller[_0x6229('0x11')]);router[_0x6229('0x12')](_0x6229('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0x6229('0x13')]=router; \ No newline at end of file +var _0x4223=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','describe','/:id','show','post','create','put','update','delete'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x4223,0x1b9));var _0x3422=function(_0x30ea2a,_0x4c1168){_0x30ea2a=_0x30ea2a-0x0;var _0x73ecb7=_0x4223[_0x30ea2a];return _0x73ecb7;};'use strict';var multer=require(_0x3422('0x0'));var util=require('util');var path=require(_0x3422('0x1'));var timeout=require(_0x3422('0x2'));var express=require(_0x3422('0x3'));var router=express[_0x3422('0x4')]();var fs_extra=require(_0x3422('0x5'));var auth=require(_0x3422('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3422('0x7'));var controller=require(_0x3422('0x8'));router[_0x3422('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3422('0x9')]('/describe',auth[_0x3422('0xa')](),controller[_0x3422('0xb')]);router[_0x3422('0x9')](_0x3422('0xc'),auth['isAuthenticated'](),controller[_0x3422('0xd')]);router[_0x3422('0xe')]('/',auth[_0x3422('0xa')](),controller[_0x3422('0xf')]);router[_0x3422('0x10')](_0x3422('0xc'),auth['isAuthenticated'](),controller[_0x3422('0x11')]);router[_0x3422('0x12')]('/:id',auth[_0x3422('0xa')](),controller['destroy']);module[_0x3422('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index d87a42b..3dde79b 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 _0x31f5=['mouseOver','INTEGER','sequelize','ENUM','timeout'];(function(_0x1a1bd2,_0x1f07e4){var _0x2fabdc=function(_0x50c293){while(--_0x50c293){_0x1a1bd2['push'](_0x1a1bd2['shift']());}};_0x2fabdc(++_0x1f07e4);}(_0x31f5,0x151));var _0x531f=function(_0x3f7f93,_0x252411){_0x3f7f93=_0x3f7f93-0x0;var _0x5a512f=_0x31f5[_0x3f7f93];return _0x5a512f;};'use strict';var Sequelize=require(_0x531f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x531f('0x1')]('mouseOver',_0x531f('0x2')),'defaultValue':_0x531f('0x3')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x531f('0x4')]}}; \ No newline at end of file +var _0x574f=['timeout','mouseOver','sequelize'];(function(_0x49e7d9,_0x14425d){var _0x57e4c1=function(_0x398929){while(--_0x398929){_0x49e7d9['push'](_0x49e7d9['shift']());}};_0x57e4c1(++_0x14425d);}(_0x574f,0x16a));var _0xf574=function(_0x16a2e8,_0x59c3a9){_0x16a2e8=_0x16a2e8-0x0;var _0x5de2a3=_0x574f[_0x16a2e8];return _0x5de2a3;};'use strict';var Sequelize=require(_0xf574('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('mouseOver',_0xf574('0x1')),'defaultValue':_0xf574('0x2')},'selector':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index 82331a4..959aafe 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 _0x0d6a=['sendStatus','error','stack','name','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','include','merge','find','catch','body','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy'];(function(_0x21c6b8,_0x16d6f6){var _0x39d474=function(_0x27dbf5){while(--_0x27dbf5){_0x21c6b8['push'](_0x21c6b8['shift']());}};_0x39d474(++_0x16d6f6);}(_0x0d6a,0xc9));var _0xa0d6=function(_0xb24a3e,_0x4a3594){_0xb24a3e=_0xb24a3e-0x0;var _0x4038d7=_0x0d6a[_0xb24a3e];return _0x4038d7;};'use strict';var emlformat=require(_0xa0d6('0x0'));var rimraf=require(_0xa0d6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa0d6('0x2'));var rp=require(_0xa0d6('0x3'));var moment=require(_0xa0d6('0x4'));var BPromise=require(_0xa0d6('0x5'));var Mustache=require(_0xa0d6('0x6'));var util=require(_0xa0d6('0x7'));var path=require(_0xa0d6('0x8'));var sox=require(_0xa0d6('0x9'));var csv=require(_0xa0d6('0xa'));var ejs=require(_0xa0d6('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa0d6('0xc'));var squel=require(_0xa0d6('0xd'));var crypto=require(_0xa0d6('0xe'));var jsforce=require(_0xa0d6('0xf'));var deskjs=require(_0xa0d6('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa0d6('0x11'));var Papa=require('papaparse');var Redis=require(_0xa0d6('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xa0d6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa0d6('0x14'));var logger=require(_0xa0d6('0x15'))(_0xa0d6('0x16'));var utils=require(_0xa0d6('0x17'));var config=require(_0xa0d6('0x18'));var licenseUtil=require(_0xa0d6('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x304c6a,_0x17da11){_0x17da11=_0x17da11||0xcc;return function(_0x27aa06){if(_0x27aa06){return _0x304c6a['sendStatus'](_0x17da11);}return _0x304c6a[_0xa0d6('0x1a')](_0x17da11)[_0xa0d6('0x1b')]();};}function respondWithResult(_0x212b39,_0x31b97b){_0x31b97b=_0x31b97b||0xc8;return function(_0x3c3c15){if(_0x3c3c15){return _0x212b39[_0xa0d6('0x1a')](_0x31b97b)[_0xa0d6('0x1c')](_0x3c3c15);}};}function respondWithFilteredResult(_0x4a0f3a,_0x5ddf29){return function(_0x39e63f){if(_0x39e63f){var _0x3f8ed3=typeof _0x5ddf29[_0xa0d6('0x1d')]===_0xa0d6('0x1e')&&typeof _0x5ddf29[_0xa0d6('0x1f')]===_0xa0d6('0x1e');var _0x82e7b6=_0x39e63f['count'];var _0x1c8547=_0x3f8ed3?0x0:_0x5ddf29[_0xa0d6('0x1d')];var _0x20c387=_0x3f8ed3?_0x39e63f['count']:_0x5ddf29[_0xa0d6('0x1d')]+_0x5ddf29['limit'];var _0x1dc618;if(_0x20c387>=_0x82e7b6){_0x20c387=_0x82e7b6;_0x1dc618=0xc8;}else{_0x1dc618=0xce;}_0x4a0f3a['status'](_0x1dc618);return _0x4a0f3a[_0xa0d6('0x20')](_0xa0d6('0x21'),_0x1c8547+'-'+_0x20c387+'/'+_0x82e7b6)[_0xa0d6('0x1c')](_0x39e63f);}return null;};}function patchUpdates(_0x3e9968){return function(_0x798c80){try{jsonpatch[_0xa0d6('0x22')](_0x798c80,_0x3e9968,!![]);}catch(_0x5a78ec){return BPromise[_0xa0d6('0x23')](_0x5a78ec);}return _0x798c80[_0xa0d6('0x24')]();};}function saveUpdates(_0x4ded22,_0x1a053e){return function(_0x51c67e){if(_0x51c67e){return _0x51c67e['update'](_0x4ded22)[_0xa0d6('0x25')](function(_0x222152){return _0x222152;});}return null;};}function removeEntity(_0x181606,_0x16cd24){return function(_0x469c42){if(_0x469c42){return _0x469c42[_0xa0d6('0x26')]()[_0xa0d6('0x25')](function(){_0x181606[_0xa0d6('0x1a')](0xcc)[_0xa0d6('0x1b')]();});}};}function handleEntityNotFound(_0x338b17,_0x4c4111){return function(_0x2eedfe){if(!_0x2eedfe){_0x338b17[_0xa0d6('0x27')](0x194);}return _0x2eedfe;};}function handleError(_0x621e42,_0x2656c5){_0x2656c5=_0x2656c5||0x1f4;return function(_0x173838){logger[_0xa0d6('0x28')](_0x173838[_0xa0d6('0x29')]);if(_0x173838[_0xa0d6('0x2a')]){delete _0x173838[_0xa0d6('0x2a')];}_0x621e42[_0xa0d6('0x1a')](_0x2656c5)[_0xa0d6('0x2b')](_0x173838);};}exports[_0xa0d6('0x2c')]=function(_0x414b84,_0x382a37){var _0x11b38c={'raw':!![],'where':{'id':_0x414b84[_0xa0d6('0x2d')]['id']}},_0x19b932={};_0x19b932[_0xa0d6('0x2e')]=_[_0xa0d6('0x2f')](db[_0xa0d6('0x30')][_0xa0d6('0x31')]);_0x19b932[_0xa0d6('0x32')]=_[_0xa0d6('0x2f')](_0x414b84[_0xa0d6('0x32')]);_0x19b932['filters']=_[_0xa0d6('0x33')](_0x19b932['model'],_0x19b932[_0xa0d6('0x32')]);_0x11b38c[_0xa0d6('0x34')]=_[_0xa0d6('0x33')](_0x19b932['model'],qs[_0xa0d6('0x35')](_0x414b84[_0xa0d6('0x32')]['fields']));_0x11b38c[_0xa0d6('0x34')]=_0x11b38c[_0xa0d6('0x34')]['length']?_0x11b38c[_0xa0d6('0x34')]:_0x19b932[_0xa0d6('0x2e')];if(_0x414b84['query']['includeAll']){_0x11b38c[_0xa0d6('0x36')]=[{'all':!![]}];}_0x11b38c=_[_0xa0d6('0x37')]({},_0x11b38c,_0x414b84['options']);return db[_0xa0d6('0x30')][_0xa0d6('0x38')](_0x11b38c)['then'](handleEntityNotFound(_0x382a37,null))[_0xa0d6('0x25')](respondWithResult(_0x382a37,null))[_0xa0d6('0x39')](handleError(_0x382a37,null));};exports['create']=function(_0x4525c5,_0x29651e){return db['ChatProactiveAction']['create'](_0x4525c5[_0xa0d6('0x3a')],{})[_0xa0d6('0x25')](respondWithResult(_0x29651e,0xc9))[_0xa0d6('0x39')](handleError(_0x29651e,null));};exports[_0xa0d6('0x3b')]=function(_0x5aba86,_0x41fbe3){if(_0x5aba86['body']['id']){delete _0x5aba86[_0xa0d6('0x3a')]['id'];}return db[_0xa0d6('0x30')][_0xa0d6('0x38')]({'where':{'id':_0x5aba86[_0xa0d6('0x2d')]['id']}})[_0xa0d6('0x25')](handleEntityNotFound(_0x41fbe3,null))[_0xa0d6('0x25')](saveUpdates(_0x5aba86[_0xa0d6('0x3a')],null))[_0xa0d6('0x25')](respondWithResult(_0x41fbe3,null))['catch'](handleError(_0x41fbe3,null));};exports[_0xa0d6('0x26')]=function(_0x3c0d5f,_0x44c204){return db['ChatProactiveAction']['find']({'where':{'id':_0x3c0d5f[_0xa0d6('0x2d')]['id']}})['then'](handleEntityNotFound(_0x44c204,null))[_0xa0d6('0x25')](removeEntity(_0x44c204,null))[_0xa0d6('0x39')](handleError(_0x44c204,null));}; \ No newline at end of file +var _0x44ae=['name','send','show','model','rawAttributes','keys','filters','intersection','attributes','query','length','includeAll','include','merge','options','ChatProactiveAction','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','save','then','destroy','stack'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x44ae,0x17d));var _0xe44a=function(_0x4684af,_0x34880f){_0x4684af=_0x4684af-0x0;var _0x3bb413=_0x44ae[_0x4684af];return _0x3bb413;};'use strict';var emlformat=require(_0xe44a('0x0'));var rimraf=require(_0xe44a('0x1'));var zipdir=require(_0xe44a('0x2'));var jsonpatch=require(_0xe44a('0x3'));var rp=require('request-promise');var moment=require(_0xe44a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe44a('0x5'));var util=require(_0xe44a('0x6'));var path=require(_0xe44a('0x7'));var sox=require(_0xe44a('0x8'));var csv=require(_0xe44a('0x9'));var ejs=require(_0xe44a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe44a('0xb'));var squel=require(_0xe44a('0xc'));var crypto=require(_0xe44a('0xd'));var jsforce=require(_0xe44a('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe44a('0x9'));var querystring=require(_0xe44a('0xf'));var Papa=require(_0xe44a('0x10'));var Redis=require(_0xe44a('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xe44a('0x12'));var as=require(_0xe44a('0x13'));var hardwareService=require(_0xe44a('0x14'));var logger=require(_0xe44a('0x15'))(_0xe44a('0x16'));var utils=require(_0xe44a('0x17'));var config=require(_0xe44a('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f1150,_0x306f7a){_0x306f7a=_0x306f7a||0xcc;return function(_0xbfc286){if(_0xbfc286){return _0x5f1150[_0xe44a('0x19')](_0x306f7a);}return _0x5f1150['status'](_0x306f7a)[_0xe44a('0x1a')]();};}function respondWithResult(_0x3ab707,_0x3656b2){_0x3656b2=_0x3656b2||0xc8;return function(_0x14c1a8){if(_0x14c1a8){return _0x3ab707[_0xe44a('0x1b')](_0x3656b2)[_0xe44a('0x1c')](_0x14c1a8);}};}function respondWithFilteredResult(_0x1d491a,_0x575d79){return function(_0x1ec698){if(_0x1ec698){var _0x96dee=typeof _0x575d79['offset']==='undefined'&&typeof _0x575d79['limit']==='undefined';var _0x959455=_0x1ec698[_0xe44a('0x1d')];var _0x2a33b6=_0x96dee?0x0:_0x575d79['offset'];var _0x20fdc7=_0x96dee?_0x1ec698[_0xe44a('0x1d')]:_0x575d79[_0xe44a('0x1e')]+_0x575d79[_0xe44a('0x1f')];var _0x1fcfce;if(_0x20fdc7>=_0x959455){_0x20fdc7=_0x959455;_0x1fcfce=0xc8;}else{_0x1fcfce=0xce;}_0x1d491a[_0xe44a('0x1b')](_0x1fcfce);return _0x1d491a['set'](_0xe44a('0x20'),_0x2a33b6+'-'+_0x20fdc7+'/'+_0x959455)['json'](_0x1ec698);}return null;};}function patchUpdates(_0x295ceb){return function(_0x6656a8){try{jsonpatch[_0xe44a('0x21')](_0x6656a8,_0x295ceb,!![]);}catch(_0x2663bb){return BPromise[_0xe44a('0x22')](_0x2663bb);}return _0x6656a8[_0xe44a('0x23')]();};}function saveUpdates(_0x37992e,_0x4e9bab){return function(_0x203889){if(_0x203889){return _0x203889['update'](_0x37992e)[_0xe44a('0x24')](function(_0x2b53b9){return _0x2b53b9;});}return null;};}function removeEntity(_0x444c93,_0x26eba0){return function(_0x1bc4e9){if(_0x1bc4e9){return _0x1bc4e9[_0xe44a('0x25')]()[_0xe44a('0x24')](function(){_0x444c93[_0xe44a('0x1b')](0xcc)[_0xe44a('0x1a')]();});}};}function handleEntityNotFound(_0x2d91b7,_0x43ef28){return function(_0x46c16b){if(!_0x46c16b){_0x2d91b7[_0xe44a('0x19')](0x194);}return _0x46c16b;};}function handleError(_0xc69e9d,_0x5574f8){_0x5574f8=_0x5574f8||0x1f4;return function(_0x8fbbbf){logger['error'](_0x8fbbbf[_0xe44a('0x26')]);if(_0x8fbbbf[_0xe44a('0x27')]){delete _0x8fbbbf['name'];}_0xc69e9d[_0xe44a('0x1b')](_0x5574f8)[_0xe44a('0x28')](_0x8fbbbf);};}exports[_0xe44a('0x29')]=function(_0x4c6690,_0xf02b86){var _0x5091c3={'raw':!![],'where':{'id':_0x4c6690['params']['id']}},_0x1cb6c7={};_0x1cb6c7[_0xe44a('0x2a')]=_['keys'](db['ChatProactiveAction'][_0xe44a('0x2b')]);_0x1cb6c7['query']=_[_0xe44a('0x2c')](_0x4c6690['query']);_0x1cb6c7[_0xe44a('0x2d')]=_[_0xe44a('0x2e')](_0x1cb6c7[_0xe44a('0x2a')],_0x1cb6c7['query']);_0x5091c3[_0xe44a('0x2f')]=_[_0xe44a('0x2e')](_0x1cb6c7['model'],qs['fields'](_0x4c6690[_0xe44a('0x30')]['fields']));_0x5091c3['attributes']=_0x5091c3[_0xe44a('0x2f')][_0xe44a('0x31')]?_0x5091c3[_0xe44a('0x2f')]:_0x1cb6c7[_0xe44a('0x2a')];if(_0x4c6690[_0xe44a('0x30')][_0xe44a('0x32')]){_0x5091c3[_0xe44a('0x33')]=[{'all':!![]}];}_0x5091c3=_[_0xe44a('0x34')]({},_0x5091c3,_0x4c6690[_0xe44a('0x35')]);return db[_0xe44a('0x36')][_0xe44a('0x37')](_0x5091c3)[_0xe44a('0x24')](handleEntityNotFound(_0xf02b86,null))[_0xe44a('0x24')](respondWithResult(_0xf02b86,null))[_0xe44a('0x38')](handleError(_0xf02b86,null));};exports[_0xe44a('0x39')]=function(_0x198683,_0x537c05){return db[_0xe44a('0x36')][_0xe44a('0x39')](_0x198683['body'],{})[_0xe44a('0x24')](respondWithResult(_0x537c05,0xc9))[_0xe44a('0x38')](handleError(_0x537c05,null));};exports['update']=function(_0x542144,_0x18cd1a){if(_0x542144[_0xe44a('0x3a')]['id']){delete _0x542144[_0xe44a('0x3a')]['id'];}return db[_0xe44a('0x36')][_0xe44a('0x37')]({'where':{'id':_0x542144[_0xe44a('0x3b')]['id']}})['then'](handleEntityNotFound(_0x18cd1a,null))[_0xe44a('0x24')](saveUpdates(_0x542144[_0xe44a('0x3a')],null))[_0xe44a('0x24')](respondWithResult(_0x18cd1a,null))[_0xe44a('0x38')](handleError(_0x18cd1a,null));};exports[_0xe44a('0x25')]=function(_0x3fede5,_0x4cca58){return db[_0xe44a('0x36')]['find']({'where':{'id':_0x3fede5[_0xe44a('0x3b')]['id']}})[_0xe44a('0x24')](handleEntityNotFound(_0x4cca58,null))[_0xe44a('0x24')](removeEntity(_0x4cca58,null))['catch'](handleError(_0x4cca58,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 58aa739..6cc27e7 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 _0x0403=['exports','define','ChatProactiveAction','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x0403,0xdf));var _0x3040=function(_0x14722b,_0x5af9ec){_0x14722b=_0x14722b-0x0;var _0x6629ce=_0x0403[_0x14722b];return _0x6629ce;};'use strict';var _=require(_0x3040('0x0'));var util=require(_0x3040('0x1'));var logger=require(_0x3040('0x2'))('api');var moment=require(_0x3040('0x3'));var BPromise=require('bluebird');var rp=require(_0x3040('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3040('0x5'));var config=require(_0x3040('0x6'));var attributes=require(_0x3040('0x7'));module[_0x3040('0x8')]=function(_0x3f5c86,_0x1374a3){return _0x3f5c86[_0x3040('0x9')](_0x3040('0xa'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf28=['./chatProactiveAction.attributes','define','ChatProactiveAction','chat_proactive_actions','api','moment','request-promise','path','rimraf','../../config/environment'];(function(_0x20fd15,_0x53f495){var _0x64905e=function(_0x4e3ad0){while(--_0x4e3ad0){_0x20fd15['push'](_0x20fd15['shift']());}};_0x64905e(++_0x53f495);}(_0xcf28,0xae));var _0x8cf2=function(_0x23b473,_0x96549d){_0x23b473=_0x23b473-0x0;var _0x536bd5=_0xcf28[_0x23b473];return _0x536bd5;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x8cf2('0x0'));var moment=require(_0x8cf2('0x1'));var BPromise=require('bluebird');var rp=require(_0x8cf2('0x2'));var fs=require('fs');var path=require(_0x8cf2('0x3'));var rimraf=require(_0x8cf2('0x4'));var config=require(_0x8cf2('0x5'));var attributes=require(_0x8cf2('0x6'));module['exports']=function(_0x432f88,_0x37e3ae){return _0x432f88[_0x8cf2('0x7')](_0x8cf2('0x8'),attributes,{'tableName':_0x8cf2('0x9'),'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 4ee21ea..d30c1fc 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 _0x4a56=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','util','bluebird','ioredis'];(function(_0x10778c,_0x461571){var _0x38d5f2=function(_0x3afba0){while(--_0x3afba0){_0x10778c['push'](_0x10778c['shift']());}};_0x38d5f2(++_0x461571);}(_0x4a56,0xd5));var _0x64a5=function(_0x3d0ad3,_0x1783ee){_0x3d0ad3=_0x3d0ad3-0x0;var _0x5397b6=_0x4a56[_0x3d0ad3];return _0x5397b6;};'use strict';var _=require('lodash');var util=require(_0x64a5('0x0'));var moment=require('moment');var BPromise=require(_0x64a5('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64a5('0x2'));var db=require(_0x64a5('0x3'))['db'];var utils=require(_0x64a5('0x4'));var logger=require(_0x64a5('0x5'))(_0x64a5('0x6'));var config=require(_0x64a5('0x7'));var jayson=require(_0x64a5('0x8'));var client=jayson[_0x64a5('0x9')][_0x64a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x32c09e,_0x5ae8cf,_0x56a0f0){return new BPromise(function(_0x493178,_0x3ed361){return client[_0x64a5('0xb')](_0x32c09e,_0x56a0f0)[_0x64a5('0xc')](function(_0x53c14e){logger[_0x64a5('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ae8cf,_0x64a5('0xe'));logger[_0x64a5('0xf')](_0x64a5('0x10'),_0x5ae8cf,'request\x20sent',JSON[_0x64a5('0x11')](_0x53c14e));if(_0x53c14e[_0x64a5('0x12')]){if(_0x53c14e[_0x64a5('0x12')][_0x64a5('0x13')]===0x1f4){logger['error'](_0x64a5('0x14'),_0x5ae8cf,_0x53c14e[_0x64a5('0x12')][_0x64a5('0x15')]);return _0x3ed361(_0x53c14e[_0x64a5('0x12')][_0x64a5('0x15')]);}logger[_0x64a5('0x12')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ae8cf,_0x53c14e[_0x64a5('0x12')]['message']);return _0x493178(_0x53c14e['error']['message']);}else{logger[_0x64a5('0xd')]('ChatProactiveAction,\x20%s,\x20%s',_0x5ae8cf,'request\x20sent');_0x493178(_0x53c14e[_0x64a5('0x16')]['message']);}})[_0x64a5('0x17')](function(_0x4ede48){logger['error'](_0x64a5('0x14'),_0x5ae8cf,_0x4ede48);_0x3ed361(_0x4ede48);});});} \ No newline at end of file +var _0x1180=['error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x5adcce,_0x10dc8b){var _0x129eb4=function(_0x45a294){while(--_0x45a294){_0x5adcce['push'](_0x5adcce['shift']());}};_0x129eb4(++_0x10dc8b);}(_0x1180,0x7c));var _0x0118=function(_0x15b544,_0x2815cb){_0x15b544=_0x15b544-0x0;var _0x4bab81=_0x1180[_0x15b544];return _0x4bab81;};'use strict';var _=require(_0x0118('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0118('0x1'));var rs=require(_0x0118('0x2'));var fs=require('fs');var Redis=require(_0x0118('0x3'));var db=require(_0x0118('0x4'))['db'];var utils=require(_0x0118('0x5'));var logger=require(_0x0118('0x6'))(_0x0118('0x7'));var config=require(_0x0118('0x8'));var jayson=require(_0x0118('0x9'));var client=jayson['client'][_0x0118('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x87cd9f,_0x14898a,_0xeec794){return new BPromise(function(_0x11b82f,_0x31ea58){return client[_0x0118('0xb')](_0x87cd9f,_0xeec794)['then'](function(_0x4a01f3){logger[_0x0118('0xc')](_0x0118('0xd'),_0x14898a,_0x0118('0xe'));logger[_0x0118('0xf')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x14898a,_0x0118('0xe'),JSON['stringify'](_0x4a01f3));if(_0x4a01f3[_0x0118('0x10')]){if(_0x4a01f3[_0x0118('0x10')][_0x0118('0x11')]===0x1f4){logger['error'](_0x0118('0xd'),_0x14898a,_0x4a01f3['error']['message']);return _0x31ea58(_0x4a01f3['error'][_0x0118('0x12')]);}logger[_0x0118('0x10')](_0x0118('0xd'),_0x14898a,_0x4a01f3['error'][_0x0118('0x12')]);return _0x11b82f(_0x4a01f3['error'][_0x0118('0x12')]);}else{logger[_0x0118('0xc')](_0x0118('0xd'),_0x14898a,_0x0118('0xe'));_0x11b82f(_0x4a01f3['result'][_0x0118('0x12')]);}})[_0x0118('0x13')](function(_0x35b775){logger[_0x0118('0x10')](_0x0118('0xd'),_0x14898a,_0x35b775);_0x31ea58(_0x35b775);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 11165fc..c4b2184 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 _0x24ca=['../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','post','put','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x3063a3,_0x297517){var _0x3d678b=function(_0x13be31){while(--_0x13be31){_0x3063a3['push'](_0x3063a3['shift']());}};_0x3d678b(++_0x297517);}(_0x24ca,0x1bc));var _0xa24c=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x24ca[_0x1eda20];return _0x31b953;};'use strict';var multer=require(_0xa24c('0x0'));var util=require('util');var path=require(_0xa24c('0x1'));var timeout=require(_0xa24c('0x2'));var express=require(_0xa24c('0x3'));var router=express['Router']();var fs_extra=require(_0xa24c('0x4'));var auth=require(_0xa24c('0x5'));var interaction=require(_0xa24c('0x6'));var config=require(_0xa24c('0x7'));var controller=require(_0xa24c('0x8'));router[_0xa24c('0x9')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller[_0xa24c('0xc')]);router[_0xa24c('0xd')]('/',auth[_0xa24c('0xb')](),controller['create']);router[_0xa24c('0xe')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller['update']);router[_0xa24c('0xf')](_0xa24c('0xa'),auth[_0xa24c('0xb')](),controller[_0xa24c('0x10')]);module[_0xa24c('0x11')]=router; \ No newline at end of file +var _0xf494=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','put','update','delete','exports','multer','util'];(function(_0x30b865,_0x19049f){var _0x5c0a2c=function(_0x18b1df){while(--_0x18b1df){_0x30b865['push'](_0x30b865['shift']());}};_0x5c0a2c(++_0x19049f);}(_0xf494,0x1c6));var _0x4f49=function(_0x3c013a,_0x3ee6ab){_0x3c013a=_0x3c013a-0x0;var _0x373dca=_0xf494[_0x3c013a];return _0x373dca;};'use strict';var multer=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var path=require(_0x4f49('0x2'));var timeout=require('connect-timeout');var express=require(_0x4f49('0x3'));var router=express[_0x4f49('0x4')]();var fs_extra=require(_0x4f49('0x5'));var auth=require(_0x4f49('0x6'));var interaction=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var controller=require(_0x4f49('0x9'));router[_0x4f49('0xa')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller[_0x4f49('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f49('0xe')]);router[_0x4f49('0xf')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller[_0x4f49('0x10')]);router[_0x4f49('0x11')](_0x4f49('0xb'),auth[_0x4f49('0xc')](),controller['destroy']);module[_0x4f49('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index f907f39..d997b35 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 _0x9c21=['ENUM','roundrobin','exports','STRING','name','INTEGER'];(function(_0x3387ee,_0x4b83dc){var _0x2ad2fa=function(_0x2664b7){while(--_0x2664b7){_0x3387ee['push'](_0x3387ee['shift']());}};_0x2ad2fa(++_0x4b83dc);}(_0x9c21,0x8c));var _0x19c2=function(_0x259b29,_0x8dc8a2){_0x259b29=_0x259b29-0x0;var _0x2e04f0=_0x9c21[_0x259b29];return _0x2e04f0;};'use strict';var Sequelize=require('sequelize');module[_0x19c2('0x0')]={'name':{'type':Sequelize[_0x19c2('0x1')],'unique':_0x19c2('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x19c2('0x1')]},'timeout':{'type':Sequelize[_0x19c2('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x19c2('0x4')]('rrmemory','beepall',_0x19c2('0x5'))}}; \ No newline at end of file +var _0x1af5=['name','STRING','ENUM','rrmemory','roundrobin','sequelize'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x1af5,0x155));var _0x51af=function(_0x2840a9,_0x31d469){_0x2840a9=_0x2840a9-0x0;var _0xf509c6=_0x1af5[_0x2840a9];return _0xf509c6;};'use strict';var Sequelize=require(_0x51af('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x51af('0x1'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x51af('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x51af('0x3')](_0x51af('0x4'),'beepall',_0x51af('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 304d8c4..9c889cc 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 _0x446d=['params','describe','getMembers','findOne','keys','UserChatQueue','hasOwnProperty','nolimit','order','sort','pick','ChatQueueId','filter','where','findAndCountAll','agent','chatPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','ids','findAll','User','Agents','online','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','userChatQueue:save','removeTeams','field','from','team_has_chat_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','sequelize','toString','QueryTypes','TeamId','union','compact','value','isEmpty','removeAgents','addAgents','omit','spread','emit','isArray','userChatQueue:remove','getAgents','squel','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','update','then','get','ChatQueues','UserProfileResource','destroy','end','error','stack','name','send','index','map','ChatQueue','rawAttributes','getOptions','include','query','rows','show','model','filters','attributes','intersection','fields','length','includeAll','merge','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x2bf246,_0x5b16e2){var _0x170b38=function(_0x4d251c){while(--_0x4d251c){_0x2bf246['push'](_0x2bf246['shift']());}};_0x170b38(++_0x5b16e2);}(_0x446d,0x133));var _0xd446=function(_0xb4e052,_0x1d3cb6){_0xb4e052=_0xb4e052-0x0;var _0x5197e7=_0x446d[_0xb4e052];return _0x5197e7;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require('lodash');var squel=require(_0xd446('0x0'));var Redis=require(_0xd446('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xd446('0x2'))(_0xd446('0x3'));var config=require(_0xd446('0x4'));var db=require(_0xd446('0x5'))['db'];config[_0xd446('0x6')]=_[_0xd446('0x7')](config[_0xd446('0x6')],{'host':_0xd446('0x8'),'port':0x18eb});var socket=require(_0xd446('0x9'))(new Redis(config[_0xd446('0x6')]));require(_0xd446('0xa'))[_0xd446('0xb')](socket);function respondWithStatusCode(_0x5dda85,_0xaa1027){_0xaa1027=_0xaa1027||0xcc;return function(_0x4d4702){if(_0x4d4702){return _0x5dda85[_0xd446('0xc')](_0xaa1027);}return _0x5dda85[_0xd446('0xd')](_0xaa1027)['end']();};}function respondWithResult(_0x12424f,_0x516f5a){_0x516f5a=_0x516f5a||0xc8;return function(_0x3717b8){if(_0x3717b8){return _0x12424f[_0xd446('0xd')](_0x516f5a)[_0xd446('0xe')](_0x3717b8);}};}function respondWithFilteredResult(_0x3ffe57,_0x11e211){return function(_0x23d37e){if(_0x23d37e){var _0x4f9431=typeof _0x11e211[_0xd446('0xf')]===_0xd446('0x10')&&typeof _0x11e211['limit']===_0xd446('0x10');var _0x83de94=_0x23d37e[_0xd446('0x11')];var _0x3f6847=_0x4f9431?0x0:_0x11e211[_0xd446('0xf')];var _0xb64b29=_0x4f9431?_0x23d37e[_0xd446('0x11')]:_0x11e211[_0xd446('0xf')]+_0x11e211[_0xd446('0x12')];var _0x421cfd;if(_0xb64b29>=_0x83de94){_0xb64b29=_0x83de94;_0x421cfd=0xc8;}else{_0x421cfd=0xce;}_0x3ffe57['status'](_0x421cfd);return _0x3ffe57['set']('Content-Range',_0x3f6847+'-'+_0xb64b29+'/'+_0x83de94)['json'](_0x23d37e);}return null;};}function saveUpdates(_0x5ea1ca){return function(_0x4da4d4){if(_0x4da4d4){return _0x4da4d4[_0xd446('0x13')](_0x5ea1ca)[_0xd446('0x14')](function(_0x41fe1f){return _0x41fe1f;});}return null;};}function removeEntity(_0x284769){return function(_0x366da2){if(_0x366da2){return _0x366da2['destroy']()['then'](function(){var _0x25b91e=_0x366da2[_0xd446('0x15')]({'plain':!![]});var _0x165ff3=_0xd446('0x16');return db[_0xd446('0x17')][_0xd446('0x18')]({'where':{'type':_0x165ff3,'resourceId':_0x25b91e['id']}})[_0xd446('0x14')](function(){return _0x366da2;});})[_0xd446('0x14')](function(){_0x284769['status'](0xcc)[_0xd446('0x19')]();});}};}function handleEntityNotFound(_0x1876e4){return function(_0x1ca941){if(!_0x1ca941){_0x1876e4[_0xd446('0xc')](0x194);}return _0x1ca941;};}function handleError(_0x11f443,_0x2386bd){_0x2386bd=_0x2386bd||0x1f4;return function(_0x1ae8d2){logger[_0xd446('0x1a')](_0x1ae8d2[_0xd446('0x1b')]);if(_0x1ae8d2[_0xd446('0x1c')]){delete _0x1ae8d2[_0xd446('0x1c')];}_0x11f443['status'](_0x2386bd)[_0xd446('0x1d')](_0x1ae8d2);};}exports[_0xd446('0x1e')]=function(_0x441ed0,_0x4e11e7){var _0x414749={};var _0x4ccec9={'count':0x0,'rows':[]};var _0x41db4f=_[_0xd446('0x1f')](db[_0xd446('0x20')][_0xd446('0x21')],function(_0x2e6c9f){return{'name':_0x2e6c9f['fieldName'],'type':_0x2e6c9f['type']['key']};});_0x414749=qs[_0xd446('0x22')](_0x41db4f,_0x441ed0);var _0x578a31={'where':_0x414749['where']};return db[_0xd446('0x20')][_0xd446('0x11')](_0x578a31)[_0xd446('0x14')](function(_0xeb1f8c){_0x4ccec9['count']=_0xeb1f8c;_0x414749[_0xd446('0x23')]=qs['include'](_0x441ed0[_0xd446('0x24')]);return db[_0xd446('0x20')]['findAll'](_0x414749);})[_0xd446('0x14')](function(_0x4873e5){_0x4ccec9[_0xd446('0x25')]=_0x4873e5;return _0x4ccec9;})[_0xd446('0x14')](respondWithFilteredResult(_0x4e11e7,_0x414749))['catch'](handleError(_0x4e11e7,null));};exports[_0xd446('0x26')]=function(_0x5860a5,_0x66d772){var _0xd7a956={'raw':!![],'where':{'id':_0x5860a5['params']['id']}},_0x25002d={};_0x25002d[_0xd446('0x27')]=_['keys'](db['ChatQueue']['rawAttributes']);_0x25002d[_0xd446('0x24')]=_['keys'](_0x5860a5[_0xd446('0x24')]);_0x25002d[_0xd446('0x28')]=_['intersection'](_0x25002d[_0xd446('0x27')],_0x25002d['query']);_0xd7a956[_0xd446('0x29')]=_[_0xd446('0x2a')](_0x25002d['model'],qs[_0xd446('0x2b')](_0x5860a5[_0xd446('0x24')][_0xd446('0x2b')]));_0xd7a956['attributes']=_0xd7a956['attributes'][_0xd446('0x2c')]?_0xd7a956[_0xd446('0x29')]:_0x25002d[_0xd446('0x27')];if(_0x5860a5[_0xd446('0x24')][_0xd446('0x2d')]){_0xd7a956[_0xd446('0x23')]=[{'all':!![]}];}_0xd7a956=_[_0xd446('0x2e')]({},_0xd7a956,_0x5860a5[_0xd446('0x2f')]);return db[_0xd446('0x20')][_0xd446('0x30')](_0xd7a956)[_0xd446('0x14')](handleEntityNotFound(_0x66d772,null))['then'](respondWithResult(_0x66d772,null))[_0xd446('0x31')](handleError(_0x66d772,null));};exports[_0xd446('0x32')]=function(_0x3ad59a,_0xc3eb31){return db['ChatQueue'][_0xd446('0x32')](_0x3ad59a[_0xd446('0x33')],{})[_0xd446('0x14')](function(_0x2be48d){var _0x31bfc9=_0x3ad59a[_0xd446('0x34')][_0xd446('0x15')]({'plain':!![]});if(!_0x31bfc9)throw new Error(_0xd446('0x35'));if(_0x31bfc9[_0xd446('0x36')]===_0xd446('0x34')){var _0x6bacc1=_0x2be48d['get']({'plain':!![]});var _0x287226=_0xd446('0x16');return db[_0xd446('0x37')][_0xd446('0x30')]({'where':{'name':_0x287226,'userProfileId':_0x31bfc9[_0xd446('0x38')]},'raw':!![]})[_0xd446('0x14')](function(_0x28e5a8){if(_0x28e5a8&&_0x28e5a8[_0xd446('0x39')]===0x0){return db['UserProfileResource']['create']({'name':_0x6bacc1['name'],'resourceId':_0x6bacc1['id'],'type':_0x28e5a8[_0xd446('0x1c')],'sectionId':_0x28e5a8['id']},{})[_0xd446('0x14')](function(){return _0x2be48d;});}else{return _0x2be48d;}})['catch'](function(_0x4c133d){logger[_0xd446('0x1a')](_0xd446('0x3a'),_0x4c133d);throw _0x4c133d;});}return _0x2be48d;})[_0xd446('0x14')](respondWithResult(_0xc3eb31,0xc9))[_0xd446('0x31')](handleError(_0xc3eb31,null));};exports[_0xd446('0x13')]=function(_0x14d3b1,_0x20987d){if(_0x14d3b1['body']['id']){delete _0x14d3b1['body']['id'];}return db['ChatQueue']['find']({'where':{'id':_0x14d3b1['params']['id']}})['then'](handleEntityNotFound(_0x20987d,null))[_0xd446('0x14')](saveUpdates(_0x14d3b1[_0xd446('0x33')],null))['then'](respondWithResult(_0x20987d,null))[_0xd446('0x31')](handleError(_0x20987d,null));};exports['destroy']=function(_0x565894,_0x57d2c3){return db[_0xd446('0x20')][_0xd446('0x30')]({'where':{'id':_0x565894[_0xd446('0x3b')]['id']}})[_0xd446('0x14')](handleEntityNotFound(_0x57d2c3,null))[_0xd446('0x14')](removeEntity(_0x57d2c3,null))[_0xd446('0x31')](handleError(_0x57d2c3,null));};exports[_0xd446('0x3c')]=function(_0x579b49,_0x44466b){return db['ChatQueue'][_0xd446('0x3c')]()[_0xd446('0x14')](respondWithResult(_0x44466b,null))[_0xd446('0x31')](handleError(_0x44466b,null));};exports[_0xd446('0x3d')]=function(_0x19c8c5,_0x7028b){var _0x14bdfc={'raw':!![],'where':{}},_0x1cbbae={},_0x227398;return db[_0xd446('0x20')][_0xd446('0x3e')]({'where':{'id':_0x19c8c5[_0xd446('0x3b')]['id']}})['then'](handleEntityNotFound(_0x7028b,null))['then'](function(_0xc7e60c){if(_0xc7e60c){_0x227398=_0xc7e60c[_0xd446('0x15')]({'plain':!![]});_0x1cbbae[_0xd446('0x27')]=_[_0xd446('0x3f')](db[_0xd446('0x40')][_0xd446('0x21')]);_0x1cbbae[_0xd446('0x24')]=_['keys'](_0x19c8c5['query']);_0x1cbbae[_0xd446('0x28')]=_['intersection'](_0x1cbbae[_0xd446('0x27')],_0x1cbbae[_0xd446('0x24')]);_0x14bdfc[_0xd446('0x29')]=_['intersection'](_0x1cbbae['model'],qs[_0xd446('0x2b')](_0x19c8c5['query'][_0xd446('0x2b')]));_0x14bdfc[_0xd446('0x29')]=_0x14bdfc['attributes'][_0xd446('0x2c')]?_0x14bdfc[_0xd446('0x29')]:_0x1cbbae['model'];if(!_0x19c8c5[_0xd446('0x24')][_0xd446('0x41')](_0xd446('0x42'))){_0x14bdfc[_0xd446('0x12')]=qs['limit'](_0x19c8c5[_0xd446('0x24')]['limit']);_0x14bdfc[_0xd446('0xf')]=qs[_0xd446('0xf')](_0x19c8c5[_0xd446('0x24')]['offset']);}_0x14bdfc[_0xd446('0x43')]=qs[_0xd446('0x44')](_0x19c8c5[_0xd446('0x24')][_0xd446('0x44')]);_0x14bdfc['where']=qs[_0xd446('0x28')](_[_0xd446('0x45')](_0x19c8c5[_0xd446('0x24')],_0x1cbbae[_0xd446('0x28')]));_0x14bdfc['where'][_0xd446('0x46')]=_0xc7e60c['id'];if(_0x19c8c5['query'][_0xd446('0x47')]){_0x14bdfc[_0xd446('0x48')]=_[_0xd446('0x2e')](_0x14bdfc[_0xd446('0x48')],{'$or':_[_0xd446('0x1f')](_0x14bdfc[_0xd446('0x29')],function(_0x2e87e3){var _0x4a0441={};_0x4a0441[_0x2e87e3]={'$like':'%'+_0x19c8c5['query'][_0xd446('0x47')]+'%'};return _0x4a0441;})});}_0x14bdfc=_[_0xd446('0x2e')]({},_0x14bdfc,_0x19c8c5['options']);return db[_0xd446('0x40')]['findAll'](_0x14bdfc);}})[_0xd446('0x14')](function(_0xb1dc91){if(_0xb1dc91){return db['User'][_0xd446('0x49')]({'where':{'id':_['map'](_0xb1dc91,'UserId'),'role':_0xd446('0x4a')},'attributes':['id','name',_0xd446('0x4b'),_0xd446('0x4c'),'createdAt']});}})[_0xd446('0x14')](function(_0x28657b){if(_0x28657b){return{'count':_0x28657b[_0xd446('0x11')],'rows':_[_0xd446('0x1f')](_0x28657b['rows'],function(_0x59d583){return{'membername':_0x59d583['name'],'UserId':_0x59d583['id'],'queue_name':_0x227398['name'],'ChatQueueId':_0x227398['id'],'interface':util[_0xd446('0x4d')](_0xd446('0x4e'),_0xd446('0x4f'),_0x59d583[_0xd446('0x1c')]),'penalty':0x0,'paused':_0x59d583[_0xd446('0x4b')],'createdAt':_0x59d583[_0xd446('0x50')],'updatedAt':_0x59d583[_0xd446('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x7028b,_0x14bdfc))[_0xd446('0x31')](handleError(_0x7028b,null));};exports[_0xd446('0x51')]=function(_0x116e7b,_0x50cb7f){var _0x22869a={};var _0x15d16d={};var _0x99d53c;var _0x5c7a0c;return db[_0xd446('0x20')][_0xd446('0x3e')]({'where':{'id':_0x116e7b['params']['id']}})[_0xd446('0x14')](handleEntityNotFound(_0x50cb7f,null))[_0xd446('0x14')](function(_0x23a49b){if(_0x23a49b){_0x99d53c=_0x23a49b;_0x15d16d[_0xd446('0x27')]=_[_0xd446('0x3f')](db[_0xd446('0x52')]['rawAttributes']);_0x15d16d['query']=_[_0xd446('0x3f')](_0x116e7b[_0xd446('0x24')]);_0x15d16d[_0xd446('0x28')]=_[_0xd446('0x2a')](_0x15d16d[_0xd446('0x27')],_0x15d16d['query']);_0x22869a['attributes']=_[_0xd446('0x2a')](_0x15d16d[_0xd446('0x27')],qs[_0xd446('0x2b')](_0x116e7b[_0xd446('0x24')][_0xd446('0x2b')]));_0x22869a[_0xd446('0x29')]=_0x22869a[_0xd446('0x29')][_0xd446('0x2c')]?_0x22869a[_0xd446('0x29')]:_0x15d16d[_0xd446('0x27')];_0x22869a[_0xd446('0x43')]=qs[_0xd446('0x44')](_0x116e7b[_0xd446('0x24')][_0xd446('0x44')]);_0x22869a[_0xd446('0x48')]=qs['filters'](_[_0xd446('0x45')](_0x116e7b['query'],_0x15d16d[_0xd446('0x28')]));if(_0x116e7b[_0xd446('0x24')][_0xd446('0x47')]){_0x22869a['where']=_[_0xd446('0x2e')](_0x22869a['where'],{'$or':_[_0xd446('0x1f')](_0x22869a[_0xd446('0x29')],function(_0x122dc7){var _0x4a928a={};_0x4a928a[_0x122dc7]={'$like':'%'+_0x116e7b[_0xd446('0x24')]['filter']+'%'};return _0x4a928a;})});}_0x22869a=_[_0xd446('0x2e')]({},_0x22869a,_0x116e7b['options']);return _0x99d53c['getTeams'](_0x22869a);}})[_0xd446('0x14')](function(_0x334458){if(_0x334458){_0x5c7a0c=_0x334458[_0xd446('0x2c')];if(!_0x116e7b[_0xd446('0x24')][_0xd446('0x41')](_0xd446('0x42'))){_0x22869a['limit']=qs[_0xd446('0x12')](_0x116e7b[_0xd446('0x24')]['limit']);_0x22869a[_0xd446('0xf')]=qs[_0xd446('0xf')](_0x116e7b[_0xd446('0x24')][_0xd446('0xf')]);}return _0x99d53c['getTeams'](_0x22869a);}})[_0xd446('0x14')](function(_0x2d404e){if(_0x2d404e){return _0x2d404e?{'count':_0x5c7a0c,'rows':_0x2d404e}:null;}})['then'](respondWithResult(_0x50cb7f,null))[_0xd446('0x31')](handleError(_0x50cb7f,null));};exports['addTeams']=function(_0x21f14a,_0x561e68){var _0x590316=_0x21f14a[_0xd446('0x33')][_0xd446('0x53')];return db[_0xd446('0x52')][_0xd446('0x54')]({'where':{'id':_0x590316},'attributes':['id'],'include':[{'model':db[_0xd446('0x55')],'as':_0xd446('0x56'),'attributes':['id',_0xd446('0x1c'),_0xd446('0x57'),'voicePause',_0xd446('0x58')],'raw':!![]}]})[_0xd446('0x14')](function(_0x159f86){if(_0x159f86){var _0x385dc2=_[_0xd446('0x59')](_0x159f86,function(_0x119bb3){var _0x2629e5=_0x119bb3[_0xd446('0x15')]({'plain':!![]});return _0x2629e5[_0xd446('0x56')];});return db['ChatQueue'][_0xd446('0x30')]({'where':{'id':_0x21f14a[_0xd446('0x3b')]['id']}})[_0xd446('0x14')](function(_0x35842b){return db['sequelize'][_0xd446('0x5a')](function(_0x36b336){return _0x35842b[_0xd446('0x5b')](_0x590316,{'transaction':_0x36b336})['then'](function(){return BPromise[_0xd446('0x5c')](_0x385dc2,function(_0x4ca544){return db[_0xd446('0x40')][_0xd446('0x5d')]({'where':{'UserId':_0x4ca544['id'],'ChatQueueId':_0x21f14a['params']['id']},'transaction':_0x36b336});});})[_0xd446('0x14')](function(){_0x385dc2[_0xd446('0x5e')](function(_0x23be00){socket['emit'](_0xd446('0x5f'),{'UserId':_0x23be00['id'],'ChatQueueId':_0x35842b['id']});});});});});}})['then'](respondWithStatusCode(_0x561e68,null))[_0xd446('0x31')](handleError(_0x561e68,null));};exports[_0xd446('0x60')]=function(_0x3b93ab,_0xe92374){return db[_0xd446('0x52')][_0xd446('0x54')]({'where':{'id':_0x3b93ab[_0xd446('0x24')][_0xd446('0x53')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd446('0x56'),'attributes':['id'],'raw':!![]}]})[_0xd446('0x14')](handleEntityNotFound(_0xe92374,null))[_0xd446('0x14')](function(_0x181b4b){var _0x3c733c=_[_0xd446('0x1f')](_0x181b4b,'id');var _0x55425e=[];var _0x42f2d3=[];var _0x5e6007=squel['select']();_0x5e6007[_0xd446('0x61')]('tq.TeamId')[_0xd446('0x62')](_0xd446('0x63'),'tq')[_0xd446('0x64')](_0xd446('0x65'),'ut',_0xd446('0x66'))[_0xd446('0x48')](_0xd446('0x67'),_0x3b93ab[_0xd446('0x3b')]['id']);for(var _0x381842=0x0;_0x381842<_0x181b4b[_0xd446('0x2c')];_0x381842+=0x1){let _0x4229bc=_0x181b4b[_0x381842];for(var _0x1ec6df=0x0;_0x1ec6df<_0x4229bc[_0xd446('0x56')][_0xd446('0x2c')];_0x1ec6df+=0x1){let _0x12b5fb=_0x4229bc[_0xd446('0x56')][_0x1ec6df];var _0x426567=_0x5e6007[_0xd446('0x68')]();_0x426567[_0xd446('0x48')](_0xd446('0x69'),_0x12b5fb['id']);_0x42f2d3['push'](db[_0xd446('0x6a')][_0xd446('0x24')](_0x426567[_0xd446('0x6b')](),{'type':db[_0xd446('0x6a')][_0xd446('0x6c')]['SELECT']})[_0xd446('0x14')](function(_0x5cebd9){if(_0x5cebd9[_0xd446('0x2c')]===0x1){return _0x12b5fb['id'];}else{var _0x2b1f13=_['every'](_[_0xd446('0x1f')](_0x5cebd9,_0xd446('0x6d')),function(_0x3bcd32){return _['includes'](_0x3c733c,_0x3bcd32);});if(_0x2b1f13){return _0x12b5fb['id'];}}}));}}return BPromise['all'](_0x42f2d3)['then'](function(_0x3d19ef){_0x55425e=_(_0x55425e)[_0xd446('0x6e')](_0x3d19ef)[_0xd446('0x6f')]()[_0xd446('0x70')]();return db['ChatQueue'][_0xd446('0x30')]({'where':{'id':_0x3b93ab[_0xd446('0x3b')]['id']}})[_0xd446('0x14')](function(_0x5d063b){return db[_0xd446('0x6a')]['transaction'](function(_0x1dccbe){return _0x5d063b['removeTeams'](_0x3b93ab[_0xd446('0x24')][_0xd446('0x53')],{'transaction':_0x1dccbe})[_0xd446('0x14')](function(){if(!_[_0xd446('0x71')](_0x55425e)){return _0x5d063b[_0xd446('0x72')](_0x55425e,{'transaction':_0x1dccbe});}})[_0xd446('0x14')](function(){_0x55425e['forEach'](function(_0x1eaa5d){socket['emit']('userChatQueue:remove',{'UserId':_0x1eaa5d,'ChatQueueId':_0x5d063b['id']});});});});});});})['then'](respondWithStatusCode(_0xe92374,null))[_0xd446('0x31')](handleError(_0xe92374,null));};exports[_0xd446('0x73')]=function(_0x3275db,_0x24dbd9){return db[_0xd446('0x20')][_0xd446('0x30')]({'where':{'id':_0x3275db['params']['id']}})[_0xd446('0x14')](handleEntityNotFound(_0x24dbd9,null))['then'](function(_0x56656b){if(_0x56656b){return _0x56656b[_0xd446('0x73')](_0x3275db[_0xd446('0x33')][_0xd446('0x53')],_[_0xd446('0x74')](_0x3275db[_0xd446('0x33')],[_0xd446('0x53'),'id'])||{})[_0xd446('0x75')](function(_0x544d65){for(var _0xe3a4fa=0x0;_0xe3a4fa<_0x3275db[_0xd446('0x33')][_0xd446('0x53')]['length'];_0xe3a4fa+=0x1){socket[_0xd446('0x76')](_0xd446('0x5f'),{'UserId':Number(_0x3275db[_0xd446('0x33')][_0xd446('0x53')][_0xe3a4fa]),'ChatQueueId':Number(_0x3275db[_0xd446('0x3b')]['id'])});}return _0x544d65;});}})['then'](respondWithResult(_0x24dbd9,null))[_0xd446('0x31')](handleError(_0x24dbd9,null));};exports['removeAgents']=function(_0x17e92e,_0x19abbb){return db['ChatQueue']['find']({'where':{'id':_0x17e92e['params']['id']}})[_0xd446('0x14')](handleEntityNotFound(_0x19abbb,null))[_0xd446('0x14')](function(_0x17fdd5){if(_0x17fdd5){return _0x17fdd5[_0xd446('0x72')](_0x17e92e['query']['ids'])['then'](function(){if(_[_0xd446('0x77')](_0x17e92e[_0xd446('0x24')][_0xd446('0x53')])){for(var _0x326496=0x0;_0x326496<_0x17e92e[_0xd446('0x24')]['ids'][_0xd446('0x2c')];_0x326496+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x17e92e['query'][_0xd446('0x53')][_0x326496]),'ChatQueueId':Number(_0x17e92e[_0xd446('0x3b')]['id'])});}}else{socket['emit'](_0xd446('0x78'),{'UserId':Number(_0x17e92e[_0xd446('0x24')][_0xd446('0x53')]),'ChatQueueId':Number(_0x17e92e[_0xd446('0x3b')]['id'])});}});}})['then'](respondWithStatusCode(_0x19abbb,null))['catch'](handleError(_0x19abbb,null));};exports[_0xd446('0x79')]=function(_0x30b4d6,_0x2f11cb){var _0x238b66={};var _0x20b313={};var _0x48c2d8;var _0x4dab0b;return db[_0xd446('0x20')][_0xd446('0x3e')]({'where':{'id':_0x30b4d6[_0xd446('0x3b')]['id']}})[_0xd446('0x14')](handleEntityNotFound(_0x2f11cb,null))[_0xd446('0x14')](function(_0x59d6d7){if(_0x59d6d7){_0x48c2d8=_0x59d6d7;_0x20b313[_0xd446('0x27')]=_['keys'](db[_0xd446('0x55')]['rawAttributes']);_0x20b313[_0xd446('0x24')]=_[_0xd446('0x3f')](_0x30b4d6[_0xd446('0x24')]);_0x20b313[_0xd446('0x28')]=_[_0xd446('0x2a')](_0x20b313['model'],_0x20b313[_0xd446('0x24')]);_0x238b66[_0xd446('0x29')]=_['intersection'](_0x20b313[_0xd446('0x27')],qs[_0xd446('0x2b')](_0x30b4d6[_0xd446('0x24')]['fields']));_0x238b66[_0xd446('0x29')]=_0x238b66[_0xd446('0x29')][_0xd446('0x2c')]?_0x238b66[_0xd446('0x29')]:_0x20b313[_0xd446('0x27')];_0x238b66[_0xd446('0x43')]=qs[_0xd446('0x44')](_0x30b4d6[_0xd446('0x24')][_0xd446('0x44')]);_0x238b66[_0xd446('0x48')]=qs['filters'](_['pick'](_0x30b4d6[_0xd446('0x24')],_0x20b313[_0xd446('0x28')]));if(_0x30b4d6[_0xd446('0x24')][_0xd446('0x47')]){_0x238b66[_0xd446('0x48')]=_[_0xd446('0x2e')](_0x238b66[_0xd446('0x48')],{'$or':_['map'](_0x238b66[_0xd446('0x29')],function(_0x19274b){var _0x49eb88={};_0x49eb88[_0x19274b]={'$like':'%'+_0x30b4d6[_0xd446('0x24')][_0xd446('0x47')]+'%'};return _0x49eb88;})});}_0x238b66=_[_0xd446('0x2e')]({},_0x238b66,_0x30b4d6['options']);return _0x48c2d8['getAgents'](_0x238b66);}})[_0xd446('0x14')](function(_0x4350e3){if(_0x4350e3){_0x4dab0b=_0x4350e3[_0xd446('0x2c')];if(!_0x30b4d6[_0xd446('0x24')]['hasOwnProperty']('nolimit')){_0x238b66[_0xd446('0x12')]=qs[_0xd446('0x12')](_0x30b4d6[_0xd446('0x24')][_0xd446('0x12')]);_0x238b66[_0xd446('0xf')]=qs['offset'](_0x30b4d6[_0xd446('0x24')][_0xd446('0xf')]);}return _0x48c2d8[_0xd446('0x79')](_0x238b66);}})[_0xd446('0x14')](function(_0x1199c3){if(_0x1199c3){return _0x1199c3?{'count':_0x4dab0b,'rows':_0x1199c3}:null;}})[_0xd446('0x14')](respondWithResult(_0x2f11cb,null))[_0xd446('0x31')](handleError(_0x2f11cb,null));}; \ No newline at end of file +var _0xcba0=['from','team_has_chat_queues','join','user_has_teams','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','forEach','addAgents','spread','removeAgents','isArray','userChatQueue:remove','getAgents','bluebird','util','squel','ioredis','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','update','destroy','then','get','ChatQueues','UserProfileResource','error','stack','name','send','index','map','ChatQueue','type','key','where','include','query','findAll','rows','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','describe','getMembers','UserChatQueue','hasOwnProperty','nolimit','sort','pick','ChatQueueId','filter','options','User','findAndCountAll','agent','chatPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','rawAttributes','order','addTeams','ids','Team','voicePause','flatMap','Agents','transaction','each','emit','userChatQueue:save','removeTeams','field','tq.TeamId'];(function(_0x1ebfc7,_0x2797db){var _0x1627b8=function(_0x59ceee){while(--_0x59ceee){_0x1ebfc7['push'](_0x1ebfc7['shift']());}};_0x1627b8(++_0x2797db);}(_0xcba0,0x177));var _0x0cba=function(_0x3ca086,_0x19a822){_0x3ca086=_0x3ca086-0x0;var _0x337a8c=_0xcba0[_0x3ca086];return _0x337a8c;};'use strict';var BPromise=require(_0x0cba('0x0'));var util=require(_0x0cba('0x1'));var _=require('lodash');var squel=require(_0x0cba('0x2'));var Redis=require(_0x0cba('0x3'));var qs=require(_0x0cba('0x4'));var logger=require('../../config/logger')(_0x0cba('0x5'));var config=require(_0x0cba('0x6'));var db=require(_0x0cba('0x7'))['db'];config[_0x0cba('0x8')]=_[_0x0cba('0x9')](config['redis'],{'host':_0x0cba('0xa'),'port':0x18eb});var socket=require(_0x0cba('0xb'))(new Redis(config[_0x0cba('0x8')]));require('./chatQueue.socket')[_0x0cba('0xc')](socket);function respondWithStatusCode(_0x43deff,_0x27582c){_0x27582c=_0x27582c||0xcc;return function(_0x491b7d){if(_0x491b7d){return _0x43deff[_0x0cba('0xd')](_0x27582c);}return _0x43deff[_0x0cba('0xe')](_0x27582c)[_0x0cba('0xf')]();};}function respondWithResult(_0x28cea8,_0x2c1abe){_0x2c1abe=_0x2c1abe||0xc8;return function(_0xb62714){if(_0xb62714){return _0x28cea8[_0x0cba('0xe')](_0x2c1abe)[_0x0cba('0x10')](_0xb62714);}};}function respondWithFilteredResult(_0x2c5884,_0x3a23cc){return function(_0x208cab){if(_0x208cab){var _0x40dfc3=typeof _0x3a23cc[_0x0cba('0x11')]==='undefined'&&typeof _0x3a23cc[_0x0cba('0x12')]===_0x0cba('0x13');var _0x54e1e1=_0x208cab[_0x0cba('0x14')];var _0x34978c=_0x40dfc3?0x0:_0x3a23cc[_0x0cba('0x11')];var _0x22cded=_0x40dfc3?_0x208cab['count']:_0x3a23cc['offset']+_0x3a23cc[_0x0cba('0x12')];var _0x2af7f5;if(_0x22cded>=_0x54e1e1){_0x22cded=_0x54e1e1;_0x2af7f5=0xc8;}else{_0x2af7f5=0xce;}_0x2c5884[_0x0cba('0xe')](_0x2af7f5);return _0x2c5884[_0x0cba('0x15')](_0x0cba('0x16'),_0x34978c+'-'+_0x22cded+'/'+_0x54e1e1)[_0x0cba('0x10')](_0x208cab);}return null;};}function saveUpdates(_0x1db233){return function(_0x45def){if(_0x45def){return _0x45def[_0x0cba('0x17')](_0x1db233)['then'](function(_0x3b99bc){return _0x3b99bc;});}return null;};}function removeEntity(_0x1809be){return function(_0x495054){if(_0x495054){return _0x495054[_0x0cba('0x18')]()[_0x0cba('0x19')](function(){var _0x3a928d=_0x495054[_0x0cba('0x1a')]({'plain':!![]});var _0x470d86=_0x0cba('0x1b');return db[_0x0cba('0x1c')][_0x0cba('0x18')]({'where':{'type':_0x470d86,'resourceId':_0x3a928d['id']}})[_0x0cba('0x19')](function(){return _0x495054;});})[_0x0cba('0x19')](function(){_0x1809be[_0x0cba('0xe')](0xcc)[_0x0cba('0xf')]();});}};}function handleEntityNotFound(_0x1158ba){return function(_0x17d4a7){if(!_0x17d4a7){_0x1158ba[_0x0cba('0xd')](0x194);}return _0x17d4a7;};}function handleError(_0x3699eb,_0x5aa48f){_0x5aa48f=_0x5aa48f||0x1f4;return function(_0x5983cc){logger[_0x0cba('0x1d')](_0x5983cc[_0x0cba('0x1e')]);if(_0x5983cc[_0x0cba('0x1f')]){delete _0x5983cc[_0x0cba('0x1f')];}_0x3699eb[_0x0cba('0xe')](_0x5aa48f)[_0x0cba('0x20')](_0x5983cc);};}exports[_0x0cba('0x21')]=function(_0x34ab49,_0x3b4477){var _0x29ddcf={};var _0x49219d={'count':0x0,'rows':[]};var _0x3c67ad=_[_0x0cba('0x22')](db[_0x0cba('0x23')]['rawAttributes'],function(_0x2f87dd){return{'name':_0x2f87dd['fieldName'],'type':_0x2f87dd[_0x0cba('0x24')][_0x0cba('0x25')]};});_0x29ddcf=qs['getOptions'](_0x3c67ad,_0x34ab49);var _0x119fa9={'where':_0x29ddcf[_0x0cba('0x26')]};return db[_0x0cba('0x23')][_0x0cba('0x14')](_0x119fa9)[_0x0cba('0x19')](function(_0x454b24){_0x49219d[_0x0cba('0x14')]=_0x454b24;_0x29ddcf[_0x0cba('0x27')]=qs[_0x0cba('0x27')](_0x34ab49[_0x0cba('0x28')]);return db['ChatQueue'][_0x0cba('0x29')](_0x29ddcf);})['then'](function(_0x1947b6){_0x49219d[_0x0cba('0x2a')]=_0x1947b6;return _0x49219d;})[_0x0cba('0x19')](respondWithFilteredResult(_0x3b4477,_0x29ddcf))['catch'](handleError(_0x3b4477,null));};exports[_0x0cba('0x2b')]=function(_0xfb4eee,_0x16eda2){var _0x59b170={'raw':!![],'where':{'id':_0xfb4eee[_0x0cba('0x2c')]['id']}},_0x339287={};_0x339287[_0x0cba('0x2d')]=_[_0x0cba('0x2e')](db[_0x0cba('0x23')]['rawAttributes']);_0x339287[_0x0cba('0x28')]=_[_0x0cba('0x2e')](_0xfb4eee['query']);_0x339287[_0x0cba('0x2f')]=_[_0x0cba('0x30')](_0x339287['model'],_0x339287[_0x0cba('0x28')]);_0x59b170[_0x0cba('0x31')]=_[_0x0cba('0x30')](_0x339287['model'],qs[_0x0cba('0x32')](_0xfb4eee['query'][_0x0cba('0x32')]));_0x59b170[_0x0cba('0x31')]=_0x59b170[_0x0cba('0x31')][_0x0cba('0x33')]?_0x59b170[_0x0cba('0x31')]:_0x339287['model'];if(_0xfb4eee[_0x0cba('0x28')][_0x0cba('0x34')]){_0x59b170[_0x0cba('0x27')]=[{'all':!![]}];}_0x59b170=_[_0x0cba('0x35')]({},_0x59b170,_0xfb4eee['options']);return db['ChatQueue'][_0x0cba('0x36')](_0x59b170)[_0x0cba('0x19')](handleEntityNotFound(_0x16eda2,null))['then'](respondWithResult(_0x16eda2,null))[_0x0cba('0x37')](handleError(_0x16eda2,null));};exports[_0x0cba('0x38')]=function(_0x460a28,_0x4d5eca){return db[_0x0cba('0x23')][_0x0cba('0x38')](_0x460a28[_0x0cba('0x39')],{})[_0x0cba('0x19')](function(_0x570e94){var _0x1e3b34=_0x460a28[_0x0cba('0x3a')][_0x0cba('0x1a')]({'plain':!![]});if(!_0x1e3b34)throw new Error(_0x0cba('0x3b'));if(_0x1e3b34[_0x0cba('0x3c')]===_0x0cba('0x3a')){var _0xc85079=_0x570e94['get']({'plain':!![]});var _0xdb6b56=_0x0cba('0x1b');return db['UserProfileSection'][_0x0cba('0x36')]({'where':{'name':_0xdb6b56,'userProfileId':_0x1e3b34[_0x0cba('0x3d')]},'raw':!![]})[_0x0cba('0x19')](function(_0x3826e5){if(_0x3826e5&&_0x3826e5['autoAssociation']===0x0){return db[_0x0cba('0x1c')][_0x0cba('0x38')]({'name':_0xc85079[_0x0cba('0x1f')],'resourceId':_0xc85079['id'],'type':_0x3826e5[_0x0cba('0x1f')],'sectionId':_0x3826e5['id']},{})[_0x0cba('0x19')](function(){return _0x570e94;});}else{return _0x570e94;}})[_0x0cba('0x37')](function(_0x1516df){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1516df);throw _0x1516df;});}return _0x570e94;})[_0x0cba('0x19')](respondWithResult(_0x4d5eca,0xc9))['catch'](handleError(_0x4d5eca,null));};exports[_0x0cba('0x17')]=function(_0x74f945,_0xd2eb0c){if(_0x74f945[_0x0cba('0x39')]['id']){delete _0x74f945[_0x0cba('0x39')]['id'];}return db['ChatQueue'][_0x0cba('0x36')]({'where':{'id':_0x74f945[_0x0cba('0x2c')]['id']}})[_0x0cba('0x19')](handleEntityNotFound(_0xd2eb0c,null))['then'](saveUpdates(_0x74f945[_0x0cba('0x39')],null))['then'](respondWithResult(_0xd2eb0c,null))[_0x0cba('0x37')](handleError(_0xd2eb0c,null));};exports[_0x0cba('0x18')]=function(_0x1ba136,_0x2fcf2e){return db[_0x0cba('0x23')]['find']({'where':{'id':_0x1ba136[_0x0cba('0x2c')]['id']}})[_0x0cba('0x19')](handleEntityNotFound(_0x2fcf2e,null))[_0x0cba('0x19')](removeEntity(_0x2fcf2e,null))['catch'](handleError(_0x2fcf2e,null));};exports[_0x0cba('0x3e')]=function(_0x2f462e,_0x2e0cff){return db[_0x0cba('0x23')][_0x0cba('0x3e')]()[_0x0cba('0x19')](respondWithResult(_0x2e0cff,null))['catch'](handleError(_0x2e0cff,null));};exports[_0x0cba('0x3f')]=function(_0x36ad4f,_0x32ae34){var _0x47aaeb={'raw':!![],'where':{}},_0x2b73d5={},_0x22ae07;return db[_0x0cba('0x23')]['findOne']({'where':{'id':_0x36ad4f[_0x0cba('0x2c')]['id']}})[_0x0cba('0x19')](handleEntityNotFound(_0x32ae34,null))[_0x0cba('0x19')](function(_0x15db8c){if(_0x15db8c){_0x22ae07=_0x15db8c[_0x0cba('0x1a')]({'plain':!![]});_0x2b73d5[_0x0cba('0x2d')]=_['keys'](db[_0x0cba('0x40')]['rawAttributes']);_0x2b73d5['query']=_[_0x0cba('0x2e')](_0x36ad4f[_0x0cba('0x28')]);_0x2b73d5[_0x0cba('0x2f')]=_[_0x0cba('0x30')](_0x2b73d5[_0x0cba('0x2d')],_0x2b73d5['query']);_0x47aaeb[_0x0cba('0x31')]=_['intersection'](_0x2b73d5['model'],qs[_0x0cba('0x32')](_0x36ad4f[_0x0cba('0x28')][_0x0cba('0x32')]));_0x47aaeb[_0x0cba('0x31')]=_0x47aaeb[_0x0cba('0x31')]['length']?_0x47aaeb[_0x0cba('0x31')]:_0x2b73d5[_0x0cba('0x2d')];if(!_0x36ad4f[_0x0cba('0x28')][_0x0cba('0x41')](_0x0cba('0x42'))){_0x47aaeb[_0x0cba('0x12')]=qs['limit'](_0x36ad4f[_0x0cba('0x28')][_0x0cba('0x12')]);_0x47aaeb[_0x0cba('0x11')]=qs['offset'](_0x36ad4f[_0x0cba('0x28')]['offset']);}_0x47aaeb['order']=qs[_0x0cba('0x43')](_0x36ad4f[_0x0cba('0x28')][_0x0cba('0x43')]);_0x47aaeb[_0x0cba('0x26')]=qs[_0x0cba('0x2f')](_[_0x0cba('0x44')](_0x36ad4f[_0x0cba('0x28')],_0x2b73d5[_0x0cba('0x2f')]));_0x47aaeb['where'][_0x0cba('0x45')]=_0x15db8c['id'];if(_0x36ad4f['query'][_0x0cba('0x46')]){_0x47aaeb[_0x0cba('0x26')]=_[_0x0cba('0x35')](_0x47aaeb[_0x0cba('0x26')],{'$or':_[_0x0cba('0x22')](_0x47aaeb['attributes'],function(_0x5d86db){var _0x5caadd={};_0x5caadd[_0x5d86db]={'$like':'%'+_0x36ad4f[_0x0cba('0x28')][_0x0cba('0x46')]+'%'};return _0x5caadd;})});}_0x47aaeb=_[_0x0cba('0x35')]({},_0x47aaeb,_0x36ad4f[_0x0cba('0x47')]);return db[_0x0cba('0x40')][_0x0cba('0x29')](_0x47aaeb);}})[_0x0cba('0x19')](function(_0x981392){if(_0x981392){return db[_0x0cba('0x48')][_0x0cba('0x49')]({'where':{'id':_['map'](_0x981392,'UserId'),'role':_0x0cba('0x4a')},'attributes':['id',_0x0cba('0x1f'),_0x0cba('0x4b'),_0x0cba('0x4c'),_0x0cba('0x4d')]});}})[_0x0cba('0x19')](function(_0x31fe7f){if(_0x31fe7f){return{'count':_0x31fe7f[_0x0cba('0x14')],'rows':_[_0x0cba('0x22')](_0x31fe7f[_0x0cba('0x2a')],function(_0x527dff){return{'membername':_0x527dff[_0x0cba('0x1f')],'UserId':_0x527dff['id'],'queue_name':_0x22ae07[_0x0cba('0x1f')],'ChatQueueId':_0x22ae07['id'],'interface':util[_0x0cba('0x4e')](_0x0cba('0x4f'),'SIP',_0x527dff[_0x0cba('0x1f')]),'penalty':0x0,'paused':_0x527dff[_0x0cba('0x4b')],'createdAt':_0x527dff[_0x0cba('0x4d')],'updatedAt':_0x527dff[_0x0cba('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x0cba('0x19')](respondWithFilteredResult(_0x32ae34,_0x47aaeb))[_0x0cba('0x37')](handleError(_0x32ae34,null));};exports[_0x0cba('0x50')]=function(_0x39f23c,_0x46e419){var _0x4689c0={};var _0x4aad64={};var _0x48b35d;var _0x532236;return db[_0x0cba('0x23')][_0x0cba('0x51')]({'where':{'id':_0x39f23c[_0x0cba('0x2c')]['id']}})['then'](handleEntityNotFound(_0x46e419,null))[_0x0cba('0x19')](function(_0x31e1d0){if(_0x31e1d0){_0x48b35d=_0x31e1d0;_0x4aad64[_0x0cba('0x2d')]=_[_0x0cba('0x2e')](db['Team'][_0x0cba('0x52')]);_0x4aad64[_0x0cba('0x28')]=_[_0x0cba('0x2e')](_0x39f23c[_0x0cba('0x28')]);_0x4aad64[_0x0cba('0x2f')]=_[_0x0cba('0x30')](_0x4aad64['model'],_0x4aad64[_0x0cba('0x28')]);_0x4689c0[_0x0cba('0x31')]=_[_0x0cba('0x30')](_0x4aad64[_0x0cba('0x2d')],qs[_0x0cba('0x32')](_0x39f23c['query'][_0x0cba('0x32')]));_0x4689c0[_0x0cba('0x31')]=_0x4689c0[_0x0cba('0x31')][_0x0cba('0x33')]?_0x4689c0[_0x0cba('0x31')]:_0x4aad64[_0x0cba('0x2d')];_0x4689c0[_0x0cba('0x53')]=qs['sort'](_0x39f23c[_0x0cba('0x28')]['sort']);_0x4689c0['where']=qs[_0x0cba('0x2f')](_[_0x0cba('0x44')](_0x39f23c[_0x0cba('0x28')],_0x4aad64[_0x0cba('0x2f')]));if(_0x39f23c[_0x0cba('0x28')][_0x0cba('0x46')]){_0x4689c0[_0x0cba('0x26')]=_['merge'](_0x4689c0[_0x0cba('0x26')],{'$or':_['map'](_0x4689c0[_0x0cba('0x31')],function(_0x25090e){var _0x4c5dc2={};_0x4c5dc2[_0x25090e]={'$like':'%'+_0x39f23c[_0x0cba('0x28')]['filter']+'%'};return _0x4c5dc2;})});}_0x4689c0=_[_0x0cba('0x35')]({},_0x4689c0,_0x39f23c[_0x0cba('0x47')]);return _0x48b35d[_0x0cba('0x50')](_0x4689c0);}})[_0x0cba('0x19')](function(_0x337d49){if(_0x337d49){_0x532236=_0x337d49[_0x0cba('0x33')];if(!_0x39f23c[_0x0cba('0x28')][_0x0cba('0x41')](_0x0cba('0x42'))){_0x4689c0[_0x0cba('0x12')]=qs[_0x0cba('0x12')](_0x39f23c[_0x0cba('0x28')][_0x0cba('0x12')]);_0x4689c0[_0x0cba('0x11')]=qs[_0x0cba('0x11')](_0x39f23c[_0x0cba('0x28')]['offset']);}return _0x48b35d[_0x0cba('0x50')](_0x4689c0);}})[_0x0cba('0x19')](function(_0x394fc1){if(_0x394fc1){return _0x394fc1?{'count':_0x532236,'rows':_0x394fc1}:null;}})[_0x0cba('0x19')](respondWithResult(_0x46e419,null))[_0x0cba('0x37')](handleError(_0x46e419,null));};exports[_0x0cba('0x54')]=function(_0x51d085,_0x35bebe){var _0xbd4c3b=_0x51d085[_0x0cba('0x39')][_0x0cba('0x55')];return db[_0x0cba('0x56')][_0x0cba('0x29')]({'where':{'id':_0xbd4c3b},'attributes':['id'],'include':[{'model':db[_0x0cba('0x48')],'as':'Agents','attributes':['id',_0x0cba('0x1f'),'online',_0x0cba('0x57'),'interface'],'raw':!![]}]})[_0x0cba('0x19')](function(_0x382f86){if(_0x382f86){var _0x1196b6=_[_0x0cba('0x58')](_0x382f86,function(_0x47da1f){var _0x15a756=_0x47da1f[_0x0cba('0x1a')]({'plain':!![]});return _0x15a756[_0x0cba('0x59')];});return db[_0x0cba('0x23')][_0x0cba('0x36')]({'where':{'id':_0x51d085[_0x0cba('0x2c')]['id']}})[_0x0cba('0x19')](function(_0x34e1d0){return db['sequelize'][_0x0cba('0x5a')](function(_0x8646df){return _0x34e1d0[_0x0cba('0x54')](_0xbd4c3b,{'transaction':_0x8646df})[_0x0cba('0x19')](function(){return BPromise[_0x0cba('0x5b')](_0x1196b6,function(_0x5765e3){return db['UserChatQueue']['findOrCreate']({'where':{'UserId':_0x5765e3['id'],'ChatQueueId':_0x51d085['params']['id']},'transaction':_0x8646df});});})[_0x0cba('0x19')](function(){_0x1196b6['forEach'](function(_0xc1f5cc){socket[_0x0cba('0x5c')](_0x0cba('0x5d'),{'UserId':_0xc1f5cc['id'],'ChatQueueId':_0x34e1d0['id']});});});});});}})[_0x0cba('0x19')](respondWithStatusCode(_0x35bebe,null))[_0x0cba('0x37')](handleError(_0x35bebe,null));};exports[_0x0cba('0x5e')]=function(_0x3b2fe0,_0x2223aa){return db[_0x0cba('0x56')][_0x0cba('0x29')]({'where':{'id':_0x3b2fe0[_0x0cba('0x28')][_0x0cba('0x55')]},'attributes':['id'],'include':[{'model':db[_0x0cba('0x48')],'as':_0x0cba('0x59'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2223aa,null))[_0x0cba('0x19')](function(_0x12ee73){var _0x142437=_['map'](_0x12ee73,'id');var _0x31f225=[];var _0x3a349d=[];var _0x2205a3=squel['select']();_0x2205a3[_0x0cba('0x5f')](_0x0cba('0x60'))[_0x0cba('0x61')](_0x0cba('0x62'),'tq')[_0x0cba('0x63')](_0x0cba('0x64'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0cba('0x26')]('ChatQueueId\x20=\x20?',_0x3b2fe0[_0x0cba('0x2c')]['id']);for(var _0x563097=0x0;_0x563097<_0x12ee73[_0x0cba('0x33')];_0x563097+=0x1){let _0x24ba1d=_0x12ee73[_0x563097];for(var _0x4c1b27=0x0;_0x4c1b27<_0x24ba1d[_0x0cba('0x59')][_0x0cba('0x33')];_0x4c1b27+=0x1){let _0x2d224f=_0x24ba1d[_0x0cba('0x59')][_0x4c1b27];var _0x4635ee=_0x2205a3['clone']();_0x4635ee[_0x0cba('0x26')]('ut.UserId\x20=\x20?',_0x2d224f['id']);_0x3a349d[_0x0cba('0x65')](db[_0x0cba('0x66')][_0x0cba('0x28')](_0x4635ee['toString'](),{'type':db[_0x0cba('0x66')][_0x0cba('0x67')][_0x0cba('0x68')]})['then'](function(_0x3d0b57){if(_0x3d0b57[_0x0cba('0x33')]===0x1){return _0x2d224f['id'];}else{var _0x22d9a=_[_0x0cba('0x69')](_['map'](_0x3d0b57,_0x0cba('0x6a')),function(_0x4c27fb){return _[_0x0cba('0x6b')](_0x142437,_0x4c27fb);});if(_0x22d9a){return _0x2d224f['id'];}}}));}}return BPromise['all'](_0x3a349d)['then'](function(_0x2e44fe){_0x31f225=_(_0x31f225)[_0x0cba('0x6c')](_0x2e44fe)[_0x0cba('0x6d')]()[_0x0cba('0x6e')]();return db['ChatQueue'][_0x0cba('0x36')]({'where':{'id':_0x3b2fe0[_0x0cba('0x2c')]['id']}})['then'](function(_0x3c70d0){return db[_0x0cba('0x66')]['transaction'](function(_0x57d213){return _0x3c70d0['removeTeams'](_0x3b2fe0[_0x0cba('0x28')][_0x0cba('0x55')],{'transaction':_0x57d213})[_0x0cba('0x19')](function(){if(!_['isEmpty'](_0x31f225)){return _0x3c70d0['removeAgents'](_0x31f225,{'transaction':_0x57d213});}})[_0x0cba('0x19')](function(){_0x31f225[_0x0cba('0x6f')](function(_0x5e0f06){socket[_0x0cba('0x5c')]('userChatQueue:remove',{'UserId':_0x5e0f06,'ChatQueueId':_0x3c70d0['id']});});});});});});})['then'](respondWithStatusCode(_0x2223aa,null))[_0x0cba('0x37')](handleError(_0x2223aa,null));};exports[_0x0cba('0x70')]=function(_0x312fdf,_0x4c12f7){return db[_0x0cba('0x23')][_0x0cba('0x36')]({'where':{'id':_0x312fdf[_0x0cba('0x2c')]['id']}})['then'](handleEntityNotFound(_0x4c12f7,null))['then'](function(_0x481e79){if(_0x481e79){return _0x481e79['addAgents'](_0x312fdf[_0x0cba('0x39')][_0x0cba('0x55')],_['omit'](_0x312fdf[_0x0cba('0x39')],[_0x0cba('0x55'),'id'])||{})[_0x0cba('0x71')](function(_0x53c1ee){for(var _0x5606fb=0x0;_0x5606fb<_0x312fdf[_0x0cba('0x39')]['ids'][_0x0cba('0x33')];_0x5606fb+=0x1){socket[_0x0cba('0x5c')](_0x0cba('0x5d'),{'UserId':Number(_0x312fdf[_0x0cba('0x39')][_0x0cba('0x55')][_0x5606fb]),'ChatQueueId':Number(_0x312fdf['params']['id'])});}return _0x53c1ee;});}})[_0x0cba('0x19')](respondWithResult(_0x4c12f7,null))[_0x0cba('0x37')](handleError(_0x4c12f7,null));};exports['removeAgents']=function(_0x57e8a8,_0x54fcc6){return db[_0x0cba('0x23')][_0x0cba('0x36')]({'where':{'id':_0x57e8a8['params']['id']}})[_0x0cba('0x19')](handleEntityNotFound(_0x54fcc6,null))[_0x0cba('0x19')](function(_0x85b62f){if(_0x85b62f){return _0x85b62f[_0x0cba('0x72')](_0x57e8a8[_0x0cba('0x28')][_0x0cba('0x55')])[_0x0cba('0x19')](function(){if(_[_0x0cba('0x73')](_0x57e8a8[_0x0cba('0x28')]['ids'])){for(var _0x32a2c4=0x0;_0x32a2c4<_0x57e8a8[_0x0cba('0x28')][_0x0cba('0x55')]['length'];_0x32a2c4+=0x1){socket[_0x0cba('0x5c')](_0x0cba('0x74'),{'UserId':Number(_0x57e8a8[_0x0cba('0x28')][_0x0cba('0x55')][_0x32a2c4]),'ChatQueueId':Number(_0x57e8a8['params']['id'])});}}else{socket[_0x0cba('0x5c')](_0x0cba('0x74'),{'UserId':Number(_0x57e8a8[_0x0cba('0x28')]['ids']),'ChatQueueId':Number(_0x57e8a8[_0x0cba('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x54fcc6,null))[_0x0cba('0x37')](handleError(_0x54fcc6,null));};exports[_0x0cba('0x75')]=function(_0x442b82,_0x42a031){var _0x352e95={};var _0x32d63b={};var _0x1db180;var _0x435518;return db[_0x0cba('0x23')]['findOne']({'where':{'id':_0x442b82['params']['id']}})[_0x0cba('0x19')](handleEntityNotFound(_0x42a031,null))[_0x0cba('0x19')](function(_0x4d70b8){if(_0x4d70b8){_0x1db180=_0x4d70b8;_0x32d63b[_0x0cba('0x2d')]=_[_0x0cba('0x2e')](db[_0x0cba('0x48')][_0x0cba('0x52')]);_0x32d63b[_0x0cba('0x28')]=_['keys'](_0x442b82[_0x0cba('0x28')]);_0x32d63b[_0x0cba('0x2f')]=_[_0x0cba('0x30')](_0x32d63b[_0x0cba('0x2d')],_0x32d63b[_0x0cba('0x28')]);_0x352e95[_0x0cba('0x31')]=_['intersection'](_0x32d63b[_0x0cba('0x2d')],qs['fields'](_0x442b82['query'][_0x0cba('0x32')]));_0x352e95[_0x0cba('0x31')]=_0x352e95['attributes'][_0x0cba('0x33')]?_0x352e95['attributes']:_0x32d63b[_0x0cba('0x2d')];_0x352e95[_0x0cba('0x53')]=qs[_0x0cba('0x43')](_0x442b82['query'][_0x0cba('0x43')]);_0x352e95[_0x0cba('0x26')]=qs[_0x0cba('0x2f')](_[_0x0cba('0x44')](_0x442b82[_0x0cba('0x28')],_0x32d63b[_0x0cba('0x2f')]));if(_0x442b82[_0x0cba('0x28')][_0x0cba('0x46')]){_0x352e95['where']=_[_0x0cba('0x35')](_0x352e95['where'],{'$or':_['map'](_0x352e95['attributes'],function(_0x25f699){var _0x1d288c={};_0x1d288c[_0x25f699]={'$like':'%'+_0x442b82[_0x0cba('0x28')]['filter']+'%'};return _0x1d288c;})});}_0x352e95=_[_0x0cba('0x35')]({},_0x352e95,_0x442b82['options']);return _0x1db180['getAgents'](_0x352e95);}})['then'](function(_0x1d886a){if(_0x1d886a){_0x435518=_0x1d886a['length'];if(!_0x442b82[_0x0cba('0x28')][_0x0cba('0x41')](_0x0cba('0x42'))){_0x352e95[_0x0cba('0x12')]=qs['limit'](_0x442b82[_0x0cba('0x28')][_0x0cba('0x12')]);_0x352e95[_0x0cba('0x11')]=qs[_0x0cba('0x11')](_0x442b82[_0x0cba('0x28')][_0x0cba('0x11')]);}return _0x1db180['getAgents'](_0x352e95);}})[_0x0cba('0x19')](function(_0x3f3d09){if(_0x3f3d09){return _0x3f3d09?{'count':_0x435518,'rows':_0x3f3d09}:null;}})[_0x0cba('0x19')](respondWithResult(_0x42a031,null))['catch'](handleError(_0x42a031,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 8ce0cbb..abbb962 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 _0xe799=['events','ChatQueue','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x50b922,_0x10cab8){var _0x1397b1=function(_0x21f12a){while(--_0x21f12a){_0x50b922['push'](_0x50b922['shift']());}};_0x1397b1(++_0x10cab8);}(_0xe799,0x170));var _0x9e79=function(_0x4fe9d3,_0x39fc2c){_0x4fe9d3=_0x4fe9d3-0x0;var _0x3a9818=_0xe799[_0x4fe9d3];return _0x3a9818;};'use strict';var EventEmitter=require(_0x9e79('0x0'));var ChatQueue=require('../../mysqldb')['db'][_0x9e79('0x1')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9e79('0x2'),'afterUpdate':_0x9e79('0x3'),'afterDestroy':'remove'};function emitEvent(_0x34a40e){return function(_0x3f0a4f,_0x809ffd,_0x4cfc04){ChatQueueEvents[_0x9e79('0x4')](_0x34a40e+':'+_0x3f0a4f['id'],_0x3f0a4f);ChatQueueEvents['emit'](_0x34a40e,_0x3f0a4f);_0x4cfc04(null);};}for(var e in events){if(events[_0x9e79('0x5')](e)){var event=events[e];ChatQueue[_0x9e79('0x6')](e,emitEvent(event));}}module[_0x9e79('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0xb5cd=['ChatQueue','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2889c3,_0x58a387){var _0x687c09=function(_0x363844){while(--_0x363844){_0x2889c3['push'](_0x2889c3['shift']());}};_0x687c09(++_0x58a387);}(_0xb5cd,0x134));var _0xdb5c=function(_0x3147f0,_0x4eba6e){_0x3147f0=_0x3147f0-0x0;var _0x546863=_0xb5cd[_0x3147f0];return _0x546863;};'use strict';var EventEmitter=require(_0xdb5c('0x0'));var ChatQueue=require(_0xdb5c('0x1'))['db'][_0xdb5c('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xdb5c('0x3')](0x0);var events={'afterCreate':_0xdb5c('0x4'),'afterUpdate':'update','afterDestroy':_0xdb5c('0x5')};function emitEvent(_0x1bdadc){return function(_0x3b013f,_0x1dcc3c,_0x27199a){ChatQueueEvents[_0xdb5c('0x6')](_0x1bdadc+':'+_0x3b013f['id'],_0x3b013f);ChatQueueEvents['emit'](_0x1bdadc,_0x3b013f);_0x27199a(null);};}for(var e in events){if(events[_0xdb5c('0x7')](e)){var event=events[e];ChatQueue[_0xdb5c('0x8')](e,emitEvent(event));}}module[_0xdb5c('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 6d1fec6..89aea55 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 _0x1e1c=['./chatQueue.attributes','exports','chat_queues','lodash','util','api','bluebird','request-promise','path'];(function(_0x4b956f,_0x443051){var _0x5cc84e=function(_0x28d360){while(--_0x28d360){_0x4b956f['push'](_0x4b956f['shift']());}};_0x5cc84e(++_0x443051);}(_0x1e1c,0x1bc));var _0xc1e1=function(_0x145c82,_0x55e865){_0x145c82=_0x145c82-0x0;var _0x26b045=_0x1e1c[_0x145c82];return _0x26b045;};'use strict';var _=require(_0xc1e1('0x0'));var util=require(_0xc1e1('0x1'));var logger=require('../../config/logger')(_0xc1e1('0x2'));var moment=require('moment');var BPromise=require(_0xc1e1('0x3'));var rp=require(_0xc1e1('0x4'));var fs=require('fs');var path=require(_0xc1e1('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc1e1('0x6'));module[_0xc1e1('0x7')]=function(_0x4db5db,_0x804a35){return _0x4db5db['define']('ChatQueue',attributes,{'tableName':_0xc1e1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1536=['ChatQueue','chat_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define'];(function(_0x966628,_0x1a6b89){var _0x18e4a1=function(_0x5817fa){while(--_0x5817fa){_0x966628['push'](_0x966628['shift']());}};_0x18e4a1(++_0x1a6b89);}(_0x1536,0x16e));var _0x6153=function(_0xfb5a95,_0x208590){_0xfb5a95=_0xfb5a95-0x0;var _0x418486=_0x1536[_0xfb5a95];return _0x418486;};'use strict';var _=require(_0x6153('0x0'));var util=require(_0x6153('0x1'));var logger=require(_0x6153('0x2'))('api');var moment=require(_0x6153('0x3'));var BPromise=require(_0x6153('0x4'));var rp=require(_0x6153('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6153('0x6'));var config=require(_0x6153('0x7'));var attributes=require(_0x6153('0x8'));module[_0x6153('0x9')]=function(_0x10f38b,_0x289b97){return _0x10f38b[_0x6153('0xa')](_0x6153('0xb'),attributes,{'tableName':_0x6153('0xc'),'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 a08c03e..54bc737 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 _0xb1ef=['client','defaults','redis','localhost','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','options','where','attributes','limit','map','include','model','ShowChatQueue','find','raw','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb1ef,0x146));var _0xfb1e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb1ef[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xfb1e('0x0'));var util=require('util');var moment=require(_0xfb1e('0x1'));var BPromise=require(_0xfb1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfb1e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfb1e('0x4'));var logger=require(_0xfb1e('0x5'))('rpc');var config=require(_0xfb1e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xfb1e('0x7')]['http']({'port':0x232a});config['redis']=_[_0xfb1e('0x8')](config[_0xfb1e('0x9')],{'host':_0xfb1e('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfb1e('0x9')]));require(_0xfb1e('0xb'))[_0xfb1e('0xc')](socket);function respondWithRpcPromise(_0x512860,_0x3e648b,_0x5e4bfa){return new BPromise(function(_0x301566,_0x228c95){return client['request'](_0x512860,_0x5e4bfa)[_0xfb1e('0xd')](function(_0x273e58){logger[_0xfb1e('0xe')](_0xfb1e('0xf'),_0x3e648b,_0xfb1e('0x10'));logger[_0xfb1e('0x11')](_0xfb1e('0x12'),_0x3e648b,'request\x20sent',JSON[_0xfb1e('0x13')](_0x273e58));if(_0x273e58[_0xfb1e('0x14')]){if(_0x273e58[_0xfb1e('0x14')][_0xfb1e('0x15')]===0x1f4){logger[_0xfb1e('0x14')](_0xfb1e('0xf'),_0x3e648b,_0x273e58['error'][_0xfb1e('0x16')]);return _0x228c95(_0x273e58[_0xfb1e('0x14')]['message']);}logger[_0xfb1e('0x14')](_0xfb1e('0xf'),_0x3e648b,_0x273e58[_0xfb1e('0x14')][_0xfb1e('0x16')]);return _0x301566(_0x273e58[_0xfb1e('0x14')][_0xfb1e('0x16')]);}else{logger[_0xfb1e('0xe')]('ChatQueue,\x20%s,\x20%s',_0x3e648b,_0xfb1e('0x10'));_0x301566(_0x273e58[_0xfb1e('0x17')][_0xfb1e('0x16')]);}})[_0xfb1e('0x18')](function(_0x25f742){logger[_0xfb1e('0x14')](_0xfb1e('0xf'),_0x3e648b,_0x25f742);_0x228c95(_0x25f742);});});}exports[_0xfb1e('0x19')]=function(_0x517ddd){var _0x41c882=this;return new Promise(function(_0x1594de,_0x2b8c7b){return db[_0xfb1e('0x1a')]['findAll']({'raw':_0x517ddd[_0xfb1e('0x1b')]?_0x517ddd[_0xfb1e('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x517ddd[_0xfb1e('0x1b')]?_0x517ddd[_0xfb1e('0x1b')][_0xfb1e('0x1c')]||null:null,'attributes':_0x517ddd[_0xfb1e('0x1b')]?_0x517ddd[_0xfb1e('0x1b')][_0xfb1e('0x1d')]||null:null,'limit':_0x517ddd[_0xfb1e('0x1b')]?_0x517ddd[_0xfb1e('0x1b')][_0xfb1e('0x1e')]||null:null,'include':_0x517ddd['options']?_0x517ddd['options']['include']?_[_0xfb1e('0x1f')](_0x517ddd['options'][_0xfb1e('0x20')],function(_0x16c328){return{'model':db[_0x16c328[_0xfb1e('0x21')]],'as':_0x16c328['as'],'attributes':_0x16c328[_0xfb1e('0x1d')],'include':_0x16c328[_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0x16c328[_0xfb1e('0x20')],function(_0x2f6c0f){return{'model':db[_0x2f6c0f['model']],'as':_0x2f6c0f['as'],'attributes':_0x2f6c0f[_0xfb1e('0x1d')],'include':_0x2f6c0f[_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0x2f6c0f[_0xfb1e('0x20')],function(_0x3b891c){return{'model':db[_0x3b891c['model']],'as':_0x3b891c['as'],'attributes':_0x3b891c[_0xfb1e('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xfb1e('0xd')](function(_0x1266f6){logger[_0xfb1e('0xe')](_0xfb1e('0x19'),_0x517ddd);logger[_0xfb1e('0x11')](_0xfb1e('0x19'),_0x517ddd,JSON['stringify'](_0x1266f6));_0x1594de(_0x1266f6);})[_0xfb1e('0x18')](function(_0x399de0){logger[_0xfb1e('0x14')](_0xfb1e('0x19'),_0x399de0[_0xfb1e('0x16')],_0x517ddd);_0x2b8c7b(_0x41c882['error'](0x1f4,_0x399de0[_0xfb1e('0x16')]));});});};exports[_0xfb1e('0x22')]=function(_0xd8abfd){var _0x47d5c4=this;return new Promise(function(_0x4aecca,_0x204ad3){return db[_0xfb1e('0x1a')][_0xfb1e('0x23')]({'raw':_0xd8abfd[_0xfb1e('0x1b')]?_0xd8abfd[_0xfb1e('0x1b')][_0xfb1e('0x24')]===undefined?!![]:![]:!![],'where':_0xd8abfd['options']?_0xd8abfd['options'][_0xfb1e('0x1c')]||null:null,'attributes':_0xd8abfd[_0xfb1e('0x1b')]?_0xd8abfd[_0xfb1e('0x1b')]['attributes']||null:null,'include':_0xd8abfd['options']?_0xd8abfd['options'][_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0xd8abfd[_0xfb1e('0x1b')][_0xfb1e('0x20')],function(_0x40024b){return{'model':db[_0x40024b[_0xfb1e('0x21')]],'as':_0x40024b['as'],'attributes':_0x40024b[_0xfb1e('0x1d')],'include':_0x40024b[_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0x40024b[_0xfb1e('0x20')],function(_0x438ba0){return{'model':db[_0x438ba0[_0xfb1e('0x21')]],'as':_0x438ba0['as'],'attributes':_0x438ba0['attributes'],'include':_0x438ba0[_0xfb1e('0x20')]?_[_0xfb1e('0x1f')](_0x438ba0[_0xfb1e('0x20')],function(_0x154b9f){return{'model':db[_0x154b9f[_0xfb1e('0x21')]],'as':_0x154b9f['as'],'attributes':_0x154b9f[_0xfb1e('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34dde7){logger[_0xfb1e('0xe')]('ShowChatQueue',_0xd8abfd);logger[_0xfb1e('0x11')](_0xfb1e('0x22'),_0xd8abfd,JSON[_0xfb1e('0x13')](_0x34dde7));_0x4aecca(_0x34dde7);})[_0xfb1e('0x18')](function(_0x586e81){logger['error'](_0xfb1e('0x22'),_0x586e81['message'],_0xd8abfd);_0x204ad3(_0x47d5c4[_0xfb1e('0x14')](0x1f4,_0x586e81['message']));});});}; \ No newline at end of file +var _0x689b=['attributes','limit','include','model','map','GetChatQueue','ShowChatQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./chatQueue.socket','register','then','info','ChatQueue,\x20%s,\x20%s','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','ChatQueue','raw','options','where'];(function(_0x38ea36,_0x4790c5){var _0x4c8cdd=function(_0x59dbf0){while(--_0x59dbf0){_0x38ea36['push'](_0x38ea36['shift']());}};_0x4c8cdd(++_0x4790c5);}(_0x689b,0xeb));var _0xb689=function(_0x3346ff,_0x417a52){_0x3346ff=_0x3346ff-0x0;var _0x466585=_0x689b[_0x3346ff];return _0x466585;};'use strict';var _=require(_0xb689('0x0'));var util=require(_0xb689('0x1'));var moment=require(_0xb689('0x2'));var BPromise=require(_0xb689('0x3'));var rs=require(_0xb689('0x4'));var fs=require('fs');var Redis=require(_0xb689('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb689('0x6'))(_0xb689('0x7'));var config=require(_0xb689('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb689('0x9')][_0xb689('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xb689('0xb')],{'host':_0xb689('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb689('0xb')]));require(_0xb689('0xd'))[_0xb689('0xe')](socket);function respondWithRpcPromise(_0x3e2f74,_0x2394b9,_0xe35a91){return new BPromise(function(_0x5d3ad6,_0x201e5){return client['request'](_0x3e2f74,_0xe35a91)[_0xb689('0xf')](function(_0x29ddfa){logger[_0xb689('0x10')](_0xb689('0x11'),_0x2394b9,'request\x20sent');logger[_0xb689('0x12')](_0xb689('0x13'),_0x2394b9,'request\x20sent',JSON[_0xb689('0x14')](_0x29ddfa));if(_0x29ddfa[_0xb689('0x15')]){if(_0x29ddfa[_0xb689('0x15')][_0xb689('0x16')]===0x1f4){logger[_0xb689('0x15')](_0xb689('0x11'),_0x2394b9,_0x29ddfa['error'][_0xb689('0x17')]);return _0x201e5(_0x29ddfa[_0xb689('0x15')][_0xb689('0x17')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x2394b9,_0x29ddfa['error']['message']);return _0x5d3ad6(_0x29ddfa['error'][_0xb689('0x17')]);}else{logger[_0xb689('0x10')]('ChatQueue,\x20%s,\x20%s',_0x2394b9,_0xb689('0x18'));_0x5d3ad6(_0x29ddfa[_0xb689('0x19')]['message']);}})[_0xb689('0x1a')](function(_0x4ea72c){logger[_0xb689('0x15')](_0xb689('0x11'),_0x2394b9,_0x4ea72c);_0x201e5(_0x4ea72c);});});}exports['GetChatQueue']=function(_0x49e094){var _0x2ab40e=this;return new Promise(function(_0x550f5f,_0x54f0db){return db[_0xb689('0x1b')]['findAll']({'raw':_0x49e094['options']?_0x49e094['options'][_0xb689('0x1c')]===undefined?!![]:![]:!![],'where':_0x49e094['options']?_0x49e094[_0xb689('0x1d')][_0xb689('0x1e')]||null:null,'attributes':_0x49e094[_0xb689('0x1d')]?_0x49e094[_0xb689('0x1d')][_0xb689('0x1f')]||null:null,'limit':_0x49e094[_0xb689('0x1d')]?_0x49e094[_0xb689('0x1d')][_0xb689('0x20')]||null:null,'include':_0x49e094[_0xb689('0x1d')]?_0x49e094[_0xb689('0x1d')][_0xb689('0x21')]?_['map'](_0x49e094[_0xb689('0x1d')][_0xb689('0x21')],function(_0x32d8ee){return{'model':db[_0x32d8ee[_0xb689('0x22')]],'as':_0x32d8ee['as'],'attributes':_0x32d8ee[_0xb689('0x1f')],'include':_0x32d8ee[_0xb689('0x21')]?_[_0xb689('0x23')](_0x32d8ee['include'],function(_0x413c56){return{'model':db[_0x413c56[_0xb689('0x22')]],'as':_0x413c56['as'],'attributes':_0x413c56[_0xb689('0x1f')],'include':_0x413c56[_0xb689('0x21')]?_[_0xb689('0x23')](_0x413c56[_0xb689('0x21')],function(_0x189fd4){return{'model':db[_0x189fd4[_0xb689('0x22')]],'as':_0x189fd4['as'],'attributes':_0x189fd4[_0xb689('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xb689('0xf')](function(_0x456b01){logger['info'](_0xb689('0x24'),_0x49e094);logger[_0xb689('0x12')](_0xb689('0x24'),_0x49e094,JSON['stringify'](_0x456b01));_0x550f5f(_0x456b01);})[_0xb689('0x1a')](function(_0x305809){logger[_0xb689('0x15')](_0xb689('0x24'),_0x305809[_0xb689('0x17')],_0x49e094);_0x54f0db(_0x2ab40e[_0xb689('0x15')](0x1f4,_0x305809[_0xb689('0x17')]));});});};exports[_0xb689('0x25')]=function(_0x39e36f){var _0xf07dd1=this;return new Promise(function(_0x100bfe,_0x6a2c39){return db[_0xb689('0x1b')]['find']({'raw':_0x39e36f[_0xb689('0x1d')]?_0x39e36f[_0xb689('0x1d')][_0xb689('0x1c')]===undefined?!![]:![]:!![],'where':_0x39e36f[_0xb689('0x1d')]?_0x39e36f[_0xb689('0x1d')]['where']||null:null,'attributes':_0x39e36f[_0xb689('0x1d')]?_0x39e36f[_0xb689('0x1d')]['attributes']||null:null,'include':_0x39e36f['options']?_0x39e36f[_0xb689('0x1d')][_0xb689('0x21')]?_[_0xb689('0x23')](_0x39e36f[_0xb689('0x1d')]['include'],function(_0x329e30){return{'model':db[_0x329e30[_0xb689('0x22')]],'as':_0x329e30['as'],'attributes':_0x329e30['attributes'],'include':_0x329e30[_0xb689('0x21')]?_[_0xb689('0x23')](_0x329e30[_0xb689('0x21')],function(_0xa23009){return{'model':db[_0xa23009[_0xb689('0x22')]],'as':_0xa23009['as'],'attributes':_0xa23009[_0xb689('0x1f')],'include':_0xa23009[_0xb689('0x21')]?_[_0xb689('0x23')](_0xa23009[_0xb689('0x21')],function(_0x578a90){return{'model':db[_0x578a90[_0xb689('0x22')]],'as':_0x578a90['as'],'attributes':_0x578a90['attributes']};}):[]};}):[]};}):[]:[]})[_0xb689('0xf')](function(_0x442384){logger[_0xb689('0x10')]('ShowChatQueue',_0x39e36f);logger[_0xb689('0x12')]('ShowChatQueue',_0x39e36f,JSON[_0xb689('0x14')](_0x442384));_0x100bfe(_0x442384);})[_0xb689('0x1a')](function(_0x5f2956){logger[_0xb689('0x15')]('ShowChatQueue',_0x5f2956['message'],_0x39e36f);_0x6a2c39(_0xf07dd1['error'](0x1f4,_0x5f2956[_0xb689('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index d59d3a1..7910f37 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 _0xbd50=['length','./chatQueue.events','save','remove','emit'];(function(_0x4ebd30,_0x27adc3){var _0x5cd4e7=function(_0x5d936e){while(--_0x5d936e){_0x4ebd30['push'](_0x4ebd30['shift']());}};_0x5cd4e7(++_0x27adc3);}(_0xbd50,0x196));var _0x0bd5=function(_0x5ec266,_0x2274b9){_0x5ec266=_0x5ec266-0x0;var _0x386316=_0xbd50[_0x5ec266];return _0x386316;};'use strict';var ChatQueueEvents=require(_0x0bd5('0x0'));var events=[_0x0bd5('0x1'),_0x0bd5('0x2'),'update'];function createListener(_0x44fcb9,_0x167372){return function(_0x37acba){_0x167372[_0x0bd5('0x3')](_0x44fcb9,_0x37acba);};}function removeListener(_0x15620d,_0x4c17ee){return function(){ChatQueueEvents['removeListener'](_0x15620d,_0x4c17ee);};}exports['register']=function(_0x376024){for(var _0x2ef1d0=0x0,_0xcc6cfa=events[_0x0bd5('0x4')];_0x2ef1d0<_0xcc6cfa;_0x2ef1d0++){var _0x1b99f3=events[_0x2ef1d0];var _0x5ebe64=createListener('chatQueue:'+_0x1b99f3,_0x376024);ChatQueueEvents['on'](_0x1b99f3,_0x5ebe64);}}; \ No newline at end of file +var _0xb332=['emit','register','./chatQueue.events','remove','update'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0xb332,0xd9));var _0x2b33=function(_0x214266,_0x1f6f52){_0x214266=_0x214266-0x0;var _0x568f75=_0xb332[_0x214266];return _0x568f75;};'use strict';var ChatQueueEvents=require(_0x2b33('0x0'));var events=['save',_0x2b33('0x1'),_0x2b33('0x2')];function createListener(_0x5ee720,_0xf8c6a7){return function(_0x548a70){_0xf8c6a7[_0x2b33('0x3')](_0x5ee720,_0x548a70);};}function removeListener(_0x4c6634,_0x34b111){return function(){ChatQueueEvents['removeListener'](_0x4c6634,_0x34b111);};}exports[_0x2b33('0x4')]=function(_0x22d66){for(var _0x478214=0x0,_0x461d44=events['length'];_0x478214<_0x461d44;_0x478214++){var _0x5ccf2d=events[_0x478214];var _0x4302b7=createListener('chatQueue:'+_0x5ccf2d,_0x22d66);ChatQueueEvents['on'](_0x5ccf2d,_0x4302b7);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 7ea68c8..7d44302 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 _0x55ca=['post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','addTeams'];(function(_0x5a6a3f,_0x313a88){var _0x3b6bc8=function(_0x16bd1a){while(--_0x16bd1a){_0x5a6a3f['push'](_0x5a6a3f['shift']());}};_0x3b6bc8(++_0x313a88);}(_0x55ca,0x126));var _0xa55c=function(_0x569560,_0x16b989){_0x569560=_0x569560-0x0;var _0x3c1de0=_0x55ca[_0x569560];return _0x3c1de0;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/describe',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['show']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getAgents']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/teams',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x13')]);router['put'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router[_0xa55c('0x15')](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x16')]);router[_0xa55c('0x15')](_0xa55c('0xe'),auth['isAuthenticated'](),controller[_0xa55c('0x17')]);router[_0xa55c('0x15')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x18')]);module[_0xa55c('0x19')]=router; \ No newline at end of file +var _0x7217=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x1b129f,_0x3d1089){var _0x26606a=function(_0x1b8277){while(--_0x1b8277){_0x1b129f['push'](_0x1b129f['shift']());}};_0x26606a(++_0x3d1089);}(_0x7217,0x19e));var _0x7721=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x7217[_0x521929];return _0x632436;};'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['getAgents']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['post'](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['addAgents']);router['put']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);router[_0x7721('0x17')](_0x7721('0xd'),auth['isAuthenticated'](),controller[_0x7721('0x18')]);router['delete'](_0x7721('0x11'),auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x17')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1a')]);module[_0x7721('0x1b')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 25148ee..e33f193 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 _0xc439=['STRING','DATE','moment','sequelize','exports'];(function(_0x23bbf4,_0x37c390){var _0x2f1b95=function(_0x16a7fe){while(--_0x16a7fe){_0x23bbf4['push'](_0x23bbf4['shift']());}};_0x2f1b95(++_0x37c390);}(_0xc439,0x174));var _0x9c43=function(_0x12d88a,_0x53e041){_0x12d88a=_0x12d88a-0x0;var _0x3a8562=_0xc439[_0x12d88a];return _0x3a8562;};'use strict';var moment=require(_0x9c43('0x0'));var Sequelize=require(_0x9c43('0x1'));module[_0x9c43('0x2')]={'uniqueid':{'type':Sequelize[_0x9c43('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9c43('0x3')]},'joinAt':{'type':Sequelize[_0x9c43('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x9c43('0x4')]},'reason':{'type':Sequelize[_0x9c43('0x3')]}}; \ No newline at end of file +var _0x0d7b=['STRING','DATE','moment','sequelize','exports'];(function(_0x2c6120,_0x1f3e60){var _0x5fb114=function(_0x45a72d){while(--_0x45a72d){_0x2c6120['push'](_0x2c6120['shift']());}};_0x5fb114(++_0x1f3e60);}(_0x0d7b,0x1ec));var _0xb0d7=function(_0x852060,_0x590cc8){_0x852060=_0x852060-0x0;var _0x2fb01a=_0x0d7b[_0x852060];return _0x2fb01a;};'use strict';var moment=require(_0xb0d7('0x0'));var Sequelize=require(_0xb0d7('0x1'));module[_0xb0d7('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb0d7('0x3')]},'joinAt':{'type':Sequelize[_0xb0d7('0x4')]},'leaveAt':{'type':Sequelize[_0xb0d7('0x4')]},'acceptAt':{'type':Sequelize[_0xb0d7('0x4')]},'exitAt':{'type':Sequelize[_0xb0d7('0x4')]},'reason':{'type':Sequelize[_0xb0d7('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 6e48aca..609c0b3 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 _0x804d=['apply','reject','destroy','end','error','send','index','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','name','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','filter','count','includeAll','include','findAll','then','rows','catch','show','intersection','options','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set'];(function(_0x1c8da6,_0xaabe8a){var _0x310260=function(_0x5deba3){while(--_0x5deba3){_0x1c8da6['push'](_0x1c8da6['shift']());}};_0x310260(++_0xaabe8a);}(_0x804d,0x116));var _0xd804=function(_0x1554e6,_0x28607d){_0x1554e6=_0x1554e6-0x0;var _0x4cafbf=_0x804d[_0x1554e6];return _0x4cafbf;};'use strict';var emlformat=require(_0xd804('0x0'));var rimraf=require(_0xd804('0x1'));var zipdir=require(_0xd804('0x2'));var jsonpatch=require(_0xd804('0x3'));var rp=require(_0xd804('0x4'));var moment=require(_0xd804('0x5'));var BPromise=require(_0xd804('0x6'));var Mustache=require(_0xd804('0x7'));var util=require('util');var path=require(_0xd804('0x8'));var sox=require(_0xd804('0x9'));var csv=require(_0xd804('0xa'));var ejs=require(_0xd804('0xb'));var fs=require('fs');var fs_extra=require(_0xd804('0xc'));var _=require(_0xd804('0xd'));var squel=require(_0xd804('0xe'));var crypto=require(_0xd804('0xf'));var jsforce=require(_0xd804('0x10'));var deskjs=require(_0xd804('0x11'));var toCsv=require(_0xd804('0xa'));var querystring=require(_0xd804('0x12'));var Papa=require('papaparse');var Redis=require(_0xd804('0x13'));var authService=require(_0xd804('0x14'));var qs=require(_0xd804('0x15'));var as=require(_0xd804('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd804('0x17'));var utils=require(_0xd804('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xd804('0x19'));var db=require(_0xd804('0x1a'))['db'];function respondWithStatusCode(_0x4fff76,_0x1d5594){_0x1d5594=_0x1d5594||0xcc;return function(_0x2dd4e5){if(_0x2dd4e5){return _0x4fff76[_0xd804('0x1b')](_0x1d5594);}return _0x4fff76['status'](_0x1d5594)['end']();};}function respondWithResult(_0x31b189,_0x3298f5){_0x3298f5=_0x3298f5||0xc8;return function(_0xcec83){if(_0xcec83){return _0x31b189[_0xd804('0x1c')](_0x3298f5)[_0xd804('0x1d')](_0xcec83);}};}function respondWithFilteredResult(_0x5ee270,_0x18c4a0){return function(_0x30be96){if(_0x30be96){var _0x597be3=typeof _0x18c4a0[_0xd804('0x1e')]===_0xd804('0x1f')&&typeof _0x18c4a0[_0xd804('0x20')]==='undefined';var _0x335203=_0x30be96['count'];var _0x421ddb=_0x597be3?0x0:_0x18c4a0[_0xd804('0x1e')];var _0x13fa46=_0x597be3?_0x30be96['count']:_0x18c4a0[_0xd804('0x1e')]+_0x18c4a0[_0xd804('0x20')];var _0x398f79;if(_0x13fa46>=_0x335203){_0x13fa46=_0x335203;_0x398f79=0xc8;}else{_0x398f79=0xce;}_0x5ee270[_0xd804('0x1c')](_0x398f79);return _0x5ee270[_0xd804('0x21')]('Content-Range',_0x421ddb+'-'+_0x13fa46+'/'+_0x335203)['json'](_0x30be96);}return null;};}function patchUpdates(_0x37021f){return function(_0x5425f0){try{jsonpatch[_0xd804('0x22')](_0x5425f0,_0x37021f,!![]);}catch(_0x103f52){return BPromise[_0xd804('0x23')](_0x103f52);}return _0x5425f0['save']();};}function saveUpdates(_0x29a3b4,_0x5dd939){return function(_0x18d28c){if(_0x18d28c){return _0x18d28c['update'](_0x29a3b4)['then'](function(_0x52c85c){return _0x52c85c;});}return null;};}function removeEntity(_0x51b191,_0x2cde57){return function(_0x2fc18b){if(_0x2fc18b){return _0x2fc18b[_0xd804('0x24')]()['then'](function(){_0x51b191[_0xd804('0x1c')](0xcc)[_0xd804('0x25')]();});}};}function handleEntityNotFound(_0x2a2502,_0x35bfef){return function(_0x5045a1){if(!_0x5045a1){_0x2a2502[_0xd804('0x1b')](0x194);}return _0x5045a1;};}function handleError(_0x11d2c4,_0x5da178){_0x5da178=_0x5da178||0x1f4;return function(_0x38a6f6){logger[_0xd804('0x26')](_0x38a6f6['stack']);if(_0x38a6f6['name']){delete _0x38a6f6['name'];}_0x11d2c4[_0xd804('0x1c')](_0x5da178)[_0xd804('0x27')](_0x38a6f6);};}exports[_0xd804('0x28')]=function(_0x570990,_0x225615){var _0x28a26f={},_0x1858f0={},_0x1f4234={'count':0x0,'rows':[]};var _0x473588=_[_0xd804('0x29')](db[_0xd804('0x2a')][_0xd804('0x2b')],function(_0x5b197a){return{'name':_0x5b197a[_0xd804('0x2c')],'type':_0x5b197a[_0xd804('0x2d')][_0xd804('0x2e')]};});_0x1858f0[_0xd804('0x2f')]=_[_0xd804('0x29')](_0x473588,_0xd804('0x30'));_0x1858f0[_0xd804('0x31')]=_[_0xd804('0x32')](_0x570990[_0xd804('0x31')]);_0x1858f0[_0xd804('0x33')]=_['intersection'](_0x1858f0['model'],_0x1858f0[_0xd804('0x31')]);_0x28a26f[_0xd804('0x34')]=_['intersection'](_0x1858f0['model'],qs[_0xd804('0x35')](_0x570990['query']['fields']));_0x28a26f[_0xd804('0x34')]=_0x28a26f[_0xd804('0x34')][_0xd804('0x36')]?_0x28a26f[_0xd804('0x34')]:_0x1858f0[_0xd804('0x2f')];if(!_0x570990[_0xd804('0x31')][_0xd804('0x37')](_0xd804('0x38'))){_0x28a26f['limit']=qs[_0xd804('0x20')](_0x570990['query'][_0xd804('0x20')]);_0x28a26f[_0xd804('0x1e')]=qs[_0xd804('0x1e')](_0x570990[_0xd804('0x31')][_0xd804('0x1e')]);}_0x28a26f['order']=qs['sort'](_0x570990['query'][_0xd804('0x39')]);_0x28a26f['where']=qs[_0xd804('0x33')](_[_0xd804('0x3a')](_0x570990[_0xd804('0x31')],_0x1858f0[_0xd804('0x33')]),_0x473588);if(_0x570990[_0xd804('0x31')]['filter']){_0x28a26f['where']=_[_0xd804('0x3b')](_0x28a26f[_0xd804('0x3c')],{'$or':_[_0xd804('0x29')](_0x473588,function(_0x46018c){if(_0x46018c['type']!=='VIRTUAL'){var _0x24c0a1={};_0x24c0a1[_0x46018c[_0xd804('0x30')]]={'$like':'%'+_0x570990[_0xd804('0x31')][_0xd804('0x3d')]+'%'};return _0x24c0a1;}})});}_0x28a26f=_['merge']({},_0x28a26f,_0x570990['options']);var _0x5628cf={'where':_0x28a26f[_0xd804('0x3c')]};return db[_0xd804('0x2a')][_0xd804('0x3e')](_0x5628cf)['then'](function(_0x293aee){_0x1f4234['count']=_0x293aee;if(_0x570990[_0xd804('0x31')][_0xd804('0x3f')]){_0x28a26f[_0xd804('0x40')]=[{'all':!![]}];}return db['ChatQueueReport'][_0xd804('0x41')](_0x28a26f);})[_0xd804('0x42')](function(_0xd13bf0){_0x1f4234[_0xd804('0x43')]=_0xd13bf0;return _0x1f4234;})['then'](respondWithFilteredResult(_0x225615,_0x28a26f))[_0xd804('0x44')](handleError(_0x225615,null));};exports[_0xd804('0x45')]=function(_0x14099b,_0xadfde0){var _0x45c011={'raw':!![],'where':{'id':_0x14099b['params']['id']}},_0x409278={};_0x409278['model']=_[_0xd804('0x32')](db['ChatQueueReport'][_0xd804('0x2b')]);_0x409278[_0xd804('0x31')]=_[_0xd804('0x32')](_0x14099b[_0xd804('0x31')]);_0x409278[_0xd804('0x33')]=_[_0xd804('0x46')](_0x409278[_0xd804('0x2f')],_0x409278[_0xd804('0x31')]);_0x45c011[_0xd804('0x34')]=_['intersection'](_0x409278['model'],qs[_0xd804('0x35')](_0x14099b[_0xd804('0x31')][_0xd804('0x35')]));_0x45c011[_0xd804('0x34')]=_0x45c011['attributes']['length']?_0x45c011[_0xd804('0x34')]:_0x409278['model'];if(_0x14099b[_0xd804('0x31')][_0xd804('0x3f')]){_0x45c011[_0xd804('0x40')]=[{'all':!![]}];}_0x45c011=_[_0xd804('0x3b')]({},_0x45c011,_0x14099b[_0xd804('0x47')]);return db[_0xd804('0x2a')][_0xd804('0x48')](_0x45c011)[_0xd804('0x42')](handleEntityNotFound(_0xadfde0,null))['then'](respondWithResult(_0xadfde0,null))[_0xd804('0x44')](handleError(_0xadfde0,null));};exports[_0xd804('0x49')]=function(_0x504f76,_0x12a15b){return db[_0xd804('0x2a')]['create'](_0x504f76[_0xd804('0x4a')],{})['then'](respondWithResult(_0x12a15b,0xc9))[_0xd804('0x44')](handleError(_0x12a15b,null));};exports[_0xd804('0x4b')]=function(_0x514eb2,_0x2f0146){if(_0x514eb2[_0xd804('0x4a')]['id']){delete _0x514eb2['body']['id'];}return db[_0xd804('0x2a')][_0xd804('0x48')]({'where':{'id':_0x514eb2[_0xd804('0x4c')]['id']}})[_0xd804('0x42')](handleEntityNotFound(_0x2f0146,null))[_0xd804('0x42')](saveUpdates(_0x514eb2[_0xd804('0x4a')],null))[_0xd804('0x42')](respondWithResult(_0x2f0146,null))[_0xd804('0x44')](handleError(_0x2f0146,null));};exports[_0xd804('0x24')]=function(_0x4d988d,_0x187cf2){return db['ChatQueueReport'][_0xd804('0x48')]({'where':{'id':_0x4d988d[_0xd804('0x4c')]['id']}})[_0xd804('0x42')](handleEntityNotFound(_0x187cf2,null))[_0xd804('0x42')](removeEntity(_0x187cf2,null))[_0xd804('0x44')](handleError(_0x187cf2,null));};exports[_0xd804('0x4d')]=function(_0x4399fc,_0x20bf43){return db[_0xd804('0x2a')]['describe']()[_0xd804('0x42')](respondWithResult(_0x20bf43,null))[_0xd804('0x44')](handleError(_0x20bf43,null));}; \ No newline at end of file +var _0x8411=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','map','ChatQueueReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','params','length','find','catch','body','describe','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x5b4c44,_0x2e495e){var _0x58485a=function(_0x13299b){while(--_0x13299b){_0x5b4c44['push'](_0x5b4c44['shift']());}};_0x58485a(++_0x2e495e);}(_0x8411,0x118));var _0x1841=function(_0x34e0db,_0x17cc56){_0x34e0db=_0x34e0db-0x0;var _0x2fc3af=_0x8411[_0x34e0db];return _0x2fc3af;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1841('0x0'));var jsonpatch=require(_0x1841('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1841('0x2'));var Mustache=require(_0x1841('0x3'));var util=require(_0x1841('0x4'));var path=require(_0x1841('0x5'));var sox=require(_0x1841('0x6'));var csv=require('to-csv');var ejs=require(_0x1841('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1841('0x8'));var squel=require(_0x1841('0x9'));var crypto=require(_0x1841('0xa'));var jsforce=require(_0x1841('0xb'));var deskjs=require(_0x1841('0xc'));var toCsv=require(_0x1841('0xd'));var querystring=require(_0x1841('0xe'));var Papa=require(_0x1841('0xf'));var Redis=require(_0x1841('0x10'));var authService=require(_0x1841('0x11'));var qs=require(_0x1841('0x12'));var as=require(_0x1841('0x13'));var hardwareService=require(_0x1841('0x14'));var logger=require(_0x1841('0x15'))(_0x1841('0x16'));var utils=require(_0x1841('0x17'));var config=require(_0x1841('0x18'));var licenseUtil=require(_0x1841('0x19'));var db=require(_0x1841('0x1a'))['db'];function respondWithStatusCode(_0x5d47ac,_0x36438a){_0x36438a=_0x36438a||0xcc;return function(_0x3bfd6f){if(_0x3bfd6f){return _0x5d47ac[_0x1841('0x1b')](_0x36438a);}return _0x5d47ac['status'](_0x36438a)['end']();};}function respondWithResult(_0x415393,_0x443172){_0x443172=_0x443172||0xc8;return function(_0x4c9df4){if(_0x4c9df4){return _0x415393[_0x1841('0x1c')](_0x443172)[_0x1841('0x1d')](_0x4c9df4);}};}function respondWithFilteredResult(_0x3e7e22,_0x287c5e){return function(_0x1e7426){if(_0x1e7426){var _0x224ff2=typeof _0x287c5e['offset']===_0x1841('0x1e')&&typeof _0x287c5e[_0x1841('0x1f')]===_0x1841('0x1e');var _0x34a235=_0x1e7426[_0x1841('0x20')];var _0x16917f=_0x224ff2?0x0:_0x287c5e[_0x1841('0x21')];var _0xeeb608=_0x224ff2?_0x1e7426[_0x1841('0x20')]:_0x287c5e[_0x1841('0x21')]+_0x287c5e[_0x1841('0x1f')];var _0xe44718;if(_0xeeb608>=_0x34a235){_0xeeb608=_0x34a235;_0xe44718=0xc8;}else{_0xe44718=0xce;}_0x3e7e22[_0x1841('0x1c')](_0xe44718);return _0x3e7e22[_0x1841('0x22')]('Content-Range',_0x16917f+'-'+_0xeeb608+'/'+_0x34a235)[_0x1841('0x1d')](_0x1e7426);}return null;};}function patchUpdates(_0x234fb4){return function(_0x31eb0b){try{jsonpatch[_0x1841('0x23')](_0x31eb0b,_0x234fb4,!![]);}catch(_0x5201b3){return BPromise[_0x1841('0x24')](_0x5201b3);}return _0x31eb0b[_0x1841('0x25')]();};}function saveUpdates(_0x4068f0,_0x1ed975){return function(_0x12e1d4){if(_0x12e1d4){return _0x12e1d4[_0x1841('0x26')](_0x4068f0)[_0x1841('0x27')](function(_0x3a546b){return _0x3a546b;});}return null;};}function removeEntity(_0x381c46,_0xb65ca6){return function(_0x168d29){if(_0x168d29){return _0x168d29[_0x1841('0x28')]()[_0x1841('0x27')](function(){_0x381c46['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x137170,_0x4ddeef){return function(_0x1e7491){if(!_0x1e7491){_0x137170[_0x1841('0x1b')](0x194);}return _0x1e7491;};}function handleError(_0xce0a33,_0x16646c){_0x16646c=_0x16646c||0x1f4;return function(_0x272e0e){logger[_0x1841('0x29')](_0x272e0e[_0x1841('0x2a')]);if(_0x272e0e[_0x1841('0x2b')]){delete _0x272e0e[_0x1841('0x2b')];}_0xce0a33[_0x1841('0x1c')](_0x16646c)['send'](_0x272e0e);};}exports['index']=function(_0x2e9f75,_0x2a65e7){var _0x4eddde={},_0x1f0985={},_0x302824={'count':0x0,'rows':[]};var _0x336e60=_[_0x1841('0x2c')](db[_0x1841('0x2d')][_0x1841('0x2e')],function(_0x5181f5){return{'name':_0x5181f5[_0x1841('0x2f')],'type':_0x5181f5[_0x1841('0x30')][_0x1841('0x31')]};});_0x1f0985[_0x1841('0x32')]=_[_0x1841('0x2c')](_0x336e60,_0x1841('0x2b'));_0x1f0985['query']=_[_0x1841('0x33')](_0x2e9f75[_0x1841('0x34')]);_0x1f0985['filters']=_[_0x1841('0x35')](_0x1f0985['model'],_0x1f0985['query']);_0x4eddde[_0x1841('0x36')]=_[_0x1841('0x35')](_0x1f0985[_0x1841('0x32')],qs[_0x1841('0x37')](_0x2e9f75['query'][_0x1841('0x37')]));_0x4eddde[_0x1841('0x36')]=_0x4eddde[_0x1841('0x36')]['length']?_0x4eddde[_0x1841('0x36')]:_0x1f0985[_0x1841('0x32')];if(!_0x2e9f75[_0x1841('0x34')][_0x1841('0x38')](_0x1841('0x39'))){_0x4eddde[_0x1841('0x1f')]=qs['limit'](_0x2e9f75[_0x1841('0x34')][_0x1841('0x1f')]);_0x4eddde['offset']=qs[_0x1841('0x21')](_0x2e9f75['query'][_0x1841('0x21')]);}_0x4eddde[_0x1841('0x3a')]=qs['sort'](_0x2e9f75[_0x1841('0x34')][_0x1841('0x3b')]);_0x4eddde[_0x1841('0x3c')]=qs[_0x1841('0x3d')](_[_0x1841('0x3e')](_0x2e9f75['query'],_0x1f0985[_0x1841('0x3d')]),_0x336e60);if(_0x2e9f75[_0x1841('0x34')][_0x1841('0x3f')]){_0x4eddde[_0x1841('0x3c')]=_[_0x1841('0x40')](_0x4eddde['where'],{'$or':_[_0x1841('0x2c')](_0x336e60,function(_0x548003){if(_0x548003[_0x1841('0x30')]!==_0x1841('0x41')){var _0x4ff7d6={};_0x4ff7d6[_0x548003['name']]={'$like':'%'+_0x2e9f75[_0x1841('0x34')][_0x1841('0x3f')]+'%'};return _0x4ff7d6;}})});}_0x4eddde=_[_0x1841('0x40')]({},_0x4eddde,_0x2e9f75[_0x1841('0x42')]);var _0x19d1a8={'where':_0x4eddde[_0x1841('0x3c')]};return db[_0x1841('0x2d')][_0x1841('0x20')](_0x19d1a8)[_0x1841('0x27')](function(_0x49ef2c){_0x302824[_0x1841('0x20')]=_0x49ef2c;if(_0x2e9f75['query'][_0x1841('0x43')]){_0x4eddde[_0x1841('0x44')]=[{'all':!![]}];}return db[_0x1841('0x2d')][_0x1841('0x45')](_0x4eddde);})[_0x1841('0x27')](function(_0x31be49){_0x302824['rows']=_0x31be49;return _0x302824;})[_0x1841('0x27')](respondWithFilteredResult(_0x2a65e7,_0x4eddde))['catch'](handleError(_0x2a65e7,null));};exports['show']=function(_0x4ea565,_0x5bdd80){var _0x59efe8={'raw':!![],'where':{'id':_0x4ea565[_0x1841('0x46')]['id']}},_0x347d8a={};_0x347d8a['model']=_[_0x1841('0x33')](db['ChatQueueReport'][_0x1841('0x2e')]);_0x347d8a[_0x1841('0x34')]=_[_0x1841('0x33')](_0x4ea565[_0x1841('0x34')]);_0x347d8a[_0x1841('0x3d')]=_[_0x1841('0x35')](_0x347d8a['model'],_0x347d8a[_0x1841('0x34')]);_0x59efe8[_0x1841('0x36')]=_[_0x1841('0x35')](_0x347d8a[_0x1841('0x32')],qs['fields'](_0x4ea565[_0x1841('0x34')][_0x1841('0x37')]));_0x59efe8['attributes']=_0x59efe8[_0x1841('0x36')][_0x1841('0x47')]?_0x59efe8[_0x1841('0x36')]:_0x347d8a[_0x1841('0x32')];if(_0x4ea565[_0x1841('0x34')]['includeAll']){_0x59efe8[_0x1841('0x44')]=[{'all':!![]}];}_0x59efe8=_['merge']({},_0x59efe8,_0x4ea565[_0x1841('0x42')]);return db[_0x1841('0x2d')][_0x1841('0x48')](_0x59efe8)[_0x1841('0x27')](handleEntityNotFound(_0x5bdd80,null))['then'](respondWithResult(_0x5bdd80,null))[_0x1841('0x49')](handleError(_0x5bdd80,null));};exports['create']=function(_0x1c8db7,_0x4ad200){return db[_0x1841('0x2d')]['create'](_0x1c8db7[_0x1841('0x4a')],{})['then'](respondWithResult(_0x4ad200,0xc9))[_0x1841('0x49')](handleError(_0x4ad200,null));};exports[_0x1841('0x26')]=function(_0x3a450e,_0xfd65cf){if(_0x3a450e[_0x1841('0x4a')]['id']){delete _0x3a450e[_0x1841('0x4a')]['id'];}return db[_0x1841('0x2d')][_0x1841('0x48')]({'where':{'id':_0x3a450e[_0x1841('0x46')]['id']}})[_0x1841('0x27')](handleEntityNotFound(_0xfd65cf,null))[_0x1841('0x27')](saveUpdates(_0x3a450e[_0x1841('0x4a')],null))[_0x1841('0x27')](respondWithResult(_0xfd65cf,null))[_0x1841('0x49')](handleError(_0xfd65cf,null));};exports[_0x1841('0x28')]=function(_0x4a196a,_0x29130d){return db['ChatQueueReport'][_0x1841('0x48')]({'where':{'id':_0x4a196a[_0x1841('0x46')]['id']}})[_0x1841('0x27')](handleEntityNotFound(_0x29130d,null))['then'](removeEntity(_0x29130d,null))[_0x1841('0x49')](handleError(_0x29130d,null));};exports[_0x1841('0x4b')]=function(_0x5d19b7,_0x4ac281){return db[_0x1841('0x2d')][_0x1841('0x4b')]()[_0x1841('0x27')](respondWithResult(_0x4ac281,null))[_0x1841('0x49')](handleError(_0x4ac281,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 8838ee3..7af8912 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 _0xcb91=['path','rimraf','./chatQueueReport.attributes','exports','define','report_chat_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x5d09de,_0x352295){var _0x1f3575=function(_0x58384a){while(--_0x58384a){_0x5d09de['push'](_0x5d09de['shift']());}};_0x1f3575(++_0x352295);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x19efbc,_0x10b7d7){_0x19efbc=_0x19efbc-0x0;var _0x205c5e=_0xcb91[_0x19efbc];return _0x205c5e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('ChatQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbaf0=['define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','exports'];(function(_0x53684a,_0x144551){var _0x9dabbb=function(_0x3d89fc){while(--_0x3d89fc){_0x53684a['push'](_0x53684a['shift']());}};_0x9dabbb(++_0x144551);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xbaf0[_0x2f5ac5];return _0x37c9a8;};'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'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0baf('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index ea3bd54..8f4bcbc 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 _0x52b0=['ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatQueueReport,\x20%s,\x20%s','message','info','result','CreateChatQueueReport','ChatQueueReport','body','options','raw','then','debug','catch','update','UpdateChatQueueReport','lodash','util','moment','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','request\x20sent'];(function(_0xac6666,_0x1fdd85){var _0x9e59f3=function(_0x59473f){while(--_0x59473f){_0xac6666['push'](_0xac6666['shift']());}};_0x9e59f3(++_0x1fdd85);}(_0x52b0,0x17e));var _0x052b=function(_0x359d1b,_0x4dbc97){_0x359d1b=_0x359d1b-0x0;var _0x39fc0c=_0x52b0[_0x359d1b];return _0x39fc0c;};'use strict';var _=require(_0x052b('0x0'));var util=require(_0x052b('0x1'));var moment=require(_0x052b('0x2'));var BPromise=require('bluebird');var rs=require(_0x052b('0x3'));var fs=require('fs');var Redis=require(_0x052b('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x052b('0x5'));var config=require(_0x052b('0x6'));var jayson=require(_0x052b('0x7'));var client=jayson[_0x052b('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x37f762,_0x1bd332,_0x13f952){return new BPromise(function(_0x313177,_0x15c5e6){return client['request'](_0x37f762,_0x13f952)['then'](function(_0x3cf3e5){logger['info']('ChatQueueReport,\x20%s,\x20%s',_0x1bd332,_0x052b('0x9'));logger['debug'](_0x052b('0xa'),_0x1bd332,'request\x20sent',JSON[_0x052b('0xb')](_0x3cf3e5));if(_0x3cf3e5[_0x052b('0xc')]){if(_0x3cf3e5['error'][_0x052b('0xd')]===0x1f4){logger[_0x052b('0xc')](_0x052b('0xe'),_0x1bd332,_0x3cf3e5[_0x052b('0xc')][_0x052b('0xf')]);return _0x15c5e6(_0x3cf3e5[_0x052b('0xc')][_0x052b('0xf')]);}logger[_0x052b('0xc')](_0x052b('0xe'),_0x1bd332,_0x3cf3e5[_0x052b('0xc')][_0x052b('0xf')]);return _0x313177(_0x3cf3e5['error'][_0x052b('0xf')]);}else{logger[_0x052b('0x10')](_0x052b('0xe'),_0x1bd332,_0x052b('0x9'));_0x313177(_0x3cf3e5[_0x052b('0x11')]['message']);}})['catch'](function(_0x14b572){logger['error'](_0x052b('0xe'),_0x1bd332,_0x14b572);_0x15c5e6(_0x14b572);});});}exports[_0x052b('0x12')]=function(_0x2a0691){var _0x190375=this;return new Promise(function(_0x60841e,_0x5bf03b){return db[_0x052b('0x13')]['create'](_0x2a0691[_0x052b('0x14')],{'raw':_0x2a0691[_0x052b('0x15')]?_0x2a0691[_0x052b('0x15')][_0x052b('0x16')]===undefined?!![]:![]:!![]})[_0x052b('0x17')](function(_0x54b247){logger[_0x052b('0x10')](_0x052b('0x12'),_0x2a0691);logger[_0x052b('0x18')](_0x052b('0x12'),_0x2a0691,JSON['stringify'](_0x54b247));_0x60841e(_0x54b247);})[_0x052b('0x19')](function(_0x2cb914){logger[_0x052b('0xc')](_0x052b('0x12'),_0x2cb914['message'],_0x2a0691);_0x5bf03b(_0x190375[_0x052b('0xc')](0x1f4,_0x2cb914[_0x052b('0xf')]));});});};exports['UpdateChatQueueReport']=function(_0x30f727){var _0x4d6f7f=this;return new Promise(function(_0x4bba82,_0x554005){return db[_0x052b('0x13')][_0x052b('0x1a')](_0x30f727['body'],{'raw':_0x30f727[_0x052b('0x15')]?_0x30f727[_0x052b('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x30f727[_0x052b('0x15')]?_0x30f727['options']['where']||null:null,'attributes':_0x30f727['options']?_0x30f727['options']['attributes']||null:null,'limit':_0x30f727['options']?_0x30f727[_0x052b('0x15')]['limit']||null:null})[_0x052b('0x17')](function(_0x9e6203){logger['info']('UpdateChatQueueReport',_0x30f727);logger[_0x052b('0x18')](_0x052b('0x1b'),_0x30f727,JSON[_0x052b('0xb')](_0x9e6203));_0x4bba82(_0x9e6203);})['catch'](function(_0x5e7594){logger['error'](_0x052b('0x1b'),_0x5e7594[_0x052b('0xf')],_0x30f727);_0x554005(_0x4d6f7f['error'](0x1f4,_0x5e7594[_0x052b('0xf')]));});});}; \ No newline at end of file +var _0xf2c2=['lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','update','where','attributes','limit'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xf2c2,0x132));var _0x2f2c=function(_0x150b05,_0x4b83a2){_0x150b05=_0x150b05-0x0;var _0x10570d=_0xf2c2[_0x150b05];return _0x10570d;};'use strict';var _=require(_0x2f2c('0x0'));var util=require(_0x2f2c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2f2c('0x2'));var fs=require('fs');var Redis=require(_0x2f2c('0x3'));var db=require(_0x2f2c('0x4'))['db'];var utils=require(_0x2f2c('0x5'));var logger=require(_0x2f2c('0x6'))(_0x2f2c('0x7'));var config=require('../../config/environment');var jayson=require(_0x2f2c('0x8'));var client=jayson[_0x2f2c('0x9')][_0x2f2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x485bfd,_0x1d2092,_0x5134e8){return new BPromise(function(_0x47c357,_0x19c5ce){return client[_0x2f2c('0xb')](_0x485bfd,_0x5134e8)[_0x2f2c('0xc')](function(_0x519cfe){logger[_0x2f2c('0xd')](_0x2f2c('0xe'),_0x1d2092,_0x2f2c('0xf'));logger[_0x2f2c('0x10')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x1d2092,'request\x20sent',JSON[_0x2f2c('0x11')](_0x519cfe));if(_0x519cfe[_0x2f2c('0x12')]){if(_0x519cfe[_0x2f2c('0x12')][_0x2f2c('0x13')]===0x1f4){logger[_0x2f2c('0x12')](_0x2f2c('0xe'),_0x1d2092,_0x519cfe['error']['message']);return _0x19c5ce(_0x519cfe[_0x2f2c('0x12')][_0x2f2c('0x14')]);}logger[_0x2f2c('0x12')](_0x2f2c('0xe'),_0x1d2092,_0x519cfe[_0x2f2c('0x12')][_0x2f2c('0x14')]);return _0x47c357(_0x519cfe[_0x2f2c('0x12')][_0x2f2c('0x14')]);}else{logger[_0x2f2c('0xd')]('ChatQueueReport,\x20%s,\x20%s',_0x1d2092,_0x2f2c('0xf'));_0x47c357(_0x519cfe[_0x2f2c('0x15')][_0x2f2c('0x14')]);}})[_0x2f2c('0x16')](function(_0x3f36c6){logger[_0x2f2c('0x12')](_0x2f2c('0xe'),_0x1d2092,_0x3f36c6);_0x19c5ce(_0x3f36c6);});});}exports[_0x2f2c('0x17')]=function(_0x4e1350){var _0x52c187=this;return new Promise(function(_0x235cbf,_0x930f8e){return db[_0x2f2c('0x18')][_0x2f2c('0x19')](_0x4e1350[_0x2f2c('0x1a')],{'raw':_0x4e1350[_0x2f2c('0x1b')]?_0x4e1350['options'][_0x2f2c('0x1c')]===undefined?!![]:![]:!![]})[_0x2f2c('0xc')](function(_0x65da07){logger[_0x2f2c('0xd')]('CreateChatQueueReport',_0x4e1350);logger[_0x2f2c('0x10')]('CreateChatQueueReport',_0x4e1350,JSON[_0x2f2c('0x11')](_0x65da07));_0x235cbf(_0x65da07);})[_0x2f2c('0x16')](function(_0x30c6c4){logger['error']('CreateChatQueueReport',_0x30c6c4[_0x2f2c('0x14')],_0x4e1350);_0x930f8e(_0x52c187[_0x2f2c('0x12')](0x1f4,_0x30c6c4[_0x2f2c('0x14')]));});});};exports[_0x2f2c('0x1d')]=function(_0x39730a){var _0x74d3ef=this;return new Promise(function(_0x584d48,_0x41ad3d){return db[_0x2f2c('0x18')][_0x2f2c('0x1e')](_0x39730a['body'],{'raw':_0x39730a[_0x2f2c('0x1b')]?_0x39730a[_0x2f2c('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x39730a[_0x2f2c('0x1b')]?_0x39730a[_0x2f2c('0x1b')][_0x2f2c('0x1f')]||null:null,'attributes':_0x39730a[_0x2f2c('0x1b')]?_0x39730a[_0x2f2c('0x1b')][_0x2f2c('0x20')]||null:null,'limit':_0x39730a['options']?_0x39730a[_0x2f2c('0x1b')][_0x2f2c('0x21')]||null:null})[_0x2f2c('0xc')](function(_0x38e921){logger[_0x2f2c('0xd')](_0x2f2c('0x1d'),_0x39730a);logger[_0x2f2c('0x10')](_0x2f2c('0x1d'),_0x39730a,JSON[_0x2f2c('0x11')](_0x38e921));_0x584d48(_0x38e921);})[_0x2f2c('0x16')](function(_0x38bc1e){logger[_0x2f2c('0x12')](_0x2f2c('0x1d'),_0x38bc1e[_0x2f2c('0x14')],_0x39730a);_0x41ad3d(_0x74d3ef[_0x2f2c('0x12')](0x1f4,_0x38bc1e['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index c92997a..72ea189 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 _0x2da3=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','delete','destroy','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2da3,0x1b3));var _0x32da=function(_0x2ee53b,_0x10e949){_0x2ee53b=_0x2ee53b-0x0;var _0x34bd72=_0x2da3[_0x2ee53b];return _0x34bd72;};'use strict';var multer=require(_0x32da('0x0'));var util=require(_0x32da('0x1'));var path=require(_0x32da('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x32da('0x3')]();var fs_extra=require(_0x32da('0x4'));var auth=require(_0x32da('0x5'));var interaction=require(_0x32da('0x6'));var config=require(_0x32da('0x7'));var controller=require(_0x32da('0x8'));router[_0x32da('0x9')]('/',auth[_0x32da('0xa')](),controller['index']);router[_0x32da('0x9')](_0x32da('0xb'),auth[_0x32da('0xa')](),controller[_0x32da('0xc')]);router[_0x32da('0x9')](_0x32da('0xd'),auth[_0x32da('0xa')](),controller[_0x32da('0xe')]);router[_0x32da('0xf')]('/',auth['isAuthenticated'](),controller[_0x32da('0x10')]);router['put']('/:id',auth[_0x32da('0xa')](),controller['update']);router[_0x32da('0x11')](_0x32da('0xd'),auth[_0x32da('0xa')](),controller[_0x32da('0x12')]);module['exports']=router; \ No newline at end of file +var _0xdaba=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete','exports','multer','path'];(function(_0x40889c,_0x73e154){var _0x1e69a3=function(_0x365601){while(--_0x365601){_0x40889c['push'](_0x40889c['shift']());}};_0x1e69a3(++_0x73e154);}(_0xdaba,0xbb));var _0xadab=function(_0x283b0a,_0x2330fc){_0x283b0a=_0x283b0a-0x0;var _0x18bba9=_0xdaba[_0x283b0a];return _0x18bba9;};'use strict';var multer=require(_0xadab('0x0'));var util=require('util');var path=require(_0xadab('0x1'));var timeout=require(_0xadab('0x2'));var express=require('express');var router=express[_0xadab('0x3')]();var fs_extra=require(_0xadab('0x4'));var auth=require(_0xadab('0x5'));var interaction=require(_0xadab('0x6'));var config=require(_0xadab('0x7'));var controller=require(_0xadab('0x8'));router[_0xadab('0x9')]('/',auth[_0xadab('0xa')](),controller[_0xadab('0xb')]);router[_0xadab('0x9')](_0xadab('0xc'),auth['isAuthenticated'](),controller[_0xadab('0xd')]);router[_0xadab('0x9')]('/:id',auth[_0xadab('0xa')](),controller['show']);router[_0xadab('0xe')]('/',auth[_0xadab('0xa')](),controller[_0xadab('0xf')]);router[_0xadab('0x10')](_0xadab('0x11'),auth[_0xadab('0xa')](),controller[_0xadab('0x12')]);router[_0xadab('0x13')](_0xadab('0x11'),auth[_0xadab('0xa')](),controller['destroy']);module[_0xadab('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 53be4e7..c0f1eb8 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x41facc,_0x1d2cc4){var _0xe521cd=function(_0x59c537){while(--_0x59c537){_0x41facc['push'](_0x41facc['shift']());}};_0xe521cd(++_0x1d2cc4);}(_0x00bb,0x1d8));var _0xb00b=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x00bb[_0x134c2e];return _0x2825db;};'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 +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5a60d8,_0x389c36){var _0x41e628=function(_0x25f9dd){while(--_0x25f9dd){_0x5a60d8['push'](_0x5a60d8['shift']());}};_0x41e628(++_0x389c36);}(_0xaa88,0x137));var _0x8aa8=function(_0x4d67b8,_0x565134){_0x4d67b8=_0x4d67b8-0x0;var _0x55af3b=_0xaa88[_0x4d67b8];return _0x55af3b;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 349e823..0dab05e 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 _0xa644=['includeAll','include','findAll','rows','catch','show','params','fields','create','body','update','find','describe','eml-format','rimraf','fast-json-patch','moment','mustache','sox','to-csv','ejs','squel','crypto','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','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','end','error','stack','name','index','ChatTransferReport','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x3ab014,_0x1f4fe7){var _0x3cf093=function(_0x3a91c7){while(--_0x3a91c7){_0x3ab014['push'](_0x3ab014['shift']());}};_0x3cf093(++_0x1f4fe7);}(_0xa644,0x1c3));var _0x4a64=function(_0x2de418,_0x1c508c){_0x2de418=_0x2de418-0x0;var _0x30d7e8=_0xa644[_0x2de418];return _0x30d7e8;};'use strict';var emlformat=require(_0x4a64('0x0'));var rimraf=require(_0x4a64('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4a64('0x2'));var rp=require('request-promise');var moment=require(_0x4a64('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4a64('0x4'));var util=require('util');var path=require('path');var sox=require(_0x4a64('0x5'));var csv=require(_0x4a64('0x6'));var ejs=require(_0x4a64('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4a64('0x8'));var crypto=require(_0x4a64('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x4a64('0xa'));var toCsv=require('to-csv');var querystring=require(_0x4a64('0xb'));var Papa=require(_0x4a64('0xc'));var Redis=require(_0x4a64('0xd'));var authService=require(_0x4a64('0xe'));var qs=require(_0x4a64('0xf'));var as=require(_0x4a64('0x10'));var hardwareService=require(_0x4a64('0x11'));var logger=require(_0x4a64('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x4a64('0x13'));var licenseUtil=require(_0x4a64('0x14'));var db=require(_0x4a64('0x15'))['db'];function respondWithStatusCode(_0x3bdf4c,_0xefb8d3){_0xefb8d3=_0xefb8d3||0xcc;return function(_0x12ed3d){if(_0x12ed3d){return _0x3bdf4c[_0x4a64('0x16')](_0xefb8d3);}return _0x3bdf4c[_0x4a64('0x17')](_0xefb8d3)['end']();};}function respondWithResult(_0x4bc892,_0x151e55){_0x151e55=_0x151e55||0xc8;return function(_0x250659){if(_0x250659){return _0x4bc892[_0x4a64('0x17')](_0x151e55)[_0x4a64('0x18')](_0x250659);}};}function respondWithFilteredResult(_0x38a498,_0x53a574){return function(_0x934d3b){if(_0x934d3b){var _0x3a8f62=typeof _0x53a574[_0x4a64('0x19')]===_0x4a64('0x1a')&&typeof _0x53a574[_0x4a64('0x1b')]===_0x4a64('0x1a');var _0x177645=_0x934d3b[_0x4a64('0x1c')];var _0x4d65b4=_0x3a8f62?0x0:_0x53a574[_0x4a64('0x19')];var _0x5c4fce=_0x3a8f62?_0x934d3b[_0x4a64('0x1c')]:_0x53a574[_0x4a64('0x19')]+_0x53a574['limit'];var _0x54e351;if(_0x5c4fce>=_0x177645){_0x5c4fce=_0x177645;_0x54e351=0xc8;}else{_0x54e351=0xce;}_0x38a498['status'](_0x54e351);return _0x38a498[_0x4a64('0x1d')](_0x4a64('0x1e'),_0x4d65b4+'-'+_0x5c4fce+'/'+_0x177645)[_0x4a64('0x18')](_0x934d3b);}return null;};}function patchUpdates(_0x1136bf){return function(_0x3fea0c){try{jsonpatch[_0x4a64('0x1f')](_0x3fea0c,_0x1136bf,!![]);}catch(_0x485920){return BPromise['reject'](_0x485920);}return _0x3fea0c[_0x4a64('0x20')]();};}function saveUpdates(_0x140b81,_0x3452f2){return function(_0x2415d9){if(_0x2415d9){return _0x2415d9['update'](_0x140b81)[_0x4a64('0x21')](function(_0x4e883f){return _0x4e883f;});}return null;};}function removeEntity(_0x5f439d,_0x2cbcfa){return function(_0x17423d){if(_0x17423d){return _0x17423d[_0x4a64('0x22')]()[_0x4a64('0x21')](function(){_0x5f439d[_0x4a64('0x17')](0xcc)[_0x4a64('0x23')]();});}};}function handleEntityNotFound(_0x4e77dc,_0x54924b){return function(_0xc09344){if(!_0xc09344){_0x4e77dc['sendStatus'](0x194);}return _0xc09344;};}function handleError(_0x4e4649,_0x2b7411){_0x2b7411=_0x2b7411||0x1f4;return function(_0x269755){logger[_0x4a64('0x24')](_0x269755[_0x4a64('0x25')]);if(_0x269755[_0x4a64('0x26')]){delete _0x269755['name'];}_0x4e4649[_0x4a64('0x17')](_0x2b7411)['send'](_0x269755);};}exports[_0x4a64('0x27')]=function(_0x2f4b22,_0x3229d9){var _0x42be7a={},_0x527159={},_0x4536fb={'count':0x0,'rows':[]};var _0x8ebb9b=_['map'](db[_0x4a64('0x28')][_0x4a64('0x29')],function(_0x44fcbe){return{'name':_0x44fcbe[_0x4a64('0x2a')],'type':_0x44fcbe[_0x4a64('0x2b')]['key']};});_0x527159[_0x4a64('0x2c')]=_['map'](_0x8ebb9b,_0x4a64('0x26'));_0x527159[_0x4a64('0x2d')]=_[_0x4a64('0x2e')](_0x2f4b22['query']);_0x527159[_0x4a64('0x2f')]=_['intersection'](_0x527159['model'],_0x527159[_0x4a64('0x2d')]);_0x42be7a[_0x4a64('0x30')]=_[_0x4a64('0x31')](_0x527159[_0x4a64('0x2c')],qs['fields'](_0x2f4b22[_0x4a64('0x2d')]['fields']));_0x42be7a[_0x4a64('0x30')]=_0x42be7a[_0x4a64('0x30')][_0x4a64('0x32')]?_0x42be7a['attributes']:_0x527159[_0x4a64('0x2c')];if(!_0x2f4b22['query'][_0x4a64('0x33')]('nolimit')){_0x42be7a[_0x4a64('0x1b')]=qs[_0x4a64('0x1b')](_0x2f4b22[_0x4a64('0x2d')][_0x4a64('0x1b')]);_0x42be7a['offset']=qs['offset'](_0x2f4b22[_0x4a64('0x2d')]['offset']);}_0x42be7a[_0x4a64('0x34')]=qs[_0x4a64('0x35')](_0x2f4b22[_0x4a64('0x2d')]['sort']);_0x42be7a[_0x4a64('0x36')]=qs[_0x4a64('0x2f')](_[_0x4a64('0x37')](_0x2f4b22[_0x4a64('0x2d')],_0x527159[_0x4a64('0x2f')]),_0x8ebb9b);if(_0x2f4b22[_0x4a64('0x2d')][_0x4a64('0x38')]){_0x42be7a[_0x4a64('0x36')]=_[_0x4a64('0x39')](_0x42be7a[_0x4a64('0x36')],{'$or':_['map'](_0x8ebb9b,function(_0x11ef60){if(_0x11ef60['type']!==_0x4a64('0x3a')){var _0x189347={};_0x189347[_0x11ef60[_0x4a64('0x26')]]={'$like':'%'+_0x2f4b22[_0x4a64('0x2d')][_0x4a64('0x38')]+'%'};return _0x189347;}})});}_0x42be7a=_['merge']({},_0x42be7a,_0x2f4b22[_0x4a64('0x3b')]);var _0x2c29ea={'where':_0x42be7a[_0x4a64('0x36')]};return db['ChatTransferReport'][_0x4a64('0x1c')](_0x2c29ea)['then'](function(_0x288352){_0x4536fb[_0x4a64('0x1c')]=_0x288352;if(_0x2f4b22[_0x4a64('0x2d')][_0x4a64('0x3c')]){_0x42be7a[_0x4a64('0x3d')]=[{'all':!![]}];}return db[_0x4a64('0x28')][_0x4a64('0x3e')](_0x42be7a);})[_0x4a64('0x21')](function(_0x2e81e2){_0x4536fb[_0x4a64('0x3f')]=_0x2e81e2;return _0x4536fb;})[_0x4a64('0x21')](respondWithFilteredResult(_0x3229d9,_0x42be7a))[_0x4a64('0x40')](handleError(_0x3229d9,null));};exports[_0x4a64('0x41')]=function(_0x3bedae,_0x12acd3){var _0x5a9279={'raw':!![],'where':{'id':_0x3bedae[_0x4a64('0x42')]['id']}},_0x3d4569={};_0x3d4569[_0x4a64('0x2c')]=_[_0x4a64('0x2e')](db['ChatTransferReport'][_0x4a64('0x29')]);_0x3d4569[_0x4a64('0x2d')]=_[_0x4a64('0x2e')](_0x3bedae[_0x4a64('0x2d')]);_0x3d4569[_0x4a64('0x2f')]=_[_0x4a64('0x31')](_0x3d4569[_0x4a64('0x2c')],_0x3d4569['query']);_0x5a9279[_0x4a64('0x30')]=_[_0x4a64('0x31')](_0x3d4569['model'],qs['fields'](_0x3bedae['query'][_0x4a64('0x43')]));_0x5a9279['attributes']=_0x5a9279[_0x4a64('0x30')]['length']?_0x5a9279[_0x4a64('0x30')]:_0x3d4569['model'];if(_0x3bedae[_0x4a64('0x2d')][_0x4a64('0x3c')]){_0x5a9279[_0x4a64('0x3d')]=[{'all':!![]}];}_0x5a9279=_['merge']({},_0x5a9279,_0x3bedae['options']);return db[_0x4a64('0x28')]['find'](_0x5a9279)['then'](handleEntityNotFound(_0x12acd3,null))['then'](respondWithResult(_0x12acd3,null))[_0x4a64('0x40')](handleError(_0x12acd3,null));};exports[_0x4a64('0x44')]=function(_0x4f89d7,_0x396f07){return db[_0x4a64('0x28')][_0x4a64('0x44')](_0x4f89d7[_0x4a64('0x45')],{})[_0x4a64('0x21')](respondWithResult(_0x396f07,0xc9))['catch'](handleError(_0x396f07,null));};exports[_0x4a64('0x46')]=function(_0x534544,_0x4ac692){if(_0x534544[_0x4a64('0x45')]['id']){delete _0x534544[_0x4a64('0x45')]['id'];}return db[_0x4a64('0x28')][_0x4a64('0x47')]({'where':{'id':_0x534544[_0x4a64('0x42')]['id']}})[_0x4a64('0x21')](handleEntityNotFound(_0x4ac692,null))['then'](saveUpdates(_0x534544[_0x4a64('0x45')],null))[_0x4a64('0x21')](respondWithResult(_0x4ac692,null))[_0x4a64('0x40')](handleError(_0x4ac692,null));};exports['destroy']=function(_0x34e3f4,_0x56b6ba){return db[_0x4a64('0x28')][_0x4a64('0x47')]({'where':{'id':_0x34e3f4[_0x4a64('0x42')]['id']}})[_0x4a64('0x21')](handleEntityNotFound(_0x56b6ba,null))['then'](removeEntity(_0x56b6ba,null))[_0x4a64('0x40')](handleError(_0x56b6ba,null));};exports[_0x4a64('0x48')]=function(_0x11fc0c,_0x56fda7){return db[_0x4a64('0x28')][_0x4a64('0x48')]()['then'](respondWithResult(_0x56fda7,null))[_0x4a64('0x40')](handleError(_0x56fda7,null));}; \ No newline at end of file +var _0x44f6=['rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','limit','undefined','count','set','apply','reject','save','update','then','sendStatus','error','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','model','map','query','keys','filters','fields','attributes','hasOwnProperty','offset','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','intersection','length','find','create','body','destroy','describe','eml-format'];(function(_0x421924,_0x15d560){var _0x10b657=function(_0x355529){while(--_0x355529){_0x421924['push'](_0x421924['shift']());}};_0x10b657(++_0x15d560);}(_0x44f6,0x171));var _0x644f=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x44f6[_0x4b73a2];return _0x383c66;};'use strict';var emlformat=require(_0x644f('0x0'));var rimraf=require(_0x644f('0x1'));var zipdir=require(_0x644f('0x2'));var jsonpatch=require(_0x644f('0x3'));var rp=require(_0x644f('0x4'));var moment=require(_0x644f('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x644f('0x6'));var util=require(_0x644f('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x644f('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x644f('0x9'));var _=require(_0x644f('0xa'));var squel=require(_0x644f('0xb'));var crypto=require('crypto');var jsforce=require(_0x644f('0xc'));var deskjs=require(_0x644f('0xd'));var toCsv=require(_0x644f('0x8'));var querystring=require(_0x644f('0xe'));var Papa=require('papaparse');var Redis=require(_0x644f('0xf'));var authService=require(_0x644f('0x10'));var qs=require(_0x644f('0x11'));var as=require(_0x644f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x644f('0x13'))(_0x644f('0x14'));var utils=require(_0x644f('0x15'));var config=require(_0x644f('0x16'));var licenseUtil=require(_0x644f('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xf97c15,_0x57702c){_0x57702c=_0x57702c||0xcc;return function(_0x1eaf01){if(_0x1eaf01){return _0xf97c15['sendStatus'](_0x57702c);}return _0xf97c15[_0x644f('0x18')](_0x57702c)[_0x644f('0x19')]();};}function respondWithResult(_0x1e52a,_0x592f83){_0x592f83=_0x592f83||0xc8;return function(_0x300124){if(_0x300124){return _0x1e52a['status'](_0x592f83)[_0x644f('0x1a')](_0x300124);}};}function respondWithFilteredResult(_0xe8155c,_0x38c640){return function(_0x4333f4){if(_0x4333f4){var _0x889153=typeof _0x38c640['offset']==='undefined'&&typeof _0x38c640[_0x644f('0x1b')]===_0x644f('0x1c');var _0x1fe32e=_0x4333f4[_0x644f('0x1d')];var _0x59d9b0=_0x889153?0x0:_0x38c640['offset'];var _0x5540a5=_0x889153?_0x4333f4[_0x644f('0x1d')]:_0x38c640['offset']+_0x38c640[_0x644f('0x1b')];var _0x58c2a7;if(_0x5540a5>=_0x1fe32e){_0x5540a5=_0x1fe32e;_0x58c2a7=0xc8;}else{_0x58c2a7=0xce;}_0xe8155c[_0x644f('0x18')](_0x58c2a7);return _0xe8155c[_0x644f('0x1e')]('Content-Range',_0x59d9b0+'-'+_0x5540a5+'/'+_0x1fe32e)[_0x644f('0x1a')](_0x4333f4);}return null;};}function patchUpdates(_0x40e6bf){return function(_0xc783ae){try{jsonpatch[_0x644f('0x1f')](_0xc783ae,_0x40e6bf,!![]);}catch(_0x3497a3){return BPromise[_0x644f('0x20')](_0x3497a3);}return _0xc783ae[_0x644f('0x21')]();};}function saveUpdates(_0x240cdc,_0x3db17c){return function(_0x95d68b){if(_0x95d68b){return _0x95d68b[_0x644f('0x22')](_0x240cdc)['then'](function(_0x3ccb6c){return _0x3ccb6c;});}return null;};}function removeEntity(_0x2d1aa1,_0x4b9fe3){return function(_0x21d97a){if(_0x21d97a){return _0x21d97a['destroy']()[_0x644f('0x23')](function(){_0x2d1aa1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x166706,_0x4d8a94){return function(_0x578c09){if(!_0x578c09){_0x166706[_0x644f('0x24')](0x194);}return _0x578c09;};}function handleError(_0xd601,_0x22add3){_0x22add3=_0x22add3||0x1f4;return function(_0x12f7d3){logger[_0x644f('0x25')](_0x12f7d3['stack']);if(_0x12f7d3[_0x644f('0x26')]){delete _0x12f7d3['name'];}_0xd601[_0x644f('0x18')](_0x22add3)[_0x644f('0x27')](_0x12f7d3);};}exports[_0x644f('0x28')]=function(_0x22e45a,_0x349292){var _0x44a3ac={},_0x21d33f={},_0x266679={'count':0x0,'rows':[]};var _0x414d9a=_['map'](db[_0x644f('0x29')][_0x644f('0x2a')],function(_0x3d8d3f){return{'name':_0x3d8d3f[_0x644f('0x2b')],'type':_0x3d8d3f[_0x644f('0x2c')]['key']};});_0x21d33f[_0x644f('0x2d')]=_[_0x644f('0x2e')](_0x414d9a,'name');_0x21d33f[_0x644f('0x2f')]=_[_0x644f('0x30')](_0x22e45a[_0x644f('0x2f')]);_0x21d33f[_0x644f('0x31')]=_['intersection'](_0x21d33f[_0x644f('0x2d')],_0x21d33f[_0x644f('0x2f')]);_0x44a3ac['attributes']=_['intersection'](_0x21d33f[_0x644f('0x2d')],qs[_0x644f('0x32')](_0x22e45a[_0x644f('0x2f')][_0x644f('0x32')]));_0x44a3ac[_0x644f('0x33')]=_0x44a3ac[_0x644f('0x33')]['length']?_0x44a3ac[_0x644f('0x33')]:_0x21d33f[_0x644f('0x2d')];if(!_0x22e45a['query'][_0x644f('0x34')]('nolimit')){_0x44a3ac[_0x644f('0x1b')]=qs[_0x644f('0x1b')](_0x22e45a[_0x644f('0x2f')][_0x644f('0x1b')]);_0x44a3ac[_0x644f('0x35')]=qs['offset'](_0x22e45a[_0x644f('0x2f')]['offset']);}_0x44a3ac[_0x644f('0x36')]=qs[_0x644f('0x37')](_0x22e45a[_0x644f('0x2f')][_0x644f('0x37')]);_0x44a3ac[_0x644f('0x38')]=qs[_0x644f('0x31')](_['pick'](_0x22e45a[_0x644f('0x2f')],_0x21d33f[_0x644f('0x31')]),_0x414d9a);if(_0x22e45a[_0x644f('0x2f')]['filter']){_0x44a3ac[_0x644f('0x38')]=_[_0x644f('0x39')](_0x44a3ac[_0x644f('0x38')],{'$or':_[_0x644f('0x2e')](_0x414d9a,function(_0x588ab9){if(_0x588ab9[_0x644f('0x2c')]!==_0x644f('0x3a')){var _0x341b37={};_0x341b37[_0x588ab9[_0x644f('0x26')]]={'$like':'%'+_0x22e45a[_0x644f('0x2f')][_0x644f('0x3b')]+'%'};return _0x341b37;}})});}_0x44a3ac=_['merge']({},_0x44a3ac,_0x22e45a[_0x644f('0x3c')]);var _0x4937de={'where':_0x44a3ac[_0x644f('0x38')]};return db['ChatTransferReport']['count'](_0x4937de)[_0x644f('0x23')](function(_0x12c09d){_0x266679[_0x644f('0x1d')]=_0x12c09d;if(_0x22e45a['query'][_0x644f('0x3d')]){_0x44a3ac[_0x644f('0x3e')]=[{'all':!![]}];}return db[_0x644f('0x29')][_0x644f('0x3f')](_0x44a3ac);})[_0x644f('0x23')](function(_0x490de7){_0x266679['rows']=_0x490de7;return _0x266679;})['then'](respondWithFilteredResult(_0x349292,_0x44a3ac))[_0x644f('0x40')](handleError(_0x349292,null));};exports[_0x644f('0x41')]=function(_0x4914f8,_0x3b0951){var _0x544320={'raw':!![],'where':{'id':_0x4914f8[_0x644f('0x42')]['id']}},_0x26a871={};_0x26a871[_0x644f('0x2d')]=_[_0x644f('0x30')](db[_0x644f('0x29')]['rawAttributes']);_0x26a871['query']=_['keys'](_0x4914f8[_0x644f('0x2f')]);_0x26a871[_0x644f('0x31')]=_[_0x644f('0x43')](_0x26a871[_0x644f('0x2d')],_0x26a871['query']);_0x544320[_0x644f('0x33')]=_[_0x644f('0x43')](_0x26a871[_0x644f('0x2d')],qs['fields'](_0x4914f8[_0x644f('0x2f')][_0x644f('0x32')]));_0x544320['attributes']=_0x544320[_0x644f('0x33')][_0x644f('0x44')]?_0x544320[_0x644f('0x33')]:_0x26a871[_0x644f('0x2d')];if(_0x4914f8[_0x644f('0x2f')][_0x644f('0x3d')]){_0x544320[_0x644f('0x3e')]=[{'all':!![]}];}_0x544320=_[_0x644f('0x39')]({},_0x544320,_0x4914f8[_0x644f('0x3c')]);return db[_0x644f('0x29')][_0x644f('0x45')](_0x544320)[_0x644f('0x23')](handleEntityNotFound(_0x3b0951,null))['then'](respondWithResult(_0x3b0951,null))[_0x644f('0x40')](handleError(_0x3b0951,null));};exports[_0x644f('0x46')]=function(_0x5de413,_0x1c045c){return db[_0x644f('0x29')][_0x644f('0x46')](_0x5de413[_0x644f('0x47')],{})[_0x644f('0x23')](respondWithResult(_0x1c045c,0xc9))[_0x644f('0x40')](handleError(_0x1c045c,null));};exports[_0x644f('0x22')]=function(_0x1b6f50,_0x2c677e){if(_0x1b6f50[_0x644f('0x47')]['id']){delete _0x1b6f50[_0x644f('0x47')]['id'];}return db[_0x644f('0x29')][_0x644f('0x45')]({'where':{'id':_0x1b6f50[_0x644f('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c677e,null))[_0x644f('0x23')](saveUpdates(_0x1b6f50[_0x644f('0x47')],null))[_0x644f('0x23')](respondWithResult(_0x2c677e,null))[_0x644f('0x40')](handleError(_0x2c677e,null));};exports[_0x644f('0x48')]=function(_0x3cf45c,_0x2c381a){return db['ChatTransferReport'][_0x644f('0x45')]({'where':{'id':_0x3cf45c[_0x644f('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c381a,null))[_0x644f('0x23')](removeEntity(_0x2c381a,null))[_0x644f('0x40')](handleError(_0x2c381a,null));};exports[_0x644f('0x49')]=function(_0x594c37,_0x5327b4){return db[_0x644f('0x29')][_0x644f('0x49')]()[_0x644f('0x23')](respondWithResult(_0x5327b4,null))['catch'](handleError(_0x5327b4,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 6bb3e8c..7353028 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 _0xb1c0=['report_chat_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport'];(function(_0x1a1ef5,_0x3cae36){var _0xfe502a=function(_0x5a37f8){while(--_0x5a37f8){_0x1a1ef5['push'](_0x1a1ef5['shift']());}};_0xfe502a(++_0x3cae36);}(_0xb1c0,0x113));var _0x0b1c=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xb1c0[_0x1589dd];return _0x1bddd1;};'use strict';var _=require('lodash');var util=require(_0x0b1c('0x0'));var logger=require(_0x0b1c('0x1'))(_0x0b1c('0x2'));var moment=require(_0x0b1c('0x3'));var BPromise=require(_0x0b1c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b1c('0x5'));var rimraf=require('rimraf');var config=require(_0x0b1c('0x6'));var attributes=require(_0x0b1c('0x7'));module[_0x0b1c('0x8')]=function(_0x1e66a4,_0x10ee39){return _0x1e66a4[_0x0b1c('0x9')](_0x0b1c('0xa'),attributes,{'tableName':_0x0b1c('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x0b1c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b4d=['define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','api','request-promise','path','../../config/environment'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x7b4d,0x16c));var _0xd7b4=function(_0x2d4421,_0x15a84f){_0x2d4421=_0x2d4421-0x0;var _0x2d3b01=_0x7b4d[_0x2d4421];return _0x2d3b01;};'use strict';var _=require(_0xd7b4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd7b4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd7b4('0x2'));var fs=require('fs');var path=require(_0xd7b4('0x3'));var rimraf=require('rimraf');var config=require(_0xd7b4('0x4'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x541cfa,_0x50b7bb){return _0x541cfa[_0xd7b4('0x5')](_0xd7b4('0x6'),attributes,{'tableName':_0xd7b4('0x7'),'paranoid':![],'indexes':[{'name':_0xd7b4('0x8'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index e8f975a..32b64c0 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 _0x449b=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x249123,_0x5f50bb){var _0x3d178c=function(_0x1e6202){while(--_0x1e6202){_0x249123['push'](_0x249123['shift']());}};_0x3d178c(++_0x5f50bb);}(_0x449b,0x1b3));var _0xb449=function(_0x5f4149,_0x32f993){_0x5f4149=_0x5f4149-0x0;var _0x3f27b2=_0x449b[_0x5f4149];return _0x3f27b2;};'use strict';var _=require(_0xb449('0x0'));var util=require(_0xb449('0x1'));var moment=require(_0xb449('0x2'));var BPromise=require(_0xb449('0x3'));var rs=require(_0xb449('0x4'));var fs=require('fs');var Redis=require(_0xb449('0x5'));var db=require(_0xb449('0x6'))['db'];var utils=require(_0xb449('0x7'));var logger=require(_0xb449('0x8'))(_0xb449('0x9'));var config=require(_0xb449('0xa'));var jayson=require(_0xb449('0xb'));var client=jayson[_0xb449('0xc')][_0xb449('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x436b4b,_0x4c6306,_0x1ca53c){return new BPromise(function(_0x207757,_0x2afcc3){return client[_0xb449('0xe')](_0x436b4b,_0x1ca53c)[_0xb449('0xf')](function(_0x512638){logger['info'](_0xb449('0x10'),_0x4c6306,'request\x20sent');logger[_0xb449('0x11')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x4c6306,_0xb449('0x12'),JSON[_0xb449('0x13')](_0x512638));if(_0x512638[_0xb449('0x14')]){if(_0x512638[_0xb449('0x14')][_0xb449('0x15')]===0x1f4){logger[_0xb449('0x14')](_0xb449('0x10'),_0x4c6306,_0x512638['error'][_0xb449('0x16')]);return _0x2afcc3(_0x512638['error']['message']);}logger['error'](_0xb449('0x10'),_0x4c6306,_0x512638[_0xb449('0x14')][_0xb449('0x16')]);return _0x207757(_0x512638['error']['message']);}else{logger['info'](_0xb449('0x10'),_0x4c6306,_0xb449('0x12'));_0x207757(_0x512638['result'][_0xb449('0x16')]);}})[_0xb449('0x17')](function(_0x121806){logger['error'](_0xb449('0x10'),_0x4c6306,_0x121806);_0x2afcc3(_0x121806);});});} \ No newline at end of file +var _0x4e80=['stringify','error','code','message','info','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x2e7426,_0x21caa7){var _0x4ddeb6=function(_0x37c23c){while(--_0x37c23c){_0x2e7426['push'](_0x2e7426['shift']());}};_0x4ddeb6(++_0x21caa7);}(_0x4e80,0x12d));var _0x04e8=function(_0x26a9ad,_0x11a04f){_0x26a9ad=_0x26a9ad-0x0;var _0x31d9bc=_0x4e80[_0x26a9ad];return _0x31d9bc;};'use strict';var _=require(_0x04e8('0x0'));var util=require(_0x04e8('0x1'));var moment=require('moment');var BPromise=require(_0x04e8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04e8('0x3'));var db=require(_0x04e8('0x4'))['db'];var utils=require(_0x04e8('0x5'));var logger=require(_0x04e8('0x6'))('rpc');var config=require(_0x04e8('0x7'));var jayson=require(_0x04e8('0x8'));var client=jayson['client'][_0x04e8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27cc16,_0x163325,_0x2709ff){return new BPromise(function(_0x34fc04,_0x4e9b75){return client['request'](_0x27cc16,_0x2709ff)[_0x04e8('0xa')](function(_0x4ac3b7){logger['info'](_0x04e8('0xb'),_0x163325,'request\x20sent');logger[_0x04e8('0xc')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x163325,_0x04e8('0xd'),JSON[_0x04e8('0xe')](_0x4ac3b7));if(_0x4ac3b7['error']){if(_0x4ac3b7[_0x04e8('0xf')][_0x04e8('0x10')]===0x1f4){logger['error'](_0x04e8('0xb'),_0x163325,_0x4ac3b7[_0x04e8('0xf')][_0x04e8('0x11')]);return _0x4e9b75(_0x4ac3b7['error'][_0x04e8('0x11')]);}logger[_0x04e8('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x163325,_0x4ac3b7[_0x04e8('0xf')]['message']);return _0x34fc04(_0x4ac3b7[_0x04e8('0xf')]['message']);}else{logger[_0x04e8('0x12')](_0x04e8('0xb'),_0x163325,'request\x20sent');_0x34fc04(_0x4ac3b7[_0x04e8('0x13')][_0x04e8('0x11')]);}})[_0x04e8('0x14')](function(_0x1071e3){logger[_0x04e8('0xf')](_0x04e8('0xb'),_0x163325,_0x1071e3);_0x4e9b75(_0x1071e3);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 89fbc9e..614b896 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 _0x82a9=['isAuthenticated','index','get','describe','/:id','create','put','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller'];(function(_0x554047,_0x46ec41){var _0x5d11e4=function(_0x5a026e){while(--_0x5a026e){_0x554047['push'](_0x554047['shift']());}};_0x5d11e4(++_0x46ec41);}(_0x82a9,0x1bb));var _0x982a=function(_0x5cdeb7,_0x19194b){_0x5cdeb7=_0x5cdeb7-0x0;var _0x1ad6a5=_0x82a9[_0x5cdeb7];return _0x1ad6a5;};'use strict';var multer=require('multer');var util=require(_0x982a('0x0'));var path=require('path');var timeout=require(_0x982a('0x1'));var express=require(_0x982a('0x2'));var router=express['Router']();var fs_extra=require(_0x982a('0x3'));var auth=require(_0x982a('0x4'));var interaction=require(_0x982a('0x5'));var config=require('../../config/environment');var controller=require(_0x982a('0x6'));router['get']('/',auth[_0x982a('0x7')](),controller[_0x982a('0x8')]);router[_0x982a('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x982a('0xa')]);router['get'](_0x982a('0xb'),auth[_0x982a('0x7')](),controller['show']);router['post']('/',auth[_0x982a('0x7')](),controller[_0x982a('0xc')]);router[_0x982a('0xd')](_0x982a('0xb'),auth[_0x982a('0x7')](),controller[_0x982a('0xe')]);router[_0x982a('0xf')](_0x982a('0xb'),auth['isAuthenticated'](),controller[_0x982a('0x10')]);module[_0x982a('0x11')]=router; \ No newline at end of file +var _0x7b45=['show','post','create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','/describe','describe','/:id'];(function(_0x4e2807,_0x3942be){var _0x2eb3fc=function(_0x2f6a75){while(--_0x2f6a75){_0x4e2807['push'](_0x4e2807['shift']());}};_0x2eb3fc(++_0x3942be);}(_0x7b45,0xef));var _0x57b4=function(_0x44700b,_0x1cef26){_0x44700b=_0x44700b-0x0;var _0x4af965=_0x7b45[_0x44700b];return _0x4af965;};'use strict';var multer=require(_0x57b4('0x0'));var util=require('util');var path=require(_0x57b4('0x1'));var timeout=require('connect-timeout');var express=require(_0x57b4('0x2'));var router=express[_0x57b4('0x3')]();var fs_extra=require(_0x57b4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x57b4('0x5'));var config=require(_0x57b4('0x6'));var controller=require(_0x57b4('0x7'));router[_0x57b4('0x8')]('/',auth[_0x57b4('0x9')](),controller['index']);router[_0x57b4('0x8')](_0x57b4('0xa'),auth[_0x57b4('0x9')](),controller[_0x57b4('0xb')]);router['get'](_0x57b4('0xc'),auth['isAuthenticated'](),controller[_0x57b4('0xd')]);router[_0x57b4('0xe')]('/',auth['isAuthenticated'](),controller[_0x57b4('0xf')]);router[_0x57b4('0x10')]('/:id',auth[_0x57b4('0x9')](),controller[_0x57b4('0x11')]);router[_0x57b4('0x12')](_0x57b4('0xc'),auth['isAuthenticated'](),controller[_0x57b4('0x13')]);module[_0x57b4('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 638be05..4309283 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 _0xd829=['You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Send','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','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','ENUM','star','thumb','TEXT','stringify','input','name','text','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','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'];(function(_0xb35654,_0x422ea2){var _0x489648=function(_0x4d5091){while(--_0x4d5091){_0xb35654['push'](_0xb35654['shift']());}};_0x489648(++_0x422ea2);}(_0xd829,0xea));var _0x9d82=function(_0xf652f0,_0x191014){_0xf652f0=_0xf652f0-0x0;var _0x84122c=_0xd829[_0xf652f0];return _0x84122c;};'use strict';var Sequelize=require(_0x9d82('0x0'));var rs=require(_0x9d82('0x1'));module[_0x9d82('0x2')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x9d82('0x3')],'allowNull':![],'unique':_0x9d82('0x4')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x5')},'mapKeyOffline':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x5')},'key':{'type':Sequelize[_0x9d82('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x6')},'customerAlias':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x9d82('0x3')],'allowNull':![],'defaultValue':_0x9d82('0x7'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x9d82('0x3')],'allowNull':![],'defaultValue':_0x9d82('0x8'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x9d82('0x3')],'allowNull':![],'defaultValue':_0x9d82('0x8'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x9d82('0x9')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x9d82('0x3')]},'animation':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x9d82('0xb'),_0x9d82('0xc')),'defaultValue':_0x9d82('0xb')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x9d82('0xd')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0x9d82('0xe')},'offline_chat_button':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0xf')},'download_transcript':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x9d82('0x9')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x12')},'placeholderMessage':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x13')},'closingMessage':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x14')},'closingMessageButton':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x9d82('0x15')},'conditionAgreement':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x9d82('0x16')](_0x9d82('0x17'),_0x9d82('0x18')),'defaultValue':_0x9d82('0x17')},'ratingStarsNumber':{'type':Sequelize[_0x9d82('0x9')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x9d82('0x19')],'defaultValue':function(){return JSON[_0x9d82('0x1a')]({'items':[{'type':_0x9d82('0x1b'),'variable':null,'config':{'placeholder':_0x9d82('0x1c'),'type':_0x9d82('0x1d'),'required':!![]},'props':{'title':_0x9d82('0x1c'),'helpText':''}},{'type':_0x9d82('0x1b'),'props':{'title':_0x9d82('0x5'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x9d82('0x5')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue']('onlineForm')?JSON['parse'](this[_0x9d82('0x1e')](_0x9d82('0x1f'))):{};},'set':function(_0x25b4bc){return this['setDataValue'](_0x9d82('0x1f'),JSON[_0x9d82('0x1a')](_0x25b4bc));}},'offlineForm':{'type':Sequelize[_0x9d82('0x19')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x9d82('0x1b'),'props':{'title':_0x9d82('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x9d82('0x5'),'type':'email'},'variable':null},{'type':_0x9d82('0x20'),'config':{'placeholder':_0x9d82('0x21')},'props':{'title':'Comments','helpText':_0x9d82('0x22')}}],'fromKey':0x0});},'get':function(){return this[_0x9d82('0x1e')](_0x9d82('0x23'))?JSON['parse'](this[_0x9d82('0x1e')](_0x9d82('0x23'))):{};},'set':function(_0x1cf518){return this[_0x9d82('0x24')](_0x9d82('0x23'),JSON[_0x9d82('0x1a')](_0x1cf518));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9d82('0x25')]();}},'autoclose':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x9d82('0x3')]},'forwardOffline':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x9d82('0x3')]},'waitingTitle':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x26')},'waitingMessage':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x27')},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0x9d82('0x28')},'offlineMessageBody':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x29')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0x9d82('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x2b')},'enableCustomerAttachment':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x9d82('0x3')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9d82('0x2c');}},'notificationSound':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0x9d82('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x2e')},'verticalAlignment':{'type':Sequelize[_0x9d82('0x9')],'defaultValue':0x1e},'labelText':{'type':Sequelize['STRING'],'defaultValue':'CHAT'},'messagesAlignment':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x2f')},'defaultTitle':{'type':Sequelize[_0x9d82('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x9d82('0x9')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x9d82('0x3')],'allowNull':![],'defaultValue':_0x9d82('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9d82('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9d82('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':_0x9d82('0x31')},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9d82('0x9')],'comment':_0x9d82('0x32')},'mandatoryDisposition':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![],'comment':_0x9d82('0x33'),'set':function(_0x5bec20){if(!_0x5bec20)this[_0x9d82('0x24')]('mandatoryDispositionPauseId',null);this[_0x9d82('0x24')](_0x9d82('0x34'),_0x5bec20);}},'vidaooEscalation':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0x9d82('0x3')]},'vidaooTopic':{'type':Sequelize[_0x9d82('0x3')],'allowNull':![],'defaultValue':_0x9d82('0x35')},'vidaooNote':{'type':Sequelize[_0x9d82('0x3')],'defaultValue':function(){return _0x9d82('0x36');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x9d82('0xa')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x9d82('0x19')]}}; \ No newline at end of file +var _0x7e31=['Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT','alternate','#fafafa','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','exports','STRING','address','email','#011F6A','#ffffff','BOOLEAN','ENUM','rounded','Chat','Send','Contact\x20us','INTEGER','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Type\x20a\x20message','Skip','thumb','input','name','text','onlineForm','parse','setDataValue','stringify','textarea','Comments','getDataValue','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'];(function(_0x47f719,_0x2e559d){var _0x407f4e=function(_0x2be03a){while(--_0x2be03a){_0x47f719['push'](_0x47f719['shift']());}};_0x407f4e(++_0x2e559d);}(_0x7e31,0x64));var _0x17e3=function(_0x3c86dc,_0x5d22fc){_0x3c86dc=_0x3c86dc-0x0;var _0x4aeb79=_0x7e31[_0x3c86dc];return _0x4aeb79;};'use strict';var Sequelize=require(_0x17e3('0x0'));var rs=require(_0x17e3('0x1'));module[_0x17e3('0x2')]={'name':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![]},'address':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![],'unique':_0x17e3('0x4')},'description':{'type':Sequelize[_0x17e3('0x3')]},'mapKey':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x17e3('0x5')},'key':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#011F6A','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![],'defaultValue':_0x17e3('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![],'defaultValue':_0x17e3('0x7'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x17e3('0x9')]('rounded','squared'),'defaultValue':_0x17e3('0xa')},'header_online':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0xb')},'offline_chat_button':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0xc')},'header_offline':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0xd')},'download_transcript':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x17e3('0xe')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x17e3('0xf')]},'closingQuestion':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize['STRING'],'defaultValue':'Form\x20submission\x20error'},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x11')},'closingMessage':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize['STRING'],'defaultValue':_0x17e3('0x12')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0x17e3('0x9')]('star',_0x17e3('0x13')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0x17e3('0xe')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x17e3('0xf')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x17e3('0x14'),'variable':null,'config':{'placeholder':_0x17e3('0x15'),'type':_0x17e3('0x16'),'required':!![]},'props':{'title':_0x17e3('0x15'),'helpText':''}},{'type':'input','props':{'title':_0x17e3('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x17e3('0x5'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x17e3('0x17'))?JSON[_0x17e3('0x18')](this['getDataValue']('onlineForm')):{};},'set':function(_0x4c22eb){return this[_0x17e3('0x19')](_0x17e3('0x17'),JSON[_0x17e3('0x1a')](_0x4c22eb));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x17e3('0x1a')]({'items':[{'type':_0x17e3('0x14'),'props':{'title':_0x17e3('0x5'),'helpText':''},'config':{'required':!![],'placeholder':_0x17e3('0x5'),'type':'email'},'variable':null},{'type':_0x17e3('0x1b'),'config':{'placeholder':'Comments'},'props':{'title':_0x17e3('0x1c'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0x17e3('0x1d')](_0x17e3('0x1e'))?JSON[_0x17e3('0x18')](this[_0x17e3('0x1d')](_0x17e3('0x1e'))):{};},'set':function(_0x315c64){return this['setDataValue'](_0x17e3('0x1e'),JSON[_0x17e3('0x1a')](_0x315c64));}},'token':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':function(){return rs[_0x17e3('0x1f')]();}},'autoclose':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x20')},'waitingMessage':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x21')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0x17e3('0x22')},'enableUnmanagedNote':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'Your\x20request\x20has\x20not\x20been\x20processed.'},'skipUnmanaged':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x12')},'sendUnmanaged':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0xc')},'enableCustomerAttachment':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x17e3('0xf')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x17e3('0x23');}},'notificationSound':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x24')},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x17e3('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x25')},'verticalAlignment':{'type':Sequelize[_0x17e3('0xe')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x26')},'messagesAlignment':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':_0x17e3('0x27')},'defaultTitle':{'type':Sequelize[_0x17e3('0x3')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x17e3('0xe')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![],'defaultValue':_0x17e3('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x17e3('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x17e3('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':'System'},'systemAvatar':{'type':Sequelize['TEXT']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x17e3('0xe')],'comment':_0x17e3('0x29')},'mandatoryDisposition':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![],'comment':_0x17e3('0x2a'),'set':function(_0x2e119d){if(!_0x2e119d)this[_0x17e3('0x19')]('mandatoryDispositionPauseId',null);this[_0x17e3('0x19')]('mandatoryDisposition',_0x2e119d);}},'vidaooEscalation':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x17e3('0x3')],'allowNull':![],'defaultValue':_0x17e3('0x2b')},'vidaooNote':{'type':Sequelize[_0x17e3('0x3')],'defaultValue':function(){return _0x17e3('0x2c');}},'vidaooMetadata':{'type':Sequelize[_0x17e3('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x17e3('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x17e3('0xf')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index b0c2aad..558844b 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 _0x008c=['server','offline-chat','basename','openNewInteraction','sequelize','transaction','Attachment','MailServerOut','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','\x22%s\x22\x20<%s>','email','MailAccountId','mimetype','subjectOffline','toPairsIn','mapValues','offlineMessageSubject','NotifyMailAccount','notifyMail','attachments','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','tag','Intervals','getProactiveActions','getLicense','virtual','License','chatLicenseExceeded','timezone','server/files/chat/iframe.ejs','3.10.1','origin','http://localhost:9000','testWebsiteWithWildcard','remote','connection','remoteAddress','replace','render','alignment','color','textButtonColor','backgroundColor','hideWhenOffline','IntervalId','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','findAndCountAll','stack','finally','getApplications','addProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','getOfflineMessages','ChatOfflineMessage','Attachments','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','mustache','util','path','ejs','fs-extra','querystring','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../errors/api','handleError','URL','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','register','client','http','request','request\x20sent','debug','error','ChatWebsite,\x20%s,\x20%s','message','catch','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','get','ChatWebsites','UserProfileResource','name','send','setUA','getResult','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','lastName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','model','%s\x20%s\x20%s','vendor','type','stringify','index','Pause','mandatoryDispositionPause','rawAttributes','fieldName','key','map','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','ChatWebsite','findAll','show','params','keys','includeAll','include','find','create','address','forEach','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ChatWebsiteId','Disposition','findOne','nolimit','rows','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','filename','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','existsSync','getSystemAvatar','server/files/images/avatars/system_avatar.png','Interval','resolve','notify','chat','from','From\x20is\x20mandatory','mapKey','MapKey\x20is\x20mandatory','isEmpty','Body\x20is\x20mandatory','No\x20available\x20attributes','updatedAt','CompanyId','ListId','includes','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','CmList','List','CmContact','Contacts','ChatApplication','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','applications','Applications','priority','asc','list','contact','headers','threadId','closed','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','ChatQueue','waitForTheAssignedQueue','Start','startRouting','EventManager','files','ValidationError','no\x20available\x20attributes','difference','createdAt','Sequelize','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','spread','server/files/templates/chatOfflineMessage.ejs','utf8','originalname'];(function(_0x346e01,_0x11018b){var _0x54e1db=function(_0x3b7c22){while(--_0x3b7c22){_0x346e01['push'](_0x346e01['shift']());}};_0x54e1db(++_0x11018b);}(_0x008c,0x188));var _0xc008=function(_0xda99d6,_0x5d0efa){_0xda99d6=_0xda99d6-0x0;var _0x4d8540=_0x008c[_0xda99d6];return _0x4d8540;};'use strict';var Mustache=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var ejs=require(_0xc008('0x3'));var fs=require('fs');var fs_extra=require(_0xc008('0x4'));var _=require('lodash');var querystring=require(_0xc008('0x5'));var htmlToText=require(_0xc008('0x6'));var Redis=require(_0xc008('0x7'));var jayson=require(_0xc008('0x8'));var qs=require(_0xc008('0x9'));var logger=require(_0xc008('0xa'))(_0xc008('0xb'));var config=require(_0xc008('0xc'));var APIBadRequestError=require(_0xc008('0xd'))['APIBadRequestError'];var APINotFoundError=require(_0xc008('0xd'))['APINotFoundError'];var APIOutOfIntervalError=require(_0xc008('0xd'))['APIOutOfIntervalError'];var APIHandleError=require('../../errors/api')[_0xc008('0xe')];var APIConflictError=require(_0xc008('0xd'))['APIConflictError'];var wildcardUtils=require('./helpers/wildcard-expressions');var URL=require('url')[_0xc008('0xf')];var db=require(_0xc008('0x10'))['db'];config['redis']=_[_0xc008('0x11')](config[_0xc008('0x12')],{'host':_0xc008('0x13'),'port':0x18eb});var socket=require(_0xc008('0x14'))(new Redis(config[_0xc008('0x12')]));require(_0xc008('0x15'))[_0xc008('0x16')](socket);var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc008('0x17')]['http']({'port':0x232a});var client9003=jayson[_0xc008('0x17')][_0xc008('0x18')]({'port':0x232b});var client9001=jayson[_0xc008('0x17')][_0xc008('0x18')]({'port':0x2329});function respondWithRpcPromise(_0x3f0ecf,_0x5ee00b,_0x5e894e,_0x4bd0f4){return new Promise(function(_0x11ef38,_0x15a6ad){var _0x3cafe3=_0x4bd0f4||client;return _0x3cafe3[_0xc008('0x19')](_0x3f0ecf,_0x5e894e)['then'](function(_0x53b06e){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x5ee00b,_0xc008('0x1a'));logger[_0xc008('0x1b')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x5ee00b,_0xc008('0x1a'),JSON['stringify'](_0x53b06e));if(_0x53b06e['error']){if(_0x53b06e['error']['code']===0x1f4){logger[_0xc008('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x5ee00b,_0x53b06e['error']['message']);return _0x15a6ad(_0x53b06e['error']['message']);}logger[_0xc008('0x1c')](_0xc008('0x1d'),_0x5ee00b,_0x53b06e[_0xc008('0x1c')][_0xc008('0x1e')]);return _0x11ef38(_0x53b06e[_0xc008('0x1c')][_0xc008('0x1e')]);}else{logger['info'](_0xc008('0x1d'),_0x5ee00b,'request\x20sent');_0x11ef38(_0x53b06e['result'][_0xc008('0x1e')]);}})[_0xc008('0x1f')](function(_0x2e3cfb){logger[_0xc008('0x1c')]('ChatWebsite,\x20%s,\x20%s',_0x5ee00b,_0x2e3cfb);_0x15a6ad(_0x2e3cfb);});});}function respondWithStatusCode(_0x48582b,_0x5de1e9){_0x5de1e9=_0x5de1e9||0xcc;return function(_0x3f7b07){if(_0x3f7b07){return _0x48582b[_0xc008('0x20')](_0x5de1e9);}return _0x48582b[_0xc008('0x21')](_0x5de1e9)[_0xc008('0x22')]();};}function respondWithResult(_0x5bebd9,_0x5e2aca){_0x5e2aca=_0x5e2aca||0xc8;return function(_0x4fce9c){if(_0x4fce9c){return _0x5bebd9['status'](_0x5e2aca)['json'](_0x4fce9c);}};}function respondWithFilteredResult(_0x3865c0,_0x29ba43){return function(_0x25eae4){if(_0x25eae4){var _0x529961=typeof _0x29ba43[_0xc008('0x23')]===_0xc008('0x24')&&typeof _0x29ba43[_0xc008('0x25')]===_0xc008('0x24');var _0x4c5dec=_0x25eae4[_0xc008('0x26')];var _0x2e0b4e=_0x529961?0x0:_0x29ba43['offset'];var _0x58db82=_0x529961?_0x25eae4['count']:_0x29ba43[_0xc008('0x23')]+_0x29ba43[_0xc008('0x25')];var _0xf831f2;if(_0x58db82>=_0x4c5dec){_0x58db82=_0x4c5dec;_0xf831f2=0xc8;}else{_0xf831f2=0xce;}_0x3865c0[_0xc008('0x21')](_0xf831f2);return _0x3865c0[_0xc008('0x27')](_0xc008('0x28'),_0x2e0b4e+'-'+_0x58db82+'/'+_0x4c5dec)[_0xc008('0x29')](_0x25eae4);}return null;};}function saveUpdates(_0x22d8e8){return function(_0x1fe1e1){if(_0x1fe1e1){return _0x1fe1e1[_0xc008('0x2a')](_0x22d8e8)[_0xc008('0x2b')](function(_0x1ac7c8){return _0x1ac7c8;});}return null;};}function removeEntity(_0x596ee8){return function(_0x334a09){if(_0x334a09){return _0x334a09[_0xc008('0x2c')]()['then'](function(){var _0xaf4b84=_0x334a09[_0xc008('0x2d')]({'plain':!![]});var _0x383be7=_0xc008('0x2e');return db[_0xc008('0x2f')][_0xc008('0x2c')]({'where':{'type':_0x383be7,'resourceId':_0xaf4b84['id']}})[_0xc008('0x2b')](function(){return _0x334a09;});})[_0xc008('0x2b')](function(){_0x596ee8[_0xc008('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x415b87){return function(_0x389a40){if(!_0x389a40){_0x415b87[_0xc008('0x20')](0x194);}return _0x389a40;};}function handleError(_0x344bad,_0x40002f){_0x40002f=_0x40002f||0x1f4;return function(_0x315562){logger[_0xc008('0x1c')](_0x315562['stack']);if(_0x315562[_0xc008('0x30')]){delete _0x315562[_0xc008('0x30')];}_0x344bad['status'](_0x40002f)[_0xc008('0x31')](_0x315562);};}function createInteractionObject(_0x15453c,_0x5e38d5,_0x263473,_0x2e4ae1){var _0x280e9b=require('user-agent-parser');var _0x53b353=new _0x280e9b();var _0x478810=_0x53b353[_0xc008('0x32')](_0x263473['user-agent'])[_0xc008('0x33')]();var _0x3884dd=_0x5e38d5[_0xc008('0x34')];if(_0x263473[_0xc008('0x35')]){_0x3884dd=_0x263473[_0xc008('0x35')];}else if(_0x263473[_0xc008('0x36')]){_0x3884dd=_[_0xc008('0x37')](_0x263473[_0xc008('0x36')][_0xc008('0x38')](','));}return{'ContactId':_0x2e4ae1['id'],'ChatWebsiteId':_0x15453c,'from':(_0x2e4ae1[_0xc008('0x39')]||'')+'\x20'+(_0x2e4ae1[_0xc008('0x3a')]||''),'customerIp':_0x3884dd,'customerPort':_0x263473[_0xc008('0x3b')]?_0x263473[_0xc008('0x3b')]:null,'referer':_0x5e38d5[_0xc008('0x3c')],'browserName':_0x478810['browser'][_0xc008('0x30')]&&_0x478810[_0xc008('0x3d')][_0xc008('0x3e')]?util[_0xc008('0x3f')]('%s\x20%s',_0x478810[_0xc008('0x3d')][_0xc008('0x30')],_0x478810[_0xc008('0x3d')][_0xc008('0x3e')]):_0xc008('0x40'),'browserVersion':_0x478810['browser'][_0xc008('0x3e')]||_0xc008('0x40'),'osName':util[_0xc008('0x3f')](_0xc008('0x41'),_0x478810['os'][_0xc008('0x30')],_0x478810['os']['version']),'osVersion':_0x478810['os'][_0xc008('0x3e')],'deviceModel':_0x478810[_0xc008('0x42')][_0xc008('0x43')]&&_0x478810[_0xc008('0x42')]['vendor']?util[_0xc008('0x3f')](_0xc008('0x44'),_0x478810[_0xc008('0x42')]['model'],_0x478810[_0xc008('0x42')]['vendor'],_0x478810[_0xc008('0x42')]['type']):null,'deviceVendor':_0x478810[_0xc008('0x42')][_0xc008('0x45')],'deviceType':_0x478810['device'][_0xc008('0x46')],'formData':JSON[_0xc008('0x47')](_0x5e38d5)};}exports[_0xc008('0x48')]=function(_0x5caaa2,_0x1cec64){var _0x2a9b5c={'include':[{'model':db[_0xc008('0x49')],'as':_0xc008('0x4a')}]},_0x200469={},_0x44fc5d={'count':0x0,'rows':[]};var _0x59ca2b=_['map'](db['ChatWebsite'][_0xc008('0x4b')],function(_0x36417a){return{'name':_0x36417a[_0xc008('0x4c')],'type':_0x36417a[_0xc008('0x46')][_0xc008('0x4d')]};});_0x200469[_0xc008('0x43')]=_[_0xc008('0x4e')](_0x59ca2b,_0xc008('0x30'));_0x200469['query']=_['keys'](_0x5caaa2['query']);_0x200469[_0xc008('0x4f')]=_[_0xc008('0x50')](_0x200469[_0xc008('0x43')],_0x200469['query']);_0x2a9b5c[_0xc008('0x51')]=_[_0xc008('0x50')](_0x200469[_0xc008('0x43')],qs[_0xc008('0x52')](_0x5caaa2[_0xc008('0x53')][_0xc008('0x52')]));_0x2a9b5c[_0xc008('0x51')]=_0x2a9b5c[_0xc008('0x51')][_0xc008('0x54')]?_0x2a9b5c[_0xc008('0x51')]:_0x200469['model'];if(!_0x5caaa2['query'][_0xc008('0x55')]('nolimit')){_0x2a9b5c[_0xc008('0x25')]=qs[_0xc008('0x25')](_0x5caaa2[_0xc008('0x53')]['limit']);_0x2a9b5c[_0xc008('0x23')]=qs[_0xc008('0x23')](_0x5caaa2[_0xc008('0x53')][_0xc008('0x23')]);}_0x2a9b5c[_0xc008('0x56')]=qs['sort'](_0x5caaa2[_0xc008('0x53')][_0xc008('0x57')]);_0x2a9b5c['where']=qs[_0xc008('0x4f')](_[_0xc008('0x58')](_0x5caaa2['query'],_0x200469['filters']),_0x59ca2b);if(_0x5caaa2[_0xc008('0x53')][_0xc008('0x59')]){_0x2a9b5c[_0xc008('0x5a')]=_[_0xc008('0x5b')](_0x2a9b5c[_0xc008('0x5a')],{'$or':_['map'](_0x59ca2b,function(_0x57f1f9){if(_0x57f1f9[_0xc008('0x46')]!=='VIRTUAL'){var _0x3d7cce={};_0x3d7cce[_0x57f1f9[_0xc008('0x30')]]={'$like':'%'+_0x5caaa2[_0xc008('0x53')][_0xc008('0x59')]+'%'};return _0x3d7cce;}})});}_0x2a9b5c=_[_0xc008('0x5b')]({},_0x2a9b5c,_0x5caaa2[_0xc008('0x5c')]);var _0x49d8b0={'where':_0x2a9b5c[_0xc008('0x5a')]};return db[_0xc008('0x5d')][_0xc008('0x26')](_0x49d8b0)[_0xc008('0x2b')](function(_0x4424f5){_0x44fc5d['count']=_0x4424f5;if(_0x5caaa2[_0xc008('0x53')]['includeAll']){_0x2a9b5c['include']=[{'all':!![]}];}return db['ChatWebsite'][_0xc008('0x5e')](_0x2a9b5c);})[_0xc008('0x2b')](function(_0x5dfb69){_0x44fc5d['rows']=_0x5dfb69;return _0x44fc5d;})[_0xc008('0x2b')](respondWithFilteredResult(_0x1cec64,_0x2a9b5c))[_0xc008('0x1f')](handleError(_0x1cec64,null));};exports[_0xc008('0x5f')]=function(_0x47a58b,_0x3587c3){var _0x1092cb={'raw':![],'where':{'id':_0x47a58b[_0xc008('0x60')]['id']},'include':[{'model':db['Pause'],'as':_0xc008('0x4a')}]},_0x12ba3f={};_0x12ba3f['model']=_[_0xc008('0x61')](db[_0xc008('0x5d')][_0xc008('0x4b')]);_0x12ba3f[_0xc008('0x53')]=_[_0xc008('0x61')](_0x47a58b[_0xc008('0x53')]);_0x12ba3f['filters']=_[_0xc008('0x50')](_0x12ba3f['model'],_0x12ba3f['query']);_0x1092cb[_0xc008('0x51')]=_[_0xc008('0x50')](_0x12ba3f['model'],qs[_0xc008('0x52')](_0x47a58b[_0xc008('0x53')][_0xc008('0x52')]));_0x1092cb[_0xc008('0x51')]=_0x1092cb[_0xc008('0x51')][_0xc008('0x54')]?_0x1092cb[_0xc008('0x51')]:_0x12ba3f['model'];if(_0x47a58b[_0xc008('0x53')][_0xc008('0x62')]){_0x1092cb[_0xc008('0x63')]=[{'all':!![]}];}_0x1092cb=_[_0xc008('0x5b')]({},_0x1092cb,_0x47a58b[_0xc008('0x5c')]);return db[_0xc008('0x5d')][_0xc008('0x64')](_0x1092cb)[_0xc008('0x2b')](handleEntityNotFound(_0x3587c3,null))[_0xc008('0x2b')](respondWithResult(_0x3587c3,null))[_0xc008('0x1f')](handleError(_0x3587c3,null));};exports[_0xc008('0x65')]=function(_0x2b5eb6,_0x131b81){var _0x41dd45=null;_0x2b5eb6['body'][_0xc008('0x66')][_0xc008('0x38')](',')[_0xc008('0x67')](_0x566dea=>{if(_0x566dea[_0xc008('0x68')]()!==''&&!wildcardUtils[_0xc008('0x69')](_0x566dea['trim']())){_0x41dd45=new APIBadRequestError('\x22'+_0x566dea['trim']()+_0xc008('0x6a'));}});if(_0x41dd45){return handleError(_0x131b81,null)(_0x41dd45);}return db[_0xc008('0x5d')][_0xc008('0x65')](_0x2b5eb6[_0xc008('0x6b')],{})[_0xc008('0x2b')](function(_0x335f00){var _0x238852=_0x2b5eb6[_0xc008('0x6c')][_0xc008('0x2d')]({'plain':!![]});if(!_0x238852)throw new Error(_0xc008('0x6d'));if(_0x238852[_0xc008('0x6e')]==='user'){var _0x336516=_0x335f00[_0xc008('0x2d')]({'plain':!![]});var _0xfdb5e3=_0xc008('0x2e');return db['UserProfileSection'][_0xc008('0x64')]({'where':{'name':_0xfdb5e3,'userProfileId':_0x238852['userProfileId']},'raw':!![]})[_0xc008('0x2b')](function(_0x46fa7b){if(_0x46fa7b&&_0x46fa7b[_0xc008('0x6f')]===0x0){return db['UserProfileResource'][_0xc008('0x65')]({'name':_0x336516[_0xc008('0x30')],'resourceId':_0x336516['id'],'type':_0x46fa7b[_0xc008('0x30')],'sectionId':_0x46fa7b['id']},{})['then'](function(){return _0x335f00;});}else{return _0x335f00;}})[_0xc008('0x1f')](function(_0x539fc8){logger[_0xc008('0x1c')](_0xc008('0x70'),_0x539fc8);throw _0x539fc8;});}return _0x335f00;})[_0xc008('0x2b')](respondWithResult(_0x131b81,0xc9))[_0xc008('0x1f')](handleError(_0x131b81,null));};exports[_0xc008('0x2a')]=function(_0x4ca4a6,_0x3c30db){var _0x3f2342=null;_0x4ca4a6['body'][_0xc008('0x66')]['split'](',')[_0xc008('0x67')](_0x50bfe5=>{if(_0x50bfe5[_0xc008('0x68')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x50bfe5[_0xc008('0x68')]())){_0x3f2342=new APIBadRequestError('\x22'+_0x50bfe5[_0xc008('0x68')]()+_0xc008('0x6a'));}});if(_0x3f2342){return handleError(_0x3c30db,null)(_0x3f2342);}if(_0x4ca4a6[_0xc008('0x6b')]['id']){delete _0x4ca4a6['body']['id'];}return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x4ca4a6[_0xc008('0x60')]['id']},'include':[{'model':db[_0xc008('0x49')],'as':_0xc008('0x4a')}]})[_0xc008('0x2b')](handleEntityNotFound(_0x3c30db,null))[_0xc008('0x2b')](saveUpdates(_0x4ca4a6[_0xc008('0x6b')],null))['then'](respondWithResult(_0x3c30db,null))[_0xc008('0x1f')](handleError(_0x3c30db,null));};exports['destroy']=function(_0x511477,_0x4c84da){return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x511477[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x4c84da,null))[_0xc008('0x2b')](removeEntity(_0x4c84da,null))[_0xc008('0x1f')](handleError(_0x4c84da,null));};exports[_0xc008('0x71')]=function(_0x519328,_0x127bdf){return db['ChatWebsite'][_0xc008('0x71')]()[_0xc008('0x2b')](respondWithResult(_0x127bdf,null))[_0xc008('0x1f')](handleError(_0x127bdf,null));};exports[_0xc008('0x72')]=function(_0xc9f3f4,_0x3b2669){if(_0xc9f3f4[_0xc008('0x6b')]['id']){delete _0xc9f3f4[_0xc008('0x6b')]['id'];}return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0xc9f3f4[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x3b2669,null))['then'](function(_0x4e7af3){if(_0x4e7af3){_0xc9f3f4[_0xc008('0x6b')][_0xc008('0x73')]=_0x4e7af3['id'];return db[_0xc008('0x74')]['create'](_0xc9f3f4[_0xc008('0x6b')]);}})[_0xc008('0x2b')](respondWithResult(_0x3b2669,null))['catch'](handleError(_0x3b2669,null));};exports['getDispositions']=function(_0x4908c8,_0x3fc44f){var _0x2ece80={'raw':![],'where':{}};var _0xd52e2b={};var _0x38ca14={'count':0x0,'rows':[]};return db[_0xc008('0x5d')][_0xc008('0x75')]({'where':{'id':_0x4908c8[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x3fc44f,null))[_0xc008('0x2b')](function(_0x1e7a11){if(_0x1e7a11){_0xd52e2b['model']=_['keys'](db[_0xc008('0x74')][_0xc008('0x4b')]);_0xd52e2b[_0xc008('0x53')]=_[_0xc008('0x61')](_0x4908c8[_0xc008('0x53')]);_0xd52e2b[_0xc008('0x4f')]=_['intersection'](_0xd52e2b['model'],_0xd52e2b[_0xc008('0x53')]);_0x2ece80[_0xc008('0x51')]=_[_0xc008('0x50')](_0xd52e2b['model'],qs['fields'](_0x4908c8['query']['fields']));_0x2ece80['attributes']=_0x2ece80['attributes'][_0xc008('0x54')]?_0x2ece80['attributes']:_0xd52e2b[_0xc008('0x43')];if(!_0x4908c8['query'][_0xc008('0x55')](_0xc008('0x76'))){_0x2ece80[_0xc008('0x25')]=qs['limit'](_0x4908c8['query'][_0xc008('0x25')]);_0x2ece80['offset']=qs[_0xc008('0x23')](_0x4908c8[_0xc008('0x53')]['offset']);}_0x2ece80[_0xc008('0x56')]=qs['sort'](_0x4908c8['query'][_0xc008('0x57')]);_0x2ece80[_0xc008('0x5a')]=qs['filters'](_[_0xc008('0x58')](_0x4908c8[_0xc008('0x53')],_0xd52e2b[_0xc008('0x4f')]));_0x2ece80['where'][_0xc008('0x73')]=_0x1e7a11['id'];if(_0x4908c8[_0xc008('0x53')][_0xc008('0x59')]){_0x2ece80[_0xc008('0x5a')]=_[_0xc008('0x5b')](_0x2ece80[_0xc008('0x5a')],{'$or':_['map'](_0x2ece80[_0xc008('0x51')],function(_0xdaff5b){var _0x2517c6={};_0x2517c6[_0xdaff5b]={'$like':'%'+_0x4908c8['query'][_0xc008('0x59')]+'%'};return _0x2517c6;})});}_0x2ece80=_[_0xc008('0x5b')]({},_0x2ece80,_0x4908c8[_0xc008('0x5c')]);return db['Disposition']['count']({'where':_0x2ece80['where']})[_0xc008('0x2b')](function(_0x470888){_0x38ca14[_0xc008('0x26')]=_0x470888;if(_0x4908c8[_0xc008('0x53')][_0xc008('0x62')]){_0x2ece80[_0xc008('0x63')]=[{'all':!![]}];}return db[_0xc008('0x74')][_0xc008('0x5e')](_0x2ece80);})['then'](function(_0x29f225){_0x38ca14[_0xc008('0x77')]=_0x29f225;return _0x38ca14;});}})['then'](respondWithFilteredResult(_0x3fc44f,_0x2ece80))['catch'](handleError(_0x3fc44f,null));};exports[_0xc008('0x78')]=function(_0x128123,_0x2be063){return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x128123['params']['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x2be063,null))[_0xc008('0x2b')](function(_0x56be9d){if(_0x56be9d){return _0x56be9d[_0xc008('0x78')](_0x128123[_0xc008('0x53')][_0xc008('0x79')]);}})[_0xc008('0x2b')](respondWithStatusCode(_0x2be063,null))['catch'](handleError(_0x2be063,null));};exports[_0xc008('0x7a')]=function(_0x2d42e0,_0x21dd25){if(_0x2d42e0[_0xc008('0x6b')]['id']){delete _0x2d42e0['body']['id'];}return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x2d42e0['params']['id']}})['then'](handleEntityNotFound(_0x21dd25,null))[_0xc008('0x2b')](function(_0x581a45){if(_0x581a45){_0x2d42e0[_0xc008('0x6b')][_0xc008('0x73')]=_0x581a45['id'];return db['CannedAnswer'][_0xc008('0x65')](_0x2d42e0[_0xc008('0x6b')]);}})[_0xc008('0x2b')](respondWithResult(_0x21dd25,null))[_0xc008('0x1f')](handleError(_0x21dd25,null));};exports[_0xc008('0x7b')]=function(_0x1cbd0c,_0x56fa88){var _0x2b2bfb={'raw':![],'where':{}};var _0x357043={};var _0x2fcad1={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x1cbd0c[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x56fa88,null))['then'](function(_0x16c1f2){if(_0x16c1f2){_0x357043[_0xc008('0x43')]=_[_0xc008('0x61')](db['CannedAnswer'][_0xc008('0x4b')]);_0x357043[_0xc008('0x53')]=_[_0xc008('0x61')](_0x1cbd0c[_0xc008('0x53')]);_0x357043[_0xc008('0x4f')]=_[_0xc008('0x50')](_0x357043[_0xc008('0x43')],_0x357043['query']);_0x2b2bfb[_0xc008('0x51')]=_['intersection'](_0x357043[_0xc008('0x43')],qs[_0xc008('0x52')](_0x1cbd0c[_0xc008('0x53')]['fields']));_0x2b2bfb[_0xc008('0x51')]=_0x2b2bfb[_0xc008('0x51')][_0xc008('0x54')]?_0x2b2bfb[_0xc008('0x51')]:_0x357043[_0xc008('0x43')];if(!_0x1cbd0c[_0xc008('0x53')][_0xc008('0x55')](_0xc008('0x76'))){_0x2b2bfb[_0xc008('0x25')]=qs[_0xc008('0x25')](_0x1cbd0c['query'][_0xc008('0x25')]);_0x2b2bfb[_0xc008('0x23')]=qs[_0xc008('0x23')](_0x1cbd0c[_0xc008('0x53')][_0xc008('0x23')]);}_0x2b2bfb['order']=qs[_0xc008('0x57')](_0x1cbd0c[_0xc008('0x53')][_0xc008('0x57')]);_0x2b2bfb[_0xc008('0x5a')]=qs[_0xc008('0x4f')](_[_0xc008('0x58')](_0x1cbd0c[_0xc008('0x53')],_0x357043[_0xc008('0x4f')]));_0x2b2bfb[_0xc008('0x5a')][_0xc008('0x73')]=_0x16c1f2['id'];if(_0x1cbd0c[_0xc008('0x53')][_0xc008('0x59')]){_0x2b2bfb[_0xc008('0x5a')]=_[_0xc008('0x5b')](_0x2b2bfb[_0xc008('0x5a')],{'$or':_['map'](_0x2b2bfb['attributes'],function(_0xa53d53){var _0x276ced={};_0x276ced[_0xa53d53]={'$like':'%'+_0x1cbd0c[_0xc008('0x53')][_0xc008('0x59')]+'%'};return _0x276ced;})});}_0x2b2bfb=_[_0xc008('0x5b')]({},_0x2b2bfb,_0x1cbd0c[_0xc008('0x5c')]);return db[_0xc008('0x7c')][_0xc008('0x26')]({'where':_0x2b2bfb[_0xc008('0x5a')]})['then'](function(_0x9e53af){_0x2fcad1[_0xc008('0x26')]=_0x9e53af;if(_0x1cbd0c['query'][_0xc008('0x62')]){_0x2b2bfb[_0xc008('0x63')]=[{'all':!![]}];}return db[_0xc008('0x7c')][_0xc008('0x5e')](_0x2b2bfb);})[_0xc008('0x2b')](function(_0x3718d9){_0x2fcad1['rows']=_0x3718d9;return _0x2fcad1;});}})[_0xc008('0x2b')](respondWithFilteredResult(_0x56fa88,_0x2b2bfb))[_0xc008('0x1f')](handleError(_0x56fa88,null));};exports[_0xc008('0x7d')]=function(_0x1cff37,_0x59e3d0){return db[_0xc008('0x5d')]['find']({'where':{'id':_0x1cff37[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x59e3d0,null))['then'](function(_0x184f30){if(_0x184f30){return _0x184f30['removeAnswers'](_0x1cff37[_0xc008('0x53')]['ids']);}})['then'](respondWithStatusCode(_0x59e3d0,null))['catch'](handleError(_0x59e3d0,null));};exports[_0xc008('0x7e')]=function(_0x402b67,_0x48f40f){_0x402b67[_0xc008('0x6b')][_0xc008('0x7f')]=_0x402b67['file'][_0xc008('0x80')];return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x402b67['params']['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x48f40f,null))[_0xc008('0x2b')](saveUpdates(_0x402b67[_0xc008('0x6b')],null))[_0xc008('0x2b')](respondWithResult(_0x48f40f,null))[_0xc008('0x1f')](handleError(_0x48f40f,null));};exports[_0xc008('0x81')]=function(_0x2d87ff,_0x45a4d4){_0x2d87ff[_0xc008('0x6b')][_0xc008('0x82')]=_0x2d87ff[_0xc008('0x83')]['filename'];return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x2d87ff[_0xc008('0x60')]['id']}})['then'](handleEntityNotFound(_0x45a4d4,null))[_0xc008('0x2b')](saveUpdates(_0x2d87ff[_0xc008('0x6b')],null))[_0xc008('0x2b')](respondWithResult(_0x45a4d4,null))['catch'](handleError(_0x45a4d4,null));};exports[_0xc008('0x84')]=function(_0x5468b9,_0x3d3ebc){_0x5468b9[_0xc008('0x6b')][_0xc008('0x85')]=_0x5468b9['file'][_0xc008('0x80')];return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x5468b9[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x3d3ebc,null))[_0xc008('0x2b')](saveUpdates(_0x5468b9[_0xc008('0x6b')],null))['then'](respondWithResult(_0x3d3ebc,null))[_0xc008('0x1f')](handleError(_0x3d3ebc,null));};exports[_0xc008('0x86')]=function(_0x17db9a,_0x39d1fd){_0x17db9a['body'][_0xc008('0x87')]=_0x17db9a['file'][_0xc008('0x80')];return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x17db9a[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x39d1fd,null))[_0xc008('0x2b')](saveUpdates(_0x17db9a[_0xc008('0x6b')],null))['then'](respondWithResult(_0x39d1fd,null))[_0xc008('0x1f')](handleError(_0x39d1fd,null));};exports[_0xc008('0x88')]=function(_0x372822,_0x3e5a69){var _0x4f0c8a=path[_0xc008('0x89')](config['root'],_0xc008('0x8a'));var _0x3b2e99={'where':{'id':_0x372822[_0xc008('0x60')]['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x58231d=![];return require(_0xc008('0x8b'))['getLicense']()[_0xc008('0x2b')](function(_0x59596d){if(_0x59596d){_0x58231d=_0x59596d[_0xc008('0x8c')];}})[_0xc008('0x2b')](function(){return db['ChatWebsite'][_0xc008('0x64')](_0x3b2e99);})[_0xc008('0x2b')](handleEntityNotFound(_0x3e5a69,null))['then'](function(_0x5b2261){if(_0x5b2261){if(!_[_0xc008('0x8d')](_0x5b2261[_0xc008('0x7f')])){if(fs['existsSync'](path[_0xc008('0x89')](config[_0xc008('0x8e')],_0xc008('0x8f'),_0x5b2261[_0xc008('0x7f')]))&&_0x58231d){_0x4f0c8a=path['join'](config[_0xc008('0x8e')],_0xc008('0x8f'),_0x5b2261[_0xc008('0x7f')]);}}return _0x3e5a69[_0xc008('0x90')](_0x4f0c8a);}})[_0xc008('0x1f')](handleError(_0x3e5a69,null));};exports[_0xc008('0x91')]=function(_0x27fd97,_0x3ff1b2){var _0x2f0e45=path[_0xc008('0x89')](config[_0xc008('0x8e')],_0xc008('0x92'));var _0x1f9b4f={'where':{'id':_0x27fd97['params']['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0xc008('0x5d')][_0xc008('0x64')](_0x1f9b4f)[_0xc008('0x2b')](handleEntityNotFound(_0x3ff1b2,null))[_0xc008('0x2b')](function(_0x1b5d7b){if(_0x1b5d7b){if(!_[_0xc008('0x8d')](_0x1b5d7b[_0xc008('0x82')])){if(fs['existsSync'](path['join'](config[_0xc008('0x8e')],_0xc008('0x93'),_0x1b5d7b[_0xc008('0x82')]))){_0x2f0e45=path['join'](config[_0xc008('0x8e')],_0xc008('0x93'),_0x1b5d7b[_0xc008('0x82')]);}}return _0x3ff1b2[_0xc008('0x90')](_0x2f0e45);}})[_0xc008('0x1f')](handleError(_0x3ff1b2,null));};exports[_0xc008('0x94')]=function(_0x35e59b,_0x39e8e3){var _0x354115=path[_0xc008('0x89')](config[_0xc008('0x8e')],_0xc008('0x95'));var _0x4ffaa3={'where':{'id':_0x35e59b['params']['id']},'attributes':['id',_0xc008('0x85'),_0xc008('0x96')],'raw':!![]};return db['ChatWebsite'][_0xc008('0x64')](_0x4ffaa3)[_0xc008('0x2b')](handleEntityNotFound(_0x39e8e3,null))[_0xc008('0x2b')](function(_0x15b272){if(_0x15b272){if(!_[_0xc008('0x8d')](_0x15b272[_0xc008('0x85')])){if(fs[_0xc008('0x97')](path[_0xc008('0x89')](config[_0xc008('0x8e')],'server/files/images/avatars/',_0x15b272['customerAvatar']))&&_0x15b272['showCustomerAvatar']){_0x354115=path[_0xc008('0x89')](config['root'],_0xc008('0x93'),_0x15b272[_0xc008('0x85')]);}}return _0x39e8e3[_0xc008('0x90')](_0x354115);}})[_0xc008('0x1f')](handleError(_0x39e8e3,null));};exports[_0xc008('0x98')]=function(_0x2073be,_0x293fc5){var _0x37636e=path[_0xc008('0x89')](config[_0xc008('0x8e')],_0xc008('0x99'));var _0x4ce373={'where':{'id':_0x2073be[_0xc008('0x60')]['id']},'attributes':['id',_0xc008('0x87')],'raw':!![]};return db[_0xc008('0x5d')][_0xc008('0x64')](_0x4ce373)[_0xc008('0x2b')](handleEntityNotFound(_0x293fc5,null))['then'](function(_0x755321){if(_0x755321){if(!_['isNil'](_0x755321[_0xc008('0x87')])){if(fs[_0xc008('0x97')](path[_0xc008('0x89')](config['root'],_0xc008('0x93'),_0x755321[_0xc008('0x87')]))){_0x37636e=path[_0xc008('0x89')](config[_0xc008('0x8e')],_0xc008('0x93'),_0x755321[_0xc008('0x87')]);}}return _0x293fc5[_0xc008('0x90')](_0x37636e);}})['catch'](handleError(_0x293fc5,null));};function checkWebsiteInterval(_0x1cad4b){var _0x3835ce=_0x1cad4b[_0xc008('0x9a')];if(!_0x3835ce){return Promise[_0xc008('0x9b')](_0x1cad4b);}var _0x52a7b5=_0x1cad4b['timezone']||undefined;return _0x3835ce['ifTime'](_0x52a7b5)['then'](function(_0x7cdb67){if(!_0x7cdb67){throw new APIOutOfIntervalError();}return _0x1cad4b;});}exports[_0xc008('0x9c')]=function(_0xfa6008,_0xdbe8ad){var _0x4db69f={'body':_0xfa6008[_0xc008('0x6b')],'channel':_0xc008('0x9d')};var _0xff42e6=[];var _0x567bfc=[];var _0x438195={};var _0x5bfe83=![];if(_0xfa6008[_0xc008('0x6b')]['id']){delete _0xfa6008['body']['id'];}if(_[_0xc008('0x8d')](_0xfa6008[_0xc008('0x6b')][_0xc008('0x9e')])){throw new APIBadRequestError(_0xc008('0x9f'));}if(_['isNil'](_0xfa6008[_0xc008('0x6b')][_0xc008('0xa0')])){throw new APIBadRequestError(_0xc008('0xa1'));}if(_[_0xc008('0xa2')](_0xfa6008[_0xc008('0x6b')][_0xc008('0x6b')])){throw new APIBadRequestError(_0xc008('0xa3'));}var _0x4c6cfa=_0xfa6008[_0xc008('0x6b')][_0xc008('0x34')]&&_0xfa6008[_0xc008('0x6b')]['referer'];return db['CmContact'][_0xc008('0x71')]()[_0xc008('0x2b')](function(_0x773edd){if(!_0x773edd){throw new Error(_0xc008('0xa4'));}_0xff42e6=Object['keys'](_0x773edd)[_0xc008('0x59')](function(_0x22b653){return!['createdAt','updatedAt']['includes'](_0x22b653);});_0x567bfc=Object[_0xc008('0x61')](_0x773edd)['filter'](function(_0x3744e1){return!['createdAt',_0xc008('0xa5'),_0xc008('0xa6'),_0xc008('0xa7')][_0xc008('0xa8')](_0x3744e1);});if(!_['includes'](_0x567bfc,_0xfa6008['body'][_0xc008('0xa0')])){throw new APIBadRequestError(_0xc008('0xa9')+_0x567bfc[_0xc008('0x89')](',\x20'));}_0x438195[_0xfa6008['body'][_0xc008('0xa0')]]=_0xfa6008[_0xc008('0x6b')][_0xc008('0x9e')];})[_0xc008('0x2b')](function(){return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0xfa6008[_0xc008('0x60')]['id']},'include':[{'model':db[_0xc008('0xaa')],'as':_0xc008('0xab'),'include':[{'model':db[_0xc008('0xac')],'as':_0xc008('0xad'),'where':_0x438195,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xc008('0xae')],'as':'Applications'},{'model':db[_0xc008('0x9a')],'as':_0xc008('0x9a'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0xc008('0xaf')],'raw':!![]}]}]});})[_0xc008('0x2b')](function(_0x36af70){if(!_0x36af70){throw new APINotFoundError(util[_0xc008('0x3f')](_0xc008('0xb0'),_0xfa6008[_0xc008('0x60')]['id']));}if(_0x4c6cfa){return checkWebsiteInterval(_0x36af70);}return _0x36af70;})['then'](function(_0xdf5bb2){_0x4db69f[_0xc008('0xb1')]=_0xdf5bb2;_0x4db69f[_0xc008('0xb2')]=_['orderBy'](_0xdf5bb2[_0xc008('0xb3')],[_0xc008('0xb4')],[_0xc008('0xb5')]);if(_0x4db69f[_0xc008('0xb1')]['Applications']){delete _0x4db69f['account'][_0xc008('0xb3')];}_0x4db69f['list']=_0xdf5bb2[_0xc008('0xab')]||{'id':_0xdf5bb2[_0xc008('0xa7')]};if(_0x4db69f[_0xc008('0xb6')]&&_0x4db69f[_0xc008('0xb6')][_0xc008('0xad')]['length']){return _0x4db69f['list'][_0xc008('0xad')][0x0];}var _0x2d3fb4=_[_0xc008('0x11')](_0xfa6008[_0xc008('0x6b')],{'firstName':_0xfa6008[_0xc008('0x6b')][_0xc008('0x9e')],'ListId':_0xdf5bb2[_0xc008('0xa7')]});_0x2d3fb4[_0xfa6008['body'][_0xc008('0xa0')]]=_0xfa6008[_0xc008('0x6b')][_0xc008('0x9e')];return db[_0xc008('0xac')][_0xc008('0x65')](_0x2d3fb4,{'fields':_0xff42e6,'raw':!![]});})[_0xc008('0x2b')](function(_0x3af9d0){_0x4db69f[_0xc008('0xb7')]=_0x3af9d0;var _0x16f9e0=createInteractionObject(_0xfa6008[_0xc008('0x60')]['id'],_0xfa6008[_0xc008('0x6b')],_0xfa6008[_0xc008('0xb8')],_0x3af9d0);var _0x4e8fca={'ChatWebsiteId':_0xfa6008[_0xc008('0x60')]['id']};if(_0xfa6008[_0xc008('0x6b')]['threadId']){_0x4e8fca[_0xc008('0xb9')]=_0xfa6008[_0xc008('0x6b')][_0xc008('0xb9')];_0x4e8fca[_0xc008('0xba')]=![];return db[_0xc008('0xbb')][_0xc008('0x64')]({'where':_0x4e8fca})[_0xc008('0x2b')](function(_0x20fbb3){var _0x1859c1=_0xfa6008[_0xc008('0x6b')][_0xc008('0x34')]&&_0xfa6008['body'][_0xc008('0x3c')];if(_0x20fbb3){_0x5bfe83=!![];return _0x20fbb3;}else if(!_0x1859c1&&_0x20fbb3&&_0x20fbb3[_0xc008('0xba')]){throw new APIConflictError(_0xc008('0xbc'));}_0x16f9e0[_0xc008('0xb9')]=_0xfa6008[_0xc008('0x6b')][_0xc008('0xb9')];_0x16f9e0[_0xc008('0xbd')]=_0xfa6008[_0xc008('0x6b')][_0xc008('0xbd')];return db[_0xc008('0xbb')][_0xc008('0x65')](_0x16f9e0);});}_0x4e8fca[_0xc008('0xbe')]=_0x3af9d0['id'];if(_0xfa6008[_0xc008('0x6b')][_0xc008('0xbf')]&&_0xfa6008[_0xc008('0x6b')][_0xc008('0xbf')]['id']){_0x4e8fca['id']=_0xfa6008['body']['interaction']['id'];return db['ChatInteraction'][_0xc008('0x64')]({'where':_0x4e8fca})[_0xc008('0x2b')](function(_0x3f80f4){var _0x1397bd=_0xfa6008[_0xc008('0x6b')][_0xc008('0x34')]&&_0xfa6008[_0xc008('0x6b')]['referer'];if(!_0x1397bd&&_0x3f80f4&&_0x3f80f4[_0xc008('0xba')]){throw new APIConflictError('Writing\x20on\x20closed\x20interaction');}else if(_0x3f80f4){_0x5bfe83=!![];return _0x3f80f4;}else{return db['ChatInteraction'][_0xc008('0x65')](_0x16f9e0);}});}return db[_0xc008('0xbb')]['create'](_0x16f9e0);})[_0xc008('0x2b')](function(_0x37257d){if(!_0x5bfe83){return _0x37257d;}var _0x3dc75c={'from':(_0x4db69f['contact'][_0xc008('0x39')]||'')+'\x20'+(_0x4db69f[_0xc008('0xb7')][_0xc008('0x3a')]||'')};if(_0xfa6008['body'][_0xc008('0xb9')]&&_0xfa6008[_0xc008('0x6b')][_0xc008('0xc0')]&&_0xfa6008[_0xc008('0x6b')][_0xc008('0xb9')]!=_0xfa6008[_0xc008('0x6b')][_0xc008('0xc0')]){_0x3dc75c[_0xc008('0xb9')]=_0xfa6008['body'][_0xc008('0xc0')];}return _0x37257d[_0xc008('0x2a')](_0x3dc75c);})[_0xc008('0x2b')](function(_0x1b5f8c){_0x4db69f[_0xc008('0xbf')]=_0x1b5f8c['get']({'plain':!![]});_0x4db69f[_0xc008('0xbf')][_0xc008('0xc1')]=!_0x5bfe83;if(_0x4db69f[_0xc008('0xbf')][_0xc008('0xc1')]){if(_0x4db69f[_0xc008('0xb1')][_0xc008('0xc2')]){_0x4db69f[_0xc008('0xb2')][_0xc008('0xc3')]({'id':0x0,'priority':_0x4db69f['applications'][_0xc008('0x54')]+0x1,'app':_0xc008('0xc4'),'appdata':_0xc008('0xc5'),'interval':_0xc008('0xc6')});}}return db['ChatMessage']['create']({'body':_0xfa6008[_0xc008('0x6b')][_0xc008('0x6b')],'ChatWebsiteId':_0xfa6008['params']['id'],'ChatInteractionId':_0x1b5f8c['id'],'direction':'in','ContactId':_0x4db69f[_0xc008('0xb7')]['id'],'AttachmentId':_0xfa6008[_0xc008('0x6b')][_0xc008('0xc7')]});})[_0xc008('0x2b')](function(_0x2ecaff){_0x4db69f[_0xc008('0x1e')]=_0x2ecaff;if(!_0x4db69f[_0xc008('0xbf')]['UserId']){return;}return db['User'][_0xc008('0x64')]({'attributes':['id','name'],'where':{'id':_0x4db69f[_0xc008('0xbf')][_0xc008('0xc8')]}});})[_0xc008('0x2b')](function(_0x2ee321){if(_0x2ee321){_0x4db69f[_0xc008('0xb2')][_0xc008('0xc9')]({'id':0x0,'priority':0x0,'app':_0xc008('0xca'),'appdata':_0x2ee321[_0xc008('0x30')]+','+(_0x4db69f[_0xc008('0xb1')][_0xc008('0xcb')]||0xa),'interval':_0xc008('0xc6')});_0x4db69f['forcedOwnership']=!![];}if(!_0x4db69f[_0xc008('0xbf')][_0xc008('0xcc')]){return;}return db[_0xc008('0xcd')][_0xc008('0x64')]({'attributes':['id',_0xc008('0x30')],'where':{'id':_0x4db69f[_0xc008('0xbf')][_0xc008('0xcc')]}});})['then'](function(_0x43065b){if(_0x43065b){_0x4db69f[_0xc008('0xb2')][_0xc008('0xc9')]({'id':0x0,'priority':0x1,'app':'queue','appdata':_0x43065b[_0xc008('0x30')]+','+(_0x4db69f[_0xc008('0xb1')][_0xc008('0xce')]||0x12c),'interval':_0xc008('0xc6')});}return respondWithRpcPromise(_0xc008('0xcf'),_0xc008('0xd0'),_0x4db69f);})['then'](function(_0x501134){respondWithRpcPromise(_0xc008('0xd1'),_0xc008('0xd1'),{'event':_0xc008('0x9c'),'message':_0x501134},client9002);return _0x501134;})[_0xc008('0x2b')](respondWithResult(_0xdbe8ad,null))[_0xc008('0x1f')](APIHandleError(_0xdbe8ad));};exports['offline']=function(_0x7c1bf8,_0x569ac1){var _0x15cdd1,_0x8fde89,_0x59df96;var _0x1c348e=[];var _0xcae7ad={};var _0x214071=_0x7c1bf8[_0xc008('0xd2')]||[];var _0x499da6=[];var _0x348c42;return db[_0xc008('0xac')][_0xc008('0x71')]()[_0xc008('0x2b')](function(_0x157b26){if(!_0x157b26){throw new db['Sequelize'][(_0xc008('0xd3'))](_0xc008('0xd4'));}_0x1c348e=_[_0xc008('0xd5')](_['keys'](_0x157b26),[_0xc008('0xd6'),_0xc008('0xa5'),_0xc008('0xa6'),_0xc008('0xa7')]);if(_0x7c1bf8['body']['id']){delete _0x7c1bf8[_0xc008('0x6b')]['id'];}if(_[_0xc008('0x8d')](_0x7c1bf8[_0xc008('0x6b')][_0xc008('0x9e')])){throw _0x569ac1[_0xc008('0x21')](0x1f4)['send'](new db[(_0xc008('0xd7'))]['ValidationError']('from\x20is\x20mandatory'));}if(_[_0xc008('0x8d')](_0x7c1bf8['body'][_0xc008('0x6b')])||_0x7c1bf8[_0xc008('0x6b')][_0xc008('0x6b')]===''){throw _0x569ac1[_0xc008('0x21')](0x1f4)[_0xc008('0x31')](new db[(_0xc008('0xd7'))][(_0xc008('0xd3'))]('body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0xc008('0x8d')](_0x7c1bf8[_0xc008('0x6b')][_0xc008('0xd8')])){throw _0x569ac1[_0xc008('0x21')](0x1f4)[_0xc008('0x31')](new db[(_0xc008('0xd7'))]['ValidationError'](_0xc008('0xd9')+_0x1c348e));}if(!_[_0xc008('0xa8')](_0x1c348e,_0x7c1bf8[_0xc008('0x6b')][_0xc008('0xd8')])){throw _0x569ac1[_0xc008('0x21')](0x1f4)[_0xc008('0x31')](new db[(_0xc008('0xd7'))][(_0xc008('0xd3'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1c348e));}_0xcae7ad[_0x7c1bf8['body'][_0xc008('0xd8')]]=_0x7c1bf8[_0xc008('0x6b')]['from'];})[_0xc008('0x2b')](function(){return db['ChatWebsite'][_0xc008('0x64')]({'where':{'id':_0x7c1bf8[_0xc008('0x60')]['id']},'include':[{'model':db[_0xc008('0xaa')],'as':_0xc008('0xab')},{'model':db[_0xc008('0xda')],'as':_0xc008('0xda')}]});})[_0xc008('0x2b')](handleEntityNotFound(_0x569ac1,null))['then'](function(_0x286082){if(_0x286082&&_0x286082['List']){_0x8fde89=_0x286082;var _0x39924c=_[_0xc008('0x11')](_0x7c1bf8[_0xc008('0x6b')],{'firstName':_0x7c1bf8[_0xc008('0x6b')][_0xc008('0x9e')],'phone':_0x7c1bf8[_0xc008('0x6b')][_0xc008('0x9e')],'ListId':_0x286082['ListId']});_0x39924c[_0x7c1bf8[_0xc008('0x6b')][_0xc008('0xd8')]]=_0x7c1bf8['body'][_0xc008('0x9e')];return db[_0xc008('0xac')][_0xc008('0xdb')]({'where':_0xcae7ad,'defaults':_0x39924c});}})[_0xc008('0xdc')](function(_0x10f98a){if(_0x10f98a){_0x59df96=_0x10f98a;var _0x2ed7e0=fs['readFileSync'](path[_0xc008('0x89')](config[_0xc008('0x8e')],_0xc008('0xdd')),_0xc008('0xde'));var _0x47d263=ejs['render'](_0x2ed7e0,{'body':_['toPairs'](_0x7c1bf8[_0xc008('0x6b')][_0xc008('0x6b')]),'bodyTitle':_0x8fde89['offlineMessageBody']});return db['ChatOfflineMessage']['create']({'body':_0x47d263,'plainBody':htmlToText['fromString'](_0x47d263),'ContactId':_0x10f98a['id'],'ChatWebsiteId':_0x8fde89['id']});}})[_0xc008('0x2b')](function(_0x134ec8){_0x348c42=_0x134ec8;if(_0x214071['length']){var _0x43ef43=_0x214071[_0xc008('0x4e')](function(_0x9bd8e6){return{'name':_0x9bd8e6[_0xc008('0xdf')],'basename':_0x9bd8e6[_0xc008('0x80')],'type':_0x9bd8e6['mimetype'],'ChatOfflineMessageId':_0x134ec8['id']};});_0x499da6=_0x43ef43['map'](_0x197cfd=>{var _0xce5e90={'filename':_0x197cfd[_0xc008('0x30')],'path':path[_0xc008('0x89')](config[_0xc008('0x8e')],_0xc008('0xe0'),_0xc008('0xd2'),'attachments',_0xc008('0xe1'),_0x197cfd[_0xc008('0xe2')])};return _0xce5e90;});if(!_0x8fde89[_0xc008('0xe3')]){return db[_0xc008('0xe4')][_0xc008('0xe5')](function(_0x3bcf94){return db[_0xc008('0xe6')]['bulkCreate'](_0x43ef43,{'transaction':_0x3bcf94});});}}})['then'](function(){if(_0x348c42){_0x15cdd1=_0x348c42;return db[_0xc008('0xda')][_0xc008('0x75')]({'where':{'service':!![]},'include':[{'model':db[_0xc008('0xe7')],'as':_0xc008('0xe8'),'raw':!![],'include':[{'model':db[_0xc008('0xe9')],'as':_0xc008('0xe9'),'raw':!![]}]}]});}})[_0xc008('0x2b')](function(_0x3f9be3){if(_0x3f9be3&&_0x3f9be3[_0xc008('0xe8')]&&_0x8fde89[_0xc008('0xea')]&&_0x8fde89[_0xc008('0xeb')]){var _0x202826=_0x3f9be3[_0xc008('0xec')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0x202826,'message':{'from':util[_0xc008('0x3f')](_0xc008('0xed'),_0x3f9be3[_0xc008('0x30')],_0x3f9be3[_0xc008('0xee')]||_0x3f9be3[_0xc008('0xe8')][_0xc008('0x6c')]),'to':_0x8fde89[_0xc008('0xeb')],'subject':_0x8fde89['offlineMessageSubject'],'html':_0x15cdd1['body'],'attachments':_0x499da6}},client9003)['then'](function(){return _0x15cdd1;})[_0xc008('0x1f')](function(_0x4b7132){logger['error'](_0x4b7132);});}})['then'](function(){if(_0x8fde89&&_0x8fde89[_0xc008('0xe3')]&&_0x8fde89[_0xc008('0xef')]){var _0x8a1e6a=[];if(_0x214071[_0xc008('0x54')]){_0x8a1e6a=_0x214071[_0xc008('0x4e')](function(_0x3d427d){return{'name':_0x3d427d[_0xc008('0xdf')],'basename':_0x3d427d[_0xc008('0x80')],'type':_0x3d427d[_0xc008('0xf0')],'ChatOfflineMessageId':_0x348c42['id']};});}var _0xdcda1f;if(!_[_0xc008('0x8d')](_0x8fde89[_0xc008('0xf1')])){var _0x5065aa=_['map'](_0x7c1bf8[_0xc008('0x6b')],function(_0x6a87a7){return _0x6a87a7;});var _0xc55c88=_[_0xc008('0xf2')](_0x5065aa)[0x0];var _0x3935a2=_[_0xc008('0xf3')](_0xc55c88,function(_0xcdba52){return _0xcdba52;});_0xdcda1f=_0x3935a2[0x1][_0x8fde89[_0xc008('0xf1')]];}var _0x5adeeb={'from':_0x59df96[_0xc008('0xee')],'firstName':_0x59df96['firstName'],'lastName':_0x59df96['lastName'],'mapKey':'email','message':{'from':_0x59df96['email'],'to':_0x8fde89[_0xc008('0xda')]['email'],'cc':'','subject':_[_0xc008('0x8d')](_0xdcda1f)?_0x8fde89[_0xc008('0xf4')]:_0xdcda1f,'messageId':'','sentAt':new Date(),'attach':_0x8a1e6a[_0xc008('0x54')],'attachments':_0x8a1e6a,'originChannel':'Chat','ChatWebsiteId':_0x8fde89['id'],'ChatOfflineMessageId':_0x15cdd1['id'],'originTo':_0x8fde89['MailAccount'][_0xc008('0xee')]},'body':_0x15cdd1[_0xc008('0x6b')]};var _0x5e1141={'account':{'id':_0x8fde89[_0xc008('0xef')]},'body':_0x5adeeb,'log':_0xc008('0xf5')};return respondWithRpcPromise(_0xc008('0xf5'),_0xc008('0xf6'),_0x5e1141,client9001)[_0xc008('0x2b')](function(){return _0x15cdd1;})[_0xc008('0x1f')](function(_0x157664){logger[_0xc008('0x1c')](_0x157664);});}return;})[_0xc008('0x2b')](function(){if(_0x15cdd1){return _0x15cdd1;}})[_0xc008('0x2b')](respondWithResult(_0x569ac1,null))['catch'](function(){for(var _0x2392ac of _0x214071){var _0x17d146=path['join'](config['root'],_0xc008('0xe0'),_0xc008('0xd2'),_0xc008('0xf7'),'offline-chat',_0x2392ac['filename']);fs_extra['remove'](_0x17d146)['catch'](function(_0x97380b){logger[_0xc008('0x1c')](_0xc008('0xf8'),_0x17d146,_0x97380b);});}});};exports[_0xc008('0xf9')]=function(_0x43e343,_0xb24d64){return db[_0xc008('0xbb')]['find']({'where':{'id':_0x43e343[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0xb24d64,null))[_0xc008('0x2b')](function(_0x2ab8b1){if(_0x2ab8b1){return _0x2ab8b1[_0xc008('0xf9')](_0x43e343['body'][_0xc008('0x79')],_[_0xc008('0xfa')](_0x43e343['body'],[_0xc008('0x79'),'id'])||{});}})[_0xc008('0x2b')](respondWithResult(_0xb24d64,null))[_0xc008('0x1f')](handleError(_0xb24d64,null));};exports[_0xc008('0xfb')]=function(_0x5658f7,_0x1f2e30){var _0x4da239={'raw':![],'where':{}};var _0x188280={};var _0x1c048d={'count':0x0,'rows':[]};return db[_0xc008('0x5d')][_0xc008('0x75')]({'where':{'id':_0x5658f7[_0xc008('0x60')]['id']}})['then'](handleEntityNotFound(_0x1f2e30,null))[_0xc008('0x2b')](function(_0x168e28){if(_0x168e28){_0x188280[_0xc008('0x43')]=_[_0xc008('0x61')](db['ChatInteraction'][_0xc008('0x4b')]);_0x188280['query']=_['keys'](_0x5658f7[_0xc008('0x53')]);_0x188280[_0xc008('0x4f')]=_[_0xc008('0x50')](_0x188280['model'],_0x188280[_0xc008('0x53')]);_0x4da239[_0xc008('0x51')]=_['intersection'](_0x188280[_0xc008('0x43')],qs[_0xc008('0x52')](_0x5658f7['query']['fields']));_0x4da239[_0xc008('0x51')]=_0x4da239['attributes']['length']?_0x4da239[_0xc008('0x51')]:_0x188280['model'];if(!_0x5658f7[_0xc008('0x53')][_0xc008('0x55')](_0xc008('0x76'))){_0x4da239[_0xc008('0x25')]=qs[_0xc008('0x25')](_0x5658f7['query']['limit']);_0x4da239[_0xc008('0x23')]=qs['offset'](_0x5658f7[_0xc008('0x53')]['offset']);}_0x4da239['order']=qs['sort'](_0x5658f7[_0xc008('0x53')]['sort']);_0x4da239[_0xc008('0x5a')]=qs[_0xc008('0x4f')](_['pick'](_0x5658f7['query'],_0x188280[_0xc008('0x4f')]));_0x4da239[_0xc008('0x5a')][_0xc008('0x73')]=_0x168e28['id'];if(_0x5658f7[_0xc008('0x53')]['filter']){_0x4da239['where']=_[_0xc008('0x5b')](_0x4da239['where'],{'$or':_['map'](_0x4da239[_0xc008('0x51')],function(_0x3f8bdf){var _0x4bbe91={};_0x4bbe91[_0x3f8bdf]={'$like':'%'+_0x5658f7['query']['filter']+'%'};return _0x4bbe91;})});}_0x4da239=_[_0xc008('0x5b')]({},_0x4da239,_0x5658f7['options']);return db[_0xc008('0xbb')][_0xc008('0x26')]({'where':_0x4da239[_0xc008('0x5a')]})[_0xc008('0x2b')](function(_0x1007b2){_0x1c048d['count']=_0x1007b2;if(_0x5658f7['query'][_0xc008('0x62')]){_0x4da239[_0xc008('0x63')]=[{'model':db[_0xc008('0xac')],'as':_0xc008('0xfc'),'required':![]},{'model':db[_0xc008('0xfd')],'as':_0xc008('0xfe'),'attributes':[_0xc008('0x30'),_0xc008('0xff'),_0xc008('0x100')],'required':![]},{'model':db[_0xc008('0x101')],'as':_0xc008('0x102'),'attributes':['id',_0xc008('0x30'),'color'],'where':_0x5658f7[_0xc008('0x53')][_0xc008('0x103')]?{'id':_0x5658f7[_0xc008('0x53')][_0xc008('0x103')]}:undefined,'required':_0x5658f7['query'][_0xc008('0x103')]?!![]:![]}];}return db[_0xc008('0xbb')][_0xc008('0x5e')](_0x4da239);})[_0xc008('0x2b')](function(_0x122084){_0x1c048d[_0xc008('0x77')]=_0x122084;return _0x1c048d;});}})[_0xc008('0x2b')](respondWithFilteredResult(_0x1f2e30,_0x4da239))[_0xc008('0x1f')](handleError(_0x1f2e30,null));};exports['getSnippet']=function(_0x31d1ac,_0x258ede){var _0x1e8036=0x0;var _0x2c9336=0x0;var _0x30d36a=![];var _0x3ed6eb;var _0x3640b0;return db['ChatWebsite'][_0xc008('0x64')]({'where':{'id':_0x31d1ac['params']['id']},'include':[{'model':db[_0xc008('0x9a')],'as':_0xc008('0x9a'),'include':[{'model':db[_0xc008('0x9a')],'as':_0xc008('0x104'),'attributes':['id',_0xc008('0xaf')]}]}]})[_0xc008('0x2b')](handleEntityNotFound(_0x258ede,null))[_0xc008('0x2b')](function(_0x22a459){if(_0x22a459){_0x3ed6eb=_0x22a459;return _0x22a459[_0xc008('0x105')]({'raw':!![]});}})[_0xc008('0x2b')](function(_0x4fae34){if(_0x3ed6eb){if(_0x4fae34){_0x3640b0=_0x4fae34;}}return require(_0xc008('0x8b'))[_0xc008('0x106')]();})[_0xc008('0x2b')](function(_0x1ddd81){if(_0x1ddd81){_0x2c9336=_0x1ddd81[_0xc008('0x107')];_0x30d36a=_0x1ddd81[_0xc008('0x8c')];}})[_0xc008('0x2b')](function(){return db[_0xc008('0xbb')][_0xc008('0x26')]({'where':{'closed':![]}});})[_0xc008('0x2b')](function(_0x471618){_0x1e8036=_0x471618;if(_0x2c9336&&_0x471618>_0x2c9336){return db[_0xc008('0x108')][_0xc008('0x75')]({'where':{'id':0x1}})['then'](function(_0xd48308){if(_0xd48308){_0xd48308['increment'](_0xc008('0x109'));}});}})[_0xc008('0x2b')](function(){var _0x40e3b0=_0x3ed6eb[_0xc008('0x9a')];var _0x370234=_0x3ed6eb[_0xc008('0x10a')]||undefined;return _0x40e3b0?_0x40e3b0['ifTime'](_0x370234):!![];})[_0xc008('0x2b')](function(_0x34cbce){var _0x337acd=fs['readFileSync'](path['join'](config['root'],_0xc008('0x10b')),_0xc008('0xde'));var _0x2ccfcf=_0xc008('0x10c');var _0x2685f0=![];var _0x3f4588,_0x1ffb27;if(_0x31d1ac['headers'][_0xc008('0x3c')]){_0x3f4588=new URL(_0x31d1ac[_0xc008('0xb8')][_0xc008('0x3c')])[_0xc008('0x10d')];}else if(_0x31d1ac[_0xc008('0xb8')]['origin']){_0x3f4588=new URL(_0x31d1ac[_0xc008('0xb8')][_0xc008('0x10d')])[_0xc008('0x10d')];}else{_0x3f4588=_0xc008('0x10e');}_0x1ffb27=typeof _0x3ed6eb[_0xc008('0x66')][_0xc008('0x38')](',')[_0xc008('0x64')](function(_0x3485a3){return wildcardUtils[_0xc008('0x10f')](_0x3485a3,_0x3f4588);})!==_0xc008('0x24');var _0x5fa4bf={'chatVersion':_0x2ccfcf,'chatWebsiteAddressOrigin':_0x1ffb27?_0x3f4588:_0x3ed6eb['address'],'remote':_0x3ed6eb[_0xc008('0x110')],'query':querystring['stringify'](_[_0xc008('0x5b')](_0x3ed6eb[_0xc008('0x2d')]({'plain':!![]}),{'customerIp':_0x31d1ac[_0xc008('0xb8')]['x-forwarded-for']||_0x31d1ac[_0xc008('0xb8')]['x-real-ip']||_0x31d1ac[_0xc008('0x111')][_0xc008('0x112')]||_0x31d1ac['ip'],'referer':_0x31d1ac[_0xc008('0xb8')][_0xc008('0x3c')],'openedInteractions':_0x1e8036,'maxInteractions':_0x2c9336,'virtual':_0x30d36a[_0xc008('0x107')],'online':_0x34cbce,'custom':_0x30d36a,'address':_0x1ffb27?_0x3f4588:null}))[_0xc008('0x113')](/'/g,'\x5c\x27')};_0x258ede[_0xc008('0x31')](ejs[_0xc008('0x114')](Mustache[_0xc008('0x114')](_0x337acd,_0x5fa4bf),{'proactiveActions':_0x3640b0,'alignment':_0x3ed6eb[_0xc008('0x115')],'verticalAlignment':_0x3ed6eb['verticalAlignment'],'div_color':_0x3ed6eb[_0xc008('0x116')],'labelText':_0x3ed6eb['labelText'],'text_color':_0x3ed6eb['textColor'],'text_button_color':_0x3ed6eb[_0xc008('0x117')],'button_color':_0x3ed6eb['color_button'],'background_color':_0x3ed6eb[_0xc008('0x118')],'hideWhenOffline':_0x3ed6eb[_0xc008('0x119')],'intervalId':_0x3ed6eb[_0xc008('0x11a')],'isDevelopment':_0x2685f0,'chatVersion':_0x2ccfcf}));})[_0xc008('0x1f')](handleError(_0x258ede,null));};exports['addApplications']=function(_0x20b0f6,_0x210db6){var _0x104afd=_0x20b0f6[_0xc008('0x60')]['id'];var _0xc5b3de=_0x20b0f6['body'];var _0x2b9571=0xc8;var _0x26022c=null;return db['sequelize'][_0xc008('0xe5')]({'isolationLevel':db[_0xc008('0xe4')][_0xc008('0x11b')][_0xc008('0x11c')][_0xc008('0x11d')]},function(_0x3b46db){return db['ChatWebsite'][_0xc008('0x75')]({'where':{'id':_0x104afd},'transaction':_0x3b46db})[_0xc008('0x2b')](function(_0x2566aa){if(_0x2566aa){return db[_0xc008('0xae')][_0xc008('0x2c')]({'where':{'ChatWebsiteId':_0x104afd},'transaction':_0x3b46db})[_0xc008('0x2b')](function(){var _0x113151=_[_0xc008('0x4e')](_0xc5b3de,function(_0x2d2362){_0x2d2362[_0xc008('0x73')]=_0x104afd;return _0x2d2362;});return db['ChatApplication'][_0xc008('0x11e')](_0x113151,{'transaction':_0x3b46db});});}else{_0x2b9571=0x194;_0x26022c=[];}});})[_0xc008('0x2b')](function(){if(_0x2b9571!==0x194){return db[_0xc008('0xae')][_0xc008('0x11f')]({'where':{'ChatWebsiteId':_0x104afd},'order':'priority'})[_0xc008('0x2b')](function(_0x1838e3){_0x26022c=_0x1838e3;});}})[_0xc008('0x1f')](function(_0x360b5b){_0x2b9571=0x1f4;logger[_0xc008('0x1c')](_0x360b5b[_0xc008('0x120')]);if(_0x360b5b[_0xc008('0x30')]){delete _0x360b5b[_0xc008('0x30')];}_0x26022c=_0x360b5b;})[_0xc008('0x121')](function(){if(_0x26022c===null){_0x210db6[_0xc008('0x20')](_0x2b9571);}else{if(_0x2b9571===0x1f4){_0x210db6[_0xc008('0x21')](_0x2b9571)[_0xc008('0x31')](_0x26022c);}else{_0x210db6[_0xc008('0x21')](_0x2b9571)[_0xc008('0x29')](_0x26022c);}}});};exports['getApplications']=function(_0x2a2bc6,_0x33545e){var _0x3e3f3b={};var _0xbc2c57={};var _0x202896;var _0x4f46d7;return db[_0xc008('0x5d')][_0xc008('0x75')]({'where':{'id':_0x2a2bc6['params']['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x33545e,null))[_0xc008('0x2b')](function(_0x552498){if(_0x552498){_0x202896=_0x552498;_0xbc2c57['model']=_['keys'](db['ChatApplication'][_0xc008('0x4b')]);_0xbc2c57['query']=_['keys'](_0x2a2bc6[_0xc008('0x53')]);_0xbc2c57[_0xc008('0x4f')]=_[_0xc008('0x50')](_0xbc2c57['model'],_0xbc2c57['query']);_0x3e3f3b[_0xc008('0x51')]=_[_0xc008('0x50')](_0xbc2c57[_0xc008('0x43')],qs[_0xc008('0x52')](_0x2a2bc6['query'][_0xc008('0x52')]));_0x3e3f3b[_0xc008('0x51')]=_0x3e3f3b['attributes'][_0xc008('0x54')]?_0x3e3f3b['attributes']:_0xbc2c57['model'];_0x3e3f3b[_0xc008('0x56')]=qs[_0xc008('0x57')](_0x2a2bc6['query']['sort']);_0x3e3f3b[_0xc008('0x5a')]=qs[_0xc008('0x4f')](_['pick'](_0x2a2bc6[_0xc008('0x53')],_0xbc2c57['filters']));if(_0x2a2bc6[_0xc008('0x53')][_0xc008('0x59')]){_0x3e3f3b[_0xc008('0x5a')]=_[_0xc008('0x5b')](_0x3e3f3b[_0xc008('0x5a')],{'$or':_[_0xc008('0x4e')](_0x3e3f3b[_0xc008('0x51')],function(_0x41a8a6){var _0x502352={};_0x502352[_0x41a8a6]={'$like':'%'+_0x2a2bc6[_0xc008('0x53')]['filter']+'%'};return _0x502352;})});}_0x3e3f3b=_[_0xc008('0x5b')]({},_0x3e3f3b,_0x2a2bc6['options']);return _0x202896['getApplications'](_0x3e3f3b);}})[_0xc008('0x2b')](function(_0x52e7d2){if(_0x52e7d2){_0x4f46d7=_0x52e7d2[_0xc008('0x54')];if(!_0x2a2bc6[_0xc008('0x53')][_0xc008('0x55')]('nolimit')){_0x3e3f3b['limit']=qs[_0xc008('0x25')](_0x2a2bc6[_0xc008('0x53')]['limit']);_0x3e3f3b['offset']=qs[_0xc008('0x23')](_0x2a2bc6[_0xc008('0x53')][_0xc008('0x23')]);}return _0x202896[_0xc008('0x122')](_0x3e3f3b);}})[_0xc008('0x2b')](function(_0x1ddfca){if(_0x1ddfca){return _0x1ddfca?{'count':_0x4f46d7,'rows':_0x1ddfca}:null;}})[_0xc008('0x2b')](respondWithResult(_0x33545e,null))[_0xc008('0x1f')](handleError(_0x33545e,null));};exports['addProactiveActions']=function(_0x24757f,_0x107fdc){return db['chatProactiveAction'][_0xc008('0x64')]({'where':{'id':_0x24757f[_0xc008('0x60')]['id']}})['then'](handleEntityNotFound(_0x107fdc,null))[_0xc008('0x2b')](function(_0x5be0f8){if(_0x5be0f8){return _0x5be0f8[_0xc008('0x123')](_0x24757f['body'][_0xc008('0x79')],_[_0xc008('0xfa')](_0x24757f['body'],[_0xc008('0x79'),'id'])||{});}})['then'](respondWithResult(_0x107fdc,null))[_0xc008('0x1f')](handleError(_0x107fdc,null));};exports[_0xc008('0x105')]=function(_0x25969f,_0x34d4c0){var _0x1483bd={};var _0x2bf125={};var _0x384e8a;var _0x1b4a2f;return db[_0xc008('0x5d')]['findOne']({'where':{'id':_0x25969f[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x34d4c0,null))[_0xc008('0x2b')](function(_0x22de7a){if(_0x22de7a){_0x384e8a=_0x22de7a;_0x2bf125[_0xc008('0x43')]=_['keys'](db[_0xc008('0x124')][_0xc008('0x4b')]);_0x2bf125[_0xc008('0x53')]=_[_0xc008('0x61')](_0x25969f[_0xc008('0x53')]);_0x2bf125[_0xc008('0x4f')]=_[_0xc008('0x50')](_0x2bf125[_0xc008('0x43')],_0x2bf125[_0xc008('0x53')]);_0x1483bd[_0xc008('0x51')]=_[_0xc008('0x50')](_0x2bf125[_0xc008('0x43')],qs[_0xc008('0x52')](_0x25969f[_0xc008('0x53')][_0xc008('0x52')]));_0x1483bd[_0xc008('0x51')]=_0x1483bd['attributes'][_0xc008('0x54')]?_0x1483bd[_0xc008('0x51')]:_0x2bf125[_0xc008('0x43')];_0x1483bd[_0xc008('0x56')]=qs[_0xc008('0x57')](_0x25969f[_0xc008('0x53')][_0xc008('0x57')]);_0x1483bd[_0xc008('0x5a')]=qs[_0xc008('0x4f')](_[_0xc008('0x58')](_0x25969f['query'],_0x2bf125[_0xc008('0x4f')]));if(_0x25969f[_0xc008('0x53')]['filter']){_0x1483bd[_0xc008('0x5a')]=_[_0xc008('0x5b')](_0x1483bd['where'],{'$or':_[_0xc008('0x4e')](_0x1483bd[_0xc008('0x51')],function(_0x2f24f7){var _0x460313={};_0x460313[_0x2f24f7]={'$like':'%'+_0x25969f[_0xc008('0x53')][_0xc008('0x59')]+'%'};return _0x460313;})});}_0x1483bd=_['merge']({},_0x1483bd,_0x25969f[_0xc008('0x5c')]);return _0x384e8a[_0xc008('0x105')](_0x1483bd);}})[_0xc008('0x2b')](function(_0x16fa87){if(_0x16fa87){_0x1b4a2f=_0x16fa87[_0xc008('0x54')];if(!_0x25969f['query'][_0xc008('0x55')](_0xc008('0x76'))){_0x1483bd[_0xc008('0x25')]=qs[_0xc008('0x25')](_0x25969f[_0xc008('0x53')][_0xc008('0x25')]);_0x1483bd[_0xc008('0x23')]=qs[_0xc008('0x23')](_0x25969f[_0xc008('0x53')][_0xc008('0x23')]);}return _0x384e8a[_0xc008('0x105')](_0x1483bd);}})[_0xc008('0x2b')](function(_0xd6b32d){if(_0xd6b32d){return _0xd6b32d?{'count':_0x1b4a2f,'rows':_0xd6b32d}:null;}})[_0xc008('0x2b')](respondWithResult(_0x34d4c0,null))[_0xc008('0x1f')](handleError(_0x34d4c0,null));};exports[_0xc008('0x125')]=function(_0x15422f,_0x252e57){var _0x5ce6cf=_0x15422f['query']['online']===_0xc008('0x126')?_0xc008('0x127'):_0xc008('0x128');return db[_0xc008('0x5d')][_0xc008('0x64')]({'attributes':['id',_0x5ce6cf],'where':{'id':_0x15422f[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x252e57,null))[_0xc008('0x2b')](function(_0x56c009){if(_0x56c009){var _0x192e7a=_0x56c009[_0x5ce6cf];var _0x2918fa=_0x192e7a&&_0x192e7a[_0xc008('0x129')]?_0x192e7a[_0xc008('0x129')]:[];_0x252e57[_0xc008('0x31')]({'fromKey':_[_0xc008('0x8d')](_0x192e7a['fromKey'])?undefined:_0x192e7a['fromKey'],'count':_0x2918fa['length'],'rows':_0x2918fa});}})[_0xc008('0x1f')](handleError(_0x252e57,null));};exports[_0xc008('0x12a')]=function(_0x5708a7,_0x5d46ce){var _0x22a2b0={'raw':![],'where':{}};var _0x256cb0={};var _0x2f36f6={'count':0x0,'rows':[]};return db[_0xc008('0x5d')][_0xc008('0x75')]({'where':{'id':_0x5708a7['params']['id']}})['then'](handleEntityNotFound(_0x5d46ce,null))[_0xc008('0x2b')](function(_0x8c41c8){if(_0x8c41c8){_0x256cb0[_0xc008('0x43')]=_['keys'](db[_0xc008('0x12b')][_0xc008('0x4b')]);_0x256cb0[_0xc008('0x53')]=_[_0xc008('0x61')](_0x5708a7[_0xc008('0x53')]);_0x256cb0[_0xc008('0x4f')]=_[_0xc008('0x50')](_0x256cb0['model'],_0x256cb0['query']);_0x22a2b0[_0xc008('0x51')]=_[_0xc008('0x50')](_0x256cb0[_0xc008('0x43')],qs[_0xc008('0x52')](_0x5708a7[_0xc008('0x53')]['fields']));_0x22a2b0[_0xc008('0x51')]=_0x22a2b0['attributes']['length']?_0x22a2b0[_0xc008('0x51')]:_0x256cb0['model'];if(!_0x5708a7[_0xc008('0x53')]['hasOwnProperty']('nolimit')){_0x22a2b0['limit']=qs[_0xc008('0x25')](_0x5708a7['query'][_0xc008('0x25')]);_0x22a2b0[_0xc008('0x23')]=qs['offset'](_0x5708a7[_0xc008('0x53')][_0xc008('0x23')]);}_0x22a2b0[_0xc008('0x56')]=qs[_0xc008('0x57')](_0x5708a7['query']['sort']);_0x22a2b0[_0xc008('0x5a')]=qs[_0xc008('0x4f')](_[_0xc008('0x58')](_0x5708a7[_0xc008('0x53')],_0x256cb0['filters']));_0x22a2b0[_0xc008('0x5a')]['ChatWebsiteId']=_0x8c41c8['id'];if(_0x5708a7[_0xc008('0x53')][_0xc008('0x59')]){_0x22a2b0[_0xc008('0x5a')]=_[_0xc008('0x5b')](_0x22a2b0['where'],{'$or':_['map'](_0x22a2b0[_0xc008('0x51')],function(_0x32b85b){var _0x191a25={};_0x191a25[_0x32b85b]={'$like':'%'+_0x5708a7['query'][_0xc008('0x59')]+'%'};return _0x191a25;})});}_0x22a2b0=_[_0xc008('0x5b')]({},_0x22a2b0,_0x5708a7[_0xc008('0x5c')]);return db[_0xc008('0x12b')][_0xc008('0x26')]({'where':_0x22a2b0['where']})['then'](function(_0x1bbbe6){_0x2f36f6[_0xc008('0x26')]=_0x1bbbe6;if(_0x5708a7[_0xc008('0x53')][_0xc008('0x62')]){_0x22a2b0[_0xc008('0x63')]=[{'all':!![]}];}else{_0x22a2b0[_0xc008('0x63')]=[{'model':db[_0xc008('0xac')],'as':_0xc008('0xfc'),'required':![]},{'model':db[_0xc008('0xe6')],'as':_0xc008('0x12c'),'required':![]}];}return db[_0xc008('0x12b')][_0xc008('0x5e')](_0x22a2b0);})[_0xc008('0x2b')](function(_0x23d0db){_0x2f36f6[_0xc008('0x77')]=_0x23d0db;return _0x2f36f6;});}})[_0xc008('0x2b')](respondWithFilteredResult(_0x5d46ce,_0x22a2b0))['catch'](handleError(_0x5d46ce,null));};exports[_0xc008('0x12d')]=function(_0x651201,_0x1a363a){return db['ChatWebsite'][_0xc008('0x64')]({'where':{'id':_0x651201[_0xc008('0x60')]['id']}})['then'](handleEntityNotFound(_0x1a363a,null))[_0xc008('0x2b')](function(_0x4b002f){if(_0x4b002f){return _0x4b002f[_0xc008('0x12d')](_0x651201[_0xc008('0x6b')][_0xc008('0x79')],_[_0xc008('0xfa')](_0x651201[_0xc008('0x6b')],[_0xc008('0x79'),'id'])||{})['spread'](function(_0x2f0c37){for(var _0x893638=0x0;_0x893638<_0x651201[_0xc008('0x6b')][_0xc008('0x79')][_0xc008('0x54')];_0x893638+=0x1){socket[_0xc008('0x12e')](_0xc008('0x12f'),{'UserId':Number(_0x651201[_0xc008('0x6b')][_0xc008('0x79')][_0x893638]),'ChatWebsiteId':Number(_0x651201['params']['id'])});}return _0x2f0c37;});}})[_0xc008('0x2b')](respondWithResult(_0x1a363a,null))[_0xc008('0x1f')](handleError(_0x1a363a,null));};exports[_0xc008('0x130')]=function(_0x53153b,_0x198ae4){return db[_0xc008('0x5d')][_0xc008('0x64')]({'where':{'id':_0x53153b[_0xc008('0x60')]['id']}})['then'](handleEntityNotFound(_0x198ae4,null))['then'](function(_0x293ec3){if(_0x293ec3){return _0x293ec3[_0xc008('0x130')](_0x53153b['query'][_0xc008('0x79')])['then'](function(){if(_[_0xc008('0x131')](_0x53153b['query'][_0xc008('0x79')])){for(var _0x4b1c77=0x0;_0x4b1c77<_0x53153b[_0xc008('0x53')][_0xc008('0x79')][_0xc008('0x54')];_0x4b1c77+=0x1){socket[_0xc008('0x12e')](_0xc008('0x132'),{'UserId':Number(_0x53153b[_0xc008('0x53')]['ids'][_0x4b1c77]),'ChatWebsiteId':Number(_0x53153b['params']['id'])});}}else{socket[_0xc008('0x12e')](_0xc008('0x132'),{'UserId':Number(_0x53153b['query']['ids']),'ChatWebsiteId':Number(_0x53153b['params']['id'])});}});}})[_0xc008('0x2b')](respondWithStatusCode(_0x198ae4,null))[_0xc008('0x1f')](handleError(_0x198ae4,null));};exports[_0xc008('0x133')]=function(_0x3ed206,_0x9a4217){var _0x141500={};var _0x5619f1={};var _0x5373db;var _0x2fae6e;return db[_0xc008('0x5d')][_0xc008('0x75')]({'where':{'id':_0x3ed206[_0xc008('0x60')]['id']}})[_0xc008('0x2b')](handleEntityNotFound(_0x9a4217,null))['then'](function(_0x275df7){if(_0x275df7){_0x5373db=_0x275df7;_0x5619f1[_0xc008('0x43')]=_['keys'](db[_0xc008('0xfd')][_0xc008('0x4b')]);_0x5619f1[_0xc008('0x53')]=_[_0xc008('0x61')](_0x3ed206[_0xc008('0x53')]);_0x5619f1['filters']=_[_0xc008('0x50')](_0x5619f1[_0xc008('0x43')],_0x5619f1['query']);_0x141500[_0xc008('0x51')]=_[_0xc008('0x50')](_0x5619f1['model'],qs[_0xc008('0x52')](_0x3ed206[_0xc008('0x53')][_0xc008('0x52')]));_0x141500['attributes']=_0x141500[_0xc008('0x51')][_0xc008('0x54')]?_0x141500[_0xc008('0x51')]:_0x5619f1[_0xc008('0x43')];_0x141500[_0xc008('0x56')]=qs[_0xc008('0x57')](_0x3ed206[_0xc008('0x53')][_0xc008('0x57')]);_0x141500['where']=qs[_0xc008('0x4f')](_[_0xc008('0x58')](_0x3ed206[_0xc008('0x53')],_0x5619f1[_0xc008('0x4f')]));if(_0x3ed206['query'][_0xc008('0x59')]){_0x141500['where']=_['merge'](_0x141500[_0xc008('0x5a')],{'$or':_['map'](_0x141500[_0xc008('0x51')],function(_0x1ca910){var _0x3385db={};_0x3385db[_0x1ca910]={'$like':'%'+_0x3ed206[_0xc008('0x53')][_0xc008('0x59')]+'%'};return _0x3385db;})});}_0x141500=_['merge']({},_0x141500,_0x3ed206[_0xc008('0x5c')]);return _0x5373db[_0xc008('0x133')](_0x141500);}})[_0xc008('0x2b')](function(_0x53e845){if(_0x53e845){_0x2fae6e=_0x53e845[_0xc008('0x54')];if(!_0x3ed206[_0xc008('0x53')][_0xc008('0x55')](_0xc008('0x76'))){_0x141500['limit']=qs[_0xc008('0x25')](_0x3ed206[_0xc008('0x53')][_0xc008('0x25')]);_0x141500[_0xc008('0x23')]=qs['offset'](_0x3ed206[_0xc008('0x53')][_0xc008('0x23')]);}return _0x5373db['getAgents'](_0x141500);}})[_0xc008('0x2b')](function(_0x59ef4a){if(_0x59ef4a){return _0x59ef4a?{'count':_0x2fae6e,'rows':_0x59ef4a}:null;}})['then'](respondWithResult(_0x9a4217,null))['catch'](handleError(_0x9a4217,null));}; \ No newline at end of file +var _0xcb81=['address','remote','x-real-ip','connection','virtual','replace','render','alignment','verticalAlignment','labelText','textColor','textButtonColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','READ_COMMITTED','finally','getApplications','chatProactiveAction','ChatProactiveAction','getFields','false','onlineForm','items','fromKey','Attachments','addAgents','userChatWebsite:save','removeAgents','isArray','emit','userChatWebsite:remove','getAgents','User','mustache','util','ejs','html-to-text','ioredis','jayson/promise','../../components/parsers/qs','../../config/logger','../../config/environment','../../errors/api','APINotFoundError','APIConflictError','./helpers/wildcard-expressions','url','URL','../../mysqldb','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','client','http','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','undefined','limit','count','offset','Content-Range','json','update','get','destroy','stack','name','send','user-agent-parser','setUA','user-agent','customerIp','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','referer','browser','version','format','%s\x20%s','unknown','device','model','vendor','type','index','Pause','map','ChatWebsite','rawAttributes','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','findAll','rows','show','params','mandatoryDispositionPause','includeAll','include','find','body','trim','testWildcardValidity','\x22\x20is\x20not\x20a\x20valid\x20wildcard\x20expression','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','describe','getDispositions','findOne','Disposition','nolimit','pick','ChatWebsiteId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addLogo','sitepic','addAvatar','agentAvatar','file','filename','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','join','server/files/images/logos/default_logo.svg','../../config/license/util','custom','isNil','existsSync','root','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','timezone','notify','chat','from','From\x20is\x20mandatory','mapKey','isEmpty','Body\x20is\x20mandatory','CmContact','createdAt','includes','updatedAt','ListId','Invalid\x20MapKey\x20parameter.\x20Allowed\x20values:\x20','Contacts','DESC','ChatApplication','Applications','Interval','interval','Chat\x20Website\x20with\x20id\x20%s\x20not\x20found','account','orderBy','priority','asc','List','list','contact','headers','threadId','ChatInteraction','Writing\x20on\x20closed\x20interaction','externalUrl','ContactId','interaction','closed','messageId','created','autoclose','applications','push','close','unmanaged','*,*,*,*','AttachmentId','UserId','agent','waitForTheAssignedAgent','queueId','queue','waitForTheAssignedQueue','startRouting','EventManager','offline','Sequelize','ValidationError','no\x20available\x20attributes','difference','CompanyId','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','spread','server/files/templates/chatOfflineMessage.ejs','utf8','toPairs','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','files','attachments','offline-chat','basename','openNewInteraction','transaction','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOffline','getSmtpOptions','sendMail','\x22%s\x22\x20<%s>','forwardOfflineAddress','offlineMessageSubject','MailAccountId','subjectOffline','toPairsIn','email','Chat','NotifyMailAccount','notifyMail','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','getInteractions','Owner','Tag','Tags','color','tag','getSnippet','getProactiveActions','getLicense','License','increment','3.10.1','origin','http://localhost:9000'];(function(_0x54395b,_0x51babb){var _0x199c87=function(_0x3e7bd8){while(--_0x3e7bd8){_0x54395b['push'](_0x54395b['shift']());}};_0x199c87(++_0x51babb);}(_0xcb81,0x154));var _0x1cb8=function(_0x202c61,_0x3673e0){_0x202c61=_0x202c61-0x0;var _0x540691=_0xcb81[_0x202c61];return _0x540691;};'use strict';var Mustache=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var path=require('path');var ejs=require(_0x1cb8('0x2'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var querystring=require('querystring');var htmlToText=require(_0x1cb8('0x3'));var Redis=require(_0x1cb8('0x4'));var jayson=require(_0x1cb8('0x5'));var qs=require(_0x1cb8('0x6'));var logger=require(_0x1cb8('0x7'))('api');var config=require(_0x1cb8('0x8'));var APIBadRequestError=require(_0x1cb8('0x9'))['APIBadRequestError'];var APINotFoundError=require(_0x1cb8('0x9'))[_0x1cb8('0xa')];var APIOutOfIntervalError=require(_0x1cb8('0x9'))['APIOutOfIntervalError'];var APIHandleError=require(_0x1cb8('0x9'))['handleError'];var APIConflictError=require('../../errors/api')[_0x1cb8('0xb')];var wildcardUtils=require(_0x1cb8('0xc'));var URL=require(_0x1cb8('0xd'))[_0x1cb8('0xe')];var db=require(_0x1cb8('0xf'))['db'];config[_0x1cb8('0x10')]=_[_0x1cb8('0x11')](config[_0x1cb8('0x10')],{'host':'localhost','port':0x18eb});var socket=require(_0x1cb8('0x12'))(new Redis(config[_0x1cb8('0x10')]));require(_0x1cb8('0x13'))[_0x1cb8('0x14')](socket);var client=jayson[_0x1cb8('0x15')]['http']({'port':0x232c});var client9002=jayson[_0x1cb8('0x15')][_0x1cb8('0x16')]({'port':0x232a});var client9003=jayson[_0x1cb8('0x15')][_0x1cb8('0x16')]({'port':0x232b});var client9001=jayson[_0x1cb8('0x15')][_0x1cb8('0x16')]({'port':0x2329});function respondWithRpcPromise(_0x339ad0,_0x243930,_0x5af4a3,_0x17a95d){return new Promise(function(_0x4b4917,_0xf6b347){var _0x28b8ff=_0x17a95d||client;return _0x28b8ff[_0x1cb8('0x17')](_0x339ad0,_0x5af4a3)[_0x1cb8('0x18')](function(_0x2635a8){logger[_0x1cb8('0x19')](_0x1cb8('0x1a'),_0x243930,_0x1cb8('0x1b'));logger[_0x1cb8('0x1c')](_0x1cb8('0x1d'),_0x243930,_0x1cb8('0x1b'),JSON[_0x1cb8('0x1e')](_0x2635a8));if(_0x2635a8['error']){if(_0x2635a8[_0x1cb8('0x1f')][_0x1cb8('0x20')]===0x1f4){logger[_0x1cb8('0x1f')](_0x1cb8('0x1a'),_0x243930,_0x2635a8['error'][_0x1cb8('0x21')]);return _0xf6b347(_0x2635a8['error'][_0x1cb8('0x21')]);}logger[_0x1cb8('0x1f')](_0x1cb8('0x1a'),_0x243930,_0x2635a8[_0x1cb8('0x1f')]['message']);return _0x4b4917(_0x2635a8['error'][_0x1cb8('0x21')]);}else{logger[_0x1cb8('0x19')](_0x1cb8('0x1a'),_0x243930,_0x1cb8('0x1b'));_0x4b4917(_0x2635a8[_0x1cb8('0x22')][_0x1cb8('0x21')]);}})[_0x1cb8('0x23')](function(_0x47b161){logger[_0x1cb8('0x1f')](_0x1cb8('0x1a'),_0x243930,_0x47b161);_0xf6b347(_0x47b161);});});}function respondWithStatusCode(_0x35c890,_0xeeb21d){_0xeeb21d=_0xeeb21d||0xcc;return function(_0x17f5f8){if(_0x17f5f8){return _0x35c890[_0x1cb8('0x24')](_0xeeb21d);}return _0x35c890['status'](_0xeeb21d)[_0x1cb8('0x25')]();};}function respondWithResult(_0x23ac21,_0xfdfb31){_0xfdfb31=_0xfdfb31||0xc8;return function(_0x3c1905){if(_0x3c1905){return _0x23ac21[_0x1cb8('0x26')](_0xfdfb31)['json'](_0x3c1905);}};}function respondWithFilteredResult(_0xed576b,_0x2e3adf){return function(_0x3a8b53){if(_0x3a8b53){var _0x21c17a=typeof _0x2e3adf['offset']===_0x1cb8('0x27')&&typeof _0x2e3adf[_0x1cb8('0x28')]===_0x1cb8('0x27');var _0x5bf630=_0x3a8b53[_0x1cb8('0x29')];var _0x2a6da9=_0x21c17a?0x0:_0x2e3adf[_0x1cb8('0x2a')];var _0x5558fe=_0x21c17a?_0x3a8b53[_0x1cb8('0x29')]:_0x2e3adf[_0x1cb8('0x2a')]+_0x2e3adf[_0x1cb8('0x28')];var _0xca35f2;if(_0x5558fe>=_0x5bf630){_0x5558fe=_0x5bf630;_0xca35f2=0xc8;}else{_0xca35f2=0xce;}_0xed576b[_0x1cb8('0x26')](_0xca35f2);return _0xed576b['set'](_0x1cb8('0x2b'),_0x2a6da9+'-'+_0x5558fe+'/'+_0x5bf630)[_0x1cb8('0x2c')](_0x3a8b53);}return null;};}function saveUpdates(_0x21fde7){return function(_0x1413a2){if(_0x1413a2){return _0x1413a2[_0x1cb8('0x2d')](_0x21fde7)[_0x1cb8('0x18')](function(_0x145f75){return _0x145f75;});}return null;};}function removeEntity(_0x18cc99){return function(_0x1aaae4){if(_0x1aaae4){return _0x1aaae4['destroy']()['then'](function(){var _0x427ddf=_0x1aaae4[_0x1cb8('0x2e')]({'plain':!![]});var _0x18a003='ChatWebsites';return db['UserProfileResource'][_0x1cb8('0x2f')]({'where':{'type':_0x18a003,'resourceId':_0x427ddf['id']}})[_0x1cb8('0x18')](function(){return _0x1aaae4;});})[_0x1cb8('0x18')](function(){_0x18cc99[_0x1cb8('0x26')](0xcc)[_0x1cb8('0x25')]();});}};}function handleEntityNotFound(_0x63ee4e){return function(_0x3cc898){if(!_0x3cc898){_0x63ee4e[_0x1cb8('0x24')](0x194);}return _0x3cc898;};}function handleError(_0x5210d5,_0xbe1943){_0xbe1943=_0xbe1943||0x1f4;return function(_0x1a6518){logger[_0x1cb8('0x1f')](_0x1a6518[_0x1cb8('0x30')]);if(_0x1a6518[_0x1cb8('0x31')]){delete _0x1a6518[_0x1cb8('0x31')];}_0x5210d5[_0x1cb8('0x26')](_0xbe1943)[_0x1cb8('0x32')](_0x1a6518);};}function createInteractionObject(_0x2e6ddb,_0x5c66f7,_0x203d3a,_0x2c98a4){var _0x5e9f5f=require(_0x1cb8('0x33'));var _0x3efb16=new _0x5e9f5f();var _0x15d6fa=_0x3efb16[_0x1cb8('0x34')](_0x203d3a[_0x1cb8('0x35')])['getResult']();var _0x385b4d=_0x5c66f7[_0x1cb8('0x36')];if(_0x203d3a[_0x1cb8('0x37')]){_0x385b4d=_0x203d3a['cf-connecting-ip'];}else if(_0x203d3a['x-forwarded-for']){_0x385b4d=_['first'](_0x203d3a[_0x1cb8('0x38')][_0x1cb8('0x39')](','));}return{'ContactId':_0x2c98a4['id'],'ChatWebsiteId':_0x2e6ddb,'from':(_0x2c98a4[_0x1cb8('0x3a')]||'')+'\x20'+(_0x2c98a4[_0x1cb8('0x3b')]||''),'customerIp':_0x385b4d,'customerPort':_0x203d3a['x-real-port']?_0x203d3a['x-real-port']:null,'referer':_0x5c66f7[_0x1cb8('0x3c')],'browserName':_0x15d6fa[_0x1cb8('0x3d')][_0x1cb8('0x31')]&&_0x15d6fa[_0x1cb8('0x3d')][_0x1cb8('0x3e')]?util[_0x1cb8('0x3f')](_0x1cb8('0x40'),_0x15d6fa[_0x1cb8('0x3d')]['name'],_0x15d6fa[_0x1cb8('0x3d')][_0x1cb8('0x3e')]):_0x1cb8('0x41'),'browserVersion':_0x15d6fa[_0x1cb8('0x3d')]['version']||_0x1cb8('0x41'),'osName':util['format'](_0x1cb8('0x40'),_0x15d6fa['os'][_0x1cb8('0x31')],_0x15d6fa['os']['version']),'osVersion':_0x15d6fa['os'][_0x1cb8('0x3e')],'deviceModel':_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x43')]&&_0x15d6fa['device']['vendor']?util[_0x1cb8('0x3f')]('%s\x20%s\x20%s',_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x43')],_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x44')],_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x45')]):null,'deviceVendor':_0x15d6fa[_0x1cb8('0x42')]['vendor'],'deviceType':_0x15d6fa[_0x1cb8('0x42')][_0x1cb8('0x45')],'formData':JSON[_0x1cb8('0x1e')](_0x5c66f7)};}exports[_0x1cb8('0x46')]=function(_0x59f992,_0x2cb11d){var _0x7f7a09={'include':[{'model':db[_0x1cb8('0x47')],'as':'mandatoryDispositionPause'}]},_0x1b83a6={},_0x4642de={'count':0x0,'rows':[]};var _0x10380e=_[_0x1cb8('0x48')](db[_0x1cb8('0x49')][_0x1cb8('0x4a')],function(_0x1ceaf1){return{'name':_0x1ceaf1['fieldName'],'type':_0x1ceaf1[_0x1cb8('0x45')][_0x1cb8('0x4b')]};});_0x1b83a6['model']=_[_0x1cb8('0x48')](_0x10380e,_0x1cb8('0x31'));_0x1b83a6[_0x1cb8('0x4c')]=_[_0x1cb8('0x4d')](_0x59f992[_0x1cb8('0x4c')]);_0x1b83a6[_0x1cb8('0x4e')]=_[_0x1cb8('0x4f')](_0x1b83a6[_0x1cb8('0x43')],_0x1b83a6[_0x1cb8('0x4c')]);_0x7f7a09[_0x1cb8('0x50')]=_[_0x1cb8('0x4f')](_0x1b83a6[_0x1cb8('0x43')],qs[_0x1cb8('0x51')](_0x59f992[_0x1cb8('0x4c')]['fields']));_0x7f7a09[_0x1cb8('0x50')]=_0x7f7a09[_0x1cb8('0x50')][_0x1cb8('0x52')]?_0x7f7a09[_0x1cb8('0x50')]:_0x1b83a6[_0x1cb8('0x43')];if(!_0x59f992[_0x1cb8('0x4c')][_0x1cb8('0x53')]('nolimit')){_0x7f7a09[_0x1cb8('0x28')]=qs[_0x1cb8('0x28')](_0x59f992[_0x1cb8('0x4c')]['limit']);_0x7f7a09['offset']=qs[_0x1cb8('0x2a')](_0x59f992[_0x1cb8('0x4c')][_0x1cb8('0x2a')]);}_0x7f7a09[_0x1cb8('0x54')]=qs[_0x1cb8('0x55')](_0x59f992['query'][_0x1cb8('0x55')]);_0x7f7a09[_0x1cb8('0x56')]=qs[_0x1cb8('0x4e')](_['pick'](_0x59f992['query'],_0x1b83a6['filters']),_0x10380e);if(_0x59f992[_0x1cb8('0x4c')]['filter']){_0x7f7a09[_0x1cb8('0x56')]=_[_0x1cb8('0x57')](_0x7f7a09[_0x1cb8('0x56')],{'$or':_[_0x1cb8('0x48')](_0x10380e,function(_0x427787){if(_0x427787['type']!==_0x1cb8('0x58')){var _0x2055ad={};_0x2055ad[_0x427787[_0x1cb8('0x31')]]={'$like':'%'+_0x59f992[_0x1cb8('0x4c')][_0x1cb8('0x59')]+'%'};return _0x2055ad;}})});}_0x7f7a09=_[_0x1cb8('0x57')]({},_0x7f7a09,_0x59f992[_0x1cb8('0x5a')]);var _0x53e09e={'where':_0x7f7a09[_0x1cb8('0x56')]};return db[_0x1cb8('0x49')][_0x1cb8('0x29')](_0x53e09e)[_0x1cb8('0x18')](function(_0x2d9995){_0x4642de[_0x1cb8('0x29')]=_0x2d9995;if(_0x59f992[_0x1cb8('0x4c')]['includeAll']){_0x7f7a09['include']=[{'all':!![]}];}return db['ChatWebsite'][_0x1cb8('0x5b')](_0x7f7a09);})['then'](function(_0x2f3daa){_0x4642de[_0x1cb8('0x5c')]=_0x2f3daa;return _0x4642de;})[_0x1cb8('0x18')](respondWithFilteredResult(_0x2cb11d,_0x7f7a09))[_0x1cb8('0x23')](handleError(_0x2cb11d,null));};exports[_0x1cb8('0x5d')]=function(_0x5d736c,_0x579d54){var _0x5de2b2={'raw':![],'where':{'id':_0x5d736c[_0x1cb8('0x5e')]['id']},'include':[{'model':db['Pause'],'as':_0x1cb8('0x5f')}]},_0x38e3d9={};_0x38e3d9['model']=_[_0x1cb8('0x4d')](db[_0x1cb8('0x49')]['rawAttributes']);_0x38e3d9[_0x1cb8('0x4c')]=_[_0x1cb8('0x4d')](_0x5d736c[_0x1cb8('0x4c')]);_0x38e3d9[_0x1cb8('0x4e')]=_[_0x1cb8('0x4f')](_0x38e3d9[_0x1cb8('0x43')],_0x38e3d9[_0x1cb8('0x4c')]);_0x5de2b2[_0x1cb8('0x50')]=_[_0x1cb8('0x4f')](_0x38e3d9[_0x1cb8('0x43')],qs[_0x1cb8('0x51')](_0x5d736c[_0x1cb8('0x4c')][_0x1cb8('0x51')]));_0x5de2b2['attributes']=_0x5de2b2[_0x1cb8('0x50')][_0x1cb8('0x52')]?_0x5de2b2[_0x1cb8('0x50')]:_0x38e3d9['model'];if(_0x5d736c[_0x1cb8('0x4c')][_0x1cb8('0x60')]){_0x5de2b2[_0x1cb8('0x61')]=[{'all':!![]}];}_0x5de2b2=_[_0x1cb8('0x57')]({},_0x5de2b2,_0x5d736c['options']);return db[_0x1cb8('0x49')][_0x1cb8('0x62')](_0x5de2b2)['then'](handleEntityNotFound(_0x579d54,null))[_0x1cb8('0x18')](respondWithResult(_0x579d54,null))[_0x1cb8('0x23')](handleError(_0x579d54,null));};exports['create']=function(_0x41a5b2,_0x46ed52){var _0x3a1089=null;_0x41a5b2[_0x1cb8('0x63')]['address']['split'](',')['forEach'](_0x7f7524=>{if(_0x7f7524[_0x1cb8('0x64')]()!==''&&!wildcardUtils[_0x1cb8('0x65')](_0x7f7524[_0x1cb8('0x64')]())){_0x3a1089=new APIBadRequestError('\x22'+_0x7f7524[_0x1cb8('0x64')]()+_0x1cb8('0x66'));}});if(_0x3a1089){return handleError(_0x46ed52,null)(_0x3a1089);}return db[_0x1cb8('0x49')]['create'](_0x41a5b2[_0x1cb8('0x63')],{})[_0x1cb8('0x18')](function(_0x438eef){var _0x5d8c5b=_0x41a5b2[_0x1cb8('0x67')][_0x1cb8('0x2e')]({'plain':!![]});if(!_0x5d8c5b)throw new Error(_0x1cb8('0x68'));if(_0x5d8c5b[_0x1cb8('0x69')]===_0x1cb8('0x67')){var _0x58e796=_0x438eef[_0x1cb8('0x2e')]({'plain':!![]});var _0x150f00=_0x1cb8('0x6a');return db['UserProfileSection'][_0x1cb8('0x62')]({'where':{'name':_0x150f00,'userProfileId':_0x5d8c5b[_0x1cb8('0x6b')]},'raw':!![]})['then'](function(_0x39bdf6){if(_0x39bdf6&&_0x39bdf6['autoAssociation']===0x0){return db['UserProfileResource'][_0x1cb8('0x6c')]({'name':_0x58e796[_0x1cb8('0x31')],'resourceId':_0x58e796['id'],'type':_0x39bdf6[_0x1cb8('0x31')],'sectionId':_0x39bdf6['id']},{})['then'](function(){return _0x438eef;});}else{return _0x438eef;}})['catch'](function(_0x5943d5){logger[_0x1cb8('0x1f')](_0x1cb8('0x6d'),_0x5943d5);throw _0x5943d5;});}return _0x438eef;})[_0x1cb8('0x18')](respondWithResult(_0x46ed52,0xc9))[_0x1cb8('0x23')](handleError(_0x46ed52,null));};exports[_0x1cb8('0x2d')]=function(_0x168009,_0x144e69){var _0x5f1186=null;_0x168009['body']['address']['split'](',')[_0x1cb8('0x6e')](_0x5b8a9e=>{if(_0x5b8a9e[_0x1cb8('0x64')]()!==''&&!wildcardUtils['testWildcardValidity'](_0x5b8a9e['trim']())){_0x5f1186=new APIBadRequestError('\x22'+_0x5b8a9e['trim']()+_0x1cb8('0x66'));}});if(_0x5f1186){return handleError(_0x144e69,null)(_0x5f1186);}if(_0x168009[_0x1cb8('0x63')]['id']){delete _0x168009[_0x1cb8('0x63')]['id'];}return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x168009[_0x1cb8('0x5e')]['id']},'include':[{'model':db[_0x1cb8('0x47')],'as':_0x1cb8('0x5f')}]})[_0x1cb8('0x18')](handleEntityNotFound(_0x144e69,null))[_0x1cb8('0x18')](saveUpdates(_0x168009[_0x1cb8('0x63')],null))[_0x1cb8('0x18')](respondWithResult(_0x144e69,null))[_0x1cb8('0x23')](handleError(_0x144e69,null));};exports[_0x1cb8('0x2f')]=function(_0xafc24b,_0x38aa03){return db['ChatWebsite'][_0x1cb8('0x62')]({'where':{'id':_0xafc24b[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x38aa03,null))[_0x1cb8('0x18')](removeEntity(_0x38aa03,null))[_0x1cb8('0x23')](handleError(_0x38aa03,null));};exports[_0x1cb8('0x6f')]=function(_0x4fbbee,_0x4e5db2){return db[_0x1cb8('0x49')][_0x1cb8('0x6f')]()[_0x1cb8('0x18')](respondWithResult(_0x4e5db2,null))[_0x1cb8('0x23')](handleError(_0x4e5db2,null));};exports['addDisposition']=function(_0x7e9918,_0x34094c){if(_0x7e9918['body']['id']){delete _0x7e9918[_0x1cb8('0x63')]['id'];}return db['ChatWebsite'][_0x1cb8('0x62')]({'where':{'id':_0x7e9918[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x34094c,null))['then'](function(_0x44b951){if(_0x44b951){_0x7e9918[_0x1cb8('0x63')]['ChatWebsiteId']=_0x44b951['id'];return db['Disposition'][_0x1cb8('0x6c')](_0x7e9918[_0x1cb8('0x63')]);}})['then'](respondWithResult(_0x34094c,null))[_0x1cb8('0x23')](handleError(_0x34094c,null));};exports[_0x1cb8('0x70')]=function(_0x3ddfba,_0x242959){var _0x451295={'raw':![],'where':{}};var _0x1195b5={};var _0x2b7a9d={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x1cb8('0x71')]({'where':{'id':_0x3ddfba['params']['id']}})['then'](handleEntityNotFound(_0x242959,null))['then'](function(_0x3a7740){if(_0x3a7740){_0x1195b5[_0x1cb8('0x43')]=_[_0x1cb8('0x4d')](db[_0x1cb8('0x72')][_0x1cb8('0x4a')]);_0x1195b5[_0x1cb8('0x4c')]=_['keys'](_0x3ddfba['query']);_0x1195b5[_0x1cb8('0x4e')]=_['intersection'](_0x1195b5[_0x1cb8('0x43')],_0x1195b5[_0x1cb8('0x4c')]);_0x451295[_0x1cb8('0x50')]=_['intersection'](_0x1195b5['model'],qs[_0x1cb8('0x51')](_0x3ddfba['query'][_0x1cb8('0x51')]));_0x451295[_0x1cb8('0x50')]=_0x451295[_0x1cb8('0x50')][_0x1cb8('0x52')]?_0x451295[_0x1cb8('0x50')]:_0x1195b5[_0x1cb8('0x43')];if(!_0x3ddfba[_0x1cb8('0x4c')][_0x1cb8('0x53')](_0x1cb8('0x73'))){_0x451295[_0x1cb8('0x28')]=qs[_0x1cb8('0x28')](_0x3ddfba[_0x1cb8('0x4c')][_0x1cb8('0x28')]);_0x451295['offset']=qs['offset'](_0x3ddfba[_0x1cb8('0x4c')][_0x1cb8('0x2a')]);}_0x451295[_0x1cb8('0x54')]=qs[_0x1cb8('0x55')](_0x3ddfba['query'][_0x1cb8('0x55')]);_0x451295[_0x1cb8('0x56')]=qs[_0x1cb8('0x4e')](_[_0x1cb8('0x74')](_0x3ddfba[_0x1cb8('0x4c')],_0x1195b5['filters']));_0x451295[_0x1cb8('0x56')][_0x1cb8('0x75')]=_0x3a7740['id'];if(_0x3ddfba[_0x1cb8('0x4c')][_0x1cb8('0x59')]){_0x451295[_0x1cb8('0x56')]=_[_0x1cb8('0x57')](_0x451295[_0x1cb8('0x56')],{'$or':_[_0x1cb8('0x48')](_0x451295[_0x1cb8('0x50')],function(_0x7e24da){var _0x4dff73={};_0x4dff73[_0x7e24da]={'$like':'%'+_0x3ddfba[_0x1cb8('0x4c')][_0x1cb8('0x59')]+'%'};return _0x4dff73;})});}_0x451295=_['merge']({},_0x451295,_0x3ddfba['options']);return db[_0x1cb8('0x72')]['count']({'where':_0x451295['where']})[_0x1cb8('0x18')](function(_0x2a375d){_0x2b7a9d['count']=_0x2a375d;if(_0x3ddfba['query'][_0x1cb8('0x60')]){_0x451295['include']=[{'all':!![]}];}return db[_0x1cb8('0x72')]['findAll'](_0x451295);})[_0x1cb8('0x18')](function(_0x32ce02){_0x2b7a9d['rows']=_0x32ce02;return _0x2b7a9d;});}})[_0x1cb8('0x18')](respondWithFilteredResult(_0x242959,_0x451295))[_0x1cb8('0x23')](handleError(_0x242959,null));};exports[_0x1cb8('0x76')]=function(_0x425afa,_0x2baafc){return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x425afa[_0x1cb8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x2baafc,null))[_0x1cb8('0x18')](function(_0x5de093){if(_0x5de093){return _0x5de093[_0x1cb8('0x76')](_0x425afa[_0x1cb8('0x4c')][_0x1cb8('0x77')]);}})['then'](respondWithStatusCode(_0x2baafc,null))['catch'](handleError(_0x2baafc,null));};exports[_0x1cb8('0x78')]=function(_0x2d4a06,_0x3868f4){if(_0x2d4a06['body']['id']){delete _0x2d4a06['body']['id'];}return db['ChatWebsite']['find']({'where':{'id':_0x2d4a06[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x3868f4,null))[_0x1cb8('0x18')](function(_0x37188f){if(_0x37188f){_0x2d4a06[_0x1cb8('0x63')][_0x1cb8('0x75')]=_0x37188f['id'];return db['CannedAnswer'][_0x1cb8('0x6c')](_0x2d4a06[_0x1cb8('0x63')]);}})[_0x1cb8('0x18')](respondWithResult(_0x3868f4,null))[_0x1cb8('0x23')](handleError(_0x3868f4,null));};exports[_0x1cb8('0x79')]=function(_0x4b89b5,_0x3dadf4){var _0x4598d4={'raw':![],'where':{}};var _0x31a9ec={};var _0x1aed78={'count':0x0,'rows':[]};return db[_0x1cb8('0x49')][_0x1cb8('0x71')]({'where':{'id':_0x4b89b5[_0x1cb8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3dadf4,null))['then'](function(_0x482f53){if(_0x482f53){_0x31a9ec[_0x1cb8('0x43')]=_[_0x1cb8('0x4d')](db[_0x1cb8('0x7a')][_0x1cb8('0x4a')]);_0x31a9ec['query']=_[_0x1cb8('0x4d')](_0x4b89b5['query']);_0x31a9ec[_0x1cb8('0x4e')]=_[_0x1cb8('0x4f')](_0x31a9ec[_0x1cb8('0x43')],_0x31a9ec['query']);_0x4598d4['attributes']=_[_0x1cb8('0x4f')](_0x31a9ec[_0x1cb8('0x43')],qs[_0x1cb8('0x51')](_0x4b89b5[_0x1cb8('0x4c')]['fields']));_0x4598d4[_0x1cb8('0x50')]=_0x4598d4[_0x1cb8('0x50')][_0x1cb8('0x52')]?_0x4598d4['attributes']:_0x31a9ec[_0x1cb8('0x43')];if(!_0x4b89b5[_0x1cb8('0x4c')][_0x1cb8('0x53')](_0x1cb8('0x73'))){_0x4598d4[_0x1cb8('0x28')]=qs['limit'](_0x4b89b5['query'][_0x1cb8('0x28')]);_0x4598d4['offset']=qs[_0x1cb8('0x2a')](_0x4b89b5[_0x1cb8('0x4c')]['offset']);}_0x4598d4[_0x1cb8('0x54')]=qs[_0x1cb8('0x55')](_0x4b89b5[_0x1cb8('0x4c')][_0x1cb8('0x55')]);_0x4598d4[_0x1cb8('0x56')]=qs['filters'](_[_0x1cb8('0x74')](_0x4b89b5[_0x1cb8('0x4c')],_0x31a9ec[_0x1cb8('0x4e')]));_0x4598d4[_0x1cb8('0x56')]['ChatWebsiteId']=_0x482f53['id'];if(_0x4b89b5[_0x1cb8('0x4c')][_0x1cb8('0x59')]){_0x4598d4[_0x1cb8('0x56')]=_[_0x1cb8('0x57')](_0x4598d4['where'],{'$or':_['map'](_0x4598d4['attributes'],function(_0x3d4e87){var _0xa1294c={};_0xa1294c[_0x3d4e87]={'$like':'%'+_0x4b89b5[_0x1cb8('0x4c')][_0x1cb8('0x59')]+'%'};return _0xa1294c;})});}_0x4598d4=_[_0x1cb8('0x57')]({},_0x4598d4,_0x4b89b5[_0x1cb8('0x5a')]);return db['CannedAnswer'][_0x1cb8('0x29')]({'where':_0x4598d4[_0x1cb8('0x56')]})[_0x1cb8('0x18')](function(_0x2ed831){_0x1aed78[_0x1cb8('0x29')]=_0x2ed831;if(_0x4b89b5[_0x1cb8('0x4c')][_0x1cb8('0x60')]){_0x4598d4['include']=[{'all':!![]}];}return db[_0x1cb8('0x7a')][_0x1cb8('0x5b')](_0x4598d4);})[_0x1cb8('0x18')](function(_0x23444c){_0x1aed78['rows']=_0x23444c;return _0x1aed78;});}})[_0x1cb8('0x18')](respondWithFilteredResult(_0x3dadf4,_0x4598d4))['catch'](handleError(_0x3dadf4,null));};exports[_0x1cb8('0x7b')]=function(_0x4359be,_0x4a5a56){return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x4359be[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x4a5a56,null))['then'](function(_0x59df7f){if(_0x59df7f){return _0x59df7f['removeAnswers'](_0x4359be[_0x1cb8('0x4c')]['ids']);}})[_0x1cb8('0x18')](respondWithStatusCode(_0x4a5a56,null))[_0x1cb8('0x23')](handleError(_0x4a5a56,null));};exports[_0x1cb8('0x7c')]=function(_0x317ec0,_0x217fe2){_0x317ec0['body'][_0x1cb8('0x7d')]=_0x317ec0['file']['filename'];return db[_0x1cb8('0x49')]['find']({'where':{'id':_0x317ec0[_0x1cb8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x217fe2,null))['then'](saveUpdates(_0x317ec0[_0x1cb8('0x63')],null))[_0x1cb8('0x18')](respondWithResult(_0x217fe2,null))[_0x1cb8('0x23')](handleError(_0x217fe2,null));};exports[_0x1cb8('0x7e')]=function(_0xcc98d,_0x18f98b){_0xcc98d[_0x1cb8('0x63')][_0x1cb8('0x7f')]=_0xcc98d[_0x1cb8('0x80')][_0x1cb8('0x81')];return db[_0x1cb8('0x49')]['find']({'where':{'id':_0xcc98d[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x18f98b,null))['then'](saveUpdates(_0xcc98d['body'],null))['then'](respondWithResult(_0x18f98b,null))['catch'](handleError(_0x18f98b,null));};exports[_0x1cb8('0x82')]=function(_0x23a8ff,_0x206f28){_0x23a8ff[_0x1cb8('0x63')][_0x1cb8('0x83')]=_0x23a8ff[_0x1cb8('0x80')][_0x1cb8('0x81')];return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x23a8ff[_0x1cb8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x206f28,null))[_0x1cb8('0x18')](saveUpdates(_0x23a8ff[_0x1cb8('0x63')],null))[_0x1cb8('0x18')](respondWithResult(_0x206f28,null))['catch'](handleError(_0x206f28,null));};exports[_0x1cb8('0x84')]=function(_0x4e557a,_0x4c16d8){_0x4e557a[_0x1cb8('0x63')][_0x1cb8('0x85')]=_0x4e557a[_0x1cb8('0x80')][_0x1cb8('0x81')];return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x4e557a[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x4c16d8,null))[_0x1cb8('0x18')](saveUpdates(_0x4e557a[_0x1cb8('0x63')],null))[_0x1cb8('0x18')](respondWithResult(_0x4c16d8,null))[_0x1cb8('0x23')](handleError(_0x4c16d8,null));};exports['getLogo']=function(_0x13e0ea,_0x4a9d31){var _0x5056d2=path[_0x1cb8('0x86')](config['root'],_0x1cb8('0x87'));var _0x411a4c={'where':{'id':_0x13e0ea['params']['id']},'attributes':['id',_0x1cb8('0x7d')],'raw':!![]};var _0x577645=![];return require(_0x1cb8('0x88'))['getLicense']()[_0x1cb8('0x18')](function(_0x2f20b0){if(_0x2f20b0){_0x577645=_0x2f20b0[_0x1cb8('0x89')];}})[_0x1cb8('0x18')](function(){return db['ChatWebsite'][_0x1cb8('0x62')](_0x411a4c);})['then'](handleEntityNotFound(_0x4a9d31,null))[_0x1cb8('0x18')](function(_0x1af5a1){if(_0x1af5a1){if(!_[_0x1cb8('0x8a')](_0x1af5a1[_0x1cb8('0x7d')])){if(fs[_0x1cb8('0x8b')](path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],'server/files/images/logos/',_0x1af5a1[_0x1cb8('0x7d')]))&&_0x577645){_0x5056d2=path['join'](config[_0x1cb8('0x8c')],_0x1cb8('0x8d'),_0x1af5a1[_0x1cb8('0x7d')]);}}return _0x4a9d31[_0x1cb8('0x8e')](_0x5056d2);}})[_0x1cb8('0x23')](handleError(_0x4a9d31,null));};exports['getAvatar']=function(_0x3b319b,_0x522267){var _0x336cd9=path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],_0x1cb8('0x8f'));var _0x300810={'where':{'id':_0x3b319b[_0x1cb8('0x5e')]['id']},'attributes':['id',_0x1cb8('0x7f')],'raw':!![]};return db[_0x1cb8('0x49')][_0x1cb8('0x62')](_0x300810)[_0x1cb8('0x18')](handleEntityNotFound(_0x522267,null))[_0x1cb8('0x18')](function(_0x3755bf){if(_0x3755bf){if(!_[_0x1cb8('0x8a')](_0x3755bf[_0x1cb8('0x7f')])){if(fs[_0x1cb8('0x8b')](path[_0x1cb8('0x86')](config['root'],_0x1cb8('0x90'),_0x3755bf[_0x1cb8('0x7f')]))){_0x336cd9=path['join'](config['root'],'server/files/images/avatars/',_0x3755bf['agentAvatar']);}}return _0x522267[_0x1cb8('0x8e')](_0x336cd9);}})[_0x1cb8('0x23')](handleError(_0x522267,null));};exports[_0x1cb8('0x91')]=function(_0x2c1df4,_0x1613c6){var _0xedd9c=path[_0x1cb8('0x86')](config['root'],_0x1cb8('0x92'));var _0x5c1076={'where':{'id':_0x2c1df4[_0x1cb8('0x5e')]['id']},'attributes':['id',_0x1cb8('0x83'),'showCustomerAvatar'],'raw':!![]};return db[_0x1cb8('0x49')][_0x1cb8('0x62')](_0x5c1076)[_0x1cb8('0x18')](handleEntityNotFound(_0x1613c6,null))[_0x1cb8('0x18')](function(_0xa1f60a){if(_0xa1f60a){if(!_[_0x1cb8('0x8a')](_0xa1f60a[_0x1cb8('0x83')])){if(fs[_0x1cb8('0x8b')](path['join'](config[_0x1cb8('0x8c')],_0x1cb8('0x90'),_0xa1f60a[_0x1cb8('0x83')]))&&_0xa1f60a[_0x1cb8('0x93')]){_0xedd9c=path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],'server/files/images/avatars/',_0xa1f60a[_0x1cb8('0x83')]);}}return _0x1613c6['download'](_0xedd9c);}})[_0x1cb8('0x23')](handleError(_0x1613c6,null));};exports[_0x1cb8('0x94')]=function(_0x2cdb0f,_0x517c2b){var _0x4e2c86=path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],'server/files/images/avatars/system_avatar.png');var _0x54235a={'where':{'id':_0x2cdb0f[_0x1cb8('0x5e')]['id']},'attributes':['id',_0x1cb8('0x85')],'raw':!![]};return db['ChatWebsite'][_0x1cb8('0x62')](_0x54235a)[_0x1cb8('0x18')](handleEntityNotFound(_0x517c2b,null))['then'](function(_0x1b3008){if(_0x1b3008){if(!_[_0x1cb8('0x8a')](_0x1b3008['systemAvatar'])){if(fs[_0x1cb8('0x8b')](path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],'server/files/images/avatars/',_0x1b3008[_0x1cb8('0x85')]))){_0x4e2c86=path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],'server/files/images/avatars/',_0x1b3008[_0x1cb8('0x85')]);}}return _0x517c2b[_0x1cb8('0x8e')](_0x4e2c86);}})['catch'](handleError(_0x517c2b,null));};function checkWebsiteInterval(_0x1874c1){var _0x33c57c=_0x1874c1['Interval'];if(!_0x33c57c){return Promise['resolve'](_0x1874c1);}var _0x22766d=_0x1874c1[_0x1cb8('0x95')]||undefined;return _0x33c57c['ifTime'](_0x22766d)[_0x1cb8('0x18')](function(_0x5bd7a4){if(!_0x5bd7a4){throw new APIOutOfIntervalError();}return _0x1874c1;});}exports[_0x1cb8('0x96')]=function(_0x953f93,_0x58b07e){var _0x55e0bc={'body':_0x953f93['body'],'channel':_0x1cb8('0x97')};var _0x5e2acb=[];var _0x42d91b=[];var _0x54c586={};var _0x55f800=![];if(_0x953f93['body']['id']){delete _0x953f93[_0x1cb8('0x63')]['id'];}if(_[_0x1cb8('0x8a')](_0x953f93['body'][_0x1cb8('0x98')])){throw new APIBadRequestError(_0x1cb8('0x99'));}if(_[_0x1cb8('0x8a')](_0x953f93['body'][_0x1cb8('0x9a')])){throw new APIBadRequestError('MapKey\x20is\x20mandatory');}if(_[_0x1cb8('0x9b')](_0x953f93[_0x1cb8('0x63')]['body'])){throw new APIBadRequestError(_0x1cb8('0x9c'));}var _0x1c2db2=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x36')]&&_0x953f93['body'][_0x1cb8('0x3c')];return db[_0x1cb8('0x9d')]['describe']()[_0x1cb8('0x18')](function(_0x2cf5a3){if(!_0x2cf5a3){throw new Error('No\x20available\x20attributes');}_0x5e2acb=Object[_0x1cb8('0x4d')](_0x2cf5a3)['filter'](function(_0x1db567){return![_0x1cb8('0x9e'),'updatedAt'][_0x1cb8('0x9f')](_0x1db567);});_0x42d91b=Object[_0x1cb8('0x4d')](_0x2cf5a3)[_0x1cb8('0x59')](function(_0x24100a){return!['createdAt',_0x1cb8('0xa0'),'CompanyId',_0x1cb8('0xa1')]['includes'](_0x24100a);});if(!_[_0x1cb8('0x9f')](_0x42d91b,_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x9a')])){throw new APIBadRequestError(_0x1cb8('0xa2')+_0x42d91b[_0x1cb8('0x86')](',\x20'));}_0x54c586[_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x9a')]]=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x98')];})[_0x1cb8('0x18')](function(){return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x953f93[_0x1cb8('0x5e')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x1cb8('0x9d')],'as':_0x1cb8('0xa3'),'where':_0x54c586,'limit':0x1,'order':[[_0x1cb8('0xa0'),_0x1cb8('0xa4')]]}]},{'model':db[_0x1cb8('0xa5')],'as':_0x1cb8('0xa6')},{'model':db[_0x1cb8('0xa7')],'as':_0x1cb8('0xa7'),'include':[{'model':db[_0x1cb8('0xa7')],'as':'Intervals','attributes':['id',_0x1cb8('0xa8')],'raw':!![]}]}]});})[_0x1cb8('0x18')](function(_0x16e956){if(!_0x16e956){throw new APINotFoundError(util['format'](_0x1cb8('0xa9'),_0x953f93[_0x1cb8('0x5e')]['id']));}if(_0x1c2db2){return checkWebsiteInterval(_0x16e956);}return _0x16e956;})[_0x1cb8('0x18')](function(_0x22cf92){_0x55e0bc[_0x1cb8('0xaa')]=_0x22cf92;_0x55e0bc['applications']=_[_0x1cb8('0xab')](_0x22cf92['Applications'],[_0x1cb8('0xac')],[_0x1cb8('0xad')]);if(_0x55e0bc[_0x1cb8('0xaa')][_0x1cb8('0xa6')]){delete _0x55e0bc[_0x1cb8('0xaa')]['Applications'];}_0x55e0bc['list']=_0x22cf92[_0x1cb8('0xae')]||{'id':_0x22cf92['ListId']};if(_0x55e0bc[_0x1cb8('0xaf')]&&_0x55e0bc[_0x1cb8('0xaf')]['Contacts'][_0x1cb8('0x52')]){return _0x55e0bc[_0x1cb8('0xaf')][_0x1cb8('0xa3')][0x0];}var _0x5364b8=_['defaults'](_0x953f93[_0x1cb8('0x63')],{'firstName':_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x98')],'ListId':_0x22cf92[_0x1cb8('0xa1')]});_0x5364b8[_0x953f93[_0x1cb8('0x63')]['mapKey']]=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x98')];return db[_0x1cb8('0x9d')]['create'](_0x5364b8,{'fields':_0x5e2acb,'raw':!![]});})[_0x1cb8('0x18')](function(_0x7362ad){_0x55e0bc[_0x1cb8('0xb0')]=_0x7362ad;var _0xad4af5=createInteractionObject(_0x953f93[_0x1cb8('0x5e')]['id'],_0x953f93[_0x1cb8('0x63')],_0x953f93[_0x1cb8('0xb1')],_0x7362ad);var _0x2add95={'ChatWebsiteId':_0x953f93[_0x1cb8('0x5e')]['id']};if(_0x953f93[_0x1cb8('0x63')]['threadId']){_0x2add95[_0x1cb8('0xb2')]=_0x953f93['body']['threadId'];_0x2add95['closed']=![];return db[_0x1cb8('0xb3')][_0x1cb8('0x62')]({'where':_0x2add95})[_0x1cb8('0x18')](function(_0x4040bb){var _0x574d04=_0x953f93['body'][_0x1cb8('0x36')]&&_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x3c')];if(_0x4040bb){_0x55f800=!![];return _0x4040bb;}else if(!_0x574d04&&_0x4040bb&&_0x4040bb['closed']){throw new APIConflictError(_0x1cb8('0xb4'));}_0xad4af5[_0x1cb8('0xb2')]=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb2')];_0xad4af5[_0x1cb8('0xb5')]=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb5')];return db[_0x1cb8('0xb3')][_0x1cb8('0x6c')](_0xad4af5);});}_0x2add95[_0x1cb8('0xb6')]=_0x7362ad['id'];if(_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb7')]&&_0x953f93[_0x1cb8('0x63')]['interaction']['id']){_0x2add95['id']=_0x953f93['body'][_0x1cb8('0xb7')]['id'];return db[_0x1cb8('0xb3')][_0x1cb8('0x62')]({'where':_0x2add95})[_0x1cb8('0x18')](function(_0x395712){var _0x2b196a=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0x36')]&&_0x953f93['body'][_0x1cb8('0x3c')];if(!_0x2b196a&&_0x395712&&_0x395712[_0x1cb8('0xb8')]){throw new APIConflictError(_0x1cb8('0xb4'));}else if(_0x395712){_0x55f800=!![];return _0x395712;}else{return db[_0x1cb8('0xb3')][_0x1cb8('0x6c')](_0xad4af5);}});}return db['ChatInteraction'][_0x1cb8('0x6c')](_0xad4af5);})[_0x1cb8('0x18')](function(_0x3e9331){if(!_0x55f800){return _0x3e9331;}var _0x224323={'from':(_0x55e0bc[_0x1cb8('0xb0')][_0x1cb8('0x3a')]||'')+'\x20'+(_0x55e0bc[_0x1cb8('0xb0')][_0x1cb8('0x3b')]||'')};if(_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb2')]&&_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb9')]&&_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb2')]!=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb9')]){_0x224323[_0x1cb8('0xb2')]=_0x953f93[_0x1cb8('0x63')][_0x1cb8('0xb9')];}return _0x3e9331[_0x1cb8('0x2d')](_0x224323);})['then'](function(_0x5aac81){_0x55e0bc[_0x1cb8('0xb7')]=_0x5aac81[_0x1cb8('0x2e')]({'plain':!![]});_0x55e0bc[_0x1cb8('0xb7')][_0x1cb8('0xba')]=!_0x55f800;if(_0x55e0bc['interaction']['created']){if(_0x55e0bc[_0x1cb8('0xaa')][_0x1cb8('0xbb')]){_0x55e0bc[_0x1cb8('0xbc')][_0x1cb8('0xbd')]({'id':0x0,'priority':_0x55e0bc['applications'][_0x1cb8('0x52')]+0x1,'app':_0x1cb8('0xbe'),'appdata':_0x1cb8('0xbf'),'interval':_0x1cb8('0xc0')});}}return db['ChatMessage'][_0x1cb8('0x6c')]({'body':_0x953f93['body'][_0x1cb8('0x63')],'ChatWebsiteId':_0x953f93[_0x1cb8('0x5e')]['id'],'ChatInteractionId':_0x5aac81['id'],'direction':'in','ContactId':_0x55e0bc['contact']['id'],'AttachmentId':_0x953f93['body'][_0x1cb8('0xc1')]});})[_0x1cb8('0x18')](function(_0xd2c894){_0x55e0bc[_0x1cb8('0x21')]=_0xd2c894;if(!_0x55e0bc['interaction'][_0x1cb8('0xc2')]){return;}return db['User']['find']({'attributes':['id',_0x1cb8('0x31')],'where':{'id':_0x55e0bc[_0x1cb8('0xb7')][_0x1cb8('0xc2')]}});})[_0x1cb8('0x18')](function(_0x5df8b0){if(_0x5df8b0){_0x55e0bc['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0x1cb8('0xc3'),'appdata':_0x5df8b0['name']+','+(_0x55e0bc[_0x1cb8('0xaa')][_0x1cb8('0xc4')]||0xa),'interval':'*,*,*,*'});_0x55e0bc['forcedOwnership']=!![];}if(!_0x55e0bc[_0x1cb8('0xb7')]['queueId']){return;}return db['ChatQueue'][_0x1cb8('0x62')]({'attributes':['id','name'],'where':{'id':_0x55e0bc[_0x1cb8('0xb7')][_0x1cb8('0xc5')]}});})[_0x1cb8('0x18')](function(_0xd35d89){if(_0xd35d89){_0x55e0bc[_0x1cb8('0xbc')]['unshift']({'id':0x0,'priority':0x1,'app':_0x1cb8('0xc6'),'appdata':_0xd35d89[_0x1cb8('0x31')]+','+(_0x55e0bc[_0x1cb8('0xaa')][_0x1cb8('0xc7')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x1cb8('0xc8'),_0x55e0bc);})['then'](function(_0x2e5037){respondWithRpcPromise(_0x1cb8('0xc9'),_0x1cb8('0xc9'),{'event':'notify','message':_0x2e5037},client9002);return _0x2e5037;})['then'](respondWithResult(_0x58b07e,null))[_0x1cb8('0x23')](APIHandleError(_0x58b07e));};exports[_0x1cb8('0xca')]=function(_0x522e26,_0x8c2aa4){var _0x4c21f4,_0x3c0934,_0x50dbbc;var _0x9c1563=[];var _0x215785={};var _0x426638=_0x522e26['files']||[];var _0xd15ec5=[];var _0x43265e;return db[_0x1cb8('0x9d')][_0x1cb8('0x6f')]()[_0x1cb8('0x18')](function(_0x55ffea){if(!_0x55ffea){throw new db[(_0x1cb8('0xcb'))][(_0x1cb8('0xcc'))](_0x1cb8('0xcd'));}_0x9c1563=_[_0x1cb8('0xce')](_[_0x1cb8('0x4d')](_0x55ffea),[_0x1cb8('0x9e'),_0x1cb8('0xa0'),_0x1cb8('0xcf'),_0x1cb8('0xa1')]);if(_0x522e26[_0x1cb8('0x63')]['id']){delete _0x522e26[_0x1cb8('0x63')]['id'];}if(_['isNil'](_0x522e26[_0x1cb8('0x63')][_0x1cb8('0x98')])){throw _0x8c2aa4[_0x1cb8('0x26')](0x1f4)[_0x1cb8('0x32')](new db[(_0x1cb8('0xcb'))]['ValidationError'](_0x1cb8('0xd0')));}if(_[_0x1cb8('0x8a')](_0x522e26['body'][_0x1cb8('0x63')])||_0x522e26[_0x1cb8('0x63')][_0x1cb8('0x63')]===''){throw _0x8c2aa4[_0x1cb8('0x26')](0x1f4)[_0x1cb8('0x32')](new db[(_0x1cb8('0xcb'))]['ValidationError'](_0x1cb8('0xd1')));}if(_[_0x1cb8('0x8a')](_0x522e26['body'][_0x1cb8('0xd2')])){throw _0x8c2aa4[_0x1cb8('0x26')](0x1f4)[_0x1cb8('0x32')](new db[(_0x1cb8('0xcb'))][(_0x1cb8('0xcc'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x9c1563));}if(!_[_0x1cb8('0x9f')](_0x9c1563,_0x522e26[_0x1cb8('0x63')]['mapKeyOffline'])){throw _0x8c2aa4[_0x1cb8('0x26')](0x1f4)[_0x1cb8('0x32')](new db[(_0x1cb8('0xcb'))][(_0x1cb8('0xcc'))](_0x1cb8('0xd3')+_0x9c1563));}_0x215785[_0x522e26['body'][_0x1cb8('0xd2')]]=_0x522e26[_0x1cb8('0x63')]['from'];})[_0x1cb8('0x18')](function(){return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x522e26[_0x1cb8('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0x1cb8('0xae')},{'model':db[_0x1cb8('0xd4')],'as':_0x1cb8('0xd4')}]});})[_0x1cb8('0x18')](handleEntityNotFound(_0x8c2aa4,null))[_0x1cb8('0x18')](function(_0x7bb3c9){if(_0x7bb3c9&&_0x7bb3c9[_0x1cb8('0xae')]){_0x3c0934=_0x7bb3c9;var _0x420152=_[_0x1cb8('0x11')](_0x522e26[_0x1cb8('0x63')],{'firstName':_0x522e26['body']['from'],'phone':_0x522e26[_0x1cb8('0x63')][_0x1cb8('0x98')],'ListId':_0x7bb3c9[_0x1cb8('0xa1')]});_0x420152[_0x522e26[_0x1cb8('0x63')][_0x1cb8('0xd2')]]=_0x522e26[_0x1cb8('0x63')][_0x1cb8('0x98')];return db[_0x1cb8('0x9d')]['findOrCreate']({'where':_0x215785,'defaults':_0x420152});}})[_0x1cb8('0xd5')](function(_0x5a6ead){if(_0x5a6ead){_0x50dbbc=_0x5a6ead;var _0x14cfac=fs['readFileSync'](path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],_0x1cb8('0xd6')),_0x1cb8('0xd7'));var _0x122b16=ejs['render'](_0x14cfac,{'body':_[_0x1cb8('0xd8')](_0x522e26['body'][_0x1cb8('0x63')]),'bodyTitle':_0x3c0934[_0x1cb8('0xd9')]});return db[_0x1cb8('0xda')][_0x1cb8('0x6c')]({'body':_0x122b16,'plainBody':htmlToText[_0x1cb8('0xdb')](_0x122b16),'ContactId':_0x5a6ead['id'],'ChatWebsiteId':_0x3c0934['id']});}})['then'](function(_0x3b04af){_0x43265e=_0x3b04af;if(_0x426638[_0x1cb8('0x52')]){var _0x12a26d=_0x426638[_0x1cb8('0x48')](function(_0x3c53b3){return{'name':_0x3c53b3[_0x1cb8('0xdc')],'basename':_0x3c53b3[_0x1cb8('0x81')],'type':_0x3c53b3[_0x1cb8('0xdd')],'ChatOfflineMessageId':_0x3b04af['id']};});_0xd15ec5=_0x12a26d[_0x1cb8('0x48')](_0x39af2b=>{var _0x2a7a21={'filename':_0x39af2b[_0x1cb8('0x31')],'path':path[_0x1cb8('0x86')](config[_0x1cb8('0x8c')],_0x1cb8('0xde'),_0x1cb8('0xdf'),_0x1cb8('0xe0'),_0x1cb8('0xe1'),_0x39af2b[_0x1cb8('0xe2')])};return _0x2a7a21;});if(!_0x3c0934[_0x1cb8('0xe3')]){return db['sequelize'][_0x1cb8('0xe4')](function(_0x46c38e){return db[_0x1cb8('0xe5')][_0x1cb8('0xe6')](_0x12a26d,{'transaction':_0x46c38e});});}}})[_0x1cb8('0x18')](function(){if(_0x43265e){_0x4c21f4=_0x43265e;return db[_0x1cb8('0xd4')][_0x1cb8('0x71')]({'where':{'service':!![]},'include':[{'model':db[_0x1cb8('0xe7')],'as':_0x1cb8('0xe8'),'raw':!![],'include':[{'model':db[_0x1cb8('0xe9')],'as':_0x1cb8('0xe9'),'raw':!![]}]}]});}})[_0x1cb8('0x18')](function(_0xbf79b){if(_0xbf79b&&_0xbf79b[_0x1cb8('0xe8')]&&_0x3c0934[_0x1cb8('0xea')]&&_0x3c0934['forwardOfflineAddress']){var _0x437f93=_0xbf79b[_0x1cb8('0xeb')]();return respondWithRpcPromise('SendMail',_0x1cb8('0xec'),{'account':_0x437f93,'message':{'from':util[_0x1cb8('0x3f')](_0x1cb8('0xed'),_0xbf79b[_0x1cb8('0x31')],_0xbf79b['email']||_0xbf79b[_0x1cb8('0xe8')][_0x1cb8('0x67')]),'to':_0x3c0934[_0x1cb8('0xee')],'subject':_0x3c0934[_0x1cb8('0xef')],'html':_0x4c21f4[_0x1cb8('0x63')],'attachments':_0xd15ec5}},client9003)[_0x1cb8('0x18')](function(){return _0x4c21f4;})['catch'](function(_0x55631){logger[_0x1cb8('0x1f')](_0x55631);});}})[_0x1cb8('0x18')](function(){if(_0x3c0934&&_0x3c0934[_0x1cb8('0xe3')]&&_0x3c0934[_0x1cb8('0xf0')]){var _0x209017=[];if(_0x426638[_0x1cb8('0x52')]){_0x209017=_0x426638[_0x1cb8('0x48')](function(_0x2fa983){return{'name':_0x2fa983['originalname'],'basename':_0x2fa983[_0x1cb8('0x81')],'type':_0x2fa983[_0x1cb8('0xdd')],'ChatOfflineMessageId':_0x43265e['id']};});}var _0x423245;if(!_['isNil'](_0x3c0934[_0x1cb8('0xf1')])){var _0x18e798=_[_0x1cb8('0x48')](_0x522e26[_0x1cb8('0x63')],function(_0x27698e){return _0x27698e;});var _0x24e942=_[_0x1cb8('0xf2')](_0x18e798)[0x0];var _0x3ecb86=_['mapValues'](_0x24e942,function(_0x25f77c){return _0x25f77c;});_0x423245=_0x3ecb86[0x1][_0x3c0934['subjectOffline']];}var _0x327a2e={'from':_0x50dbbc[_0x1cb8('0xf3')],'firstName':_0x50dbbc[_0x1cb8('0x3a')],'lastName':_0x50dbbc[_0x1cb8('0x3b')],'mapKey':_0x1cb8('0xf3'),'message':{'from':_0x50dbbc['email'],'to':_0x3c0934[_0x1cb8('0xd4')][_0x1cb8('0xf3')],'cc':'','subject':_['isNil'](_0x423245)?_0x3c0934['offlineMessageSubject']:_0x423245,'messageId':'','sentAt':new Date(),'attach':_0x209017[_0x1cb8('0x52')],'attachments':_0x209017,'originChannel':_0x1cb8('0xf4'),'ChatWebsiteId':_0x3c0934['id'],'ChatOfflineMessageId':_0x4c21f4['id'],'originTo':_0x3c0934[_0x1cb8('0xd4')][_0x1cb8('0xf3')]},'body':_0x4c21f4[_0x1cb8('0x63')]};var _0x1e5abc={'account':{'id':_0x3c0934[_0x1cb8('0xf0')]},'body':_0x327a2e,'log':_0x1cb8('0xf5')};return respondWithRpcPromise(_0x1cb8('0xf5'),_0x1cb8('0xf6'),_0x1e5abc,client9001)[_0x1cb8('0x18')](function(){return _0x4c21f4;})[_0x1cb8('0x23')](function(_0x183208){logger[_0x1cb8('0x1f')](_0x183208);});}return;})[_0x1cb8('0x18')](function(){if(_0x4c21f4){return _0x4c21f4;}})[_0x1cb8('0x18')](respondWithResult(_0x8c2aa4,null))[_0x1cb8('0x23')](function(){for(var _0x2b6f7f of _0x426638){var _0x1f5694=path['join'](config['root'],_0x1cb8('0xde'),'files','attachments',_0x1cb8('0xe1'),_0x2b6f7f[_0x1cb8('0x81')]);fs_extra['remove'](_0x1f5694)[_0x1cb8('0x23')](function(_0x502d55){logger[_0x1cb8('0x1f')](_0x1cb8('0xf7'),_0x1f5694,_0x502d55);});}});};exports[_0x1cb8('0xf8')]=function(_0x4f58d5,_0x526eb6){return db[_0x1cb8('0xb3')]['find']({'where':{'id':_0x4f58d5[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x526eb6,null))[_0x1cb8('0x18')](function(_0x5da69b){if(_0x5da69b){return _0x5da69b[_0x1cb8('0xf8')](_0x4f58d5['body']['ids'],_[_0x1cb8('0xf9')](_0x4f58d5[_0x1cb8('0x63')],[_0x1cb8('0x77'),'id'])||{});}})['then'](respondWithResult(_0x526eb6,null))[_0x1cb8('0x23')](handleError(_0x526eb6,null));};exports[_0x1cb8('0xfa')]=function(_0x5b96cc,_0xd8a47b){var _0x3ccb7d={'raw':![],'where':{}};var _0x3812cd={};var _0x1d7374={'count':0x0,'rows':[]};return db[_0x1cb8('0x49')][_0x1cb8('0x71')]({'where':{'id':_0x5b96cc[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0xd8a47b,null))[_0x1cb8('0x18')](function(_0x318d31){if(_0x318d31){_0x3812cd['model']=_[_0x1cb8('0x4d')](db[_0x1cb8('0xb3')][_0x1cb8('0x4a')]);_0x3812cd['query']=_[_0x1cb8('0x4d')](_0x5b96cc['query']);_0x3812cd[_0x1cb8('0x4e')]=_[_0x1cb8('0x4f')](_0x3812cd[_0x1cb8('0x43')],_0x3812cd[_0x1cb8('0x4c')]);_0x3ccb7d[_0x1cb8('0x50')]=_['intersection'](_0x3812cd[_0x1cb8('0x43')],qs['fields'](_0x5b96cc[_0x1cb8('0x4c')][_0x1cb8('0x51')]));_0x3ccb7d[_0x1cb8('0x50')]=_0x3ccb7d[_0x1cb8('0x50')][_0x1cb8('0x52')]?_0x3ccb7d['attributes']:_0x3812cd[_0x1cb8('0x43')];if(!_0x5b96cc[_0x1cb8('0x4c')][_0x1cb8('0x53')]('nolimit')){_0x3ccb7d[_0x1cb8('0x28')]=qs[_0x1cb8('0x28')](_0x5b96cc[_0x1cb8('0x4c')]['limit']);_0x3ccb7d['offset']=qs[_0x1cb8('0x2a')](_0x5b96cc[_0x1cb8('0x4c')][_0x1cb8('0x2a')]);}_0x3ccb7d['order']=qs[_0x1cb8('0x55')](_0x5b96cc['query'][_0x1cb8('0x55')]);_0x3ccb7d[_0x1cb8('0x56')]=qs[_0x1cb8('0x4e')](_['pick'](_0x5b96cc['query'],_0x3812cd[_0x1cb8('0x4e')]));_0x3ccb7d[_0x1cb8('0x56')][_0x1cb8('0x75')]=_0x318d31['id'];if(_0x5b96cc['query'][_0x1cb8('0x59')]){_0x3ccb7d['where']=_[_0x1cb8('0x57')](_0x3ccb7d['where'],{'$or':_[_0x1cb8('0x48')](_0x3ccb7d[_0x1cb8('0x50')],function(_0x582e68){var _0x58b14b={};_0x58b14b[_0x582e68]={'$like':'%'+_0x5b96cc[_0x1cb8('0x4c')][_0x1cb8('0x59')]+'%'};return _0x58b14b;})});}_0x3ccb7d=_[_0x1cb8('0x57')]({},_0x3ccb7d,_0x5b96cc[_0x1cb8('0x5a')]);return db[_0x1cb8('0xb3')][_0x1cb8('0x29')]({'where':_0x3ccb7d[_0x1cb8('0x56')]})['then'](function(_0x398bb8){_0x1d7374[_0x1cb8('0x29')]=_0x398bb8;if(_0x5b96cc['query'][_0x1cb8('0x60')]){_0x3ccb7d[_0x1cb8('0x61')]=[{'model':db[_0x1cb8('0x9d')],'as':'Contact','required':![]},{'model':db['User'],'as':_0x1cb8('0xfb'),'attributes':['name','fullname','internal'],'required':![]},{'model':db[_0x1cb8('0xfc')],'as':_0x1cb8('0xfd'),'attributes':['id',_0x1cb8('0x31'),_0x1cb8('0xfe')],'where':_0x5b96cc['query'][_0x1cb8('0xff')]?{'id':_0x5b96cc[_0x1cb8('0x4c')][_0x1cb8('0xff')]}:undefined,'required':_0x5b96cc[_0x1cb8('0x4c')][_0x1cb8('0xff')]?!![]:![]}];}return db[_0x1cb8('0xb3')][_0x1cb8('0x5b')](_0x3ccb7d);})[_0x1cb8('0x18')](function(_0x5878fb){_0x1d7374['rows']=_0x5878fb;return _0x1d7374;});}})[_0x1cb8('0x18')](respondWithFilteredResult(_0xd8a47b,_0x3ccb7d))[_0x1cb8('0x23')](handleError(_0xd8a47b,null));};exports[_0x1cb8('0x100')]=function(_0x4f46df,_0x54c172){var _0x4bb9bf=0x0;var _0x2efa4a=0x0;var _0x4a1a96=![];var _0x526298;var _0x3ace86;return db[_0x1cb8('0x49')]['find']({'where':{'id':_0x4f46df[_0x1cb8('0x5e')]['id']},'include':[{'model':db['Interval'],'as':_0x1cb8('0xa7'),'include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x1cb8('0xa8')]}]}]})['then'](handleEntityNotFound(_0x54c172,null))[_0x1cb8('0x18')](function(_0x309e32){if(_0x309e32){_0x526298=_0x309e32;return _0x309e32[_0x1cb8('0x101')]({'raw':!![]});}})[_0x1cb8('0x18')](function(_0x3f1167){if(_0x526298){if(_0x3f1167){_0x3ace86=_0x3f1167;}}return require(_0x1cb8('0x88'))[_0x1cb8('0x102')]();})[_0x1cb8('0x18')](function(_0x1485aa){if(_0x1485aa){_0x2efa4a=_0x1485aa['virtual'];_0x4a1a96=_0x1485aa['custom'];}})[_0x1cb8('0x18')](function(){return db['ChatInteraction'][_0x1cb8('0x29')]({'where':{'closed':![]}});})[_0x1cb8('0x18')](function(_0xc0d895){_0x4bb9bf=_0xc0d895;if(_0x2efa4a&&_0xc0d895>_0x2efa4a){return db[_0x1cb8('0x103')]['findOne']({'where':{'id':0x1}})[_0x1cb8('0x18')](function(_0x1fea10){if(_0x1fea10){_0x1fea10[_0x1cb8('0x104')]('chatLicenseExceeded');}});}})[_0x1cb8('0x18')](function(){var _0x3ed9fd=_0x526298[_0x1cb8('0xa7')];var _0x1319ad=_0x526298['timezone']||undefined;return _0x3ed9fd?_0x3ed9fd['ifTime'](_0x1319ad):!![];})['then'](function(_0x1a46f0){var _0x1ac4aa=fs['readFileSync'](path[_0x1cb8('0x86')](config['root'],'server/files/chat/iframe.ejs'),'utf8');var _0x211dac=_0x1cb8('0x105');var _0x2f27dd=![];var _0x47d2f0,_0xd88ec7;if(_0x4f46df[_0x1cb8('0xb1')]['referer']){_0x47d2f0=new URL(_0x4f46df[_0x1cb8('0xb1')]['referer'])[_0x1cb8('0x106')];}else if(_0x4f46df['headers'][_0x1cb8('0x106')]){_0x47d2f0=new URL(_0x4f46df[_0x1cb8('0xb1')][_0x1cb8('0x106')])[_0x1cb8('0x106')];}else{_0x47d2f0=_0x1cb8('0x107');}_0xd88ec7=typeof _0x526298[_0x1cb8('0x108')]['split'](',')[_0x1cb8('0x62')](function(_0x45cc1c){return wildcardUtils['testWebsiteWithWildcard'](_0x45cc1c,_0x47d2f0);})!=='undefined';var _0x5d219a={'chatVersion':_0x211dac,'chatWebsiteAddressOrigin':_0xd88ec7?_0x47d2f0:_0x526298['address'],'remote':_0x526298[_0x1cb8('0x109')],'query':querystring[_0x1cb8('0x1e')](_[_0x1cb8('0x57')](_0x526298[_0x1cb8('0x2e')]({'plain':!![]}),{'customerIp':_0x4f46df[_0x1cb8('0xb1')][_0x1cb8('0x38')]||_0x4f46df[_0x1cb8('0xb1')][_0x1cb8('0x10a')]||_0x4f46df[_0x1cb8('0x10b')]['remoteAddress']||_0x4f46df['ip'],'referer':_0x4f46df[_0x1cb8('0xb1')][_0x1cb8('0x3c')],'openedInteractions':_0x4bb9bf,'maxInteractions':_0x2efa4a,'virtual':_0x4a1a96[_0x1cb8('0x10c')],'online':_0x1a46f0,'custom':_0x4a1a96,'address':_0xd88ec7?_0x47d2f0:null}))[_0x1cb8('0x10d')](/'/g,'\x5c\x27')};_0x54c172[_0x1cb8('0x32')](ejs['render'](Mustache[_0x1cb8('0x10e')](_0x1ac4aa,_0x5d219a),{'proactiveActions':_0x3ace86,'alignment':_0x526298[_0x1cb8('0x10f')],'verticalAlignment':_0x526298[_0x1cb8('0x110')],'div_color':_0x526298[_0x1cb8('0xfe')],'labelText':_0x526298[_0x1cb8('0x111')],'text_color':_0x526298[_0x1cb8('0x112')],'text_button_color':_0x526298[_0x1cb8('0x113')],'button_color':_0x526298[_0x1cb8('0x114')],'background_color':_0x526298[_0x1cb8('0x115')],'hideWhenOffline':_0x526298[_0x1cb8('0x116')],'intervalId':_0x526298[_0x1cb8('0x117')],'isDevelopment':_0x2f27dd,'chatVersion':_0x211dac}));})[_0x1cb8('0x23')](handleError(_0x54c172,null));};exports[_0x1cb8('0x118')]=function(_0x502d26,_0xf049fc){var _0x38d9ee=_0x502d26['params']['id'];var _0x70d4e1=_0x502d26[_0x1cb8('0x63')];var _0x1f615e=0xc8;var _0x254b42=null;return db[_0x1cb8('0x119')][_0x1cb8('0xe4')]({'isolationLevel':db[_0x1cb8('0x119')][_0x1cb8('0x11a')]['ISOLATION_LEVELS'][_0x1cb8('0x11b')]},function(_0x2b533f){return db[_0x1cb8('0x49')]['findOne']({'where':{'id':_0x38d9ee},'transaction':_0x2b533f})[_0x1cb8('0x18')](function(_0x36a875){if(_0x36a875){return db[_0x1cb8('0xa5')][_0x1cb8('0x2f')]({'where':{'ChatWebsiteId':_0x38d9ee},'transaction':_0x2b533f})[_0x1cb8('0x18')](function(){var _0x13905e=_['map'](_0x70d4e1,function(_0x41a769){_0x41a769[_0x1cb8('0x75')]=_0x38d9ee;return _0x41a769;});return db[_0x1cb8('0xa5')][_0x1cb8('0xe6')](_0x13905e,{'transaction':_0x2b533f});});}else{_0x1f615e=0x194;_0x254b42=[];}});})[_0x1cb8('0x18')](function(){if(_0x1f615e!==0x194){return db[_0x1cb8('0xa5')]['findAndCountAll']({'where':{'ChatWebsiteId':_0x38d9ee},'order':_0x1cb8('0xac')})[_0x1cb8('0x18')](function(_0x4e3037){_0x254b42=_0x4e3037;});}})['catch'](function(_0x74dd99){_0x1f615e=0x1f4;logger[_0x1cb8('0x1f')](_0x74dd99[_0x1cb8('0x30')]);if(_0x74dd99[_0x1cb8('0x31')]){delete _0x74dd99[_0x1cb8('0x31')];}_0x254b42=_0x74dd99;})[_0x1cb8('0x11c')](function(){if(_0x254b42===null){_0xf049fc[_0x1cb8('0x24')](_0x1f615e);}else{if(_0x1f615e===0x1f4){_0xf049fc[_0x1cb8('0x26')](_0x1f615e)['send'](_0x254b42);}else{_0xf049fc['status'](_0x1f615e)['json'](_0x254b42);}}});};exports[_0x1cb8('0x11d')]=function(_0x47b6ed,_0x202fc9){var _0x3f85ea={};var _0x463341={};var _0x4b475f;var _0x363000;return db[_0x1cb8('0x49')][_0x1cb8('0x71')]({'where':{'id':_0x47b6ed['params']['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x202fc9,null))[_0x1cb8('0x18')](function(_0x423e79){if(_0x423e79){_0x4b475f=_0x423e79;_0x463341[_0x1cb8('0x43')]=_[_0x1cb8('0x4d')](db[_0x1cb8('0xa5')][_0x1cb8('0x4a')]);_0x463341['query']=_['keys'](_0x47b6ed[_0x1cb8('0x4c')]);_0x463341['filters']=_[_0x1cb8('0x4f')](_0x463341['model'],_0x463341[_0x1cb8('0x4c')]);_0x3f85ea[_0x1cb8('0x50')]=_[_0x1cb8('0x4f')](_0x463341[_0x1cb8('0x43')],qs[_0x1cb8('0x51')](_0x47b6ed['query'][_0x1cb8('0x51')]));_0x3f85ea[_0x1cb8('0x50')]=_0x3f85ea[_0x1cb8('0x50')][_0x1cb8('0x52')]?_0x3f85ea['attributes']:_0x463341[_0x1cb8('0x43')];_0x3f85ea[_0x1cb8('0x54')]=qs[_0x1cb8('0x55')](_0x47b6ed[_0x1cb8('0x4c')][_0x1cb8('0x55')]);_0x3f85ea['where']=qs[_0x1cb8('0x4e')](_[_0x1cb8('0x74')](_0x47b6ed[_0x1cb8('0x4c')],_0x463341['filters']));if(_0x47b6ed[_0x1cb8('0x4c')][_0x1cb8('0x59')]){_0x3f85ea[_0x1cb8('0x56')]=_[_0x1cb8('0x57')](_0x3f85ea['where'],{'$or':_[_0x1cb8('0x48')](_0x3f85ea[_0x1cb8('0x50')],function(_0x2839a8){var _0x16e8d2={};_0x16e8d2[_0x2839a8]={'$like':'%'+_0x47b6ed[_0x1cb8('0x4c')][_0x1cb8('0x59')]+'%'};return _0x16e8d2;})});}_0x3f85ea=_[_0x1cb8('0x57')]({},_0x3f85ea,_0x47b6ed[_0x1cb8('0x5a')]);return _0x4b475f[_0x1cb8('0x11d')](_0x3f85ea);}})[_0x1cb8('0x18')](function(_0x5de558){if(_0x5de558){_0x363000=_0x5de558[_0x1cb8('0x52')];if(!_0x47b6ed[_0x1cb8('0x4c')]['hasOwnProperty'](_0x1cb8('0x73'))){_0x3f85ea['limit']=qs[_0x1cb8('0x28')](_0x47b6ed[_0x1cb8('0x4c')]['limit']);_0x3f85ea[_0x1cb8('0x2a')]=qs[_0x1cb8('0x2a')](_0x47b6ed[_0x1cb8('0x4c')][_0x1cb8('0x2a')]);}return _0x4b475f[_0x1cb8('0x11d')](_0x3f85ea);}})[_0x1cb8('0x18')](function(_0x4c5f96){if(_0x4c5f96){return _0x4c5f96?{'count':_0x363000,'rows':_0x4c5f96}:null;}})[_0x1cb8('0x18')](respondWithResult(_0x202fc9,null))[_0x1cb8('0x23')](handleError(_0x202fc9,null));};exports['addProactiveActions']=function(_0x4a1b43,_0x3ac39c){return db[_0x1cb8('0x11e')][_0x1cb8('0x62')]({'where':{'id':_0x4a1b43[_0x1cb8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3ac39c,null))['then'](function(_0x106b44){if(_0x106b44){return _0x106b44['addProactiveActions'](_0x4a1b43[_0x1cb8('0x63')][_0x1cb8('0x77')],_[_0x1cb8('0xf9')](_0x4a1b43['body'],['ids','id'])||{});}})[_0x1cb8('0x18')](respondWithResult(_0x3ac39c,null))[_0x1cb8('0x23')](handleError(_0x3ac39c,null));};exports['getProactiveActions']=function(_0x2edb7e,_0x1a51f0){var _0x57c2cf={};var _0x1eadd3={};var _0x5aed14;var _0x15139c;return db[_0x1cb8('0x49')][_0x1cb8('0x71')]({'where':{'id':_0x2edb7e['params']['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x1a51f0,null))[_0x1cb8('0x18')](function(_0x19ef15){if(_0x19ef15){_0x5aed14=_0x19ef15;_0x1eadd3['model']=_['keys'](db[_0x1cb8('0x11f')][_0x1cb8('0x4a')]);_0x1eadd3[_0x1cb8('0x4c')]=_[_0x1cb8('0x4d')](_0x2edb7e[_0x1cb8('0x4c')]);_0x1eadd3[_0x1cb8('0x4e')]=_[_0x1cb8('0x4f')](_0x1eadd3[_0x1cb8('0x43')],_0x1eadd3[_0x1cb8('0x4c')]);_0x57c2cf[_0x1cb8('0x50')]=_[_0x1cb8('0x4f')](_0x1eadd3[_0x1cb8('0x43')],qs['fields'](_0x2edb7e['query']['fields']));_0x57c2cf[_0x1cb8('0x50')]=_0x57c2cf['attributes'][_0x1cb8('0x52')]?_0x57c2cf['attributes']:_0x1eadd3[_0x1cb8('0x43')];_0x57c2cf['order']=qs['sort'](_0x2edb7e[_0x1cb8('0x4c')][_0x1cb8('0x55')]);_0x57c2cf['where']=qs[_0x1cb8('0x4e')](_[_0x1cb8('0x74')](_0x2edb7e[_0x1cb8('0x4c')],_0x1eadd3[_0x1cb8('0x4e')]));if(_0x2edb7e[_0x1cb8('0x4c')]['filter']){_0x57c2cf[_0x1cb8('0x56')]=_[_0x1cb8('0x57')](_0x57c2cf[_0x1cb8('0x56')],{'$or':_[_0x1cb8('0x48')](_0x57c2cf[_0x1cb8('0x50')],function(_0x5c0ef8){var _0x5b699b={};_0x5b699b[_0x5c0ef8]={'$like':'%'+_0x2edb7e[_0x1cb8('0x4c')][_0x1cb8('0x59')]+'%'};return _0x5b699b;})});}_0x57c2cf=_[_0x1cb8('0x57')]({},_0x57c2cf,_0x2edb7e[_0x1cb8('0x5a')]);return _0x5aed14['getProactiveActions'](_0x57c2cf);}})[_0x1cb8('0x18')](function(_0x27a766){if(_0x27a766){_0x15139c=_0x27a766['length'];if(!_0x2edb7e[_0x1cb8('0x4c')][_0x1cb8('0x53')]('nolimit')){_0x57c2cf[_0x1cb8('0x28')]=qs[_0x1cb8('0x28')](_0x2edb7e['query']['limit']);_0x57c2cf[_0x1cb8('0x2a')]=qs['offset'](_0x2edb7e[_0x1cb8('0x4c')][_0x1cb8('0x2a')]);}return _0x5aed14['getProactiveActions'](_0x57c2cf);}})[_0x1cb8('0x18')](function(_0x34c028){if(_0x34c028){return _0x34c028?{'count':_0x15139c,'rows':_0x34c028}:null;}})[_0x1cb8('0x18')](respondWithResult(_0x1a51f0,null))['catch'](handleError(_0x1a51f0,null));};exports[_0x1cb8('0x120')]=function(_0x548df4,_0xfb255e){var _0x424916=_0x548df4['query']['online']===_0x1cb8('0x121')?'offlineForm':_0x1cb8('0x122');return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'attributes':['id',_0x424916],'where':{'id':_0x548df4[_0x1cb8('0x5e')]['id']}})['then'](handleEntityNotFound(_0xfb255e,null))[_0x1cb8('0x18')](function(_0x3dba7a){if(_0x3dba7a){var _0x3bfd8b=_0x3dba7a[_0x424916];var _0x364373=_0x3bfd8b&&_0x3bfd8b[_0x1cb8('0x123')]?_0x3bfd8b['items']:[];_0xfb255e[_0x1cb8('0x32')]({'fromKey':_[_0x1cb8('0x8a')](_0x3bfd8b[_0x1cb8('0x124')])?undefined:_0x3bfd8b[_0x1cb8('0x124')],'count':_0x364373[_0x1cb8('0x52')],'rows':_0x364373});}})[_0x1cb8('0x23')](handleError(_0xfb255e,null));};exports['getOfflineMessages']=function(_0x10c924,_0x3e930e){var _0x44c8aa={'raw':![],'where':{}};var _0x174f23={};var _0x322415={'count':0x0,'rows':[]};return db[_0x1cb8('0x49')][_0x1cb8('0x71')]({'where':{'id':_0x10c924['params']['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x3e930e,null))['then'](function(_0x21825f){if(_0x21825f){_0x174f23['model']=_[_0x1cb8('0x4d')](db[_0x1cb8('0xda')][_0x1cb8('0x4a')]);_0x174f23[_0x1cb8('0x4c')]=_[_0x1cb8('0x4d')](_0x10c924[_0x1cb8('0x4c')]);_0x174f23['filters']=_[_0x1cb8('0x4f')](_0x174f23['model'],_0x174f23['query']);_0x44c8aa[_0x1cb8('0x50')]=_['intersection'](_0x174f23[_0x1cb8('0x43')],qs['fields'](_0x10c924['query'][_0x1cb8('0x51')]));_0x44c8aa[_0x1cb8('0x50')]=_0x44c8aa[_0x1cb8('0x50')]['length']?_0x44c8aa[_0x1cb8('0x50')]:_0x174f23[_0x1cb8('0x43')];if(!_0x10c924[_0x1cb8('0x4c')][_0x1cb8('0x53')](_0x1cb8('0x73'))){_0x44c8aa[_0x1cb8('0x28')]=qs['limit'](_0x10c924[_0x1cb8('0x4c')]['limit']);_0x44c8aa[_0x1cb8('0x2a')]=qs['offset'](_0x10c924[_0x1cb8('0x4c')][_0x1cb8('0x2a')]);}_0x44c8aa[_0x1cb8('0x54')]=qs[_0x1cb8('0x55')](_0x10c924[_0x1cb8('0x4c')][_0x1cb8('0x55')]);_0x44c8aa['where']=qs[_0x1cb8('0x4e')](_['pick'](_0x10c924['query'],_0x174f23[_0x1cb8('0x4e')]));_0x44c8aa['where'][_0x1cb8('0x75')]=_0x21825f['id'];if(_0x10c924['query']['filter']){_0x44c8aa[_0x1cb8('0x56')]=_['merge'](_0x44c8aa[_0x1cb8('0x56')],{'$or':_['map'](_0x44c8aa[_0x1cb8('0x50')],function(_0x31311d){var _0x11a302={};_0x11a302[_0x31311d]={'$like':'%'+_0x10c924[_0x1cb8('0x4c')][_0x1cb8('0x59')]+'%'};return _0x11a302;})});}_0x44c8aa=_[_0x1cb8('0x57')]({},_0x44c8aa,_0x10c924[_0x1cb8('0x5a')]);return db['ChatOfflineMessage'][_0x1cb8('0x29')]({'where':_0x44c8aa['where']})[_0x1cb8('0x18')](function(_0x58101a){_0x322415['count']=_0x58101a;if(_0x10c924['query'][_0x1cb8('0x60')]){_0x44c8aa[_0x1cb8('0x61')]=[{'all':!![]}];}else{_0x44c8aa[_0x1cb8('0x61')]=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x1cb8('0xe5')],'as':_0x1cb8('0x125'),'required':![]}];}return db['ChatOfflineMessage'][_0x1cb8('0x5b')](_0x44c8aa);})['then'](function(_0x4f64b6){_0x322415[_0x1cb8('0x5c')]=_0x4f64b6;return _0x322415;});}})[_0x1cb8('0x18')](respondWithFilteredResult(_0x3e930e,_0x44c8aa))[_0x1cb8('0x23')](handleError(_0x3e930e,null));};exports['addAgents']=function(_0x1f37ac,_0x40218c){return db[_0x1cb8('0x49')][_0x1cb8('0x62')]({'where':{'id':_0x1f37ac[_0x1cb8('0x5e')]['id']}})['then'](handleEntityNotFound(_0x40218c,null))[_0x1cb8('0x18')](function(_0x5a34e1){if(_0x5a34e1){return _0x5a34e1[_0x1cb8('0x126')](_0x1f37ac['body']['ids'],_['omit'](_0x1f37ac['body'],[_0x1cb8('0x77'),'id'])||{})[_0x1cb8('0xd5')](function(_0x1e6466){for(var _0x317996=0x0;_0x317996<_0x1f37ac[_0x1cb8('0x63')]['ids'][_0x1cb8('0x52')];_0x317996+=0x1){socket['emit'](_0x1cb8('0x127'),{'UserId':Number(_0x1f37ac[_0x1cb8('0x63')][_0x1cb8('0x77')][_0x317996]),'ChatWebsiteId':Number(_0x1f37ac[_0x1cb8('0x5e')]['id'])});}return _0x1e6466;});}})[_0x1cb8('0x18')](respondWithResult(_0x40218c,null))[_0x1cb8('0x23')](handleError(_0x40218c,null));};exports[_0x1cb8('0x128')]=function(_0x5cc4bc,_0x116020){return db[_0x1cb8('0x49')]['find']({'where':{'id':_0x5cc4bc[_0x1cb8('0x5e')]['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x116020,null))[_0x1cb8('0x18')](function(_0x227c16){if(_0x227c16){return _0x227c16[_0x1cb8('0x128')](_0x5cc4bc[_0x1cb8('0x4c')][_0x1cb8('0x77')])[_0x1cb8('0x18')](function(){if(_[_0x1cb8('0x129')](_0x5cc4bc[_0x1cb8('0x4c')]['ids'])){for(var _0x788c53=0x0;_0x788c53<_0x5cc4bc[_0x1cb8('0x4c')][_0x1cb8('0x77')][_0x1cb8('0x52')];_0x788c53+=0x1){socket[_0x1cb8('0x12a')](_0x1cb8('0x12b'),{'UserId':Number(_0x5cc4bc[_0x1cb8('0x4c')][_0x1cb8('0x77')][_0x788c53]),'ChatWebsiteId':Number(_0x5cc4bc['params']['id'])});}}else{socket[_0x1cb8('0x12a')](_0x1cb8('0x12b'),{'UserId':Number(_0x5cc4bc[_0x1cb8('0x4c')][_0x1cb8('0x77')]),'ChatWebsiteId':Number(_0x5cc4bc['params']['id'])});}});}})['then'](respondWithStatusCode(_0x116020,null))[_0x1cb8('0x23')](handleError(_0x116020,null));};exports[_0x1cb8('0x12c')]=function(_0x27077e,_0x2935d6){var _0x570652={};var _0x4e8e21={};var _0x40ecba;var _0x2f924f;return db[_0x1cb8('0x49')][_0x1cb8('0x71')]({'where':{'id':_0x27077e['params']['id']}})[_0x1cb8('0x18')](handleEntityNotFound(_0x2935d6,null))[_0x1cb8('0x18')](function(_0x29a1a1){if(_0x29a1a1){_0x40ecba=_0x29a1a1;_0x4e8e21['model']=_['keys'](db[_0x1cb8('0x12d')][_0x1cb8('0x4a')]);_0x4e8e21['query']=_[_0x1cb8('0x4d')](_0x27077e[_0x1cb8('0x4c')]);_0x4e8e21[_0x1cb8('0x4e')]=_[_0x1cb8('0x4f')](_0x4e8e21[_0x1cb8('0x43')],_0x4e8e21[_0x1cb8('0x4c')]);_0x570652['attributes']=_[_0x1cb8('0x4f')](_0x4e8e21['model'],qs['fields'](_0x27077e['query'][_0x1cb8('0x51')]));_0x570652[_0x1cb8('0x50')]=_0x570652[_0x1cb8('0x50')]['length']?_0x570652[_0x1cb8('0x50')]:_0x4e8e21[_0x1cb8('0x43')];_0x570652[_0x1cb8('0x54')]=qs[_0x1cb8('0x55')](_0x27077e[_0x1cb8('0x4c')]['sort']);_0x570652[_0x1cb8('0x56')]=qs[_0x1cb8('0x4e')](_[_0x1cb8('0x74')](_0x27077e[_0x1cb8('0x4c')],_0x4e8e21['filters']));if(_0x27077e[_0x1cb8('0x4c')][_0x1cb8('0x59')]){_0x570652[_0x1cb8('0x56')]=_['merge'](_0x570652[_0x1cb8('0x56')],{'$or':_[_0x1cb8('0x48')](_0x570652[_0x1cb8('0x50')],function(_0x3a56fc){var _0x5e3e91={};_0x5e3e91[_0x3a56fc]={'$like':'%'+_0x27077e[_0x1cb8('0x4c')]['filter']+'%'};return _0x5e3e91;})});}_0x570652=_[_0x1cb8('0x57')]({},_0x570652,_0x27077e[_0x1cb8('0x5a')]);return _0x40ecba[_0x1cb8('0x12c')](_0x570652);}})[_0x1cb8('0x18')](function(_0x26ef24){if(_0x26ef24){_0x2f924f=_0x26ef24[_0x1cb8('0x52')];if(!_0x27077e[_0x1cb8('0x4c')][_0x1cb8('0x53')]('nolimit')){_0x570652['limit']=qs['limit'](_0x27077e['query'][_0x1cb8('0x28')]);_0x570652[_0x1cb8('0x2a')]=qs[_0x1cb8('0x2a')](_0x27077e['query'][_0x1cb8('0x2a')]);}return _0x40ecba[_0x1cb8('0x12c')](_0x570652);}})[_0x1cb8('0x18')](function(_0x34e3c9){if(_0x34e3c9){return _0x34e3c9?{'count':_0x2f924f,'rows':_0x34e3c9}:null;}})[_0x1cb8('0x18')](respondWithResult(_0x2935d6,null))[_0x1cb8('0x23')](handleError(_0x2935d6,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index c5d0830..ba532eb 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 _0xa991=['ChatWebsite','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x210603,_0x4adbac){var _0x1bcb7d=function(_0x2cdf89){while(--_0x2cdf89){_0x210603['push'](_0x210603['shift']());}};_0x1bcb7d(++_0x4adbac);}(_0xa991,0x143));var _0x1a99=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xa991[_0x2064e5];return _0x21a233;};'use strict';var EventEmitter=require(_0x1a99('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x1a99('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x1a99('0x2')](0x0);var events={'afterCreate':_0x1a99('0x3'),'afterUpdate':_0x1a99('0x4'),'afterDestroy':_0x1a99('0x5')};function emitEvent(_0x577db5){return function(_0x46c8c4,_0x1fe48a,_0x118756){ChatWebsiteEvents[_0x1a99('0x6')](_0x577db5+':'+_0x46c8c4['id'],_0x46c8c4);ChatWebsiteEvents[_0x1a99('0x6')](_0x577db5,_0x46c8c4);_0x118756(null);};}for(var e in events){if(events[_0x1a99('0x7')](e)){var event=events[e];ChatWebsite[_0x1a99('0x8')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file +var _0xaf79=['remove','emit','hook','exports','../../mysqldb','ChatWebsite','setMaxListeners','save','update'];(function(_0xd3c93d,_0xf7dd71){var _0x3924c3=function(_0x18d6c5){while(--_0x18d6c5){_0xd3c93d['push'](_0xd3c93d['shift']());}};_0x3924c3(++_0xf7dd71);}(_0xaf79,0x82));var _0x9af7=function(_0x408663,_0x5eb6ce){_0x408663=_0x408663-0x0;var _0x4eb1f1=_0xaf79[_0x408663];return _0x4eb1f1;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x9af7('0x0'))['db'][_0x9af7('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x9af7('0x2')](0x0);var events={'afterCreate':_0x9af7('0x3'),'afterUpdate':_0x9af7('0x4'),'afterDestroy':_0x9af7('0x5')};function emitEvent(_0x53e09f){return function(_0x6e8099,_0xfa2a43,_0x432c06){ChatWebsiteEvents[_0x9af7('0x6')](_0x53e09f+':'+_0x6e8099['id'],_0x6e8099);ChatWebsiteEvents['emit'](_0x53e09f,_0x6e8099);_0x432c06(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0x9af7('0x7')](e,emitEvent(event));}}module[_0x9af7('0x8')]=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 320db48..3f8178b 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 _0x037f=['bluebird','request-promise','path','rimraf','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','../../config/logger','api'];(function(_0x140e7f,_0x5f50a7){var _0x39656b=function(_0xd5f5d7){while(--_0xd5f5d7){_0x140e7f['push'](_0x140e7f['shift']());}};_0x39656b(++_0x5f50a7);}(_0x037f,0x1ab));var _0xf037=function(_0x90a39a,_0x32020d){_0x90a39a=_0x90a39a-0x0;var _0x2b62f7=_0x037f[_0x90a39a];return _0x2b62f7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf037('0x0'))(_0xf037('0x1'));var moment=require('moment');var BPromise=require(_0xf037('0x2'));var rp=require(_0xf037('0x3'));var fs=require('fs');var path=require(_0xf037('0x4'));var rimraf=require(_0xf037('0x5'));var config=require('../../config/environment');var attributes=require(_0xf037('0x6'));module[_0xf037('0x7')]=function(_0x3d61f1,_0x4b3589){return _0x3d61f1[_0xf037('0x8')](_0xf037('0x9'),attributes,{'tableName':_0xf037('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ad4=['api','moment','bluebird','request-promise','path','../../config/environment','./chatWebsite.attributes','exports','define','ChatWebsite','chat_websites','lodash','util'];(function(_0x1b7161,_0xc11e47){var _0x1fae52=function(_0xb5f207){while(--_0xb5f207){_0x1b7161['push'](_0x1b7161['shift']());}};_0x1fae52(++_0xc11e47);}(_0x9ad4,0x1b8));var _0x49ad=function(_0x4ab9a7,_0x291df1){_0x4ab9a7=_0x4ab9a7-0x0;var _0xd08799=_0x9ad4[_0x4ab9a7];return _0xd08799;};'use strict';var _=require(_0x49ad('0x0'));var util=require(_0x49ad('0x1'));var logger=require('../../config/logger')(_0x49ad('0x2'));var moment=require(_0x49ad('0x3'));var BPromise=require(_0x49ad('0x4'));var rp=require(_0x49ad('0x5'));var fs=require('fs');var path=require(_0x49ad('0x6'));var rimraf=require('rimraf');var config=require(_0x49ad('0x7'));var attributes=require(_0x49ad('0x8'));module[_0x49ad('0x9')]=function(_0x91f9a9,_0x2ed766){return _0x91f9a9[_0x49ad('0xa')](_0x49ad('0xb'),attributes,{'tableName':_0x49ad('0xc'),'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 9647828..f47088d 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 _0xdce7=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./chatWebsite.socket','request','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x4e9e00,_0x157820){var _0x201de0=function(_0x3217d5){while(--_0x3217d5){_0x4e9e00['push'](_0x4e9e00['shift']());}};_0x201de0(++_0x157820);}(_0xdce7,0xaa));var _0x7dce=function(_0x15a3a4,_0x524046){_0x15a3a4=_0x15a3a4-0x0;var _0x248605=_0xdce7[_0x15a3a4];return _0x248605;};'use strict';var _=require('lodash');var util=require(_0x7dce('0x0'));var moment=require(_0x7dce('0x1'));var BPromise=require(_0x7dce('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7dce('0x3'));var db=require(_0x7dce('0x4'))['db'];var utils=require(_0x7dce('0x5'));var logger=require(_0x7dce('0x6'))(_0x7dce('0x7'));var config=require(_0x7dce('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x7dce('0x9')][_0x7dce('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x7dce('0xb')],{'host':_0x7dce('0xc'),'port':0x18eb});var socket=require(_0x7dce('0xd'))(new Redis(config[_0x7dce('0xb')]));require(_0x7dce('0xe'))['register'](socket);function respondWithRpcPromise(_0x4efaf1,_0x501c40,_0x4d292a){return new BPromise(function(_0x55ca99,_0x7ced39){return client[_0x7dce('0xf')](_0x4efaf1,_0x4d292a)['then'](function(_0x26c725){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x501c40,'request\x20sent');logger[_0x7dce('0x10')](_0x7dce('0x11'),_0x501c40,_0x7dce('0x12'),JSON[_0x7dce('0x13')](_0x26c725));if(_0x26c725['error']){if(_0x26c725[_0x7dce('0x14')]['code']===0x1f4){logger[_0x7dce('0x14')](_0x7dce('0x15'),_0x501c40,_0x26c725[_0x7dce('0x14')][_0x7dce('0x16')]);return _0x7ced39(_0x26c725[_0x7dce('0x14')][_0x7dce('0x16')]);}logger[_0x7dce('0x14')](_0x7dce('0x15'),_0x501c40,_0x26c725['error'][_0x7dce('0x16')]);return _0x55ca99(_0x26c725['error'][_0x7dce('0x16')]);}else{logger['info']('ChatWebsite,\x20%s,\x20%s',_0x501c40,_0x7dce('0x12'));_0x55ca99(_0x26c725[_0x7dce('0x17')]['message']);}})[_0x7dce('0x18')](function(_0x934d53){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x501c40,_0x934d53);_0x7ced39(_0x934d53);});});} \ No newline at end of file +var _0x98b9=['request','then','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','ChatWebsite,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./chatWebsite.socket','register'];(function(_0x3ed131,_0x4be59f){var _0x1a0365=function(_0x4e4342){while(--_0x4e4342){_0x3ed131['push'](_0x3ed131['shift']());}};_0x1a0365(++_0x4be59f);}(_0x98b9,0x84));var _0x998b=function(_0x599fd2,_0x2bea83){_0x599fd2=_0x599fd2-0x0;var _0x467b51=_0x98b9[_0x599fd2];return _0x467b51;};'use strict';var _=require(_0x998b('0x0'));var util=require(_0x998b('0x1'));var moment=require(_0x998b('0x2'));var BPromise=require(_0x998b('0x3'));var rs=require(_0x998b('0x4'));var fs=require('fs');var Redis=require(_0x998b('0x5'));var db=require(_0x998b('0x6'))['db'];var utils=require(_0x998b('0x7'));var logger=require(_0x998b('0x8'))(_0x998b('0x9'));var config=require(_0x998b('0xa'));var jayson=require(_0x998b('0xb'));var client=jayson[_0x998b('0xc')][_0x998b('0xd')]({'port':0x232a});config[_0x998b('0xe')]=_[_0x998b('0xf')](config[_0x998b('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x998b('0x10'))[_0x998b('0x11')](socket);function respondWithRpcPromise(_0x4c90f2,_0x5ed447,_0x2baa5d){return new BPromise(function(_0x5dbf15,_0x3b697a){return client[_0x998b('0x12')](_0x4c90f2,_0x2baa5d)[_0x998b('0x13')](function(_0x2b6e45){logger[_0x998b('0x14')]('ChatWebsite,\x20%s,\x20%s',_0x5ed447,_0x998b('0x15'));logger[_0x998b('0x16')](_0x998b('0x17'),_0x5ed447,'request\x20sent',JSON['stringify'](_0x2b6e45));if(_0x2b6e45[_0x998b('0x18')]){if(_0x2b6e45[_0x998b('0x18')][_0x998b('0x19')]===0x1f4){logger[_0x998b('0x18')]('ChatWebsite,\x20%s,\x20%s',_0x5ed447,_0x2b6e45[_0x998b('0x18')]['message']);return _0x3b697a(_0x2b6e45[_0x998b('0x18')]['message']);}logger[_0x998b('0x18')](_0x998b('0x1a'),_0x5ed447,_0x2b6e45[_0x998b('0x18')][_0x998b('0x1b')]);return _0x5dbf15(_0x2b6e45[_0x998b('0x18')][_0x998b('0x1b')]);}else{logger[_0x998b('0x14')](_0x998b('0x1a'),_0x5ed447,_0x998b('0x15'));_0x5dbf15(_0x2b6e45[_0x998b('0x1c')][_0x998b('0x1b')]);}})[_0x998b('0x1d')](function(_0x2b198d){logger[_0x998b('0x18')](_0x998b('0x1a'),_0x5ed447,_0x2b198d);_0x3b697a(_0x2b198d);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 68de689..13e61dd 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 _0x1cb4=['emit','removeListener','chatWebsite:','./chatWebsite.events','save'];(function(_0x2a5755,_0x17f587){var _0x1700da=function(_0x40c908){while(--_0x40c908){_0x2a5755['push'](_0x2a5755['shift']());}};_0x1700da(++_0x17f587);}(_0x1cb4,0xb2));var _0x41cb=function(_0x584342,_0x2159a0){_0x584342=_0x584342-0x0;var _0x3cca99=_0x1cb4[_0x584342];return _0x3cca99;};'use strict';var ChatWebsiteEvents=require(_0x41cb('0x0'));var events=[_0x41cb('0x1'),'remove','update'];function createListener(_0x593865,_0x258ff4){return function(_0x432627){_0x258ff4[_0x41cb('0x2')](_0x593865,_0x432627);};}function removeListener(_0x5b0363,_0x4ced44){return function(){ChatWebsiteEvents[_0x41cb('0x3')](_0x5b0363,_0x4ced44);};}exports['register']=function(_0x2502fd){for(var _0x4ec3c7=0x0,_0x3e52a6=events['length'];_0x4ec3c7<_0x3e52a6;_0x4ec3c7++){var _0x2fbd07=events[_0x4ec3c7];var _0x4fb8f4=createListener(_0x41cb('0x4')+_0x2fbd07,_0x2502fd);ChatWebsiteEvents['on'](_0x2fbd07,_0x4fb8f4);}}; \ No newline at end of file +var _0xe37a=['chatWebsite:','./chatWebsite.events','remove','emit','removeListener','length'];(function(_0x17066f,_0x2fb843){var _0x221b86=function(_0x1747ee){while(--_0x1747ee){_0x17066f['push'](_0x17066f['shift']());}};_0x221b86(++_0x2fb843);}(_0xe37a,0xe5));var _0xae37=function(_0x1058e5,_0x440855){_0x1058e5=_0x1058e5-0x0;var _0x9a8e3d=_0xe37a[_0x1058e5];return _0x9a8e3d;};'use strict';var ChatWebsiteEvents=require(_0xae37('0x0'));var events=['save',_0xae37('0x1'),'update'];function createListener(_0x1d5ea0,_0x47fe00){return function(_0x5d8173){_0x47fe00[_0xae37('0x2')](_0x1d5ea0,_0x5d8173);};}function removeListener(_0x1259e9,_0x4af123){return function(){ChatWebsiteEvents[_0xae37('0x3')](_0x1259e9,_0x4af123);};}exports['register']=function(_0x4765ed){for(var _0x479910=0x0,_0x5aa0c7=events[_0xae37('0x4')];_0x479910<_0x5aa0c7;_0x479910++){var _0x536851=events[_0x479910];var _0x4cf37f=createListener(_0xae37('0x5')+_0x536851,_0x4765ed);ChatWebsiteEvents['on'](_0x536851,_0x4cf37f);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/helpers/wildcard-expressions.js b/server/api/chatWebsite/helpers/wildcard-expressions.js index 9c6cca9..3a697ea 100644 --- a/server/api/chatWebsite/helpers/wildcard-expressions.js +++ b/server/api/chatWebsite/helpers/wildcard-expressions.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa498=['escapeRegExp','url','localhost','test','trim','([\x5cw]+)','replace','exports','../../../utils/misc'];(function(_0xa4f636,_0xaca1b6){var _0x37e02a=function(_0x49bd47){while(--_0x49bd47){_0xa4f636['push'](_0xa4f636['shift']());}};_0x37e02a(++_0xaca1b6);}(_0xa498,0x179));var _0x8a49=function(_0x280ae7,_0x456fb1){_0x280ae7=_0x280ae7-0x0;var _0x418b9e=_0xa498[_0x280ae7];return _0x418b9e;};var escapeRegExp=require(_0x8a49('0x0'))[_0x8a49('0x1')];var URL=require(_0x8a49('0x2'))['URL'];function testWildcardValidity(_0x35e092){var _0x3c8f12=!![];try{new URL(_0x35e092['replace']('*',_0x8a49('0x3')));}catch(_0x4630fe){_0x3c8f12=![];}return _0x3c8f12&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x8a49('0x4')](_0x35e092);}function testWebsiteWithWildcard(_0x2e7948,_0x17d85c){var _0x35a826;var _0x580bd3=escapeRegExp(_0x2e7948[_0x8a49('0x5')]()['replace'](/\/$/,''))['replace']('\x5c*',_0x8a49('0x6'));try{new URL(_0x2e7948[_0x8a49('0x7')]('\x5c*',_0x8a49('0x3')));_0x35a826=new RegExp(_0x580bd3)[_0x8a49('0x4')](_0x17d85c);}catch(_0x26ee03){_0x35a826=![];}return _0x35a826;}module[_0x8a49('0x8')]={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file +var _0xffd6=['escapeRegExp','url','replace','localhost','test','trim','([\x5cw]+)','../../../utils/misc'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xffd6,0x97));var _0x6ffd=function(_0x16db8b,_0xca7d28){_0x16db8b=_0x16db8b-0x0;var _0x5ba017=_0xffd6[_0x16db8b];return _0x5ba017;};var escapeRegExp=require(_0x6ffd('0x0'))[_0x6ffd('0x1')];var URL=require(_0x6ffd('0x2'))['URL'];function testWildcardValidity(_0x589640){var _0x305b6b=!![];try{new URL(_0x589640[_0x6ffd('0x3')]('*',_0x6ffd('0x4')));}catch(_0x560afa){_0x305b6b=![];}return _0x305b6b&&new RegExp(/(http(s)?):\/\/(\*|(((\*\.)+)?([a-zA-Z0-9\-_]+\.){0,}([a-zA-Z0-9\-_]+)))(:[\d]+)?\/?$/)[_0x6ffd('0x5')](_0x589640);}function testWebsiteWithWildcard(_0x173979,_0x3b8a46){var _0x2949a4;var _0x561055=escapeRegExp(_0x173979[_0x6ffd('0x6')]()[_0x6ffd('0x3')](/\/$/,''))[_0x6ffd('0x3')]('\x5c*',_0x6ffd('0x7'));try{new URL(_0x173979[_0x6ffd('0x3')]('\x5c*','localhost'));_0x2949a4=new RegExp(_0x561055)[_0x6ffd('0x5')](_0x3b8a46);}catch(_0x417f34){_0x2949a4=![];}return _0x2949a4;}module['exports']={'testWebsiteWithWildcard':testWebsiteWithWildcard,'testWildcardValidity':testWildcardValidity}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index d6e51e6..c89c06c 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 _0x91b0=['/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/users','create','post','addDisposition','addAnswer','diskStorage','server/files/images/logos/','format','%s-%s','now','originalname','single','file','addLogo','addAvatar','root','addCustomerAvatar','join','server/files/images/avatars/','/:id/system_avatar','addSystemAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','/:id/offline','any','addInteraction','addApplications','addProactiveActions','addAgents','put','update','delete','removeAnswers','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id','show'];(function(_0x3fd89f,_0x5d2f5e){var _0x1f2af8=function(_0x14c264){while(--_0x14c264){_0x3fd89f['push'](_0x3fd89f['shift']());}};_0x1f2af8(++_0x5d2f5e);}(_0x91b0,0x1c9));var _0x091b=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0x91b0[_0x5783f4];return _0x28e380;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x091b('0x0'));var timeout=require(_0x091b('0x1'));var express=require(_0x091b('0x2'));var router=express[_0x091b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x091b('0x4'));var interaction=require(_0x091b('0x5'));var config=require(_0x091b('0x6'));var controller=require('./chatWebsite.controller');router[_0x091b('0x7')]('/',auth['isAuthenticated'](),controller[_0x091b('0x8')]);router[_0x091b('0x7')]('/describe',auth[_0x091b('0x9')](),controller['describe']);router[_0x091b('0x7')](_0x091b('0xa'),auth[_0x091b('0x9')](),controller[_0x091b('0xb')]);router[_0x091b('0x7')](_0x091b('0xc'),auth['isAuthenticated'](),controller[_0x091b('0xd')]);router[_0x091b('0x7')](_0x091b('0xe'),auth[_0x091b('0x9')](),controller[_0x091b('0xf')]);router[_0x091b('0x7')](_0x091b('0x10'),controller[_0x091b('0x11')]);router[_0x091b('0x7')](_0x091b('0x12'),controller['getAvatar']);router['get'](_0x091b('0x13'),controller[_0x091b('0x14')]);router['get']('/:id/system_avatar',controller['getSystemAvatar']);router[_0x091b('0x7')](_0x091b('0x15'),auth[_0x091b('0x9')](),controller[_0x091b('0x16')]);router[_0x091b('0x7')](_0x091b('0x17'),controller[_0x091b('0x18')]);router[_0x091b('0x7')](_0x091b('0x19'),auth[_0x091b('0x9')](),controller[_0x091b('0x1a')]);router[_0x091b('0x7')](_0x091b('0x1b'),auth[_0x091b('0x9')](),controller[_0x091b('0x1c')]);router['get'](_0x091b('0x1d'),controller['getFields']);router[_0x091b('0x7')]('/:id/offline_messages',auth[_0x091b('0x9')](),controller['getOfflineMessages']);router[_0x091b('0x7')](_0x091b('0x1e'),auth[_0x091b('0x9')](),controller['getAgents']);router['post']('/',auth[_0x091b('0x9')](),controller[_0x091b('0x1f')]);router[_0x091b('0x20')](_0x091b('0xc'),auth[_0x091b('0x9')](),controller[_0x091b('0x21')]);router[_0x091b('0x20')]('/:id/canned_answers',auth[_0x091b('0x9')](),controller[_0x091b('0x22')]);var upload=multer({'storage':multer[_0x091b('0x23')]({'destination':function(_0x1869d2,_0x40d567,_0x7c0556){_0x7c0556(null,path['join'](config['root'],_0x091b('0x24')));},'filename':function(_0x1d0b6a,_0x367a47,_0xf7faa){_0xf7faa(null,util[_0x091b('0x25')](_0x091b('0x26'),Date[_0x091b('0x27')](),_0x367a47[_0x091b('0x28')]));}})});router[_0x091b('0x20')](_0x091b('0x10'),upload[_0x091b('0x29')](_0x091b('0x2a')),controller[_0x091b('0x2b')]);var upload=multer({'storage':multer[_0x091b('0x23')]({'destination':function(_0x149a99,_0x378d10,_0x2151e8){_0x2151e8(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x4c3c1e,_0x5089e1,_0x455ce5){_0x455ce5(null,util['format'](_0x091b('0x26'),Date[_0x091b('0x27')](),_0x5089e1['originalname']));}})});router[_0x091b('0x20')](_0x091b('0x12'),upload['single'](_0x091b('0x2a')),controller[_0x091b('0x2c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x13c2d3,_0x526ea9,_0x3f9d6a){_0x3f9d6a(null,path['join'](config[_0x091b('0x2d')],'server/files/images/avatars/'));},'filename':function(_0x1e80a1,_0x422986,_0x718cc9){_0x718cc9(null,util[_0x091b('0x25')](_0x091b('0x26'),Date[_0x091b('0x27')](),_0x422986[_0x091b('0x28')]));}})});router[_0x091b('0x20')]('/:id/customer_avatar',upload['single'](_0x091b('0x2a')),controller[_0x091b('0x2e')]);var upload=multer({'storage':multer[_0x091b('0x23')]({'destination':function(_0x2f1d3a,_0x515761,_0x425fb6){_0x425fb6(null,path[_0x091b('0x2f')](config['root'],_0x091b('0x30')));},'filename':function(_0x22fffb,_0x377f76,_0x4e143b){_0x4e143b(null,util['format']('%s-%s',Date[_0x091b('0x27')](),_0x377f76['originalname']));}})});router['post'](_0x091b('0x31'),upload[_0x091b('0x29')](_0x091b('0x2a')),controller[_0x091b('0x32')]);router['post'](_0x091b('0x33'),controller[_0x091b('0x34')]);const offlineUploadMulter=multer({'storage':multer[_0x091b('0x23')]({'destination':function(_0x41fea6,_0x2b58b8,_0x481c5a){const _0x1f24c7=path['join'](config[_0x091b('0x2d')],_0x091b('0x35'),'attachments',_0x091b('0x36'));fs_extra[_0x091b('0x37')](_0x1f24c7,function(){_0x481c5a(null,_0x1f24c7);});},'filename':function(_0x1376a3,_0x53d4b3,_0x1bde22){const _0x45e208=_0x53d4b3[_0x091b('0x28')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x472738=path['extname'](_0x45e208);const _0x48479e=Date['now']()+'-'+_0x45e208['replace'](_0x472738,'')+_0x472738;_0x1bde22(null,_0x48479e);}})});router[_0x091b('0x20')](_0x091b('0x38'),offlineUploadMulter[_0x091b('0x39')](),controller['offline']);router[_0x091b('0x20')](_0x091b('0x15'),auth[_0x091b('0x9')](),controller[_0x091b('0x3a')]);router[_0x091b('0x20')](_0x091b('0x19'),auth[_0x091b('0x9')](),controller[_0x091b('0x3b')]);router[_0x091b('0x20')](_0x091b('0x1b'),auth[_0x091b('0x9')](),controller[_0x091b('0x3c')]);router['post'](_0x091b('0x1e'),auth['isAuthenticated'](),controller[_0x091b('0x3d')]);router[_0x091b('0x3e')](_0x091b('0xa'),auth[_0x091b('0x9')](),controller[_0x091b('0x3f')]);router[_0x091b('0x40')](_0x091b('0xa'),auth[_0x091b('0x9')](),controller['destroy']);router['delete'](_0x091b('0xc'),auth['isAuthenticated'](),controller['removeDispositions']);router['delete'](_0x091b('0xe'),auth['isAuthenticated'](),controller[_0x091b('0x41')]);router[_0x091b('0x40')](_0x091b('0x1e'),auth[_0x091b('0x9')](),controller['removeAgents']);module[_0x091b('0x42')]=router; \ No newline at end of file +var _0x88ac=['getAnswers','/:id/logo','/:id/avatar','getAvatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','/:id/offline_messages','getOfflineMessages','post','create','addDisposition','addAnswer','join','root','server/files/images/logos/','%s-%s','now','originalname','file','addLogo','diskStorage','format','single','addAvatar','server/files/images/avatars/','/:id/customer_avatar','addCustomerAvatar','addSystemAvatar','/:id/notify','notify','server/files','attachments','offline-chat','ensureDir','replace','extname','/:id/offline','any','/:id/interactions','addInteraction','addApplications','addProactiveActions','/:id/users','addAgents','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./chatWebsite.controller','isAuthenticated','get','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x88ac,0x1a2));var _0xc88a=function(_0x1c3bed,_0x1736f9){_0x1c3bed=_0x1c3bed-0x0;var _0x1302b9=_0x88ac[_0x1c3bed];return _0x1302b9;};'use strict';var multer=require(_0xc88a('0x0'));var util=require(_0xc88a('0x1'));var path=require(_0xc88a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc88a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xc88a('0x4'));var interaction=require(_0xc88a('0x5'));var config=require('../../config/environment');var controller=require(_0xc88a('0x6'));router['get']('/',auth[_0xc88a('0x7')](),controller['index']);router[_0xc88a('0x8')]('/describe',auth[_0xc88a('0x7')](),controller['describe']);router[_0xc88a('0x8')](_0xc88a('0x9'),auth[_0xc88a('0x7')](),controller[_0xc88a('0xa')]);router['get'](_0xc88a('0xb'),auth[_0xc88a('0x7')](),controller[_0xc88a('0xc')]);router[_0xc88a('0x8')](_0xc88a('0xd'),auth['isAuthenticated'](),controller[_0xc88a('0xe')]);router[_0xc88a('0x8')](_0xc88a('0xf'),controller['getLogo']);router[_0xc88a('0x8')](_0xc88a('0x10'),controller[_0xc88a('0x11')]);router[_0xc88a('0x8')]('/:id/customer_avatar',controller['getCustomerAvatar']);router['get'](_0xc88a('0x12'),controller[_0xc88a('0x13')]);router[_0xc88a('0x8')]('/:id/interactions',auth[_0xc88a('0x7')](),controller[_0xc88a('0x14')]);router['get'](_0xc88a('0x15'),controller[_0xc88a('0x16')]);router['get'](_0xc88a('0x17'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x18')]);router[_0xc88a('0x8')](_0xc88a('0x19'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x1a')]);router[_0xc88a('0x8')](_0xc88a('0x1b'),controller['getFields']);router[_0xc88a('0x8')](_0xc88a('0x1c'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x1d')]);router[_0xc88a('0x8')]('/:id/users',auth[_0xc88a('0x7')](),controller['getAgents']);router[_0xc88a('0x1e')]('/',auth[_0xc88a('0x7')](),controller[_0xc88a('0x1f')]);router[_0xc88a('0x1e')](_0xc88a('0xb'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x20')]);router[_0xc88a('0x1e')](_0xc88a('0xd'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5394a9,_0x1ad6be,_0x2f685d){_0x2f685d(null,path[_0xc88a('0x22')](config[_0xc88a('0x23')],_0xc88a('0x24')));},'filename':function(_0x501c74,_0x371c6d,_0x260239){_0x260239(null,util['format'](_0xc88a('0x25'),Date[_0xc88a('0x26')](),_0x371c6d[_0xc88a('0x27')]));}})});router[_0xc88a('0x1e')](_0xc88a('0xf'),upload['single'](_0xc88a('0x28')),controller[_0xc88a('0x29')]);var upload=multer({'storage':multer[_0xc88a('0x2a')]({'destination':function(_0x5804c7,_0x5a9533,_0x2b0611){_0x2b0611(null,path[_0xc88a('0x22')](config[_0xc88a('0x23')],'server/files/images/avatars/'));},'filename':function(_0x208d6c,_0x39d172,_0x141a41){_0x141a41(null,util[_0xc88a('0x2b')]('%s-%s',Date['now'](),_0x39d172[_0xc88a('0x27')]));}})});router[_0xc88a('0x1e')]('/:id/avatar',upload[_0xc88a('0x2c')](_0xc88a('0x28')),controller[_0xc88a('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x586aa7,_0x395c67,_0x141b43){_0x141b43(null,path[_0xc88a('0x22')](config[_0xc88a('0x23')],_0xc88a('0x2e')));},'filename':function(_0x364f70,_0x28cb36,_0x377eef){_0x377eef(null,util['format'](_0xc88a('0x25'),Date['now'](),_0x28cb36[_0xc88a('0x27')]));}})});router['post'](_0xc88a('0x2f'),upload[_0xc88a('0x2c')](_0xc88a('0x28')),controller[_0xc88a('0x30')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x58e207,_0x4e3077,_0x1b76a0){_0x1b76a0(null,path['join'](config[_0xc88a('0x23')],_0xc88a('0x2e')));},'filename':function(_0x38971a,_0x768d04,_0x68d00a){_0x68d00a(null,util[_0xc88a('0x2b')]('%s-%s',Date[_0xc88a('0x26')](),_0x768d04['originalname']));}})});router['post']('/:id/system_avatar',upload['single']('file'),controller[_0xc88a('0x31')]);router['post'](_0xc88a('0x32'),controller[_0xc88a('0x33')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x5bbbdd,_0x508717,_0x50b533){const _0x1c3560=path[_0xc88a('0x22')](config[_0xc88a('0x23')],_0xc88a('0x34'),_0xc88a('0x35'),_0xc88a('0x36'));fs_extra[_0xc88a('0x37')](_0x1c3560,function(){_0x50b533(null,_0x1c3560);});},'filename':function(_0xa0fcd0,_0x24e07c,_0x23a6ff){const _0x30201d=_0x24e07c[_0xc88a('0x27')][_0xc88a('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x44166c=path[_0xc88a('0x39')](_0x30201d);const _0x52f7bd=Date[_0xc88a('0x26')]()+'-'+_0x30201d['replace'](_0x44166c,'')+_0x44166c;_0x23a6ff(null,_0x52f7bd);}})});router[_0xc88a('0x1e')](_0xc88a('0x3a'),offlineUploadMulter[_0xc88a('0x3b')](),controller['offline']);router[_0xc88a('0x1e')](_0xc88a('0x3c'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x3d')]);router[_0xc88a('0x1e')]('/:id/applications',auth[_0xc88a('0x7')](),controller[_0xc88a('0x3e')]);router['post'](_0xc88a('0x19'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x3f')]);router[_0xc88a('0x1e')](_0xc88a('0x40'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x41')]);router['put'](_0xc88a('0x9'),auth[_0xc88a('0x7')](),controller['update']);router['delete'](_0xc88a('0x9'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x42')]);router[_0xc88a('0x43')](_0xc88a('0xb'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x44')]);router['delete'](_0xc88a('0xd'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x45')]);router[_0xc88a('0x43')](_0xc88a('0x40'),auth[_0xc88a('0x7')](),controller[_0xc88a('0x46')]);module[_0xc88a('0x47')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index 41ed696..204ebe5 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 _0x3b0f=['get','expressEndpoint','use','isAuthenticated','exports','express','../components/auth/service','Router','env','production','app'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0x3b0f,0x1c8));var _0xf3b0=function(_0x3a02dd,_0x52392b){_0x3a02dd=_0x3a02dd-0x0;var _0x5988e8=_0x3b0f[_0x3a02dd];return _0x5988e8;};var beaverLogger=require('beaver-logger/server');var express=require(_0xf3b0('0x0'));var auth=require(_0xf3b0('0x1'));var config=require('../config/environment');var router=express[_0xf3b0('0x2')]();var isProduction=config[_0xf3b0('0x3')]===_0xf3b0('0x4')||![];function clientSideLogs(_0x51c85f,_0x119015,_0x544f32){var _0x4f27ef=_0x51c85f[_0xf3b0('0x5')][_0xf3b0('0x6')]('client-side-logger');if(!_0x4f27ef){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger[_0xf3b0('0x7')]({'uri':'/client-logs','logger':_0x4f27ef,'enableCors':!isProduction})(_0x51c85f,_0x119015,_0x544f32);}router[_0xf3b0('0x8')](auth[_0xf3b0('0x9')](),clientSideLogs);module[_0xf3b0('0xa')]=router; \ No newline at end of file +var _0x9ec1=['client-side-logger','Client-Side\x20logger\x20not\x20found!','expressEndpoint','/client-logs','use','isAuthenticated','express','../components/auth/service','../config/environment','Router','env','production','app','get'];(function(_0x501b95,_0x1e7d66){var _0x118ba2=function(_0x37e09b){while(--_0x37e09b){_0x501b95['push'](_0x501b95['shift']());}};_0x118ba2(++_0x1e7d66);}(_0x9ec1,0x13a));var _0x19ec=function(_0x499001,_0x3f27ae){_0x499001=_0x499001-0x0;var _0x320c65=_0x9ec1[_0x499001];return _0x320c65;};var beaverLogger=require('beaver-logger/server');var express=require(_0x19ec('0x0'));var auth=require(_0x19ec('0x1'));var config=require(_0x19ec('0x2'));var router=express[_0x19ec('0x3')]();var isProduction=config[_0x19ec('0x4')]===_0x19ec('0x5')||![];function clientSideLogs(_0x2a3dc9,_0x202ac2,_0x33d4af){var _0x3eb98a=_0x2a3dc9[_0x19ec('0x6')][_0x19ec('0x7')](_0x19ec('0x8'));if(!_0x3eb98a){throw new Error(_0x19ec('0x9'));}return beaverLogger[_0x19ec('0xa')]({'uri':_0x19ec('0xb'),'logger':_0x3eb98a,'enableCors':!isProduction})(_0x2a3dc9,_0x202ac2,_0x33d4af);}router[_0x19ec('0xc')](auth[_0x19ec('0xd')](),clientSideLogs);module['exports']=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index c845aca..12f8919 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 _0xdf09=['TEXT','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','STRING','ENUM','AmazonAWS','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_secret'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0xdf09,0x185));var _0x9df0=function(_0x3307ab,_0x4ecbda){_0x3307ab=_0x3307ab-0x0;var _0x1ee655=_0xdf09[_0x3307ab];return _0x1ee655;};'use strict';var Sequelize=require(_0x9df0('0x0'));module['exports']={'name':{'type':Sequelize[_0x9df0('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x9df0('0x2')](_0x9df0('0x3'),'Google',_0x9df0('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x9df0('0x2')](_0x9df0('0x5'),'Dynamics365')},'data1':{'type':Sequelize['STRING'],'comment':'MicrosoftAzure\x20=>\x20client_id'},'data2':{'type':Sequelize[_0x9df0('0x1')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0x9df0('0x1')],'comment':_0x9df0('0x6')},'data4':{'type':Sequelize[_0x9df0('0x1')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize['TEXT'],'comment':'MicrosoftAzure\x20=>\x20access_token'},'data6':{'type':Sequelize[_0x9df0('0x7')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0x9df0('0x7')],'comment':_0x9df0('0x8')}}; \ No newline at end of file +var _0x7715=['MicrosoftAzure\x20=>\x20tenant','MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','sequelize','exports','STRING','ENUM','AmazonAWS','Google','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id'];(function(_0x3abab3,_0x4aaebb){var _0x44a5c8=function(_0x25c9b9){while(--_0x25c9b9){_0x3abab3['push'](_0x3abab3['shift']());}};_0x44a5c8(++_0x4aaebb);}(_0x7715,0x17d));var _0x5771=function(_0x1bfbe7,_0x34e702){_0x1bfbe7=_0x1bfbe7-0x0;var _0x452f2c=_0x7715[_0x1bfbe7];return _0x452f2c;};'use strict';var Sequelize=require(_0x5771('0x0'));module[_0x5771('0x1')]={'name':{'type':Sequelize[_0x5771('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5771('0x3')](_0x5771('0x4'),_0x5771('0x5'),_0x5771('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x5771('0x3')](_0x5771('0x7'),'Dynamics365')},'data1':{'type':Sequelize[_0x5771('0x2')],'comment':_0x5771('0x8')},'data2':{'type':Sequelize[_0x5771('0x2')],'comment':_0x5771('0x9')},'data3':{'type':Sequelize['STRING'],'comment':_0x5771('0xa')},'data4':{'type':Sequelize[_0x5771('0x2')],'comment':_0x5771('0xb')},'data5':{'type':Sequelize[_0x5771('0xc')],'comment':_0x5771('0xd')},'data6':{'type':Sequelize[_0x5771('0xc')],'comment':_0x5771('0xe')},'data7':{'type':Sequelize[_0x5771('0xc')],'comment':'MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri'}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index 2defbcb..59cb67c 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 _0x70dc=['get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','del','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','json','limit','undefined','offset','count','status','set','Content-Range','then','destroy','sendStatus','error','stack','name','send','padEnd','index','CloudProvider','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','rows','service','MicrosoftAzure','decryptString','data3','catch','show','params','keys','length','options','find','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','encryptString','update','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user'];(function(_0x34bc30,_0x177cb0){var _0x5706de=function(_0x535a8c){while(--_0x535a8c){_0x34bc30['push'](_0x34bc30['shift']());}};_0x5706de(++_0x177cb0);}(_0x70dc,0x199));var _0xc70d=function(_0x42dc68,_0x565387){_0x42dc68=_0x42dc68-0x0;var _0xed76e=_0x70dc[_0x42dc68];return _0xed76e;};'use strict';var _=require(_0xc70d('0x0'));var Redis=require(_0xc70d('0x1'));var qs=require(_0xc70d('0x2'));var encryptor=require(_0xc70d('0x3'));var config=require(_0xc70d('0x4'));var logger=require(_0xc70d('0x5'))(_0xc70d('0x6'));var db=require('../../mysqldb')['db'];var oauth=require(_0xc70d('0x7'));config[_0xc70d('0x8')]=_[_0xc70d('0x9')](config[_0xc70d('0x8')],{'host':_0xc70d('0xa'),'port':0x18eb});var socket=require(_0xc70d('0xb'))(new Redis(config[_0xc70d('0x8')]));var redis=new Redis(config[_0xc70d('0x8')]);function respondWithStatusCode(_0x1620e5,_0x379607){_0x379607=_0x379607||0xcc;return function(_0x1c8137){if(_0x1c8137){return _0x1620e5['sendStatus'](_0x379607);}return _0x1620e5['status'](_0x379607)['end']();};}function respondWithResult(_0x1ae7de,_0x264562){_0x264562=_0x264562||0xc8;return function(_0x1984a6){if(_0x1984a6){return _0x1ae7de['status'](_0x264562)[_0xc70d('0xc')](_0x1984a6);}};}function respondWithFilteredResult(_0x55ae21,_0x3bf3f7){return function(_0x468a6c){if(_0x468a6c){var _0xeb9fb8=typeof _0x3bf3f7['offset']==='undefined'&&typeof _0x3bf3f7[_0xc70d('0xd')]===_0xc70d('0xe');var _0x516d77=_0x468a6c['count'];var _0x4e7171=_0xeb9fb8?0x0:_0x3bf3f7[_0xc70d('0xf')];var _0x18b065=_0xeb9fb8?_0x468a6c[_0xc70d('0x10')]:_0x3bf3f7[_0xc70d('0xf')]+_0x3bf3f7[_0xc70d('0xd')];var _0x57148b;if(_0x18b065>=_0x516d77){_0x18b065=_0x516d77;_0x57148b=0xc8;}else{_0x57148b=0xce;}_0x55ae21[_0xc70d('0x11')](_0x57148b);return _0x55ae21[_0xc70d('0x12')](_0xc70d('0x13'),_0x4e7171+'-'+_0x18b065+'/'+_0x516d77)[_0xc70d('0xc')](_0x468a6c);}return null;};}function saveUpdates(_0x47fa47){return function(_0x165469){if(_0x165469){return _0x165469['update'](_0x47fa47)[_0xc70d('0x14')](function(_0x149f51){return _0x149f51;});}return null;};}function removeEntity(_0x39cc7e){return function(_0x241ade){if(_0x241ade){return _0x241ade[_0xc70d('0x15')]()[_0xc70d('0x14')](function(){_0x39cc7e[_0xc70d('0x11')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27f309){return function(_0x4088a2){if(!_0x4088a2){_0x27f309[_0xc70d('0x16')](0x194);}return _0x4088a2;};}function handleError(_0x2b6792,_0x592ff1){_0x592ff1=_0x592ff1||0x1f4;return function(_0x330560){logger[_0xc70d('0x17')](_0x330560[_0xc70d('0x18')]);if(_0x330560[_0xc70d('0x19')]){delete _0x330560[_0xc70d('0x19')];}_0x2b6792[_0xc70d('0x11')](_0x592ff1)[_0xc70d('0x1a')](_0x330560);};}function maskClientSecret(_0x52051c){return _[_0xc70d('0x1b')](_0x52051c['slice'](0x0,0x3),0x14,'*');}exports[_0xc70d('0x1c')]=function(_0x5c67c4,_0x361269){var _0x1d913f={},_0x2f87b3={},_0x1de9f5={'count':0x0,'rows':[]};var _0x41b696=_['map'](db[_0xc70d('0x1d')][_0xc70d('0x1e')],function(_0x5b7094){return{'name':_0x5b7094[_0xc70d('0x1f')],'type':_0x5b7094[_0xc70d('0x20')]['key']};});_0x2f87b3[_0xc70d('0x21')]=_[_0xc70d('0x22')](_0x41b696,_0xc70d('0x19'));_0x2f87b3[_0xc70d('0x23')]=_['keys'](_0x5c67c4[_0xc70d('0x23')]);_0x2f87b3[_0xc70d('0x24')]=_[_0xc70d('0x25')](_0x2f87b3[_0xc70d('0x21')],_0x2f87b3[_0xc70d('0x23')]);_0x1d913f[_0xc70d('0x26')]=_[_0xc70d('0x25')](_0x2f87b3['model'],qs[_0xc70d('0x27')](_0x5c67c4[_0xc70d('0x23')]['fields']));_0x1d913f[_0xc70d('0x26')]=_0x1d913f[_0xc70d('0x26')]['length']?_0x1d913f[_0xc70d('0x26')]:_0x2f87b3[_0xc70d('0x21')];if(!_0x5c67c4['query'][_0xc70d('0x28')](_0xc70d('0x29'))){_0x1d913f[_0xc70d('0xd')]=qs[_0xc70d('0xd')](_0x5c67c4[_0xc70d('0x23')][_0xc70d('0xd')]);_0x1d913f[_0xc70d('0xf')]=qs[_0xc70d('0xf')](_0x5c67c4[_0xc70d('0x23')][_0xc70d('0xf')]);}_0x1d913f[_0xc70d('0x2a')]=qs[_0xc70d('0x2b')](_0x5c67c4[_0xc70d('0x23')][_0xc70d('0x2b')]);_0x1d913f[_0xc70d('0x2c')]=qs[_0xc70d('0x24')](_[_0xc70d('0x2d')](_0x5c67c4[_0xc70d('0x23')],_0x2f87b3[_0xc70d('0x24')]),_0x41b696);if(_0x5c67c4['query']['filter']){_0x1d913f[_0xc70d('0x2c')]=_[_0xc70d('0x2e')](_0x1d913f[_0xc70d('0x2c')],{'$or':_['map'](_0x41b696,function(_0x371925){if(_0x371925[_0xc70d('0x20')]!==_0xc70d('0x2f')){var _0x537a74={};_0x537a74[_0x371925[_0xc70d('0x19')]]={'$like':'%'+_0x5c67c4['query'][_0xc70d('0x30')]+'%'};return _0x537a74;}})});}_0x1d913f=_[_0xc70d('0x2e')]({},_0x1d913f,_0x5c67c4['options']);var _0xcaeb44={'where':_0x1d913f[_0xc70d('0x2c')]};return db[_0xc70d('0x1d')][_0xc70d('0x10')](_0xcaeb44)[_0xc70d('0x14')](function(_0x1b30e8){_0x1de9f5[_0xc70d('0x10')]=_0x1b30e8;if(_0x5c67c4[_0xc70d('0x23')][_0xc70d('0x31')]){_0x1d913f[_0xc70d('0x32')]=[{'all':!![]}];}return db[_0xc70d('0x1d')]['findAll'](_0x1d913f);})['then'](function(_0x4d30a9){_0x1de9f5[_0xc70d('0x33')]=_[_0xc70d('0x22')](_0x4d30a9,function(_0x2cb455){if(_0x2cb455[_0xc70d('0x34')]===_0xc70d('0x35')){var _0x4b1b83=encryptor[_0xc70d('0x36')](_0x2cb455[_0xc70d('0x37')]);_0x2cb455['data3']=maskClientSecret(_0x4b1b83);}return _0x2cb455;});return _0x1de9f5;})[_0xc70d('0x14')](respondWithFilteredResult(_0x361269,_0x1d913f))[_0xc70d('0x38')](handleError(_0x361269,null));};exports[_0xc70d('0x39')]=function(_0x42a876,_0x1785e0){var _0x517bf5={'raw':!![],'where':{'id':_0x42a876[_0xc70d('0x3a')]['id']}},_0x215f92={};_0x215f92[_0xc70d('0x21')]=_[_0xc70d('0x3b')](db[_0xc70d('0x1d')][_0xc70d('0x1e')]);_0x215f92[_0xc70d('0x23')]=_['keys'](_0x42a876[_0xc70d('0x23')]);_0x215f92[_0xc70d('0x24')]=_['intersection'](_0x215f92['model'],_0x215f92[_0xc70d('0x23')]);_0x517bf5['attributes']=_[_0xc70d('0x25')](_0x215f92[_0xc70d('0x21')],qs[_0xc70d('0x27')](_0x42a876[_0xc70d('0x23')][_0xc70d('0x27')]));_0x517bf5[_0xc70d('0x26')]=_0x517bf5[_0xc70d('0x26')][_0xc70d('0x3c')]?_0x517bf5[_0xc70d('0x26')]:_0x215f92[_0xc70d('0x21')];if(_0x42a876[_0xc70d('0x23')][_0xc70d('0x31')]){_0x517bf5[_0xc70d('0x32')]=[{'all':!![]}];}_0x517bf5=_['merge']({},_0x517bf5,_0x42a876[_0xc70d('0x3d')]);return db[_0xc70d('0x1d')][_0xc70d('0x3e')](_0x517bf5)[_0xc70d('0x14')](handleEntityNotFound(_0x1785e0,null))[_0xc70d('0x14')](function(_0x497b8b){if(_0x497b8b['service']==='MicrosoftAzure'){var _0x307249=encryptor[_0xc70d('0x36')](_0x497b8b[_0xc70d('0x37')]);_0x497b8b[_0xc70d('0x37')]=maskClientSecret(_0x307249);}return _0x497b8b;})['then'](respondWithResult(_0x1785e0,null))[_0xc70d('0x38')](handleError(_0x1785e0,null));};exports[_0xc70d('0x3f')]=function(_0x5d89b2,_0x15d513){if(!_0x5d89b2[_0xc70d('0x40')][_0xc70d('0x19')])throw new Error(_0xc70d('0x41'));if(!_0x5d89b2[_0xc70d('0x40')][_0xc70d('0x34')])throw new Error(_0xc70d('0x42'));var _0x19149d=db['CloudProvider'][_0xc70d('0x1e')]['service'][_0xc70d('0x43')];if(!_0x19149d[_0xc70d('0x44')](_0x5d89b2['body'][_0xc70d('0x34')]))throw new Error(_0xc70d('0x45')+_0x19149d['join'](',\x20'));if(_0x5d89b2[_0xc70d('0x40')][_0xc70d('0x34')]===_0xc70d('0x35')&&_0x5d89b2[_0xc70d('0x40')][_0xc70d('0x37')]){_0x5d89b2[_0xc70d('0x40')]['data3']=encryptor[_0xc70d('0x46')](_0x5d89b2[_0xc70d('0x40')]['data3']);}return db[_0xc70d('0x1d')][_0xc70d('0x3f')](_0x5d89b2[_0xc70d('0x40')],{})[_0xc70d('0x14')](respondWithResult(_0x15d513,0xc9))[_0xc70d('0x38')](handleError(_0x15d513,null));};exports[_0xc70d('0x47')]=function(_0x33e601,_0x2d4863){if(_0x33e601['body']['id']){delete _0x33e601['body']['id'];}return db['CloudProvider'][_0xc70d('0x3e')]({'where':{'id':_0x33e601[_0xc70d('0x3a')]['id']}})[_0xc70d('0x14')](handleEntityNotFound(_0x2d4863,null))[_0xc70d('0x14')](function(_0xf75acf){if(_0xf75acf[_0xc70d('0x34')]===_0xc70d('0x35')&&_0x33e601[_0xc70d('0x40')][_0xc70d('0x37')]){_0x33e601['body'][_0xc70d('0x37')]=encryptor[_0xc70d('0x46')](_0x33e601[_0xc70d('0x40')]['data3']);}return _0xf75acf;})[_0xc70d('0x14')](saveUpdates(_0x33e601[_0xc70d('0x40')],null))[_0xc70d('0x14')](respondWithResult(_0x2d4863,null))['catch'](handleError(_0x2d4863,null));};exports[_0xc70d('0x15')]=function(_0x25d366,_0x1e1435){return db['CloudProvider'][_0xc70d('0x3e')]({'where':{'id':_0x25d366[_0xc70d('0x3a')]['id']}})[_0xc70d('0x14')](handleEntityNotFound(_0x1e1435,null))[_0xc70d('0x14')](removeEntity(_0x1e1435,null))[_0xc70d('0x38')](handleError(_0x1e1435,null));};exports[_0xc70d('0x48')]=function(_0xb20d4b,_0x4df2eb){return db[_0xc70d('0x1d')][_0xc70d('0x49')]({'where':{'id':_0xb20d4b[_0xc70d('0x3a')]['id']},'raw':!![]})[_0xc70d('0x14')](function(_0x29e7bd){if(!_0x29e7bd)return _0x4df2eb[_0xc70d('0x16')](0x194);return{'url':oauth[_0xc70d('0x4a')](_0x29e7bd,_0xb20d4b[_0xc70d('0x4b')]['id'])};})[_0xc70d('0x14')](respondWithResult(_0x4df2eb,null))[_0xc70d('0x38')](handleError(_0x4df2eb,null));};exports['oauth2MicrosoftCallback']=function(_0x208ee9,_0x56067b){var _0x519814=_0x208ee9[_0xc70d('0x40')];var _0x390117;var _0x3e2b15;if(_0x519814[_0xc70d('0x17')])throw _0x519814;redis[_0xc70d('0x4c')](_0x519814[_0xc70d('0x4d')])[_0xc70d('0x14')](function(_0x3bb561){if(!_0x3bb561)throw new Error(_0xc70d('0x4e'));_0x390117=JSON[_0xc70d('0x4f')](_0x3bb561);var _0x9bfbd4=Buffer[_0xc70d('0x50')](_0x519814[_0xc70d('0x4d')],_0xc70d('0x51'))[_0xc70d('0x52')](_0xc70d('0x53'));_0x3e2b15=JSON[_0xc70d('0x4f')](_0x9bfbd4);if(!oauth[_0xc70d('0x54')](_0x519814[_0xc70d('0x55')],_0x390117[_0xc70d('0x56')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xc70d('0x57')](_0x519814['state']);return oauth['getOauth2MicrosoftAccessToken'](_0x519814['code'],_0x390117);})[_0xc70d('0x14')](function(_0x5cc486){_0x390117[_0xc70d('0x58')]=_0x5cc486['access_token'];_0x390117[_0xc70d('0x59')]=_0x5cc486[_0xc70d('0x5a')];return db[_0xc70d('0x1d')][_0xc70d('0x47')]({'data5':_0x390117[_0xc70d('0x58')],'data6':_0x390117[_0xc70d('0x59')]},{'where':{'id':_0x390117['id']}});})[_0xc70d('0x14')](function(){oauth[_0xc70d('0x5b')](_0x390117);socket[_0xc70d('0x5c')](_0xc70d('0x5d'),{'id':_0x3e2b15['id']});return;})[_0xc70d('0x14')](respondWithStatusCode(_0x56067b,null))['catch'](function(_0x562dcc){if(_0x3e2b15){socket[_0xc70d('0x5c')]('microsoftAuthorization:error',{'id':_0x3e2b15['id']});}if(!_0x390117){logger['error'](_0xc70d('0x5e'),_0x562dcc);return _0x56067b[_0xc70d('0x11')](0x1f4)['send'](_0x562dcc['message']);}logger['error'](_0xc70d('0x5f'),_0x390117['id'],JSON[_0xc70d('0x60')](_0x562dcc));});}; \ No newline at end of file +var _0x063e=['stringify','ioredis','../../components/parsers/qs','../../config/environment','../../config/logger','api','./cloudProvider.oauth','defaults','redis','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy','sendStatus','error','name','padEnd','slice','index','map','CloudProvider','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','count','includeAll','include','findAll','rows','MicrosoftAzure','decryptString','catch','show','params','keys','options','find','data3','body','service','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','base64','toString','ascii','isValidIdToken','id_token','oauth2Claims','del','code','data5','data6','refresh_token','startRefreshInterval','emit','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','send'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0x063e,0x1d7));var _0xe063=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x063e[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var Redis=require(_0xe063('0x0'));var qs=require(_0xe063('0x1'));var encryptor=require('../../components/encryptor');var config=require(_0xe063('0x2'));var logger=require(_0xe063('0x3'))(_0xe063('0x4'));var db=require('../../mysqldb')['db'];var oauth=require(_0xe063('0x5'));config['redis']=_[_0xe063('0x6')](config[_0xe063('0x7')],{'host':_0xe063('0x8'),'port':0x18eb});var socket=require(_0xe063('0x9'))(new Redis(config[_0xe063('0x7')]));var redis=new Redis(config[_0xe063('0x7')]);function respondWithStatusCode(_0x1945aa,_0x4bb9ea){_0x4bb9ea=_0x4bb9ea||0xcc;return function(_0x2bcb2d){if(_0x2bcb2d){return _0x1945aa['sendStatus'](_0x4bb9ea);}return _0x1945aa[_0xe063('0xa')](_0x4bb9ea)[_0xe063('0xb')]();};}function respondWithResult(_0xcebb22,_0x52fd91){_0x52fd91=_0x52fd91||0xc8;return function(_0x2bdb02){if(_0x2bdb02){return _0xcebb22[_0xe063('0xa')](_0x52fd91)[_0xe063('0xc')](_0x2bdb02);}};}function respondWithFilteredResult(_0x25d6aa,_0x13ba06){return function(_0x49a2c7){if(_0x49a2c7){var _0x5d17cd=typeof _0x13ba06[_0xe063('0xd')]===_0xe063('0xe')&&typeof _0x13ba06[_0xe063('0xf')]==='undefined';var _0x436186=_0x49a2c7['count'];var _0x55222f=_0x5d17cd?0x0:_0x13ba06['offset'];var _0x5158bc=_0x5d17cd?_0x49a2c7['count']:_0x13ba06[_0xe063('0xd')]+_0x13ba06[_0xe063('0xf')];var _0x52d870;if(_0x5158bc>=_0x436186){_0x5158bc=_0x436186;_0x52d870=0xc8;}else{_0x52d870=0xce;}_0x25d6aa[_0xe063('0xa')](_0x52d870);return _0x25d6aa[_0xe063('0x10')](_0xe063('0x11'),_0x55222f+'-'+_0x5158bc+'/'+_0x436186)[_0xe063('0xc')](_0x49a2c7);}return null;};}function saveUpdates(_0x34961d){return function(_0x24812b){if(_0x24812b){return _0x24812b[_0xe063('0x12')](_0x34961d)[_0xe063('0x13')](function(_0x4e263d){return _0x4e263d;});}return null;};}function removeEntity(_0x19b0db){return function(_0x4c0d64){if(_0x4c0d64){return _0x4c0d64[_0xe063('0x14')]()[_0xe063('0x13')](function(){_0x19b0db[_0xe063('0xa')](0xcc)[_0xe063('0xb')]();});}};}function handleEntityNotFound(_0x217c68){return function(_0x54e442){if(!_0x54e442){_0x217c68[_0xe063('0x15')](0x194);}return _0x54e442;};}function handleError(_0x5c92f1,_0x4aaa19){_0x4aaa19=_0x4aaa19||0x1f4;return function(_0x55277b){logger[_0xe063('0x16')](_0x55277b['stack']);if(_0x55277b[_0xe063('0x17')]){delete _0x55277b[_0xe063('0x17')];}_0x5c92f1[_0xe063('0xa')](_0x4aaa19)['send'](_0x55277b);};}function maskClientSecret(_0x321a4a){return _[_0xe063('0x18')](_0x321a4a[_0xe063('0x19')](0x0,0x3),0x14,'*');}exports[_0xe063('0x1a')]=function(_0x52e8eb,_0xb0f3db){var _0x281544={},_0x1b22d3={},_0x4b4af5={'count':0x0,'rows':[]};var _0x1fe66c=_[_0xe063('0x1b')](db[_0xe063('0x1c')][_0xe063('0x1d')],function(_0x1244c6){return{'name':_0x1244c6['fieldName'],'type':_0x1244c6[_0xe063('0x1e')][_0xe063('0x1f')]};});_0x1b22d3[_0xe063('0x20')]=_['map'](_0x1fe66c,_0xe063('0x17'));_0x1b22d3[_0xe063('0x21')]=_['keys'](_0x52e8eb[_0xe063('0x21')]);_0x1b22d3[_0xe063('0x22')]=_[_0xe063('0x23')](_0x1b22d3[_0xe063('0x20')],_0x1b22d3[_0xe063('0x21')]);_0x281544[_0xe063('0x24')]=_['intersection'](_0x1b22d3['model'],qs[_0xe063('0x25')](_0x52e8eb[_0xe063('0x21')][_0xe063('0x25')]));_0x281544[_0xe063('0x24')]=_0x281544[_0xe063('0x24')][_0xe063('0x26')]?_0x281544[_0xe063('0x24')]:_0x1b22d3[_0xe063('0x20')];if(!_0x52e8eb[_0xe063('0x21')]['hasOwnProperty']('nolimit')){_0x281544[_0xe063('0xf')]=qs[_0xe063('0xf')](_0x52e8eb[_0xe063('0x21')][_0xe063('0xf')]);_0x281544['offset']=qs[_0xe063('0xd')](_0x52e8eb['query']['offset']);}_0x281544['order']=qs[_0xe063('0x27')](_0x52e8eb[_0xe063('0x21')][_0xe063('0x27')]);_0x281544['where']=qs[_0xe063('0x22')](_[_0xe063('0x28')](_0x52e8eb[_0xe063('0x21')],_0x1b22d3[_0xe063('0x22')]),_0x1fe66c);if(_0x52e8eb[_0xe063('0x21')][_0xe063('0x29')]){_0x281544[_0xe063('0x2a')]=_[_0xe063('0x2b')](_0x281544[_0xe063('0x2a')],{'$or':_['map'](_0x1fe66c,function(_0x304240){if(_0x304240['type']!=='VIRTUAL'){var _0x57f5fe={};_0x57f5fe[_0x304240['name']]={'$like':'%'+_0x52e8eb[_0xe063('0x21')]['filter']+'%'};return _0x57f5fe;}})});}_0x281544=_[_0xe063('0x2b')]({},_0x281544,_0x52e8eb['options']);var _0x3bb56b={'where':_0x281544[_0xe063('0x2a')]};return db['CloudProvider']['count'](_0x3bb56b)[_0xe063('0x13')](function(_0x3f05f5){_0x4b4af5[_0xe063('0x2c')]=_0x3f05f5;if(_0x52e8eb[_0xe063('0x21')][_0xe063('0x2d')]){_0x281544[_0xe063('0x2e')]=[{'all':!![]}];}return db[_0xe063('0x1c')][_0xe063('0x2f')](_0x281544);})[_0xe063('0x13')](function(_0x515f0f){_0x4b4af5[_0xe063('0x30')]=_[_0xe063('0x1b')](_0x515f0f,function(_0x1280f7){if(_0x1280f7['service']===_0xe063('0x31')){var _0x2c439b=encryptor[_0xe063('0x32')](_0x1280f7['data3']);_0x1280f7['data3']=maskClientSecret(_0x2c439b);}return _0x1280f7;});return _0x4b4af5;})[_0xe063('0x13')](respondWithFilteredResult(_0xb0f3db,_0x281544))[_0xe063('0x33')](handleError(_0xb0f3db,null));};exports[_0xe063('0x34')]=function(_0x4e7603,_0x2c0843){var _0x3bddcc={'raw':!![],'where':{'id':_0x4e7603[_0xe063('0x35')]['id']}},_0x2a44b7={};_0x2a44b7[_0xe063('0x20')]=_[_0xe063('0x36')](db[_0xe063('0x1c')]['rawAttributes']);_0x2a44b7[_0xe063('0x21')]=_[_0xe063('0x36')](_0x4e7603[_0xe063('0x21')]);_0x2a44b7[_0xe063('0x22')]=_[_0xe063('0x23')](_0x2a44b7[_0xe063('0x20')],_0x2a44b7[_0xe063('0x21')]);_0x3bddcc['attributes']=_[_0xe063('0x23')](_0x2a44b7['model'],qs['fields'](_0x4e7603[_0xe063('0x21')]['fields']));_0x3bddcc['attributes']=_0x3bddcc[_0xe063('0x24')][_0xe063('0x26')]?_0x3bddcc['attributes']:_0x2a44b7[_0xe063('0x20')];if(_0x4e7603['query']['includeAll']){_0x3bddcc[_0xe063('0x2e')]=[{'all':!![]}];}_0x3bddcc=_[_0xe063('0x2b')]({},_0x3bddcc,_0x4e7603[_0xe063('0x37')]);return db['CloudProvider'][_0xe063('0x38')](_0x3bddcc)[_0xe063('0x13')](handleEntityNotFound(_0x2c0843,null))['then'](function(_0x5e0bca){if(_0x5e0bca['service']==='MicrosoftAzure'){var _0x3045f0=encryptor[_0xe063('0x32')](_0x5e0bca[_0xe063('0x39')]);_0x5e0bca[_0xe063('0x39')]=maskClientSecret(_0x3045f0);}return _0x5e0bca;})[_0xe063('0x13')](respondWithResult(_0x2c0843,null))[_0xe063('0x33')](handleError(_0x2c0843,null));};exports['create']=function(_0x4876eb,_0xf1ff70){if(!_0x4876eb[_0xe063('0x3a')][_0xe063('0x17')])throw new Error('Name\x20parameter\x20not\x20specified');if(!_0x4876eb[_0xe063('0x3a')][_0xe063('0x3b')])throw new Error('Service\x20parameter\x20not\x20specified');var _0x41622d=db[_0xe063('0x1c')][_0xe063('0x1d')]['service'][_0xe063('0x3c')];if(!_0x41622d[_0xe063('0x3d')](_0x4876eb[_0xe063('0x3a')][_0xe063('0x3b')]))throw new Error(_0xe063('0x3e')+_0x41622d[_0xe063('0x3f')](',\x20'));if(_0x4876eb[_0xe063('0x3a')]['service']==='MicrosoftAzure'&&_0x4876eb['body'][_0xe063('0x39')]){_0x4876eb['body'][_0xe063('0x39')]=encryptor[_0xe063('0x40')](_0x4876eb['body'][_0xe063('0x39')]);}return db[_0xe063('0x1c')][_0xe063('0x41')](_0x4876eb[_0xe063('0x3a')],{})[_0xe063('0x13')](respondWithResult(_0xf1ff70,0xc9))[_0xe063('0x33')](handleError(_0xf1ff70,null));};exports[_0xe063('0x12')]=function(_0x403a7b,_0x5b0e15){if(_0x403a7b[_0xe063('0x3a')]['id']){delete _0x403a7b[_0xe063('0x3a')]['id'];}return db[_0xe063('0x1c')][_0xe063('0x38')]({'where':{'id':_0x403a7b[_0xe063('0x35')]['id']}})['then'](handleEntityNotFound(_0x5b0e15,null))[_0xe063('0x13')](function(_0x463d32){if(_0x463d32[_0xe063('0x3b')]==='MicrosoftAzure'&&_0x403a7b['body']['data3']){_0x403a7b[_0xe063('0x3a')][_0xe063('0x39')]=encryptor[_0xe063('0x40')](_0x403a7b[_0xe063('0x3a')]['data3']);}return _0x463d32;})[_0xe063('0x13')](saveUpdates(_0x403a7b[_0xe063('0x3a')],null))['then'](respondWithResult(_0x5b0e15,null))[_0xe063('0x33')](handleError(_0x5b0e15,null));};exports[_0xe063('0x14')]=function(_0x27da11,_0x2f9d9e){return db[_0xe063('0x1c')][_0xe063('0x38')]({'where':{'id':_0x27da11[_0xe063('0x35')]['id']}})['then'](handleEntityNotFound(_0x2f9d9e,null))[_0xe063('0x13')](removeEntity(_0x2f9d9e,null))[_0xe063('0x33')](handleError(_0x2f9d9e,null));};exports[_0xe063('0x42')]=function(_0x2b6edd,_0x231595){return db[_0xe063('0x1c')][_0xe063('0x43')]({'where':{'id':_0x2b6edd[_0xe063('0x35')]['id']},'raw':!![]})[_0xe063('0x13')](function(_0x487e14){if(!_0x487e14)return _0x231595[_0xe063('0x15')](0x194);return{'url':oauth[_0xe063('0x44')](_0x487e14,_0x2b6edd[_0xe063('0x45')]['id'])};})[_0xe063('0x13')](respondWithResult(_0x231595,null))[_0xe063('0x33')](handleError(_0x231595,null));};exports[_0xe063('0x46')]=function(_0x296bdb,_0x1843b8){var _0x462489=_0x296bdb[_0xe063('0x3a')];var _0x1153e1;var _0x266501;if(_0x462489[_0xe063('0x16')])throw _0x462489;redis[_0xe063('0x47')](_0x462489[_0xe063('0x48')])[_0xe063('0x13')](function(_0x5efd0c){if(!_0x5efd0c)throw new Error(_0xe063('0x49'));_0x1153e1=JSON[_0xe063('0x4a')](_0x5efd0c);var _0x195293=Buffer[_0xe063('0x4b')](_0x462489['state'],_0xe063('0x4c'))[_0xe063('0x4d')](_0xe063('0x4e'));_0x266501=JSON['parse'](_0x195293);if(!oauth[_0xe063('0x4f')](_0x462489[_0xe063('0x50')],_0x1153e1[_0xe063('0x51')]))throw new Error('Unable\x20to\x20validate\x20id_token');redis[_0xe063('0x52')](_0x462489[_0xe063('0x48')]);return oauth['getOauth2MicrosoftAccessToken'](_0x462489[_0xe063('0x53')],_0x1153e1);})['then'](function(_0x4267c6){_0x1153e1[_0xe063('0x54')]=_0x4267c6['access_token'];_0x1153e1[_0xe063('0x55')]=_0x4267c6[_0xe063('0x56')];return db[_0xe063('0x1c')][_0xe063('0x12')]({'data5':_0x1153e1[_0xe063('0x54')],'data6':_0x1153e1['data6']},{'where':{'id':_0x1153e1['id']}});})[_0xe063('0x13')](function(){oauth[_0xe063('0x57')](_0x1153e1);socket[_0xe063('0x58')](_0xe063('0x59'),{'id':_0x266501['id']});return;})[_0xe063('0x13')](respondWithStatusCode(_0x1843b8,null))['catch'](function(_0x38b02d){if(_0x266501){socket['emit'](_0xe063('0x5a'),{'id':_0x266501['id']});}if(!_0x1153e1){logger[_0xe063('0x16')](_0xe063('0x5b'),_0x38b02d);return _0x1843b8[_0xe063('0xa')](0x1f4)[_0xe063('0x5c')](_0x38b02d['message']);}logger['error']('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x1153e1['id'],JSON[_0xe063('0x5d')](_0x38b02d));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index bacffa6..d7f6046 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 _0x5d6b=['cloud_providers','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','exports','define','CloudProvider'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0x5d6b,0x109));var _0xb5d6=function(_0x478e95,_0x57af41){_0x478e95=_0x478e95-0x0;var _0x2ba047=_0x5d6b[_0x478e95];return _0x2ba047;};'use strict';var _=require(_0xb5d6('0x0'));var util=require(_0xb5d6('0x1'));var logger=require(_0xb5d6('0x2'))(_0xb5d6('0x3'));var moment=require('moment');var BPromise=require(_0xb5d6('0x4'));var rp=require(_0xb5d6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb5d6('0x6'));var config=require(_0xb5d6('0x7'));var attributes=require('./cloudProvider.attributes');module[_0xb5d6('0x8')]=function(_0x45a9f4,_0x2ac8e4){return _0x45a9f4[_0xb5d6('0x9')](_0xb5d6('0xa'),attributes,{'tableName':_0xb5d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6bd=['../../config/logger','api','moment','rimraf','../../config/environment','./cloudProvider.attributes','exports','define','lodash','util'];(function(_0x21e563,_0xadbdca){var _0x5e6b46=function(_0x302b50){while(--_0x302b50){_0x21e563['push'](_0x21e563['shift']());}};_0x5e6b46(++_0xadbdca);}(_0xc6bd,0x148));var _0xdc6b=function(_0x109c6c,_0x3e27b2){_0x109c6c=_0x109c6c-0x0;var _0x3e150e=_0xc6bd[_0x109c6c];return _0x3e150e;};'use strict';var _=require(_0xdc6b('0x0'));var util=require(_0xdc6b('0x1'));var logger=require(_0xdc6b('0x2'))(_0xdc6b('0x3'));var moment=require(_0xdc6b('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xdc6b('0x5'));var config=require(_0xdc6b('0x6'));var attributes=require(_0xdc6b('0x7'));module[_0xdc6b('0x8')]=function(_0x3d3d26,_0x599274){return _0x3d3d26[_0xdc6b('0x9')]('CloudProvider',attributes,{'tableName':'cloud_providers','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 fef38de..ac4c53e 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 _0xeec4=['iss','aud','audience','isAfter','unix','exp','resolve','then','data3','CloudProvider','findOne','refresh_token','data6','decryptString','POST','data5','access_token','update','catch','authorization_code','intervals','bind','findAll','inspect','error','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','jsonwebtoken','moment','ioredis','util','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','defaults','redis','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','type','Dynamics365','push','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','id_token','from','stringify','randomBytes','toString','hex','client_id','data1','response_type','redirect_uri','data4','response_mode','form_post','scope','state','nonce','prompt','login','map','value','oauth2Claims','oauth2/','decode','payload'];(function(_0x256e32,_0x4013bc){var _0x464070=function(_0x449398){while(--_0x449398){_0x256e32['push'](_0x256e32['shift']());}};_0x464070(++_0x4013bc);}(_0xeec4,0x1a6));var _0x4eec=function(_0x59eefb,_0x2151ce){_0x59eefb=_0x59eefb-0x0;var _0x1a49e8=_0xeec4[_0x59eefb];return _0x1a49e8;};'use strict';var _=require('lodash');var crypto=require('crypto');var jwt=require(_0x4eec('0x0'));var moment=require(_0x4eec('0x1'));var Redis=require(_0x4eec('0x2'));var rp=require('request-promise');var util=require(_0x4eec('0x3'));var encryptor=require('../../components/encryptor');var config=require(_0x4eec('0x4'));var logger=require('../../config/logger')(_0x4eec('0x5'));var schedule=require(_0x4eec('0x6'));var db=require(_0x4eec('0x7'))['db'];config['redis']=_[_0x4eec('0x8')](config[_0x4eec('0x9')],{'host':'localhost','port':0x18eb});var redis=new Redis(config[_0x4eec('0x9')]);var MICROSOFT_AUTH_URL=_0x4eec('0xa');var AZURE_AUTH_SCOPES={'Outlook365':[_0x4eec('0xb'),_0x4eec('0xc'),'email',_0x4eec('0xd'),_0x4eec('0xe'),'https://outlook.office.com/POP.AccessAsUser.All',_0x4eec('0xf')],'Dynamics365':[_0x4eec('0xb'),'offline_access']};var MICROSOFT_AUTH_ENDPOINT=_0x4eec('0x10');var MICROSOFT_TOKEN_ENDPOINT=_0x4eec('0x11');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x7e70b3){var _0xcbdcef=_['map'](AZURE_AUTH_SCOPES[_0x7e70b3[_0x4eec('0x12')]]);if(_0x7e70b3[_0x4eec('0x12')]===_0x4eec('0x13'))_0xcbdcef[_0x4eec('0x14')](_0x7e70b3[_0x4eec('0x15')]+_0x4eec('0x16'));return _0xcbdcef[_0x4eec('0x17')]('\x20');}function getAccessTokenScope(_0x29b7f4){if(_0x29b7f4['type']===_0x4eec('0x18'))return _0x4eec('0xe');if(_0x29b7f4[_0x4eec('0x12')]===_0x4eec('0x13'))return _0x29b7f4['data7']+_0x4eec('0x16');}function generateMicrosoftAuthorizationUrl(_0x649b29,_0x52e91e){var _0x54b874=MICROSOFT_AUTH_URL[_0x4eec('0x19')](_0x4eec('0x1a'),_0x649b29[_0x4eec('0x1b')]);var _0x3c728e=['code',_0x4eec('0x1c')];var _0x25e3cb=Buffer[_0x4eec('0x1d')](JSON[_0x4eec('0x1e')]({'id':_0x52e91e}))['toString']('base64');var _0x4bc1ca=crypto[_0x4eec('0x1f')](0x10)[_0x4eec('0x20')](_0x4eec('0x21'));var _0x437ef8=getAuthorizationScopes(_0x649b29);var _0x50385e=[{'key':_0x4eec('0x22'),'value':_0x649b29[_0x4eec('0x23')]},{'key':_0x4eec('0x24'),'value':encodeURIComponent(_0x3c728e[_0x4eec('0x17')]('\x20'))},{'key':_0x4eec('0x25'),'value':_0x649b29[_0x4eec('0x26')]},{'key':_0x4eec('0x27'),'value':_0x4eec('0x28')},{'key':_0x4eec('0x29'),'value':encodeURIComponent(_0x437ef8)},{'key':_0x4eec('0x2a'),'value':_0x25e3cb},{'key':_0x4eec('0x2b'),'value':_0x4bc1ca},{'key':_0x4eec('0x2c'),'value':_0x4eec('0x2d')}];var _0x444cd1=_0x54b874+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0x4eec('0x2e')](_0x50385e,function(_0x2e200c){return _0x2e200c['key']+'='+_0x2e200c[_0x4eec('0x2f')];})[_0x4eec('0x17')]('&');_0x649b29[_0x4eec('0x30')]={'issuer':_0x54b874[_0x4eec('0x19')](_0x4eec('0x31'),''),'audience':_0x649b29[_0x4eec('0x23')],'state':_0x25e3cb,'nonce':_0x4bc1ca};redis['set'](_0x25e3cb,JSON['stringify'](_0x649b29));return _0x444cd1;}function isValidIdToken(_0x3b1f6d,_0x2d7e1e){try{var _0x2ccfbc=jwt[_0x4eec('0x32')](_0x3b1f6d,{'complete':!![]});var _0x1cd4f0=_0x2ccfbc[_0x4eec('0x33')];if(_0x1cd4f0[_0x4eec('0x34')]!==_0x2d7e1e['issuer'])return![];if(_0x1cd4f0[_0x4eec('0x35')]!==_0x2d7e1e[_0x4eec('0x36')])return![];if(_0x1cd4f0[_0x4eec('0x2b')]!==_0x2d7e1e[_0x4eec('0x2b')])return![];if(moment()[_0x4eec('0x37')](moment[_0x4eec('0x38')](_0x1cd4f0[_0x4eec('0x39')])))return![];return!![];}catch(_0x3b44df){throw _0x3b44df;}}function refreshOauth2MicrosoftAccessToken(_0x259a0b){return Promise[_0x4eec('0x3a')]()[_0x4eec('0x3b')](function(){if(_0x259a0b[_0x4eec('0x3c')])return _0x259a0b;return db[_0x4eec('0x3d')][_0x4eec('0x3e')]({'where':{'id':_0x259a0b['id']},'raw':!![]});})[_0x4eec('0x3b')](function(_0x4f5117){var _0x3f37a5={'grant_type':_0x4eec('0x3f'),'refresh_token':_0x4f5117[_0x4eec('0x40')],'scope':getAccessTokenScope(_0x4f5117),'redirect_uri':_0x4f5117[_0x4eec('0x26')],'client_id':_0x4f5117[_0x4eec('0x23')],'client_secret':encryptor[_0x4eec('0x41')](_0x4f5117[_0x4eec('0x3c')])};var _0x28f3cf={'method':_0x4eec('0x42'),'uri':MICROSOFT_AUTH_URL[_0x4eec('0x19')](_0x4eec('0x1a'),_0x4f5117[_0x4eec('0x1b')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x3f37a5,'json':!![]};return rp(_0x28f3cf);})[_0x4eec('0x3b')](function(_0x4a67b9){_0x259a0b[_0x4eec('0x43')]=_0x4a67b9[_0x4eec('0x44')];_0x259a0b[_0x4eec('0x40')]=_0x4a67b9[_0x4eec('0x3f')];return db[_0x4eec('0x3d')][_0x4eec('0x45')]({'data5':_0x259a0b[_0x4eec('0x43')],'data6':_0x259a0b[_0x4eec('0x40')]},{'where':{'id':_0x259a0b['id']}});})[_0x4eec('0x3b')](function(){return _0x259a0b;})[_0x4eec('0x46')](function(_0xe7ac11){logger['error']('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x259a0b['id'],_0xe7ac11);});}function getOauth2MicrosoftAccessToken(_0x2e0cd3,_0x51db15){var _0xb5f75={'grant_type':_0x4eec('0x47'),'code':_0x2e0cd3,'scope':getAccessTokenScope(_0x51db15),'redirect_uri':_0x51db15[_0x4eec('0x26')],'client_id':_0x51db15[_0x4eec('0x23')],'client_secret':encryptor[_0x4eec('0x41')](_0x51db15[_0x4eec('0x3c')])};var _0x26d032={'method':_0x4eec('0x42'),'uri':MICROSOFT_AUTH_URL[_0x4eec('0x19')](_0x4eec('0x1a'),_0x51db15['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0xb5f75,'json':!![]};return rp(_0x26d032);}function startRefreshInterval(_0x2ea2fd){var _0x10133d=schedule[_0x4eec('0x48')];if(_0x10133d[_0x2ea2fd['id']])clearInterval(_0x10133d[_0x2ea2fd['id']]);_0x10133d[_0x2ea2fd['id']]=setInterval(refreshOauth2MicrosoftAccessToken[_0x4eec('0x49')](this,{'id':_0x2ea2fd['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0x4eec('0x48')]=_0x10133d;}function startAllRefreshIntervals(){return db[_0x4eec('0x3d')][_0x4eec('0x4a')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0x4eec('0x3b')](function(_0x51de3b){var _0x16a151=_0x51de3b[_0x4eec('0x2e')](function(_0x1cfac5){return refreshOauth2MicrosoftAccessToken(_0x1cfac5)[_0x4eec('0x3b')](function(_0x27338a){startRefreshInterval(_0x27338a);});});return Promise['all'](_0x16a151);})[_0x4eec('0x46')](function(_0x42cc03){var _0x146a7d=_0x42cc03?util[_0x4eec('0x4b')](_0x42cc03,{'showHidden':![],'depth':null}):'';logger[_0x4eec('0x4c')](_0x4eec('0x4d'),_0x146a7d);});}module[_0x4eec('0x4e')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0xd9b9=['[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','crypto','jsonwebtoken','moment','request-promise','util','../../components/encryptor','../../config/environment','api','../../config/schedule/cloud-provider','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','offline_access','/authorize','map','type','Dynamics365','data7','/.default','join','Outlook365','replace','{TENANT_ID}','data2','code','id_token','base64','randomBytes','toString','hex','client_id','response_type','redirect_uri','response_mode','form_post','state','key','value','oauth2/','data1','set','stringify','decode','payload','iss','issuer','aud','audience','nonce','isAfter','unix','data3','CloudProvider','then','refresh_token','data6','data4','decryptString','data5','access_token','update','catch','error','POST','intervals','all','inspect'];(function(_0x426892,_0x42aaeb){var _0x1d7fd4=function(_0x5a78f5){while(--_0x5a78f5){_0x426892['push'](_0x426892['shift']());}};_0x1d7fd4(++_0x42aaeb);}(_0xd9b9,0xe3));var _0x9d9b=function(_0x47916a,_0x1b403b){_0x47916a=_0x47916a-0x0;var _0x321a13=_0xd9b9[_0x47916a];return _0x321a13;};'use strict';var _=require('lodash');var crypto=require(_0x9d9b('0x0'));var jwt=require(_0x9d9b('0x1'));var moment=require(_0x9d9b('0x2'));var Redis=require('ioredis');var rp=require(_0x9d9b('0x3'));var util=require(_0x9d9b('0x4'));var encryptor=require(_0x9d9b('0x5'));var config=require(_0x9d9b('0x6'));var logger=require('../../config/logger')(_0x9d9b('0x7'));var schedule=require(_0x9d9b('0x8'));var db=require(_0x9d9b('0x9'))['db'];config[_0x9d9b('0xa')]=_[_0x9d9b('0xb')](config['redis'],{'host':_0x9d9b('0xc'),'port':0x18eb});var redis=new Redis(config[_0x9d9b('0xa')]);var MICROSOFT_AUTH_URL=_0x9d9b('0xd');var AZURE_AUTH_SCOPES={'Outlook365':[_0x9d9b('0xe'),_0x9d9b('0xf'),_0x9d9b('0x10'),'offline_access',_0x9d9b('0x11'),'https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0x9d9b('0xe'),_0x9d9b('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0x9d9b('0x13');var MICROSOFT_TOKEN_ENDPOINT='/token';var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5c31e6){var _0x48b3b7=_[_0x9d9b('0x14')](AZURE_AUTH_SCOPES[_0x5c31e6[_0x9d9b('0x15')]]);if(_0x5c31e6[_0x9d9b('0x15')]===_0x9d9b('0x16'))_0x48b3b7['push'](_0x5c31e6[_0x9d9b('0x17')]+_0x9d9b('0x18'));return _0x48b3b7[_0x9d9b('0x19')]('\x20');}function getAccessTokenScope(_0x157213){if(_0x157213[_0x9d9b('0x15')]===_0x9d9b('0x1a'))return _0x9d9b('0x11');if(_0x157213[_0x9d9b('0x15')]===_0x9d9b('0x16'))return _0x157213[_0x9d9b('0x17')]+_0x9d9b('0x18');}function generateMicrosoftAuthorizationUrl(_0x19ba81,_0x5404a7){var _0x4a786c=MICROSOFT_AUTH_URL[_0x9d9b('0x1b')](_0x9d9b('0x1c'),_0x19ba81[_0x9d9b('0x1d')]);var _0xc7ed2e=[_0x9d9b('0x1e'),_0x9d9b('0x1f')];var _0x42081a=Buffer['from'](JSON['stringify']({'id':_0x5404a7}))['toString'](_0x9d9b('0x20'));var _0x238d9c=crypto[_0x9d9b('0x21')](0x10)[_0x9d9b('0x22')](_0x9d9b('0x23'));var _0x265962=getAuthorizationScopes(_0x19ba81);var _0x5d8fc8=[{'key':_0x9d9b('0x24'),'value':_0x19ba81['data1']},{'key':_0x9d9b('0x25'),'value':encodeURIComponent(_0xc7ed2e[_0x9d9b('0x19')]('\x20'))},{'key':_0x9d9b('0x26'),'value':_0x19ba81['data4']},{'key':_0x9d9b('0x27'),'value':_0x9d9b('0x28')},{'key':'scope','value':encodeURIComponent(_0x265962)},{'key':_0x9d9b('0x29'),'value':_0x42081a},{'key':'nonce','value':_0x238d9c},{'key':'prompt','value':'login'}];var _0xf738f6=_0x4a786c+MICROSOFT_AUTH_ENDPOINT+'?'+_['map'](_0x5d8fc8,function(_0x2dc612){return _0x2dc612[_0x9d9b('0x2a')]+'='+_0x2dc612[_0x9d9b('0x2b')];})[_0x9d9b('0x19')]('&');_0x19ba81['oauth2Claims']={'issuer':_0x4a786c['replace'](_0x9d9b('0x2c'),''),'audience':_0x19ba81[_0x9d9b('0x2d')],'state':_0x42081a,'nonce':_0x238d9c};redis[_0x9d9b('0x2e')](_0x42081a,JSON[_0x9d9b('0x2f')](_0x19ba81));return _0xf738f6;}function isValidIdToken(_0x124cce,_0x1f0648){try{var _0x5cba8c=jwt[_0x9d9b('0x30')](_0x124cce,{'complete':!![]});var _0x3738e4=_0x5cba8c[_0x9d9b('0x31')];if(_0x3738e4[_0x9d9b('0x32')]!==_0x1f0648[_0x9d9b('0x33')])return![];if(_0x3738e4[_0x9d9b('0x34')]!==_0x1f0648[_0x9d9b('0x35')])return![];if(_0x3738e4['nonce']!==_0x1f0648[_0x9d9b('0x36')])return![];if(moment()[_0x9d9b('0x37')](moment[_0x9d9b('0x38')](_0x3738e4['exp'])))return![];return!![];}catch(_0x431f71){throw _0x431f71;}}function refreshOauth2MicrosoftAccessToken(_0x597694){return Promise['resolve']()['then'](function(){if(_0x597694[_0x9d9b('0x39')])return _0x597694;return db[_0x9d9b('0x3a')]['findOne']({'where':{'id':_0x597694['id']},'raw':!![]});})[_0x9d9b('0x3b')](function(_0x10203d){var _0x309bf6={'grant_type':_0x9d9b('0x3c'),'refresh_token':_0x10203d[_0x9d9b('0x3d')],'scope':getAccessTokenScope(_0x10203d),'redirect_uri':_0x10203d[_0x9d9b('0x3e')],'client_id':_0x10203d['data1'],'client_secret':encryptor[_0x9d9b('0x3f')](_0x10203d['data3'])};var _0x5245dd={'method':'POST','uri':MICROSOFT_AUTH_URL['replace'](_0x9d9b('0x1c'),_0x10203d[_0x9d9b('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x309bf6,'json':!![]};return rp(_0x5245dd);})[_0x9d9b('0x3b')](function(_0x51366f){_0x597694[_0x9d9b('0x40')]=_0x51366f[_0x9d9b('0x41')];_0x597694[_0x9d9b('0x3d')]=_0x51366f['refresh_token'];return db['CloudProvider'][_0x9d9b('0x42')]({'data5':_0x597694[_0x9d9b('0x40')],'data6':_0x597694['data6']},{'where':{'id':_0x597694['id']}});})['then'](function(){return _0x597694;})[_0x9d9b('0x43')](function(_0x4da12f){logger[_0x9d9b('0x44')]('Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s',_0x597694['id'],_0x4da12f);});}function getOauth2MicrosoftAccessToken(_0x2d9169,_0x28b9f8){var _0x4f82bc={'grant_type':'authorization_code','code':_0x2d9169,'scope':getAccessTokenScope(_0x28b9f8),'redirect_uri':_0x28b9f8[_0x9d9b('0x3e')],'client_id':_0x28b9f8[_0x9d9b('0x2d')],'client_secret':encryptor[_0x9d9b('0x3f')](_0x28b9f8['data3'])};var _0x53316b={'method':_0x9d9b('0x45'),'uri':MICROSOFT_AUTH_URL[_0x9d9b('0x1b')](_0x9d9b('0x1c'),_0x28b9f8[_0x9d9b('0x1d')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x4f82bc,'json':!![]};return rp(_0x53316b);}function startRefreshInterval(_0x961d32){var _0x1563b4=schedule[_0x9d9b('0x46')];if(_0x1563b4[_0x961d32['id']])clearInterval(_0x1563b4[_0x961d32['id']]);_0x1563b4[_0x961d32['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x961d32['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x1563b4;}function startAllRefreshIntervals(){return db[_0x9d9b('0x3a')]['findAll']({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x4fa0ae){var _0xdea203=_0x4fa0ae[_0x9d9b('0x14')](function(_0x1936d7){return refreshOauth2MicrosoftAccessToken(_0x1936d7)[_0x9d9b('0x3b')](function(_0x439b3a){startRefreshInterval(_0x439b3a);});});return Promise[_0x9d9b('0x47')](_0xdea203);})[_0x9d9b('0x43')](function(_0x530984){var _0xc48763=_0x530984?util[_0x9d9b('0x48')](_0x530984,{'showHidden':![],'depth':null}):'';logger['error'](_0x9d9b('0x49'),_0xc48763);});}module[_0x9d9b('0x4a')]={'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 4059cb4..f744c6b 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 _0xfbbb=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','info','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','error','code','CloudProvider,\x20%s,\x20%s','message','result','catch','lodash','util'];(function(_0x480df9,_0x45434a){var _0x5d8247=function(_0x48dab6){while(--_0x48dab6){_0x480df9['push'](_0x480df9['shift']());}};_0x5d8247(++_0x45434a);}(_0xfbbb,0x1b3));var _0xbfbb=function(_0x568363,_0x2e79a7){_0x568363=_0x568363-0x0;var _0x47f0ed=_0xfbbb[_0x568363];return _0x47f0ed;};'use strict';var _=require(_0xbfbb('0x0'));var util=require(_0xbfbb('0x1'));var moment=require(_0xbfbb('0x2'));var BPromise=require(_0xbfbb('0x3'));var rs=require(_0xbfbb('0x4'));var fs=require('fs');var Redis=require(_0xbfbb('0x5'));var db=require(_0xbfbb('0x6'))['db'];var utils=require(_0xbfbb('0x7'));var logger=require(_0xbfbb('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbfbb('0x9'));var client=jayson['client'][_0xbfbb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16c6cc,_0x16a41c,_0x5a69b3){return new BPromise(function(_0x1f2c31,_0x3260a7){return client[_0xbfbb('0xb')](_0x16c6cc,_0x5a69b3)[_0xbfbb('0xc')](function(_0x1baefa){logger[_0xbfbb('0xd')]('CloudProvider,\x20%s,\x20%s',_0x16a41c,_0xbfbb('0xe'));logger[_0xbfbb('0xf')](_0xbfbb('0x10'),_0x16a41c,_0xbfbb('0xe'),JSON['stringify'](_0x1baefa));if(_0x1baefa[_0xbfbb('0x11')]){if(_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x12')]===0x1f4){logger[_0xbfbb('0x11')](_0xbfbb('0x13'),_0x16a41c,_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x14')]);return _0x3260a7(_0x1baefa[_0xbfbb('0x11')]['message']);}logger[_0xbfbb('0x11')](_0xbfbb('0x13'),_0x16a41c,_0x1baefa[_0xbfbb('0x11')][_0xbfbb('0x14')]);return _0x1f2c31(_0x1baefa[_0xbfbb('0x11')]['message']);}else{logger[_0xbfbb('0xd')](_0xbfbb('0x13'),_0x16a41c,_0xbfbb('0xe'));_0x1f2c31(_0x1baefa[_0xbfbb('0x15')][_0xbfbb('0x14')]);}})[_0xbfbb('0x16')](function(_0x2f49e5){logger['error']('CloudProvider,\x20%s,\x20%s',_0x16a41c,_0x2f49e5);_0x3260a7(_0x2f49e5);});});} \ No newline at end of file +var _0x236c=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','debug','CloudProvider,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2f4943,_0x4d7077){var _0x300213=function(_0x8bf8f1){while(--_0x8bf8f1){_0x2f4943['push'](_0x2f4943['shift']());}};_0x300213(++_0x4d7077);}(_0x236c,0x155));var _0xc236=function(_0x9031b,_0x483db7){_0x9031b=_0x9031b-0x0;var _0xe13f19=_0x236c[_0x9031b];return _0xe13f19;};'use strict';var _=require(_0xc236('0x0'));var util=require('util');var moment=require(_0xc236('0x1'));var BPromise=require(_0xc236('0x2'));var rs=require(_0xc236('0x3'));var fs=require('fs');var Redis=require(_0xc236('0x4'));var db=require(_0xc236('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc236('0x6'))(_0xc236('0x7'));var config=require(_0xc236('0x8'));var jayson=require(_0xc236('0x9'));var client=jayson[_0xc236('0xa')][_0xc236('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5abd65,_0xd612c6,_0x4d349b){return new BPromise(function(_0x51a13b,_0x5bc6a2){return client['request'](_0x5abd65,_0x4d349b)[_0xc236('0xc')](function(_0x4b8dc6){logger[_0xc236('0xd')](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));logger[_0xc236('0x10')](_0xc236('0x11'),_0xd612c6,'request\x20sent',JSON[_0xc236('0x12')](_0x4b8dc6));if(_0x4b8dc6[_0xc236('0x13')]){if(_0x4b8dc6['error'][_0xc236('0x14')]===0x1f4){logger[_0xc236('0x13')]('CloudProvider,\x20%s,\x20%s',_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x5bc6a2(_0x4b8dc6['error'][_0xc236('0x15')]);}logger[_0xc236('0x13')](_0xc236('0xe'),_0xd612c6,_0x4b8dc6[_0xc236('0x13')]['message']);return _0x51a13b(_0x4b8dc6[_0xc236('0x13')]['message']);}else{logger['info'](_0xc236('0xe'),_0xd612c6,_0xc236('0xf'));_0x51a13b(_0x4b8dc6[_0xc236('0x16')][_0xc236('0x15')]);}})[_0xc236('0x17')](function(_0x5ac3ed){logger['error']('CloudProvider,\x20%s,\x20%s',_0xd612c6,_0x5ac3ed);_0x5bc6a2(_0x5ac3ed);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index c5385b0..f911dda 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 _0x1261=['/:id','show','create','put','update','delete','/:id/oauth2/microsoft/authorize/','post','exports','Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','index'];(function(_0x35af23,_0x9190f6){var _0x340506=function(_0xd4c26b){while(--_0xd4c26b){_0x35af23['push'](_0x35af23['shift']());}};_0x340506(++_0x9190f6);}(_0x1261,0x144));var _0x1126=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0x1261[_0x547ff4];return _0xe41057;};'use strict';var express=require('express');var router=express[_0x1126('0x0')]();var auth=require(_0x1126('0x1'));var controller=require(_0x1126('0x2'));router[_0x1126('0x3')]('/',auth[_0x1126('0x4')](),controller[_0x1126('0x5')]);router[_0x1126('0x3')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller[_0x1126('0x7')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1126('0x8')]);router[_0x1126('0x9')]('/:id',auth[_0x1126('0x4')](),controller[_0x1126('0xa')]);router[_0x1126('0xb')](_0x1126('0x6'),auth[_0x1126('0x4')](),controller['destroy']);router[_0x1126('0x3')](_0x1126('0xc'),auth[_0x1126('0x4')](),controller['oauth2MicrosoftAuthorize']);router[_0x1126('0xd')]('/oauth2/microsoft/callback',controller['oauth2MicrosoftCallback']);module[_0x1126('0xe')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x321f9f,_0x1d95db){var _0x5b0ef9=function(_0xc21431){while(--_0xc21431){_0x321f9f['push'](_0x321f9f['shift']());}};_0x5b0ef9(++_0x1d95db);}(_0x2ef3,0xba));var _0x32ef=function(_0x3144e1,_0x88a9fb){_0x3144e1=_0x3144e1-0x0;var _0x3d7e88=_0x2ef3[_0x3144e1];return _0x3d7e88;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 20ec1d7..745cfb7 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 _0xd2b8=['sequelize','STRING','name'];(function(_0x1d5e48,_0x51dc5c){var _0x2c1220=function(_0x369d64){while(--_0x369d64){_0x1d5e48['push'](_0x1d5e48['shift']());}};_0x2c1220(++_0x51dc5c);}(_0xd2b8,0x7e));var _0x8d2b=function(_0x45674a,_0x5444dc){_0x45674a=_0x45674a-0x0;var _0x4488e8=_0xd2b8[_0x45674a];return _0x4488e8;};'use strict';var Sequelize=require(_0x8d2b('0x0'));module['exports']={'name':{'type':Sequelize[_0x8d2b('0x1')],'unique':_0x8d2b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8d2b('0x1')]},'companyId':{'type':Sequelize[_0x8d2b('0x1')]},'website':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x8d2b('0x1')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x8d2b('0x1')]},'street':{'type':Sequelize[_0x8d2b('0x1')]},'postalCode':{'type':Sequelize[_0x8d2b('0x1')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x8d2b('0x1')]},'email':{'type':Sequelize[_0x8d2b('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8d2b('0x1')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x8d2b('0x1')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x8d2b('0x1')]},'description':{'type':Sequelize[_0x8d2b('0x1')]}}; \ No newline at end of file +var _0xff67=['exports','name','STRING'];(function(_0x1104a5,_0x115653){var _0x3b6e74=function(_0x1cfc64){while(--_0x1cfc64){_0x1104a5['push'](_0x1104a5['shift']());}};_0x3b6e74(++_0x115653);}(_0xff67,0x1e9));var _0x7ff6=function(_0x38cd95,_0x2bdbad){_0x38cd95=_0x38cd95-0x0;var _0x1e8ae6=_0xff67[_0x38cd95];return _0x1e8ae6;};'use strict';var Sequelize=require('sequelize');module[_0x7ff6('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x7ff6('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x7ff6('0x2')]},'companyId':{'type':Sequelize[_0x7ff6('0x2')]},'website':{'type':Sequelize[_0x7ff6('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x7ff6('0x2')]},'street':{'type':Sequelize[_0x7ff6('0x2')]},'postalCode':{'type':Sequelize[_0x7ff6('0x2')]},'city':{'type':Sequelize[_0x7ff6('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7ff6('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x7ff6('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0x7ff6('0x2')]},'sCity':{'type':Sequelize[_0x7ff6('0x2')]},'sCountry':{'type':Sequelize[_0x7ff6('0x2')]},'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 9ba0fee..9541f9b 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 _0xff66=['catch','show','rawAttributes','includeAll','merge','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addContacts','ids','getContacts','CmContact','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Companies','UserProfileResource','error','stack','name','send','index','CmCompany','describe','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','map','options','include','rows'];(function(_0x33611d,_0x48c2b5){var _0x4db2c2=function(_0x4902ca){while(--_0x4902ca){_0x33611d['push'](_0x33611d['shift']());}};_0x4db2c2(++_0x48c2b5);}(_0xff66,0x16d));var _0x6ff6=function(_0x478414,_0xcf142d){_0x478414=_0x478414-0x0;var _0x5eb6b9=_0xff66[_0x478414];return _0x5eb6b9;};'use strict';var emlformat=require(_0x6ff6('0x0'));var rimraf=require(_0x6ff6('0x1'));var zipdir=require(_0x6ff6('0x2'));var jsonpatch=require(_0x6ff6('0x3'));var rp=require(_0x6ff6('0x4'));var moment=require(_0x6ff6('0x5'));var BPromise=require(_0x6ff6('0x6'));var Mustache=require(_0x6ff6('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6ff6('0x8'));var ejs=require(_0x6ff6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ff6('0xa'));var squel=require(_0x6ff6('0xb'));var crypto=require(_0x6ff6('0xc'));var jsforce=require(_0x6ff6('0xd'));var deskjs=require(_0x6ff6('0xe'));var toCsv=require(_0x6ff6('0x8'));var querystring=require(_0x6ff6('0xf'));var Papa=require(_0x6ff6('0x10'));var Redis=require(_0x6ff6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6ff6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6ff6('0x13'));var logger=require(_0x6ff6('0x14'))(_0x6ff6('0x15'));var utils=require(_0x6ff6('0x16'));var config=require(_0x6ff6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x6ff6('0x18'))['db'];function respondWithStatusCode(_0x4f00e5,_0x3c3354){_0x3c3354=_0x3c3354||0xcc;return function(_0x4aaeb2){if(_0x4aaeb2){return _0x4f00e5[_0x6ff6('0x19')](_0x3c3354);}return _0x4f00e5[_0x6ff6('0x1a')](_0x3c3354)[_0x6ff6('0x1b')]();};}function respondWithResult(_0x15a342,_0x2d626d){_0x2d626d=_0x2d626d||0xc8;return function(_0x128f83){if(_0x128f83){return _0x15a342[_0x6ff6('0x1a')](_0x2d626d)[_0x6ff6('0x1c')](_0x128f83);}};}function respondWithFilteredResult(_0x329996,_0x4c27e9){return function(_0x4e35aa){if(_0x4e35aa){var _0x878b55=typeof _0x4c27e9[_0x6ff6('0x1d')]===_0x6ff6('0x1e')&&typeof _0x4c27e9[_0x6ff6('0x1f')]===_0x6ff6('0x1e');var _0x3fbd4f=_0x4e35aa[_0x6ff6('0x20')];var _0x10f21f=_0x878b55?0x0:_0x4c27e9[_0x6ff6('0x1d')];var _0x2a2db5=_0x878b55?_0x4e35aa[_0x6ff6('0x20')]:_0x4c27e9[_0x6ff6('0x1d')]+_0x4c27e9[_0x6ff6('0x1f')];var _0x3a53cd;if(_0x2a2db5>=_0x3fbd4f){_0x2a2db5=_0x3fbd4f;_0x3a53cd=0xc8;}else{_0x3a53cd=0xce;}_0x329996['status'](_0x3a53cd);return _0x329996[_0x6ff6('0x21')](_0x6ff6('0x22'),_0x10f21f+'-'+_0x2a2db5+'/'+_0x3fbd4f)[_0x6ff6('0x1c')](_0x4e35aa);}return null;};}function patchUpdates(_0x75ccb0){return function(_0x4f715e){try{jsonpatch[_0x6ff6('0x23')](_0x4f715e,_0x75ccb0,!![]);}catch(_0x4dae1e){return BPromise[_0x6ff6('0x24')](_0x4dae1e);}return _0x4f715e[_0x6ff6('0x25')]();};}function saveUpdates(_0x4a7164,_0x5d89f0){return function(_0x26a3fe){if(_0x26a3fe){return _0x26a3fe[_0x6ff6('0x26')](_0x4a7164)[_0x6ff6('0x27')](function(_0x4a846b){return _0x4a846b;});}return null;};}function removeEntity(_0x550dfb,_0x48cd43){return function(_0x5a5130){if(_0x5a5130){return _0x5a5130[_0x6ff6('0x28')]()[_0x6ff6('0x27')](function(){var _0x19cd0f=_0x5a5130[_0x6ff6('0x29')]({'plain':!![]});var _0x14a4d5=_0x6ff6('0x2a');return db[_0x6ff6('0x2b')][_0x6ff6('0x28')]({'where':{'type':_0x14a4d5,'resourceId':_0x19cd0f['id']}})[_0x6ff6('0x27')](function(){return _0x5a5130;});})['then'](function(){_0x550dfb[_0x6ff6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f5778,_0x3c6d71){return function(_0x54f3ce){if(!_0x54f3ce){_0x1f5778['sendStatus'](0x194);}return _0x54f3ce;};}function handleError(_0x569738,_0x1c3cdb){_0x1c3cdb=_0x1c3cdb||0x1f4;return function(_0x73291c){logger[_0x6ff6('0x2c')](_0x73291c[_0x6ff6('0x2d')]);if(_0x73291c['name']){delete _0x73291c[_0x6ff6('0x2e')];}_0x569738[_0x6ff6('0x1a')](_0x1c3cdb)[_0x6ff6('0x2f')](_0x73291c);};}exports[_0x6ff6('0x30')]=function(_0x57b063,_0x4bad5d){var _0x4fde3c={},_0x374d61={},_0x4ccc9e={'count':0x0,'rows':[]};return db[_0x6ff6('0x31')][_0x6ff6('0x32')]()[_0x6ff6('0x27')](function(_0x1bf189){_0x374d61[_0x6ff6('0x33')]=_[_0x6ff6('0x34')](_0x1bf189);_0x374d61[_0x6ff6('0x35')]=_[_0x6ff6('0x34')](_0x57b063['query']);_0x374d61['filters']=_[_0x6ff6('0x36')](_0x374d61[_0x6ff6('0x33')],_0x374d61['query']);_0x4fde3c[_0x6ff6('0x37')]=_[_0x6ff6('0x36')](_0x374d61[_0x6ff6('0x33')],qs[_0x6ff6('0x38')](_0x57b063['query'][_0x6ff6('0x38')]));_0x4fde3c[_0x6ff6('0x37')]=_0x4fde3c['attributes'][_0x6ff6('0x39')]?_0x4fde3c[_0x6ff6('0x37')]:_0x374d61[_0x6ff6('0x33')];if(!_0x57b063['query'][_0x6ff6('0x3a')](_0x6ff6('0x3b'))){_0x4fde3c[_0x6ff6('0x1f')]=qs[_0x6ff6('0x1f')](_0x57b063['query'][_0x6ff6('0x1f')]);_0x4fde3c[_0x6ff6('0x1d')]=qs[_0x6ff6('0x1d')](_0x57b063['query'][_0x6ff6('0x1d')]);}_0x4fde3c[_0x6ff6('0x3c')]=qs[_0x6ff6('0x3d')](_0x57b063['query'][_0x6ff6('0x3d')]);_0x4fde3c[_0x6ff6('0x3e')]=qs[_0x6ff6('0x3f')](_[_0x6ff6('0x40')](_0x57b063[_0x6ff6('0x35')],_0x374d61[_0x6ff6('0x3f')]),_0x1bf189);if(_0x57b063['query'][_0x6ff6('0x41')]){_0x4fde3c[_0x6ff6('0x3e')]=_['merge'](_0x4fde3c[_0x6ff6('0x3e')],{'$or':_[_0x6ff6('0x42')](_0x4fde3c['attributes'],function(_0x13ed76){var _0x20266e={};_0x20266e[_0x13ed76]={'$like':'%'+_0x57b063[_0x6ff6('0x35')][_0x6ff6('0x41')]+'%'};return _0x20266e;})});}_0x4fde3c=_['merge']({},_0x4fde3c,_0x57b063[_0x6ff6('0x43')]);var _0x506d43={'where':_0x4fde3c[_0x6ff6('0x3e')]};return db['CmCompany']['count'](_0x506d43)[_0x6ff6('0x27')](function(_0x245623){_0x4ccc9e[_0x6ff6('0x20')]=_0x245623;if(_0x57b063[_0x6ff6('0x35')]['includeAll']){_0x4fde3c[_0x6ff6('0x44')]=[{'all':!![]}];}return db[_0x6ff6('0x31')]['findAll'](_0x4fde3c);})[_0x6ff6('0x27')](function(_0xa7d9dd){_0x4ccc9e[_0x6ff6('0x45')]=_0xa7d9dd;return _0x4ccc9e;})[_0x6ff6('0x27')](respondWithFilteredResult(_0x4bad5d,_0x4fde3c))[_0x6ff6('0x46')](handleError(_0x4bad5d,null));})[_0x6ff6('0x46')](handleError(_0x4bad5d,null));};exports[_0x6ff6('0x47')]=function(_0x564597,_0x188ff6){var _0x5a0347={'raw':![],'where':{'id':_0x564597['params']['id']}},_0x4ab495={};_0x4ab495[_0x6ff6('0x33')]=_['keys'](db[_0x6ff6('0x31')][_0x6ff6('0x48')]);_0x4ab495[_0x6ff6('0x35')]=_['keys'](_0x564597[_0x6ff6('0x35')]);_0x4ab495[_0x6ff6('0x3f')]=_[_0x6ff6('0x36')](_0x4ab495[_0x6ff6('0x33')],_0x4ab495[_0x6ff6('0x35')]);_0x5a0347[_0x6ff6('0x37')]=_[_0x6ff6('0x36')](_0x4ab495[_0x6ff6('0x33')],qs['fields'](_0x564597[_0x6ff6('0x35')][_0x6ff6('0x38')]));_0x5a0347['attributes']=_0x5a0347['attributes']['length']?_0x5a0347[_0x6ff6('0x37')]:_0x4ab495[_0x6ff6('0x33')];if(_0x564597[_0x6ff6('0x35')][_0x6ff6('0x49')]){_0x5a0347[_0x6ff6('0x44')]=[{'all':!![]}];}_0x5a0347=_[_0x6ff6('0x4a')]({},_0x5a0347,_0x564597[_0x6ff6('0x43')]);return db[_0x6ff6('0x31')][_0x6ff6('0x4b')](_0x5a0347)['then'](handleEntityNotFound(_0x188ff6,null))[_0x6ff6('0x27')](respondWithResult(_0x188ff6,null))['catch'](handleError(_0x188ff6,null));};exports[_0x6ff6('0x4c')]=function(_0x2574f4,_0x2651c2){return db[_0x6ff6('0x31')][_0x6ff6('0x4c')](_0x2574f4[_0x6ff6('0x4d')],{})[_0x6ff6('0x27')](function(_0x503a5c){var _0x4a3e0a=_0x2574f4[_0x6ff6('0x4e')][_0x6ff6('0x29')]({'plain':!![]});if(!_0x4a3e0a)throw new Error(_0x6ff6('0x4f'));if(_0x4a3e0a['role']===_0x6ff6('0x4e')){var _0x37c70e=_0x503a5c[_0x6ff6('0x29')]({'plain':!![]});var _0x47b107=_0x6ff6('0x2a');return db[_0x6ff6('0x50')][_0x6ff6('0x4b')]({'where':{'name':_0x47b107,'userProfileId':_0x4a3e0a['userProfileId']},'raw':!![]})['then'](function(_0x23a758){if(_0x23a758&&_0x23a758['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x37c70e[_0x6ff6('0x2e')],'resourceId':_0x37c70e['id'],'type':_0x23a758[_0x6ff6('0x2e')],'sectionId':_0x23a758['id']},{})['then'](function(){return _0x503a5c;});}else{return _0x503a5c;}})[_0x6ff6('0x46')](function(_0x5c9353){logger['error'](_0x6ff6('0x51'),_0x5c9353);throw _0x5c9353;});}return _0x503a5c;})[_0x6ff6('0x27')](respondWithResult(_0x2651c2,0xc9))[_0x6ff6('0x46')](handleError(_0x2651c2,null));};exports[_0x6ff6('0x26')]=function(_0x1a74bb,_0x1f6c05){if(_0x1a74bb[_0x6ff6('0x4d')]['id']){delete _0x1a74bb['body']['id'];}return db[_0x6ff6('0x31')]['find']({'where':{'id':_0x1a74bb[_0x6ff6('0x52')]['id']}})[_0x6ff6('0x27')](handleEntityNotFound(_0x1f6c05,null))[_0x6ff6('0x27')](saveUpdates(_0x1a74bb[_0x6ff6('0x4d')],null))['then'](respondWithResult(_0x1f6c05,null))[_0x6ff6('0x46')](handleError(_0x1f6c05,null));};exports[_0x6ff6('0x28')]=function(_0x549f94,_0x5b9798){return db[_0x6ff6('0x31')][_0x6ff6('0x4b')]({'where':{'id':_0x549f94[_0x6ff6('0x52')]['id']}})[_0x6ff6('0x27')](handleEntityNotFound(_0x5b9798,null))[_0x6ff6('0x27')](removeEntity(_0x5b9798,null))[_0x6ff6('0x46')](handleError(_0x5b9798,null));};exports['describe']=function(_0x337bbc,_0x14ff2c){return db[_0x6ff6('0x31')]['describe']()['then'](respondWithResult(_0x14ff2c,null))['catch'](handleError(_0x14ff2c,null));};exports[_0x6ff6('0x53')]=function(_0x5e7243,_0x17f550,_0x3ef707){return db['CmContact'][_0x6ff6('0x4b')]({'where':{'id':_0x5e7243[_0x6ff6('0x52')]['id']}})[_0x6ff6('0x27')](handleEntityNotFound(_0x17f550,null))[_0x6ff6('0x27')](function(_0x410992){if(_0x410992){return _0x410992[_0x6ff6('0x53')](_0x5e7243[_0x6ff6('0x4d')][_0x6ff6('0x54')],_['omit'](_0x5e7243[_0x6ff6('0x4d')],[_0x6ff6('0x54'),'id'])||{});}})[_0x6ff6('0x27')](respondWithResult(_0x17f550,null))[_0x6ff6('0x46')](handleError(_0x17f550,null));};exports[_0x6ff6('0x55')]=function(_0x4b0040,_0xd2ac44,_0x6a0084){var _0x25bacd={};var _0x54f505={};var _0x1c5120;var _0x7ad8b5;return db['CmCompany']['findOne']({'where':{'id':_0x4b0040[_0x6ff6('0x52')]['id']}})[_0x6ff6('0x27')](handleEntityNotFound(_0xd2ac44,null))[_0x6ff6('0x27')](function(_0x439c85){if(_0x439c85){_0x1c5120=_0x439c85;_0x54f505['model']=_[_0x6ff6('0x34')](db[_0x6ff6('0x56')][_0x6ff6('0x48')]);_0x54f505[_0x6ff6('0x35')]=_['keys'](_0x4b0040[_0x6ff6('0x35')]);_0x54f505[_0x6ff6('0x3f')]=_[_0x6ff6('0x36')](_0x54f505[_0x6ff6('0x33')],_0x54f505[_0x6ff6('0x35')]);_0x25bacd[_0x6ff6('0x37')]=_[_0x6ff6('0x36')](_0x54f505['model'],qs['fields'](_0x4b0040[_0x6ff6('0x35')][_0x6ff6('0x38')]));_0x25bacd['attributes']=_0x25bacd[_0x6ff6('0x37')][_0x6ff6('0x39')]?_0x25bacd[_0x6ff6('0x37')]:_0x54f505[_0x6ff6('0x33')];_0x25bacd[_0x6ff6('0x3c')]=qs[_0x6ff6('0x3d')](_0x4b0040[_0x6ff6('0x35')][_0x6ff6('0x3d')]);_0x25bacd['where']=qs[_0x6ff6('0x3f')](_[_0x6ff6('0x40')](_0x4b0040[_0x6ff6('0x35')],_0x54f505['filters']));if(_0x4b0040[_0x6ff6('0x35')][_0x6ff6('0x41')]){_0x25bacd[_0x6ff6('0x3e')]=_[_0x6ff6('0x4a')](_0x25bacd[_0x6ff6('0x3e')],{'$or':_[_0x6ff6('0x42')](_0x25bacd[_0x6ff6('0x37')],function(_0x2b8f6d){var _0x13b3b9={};_0x13b3b9[_0x2b8f6d]={'$like':'%'+_0x4b0040[_0x6ff6('0x35')]['filter']+'%'};return _0x13b3b9;})});}_0x25bacd=_['merge']({},_0x25bacd,_0x4b0040[_0x6ff6('0x43')]);return _0x1c5120[_0x6ff6('0x55')](_0x25bacd);}})['then'](function(_0x17cc67){if(_0x17cc67){_0x7ad8b5=_0x17cc67['length'];if(!_0x4b0040[_0x6ff6('0x35')][_0x6ff6('0x3a')](_0x6ff6('0x3b'))){_0x25bacd[_0x6ff6('0x1f')]=qs['limit'](_0x4b0040['query'][_0x6ff6('0x1f')]);_0x25bacd[_0x6ff6('0x1d')]=qs[_0x6ff6('0x1d')](_0x4b0040[_0x6ff6('0x35')][_0x6ff6('0x1d')]);}return _0x1c5120[_0x6ff6('0x55')](_0x25bacd);}})['then'](function(_0x56148b){if(_0x56148b){return _0x56148b?{'count':_0x7ad8b5,'rows':_0x56148b}:null;}})[_0x6ff6('0x27')](respondWithResult(_0xd2ac44,null))[_0x6ff6('0x46')](handleError(_0xd2ac44,null));}; \ No newline at end of file +var _0x766f=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','save','update','then','get','Companies','UserProfileResource','error','send','index','CmCompany','describe','model','keys','query','intersection','attributes','length','hasOwnProperty','order','sort','pick','filters','where','merge','map','filter','options','includeAll','include','findAll','catch','show','fields','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','destroy','addContacts','CmContact','omit','getContacts','findOne','nolimit','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x766f,0x93));var _0xf766=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x766f[_0x4a53d];return _0x27410e;};'use strict';var emlformat=require(_0xf766('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf766('0x1'));var rp=require(_0xf766('0x2'));var moment=require(_0xf766('0x3'));var BPromise=require(_0xf766('0x4'));var Mustache=require(_0xf766('0x5'));var util=require(_0xf766('0x6'));var path=require(_0xf766('0x7'));var sox=require(_0xf766('0x8'));var csv=require(_0xf766('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf766('0xa'));var _=require('lodash');var squel=require(_0xf766('0xb'));var crypto=require('crypto');var jsforce=require(_0xf766('0xc'));var deskjs=require(_0xf766('0xd'));var toCsv=require(_0xf766('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf766('0xe'));var authService=require(_0xf766('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf766('0x10'));var hardwareService=require(_0xf766('0x11'));var logger=require('../../config/logger')(_0xf766('0x12'));var utils=require(_0xf766('0x13'));var config=require(_0xf766('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xf766('0x15'))['db'];function respondWithStatusCode(_0x1d78da,_0x13538e){_0x13538e=_0x13538e||0xcc;return function(_0x15bd10){if(_0x15bd10){return _0x1d78da[_0xf766('0x16')](_0x13538e);}return _0x1d78da[_0xf766('0x17')](_0x13538e)[_0xf766('0x18')]();};}function respondWithResult(_0xe896eb,_0x21c534){_0x21c534=_0x21c534||0xc8;return function(_0x484c78){if(_0x484c78){return _0xe896eb[_0xf766('0x17')](_0x21c534)[_0xf766('0x19')](_0x484c78);}};}function respondWithFilteredResult(_0x5108d9,_0xd6177c){return function(_0x300230){if(_0x300230){var _0xfff5ab=typeof _0xd6177c[_0xf766('0x1a')]==='undefined'&&typeof _0xd6177c[_0xf766('0x1b')]===_0xf766('0x1c');var _0x1ecd08=_0x300230['count'];var _0x39ae00=_0xfff5ab?0x0:_0xd6177c[_0xf766('0x1a')];var _0x34faa1=_0xfff5ab?_0x300230[_0xf766('0x1d')]:_0xd6177c[_0xf766('0x1a')]+_0xd6177c[_0xf766('0x1b')];var _0xa5064c;if(_0x34faa1>=_0x1ecd08){_0x34faa1=_0x1ecd08;_0xa5064c=0xc8;}else{_0xa5064c=0xce;}_0x5108d9[_0xf766('0x17')](_0xa5064c);return _0x5108d9[_0xf766('0x1e')]('Content-Range',_0x39ae00+'-'+_0x34faa1+'/'+_0x1ecd08)['json'](_0x300230);}return null;};}function patchUpdates(_0x50fbc8){return function(_0x1b41fd){try{jsonpatch[_0xf766('0x1f')](_0x1b41fd,_0x50fbc8,!![]);}catch(_0x53738e){return BPromise['reject'](_0x53738e);}return _0x1b41fd[_0xf766('0x20')]();};}function saveUpdates(_0xa20c66,_0x74ce8b){return function(_0x4425a2){if(_0x4425a2){return _0x4425a2[_0xf766('0x21')](_0xa20c66)['then'](function(_0x4b1c42){return _0x4b1c42;});}return null;};}function removeEntity(_0x2aa6e5,_0x4a1f97){return function(_0x1e6f2d){if(_0x1e6f2d){return _0x1e6f2d['destroy']()[_0xf766('0x22')](function(){var _0x3c912d=_0x1e6f2d[_0xf766('0x23')]({'plain':!![]});var _0x34be22=_0xf766('0x24');return db[_0xf766('0x25')]['destroy']({'where':{'type':_0x34be22,'resourceId':_0x3c912d['id']}})[_0xf766('0x22')](function(){return _0x1e6f2d;});})[_0xf766('0x22')](function(){_0x2aa6e5[_0xf766('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5249ec,_0x3566c7){return function(_0x2e16ce){if(!_0x2e16ce){_0x5249ec[_0xf766('0x16')](0x194);}return _0x2e16ce;};}function handleError(_0x35be99,_0xce90a9){_0xce90a9=_0xce90a9||0x1f4;return function(_0x2c9913){logger[_0xf766('0x26')](_0x2c9913['stack']);if(_0x2c9913['name']){delete _0x2c9913['name'];}_0x35be99[_0xf766('0x17')](_0xce90a9)[_0xf766('0x27')](_0x2c9913);};}exports[_0xf766('0x28')]=function(_0x2c0972,_0x30df46){var _0x1b164f={},_0x3e7833={},_0x226b67={'count':0x0,'rows':[]};return db[_0xf766('0x29')][_0xf766('0x2a')]()[_0xf766('0x22')](function(_0x36962d){_0x3e7833[_0xf766('0x2b')]=_[_0xf766('0x2c')](_0x36962d);_0x3e7833['query']=_['keys'](_0x2c0972[_0xf766('0x2d')]);_0x3e7833['filters']=_[_0xf766('0x2e')](_0x3e7833[_0xf766('0x2b')],_0x3e7833[_0xf766('0x2d')]);_0x1b164f[_0xf766('0x2f')]=_[_0xf766('0x2e')](_0x3e7833[_0xf766('0x2b')],qs['fields'](_0x2c0972[_0xf766('0x2d')]['fields']));_0x1b164f[_0xf766('0x2f')]=_0x1b164f[_0xf766('0x2f')][_0xf766('0x30')]?_0x1b164f[_0xf766('0x2f')]:_0x3e7833[_0xf766('0x2b')];if(!_0x2c0972[_0xf766('0x2d')][_0xf766('0x31')]('nolimit')){_0x1b164f[_0xf766('0x1b')]=qs['limit'](_0x2c0972['query'][_0xf766('0x1b')]);_0x1b164f[_0xf766('0x1a')]=qs['offset'](_0x2c0972[_0xf766('0x2d')][_0xf766('0x1a')]);}_0x1b164f[_0xf766('0x32')]=qs[_0xf766('0x33')](_0x2c0972['query'][_0xf766('0x33')]);_0x1b164f['where']=qs['filters'](_[_0xf766('0x34')](_0x2c0972[_0xf766('0x2d')],_0x3e7833[_0xf766('0x35')]),_0x36962d);if(_0x2c0972[_0xf766('0x2d')]['filter']){_0x1b164f[_0xf766('0x36')]=_[_0xf766('0x37')](_0x1b164f['where'],{'$or':_[_0xf766('0x38')](_0x1b164f['attributes'],function(_0x2e627c){var _0x178f90={};_0x178f90[_0x2e627c]={'$like':'%'+_0x2c0972[_0xf766('0x2d')][_0xf766('0x39')]+'%'};return _0x178f90;})});}_0x1b164f=_['merge']({},_0x1b164f,_0x2c0972[_0xf766('0x3a')]);var _0x4f47d5={'where':_0x1b164f[_0xf766('0x36')]};return db[_0xf766('0x29')]['count'](_0x4f47d5)['then'](function(_0x241405){_0x226b67[_0xf766('0x1d')]=_0x241405;if(_0x2c0972[_0xf766('0x2d')][_0xf766('0x3b')]){_0x1b164f[_0xf766('0x3c')]=[{'all':!![]}];}return db[_0xf766('0x29')][_0xf766('0x3d')](_0x1b164f);})[_0xf766('0x22')](function(_0x1490d4){_0x226b67['rows']=_0x1490d4;return _0x226b67;})[_0xf766('0x22')](respondWithFilteredResult(_0x30df46,_0x1b164f))['catch'](handleError(_0x30df46,null));})[_0xf766('0x3e')](handleError(_0x30df46,null));};exports[_0xf766('0x3f')]=function(_0x22d678,_0x248aa8){var _0x47f46e={'raw':![],'where':{'id':_0x22d678['params']['id']}},_0x9acd46={};_0x9acd46[_0xf766('0x2b')]=_[_0xf766('0x2c')](db[_0xf766('0x29')]['rawAttributes']);_0x9acd46['query']=_[_0xf766('0x2c')](_0x22d678[_0xf766('0x2d')]);_0x9acd46[_0xf766('0x35')]=_[_0xf766('0x2e')](_0x9acd46['model'],_0x9acd46[_0xf766('0x2d')]);_0x47f46e[_0xf766('0x2f')]=_[_0xf766('0x2e')](_0x9acd46[_0xf766('0x2b')],qs[_0xf766('0x40')](_0x22d678[_0xf766('0x2d')][_0xf766('0x40')]));_0x47f46e[_0xf766('0x2f')]=_0x47f46e[_0xf766('0x2f')][_0xf766('0x30')]?_0x47f46e[_0xf766('0x2f')]:_0x9acd46[_0xf766('0x2b')];if(_0x22d678[_0xf766('0x2d')][_0xf766('0x3b')]){_0x47f46e[_0xf766('0x3c')]=[{'all':!![]}];}_0x47f46e=_[_0xf766('0x37')]({},_0x47f46e,_0x22d678[_0xf766('0x3a')]);return db[_0xf766('0x29')][_0xf766('0x41')](_0x47f46e)[_0xf766('0x22')](handleEntityNotFound(_0x248aa8,null))[_0xf766('0x22')](respondWithResult(_0x248aa8,null))[_0xf766('0x3e')](handleError(_0x248aa8,null));};exports[_0xf766('0x42')]=function(_0x52808e,_0x5a4adf){return db[_0xf766('0x29')]['create'](_0x52808e['body'],{})[_0xf766('0x22')](function(_0x532af3){var _0x171d50=_0x52808e[_0xf766('0x43')][_0xf766('0x23')]({'plain':!![]});if(!_0x171d50)throw new Error(_0xf766('0x44'));if(_0x171d50[_0xf766('0x45')]===_0xf766('0x43')){var _0x144cdb=_0x532af3[_0xf766('0x23')]({'plain':!![]});var _0x4f8683=_0xf766('0x24');return db[_0xf766('0x46')]['find']({'where':{'name':_0x4f8683,'userProfileId':_0x171d50[_0xf766('0x47')]},'raw':!![]})[_0xf766('0x22')](function(_0x5a3dc9){if(_0x5a3dc9&&_0x5a3dc9['autoAssociation']===0x0){return db[_0xf766('0x25')][_0xf766('0x42')]({'name':_0x144cdb['name'],'resourceId':_0x144cdb['id'],'type':_0x5a3dc9['name'],'sectionId':_0x5a3dc9['id']},{})[_0xf766('0x22')](function(){return _0x532af3;});}else{return _0x532af3;}})[_0xf766('0x3e')](function(_0x75b039){logger[_0xf766('0x26')](_0xf766('0x48'),_0x75b039);throw _0x75b039;});}return _0x532af3;})['then'](respondWithResult(_0x5a4adf,0xc9))[_0xf766('0x3e')](handleError(_0x5a4adf,null));};exports['update']=function(_0x4a6857,_0x4430ef){if(_0x4a6857[_0xf766('0x49')]['id']){delete _0x4a6857[_0xf766('0x49')]['id'];}return db[_0xf766('0x29')][_0xf766('0x41')]({'where':{'id':_0x4a6857[_0xf766('0x4a')]['id']}})[_0xf766('0x22')](handleEntityNotFound(_0x4430ef,null))[_0xf766('0x22')](saveUpdates(_0x4a6857[_0xf766('0x49')],null))[_0xf766('0x22')](respondWithResult(_0x4430ef,null))[_0xf766('0x3e')](handleError(_0x4430ef,null));};exports[_0xf766('0x4b')]=function(_0x572962,_0x8f9576){return db['CmCompany'][_0xf766('0x41')]({'where':{'id':_0x572962[_0xf766('0x4a')]['id']}})[_0xf766('0x22')](handleEntityNotFound(_0x8f9576,null))[_0xf766('0x22')](removeEntity(_0x8f9576,null))[_0xf766('0x3e')](handleError(_0x8f9576,null));};exports[_0xf766('0x2a')]=function(_0x16981f,_0x5292cb){return db['CmCompany']['describe']()[_0xf766('0x22')](respondWithResult(_0x5292cb,null))['catch'](handleError(_0x5292cb,null));};exports[_0xf766('0x4c')]=function(_0x18e62b,_0x5f3977,_0x509246){return db[_0xf766('0x4d')][_0xf766('0x41')]({'where':{'id':_0x18e62b[_0xf766('0x4a')]['id']}})[_0xf766('0x22')](handleEntityNotFound(_0x5f3977,null))['then'](function(_0x275984){if(_0x275984){return _0x275984[_0xf766('0x4c')](_0x18e62b[_0xf766('0x49')]['ids'],_[_0xf766('0x4e')](_0x18e62b[_0xf766('0x49')],['ids','id'])||{});}})['then'](respondWithResult(_0x5f3977,null))['catch'](handleError(_0x5f3977,null));};exports[_0xf766('0x4f')]=function(_0x433ebc,_0xc818f0,_0x2f0875){var _0x4f3fe8={};var _0x256643={};var _0x4ac2b4;var _0x11485c;return db[_0xf766('0x29')][_0xf766('0x50')]({'where':{'id':_0x433ebc[_0xf766('0x4a')]['id']}})['then'](handleEntityNotFound(_0xc818f0,null))[_0xf766('0x22')](function(_0xc75fb6){if(_0xc75fb6){_0x4ac2b4=_0xc75fb6;_0x256643[_0xf766('0x2b')]=_[_0xf766('0x2c')](db[_0xf766('0x4d')]['rawAttributes']);_0x256643[_0xf766('0x2d')]=_[_0xf766('0x2c')](_0x433ebc['query']);_0x256643[_0xf766('0x35')]=_[_0xf766('0x2e')](_0x256643[_0xf766('0x2b')],_0x256643[_0xf766('0x2d')]);_0x4f3fe8[_0xf766('0x2f')]=_[_0xf766('0x2e')](_0x256643[_0xf766('0x2b')],qs[_0xf766('0x40')](_0x433ebc[_0xf766('0x2d')][_0xf766('0x40')]));_0x4f3fe8[_0xf766('0x2f')]=_0x4f3fe8[_0xf766('0x2f')][_0xf766('0x30')]?_0x4f3fe8[_0xf766('0x2f')]:_0x256643['model'];_0x4f3fe8['order']=qs[_0xf766('0x33')](_0x433ebc[_0xf766('0x2d')][_0xf766('0x33')]);_0x4f3fe8[_0xf766('0x36')]=qs[_0xf766('0x35')](_[_0xf766('0x34')](_0x433ebc[_0xf766('0x2d')],_0x256643[_0xf766('0x35')]));if(_0x433ebc[_0xf766('0x2d')][_0xf766('0x39')]){_0x4f3fe8[_0xf766('0x36')]=_[_0xf766('0x37')](_0x4f3fe8[_0xf766('0x36')],{'$or':_[_0xf766('0x38')](_0x4f3fe8[_0xf766('0x2f')],function(_0x19ad79){var _0x3cedf1={};_0x3cedf1[_0x19ad79]={'$like':'%'+_0x433ebc['query'][_0xf766('0x39')]+'%'};return _0x3cedf1;})});}_0x4f3fe8=_[_0xf766('0x37')]({},_0x4f3fe8,_0x433ebc[_0xf766('0x3a')]);return _0x4ac2b4[_0xf766('0x4f')](_0x4f3fe8);}})[_0xf766('0x22')](function(_0x3d0eb9){if(_0x3d0eb9){_0x11485c=_0x3d0eb9[_0xf766('0x30')];if(!_0x433ebc['query'][_0xf766('0x31')](_0xf766('0x51'))){_0x4f3fe8['limit']=qs[_0xf766('0x1b')](_0x433ebc['query']['limit']);_0x4f3fe8[_0xf766('0x1a')]=qs[_0xf766('0x1a')](_0x433ebc['query'][_0xf766('0x1a')]);}return _0x4ac2b4[_0xf766('0x4f')](_0x4f3fe8);}})[_0xf766('0x22')](function(_0x57d5ea){if(_0x57d5ea){return _0x57d5ea?{'count':_0x11485c,'rows':_0x57d5ea}:null;}})[_0xf766('0x22')](respondWithResult(_0xc818f0,null))[_0xf766('0x3e')](handleError(_0xc818f0,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index a18c5f0..6dba26f 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 _0x57aa=['request-promise','rimraf','../../config/environment','exports','define','cm_companies','lodash','util','../../config/logger'];(function(_0x2cb4cb,_0x273e65){var _0x5566fd=function(_0xe66217){while(--_0xe66217){_0x2cb4cb['push'](_0x2cb4cb['shift']());}};_0x5566fd(++_0x273e65);}(_0x57aa,0x69));var _0xa57a=function(_0x52c8d3,_0x15009a){_0x52c8d3=_0x52c8d3-0x0;var _0x4b7f9d=_0x57aa[_0x52c8d3];return _0x4b7f9d;};'use strict';var _=require(_0xa57a('0x0'));var util=require(_0xa57a('0x1'));var logger=require(_0xa57a('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa57a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa57a('0x4'));var config=require(_0xa57a('0x5'));var attributes=require('./cmCompany.attributes');module[_0xa57a('0x6')]=function(_0x1d60d0,_0x4dea2a){return _0x1d60d0[_0xa57a('0x7')]('CmCompany',attributes,{'tableName':_0xa57a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x02a7=['request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','CmCompany','cm_companies','lodash','util','api','moment','bluebird'];(function(_0x84601,_0xd0d940){var _0x5995cf=function(_0x2624ba){while(--_0x2624ba){_0x84601['push'](_0x84601['shift']());}};_0x5995cf(++_0xd0d940);}(_0x02a7,0x103));var _0x702a=function(_0x5e03fb,_0x32b730){_0x5e03fb=_0x5e03fb-0x0;var _0x1004bf=_0x02a7[_0x5e03fb];return _0x1004bf;};'use strict';var _=require(_0x702a('0x0'));var util=require(_0x702a('0x1'));var logger=require('../../config/logger')(_0x702a('0x2'));var moment=require(_0x702a('0x3'));var BPromise=require(_0x702a('0x4'));var rp=require(_0x702a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x702a('0x6'));var config=require(_0x702a('0x7'));var attributes=require(_0x702a('0x8'));module[_0x702a('0x9')]=function(_0x194f02,_0x31f63f){return _0x194f02['define'](_0x702a('0xa'),attributes,{'tableName':_0x702a('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 248e87e..bc1c3e9 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 _0x4f8f=['message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','CmCompany,\x20%s,\x20%s','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x1dcb37,_0x2d1499){var _0x3d1f88=function(_0x48d685){while(--_0x48d685){_0x1dcb37['push'](_0x1dcb37['shift']());}};_0x3d1f88(++_0x2d1499);}(_0x4f8f,0x115));var _0xf4f8=function(_0x4b8b37,_0x10aa33){_0x4b8b37=_0x4b8b37-0x0;var _0x563b0f=_0x4f8f[_0x4b8b37];return _0x563b0f;};'use strict';var _=require(_0xf4f8('0x0'));var util=require(_0xf4f8('0x1'));var moment=require('moment');var BPromise=require(_0xf4f8('0x2'));var rs=require(_0xf4f8('0x3'));var fs=require('fs');var Redis=require(_0xf4f8('0x4'));var db=require(_0xf4f8('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf4f8('0x6'))(_0xf4f8('0x7'));var config=require('../../config/environment');var jayson=require(_0xf4f8('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2b35a8,_0x19d9f3,_0x45c67f){return new BPromise(function(_0x50186b,_0x3abf71){return client[_0xf4f8('0x9')](_0x2b35a8,_0x45c67f)[_0xf4f8('0xa')](function(_0x1117f4){logger['info'](_0xf4f8('0xb'),_0x19d9f3,'request\x20sent');logger[_0xf4f8('0xc')](_0xf4f8('0xd'),_0x19d9f3,'request\x20sent',JSON[_0xf4f8('0xe')](_0x1117f4));if(_0x1117f4[_0xf4f8('0xf')]){if(_0x1117f4[_0xf4f8('0xf')][_0xf4f8('0x10')]===0x1f4){logger[_0xf4f8('0xf')](_0xf4f8('0xb'),_0x19d9f3,_0x1117f4['error'][_0xf4f8('0x11')]);return _0x3abf71(_0x1117f4[_0xf4f8('0xf')][_0xf4f8('0x11')]);}logger[_0xf4f8('0xf')]('CmCompany,\x20%s,\x20%s',_0x19d9f3,_0x1117f4[_0xf4f8('0xf')][_0xf4f8('0x11')]);return _0x50186b(_0x1117f4['error'][_0xf4f8('0x11')]);}else{logger[_0xf4f8('0x12')](_0xf4f8('0xb'),_0x19d9f3,'request\x20sent');_0x50186b(_0x1117f4[_0xf4f8('0x13')][_0xf4f8('0x11')]);}})[_0xf4f8('0x14')](function(_0x42a8f3){logger[_0xf4f8('0xf')](_0xf4f8('0xb'),_0x19d9f3,_0x42a8f3);_0x3abf71(_0x42a8f3);});});} \ No newline at end of file +var _0x8f19=['lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','CmCompany,\x20%s,\x20%s','CmCompany,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch'];(function(_0xac4137,_0x5efd64){var _0x3531df=function(_0x117abd){while(--_0x117abd){_0xac4137['push'](_0xac4137['shift']());}};_0x3531df(++_0x5efd64);}(_0x8f19,0x104));var _0x98f1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f19[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x98f1('0x0'));var util=require(_0x98f1('0x1'));var moment=require(_0x98f1('0x2'));var BPromise=require(_0x98f1('0x3'));var rs=require(_0x98f1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x98f1('0x5'));var logger=require(_0x98f1('0x6'))(_0x98f1('0x7'));var config=require(_0x98f1('0x8'));var jayson=require(_0x98f1('0x9'));var client=jayson[_0x98f1('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1880e9,_0xaa499d,_0x117e07){return new BPromise(function(_0x43b466,_0x50e6dc){return client[_0x98f1('0xb')](_0x1880e9,_0x117e07)['then'](function(_0x1ccbd6){logger[_0x98f1('0xc')](_0x98f1('0xd'),_0xaa499d,'request\x20sent');logger['debug'](_0x98f1('0xe'),_0xaa499d,'request\x20sent',JSON['stringify'](_0x1ccbd6));if(_0x1ccbd6['error']){if(_0x1ccbd6[_0x98f1('0xf')]['code']===0x1f4){logger[_0x98f1('0xf')]('CmCompany,\x20%s,\x20%s',_0xaa499d,_0x1ccbd6['error']['message']);return _0x50e6dc(_0x1ccbd6[_0x98f1('0xf')][_0x98f1('0x10')]);}logger[_0x98f1('0xf')]('CmCompany,\x20%s,\x20%s',_0xaa499d,_0x1ccbd6[_0x98f1('0xf')]['message']);return _0x43b466(_0x1ccbd6[_0x98f1('0xf')][_0x98f1('0x10')]);}else{logger[_0x98f1('0xc')](_0x98f1('0xd'),_0xaa499d,_0x98f1('0x11'));_0x43b466(_0x1ccbd6[_0x98f1('0x12')][_0x98f1('0x10')]);}})[_0x98f1('0x13')](function(_0x3a3c32){logger[_0x98f1('0xf')](_0x98f1('0xd'),_0xaa499d,_0x3a3c32);_0x50e6dc(_0x3a3c32);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index ea5a3c2..b9a9f7b 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 _0x4a9e=['/:id','getContacts','post','create','/:id/contacts','addContacts','put','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','./cmCompany.controller','get','isAuthenticated','index','/describe'];(function(_0x2b9d5c,_0x173518){var _0x37bb93=function(_0x5515cd){while(--_0x5515cd){_0x2b9d5c['push'](_0x2b9d5c['shift']());}};_0x37bb93(++_0x173518);}(_0x4a9e,0x1ad));var _0xe4a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a9e[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0xe4a9('0x0'));var util=require(_0xe4a9('0x1'));var path=require(_0xe4a9('0x2'));var timeout=require(_0xe4a9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe4a9('0x4'));var interaction=require(_0xe4a9('0x5'));var config=require('../../config/environment');var controller=require(_0xe4a9('0x6'));router[_0xe4a9('0x7')]('/',auth[_0xe4a9('0x8')](),controller[_0xe4a9('0x9')]);router[_0xe4a9('0x7')](_0xe4a9('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xe4a9('0x7')](_0xe4a9('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xe4a9('0x7')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xe4a9('0xc')]);router[_0xe4a9('0xd')]('/',auth[_0xe4a9('0x8')](),controller[_0xe4a9('0xe')]);router['post'](_0xe4a9('0xf'),auth['isAuthenticated'](),controller[_0xe4a9('0x10')]);router[_0xe4a9('0x11')](_0xe4a9('0xb'),auth[_0xe4a9('0x8')](),controller[_0xe4a9('0x12')]);router[_0xe4a9('0x13')](_0xe4a9('0xb'),auth[_0xe4a9('0x8')](),controller[_0xe4a9('0x14')]);module[_0xe4a9('0x15')]=router; \ No newline at end of file +var _0xea2d=['/describe','describe','/:id','show','/:id/contacts','getContacts','create','post','put','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index'];(function(_0x5b80b0,_0x5e50f8){var _0x198b5f=function(_0x3ae56d){while(--_0x3ae56d){_0x5b80b0['push'](_0x5b80b0['shift']());}};_0x198b5f(++_0x5e50f8);}(_0xea2d,0xfb));var _0xdea2=function(_0xbcafe5,_0x2aaa35){_0xbcafe5=_0xbcafe5-0x0;var _0x2aded6=_0xea2d[_0xbcafe5];return _0x2aded6;};'use strict';var multer=require('multer');var util=require(_0xdea2('0x0'));var path=require(_0xdea2('0x1'));var timeout=require(_0xdea2('0x2'));var express=require(_0xdea2('0x3'));var router=express[_0xdea2('0x4')]();var fs_extra=require(_0xdea2('0x5'));var auth=require(_0xdea2('0x6'));var interaction=require(_0xdea2('0x7'));var config=require(_0xdea2('0x8'));var controller=require(_0xdea2('0x9'));router[_0xdea2('0xa')]('/',auth[_0xdea2('0xb')](),controller[_0xdea2('0xc')]);router[_0xdea2('0xa')](_0xdea2('0xd'),auth['isAuthenticated'](),controller[_0xdea2('0xe')]);router['get'](_0xdea2('0xf'),auth[_0xdea2('0xb')](),controller[_0xdea2('0x10')]);router[_0xdea2('0xa')](_0xdea2('0x11'),auth['isAuthenticated'](),controller[_0xdea2('0x12')]);router['post']('/',auth[_0xdea2('0xb')](),controller[_0xdea2('0x13')]);router[_0xdea2('0x14')](_0xdea2('0x11'),auth[_0xdea2('0xb')](),controller['addContacts']);router[_0xdea2('0x15')](_0xdea2('0xf'),auth[_0xdea2('0xb')](),controller['update']);router['delete'](_0xdea2('0xf'),auth[_0xdea2('0xb')](),controller[_0xdea2('0x16')]);module[_0xdea2('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 9c507ba..ea8ba8e 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 _0xb896=['INTEGER','DATE','NOW','lodash','exports','STRING','TEXT'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0xb896,0xb9));var _0x6b89=function(_0x52e68e,_0x309912){_0x52e68e=_0x52e68e-0x0;var _0x3211a4=_0xb896[_0x52e68e];return _0x3211a4;};'use strict';var _=require(_0x6b89('0x0'));var Sequelize=require('sequelize');module[_0x6b89('0x1')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0x6b89('0x2')]},'street':{'type':Sequelize[_0x6b89('0x2')]},'postalCode':{'type':Sequelize[_0x6b89('0x2')]},'city':{'type':Sequelize[_0x6b89('0x2')]},'country':{'type':Sequelize[_0x6b89('0x2')]},'dateOfBirth':{'type':Sequelize[_0x6b89('0x2')]},'description':{'type':Sequelize[_0x6b89('0x3')]},'phone':{'type':Sequelize[_0x6b89('0x2')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0x6b89('0x2')]},'email':{'type':Sequelize[_0x6b89('0x2')]},'url':{'type':Sequelize[_0x6b89('0x2')]},'facebook':{'type':Sequelize[_0x6b89('0x2')]},'fb_data':{'type':Sequelize[_0x6b89('0x2')]},'twitter':{'type':Sequelize[_0x6b89('0x2')]},'skype':{'type':Sequelize[_0x6b89('0x2')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x6b89('0x2')]},'wechat':{'type':Sequelize[_0x6b89('0x2')]},'telegram':{'type':Sequelize[_0x6b89('0x2')]},'UserId':{'type':Sequelize['INTEGER']},'AdditionalPhones':{'type':Sequelize[_0x6b89('0x2')]},'priority':{'type':Sequelize[_0x6b89('0x4')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x6b89('0x5')],'defaultValue':Sequelize[_0x6b89('0x6')]},'dialTimezone':{'type':Sequelize[_0x6b89('0x2')]},'utcOffset':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x8249=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x4aa7d6,_0x132398){var _0x549c6c=function(_0x242e9e){while(--_0x242e9e){_0x4aa7d6['push'](_0x4aa7d6['shift']());}};_0x549c6c(++_0x132398);}(_0x8249,0x1a2));var _0x9824=function(_0x43b1fb,_0x22e01e){_0x43b1fb=_0x43b1fb-0x0;var _0x2eb5bc=_0x8249[_0x43b1fb];return _0x2eb5bc;};'use strict';var _=require(_0x9824('0x0'));var Sequelize=require(_0x9824('0x1'));module[_0x9824('0x2')]={'firstName':{'type':Sequelize[_0x9824('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0x9824('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x9824('0x3')]},'dateOfBirth':{'type':Sequelize[_0x9824('0x3')]},'description':{'type':Sequelize[_0x9824('0x4')]},'phone':{'type':Sequelize[_0x9824('0x3')]},'mobile':{'type':Sequelize[_0x9824('0x3')]},'fax':{'type':Sequelize[_0x9824('0x3')]},'email':{'type':Sequelize[_0x9824('0x3')]},'url':{'type':Sequelize[_0x9824('0x3')]},'facebook':{'type':Sequelize[_0x9824('0x3')]},'fb_data':{'type':Sequelize[_0x9824('0x3')]},'twitter':{'type':Sequelize['STRING']},'skype':{'type':Sequelize[_0x9824('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x9824('0x3')]},'line':{'type':Sequelize[_0x9824('0x3')]},'wechat':{'type':Sequelize[_0x9824('0x3')]},'telegram':{'type':Sequelize[_0x9824('0x3')]},'UserId':{'type':Sequelize[_0x9824('0x5')]},'AdditionalPhones':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x9824('0x5')](0x2)[_0x9824('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x9824('0x7')],'defaultValue':Sequelize[_0x9824('0x8')]},'dialTimezone':{'type':Sequelize[_0x9824('0x3')]},'utcOffset':{'type':Sequelize[_0x9824('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 8ffe7ab..3987fe7 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 _0x0633=['each','duplicates','$or','where','ListId','findOrCreate','spread','push','contact','all','Tags','color','tag','Phones','ContactItemType','sequelize','literal','omit','map','$and','pickBy','format','cf_%d','table','cm_contacts','setFields','id\x20=\x20?','toParam','text','phone','getTags','findOne','Tag','filters','intersection','attributes','model','fields','order','sort','pick','options','nolimit','setAdditionalPhones','CmContactHasItem','items','item_types','ItemTypeId','description','OrderBy','contact\x20phone\x20exists','CmHopperAdditionalPhone','PHONE','ItemType','`ItemType`.OrderBy','CmHopperId','getAdditionalPhones','duplicateAdditionalPhones','fromContactId','toContactId','rawAttributes','ContactId','filter','includeAll','rows','include','getHopperFinals','getJscriptySessions','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','file','filename','chmodSync','child_process','CompanyId','socket_timestamp','File\x20uploaded\x20correctly!','send','upload','createReadStream','meta','import','User','agent','binding','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','pid','importUpdates','fork','../../components/import/cm/csvUpdates','exit','error\x20child\x20process','getJourney','mail','chat','openchannel','whatsapp','voice','-createdAt','resolve','includes','channel','toLowerCase','Invalid\x20channel','range','parse','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','destination','callerid','starttime','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','DESC','Website','Account','closed','closedAt','thirdDisposition','key','Owner','customerIp','customerPort','osName','ratingMessage','ratingType','ratingValue','referer','subject','externalUrl','threadId','startCase','findAndCountAll','flatten','sortBy','reverse','value','slice','moment','bluebird','util','path','squel','papaparse','ioredis','../../components/contacts','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./cmContact.socket','register','status','json','limit','undefined','count','offset','set','update','then','destroy','end','sendStatus','stack','name','index','describe','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','findAll','length','columnName','alias','type','values','info','Custom\x20field\x20%s\x20not\x20found\x20on\x20cm_contacts\x20table','forEach','hasOwnProperty','merge','body','from','get','mergeWith','isArray','join','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperFinal','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x0633,0x19e));var _0x3063=function(_0x122a37,_0x3ee0cf){_0x122a37=_0x122a37-0x0;var _0x5db960=_0x0633[_0x122a37];return _0x5db960;};'use strict';var moment=require(_0x3063('0x0'));var BPromise=require(_0x3063('0x1'));var util=require(_0x3063('0x2'));var path=require(_0x3063('0x3'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3063('0x4'));var Papa=require(_0x3063('0x5'));var Redis=require(_0x3063('0x6'));var contacts=require(_0x3063('0x7'));var qs=require(_0x3063('0x8'));var logger=require('../../config/logger')(_0x3063('0x9'));var config=require(_0x3063('0xa'));var shared=require('../../config/environment/shared');var db=require(_0x3063('0xb'))['db'];config[_0x3063('0xc')]=_[_0x3063('0xd')](config['redis'],{'host':_0x3063('0xe'),'port':0x18eb});var socket=require(_0x3063('0xf'))(new Redis(config['redis']));require(_0x3063('0x10'))[_0x3063('0x11')](socket);function respondWithResult(_0x21ec67,_0x4ecea0){_0x4ecea0=_0x4ecea0||0xc8;return function(_0x225cd7){if(_0x225cd7){return _0x21ec67[_0x3063('0x12')](_0x4ecea0)[_0x3063('0x13')](_0x225cd7);}};}function respondWithFilteredResult(_0x482235,_0x36332b){return function(_0x5a5de6){if(_0x5a5de6){var _0xb20dbe=typeof _0x36332b['offset']==='undefined'&&typeof _0x36332b[_0x3063('0x14')]===_0x3063('0x15');var _0xffc2a=_0x5a5de6[_0x3063('0x16')];var _0x5c5a0e=_0xb20dbe?0x0:_0x36332b[_0x3063('0x17')];var _0xccad6f=_0xb20dbe?_0x5a5de6[_0x3063('0x16')]:_0x36332b[_0x3063('0x17')]+_0x36332b[_0x3063('0x14')];var _0x1fc749;if(_0xccad6f>=_0xffc2a){_0xccad6f=_0xffc2a;_0x1fc749=0xc8;}else{_0x1fc749=0xce;}_0x482235[_0x3063('0x12')](_0x1fc749);return _0x482235[_0x3063('0x18')]('Content-Range',_0x5c5a0e+'-'+_0xccad6f+'/'+_0xffc2a)['json'](_0x5a5de6);}return null;};}function saveUpdates(_0xbcb100){return function(_0x2e23a2){if(_0x2e23a2){return _0x2e23a2[_0x3063('0x19')](_0xbcb100)[_0x3063('0x1a')](function(_0x2a9020){return _0x2a9020;});}return null;};}function removeEntity(_0x38a052){return function(_0x1fe40c){if(_0x1fe40c){return _0x1fe40c[_0x3063('0x1b')]()[_0x3063('0x1a')](function(){_0x38a052[_0x3063('0x12')](0xcc)[_0x3063('0x1c')]();});}};}function handleEntityNotFound(_0x45e952){return function(_0x1b0f0b){if(!_0x1b0f0b){_0x45e952[_0x3063('0x1d')](0x194);}return _0x1b0f0b;};}function handleError(_0x21b407,_0x4bc368){_0x4bc368=_0x4bc368||0x1f4;return function(_0x486e75){logger['error'](_0x486e75[_0x3063('0x1e')]);if(_0x486e75[_0x3063('0x1f')]){delete _0x486e75['name'];}_0x21b407[_0x3063('0x12')](_0x4bc368)['send'](_0x486e75);};}exports[_0x3063('0x20')]=function(_0xf96c1c,_0x5ee8d1){var _0x5ae3a8={};return contacts[_0x3063('0x21')]()['then'](function(_0x36c689){_0x5ae3a8=qs['getOptions'](_0x36c689,_0xf96c1c);return contacts['findAll'](_0xf96c1c[_0x3063('0x22')],_0xf96c1c[_0x3063('0x23')],_0x5ae3a8,_0x36c689);})[_0x3063('0x1a')](respondWithFilteredResult(_0x5ee8d1,_0x5ae3a8))[_0x3063('0x24')](handleError(_0x5ee8d1,null));};exports[_0x3063('0x1b')]=function(_0x10d53f,_0xc9519a){return db[_0x3063('0x25')][_0x3063('0x26')]({'where':{'id':_0x10d53f[_0x3063('0x27')]['id']}})[_0x3063('0x1a')](handleEntityNotFound(_0xc9519a,null))[_0x3063('0x1a')](removeEntity(_0xc9519a,null))[_0x3063('0x24')](handleError(_0xc9519a,null));};exports['describe']=function(_0x55ebe4,_0x5c8876){return db[_0x3063('0x25')]['describe']()[_0x3063('0x1a')](function(_0x50c97b){delete _0x50c97b[_0x3063('0x28')];for(var _0x124d8d=0x0;_0x124d8d0x0){return new Promise(function(_0x3442f7){var _0x5b4cc4=[];for(var _0x47ecc4=0x0;_0x47ecc4<_0x57e4a7[_0x3063('0x30')];_0x47ecc4++){_0x5b4cc4[_0x3063('0x69')](insertAdditionalPhones(_0x57e4a7[_0x47ecc4][_0x3063('0x6a')],_0x57e4a7[_0x47ecc4]['additionalPhones']));}Promise[_0x3063('0x6b')](_0x5b4cc4)['then'](function(){_0x3442f7(0x1);});})['then'](function(){return{'success':_0x3dca66,'failure':_0x500a16,'duplicates':_0x26b89a};});}else{return{'success':_0x3dca66,'failure':_0x500a16,'duplicates':_0x26b89a};}}})['then'](respondWithResult(_0x1b44c0,0xc9))[_0x3063('0x24')](handleError(_0x1b44c0,null));};exports['show']=function(_0x125b6e,_0x5cf918){var _0x536a01;return db[_0x3063('0x25')][_0x3063('0x21')]()['then'](function(_0x366698){return db[_0x3063('0x25')][_0x3063('0x26')]({'where':{'id':_0x125b6e['params']['id']},'include':[{'model':db['Tag'],'as':_0x3063('0x6c'),'attributes':['id','name',_0x3063('0x6d')],'required':_0x125b6e[_0x3063('0x22')][_0x3063('0x6e')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x3063('0x6f'),'where':{'CmContactId':_0x125b6e[_0x3063('0x27')]['id']},'required':![],'include':[{'model':db[_0x3063('0x70')],'as':'ItemType'}]}],'order':[db[_0x3063('0x71')][_0x3063('0x72')]('Phones.OrderBy')],'attributes':_['keys'](_0x366698)});})[_0x3063('0x1a')](function(_0x549456){if(!_[_0x3063('0x5d')](_0x549456)){_0x536a01=_0x549456[_0x3063('0x3c')]({'plain':!![]});var _0x37777b={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x549456&&_0x549456[_0x3063('0x66')]){if(_0x549456['ListId']){_0x37777b[_0x3063('0x65')]['$and'][_0x3063('0x69')]({'ListId':{'$ne':_0x549456[_0x3063('0x66')]}});}}return db['CmCustomField']['findAll'](_0x37777b);}})[_0x3063('0x1a')](function(_0x441690){if(!_[_0x3063('0x5d')](_0x441690)){return _[_0x3063('0x73')](_0x536a01,_[_0x3063('0x74')](_0x441690,function(_0x3b3d26){return util['format']('cf_%d',_0x3b3d26['id']);}));}})['then'](handleEntityNotFound(_0x5cf918,null))['then'](respondWithResult(_0x5cf918,null))[_0x3063('0x24')](handleError(_0x5cf918,null));};exports[_0x3063('0x19')]=function(_0xbc4bf6,_0x1e865b){var _0x3b61eb;if(_0xbc4bf6[_0x3063('0x3a')]['id']){delete _0xbc4bf6[_0x3063('0x3a')]['id'];}if(!_[_0x3063('0x5d')](_0xbc4bf6[_0x3063('0x3a')]['dialTimezone'])){var _0x574af9=_0xbc4bf6[_0x3063('0x3a')]['dialTimezone'];if(!_[_0x3063('0x5d')](shared[_0x3063('0x5e')][_0x574af9]))_0xbc4bf6[_0x3063('0x3a')][_0x3063('0x5f')]=shared[_0x3063('0x5e')][_0x574af9]['utcOffset'];}return db[_0x3063('0x25')]['find']({'where':{'id':_0xbc4bf6[_0x3063('0x27')]['id']}})['then'](handleEntityNotFound(_0x1e865b,null))[_0x3063('0x1a')](saveUpdates(_0xbc4bf6[_0x3063('0x3a')],null))['then'](function(_0x4b7542){_0x3b61eb=_0x4b7542;var _0x268020={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4b7542&&_0x4b7542[_0x3063('0x66')]){if(_0x4b7542[_0x3063('0x66')]){_0x268020[_0x3063('0x65')][_0x3063('0x75')][_0x3063('0x69')]({'ListId':{'$ne':_0x4b7542[_0x3063('0x66')]}});}}return db['CmCustomField'][_0x3063('0x2f')](_0x268020);})[_0x3063('0x1a')](function(_0x1694b6){if(_0x1694b6){return _[_0x3063('0x73')](_[_0x3063('0x76')](_0xbc4bf6[_0x3063('0x3a')],function(_0x4462b7,_0x5edb24){return _['startsWith'](_0x5edb24,_0x3063('0x2b'));}),_[_0x3063('0x74')](_0x1694b6,function(_0x3a1828){return util[_0x3063('0x77')](_0x3063('0x78'),_0x3a1828['id']);}));}})[_0x3063('0x1a')](function(_0x14f2ca){if(_0x14f2ca&&!_['isEmpty'](_0x14f2ca)){var _0x11e700=squel['update']()[_0x3063('0x79')](_0x3063('0x7a'))[_0x3063('0x7b')](_0x14f2ca)[_0x3063('0x65')](_0x3063('0x7c'),_0xbc4bf6[_0x3063('0x27')]['id'])[_0x3063('0x7d')]();return db['sequelize']['query'](_0x11e700[_0x3063('0x7e')],{'replacements':_0x11e700['values']});}})[_0x3063('0x1a')](function(){if(_0xbc4bf6['body'][_0x3063('0x7f')]&&_0x3b61eb){return db[_0x3063('0x40')]['update']({'phone':_0xbc4bf6[_0x3063('0x3a')][_0x3063('0x7f')],'OrderBy':0x0},{'where':{'ContactId':_0x3b61eb['id']}});}})[_0x3063('0x1a')](function(){return _0x3b61eb;})['then'](respondWithResult(_0x1e865b,null))[_0x3063('0x24')](handleError(_0x1e865b,null));};exports[_0x3063('0x80')]=function(_0x19f802,_0x2ae671){var _0xf2cc08={};var _0x1721d2={};var _0x37aad0;var _0x4faaa8;return db[_0x3063('0x25')][_0x3063('0x81')]({'where':{'id':_0x19f802['params']['id']}})['then'](handleEntityNotFound(_0x2ae671,null))['then'](function(_0x340ee7){if(_0x340ee7){_0x37aad0=_0x340ee7;_0x1721d2['model']=_['keys'](db[_0x3063('0x82')]['rawAttributes']);_0x1721d2[_0x3063('0x22')]=_[_0x3063('0x29')](_0x19f802[_0x3063('0x22')]);_0x1721d2[_0x3063('0x83')]=_[_0x3063('0x84')](_0x1721d2['model'],_0x1721d2[_0x3063('0x22')]);_0xf2cc08[_0x3063('0x85')]=_['intersection'](_0x1721d2[_0x3063('0x86')],qs[_0x3063('0x87')](_0x19f802[_0x3063('0x22')]['fields']));_0xf2cc08[_0x3063('0x85')]=_0xf2cc08[_0x3063('0x85')][_0x3063('0x30')]?_0xf2cc08[_0x3063('0x85')]:_0x1721d2[_0x3063('0x86')];_0xf2cc08[_0x3063('0x88')]=qs[_0x3063('0x89')](_0x19f802[_0x3063('0x22')]['sort']);_0xf2cc08[_0x3063('0x65')]=qs[_0x3063('0x83')](_[_0x3063('0x8a')](_0x19f802[_0x3063('0x22')],_0x1721d2[_0x3063('0x83')]));if(_0x19f802['query']['filter']){_0xf2cc08[_0x3063('0x65')]=_[_0x3063('0x39')](_0xf2cc08[_0x3063('0x65')],{'$or':_[_0x3063('0x74')](_0xf2cc08[_0x3063('0x85')],function(_0x2c5355){var _0x56c027={};_0x56c027[_0x2c5355]={'$like':'%'+_0x19f802[_0x3063('0x22')]['filter']+'%'};return _0x56c027;})});}_0xf2cc08=_[_0x3063('0x39')]({},_0xf2cc08,_0x19f802[_0x3063('0x8b')]);return _0x37aad0[_0x3063('0x80')](_0xf2cc08);}})[_0x3063('0x1a')](function(_0x45d330){if(_0x45d330){_0x4faaa8=_0x45d330[_0x3063('0x30')];if(!_0x19f802['query']['hasOwnProperty'](_0x3063('0x8c'))){_0xf2cc08[_0x3063('0x14')]=qs[_0x3063('0x14')](_0x19f802[_0x3063('0x22')][_0x3063('0x14')]);_0xf2cc08[_0x3063('0x17')]=qs[_0x3063('0x17')](_0x19f802[_0x3063('0x22')][_0x3063('0x17')]);}return _0x37aad0[_0x3063('0x80')](_0xf2cc08);}})[_0x3063('0x1a')](function(_0x4d66b1){if(_0x4d66b1){return _0x4d66b1?{'count':_0x4faaa8,'rows':_0x4d66b1}:null;}})[_0x3063('0x1a')](respondWithResult(_0x2ae671,null))['catch'](handleError(_0x2ae671,null));};exports['setTags']=function(_0x4a4fc5,_0x1eb7d4){if(_0x4a4fc5[_0x3063('0x3a')]['id']){delete _0x4a4fc5[_0x3063('0x3a')]['id'];}return db['CmContact'][_0x3063('0x81')]({'where':{'id':_0x4a4fc5[_0x3063('0x27')]['id']}})[_0x3063('0x1a')](handleEntityNotFound(_0x1eb7d4,null))['then'](function(_0x113da7){if(_0x113da7){return _0x113da7['setTags'](_0x4a4fc5[_0x3063('0x3a')]['ids']||[]);}return null;})[_0x3063('0x1a')](respondWithResult(_0x1eb7d4,null))[_0x3063('0x24')](handleError(_0x1eb7d4,null));};exports[_0x3063('0x8d')]=function(_0x73c0f1,_0x511fcb){var _0x38c4f4=[];_0x38c4f4['push'](addAdditionalPhones(_0x73c0f1[_0x3063('0x3a')]));Promise[_0x3063('0x6b')](_0x38c4f4)['then'](function(){_0x38c4f4=[];_0x38c4f4[_0x3063('0x69')](deleteCmHopperPhones(_0x73c0f1['body']['id']));_0x38c4f4['push'](addCmHopperPhones(_0x73c0f1[_0x3063('0x3a')]['id']));Promise['all'](_0x38c4f4)[_0x3063('0x1a')](function(){return[0x1];})[_0x3063('0x1a')](respondWithResult(_0x511fcb,null));});};function addAdditionalPhones(_0x3355e1){var _0x52922e;return new Promise(function(_0x4d786b){return db[_0x3063('0x8e')][_0x3063('0x1b')]({'where':{'CmContactId':_0x3355e1['id']}})[_0x3063('0x1a')](function(){db[_0x3063('0x70')][_0x3063('0x2f')]({'raw':!![],'attributes':['id','OrderBy']})[_0x3063('0x1a')](function(_0x40a7c4){var _0x1e1705=[];for(var _0x200a81=0x0;_0x200a81<_0x3355e1[_0x3063('0x8f')][_0x3063('0x30')];_0x200a81++){var _0x806742=_0x3355e1['item_types']?_[_0x3063('0x5d')](_0x3355e1[_0x3063('0x90')][_0x200a81])?'':_0x3355e1[_0x3063('0x90')][_0x200a81]:_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x91')]?_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x91')]:'';var _0x2254f1=_['isNil'](_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x92')])?'':_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x92')];var _0x546ce0=_0x806742+':'+_0x3355e1['items'][_0x200a81]['phone']+'§'+_0x2254f1;if(_[_0x3063('0x5d')](_0x52922e))_0x52922e=_0x546ce0;else _0x52922e+=';'+_0x546ce0;var _0x14f1ec=null;var _0x58579d=null;if(_0x3355e1[_0x3063('0x90')]){if(!_[_0x3063('0x5d')](_0x3355e1[_0x3063('0x90')][_0x200a81])){_0x58579d=_['find'](_0x40a7c4,function(_0x5146e8){return _0x5146e8['id']===_0x3355e1['item_types'][_0x200a81];});if(!_[_0x3063('0x5d')](_0x58579d)){_0x14f1ec=_0x58579d[_0x3063('0x93')];}}}else{if(!_[_0x3063('0x5d')](_0x3355e1[_0x3063('0x8f')][_0x200a81])){_0x58579d=_[_0x3063('0x26')](_0x40a7c4,function(_0x5b4753){return _0x5b4753['id']===_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x91')];});if(!_[_0x3063('0x5d')](_0x58579d)){_0x14f1ec=_0x200a81;}}}if(_[_0x3063('0x5d')](_0x14f1ec)){_0x14f1ec=0x64;}_0x1e1705['push'](addAdditionalPhone(_0x3355e1['id'],_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x7f')],_0x3355e1[_0x3063('0x90')]?_[_0x3063('0x5d')](_0x3355e1['item_types'][_0x200a81])?null:_0x3355e1[_0x3063('0x90')][_0x200a81]:_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x91')]?_0x3355e1[_0x3063('0x8f')][_0x200a81][_0x3063('0x91')]:null,_0x14f1ec,_0x2254f1));}Promise[_0x3063('0x6b')](_0x1e1705)[_0x3063('0x1a')](function(){db[_0x3063('0x25')][_0x3063('0x19')]({'AdditionalPhones':_0x52922e},{'where':{'id':_0x3355e1['id']}})['then'](function(){_0x4d786b(0x1);});});});});});}function addAdditionalPhone(_0x4e78ea,_0x3ff197,_0x535141,_0x558970,_0x48a19b){return db['CmContactHasItem'][_0x3063('0x26')]({'where':{'CmContactId':_0x4e78ea,'item':_0x3ff197}})[_0x3063('0x1a')](function(_0x261b70){if(_0x261b70)logger[_0x3063('0x35')](_0x3063('0x94'),_0x261b70);else{db[_0x3063('0x8e')][_0x3063('0x44')]({'CmContactId':_0x4e78ea,'item':_0x3ff197,'ItemTypeId':_0x535141,'OrderBy':_0x558970,'ItemClass':'PHONE','description':_0x48a19b});}});}function deleteCmHopperPhones(_0x51800e){return new Promise(function(_0x2b421a){return db[_0x3063('0x40')][_0x3063('0x2f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x51800e}})[_0x3063('0x1a')](function(_0x508580){db[_0x3063('0x95')][_0x3063('0x1b')]({'where':{'CmHopperId':{'$in':_['map'](_0x508580,'id')}}});})[_0x3063('0x1a')](function(){_0x2b421a(0x1);});});}function addCmHopperPhones(_0x3942a1){return new Promise(function(_0x4cc506){return db[_0x3063('0x40')][_0x3063('0x2f')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x3942a1}})[_0x3063('0x1a')](function(_0x3d4387){var _0x5d536d=[];_[_0x3063('0x74')](_0x3d4387,function(_0x2727bb){_0x5d536d[_0x3063('0x69')](createCmHopperPhone(_0x3942a1,_0x2727bb['id']));});Promise[_0x3063('0x6b')](_0x5d536d)[_0x3063('0x1a')](function(){_0x4cc506(0x1);});});});}function createCmHopperPhone(_0x55a838,_0x1078e2){return new Promise(function(_0x43e583){db['CmContactHasItem']['findAll']({'raw':!![],'attributes':['item',_0x3063('0x93')],'where':{'CmContactId':_0x55a838,'ItemClass':_0x3063('0x96')},'include':[{'model':db[_0x3063('0x70')],'attributes':[_0x3063('0x93')],'as':_0x3063('0x97')}],'order':[_0x3063('0x93'),db[_0x3063('0x71')]['literal'](_0x3063('0x98'))]})['then'](function(_0x161e72){var _0xd45cd0=0x1;var _0x26214b=_[_0x3063('0x74')](_0x161e72,function(_0x2fd49c){_0x2fd49c[_0x3063('0x99')]=_0x1078e2;_0x2fd49c[_0x3063('0x7f')]=_0x2fd49c['item'];_0x2fd49c[_0x3063('0x93')]=_0xd45cd0;delete _0x2fd49c['ItemType.OrderBy'];_0xd45cd0=_0xd45cd0+0x1;return _0x2fd49c;});return db[_0x3063('0x95')][_0x3063('0x61')](_0x26214b,{});})[_0x3063('0x1a')](function(){_0x43e583(0x1);});});}function insertAdditionalPhones(_0x5b1d06,_0x1adee0){return new Promise(function(_0x39dc27){var _0x391013=[];for(var _0x1a7976=0x0;_0x1a7976<_0x1adee0['length'];_0x1a7976++){var _0x5023ed=_0x1adee0[_0x1a7976];_0x391013[_0x3063('0x69')](parseContactItemType(_0x5023ed));}Promise['all'](_0x391013)['then'](function(){var _0x267619={'id':_0x5b1d06['id'],'items':_0x1adee0};return addAdditionalPhones(_0x267619)[_0x3063('0x1a')](function(){return addCmHopperPhones(_0x5b1d06['id']);});})[_0x3063('0x1a')](function(){_0x39dc27(_0x5b1d06);});});}function parseContactItemType(_0x2ed579){return new Promise(function(_0x13d684){if(_0x2ed579[_0x3063('0x38')](_0x3063('0x91'))){_0x13d684(_0x2ed579);}else{return db[_0x3063('0x70')]['find']({'where':{'name':_0x2ed579[_0x3063('0x97')]}})[_0x3063('0x1a')](function(_0x41e488){if(_[_0x3063('0x5d')](_0x41e488))_0x2ed579[_0x3063('0x91')]=null;else _0x2ed579['ItemTypeId']=_0x41e488['id'];_0x13d684(_0x2ed579);});}});}exports[_0x3063('0x9a')]=function(_0x58a61d,_0x25e967){return db[_0x3063('0x8e')][_0x3063('0x2f')]({'raw':!![],'where':{'CmContactId':_0x58a61d[_0x3063('0x27')]['id'],'ItemClass':_0x3063('0x96')},'include':[{'model':db[_0x3063('0x70')],'as':_0x3063('0x97')}],'order':[[_0x3063('0x93')],[db[_0x3063('0x71')][_0x3063('0x72')](_0x3063('0x98'))]]})[_0x3063('0x1a')](function(_0x4df573){return _0x4df573;})[_0x3063('0x1a')](respondWithResult(_0x25e967,null))[_0x3063('0x24')](handleError(_0x25e967,null));};exports[_0x3063('0x9b')]=function(_0x16654f,_0x1f8288){return db['CmContactHasItem']['findAll']({'raw':!![],'where':{'CmContactId':_0x16654f[_0x3063('0x3a')][_0x3063('0x9c')]}})[_0x3063('0x1a')](function(_0x4d3c58){var _0x27a2cf=_['map'](_0x4d3c58,function(_0x33804c){_0x33804c['CmContactId']=_0x16654f[_0x3063('0x3a')][_0x3063('0x9d')];return _0x33804c;});return db[_0x3063('0x8e')][_0x3063('0x61')](_0x27a2cf,{});})[_0x3063('0x1a')](function(){return addCmHopperPhones(_0x16654f[_0x3063('0x3a')]['toContactId']);})[_0x3063('0x1a')](function(){return['ok'];})['then'](respondWithResult(_0x1f8288,null))['catch'](handleError(_0x1f8288,null));};exports['rescheduleAdditionalPhones']=function(_0x34dd4a,_0x59f3a7){var _0x3832c6=[];_0x3832c6[_0x3063('0x69')](createCmHopperPhone(_0x34dd4a[_0x3063('0x3a')]['id'],_0x34dd4a[_0x3063('0x3a')]['hopperId']));Promise['all'](_0x3832c6)[_0x3063('0x1a')](function(){return[0x1];})['then'](respondWithResult(_0x59f3a7,null));};exports['getHoppers']=function(_0x473973,_0x410127){var _0x15a6d8={'raw':![],'where':{}};var _0xc9e1dd={};var _0x6a2638={'count':0x0,'rows':[]};return db[_0x3063('0x25')][_0x3063('0x81')]({'where':{'id':_0x473973[_0x3063('0x27')]['id']}})[_0x3063('0x1a')](handleEntityNotFound(_0x410127,null))[_0x3063('0x1a')](function(_0x5918b9){if(_0x5918b9){_0xc9e1dd[_0x3063('0x86')]=_[_0x3063('0x29')](db[_0x3063('0x40')][_0x3063('0x9e')]);_0xc9e1dd[_0x3063('0x22')]=_['keys'](_0x473973[_0x3063('0x22')]);_0xc9e1dd[_0x3063('0x83')]=_[_0x3063('0x84')](_0xc9e1dd[_0x3063('0x86')],_0xc9e1dd[_0x3063('0x22')]);_0x15a6d8['attributes']=_[_0x3063('0x84')](_0xc9e1dd[_0x3063('0x86')],qs[_0x3063('0x87')](_0x473973['query'][_0x3063('0x87')]));_0x15a6d8['attributes']=_0x15a6d8[_0x3063('0x85')][_0x3063('0x30')]?_0x15a6d8[_0x3063('0x85')]:_0xc9e1dd['model'];if(!_0x473973['query'][_0x3063('0x38')](_0x3063('0x8c'))){_0x15a6d8[_0x3063('0x14')]=qs[_0x3063('0x14')](_0x473973[_0x3063('0x22')]['limit']);_0x15a6d8[_0x3063('0x17')]=qs[_0x3063('0x17')](_0x473973[_0x3063('0x22')]['offset']);}_0x15a6d8[_0x3063('0x88')]=qs[_0x3063('0x89')](_0x473973[_0x3063('0x22')]['sort']);_0x15a6d8['where']=qs[_0x3063('0x83')](_['pick'](_0x473973['query'],_0xc9e1dd['filters']));_0x15a6d8['where'][_0x3063('0x9f')]=_0x5918b9['id'];if(_0x473973[_0x3063('0x22')][_0x3063('0xa0')]){_0x15a6d8[_0x3063('0x65')]=_[_0x3063('0x39')](_0x15a6d8[_0x3063('0x65')],{'$or':_[_0x3063('0x74')](_0x15a6d8[_0x3063('0x85')],function(_0x2a4523){var _0x866876={};_0x866876[_0x2a4523]={'$like':'%'+_0x473973[_0x3063('0x22')][_0x3063('0xa0')]+'%'};return _0x866876;})});}_0x15a6d8=_[_0x3063('0x39')]({},_0x15a6d8,_0x473973[_0x3063('0x8b')]);return db[_0x3063('0x40')]['count']({'where':_0x15a6d8[_0x3063('0x65')]})[_0x3063('0x1a')](function(_0x255f03){_0x6a2638[_0x3063('0x16')]=_0x255f03;if(_0x473973['query'][_0x3063('0xa1')]){_0x15a6d8['include']=[{'all':!![]}];}return db['CmHopper'][_0x3063('0x2f')](_0x15a6d8);})[_0x3063('0x1a')](function(_0x43eb34){_0x6a2638[_0x3063('0xa2')]=_0x43eb34;return _0x6a2638;});}})[_0x3063('0x1a')](respondWithFilteredResult(_0x410127,_0x15a6d8))['catch'](handleError(_0x410127,null));};exports['getHopperHistories']=function(_0x3937a6,_0x446dbc){var _0x2abfe5={'raw':!![],'where':{}};var _0x5072d8={};var _0x55a10b={'count':0x0,'rows':[]};return db[_0x3063('0x25')][_0x3063('0x81')]({'where':{'id':_0x3937a6[_0x3063('0x27')]['id']}})['then'](handleEntityNotFound(_0x446dbc,null))[_0x3063('0x1a')](function(_0x20ae31){if(_0x20ae31){_0x5072d8[_0x3063('0x86')]=_[_0x3063('0x29')](db[_0x3063('0x51')][_0x3063('0x9e')]);_0x5072d8[_0x3063('0x22')]=_['keys'](_0x3937a6[_0x3063('0x22')]);_0x5072d8[_0x3063('0x83')]=_['intersection'](_0x5072d8['model'],_0x5072d8['query']);_0x2abfe5[_0x3063('0x85')]=_['intersection'](_0x5072d8[_0x3063('0x86')],qs[_0x3063('0x87')](_0x3937a6[_0x3063('0x22')][_0x3063('0x87')]));_0x2abfe5[_0x3063('0x85')]=_0x2abfe5[_0x3063('0x85')]['length']?_0x2abfe5[_0x3063('0x85')]:_0x5072d8[_0x3063('0x86')];if(!_0x3937a6[_0x3063('0x22')][_0x3063('0x38')]('nolimit')){_0x2abfe5[_0x3063('0x14')]=qs['limit'](_0x3937a6[_0x3063('0x22')]['limit']);_0x2abfe5[_0x3063('0x17')]=qs['offset'](_0x3937a6[_0x3063('0x22')][_0x3063('0x17')]);}_0x2abfe5[_0x3063('0x88')]=qs['sort'](_0x3937a6['query'][_0x3063('0x89')]);_0x2abfe5[_0x3063('0x65')]=qs['filters'](_[_0x3063('0x8a')](_0x3937a6[_0x3063('0x22')],_0x5072d8[_0x3063('0x83')]));_0x2abfe5[_0x3063('0x65')][_0x3063('0x9f')]=_0x20ae31['id'];if(_0x3937a6[_0x3063('0x22')][_0x3063('0xa0')]){_0x2abfe5['where']=_['merge'](_0x2abfe5[_0x3063('0x65')],{'$or':_[_0x3063('0x74')](_0x2abfe5['attributes'],function(_0x414d35){var _0x540544={};_0x540544[_0x414d35]={'$like':'%'+_0x3937a6['query'][_0x3063('0xa0')]+'%'};return _0x540544;})});}_0x2abfe5=_[_0x3063('0x39')]({},_0x2abfe5,_0x3937a6[_0x3063('0x8b')]);return db['CmHopperHistory'][_0x3063('0x16')]({'where':_0x2abfe5[_0x3063('0x65')]})[_0x3063('0x1a')](function(_0x4d54c0){_0x55a10b[_0x3063('0x16')]=_0x4d54c0;if(_0x3937a6[_0x3063('0x22')]['includeAll']){_0x2abfe5[_0x3063('0xa3')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x3063('0x2f')](_0x2abfe5);})[_0x3063('0x1a')](function(_0x1aefb5){_0x55a10b[_0x3063('0xa2')]=_0x1aefb5;return _0x55a10b;});}})[_0x3063('0x1a')](respondWithFilteredResult(_0x446dbc,_0x2abfe5))['catch'](handleError(_0x446dbc,null));};exports[_0x3063('0xa4')]=function(_0x58eaea,_0x48167c){var _0x4588af={'raw':!![],'where':{}};var _0x1a62cd={};var _0x4ec6b6={'count':0x0,'rows':[]};return db[_0x3063('0x25')][_0x3063('0x81')]({'where':{'id':_0x58eaea[_0x3063('0x27')]['id']}})['then'](handleEntityNotFound(_0x48167c,null))[_0x3063('0x1a')](function(_0x121e96){if(_0x121e96){_0x1a62cd[_0x3063('0x86')]=_[_0x3063('0x29')](db[_0x3063('0x50')][_0x3063('0x9e')]);_0x1a62cd[_0x3063('0x22')]=_[_0x3063('0x29')](_0x58eaea[_0x3063('0x22')]);_0x1a62cd[_0x3063('0x83')]=_[_0x3063('0x84')](_0x1a62cd[_0x3063('0x86')],_0x1a62cd[_0x3063('0x22')]);_0x4588af[_0x3063('0x85')]=_[_0x3063('0x84')](_0x1a62cd['model'],qs[_0x3063('0x87')](_0x58eaea[_0x3063('0x22')][_0x3063('0x87')]));_0x4588af[_0x3063('0x85')]=_0x4588af[_0x3063('0x85')][_0x3063('0x30')]?_0x4588af[_0x3063('0x85')]:_0x1a62cd['model'];if(!_0x58eaea[_0x3063('0x22')][_0x3063('0x38')](_0x3063('0x8c'))){_0x4588af[_0x3063('0x14')]=qs['limit'](_0x58eaea[_0x3063('0x22')]['limit']);_0x4588af[_0x3063('0x17')]=qs[_0x3063('0x17')](_0x58eaea[_0x3063('0x22')][_0x3063('0x17')]);}_0x4588af[_0x3063('0x88')]=qs['sort'](_0x58eaea[_0x3063('0x22')][_0x3063('0x89')]);_0x4588af[_0x3063('0x65')]=qs[_0x3063('0x83')](_['pick'](_0x58eaea[_0x3063('0x22')],_0x1a62cd[_0x3063('0x83')]));_0x4588af[_0x3063('0x65')][_0x3063('0x9f')]=_0x121e96['id'];if(_0x58eaea[_0x3063('0x22')]['filter']){_0x4588af[_0x3063('0x65')]=_[_0x3063('0x39')](_0x4588af[_0x3063('0x65')],{'$or':_['map'](_0x4588af[_0x3063('0x85')],function(_0x3ee430){var _0x55b675={};_0x55b675[_0x3ee430]={'$like':'%'+_0x58eaea[_0x3063('0x22')][_0x3063('0xa0')]+'%'};return _0x55b675;})});}_0x4588af=_['merge']({},_0x4588af,_0x58eaea[_0x3063('0x8b')]);return db[_0x3063('0x50')][_0x3063('0x16')]({'where':_0x4588af[_0x3063('0x65')]})['then'](function(_0x51b956){_0x4ec6b6[_0x3063('0x16')]=_0x51b956;if(_0x58eaea[_0x3063('0x22')][_0x3063('0xa1')]){_0x4588af[_0x3063('0xa3')]=[{'all':!![]}];}return db[_0x3063('0x50')][_0x3063('0x2f')](_0x4588af);})[_0x3063('0x1a')](function(_0x46b032){_0x4ec6b6[_0x3063('0xa2')]=_0x46b032;return _0x4ec6b6;});}})[_0x3063('0x1a')](respondWithFilteredResult(_0x48167c,_0x4588af))['catch'](handleError(_0x48167c,null));};exports[_0x3063('0xa5')]=function(_0x5ceaae,_0x48ded8){var _0x307b5d={'raw':!![],'where':{}};var _0x301363={};var _0x412315={'count':0x0,'rows':[]};return db['CmContact'][_0x3063('0x81')]({'where':{'id':_0x5ceaae['params']['id']}})[_0x3063('0x1a')](handleEntityNotFound(_0x48ded8,null))[_0x3063('0x1a')](function(_0xbd35b6){if(_0xbd35b6){_0x301363[_0x3063('0x86')]=_['keys'](db[_0x3063('0x58')][_0x3063('0x9e')]);_0x301363['query']=_[_0x3063('0x29')](_0x5ceaae[_0x3063('0x22')]);_0x301363[_0x3063('0x83')]=_[_0x3063('0x84')](_0x301363[_0x3063('0x86')],_0x301363[_0x3063('0x22')]);_0x307b5d[_0x3063('0x85')]=_[_0x3063('0x84')](_0x301363[_0x3063('0x86')],qs[_0x3063('0x87')](_0x5ceaae['query'][_0x3063('0x87')]));_0x307b5d['attributes']=_0x307b5d[_0x3063('0x85')][_0x3063('0x30')]?_0x307b5d[_0x3063('0x85')]:_0x301363[_0x3063('0x86')];if(!_0x5ceaae[_0x3063('0x22')][_0x3063('0x38')]('nolimit')){_0x307b5d[_0x3063('0x14')]=qs[_0x3063('0x14')](_0x5ceaae[_0x3063('0x22')][_0x3063('0x14')]);_0x307b5d[_0x3063('0x17')]=qs[_0x3063('0x17')](_0x5ceaae['query'][_0x3063('0x17')]);}_0x307b5d[_0x3063('0x88')]=qs[_0x3063('0x89')](_0x5ceaae[_0x3063('0x22')]['sort']);_0x307b5d[_0x3063('0x65')]=qs[_0x3063('0x83')](_[_0x3063('0x8a')](_0x5ceaae[_0x3063('0x22')],_0x301363[_0x3063('0x83')]));_0x307b5d['where']['ContactId']=_0xbd35b6['id'];if(_0x5ceaae[_0x3063('0x22')][_0x3063('0xa0')]){_0x307b5d[_0x3063('0x65')]=_[_0x3063('0x39')](_0x307b5d[_0x3063('0x65')],{'$or':_[_0x3063('0x74')](_0x307b5d[_0x3063('0x85')],function(_0x15deb1){var _0x5ea032={};_0x5ea032[_0x15deb1]={'$like':'%'+_0x5ceaae[_0x3063('0x22')]['filter']+'%'};return _0x5ea032;})});}_0x307b5d=_[_0x3063('0x39')]({},_0x307b5d,_0x5ceaae['options']);return db[_0x3063('0x58')]['count']({'where':_0x307b5d[_0x3063('0x65')]})[_0x3063('0x1a')](function(_0x3a343d){_0x412315[_0x3063('0x16')]=_0x3a343d;if(_0x5ceaae[_0x3063('0x22')][_0x3063('0xa1')]){_0x307b5d[_0x3063('0xa3')]=[{'all':!![]}];}return db[_0x3063('0x58')][_0x3063('0x2f')](_0x307b5d);})[_0x3063('0x1a')](function(_0x50dfce){_0x412315[_0x3063('0xa2')]=_0x50dfce;return _0x412315;});}})[_0x3063('0x1a')](respondWithFilteredResult(_0x48ded8,_0x307b5d))[_0x3063('0x24')](handleError(_0x48ded8,null));};exports[_0x3063('0xa6')]=function(_0x250a75,_0x361279){try{if(!_0x250a75[_0x3063('0x3a')][_0x3063('0x66')]){throw new Error(_0x3063('0xa7'));}if(!_0x250a75['body'][_0x3063('0xa8')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x250a75[_0x3063('0x3a')][_0x3063('0xa9')]){throw new Error('No\x20association\x20values\x20specified!');}if(!_0x250a75['body']['socket_timestamp']){throw new Error(_0x3063('0xaa'));}var _0x1e617a=_0x250a75[_0x3063('0x3a')][_0x3063('0xa8')][_0x3063('0xab')](',');var _0x166bb3=_0x250a75[_0x3063('0x3a')][_0x3063('0xa9')][_0x3063('0xab')](',');if(!_0x1e617a[_0x3063('0x30')]||!_0x166bb3[_0x3063('0x30')]||_0x1e617a['length']!==_0x166bb3[_0x3063('0x30')]){throw new Error(_0x3063('0xac'));}_0x250a75['body'][_0x3063('0x87')]=_[_0x3063('0xad')](_0x1e617a,_0x166bb3);if(!_0x250a75[_0x3063('0x3a')][_0x3063('0x87')][_0x3063('0x7f')]){throw new Error(_0x3063('0xae'));}if(!_0x250a75['body'][_0x3063('0x87')][_0x3063('0xaf')]){throw new Error(_0x3063('0xb0'));}var _0x59932f=path[_0x3063('0x3f')](config['root'],'server/files/tmp',_0x250a75[_0x3063('0xb1')][_0x3063('0xb2')]);fs[_0x3063('0xb3')](_0x59932f,parseInt('0777',0x8));var _0x583d7f=require(_0x3063('0xb4'))['fork'](path[_0x3063('0x3f')](__dirname,'../../components/import/cm/csv'),[_0x59932f,_0x250a75['body'][_0x3063('0xa8')],_0x250a75[_0x3063('0x3a')]['binding_values'],_0x250a75[_0x3063('0x3a')][_0x3063('0x66')],_0x250a75[_0x3063('0x3a')][_0x3063('0xb5')],_0x250a75['body']['duplicates'],_0x250a75[_0x3063('0x3a')][_0x3063('0xb6')]]);return _0x361279[_0x3063('0x12')](0xc8)[_0x3063('0x13')]({'message':_0x3063('0xb7'),'pid':_0x583d7f['pid']});}catch(_0x244d46){return _0x361279[_0x3063('0x12')](0x1f4)[_0x3063('0xb8')](_0x244d46);}};exports[_0x3063('0xb9')]=function(_0x5b3893,_0x14156b){var _0x5b1d3a=fs[_0x3063('0xba')](_0x5b3893['file'][_0x3063('0x3')]);Papa['parse'](_0x5b1d3a,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x38fe01){return _0x14156b['status'](0xc8)['json']({'file':_0x5b3893[_0x3063('0xb1')],'fields':_0x38fe01[_0x3063('0xbb')][_0x3063('0x87')]});}});};exports[_0x3063('0xbc')]=function(_0x26fccc,_0x493608){return db[_0x3063('0xbd')][_0x3063('0x2f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x3063('0xbe')}})[_0x3063('0x1a')](function(_0x2505d8){var _0x47ae08=![];if(!_0x26fccc[_0x3063('0x3a')][_0x3063('0x66')]){throw new Error(_0x3063('0xa7'));}if(!_0x26fccc[_0x3063('0x3a')][_0x3063('0xbf')][_0x3063('0x7f')]){throw new Error(_0x3063('0xae'));}if(!_0x26fccc[_0x3063('0x3a')][_0x3063('0xbf')]['firstName']){throw new Error(_0x3063('0xb0'));}if(!_0x26fccc[_0x3063('0x3a')][_0x3063('0xb6')]){throw new Error(_0x3063('0xaa'));}var _0xd5429e=require(_0x3063('0xb4'))['fork'](path['join'](__dirname,_0x3063('0xc0')),[_0x26fccc[_0x3063('0x27')]['id'],JSON[_0x3063('0xc1')](_0x26fccc['body']),JSON[_0x3063('0xc1')](_0x2505d8)]);_0xd5429e['on'](_0x3063('0xc2'),function(){_0x47ae08=!![];return _0x493608[_0x3063('0x12')](0xc8)[_0x3063('0x13')]({'message':_0x3063('0xc3'),'pid':_0xd5429e[_0x3063('0xc4')]});});_0xd5429e['on']('exit',function(_0x34ca4d){if(_0x34ca4d&&!_0x47ae08){return _0x493608['status'](0x1f4)['json']({'message':'error\x20child\x20process','pid':_0xd5429e['pid']});}});})[_0x3063('0x24')](handleError(_0x493608,null));};exports[_0x3063('0xc5')]=function(_0x55c2ef,_0x161197){return db[_0x3063('0xbd')][_0x3063('0x2f')]({'raw':!![],'attributes':['id'],'where':{'role':_0x3063('0xbe')}})[_0x3063('0x1a')](function(_0x384388){var _0x255730=![];if(!_0x55c2ef[_0x3063('0x3a')][_0x3063('0x66')]){throw new Error('No\x20ListId\x20specified');}if(!_0x55c2ef['body']['binding']['phone']){throw new Error('No\x20phone\x20column\x20specified');}if(!_0x55c2ef[_0x3063('0x3a')][_0x3063('0xbf')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x55c2ef['body'][_0x3063('0xb6')]){throw new Error(_0x3063('0xaa'));}var _0x2fc393=require(_0x3063('0xb4'))[_0x3063('0xc6')](path[_0x3063('0x3f')](__dirname,_0x3063('0xc7')),[_0x55c2ef[_0x3063('0x27')]['id'],JSON[_0x3063('0xc1')](_0x55c2ef[_0x3063('0x3a')]),JSON['stringify'](_0x384388)]);_0x2fc393['on'](_0x3063('0xc2'),function(){_0x255730=!![];return _0x161197['status'](0xc8)[_0x3063('0x13')]({'message':_0x3063('0xc3'),'pid':_0x2fc393['pid']});});_0x2fc393['on'](_0x3063('0xc8'),function(_0x212117){if(_0x212117&&!_0x255730){return _0x161197[_0x3063('0x12')](0x1f4)[_0x3063('0x13')]({'message':_0x3063('0xc9'),'pid':_0x2fc393['pid']});}});})[_0x3063('0x24')](handleError(_0x161197,null));};exports[_0x3063('0xca')]=function(_0xf986bf,_0x43a149){var _0x515d36=[_0x3063('0xcb'),_0x3063('0xcc'),'sms',_0x3063('0xcd'),'fax',_0x3063('0xce'),_0x3063('0xcf')];var _0x1afe5b={'offset':0x0,'order':qs[_0x3063('0x89')](_0x3063('0xd0'))},_0x137ef0={'count':0x0,'rows':[]};Promise[_0x3063('0xd1')]()['then'](function(){if(_0xf986bf[_0x3063('0x22')]['channel']){if(!_[_0x3063('0xd2')](_0x515d36,_0xf986bf[_0x3063('0x22')][_0x3063('0xd3')][_0x3063('0xd4')]())){throw new Error(_0x3063('0xd5'));}_0x515d36=[_0xf986bf[_0x3063('0x22')][_0x3063('0xd3')]['toLowerCase']()];}if(_0xf986bf[_0x3063('0x22')][_0x3063('0xd6')]){try{var _0x584a10=JSON[_0x3063('0xd7')](_0xf986bf[_0x3063('0x22')][_0x3063('0xd6')]);if(!moment(_0x584a10[_0x3063('0x3b')])['isValid']()){throw new Error(_0x3063('0xd8'));}if(!moment(_0x584a10['to'])[_0x3063('0xd9')]()){throw new Error(_0x3063('0xda'));}}catch(_0x103898){throw new Error('Invalid\x20createdAt\x20filter');}}if(!_0xf986bf[_0x3063('0x22')][_0x3063('0x38')](_0x3063('0x8c'))){_0x1afe5b[_0x3063('0x14')]=qs[_0x3063('0x14')](_0xf986bf[_0x3063('0x22')]['limit']||0xa);_0x1afe5b['offset']=qs[_0x3063('0x17')](_0xf986bf['query']['offset']);}var _0x3a63e7=_0x515d36[_0x3063('0x74')](function(_0xa161f2){if(_0xa161f2===_0x3063('0xcf')){var _0x58254d={'attributes':['id','uniqueid',_0x3063('0x33'),'source',_0x3063('0xdb'),_0x3063('0xdc'),_0x3063('0xdd'),_0x3063('0xde'),_0x3063('0xdf'),_0x3063('0xe0'),_0x3063('0xe1'),_0x3063('0xe2'),_0x3063('0xe3'),_0x3063('0xe4'),_0x3063('0xe5')],'where':{'ContactId':_0xf986bf['params']['id']},'include':[{'model':db[_0x3063('0xbd')],'as':_0x3063('0xbd'),'attributes':['id',_0x3063('0x1f'),_0x3063('0xe6'),_0x3063('0x32')]}],'order':[[_0x3063('0xe1'),_0x3063('0xe7')]]};if(_0xf986bf['query'][_0x3063('0xd6')]){_0x58254d[_0x3063('0x65')][_0x3063('0xe1')]={'$gte':_0x584a10[_0x3063('0x3b')],'$lte':_0x584a10['to']};}return db[_0x3063('0x53')]['findAndCountAll'](_0x58254d)[_0x3063('0x1a')](function(_0x226a92){_0x137ef0['count']+=_0x226a92[_0x3063('0x16')];return _[_0x3063('0x74')](_0x226a92[_0x3063('0xa2')],function(_0x5520b9){var _0x4c2b75=_0x5520b9['get']({'plain':!![]});_0x4c2b75[_0x3063('0xd3')]=_0xa161f2;if(_0x4c2b75[_0x3063('0xbd')]){_0x4c2b75[_0x3063('0xbd')]={'id':_0x4c2b75['User']['id'],'name':_0x4c2b75[_0x3063('0xbd')][_0x3063('0x1f')],'fullname':_0x4c2b75[_0x3063('0xbd')][_0x3063('0xe6')],'alias':_0x4c2b75[_0x3063('0xbd')]['alias']};}return _0x4c2b75;});});}else{var _0x44929d=_['startCase'](_0xa161f2)+(_0xa161f2===_0x3063('0xcc')?_0x3063('0xe8'):_0x3063('0xe9'));var _0x44a8bb={'attributes':['id',_0x3063('0xea'),_0x3063('0xeb'),_0x3063('0xe1'),_0x3063('0xe0'),'disposition','secondDisposition',_0x3063('0xec'),_0x3063('0xe5'),_0x44929d+'Id'],'where':{'ContactId':_0xf986bf[_0x3063('0x27')]['id']},'include':[{'model':db[_0x44929d],'as':_0x3063('0xe9'),'attributes':['id',_0x3063('0x1f'),_0x3063('0xed')]},{'model':db[_0x3063('0xbd')],'as':_0x3063('0xee'),'attributes':['id',_0x3063('0x1f'),'fullname']},{'model':db[_0x3063('0x82')],'as':_0x3063('0x6c'),'attributes':['id','name','color'],'through':{'attributes':[]}}],'order':[[_0x3063('0xe1'),_0x3063('0xe7')]]};if(_0xf986bf['query'][_0x3063('0xd6')]){_0x44a8bb[_0x3063('0x65')][_0x3063('0xe1')]={'$gte':_0x584a10[_0x3063('0x3b')],'$lte':_0x584a10['to']};}switch(_0xa161f2){case'chat':_0x44a8bb[_0x3063('0x85')][_0x3063('0x69')]('browserName',_0x3063('0xef'),_0x3063('0xf0'),'deviceModel',_0x3063('0xf1'),_0x3063('0xf2'),_0x3063('0xf3'),_0x3063('0xf4'),_0x3063('0xf5'));break;case _0x3063('0xcb'):_0x44a8bb[_0x3063('0x85')][_0x3063('0x69')](_0x3063('0xf6'),'substatus');break;case _0x3063('0xcd'):_0x44a8bb[_0x3063('0x85')]['push'](_0x3063('0xf7'),_0x3063('0xf8'));break;}return db[_[_0x3063('0xf9')](_0xa161f2)+'Interaction'][_0x3063('0xfa')](_0x44a8bb)[_0x3063('0x1a')](function(_0x97e833){_0x137ef0['count']+=_0x97e833[_0x3063('0x16')];return _[_0x3063('0x74')](_0x97e833[_0x3063('0xa2')],function(_0x540020){var _0x3b8cef=_0x540020[_0x3063('0x3c')]({'plain':!![]});_0x3b8cef[_0x3063('0xd3')]=_0xa161f2;if(_0x3b8cef[_0x3063('0xee')]){_0x3b8cef[_0x3063('0xee')]={'id':_0x3b8cef[_0x3063('0xee')]['id'],'name':_0x3b8cef[_0x3063('0xee')][_0x3063('0x1f')],'fullname':_0x3b8cef[_0x3063('0xee')][_0x3063('0xe6')]};}return _0x3b8cef;});});}});return Promise[_0x3063('0x6b')](_0x3a63e7);})[_0x3063('0x1a')](function(_0x3b5f2d){return _(_0x3b5f2d)[_0x3063('0xfb')]()[_0x3063('0xfc')]('createdAt')[_0x3063('0xfd')]()[_0x3063('0xfe')]();})[_0x3063('0x1a')](function(_0x43f096){_0x137ef0[_0x3063('0xa2')]=_0x1afe5b[_0x3063('0x14')]?_0x43f096[_0x3063('0xff')](_0x1afe5b[_0x3063('0x17')],_0x1afe5b['offset']+_0x1afe5b['limit']):_0x43f096;return _0x137ef0;})['then'](respondWithFilteredResult(_0x43a149,_0x1afe5b))[_0x3063('0x24')](handleError(_0x43a149,null));}; \ No newline at end of file +var _0xc009=['json','offset','undefined','count','limit','status','set','Content-Range','update','then','destroy','end','sendStatus','stack','name','send','describe','query','user','find','CmContact','keys','length','startsWith','cf_','columnName','displayName','analytics','CmCustomField','findAll','custom','type','forEach','hasOwnProperty','catch','merge','body','get','mergeWith','isArray','tags','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','from','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','ChatMessage','ChatOfflineMessage','MailMessage','MailInteraction','SmsInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','isNil','dialTimezone','timezones','utcOffset','additionalPhones','bulkCreate','each','duplicates','$or','push','where','ListId','findOrCreate','spread','all','show','Tag','tag','Phones','params','ContactItemType','sequelize','literal','Phones.OrderBy','$and','omit','map','format','cf_%d','isEmpty','table','setFields','id\x20=\x20?','toParam','values','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','sort','pick','filter','nolimit','findOne','setTags','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','PHONE','CmHopperAdditionalPhone','item','ItemType','CmHopperId','ItemType.OrderBy','getAdditionalPhones','`ItemType`.OrderBy','duplicateAdditionalPhones','fromContactId','CmContactId','toContactId','rescheduleAdditionalPhones','getHoppers','order','ContactId','options','includeAll','include','rows','getHopperHistories','CmHopperHistory','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','filename','0777','fork','CompanyId','pid','meta','import','User','binding','child_process','../../components/import/cm/csv2','stringify','start\x20child\x20process\x20correctly!','exit','importUpdates','agent','../../components/import/cm/csvUpdates','message','getJourney','mail','chat','openchannel','fax','whatsapp','voice','-createdAt','includes','channel','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20from\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','endtime','duration','note','userDisposition','userThirdDisposition','UserId','createdAt','DESC','findAndCountAll','fullname','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','Tags','color','browserName','deviceModel','osName','ratingMessage','ratingType','ratingValue','subject','externalUrl','threadId','Interaction','flatten','sortBy','reverse','value','slice','moment','bluebird','path','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./cmContact.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc009,0xec));var _0x9c00=function(_0x57ef89,_0x2867d8){_0x57ef89=_0x57ef89-0x0;var _0x335ccf=_0xc009[_0x57ef89];return _0x335ccf;};'use strict';var moment=require(_0x9c00('0x0'));var BPromise=require(_0x9c00('0x1'));var util=require('util');var path=require(_0x9c00('0x2'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9c00('0x3'));var Papa=require('papaparse');var Redis=require('ioredis');var contacts=require('../../components/contacts');var qs=require(_0x9c00('0x4'));var logger=require(_0x9c00('0x5'))(_0x9c00('0x6'));var config=require(_0x9c00('0x7'));var shared=require('../../config/environment/shared');var db=require(_0x9c00('0x8'))['db'];config[_0x9c00('0x9')]=_[_0x9c00('0xa')](config[_0x9c00('0x9')],{'host':_0x9c00('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c00('0x9')]));require(_0x9c00('0xc'))[_0x9c00('0xd')](socket);function respondWithResult(_0x33a9ae,_0xce7ffe){_0xce7ffe=_0xce7ffe||0xc8;return function(_0x4bf432){if(_0x4bf432){return _0x33a9ae['status'](_0xce7ffe)[_0x9c00('0xe')](_0x4bf432);}};}function respondWithFilteredResult(_0x56b0cc,_0x4a44b5){return function(_0x702a6f){if(_0x702a6f){var _0x20c188=typeof _0x4a44b5[_0x9c00('0xf')]===_0x9c00('0x10')&&typeof _0x4a44b5['limit']===_0x9c00('0x10');var _0x4f2640=_0x702a6f[_0x9c00('0x11')];var _0x554119=_0x20c188?0x0:_0x4a44b5['offset'];var _0x3bcee4=_0x20c188?_0x702a6f['count']:_0x4a44b5[_0x9c00('0xf')]+_0x4a44b5[_0x9c00('0x12')];var _0x225bc0;if(_0x3bcee4>=_0x4f2640){_0x3bcee4=_0x4f2640;_0x225bc0=0xc8;}else{_0x225bc0=0xce;}_0x56b0cc[_0x9c00('0x13')](_0x225bc0);return _0x56b0cc[_0x9c00('0x14')](_0x9c00('0x15'),_0x554119+'-'+_0x3bcee4+'/'+_0x4f2640)[_0x9c00('0xe')](_0x702a6f);}return null;};}function saveUpdates(_0x5c26e7){return function(_0x53c02f){if(_0x53c02f){return _0x53c02f[_0x9c00('0x16')](_0x5c26e7)[_0x9c00('0x17')](function(_0x19422b){return _0x19422b;});}return null;};}function removeEntity(_0x5b9e40){return function(_0x47ba3e){if(_0x47ba3e){return _0x47ba3e[_0x9c00('0x18')]()[_0x9c00('0x17')](function(){_0x5b9e40[_0x9c00('0x13')](0xcc)[_0x9c00('0x19')]();});}};}function handleEntityNotFound(_0x1e74d9){return function(_0x43d4b5){if(!_0x43d4b5){_0x1e74d9[_0x9c00('0x1a')](0x194);}return _0x43d4b5;};}function handleError(_0x523ae7,_0x2cd6b8){_0x2cd6b8=_0x2cd6b8||0x1f4;return function(_0x3c2741){logger['error'](_0x3c2741[_0x9c00('0x1b')]);if(_0x3c2741[_0x9c00('0x1c')]){delete _0x3c2741[_0x9c00('0x1c')];}_0x523ae7[_0x9c00('0x13')](_0x2cd6b8)[_0x9c00('0x1d')](_0x3c2741);};}exports['index']=function(_0x323532,_0x49cfe5){var _0x16c0b8={};return contacts[_0x9c00('0x1e')]()['then'](function(_0x6fee04){_0x16c0b8=qs['getOptions'](_0x6fee04,_0x323532);return contacts['findAll'](_0x323532[_0x9c00('0x1f')],_0x323532[_0x9c00('0x20')],_0x16c0b8,_0x6fee04);})[_0x9c00('0x17')](respondWithFilteredResult(_0x49cfe5,_0x16c0b8))['catch'](handleError(_0x49cfe5,null));};exports[_0x9c00('0x18')]=function(_0x5c730d,_0xcbfcfd){return db['CmContact'][_0x9c00('0x21')]({'where':{'id':_0x5c730d['params']['id']}})['then'](handleEntityNotFound(_0xcbfcfd,null))[_0x9c00('0x17')](removeEntity(_0xcbfcfd,null))['catch'](handleError(_0xcbfcfd,null));};exports[_0x9c00('0x1e')]=function(_0x1e03c7,_0x5a04e0){return db[_0x9c00('0x22')][_0x9c00('0x1e')]()[_0x9c00('0x17')](function(_0x4fcb0b){delete _0x4fcb0b['tags'];for(var _0x5098d4=0x0;_0x5098d40x0){return new Promise(function(_0x5969ed){var _0x30216f=[];for(var _0x19997b=0x0;_0x19997b<_0x5eae8c[_0x9c00('0x24')];_0x19997b++){_0x30216f[_0x9c00('0x5c')](insertAdditionalPhones(_0x5eae8c[_0x19997b]['contact'],_0x5eae8c[_0x19997b][_0x9c00('0x57')]));}Promise[_0x9c00('0x61')](_0x30216f)[_0x9c00('0x17')](function(){_0x5969ed(0x1);});})['then'](function(){return{'success':_0x4c8f02,'failure':_0x20f44c,'duplicates':_0x1de2c3};});}else{return{'success':_0x4c8f02,'failure':_0x20f44c,'duplicates':_0x1de2c3};}}})['then'](respondWithResult(_0x476ad6,0xc9))[_0x9c00('0x30')](handleError(_0x476ad6,null));};exports[_0x9c00('0x62')]=function(_0x1fa4be,_0x1ce242){var _0x5c65a2;return db[_0x9c00('0x22')][_0x9c00('0x1e')]()[_0x9c00('0x17')](function(_0x4969be){return db[_0x9c00('0x22')][_0x9c00('0x21')]({'where':{'id':_0x1fa4be['params']['id']},'include':[{'model':db[_0x9c00('0x63')],'as':'Tags','attributes':['id','name','color'],'required':_0x1fa4be[_0x9c00('0x1f')][_0x9c00('0x64')]?!![]:![]},{'model':db[_0x9c00('0x49')],'as':_0x9c00('0x65'),'where':{'CmContactId':_0x1fa4be[_0x9c00('0x66')]['id']},'required':![],'include':[{'model':db[_0x9c00('0x67')],'as':'ItemType'}]}],'order':[db[_0x9c00('0x68')][_0x9c00('0x69')](_0x9c00('0x6a'))],'attributes':_[_0x9c00('0x23')](_0x4969be)});})[_0x9c00('0x17')](function(_0x35f0fb){if(!_['isNil'](_0x35f0fb)){_0x5c65a2=_0x35f0fb[_0x9c00('0x33')]({'plain':!![]});var _0x15f916={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x35f0fb&&_0x35f0fb[_0x9c00('0x5e')]){if(_0x35f0fb[_0x9c00('0x5e')]){_0x15f916[_0x9c00('0x5d')][_0x9c00('0x6b')][_0x9c00('0x5c')]({'ListId':{'$ne':_0x35f0fb[_0x9c00('0x5e')]}});}}return db['CmCustomField'][_0x9c00('0x2b')](_0x15f916);}})['then'](function(_0x490f92){if(!_[_0x9c00('0x53')](_0x490f92)){return _[_0x9c00('0x6c')](_0x5c65a2,_[_0x9c00('0x6d')](_0x490f92,function(_0x4dc9f4){return util[_0x9c00('0x6e')](_0x9c00('0x6f'),_0x4dc9f4['id']);}));}})['then'](handleEntityNotFound(_0x1ce242,null))[_0x9c00('0x17')](respondWithResult(_0x1ce242,null))[_0x9c00('0x30')](handleError(_0x1ce242,null));};exports[_0x9c00('0x16')]=function(_0x1c53b7,_0x4f511c){var _0x26fc91;if(_0x1c53b7[_0x9c00('0x32')]['id']){delete _0x1c53b7[_0x9c00('0x32')]['id'];}if(!_[_0x9c00('0x53')](_0x1c53b7[_0x9c00('0x32')][_0x9c00('0x54')])){var _0x50e16f=_0x1c53b7[_0x9c00('0x32')][_0x9c00('0x54')];if(!_[_0x9c00('0x53')](shared[_0x9c00('0x55')][_0x50e16f]))_0x1c53b7[_0x9c00('0x32')][_0x9c00('0x56')]=shared[_0x9c00('0x55')][_0x50e16f][_0x9c00('0x56')];}return db[_0x9c00('0x22')][_0x9c00('0x21')]({'where':{'id':_0x1c53b7[_0x9c00('0x66')]['id']}})[_0x9c00('0x17')](handleEntityNotFound(_0x4f511c,null))[_0x9c00('0x17')](saveUpdates(_0x1c53b7['body'],null))[_0x9c00('0x17')](function(_0x54e57f){_0x26fc91=_0x54e57f;var _0x3b15b4={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x54e57f&&_0x54e57f[_0x9c00('0x5e')]){if(_0x54e57f[_0x9c00('0x5e')]){_0x3b15b4[_0x9c00('0x5d')][_0x9c00('0x6b')][_0x9c00('0x5c')]({'ListId':{'$ne':_0x54e57f[_0x9c00('0x5e')]}});}}return db['CmCustomField']['findAll'](_0x3b15b4);})['then'](function(_0x59f9ab){if(_0x59f9ab){return _['omit'](_['pickBy'](_0x1c53b7[_0x9c00('0x32')],function(_0x3bda4d,_0x59c4a1){return _[_0x9c00('0x25')](_0x59c4a1,_0x9c00('0x26'));}),_[_0x9c00('0x6d')](_0x59f9ab,function(_0x512829){return util[_0x9c00('0x6e')](_0x9c00('0x6f'),_0x512829['id']);}));}})[_0x9c00('0x17')](function(_0x4b6111){if(_0x4b6111&&!_[_0x9c00('0x70')](_0x4b6111)){var _0x590006=squel[_0x9c00('0x16')]()[_0x9c00('0x71')]('cm_contacts')[_0x9c00('0x72')](_0x4b6111)[_0x9c00('0x5d')](_0x9c00('0x73'),_0x1c53b7[_0x9c00('0x66')]['id'])[_0x9c00('0x74')]();return db[_0x9c00('0x68')]['query'](_0x590006['text'],{'replacements':_0x590006[_0x9c00('0x75')]});}})['then'](function(){if(_0x1c53b7[_0x9c00('0x32')][_0x9c00('0x76')]&&_0x26fc91){return db[_0x9c00('0x3a')][_0x9c00('0x16')]({'phone':_0x1c53b7[_0x9c00('0x32')]['phone'],'OrderBy':0x0},{'where':{'ContactId':_0x26fc91['id']}});}})[_0x9c00('0x17')](function(){return _0x26fc91;})[_0x9c00('0x17')](respondWithResult(_0x4f511c,null))[_0x9c00('0x30')](handleError(_0x4f511c,null));};exports[_0x9c00('0x77')]=function(_0x14c476,_0x34612b){var _0x2424b6={};var _0xf113e0={};var _0x1131ea;var _0x15d376;return db[_0x9c00('0x22')]['findOne']({'where':{'id':_0x14c476[_0x9c00('0x66')]['id']}})['then'](handleEntityNotFound(_0x34612b,null))[_0x9c00('0x17')](function(_0xe7274e){if(_0xe7274e){_0x1131ea=_0xe7274e;_0xf113e0[_0x9c00('0x78')]=_[_0x9c00('0x23')](db[_0x9c00('0x63')][_0x9c00('0x79')]);_0xf113e0['query']=_[_0x9c00('0x23')](_0x14c476[_0x9c00('0x1f')]);_0xf113e0[_0x9c00('0x7a')]=_[_0x9c00('0x7b')](_0xf113e0[_0x9c00('0x78')],_0xf113e0[_0x9c00('0x1f')]);_0x2424b6[_0x9c00('0x7c')]=_['intersection'](_0xf113e0['model'],qs[_0x9c00('0x7d')](_0x14c476[_0x9c00('0x1f')]['fields']));_0x2424b6[_0x9c00('0x7c')]=_0x2424b6[_0x9c00('0x7c')][_0x9c00('0x24')]?_0x2424b6[_0x9c00('0x7c')]:_0xf113e0[_0x9c00('0x78')];_0x2424b6['order']=qs[_0x9c00('0x7e')](_0x14c476[_0x9c00('0x1f')][_0x9c00('0x7e')]);_0x2424b6[_0x9c00('0x5d')]=qs[_0x9c00('0x7a')](_[_0x9c00('0x7f')](_0x14c476[_0x9c00('0x1f')],_0xf113e0[_0x9c00('0x7a')]));if(_0x14c476[_0x9c00('0x1f')][_0x9c00('0x80')]){_0x2424b6['where']=_[_0x9c00('0x31')](_0x2424b6[_0x9c00('0x5d')],{'$or':_['map'](_0x2424b6[_0x9c00('0x7c')],function(_0x2587a8){var _0x22ccaa={};_0x22ccaa[_0x2587a8]={'$like':'%'+_0x14c476['query']['filter']+'%'};return _0x22ccaa;})});}_0x2424b6=_[_0x9c00('0x31')]({},_0x2424b6,_0x14c476['options']);return _0x1131ea[_0x9c00('0x77')](_0x2424b6);}})['then'](function(_0x53df05){if(_0x53df05){_0x15d376=_0x53df05['length'];if(!_0x14c476[_0x9c00('0x1f')][_0x9c00('0x2f')](_0x9c00('0x81'))){_0x2424b6[_0x9c00('0x12')]=qs['limit'](_0x14c476[_0x9c00('0x1f')]['limit']);_0x2424b6[_0x9c00('0xf')]=qs[_0x9c00('0xf')](_0x14c476[_0x9c00('0x1f')][_0x9c00('0xf')]);}return _0x1131ea[_0x9c00('0x77')](_0x2424b6);}})[_0x9c00('0x17')](function(_0x46f2a1){if(_0x46f2a1){return _0x46f2a1?{'count':_0x15d376,'rows':_0x46f2a1}:null;}})[_0x9c00('0x17')](respondWithResult(_0x34612b,null))[_0x9c00('0x30')](handleError(_0x34612b,null));};exports['setTags']=function(_0x36b3ce,_0x326326){if(_0x36b3ce[_0x9c00('0x32')]['id']){delete _0x36b3ce[_0x9c00('0x32')]['id'];}return db[_0x9c00('0x22')][_0x9c00('0x82')]({'where':{'id':_0x36b3ce[_0x9c00('0x66')]['id']}})[_0x9c00('0x17')](handleEntityNotFound(_0x326326,null))[_0x9c00('0x17')](function(_0x1db584){if(_0x1db584){return _0x1db584[_0x9c00('0x83')](_0x36b3ce[_0x9c00('0x32')][_0x9c00('0x84')]||[]);}return null;})[_0x9c00('0x17')](respondWithResult(_0x326326,null))[_0x9c00('0x30')](handleError(_0x326326,null));};exports[_0x9c00('0x85')]=function(_0xbdf0f4,_0x3f9194){var _0x43e9d5=[];_0x43e9d5[_0x9c00('0x5c')](addAdditionalPhones(_0xbdf0f4[_0x9c00('0x32')]));Promise[_0x9c00('0x61')](_0x43e9d5)[_0x9c00('0x17')](function(){_0x43e9d5=[];_0x43e9d5[_0x9c00('0x5c')](deleteCmHopperPhones(_0xbdf0f4[_0x9c00('0x32')]['id']));_0x43e9d5[_0x9c00('0x5c')](addCmHopperPhones(_0xbdf0f4['body']['id']));Promise[_0x9c00('0x61')](_0x43e9d5)[_0x9c00('0x17')](function(){return[0x1];})[_0x9c00('0x17')](respondWithResult(_0x3f9194,null));});};function addAdditionalPhones(_0x268bd3){var _0x306458;return new Promise(function(_0x10575c){return db['CmContactHasItem'][_0x9c00('0x18')]({'where':{'CmContactId':_0x268bd3['id']}})[_0x9c00('0x17')](function(){db[_0x9c00('0x67')]['findAll']({'raw':!![],'attributes':['id',_0x9c00('0x86')]})['then'](function(_0x44cb1e){var _0x330915=[];for(var _0x535d27=0x0;_0x535d27<_0x268bd3[_0x9c00('0x87')]['length'];_0x535d27++){var _0x194723=_0x268bd3['item_types']?_[_0x9c00('0x53')](_0x268bd3['item_types'][_0x535d27])?'':_0x268bd3[_0x9c00('0x88')][_0x535d27]:_0x268bd3[_0x9c00('0x87')][_0x535d27][_0x9c00('0x89')]?_0x268bd3['items'][_0x535d27]['ItemTypeId']:'';var _0x53ce06=_[_0x9c00('0x53')](_0x268bd3[_0x9c00('0x87')][_0x535d27][_0x9c00('0x8a')])?'':_0x268bd3[_0x9c00('0x87')][_0x535d27]['description'];var _0x162c9c=_0x194723+':'+_0x268bd3[_0x9c00('0x87')][_0x535d27][_0x9c00('0x76')]+'§'+_0x53ce06;if(_['isNil'](_0x306458))_0x306458=_0x162c9c;else _0x306458+=';'+_0x162c9c;var _0x596821=null;var _0x207857=null;if(_0x268bd3['item_types']){if(!_[_0x9c00('0x53')](_0x268bd3[_0x9c00('0x88')][_0x535d27])){_0x207857=_[_0x9c00('0x21')](_0x44cb1e,function(_0x1506c6){return _0x1506c6['id']===_0x268bd3['item_types'][_0x535d27];});if(!_[_0x9c00('0x53')](_0x207857)){_0x596821=_0x207857[_0x9c00('0x86')];}}}else{if(!_[_0x9c00('0x53')](_0x268bd3[_0x9c00('0x87')][_0x535d27])){_0x207857=_['find'](_0x44cb1e,function(_0x4f5745){return _0x4f5745['id']===_0x268bd3[_0x9c00('0x87')][_0x535d27][_0x9c00('0x89')];});if(!_[_0x9c00('0x53')](_0x207857)){_0x596821=_0x535d27;}}}if(_[_0x9c00('0x53')](_0x596821)){_0x596821=0x64;}_0x330915[_0x9c00('0x5c')](addAdditionalPhone(_0x268bd3['id'],_0x268bd3['items'][_0x535d27][_0x9c00('0x76')],_0x268bd3[_0x9c00('0x88')]?_[_0x9c00('0x53')](_0x268bd3[_0x9c00('0x88')][_0x535d27])?null:_0x268bd3[_0x9c00('0x88')][_0x535d27]:_0x268bd3[_0x9c00('0x87')][_0x535d27][_0x9c00('0x89')]?_0x268bd3[_0x9c00('0x87')][_0x535d27][_0x9c00('0x89')]:null,_0x596821,_0x53ce06));}Promise[_0x9c00('0x61')](_0x330915)[_0x9c00('0x17')](function(){db[_0x9c00('0x22')][_0x9c00('0x16')]({'AdditionalPhones':_0x306458},{'where':{'id':_0x268bd3['id']}})[_0x9c00('0x17')](function(){_0x10575c(0x1);});});});});});}function addAdditionalPhone(_0x5b3110,_0x537290,_0x3cc460,_0x14766f,_0x3b544d){return db[_0x9c00('0x49')][_0x9c00('0x21')]({'where':{'CmContactId':_0x5b3110,'item':_0x537290}})['then'](function(_0x2b6558){if(_0x2b6558)logger['info']('contact\x20phone\x20exists',_0x2b6558);else{db['CmContactHasItem'][_0x9c00('0x3f')]({'CmContactId':_0x5b3110,'item':_0x537290,'ItemTypeId':_0x3cc460,'OrderBy':_0x14766f,'ItemClass':_0x9c00('0x8b'),'description':_0x3b544d});}});}function deleteCmHopperPhones(_0xb24fe7){return new Promise(function(_0x2985d8){return db[_0x9c00('0x3a')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0xb24fe7}})[_0x9c00('0x17')](function(_0x5179d1){db[_0x9c00('0x8c')][_0x9c00('0x18')]({'where':{'CmHopperId':{'$in':_[_0x9c00('0x6d')](_0x5179d1,'id')}}});})[_0x9c00('0x17')](function(){_0x2985d8(0x1);});});}function addCmHopperPhones(_0x32f432){return new Promise(function(_0x35863b){return db[_0x9c00('0x3a')][_0x9c00('0x2b')]({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x32f432}})[_0x9c00('0x17')](function(_0x212c53){var _0x4e13ff=[];_['map'](_0x212c53,function(_0xb0e81e){_0x4e13ff[_0x9c00('0x5c')](createCmHopperPhone(_0x32f432,_0xb0e81e['id']));});Promise[_0x9c00('0x61')](_0x4e13ff)['then'](function(){_0x35863b(0x1);});});});}function createCmHopperPhone(_0x341e72,_0x8a823c){return new Promise(function(_0x5e65ea){db[_0x9c00('0x49')]['findAll']({'raw':!![],'attributes':[_0x9c00('0x8d'),_0x9c00('0x86')],'where':{'CmContactId':_0x341e72,'ItemClass':_0x9c00('0x8b')},'include':[{'model':db[_0x9c00('0x67')],'attributes':[_0x9c00('0x86')],'as':_0x9c00('0x8e')}],'order':[_0x9c00('0x86'),db[_0x9c00('0x68')][_0x9c00('0x69')]('`ItemType`.OrderBy')]})[_0x9c00('0x17')](function(_0xd32175){var _0x191f8d=0x1;var _0x2a9dd4=_[_0x9c00('0x6d')](_0xd32175,function(_0x2f5a88){_0x2f5a88[_0x9c00('0x8f')]=_0x8a823c;_0x2f5a88[_0x9c00('0x76')]=_0x2f5a88[_0x9c00('0x8d')];_0x2f5a88[_0x9c00('0x86')]=_0x191f8d;delete _0x2f5a88[_0x9c00('0x90')];_0x191f8d=_0x191f8d+0x1;return _0x2f5a88;});return db[_0x9c00('0x8c')][_0x9c00('0x58')](_0x2a9dd4,{});})[_0x9c00('0x17')](function(){_0x5e65ea(0x1);});});}function insertAdditionalPhones(_0xa562ff,_0x18876b){return new Promise(function(_0x50902a){var _0x5d70dc=[];for(var _0x675ea3=0x0;_0x675ea3<_0x18876b['length'];_0x675ea3++){var _0x4fe8fa=_0x18876b[_0x675ea3];_0x5d70dc['push'](parseContactItemType(_0x4fe8fa));}Promise['all'](_0x5d70dc)[_0x9c00('0x17')](function(){var _0x63a1a9={'id':_0xa562ff['id'],'items':_0x18876b};return addAdditionalPhones(_0x63a1a9)[_0x9c00('0x17')](function(){return addCmHopperPhones(_0xa562ff['id']);});})[_0x9c00('0x17')](function(){_0x50902a(_0xa562ff);});});}function parseContactItemType(_0x5972f0){return new Promise(function(_0x570db1){if(_0x5972f0[_0x9c00('0x2f')](_0x9c00('0x89'))){_0x570db1(_0x5972f0);}else{return db[_0x9c00('0x67')][_0x9c00('0x21')]({'where':{'name':_0x5972f0[_0x9c00('0x8e')]}})[_0x9c00('0x17')](function(_0x410d80){if(_[_0x9c00('0x53')](_0x410d80))_0x5972f0[_0x9c00('0x89')]=null;else _0x5972f0[_0x9c00('0x89')]=_0x410d80['id'];_0x570db1(_0x5972f0);});}});}exports[_0x9c00('0x91')]=function(_0xa80c8d,_0x47b060){return db[_0x9c00('0x49')][_0x9c00('0x2b')]({'raw':!![],'where':{'CmContactId':_0xa80c8d[_0x9c00('0x66')]['id'],'ItemClass':_0x9c00('0x8b')},'include':[{'model':db[_0x9c00('0x67')],'as':_0x9c00('0x8e')}],'order':[['OrderBy'],[db[_0x9c00('0x68')][_0x9c00('0x69')](_0x9c00('0x92'))]]})[_0x9c00('0x17')](function(_0x40a719){return _0x40a719;})[_0x9c00('0x17')](respondWithResult(_0x47b060,null))['catch'](handleError(_0x47b060,null));};exports[_0x9c00('0x93')]=function(_0x16ca70,_0x325881){return db['CmContactHasItem'][_0x9c00('0x2b')]({'raw':!![],'where':{'CmContactId':_0x16ca70[_0x9c00('0x32')][_0x9c00('0x94')]}})[_0x9c00('0x17')](function(_0x3805ed){var _0x3dfb10=_[_0x9c00('0x6d')](_0x3805ed,function(_0x3959fc){_0x3959fc[_0x9c00('0x95')]=_0x16ca70[_0x9c00('0x32')][_0x9c00('0x96')];return _0x3959fc;});return db[_0x9c00('0x49')][_0x9c00('0x58')](_0x3dfb10,{});})[_0x9c00('0x17')](function(){return addCmHopperPhones(_0x16ca70[_0x9c00('0x32')]['toContactId']);})[_0x9c00('0x17')](function(){return['ok'];})[_0x9c00('0x17')](respondWithResult(_0x325881,null))[_0x9c00('0x30')](handleError(_0x325881,null));};exports[_0x9c00('0x97')]=function(_0x4d44ef,_0x19a0ae){var _0x514456=[];_0x514456[_0x9c00('0x5c')](createCmHopperPhone(_0x4d44ef[_0x9c00('0x32')]['id'],_0x4d44ef[_0x9c00('0x32')]['hopperId']));Promise[_0x9c00('0x61')](_0x514456)['then'](function(){return[0x1];})[_0x9c00('0x17')](respondWithResult(_0x19a0ae,null));};exports[_0x9c00('0x98')]=function(_0x31f4e7,_0x3a208d){var _0x361752={'raw':![],'where':{}};var _0x229ffb={};var _0x2bf178={'count':0x0,'rows':[]};return db[_0x9c00('0x22')][_0x9c00('0x82')]({'where':{'id':_0x31f4e7[_0x9c00('0x66')]['id']}})[_0x9c00('0x17')](handleEntityNotFound(_0x3a208d,null))[_0x9c00('0x17')](function(_0x5049d4){if(_0x5049d4){_0x229ffb[_0x9c00('0x78')]=_[_0x9c00('0x23')](db['CmHopper'][_0x9c00('0x79')]);_0x229ffb[_0x9c00('0x1f')]=_[_0x9c00('0x23')](_0x31f4e7[_0x9c00('0x1f')]);_0x229ffb[_0x9c00('0x7a')]=_[_0x9c00('0x7b')](_0x229ffb[_0x9c00('0x78')],_0x229ffb[_0x9c00('0x1f')]);_0x361752[_0x9c00('0x7c')]=_[_0x9c00('0x7b')](_0x229ffb[_0x9c00('0x78')],qs[_0x9c00('0x7d')](_0x31f4e7['query'][_0x9c00('0x7d')]));_0x361752[_0x9c00('0x7c')]=_0x361752['attributes']['length']?_0x361752[_0x9c00('0x7c')]:_0x229ffb[_0x9c00('0x78')];if(!_0x31f4e7[_0x9c00('0x1f')][_0x9c00('0x2f')]('nolimit')){_0x361752['limit']=qs[_0x9c00('0x12')](_0x31f4e7[_0x9c00('0x1f')][_0x9c00('0x12')]);_0x361752[_0x9c00('0xf')]=qs['offset'](_0x31f4e7['query']['offset']);}_0x361752[_0x9c00('0x99')]=qs[_0x9c00('0x7e')](_0x31f4e7[_0x9c00('0x1f')][_0x9c00('0x7e')]);_0x361752[_0x9c00('0x5d')]=qs[_0x9c00('0x7a')](_[_0x9c00('0x7f')](_0x31f4e7['query'],_0x229ffb[_0x9c00('0x7a')]));_0x361752['where'][_0x9c00('0x9a')]=_0x5049d4['id'];if(_0x31f4e7['query'][_0x9c00('0x80')]){_0x361752[_0x9c00('0x5d')]=_[_0x9c00('0x31')](_0x361752[_0x9c00('0x5d')],{'$or':_[_0x9c00('0x6d')](_0x361752[_0x9c00('0x7c')],function(_0x280ea6){var _0x50330d={};_0x50330d[_0x280ea6]={'$like':'%'+_0x31f4e7[_0x9c00('0x1f')][_0x9c00('0x80')]+'%'};return _0x50330d;})});}_0x361752=_[_0x9c00('0x31')]({},_0x361752,_0x31f4e7[_0x9c00('0x9b')]);return db[_0x9c00('0x3a')]['count']({'where':_0x361752[_0x9c00('0x5d')]})[_0x9c00('0x17')](function(_0x56715a){_0x2bf178[_0x9c00('0x11')]=_0x56715a;if(_0x31f4e7[_0x9c00('0x1f')][_0x9c00('0x9c')]){_0x361752[_0x9c00('0x9d')]=[{'all':!![]}];}return db[_0x9c00('0x3a')][_0x9c00('0x2b')](_0x361752);})['then'](function(_0x5397ac){_0x2bf178[_0x9c00('0x9e')]=_0x5397ac;return _0x2bf178;});}})['then'](respondWithFilteredResult(_0x3a208d,_0x361752))['catch'](handleError(_0x3a208d,null));};exports[_0x9c00('0x9f')]=function(_0x5c0b91,_0x1a01f4){var _0x52fa19={'raw':!![],'where':{}};var _0x1b90ec={};var _0x1bac5e={'count':0x0,'rows':[]};return db[_0x9c00('0x22')]['findOne']({'where':{'id':_0x5c0b91[_0x9c00('0x66')]['id']}})[_0x9c00('0x17')](handleEntityNotFound(_0x1a01f4,null))[_0x9c00('0x17')](function(_0x33dbf7){if(_0x33dbf7){_0x1b90ec[_0x9c00('0x78')]=_[_0x9c00('0x23')](db[_0x9c00('0xa0')]['rawAttributes']);_0x1b90ec[_0x9c00('0x1f')]=_['keys'](_0x5c0b91[_0x9c00('0x1f')]);_0x1b90ec['filters']=_[_0x9c00('0x7b')](_0x1b90ec[_0x9c00('0x78')],_0x1b90ec[_0x9c00('0x1f')]);_0x52fa19[_0x9c00('0x7c')]=_['intersection'](_0x1b90ec[_0x9c00('0x78')],qs[_0x9c00('0x7d')](_0x5c0b91[_0x9c00('0x1f')]['fields']));_0x52fa19[_0x9c00('0x7c')]=_0x52fa19[_0x9c00('0x7c')][_0x9c00('0x24')]?_0x52fa19['attributes']:_0x1b90ec[_0x9c00('0x78')];if(!_0x5c0b91[_0x9c00('0x1f')][_0x9c00('0x2f')](_0x9c00('0x81'))){_0x52fa19[_0x9c00('0x12')]=qs[_0x9c00('0x12')](_0x5c0b91[_0x9c00('0x1f')][_0x9c00('0x12')]);_0x52fa19['offset']=qs[_0x9c00('0xf')](_0x5c0b91[_0x9c00('0x1f')]['offset']);}_0x52fa19['order']=qs[_0x9c00('0x7e')](_0x5c0b91[_0x9c00('0x1f')]['sort']);_0x52fa19[_0x9c00('0x5d')]=qs[_0x9c00('0x7a')](_[_0x9c00('0x7f')](_0x5c0b91['query'],_0x1b90ec[_0x9c00('0x7a')]));_0x52fa19[_0x9c00('0x5d')][_0x9c00('0x9a')]=_0x33dbf7['id'];if(_0x5c0b91['query'][_0x9c00('0x80')]){_0x52fa19['where']=_[_0x9c00('0x31')](_0x52fa19['where'],{'$or':_[_0x9c00('0x6d')](_0x52fa19[_0x9c00('0x7c')],function(_0x457399){var _0x31d962={};_0x31d962[_0x457399]={'$like':'%'+_0x5c0b91[_0x9c00('0x1f')][_0x9c00('0x80')]+'%'};return _0x31d962;})});}_0x52fa19=_[_0x9c00('0x31')]({},_0x52fa19,_0x5c0b91['options']);return db[_0x9c00('0xa0')]['count']({'where':_0x52fa19[_0x9c00('0x5d')]})[_0x9c00('0x17')](function(_0x4553cd){_0x1bac5e[_0x9c00('0x11')]=_0x4553cd;if(_0x5c0b91[_0x9c00('0x1f')]['includeAll']){_0x52fa19['include']=[{'all':!![]}];}return db[_0x9c00('0xa0')]['findAll'](_0x52fa19);})[_0x9c00('0x17')](function(_0x58b946){_0x1bac5e[_0x9c00('0x9e')]=_0x58b946;return _0x1bac5e;});}})[_0x9c00('0x17')](respondWithFilteredResult(_0x1a01f4,_0x52fa19))[_0x9c00('0x30')](handleError(_0x1a01f4,null));};exports['getHopperFinals']=function(_0x2d799a,_0x2ed748){var _0x16a230={'raw':!![],'where':{}};var _0x28a37e={};var _0x131e4e={'count':0x0,'rows':[]};return db[_0x9c00('0x22')][_0x9c00('0x82')]({'where':{'id':_0x2d799a['params']['id']}})['then'](handleEntityNotFound(_0x2ed748,null))['then'](function(_0x29a18e){if(_0x29a18e){_0x28a37e[_0x9c00('0x78')]=_['keys'](db[_0x9c00('0x4a')][_0x9c00('0x79')]);_0x28a37e[_0x9c00('0x1f')]=_[_0x9c00('0x23')](_0x2d799a['query']);_0x28a37e[_0x9c00('0x7a')]=_[_0x9c00('0x7b')](_0x28a37e[_0x9c00('0x78')],_0x28a37e[_0x9c00('0x1f')]);_0x16a230['attributes']=_[_0x9c00('0x7b')](_0x28a37e[_0x9c00('0x78')],qs[_0x9c00('0x7d')](_0x2d799a[_0x9c00('0x1f')][_0x9c00('0x7d')]));_0x16a230[_0x9c00('0x7c')]=_0x16a230[_0x9c00('0x7c')][_0x9c00('0x24')]?_0x16a230[_0x9c00('0x7c')]:_0x28a37e[_0x9c00('0x78')];if(!_0x2d799a['query'][_0x9c00('0x2f')](_0x9c00('0x81'))){_0x16a230[_0x9c00('0x12')]=qs[_0x9c00('0x12')](_0x2d799a[_0x9c00('0x1f')]['limit']);_0x16a230[_0x9c00('0xf')]=qs[_0x9c00('0xf')](_0x2d799a[_0x9c00('0x1f')]['offset']);}_0x16a230[_0x9c00('0x99')]=qs[_0x9c00('0x7e')](_0x2d799a[_0x9c00('0x1f')]['sort']);_0x16a230[_0x9c00('0x5d')]=qs[_0x9c00('0x7a')](_[_0x9c00('0x7f')](_0x2d799a[_0x9c00('0x1f')],_0x28a37e[_0x9c00('0x7a')]));_0x16a230['where']['ContactId']=_0x29a18e['id'];if(_0x2d799a[_0x9c00('0x1f')]['filter']){_0x16a230[_0x9c00('0x5d')]=_[_0x9c00('0x31')](_0x16a230['where'],{'$or':_[_0x9c00('0x6d')](_0x16a230[_0x9c00('0x7c')],function(_0x5de71d){var _0x2b0957={};_0x2b0957[_0x5de71d]={'$like':'%'+_0x2d799a[_0x9c00('0x1f')]['filter']+'%'};return _0x2b0957;})});}_0x16a230=_[_0x9c00('0x31')]({},_0x16a230,_0x2d799a[_0x9c00('0x9b')]);return db[_0x9c00('0x4a')][_0x9c00('0x11')]({'where':_0x16a230['where']})['then'](function(_0x1f03be){_0x131e4e[_0x9c00('0x11')]=_0x1f03be;if(_0x2d799a[_0x9c00('0x1f')][_0x9c00('0x9c')]){_0x16a230[_0x9c00('0x9d')]=[{'all':!![]}];}return db['CmHopperFinal'][_0x9c00('0x2b')](_0x16a230);})['then'](function(_0x4d352e){_0x131e4e[_0x9c00('0x9e')]=_0x4d352e;return _0x131e4e;});}})[_0x9c00('0x17')](respondWithFilteredResult(_0x2ed748,_0x16a230))[_0x9c00('0x30')](handleError(_0x2ed748,null));};exports['getJscriptySessions']=function(_0x5dc576,_0x51cffd){var _0x36184e={'raw':!![],'where':{}};var _0x2dc32b={};var _0x1f029c={'count':0x0,'rows':[]};return db[_0x9c00('0x22')]['findOne']({'where':{'id':_0x5dc576['params']['id']}})['then'](handleEntityNotFound(_0x51cffd,null))[_0x9c00('0x17')](function(_0x547788){if(_0x547788){_0x2dc32b[_0x9c00('0x78')]=_[_0x9c00('0x23')](db[_0x9c00('0xa1')][_0x9c00('0x79')]);_0x2dc32b[_0x9c00('0x1f')]=_[_0x9c00('0x23')](_0x5dc576[_0x9c00('0x1f')]);_0x2dc32b[_0x9c00('0x7a')]=_[_0x9c00('0x7b')](_0x2dc32b['model'],_0x2dc32b['query']);_0x36184e[_0x9c00('0x7c')]=_[_0x9c00('0x7b')](_0x2dc32b[_0x9c00('0x78')],qs[_0x9c00('0x7d')](_0x5dc576[_0x9c00('0x1f')]['fields']));_0x36184e[_0x9c00('0x7c')]=_0x36184e[_0x9c00('0x7c')][_0x9c00('0x24')]?_0x36184e[_0x9c00('0x7c')]:_0x2dc32b['model'];if(!_0x5dc576[_0x9c00('0x1f')][_0x9c00('0x2f')](_0x9c00('0x81'))){_0x36184e[_0x9c00('0x12')]=qs[_0x9c00('0x12')](_0x5dc576['query'][_0x9c00('0x12')]);_0x36184e[_0x9c00('0xf')]=qs[_0x9c00('0xf')](_0x5dc576[_0x9c00('0x1f')][_0x9c00('0xf')]);}_0x36184e['order']=qs[_0x9c00('0x7e')](_0x5dc576[_0x9c00('0x1f')][_0x9c00('0x7e')]);_0x36184e['where']=qs[_0x9c00('0x7a')](_[_0x9c00('0x7f')](_0x5dc576[_0x9c00('0x1f')],_0x2dc32b[_0x9c00('0x7a')]));_0x36184e[_0x9c00('0x5d')][_0x9c00('0x9a')]=_0x547788['id'];if(_0x5dc576[_0x9c00('0x1f')][_0x9c00('0x80')]){_0x36184e[_0x9c00('0x5d')]=_[_0x9c00('0x31')](_0x36184e[_0x9c00('0x5d')],{'$or':_['map'](_0x36184e[_0x9c00('0x7c')],function(_0x54b30e){var _0x305d75={};_0x305d75[_0x54b30e]={'$like':'%'+_0x5dc576[_0x9c00('0x1f')][_0x9c00('0x80')]+'%'};return _0x305d75;})});}_0x36184e=_[_0x9c00('0x31')]({},_0x36184e,_0x5dc576[_0x9c00('0x9b')]);return db[_0x9c00('0xa1')][_0x9c00('0x11')]({'where':_0x36184e[_0x9c00('0x5d')]})[_0x9c00('0x17')](function(_0x222774){_0x1f029c[_0x9c00('0x11')]=_0x222774;if(_0x5dc576['query'][_0x9c00('0x9c')]){_0x36184e[_0x9c00('0x9d')]=[{'all':!![]}];}return db[_0x9c00('0xa1')][_0x9c00('0x2b')](_0x36184e);})[_0x9c00('0x17')](function(_0x2ec957){_0x1f029c[_0x9c00('0x9e')]=_0x2ec957;return _0x1f029c;});}})[_0x9c00('0x17')](respondWithFilteredResult(_0x51cffd,_0x36184e))['catch'](handleError(_0x51cffd,null));};exports[_0x9c00('0xa2')]=function(_0x4dc198,_0x5cafec){try{if(!_0x4dc198[_0x9c00('0x32')][_0x9c00('0x5e')]){throw new Error(_0x9c00('0xa3'));}if(!_0x4dc198['body'][_0x9c00('0xa4')]){throw new Error('No\x20association\x20keys\x20specified!');}if(!_0x4dc198[_0x9c00('0x32')][_0x9c00('0xa5')]){throw new Error(_0x9c00('0xa6'));}if(!_0x4dc198[_0x9c00('0x32')][_0x9c00('0xa7')]){throw new Error(_0x9c00('0xa8'));}var _0x1094ca=_0x4dc198[_0x9c00('0x32')]['binding_keys'][_0x9c00('0xa9')](',');var _0x16a067=_0x4dc198[_0x9c00('0x32')][_0x9c00('0xa5')][_0x9c00('0xa9')](',');if(!_0x1094ca[_0x9c00('0x24')]||!_0x16a067[_0x9c00('0x24')]||_0x1094ca[_0x9c00('0x24')]!==_0x16a067[_0x9c00('0x24')]){throw new Error(_0x9c00('0xaa'));}_0x4dc198['body']['fields']=_['zipObject'](_0x1094ca,_0x16a067);if(!_0x4dc198[_0x9c00('0x32')][_0x9c00('0x7d')][_0x9c00('0x76')]){throw new Error(_0x9c00('0xab'));}if(!_0x4dc198[_0x9c00('0x32')][_0x9c00('0x7d')][_0x9c00('0xac')]){throw new Error(_0x9c00('0xad'));}var _0x345da9=path['join'](config[_0x9c00('0xae')],'server/files/tmp',_0x4dc198[_0x9c00('0xaf')][_0x9c00('0xb0')]);fs['chmodSync'](_0x345da9,parseInt(_0x9c00('0xb1'),0x8));var _0x420400=require('child_process')[_0x9c00('0xb2')](path[_0x9c00('0x37')](__dirname,'../../components/import/cm/csv'),[_0x345da9,_0x4dc198['body'][_0x9c00('0xa4')],_0x4dc198[_0x9c00('0x32')][_0x9c00('0xa5')],_0x4dc198[_0x9c00('0x32')][_0x9c00('0x5e')],_0x4dc198[_0x9c00('0x32')][_0x9c00('0xb3')],_0x4dc198['body'][_0x9c00('0x5a')],_0x4dc198['body'][_0x9c00('0xa7')]]);return _0x5cafec[_0x9c00('0x13')](0xc8)['json']({'message':'File\x20uploaded\x20correctly!','pid':_0x420400[_0x9c00('0xb4')]});}catch(_0x27baaf){return _0x5cafec[_0x9c00('0x13')](0x1f4)[_0x9c00('0x1d')](_0x27baaf);}};exports['upload']=function(_0x232292,_0x14f40e){var _0x562ff2=fs['createReadStream'](_0x232292['file'][_0x9c00('0x2')]);Papa['parse'](_0x562ff2,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x148e92){return _0x14f40e[_0x9c00('0x13')](0xc8)[_0x9c00('0xe')]({'file':_0x232292[_0x9c00('0xaf')],'fields':_0x148e92[_0x9c00('0xb5')][_0x9c00('0x7d')]});}});};exports[_0x9c00('0xb6')]=function(_0x255f96,_0x3feba9){return db[_0x9c00('0xb7')][_0x9c00('0x2b')]({'raw':!![],'attributes':['id'],'where':{'role':'agent'}})[_0x9c00('0x17')](function(_0x179b52){var _0x57c769=![];if(!_0x255f96['body'][_0x9c00('0x5e')]){throw new Error('No\x20ListId\x20specified');}if(!_0x255f96[_0x9c00('0x32')][_0x9c00('0xb8')][_0x9c00('0x76')]){throw new Error(_0x9c00('0xab'));}if(!_0x255f96['body'][_0x9c00('0xb8')]['firstName']){throw new Error(_0x9c00('0xad'));}if(!_0x255f96[_0x9c00('0x32')][_0x9c00('0xa7')]){throw new Error(_0x9c00('0xa8'));}var _0x2e75fe=require(_0x9c00('0xb9'))[_0x9c00('0xb2')](path[_0x9c00('0x37')](__dirname,_0x9c00('0xba')),[_0x255f96[_0x9c00('0x66')]['id'],JSON[_0x9c00('0xbb')](_0x255f96[_0x9c00('0x32')]),JSON[_0x9c00('0xbb')](_0x179b52)]);_0x2e75fe['on']('message',function(){_0x57c769=!![];return _0x3feba9[_0x9c00('0x13')](0xc8)['json']({'message':_0x9c00('0xbc'),'pid':_0x2e75fe['pid']});});_0x2e75fe['on'](_0x9c00('0xbd'),function(_0x27f195){if(_0x27f195&&!_0x57c769){return _0x3feba9[_0x9c00('0x13')](0x1f4)[_0x9c00('0xe')]({'message':'error\x20child\x20process','pid':_0x2e75fe[_0x9c00('0xb4')]});}});})[_0x9c00('0x30')](handleError(_0x3feba9,null));};exports[_0x9c00('0xbe')]=function(_0x5a6f5e,_0x4bb531){return db[_0x9c00('0xb7')][_0x9c00('0x2b')]({'raw':!![],'attributes':['id'],'where':{'role':_0x9c00('0xbf')}})[_0x9c00('0x17')](function(_0x41e13e){var _0x1dbe7d=![];if(!_0x5a6f5e['body'][_0x9c00('0x5e')]){throw new Error('No\x20ListId\x20specified');}if(!_0x5a6f5e[_0x9c00('0x32')][_0x9c00('0xb8')]['phone']){throw new Error(_0x9c00('0xab'));}if(!_0x5a6f5e[_0x9c00('0x32')][_0x9c00('0xb8')]['firstName']){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x5a6f5e[_0x9c00('0x32')]['socket_timestamp']){throw new Error(_0x9c00('0xa8'));}var _0x40988a=require(_0x9c00('0xb9'))[_0x9c00('0xb2')](path[_0x9c00('0x37')](__dirname,_0x9c00('0xc0')),[_0x5a6f5e[_0x9c00('0x66')]['id'],JSON['stringify'](_0x5a6f5e[_0x9c00('0x32')]),JSON[_0x9c00('0xbb')](_0x41e13e)]);_0x40988a['on'](_0x9c00('0xc1'),function(){_0x1dbe7d=!![];return _0x4bb531['status'](0xc8)[_0x9c00('0xe')]({'message':_0x9c00('0xbc'),'pid':_0x40988a[_0x9c00('0xb4')]});});_0x40988a['on'](_0x9c00('0xbd'),function(_0xab502c){if(_0xab502c&&!_0x1dbe7d){return _0x4bb531[_0x9c00('0x13')](0x1f4)[_0x9c00('0xe')]({'message':'error\x20child\x20process','pid':_0x40988a[_0x9c00('0xb4')]});}});})[_0x9c00('0x30')](handleError(_0x4bb531,null));};exports[_0x9c00('0xc2')]=function(_0x11a503,_0x1399e5){var _0x148d97=[_0x9c00('0xc3'),_0x9c00('0xc4'),'sms',_0x9c00('0xc5'),_0x9c00('0xc6'),_0x9c00('0xc7'),_0x9c00('0xc8')];var _0x17490a={'offset':0x0,'order':qs[_0x9c00('0x7e')](_0x9c00('0xc9'))},_0x1e0d07={'count':0x0,'rows':[]};Promise['resolve']()[_0x9c00('0x17')](function(){if(_0x11a503[_0x9c00('0x1f')]['channel']){if(!_[_0x9c00('0xca')](_0x148d97,_0x11a503[_0x9c00('0x1f')][_0x9c00('0xcb')][_0x9c00('0xcc')]())){throw new Error(_0x9c00('0xcd'));}_0x148d97=[_0x11a503[_0x9c00('0x1f')][_0x9c00('0xcb')]['toLowerCase']()];}if(_0x11a503[_0x9c00('0x1f')][_0x9c00('0xce')]){try{var _0x3a78ce=JSON[_0x9c00('0xcf')](_0x11a503[_0x9c00('0x1f')][_0x9c00('0xce')]);if(!moment(_0x3a78ce[_0x9c00('0x3d')])[_0x9c00('0xd0')]()){throw new Error(_0x9c00('0xd1'));}if(!moment(_0x3a78ce['to'])['isValid']()){throw new Error('Invalid\x20date\x20for\x20range\x20to\x20filter');}}catch(_0x17d5e9){throw new Error(_0x9c00('0xd2'));}}if(!_0x11a503[_0x9c00('0x1f')][_0x9c00('0x2f')](_0x9c00('0x81'))){_0x17490a[_0x9c00('0x12')]=qs[_0x9c00('0x12')](_0x11a503[_0x9c00('0x1f')][_0x9c00('0x12')]||0xa);_0x17490a[_0x9c00('0xf')]=qs[_0x9c00('0xf')](_0x11a503[_0x9c00('0x1f')]['offset']);}var _0x2dc84a=_0x148d97['map'](function(_0x2ded5b){if(_0x2ded5b===_0x9c00('0xc8')){var _0x3e0afc={'attributes':['id',_0x9c00('0xd3'),_0x9c00('0x2d'),_0x9c00('0xd4'),_0x9c00('0xd5'),_0x9c00('0xd6'),'starttime',_0x9c00('0xd7'),_0x9c00('0xd8'),_0x9c00('0xd9'),'createdAt',_0x9c00('0xda'),'userSecondDisposition',_0x9c00('0xdb'),_0x9c00('0xdc')],'where':{'ContactId':_0x11a503[_0x9c00('0x66')]['id']},'include':[{'model':db[_0x9c00('0xb7')],'as':'User','attributes':['id',_0x9c00('0x1c'),'fullname','alias']}],'order':[[_0x9c00('0xdd'),_0x9c00('0xde')]]};if(_0x11a503[_0x9c00('0x1f')][_0x9c00('0xce')]){_0x3e0afc['where'][_0x9c00('0xdd')]={'$gte':_0x3a78ce[_0x9c00('0x3d')],'$lte':_0x3a78ce['to']};}return db[_0x9c00('0x4b')][_0x9c00('0xdf')](_0x3e0afc)[_0x9c00('0x17')](function(_0x537b06){_0x1e0d07[_0x9c00('0x11')]+=_0x537b06[_0x9c00('0x11')];return _[_0x9c00('0x6d')](_0x537b06[_0x9c00('0x9e')],function(_0x5a6666){var _0x132ca2=_0x5a6666['get']({'plain':!![]});_0x132ca2[_0x9c00('0xcb')]=_0x2ded5b;if(_0x132ca2[_0x9c00('0xb7')]){_0x132ca2[_0x9c00('0xb7')]={'id':_0x132ca2[_0x9c00('0xb7')]['id'],'name':_0x132ca2[_0x9c00('0xb7')][_0x9c00('0x1c')],'fullname':_0x132ca2['User'][_0x9c00('0xe0')],'alias':_0x132ca2[_0x9c00('0xb7')]['alias']};}return _0x132ca2;});});}else{var _0x47fb75=_[_0x9c00('0xe1')](_0x2ded5b)+(_0x2ded5b==='chat'?_0x9c00('0xe2'):_0x9c00('0xe3'));var _0x169140={'attributes':['id','closed',_0x9c00('0xe4'),_0x9c00('0xdd'),'note',_0x9c00('0xe5'),_0x9c00('0xe6'),_0x9c00('0xe7'),'UserId',_0x47fb75+'Id'],'where':{'ContactId':_0x11a503[_0x9c00('0x66')]['id']},'include':[{'model':db[_0x47fb75],'as':_0x9c00('0xe3'),'attributes':['id',_0x9c00('0x1c'),'key']},{'model':db[_0x9c00('0xb7')],'as':_0x9c00('0xe8'),'attributes':['id',_0x9c00('0x1c'),_0x9c00('0xe0')]},{'model':db[_0x9c00('0x63')],'as':_0x9c00('0xe9'),'attributes':['id',_0x9c00('0x1c'),_0x9c00('0xea')],'through':{'attributes':[]}}],'order':[[_0x9c00('0xdd'),_0x9c00('0xde')]]};if(_0x11a503['query'][_0x9c00('0xce')]){_0x169140[_0x9c00('0x5d')][_0x9c00('0xdd')]={'$gte':_0x3a78ce[_0x9c00('0x3d')],'$lte':_0x3a78ce['to']};}switch(_0x2ded5b){case'chat':_0x169140[_0x9c00('0x7c')][_0x9c00('0x5c')](_0x9c00('0xeb'),'customerIp','customerPort',_0x9c00('0xec'),_0x9c00('0xed'),_0x9c00('0xee'),_0x9c00('0xef'),_0x9c00('0xf0'),'referer');break;case'mail':_0x169140[_0x9c00('0x7c')]['push'](_0x9c00('0xf1'),'substatus');break;case _0x9c00('0xc5'):_0x169140['attributes'][_0x9c00('0x5c')](_0x9c00('0xf2'),_0x9c00('0xf3'));break;}return db[_[_0x9c00('0xe1')](_0x2ded5b)+_0x9c00('0xf4')][_0x9c00('0xdf')](_0x169140)[_0x9c00('0x17')](function(_0x997e04){_0x1e0d07[_0x9c00('0x11')]+=_0x997e04['count'];return _[_0x9c00('0x6d')](_0x997e04[_0x9c00('0x9e')],function(_0x4e1740){var _0x504b21=_0x4e1740[_0x9c00('0x33')]({'plain':!![]});_0x504b21[_0x9c00('0xcb')]=_0x2ded5b;if(_0x504b21[_0x9c00('0xe8')]){_0x504b21[_0x9c00('0xe8')]={'id':_0x504b21[_0x9c00('0xe8')]['id'],'name':_0x504b21[_0x9c00('0xe8')][_0x9c00('0x1c')],'fullname':_0x504b21[_0x9c00('0xe8')][_0x9c00('0xe0')]};}return _0x504b21;});});}});return Promise['all'](_0x2dc84a);})[_0x9c00('0x17')](function(_0x6294ec){return _(_0x6294ec)[_0x9c00('0xf5')]()[_0x9c00('0xf6')](_0x9c00('0xdd'))[_0x9c00('0xf7')]()[_0x9c00('0xf8')]();})['then'](function(_0x2b5b33){_0x1e0d07[_0x9c00('0x9e')]=_0x17490a['limit']?_0x2b5b33[_0x9c00('0xf9')](_0x17490a[_0x9c00('0xf')],_0x17490a[_0x9c00('0xf')]+_0x17490a[_0x9c00('0x12')]):_0x2b5b33;return _0x1e0d07;})[_0x9c00('0x17')](respondWithFilteredResult(_0x1399e5,_0x17490a))[_0x9c00('0x30')](handleError(_0x1399e5,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 8b61d8e..fde6d2f 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 _0x5ecb=['emit','hasOwnProperty','hook','exports','../../mysqldb','save','update','remove'];(function(_0x10e3b2,_0x3187b9){var _0xed1e6=function(_0x3bdb39){while(--_0x3bdb39){_0x10e3b2['push'](_0x10e3b2['shift']());}};_0xed1e6(++_0x3187b9);}(_0x5ecb,0x154));var _0xb5ec=function(_0x3f5dca,_0x59472b){_0x3f5dca=_0x3f5dca-0x0;var _0x5b833a=_0x5ecb[_0x3f5dca];return _0x5b833a;};'use strict';var EventEmitter=require('events');var CmContact=require(_0xb5ec('0x0'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb5ec('0x1'),'afterUpdate':_0xb5ec('0x2'),'afterDestroy':_0xb5ec('0x3')};function emitEvent(_0x235ce0){return function(_0x44b5b3,_0x4bf38d,_0x525600){CmContactEvents[_0xb5ec('0x4')](_0x235ce0+':'+_0x44b5b3['id'],_0x44b5b3);CmContactEvents[_0xb5ec('0x4')](_0x235ce0,_0x44b5b3);_0x525600(null);};}for(var e in events){if(events[_0xb5ec('0x5')](e)){var event=events[e];CmContact[_0xb5ec('0x6')](e,emitEvent(event));}}module[_0xb5ec('0x7')]=CmContactEvents; \ No newline at end of file +var _0x36d4=['remove','emit','hook','exports','events','../../mysqldb','save'];(function(_0x5d2288,_0x352f6c){var _0x633f73=function(_0x4c26cf){while(--_0x4c26cf){_0x5d2288['push'](_0x5d2288['shift']());}};_0x633f73(++_0x352f6c);}(_0x36d4,0x6d));var _0x436d=function(_0x178f52,_0x5d9675){_0x178f52=_0x178f52-0x0;var _0x556f99=_0x36d4[_0x178f52];return _0x556f99;};'use strict';var EventEmitter=require(_0x436d('0x0'));var CmContact=require(_0x436d('0x1'))['db']['CmContact'];var CmContactEvents=new EventEmitter();CmContactEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x436d('0x2'),'afterUpdate':'update','afterDestroy':_0x436d('0x3')};function emitEvent(_0x4e8af0){return function(_0x2f72e0,_0x4ddeec,_0x13d28c){CmContactEvents[_0x436d('0x4')](_0x4e8af0+':'+_0x2f72e0['id'],_0x2f72e0);CmContactEvents[_0x436d('0x4')](_0x4e8af0,_0x2f72e0);_0x13d28c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0x436d('0x5')](e,emitEvent(event));}}module[_0x436d('0x6')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index d8dfac9..d767a77 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 _0xf2b8=['catch','message','isEmpty','length','destroy','ContactId','push','[CmContact][afterDestroy][Succesfull]','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','api','../../config/environment/shared','./cmContact.attributes','VoiceQueue','scheduledat','format','isNil','dialTimezone','findOne','then','resolve','utcOffset','add','minutes','YYYY-MM-DD\x20HH:mm:ss','phone','ListId','priority','callbackUniqueid','assign','CmHopper','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20','CampaignId','VoiceQueueId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','always','findAll','outbound','dialCheckDuplicateType','Lists','map','all','Campaign','CmList','BlackLists','CmHopperBlack','create','exports','define','cm_contacts','fti_cm_contacts','firstName','lastName','fax','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','get','error','[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'];(function(_0x4cbe17,_0x300320){var _0x3070ef=function(_0xce193c){while(--_0xce193c){_0x4cbe17['push'](_0x4cbe17['shift']());}};_0x3070ef(++_0x300320);}(_0xf2b8,0x116));var _0x8f2b=function(_0x11d452,_0x14e650){_0x11d452=_0x11d452-0x0;var _0x44cc01=_0xf2b8[_0x11d452];return _0x44cc01;};'use strict';var _=require(_0x8f2b('0x0'));var util=require(_0x8f2b('0x1'));var logger=require(_0x8f2b('0x2'))(_0x8f2b('0x3'));var moment=require('moment');var shared=require(_0x8f2b('0x4'));var attributes=require(_0x8f2b('0x5'));function getTimezoneCallbackAt(_0x4d71c2,_0x2c2db1,_0x2c9aff,_0xd317a4){var _0x165fa2=_0xd317a4?'Campaign':_0x8f2b('0x6');var _0x21f115=_0x2c9aff[_0x8f2b('0x7')]?_0x2c9aff['scheduledat']:moment()[_0x8f2b('0x8')]('YYYY-MM-DD\x20HH:mm:ss');if(_[_0x8f2b('0x9')](_0x2c9aff[_0x8f2b('0xa')])){return Promise['resolve'](_0x21f115);}return _0x4d71c2[_0x165fa2][_0x8f2b('0xb')]({'where':{'id':_0x2c2db1}})[_0x8f2b('0xc')](function(_0x74f32a){if(_[_0x8f2b('0x9')](_0x74f32a)||_[_0x8f2b('0x9')](_0x74f32a[_0x8f2b('0xa')])){return Promise[_0x8f2b('0xd')](_0x21f115);}var _0x438e56=shared['timezones'];var _0x47354a=_0x438e56[_0x74f32a[_0x8f2b('0xa')]];var _0x3833d1=_0x438e56[_0x2c9aff[_0x8f2b('0xa')]];if(_[_0x8f2b('0x9')](_0x47354a)&&_[_0x8f2b('0x9')](_0x3833d1)){return Promise[_0x8f2b('0xd')](_0x21f115);}var _0x516dcc=_0x47354a[_0x8f2b('0xe')]-_0x3833d1[_0x8f2b('0xe')];var _0x3b7455=_0x2c9aff[_0x8f2b('0x7')]?_0x2c9aff[_0x8f2b('0x7')]:moment();_0x21f115=moment(_0x3b7455)[_0x8f2b('0xf')](_0x516dcc,_0x8f2b('0x10'))['format'](_0x8f2b('0x11'));return Promise[_0x8f2b('0xd')](_0x21f115);});}function getNewHopperPayload(_0xa5aebe){return{'phone':_0xa5aebe[_0x8f2b('0x12')],'ContactId':_0xa5aebe['id'],'ListId':_0xa5aebe[_0x8f2b('0x13')],'scheduledat':_0xa5aebe[_0x8f2b('0x7')]?_0xa5aebe[_0x8f2b('0x7')]:moment()['format'](_0x8f2b('0x11')),'priority':_0xa5aebe[_0x8f2b('0x14')]?_0xa5aebe[_0x8f2b('0x14')]:0x2,'callback':_0xa5aebe[_0x8f2b('0x15')]?!![]:![],'callbackuniqueid':_0xa5aebe[_0x8f2b('0x15')]?_0xa5aebe[_0x8f2b('0x15')]:undefined,'callbackat':_0xa5aebe[_0x8f2b('0x15')]?moment()[_0x8f2b('0x8')](_0x8f2b('0x11')):undefined};}function handleAlwaysCheckDuplicate(_0x79d6e1,_0x42ec43,_0x44fd1e,_0x1c7347){var _0x19aeea={'phone':_0x44fd1e[_0x8f2b('0x12')]};var _0x24fdf7={'calleridnum':_0x44fd1e[_0x8f2b('0x12')]};if(_0x1c7347){Object[_0x8f2b('0x16')](_0x19aeea,{'CampaignId':_0x42ec43['id']});Object['assign'](_0x24fdf7,{'CampaignId':_0x42ec43['id']});}else{Object['assign'](_0x19aeea,{'VoiceQueueId':_0x42ec43['id']});Object['assign'](_0x24fdf7,{'VoiceQueueId':_0x42ec43['id']});}return _0x79d6e1[_0x8f2b('0x17')][_0x8f2b('0xb')]({'where':_0x19aeea})[_0x8f2b('0xc')](function(_0x28b61f){if(_0x28b61f){throw new Error(_0x8f2b('0x18')+_0x44fd1e[_0x8f2b('0x12')]+'\x20in\x20Campaign\x20with\x20id\x20'+_0x42ec43['id']);}return _0x79d6e1[_0x8f2b('0x19')][_0x8f2b('0xb')]({'where':_0x24fdf7});})['then'](function(_0x552071){if(_0x552071){throw new Error(_0x8f2b('0x1a')+_0x44fd1e[_0x8f2b('0x12')]+_0x8f2b('0x1b')+_0x42ec43['id']);}var _0x270009=getNewHopperPayload(_0x44fd1e);if(_0x1c7347){_0x270009[_0x8f2b('0x1c')]=_0x42ec43['id'];}else{_0x270009[_0x8f2b('0x1d')]=_0x42ec43['id'];}return _0x79d6e1['CmHopper']['create'](_0x270009);});}function handleOnlyIfOpenCheckDuplicate(_0x3f246b,_0x587273,_0xeb6b84,_0x4245d1){var _0x3f3696={'phone':_0xeb6b84[_0x8f2b('0x12')]};if(_0x4245d1){Object[_0x8f2b('0x16')](_0x3f3696,{'CampaignId':_0x587273['id']});}else{Object['assign'](_0x3f3696,{'VoiceQueueId':_0x587273['id']});}return _0x3f246b[_0x8f2b('0x17')]['findOne']({'where':_0x3f3696})[_0x8f2b('0xc')](function(_0x5666f0){if(_0x5666f0){throw new Error(_0x8f2b('0x1e')+_0xeb6b84['phone']+_0x8f2b('0x1b')+_0x587273['id']);}var _0x570f76=getNewHopperPayload(_0xeb6b84);if(_0x4245d1){_0x570f76['CampaignId']=_0x587273['id'];}else{_0x570f76[_0x8f2b('0x1d')]=_0x587273['id'];}return _0x3f246b[_0x8f2b('0x17')]['create'](_0x570f76);});}function handleNeverCheckDuplicate(_0x158d12,_0x44d57b,_0x20ed6e){var _0x2d44b8=getNewHopperPayload(_0x20ed6e);_0x2d44b8[_0x8f2b('0x1d')]=_0x44d57b['id'];return _0x158d12[_0x8f2b('0x17')]['create'](_0x2d44b8);}function handleCheckDuplicate(_0x25d883,_0x4a490c,_0xd461b7,_0x42ac9c){return getTimezoneCallbackAt(_0x25d883,_0x4a490c,_0xd461b7,_0x42ac9c)[_0x8f2b('0xc')](function(_0xa2b748){_0xd461b7['scheduledat']=_0xa2b748;switch(_0x4a490c['dialCheckDuplicateType']){case _0x8f2b('0x1f'):return handleAlwaysCheckDuplicate(_0x25d883,_0x4a490c,_0xd461b7,_0x42ac9c);case'onlyIfOpen':return handleOnlyIfOpenCheckDuplicate(_0x25d883,_0x4a490c,_0xd461b7,_0x42ac9c);default:return handleNeverCheckDuplicate(_0x25d883,_0x4a490c,_0xd461b7);}});}function createHopperForVoiceQueues(_0x5ba6dc,_0x437a9b){return _0x5ba6dc[_0x8f2b('0x6')][_0x8f2b('0x20')]({'where':{'type':_0x8f2b('0x21')},'attributes':['id',_0x8f2b('0x22'),_0x8f2b('0xa')],'include':[{'model':_0x5ba6dc['CmList'],'as':_0x8f2b('0x23'),'where':{'id':_0x437a9b[_0x8f2b('0x13')]}}],'raw':!![]})[_0x8f2b('0xc')](function(_0x5d096d){var _0x5502b4=_0x5d096d[_0x8f2b('0x24')](function(_0xff3ecd){return handleCheckDuplicate(_0x5ba6dc,_0xff3ecd,_0x437a9b,![]);});return Promise[_0x8f2b('0x25')](_0x5502b4);});}function createHopperForCampaigns(_0x414211,_0x3b047b){return _0x414211[_0x8f2b('0x26')][_0x8f2b('0x20')]({'attributes':['id',_0x8f2b('0x22'),_0x8f2b('0xa')],'include':[{'model':_0x414211[_0x8f2b('0x27')],'as':'Lists','where':{'id':_0x3b047b[_0x8f2b('0x13')]}}],'raw':!![]})['then'](function(_0x2ddfe5){var _0x449ba5=_0x2ddfe5['map'](function(_0x3324df){return handleCheckDuplicate(_0x414211,_0x3324df,_0x3b047b,!![]);});return Promise[_0x8f2b('0x25')](_0x449ba5);});}function createHopperBlackForVoiceQueues(_0x37094f,_0xeedc4b){return _0x37094f[_0x8f2b('0x6')][_0x8f2b('0x20')]({'where':{'type':_0x8f2b('0x21')},'attributes':['id'],'include':[{'model':_0x37094f[_0x8f2b('0x27')],'as':_0x8f2b('0x28'),'where':{'id':_0xeedc4b['ListId']}}],'raw':!![]})['then'](function(_0x290e2b){var _0x19f0d9=_0x290e2b['map'](function(_0x21ead7){return _0x37094f[_0x8f2b('0x29')][_0x8f2b('0x2a')]({'phone':_0xeedc4b[_0x8f2b('0x12')],'ContactId':_0xeedc4b['id'],'ListId':_0xeedc4b[_0x8f2b('0x13')],'VoiceQueueId':_0x21ead7['id']});});return Promise[_0x8f2b('0x25')](_0x19f0d9);});}function createHopperBlackForCampaigns(_0xc03fb4,_0x36db49){return _0xc03fb4[_0x8f2b('0x26')]['findAll']({'attributes':['id'],'include':[{'model':_0xc03fb4[_0x8f2b('0x27')],'as':_0x8f2b('0x28'),'where':{'id':_0x36db49[_0x8f2b('0x13')]}}],'raw':!![]})[_0x8f2b('0xc')](function(_0x5a3fb3){var _0xf5546b=_0x5a3fb3[_0x8f2b('0x24')](function(_0x550857){return _0xc03fb4[_0x8f2b('0x29')]['create']({'phone':_0x36db49[_0x8f2b('0x12')],'ContactId':_0x36db49['id'],'ListId':_0x36db49[_0x8f2b('0x13')],'CampaignId':_0x550857['id']});});return Promise[_0x8f2b('0x25')](_0xf5546b);});}module[_0x8f2b('0x2b')]=function(_0x3c9dcb){return _0x3c9dcb[_0x8f2b('0x2c')]('CmContact',attributes,{'tableName':_0x8f2b('0x2d'),'paranoid':!![],'indexes':[{'name':_0x8f2b('0x12'),'fields':[_0x8f2b('0x12')]},{'name':_0x8f2b('0x2e'),'fields':[_0x8f2b('0x2f'),_0x8f2b('0x30'),_0x8f2b('0x12'),'mobile',_0x8f2b('0x31'),'email'],'type':_0x8f2b('0x32')}],'timestamps':!![],'charset':_0x8f2b('0x33'),'collate':_0x8f2b('0x34'),'hooks':{'afterCreate':function(_0x103afb,_0x3443ad,_0x3e5523){var _0x2a8880=_0x3c9dcb[_0x8f2b('0x35')];var _0x2f0a61=_0x103afb[_0x8f2b('0x36')]({'plain':!![]});if(!_0x2f0a61[_0x8f2b('0x13')]){logger[_0x8f2b('0x37')](_0x8f2b('0x38')+_0x2f0a61['id']);return _0x3e5523();}if(!_0x2f0a61[_0x8f2b('0x12')]){return _0x3e5523();}return createHopperForVoiceQueues(_0x2a8880,_0x2f0a61)[_0x8f2b('0xc')](function(){return createHopperBlackForVoiceQueues(_0x2a8880,_0x2f0a61);})[_0x8f2b('0xc')](function(){return createHopperForCampaigns(_0x2a8880,_0x2f0a61);})[_0x8f2b('0xc')](function(){return createHopperBlackForCampaigns(_0x2a8880,_0x2f0a61);})[_0x8f2b('0xc')](function(){return _0x3e5523();})[_0x8f2b('0x39')](function(_0x5151c4){logger[_0x8f2b('0x37')]('[cmContact][afterCreate]',_0x5151c4[_0x8f2b('0x3a')]);_0x3e5523();});},'afterDestroy':function(_0x14c401,_0x484f41,_0x1a41d6){var _0x29c490=_0x3c9dcb[_0x8f2b('0x35')];var _0x17df6a=_0x14c401[_0x8f2b('0x36')]({'plain':!![]});return _0x29c490[_0x8f2b('0x17')][_0x8f2b('0x20')]({'raw':!![],'where':{'ListId':_0x17df6a[_0x8f2b('0x13')],'ContactId':_0x17df6a['id']}})[_0x8f2b('0xc')](function(_0x3a8ce0){if(!_[_0x8f2b('0x3b')](_0x3a8ce0)){var _0xd7ab11=[];for(var _0x4045dd=0x0;_0x4045dd<_0x3a8ce0[_0x8f2b('0x3c')];_0x4045dd+=0x1){var _0x990e29=_0x29c490[_0x8f2b('0x17')][_0x8f2b('0x3d')]({'where':{'ListId':_0x3a8ce0[_0x4045dd][_0x8f2b('0x13')],'ContactId':_0x3a8ce0[_0x4045dd][_0x8f2b('0x3e')],'VoiceQueueId':_0x3a8ce0[_0x4045dd][_0x8f2b('0x1d')],'CampaignId':_0x3a8ce0[_0x4045dd][_0x8f2b('0x1c')]}});_0xd7ab11[_0x8f2b('0x3f')](_0x990e29);}return Promise[_0x8f2b('0x25')](_0xd7ab11);}})[_0x8f2b('0xc')](function(_0x21f3a6){logger['info'](_0x8f2b('0x40'),util[_0x8f2b('0x41')](_0x21f3a6,{'showHidden':![],'depth':null}));_0x1a41d6();})[_0x8f2b('0x39')](function(_0x133d0e){logger['error'](_0x8f2b('0x42'),util[_0x8f2b('0x41')](_0x133d0e,{'showHidden':![],'depth':null}));_0x1a41d6(_0x133d0e);});}}});}; \ No newline at end of file +var _0xd38d=['CmHopperFinal','[Always]\x20Hopper\x20Final\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','CampaignId','[OnlyIfOpen]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','VoiceQueueId','CmHopper','create','dialCheckDuplicateType','always','onlyIfOpen','findAll','outbound','CmList','Lists','map','all','CmHopperBlack','exports','define','CmContact','fti_cm_contacts','mobile','utf8mb4','models','get','error','catch','isEmpty','destroy','push','info','inspect','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','moment','../../config/environment/shared','./cmContact.attributes','Campaign','VoiceQueue','scheduledat','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','resolve','findOne','then','timezones','utcOffset','add','minutes','phone','ListId','format','priority','callbackUniqueid','assign','[Always]\x20Hopper\x20already\x20exists\x20for\x20contact\x20with\x20phone\x20','\x20in\x20Campaign\x20with\x20id\x20'];(function(_0x2f24ee,_0x2b15b9){var _0x50dbd5=function(_0x339a6d){while(--_0x339a6d){_0x2f24ee['push'](_0x2f24ee['shift']());}};_0x50dbd5(++_0x2b15b9);}(_0xd38d,0x189));var _0xdd38=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xd38d[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0xdd38('0x0'));var util=require(_0xdd38('0x1'));var logger=require(_0xdd38('0x2'))('api');var moment=require(_0xdd38('0x3'));var shared=require(_0xdd38('0x4'));var attributes=require(_0xdd38('0x5'));function getTimezoneCallbackAt(_0x4af559,_0x6ba13e,_0xc62d25,_0x1340b8){var _0x31a878=_0x1340b8?_0xdd38('0x6'):_0xdd38('0x7');var _0x973d4d=_0xc62d25[_0xdd38('0x8')]?_0xc62d25[_0xdd38('0x8')]:moment()['format'](_0xdd38('0x9'));if(_[_0xdd38('0xa')](_0xc62d25[_0xdd38('0xb')])){return Promise[_0xdd38('0xc')](_0x973d4d);}return _0x4af559[_0x31a878][_0xdd38('0xd')]({'where':{'id':_0x6ba13e}})[_0xdd38('0xe')](function(_0x32f873){if(_['isNil'](_0x32f873)||_[_0xdd38('0xa')](_0x32f873[_0xdd38('0xb')])){return Promise['resolve'](_0x973d4d);}var _0x2dc0f0=shared[_0xdd38('0xf')];var _0x37690b=_0x2dc0f0[_0x32f873[_0xdd38('0xb')]];var _0xd2974f=_0x2dc0f0[_0xc62d25[_0xdd38('0xb')]];if(_[_0xdd38('0xa')](_0x37690b)&&_[_0xdd38('0xa')](_0xd2974f)){return Promise['resolve'](_0x973d4d);}var _0x252f05=_0x37690b[_0xdd38('0x10')]-_0xd2974f['utcOffset'];var _0x288fe6=_0xc62d25[_0xdd38('0x8')]?_0xc62d25[_0xdd38('0x8')]:moment();_0x973d4d=moment(_0x288fe6)[_0xdd38('0x11')](_0x252f05,_0xdd38('0x12'))['format'](_0xdd38('0x9'));return Promise['resolve'](_0x973d4d);});}function getNewHopperPayload(_0x2cc0b6){return{'phone':_0x2cc0b6[_0xdd38('0x13')],'ContactId':_0x2cc0b6['id'],'ListId':_0x2cc0b6[_0xdd38('0x14')],'scheduledat':_0x2cc0b6[_0xdd38('0x8')]?_0x2cc0b6[_0xdd38('0x8')]:moment()[_0xdd38('0x15')](_0xdd38('0x9')),'priority':_0x2cc0b6[_0xdd38('0x16')]?_0x2cc0b6['priority']:0x2,'callback':_0x2cc0b6[_0xdd38('0x17')]?!![]:![],'callbackuniqueid':_0x2cc0b6[_0xdd38('0x17')]?_0x2cc0b6[_0xdd38('0x17')]:undefined,'callbackat':_0x2cc0b6[_0xdd38('0x17')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined};}function handleAlwaysCheckDuplicate(_0x3deb36,_0x3f7918,_0x284e11,_0x322687){var _0x50476a={'phone':_0x284e11[_0xdd38('0x13')]};var _0x55f265={'calleridnum':_0x284e11[_0xdd38('0x13')]};if(_0x322687){Object[_0xdd38('0x18')](_0x50476a,{'CampaignId':_0x3f7918['id']});Object[_0xdd38('0x18')](_0x55f265,{'CampaignId':_0x3f7918['id']});}else{Object[_0xdd38('0x18')](_0x50476a,{'VoiceQueueId':_0x3f7918['id']});Object['assign'](_0x55f265,{'VoiceQueueId':_0x3f7918['id']});}return _0x3deb36['CmHopper'][_0xdd38('0xd')]({'where':_0x50476a})[_0xdd38('0xe')](function(_0x2211e9){if(_0x2211e9){throw new Error(_0xdd38('0x19')+_0x284e11[_0xdd38('0x13')]+_0xdd38('0x1a')+_0x3f7918['id']);}return _0x3deb36[_0xdd38('0x1b')][_0xdd38('0xd')]({'where':_0x55f265});})[_0xdd38('0xe')](function(_0x6afdd8){if(_0x6afdd8){throw new Error(_0xdd38('0x1c')+_0x284e11[_0xdd38('0x13')]+_0xdd38('0x1a')+_0x3f7918['id']);}var _0x401bba=getNewHopperPayload(_0x284e11);if(_0x322687){_0x401bba[_0xdd38('0x1d')]=_0x3f7918['id'];}else{_0x401bba['VoiceQueueId']=_0x3f7918['id'];}return _0x3deb36['CmHopper']['create'](_0x401bba);});}function handleOnlyIfOpenCheckDuplicate(_0x3ca8be,_0x4ac6eb,_0x3e4885,_0x1769d3){var _0x161403={'phone':_0x3e4885[_0xdd38('0x13')]};if(_0x1769d3){Object[_0xdd38('0x18')](_0x161403,{'CampaignId':_0x4ac6eb['id']});}else{Object[_0xdd38('0x18')](_0x161403,{'VoiceQueueId':_0x4ac6eb['id']});}return _0x3ca8be['CmHopper'][_0xdd38('0xd')]({'where':_0x161403})['then'](function(_0x15ec2f){if(_0x15ec2f){throw new Error(_0xdd38('0x1e')+_0x3e4885[_0xdd38('0x13')]+_0xdd38('0x1a')+_0x4ac6eb['id']);}var _0x354c71=getNewHopperPayload(_0x3e4885);if(_0x1769d3){_0x354c71[_0xdd38('0x1d')]=_0x4ac6eb['id'];}else{_0x354c71[_0xdd38('0x1f')]=_0x4ac6eb['id'];}return _0x3ca8be[_0xdd38('0x20')][_0xdd38('0x21')](_0x354c71);});}function handleNeverCheckDuplicate(_0x2272b2,_0x2bc0dd,_0x5edf82){var _0xe42874=getNewHopperPayload(_0x5edf82);_0xe42874[_0xdd38('0x1f')]=_0x2bc0dd['id'];return _0x2272b2[_0xdd38('0x20')][_0xdd38('0x21')](_0xe42874);}function handleCheckDuplicate(_0x5b730c,_0xafd137,_0x4cc2a4,_0x3142b6){return getTimezoneCallbackAt(_0x5b730c,_0xafd137,_0x4cc2a4,_0x3142b6)[_0xdd38('0xe')](function(_0x321a5d){_0x4cc2a4[_0xdd38('0x8')]=_0x321a5d;switch(_0xafd137[_0xdd38('0x22')]){case _0xdd38('0x23'):return handleAlwaysCheckDuplicate(_0x5b730c,_0xafd137,_0x4cc2a4,_0x3142b6);case _0xdd38('0x24'):return handleOnlyIfOpenCheckDuplicate(_0x5b730c,_0xafd137,_0x4cc2a4,_0x3142b6);default:return handleNeverCheckDuplicate(_0x5b730c,_0xafd137,_0x4cc2a4);}});}function createHopperForVoiceQueues(_0x5639cf,_0x7407aa){return _0x5639cf[_0xdd38('0x7')][_0xdd38('0x25')]({'where':{'type':_0xdd38('0x26')},'attributes':['id','dialCheckDuplicateType','dialTimezone'],'include':[{'model':_0x5639cf[_0xdd38('0x27')],'as':_0xdd38('0x28'),'where':{'id':_0x7407aa[_0xdd38('0x14')]}}],'raw':!![]})['then'](function(_0x5b2fe9){var _0x5e6b8a=_0x5b2fe9[_0xdd38('0x29')](function(_0x45827d){return handleCheckDuplicate(_0x5639cf,_0x45827d,_0x7407aa,![]);});return Promise[_0xdd38('0x2a')](_0x5e6b8a);});}function createHopperForCampaigns(_0x26c665,_0x5719ce){return _0x26c665[_0xdd38('0x6')][_0xdd38('0x25')]({'attributes':['id','dialCheckDuplicateType',_0xdd38('0xb')],'include':[{'model':_0x26c665[_0xdd38('0x27')],'as':_0xdd38('0x28'),'where':{'id':_0x5719ce['ListId']}}],'raw':!![]})['then'](function(_0x35e0b3){var _0x20f7e0=_0x35e0b3[_0xdd38('0x29')](function(_0x4a28d9){return handleCheckDuplicate(_0x26c665,_0x4a28d9,_0x5719ce,!![]);});return Promise[_0xdd38('0x2a')](_0x20f7e0);});}function createHopperBlackForVoiceQueues(_0x399b6a,_0xde6eef){return _0x399b6a[_0xdd38('0x7')][_0xdd38('0x25')]({'where':{'type':_0xdd38('0x26')},'attributes':['id'],'include':[{'model':_0x399b6a[_0xdd38('0x27')],'as':'BlackLists','where':{'id':_0xde6eef[_0xdd38('0x14')]}}],'raw':!![]})['then'](function(_0x1735f7){var _0x1351ae=_0x1735f7['map'](function(_0x35d073){return _0x399b6a['CmHopperBlack'][_0xdd38('0x21')]({'phone':_0xde6eef[_0xdd38('0x13')],'ContactId':_0xde6eef['id'],'ListId':_0xde6eef[_0xdd38('0x14')],'VoiceQueueId':_0x35d073['id']});});return Promise[_0xdd38('0x2a')](_0x1351ae);});}function createHopperBlackForCampaigns(_0x315afe,_0x23d916){return _0x315afe[_0xdd38('0x6')][_0xdd38('0x25')]({'attributes':['id'],'include':[{'model':_0x315afe[_0xdd38('0x27')],'as':'BlackLists','where':{'id':_0x23d916['ListId']}}],'raw':!![]})[_0xdd38('0xe')](function(_0x21da56){var _0x2db4f9=_0x21da56['map'](function(_0xf1313){return _0x315afe[_0xdd38('0x2b')]['create']({'phone':_0x23d916[_0xdd38('0x13')],'ContactId':_0x23d916['id'],'ListId':_0x23d916[_0xdd38('0x14')],'CampaignId':_0xf1313['id']});});return Promise[_0xdd38('0x2a')](_0x2db4f9);});}module[_0xdd38('0x2c')]=function(_0x24be20){return _0x24be20[_0xdd38('0x2d')](_0xdd38('0x2e'),attributes,{'tableName':'cm_contacts','paranoid':!![],'indexes':[{'name':_0xdd38('0x13'),'fields':[_0xdd38('0x13')]},{'name':_0xdd38('0x2f'),'fields':['firstName','lastName','phone',_0xdd38('0x30'),'fax','email'],'type':'FULLTEXT'}],'timestamps':!![],'charset':_0xdd38('0x31'),'collate':'utf8mb4_unicode_ci','hooks':{'afterCreate':function(_0x4457d9,_0x2c6a74,_0x1e22f1){var _0x23018e=_0x24be20[_0xdd38('0x32')];var _0x5ab5ac=_0x4457d9[_0xdd38('0x33')]({'plain':!![]});if(!_0x5ab5ac[_0xdd38('0x14')]){logger[_0xdd38('0x34')]('[cmContact][afterCreate]\x20List\x20not\x20found\x20for\x20contact\x20with\x20id\x20'+_0x5ab5ac['id']);return _0x1e22f1();}if(!_0x5ab5ac[_0xdd38('0x13')]){return _0x1e22f1();}return createHopperForVoiceQueues(_0x23018e,_0x5ab5ac)['then'](function(){return createHopperBlackForVoiceQueues(_0x23018e,_0x5ab5ac);})[_0xdd38('0xe')](function(){return createHopperForCampaigns(_0x23018e,_0x5ab5ac);})['then'](function(){return createHopperBlackForCampaigns(_0x23018e,_0x5ab5ac);})[_0xdd38('0xe')](function(){return _0x1e22f1();})[_0xdd38('0x35')](function(_0x781aa9){logger['error']('[cmContact][afterCreate]',_0x781aa9['message']);_0x1e22f1();});},'afterDestroy':function(_0x579724,_0xf48ee,_0x54918c){var _0x54b063=_0x24be20[_0xdd38('0x32')];var _0x160614=_0x579724[_0xdd38('0x33')]({'plain':!![]});return _0x54b063['CmHopper'][_0xdd38('0x25')]({'raw':!![],'where':{'ListId':_0x160614[_0xdd38('0x14')],'ContactId':_0x160614['id']}})[_0xdd38('0xe')](function(_0x1dc48d){if(!_[_0xdd38('0x36')](_0x1dc48d)){var _0x52cb02=[];for(var _0x29257e=0x0;_0x29257e<_0x1dc48d['length'];_0x29257e+=0x1){var _0x90e6d8=_0x54b063[_0xdd38('0x20')][_0xdd38('0x37')]({'where':{'ListId':_0x1dc48d[_0x29257e][_0xdd38('0x14')],'ContactId':_0x1dc48d[_0x29257e]['ContactId'],'VoiceQueueId':_0x1dc48d[_0x29257e][_0xdd38('0x1f')],'CampaignId':_0x1dc48d[_0x29257e]['CampaignId']}});_0x52cb02[_0xdd38('0x38')](_0x90e6d8);}return Promise[_0xdd38('0x2a')](_0x52cb02);}})['then'](function(_0x599352){logger[_0xdd38('0x39')]('[CmContact][afterDestroy][Succesfull]',util[_0xdd38('0x3a')](_0x599352,{'showHidden':![],'depth':null}));_0x54918c();})['catch'](function(_0xa3c56b){logger[_0xdd38('0x34')](_0xdd38('0x3b'),util[_0xdd38('0x3a')](_0xa3c56b,{'showHidden':![],'depth':null}));_0x54918c(_0xa3c56b);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 5ca1712..fe5435b 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_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 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(_0x4e1b44,_0x2cb0f7){var _0x2e768f=function(_0x365eec){while(--_0x365eec){_0x4e1b44['push'](_0x4e1b44['shift']());}};_0x2e768f(++_0x2cb0f7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'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 d610026..9d83bf6 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 _0x6732=['STRING','PHONE','sequelize','exports','INTEGER'];(function(_0x430d11,_0x4268b2){var _0x222357=function(_0x3a90a9){while(--_0x3a90a9){_0x430d11['push'](_0x430d11['shift']());}};_0x222357(++_0x4268b2);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x2673('0x0'));module[_0x2673('0x1')]={'CmContactId':{'type':Sequelize[_0x2673('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x2673('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize['INTEGER'],'defaultValue':null},'ItemClass':{'type':Sequelize[_0x2673('0x3')],'defaultValue':_0x2673('0x4')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0x2673('0x3')],'defaultValue':null}}; \ No newline at end of file +var _0x8fed=['STRING','PHONE','INTEGER'];(function(_0x20955a,_0x17a5c5){var _0x1e9a24=function(_0x4d28c8){while(--_0x4d28c8){_0x20955a['push'](_0x20955a['shift']());}};_0x1e9a24(++_0x17a5c5);}(_0x8fed,0xf5));var _0xd8fe=function(_0x52f4ad,_0x408fa5){_0x52f4ad=_0x52f4ad-0x0;var _0x1535b1=_0x8fed[_0x52f4ad];return _0x1535b1;};'use strict';var Sequelize=require('sequelize');module['exports']={'CmContactId':{'type':Sequelize[_0xd8fe('0x0')],'primaryKey':!![]},'item':{'type':Sequelize[_0xd8fe('0x1')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xd8fe('0x0')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xd8fe('0x1')],'defaultValue':_0xd8fe('0x2')},'OrderBy':{'type':Sequelize['INTEGER'],'defaultValue':null},'description':{'type':Sequelize[_0xd8fe('0x1')],'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 bfaa16f..cd4941b 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 _0x586a=['count','set','Content-Range','apply','reject','update','then','destroy','UserProfileResource','error','name','map','fieldName','model','query','filters','intersection','attributes','fields','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','CmContactHasItem','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','CmContactHasItems','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','bluebird','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit'];(function(_0x2e4790,_0x15d4ed){var _0x324230=function(_0x592269){while(--_0x592269){_0x2e4790['push'](_0x2e4790['shift']());}};_0x324230(++_0x15d4ed);}(_0x586a,0x17e));var _0xa586=function(_0x390ccc,_0x44622d){_0x390ccc=_0x390ccc-0x0;var _0xf97425=_0x586a[_0x390ccc];return _0xf97425;};'use strict';var emlformat=require(_0xa586('0x0'));var rimraf=require(_0xa586('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa586('0x2'));var rp=require(_0xa586('0x3'));var moment=require('moment');var BPromise=require(_0xa586('0x4'));var Mustache=require(_0xa586('0x5'));var util=require(_0xa586('0x6'));var path=require(_0xa586('0x7'));var sox=require(_0xa586('0x8'));var csv=require(_0xa586('0x9'));var ejs=require(_0xa586('0xa'));var fs=require('fs');var fs_extra=require(_0xa586('0xb'));var _=require(_0xa586('0xc'));var squel=require(_0xa586('0xd'));var crypto=require(_0xa586('0xe'));var jsforce=require(_0xa586('0xf'));var deskjs=require(_0xa586('0x10'));var toCsv=require(_0xa586('0x9'));var querystring=require('querystring');var Papa=require(_0xa586('0x11'));var Redis=require('ioredis');var authService=require(_0xa586('0x12'));var qs=require(_0xa586('0x13'));var as=require(_0xa586('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa586('0x15'))(_0xa586('0x16'));var utils=require(_0xa586('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xa586('0x18'));var db=require(_0xa586('0x19'))['db'];function respondWithStatusCode(_0x3b59cc,_0x3a6733){_0x3a6733=_0x3a6733||0xcc;return function(_0x4d2211){if(_0x4d2211){return _0x3b59cc[_0xa586('0x1a')](_0x3a6733);}return _0x3b59cc[_0xa586('0x1b')](_0x3a6733)[_0xa586('0x1c')]();};}function respondWithResult(_0x37a7c5,_0xe630e3){_0xe630e3=_0xe630e3||0xc8;return function(_0x404daa){if(_0x404daa){return _0x37a7c5[_0xa586('0x1b')](_0xe630e3)[_0xa586('0x1d')](_0x404daa);}};}function respondWithFilteredResult(_0x4b1338,_0x25ed40){return function(_0x5b22ee){if(_0x5b22ee){var _0x13d20a=typeof _0x25ed40[_0xa586('0x1e')]===_0xa586('0x1f')&&typeof _0x25ed40[_0xa586('0x20')]===_0xa586('0x1f');var _0x8ebad8=_0x5b22ee[_0xa586('0x21')];var _0x5743bb=_0x13d20a?0x0:_0x25ed40[_0xa586('0x1e')];var _0x4c41e1=_0x13d20a?_0x5b22ee[_0xa586('0x21')]:_0x25ed40[_0xa586('0x1e')]+_0x25ed40[_0xa586('0x20')];var _0x4ddfd8;if(_0x4c41e1>=_0x8ebad8){_0x4c41e1=_0x8ebad8;_0x4ddfd8=0xc8;}else{_0x4ddfd8=0xce;}_0x4b1338[_0xa586('0x1b')](_0x4ddfd8);return _0x4b1338[_0xa586('0x22')](_0xa586('0x23'),_0x5743bb+'-'+_0x4c41e1+'/'+_0x8ebad8)['json'](_0x5b22ee);}return null;};}function patchUpdates(_0x30862f){return function(_0x4362f2){try{jsonpatch[_0xa586('0x24')](_0x4362f2,_0x30862f,!![]);}catch(_0x314bf4){return BPromise[_0xa586('0x25')](_0x314bf4);}return _0x4362f2['save']();};}function saveUpdates(_0x223581,_0x3f3635){return function(_0x2ed474){if(_0x2ed474){return _0x2ed474[_0xa586('0x26')](_0x223581)[_0xa586('0x27')](function(_0x4856c8){return _0x4856c8;});}return null;};}function removeEntity(_0x313991,_0x2351ab){return function(_0x319008){if(_0x319008){return _0x319008[_0xa586('0x28')]()['then'](function(){var _0x134a9a=_0x319008['get']({'plain':!![]});var _0x530231='CmContactHasItems';return db[_0xa586('0x29')][_0xa586('0x28')]({'where':{'type':_0x530231,'resourceId':_0x134a9a['id']}})[_0xa586('0x27')](function(){return _0x319008;});})[_0xa586('0x27')](function(){_0x313991[_0xa586('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5987c4,_0x152e78){return function(_0x26d04c){if(!_0x26d04c){_0x5987c4[_0xa586('0x1a')](0x194);}return _0x26d04c;};}function handleError(_0x35b8a8,_0xd67b17){_0xd67b17=_0xd67b17||0x1f4;return function(_0x5eb31f){logger[_0xa586('0x2a')](_0x5eb31f['stack']);if(_0x5eb31f[_0xa586('0x2b')]){delete _0x5eb31f[_0xa586('0x2b')];}_0x35b8a8[_0xa586('0x1b')](_0xd67b17)['send'](_0x5eb31f);};}exports['index']=function(_0x2e92c3,_0x138a7d){var _0x4c26d6={},_0x279b26={},_0x524304={'count':0x0,'rows':[]};var _0x396445=_[_0xa586('0x2c')](db['CmContactHasItem']['rawAttributes'],function(_0x296a68){return{'name':_0x296a68[_0xa586('0x2d')],'type':_0x296a68['type']['key']};});_0x279b26[_0xa586('0x2e')]=_[_0xa586('0x2c')](_0x396445,_0xa586('0x2b'));_0x279b26[_0xa586('0x2f')]=_['keys'](_0x2e92c3['query']);_0x279b26[_0xa586('0x30')]=_[_0xa586('0x31')](_0x279b26['model'],_0x279b26[_0xa586('0x2f')]);_0x4c26d6[_0xa586('0x32')]=_[_0xa586('0x31')](_0x279b26[_0xa586('0x2e')],qs['fields'](_0x2e92c3[_0xa586('0x2f')][_0xa586('0x33')]));_0x4c26d6[_0xa586('0x32')]=_0x4c26d6[_0xa586('0x32')]['length']?_0x4c26d6['attributes']:_0x279b26['model'];if(!_0x2e92c3[_0xa586('0x2f')]['hasOwnProperty'](_0xa586('0x34'))){_0x4c26d6[_0xa586('0x20')]=qs[_0xa586('0x20')](_0x2e92c3[_0xa586('0x2f')][_0xa586('0x20')]);_0x4c26d6['offset']=qs[_0xa586('0x1e')](_0x2e92c3[_0xa586('0x2f')][_0xa586('0x1e')]);}_0x4c26d6[_0xa586('0x35')]=qs[_0xa586('0x36')](_0x2e92c3[_0xa586('0x2f')][_0xa586('0x36')]);_0x4c26d6['where']=qs[_0xa586('0x30')](_[_0xa586('0x37')](_0x2e92c3['query'],_0x279b26[_0xa586('0x30')]),_0x396445);if(_0x2e92c3[_0xa586('0x2f')][_0xa586('0x38')]){_0x4c26d6['where']=_[_0xa586('0x39')](_0x4c26d6[_0xa586('0x3a')],{'$or':_[_0xa586('0x2c')](_0x396445,function(_0x19c0f4){if(_0x19c0f4[_0xa586('0x3b')]!==_0xa586('0x3c')){var _0x47e34c={};_0x47e34c[_0x19c0f4[_0xa586('0x2b')]]={'$like':'%'+_0x2e92c3[_0xa586('0x2f')][_0xa586('0x38')]+'%'};return _0x47e34c;}})});}_0x4c26d6=_[_0xa586('0x39')]({},_0x4c26d6,_0x2e92c3[_0xa586('0x3d')]);var _0xd849d4={'where':_0x4c26d6[_0xa586('0x3a')]};return db[_0xa586('0x3e')][_0xa586('0x21')](_0xd849d4)[_0xa586('0x27')](function(_0x14e2ec){_0x524304[_0xa586('0x21')]=_0x14e2ec;if(_0x2e92c3[_0xa586('0x2f')][_0xa586('0x3f')]){_0x4c26d6[_0xa586('0x40')]=[{'all':!![]}];}return db[_0xa586('0x3e')][_0xa586('0x41')](_0x4c26d6);})[_0xa586('0x27')](function(_0x1e2089){_0x524304[_0xa586('0x42')]=_0x1e2089;return _0x524304;})[_0xa586('0x27')](respondWithFilteredResult(_0x138a7d,_0x4c26d6))[_0xa586('0x43')](handleError(_0x138a7d,null));};exports[_0xa586('0x44')]=function(_0x26ffa9,_0x571894){var _0x2a6813={'raw':!![],'where':{'id':_0x26ffa9[_0xa586('0x45')]['id']}},_0x1f1dad={};_0x1f1dad['model']=_['keys'](db[_0xa586('0x3e')]['rawAttributes']);_0x1f1dad[_0xa586('0x2f')]=_['keys'](_0x26ffa9[_0xa586('0x2f')]);_0x1f1dad[_0xa586('0x30')]=_[_0xa586('0x31')](_0x1f1dad[_0xa586('0x2e')],_0x1f1dad[_0xa586('0x2f')]);_0x2a6813[_0xa586('0x32')]=_[_0xa586('0x31')](_0x1f1dad[_0xa586('0x2e')],qs[_0xa586('0x33')](_0x26ffa9['query'][_0xa586('0x33')]));_0x2a6813[_0xa586('0x32')]=_0x2a6813['attributes'][_0xa586('0x46')]?_0x2a6813[_0xa586('0x32')]:_0x1f1dad[_0xa586('0x2e')];if(_0x26ffa9[_0xa586('0x2f')]['includeAll']){_0x2a6813[_0xa586('0x40')]=[{'all':!![]}];}_0x2a6813=_[_0xa586('0x39')]({},_0x2a6813,_0x26ffa9['options']);return db[_0xa586('0x3e')][_0xa586('0x47')](_0x2a6813)['then'](handleEntityNotFound(_0x571894,null))[_0xa586('0x27')](respondWithResult(_0x571894,null))[_0xa586('0x43')](handleError(_0x571894,null));};exports['create']=function(_0x44b3ad,_0xaa9fe5){return db[_0xa586('0x3e')][_0xa586('0x48')](_0x44b3ad[_0xa586('0x49')],{})[_0xa586('0x27')](function(_0x18d3af){var _0xe35d80=_0x44b3ad[_0xa586('0x4a')][_0xa586('0x4b')]({'plain':!![]});if(!_0xe35d80)throw new Error(_0xa586('0x4c'));if(_0xe35d80[_0xa586('0x4d')]===_0xa586('0x4a')){var _0x538845=_0x18d3af[_0xa586('0x4b')]({'plain':!![]});var _0x5675a0=_0xa586('0x4e');return db[_0xa586('0x4f')][_0xa586('0x47')]({'where':{'name':_0x5675a0,'userProfileId':_0xe35d80[_0xa586('0x50')]},'raw':!![]})[_0xa586('0x27')](function(_0x10c6a6){if(_0x10c6a6&&_0x10c6a6[_0xa586('0x51')]===0x0){return db[_0xa586('0x29')]['create']({'name':_0x538845[_0xa586('0x2b')],'resourceId':_0x538845['id'],'type':_0x10c6a6[_0xa586('0x2b')],'sectionId':_0x10c6a6['id']},{})['then'](function(){return _0x18d3af;});}else{return _0x18d3af;}})[_0xa586('0x43')](function(_0x454205){logger[_0xa586('0x2a')](_0xa586('0x52'),_0x454205);throw _0x454205;});}return _0x18d3af;})['then'](respondWithResult(_0xaa9fe5,0xc9))['catch'](handleError(_0xaa9fe5,null));};exports['update']=function(_0x2f33c5,_0x3071f3){if(_0x2f33c5[_0xa586('0x49')]['id']){delete _0x2f33c5['body']['id'];}return db[_0xa586('0x3e')][_0xa586('0x47')]({'where':{'id':_0x2f33c5[_0xa586('0x45')]['id']}})[_0xa586('0x27')](handleEntityNotFound(_0x3071f3,null))[_0xa586('0x27')](saveUpdates(_0x2f33c5[_0xa586('0x49')],null))[_0xa586('0x27')](respondWithResult(_0x3071f3,null))[_0xa586('0x43')](handleError(_0x3071f3,null));};exports[_0xa586('0x28')]=function(_0x384013,_0x58aaf4){return db[_0xa586('0x3e')][_0xa586('0x47')]({'where':{'id':_0x384013[_0xa586('0x45')]['id']}})['then'](handleEntityNotFound(_0x58aaf4,null))['then'](removeEntity(_0x58aaf4,null))[_0xa586('0x43')](handleError(_0x58aaf4,null));}; \ No newline at end of file +var _0xb1f2=['desk.js','../../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','json','offset','limit','undefined','count','set','Content-Range','apply','reject','destroy','then','get','CmContactHasItems','UserProfileResource','error','stack','name','send','index','CmContactHasItem','rawAttributes','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','options','includeAll','include','findAll','catch','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','jsforce'];(function(_0x45a898,_0x4f5860){var _0x132a39=function(_0x33b16f){while(--_0x33b16f){_0x45a898['push'](_0x45a898['shift']());}};_0x132a39(++_0x4f5860);}(_0xb1f2,0x189));var _0x2b1f=function(_0x45d911,_0x3278e2){_0x45d911=_0x45d911-0x0;var _0x1f10c7=_0xb1f2[_0x45d911];return _0x1f10c7;};'use strict';var emlformat=require(_0x2b1f('0x0'));var rimraf=require(_0x2b1f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x2b1f('0x2'));var moment=require(_0x2b1f('0x3'));var BPromise=require(_0x2b1f('0x4'));var Mustache=require(_0x2b1f('0x5'));var util=require('util');var path=require(_0x2b1f('0x6'));var sox=require(_0x2b1f('0x7'));var csv=require(_0x2b1f('0x8'));var ejs=require(_0x2b1f('0x9'));var fs=require('fs');var fs_extra=require(_0x2b1f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2b1f('0xb'));var deskjs=require(_0x2b1f('0xc'));var toCsv=require(_0x2b1f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2b1f('0xd'));var qs=require(_0x2b1f('0xe'));var as=require(_0x2b1f('0xf'));var hardwareService=require(_0x2b1f('0x10'));var logger=require(_0x2b1f('0x11'))(_0x2b1f('0x12'));var utils=require(_0x2b1f('0x13'));var config=require(_0x2b1f('0x14'));var licenseUtil=require(_0x2b1f('0x15'));var db=require(_0x2b1f('0x16'))['db'];function respondWithStatusCode(_0x1feb3c,_0x123281){_0x123281=_0x123281||0xcc;return function(_0x327ddc){if(_0x327ddc){return _0x1feb3c[_0x2b1f('0x17')](_0x123281);}return _0x1feb3c[_0x2b1f('0x18')](_0x123281)[_0x2b1f('0x19')]();};}function respondWithResult(_0x463591,_0x246ae8){_0x246ae8=_0x246ae8||0xc8;return function(_0xb67115){if(_0xb67115){return _0x463591['status'](_0x246ae8)[_0x2b1f('0x1a')](_0xb67115);}};}function respondWithFilteredResult(_0x56f1b7,_0x448fe0){return function(_0x346fc7){if(_0x346fc7){var _0x25cbdb=typeof _0x448fe0[_0x2b1f('0x1b')]==='undefined'&&typeof _0x448fe0[_0x2b1f('0x1c')]===_0x2b1f('0x1d');var _0x3cc442=_0x346fc7[_0x2b1f('0x1e')];var _0x2f583a=_0x25cbdb?0x0:_0x448fe0[_0x2b1f('0x1b')];var _0x2a05ae=_0x25cbdb?_0x346fc7[_0x2b1f('0x1e')]:_0x448fe0[_0x2b1f('0x1b')]+_0x448fe0[_0x2b1f('0x1c')];var _0x34c4cb;if(_0x2a05ae>=_0x3cc442){_0x2a05ae=_0x3cc442;_0x34c4cb=0xc8;}else{_0x34c4cb=0xce;}_0x56f1b7[_0x2b1f('0x18')](_0x34c4cb);return _0x56f1b7[_0x2b1f('0x1f')](_0x2b1f('0x20'),_0x2f583a+'-'+_0x2a05ae+'/'+_0x3cc442)['json'](_0x346fc7);}return null;};}function patchUpdates(_0x806dc7){return function(_0x218446){try{jsonpatch[_0x2b1f('0x21')](_0x218446,_0x806dc7,!![]);}catch(_0x487acd){return BPromise[_0x2b1f('0x22')](_0x487acd);}return _0x218446['save']();};}function saveUpdates(_0x12b78d,_0x1e529b){return function(_0x479971){if(_0x479971){return _0x479971['update'](_0x12b78d)['then'](function(_0x18e999){return _0x18e999;});}return null;};}function removeEntity(_0x14b370,_0x35717d){return function(_0x58342a){if(_0x58342a){return _0x58342a[_0x2b1f('0x23')]()[_0x2b1f('0x24')](function(){var _0x1abda0=_0x58342a[_0x2b1f('0x25')]({'plain':!![]});var _0x49eca2=_0x2b1f('0x26');return db[_0x2b1f('0x27')]['destroy']({'where':{'type':_0x49eca2,'resourceId':_0x1abda0['id']}})[_0x2b1f('0x24')](function(){return _0x58342a;});})[_0x2b1f('0x24')](function(){_0x14b370[_0x2b1f('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x32b4cd,_0x3e2feb){return function(_0x373130){if(!_0x373130){_0x32b4cd['sendStatus'](0x194);}return _0x373130;};}function handleError(_0x5f0f73,_0x5be0ae){_0x5be0ae=_0x5be0ae||0x1f4;return function(_0x42665d){logger[_0x2b1f('0x28')](_0x42665d[_0x2b1f('0x29')]);if(_0x42665d[_0x2b1f('0x2a')]){delete _0x42665d[_0x2b1f('0x2a')];}_0x5f0f73[_0x2b1f('0x18')](_0x5be0ae)[_0x2b1f('0x2b')](_0x42665d);};}exports[_0x2b1f('0x2c')]=function(_0x5ed48e,_0x575a13){var _0x3b7072={},_0x3cdd39={},_0xd7d440={'count':0x0,'rows':[]};var _0xc3b545=_['map'](db[_0x2b1f('0x2d')][_0x2b1f('0x2e')],function(_0x29e819){return{'name':_0x29e819['fieldName'],'type':_0x29e819['type'][_0x2b1f('0x2f')]};});_0x3cdd39[_0x2b1f('0x30')]=_[_0x2b1f('0x31')](_0xc3b545,_0x2b1f('0x2a'));_0x3cdd39[_0x2b1f('0x32')]=_['keys'](_0x5ed48e['query']);_0x3cdd39[_0x2b1f('0x33')]=_[_0x2b1f('0x34')](_0x3cdd39[_0x2b1f('0x30')],_0x3cdd39[_0x2b1f('0x32')]);_0x3b7072[_0x2b1f('0x35')]=_['intersection'](_0x3cdd39[_0x2b1f('0x30')],qs[_0x2b1f('0x36')](_0x5ed48e[_0x2b1f('0x32')][_0x2b1f('0x36')]));_0x3b7072[_0x2b1f('0x35')]=_0x3b7072[_0x2b1f('0x35')][_0x2b1f('0x37')]?_0x3b7072[_0x2b1f('0x35')]:_0x3cdd39[_0x2b1f('0x30')];if(!_0x5ed48e[_0x2b1f('0x32')][_0x2b1f('0x38')](_0x2b1f('0x39'))){_0x3b7072['limit']=qs['limit'](_0x5ed48e[_0x2b1f('0x32')][_0x2b1f('0x1c')]);_0x3b7072[_0x2b1f('0x1b')]=qs['offset'](_0x5ed48e[_0x2b1f('0x32')][_0x2b1f('0x1b')]);}_0x3b7072[_0x2b1f('0x3a')]=qs[_0x2b1f('0x3b')](_0x5ed48e[_0x2b1f('0x32')]['sort']);_0x3b7072[_0x2b1f('0x3c')]=qs[_0x2b1f('0x33')](_['pick'](_0x5ed48e[_0x2b1f('0x32')],_0x3cdd39[_0x2b1f('0x33')]),_0xc3b545);if(_0x5ed48e[_0x2b1f('0x32')][_0x2b1f('0x3d')]){_0x3b7072[_0x2b1f('0x3c')]=_[_0x2b1f('0x3e')](_0x3b7072['where'],{'$or':_[_0x2b1f('0x31')](_0xc3b545,function(_0x41e1c9){if(_0x41e1c9[_0x2b1f('0x3f')]!=='VIRTUAL'){var _0x58f3b6={};_0x58f3b6[_0x41e1c9[_0x2b1f('0x2a')]]={'$like':'%'+_0x5ed48e[_0x2b1f('0x32')][_0x2b1f('0x3d')]+'%'};return _0x58f3b6;}})});}_0x3b7072=_[_0x2b1f('0x3e')]({},_0x3b7072,_0x5ed48e[_0x2b1f('0x40')]);var _0x51b0d2={'where':_0x3b7072['where']};return db[_0x2b1f('0x2d')][_0x2b1f('0x1e')](_0x51b0d2)[_0x2b1f('0x24')](function(_0x14b106){_0xd7d440['count']=_0x14b106;if(_0x5ed48e['query'][_0x2b1f('0x41')]){_0x3b7072[_0x2b1f('0x42')]=[{'all':!![]}];}return db[_0x2b1f('0x2d')][_0x2b1f('0x43')](_0x3b7072);})[_0x2b1f('0x24')](function(_0x323dff){_0xd7d440['rows']=_0x323dff;return _0xd7d440;})[_0x2b1f('0x24')](respondWithFilteredResult(_0x575a13,_0x3b7072))[_0x2b1f('0x44')](handleError(_0x575a13,null));};exports['show']=function(_0x261677,_0x1daaac){var _0x154678={'raw':!![],'where':{'id':_0x261677['params']['id']}},_0x4c69de={};_0x4c69de[_0x2b1f('0x30')]=_[_0x2b1f('0x45')](db[_0x2b1f('0x2d')][_0x2b1f('0x2e')]);_0x4c69de[_0x2b1f('0x32')]=_[_0x2b1f('0x45')](_0x261677['query']);_0x4c69de['filters']=_['intersection'](_0x4c69de[_0x2b1f('0x30')],_0x4c69de[_0x2b1f('0x32')]);_0x154678[_0x2b1f('0x35')]=_[_0x2b1f('0x34')](_0x4c69de[_0x2b1f('0x30')],qs[_0x2b1f('0x36')](_0x261677[_0x2b1f('0x32')][_0x2b1f('0x36')]));_0x154678[_0x2b1f('0x35')]=_0x154678[_0x2b1f('0x35')][_0x2b1f('0x37')]?_0x154678[_0x2b1f('0x35')]:_0x4c69de['model'];if(_0x261677[_0x2b1f('0x32')][_0x2b1f('0x41')]){_0x154678[_0x2b1f('0x42')]=[{'all':!![]}];}_0x154678=_[_0x2b1f('0x3e')]({},_0x154678,_0x261677[_0x2b1f('0x40')]);return db[_0x2b1f('0x2d')][_0x2b1f('0x46')](_0x154678)[_0x2b1f('0x24')](handleEntityNotFound(_0x1daaac,null))['then'](respondWithResult(_0x1daaac,null))[_0x2b1f('0x44')](handleError(_0x1daaac,null));};exports[_0x2b1f('0x47')]=function(_0x5515cb,_0x1550a3){return db[_0x2b1f('0x2d')]['create'](_0x5515cb[_0x2b1f('0x48')],{})['then'](function(_0x45c522){var _0x2ab036=_0x5515cb[_0x2b1f('0x49')][_0x2b1f('0x25')]({'plain':!![]});if(!_0x2ab036)throw new Error(_0x2b1f('0x4a'));if(_0x2ab036[_0x2b1f('0x4b')]===_0x2b1f('0x49')){var _0x1f6b8a=_0x45c522[_0x2b1f('0x25')]({'plain':!![]});var _0x30f314='CmContactHasItems';return db[_0x2b1f('0x4c')][_0x2b1f('0x46')]({'where':{'name':_0x30f314,'userProfileId':_0x2ab036[_0x2b1f('0x4d')]},'raw':!![]})[_0x2b1f('0x24')](function(_0x7cd830){if(_0x7cd830&&_0x7cd830['autoAssociation']===0x0){return db['UserProfileResource'][_0x2b1f('0x47')]({'name':_0x1f6b8a['name'],'resourceId':_0x1f6b8a['id'],'type':_0x7cd830[_0x2b1f('0x2a')],'sectionId':_0x7cd830['id']},{})[_0x2b1f('0x24')](function(){return _0x45c522;});}else{return _0x45c522;}})['catch'](function(_0x43debd){logger['error'](_0x2b1f('0x4e'),_0x43debd);throw _0x43debd;});}return _0x45c522;})['then'](respondWithResult(_0x1550a3,0xc9))[_0x2b1f('0x44')](handleError(_0x1550a3,null));};exports[_0x2b1f('0x4f')]=function(_0x1ae54b,_0x59815a){if(_0x1ae54b[_0x2b1f('0x48')]['id']){delete _0x1ae54b[_0x2b1f('0x48')]['id'];}return db[_0x2b1f('0x2d')][_0x2b1f('0x46')]({'where':{'id':_0x1ae54b[_0x2b1f('0x50')]['id']}})[_0x2b1f('0x24')](handleEntityNotFound(_0x59815a,null))[_0x2b1f('0x24')](saveUpdates(_0x1ae54b[_0x2b1f('0x48')],null))['then'](respondWithResult(_0x59815a,null))['catch'](handleError(_0x59815a,null));};exports['destroy']=function(_0x45bfa9,_0xd7cfb2){return db[_0x2b1f('0x2d')]['find']({'where':{'id':_0x45bfa9[_0x2b1f('0x50')]['id']}})[_0x2b1f('0x24')](handleEntityNotFound(_0xd7cfb2,null))[_0x2b1f('0x24')](removeEntity(_0xd7cfb2,null))[_0x2b1f('0x44')](handleError(_0xd7cfb2,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 84ceccf..faf061e 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 _0xa6da=['./cmContactHasItem.attributes','exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa6da,0x13d));var _0xaa6d=function(_0x5cfc40,_0x421f58){_0x5cfc40=_0x5cfc40-0x0;var _0x1f9716=_0xa6da[_0x5cfc40];return _0x1f9716;};'use strict';var _=require(_0xaa6d('0x0'));var util=require(_0xaa6d('0x1'));var logger=require(_0xaa6d('0x2'))('api');var moment=require('moment');var BPromise=require(_0xaa6d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaa6d('0x4'));var rimraf=require(_0xaa6d('0x5'));var config=require(_0xaa6d('0x6'));var attributes=require(_0xaa6d('0x7'));module[_0xaa6d('0x8')]=function(_0x41f7ea,_0x35e514){return _0x41f7ea[_0xaa6d('0x9')](_0xaa6d('0xa'),attributes,{'tableName':_0xaa6d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa65f=['moment','bluebird','request-promise','path','../../config/environment','./cmContactHasItem.attributes','exports','CmContactHasItem','cm_contact_has_items','lodash','util','../../config/logger','api'];(function(_0x57d6f6,_0x322ead){var _0x47f438=function(_0xac66fb){while(--_0xac66fb){_0x57d6f6['push'](_0x57d6f6['shift']());}};_0x47f438(++_0x322ead);}(_0xa65f,0xcc));var _0xfa65=function(_0x369289,_0x1ceef4){_0x369289=_0x369289-0x0;var _0x392ed2=_0xa65f[_0x369289];return _0x392ed2;};'use strict';var _=require(_0xfa65('0x0'));var util=require(_0xfa65('0x1'));var logger=require(_0xfa65('0x2'))(_0xfa65('0x3'));var moment=require(_0xfa65('0x4'));var BPromise=require(_0xfa65('0x5'));var rp=require(_0xfa65('0x6'));var fs=require('fs');var path=require(_0xfa65('0x7'));var rimraf=require('rimraf');var config=require(_0xfa65('0x8'));var attributes=require(_0xfa65('0x9'));module[_0xfa65('0xa')]=function(_0x1dc229,_0x59e62c){return _0x1dc229['define'](_0xfa65('0xb'),attributes,{'tableName':_0xfa65('0xc'),'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 4128f8d..30e3b26 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 _0x6c60=['ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','randomstring'];(function(_0x30c93d,_0x1e3bb7){var _0x4d9f45=function(_0xe268eb){while(--_0xe268eb){_0x30c93d['push'](_0x30c93d['shift']());}};_0x4d9f45(++_0x1e3bb7);}(_0x6c60,0xd0));var _0x06c6=function(_0x3f0b30,_0x159bc8){_0x3f0b30=_0x3f0b30-0x0;var _0x2748a5=_0x6c60[_0x3f0b30];return _0x2748a5;};'use strict';var _=require('lodash');var util=require(_0x06c6('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x06c6('0x1'));var fs=require('fs');var Redis=require(_0x06c6('0x2'));var db=require(_0x06c6('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x06c6('0x4'));var config=require('../../config/environment');var jayson=require(_0x06c6('0x5'));var client=jayson[_0x06c6('0x6')][_0x06c6('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x108321,_0x9c02b2,_0x2a115c){return new BPromise(function(_0x2909d0,_0x1bedfc){return client[_0x06c6('0x8')](_0x108321,_0x2a115c)[_0x06c6('0x9')](function(_0x2ae12b){logger[_0x06c6('0xa')](_0x06c6('0xb'),_0x9c02b2,'request\x20sent');logger[_0x06c6('0xc')](_0x06c6('0xd'),_0x9c02b2,_0x06c6('0xe'),JSON[_0x06c6('0xf')](_0x2ae12b));if(_0x2ae12b[_0x06c6('0x10')]){if(_0x2ae12b[_0x06c6('0x10')][_0x06c6('0x11')]===0x1f4){logger[_0x06c6('0x10')]('CmContactHasItem,\x20%s,\x20%s',_0x9c02b2,_0x2ae12b[_0x06c6('0x10')]['message']);return _0x1bedfc(_0x2ae12b[_0x06c6('0x10')][_0x06c6('0x12')]);}logger[_0x06c6('0x10')](_0x06c6('0xb'),_0x9c02b2,_0x2ae12b[_0x06c6('0x10')]['message']);return _0x2909d0(_0x2ae12b[_0x06c6('0x10')]['message']);}else{logger[_0x06c6('0xa')](_0x06c6('0xb'),_0x9c02b2,_0x06c6('0xe'));_0x2909d0(_0x2ae12b[_0x06c6('0x13')]['message']);}})[_0x06c6('0x14')](function(_0x1e2714){logger['error'](_0x06c6('0xb'),_0x9c02b2,_0x1e2714);_0x1bedfc(_0x1e2714);});});} \ No newline at end of file +var _0x4c22=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5def17,_0x30c9b3){var _0x1389db=function(_0x30a7ec){while(--_0x30a7ec){_0x5def17['push'](_0x5def17['shift']());}};_0x1389db(++_0x30c9b3);}(_0x4c22,0x1bd));var _0x24c2=function(_0x109946,_0x3a7335){_0x109946=_0x109946-0x0;var _0xd7868a=_0x4c22[_0x109946];return _0xd7868a;};'use strict';var _=require(_0x24c2('0x0'));var util=require(_0x24c2('0x1'));var moment=require(_0x24c2('0x2'));var BPromise=require(_0x24c2('0x3'));var rs=require(_0x24c2('0x4'));var fs=require('fs');var Redis=require(_0x24c2('0x5'));var db=require(_0x24c2('0x6'))['db'];var utils=require(_0x24c2('0x7'));var logger=require(_0x24c2('0x8'))('rpc');var config=require(_0x24c2('0x9'));var jayson=require(_0x24c2('0xa'));var client=jayson[_0x24c2('0xb')][_0x24c2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26e387,_0x3c92a3,_0x1551f0){return new BPromise(function(_0x1e84dc,_0x579a12){return client[_0x24c2('0xd')](_0x26e387,_0x1551f0)[_0x24c2('0xe')](function(_0x1cbe37){logger[_0x24c2('0xf')](_0x24c2('0x10'),_0x3c92a3,_0x24c2('0x11'));logger[_0x24c2('0x12')](_0x24c2('0x13'),_0x3c92a3,'request\x20sent',JSON[_0x24c2('0x14')](_0x1cbe37));if(_0x1cbe37[_0x24c2('0x15')]){if(_0x1cbe37[_0x24c2('0x15')][_0x24c2('0x16')]===0x1f4){logger[_0x24c2('0x15')](_0x24c2('0x10'),_0x3c92a3,_0x1cbe37[_0x24c2('0x15')][_0x24c2('0x17')]);return _0x579a12(_0x1cbe37[_0x24c2('0x15')][_0x24c2('0x17')]);}logger[_0x24c2('0x15')](_0x24c2('0x10'),_0x3c92a3,_0x1cbe37[_0x24c2('0x15')]['message']);return _0x1e84dc(_0x1cbe37[_0x24c2('0x15')][_0x24c2('0x17')]);}else{logger['info'](_0x24c2('0x10'),_0x3c92a3,'request\x20sent');_0x1e84dc(_0x1cbe37[_0x24c2('0x18')][_0x24c2('0x17')]);}})[_0x24c2('0x19')](function(_0x5e2186){logger['error']('CmContactHasItem,\x20%s,\x20%s',_0x3c92a3,_0x5e2186);_0x579a12(_0x5e2186);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index 7ae2771..e6deee7 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 _0x76d8=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','multer','util'];(function(_0xe3430,_0x118fdf){var _0xbfe94b=function(_0xa3decd){while(--_0xa3decd){_0xe3430['push'](_0xe3430['shift']());}};_0xbfe94b(++_0x118fdf);}(_0x76d8,0xbc));var _0x876d=function(_0x514f19,_0x5d9b97){_0x514f19=_0x514f19-0x0;var _0x3706e1=_0x76d8[_0x514f19];return _0x3706e1;};'use strict';var multer=require(_0x876d('0x0'));var util=require(_0x876d('0x1'));var path=require(_0x876d('0x2'));var timeout=require(_0x876d('0x3'));var express=require('express');var router=express[_0x876d('0x4')]();var fs_extra=require(_0x876d('0x5'));var auth=require(_0x876d('0x6'));var interaction=require(_0x876d('0x7'));var config=require('../../config/environment');var controller=require(_0x876d('0x8'));router[_0x876d('0x9')]('/',auth[_0x876d('0xa')](),controller[_0x876d('0xb')]);router[_0x876d('0x9')](_0x876d('0xc'),auth[_0x876d('0xa')](),controller[_0x876d('0xd')]);router[_0x876d('0xe')]('/',auth[_0x876d('0xa')](),controller[_0x876d('0xf')]);router[_0x876d('0x10')]('/:id',auth[_0x876d('0xa')](),controller[_0x876d('0x11')]);router['delete'](_0x876d('0xc'),auth[_0x876d('0xa')](),controller[_0x876d('0x12')]);module['exports']=router; \ No newline at end of file +var _0xcdb4=['isAuthenticated','create','put','update','delete','exports','multer','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','/:id','show'];(function(_0x4c0adc,_0xd5df5d){var _0x442979=function(_0x3a70b7){while(--_0x3a70b7){_0x4c0adc['push'](_0x4c0adc['shift']());}};_0x442979(++_0xd5df5d);}(_0xcdb4,0x1f3));var _0x4cdb=function(_0x37cc92,_0x373e27){_0x37cc92=_0x37cc92-0x0;var _0x20266c=_0xcdb4[_0x37cc92];return _0x20266c;};'use strict';var multer=require(_0x4cdb('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4cdb('0x1'));var router=express[_0x4cdb('0x2')]();var fs_extra=require(_0x4cdb('0x3'));var auth=require(_0x4cdb('0x4'));var interaction=require(_0x4cdb('0x5'));var config=require(_0x4cdb('0x6'));var controller=require(_0x4cdb('0x7'));router[_0x4cdb('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x4cdb('0x9'),auth['isAuthenticated'](),controller[_0x4cdb('0xa')]);router['post']('/',auth[_0x4cdb('0xb')](),controller[_0x4cdb('0xc')]);router[_0x4cdb('0xd')](_0x4cdb('0x9'),auth[_0x4cdb('0xb')](),controller[_0x4cdb('0xe')]);router[_0x4cdb('0xf')]('/:id',auth[_0x4cdb('0xb')](),controller['destroy']);module[_0x4cdb('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 60826b5..c621d25 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 _0x09bf=['TEXT','type','parse','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL','alias','STRING','setDataValue','getDataValue','name'];(function(_0x231e16,_0x67347b){var _0x570a7c=function(_0x2c35b4){while(--_0x2c35b4){_0x231e16['push'](_0x231e16['shift']());}};_0x570a7c(++_0x67347b);}(_0x09bf,0x195));var _0xf09b=function(_0x11ca06,_0x239d8b){_0x11ca06=_0x11ca06-0x0;var _0x41d8fb=_0x09bf[_0x11ca06];return _0x41d8fb;};'use strict';var Sequelize=require(_0xf09b('0x0'));var _=require(_0xf09b('0x1'));module[_0xf09b('0x2')]={'name':{'type':Sequelize[_0xf09b('0x3')],'get':function(_0x404555){return this['getDataValue'](_0xf09b('0x4'));}},'alias':{'type':Sequelize[_0xf09b('0x5')],'allowNull':![],'set':function(_0x25958a){this[_0xf09b('0x6')](_0xf09b('0x4'),_0x25958a?_0x25958a:this[_0xf09b('0x7')](_0xf09b('0x8')));}},'type':{'type':Sequelize[_0xf09b('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0xf09b('0x9')]('long'),'get':function(){if(this[_0xf09b('0x7')](_0xf09b('0xa'))==='select'){return JSON[_0xf09b('0xb')](this[_0xf09b('0x7')](_0xf09b('0xc')));}else{return this[_0xf09b('0x7')]('values');}},'set':function(_0x8be632){if(Array[_0xf09b('0xd')](_0x8be632)){this[_0xf09b('0x6')](_0xf09b('0xc'),JSON[_0xf09b('0xe')](_0x8be632));}else{this[_0xf09b('0x6')]('values',_0x8be632);}}},'required':{'type':Sequelize[_0xf09b('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0xf09b('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0xf09b('0x10')](_0xf09b('0x11'))}}; \ No newline at end of file +var _0x2364=['parse','isArray','values','stringify','BOOLEAN','ENUM','lodash','exports','alias','STRING','setDataValue','getDataValue','name','TEXT','long','type','select'];(function(_0x5dbacd,_0x12a43e){var _0x1125a2=function(_0x55ef64){while(--_0x55ef64){_0x5dbacd['push'](_0x5dbacd['shift']());}};_0x1125a2(++_0x12a43e);}(_0x2364,0xb0));var _0x4236=function(_0x393082,_0x1941c7){_0x393082=_0x393082-0x0;var _0x38e90e=_0x2364[_0x393082];return _0x38e90e;};'use strict';var Sequelize=require('sequelize');var _=require(_0x4236('0x0'));module[_0x4236('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2413d7){return this['getDataValue'](_0x4236('0x2'));}},'alias':{'type':Sequelize[_0x4236('0x3')],'allowNull':![],'set':function(_0x23ff43){this[_0x4236('0x4')](_0x4236('0x2'),_0x23ff43?_0x23ff43:this[_0x4236('0x5')](_0x4236('0x6')));}},'type':{'type':Sequelize[_0x4236('0x3')],'allowNull':![]},'values':{'type':Sequelize[_0x4236('0x7')](_0x4236('0x8')),'get':function(){if(this['getDataValue'](_0x4236('0x9'))===_0x4236('0xa')){return JSON[_0x4236('0xb')](this['getDataValue']('values'));}else{return this[_0x4236('0x5')]('values');}},'set':function(_0x29c2f5){if(Array[_0x4236('0xc')](_0x29c2f5)){this[_0x4236('0x4')](_0x4236('0xd'),JSON[_0x4236('0xe')](_0x29c2f5));}else{this[_0x4236('0x4')]('values',_0x29c2f5);}}},'required':{'type':Sequelize[_0x4236('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x4236('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x4236('0x10')]('voice')}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 23a2e34..d702b0a 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 _0x9971=['nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','body','create','sequelize','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','index','CmCustomField','type','key','differenceBy','keys','filters','intersection','model','query','fields','attributes','length'];(function(_0xd86ce5,_0xb30ee8){var _0x2b114b=function(_0x1caff3){while(--_0x1caff3){_0xd86ce5['push'](_0xd86ce5['shift']());}};_0x2b114b(++_0xb30ee8);}(_0x9971,0xcc));var _0x1997=function(_0x403ece,_0x3e9f1e){_0x403ece=_0x403ece-0x0;var _0x248976=_0x9971[_0x403ece];return _0x248976;};'use strict';var emlformat=require(_0x1997('0x0'));var rimraf=require(_0x1997('0x1'));var zipdir=require(_0x1997('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1997('0x3'));var moment=require(_0x1997('0x4'));var BPromise=require(_0x1997('0x5'));var Mustache=require(_0x1997('0x6'));var util=require('util');var path=require('path');var sox=require(_0x1997('0x7'));var csv=require(_0x1997('0x8'));var ejs=require(_0x1997('0x9'));var fs=require('fs');var fs_extra=require(_0x1997('0xa'));var _=require('lodash');var squel=require(_0x1997('0xb'));var crypto=require('crypto');var jsforce=require(_0x1997('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x1997('0x8'));var querystring=require(_0x1997('0xd'));var Papa=require(_0x1997('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x1997('0xf'));var as=require(_0x1997('0x10'));var hardwareService=require(_0x1997('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0x1997('0x12'));var config=require(_0x1997('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x1997('0x14'))['db'];function respondWithStatusCode(_0x17984e,_0x535a5a){_0x535a5a=_0x535a5a||0xcc;return function(_0x1b4ae8){if(_0x1b4ae8){return _0x17984e[_0x1997('0x15')](_0x535a5a);}return _0x17984e[_0x1997('0x16')](_0x535a5a)[_0x1997('0x17')]();};}function respondWithResult(_0x37c9f2,_0x41c605){_0x41c605=_0x41c605||0xc8;return function(_0x32bd02){if(_0x32bd02){return _0x37c9f2[_0x1997('0x16')](_0x41c605)[_0x1997('0x18')](_0x32bd02);}};}function respondWithFilteredResult(_0x261668,_0x5a427c){return function(_0x24c36c){if(_0x24c36c){var _0x16f6c4=typeof _0x5a427c['offset']===_0x1997('0x19')&&typeof _0x5a427c[_0x1997('0x1a')]===_0x1997('0x19');var _0x25f83f=_0x24c36c[_0x1997('0x1b')];var _0x5c3385=_0x16f6c4?0x0:_0x5a427c[_0x1997('0x1c')];var _0x4261ac=_0x16f6c4?_0x24c36c['count']:_0x5a427c[_0x1997('0x1c')]+_0x5a427c[_0x1997('0x1a')];var _0x55f439;if(_0x4261ac>=_0x25f83f){_0x4261ac=_0x25f83f;_0x55f439=0xc8;}else{_0x55f439=0xce;}_0x261668[_0x1997('0x16')](_0x55f439);return _0x261668[_0x1997('0x1d')](_0x1997('0x1e'),_0x5c3385+'-'+_0x4261ac+'/'+_0x25f83f)[_0x1997('0x18')](_0x24c36c);}return null;};}function patchUpdates(_0x1752f4){return function(_0x4679ed){try{jsonpatch[_0x1997('0x1f')](_0x4679ed,_0x1752f4,!![]);}catch(_0xb70035){return BPromise[_0x1997('0x20')](_0xb70035);}return _0x4679ed[_0x1997('0x21')]();};}function saveUpdates(_0x500f9d,_0x425738){return function(_0x88f3bc){if(_0x88f3bc){return _0x88f3bc[_0x1997('0x22')](_0x500f9d)[_0x1997('0x23')](function(_0x2d2b53){return _0x2d2b53;});}return null;};}function removeEntity(_0x336eec,_0x474317){return function(_0xe2228a){if(_0xe2228a){return _0xe2228a[_0x1997('0x24')]()['then'](function(){_0x336eec[_0x1997('0x16')](0xcc)[_0x1997('0x17')]();});}};}function handleEntityNotFound(_0x5e5e86,_0x4da48d){return function(_0x353120){if(!_0x353120){_0x5e5e86[_0x1997('0x15')](0x194);}return _0x353120;};}function handleError(_0x6829f0,_0x539a45){_0x539a45=_0x539a45||0x1f4;return function(_0xb4f9d){logger['error'](_0xb4f9d['stack']);if(_0xb4f9d['name']){delete _0xb4f9d[_0x1997('0x25')];}_0x6829f0[_0x1997('0x16')](_0x539a45)['send'](_0xb4f9d);};}exports[_0x1997('0x26')]=function(_0x3d9d2a,_0x41a32d){var _0x309d9f={},_0x51d6a1={},_0x44fa02={'count':0x0,'rows':[]};var _0x203fb0=_['map'](db[_0x1997('0x27')]['rawAttributes'],function(_0x3b7f4c){return{'name':_0x3b7f4c['fieldName'],'type':_0x3b7f4c[_0x1997('0x28')][_0x1997('0x29')]};});_0x51d6a1['model']=_[_0x1997('0x2a')](_['map'](_0x203fb0,_0x1997('0x25')),[_0x1997('0x25')]);_0x51d6a1['query']=_[_0x1997('0x2b')](_0x3d9d2a['query']);_0x51d6a1[_0x1997('0x2c')]=_[_0x1997('0x2d')](_0x51d6a1[_0x1997('0x2e')],_0x51d6a1[_0x1997('0x2f')]);_0x309d9f['attributes']=_[_0x1997('0x2d')](_0x51d6a1[_0x1997('0x2e')],qs[_0x1997('0x30')](_0x3d9d2a[_0x1997('0x2f')][_0x1997('0x30')]));_0x309d9f[_0x1997('0x31')]=_0x309d9f[_0x1997('0x31')][_0x1997('0x32')]?_0x309d9f[_0x1997('0x31')]:_0x51d6a1[_0x1997('0x2e')];if(!_0x3d9d2a[_0x1997('0x2f')]['hasOwnProperty'](_0x1997('0x33'))){_0x309d9f['limit']=qs['limit'](_0x3d9d2a['query'][_0x1997('0x1a')]);_0x309d9f['offset']=qs['offset'](_0x3d9d2a[_0x1997('0x2f')][_0x1997('0x1c')]);}_0x309d9f[_0x1997('0x34')]=qs[_0x1997('0x35')](_0x3d9d2a[_0x1997('0x2f')][_0x1997('0x35')]);_0x309d9f['where']=qs['filters'](_['pick'](_0x3d9d2a[_0x1997('0x2f')],_0x51d6a1[_0x1997('0x2c')]),_0x203fb0);if(_0x3d9d2a[_0x1997('0x2f')][_0x1997('0x36')]){_0x309d9f[_0x1997('0x37')]=_[_0x1997('0x38')](_0x309d9f[_0x1997('0x37')],{'$or':_['map'](_0x203fb0,function(_0x31ed87){if(_0x31ed87[_0x1997('0x28')]!==_0x1997('0x39')){var _0x222c1={};_0x222c1[_0x31ed87[_0x1997('0x25')]]={'$like':'%'+_0x3d9d2a[_0x1997('0x2f')][_0x1997('0x36')]+'%'};return _0x222c1;}})});}_0x309d9f=_[_0x1997('0x38')]({},_0x309d9f,_0x3d9d2a[_0x1997('0x3a')]);var _0x5861d0={'where':_0x309d9f[_0x1997('0x37')]};return db[_0x1997('0x27')][_0x1997('0x1b')](_0x5861d0)[_0x1997('0x23')](function(_0x4d289d){_0x44fa02['count']=_0x4d289d;if(_0x3d9d2a['query'][_0x1997('0x3b')]){_0x309d9f[_0x1997('0x3c')]=[{'all':!![]}];}return db[_0x1997('0x27')][_0x1997('0x3d')](_0x309d9f);})[_0x1997('0x23')](function(_0x215a0b){_0x44fa02[_0x1997('0x3e')]=_0x215a0b;return _0x44fa02;})[_0x1997('0x23')](respondWithFilteredResult(_0x41a32d,_0x309d9f))[_0x1997('0x3f')](handleError(_0x41a32d,null));};exports[_0x1997('0x40')]=function(_0x320f86,_0x1c0d20){var _0x1dbb85={'raw':!![],'where':{'id':_0x320f86[_0x1997('0x41')]['id']}},_0xb5e5f0={};_0xb5e5f0[_0x1997('0x2e')]=_[_0x1997('0x2b')](db[_0x1997('0x27')][_0x1997('0x42')]);_0xb5e5f0['query']=_[_0x1997('0x2b')](_0x320f86[_0x1997('0x2f')]);_0xb5e5f0['filters']=_[_0x1997('0x2d')](_0xb5e5f0[_0x1997('0x2e')],_0xb5e5f0[_0x1997('0x2f')]);_0x1dbb85['attributes']=_[_0x1997('0x2d')](_0xb5e5f0[_0x1997('0x2e')],qs[_0x1997('0x30')](_0x320f86[_0x1997('0x2f')][_0x1997('0x30')]));_0x1dbb85[_0x1997('0x31')]=_0x1dbb85[_0x1997('0x31')][_0x1997('0x32')]?_0x1dbb85[_0x1997('0x31')]:_0xb5e5f0['model'];if(_0x320f86[_0x1997('0x2f')][_0x1997('0x3b')]){_0x1dbb85[_0x1997('0x3c')]=[{'all':!![]}];}_0x1dbb85=_[_0x1997('0x38')]({},_0x1dbb85,_0x320f86[_0x1997('0x3a')]);return db['CmCustomField'][_0x1997('0x43')](_0x1dbb85)[_0x1997('0x23')](handleEntityNotFound(_0x1c0d20,null))[_0x1997('0x23')](respondWithResult(_0x1c0d20,null))[_0x1997('0x3f')](handleError(_0x1c0d20,null));};exports['update']=function(_0x2d436a,_0x4c20e9){if(_0x2d436a[_0x1997('0x44')]['id']){delete _0x2d436a[_0x1997('0x44')]['id'];}return db['CmCustomField'][_0x1997('0x43')]({'where':{'id':_0x2d436a[_0x1997('0x41')]['id']}})['then'](handleEntityNotFound(_0x4c20e9,null))[_0x1997('0x23')](saveUpdates(_0x2d436a['body'],null))[_0x1997('0x23')](respondWithResult(_0x4c20e9,null))['catch'](handleError(_0x4c20e9,null));};exports['destroy']=function(_0x58e927,_0x50b94f){return db[_0x1997('0x27')][_0x1997('0x43')]({'where':{'id':_0x58e927['params']['id']}})[_0x1997('0x23')](handleEntityNotFound(_0x50b94f,null))[_0x1997('0x23')](removeEntity(_0x50b94f,null))[_0x1997('0x3f')](handleError(_0x50b94f,null));};exports[_0x1997('0x45')]=function(_0x48ec3e,_0x912d79){var _0x3dcb7c;return db[_0x1997('0x46')][_0x1997('0x47')](function(_0x40024a){return db['CmCustomField'][_0x1997('0x45')](_0x48ec3e[_0x1997('0x44')],{'transaction':_0x40024a})['then'](function(_0x572aa4){_0x3dcb7c=_0x572aa4;var _0x10787c={'type':db[_0x1997('0x48')][_0x1997('0x49')],'transaction':_0x40024a};switch(_0x48ec3e[_0x1997('0x44')]['type']){case _0x1997('0x4a'):_0x10787c[_0x1997('0x28')]=db[_0x1997('0x48')][_0x1997('0x49')];break;case _0x1997('0x4b'):_0x10787c['type']=db['Sequelize'][_0x1997('0x4c')];break;case _0x1997('0x4d'):_0x10787c[_0x1997('0x28')]=db[_0x1997('0x48')][_0x1997('0x4e')];_0x10787c[_0x1997('0x4f')]=![];break;default:}return db[_0x1997('0x46')][_0x1997('0x50')][_0x1997('0x51')](_0x1997('0x52'),util[_0x1997('0x53')](_0x1997('0x54'),_0x3dcb7c['id']),_0x10787c);})[_0x1997('0x23')](function(){return _0x3dcb7c;});})[_0x1997('0x23')](respondWithResult(_0x912d79,0xc9))[_0x1997('0x3f')](handleError(_0x912d79,null));}; \ No newline at end of file +var _0x674e=['intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','options','CmCustomField','includeAll','include','rows','catch','merge','find','body','create','sequelize','Sequelize','TEXT','switch','BOOLEAN','addColumn','format','cf_%d','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','undefined','count','set','apply','reject','save','then','destroy','sendStatus','error','name','index','rawAttributes','fieldName','type','key','differenceBy','map','query','keys','filters'];(function(_0x458506,_0x5937e1){var _0x46395f=function(_0x33900b){while(--_0x33900b){_0x458506['push'](_0x458506['shift']());}};_0x46395f(++_0x5937e1);}(_0x674e,0x1f3));var _0xe674=function(_0x4c0091,_0x47d8d5){_0x4c0091=_0x4c0091-0x0;var _0x36b26f=_0x674e[_0x4c0091];return _0x36b26f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe674('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe674('0x1'));var rp=require(_0xe674('0x2'));var moment=require('moment');var BPromise=require(_0xe674('0x3'));var Mustache=require(_0xe674('0x4'));var util=require(_0xe674('0x5'));var path=require(_0xe674('0x6'));var sox=require(_0xe674('0x7'));var csv=require(_0xe674('0x8'));var ejs=require(_0xe674('0x9'));var fs=require('fs');var fs_extra=require(_0xe674('0xa'));var _=require(_0xe674('0xb'));var squel=require('squel');var crypto=require(_0xe674('0xc'));var jsforce=require(_0xe674('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe674('0x8'));var querystring=require(_0xe674('0xe'));var Papa=require(_0xe674('0xf'));var Redis=require(_0xe674('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe674('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe674('0x12'))(_0xe674('0x13'));var utils=require(_0xe674('0x14'));var config=require(_0xe674('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xe674('0x16'))['db'];function respondWithStatusCode(_0x3e21af,_0x19fce8){_0x19fce8=_0x19fce8||0xcc;return function(_0x8abdcc){if(_0x8abdcc){return _0x3e21af['sendStatus'](_0x19fce8);}return _0x3e21af[_0xe674('0x17')](_0x19fce8)['end']();};}function respondWithResult(_0x2c9995,_0xeccfee){_0xeccfee=_0xeccfee||0xc8;return function(_0x1a85a6){if(_0x1a85a6){return _0x2c9995[_0xe674('0x17')](_0xeccfee)[_0xe674('0x18')](_0x1a85a6);}};}function respondWithFilteredResult(_0x480377,_0x29cd8b){return function(_0x5a5783){if(_0x5a5783){var _0x171a15=typeof _0x29cd8b[_0xe674('0x19')]===_0xe674('0x1a')&&typeof _0x29cd8b['limit']===_0xe674('0x1a');var _0x3a5d3d=_0x5a5783[_0xe674('0x1b')];var _0x2f5883=_0x171a15?0x0:_0x29cd8b['offset'];var _0x57f156=_0x171a15?_0x5a5783[_0xe674('0x1b')]:_0x29cd8b[_0xe674('0x19')]+_0x29cd8b['limit'];var _0x3b2d5f;if(_0x57f156>=_0x3a5d3d){_0x57f156=_0x3a5d3d;_0x3b2d5f=0xc8;}else{_0x3b2d5f=0xce;}_0x480377[_0xe674('0x17')](_0x3b2d5f);return _0x480377[_0xe674('0x1c')]('Content-Range',_0x2f5883+'-'+_0x57f156+'/'+_0x3a5d3d)[_0xe674('0x18')](_0x5a5783);}return null;};}function patchUpdates(_0x474110){return function(_0x281744){try{jsonpatch[_0xe674('0x1d')](_0x281744,_0x474110,!![]);}catch(_0x306522){return BPromise[_0xe674('0x1e')](_0x306522);}return _0x281744[_0xe674('0x1f')]();};}function saveUpdates(_0x379057,_0x1cb720){return function(_0x3cd361){if(_0x3cd361){return _0x3cd361['update'](_0x379057)[_0xe674('0x20')](function(_0x1dfc94){return _0x1dfc94;});}return null;};}function removeEntity(_0x27830d,_0x21710d){return function(_0x56eb08){if(_0x56eb08){return _0x56eb08[_0xe674('0x21')]()[_0xe674('0x20')](function(){_0x27830d[_0xe674('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39cc7c,_0x11a9b7){return function(_0x1c560e){if(!_0x1c560e){_0x39cc7c[_0xe674('0x22')](0x194);}return _0x1c560e;};}function handleError(_0x3e62ee,_0x38f0f9){_0x38f0f9=_0x38f0f9||0x1f4;return function(_0x23ad23){logger[_0xe674('0x23')](_0x23ad23['stack']);if(_0x23ad23[_0xe674('0x24')]){delete _0x23ad23[_0xe674('0x24')];}_0x3e62ee[_0xe674('0x17')](_0x38f0f9)['send'](_0x23ad23);};}exports[_0xe674('0x25')]=function(_0x442223,_0x3abcb4){var _0x4a54e9={},_0x47ce25={},_0x3714b2={'count':0x0,'rows':[]};var _0x17c6b1=_['map'](db['CmCustomField'][_0xe674('0x26')],function(_0x1ee1d8){return{'name':_0x1ee1d8[_0xe674('0x27')],'type':_0x1ee1d8[_0xe674('0x28')][_0xe674('0x29')]};});_0x47ce25['model']=_[_0xe674('0x2a')](_[_0xe674('0x2b')](_0x17c6b1,_0xe674('0x24')),[_0xe674('0x24')]);_0x47ce25[_0xe674('0x2c')]=_[_0xe674('0x2d')](_0x442223[_0xe674('0x2c')]);_0x47ce25[_0xe674('0x2e')]=_[_0xe674('0x2f')](_0x47ce25[_0xe674('0x30')],_0x47ce25[_0xe674('0x2c')]);_0x4a54e9[_0xe674('0x31')]=_[_0xe674('0x2f')](_0x47ce25[_0xe674('0x30')],qs['fields'](_0x442223[_0xe674('0x2c')][_0xe674('0x32')]));_0x4a54e9['attributes']=_0x4a54e9[_0xe674('0x31')][_0xe674('0x33')]?_0x4a54e9[_0xe674('0x31')]:_0x47ce25['model'];if(!_0x442223[_0xe674('0x2c')][_0xe674('0x34')](_0xe674('0x35'))){_0x4a54e9[_0xe674('0x36')]=qs[_0xe674('0x36')](_0x442223[_0xe674('0x2c')][_0xe674('0x36')]);_0x4a54e9[_0xe674('0x19')]=qs[_0xe674('0x19')](_0x442223[_0xe674('0x2c')][_0xe674('0x19')]);}_0x4a54e9[_0xe674('0x37')]=qs[_0xe674('0x38')](_0x442223[_0xe674('0x2c')][_0xe674('0x38')]);_0x4a54e9[_0xe674('0x39')]=qs[_0xe674('0x2e')](_[_0xe674('0x3a')](_0x442223['query'],_0x47ce25[_0xe674('0x2e')]),_0x17c6b1);if(_0x442223[_0xe674('0x2c')][_0xe674('0x3b')]){_0x4a54e9[_0xe674('0x39')]=_['merge'](_0x4a54e9[_0xe674('0x39')],{'$or':_[_0xe674('0x2b')](_0x17c6b1,function(_0x2ee0c7){if(_0x2ee0c7['type']!=='VIRTUAL'){var _0x4a2a16={};_0x4a2a16[_0x2ee0c7[_0xe674('0x24')]]={'$like':'%'+_0x442223['query'][_0xe674('0x3b')]+'%'};return _0x4a2a16;}})});}_0x4a54e9=_['merge']({},_0x4a54e9,_0x442223[_0xe674('0x3c')]);var _0x5d35c4={'where':_0x4a54e9[_0xe674('0x39')]};return db[_0xe674('0x3d')][_0xe674('0x1b')](_0x5d35c4)[_0xe674('0x20')](function(_0x2fd580){_0x3714b2[_0xe674('0x1b')]=_0x2fd580;if(_0x442223['query'][_0xe674('0x3e')]){_0x4a54e9[_0xe674('0x3f')]=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x4a54e9);})['then'](function(_0x549af2){_0x3714b2[_0xe674('0x40')]=_0x549af2;return _0x3714b2;})[_0xe674('0x20')](respondWithFilteredResult(_0x3abcb4,_0x4a54e9))[_0xe674('0x41')](handleError(_0x3abcb4,null));};exports['show']=function(_0x1c2844,_0x2cde47){var _0x70c776={'raw':!![],'where':{'id':_0x1c2844['params']['id']}},_0x3d87a3={};_0x3d87a3['model']=_[_0xe674('0x2d')](db[_0xe674('0x3d')][_0xe674('0x26')]);_0x3d87a3['query']=_[_0xe674('0x2d')](_0x1c2844[_0xe674('0x2c')]);_0x3d87a3['filters']=_[_0xe674('0x2f')](_0x3d87a3[_0xe674('0x30')],_0x3d87a3[_0xe674('0x2c')]);_0x70c776[_0xe674('0x31')]=_[_0xe674('0x2f')](_0x3d87a3[_0xe674('0x30')],qs[_0xe674('0x32')](_0x1c2844[_0xe674('0x2c')]['fields']));_0x70c776[_0xe674('0x31')]=_0x70c776[_0xe674('0x31')][_0xe674('0x33')]?_0x70c776['attributes']:_0x3d87a3[_0xe674('0x30')];if(_0x1c2844[_0xe674('0x2c')][_0xe674('0x3e')]){_0x70c776[_0xe674('0x3f')]=[{'all':!![]}];}_0x70c776=_[_0xe674('0x42')]({},_0x70c776,_0x1c2844[_0xe674('0x3c')]);return db[_0xe674('0x3d')][_0xe674('0x43')](_0x70c776)[_0xe674('0x20')](handleEntityNotFound(_0x2cde47,null))['then'](respondWithResult(_0x2cde47,null))[_0xe674('0x41')](handleError(_0x2cde47,null));};exports['update']=function(_0xee5bbf,_0x2da48b){if(_0xee5bbf['body']['id']){delete _0xee5bbf[_0xe674('0x44')]['id'];}return db['CmCustomField']['find']({'where':{'id':_0xee5bbf['params']['id']}})[_0xe674('0x20')](handleEntityNotFound(_0x2da48b,null))['then'](saveUpdates(_0xee5bbf[_0xe674('0x44')],null))[_0xe674('0x20')](respondWithResult(_0x2da48b,null))[_0xe674('0x41')](handleError(_0x2da48b,null));};exports[_0xe674('0x21')]=function(_0x2dd8ce,_0x21b3eb){return db[_0xe674('0x3d')]['find']({'where':{'id':_0x2dd8ce['params']['id']}})[_0xe674('0x20')](handleEntityNotFound(_0x21b3eb,null))[_0xe674('0x20')](removeEntity(_0x21b3eb,null))['catch'](handleError(_0x21b3eb,null));};exports[_0xe674('0x45')]=function(_0x35c53e,_0x433d72){var _0x48b607;return db[_0xe674('0x46')]['transaction'](function(_0x20838c){return db[_0xe674('0x3d')][_0xe674('0x45')](_0x35c53e[_0xe674('0x44')],{'transaction':_0x20838c})[_0xe674('0x20')](function(_0x5e28de){_0x48b607=_0x5e28de;var _0x2b2ab7={'type':db[_0xe674('0x47')][_0xe674('0x48')],'transaction':_0x20838c};switch(_0x35c53e[_0xe674('0x44')][_0xe674('0x28')]){case'text':_0x2b2ab7[_0xe674('0x28')]=db[_0xe674('0x47')][_0xe674('0x48')];break;case'number':_0x2b2ab7[_0xe674('0x28')]=db[_0xe674('0x47')]['INTEGER'];break;case _0xe674('0x49'):_0x2b2ab7[_0xe674('0x28')]=db['Sequelize'][_0xe674('0x4a')];_0x2b2ab7['defaultValue']=![];break;default:}return db[_0xe674('0x46')]['queryInterface'][_0xe674('0x4b')]('cm_contacts',util[_0xe674('0x4c')](_0xe674('0x4d'),_0x48b607['id']),_0x2b2ab7);})[_0xe674('0x20')](function(){return _0x48b607;});})[_0xe674('0x20')](respondWithResult(_0x433d72,0xc9))[_0xe674('0x41')](handleError(_0x433d72,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index b5db58a..fdc3a9f 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 _0x2ee6=['moment','bluebird','../../config/environment','./cmCustomField.attributes','CmCustomField','cm_custom_fields','lodash','util','api'];(function(_0x1f66a1,_0x15dc56){var _0x1ae463=function(_0x563131){while(--_0x563131){_0x1f66a1['push'](_0x1f66a1['shift']());}};_0x1ae463(++_0x15dc56);}(_0x2ee6,0x1ad));var _0x62ee=function(_0xa785d3,_0x23ce94){_0xa785d3=_0xa785d3-0x0;var _0x18049c=_0x2ee6[_0xa785d3];return _0x18049c;};'use strict';var _=require(_0x62ee('0x0'));var util=require(_0x62ee('0x1'));var logger=require('../../config/logger')(_0x62ee('0x2'));var moment=require(_0x62ee('0x3'));var BPromise=require(_0x62ee('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x62ee('0x5'));var attributes=require(_0x62ee('0x6'));module['exports']=function(_0x397177,_0x2b7e39){return _0x397177['define'](_0x62ee('0x7'),attributes,{'tableName':_0x62ee('0x8'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8cd4=['../../config/logger','api','moment','path','rimraf','./cmCustomField.attributes','exports','define','lodash','util'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0x8cd4,0x170));var _0x48cd=function(_0x4bf0a3,_0x375172){_0x4bf0a3=_0x4bf0a3-0x0;var _0x366e64=_0x8cd4[_0x4bf0a3];return _0x366e64;};'use strict';var _=require(_0x48cd('0x0'));var util=require(_0x48cd('0x1'));var logger=require(_0x48cd('0x2'))(_0x48cd('0x3'));var moment=require(_0x48cd('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x48cd('0x5'));var rimraf=require(_0x48cd('0x6'));var config=require('../../config/environment');var attributes=require(_0x48cd('0x7'));module[_0x48cd('0x8')]=function(_0x4be917,_0x134a2e){return _0x4be917[_0x48cd('0x9')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','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 66d9d07..501ba52 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 _0x6784=['../../config/logger','rpc','../../config/environment','client','http','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x6784,0xf6));var _0x4678=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x6784[_0x288f5e];return _0x476cc9;};'use strict';var _=require(_0x4678('0x0'));var util=require(_0x4678('0x1'));var moment=require('moment');var BPromise=require(_0x4678('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4678('0x3'));var db=require(_0x4678('0x4'))['db'];var utils=require(_0x4678('0x5'));var logger=require(_0x4678('0x6'))(_0x4678('0x7'));var config=require(_0x4678('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4678('0x9')][_0x4678('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x431d6b,_0x4a20ce,_0x9e4aea){return new BPromise(function(_0x249800,_0x11bc54){return client[_0x4678('0xb')](_0x431d6b,_0x9e4aea)['then'](function(_0x4627de){logger['info'](_0x4678('0xc'),_0x4a20ce,_0x4678('0xd'));logger[_0x4678('0xe')](_0x4678('0xf'),_0x4a20ce,_0x4678('0xd'),JSON['stringify'](_0x4627de));if(_0x4627de[_0x4678('0x10')]){if(_0x4627de[_0x4678('0x10')][_0x4678('0x11')]===0x1f4){logger[_0x4678('0x10')](_0x4678('0xc'),_0x4a20ce,_0x4627de['error']['message']);return _0x11bc54(_0x4627de[_0x4678('0x10')]['message']);}logger[_0x4678('0x10')](_0x4678('0xc'),_0x4a20ce,_0x4627de['error'][_0x4678('0x12')]);return _0x249800(_0x4627de['error'][_0x4678('0x12')]);}else{logger['info'](_0x4678('0xc'),_0x4a20ce,_0x4678('0xd'));_0x249800(_0x4627de[_0x4678('0x13')][_0x4678('0x12')]);}})[_0x4678('0x14')](function(_0x28f4d2){logger['error']('CmCustomField,\x20%s,\x20%s',_0x4a20ce,_0x28f4d2);_0x11bc54(_0x28f4d2);});});} \ No newline at end of file +var _0xd232=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','moment'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xd232,0xb3));var _0x2d23=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd232[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2d23('0x0'));var BPromise=require(_0x2d23('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2d23('0x2'));var db=require(_0x2d23('0x3'))['db'];var utils=require(_0x2d23('0x4'));var logger=require('../../config/logger')(_0x2d23('0x5'));var config=require('../../config/environment');var jayson=require(_0x2d23('0x6'));var client=jayson['client'][_0x2d23('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4d7783,_0x3a2699,_0x438cc5){return new BPromise(function(_0x55eaac,_0x1a3c48){return client['request'](_0x4d7783,_0x438cc5)['then'](function(_0xf9aa78){logger[_0x2d23('0x8')](_0x2d23('0x9'),_0x3a2699,_0x2d23('0xa'));logger[_0x2d23('0xb')](_0x2d23('0xc'),_0x3a2699,_0x2d23('0xa'),JSON['stringify'](_0xf9aa78));if(_0xf9aa78['error']){if(_0xf9aa78['error'][_0x2d23('0xd')]===0x1f4){logger[_0x2d23('0xe')](_0x2d23('0x9'),_0x3a2699,_0xf9aa78[_0x2d23('0xe')][_0x2d23('0xf')]);return _0x1a3c48(_0xf9aa78['error'][_0x2d23('0xf')]);}logger[_0x2d23('0xe')](_0x2d23('0x9'),_0x3a2699,_0xf9aa78['error'][_0x2d23('0xf')]);return _0x55eaac(_0xf9aa78[_0x2d23('0xe')][_0x2d23('0xf')]);}else{logger['info'](_0x2d23('0x9'),_0x3a2699,'request\x20sent');_0x55eaac(_0xf9aa78[_0x2d23('0x10')][_0x2d23('0xf')]);}})[_0x2d23('0x11')](function(_0x71c4c8){logger['error'](_0x2d23('0x9'),_0x3a2699,_0x71c4c8);_0x1a3c48(_0x71c4c8);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index e40bb7a..00fd269 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 _0x723e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated','index','get','/:id','show','post','put','delete','exports','util','path','connect-timeout'];(function(_0x343f78,_0x542846){var _0x224655=function(_0x10d5d4){while(--_0x10d5d4){_0x343f78['push'](_0x343f78['shift']());}};_0x224655(++_0x542846);}(_0x723e,0x179));var _0xe723=function(_0x58afb0,_0x3f5c0e){_0x58afb0=_0x58afb0-0x0;var _0x94fb03=_0x723e[_0x58afb0];return _0x94fb03;};'use strict';var multer=require('multer');var util=require(_0xe723('0x0'));var path=require(_0xe723('0x1'));var timeout=require(_0xe723('0x2'));var express=require(_0xe723('0x3'));var router=express[_0xe723('0x4')]();var fs_extra=require(_0xe723('0x5'));var auth=require(_0xe723('0x6'));var interaction=require(_0xe723('0x7'));var config=require(_0xe723('0x8'));var controller=require(_0xe723('0x9'));router['get']('/',auth[_0xe723('0xa')](),controller[_0xe723('0xb')]);router[_0xe723('0xc')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller[_0xe723('0xe')]);router[_0xe723('0xf')]('/',auth[_0xe723('0xa')](),controller['create']);router[_0xe723('0x10')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller['update']);router[_0xe723('0x11')](_0xe723('0xd'),auth[_0xe723('0xa')](),controller['destroy']);module[_0xe723('0x12')]=router; \ No newline at end of file +var _0x3c2a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer','util','connect-timeout'];(function(_0x57a6f8,_0x5d5cde){var _0x5deef8=function(_0x56cd03){while(--_0x56cd03){_0x57a6f8['push'](_0x57a6f8['shift']());}};_0x5deef8(++_0x5d5cde);}(_0x3c2a,0x1b2));var _0xa3c2=function(_0x9274f8,_0x582257){_0x9274f8=_0x9274f8-0x0;var _0x573cd7=_0x3c2a[_0x9274f8];return _0x573cd7;};'use strict';var multer=require(_0xa3c2('0x0'));var util=require(_0xa3c2('0x1'));var path=require('path');var timeout=require(_0xa3c2('0x2'));var express=require('express');var router=express[_0xa3c2('0x3')]();var fs_extra=require(_0xa3c2('0x4'));var auth=require(_0xa3c2('0x5'));var interaction=require(_0xa3c2('0x6'));var config=require(_0xa3c2('0x7'));var controller=require(_0xa3c2('0x8'));router[_0xa3c2('0x9')]('/',auth[_0xa3c2('0xa')](),controller[_0xa3c2('0xb')]);router[_0xa3c2('0x9')](_0xa3c2('0xc'),auth[_0xa3c2('0xa')](),controller[_0xa3c2('0xd')]);router[_0xa3c2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa3c2('0xf')](_0xa3c2('0xc'),auth[_0xa3c2('0xa')](),controller[_0xa3c2('0x10')]);router[_0xa3c2('0x11')]('/:id',auth[_0xa3c2('0xa')](),controller['destroy']);module[_0xa3c2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index a01419a..31dc421 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 _0x011a=['contactListQueue','moment','sequelize','DATE','format','INTEGER','BOOLEAN','STRING','UNSIGNED'];(function(_0x57c48a,_0x4f0e5a){var _0x344f74=function(_0xc0dfbc){while(--_0xc0dfbc){_0x57c48a['push'](_0x57c48a['shift']());}};_0x344f74(++_0x4f0e5a);}(_0x011a,0x91));var _0xa011=function(_0x322296,_0x57eb19){_0x322296=_0x322296-0x0;var _0x432ea7=_0x011a[_0x322296];return _0x432ea7;};'use strict';var moment=require(_0xa011('0x0'));var Sequelize=require(_0xa011('0x1'));module['exports']={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa011('0x2')],'defaultValue':moment()[_0xa011('0x3')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xa011('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa011('0x4')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa011('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xa011('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa011('0x2')]},'priority':{'type':Sequelize[_0xa011('0x4')](0x2)[_0xa011('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xa011('0x5')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa011('0x4')],'unique':_0xa011('0x8')},'ListId':{'type':Sequelize[_0xa011('0x4')],'unique':_0xa011('0x8')},'UserId':{'type':Sequelize[_0xa011('0x4')]},'VoiceQueueId':{'type':Sequelize[_0xa011('0x4')],'unique':_0xa011('0x8')},'CampaignId':{'type':Sequelize[_0xa011('0x4')]},'countnosuchnumberretry':{'type':Sequelize[_0xa011('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xa011('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa011('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa011('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa011('0x4')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0xa011('0x4')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xa011('0x6')]},'recallmeNotifiedDate':{'type':Sequelize[_0xa011('0x2')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0xb419=['DATE','UNSIGNED','contactListQueue','moment','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER'];(function(_0x1dd4ae,_0x42e514){var _0x2ff409=function(_0x3a2609){while(--_0x3a2609){_0x1dd4ae['push'](_0x1dd4ae['shift']());}};_0x2ff409(++_0x42e514);}(_0xb419,0xf6));var _0x9b41=function(_0x5d31cd,_0x1b48cd){_0x5d31cd=_0x5d31cd-0x0;var _0x38808c=_0xb419[_0x5d31cd];return _0x38808c;};'use strict';var moment=require(_0x9b41('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0x9b41('0x1')],'allowNull':![]},'active':{'type':Sequelize[_0x9b41('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x9b41('0x3')](_0x9b41('0x4'))},'countbusyretry':{'type':Sequelize[_0x9b41('0x5')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9b41('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x9b41('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9b41('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9b41('0x6')]},'priority':{'type':Sequelize[_0x9b41('0x5')](0x2)[_0x9b41('0x7')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x9b41('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x9b41('0x5')],'unique':_0x9b41('0x8')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x9b41('0x8')},'UserId':{'type':Sequelize[_0x9b41('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x9b41('0x5')],'unique':_0x9b41('0x8')},'CampaignId':{'type':Sequelize[_0x9b41('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x9b41('0x5')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9b41('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9b41('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9b41('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9b41('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x9b41('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x9b41('0x1')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'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 9e7c659..6ef6a44 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 _0xf120=['$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','include','findAll','catch','keys','rawAttributes','intersection','includeAll','find','create','body','describe','destroy','params','VoiceQueueId','CampaignId','VoiceQueue','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','ivr','CmContact','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','length','sequelize','transaction','filter','value','direction','prev','hopperIds','ASC','scheduledAt','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','isEmpty','priority','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','phone','recallme','LOCK','UPDATE','Contact','CmCompany','CmList','List','Queue','dialActive','findOne','Company','getOpenContacts','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','lodash','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','status','json','offset','limit','count','set','Content-Range','update','then','sendStatus','error','stack','name','send','index','CmHopper','fieldName','type','key','map','query','filters','model','concat','$or','$lte','$ne','$eq','$not'];(function(_0x6d4d11,_0x204d60){var _0x49c1f3=function(_0x219253){while(--_0x219253){_0x6d4d11['push'](_0x6d4d11['shift']());}};_0x49c1f3(++_0x204d60);}(_0xf120,0x179));var _0x0f12=function(_0x1ac0c9,_0x3575e9){_0x1ac0c9=_0x1ac0c9-0x0;var _0x5b60e6=_0xf120[_0x1ac0c9];return _0x5b60e6;};'use strict';var moment=require('moment');var _=require(_0x0f12('0x0'));var qs=require(_0x0f12('0x1'));var logger=require(_0x0f12('0x2'))('api');var shared=require(_0x0f12('0x3'));var db=require(_0x0f12('0x4'))['db'];function respondWithResult(_0x163c58,_0x5a263b){_0x5a263b=_0x5a263b||0xc8;return function(_0x1a4043){if(_0x1a4043){return _0x163c58[_0x0f12('0x5')](_0x5a263b)[_0x0f12('0x6')](_0x1a4043);}};}function respondWithFilteredResult(_0x308941,_0x21f951){return function(_0x341516){if(_0x341516){var _0x1f32b7=typeof _0x21f951[_0x0f12('0x7')]==='undefined'&&typeof _0x21f951[_0x0f12('0x8')]==='undefined';var _0x3b909b=_0x341516[_0x0f12('0x9')];var _0x45a714=_0x1f32b7?0x0:_0x21f951['offset'];var _0x5f158a=_0x1f32b7?_0x341516[_0x0f12('0x9')]:_0x21f951[_0x0f12('0x7')]+_0x21f951[_0x0f12('0x8')];var _0xd85187;if(_0x5f158a>=_0x3b909b){_0x5f158a=_0x3b909b;_0xd85187=0xc8;}else{_0xd85187=0xce;}_0x308941[_0x0f12('0x5')](_0xd85187);return _0x308941[_0x0f12('0xa')](_0x0f12('0xb'),_0x45a714+'-'+_0x5f158a+'/'+_0x3b909b)['json'](_0x341516);}return null;};}function saveUpdates(_0xf75042,_0x11a236){return function(_0xb80905){if(_0xb80905){return _0xb80905[_0x0f12('0xc')](_0xf75042)[_0x0f12('0xd')](function(_0xc019be){return _0xc019be;});}return null;};}function handleEntityNotFound(_0x35ef6f,_0x7f1ae7){return function(_0x215a7a){if(!_0x215a7a){_0x35ef6f[_0x0f12('0xe')](0x194);}return _0x215a7a;};}function handleError(_0x23adc0,_0x3f2716){_0x3f2716=_0x3f2716||0x1f4;return function(_0xe61624){logger[_0x0f12('0xf')](_0xe61624[_0x0f12('0x10')]);if(_0xe61624['name']){delete _0xe61624[_0x0f12('0x11')];}_0x23adc0['status'](_0x3f2716)[_0x0f12('0x12')](_0xe61624);};}exports[_0x0f12('0x13')]=function(_0x28119e,_0x12eb6c){var _0x60daff={},_0xa2168f={},_0x5f4290={'count':0x0,'rows':[]};var _0x2fdc6c=_['map'](db[_0x0f12('0x14')]['rawAttributes'],function(_0x4867c8){return{'name':_0x4867c8[_0x0f12('0x15')],'type':_0x4867c8[_0x0f12('0x16')][_0x0f12('0x17')]};});_0xa2168f['model']=_[_0x0f12('0x18')](_0x2fdc6c,'name');_0xa2168f[_0x0f12('0x19')]=_['keys'](_0x28119e[_0x0f12('0x19')]);_0xa2168f[_0x0f12('0x1a')]=_['intersection'](_0xa2168f[_0x0f12('0x1b')],_0xa2168f[_0x0f12('0x19')]);_0xa2168f[_0x0f12('0x1a')]=_[_0x0f12('0x1c')](_0xa2168f[_0x0f12('0x1a')],['$and',_0x0f12('0x1d'),'$gt','$gte','$lt',_0x0f12('0x1e'),_0x0f12('0x1f'),_0x0f12('0x20'),_0x0f12('0x21'),'$between',_0x0f12('0x22'),_0x0f12('0x23'),_0x0f12('0x24'),'$like',_0x0f12('0x25'),_0x0f12('0x26'),_0x0f12('0x27'),'$like',_0x0f12('0x28'),_0x0f12('0x29'),_0x0f12('0x2a'),_0x0f12('0x2b')]);_0x60daff[_0x0f12('0x2c')]=_['intersection'](_0xa2168f['model'],qs[_0x0f12('0x2d')](_0x28119e['query'][_0x0f12('0x2d')]));_0x60daff[_0x0f12('0x2c')]=_0x60daff[_0x0f12('0x2c')]['length']?_0x60daff[_0x0f12('0x2c')]:_0xa2168f[_0x0f12('0x1b')];if(!_0x28119e[_0x0f12('0x19')][_0x0f12('0x2e')](_0x0f12('0x2f'))){_0x60daff[_0x0f12('0x8')]=qs['limit'](_0x28119e[_0x0f12('0x19')][_0x0f12('0x8')]);_0x60daff[_0x0f12('0x7')]=qs['offset'](_0x28119e[_0x0f12('0x19')][_0x0f12('0x7')]);}_0x60daff[_0x0f12('0x30')]=qs[_0x0f12('0x31')](_0x28119e['query'][_0x0f12('0x31')]);_0x60daff[_0x0f12('0x32')]=qs[_0x0f12('0x1a')](_[_0x0f12('0x33')](_0x28119e[_0x0f12('0x19')],_0xa2168f[_0x0f12('0x1a')]),_0x2fdc6c);if(_0x28119e[_0x0f12('0x19')]['filter']){_0x60daff[_0x0f12('0x32')]=_[_0x0f12('0x34')](_0x60daff['where'],{'$or':_[_0x0f12('0x18')](_0x2fdc6c,function(_0x40715e){if(_0x40715e['type']!==_0x0f12('0x35')){var _0x2ca92b={};_0x2ca92b[_0x40715e['name']]={'$like':'%'+_0x28119e[_0x0f12('0x19')]['filter']+'%'};return _0x2ca92b;}})});}_0x60daff=_[_0x0f12('0x34')]({},_0x60daff,_0x28119e[_0x0f12('0x36')]);var _0x2ed69c={'where':_0x60daff[_0x0f12('0x32')]};return db[_0x0f12('0x14')][_0x0f12('0x9')](_0x2ed69c)[_0x0f12('0xd')](function(_0x1d48a7){_0x5f4290[_0x0f12('0x9')]=_0x1d48a7;if(_0x28119e[_0x0f12('0x19')]['includeAll']){_0x60daff[_0x0f12('0x37')]=[{'all':!![]}];}return db[_0x0f12('0x14')][_0x0f12('0x38')](_0x60daff);})['then'](function(_0x5bea02){_0x5f4290['rows']=_0x5bea02;return _0x5f4290;})[_0x0f12('0xd')](respondWithFilteredResult(_0x12eb6c,_0x60daff))[_0x0f12('0x39')](handleError(_0x12eb6c,null));};exports['show']=function(_0x4bf268,_0x21be62){var _0x1a43c6={'raw':!![],'where':{'id':_0x4bf268['params']['id']}},_0x3acc80={};_0x3acc80[_0x0f12('0x1b')]=_[_0x0f12('0x3a')](db['CmHopper'][_0x0f12('0x3b')]);_0x3acc80[_0x0f12('0x19')]=_[_0x0f12('0x3a')](_0x4bf268[_0x0f12('0x19')]);_0x3acc80[_0x0f12('0x1a')]=_[_0x0f12('0x3c')](_0x3acc80[_0x0f12('0x1b')],_0x3acc80['query']);_0x1a43c6[_0x0f12('0x2c')]=_['intersection'](_0x3acc80[_0x0f12('0x1b')],qs[_0x0f12('0x2d')](_0x4bf268['query'][_0x0f12('0x2d')]));_0x1a43c6[_0x0f12('0x2c')]=_0x1a43c6[_0x0f12('0x2c')]['length']?_0x1a43c6['attributes']:_0x3acc80[_0x0f12('0x1b')];if(_0x4bf268[_0x0f12('0x19')][_0x0f12('0x3d')]){_0x1a43c6[_0x0f12('0x37')]=[{'all':!![]}];}_0x1a43c6=_['merge']({},_0x1a43c6,_0x4bf268[_0x0f12('0x36')]);return db[_0x0f12('0x14')][_0x0f12('0x3e')](_0x1a43c6)[_0x0f12('0xd')](handleEntityNotFound(_0x21be62,null))['then'](respondWithResult(_0x21be62,null))[_0x0f12('0x39')](handleError(_0x21be62,null));};exports[_0x0f12('0x3f')]=function(_0x54ec90,_0x4b7599){return db[_0x0f12('0x14')][_0x0f12('0x3f')](_0x54ec90[_0x0f12('0x40')],{})['then'](respondWithResult(_0x4b7599,0xc9))['catch'](handleError(_0x4b7599,null));};exports[_0x0f12('0xc')]=function(_0x108ade,_0x569c2f){if(_0x108ade[_0x0f12('0x40')]['id']){delete _0x108ade['body']['id'];}return db[_0x0f12('0x14')][_0x0f12('0x3e')]({'where':{'id':_0x108ade['params']['id']}})['then'](handleEntityNotFound(_0x569c2f,null))[_0x0f12('0xd')](saveUpdates(_0x108ade[_0x0f12('0x40')],null))[_0x0f12('0xd')](respondWithResult(_0x569c2f,null))[_0x0f12('0x39')](handleError(_0x569c2f,null));};exports[_0x0f12('0x41')]=function(_0x2f561c,_0x294314){return db[_0x0f12('0x14')]['describe']()[_0x0f12('0xd')](respondWithResult(_0x294314,null))['catch'](handleError(_0x294314,null));};exports[_0x0f12('0x42')]=function(_0x52f1c2,_0x4add76){var _0xbbacc1;var _0x5cfd51=_0x52f1c2[_0x0f12('0x43')]['id'];return db[_0x0f12('0x14')][_0x0f12('0x3e')]({'where':{'id':_0x52f1c2[_0x0f12('0x43')]['id']}})['then'](handleEntityNotFound(_0x4add76,null))[_0x0f12('0xd')](function(_0x90f918){if(_0x90f918){return _0x90f918[_0x0f12('0x42')]()[_0x0f12('0xd')](function(_0x48acec){return _0x48acec;});}})['then'](function(_0x122a57){_0xbbacc1=_0x122a57;if(_0x122a57){if(_0x122a57[_0x0f12('0x44')]||_0x122a57[_0x0f12('0x45')]){return db[_0x122a57[_0x0f12('0x44')]?_0x0f12('0x46'):'Campaign']['find']({'where':{'id':_0x122a57['VoiceQueueId']?_0x122a57[_0x0f12('0x44')]:_0x122a57[_0x0f12('0x45')]},'attributes':['id',_0x0f12('0x11')],'raw':!![]});}}})[_0x0f12('0xd')](function(_0x18c68b){var _0x33af1f={};if(_0x18c68b){_[_0x0f12('0x34')](_0x33af1f,_[_0x0f12('0x47')](_0xbbacc1[_0x0f12('0x48')],[_0x0f12('0x49'),_0x0f12('0x4a'),'id']));_0x33af1f['state']=0x15;_0x33af1f[_0x0f12('0x4b')]=_0x0f12('0x4c');_0x33af1f[_0x0f12('0x4d')]=_0x18c68b[_0x0f12('0x11')];_0x33af1f['membername']=_0x52f1c2['user'][_0x0f12('0x11')];_0x33af1f[_0x0f12('0x4e')]=_0x52f1c2[_0x0f12('0x4f')]['id'];_0x33af1f[_0x0f12('0x4c')]=!![];_0x33af1f[_0x0f12('0x50')]=moment()[_0x0f12('0x51')](_0x0f12('0x52'));_0x33af1f[_0x0f12('0x53')]=_0xbbacc1['phone'];_0x33af1f[_0x0f12('0x54')]=_0xbbacc1[_0x0f12('0x44')]?'queue':_0x0f12('0x55');return db[_0x0f12('0x56')][_0x0f12('0x3e')]({'where':{'id':_0x33af1f['ContactId']},'attributes':[_0x0f12('0x57'),_0x0f12('0x58')]})[_0x0f12('0xd')](function(_0x2ca6bb){if(!_[_0x0f12('0x59')](_0x4add76)&&!_['isNil'](_0x2ca6bb[_0x0f12('0x57')])){_0x33af1f['calleridname']=_0x2ca6bb[_0x0f12('0x57')];if(!_['isNil'](_0x2ca6bb[_0x0f12('0x58')])){_0x33af1f[_0x0f12('0x5a')]+='\x20'+_0x2ca6bb['lastName'];}}})[_0x0f12('0x5b')](function(){return db[_0x0f12('0x5c')]['create'](_0x33af1f);});}})[_0x0f12('0xd')](function(_0x5498aa){return db[_0x0f12('0x5d')]['destroy']({'where':{'CmHopperId':_0x5cfd51}});})[_0x0f12('0xd')](function(){return _0x4add76[_0x0f12('0x5')](0xcc)[_0x0f12('0x5e')]();})['catch'](handleError(_0x4add76,null));};exports[_0x0f12('0x5f')]=function(_0x2df09e,_0x2cc2d6){var _0x5cf716=[];return db[_0x0f12('0x56')][_0x0f12('0x41')]()['then'](function(_0x155ead){_0x5cf716=_[_0x0f12('0x3a')](_0x155ead);return _0x2df09e['user'][_0x0f12('0x60')]({'where':{'type':_0x0f12('0x61'),'dialActive':!![],'dialMethod':_0x0f12('0x62')},'attributes':['id',_0x0f12('0x63'),_0x0f12('0x64')],'raw':!![]});})[_0x0f12('0xd')](function(_0x9b2714){if(_0x9b2714&&_0x9b2714[_0x0f12('0x65')]){return db[_0x0f12('0x66')][_0x0f12('0x67')](function(_0x13db9c){var _0x2f3392={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x0f12('0x52'))},'VoiceQueueId':{'$in':_[_0x0f12('0x18')](_0x9b2714,'id')},'$or':[{'UserId':null},{'UserId':_0x2df09e[_0x0f12('0x4f')]['id']}]};var _0x1f6c14={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x9b2714)[_0x0f12('0x68')](['dialPreviewAutoRecallMe',0x0])[_0x0f12('0x18')]('id')[_0x0f12('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x2df09e[_0x0f12('0x4f')]['id']}]};var _0x5967c2={'$or':[_0x2f3392,_0x1f6c14]};var _0x128af9=[];if(_0x2df09e['body'][_0x0f12('0x6a')]&&_0x2df09e[_0x0f12('0x40')][_0x0f12('0x6a')]===_0x0f12('0x6b')){if(!_['isEmpty'](_0x2df09e[_0x0f12('0x40')]['hopperIds'])){_0x5967c2['id']={'$in':_0x2df09e[_0x0f12('0x40')][_0x0f12('0x6c')]};}_0x128af9=[['priority',_0x0f12('0x6d')],[_0x0f12('0x6e'),_0x9b2714[0x0][_0x0f12('0x63')]===_0x0f12('0x6d')?_0x0f12('0x6f'):_0x0f12('0x6d')],db['sequelize'][_0x0f12('0x70')](_0x0f12('0x71')),['id',_0x0f12('0x6f')]];}else{if(!_[_0x0f12('0x72')](_0x2df09e[_0x0f12('0x40')][_0x0f12('0x6c')])){_0x5967c2['id']={'$notIn':_0x2df09e[_0x0f12('0x40')][_0x0f12('0x6c')]};}_0x128af9=[[_0x0f12('0x73'),_0x0f12('0x6f')],[_0x0f12('0x6e'),_0x9b2714[0x0]['dialOrderByScheduledAt']],db[_0x0f12('0x66')]['literal'](_0x0f12('0x74')),['id',_0x0f12('0x6d')]];}return db[_0x0f12('0x14')]['findOne']({'attributes':['id',_0x0f12('0x75'),_0x0f12('0x76'),_0x0f12('0x77')],'where':_0x5967c2,'order':_0x128af9,'transaction':_0x13db9c,'lock':_0x13db9c[_0x0f12('0x78')][_0x0f12('0x79')],'include':[{'model':db[_0x0f12('0x56')],'as':_0x0f12('0x7a'),'attributes':_0x5cf716,'include':[{'model':db[_0x0f12('0x7b')],'as':'Company','attributes':['id',_0x0f12('0x11')]}]},{'model':db[_0x0f12('0x7c')],'as':_0x0f12('0x7d'),'attributes':['id',_0x0f12('0x11')]},{'model':db[_0x0f12('0x46')],'as':_0x0f12('0x7e'),'attributes':['id',_0x0f12('0x11'),_0x0f12('0x7f')]}]})[_0x0f12('0xd')](function(_0x498966){if(_0x498966){return _0x498966['update']({'UserId':_0x2df09e[_0x0f12('0x4f')]['id']},{'transaction':_0x13db9c});}});});}})[_0x0f12('0xd')](handleEntityNotFound(_0x2cc2d6,null))[_0x0f12('0xd')](respondWithResult(_0x2cc2d6,null))[_0x0f12('0x39')](handleError(_0x2cc2d6,null));};exports['getPreviewRecall']=function(_0x3a169b,_0x1557db,_0x3567db){var _0x5a3255=[];var _0x8e211=_0x3a169b[_0x0f12('0x43')]['id'];var _0xd18662=_0x3a169b[_0x0f12('0x4f')]['id'];return db[_0x0f12('0x56')][_0x0f12('0x41')]()['then'](function(_0x2981db){_0x5a3255=_[_0x0f12('0x3a')](_0x2981db);return db[_0x0f12('0x66')]['transaction'](function(_0x2cc0b7){const _0x1b28c2={'id':_0x8e211};return db[_0x0f12('0x14')][_0x0f12('0x80')]({'attributes':['id',_0x0f12('0x75'),_0x0f12('0x77')],'where':_0x1b28c2,'transaction':_0x2cc0b7,'lock':_0x2cc0b7['LOCK'][_0x0f12('0x79')],'include':[{'model':db[_0x0f12('0x56')],'as':'Contact','attributes':_0x5a3255,'include':[{'model':db[_0x0f12('0x7b')],'as':_0x0f12('0x81'),'attributes':['id',_0x0f12('0x11')]}]},{'model':db[_0x0f12('0x7c')],'as':_0x0f12('0x7d'),'attributes':['id',_0x0f12('0x11')]},{'model':db[_0x0f12('0x46')],'as':_0x0f12('0x7e'),'attributes':['id','name','dialActive']}]})[_0x0f12('0xd')](function(_0x1782a9){if(_0x1782a9){return _0x1782a9[_0x0f12('0xc')]({'UserId':_0xd18662},{'transaction':_0x2cc0b7});}});});})[_0x0f12('0xd')](handleEntityNotFound(_0x1557db,null))['then'](respondWithResult(_0x1557db,null))['catch'](handleError(_0x1557db,null));};exports[_0x0f12('0x82')]=function(_0x310af3,_0x597a9b){return _0x310af3[_0x0f12('0x4f')]['getVoiceQueues']({'where':{'type':_0x0f12('0x61'),'dialActive':!![],'dialMethod':_0x0f12('0x62')},'attributes':['id'],'raw':!![]})[_0x0f12('0xd')](function(_0x4ec86a){if(_0x4ec86a&&_0x4ec86a[_0x0f12('0x65')]){return db['CmHopper']['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x0f12('0x51')](_0x0f12('0x52'))},'VoiceQueueId':{'$in':_['map'](_0x4ec86a,'id')},'$or':[{'UserId':null},{'UserId':_0x310af3[_0x0f12('0x4f')]['id']}]}});}return 0x0;})[_0x0f12('0xd')](function(_0x130b70){if(!_[_0x0f12('0x59')](_0x130b70)&&_['isNumber'](_0x130b70)){return _0x597a9b[_0x0f12('0x5')](0xc8)[_0x0f12('0x6')]({'contacts':_0x130b70});}else{logger[_0x0f12('0xf')](_0x0f12('0x83'),_0x0f12('0x82'),0x194,_0x0f12('0x84'));_0x597a9b['sendStatus'](0x194);}})[_0x0f12('0x39')](handleError(_0x597a9b,null));};exports[_0x0f12('0x85')]=function(_0x3093a0,_0x57b290){var _0x4c2c6e=shared[_0x0f12('0x86')];var _0x169fbb=[];_[_0x0f12('0x18')](_0x4c2c6e,function(_0x10e218){_0x169fbb[_0x0f12('0x87')]({'id':_0x10e218[_0x0f12('0x11')],'name':_0x10e218[_0x0f12('0x11')],'utcOffset':_0x10e218[_0x0f12('0x88')]});});return _0x57b290[_0x0f12('0x5')](0xc8)[_0x0f12('0x6')]({'tz':_0x169fbb});};exports['getTimezone']=function(_0x259652,_0x1c0610){var _0x404bc7=shared[_0x0f12('0x86')];var _0x322067={};if(!_[_0x0f12('0x59')](_0x404bc7[_0x259652[_0x0f12('0x40')]['id']]))_0x322067=_0x404bc7[_0x259652[_0x0f12('0x40')]['id']];return _0x1c0610[_0x0f12('0x5')](0xc8)['json'](_0x322067);}; \ No newline at end of file +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(_0x39d544,_0x35c14f){var _0x5a5ff2=function(_0x2271fb){while(--_0x2271fb){_0x39d544['push'](_0x39d544['shift']());}};_0x5a5ff2(++_0x35c14f);}(_0xbfe8,0x1b9));var _0x8bfe=function(_0x573f85,_0x36146b){_0x573f85=_0x573f85-0x0;var _0x2a312a=_0xbfe8[_0x573f85];return _0x2a312a;};'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 diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 9239da3..a530b02 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 _0xb4c7=['request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x426ff1,_0xd23e7){_0x426ff1=_0x426ff1-0x0;var _0x2638bb=_0xb4c7[_0x426ff1];return _0x2638bb;};'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')]('CmHopper',attributes,{'tableName':_0x7b4c('0xb'),'paranoid':![],'indexes':[{'name':_0x7b4c('0xc'),'fields':['scheduledat']},{'name':_0x7b4c('0xd'),'fields':[_0x7b4c('0xd')]},{'name':_0x7b4c('0xe'),'fields':[_0x7b4c('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['scheduledat','phone','priority','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','define','CmHopper','cm_hopper'];(function(_0x5a95fa,_0x4a2fc9){var _0x1a61b8=function(_0x59f119){while(--_0x59f119){_0x5a95fa['push'](_0x5a95fa['shift']());}};_0x1a61b8(++_0x4a2fc9);}(_0x1967,0x173));var _0x7196=function(_0x8368c1,_0x4a101b){_0x8368c1=_0x8368c1-0x0;var _0x32635e=_0x1967[_0x8368c1];return _0x32635e;};'use strict';var _=require('lodash');var util=require(_0x7196('0x0'));var logger=require(_0x7196('0x1'))(_0x7196('0x2'));var moment=require(_0x7196('0x3'));var BPromise=require(_0x7196('0x4'));var rp=require(_0x7196('0x5'));var fs=require('fs');var path=require(_0x7196('0x6'));var rimraf=require(_0x7196('0x7'));var config=require(_0x7196('0x8'));var attributes=require(_0x7196('0x9'));module['exports']=function(_0x36b01e,_0x186175){return _0x36b01e[_0x7196('0xa')](_0x7196('0xb'),attributes,{'tableName':_0x7196('0xc'),'paranoid':![],'indexes':[{'name':_0x7196('0xd'),'fields':['scheduledat']},{'name':_0x7196('0xe'),'fields':[_0x7196('0xe')]},{'name':_0x7196('0xf'),'fields':[_0x7196('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 9b56a55..f10f172 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 _0x3a7f=['UpdateCmHopper','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','findAll','LOCK','UPDATE','keys','User','Agent','voicePause','length','UserId','push','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','transaction','CmHopperFinal','create','MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','order','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','getContactByPhone','ResetActiveCalls','voiceQueueIds','interval','availableAgentsIds','NOW()','CmList','CmHopperHandlePreviewRecallNotifications','lodash','util','../../config/logger','GetCmHopper','CmHopper','options','raw','where','attributes','limit','include','model','map','info','debug','stringify','catch','error','message','ShowCmHopper','find','body','then','CreateCmHopper','update'];(function(_0x4e1f1a,_0x5787f3){var _0x20a493=function(_0x237d4){while(--_0x237d4){_0x4e1f1a['push'](_0x4e1f1a['shift']());}};_0x20a493(++_0x5787f3);}(_0x3a7f,0x113));var _0xf3a7=function(_0x3022ed,_0x483a78){_0x3022ed=_0x3022ed-0x0;var _0x1cd99c=_0x3a7f[_0x3022ed];return _0x1cd99c;};'use strict';var _=require(_0xf3a7('0x0'));var util=require(_0xf3a7('0x1'));var moment=require('moment');var BPromise=require('bluebird');var db=require('../../mysqldb')['db'];var logger=require(_0xf3a7('0x2'))('rpc');exports[_0xf3a7('0x3')]=function(_0x51e633){var _0x240f57=this;return new Promise(function(_0x231479,_0x200813){return db[_0xf3a7('0x4')]['findAll']({'raw':_0x51e633['options']?_0x51e633[_0xf3a7('0x5')][_0xf3a7('0x6')]===undefined?!![]:![]:!![],'where':_0x51e633[_0xf3a7('0x5')]?_0x51e633[_0xf3a7('0x5')][_0xf3a7('0x7')]||null:null,'attributes':_0x51e633[_0xf3a7('0x5')]?_0x51e633[_0xf3a7('0x5')][_0xf3a7('0x8')]||null:null,'limit':_0x51e633[_0xf3a7('0x5')]?_0x51e633[_0xf3a7('0x5')][_0xf3a7('0x9')]||null:null,'include':_0x51e633[_0xf3a7('0x5')]?_0x51e633[_0xf3a7('0x5')][_0xf3a7('0xa')]?_['map'](_0x51e633[_0xf3a7('0x5')][_0xf3a7('0xa')],function(_0x437d63){return{'model':db[_0x437d63[_0xf3a7('0xb')]],'as':_0x437d63['as'],'attributes':_0x437d63[_0xf3a7('0x8')],'include':_0x437d63[_0xf3a7('0xa')]?_[_0xf3a7('0xc')](_0x437d63[_0xf3a7('0xa')],function(_0x2d8787){return{'model':db[_0x2d8787['model']],'as':_0x2d8787['as'],'attributes':_0x2d8787[_0xf3a7('0x8')],'include':_0x2d8787['include']?_[_0xf3a7('0xc')](_0x2d8787[_0xf3a7('0xa')],function(_0xd9be09){return{'model':db[_0xd9be09[_0xf3a7('0xb')]],'as':_0xd9be09['as'],'attributes':_0xd9be09[_0xf3a7('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x307fdc){logger[_0xf3a7('0xd')](_0xf3a7('0x3'),_0x51e633);logger[_0xf3a7('0xe')](_0xf3a7('0x3'),_0x51e633,JSON[_0xf3a7('0xf')](_0x307fdc));_0x231479(_0x307fdc);})[_0xf3a7('0x10')](function(_0x122c54){logger[_0xf3a7('0x11')](_0xf3a7('0x3'),_0x122c54[_0xf3a7('0x12')],_0x51e633);_0x200813(_0x240f57['error'](0x1f4,_0x122c54[_0xf3a7('0x12')]));});});};exports[_0xf3a7('0x13')]=function(_0x2bcbe0){var _0x5d5471=this;return new Promise(function(_0x4de002,_0x1de09d){return db['CmHopper'][_0xf3a7('0x14')]({'raw':_0x2bcbe0[_0xf3a7('0x5')]?_0x2bcbe0[_0xf3a7('0x5')][_0xf3a7('0x6')]===undefined?!![]:![]:!![],'where':_0x2bcbe0[_0xf3a7('0x5')]?_0x2bcbe0['options']['where']||null:null,'attributes':_0x2bcbe0[_0xf3a7('0x5')]?_0x2bcbe0[_0xf3a7('0x5')][_0xf3a7('0x8')]||null:null,'include':_0x2bcbe0[_0xf3a7('0x5')]?_0x2bcbe0['options'][_0xf3a7('0xa')]?_['map'](_0x2bcbe0[_0xf3a7('0x5')][_0xf3a7('0xa')],function(_0x1f4e05){return{'model':db[_0x1f4e05['model']],'as':_0x1f4e05['as'],'attributes':_0x1f4e05[_0xf3a7('0x8')],'include':_0x1f4e05[_0xf3a7('0xa')]?_[_0xf3a7('0xc')](_0x1f4e05[_0xf3a7('0xa')],function(_0x16e556){return{'model':db[_0x16e556[_0xf3a7('0xb')]],'as':_0x16e556['as'],'attributes':_0x16e556[_0xf3a7('0x8')],'include':_0x16e556['include']?_[_0xf3a7('0xc')](_0x16e556['include'],function(_0x4ddff2){return{'model':db[_0x4ddff2['model']],'as':_0x4ddff2['as'],'attributes':_0x4ddff2[_0xf3a7('0x8')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x13b879){logger[_0xf3a7('0xd')](_0xf3a7('0x13'),_0x2bcbe0);logger['debug'](_0xf3a7('0x13'),_0x2bcbe0,JSON[_0xf3a7('0xf')](_0x13b879));_0x4de002(_0x13b879);})[_0xf3a7('0x10')](function(_0x3cba20){logger[_0xf3a7('0x11')](_0xf3a7('0x13'),_0x3cba20[_0xf3a7('0x12')],_0x2bcbe0);_0x1de09d(_0x5d5471[_0xf3a7('0x11')](0x1f4,_0x3cba20['message']));});});};exports['CreateCmHopper']=function(_0x2e97e2){var _0x4403bd=this;return new Promise(function(_0x57fefd,_0x43d178){return db[_0xf3a7('0x4')]['create'](_0x2e97e2[_0xf3a7('0x15')],{'raw':_0x2e97e2[_0xf3a7('0x5')]?_0x2e97e2[_0xf3a7('0x5')]['raw']===undefined?!![]:![]:!![]})[_0xf3a7('0x16')](function(_0x2b0002){logger['info']('CreateCmHopper',_0x2e97e2);logger[_0xf3a7('0xe')](_0xf3a7('0x17'),_0x2e97e2,JSON[_0xf3a7('0xf')](_0x2b0002));_0x57fefd(_0x2b0002);})['catch'](function(_0x4dc36f){logger[_0xf3a7('0x11')](_0xf3a7('0x17'),_0x4dc36f[_0xf3a7('0x12')],_0x2e97e2);_0x43d178(_0x4403bd[_0xf3a7('0x11')](0x1f4,_0x4dc36f[_0xf3a7('0x12')]));});});};exports['UpdateCmHopper']=function(_0x484806){var _0xf24127=this;return new Promise(function(_0x11bf50,_0x102f26){return db['CmHopper'][_0xf3a7('0x18')](_0x484806[_0xf3a7('0x15')],{'raw':_0x484806[_0xf3a7('0x5')]?_0x484806[_0xf3a7('0x5')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x484806[_0xf3a7('0x5')]?_0x484806['options'][_0xf3a7('0x7')]||null:null,'attributes':_0x484806[_0xf3a7('0x5')]?_0x484806[_0xf3a7('0x5')][_0xf3a7('0x8')]||null:null,'limit':_0x484806['options']?_0x484806[_0xf3a7('0x5')]['limit']||null:null})['then'](function(_0x25feae){logger[_0xf3a7('0xd')](_0xf3a7('0x19'),_0x484806);logger['info'](_0xf3a7('0x1a'),JSON['stringify'](_0x484806[_0xf3a7('0x5')]['where']),_0x484806[_0xf3a7('0x15')][_0xf3a7('0x1b')]);logger[_0xf3a7('0xe')](_0xf3a7('0x19'),_0x484806,JSON[_0xf3a7('0xf')](_0x25feae));_0x11bf50(_0x25feae);})['catch'](function(_0x49f631){logger['error']('UpdateCmHopper',_0x49f631['message'],_0x484806);_0x102f26(_0xf24127[_0xf3a7('0x11')](0x1f4,_0x49f631[_0xf3a7('0x12')]));});});};exports[_0xf3a7('0x1c')]=function(_0x9425fb){var _0xb954d1=this;return new Promise(function(_0x5dbc83,_0x478df7){return db[_0xf3a7('0x4')][_0xf3a7('0x1d')]({'where':_0x9425fb[_0xf3a7('0x5')]?_0x9425fb['options'][_0xf3a7('0x7')]||null:null})[_0xf3a7('0x16')](function(_0x53ff2e){logger[_0xf3a7('0xd')](_0xf3a7('0x1c'),_0x9425fb);logger['debug'](_0xf3a7('0x1c'),_0x9425fb,JSON[_0xf3a7('0xf')](_0x53ff2e));_0x5dbc83(_0x53ff2e);})[_0xf3a7('0x10')](function(_0x2c5b40){logger[_0xf3a7('0x11')]('DestroyCmHopper',_0x2c5b40[_0xf3a7('0x12')],_0x9425fb);_0x478df7(_0xb954d1[_0xf3a7('0x11')](0x1f4,_0x2c5b40[_0xf3a7('0x12')]));});});};exports[_0xf3a7('0x1e')]=function(_0x318c15){var _0x54b8f1=this;return new Promise(function(_0x4a508b,_0x4e56d7){return db[_0xf3a7('0x1f')][_0xf3a7('0x20')]()[_0xf3a7('0x16')](function(_0x5843e0){return db[_0xf3a7('0x21')]['transaction'](function(_0x3f752b){return db[_0xf3a7('0x4')][_0xf3a7('0x22')]({'where':_0x318c15[_0xf3a7('0x5')]?_0x318c15[_0xf3a7('0x5')][_0xf3a7('0x7')]||null:null,'attributes':_0x318c15[_0xf3a7('0x5')]?_0x318c15[_0xf3a7('0x5')][_0xf3a7('0x8')]||null:null,'limit':_0x318c15[_0xf3a7('0x5')]?_0x318c15[_0xf3a7('0x5')][_0xf3a7('0x9')]||null:null,'order':_0x318c15[_0xf3a7('0x5')]?_0x318c15['options']['order']||null:null,'transaction':_0x3f752b,'lock':_0x3f752b[_0xf3a7('0x23')][_0xf3a7('0x24')],'include':[{'model':db[_0xf3a7('0x1f')],'as':'Contact','attributes':_[_0xf3a7('0x25')](_0x5843e0)},{'model':db[_0xf3a7('0x26')],'as':_0xf3a7('0x27'),'attributes':['id','name',_0xf3a7('0x28')]}]})[_0xf3a7('0x16')](function(_0xa687eb){var _0x273a98=[];var _0xd7e777=[];for(var _0xfd2797=0x0;_0xfd2797<_0xa687eb[_0xf3a7('0x29')];_0xfd2797+=0x1){var _0x1a26f1=_0xa687eb[_0xfd2797][_0xf3a7('0x2a')];if(_0x1a26f1===null){_0x273a98[_0xf3a7('0x2b')](_0xa687eb[_0xfd2797][_0xf3a7('0x18')](_0x318c15['body'],{'transaction':_0x3f752b}));}else if(!_0xd7e777['includes'](_0x1a26f1)){_0xd7e777[_0xf3a7('0x2b')](_0x1a26f1);_0x273a98[_0xf3a7('0x2b')](_0xa687eb[_0xfd2797][_0xf3a7('0x18')](_0x318c15[_0xf3a7('0x15')],{'transaction':_0x3f752b}));}}return BPromise['all'](_0x273a98);});})[_0xf3a7('0x16')](function(_0x5ae7c2){logger[_0xf3a7('0xd')](_0xf3a7('0x1e'),_0x318c15);if(_0x5ae7c2['length']>0x0){logger[_0xf3a7('0xd')](_0xf3a7('0x2c'),_0x5ae7c2[0x0][_0xf3a7('0x2d')]['id'],_0x5ae7c2[0x0][_0xf3a7('0x2d')][_0xf3a7('0x2e')],_0x5ae7c2[0x0][_0xf3a7('0x2d')]['active']);}logger['debug'](_0xf3a7('0x1e'),_0x318c15,JSON[_0xf3a7('0xf')](_0x5ae7c2));_0x4a508b(_0x5ae7c2);})['catch'](function(_0x2391ee){logger[_0xf3a7('0x11')](_0xf3a7('0x1e'),_0x2391ee[_0xf3a7('0x12')],_0x318c15);_0x4e56d7(_0x54b8f1['error'](0x1f4,_0x2391ee[_0xf3a7('0x12')]));});});});};exports[_0xf3a7('0x2f')]=function(_0x29ebac){var _0x3ccd48=this;return new Promise(function(_0x223ecf,_0x19867f){return db['sequelize'][_0xf3a7('0x30')](function(_0xd7bed){return db[_0xf3a7('0x31')][_0xf3a7('0x32')](_0x29ebac[_0xf3a7('0x15')],{'raw':_0x29ebac['options']?_0x29ebac[_0xf3a7('0x5')][_0xf3a7('0x6')]===undefined?!![]:![]:!![],'transaction':_0xd7bed})[_0xf3a7('0x16')](function(){logger[_0xf3a7('0xd')](_0xf3a7('0x33'),JSON[_0xf3a7('0xf')](_0x29ebac[_0xf3a7('0x5')][_0xf3a7('0x7')]),_0x29ebac[_0xf3a7('0x5')][_0xf3a7('0x7')][_0xf3a7('0x1b')]);return db[_0xf3a7('0x4')]['destroy']({'where':_0x29ebac[_0xf3a7('0x5')]?_0x29ebac['options'][_0xf3a7('0x7')]||null:null,'transaction':_0xd7bed});});})['then'](function(_0x62cee4){logger['info'](_0xf3a7('0x2f'),_0x29ebac);logger['debug'](_0xf3a7('0x2f'),_0x29ebac,JSON[_0xf3a7('0xf')](_0x62cee4));_0x223ecf(_0x62cee4);})[_0xf3a7('0x10')](function(_0x30d7b7){logger[_0xf3a7('0x11')](_0xf3a7('0x2f'),_0x30d7b7['message'],_0x29ebac);_0x19867f(_0x3ccd48['error'](0x1f4,_0x30d7b7[_0xf3a7('0x12')]));});});};exports[_0xf3a7('0x34')]=function(_0x404f33){var _0x12ae39=this;return new Promise(function(_0x17059f,_0x2d05b1){return db[_0xf3a7('0x4')][_0xf3a7('0x22')]({'raw':_0x404f33[_0xf3a7('0x5')]?_0x404f33['options']['raw']===undefined?!![]:![]:!![],'where':_0x404f33[_0xf3a7('0x5')]?_0x404f33['options']['where']||null:null,'attributes':[[db[_0xf3a7('0x21')]['fn'](_0xf3a7('0x35'),db[_0xf3a7('0x21')]['fn']('IF',db['sequelize'][_0xf3a7('0x36')](_0xf3a7('0x37')+util[_0xf3a7('0x38')](_0xf3a7('0x39'),moment()[_0xf3a7('0x38')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xf3a7('0x3a')))),_0xf3a7('0x3b')]]})[_0xf3a7('0x16')](function(_0x64e0f4){logger[_0xf3a7('0xd')](_0xf3a7('0x34'),_0x404f33);logger[_0xf3a7('0xe')](_0xf3a7('0x34'),_0x404f33,JSON['stringify'](_0x64e0f4));_0x17059f(_0x64e0f4);})['catch'](function(_0x300825){logger['error']('CountReScheduled',_0x300825[_0xf3a7('0x12')],_0x404f33);_0x2d05b1(_0x12ae39[_0xf3a7('0x11')](0x1f4,_0x300825[_0xf3a7('0x12')]));});});};exports[_0xf3a7('0x3c')]=function(_0x277a6d){var _0x2cd572=this;return new Promise(function(_0x39cf7b,_0x430b53){return db[_0xf3a7('0x1f')][_0xf3a7('0x20')]()[_0xf3a7('0x16')](function(){return db[_0xf3a7('0x21')][_0xf3a7('0x30')](function(_0x2a8560){return db[_0xf3a7('0x4')][_0xf3a7('0x22')]({'where':_0x277a6d[_0xf3a7('0x5')]?_0x277a6d[_0xf3a7('0x5')][_0xf3a7('0x7')]||null:null,'attributes':_0x277a6d[_0xf3a7('0x5')]?_0x277a6d[_0xf3a7('0x5')][_0xf3a7('0x8')]||null:null,'limit':0x1,'order':_0x277a6d[_0xf3a7('0x5')]?_0x277a6d[_0xf3a7('0x5')][_0xf3a7('0x3d')]||null:null,'group':db[_0xf3a7('0x4')][_0xf3a7('0x2a')],'transaction':_0x2a8560,'lock':_0x2a8560['LOCK'][_0xf3a7('0x24')],'include':_0x277a6d['options']?_0x277a6d[_0xf3a7('0x5')][_0xf3a7('0xa')]?_['map'](_0x277a6d[_0xf3a7('0x5')]['include'],function(_0x4dac58){return{'model':db[_0x4dac58[_0xf3a7('0xb')]],'as':_0x4dac58['as'],'attributes':_0x4dac58[_0xf3a7('0x8')],'include':_0x4dac58[_0xf3a7('0xa')]?_[_0xf3a7('0xc')](_0x4dac58[_0xf3a7('0xa')],function(_0x346d3c){return{'model':db[_0x346d3c[_0xf3a7('0xb')]],'as':_0x346d3c['as'],'attributes':_0x346d3c[_0xf3a7('0x8')],'include':_0x346d3c[_0xf3a7('0xa')]?_['map'](_0x346d3c[_0xf3a7('0xa')],function(_0x2519f0){return{'model':db[_0x2519f0[_0xf3a7('0xb')]],'as':_0x2519f0['as'],'attributes':_0x2519f0[_0xf3a7('0x8')]};}):[]};}):[]};}):[]:[]})[_0xf3a7('0x16')](function(_0x3bbd86){var _0x1b22cc=[];for(var _0xafc543=0x0;_0xafc543<_0x3bbd86['length'];_0xafc543+=0x1){_0x1b22cc[_0xf3a7('0x2b')](_0x3bbd86[_0xafc543][_0xf3a7('0x18')](_0x277a6d[_0xf3a7('0x15')],{'transaction':_0x2a8560}));}return BPromise['all'](_0x1b22cc);});})[_0xf3a7('0x16')](function(_0x2e251b){logger[_0xf3a7('0xd')](_0xf3a7('0x3c'),_0x277a6d);logger[_0xf3a7('0xe')](_0xf3a7('0x3c'),_0x277a6d,JSON['stringify'](_0x2e251b));_0x39cf7b(_0x2e251b);})[_0xf3a7('0x10')](function(_0x1c1c8a){logger['error'](_0xf3a7('0x3c'),_0x1c1c8a[_0xf3a7('0x12')],_0x277a6d);_0x430b53(_0x2cd572[_0xf3a7('0x11')](0x1f4,_0x1c1c8a[_0xf3a7('0x12')]));});});});};exports[_0xf3a7('0x3e')]=function(_0x22e361){var _0x37afa7=this;return new Promise(function(_0x5380e7,_0x21d0be){db['CmContact']['describe']()[_0xf3a7('0x16')](function(_0x24d5c4){return db['CmHopper'][_0xf3a7('0x22')]({'raw':_0x22e361[_0xf3a7('0x5')]?_0x22e361[_0xf3a7('0x5')]['raw']===undefined?!![]:![]:!![],'where':_0x22e361['options']?_0x22e361[_0xf3a7('0x5')][_0xf3a7('0x7')]||null:null,'attributes':_0x22e361['options']?_0x22e361['options']['attributes']||null:null,'limit':_0x22e361[_0xf3a7('0x5')]?_0x22e361['options'][_0xf3a7('0x9')]||null:null,'include':_0x22e361[_0xf3a7('0x5')]?_0x22e361[_0xf3a7('0x5')][_0xf3a7('0xa')]?_[_0xf3a7('0xc')](_0x22e361[_0xf3a7('0x5')]['include'],function(_0x4e9eed){return{'model':db[_0x4e9eed[_0xf3a7('0xb')]],'as':_0x4e9eed['as'],'attributes':_0x4e9eed['as']===_0xf3a7('0x3f')?_['keys'](_0x24d5c4):_0x4e9eed['attributes'],'include':_0x4e9eed[_0xf3a7('0xa')]?_['map'](_0x4e9eed['include'],function(_0x354fc8){return{'model':db[_0x354fc8[_0xf3a7('0xb')]],'as':_0x354fc8['as'],'attributes':_0x354fc8[_0xf3a7('0x8')],'include':_0x354fc8[_0xf3a7('0xa')]?_['map'](_0x354fc8['include'],function(_0x25b42b){return{'model':db[_0x25b42b[_0xf3a7('0xb')]],'as':_0x25b42b['as'],'attributes':_0x25b42b[_0xf3a7('0x8')]};}):[]};}):[]};}):[]:[]})[_0xf3a7('0x16')](function(_0x4c1f02){logger[_0xf3a7('0xd')]('GetCmHopper',_0x22e361);logger['debug']('GetCmHopper',_0x22e361,JSON[_0xf3a7('0xf')](_0x4c1f02));_0x5380e7(_0x4c1f02);})['catch'](function(_0x339aae){logger['error'](_0xf3a7('0x3'),_0x339aae[_0xf3a7('0x12')],_0x22e361);_0x21d0be(_0x37afa7[_0xf3a7('0x11')](0x1f4,_0x339aae[_0xf3a7('0x12')]));});});});};exports[_0xf3a7('0x40')]=function(_0xd46843){var _0x45ba4a=this;return new Promise(function(_0x30b26d,_0x46ca0b){return db[_0xf3a7('0x1f')][_0xf3a7('0x41')]({'raw':!![],'where':{'phone':_0xd46843['options'][_0xf3a7('0x7')][_0xf3a7('0x42')]},'attributes':['id','dialTimezone'],'order':[['id','DESC']]})[_0xf3a7('0x16')](function(_0x4f636f){logger[_0xf3a7('0xd')]('getContactByPhone',_0xd46843);logger[_0xf3a7('0xe')](_0xf3a7('0x43'),_0xd46843,JSON[_0xf3a7('0xf')](_0x4f636f));_0x30b26d(_0x4f636f);})[_0xf3a7('0x10')](function(_0x57e553){logger['error'](_0xf3a7('0x43'),_0x57e553['message'],_0xd46843);_0x46ca0b(_0x45ba4a['error'](0x1f4,_0x57e553[_0xf3a7('0x12')]));});});};exports[_0xf3a7('0x44')]=function(_0x20b1ab){var _0x1a7329=this;return new Promise(function(_0x11799a,_0x3755fe){return db[_0xf3a7('0x21')][_0xf3a7('0x30')](function(_0x2f2d30){var _0x4294eb=_0x20b1ab[_0xf3a7('0x5')]&&_0x20b1ab['options']['where']?_0x20b1ab[_0xf3a7('0x5')][_0xf3a7('0x7')]:{};return db[_0xf3a7('0x4')]['update'](_0x20b1ab[_0xf3a7('0x15')],{'where':_0x4294eb,'transaction':_0x2f2d30})[_0xf3a7('0x16')](function(_0x4b3a47){logger[_0xf3a7('0xd')](_0xf3a7('0x44'),_0x20b1ab);logger[_0xf3a7('0xe')](_0xf3a7('0x44'),_0x20b1ab,JSON[_0xf3a7('0xf')](_0x4b3a47));_0x11799a(_0x4b3a47);})[_0xf3a7('0x10')](function(_0x3a638b){logger[_0xf3a7('0x11')](_0xf3a7('0x44'),_0x3a638b['message'],_0x20b1ab);_0x3755fe(_0x1a7329[_0xf3a7('0x11')](0x1f4,_0x3a638b['message']));});});});};exports['CmHopperHandlePreviewRecallNotifications']=function(_0x4be209){var _0x3bc68b=this;var _0x15e83d=_0x4be209[_0xf3a7('0x15')][_0xf3a7('0x7')][_0xf3a7('0x45')];var _0x2c4e50=_0x4be209[_0xf3a7('0x15')][_0xf3a7('0x7')][_0xf3a7('0x46')];var _0x39aa02=_0x4be209[_0xf3a7('0x15')][_0xf3a7('0x7')][_0xf3a7('0x47')];return new Promise(function(_0x21260b,_0x348b2f){return db[_0xf3a7('0x4')]['findAll']({'where':{'voiceQueueId':{'$in':_0x15e83d},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize'][_0xf3a7('0x36')]('NOW()\x20+\x20INTERVAL\x20'+_0x2c4e50+'\x20MINUTE'),'$gt':db[_0xf3a7('0x21')]['literal'](_0xf3a7('0x48'))}},'UserId':{'$in':_0x39aa02}},'include':[{'model':db[_0xf3a7('0x1f')],'as':'Contact'},{'model':db['User'],'as':_0xf3a7('0x27'),'attributes':['id','name',_0xf3a7('0x28')]},{'model':db[_0xf3a7('0x49')],'as':'List'}]})[_0xf3a7('0x16')](function(_0x1c7642){if(_0x1c7642[_0xf3a7('0x29')]>0x0){return db['sequelize'][_0xf3a7('0x30')](function(_0x3f3746){return db[_0xf3a7('0x4')][_0xf3a7('0x18')]({'recallmeNotifiedDate':db[_0xf3a7('0x21')]['literal']('NOW()')},{'where':{'id':{'$in':_['map'](_0x1c7642,'id')}},'transaction':_0x3f3746})[_0xf3a7('0x16')](function(){_0x21260b(_0x1c7642);})['catch'](function(_0x5c2bf4){logger['error'](_0xf3a7('0x4a'),_0x5c2bf4[_0xf3a7('0x12')],_0x4be209);_0x348b2f(_0x3bc68b[_0xf3a7('0x11')](0x1f4,_0x5c2bf4[_0xf3a7('0x12')]));});})[_0xf3a7('0x10')](function(_0x1a55bc){logger[_0xf3a7('0x11')](_0xf3a7('0x4a'),_0x1a55bc[_0xf3a7('0x12')],_0x4be209);_0x348b2f(_0x3bc68b['error'](0x1f4,_0x1a55bc[_0xf3a7('0x12')]));});}else{_0x21260b(_0x1c7642);}});});}; \ No newline at end of file +var _0xf725=['transaction','order','LOCK','UPDATE','CmContact','keys','User','Agent','name','voicePause','length','UserId','push','update','includes','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','MoveContactManagedDialer','CmHopperFinal','destroy','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','CountReScheduled','GetContactRecallMe','all','Contact','GetContactByPhone','findOne','phone','dialTimezone','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','NOW()','CmList','List','lodash','util','moment','bluebird','../../config/logger','GetCmHopper','CmHopper','findAll','options','where','attributes','include','map','model','then','info','debug','message','error','find','raw','ShowCmHopper','stringify','catch','CreateCmHopper','create','body','UpdateCmHopper','limit','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','GetContactDialer','describe','sequelize'];(function(_0x296f38,_0xd95c43){var _0x3ff21e=function(_0x44ac03){while(--_0x44ac03){_0x296f38['push'](_0x296f38['shift']());}};_0x3ff21e(++_0xd95c43);}(_0xf725,0xd0));var _0x5f72=function(_0x48231f,_0x3caff8){_0x48231f=_0x48231f-0x0;var _0x3123bc=_0xf725[_0x48231f];return _0x3123bc;};'use strict';var _=require(_0x5f72('0x0'));var util=require(_0x5f72('0x1'));var moment=require(_0x5f72('0x2'));var BPromise=require(_0x5f72('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0x5f72('0x4'))('rpc');exports[_0x5f72('0x5')]=function(_0x31722d){var _0x28a13b=this;return new Promise(function(_0x51e204,_0x47e095){return db[_0x5f72('0x6')][_0x5f72('0x7')]({'raw':_0x31722d[_0x5f72('0x8')]?_0x31722d['options']['raw']===undefined?!![]:![]:!![],'where':_0x31722d[_0x5f72('0x8')]?_0x31722d['options'][_0x5f72('0x9')]||null:null,'attributes':_0x31722d['options']?_0x31722d['options'][_0x5f72('0xa')]||null:null,'limit':_0x31722d[_0x5f72('0x8')]?_0x31722d[_0x5f72('0x8')]['limit']||null:null,'include':_0x31722d[_0x5f72('0x8')]?_0x31722d[_0x5f72('0x8')][_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x31722d[_0x5f72('0x8')]['include'],function(_0x292bc9){return{'model':db[_0x292bc9['model']],'as':_0x292bc9['as'],'attributes':_0x292bc9['attributes'],'include':_0x292bc9[_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x292bc9[_0x5f72('0xb')],function(_0x134f63){return{'model':db[_0x134f63['model']],'as':_0x134f63['as'],'attributes':_0x134f63[_0x5f72('0xa')],'include':_0x134f63['include']?_[_0x5f72('0xc')](_0x134f63[_0x5f72('0xb')],function(_0x473f97){return{'model':db[_0x473f97[_0x5f72('0xd')]],'as':_0x473f97['as'],'attributes':_0x473f97['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f72('0xe')](function(_0x3710b6){logger[_0x5f72('0xf')](_0x5f72('0x5'),_0x31722d);logger[_0x5f72('0x10')]('GetCmHopper',_0x31722d,JSON['stringify'](_0x3710b6));_0x51e204(_0x3710b6);})['catch'](function(_0x379bb7){logger['error'](_0x5f72('0x5'),_0x379bb7[_0x5f72('0x11')],_0x31722d);_0x47e095(_0x28a13b[_0x5f72('0x12')](0x1f4,_0x379bb7['message']));});});};exports['ShowCmHopper']=function(_0x200959){var _0x39898f=this;return new Promise(function(_0x57b43f,_0x51958f){return db[_0x5f72('0x6')][_0x5f72('0x13')]({'raw':_0x200959[_0x5f72('0x8')]?_0x200959[_0x5f72('0x8')][_0x5f72('0x14')]===undefined?!![]:![]:!![],'where':_0x200959[_0x5f72('0x8')]?_0x200959[_0x5f72('0x8')][_0x5f72('0x9')]||null:null,'attributes':_0x200959[_0x5f72('0x8')]?_0x200959[_0x5f72('0x8')][_0x5f72('0xa')]||null:null,'include':_0x200959['options']?_0x200959[_0x5f72('0x8')][_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x200959[_0x5f72('0x8')][_0x5f72('0xb')],function(_0x59f662){return{'model':db[_0x59f662[_0x5f72('0xd')]],'as':_0x59f662['as'],'attributes':_0x59f662['attributes'],'include':_0x59f662[_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x59f662[_0x5f72('0xb')],function(_0x39428d){return{'model':db[_0x39428d[_0x5f72('0xd')]],'as':_0x39428d['as'],'attributes':_0x39428d['attributes'],'include':_0x39428d[_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x39428d['include'],function(_0x3af16f){return{'model':db[_0x3af16f['model']],'as':_0x3af16f['as'],'attributes':_0x3af16f['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f72('0xe')](function(_0x16e40b){logger[_0x5f72('0xf')](_0x5f72('0x15'),_0x200959);logger[_0x5f72('0x10')](_0x5f72('0x15'),_0x200959,JSON[_0x5f72('0x16')](_0x16e40b));_0x57b43f(_0x16e40b);})[_0x5f72('0x17')](function(_0x4c9ce5){logger[_0x5f72('0x12')](_0x5f72('0x15'),_0x4c9ce5['message'],_0x200959);_0x51958f(_0x39898f[_0x5f72('0x12')](0x1f4,_0x4c9ce5[_0x5f72('0x11')]));});});};exports[_0x5f72('0x18')]=function(_0xb8548d){var _0x5eeea9=this;return new Promise(function(_0xa182ca,_0x26cf4f){return db[_0x5f72('0x6')][_0x5f72('0x19')](_0xb8548d[_0x5f72('0x1a')],{'raw':_0xb8548d['options']?_0xb8548d['options'][_0x5f72('0x14')]===undefined?!![]:![]:!![]})[_0x5f72('0xe')](function(_0x19ad35){logger[_0x5f72('0xf')](_0x5f72('0x18'),_0xb8548d);logger['debug'](_0x5f72('0x18'),_0xb8548d,JSON[_0x5f72('0x16')](_0x19ad35));_0xa182ca(_0x19ad35);})[_0x5f72('0x17')](function(_0x3ea194){logger[_0x5f72('0x12')](_0x5f72('0x18'),_0x3ea194[_0x5f72('0x11')],_0xb8548d);_0x26cf4f(_0x5eeea9[_0x5f72('0x12')](0x1f4,_0x3ea194[_0x5f72('0x11')]));});});};exports[_0x5f72('0x1b')]=function(_0x44be81){var _0x216bba=this;return new Promise(function(_0xf4d8b,_0xddb45c){return db['CmHopper']['update'](_0x44be81['body'],{'raw':_0x44be81[_0x5f72('0x8')]?_0x44be81[_0x5f72('0x8')][_0x5f72('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x44be81[_0x5f72('0x8')]?_0x44be81[_0x5f72('0x8')][_0x5f72('0x9')]||null:null,'attributes':_0x44be81[_0x5f72('0x8')]?_0x44be81[_0x5f72('0x8')]['attributes']||null:null,'limit':_0x44be81[_0x5f72('0x8')]?_0x44be81['options'][_0x5f72('0x1c')]||null:null})[_0x5f72('0xe')](function(_0x60e1d5){logger[_0x5f72('0xf')]('UpdateCmHopper',_0x44be81);logger[_0x5f72('0xf')](_0x5f72('0x1d'),JSON[_0x5f72('0x16')](_0x44be81[_0x5f72('0x8')][_0x5f72('0x9')]),_0x44be81[_0x5f72('0x1a')][_0x5f72('0x1e')]);logger[_0x5f72('0x10')](_0x5f72('0x1b'),_0x44be81,JSON[_0x5f72('0x16')](_0x60e1d5));_0xf4d8b(_0x60e1d5);})[_0x5f72('0x17')](function(_0x5bb804){logger[_0x5f72('0x12')](_0x5f72('0x1b'),_0x5bb804[_0x5f72('0x11')],_0x44be81);_0xddb45c(_0x216bba[_0x5f72('0x12')](0x1f4,_0x5bb804[_0x5f72('0x11')]));});});};exports[_0x5f72('0x1f')]=function(_0x125d1c){var _0x483168=this;return new Promise(function(_0x34715b,_0x20325f){return db[_0x5f72('0x6')]['destroy']({'where':_0x125d1c[_0x5f72('0x8')]?_0x125d1c[_0x5f72('0x8')][_0x5f72('0x9')]||null:null})['then'](function(_0x4d50c1){logger[_0x5f72('0xf')](_0x5f72('0x1f'),_0x125d1c);logger[_0x5f72('0x10')]('DestroyCmHopper',_0x125d1c,JSON[_0x5f72('0x16')](_0x4d50c1));_0x34715b(_0x4d50c1);})[_0x5f72('0x17')](function(_0x3649b6){logger['error']('DestroyCmHopper',_0x3649b6[_0x5f72('0x11')],_0x125d1c);_0x20325f(_0x483168[_0x5f72('0x12')](0x1f4,_0x3649b6['message']));});});};exports[_0x5f72('0x20')]=function(_0x4313c4){var _0x958ab7=this;return new Promise(function(_0x3aa314,_0x27e04a){return db['CmContact'][_0x5f72('0x21')]()[_0x5f72('0xe')](function(_0x2b9918){return db[_0x5f72('0x22')][_0x5f72('0x23')](function(_0x1bf910){return db['CmHopper']['findAll']({'where':_0x4313c4[_0x5f72('0x8')]?_0x4313c4[_0x5f72('0x8')][_0x5f72('0x9')]||null:null,'attributes':_0x4313c4[_0x5f72('0x8')]?_0x4313c4['options'][_0x5f72('0xa')]||null:null,'limit':_0x4313c4[_0x5f72('0x8')]?_0x4313c4['options'][_0x5f72('0x1c')]||null:null,'order':_0x4313c4[_0x5f72('0x8')]?_0x4313c4[_0x5f72('0x8')][_0x5f72('0x24')]||null:null,'transaction':_0x1bf910,'lock':_0x1bf910[_0x5f72('0x25')][_0x5f72('0x26')],'include':[{'model':db[_0x5f72('0x27')],'as':'Contact','attributes':_[_0x5f72('0x28')](_0x2b9918)},{'model':db[_0x5f72('0x29')],'as':_0x5f72('0x2a'),'attributes':['id',_0x5f72('0x2b'),_0x5f72('0x2c')]}]})[_0x5f72('0xe')](function(_0x2e5dbb){var _0x5ccd3c=[];var _0x12bd91=[];for(var _0x2abf49=0x0;_0x2abf49<_0x2e5dbb[_0x5f72('0x2d')];_0x2abf49+=0x1){var _0x4d3411=_0x2e5dbb[_0x2abf49][_0x5f72('0x2e')];if(_0x4d3411===null){_0x5ccd3c[_0x5f72('0x2f')](_0x2e5dbb[_0x2abf49][_0x5f72('0x30')](_0x4313c4[_0x5f72('0x1a')],{'transaction':_0x1bf910}));}else if(!_0x12bd91[_0x5f72('0x31')](_0x4d3411)){_0x12bd91[_0x5f72('0x2f')](_0x4d3411);_0x5ccd3c[_0x5f72('0x2f')](_0x2e5dbb[_0x2abf49][_0x5f72('0x30')](_0x4313c4[_0x5f72('0x1a')],{'transaction':_0x1bf910}));}}return BPromise['all'](_0x5ccd3c);});})[_0x5f72('0xe')](function(_0x5709e3){logger[_0x5f72('0xf')](_0x5f72('0x20'),_0x4313c4);if(_0x5709e3[_0x5f72('0x2d')]>0x0){logger[_0x5f72('0xf')](_0x5f72('0x32'),_0x5709e3[0x0][_0x5f72('0x33')]['id'],_0x5709e3[0x0][_0x5f72('0x33')][_0x5f72('0x34')],_0x5709e3[0x0][_0x5f72('0x33')][_0x5f72('0x1e')]);}logger[_0x5f72('0x10')](_0x5f72('0x20'),_0x4313c4,JSON[_0x5f72('0x16')](_0x5709e3));_0x3aa314(_0x5709e3);})[_0x5f72('0x17')](function(_0x127492){logger[_0x5f72('0x12')](_0x5f72('0x20'),_0x127492[_0x5f72('0x11')],_0x4313c4);_0x27e04a(_0x958ab7[_0x5f72('0x12')](0x1f4,_0x127492['message']));});});});};exports[_0x5f72('0x35')]=function(_0x4e939b){var _0x533636=this;return new Promise(function(_0xde2439,_0x207120){return db['sequelize'][_0x5f72('0x23')](function(_0x4b9170){return db[_0x5f72('0x36')][_0x5f72('0x19')](_0x4e939b['body'],{'raw':_0x4e939b['options']?_0x4e939b[_0x5f72('0x8')][_0x5f72('0x14')]===undefined?!![]:![]:!![],'transaction':_0x4b9170})['then'](function(){logger[_0x5f72('0xf')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x4e939b[_0x5f72('0x8')][_0x5f72('0x9')]),_0x4e939b[_0x5f72('0x8')][_0x5f72('0x9')][_0x5f72('0x1e')]);return db[_0x5f72('0x6')][_0x5f72('0x37')]({'where':_0x4e939b[_0x5f72('0x8')]?_0x4e939b[_0x5f72('0x8')][_0x5f72('0x9')]||null:null,'transaction':_0x4b9170});});})['then'](function(_0x2f3d73){logger['info'](_0x5f72('0x35'),_0x4e939b);logger['debug'](_0x5f72('0x35'),_0x4e939b,JSON[_0x5f72('0x16')](_0x2f3d73));_0xde2439(_0x2f3d73);})[_0x5f72('0x17')](function(_0x3aa2b1){logger['error']('MoveContactManagedDialer',_0x3aa2b1[_0x5f72('0x11')],_0x4e939b);_0x207120(_0x533636['error'](0x1f4,_0x3aa2b1[_0x5f72('0x11')]));});});};exports['CountReScheduled']=function(_0x3a30f9){var _0x41f867=this;return new Promise(function(_0xab111e,_0x4d53cc){return db[_0x5f72('0x6')][_0x5f72('0x7')]({'raw':_0x3a30f9[_0x5f72('0x8')]?_0x3a30f9['options'][_0x5f72('0x14')]===undefined?!![]:![]:!![],'where':_0x3a30f9[_0x5f72('0x8')]?_0x3a30f9['options'][_0x5f72('0x9')]||null:null,'attributes':[[db[_0x5f72('0x22')]['fn'](_0x5f72('0x38'),db[_0x5f72('0x22')]['fn']('IF',db[_0x5f72('0x22')][_0x5f72('0x39')](_0x5f72('0x3a')+util[_0x5f72('0x3b')](_0x5f72('0x3c'),moment()[_0x5f72('0x3b')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x5f72('0x3d')))),_0x5f72('0x3e')]]})['then'](function(_0x8dff2f){logger[_0x5f72('0xf')](_0x5f72('0x3f'),_0x3a30f9);logger[_0x5f72('0x10')](_0x5f72('0x3f'),_0x3a30f9,JSON[_0x5f72('0x16')](_0x8dff2f));_0xab111e(_0x8dff2f);})['catch'](function(_0x510efe){logger[_0x5f72('0x12')]('CountReScheduled',_0x510efe[_0x5f72('0x11')],_0x3a30f9);_0x4d53cc(_0x41f867[_0x5f72('0x12')](0x1f4,_0x510efe[_0x5f72('0x11')]));});});};exports[_0x5f72('0x40')]=function(_0x45f4aa){var _0x1c6dad=this;return new Promise(function(_0x197071,_0x2319ff){return db[_0x5f72('0x27')][_0x5f72('0x21')]()['then'](function(){return db[_0x5f72('0x22')][_0x5f72('0x23')](function(_0x55dd89){return db[_0x5f72('0x6')]['findAll']({'where':_0x45f4aa[_0x5f72('0x8')]?_0x45f4aa[_0x5f72('0x8')]['where']||null:null,'attributes':_0x45f4aa[_0x5f72('0x8')]?_0x45f4aa[_0x5f72('0x8')][_0x5f72('0xa')]||null:null,'limit':0x1,'order':_0x45f4aa[_0x5f72('0x8')]?_0x45f4aa[_0x5f72('0x8')]['order']||null:null,'group':db[_0x5f72('0x6')][_0x5f72('0x2e')],'transaction':_0x55dd89,'lock':_0x55dd89['LOCK'][_0x5f72('0x26')],'include':_0x45f4aa['options']?_0x45f4aa[_0x5f72('0x8')][_0x5f72('0xb')]?_['map'](_0x45f4aa[_0x5f72('0x8')][_0x5f72('0xb')],function(_0x135e80){return{'model':db[_0x135e80[_0x5f72('0xd')]],'as':_0x135e80['as'],'attributes':_0x135e80[_0x5f72('0xa')],'include':_0x135e80[_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x135e80[_0x5f72('0xb')],function(_0xe47b46){return{'model':db[_0xe47b46['model']],'as':_0xe47b46['as'],'attributes':_0xe47b46['attributes'],'include':_0xe47b46[_0x5f72('0xb')]?_['map'](_0xe47b46[_0x5f72('0xb')],function(_0x56a265){return{'model':db[_0x56a265[_0x5f72('0xd')]],'as':_0x56a265['as'],'attributes':_0x56a265['attributes']};}):[]};}):[]};}):[]:[]})[_0x5f72('0xe')](function(_0x9ae1d1){var _0xfaf62d=[];for(var _0x597d6f=0x0;_0x597d6f<_0x9ae1d1[_0x5f72('0x2d')];_0x597d6f+=0x1){_0xfaf62d[_0x5f72('0x2f')](_0x9ae1d1[_0x597d6f]['update'](_0x45f4aa[_0x5f72('0x1a')],{'transaction':_0x55dd89}));}return BPromise[_0x5f72('0x41')](_0xfaf62d);});})[_0x5f72('0xe')](function(_0x25df47){logger[_0x5f72('0xf')]('GetContactRecallMe',_0x45f4aa);logger[_0x5f72('0x10')](_0x5f72('0x40'),_0x45f4aa,JSON[_0x5f72('0x16')](_0x25df47));_0x197071(_0x25df47);})[_0x5f72('0x17')](function(_0x12bc23){logger[_0x5f72('0x12')](_0x5f72('0x40'),_0x12bc23[_0x5f72('0x11')],_0x45f4aa);_0x2319ff(_0x1c6dad[_0x5f72('0x12')](0x1f4,_0x12bc23[_0x5f72('0x11')]));});});});};exports['GetCmHopperPreview']=function(_0x4727d9){var _0xd71502=this;return new Promise(function(_0x4e1f53,_0x525ca5){db[_0x5f72('0x27')][_0x5f72('0x21')]()[_0x5f72('0xe')](function(_0x4e9305){return db[_0x5f72('0x6')]['findAll']({'raw':_0x4727d9[_0x5f72('0x8')]?_0x4727d9[_0x5f72('0x8')][_0x5f72('0x14')]===undefined?!![]:![]:!![],'where':_0x4727d9[_0x5f72('0x8')]?_0x4727d9[_0x5f72('0x8')]['where']||null:null,'attributes':_0x4727d9[_0x5f72('0x8')]?_0x4727d9[_0x5f72('0x8')][_0x5f72('0xa')]||null:null,'limit':_0x4727d9[_0x5f72('0x8')]?_0x4727d9[_0x5f72('0x8')][_0x5f72('0x1c')]||null:null,'include':_0x4727d9[_0x5f72('0x8')]?_0x4727d9[_0x5f72('0x8')][_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x4727d9[_0x5f72('0x8')]['include'],function(_0x1550d3){return{'model':db[_0x1550d3[_0x5f72('0xd')]],'as':_0x1550d3['as'],'attributes':_0x1550d3['as']===_0x5f72('0x42')?_[_0x5f72('0x28')](_0x4e9305):_0x1550d3['attributes'],'include':_0x1550d3[_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x1550d3['include'],function(_0x1dc35c){return{'model':db[_0x1dc35c[_0x5f72('0xd')]],'as':_0x1dc35c['as'],'attributes':_0x1dc35c[_0x5f72('0xa')],'include':_0x1dc35c[_0x5f72('0xb')]?_[_0x5f72('0xc')](_0x1dc35c[_0x5f72('0xb')],function(_0x3fae4a){return{'model':db[_0x3fae4a[_0x5f72('0xd')]],'as':_0x3fae4a['as'],'attributes':_0x3fae4a[_0x5f72('0xa')]};}):[]};}):[]};}):[]:[]})[_0x5f72('0xe')](function(_0x3978bf){logger[_0x5f72('0xf')]('GetCmHopper',_0x4727d9);logger[_0x5f72('0x10')](_0x5f72('0x5'),_0x4727d9,JSON[_0x5f72('0x16')](_0x3978bf));_0x4e1f53(_0x3978bf);})['catch'](function(_0x514796){logger[_0x5f72('0x12')](_0x5f72('0x5'),_0x514796[_0x5f72('0x11')],_0x4727d9);_0x525ca5(_0xd71502[_0x5f72('0x12')](0x1f4,_0x514796[_0x5f72('0x11')]));});});});};exports[_0x5f72('0x43')]=function(_0x378da1){var _0x4d45e5=this;return new Promise(function(_0x3722e6,_0x346822){return db['CmContact'][_0x5f72('0x44')]({'raw':!![],'where':{'phone':_0x378da1[_0x5f72('0x8')][_0x5f72('0x9')][_0x5f72('0x45')]},'attributes':['id',_0x5f72('0x46')],'order':[['id','DESC']]})[_0x5f72('0xe')](function(_0x4b6b9f){logger[_0x5f72('0xf')]('getContactByPhone',_0x378da1);logger[_0x5f72('0x10')](_0x5f72('0x47'),_0x378da1,JSON[_0x5f72('0x16')](_0x4b6b9f));_0x3722e6(_0x4b6b9f);})[_0x5f72('0x17')](function(_0x19dccb){logger[_0x5f72('0x12')](_0x5f72('0x47'),_0x19dccb[_0x5f72('0x11')],_0x378da1);_0x346822(_0x4d45e5['error'](0x1f4,_0x19dccb['message']));});});};exports['ResetActiveCalls']=function(_0x120a0b){var _0x455e4d=this;return new Promise(function(_0x2f74fa,_0x305c03){return db[_0x5f72('0x22')]['transaction'](function(_0x59f1d6){var _0x46f5be=_0x120a0b[_0x5f72('0x8')]&&_0x120a0b[_0x5f72('0x8')][_0x5f72('0x9')]?_0x120a0b[_0x5f72('0x8')][_0x5f72('0x9')]:{};return db[_0x5f72('0x6')]['update'](_0x120a0b['body'],{'where':_0x46f5be,'transaction':_0x59f1d6})[_0x5f72('0xe')](function(_0x3ebf61){logger['info'](_0x5f72('0x48'),_0x120a0b);logger['debug'](_0x5f72('0x48'),_0x120a0b,JSON[_0x5f72('0x16')](_0x3ebf61));_0x2f74fa(_0x3ebf61);})[_0x5f72('0x17')](function(_0x170df7){logger[_0x5f72('0x12')]('ResetActiveCalls',_0x170df7['message'],_0x120a0b);_0x305c03(_0x455e4d[_0x5f72('0x12')](0x1f4,_0x170df7['message']));});});});};exports[_0x5f72('0x49')]=function(_0x205eb6){var _0x6d62c7=this;var _0x255084=_0x205eb6[_0x5f72('0x1a')][_0x5f72('0x9')][_0x5f72('0x4a')];var _0x391af4=_0x205eb6[_0x5f72('0x1a')][_0x5f72('0x9')][_0x5f72('0x4b')];var _0x16dfd1=_0x205eb6['body'][_0x5f72('0x9')][_0x5f72('0x4c')];return new Promise(function(_0x170530,_0x4e271f){return db[_0x5f72('0x6')][_0x5f72('0x7')]({'where':{'voiceQueueId':{'$in':_0x255084},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db['sequelize']['literal'](_0x5f72('0x4d')+_0x391af4+'\x20MINUTE'),'$gt':db[_0x5f72('0x22')]['literal'](_0x5f72('0x4e'))}},'UserId':{'$in':_0x16dfd1}},'include':[{'model':db[_0x5f72('0x27')],'as':_0x5f72('0x42')},{'model':db[_0x5f72('0x29')],'as':'Agent','attributes':['id',_0x5f72('0x2b'),'voicePause']},{'model':db[_0x5f72('0x4f')],'as':_0x5f72('0x50')}]})['then'](function(_0x2f1ed9){if(_0x2f1ed9[_0x5f72('0x2d')]>0x0){return db[_0x5f72('0x22')][_0x5f72('0x23')](function(_0x40dde1){return db['CmHopper'][_0x5f72('0x30')]({'recallmeNotifiedDate':db[_0x5f72('0x22')][_0x5f72('0x39')](_0x5f72('0x4e'))},{'where':{'id':{'$in':_[_0x5f72('0xc')](_0x2f1ed9,'id')}},'transaction':_0x40dde1})['then'](function(){_0x170530(_0x2f1ed9);})[_0x5f72('0x17')](function(_0x1d93f4){logger['error'](_0x5f72('0x49'),_0x1d93f4[_0x5f72('0x11')],_0x205eb6);_0x4e271f(_0x6d62c7[_0x5f72('0x12')](0x1f4,_0x1d93f4['message']));});})[_0x5f72('0x17')](function(_0x4280b7){logger[_0x5f72('0x12')](_0x5f72('0x49'),_0x4280b7[_0x5f72('0x11')],_0x205eb6);_0x4e271f(_0x6d62c7['error'](0x1f4,_0x4280b7[_0x5f72('0x11')]));});}else{_0x170530(_0x2f1ed9);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index c81c721..f1fb0d8 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 _0x9fe2=['/preview','getPreview','/timezone','getTimezone','/:id','update','delete','destroy','exports','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/timezones','getTimezones','/:id/previewrecall','create','post'];(function(_0x114c1c,_0x5bfd6d){var _0x50a0a6=function(_0x4f97f0){while(--_0x4f97f0){_0x114c1c['push'](_0x114c1c['shift']());}};_0x50a0a6(++_0x5bfd6d);}(_0x9fe2,0x189));var _0x29fe=function(_0x1d4bb9,_0x2f0617){_0x1d4bb9=_0x1d4bb9-0x0;var _0x16cf96=_0x9fe2[_0x1d4bb9];return _0x16cf96;};'use strict';var express=require(_0x29fe('0x0'));var router=express[_0x29fe('0x1')]();var auth=require(_0x29fe('0x2'));var controller=require('./cmHopper.controller');router[_0x29fe('0x3')]('/',auth[_0x29fe('0x4')](),controller[_0x29fe('0x5')]);router[_0x29fe('0x3')](_0x29fe('0x6'),auth['isAuthenticated'](),controller[_0x29fe('0x7')]);router[_0x29fe('0x3')](_0x29fe('0x8'),auth[_0x29fe('0x4')](),controller[_0x29fe('0x9')]);router[_0x29fe('0x3')](_0x29fe('0xa'),auth['isAuthenticated'](),controller[_0x29fe('0xb')]);router[_0x29fe('0x3')]('/:id',auth[_0x29fe('0x4')](),controller['show']);router['get'](_0x29fe('0xc'),auth[_0x29fe('0x4')](),controller['getPreviewRecall']);router['post']('/',auth[_0x29fe('0x4')](),controller[_0x29fe('0xd')]);router[_0x29fe('0xe')](_0x29fe('0xf'),auth[_0x29fe('0x4')](),controller[_0x29fe('0x10')]);router[_0x29fe('0xe')](_0x29fe('0x11'),auth[_0x29fe('0x4')](),controller[_0x29fe('0x12')]);router['put'](_0x29fe('0x13'),auth[_0x29fe('0x4')](),controller[_0x29fe('0x14')]);router[_0x29fe('0x15')]('/:id',auth[_0x29fe('0x4')](),controller[_0x29fe('0x16')]);module[_0x29fe('0x17')]=router; \ No newline at end of file +var _0xfe60=['getOpenContacts','/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','post','create','/preview','getPreview','getTimezone','put','update','delete','destroy','exports','express','Router','../../components/auth/service','./cmHopper.controller','get','index','/describe','isAuthenticated'];(function(_0x35aa5c,_0x2b7f6e){var _0xd6d1b6=function(_0x48d58c){while(--_0x48d58c){_0x35aa5c['push'](_0x35aa5c['shift']());}};_0xd6d1b6(++_0x2b7f6e);}(_0xfe60,0x75));var _0x0fe6=function(_0x1ff3ec,_0x319426){_0x1ff3ec=_0x1ff3ec-0x0;var _0x5a9385=_0xfe60[_0x1ff3ec];return _0x5a9385;};'use strict';var express=require(_0x0fe6('0x0'));var router=express[_0x0fe6('0x1')]();var auth=require(_0x0fe6('0x2'));var controller=require(_0x0fe6('0x3'));router[_0x0fe6('0x4')]('/',auth['isAuthenticated'](),controller[_0x0fe6('0x5')]);router[_0x0fe6('0x4')](_0x0fe6('0x6'),auth[_0x0fe6('0x7')](),controller['describe']);router[_0x0fe6('0x4')]('/opencontacts',auth[_0x0fe6('0x7')](),controller[_0x0fe6('0x8')]);router[_0x0fe6('0x4')](_0x0fe6('0x9'),auth[_0x0fe6('0x7')](),controller[_0x0fe6('0xa')]);router['get'](_0x0fe6('0xb'),auth[_0x0fe6('0x7')](),controller[_0x0fe6('0xc')]);router[_0x0fe6('0x4')](_0x0fe6('0xd'),auth[_0x0fe6('0x7')](),controller[_0x0fe6('0xe')]);router[_0x0fe6('0xf')]('/',auth[_0x0fe6('0x7')](),controller[_0x0fe6('0x10')]);router[_0x0fe6('0xf')](_0x0fe6('0x11'),auth[_0x0fe6('0x7')](),controller[_0x0fe6('0x12')]);router[_0x0fe6('0xf')]('/timezone',auth['isAuthenticated'](),controller[_0x0fe6('0x13')]);router[_0x0fe6('0x14')]('/:id',auth[_0x0fe6('0x7')](),controller[_0x0fe6('0x15')]);router[_0x0fe6('0x16')](_0x0fe6('0xb'),auth['isAuthenticated'](),controller[_0x0fe6('0x17')]);module[_0x0fe6('0x18')]=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index c0435e2..f2f999a 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 _0xaa71=['sequelize','exports','INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment'];(function(_0x22dd2b,_0x3b116a){var _0x2c816c=function(_0x4f2765){while(--_0x4f2765){_0x22dd2b['push'](_0x22dd2b['shift']());}};_0x2c816c(++_0x3b116a);}(_0xaa71,0xae));var _0x1aa7=function(_0x1ed65d,_0x2e344e){_0x1ed65d=_0x1ed65d-0x0;var _0x96d5f2=_0xaa71[_0x1ed65d];return _0x96d5f2;};'use strict';var moment=require(_0x1aa7('0x0'));var Sequelize=require(_0x1aa7('0x1'));module[_0x1aa7('0x2')]={'CmHopperId':{'type':Sequelize[_0x1aa7('0x3')]},'phone':{'type':Sequelize[_0x1aa7('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x1aa7('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x1aa7('0x5')],'defaultValue':moment()['format'](_0x1aa7('0x6'))},'countbusyretry':{'type':Sequelize[_0x1aa7('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x1aa7('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x1aa7('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x1aa7('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1aa7('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x1aa7('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xb527=['exports','INTEGER','STRING','DATE','YYYY-MM-DD\x20HH:mm:ss','moment','sequelize'];(function(_0x3e3432,_0xa18f5f){var _0x10bb36=function(_0x18808e){while(--_0x18808e){_0x3e3432['push'](_0x3e3432['shift']());}};_0x10bb36(++_0xa18f5f);}(_0xb527,0x116));var _0x7b52=function(_0xfdc98e,_0x3f3e0e){_0xfdc98e=_0xfdc98e-0x0;var _0x5b0307=_0xb527[_0xfdc98e];return _0x5b0307;};'use strict';var moment=require(_0x7b52('0x0'));var Sequelize=require(_0x7b52('0x1'));module[_0x7b52('0x2')]={'CmHopperId':{'type':Sequelize[_0x7b52('0x3')]},'phone':{'type':Sequelize[_0x7b52('0x4')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x7b52('0x3')],'defaultValue':0x0},'scheduledat':{'type':Sequelize[_0x7b52('0x5')],'defaultValue':moment()['format'](_0x7b52('0x6'))},'countbusyretry':{'type':Sequelize[_0x7b52('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x7b52('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x7b52('0x3')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x7b52('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x7b52('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x7b52('0x3')],'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 82e70bf..f2aa55a 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 _0x9cf5=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','get','CmHopperAdditionalPhones','UserProfileResource','error','name','CmHopperAdditionalPhone','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','VIRTUAL','merge','options','includeAll','include','catch','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format'];(function(_0x21d2b5,_0x3dea6c){var _0x4e5991=function(_0xb9aca1){while(--_0xb9aca1){_0x21d2b5['push'](_0x21d2b5['shift']());}};_0x4e5991(++_0x3dea6c);}(_0x9cf5,0x180));var _0x59cf=function(_0x10c35f,_0x33d9b7){_0x10c35f=_0x10c35f-0x0;var _0x144ada=_0x9cf5[_0x10c35f];return _0x144ada;};'use strict';var emlformat=require(_0x59cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x59cf('0x1'));var jsonpatch=require(_0x59cf('0x2'));var rp=require(_0x59cf('0x3'));var moment=require(_0x59cf('0x4'));var BPromise=require(_0x59cf('0x5'));var Mustache=require(_0x59cf('0x6'));var util=require(_0x59cf('0x7'));var path=require(_0x59cf('0x8'));var sox=require(_0x59cf('0x9'));var csv=require('to-csv');var ejs=require(_0x59cf('0xa'));var fs=require('fs');var fs_extra=require(_0x59cf('0xb'));var _=require(_0x59cf('0xc'));var squel=require(_0x59cf('0xd'));var crypto=require(_0x59cf('0xe'));var jsforce=require(_0x59cf('0xf'));var deskjs=require(_0x59cf('0x10'));var toCsv=require(_0x59cf('0x11'));var querystring=require(_0x59cf('0x12'));var Papa=require(_0x59cf('0x13'));var Redis=require(_0x59cf('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x59cf('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x59cf('0x16'))('api');var utils=require(_0x59cf('0x17'));var config=require(_0x59cf('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x357628,_0x1e05fe){_0x1e05fe=_0x1e05fe||0xcc;return function(_0x26deb0){if(_0x26deb0){return _0x357628[_0x59cf('0x19')](_0x1e05fe);}return _0x357628[_0x59cf('0x1a')](_0x1e05fe)[_0x59cf('0x1b')]();};}function respondWithResult(_0x56af73,_0x4e40ab){_0x4e40ab=_0x4e40ab||0xc8;return function(_0x57ea74){if(_0x57ea74){return _0x56af73[_0x59cf('0x1a')](_0x4e40ab)[_0x59cf('0x1c')](_0x57ea74);}};}function respondWithFilteredResult(_0x2d9891,_0x132d5f){return function(_0x26fcbd){if(_0x26fcbd){var _0x42ac08=typeof _0x132d5f[_0x59cf('0x1d')]===_0x59cf('0x1e')&&typeof _0x132d5f[_0x59cf('0x1f')]===_0x59cf('0x1e');var _0x3f7ff3=_0x26fcbd[_0x59cf('0x20')];var _0x539bab=_0x42ac08?0x0:_0x132d5f[_0x59cf('0x1d')];var _0x5f4125=_0x42ac08?_0x26fcbd['count']:_0x132d5f[_0x59cf('0x1d')]+_0x132d5f['limit'];var _0x525bff;if(_0x5f4125>=_0x3f7ff3){_0x5f4125=_0x3f7ff3;_0x525bff=0xc8;}else{_0x525bff=0xce;}_0x2d9891[_0x59cf('0x1a')](_0x525bff);return _0x2d9891[_0x59cf('0x21')]('Content-Range',_0x539bab+'-'+_0x5f4125+'/'+_0x3f7ff3)[_0x59cf('0x1c')](_0x26fcbd);}return null;};}function patchUpdates(_0x4b73f9){return function(_0x56842d){try{jsonpatch[_0x59cf('0x22')](_0x56842d,_0x4b73f9,!![]);}catch(_0x532b3e){return BPromise['reject'](_0x532b3e);}return _0x56842d[_0x59cf('0x23')]();};}function saveUpdates(_0x4d2c7c,_0xd99678){return function(_0x275ce0){if(_0x275ce0){return _0x275ce0[_0x59cf('0x24')](_0x4d2c7c)[_0x59cf('0x25')](function(_0x1c9524){return _0x1c9524;});}return null;};}function removeEntity(_0x19de4a,_0x3f684d){return function(_0x3034e9){if(_0x3034e9){return _0x3034e9[_0x59cf('0x26')]()[_0x59cf('0x25')](function(){var _0x269dee=_0x3034e9[_0x59cf('0x27')]({'plain':!![]});var _0x5237b7=_0x59cf('0x28');return db[_0x59cf('0x29')][_0x59cf('0x26')]({'where':{'type':_0x5237b7,'resourceId':_0x269dee['id']}})['then'](function(){return _0x3034e9;});})[_0x59cf('0x25')](function(){_0x19de4a[_0x59cf('0x1a')](0xcc)[_0x59cf('0x1b')]();});}};}function handleEntityNotFound(_0x46821f,_0x539799){return function(_0x362efb){if(!_0x362efb){_0x46821f[_0x59cf('0x19')](0x194);}return _0x362efb;};}function handleError(_0x3c5693,_0x5de512){_0x5de512=_0x5de512||0x1f4;return function(_0x556fde){logger[_0x59cf('0x2a')](_0x556fde['stack']);if(_0x556fde[_0x59cf('0x2b')]){delete _0x556fde[_0x59cf('0x2b')];}_0x3c5693[_0x59cf('0x1a')](_0x5de512)['send'](_0x556fde);};}exports['index']=function(_0x17c179,_0x38a80f){var _0x160e61={},_0x4d056b={},_0x231928={'count':0x0,'rows':[]};var _0x485824=_['map'](db[_0x59cf('0x2c')][_0x59cf('0x2d')],function(_0x4e0a6f){return{'name':_0x4e0a6f[_0x59cf('0x2e')],'type':_0x4e0a6f[_0x59cf('0x2f')]['key']};});_0x4d056b['model']=_[_0x59cf('0x30')](_0x485824,_0x59cf('0x2b'));_0x4d056b[_0x59cf('0x31')]=_[_0x59cf('0x32')](_0x17c179[_0x59cf('0x31')]);_0x4d056b[_0x59cf('0x33')]=_[_0x59cf('0x34')](_0x4d056b[_0x59cf('0x35')],_0x4d056b[_0x59cf('0x31')]);_0x160e61[_0x59cf('0x36')]=_[_0x59cf('0x34')](_0x4d056b[_0x59cf('0x35')],qs[_0x59cf('0x37')](_0x17c179[_0x59cf('0x31')]['fields']));_0x160e61[_0x59cf('0x36')]=_0x160e61[_0x59cf('0x36')][_0x59cf('0x38')]?_0x160e61[_0x59cf('0x36')]:_0x4d056b['model'];if(!_0x17c179[_0x59cf('0x31')][_0x59cf('0x39')]('nolimit')){_0x160e61[_0x59cf('0x1f')]=qs[_0x59cf('0x1f')](_0x17c179[_0x59cf('0x31')][_0x59cf('0x1f')]);_0x160e61[_0x59cf('0x1d')]=qs[_0x59cf('0x1d')](_0x17c179[_0x59cf('0x31')]['offset']);}_0x160e61[_0x59cf('0x3a')]=qs[_0x59cf('0x3b')](_0x17c179['query'][_0x59cf('0x3b')]);_0x160e61[_0x59cf('0x3c')]=qs[_0x59cf('0x33')](_['pick'](_0x17c179['query'],_0x4d056b[_0x59cf('0x33')]),_0x485824);if(_0x17c179['query']['filter']){_0x160e61[_0x59cf('0x3c')]=_['merge'](_0x160e61[_0x59cf('0x3c')],{'$or':_[_0x59cf('0x30')](_0x485824,function(_0x11e237){if(_0x11e237[_0x59cf('0x2f')]!==_0x59cf('0x3d')){var _0xfe3e={};_0xfe3e[_0x11e237[_0x59cf('0x2b')]]={'$like':'%'+_0x17c179[_0x59cf('0x31')]['filter']+'%'};return _0xfe3e;}})});}_0x160e61=_[_0x59cf('0x3e')]({},_0x160e61,_0x17c179[_0x59cf('0x3f')]);var _0x41d8e6={'where':_0x160e61['where']};return db[_0x59cf('0x2c')]['count'](_0x41d8e6)[_0x59cf('0x25')](function(_0x25e319){_0x231928[_0x59cf('0x20')]=_0x25e319;if(_0x17c179[_0x59cf('0x31')][_0x59cf('0x40')]){_0x160e61[_0x59cf('0x41')]=[{'all':!![]}];}return db[_0x59cf('0x2c')]['findAll'](_0x160e61);})[_0x59cf('0x25')](function(_0xb6fa22){_0x231928['rows']=_0xb6fa22;return _0x231928;})[_0x59cf('0x25')](respondWithFilteredResult(_0x38a80f,_0x160e61))[_0x59cf('0x42')](handleError(_0x38a80f,null));};exports[_0x59cf('0x43')]=function(_0x99d051,_0x319a83){var _0x54f0bd={'raw':!![],'where':{'id':_0x99d051[_0x59cf('0x44')]['id']}},_0x5edca7={};_0x5edca7[_0x59cf('0x35')]=_['keys'](db[_0x59cf('0x2c')][_0x59cf('0x2d')]);_0x5edca7[_0x59cf('0x31')]=_[_0x59cf('0x32')](_0x99d051[_0x59cf('0x31')]);_0x5edca7[_0x59cf('0x33')]=_[_0x59cf('0x34')](_0x5edca7[_0x59cf('0x35')],_0x5edca7['query']);_0x54f0bd['attributes']=_[_0x59cf('0x34')](_0x5edca7[_0x59cf('0x35')],qs[_0x59cf('0x37')](_0x99d051[_0x59cf('0x31')][_0x59cf('0x37')]));_0x54f0bd['attributes']=_0x54f0bd[_0x59cf('0x36')][_0x59cf('0x38')]?_0x54f0bd[_0x59cf('0x36')]:_0x5edca7[_0x59cf('0x35')];if(_0x99d051[_0x59cf('0x31')][_0x59cf('0x40')]){_0x54f0bd[_0x59cf('0x41')]=[{'all':!![]}];}_0x54f0bd=_['merge']({},_0x54f0bd,_0x99d051[_0x59cf('0x3f')]);return db[_0x59cf('0x2c')]['find'](_0x54f0bd)[_0x59cf('0x25')](handleEntityNotFound(_0x319a83,null))[_0x59cf('0x25')](respondWithResult(_0x319a83,null))['catch'](handleError(_0x319a83,null));};exports[_0x59cf('0x45')]=function(_0x403221,_0x116e87){return db[_0x59cf('0x2c')][_0x59cf('0x45')](_0x403221['body'],{})[_0x59cf('0x25')](function(_0x299145){var _0x42b13a=_0x403221[_0x59cf('0x46')][_0x59cf('0x27')]({'plain':!![]});if(!_0x42b13a)throw new Error(_0x59cf('0x47'));if(_0x42b13a['role']===_0x59cf('0x46')){var _0x1314e3=_0x299145[_0x59cf('0x27')]({'plain':!![]});var _0x359cf4=_0x59cf('0x28');return db[_0x59cf('0x48')][_0x59cf('0x49')]({'where':{'name':_0x359cf4,'userProfileId':_0x42b13a['userProfileId']},'raw':!![]})[_0x59cf('0x25')](function(_0x4153a0){if(_0x4153a0&&_0x4153a0[_0x59cf('0x4a')]===0x0){return db['UserProfileResource'][_0x59cf('0x45')]({'name':_0x1314e3[_0x59cf('0x2b')],'resourceId':_0x1314e3['id'],'type':_0x4153a0[_0x59cf('0x2b')],'sectionId':_0x4153a0['id']},{})[_0x59cf('0x25')](function(){return _0x299145;});}else{return _0x299145;}})[_0x59cf('0x42')](function(_0x290b69){logger[_0x59cf('0x2a')](_0x59cf('0x4b'),_0x290b69);throw _0x290b69;});}return _0x299145;})[_0x59cf('0x25')](respondWithResult(_0x116e87,0xc9))[_0x59cf('0x42')](handleError(_0x116e87,null));};exports[_0x59cf('0x24')]=function(_0x4b9d6a,_0x2ba98b){if(_0x4b9d6a['body']['id']){delete _0x4b9d6a[_0x59cf('0x4c')]['id'];}return db[_0x59cf('0x2c')]['find']({'where':{'id':_0x4b9d6a[_0x59cf('0x44')]['id']}})[_0x59cf('0x25')](handleEntityNotFound(_0x2ba98b,null))[_0x59cf('0x25')](saveUpdates(_0x4b9d6a[_0x59cf('0x4c')],null))['then'](respondWithResult(_0x2ba98b,null))[_0x59cf('0x42')](handleError(_0x2ba98b,null));};exports[_0x59cf('0x26')]=function(_0xf8bf0a,_0x361cfc){return db['CmHopperAdditionalPhone'][_0x59cf('0x49')]({'where':{'id':_0xf8bf0a[_0x59cf('0x44')]['id']}})[_0x59cf('0x25')](handleEntityNotFound(_0x361cfc,null))['then'](removeEntity(_0x361cfc,null))[_0x59cf('0x42')](handleError(_0x361cfc,null));}; \ No newline at end of file +var _0xba08=['then','get','CmHopperAdditionalPhones','UserProfileResource','destroy','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','json','reject','update'];(function(_0xfa634c,_0x414e0e){var _0x73e478=function(_0xac2a51){while(--_0xac2a51){_0xfa634c['push'](_0xfa634c['shift']());}};_0x73e478(++_0x414e0e);}(_0xba08,0x188));var _0x8ba0=function(_0xb5a111,_0x25dd37){_0xb5a111=_0xb5a111-0x0;var _0x169f93=_0xba08[_0xb5a111];return _0x169f93;};'use strict';var emlformat=require(_0x8ba0('0x0'));var rimraf=require(_0x8ba0('0x1'));var zipdir=require(_0x8ba0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ba0('0x3'));var moment=require(_0x8ba0('0x4'));var BPromise=require(_0x8ba0('0x5'));var Mustache=require(_0x8ba0('0x6'));var util=require(_0x8ba0('0x7'));var path=require(_0x8ba0('0x8'));var sox=require(_0x8ba0('0x9'));var csv=require(_0x8ba0('0xa'));var ejs=require(_0x8ba0('0xb'));var fs=require('fs');var fs_extra=require(_0x8ba0('0xc'));var _=require(_0x8ba0('0xd'));var squel=require(_0x8ba0('0xe'));var crypto=require(_0x8ba0('0xf'));var jsforce=require(_0x8ba0('0x10'));var deskjs=require(_0x8ba0('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8ba0('0x12'));var Redis=require('ioredis');var authService=require(_0x8ba0('0x13'));var qs=require(_0x8ba0('0x14'));var as=require(_0x8ba0('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x8ba0('0x16'));var utils=require(_0x8ba0('0x17'));var config=require(_0x8ba0('0x18'));var licenseUtil=require(_0x8ba0('0x19'));var db=require(_0x8ba0('0x1a'))['db'];function respondWithStatusCode(_0x40c370,_0x4bee64){_0x4bee64=_0x4bee64||0xcc;return function(_0x2a2324){if(_0x2a2324){return _0x40c370[_0x8ba0('0x1b')](_0x4bee64);}return _0x40c370[_0x8ba0('0x1c')](_0x4bee64)[_0x8ba0('0x1d')]();};}function respondWithResult(_0x46a0bb,_0x1a5b96){_0x1a5b96=_0x1a5b96||0xc8;return function(_0x1097b5){if(_0x1097b5){return _0x46a0bb[_0x8ba0('0x1c')](_0x1a5b96)['json'](_0x1097b5);}};}function respondWithFilteredResult(_0x19dab2,_0x38878c){return function(_0x592577){if(_0x592577){var _0x4bd100=typeof _0x38878c[_0x8ba0('0x1e')]==='undefined'&&typeof _0x38878c['limit']===_0x8ba0('0x1f');var _0x5770be=_0x592577[_0x8ba0('0x20')];var _0x34b446=_0x4bd100?0x0:_0x38878c[_0x8ba0('0x1e')];var _0xee9121=_0x4bd100?_0x592577['count']:_0x38878c[_0x8ba0('0x1e')]+_0x38878c[_0x8ba0('0x21')];var _0x20e78e;if(_0xee9121>=_0x5770be){_0xee9121=_0x5770be;_0x20e78e=0xc8;}else{_0x20e78e=0xce;}_0x19dab2[_0x8ba0('0x1c')](_0x20e78e);return _0x19dab2[_0x8ba0('0x22')]('Content-Range',_0x34b446+'-'+_0xee9121+'/'+_0x5770be)[_0x8ba0('0x23')](_0x592577);}return null;};}function patchUpdates(_0x26b7bf){return function(_0x43b9d6){try{jsonpatch['apply'](_0x43b9d6,_0x26b7bf,!![]);}catch(_0x10130d){return BPromise[_0x8ba0('0x24')](_0x10130d);}return _0x43b9d6['save']();};}function saveUpdates(_0x30e1be,_0x53897a){return function(_0x493f76){if(_0x493f76){return _0x493f76[_0x8ba0('0x25')](_0x30e1be)[_0x8ba0('0x26')](function(_0x49a58a){return _0x49a58a;});}return null;};}function removeEntity(_0x7a6248,_0xc514a1){return function(_0x5e7cd6){if(_0x5e7cd6){return _0x5e7cd6['destroy']()[_0x8ba0('0x26')](function(){var _0xb5b016=_0x5e7cd6[_0x8ba0('0x27')]({'plain':!![]});var _0x716824=_0x8ba0('0x28');return db[_0x8ba0('0x29')][_0x8ba0('0x2a')]({'where':{'type':_0x716824,'resourceId':_0xb5b016['id']}})[_0x8ba0('0x26')](function(){return _0x5e7cd6;});})[_0x8ba0('0x26')](function(){_0x7a6248['status'](0xcc)[_0x8ba0('0x1d')]();});}};}function handleEntityNotFound(_0x5a0235,_0x1ec1a7){return function(_0x3f4532){if(!_0x3f4532){_0x5a0235[_0x8ba0('0x1b')](0x194);}return _0x3f4532;};}function handleError(_0xb1b310,_0x7e5555){_0x7e5555=_0x7e5555||0x1f4;return function(_0x5f1104){logger[_0x8ba0('0x2b')](_0x5f1104[_0x8ba0('0x2c')]);if(_0x5f1104[_0x8ba0('0x2d')]){delete _0x5f1104[_0x8ba0('0x2d')];}_0xb1b310['status'](_0x7e5555)[_0x8ba0('0x2e')](_0x5f1104);};}exports[_0x8ba0('0x2f')]=function(_0x3d0eb9,_0x18aec1){var _0x117d3d={},_0x1711be={},_0xf85df6={'count':0x0,'rows':[]};var _0x36f6f6=_[_0x8ba0('0x30')](db[_0x8ba0('0x31')][_0x8ba0('0x32')],function(_0x29535e){return{'name':_0x29535e[_0x8ba0('0x33')],'type':_0x29535e[_0x8ba0('0x34')][_0x8ba0('0x35')]};});_0x1711be['model']=_['map'](_0x36f6f6,'name');_0x1711be[_0x8ba0('0x36')]=_[_0x8ba0('0x37')](_0x3d0eb9['query']);_0x1711be['filters']=_[_0x8ba0('0x38')](_0x1711be[_0x8ba0('0x39')],_0x1711be[_0x8ba0('0x36')]);_0x117d3d[_0x8ba0('0x3a')]=_[_0x8ba0('0x38')](_0x1711be[_0x8ba0('0x39')],qs['fields'](_0x3d0eb9[_0x8ba0('0x36')][_0x8ba0('0x3b')]));_0x117d3d[_0x8ba0('0x3a')]=_0x117d3d['attributes'][_0x8ba0('0x3c')]?_0x117d3d[_0x8ba0('0x3a')]:_0x1711be[_0x8ba0('0x39')];if(!_0x3d0eb9['query']['hasOwnProperty'](_0x8ba0('0x3d'))){_0x117d3d[_0x8ba0('0x21')]=qs['limit'](_0x3d0eb9['query'][_0x8ba0('0x21')]);_0x117d3d[_0x8ba0('0x1e')]=qs[_0x8ba0('0x1e')](_0x3d0eb9[_0x8ba0('0x36')]['offset']);}_0x117d3d[_0x8ba0('0x3e')]=qs[_0x8ba0('0x3f')](_0x3d0eb9[_0x8ba0('0x36')]['sort']);_0x117d3d[_0x8ba0('0x40')]=qs[_0x8ba0('0x41')](_[_0x8ba0('0x42')](_0x3d0eb9[_0x8ba0('0x36')],_0x1711be[_0x8ba0('0x41')]),_0x36f6f6);if(_0x3d0eb9['query'][_0x8ba0('0x43')]){_0x117d3d[_0x8ba0('0x40')]=_[_0x8ba0('0x44')](_0x117d3d['where'],{'$or':_[_0x8ba0('0x30')](_0x36f6f6,function(_0x30613f){if(_0x30613f[_0x8ba0('0x34')]!==_0x8ba0('0x45')){var _0x1ed5d5={};_0x1ed5d5[_0x30613f[_0x8ba0('0x2d')]]={'$like':'%'+_0x3d0eb9['query']['filter']+'%'};return _0x1ed5d5;}})});}_0x117d3d=_[_0x8ba0('0x44')]({},_0x117d3d,_0x3d0eb9['options']);var _0x37fdc4={'where':_0x117d3d[_0x8ba0('0x40')]};return db[_0x8ba0('0x31')]['count'](_0x37fdc4)[_0x8ba0('0x26')](function(_0x2cc6d0){_0xf85df6[_0x8ba0('0x20')]=_0x2cc6d0;if(_0x3d0eb9['query'][_0x8ba0('0x46')]){_0x117d3d[_0x8ba0('0x47')]=[{'all':!![]}];}return db[_0x8ba0('0x31')][_0x8ba0('0x48')](_0x117d3d);})[_0x8ba0('0x26')](function(_0xdff783){_0xf85df6[_0x8ba0('0x49')]=_0xdff783;return _0xf85df6;})['then'](respondWithFilteredResult(_0x18aec1,_0x117d3d))[_0x8ba0('0x4a')](handleError(_0x18aec1,null));};exports[_0x8ba0('0x4b')]=function(_0x1694b9,_0x344c6d){var _0x547e23={'raw':!![],'where':{'id':_0x1694b9['params']['id']}},_0x27537d={};_0x27537d[_0x8ba0('0x39')]=_[_0x8ba0('0x37')](db[_0x8ba0('0x31')]['rawAttributes']);_0x27537d[_0x8ba0('0x36')]=_[_0x8ba0('0x37')](_0x1694b9[_0x8ba0('0x36')]);_0x27537d['filters']=_['intersection'](_0x27537d[_0x8ba0('0x39')],_0x27537d['query']);_0x547e23['attributes']=_[_0x8ba0('0x38')](_0x27537d[_0x8ba0('0x39')],qs[_0x8ba0('0x3b')](_0x1694b9[_0x8ba0('0x36')][_0x8ba0('0x3b')]));_0x547e23[_0x8ba0('0x3a')]=_0x547e23[_0x8ba0('0x3a')][_0x8ba0('0x3c')]?_0x547e23['attributes']:_0x27537d[_0x8ba0('0x39')];if(_0x1694b9[_0x8ba0('0x36')]['includeAll']){_0x547e23[_0x8ba0('0x47')]=[{'all':!![]}];}_0x547e23=_[_0x8ba0('0x44')]({},_0x547e23,_0x1694b9[_0x8ba0('0x4c')]);return db['CmHopperAdditionalPhone'][_0x8ba0('0x4d')](_0x547e23)['then'](handleEntityNotFound(_0x344c6d,null))[_0x8ba0('0x26')](respondWithResult(_0x344c6d,null))['catch'](handleError(_0x344c6d,null));};exports[_0x8ba0('0x4e')]=function(_0x364c34,_0x2176fc){return db[_0x8ba0('0x31')][_0x8ba0('0x4e')](_0x364c34[_0x8ba0('0x4f')],{})[_0x8ba0('0x26')](function(_0x2173b2){var _0x32de2d=_0x364c34['user'][_0x8ba0('0x27')]({'plain':!![]});if(!_0x32de2d)throw new Error(_0x8ba0('0x50'));if(_0x32de2d[_0x8ba0('0x51')]===_0x8ba0('0x52')){var _0x189527=_0x2173b2['get']({'plain':!![]});var _0x5210bb=_0x8ba0('0x28');return db[_0x8ba0('0x53')][_0x8ba0('0x4d')]({'where':{'name':_0x5210bb,'userProfileId':_0x32de2d['userProfileId']},'raw':!![]})['then'](function(_0x5e7277){if(_0x5e7277&&_0x5e7277['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x189527[_0x8ba0('0x2d')],'resourceId':_0x189527['id'],'type':_0x5e7277[_0x8ba0('0x2d')],'sectionId':_0x5e7277['id']},{})[_0x8ba0('0x26')](function(){return _0x2173b2;});}else{return _0x2173b2;}})[_0x8ba0('0x4a')](function(_0xafe0ea){logger['error'](_0x8ba0('0x54'),_0xafe0ea);throw _0xafe0ea;});}return _0x2173b2;})['then'](respondWithResult(_0x2176fc,0xc9))['catch'](handleError(_0x2176fc,null));};exports['update']=function(_0x4eda9e,_0x5d1cad){if(_0x4eda9e[_0x8ba0('0x4f')]['id']){delete _0x4eda9e[_0x8ba0('0x4f')]['id'];}return db['CmHopperAdditionalPhone'][_0x8ba0('0x4d')]({'where':{'id':_0x4eda9e[_0x8ba0('0x55')]['id']}})[_0x8ba0('0x26')](handleEntityNotFound(_0x5d1cad,null))[_0x8ba0('0x26')](saveUpdates(_0x4eda9e[_0x8ba0('0x4f')],null))['then'](respondWithResult(_0x5d1cad,null))[_0x8ba0('0x4a')](handleError(_0x5d1cad,null));};exports['destroy']=function(_0x8b1752,_0x111366){return db['CmHopperAdditionalPhone'][_0x8ba0('0x4d')]({'where':{'id':_0x8b1752[_0x8ba0('0x55')]['id']}})[_0x8ba0('0x26')](handleEntityNotFound(_0x111366,null))['then'](removeEntity(_0x111366,null))[_0x8ba0('0x4a')](handleError(_0x111366,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index d03ef10..5dc1667 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 _0xe157=['api','path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','exports','define','cm_hopper_additional_phones','lodash','util','../../config/logger'];(function(_0x4caf6b,_0x1e60ea){var _0x29e73c=function(_0x1299ad){while(--_0x1299ad){_0x4caf6b['push'](_0x4caf6b['shift']());}};_0x29e73c(++_0x1e60ea);}(_0xe157,0x13c));var _0x7e15=function(_0x5c7eb9,_0x5307de){_0x5c7eb9=_0x5c7eb9-0x0;var _0x4d0189=_0xe157[_0x5c7eb9];return _0x4d0189;};'use strict';var _=require(_0x7e15('0x0'));var util=require(_0x7e15('0x1'));var logger=require(_0x7e15('0x2'))(_0x7e15('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x7e15('0x4'));var rimraf=require(_0x7e15('0x5'));var config=require(_0x7e15('0x6'));var attributes=require(_0x7e15('0x7'));module[_0x7e15('0x8')]=function(_0x331934,_0x422932){return _0x331934[_0x7e15('0x9')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x7e15('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5341=['bluebird','request-promise','path','../../config/environment','exports','define','CmHopperAdditionalPhone','lodash','util','../../config/logger','api','moment'];(function(_0x5938bd,_0x28b89d){var _0x3fc973=function(_0x361ccc){while(--_0x361ccc){_0x5938bd['push'](_0x5938bd['shift']());}};_0x3fc973(++_0x28b89d);}(_0x5341,0xbb));var _0x1534=function(_0x46a13a,_0x56e2d9){_0x46a13a=_0x46a13a-0x0;var _0x58b6e2=_0x5341[_0x46a13a];return _0x58b6e2;};'use strict';var _=require(_0x1534('0x0'));var util=require(_0x1534('0x1'));var logger=require(_0x1534('0x2'))(_0x1534('0x3'));var moment=require(_0x1534('0x4'));var BPromise=require(_0x1534('0x5'));var rp=require(_0x1534('0x6'));var fs=require('fs');var path=require(_0x1534('0x7'));var rimraf=require('rimraf');var config=require(_0x1534('0x8'));var attributes=require('./cmHopperAdditionalPhone.attributes');module[_0x1534('0x9')]=function(_0x3defe5,_0x6b465a){return _0x3defe5[_0x1534('0xa')](_0x1534('0xb'),attributes,{'tableName':'cm_hopper_additional_phones','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 49a41d4..291e1a7 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 _0x4d07=['jayson/promise','then','info','debug','request\x20sent','stringify','error','CmHopperAdditionalPhone,\x20%s,\x20%s','message','result','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','VoiceQueueId','OrderBy','ASC','countbusyretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','entity','countcongestionretry','countnoanswerretry','countagentrejectretry','SwapAdditionalPhones','ListId','CampaignId','CmHopperAdditionalPhone','duration','waitTime','isNil','scheduledat','add','minutes','phone','createdAt','updatedAt','update','activateAdditionalPhone','IncrementPreviewCounters','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5a14d2,_0x22b89a){var _0xb08187=function(_0x541eeb){while(--_0x541eeb){_0x5a14d2['push'](_0x5a14d2['shift']());}};_0xb08187(++_0x22b89a);}(_0x4d07,0x1ad));var _0x74d0=function(_0x4a372d,_0x3bd91f){_0x4a372d=_0x4a372d-0x0;var _0x546ac0=_0x4d07[_0x4a372d];return _0x546ac0;};'use strict';var _=require(_0x74d0('0x0'));var util=require(_0x74d0('0x1'));var moment=require(_0x74d0('0x2'));var BPromise=require(_0x74d0('0x3'));var rs=require(_0x74d0('0x4'));var fs=require('fs');var Redis=require(_0x74d0('0x5'));var db=require(_0x74d0('0x6'))['db'];var utils=require(_0x74d0('0x7'));var logger=require(_0x74d0('0x8'))(_0x74d0('0x9'));var config=require(_0x74d0('0xa'));var jayson=require(_0x74d0('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x488cbe,_0x520d68,_0x1bd416){return new BPromise(function(_0x1fb039,_0x2a18b0){return client['request'](_0x488cbe,_0x1bd416)[_0x74d0('0xc')](function(_0x1553b9){logger[_0x74d0('0xd')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x520d68,'request\x20sent');logger[_0x74d0('0xe')]('CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s',_0x520d68,_0x74d0('0xf'),JSON[_0x74d0('0x10')](_0x1553b9));if(_0x1553b9[_0x74d0('0x11')]){if(_0x1553b9[_0x74d0('0x11')]['code']===0x1f4){logger[_0x74d0('0x11')](_0x74d0('0x12'),_0x520d68,_0x1553b9[_0x74d0('0x11')]['message']);return _0x2a18b0(_0x1553b9['error'][_0x74d0('0x13')]);}logger[_0x74d0('0x11')](_0x74d0('0x12'),_0x520d68,_0x1553b9[_0x74d0('0x11')][_0x74d0('0x13')]);return _0x1fb039(_0x1553b9[_0x74d0('0x11')]['message']);}else{logger[_0x74d0('0xd')](_0x74d0('0x12'),_0x520d68,'request\x20sent');_0x1fb039(_0x1553b9[_0x74d0('0x14')][_0x74d0('0x13')]);}})[_0x74d0('0x15')](function(_0x5a4f3b){logger[_0x74d0('0x11')](_0x74d0('0x12'),_0x520d68,_0x5a4f3b);_0x2a18b0(_0x5a4f3b);});});}exports[_0x74d0('0x16')]=function(_0xc40c3a){var _0x46780c=this;return new Promise(function(_0x38f43c,_0x1ebb37){return db[_0x74d0('0x17')][_0x74d0('0x18')]({'raw':!![],'where':{'ContactId':_0xc40c3a[_0x74d0('0x19')][_0x74d0('0x1a')],'ListId':_0xc40c3a[_0x74d0('0x19')]['ListId'],'VoiceQueueId':_0xc40c3a['body'][_0x74d0('0x1b')]===undefined?null:_0xc40c3a[_0x74d0('0x19')]['VoiceQueueId'],'CampaignId':_0xc40c3a[_0x74d0('0x19')]['CampaignId']===undefined?null:_0xc40c3a[_0x74d0('0x19')]['CampaignId']}})['then'](function(_0x2a4eae){if(_0x2a4eae!=null){return db['CmHopperAdditionalPhone'][_0x74d0('0x18')]({'raw':!![],'where':{'CmHopperId':_0x2a4eae['id'],'OrderBy':{'$gt':_0x2a4eae['OrderBy']}},'order':[[_0x74d0('0x1c'),_0x74d0('0x1d')]]})['then'](function(_0x1d9165){var _0x34848e=0x0;if(_0x1d9165){if(_0x1d9165[_0x74d0('0x1e')]+_0x1d9165['countcongestionretry']+_0x1d9165['countnoanswerretry']+_0x1d9165[_0x74d0('0x1f')]+_0x1d9165[_0x74d0('0x20')]+_0x1d9165[_0x74d0('0x21')]+_0x1d9165[_0x74d0('0x22')]+_0x1d9165['countagentrejectretry']<_0xc40c3a[_0x74d0('0x23')]['dialGlobalMaxRetry'])_0x34848e=0x1;_0x38f43c({'additional':_0x34848e});}else{return db['CmHopperAdditionalPhone'][_0x74d0('0x18')]({'raw':!![],'where':{'CmHopperId':_0x2a4eae['id']},'order':[[_0x74d0('0x1c'),_0x74d0('0x1d')]]})[_0x74d0('0xc')](function(_0x4a16cd){var _0x373484=0x0;if(_0x4a16cd){if(_0x4a16cd['countbusyretry']+_0x4a16cd[_0x74d0('0x24')]+_0x4a16cd[_0x74d0('0x25')]+_0x4a16cd['countnosuchnumberretry']+_0x4a16cd[_0x74d0('0x20')]+_0x4a16cd[_0x74d0('0x21')]+_0x4a16cd[_0x74d0('0x22')]+_0x4a16cd[_0x74d0('0x26')]<_0xc40c3a[_0x74d0('0x23')]['dialGlobalMaxRetry'])_0x373484=0x1;_0x38f43c({'additional':_0x373484});}else{_0x38f43c({'additional':0x0});}})['catch'](function(_0x1d3f52){logger[_0x74d0('0x11')](_0x74d0('0x16'),_0x1d3f52['message']);_0x1ebb37(_0x46780c['error'](0x1f4,_0x1d3f52[_0x74d0('0x13')]));});}})[_0x74d0('0x15')](function(_0x305a55){logger[_0x74d0('0x11')](_0x74d0('0x16'),_0x305a55[_0x74d0('0x13')]);_0x1ebb37(_0x46780c['error'](0x1f4,_0x305a55[_0x74d0('0x13')]));});}else _0x38f43c({'additional':0x0});});});};exports[_0x74d0('0x27')]=function(_0x6c4ea5){var _0x117b8b=this;return new Promise(function(_0x169a9a,_0x5e1893){return db[_0x74d0('0x17')][_0x74d0('0x18')]({'raw':!![],'where':{'ContactId':_0x6c4ea5[_0x74d0('0x19')]['ContactId'],'ListId':_0x6c4ea5['body'][_0x74d0('0x28')],'VoiceQueueId':_0x6c4ea5[_0x74d0('0x19')][_0x74d0('0x1b')]===undefined?null:_0x6c4ea5[_0x74d0('0x19')][_0x74d0('0x1b')],'CampaignId':_0x6c4ea5[_0x74d0('0x19')][_0x74d0('0x29')]===undefined?null:_0x6c4ea5[_0x74d0('0x19')]['CampaignId']}})[_0x74d0('0xc')](function(_0x37f61f){if(_0x37f61f!=null){return db[_0x74d0('0x2a')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x37f61f['id'],'OrderBy':{'$gte':_0x37f61f['OrderBy']}},'order':[[_0x74d0('0x1c'),_0x74d0('0x1d')]]})['then'](function(_0xdf3b5){if(_0xdf3b5)return activateAdditionalPhone(_0x37f61f,_0x6c4ea5[_0x74d0('0x19')],_0xdf3b5,_0x6c4ea5[_0x74d0('0x2b')],_0x6c4ea5['waitTime'])['then'](function(_0x20d07f){_0x169a9a(_0x20d07f);});else{return db[_0x74d0('0x2a')][_0x74d0('0x18')]({'raw':!![],'where':{'CmHopperId':_0x37f61f['id']},'order':[[_0x74d0('0x1c'),_0x74d0('0x1d')]]})['then'](function(_0x143b94){if(_0x143b94)return activateAdditionalPhone(_0x37f61f,_0x6c4ea5[_0x74d0('0x19')],_0x143b94,_0x6c4ea5[_0x74d0('0x2b')],_0x6c4ea5[_0x74d0('0x2c')])['then'](function(_0x580487){_0x169a9a(_0x580487);});else{_0x169a9a({'id':_0x37f61f['id'],'phone':''});}})[_0x74d0('0x15')](function(_0x28d7e5){logger[_0x74d0('0x11')](_0x74d0('0x16'),_0x28d7e5[_0x74d0('0x13')]);_0x5e1893(_0x117b8b['error'](0x1f4,_0x28d7e5[_0x74d0('0x13')]));});}})[_0x74d0('0x15')](function(_0x5a1c18){logger[_0x74d0('0x11')]('VerifyAdditionalPhones',_0x5a1c18[_0x74d0('0x13')]);_0x5e1893(_0x117b8b[_0x74d0('0x11')](0x1f4,_0x5a1c18[_0x74d0('0x13')]));});}else _0x169a9a(0x1);});});};function activateAdditionalPhone(_0x36b070,_0x50b533,_0x17ff97,_0x1b08f4,_0x126dcf){return new Promise(function(_0xb4b992,_0x4e6cfa){var _0x3bfe5c;if(_[_0x74d0('0x2d')](_0x17ff97[_0x74d0('0x2e')])){_0x17ff97['scheduledat']=moment();}if(moment()>moment(_0x17ff97['scheduledat'])){_0x3bfe5c=moment()[_0x74d0('0x2f')](_0x126dcf||0x3,_0x74d0('0x30'));}else{if(_0x17ff97[_0x74d0('0x1c')]==0x0){_0x3bfe5c=moment(_0x17ff97[_0x74d0('0x2e')]);}else{_0x3bfe5c=moment()[_0x74d0('0x2f')](_0x126dcf||0x3,_0x74d0('0x30'));}}if(_[_0x74d0('0x2d')](_0x3bfe5c)){_0x3bfe5c=moment()[_0x74d0('0x2f')](_0x126dcf||0x3,_0x74d0('0x30'));}var _0xbda7d={'phone':_0x36b070[_0x74d0('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x36b070[_0x74d0('0x1c')])?0x0:_0x36b070[_0x74d0('0x1c')],'scheduledat':moment()[_0x74d0('0x2f')](_0x1b08f4||0x1,_0x74d0('0x30')),'countbusyretry':_0x50b533['countbusyretry'],'countcongestionretry':_0x50b533[_0x74d0('0x24')],'countnoanswerretry':_0x50b533[_0x74d0('0x25')],'countnosuchnumberretry':_0x50b533[_0x74d0('0x1f')],'countdropretry':_0x50b533[_0x74d0('0x20')],'countabandonedretry':_0x50b533[_0x74d0('0x21')],'countmachineretry':_0x50b533[_0x74d0('0x22')],'countagentrejectretry':_0x50b533['countagentrejectretry'],'createdAt':_0x50b533[_0x74d0('0x32')],'updatedAt':_0x50b533['updatedAt']};var _0x1b0295={'CmHopperId':_0x36b070['id'],'phone':_0x17ff97[_0x74d0('0x31')],'active':0x0,'OrderBy':_['isNil'](_0x17ff97[_0x74d0('0x1c')])?0x0:_0x17ff97[_0x74d0('0x1c')],'scheduledat':_0x3bfe5c,'countbusyretry':_0x17ff97[_0x74d0('0x1e')],'countcongestionretry':_0x17ff97[_0x74d0('0x24')],'countnoanswerretry':_0x17ff97[_0x74d0('0x25')],'countnosuchnumberretry':_0x17ff97['countnosuchnumberretry'],'countdropretry':_0x17ff97[_0x74d0('0x20')],'countabandonedretry':_0x17ff97[_0x74d0('0x21')],'countmachineretry':_0x17ff97[_0x74d0('0x22')],'countagentrejectretry':_0x17ff97[_0x74d0('0x26')],'createdAt':_0x17ff97[_0x74d0('0x32')],'updatedAt':_0x17ff97[_0x74d0('0x33')]};return db['sequelize']['transaction'](function(_0x3de8bc){return db['CmHopperAdditionalPhone'][_0x74d0('0x34')](_0xbda7d,{'where':{'id':_0x17ff97['id']}},{'transaction':_0x3de8bc})[_0x74d0('0xc')](function(){return db[_0x74d0('0x17')][_0x74d0('0x34')](_0x1b0295,{'where':{'id':_0x36b070['id']}},{'transaction':_0x3de8bc});});})[_0x74d0('0xc')](function(_0x2f62b7){_0xb4b992({'id':_0x36b070['id'],'phone':_0x17ff97[_0x74d0('0x31')]});})['catch'](function(_0x579733){logger[_0x74d0('0x11')](_0x74d0('0x35'),_0x579733['message']);_0x4e6cfa({'error':_0x579733[_0x74d0('0x13')]});});});}exports[_0x74d0('0x36')]=function(_0x259ee1){var _0x16ffbd=this;return new Promise(function(_0x382b0b,_0x165bdd){return db[_0x74d0('0x17')][_0x74d0('0x34')](_0x259ee1[_0x74d0('0x19')]['field'],{'where':{'id':_0x259ee1[_0x74d0('0x19')]['id']}})[_0x74d0('0xc')](function(_0x2d2c53){_0x382b0b(_0x2d2c53);})[_0x74d0('0x15')](function(_0x36b58f){logger[_0x74d0('0x11')](_0x74d0('0x36'),_0x36b58f['message']);_0x165bdd(_0x16ffbd[_0x74d0('0x11')](0x1f4,_0x36b58f['message']));});});}; \ No newline at end of file +var _0x2867=['CampaignId','duration','waitTime','scheduledat','add','minutes','isNil','phone','countcongestionretry','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','field','IncrementPreviewCounters','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','stringify','code','error','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ContactId','ListId','VoiceQueueId','OrderBy','ASC','countbusyretry','countnoanswerretry','countdropretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','CmHopperAdditionalPhone','countnosuchnumberretry','countabandonedretry'];(function(_0x29933d,_0x2969c7){var _0x21c910=function(_0x2c625b){while(--_0x2c625b){_0x29933d['push'](_0x29933d['shift']());}};_0x21c910(++_0x2969c7);}(_0x2867,0xc5));var _0x7286=function(_0x2c574e,_0x491053){_0x2c574e=_0x2c574e-0x0;var _0x1101f7=_0x2867[_0x2c574e];return _0x1101f7;};'use strict';var _=require(_0x7286('0x0'));var util=require(_0x7286('0x1'));var moment=require('moment');var BPromise=require(_0x7286('0x2'));var rs=require(_0x7286('0x3'));var fs=require('fs');var Redis=require(_0x7286('0x4'));var db=require(_0x7286('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7286('0x6'))(_0x7286('0x7'));var config=require(_0x7286('0x8'));var jayson=require(_0x7286('0x9'));var client=jayson[_0x7286('0xa')][_0x7286('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x54c588,_0x1eb1ce,_0x4c1dcb){return new BPromise(function(_0xfd5ebc,_0x3b8f82){return client[_0x7286('0xc')](_0x54c588,_0x4c1dcb)[_0x7286('0xd')](function(_0x4e7b27){logger[_0x7286('0xe')](_0x7286('0xf'),_0x1eb1ce,_0x7286('0x10'));logger[_0x7286('0x11')](_0x7286('0x12'),_0x1eb1ce,_0x7286('0x10'),JSON[_0x7286('0x13')](_0x4e7b27));if(_0x4e7b27['error']){if(_0x4e7b27['error'][_0x7286('0x14')]===0x1f4){logger[_0x7286('0x15')](_0x7286('0xf'),_0x1eb1ce,_0x4e7b27[_0x7286('0x15')]['message']);return _0x3b8f82(_0x4e7b27[_0x7286('0x15')][_0x7286('0x16')]);}logger['error'](_0x7286('0xf'),_0x1eb1ce,_0x4e7b27['error'][_0x7286('0x16')]);return _0xfd5ebc(_0x4e7b27[_0x7286('0x15')]['message']);}else{logger[_0x7286('0xe')](_0x7286('0xf'),_0x1eb1ce,'request\x20sent');_0xfd5ebc(_0x4e7b27['result']['message']);}})[_0x7286('0x17')](function(_0x3017eb){logger['error'](_0x7286('0xf'),_0x1eb1ce,_0x3017eb);_0x3b8f82(_0x3017eb);});});}exports[_0x7286('0x18')]=function(_0x1c759e){var _0x5142a5=this;return new Promise(function(_0x508fd9,_0x22841b){return db[_0x7286('0x19')][_0x7286('0x1a')]({'raw':!![],'where':{'ContactId':_0x1c759e[_0x7286('0x1b')][_0x7286('0x1c')],'ListId':_0x1c759e['body'][_0x7286('0x1d')],'VoiceQueueId':_0x1c759e[_0x7286('0x1b')]['VoiceQueueId']===undefined?null:_0x1c759e[_0x7286('0x1b')][_0x7286('0x1e')],'CampaignId':_0x1c759e[_0x7286('0x1b')]['CampaignId']===undefined?null:_0x1c759e[_0x7286('0x1b')]['CampaignId']}})[_0x7286('0xd')](function(_0x45f355){if(_0x45f355!=null){return db['CmHopperAdditionalPhone'][_0x7286('0x1a')]({'raw':!![],'where':{'CmHopperId':_0x45f355['id'],'OrderBy':{'$gt':_0x45f355['OrderBy']}},'order':[[_0x7286('0x1f'),_0x7286('0x20')]]})['then'](function(_0x24807c){var _0xc4a334=0x0;if(_0x24807c){if(_0x24807c[_0x7286('0x21')]+_0x24807c['countcongestionretry']+_0x24807c[_0x7286('0x22')]+_0x24807c['countnosuchnumberretry']+_0x24807c[_0x7286('0x23')]+_0x24807c['countabandonedretry']+_0x24807c[_0x7286('0x24')]+_0x24807c[_0x7286('0x25')]<_0x1c759e[_0x7286('0x26')][_0x7286('0x27')])_0xc4a334=0x1;_0x508fd9({'additional':_0xc4a334});}else{return db[_0x7286('0x28')]['findOne']({'raw':!![],'where':{'CmHopperId':_0x45f355['id']},'order':[['OrderBy',_0x7286('0x20')]]})['then'](function(_0x3e868f){var _0x31fcb7=0x0;if(_0x3e868f){if(_0x3e868f[_0x7286('0x21')]+_0x3e868f['countcongestionretry']+_0x3e868f[_0x7286('0x22')]+_0x3e868f[_0x7286('0x29')]+_0x3e868f[_0x7286('0x23')]+_0x3e868f[_0x7286('0x2a')]+_0x3e868f[_0x7286('0x24')]+_0x3e868f['countagentrejectretry']<_0x1c759e[_0x7286('0x26')][_0x7286('0x27')])_0x31fcb7=0x1;_0x508fd9({'additional':_0x31fcb7});}else{_0x508fd9({'additional':0x0});}})[_0x7286('0x17')](function(_0x48c414){logger[_0x7286('0x15')](_0x7286('0x18'),_0x48c414[_0x7286('0x16')]);_0x22841b(_0x5142a5['error'](0x1f4,_0x48c414['message']));});}})[_0x7286('0x17')](function(_0x1b50c2){logger[_0x7286('0x15')](_0x7286('0x18'),_0x1b50c2[_0x7286('0x16')]);_0x22841b(_0x5142a5[_0x7286('0x15')](0x1f4,_0x1b50c2[_0x7286('0x16')]));});}else _0x508fd9({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x56a499){var _0x4a797f=this;return new Promise(function(_0x4b3749,_0x55cbeb){return db[_0x7286('0x19')][_0x7286('0x1a')]({'raw':!![],'where':{'ContactId':_0x56a499[_0x7286('0x1b')][_0x7286('0x1c')],'ListId':_0x56a499[_0x7286('0x1b')][_0x7286('0x1d')],'VoiceQueueId':_0x56a499[_0x7286('0x1b')][_0x7286('0x1e')]===undefined?null:_0x56a499['body'][_0x7286('0x1e')],'CampaignId':_0x56a499[_0x7286('0x1b')][_0x7286('0x2b')]===undefined?null:_0x56a499[_0x7286('0x1b')][_0x7286('0x2b')]}})[_0x7286('0xd')](function(_0xb8eff5){if(_0xb8eff5!=null){return db[_0x7286('0x28')][_0x7286('0x1a')]({'raw':!![],'where':{'CmHopperId':_0xb8eff5['id'],'OrderBy':{'$gte':_0xb8eff5[_0x7286('0x1f')]}},'order':[[_0x7286('0x1f'),_0x7286('0x20')]]})[_0x7286('0xd')](function(_0x516747){if(_0x516747)return activateAdditionalPhone(_0xb8eff5,_0x56a499[_0x7286('0x1b')],_0x516747,_0x56a499[_0x7286('0x2c')],_0x56a499['waitTime'])[_0x7286('0xd')](function(_0x139d06){_0x4b3749(_0x139d06);});else{return db[_0x7286('0x28')][_0x7286('0x1a')]({'raw':!![],'where':{'CmHopperId':_0xb8eff5['id']},'order':[['OrderBy',_0x7286('0x20')]]})['then'](function(_0x57065a){if(_0x57065a)return activateAdditionalPhone(_0xb8eff5,_0x56a499['body'],_0x57065a,_0x56a499['duration'],_0x56a499[_0x7286('0x2d')])[_0x7286('0xd')](function(_0x3f6170){_0x4b3749(_0x3f6170);});else{_0x4b3749({'id':_0xb8eff5['id'],'phone':''});}})['catch'](function(_0x848900){logger[_0x7286('0x15')](_0x7286('0x18'),_0x848900[_0x7286('0x16')]);_0x55cbeb(_0x4a797f[_0x7286('0x15')](0x1f4,_0x848900['message']));});}})['catch'](function(_0x4db93d){logger[_0x7286('0x15')](_0x7286('0x18'),_0x4db93d['message']);_0x55cbeb(_0x4a797f['error'](0x1f4,_0x4db93d[_0x7286('0x16')]));});}else _0x4b3749(0x1);});});};function activateAdditionalPhone(_0x717f7f,_0x210e0d,_0x47670f,_0x527a99,_0x3e1a97){return new Promise(function(_0x461a7d,_0x2691a7){var _0x324ba5;if(_['isNil'](_0x47670f[_0x7286('0x2e')])){_0x47670f[_0x7286('0x2e')]=moment();}if(moment()>moment(_0x47670f[_0x7286('0x2e')])){_0x324ba5=moment()[_0x7286('0x2f')](_0x3e1a97||0x3,_0x7286('0x30'));}else{if(_0x47670f[_0x7286('0x1f')]==0x0){_0x324ba5=moment(_0x47670f[_0x7286('0x2e')]);}else{_0x324ba5=moment()['add'](_0x3e1a97||0x3,_0x7286('0x30'));}}if(_[_0x7286('0x31')](_0x324ba5)){_0x324ba5=moment()['add'](_0x3e1a97||0x3,_0x7286('0x30'));}var _0x51d4f4={'phone':_0x717f7f[_0x7286('0x32')],'active':0x0,'OrderBy':_[_0x7286('0x31')](_0x717f7f[_0x7286('0x1f')])?0x0:_0x717f7f[_0x7286('0x1f')],'scheduledat':moment()[_0x7286('0x2f')](_0x527a99||0x1,'minutes'),'countbusyretry':_0x210e0d[_0x7286('0x21')],'countcongestionretry':_0x210e0d[_0x7286('0x33')],'countnoanswerretry':_0x210e0d['countnoanswerretry'],'countnosuchnumberretry':_0x210e0d[_0x7286('0x29')],'countdropretry':_0x210e0d[_0x7286('0x23')],'countabandonedretry':_0x210e0d[_0x7286('0x2a')],'countmachineretry':_0x210e0d[_0x7286('0x24')],'countagentrejectretry':_0x210e0d[_0x7286('0x25')],'createdAt':_0x210e0d[_0x7286('0x34')],'updatedAt':_0x210e0d[_0x7286('0x35')]};var _0x1d133c={'CmHopperId':_0x717f7f['id'],'phone':_0x47670f[_0x7286('0x32')],'active':0x0,'OrderBy':_[_0x7286('0x31')](_0x47670f[_0x7286('0x1f')])?0x0:_0x47670f[_0x7286('0x1f')],'scheduledat':_0x324ba5,'countbusyretry':_0x47670f[_0x7286('0x21')],'countcongestionretry':_0x47670f[_0x7286('0x33')],'countnoanswerretry':_0x47670f[_0x7286('0x22')],'countnosuchnumberretry':_0x47670f[_0x7286('0x29')],'countdropretry':_0x47670f['countdropretry'],'countabandonedretry':_0x47670f['countabandonedretry'],'countmachineretry':_0x47670f[_0x7286('0x24')],'countagentrejectretry':_0x47670f[_0x7286('0x25')],'createdAt':_0x47670f[_0x7286('0x34')],'updatedAt':_0x47670f[_0x7286('0x35')]};return db[_0x7286('0x36')][_0x7286('0x37')](function(_0x5cbc8a){return db[_0x7286('0x28')][_0x7286('0x38')](_0x51d4f4,{'where':{'id':_0x47670f['id']}},{'transaction':_0x5cbc8a})[_0x7286('0xd')](function(){return db[_0x7286('0x19')][_0x7286('0x38')](_0x1d133c,{'where':{'id':_0x717f7f['id']}},{'transaction':_0x5cbc8a});});})['then'](function(_0x14017d){_0x461a7d({'id':_0x717f7f['id'],'phone':_0x47670f[_0x7286('0x32')]});})['catch'](function(_0x5f45dd){logger[_0x7286('0x15')](_0x7286('0x39'),_0x5f45dd['message']);_0x2691a7({'error':_0x5f45dd[_0x7286('0x16')]});});});}exports['IncrementPreviewCounters']=function(_0x209d75){var _0x2cfbb0=this;return new Promise(function(_0x31f445,_0x64702c){return db[_0x7286('0x19')]['update'](_0x209d75['body'][_0x7286('0x3a')],{'where':{'id':_0x209d75[_0x7286('0x1b')]['id']}})[_0x7286('0xd')](function(_0x456552){_0x31f445(_0x456552);})[_0x7286('0x17')](function(_0xd179b2){logger[_0x7286('0x15')](_0x7286('0x3b'),_0xd179b2['message']);_0x64702c(_0x2cfbb0[_0x7286('0x15')](0x1f4,_0xd179b2[_0x7286('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 8241064..77dcc36 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 _0x50c0=['./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x10f68e,_0xf198ea){var _0x4c8372=function(_0x38517){while(--_0x38517){_0x10f68e['push'](_0x10f68e['shift']());}};_0x4c8372(++_0xf198ea);}(_0x50c0,0xd0));var _0x050c=function(_0x598f1f,_0xa7d1c){_0x598f1f=_0x598f1f-0x0;var _0x26d77d=_0x50c0[_0x598f1f];return _0x26d77d;};'use strict';var multer=require(_0x050c('0x0'));var util=require('util');var path=require(_0x050c('0x1'));var timeout=require(_0x050c('0x2'));var express=require('express');var router=express[_0x050c('0x3')]();var fs_extra=require(_0x050c('0x4'));var auth=require(_0x050c('0x5'));var interaction=require(_0x050c('0x6'));var config=require(_0x050c('0x7'));var controller=require(_0x050c('0x8'));router[_0x050c('0x9')]('/',auth[_0x050c('0xa')](),controller[_0x050c('0xb')]);router['get'](_0x050c('0xc'),auth[_0x050c('0xa')](),controller[_0x050c('0xd')]);router['post']('/',auth[_0x050c('0xa')](),controller['create']);router[_0x050c('0xe')](_0x050c('0xc'),auth[_0x050c('0xa')](),controller['update']);router[_0x050c('0xf')](_0x050c('0xc'),auth[_0x050c('0xa')](),controller[_0x050c('0x10')]);module[_0x050c('0x11')]=router; \ No newline at end of file +var _0x8c2d=['delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./cmHopperAdditionalPhone.controller','isAuthenticated','index','/:id','show','post','create','put'];(function(_0x214168,_0x3c8ca7){var _0x3af9d5=function(_0x58130e){while(--_0x58130e){_0x214168['push'](_0x214168['shift']());}};_0x3af9d5(++_0x3c8ca7);}(_0x8c2d,0x1cb));var _0xd8c2=function(_0x71ae3c,_0x49c7a8){_0x71ae3c=_0x71ae3c-0x0;var _0x267933=_0x8c2d[_0x71ae3c];return _0x267933;};'use strict';var multer=require(_0xd8c2('0x0'));var util=require(_0xd8c2('0x1'));var path=require(_0xd8c2('0x2'));var timeout=require(_0xd8c2('0x3'));var express=require(_0xd8c2('0x4'));var router=express[_0xd8c2('0x5')]();var fs_extra=require(_0xd8c2('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xd8c2('0x7'));var config=require('../../config/environment');var controller=require(_0xd8c2('0x8'));router['get']('/',auth[_0xd8c2('0x9')](),controller[_0xd8c2('0xa')]);router['get'](_0xd8c2('0xb'),auth['isAuthenticated'](),controller[_0xd8c2('0xc')]);router[_0xd8c2('0xd')]('/',auth['isAuthenticated'](),controller[_0xd8c2('0xe')]);router[_0xd8c2('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd8c2('0x10')](_0xd8c2('0xb'),auth[_0xd8c2('0x9')](),controller[_0xd8c2('0x11')]);module[_0xd8c2('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index b20e226..f5bb5aa 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 _0x02b6=['exports','STRING','INTEGER','contactListQueue','moment'];(function(_0x7f87e0,_0x4fb109){var _0x54603c=function(_0x4d0cb1){while(--_0x4d0cb1){_0x7f87e0['push'](_0x7f87e0['shift']());}};_0x54603c(++_0x4fb109);}(_0x02b6,0xfe));var _0x602b=function(_0x58f971,_0x5336f8){_0x58f971=_0x58f971-0x0;var _0x33f9d6=_0x02b6[_0x58f971];return _0x33f9d6;};'use strict';var moment=require(_0x602b('0x0'));var Sequelize=require('sequelize');module[_0x602b('0x1')]={'phone':{'type':Sequelize[_0x602b('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x602b('0x3')],'unique':'contactListQueue'},'ListId':{'type':Sequelize['INTEGER'],'unique':_0x602b('0x4')},'VoiceQueueId':{'type':Sequelize[_0x602b('0x3')],'unique':_0x602b('0x4')}}; \ No newline at end of file +var _0xbccd=['moment','STRING','INTEGER','contactListQueue'];(function(_0xc7348b,_0x145880){var _0x307cec=function(_0x4f1554){while(--_0x4f1554){_0xc7348b['push'](_0xc7348b['shift']());}};_0x307cec(++_0x145880);}(_0xbccd,0x1b0));var _0xdbcc=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xbccd[_0x5f09c5];return _0x426ad9;};'use strict';var moment=require(_0xdbcc('0x0'));var Sequelize=require('sequelize');module['exports']={'phone':{'type':Sequelize[_0xdbcc('0x1')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xdbcc('0x2')],'unique':_0xdbcc('0x3')},'ListId':{'type':Sequelize[_0xdbcc('0x2')],'unique':_0xdbcc('0x3')},'VoiceQueueId':{'type':Sequelize[_0xdbcc('0x2')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 9109a69..aed0aa8 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 _0xaf73=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','CmHopperBlack','find','update','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','error','name','map','rawAttributes','key','model','query'];(function(_0x341a67,_0x230d99){var _0x35007a=function(_0x5aaa62){while(--_0x5aaa62){_0x341a67['push'](_0x341a67['shift']());}};_0x35007a(++_0x230d99);}(_0xaf73,0x149));var _0x3af7=function(_0x2cc671,_0x6a8aa5){_0x2cc671=_0x2cc671-0x0;var _0x1977a2=_0xaf73[_0x2cc671];return _0x1977a2;};'use strict';var emlformat=require(_0x3af7('0x0'));var rimraf=require(_0x3af7('0x1'));var zipdir=require(_0x3af7('0x2'));var jsonpatch=require(_0x3af7('0x3'));var rp=require(_0x3af7('0x4'));var moment=require(_0x3af7('0x5'));var BPromise=require(_0x3af7('0x6'));var Mustache=require(_0x3af7('0x7'));var util=require(_0x3af7('0x8'));var path=require(_0x3af7('0x9'));var sox=require(_0x3af7('0xa'));var csv=require(_0x3af7('0xb'));var ejs=require(_0x3af7('0xc'));var fs=require('fs');var fs_extra=require(_0x3af7('0xd'));var _=require(_0x3af7('0xe'));var squel=require(_0x3af7('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3af7('0xb'));var querystring=require(_0x3af7('0x10'));var Papa=require(_0x3af7('0x11'));var Redis=require(_0x3af7('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x3af7('0x13'));var hardwareService=require(_0x3af7('0x14'));var logger=require(_0x3af7('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x3af7('0x16'));var licenseUtil=require(_0x3af7('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x26db9d,_0x275ba9){_0x275ba9=_0x275ba9||0xcc;return function(_0x5c6054){if(_0x5c6054){return _0x26db9d[_0x3af7('0x18')](_0x275ba9);}return _0x26db9d['status'](_0x275ba9)[_0x3af7('0x19')]();};}function respondWithResult(_0x27dffa,_0x2616ec){_0x2616ec=_0x2616ec||0xc8;return function(_0xceba6a){if(_0xceba6a){return _0x27dffa[_0x3af7('0x1a')](_0x2616ec)[_0x3af7('0x1b')](_0xceba6a);}};}function respondWithFilteredResult(_0x4df0f0,_0x5dbf21){return function(_0x3c4288){if(_0x3c4288){var _0x49aee5=typeof _0x5dbf21[_0x3af7('0x1c')]==='undefined'&&typeof _0x5dbf21[_0x3af7('0x1d')]===_0x3af7('0x1e');var _0x475b61=_0x3c4288[_0x3af7('0x1f')];var _0x5281f1=_0x49aee5?0x0:_0x5dbf21[_0x3af7('0x1c')];var _0x4f3911=_0x49aee5?_0x3c4288['count']:_0x5dbf21[_0x3af7('0x1c')]+_0x5dbf21[_0x3af7('0x1d')];var _0x25ae05;if(_0x4f3911>=_0x475b61){_0x4f3911=_0x475b61;_0x25ae05=0xc8;}else{_0x25ae05=0xce;}_0x4df0f0[_0x3af7('0x1a')](_0x25ae05);return _0x4df0f0[_0x3af7('0x20')](_0x3af7('0x21'),_0x5281f1+'-'+_0x4f3911+'/'+_0x475b61)[_0x3af7('0x1b')](_0x3c4288);}return null;};}function patchUpdates(_0x20d88d){return function(_0x5eebf0){try{jsonpatch[_0x3af7('0x22')](_0x5eebf0,_0x20d88d,!![]);}catch(_0x3c1739){return BPromise[_0x3af7('0x23')](_0x3c1739);}return _0x5eebf0[_0x3af7('0x24')]();};}function saveUpdates(_0x351458,_0x1a9c63){return function(_0x4116f9){if(_0x4116f9){return _0x4116f9['update'](_0x351458)[_0x3af7('0x25')](function(_0x58dac5){return _0x58dac5;});}return null;};}function removeEntity(_0x2a707b,_0x5db8aa){return function(_0x581250){if(_0x581250){return _0x581250[_0x3af7('0x26')]()['then'](function(){_0x2a707b[_0x3af7('0x1a')](0xcc)[_0x3af7('0x19')]();});}};}function handleEntityNotFound(_0x13fc85,_0x832f2a){return function(_0x5490bc){if(!_0x5490bc){_0x13fc85[_0x3af7('0x18')](0x194);}return _0x5490bc;};}function handleError(_0x14a265,_0x264ef1){_0x264ef1=_0x264ef1||0x1f4;return function(_0x17ba2f){logger[_0x3af7('0x27')](_0x17ba2f['stack']);if(_0x17ba2f[_0x3af7('0x28')]){delete _0x17ba2f[_0x3af7('0x28')];}_0x14a265[_0x3af7('0x1a')](_0x264ef1)['send'](_0x17ba2f);};}exports['index']=function(_0x11500a,_0x41b905){var _0x273fc5={},_0x552166={},_0x2e82c7={'count':0x0,'rows':[]};var _0x360eca=_[_0x3af7('0x29')](db['CmHopperBlack'][_0x3af7('0x2a')],function(_0x491174){return{'name':_0x491174['fieldName'],'type':_0x491174['type'][_0x3af7('0x2b')]};});_0x552166[_0x3af7('0x2c')]=_[_0x3af7('0x29')](_0x360eca,_0x3af7('0x28'));_0x552166[_0x3af7('0x2d')]=_[_0x3af7('0x2e')](_0x11500a[_0x3af7('0x2d')]);_0x552166[_0x3af7('0x2f')]=_[_0x3af7('0x30')](_0x552166[_0x3af7('0x2c')],_0x552166['query']);_0x273fc5[_0x3af7('0x31')]=_['intersection'](_0x552166[_0x3af7('0x2c')],qs[_0x3af7('0x32')](_0x11500a[_0x3af7('0x2d')][_0x3af7('0x32')]));_0x273fc5['attributes']=_0x273fc5['attributes'][_0x3af7('0x33')]?_0x273fc5['attributes']:_0x552166[_0x3af7('0x2c')];if(!_0x11500a['query'][_0x3af7('0x34')](_0x3af7('0x35'))){_0x273fc5[_0x3af7('0x1d')]=qs[_0x3af7('0x1d')](_0x11500a[_0x3af7('0x2d')][_0x3af7('0x1d')]);_0x273fc5[_0x3af7('0x1c')]=qs[_0x3af7('0x1c')](_0x11500a[_0x3af7('0x2d')]['offset']);}_0x273fc5[_0x3af7('0x36')]=qs[_0x3af7('0x37')](_0x11500a[_0x3af7('0x2d')]['sort']);_0x273fc5[_0x3af7('0x38')]=qs[_0x3af7('0x2f')](_[_0x3af7('0x39')](_0x11500a[_0x3af7('0x2d')],_0x552166['filters']),_0x360eca);if(_0x11500a[_0x3af7('0x2d')][_0x3af7('0x3a')]){_0x273fc5[_0x3af7('0x38')]=_['merge'](_0x273fc5[_0x3af7('0x38')],{'$or':_['map'](_0x360eca,function(_0x2ed0eb){if(_0x2ed0eb[_0x3af7('0x3b')]!==_0x3af7('0x3c')){var _0x309845={};_0x309845[_0x2ed0eb[_0x3af7('0x28')]]={'$like':'%'+_0x11500a[_0x3af7('0x2d')]['filter']+'%'};return _0x309845;}})});}_0x273fc5=_[_0x3af7('0x3d')]({},_0x273fc5,_0x11500a[_0x3af7('0x3e')]);var _0x453994={'where':_0x273fc5['where']};return db['CmHopperBlack'][_0x3af7('0x1f')](_0x453994)[_0x3af7('0x25')](function(_0x668b74){_0x2e82c7[_0x3af7('0x1f')]=_0x668b74;if(_0x11500a['query'][_0x3af7('0x3f')]){_0x273fc5[_0x3af7('0x40')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x3af7('0x41')](_0x273fc5);})[_0x3af7('0x25')](function(_0x516d62){_0x2e82c7[_0x3af7('0x42')]=_0x516d62;return _0x2e82c7;})[_0x3af7('0x25')](respondWithFilteredResult(_0x41b905,_0x273fc5))[_0x3af7('0x43')](handleError(_0x41b905,null));};exports[_0x3af7('0x44')]=function(_0x6bc790,_0x18d483){var _0x3b7746={'raw':!![],'where':{'id':_0x6bc790[_0x3af7('0x45')]['id']}},_0x7e952c={};_0x7e952c[_0x3af7('0x2c')]=_[_0x3af7('0x2e')](db['CmHopperBlack'][_0x3af7('0x2a')]);_0x7e952c[_0x3af7('0x2d')]=_[_0x3af7('0x2e')](_0x6bc790[_0x3af7('0x2d')]);_0x7e952c[_0x3af7('0x2f')]=_['intersection'](_0x7e952c[_0x3af7('0x2c')],_0x7e952c[_0x3af7('0x2d')]);_0x3b7746['attributes']=_[_0x3af7('0x30')](_0x7e952c['model'],qs['fields'](_0x6bc790['query'][_0x3af7('0x32')]));_0x3b7746['attributes']=_0x3b7746['attributes']['length']?_0x3b7746[_0x3af7('0x31')]:_0x7e952c[_0x3af7('0x2c')];if(_0x6bc790[_0x3af7('0x2d')][_0x3af7('0x3f')]){_0x3b7746[_0x3af7('0x40')]=[{'all':!![]}];}_0x3b7746=_['merge']({},_0x3b7746,_0x6bc790[_0x3af7('0x3e')]);return db[_0x3af7('0x46')][_0x3af7('0x47')](_0x3b7746)[_0x3af7('0x25')](handleEntityNotFound(_0x18d483,null))[_0x3af7('0x25')](respondWithResult(_0x18d483,null))[_0x3af7('0x43')](handleError(_0x18d483,null));};exports[_0x3af7('0x48')]=function(_0x5ad13a,_0x405722){if(_0x5ad13a[_0x3af7('0x49')]['id']){delete _0x5ad13a[_0x3af7('0x49')]['id'];}return db[_0x3af7('0x46')][_0x3af7('0x47')]({'where':{'id':_0x5ad13a[_0x3af7('0x45')]['id']}})[_0x3af7('0x25')](handleEntityNotFound(_0x405722,null))['then'](saveUpdates(_0x5ad13a['body'],null))[_0x3af7('0x25')](respondWithResult(_0x405722,null))[_0x3af7('0x43')](handleError(_0x405722,null));};exports[_0x3af7('0x26')]=function(_0x2116c1,_0x15026a){return db[_0x3af7('0x46')][_0x3af7('0x47')]({'where':{'id':_0x2116c1[_0x3af7('0x45')]['id']}})['then'](handleEntityNotFound(_0x15026a,null))['then'](removeEntity(_0x15026a,null))[_0x3af7('0x43')](handleError(_0x15026a,null));};exports[_0x3af7('0x4a')]=function(_0x1186ee,_0x4e88e7){return db[_0x3af7('0x46')][_0x3af7('0x4a')]()['then'](respondWithResult(_0x4e88e7,null))[_0x3af7('0x43')](handleError(_0x4e88e7,null));}; \ No newline at end of file +var _0xc00b=['count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','CmHopperBlack','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','find','body','params','catch','destroy','describe','eml-format','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined'];(function(_0x3954c8,_0x53cf4e){var _0x5e76ca=function(_0x3c9336){while(--_0x3c9336){_0x3954c8['push'](_0x3954c8['shift']());}};_0x5e76ca(++_0x53cf4e);}(_0xc00b,0x1e5));var _0xbc00=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0xc00b[_0x1c8c28];return _0x1f59b4;};'use strict';var emlformat=require(_0xbc00('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbc00('0x1'));var moment=require('moment');var BPromise=require(_0xbc00('0x2'));var Mustache=require(_0xbc00('0x3'));var util=require(_0xbc00('0x4'));var path=require(_0xbc00('0x5'));var sox=require('sox');var csv=require(_0xbc00('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc00('0x7'));var _=require('lodash');var squel=require(_0xbc00('0x8'));var crypto=require(_0xbc00('0x9'));var jsforce=require(_0xbc00('0xa'));var deskjs=require(_0xbc00('0xb'));var toCsv=require(_0xbc00('0x6'));var querystring=require(_0xbc00('0xc'));var Papa=require('papaparse');var Redis=require(_0xbc00('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xbc00('0xe'));var as=require(_0xbc00('0xf'));var hardwareService=require(_0xbc00('0x10'));var logger=require('../../config/logger')(_0xbc00('0x11'));var utils=require('../../config/utils');var config=require(_0xbc00('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0xbc00('0x13'))['db'];function respondWithStatusCode(_0x248684,_0x12cd59){_0x12cd59=_0x12cd59||0xcc;return function(_0x4aabba){if(_0x4aabba){return _0x248684[_0xbc00('0x14')](_0x12cd59);}return _0x248684[_0xbc00('0x15')](_0x12cd59)[_0xbc00('0x16')]();};}function respondWithResult(_0x55f770,_0xfcc4d2){_0xfcc4d2=_0xfcc4d2||0xc8;return function(_0xd05e85){if(_0xd05e85){return _0x55f770['status'](_0xfcc4d2)[_0xbc00('0x17')](_0xd05e85);}};}function respondWithFilteredResult(_0x3eb532,_0x3d6773){return function(_0x3d9659){if(_0x3d9659){var _0x46ae64=typeof _0x3d6773[_0xbc00('0x18')]===_0xbc00('0x19')&&typeof _0x3d6773['limit']==='undefined';var _0x53b0cd=_0x3d9659[_0xbc00('0x1a')];var _0x4e529d=_0x46ae64?0x0:_0x3d6773[_0xbc00('0x18')];var _0x5c1423=_0x46ae64?_0x3d9659[_0xbc00('0x1a')]:_0x3d6773[_0xbc00('0x18')]+_0x3d6773['limit'];var _0x3820c5;if(_0x5c1423>=_0x53b0cd){_0x5c1423=_0x53b0cd;_0x3820c5=0xc8;}else{_0x3820c5=0xce;}_0x3eb532['status'](_0x3820c5);return _0x3eb532[_0xbc00('0x1b')](_0xbc00('0x1c'),_0x4e529d+'-'+_0x5c1423+'/'+_0x53b0cd)['json'](_0x3d9659);}return null;};}function patchUpdates(_0x340f91){return function(_0x225ee6){try{jsonpatch[_0xbc00('0x1d')](_0x225ee6,_0x340f91,!![]);}catch(_0x13abd5){return BPromise[_0xbc00('0x1e')](_0x13abd5);}return _0x225ee6[_0xbc00('0x1f')]();};}function saveUpdates(_0x5c5131,_0x4c88c6){return function(_0x39afdf){if(_0x39afdf){return _0x39afdf[_0xbc00('0x20')](_0x5c5131)[_0xbc00('0x21')](function(_0x5286eb){return _0x5286eb;});}return null;};}function removeEntity(_0x334f8b,_0xf54de8){return function(_0x593289){if(_0x593289){return _0x593289['destroy']()[_0xbc00('0x21')](function(){_0x334f8b[_0xbc00('0x15')](0xcc)[_0xbc00('0x16')]();});}};}function handleEntityNotFound(_0x532f0d,_0x5f21c5){return function(_0x1a969f){if(!_0x1a969f){_0x532f0d['sendStatus'](0x194);}return _0x1a969f;};}function handleError(_0x33a6be,_0x3543f2){_0x3543f2=_0x3543f2||0x1f4;return function(_0x4b3356){logger[_0xbc00('0x22')](_0x4b3356[_0xbc00('0x23')]);if(_0x4b3356[_0xbc00('0x24')]){delete _0x4b3356[_0xbc00('0x24')];}_0x33a6be['status'](_0x3543f2)[_0xbc00('0x25')](_0x4b3356);};}exports[_0xbc00('0x26')]=function(_0x15724a,_0x458c3e){var _0x1a9da0={},_0x1a0e23={},_0x30c348={'count':0x0,'rows':[]};var _0x57a4a8=_[_0xbc00('0x27')](db[_0xbc00('0x28')]['rawAttributes'],function(_0x2c0cb3){return{'name':_0x2c0cb3[_0xbc00('0x29')],'type':_0x2c0cb3[_0xbc00('0x2a')][_0xbc00('0x2b')]};});_0x1a0e23[_0xbc00('0x2c')]=_[_0xbc00('0x27')](_0x57a4a8,_0xbc00('0x24'));_0x1a0e23[_0xbc00('0x2d')]=_[_0xbc00('0x2e')](_0x15724a[_0xbc00('0x2d')]);_0x1a0e23['filters']=_[_0xbc00('0x2f')](_0x1a0e23[_0xbc00('0x2c')],_0x1a0e23[_0xbc00('0x2d')]);_0x1a9da0[_0xbc00('0x30')]=_['intersection'](_0x1a0e23[_0xbc00('0x2c')],qs[_0xbc00('0x31')](_0x15724a[_0xbc00('0x2d')][_0xbc00('0x31')]));_0x1a9da0[_0xbc00('0x30')]=_0x1a9da0['attributes'][_0xbc00('0x32')]?_0x1a9da0[_0xbc00('0x30')]:_0x1a0e23[_0xbc00('0x2c')];if(!_0x15724a['query'][_0xbc00('0x33')](_0xbc00('0x34'))){_0x1a9da0[_0xbc00('0x35')]=qs[_0xbc00('0x35')](_0x15724a[_0xbc00('0x2d')]['limit']);_0x1a9da0[_0xbc00('0x18')]=qs[_0xbc00('0x18')](_0x15724a[_0xbc00('0x2d')][_0xbc00('0x18')]);}_0x1a9da0[_0xbc00('0x36')]=qs[_0xbc00('0x37')](_0x15724a['query']['sort']);_0x1a9da0[_0xbc00('0x38')]=qs[_0xbc00('0x39')](_[_0xbc00('0x3a')](_0x15724a[_0xbc00('0x2d')],_0x1a0e23[_0xbc00('0x39')]),_0x57a4a8);if(_0x15724a['query']['filter']){_0x1a9da0[_0xbc00('0x38')]=_[_0xbc00('0x3b')](_0x1a9da0[_0xbc00('0x38')],{'$or':_['map'](_0x57a4a8,function(_0x2c8060){if(_0x2c8060[_0xbc00('0x2a')]!==_0xbc00('0x3c')){var _0x465f0d={};_0x465f0d[_0x2c8060['name']]={'$like':'%'+_0x15724a[_0xbc00('0x2d')]['filter']+'%'};return _0x465f0d;}})});}_0x1a9da0=_[_0xbc00('0x3b')]({},_0x1a9da0,_0x15724a[_0xbc00('0x3d')]);var _0x5ead44={'where':_0x1a9da0['where']};return db[_0xbc00('0x28')][_0xbc00('0x1a')](_0x5ead44)[_0xbc00('0x21')](function(_0x7d36a2){_0x30c348[_0xbc00('0x1a')]=_0x7d36a2;if(_0x15724a[_0xbc00('0x2d')][_0xbc00('0x3e')]){_0x1a9da0[_0xbc00('0x3f')]=[{'all':!![]}];}return db[_0xbc00('0x28')]['findAll'](_0x1a9da0);})[_0xbc00('0x21')](function(_0x51c4d8){_0x30c348[_0xbc00('0x40')]=_0x51c4d8;return _0x30c348;})[_0xbc00('0x21')](respondWithFilteredResult(_0x458c3e,_0x1a9da0))['catch'](handleError(_0x458c3e,null));};exports[_0xbc00('0x41')]=function(_0x56e4fa,_0x112067){var _0x3ce349={'raw':!![],'where':{'id':_0x56e4fa['params']['id']}},_0x25b82a={};_0x25b82a[_0xbc00('0x2c')]=_['keys'](db[_0xbc00('0x28')][_0xbc00('0x42')]);_0x25b82a[_0xbc00('0x2d')]=_[_0xbc00('0x2e')](_0x56e4fa[_0xbc00('0x2d')]);_0x25b82a['filters']=_['intersection'](_0x25b82a['model'],_0x25b82a['query']);_0x3ce349[_0xbc00('0x30')]=_[_0xbc00('0x2f')](_0x25b82a['model'],qs[_0xbc00('0x31')](_0x56e4fa[_0xbc00('0x2d')][_0xbc00('0x31')]));_0x3ce349['attributes']=_0x3ce349[_0xbc00('0x30')][_0xbc00('0x32')]?_0x3ce349['attributes']:_0x25b82a['model'];if(_0x56e4fa['query'][_0xbc00('0x3e')]){_0x3ce349[_0xbc00('0x3f')]=[{'all':!![]}];}_0x3ce349=_[_0xbc00('0x3b')]({},_0x3ce349,_0x56e4fa[_0xbc00('0x3d')]);return db[_0xbc00('0x28')][_0xbc00('0x43')](_0x3ce349)[_0xbc00('0x21')](handleEntityNotFound(_0x112067,null))['then'](respondWithResult(_0x112067,null))['catch'](handleError(_0x112067,null));};exports[_0xbc00('0x20')]=function(_0x47f693,_0x43a386){if(_0x47f693['body']['id']){delete _0x47f693[_0xbc00('0x44')]['id'];}return db[_0xbc00('0x28')]['find']({'where':{'id':_0x47f693[_0xbc00('0x45')]['id']}})[_0xbc00('0x21')](handleEntityNotFound(_0x43a386,null))['then'](saveUpdates(_0x47f693[_0xbc00('0x44')],null))['then'](respondWithResult(_0x43a386,null))[_0xbc00('0x46')](handleError(_0x43a386,null));};exports[_0xbc00('0x47')]=function(_0x5b2c0b,_0x41cd92){return db[_0xbc00('0x28')]['find']({'where':{'id':_0x5b2c0b[_0xbc00('0x45')]['id']}})[_0xbc00('0x21')](handleEntityNotFound(_0x41cd92,null))[_0xbc00('0x21')](removeEntity(_0x41cd92,null))[_0xbc00('0x46')](handleError(_0x41cd92,null));};exports[_0xbc00('0x48')]=function(_0xd08fe5,_0xa9be82){return db[_0xbc00('0x28')][_0xbc00('0x48')]()[_0xbc00('0x21')](respondWithResult(_0xa9be82,null))[_0xbc00('0x46')](handleError(_0xa9be82,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index e9c92e4..bfabb93 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 _0xcb10=['path','rimraf','../../config/environment','define','CmHopperBlack','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x2d0312,_0x133a2c){var _0x488377=function(_0x4df70d){while(--_0x4df70d){_0x2d0312['push'](_0x2d0312['shift']());}};_0x488377(++_0x133a2c);}(_0xcb10,0xb5));var _0x0cb1=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0xcb10[_0x2aec52];return _0x3b8835;};'use strict';var _=require(_0x0cb1('0x0'));var util=require(_0x0cb1('0x1'));var logger=require(_0x0cb1('0x2'))(_0x0cb1('0x3'));var moment=require('moment');var BPromise=require(_0x0cb1('0x4'));var rp=require(_0x0cb1('0x5'));var fs=require('fs');var path=require(_0x0cb1('0x6'));var rimraf=require(_0x0cb1('0x7'));var config=require(_0x0cb1('0x8'));var attributes=require('./cmHopperBlack.attributes');module['exports']=function(_0xd4495e,_0x1ae714){return _0xd4495e[_0x0cb1('0x9')](_0x0cb1('0xa'),attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf61c=['cm_hopper_black','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf61c,0x121));var _0xcf61=function(_0x292b1b,_0x4102ba){_0x292b1b=_0x292b1b-0x0;var _0x40c64c=_0xf61c[_0x292b1b];return _0x40c64c;};'use strict';var _=require(_0xcf61('0x0'));var util=require('util');var logger=require(_0xcf61('0x1'))('api');var moment=require(_0xcf61('0x2'));var BPromise=require(_0xcf61('0x3'));var rp=require(_0xcf61('0x4'));var fs=require('fs');var path=require(_0xcf61('0x5'));var rimraf=require(_0xcf61('0x6'));var config=require(_0xcf61('0x7'));var attributes=require(_0xcf61('0x8'));module[_0xcf61('0x9')]=function(_0x1551ac,_0xffc3c){return _0x1551ac[_0xcf61('0xa')]('CmHopperBlack',attributes,{'tableName':_0xcf61('0xb'),'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 f2bcc22..76adf08 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 _0x6922=['where','attributes','map','include','model','update','body','limit','then','UpdateCmHopperBlack','catch','DestroyCmHopperBlack','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetCmHopperBlack','CmHopperBlack','findAll','options','raw'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x6922,0x1b9));var _0x2692=function(_0x497976,_0x2d7586){_0x497976=_0x497976-0x0;var _0x177dcc=_0x6922[_0x497976];return _0x177dcc;};'use strict';var _=require(_0x2692('0x0'));var util=require(_0x2692('0x1'));var moment=require(_0x2692('0x2'));var BPromise=require(_0x2692('0x3'));var rs=require(_0x2692('0x4'));var fs=require('fs');var Redis=require(_0x2692('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2692('0x6'));var logger=require(_0x2692('0x7'))(_0x2692('0x8'));var config=require(_0x2692('0x9'));var jayson=require(_0x2692('0xa'));var client=jayson[_0x2692('0xb')][_0x2692('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4dcbf3,_0x5243ea,_0x307ce2){return new BPromise(function(_0x38acd6,_0x328f4a){return client[_0x2692('0xd')](_0x4dcbf3,_0x307ce2)['then'](function(_0xc9e450){logger[_0x2692('0xe')](_0x2692('0xf'),_0x5243ea,_0x2692('0x10'));logger[_0x2692('0x11')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x5243ea,_0x2692('0x10'),JSON[_0x2692('0x12')](_0xc9e450));if(_0xc9e450[_0x2692('0x13')]){if(_0xc9e450[_0x2692('0x13')][_0x2692('0x14')]===0x1f4){logger[_0x2692('0x13')](_0x2692('0xf'),_0x5243ea,_0xc9e450[_0x2692('0x13')]['message']);return _0x328f4a(_0xc9e450[_0x2692('0x13')][_0x2692('0x15')]);}logger['error'](_0x2692('0xf'),_0x5243ea,_0xc9e450[_0x2692('0x13')][_0x2692('0x15')]);return _0x38acd6(_0xc9e450[_0x2692('0x13')][_0x2692('0x15')]);}else{logger[_0x2692('0xe')](_0x2692('0xf'),_0x5243ea,_0x2692('0x10'));_0x38acd6(_0xc9e450['result'][_0x2692('0x15')]);}})['catch'](function(_0x37be2a){logger[_0x2692('0x13')]('CmHopperBlack,\x20%s,\x20%s',_0x5243ea,_0x37be2a);_0x328f4a(_0x37be2a);});});}exports[_0x2692('0x16')]=function(_0x27371a){var _0x2eb4de=this;return new Promise(function(_0x21b95a,_0x441af4){return db[_0x2692('0x17')][_0x2692('0x18')]({'raw':_0x27371a[_0x2692('0x19')]?_0x27371a[_0x2692('0x19')][_0x2692('0x1a')]===undefined?!![]:![]:!![],'where':_0x27371a['options']?_0x27371a[_0x2692('0x19')][_0x2692('0x1b')]||null:null,'attributes':_0x27371a[_0x2692('0x19')]?_0x27371a[_0x2692('0x19')][_0x2692('0x1c')]||null:null,'limit':_0x27371a['options']?_0x27371a['options']['limit']||null:null,'include':_0x27371a[_0x2692('0x19')]?_0x27371a[_0x2692('0x19')]['include']?_[_0x2692('0x1d')](_0x27371a[_0x2692('0x19')][_0x2692('0x1e')],function(_0x1540c2){return{'model':db[_0x1540c2['model']],'as':_0x1540c2['as'],'attributes':_0x1540c2[_0x2692('0x1c')],'include':_0x1540c2[_0x2692('0x1e')]?_[_0x2692('0x1d')](_0x1540c2[_0x2692('0x1e')],function(_0x4ffc83){return{'model':db[_0x4ffc83[_0x2692('0x1f')]],'as':_0x4ffc83['as'],'attributes':_0x4ffc83['attributes'],'include':_0x4ffc83[_0x2692('0x1e')]?_['map'](_0x4ffc83[_0x2692('0x1e')],function(_0x2f3907){return{'model':db[_0x2f3907['model']],'as':_0x2f3907['as'],'attributes':_0x2f3907[_0x2692('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ec20a){logger['info']('GetCmHopperBlack',_0x27371a);logger[_0x2692('0x11')](_0x2692('0x16'),_0x27371a,JSON[_0x2692('0x12')](_0x3ec20a));_0x21b95a(_0x3ec20a);})['catch'](function(_0x59d679){logger[_0x2692('0x13')]('GetCmHopperBlack',_0x59d679[_0x2692('0x15')],_0x27371a);_0x441af4(_0x2eb4de[_0x2692('0x13')](0x1f4,_0x59d679[_0x2692('0x15')]));});});};exports['UpdateCmHopperBlack']=function(_0x2ba6a6){var _0x1b67a7=this;return new Promise(function(_0x1f77d0,_0xf49b73){return db[_0x2692('0x17')][_0x2692('0x20')](_0x2ba6a6[_0x2692('0x21')],{'raw':_0x2ba6a6['options']?_0x2ba6a6[_0x2692('0x19')][_0x2692('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ba6a6['options']?_0x2ba6a6['options'][_0x2692('0x1b')]||null:null,'attributes':_0x2ba6a6[_0x2692('0x19')]?_0x2ba6a6[_0x2692('0x19')][_0x2692('0x1c')]||null:null,'limit':_0x2ba6a6[_0x2692('0x19')]?_0x2ba6a6[_0x2692('0x19')][_0x2692('0x22')]||null:null})[_0x2692('0x23')](function(_0x36ee1c){logger['info'](_0x2692('0x24'),_0x2ba6a6);logger['debug']('UpdateCmHopperBlack',_0x2ba6a6,JSON[_0x2692('0x12')](_0x36ee1c));_0x1f77d0(_0x36ee1c);})[_0x2692('0x25')](function(_0x3fe14b){logger[_0x2692('0x13')](_0x2692('0x24'),_0x3fe14b[_0x2692('0x15')],_0x2ba6a6);_0xf49b73(_0x1b67a7[_0x2692('0x13')](0x1f4,_0x3fe14b[_0x2692('0x15')]));});});};exports['DestroyCmHopperBlack']=function(_0x2a87b7){var _0x4c181b=this;return new Promise(function(_0x49236b,_0x5a1f0e){return db[_0x2692('0x17')]['destroy']({'where':_0x2a87b7['options']?_0x2a87b7[_0x2692('0x19')][_0x2692('0x1b')]||null:null})[_0x2692('0x23')](function(_0x4d23c8){logger[_0x2692('0xe')](_0x2692('0x26'),_0x2a87b7);logger[_0x2692('0x11')](_0x2692('0x26'),_0x2a87b7,JSON[_0x2692('0x12')](_0x4d23c8));_0x49236b(_0x4d23c8);})[_0x2692('0x25')](function(_0x28ff26){logger[_0x2692('0x13')](_0x2692('0x26'),_0x28ff26['message'],_0x2a87b7);_0x5a1f0e(_0x4c181b[_0x2692('0x13')](0x1f4,_0x28ff26[_0x2692('0x15')]));});});}; \ No newline at end of file +var _0xfdd2=['message','request\x20sent','result','GetCmHopperBlack','CmHopperBlack','findAll','raw','options','where','attributes','limit','model','include','map','then','catch','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x449561,_0x694bc6){var _0x1f08b3=function(_0x1f7d8d){while(--_0x1f7d8d){_0x449561['push'](_0x449561['shift']());}};_0x1f08b3(++_0x694bc6);}(_0xfdd2,0xb1));var _0x2fdd=function(_0x1df5cd,_0x3dc641){_0x1df5cd=_0x1df5cd-0x0;var _0xf6df9b=_0xfdd2[_0x1df5cd];return _0xf6df9b;};'use strict';var _=require(_0x2fdd('0x0'));var util=require(_0x2fdd('0x1'));var moment=require(_0x2fdd('0x2'));var BPromise=require('bluebird');var rs=require(_0x2fdd('0x3'));var fs=require('fs');var Redis=require(_0x2fdd('0x4'));var db=require(_0x2fdd('0x5'))['db'];var utils=require(_0x2fdd('0x6'));var logger=require(_0x2fdd('0x7'))(_0x2fdd('0x8'));var config=require('../../config/environment');var jayson=require(_0x2fdd('0x9'));var client=jayson[_0x2fdd('0xa')][_0x2fdd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x645179,_0x4367d2,_0x4dc1af){return new BPromise(function(_0x5e6c2a,_0xe8a48e){return client['request'](_0x645179,_0x4dc1af)['then'](function(_0x28c9a7){logger[_0x2fdd('0xc')](_0x2fdd('0xd'),_0x4367d2,'request\x20sent');logger[_0x2fdd('0xe')](_0x2fdd('0xf'),_0x4367d2,'request\x20sent',JSON[_0x2fdd('0x10')](_0x28c9a7));if(_0x28c9a7[_0x2fdd('0x11')]){if(_0x28c9a7[_0x2fdd('0x11')]['code']===0x1f4){logger['error'](_0x2fdd('0xd'),_0x4367d2,_0x28c9a7[_0x2fdd('0x11')][_0x2fdd('0x12')]);return _0xe8a48e(_0x28c9a7[_0x2fdd('0x11')][_0x2fdd('0x12')]);}logger['error'](_0x2fdd('0xd'),_0x4367d2,_0x28c9a7[_0x2fdd('0x11')][_0x2fdd('0x12')]);return _0x5e6c2a(_0x28c9a7[_0x2fdd('0x11')][_0x2fdd('0x12')]);}else{logger[_0x2fdd('0xc')](_0x2fdd('0xd'),_0x4367d2,_0x2fdd('0x13'));_0x5e6c2a(_0x28c9a7[_0x2fdd('0x14')][_0x2fdd('0x12')]);}})['catch'](function(_0x37bf9d){logger[_0x2fdd('0x11')](_0x2fdd('0xd'),_0x4367d2,_0x37bf9d);_0xe8a48e(_0x37bf9d);});});}exports[_0x2fdd('0x15')]=function(_0x493187){var _0x1cc220=this;return new Promise(function(_0x177940,_0xcda669){return db[_0x2fdd('0x16')][_0x2fdd('0x17')]({'raw':_0x493187['options']?_0x493187['options'][_0x2fdd('0x18')]===undefined?!![]:![]:!![],'where':_0x493187['options']?_0x493187[_0x2fdd('0x19')][_0x2fdd('0x1a')]||null:null,'attributes':_0x493187[_0x2fdd('0x19')]?_0x493187['options'][_0x2fdd('0x1b')]||null:null,'limit':_0x493187[_0x2fdd('0x19')]?_0x493187['options'][_0x2fdd('0x1c')]||null:null,'include':_0x493187[_0x2fdd('0x19')]?_0x493187[_0x2fdd('0x19')]['include']?_['map'](_0x493187['options']['include'],function(_0x309559){return{'model':db[_0x309559[_0x2fdd('0x1d')]],'as':_0x309559['as'],'attributes':_0x309559[_0x2fdd('0x1b')],'include':_0x309559[_0x2fdd('0x1e')]?_[_0x2fdd('0x1f')](_0x309559[_0x2fdd('0x1e')],function(_0x3267d5){return{'model':db[_0x3267d5[_0x2fdd('0x1d')]],'as':_0x3267d5['as'],'attributes':_0x3267d5[_0x2fdd('0x1b')],'include':_0x3267d5[_0x2fdd('0x1e')]?_[_0x2fdd('0x1f')](_0x3267d5[_0x2fdd('0x1e')],function(_0x51b70a){return{'model':db[_0x51b70a[_0x2fdd('0x1d')]],'as':_0x51b70a['as'],'attributes':_0x51b70a[_0x2fdd('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x2fdd('0x20')](function(_0xff87a1){logger[_0x2fdd('0xc')](_0x2fdd('0x15'),_0x493187);logger[_0x2fdd('0xe')]('GetCmHopperBlack',_0x493187,JSON[_0x2fdd('0x10')](_0xff87a1));_0x177940(_0xff87a1);})[_0x2fdd('0x21')](function(_0x3f3556){logger[_0x2fdd('0x11')](_0x2fdd('0x15'),_0x3f3556[_0x2fdd('0x12')],_0x493187);_0xcda669(_0x1cc220[_0x2fdd('0x11')](0x1f4,_0x3f3556[_0x2fdd('0x12')]));});});};exports[_0x2fdd('0x22')]=function(_0xf482d6){var _0x41897a=this;return new Promise(function(_0x449479,_0x1709e0){return db[_0x2fdd('0x16')][_0x2fdd('0x23')](_0xf482d6[_0x2fdd('0x24')],{'raw':_0xf482d6['options']?_0xf482d6['options'][_0x2fdd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf482d6[_0x2fdd('0x19')]?_0xf482d6[_0x2fdd('0x19')]['where']||null:null,'attributes':_0xf482d6['options']?_0xf482d6['options']['attributes']||null:null,'limit':_0xf482d6['options']?_0xf482d6[_0x2fdd('0x19')][_0x2fdd('0x1c')]||null:null})['then'](function(_0x318dc7){logger[_0x2fdd('0xc')](_0x2fdd('0x22'),_0xf482d6);logger[_0x2fdd('0xe')](_0x2fdd('0x22'),_0xf482d6,JSON[_0x2fdd('0x10')](_0x318dc7));_0x449479(_0x318dc7);})[_0x2fdd('0x21')](function(_0x191d27){logger[_0x2fdd('0x11')](_0x2fdd('0x22'),_0x191d27[_0x2fdd('0x12')],_0xf482d6);_0x1709e0(_0x41897a[_0x2fdd('0x11')](0x1f4,_0x191d27[_0x2fdd('0x12')]));});});};exports[_0x2fdd('0x25')]=function(_0x44c93f){var _0x58fd1e=this;return new Promise(function(_0x4f9cfc,_0x4d91b5){return db[_0x2fdd('0x16')][_0x2fdd('0x26')]({'where':_0x44c93f['options']?_0x44c93f[_0x2fdd('0x19')][_0x2fdd('0x1a')]||null:null})['then'](function(_0x47d766){logger[_0x2fdd('0xc')](_0x2fdd('0x25'),_0x44c93f);logger[_0x2fdd('0xe')](_0x2fdd('0x25'),_0x44c93f,JSON[_0x2fdd('0x10')](_0x47d766));_0x4f9cfc(_0x47d766);})['catch'](function(_0x41ad7f){logger['error'](_0x2fdd('0x25'),_0x41ad7f[_0x2fdd('0x12')],_0x44c93f);_0x4d91b5(_0x58fd1e[_0x2fdd('0x11')](0x1f4,_0x41ad7f['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 05b95e5..8e01abf 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 _0x5334=['isAuthenticated','show','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','index','describe','get','/:id'];(function(_0x12d3f4,_0x377f2c){var _0x4f9bf4=function(_0x2df216){while(--_0x2df216){_0x12d3f4['push'](_0x12d3f4['shift']());}};_0x4f9bf4(++_0x377f2c);}(_0x5334,0x84));var _0x4533=function(_0x3bca4f,_0x3e0414){_0x3bca4f=_0x3bca4f-0x0;var _0x5e45d3=_0x5334[_0x3bca4f];return _0x5e45d3;};'use strict';var multer=require(_0x4533('0x0'));var util=require(_0x4533('0x1'));var path=require(_0x4533('0x2'));var timeout=require(_0x4533('0x3'));var express=require(_0x4533('0x4'));var router=express['Router']();var fs_extra=require(_0x4533('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4533('0x6'));var config=require(_0x4533('0x7'));var controller=require('./cmHopperBlack.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x4533('0x8')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x4533('0x9')]);router[_0x4533('0xa')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller[_0x4533('0xd')]);router[_0x4533('0xe')](_0x4533('0xb'),auth['isAuthenticated'](),controller[_0x4533('0xf')]);router[_0x4533('0x10')](_0x4533('0xb'),auth[_0x4533('0xc')](),controller['destroy']);module[_0x4533('0x11')]=router; \ No newline at end of file +var _0x627e=['describe','/:id','put','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe'];(function(_0x1a57c7,_0x1f0c32){var _0xb5899c=function(_0x4b7242){while(--_0x4b7242){_0x1a57c7['push'](_0x1a57c7['shift']());}};_0xb5899c(++_0x1f0c32);}(_0x627e,0x14a));var _0xe627=function(_0x8e500b,_0x5537d7){_0x8e500b=_0x8e500b-0x0;var _0x270372=_0x627e[_0x8e500b];return _0x270372;};'use strict';var multer=require(_0xe627('0x0'));var util=require(_0xe627('0x1'));var path=require(_0xe627('0x2'));var timeout=require(_0xe627('0x3'));var express=require(_0xe627('0x4'));var router=express['Router']();var fs_extra=require(_0xe627('0x5'));var auth=require(_0xe627('0x6'));var interaction=require(_0xe627('0x7'));var config=require('../../config/environment');var controller=require('./cmHopperBlack.controller');router['get']('/',auth[_0xe627('0x8')](),controller[_0xe627('0x9')]);router[_0xe627('0xa')](_0xe627('0xb'),auth[_0xe627('0x8')](),controller[_0xe627('0xc')]);router['get'](_0xe627('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xe627('0xe')](_0xe627('0xd'),auth['isAuthenticated'](),controller['update']);router[_0xe627('0xf')](_0xe627('0xd'),auth[_0xe627('0x8')](),controller[_0xe627('0x10')]);module[_0xe627('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 5071408..cff1c7d 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 _0x145e=['BOOLEAN','sequelize','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime','followuptime','diff','seconds'];(function(_0xf26c2e,_0x56c3ea){var _0x46ecb4=function(_0x1be516){while(--_0x1be516){_0xf26c2e['push'](_0xf26c2e['shift']());}};_0x46ecb4(++_0x56c3ea);}(_0x145e,0x1ed));var _0xe145=function(_0x111c6c,_0x5ac573){_0x111c6c=_0x111c6c-0x0;var _0x2e983a=_0x145e[_0x111c6c];return _0x2e983a;};'use strict';var Sequelize=require(_0xe145('0x0'));var moment=require(_0xe145('0x1'));module[_0xe145('0x2')]={'state':{'type':Sequelize[_0xe145('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xe145('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xe145('0x4')]},'originatecalleridname':{'type':Sequelize[_0xe145('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xe145('0x5')]},'responsetime':{'type':Sequelize[_0xe145('0x5')]},'answertime':{'type':Sequelize[_0xe145('0x5')]},'droptime':{'type':Sequelize[_0xe145('0x5')]},'endtime':{'type':Sequelize[_0xe145('0x5')]},'ringtime':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0xe145('0x4')]},'campaigntype':{'type':Sequelize[_0xe145('0x4')]},'membername':{'type':Sequelize[_0xe145('0x4')]},'reason':{'type':Sequelize[_0xe145('0x4')]},'disposition':{'type':Sequelize[_0xe145('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xe145('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x17b478){var _0x3a84d6=this[_0xe145('0x6')](_0xe145('0x7'));if(_0x3a84d6&&_0x17b478){this['setDataValue'](_0xe145('0x8'),moment(_0x17b478)[_0xe145('0x9')](moment(_0x3a84d6),_0xe145('0xa')));}}},'amd':{'type':Sequelize[_0xe145('0xb')],'defaultValue':![]},'fax':{'type':Sequelize[_0xe145('0xb')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xe145('0xb')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xe145('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0xe145('0x5')]},'callback':{'type':Sequelize[_0xe145('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xe145('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xe145('0x5')]},'deleted':{'type':Sequelize[_0xe145('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xe145('0x5')]},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xe145('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xe145('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9589=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','seconds','BOOLEAN','sequelize','moment'];(function(_0x4e95c8,_0x26c8f6){var _0x1d5ecf=function(_0x3474df){while(--_0x3474df){_0x4e95c8['push'](_0x4e95c8['shift']());}};_0x1d5ecf(++_0x26c8f6);}(_0x9589,0x1d2));var _0x9958=function(_0x1dc6bb,_0x1f7408){_0x1dc6bb=_0x1dc6bb-0x0;var _0x53600a=_0x9589[_0x1dc6bb];return _0x53600a;};'use strict';var Sequelize=require(_0x9958('0x0'));var moment=require(_0x9958('0x1'));module[_0x9958('0x2')]={'state':{'type':Sequelize[_0x9958('0x3')](0x2)},'statedesc':{'type':Sequelize[_0x9958('0x4')]},'scheduledat':{'type':Sequelize[_0x9958('0x5')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x9958('0x4')]},'originatecalleridnum':{'type':Sequelize[_0x9958('0x4')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x9958('0x4')]},'calleridname':{'type':Sequelize[_0x9958('0x4')]},'starttime':{'type':Sequelize[_0x9958('0x5')]},'responsetime':{'type':Sequelize[_0x9958('0x5')]},'answertime':{'type':Sequelize[_0x9958('0x5')]},'droptime':{'type':Sequelize[_0x9958('0x5')]},'endtime':{'type':Sequelize[_0x9958('0x5')]},'ringtime':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x9958('0x4')]},'campaign':{'type':Sequelize[_0x9958('0x4')]},'campaigntype':{'type':Sequelize[_0x9958('0x4')]},'membername':{'type':Sequelize[_0x9958('0x4')]},'reason':{'type':Sequelize[_0x9958('0x4')]},'disposition':{'type':Sequelize[_0x9958('0x4')]},'secondDisposition':{'type':Sequelize[_0x9958('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x3fbd76){var _0x368a7e=this[_0x9958('0x6')](_0x9958('0x7'));if(_0x368a7e&&_0x3fbd76){this[_0x9958('0x8')](_0x9958('0x9'),moment(_0x3fbd76)[_0x9958('0xa')](moment(_0x368a7e),_0x9958('0xb')));}}},'amd':{'type':Sequelize[_0x9958('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x9958('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x9958('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x9958('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x9958('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x9958('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x9958('0x5')]},'deleted':{'type':Sequelize[_0x9958('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x9958('0x5')]},'recallme':{'type':Sequelize[_0x9958('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x9958('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x9958('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x9958('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 07a3d26..14c8b15 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 _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(_0x37fe9a,_0x454238){var _0x23f59d=function(_0x909f5b){while(--_0x909f5b){_0x37fe9a['push'](_0x37fe9a['shift']());}};_0x23f59d(++_0x454238);}(_0x57ca,0x108));var _0xa57c=function(_0x294cd5,_0x42d039){_0x294cd5=_0x294cd5-0x0;var _0x558055=_0x57ca[_0x294cd5];return _0x558055;};'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 +var _0xfcf0=['noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x2010\x20,\x201,\x20null','abandonedContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','NOW()','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','state\x20=\x20?','state','toString','VoiceQueueId\x20=\x20?','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','ListId','CampaignId','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum\x20IS\x20NOT\x20NULL','CmHopper','findOne','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','describe','body','uniqueid','find','findAll','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null'];(function(_0x22b2f8,_0x152017){var _0x14702f=function(_0x32c54a){while(--_0x32c54a){_0x22b2f8['push'](_0x22b2f8['shift']());}};_0x14702f(++_0x152017);}(_0xfcf0,0x138));var _0x0fcf=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xfcf0[_0x341e0f];return _0x59555a;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':!![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')]()[_0x0fcf('0x24')](respondWithResult(_0x345188,null))['catch'](handleError(_0x345188,null));};exports['update']=function(_0x259c91,_0x243699){if(_0x259c91[_0x0fcf('0x47')][_0x0fcf('0x48')]){delete _0x259c91[_0x0fcf('0x47')][_0x0fcf('0x48')];}return db['CmHopperFinal'][_0x0fcf('0x49')]({'where':{'uniqueid':_0x259c91[_0x0fcf('0x43')]['id']}})['then'](handleEntityNotFound(_0x243699,null))[_0x0fcf('0x24')](saveUpdates(_0x259c91[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x243699,null))[_0x0fcf('0x42')](handleError(_0x243699,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0xc514bf,_0x382448,_0x1bb062){return db[_0x0fcf('0x2b')][_0x0fcf('0x4a')]({'raw':![],'where':{'VoiceQueueId':_0xc514bf[_0x0fcf('0x43')]['id']},'attributes':[[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x4e')))),_0x0fcf('0x4f')],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x50')))),_0x0fcf('0x51')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')]['literal'](_0x0fcf('0x52')))),_0x0fcf('0x53')],[db['sequelize']['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x54')))),_0x0fcf('0x55')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0fcf('0x4d')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x0fcf('0x56')],[db[_0x0fcf('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x57')))),'abandonedContacts'],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x2022,\x201,\x20null'))),_0x0fcf('0x58')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x59')))),_0x0fcf('0x5a')]]})[_0x0fcf('0x24')](handleEntityNotFound(_0x382448,null))[_0x0fcf('0x24')](respondWithResult(_0x382448,null))[_0x0fcf('0x42')](handleError(_0x382448,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x62d12e,_0x1dda2e,_0x6af0f5){return db[_0x0fcf('0x2b')][_0x0fcf('0x4a')]({'raw':![],'where':{'CampaignId':_0x62d12e[_0x0fcf('0x43')]['id']},'attributes':[[db[_0x0fcf('0x4b')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x200,\x201,\x20null'))),_0x0fcf('0x4f')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x50')))),_0x0fcf('0x51')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x52')))),_0x0fcf('0x53')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db['sequelize']['fn']('IF',db['sequelize'][_0x0fcf('0x4d')](_0x0fcf('0x54')))),_0x0fcf('0x55')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x5b')))),_0x0fcf('0x56')],[db['sequelize']['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')](_0x0fcf('0x57')))),_0x0fcf('0x5c')],[db[_0x0fcf('0x4b')]['fn'](_0x0fcf('0x4c'),db[_0x0fcf('0x4b')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022,\x201,\x20null'))),'reCallContacts'],[db[_0x0fcf('0x4b')]['fn']('COUNT',db[_0x0fcf('0x4b')]['fn']('IF',db[_0x0fcf('0x4b')][_0x0fcf('0x4d')]('`state`\x20=\x2019,\x201,\x20null'))),'answeringMachine']]})[_0x0fcf('0x24')](handleEntityNotFound(_0x1dda2e,null))[_0x0fcf('0x24')](respondWithResult(_0x1dda2e,null))['catch'](handleError(_0x1dda2e,null));};exports[_0x0fcf('0x5d')]=function(_0x3cb75a,_0x5936a6,_0x3d02c1){return db[_0x0fcf('0x5e')][_0x0fcf('0x49')]({'where':{'id':_0x3cb75a[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x5936a6,null))[_0x0fcf('0x24')](function(_0x4704c9){var _0x4b1f10;if(_0x4704c9){_0x4b1f10=squel[_0x0fcf('0x5f')]()[_0x0fcf('0x60')](_0x0fcf('0x61'))[_0x0fcf('0x62')]([_0x0fcf('0x63'),_0x0fcf('0x64'),'ContactId','ListId',_0x0fcf('0x65'),_0x0fcf('0x66'),_0x0fcf('0x67')],squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x69'),_0x0fcf('0x63'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x64'))['field']('ANY_VALUE(ContactId)',_0x0fcf('0x6c'))['field'](_0x0fcf('0x6d'),'ListId')[_0x0fcf('0x6a')](_0x0fcf('0x6e'),_0x0fcf('0x65'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),'createdAt')[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x67'))[_0x0fcf('0x6f')]('cm_hopper_final')[_0x0fcf('0x3d')]('VoiceQueueId\x20=\x20?',_0x3cb75a[_0x0fcf('0x43')]['id']['toString']())[_0x0fcf('0x3d')](_0x0fcf('0x70'),_0x3cb75a['body'][_0x0fcf('0x71')][_0x0fcf('0x72')]())[_0x0fcf('0x3d')]('calleridnum\x20IS\x20NOT\x20NULL')['where']('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x63'))[_0x0fcf('0x6f')](_0x0fcf('0x61'))[_0x0fcf('0x3d')](_0x0fcf('0x73'),_0x3cb75a[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]()))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel['select']()[_0x0fcf('0x6a')](_0x0fcf('0x75'))[_0x0fcf('0x6f')](_0x0fcf('0x76'))[_0x0fcf('0x3d')](_0x0fcf('0x73'),_0x3cb75a[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]())['where'](_0x0fcf('0x77')))[_0x0fcf('0x78')](_0x0fcf('0x6c')))[_0x0fcf('0x72')]();return db[_0x0fcf('0x4b')][_0x0fcf('0x33')](_0x4b1f10);}return[];})[_0x0fcf('0x24')](respondWithResult(_0x5936a6,null))['catch'](handleError(_0x5936a6,null));};exports[_0x0fcf('0x79')]=function(_0x489c6d,_0x18645d,_0x9e933e){return db[_0x0fcf('0x7a')]['find']({'where':{'id':_0x489c6d['params']['id']}})['then'](handleEntityNotFound(_0x18645d,null))['then'](function(_0x301991){var _0x46bcc2;if(_0x301991){_0x46bcc2=squel[_0x0fcf('0x5f')]()[_0x0fcf('0x60')](_0x0fcf('0x61'))[_0x0fcf('0x62')]([_0x0fcf('0x63'),_0x0fcf('0x64'),_0x0fcf('0x6c'),_0x0fcf('0x7b'),_0x0fcf('0x7c'),'createdAt',_0x0fcf('0x67')],squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x69'),'phone')[_0x0fcf('0x6a')](_0x0fcf('0x6b'),'scheduledAt')['field'](_0x0fcf('0x7d'),_0x0fcf('0x6c'))['field'](_0x0fcf('0x6d'),_0x0fcf('0x7b'))[_0x0fcf('0x6a')](_0x0fcf('0x7e'),_0x0fcf('0x7c'))[_0x0fcf('0x6a')](_0x0fcf('0x6b'),_0x0fcf('0x66'))['field'](_0x0fcf('0x6b'),_0x0fcf('0x67'))[_0x0fcf('0x6f')](_0x0fcf('0x76'))['where'](_0x0fcf('0x7f'),_0x489c6d['params']['id']['toString']())['where'](_0x0fcf('0x70'),_0x489c6d[_0x0fcf('0x47')][_0x0fcf('0x71')][_0x0fcf('0x72')]())[_0x0fcf('0x3d')](_0x0fcf('0x80'))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel[_0x0fcf('0x68')]()['field'](_0x0fcf('0x63'))[_0x0fcf('0x6f')](_0x0fcf('0x61'))[_0x0fcf('0x3d')](_0x0fcf('0x7f'),_0x489c6d[_0x0fcf('0x43')]['id'][_0x0fcf('0x72')]()))[_0x0fcf('0x3d')](_0x0fcf('0x74'),squel['select']()['field']('calleridnum')[_0x0fcf('0x6f')](_0x0fcf('0x76'))[_0x0fcf('0x3d')](_0x0fcf('0x7f'),_0x489c6d['params']['id']['toString']())['where'](_0x0fcf('0x77')))['group'](_0x0fcf('0x6c')))['toString']();return db[_0x0fcf('0x4b')]['query'](_0x46bcc2);}return[];})[_0x0fcf('0x24')](respondWithResult(_0x18645d,null))['catch'](handleError(_0x18645d,null));};exports['checkContactHopper']=function(_0x426625,_0x4ccae3,_0x2905fa){return db[_0x0fcf('0x81')][_0x0fcf('0x82')]({'where':{'VoiceQueueId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x65')],'CampaignId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x7c')],'ContactId':_0x426625[_0x0fcf('0x47')][_0x0fcf('0x6c')]}})[_0x0fcf('0x24')](handleEntityNotFound(_0x4ccae3,null))[_0x0fcf('0x24')](function(_0x274aa9){if(_0x274aa9){return _0x274aa9;}return null;})[_0x0fcf('0x24')](respondWithResult(_0x4ccae3,null))['catch'](handleError(_0x4ccae3,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index ce6ecec..7735728 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 _0x0818=['../../config/logger','request-promise','path','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util'];(function(_0x13d0c2,_0x46def9){var _0x153302=function(_0x2bb361){while(--_0x2bb361){_0x13d0c2['push'](_0x13d0c2['shift']());}};_0x153302(++_0x46def9);}(_0x0818,0x143));var _0x8081=function(_0x4313b7,_0x48641c){_0x4313b7=_0x4313b7-0x0;var _0x57dbbe=_0x0818[_0x4313b7];return _0x57dbbe;};'use strict';var _=require(_0x8081('0x0'));var util=require(_0x8081('0x1'));var logger=require(_0x8081('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8081('0x3'));var fs=require('fs');var path=require(_0x8081('0x4'));var rimraf=require('rimraf');var config=require(_0x8081('0x5'));var attributes=require(_0x8081('0x6'));module[_0x8081('0x7')]=function(_0x459f8e,_0x3d34b0){return _0x459f8e[_0x8081('0x8')](_0x8081('0x9'),attributes,{'tableName':_0x8081('0xa'),'paranoid':![],'indexes':[{'name':_0x8081('0xb'),'fields':[_0x8081('0xb')]},{'name':_0x8081('0xc'),'fields':[_0x8081('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbabc=['cm_hopper_final','calleridnum','uniqueid','lodash','util','moment','rimraf','./cmHopperFinal.attributes','define','CmHopperFinal'];(function(_0x17e429,_0x26671a){var _0x3aafc4=function(_0xa673d4){while(--_0xa673d4){_0x17e429['push'](_0x17e429['shift']());}};_0x3aafc4(++_0x26671a);}(_0xbabc,0xfd));var _0xcbab=function(_0x13beb9,_0x1f14c9){_0x13beb9=_0x13beb9-0x0;var _0xa3df3d=_0xbabc[_0x13beb9];return _0xa3df3d;};'use strict';var _=require(_0xcbab('0x0'));var util=require(_0xcbab('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xcbab('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcbab('0x3'));var config=require('../../config/environment');var attributes=require(_0xcbab('0x4'));module['exports']=function(_0x3499ea,_0x3ac788){return _0x3499ea[_0xcbab('0x5')](_0xcbab('0x6'),attributes,{'tableName':_0xcbab('0x7'),'paranoid':![],'indexes':[{'name':_0xcbab('0x8'),'fields':[_0xcbab('0x8')]},{'name':_0xcbab('0x9'),'fields':[_0xcbab('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 8591741..c53548d 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(_0x46f12b,_0x28678b){var _0x179daf=function(_0xa18d9){while(--_0xa18d9){_0x46f12b['push'](_0x46f12b['shift']());}};_0x179daf(++_0x28678b);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f9ea9,_0x19840d){_0x3f9ea9=_0x3f9ea9-0x0;var _0x291e7f=_0xb10b[_0x3f9ea9];return _0x291e7f;};'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 _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(_0x309b6a,_0x25bfcd){var _0x73e219=function(_0x2d692f){while(--_0x2d692f){_0x309b6a['push'](_0x309b6a['shift']());}};_0x73e219(++_0x25bfcd);}(_0xb10b,0x12a));var _0xbb10=function(_0x571a36,_0x5936f2){_0x571a36=_0x571a36-0x0;var _0x4dd68e=_0xb10b[_0x571a36];return _0x4dd68e;};'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 diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index d056845..2861c88 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 _0x9e42=['show','countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','/checkContactHopper','put','update','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x34331b,_0x22a64c){var _0x1f97c8=function(_0x488b07){while(--_0x488b07){_0x34331b['push'](_0x34331b['shift']());}};_0x1f97c8(++_0x22a64c);}(_0x9e42,0xd0));var _0x29e4=function(_0x3adb8e,_0x247ca2){_0x3adb8e=_0x3adb8e-0x0;var _0x3eacdb=_0x9e42[_0x3adb8e];return _0x3eacdb;};'use strict';var multer=require(_0x29e4('0x0'));var util=require(_0x29e4('0x1'));var path=require('path');var timeout=require(_0x29e4('0x2'));var express=require(_0x29e4('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x29e4('0x4'));var interaction=require(_0x29e4('0x5'));var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x29e4('0x6')]('/',auth[_0x29e4('0x7')](),controller[_0x29e4('0x8')]);router[_0x29e4('0x6')](_0x29e4('0x9'),auth['isAuthenticated'](),controller[_0x29e4('0xa')]);router['get'](_0x29e4('0xb'),auth[_0x29e4('0x7')](),controller[_0x29e4('0xc')]);router[_0x29e4('0x6')]('/voice/queue/countAttributes/:id',auth['isAuthenticated'](),controller[_0x29e4('0xd')]);router[_0x29e4('0x6')]('/campaign/countAttributes/:id',auth[_0x29e4('0x7')](),controller[_0x29e4('0xe')]);router[_0x29e4('0xf')](_0x29e4('0x10'),auth[_0x29e4('0x7')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x29e4('0xf')](_0x29e4('0x11'),auth['isAuthenticated'](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x29e4('0xf')](_0x29e4('0x12'),auth[_0x29e4('0x7')](),controller['checkContactHopper']);router[_0x29e4('0x13')](_0x29e4('0xb'),auth[_0x29e4('0x7')](),controller[_0x29e4('0x14')]);module[_0x29e4('0x15')]=router; \ No newline at end of file +var _0xa72d=['describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','checkContactHopper','put','update','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get'];(function(_0x457bc6,_0x431adc){var _0x337f06=function(_0x158788){while(--_0x158788){_0x457bc6['push'](_0x457bc6['shift']());}};_0x337f06(++_0x431adc);}(_0xa72d,0x1bf));var _0xda72=function(_0x3fc1d5,_0x4a4e2c){_0x3fc1d5=_0x3fc1d5-0x0;var _0x1b68eb=_0xa72d[_0x3fc1d5];return _0x1b68eb;};'use strict';var multer=require(_0xda72('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xda72('0x1'));var express=require(_0xda72('0x2'));var router=express[_0xda72('0x3')]();var fs_extra=require(_0xda72('0x4'));var auth=require(_0xda72('0x5'));var interaction=require(_0xda72('0x6'));var config=require(_0xda72('0x7'));var controller=require(_0xda72('0x8'));router['get']('/',auth[_0xda72('0x9')](),controller[_0xda72('0xa')]);router[_0xda72('0xb')]('/describe',auth[_0xda72('0x9')](),controller[_0xda72('0xc')]);router[_0xda72('0xb')](_0xda72('0xd'),auth[_0xda72('0x9')](),controller[_0xda72('0xe')]);router[_0xda72('0xb')](_0xda72('0xf'),auth[_0xda72('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0xda72('0x10'),auth['isAuthenticated'](),controller['countContactsIvrCampaignHopperFinal']);router[_0xda72('0x11')](_0xda72('0x12'),auth['isAuthenticated'](),controller[_0xda72('0x13')]);router[_0xda72('0x11')](_0xda72('0x14'),auth[_0xda72('0x9')](),controller[_0xda72('0x15')]);router['post'](_0xda72('0x16'),auth[_0xda72('0x9')](),controller[_0xda72('0x17')]);router[_0xda72('0x18')](_0xda72('0xd'),auth[_0xda72('0x9')](),controller[_0xda72('0x19')]);module[_0xda72('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 75a639b..6775b8c 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 _0xe108=['DATE','BOOLEAN','exports','STRING','INTEGER'];(function(_0x3a38f7,_0x2b700e){var _0x5a0eb3=function(_0x28fcd8){while(--_0x28fcd8){_0x3a38f7['push'](_0x3a38f7['shift']());}};_0x5a0eb3(++_0x2b700e);}(_0xe108,0x6b));var _0x8e10=function(_0x2c7377,_0x32ade5){_0x2c7377=_0x2c7377-0x0;var _0x35e181=_0xe108[_0x2c7377];return _0x35e181;};'use strict';var Sequelize=require('sequelize');module[_0x8e10('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x8e10('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x8e10('0x1')]},'originatecalleridnum':{'type':Sequelize[_0x8e10('0x1')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x8e10('0x1')]},'calleridname':{'type':Sequelize[_0x8e10('0x1')]},'starttime':{'type':Sequelize[_0x8e10('0x3')]},'responsetime':{'type':Sequelize[_0x8e10('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x8e10('0x3')]},'endtime':{'type':Sequelize[_0x8e10('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x8e10('0x1')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x8e10('0x1')]},'amd':{'type':Sequelize[_0x8e10('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x8e10('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x8e10('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8e10('0x1')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x8e10('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x8e10('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8e10('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8e10('0x1')]}}; \ No newline at end of file +var _0x6ee7=['BOOLEAN','sequelize','exports','INTEGER','STRING','DATE'];(function(_0x3a630a,_0x19db43){var _0x487f2c=function(_0x444b33){while(--_0x444b33){_0x3a630a['push'](_0x3a630a['shift']());}};_0x487f2c(++_0x19db43);}(_0x6ee7,0x1e1));var _0x76ee=function(_0x29dee5,_0x49761c){_0x29dee5=_0x29dee5-0x0;var _0x5f1bd9=_0x6ee7[_0x29dee5];return _0x5f1bd9;};'use strict';var Sequelize=require(_0x76ee('0x0'));module[_0x76ee('0x1')]={'state':{'type':Sequelize[_0x76ee('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x76ee('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x76ee('0x3')]},'originatecalleridnum':{'type':Sequelize[_0x76ee('0x3')]},'originatecalleridname':{'type':Sequelize[_0x76ee('0x3')]},'calleridnum':{'type':Sequelize[_0x76ee('0x3')]},'calleridname':{'type':Sequelize[_0x76ee('0x3')]},'starttime':{'type':Sequelize[_0x76ee('0x4')]},'responsetime':{'type':Sequelize[_0x76ee('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x76ee('0x4')]},'endtime':{'type':Sequelize[_0x76ee('0x4')]},'ringtime':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x76ee('0x3')]},'membername':{'type':Sequelize[_0x76ee('0x3')]},'reason':{'type':Sequelize[_0x76ee('0x3')]},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x76ee('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x76ee('0x4')]},'recallme':{'type':Sequelize[_0x76ee('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x76ee('0x4')]},'edited':{'type':Sequelize[_0x76ee('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x76ee('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x76ee('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index 5f282ea..ee5d40d 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 _0x8d2b=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','sendStatus','error','stack','name','send','index','type','key','map','query','keys','filters','intersection','fields','attributes','length','model','order','sort','pick','filter','where','merge','options','CmHopperHistory','findAll','then','rows','catch','show','rawAttributes','includeAll','find','create','body','describe','uniqueid','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring'];(function(_0x2fcf43,_0x3e5722){var _0x2bed87=function(_0x422b67){while(--_0x422b67){_0x2fcf43['push'](_0x2fcf43['shift']());}};_0x2bed87(++_0x3e5722);}(_0x8d2b,0x1c9));var _0xb8d2=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0x8d2b[_0x261e29];return _0x25ef43;};'use strict';var emlformat=require(_0xb8d2('0x0'));var rimraf=require(_0xb8d2('0x1'));var zipdir=require(_0xb8d2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8d2('0x3'));var moment=require(_0xb8d2('0x4'));var BPromise=require(_0xb8d2('0x5'));var Mustache=require(_0xb8d2('0x6'));var util=require(_0xb8d2('0x7'));var path=require(_0xb8d2('0x8'));var sox=require('sox');var csv=require(_0xb8d2('0x9'));var ejs=require(_0xb8d2('0xa'));var fs=require('fs');var fs_extra=require(_0xb8d2('0xb'));var _=require(_0xb8d2('0xc'));var squel=require(_0xb8d2('0xd'));var crypto=require(_0xb8d2('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb8d2('0xf'));var toCsv=require(_0xb8d2('0x9'));var querystring=require(_0xb8d2('0x10'));var Papa=require(_0xb8d2('0x11'));var Redis=require(_0xb8d2('0x12'));var authService=require(_0xb8d2('0x13'));var qs=require(_0xb8d2('0x14'));var as=require(_0xb8d2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb8d2('0x16'))(_0xb8d2('0x17'));var utils=require(_0xb8d2('0x18'));var config=require(_0xb8d2('0x19'));var licenseUtil=require(_0xb8d2('0x1a'));var db=require(_0xb8d2('0x1b'))['db'];function respondWithStatusCode(_0x32e6c9,_0x4f2afc){_0x4f2afc=_0x4f2afc||0xcc;return function(_0x2014e5){if(_0x2014e5){return _0x32e6c9['sendStatus'](_0x4f2afc);}return _0x32e6c9[_0xb8d2('0x1c')](_0x4f2afc)[_0xb8d2('0x1d')]();};}function respondWithResult(_0x3c1b0f,_0x50297b){_0x50297b=_0x50297b||0xc8;return function(_0x1a3254){if(_0x1a3254){return _0x3c1b0f[_0xb8d2('0x1c')](_0x50297b)[_0xb8d2('0x1e')](_0x1a3254);}};}function respondWithFilteredResult(_0x108efb,_0x199033){return function(_0x2f6b6c){if(_0x2f6b6c){var _0xc6a21e=typeof _0x199033[_0xb8d2('0x1f')]===_0xb8d2('0x20')&&typeof _0x199033[_0xb8d2('0x21')]==='undefined';var _0x1cb37d=_0x2f6b6c[_0xb8d2('0x22')];var _0x588178=_0xc6a21e?0x0:_0x199033[_0xb8d2('0x1f')];var _0x389b41=_0xc6a21e?_0x2f6b6c[_0xb8d2('0x22')]:_0x199033[_0xb8d2('0x1f')]+_0x199033[_0xb8d2('0x21')];var _0x3fdbee;if(_0x389b41>=_0x1cb37d){_0x389b41=_0x1cb37d;_0x3fdbee=0xc8;}else{_0x3fdbee=0xce;}_0x108efb[_0xb8d2('0x1c')](_0x3fdbee);return _0x108efb['set'](_0xb8d2('0x23'),_0x588178+'-'+_0x389b41+'/'+_0x1cb37d)[_0xb8d2('0x1e')](_0x2f6b6c);}return null;};}function patchUpdates(_0xb57c0c){return function(_0x59d3d9){try{jsonpatch[_0xb8d2('0x24')](_0x59d3d9,_0xb57c0c,!![]);}catch(_0x37fd3f){return BPromise[_0xb8d2('0x25')](_0x37fd3f);}return _0x59d3d9[_0xb8d2('0x26')]();};}function saveUpdates(_0x3f55c3,_0xee0da5){return function(_0x290f84){if(_0x290f84){return _0x290f84[_0xb8d2('0x27')](_0x3f55c3)['then'](function(_0x4b6e3f){return _0x4b6e3f;});}return null;};}function removeEntity(_0x50be9b,_0x2f701b){return function(_0x2ee906){if(_0x2ee906){return _0x2ee906[_0xb8d2('0x28')]()['then'](function(){_0x50be9b[_0xb8d2('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f45c3,_0x13f40c){return function(_0x189383){if(!_0x189383){_0x4f45c3[_0xb8d2('0x29')](0x194);}return _0x189383;};}function handleError(_0x1d588f,_0x2cf2a4){_0x2cf2a4=_0x2cf2a4||0x1f4;return function(_0x212c94){logger[_0xb8d2('0x2a')](_0x212c94[_0xb8d2('0x2b')]);if(_0x212c94[_0xb8d2('0x2c')]){delete _0x212c94[_0xb8d2('0x2c')];}_0x1d588f[_0xb8d2('0x1c')](_0x2cf2a4)[_0xb8d2('0x2d')](_0x212c94);};}exports[_0xb8d2('0x2e')]=function(_0x3998ea,_0x4d1539){var _0x40f12e={},_0x473368={},_0x634597={'count':0x0,'rows':[]};var _0xeffe98=_['map'](db['CmHopperHistory']['rawAttributes'],function(_0x55608e){return{'name':_0x55608e['fieldName'],'type':_0x55608e[_0xb8d2('0x2f')][_0xb8d2('0x30')]};});_0x473368['model']=_[_0xb8d2('0x31')](_0xeffe98,'name');_0x473368[_0xb8d2('0x32')]=_[_0xb8d2('0x33')](_0x3998ea['query']);_0x473368[_0xb8d2('0x34')]=_[_0xb8d2('0x35')](_0x473368['model'],_0x473368[_0xb8d2('0x32')]);_0x40f12e['attributes']=_[_0xb8d2('0x35')](_0x473368['model'],qs[_0xb8d2('0x36')](_0x3998ea['query'][_0xb8d2('0x36')]));_0x40f12e[_0xb8d2('0x37')]=_0x40f12e['attributes'][_0xb8d2('0x38')]?_0x40f12e[_0xb8d2('0x37')]:_0x473368[_0xb8d2('0x39')];if(!_0x3998ea[_0xb8d2('0x32')]['hasOwnProperty']('nolimit')){_0x40f12e['limit']=qs[_0xb8d2('0x21')](_0x3998ea['query']['limit']);_0x40f12e[_0xb8d2('0x1f')]=qs[_0xb8d2('0x1f')](_0x3998ea['query'][_0xb8d2('0x1f')]);}_0x40f12e[_0xb8d2('0x3a')]=qs[_0xb8d2('0x3b')](_0x3998ea[_0xb8d2('0x32')][_0xb8d2('0x3b')]);_0x40f12e['where']=qs[_0xb8d2('0x34')](_[_0xb8d2('0x3c')](_0x3998ea[_0xb8d2('0x32')],_0x473368[_0xb8d2('0x34')]),_0xeffe98);if(_0x3998ea[_0xb8d2('0x32')][_0xb8d2('0x3d')]){_0x40f12e[_0xb8d2('0x3e')]=_[_0xb8d2('0x3f')](_0x40f12e[_0xb8d2('0x3e')],{'$or':_[_0xb8d2('0x31')](_0xeffe98,function(_0x4ae041){if(_0x4ae041[_0xb8d2('0x2f')]!=='VIRTUAL'){var _0x16d5c5={};_0x16d5c5[_0x4ae041[_0xb8d2('0x2c')]]={'$like':'%'+_0x3998ea[_0xb8d2('0x32')]['filter']+'%'};return _0x16d5c5;}})});}_0x40f12e=_[_0xb8d2('0x3f')]({},_0x40f12e,_0x3998ea[_0xb8d2('0x40')]);var _0xb675f3={'where':_0x40f12e[_0xb8d2('0x3e')]};return db['CmHopperHistory'][_0xb8d2('0x22')](_0xb675f3)['then'](function(_0xcd8725){_0x634597[_0xb8d2('0x22')]=_0xcd8725;if(_0x3998ea[_0xb8d2('0x32')]['includeAll']){_0x40f12e['include']=[{'all':!![]}];}return db[_0xb8d2('0x41')][_0xb8d2('0x42')](_0x40f12e);})[_0xb8d2('0x43')](function(_0x563460){_0x634597[_0xb8d2('0x44')]=_0x563460;return _0x634597;})['then'](respondWithFilteredResult(_0x4d1539,_0x40f12e))[_0xb8d2('0x45')](handleError(_0x4d1539,null));};exports[_0xb8d2('0x46')]=function(_0x3b75c3,_0x5a0176){var _0x2ca4d4={'raw':!![],'where':{'id':_0x3b75c3['params']['id']}},_0x1adffe={};_0x1adffe[_0xb8d2('0x39')]=_[_0xb8d2('0x33')](db['CmHopperHistory'][_0xb8d2('0x47')]);_0x1adffe['query']=_[_0xb8d2('0x33')](_0x3b75c3['query']);_0x1adffe['filters']=_[_0xb8d2('0x35')](_0x1adffe['model'],_0x1adffe[_0xb8d2('0x32')]);_0x2ca4d4[_0xb8d2('0x37')]=_['intersection'](_0x1adffe[_0xb8d2('0x39')],qs[_0xb8d2('0x36')](_0x3b75c3['query'][_0xb8d2('0x36')]));_0x2ca4d4[_0xb8d2('0x37')]=_0x2ca4d4[_0xb8d2('0x37')][_0xb8d2('0x38')]?_0x2ca4d4[_0xb8d2('0x37')]:_0x1adffe[_0xb8d2('0x39')];if(_0x3b75c3[_0xb8d2('0x32')][_0xb8d2('0x48')]){_0x2ca4d4['include']=[{'all':!![]}];}_0x2ca4d4=_[_0xb8d2('0x3f')]({},_0x2ca4d4,_0x3b75c3['options']);return db[_0xb8d2('0x41')][_0xb8d2('0x49')](_0x2ca4d4)[_0xb8d2('0x43')](handleEntityNotFound(_0x5a0176,null))['then'](respondWithResult(_0x5a0176,null))['catch'](handleError(_0x5a0176,null));};exports[_0xb8d2('0x4a')]=function(_0x30cb7f,_0x389a43){return db[_0xb8d2('0x41')]['create'](_0x30cb7f[_0xb8d2('0x4b')],{})[_0xb8d2('0x43')](respondWithResult(_0x389a43,0xc9))[_0xb8d2('0x45')](handleError(_0x389a43,null));};exports[_0xb8d2('0x4c')]=function(_0x4f0dbe,_0x47eb70){return db[_0xb8d2('0x41')]['describe']()['then'](respondWithResult(_0x47eb70,null))[_0xb8d2('0x45')](handleError(_0x47eb70,null));};exports['update']=function(_0x137773,_0x402a99){if(_0x137773[_0xb8d2('0x4b')][_0xb8d2('0x4d')]){delete _0x137773[_0xb8d2('0x4b')][_0xb8d2('0x4d')];}return db[_0xb8d2('0x41')][_0xb8d2('0x49')]({'where':{'uniqueid':_0x137773[_0xb8d2('0x4e')]['id']}})['then'](handleEntityNotFound(_0x402a99,null))[_0xb8d2('0x43')](saveUpdates(_0x137773[_0xb8d2('0x4b')],null))[_0xb8d2('0x43')](respondWithResult(_0x402a99,null))[_0xb8d2('0x45')](handleError(_0x402a99,null));}; \ No newline at end of file +var _0x47e4=['reject','then','destroy','error','name','index','map','CmHopperHistory','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','show','params','options','find','catch','create','describe','update','body','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply'];(function(_0xfe9a48,_0x4f5feb){var _0x16a6c0=function(_0xbeb0ea){while(--_0xbeb0ea){_0xfe9a48['push'](_0xfe9a48['shift']());}};_0x16a6c0(++_0x4f5feb);}(_0x47e4,0x105));var _0x447e=function(_0x5520c7,_0xbee449){_0x5520c7=_0x5520c7-0x0;var _0x3b0590=_0x47e4[_0x5520c7];return _0x3b0590;};'use strict';var emlformat=require(_0x447e('0x0'));var rimraf=require(_0x447e('0x1'));var zipdir=require(_0x447e('0x2'));var jsonpatch=require(_0x447e('0x3'));var rp=require(_0x447e('0x4'));var moment=require(_0x447e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x447e('0x6'));var util=require(_0x447e('0x7'));var path=require(_0x447e('0x8'));var sox=require(_0x447e('0x9'));var csv=require(_0x447e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x447e('0xb'));var _=require('lodash');var squel=require(_0x447e('0xc'));var crypto=require(_0x447e('0xd'));var jsforce=require(_0x447e('0xe'));var deskjs=require(_0x447e('0xf'));var toCsv=require(_0x447e('0xa'));var querystring=require(_0x447e('0x10'));var Papa=require(_0x447e('0x11'));var Redis=require(_0x447e('0x12'));var authService=require(_0x447e('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x447e('0x14'))('api');var utils=require(_0x447e('0x15'));var config=require(_0x447e('0x16'));var licenseUtil=require(_0x447e('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xdabcf1,_0x5e8245){_0x5e8245=_0x5e8245||0xcc;return function(_0x3b5902){if(_0x3b5902){return _0xdabcf1[_0x447e('0x18')](_0x5e8245);}return _0xdabcf1[_0x447e('0x19')](_0x5e8245)[_0x447e('0x1a')]();};}function respondWithResult(_0x13e81e,_0x2b5fcb){_0x2b5fcb=_0x2b5fcb||0xc8;return function(_0xf11b50){if(_0xf11b50){return _0x13e81e['status'](_0x2b5fcb)[_0x447e('0x1b')](_0xf11b50);}};}function respondWithFilteredResult(_0x29d10e,_0x3ca235){return function(_0x3311af){if(_0x3311af){var _0x427297=typeof _0x3ca235['offset']===_0x447e('0x1c')&&typeof _0x3ca235[_0x447e('0x1d')]===_0x447e('0x1c');var _0x233018=_0x3311af[_0x447e('0x1e')];var _0x577330=_0x427297?0x0:_0x3ca235[_0x447e('0x1f')];var _0x44a6eb=_0x427297?_0x3311af[_0x447e('0x1e')]:_0x3ca235[_0x447e('0x1f')]+_0x3ca235['limit'];var _0x202842;if(_0x44a6eb>=_0x233018){_0x44a6eb=_0x233018;_0x202842=0xc8;}else{_0x202842=0xce;}_0x29d10e[_0x447e('0x19')](_0x202842);return _0x29d10e[_0x447e('0x20')](_0x447e('0x21'),_0x577330+'-'+_0x44a6eb+'/'+_0x233018)[_0x447e('0x1b')](_0x3311af);}return null;};}function patchUpdates(_0x57f643){return function(_0x437c34){try{jsonpatch[_0x447e('0x22')](_0x437c34,_0x57f643,!![]);}catch(_0x2e67d9){return BPromise[_0x447e('0x23')](_0x2e67d9);}return _0x437c34['save']();};}function saveUpdates(_0x1dab90,_0x29a990){return function(_0x5aad00){if(_0x5aad00){return _0x5aad00['update'](_0x1dab90)[_0x447e('0x24')](function(_0x442f9f){return _0x442f9f;});}return null;};}function removeEntity(_0x1d2356,_0x4461d6){return function(_0x4cda8f){if(_0x4cda8f){return _0x4cda8f[_0x447e('0x25')]()[_0x447e('0x24')](function(){_0x1d2356[_0x447e('0x19')](0xcc)[_0x447e('0x1a')]();});}};}function handleEntityNotFound(_0x56bf31,_0x59f728){return function(_0x59415b){if(!_0x59415b){_0x56bf31[_0x447e('0x18')](0x194);}return _0x59415b;};}function handleError(_0xfbfd0d,_0x1caca8){_0x1caca8=_0x1caca8||0x1f4;return function(_0x4961ba){logger[_0x447e('0x26')](_0x4961ba['stack']);if(_0x4961ba['name']){delete _0x4961ba[_0x447e('0x27')];}_0xfbfd0d[_0x447e('0x19')](_0x1caca8)['send'](_0x4961ba);};}exports[_0x447e('0x28')]=function(_0x26682d,_0x2494ed){var _0x4e0ed1={},_0x9a31b9={},_0x4df894={'count':0x0,'rows':[]};var _0x35284a=_[_0x447e('0x29')](db[_0x447e('0x2a')][_0x447e('0x2b')],function(_0x1c91f9){return{'name':_0x1c91f9['fieldName'],'type':_0x1c91f9[_0x447e('0x2c')][_0x447e('0x2d')]};});_0x9a31b9['model']=_[_0x447e('0x29')](_0x35284a,_0x447e('0x27'));_0x9a31b9[_0x447e('0x2e')]=_[_0x447e('0x2f')](_0x26682d[_0x447e('0x2e')]);_0x9a31b9[_0x447e('0x30')]=_[_0x447e('0x31')](_0x9a31b9[_0x447e('0x32')],_0x9a31b9[_0x447e('0x2e')]);_0x4e0ed1[_0x447e('0x33')]=_[_0x447e('0x31')](_0x9a31b9['model'],qs[_0x447e('0x34')](_0x26682d[_0x447e('0x2e')][_0x447e('0x34')]));_0x4e0ed1[_0x447e('0x33')]=_0x4e0ed1[_0x447e('0x33')][_0x447e('0x35')]?_0x4e0ed1[_0x447e('0x33')]:_0x9a31b9[_0x447e('0x32')];if(!_0x26682d[_0x447e('0x2e')][_0x447e('0x36')]('nolimit')){_0x4e0ed1[_0x447e('0x1d')]=qs[_0x447e('0x1d')](_0x26682d[_0x447e('0x2e')]['limit']);_0x4e0ed1['offset']=qs[_0x447e('0x1f')](_0x26682d[_0x447e('0x2e')][_0x447e('0x1f')]);}_0x4e0ed1[_0x447e('0x37')]=qs[_0x447e('0x38')](_0x26682d[_0x447e('0x2e')][_0x447e('0x38')]);_0x4e0ed1[_0x447e('0x39')]=qs['filters'](_[_0x447e('0x3a')](_0x26682d[_0x447e('0x2e')],_0x9a31b9[_0x447e('0x30')]),_0x35284a);if(_0x26682d[_0x447e('0x2e')][_0x447e('0x3b')]){_0x4e0ed1[_0x447e('0x39')]=_[_0x447e('0x3c')](_0x4e0ed1[_0x447e('0x39')],{'$or':_[_0x447e('0x29')](_0x35284a,function(_0x23831b){if(_0x23831b[_0x447e('0x2c')]!==_0x447e('0x3d')){var _0x2a5914={};_0x2a5914[_0x23831b['name']]={'$like':'%'+_0x26682d['query']['filter']+'%'};return _0x2a5914;}})});}_0x4e0ed1=_[_0x447e('0x3c')]({},_0x4e0ed1,_0x26682d['options']);var _0x169775={'where':_0x4e0ed1[_0x447e('0x39')]};return db[_0x447e('0x2a')][_0x447e('0x1e')](_0x169775)[_0x447e('0x24')](function(_0x4866b0){_0x4df894[_0x447e('0x1e')]=_0x4866b0;if(_0x26682d[_0x447e('0x2e')][_0x447e('0x3e')]){_0x4e0ed1[_0x447e('0x3f')]=[{'all':!![]}];}return db[_0x447e('0x2a')]['findAll'](_0x4e0ed1);})['then'](function(_0x541935){_0x4df894['rows']=_0x541935;return _0x4df894;})[_0x447e('0x24')](respondWithFilteredResult(_0x2494ed,_0x4e0ed1))['catch'](handleError(_0x2494ed,null));};exports[_0x447e('0x40')]=function(_0x195fcd,_0x50fcac){var _0x2e258a={'raw':!![],'where':{'id':_0x195fcd[_0x447e('0x41')]['id']}},_0x206297={};_0x206297[_0x447e('0x32')]=_['keys'](db[_0x447e('0x2a')][_0x447e('0x2b')]);_0x206297[_0x447e('0x2e')]=_[_0x447e('0x2f')](_0x195fcd[_0x447e('0x2e')]);_0x206297['filters']=_[_0x447e('0x31')](_0x206297['model'],_0x206297[_0x447e('0x2e')]);_0x2e258a[_0x447e('0x33')]=_['intersection'](_0x206297['model'],qs[_0x447e('0x34')](_0x195fcd[_0x447e('0x2e')]['fields']));_0x2e258a[_0x447e('0x33')]=_0x2e258a[_0x447e('0x33')][_0x447e('0x35')]?_0x2e258a[_0x447e('0x33')]:_0x206297[_0x447e('0x32')];if(_0x195fcd[_0x447e('0x2e')][_0x447e('0x3e')]){_0x2e258a[_0x447e('0x3f')]=[{'all':!![]}];}_0x2e258a=_[_0x447e('0x3c')]({},_0x2e258a,_0x195fcd[_0x447e('0x42')]);return db[_0x447e('0x2a')][_0x447e('0x43')](_0x2e258a)[_0x447e('0x24')](handleEntityNotFound(_0x50fcac,null))[_0x447e('0x24')](respondWithResult(_0x50fcac,null))[_0x447e('0x44')](handleError(_0x50fcac,null));};exports['create']=function(_0x593558,_0x1a0eaa){return db[_0x447e('0x2a')][_0x447e('0x45')](_0x593558['body'],{})['then'](respondWithResult(_0x1a0eaa,0xc9))[_0x447e('0x44')](handleError(_0x1a0eaa,null));};exports[_0x447e('0x46')]=function(_0x29c95e,_0x20caf5){return db['CmHopperHistory'][_0x447e('0x46')]()[_0x447e('0x24')](respondWithResult(_0x20caf5,null))['catch'](handleError(_0x20caf5,null));};exports[_0x447e('0x47')]=function(_0x555bea,_0x3e7497){if(_0x555bea[_0x447e('0x48')][_0x447e('0x49')]){delete _0x555bea['body'][_0x447e('0x49')];}return db[_0x447e('0x2a')][_0x447e('0x43')]({'where':{'uniqueid':_0x555bea[_0x447e('0x41')]['id']}})['then'](handleEntityNotFound(_0x3e7497,null))[_0x447e('0x24')](saveUpdates(_0x555bea[_0x447e('0x48')],null))['then'](respondWithResult(_0x3e7497,null))[_0x447e('0x44')](handleError(_0x3e7497,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index b2cdafe..4e904ef 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 _0x5800=['uniqueid','util','../../config/logger','api','moment','request-promise','path','../../config/environment','CmHopperHistory','endtime'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x5800,0x1b9));var _0x0580=function(_0x4852e9,_0x5f2606){_0x4852e9=_0x4852e9-0x0;var _0x41df49=_0x5800[_0x4852e9];return _0x41df49;};'use strict';var _=require('lodash');var util=require(_0x0580('0x0'));var logger=require(_0x0580('0x1'))(_0x0580('0x2'));var moment=require(_0x0580('0x3'));var BPromise=require('bluebird');var rp=require(_0x0580('0x4'));var fs=require('fs');var path=require(_0x0580('0x5'));var rimraf=require('rimraf');var config=require(_0x0580('0x6'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x36e61e,_0xe05a43){return _0x36e61e['define'](_0x0580('0x7'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x0580('0x8'),'fields':['endtime']},{'name':_0x0580('0x9'),'fields':[_0x0580('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7b77=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmHopperHistory.attributes','exports','define','cm_hopper_history','endtime','uniqueid','lodash'];(function(_0x2a4d76,_0x5da602){var _0x313f01=function(_0x536c12){while(--_0x536c12){_0x2a4d76['push'](_0x2a4d76['shift']());}};_0x313f01(++_0x5da602);}(_0x7b77,0x179));var _0x77b7=function(_0x42bdad,_0x12836c){_0x42bdad=_0x42bdad-0x0;var _0x122626=_0x7b77[_0x42bdad];return _0x122626;};'use strict';var _=require(_0x77b7('0x0'));var util=require(_0x77b7('0x1'));var logger=require(_0x77b7('0x2'))(_0x77b7('0x3'));var moment=require('moment');var BPromise=require(_0x77b7('0x4'));var rp=require(_0x77b7('0x5'));var fs=require('fs');var path=require(_0x77b7('0x6'));var rimraf=require('rimraf');var config=require(_0x77b7('0x7'));var attributes=require(_0x77b7('0x8'));module[_0x77b7('0x9')]=function(_0x3d97f0,_0x4556c1){return _0x3d97f0[_0x77b7('0xa')]('CmHopperHistory',attributes,{'tableName':_0x77b7('0xb'),'paranoid':![],'indexes':[{'name':_0x77b7('0xc'),'fields':[_0x77b7('0xc')]},{'name':'uniqueid','fields':[_0x77b7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 84303cb..5f7cf42 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 _0x4dd3=['`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','findAll','campaign','name','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','raw','col','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','stringify','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG'];(function(_0x5906fd,_0x107f15){var _0x49aee4=function(_0x22b07b){while(--_0x22b07b){_0x5906fd['push'](_0x5906fd['shift']());}};_0x49aee4(++_0x107f15);}(_0x4dd3,0xf5));var _0x34dd=function(_0x2b5b44,_0x17189c){_0x2b5b44=_0x2b5b44-0x0;var _0x32cb66=_0x4dd3[_0x2b5b44];return _0x32cb66;};'use strict';var _=require(_0x34dd('0x0'));var util=require(_0x34dd('0x1'));var moment=require(_0x34dd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34dd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x34dd('0x4'));var logger=require(_0x34dd('0x5'))(_0x34dd('0x6'));var config=require('../../config/environment');var jayson=require(_0x34dd('0x7'));var client=jayson[_0x34dd('0x8')][_0x34dd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x365482,_0x3a3429,_0x5e8911){return new BPromise(function(_0x4cb036,_0xc0c516){return client[_0x34dd('0xa')](_0x365482,_0x5e8911)[_0x34dd('0xb')](function(_0x4e1bc8){logger[_0x34dd('0xc')](_0x34dd('0xd'),_0x3a3429,_0x34dd('0xe'));logger[_0x34dd('0xf')](_0x34dd('0x10'),_0x3a3429,_0x34dd('0xe'),JSON['stringify'](_0x4e1bc8));if(_0x4e1bc8[_0x34dd('0x11')]){if(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x12')]===0x1f4){logger[_0x34dd('0x11')](_0x34dd('0xd'),_0x3a3429,_0x4e1bc8['error']['message']);return _0xc0c516(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x13')]);}logger[_0x34dd('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x3a3429,_0x4e1bc8[_0x34dd('0x11')]['message']);return _0x4cb036(_0x4e1bc8[_0x34dd('0x11')][_0x34dd('0x13')]);}else{logger[_0x34dd('0xc')](_0x34dd('0xd'),_0x3a3429,_0x34dd('0xe'));_0x4cb036(_0x4e1bc8[_0x34dd('0x14')]['message']);}})[_0x34dd('0x15')](function(_0x46d9f5){logger[_0x34dd('0x11')](_0x34dd('0xd'),_0x3a3429,_0x46d9f5);_0xc0c516(_0x46d9f5);});});}exports[_0x34dd('0x16')]=function(_0x366274){var _0x3e2084=this;return new Promise(function(_0x2b4b52,_0xcbe2b5){return db[_0x34dd('0x17')][_0x34dd('0x18')](_0x366274[_0x34dd('0x19')],{'raw':_0x366274[_0x34dd('0x1a')]?_0x366274[_0x34dd('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x23072a){logger[_0x34dd('0xc')](_0x34dd('0x16'),_0x366274);logger[_0x34dd('0xf')](_0x34dd('0x16'),_0x366274,JSON[_0x34dd('0x1b')](_0x23072a));_0x2b4b52(_0x23072a);})['catch'](function(_0x41e4bf){logger[_0x34dd('0x11')]('CreateCmHopperHistory',_0x41e4bf['message'],_0x366274);_0xcbe2b5(_0x3e2084['error'](0x1f4,_0x41e4bf[_0x34dd('0x13')]));});});};exports['AvgHandleTime']=function(_0x93beae){var _0x330641=this;return new Promise(function(_0x4c2e31,_0x29e4a3){return db[_0x34dd('0x17')]['findAll']({'raw':_0x93beae['options']?_0x93beae[_0x34dd('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x93beae[_0x34dd('0x1a')]?_0x93beae[_0x34dd('0x1a')][_0x34dd('0x1c')]||null:null,'attributes':[[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['col']('id')),_0x34dd('0x1f')],[db[_0x34dd('0x1d')]['fn']('COUNT',db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x21')))),'predictiveIntervalAnsweredCalls'],[db['sequelize']['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x22')))),_0x34dd('0x23')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db['sequelize']['fn']('IF',db['sequelize'][_0x34dd('0x20')](_0x34dd('0x24')))),_0x34dd('0x25')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x26'),db[_0x34dd('0x1d')]['fn']('IF',db['sequelize']['literal'](_0x34dd('0x27')))),_0x34dd('0x28')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x26'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')]['literal'](_0x34dd('0x29')))),_0x34dd('0x2a')]]})['then'](function(_0x580155){logger[_0x34dd('0xc')](_0x34dd('0x2b'),_0x93beae);logger[_0x34dd('0xf')](_0x34dd('0x2b'),_0x93beae,JSON[_0x34dd('0x1b')](_0x580155));_0x4c2e31(_0x580155);})[_0x34dd('0x15')](function(_0x3c567e){logger[_0x34dd('0x11')]('AvgHandleTime',_0x3c567e[_0x34dd('0x13')],_0x93beae);_0x29e4a3(_0x330641[_0x34dd('0x11')](0x1f4,_0x3c567e['message']));});});};exports[_0x34dd('0x2c')]=function(_0x1df9e4){var _0x6c3eba=this;return new Promise(function(_0x32a7fb,_0x5906b8){return db[_0x34dd('0x17')][_0x34dd('0x2d')]({'raw':_0x1df9e4['options']?_0x1df9e4[_0x34dd('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1df9e4['options']?_0x1df9e4[_0x34dd('0x1a')][_0x34dd('0x1c')]||null:null,'attributes':[[_0x34dd('0x2e'),_0x34dd('0x2f')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')]('`state`\x20=\x200,\x201,\x20null'))),_0x34dd('0x30')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x31')))),_0x34dd('0x32')],[db[_0x34dd('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x21')))),'outboundAnswerCallsDay'],[db[_0x34dd('0x1d')]['fn']('COUNT',db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x33')))),'outboundBusyCallsDay'],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x34')))),_0x34dd('0x35')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db['sequelize']['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x36')))),_0x34dd('0x37')],[db['sequelize']['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x38')))),_0x34dd('0x39')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db['sequelize']['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')]('`state`\x20=\x2012,\x201,\x20null'))),_0x34dd('0x3a')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),_0x34dd('0x3b')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')]['literal'](_0x34dd('0x3c')))),_0x34dd('0x3d')],[db['sequelize']['fn']('COUNT',db[_0x34dd('0x1d')]['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x3e')))),_0x34dd('0x3f')],[db[_0x34dd('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')]('`state`\x20=\x2016,\x201,\x20null'))),_0x34dd('0x40')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')]['fn']('IF',db['sequelize'][_0x34dd('0x20')](_0x34dd('0x41')))),_0x34dd('0x3f')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db['sequelize']['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x34dd('0x2e')]})[_0x34dd('0xb')](function(_0x181c8e){logger['info'](_0x34dd('0x2c'),_0x1df9e4);logger[_0x34dd('0xf')]('GetVoiceQueueHopperHistory',_0x1df9e4,JSON[_0x34dd('0x1b')](_0x181c8e));_0x32a7fb(_0x181c8e);})[_0x34dd('0x15')](function(_0x365b97){logger[_0x34dd('0x11')]('GetVoiceQueueHopperHistory',_0x365b97[_0x34dd('0x13')],_0x1df9e4);_0x5906b8(_0x6c3eba[_0x34dd('0x11')](0x1f4,_0x365b97[_0x34dd('0x13')]));});});};exports['GetCampaignHopperHistory']=function(_0x376bb6){var _0x396b3c=this;return new Promise(function(_0x2827e4,_0xbf3a2c){return db[_0x34dd('0x17')][_0x34dd('0x2d')]({'raw':_0x376bb6['options']?_0x376bb6[_0x34dd('0x1a')][_0x34dd('0x42')]===undefined?!![]:![]:!![],'where':_0x376bb6[_0x34dd('0x1a')]?_0x376bb6[_0x34dd('0x1a')]['where']||null:null,'attributes':[[_0x34dd('0x2e'),_0x34dd('0x2f')],[db['sequelize']['fn'](_0x34dd('0x1e'),db[_0x34dd('0x1d')][_0x34dd('0x43')]('id')),_0x34dd('0x44')],[db[_0x34dd('0x1d')]['fn'](_0x34dd('0x1e'),db['sequelize']['fn']('IF',db[_0x34dd('0x1d')][_0x34dd('0x20')](_0x34dd('0x21')))),_0x34dd('0x45')]],'group':[_0x34dd('0x2e')]})[_0x34dd('0xb')](function(_0x38b212){logger[_0x34dd('0xc')]('GetCampaignHopperHistory',_0x376bb6);logger[_0x34dd('0xf')](_0x34dd('0x46'),_0x376bb6,JSON[_0x34dd('0x1b')](_0x38b212));_0x2827e4(_0x38b212);})[_0x34dd('0x15')](function(_0x269e1f){logger[_0x34dd('0x11')](_0x34dd('0x46'),_0x269e1f[_0x34dd('0x13')],_0x376bb6);_0xbf3a2c(_0x396b3c[_0x34dd('0x11')](0x1f4,_0x269e1f['message']));});});}; \ No newline at end of file +var _0xa1f1=['CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperHistory','body','options','raw','debug','AvgHandleTime','CmHopperHistory','findAll','where','sequelize','COUNT','predictiveIntervalTotalCalls','literal','`state`\x20=\x2010,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','then','GetCampaignHopperHistory','col','ivrTotalCallsDays','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent'];(function(_0x47313d,_0x2128c4){var _0x1ca6f0=function(_0x5dc4ed){while(--_0x5dc4ed){_0x47313d['push'](_0x47313d['shift']());}};_0x1ca6f0(++_0x2128c4);}(_0xa1f1,0x7b));var _0x1a1f=function(_0xac0de1,_0x12d3d9){_0xac0de1=_0xac0de1-0x0;var _0x1c1995=_0xa1f1[_0xac0de1];return _0x1c1995;};'use strict';var _=require('lodash');var util=require(_0x1a1f('0x0'));var moment=require(_0x1a1f('0x1'));var BPromise=require(_0x1a1f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a1f('0x3'))['db'];var utils=require(_0x1a1f('0x4'));var logger=require(_0x1a1f('0x5'))(_0x1a1f('0x6'));var config=require(_0x1a1f('0x7'));var jayson=require(_0x1a1f('0x8'));var client=jayson[_0x1a1f('0x9')][_0x1a1f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x187398,_0x3ec84e,_0x536442){return new BPromise(function(_0x1e608b,_0x8ecdd3){return client[_0x1a1f('0xb')](_0x187398,_0x536442)['then'](function(_0x42c485){logger[_0x1a1f('0xc')](_0x1a1f('0xd'),_0x3ec84e,_0x1a1f('0xe'));logger['debug'](_0x1a1f('0xf'),_0x3ec84e,_0x1a1f('0xe'),JSON[_0x1a1f('0x10')](_0x42c485));if(_0x42c485[_0x1a1f('0x11')]){if(_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x12')]===0x1f4){logger[_0x1a1f('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x3ec84e,_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x13')]);return _0x8ecdd3(_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x13')]);}logger[_0x1a1f('0x11')](_0x1a1f('0xd'),_0x3ec84e,_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x13')]);return _0x1e608b(_0x42c485[_0x1a1f('0x11')][_0x1a1f('0x13')]);}else{logger['info'](_0x1a1f('0xd'),_0x3ec84e,_0x1a1f('0xe'));_0x1e608b(_0x42c485[_0x1a1f('0x14')][_0x1a1f('0x13')]);}})[_0x1a1f('0x15')](function(_0x1f878d){logger['error']('CmHopperHistory,\x20%s,\x20%s',_0x3ec84e,_0x1f878d);_0x8ecdd3(_0x1f878d);});});}exports[_0x1a1f('0x16')]=function(_0x44d4b8){var _0x593d42=this;return new Promise(function(_0x65398b,_0x1a0bb9){return db['CmHopperHistory']['create'](_0x44d4b8[_0x1a1f('0x17')],{'raw':_0x44d4b8[_0x1a1f('0x18')]?_0x44d4b8[_0x1a1f('0x18')][_0x1a1f('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x1c7805){logger[_0x1a1f('0xc')](_0x1a1f('0x16'),_0x44d4b8);logger[_0x1a1f('0x1a')]('CreateCmHopperHistory',_0x44d4b8,JSON[_0x1a1f('0x10')](_0x1c7805));_0x65398b(_0x1c7805);})[_0x1a1f('0x15')](function(_0x52e524){logger[_0x1a1f('0x11')](_0x1a1f('0x16'),_0x52e524[_0x1a1f('0x13')],_0x44d4b8);_0x1a0bb9(_0x593d42[_0x1a1f('0x11')](0x1f4,_0x52e524['message']));});});};exports[_0x1a1f('0x1b')]=function(_0x56c4ae){var _0xe4161a=this;return new Promise(function(_0x39c629,_0xa6198d){return db[_0x1a1f('0x1c')][_0x1a1f('0x1d')]({'raw':_0x56c4ae[_0x1a1f('0x18')]?_0x56c4ae['options'][_0x1a1f('0x19')]===undefined?!![]:![]:!![],'where':_0x56c4ae[_0x1a1f('0x18')]?_0x56c4ae[_0x1a1f('0x18')][_0x1a1f('0x1e')]||null:null,'attributes':[[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db['sequelize']['col']('id')),_0x1a1f('0x21')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db['sequelize']['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')]('`state`\x20=\x204,\x201,\x20null'))),'predictiveIntervalAnsweredCalls'],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x23')))),'predictiveIntervalDroppedCallsTimeout'],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')]['literal']('`state`\x20=\x2011,\x201,\x20null'))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x24'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x25')))),'predictiveIntervalAvgHoldtime'],[db['sequelize']['fn'](_0x1a1f('0x24'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')]['literal'](_0x1a1f('0x26')))),_0x1a1f('0x27')]]})['then'](function(_0x4c8470){logger[_0x1a1f('0xc')](_0x1a1f('0x1b'),_0x56c4ae);logger[_0x1a1f('0x1a')](_0x1a1f('0x1b'),_0x56c4ae,JSON[_0x1a1f('0x10')](_0x4c8470));_0x39c629(_0x4c8470);})['catch'](function(_0x347fe0){logger[_0x1a1f('0x11')](_0x1a1f('0x1b'),_0x347fe0[_0x1a1f('0x13')],_0x56c4ae);_0xa6198d(_0xe4161a['error'](0x1f4,_0x347fe0['message']));});});};exports[_0x1a1f('0x28')]=function(_0x1e88ad){var _0x4aead7=this;return new Promise(function(_0x39c8a0,_0x576190){return db['CmHopperHistory'][_0x1a1f('0x1d')]({'raw':_0x1e88ad[_0x1a1f('0x18')]?_0x1e88ad[_0x1a1f('0x18')][_0x1a1f('0x19')]===undefined?!![]:![]:!![],'where':_0x1e88ad[_0x1a1f('0x18')]?_0x1e88ad['options'][_0x1a1f('0x1e')]||null:null,'attributes':[[_0x1a1f('0x29'),_0x1a1f('0x2a')],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x2b')))),_0x1a1f('0x2c')],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x2d')))),_0x1a1f('0x2e')],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize'][_0x1a1f('0x22')](_0x1a1f('0x2f')))),_0x1a1f('0x30')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1a1f('0x31')))),'outboundBusyCallsDay'],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x32')))),_0x1a1f('0x33')],[db['sequelize']['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize']['literal'](_0x1a1f('0x34')))),_0x1a1f('0x35')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')]('`state`\x20=\x2011\x20,\x201,\x20null'))),'outboundDropCallsDayCallersExit'],[db[_0x1a1f('0x1f')]['fn']('COUNT',db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x1a1f('0x36')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize'][_0x1a1f('0x22')](_0x1a1f('0x37')))),_0x1a1f('0x38')],[db[_0x1a1f('0x1f')]['fn']('COUNT',db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize'][_0x1a1f('0x22')](_0x1a1f('0x39')))),_0x1a1f('0x3a')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db['sequelize']['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')]('`state`\x20=\x2018,\x201,\x20null'))),'outboundRejectCallsDay'],[db[_0x1a1f('0x1f')]['fn']('COUNT',db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')]['literal'](_0x1a1f('0x3b')))),_0x1a1f('0x3c')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db['sequelize']['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x3d')))),_0x1a1f('0x3e')],[db[_0x1a1f('0x1f')]['fn'](_0x1a1f('0x20'),db[_0x1a1f('0x1f')]['fn']('IF',db['sequelize'][_0x1a1f('0x22')](_0x1a1f('0x3f')))),_0x1a1f('0x40')]],'group':[_0x1a1f('0x29')]})[_0x1a1f('0x41')](function(_0x3f0bc3){logger[_0x1a1f('0xc')](_0x1a1f('0x28'),_0x1e88ad);logger['debug']('GetVoiceQueueHopperHistory',_0x1e88ad,JSON[_0x1a1f('0x10')](_0x3f0bc3));_0x39c8a0(_0x3f0bc3);})['catch'](function(_0x29a984){logger[_0x1a1f('0x11')](_0x1a1f('0x28'),_0x29a984['message'],_0x1e88ad);_0x576190(_0x4aead7['error'](0x1f4,_0x29a984[_0x1a1f('0x13')]));});});};exports[_0x1a1f('0x42')]=function(_0x29b1d5){var _0x17c011=this;return new Promise(function(_0x4b6988,_0x33ff8c){return db[_0x1a1f('0x1c')]['findAll']({'raw':_0x29b1d5[_0x1a1f('0x18')]?_0x29b1d5[_0x1a1f('0x18')][_0x1a1f('0x19')]===undefined?!![]:![]:!![],'where':_0x29b1d5[_0x1a1f('0x18')]?_0x29b1d5[_0x1a1f('0x18')][_0x1a1f('0x1e')]||null:null,'attributes':[[_0x1a1f('0x29'),_0x1a1f('0x2a')],[db['sequelize']['fn'](_0x1a1f('0x20'),db['sequelize'][_0x1a1f('0x43')]('id')),_0x1a1f('0x44')],[db[_0x1a1f('0x1f')]['fn']('COUNT',db[_0x1a1f('0x1f')]['fn']('IF',db[_0x1a1f('0x1f')][_0x1a1f('0x22')](_0x1a1f('0x2f')))),'ivrAnswerCallsDay']],'group':[_0x1a1f('0x29')]})['then'](function(_0x32116e){logger[_0x1a1f('0xc')](_0x1a1f('0x42'),_0x29b1d5);logger[_0x1a1f('0x1a')](_0x1a1f('0x42'),_0x29b1d5,JSON[_0x1a1f('0x10')](_0x32116e));_0x4b6988(_0x32116e);})['catch'](function(_0x54200c){logger['error'](_0x1a1f('0x42'),_0x54200c[_0x1a1f('0x13')],_0x29b1d5);_0x33ff8c(_0x17c011[_0x1a1f('0x11')](0x1f4,_0x54200c[_0x1a1f('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 28cacc0..c9706d7 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 _0x4ae7=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','update','exports','util','path','connect-timeout'];(function(_0x1cb167,_0x5c7737){var _0xdc8018=function(_0x4fa87f){while(--_0x4fa87f){_0x1cb167['push'](_0x1cb167['shift']());}};_0xdc8018(++_0x5c7737);}(_0x4ae7,0x10d));var _0x74ae=function(_0x54f128,_0x2987fd){_0x54f128=_0x54f128-0x0;var _0x30f507=_0x4ae7[_0x54f128];return _0x30f507;};'use strict';var multer=require('multer');var util=require(_0x74ae('0x0'));var path=require(_0x74ae('0x1'));var timeout=require(_0x74ae('0x2'));var express=require(_0x74ae('0x3'));var router=express[_0x74ae('0x4')]();var fs_extra=require(_0x74ae('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x74ae('0x6'));var config=require(_0x74ae('0x7'));var controller=require('./cmHopperHistory.controller');router[_0x74ae('0x8')]('/',auth[_0x74ae('0x9')](),controller['index']);router[_0x74ae('0x8')](_0x74ae('0xa'),auth[_0x74ae('0x9')](),controller[_0x74ae('0xb')]);router['get'](_0x74ae('0xc'),auth[_0x74ae('0x9')](),controller[_0x74ae('0xd')]);router['post']('/',auth[_0x74ae('0x9')](),controller[_0x74ae('0xe')]);router['put'](_0x74ae('0xc'),auth[_0x74ae('0x9')](),controller[_0x74ae('0xf')]);module[_0x74ae('0x10')]=router; \ No newline at end of file +var _0x9543=['../../config/environment','./cmHopperHistory.controller','get','index','/describe','describe','/:id','isAuthenticated','create','put','update','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service'];(function(_0x323d7e,_0x8f38de){var _0x4c053c=function(_0x51853c){while(--_0x51853c){_0x323d7e['push'](_0x323d7e['shift']());}};_0x4c053c(++_0x8f38de);}(_0x9543,0x1a4));var _0x3954=function(_0x2f3947,_0xd4b6f){_0x2f3947=_0x2f3947-0x0;var _0x424d39=_0x9543[_0x2f3947];return _0x424d39;};'use strict';var multer=require(_0x3954('0x0'));var util=require(_0x3954('0x1'));var path=require('path');var timeout=require(_0x3954('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3954('0x3'));var interaction=require(_0x3954('0x4'));var config=require(_0x3954('0x5'));var controller=require(_0x3954('0x6'));router[_0x3954('0x7')]('/',auth['isAuthenticated'](),controller[_0x3954('0x8')]);router[_0x3954('0x7')](_0x3954('0x9'),auth['isAuthenticated'](),controller[_0x3954('0xa')]);router[_0x3954('0x7')](_0x3954('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x3954('0xc')](),controller[_0x3954('0xd')]);router[_0x3954('0xe')](_0x3954('0xb'),auth['isAuthenticated'](),controller[_0x3954('0xf')]);module[_0x3954('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index 94952e9..f2b0f7d 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 _0xf120=['STRING','name','exports'];(function(_0x3fcf30,_0xe3a49e){var _0x2ed4b0=function(_0x306e68){while(--_0x306e68){_0x3fcf30['push'](_0x3fcf30['shift']());}};_0x2ed4b0(++_0xe3a49e);}(_0xf120,0x179));var _0x0f12=function(_0x5dd180,_0x20a332){_0x5dd180=_0x5dd180-0x0;var _0x4d3319=_0xf120[_0x5dd180];return _0x4d3319;};'use strict';var Sequelize=require('sequelize');module[_0x0f12('0x0')]={'name':{'type':Sequelize[_0x0f12('0x1')],'unique':_0x0f12('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x0f12('0x1')]}}; \ No newline at end of file +var _0xadf0=['name','exports','STRING'];(function(_0x35fbb9,_0x548887){var _0x25bb90=function(_0x2a08a4){while(--_0x2a08a4){_0x35fbb9['push'](_0x35fbb9['shift']());}};_0x25bb90(++_0x548887);}(_0xadf0,0x12d));var _0x0adf=function(_0xe2e012,_0x30f284){_0xe2e012=_0xe2e012-0x0;var _0x4ba424=_0xadf0[_0xe2e012];return _0x4ba424;};'use strict';var Sequelize=require('sequelize');module[_0x0adf('0x0')]={'name':{'type':Sequelize[_0x0adf('0x1')],'unique':_0x0adf('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x0adf('0x1')]},'dialPrefix':{'type':Sequelize[_0x0adf('0x1')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 0a184a3..f791508 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 _0x34b2=['then','get','destroy','error','name','send','map','CmList','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Lists','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','getDispositions','Disposition','removeDispositions','ids','addContacts','CmContact','isArray','tags','each','omit','success','dataValues','errors','push','message','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','getContactsCsv','ContactItemType','OrderBy','select','from','cm_contacts','c.deletedAt\x20is\x20null','field','alias','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id','toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','findOne','transaction','addCustomFields','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','cf_%s','order','findAndCountAll','getGlobalCustomFields','spread','emit','userCmList:save','removeAgents','getAgents','User','info','sequelize','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./cmList.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update'];(function(_0x13727f,_0x529dd9){var _0x1f8749=function(_0x58b69d){while(--_0x58b69d){_0x13727f['push'](_0x13727f['shift']());}};_0x1f8749(++_0x529dd9);}(_0x34b2,0x75));var _0x234b=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0x34b2[_0x3da612];return _0x1a9d1d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x234b('0x0'));var jsonpatch=require(_0x234b('0x1'));var rp=require(_0x234b('0x2'));var moment=require('moment');var BPromise=require(_0x234b('0x3'));var Mustache=require(_0x234b('0x4'));var util=require(_0x234b('0x5'));var path=require('path');var sox=require(_0x234b('0x6'));var csv=require(_0x234b('0x7'));var ejs=require(_0x234b('0x8'));var fs=require('fs');var fs_extra=require(_0x234b('0x9'));var _=require(_0x234b('0xa'));var squel=require(_0x234b('0xb'));var crypto=require(_0x234b('0xc'));var jsforce=require(_0x234b('0xd'));var deskjs=require(_0x234b('0xe'));var toCsv=require(_0x234b('0x7'));var querystring=require('querystring');var Papa=require(_0x234b('0xf'));var Redis=require(_0x234b('0x10'));var authService=require(_0x234b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x234b('0x12'));var hardwareService=require(_0x234b('0x13'));var logger=require(_0x234b('0x14'))(_0x234b('0x15'));var utils=require(_0x234b('0x16'));var config=require(_0x234b('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config[_0x234b('0x18')]=_[_0x234b('0x19')](config[_0x234b('0x18')],{'host':_0x234b('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x234b('0x18')]));require(_0x234b('0x1b'))[_0x234b('0x1c')](socket);function respondWithStatusCode(_0x680903,_0x15cd69){_0x15cd69=_0x15cd69||0xcc;return function(_0x38914a){if(_0x38914a){return _0x680903[_0x234b('0x1d')](_0x15cd69);}return _0x680903[_0x234b('0x1e')](_0x15cd69)[_0x234b('0x1f')]();};}function respondWithResult(_0x5b8f3c,_0xddf766){_0xddf766=_0xddf766||0xc8;return function(_0x17cf59){if(_0x17cf59){return _0x5b8f3c[_0x234b('0x1e')](_0xddf766)[_0x234b('0x20')](_0x17cf59);}};}function respondWithFilteredResult(_0x19b995,_0x576453){return function(_0x33f189){if(_0x33f189){var _0x355878=typeof _0x576453[_0x234b('0x21')]==='undefined'&&typeof _0x576453[_0x234b('0x22')]===_0x234b('0x23');var _0x4c8591=_0x33f189['count'];var _0x224ecc=_0x355878?0x0:_0x576453[_0x234b('0x21')];var _0x53af4d=_0x355878?_0x33f189[_0x234b('0x24')]:_0x576453[_0x234b('0x21')]+_0x576453['limit'];var _0x5a9b6d;if(_0x53af4d>=_0x4c8591){_0x53af4d=_0x4c8591;_0x5a9b6d=0xc8;}else{_0x5a9b6d=0xce;}_0x19b995[_0x234b('0x1e')](_0x5a9b6d);return _0x19b995[_0x234b('0x25')](_0x234b('0x26'),_0x224ecc+'-'+_0x53af4d+'/'+_0x4c8591)[_0x234b('0x20')](_0x33f189);}return null;};}function patchUpdates(_0x157d25){return function(_0x2947ad){try{jsonpatch[_0x234b('0x27')](_0x2947ad,_0x157d25,!![]);}catch(_0x24b39b){return BPromise[_0x234b('0x28')](_0x24b39b);}return _0x2947ad['save']();};}function saveUpdates(_0x3c12bd,_0x5441b5){return function(_0x3bbbcf){if(_0x3bbbcf){return _0x3bbbcf[_0x234b('0x29')](_0x3c12bd)[_0x234b('0x2a')](function(_0x226c02){return _0x226c02;});}return null;};}function removeEntity(_0x50c95e,_0x2d67ae){return function(_0x45a535){if(_0x45a535){return _0x45a535['destroy']()['then'](function(){var _0x260a88=_0x45a535[_0x234b('0x2b')]({'plain':!![]});var _0x520c36='Lists';return db['UserProfileResource'][_0x234b('0x2c')]({'where':{'type':_0x520c36,'resourceId':_0x260a88['id']}})[_0x234b('0x2a')](function(){return _0x45a535;});})[_0x234b('0x2a')](function(){_0x50c95e[_0x234b('0x1e')](0xcc)[_0x234b('0x1f')]();});}};}function handleEntityNotFound(_0x2414f7,_0x23b058){return function(_0x3deaca){if(!_0x3deaca){_0x2414f7[_0x234b('0x1d')](0x194);}return _0x3deaca;};}function handleError(_0x82432f,_0x3ec48a){_0x3ec48a=_0x3ec48a||0x1f4;return function(_0x4a3df2){logger[_0x234b('0x2d')](_0x4a3df2['stack']);if(_0x4a3df2['name']){delete _0x4a3df2[_0x234b('0x2e')];}_0x82432f['status'](_0x3ec48a)[_0x234b('0x2f')](_0x4a3df2);};}exports['index']=function(_0x45cf78,_0x5b65bf){var _0x2320fe={},_0x27fc76={},_0x3aaff1={'count':0x0,'rows':[]};var _0xce2596=_[_0x234b('0x30')](db[_0x234b('0x31')][_0x234b('0x32')],function(_0x23b6c3){return{'name':_0x23b6c3[_0x234b('0x33')],'type':_0x23b6c3['type'][_0x234b('0x34')]};});_0x27fc76['model']=_[_0x234b('0x30')](_0xce2596,_0x234b('0x2e'));_0x27fc76[_0x234b('0x35')]=_['keys'](_0x45cf78[_0x234b('0x35')]);_0x27fc76[_0x234b('0x36')]=_[_0x234b('0x37')](_0x27fc76[_0x234b('0x38')],_0x27fc76[_0x234b('0x35')]);_0x2320fe[_0x234b('0x39')]=_[_0x234b('0x37')](_0x27fc76[_0x234b('0x38')],qs[_0x234b('0x3a')](_0x45cf78[_0x234b('0x35')]['fields']));_0x2320fe['attributes']=_0x2320fe[_0x234b('0x39')][_0x234b('0x3b')]?_0x2320fe[_0x234b('0x39')]:_0x27fc76['model'];if(!_0x45cf78['query'][_0x234b('0x3c')](_0x234b('0x3d'))){_0x2320fe[_0x234b('0x22')]=qs[_0x234b('0x22')](_0x45cf78[_0x234b('0x35')][_0x234b('0x22')]);_0x2320fe[_0x234b('0x21')]=qs[_0x234b('0x21')](_0x45cf78[_0x234b('0x35')]['offset']);}_0x2320fe['order']=qs[_0x234b('0x3e')](_0x45cf78[_0x234b('0x35')][_0x234b('0x3e')]);_0x2320fe[_0x234b('0x3f')]=qs[_0x234b('0x36')](_[_0x234b('0x40')](_0x45cf78['query'],_0x27fc76[_0x234b('0x36')]),_0xce2596);if(_0x45cf78[_0x234b('0x35')][_0x234b('0x41')]){_0x2320fe[_0x234b('0x3f')]=_[_0x234b('0x42')](_0x2320fe[_0x234b('0x3f')],{'$or':_[_0x234b('0x30')](_0xce2596,function(_0x35af56){if(_0x35af56[_0x234b('0x43')]!=='VIRTUAL'){var _0x28cac8={};_0x28cac8[_0x35af56[_0x234b('0x2e')]]={'$like':'%'+_0x45cf78[_0x234b('0x35')][_0x234b('0x41')]+'%'};return _0x28cac8;}})});}_0x2320fe=_[_0x234b('0x42')]({},_0x2320fe,_0x45cf78[_0x234b('0x44')]);var _0x52c5ed={'where':_0x2320fe[_0x234b('0x3f')]};return db[_0x234b('0x31')][_0x234b('0x24')](_0x52c5ed)[_0x234b('0x2a')](function(_0x390e4d){_0x3aaff1[_0x234b('0x24')]=_0x390e4d;if(_0x45cf78[_0x234b('0x35')][_0x234b('0x45')]){_0x2320fe[_0x234b('0x46')]=[{'all':!![]}];}return db[_0x234b('0x31')][_0x234b('0x47')](_0x2320fe);})[_0x234b('0x2a')](function(_0xdf9c5){_0x3aaff1[_0x234b('0x48')]=_0xdf9c5;return _0x3aaff1;})['then'](respondWithFilteredResult(_0x5b65bf,_0x2320fe))['catch'](handleError(_0x5b65bf,null));};exports['show']=function(_0x401f0d,_0x1bf37f){var _0x4af2f3={'raw':![],'where':{'id':_0x401f0d[_0x234b('0x49')]['id']}},_0xf017e={};_0xf017e[_0x234b('0x38')]=_[_0x234b('0x4a')](db['CmList']['rawAttributes']);_0xf017e[_0x234b('0x35')]=_[_0x234b('0x4a')](_0x401f0d[_0x234b('0x35')]);_0xf017e['filters']=_[_0x234b('0x37')](_0xf017e[_0x234b('0x38')],_0xf017e['query']);_0x4af2f3[_0x234b('0x39')]=_['intersection'](_0xf017e['model'],qs[_0x234b('0x3a')](_0x401f0d['query']['fields']));_0x4af2f3['attributes']=_0x4af2f3[_0x234b('0x39')][_0x234b('0x3b')]?_0x4af2f3[_0x234b('0x39')]:_0xf017e[_0x234b('0x38')];if(_0x401f0d['query'][_0x234b('0x45')]){_0x4af2f3['include']=[{'all':!![]}];}_0x4af2f3=_[_0x234b('0x42')]({},_0x4af2f3,_0x401f0d[_0x234b('0x44')]);return db[_0x234b('0x31')][_0x234b('0x4b')](_0x4af2f3)[_0x234b('0x2a')](handleEntityNotFound(_0x1bf37f,null))[_0x234b('0x2a')](respondWithResult(_0x1bf37f,null))[_0x234b('0x4c')](handleError(_0x1bf37f,null));};exports[_0x234b('0x4d')]=function(_0xc4d492,_0x55affe){return db[_0x234b('0x31')][_0x234b('0x4d')](_0xc4d492[_0x234b('0x4e')],{})[_0x234b('0x2a')](function(_0x799e5f){var _0x14ffd3=_0xc4d492[_0x234b('0x4f')][_0x234b('0x2b')]({'plain':!![]});if(!_0x14ffd3)throw new Error(_0x234b('0x50'));if(_0x14ffd3[_0x234b('0x51')]===_0x234b('0x4f')){var _0x425ef9=_0x799e5f[_0x234b('0x2b')]({'plain':!![]});var _0x1e97da=_0x234b('0x52');return db[_0x234b('0x53')]['find']({'where':{'name':_0x1e97da,'userProfileId':_0x14ffd3[_0x234b('0x54')]},'raw':!![]})['then'](function(_0xab45fb){if(_0xab45fb&&_0xab45fb[_0x234b('0x55')]===0x0){return db[_0x234b('0x56')][_0x234b('0x4d')]({'name':_0x425ef9[_0x234b('0x2e')],'resourceId':_0x425ef9['id'],'type':_0xab45fb[_0x234b('0x2e')],'sectionId':_0xab45fb['id']},{})['then'](function(){return _0x799e5f;});}else{return _0x799e5f;}})[_0x234b('0x4c')](function(_0x26534c){logger[_0x234b('0x2d')](_0x234b('0x57'),_0x26534c);throw _0x26534c;});}return _0x799e5f;})[_0x234b('0x2a')](respondWithResult(_0x55affe,0xc9))[_0x234b('0x4c')](handleError(_0x55affe,null));};exports['update']=function(_0x865835,_0x387185){if(_0x865835[_0x234b('0x4e')]['id']){delete _0x865835['body']['id'];}return db[_0x234b('0x31')]['find']({'where':{'id':_0x865835[_0x234b('0x49')]['id']}})[_0x234b('0x2a')](handleEntityNotFound(_0x387185,null))['then'](saveUpdates(_0x865835['body'],null))[_0x234b('0x2a')](respondWithResult(_0x387185,null))[_0x234b('0x4c')](handleError(_0x387185,null));};exports[_0x234b('0x2c')]=function(_0x5db805,_0x4ee51f){return db['CmList'][_0x234b('0x4b')]({'where':{'id':_0x5db805[_0x234b('0x49')]['id']}})['then'](handleEntityNotFound(_0x4ee51f,null))[_0x234b('0x2a')](removeEntity(_0x4ee51f,null))[_0x234b('0x4c')](handleError(_0x4ee51f,null));};exports['describe']=function(_0x3ae122,_0x1751c1){return db[_0x234b('0x31')][_0x234b('0x58')]()['then'](respondWithResult(_0x1751c1,null))['catch'](handleError(_0x1751c1,null));};exports[_0x234b('0x59')]=function(_0x57f340,_0xc1388f,_0x6aa334){if(_0x57f340[_0x234b('0x4e')]['id']){delete _0x57f340[_0x234b('0x4e')]['id'];}return db['CmList']['find']({'where':{'id':_0x57f340[_0x234b('0x49')]['id']}})[_0x234b('0x2a')](handleEntityNotFound(_0xc1388f,null))[_0x234b('0x2a')](function(_0x5daa0f){if(_0x5daa0f){_0x57f340[_0x234b('0x4e')][_0x234b('0x5a')]=_0x5daa0f['id'];return db['Disposition'][_0x234b('0x4d')](_0x57f340[_0x234b('0x4e')]);}})[_0x234b('0x2a')](respondWithResult(_0xc1388f,null))[_0x234b('0x4c')](handleError(_0xc1388f,null));};exports[_0x234b('0x5b')]=function(_0x21ec39,_0x46e968,_0x210833){var _0x951b67={'raw':![],'where':{}};var _0x1ed7d1={};var _0x43bab3={'count':0x0,'rows':[]};return db[_0x234b('0x31')]['findOne']({'where':{'id':_0x21ec39[_0x234b('0x49')]['id']}})[_0x234b('0x2a')](handleEntityNotFound(_0x46e968,null))[_0x234b('0x2a')](function(_0x1d36af){if(_0x1d36af){_0x1ed7d1[_0x234b('0x38')]=_['keys'](db[_0x234b('0x5c')][_0x234b('0x32')]);_0x1ed7d1[_0x234b('0x35')]=_[_0x234b('0x4a')](_0x21ec39[_0x234b('0x35')]);_0x1ed7d1[_0x234b('0x36')]=_[_0x234b('0x37')](_0x1ed7d1[_0x234b('0x38')],_0x1ed7d1[_0x234b('0x35')]);_0x951b67[_0x234b('0x39')]=_[_0x234b('0x37')](_0x1ed7d1['model'],qs[_0x234b('0x3a')](_0x21ec39[_0x234b('0x35')][_0x234b('0x3a')]));_0x951b67[_0x234b('0x39')]=_0x951b67[_0x234b('0x39')]['length']?_0x951b67[_0x234b('0x39')]:_0x1ed7d1[_0x234b('0x38')];if(!_0x21ec39[_0x234b('0x35')][_0x234b('0x3c')]('nolimit')){_0x951b67[_0x234b('0x22')]=qs[_0x234b('0x22')](_0x21ec39[_0x234b('0x35')][_0x234b('0x22')]);_0x951b67[_0x234b('0x21')]=qs[_0x234b('0x21')](_0x21ec39[_0x234b('0x35')][_0x234b('0x21')]);}_0x951b67['order']=qs[_0x234b('0x3e')](_0x21ec39[_0x234b('0x35')][_0x234b('0x3e')]);_0x951b67['where']=qs['filters'](_[_0x234b('0x40')](_0x21ec39[_0x234b('0x35')],_0x1ed7d1[_0x234b('0x36')]));_0x951b67[_0x234b('0x3f')][_0x234b('0x5a')]=_0x1d36af['id'];if(_0x21ec39[_0x234b('0x35')][_0x234b('0x41')]){_0x951b67[_0x234b('0x3f')]=_[_0x234b('0x42')](_0x951b67[_0x234b('0x3f')],{'$or':_[_0x234b('0x30')](_0x951b67[_0x234b('0x39')],function(_0x1e8856){var _0xf2a83b={};_0xf2a83b[_0x1e8856]={'$like':'%'+_0x21ec39[_0x234b('0x35')]['filter']+'%'};return _0xf2a83b;})});}_0x951b67=_[_0x234b('0x42')]({},_0x951b67,_0x21ec39[_0x234b('0x44')]);return db[_0x234b('0x5c')][_0x234b('0x24')]({'where':_0x951b67[_0x234b('0x3f')]})[_0x234b('0x2a')](function(_0x2a2728){_0x43bab3[_0x234b('0x24')]=_0x2a2728;if(_0x21ec39['query']['includeAll']){_0x951b67[_0x234b('0x46')]=[{'all':!![]}];}return db[_0x234b('0x5c')]['findAll'](_0x951b67);})[_0x234b('0x2a')](function(_0x398942){_0x43bab3[_0x234b('0x48')]=_0x398942;return _0x43bab3;});}})[_0x234b('0x2a')](respondWithFilteredResult(_0x46e968,_0x951b67))[_0x234b('0x4c')](handleError(_0x46e968,null));};exports[_0x234b('0x5d')]=function(_0x438ece,_0xc9e987,_0x1b6efc){return db[_0x234b('0x31')][_0x234b('0x4b')]({'where':{'id':_0x438ece[_0x234b('0x49')]['id']}})[_0x234b('0x2a')](handleEntityNotFound(_0xc9e987,null))[_0x234b('0x2a')](function(_0x5b40c1){if(_0x5b40c1){return _0x5b40c1['removeDispositions'](_0x438ece[_0x234b('0x35')][_0x234b('0x5e')]);}})['then'](respondWithStatusCode(_0xc9e987,null))[_0x234b('0x4c')](handleError(_0xc9e987,null));};exports[_0x234b('0x5f')]=function(_0x5b3a07,_0x567a34,_0xa9dd10){return db[_0x234b('0x31')][_0x234b('0x4b')]({'where':{'id':_0x5b3a07['params']['id']}})[_0x234b('0x2a')](handleEntityNotFound(_0x567a34,null))[_0x234b('0x2a')](function(_0x445545){if(_0x445545){var _0x38a15f=[];var _0x31a06b={'success':[],'errors':[]};return db[_0x234b('0x60')][_0x234b('0x58')]()[_0x234b('0x2a')](function(_0x241b7d){if(_0x5b3a07[_0x234b('0x4e')]['tags']&&_[_0x234b('0x61')](_0x5b3a07[_0x234b('0x4e')]['tags'])){if(_0x5b3a07[_0x234b('0x4e')][_0x234b('0x62')][_0x234b('0x3b')]){_0x5b3a07[_0x234b('0x4e')][_0x234b('0x62')]=_0x5b3a07[_0x234b('0x4e')][_0x234b('0x62')]['join'](';')+';';}else{_0x5b3a07[_0x234b('0x4e')][_0x234b('0x62')]=null;}}else{_0x5b3a07[_0x234b('0x4e')][_0x234b('0x62')]=null;}if(_0x5b3a07[_0x234b('0x4e')]&&_[_0x234b('0x61')](_0x5b3a07['body'])){for(var _0x3ae399=0x0;_0x3ae399<_0x5b3a07[_0x234b('0x4e')]['length'];_0x3ae399+=0x1){_0x5b3a07[_0x234b('0x4e')][_0x3ae399]['ListId']=_0x5b3a07[_0x234b('0x49')]['id'];_0x38a15f['push'](_0x5b3a07[_0x234b('0x4e')][_0x3ae399]);}return BPromise[_0x234b('0x63')](_0x38a15f,function(_0x450edc){return db[_0x234b('0x60')][_0x234b('0x4d')](_[_0x234b('0x64')](_0x450edc,['ids','id'])||{},{'fields':_[_0x234b('0x4a')](_0x241b7d),'raw':!![]})[_0x234b('0x2a')](function(_0x2cf263){_0x31a06b[_0x234b('0x65')]['push'](_0x2cf263[_0x234b('0x66')]);})['catch'](function(_0x4e5dad){_0x31a06b[_0x234b('0x67')][_0x234b('0x68')]({'data':_0x450edc,'error':_0x4e5dad[_0x234b('0x69')]});});})[_0x234b('0x2a')](function(_0x1179ca){return _0x31a06b;})[_0x234b('0x4c')](function(_0x3d070e){return _0x3d070e;});}else{_0x567a34[_0x234b('0x1e')](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0x234b('0x2a')](respondWithResult(_0x567a34,null))['catch'](handleError(_0x567a34,null));};exports[_0x234b('0x6a')]=function(_0x15f238,_0x1986bb,_0x1121ec){var _0x66cdd6;return db['CmList']['find']({'where':{'id':_0x15f238[_0x234b('0x49')]['id']},'include':[{'model':db[_0x234b('0x6b')],'as':_0x234b('0x6c')}]})[_0x234b('0x2a')](handleEntityNotFound(_0x1986bb,null))[_0x234b('0x2a')](function(_0x73e139){if(_0x73e139){_0x66cdd6=_0x73e139;return db[_0x234b('0x60')][_0x234b('0x32')];}})[_0x234b('0x2a')](function(_0x39916d){if(_0x39916d){var _0x1ec910={};var _0xd222fb={};_0xd222fb[_0x234b('0x38')]=_[_0x234b('0x6d')](_[_0x234b('0x4a')](_0x39916d),_[_0x234b('0x30')](_0x66cdd6[_0x234b('0x6c')],function(_0x3c18ca){return util[_0x234b('0x6e')](_0x234b('0x6f'),_0x3c18ca['id']);}));_0xd222fb[_0x234b('0x35')]=_[_0x234b('0x4a')](_0x15f238[_0x234b('0x35')]);_0xd222fb[_0x234b('0x36')]=_[_0x234b('0x37')](_0xd222fb[_0x234b('0x38')],_0xd222fb[_0x234b('0x35')]);_0x1ec910[_0x234b('0x39')]=_[_0x234b('0x37')](_0xd222fb[_0x234b('0x38')],qs[_0x234b('0x3a')](_0x15f238[_0x234b('0x35')][_0x234b('0x3a')]));_0x1ec910[_0x234b('0x39')]=_0x1ec910[_0x234b('0x39')]['length']?_0x1ec910[_0x234b('0x39')]:_0xd222fb[_0x234b('0x38')];if(!_0x15f238[_0x234b('0x35')][_0x234b('0x3c')](_0x234b('0x3d'))){_0x1ec910['limit']=qs['limit'](_0x15f238[_0x234b('0x35')][_0x234b('0x22')]);_0x1ec910[_0x234b('0x21')]=qs[_0x234b('0x21')](_0x15f238['query']['offset']);}_0x1ec910['order']=qs[_0x234b('0x3e')](_0x15f238[_0x234b('0x35')]['sort']);_0x1ec910['where']=qs['filters'](_[_0x234b('0x40')](_0x15f238[_0x234b('0x35')],_0xd222fb[_0x234b('0x36')]));_0x1ec910['raw']=!![];if(_0x15f238['query'][_0x234b('0x41')]){_0x1ec910[_0x234b('0x3f')]=_[_0x234b('0x42')](_0x1ec910[_0x234b('0x3f')],{'$or':_[_0x234b('0x30')](_0x1ec910[_0x234b('0x39')],function(_0x4fe359){var _0x53e530={};_0x53e530[_0x4fe359]={'$like':'%'+_0x15f238['query'][_0x234b('0x41')]+'%'};return _0x53e530;})});}_0x1ec910=_[_0x234b('0x42')]({},_0x1ec910,_0x15f238[_0x234b('0x44')]);return _0x66cdd6[_0x234b('0x6a')](_0x1ec910);}})[_0x234b('0x2a')](respondWithResult(_0x1986bb,null))['catch'](handleError(_0x1986bb,null));};exports[_0x234b('0x70')]=function(_0x3f0ee0,_0x22ab60,_0x121951){var _0x51d10e;var _0x5d12b1;var _0x4d23ee;var _0x498140=_0x3f0ee0[_0x234b('0x49')]['id'];csv_results=[];return db[_0x234b('0x71')][_0x234b('0x47')]({'attributes':['id','name'],'raw':!![],'order':[_0x234b('0x72')]})[_0x234b('0x2a')](function(_0x281cef){_0x51d10e=_0x281cef;var _0x208013=_['keys'](db[_0x234b('0x60')][_0x234b('0x32')]);return db[_0x234b('0x6b')][_0x234b('0x47')]({'raw':!![],'attributes':['id','alias']})[_0x234b('0x2a')](function(_0x53c78d){_0x5d12b1=_0x53c78d;var _0x2e7072=squel[_0x234b('0x73')]()[_0x234b('0x3a')](_0x208013)[_0x234b('0x74')](_0x234b('0x75'),'c')['where']('c.ListId\x20=\x20?',_0x498140)[_0x234b('0x3f')](_0x234b('0x76'))['distinct']();for(var _0x55ee4e=0x0;_0x55ee4e<_0x5d12b1['length'];_0x55ee4e++){_0x2e7072[_0x234b('0x77')]('c.cf_'+_0x5d12b1[_0x55ee4e]['id'],'customField_'+_0x5d12b1[_0x55ee4e][_0x234b('0x78')]);}for(var _0x55ee4e=0x0;_0x55ee4e<_0x51d10e['length'];_0x55ee4e++){_0x2e7072['field'](squel['select']()[_0x234b('0x77')]('item')['from'](_0x234b('0x79'))[_0x234b('0x3f')](_0x234b('0x7a'),_0x51d10e[_0x55ee4e]['id'])[_0x234b('0x3f')]('CmContactId\x20=\x20c.id'),_0x234b('0x7b')+_0x51d10e[_0x55ee4e][_0x234b('0x2e')]);_0x2e7072[_0x234b('0x77')](squel[_0x234b('0x73')]()[_0x234b('0x77')](_0x234b('0x7c'))[_0x234b('0x74')](_0x234b('0x79'))[_0x234b('0x3f')]('ItemTypeId\x20=\x20?',_0x51d10e[_0x55ee4e]['id'])['where'](_0x234b('0x7d')),'description_additionalPhone_'+_0x51d10e[_0x55ee4e]['name']);}var _0x19d68b=[];_0x19d68b[_0x234b('0x68')](_0x2e7072[_0x234b('0x7e')]());BPromise[_0x234b('0x63')](_0x19d68b,handleQuery)[_0x234b('0x2a')](function(_0x26c758){handleQuery(_0x2e7072[_0x234b('0x7e')]());var _0x140922=csv_results[0x0];if(!_[_0x234b('0x7f')](_0x140922)){var _0x50229c=toCsv(_0x140922);var _0x62cfd3=Date[_0x234b('0x80')]();fs[_0x234b('0x81')](util[_0x234b('0x6e')](_0x234b('0x82'),_0x498140,_0x62cfd3),_0x50229c);_0x22ab60[_0x234b('0x83')](_0x234b('0x84'),_0x234b('0x85')+util['format'](_0x234b('0x86'),_0x498140,_0x62cfd3));_0x22ab60[_0x234b('0x83')](_0x234b('0x87'),_0x234b('0x88'));return _0x22ab60['download'](util['format'](_0x234b('0x82'),_0x498140,_0x62cfd3));}else{return _0x22ab60['sendStatus'](0xcc);}});});});};exports['addCustomField']=function(_0x4c7f47,_0x412299,_0x5f398a){var _0x2ce028;delete _0x4c7f47[_0x234b('0x4e')]['id'];return db[_0x234b('0x31')][_0x234b('0x89')]({'where':{'id':_0x4c7f47[_0x234b('0x49')]['id']}})[_0x234b('0x2a')](handleEntityNotFound(_0x412299,null))['then'](function(_0x29780f){if(_0x29780f){return db['sequelize'][_0x234b('0x8a')](function(_0x296cd4){return db[_0x234b('0x6b')][_0x234b('0x4d')](_0x4c7f47[_0x234b('0x4e')],{'transaction':_0x296cd4})[_0x234b('0x2a')](function(_0x4261fa){_0x2ce028=_0x4261fa;return _0x29780f[_0x234b('0x8b')](_0x4261fa,{'transaction':_0x296cd4});})[_0x234b('0x2a')](function(){var _0x224cf2={'type':db['Sequelize'][_0x234b('0x8c')],'transaction':_0x296cd4};switch(_0x4c7f47['body'][_0x234b('0x43')]){case _0x234b('0x8d'):_0x224cf2[_0x234b('0x43')]=db[_0x234b('0x8e')][_0x234b('0x8c')];break;case'number':_0x224cf2[_0x234b('0x43')]=db[_0x234b('0x8e')][_0x234b('0x8f')];break;case _0x234b('0x90'):_0x224cf2[_0x234b('0x43')]=db[_0x234b('0x8e')][_0x234b('0x91')];_0x224cf2[_0x234b('0x92')]=![];break;default:}return db['sequelize']['queryInterface']['addColumn'](_0x234b('0x75'),util[_0x234b('0x6e')](_0x234b('0x93'),_0x2ce028['id']),_0x224cf2);})[_0x234b('0x2a')](function(){return _0x2ce028;});});}})[_0x234b('0x2a')](respondWithResult(_0x412299,null))['catch'](handleError(_0x412299,null));};exports['getCustomFields']=function(_0x4fffeb,_0x2e985e,_0x1bc9ac){var _0x218490={};var _0x5d0416={};var _0x4a382d;var _0x2e5eed;return db[_0x234b('0x31')][_0x234b('0x89')]({'where':{'id':_0x4fffeb[_0x234b('0x49')]['id']}})['then'](handleEntityNotFound(_0x2e985e,null))[_0x234b('0x2a')](function(_0x45cd70){if(_0x45cd70){_0x4a382d=_0x45cd70;_0x5d0416['model']=_[_0x234b('0x4a')](db[_0x234b('0x6b')][_0x234b('0x32')]);_0x5d0416['query']=_['keys'](_0x4fffeb[_0x234b('0x35')]);_0x5d0416[_0x234b('0x36')]=_[_0x234b('0x37')](_0x5d0416[_0x234b('0x38')],_0x5d0416['query']);_0x218490[_0x234b('0x39')]=_[_0x234b('0x37')](_0x5d0416['model'],qs[_0x234b('0x3a')](_0x4fffeb['query'][_0x234b('0x3a')]));_0x218490['attributes']=_0x218490[_0x234b('0x39')]['length']?_0x218490[_0x234b('0x39')]:_0x5d0416['model'];_0x218490[_0x234b('0x94')]=qs[_0x234b('0x3e')](_0x4fffeb[_0x234b('0x35')][_0x234b('0x3e')]);_0x218490[_0x234b('0x3f')]=qs[_0x234b('0x36')](_[_0x234b('0x40')](_0x4fffeb['query'],_0x5d0416[_0x234b('0x36')]));_0x218490[_0x234b('0x3f')]=_[_0x234b('0x42')](_0x218490[_0x234b('0x3f')],{'$or':[{'ListId':_0x45cd70['id']},{'ListId':null}]});if(_0x4fffeb['query'][_0x234b('0x41')]){_0x218490[_0x234b('0x3f')]=_[_0x234b('0x42')](_0x218490[_0x234b('0x3f')],{'$or':_[_0x234b('0x30')](_0x218490[_0x234b('0x39')],function(_0xb0b18d){var _0x15465c={};_0x15465c[_0xb0b18d]={'$like':'%'+_0x4fffeb[_0x234b('0x35')][_0x234b('0x41')]+'%'};return _0x15465c;})});}_0x218490=_[_0x234b('0x42')]({},_0x218490,_0x4fffeb[_0x234b('0x44')]);return db[_0x234b('0x6b')][_0x234b('0x95')](_0x218490);}})[_0x234b('0x2a')](respondWithResult(_0x2e985e,null))[_0x234b('0x4c')](handleError(_0x2e985e,null));};exports[_0x234b('0x96')]=function(_0x392b3d,_0x2b5d29){return db[_0x234b('0x6b')][_0x234b('0x95')]({'where':{'ListId':null}})[_0x234b('0x2a')](handleEntityNotFound(_0x2b5d29,null))['then'](function(_0x1023ff){return _0x1023ff;})[_0x234b('0x2a')](respondWithResult(_0x2b5d29,null))[_0x234b('0x4c')](handleError(_0x2b5d29,null));};exports['addAgents']=function(_0xedbe32,_0x451205,_0x528772){return db['CmList'][_0x234b('0x4b')]({'where':{'id':_0xedbe32[_0x234b('0x49')]['id']}})[_0x234b('0x2a')](handleEntityNotFound(_0x451205,null))['then'](function(_0x9cef8f){if(_0x9cef8f){return _0x9cef8f['addAgents'](_0xedbe32['body'][_0x234b('0x5e')],_['omit'](_0xedbe32[_0x234b('0x4e')],[_0x234b('0x5e'),'id'])||{})[_0x234b('0x97')](function(_0x3021eb){for(var _0x4e11b3=0x0;_0x4e11b3<_0xedbe32[_0x234b('0x4e')][_0x234b('0x5e')]['length'];_0x4e11b3+=0x1){socket[_0x234b('0x98')](_0x234b('0x99'),{'UserId':Number(_0xedbe32[_0x234b('0x4e')][_0x234b('0x5e')][_0x4e11b3]),'CmListId':Number(_0xedbe32[_0x234b('0x49')]['id'])});}return _0x3021eb;});}})[_0x234b('0x2a')](respondWithResult(_0x451205,null))[_0x234b('0x4c')](handleError(_0x451205,null));};exports[_0x234b('0x9a')]=function(_0x1b97cd,_0x41cc7a,_0x316a23){return db[_0x234b('0x31')][_0x234b('0x4b')]({'where':{'id':_0x1b97cd[_0x234b('0x49')]['id']}})['then'](handleEntityNotFound(_0x41cc7a,null))[_0x234b('0x2a')](function(_0x408e89){if(_0x408e89){return _0x408e89[_0x234b('0x9a')](_0x1b97cd[_0x234b('0x35')][_0x234b('0x5e')])[_0x234b('0x2a')](function(){if(_[_0x234b('0x61')](_0x1b97cd[_0x234b('0x35')]['ids'])){for(var _0x248ce2=0x0;_0x248ce2<_0x1b97cd[_0x234b('0x35')][_0x234b('0x5e')][_0x234b('0x3b')];_0x248ce2+=0x1){socket[_0x234b('0x98')]('userCmList:remove',{'UserId':Number(_0x1b97cd['query'][_0x234b('0x5e')][_0x248ce2]),'CmListId':Number(_0x1b97cd['params']['id'])});}}else{socket['emit']('userCmList:remove',{'UserId':Number(_0x1b97cd['query']['ids']),'CmListId':Number(_0x1b97cd[_0x234b('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x41cc7a,null))['catch'](handleError(_0x41cc7a,null));};exports[_0x234b('0x9b')]=function(_0x2a0183,_0x1600b3,_0x373b60){var _0x5e87f9={};var _0x31b0e4={};var _0x41c8a2;var _0x510bdc;return db[_0x234b('0x31')]['findOne']({'where':{'id':_0x2a0183[_0x234b('0x49')]['id']}})['then'](handleEntityNotFound(_0x1600b3,null))[_0x234b('0x2a')](function(_0x41a859){if(_0x41a859){_0x41c8a2=_0x41a859;_0x31b0e4[_0x234b('0x38')]=_[_0x234b('0x4a')](db[_0x234b('0x9c')][_0x234b('0x32')]);_0x31b0e4['query']=_[_0x234b('0x4a')](_0x2a0183[_0x234b('0x35')]);_0x31b0e4[_0x234b('0x36')]=_[_0x234b('0x37')](_0x31b0e4[_0x234b('0x38')],_0x31b0e4[_0x234b('0x35')]);_0x5e87f9[_0x234b('0x39')]=_[_0x234b('0x37')](_0x31b0e4[_0x234b('0x38')],qs[_0x234b('0x3a')](_0x2a0183[_0x234b('0x35')][_0x234b('0x3a')]));_0x5e87f9[_0x234b('0x39')]=_0x5e87f9[_0x234b('0x39')]['length']?_0x5e87f9['attributes']:_0x31b0e4[_0x234b('0x38')];_0x5e87f9[_0x234b('0x94')]=qs[_0x234b('0x3e')](_0x2a0183['query'][_0x234b('0x3e')]);_0x5e87f9[_0x234b('0x3f')]=qs[_0x234b('0x36')](_[_0x234b('0x40')](_0x2a0183[_0x234b('0x35')],_0x31b0e4[_0x234b('0x36')]));if(_0x2a0183[_0x234b('0x35')][_0x234b('0x41')]){_0x5e87f9[_0x234b('0x3f')]=_[_0x234b('0x42')](_0x5e87f9[_0x234b('0x3f')],{'$or':_[_0x234b('0x30')](_0x5e87f9[_0x234b('0x39')],function(_0x56944d){var _0x2b7bf8={};_0x2b7bf8[_0x56944d]={'$like':'%'+_0x2a0183[_0x234b('0x35')][_0x234b('0x41')]+'%'};return _0x2b7bf8;})});}_0x5e87f9=_[_0x234b('0x42')]({},_0x5e87f9,_0x2a0183[_0x234b('0x44')]);return _0x41c8a2[_0x234b('0x9b')](_0x5e87f9);}})['then'](function(_0x1c0186){if(_0x1c0186){_0x510bdc=_0x1c0186[_0x234b('0x3b')];if(!_0x2a0183['query'][_0x234b('0x3c')](_0x234b('0x3d'))){_0x5e87f9[_0x234b('0x22')]=qs[_0x234b('0x22')](_0x2a0183[_0x234b('0x35')][_0x234b('0x22')]);_0x5e87f9[_0x234b('0x21')]=qs[_0x234b('0x21')](_0x2a0183[_0x234b('0x35')][_0x234b('0x21')]);}return _0x41c8a2[_0x234b('0x9b')](_0x5e87f9);}})[_0x234b('0x2a')](function(_0x5d4d7b){if(_0x5d4d7b){return _0x5d4d7b?{'count':_0x510bdc,'rows':_0x5d4d7b}:null;}})[_0x234b('0x2a')](respondWithResult(_0x1600b3,null))[_0x234b('0x4c')](handleError(_0x1600b3,null));};function handleQuery(_0x1645ad){logger[_0x234b('0x9d')](_0x1645ad);return db[_0x234b('0x9e')][_0x234b('0x35')](_0x1645ad)[_0x234b('0x97')](function(_0x9a1088){csv_results['push'](_0x9a1088);})[_0x234b('0x4c')](function(_0x2fd22b){logger[_0x234b('0x2d')](_0x2fd22b[_0x234b('0x69')]);});} \ No newline at end of file +var _0xd5f2=['errors','message','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','format','cf_%d','raw','getContacts','getContactsCsv','ContactItemType','OrderBy','alias','select','from','c.deletedAt\x20is\x20null','distinct','field','c.cf_','customField_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','list_%d_%s.csv','Content-type','download','addCustomField','sequelize','transaction','text','Sequelize','TEXT','INTEGER','BOOLEAN','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','info','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./cmList.socket','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','UserProfileResource','stack','name','index','map','CmList','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','options','include','findAll','rows','catch','show','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','describe','ListId','Disposition','getDispositions','findOne','rawAttributes','removeDispositions','ids','addContacts','CmContact','tags','isArray','each','success','push'];(function(_0x508cb9,_0x16836a){var _0x453fc0=function(_0x4f1a2a){while(--_0x4f1a2a){_0x508cb9['push'](_0x508cb9['shift']());}};_0x453fc0(++_0x16836a);}(_0xd5f2,0x17c));var _0x2d5f=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd5f2[_0x27af45];return _0x18df21;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2d5f('0x0'));var zipdir=require(_0x2d5f('0x1'));var jsonpatch=require(_0x2d5f('0x2'));var rp=require(_0x2d5f('0x3'));var moment=require(_0x2d5f('0x4'));var BPromise=require(_0x2d5f('0x5'));var Mustache=require(_0x2d5f('0x6'));var util=require(_0x2d5f('0x7'));var path=require(_0x2d5f('0x8'));var sox=require(_0x2d5f('0x9'));var csv=require(_0x2d5f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d5f('0xb'));var squel=require('squel');var crypto=require(_0x2d5f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2d5f('0xd'));var toCsv=require(_0x2d5f('0xa'));var querystring=require(_0x2d5f('0xe'));var Papa=require('papaparse');var Redis=require(_0x2d5f('0xf'));var authService=require(_0x2d5f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x2d5f('0x11'));var hardwareService=require(_0x2d5f('0x12'));var logger=require('../../config/logger')(_0x2d5f('0x13'));var utils=require(_0x2d5f('0x14'));var config=require(_0x2d5f('0x15'));var licenseUtil=require(_0x2d5f('0x16'));var db=require(_0x2d5f('0x17'))['db'];var csv_results;config[_0x2d5f('0x18')]=_['defaults'](config[_0x2d5f('0x18')],{'host':_0x2d5f('0x19'),'port':0x18eb});var socket=require(_0x2d5f('0x1a'))(new Redis(config['redis']));require(_0x2d5f('0x1b'))['register'](socket);function respondWithStatusCode(_0x34724f,_0x480c62){_0x480c62=_0x480c62||0xcc;return function(_0x12dfaa){if(_0x12dfaa){return _0x34724f[_0x2d5f('0x1c')](_0x480c62);}return _0x34724f['status'](_0x480c62)[_0x2d5f('0x1d')]();};}function respondWithResult(_0x29238e,_0x2723a7){_0x2723a7=_0x2723a7||0xc8;return function(_0x7e6019){if(_0x7e6019){return _0x29238e[_0x2d5f('0x1e')](_0x2723a7)[_0x2d5f('0x1f')](_0x7e6019);}};}function respondWithFilteredResult(_0x3e184d,_0x5babf3){return function(_0x3387b5){if(_0x3387b5){var _0x5c6fb9=typeof _0x5babf3[_0x2d5f('0x20')]===_0x2d5f('0x21')&&typeof _0x5babf3[_0x2d5f('0x22')]===_0x2d5f('0x21');var _0x215e33=_0x3387b5[_0x2d5f('0x23')];var _0x446a82=_0x5c6fb9?0x0:_0x5babf3['offset'];var _0x5ac7c3=_0x5c6fb9?_0x3387b5[_0x2d5f('0x23')]:_0x5babf3['offset']+_0x5babf3[_0x2d5f('0x22')];var _0x39e922;if(_0x5ac7c3>=_0x215e33){_0x5ac7c3=_0x215e33;_0x39e922=0xc8;}else{_0x39e922=0xce;}_0x3e184d['status'](_0x39e922);return _0x3e184d[_0x2d5f('0x24')](_0x2d5f('0x25'),_0x446a82+'-'+_0x5ac7c3+'/'+_0x215e33)['json'](_0x3387b5);}return null;};}function patchUpdates(_0x47a9a3){return function(_0x2f43b2){try{jsonpatch[_0x2d5f('0x26')](_0x2f43b2,_0x47a9a3,!![]);}catch(_0x5ce65d){return BPromise[_0x2d5f('0x27')](_0x5ce65d);}return _0x2f43b2[_0x2d5f('0x28')]();};}function saveUpdates(_0x30f446,_0x9b914a){return function(_0x5b0884){if(_0x5b0884){return _0x5b0884['update'](_0x30f446)[_0x2d5f('0x29')](function(_0x13cd9d){return _0x13cd9d;});}return null;};}function removeEntity(_0x1e6f0c,_0x5cdc62){return function(_0x145f26){if(_0x145f26){return _0x145f26[_0x2d5f('0x2a')]()['then'](function(){var _0x19397b=_0x145f26['get']({'plain':!![]});var _0x3b1e88='Lists';return db[_0x2d5f('0x2b')][_0x2d5f('0x2a')]({'where':{'type':_0x3b1e88,'resourceId':_0x19397b['id']}})['then'](function(){return _0x145f26;});})[_0x2d5f('0x29')](function(){_0x1e6f0c[_0x2d5f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11b1e2,_0x430aa7){return function(_0x1379f5){if(!_0x1379f5){_0x11b1e2['sendStatus'](0x194);}return _0x1379f5;};}function handleError(_0xc8e74e,_0x2acd2f){_0x2acd2f=_0x2acd2f||0x1f4;return function(_0x50ee84){logger['error'](_0x50ee84[_0x2d5f('0x2c')]);if(_0x50ee84['name']){delete _0x50ee84[_0x2d5f('0x2d')];}_0xc8e74e['status'](_0x2acd2f)['send'](_0x50ee84);};}exports[_0x2d5f('0x2e')]=function(_0x3d025a,_0x14b2bd){var _0x48cd9c={},_0x444087={},_0x47fa04={'count':0x0,'rows':[]};var _0x138f22=_[_0x2d5f('0x2f')](db[_0x2d5f('0x30')]['rawAttributes'],function(_0x208a9a){return{'name':_0x208a9a[_0x2d5f('0x31')],'type':_0x208a9a['type'][_0x2d5f('0x32')]};});_0x444087[_0x2d5f('0x33')]=_[_0x2d5f('0x2f')](_0x138f22,_0x2d5f('0x2d'));_0x444087['query']=_[_0x2d5f('0x34')](_0x3d025a[_0x2d5f('0x35')]);_0x444087['filters']=_[_0x2d5f('0x36')](_0x444087['model'],_0x444087[_0x2d5f('0x35')]);_0x48cd9c[_0x2d5f('0x37')]=_['intersection'](_0x444087['model'],qs[_0x2d5f('0x38')](_0x3d025a[_0x2d5f('0x35')][_0x2d5f('0x38')]));_0x48cd9c[_0x2d5f('0x37')]=_0x48cd9c[_0x2d5f('0x37')][_0x2d5f('0x39')]?_0x48cd9c['attributes']:_0x444087[_0x2d5f('0x33')];if(!_0x3d025a[_0x2d5f('0x35')][_0x2d5f('0x3a')](_0x2d5f('0x3b'))){_0x48cd9c[_0x2d5f('0x22')]=qs['limit'](_0x3d025a[_0x2d5f('0x35')][_0x2d5f('0x22')]);_0x48cd9c['offset']=qs[_0x2d5f('0x20')](_0x3d025a[_0x2d5f('0x35')][_0x2d5f('0x20')]);}_0x48cd9c[_0x2d5f('0x3c')]=qs[_0x2d5f('0x3d')](_0x3d025a[_0x2d5f('0x35')]['sort']);_0x48cd9c[_0x2d5f('0x3e')]=qs[_0x2d5f('0x3f')](_[_0x2d5f('0x40')](_0x3d025a[_0x2d5f('0x35')],_0x444087[_0x2d5f('0x3f')]),_0x138f22);if(_0x3d025a[_0x2d5f('0x35')]['filter']){_0x48cd9c[_0x2d5f('0x3e')]=_[_0x2d5f('0x41')](_0x48cd9c[_0x2d5f('0x3e')],{'$or':_[_0x2d5f('0x2f')](_0x138f22,function(_0x28fb22){if(_0x28fb22[_0x2d5f('0x42')]!=='VIRTUAL'){var _0x296bd9={};_0x296bd9[_0x28fb22[_0x2d5f('0x2d')]]={'$like':'%'+_0x3d025a[_0x2d5f('0x35')][_0x2d5f('0x43')]+'%'};return _0x296bd9;}})});}_0x48cd9c=_[_0x2d5f('0x41')]({},_0x48cd9c,_0x3d025a[_0x2d5f('0x44')]);var _0x3a16d0={'where':_0x48cd9c[_0x2d5f('0x3e')]};return db['CmList']['count'](_0x3a16d0)[_0x2d5f('0x29')](function(_0x25ffb5){_0x47fa04[_0x2d5f('0x23')]=_0x25ffb5;if(_0x3d025a[_0x2d5f('0x35')]['includeAll']){_0x48cd9c[_0x2d5f('0x45')]=[{'all':!![]}];}return db[_0x2d5f('0x30')][_0x2d5f('0x46')](_0x48cd9c);})['then'](function(_0x5d073a){_0x47fa04[_0x2d5f('0x47')]=_0x5d073a;return _0x47fa04;})['then'](respondWithFilteredResult(_0x14b2bd,_0x48cd9c))[_0x2d5f('0x48')](handleError(_0x14b2bd,null));};exports[_0x2d5f('0x49')]=function(_0x50146b,_0x4ee461){var _0x925041={'raw':![],'where':{'id':_0x50146b['params']['id']}},_0x3ea151={};_0x3ea151[_0x2d5f('0x33')]=_[_0x2d5f('0x34')](db['CmList']['rawAttributes']);_0x3ea151[_0x2d5f('0x35')]=_[_0x2d5f('0x34')](_0x50146b[_0x2d5f('0x35')]);_0x3ea151[_0x2d5f('0x3f')]=_[_0x2d5f('0x36')](_0x3ea151[_0x2d5f('0x33')],_0x3ea151[_0x2d5f('0x35')]);_0x925041[_0x2d5f('0x37')]=_[_0x2d5f('0x36')](_0x3ea151[_0x2d5f('0x33')],qs[_0x2d5f('0x38')](_0x50146b['query'][_0x2d5f('0x38')]));_0x925041[_0x2d5f('0x37')]=_0x925041[_0x2d5f('0x37')][_0x2d5f('0x39')]?_0x925041[_0x2d5f('0x37')]:_0x3ea151[_0x2d5f('0x33')];if(_0x50146b[_0x2d5f('0x35')][_0x2d5f('0x4a')]){_0x925041[_0x2d5f('0x45')]=[{'all':!![]}];}_0x925041=_['merge']({},_0x925041,_0x50146b[_0x2d5f('0x44')]);return db[_0x2d5f('0x30')][_0x2d5f('0x4b')](_0x925041)[_0x2d5f('0x29')](handleEntityNotFound(_0x4ee461,null))['then'](respondWithResult(_0x4ee461,null))[_0x2d5f('0x48')](handleError(_0x4ee461,null));};exports[_0x2d5f('0x4c')]=function(_0x51fb9c,_0x588a93){return db['CmList']['create'](_0x51fb9c[_0x2d5f('0x4d')],{})[_0x2d5f('0x29')](function(_0x44be6a){var _0x4e14d8=_0x51fb9c[_0x2d5f('0x4e')]['get']({'plain':!![]});if(!_0x4e14d8)throw new Error(_0x2d5f('0x4f'));if(_0x4e14d8['role']===_0x2d5f('0x4e')){var _0x51cc7b=_0x44be6a[_0x2d5f('0x50')]({'plain':!![]});var _0xedb6a6='Lists';return db[_0x2d5f('0x51')][_0x2d5f('0x4b')]({'where':{'name':_0xedb6a6,'userProfileId':_0x4e14d8[_0x2d5f('0x52')]},'raw':!![]})[_0x2d5f('0x29')](function(_0x49ede8){if(_0x49ede8&&_0x49ede8[_0x2d5f('0x53')]===0x0){return db[_0x2d5f('0x2b')][_0x2d5f('0x4c')]({'name':_0x51cc7b[_0x2d5f('0x2d')],'resourceId':_0x51cc7b['id'],'type':_0x49ede8['name'],'sectionId':_0x49ede8['id']},{})[_0x2d5f('0x29')](function(){return _0x44be6a;});}else{return _0x44be6a;}})[_0x2d5f('0x48')](function(_0x81b355){logger[_0x2d5f('0x54')](_0x2d5f('0x55'),_0x81b355);throw _0x81b355;});}return _0x44be6a;})[_0x2d5f('0x29')](respondWithResult(_0x588a93,0xc9))[_0x2d5f('0x48')](handleError(_0x588a93,null));};exports[_0x2d5f('0x56')]=function(_0x4011b9,_0xcb67d1){if(_0x4011b9[_0x2d5f('0x4d')]['id']){delete _0x4011b9[_0x2d5f('0x4d')]['id'];}return db[_0x2d5f('0x30')]['find']({'where':{'id':_0x4011b9[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0xcb67d1,null))[_0x2d5f('0x29')](saveUpdates(_0x4011b9['body'],null))[_0x2d5f('0x29')](respondWithResult(_0xcb67d1,null))['catch'](handleError(_0xcb67d1,null));};exports[_0x2d5f('0x2a')]=function(_0x379f4a,_0x48143a){return db[_0x2d5f('0x30')]['find']({'where':{'id':_0x379f4a[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x48143a,null))['then'](removeEntity(_0x48143a,null))['catch'](handleError(_0x48143a,null));};exports['describe']=function(_0x28cf37,_0x506ed8){return db[_0x2d5f('0x30')][_0x2d5f('0x58')]()['then'](respondWithResult(_0x506ed8,null))[_0x2d5f('0x48')](handleError(_0x506ed8,null));};exports['addDisposition']=function(_0x49fb8f,_0x589c93,_0x2652c2){if(_0x49fb8f[_0x2d5f('0x4d')]['id']){delete _0x49fb8f[_0x2d5f('0x4d')]['id'];}return db[_0x2d5f('0x30')][_0x2d5f('0x4b')]({'where':{'id':_0x49fb8f[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x589c93,null))[_0x2d5f('0x29')](function(_0x34145a){if(_0x34145a){_0x49fb8f['body'][_0x2d5f('0x59')]=_0x34145a['id'];return db[_0x2d5f('0x5a')][_0x2d5f('0x4c')](_0x49fb8f[_0x2d5f('0x4d')]);}})['then'](respondWithResult(_0x589c93,null))['catch'](handleError(_0x589c93,null));};exports[_0x2d5f('0x5b')]=function(_0x414278,_0x356c59,_0x1e3914){var _0x3b6c71={'raw':![],'where':{}};var _0x254423={};var _0x3ab83b={'count':0x0,'rows':[]};return db[_0x2d5f('0x30')][_0x2d5f('0x5c')]({'where':{'id':_0x414278[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x356c59,null))[_0x2d5f('0x29')](function(_0x1fb9c7){if(_0x1fb9c7){_0x254423['model']=_[_0x2d5f('0x34')](db[_0x2d5f('0x5a')][_0x2d5f('0x5d')]);_0x254423[_0x2d5f('0x35')]=_[_0x2d5f('0x34')](_0x414278[_0x2d5f('0x35')]);_0x254423[_0x2d5f('0x3f')]=_[_0x2d5f('0x36')](_0x254423[_0x2d5f('0x33')],_0x254423[_0x2d5f('0x35')]);_0x3b6c71[_0x2d5f('0x37')]=_['intersection'](_0x254423[_0x2d5f('0x33')],qs[_0x2d5f('0x38')](_0x414278['query'][_0x2d5f('0x38')]));_0x3b6c71['attributes']=_0x3b6c71[_0x2d5f('0x37')][_0x2d5f('0x39')]?_0x3b6c71['attributes']:_0x254423['model'];if(!_0x414278[_0x2d5f('0x35')][_0x2d5f('0x3a')]('nolimit')){_0x3b6c71['limit']=qs[_0x2d5f('0x22')](_0x414278[_0x2d5f('0x35')][_0x2d5f('0x22')]);_0x3b6c71['offset']=qs[_0x2d5f('0x20')](_0x414278[_0x2d5f('0x35')]['offset']);}_0x3b6c71['order']=qs[_0x2d5f('0x3d')](_0x414278[_0x2d5f('0x35')][_0x2d5f('0x3d')]);_0x3b6c71['where']=qs[_0x2d5f('0x3f')](_['pick'](_0x414278[_0x2d5f('0x35')],_0x254423[_0x2d5f('0x3f')]));_0x3b6c71[_0x2d5f('0x3e')][_0x2d5f('0x59')]=_0x1fb9c7['id'];if(_0x414278[_0x2d5f('0x35')][_0x2d5f('0x43')]){_0x3b6c71[_0x2d5f('0x3e')]=_[_0x2d5f('0x41')](_0x3b6c71['where'],{'$or':_[_0x2d5f('0x2f')](_0x3b6c71[_0x2d5f('0x37')],function(_0x34f8b4){var _0x562ea6={};_0x562ea6[_0x34f8b4]={'$like':'%'+_0x414278[_0x2d5f('0x35')][_0x2d5f('0x43')]+'%'};return _0x562ea6;})});}_0x3b6c71=_[_0x2d5f('0x41')]({},_0x3b6c71,_0x414278['options']);return db[_0x2d5f('0x5a')]['count']({'where':_0x3b6c71[_0x2d5f('0x3e')]})['then'](function(_0x5bfecc){_0x3ab83b[_0x2d5f('0x23')]=_0x5bfecc;if(_0x414278[_0x2d5f('0x35')][_0x2d5f('0x4a')]){_0x3b6c71[_0x2d5f('0x45')]=[{'all':!![]}];}return db['Disposition'][_0x2d5f('0x46')](_0x3b6c71);})[_0x2d5f('0x29')](function(_0x19eda8){_0x3ab83b['rows']=_0x19eda8;return _0x3ab83b;});}})[_0x2d5f('0x29')](respondWithFilteredResult(_0x356c59,_0x3b6c71))[_0x2d5f('0x48')](handleError(_0x356c59,null));};exports[_0x2d5f('0x5e')]=function(_0xed9777,_0x3afd81,_0x5028a2){return db[_0x2d5f('0x30')][_0x2d5f('0x4b')]({'where':{'id':_0xed9777[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x3afd81,null))[_0x2d5f('0x29')](function(_0x5d2a69){if(_0x5d2a69){return _0x5d2a69[_0x2d5f('0x5e')](_0xed9777[_0x2d5f('0x35')][_0x2d5f('0x5f')]);}})['then'](respondWithStatusCode(_0x3afd81,null))[_0x2d5f('0x48')](handleError(_0x3afd81,null));};exports[_0x2d5f('0x60')]=function(_0x1de076,_0x5a0f87,_0x586d15){return db[_0x2d5f('0x30')]['find']({'where':{'id':_0x1de076[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x5a0f87,null))[_0x2d5f('0x29')](function(_0x184c1c){if(_0x184c1c){var _0x3dbe13=[];var _0x47bdfc={'success':[],'errors':[]};return db[_0x2d5f('0x61')][_0x2d5f('0x58')]()[_0x2d5f('0x29')](function(_0x1e0228){if(_0x1de076[_0x2d5f('0x4d')][_0x2d5f('0x62')]&&_[_0x2d5f('0x63')](_0x1de076['body'][_0x2d5f('0x62')])){if(_0x1de076[_0x2d5f('0x4d')][_0x2d5f('0x62')]['length']){_0x1de076[_0x2d5f('0x4d')][_0x2d5f('0x62')]=_0x1de076[_0x2d5f('0x4d')][_0x2d5f('0x62')]['join'](';')+';';}else{_0x1de076['body'][_0x2d5f('0x62')]=null;}}else{_0x1de076['body'][_0x2d5f('0x62')]=null;}if(_0x1de076[_0x2d5f('0x4d')]&&_[_0x2d5f('0x63')](_0x1de076[_0x2d5f('0x4d')])){for(var _0x1ad6ee=0x0;_0x1ad6ee<_0x1de076[_0x2d5f('0x4d')][_0x2d5f('0x39')];_0x1ad6ee+=0x1){_0x1de076[_0x2d5f('0x4d')][_0x1ad6ee]['ListId']=_0x1de076[_0x2d5f('0x57')]['id'];_0x3dbe13['push'](_0x1de076[_0x2d5f('0x4d')][_0x1ad6ee]);}return BPromise[_0x2d5f('0x64')](_0x3dbe13,function(_0x4b9c21){return db[_0x2d5f('0x61')][_0x2d5f('0x4c')](_['omit'](_0x4b9c21,[_0x2d5f('0x5f'),'id'])||{},{'fields':_['keys'](_0x1e0228),'raw':!![]})['then'](function(_0x4d8c0a){_0x47bdfc[_0x2d5f('0x65')][_0x2d5f('0x66')](_0x4d8c0a['dataValues']);})[_0x2d5f('0x48')](function(_0x29b4ee){_0x47bdfc[_0x2d5f('0x67')][_0x2d5f('0x66')]({'data':_0x4b9c21,'error':_0x29b4ee[_0x2d5f('0x68')]});});})[_0x2d5f('0x29')](function(_0x2dca1a){return _0x47bdfc;})[_0x2d5f('0x48')](function(_0x327b6b){return _0x327b6b;});}else{_0x5a0f87['status'](0x190)[_0x2d5f('0x1f')]({'message':_0x2d5f('0x69')});}});}})['then'](respondWithResult(_0x5a0f87,null))['catch'](handleError(_0x5a0f87,null));};exports['getContacts']=function(_0x5d9834,_0x3b3c13,_0x201185){var _0x463ea2;return db[_0x2d5f('0x30')][_0x2d5f('0x4b')]({'where':{'id':_0x5d9834[_0x2d5f('0x57')]['id']},'include':[{'model':db[_0x2d5f('0x6a')],'as':'CustomFields'}]})[_0x2d5f('0x29')](handleEntityNotFound(_0x3b3c13,null))['then'](function(_0x49c9c9){if(_0x49c9c9){_0x463ea2=_0x49c9c9;return db[_0x2d5f('0x61')][_0x2d5f('0x5d')];}})[_0x2d5f('0x29')](function(_0x35b234){if(_0x35b234){var _0x245063={};var _0x1741de={};_0x1741de[_0x2d5f('0x33')]=_[_0x2d5f('0x6b')](_['keys'](_0x35b234),_[_0x2d5f('0x2f')](_0x463ea2[_0x2d5f('0x6c')],function(_0x3c4688){return util[_0x2d5f('0x6d')](_0x2d5f('0x6e'),_0x3c4688['id']);}));_0x1741de[_0x2d5f('0x35')]=_[_0x2d5f('0x34')](_0x5d9834[_0x2d5f('0x35')]);_0x1741de[_0x2d5f('0x3f')]=_['intersection'](_0x1741de['model'],_0x1741de['query']);_0x245063[_0x2d5f('0x37')]=_[_0x2d5f('0x36')](_0x1741de[_0x2d5f('0x33')],qs[_0x2d5f('0x38')](_0x5d9834[_0x2d5f('0x35')][_0x2d5f('0x38')]));_0x245063[_0x2d5f('0x37')]=_0x245063[_0x2d5f('0x37')]['length']?_0x245063[_0x2d5f('0x37')]:_0x1741de[_0x2d5f('0x33')];if(!_0x5d9834[_0x2d5f('0x35')][_0x2d5f('0x3a')]('nolimit')){_0x245063[_0x2d5f('0x22')]=qs[_0x2d5f('0x22')](_0x5d9834[_0x2d5f('0x35')][_0x2d5f('0x22')]);_0x245063[_0x2d5f('0x20')]=qs['offset'](_0x5d9834[_0x2d5f('0x35')][_0x2d5f('0x20')]);}_0x245063[_0x2d5f('0x3c')]=qs['sort'](_0x5d9834[_0x2d5f('0x35')]['sort']);_0x245063[_0x2d5f('0x3e')]=qs[_0x2d5f('0x3f')](_[_0x2d5f('0x40')](_0x5d9834['query'],_0x1741de[_0x2d5f('0x3f')]));_0x245063[_0x2d5f('0x6f')]=!![];if(_0x5d9834[_0x2d5f('0x35')][_0x2d5f('0x43')]){_0x245063[_0x2d5f('0x3e')]=_[_0x2d5f('0x41')](_0x245063['where'],{'$or':_[_0x2d5f('0x2f')](_0x245063['attributes'],function(_0x4f8818){var _0x5eb7e5={};_0x5eb7e5[_0x4f8818]={'$like':'%'+_0x5d9834[_0x2d5f('0x35')][_0x2d5f('0x43')]+'%'};return _0x5eb7e5;})});}_0x245063=_[_0x2d5f('0x41')]({},_0x245063,_0x5d9834[_0x2d5f('0x44')]);return _0x463ea2[_0x2d5f('0x70')](_0x245063);}})[_0x2d5f('0x29')](respondWithResult(_0x3b3c13,null))[_0x2d5f('0x48')](handleError(_0x3b3c13,null));};exports[_0x2d5f('0x71')]=function(_0x47fc0e,_0x179f97,_0x50d572){var _0x5ca4bf;var _0x291cdf;var _0x5449f1;var _0x518d5e=_0x47fc0e[_0x2d5f('0x57')]['id'];csv_results=[];return db[_0x2d5f('0x72')]['findAll']({'attributes':['id',_0x2d5f('0x2d')],'raw':!![],'order':[_0x2d5f('0x73')]})[_0x2d5f('0x29')](function(_0x261676){_0x5ca4bf=_0x261676;var _0x2ca4de=_[_0x2d5f('0x34')](db[_0x2d5f('0x61')][_0x2d5f('0x5d')]);return db[_0x2d5f('0x6a')][_0x2d5f('0x46')]({'raw':!![],'attributes':['id',_0x2d5f('0x74')]})[_0x2d5f('0x29')](function(_0x1c9d79){_0x291cdf=_0x1c9d79;var _0x104a8d=squel[_0x2d5f('0x75')]()[_0x2d5f('0x38')](_0x2ca4de)[_0x2d5f('0x76')]('cm_contacts','c')[_0x2d5f('0x3e')]('c.ListId\x20=\x20?',_0x518d5e)[_0x2d5f('0x3e')](_0x2d5f('0x77'))[_0x2d5f('0x78')]();for(var _0x28fa80=0x0;_0x28fa80<_0x291cdf['length'];_0x28fa80++){_0x104a8d[_0x2d5f('0x79')](_0x2d5f('0x7a')+_0x291cdf[_0x28fa80]['id'],_0x2d5f('0x7b')+_0x291cdf[_0x28fa80]['alias']);}for(var _0x28fa80=0x0;_0x28fa80<_0x5ca4bf[_0x2d5f('0x39')];_0x28fa80++){_0x104a8d['field'](squel[_0x2d5f('0x75')]()[_0x2d5f('0x79')](_0x2d5f('0x7c'))[_0x2d5f('0x76')](_0x2d5f('0x7d'))[_0x2d5f('0x3e')](_0x2d5f('0x7e'),_0x5ca4bf[_0x28fa80]['id'])[_0x2d5f('0x3e')](_0x2d5f('0x7f')),_0x2d5f('0x80')+_0x5ca4bf[_0x28fa80][_0x2d5f('0x2d')]);_0x104a8d[_0x2d5f('0x79')](squel[_0x2d5f('0x75')]()[_0x2d5f('0x79')](_0x2d5f('0x81'))[_0x2d5f('0x76')](_0x2d5f('0x7d'))[_0x2d5f('0x3e')](_0x2d5f('0x7e'),_0x5ca4bf[_0x28fa80]['id'])[_0x2d5f('0x3e')](_0x2d5f('0x7f')),_0x2d5f('0x82')+_0x5ca4bf[_0x28fa80][_0x2d5f('0x2d')]);}var _0x358df4=[];_0x358df4[_0x2d5f('0x66')](_0x104a8d['toString']());BPromise['each'](_0x358df4,handleQuery)[_0x2d5f('0x29')](function(_0x23ba53){handleQuery(_0x104a8d[_0x2d5f('0x83')]());var _0x443ccf=csv_results[0x0];if(!_['isEmpty'](_0x443ccf)){var _0x3360af=toCsv(_0x443ccf);var _0x47268b=Date[_0x2d5f('0x84')]();fs[_0x2d5f('0x85')](util[_0x2d5f('0x6d')](_0x2d5f('0x86'),_0x518d5e,_0x47268b),_0x3360af);_0x179f97[_0x2d5f('0x87')]('Content-disposition','attachment;\x20filename='+util[_0x2d5f('0x6d')](_0x2d5f('0x88'),_0x518d5e,_0x47268b));_0x179f97[_0x2d5f('0x87')](_0x2d5f('0x89'),'text/csv');return _0x179f97[_0x2d5f('0x8a')](util[_0x2d5f('0x6d')](_0x2d5f('0x86'),_0x518d5e,_0x47268b));}else{return _0x179f97[_0x2d5f('0x1c')](0xcc);}});});});};exports[_0x2d5f('0x8b')]=function(_0x94fb9e,_0x5e3904,_0x386194){var _0x16b7eb;delete _0x94fb9e[_0x2d5f('0x4d')]['id'];return db[_0x2d5f('0x30')][_0x2d5f('0x5c')]({'where':{'id':_0x94fb9e['params']['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x5e3904,null))['then'](function(_0x3274f3){if(_0x3274f3){return db[_0x2d5f('0x8c')][_0x2d5f('0x8d')](function(_0x3e0ea9){return db['CmCustomField'][_0x2d5f('0x4c')](_0x94fb9e[_0x2d5f('0x4d')],{'transaction':_0x3e0ea9})['then'](function(_0x2a8691){_0x16b7eb=_0x2a8691;return _0x3274f3['addCustomFields'](_0x2a8691,{'transaction':_0x3e0ea9});})[_0x2d5f('0x29')](function(){var _0x532814={'type':db['Sequelize']['TEXT'],'transaction':_0x3e0ea9};switch(_0x94fb9e[_0x2d5f('0x4d')][_0x2d5f('0x42')]){case _0x2d5f('0x8e'):_0x532814[_0x2d5f('0x42')]=db[_0x2d5f('0x8f')][_0x2d5f('0x90')];break;case'number':_0x532814[_0x2d5f('0x42')]=db[_0x2d5f('0x8f')][_0x2d5f('0x91')];break;case'switch':_0x532814[_0x2d5f('0x42')]=db['Sequelize'][_0x2d5f('0x92')];_0x532814['defaultValue']=![];break;default:}return db[_0x2d5f('0x8c')]['queryInterface'][_0x2d5f('0x93')](_0x2d5f('0x94'),util['format'](_0x2d5f('0x95'),_0x16b7eb['id']),_0x532814);})[_0x2d5f('0x29')](function(){return _0x16b7eb;});});}})['then'](respondWithResult(_0x5e3904,null))[_0x2d5f('0x48')](handleError(_0x5e3904,null));};exports[_0x2d5f('0x96')]=function(_0x12fb1a,_0x5ba5db,_0x3bb56c){var _0x118a93={};var _0x3228d6={};var _0x1e325f;var _0x453a42;return db[_0x2d5f('0x30')][_0x2d5f('0x5c')]({'where':{'id':_0x12fb1a[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x5ba5db,null))[_0x2d5f('0x29')](function(_0x3bc642){if(_0x3bc642){_0x1e325f=_0x3bc642;_0x3228d6[_0x2d5f('0x33')]=_[_0x2d5f('0x34')](db[_0x2d5f('0x6a')][_0x2d5f('0x5d')]);_0x3228d6[_0x2d5f('0x35')]=_[_0x2d5f('0x34')](_0x12fb1a[_0x2d5f('0x35')]);_0x3228d6[_0x2d5f('0x3f')]=_[_0x2d5f('0x36')](_0x3228d6[_0x2d5f('0x33')],_0x3228d6[_0x2d5f('0x35')]);_0x118a93[_0x2d5f('0x37')]=_[_0x2d5f('0x36')](_0x3228d6[_0x2d5f('0x33')],qs[_0x2d5f('0x38')](_0x12fb1a['query']['fields']));_0x118a93[_0x2d5f('0x37')]=_0x118a93[_0x2d5f('0x37')]['length']?_0x118a93[_0x2d5f('0x37')]:_0x3228d6[_0x2d5f('0x33')];_0x118a93[_0x2d5f('0x3c')]=qs[_0x2d5f('0x3d')](_0x12fb1a[_0x2d5f('0x35')]['sort']);_0x118a93['where']=qs[_0x2d5f('0x3f')](_['pick'](_0x12fb1a[_0x2d5f('0x35')],_0x3228d6[_0x2d5f('0x3f')]));_0x118a93[_0x2d5f('0x3e')]=_[_0x2d5f('0x41')](_0x118a93['where'],{'$or':[{'ListId':_0x3bc642['id']},{'ListId':null}]});if(_0x12fb1a[_0x2d5f('0x35')][_0x2d5f('0x43')]){_0x118a93['where']=_[_0x2d5f('0x41')](_0x118a93[_0x2d5f('0x3e')],{'$or':_[_0x2d5f('0x2f')](_0x118a93[_0x2d5f('0x37')],function(_0x4e3bcf){var _0x3d53e9={};_0x3d53e9[_0x4e3bcf]={'$like':'%'+_0x12fb1a[_0x2d5f('0x35')][_0x2d5f('0x43')]+'%'};return _0x3d53e9;})});}_0x118a93=_[_0x2d5f('0x41')]({},_0x118a93,_0x12fb1a['options']);return db[_0x2d5f('0x6a')][_0x2d5f('0x97')](_0x118a93);}})[_0x2d5f('0x29')](respondWithResult(_0x5ba5db,null))[_0x2d5f('0x48')](handleError(_0x5ba5db,null));};exports['getGlobalCustomFields']=function(_0x2b342f,_0x49c9b6){return db['CmCustomField']['findAndCountAll']({'where':{'ListId':null}})[_0x2d5f('0x29')](handleEntityNotFound(_0x49c9b6,null))[_0x2d5f('0x29')](function(_0x9d03a){return _0x9d03a;})[_0x2d5f('0x29')](respondWithResult(_0x49c9b6,null))[_0x2d5f('0x48')](handleError(_0x49c9b6,null));};exports[_0x2d5f('0x98')]=function(_0x2bc506,_0x3cb258,_0x2bd8a1){return db[_0x2d5f('0x30')][_0x2d5f('0x4b')]({'where':{'id':_0x2bc506[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x3cb258,null))[_0x2d5f('0x29')](function(_0x1d53d4){if(_0x1d53d4){return _0x1d53d4['addAgents'](_0x2bc506['body']['ids'],_['omit'](_0x2bc506['body'],[_0x2d5f('0x5f'),'id'])||{})[_0x2d5f('0x99')](function(_0x183d0d){for(var _0x41bde0=0x0;_0x41bde0<_0x2bc506[_0x2d5f('0x4d')][_0x2d5f('0x5f')][_0x2d5f('0x39')];_0x41bde0+=0x1){socket[_0x2d5f('0x9a')](_0x2d5f('0x9b'),{'UserId':Number(_0x2bc506[_0x2d5f('0x4d')][_0x2d5f('0x5f')][_0x41bde0]),'CmListId':Number(_0x2bc506[_0x2d5f('0x57')]['id'])});}return _0x183d0d;});}})['then'](respondWithResult(_0x3cb258,null))[_0x2d5f('0x48')](handleError(_0x3cb258,null));};exports[_0x2d5f('0x9c')]=function(_0x2ecc25,_0x3d145f,_0x5c39d8){return db[_0x2d5f('0x30')][_0x2d5f('0x4b')]({'where':{'id':_0x2ecc25['params']['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x3d145f,null))['then'](function(_0x266875){if(_0x266875){return _0x266875[_0x2d5f('0x9c')](_0x2ecc25[_0x2d5f('0x35')][_0x2d5f('0x5f')])['then'](function(){if(_[_0x2d5f('0x63')](_0x2ecc25[_0x2d5f('0x35')][_0x2d5f('0x5f')])){for(var _0x6342a8=0x0;_0x6342a8<_0x2ecc25[_0x2d5f('0x35')][_0x2d5f('0x5f')][_0x2d5f('0x39')];_0x6342a8+=0x1){socket['emit']('userCmList:remove',{'UserId':Number(_0x2ecc25[_0x2d5f('0x35')]['ids'][_0x6342a8]),'CmListId':Number(_0x2ecc25[_0x2d5f('0x57')]['id'])});}}else{socket[_0x2d5f('0x9a')](_0x2d5f('0x9d'),{'UserId':Number(_0x2ecc25['query']['ids']),'CmListId':Number(_0x2ecc25[_0x2d5f('0x57')]['id'])});}});}})[_0x2d5f('0x29')](respondWithStatusCode(_0x3d145f,null))[_0x2d5f('0x48')](handleError(_0x3d145f,null));};exports['getAgents']=function(_0x4fd9e2,_0x329af7,_0x2a90d9){var _0x27c518={};var _0x356e5f={};var _0x33bcb6;var _0x30b5ec;return db[_0x2d5f('0x30')][_0x2d5f('0x5c')]({'where':{'id':_0x4fd9e2[_0x2d5f('0x57')]['id']}})[_0x2d5f('0x29')](handleEntityNotFound(_0x329af7,null))[_0x2d5f('0x29')](function(_0x2ac446){if(_0x2ac446){_0x33bcb6=_0x2ac446;_0x356e5f[_0x2d5f('0x33')]=_[_0x2d5f('0x34')](db[_0x2d5f('0x9e')][_0x2d5f('0x5d')]);_0x356e5f['query']=_['keys'](_0x4fd9e2[_0x2d5f('0x35')]);_0x356e5f['filters']=_[_0x2d5f('0x36')](_0x356e5f['model'],_0x356e5f[_0x2d5f('0x35')]);_0x27c518['attributes']=_[_0x2d5f('0x36')](_0x356e5f['model'],qs['fields'](_0x4fd9e2[_0x2d5f('0x35')][_0x2d5f('0x38')]));_0x27c518[_0x2d5f('0x37')]=_0x27c518[_0x2d5f('0x37')][_0x2d5f('0x39')]?_0x27c518[_0x2d5f('0x37')]:_0x356e5f[_0x2d5f('0x33')];_0x27c518['order']=qs[_0x2d5f('0x3d')](_0x4fd9e2[_0x2d5f('0x35')]['sort']);_0x27c518[_0x2d5f('0x3e')]=qs['filters'](_[_0x2d5f('0x40')](_0x4fd9e2[_0x2d5f('0x35')],_0x356e5f['filters']));if(_0x4fd9e2['query']['filter']){_0x27c518[_0x2d5f('0x3e')]=_[_0x2d5f('0x41')](_0x27c518['where'],{'$or':_['map'](_0x27c518['attributes'],function(_0x4becf9){var _0x2b8ef3={};_0x2b8ef3[_0x4becf9]={'$like':'%'+_0x4fd9e2[_0x2d5f('0x35')]['filter']+'%'};return _0x2b8ef3;})});}_0x27c518=_['merge']({},_0x27c518,_0x4fd9e2['options']);return _0x33bcb6[_0x2d5f('0x9f')](_0x27c518);}})[_0x2d5f('0x29')](function(_0x25239c){if(_0x25239c){_0x30b5ec=_0x25239c[_0x2d5f('0x39')];if(!_0x4fd9e2[_0x2d5f('0x35')][_0x2d5f('0x3a')](_0x2d5f('0x3b'))){_0x27c518[_0x2d5f('0x22')]=qs[_0x2d5f('0x22')](_0x4fd9e2['query'][_0x2d5f('0x22')]);_0x27c518[_0x2d5f('0x20')]=qs['offset'](_0x4fd9e2[_0x2d5f('0x35')][_0x2d5f('0x20')]);}return _0x33bcb6[_0x2d5f('0x9f')](_0x27c518);}})[_0x2d5f('0x29')](function(_0xba867){if(_0xba867){return _0xba867?{'count':_0x30b5ec,'rows':_0xba867}:null;}})['then'](respondWithResult(_0x329af7,null))[_0x2d5f('0x48')](handleError(_0x329af7,null));};function handleQuery(_0x2b3309){logger[_0x2d5f('0xa0')](_0x2b3309);return db[_0x2d5f('0x8c')][_0x2d5f('0x35')](_0x2b3309)[_0x2d5f('0x99')](function(_0x5c09a1){csv_results[_0x2d5f('0x66')](_0x5c09a1);})[_0x2d5f('0x48')](function(_0x310291){logger[_0x2d5f('0x54')](_0x310291[_0x2d5f('0x68')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index da5c252..5166292 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 _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x315ad5,_0x4c6fbc){var _0x353745=function(_0x18e21a){while(--_0x18e21a){_0x315ad5['push'](_0x315ad5['shift']());}};_0x353745(++_0x4c6fbc);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('0x9')]=CmListEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0x55ca,0x126));var _0xa55c=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0x55ca[_0x5f0089];return _0x193892;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](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 b91e738..47ca876 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 _0xb903=['rimraf','../../config/environment','./cmList.attributes','exports','cm_lists','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x501c00,_0x1dc98b){var _0x5ad836=function(_0x21299f){while(--_0x21299f){_0x501c00['push'](_0x501c00['shift']());}};_0x5ad836(++_0x1dc98b);}(_0xb903,0x185));var _0x3b90=function(_0x276d28,_0xdab4e8){_0x276d28=_0x276d28-0x0;var _0x425d0d=_0xb903[_0x276d28];return _0x425d0d;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var logger=require(_0x3b90('0x2'))(_0x3b90('0x3'));var moment=require('moment');var BPromise=require(_0x3b90('0x4'));var rp=require(_0x3b90('0x5'));var fs=require('fs');var path=require(_0x3b90('0x6'));var rimraf=require(_0x3b90('0x7'));var config=require(_0x3b90('0x8'));var attributes=require(_0x3b90('0x9'));module[_0x3b90('0xa')]=function(_0x5acd76,_0x15b68f){return _0x5acd76['define']('CmList',attributes,{'tableName':_0x3b90('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd64b=['define','CmList','cm_lists','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x40da45,_0x29029f){var _0x29f717=function(_0x54c13c){while(--_0x54c13c){_0x40da45['push'](_0x40da45['shift']());}};_0x29f717(++_0x29029f);}(_0xd64b,0xc1));var _0xbd64=function(_0x42be36,_0x425079){_0x42be36=_0x42be36-0x0;var _0x3473d4=_0xd64b[_0x42be36];return _0x3473d4;};'use strict';var _=require(_0xbd64('0x0'));var util=require('util');var logger=require(_0xbd64('0x1'))('api');var moment=require(_0xbd64('0x2'));var BPromise=require(_0xbd64('0x3'));var rp=require(_0xbd64('0x4'));var fs=require('fs');var path=require(_0xbd64('0x5'));var rimraf=require(_0xbd64('0x6'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module['exports']=function(_0x51e87d,_0x58e9e7){return _0x51e87d[_0xbd64('0x7')](_0xbd64('0x8'),attributes,{'tableName':_0xbd64('0x9'),'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 27a03d6..2831a6a 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 _0xf769=['debug','CmList,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','./cmList.socket','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent'];(function(_0x556dda,_0x3180e8){var _0x3405ce=function(_0x4b0aac){while(--_0x4b0aac){_0x556dda['push'](_0x556dda['shift']());}};_0x3405ce(++_0x3180e8);}(_0xf769,0x157));var _0x9f76=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0xf769[_0x28e74e];return _0xb45ac1;};'use strict';var _=require(_0x9f76('0x0'));var util=require(_0x9f76('0x1'));var moment=require(_0x9f76('0x2'));var BPromise=require(_0x9f76('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9f76('0x4'));var db=require(_0x9f76('0x5'))['db'];var utils=require(_0x9f76('0x6'));var logger=require('../../config/logger')(_0x9f76('0x7'));var config=require(_0x9f76('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9f76('0x9')][_0x9f76('0xa')]({'port':0x232a});config[_0x9f76('0xb')]=_[_0x9f76('0xc')](config[_0x9f76('0xb')],{'host':_0x9f76('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9f76('0xb')]));require(_0x9f76('0xe'))[_0x9f76('0xf')](socket);function respondWithRpcPromise(_0x45454a,_0xc6dcb1,_0x30b7f5){return new BPromise(function(_0x93e62e,_0x1cd10f){return client[_0x9f76('0x10')](_0x45454a,_0x30b7f5)[_0x9f76('0x11')](function(_0x4fa730){logger[_0x9f76('0x12')](_0x9f76('0x13'),_0xc6dcb1,_0x9f76('0x14'));logger[_0x9f76('0x15')](_0x9f76('0x16'),_0xc6dcb1,_0x9f76('0x14'),JSON['stringify'](_0x4fa730));if(_0x4fa730[_0x9f76('0x17')]){if(_0x4fa730[_0x9f76('0x17')][_0x9f76('0x18')]===0x1f4){logger[_0x9f76('0x17')]('CmList,\x20%s,\x20%s',_0xc6dcb1,_0x4fa730[_0x9f76('0x17')][_0x9f76('0x19')]);return _0x1cd10f(_0x4fa730[_0x9f76('0x17')][_0x9f76('0x19')]);}logger['error']('CmList,\x20%s,\x20%s',_0xc6dcb1,_0x4fa730[_0x9f76('0x17')][_0x9f76('0x19')]);return _0x93e62e(_0x4fa730['error'][_0x9f76('0x19')]);}else{logger[_0x9f76('0x12')](_0x9f76('0x13'),_0xc6dcb1,_0x9f76('0x14'));_0x93e62e(_0x4fa730[_0x9f76('0x1a')]['message']);}})[_0x9f76('0x1b')](function(_0x4975d6){logger['error']('CmList,\x20%s,\x20%s',_0xc6dcb1,_0x4975d6);_0x1cd10f(_0x4975d6);});});} \ No newline at end of file +var _0x90d3=['message','result','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register','request','info','CmList,\x20%s,\x20%s','debug','CmList,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x1e9be4,_0x4138d7){var _0x2d39f6=function(_0x2b0851){while(--_0x2b0851){_0x1e9be4['push'](_0x1e9be4['shift']());}};_0x2d39f6(++_0x4138d7);}(_0x90d3,0x1ab));var _0x390d=function(_0x41cfd4,_0x1ed2cc){_0x41cfd4=_0x41cfd4-0x0;var _0x190f48=_0x90d3[_0x41cfd4];return _0x190f48;};'use strict';var _=require(_0x390d('0x0'));var util=require('util');var moment=require(_0x390d('0x1'));var BPromise=require(_0x390d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x390d('0x3'))['db'];var utils=require(_0x390d('0x4'));var logger=require(_0x390d('0x5'))('rpc');var config=require(_0x390d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x390d('0x7')]['http']({'port':0x232a});config[_0x390d('0x8')]=_[_0x390d('0x9')](config['redis'],{'host':_0x390d('0xa'),'port':0x18eb});var socket=require(_0x390d('0xb'))(new Redis(config[_0x390d('0x8')]));require(_0x390d('0xc'))[_0x390d('0xd')](socket);function respondWithRpcPromise(_0x52ff2c,_0xd78bde,_0x5b2ead){return new BPromise(function(_0x4a37ef,_0x385199){return client[_0x390d('0xe')](_0x52ff2c,_0x5b2ead)['then'](function(_0x1cecc6){logger[_0x390d('0xf')](_0x390d('0x10'),_0xd78bde,'request\x20sent');logger[_0x390d('0x11')](_0x390d('0x12'),_0xd78bde,_0x390d('0x13'),JSON[_0x390d('0x14')](_0x1cecc6));if(_0x1cecc6['error']){if(_0x1cecc6[_0x390d('0x15')][_0x390d('0x16')]===0x1f4){logger[_0x390d('0x15')](_0x390d('0x10'),_0xd78bde,_0x1cecc6[_0x390d('0x15')][_0x390d('0x17')]);return _0x385199(_0x1cecc6['error'][_0x390d('0x17')]);}logger['error'](_0x390d('0x10'),_0xd78bde,_0x1cecc6['error']['message']);return _0x4a37ef(_0x1cecc6[_0x390d('0x15')][_0x390d('0x17')]);}else{logger['info'](_0x390d('0x10'),_0xd78bde,'request\x20sent');_0x4a37ef(_0x1cecc6[_0x390d('0x18')]['message']);}})['catch'](function(_0x133c58){logger[_0x390d('0x15')](_0x390d('0x10'),_0xd78bde,_0x133c58);_0x385199(_0x133c58);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 1d4a55f..2e69f93 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 _0xe3b7=['save','remove','update','emit','register','length','./cmList.events'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xe3b7,0x12c));var _0x7e3b=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xe3b7[_0x21aec3];return _0x288bbc;};'use strict';var CmListEvents=require(_0x7e3b('0x0'));var events=[_0x7e3b('0x1'),_0x7e3b('0x2'),_0x7e3b('0x3')];function createListener(_0x4c8a26,_0x386f5a){return function(_0x22ea97){_0x386f5a[_0x7e3b('0x4')](_0x4c8a26,_0x22ea97);};}function removeListener(_0x5641fc,_0x1e652e){return function(){CmListEvents['removeListener'](_0x5641fc,_0x1e652e);};}exports[_0x7e3b('0x5')]=function(_0x3a9809){for(var _0x4b7396=0x0,_0xfbede5=events[_0x7e3b('0x6')];_0x4b7396<_0xfbede5;_0x4b7396++){var _0x23afed=events[_0x4b7396];var _0x4dd509=createListener('cmList:'+_0x23afed,_0x3a9809);CmListEvents['on'](_0x23afed,_0x4dd509);}}; \ No newline at end of file +var _0xadb0=['./cmList.events','save','remove','removeListener','register','length'];(function(_0x4785f4,_0x510d19){var _0x5f520=function(_0x5f430c){while(--_0x5f430c){_0x4785f4['push'](_0x4785f4['shift']());}};_0x5f520(++_0x510d19);}(_0xadb0,0x108));var _0x0adb=function(_0x2d086f,_0x2cd5ed){_0x2d086f=_0x2d086f-0x0;var _0x4ee454=_0xadb0[_0x2d086f];return _0x4ee454;};'use strict';var CmListEvents=require(_0x0adb('0x0'));var events=[_0x0adb('0x1'),_0x0adb('0x2'),'update'];function createListener(_0x4fa3a1,_0x5da954){return function(_0x1dba4d){_0x5da954['emit'](_0x4fa3a1,_0x1dba4d);};}function removeListener(_0x1e31b6,_0x449a42){return function(){CmListEvents[_0x0adb('0x3')](_0x1e31b6,_0x449a42);};}exports[_0x0adb('0x4')]=function(_0x1a2037){for(var _0x5929a2=0x0,_0x528cce=events[_0x0adb('0x5')];_0x5929a2<_0x528cce;_0x5929a2++){var _0x3cba28=events[_0x5929a2];var _0x5cc39d=createListener('cmList:'+_0x3cba28,_0x1a2037);CmListEvents['on'](_0x3cba28,_0x5cc39d);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index d603fe0..c053d55 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 _0xa8ad=['update','delete','destroy','removeAgents','multer','path','Router','../../components/interaction/service','../../config/environment','./cmList.controller','get','index','/describe','isAuthenticated','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','addAgents','put','/:id'];(function(_0x3a13cf,_0x478c62){var _0x4817c=function(_0x3a2e75){while(--_0x3a2e75){_0x3a13cf['push'](_0x3a13cf['shift']());}};_0x4817c(++_0x478c62);}(_0xa8ad,0x10c));var _0xda8a=function(_0x242491,_0xd2c9ac){_0x242491=_0x242491-0x0;var _0x4e176f=_0xa8ad[_0x242491];return _0x4e176f;};'use strict';var multer=require(_0xda8a('0x0'));var util=require('util');var path=require(_0xda8a('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xda8a('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xda8a('0x3'));var config=require(_0xda8a('0x4'));var controller=require(_0xda8a('0x5'));router[_0xda8a('0x6')]('/',auth['isAuthenticated'](),controller[_0xda8a('0x7')]);router[_0xda8a('0x6')](_0xda8a('0x8'),auth[_0xda8a('0x9')](),controller['describe']);router['get']('/global_fields',auth[_0xda8a('0x9')](),controller[_0xda8a('0xa')]);router[_0xda8a('0x6')]('/:id',auth[_0xda8a('0x9')](),controller[_0xda8a('0xb')]);router[_0xda8a('0x6')](_0xda8a('0xc'),auth['isAuthenticated'](),controller[_0xda8a('0xd')]);router[_0xda8a('0x6')](_0xda8a('0xe'),auth[_0xda8a('0x9')](),controller[_0xda8a('0xf')]);router['get'](_0xda8a('0x10'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0xda8a('0x6')](_0xda8a('0x11'),auth[_0xda8a('0x9')](),controller[_0xda8a('0x12')]);router[_0xda8a('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0xda8a('0x13')]);router[_0xda8a('0x14')]('/',auth['isAuthenticated'](),controller[_0xda8a('0x15')]);router[_0xda8a('0x14')](_0xda8a('0xc'),auth[_0xda8a('0x9')](),controller[_0xda8a('0x16')]);router[_0xda8a('0x14')](_0xda8a('0xe'),auth[_0xda8a('0x9')](),controller[_0xda8a('0x17')]);router[_0xda8a('0x14')](_0xda8a('0x11'),auth['isAuthenticated'](),controller[_0xda8a('0x18')]);router['post'](_0xda8a('0x19'),auth[_0xda8a('0x9')](),controller[_0xda8a('0x1a')]);router[_0xda8a('0x1b')](_0xda8a('0x1c'),auth['isAuthenticated'](),controller[_0xda8a('0x1d')]);router[_0xda8a('0x1e')](_0xda8a('0x1c'),auth['isAuthenticated'](),controller[_0xda8a('0x1f')]);router[_0xda8a('0x1e')](_0xda8a('0xc'),auth[_0xda8a('0x9')](),controller['removeDispositions']);router[_0xda8a('0x1e')](_0xda8a('0x19'),auth[_0xda8a('0x9')](),controller[_0xda8a('0x20')]);module['exports']=router; \ No newline at end of file +var _0xe782=['addDisposition','addContacts','addCustomField','addAgents','put','update','/:id','delete','removeDispositions','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','isAuthenticated','index','get','/global_fields','getGlobalCustomFields','show','/:id/dispositions','getDispositions','/:id/contacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','create','post'];(function(_0x3cb3ca,_0x44d697){var _0x214366=function(_0x6b38e1){while(--_0x6b38e1){_0x3cb3ca['push'](_0x3cb3ca['shift']());}};_0x214366(++_0x44d697);}(_0xe782,0x133));var _0x2e78=function(_0x295bb9,_0x3f3d99){_0x295bb9=_0x295bb9-0x0;var _0x2647a0=_0xe782[_0x295bb9];return _0x2647a0;};'use strict';var multer=require('multer');var util=require(_0x2e78('0x0'));var path=require(_0x2e78('0x1'));var timeout=require(_0x2e78('0x2'));var express=require('express');var router=express[_0x2e78('0x3')]();var fs_extra=require(_0x2e78('0x4'));var auth=require(_0x2e78('0x5'));var interaction=require(_0x2e78('0x6'));var config=require(_0x2e78('0x7'));var controller=require(_0x2e78('0x8'));router['get']('/',auth[_0x2e78('0x9')](),controller[_0x2e78('0xa')]);router[_0x2e78('0xb')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x2e78('0xb')](_0x2e78('0xc'),auth['isAuthenticated'](),controller[_0x2e78('0xd')]);router[_0x2e78('0xb')]('/:id',auth[_0x2e78('0x9')](),controller[_0x2e78('0xe')]);router[_0x2e78('0xb')](_0x2e78('0xf'),auth['isAuthenticated'](),controller[_0x2e78('0x10')]);router['get'](_0x2e78('0x11'),auth[_0x2e78('0x9')](),controller['getContacts']);router['get'](_0x2e78('0x12'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x13')]);router['get'](_0x2e78('0x14'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x15')]);router[_0x2e78('0xb')](_0x2e78('0x16'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x17')]);router['post']('/',auth[_0x2e78('0x9')](),controller[_0x2e78('0x18')]);router[_0x2e78('0x19')](_0x2e78('0xf'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x1a')]);router[_0x2e78('0x19')](_0x2e78('0x11'),auth['isAuthenticated'](),controller[_0x2e78('0x1b')]);router['post'](_0x2e78('0x14'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x1c')]);router[_0x2e78('0x19')]('/:id/users',auth[_0x2e78('0x9')](),controller[_0x2e78('0x1d')]);router[_0x2e78('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x2e78('0x1f')]);router['delete'](_0x2e78('0x20'),auth['isAuthenticated'](),controller['destroy']);router[_0x2e78('0x21')](_0x2e78('0xf'),auth[_0x2e78('0x9')](),controller[_0x2e78('0x22')]);router[_0x2e78('0x21')]('/:id/users',auth[_0x2e78('0x9')](),controller[_0x2e78('0x23')]);module[_0x2e78('0x24')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index f84f025..6bfb03b 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 _0x874c=['field','STRING','sequelize','exports','getDataValue'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x874c,0xe3));var _0xc874=function(_0x5a5c0e,_0x479bf1){_0x5a5c0e=_0x5a5c0e-0x0;var _0x5edc4f=_0x874c[_0x5a5c0e];return _0x5edc4f;};'use strict';var Sequelize=require(_0xc874('0x0'));module[_0xc874('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x12ce87){return this[_0xc874('0x2')](_0xc874('0x3'));}},'field':{'type':Sequelize[_0xc874('0x4')],'allowNull':![]},'operator':{'type':Sequelize[_0xc874('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0xc874('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x7ddf=['VIRTUAL','getDataValue','STRING','sequelize'];(function(_0x587fd9,_0x198ced){var _0xb044cd=function(_0x15b6ac){while(--_0x15b6ac){_0x587fd9['push'](_0x587fd9['shift']());}};_0xb044cd(++_0x198ced);}(_0x7ddf,0x11b));var _0xf7dd=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x7ddf[_0x24237f];return _0x48298e;};'use strict';var Sequelize=require(_0xf7dd('0x0'));module['exports']={'name':{'type':Sequelize[_0xf7dd('0x1')],'get':function(_0xea197f){return this[_0xf7dd('0x2')]('field');}},'field':{'type':Sequelize[_0xf7dd('0x3')],'allowNull':![]},'operator':{'type':Sequelize[_0xf7dd('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0xf7dd('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 903b541..98e5435 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 _0x9957=['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','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x2f1781,_0xc26ecf){var _0x5133ec=function(_0x15d769){while(--_0x15d769){_0x2f1781['push'](_0x2f1781['shift']());}};_0x5133ec(++_0xc26ecf);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x9957=['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','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x1b2e83,_0x1dfdc2){var _0x100acf=function(_0x52ece6){while(--_0x52ece6){_0x1b2e83['push'](_0x1b2e83['shift']());}};_0x100acf(++_0x1dfdc2);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 5e8523f..aceddee 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 _0x8fb6=['rimraf','./condition.attributes','exports','define','tools_conditions','lodash','api','moment','request-promise','path'];(function(_0x4b1cd7,_0x27b641){var _0x400e61=function(_0x51d246){while(--_0x51d246){_0x4b1cd7['push'](_0x4b1cd7['shift']());}};_0x400e61(++_0x27b641);}(_0x8fb6,0x1b3));var _0x68fb=function(_0x5712a7,_0x4e4280){_0x5712a7=_0x5712a7-0x0;var _0x3beca3=_0x8fb6[_0x5712a7];return _0x3beca3;};'use strict';var _=require(_0x68fb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x68fb('0x1'));var moment=require(_0x68fb('0x2'));var BPromise=require('bluebird');var rp=require(_0x68fb('0x3'));var fs=require('fs');var path=require(_0x68fb('0x4'));var rimraf=require(_0x68fb('0x5'));var config=require('../../config/environment');var attributes=require(_0x68fb('0x6'));module[_0x68fb('0x7')]=function(_0x3ff084,_0x145118){return _0x3ff084[_0x68fb('0x8')]('Condition',attributes,{'tableName':_0x68fb('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2ed2=['bluebird','request-promise','rimraf','./condition.attributes','exports','Condition','tools_conditions','lodash','util','../../config/logger','api'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x2ed2,0x1eb));var _0x22ed=function(_0x4421a0,_0x1525bc){_0x4421a0=_0x4421a0-0x0;var _0x5626d0=_0x2ed2[_0x4421a0];return _0x5626d0;};'use strict';var _=require(_0x22ed('0x0'));var util=require(_0x22ed('0x1'));var logger=require(_0x22ed('0x2'))(_0x22ed('0x3'));var moment=require('moment');var BPromise=require(_0x22ed('0x4'));var rp=require(_0x22ed('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22ed('0x6'));var config=require('../../config/environment');var attributes=require(_0x22ed('0x7'));module[_0x22ed('0x8')]=function(_0x2ab9d3,_0x52662d){return _0x2ab9d3['define'](_0x22ed('0x9'),attributes,{'tableName':_0x22ed('0xa'),'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 394157a..ede024d 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 _0xd820=['Condition,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code'];(function(_0x28d5cd,_0x5db33b){var _0x424c22=function(_0x4bea4c){while(--_0x4bea4c){_0x28d5cd['push'](_0x28d5cd['shift']());}};_0x424c22(++_0x5db33b);}(_0xd820,0xb3));var _0x0d82=function(_0x51bf0f,_0x3b3cfb){_0x51bf0f=_0x51bf0f-0x0;var _0x5c8633=_0xd820[_0x51bf0f];return _0x5c8633;};'use strict';var _=require(_0x0d82('0x0'));var util=require(_0x0d82('0x1'));var moment=require('moment');var BPromise=require(_0x0d82('0x2'));var rs=require(_0x0d82('0x3'));var fs=require('fs');var Redis=require(_0x0d82('0x4'));var db=require(_0x0d82('0x5'))['db'];var utils=require(_0x0d82('0x6'));var logger=require(_0x0d82('0x7'))(_0x0d82('0x8'));var config=require('../../config/environment');var jayson=require(_0x0d82('0x9'));var client=jayson[_0x0d82('0xa')][_0x0d82('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11d929,_0x57ed0d,_0x4ae193){return new BPromise(function(_0x3015b7,_0x24c034){return client[_0x0d82('0xc')](_0x11d929,_0x4ae193)['then'](function(_0x3d92ec){logger[_0x0d82('0xd')]('Condition,\x20%s,\x20%s',_0x57ed0d,_0x0d82('0xe'));logger[_0x0d82('0xf')]('Condition,\x20%s,\x20%s,\x20%s',_0x57ed0d,_0x0d82('0xe'),JSON[_0x0d82('0x10')](_0x3d92ec));if(_0x3d92ec[_0x0d82('0x11')]){if(_0x3d92ec['error'][_0x0d82('0x12')]===0x1f4){logger[_0x0d82('0x11')](_0x0d82('0x13'),_0x57ed0d,_0x3d92ec[_0x0d82('0x11')][_0x0d82('0x14')]);return _0x24c034(_0x3d92ec[_0x0d82('0x11')]['message']);}logger[_0x0d82('0x11')](_0x0d82('0x13'),_0x57ed0d,_0x3d92ec[_0x0d82('0x11')]['message']);return _0x3015b7(_0x3d92ec[_0x0d82('0x11')]['message']);}else{logger['info'](_0x0d82('0x13'),_0x57ed0d,_0x0d82('0xe'));_0x3015b7(_0x3d92ec[_0x0d82('0x15')]['message']);}})['catch'](function(_0x168401){logger['error']('Condition,\x20%s,\x20%s',_0x57ed0d,_0x168401);_0x24c034(_0x168401);});});} \ No newline at end of file +var _0x7332=['message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x413a68,_0x1ada70){var _0x30ed03=function(_0x752154){while(--_0x752154){_0x413a68['push'](_0x413a68['shift']());}};_0x30ed03(++_0x1ada70);}(_0x7332,0x100));var _0x2733=function(_0x481f84,_0x8954b0){_0x481f84=_0x481f84-0x0;var _0x1ede8d=_0x7332[_0x481f84];return _0x1ede8d;};'use strict';var _=require(_0x2733('0x0'));var util=require(_0x2733('0x1'));var moment=require('moment');var BPromise=require(_0x2733('0x2'));var rs=require(_0x2733('0x3'));var fs=require('fs');var Redis=require(_0x2733('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2733('0x5'));var logger=require(_0x2733('0x6'))(_0x2733('0x7'));var config=require(_0x2733('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2733('0x9')][_0x2733('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf22e28,_0x47c0f6,_0x56854a){return new BPromise(function(_0x40bcc1,_0x13cea9){return client['request'](_0xf22e28,_0x56854a)[_0x2733('0xb')](function(_0x30eaed){logger[_0x2733('0xc')](_0x2733('0xd'),_0x47c0f6,_0x2733('0xe'));logger[_0x2733('0xf')](_0x2733('0x10'),_0x47c0f6,'request\x20sent',JSON[_0x2733('0x11')](_0x30eaed));if(_0x30eaed[_0x2733('0x12')]){if(_0x30eaed['error'][_0x2733('0x13')]===0x1f4){logger[_0x2733('0x12')](_0x2733('0xd'),_0x47c0f6,_0x30eaed[_0x2733('0x12')][_0x2733('0x14')]);return _0x13cea9(_0x30eaed[_0x2733('0x12')]['message']);}logger[_0x2733('0x12')](_0x2733('0xd'),_0x47c0f6,_0x30eaed[_0x2733('0x12')][_0x2733('0x14')]);return _0x40bcc1(_0x30eaed[_0x2733('0x12')][_0x2733('0x14')]);}else{logger[_0x2733('0xc')](_0x2733('0xd'),_0x47c0f6,_0x2733('0xe'));_0x40bcc1(_0x30eaed[_0x2733('0x15')]['message']);}})[_0x2733('0x16')](function(_0x171731){logger[_0x2733('0x12')](_0x2733('0xd'),_0x47c0f6,_0x171731);_0x13cea9(_0x171731);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index ad76573..2a9339a 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 _0x33db=['isAuthenticated','delete','/:id','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put'];(function(_0x1d6528,_0x1c20a3){var _0x3928df=function(_0x520799){while(--_0x520799){_0x1d6528['push'](_0x1d6528['shift']());}};_0x3928df(++_0x1c20a3);}(_0x33db,0x17c));var _0xb33d=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0x33db[_0x1db251];return _0x56685a;};'use strict';var multer=require(_0xb33d('0x0'));var util=require(_0xb33d('0x1'));var path=require(_0xb33d('0x2'));var timeout=require('connect-timeout');var express=require(_0xb33d('0x3'));var router=express[_0xb33d('0x4')]();var fs_extra=require(_0xb33d('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb33d('0x6'));var config=require(_0xb33d('0x7'));var controller=require(_0xb33d('0x8'));router[_0xb33d('0x9')]('/:id',auth[_0xb33d('0xa')](),controller['update']);router[_0xb33d('0xb')](_0xb33d('0xc'),auth['isAuthenticated'](),controller[_0xb33d('0xd')]);module[_0xb33d('0xe')]=router; \ No newline at end of file +var _0x12d8=['../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4ae6ef,_0xc2af80){var _0x3cbb4e=function(_0x569ad5){while(--_0x569ad5){_0x4ae6ef['push'](_0x4ae6ef['shift']());}};_0x3cbb4e(++_0xc2af80);}(_0x12d8,0x81));var _0x812d=function(_0x4e15c2,_0x1a3704){_0x4e15c2=_0x4e15c2-0x0;var _0x6211d5=_0x12d8[_0x4e15c2];return _0x6211d5;};'use strict';var multer=require(_0x812d('0x0'));var util=require(_0x812d('0x1'));var path=require('path');var timeout=require(_0x812d('0x2'));var express=require(_0x812d('0x3'));var router=express[_0x812d('0x4')]();var fs_extra=require(_0x812d('0x5'));var auth=require(_0x812d('0x6'));var interaction=require(_0x812d('0x7'));var config=require(_0x812d('0x8'));var controller=require(_0x812d('0x9'));router[_0x812d('0xa')](_0x812d('0xb'),auth['isAuthenticated'](),controller[_0x812d('0xc')]);router[_0x812d('0xd')](_0x812d('0xb'),auth[_0x812d('0xe')](),controller[_0x812d('0xf')]);module[_0x812d('0x10')]=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index 163f42c..5d64998 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 _0xf117=['INTEGER','sequelize','exports','STRING'];(function(_0x1dc992,_0x2a7a63){var _0x4adf26=function(_0x2546db){while(--_0x2546db){_0x1dc992['push'](_0x1dc992['shift']());}};_0x4adf26(++_0x2a7a63);}(_0xf117,0x99));var _0x7f11=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0xf117[_0x88cd7b];return _0x56fcc8;};'use strict';var Sequelize=require(_0x7f11('0x0'));module[_0x7f11('0x1')]={'name':{'type':Sequelize[_0x7f11('0x2')],'allowNull':![],'unique':'name'},'OrderBy':{'type':Sequelize[_0x7f11('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x7f11('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x1e1a=['STRING','name','sequelize','exports'];(function(_0x4f0a33,_0x3a64a3){var _0x5e94b2=function(_0x5c8cf2){while(--_0x5c8cf2){_0x4f0a33['push'](_0x4f0a33['shift']());}};_0x5e94b2(++_0x3a64a3);}(_0x1e1a,0x86));var _0xa1e1=function(_0x3ac173,_0x208130){_0x3ac173=_0x3ac173-0x0;var _0x30e23a=_0x1e1a[_0x3ac173];return _0x30e23a;};'use strict';var Sequelize=require(_0xa1e1('0x0'));module[_0xa1e1('0x1')]={'name':{'type':Sequelize[_0xa1e1('0x2')],'allowNull':![],'unique':_0xa1e1('0x3')},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0xa1e1('0x2')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index daf7bde..0bb0fef 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 _0x3d04=['nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','show','params','rawAttributes','merge','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','ContactItemTypes','end','error','stack','name','send','map','ContactItemType','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x256fee,_0x57b509){var _0x52c53f=function(_0x46d68c){while(--_0x46d68c){_0x256fee['push'](_0x256fee['shift']());}};_0x52c53f(++_0x57b509);}(_0x3d04,0xbe));var _0x43d0=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x3d04[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x43d0('0x0'));var rimraf=require(_0x43d0('0x1'));var zipdir=require(_0x43d0('0x2'));var jsonpatch=require(_0x43d0('0x3'));var rp=require(_0x43d0('0x4'));var moment=require(_0x43d0('0x5'));var BPromise=require(_0x43d0('0x6'));var Mustache=require(_0x43d0('0x7'));var util=require('util');var path=require(_0x43d0('0x8'));var sox=require(_0x43d0('0x9'));var csv=require(_0x43d0('0xa'));var ejs=require(_0x43d0('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x43d0('0xc'));var deskjs=require(_0x43d0('0xd'));var toCsv=require(_0x43d0('0xa'));var querystring=require(_0x43d0('0xe'));var Papa=require(_0x43d0('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43d0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x43d0('0x11'))(_0x43d0('0x12'));var utils=require(_0x43d0('0x13'));var config=require(_0x43d0('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x43d0('0x15'))['db'];function respondWithStatusCode(_0x23daaa,_0x546b23){_0x546b23=_0x546b23||0xcc;return function(_0x29773b){if(_0x29773b){return _0x23daaa[_0x43d0('0x16')](_0x546b23);}return _0x23daaa[_0x43d0('0x17')](_0x546b23)['end']();};}function respondWithResult(_0xd262a8,_0x2454fa){_0x2454fa=_0x2454fa||0xc8;return function(_0x436130){if(_0x436130){return _0xd262a8['status'](_0x2454fa)[_0x43d0('0x18')](_0x436130);}};}function respondWithFilteredResult(_0x357f87,_0x44e6ec){return function(_0x1218b5){if(_0x1218b5){var _0x91b4a1=typeof _0x44e6ec['offset']==='undefined'&&typeof _0x44e6ec[_0x43d0('0x19')]===_0x43d0('0x1a');var _0x35decf=_0x1218b5['count'];var _0x2c641e=_0x91b4a1?0x0:_0x44e6ec['offset'];var _0x2c9d06=_0x91b4a1?_0x1218b5[_0x43d0('0x1b')]:_0x44e6ec[_0x43d0('0x1c')]+_0x44e6ec['limit'];var _0x3d7dcc;if(_0x2c9d06>=_0x35decf){_0x2c9d06=_0x35decf;_0x3d7dcc=0xc8;}else{_0x3d7dcc=0xce;}_0x357f87[_0x43d0('0x17')](_0x3d7dcc);return _0x357f87['set'](_0x43d0('0x1d'),_0x2c641e+'-'+_0x2c9d06+'/'+_0x35decf)[_0x43d0('0x18')](_0x1218b5);}return null;};}function patchUpdates(_0x348429){return function(_0x248622){try{jsonpatch[_0x43d0('0x1e')](_0x248622,_0x348429,!![]);}catch(_0x28381b){return BPromise[_0x43d0('0x1f')](_0x28381b);}return _0x248622[_0x43d0('0x20')]();};}function saveUpdates(_0x30febc,_0xc8a644){return function(_0xec5f07){if(_0xec5f07){return _0xec5f07[_0x43d0('0x21')](_0x30febc)[_0x43d0('0x22')](function(_0xbc72e6){return _0xbc72e6;});}return null;};}function removeEntity(_0x2efd77,_0x48aa18){return function(_0x2c7b24){if(_0x2c7b24){return _0x2c7b24[_0x43d0('0x23')]()['then'](function(){var _0x1fe708=_0x2c7b24['get']({'plain':!![]});var _0x29c111=_0x43d0('0x24');return db['UserProfileResource'][_0x43d0('0x23')]({'where':{'type':_0x29c111,'resourceId':_0x1fe708['id']}})[_0x43d0('0x22')](function(){return _0x2c7b24;});})['then'](function(){_0x2efd77[_0x43d0('0x17')](0xcc)[_0x43d0('0x25')]();});}};}function handleEntityNotFound(_0x22ae3c,_0x5f16ac){return function(_0x447725){if(!_0x447725){_0x22ae3c[_0x43d0('0x16')](0x194);}return _0x447725;};}function handleError(_0x2c4f3f,_0x1eb771){_0x1eb771=_0x1eb771||0x1f4;return function(_0x37d78f){logger[_0x43d0('0x26')](_0x37d78f[_0x43d0('0x27')]);if(_0x37d78f['name']){delete _0x37d78f[_0x43d0('0x28')];}_0x2c4f3f[_0x43d0('0x17')](_0x1eb771)[_0x43d0('0x29')](_0x37d78f);};}exports['index']=function(_0x4bfce9,_0x52c37b){var _0x3c1ea3={},_0x2db9dc={},_0x10086b={'count':0x0,'rows':[]};var _0x13e3c9=_[_0x43d0('0x2a')](db[_0x43d0('0x2b')]['rawAttributes'],function(_0x77654d){return{'name':_0x77654d[_0x43d0('0x2c')],'type':_0x77654d[_0x43d0('0x2d')][_0x43d0('0x2e')]};});_0x2db9dc[_0x43d0('0x2f')]=_[_0x43d0('0x2a')](_0x13e3c9,_0x43d0('0x28'));_0x2db9dc[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0x4bfce9[_0x43d0('0x30')]);_0x2db9dc[_0x43d0('0x32')]=_['intersection'](_0x2db9dc[_0x43d0('0x2f')],_0x2db9dc[_0x43d0('0x30')]);_0x3c1ea3[_0x43d0('0x33')]=_[_0x43d0('0x34')](_0x2db9dc['model'],qs[_0x43d0('0x35')](_0x4bfce9['query'][_0x43d0('0x35')]));_0x3c1ea3[_0x43d0('0x33')]=_0x3c1ea3['attributes'][_0x43d0('0x36')]?_0x3c1ea3[_0x43d0('0x33')]:_0x2db9dc[_0x43d0('0x2f')];if(!_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x37')](_0x43d0('0x38'))){_0x3c1ea3[_0x43d0('0x19')]=qs[_0x43d0('0x19')](_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x19')]);_0x3c1ea3[_0x43d0('0x1c')]=qs['offset'](_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x1c')]);}_0x3c1ea3[_0x43d0('0x39')]=qs[_0x43d0('0x3a')](_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x3a')]);_0x3c1ea3[_0x43d0('0x3b')]=qs[_0x43d0('0x32')](_[_0x43d0('0x3c')](_0x4bfce9[_0x43d0('0x30')],_0x2db9dc[_0x43d0('0x32')]),_0x13e3c9);if(_0x4bfce9[_0x43d0('0x30')][_0x43d0('0x3d')]){_0x3c1ea3[_0x43d0('0x3b')]=_['merge'](_0x3c1ea3[_0x43d0('0x3b')],{'$or':_[_0x43d0('0x2a')](_0x13e3c9,function(_0x38f330){if(_0x38f330[_0x43d0('0x2d')]!==_0x43d0('0x3e')){var _0x1e6c8b={};_0x1e6c8b[_0x38f330[_0x43d0('0x28')]]={'$like':'%'+_0x4bfce9[_0x43d0('0x30')]['filter']+'%'};return _0x1e6c8b;}})});}_0x3c1ea3=_['merge']({},_0x3c1ea3,_0x4bfce9[_0x43d0('0x3f')]);var _0x5ad2d0={'where':_0x3c1ea3['where']};return db[_0x43d0('0x2b')]['count'](_0x5ad2d0)[_0x43d0('0x22')](function(_0x5027d0){_0x10086b[_0x43d0('0x1b')]=_0x5027d0;if(_0x4bfce9['query'][_0x43d0('0x40')]){_0x3c1ea3[_0x43d0('0x41')]=[{'all':!![]}];}return db[_0x43d0('0x2b')]['findAll'](_0x3c1ea3);})[_0x43d0('0x22')](function(_0x520406){_0x10086b[_0x43d0('0x42')]=_0x520406;return _0x10086b;})['then'](respondWithFilteredResult(_0x52c37b,_0x3c1ea3))['catch'](handleError(_0x52c37b,null));};exports[_0x43d0('0x43')]=function(_0xcb5a02,_0x4d539f){var _0x2f2ac9={'raw':!![],'where':{'id':_0xcb5a02[_0x43d0('0x44')]['id']}},_0x1c87bc={};_0x1c87bc[_0x43d0('0x2f')]=_[_0x43d0('0x31')](db['ContactItemType'][_0x43d0('0x45')]);_0x1c87bc[_0x43d0('0x30')]=_[_0x43d0('0x31')](_0xcb5a02[_0x43d0('0x30')]);_0x1c87bc['filters']=_[_0x43d0('0x34')](_0x1c87bc[_0x43d0('0x2f')],_0x1c87bc[_0x43d0('0x30')]);_0x2f2ac9[_0x43d0('0x33')]=_[_0x43d0('0x34')](_0x1c87bc['model'],qs[_0x43d0('0x35')](_0xcb5a02[_0x43d0('0x30')]['fields']));_0x2f2ac9[_0x43d0('0x33')]=_0x2f2ac9[_0x43d0('0x33')][_0x43d0('0x36')]?_0x2f2ac9['attributes']:_0x1c87bc[_0x43d0('0x2f')];if(_0xcb5a02['query'][_0x43d0('0x40')]){_0x2f2ac9['include']=[{'all':!![]}];}_0x2f2ac9=_[_0x43d0('0x46')]({},_0x2f2ac9,_0xcb5a02[_0x43d0('0x3f')]);return db[_0x43d0('0x2b')][_0x43d0('0x47')](_0x2f2ac9)[_0x43d0('0x22')](handleEntityNotFound(_0x4d539f,null))['then'](respondWithResult(_0x4d539f,null))[_0x43d0('0x48')](handleError(_0x4d539f,null));};exports['create']=function(_0x5a6364,_0x3e7392){return db[_0x43d0('0x2b')][_0x43d0('0x49')](_0x5a6364[_0x43d0('0x4a')],{})[_0x43d0('0x22')](function(_0x3685cf){var _0x36c9d0=_0x5a6364[_0x43d0('0x4b')][_0x43d0('0x4c')]({'plain':!![]});if(!_0x36c9d0)throw new Error(_0x43d0('0x4d'));if(_0x36c9d0[_0x43d0('0x4e')]==='user'){var _0x338203=_0x3685cf[_0x43d0('0x4c')]({'plain':!![]});var _0x1503bc='ContactItemTypes';return db[_0x43d0('0x4f')]['find']({'where':{'name':_0x1503bc,'userProfileId':_0x36c9d0['userProfileId']},'raw':!![]})[_0x43d0('0x22')](function(_0x29a14a){if(_0x29a14a&&_0x29a14a[_0x43d0('0x50')]===0x0){return db[_0x43d0('0x51')][_0x43d0('0x49')]({'name':_0x338203['name'],'resourceId':_0x338203['id'],'type':_0x29a14a['name'],'sectionId':_0x29a14a['id']},{})[_0x43d0('0x22')](function(){return _0x3685cf;});}else{return _0x3685cf;}})['catch'](function(_0x32aab0){logger[_0x43d0('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32aab0);throw _0x32aab0;});}return _0x3685cf;})['then'](respondWithResult(_0x3e7392,0xc9))['catch'](handleError(_0x3e7392,null));};exports[_0x43d0('0x21')]=function(_0x126863,_0x3d89d4){if(_0x126863[_0x43d0('0x4a')]['id']){delete _0x126863[_0x43d0('0x4a')]['id'];}return db[_0x43d0('0x2b')][_0x43d0('0x47')]({'where':{'id':_0x126863[_0x43d0('0x44')]['id']}})[_0x43d0('0x22')](handleEntityNotFound(_0x3d89d4,null))['then'](saveUpdates(_0x126863[_0x43d0('0x4a')],null))[_0x43d0('0x22')](respondWithResult(_0x3d89d4,null))[_0x43d0('0x48')](handleError(_0x3d89d4,null));};exports[_0x43d0('0x23')]=function(_0x44feea,_0x5e341f){return db[_0x43d0('0x2b')][_0x43d0('0x47')]({'where':{'id':_0x44feea[_0x43d0('0x44')]['id']}})[_0x43d0('0x22')](handleEntityNotFound(_0x5e341f,null))['then'](db['CmContactHasItem'][_0x43d0('0x21')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x44feea[_0x43d0('0x44')]['id']}}))[_0x43d0('0x22')](removeEntity(_0x5e341f,null))[_0x43d0('0x48')](handleError(_0x5e341f,null));}; \ No newline at end of file +var _0xea28=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','ContactItemTypes','sendStatus','stack','name','send','index','map','ContactItemType','fieldName','key','model','query','keys','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','show','intersection','include','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','autoAssociation','UserProfileResource','body','params','destroy','CmContactHasItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel'];(function(_0x13f7b5,_0x38fe7b){var _0x5a99d5=function(_0x22414d){while(--_0x22414d){_0x13f7b5['push'](_0x13f7b5['shift']());}};_0x5a99d5(++_0x38fe7b);}(_0xea28,0x13a));var _0x8ea2=function(_0x19d872,_0x3c2116){_0x19d872=_0x19d872-0x0;var _0x57a144=_0xea28[_0x19d872];return _0x57a144;};'use strict';var emlformat=require(_0x8ea2('0x0'));var rimraf=require(_0x8ea2('0x1'));var zipdir=require(_0x8ea2('0x2'));var jsonpatch=require(_0x8ea2('0x3'));var rp=require(_0x8ea2('0x4'));var moment=require(_0x8ea2('0x5'));var BPromise=require(_0x8ea2('0x6'));var Mustache=require(_0x8ea2('0x7'));var util=require('util');var path=require(_0x8ea2('0x8'));var sox=require(_0x8ea2('0x9'));var csv=require(_0x8ea2('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ea2('0xb'));var _=require(_0x8ea2('0xc'));var squel=require(_0x8ea2('0xd'));var crypto=require(_0x8ea2('0xe'));var jsforce=require(_0x8ea2('0xf'));var deskjs=require(_0x8ea2('0x10'));var toCsv=require(_0x8ea2('0xa'));var querystring=require(_0x8ea2('0x11'));var Papa=require(_0x8ea2('0x12'));var Redis=require(_0x8ea2('0x13'));var authService=require(_0x8ea2('0x14'));var qs=require(_0x8ea2('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ea2('0x16'))(_0x8ea2('0x17'));var utils=require(_0x8ea2('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x8ea2('0x19'));var db=require(_0x8ea2('0x1a'))['db'];function respondWithStatusCode(_0x1dfb6e,_0x10aead){_0x10aead=_0x10aead||0xcc;return function(_0xe47c0e){if(_0xe47c0e){return _0x1dfb6e['sendStatus'](_0x10aead);}return _0x1dfb6e[_0x8ea2('0x1b')](_0x10aead)['end']();};}function respondWithResult(_0x4b2192,_0x772bad){_0x772bad=_0x772bad||0xc8;return function(_0x4726a7){if(_0x4726a7){return _0x4b2192[_0x8ea2('0x1b')](_0x772bad)[_0x8ea2('0x1c')](_0x4726a7);}};}function respondWithFilteredResult(_0x393faf,_0xbb9bd1){return function(_0x3cff96){if(_0x3cff96){var _0x11f5e8=typeof _0xbb9bd1[_0x8ea2('0x1d')]===_0x8ea2('0x1e')&&typeof _0xbb9bd1[_0x8ea2('0x1f')]===_0x8ea2('0x1e');var _0x3bc774=_0x3cff96[_0x8ea2('0x20')];var _0x1b64cf=_0x11f5e8?0x0:_0xbb9bd1[_0x8ea2('0x1d')];var _0x467045=_0x11f5e8?_0x3cff96[_0x8ea2('0x20')]:_0xbb9bd1[_0x8ea2('0x1d')]+_0xbb9bd1[_0x8ea2('0x1f')];var _0x134cbe;if(_0x467045>=_0x3bc774){_0x467045=_0x3bc774;_0x134cbe=0xc8;}else{_0x134cbe=0xce;}_0x393faf[_0x8ea2('0x1b')](_0x134cbe);return _0x393faf['set']('Content-Range',_0x1b64cf+'-'+_0x467045+'/'+_0x3bc774)[_0x8ea2('0x1c')](_0x3cff96);}return null;};}function patchUpdates(_0x248c18){return function(_0x29151a){try{jsonpatch['apply'](_0x29151a,_0x248c18,!![]);}catch(_0x46f4fe){return BPromise[_0x8ea2('0x21')](_0x46f4fe);}return _0x29151a['save']();};}function saveUpdates(_0x3d593b,_0x283f00){return function(_0x37229a){if(_0x37229a){return _0x37229a[_0x8ea2('0x22')](_0x3d593b)[_0x8ea2('0x23')](function(_0xe5c943){return _0xe5c943;});}return null;};}function removeEntity(_0x199417,_0x1e4cc9){return function(_0x18ec34){if(_0x18ec34){return _0x18ec34['destroy']()[_0x8ea2('0x23')](function(){var _0x4f48bd=_0x18ec34[_0x8ea2('0x24')]({'plain':!![]});var _0x42bec8=_0x8ea2('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x42bec8,'resourceId':_0x4f48bd['id']}})[_0x8ea2('0x23')](function(){return _0x18ec34;});})['then'](function(){_0x199417[_0x8ea2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3be291,_0x12fa37){return function(_0x21c526){if(!_0x21c526){_0x3be291[_0x8ea2('0x26')](0x194);}return _0x21c526;};}function handleError(_0x4e1b90,_0x5ce1d4){_0x5ce1d4=_0x5ce1d4||0x1f4;return function(_0xacaa6c){logger['error'](_0xacaa6c[_0x8ea2('0x27')]);if(_0xacaa6c[_0x8ea2('0x28')]){delete _0xacaa6c[_0x8ea2('0x28')];}_0x4e1b90[_0x8ea2('0x1b')](_0x5ce1d4)[_0x8ea2('0x29')](_0xacaa6c);};}exports[_0x8ea2('0x2a')]=function(_0x32e225,_0x316707){var _0x19e868={},_0x9c5fac={},_0x56d914={'count':0x0,'rows':[]};var _0x5b7ff9=_[_0x8ea2('0x2b')](db[_0x8ea2('0x2c')]['rawAttributes'],function(_0x4a110f){return{'name':_0x4a110f[_0x8ea2('0x2d')],'type':_0x4a110f['type'][_0x8ea2('0x2e')]};});_0x9c5fac[_0x8ea2('0x2f')]=_['map'](_0x5b7ff9,_0x8ea2('0x28'));_0x9c5fac[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x32e225['query']);_0x9c5fac['filters']=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],_0x9c5fac[_0x8ea2('0x30')]);_0x19e868[_0x8ea2('0x32')]=_['intersection'](_0x9c5fac[_0x8ea2('0x2f')],qs[_0x8ea2('0x33')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x19e868[_0x8ea2('0x32')]=_0x19e868[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x19e868[_0x8ea2('0x32')]:_0x9c5fac['model'];if(!_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x35')](_0x8ea2('0x36'))){_0x19e868[_0x8ea2('0x1f')]=qs['limit'](_0x32e225[_0x8ea2('0x30')]['limit']);_0x19e868[_0x8ea2('0x1d')]=qs[_0x8ea2('0x1d')](_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x1d')]);}_0x19e868['order']=qs[_0x8ea2('0x37')](_0x32e225['query']['sort']);_0x19e868[_0x8ea2('0x38')]=qs['filters'](_[_0x8ea2('0x39')](_0x32e225[_0x8ea2('0x30')],_0x9c5fac[_0x8ea2('0x3a')]),_0x5b7ff9);if(_0x32e225[_0x8ea2('0x30')][_0x8ea2('0x3b')]){_0x19e868['where']=_[_0x8ea2('0x3c')](_0x19e868['where'],{'$or':_[_0x8ea2('0x2b')](_0x5b7ff9,function(_0x282f00){if(_0x282f00[_0x8ea2('0x3d')]!==_0x8ea2('0x3e')){var _0x4f9a8c={};_0x4f9a8c[_0x282f00[_0x8ea2('0x28')]]={'$like':'%'+_0x32e225['query'][_0x8ea2('0x3b')]+'%'};return _0x4f9a8c;}})});}_0x19e868=_['merge']({},_0x19e868,_0x32e225[_0x8ea2('0x3f')]);var _0x450e8f={'where':_0x19e868[_0x8ea2('0x38')]};return db[_0x8ea2('0x2c')][_0x8ea2('0x20')](_0x450e8f)[_0x8ea2('0x23')](function(_0x2f4fa8){_0x56d914['count']=_0x2f4fa8;if(_0x32e225['query'][_0x8ea2('0x40')]){_0x19e868['include']=[{'all':!![]}];}return db['ContactItemType']['findAll'](_0x19e868);})[_0x8ea2('0x23')](function(_0x5d9ba0){_0x56d914[_0x8ea2('0x41')]=_0x5d9ba0;return _0x56d914;})[_0x8ea2('0x23')](respondWithFilteredResult(_0x316707,_0x19e868))[_0x8ea2('0x42')](handleError(_0x316707,null));};exports[_0x8ea2('0x43')]=function(_0x989d9b,_0x8f700f){var _0x3b2219={'raw':!![],'where':{'id':_0x989d9b['params']['id']}},_0x348b17={};_0x348b17[_0x8ea2('0x2f')]=_[_0x8ea2('0x31')](db[_0x8ea2('0x2c')]['rawAttributes']);_0x348b17[_0x8ea2('0x30')]=_[_0x8ea2('0x31')](_0x989d9b[_0x8ea2('0x30')]);_0x348b17[_0x8ea2('0x3a')]=_[_0x8ea2('0x44')](_0x348b17['model'],_0x348b17[_0x8ea2('0x30')]);_0x3b2219[_0x8ea2('0x32')]=_[_0x8ea2('0x44')](_0x348b17['model'],qs[_0x8ea2('0x33')](_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x33')]));_0x3b2219[_0x8ea2('0x32')]=_0x3b2219[_0x8ea2('0x32')][_0x8ea2('0x34')]?_0x3b2219[_0x8ea2('0x32')]:_0x348b17[_0x8ea2('0x2f')];if(_0x989d9b[_0x8ea2('0x30')][_0x8ea2('0x40')]){_0x3b2219[_0x8ea2('0x45')]=[{'all':!![]}];}_0x3b2219=_[_0x8ea2('0x3c')]({},_0x3b2219,_0x989d9b[_0x8ea2('0x3f')]);return db[_0x8ea2('0x2c')]['find'](_0x3b2219)[_0x8ea2('0x23')](handleEntityNotFound(_0x8f700f,null))[_0x8ea2('0x23')](respondWithResult(_0x8f700f,null))[_0x8ea2('0x42')](handleError(_0x8f700f,null));};exports[_0x8ea2('0x46')]=function(_0x182a46,_0x1daa25){return db[_0x8ea2('0x2c')][_0x8ea2('0x46')](_0x182a46['body'],{})[_0x8ea2('0x23')](function(_0x37a1cf){var _0x24dddb=_0x182a46['user']['get']({'plain':!![]});if(!_0x24dddb)throw new Error(_0x8ea2('0x47'));if(_0x24dddb[_0x8ea2('0x48')]===_0x8ea2('0x49')){var _0x5e5c37=_0x37a1cf[_0x8ea2('0x24')]({'plain':!![]});var _0x315b5d=_0x8ea2('0x25');return db[_0x8ea2('0x4a')][_0x8ea2('0x4b')]({'where':{'name':_0x315b5d,'userProfileId':_0x24dddb['userProfileId']},'raw':!![]})['then'](function(_0x24a22a){if(_0x24a22a&&_0x24a22a[_0x8ea2('0x4c')]===0x0){return db[_0x8ea2('0x4d')]['create']({'name':_0x5e5c37[_0x8ea2('0x28')],'resourceId':_0x5e5c37['id'],'type':_0x24a22a[_0x8ea2('0x28')],'sectionId':_0x24a22a['id']},{})[_0x8ea2('0x23')](function(){return _0x37a1cf;});}else{return _0x37a1cf;}})['catch'](function(_0x5c6524){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c6524);throw _0x5c6524;});}return _0x37a1cf;})['then'](respondWithResult(_0x1daa25,0xc9))[_0x8ea2('0x42')](handleError(_0x1daa25,null));};exports[_0x8ea2('0x22')]=function(_0x5f56f8,_0x49cf11){if(_0x5f56f8[_0x8ea2('0x4e')]['id']){delete _0x5f56f8[_0x8ea2('0x4e')]['id'];}return db[_0x8ea2('0x2c')]['find']({'where':{'id':_0x5f56f8[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x49cf11,null))['then'](saveUpdates(_0x5f56f8[_0x8ea2('0x4e')],null))[_0x8ea2('0x23')](respondWithResult(_0x49cf11,null))[_0x8ea2('0x42')](handleError(_0x49cf11,null));};exports[_0x8ea2('0x50')]=function(_0x4728b4,_0x58674d){return db['ContactItemType']['find']({'where':{'id':_0x4728b4[_0x8ea2('0x4f')]['id']}})[_0x8ea2('0x23')](handleEntityNotFound(_0x58674d,null))[_0x8ea2('0x23')](db[_0x8ea2('0x51')][_0x8ea2('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x4728b4[_0x8ea2('0x4f')]['id']}}))[_0x8ea2('0x23')](removeEntity(_0x58674d,null))['catch'](handleError(_0x58674d,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 24ae513..dc9285d 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 _0xf92f=['util','../../config/logger','bluebird','path','../../config/environment','exports','ContactItemType','tools_contact_item_types'];(function(_0x19b23a,_0x5e6cea){var _0x4a4c52=function(_0x67636d){while(--_0x67636d){_0x19b23a['push'](_0x19b23a['shift']());}};_0x4a4c52(++_0x5e6cea);}(_0xf92f,0x1f0));var _0xff92=function(_0x538478,_0xcc0e64){_0x538478=_0x538478-0x0;var _0x349fae=_0xf92f[_0x538478];return _0x349fae;};'use strict';var _=require('lodash');var util=require(_0xff92('0x0'));var logger=require(_0xff92('0x1'))('api');var moment=require('moment');var BPromise=require(_0xff92('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xff92('0x3'));var rimraf=require('rimraf');var config=require(_0xff92('0x4'));var attributes=require('./contactItemType.attributes');module[_0xff92('0x5')]=function(_0x2db7fe,_0x2f9724){return _0x2db7fe['define'](_0xff92('0x6'),attributes,{'tableName':_0xff92('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2634=['./contactItemType.attributes','define','ContactItemType','lodash','api','bluebird','path','rimraf'];(function(_0x51bda1,_0x44f80d){var _0x1ce08c=function(_0x5b788e){while(--_0x5b788e){_0x51bda1['push'](_0x51bda1['shift']());}};_0x1ce08c(++_0x44f80d);}(_0x2634,0x1e3));var _0x4263=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2634[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x4263('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4263('0x1'));var moment=require('moment');var BPromise=require(_0x4263('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4263('0x3'));var rimraf=require(_0x4263('0x4'));var config=require('../../config/environment');var attributes=require(_0x4263('0x5'));module['exports']=function(_0x13d2e1,_0x23938e){return _0x13d2e1[_0x4263('0x6')](_0x4263('0x7'),attributes,{'tableName':'tools_contact_item_types','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 7d8edf9..53f8f34 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 _0x0cee=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x596623,_0x3930a1){var _0x5b51bf=function(_0x4759b9){while(--_0x4759b9){_0x596623['push'](_0x596623['shift']());}};_0x5b51bf(++_0x3930a1);}(_0x0cee,0x12f));var _0xe0ce=function(_0x39ecf4,_0x326b43){_0x39ecf4=_0x39ecf4-0x0;var _0x54191e=_0x0cee[_0x39ecf4];return _0x54191e;};'use strict';var _=require(_0xe0ce('0x0'));var util=require(_0xe0ce('0x1'));var moment=require(_0xe0ce('0x2'));var BPromise=require(_0xe0ce('0x3'));var rs=require(_0xe0ce('0x4'));var fs=require('fs');var Redis=require(_0xe0ce('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe0ce('0x6'))(_0xe0ce('0x7'));var config=require(_0xe0ce('0x8'));var jayson=require(_0xe0ce('0x9'));var client=jayson[_0xe0ce('0xa')][_0xe0ce('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x64f82c,_0x415f34,_0x494eca){return new BPromise(function(_0x27eea3,_0x2fa936){return client['request'](_0x64f82c,_0x494eca)[_0xe0ce('0xc')](function(_0x94afeb){logger[_0xe0ce('0xd')](_0xe0ce('0xe'),_0x415f34,'request\x20sent');logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x415f34,_0xe0ce('0xf'),JSON[_0xe0ce('0x10')](_0x94afeb));if(_0x94afeb[_0xe0ce('0x11')]){if(_0x94afeb[_0xe0ce('0x11')][_0xe0ce('0x12')]===0x1f4){logger[_0xe0ce('0x11')](_0xe0ce('0xe'),_0x415f34,_0x94afeb[_0xe0ce('0x11')][_0xe0ce('0x13')]);return _0x2fa936(_0x94afeb[_0xe0ce('0x11')][_0xe0ce('0x13')]);}logger[_0xe0ce('0x11')]('ContactItemType,\x20%s,\x20%s',_0x415f34,_0x94afeb['error'][_0xe0ce('0x13')]);return _0x27eea3(_0x94afeb[_0xe0ce('0x11')]['message']);}else{logger['info'](_0xe0ce('0xe'),_0x415f34,_0xe0ce('0xf'));_0x27eea3(_0x94afeb[_0xe0ce('0x14')][_0xe0ce('0x13')]);}})[_0xe0ce('0x15')](function(_0x4e82bc){logger[_0xe0ce('0x11')]('ContactItemType,\x20%s,\x20%s',_0x415f34,_0x4e82bc);_0x2fa936(_0x4e82bc);});});} \ No newline at end of file +var _0x912f=['jayson/promise','client','request','then','info','request\x20sent','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','ContactItemType,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x294975,_0xba7309){var _0x523628=function(_0x53e7ee){while(--_0x53e7ee){_0x294975['push'](_0x294975['shift']());}};_0x523628(++_0xba7309);}(_0x912f,0x1d9));var _0xf912=function(_0x250d23,_0x4af20e){_0x250d23=_0x250d23-0x0;var _0x8611f7=_0x912f[_0x250d23];return _0x8611f7;};'use strict';var _=require(_0xf912('0x0'));var util=require(_0xf912('0x1'));var moment=require(_0xf912('0x2'));var BPromise=require('bluebird');var rs=require(_0xf912('0x3'));var fs=require('fs');var Redis=require(_0xf912('0x4'));var db=require(_0xf912('0x5'))['db'];var utils=require(_0xf912('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xf912('0x7'));var client=jayson[_0xf912('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x393532,_0x3696be,_0x11e894){return new BPromise(function(_0x51b95b,_0x553a67){return client[_0xf912('0x9')](_0x393532,_0x11e894)[_0xf912('0xa')](function(_0x2469a2){logger[_0xf912('0xb')]('ContactItemType,\x20%s,\x20%s',_0x3696be,_0xf912('0xc'));logger['debug'](_0xf912('0xd'),_0x3696be,_0xf912('0xc'),JSON[_0xf912('0xe')](_0x2469a2));if(_0x2469a2['error']){if(_0x2469a2['error']['code']===0x1f4){logger[_0xf912('0xf')](_0xf912('0x10'),_0x3696be,_0x2469a2[_0xf912('0xf')][_0xf912('0x11')]);return _0x553a67(_0x2469a2['error'][_0xf912('0x11')]);}logger[_0xf912('0xf')](_0xf912('0x10'),_0x3696be,_0x2469a2['error']['message']);return _0x51b95b(_0x2469a2[_0xf912('0xf')][_0xf912('0x11')]);}else{logger[_0xf912('0xb')](_0xf912('0x10'),_0x3696be,_0xf912('0xc'));_0x51b95b(_0x2469a2[_0xf912('0x12')][_0xf912('0x11')]);}})[_0xf912('0x13')](function(_0x158826){logger['error'](_0xf912('0x10'),_0x3696be,_0x158826);_0x553a67(_0x158826);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 0b33d4a..ce3d1f9 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 _0x4fc2=['get','isAuthenticated','index','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','./contactItemType.controller'];(function(_0x3adfd7,_0x14bcbf){var _0x54d03e=function(_0x5ef73e){while(--_0x5ef73e){_0x3adfd7['push'](_0x3adfd7['shift']());}};_0x54d03e(++_0x14bcbf);}(_0x4fc2,0x197));var _0x24fc=function(_0xf32c6d,_0x372704){_0xf32c6d=_0xf32c6d-0x0;var _0x156c11=_0x4fc2[_0xf32c6d];return _0x156c11;};'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('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x24fc('0x6'));router[_0x24fc('0x7')]('/',auth[_0x24fc('0x8')](),controller[_0x24fc('0x9')]);router[_0x24fc('0x7')](_0x24fc('0xa'),auth[_0x24fc('0x8')](),controller[_0x24fc('0xb')]);router['post']('/',auth[_0x24fc('0x8')](),controller[_0x24fc('0xc')]);router[_0x24fc('0xd')](_0x24fc('0xa'),auth['isAuthenticated'](),controller[_0x24fc('0xe')]);router[_0x24fc('0xf')](_0x24fc('0xa'),auth['isAuthenticated'](),controller[_0x24fc('0x10')]);module[_0x24fc('0x11')]=router; \ No newline at end of file +var _0x4a1c=['create','put','/:id','destroy','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./contactItemType.controller','get','index','isAuthenticated','show','post'];(function(_0x14c43d,_0x5de3af){var _0x1190f0=function(_0x2aa41f){while(--_0x2aa41f){_0x14c43d['push'](_0x14c43d['shift']());}};_0x1190f0(++_0x5de3af);}(_0x4a1c,0x199));var _0xc4a1=function(_0x528575,_0x2e067d){_0x528575=_0x528575-0x0;var _0x3063b7=_0x4a1c[_0x528575];return _0x3063b7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc4a1('0x0'));var express=require(_0xc4a1('0x1'));var router=express['Router']();var fs_extra=require(_0xc4a1('0x2'));var auth=require(_0xc4a1('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc4a1('0x4'));var controller=require(_0xc4a1('0x5'));router[_0xc4a1('0x6')]('/',auth['isAuthenticated'](),controller[_0xc4a1('0x7')]);router[_0xc4a1('0x6')]('/:id',auth[_0xc4a1('0x8')](),controller[_0xc4a1('0x9')]);router[_0xc4a1('0xa')]('/',auth[_0xc4a1('0x8')](),controller[_0xc4a1('0xb')]);router[_0xc4a1('0xc')]('/:id',auth[_0xc4a1('0x8')](),controller['update']);router['delete'](_0xc4a1('0xd'),auth['isAuthenticated'](),controller[_0xc4a1('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index c023445..bebbc1b 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 _0xb10b=['name','sequelize','STRING'];(function(_0x371886,_0x352931){var _0x104864=function(_0x1055c2){while(--_0x1055c2){_0x371886['push'](_0x371886['shift']());}};_0x104864(++_0x352931);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c206c,_0x30bdcf){_0x1c206c=_0x1c206c-0x0;var _0x188aaa=_0xb10b[_0x1c206c];return _0x188aaa;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xe706,0xa3));var _0x6e70=function(_0x3b1582,_0x31a7ff){_0x3b1582=_0x3b1582-0x0;var _0x3f2d2f=_0xe706[_0x3b1582];return _0x3f2d2f;};'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 96692bf..55b2be0 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 _0x983b=['findOne','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','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','clone','omit','createdAt','updatedAt','params','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','attrOpenchannelAccounts','web-report','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','getItems'];(function(_0x5180c3,_0x4b35f7){var _0x55c975=function(_0x4746cb){while(--_0x4746cb){_0x5180c3['push'](_0x5180c3['shift']());}};_0x55c975(++_0x4b35f7);}(_0x983b,0x187));var _0xb983=function(_0x40cdfe,_0x11cce4){_0x40cdfe=_0x40cdfe-0x0;var _0x22e2d6=_0x983b[_0x40cdfe];return _0x22e2d6;};'use strict';var emlformat=require(_0xb983('0x0'));var rimraf=require(_0xb983('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb983('0x2'));var rp=require('request-promise');var moment=require(_0xb983('0x3'));var BPromise=require(_0xb983('0x4'));var Mustache=require(_0xb983('0x5'));var util=require(_0xb983('0x6'));var path=require(_0xb983('0x7'));var sox=require('sox');var csv=require(_0xb983('0x8'));var ejs=require(_0xb983('0x9'));var fs=require('fs');var fs_extra=require(_0xb983('0xa'));var _=require(_0xb983('0xb'));var squel=require(_0xb983('0xc'));var crypto=require('crypto');var jsforce=require(_0xb983('0xd'));var deskjs=require(_0xb983('0xe'));var toCsv=require(_0xb983('0x8'));var querystring=require('querystring');var Papa=require(_0xb983('0xf'));var Redis=require('ioredis');var authService=require(_0xb983('0x10'));var qs=require(_0xb983('0x11'));var as=require(_0xb983('0x12'));var hardwareService=require(_0xb983('0x13'));var logger=require(_0xb983('0x14'))(_0xb983('0x15'));var utils=require(_0xb983('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb983('0x17'));var db=require(_0xb983('0x18'))['db'];config[_0xb983('0x19')]=_[_0xb983('0x1a')](config[_0xb983('0x19')],{'host':_0xb983('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb983('0x19')]));require('./dashboard.socket')[_0xb983('0x1c')](socket);function respondWithStatusCode(_0x59642f,_0x34af87){_0x34af87=_0x34af87||0xcc;return function(_0x119c57){if(_0x119c57){return _0x59642f[_0xb983('0x1d')](_0x34af87);}return _0x59642f['status'](_0x34af87)[_0xb983('0x1e')]();};}function respondWithResult(_0x297b34,_0x3d9f26){_0x3d9f26=_0x3d9f26||0xc8;return function(_0x5c872f){if(_0x5c872f){return _0x297b34['status'](_0x3d9f26)[_0xb983('0x1f')](_0x5c872f);}};}function respondWithFilteredResult(_0x51ba87,_0x5a94ad){return function(_0x1f66fd){if(_0x1f66fd){var _0x1c9435=typeof _0x5a94ad[_0xb983('0x20')]===_0xb983('0x21')&&typeof _0x5a94ad[_0xb983('0x22')]===_0xb983('0x21');var _0x335cff=_0x1f66fd[_0xb983('0x23')];var _0x444fc8=_0x1c9435?0x0:_0x5a94ad['offset'];var _0x378bcf=_0x1c9435?_0x1f66fd[_0xb983('0x23')]:_0x5a94ad[_0xb983('0x20')]+_0x5a94ad[_0xb983('0x22')];var _0x13103a;if(_0x378bcf>=_0x335cff){_0x378bcf=_0x335cff;_0x13103a=0xc8;}else{_0x13103a=0xce;}_0x51ba87[_0xb983('0x24')](_0x13103a);return _0x51ba87[_0xb983('0x25')](_0xb983('0x26'),_0x444fc8+'-'+_0x378bcf+'/'+_0x335cff)[_0xb983('0x1f')](_0x1f66fd);}return null;};}function patchUpdates(_0x30a83f){return function(_0x58927c){try{jsonpatch['apply'](_0x58927c,_0x30a83f,!![]);}catch(_0x1fc62e){return BPromise[_0xb983('0x27')](_0x1fc62e);}return _0x58927c[_0xb983('0x28')]();};}function saveUpdates(_0x3e3b97,_0x4ee096){return function(_0x1dc947){if(_0x1dc947){return _0x1dc947[_0xb983('0x29')](_0x3e3b97)[_0xb983('0x2a')](function(_0x298545){return _0x298545;});}return null;};}function removeEntity(_0xf6a49,_0xa4a139){return function(_0x1b996e){if(_0x1b996e){return _0x1b996e[_0xb983('0x2b')]()[_0xb983('0x2a')](function(){var _0x463d2d=_0x1b996e[_0xb983('0x2c')]({'plain':!![]});var _0x3bfedb=_0xb983('0x2d');return db[_0xb983('0x2e')][_0xb983('0x2b')]({'where':{'type':_0x3bfedb,'resourceId':_0x463d2d['id']}})[_0xb983('0x2a')](function(){return _0x1b996e;});})[_0xb983('0x2a')](function(){_0xf6a49['status'](0xcc)[_0xb983('0x1e')]();});}};}function handleEntityNotFound(_0x587dea,_0x395ea4){return function(_0x7bb155){if(!_0x7bb155){_0x587dea[_0xb983('0x1d')](0x194);}return _0x7bb155;};}function handleError(_0x1f8d7b,_0x3ac614){_0x3ac614=_0x3ac614||0x1f4;return function(_0x2baf10){logger[_0xb983('0x2f')](_0x2baf10[_0xb983('0x30')]);if(_0x2baf10[_0xb983('0x31')]){delete _0x2baf10[_0xb983('0x31')];}_0x1f8d7b[_0xb983('0x24')](_0x3ac614)[_0xb983('0x32')](_0x2baf10);};}exports[_0xb983('0x33')]=function(_0x8b71e5,_0x2fc595){var _0x544201={},_0x3bb0ed={},_0xb3d9b6={'count':0x0,'rows':[]};var _0x549651=_[_0xb983('0x34')](db[_0xb983('0x35')][_0xb983('0x36')],function(_0xc4e197){return{'name':_0xc4e197[_0xb983('0x37')],'type':_0xc4e197[_0xb983('0x38')][_0xb983('0x39')]};});_0x3bb0ed[_0xb983('0x3a')]=_[_0xb983('0x34')](_0x549651,_0xb983('0x31'));_0x3bb0ed[_0xb983('0x3b')]=_[_0xb983('0x3c')](_0x8b71e5[_0xb983('0x3b')]);_0x3bb0ed[_0xb983('0x3d')]=_[_0xb983('0x3e')](_0x3bb0ed['model'],_0x3bb0ed[_0xb983('0x3b')]);_0x544201[_0xb983('0x3f')]=_[_0xb983('0x3e')](_0x3bb0ed[_0xb983('0x3a')],qs[_0xb983('0x40')](_0x8b71e5['query'][_0xb983('0x40')]));_0x544201[_0xb983('0x3f')]=_0x544201[_0xb983('0x3f')][_0xb983('0x41')]?_0x544201[_0xb983('0x3f')]:_0x3bb0ed[_0xb983('0x3a')];if(!_0x8b71e5[_0xb983('0x3b')][_0xb983('0x42')](_0xb983('0x43'))){_0x544201[_0xb983('0x22')]=qs['limit'](_0x8b71e5[_0xb983('0x3b')][_0xb983('0x22')]);_0x544201[_0xb983('0x20')]=qs['offset'](_0x8b71e5[_0xb983('0x3b')][_0xb983('0x20')]);}_0x544201[_0xb983('0x44')]=qs['sort'](_0x8b71e5[_0xb983('0x3b')][_0xb983('0x45')]);_0x544201['where']=qs['filters'](_['pick'](_0x8b71e5[_0xb983('0x3b')],_0x3bb0ed['filters']),_0x549651);if(_0x8b71e5[_0xb983('0x3b')]['filter']){_0x544201[_0xb983('0x46')]=_[_0xb983('0x47')](_0x544201[_0xb983('0x46')],{'$or':_[_0xb983('0x34')](_0x549651,function(_0x5109bb){if(_0x5109bb[_0xb983('0x38')]!==_0xb983('0x48')){var _0x1402e5={};_0x1402e5[_0x5109bb[_0xb983('0x31')]]={'$like':'%'+_0x8b71e5[_0xb983('0x3b')][_0xb983('0x49')]+'%'};return _0x1402e5;}})});}_0x544201=_['merge']({},_0x544201,_0x8b71e5[_0xb983('0x4a')]);var _0x4deb7b={'where':_0x544201['where']};return db['Dashboard']['count'](_0x4deb7b)[_0xb983('0x2a')](function(_0x11a209){_0xb3d9b6[_0xb983('0x23')]=_0x11a209;if(_0x8b71e5[_0xb983('0x3b')][_0xb983('0x4b')]){_0x544201[_0xb983('0x4c')]=[{'all':!![]}];}return db['Dashboard'][_0xb983('0x4d')](_0x544201);})[_0xb983('0x2a')](function(_0x2ccb81){_0xb3d9b6['rows']=_0x2ccb81;return _0xb3d9b6;})[_0xb983('0x2a')](respondWithFilteredResult(_0x2fc595,_0x544201))[_0xb983('0x4e')](handleError(_0x2fc595,null));};exports[_0xb983('0x4f')]=function(_0x36e540,_0x1cf52b){var _0x902680={'raw':![],'where':{'id':_0x36e540['params']['id']}},_0x136543={};_0x136543[_0xb983('0x3a')]=_[_0xb983('0x3c')](db['Dashboard'][_0xb983('0x36')]);_0x136543['query']=_['keys'](_0x36e540['query']);_0x136543[_0xb983('0x3d')]=_['intersection'](_0x136543[_0xb983('0x3a')],_0x136543[_0xb983('0x3b')]);_0x902680[_0xb983('0x3f')]=_[_0xb983('0x3e')](_0x136543[_0xb983('0x3a')],qs['fields'](_0x36e540[_0xb983('0x3b')]['fields']));_0x902680[_0xb983('0x3f')]=_0x902680[_0xb983('0x3f')]['length']?_0x902680[_0xb983('0x3f')]:_0x136543['model'];if(_0x36e540[_0xb983('0x3b')]['includeAll']){_0x902680[_0xb983('0x4c')]=[{'all':!![]}];}_0x902680=_[_0xb983('0x47')]({},_0x902680,_0x36e540[_0xb983('0x4a')]);return db[_0xb983('0x35')][_0xb983('0x50')](_0x902680)['then'](handleEntityNotFound(_0x1cf52b,null))['then'](respondWithResult(_0x1cf52b,null))['catch'](handleError(_0x1cf52b,null));};exports[_0xb983('0x51')]=function(_0x22f88d,_0x34506b){return db['Dashboard'][_0xb983('0x51')](_0x22f88d[_0xb983('0x52')],{})[_0xb983('0x2a')](function(_0x2f57d3){var _0x389a0=_0x22f88d[_0xb983('0x53')]['get']({'plain':!![]});if(!_0x389a0)throw new Error(_0xb983('0x54'));if(_0x389a0[_0xb983('0x55')]==='user'){var _0x556356=_0x2f57d3['get']({'plain':!![]});var _0x62e3ff=_0xb983('0x2d');return db[_0xb983('0x56')]['find']({'where':{'name':_0x62e3ff,'userProfileId':_0x389a0[_0xb983('0x57')]},'raw':!![]})[_0xb983('0x2a')](function(_0x2860e5){if(_0x2860e5&&_0x2860e5[_0xb983('0x58')]===0x0){return db[_0xb983('0x2e')][_0xb983('0x51')]({'name':_0x556356[_0xb983('0x31')],'resourceId':_0x556356['id'],'type':_0x2860e5[_0xb983('0x31')],'sectionId':_0x2860e5['id']},{})[_0xb983('0x2a')](function(){return _0x2f57d3;});}else{return _0x2f57d3;}})[_0xb983('0x4e')](function(_0x2c4435){logger[_0xb983('0x2f')](_0xb983('0x59'),_0x2c4435);throw _0x2c4435;});}return _0x2f57d3;})['then'](respondWithResult(_0x34506b,0xc9))['catch'](handleError(_0x34506b,null));};exports[_0xb983('0x5a')]=function(_0x54c2e9,_0x35cdaa){var _0x50bebc={'where':{'id':_0x54c2e9['params']['id']}},_0x8ee928={};_0x8ee928[_0xb983('0x3a')]=_[_0xb983('0x3c')](db[_0xb983('0x35')][_0xb983('0x36')]);_0x50bebc[_0xb983('0x3f')]=_[_0xb983('0x3e')](_0x8ee928[_0xb983('0x3a')],qs['fields'](_0x54c2e9[_0xb983('0x3b')][_0xb983('0x40')]));_0x50bebc[_0xb983('0x3f')]=_0x50bebc['attributes'][_0xb983('0x41')]?_0x50bebc['attributes']:_0x8ee928[_0xb983('0x3a')];if(_0x54c2e9['query'][_0xb983('0x4b')]){_0x50bebc['include']=[{'all':!![]}];}_0x50bebc=_['merge']({},_0x50bebc,_0x54c2e9[_0xb983('0x4a')]);return db['Dashboard'][_0xb983('0x50')](_0x50bebc)[_0xb983('0x2a')](handleEntityNotFound(_0x35cdaa,null))[_0xb983('0x2a')](function(_0x4df12f){if(_0x4df12f){var _0x487618=_0x4df12f[_0xb983('0x2c')]({'plain':!![]});_0x487618=qs[_0xb983('0x5b')](_0x487618,['id',_0xb983('0x5c'),_0xb983('0x5d')]);_0x54c2e9[_0xb983('0x52')]=_[_0xb983('0x5b')](_0x54c2e9[_0xb983('0x52')],['id','createdAt','updatedAt']);return db['Dashboard'][_0xb983('0x51')](_[_0xb983('0x47')](_0x487618,_0x54c2e9[_0xb983('0x52')]),{'include':_0x54c2e9[_0xb983('0x3b')][_0xb983('0x4b')]?[{'all':!![]}]:undefined})['then'](function(_0x59865c){var _0x44455b=_0x54c2e9[_0xb983('0x53')][_0xb983('0x2c')]({'plain':!![]});if(!_0x44455b)throw new Error(_0xb983('0x54'));if(_0x44455b['role']==='user'){var _0x1a54f4=_0x59865c[_0xb983('0x2c')]({'plain':!![]});var _0x3b5ca8=_0xb983('0x2d');return db[_0xb983('0x56')][_0xb983('0x50')]({'where':{'name':_0x3b5ca8,'userProfileId':_0x44455b['userProfileId']},'raw':!![]})['then'](function(_0x10953c){if(_0x10953c&&_0x10953c[_0xb983('0x58')]===0x0){return db[_0xb983('0x2e')][_0xb983('0x51')]({'name':_0x1a54f4[_0xb983('0x31')],'resourceId':_0x1a54f4['id'],'type':_0x10953c['name'],'sectionId':_0x10953c['id']},{})['then'](function(){return _0x59865c;});}else{return _0x59865c;}})[_0xb983('0x4e')](function(_0xf6375f){logger[_0xb983('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xf6375f);throw _0xf6375f;});}return _0x59865c;});}})['then'](respondWithResult(_0x35cdaa,0xc9))['catch'](handleError(_0x35cdaa,null));};exports[_0xb983('0x29')]=function(_0x58fc8e,_0x39c073){if(_0x58fc8e[_0xb983('0x52')]['id']){delete _0x58fc8e[_0xb983('0x52')]['id'];}return db[_0xb983('0x35')][_0xb983('0x50')]({'where':{'id':_0x58fc8e['params']['id']}})[_0xb983('0x2a')](handleEntityNotFound(_0x39c073,null))[_0xb983('0x2a')](saveUpdates(_0x58fc8e[_0xb983('0x52')],null))[_0xb983('0x2a')](respondWithResult(_0x39c073,null))[_0xb983('0x4e')](handleError(_0x39c073,null));};exports[_0xb983('0x2b')]=function(_0x5b26a4,_0x1c0064){return db[_0xb983('0x35')]['find']({'where':{'id':_0x5b26a4[_0xb983('0x5e')]['id']}})[_0xb983('0x2a')](handleEntityNotFound(_0x1c0064,null))[_0xb983('0x2a')](removeEntity(_0x1c0064,null))[_0xb983('0x4e')](handleError(_0x1c0064,null));};function widgetAttributes(_0x198e60){try{switch(_0x198e60['type']){case _0xb983('0x5f'):return[{'name':_0xb983('0x60'),'value':_0x198e60[_0xb983('0x60')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x0]?_0x198e60['attrs'][0x0]['value']:undefined)||_0xb983('0x62')}];case'custom':return[{'name':_0xb983('0x63'),'value':_0x198e60['attrPath']||(_0x198e60[_0xb983('0x61')]&&_0x198e60['attrs'][0x0]?_0x198e60[_0xb983('0x61')][0x0][_0xb983('0x64')]:undefined)||''}];case _0xb983('0x65'):return[{'name':_0xb983('0x66'),'value':_0x198e60['attrHourFormat']||(_0x198e60[_0xb983('0x61')]&&_0x198e60['attrs'][0x0]?_0x198e60[_0xb983('0x61')][0x0][_0xb983('0x64')]:undefined)||_0xb983('0x67')},{'name':_0xb983('0x68'),'value':_0x198e60[_0xb983('0x68')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x1]?_0x198e60[_0xb983('0x61')][0x1][_0xb983('0x64')]:undefined)||_0xb983('0x69')},{'name':_0xb983('0x6a'),'value':_0x198e60[_0xb983('0x6a')]||(_0x198e60['attrs']&&_0x198e60[_0xb983('0x61')][0x2]?_0x198e60[_0xb983('0x61')][0x2]['value']:undefined)||0xc}];case _0xb983('0x6b'):return[{'name':'attrMetric','value':_0x198e60['attrMetric']||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x0]?_0x198e60[_0xb983('0x61')][0x0][_0xb983('0x64')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x198e60[_0xb983('0x6c')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x1]?_0x198e60[_0xb983('0x61')][0x1][_0xb983('0x64')]:undefined)||[]},{'name':_0xb983('0x6a'),'value':_0x198e60[_0xb983('0x6a')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x2]?_0x198e60[_0xb983('0x61')][0x2][_0xb983('0x64')]:undefined)||0x14},{'name':_0xb983('0x6d'),'value':_0x198e60[_0xb983('0x6d')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60['attrs'][0x3]?_0x198e60[_0xb983('0x61')][0x3][_0xb983('0x64')]:undefined)||_0xb983('0x6e')},{'name':'attrEmailAccounts','value':_0x198e60[_0xb983('0x6f')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x4]?_0x198e60[_0xb983('0x61')][0x4]['value']:undefined)||''},{'name':_0xb983('0x70'),'value':_0x198e60[_0xb983('0x70')]||(_0x198e60['attrs']&&_0x198e60['attrs'][0x5]?_0x198e60[_0xb983('0x61')][0x5][_0xb983('0x64')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x198e60[_0xb983('0x71')]||(_0x198e60['attrs']&&_0x198e60['attrs'][0x6]?_0x198e60[_0xb983('0x61')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x198e60['attrOpenchannelAccounts']||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x7]?_0x198e60[_0xb983('0x61')][0x7][_0xb983('0x64')]:undefined)||''},{'name':_0xb983('0x72'),'value':_0x198e60['attrWhatsappAccounts']||(_0x198e60['attrs']&&_0x198e60[_0xb983('0x61')][0x8]?_0x198e60[_0xb983('0x61')][0x8][_0xb983('0x64')]:undefined)||''},{'name':'attrChatWebsites','value':_0x198e60[_0xb983('0x73')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x9]?_0x198e60[_0xb983('0x61')][0x9]['value']:undefined)||''}];case _0xb983('0x74'):case _0xb983('0x75'):return[{'name':_0xb983('0x76'),'value':_0x198e60[_0xb983('0x76')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x0]?_0x198e60[_0xb983('0x61')][0x0][_0xb983('0x64')]:undefined)||_0xb983('0x77')},{'name':_0xb983('0x78'),'value':_0x198e60[_0xb983('0x78')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x1]?_0x198e60[_0xb983('0x61')][0x1][_0xb983('0x64')]:undefined)||null},{'name':_0xb983('0x79'),'value':_0x198e60['attrSerie3']||(_0x198e60['attrs']&&_0x198e60[_0xb983('0x61')][0x2]?_0x198e60[_0xb983('0x61')][0x2][_0xb983('0x64')]:undefined)||null},{'name':_0xb983('0x6c'),'value':_0x198e60[_0xb983('0x6c')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60['attrs'][0x3]?_0x198e60[_0xb983('0x61')][0x3][_0xb983('0x64')]:undefined)||[]},{'name':'attrChannel','value':_0x198e60[_0xb983('0x6d')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60['attrs'][0x4]?_0x198e60['attrs'][0x4][_0xb983('0x64')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x198e60['attrEmailAccounts']||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x5]?_0x198e60[_0xb983('0x61')][0x5]['value']:undefined)||''},{'name':_0xb983('0x70'),'value':_0x198e60[_0xb983('0x70')]||(_0x198e60['attrs']&&_0x198e60['attrs'][0x6]?_0x198e60[_0xb983('0x61')][0x6][_0xb983('0x64')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x198e60[_0xb983('0x71')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x7]?_0x198e60[_0xb983('0x61')][0x7][_0xb983('0x64')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x198e60[_0xb983('0x7a')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x8]?_0x198e60[_0xb983('0x61')][0x8][_0xb983('0x64')]:undefined)||''},{'name':_0xb983('0x72'),'value':_0x198e60[_0xb983('0x72')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x9]?_0x198e60[_0xb983('0x61')][0x9]['value']:undefined)||''},{'name':_0xb983('0x73'),'value':_0x198e60[_0xb983('0x73')]||(_0x198e60['attrs']&&_0x198e60[_0xb983('0x61')][0xa]?_0x198e60[_0xb983('0x61')][0xa][_0xb983('0x64')]:undefined)||''}];case _0xb983('0x7b'):return[{'name':'attrReport','type':_0x198e60['reportType']||(_0x198e60[_0xb983('0x61')]&&_0x198e60['attrs'][0x0]?_0x198e60[_0xb983('0x61')][0x0][_0xb983('0x38')]:undefined)||null,'value':_0x198e60['attrReport']||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x0]?_0x198e60[_0xb983('0x61')][0x0][_0xb983('0x64')]:undefined)||null},{'name':_0xb983('0x7c'),'value':_0x198e60[_0xb983('0x7c')]||(_0x198e60[_0xb983('0x61')]&&_0x198e60[_0xb983('0x61')][0x1]?_0x198e60['attrs'][0x1][_0xb983('0x64')]:undefined)||0x0}];default:return[];}}catch(_0x3a89a8){logger['error'](_0xb983('0x7d'),JSON[_0xb983('0x7e')](_0x3a89a8));return[];}}exports[_0xb983('0x7f')]=function(_0x1156e7,_0x587592,_0x3fa306){if(_0x1156e7[_0xb983('0x52')]['id']){delete _0x1156e7['body']['id'];}return db[_0xb983('0x35')][_0xb983('0x50')]({'where':{'id':_0x1156e7[_0xb983('0x5e')]['id']}})[_0xb983('0x2a')](handleEntityNotFound(_0x587592,null))[_0xb983('0x2a')](function(_0x52a48d){if(_0x52a48d){_0x1156e7[_0xb983('0x52')]['DashboardId']=_0x52a48d['id'];_0x1156e7['body'][_0xb983('0x61')]=widgetAttributes(_0x1156e7[_0xb983('0x52')]);return db['DashboardItem'][_0xb983('0x51')](_0x1156e7['body']);}})[_0xb983('0x2a')](respondWithResult(_0x587592,null))[_0xb983('0x4e')](handleError(_0x587592,null));};exports[_0xb983('0x80')]=function(_0x57140d,_0xdb7ac6,_0x2e9ff7){var _0x2e65d2={};var _0x5ccadf={};var _0x1413a9;var _0x5884dd;return db[_0xb983('0x35')][_0xb983('0x81')]({'where':{'id':_0x57140d[_0xb983('0x5e')]['id']}})[_0xb983('0x2a')](handleEntityNotFound(_0xdb7ac6,null))[_0xb983('0x2a')](function(_0x127c47){if(_0x127c47){_0x1413a9=_0x127c47;_0x5ccadf[_0xb983('0x3a')]=_[_0xb983('0x3c')](db['DashboardItem'][_0xb983('0x36')]);_0x5ccadf[_0xb983('0x3b')]=_[_0xb983('0x3c')](_0x57140d['query']);_0x5ccadf[_0xb983('0x3d')]=_[_0xb983('0x3e')](_0x5ccadf[_0xb983('0x3a')],_0x5ccadf[_0xb983('0x3b')]);_0x2e65d2[_0xb983('0x3f')]=_[_0xb983('0x3e')](_0x5ccadf['model'],qs[_0xb983('0x40')](_0x57140d['query']['fields']));_0x2e65d2['attributes']=_0x2e65d2[_0xb983('0x3f')][_0xb983('0x41')]?_0x2e65d2['attributes']:_0x5ccadf['model'];_0x2e65d2[_0xb983('0x44')]=qs[_0xb983('0x45')](_0x57140d[_0xb983('0x3b')][_0xb983('0x45')]);_0x2e65d2['where']=qs['filters'](_['pick'](_0x57140d[_0xb983('0x3b')],_0x5ccadf[_0xb983('0x3d')]));if(_0x57140d[_0xb983('0x3b')]['filter']){_0x2e65d2[_0xb983('0x46')]=_[_0xb983('0x47')](_0x2e65d2[_0xb983('0x46')],{'$or':_[_0xb983('0x34')](_0x2e65d2['attributes'],function(_0x5a4f3d){var _0x4e8efb={};_0x4e8efb[_0x5a4f3d]={'$like':'%'+_0x57140d[_0xb983('0x3b')][_0xb983('0x49')]+'%'};return _0x4e8efb;})});}_0x2e65d2=_[_0xb983('0x47')]({},_0x2e65d2,_0x57140d[_0xb983('0x4a')]);return _0x1413a9[_0xb983('0x80')](_0x2e65d2);}})['then'](function(_0x387578){if(_0x387578){_0x5884dd=_0x387578[_0xb983('0x41')];if(!_0x57140d[_0xb983('0x3b')][_0xb983('0x42')](_0xb983('0x43'))){_0x2e65d2[_0xb983('0x22')]=qs[_0xb983('0x22')](_0x57140d[_0xb983('0x3b')][_0xb983('0x22')]);_0x2e65d2[_0xb983('0x20')]=qs[_0xb983('0x20')](_0x57140d[_0xb983('0x3b')][_0xb983('0x20')]);}return _0x1413a9[_0xb983('0x80')](_0x2e65d2);}})[_0xb983('0x2a')](function(_0x472b4f){if(_0x472b4f){return _0x472b4f?{'count':_0x5884dd,'rows':_0x472b4f}:null;}})['then'](respondWithResult(_0xdb7ac6,null))['catch'](handleError(_0xdb7ac6,null));}; \ No newline at end of file +var _0x893f=['attrReport','reportType','attrRefresh','stringify','addItem','getItems','findOne','DashboardItem','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','undefined','limit','count','offset','set','save','update','destroy','then','get','CustomDashboards','UserProfileResource','error','name','send','map','Dashboard','rawAttributes','type','key','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','rows','catch','show','params','keys','length','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','updatedAt','role','attrUrl','attrs','value','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrWhatsappAccounts','multibar-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrOpenchannelAccounts','attrChatWebsites','web-report'];(function(_0x4305e2,_0x401ac3){var _0x1f9552=function(_0x41cc2a){while(--_0x41cc2a){_0x4305e2['push'](_0x4305e2['shift']());}};_0x1f9552(++_0x401ac3);}(_0x893f,0x182));var _0xf893=function(_0x785987,_0x14827a){_0x785987=_0x785987-0x0;var _0x29f5c8=_0x893f[_0x785987];return _0x29f5c8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf893('0x0'));var zipdir=require(_0xf893('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf893('0x2'));var moment=require(_0xf893('0x3'));var BPromise=require(_0xf893('0x4'));var Mustache=require(_0xf893('0x5'));var util=require(_0xf893('0x6'));var path=require(_0xf893('0x7'));var sox=require('sox');var csv=require(_0xf893('0x8'));var ejs=require(_0xf893('0x9'));var fs=require('fs');var fs_extra=require(_0xf893('0xa'));var _=require(_0xf893('0xb'));var squel=require(_0xf893('0xc'));var crypto=require(_0xf893('0xd'));var jsforce=require(_0xf893('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf893('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf893('0xf'));var authService=require(_0xf893('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xf893('0x11'));var hardwareService=require(_0xf893('0x12'));var logger=require(_0xf893('0x13'))(_0xf893('0x14'));var utils=require(_0xf893('0x15'));var config=require(_0xf893('0x16'));var licenseUtil=require(_0xf893('0x17'));var db=require(_0xf893('0x18'))['db'];config['redis']=_[_0xf893('0x19')](config[_0xf893('0x1a')],{'host':_0xf893('0x1b'),'port':0x18eb});var socket=require(_0xf893('0x1c'))(new Redis(config[_0xf893('0x1a')]));require(_0xf893('0x1d'))[_0xf893('0x1e')](socket);function respondWithStatusCode(_0x2b6b7c,_0x281b33){_0x281b33=_0x281b33||0xcc;return function(_0x2f8809){if(_0x2f8809){return _0x2b6b7c[_0xf893('0x1f')](_0x281b33);}return _0x2b6b7c[_0xf893('0x20')](_0x281b33)[_0xf893('0x21')]();};}function respondWithResult(_0x7b10c7,_0x21ed88){_0x21ed88=_0x21ed88||0xc8;return function(_0x4b9003){if(_0x4b9003){return _0x7b10c7[_0xf893('0x20')](_0x21ed88)[_0xf893('0x22')](_0x4b9003);}};}function respondWithFilteredResult(_0x378e95,_0x5be803){return function(_0x46f6e5){if(_0x46f6e5){var _0x5cdb7b=typeof _0x5be803['offset']===_0xf893('0x23')&&typeof _0x5be803[_0xf893('0x24')]===_0xf893('0x23');var _0x381fd2=_0x46f6e5[_0xf893('0x25')];var _0x3864d7=_0x5cdb7b?0x0:_0x5be803[_0xf893('0x26')];var _0x4a8bc5=_0x5cdb7b?_0x46f6e5[_0xf893('0x25')]:_0x5be803[_0xf893('0x26')]+_0x5be803[_0xf893('0x24')];var _0x41b020;if(_0x4a8bc5>=_0x381fd2){_0x4a8bc5=_0x381fd2;_0x41b020=0xc8;}else{_0x41b020=0xce;}_0x378e95[_0xf893('0x20')](_0x41b020);return _0x378e95[_0xf893('0x27')]('Content-Range',_0x3864d7+'-'+_0x4a8bc5+'/'+_0x381fd2)['json'](_0x46f6e5);}return null;};}function patchUpdates(_0x395dbb){return function(_0xb4d62f){try{jsonpatch['apply'](_0xb4d62f,_0x395dbb,!![]);}catch(_0x997c6e){return BPromise['reject'](_0x997c6e);}return _0xb4d62f[_0xf893('0x28')]();};}function saveUpdates(_0x198264,_0xb7e447){return function(_0xc88919){if(_0xc88919){return _0xc88919[_0xf893('0x29')](_0x198264)['then'](function(_0x51297b){return _0x51297b;});}return null;};}function removeEntity(_0x845701,_0x103b19){return function(_0x3b3b04){if(_0x3b3b04){return _0x3b3b04[_0xf893('0x2a')]()[_0xf893('0x2b')](function(){var _0x4a7dc8=_0x3b3b04[_0xf893('0x2c')]({'plain':!![]});var _0x32cf56=_0xf893('0x2d');return db[_0xf893('0x2e')][_0xf893('0x2a')]({'where':{'type':_0x32cf56,'resourceId':_0x4a7dc8['id']}})[_0xf893('0x2b')](function(){return _0x3b3b04;});})[_0xf893('0x2b')](function(){_0x845701['status'](0xcc)[_0xf893('0x21')]();});}};}function handleEntityNotFound(_0x314f87,_0xcca8b8){return function(_0x2d31a3){if(!_0x2d31a3){_0x314f87[_0xf893('0x1f')](0x194);}return _0x2d31a3;};}function handleError(_0x451cfa,_0x42d2d3){_0x42d2d3=_0x42d2d3||0x1f4;return function(_0x50ab52){logger[_0xf893('0x2f')](_0x50ab52['stack']);if(_0x50ab52[_0xf893('0x30')]){delete _0x50ab52[_0xf893('0x30')];}_0x451cfa[_0xf893('0x20')](_0x42d2d3)[_0xf893('0x31')](_0x50ab52);};}exports['index']=function(_0x119266,_0x348b0e){var _0x293bca={},_0x1a3e9a={},_0x183e2d={'count':0x0,'rows':[]};var _0x4b663c=_[_0xf893('0x32')](db[_0xf893('0x33')][_0xf893('0x34')],function(_0x1d3443){return{'name':_0x1d3443['fieldName'],'type':_0x1d3443[_0xf893('0x35')][_0xf893('0x36')]};});_0x1a3e9a['model']=_[_0xf893('0x32')](_0x4b663c,_0xf893('0x30'));_0x1a3e9a[_0xf893('0x37')]=_['keys'](_0x119266[_0xf893('0x37')]);_0x1a3e9a['filters']=_[_0xf893('0x38')](_0x1a3e9a['model'],_0x1a3e9a['query']);_0x293bca[_0xf893('0x39')]=_[_0xf893('0x38')](_0x1a3e9a[_0xf893('0x3a')],qs[_0xf893('0x3b')](_0x119266[_0xf893('0x37')][_0xf893('0x3b')]));_0x293bca['attributes']=_0x293bca['attributes']['length']?_0x293bca[_0xf893('0x39')]:_0x1a3e9a['model'];if(!_0x119266[_0xf893('0x37')][_0xf893('0x3c')](_0xf893('0x3d'))){_0x293bca[_0xf893('0x24')]=qs[_0xf893('0x24')](_0x119266[_0xf893('0x37')][_0xf893('0x24')]);_0x293bca['offset']=qs[_0xf893('0x26')](_0x119266['query'][_0xf893('0x26')]);}_0x293bca[_0xf893('0x3e')]=qs[_0xf893('0x3f')](_0x119266[_0xf893('0x37')][_0xf893('0x3f')]);_0x293bca[_0xf893('0x40')]=qs['filters'](_[_0xf893('0x41')](_0x119266['query'],_0x1a3e9a[_0xf893('0x42')]),_0x4b663c);if(_0x119266[_0xf893('0x37')][_0xf893('0x43')]){_0x293bca[_0xf893('0x40')]=_[_0xf893('0x44')](_0x293bca[_0xf893('0x40')],{'$or':_[_0xf893('0x32')](_0x4b663c,function(_0x51644e){if(_0x51644e[_0xf893('0x35')]!==_0xf893('0x45')){var _0x55d58f={};_0x55d58f[_0x51644e[_0xf893('0x30')]]={'$like':'%'+_0x119266[_0xf893('0x37')][_0xf893('0x43')]+'%'};return _0x55d58f;}})});}_0x293bca=_[_0xf893('0x44')]({},_0x293bca,_0x119266[_0xf893('0x46')]);var _0x266972={'where':_0x293bca[_0xf893('0x40')]};return db[_0xf893('0x33')][_0xf893('0x25')](_0x266972)['then'](function(_0x282995){_0x183e2d['count']=_0x282995;if(_0x119266['query']['includeAll']){_0x293bca['include']=[{'all':!![]}];}return db[_0xf893('0x33')]['findAll'](_0x293bca);})[_0xf893('0x2b')](function(_0x119acc){_0x183e2d[_0xf893('0x47')]=_0x119acc;return _0x183e2d;})['then'](respondWithFilteredResult(_0x348b0e,_0x293bca))[_0xf893('0x48')](handleError(_0x348b0e,null));};exports[_0xf893('0x49')]=function(_0x4fc226,_0x45964c){var _0x5536d1={'raw':![],'where':{'id':_0x4fc226[_0xf893('0x4a')]['id']}},_0x346ad3={};_0x346ad3[_0xf893('0x3a')]=_[_0xf893('0x4b')](db[_0xf893('0x33')][_0xf893('0x34')]);_0x346ad3[_0xf893('0x37')]=_[_0xf893('0x4b')](_0x4fc226[_0xf893('0x37')]);_0x346ad3['filters']=_[_0xf893('0x38')](_0x346ad3[_0xf893('0x3a')],_0x346ad3[_0xf893('0x37')]);_0x5536d1[_0xf893('0x39')]=_[_0xf893('0x38')](_0x346ad3[_0xf893('0x3a')],qs[_0xf893('0x3b')](_0x4fc226[_0xf893('0x37')][_0xf893('0x3b')]));_0x5536d1[_0xf893('0x39')]=_0x5536d1[_0xf893('0x39')][_0xf893('0x4c')]?_0x5536d1[_0xf893('0x39')]:_0x346ad3['model'];if(_0x4fc226[_0xf893('0x37')]['includeAll']){_0x5536d1[_0xf893('0x4d')]=[{'all':!![]}];}_0x5536d1=_[_0xf893('0x44')]({},_0x5536d1,_0x4fc226[_0xf893('0x46')]);return db[_0xf893('0x33')][_0xf893('0x4e')](_0x5536d1)[_0xf893('0x2b')](handleEntityNotFound(_0x45964c,null))[_0xf893('0x2b')](respondWithResult(_0x45964c,null))['catch'](handleError(_0x45964c,null));};exports['create']=function(_0x4c2f1d,_0x29e334){return db['Dashboard'][_0xf893('0x4f')](_0x4c2f1d['body'],{})['then'](function(_0xb944fe){var _0x5ebfdf=_0x4c2f1d[_0xf893('0x50')][_0xf893('0x2c')]({'plain':!![]});if(!_0x5ebfdf)throw new Error(_0xf893('0x51'));if(_0x5ebfdf['role']==='user'){var _0x56508f=_0xb944fe[_0xf893('0x2c')]({'plain':!![]});var _0x44edbc=_0xf893('0x2d');return db[_0xf893('0x52')][_0xf893('0x4e')]({'where':{'name':_0x44edbc,'userProfileId':_0x5ebfdf[_0xf893('0x53')]},'raw':!![]})[_0xf893('0x2b')](function(_0x5bb0b7){if(_0x5bb0b7&&_0x5bb0b7[_0xf893('0x54')]===0x0){return db[_0xf893('0x2e')]['create']({'name':_0x56508f[_0xf893('0x30')],'resourceId':_0x56508f['id'],'type':_0x5bb0b7['name'],'sectionId':_0x5bb0b7['id']},{})[_0xf893('0x2b')](function(){return _0xb944fe;});}else{return _0xb944fe;}})[_0xf893('0x48')](function(_0x3b7893){logger[_0xf893('0x2f')](_0xf893('0x55'),_0x3b7893);throw _0x3b7893;});}return _0xb944fe;})[_0xf893('0x2b')](respondWithResult(_0x29e334,0xc9))[_0xf893('0x48')](handleError(_0x29e334,null));};exports[_0xf893('0x56')]=function(_0x4df12f,_0x374260){var _0x59e3be={'where':{'id':_0x4df12f[_0xf893('0x4a')]['id']}},_0x7d0bfe={};_0x7d0bfe[_0xf893('0x3a')]=_[_0xf893('0x4b')](db['Dashboard']['rawAttributes']);_0x59e3be[_0xf893('0x39')]=_[_0xf893('0x38')](_0x7d0bfe[_0xf893('0x3a')],qs[_0xf893('0x3b')](_0x4df12f[_0xf893('0x37')][_0xf893('0x3b')]));_0x59e3be[_0xf893('0x39')]=_0x59e3be[_0xf893('0x39')][_0xf893('0x4c')]?_0x59e3be['attributes']:_0x7d0bfe[_0xf893('0x3a')];if(_0x4df12f['query']['includeAll']){_0x59e3be['include']=[{'all':!![]}];}_0x59e3be=_[_0xf893('0x44')]({},_0x59e3be,_0x4df12f[_0xf893('0x46')]);return db[_0xf893('0x33')]['find'](_0x59e3be)[_0xf893('0x2b')](handleEntityNotFound(_0x374260,null))['then'](function(_0x11159f){if(_0x11159f){var _0x42c582=_0x11159f[_0xf893('0x2c')]({'plain':!![]});_0x42c582=qs[_0xf893('0x57')](_0x42c582,['id',_0xf893('0x58'),'updatedAt']);_0x4df12f[_0xf893('0x59')]=_[_0xf893('0x57')](_0x4df12f[_0xf893('0x59')],['id',_0xf893('0x58'),_0xf893('0x5a')]);return db[_0xf893('0x33')][_0xf893('0x4f')](_[_0xf893('0x44')](_0x42c582,_0x4df12f[_0xf893('0x59')]),{'include':_0x4df12f['query']['includeAll']?[{'all':!![]}]:undefined})[_0xf893('0x2b')](function(_0x4b27b5){var _0x54d6f2=_0x4df12f['user'][_0xf893('0x2c')]({'plain':!![]});if(!_0x54d6f2)throw new Error(_0xf893('0x51'));if(_0x54d6f2[_0xf893('0x5b')]===_0xf893('0x50')){var _0x531f64=_0x4b27b5[_0xf893('0x2c')]({'plain':!![]});var _0x488ac9=_0xf893('0x2d');return db[_0xf893('0x52')][_0xf893('0x4e')]({'where':{'name':_0x488ac9,'userProfileId':_0x54d6f2[_0xf893('0x53')]},'raw':!![]})[_0xf893('0x2b')](function(_0x550a4c){if(_0x550a4c&&_0x550a4c[_0xf893('0x54')]===0x0){return db[_0xf893('0x2e')][_0xf893('0x4f')]({'name':_0x531f64['name'],'resourceId':_0x531f64['id'],'type':_0x550a4c[_0xf893('0x30')],'sectionId':_0x550a4c['id']},{})[_0xf893('0x2b')](function(){return _0x4b27b5;});}else{return _0x4b27b5;}})['catch'](function(_0x3ec9f5){logger[_0xf893('0x2f')](_0xf893('0x55'),_0x3ec9f5);throw _0x3ec9f5;});}return _0x4b27b5;});}})[_0xf893('0x2b')](respondWithResult(_0x374260,0xc9))[_0xf893('0x48')](handleError(_0x374260,null));};exports[_0xf893('0x29')]=function(_0x28c442,_0x463ff9){if(_0x28c442[_0xf893('0x59')]['id']){delete _0x28c442['body']['id'];}return db[_0xf893('0x33')]['find']({'where':{'id':_0x28c442[_0xf893('0x4a')]['id']}})[_0xf893('0x2b')](handleEntityNotFound(_0x463ff9,null))['then'](saveUpdates(_0x28c442[_0xf893('0x59')],null))['then'](respondWithResult(_0x463ff9,null))[_0xf893('0x48')](handleError(_0x463ff9,null));};exports[_0xf893('0x2a')]=function(_0x318ed6,_0xb1f3a6){return db[_0xf893('0x33')][_0xf893('0x4e')]({'where':{'id':_0x318ed6[_0xf893('0x4a')]['id']}})[_0xf893('0x2b')](handleEntityNotFound(_0xb1f3a6,null))[_0xf893('0x2b')](removeEntity(_0xb1f3a6,null))['catch'](handleError(_0xb1f3a6,null));};function widgetAttributes(_0x538312){try{switch(_0x538312[_0xf893('0x35')]){case'iframe':return[{'name':'attrUrl','value':_0x538312[_0xf893('0x5c')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x0]?_0x538312[_0xf893('0x5d')][0x0][_0xf893('0x5e')]:undefined)||'https://'}];case'custom':return[{'name':_0xf893('0x5f'),'value':_0x538312[_0xf893('0x5f')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x0]?_0x538312[_0xf893('0x5d')][0x0][_0xf893('0x5e')]:undefined)||''}];case _0xf893('0x60'):return[{'name':_0xf893('0x61'),'value':_0x538312['attrHourFormat']||(_0x538312['attrs']&&_0x538312['attrs'][0x0]?_0x538312[_0xf893('0x5d')][0x0][_0xf893('0x5e')]:undefined)||_0xf893('0x62')},{'name':_0xf893('0x63'),'value':_0x538312[_0xf893('0x63')]||(_0x538312[_0xf893('0x5d')]&&_0x538312['attrs'][0x1]?_0x538312[_0xf893('0x5d')][0x1]['value']:undefined)||_0xf893('0x64')},{'name':_0xf893('0x65'),'value':_0x538312[_0xf893('0x65')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x2]?_0x538312[_0xf893('0x5d')][0x2][_0xf893('0x5e')]:undefined)||0xc}];case _0xf893('0x66'):return[{'name':_0xf893('0x67'),'value':_0x538312[_0xf893('0x67')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x0]?_0x538312[_0xf893('0x5d')][0x0][_0xf893('0x5e')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x538312['attrVoiceQueues']||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x1]?_0x538312[_0xf893('0x5d')][0x1][_0xf893('0x5e')]:undefined)||[]},{'name':_0xf893('0x65'),'value':_0x538312['attrFontSize']||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x2]?_0x538312[_0xf893('0x5d')][0x2][_0xf893('0x5e')]:undefined)||0x14},{'name':_0xf893('0x68'),'value':_0x538312['attrChannel']||(_0x538312['attrs']&&_0x538312['attrs'][0x3]?_0x538312[_0xf893('0x5d')][0x3][_0xf893('0x5e')]:undefined)||_0xf893('0x69')},{'name':_0xf893('0x6a'),'value':_0x538312[_0xf893('0x6a')]||(_0x538312['attrs']&&_0x538312['attrs'][0x4]?_0x538312[_0xf893('0x5d')][0x4]['value']:undefined)||''},{'name':_0xf893('0x6b'),'value':_0x538312[_0xf893('0x6b')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x5]?_0x538312[_0xf893('0x5d')][0x5]['value']:undefined)||''},{'name':_0xf893('0x6c'),'value':_0x538312[_0xf893('0x6c')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x6]?_0x538312['attrs'][0x6][_0xf893('0x5e')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x538312['attrOpenchannelAccounts']||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x7]?_0x538312[_0xf893('0x5d')][0x7][_0xf893('0x5e')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x538312[_0xf893('0x6d')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x8]?_0x538312[_0xf893('0x5d')][0x8][_0xf893('0x5e')]:undefined)||''},{'name':'attrChatWebsites','value':_0x538312['attrChatWebsites']||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x9]?_0x538312['attrs'][0x9][_0xf893('0x5e')]:undefined)||''}];case _0xf893('0x6e'):case'pie-chart':return[{'name':_0xf893('0x6f'),'value':_0x538312[_0xf893('0x6f')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x0]?_0x538312[_0xf893('0x5d')][0x0][_0xf893('0x5e')]:undefined)||'total'},{'name':'attrSerie2','value':_0x538312[_0xf893('0x70')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x1]?_0x538312[_0xf893('0x5d')][0x1][_0xf893('0x5e')]:undefined)||null},{'name':_0xf893('0x71'),'value':_0x538312[_0xf893('0x71')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x2]?_0x538312['attrs'][0x2][_0xf893('0x5e')]:undefined)||null},{'name':_0xf893('0x72'),'value':_0x538312[_0xf893('0x72')]||(_0x538312['attrs']&&_0x538312[_0xf893('0x5d')][0x3]?_0x538312[_0xf893('0x5d')][0x3]['value']:undefined)||[]},{'name':_0xf893('0x68'),'value':_0x538312[_0xf893('0x68')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x4]?_0x538312[_0xf893('0x5d')][0x4][_0xf893('0x5e')]:undefined)||_0xf893('0x69')},{'name':_0xf893('0x6a'),'value':_0x538312['attrEmailAccounts']||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x5]?_0x538312['attrs'][0x5][_0xf893('0x5e')]:undefined)||''},{'name':_0xf893('0x6b'),'value':_0x538312['attrFaxAccounts']||(_0x538312['attrs']&&_0x538312[_0xf893('0x5d')][0x6]?_0x538312[_0xf893('0x5d')][0x6][_0xf893('0x5e')]:undefined)||''},{'name':_0xf893('0x6c'),'value':_0x538312[_0xf893('0x6c')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x7]?_0x538312[_0xf893('0x5d')][0x7][_0xf893('0x5e')]:undefined)||''},{'name':_0xf893('0x73'),'value':_0x538312[_0xf893('0x73')]||(_0x538312[_0xf893('0x5d')]&&_0x538312['attrs'][0x8]?_0x538312['attrs'][0x8][_0xf893('0x5e')]:undefined)||''},{'name':_0xf893('0x6d'),'value':_0x538312[_0xf893('0x6d')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x9]?_0x538312[_0xf893('0x5d')][0x9][_0xf893('0x5e')]:undefined)||''},{'name':_0xf893('0x74'),'value':_0x538312[_0xf893('0x74')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0xa]?_0x538312[_0xf893('0x5d')][0xa][_0xf893('0x5e')]:undefined)||''}];case _0xf893('0x75'):return[{'name':_0xf893('0x76'),'type':_0x538312[_0xf893('0x77')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x0]?_0x538312['attrs'][0x0][_0xf893('0x35')]:undefined)||null,'value':_0x538312[_0xf893('0x76')]||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x0]?_0x538312['attrs'][0x0]['value']:undefined)||null},{'name':_0xf893('0x78'),'value':_0x538312['attrRefresh']||(_0x538312[_0xf893('0x5d')]&&_0x538312[_0xf893('0x5d')][0x1]?_0x538312[_0xf893('0x5d')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x394cdc){logger[_0xf893('0x2f')]('widgetAttributes:\x20%s',JSON[_0xf893('0x79')](_0x394cdc));return[];}}exports[_0xf893('0x7a')]=function(_0x59ab28,_0x3aca7d,_0x58d630){if(_0x59ab28[_0xf893('0x59')]['id']){delete _0x59ab28['body']['id'];}return db['Dashboard'][_0xf893('0x4e')]({'where':{'id':_0x59ab28[_0xf893('0x4a')]['id']}})[_0xf893('0x2b')](handleEntityNotFound(_0x3aca7d,null))['then'](function(_0x140491){if(_0x140491){_0x59ab28[_0xf893('0x59')]['DashboardId']=_0x140491['id'];_0x59ab28[_0xf893('0x59')][_0xf893('0x5d')]=widgetAttributes(_0x59ab28[_0xf893('0x59')]);return db['DashboardItem'][_0xf893('0x4f')](_0x59ab28['body']);}})[_0xf893('0x2b')](respondWithResult(_0x3aca7d,null))['catch'](handleError(_0x3aca7d,null));};exports[_0xf893('0x7b')]=function(_0x2f4a92,_0x42f7be,_0x39868d){var _0x2e1495={};var _0x29d01b={};var _0x411ae6;var _0x40a729;return db[_0xf893('0x33')][_0xf893('0x7c')]({'where':{'id':_0x2f4a92[_0xf893('0x4a')]['id']}})['then'](handleEntityNotFound(_0x42f7be,null))[_0xf893('0x2b')](function(_0xa35e23){if(_0xa35e23){_0x411ae6=_0xa35e23;_0x29d01b[_0xf893('0x3a')]=_[_0xf893('0x4b')](db[_0xf893('0x7d')][_0xf893('0x34')]);_0x29d01b[_0xf893('0x37')]=_[_0xf893('0x4b')](_0x2f4a92[_0xf893('0x37')]);_0x29d01b['filters']=_['intersection'](_0x29d01b[_0xf893('0x3a')],_0x29d01b[_0xf893('0x37')]);_0x2e1495[_0xf893('0x39')]=_['intersection'](_0x29d01b['model'],qs[_0xf893('0x3b')](_0x2f4a92[_0xf893('0x37')][_0xf893('0x3b')]));_0x2e1495[_0xf893('0x39')]=_0x2e1495[_0xf893('0x39')][_0xf893('0x4c')]?_0x2e1495['attributes']:_0x29d01b['model'];_0x2e1495['order']=qs[_0xf893('0x3f')](_0x2f4a92[_0xf893('0x37')][_0xf893('0x3f')]);_0x2e1495[_0xf893('0x40')]=qs[_0xf893('0x42')](_[_0xf893('0x41')](_0x2f4a92[_0xf893('0x37')],_0x29d01b[_0xf893('0x42')]));if(_0x2f4a92['query'][_0xf893('0x43')]){_0x2e1495[_0xf893('0x40')]=_[_0xf893('0x44')](_0x2e1495[_0xf893('0x40')],{'$or':_['map'](_0x2e1495[_0xf893('0x39')],function(_0x31b694){var _0x4c0030={};_0x4c0030[_0x31b694]={'$like':'%'+_0x2f4a92[_0xf893('0x37')]['filter']+'%'};return _0x4c0030;})});}_0x2e1495=_['merge']({},_0x2e1495,_0x2f4a92[_0xf893('0x46')]);return _0x411ae6['getItems'](_0x2e1495);}})['then'](function(_0x15dd13){if(_0x15dd13){_0x40a729=_0x15dd13[_0xf893('0x4c')];if(!_0x2f4a92[_0xf893('0x37')]['hasOwnProperty'](_0xf893('0x3d'))){_0x2e1495['limit']=qs[_0xf893('0x24')](_0x2f4a92['query'][_0xf893('0x24')]);_0x2e1495[_0xf893('0x26')]=qs['offset'](_0x2f4a92['query'][_0xf893('0x26')]);}return _0x411ae6[_0xf893('0x7b')](_0x2e1495);}})['then'](function(_0x2b1392){if(_0x2b1392){return _0x2b1392?{'count':_0x40a729,'rows':_0x2b1392}:null;}})['then'](respondWithResult(_0x42f7be,null))[_0xf893('0x48')](handleError(_0x42f7be,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 642f9bf..375d3d7 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 _0x92f4=['save','update','emit','hook','exports','../../mysqldb','Dashboard'];(function(_0x342231,_0x1618f3){var _0x32e1cd=function(_0x63a7d9){while(--_0x63a7d9){_0x342231['push'](_0x342231['shift']());}};_0x32e1cd(++_0x1618f3);}(_0x92f4,0x10f));var _0x492f=function(_0x3793a4,_0x18871a){_0x3793a4=_0x3793a4-0x0;var _0x2ab94f=_0x92f4[_0x3793a4];return _0x2ab94f;};'use strict';var EventEmitter=require('events');var Dashboard=require(_0x492f('0x0'))['db'][_0x492f('0x1')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x492f('0x2'),'afterUpdate':_0x492f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1a951a){return function(_0x5de633,_0x415caf,_0x264a66){DashboardEvents[_0x492f('0x4')](_0x1a951a+':'+_0x5de633['id'],_0x5de633);DashboardEvents['emit'](_0x1a951a,_0x5de633);_0x264a66(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x492f('0x5')](e,emitEvent(event));}}module[_0x492f('0x6')]=DashboardEvents; \ No newline at end of file +var _0x1e8e=['hasOwnProperty','events','../../mysqldb','Dashboard','setMaxListeners','save','update','remove','emit'];(function(_0x3b26af,_0x13e70a){var _0x43fe5d=function(_0x1b839d){while(--_0x1b839d){_0x3b26af['push'](_0x3b26af['shift']());}};_0x43fe5d(++_0x13e70a);}(_0x1e8e,0xeb));var _0xe1e8=function(_0x409012,_0x5bfea2){_0x409012=_0x409012-0x0;var _0x3ac007=_0x1e8e[_0x409012];return _0x3ac007;};'use strict';var EventEmitter=require(_0xe1e8('0x0'));var Dashboard=require(_0xe1e8('0x1'))['db'][_0xe1e8('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xe1e8('0x3')](0x0);var events={'afterCreate':_0xe1e8('0x4'),'afterUpdate':_0xe1e8('0x5'),'afterDestroy':_0xe1e8('0x6')};function emitEvent(_0xcdc654){return function(_0x347bd9,_0x4d9a2e,_0x5d60a0){DashboardEvents[_0xe1e8('0x7')](_0xcdc654+':'+_0x347bd9['id'],_0x347bd9);DashboardEvents[_0xe1e8('0x7')](_0xcdc654,_0x347bd9);_0x5d60a0(null);};}for(var e in events){if(events[_0xe1e8('0x8')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index fdf7456..7e9a6f8 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 _0xc4fb=['util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','dashboards','lodash'];(function(_0x482c27,_0x232507){var _0x539fff=function(_0x47de55){while(--_0x47de55){_0x482c27['push'](_0x482c27['shift']());}};_0x539fff(++_0x232507);}(_0xc4fb,0x12a));var _0xbc4f=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xc4fb[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xbc4f('0x0'));var util=require(_0xbc4f('0x1'));var logger=require(_0xbc4f('0x2'))('api');var moment=require(_0xbc4f('0x3'));var BPromise=require(_0xbc4f('0x4'));var rp=require(_0xbc4f('0x5'));var fs=require('fs');var path=require(_0xbc4f('0x6'));var rimraf=require('rimraf');var config=require(_0xbc4f('0x7'));var attributes=require(_0xbc4f('0x8'));module[_0xbc4f('0x9')]=function(_0x4f78ae,_0x4db060){return _0x4f78ae[_0xbc4f('0xa')](_0xbc4f('0xb'),attributes,{'tableName':_0xbc4f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b6c=['dashboards','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','./dashboard.attributes','exports'];(function(_0x153c40,_0x29ca39){var _0x28b579=function(_0x47ca22){while(--_0x47ca22){_0x153c40['push'](_0x153c40['shift']());}};_0x28b579(++_0x29ca39);}(_0x9b6c,0x135));var _0xc9b6=function(_0x253c9c,_0x5ee6b7){_0x253c9c=_0x253c9c-0x0;var _0x5b5e2f=_0x9b6c[_0x253c9c];return _0x5b5e2f;};'use strict';var _=require(_0xc9b6('0x0'));var util=require(_0xc9b6('0x1'));var logger=require('../../config/logger')(_0xc9b6('0x2'));var moment=require(_0xc9b6('0x3'));var BPromise=require(_0xc9b6('0x4'));var rp=require(_0xc9b6('0x5'));var fs=require('fs');var path=require(_0xc9b6('0x6'));var rimraf=require('rimraf');var config=require(_0xc9b6('0x7'));var attributes=require(_0xc9b6('0x8'));module[_0xc9b6('0x9')]=function(_0x5bd95f,_0x5db66b){return _0x5bd95f['define']('Dashboard',attributes,{'tableName':_0xc9b6('0xa'),'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 052185e..7cd0680 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 _0x4579=['rpc','../../config/environment','jayson/promise','http','redis','localhost','./dashboard.socket','register','request','then','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','error','code','Dashboard,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x4579,0x164));var _0x9457=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4579[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9457('0x0'));var util=require('util');var moment=require(_0x9457('0x1'));var BPromise=require(_0x9457('0x2'));var rs=require(_0x9457('0x3'));var fs=require('fs');var Redis=require(_0x9457('0x4'));var db=require(_0x9457('0x5'))['db'];var utils=require(_0x9457('0x6'));var logger=require(_0x9457('0x7'))(_0x9457('0x8'));var config=require(_0x9457('0x9'));var jayson=require(_0x9457('0xa'));var client=jayson['client'][_0x9457('0xb')]({'port':0x232a});config[_0x9457('0xc')]=_['defaults'](config[_0x9457('0xc')],{'host':_0x9457('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x9457('0xe'))[_0x9457('0xf')](socket);function respondWithRpcPromise(_0x2e6172,_0x254711,_0x4bf92c){return new BPromise(function(_0x228f2c,_0x3da939){return client[_0x9457('0x10')](_0x2e6172,_0x4bf92c)[_0x9457('0x11')](function(_0x48ceed){logger['info']('Dashboard,\x20%s,\x20%s',_0x254711,_0x9457('0x12'));logger[_0x9457('0x13')](_0x9457('0x14'),_0x254711,_0x9457('0x12'),JSON['stringify'](_0x48ceed));if(_0x48ceed[_0x9457('0x15')]){if(_0x48ceed[_0x9457('0x15')][_0x9457('0x16')]===0x1f4){logger[_0x9457('0x15')](_0x9457('0x17'),_0x254711,_0x48ceed['error'][_0x9457('0x18')]);return _0x3da939(_0x48ceed[_0x9457('0x15')]['message']);}logger[_0x9457('0x15')]('Dashboard,\x20%s,\x20%s',_0x254711,_0x48ceed[_0x9457('0x15')][_0x9457('0x18')]);return _0x228f2c(_0x48ceed[_0x9457('0x15')]['message']);}else{logger[_0x9457('0x19')]('Dashboard,\x20%s,\x20%s',_0x254711,_0x9457('0x12'));_0x228f2c(_0x48ceed[_0x9457('0x1a')][_0x9457('0x18')]);}})[_0x9457('0x1b')](function(_0x2a698d){logger[_0x9457('0x15')](_0x9457('0x17'),_0x254711,_0x2a698d);_0x3da939(_0x2a698d);});});} \ No newline at end of file +var _0x54d2=['then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','./dashboard.socket','register','request'];(function(_0x206f4b,_0x346117){var _0x20599c=function(_0x2f15b3){while(--_0x2f15b3){_0x206f4b['push'](_0x206f4b['shift']());}};_0x20599c(++_0x346117);}(_0x54d2,0x1de));var _0x254d=function(_0x4efc59,_0x33de52){_0x4efc59=_0x4efc59-0x0;var _0x351a49=_0x54d2[_0x4efc59];return _0x351a49;};'use strict';var _=require('lodash');var util=require(_0x254d('0x0'));var moment=require(_0x254d('0x1'));var BPromise=require(_0x254d('0x2'));var rs=require(_0x254d('0x3'));var fs=require('fs');var Redis=require(_0x254d('0x4'));var db=require(_0x254d('0x5'))['db'];var utils=require(_0x254d('0x6'));var logger=require('../../config/logger')(_0x254d('0x7'));var config=require(_0x254d('0x8'));var jayson=require(_0x254d('0x9'));var client=jayson[_0x254d('0xa')]['http']({'port':0x232a});config[_0x254d('0xb')]=_[_0x254d('0xc')](config[_0x254d('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x254d('0xb')]));require(_0x254d('0xd'))[_0x254d('0xe')](socket);function respondWithRpcPromise(_0x251a3b,_0x851add,_0x2b1a32){return new BPromise(function(_0x4afcad,_0x490c44){return client[_0x254d('0xf')](_0x251a3b,_0x2b1a32)[_0x254d('0x10')](function(_0x3fd69e){logger[_0x254d('0x11')](_0x254d('0x12'),_0x851add,_0x254d('0x13'));logger[_0x254d('0x14')](_0x254d('0x15'),_0x851add,_0x254d('0x13'),JSON[_0x254d('0x16')](_0x3fd69e));if(_0x3fd69e[_0x254d('0x17')]){if(_0x3fd69e[_0x254d('0x17')]['code']===0x1f4){logger['error']('Dashboard,\x20%s,\x20%s',_0x851add,_0x3fd69e['error'][_0x254d('0x18')]);return _0x490c44(_0x3fd69e[_0x254d('0x17')][_0x254d('0x18')]);}logger[_0x254d('0x17')]('Dashboard,\x20%s,\x20%s',_0x851add,_0x3fd69e['error'][_0x254d('0x18')]);return _0x4afcad(_0x3fd69e[_0x254d('0x17')]['message']);}else{logger[_0x254d('0x11')](_0x254d('0x12'),_0x851add,'request\x20sent');_0x4afcad(_0x3fd69e[_0x254d('0x19')][_0x254d('0x18')]);}})['catch'](function(_0xaebed2){logger[_0x254d('0x17')](_0x254d('0x12'),_0x851add,_0xaebed2);_0x490c44(_0xaebed2);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 6af3634..a04ae27 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 _0xdd1d=['remove','emit','removeListener','register','length','dashboard:'];(function(_0x5aaa66,_0x3522ab){var _0x19f48a=function(_0x16e595){while(--_0x16e595){_0x5aaa66['push'](_0x5aaa66['shift']());}};_0x19f48a(++_0x3522ab);}(_0xdd1d,0x150));var _0xddd1=function(_0x39a04c,_0x2b4002){_0x39a04c=_0x39a04c-0x0;var _0x580cb0=_0xdd1d[_0x39a04c];return _0x580cb0;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xddd1('0x0'),'update'];function createListener(_0x558f17,_0x589dab){return function(_0x26fc48){_0x589dab[_0xddd1('0x1')](_0x558f17,_0x26fc48);};}function removeListener(_0x566bbf,_0x592f8b){return function(){DashboardEvents[_0xddd1('0x2')](_0x566bbf,_0x592f8b);};}exports[_0xddd1('0x3')]=function(_0x484484){for(var _0x28193e=0x0,_0x5f431c=events[_0xddd1('0x4')];_0x28193e<_0x5f431c;_0x28193e++){var _0x3b4743=events[_0x28193e];var _0x213242=createListener(_0xddd1('0x5')+_0x3b4743,_0x484484);DashboardEvents['on'](_0x3b4743,_0x213242);}}; \ No newline at end of file +var _0x2af3=['./dashboard.events','save','remove','update','emit','register','length','dashboard:'];(function(_0x1dc9ae,_0x42127b){var _0x2789f1=function(_0x3e3b71){while(--_0x3e3b71){_0x1dc9ae['push'](_0x1dc9ae['shift']());}};_0x2789f1(++_0x42127b);}(_0x2af3,0x160));var _0x32af=function(_0x2ffdee,_0x42beea){_0x2ffdee=_0x2ffdee-0x0;var _0x5561b9=_0x2af3[_0x2ffdee];return _0x5561b9;};'use strict';var DashboardEvents=require(_0x32af('0x0'));var events=[_0x32af('0x1'),_0x32af('0x2'),_0x32af('0x3')];function createListener(_0x2ede1b,_0x10f496){return function(_0x4c7cf0){_0x10f496[_0x32af('0x4')](_0x2ede1b,_0x4c7cf0);};}function removeListener(_0x412997,_0x178569){return function(){DashboardEvents['removeListener'](_0x412997,_0x178569);};}exports[_0x32af('0x5')]=function(_0x19a9e8){for(var _0x4eeb2b=0x0,_0xee01c6=events[_0x32af('0x6')];_0x4eeb2b<_0xee01c6;_0x4eeb2b++){var _0xb3d2e0=events[_0x4eeb2b];var _0xb725ce=createListener(_0x32af('0x7')+_0xb3d2e0,_0x19a9e8);DashboardEvents['on'](_0xb3d2e0,_0xb725ce);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 4c7bc2e..b1b4f75 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 _0x8341=['post','clone','addItem','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','isAuthenticated','show','/:id/items','getItems','create'];(function(_0x27bf3b,_0x353051){var _0x417ff7=function(_0x417989){while(--_0x417989){_0x27bf3b['push'](_0x27bf3b['shift']());}};_0x417ff7(++_0x353051);}(_0x8341,0x1e9));var _0x1834=function(_0x3d491e,_0x5c5126){_0x3d491e=_0x3d491e-0x0;var _0x29ab5c=_0x8341[_0x3d491e];return _0x29ab5c;};'use strict';var multer=require(_0x1834('0x0'));var util=require('util');var path=require(_0x1834('0x1'));var timeout=require(_0x1834('0x2'));var express=require('express');var router=express[_0x1834('0x3')]();var fs_extra=require(_0x1834('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1834('0x5'));var config=require(_0x1834('0x6'));var controller=require(_0x1834('0x7'));router[_0x1834('0x8')]('/',auth['isAuthenticated'](),controller[_0x1834('0x9')]);router[_0x1834('0x8')]('/:id',auth[_0x1834('0xa')](),controller[_0x1834('0xb')]);router[_0x1834('0x8')](_0x1834('0xc'),auth[_0x1834('0xa')](),controller[_0x1834('0xd')]);router['post']('/',auth[_0x1834('0xa')](),controller[_0x1834('0xe')]);router[_0x1834('0xf')]('/:id/clone',auth[_0x1834('0xa')](),controller[_0x1834('0x10')]);router[_0x1834('0xf')](_0x1834('0xc'),auth[_0x1834('0xa')](),controller[_0x1834('0x11')]);router[_0x1834('0x12')](_0x1834('0x13'),auth[_0x1834('0xa')](),controller[_0x1834('0x14')]);router[_0x1834('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x1834('0x16')]);module[_0x1834('0x17')]=router; \ No newline at end of file +var _0xbe2c=['update','delete','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','isAuthenticated','index','get','/:id','/:id/items','post','create','/:id/clone','clone','addItem','put'];(function(_0x56cc28,_0x4a921e){var _0x1f5798=function(_0x45f7a5){while(--_0x45f7a5){_0x56cc28['push'](_0x56cc28['shift']());}};_0x1f5798(++_0x4a921e);}(_0xbe2c,0x1e6));var _0xcbe2=function(_0x54add2,_0x879789){_0x54add2=_0x54add2-0x0;var _0x178bda=_0xbe2c[_0x54add2];return _0x178bda;};'use strict';var multer=require('multer');var util=require(_0xcbe2('0x0'));var path=require(_0xcbe2('0x1'));var timeout=require(_0xcbe2('0x2'));var express=require(_0xcbe2('0x3'));var router=express['Router']();var fs_extra=require(_0xcbe2('0x4'));var auth=require(_0xcbe2('0x5'));var interaction=require(_0xcbe2('0x6'));var config=require(_0xcbe2('0x7'));var controller=require(_0xcbe2('0x8'));router['get']('/',auth[_0xcbe2('0x9')](),controller[_0xcbe2('0xa')]);router[_0xcbe2('0xb')](_0xcbe2('0xc'),auth[_0xcbe2('0x9')](),controller['show']);router[_0xcbe2('0xb')](_0xcbe2('0xd'),auth[_0xcbe2('0x9')](),controller['getItems']);router[_0xcbe2('0xe')]('/',auth[_0xcbe2('0x9')](),controller[_0xcbe2('0xf')]);router['post'](_0xcbe2('0x10'),auth[_0xcbe2('0x9')](),controller[_0xcbe2('0x11')]);router[_0xcbe2('0xe')](_0xcbe2('0xd'),auth['isAuthenticated'](),controller[_0xcbe2('0x12')]);router[_0xcbe2('0x13')]('/:id',auth[_0xcbe2('0x9')](),controller[_0xcbe2('0x14')]);router[_0xcbe2('0x15')](_0xcbe2('0xc'),auth[_0xcbe2('0x9')](),controller['destroy']);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 7da1f67..6b4dbe1 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 _0xafc4=['TEXT','long','setDataValue','attrs','stringify','INTEGER','sequelize','lodash','STRING'];(function(_0x492492,_0x4380cc){var _0x558059=function(_0x493b8c){while(--_0x493b8c){_0x492492['push'](_0x492492['shift']());}};_0x558059(++_0x4380cc);}(_0xafc4,0x69));var _0x4afc=function(_0x361e17,_0x29c1f1){_0x361e17=_0x361e17-0x0;var _0xda8154=_0xafc4[_0x361e17];return _0xda8154;};'use strict';var Sequelize=require(_0x4afc('0x0'));var squel=require('squel');var _=require(_0x4afc('0x1'));module['exports']={'title':{'type':Sequelize[_0x4afc('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4afc('0x2')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x4afc('0x3')](_0x4afc('0x4')),'get':function(){try{return JSON['parse'](this['getDataValue']('attrs'));}catch(_0x36cb50){return[];}},'set':function(_0x471d45){try{this[_0x4afc('0x5')](_0x4afc('0x6'),JSON[_0x4afc('0x7')](_0x471d45));}catch(_0xaf053d){this['setDataValue'](_0x4afc('0x6'),JSON[_0x4afc('0x7')]([]));}}},'sizeX':{'type':Sequelize[_0x4afc('0x8')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x4afc('0x8')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x4afc('0x8')]},'col':{'type':Sequelize[_0x4afc('0x8')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x4afc('0x2')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x4afc('0x2')]},'titleFontSize':{'type':Sequelize[_0x4afc('0x8')],'defaultValue':0xc}}; \ No newline at end of file +var _0x2eb2=['STRING','TEXT','parse','setDataValue','attrs','stringify','INTEGER','#2196f3','squel','lodash','exports'];(function(_0x257e22,_0x517acf){var _0x195f6e=function(_0x5a47d7){while(--_0x5a47d7){_0x257e22['push'](_0x257e22['shift']());}};_0x195f6e(++_0x517acf);}(_0x2eb2,0x19f));var _0x22eb=function(_0x5e36d1,_0x471178){_0x5e36d1=_0x5e36d1-0x0;var _0x950b9e=_0x2eb2[_0x5e36d1];return _0x950b9e;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x22eb('0x0'));var _=require(_0x22eb('0x1'));module[_0x22eb('0x2')]={'title':{'type':Sequelize[_0x22eb('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x22eb('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x22eb('0x4')]('long'),'get':function(){try{return JSON[_0x22eb('0x5')](this['getDataValue']('attrs'));}catch(_0x1dfef7){return[];}},'set':function(_0x10e116){try{this[_0x22eb('0x6')](_0x22eb('0x7'),JSON[_0x22eb('0x8')](_0x10e116));}catch(_0x396806){this[_0x22eb('0x6')](_0x22eb('0x7'),JSON[_0x22eb('0x8')]([]));}}},'sizeX':{'type':Sequelize[_0x22eb('0x9')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x22eb('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x22eb('0x9')]},'col':{'type':Sequelize['INTEGER']},'background':{'type':Sequelize[_0x22eb('0x3')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x22eb('0xa'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize['STRING']},'titleFontSize':{'type':Sequelize[_0x22eb('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 189c98e..fad88fa 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 _0x4819=['attrWhatsappAccounts','attrChatWebsites','attrSerie1','attrSerie3','web-report','attrReport','attrRefresh','stringify','create','body','update','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','show','params','model','keys','filters','query','attributes','intersection','fields','length','includeAll','include','options','find','catch','DashboardItem','type','iframe','attrUrl','attrs','https://','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts'];(function(_0x402f6e,_0x30d2df){var _0x31a8dc=function(_0x594553){while(--_0x594553){_0x402f6e['push'](_0x402f6e['shift']());}};_0x31a8dc(++_0x30d2df);}(_0x4819,0xcd));var _0x9481=function(_0x83ee0a,_0x44947d){_0x83ee0a=_0x83ee0a-0x0;var _0x5dc29f=_0x4819[_0x83ee0a];return _0x5dc29f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];config[_0x9481('0x1a')]=_['defaults'](config['redis'],{'host':_0x9481('0x1b'),'port':0x18eb});var socket=require(_0x9481('0x1c'))(new Redis(config[_0x9481('0x1a')]));require(_0x9481('0x1d'))[_0x9481('0x1e')](socket);function respondWithStatusCode(_0xc7a0b5,_0x3fb97f){_0x3fb97f=_0x3fb97f||0xcc;return function(_0x495b30){if(_0x495b30){return _0xc7a0b5[_0x9481('0x1f')](_0x3fb97f);}return _0xc7a0b5[_0x9481('0x20')](_0x3fb97f)['end']();};}function respondWithResult(_0x2266d5,_0x518150){_0x518150=_0x518150||0xc8;return function(_0x34108d){if(_0x34108d){return _0x2266d5[_0x9481('0x20')](_0x518150)[_0x9481('0x21')](_0x34108d);}};}function respondWithFilteredResult(_0x2bb2a4,_0x546fce){return function(_0x5eda66){if(_0x5eda66){var _0x20473d=typeof _0x546fce['offset']==='undefined'&&typeof _0x546fce[_0x9481('0x22')]===_0x9481('0x23');var _0x18c6f5=_0x5eda66[_0x9481('0x24')];var _0x7000e7=_0x20473d?0x0:_0x546fce[_0x9481('0x25')];var _0x55a1bd=_0x20473d?_0x5eda66[_0x9481('0x24')]:_0x546fce[_0x9481('0x25')]+_0x546fce[_0x9481('0x22')];var _0x615e02;if(_0x55a1bd>=_0x18c6f5){_0x55a1bd=_0x18c6f5;_0x615e02=0xc8;}else{_0x615e02=0xce;}_0x2bb2a4[_0x9481('0x20')](_0x615e02);return _0x2bb2a4['set'](_0x9481('0x26'),_0x7000e7+'-'+_0x55a1bd+'/'+_0x18c6f5)[_0x9481('0x21')](_0x5eda66);}return null;};}function patchUpdates(_0x572599){return function(_0x2bcf37){try{jsonpatch[_0x9481('0x27')](_0x2bcf37,_0x572599,!![]);}catch(_0x352b3a){return BPromise[_0x9481('0x28')](_0x352b3a);}return _0x2bcf37[_0x9481('0x29')]();};}function saveUpdates(_0x49ecfa,_0x91e3d9){return function(_0x22f0b5){if(_0x22f0b5){return _0x22f0b5['update'](_0x49ecfa)['then'](function(_0x12b0c3){return _0x12b0c3;});}return null;};}function removeEntity(_0x299e28,_0x550fce){return function(_0x1e6f28){if(_0x1e6f28){return _0x1e6f28[_0x9481('0x2a')]()[_0x9481('0x2b')](function(){_0x299e28[_0x9481('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14f03e,_0x3ca064){return function(_0x3c2585){if(!_0x3c2585){_0x14f03e['sendStatus'](0x194);}return _0x3c2585;};}function handleError(_0x1791b2,_0x56e944){_0x56e944=_0x56e944||0x1f4;return function(_0x2e1eff){logger[_0x9481('0x2c')](_0x2e1eff[_0x9481('0x2d')]);if(_0x2e1eff[_0x9481('0x2e')]){delete _0x2e1eff[_0x9481('0x2e')];}_0x1791b2['status'](_0x56e944)[_0x9481('0x2f')](_0x2e1eff);};}exports[_0x9481('0x30')]=function(_0x46e4ab,_0x4895a0){var _0x56752e={'raw':![],'where':{'id':_0x46e4ab[_0x9481('0x31')]['id']}},_0x1addc8={};_0x1addc8[_0x9481('0x32')]=_[_0x9481('0x33')](db['DashboardItem']['rawAttributes']);_0x1addc8['query']=_[_0x9481('0x33')](_0x46e4ab['query']);_0x1addc8[_0x9481('0x34')]=_['intersection'](_0x1addc8[_0x9481('0x32')],_0x1addc8[_0x9481('0x35')]);_0x56752e[_0x9481('0x36')]=_[_0x9481('0x37')](_0x1addc8[_0x9481('0x32')],qs['fields'](_0x46e4ab[_0x9481('0x35')][_0x9481('0x38')]));_0x56752e[_0x9481('0x36')]=_0x56752e['attributes'][_0x9481('0x39')]?_0x56752e[_0x9481('0x36')]:_0x1addc8[_0x9481('0x32')];if(_0x46e4ab[_0x9481('0x35')][_0x9481('0x3a')]){_0x56752e[_0x9481('0x3b')]=[{'all':!![]}];}_0x56752e=_['merge']({},_0x56752e,_0x46e4ab[_0x9481('0x3c')]);return db['DashboardItem'][_0x9481('0x3d')](_0x56752e)[_0x9481('0x2b')](handleEntityNotFound(_0x4895a0,null))[_0x9481('0x2b')](respondWithResult(_0x4895a0,null))[_0x9481('0x3e')](handleError(_0x4895a0,null));};exports[_0x9481('0x2a')]=function(_0x2face9,_0x541d8b){return db[_0x9481('0x3f')][_0x9481('0x3d')]({'where':{'id':_0x2face9['params']['id']}})['then'](handleEntityNotFound(_0x541d8b,null))[_0x9481('0x2b')](removeEntity(_0x541d8b,null))['catch'](handleError(_0x541d8b,null));};function widgetAttributes(_0x224b88){try{switch(_0x224b88[_0x9481('0x40')]){case _0x9481('0x41'):return[{'name':_0x9481('0x42'),'value':_0x224b88['attrUrl']||(_0x224b88[_0x9481('0x43')]&&_0x224b88['attrs'][0x0]?_0x224b88[_0x9481('0x43')][0x0]['value']:undefined)||_0x9481('0x44')}];case'custom':return[{'name':_0x9481('0x45'),'value':_0x224b88[_0x9481('0x45')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x0]?_0x224b88[_0x9481('0x43')][0x0][_0x9481('0x46')]:undefined)||''}];case _0x9481('0x47'):return[{'name':'attrHourFormat','value':_0x224b88[_0x9481('0x48')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x0]?_0x224b88[_0x9481('0x43')][0x0][_0x9481('0x46')]:undefined)||_0x9481('0x49')},{'name':_0x9481('0x4a'),'value':_0x224b88['attrTimezone']||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x1]?_0x224b88['attrs'][0x1][_0x9481('0x46')]:undefined)||_0x9481('0x4b')},{'name':_0x9481('0x4c'),'value':_0x224b88[_0x9481('0x4c')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88['attrs'][0x2]?_0x224b88[_0x9481('0x43')][0x2]['value']:undefined)||0xc}];case _0x9481('0x4d'):return[{'name':_0x9481('0x4e'),'value':_0x224b88['attrMetric']||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0x0]?_0x224b88[_0x9481('0x43')][0x0][_0x9481('0x46')]:undefined)||'total'},{'name':_0x9481('0x4f'),'value':_0x224b88[_0x9481('0x4f')]||(_0x224b88['attrs']&&_0x224b88['attrs'][0x1]?_0x224b88[_0x9481('0x43')][0x1]['value']:undefined)||[]},{'name':_0x9481('0x4c'),'value':_0x224b88[_0x9481('0x4c')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x2]?_0x224b88[_0x9481('0x43')][0x2]['value']:undefined)||0x14},{'name':_0x9481('0x50'),'value':_0x224b88[_0x9481('0x50')]||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0x3]?_0x224b88[_0x9481('0x43')][0x3][_0x9481('0x46')]:undefined)||_0x9481('0x51')},{'name':_0x9481('0x52'),'value':_0x224b88[_0x9481('0x52')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x4]?_0x224b88[_0x9481('0x43')][0x4]['value']:undefined)||''},{'name':_0x9481('0x53'),'value':_0x224b88['attrFaxAccounts']||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0x5]?_0x224b88['attrs'][0x5][_0x9481('0x46')]:undefined)||''},{'name':_0x9481('0x54'),'value':_0x224b88['attrSmsAccounts']||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x6]?_0x224b88[_0x9481('0x43')][0x6][_0x9481('0x46')]:undefined)||''},{'name':_0x9481('0x55'),'value':_0x224b88[_0x9481('0x55')]||(_0x224b88['attrs']&&_0x224b88['attrs'][0x7]?_0x224b88[_0x9481('0x43')][0x7][_0x9481('0x46')]:undefined)||''},{'name':_0x9481('0x56'),'value':_0x224b88[_0x9481('0x56')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x8]?_0x224b88[_0x9481('0x43')][0x8][_0x9481('0x46')]:undefined)||''},{'name':'attrChatWebsites','value':_0x224b88[_0x9481('0x57')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x9]?_0x224b88[_0x9481('0x43')][0x9][_0x9481('0x46')]:undefined)||''}];case'multibar-chart':case'pie-chart':return[{'name':_0x9481('0x58'),'value':_0x224b88[_0x9481('0x58')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88['attrs'][0x0]?_0x224b88['attrs'][0x0]['value']:undefined)||'total'},{'name':'attrSerie2','value':_0x224b88['attrSerie2']||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0x1]?_0x224b88[_0x9481('0x43')][0x1]['value']:undefined)||null},{'name':_0x9481('0x59'),'value':_0x224b88['attrSerie3']||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x2]?_0x224b88[_0x9481('0x43')][0x2][_0x9481('0x46')]:undefined)||null},{'name':_0x9481('0x4f'),'value':_0x224b88[_0x9481('0x4f')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88['attrs'][0x3]?_0x224b88[_0x9481('0x43')][0x3][_0x9481('0x46')]:undefined)||[]},{'name':'attrChannel','value':_0x224b88[_0x9481('0x50')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x4]?_0x224b88[_0x9481('0x43')][0x4][_0x9481('0x46')]:undefined)||'voice'},{'name':_0x9481('0x52'),'value':_0x224b88[_0x9481('0x52')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x5]?_0x224b88[_0x9481('0x43')][0x5][_0x9481('0x46')]:undefined)||''},{'name':_0x9481('0x53'),'value':_0x224b88[_0x9481('0x53')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88['attrs'][0x6]?_0x224b88['attrs'][0x6]['value']:undefined)||''},{'name':_0x9481('0x54'),'value':_0x224b88[_0x9481('0x54')]||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0x7]?_0x224b88[_0x9481('0x43')][0x7][_0x9481('0x46')]:undefined)||''},{'name':_0x9481('0x55'),'value':_0x224b88[_0x9481('0x55')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88['attrs'][0x8]?_0x224b88['attrs'][0x8][_0x9481('0x46')]:undefined)||''},{'name':_0x9481('0x56'),'value':_0x224b88[_0x9481('0x56')]||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x9]?_0x224b88[_0x9481('0x43')][0x9]['value']:undefined)||''},{'name':'attrChatWebsites','value':_0x224b88[_0x9481('0x57')]||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0xa]?_0x224b88['attrs'][0xa][_0x9481('0x46')]:undefined)||''}];case _0x9481('0x5a'):return[{'name':_0x9481('0x5b'),'type':_0x224b88['reportType']||(_0x224b88[_0x9481('0x43')]&&_0x224b88[_0x9481('0x43')][0x0]?_0x224b88['attrs'][0x0]['type']:undefined)||null,'value':_0x224b88['attrReport']||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0x0]?_0x224b88['attrs'][0x0][_0x9481('0x46')]:undefined)||null},{'name':_0x9481('0x5c'),'value':_0x224b88[_0x9481('0x5c')]||(_0x224b88['attrs']&&_0x224b88[_0x9481('0x43')][0x1]?_0x224b88['attrs'][0x1][_0x9481('0x46')]:undefined)||0x0}];default:return[];}}catch(_0xdf1bd9){logger[_0x9481('0x2c')]('widgetAttributes:\x20%s',JSON[_0x9481('0x5d')](_0xdf1bd9));return[];}}exports[_0x9481('0x5e')]=function(_0x4ff016,_0x321972){if(_0x4ff016[_0x9481('0x5f')]){_0x4ff016[_0x9481('0x5f')][_0x9481('0x43')]=widgetAttributes(_0x4ff016[_0x9481('0x5f')]);}return db[_0x9481('0x3f')][_0x9481('0x5e')](_0x4ff016[_0x9481('0x5f')],{})[_0x9481('0x2b')](respondWithResult(_0x321972,0xc9))[_0x9481('0x3e')](handleError(_0x321972,null));};exports[_0x9481('0x60')]=function(_0xc9a414,_0x3daaff){if(_0xc9a414[_0x9481('0x5f')]['id']){delete _0xc9a414[_0x9481('0x5f')]['id'];}_0xc9a414[_0x9481('0x5f')][_0x9481('0x43')]=widgetAttributes(_0xc9a414['body']);return db[_0x9481('0x3f')]['find']({'where':{'id':_0xc9a414['params']['id']}})[_0x9481('0x2b')](handleEntityNotFound(_0x3daaff,null))['then'](saveUpdates(_0xc9a414['body'],null))['then'](respondWithResult(_0x3daaff,null))[_0x9481('0x3e')](handleError(_0x3daaff,null));}; \ No newline at end of file +var _0xbe52=['sendStatus','error','name','send','show','params','model','DashboardItem','rawAttributes','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','catch','find','type','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','attrChannel','voice','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','total','attrSerie2','attrEmailAccounts','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./dashboardItem.socket','register','end','status','json','undefined','limit','count','offset','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x4b6133,_0x37cce8){var _0x4185fb=function(_0x45bdfd){while(--_0x45bdfd){_0x4b6133['push'](_0x4b6133['shift']());}};_0x4185fb(++_0x37cce8);}(_0xbe52,0x164));var _0x2be5=function(_0x49b47a,_0x4ee998){_0x49b47a=_0x49b47a-0x0;var _0x30a84a=_0xbe52[_0x49b47a];return _0x30a84a;};'use strict';var emlformat=require(_0x2be5('0x0'));var rimraf=require(_0x2be5('0x1'));var zipdir=require(_0x2be5('0x2'));var jsonpatch=require(_0x2be5('0x3'));var rp=require(_0x2be5('0x4'));var moment=require('moment');var BPromise=require(_0x2be5('0x5'));var Mustache=require(_0x2be5('0x6'));var util=require(_0x2be5('0x7'));var path=require(_0x2be5('0x8'));var sox=require(_0x2be5('0x9'));var csv=require(_0x2be5('0xa'));var ejs=require(_0x2be5('0xb'));var fs=require('fs');var fs_extra=require(_0x2be5('0xc'));var _=require(_0x2be5('0xd'));var squel=require(_0x2be5('0xe'));var crypto=require(_0x2be5('0xf'));var jsforce=require(_0x2be5('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x2be5('0xa'));var querystring=require(_0x2be5('0x11'));var Papa=require(_0x2be5('0x12'));var Redis=require('ioredis');var authService=require(_0x2be5('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2be5('0x14'));var logger=require(_0x2be5('0x15'))(_0x2be5('0x16'));var utils=require(_0x2be5('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x2be5('0x18'));var db=require(_0x2be5('0x19'))['db'];config['redis']=_['defaults'](config[_0x2be5('0x1a')],{'host':_0x2be5('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2be5('0x1a')]));require(_0x2be5('0x1c'))[_0x2be5('0x1d')](socket);function respondWithStatusCode(_0x71834e,_0x38fc4b){_0x38fc4b=_0x38fc4b||0xcc;return function(_0x17737d){if(_0x17737d){return _0x71834e['sendStatus'](_0x38fc4b);}return _0x71834e['status'](_0x38fc4b)[_0x2be5('0x1e')]();};}function respondWithResult(_0x5e6f16,_0x1ae512){_0x1ae512=_0x1ae512||0xc8;return function(_0x577ca4){if(_0x577ca4){return _0x5e6f16[_0x2be5('0x1f')](_0x1ae512)[_0x2be5('0x20')](_0x577ca4);}};}function respondWithFilteredResult(_0x35db37,_0x5c6a02){return function(_0x8ea605){if(_0x8ea605){var _0x32fe0d=typeof _0x5c6a02['offset']===_0x2be5('0x21')&&typeof _0x5c6a02[_0x2be5('0x22')]===_0x2be5('0x21');var _0x1bffbf=_0x8ea605[_0x2be5('0x23')];var _0x22d7c2=_0x32fe0d?0x0:_0x5c6a02[_0x2be5('0x24')];var _0x53749d=_0x32fe0d?_0x8ea605['count']:_0x5c6a02[_0x2be5('0x24')]+_0x5c6a02[_0x2be5('0x22')];var _0x1bafd2;if(_0x53749d>=_0x1bffbf){_0x53749d=_0x1bffbf;_0x1bafd2=0xc8;}else{_0x1bafd2=0xce;}_0x35db37[_0x2be5('0x1f')](_0x1bafd2);return _0x35db37['set'](_0x2be5('0x25'),_0x22d7c2+'-'+_0x53749d+'/'+_0x1bffbf)[_0x2be5('0x20')](_0x8ea605);}return null;};}function patchUpdates(_0x2bbe9f){return function(_0x1f6c50){try{jsonpatch[_0x2be5('0x26')](_0x1f6c50,_0x2bbe9f,!![]);}catch(_0x3f78d4){return BPromise[_0x2be5('0x27')](_0x3f78d4);}return _0x1f6c50[_0x2be5('0x28')]();};}function saveUpdates(_0x3f4430,_0x3e63ab){return function(_0x5e9cb0){if(_0x5e9cb0){return _0x5e9cb0[_0x2be5('0x29')](_0x3f4430)[_0x2be5('0x2a')](function(_0x323c2d){return _0x323c2d;});}return null;};}function removeEntity(_0x4d3aee,_0x25c47c){return function(_0x319ed6){if(_0x319ed6){return _0x319ed6[_0x2be5('0x2b')]()[_0x2be5('0x2a')](function(){_0x4d3aee[_0x2be5('0x1f')](0xcc)[_0x2be5('0x1e')]();});}};}function handleEntityNotFound(_0x4bdbad,_0x228edd){return function(_0x1cfbd7){if(!_0x1cfbd7){_0x4bdbad[_0x2be5('0x2c')](0x194);}return _0x1cfbd7;};}function handleError(_0x329928,_0xa83c58){_0xa83c58=_0xa83c58||0x1f4;return function(_0x28c6bb){logger[_0x2be5('0x2d')](_0x28c6bb['stack']);if(_0x28c6bb[_0x2be5('0x2e')]){delete _0x28c6bb[_0x2be5('0x2e')];}_0x329928[_0x2be5('0x1f')](_0xa83c58)[_0x2be5('0x2f')](_0x28c6bb);};}exports[_0x2be5('0x30')]=function(_0x3817a7,_0x16afa0){var _0x4ca5a2={'raw':![],'where':{'id':_0x3817a7[_0x2be5('0x31')]['id']}},_0xf58441={};_0xf58441[_0x2be5('0x32')]=_['keys'](db[_0x2be5('0x33')][_0x2be5('0x34')]);_0xf58441['query']=_[_0x2be5('0x35')](_0x3817a7[_0x2be5('0x36')]);_0xf58441[_0x2be5('0x37')]=_[_0x2be5('0x38')](_0xf58441['model'],_0xf58441[_0x2be5('0x36')]);_0x4ca5a2[_0x2be5('0x39')]=_[_0x2be5('0x38')](_0xf58441['model'],qs['fields'](_0x3817a7[_0x2be5('0x36')][_0x2be5('0x3a')]));_0x4ca5a2[_0x2be5('0x39')]=_0x4ca5a2[_0x2be5('0x39')][_0x2be5('0x3b')]?_0x4ca5a2[_0x2be5('0x39')]:_0xf58441['model'];if(_0x3817a7[_0x2be5('0x36')][_0x2be5('0x3c')]){_0x4ca5a2['include']=[{'all':!![]}];}_0x4ca5a2=_[_0x2be5('0x3d')]({},_0x4ca5a2,_0x3817a7[_0x2be5('0x3e')]);return db[_0x2be5('0x33')]['find'](_0x4ca5a2)['then'](handleEntityNotFound(_0x16afa0,null))[_0x2be5('0x2a')](respondWithResult(_0x16afa0,null))[_0x2be5('0x3f')](handleError(_0x16afa0,null));};exports[_0x2be5('0x2b')]=function(_0x1644be,_0x470f1d){return db[_0x2be5('0x33')][_0x2be5('0x40')]({'where':{'id':_0x1644be[_0x2be5('0x31')]['id']}})[_0x2be5('0x2a')](handleEntityNotFound(_0x470f1d,null))['then'](removeEntity(_0x470f1d,null))[_0x2be5('0x3f')](handleError(_0x470f1d,null));};function widgetAttributes(_0x36574c){try{switch(_0x36574c[_0x2be5('0x41')]){case'iframe':return[{'name':_0x2be5('0x42'),'value':_0x36574c[_0x2be5('0x42')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x0]?_0x36574c['attrs'][0x0][_0x2be5('0x44')]:undefined)||_0x2be5('0x45')}];case _0x2be5('0x46'):return[{'name':'attrPath','value':_0x36574c[_0x2be5('0x47')]||(_0x36574c['attrs']&&_0x36574c[_0x2be5('0x43')][0x0]?_0x36574c[_0x2be5('0x43')][0x0]['value']:undefined)||''}];case _0x2be5('0x48'):return[{'name':_0x2be5('0x49'),'value':_0x36574c[_0x2be5('0x49')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x0]?_0x36574c['attrs'][0x0][_0x2be5('0x44')]:undefined)||_0x2be5('0x4a')},{'name':_0x2be5('0x4b'),'value':_0x36574c[_0x2be5('0x4b')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x1]?_0x36574c[_0x2be5('0x43')][0x1]['value']:undefined)||_0x2be5('0x4c')},{'name':_0x2be5('0x4d'),'value':_0x36574c[_0x2be5('0x4d')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x2]?_0x36574c['attrs'][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x2be5('0x4e'),'value':_0x36574c['attrMetric']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x0]?_0x36574c[_0x2be5('0x43')][0x0][_0x2be5('0x44')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x36574c[_0x2be5('0x4f')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x1]?_0x36574c['attrs'][0x1]['value']:undefined)||[]},{'name':_0x2be5('0x4d'),'value':_0x36574c['attrFontSize']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x2]?_0x36574c['attrs'][0x2]['value']:undefined)||0x14},{'name':_0x2be5('0x50'),'value':_0x36574c[_0x2be5('0x50')]||(_0x36574c['attrs']&&_0x36574c[_0x2be5('0x43')][0x3]?_0x36574c[_0x2be5('0x43')][0x3][_0x2be5('0x44')]:undefined)||_0x2be5('0x51')},{'name':'attrEmailAccounts','value':_0x36574c['attrEmailAccounts']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x4]?_0x36574c[_0x2be5('0x43')][0x4][_0x2be5('0x44')]:undefined)||''},{'name':_0x2be5('0x52'),'value':_0x36574c['attrFaxAccounts']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x5]?_0x36574c[_0x2be5('0x43')][0x5][_0x2be5('0x44')]:undefined)||''},{'name':_0x2be5('0x53'),'value':_0x36574c[_0x2be5('0x53')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x6]?_0x36574c['attrs'][0x6][_0x2be5('0x44')]:undefined)||''},{'name':_0x2be5('0x54'),'value':_0x36574c[_0x2be5('0x54')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x7]?_0x36574c[_0x2be5('0x43')][0x7][_0x2be5('0x44')]:undefined)||''},{'name':_0x2be5('0x55'),'value':_0x36574c[_0x2be5('0x55')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x8]?_0x36574c[_0x2be5('0x43')][0x8]['value']:undefined)||''},{'name':_0x2be5('0x56'),'value':_0x36574c[_0x2be5('0x56')]||(_0x36574c['attrs']&&_0x36574c[_0x2be5('0x43')][0x9]?_0x36574c[_0x2be5('0x43')][0x9][_0x2be5('0x44')]:undefined)||''}];case _0x2be5('0x57'):case _0x2be5('0x58'):return[{'name':'attrSerie1','value':_0x36574c[_0x2be5('0x59')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x0]?_0x36574c[_0x2be5('0x43')][0x0][_0x2be5('0x44')]:undefined)||_0x2be5('0x5a')},{'name':_0x2be5('0x5b'),'value':_0x36574c[_0x2be5('0x5b')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x1]?_0x36574c[_0x2be5('0x43')][0x1][_0x2be5('0x44')]:undefined)||null},{'name':'attrSerie3','value':_0x36574c['attrSerie3']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x2]?_0x36574c[_0x2be5('0x43')][0x2][_0x2be5('0x44')]:undefined)||null},{'name':_0x2be5('0x4f'),'value':_0x36574c[_0x2be5('0x4f')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x3]?_0x36574c['attrs'][0x3][_0x2be5('0x44')]:undefined)||[]},{'name':_0x2be5('0x50'),'value':_0x36574c[_0x2be5('0x50')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x4]?_0x36574c[_0x2be5('0x43')][0x4][_0x2be5('0x44')]:undefined)||_0x2be5('0x51')},{'name':_0x2be5('0x5c'),'value':_0x36574c['attrEmailAccounts']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x5]?_0x36574c[_0x2be5('0x43')][0x5]['value']:undefined)||''},{'name':_0x2be5('0x52'),'value':_0x36574c[_0x2be5('0x52')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x6]?_0x36574c[_0x2be5('0x43')][0x6][_0x2be5('0x44')]:undefined)||''},{'name':_0x2be5('0x53'),'value':_0x36574c[_0x2be5('0x53')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x7]?_0x36574c[_0x2be5('0x43')][0x7][_0x2be5('0x44')]:undefined)||''},{'name':_0x2be5('0x54'),'value':_0x36574c['attrOpenchannelAccounts']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x8]?_0x36574c[_0x2be5('0x43')][0x8]['value']:undefined)||''},{'name':_0x2be5('0x55'),'value':_0x36574c['attrWhatsappAccounts']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c['attrs'][0x9]?_0x36574c[_0x2be5('0x43')][0x9][_0x2be5('0x44')]:undefined)||''},{'name':_0x2be5('0x56'),'value':_0x36574c[_0x2be5('0x56')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0xa]?_0x36574c[_0x2be5('0x43')][0xa][_0x2be5('0x44')]:undefined)||''}];case _0x2be5('0x5d'):return[{'name':_0x2be5('0x5e'),'type':_0x36574c['reportType']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x0]?_0x36574c[_0x2be5('0x43')][0x0][_0x2be5('0x41')]:undefined)||null,'value':_0x36574c['attrReport']||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x0]?_0x36574c[_0x2be5('0x43')][0x0][_0x2be5('0x44')]:undefined)||null},{'name':'attrRefresh','value':_0x36574c[_0x2be5('0x5f')]||(_0x36574c[_0x2be5('0x43')]&&_0x36574c[_0x2be5('0x43')][0x1]?_0x36574c['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x8b7d42){logger[_0x2be5('0x2d')](_0x2be5('0x60'),JSON[_0x2be5('0x61')](_0x8b7d42));return[];}}exports[_0x2be5('0x62')]=function(_0x437f4e,_0x2e4667){if(_0x437f4e[_0x2be5('0x63')]){_0x437f4e[_0x2be5('0x63')][_0x2be5('0x43')]=widgetAttributes(_0x437f4e[_0x2be5('0x63')]);}return db[_0x2be5('0x33')][_0x2be5('0x62')](_0x437f4e[_0x2be5('0x63')],{})[_0x2be5('0x2a')](respondWithResult(_0x2e4667,0xc9))['catch'](handleError(_0x2e4667,null));};exports[_0x2be5('0x29')]=function(_0x7952c4,_0x303e2c){if(_0x7952c4[_0x2be5('0x63')]['id']){delete _0x7952c4[_0x2be5('0x63')]['id'];}_0x7952c4['body'][_0x2be5('0x43')]=widgetAttributes(_0x7952c4['body']);return db[_0x2be5('0x33')][_0x2be5('0x40')]({'where':{'id':_0x7952c4[_0x2be5('0x31')]['id']}})[_0x2be5('0x2a')](handleEntityNotFound(_0x303e2c,null))[_0x2be5('0x2a')](saveUpdates(_0x7952c4['body'],null))[_0x2be5('0x2a')](respondWithResult(_0x303e2c,null))[_0x2be5('0x3f')](handleError(_0x303e2c,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index 4c2a4e3..417e6ac 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 _0x6e12=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','DashboardItem','update'];(function(_0x2ddd42,_0x39be46){var _0x189dc1=function(_0xab9aac){while(--_0xab9aac){_0x2ddd42['push'](_0x2ddd42['shift']());}};_0x189dc1(++_0x39be46);}(_0x6e12,0xac));var _0x26e1=function(_0x1b1db0,_0x2403da){_0x1b1db0=_0x1b1db0-0x0;var _0x5c5c32=_0x6e12[_0x1b1db0];return _0x5c5c32;};'use strict';var EventEmitter=require(_0x26e1('0x0'));var DashboardItem=require(_0x26e1('0x1'))['db'][_0x26e1('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x26e1('0x3'),'afterDestroy':_0x26e1('0x4')};function emitEvent(_0xdad967){return function(_0x332dd4,_0x4782ed,_0x4dd09c){DashboardItemEvents[_0x26e1('0x5')](_0xdad967+':'+_0x332dd4['id'],_0x332dd4);DashboardItemEvents[_0x26e1('0x5')](_0xdad967,_0x332dd4);_0x4dd09c(null);};}for(var e in events){if(events[_0x26e1('0x6')](e)){var event=events[e];DashboardItem[_0x26e1('0x7')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x00f0=['exports','events','setMaxListeners','save','update','remove','emit','hook'];(function(_0x4965df,_0x4bff91){var _0xfb3d6d=function(_0x40ee7d){while(--_0x40ee7d){_0x4965df['push'](_0x4965df['shift']());}};_0xfb3d6d(++_0x4bff91);}(_0x00f0,0x111));var _0x000f=function(_0xb77969,_0x25422b){_0xb77969=_0xb77969-0x0;var _0x362813=_0x00f0[_0xb77969];return _0x362813;};'use strict';var EventEmitter=require(_0x000f('0x0'));var DashboardItem=require('../../mysqldb')['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x000f('0x1')](0x0);var events={'afterCreate':_0x000f('0x2'),'afterUpdate':_0x000f('0x3'),'afterDestroy':_0x000f('0x4')};function emitEvent(_0x525737){return function(_0x2b906e,_0x384ce5,_0x291875){DashboardItemEvents['emit'](_0x525737+':'+_0x2b906e['id'],_0x2b906e);DashboardItemEvents[_0x000f('0x5')](_0x525737,_0x2b906e);_0x291875(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem[_0x000f('0x6')](e,emitEvent(event));}}module[_0x000f('0x7')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index c96d769..7e2227b 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 _0xd99d=['dashboard_items','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xd99d,0x1ae));var _0xdd99=function(_0x1d1c61,_0x241ab0){_0x1d1c61=_0x1d1c61-0x0;var _0x190333=_0xd99d[_0x1d1c61];return _0x190333;};'use strict';var _=require(_0xdd99('0x0'));var util=require('util');var logger=require(_0xdd99('0x1'))(_0xdd99('0x2'));var moment=require('moment');var BPromise=require(_0xdd99('0x3'));var rp=require(_0xdd99('0x4'));var fs=require('fs');var path=require(_0xdd99('0x5'));var rimraf=require(_0xdd99('0x6'));var config=require(_0xdd99('0x7'));var attributes=require(_0xdd99('0x8'));module[_0xdd99('0x9')]=function(_0x2537e5,_0x30b828){return _0x2537e5[_0xdd99('0xa')](_0xdd99('0xb'),attributes,{'tableName':_0xdd99('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcc0d=['../../config/environment','./dashboardItem.attributes','DashboardItem','lodash','util','../../config/logger','bluebird','request-promise','rimraf'];(function(_0x48b08d,_0x35a344){var _0x460015=function(_0x229c56){while(--_0x229c56){_0x48b08d['push'](_0x48b08d['shift']());}};_0x460015(++_0x35a344);}(_0xcc0d,0x174));var _0xdcc0=function(_0x5d6bb6,_0x33a9bd){_0x5d6bb6=_0x5d6bb6-0x0;var _0x3d70e9=_0xcc0d[_0x5d6bb6];return _0x3d70e9;};'use strict';var _=require(_0xdcc0('0x0'));var util=require(_0xdcc0('0x1'));var logger=require(_0xdcc0('0x2'))('api');var moment=require('moment');var BPromise=require(_0xdcc0('0x3'));var rp=require(_0xdcc0('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdcc0('0x5'));var config=require(_0xdcc0('0x6'));var attributes=require(_0xdcc0('0x7'));module['exports']=function(_0x3baa5c,_0x5b6b32){return _0x3baa5c['define'](_0xdcc0('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 473d949..12f66d3 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 _0x7f48=['debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','then','DashboardItem,\x20%s,\x20%s'];(function(_0x187b71,_0x4cfd66){var _0x4566a6=function(_0x45f3c5){while(--_0x45f3c5){_0x187b71['push'](_0x187b71['shift']());}};_0x4566a6(++_0x4cfd66);}(_0x7f48,0xd7));var _0x87f4=function(_0x1e2080,_0x53283b){_0x1e2080=_0x1e2080-0x0;var _0x260111=_0x7f48[_0x1e2080];return _0x260111;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x87f4('0x0'));var BPromise=require(_0x87f4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87f4('0x2'));var db=require(_0x87f4('0x3'))['db'];var utils=require(_0x87f4('0x4'));var logger=require('../../config/logger')(_0x87f4('0x5'));var config=require(_0x87f4('0x6'));var jayson=require(_0x87f4('0x7'));var client=jayson[_0x87f4('0x8')][_0x87f4('0x9')]({'port':0x232a});config[_0x87f4('0xa')]=_[_0x87f4('0xb')](config['redis'],{'host':_0x87f4('0xc'),'port':0x18eb});var socket=require(_0x87f4('0xd'))(new Redis(config[_0x87f4('0xa')]));require(_0x87f4('0xe'))[_0x87f4('0xf')](socket);function respondWithRpcPromise(_0x30662c,_0x3cecab,_0x5976a8){return new BPromise(function(_0x46dc70,_0x1e855f){return client[_0x87f4('0x10')](_0x30662c,_0x5976a8)[_0x87f4('0x11')](function(_0x150501){logger['info'](_0x87f4('0x12'),_0x3cecab,'request\x20sent');logger[_0x87f4('0x13')](_0x87f4('0x14'),_0x3cecab,'request\x20sent',JSON['stringify'](_0x150501));if(_0x150501[_0x87f4('0x15')]){if(_0x150501['error'][_0x87f4('0x16')]===0x1f4){logger[_0x87f4('0x15')](_0x87f4('0x12'),_0x3cecab,_0x150501['error'][_0x87f4('0x17')]);return _0x1e855f(_0x150501[_0x87f4('0x15')][_0x87f4('0x17')]);}logger[_0x87f4('0x15')](_0x87f4('0x12'),_0x3cecab,_0x150501[_0x87f4('0x15')][_0x87f4('0x17')]);return _0x46dc70(_0x150501[_0x87f4('0x15')][_0x87f4('0x17')]);}else{logger['info'](_0x87f4('0x12'),_0x3cecab,_0x87f4('0x18'));_0x46dc70(_0x150501['result'][_0x87f4('0x17')]);}})[_0x87f4('0x19')](function(_0x27a25f){logger[_0x87f4('0x15')](_0x87f4('0x12'),_0x3cecab,_0x27a25f);_0x1e855f(_0x27a25f);});});} \ No newline at end of file +var _0x8168=['request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket'];(function(_0x1904ec,_0x4fbef5){var _0x54bad4=function(_0x1e8100){while(--_0x1e8100){_0x1904ec['push'](_0x1904ec['shift']());}};_0x54bad4(++_0x4fbef5);}(_0x8168,0x1e8));var _0x8816=function(_0x3a07d4,_0xa80b88){_0x3a07d4=_0x3a07d4-0x0;var _0x2c352=_0x8168[_0x3a07d4];return _0x2c352;};'use strict';var _=require(_0x8816('0x0'));var util=require('util');var moment=require(_0x8816('0x1'));var BPromise=require(_0x8816('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8816('0x3'));var db=require(_0x8816('0x4'))['db'];var utils=require(_0x8816('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8816('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x8816('0x7')]=_[_0x8816('0x8')](config[_0x8816('0x7')],{'host':_0x8816('0x9'),'port':0x18eb});var socket=require(_0x8816('0xa'))(new Redis(config[_0x8816('0x7')]));require(_0x8816('0xb'))['register'](socket);function respondWithRpcPromise(_0x42220b,_0x2c9631,_0x1c6981){return new BPromise(function(_0x4ee4ae,_0x3b88e7){return client[_0x8816('0xc')](_0x42220b,_0x1c6981)[_0x8816('0xd')](function(_0x141a2d){logger[_0x8816('0xe')](_0x8816('0xf'),_0x2c9631,_0x8816('0x10'));logger[_0x8816('0x11')](_0x8816('0x12'),_0x2c9631,'request\x20sent',JSON[_0x8816('0x13')](_0x141a2d));if(_0x141a2d['error']){if(_0x141a2d[_0x8816('0x14')][_0x8816('0x15')]===0x1f4){logger[_0x8816('0x14')](_0x8816('0xf'),_0x2c9631,_0x141a2d[_0x8816('0x14')][_0x8816('0x16')]);return _0x3b88e7(_0x141a2d[_0x8816('0x14')][_0x8816('0x16')]);}logger['error']('DashboardItem,\x20%s,\x20%s',_0x2c9631,_0x141a2d[_0x8816('0x14')]['message']);return _0x4ee4ae(_0x141a2d[_0x8816('0x14')][_0x8816('0x16')]);}else{logger['info'](_0x8816('0xf'),_0x2c9631,_0x8816('0x10'));_0x4ee4ae(_0x141a2d[_0x8816('0x17')][_0x8816('0x16')]);}})[_0x8816('0x18')](function(_0x541330){logger[_0x8816('0x14')](_0x8816('0xf'),_0x2c9631,_0x541330);_0x3b88e7(_0x541330);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 3fd475a..65c777d 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 _0xf464=['save','update','removeListener','register','length','./dashboardItem.events'];(function(_0x41339a,_0x28fdc4){var _0x3fe50a=function(_0x5ebd6f){while(--_0x5ebd6f){_0x41339a['push'](_0x41339a['shift']());}};_0x3fe50a(++_0x28fdc4);}(_0xf464,0xdd));var _0x4f46=function(_0x6c6a89,_0x4468b7){_0x6c6a89=_0x6c6a89-0x0;var _0x182a9f=_0xf464[_0x6c6a89];return _0x182a9f;};'use strict';var DashboardItemEvents=require(_0x4f46('0x0'));var events=[_0x4f46('0x1'),'remove',_0x4f46('0x2')];function createListener(_0x5380af,_0x540f6c){return function(_0x10eb54){_0x540f6c['emit'](_0x5380af,_0x10eb54);};}function removeListener(_0x41868e,_0x47f9f3){return function(){DashboardItemEvents[_0x4f46('0x3')](_0x41868e,_0x47f9f3);};}exports[_0x4f46('0x4')]=function(_0x32e396){for(var _0x43a6a4=0x0,_0x4a05fe=events[_0x4f46('0x5')];_0x43a6a4<_0x4a05fe;_0x43a6a4++){var _0x2855b5=events[_0x43a6a4];var _0x462b25=createListener('dashboardItem:'+_0x2855b5,_0x32e396);DashboardItemEvents['on'](_0x2855b5,_0x462b25);}}; \ No newline at end of file +var _0x592d=['removeListener','length','./dashboardItem.events','save','remove','update'];(function(_0x126591,_0xbe043d){var _0xd3a26=function(_0x21ba71){while(--_0x21ba71){_0x126591['push'](_0x126591['shift']());}};_0xd3a26(++_0xbe043d);}(_0x592d,0x9e));var _0xd592=function(_0x228e86,_0x2ceaaf){_0x228e86=_0x228e86-0x0;var _0x3a7649=_0x592d[_0x228e86];return _0x3a7649;};'use strict';var DashboardItemEvents=require(_0xd592('0x0'));var events=[_0xd592('0x1'),_0xd592('0x2'),_0xd592('0x3')];function createListener(_0x5b392d,_0x42be9e){return function(_0x1d7da2){_0x42be9e['emit'](_0x5b392d,_0x1d7da2);};}function removeListener(_0x27a1e0,_0x1b8a09){return function(){DashboardItemEvents[_0xd592('0x4')](_0x27a1e0,_0x1b8a09);};}exports['register']=function(_0x4558cc){for(var _0x39fcbb=0x0,_0x1e46eb=events[_0xd592('0x5')];_0x39fcbb<_0x1e46eb;_0x39fcbb++){var _0x6396=events[_0x39fcbb];var _0x170bee=createListener('dashboardItem:'+_0x6396,_0x4558cc);DashboardItemEvents['on'](_0x6396,_0x170bee);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index a10abf7..cef70c5 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 _0x590a=['post','create','put','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','./dashboardItem.controller','/:id','isAuthenticated','show'];(function(_0x153ecb,_0x1e8c1c){var _0x388094=function(_0x5dabc5){while(--_0x5dabc5){_0x153ecb['push'](_0x153ecb['shift']());}};_0x388094(++_0x1e8c1c);}(_0x590a,0x113));var _0xa590=function(_0x4e1407,_0x368305){_0x4e1407=_0x4e1407-0x0;var _0x69baad=_0x590a[_0x4e1407];return _0x69baad;};'use strict';var multer=require(_0xa590('0x0'));var util=require('util');var path=require(_0xa590('0x1'));var timeout=require(_0xa590('0x2'));var express=require(_0xa590('0x3'));var router=express['Router']();var fs_extra=require(_0xa590('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa590('0x5'));var config=require('../../config/environment');var controller=require(_0xa590('0x6'));router['get'](_0xa590('0x7'),auth[_0xa590('0x8')](),controller[_0xa590('0x9')]);router[_0xa590('0xa')]('/',auth[_0xa590('0x8')](),controller[_0xa590('0xb')]);router[_0xa590('0xc')](_0xa590('0x7'),auth['isAuthenticated'](),controller['update']);router[_0xa590('0xd')](_0xa590('0x7'),auth['isAuthenticated'](),controller[_0xa590('0xe')]);module['exports']=router; \ No newline at end of file +var _0x4229=['update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated','create','put'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x4229,0x1f3));var _0x9422=function(_0x1698d4,_0x51d44e){_0x1698d4=_0x1698d4-0x0;var _0x53474d=_0x4229[_0x1698d4];return _0x53474d;};'use strict';var multer=require('multer');var util=require(_0x9422('0x0'));var path=require(_0x9422('0x1'));var timeout=require(_0x9422('0x2'));var express=require(_0x9422('0x3'));var router=express[_0x9422('0x4')]();var fs_extra=require(_0x9422('0x5'));var auth=require(_0x9422('0x6'));var interaction=require(_0x9422('0x7'));var config=require('../../config/environment');var controller=require('./dashboardItem.controller');router[_0x9422('0x8')](_0x9422('0x9'),auth[_0x9422('0xa')](),controller['show']);router['post']('/',auth[_0x9422('0xa')](),controller[_0x9422('0xb')]);router[_0x9422('0xc')](_0x9422('0x9'),auth[_0x9422('0xa')](),controller[_0x9422('0xd')]);router['delete'](_0x9422('0x9'),auth[_0x9422('0xa')](),controller[_0x9422('0xe')]);module[_0x9422('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 1f82a16..fd2ebee 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 _0xdde9=['sequelize','exports','STRING','ENUM','second'];(function(_0x2a635c,_0x451c5f){var _0x4e52cc=function(_0x35d1d9){while(--_0x35d1d9){_0x2a635c['push'](_0x2a635c['shift']());}};_0x4e52cc(++_0x451c5f);}(_0xdde9,0x9b));var _0x9dde=function(_0x2e3116,_0x284b68){_0x2e3116=_0x2e3116-0x0;var _0x4d2680=_0xdde9[_0x2e3116];return _0x4d2680;};'use strict';var Sequelize=require(_0x9dde('0x0'));module[_0x9dde('0x1')]={'name':{'type':Sequelize[_0x9dde('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0x9dde('0x3')]('first',_0x9dde('0x4'),'third'),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x9dde('0x2')]}}; \ No newline at end of file +var _0xc0e9=['STRING','exports','ENUM','first','second','third'];(function(_0x1bc844,_0x447375){var _0x3ae686=function(_0x1b8f93){while(--_0x1b8f93){_0x1bc844['push'](_0x1bc844['shift']());}};_0x3ae686(++_0x447375);}(_0xc0e9,0x11b));var _0x9c0e=function(_0x569f71,_0x4d66cb){_0x569f71=_0x569f71-0x0;var _0x5c3f46=_0xc0e9[_0x569f71];return _0x5c3f46;};'use strict';var Sequelize=require('sequelize');module[_0x9c0e('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'level':{'type':Sequelize[_0x9c0e('0x1')](_0x9c0e('0x2'),_0x9c0e('0x3'),_0x9c0e('0x4')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0x9c0e('0x5')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index c735f54..ca25957 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 _0x2384=['moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','Dispositions','UserProfileResource','error','stack','name','send','index','Disposition','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','destroy','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x5cc136,_0x5a2c2e){var _0x1b4ff7=function(_0xcc19f7){while(--_0xcc19f7){_0x5cc136['push'](_0x5cc136['shift']());}};_0x1b4ff7(++_0x5a2c2e);}(_0x2384,0x1aa));var _0x4238=function(_0x9a99cc,_0x489c4f){_0x9a99cc=_0x9a99cc-0x0;var _0x2a8d2f=_0x2384[_0x9a99cc];return _0x2a8d2f;};'use strict';var emlformat=require(_0x4238('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4238('0x1'));var jsonpatch=require(_0x4238('0x2'));var rp=require(_0x4238('0x3'));var moment=require(_0x4238('0x4'));var BPromise=require(_0x4238('0x5'));var Mustache=require('mustache');var util=require(_0x4238('0x6'));var path=require('path');var sox=require(_0x4238('0x7'));var csv=require(_0x4238('0x8'));var ejs=require(_0x4238('0x9'));var fs=require('fs');var fs_extra=require(_0x4238('0xa'));var _=require(_0x4238('0xb'));var squel=require(_0x4238('0xc'));var crypto=require(_0x4238('0xd'));var jsforce=require(_0x4238('0xe'));var deskjs=require(_0x4238('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4238('0x10'));var Papa=require(_0x4238('0x11'));var Redis=require('ioredis');var authService=require(_0x4238('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4238('0x13'));var logger=require(_0x4238('0x14'))(_0x4238('0x15'));var utils=require(_0x4238('0x16'));var config=require(_0x4238('0x17'));var licenseUtil=require(_0x4238('0x18'));var db=require(_0x4238('0x19'))['db'];function respondWithStatusCode(_0x22d54a,_0x121264){_0x121264=_0x121264||0xcc;return function(_0x43841f){if(_0x43841f){return _0x22d54a[_0x4238('0x1a')](_0x121264);}return _0x22d54a[_0x4238('0x1b')](_0x121264)[_0x4238('0x1c')]();};}function respondWithResult(_0xd0ec7,_0x360b56){_0x360b56=_0x360b56||0xc8;return function(_0x2cc41c){if(_0x2cc41c){return _0xd0ec7['status'](_0x360b56)[_0x4238('0x1d')](_0x2cc41c);}};}function respondWithFilteredResult(_0x3afc0a,_0x55540f){return function(_0x468875){if(_0x468875){var _0x40c89f=typeof _0x55540f[_0x4238('0x1e')]==='undefined'&&typeof _0x55540f[_0x4238('0x1f')]===_0x4238('0x20');var _0x384361=_0x468875['count'];var _0x49e9ce=_0x40c89f?0x0:_0x55540f[_0x4238('0x1e')];var _0x4c24b6=_0x40c89f?_0x468875[_0x4238('0x21')]:_0x55540f[_0x4238('0x1e')]+_0x55540f[_0x4238('0x1f')];var _0x210f86;if(_0x4c24b6>=_0x384361){_0x4c24b6=_0x384361;_0x210f86=0xc8;}else{_0x210f86=0xce;}_0x3afc0a[_0x4238('0x1b')](_0x210f86);return _0x3afc0a[_0x4238('0x22')](_0x4238('0x23'),_0x49e9ce+'-'+_0x4c24b6+'/'+_0x384361)['json'](_0x468875);}return null;};}function patchUpdates(_0x44afc0){return function(_0x125072){try{jsonpatch[_0x4238('0x24')](_0x125072,_0x44afc0,!![]);}catch(_0x383392){return BPromise['reject'](_0x383392);}return _0x125072[_0x4238('0x25')]();};}function saveUpdates(_0x125107,_0x3816ce){return function(_0x39e021){if(_0x39e021){return _0x39e021['update'](_0x125107)[_0x4238('0x26')](function(_0x381e1f){return _0x381e1f;});}return null;};}function removeEntity(_0x4371c2,_0xc2f2fb){return function(_0x3b8352){if(_0x3b8352){return _0x3b8352['destroy']()[_0x4238('0x26')](function(){var _0xded23f=_0x3b8352['get']({'plain':!![]});var _0xc765e6=_0x4238('0x27');return db[_0x4238('0x28')]['destroy']({'where':{'type':_0xc765e6,'resourceId':_0xded23f['id']}})[_0x4238('0x26')](function(){return _0x3b8352;});})['then'](function(){_0x4371c2[_0x4238('0x1b')](0xcc)[_0x4238('0x1c')]();});}};}function handleEntityNotFound(_0x23d1d2,_0x36e41a){return function(_0x3fc5d0){if(!_0x3fc5d0){_0x23d1d2[_0x4238('0x1a')](0x194);}return _0x3fc5d0;};}function handleError(_0x4c5a35,_0x3e3d0a){_0x3e3d0a=_0x3e3d0a||0x1f4;return function(_0x2d68a9){logger[_0x4238('0x29')](_0x2d68a9[_0x4238('0x2a')]);if(_0x2d68a9[_0x4238('0x2b')]){delete _0x2d68a9['name'];}_0x4c5a35['status'](_0x3e3d0a)[_0x4238('0x2c')](_0x2d68a9);};}exports[_0x4238('0x2d')]=function(_0x3c8d70,_0x5482d4){var _0x33c58f={},_0x4a51c6={},_0x112954={'count':0x0,'rows':[]};var _0x3f2bef=_['map'](db[_0x4238('0x2e')][_0x4238('0x2f')],function(_0x484953){return{'name':_0x484953[_0x4238('0x30')],'type':_0x484953['type'][_0x4238('0x31')]};});_0x4a51c6[_0x4238('0x32')]=_['map'](_0x3f2bef,'name');_0x4a51c6['query']=_[_0x4238('0x33')](_0x3c8d70[_0x4238('0x34')]);_0x4a51c6['filters']=_[_0x4238('0x35')](_0x4a51c6['model'],_0x4a51c6[_0x4238('0x34')]);_0x33c58f[_0x4238('0x36')]=_['intersection'](_0x4a51c6[_0x4238('0x32')],qs[_0x4238('0x37')](_0x3c8d70[_0x4238('0x34')][_0x4238('0x37')]));_0x33c58f[_0x4238('0x36')]=_0x33c58f[_0x4238('0x36')][_0x4238('0x38')]?_0x33c58f[_0x4238('0x36')]:_0x4a51c6['model'];if(!_0x3c8d70[_0x4238('0x34')][_0x4238('0x39')](_0x4238('0x3a'))){_0x33c58f[_0x4238('0x1f')]=qs[_0x4238('0x1f')](_0x3c8d70[_0x4238('0x34')][_0x4238('0x1f')]);_0x33c58f[_0x4238('0x1e')]=qs['offset'](_0x3c8d70[_0x4238('0x34')][_0x4238('0x1e')]);}_0x33c58f[_0x4238('0x3b')]=qs[_0x4238('0x3c')](_0x3c8d70['query'][_0x4238('0x3c')]);_0x33c58f[_0x4238('0x3d')]=qs[_0x4238('0x3e')](_[_0x4238('0x3f')](_0x3c8d70[_0x4238('0x34')],_0x4a51c6['filters']),_0x3f2bef);if(_0x3c8d70[_0x4238('0x34')][_0x4238('0x40')]){_0x33c58f[_0x4238('0x3d')]=_[_0x4238('0x41')](_0x33c58f['where'],{'$or':_[_0x4238('0x42')](_0x3f2bef,function(_0x435e4c){if(_0x435e4c['type']!==_0x4238('0x43')){var _0x531e15={};_0x531e15[_0x435e4c['name']]={'$like':'%'+_0x3c8d70['query'][_0x4238('0x40')]+'%'};return _0x531e15;}})});}_0x33c58f=_[_0x4238('0x41')]({},_0x33c58f,_0x3c8d70[_0x4238('0x44')]);var _0x3af6d9={'where':_0x33c58f[_0x4238('0x3d')]};return db['Disposition'][_0x4238('0x21')](_0x3af6d9)[_0x4238('0x26')](function(_0x184b9d){_0x112954[_0x4238('0x21')]=_0x184b9d;if(_0x3c8d70[_0x4238('0x34')][_0x4238('0x45')]){_0x33c58f[_0x4238('0x46')]=[{'all':!![]}];}return db['Disposition'][_0x4238('0x47')](_0x33c58f);})[_0x4238('0x26')](function(_0x324f31){_0x112954[_0x4238('0x48')]=_0x324f31;return _0x112954;})['then'](respondWithFilteredResult(_0x5482d4,_0x33c58f))[_0x4238('0x49')](handleError(_0x5482d4,null));};exports[_0x4238('0x4a')]=function(_0x3d7d1b,_0x580eb3){var _0x2f54ab={'raw':!![],'where':{'id':_0x3d7d1b[_0x4238('0x4b')]['id']}},_0xffb567={};_0xffb567[_0x4238('0x32')]=_[_0x4238('0x33')](db[_0x4238('0x2e')][_0x4238('0x2f')]);_0xffb567['query']=_['keys'](_0x3d7d1b['query']);_0xffb567[_0x4238('0x3e')]=_[_0x4238('0x35')](_0xffb567[_0x4238('0x32')],_0xffb567['query']);_0x2f54ab[_0x4238('0x36')]=_['intersection'](_0xffb567['model'],qs['fields'](_0x3d7d1b['query'][_0x4238('0x37')]));_0x2f54ab[_0x4238('0x36')]=_0x2f54ab[_0x4238('0x36')][_0x4238('0x38')]?_0x2f54ab[_0x4238('0x36')]:_0xffb567[_0x4238('0x32')];if(_0x3d7d1b[_0x4238('0x34')][_0x4238('0x45')]){_0x2f54ab['include']=[{'all':!![]}];}_0x2f54ab=_[_0x4238('0x41')]({},_0x2f54ab,_0x3d7d1b[_0x4238('0x44')]);return db[_0x4238('0x2e')]['find'](_0x2f54ab)[_0x4238('0x26')](handleEntityNotFound(_0x580eb3,null))[_0x4238('0x26')](respondWithResult(_0x580eb3,null))[_0x4238('0x49')](handleError(_0x580eb3,null));};exports[_0x4238('0x4c')]=function(_0x2c1c2d,_0x20f5fd){return db['Disposition'][_0x4238('0x4c')](_0x2c1c2d['body'],{})[_0x4238('0x26')](function(_0x304238){var _0x3ce701=_0x2c1c2d[_0x4238('0x4d')][_0x4238('0x4e')]({'plain':!![]});if(!_0x3ce701)throw new Error(_0x4238('0x4f'));if(_0x3ce701[_0x4238('0x50')]==='user'){var _0x550c70=_0x304238[_0x4238('0x4e')]({'plain':!![]});var _0x34e816=_0x4238('0x27');return db[_0x4238('0x51')]['find']({'where':{'name':_0x34e816,'userProfileId':_0x3ce701['userProfileId']},'raw':!![]})['then'](function(_0x465ab3){if(_0x465ab3&&_0x465ab3['autoAssociation']===0x0){return db[_0x4238('0x28')]['create']({'name':_0x550c70[_0x4238('0x2b')],'resourceId':_0x550c70['id'],'type':_0x465ab3[_0x4238('0x2b')],'sectionId':_0x465ab3['id']},{})[_0x4238('0x26')](function(){return _0x304238;});}else{return _0x304238;}})[_0x4238('0x49')](function(_0x2e9b19){logger[_0x4238('0x29')](_0x4238('0x52'),_0x2e9b19);throw _0x2e9b19;});}return _0x304238;})[_0x4238('0x26')](respondWithResult(_0x20f5fd,0xc9))[_0x4238('0x49')](handleError(_0x20f5fd,null));};exports['update']=function(_0x21d14f,_0x2d6f2e){if(_0x21d14f[_0x4238('0x53')]['id']){delete _0x21d14f[_0x4238('0x53')]['id'];}return db[_0x4238('0x2e')][_0x4238('0x54')]({'where':{'id':_0x21d14f[_0x4238('0x4b')]['id']}})[_0x4238('0x26')](handleEntityNotFound(_0x2d6f2e,null))['then'](saveUpdates(_0x21d14f[_0x4238('0x53')],null))[_0x4238('0x26')](respondWithResult(_0x2d6f2e,null))[_0x4238('0x49')](handleError(_0x2d6f2e,null));};exports[_0x4238('0x55')]=function(_0x696d65,_0x327ee0){return db[_0x4238('0x2e')][_0x4238('0x54')]({'where':{'id':_0x696d65[_0x4238('0x4b')]['id']}})[_0x4238('0x26')](handleEntityNotFound(_0x327ee0,null))['then'](removeEntity(_0x327ee0,null))[_0x4238('0x49')](handleError(_0x327ee0,null));}; \ No newline at end of file +var _0xbf25=['send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','filter','where','VIRTUAL','merge','Disposition','includeAll','include','catch','show','params','rawAttributes','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','find','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','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','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','get','Dispositions','sendStatus','error','stack','name'];(function(_0x231984,_0x3c4e25){var _0x9671ef=function(_0x3d8dd4){while(--_0x3d8dd4){_0x231984['push'](_0x231984['shift']());}};_0x9671ef(++_0x3c4e25);}(_0xbf25,0x15e));var _0x5bf2=function(_0x5d5a44,_0x14308c){_0x5d5a44=_0x5d5a44-0x0;var _0x3cf472=_0xbf25[_0x5d5a44];return _0x3cf472;};'use strict';var emlformat=require(_0x5bf2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5bf2('0x1'));var jsonpatch=require(_0x5bf2('0x2'));var rp=require(_0x5bf2('0x3'));var moment=require(_0x5bf2('0x4'));var BPromise=require(_0x5bf2('0x5'));var Mustache=require(_0x5bf2('0x6'));var util=require('util');var path=require(_0x5bf2('0x7'));var sox=require('sox');var csv=require(_0x5bf2('0x8'));var ejs=require(_0x5bf2('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5bf2('0xa'));var squel=require(_0x5bf2('0xb'));var crypto=require(_0x5bf2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5bf2('0xd'));var toCsv=require(_0x5bf2('0x8'));var querystring=require(_0x5bf2('0xe'));var Papa=require('papaparse');var Redis=require(_0x5bf2('0xf'));var authService=require(_0x5bf2('0x10'));var qs=require(_0x5bf2('0x11'));var as=require(_0x5bf2('0x12'));var hardwareService=require(_0x5bf2('0x13'));var logger=require(_0x5bf2('0x14'))(_0x5bf2('0x15'));var utils=require(_0x5bf2('0x16'));var config=require(_0x5bf2('0x17'));var licenseUtil=require(_0x5bf2('0x18'));var db=require(_0x5bf2('0x19'))['db'];function respondWithStatusCode(_0x656dc6,_0x355620){_0x355620=_0x355620||0xcc;return function(_0x541e89){if(_0x541e89){return _0x656dc6['sendStatus'](_0x355620);}return _0x656dc6[_0x5bf2('0x1a')](_0x355620)[_0x5bf2('0x1b')]();};}function respondWithResult(_0x5d3cb6,_0x10c8a1){_0x10c8a1=_0x10c8a1||0xc8;return function(_0x43a83b){if(_0x43a83b){return _0x5d3cb6[_0x5bf2('0x1a')](_0x10c8a1)[_0x5bf2('0x1c')](_0x43a83b);}};}function respondWithFilteredResult(_0x15abc4,_0x277d50){return function(_0x3083cd){if(_0x3083cd){var _0xff9397=typeof _0x277d50[_0x5bf2('0x1d')]===_0x5bf2('0x1e')&&typeof _0x277d50[_0x5bf2('0x1f')]===_0x5bf2('0x1e');var _0x4d1990=_0x3083cd['count'];var _0x2f87ff=_0xff9397?0x0:_0x277d50['offset'];var _0x3df0cd=_0xff9397?_0x3083cd[_0x5bf2('0x20')]:_0x277d50['offset']+_0x277d50['limit'];var _0x3adc26;if(_0x3df0cd>=_0x4d1990){_0x3df0cd=_0x4d1990;_0x3adc26=0xc8;}else{_0x3adc26=0xce;}_0x15abc4[_0x5bf2('0x1a')](_0x3adc26);return _0x15abc4[_0x5bf2('0x21')](_0x5bf2('0x22'),_0x2f87ff+'-'+_0x3df0cd+'/'+_0x4d1990)[_0x5bf2('0x1c')](_0x3083cd);}return null;};}function patchUpdates(_0x3c97f5){return function(_0x3a9694){try{jsonpatch[_0x5bf2('0x23')](_0x3a9694,_0x3c97f5,!![]);}catch(_0x44bedc){return BPromise['reject'](_0x44bedc);}return _0x3a9694['save']();};}function saveUpdates(_0xe8c648,_0x3885e8){return function(_0x161ec2){if(_0x161ec2){return _0x161ec2[_0x5bf2('0x24')](_0xe8c648)[_0x5bf2('0x25')](function(_0x1cb9e1){return _0x1cb9e1;});}return null;};}function removeEntity(_0x37036d,_0x2eea63){return function(_0x239206){if(_0x239206){return _0x239206[_0x5bf2('0x26')]()[_0x5bf2('0x25')](function(){var _0x20ee02=_0x239206[_0x5bf2('0x27')]({'plain':!![]});var _0x5ae161=_0x5bf2('0x28');return db['UserProfileResource'][_0x5bf2('0x26')]({'where':{'type':_0x5ae161,'resourceId':_0x20ee02['id']}})[_0x5bf2('0x25')](function(){return _0x239206;});})['then'](function(){_0x37036d[_0x5bf2('0x1a')](0xcc)[_0x5bf2('0x1b')]();});}};}function handleEntityNotFound(_0x5cefb3,_0x5426f9){return function(_0x8c54cd){if(!_0x8c54cd){_0x5cefb3[_0x5bf2('0x29')](0x194);}return _0x8c54cd;};}function handleError(_0x3ceabf,_0x43c2f7){_0x43c2f7=_0x43c2f7||0x1f4;return function(_0x5ca619){logger[_0x5bf2('0x2a')](_0x5ca619[_0x5bf2('0x2b')]);if(_0x5ca619[_0x5bf2('0x2c')]){delete _0x5ca619[_0x5bf2('0x2c')];}_0x3ceabf[_0x5bf2('0x1a')](_0x43c2f7)[_0x5bf2('0x2d')](_0x5ca619);};}exports['index']=function(_0x3edba7,_0x2ea937){var _0x44a6a3={},_0x59ac8b={},_0x7023ae={'count':0x0,'rows':[]};var _0x432de6=_[_0x5bf2('0x2e')](db['Disposition']['rawAttributes'],function(_0x5284fe){return{'name':_0x5284fe[_0x5bf2('0x2f')],'type':_0x5284fe[_0x5bf2('0x30')][_0x5bf2('0x31')]};});_0x59ac8b[_0x5bf2('0x32')]=_[_0x5bf2('0x2e')](_0x432de6,'name');_0x59ac8b['query']=_[_0x5bf2('0x33')](_0x3edba7[_0x5bf2('0x34')]);_0x59ac8b[_0x5bf2('0x35')]=_[_0x5bf2('0x36')](_0x59ac8b[_0x5bf2('0x32')],_0x59ac8b[_0x5bf2('0x34')]);_0x44a6a3[_0x5bf2('0x37')]=_[_0x5bf2('0x36')](_0x59ac8b[_0x5bf2('0x32')],qs[_0x5bf2('0x38')](_0x3edba7[_0x5bf2('0x34')][_0x5bf2('0x38')]));_0x44a6a3[_0x5bf2('0x37')]=_0x44a6a3['attributes'][_0x5bf2('0x39')]?_0x44a6a3['attributes']:_0x59ac8b['model'];if(!_0x3edba7['query']['hasOwnProperty'](_0x5bf2('0x3a'))){_0x44a6a3[_0x5bf2('0x1f')]=qs[_0x5bf2('0x1f')](_0x3edba7[_0x5bf2('0x34')][_0x5bf2('0x1f')]);_0x44a6a3['offset']=qs['offset'](_0x3edba7['query'][_0x5bf2('0x1d')]);}_0x44a6a3[_0x5bf2('0x3b')]=qs['sort'](_0x3edba7['query']['sort']);_0x44a6a3['where']=qs[_0x5bf2('0x35')](_['pick'](_0x3edba7[_0x5bf2('0x34')],_0x59ac8b[_0x5bf2('0x35')]),_0x432de6);if(_0x3edba7[_0x5bf2('0x34')][_0x5bf2('0x3c')]){_0x44a6a3[_0x5bf2('0x3d')]=_['merge'](_0x44a6a3['where'],{'$or':_[_0x5bf2('0x2e')](_0x432de6,function(_0xa1c3bc){if(_0xa1c3bc[_0x5bf2('0x30')]!==_0x5bf2('0x3e')){var _0x51290c={};_0x51290c[_0xa1c3bc['name']]={'$like':'%'+_0x3edba7[_0x5bf2('0x34')][_0x5bf2('0x3c')]+'%'};return _0x51290c;}})});}_0x44a6a3=_[_0x5bf2('0x3f')]({},_0x44a6a3,_0x3edba7['options']);var _0x1cd76b={'where':_0x44a6a3['where']};return db[_0x5bf2('0x40')]['count'](_0x1cd76b)[_0x5bf2('0x25')](function(_0x22e6d4){_0x7023ae[_0x5bf2('0x20')]=_0x22e6d4;if(_0x3edba7[_0x5bf2('0x34')][_0x5bf2('0x41')]){_0x44a6a3[_0x5bf2('0x42')]=[{'all':!![]}];}return db[_0x5bf2('0x40')]['findAll'](_0x44a6a3);})['then'](function(_0x1509c1){_0x7023ae['rows']=_0x1509c1;return _0x7023ae;})['then'](respondWithFilteredResult(_0x2ea937,_0x44a6a3))[_0x5bf2('0x43')](handleError(_0x2ea937,null));};exports[_0x5bf2('0x44')]=function(_0x880696,_0x1de267){var _0x2aba02={'raw':!![],'where':{'id':_0x880696[_0x5bf2('0x45')]['id']}},_0x4d2159={};_0x4d2159[_0x5bf2('0x32')]=_[_0x5bf2('0x33')](db['Disposition'][_0x5bf2('0x46')]);_0x4d2159['query']=_[_0x5bf2('0x33')](_0x880696[_0x5bf2('0x34')]);_0x4d2159['filters']=_[_0x5bf2('0x36')](_0x4d2159['model'],_0x4d2159['query']);_0x2aba02[_0x5bf2('0x37')]=_['intersection'](_0x4d2159['model'],qs['fields'](_0x880696[_0x5bf2('0x34')][_0x5bf2('0x38')]));_0x2aba02['attributes']=_0x2aba02[_0x5bf2('0x37')][_0x5bf2('0x39')]?_0x2aba02[_0x5bf2('0x37')]:_0x4d2159[_0x5bf2('0x32')];if(_0x880696['query'][_0x5bf2('0x41')]){_0x2aba02[_0x5bf2('0x42')]=[{'all':!![]}];}_0x2aba02=_['merge']({},_0x2aba02,_0x880696['options']);return db[_0x5bf2('0x40')]['find'](_0x2aba02)[_0x5bf2('0x25')](handleEntityNotFound(_0x1de267,null))[_0x5bf2('0x25')](respondWithResult(_0x1de267,null))['catch'](handleError(_0x1de267,null));};exports['create']=function(_0x3a58fe,_0x4a2b21){return db[_0x5bf2('0x40')]['create'](_0x3a58fe['body'],{})[_0x5bf2('0x25')](function(_0x311bb1){var _0x323a73=_0x3a58fe['user'][_0x5bf2('0x27')]({'plain':!![]});if(!_0x323a73)throw new Error(_0x5bf2('0x47'));if(_0x323a73['role']==='user'){var _0x141747=_0x311bb1['get']({'plain':!![]});var _0x1b9cb8=_0x5bf2('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x1b9cb8,'userProfileId':_0x323a73[_0x5bf2('0x48')]},'raw':!![]})[_0x5bf2('0x25')](function(_0x3217a2){if(_0x3217a2&&_0x3217a2[_0x5bf2('0x49')]===0x0){return db[_0x5bf2('0x4a')][_0x5bf2('0x4b')]({'name':_0x141747[_0x5bf2('0x2c')],'resourceId':_0x141747['id'],'type':_0x3217a2[_0x5bf2('0x2c')],'sectionId':_0x3217a2['id']},{})[_0x5bf2('0x25')](function(){return _0x311bb1;});}else{return _0x311bb1;}})['catch'](function(_0x4e32e4){logger[_0x5bf2('0x2a')](_0x5bf2('0x4c'),_0x4e32e4);throw _0x4e32e4;});}return _0x311bb1;})[_0x5bf2('0x25')](respondWithResult(_0x4a2b21,0xc9))['catch'](handleError(_0x4a2b21,null));};exports['update']=function(_0x5e8617,_0x5d9618){if(_0x5e8617[_0x5bf2('0x4d')]['id']){delete _0x5e8617['body']['id'];}return db[_0x5bf2('0x40')][_0x5bf2('0x4e')]({'where':{'id':_0x5e8617['params']['id']}})[_0x5bf2('0x25')](handleEntityNotFound(_0x5d9618,null))[_0x5bf2('0x25')](saveUpdates(_0x5e8617[_0x5bf2('0x4d')],null))['then'](respondWithResult(_0x5d9618,null))[_0x5bf2('0x43')](handleError(_0x5d9618,null));};exports[_0x5bf2('0x26')]=function(_0x20f5c9,_0x5e8dfc){return db[_0x5bf2('0x40')][_0x5bf2('0x4e')]({'where':{'id':_0x20f5c9[_0x5bf2('0x45')]['id']}})[_0x5bf2('0x25')](handleEntityNotFound(_0x5e8dfc,null))['then'](removeEntity(_0x5e8dfc,null))[_0x5bf2('0x43')](handleError(_0x5e8dfc,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 0149515..5dba357 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 _0xd529=['bluebird','request-promise','./disposition.attributes','define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','../../config/logger','api','moment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd529,0x6a));var _0x9d52=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd529[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x9d52('0x0'));var util=require('util');var logger=require(_0x9d52('0x1'))(_0x9d52('0x2'));var moment=require(_0x9d52('0x3'));var BPromise=require(_0x9d52('0x4'));var rp=require(_0x9d52('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9d52('0x6'));module['exports']=function(_0xb46874,_0x3e1cc7){return _0xb46874[_0x9d52('0x7')](_0x9d52('0x8'),attributes,{'tableName':_0x9d52('0x9'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x9d52('0xa'),'fields':[_0x9d52('0xb'),'ListId']},{'unique':!![],'name':_0x9d52('0xc'),'fields':[_0x9d52('0xb'),_0x9d52('0xd')]},{'unique':!![],'name':_0x9d52('0xe'),'fields':['name','MailAccountId']},{'unique':!![],'name':_0x9d52('0xf'),'fields':[_0x9d52('0xb'),_0x9d52('0x10')]},{'unique':!![],'name':_0x9d52('0x11'),'fields':[_0x9d52('0xb'),'FaxAccountId']},{'unique':!![],'name':_0x9d52('0x12'),'fields':[_0x9d52('0xb'),_0x9d52('0x13')]},{'unique':!![],'name':_0x9d52('0x14'),'fields':['name',_0x9d52('0x15')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdafb=['name','ChatWebsiteId','name_mail','SmsAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','Disposition','tools_dispositions','name_voice'];(function(_0x5e5c00,_0x1b7a1d){var _0x47d92c=function(_0x11df20){while(--_0x11df20){_0x5e5c00['push'](_0x5e5c00['shift']());}};_0x47d92c(++_0x1b7a1d);}(_0xdafb,0xce));var _0xbdaf=function(_0x158ba3,_0xc7b8e4){_0x158ba3=_0x158ba3-0x0;var _0x50a36c=_0xdafb[_0x158ba3];return _0x50a36c;};'use strict';var _=require(_0xbdaf('0x0'));var util=require(_0xbdaf('0x1'));var logger=require(_0xbdaf('0x2'))(_0xbdaf('0x3'));var moment=require(_0xbdaf('0x4'));var BPromise=require('bluebird');var rp=require(_0xbdaf('0x5'));var fs=require('fs');var path=require(_0xbdaf('0x6'));var rimraf=require(_0xbdaf('0x7'));var config=require(_0xbdaf('0x8'));var attributes=require('./disposition.attributes');module[_0xbdaf('0x9')]=function(_0x3b07d4,_0x1c1f5d){return _0x3b07d4[_0xbdaf('0xa')](_0xbdaf('0xb'),attributes,{'tableName':_0xbdaf('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xbdaf('0xd'),'fields':[_0xbdaf('0xe'),'ListId']},{'unique':!![],'name':'name_chat','fields':['name',_0xbdaf('0xf')]},{'unique':!![],'name':_0xbdaf('0x10'),'fields':['name','MailAccountId']},{'unique':!![],'name':'name_sms','fields':['name',_0xbdaf('0x11')]},{'unique':!![],'name':'name_fax','fields':[_0xbdaf('0xe'),'FaxAccountId']},{'unique':!![],'name':_0xbdaf('0x12'),'fields':[_0xbdaf('0xe'),_0xbdaf('0x13')]},{'unique':!![],'name':_0xbdaf('0x14'),'fields':['name',_0xbdaf('0x15')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 6f526bb..d33d118 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(_0x6c704c,_0x1501ac){var _0x542f27=function(_0x4402e){while(--_0x4402e){_0x6c704c['push'](_0x6c704c['shift']());}};_0x542f27(++_0x1501ac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0x4d5684,_0x35c59f){var _0x148274=function(_0xeb37eb){while(--_0xeb37eb){_0x4d5684['push'](_0x4d5684['shift']());}};_0x148274(++_0x35c59f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 cdf09e4..6474377 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 _0x5c03=['./disposition.controller','get','isAuthenticated','index','create','put','update','delete','/:id','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x54a229,_0x479dd1){var _0x36232e=function(_0x48a4d3){while(--_0x48a4d3){_0x54a229['push'](_0x54a229['shift']());}};_0x36232e(++_0x479dd1);}(_0x5c03,0x174));var _0x35c0=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0x5c03[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x35c0('0x0'));var util=require(_0x35c0('0x1'));var path=require('path');var timeout=require(_0x35c0('0x2'));var express=require('express');var router=express[_0x35c0('0x3')]();var fs_extra=require(_0x35c0('0x4'));var auth=require(_0x35c0('0x5'));var interaction=require(_0x35c0('0x6'));var config=require(_0x35c0('0x7'));var controller=require(_0x35c0('0x8'));router[_0x35c0('0x9')]('/',auth[_0x35c0('0xa')](),controller[_0x35c0('0xb')]);router[_0x35c0('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x35c0('0xa')](),controller[_0x35c0('0xc')]);router[_0x35c0('0xd')]('/:id',auth[_0x35c0('0xa')](),controller[_0x35c0('0xe')]);router[_0x35c0('0xf')](_0x35c0('0x10'),auth[_0x35c0('0xa')](),controller[_0x35c0('0x11')]);module[_0x35c0('0x12')]=router; \ No newline at end of file +var _0x4a2f=['isAuthenticated','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./disposition.controller','/:id','show'];(function(_0x84cf8c,_0x211a87){var _0x302398=function(_0x230780){while(--_0x230780){_0x84cf8c['push'](_0x84cf8c['shift']());}};_0x302398(++_0x211a87);}(_0x4a2f,0x146));var _0xf4a2=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x4a2f[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0xf4a2('0x0'));var util=require('util');var path=require(_0xf4a2('0x1'));var timeout=require('connect-timeout');var express=require(_0xf4a2('0x2'));var router=express[_0xf4a2('0x3')]();var fs_extra=require(_0xf4a2('0x4'));var auth=require(_0xf4a2('0x5'));var interaction=require(_0xf4a2('0x6'));var config=require('../../config/environment');var controller=require(_0xf4a2('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xf4a2('0x8'),auth['isAuthenticated'](),controller[_0xf4a2('0x9')]);router['post']('/',auth[_0xf4a2('0xa')](),controller['create']);router[_0xf4a2('0xb')](_0xf4a2('0x8'),auth['isAuthenticated'](),controller[_0xf4a2('0xc')]);router[_0xf4a2('0xd')](_0xf4a2('0x8'),auth[_0xf4a2('0xa')](),controller[_0xf4a2('0xe')]);module[_0xf4a2('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 39657aa..6a5b229 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 _0x2c8f=['IAX','DADHI','KHOMP','SIP','TEXT','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','exports','yes','STRING','localstationid','ENUM','2400','4800','7200','12000','14400','9600','v17,v27,v29'];(function(_0xd0f198,_0x44e8a6){var _0x3afa4f=function(_0x106f6e){while(--_0x106f6e){_0xd0f198['push'](_0xd0f198['shift']());}};_0x3afa4f(++_0x44e8a6);}(_0x2c8f,0x192));var _0xf2c8=function(_0x2949be,_0xf8dd34){_0x2949be=_0x2949be-0x0;var _0x4cf0bc=_0x2c8f[_0x2949be];return _0x4cf0bc;};'use strict';var Sequelize=require('sequelize');module[_0xf2c8('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM'](_0xf2c8('0x1'),'no'),'defaultValue':_0xf2c8('0x1')},'headerinfo':{'type':Sequelize[_0xf2c8('0x2')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize['STRING'],'unique':_0xf2c8('0x3')},'minrate':{'type':Sequelize[_0xf2c8('0x4')](_0xf2c8('0x5'),_0xf2c8('0x6'),_0xf2c8('0x7'),'9600',_0xf2c8('0x8'),_0xf2c8('0x9')),'defaultValue':_0xf2c8('0x6')},'maxrate':{'type':Sequelize[_0xf2c8('0x4')](_0xf2c8('0x5'),_0xf2c8('0x6'),'7200',_0xf2c8('0xa'),_0xf2c8('0x8'),_0xf2c8('0x9')),'defaultValue':_0xf2c8('0x9')},'modem':{'type':Sequelize[_0xf2c8('0x2')],'defaultValue':_0xf2c8('0xb')},'gateway':{'type':Sequelize[_0xf2c8('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xf2c8('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xf2c8('0x4')]('SIP',_0xf2c8('0xc'),_0xf2c8('0xd'),_0xf2c8('0xe')),'defaultValue':_0xf2c8('0xf')},'key':{'type':Sequelize[_0xf2c8('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xf2c8('0x10')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0xf2c8('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf2c8('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xf2c8('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xf2c8('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xf2c8('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf2c8('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf2c8('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf2c8('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0xf2c8('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xf2c8('0x11')],'defaultValue':![],'comment':_0xf2c8('0x14'),'set':function(_0xe1ec71){if(!_0xe1ec71)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xf2c8('0x15')](_0xf2c8('0x16'),_0xe1ec71);}}}; \ No newline at end of file +var _0x8375=['sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition'];(function(_0x86c2a4,_0x11e4f6){var _0x4d08fa=function(_0x97e2a9){while(--_0x97e2a9){_0x86c2a4['push'](_0x86c2a4['shift']());}};_0x4d08fa(++_0x11e4f6);}(_0x8375,0xa8));var _0x5837=function(_0x2ecc53,_0x291adf){_0x2ecc53=_0x2ecc53-0x0;var _0x46a300=_0x8375[_0x2ecc53];return _0x46a300;};'use strict';var Sequelize=require(_0x5837('0x0'));module[_0x5837('0x1')]={'name':{'type':Sequelize[_0x5837('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x5837('0x3')](_0x5837('0x4'),'no'),'defaultValue':_0x5837('0x4')},'headerinfo':{'type':Sequelize[_0x5837('0x2')],'defaultValue':_0x5837('0x5')},'localstationid':{'type':Sequelize[_0x5837('0x2')],'unique':'localstationid'},'minrate':{'type':Sequelize[_0x5837('0x3')](_0x5837('0x6'),_0x5837('0x7'),_0x5837('0x8'),_0x5837('0x9'),'12000','14400'),'defaultValue':_0x5837('0x7')},'maxrate':{'type':Sequelize[_0x5837('0x3')]('2400',_0x5837('0x7'),'7200',_0x5837('0x9'),_0x5837('0xa'),_0x5837('0xb')),'defaultValue':_0x5837('0xb')},'modem':{'type':Sequelize[_0x5837('0x2')],'defaultValue':_0x5837('0xc')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5837('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x5837('0xd')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5837('0x3')](_0x5837('0xe'),_0x5837('0xf'),'DADHI','KHOMP'),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x5837('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x5837('0x10')],'defaultValue':function(){return _0x5837('0x11');}},'notificationSound':{'type':Sequelize[_0x5837('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5837('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5837('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x5837('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x5837('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5837('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5837('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5837('0xd')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5837('0x12')],'defaultValue':![],'comment':_0x5837('0x13'),'set':function(_0x3a509b){if(!_0x3a509b)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x5837('0x14'),_0x3a509b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 5c252d7..92b8a05 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 _0x37be=['UserProfileResource','sendStatus','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','find','create','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','length','hasOwnProperty','pick','removeDispositions','ids','getAnswers','CannedAnswer','removeAnswers','addInteraction','omit','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','findAndCountAll','priority','finally','getApplications','from-voip-provider','exten','localstationid','app','system','description','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','ReceiveFax','addAccountApplications','transaction','VoiceExtension','bulkCreate','tech','key','createdAt','TrunkId','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','List\x20not\x20found','user','filename','Messages','out','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','userFaxAccount:save','removeAgents','isArray','emit','userFaxAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','./faxAccount.socket','jayson/promise','client','http','request','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','status','end','json','undefined','limit','count','offset','Content-Range','apply','save','update','then','destroy','get','FaxAccounts'];(function(_0x166742,_0x55520c){var _0xb7814a=function(_0x18feaf){while(--_0x18feaf){_0x166742['push'](_0x166742['shift']());}};_0xb7814a(++_0x55520c);}(_0x37be,0x153));var _0xe37b=function(_0xa2a5d6,_0x524481){_0xa2a5d6=_0xa2a5d6-0x0;var _0x140d6b=_0x37be[_0xa2a5d6];return _0x140d6b;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe37b('0x0'));var jsonpatch=require(_0xe37b('0x1'));var rp=require(_0xe37b('0x2'));var moment=require(_0xe37b('0x3'));var BPromise=require(_0xe37b('0x4'));var Mustache=require('mustache');var util=require(_0xe37b('0x5'));var path=require(_0xe37b('0x6'));var sox=require(_0xe37b('0x7'));var csv=require(_0xe37b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe37b('0x9'));var _=require(_0xe37b('0xa'));var squel=require(_0xe37b('0xb'));var crypto=require(_0xe37b('0xc'));var jsforce=require(_0xe37b('0xd'));var deskjs=require(_0xe37b('0xe'));var toCsv=require(_0xe37b('0x8'));var querystring=require(_0xe37b('0xf'));var Papa=require(_0xe37b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe37b('0x11'));var as=require(_0xe37b('0x12'));var hardwareService=require(_0xe37b('0x13'));var logger=require('../../config/logger')(_0xe37b('0x14'));var utils=require(_0xe37b('0x15'));var config=require(_0xe37b('0x16'));var licenseUtil=require(_0xe37b('0x17'));var db=require(_0xe37b('0x18'))['db'];config['redis']=_[_0xe37b('0x19')](config[_0xe37b('0x1a')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe37b('0x1b'))['register'](socket);var jayson=require(_0xe37b('0x1c'));var client=jayson[_0xe37b('0x1d')][_0xe37b('0x1e')]({'port':0x232c});var client9002=jayson[_0xe37b('0x1d')][_0xe37b('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x24eba6,_0x4d6d6e,_0x5bbb12,_0x1f23a8){return new BPromise(function(_0x59c4a8,_0x1e2b69){var _0x4771a2=_0x1f23a8||client;return _0x4771a2[_0xe37b('0x1f')](_0x24eba6,_0x5bbb12)['then'](function(_0x5b81c4){logger[_0xe37b('0x20')](_0xe37b('0x21'),_0x4d6d6e,'request\x20sent');logger[_0xe37b('0x22')](_0xe37b('0x23'),_0x4d6d6e,_0xe37b('0x24'),JSON['stringify'](_0x5b81c4));if(_0x5b81c4['error']){if(_0x5b81c4[_0xe37b('0x25')][_0xe37b('0x26')]===0x1f4){logger[_0xe37b('0x25')](_0xe37b('0x21'),_0x4d6d6e,_0x5b81c4[_0xe37b('0x25')]['message']);return _0x1e2b69(_0x5b81c4[_0xe37b('0x25')][_0xe37b('0x27')]);}logger[_0xe37b('0x25')](_0xe37b('0x21'),_0x4d6d6e,_0x5b81c4[_0xe37b('0x25')][_0xe37b('0x27')]);return _0x59c4a8(_0x5b81c4['error'][_0xe37b('0x27')]);}else{logger[_0xe37b('0x20')](_0xe37b('0x21'),_0x4d6d6e,'request\x20sent');_0x59c4a8(_0x5b81c4[_0xe37b('0x28')]['message']);}})[_0xe37b('0x29')](function(_0x31aef8){logger['error'](_0xe37b('0x21'),_0x4d6d6e,_0x31aef8);_0x1e2b69(_0x31aef8);});});}function respondWithStatusCode(_0x317e03,_0x2c34f4){_0x2c34f4=_0x2c34f4||0xcc;return function(_0x1a3e90){if(_0x1a3e90){return _0x317e03['sendStatus'](_0x2c34f4);}return _0x317e03[_0xe37b('0x2a')](_0x2c34f4)[_0xe37b('0x2b')]();};}function respondWithResult(_0x50e4ad,_0x3b1617){_0x3b1617=_0x3b1617||0xc8;return function(_0x57e743){if(_0x57e743){return _0x50e4ad[_0xe37b('0x2a')](_0x3b1617)[_0xe37b('0x2c')](_0x57e743);}};}function respondWithFilteredResult(_0x2471b5,_0x2e3135){return function(_0x34ee5f){if(_0x34ee5f){var _0x11c40c=typeof _0x2e3135['offset']===_0xe37b('0x2d')&&typeof _0x2e3135[_0xe37b('0x2e')]===_0xe37b('0x2d');var _0x8cc7aa=_0x34ee5f[_0xe37b('0x2f')];var _0x1a70e8=_0x11c40c?0x0:_0x2e3135[_0xe37b('0x30')];var _0x16fb5d=_0x11c40c?_0x34ee5f[_0xe37b('0x2f')]:_0x2e3135[_0xe37b('0x30')]+_0x2e3135['limit'];var _0x1991b6;if(_0x16fb5d>=_0x8cc7aa){_0x16fb5d=_0x8cc7aa;_0x1991b6=0xc8;}else{_0x1991b6=0xce;}_0x2471b5['status'](_0x1991b6);return _0x2471b5['set'](_0xe37b('0x31'),_0x1a70e8+'-'+_0x16fb5d+'/'+_0x8cc7aa)['json'](_0x34ee5f);}return null;};}function patchUpdates(_0x114015){return function(_0x1c2ad1){try{jsonpatch[_0xe37b('0x32')](_0x1c2ad1,_0x114015,!![]);}catch(_0x586aa5){return BPromise['reject'](_0x586aa5);}return _0x1c2ad1[_0xe37b('0x33')]();};}function saveUpdates(_0x533928,_0x103bcf){return function(_0x18ca48){if(_0x18ca48){return _0x18ca48[_0xe37b('0x34')](_0x533928)[_0xe37b('0x35')](function(_0x171644){return _0x171644;});}return null;};}function removeEntity(_0x12e287,_0x2864c4){return function(_0x11edbc){if(_0x11edbc){return _0x11edbc[_0xe37b('0x36')]()[_0xe37b('0x35')](function(){var _0x8ebe80=_0x11edbc[_0xe37b('0x37')]({'plain':!![]});var _0x311933=_0xe37b('0x38');return db[_0xe37b('0x39')][_0xe37b('0x36')]({'where':{'type':_0x311933,'resourceId':_0x8ebe80['id']}})['then'](function(){return _0x11edbc;});})[_0xe37b('0x35')](function(){_0x12e287[_0xe37b('0x2a')](0xcc)[_0xe37b('0x2b')]();});}};}function handleEntityNotFound(_0x44c17f,_0x49f4c9){return function(_0x32ec28){if(!_0x32ec28){_0x44c17f[_0xe37b('0x3a')](0x194);}return _0x32ec28;};}function handleError(_0xbaad55,_0x308779){_0x308779=_0x308779||0x1f4;return function(_0x2d9d9d){logger['error'](_0x2d9d9d[_0xe37b('0x3b')]);if(_0x2d9d9d[_0xe37b('0x3c')]){delete _0x2d9d9d[_0xe37b('0x3c')];}_0xbaad55['status'](_0x308779)[_0xe37b('0x3d')](_0x2d9d9d);};}exports[_0xe37b('0x3e')]=function(_0x32ac4d,_0x19a057){var _0x56c5c8={'include':[{'model':db['Pause'],'as':_0xe37b('0x3f')}]},_0x27784b={},_0xa1b3f={'count':0x0,'rows':[]};var _0x910515=_[_0xe37b('0x40')](db[_0xe37b('0x41')][_0xe37b('0x42')],function(_0xf8172c){return{'name':_0xf8172c['fieldName'],'type':_0xf8172c[_0xe37b('0x43')]['key']};});_0x27784b[_0xe37b('0x44')]=_[_0xe37b('0x40')](_0x910515,_0xe37b('0x3c'));_0x27784b[_0xe37b('0x45')]=_[_0xe37b('0x46')](_0x32ac4d[_0xe37b('0x45')]);_0x27784b[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x27784b[_0xe37b('0x44')],_0x27784b[_0xe37b('0x45')]);_0x56c5c8[_0xe37b('0x49')]=_[_0xe37b('0x48')](_0x27784b['model'],qs[_0xe37b('0x4a')](_0x32ac4d[_0xe37b('0x45')][_0xe37b('0x4a')]));_0x56c5c8['attributes']=_0x56c5c8['attributes']['length']?_0x56c5c8[_0xe37b('0x49')]:_0x27784b[_0xe37b('0x44')];if(!_0x32ac4d[_0xe37b('0x45')]['hasOwnProperty'](_0xe37b('0x4b'))){_0x56c5c8[_0xe37b('0x2e')]=qs[_0xe37b('0x2e')](_0x32ac4d[_0xe37b('0x45')][_0xe37b('0x2e')]);_0x56c5c8[_0xe37b('0x30')]=qs[_0xe37b('0x30')](_0x32ac4d[_0xe37b('0x45')][_0xe37b('0x30')]);}_0x56c5c8[_0xe37b('0x4c')]=qs[_0xe37b('0x4d')](_0x32ac4d[_0xe37b('0x45')][_0xe37b('0x4d')]);_0x56c5c8[_0xe37b('0x4e')]=qs[_0xe37b('0x47')](_['pick'](_0x32ac4d[_0xe37b('0x45')],_0x27784b[_0xe37b('0x47')]),_0x910515);if(_0x32ac4d[_0xe37b('0x45')][_0xe37b('0x4f')]){_0x56c5c8[_0xe37b('0x4e')]=_['merge'](_0x56c5c8[_0xe37b('0x4e')],{'$or':_[_0xe37b('0x40')](_0x910515,function(_0x3aa415){if(_0x3aa415['type']!==_0xe37b('0x50')){var _0x15ef81={};_0x15ef81[_0x3aa415[_0xe37b('0x3c')]]={'$like':'%'+_0x32ac4d[_0xe37b('0x45')]['filter']+'%'};return _0x15ef81;}})});}_0x56c5c8=_[_0xe37b('0x51')]({},_0x56c5c8,_0x32ac4d[_0xe37b('0x52')]);var _0x2e492e={'where':_0x56c5c8[_0xe37b('0x4e')]};return db[_0xe37b('0x41')]['count'](_0x2e492e)[_0xe37b('0x35')](function(_0x4d58e2){_0xa1b3f[_0xe37b('0x2f')]=_0x4d58e2;if(_0x32ac4d[_0xe37b('0x45')][_0xe37b('0x53')]){_0x56c5c8[_0xe37b('0x54')]=[{'all':!![]}];}return db[_0xe37b('0x41')][_0xe37b('0x55')](_0x56c5c8);})['then'](function(_0x222fbd){_0xa1b3f[_0xe37b('0x56')]=_0x222fbd;return _0xa1b3f;})[_0xe37b('0x35')](respondWithFilteredResult(_0x19a057,_0x56c5c8))[_0xe37b('0x29')](handleError(_0x19a057,null));};exports[_0xe37b('0x57')]=function(_0x3fe041,_0x432c6d){var _0x24aa99={'raw':![],'where':{'id':_0x3fe041[_0xe37b('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xe37b('0x3f')}]},_0x367405={};_0x367405[_0xe37b('0x44')]=_[_0xe37b('0x46')](db[_0xe37b('0x41')][_0xe37b('0x42')]);_0x367405[_0xe37b('0x45')]=_['keys'](_0x3fe041['query']);_0x367405[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x367405[_0xe37b('0x44')],_0x367405[_0xe37b('0x45')]);_0x24aa99[_0xe37b('0x49')]=_[_0xe37b('0x48')](_0x367405[_0xe37b('0x44')],qs[_0xe37b('0x4a')](_0x3fe041[_0xe37b('0x45')][_0xe37b('0x4a')]));_0x24aa99[_0xe37b('0x49')]=_0x24aa99['attributes']['length']?_0x24aa99[_0xe37b('0x49')]:_0x367405[_0xe37b('0x44')];if(_0x3fe041[_0xe37b('0x45')][_0xe37b('0x53')]){_0x24aa99[_0xe37b('0x54')]=[{'all':!![]}];}_0x24aa99=_[_0xe37b('0x51')]({},_0x24aa99,_0x3fe041[_0xe37b('0x52')]);return db[_0xe37b('0x41')][_0xe37b('0x59')](_0x24aa99)[_0xe37b('0x35')](handleEntityNotFound(_0x432c6d,null))[_0xe37b('0x35')](respondWithResult(_0x432c6d,null))['catch'](handleError(_0x432c6d,null));};exports['create']=function(_0xb2f748,_0x290337){return db['FaxAccount'][_0xe37b('0x5a')](_0xb2f748['body'],{})[_0xe37b('0x35')](function(_0x2cecfe){var _0x536d5c=_0xb2f748['user'][_0xe37b('0x37')]({'plain':!![]});if(!_0x536d5c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x536d5c[_0xe37b('0x5b')]==='user'){var _0x59d464=_0x2cecfe['get']({'plain':!![]});var _0x2dd500=_0xe37b('0x38');return db[_0xe37b('0x5c')]['find']({'where':{'name':_0x2dd500,'userProfileId':_0x536d5c[_0xe37b('0x5d')]},'raw':!![]})[_0xe37b('0x35')](function(_0x6f742a){if(_0x6f742a&&_0x6f742a['autoAssociation']===0x0){return db[_0xe37b('0x39')][_0xe37b('0x5a')]({'name':_0x59d464[_0xe37b('0x3c')],'resourceId':_0x59d464['id'],'type':_0x6f742a[_0xe37b('0x3c')],'sectionId':_0x6f742a['id']},{})[_0xe37b('0x35')](function(){return _0x2cecfe;});}else{return _0x2cecfe;}})[_0xe37b('0x29')](function(_0x1390f0){logger[_0xe37b('0x25')](_0xe37b('0x5e'),_0x1390f0);throw _0x1390f0;});}return _0x2cecfe;})[_0xe37b('0x35')](respondWithResult(_0x290337,0xc9))[_0xe37b('0x29')](handleError(_0x290337,null));};exports[_0xe37b('0x34')]=function(_0x4362bf,_0x37074d){if(_0x4362bf['body']['id']){delete _0x4362bf[_0xe37b('0x5f')]['id'];}return db['FaxAccount'][_0xe37b('0x59')]({'where':{'id':_0x4362bf[_0xe37b('0x58')]['id']},'include':[{'model':db[_0xe37b('0x60')],'as':_0xe37b('0x3f')}]})['then'](handleEntityNotFound(_0x37074d,null))[_0xe37b('0x35')](saveUpdates(_0x4362bf[_0xe37b('0x5f')],null))[_0xe37b('0x35')](respondWithResult(_0x37074d,null))['catch'](handleError(_0x37074d,null));};exports[_0xe37b('0x36')]=function(_0x3b4a2d,_0x4cc8ca){return db[_0xe37b('0x41')]['find']({'where':{'id':_0x3b4a2d['params']['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x4cc8ca,null))['then'](removeEntity(_0x4cc8ca,null))[_0xe37b('0x29')](handleError(_0x4cc8ca,null));};exports['describe']=function(_0x2c25f2,_0x2ea6e6){return db['FaxAccount'][_0xe37b('0x61')]()[_0xe37b('0x35')](respondWithResult(_0x2ea6e6,null))[_0xe37b('0x29')](handleError(_0x2ea6e6,null));};exports[_0xe37b('0x62')]=function(_0x5806d8,_0x37b2e7,_0x4b1c26){if(_0x5806d8['body']['id']){delete _0x5806d8[_0xe37b('0x5f')]['id'];}return db[_0xe37b('0x41')][_0xe37b('0x59')]({'where':{'id':_0x5806d8[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x37b2e7,null))[_0xe37b('0x35')](function(_0x30f0b6){if(_0x30f0b6){_0x5806d8[_0xe37b('0x5f')][_0xe37b('0x63')]=_0x30f0b6['id'];return db['Disposition'][_0xe37b('0x5a')](_0x5806d8[_0xe37b('0x5f')]);}})['then'](respondWithResult(_0x37b2e7,null))['catch'](handleError(_0x37b2e7,null));};exports[_0xe37b('0x64')]=function(_0xfad093,_0x1b4472,_0xa165fe){var _0x1f62bd={'raw':![],'where':{}};var _0x3fbf9b={};var _0x3f6b08={'count':0x0,'rows':[]};return db[_0xe37b('0x41')][_0xe37b('0x65')]({'where':{'id':_0xfad093[_0xe37b('0x58')]['id']}})['then'](handleEntityNotFound(_0x1b4472,null))['then'](function(_0x11f2d9){if(_0x11f2d9){_0x3fbf9b['model']=_['keys'](db[_0xe37b('0x66')]['rawAttributes']);_0x3fbf9b[_0xe37b('0x45')]=_[_0xe37b('0x46')](_0xfad093[_0xe37b('0x45')]);_0x3fbf9b[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x3fbf9b[_0xe37b('0x44')],_0x3fbf9b[_0xe37b('0x45')]);_0x1f62bd['attributes']=_[_0xe37b('0x48')](_0x3fbf9b['model'],qs[_0xe37b('0x4a')](_0xfad093['query'][_0xe37b('0x4a')]));_0x1f62bd[_0xe37b('0x49')]=_0x1f62bd[_0xe37b('0x49')][_0xe37b('0x67')]?_0x1f62bd[_0xe37b('0x49')]:_0x3fbf9b['model'];if(!_0xfad093[_0xe37b('0x45')][_0xe37b('0x68')](_0xe37b('0x4b'))){_0x1f62bd[_0xe37b('0x2e')]=qs['limit'](_0xfad093['query'][_0xe37b('0x2e')]);_0x1f62bd[_0xe37b('0x30')]=qs['offset'](_0xfad093['query']['offset']);}_0x1f62bd[_0xe37b('0x4c')]=qs[_0xe37b('0x4d')](_0xfad093[_0xe37b('0x45')][_0xe37b('0x4d')]);_0x1f62bd[_0xe37b('0x4e')]=qs[_0xe37b('0x47')](_[_0xe37b('0x69')](_0xfad093[_0xe37b('0x45')],_0x3fbf9b[_0xe37b('0x47')]));_0x1f62bd[_0xe37b('0x4e')][_0xe37b('0x63')]=_0x11f2d9['id'];if(_0xfad093[_0xe37b('0x45')][_0xe37b('0x4f')]){_0x1f62bd[_0xe37b('0x4e')]=_[_0xe37b('0x51')](_0x1f62bd['where'],{'$or':_[_0xe37b('0x40')](_0x1f62bd[_0xe37b('0x49')],function(_0x331a45){var _0x581ebc={};_0x581ebc[_0x331a45]={'$like':'%'+_0xfad093[_0xe37b('0x45')]['filter']+'%'};return _0x581ebc;})});}_0x1f62bd=_[_0xe37b('0x51')]({},_0x1f62bd,_0xfad093['options']);return db[_0xe37b('0x66')][_0xe37b('0x2f')]({'where':_0x1f62bd[_0xe37b('0x4e')]})[_0xe37b('0x35')](function(_0x42912e){_0x3f6b08['count']=_0x42912e;if(_0xfad093['query']['includeAll']){_0x1f62bd[_0xe37b('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xe37b('0x55')](_0x1f62bd);})['then'](function(_0x592f2c){_0x3f6b08[_0xe37b('0x56')]=_0x592f2c;return _0x3f6b08;});}})[_0xe37b('0x35')](respondWithFilteredResult(_0x1b4472,_0x1f62bd))[_0xe37b('0x29')](handleError(_0x1b4472,null));};exports[_0xe37b('0x6a')]=function(_0x120bfc,_0x2e379b,_0x7816b1){return db[_0xe37b('0x41')][_0xe37b('0x59')]({'where':{'id':_0x120bfc[_0xe37b('0x58')]['id']}})['then'](handleEntityNotFound(_0x2e379b,null))[_0xe37b('0x35')](function(_0x1f9b29){if(_0x1f9b29){return _0x1f9b29['removeDispositions'](_0x120bfc[_0xe37b('0x45')][_0xe37b('0x6b')]);}})[_0xe37b('0x35')](respondWithStatusCode(_0x2e379b,null))[_0xe37b('0x29')](handleError(_0x2e379b,null));};exports['addAnswer']=function(_0x1d28e8,_0x101c66,_0x224dee){if(_0x1d28e8[_0xe37b('0x5f')]['id']){delete _0x1d28e8[_0xe37b('0x5f')]['id'];}return db[_0xe37b('0x41')][_0xe37b('0x59')]({'where':{'id':_0x1d28e8[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x101c66,null))[_0xe37b('0x35')](function(_0x4c9bc3){if(_0x4c9bc3){_0x1d28e8[_0xe37b('0x5f')][_0xe37b('0x63')]=_0x4c9bc3['id'];return db['CannedAnswer'][_0xe37b('0x5a')](_0x1d28e8[_0xe37b('0x5f')]);}})[_0xe37b('0x35')](respondWithResult(_0x101c66,null))['catch'](handleError(_0x101c66,null));};exports[_0xe37b('0x6c')]=function(_0x4fb0d8,_0x37547f,_0x2bd311){var _0x48b0c9={'raw':![],'where':{}};var _0x371be0={};var _0x2da1ee={'count':0x0,'rows':[]};return db[_0xe37b('0x41')][_0xe37b('0x65')]({'where':{'id':_0x4fb0d8[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x37547f,null))[_0xe37b('0x35')](function(_0xcaf5ed){if(_0xcaf5ed){_0x371be0[_0xe37b('0x44')]=_[_0xe37b('0x46')](db[_0xe37b('0x6d')][_0xe37b('0x42')]);_0x371be0[_0xe37b('0x45')]=_[_0xe37b('0x46')](_0x4fb0d8[_0xe37b('0x45')]);_0x371be0[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x371be0[_0xe37b('0x44')],_0x371be0['query']);_0x48b0c9['attributes']=_[_0xe37b('0x48')](_0x371be0['model'],qs[_0xe37b('0x4a')](_0x4fb0d8[_0xe37b('0x45')][_0xe37b('0x4a')]));_0x48b0c9[_0xe37b('0x49')]=_0x48b0c9[_0xe37b('0x49')]['length']?_0x48b0c9[_0xe37b('0x49')]:_0x371be0[_0xe37b('0x44')];if(!_0x4fb0d8['query'][_0xe37b('0x68')]('nolimit')){_0x48b0c9['limit']=qs[_0xe37b('0x2e')](_0x4fb0d8[_0xe37b('0x45')][_0xe37b('0x2e')]);_0x48b0c9[_0xe37b('0x30')]=qs[_0xe37b('0x30')](_0x4fb0d8[_0xe37b('0x45')][_0xe37b('0x30')]);}_0x48b0c9['order']=qs[_0xe37b('0x4d')](_0x4fb0d8['query'][_0xe37b('0x4d')]);_0x48b0c9[_0xe37b('0x4e')]=qs[_0xe37b('0x47')](_['pick'](_0x4fb0d8[_0xe37b('0x45')],_0x371be0[_0xe37b('0x47')]));_0x48b0c9[_0xe37b('0x4e')][_0xe37b('0x63')]=_0xcaf5ed['id'];if(_0x4fb0d8[_0xe37b('0x45')]['filter']){_0x48b0c9[_0xe37b('0x4e')]=_[_0xe37b('0x51')](_0x48b0c9['where'],{'$or':_[_0xe37b('0x40')](_0x48b0c9[_0xe37b('0x49')],function(_0x593530){var _0x32186d={};_0x32186d[_0x593530]={'$like':'%'+_0x4fb0d8[_0xe37b('0x45')]['filter']+'%'};return _0x32186d;})});}_0x48b0c9=_[_0xe37b('0x51')]({},_0x48b0c9,_0x4fb0d8[_0xe37b('0x52')]);return db['CannedAnswer']['count']({'where':_0x48b0c9[_0xe37b('0x4e')]})['then'](function(_0x5c3763){_0x2da1ee[_0xe37b('0x2f')]=_0x5c3763;if(_0x4fb0d8[_0xe37b('0x45')][_0xe37b('0x53')]){_0x48b0c9['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xe37b('0x55')](_0x48b0c9);})[_0xe37b('0x35')](function(_0x5ca5f4){_0x2da1ee[_0xe37b('0x56')]=_0x5ca5f4;return _0x2da1ee;});}})[_0xe37b('0x35')](respondWithFilteredResult(_0x37547f,_0x48b0c9))[_0xe37b('0x29')](handleError(_0x37547f,null));};exports['removeAnswers']=function(_0x5551ba,_0x5c54f4,_0x3e02bd){return db[_0xe37b('0x41')][_0xe37b('0x59')]({'where':{'id':_0x5551ba['params']['id']}})['then'](handleEntityNotFound(_0x5c54f4,null))[_0xe37b('0x35')](function(_0x13d776){if(_0x13d776){return _0x13d776[_0xe37b('0x6e')](_0x5551ba[_0xe37b('0x45')][_0xe37b('0x6b')]);}})['then'](respondWithStatusCode(_0x5c54f4,null))[_0xe37b('0x29')](handleError(_0x5c54f4,null));};exports[_0xe37b('0x6f')]=function(_0x4946f7,_0x527521,_0xc2d2af){return db['FaxInteraction']['find']({'where':{'id':_0x4946f7[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x527521,null))[_0xe37b('0x35')](function(_0x4fa8e5){if(_0x4fa8e5){return _0x4fa8e5['addInteraction'](_0x4946f7[_0xe37b('0x5f')]['ids'],_[_0xe37b('0x70')](_0x4946f7['body'],[_0xe37b('0x6b'),'id'])||{});}})[_0xe37b('0x35')](respondWithResult(_0x527521,null))[_0xe37b('0x29')](handleError(_0x527521,null));};exports[_0xe37b('0x71')]=function(_0x18c0b7,_0x211c85,_0x26edf2){var _0x234f98={'raw':![],'where':{}};var _0x59f5ea={};var _0x2b740c={'count':0x0,'rows':[]};return db[_0xe37b('0x41')]['findOne']({'where':{'id':_0x18c0b7[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x211c85,null))[_0xe37b('0x35')](function(_0x1f0c30){if(_0x1f0c30){_0x59f5ea[_0xe37b('0x44')]=_[_0xe37b('0x46')](db[_0xe37b('0x72')]['rawAttributes']);_0x59f5ea[_0xe37b('0x45')]=_[_0xe37b('0x46')](_0x18c0b7[_0xe37b('0x45')]);_0x59f5ea[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x59f5ea[_0xe37b('0x44')],_0x59f5ea[_0xe37b('0x45')]);_0x234f98[_0xe37b('0x49')]=_[_0xe37b('0x48')](_0x59f5ea[_0xe37b('0x44')],qs['fields'](_0x18c0b7['query'][_0xe37b('0x4a')]));_0x234f98[_0xe37b('0x49')]=_0x234f98[_0xe37b('0x49')][_0xe37b('0x67')]?_0x234f98[_0xe37b('0x49')]:_0x59f5ea[_0xe37b('0x44')];if(!_0x18c0b7[_0xe37b('0x45')][_0xe37b('0x68')](_0xe37b('0x4b'))){_0x234f98['limit']=qs['limit'](_0x18c0b7[_0xe37b('0x45')][_0xe37b('0x2e')]);_0x234f98[_0xe37b('0x30')]=qs[_0xe37b('0x30')](_0x18c0b7[_0xe37b('0x45')]['offset']);}_0x234f98[_0xe37b('0x4c')]=qs['sort'](_0x18c0b7[_0xe37b('0x45')]['sort']);_0x234f98[_0xe37b('0x4e')]=qs[_0xe37b('0x47')](_[_0xe37b('0x69')](_0x18c0b7[_0xe37b('0x45')],_0x59f5ea['filters']));_0x234f98[_0xe37b('0x4e')][_0xe37b('0x63')]=_0x1f0c30['id'];if(_0x18c0b7[_0xe37b('0x45')][_0xe37b('0x4f')]){_0x234f98[_0xe37b('0x4e')]=_['merge'](_0x234f98['where'],{'$or':_[_0xe37b('0x40')](_0x234f98[_0xe37b('0x49')],function(_0x541ddb){var _0x2ba034={};_0x2ba034[_0x541ddb]={'$like':'%'+_0x18c0b7[_0xe37b('0x45')][_0xe37b('0x4f')]+'%'};return _0x2ba034;})});}_0x234f98=_[_0xe37b('0x51')]({},_0x234f98,_0x18c0b7['options']);return db[_0xe37b('0x72')][_0xe37b('0x2f')]({'where':_0x234f98[_0xe37b('0x4e')]})[_0xe37b('0x35')](function(_0x30ed19){_0x2b740c[_0xe37b('0x2f')]=_0x30ed19;if(_0x18c0b7[_0xe37b('0x45')][_0xe37b('0x53')]){_0x234f98[_0xe37b('0x54')]=[{'model':db[_0xe37b('0x73')],'as':_0xe37b('0x74'),'required':![]},{'model':db[_0xe37b('0x75')],'as':_0xe37b('0x76'),'attributes':['name',_0xe37b('0x77'),_0xe37b('0x78')],'required':![]},{'model':db[_0xe37b('0x79')],'as':_0xe37b('0x7a'),'attributes':['id',_0xe37b('0x3c'),'color'],'where':_0x18c0b7[_0xe37b('0x45')]['tag']?{'id':_0x18c0b7[_0xe37b('0x45')][_0xe37b('0x7b')]}:undefined,'required':_0x18c0b7['query']['tag']?!![]:![]}];}return db[_0xe37b('0x72')][_0xe37b('0x55')](_0x234f98);})[_0xe37b('0x35')](function(_0x56723e){_0x2b740c[_0xe37b('0x56')]=_0x56723e;return _0x2b740c;});}})[_0xe37b('0x35')](respondWithFilteredResult(_0x211c85,_0x234f98))[_0xe37b('0x29')](handleError(_0x211c85,null));};exports['addApplications']=function(_0x1eb9b2,_0x120990){var _0xddac6e=_0x1eb9b2[_0xe37b('0x58')]['id'];var _0x14cf3c=_0x1eb9b2[_0xe37b('0x5f')];var _0x526240=0xc8;var _0x2944c2=null;return db[_0xe37b('0x7c')]['transaction']({'isolationLevel':db[_0xe37b('0x7c')][_0xe37b('0x7d')][_0xe37b('0x7e')][_0xe37b('0x7f')]},function(_0x1df10d){return db[_0xe37b('0x41')][_0xe37b('0x65')]({'where':{'id':_0xddac6e},'transaction':_0x1df10d})['then'](function(_0x4be4fb){if(_0x4be4fb){return db['FaxApplication'][_0xe37b('0x36')]({'where':{'FaxAccountId':_0xddac6e},'transaction':_0x1df10d})[_0xe37b('0x35')](function(){var _0x2236fd=_['map'](_0x14cf3c,function(_0x389587){_0x389587[_0xe37b('0x63')]=_0xddac6e;return _0x389587;});return db[_0xe37b('0x80')]['bulkCreate'](_0x2236fd,{'transaction':_0x1df10d});});}else{_0x526240=0x194;_0x2944c2=[];}});})[_0xe37b('0x35')](function(){if(_0x526240!==0x194){return db[_0xe37b('0x80')][_0xe37b('0x81')]({'where':{'FaxAccountId':_0xddac6e},'order':_0xe37b('0x82')})[_0xe37b('0x35')](function(_0x558aa9){_0x2944c2=_0x558aa9;});}})['catch'](function(_0x5a073a){_0x526240=0x1f4;logger[_0xe37b('0x25')](_0x5a073a[_0xe37b('0x3b')]);if(_0x5a073a['name']){delete _0x5a073a[_0xe37b('0x3c')];}_0x2944c2=_0x5a073a;})[_0xe37b('0x83')](function(){if(_0x2944c2===null){_0x120990[_0xe37b('0x3a')](_0x526240);}else{if(_0x526240===0x1f4){_0x120990[_0xe37b('0x2a')](_0x526240)[_0xe37b('0x3d')](_0x2944c2);}else{_0x120990[_0xe37b('0x2a')](_0x526240)[_0xe37b('0x2c')](_0x2944c2);}}});};exports[_0xe37b('0x84')]=function(_0x42e094,_0x2fe464,_0x117c40){var _0x10ec60={};var _0x27188b={};var _0x3ac134;var _0x57bfb1;return db[_0xe37b('0x41')][_0xe37b('0x65')]({'where':{'id':_0x42e094[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x2fe464,null))[_0xe37b('0x35')](function(_0x1f3239){if(_0x1f3239){_0x3ac134=_0x1f3239;_0x27188b['model']=_[_0xe37b('0x46')](db['FaxApplication'][_0xe37b('0x42')]);_0x27188b[_0xe37b('0x45')]=_['keys'](_0x42e094['query']);_0x27188b[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x27188b['model'],_0x27188b[_0xe37b('0x45')]);_0x10ec60[_0xe37b('0x49')]=_[_0xe37b('0x48')](_0x27188b[_0xe37b('0x44')],qs['fields'](_0x42e094[_0xe37b('0x45')][_0xe37b('0x4a')]));_0x10ec60[_0xe37b('0x49')]=_0x10ec60['attributes'][_0xe37b('0x67')]?_0x10ec60[_0xe37b('0x49')]:_0x27188b[_0xe37b('0x44')];_0x10ec60['order']=qs[_0xe37b('0x4d')](_0x42e094[_0xe37b('0x45')][_0xe37b('0x4d')]);_0x10ec60[_0xe37b('0x4e')]=qs[_0xe37b('0x47')](_[_0xe37b('0x69')](_0x42e094[_0xe37b('0x45')],_0x27188b['filters']));if(_0x42e094['query']['filter']){_0x10ec60[_0xe37b('0x4e')]=_['merge'](_0x10ec60[_0xe37b('0x4e')],{'$or':_[_0xe37b('0x40')](_0x10ec60[_0xe37b('0x49')],function(_0x2b65a6){var _0x40f80c={};_0x40f80c[_0x2b65a6]={'$like':'%'+_0x42e094[_0xe37b('0x45')][_0xe37b('0x4f')]+'%'};return _0x40f80c;})});}_0x10ec60=_['merge']({},_0x10ec60,_0x42e094[_0xe37b('0x52')]);return _0x3ac134[_0xe37b('0x84')](_0x10ec60);}})[_0xe37b('0x35')](function(_0x779416){if(_0x779416){_0x57bfb1=_0x779416['length'];if(!_0x42e094['query'][_0xe37b('0x68')]('nolimit')){_0x10ec60[_0xe37b('0x2e')]=qs[_0xe37b('0x2e')](_0x42e094[_0xe37b('0x45')]['limit']);_0x10ec60['offset']=qs['offset'](_0x42e094['query'][_0xe37b('0x30')]);}return _0x3ac134[_0xe37b('0x84')](_0x10ec60);}})[_0xe37b('0x35')](function(_0xc2c415){if(_0xc2c415){return _0xc2c415?{'count':_0x57bfb1,'rows':_0xc2c415}:null;}})[_0xe37b('0x35')](respondWithResult(_0x2fe464,null))[_0xe37b('0x29')](handleError(_0x2fe464,null));};function Extension(_0x3b0c0e,_0x12ee1e,_0x15698f,_0x13dbbe){this['context']=_0xe37b('0x85');this[_0xe37b('0x86')]=_0x3b0c0e[_0xe37b('0x87')];this[_0xe37b('0x88')]=_0x13dbbe;this[_0xe37b('0x43')]=_0xe37b('0x89');this[_0xe37b('0x8a')]=_0xe37b('0x8b');this[_0xe37b('0x63')]=_0x3b0c0e['id'];this[_0xe37b('0x82')]=_0x12ee1e;this[_0xe37b('0x8c')]=_0x15698f;}function createExtensionsReciveFax(_0x4e8b23){var _0xc0277c=0x1;var _0x4e562f=[];_0x4e562f[_0xe37b('0x8d')](new Extension(_0x4e8b23,_0xc0277c,'',_0xe37b('0x8e')));_0xc0277c+=0x1;_0x4e562f[_0xe37b('0x8d')](new Extension(_0x4e8b23,_0xc0277c,_0xe37b('0x8f'),_0xe37b('0x90')));_0xc0277c+=0x1;for(var _0x2ec17d in _0x4e8b23){if(_0x4e8b23[_0xe37b('0x68')](_0x2ec17d)&&(_0x2ec17d===_0xe37b('0x91')||_0x2ec17d===_0xe37b('0x87')||_0x2ec17d==='gateway'||_0x2ec17d==='faxdetect'||_0x2ec17d==='headerinfo'||_0x2ec17d===_0xe37b('0x92')||_0x2ec17d===_0xe37b('0x93')||_0x2ec17d===_0xe37b('0x94')||_0x2ec17d===_0xe37b('0x95'))){_0x4e562f['push'](new Extension(_0x4e8b23,_0xc0277c,_0xe37b('0x96')+_0x2ec17d+')='+_0x4e8b23[_0x2ec17d],_0xe37b('0x90')));_0xc0277c+=0x1;}}_0x4e562f[_0xe37b('0x8d')](new Extension(_0x4e8b23,_0xc0277c,'6',_0xe37b('0x97')));_0xc0277c+=0x1;_0x4e562f['push'](new Extension(_0x4e8b23,_0xc0277c,'/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',_0xe37b('0x98')));_0xc0277c=0x0;return _0x4e562f;}exports[_0xe37b('0x99')]=function(_0x490cbe,_0x27a5b7,_0xd70508){var _0x845acb;return db[_0xe37b('0x7c')][_0xe37b('0x9a')](function(_0x2ebcb8){return db['FaxAccount'][_0xe37b('0x5a')](_0x490cbe[_0xe37b('0x5f')],{'transaction':_0x2ebcb8})[_0xe37b('0x35')](function(_0x526f58){_0x845acb=_0x526f58[_0xe37b('0x37')]({'plain':!![]});return db[_0xe37b('0x9b')]['bulkCreate'](createExtensionsReciveFax(_0x845acb),{'transaction':_0x2ebcb8});});})[_0xe37b('0x35')](function(){return _0x845acb;})['then'](respondWithResult(_0x27a5b7,null))[_0xe37b('0x29')](handleError(_0x27a5b7,null));};exports['updateAccountApplications']=function(_0x1cd192,_0xc2aced,_0x5117a3){var _0x3e8017;return db[_0xe37b('0x7c')]['transaction'](function(_0x484ec2){return db[_0xe37b('0x41')][_0xe37b('0x34')](_0x1cd192['body'],{'where':{'id':_0x1cd192[_0xe37b('0x5f')]['id']},'transaction':_0x484ec2})['then'](function(_0x3b2282){return db[_0xe37b('0x9b')]['destroy']({'where':{'FaxAccountId':_0x1cd192[_0xe37b('0x5f')]['id']},'transaction':_0x484ec2})[_0xe37b('0x35')](function(_0x3beb99){return db[_0xe37b('0x9b')][_0xe37b('0x9c')](createExtensionsReciveFax(_[_0xe37b('0x70')](_0x1cd192[_0xe37b('0x5f')],[_0xe37b('0x9d'),_0xe37b('0x9e'),_0xe37b('0x9f'),'updatedAt',_0xe37b('0xa0'),_0xe37b('0xa1')])),{'transaction':_0x484ec2});});});})[_0xe37b('0x35')](function(){return db[_0xe37b('0x41')]['findById'](_0x1cd192[_0xe37b('0x5f')]['id']);})['then'](respondWithResult(_0xc2aced,null))[_0xe37b('0x29')](handleError(_0xc2aced,null));};exports[_0xe37b('0xa2')]=function(_0x807984,_0x8b5a40,_0x166a54){var _0x3f6c54={'raw':!![],'where':{}};var _0x2ef41a={};var _0x258753={'count':0x0,'rows':[]};return db['FaxAccount']['findOne']({'where':{'id':_0x807984[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x8b5a40,null))[_0xe37b('0x35')](function(_0x1f7c5d){if(_0x1f7c5d){_0x2ef41a[_0xe37b('0x44')]=_[_0xe37b('0x46')](db[_0xe37b('0xa3')]['rawAttributes']);_0x2ef41a[_0xe37b('0x45')]=_['keys'](_0x807984[_0xe37b('0x45')]);_0x2ef41a[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x2ef41a[_0xe37b('0x44')],_0x2ef41a[_0xe37b('0x45')]);_0x3f6c54[_0xe37b('0x49')]=_['intersection'](_0x2ef41a[_0xe37b('0x44')],qs[_0xe37b('0x4a')](_0x807984[_0xe37b('0x45')][_0xe37b('0x4a')]));_0x3f6c54['attributes']=_0x3f6c54[_0xe37b('0x49')][_0xe37b('0x67')]?_0x3f6c54[_0xe37b('0x49')]:_0x2ef41a[_0xe37b('0x44')];if(!_0x807984[_0xe37b('0x45')][_0xe37b('0x68')]('nolimit')){_0x3f6c54[_0xe37b('0x2e')]=qs[_0xe37b('0x2e')](_0x807984[_0xe37b('0x45')]['limit']);_0x3f6c54[_0xe37b('0x30')]=qs[_0xe37b('0x30')](_0x807984[_0xe37b('0x45')][_0xe37b('0x30')]);}_0x3f6c54[_0xe37b('0x4c')]=qs[_0xe37b('0x4d')](_0x807984['query'][_0xe37b('0x4d')]);_0x3f6c54[_0xe37b('0x4e')]=qs[_0xe37b('0x47')](_[_0xe37b('0x69')](_0x807984[_0xe37b('0x45')],_0x2ef41a[_0xe37b('0x47')]));_0x3f6c54['where'][_0xe37b('0x63')]=_0x1f7c5d['id'];if(_0x807984[_0xe37b('0x45')][_0xe37b('0x4f')]){_0x3f6c54[_0xe37b('0x4e')]=_['merge'](_0x3f6c54[_0xe37b('0x4e')],{'$or':_['map'](_0x3f6c54[_0xe37b('0x49')],function(_0x2e0e68){var _0xc094db={};_0xc094db[_0x2e0e68]={'$like':'%'+_0x807984[_0xe37b('0x45')][_0xe37b('0x4f')]+'%'};return _0xc094db;})});}if(_0x807984[_0xe37b('0x45')][_0xe37b('0xa4')]){var _0x4d86f1=_0x807984[_0xe37b('0x45')]['$gte'][_0xe37b('0xa5')](',');var _0x4d458d={};_0x4d458d[_0x4d86f1[0x0]]={'$gte':moment(_0x4d86f1[0x1])[_0xe37b('0xa6')](_0xe37b('0xa7'))};_0x3f6c54[_0xe37b('0x4e')]=_['merge'](_0x3f6c54[_0xe37b('0x4e')],_0x4d458d);}_0x3f6c54=_['merge']({},_0x3f6c54,_0x807984[_0xe37b('0x52')]);return db[_0xe37b('0xa3')][_0xe37b('0x2f')]({'where':_0x3f6c54[_0xe37b('0x4e')]})[_0xe37b('0x35')](function(_0x1b2b4f){_0x258753[_0xe37b('0x2f')]=_0x1b2b4f;if(_0x807984['query'][_0xe37b('0x53')]){_0x3f6c54[_0xe37b('0x54')]=[{'all':!![]}];}return db[_0xe37b('0xa3')]['findAll'](_0x3f6c54);})[_0xe37b('0x35')](function(_0x2df8ad){_0x258753[_0xe37b('0x56')]=_0x2df8ad;return _0x258753;});}})[_0xe37b('0x35')](respondWithFilteredResult(_0x8b5a40,_0x3f6c54))[_0xe37b('0x29')](handleError(_0x8b5a40,null));};exports['send']=function(_0x2f325a,_0x349637,_0x445f14){var _0x3ecc2f,_0x26582a={},_0x54b30f;if(_0x2f325a[_0xe37b('0x5f')]['to']){_0x54b30f=_0x2f325a['body']['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x2f325a[_0xe37b('0x58')]['id']},'include':[{'model':db[_0xe37b('0xa8')],'as':'List','include':[{'model':db[_0xe37b('0x73')],'as':_0xe37b('0xa9'),'where':{'fax':_0x54b30f},'limit':0x1,'order':[['updatedAt',_0xe37b('0xaa')]]}]}]})[_0xe37b('0x35')](handleEntityNotFound(_0x349637,null))[_0xe37b('0x35')](function(_0x559deb){_0x3ecc2f=_0x559deb;if(_0x2f325a[_0xe37b('0x5f')]['attachments']&&_0x2f325a[_0xe37b('0x5f')]['attachments'][_0xe37b('0x67')]){for(var _0x47b41a=0x0;_0x47b41a<_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')]['length'];_0x47b41a+=0x1){_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][_0x47b41a]={'filename':_0x2f325a[_0xe37b('0x5f')]['attachments'][_0x47b41a][_0xe37b('0x3c')],'id':_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][_0x47b41a]['id'],'path':path[_0xe37b('0xac')](config[_0xe37b('0xad')],_0xe37b('0xae'),_0x2f325a[_0xe37b('0x5f')]['attachments'][_0x47b41a][_0xe37b('0xaf')])};}}return respondWithRpcPromise(_0xe37b('0xb0'),_0xe37b('0xb0'),{'FaxAccountId':_[_0xe37b('0xb1')](_0x2f325a[_0xe37b('0x58')]['id'])?undefined:_0x2f325a[_0xe37b('0x58')]['id'],'path':_[_0xe37b('0xb1')](_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][0x0][_0xe37b('0x6')])?undefined:_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][0x0][_0xe37b('0x6')],'fax':_[_0xe37b('0xb1')](_0x2f325a['body']['to'][0x0])?undefined:_0x2f325a[_0xe37b('0x5f')]['to'][0x0]},client9002);})['then'](function(){if(_0x3ecc2f){if(_[_0xe37b('0xb1')](_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xb2')])){_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xb2')]=util[_0xe37b('0xa6')](_0xe37b('0xb3'),_0x3ecc2f['name'],_0x3ecc2f[_0xe37b('0xb4')]);}if(_0x3ecc2f[_0xe37b('0xb5')]){if(_0x3ecc2f[_0xe37b('0xb5')][_0xe37b('0xa9')][_0xe37b('0x67')]){return _0x3ecc2f[_0xe37b('0xb5')][_0xe37b('0xa9')][0x0];}else{return db[_0xe37b('0x73')][_0xe37b('0x5a')](_['defaults'](_0x2f325a[_0xe37b('0x5f')],{'firstName':_0x2f325a[_0xe37b('0x5f')]['to'][0x0],'phone':_0x2f325a[_0xe37b('0x5f')]['to'][0x0],'fax':_0x2f325a[_0xe37b('0x5f')]['to'][0x0],'ListId':_0x3ecc2f[_0xe37b('0xa1')]}));}}else{throw new Error(_0xe37b('0xb6'));}}else{throw new Error('Send\x20Fax\x20failed');}})[_0xe37b('0x35')](function(_0x1b2e46){if(_0x1b2e46){return db['FaxInteraction'][_0xe37b('0x59')]({'where':{'ContactId':_0x1b2e46['id'],'closed':![],'FaxAccountId':_0x3ecc2f['id']}})[_0xe37b('0x35')](function(_0x25d690){if(_0x25d690){return[_0x25d690,![]];}return db['FaxInteraction'][_0xe37b('0x5a')]({'UserId':_0x2f325a[_0xe37b('0xb7')]['id'],'ContactId':_0x1b2e46['id'],'FaxAccountId':_0x3ecc2f['id'],'fax':_0x2f325a[_0xe37b('0x5f')]['to'][0x0],'firstMsgDirection':'out','Messages':[_[_0xe37b('0x51')](_0x2f325a[_0xe37b('0x5f')],{'read':![],'body':_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][0x0][_0xe37b('0xb8')],'FaxAccountId':_0x3ecc2f['id'],'UserId':_0x2f325a[_0xe37b('0xb7')]['id'],'ContactId':_0x1b2e46['id'],'AttachmentId':_0x2f325a['body'][_0xe37b('0xab')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xe37b('0xb9')}]})[_0xe37b('0x35')](function(_0x43693b){return[_0x43693b,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x49e22c,_0x479841){if(_0x479841){return _0x49e22c;}return db[_0xe37b('0xa3')][_0xe37b('0x5a')]({'direction':_0xe37b('0xba'),'read':![],'body':_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][0x0][_0xe37b('0xb8')],'FaxAccountId':_0x3ecc2f['id'],'FaxInteractionId':_0x49e22c['id'],'UserId':_0x2f325a[_0xe37b('0xb7')]['id'],'ContactId':_0x49e22c['ContactId'],'AttachmentId':_0x2f325a[_0xe37b('0x5f')]['attachments'][0x0]['id']})[_0xe37b('0x35')](function(_0x1a0ab3){_0x49e22c[_0xe37b('0xbb')][_0xe37b('0xb9')]=[];_0x49e22c['dataValues'][_0xe37b('0xb9')][_0xe37b('0x8d')](_0x1a0ab3[_0xe37b('0xbb')]);return _0x49e22c;});})[_0xe37b('0x35')](function(_0x5bb01c){respondWithRpcPromise(_0xe37b('0xbc'),'SendFax',{'FaxAccountId':_[_0xe37b('0xb1')](_0x2f325a['params']['id'])?undefined:_0x2f325a[_0xe37b('0x58')]['id'],'path':_[_0xe37b('0xb1')](_0x2f325a['body'][_0xe37b('0xab')][0x0]['path'])?undefined:_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][0x0][_0xe37b('0x6')],'fax':_[_0xe37b('0xb1')](_0x2f325a[_0xe37b('0x5f')]['to'][0x0])?undefined:_0x2f325a['body']['to'][0x0],'AttachmentId':_0x2f325a[_0xe37b('0x5f')][_0xe37b('0xab')][0x0]['id']},client9002)[_0xe37b('0x35')](function(_0x4dffad){logger['info'](_0xe37b('0xbd'),_0x4dffad);})[_0xe37b('0x29')](function(_0x89ecfe){logger[_0xe37b('0x20')](_0xe37b('0xbd'),_0x89ecfe);});return _0x5bb01c;})[_0xe37b('0x35')](respondWithResult(_0x349637,null))[_0xe37b('0x29')](handleError(_0x349637,null));};exports[_0xe37b('0xbe')]=function(_0x3a7d63,_0x3eaf10,_0x531741){return db['FaxAccount'][_0xe37b('0x59')]({'where':{'id':_0x3a7d63[_0xe37b('0x58')]['id']}})['then'](handleEntityNotFound(_0x3eaf10,null))[_0xe37b('0x35')](function(_0x17a3fa){if(_0x17a3fa){return _0x17a3fa[_0xe37b('0xbe')](_0x3a7d63[_0xe37b('0x5f')][_0xe37b('0x6b')],_[_0xe37b('0x70')](_0x3a7d63[_0xe37b('0x5f')],[_0xe37b('0x6b'),'id'])||{})[_0xe37b('0xbf')](function(_0xe8231f){for(var _0x4e2ef4=0x0;_0x4e2ef4<_0x3a7d63[_0xe37b('0x5f')][_0xe37b('0x6b')][_0xe37b('0x67')];_0x4e2ef4+=0x1){socket['emit'](_0xe37b('0xc0'),{'UserId':Number(_0x3a7d63['body'][_0xe37b('0x6b')][_0x4e2ef4]),'FaxAccountId':Number(_0x3a7d63['params']['id'])});}return _0xe8231f;});}})[_0xe37b('0x35')](respondWithResult(_0x3eaf10,null))['catch'](handleError(_0x3eaf10,null));};exports[_0xe37b('0xc1')]=function(_0x53c935,_0x4bfa37,_0x208046){return db[_0xe37b('0x41')][_0xe37b('0x59')]({'where':{'id':_0x53c935['params']['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x4bfa37,null))['then'](function(_0x102194){if(_0x102194){return _0x102194[_0xe37b('0xc1')](_0x53c935[_0xe37b('0x45')]['ids'])['then'](function(){if(_[_0xe37b('0xc2')](_0x53c935[_0xe37b('0x45')][_0xe37b('0x6b')])){for(var _0x5ecd54=0x0;_0x5ecd54<_0x53c935['query']['ids'][_0xe37b('0x67')];_0x5ecd54+=0x1){socket[_0xe37b('0xc3')](_0xe37b('0xc4'),{'UserId':Number(_0x53c935['query']['ids'][_0x5ecd54]),'FaxAccountId':Number(_0x53c935['params']['id'])});}}else{socket[_0xe37b('0xc3')]('userFaxAccount:remove',{'UserId':Number(_0x53c935[_0xe37b('0x45')]['ids']),'FaxAccountId':Number(_0x53c935[_0xe37b('0x58')]['id'])});}});}})[_0xe37b('0x35')](respondWithStatusCode(_0x4bfa37,null))[_0xe37b('0x29')](handleError(_0x4bfa37,null));};exports['getAgents']=function(_0x185fda,_0x6913df,_0x16766b){var _0x2a7607={};var _0x2dd064={};var _0x49b6a1;var _0x1521f4;return db[_0xe37b('0x41')]['findOne']({'where':{'id':_0x185fda[_0xe37b('0x58')]['id']}})[_0xe37b('0x35')](handleEntityNotFound(_0x6913df,null))[_0xe37b('0x35')](function(_0x479ed4){if(_0x479ed4){_0x49b6a1=_0x479ed4;_0x2dd064['model']=_[_0xe37b('0x46')](db[_0xe37b('0x75')][_0xe37b('0x42')]);_0x2dd064[_0xe37b('0x45')]=_['keys'](_0x185fda[_0xe37b('0x45')]);_0x2dd064[_0xe37b('0x47')]=_[_0xe37b('0x48')](_0x2dd064['model'],_0x2dd064[_0xe37b('0x45')]);_0x2a7607[_0xe37b('0x49')]=_[_0xe37b('0x48')](_0x2dd064[_0xe37b('0x44')],qs['fields'](_0x185fda[_0xe37b('0x45')]['fields']));_0x2a7607[_0xe37b('0x49')]=_0x2a7607['attributes'][_0xe37b('0x67')]?_0x2a7607['attributes']:_0x2dd064[_0xe37b('0x44')];_0x2a7607['order']=qs['sort'](_0x185fda[_0xe37b('0x45')]['sort']);_0x2a7607['where']=qs[_0xe37b('0x47')](_['pick'](_0x185fda[_0xe37b('0x45')],_0x2dd064['filters']));if(_0x185fda[_0xe37b('0x45')][_0xe37b('0x4f')]){_0x2a7607[_0xe37b('0x4e')]=_['merge'](_0x2a7607[_0xe37b('0x4e')],{'$or':_[_0xe37b('0x40')](_0x2a7607[_0xe37b('0x49')],function(_0x8df767){var _0x2999a2={};_0x2999a2[_0x8df767]={'$like':'%'+_0x185fda[_0xe37b('0x45')][_0xe37b('0x4f')]+'%'};return _0x2999a2;})});}_0x2a7607=_[_0xe37b('0x51')]({},_0x2a7607,_0x185fda[_0xe37b('0x52')]);return _0x49b6a1[_0xe37b('0xc5')](_0x2a7607);}})[_0xe37b('0x35')](function(_0x148580){if(_0x148580){_0x1521f4=_0x148580['length'];if(!_0x185fda['query'][_0xe37b('0x68')](_0xe37b('0x4b'))){_0x2a7607[_0xe37b('0x2e')]=qs['limit'](_0x185fda['query'][_0xe37b('0x2e')]);_0x2a7607[_0xe37b('0x30')]=qs[_0xe37b('0x30')](_0x185fda[_0xe37b('0x45')][_0xe37b('0x30')]);}return _0x49b6a1['getAgents'](_0x2a7607);}})['then'](function(_0x163c4e){if(_0x163c4e){return _0x163c4e?{'count':_0x1521f4,'rows':_0x163c4e}:null;}})['then'](respondWithResult(_0x6913df,null))['catch'](handleError(_0x6913df,null));}; \ No newline at end of file +var _0xc94e=['key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','FaxAccount','findAll','show','params','keys','include','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','FaxAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','User','Owner','fullname','Tag','Tags','tag','addApplications','transaction','sequelize','Transaction','FaxApplication','bulkCreate','findAndCountAll','priority','finally','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','Set','ecm','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','FAXOPT(','Wait','/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','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','path','from','List','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','jsforce','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','jayson/promise','client','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','FaxAccounts','destroy','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0xc94e,0x13e));var _0xec94=function(_0x1fc0db,_0x18ba86){_0x1fc0db=_0x1fc0db-0x0;var _0x2a9f10=_0xc94e[_0x1fc0db];return _0x2a9f10;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xec94('0x0'));var jsonpatch=require(_0xec94('0x1'));var rp=require(_0xec94('0x2'));var moment=require(_0xec94('0x3'));var BPromise=require(_0xec94('0x4'));var Mustache=require(_0xec94('0x5'));var util=require('util');var path=require('path');var sox=require(_0xec94('0x6'));var csv=require(_0xec94('0x7'));var ejs=require(_0xec94('0x8'));var fs=require('fs');var fs_extra=require(_0xec94('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xec94('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xec94('0x7'));var querystring=require(_0xec94('0xb'));var Papa=require(_0xec94('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec94('0xd'));var logger=require(_0xec94('0xe'))(_0xec94('0xf'));var utils=require(_0xec94('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xec94('0x11'));var db=require(_0xec94('0x12'))['db'];config[_0xec94('0x13')]=_[_0xec94('0x14')](config[_0xec94('0x13')],{'host':_0xec94('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xec94('0x13')]));require(_0xec94('0x16'))['register'](socket);var jayson=require(_0xec94('0x17'));var client=jayson[_0xec94('0x18')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4b14f1,_0x4baf6a,_0x13ad49,_0x36ab4f){return new BPromise(function(_0x496396,_0x5ca0eb){var _0x542f56=_0x36ab4f||client;return _0x542f56[_0xec94('0x19')](_0x4b14f1,_0x13ad49)['then'](function(_0x2bd611){logger[_0xec94('0x1a')](_0xec94('0x1b'),_0x4baf6a,_0xec94('0x1c'));logger[_0xec94('0x1d')](_0xec94('0x1e'),_0x4baf6a,_0xec94('0x1c'),JSON[_0xec94('0x1f')](_0x2bd611));if(_0x2bd611[_0xec94('0x20')]){if(_0x2bd611[_0xec94('0x20')]['code']===0x1f4){logger[_0xec94('0x20')](_0xec94('0x1b'),_0x4baf6a,_0x2bd611[_0xec94('0x20')][_0xec94('0x21')]);return _0x5ca0eb(_0x2bd611['error'][_0xec94('0x21')]);}logger[_0xec94('0x20')]('FaxAccount,\x20%s,\x20%s',_0x4baf6a,_0x2bd611[_0xec94('0x20')]['message']);return _0x496396(_0x2bd611[_0xec94('0x20')][_0xec94('0x21')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x4baf6a,_0xec94('0x1c'));_0x496396(_0x2bd611[_0xec94('0x22')]['message']);}})[_0xec94('0x23')](function(_0x34eba0){logger[_0xec94('0x20')]('FaxAccount,\x20%s,\x20%s',_0x4baf6a,_0x34eba0);_0x5ca0eb(_0x34eba0);});});}function respondWithStatusCode(_0x5d42f2,_0x40fb2c){_0x40fb2c=_0x40fb2c||0xcc;return function(_0x2ae205){if(_0x2ae205){return _0x5d42f2['sendStatus'](_0x40fb2c);}return _0x5d42f2[_0xec94('0x24')](_0x40fb2c)[_0xec94('0x25')]();};}function respondWithResult(_0x496ca7,_0x9657a3){_0x9657a3=_0x9657a3||0xc8;return function(_0xdc2b13){if(_0xdc2b13){return _0x496ca7[_0xec94('0x24')](_0x9657a3)[_0xec94('0x26')](_0xdc2b13);}};}function respondWithFilteredResult(_0x5464b8,_0xd1d473){return function(_0x3ea09c){if(_0x3ea09c){var _0x13f938=typeof _0xd1d473[_0xec94('0x27')]===_0xec94('0x28')&&typeof _0xd1d473[_0xec94('0x29')]===_0xec94('0x28');var _0x3dd245=_0x3ea09c[_0xec94('0x2a')];var _0x48e83b=_0x13f938?0x0:_0xd1d473[_0xec94('0x27')];var _0x57d637=_0x13f938?_0x3ea09c[_0xec94('0x2a')]:_0xd1d473[_0xec94('0x27')]+_0xd1d473[_0xec94('0x29')];var _0x2d99d8;if(_0x57d637>=_0x3dd245){_0x57d637=_0x3dd245;_0x2d99d8=0xc8;}else{_0x2d99d8=0xce;}_0x5464b8[_0xec94('0x24')](_0x2d99d8);return _0x5464b8[_0xec94('0x2b')](_0xec94('0x2c'),_0x48e83b+'-'+_0x57d637+'/'+_0x3dd245)[_0xec94('0x26')](_0x3ea09c);}return null;};}function patchUpdates(_0x31bc37){return function(_0x6ed7c5){try{jsonpatch[_0xec94('0x2d')](_0x6ed7c5,_0x31bc37,!![]);}catch(_0x2633c1){return BPromise[_0xec94('0x2e')](_0x2633c1);}return _0x6ed7c5[_0xec94('0x2f')]();};}function saveUpdates(_0x3f428b,_0x4b7a1f){return function(_0x2a31ba){if(_0x2a31ba){return _0x2a31ba[_0xec94('0x30')](_0x3f428b)[_0xec94('0x31')](function(_0xb9600b){return _0xb9600b;});}return null;};}function removeEntity(_0x21b13a,_0x11988b){return function(_0x940920){if(_0x940920){return _0x940920['destroy']()[_0xec94('0x31')](function(){var _0x3f4163=_0x940920[_0xec94('0x32')]({'plain':!![]});var _0x19c975=_0xec94('0x33');return db['UserProfileResource'][_0xec94('0x34')]({'where':{'type':_0x19c975,'resourceId':_0x3f4163['id']}})[_0xec94('0x31')](function(){return _0x940920;});})[_0xec94('0x31')](function(){_0x21b13a[_0xec94('0x24')](0xcc)[_0xec94('0x25')]();});}};}function handleEntityNotFound(_0x794909,_0x28b54d){return function(_0x4eb13d){if(!_0x4eb13d){_0x794909[_0xec94('0x35')](0x194);}return _0x4eb13d;};}function handleError(_0x3ed59a,_0x53d897){_0x53d897=_0x53d897||0x1f4;return function(_0x5c435e){logger[_0xec94('0x20')](_0x5c435e[_0xec94('0x36')]);if(_0x5c435e[_0xec94('0x37')]){delete _0x5c435e['name'];}_0x3ed59a['status'](_0x53d897)[_0xec94('0x38')](_0x5c435e);};}exports[_0xec94('0x39')]=function(_0x335156,_0x1be860){var _0x3ae6da={'include':[{'model':db[_0xec94('0x3a')],'as':_0xec94('0x3b')}]},_0x42b912={},_0x595b72={'count':0x0,'rows':[]};var _0x7c4a2c=_[_0xec94('0x3c')](db['FaxAccount'][_0xec94('0x3d')],function(_0x6794){return{'name':_0x6794[_0xec94('0x3e')],'type':_0x6794[_0xec94('0x3f')][_0xec94('0x40')]};});_0x42b912[_0xec94('0x41')]=_[_0xec94('0x3c')](_0x7c4a2c,'name');_0x42b912[_0xec94('0x42')]=_['keys'](_0x335156[_0xec94('0x42')]);_0x42b912[_0xec94('0x43')]=_[_0xec94('0x44')](_0x42b912[_0xec94('0x41')],_0x42b912[_0xec94('0x42')]);_0x3ae6da[_0xec94('0x45')]=_['intersection'](_0x42b912[_0xec94('0x41')],qs[_0xec94('0x46')](_0x335156[_0xec94('0x42')][_0xec94('0x46')]));_0x3ae6da[_0xec94('0x45')]=_0x3ae6da[_0xec94('0x45')][_0xec94('0x47')]?_0x3ae6da[_0xec94('0x45')]:_0x42b912['model'];if(!_0x335156[_0xec94('0x42')][_0xec94('0x48')](_0xec94('0x49'))){_0x3ae6da['limit']=qs['limit'](_0x335156[_0xec94('0x42')][_0xec94('0x29')]);_0x3ae6da['offset']=qs['offset'](_0x335156[_0xec94('0x42')][_0xec94('0x27')]);}_0x3ae6da[_0xec94('0x4a')]=qs['sort'](_0x335156[_0xec94('0x42')][_0xec94('0x4b')]);_0x3ae6da['where']=qs[_0xec94('0x43')](_[_0xec94('0x4c')](_0x335156[_0xec94('0x42')],_0x42b912[_0xec94('0x43')]),_0x7c4a2c);if(_0x335156[_0xec94('0x42')]['filter']){_0x3ae6da[_0xec94('0x4d')]=_[_0xec94('0x4e')](_0x3ae6da['where'],{'$or':_[_0xec94('0x3c')](_0x7c4a2c,function(_0x2df09a){if(_0x2df09a[_0xec94('0x3f')]!==_0xec94('0x4f')){var _0xcf25e1={};_0xcf25e1[_0x2df09a[_0xec94('0x37')]]={'$like':'%'+_0x335156[_0xec94('0x42')][_0xec94('0x50')]+'%'};return _0xcf25e1;}})});}_0x3ae6da=_[_0xec94('0x4e')]({},_0x3ae6da,_0x335156[_0xec94('0x51')]);var _0x27da96={'where':_0x3ae6da[_0xec94('0x4d')]};return db['FaxAccount'][_0xec94('0x2a')](_0x27da96)[_0xec94('0x31')](function(_0x4c747e){_0x595b72[_0xec94('0x2a')]=_0x4c747e;if(_0x335156[_0xec94('0x42')][_0xec94('0x52')]){_0x3ae6da['include']=[{'all':!![]}];}return db[_0xec94('0x53')][_0xec94('0x54')](_0x3ae6da);})['then'](function(_0x1e70f0){_0x595b72['rows']=_0x1e70f0;return _0x595b72;})['then'](respondWithFilteredResult(_0x1be860,_0x3ae6da))[_0xec94('0x23')](handleError(_0x1be860,null));};exports[_0xec94('0x55')]=function(_0x14654d,_0x3889d3){var _0x4ac2e0={'raw':![],'where':{'id':_0x14654d[_0xec94('0x56')]['id']},'include':[{'model':db[_0xec94('0x3a')],'as':'mandatoryDispositionPause'}]},_0x42f5de={};_0x42f5de[_0xec94('0x41')]=_[_0xec94('0x57')](db[_0xec94('0x53')][_0xec94('0x3d')]);_0x42f5de['query']=_['keys'](_0x14654d['query']);_0x42f5de[_0xec94('0x43')]=_[_0xec94('0x44')](_0x42f5de[_0xec94('0x41')],_0x42f5de[_0xec94('0x42')]);_0x4ac2e0[_0xec94('0x45')]=_[_0xec94('0x44')](_0x42f5de['model'],qs[_0xec94('0x46')](_0x14654d[_0xec94('0x42')]['fields']));_0x4ac2e0[_0xec94('0x45')]=_0x4ac2e0[_0xec94('0x45')][_0xec94('0x47')]?_0x4ac2e0[_0xec94('0x45')]:_0x42f5de[_0xec94('0x41')];if(_0x14654d[_0xec94('0x42')][_0xec94('0x52')]){_0x4ac2e0[_0xec94('0x58')]=[{'all':!![]}];}_0x4ac2e0=_['merge']({},_0x4ac2e0,_0x14654d[_0xec94('0x51')]);return db[_0xec94('0x53')][_0xec94('0x59')](_0x4ac2e0)[_0xec94('0x31')](handleEntityNotFound(_0x3889d3,null))['then'](respondWithResult(_0x3889d3,null))[_0xec94('0x23')](handleError(_0x3889d3,null));};exports[_0xec94('0x5a')]=function(_0xc0191f,_0x29927c){return db['FaxAccount'][_0xec94('0x5a')](_0xc0191f['body'],{})[_0xec94('0x31')](function(_0x269c5d){var _0x5aa1b2=_0xc0191f[_0xec94('0x5b')][_0xec94('0x32')]({'plain':!![]});if(!_0x5aa1b2)throw new Error(_0xec94('0x5c'));if(_0x5aa1b2[_0xec94('0x5d')]===_0xec94('0x5b')){var _0x9816f5=_0x269c5d[_0xec94('0x32')]({'plain':!![]});var _0x2fc7e7='FaxAccounts';return db[_0xec94('0x5e')]['find']({'where':{'name':_0x2fc7e7,'userProfileId':_0x5aa1b2[_0xec94('0x5f')]},'raw':!![]})[_0xec94('0x31')](function(_0x5167d9){if(_0x5167d9&&_0x5167d9[_0xec94('0x60')]===0x0){return db['UserProfileResource'][_0xec94('0x5a')]({'name':_0x9816f5['name'],'resourceId':_0x9816f5['id'],'type':_0x5167d9[_0xec94('0x37')],'sectionId':_0x5167d9['id']},{})['then'](function(){return _0x269c5d;});}else{return _0x269c5d;}})[_0xec94('0x23')](function(_0x3a7bc8){logger['error'](_0xec94('0x61'),_0x3a7bc8);throw _0x3a7bc8;});}return _0x269c5d;})[_0xec94('0x31')](respondWithResult(_0x29927c,0xc9))[_0xec94('0x23')](handleError(_0x29927c,null));};exports['update']=function(_0x3d50eb,_0x3ba8bb){if(_0x3d50eb[_0xec94('0x62')]['id']){delete _0x3d50eb['body']['id'];}return db['FaxAccount']['find']({'where':{'id':_0x3d50eb[_0xec94('0x56')]['id']},'include':[{'model':db[_0xec94('0x3a')],'as':_0xec94('0x3b')}]})[_0xec94('0x31')](handleEntityNotFound(_0x3ba8bb,null))['then'](saveUpdates(_0x3d50eb[_0xec94('0x62')],null))[_0xec94('0x31')](respondWithResult(_0x3ba8bb,null))['catch'](handleError(_0x3ba8bb,null));};exports[_0xec94('0x34')]=function(_0x276a98,_0x4d9acc){return db[_0xec94('0x53')][_0xec94('0x59')]({'where':{'id':_0x276a98[_0xec94('0x56')]['id']}})['then'](handleEntityNotFound(_0x4d9acc,null))['then'](removeEntity(_0x4d9acc,null))['catch'](handleError(_0x4d9acc,null));};exports[_0xec94('0x63')]=function(_0x200291,_0x46c2bf){return db['FaxAccount'][_0xec94('0x63')]()[_0xec94('0x31')](respondWithResult(_0x46c2bf,null))[_0xec94('0x23')](handleError(_0x46c2bf,null));};exports['addDisposition']=function(_0x568241,_0x3ac33d,_0x55d54e){if(_0x568241[_0xec94('0x62')]['id']){delete _0x568241[_0xec94('0x62')]['id'];}return db[_0xec94('0x53')][_0xec94('0x59')]({'where':{'id':_0x568241[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x3ac33d,null))['then'](function(_0x3befad){if(_0x3befad){_0x568241[_0xec94('0x62')][_0xec94('0x64')]=_0x3befad['id'];return db[_0xec94('0x65')]['create'](_0x568241['body']);}})[_0xec94('0x31')](respondWithResult(_0x3ac33d,null))['catch'](handleError(_0x3ac33d,null));};exports[_0xec94('0x66')]=function(_0x8e4916,_0xfd11cd,_0x17b4eb){var _0x316fcf={'raw':![],'where':{}};var _0x5cae43={};var _0x122d36={'count':0x0,'rows':[]};return db['FaxAccount'][_0xec94('0x67')]({'where':{'id':_0x8e4916[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0xfd11cd,null))[_0xec94('0x31')](function(_0x1484d0){if(_0x1484d0){_0x5cae43[_0xec94('0x41')]=_['keys'](db[_0xec94('0x65')][_0xec94('0x3d')]);_0x5cae43[_0xec94('0x42')]=_[_0xec94('0x57')](_0x8e4916[_0xec94('0x42')]);_0x5cae43[_0xec94('0x43')]=_[_0xec94('0x44')](_0x5cae43[_0xec94('0x41')],_0x5cae43[_0xec94('0x42')]);_0x316fcf['attributes']=_[_0xec94('0x44')](_0x5cae43[_0xec94('0x41')],qs[_0xec94('0x46')](_0x8e4916[_0xec94('0x42')][_0xec94('0x46')]));_0x316fcf[_0xec94('0x45')]=_0x316fcf[_0xec94('0x45')]['length']?_0x316fcf['attributes']:_0x5cae43['model'];if(!_0x8e4916['query'][_0xec94('0x48')](_0xec94('0x49'))){_0x316fcf['limit']=qs[_0xec94('0x29')](_0x8e4916[_0xec94('0x42')]['limit']);_0x316fcf['offset']=qs[_0xec94('0x27')](_0x8e4916[_0xec94('0x42')]['offset']);}_0x316fcf[_0xec94('0x4a')]=qs[_0xec94('0x4b')](_0x8e4916['query']['sort']);_0x316fcf[_0xec94('0x4d')]=qs[_0xec94('0x43')](_[_0xec94('0x4c')](_0x8e4916[_0xec94('0x42')],_0x5cae43[_0xec94('0x43')]));_0x316fcf[_0xec94('0x4d')]['FaxAccountId']=_0x1484d0['id'];if(_0x8e4916[_0xec94('0x42')]['filter']){_0x316fcf[_0xec94('0x4d')]=_['merge'](_0x316fcf['where'],{'$or':_[_0xec94('0x3c')](_0x316fcf[_0xec94('0x45')],function(_0x7f455f){var _0x58ab38={};_0x58ab38[_0x7f455f]={'$like':'%'+_0x8e4916[_0xec94('0x42')][_0xec94('0x50')]+'%'};return _0x58ab38;})});}_0x316fcf=_[_0xec94('0x4e')]({},_0x316fcf,_0x8e4916[_0xec94('0x51')]);return db[_0xec94('0x65')][_0xec94('0x2a')]({'where':_0x316fcf[_0xec94('0x4d')]})[_0xec94('0x31')](function(_0x5cd243){_0x122d36[_0xec94('0x2a')]=_0x5cd243;if(_0x8e4916[_0xec94('0x42')][_0xec94('0x52')]){_0x316fcf[_0xec94('0x58')]=[{'all':!![]}];}return db['Disposition'][_0xec94('0x54')](_0x316fcf);})[_0xec94('0x31')](function(_0x3452cd){_0x122d36[_0xec94('0x68')]=_0x3452cd;return _0x122d36;});}})['then'](respondWithFilteredResult(_0xfd11cd,_0x316fcf))[_0xec94('0x23')](handleError(_0xfd11cd,null));};exports[_0xec94('0x69')]=function(_0x111445,_0x1365d3,_0x5eeace){return db['FaxAccount']['find']({'where':{'id':_0x111445[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x1365d3,null))[_0xec94('0x31')](function(_0x53f3bf){if(_0x53f3bf){return _0x53f3bf[_0xec94('0x69')](_0x111445[_0xec94('0x42')][_0xec94('0x6a')]);}})[_0xec94('0x31')](respondWithStatusCode(_0x1365d3,null))[_0xec94('0x23')](handleError(_0x1365d3,null));};exports[_0xec94('0x6b')]=function(_0x2bc86b,_0x468d95,_0x3eafb8){if(_0x2bc86b[_0xec94('0x62')]['id']){delete _0x2bc86b[_0xec94('0x62')]['id'];}return db[_0xec94('0x53')][_0xec94('0x59')]({'where':{'id':_0x2bc86b[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x468d95,null))[_0xec94('0x31')](function(_0x1fc3c7){if(_0x1fc3c7){_0x2bc86b[_0xec94('0x62')]['FaxAccountId']=_0x1fc3c7['id'];return db[_0xec94('0x6c')]['create'](_0x2bc86b[_0xec94('0x62')]);}})['then'](respondWithResult(_0x468d95,null))[_0xec94('0x23')](handleError(_0x468d95,null));};exports['getAnswers']=function(_0x550e89,_0xdadaf5,_0x82a4c0){var _0x3534f2={'raw':![],'where':{}};var _0x505814={};var _0x435b4a={'count':0x0,'rows':[]};return db[_0xec94('0x53')][_0xec94('0x67')]({'where':{'id':_0x550e89[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0xdadaf5,null))[_0xec94('0x31')](function(_0x3214ed){if(_0x3214ed){_0x505814[_0xec94('0x41')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x505814[_0xec94('0x42')]=_[_0xec94('0x57')](_0x550e89[_0xec94('0x42')]);_0x505814['filters']=_['intersection'](_0x505814[_0xec94('0x41')],_0x505814['query']);_0x3534f2[_0xec94('0x45')]=_['intersection'](_0x505814[_0xec94('0x41')],qs[_0xec94('0x46')](_0x550e89[_0xec94('0x42')][_0xec94('0x46')]));_0x3534f2[_0xec94('0x45')]=_0x3534f2[_0xec94('0x45')][_0xec94('0x47')]?_0x3534f2['attributes']:_0x505814[_0xec94('0x41')];if(!_0x550e89[_0xec94('0x42')][_0xec94('0x48')](_0xec94('0x49'))){_0x3534f2[_0xec94('0x29')]=qs['limit'](_0x550e89[_0xec94('0x42')][_0xec94('0x29')]);_0x3534f2[_0xec94('0x27')]=qs[_0xec94('0x27')](_0x550e89['query'][_0xec94('0x27')]);}_0x3534f2[_0xec94('0x4a')]=qs[_0xec94('0x4b')](_0x550e89['query'][_0xec94('0x4b')]);_0x3534f2[_0xec94('0x4d')]=qs[_0xec94('0x43')](_[_0xec94('0x4c')](_0x550e89[_0xec94('0x42')],_0x505814[_0xec94('0x43')]));_0x3534f2[_0xec94('0x4d')][_0xec94('0x64')]=_0x3214ed['id'];if(_0x550e89[_0xec94('0x42')]['filter']){_0x3534f2[_0xec94('0x4d')]=_[_0xec94('0x4e')](_0x3534f2[_0xec94('0x4d')],{'$or':_[_0xec94('0x3c')](_0x3534f2[_0xec94('0x45')],function(_0x99a807){var _0x467b12={};_0x467b12[_0x99a807]={'$like':'%'+_0x550e89[_0xec94('0x42')][_0xec94('0x50')]+'%'};return _0x467b12;})});}_0x3534f2=_[_0xec94('0x4e')]({},_0x3534f2,_0x550e89['options']);return db[_0xec94('0x6c')]['count']({'where':_0x3534f2[_0xec94('0x4d')]})['then'](function(_0x52d3d1){_0x435b4a[_0xec94('0x2a')]=_0x52d3d1;if(_0x550e89[_0xec94('0x42')][_0xec94('0x52')]){_0x3534f2[_0xec94('0x58')]=[{'all':!![]}];}return db[_0xec94('0x6c')][_0xec94('0x54')](_0x3534f2);})[_0xec94('0x31')](function(_0x27c344){_0x435b4a[_0xec94('0x68')]=_0x27c344;return _0x435b4a;});}})[_0xec94('0x31')](respondWithFilteredResult(_0xdadaf5,_0x3534f2))['catch'](handleError(_0xdadaf5,null));};exports[_0xec94('0x6d')]=function(_0x517828,_0x45e68d,_0x4de955){return db[_0xec94('0x53')]['find']({'where':{'id':_0x517828[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x45e68d,null))[_0xec94('0x31')](function(_0x4cab0f){if(_0x4cab0f){return _0x4cab0f[_0xec94('0x6d')](_0x517828['query'][_0xec94('0x6a')]);}})['then'](respondWithStatusCode(_0x45e68d,null))[_0xec94('0x23')](handleError(_0x45e68d,null));};exports[_0xec94('0x6e')]=function(_0x22ab4b,_0x4f127c,_0x472420){return db[_0xec94('0x6f')][_0xec94('0x59')]({'where':{'id':_0x22ab4b[_0xec94('0x56')]['id']}})['then'](handleEntityNotFound(_0x4f127c,null))['then'](function(_0x4248d3){if(_0x4248d3){return _0x4248d3[_0xec94('0x6e')](_0x22ab4b[_0xec94('0x62')][_0xec94('0x6a')],_[_0xec94('0x70')](_0x22ab4b[_0xec94('0x62')],['ids','id'])||{});}})[_0xec94('0x31')](respondWithResult(_0x4f127c,null))[_0xec94('0x23')](handleError(_0x4f127c,null));};exports[_0xec94('0x71')]=function(_0x1d05aa,_0x21ebf2,_0x593a31){var _0x5673a9={'raw':![],'where':{}};var _0x59fb1c={};var _0x376cd7={'count':0x0,'rows':[]};return db[_0xec94('0x53')][_0xec94('0x67')]({'where':{'id':_0x1d05aa[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x21ebf2,null))[_0xec94('0x31')](function(_0x57c2ca){if(_0x57c2ca){_0x59fb1c[_0xec94('0x41')]=_[_0xec94('0x57')](db[_0xec94('0x6f')][_0xec94('0x3d')]);_0x59fb1c[_0xec94('0x42')]=_[_0xec94('0x57')](_0x1d05aa['query']);_0x59fb1c[_0xec94('0x43')]=_[_0xec94('0x44')](_0x59fb1c[_0xec94('0x41')],_0x59fb1c[_0xec94('0x42')]);_0x5673a9[_0xec94('0x45')]=_[_0xec94('0x44')](_0x59fb1c[_0xec94('0x41')],qs[_0xec94('0x46')](_0x1d05aa[_0xec94('0x42')]['fields']));_0x5673a9[_0xec94('0x45')]=_0x5673a9[_0xec94('0x45')]['length']?_0x5673a9[_0xec94('0x45')]:_0x59fb1c[_0xec94('0x41')];if(!_0x1d05aa[_0xec94('0x42')]['hasOwnProperty'](_0xec94('0x49'))){_0x5673a9[_0xec94('0x29')]=qs[_0xec94('0x29')](_0x1d05aa[_0xec94('0x42')]['limit']);_0x5673a9[_0xec94('0x27')]=qs[_0xec94('0x27')](_0x1d05aa[_0xec94('0x42')][_0xec94('0x27')]);}_0x5673a9['order']=qs['sort'](_0x1d05aa['query'][_0xec94('0x4b')]);_0x5673a9[_0xec94('0x4d')]=qs['filters'](_['pick'](_0x1d05aa['query'],_0x59fb1c[_0xec94('0x43')]));_0x5673a9[_0xec94('0x4d')][_0xec94('0x64')]=_0x57c2ca['id'];if(_0x1d05aa[_0xec94('0x42')][_0xec94('0x50')]){_0x5673a9['where']=_[_0xec94('0x4e')](_0x5673a9[_0xec94('0x4d')],{'$or':_[_0xec94('0x3c')](_0x5673a9[_0xec94('0x45')],function(_0x589e3e){var _0x55d215={};_0x55d215[_0x589e3e]={'$like':'%'+_0x1d05aa[_0xec94('0x42')][_0xec94('0x50')]+'%'};return _0x55d215;})});}_0x5673a9=_['merge']({},_0x5673a9,_0x1d05aa['options']);return db[_0xec94('0x6f')][_0xec94('0x2a')]({'where':_0x5673a9[_0xec94('0x4d')]})[_0xec94('0x31')](function(_0x1903a0){_0x376cd7[_0xec94('0x2a')]=_0x1903a0;if(_0x1d05aa['query'][_0xec94('0x52')]){_0x5673a9[_0xec94('0x58')]=[{'model':db[_0xec94('0x72')],'as':'Contact','required':![]},{'model':db[_0xec94('0x73')],'as':_0xec94('0x74'),'attributes':['name',_0xec94('0x75'),'internal'],'required':![]},{'model':db[_0xec94('0x76')],'as':_0xec94('0x77'),'attributes':['id',_0xec94('0x37'),'color'],'where':_0x1d05aa[_0xec94('0x42')][_0xec94('0x78')]?{'id':_0x1d05aa[_0xec94('0x42')][_0xec94('0x78')]}:undefined,'required':_0x1d05aa['query']['tag']?!![]:![]}];}return db[_0xec94('0x6f')]['findAll'](_0x5673a9);})['then'](function(_0x5e2758){_0x376cd7[_0xec94('0x68')]=_0x5e2758;return _0x376cd7;});}})[_0xec94('0x31')](respondWithFilteredResult(_0x21ebf2,_0x5673a9))[_0xec94('0x23')](handleError(_0x21ebf2,null));};exports[_0xec94('0x79')]=function(_0x2da8a4,_0x210299){var _0x6a39ae=_0x2da8a4[_0xec94('0x56')]['id'];var _0xa96228=_0x2da8a4['body'];var _0x59060e=0xc8;var _0xb2692c=null;return db['sequelize'][_0xec94('0x7a')]({'isolationLevel':db[_0xec94('0x7b')][_0xec94('0x7c')]['ISOLATION_LEVELS']['READ_COMMITTED']},function(_0x1d080b){return db[_0xec94('0x53')][_0xec94('0x67')]({'where':{'id':_0x6a39ae},'transaction':_0x1d080b})['then'](function(_0x31fc8f){if(_0x31fc8f){return db[_0xec94('0x7d')][_0xec94('0x34')]({'where':{'FaxAccountId':_0x6a39ae},'transaction':_0x1d080b})['then'](function(){var _0x983a59=_[_0xec94('0x3c')](_0xa96228,function(_0x2b871b){_0x2b871b[_0xec94('0x64')]=_0x6a39ae;return _0x2b871b;});return db[_0xec94('0x7d')][_0xec94('0x7e')](_0x983a59,{'transaction':_0x1d080b});});}else{_0x59060e=0x194;_0xb2692c=[];}});})['then'](function(){if(_0x59060e!==0x194){return db[_0xec94('0x7d')][_0xec94('0x7f')]({'where':{'FaxAccountId':_0x6a39ae},'order':_0xec94('0x80')})[_0xec94('0x31')](function(_0x5aba2a){_0xb2692c=_0x5aba2a;});}})[_0xec94('0x23')](function(_0x358b01){_0x59060e=0x1f4;logger[_0xec94('0x20')](_0x358b01['stack']);if(_0x358b01[_0xec94('0x37')]){delete _0x358b01['name'];}_0xb2692c=_0x358b01;})[_0xec94('0x81')](function(){if(_0xb2692c===null){_0x210299[_0xec94('0x35')](_0x59060e);}else{if(_0x59060e===0x1f4){_0x210299[_0xec94('0x24')](_0x59060e)[_0xec94('0x38')](_0xb2692c);}else{_0x210299[_0xec94('0x24')](_0x59060e)[_0xec94('0x26')](_0xb2692c);}}});};exports['getApplications']=function(_0x1d5ee8,_0x3b1539,_0x1e8ff9){var _0x203e91={};var _0x278ff9={};var _0x21783f;var _0x25e14a;return db[_0xec94('0x53')][_0xec94('0x67')]({'where':{'id':_0x1d5ee8[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x3b1539,null))[_0xec94('0x31')](function(_0x50d073){if(_0x50d073){_0x21783f=_0x50d073;_0x278ff9[_0xec94('0x41')]=_[_0xec94('0x57')](db['FaxApplication'][_0xec94('0x3d')]);_0x278ff9[_0xec94('0x42')]=_[_0xec94('0x57')](_0x1d5ee8[_0xec94('0x42')]);_0x278ff9[_0xec94('0x43')]=_['intersection'](_0x278ff9[_0xec94('0x41')],_0x278ff9[_0xec94('0x42')]);_0x203e91[_0xec94('0x45')]=_['intersection'](_0x278ff9[_0xec94('0x41')],qs[_0xec94('0x46')](_0x1d5ee8['query']['fields']));_0x203e91[_0xec94('0x45')]=_0x203e91[_0xec94('0x45')][_0xec94('0x47')]?_0x203e91[_0xec94('0x45')]:_0x278ff9[_0xec94('0x41')];_0x203e91[_0xec94('0x4a')]=qs['sort'](_0x1d5ee8['query'][_0xec94('0x4b')]);_0x203e91[_0xec94('0x4d')]=qs[_0xec94('0x43')](_[_0xec94('0x4c')](_0x1d5ee8['query'],_0x278ff9[_0xec94('0x43')]));if(_0x1d5ee8[_0xec94('0x42')][_0xec94('0x50')]){_0x203e91[_0xec94('0x4d')]=_[_0xec94('0x4e')](_0x203e91[_0xec94('0x4d')],{'$or':_[_0xec94('0x3c')](_0x203e91[_0xec94('0x45')],function(_0x5f374e){var _0x51c5f4={};_0x51c5f4[_0x5f374e]={'$like':'%'+_0x1d5ee8[_0xec94('0x42')][_0xec94('0x50')]+'%'};return _0x51c5f4;})});}_0x203e91=_[_0xec94('0x4e')]({},_0x203e91,_0x1d5ee8[_0xec94('0x51')]);return _0x21783f['getApplications'](_0x203e91);}})[_0xec94('0x31')](function(_0x45efe5){if(_0x45efe5){_0x25e14a=_0x45efe5['length'];if(!_0x1d5ee8[_0xec94('0x42')]['hasOwnProperty']('nolimit')){_0x203e91[_0xec94('0x29')]=qs['limit'](_0x1d5ee8['query']['limit']);_0x203e91[_0xec94('0x27')]=qs[_0xec94('0x27')](_0x1d5ee8[_0xec94('0x42')][_0xec94('0x27')]);}return _0x21783f['getApplications'](_0x203e91);}})[_0xec94('0x31')](function(_0x5c82a3){if(_0x5c82a3){return _0x5c82a3?{'count':_0x25e14a,'rows':_0x5c82a3}:null;}})[_0xec94('0x31')](respondWithResult(_0x3b1539,null))[_0xec94('0x23')](handleError(_0x3b1539,null));};function Extension(_0x586fcd,_0x1fb942,_0x57a78b,_0x4c0920){this['context']=_0xec94('0x82');this[_0xec94('0x83')]=_0x586fcd['localstationid'];this[_0xec94('0x84')]=_0x4c0920;this[_0xec94('0x3f')]=_0xec94('0x85');this[_0xec94('0x86')]=_0xec94('0x87');this['FaxAccountId']=_0x586fcd['id'];this[_0xec94('0x80')]=_0x1fb942;this[_0xec94('0x88')]=_0x57a78b;}function createExtensionsReciveFax(_0x4bc5c4){var _0xd1f2a5=0x1;var _0x3547cf=[];_0x3547cf[_0xec94('0x89')](new Extension(_0x4bc5c4,_0xd1f2a5,'',_0xec94('0x8a')));_0xd1f2a5+=0x1;_0x3547cf[_0xec94('0x89')](new Extension(_0x4bc5c4,_0xd1f2a5,'CDR(type)=inbound-fax',_0xec94('0x8b')));_0xd1f2a5+=0x1;for(var _0x5bc093 in _0x4bc5c4){if(_0x4bc5c4['hasOwnProperty'](_0x5bc093)&&(_0x5bc093===_0xec94('0x8c')||_0x5bc093==='localstationid'||_0x5bc093==='gateway'||_0x5bc093===_0xec94('0x8d')||_0x5bc093===_0xec94('0x8e')||_0x5bc093===_0xec94('0x8f')||_0x5bc093===_0xec94('0x90')||_0x5bc093===_0xec94('0x91')||_0x5bc093===_0xec94('0x92'))){_0x3547cf[_0xec94('0x89')](new Extension(_0x4bc5c4,_0xd1f2a5,_0xec94('0x93')+_0x5bc093+')='+_0x4bc5c4[_0x5bc093],'Set'));_0xd1f2a5+=0x1;}}_0x3547cf['push'](new Extension(_0x4bc5c4,_0xd1f2a5,'6',_0xec94('0x94')));_0xd1f2a5+=0x1;_0x3547cf[_0xec94('0x89')](new Extension(_0x4bc5c4,_0xd1f2a5,_0xec94('0x95'),'ReceiveFax'));_0xd1f2a5=0x0;return _0x3547cf;}exports['addAccountApplications']=function(_0x2dbb1b,_0x52c478,_0x1a461b){var _0x5d6ef7;return db[_0xec94('0x7b')][_0xec94('0x7a')](function(_0x48a8c7){return db[_0xec94('0x53')][_0xec94('0x5a')](_0x2dbb1b[_0xec94('0x62')],{'transaction':_0x48a8c7})[_0xec94('0x31')](function(_0x4d9562){_0x5d6ef7=_0x4d9562[_0xec94('0x32')]({'plain':!![]});return db[_0xec94('0x96')][_0xec94('0x7e')](createExtensionsReciveFax(_0x5d6ef7),{'transaction':_0x48a8c7});});})[_0xec94('0x31')](function(){return _0x5d6ef7;})[_0xec94('0x31')](respondWithResult(_0x52c478,null))[_0xec94('0x23')](handleError(_0x52c478,null));};exports[_0xec94('0x97')]=function(_0xd48acd,_0x128d48,_0x3449e8){var _0x16da9d;return db[_0xec94('0x7b')][_0xec94('0x7a')](function(_0x13ae2c){return db[_0xec94('0x53')][_0xec94('0x30')](_0xd48acd[_0xec94('0x62')],{'where':{'id':_0xd48acd[_0xec94('0x62')]['id']},'transaction':_0x13ae2c})[_0xec94('0x31')](function(_0x6940b2){return db[_0xec94('0x96')][_0xec94('0x34')]({'where':{'FaxAccountId':_0xd48acd[_0xec94('0x62')]['id']},'transaction':_0x13ae2c})[_0xec94('0x31')](function(_0x7758a8){return db[_0xec94('0x96')]['bulkCreate'](createExtensionsReciveFax(_['omit'](_0xd48acd[_0xec94('0x62')],[_0xec94('0x98'),'key',_0xec94('0x99'),_0xec94('0x9a'),_0xec94('0x9b'),_0xec94('0x9c')])),{'transaction':_0x13ae2c});});});})[_0xec94('0x31')](function(){return db[_0xec94('0x53')][_0xec94('0x9d')](_0xd48acd[_0xec94('0x62')]['id']);})[_0xec94('0x31')](respondWithResult(_0x128d48,null))[_0xec94('0x23')](handleError(_0x128d48,null));};exports[_0xec94('0x9e')]=function(_0x2bfbf2,_0x255268,_0x1cc01a){var _0x5cb399={'raw':!![],'where':{}};var _0x566d94={};var _0x5b5dca={'count':0x0,'rows':[]};return db[_0xec94('0x53')]['findOne']({'where':{'id':_0x2bfbf2[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x255268,null))[_0xec94('0x31')](function(_0x48a0b5){if(_0x48a0b5){_0x566d94['model']=_[_0xec94('0x57')](db[_0xec94('0x9f')][_0xec94('0x3d')]);_0x566d94[_0xec94('0x42')]=_[_0xec94('0x57')](_0x2bfbf2[_0xec94('0x42')]);_0x566d94[_0xec94('0x43')]=_['intersection'](_0x566d94[_0xec94('0x41')],_0x566d94[_0xec94('0x42')]);_0x5cb399['attributes']=_[_0xec94('0x44')](_0x566d94['model'],qs[_0xec94('0x46')](_0x2bfbf2[_0xec94('0x42')][_0xec94('0x46')]));_0x5cb399['attributes']=_0x5cb399[_0xec94('0x45')][_0xec94('0x47')]?_0x5cb399[_0xec94('0x45')]:_0x566d94[_0xec94('0x41')];if(!_0x2bfbf2[_0xec94('0x42')]['hasOwnProperty'](_0xec94('0x49'))){_0x5cb399[_0xec94('0x29')]=qs[_0xec94('0x29')](_0x2bfbf2[_0xec94('0x42')][_0xec94('0x29')]);_0x5cb399['offset']=qs[_0xec94('0x27')](_0x2bfbf2[_0xec94('0x42')]['offset']);}_0x5cb399[_0xec94('0x4a')]=qs[_0xec94('0x4b')](_0x2bfbf2['query'][_0xec94('0x4b')]);_0x5cb399[_0xec94('0x4d')]=qs[_0xec94('0x43')](_[_0xec94('0x4c')](_0x2bfbf2[_0xec94('0x42')],_0x566d94[_0xec94('0x43')]));_0x5cb399[_0xec94('0x4d')][_0xec94('0x64')]=_0x48a0b5['id'];if(_0x2bfbf2['query'][_0xec94('0x50')]){_0x5cb399[_0xec94('0x4d')]=_[_0xec94('0x4e')](_0x5cb399[_0xec94('0x4d')],{'$or':_['map'](_0x5cb399[_0xec94('0x45')],function(_0x29c289){var _0x2cd1c9={};_0x2cd1c9[_0x29c289]={'$like':'%'+_0x2bfbf2[_0xec94('0x42')][_0xec94('0x50')]+'%'};return _0x2cd1c9;})});}if(_0x2bfbf2[_0xec94('0x42')][_0xec94('0xa0')]){var _0x30ac3b=_0x2bfbf2[_0xec94('0x42')][_0xec94('0xa0')][_0xec94('0xa1')](',');var _0x1eeb84={};_0x1eeb84[_0x30ac3b[0x0]]={'$gte':moment(_0x30ac3b[0x1])[_0xec94('0xa2')](_0xec94('0xa3'))};_0x5cb399[_0xec94('0x4d')]=_[_0xec94('0x4e')](_0x5cb399['where'],_0x1eeb84);}_0x5cb399=_[_0xec94('0x4e')]({},_0x5cb399,_0x2bfbf2['options']);return db['FaxMessage'][_0xec94('0x2a')]({'where':_0x5cb399[_0xec94('0x4d')]})['then'](function(_0x601178){_0x5b5dca['count']=_0x601178;if(_0x2bfbf2[_0xec94('0x42')][_0xec94('0x52')]){_0x5cb399[_0xec94('0x58')]=[{'all':!![]}];}return db['FaxMessage'][_0xec94('0x54')](_0x5cb399);})[_0xec94('0x31')](function(_0x2ebaf1){_0x5b5dca[_0xec94('0x68')]=_0x2ebaf1;return _0x5b5dca;});}})[_0xec94('0x31')](respondWithFilteredResult(_0x255268,_0x5cb399))[_0xec94('0x23')](handleError(_0x255268,null));};exports[_0xec94('0x38')]=function(_0x568f4c,_0x317237,_0x229170){var _0x12b250,_0x377f05={},_0x1a87b1;if(_0x568f4c[_0xec94('0x62')]['to']){_0x1a87b1=_0x568f4c[_0xec94('0x62')]['to'][0x0];}return db[_0xec94('0x53')][_0xec94('0x59')]({'where':{'id':_0x568f4c['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xec94('0xa4'),'where':{'fax':_0x1a87b1},'limit':0x1,'order':[[_0xec94('0x9a'),_0xec94('0xa5')]]}]}]})['then'](handleEntityNotFound(_0x317237,null))[_0xec94('0x31')](function(_0x4365d0){_0x12b250=_0x4365d0;if(_0x568f4c['body'][_0xec94('0xa6')]&&_0x568f4c[_0xec94('0x62')]['attachments']['length']){for(var _0x180ed8=0x0;_0x180ed8<_0x568f4c[_0xec94('0x62')]['attachments'][_0xec94('0x47')];_0x180ed8+=0x1){_0x568f4c[_0xec94('0x62')][_0xec94('0xa6')][_0x180ed8]={'filename':_0x568f4c[_0xec94('0x62')][_0xec94('0xa6')][_0x180ed8][_0xec94('0x37')],'id':_0x568f4c[_0xec94('0x62')]['attachments'][_0x180ed8]['id'],'path':path[_0xec94('0xa7')](config[_0xec94('0xa8')],_0xec94('0xa9'),_0x568f4c[_0xec94('0x62')]['attachments'][_0x180ed8][_0xec94('0xaa')])};}}return respondWithRpcPromise(_0xec94('0xab'),_0xec94('0xab'),{'FaxAccountId':_['isNil'](_0x568f4c[_0xec94('0x56')]['id'])?undefined:_0x568f4c[_0xec94('0x56')]['id'],'path':_[_0xec94('0xac')](_0x568f4c[_0xec94('0x62')][_0xec94('0xa6')][0x0][_0xec94('0xad')])?undefined:_0x568f4c[_0xec94('0x62')][_0xec94('0xa6')][0x0][_0xec94('0xad')],'fax':_[_0xec94('0xac')](_0x568f4c[_0xec94('0x62')]['to'][0x0])?undefined:_0x568f4c[_0xec94('0x62')]['to'][0x0]},client9002);})['then'](function(){if(_0x12b250){if(_[_0xec94('0xac')](_0x568f4c[_0xec94('0x62')][_0xec94('0xae')])){_0x568f4c['body'][_0xec94('0xae')]=util['format']('\x22%s\x22\x20<%s>',_0x12b250[_0xec94('0x37')],_0x12b250['fax']);}if(_0x12b250[_0xec94('0xaf')]){if(_0x12b250[_0xec94('0xaf')][_0xec94('0xa4')][_0xec94('0x47')]){return _0x12b250['List'][_0xec94('0xa4')][0x0];}else{return db['CmContact'][_0xec94('0x5a')](_[_0xec94('0x14')](_0x568f4c[_0xec94('0x62')],{'firstName':_0x568f4c['body']['to'][0x0],'phone':_0x568f4c['body']['to'][0x0],'fax':_0x568f4c[_0xec94('0x62')]['to'][0x0],'ListId':_0x12b250[_0xec94('0x9c')]}));}}else{throw new Error(_0xec94('0xb0'));}}else{throw new Error(_0xec94('0xb1'));}})[_0xec94('0x31')](function(_0x551de6){if(_0x551de6){return db[_0xec94('0x6f')][_0xec94('0x59')]({'where':{'ContactId':_0x551de6['id'],'closed':![],'FaxAccountId':_0x12b250['id']}})[_0xec94('0x31')](function(_0x4abd72){if(_0x4abd72){return[_0x4abd72,![]];}return db['FaxInteraction'][_0xec94('0x5a')]({'UserId':_0x568f4c[_0xec94('0x5b')]['id'],'ContactId':_0x551de6['id'],'FaxAccountId':_0x12b250['id'],'fax':_0x568f4c[_0xec94('0x62')]['to'][0x0],'firstMsgDirection':_0xec94('0xb2'),'Messages':[_[_0xec94('0x4e')](_0x568f4c[_0xec94('0x62')],{'read':![],'body':_0x568f4c[_0xec94('0x62')][_0xec94('0xa6')][0x0][_0xec94('0xb3')],'FaxAccountId':_0x12b250['id'],'UserId':_0x568f4c['user']['id'],'ContactId':_0x551de6['id'],'AttachmentId':_0x568f4c[_0xec94('0x62')]['attachments'][0x0]['id']})]},{'include':[{'model':db[_0xec94('0x9f')],'as':_0xec94('0xb4')}]})[_0xec94('0x31')](function(_0x5835c0){return[_0x5835c0,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xec94('0xb5')](function(_0x5ead76,_0x1c8f39){if(_0x1c8f39){return _0x5ead76;}return db['FaxMessage'][_0xec94('0x5a')]({'direction':'out','read':![],'body':_0x568f4c['body'][_0xec94('0xa6')][0x0][_0xec94('0xb3')],'FaxAccountId':_0x12b250['id'],'FaxInteractionId':_0x5ead76['id'],'UserId':_0x568f4c['user']['id'],'ContactId':_0x5ead76['ContactId'],'AttachmentId':_0x568f4c[_0xec94('0x62')][_0xec94('0xa6')][0x0]['id']})[_0xec94('0x31')](function(_0x5c7a4e){_0x5ead76[_0xec94('0xb6')][_0xec94('0xb4')]=[];_0x5ead76[_0xec94('0xb6')][_0xec94('0xb4')][_0xec94('0x89')](_0x5c7a4e['dataValues']);return _0x5ead76;});})[_0xec94('0x31')](function(_0x1540ad){respondWithRpcPromise(_0xec94('0xb7'),_0xec94('0xb7'),{'FaxAccountId':_[_0xec94('0xac')](_0x568f4c[_0xec94('0x56')]['id'])?undefined:_0x568f4c['params']['id'],'path':_[_0xec94('0xac')](_0x568f4c[_0xec94('0x62')][_0xec94('0xa6')][0x0]['path'])?undefined:_0x568f4c['body'][_0xec94('0xa6')][0x0][_0xec94('0xad')],'fax':_[_0xec94('0xac')](_0x568f4c['body']['to'][0x0])?undefined:_0x568f4c[_0xec94('0x62')]['to'][0x0],'AttachmentId':_0x568f4c[_0xec94('0x62')]['attachments'][0x0]['id']},client9002)[_0xec94('0x31')](function(_0x4e75e5){logger[_0xec94('0x1a')](_0xec94('0xb8'),_0x4e75e5);})[_0xec94('0x23')](function(_0x4fac02){logger[_0xec94('0x1a')](_0xec94('0xb8'),_0x4fac02);});return _0x1540ad;})[_0xec94('0x31')](respondWithResult(_0x317237,null))[_0xec94('0x23')](handleError(_0x317237,null));};exports[_0xec94('0xb9')]=function(_0x2d111d,_0x404e8e,_0x37c56a){return db['FaxAccount'][_0xec94('0x59')]({'where':{'id':_0x2d111d['params']['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x404e8e,null))[_0xec94('0x31')](function(_0x15eaee){if(_0x15eaee){return _0x15eaee[_0xec94('0xb9')](_0x2d111d['body'][_0xec94('0x6a')],_['omit'](_0x2d111d['body'],['ids','id'])||{})[_0xec94('0xb5')](function(_0x13b6b5){for(var _0x183f6d=0x0;_0x183f6d<_0x2d111d[_0xec94('0x62')]['ids'][_0xec94('0x47')];_0x183f6d+=0x1){socket[_0xec94('0xba')]('userFaxAccount:save',{'UserId':Number(_0x2d111d[_0xec94('0x62')][_0xec94('0x6a')][_0x183f6d]),'FaxAccountId':Number(_0x2d111d['params']['id'])});}return _0x13b6b5;});}})[_0xec94('0x31')](respondWithResult(_0x404e8e,null))[_0xec94('0x23')](handleError(_0x404e8e,null));};exports[_0xec94('0xbb')]=function(_0x2a0d7c,_0x4af174,_0x225445){return db['FaxAccount']['find']({'where':{'id':_0x2a0d7c[_0xec94('0x56')]['id']}})['then'](handleEntityNotFound(_0x4af174,null))[_0xec94('0x31')](function(_0x3f5cce){if(_0x3f5cce){return _0x3f5cce[_0xec94('0xbb')](_0x2a0d7c['query']['ids'])[_0xec94('0x31')](function(){if(_[_0xec94('0xbc')](_0x2a0d7c[_0xec94('0x42')]['ids'])){for(var _0x5ee299=0x0;_0x5ee299<_0x2a0d7c[_0xec94('0x42')][_0xec94('0x6a')]['length'];_0x5ee299+=0x1){socket[_0xec94('0xba')](_0xec94('0xbd'),{'UserId':Number(_0x2a0d7c[_0xec94('0x42')][_0xec94('0x6a')][_0x5ee299]),'FaxAccountId':Number(_0x2a0d7c[_0xec94('0x56')]['id'])});}}else{socket['emit'](_0xec94('0xbd'),{'UserId':Number(_0x2a0d7c[_0xec94('0x42')][_0xec94('0x6a')]),'FaxAccountId':Number(_0x2a0d7c[_0xec94('0x56')]['id'])});}});}})[_0xec94('0x31')](respondWithStatusCode(_0x4af174,null))[_0xec94('0x23')](handleError(_0x4af174,null));};exports[_0xec94('0xbe')]=function(_0x55588d,_0x18181d,_0x206c49){var _0x2fc9ef={};var _0x17f5df={};var _0x3a0f76;var _0x51739a;return db['FaxAccount'][_0xec94('0x67')]({'where':{'id':_0x55588d[_0xec94('0x56')]['id']}})[_0xec94('0x31')](handleEntityNotFound(_0x18181d,null))['then'](function(_0x2374a4){if(_0x2374a4){_0x3a0f76=_0x2374a4;_0x17f5df[_0xec94('0x41')]=_[_0xec94('0x57')](db[_0xec94('0x73')][_0xec94('0x3d')]);_0x17f5df[_0xec94('0x42')]=_[_0xec94('0x57')](_0x55588d[_0xec94('0x42')]);_0x17f5df[_0xec94('0x43')]=_['intersection'](_0x17f5df['model'],_0x17f5df[_0xec94('0x42')]);_0x2fc9ef['attributes']=_[_0xec94('0x44')](_0x17f5df[_0xec94('0x41')],qs[_0xec94('0x46')](_0x55588d[_0xec94('0x42')][_0xec94('0x46')]));_0x2fc9ef[_0xec94('0x45')]=_0x2fc9ef['attributes'][_0xec94('0x47')]?_0x2fc9ef[_0xec94('0x45')]:_0x17f5df[_0xec94('0x41')];_0x2fc9ef[_0xec94('0x4a')]=qs[_0xec94('0x4b')](_0x55588d['query'][_0xec94('0x4b')]);_0x2fc9ef[_0xec94('0x4d')]=qs['filters'](_[_0xec94('0x4c')](_0x55588d[_0xec94('0x42')],_0x17f5df[_0xec94('0x43')]));if(_0x55588d['query']['filter']){_0x2fc9ef[_0xec94('0x4d')]=_[_0xec94('0x4e')](_0x2fc9ef[_0xec94('0x4d')],{'$or':_[_0xec94('0x3c')](_0x2fc9ef[_0xec94('0x45')],function(_0x195c4d){var _0x48e56a={};_0x48e56a[_0x195c4d]={'$like':'%'+_0x55588d[_0xec94('0x42')]['filter']+'%'};return _0x48e56a;})});}_0x2fc9ef=_['merge']({},_0x2fc9ef,_0x55588d['options']);return _0x3a0f76['getAgents'](_0x2fc9ef);}})[_0xec94('0x31')](function(_0x276b44){if(_0x276b44){_0x51739a=_0x276b44[_0xec94('0x47')];if(!_0x55588d[_0xec94('0x42')][_0xec94('0x48')](_0xec94('0x49'))){_0x2fc9ef[_0xec94('0x29')]=qs[_0xec94('0x29')](_0x55588d[_0xec94('0x42')]['limit']);_0x2fc9ef[_0xec94('0x27')]=qs[_0xec94('0x27')](_0x55588d[_0xec94('0x42')][_0xec94('0x27')]);}return _0x3a0f76[_0xec94('0xbe')](_0x2fc9ef);}})[_0xec94('0x31')](function(_0x113a2b){if(_0x113a2b){return _0x113a2b?{'count':_0x51739a,'rows':_0x113a2b}:null;}})[_0xec94('0x31')](respondWithResult(_0x18181d,null))[_0xec94('0x23')](handleError(_0x18181d,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index cbb4215..f782021 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 _0x6da9=['emit','hook','events','../../mysqldb','FaxAccount','setMaxListeners','save','update','remove'];(function(_0x2ef6c8,_0x43ea5f){var _0x15e631=function(_0x5e3b3a){while(--_0x5e3b3a){_0x2ef6c8['push'](_0x2ef6c8['shift']());}};_0x15e631(++_0x43ea5f);}(_0x6da9,0x161));var _0x96da=function(_0x5429fd,_0x456b33){_0x5429fd=_0x5429fd-0x0;var _0x577643=_0x6da9[_0x5429fd];return _0x577643;};'use strict';var EventEmitter=require(_0x96da('0x0'));var FaxAccount=require(_0x96da('0x1'))['db'][_0x96da('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x96da('0x3')](0x0);var events={'afterCreate':_0x96da('0x4'),'afterUpdate':_0x96da('0x5'),'afterDestroy':_0x96da('0x6')};function emitEvent(_0x5198e8){return function(_0x5d07cd,_0x4fd3b8,_0x191a57){FaxAccountEvents[_0x96da('0x7')](_0x5198e8+':'+_0x5d07cd['id'],_0x5d07cd);FaxAccountEvents[_0x96da('0x7')](_0x5198e8,_0x5d07cd);_0x191a57(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x96da('0x8')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0x9eac=['emit','hasOwnProperty','exports','events','FaxAccount','setMaxListeners','save','remove'];(function(_0x2d61ac,_0x18ff36){var _0x3f7d3c=function(_0x2ba7e5){while(--_0x2ba7e5){_0x2d61ac['push'](_0x2d61ac['shift']());}};_0x3f7d3c(++_0x18ff36);}(_0x9eac,0x6b));var _0xc9ea=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x9eac[_0xaa1b3e];return _0x454d7d;};'use strict';var EventEmitter=require(_0xc9ea('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0xc9ea('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xc9ea('0x2')](0x0);var events={'afterCreate':_0xc9ea('0x3'),'afterUpdate':'update','afterDestroy':_0xc9ea('0x4')};function emitEvent(_0x3a55f0){return function(_0x1f50c1,_0x5a6156,_0x411df4){FaxAccountEvents['emit'](_0x3a55f0+':'+_0x1f50c1['id'],_0x1f50c1);FaxAccountEvents[_0xc9ea('0x5')](_0x3a55f0,_0x1f50c1);_0x411df4(null);};}for(var e in events){if(events[_0xc9ea('0x6')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xc9ea('0x7')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index 9102f59..54de863 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 _0xa394=['../../config/logger','api','moment','bluebird','request-promise','rimraf','exports','FaxAccount','fax_accounts','lodash'];(function(_0x3449b7,_0x49680a){var _0x33ce15=function(_0xc3a88b){while(--_0xc3a88b){_0x3449b7['push'](_0x3449b7['shift']());}};_0x33ce15(++_0x49680a);}(_0xa394,0xd1));var _0x4a39=function(_0x46fa46,_0x533f3e){_0x46fa46=_0x46fa46-0x0;var _0x2ab26c=_0xa394[_0x46fa46];return _0x2ab26c;};'use strict';var _=require(_0x4a39('0x0'));var util=require('util');var logger=require(_0x4a39('0x1'))(_0x4a39('0x2'));var moment=require(_0x4a39('0x3'));var BPromise=require(_0x4a39('0x4'));var rp=require(_0x4a39('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a39('0x6'));var config=require('../../config/environment');var attributes=require('./faxAccount.attributes');module[_0x4a39('0x7')]=function(_0x419a46,_0x4591a9){return _0x419a46['define'](_0x4a39('0x8'),attributes,{'tableName':_0x4a39('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41be=['define','fax_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxAccount.attributes','exports'];(function(_0x7852f3,_0x192e1b){var _0x1deb6e=function(_0x652b97){while(--_0x652b97){_0x7852f3['push'](_0x7852f3['shift']());}};_0x1deb6e(++_0x192e1b);}(_0x41be,0x1e2));var _0xe41b=function(_0x401a4d,_0x4bb835){_0x401a4d=_0x401a4d-0x0;var _0x1faaff=_0x41be[_0x401a4d];return _0x1faaff;};'use strict';var _=require(_0xe41b('0x0'));var util=require('util');var logger=require(_0xe41b('0x1'))(_0xe41b('0x2'));var moment=require(_0xe41b('0x3'));var BPromise=require(_0xe41b('0x4'));var rp=require(_0xe41b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe41b('0x6'));var config=require(_0xe41b('0x7'));var attributes=require(_0xe41b('0x8'));module[_0xe41b('0x9')]=function(_0x2de8c6,_0x374b30){return _0x2de8c6[_0xe41b('0xa')]('FaxAccount',attributes,{'tableName':_0xe41b('0xb'),'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 48722b1..0db3823 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 _0xf3ab=['startRouting','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','defaults','localhost','socket.io-emitter','redis','./faxAccount.socket','request','then','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxAccount,\x20%s,\x20%s','message','request\x20sent','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','limit','include','map','model','NotifyFaxAccount','fax','CmContact','ValidationError','no\x20available\x20attributes','difference','keys','body','isNil','from','Sequelize','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','List','updatedAt','DESC','FaxApplication','Applications','get','applications','list','orderBy','asc','Contacts','length','ListId','create','contact','FaxInteraction','Contact\x20not\x20found','spread','autoclose','close','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','waitForTheAssignedAgent','queueId','FaxQueue','queue','waitForTheAssignedQueue'];(function(_0x13d2d0,_0x1b3a81){var _0x447d57=function(_0x5a53d2){while(--_0x5a53d2){_0x13d2d0['push'](_0x13d2d0['shift']());}};_0x447d57(++_0x1b3a81);}(_0xf3ab,0xb5));var _0xbf3a=function(_0x172660,_0x260d9b){_0x172660=_0x172660-0x0;var _0x83204f=_0xf3ab[_0x172660];return _0x83204f;};'use strict';var _=require(_0xbf3a('0x0'));var util=require(_0xbf3a('0x1'));var moment=require('moment');var BPromise=require(_0xbf3a('0x2'));var rs=require(_0xbf3a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf3a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbf3a('0x5'))(_0xbf3a('0x6'));var config=require(_0xbf3a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xbf3a('0x8')]['http']({'port':0x232c});config['redis']=_[_0xbf3a('0x9')](config['redis'],{'host':_0xbf3a('0xa'),'port':0x18eb});var socket=require(_0xbf3a('0xb'))(new Redis(config[_0xbf3a('0xc')]));require(_0xbf3a('0xd'))['register'](socket);function respondWithRpcPromise(_0x33a7fa,_0x295f6c,_0x42fb1e){return new BPromise(function(_0x2623fc,_0x3124a2){return client[_0xbf3a('0xe')](_0x33a7fa,_0x42fb1e)[_0xbf3a('0xf')](function(_0x268317){logger[_0xbf3a('0x10')]('FaxAccount,\x20%s,\x20%s',_0x295f6c,'request\x20sent');logger[_0xbf3a('0x11')](_0xbf3a('0x12'),_0x295f6c,'request\x20sent',JSON[_0xbf3a('0x13')](_0x268317));if(_0x268317[_0xbf3a('0x14')]){if(_0x268317['error'][_0xbf3a('0x15')]===0x1f4){logger[_0xbf3a('0x14')](_0xbf3a('0x16'),_0x295f6c,_0x268317[_0xbf3a('0x14')][_0xbf3a('0x17')]);return _0x3124a2(_0x268317[_0xbf3a('0x14')][_0xbf3a('0x17')]);}logger[_0xbf3a('0x14')](_0xbf3a('0x16'),_0x295f6c,_0x268317[_0xbf3a('0x14')][_0xbf3a('0x17')]);return _0x2623fc(_0x268317[_0xbf3a('0x14')]['message']);}else{logger[_0xbf3a('0x10')](_0xbf3a('0x16'),_0x295f6c,_0xbf3a('0x18'));_0x2623fc(_0x268317[_0xbf3a('0x19')][_0xbf3a('0x17')]);}})[_0xbf3a('0x1a')](function(_0x18cbf2){logger[_0xbf3a('0x14')]('FaxAccount,\x20%s,\x20%s',_0x295f6c,_0x18cbf2);_0x3124a2(_0x18cbf2);});});}exports[_0xbf3a('0x1b')]=function(_0x5c2c3b){var _0x1441d7=this;return new Promise(function(_0x1f9a29,_0x187b1b){return db[_0xbf3a('0x1c')]['findAll']({'raw':_0x5c2c3b[_0xbf3a('0x1d')]?_0x5c2c3b[_0xbf3a('0x1d')][_0xbf3a('0x1e')]===undefined?!![]:![]:!![],'where':_0x5c2c3b[_0xbf3a('0x1d')]?_0x5c2c3b[_0xbf3a('0x1d')][_0xbf3a('0x1f')]||null:null,'attributes':_0x5c2c3b['options']?_0x5c2c3b[_0xbf3a('0x1d')][_0xbf3a('0x20')]||null:null,'limit':_0x5c2c3b[_0xbf3a('0x1d')]?_0x5c2c3b[_0xbf3a('0x1d')][_0xbf3a('0x21')]||null:null,'include':_0x5c2c3b[_0xbf3a('0x1d')]?_0x5c2c3b[_0xbf3a('0x1d')][_0xbf3a('0x22')]?_[_0xbf3a('0x23')](_0x5c2c3b[_0xbf3a('0x1d')][_0xbf3a('0x22')],function(_0x333557){return{'model':db[_0x333557['model']],'as':_0x333557['as'],'attributes':_0x333557['attributes'],'include':_0x333557[_0xbf3a('0x22')]?_[_0xbf3a('0x23')](_0x333557[_0xbf3a('0x22')],function(_0x49d53c){return{'model':db[_0x49d53c[_0xbf3a('0x24')]],'as':_0x49d53c['as'],'attributes':_0x49d53c[_0xbf3a('0x20')],'include':_0x49d53c['include']?_['map'](_0x49d53c[_0xbf3a('0x22')],function(_0x4e414f){return{'model':db[_0x4e414f[_0xbf3a('0x24')]],'as':_0x4e414f['as'],'attributes':_0x4e414f[_0xbf3a('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbf3a('0xf')](function(_0x47083a){logger[_0xbf3a('0x10')](_0xbf3a('0x1b'),_0x5c2c3b);logger[_0xbf3a('0x11')](_0xbf3a('0x1b'),_0x5c2c3b,JSON['stringify'](_0x47083a));_0x1f9a29(_0x47083a);})[_0xbf3a('0x1a')](function(_0x5636c2){logger[_0xbf3a('0x14')]('GetFaxAccount',_0x5636c2[_0xbf3a('0x17')],_0x5c2c3b);_0x187b1b(_0x1441d7[_0xbf3a('0x14')](0x1f4,_0x5636c2[_0xbf3a('0x17')]));});});};exports[_0xbf3a('0x25')]=function(_0x25e13d,_0x3bf4f6,_0x318ee3){var _0x1daac2=this;return new Promise(function(_0x3d965e,_0x23d37a){var _0x4694cb={'body':_0x25e13d['body'],'channel':_0xbf3a('0x26')};var _0x37b621=[];var _0x180567=[];var _0xc56f78={};return db[_0xbf3a('0x27')]['describe']()['then'](function(_0x5b6816){if(!_0x5b6816){throw new db['Sequelize'][(_0xbf3a('0x28'))](_0xbf3a('0x29'));}_0x37b621=_[_0xbf3a('0x2a')](_[_0xbf3a('0x2b')](_0x5b6816),['createdAt','updatedAt']);_0x180567=_[_0xbf3a('0x2a')](_[_0xbf3a('0x2b')](_0x5b6816),['createdAt','updatedAt','CompanyId','ListId']);if(_0x25e13d[_0xbf3a('0x2c')]['id']){delete _0x25e13d[_0xbf3a('0x2c')]['id'];}if(_[_0xbf3a('0x2d')](_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x2e')])){throw new db[(_0xbf3a('0x2f'))][(_0xbf3a('0x28'))](_0xbf3a('0x30'));}if(_[_0xbf3a('0x2d')](_0x25e13d['body']['body'])||_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x2c')]===''){throw new db[(_0xbf3a('0x2f'))][(_0xbf3a('0x28'))](_0xbf3a('0x31'));}if(_[_0xbf3a('0x2d')](_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x32')])){throw new db[(_0xbf3a('0x2f'))][(_0xbf3a('0x28'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x180567);}if(!_['includes'](_0x180567,_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x32')])){throw new db[(_0xbf3a('0x2f'))]['ValidationError'](_0xbf3a('0x33')+_0x180567);}_0xc56f78[_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x32')]]=_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x2e')];})[_0xbf3a('0xf')](function(){return db[_0xbf3a('0x1c')][_0xbf3a('0x34')]({'where':{'id':_0x25e13d[_0xbf3a('0x35')]['id']},'include':[{'model':db[_0xbf3a('0x36')],'as':_0xbf3a('0x37'),'include':[{'model':db[_0xbf3a('0x27')],'as':'Contacts','where':_0xc56f78,'limit':0x1,'order':[[_0xbf3a('0x38'),_0xbf3a('0x39')]]}]},{'model':db[_0xbf3a('0x3a')],'as':_0xbf3a('0x3b')}]});})[_0xbf3a('0xf')](function(_0x4d14f6){if(_0x4d14f6&&_0x4d14f6[_0xbf3a('0x37')]){var _0x48ff60=_0x4d14f6[_0xbf3a('0x3c')]({'plain':!![]});_0x4694cb['account']=_0x48ff60;_0x4694cb[_0xbf3a('0x3d')]=_0x48ff60[_0xbf3a('0x3b')];_0x4694cb[_0xbf3a('0x3e')]=_0x48ff60['List'];_0x4694cb['applications']=_[_0xbf3a('0x3f')](_0x4694cb[_0xbf3a('0x3d')],['priority'],[_0xbf3a('0x40')]);if(_0x4694cb[_0xbf3a('0x35')]['Applications']){delete _0x4694cb[_0xbf3a('0x35')]['Applications'];}if(_0x4694cb[_0xbf3a('0x35')]['List']&&_0x4694cb[_0xbf3a('0x35')]['List'][_0xbf3a('0x41')][_0xbf3a('0x42')]){return _0x4694cb['account'][_0xbf3a('0x37')][_0xbf3a('0x41')][0x0];}var _0x22235a=_[_0xbf3a('0x9')](_0x25e13d[_0xbf3a('0x2c')],{'firstName':_0x25e13d['body'][_0xbf3a('0x2e')],'ListId':_0x48ff60[_0xbf3a('0x43')]});_0x22235a[_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x32')]]=_0x25e13d[_0xbf3a('0x2c')]['from'];return db['CmContact'][_0xbf3a('0x44')](_0x22235a,{'fields':_0x37b621,'raw':!![]});}})['then'](function(_0x5d2e07){_0x4694cb[_0xbf3a('0x45')]=_0x5d2e07;if(_0x5d2e07){var _0xc9df12={'ContactId':_0x5d2e07['id'],'FaxAccountId':_0x25e13d[_0xbf3a('0x35')]['id'],'fax':_0x5d2e07[_0xbf3a('0x26')]};return db[_0xbf3a('0x46')][_0xbf3a('0x34')]({'where':{'ContactId':_0x5d2e07['id'],'closed':![],'FaxAccountId':_0x25e13d[_0xbf3a('0x35')]['id']}})['then'](function(_0x20600c){if(_0x20600c){return[_0x20600c,![]];}return db[_0xbf3a('0x46')]['create'](_0xc9df12)[_0xbf3a('0xf')](function(_0x4c1c59){return[_0x4c1c59,!![]];});});}else{throw new Error(_0xbf3a('0x47'));}})[_0xbf3a('0x48')](function(_0x4ac59b,_0x19deca){var _0x37b29c=_0x4ac59b[_0xbf3a('0x3c')]({'plain':!![]});if(_0x19deca){if(_0x4694cb[_0xbf3a('0x35')][_0xbf3a('0x49')]){_0x4694cb[_0xbf3a('0x3d')]['push']({'id':0x0,'priority':_0x4694cb['applications']['length']+0x1,'app':_0xbf3a('0x4a'),'appdata':_0xbf3a('0x4b'),'interval':_0xbf3a('0x4c')});}_0x37b29c['created']=!![];}else{_0x37b29c[_0xbf3a('0x4d')]=![];}_0x4694cb[_0xbf3a('0x4e')]=_0x37b29c;return db[_0xbf3a('0x4f')][_0xbf3a('0x44')]({'body':_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x2c')],'FaxAccountId':_0x25e13d[_0xbf3a('0x35')]['id'],'FaxInteractionId':_0x4ac59b['id'],'direction':'in','ContactId':_0x4ac59b['ContactId'],'AttachmentId':_0x25e13d[_0xbf3a('0x2c')][_0xbf3a('0x50')]});})[_0xbf3a('0xf')](function(_0x2fc54b){_0x4694cb[_0xbf3a('0x17')]=_0x2fc54b;if(!_0x4694cb[_0xbf3a('0x4e')][_0xbf3a('0x51')])return;return db[_0xbf3a('0x52')][_0xbf3a('0x34')]({'attributes':['id',_0xbf3a('0x53')],'where':{'id':_0x4694cb[_0xbf3a('0x4e')]['UserId']}});})[_0xbf3a('0xf')](function(_0x4c84c7){if(_0x4c84c7){_0x4694cb['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4c84c7[_0xbf3a('0x53')]+','+(_0x4694cb[_0xbf3a('0x35')][_0xbf3a('0x54')]||0xa),'interval':'*,*,*,*'});}if(!_0x4694cb[_0xbf3a('0x4e')][_0xbf3a('0x55')])return;return db[_0xbf3a('0x56')][_0xbf3a('0x34')]({'attributes':['id',_0xbf3a('0x53')],'where':{'id':_0x4694cb[_0xbf3a('0x4e')][_0xbf3a('0x55')]}});})[_0xbf3a('0xf')](function(_0x3445f4){if(_0x3445f4){_0x4694cb['applications']['unshift']({'id':0x0,'priority':0x1,'app':_0xbf3a('0x57'),'appdata':_0x3445f4[_0xbf3a('0x53')]+','+(_0x4694cb['account'][_0xbf3a('0x58')]||0x12c),'interval':_0xbf3a('0x4c')});}return respondWithRpcPromise('Start',_0xbf3a('0x59'),_0x4694cb);})[_0xbf3a('0xf')](function(_0x840d52){_0x3d965e(_0x840d52);})[_0xbf3a('0x1a')](function(_0x148ebf){_0x23d37a(_0x1daac2['error'](0x1f4,_0x148ebf[_0xbf3a('0x17')]));});});}; \ No newline at end of file +var _0x39bc=['list','priority','asc','Contacts','length','contact','FaxInteraction','create','Contact\x20not\x20found','autoclose','push','close','unmanaged','*,*,*,*','created','AttachmentId','interaction','UserId','User','name','unshift','agent','queueId','queue','waitForTheAssignedQueue','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./faxAccount.socket','register','then','info','FaxAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','GetFaxAccount','FaxAccount','options','raw','where','attributes','include','map','model','NotifyFaxAccount','fax','CmContact','Sequelize','ValidationError','difference','keys','createdAt','updatedAt','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','CmList','List','DESC','FaxApplication','Applications','get','account','applications'];(function(_0x3d7af5,_0x308d72){var _0x11b446=function(_0x3ff3e4){while(--_0x3ff3e4){_0x3d7af5['push'](_0x3d7af5['shift']());}};_0x11b446(++_0x308d72);}(_0x39bc,0xc9));var _0xc39b=function(_0x5c3a80,_0x4b2c5c){_0x5c3a80=_0x5c3a80-0x0;var _0xd6dae5=_0x39bc[_0x5c3a80];return _0xd6dae5;};'use strict';var _=require(_0xc39b('0x0'));var util=require(_0xc39b('0x1'));var moment=require(_0xc39b('0x2'));var BPromise=require(_0xc39b('0x3'));var rs=require(_0xc39b('0x4'));var fs=require('fs');var Redis=require(_0xc39b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc39b('0x6'));var logger=require(_0xc39b('0x7'))(_0xc39b('0x8'));var config=require(_0xc39b('0x9'));var jayson=require(_0xc39b('0xa'));var client=jayson[_0xc39b('0xb')][_0xc39b('0xc')]({'port':0x232c});config['redis']=_[_0xc39b('0xd')](config[_0xc39b('0xe')],{'host':_0xc39b('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc39b('0xe')]));require(_0xc39b('0x10'))[_0xc39b('0x11')](socket);function respondWithRpcPromise(_0x59d6f8,_0x57ec2e,_0xdb1009){return new BPromise(function(_0x56bc9f,_0x627e2f){return client['request'](_0x59d6f8,_0xdb1009)[_0xc39b('0x12')](function(_0x4b8e58){logger[_0xc39b('0x13')](_0xc39b('0x14'),_0x57ec2e,'request\x20sent');logger[_0xc39b('0x15')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x57ec2e,_0xc39b('0x16'),JSON['stringify'](_0x4b8e58));if(_0x4b8e58[_0xc39b('0x17')]){if(_0x4b8e58['error'][_0xc39b('0x18')]===0x1f4){logger[_0xc39b('0x17')](_0xc39b('0x14'),_0x57ec2e,_0x4b8e58[_0xc39b('0x17')][_0xc39b('0x19')]);return _0x627e2f(_0x4b8e58[_0xc39b('0x17')][_0xc39b('0x19')]);}logger[_0xc39b('0x17')](_0xc39b('0x14'),_0x57ec2e,_0x4b8e58[_0xc39b('0x17')][_0xc39b('0x19')]);return _0x56bc9f(_0x4b8e58[_0xc39b('0x17')][_0xc39b('0x19')]);}else{logger[_0xc39b('0x13')](_0xc39b('0x14'),_0x57ec2e,_0xc39b('0x16'));_0x56bc9f(_0x4b8e58[_0xc39b('0x1a')]['message']);}})[_0xc39b('0x1b')](function(_0x2f73f2){logger['error'](_0xc39b('0x14'),_0x57ec2e,_0x2f73f2);_0x627e2f(_0x2f73f2);});});}exports[_0xc39b('0x1c')]=function(_0x5e203c){var _0x5cddad=this;return new Promise(function(_0x39c9c0,_0x310543){return db[_0xc39b('0x1d')]['findAll']({'raw':_0x5e203c[_0xc39b('0x1e')]?_0x5e203c['options'][_0xc39b('0x1f')]===undefined?!![]:![]:!![],'where':_0x5e203c['options']?_0x5e203c[_0xc39b('0x1e')][_0xc39b('0x20')]||null:null,'attributes':_0x5e203c[_0xc39b('0x1e')]?_0x5e203c[_0xc39b('0x1e')][_0xc39b('0x21')]||null:null,'limit':_0x5e203c['options']?_0x5e203c[_0xc39b('0x1e')]['limit']||null:null,'include':_0x5e203c['options']?_0x5e203c[_0xc39b('0x1e')][_0xc39b('0x22')]?_[_0xc39b('0x23')](_0x5e203c['options'][_0xc39b('0x22')],function(_0x559713){return{'model':db[_0x559713[_0xc39b('0x24')]],'as':_0x559713['as'],'attributes':_0x559713[_0xc39b('0x21')],'include':_0x559713['include']?_[_0xc39b('0x23')](_0x559713[_0xc39b('0x22')],function(_0x30481a){return{'model':db[_0x30481a['model']],'as':_0x30481a['as'],'attributes':_0x30481a[_0xc39b('0x21')],'include':_0x30481a[_0xc39b('0x22')]?_['map'](_0x30481a[_0xc39b('0x22')],function(_0x173fbb){return{'model':db[_0x173fbb[_0xc39b('0x24')]],'as':_0x173fbb['as'],'attributes':_0x173fbb['attributes']};}):[]};}):[]};}):[]:[]})[_0xc39b('0x12')](function(_0x4b6d17){logger[_0xc39b('0x13')](_0xc39b('0x1c'),_0x5e203c);logger[_0xc39b('0x15')](_0xc39b('0x1c'),_0x5e203c,JSON['stringify'](_0x4b6d17));_0x39c9c0(_0x4b6d17);})[_0xc39b('0x1b')](function(_0x152f16){logger[_0xc39b('0x17')](_0xc39b('0x1c'),_0x152f16[_0xc39b('0x19')],_0x5e203c);_0x310543(_0x5cddad[_0xc39b('0x17')](0x1f4,_0x152f16['message']));});});};exports[_0xc39b('0x25')]=function(_0x227f95,_0x299588,_0x5503bf){var _0x591ed2=this;return new Promise(function(_0x108573,_0x40d035){var _0x48e1c6={'body':_0x227f95['body'],'channel':_0xc39b('0x26')};var _0x30a17c=[];var _0x4d9617=[];var _0x388876={};return db[_0xc39b('0x27')]['describe']()[_0xc39b('0x12')](function(_0x46b1f4){if(!_0x46b1f4){throw new db[(_0xc39b('0x28'))][(_0xc39b('0x29'))]('no\x20available\x20attributes');}_0x30a17c=_[_0xc39b('0x2a')](_[_0xc39b('0x2b')](_0x46b1f4),[_0xc39b('0x2c'),_0xc39b('0x2d')]);_0x4d9617=_['difference'](_['keys'](_0x46b1f4),[_0xc39b('0x2c'),_0xc39b('0x2d'),'CompanyId',_0xc39b('0x2e')]);if(_0x227f95[_0xc39b('0x2f')]['id']){delete _0x227f95[_0xc39b('0x2f')]['id'];}if(_[_0xc39b('0x30')](_0x227f95[_0xc39b('0x2f')][_0xc39b('0x31')])){throw new db['Sequelize']['ValidationError'](_0xc39b('0x32'));}if(_[_0xc39b('0x30')](_0x227f95[_0xc39b('0x2f')]['body'])||_0x227f95[_0xc39b('0x2f')][_0xc39b('0x2f')]===''){throw new db[(_0xc39b('0x28'))][(_0xc39b('0x29'))](_0xc39b('0x33'));}if(_[_0xc39b('0x30')](_0x227f95[_0xc39b('0x2f')][_0xc39b('0x34')])){throw new db[(_0xc39b('0x28'))][(_0xc39b('0x29'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4d9617);}if(!_['includes'](_0x4d9617,_0x227f95[_0xc39b('0x2f')][_0xc39b('0x34')])){throw new db[(_0xc39b('0x28'))][(_0xc39b('0x29'))](_0xc39b('0x35')+_0x4d9617);}_0x388876[_0x227f95[_0xc39b('0x2f')]['mapKey']]=_0x227f95[_0xc39b('0x2f')][_0xc39b('0x31')];})[_0xc39b('0x12')](function(){return db[_0xc39b('0x1d')][_0xc39b('0x36')]({'where':{'id':_0x227f95['account']['id']},'include':[{'model':db[_0xc39b('0x37')],'as':_0xc39b('0x38'),'include':[{'model':db[_0xc39b('0x27')],'as':'Contacts','where':_0x388876,'limit':0x1,'order':[[_0xc39b('0x2d'),_0xc39b('0x39')]]}]},{'model':db[_0xc39b('0x3a')],'as':_0xc39b('0x3b')}]});})[_0xc39b('0x12')](function(_0x2709d1){if(_0x2709d1&&_0x2709d1[_0xc39b('0x38')]){var _0x31f8e3=_0x2709d1[_0xc39b('0x3c')]({'plain':!![]});_0x48e1c6[_0xc39b('0x3d')]=_0x31f8e3;_0x48e1c6[_0xc39b('0x3e')]=_0x31f8e3[_0xc39b('0x3b')];_0x48e1c6[_0xc39b('0x3f')]=_0x31f8e3['List'];_0x48e1c6[_0xc39b('0x3e')]=_['orderBy'](_0x48e1c6[_0xc39b('0x3e')],[_0xc39b('0x40')],[_0xc39b('0x41')]);if(_0x48e1c6[_0xc39b('0x3d')][_0xc39b('0x3b')]){delete _0x48e1c6['account'][_0xc39b('0x3b')];}if(_0x48e1c6['account']['List']&&_0x48e1c6[_0xc39b('0x3d')][_0xc39b('0x38')][_0xc39b('0x42')][_0xc39b('0x43')]){return _0x48e1c6['account']['List'][_0xc39b('0x42')][0x0];}var _0x40ebf3=_['defaults'](_0x227f95['body'],{'firstName':_0x227f95[_0xc39b('0x2f')][_0xc39b('0x31')],'ListId':_0x31f8e3['ListId']});_0x40ebf3[_0x227f95['body']['mapKey']]=_0x227f95[_0xc39b('0x2f')][_0xc39b('0x31')];return db[_0xc39b('0x27')]['create'](_0x40ebf3,{'fields':_0x30a17c,'raw':!![]});}})[_0xc39b('0x12')](function(_0x5ecee1){_0x48e1c6[_0xc39b('0x44')]=_0x5ecee1;if(_0x5ecee1){var _0x371858={'ContactId':_0x5ecee1['id'],'FaxAccountId':_0x227f95['account']['id'],'fax':_0x5ecee1[_0xc39b('0x26')]};return db['FaxInteraction']['find']({'where':{'ContactId':_0x5ecee1['id'],'closed':![],'FaxAccountId':_0x227f95[_0xc39b('0x3d')]['id']}})[_0xc39b('0x12')](function(_0x4ee7de){if(_0x4ee7de){return[_0x4ee7de,![]];}return db[_0xc39b('0x45')][_0xc39b('0x46')](_0x371858)['then'](function(_0x420d91){return[_0x420d91,!![]];});});}else{throw new Error(_0xc39b('0x47'));}})['spread'](function(_0x50696b,_0xa31cca){var _0x44a3bc=_0x50696b[_0xc39b('0x3c')]({'plain':!![]});if(_0xa31cca){if(_0x48e1c6['account'][_0xc39b('0x48')]){_0x48e1c6['applications'][_0xc39b('0x49')]({'id':0x0,'priority':_0x48e1c6[_0xc39b('0x3e')]['length']+0x1,'app':_0xc39b('0x4a'),'appdata':_0xc39b('0x4b'),'interval':_0xc39b('0x4c')});}_0x44a3bc[_0xc39b('0x4d')]=!![];}else{_0x44a3bc['created']=![];}_0x48e1c6['interaction']=_0x44a3bc;return db['FaxMessage'][_0xc39b('0x46')]({'body':_0x227f95[_0xc39b('0x2f')]['body'],'FaxAccountId':_0x227f95[_0xc39b('0x3d')]['id'],'FaxInteractionId':_0x50696b['id'],'direction':'in','ContactId':_0x50696b['ContactId'],'AttachmentId':_0x227f95[_0xc39b('0x2f')][_0xc39b('0x4e')]});})[_0xc39b('0x12')](function(_0x19bc7e){_0x48e1c6['message']=_0x19bc7e;if(!_0x48e1c6[_0xc39b('0x4f')][_0xc39b('0x50')])return;return db[_0xc39b('0x51')]['find']({'attributes':['id',_0xc39b('0x52')],'where':{'id':_0x48e1c6[_0xc39b('0x4f')][_0xc39b('0x50')]}});})[_0xc39b('0x12')](function(_0x54366b){if(_0x54366b){_0x48e1c6['applications'][_0xc39b('0x53')]({'id':0x0,'priority':0x0,'app':_0xc39b('0x54'),'appdata':_0x54366b[_0xc39b('0x52')]+','+(_0x48e1c6[_0xc39b('0x3d')]['waitForTheAssignedAgent']||0xa),'interval':_0xc39b('0x4c')});}if(!_0x48e1c6[_0xc39b('0x4f')][_0xc39b('0x55')])return;return db['FaxQueue'][_0xc39b('0x36')]({'attributes':['id',_0xc39b('0x52')],'where':{'id':_0x48e1c6[_0xc39b('0x4f')][_0xc39b('0x55')]}});})[_0xc39b('0x12')](function(_0x1cc08e){if(_0x1cc08e){_0x48e1c6[_0xc39b('0x3e')][_0xc39b('0x53')]({'id':0x0,'priority':0x1,'app':_0xc39b('0x56'),'appdata':_0x1cc08e['name']+','+(_0x48e1c6[_0xc39b('0x3d')][_0xc39b('0x57')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start','startRouting',_0x48e1c6);})['then'](function(_0xae4ea4){_0x108573(_0xae4ea4);})['catch'](function(_0x393ccb){_0x40d035(_0x591ed2[_0xc39b('0x17')](0x1f4,_0x393ccb[_0xc39b('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index 49ed61d..fed7246 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 _0x61db=['register','length','./faxAccount.events','save','remove','update','emit','removeListener'];(function(_0x7f70e1,_0x283365){var _0x309c5e=function(_0x395a8c){while(--_0x395a8c){_0x7f70e1['push'](_0x7f70e1['shift']());}};_0x309c5e(++_0x283365);}(_0x61db,0x10a));var _0xb61d=function(_0x580831,_0x2e293d){_0x580831=_0x580831-0x0;var _0x14c21a=_0x61db[_0x580831];return _0x14c21a;};'use strict';var FaxAccountEvents=require(_0xb61d('0x0'));var events=[_0xb61d('0x1'),_0xb61d('0x2'),_0xb61d('0x3')];function createListener(_0x138053,_0x39260b){return function(_0x47f7cb){_0x39260b[_0xb61d('0x4')](_0x138053,_0x47f7cb);};}function removeListener(_0x2f57ec,_0x508b51){return function(){FaxAccountEvents[_0xb61d('0x5')](_0x2f57ec,_0x508b51);};}exports[_0xb61d('0x6')]=function(_0x30dbcf){for(var _0x33f37f=0x0,_0x25b304=events[_0xb61d('0x7')];_0x33f37f<_0x25b304;_0x33f37f++){var _0x31428f=events[_0x33f37f];var _0x3c96c5=createListener('faxAccount:'+_0x31428f,_0x30dbcf);FaxAccountEvents['on'](_0x31428f,_0x3c96c5);}}; \ No newline at end of file +var _0xe0bb=['save','remove','update','emit','removeListener','register','length','faxAccount:','./faxAccount.events'];(function(_0x216d12,_0x5d7760){var _0x3e6a4d=function(_0x389cbe){while(--_0x389cbe){_0x216d12['push'](_0x216d12['shift']());}};_0x3e6a4d(++_0x5d7760);}(_0xe0bb,0x116));var _0xbe0b=function(_0x17371c,_0x1a1e9c){_0x17371c=_0x17371c-0x0;var _0x422265=_0xe0bb[_0x17371c];return _0x422265;};'use strict';var FaxAccountEvents=require(_0xbe0b('0x0'));var events=[_0xbe0b('0x1'),_0xbe0b('0x2'),_0xbe0b('0x3')];function createListener(_0x3b2f38,_0x30bb82){return function(_0x544d76){_0x30bb82[_0xbe0b('0x4')](_0x3b2f38,_0x544d76);};}function removeListener(_0xa07433,_0x5d1ed9){return function(){FaxAccountEvents[_0xbe0b('0x5')](_0xa07433,_0x5d1ed9);};}exports[_0xbe0b('0x6')]=function(_0x34aa00){for(var _0x3e14b3=0x0,_0x1740b0=events[_0xbe0b('0x7')];_0x3e14b3<_0x1740b0;_0x3e14b3++){var _0xd4cc76=events[_0x3e14b3];var _0x236338=createListener(_0xbe0b('0x8')+_0xd4cc76,_0x34aa00);FaxAccountEvents['on'](_0xd4cc76,_0x236338);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 61de83b..dc548b9 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 _0x273b=['/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','create','post','addDisposition','addAnswer','/addaccountapplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','send','addAgents','delete','destroy','removeDispositions','removeAnswers','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x26c04b,_0x43a36){var _0x5d1bed=function(_0x2d60af){while(--_0x2d60af){_0x26c04b['push'](_0x26c04b['shift']());}};_0x5d1bed(++_0x43a36);}(_0x273b,0xb8));var _0xb273=function(_0x129282,_0x408da7){_0x129282=_0x129282-0x0;var _0x2e0be9=_0x273b[_0x129282];return _0x2e0be9;};'use strict';var multer=require('multer');var util=require(_0xb273('0x0'));var path=require(_0xb273('0x1'));var timeout=require(_0xb273('0x2'));var express=require('express');var router=express[_0xb273('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb273('0x4'));var interaction=require(_0xb273('0x5'));var config=require('../../config/environment');var controller=require('./faxAccount.controller');router[_0xb273('0x6')]('/',auth[_0xb273('0x7')](),controller[_0xb273('0x8')]);router[_0xb273('0x6')](_0xb273('0x9'),auth[_0xb273('0x7')](),controller[_0xb273('0xa')]);router[_0xb273('0x6')](_0xb273('0xb'),auth[_0xb273('0x7')](),controller[_0xb273('0xc')]);router[_0xb273('0x6')](_0xb273('0xd'),auth[_0xb273('0x7')](),controller[_0xb273('0xe')]);router[_0xb273('0x6')](_0xb273('0xf'),auth[_0xb273('0x7')](),controller[_0xb273('0x10')]);router['get'](_0xb273('0x11'),auth[_0xb273('0x7')](),controller[_0xb273('0x12')]);router[_0xb273('0x6')](_0xb273('0x13'),auth[_0xb273('0x7')](),controller['getApplications']);router[_0xb273('0x6')](_0xb273('0x14'),auth[_0xb273('0x7')](),controller[_0xb273('0x15')]);router['get'](_0xb273('0x16'),auth[_0xb273('0x7')](),controller[_0xb273('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb273('0x18')]);router[_0xb273('0x19')](_0xb273('0xd'),auth[_0xb273('0x7')](),controller[_0xb273('0x1a')]);router['post'](_0xb273('0xf'),auth[_0xb273('0x7')](),controller[_0xb273('0x1b')]);router[_0xb273('0x19')]('/:id/interactions',auth[_0xb273('0x7')](),controller['addInteraction']);router[_0xb273('0x19')](_0xb273('0x13'),auth[_0xb273('0x7')](),controller['addApplications']);router[_0xb273('0x19')](_0xb273('0x1c'),auth[_0xb273('0x7')](),controller[_0xb273('0x1d')]);router[_0xb273('0x19')](_0xb273('0x1e'),auth[_0xb273('0x7')](),controller[_0xb273('0x1f')]);router['post']('/:id/send',auth['isAuthenticated'](),controller[_0xb273('0x20')]);router[_0xb273('0x19')](_0xb273('0x16'),auth[_0xb273('0x7')](),controller[_0xb273('0x21')]);router['put'](_0xb273('0xb'),auth[_0xb273('0x7')](),controller['update']);router[_0xb273('0x22')]('/:id',auth['isAuthenticated'](),controller[_0xb273('0x23')]);router[_0xb273('0x22')](_0xb273('0xd'),auth[_0xb273('0x7')](),controller[_0xb273('0x24')]);router[_0xb273('0x22')](_0xb273('0xf'),auth[_0xb273('0x7')](),controller[_0xb273('0x25')]);router['delete'](_0xb273('0x16'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xb273('0x26')]=router; \ No newline at end of file +var _0x2835=['getDispositions','/:id/canned_answers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','getAgents','post','create','/:id/dispositions','addDisposition','addApplications','/addaccountapplications','/updateaccountapplications','updateAccountApplications','/:id/send','send','/:id/users','addAgents','/:id','update','delete','destroy','removeAnswers','removeAgents','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x7e3b9b,_0x284b8f){var _0x5c35f3=function(_0x4b57c9){while(--_0x4b57c9){_0x7e3b9b['push'](_0x7e3b9b['shift']());}};_0x5c35f3(++_0x284b8f);}(_0x2835,0x1b5));var _0x5283=function(_0x140c0a,_0x1bd761){_0x140c0a=_0x140c0a-0x0;var _0x2f9c64=_0x2835[_0x140c0a];return _0x2f9c64;};'use strict';var multer=require('multer');var util=require(_0x5283('0x0'));var path=require(_0x5283('0x1'));var timeout=require(_0x5283('0x2'));var express=require('express');var router=express[_0x5283('0x3')]();var fs_extra=require(_0x5283('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5283('0x5'));var config=require(_0x5283('0x6'));var controller=require(_0x5283('0x7'));router[_0x5283('0x8')]('/',auth[_0x5283('0x9')](),controller[_0x5283('0xa')]);router[_0x5283('0x8')](_0x5283('0xb'),auth[_0x5283('0x9')](),controller[_0x5283('0xc')]);router[_0x5283('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x5283('0xd')]);router[_0x5283('0x8')]('/:id/dispositions',auth[_0x5283('0x9')](),controller[_0x5283('0xe')]);router[_0x5283('0x8')](_0x5283('0xf'),auth[_0x5283('0x9')](),controller['getAnswers']);router[_0x5283('0x8')](_0x5283('0x10'),auth['isAuthenticated'](),controller[_0x5283('0x11')]);router[_0x5283('0x8')](_0x5283('0x12'),auth['isAuthenticated'](),controller['getApplications']);router[_0x5283('0x8')](_0x5283('0x13'),auth[_0x5283('0x9')](),controller[_0x5283('0x14')]);router['get']('/:id/users',auth[_0x5283('0x9')](),controller[_0x5283('0x15')]);router[_0x5283('0x16')]('/',auth[_0x5283('0x9')](),controller[_0x5283('0x17')]);router[_0x5283('0x16')](_0x5283('0x18'),auth[_0x5283('0x9')](),controller[_0x5283('0x19')]);router[_0x5283('0x16')](_0x5283('0xf'),auth[_0x5283('0x9')](),controller['addAnswer']);router['post']('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router['post']('/:id/applications',auth[_0x5283('0x9')](),controller[_0x5283('0x1a')]);router[_0x5283('0x16')](_0x5283('0x1b'),auth[_0x5283('0x9')](),controller['addAccountApplications']);router[_0x5283('0x16')](_0x5283('0x1c'),auth[_0x5283('0x9')](),controller[_0x5283('0x1d')]);router[_0x5283('0x16')](_0x5283('0x1e'),auth[_0x5283('0x9')](),controller[_0x5283('0x1f')]);router[_0x5283('0x16')](_0x5283('0x20'),auth[_0x5283('0x9')](),controller[_0x5283('0x21')]);router['put'](_0x5283('0x22'),auth['isAuthenticated'](),controller[_0x5283('0x23')]);router[_0x5283('0x24')](_0x5283('0x22'),auth[_0x5283('0x9')](),controller[_0x5283('0x25')]);router['delete'](_0x5283('0x18'),auth[_0x5283('0x9')](),controller['removeDispositions']);router[_0x5283('0x24')](_0x5283('0xf'),auth[_0x5283('0x9')](),controller[_0x5283('0x26')]);router[_0x5283('0x24')](_0x5283('0x20'),auth['isAuthenticated'](),controller[_0x5283('0x27')]);module[_0x5283('0x28')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index db8602f..433a51b 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 _0x92ed=['*,*,*,*','sequelize','exports','INTEGER','STRING','TEXT'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x92ed,0xdf));var _0xd92e=function(_0x2610ae,_0x40c221){_0x2610ae=_0x2610ae-0x0;var _0x1b368b=_0x92ed[_0x2610ae];return _0x1b368b;};'use strict';var Sequelize=require(_0xd92e('0x0'));module[_0xd92e('0x1')]={'priority':{'type':Sequelize[_0xd92e('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd92e('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0xd92e('0x4')]()},'description':{'type':Sequelize[_0xd92e('0x3')]},'interval':{'type':Sequelize[_0xd92e('0x3')],'defaultValue':_0xd92e('0x5')}}; \ No newline at end of file +var _0x7d04=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x23a9f6,_0x5582e1){var _0x27dc42=function(_0xa0d3ef){while(--_0xa0d3ef){_0x23a9f6['push'](_0x23a9f6['shift']());}};_0x27dc42(++_0x5582e1);}(_0x7d04,0x170));var _0x47d0=function(_0x281457,_0x5d9e3c){_0x281457=_0x281457-0x0;var _0x2dea1e=_0x7d04[_0x281457];return _0x2dea1e;};'use strict';var Sequelize=require(_0x47d0('0x0'));module[_0x47d0('0x1')]={'priority':{'type':Sequelize[_0x47d0('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x47d0('0x3')],'allowNull':![],'defaultValue':_0x47d0('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x47d0('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x47d0('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index ec5528d..a0cc999 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 _0x16ba=['rows','catch','params','rawAttributes','find','create','update','body','eml-format','zip-dir','fast-json-patch','moment','mustache','util','ejs','lodash','squel','crypto','jsforce','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','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','end','error','name','map','FaxApplication','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x16ba,0x1be));var _0xa16b=function(_0x45411c,_0x424a3a){_0x45411c=_0x45411c-0x0;var _0x61af2d=_0x16ba[_0x45411c];return _0x61af2d;};'use strict';var emlformat=require(_0xa16b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa16b('0x1'));var jsonpatch=require(_0xa16b('0x2'));var rp=require('request-promise');var moment=require(_0xa16b('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xa16b('0x4'));var util=require(_0xa16b('0x5'));var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa16b('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa16b('0x7'));var squel=require(_0xa16b('0x8'));var crypto=require(_0xa16b('0x9'));var jsforce=require(_0xa16b('0xa'));var deskjs=require(_0xa16b('0xb'));var toCsv=require(_0xa16b('0xc'));var querystring=require(_0xa16b('0xd'));var Papa=require(_0xa16b('0xe'));var Redis=require(_0xa16b('0xf'));var authService=require(_0xa16b('0x10'));var qs=require(_0xa16b('0x11'));var as=require(_0xa16b('0x12'));var hardwareService=require(_0xa16b('0x13'));var logger=require(_0xa16b('0x14'))(_0xa16b('0x15'));var utils=require(_0xa16b('0x16'));var config=require(_0xa16b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xa16b('0x18'))['db'];function respondWithStatusCode(_0x11da83,_0x6d30c1){_0x6d30c1=_0x6d30c1||0xcc;return function(_0x52b5c5){if(_0x52b5c5){return _0x11da83[_0xa16b('0x19')](_0x6d30c1);}return _0x11da83[_0xa16b('0x1a')](_0x6d30c1)['end']();};}function respondWithResult(_0x2e47bc,_0x1475eb){_0x1475eb=_0x1475eb||0xc8;return function(_0x1e6a06){if(_0x1e6a06){return _0x2e47bc['status'](_0x1475eb)[_0xa16b('0x1b')](_0x1e6a06);}};}function respondWithFilteredResult(_0x3b85f0,_0x4bd8d1){return function(_0x51a5f7){if(_0x51a5f7){var _0x275cb1=typeof _0x4bd8d1['offset']===_0xa16b('0x1c')&&typeof _0x4bd8d1[_0xa16b('0x1d')]===_0xa16b('0x1c');var _0x59cfee=_0x51a5f7[_0xa16b('0x1e')];var _0x23fc3f=_0x275cb1?0x0:_0x4bd8d1[_0xa16b('0x1f')];var _0x1fb0b7=_0x275cb1?_0x51a5f7[_0xa16b('0x1e')]:_0x4bd8d1[_0xa16b('0x1f')]+_0x4bd8d1['limit'];var _0x509473;if(_0x1fb0b7>=_0x59cfee){_0x1fb0b7=_0x59cfee;_0x509473=0xc8;}else{_0x509473=0xce;}_0x3b85f0[_0xa16b('0x1a')](_0x509473);return _0x3b85f0[_0xa16b('0x20')](_0xa16b('0x21'),_0x23fc3f+'-'+_0x1fb0b7+'/'+_0x59cfee)['json'](_0x51a5f7);}return null;};}function patchUpdates(_0x2bb3d2){return function(_0x697929){try{jsonpatch[_0xa16b('0x22')](_0x697929,_0x2bb3d2,!![]);}catch(_0x725a67){return BPromise[_0xa16b('0x23')](_0x725a67);}return _0x697929[_0xa16b('0x24')]();};}function saveUpdates(_0x19cf3a,_0x56b919){return function(_0x1719f6){if(_0x1719f6){return _0x1719f6['update'](_0x19cf3a)[_0xa16b('0x25')](function(_0x1a0a22){return _0x1a0a22;});}return null;};}function removeEntity(_0x170b37,_0x3817ae){return function(_0x2cc425){if(_0x2cc425){return _0x2cc425['destroy']()[_0xa16b('0x25')](function(){_0x170b37[_0xa16b('0x1a')](0xcc)[_0xa16b('0x26')]();});}};}function handleEntityNotFound(_0x3969c4,_0x111c40){return function(_0x2ef7f2){if(!_0x2ef7f2){_0x3969c4[_0xa16b('0x19')](0x194);}return _0x2ef7f2;};}function handleError(_0x4ea950,_0x1a2f45){_0x1a2f45=_0x1a2f45||0x1f4;return function(_0x2ee305){logger[_0xa16b('0x27')](_0x2ee305['stack']);if(_0x2ee305[_0xa16b('0x28')]){delete _0x2ee305['name'];}_0x4ea950['status'](_0x1a2f45)['send'](_0x2ee305);};}exports['index']=function(_0x44f2fe,_0x3e8b27){var _0x3b1a24={},_0x3e60d8={},_0x25cbb7={'count':0x0,'rows':[]};var _0x5931c7=_[_0xa16b('0x29')](db[_0xa16b('0x2a')]['rawAttributes'],function(_0x349590){return{'name':_0x349590[_0xa16b('0x2b')],'type':_0x349590[_0xa16b('0x2c')]['key']};});_0x3e60d8[_0xa16b('0x2d')]=_[_0xa16b('0x29')](_0x5931c7,_0xa16b('0x28'));_0x3e60d8[_0xa16b('0x2e')]=_[_0xa16b('0x2f')](_0x44f2fe[_0xa16b('0x2e')]);_0x3e60d8[_0xa16b('0x30')]=_[_0xa16b('0x31')](_0x3e60d8['model'],_0x3e60d8[_0xa16b('0x2e')]);_0x3b1a24[_0xa16b('0x32')]=_[_0xa16b('0x31')](_0x3e60d8[_0xa16b('0x2d')],qs['fields'](_0x44f2fe['query'][_0xa16b('0x33')]));_0x3b1a24[_0xa16b('0x32')]=_0x3b1a24['attributes'][_0xa16b('0x34')]?_0x3b1a24[_0xa16b('0x32')]:_0x3e60d8[_0xa16b('0x2d')];if(!_0x44f2fe['query'][_0xa16b('0x35')](_0xa16b('0x36'))){_0x3b1a24[_0xa16b('0x1d')]=qs[_0xa16b('0x1d')](_0x44f2fe['query'][_0xa16b('0x1d')]);_0x3b1a24['offset']=qs[_0xa16b('0x1f')](_0x44f2fe[_0xa16b('0x2e')][_0xa16b('0x1f')]);}_0x3b1a24['order']=qs['sort'](_0x44f2fe[_0xa16b('0x2e')][_0xa16b('0x37')]);_0x3b1a24['where']=qs['filters'](_[_0xa16b('0x38')](_0x44f2fe['query'],_0x3e60d8[_0xa16b('0x30')]),_0x5931c7);if(_0x44f2fe[_0xa16b('0x2e')]['filter']){_0x3b1a24['where']=_[_0xa16b('0x39')](_0x3b1a24[_0xa16b('0x3a')],{'$or':_['map'](_0x5931c7,function(_0x3959d9){if(_0x3959d9[_0xa16b('0x2c')]!==_0xa16b('0x3b')){var _0x58911b={};_0x58911b[_0x3959d9[_0xa16b('0x28')]]={'$like':'%'+_0x44f2fe[_0xa16b('0x2e')][_0xa16b('0x3c')]+'%'};return _0x58911b;}})});}_0x3b1a24=_[_0xa16b('0x39')]({},_0x3b1a24,_0x44f2fe[_0xa16b('0x3d')]);var _0x12aeae={'where':_0x3b1a24['where']};return db[_0xa16b('0x2a')][_0xa16b('0x1e')](_0x12aeae)[_0xa16b('0x25')](function(_0x5420f7){_0x25cbb7[_0xa16b('0x1e')]=_0x5420f7;if(_0x44f2fe[_0xa16b('0x2e')][_0xa16b('0x3e')]){_0x3b1a24[_0xa16b('0x3f')]=[{'all':!![]}];}return db[_0xa16b('0x2a')][_0xa16b('0x40')](_0x3b1a24);})[_0xa16b('0x25')](function(_0x44d234){_0x25cbb7[_0xa16b('0x41')]=_0x44d234;return _0x25cbb7;})[_0xa16b('0x25')](respondWithFilteredResult(_0x3e8b27,_0x3b1a24))[_0xa16b('0x42')](handleError(_0x3e8b27,null));};exports['show']=function(_0x181dae,_0x36fc16){var _0x3ee474={'raw':!![],'where':{'id':_0x181dae[_0xa16b('0x43')]['id']}},_0x1625ff={};_0x1625ff[_0xa16b('0x2d')]=_[_0xa16b('0x2f')](db[_0xa16b('0x2a')][_0xa16b('0x44')]);_0x1625ff[_0xa16b('0x2e')]=_[_0xa16b('0x2f')](_0x181dae[_0xa16b('0x2e')]);_0x1625ff[_0xa16b('0x30')]=_[_0xa16b('0x31')](_0x1625ff[_0xa16b('0x2d')],_0x1625ff['query']);_0x3ee474['attributes']=_[_0xa16b('0x31')](_0x1625ff[_0xa16b('0x2d')],qs[_0xa16b('0x33')](_0x181dae[_0xa16b('0x2e')][_0xa16b('0x33')]));_0x3ee474[_0xa16b('0x32')]=_0x3ee474['attributes'][_0xa16b('0x34')]?_0x3ee474['attributes']:_0x1625ff['model'];if(_0x181dae[_0xa16b('0x2e')][_0xa16b('0x3e')]){_0x3ee474[_0xa16b('0x3f')]=[{'all':!![]}];}_0x3ee474=_['merge']({},_0x3ee474,_0x181dae[_0xa16b('0x3d')]);return db[_0xa16b('0x2a')][_0xa16b('0x45')](_0x3ee474)[_0xa16b('0x25')](handleEntityNotFound(_0x36fc16,null))['then'](respondWithResult(_0x36fc16,null))[_0xa16b('0x42')](handleError(_0x36fc16,null));};exports[_0xa16b('0x46')]=function(_0x392f1c,_0x29775a){return db[_0xa16b('0x2a')][_0xa16b('0x46')](_0x392f1c['body'],{})['then'](respondWithResult(_0x29775a,0xc9))[_0xa16b('0x42')](handleError(_0x29775a,null));};exports[_0xa16b('0x47')]=function(_0x1f40de,_0x5882f1){if(_0x1f40de['body']['id']){delete _0x1f40de[_0xa16b('0x48')]['id'];}return db[_0xa16b('0x2a')]['find']({'where':{'id':_0x1f40de[_0xa16b('0x43')]['id']}})[_0xa16b('0x25')](handleEntityNotFound(_0x5882f1,null))[_0xa16b('0x25')](saveUpdates(_0x1f40de[_0xa16b('0x48')],null))[_0xa16b('0x25')](respondWithResult(_0x5882f1,null))['catch'](handleError(_0x5882f1,null));};exports['destroy']=function(_0x541a76,_0x28dfe3){return db[_0xa16b('0x2a')][_0xa16b('0x45')]({'where':{'id':_0x541a76[_0xa16b('0x43')]['id']}})[_0xa16b('0x25')](handleEntityNotFound(_0x28dfe3,null))[_0xa16b('0x25')](removeEntity(_0x28dfe3,null))[_0xa16b('0x42')](handleError(_0x28dfe3,null));}; \ No newline at end of file +var _0xb91a=['intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','set','apply','reject','update','then','end','error','name','send','index','FaxApplication','rawAttributes','type','key','model','map','query','keys','filters'];(function(_0x49cee9,_0x28e9de){var _0x5c896d=function(_0x29a2dd){while(--_0x29a2dd){_0x49cee9['push'](_0x49cee9['shift']());}};_0x5c896d(++_0x28e9de);}(_0xb91a,0x199));var _0xab91=function(_0x38885c,_0x59c452){_0x38885c=_0x38885c-0x0;var _0x3b27a2=_0xb91a[_0x38885c];return _0x3b27a2;};'use strict';var emlformat=require(_0xab91('0x0'));var rimraf=require(_0xab91('0x1'));var zipdir=require(_0xab91('0x2'));var jsonpatch=require(_0xab91('0x3'));var rp=require(_0xab91('0x4'));var moment=require(_0xab91('0x5'));var BPromise=require(_0xab91('0x6'));var Mustache=require(_0xab91('0x7'));var util=require(_0xab91('0x8'));var path=require('path');var sox=require(_0xab91('0x9'));var csv=require('to-csv');var ejs=require(_0xab91('0xa'));var fs=require('fs');var fs_extra=require(_0xab91('0xb'));var _=require('lodash');var squel=require(_0xab91('0xc'));var crypto=require(_0xab91('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xab91('0xe'));var toCsv=require(_0xab91('0xf'));var querystring=require('querystring');var Papa=require(_0xab91('0x10'));var Redis=require(_0xab91('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xab91('0x12'));var as=require(_0xab91('0x13'));var hardwareService=require(_0xab91('0x14'));var logger=require(_0xab91('0x15'))(_0xab91('0x16'));var utils=require(_0xab91('0x17'));var config=require(_0xab91('0x18'));var licenseUtil=require(_0xab91('0x19'));var db=require(_0xab91('0x1a'))['db'];function respondWithStatusCode(_0x4bcf05,_0x5621c3){_0x5621c3=_0x5621c3||0xcc;return function(_0x2381eb){if(_0x2381eb){return _0x4bcf05[_0xab91('0x1b')](_0x5621c3);}return _0x4bcf05['status'](_0x5621c3)['end']();};}function respondWithResult(_0x1352a8,_0x2d293a){_0x2d293a=_0x2d293a||0xc8;return function(_0x249d4b){if(_0x249d4b){return _0x1352a8['status'](_0x2d293a)[_0xab91('0x1c')](_0x249d4b);}};}function respondWithFilteredResult(_0x501a57,_0xfcda5c){return function(_0x4df06f){if(_0x4df06f){var _0x199360=typeof _0xfcda5c[_0xab91('0x1d')]===_0xab91('0x1e')&&typeof _0xfcda5c[_0xab91('0x1f')]===_0xab91('0x1e');var _0x1115f1=_0x4df06f['count'];var _0x3c7ce8=_0x199360?0x0:_0xfcda5c[_0xab91('0x1d')];var _0x304189=_0x199360?_0x4df06f[_0xab91('0x20')]:_0xfcda5c['offset']+_0xfcda5c[_0xab91('0x1f')];var _0x1769a7;if(_0x304189>=_0x1115f1){_0x304189=_0x1115f1;_0x1769a7=0xc8;}else{_0x1769a7=0xce;}_0x501a57[_0xab91('0x21')](_0x1769a7);return _0x501a57[_0xab91('0x22')]('Content-Range',_0x3c7ce8+'-'+_0x304189+'/'+_0x1115f1)[_0xab91('0x1c')](_0x4df06f);}return null;};}function patchUpdates(_0x1ccd26){return function(_0x391390){try{jsonpatch[_0xab91('0x23')](_0x391390,_0x1ccd26,!![]);}catch(_0x44209c){return BPromise[_0xab91('0x24')](_0x44209c);}return _0x391390['save']();};}function saveUpdates(_0x2decb3,_0x2075c1){return function(_0x6cb2f3){if(_0x6cb2f3){return _0x6cb2f3[_0xab91('0x25')](_0x2decb3)[_0xab91('0x26')](function(_0xc0d8a2){return _0xc0d8a2;});}return null;};}function removeEntity(_0x2a7611,_0x2401d6){return function(_0x553f3b){if(_0x553f3b){return _0x553f3b['destroy']()['then'](function(){_0x2a7611['status'](0xcc)[_0xab91('0x27')]();});}};}function handleEntityNotFound(_0x49c942,_0x23c682){return function(_0x42e996){if(!_0x42e996){_0x49c942[_0xab91('0x1b')](0x194);}return _0x42e996;};}function handleError(_0x1a5983,_0x1b49fd){_0x1b49fd=_0x1b49fd||0x1f4;return function(_0x429a40){logger[_0xab91('0x28')](_0x429a40['stack']);if(_0x429a40[_0xab91('0x29')]){delete _0x429a40[_0xab91('0x29')];}_0x1a5983[_0xab91('0x21')](_0x1b49fd)[_0xab91('0x2a')](_0x429a40);};}exports[_0xab91('0x2b')]=function(_0x1e915e,_0x27f538){var _0x1d9960={},_0x3d0a1b={},_0x858213={'count':0x0,'rows':[]};var _0x124a43=_['map'](db[_0xab91('0x2c')][_0xab91('0x2d')],function(_0x186008){return{'name':_0x186008['fieldName'],'type':_0x186008[_0xab91('0x2e')][_0xab91('0x2f')]};});_0x3d0a1b[_0xab91('0x30')]=_[_0xab91('0x31')](_0x124a43,'name');_0x3d0a1b[_0xab91('0x32')]=_[_0xab91('0x33')](_0x1e915e[_0xab91('0x32')]);_0x3d0a1b[_0xab91('0x34')]=_[_0xab91('0x35')](_0x3d0a1b[_0xab91('0x30')],_0x3d0a1b[_0xab91('0x32')]);_0x1d9960[_0xab91('0x36')]=_[_0xab91('0x35')](_0x3d0a1b[_0xab91('0x30')],qs['fields'](_0x1e915e['query'][_0xab91('0x37')]));_0x1d9960['attributes']=_0x1d9960[_0xab91('0x36')]['length']?_0x1d9960['attributes']:_0x3d0a1b['model'];if(!_0x1e915e['query'][_0xab91('0x38')]('nolimit')){_0x1d9960[_0xab91('0x1f')]=qs[_0xab91('0x1f')](_0x1e915e['query']['limit']);_0x1d9960[_0xab91('0x1d')]=qs[_0xab91('0x1d')](_0x1e915e[_0xab91('0x32')][_0xab91('0x1d')]);}_0x1d9960[_0xab91('0x39')]=qs[_0xab91('0x3a')](_0x1e915e['query']['sort']);_0x1d9960[_0xab91('0x3b')]=qs[_0xab91('0x34')](_[_0xab91('0x3c')](_0x1e915e[_0xab91('0x32')],_0x3d0a1b[_0xab91('0x34')]),_0x124a43);if(_0x1e915e[_0xab91('0x32')][_0xab91('0x3d')]){_0x1d9960[_0xab91('0x3b')]=_['merge'](_0x1d9960[_0xab91('0x3b')],{'$or':_[_0xab91('0x31')](_0x124a43,function(_0x531d58){if(_0x531d58[_0xab91('0x2e')]!==_0xab91('0x3e')){var _0x25b1ce={};_0x25b1ce[_0x531d58[_0xab91('0x29')]]={'$like':'%'+_0x1e915e[_0xab91('0x32')][_0xab91('0x3d')]+'%'};return _0x25b1ce;}})});}_0x1d9960=_[_0xab91('0x3f')]({},_0x1d9960,_0x1e915e['options']);var _0x4bad8b={'where':_0x1d9960[_0xab91('0x3b')]};return db['FaxApplication']['count'](_0x4bad8b)[_0xab91('0x26')](function(_0x50d212){_0x858213[_0xab91('0x20')]=_0x50d212;if(_0x1e915e[_0xab91('0x32')][_0xab91('0x40')]){_0x1d9960[_0xab91('0x41')]=[{'all':!![]}];}return db[_0xab91('0x2c')][_0xab91('0x42')](_0x1d9960);})[_0xab91('0x26')](function(_0x3e0fe3){_0x858213[_0xab91('0x43')]=_0x3e0fe3;return _0x858213;})[_0xab91('0x26')](respondWithFilteredResult(_0x27f538,_0x1d9960))[_0xab91('0x44')](handleError(_0x27f538,null));};exports[_0xab91('0x45')]=function(_0xc02978,_0x22ff75){var _0x3beb0d={'raw':!![],'where':{'id':_0xc02978[_0xab91('0x46')]['id']}},_0x481dfc={};_0x481dfc[_0xab91('0x30')]=_[_0xab91('0x33')](db[_0xab91('0x2c')][_0xab91('0x2d')]);_0x481dfc[_0xab91('0x32')]=_[_0xab91('0x33')](_0xc02978['query']);_0x481dfc['filters']=_[_0xab91('0x35')](_0x481dfc[_0xab91('0x30')],_0x481dfc[_0xab91('0x32')]);_0x3beb0d[_0xab91('0x36')]=_['intersection'](_0x481dfc[_0xab91('0x30')],qs[_0xab91('0x37')](_0xc02978[_0xab91('0x32')][_0xab91('0x37')]));_0x3beb0d[_0xab91('0x36')]=_0x3beb0d['attributes'][_0xab91('0x47')]?_0x3beb0d[_0xab91('0x36')]:_0x481dfc[_0xab91('0x30')];if(_0xc02978[_0xab91('0x32')][_0xab91('0x40')]){_0x3beb0d[_0xab91('0x41')]=[{'all':!![]}];}_0x3beb0d=_[_0xab91('0x3f')]({},_0x3beb0d,_0xc02978[_0xab91('0x48')]);return db[_0xab91('0x2c')]['find'](_0x3beb0d)[_0xab91('0x26')](handleEntityNotFound(_0x22ff75,null))[_0xab91('0x26')](respondWithResult(_0x22ff75,null))[_0xab91('0x44')](handleError(_0x22ff75,null));};exports['create']=function(_0x59e77a,_0x399a79){return db[_0xab91('0x2c')][_0xab91('0x49')](_0x59e77a[_0xab91('0x4a')],{})['then'](respondWithResult(_0x399a79,0xc9))[_0xab91('0x44')](handleError(_0x399a79,null));};exports[_0xab91('0x25')]=function(_0xc732a3,_0x529d1b){if(_0xc732a3[_0xab91('0x4a')]['id']){delete _0xc732a3[_0xab91('0x4a')]['id'];}return db[_0xab91('0x2c')][_0xab91('0x4b')]({'where':{'id':_0xc732a3[_0xab91('0x46')]['id']}})[_0xab91('0x26')](handleEntityNotFound(_0x529d1b,null))[_0xab91('0x26')](saveUpdates(_0xc732a3['body'],null))[_0xab91('0x26')](respondWithResult(_0x529d1b,null))[_0xab91('0x44')](handleError(_0x529d1b,null));};exports[_0xab91('0x4c')]=function(_0x4b96cb,_0x1756d7){return db[_0xab91('0x2c')]['find']({'where':{'id':_0x4b96cb[_0xab91('0x46')]['id']}})[_0xab91('0x26')](handleEntityNotFound(_0x1756d7,null))[_0xab91('0x26')](removeEntity(_0x1756d7,null))[_0xab91('0x44')](handleError(_0x1756d7,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 1378619..b57ff6d 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 _0x6f63=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxApplication.attributes','exports','define','FaxApplication','fax_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x302ed2,_0x506e66){var _0x5b1191=function(_0x3d76ac){while(--_0x3d76ac){_0x302ed2['push'](_0x302ed2['shift']());}};_0x5b1191(++_0x506e66);}(_0x6f63,0x1a1));var _0x36f6=function(_0x2ade68,_0x435d63){_0x2ade68=_0x2ade68-0x0;var _0x3d6562=_0x6f63[_0x2ade68];return _0x3d6562;};'use strict';var _=require(_0x36f6('0x0'));var util=require(_0x36f6('0x1'));var logger=require(_0x36f6('0x2'))(_0x36f6('0x3'));var moment=require(_0x36f6('0x4'));var BPromise=require(_0x36f6('0x5'));var rp=require(_0x36f6('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x36f6('0x7'));var config=require(_0x36f6('0x8'));var attributes=require(_0x36f6('0x9'));module[_0x36f6('0xa')]=function(_0x395e61,_0x3823cc){return _0x395e61[_0x36f6('0xb')](_0x36f6('0xc'),attributes,{'tableName':_0x36f6('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x36f6('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfb6e=['path','rimraf','../../config/environment','./faxApplication.attributes','exports','define','fax_applications','utf8mb4_unicode_ci','util','../../config/logger','api','request-promise'];(function(_0x3416e2,_0x5c9c1b){var _0x52f5fe=function(_0x428adc){while(--_0x428adc){_0x3416e2['push'](_0x3416e2['shift']());}};_0x52f5fe(++_0x5c9c1b);}(_0xfb6e,0x74));var _0xefb6=function(_0x425114,_0x1449ec){_0x425114=_0x425114-0x0;var _0x2d9ead=_0xfb6e[_0x425114];return _0x2d9ead;};'use strict';var _=require('lodash');var util=require(_0xefb6('0x0'));var logger=require(_0xefb6('0x1'))(_0xefb6('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xefb6('0x3'));var fs=require('fs');var path=require(_0xefb6('0x4'));var rimraf=require(_0xefb6('0x5'));var config=require(_0xefb6('0x6'));var attributes=require(_0xefb6('0x7'));module[_0xefb6('0x8')]=function(_0x242edc,_0x22b42b){return _0x242edc[_0xefb6('0x9')]('FaxApplication',attributes,{'tableName':_0xefb6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xefb6('0xb')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index e335982..60d3513 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 _0x3718=['../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','FaxApplication,\x20%s,\x20%s','message','info','body','options','where','attributes','limit','UpdateFaxApplication','catch','lodash','util','moment','randomstring'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3718,0xb2));var _0x8371=function(_0x2fa2b9,_0x1f876a){_0x2fa2b9=_0x2fa2b9-0x0;var _0x3dc9e6=_0x3718[_0x2fa2b9];return _0x3dc9e6;};'use strict';var _=require(_0x8371('0x0'));var util=require(_0x8371('0x1'));var moment=require(_0x8371('0x2'));var BPromise=require('bluebird');var rs=require(_0x8371('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8371('0x4'))['db'];var utils=require(_0x8371('0x5'));var logger=require('../../config/logger')(_0x8371('0x6'));var config=require('../../config/environment');var jayson=require(_0x8371('0x7'));var client=jayson['client'][_0x8371('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x516885,_0x5eebe2,_0x4389c7){return new BPromise(function(_0x3898bc,_0x3cf639){return client[_0x8371('0x9')](_0x516885,_0x4389c7)[_0x8371('0xa')](function(_0x200daa){logger['info']('FaxApplication,\x20%s,\x20%s',_0x5eebe2,_0x8371('0xb'));logger[_0x8371('0xc')](_0x8371('0xd'),_0x5eebe2,_0x8371('0xb'),JSON[_0x8371('0xe')](_0x200daa));if(_0x200daa[_0x8371('0xf')]){if(_0x200daa[_0x8371('0xf')]['code']===0x1f4){logger[_0x8371('0xf')](_0x8371('0x10'),_0x5eebe2,_0x200daa[_0x8371('0xf')]['message']);return _0x3cf639(_0x200daa[_0x8371('0xf')][_0x8371('0x11')]);}logger['error'](_0x8371('0x10'),_0x5eebe2,_0x200daa['error'][_0x8371('0x11')]);return _0x3898bc(_0x200daa[_0x8371('0xf')][_0x8371('0x11')]);}else{logger[_0x8371('0x12')](_0x8371('0x10'),_0x5eebe2,_0x8371('0xb'));_0x3898bc(_0x200daa['result'][_0x8371('0x11')]);}})['catch'](function(_0x399207){logger[_0x8371('0xf')](_0x8371('0x10'),_0x5eebe2,_0x399207);_0x3cf639(_0x399207);});});}exports['UpdateFaxApplication']=function(_0x4ed92f){var _0x1c897c=this;return new Promise(function(_0x77ffaf,_0x57fde3){return db['FaxApplication']['update'](_0x4ed92f[_0x8371('0x13')],{'raw':_0x4ed92f[_0x8371('0x14')]?_0x4ed92f[_0x8371('0x14')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ed92f[_0x8371('0x14')]?_0x4ed92f[_0x8371('0x14')][_0x8371('0x15')]||null:null,'attributes':_0x4ed92f[_0x8371('0x14')]?_0x4ed92f['options'][_0x8371('0x16')]||null:null,'limit':_0x4ed92f[_0x8371('0x14')]?_0x4ed92f[_0x8371('0x14')][_0x8371('0x17')]||null:null})['then'](function(_0x41d7c3){logger[_0x8371('0x12')](_0x8371('0x18'),_0x4ed92f);logger[_0x8371('0xc')](_0x8371('0x18'),_0x4ed92f,JSON[_0x8371('0xe')](_0x41d7c3));_0x77ffaf(_0x41d7c3);})[_0x8371('0x19')](function(_0x278821){logger['error'](_0x8371('0x18'),_0x278821[_0x8371('0x11')],_0x4ed92f);_0x57fde3(_0x1c897c['error'](0x1f4,_0x278821[_0x8371('0x11')]));});});}; \ No newline at end of file +var _0xe9a2=['client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateFaxApplication','FaxApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x5d96ff,_0x431da5){var _0x4f93ca=function(_0x355a50){while(--_0x355a50){_0x5d96ff['push'](_0x5d96ff['shift']());}};_0x4f93ca(++_0x431da5);}(_0xe9a2,0x71));var _0x2e9a=function(_0x3a1bf1,_0x3c2ac8){_0x3a1bf1=_0x3a1bf1-0x0;var _0x31d72e=_0xe9a2[_0x3a1bf1];return _0x31d72e;};'use strict';var _=require(_0x2e9a('0x0'));var util=require(_0x2e9a('0x1'));var moment=require(_0x2e9a('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2e9a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2e9a('0x4'));var logger=require('../../config/logger')(_0x2e9a('0x5'));var config=require(_0x2e9a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2e9a('0x7')][_0x2e9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bdf65,_0x39aa91,_0x2a9275){return new BPromise(function(_0x2e7c1f,_0x2f1fa3){return client[_0x2e9a('0x9')](_0x4bdf65,_0x2a9275)[_0x2e9a('0xa')](function(_0x4b6906){logger[_0x2e9a('0xb')](_0x2e9a('0xc'),_0x39aa91,_0x2e9a('0xd'));logger[_0x2e9a('0xe')](_0x2e9a('0xf'),_0x39aa91,'request\x20sent',JSON[_0x2e9a('0x10')](_0x4b6906));if(_0x4b6906['error']){if(_0x4b6906[_0x2e9a('0x11')]['code']===0x1f4){logger[_0x2e9a('0x11')](_0x2e9a('0xc'),_0x39aa91,_0x4b6906[_0x2e9a('0x11')]['message']);return _0x2f1fa3(_0x4b6906['error'][_0x2e9a('0x12')]);}logger[_0x2e9a('0x11')](_0x2e9a('0xc'),_0x39aa91,_0x4b6906[_0x2e9a('0x11')]['message']);return _0x2e7c1f(_0x4b6906[_0x2e9a('0x11')][_0x2e9a('0x12')]);}else{logger['info'](_0x2e9a('0xc'),_0x39aa91,_0x2e9a('0xd'));_0x2e7c1f(_0x4b6906[_0x2e9a('0x13')][_0x2e9a('0x12')]);}})[_0x2e9a('0x14')](function(_0x35fe81){logger[_0x2e9a('0x11')]('FaxApplication,\x20%s,\x20%s',_0x39aa91,_0x35fe81);_0x2f1fa3(_0x35fe81);});});}exports[_0x2e9a('0x15')]=function(_0x4822f6){var _0x2e7d01=this;return new Promise(function(_0x13e52b,_0x30728c){return db[_0x2e9a('0x16')][_0x2e9a('0x17')](_0x4822f6[_0x2e9a('0x18')],{'raw':_0x4822f6[_0x2e9a('0x19')]?_0x4822f6[_0x2e9a('0x19')][_0x2e9a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4822f6[_0x2e9a('0x19')]?_0x4822f6[_0x2e9a('0x19')][_0x2e9a('0x1b')]||null:null,'attributes':_0x4822f6['options']?_0x4822f6[_0x2e9a('0x19')][_0x2e9a('0x1c')]||null:null,'limit':_0x4822f6[_0x2e9a('0x19')]?_0x4822f6['options'][_0x2e9a('0x1d')]||null:null})['then'](function(_0x51ebc4){logger[_0x2e9a('0xb')](_0x2e9a('0x15'),_0x4822f6);logger['debug'](_0x2e9a('0x15'),_0x4822f6,JSON[_0x2e9a('0x10')](_0x51ebc4));_0x13e52b(_0x51ebc4);})[_0x2e9a('0x14')](function(_0x28a3a6){logger[_0x2e9a('0x11')](_0x2e9a('0x15'),_0x28a3a6[_0x2e9a('0x12')],_0x4822f6);_0x30728c(_0x2e7d01[_0x2e9a('0x11')](0x1f4,_0x28a3a6['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index b425e02..d18a999 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 _0x0598=['../../components/auth/service','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra'];(function(_0x9d4ce4,_0x510f23){var _0x555e00=function(_0x2572f9){while(--_0x2572f9){_0x9d4ce4['push'](_0x9d4ce4['shift']());}};_0x555e00(++_0x510f23);}(_0x0598,0x92));var _0x8059=function(_0x15d767,_0x3ed410){_0x15d767=_0x15d767-0x0;var _0x2eca00=_0x0598[_0x15d767];return _0x2eca00;};'use strict';var multer=require(_0x8059('0x0'));var util=require(_0x8059('0x1'));var path=require('path');var timeout=require(_0x8059('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8059('0x3'));var auth=require(_0x8059('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxApplication.controller');router[_0x8059('0x5')]('/',auth[_0x8059('0x6')](),controller['index']);router['get'](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0x8')]);router[_0x8059('0x9')]('/',auth['isAuthenticated'](),controller['create']);router[_0x8059('0xa')](_0x8059('0x7'),auth[_0x8059('0x6')](),controller[_0x8059('0xb')]);router[_0x8059('0xc')]('/:id',auth['isAuthenticated'](),controller[_0x8059('0xd')]);module[_0x8059('0xe')]=router; \ No newline at end of file +var _0xed3c=['index','show','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./faxApplication.controller','get','isAuthenticated'];(function(_0x169dd4,_0x40c532){var _0x58359f=function(_0x2850f1){while(--_0x2850f1){_0x169dd4['push'](_0x169dd4['shift']());}};_0x58359f(++_0x40c532);}(_0xed3c,0x1a6));var _0xced3=function(_0x2f0f90,_0x411945){_0x2f0f90=_0x2f0f90-0x0;var _0x3da03a=_0xed3c[_0x2f0f90];return _0x3da03a;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var fs_extra=require(_0xced3('0x5'));var auth=require(_0xced3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced3('0x7'));router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xa')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xced3('0xb')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xced3('0xc')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0xe')]);router[_0xced3('0xf')]('/:id',auth[_0xced3('0x9')](),controller[_0xced3('0x10')]);module[_0xced3('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 b8e6596..2b8d1ed 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 _0xa30a=['exports','BOOLEAN','STRING','DATE','ENUM','out','INTEGER','sequelize'];(function(_0x591331,_0x39cdc1){var _0x4570ff=function(_0xe4a8fb){while(--_0xe4a8fb){_0x591331['push'](_0x591331['shift']());}};_0x4570ff(++_0x39cdc1);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaa30('0x0'));module[_0xaa30('0x1')]={'closed':{'type':Sequelize[_0xaa30('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xaa30('0x3')]},'secondDisposition':{'type':Sequelize[_0xaa30('0x3')]},'thirdDisposition':{'type':Sequelize[_0xaa30('0x3')]},'note':{'type':Sequelize[_0xaa30('0x3')]},'read1stAt':{'type':Sequelize[_0xaa30('0x4')]},'fax':{'type':Sequelize[_0xaa30('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xaa30('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xaa30('0x4')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xaa30('0x6')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xaa30('0x7')]}}; \ No newline at end of file +var _0xe2fe=['DATE','STRING','out','INTEGER','sequelize'];(function(_0x466e9b,_0x19a655){var _0x39a57b=function(_0x1b6b81){while(--_0x1b6b81){_0x466e9b['push'](_0x466e9b['shift']());}};_0x39a57b(++_0x19a655);}(_0xe2fe,0x86));var _0xee2f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe2fe[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xee2f('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xee2f('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xee2f('0x2')]},'thirdDisposition':{'type':Sequelize[_0xee2f('0x2')]},'note':{'type':Sequelize[_0xee2f('0x2')]},'read1stAt':{'type':Sequelize[_0xee2f('0x1')]},'fax':{'type':Sequelize[_0xee2f('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xee2f('0x3')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xee2f('0x1')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xee2f('0x3')),'defaultValue':'in','allowNull':![]},'queueId':{'type':Sequelize[_0xee2f('0x4')]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index b619c65..4b7420b 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 _0xe751=['socket.io-emitter','./faxInteraction.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','update','destroy','then','error','name','index','FaxInteraction','rawAttributes','fieldName','type','getOptions','findAll','fax','query','user','catch','show','params','model','keys','intersection','attributes','fields','includeAll','include','options','create','body','find','addMessage','ids','omit','FaxMessage','filters','length','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','merge','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','spread','Tag','color','emit','faxInteractionTags:save','removeTags','unix','toString','join','root','server','files','attachments','format','transcript-%d-%s.zip','Attachment','Messages','createdAt','get','mkdirSync','basename','existsSync','createReadStream','createWriteStream','download','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','path','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis'];(function(_0x1f8490,_0xf8509b){var _0x295061=function(_0xa4b16){while(--_0xa4b16){_0x1f8490['push'](_0x1f8490['shift']());}};_0x295061(++_0xf8509b);}(_0xe751,0x199));var _0x1e75=function(_0x11239c,_0x2fc625){_0x11239c=_0x11239c-0x0;var _0x2ad4e6=_0xe751[_0x11239c];return _0x2ad4e6;};'use strict';var rimraf=require(_0x1e75('0x0'));var zipdir=require(_0x1e75('0x1'));var moment=require('moment');var BPromise=require(_0x1e75('0x2'));var util=require(_0x1e75('0x3'));var path=require(_0x1e75('0x4'));var fs=require('fs');var _=require(_0x1e75('0x5'));var Redis=require(_0x1e75('0x6'));var interaction=require(_0x1e75('0x7'));var qs=require(_0x1e75('0x8'));var logger=require(_0x1e75('0x9'))(_0x1e75('0xa'));var config=require(_0x1e75('0xb'));var db=require(_0x1e75('0xc'))['db'];config['redis']=_[_0x1e75('0xd')](config[_0x1e75('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0x1e75('0xf'))(new Redis(config['redis']));require(_0x1e75('0x10'))[_0x1e75('0x11')](socket);function respondWithStatusCode(_0xe98774,_0x73f583){_0x73f583=_0x73f583||0xcc;return function(_0x5a5a5e){if(_0x5a5a5e){return _0xe98774[_0x1e75('0x12')](_0x73f583);}return _0xe98774['status'](_0x73f583)[_0x1e75('0x13')]();};}function respondWithResult(_0x391f7c,_0x31aa23){_0x31aa23=_0x31aa23||0xc8;return function(_0x2aa2a0){if(_0x2aa2a0){return _0x391f7c[_0x1e75('0x14')](_0x31aa23)[_0x1e75('0x15')](_0x2aa2a0);}};}function respondWithFilteredResult(_0x37d70e,_0x52a10f){return function(_0x2a0cd8){if(_0x2a0cd8){var _0x4fffd2=typeof _0x52a10f[_0x1e75('0x16')]===_0x1e75('0x17')&&typeof _0x52a10f[_0x1e75('0x18')]==='undefined';var _0x3d1951=_0x2a0cd8['count'];var _0xd703e5=_0x4fffd2?0x0:_0x52a10f['offset'];var _0x5531bd=_0x4fffd2?_0x2a0cd8[_0x1e75('0x19')]:_0x52a10f[_0x1e75('0x16')]+_0x52a10f[_0x1e75('0x18')];var _0x29bbc3;if(_0x5531bd>=_0x3d1951){_0x5531bd=_0x3d1951;_0x29bbc3=0xc8;}else{_0x29bbc3=0xce;}_0x37d70e[_0x1e75('0x14')](_0x29bbc3);return _0x37d70e[_0x1e75('0x1a')](_0x1e75('0x1b'),_0xd703e5+'-'+_0x5531bd+'/'+_0x3d1951)[_0x1e75('0x15')](_0x2a0cd8);}return null;};}function saveUpdates(_0x1b3dbc){return function(_0xdcfd40){if(_0xdcfd40){return _0xdcfd40[_0x1e75('0x1c')](_0x1b3dbc)['then'](function(_0x4a499f){return _0x4a499f;});}return null;};}function removeEntity(_0x48e40f){return function(_0x1bf67e){if(_0x1bf67e){return _0x1bf67e[_0x1e75('0x1d')]()[_0x1e75('0x1e')](function(){_0x48e40f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb47dde){return function(_0x58d991){if(!_0x58d991){_0xb47dde[_0x1e75('0x12')](0x194);}return _0x58d991;};}function handleError(_0x2bb4a9,_0x4d6b29){_0x4d6b29=_0x4d6b29||0x1f4;return function(_0x2f9f05){logger[_0x1e75('0x1f')](_0x2f9f05['stack']);if(_0x2f9f05[_0x1e75('0x20')]){delete _0x2f9f05[_0x1e75('0x20')];}_0x2bb4a9[_0x1e75('0x14')](_0x4d6b29)['send'](_0x2f9f05);};}exports[_0x1e75('0x21')]=function(_0x307be0,_0x1d87d8){var _0x12d337={};var _0x2f76e5=_['map'](db[_0x1e75('0x22')][_0x1e75('0x23')],function(_0x437b3d){return{'name':_0x437b3d[_0x1e75('0x24')],'type':_0x437b3d[_0x1e75('0x25')]['key']};});_0x12d337=qs[_0x1e75('0x26')](_0x2f76e5,_0x307be0);return interaction[_0x1e75('0x27')](_0x1e75('0x28'),_0x307be0[_0x1e75('0x29')],_0x307be0[_0x1e75('0x2a')],_0x12d337,_0x2f76e5)[_0x1e75('0x1e')](respondWithFilteredResult(_0x1d87d8,_0x12d337))[_0x1e75('0x2b')](handleError(_0x1d87d8,null));};exports[_0x1e75('0x2c')]=function(_0x13cd6b,_0x4247f0){var _0x2a96d8={'raw':![],'where':{'id':_0x13cd6b[_0x1e75('0x2d')]['id']}},_0xafe0={};_0xafe0[_0x1e75('0x2e')]=_['keys'](db[_0x1e75('0x22')][_0x1e75('0x23')]);_0xafe0[_0x1e75('0x29')]=_[_0x1e75('0x2f')](_0x13cd6b[_0x1e75('0x29')]);_0xafe0['filters']=_[_0x1e75('0x30')](_0xafe0[_0x1e75('0x2e')],_0xafe0[_0x1e75('0x29')]);_0x2a96d8[_0x1e75('0x31')]=_['intersection'](_0xafe0['model'],qs[_0x1e75('0x32')](_0x13cd6b[_0x1e75('0x29')][_0x1e75('0x32')]));_0x2a96d8[_0x1e75('0x31')]=_0x2a96d8['attributes']['length']?_0x2a96d8[_0x1e75('0x31')]:_0xafe0[_0x1e75('0x2e')];if(_0x13cd6b[_0x1e75('0x29')][_0x1e75('0x33')]){_0x2a96d8[_0x1e75('0x34')]=[{'all':!![]}];}_0x2a96d8=_['merge']({},_0x2a96d8,_0x13cd6b[_0x1e75('0x35')]);return db['FaxInteraction']['find'](_0x2a96d8)[_0x1e75('0x1e')](handleEntityNotFound(_0x4247f0,null))[_0x1e75('0x1e')](respondWithResult(_0x4247f0,null))[_0x1e75('0x2b')](handleError(_0x4247f0,null));};exports['create']=function(_0x54fedc,_0xb9fdc0){return db[_0x1e75('0x22')][_0x1e75('0x36')](_0x54fedc[_0x1e75('0x37')],{})[_0x1e75('0x1e')](respondWithResult(_0xb9fdc0,0xc9))[_0x1e75('0x2b')](handleError(_0xb9fdc0,null));};exports[_0x1e75('0x1c')]=function(_0x8024a1,_0x479e85){if(_0x8024a1[_0x1e75('0x37')]['id']){delete _0x8024a1['body']['id'];}return db[_0x1e75('0x22')][_0x1e75('0x38')]({'where':{'id':_0x8024a1[_0x1e75('0x2d')]['id']}})[_0x1e75('0x1e')](handleEntityNotFound(_0x479e85,null))[_0x1e75('0x1e')](saveUpdates(_0x8024a1[_0x1e75('0x37')],null))['then'](respondWithResult(_0x479e85,null))[_0x1e75('0x2b')](handleError(_0x479e85,null));};exports[_0x1e75('0x1d')]=function(_0x1cf1b7,_0x54a3d4){return db[_0x1e75('0x22')][_0x1e75('0x38')]({'where':{'id':_0x1cf1b7[_0x1e75('0x2d')]['id']}})[_0x1e75('0x1e')](handleEntityNotFound(_0x54a3d4,null))['then'](removeEntity(_0x54a3d4,null))[_0x1e75('0x2b')](handleError(_0x54a3d4,null));};exports['describe']=function(_0x1bac15,_0x2fa270){return db[_0x1e75('0x22')]['describe']()[_0x1e75('0x1e')](respondWithResult(_0x2fa270,null))[_0x1e75('0x2b')](handleError(_0x2fa270,null));};exports[_0x1e75('0x39')]=function(_0x4c166c,_0x334bb0){return db['FaxMessage'][_0x1e75('0x38')]({'where':{'id':_0x4c166c['params']['id']}})['then'](handleEntityNotFound(_0x334bb0,null))[_0x1e75('0x1e')](function(_0x24fcc6){if(_0x24fcc6){return _0x24fcc6['addMessage'](_0x4c166c[_0x1e75('0x37')][_0x1e75('0x3a')],_[_0x1e75('0x3b')](_0x4c166c['body'],[_0x1e75('0x3a'),'id'])||{});}})['then'](respondWithResult(_0x334bb0,null))[_0x1e75('0x2b')](handleError(_0x334bb0,null));};exports['getMessages']=function(_0x5e9a7a,_0x10f00e){var _0x490f47={'raw':![],'where':{}};var _0x2a1cd7={};var _0x27e3ae={'count':0x0,'rows':[]};return db[_0x1e75('0x22')]['findOne']({'where':{'id':_0x5e9a7a[_0x1e75('0x2d')]['id']}})[_0x1e75('0x1e')](handleEntityNotFound(_0x10f00e,null))[_0x1e75('0x1e')](function(_0x317b95){if(_0x317b95){_0x2a1cd7[_0x1e75('0x2e')]=_[_0x1e75('0x2f')](db[_0x1e75('0x3c')][_0x1e75('0x23')]);_0x2a1cd7[_0x1e75('0x29')]=_[_0x1e75('0x2f')](_0x5e9a7a[_0x1e75('0x29')]);_0x2a1cd7[_0x1e75('0x3d')]=_[_0x1e75('0x30')](_0x2a1cd7['model'],_0x2a1cd7[_0x1e75('0x29')]);_0x490f47[_0x1e75('0x31')]=_['intersection'](_0x2a1cd7[_0x1e75('0x2e')],qs['fields'](_0x5e9a7a[_0x1e75('0x29')][_0x1e75('0x32')]));_0x490f47[_0x1e75('0x31')]=_0x490f47[_0x1e75('0x31')][_0x1e75('0x3e')]?_0x490f47[_0x1e75('0x31')]:_0x2a1cd7[_0x1e75('0x2e')];if(!_0x5e9a7a['query'][_0x1e75('0x3f')](_0x1e75('0x40'))){_0x490f47[_0x1e75('0x18')]=qs[_0x1e75('0x18')](_0x5e9a7a['query'][_0x1e75('0x18')]);_0x490f47[_0x1e75('0x16')]=qs['offset'](_0x5e9a7a[_0x1e75('0x29')][_0x1e75('0x16')]);}_0x490f47[_0x1e75('0x41')]=qs['sort'](_0x5e9a7a[_0x1e75('0x29')][_0x1e75('0x42')]);_0x490f47[_0x1e75('0x43')]=qs['filters'](_[_0x1e75('0x44')](_0x5e9a7a[_0x1e75('0x29')],_0x2a1cd7[_0x1e75('0x3d')]));_0x490f47[_0x1e75('0x43')][_0x1e75('0x45')]=_0x317b95['id'];if(_0x5e9a7a[_0x1e75('0x29')][_0x1e75('0x46')]){_0x490f47[_0x1e75('0x43')]=_[_0x1e75('0x47')](_0x490f47['where'],{'$or':_[_0x1e75('0x48')](_0x490f47['attributes'],function(_0x5ee58e){var _0x4c3096={};_0x4c3096[_0x5ee58e]={'$like':'%'+_0x5e9a7a[_0x1e75('0x29')]['filter']+'%'};return _0x4c3096;})});}if(_0x5e9a7a['query'][_0x1e75('0x49')]){var _0xffe6c4=_0x5e9a7a[_0x1e75('0x29')]['$gte'][_0x1e75('0x4a')](',');var _0x1d120d={};_0x1d120d[_0xffe6c4[0x0]]={'$gte':moment(_0xffe6c4[0x1])['format'](_0x1e75('0x4b'))};_0x490f47['where']=_[_0x1e75('0x47')](_0x490f47['where'],_0x1d120d);}_0x490f47=_[_0x1e75('0x47')]({},_0x490f47,_0x5e9a7a[_0x1e75('0x35')]);return db[_0x1e75('0x3c')][_0x1e75('0x19')]({'where':_0x490f47[_0x1e75('0x43')]})[_0x1e75('0x1e')](function(_0x936b0c){_0x27e3ae[_0x1e75('0x19')]=_0x936b0c;if(_0x5e9a7a[_0x1e75('0x29')][_0x1e75('0x33')]){_0x490f47[_0x1e75('0x34')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x490f47);})[_0x1e75('0x1e')](function(_0x365646){_0x27e3ae[_0x1e75('0x4c')]=_0x365646;return _0x27e3ae;});}})[_0x1e75('0x1e')](respondWithFilteredResult(_0x10f00e,_0x490f47))[_0x1e75('0x2b')](handleError(_0x10f00e,null));};exports[_0x1e75('0x4d')]=function(_0x67baca,_0x418cc6){return db[_0x1e75('0x22')][_0x1e75('0x38')]({'where':{'id':_0x67baca[_0x1e75('0x2d')]['id']}})['then'](handleEntityNotFound(_0x418cc6,null))[_0x1e75('0x1e')](function(_0xf253af){if(_0xf253af){return _0xf253af['setTags'](_0x67baca[_0x1e75('0x37')][_0x1e75('0x3a')],_[_0x1e75('0x3b')](_0x67baca[_0x1e75('0x37')],['ids','id'])||{})[_0x1e75('0x4e')](function(){return db[_0x1e75('0x4f')][_0x1e75('0x27')]({'attributes':['id',_0x1e75('0x20'),_0x1e75('0x50')],'where':{'id':_0x67baca['body']['ids']}});})[_0x1e75('0x1e')](function(_0x16b7de){socket[_0x1e75('0x51')](_0x1e75('0x52'),{'id':Number(_0x67baca[_0x1e75('0x2d')]['id']),'tags':_0x16b7de||[]});return{'id':Number(_0x67baca[_0x1e75('0x2d')]['id']),'tags':_0x16b7de||[]};});}})[_0x1e75('0x1e')](respondWithResult(_0x418cc6,null))[_0x1e75('0x2b')](handleError(_0x418cc6,null));};exports['removeTags']=function(_0x3d0da0,_0x271f85){return db[_0x1e75('0x22')][_0x1e75('0x38')]({'where':{'id':_0x3d0da0['params']['id']}})[_0x1e75('0x1e')](handleEntityNotFound(_0x271f85,null))[_0x1e75('0x1e')](function(_0x5c1f98){if(_0x5c1f98){return _0x5c1f98[_0x1e75('0x53')](_0x3d0da0[_0x1e75('0x29')][_0x1e75('0x3a')]);}})[_0x1e75('0x1e')](respondWithStatusCode(_0x271f85,null))[_0x1e75('0x2b')](handleError(_0x271f85,null));};exports['download']=function(_0x25f940,_0x1093f6){var _0xed760b=moment()[_0x1e75('0x54')]()[_0x1e75('0x55')]();var _0x36bd38=path[_0x1e75('0x56')](config[_0x1e75('0x57')],_0x1e75('0x58'),_0x1e75('0x59'),'tmp');var _0x3e127c=path['join'](config[_0x1e75('0x57')],'server',_0x1e75('0x59'),_0x1e75('0x5a'));var _0x9cfd80=path['join'](_0x36bd38,_0xed760b);var _0x1f8dfe=util[_0x1e75('0x5b')](_0x1e75('0x5c'),_0x25f940[_0x1e75('0x2d')]['id'],_0xed760b);var _0x5f0e39=path[_0x1e75('0x56')](_0x36bd38,_0x1f8dfe);var _0x5680b0=[];_0x5680b0['push']({'model':db[_0x1e75('0x5d')],'as':_0x1e75('0x5d'),'raw':!![]});var _0x16d2b1=[{'model':db['FaxMessage'],'as':_0x1e75('0x5e'),'attributes':['id','body',_0x1e75('0x5f')],'include':_0x5680b0}];return db[_0x1e75('0x22')]['find']({'where':{'id':_0x25f940[_0x1e75('0x2d')]['id']},'include':_0x16d2b1})['then'](handleEntityNotFound(_0x1093f6,null))[_0x1e75('0x1e')](function(_0xa06f0f){if(_0xa06f0f&&_0xa06f0f['Messages']){var _0x45ccc8=_0xa06f0f[_0x1e75('0x60')]({'plain':!![]});fs[_0x1e75('0x61')](_0x9cfd80);for(var _0x37d76f=0x0;_0x37d76f<_0x45ccc8[_0x1e75('0x5e')][_0x1e75('0x3e')];_0x37d76f++){var _0x13297e=_0x45ccc8[_0x1e75('0x5e')][_0x37d76f][_0x1e75('0x5d')];if(_0x13297e){var _0x2a086c=path[_0x1e75('0x56')](_0x3e127c,_0x13297e[_0x1e75('0x62')]);if(fs[_0x1e75('0x63')](_0x2a086c)){fs[_0x1e75('0x64')](_0x2a086c)['pipe'](fs[_0x1e75('0x65')](path['join'](_0x9cfd80,_0x13297e[_0x1e75('0x62')])));}}}return BPromise['resolve']()[_0x1e75('0x1e')](function(){return new BPromise(function(_0x1f5d6c,_0x2dbd7b){zipdir(_0x9cfd80,{'saveTo':_0x5f0e39},function(_0x5d02d4,_0xbbced8){if(_0x5d02d4)return _0x2dbd7b(_0x5d02d4);return _0x1f5d6c(_0xbbced8);});})[_0x1e75('0x1e')](function(){return new BPromise(function(_0x259e50,_0x40cac9){rimraf(_0x9cfd80,function(_0x4f1015){if(_0x4f1015)_0x40cac9(_0x4f1015);return _0x259e50();});});})['then'](function(){return _0x1093f6[_0x1e75('0x66')](_0x5f0e39,_0x1f8dfe,function(_0x2ec1){if(_0x2ec1){console[_0x1e75('0x67')](_0x1e75('0x68'),_0x2ec1);}else{fs[_0x1e75('0x69')](_0x5f0e39);}});});});}else{return _0x1093f6[_0x1e75('0x12')](0xc8);}})[_0x1e75('0x2b')](handleError(_0x1093f6,null));}; \ No newline at end of file +var _0x32a6=['ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','status','json','offset','undefined','count','limit','set','update','then','destroy','end','sendStatus','error','stack','name','index','map','FaxInteraction','rawAttributes','fieldName','type','getOptions','fax','catch','model','keys','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','create','body','params','FaxMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','sort','where','pick','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','setTags','Tag','emit','faxInteractionTags:save','removeTags','download','toString','join','server','files','tmp','root','attachments','push','Attachment','Messages','createdAt','get','basename','createReadStream','pipe','createWriteStream','log','unlinkSync','rimraf','zip-dir','moment','util','path'];(function(_0x592416,_0x1cac8b){var _0x527db5=function(_0x3f65e0){while(--_0x3f65e0){_0x592416['push'](_0x592416['shift']());}};_0x527db5(++_0x1cac8b);}(_0x32a6,0x127));var _0x632a=function(_0x2a183f,_0x479397){_0x2a183f=_0x2a183f-0x0;var _0x27c963=_0x32a6[_0x2a183f];return _0x27c963;};'use strict';var rimraf=require(_0x632a('0x0'));var zipdir=require(_0x632a('0x1'));var moment=require(_0x632a('0x2'));var BPromise=require('bluebird');var util=require(_0x632a('0x3'));var path=require(_0x632a('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x632a('0x5'));var interaction=require(_0x632a('0x6'));var qs=require(_0x632a('0x7'));var logger=require(_0x632a('0x8'))(_0x632a('0x9'));var config=require(_0x632a('0xa'));var db=require(_0x632a('0xb'))['db'];config[_0x632a('0xc')]=_[_0x632a('0xd')](config[_0x632a('0xc')],{'host':_0x632a('0xe'),'port':0x18eb});var socket=require(_0x632a('0xf'))(new Redis(config[_0x632a('0xc')]));require(_0x632a('0x10'))[_0x632a('0x11')](socket);function respondWithStatusCode(_0x27f18d,_0x325c39){_0x325c39=_0x325c39||0xcc;return function(_0x378224){if(_0x378224){return _0x27f18d['sendStatus'](_0x325c39);}return _0x27f18d[_0x632a('0x12')](_0x325c39)['end']();};}function respondWithResult(_0x1621f5,_0x3374cf){_0x3374cf=_0x3374cf||0xc8;return function(_0x31700a){if(_0x31700a){return _0x1621f5[_0x632a('0x12')](_0x3374cf)[_0x632a('0x13')](_0x31700a);}};}function respondWithFilteredResult(_0x5d0203,_0x3531c1){return function(_0x3b1f17){if(_0x3b1f17){var _0x1cbb62=typeof _0x3531c1[_0x632a('0x14')]==='undefined'&&typeof _0x3531c1['limit']===_0x632a('0x15');var _0x43eb48=_0x3b1f17[_0x632a('0x16')];var _0x58542e=_0x1cbb62?0x0:_0x3531c1[_0x632a('0x14')];var _0x55fd5c=_0x1cbb62?_0x3b1f17[_0x632a('0x16')]:_0x3531c1['offset']+_0x3531c1[_0x632a('0x17')];var _0xf8bfa8;if(_0x55fd5c>=_0x43eb48){_0x55fd5c=_0x43eb48;_0xf8bfa8=0xc8;}else{_0xf8bfa8=0xce;}_0x5d0203['status'](_0xf8bfa8);return _0x5d0203[_0x632a('0x18')]('Content-Range',_0x58542e+'-'+_0x55fd5c+'/'+_0x43eb48)[_0x632a('0x13')](_0x3b1f17);}return null;};}function saveUpdates(_0x213366){return function(_0x2a15b6){if(_0x2a15b6){return _0x2a15b6[_0x632a('0x19')](_0x213366)[_0x632a('0x1a')](function(_0x4451a6){return _0x4451a6;});}return null;};}function removeEntity(_0x4c24f0){return function(_0x4af161){if(_0x4af161){return _0x4af161[_0x632a('0x1b')]()[_0x632a('0x1a')](function(){_0x4c24f0[_0x632a('0x12')](0xcc)[_0x632a('0x1c')]();});}};}function handleEntityNotFound(_0x431b6d){return function(_0x1338bd){if(!_0x1338bd){_0x431b6d[_0x632a('0x1d')](0x194);}return _0x1338bd;};}function handleError(_0x4c451a,_0x24492f){_0x24492f=_0x24492f||0x1f4;return function(_0x46a093){logger[_0x632a('0x1e')](_0x46a093[_0x632a('0x1f')]);if(_0x46a093['name']){delete _0x46a093[_0x632a('0x20')];}_0x4c451a[_0x632a('0x12')](_0x24492f)['send'](_0x46a093);};}exports[_0x632a('0x21')]=function(_0x1f3742,_0x46584a){var _0x363f4b={};var _0x447282=_[_0x632a('0x22')](db[_0x632a('0x23')][_0x632a('0x24')],function(_0x305f4b){return{'name':_0x305f4b[_0x632a('0x25')],'type':_0x305f4b[_0x632a('0x26')]['key']};});_0x363f4b=qs[_0x632a('0x27')](_0x447282,_0x1f3742);return interaction['findAll'](_0x632a('0x28'),_0x1f3742['query'],_0x1f3742['user'],_0x363f4b,_0x447282)[_0x632a('0x1a')](respondWithFilteredResult(_0x46584a,_0x363f4b))[_0x632a('0x29')](handleError(_0x46584a,null));};exports['show']=function(_0x29b58f,_0x1aeabb){var _0x24da9c={'raw':![],'where':{'id':_0x29b58f['params']['id']}},_0x21747b={};_0x21747b[_0x632a('0x2a')]=_[_0x632a('0x2b')](db[_0x632a('0x23')][_0x632a('0x24')]);_0x21747b['query']=_[_0x632a('0x2b')](_0x29b58f[_0x632a('0x2c')]);_0x21747b[_0x632a('0x2d')]=_[_0x632a('0x2e')](_0x21747b[_0x632a('0x2a')],_0x21747b[_0x632a('0x2c')]);_0x24da9c[_0x632a('0x2f')]=_['intersection'](_0x21747b['model'],qs[_0x632a('0x30')](_0x29b58f['query']['fields']));_0x24da9c[_0x632a('0x2f')]=_0x24da9c[_0x632a('0x2f')][_0x632a('0x31')]?_0x24da9c[_0x632a('0x2f')]:_0x21747b[_0x632a('0x2a')];if(_0x29b58f[_0x632a('0x2c')][_0x632a('0x32')]){_0x24da9c[_0x632a('0x33')]=[{'all':!![]}];}_0x24da9c=_[_0x632a('0x34')]({},_0x24da9c,_0x29b58f[_0x632a('0x35')]);return db[_0x632a('0x23')][_0x632a('0x36')](_0x24da9c)[_0x632a('0x1a')](handleEntityNotFound(_0x1aeabb,null))[_0x632a('0x1a')](respondWithResult(_0x1aeabb,null))[_0x632a('0x29')](handleError(_0x1aeabb,null));};exports[_0x632a('0x37')]=function(_0x150efe,_0x1a2ce4){return db[_0x632a('0x23')][_0x632a('0x37')](_0x150efe[_0x632a('0x38')],{})[_0x632a('0x1a')](respondWithResult(_0x1a2ce4,0xc9))[_0x632a('0x29')](handleError(_0x1a2ce4,null));};exports[_0x632a('0x19')]=function(_0x4e90e1,_0xe3ac22){if(_0x4e90e1[_0x632a('0x38')]['id']){delete _0x4e90e1['body']['id'];}return db[_0x632a('0x23')][_0x632a('0x36')]({'where':{'id':_0x4e90e1[_0x632a('0x39')]['id']}})['then'](handleEntityNotFound(_0xe3ac22,null))['then'](saveUpdates(_0x4e90e1[_0x632a('0x38')],null))[_0x632a('0x1a')](respondWithResult(_0xe3ac22,null))[_0x632a('0x29')](handleError(_0xe3ac22,null));};exports['destroy']=function(_0x3fe1b8,_0x21ae2c){return db[_0x632a('0x23')][_0x632a('0x36')]({'where':{'id':_0x3fe1b8[_0x632a('0x39')]['id']}})[_0x632a('0x1a')](handleEntityNotFound(_0x21ae2c,null))[_0x632a('0x1a')](removeEntity(_0x21ae2c,null))[_0x632a('0x29')](handleError(_0x21ae2c,null));};exports['describe']=function(_0x3b1ddb,_0x51fa0c){return db[_0x632a('0x23')]['describe']()[_0x632a('0x1a')](respondWithResult(_0x51fa0c,null))['catch'](handleError(_0x51fa0c,null));};exports['addMessage']=function(_0x55e2a7,_0x110756){return db[_0x632a('0x3a')][_0x632a('0x36')]({'where':{'id':_0x55e2a7['params']['id']}})[_0x632a('0x1a')](handleEntityNotFound(_0x110756,null))[_0x632a('0x1a')](function(_0x355b40){if(_0x355b40){return _0x355b40[_0x632a('0x3b')](_0x55e2a7['body'][_0x632a('0x3c')],_[_0x632a('0x3d')](_0x55e2a7[_0x632a('0x38')],[_0x632a('0x3c'),'id'])||{});}})[_0x632a('0x1a')](respondWithResult(_0x110756,null))[_0x632a('0x29')](handleError(_0x110756,null));};exports[_0x632a('0x3e')]=function(_0x3969ea,_0x1aeea5){var _0x5d3b66={'raw':![],'where':{}};var _0x464ed6={};var _0x3a56b1={'count':0x0,'rows':[]};return db[_0x632a('0x23')][_0x632a('0x3f')]({'where':{'id':_0x3969ea[_0x632a('0x39')]['id']}})[_0x632a('0x1a')](handleEntityNotFound(_0x1aeea5,null))['then'](function(_0x2ff202){if(_0x2ff202){_0x464ed6[_0x632a('0x2a')]=_[_0x632a('0x2b')](db[_0x632a('0x3a')][_0x632a('0x24')]);_0x464ed6[_0x632a('0x2c')]=_[_0x632a('0x2b')](_0x3969ea[_0x632a('0x2c')]);_0x464ed6[_0x632a('0x2d')]=_['intersection'](_0x464ed6['model'],_0x464ed6[_0x632a('0x2c')]);_0x5d3b66[_0x632a('0x2f')]=_[_0x632a('0x2e')](_0x464ed6[_0x632a('0x2a')],qs[_0x632a('0x30')](_0x3969ea['query']['fields']));_0x5d3b66[_0x632a('0x2f')]=_0x5d3b66[_0x632a('0x2f')][_0x632a('0x31')]?_0x5d3b66['attributes']:_0x464ed6[_0x632a('0x2a')];if(!_0x3969ea['query'][_0x632a('0x40')](_0x632a('0x41'))){_0x5d3b66[_0x632a('0x17')]=qs['limit'](_0x3969ea['query'][_0x632a('0x17')]);_0x5d3b66[_0x632a('0x14')]=qs['offset'](_0x3969ea['query'][_0x632a('0x14')]);}_0x5d3b66['order']=qs[_0x632a('0x42')](_0x3969ea['query']['sort']);_0x5d3b66[_0x632a('0x43')]=qs['filters'](_[_0x632a('0x44')](_0x3969ea['query'],_0x464ed6[_0x632a('0x2d')]));_0x5d3b66[_0x632a('0x43')]['FaxInteractionId']=_0x2ff202['id'];if(_0x3969ea[_0x632a('0x2c')][_0x632a('0x45')]){_0x5d3b66[_0x632a('0x43')]=_[_0x632a('0x34')](_0x5d3b66[_0x632a('0x43')],{'$or':_[_0x632a('0x22')](_0x5d3b66[_0x632a('0x2f')],function(_0x46e312){var _0x132b32={};_0x132b32[_0x46e312]={'$like':'%'+_0x3969ea['query'][_0x632a('0x45')]+'%'};return _0x132b32;})});}if(_0x3969ea['query'][_0x632a('0x46')]){var _0x2c7e6e=_0x3969ea['query'][_0x632a('0x46')][_0x632a('0x47')](',');var _0x2db640={};_0x2db640[_0x2c7e6e[0x0]]={'$gte':moment(_0x2c7e6e[0x1])[_0x632a('0x48')](_0x632a('0x49'))};_0x5d3b66[_0x632a('0x43')]=_['merge'](_0x5d3b66[_0x632a('0x43')],_0x2db640);}_0x5d3b66=_[_0x632a('0x34')]({},_0x5d3b66,_0x3969ea[_0x632a('0x35')]);return db['FaxMessage']['count']({'where':_0x5d3b66[_0x632a('0x43')]})['then'](function(_0x28c068){_0x3a56b1[_0x632a('0x16')]=_0x28c068;if(_0x3969ea[_0x632a('0x2c')][_0x632a('0x32')]){_0x5d3b66[_0x632a('0x33')]=[{'all':!![]}];}return db['FaxMessage'][_0x632a('0x4a')](_0x5d3b66);})[_0x632a('0x1a')](function(_0xb6795e){_0x3a56b1[_0x632a('0x4b')]=_0xb6795e;return _0x3a56b1;});}})[_0x632a('0x1a')](respondWithFilteredResult(_0x1aeea5,_0x5d3b66))[_0x632a('0x29')](handleError(_0x1aeea5,null));};exports['addTags']=function(_0x1592cd,_0x4ccdb9){return db[_0x632a('0x23')][_0x632a('0x36')]({'where':{'id':_0x1592cd[_0x632a('0x39')]['id']}})[_0x632a('0x1a')](handleEntityNotFound(_0x4ccdb9,null))['then'](function(_0x4c9910){if(_0x4c9910){return _0x4c9910[_0x632a('0x4c')](_0x1592cd[_0x632a('0x38')]['ids'],_['omit'](_0x1592cd[_0x632a('0x38')],['ids','id'])||{})['spread'](function(){return db[_0x632a('0x4d')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x1592cd[_0x632a('0x38')][_0x632a('0x3c')]}});})[_0x632a('0x1a')](function(_0x5e4d7b){socket[_0x632a('0x4e')](_0x632a('0x4f'),{'id':Number(_0x1592cd[_0x632a('0x39')]['id']),'tags':_0x5e4d7b||[]});return{'id':Number(_0x1592cd[_0x632a('0x39')]['id']),'tags':_0x5e4d7b||[]};});}})[_0x632a('0x1a')](respondWithResult(_0x4ccdb9,null))[_0x632a('0x29')](handleError(_0x4ccdb9,null));};exports[_0x632a('0x50')]=function(_0x3f2e50,_0x4eaded){return db[_0x632a('0x23')][_0x632a('0x36')]({'where':{'id':_0x3f2e50[_0x632a('0x39')]['id']}})[_0x632a('0x1a')](handleEntityNotFound(_0x4eaded,null))[_0x632a('0x1a')](function(_0x19b1d2){if(_0x19b1d2){return _0x19b1d2[_0x632a('0x50')](_0x3f2e50[_0x632a('0x2c')]['ids']);}})[_0x632a('0x1a')](respondWithStatusCode(_0x4eaded,null))[_0x632a('0x29')](handleError(_0x4eaded,null));};exports[_0x632a('0x51')]=function(_0x4c1c76,_0x502573){var _0x264aa7=moment()['unix']()[_0x632a('0x52')]();var _0x1ad027=path[_0x632a('0x53')](config['root'],_0x632a('0x54'),_0x632a('0x55'),_0x632a('0x56'));var _0x3fb456=path[_0x632a('0x53')](config[_0x632a('0x57')],_0x632a('0x54'),'files',_0x632a('0x58'));var _0x3e499e=path['join'](_0x1ad027,_0x264aa7);var _0x1e845e=util[_0x632a('0x48')]('transcript-%d-%s.zip',_0x4c1c76['params']['id'],_0x264aa7);var _0x538654=path['join'](_0x1ad027,_0x1e845e);var _0x3d4247=[];_0x3d4247[_0x632a('0x59')]({'model':db['Attachment'],'as':_0x632a('0x5a'),'raw':!![]});var _0x2bc961=[{'model':db[_0x632a('0x3a')],'as':_0x632a('0x5b'),'attributes':['id',_0x632a('0x38'),_0x632a('0x5c')],'include':_0x3d4247}];return db['FaxInteraction'][_0x632a('0x36')]({'where':{'id':_0x4c1c76[_0x632a('0x39')]['id']},'include':_0x2bc961})[_0x632a('0x1a')](handleEntityNotFound(_0x502573,null))['then'](function(_0x5302ef){if(_0x5302ef&&_0x5302ef[_0x632a('0x5b')]){var _0x1e07a5=_0x5302ef[_0x632a('0x5d')]({'plain':!![]});fs['mkdirSync'](_0x3e499e);for(var _0x194c07=0x0;_0x194c07<_0x1e07a5['Messages']['length'];_0x194c07++){var _0x13ecdc=_0x1e07a5['Messages'][_0x194c07][_0x632a('0x5a')];if(_0x13ecdc){var _0xa77253=path[_0x632a('0x53')](_0x3fb456,_0x13ecdc[_0x632a('0x5e')]);if(fs['existsSync'](_0xa77253)){fs[_0x632a('0x5f')](_0xa77253)[_0x632a('0x60')](fs[_0x632a('0x61')](path[_0x632a('0x53')](_0x3e499e,_0x13ecdc[_0x632a('0x5e')])));}}}return BPromise['resolve']()[_0x632a('0x1a')](function(){return new BPromise(function(_0xbfd62f,_0x4e5473){zipdir(_0x3e499e,{'saveTo':_0x538654},function(_0x494419,_0x5eaad4){if(_0x494419)return _0x4e5473(_0x494419);return _0xbfd62f(_0x5eaad4);});})[_0x632a('0x1a')](function(){return new BPromise(function(_0x41c645,_0x3e6922){rimraf(_0x3e499e,function(_0x1165fe){if(_0x1165fe)_0x3e6922(_0x1165fe);return _0x41c645();});});})[_0x632a('0x1a')](function(){return _0x502573[_0x632a('0x51')](_0x538654,_0x1e845e,function(_0x419a57){if(_0x419a57){console[_0x632a('0x62')]('err',_0x419a57);}else{fs[_0x632a('0x63')](_0x538654);}});});});}else{return _0x502573[_0x632a('0x1d')](0xc8);}})[_0x632a('0x29')](handleError(_0x502573,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 57f0ceb..17e30f0 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 _0xf607=['getUsers','setDataValue','Users','map','findAll','then','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update','remove'];(function(_0x184023,_0x29ac97){var _0x39eac0=function(_0x150f65){while(--_0x150f65){_0x184023['push'](_0x184023['shift']());}};_0x39eac0(++_0x29ac97);}(_0xf607,0xe4));var _0x7f60=function(_0x23abf2,_0x2a6ad1){_0x23abf2=_0x23abf2-0x0;var _0x5b2cfe=_0xf607[_0x23abf2];return _0x5b2cfe;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x7f60('0x0'))['db'][_0x7f60('0x1')];var FaxMessage=require(_0x7f60('0x0'))['db'][_0x7f60('0x2')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x7f60('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7f60('0x4'),'afterDestroy':_0x7f60('0x5')};function emitEvent(_0x4b04e0){return function(_0x4ffe2f,_0x21ffd0,_0x582e4b){_0x4ffe2f[_0x7f60('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x15beb5){_0x4ffe2f[_0x7f60('0x7')](_0x7f60('0x8'),_0x15beb5[_0x7f60('0x9')](function(_0x427fcc){return{'id':_0x427fcc['id']};}));return FaxMessage[_0x7f60('0xa')]({'where':{'FaxInteractionId':_0x4ffe2f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x7f60('0xb')](function(_0x57b30f){_0x4ffe2f['setDataValue'](_0x7f60('0xc'),_0x57b30f['length']);FaxInteractionEvents[_0x7f60('0xd')](_0x4b04e0+':'+_0x4ffe2f['id'],_0x4ffe2f);FaxInteractionEvents[_0x7f60('0xd')](_0x4b04e0,_0x4ffe2f);_0x582e4b(null);})[_0x7f60('0xe')](_0x582e4b(null));};}for(var e in events){if(events[_0x7f60('0xf')](e)){var event=events[e];FaxInteraction[_0x7f60('0x10')](e,emitEvent(event));}}module[_0x7f60('0x11')]=FaxInteractionEvents; \ No newline at end of file +var _0x137b=['update','remove','getUsers','then','setDataValue','Users','length','emit','catch','hasOwnProperty','hook','exports','events','FaxInteraction','../../mysqldb','FaxMessage','save'];(function(_0xe50756,_0x12b6ae){var _0x1541a5=function(_0x49c421){while(--_0x49c421){_0xe50756['push'](_0xe50756['shift']());}};_0x1541a5(++_0x12b6ae);}(_0x137b,0xe9));var _0xb137=function(_0x2638d0,_0x52f653){_0x2638d0=_0x2638d0-0x0;var _0x411a60=_0x137b[_0x2638d0];return _0x411a60;};'use strict';var EventEmitter=require(_0xb137('0x0'));var FaxInteraction=require('../../mysqldb')['db'][_0xb137('0x1')];var FaxMessage=require(_0xb137('0x2'))['db'][_0xb137('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb137('0x4'),'afterUpdate':_0xb137('0x5'),'afterDestroy':_0xb137('0x6')};function emitEvent(_0x32bdf4){return function(_0x14c873,_0x42921b,_0x291fb6){_0x14c873[_0xb137('0x7')]({'attributes':['id'],'raw':!![]})[_0xb137('0x8')](function(_0x146274){_0x14c873[_0xb137('0x9')](_0xb137('0xa'),_0x146274['map'](function(_0x2e1ccc){return{'id':_0x2e1ccc['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x14c873['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb137('0x8')](function(_0x582091){_0x14c873['setDataValue']('unreadMessages',_0x582091[_0xb137('0xb')]);FaxInteractionEvents[_0xb137('0xc')](_0x32bdf4+':'+_0x14c873['id'],_0x14c873);FaxInteractionEvents[_0xb137('0xc')](_0x32bdf4,_0x14c873);_0x291fb6(null);})[_0xb137('0xd')](_0x291fb6(null));};}for(var e in events){if(events[_0xb137('0xe')](e)){var event=events[e];FaxInteraction[_0xb137('0xf')](e,emitEvent(event));}}module[_0xb137('0x10')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index fcd9e7c..df90a8c 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 _0xb2c8=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','bluebird','request-promise','path','rimraf','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closed'];(function(_0x2db45e,_0x3c3b37){var _0x200a5=function(_0x2a9fb2){while(--_0x2a9fb2){_0x2db45e['push'](_0x2db45e['shift']());}};_0x200a5(++_0x3c3b37);}(_0xb2c8,0x197));var _0x8b2c=function(_0x3e3082,_0x3487ec){_0x3e3082=_0x3e3082-0x0;var _0x1ee834=_0xb2c8[_0x3e3082];return _0x1ee834;};'use strict';var _=require(_0x8b2c('0x0'));var util=require(_0x8b2c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8b2c('0x2'));var BPromise=require(_0x8b2c('0x3'));var rp=require(_0x8b2c('0x4'));var fs=require('fs');var path=require(_0x8b2c('0x5'));var rimraf=require(_0x8b2c('0x6'));var config=require('../../config/environment');var attributes=require(_0x8b2c('0x7'));module[_0x8b2c('0x8')]=function(_0x1b0e93,_0x565ad3){return _0x1b0e93[_0x8b2c('0x9')](_0x8b2c('0xa'),attributes,{'tableName':_0x8b2c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x59d8a1,_0x35608c,_0x399eb0){if(_0x59d8a1['changed'](_0x8b2c('0xc'))){_0x59d8a1['closedAt']=moment()[_0x8b2c('0xd')](_0x8b2c('0xe'));}_0x399eb0(null,_0x59d8a1);}}});}; \ No newline at end of file +var _0xb6ec=['../../config/environment','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4fbbe7,_0x1fdb52){var _0x8331b1=function(_0x3a413f){while(--_0x3a413f){_0x4fbbe7['push'](_0x4fbbe7['shift']());}};_0x8331b1(++_0x1fdb52);}(_0xb6ec,0xca));var _0xcb6e=function(_0xbc9a74,_0x5d258d){_0xbc9a74=_0xbc9a74-0x0;var _0x4a5552=_0xb6ec[_0xbc9a74];return _0x4a5552;};'use strict';var _=require(_0xcb6e('0x0'));var util=require(_0xcb6e('0x1'));var logger=require(_0xcb6e('0x2'))(_0xcb6e('0x3'));var moment=require('moment');var BPromise=require(_0xcb6e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xcb6e('0x5'));var rimraf=require('rimraf');var config=require(_0xcb6e('0x6'));var attributes=require('./faxInteraction.attributes');module[_0xcb6e('0x7')]=function(_0x507a50,_0x3c7533){return _0x507a50[_0xcb6e('0x8')](_0xcb6e('0x9'),attributes,{'tableName':_0xcb6e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x463f4c,_0x54dfee,_0x2d833b){if(_0x463f4c[_0xcb6e('0xb')](_0xcb6e('0xc'))){_0x463f4c[_0xcb6e('0xd')]=moment()[_0xcb6e('0xe')](_0xcb6e('0xf'));}_0x2d833b(null,_0x463f4c);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index c199385..7e49ca7 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 _0x394a=['localhost','socket.io-emitter','./faxInteraction.socket','register','request','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','attributes','then','find','addTags','omit','ids','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis'];(function(_0x93c068,_0x12f596){var _0x3c7015=function(_0x130131){while(--_0x130131){_0x93c068['push'](_0x93c068['shift']());}};_0x3c7015(++_0x12f596);}(_0x394a,0x143));var _0xa394=function(_0x5c1f23,_0x5f2cef){_0x5c1f23=_0x5c1f23-0x0;var _0x407ef8=_0x394a[_0x5c1f23];return _0x407ef8;};'use strict';var _=require(_0xa394('0x0'));var util=require('util');var moment=require(_0xa394('0x1'));var BPromise=require(_0xa394('0x2'));var rs=require(_0xa394('0x3'));var fs=require('fs');var Redis=require(_0xa394('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa394('0x5'));var logger=require(_0xa394('0x6'))(_0xa394('0x7'));var config=require(_0xa394('0x8'));var jayson=require(_0xa394('0x9'));var client=jayson[_0xa394('0xa')]['http']({'port':0x232a});config['redis']=_[_0xa394('0xb')](config[_0xa394('0xc')],{'host':_0xa394('0xd'),'port':0x18eb});var socket=require(_0xa394('0xe'))(new Redis(config[_0xa394('0xc')]));require(_0xa394('0xf'))[_0xa394('0x10')](socket);function respondWithRpcPromise(_0x2102c6,_0x52afba,_0x86b2ba){return new BPromise(function(_0x469839,_0xfea1b3){return client[_0xa394('0x11')](_0x2102c6,_0x86b2ba)['then'](function(_0x1d481e){logger[_0xa394('0x12')](_0xa394('0x13'),_0x52afba,_0xa394('0x14'));logger[_0xa394('0x15')](_0xa394('0x16'),_0x52afba,_0xa394('0x14'),JSON[_0xa394('0x17')](_0x1d481e));if(_0x1d481e['error']){if(_0x1d481e[_0xa394('0x18')][_0xa394('0x19')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x52afba,_0x1d481e['error'][_0xa394('0x1a')]);return _0xfea1b3(_0x1d481e[_0xa394('0x18')][_0xa394('0x1a')]);}logger['error'](_0xa394('0x13'),_0x52afba,_0x1d481e['error'][_0xa394('0x1a')]);return _0x469839(_0x1d481e[_0xa394('0x18')][_0xa394('0x1a')]);}else{logger[_0xa394('0x12')](_0xa394('0x13'),_0x52afba,'request\x20sent');_0x469839(_0x1d481e['result'][_0xa394('0x1a')]);}})[_0xa394('0x1b')](function(_0x2e926e){logger[_0xa394('0x18')](_0xa394('0x13'),_0x52afba,_0x2e926e);_0xfea1b3(_0x2e926e);});});}exports[_0xa394('0x1c')]=function(_0x448013){var _0x1b162b=this;return new Promise(function(_0x33de8a,_0x4c855f){return db[_0xa394('0x1d')]['update'](_0x448013[_0xa394('0x1e')],{'raw':_0x448013[_0xa394('0x1f')]?_0x448013[_0xa394('0x1f')][_0xa394('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x448013['options']?_0x448013[_0xa394('0x1f')][_0xa394('0x21')]||null:null,'attributes':_0x448013[_0xa394('0x1f')]?_0x448013[_0xa394('0x1f')][_0xa394('0x22')]||null:null,'limit':_0x448013[_0xa394('0x1f')]?_0x448013[_0xa394('0x1f')]['limit']||null:null})[_0xa394('0x23')](function(_0x3df011){logger[_0xa394('0x12')]('UpdateFaxInteraction',_0x448013);logger[_0xa394('0x15')]('UpdateFaxInteraction',_0x448013,JSON[_0xa394('0x17')](_0x3df011));_0x33de8a(_0x3df011);})[_0xa394('0x1b')](function(_0x542c6b){logger['error'](_0xa394('0x1c'),_0x542c6b[_0xa394('0x1a')],_0x448013);_0x4c855f(_0x1b162b['error'](0x1f4,_0x542c6b[_0xa394('0x1a')]));});});};exports['AddTagsToFaxInteraction']=function(_0x1750d5){return new Promise(function(_0x1fe06f,_0x3c3903){return db[_0xa394('0x1d')][_0xa394('0x24')]({'where':_0x1750d5[_0xa394('0x1f')]?_0x1750d5[_0xa394('0x1f')]['where']||null:null})['then'](function(_0x18887c){if(_0x18887c){return _0x18887c[_0xa394('0x25')](_0x1750d5[_0xa394('0x1e')]['ids'],_[_0xa394('0x26')](_0x1750d5[_0xa394('0x1e')],[_0xa394('0x27'),'id'])||{});}})[_0xa394('0x28')](function(_0x127124){logger[_0xa394('0x12')](_0xa394('0x29'),_0x1750d5);logger[_0xa394('0x15')](_0xa394('0x29'),_0x1750d5,JSON[_0xa394('0x17')](_0x127124));_0x1fe06f(_0x127124);})[_0xa394('0x1b')](function(_0x116e9e){logger[_0xa394('0x18')](_0xa394('0x29'),_0x116e9e['message'],_0x1750d5);_0x3c3903(_this[_0xa394('0x18')](0x1f4,_0x116e9e['message']));});});}; \ No newline at end of file +var _0x58bc=['catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','then','stringify','AddTagsToFaxInteraction','find','addTags','ids','omit','spread','AddTags','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','error','code','message','info','result'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0x58bc,0xf9));var _0xc58b=function(_0x1a58dc,_0x566e62){_0x1a58dc=_0x1a58dc-0x0;var _0x2ff7cd=_0x58bc[_0x1a58dc];return _0x2ff7cd;};'use strict';var _=require('lodash');var util=require(_0xc58b('0x0'));var moment=require(_0xc58b('0x1'));var BPromise=require(_0xc58b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc58b('0x3'));var db=require(_0xc58b('0x4'))['db'];var utils=require(_0xc58b('0x5'));var logger=require('../../config/logger')(_0xc58b('0x6'));var config=require(_0xc58b('0x7'));var jayson=require(_0xc58b('0x8'));var client=jayson[_0xc58b('0x9')][_0xc58b('0xa')]({'port':0x232a});config[_0xc58b('0xb')]=_[_0xc58b('0xc')](config[_0xc58b('0xb')],{'host':_0xc58b('0xd'),'port':0x18eb});var socket=require(_0xc58b('0xe'))(new Redis(config[_0xc58b('0xb')]));require(_0xc58b('0xf'))[_0xc58b('0x10')](socket);function respondWithRpcPromise(_0x4b8736,_0x49b751,_0x549175){return new BPromise(function(_0x174bff,_0x14939f){return client[_0xc58b('0x11')](_0x4b8736,_0x549175)['then'](function(_0x368841){logger['info'](_0xc58b('0x12'),_0x49b751,_0xc58b('0x13'));logger[_0xc58b('0x14')](_0xc58b('0x15'),_0x49b751,_0xc58b('0x13'),JSON['stringify'](_0x368841));if(_0x368841[_0xc58b('0x16')]){if(_0x368841[_0xc58b('0x16')][_0xc58b('0x17')]===0x1f4){logger['error']('FaxInteraction,\x20%s,\x20%s',_0x49b751,_0x368841['error'][_0xc58b('0x18')]);return _0x14939f(_0x368841[_0xc58b('0x16')][_0xc58b('0x18')]);}logger[_0xc58b('0x16')](_0xc58b('0x12'),_0x49b751,_0x368841[_0xc58b('0x16')][_0xc58b('0x18')]);return _0x174bff(_0x368841[_0xc58b('0x16')]['message']);}else{logger[_0xc58b('0x19')](_0xc58b('0x12'),_0x49b751,'request\x20sent');_0x174bff(_0x368841[_0xc58b('0x1a')][_0xc58b('0x18')]);}})[_0xc58b('0x1b')](function(_0x4c82fa){logger[_0xc58b('0x16')](_0xc58b('0x12'),_0x49b751,_0x4c82fa);_0x14939f(_0x4c82fa);});});}exports[_0xc58b('0x1c')]=function(_0x49562e){var _0x5608df=this;return new Promise(function(_0x26d83d,_0x56da04){return db[_0xc58b('0x1d')][_0xc58b('0x1e')](_0x49562e[_0xc58b('0x1f')],{'raw':_0x49562e[_0xc58b('0x20')]?_0x49562e['options'][_0xc58b('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x49562e[_0xc58b('0x20')]?_0x49562e['options'][_0xc58b('0x22')]||null:null,'attributes':_0x49562e[_0xc58b('0x20')]?_0x49562e[_0xc58b('0x20')][_0xc58b('0x23')]||null:null,'limit':_0x49562e[_0xc58b('0x20')]?_0x49562e[_0xc58b('0x20')][_0xc58b('0x24')]||null:null})[_0xc58b('0x25')](function(_0x5d6991){logger[_0xc58b('0x19')](_0xc58b('0x1c'),_0x49562e);logger[_0xc58b('0x14')](_0xc58b('0x1c'),_0x49562e,JSON[_0xc58b('0x26')](_0x5d6991));_0x26d83d(_0x5d6991);})[_0xc58b('0x1b')](function(_0x1dee37){logger[_0xc58b('0x16')]('UpdateFaxInteraction',_0x1dee37[_0xc58b('0x18')],_0x49562e);_0x56da04(_0x5608df[_0xc58b('0x16')](0x1f4,_0x1dee37['message']));});});};exports[_0xc58b('0x27')]=function(_0x345096){return new Promise(function(_0x422180,_0x42830){return db[_0xc58b('0x1d')][_0xc58b('0x28')]({'where':_0x345096[_0xc58b('0x20')]?_0x345096[_0xc58b('0x20')][_0xc58b('0x22')]||null:null})[_0xc58b('0x25')](function(_0x3f4c76){if(_0x3f4c76){return _0x3f4c76[_0xc58b('0x29')](_0x345096[_0xc58b('0x1f')][_0xc58b('0x2a')],_[_0xc58b('0x2b')](_0x345096[_0xc58b('0x1f')],[_0xc58b('0x2a'),'id'])||{});}})[_0xc58b('0x2c')](function(_0x45a654){logger[_0xc58b('0x19')](_0xc58b('0x2d'),_0x345096);logger[_0xc58b('0x14')](_0xc58b('0x2d'),_0x345096,JSON[_0xc58b('0x26')](_0x45a654));_0x422180(_0x45a654);})['catch'](function(_0x582062){logger['error']('AddTags',_0x582062[_0xc58b('0x18')],_0x345096);_0x42830(_this['error'](0x1f4,_0x582062['message']));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index f0351de..86869a3 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 _0x05bd=['save','remove','update','register','length','faxInteraction:'];(function(_0x563b6a,_0x29d2b7){var _0x46da0c=function(_0x20f3b9){while(--_0x20f3b9){_0x563b6a['push'](_0x563b6a['shift']());}};_0x46da0c(++_0x29d2b7);}(_0x05bd,0xa8));var _0xd05b=function(_0x657e67,_0x518f58){_0x657e67=_0x657e67-0x0;var _0x29e86d=_0x05bd[_0x657e67];return _0x29e86d;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0xd05b('0x0'),_0xd05b('0x1'),_0xd05b('0x2')];function createListener(_0x4dd7bc,_0x55deca){return function(_0x226079){_0x55deca['emit'](_0x4dd7bc,_0x226079);};}function removeListener(_0x4e345f,_0x3e47a1){return function(){FaxInteractionEvents['removeListener'](_0x4e345f,_0x3e47a1);};}exports[_0xd05b('0x3')]=function(_0x55c552){for(var _0x3a6b48=0x0,_0x2cbb6c=events[_0xd05b('0x4')];_0x3a6b48<_0x2cbb6c;_0x3a6b48++){var _0x21f668=events[_0x3a6b48];var _0x3f364a=createListener(_0xd05b('0x5')+_0x21f668,_0x55c552);FaxInteractionEvents['on'](_0x21f668,_0x3f364a);}}; \ No newline at end of file +var _0x84fa=['removeListener','register','length','./faxInteraction.events','remove','update','emit'];(function(_0x4301ed,_0xc7cda0){var _0x1152e0=function(_0x2c8b04){while(--_0x2c8b04){_0x4301ed['push'](_0x4301ed['shift']());}};_0x1152e0(++_0xc7cda0);}(_0x84fa,0x176));var _0xa84f=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0x84fa[_0xc6be3a];return _0x56a310;};'use strict';var FaxInteractionEvents=require(_0xa84f('0x0'));var events=['save',_0xa84f('0x1'),_0xa84f('0x2')];function createListener(_0x4dc3bf,_0xc5dbcd){return function(_0x48f493){_0xc5dbcd[_0xa84f('0x3')](_0x4dc3bf,_0x48f493);};}function removeListener(_0x58e620,_0x1f8d18){return function(){FaxInteractionEvents[_0xa84f('0x4')](_0x58e620,_0x1f8d18);};}exports[_0xa84f('0x5')]=function(_0x19af3c){for(var _0x35e218=0x0,_0x3d36aa=events[_0xa84f('0x6')];_0x35e218<_0x3d36aa;_0x35e218++){var _0x11ca1c=events[_0x35e218];var _0x65fae3=createListener('faxInteraction:'+_0x11ca1c,_0x19af3c);FaxInteractionEvents['on'](_0x11ca1c,_0x65fae3);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 4a44283..033fa5f 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 _0xb3ea=['/:id','/:id/messages','/:id/download','download','post','addMessage','/:id/tags','tracked','addTags','put','faxinteraction:update','delete','fax','faxinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','describe'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb3ea,0x10d));var _0xab3e=function(_0x2ee3e2,_0x3c4049){_0x2ee3e2=_0x2ee3e2-0x0;var _0x3ac875=_0xb3ea[_0x2ee3e2];return _0x3ac875;};'use strict';var multer=require(_0xab3e('0x0'));var util=require(_0xab3e('0x1'));var path=require(_0xab3e('0x2'));var timeout=require('connect-timeout');var express=require(_0xab3e('0x3'));var router=express['Router']();var fs_extra=require(_0xab3e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xab3e('0x5'));var config=require(_0xab3e('0x6'));var controller=require(_0xab3e('0x7'));router[_0xab3e('0x8')]('/',auth[_0xab3e('0x9')](),controller['index']);router[_0xab3e('0x8')]('/describe',auth[_0xab3e('0x9')](),controller[_0xab3e('0xa')]);router['get'](_0xab3e('0xb'),auth[_0xab3e('0x9')](),controller['show']);router[_0xab3e('0x8')](_0xab3e('0xc'),auth['isAuthenticated'](),controller['getMessages']);router[_0xab3e('0x8')](_0xab3e('0xd'),auth[_0xab3e('0x9')](),controller[_0xab3e('0xe')]);router[_0xab3e('0xf')]('/',auth[_0xab3e('0x9')](),controller['create']);router['post']('/:id/messages',auth[_0xab3e('0x9')](),controller[_0xab3e('0x10')]);router[_0xab3e('0xf')](_0xab3e('0x11'),auth['isAuthenticated'](),interaction[_0xab3e('0x12')]('fax','faxinteraction:addtags'),controller[_0xab3e('0x13')]);router[_0xab3e('0x14')]('/:id',auth[_0xab3e('0x9')](),interaction[_0xab3e('0x12')]('fax',_0xab3e('0x15')),controller['update']);router[_0xab3e('0x16')]('/:id',auth['isAuthenticated'](),interaction[_0xab3e('0x12')](_0xab3e('0x17'),_0xab3e('0x18')),controller[_0xab3e('0x19')]);router[_0xab3e('0x16')](_0xab3e('0x11'),auth['isAuthenticated'](),controller[_0xab3e('0x1a')]);module[_0xab3e('0x1b')]=router; \ No newline at end of file +var _0x3810=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','download','post','create','/:id/messages','addMessage','/:id/tags','fax','put','faxinteraction:update','update','delete','tracked','destroy','removeTags'];(function(_0x309385,_0x3ab38f){var _0x45b0f5=function(_0x4fa7e0){while(--_0x4fa7e0){_0x309385['push'](_0x309385['shift']());}};_0x45b0f5(++_0x3ab38f);}(_0x3810,0x12d));var _0x0381=function(_0x39609a,_0x28a563){_0x39609a=_0x39609a-0x0;var _0xecd92=_0x3810[_0x39609a];return _0xecd92;};'use strict';var multer=require(_0x0381('0x0'));var util=require(_0x0381('0x1'));var path=require(_0x0381('0x2'));var timeout=require(_0x0381('0x3'));var express=require('express');var router=express[_0x0381('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x0381('0x5'));var interaction=require(_0x0381('0x6'));var config=require(_0x0381('0x7'));var controller=require('./faxInteraction.controller');router[_0x0381('0x8')]('/',auth['isAuthenticated'](),controller[_0x0381('0x9')]);router[_0x0381('0x8')](_0x0381('0xa'),auth[_0x0381('0xb')](),controller[_0x0381('0xc')]);router['get'](_0x0381('0xd'),auth[_0x0381('0xb')](),controller[_0x0381('0xe')]);router['get']('/:id/messages',auth[_0x0381('0xb')](),controller['getMessages']);router['get']('/:id/download',auth[_0x0381('0xb')](),controller[_0x0381('0xf')]);router[_0x0381('0x10')]('/',auth[_0x0381('0xb')](),controller[_0x0381('0x11')]);router[_0x0381('0x10')](_0x0381('0x12'),auth[_0x0381('0xb')](),controller[_0x0381('0x13')]);router['post'](_0x0381('0x14'),auth[_0x0381('0xb')](),interaction['tracked'](_0x0381('0x15'),'faxinteraction:addtags'),controller['addTags']);router[_0x0381('0x16')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0x0381('0x15'),_0x0381('0x17')),controller[_0x0381('0x18')]);router[_0x0381('0x19')]('/:id',auth['isAuthenticated'](),interaction[_0x0381('0x1a')]('fax','faxinteraction:destroy'),controller[_0x0381('0x1b')]);router[_0x0381('0x19')]('/:id/tags',auth['isAuthenticated'](),controller[_0x0381('0x1c')]);module[_0x0381('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index c2025e4..41d2056 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 _0xd2ea=['DATE','sequelize','exports','TEXT','medium','BOOLEAN','out'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xd2ea,0x15f));var _0xad2e=function(_0xb0787e,_0xab707f){_0xb0787e=_0xb0787e-0x0;var _0x1cdcd6=_0xd2ea[_0xb0787e];return _0x1cdcd6;};'use strict';var Sequelize=require(_0xad2e('0x0'));module[_0xad2e('0x1')]={'body':{'type':Sequelize[_0xad2e('0x2')](_0xad2e('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xad2e('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0xad2e('0x5')),'defaultValue':_0xad2e('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xad2e('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0xad2e('0x6')]}}; \ No newline at end of file +var _0x9c44=['out','TEXT','medium','BOOLEAN','ENUM'];(function(_0x3696d7,_0x4fe23f){var _0xdc9dd1=function(_0x367089){while(--_0x367089){_0x3696d7['push'](_0x3696d7['shift']());}};_0xdc9dd1(++_0x4fe23f);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x49c4('0x0')](_0x49c4('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x49c4('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x49c4('0x3')]('in',_0x49c4('0x4')),'defaultValue':_0x49c4('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index 3037295..4f962d4 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 _0x7a33=['findOne','isNil','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','server','files','download','join','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','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','redis','localhost','socket.io-emitter','./faxMessage.socket','register','client','http','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','count','set','reject','update','destroy','name','send','map','FaxMessage','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','body','find','params','describe','fax-interactions','accept','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','agent','get','FaxInteraction','FaxInteractionId','UserId','read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','contact','create'];(function(_0x5d2ec1,_0x812619){var _0xbb8e5=function(_0x422c7a){while(--_0x422c7a){_0x5d2ec1['push'](_0x5d2ec1['shift']());}};_0xbb8e5(++_0x812619);}(_0x7a33,0x11e));var _0x37a3=function(_0x2615e1,_0x14ef24){_0x2615e1=_0x2615e1-0x0;var _0x15efb8=_0x7a33[_0x2615e1];return _0x15efb8;};'use strict';var emlformat=require(_0x37a3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x37a3('0x1'));var rp=require(_0x37a3('0x2'));var moment=require(_0x37a3('0x3'));var BPromise=require(_0x37a3('0x4'));var Mustache=require(_0x37a3('0x5'));var util=require(_0x37a3('0x6'));var path=require(_0x37a3('0x7'));var sox=require(_0x37a3('0x8'));var csv=require(_0x37a3('0x9'));var ejs=require(_0x37a3('0xa'));var fs=require('fs');var fs_extra=require(_0x37a3('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x37a3('0xc'));var deskjs=require(_0x37a3('0xd'));var toCsv=require(_0x37a3('0x9'));var querystring=require(_0x37a3('0xe'));var Papa=require(_0x37a3('0xf'));var Redis=require('ioredis');var authService=require(_0x37a3('0x10'));var qs=require(_0x37a3('0x11'));var as=require(_0x37a3('0x12'));var hardwareService=require(_0x37a3('0x13'));var logger=require(_0x37a3('0x14'))(_0x37a3('0x15'));var utils=require(_0x37a3('0x16'));var config=require(_0x37a3('0x17'));var licenseUtil=require(_0x37a3('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x37a3('0x19')],{'host':_0x37a3('0x1a'),'port':0x18eb});var socket=require(_0x37a3('0x1b'))(new Redis(config[_0x37a3('0x19')]));require(_0x37a3('0x1c'))[_0x37a3('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x37a3('0x1e')][_0x37a3('0x1f')]({'port':0x232c});var client9002=jayson[_0x37a3('0x1e')][_0x37a3('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x4e8d00,_0x41aeac,_0x28899e,_0x2be390){return new BPromise(function(_0x82671b,_0x10c37a){var _0x223198=_0x2be390||client;return _0x223198['request'](_0x4e8d00,_0x28899e)[_0x37a3('0x20')](function(_0xa7d7e3){logger[_0x37a3('0x21')](_0x37a3('0x22'),_0x41aeac,_0x37a3('0x23'));logger[_0x37a3('0x24')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x41aeac,'request\x20sent',JSON[_0x37a3('0x25')](_0xa7d7e3));if(_0xa7d7e3[_0x37a3('0x26')]){if(_0xa7d7e3[_0x37a3('0x26')][_0x37a3('0x27')]===0x1f4){logger['error'](_0x37a3('0x22'),_0x41aeac,_0xa7d7e3[_0x37a3('0x26')][_0x37a3('0x28')]);return _0x10c37a(_0xa7d7e3[_0x37a3('0x26')]['message']);}logger['error'](_0x37a3('0x22'),_0x41aeac,_0xa7d7e3[_0x37a3('0x26')][_0x37a3('0x28')]);return _0x82671b(_0xa7d7e3[_0x37a3('0x26')]['message']);}else{logger['info'](_0x37a3('0x22'),_0x41aeac,_0x37a3('0x23'));_0x82671b(_0xa7d7e3[_0x37a3('0x29')][_0x37a3('0x28')]);}})[_0x37a3('0x2a')](function(_0x550a9f){logger[_0x37a3('0x26')]('FaxMessage,\x20%s,\x20%s',_0x41aeac,_0x550a9f);_0x10c37a(_0x550a9f);});});}function respondWithStatusCode(_0x505130,_0x4f28c8){_0x4f28c8=_0x4f28c8||0xcc;return function(_0x9731d7){if(_0x9731d7){return _0x505130[_0x37a3('0x2b')](_0x4f28c8);}return _0x505130['status'](_0x4f28c8)[_0x37a3('0x2c')]();};}function respondWithResult(_0x887486,_0x1a9aa8){_0x1a9aa8=_0x1a9aa8||0xc8;return function(_0x2e342a){if(_0x2e342a){return _0x887486[_0x37a3('0x2d')](_0x1a9aa8)[_0x37a3('0x2e')](_0x2e342a);}};}function respondWithFilteredResult(_0x5bdc6b,_0x2c285d){return function(_0x387b53){if(_0x387b53){var _0x2781f1=typeof _0x2c285d[_0x37a3('0x2f')]===_0x37a3('0x30')&&typeof _0x2c285d['limit']===_0x37a3('0x30');var _0x35840f=_0x387b53[_0x37a3('0x31')];var _0xce6163=_0x2781f1?0x0:_0x2c285d[_0x37a3('0x2f')];var _0x35f58b=_0x2781f1?_0x387b53['count']:_0x2c285d[_0x37a3('0x2f')]+_0x2c285d['limit'];var _0x49242e;if(_0x35f58b>=_0x35840f){_0x35f58b=_0x35840f;_0x49242e=0xc8;}else{_0x49242e=0xce;}_0x5bdc6b[_0x37a3('0x2d')](_0x49242e);return _0x5bdc6b[_0x37a3('0x32')]('Content-Range',_0xce6163+'-'+_0x35f58b+'/'+_0x35840f)['json'](_0x387b53);}return null;};}function patchUpdates(_0x42fb7c){return function(_0x133731){try{jsonpatch['apply'](_0x133731,_0x42fb7c,!![]);}catch(_0x1dc21e){return BPromise[_0x37a3('0x33')](_0x1dc21e);}return _0x133731['save']();};}function saveUpdates(_0x48bca3,_0x44d252){return function(_0x34854d){if(_0x34854d){return _0x34854d[_0x37a3('0x34')](_0x48bca3)['then'](function(_0x8c3940){return _0x8c3940;});}return null;};}function removeEntity(_0x20c13a,_0x2b4a8d){return function(_0x270420){if(_0x270420){return _0x270420[_0x37a3('0x35')]()[_0x37a3('0x20')](function(){_0x20c13a['status'](0xcc)[_0x37a3('0x2c')]();});}};}function handleEntityNotFound(_0x17d093,_0x509ea6){return function(_0x965222){if(!_0x965222){_0x17d093[_0x37a3('0x2b')](0x194);}return _0x965222;};}function handleError(_0x5e0e7d,_0x3ac51d){_0x3ac51d=_0x3ac51d||0x1f4;return function(_0x5f20ae){logger['error'](_0x5f20ae['stack']);if(_0x5f20ae[_0x37a3('0x36')]){delete _0x5f20ae[_0x37a3('0x36')];}_0x5e0e7d[_0x37a3('0x2d')](_0x3ac51d)[_0x37a3('0x37')](_0x5f20ae);};}exports['index']=function(_0x33767b,_0x5969de){var _0x383b67={},_0x2f957c={},_0x550a00={'count':0x0,'rows':[]};var _0x16dcc3=_[_0x37a3('0x38')](db[_0x37a3('0x39')][_0x37a3('0x3a')],function(_0xb15213){return{'name':_0xb15213['fieldName'],'type':_0xb15213['type'][_0x37a3('0x3b')]};});_0x2f957c[_0x37a3('0x3c')]=_[_0x37a3('0x38')](_0x16dcc3,'name');_0x2f957c[_0x37a3('0x3d')]=_[_0x37a3('0x3e')](_0x33767b[_0x37a3('0x3d')]);_0x2f957c[_0x37a3('0x3f')]=_[_0x37a3('0x40')](_0x2f957c[_0x37a3('0x3c')],_0x2f957c[_0x37a3('0x3d')]);_0x383b67['attributes']=_[_0x37a3('0x40')](_0x2f957c[_0x37a3('0x3c')],qs[_0x37a3('0x41')](_0x33767b['query']['fields']));_0x383b67[_0x37a3('0x42')]=_0x383b67[_0x37a3('0x42')][_0x37a3('0x43')]?_0x383b67['attributes']:_0x2f957c['model'];if(!_0x33767b[_0x37a3('0x3d')]['hasOwnProperty']('nolimit')){_0x383b67[_0x37a3('0x44')]=qs['limit'](_0x33767b[_0x37a3('0x3d')]['limit']);_0x383b67['offset']=qs[_0x37a3('0x2f')](_0x33767b[_0x37a3('0x3d')][_0x37a3('0x2f')]);}_0x383b67[_0x37a3('0x45')]=qs[_0x37a3('0x46')](_0x33767b[_0x37a3('0x3d')][_0x37a3('0x46')]);_0x383b67[_0x37a3('0x47')]=qs[_0x37a3('0x3f')](_[_0x37a3('0x48')](_0x33767b[_0x37a3('0x3d')],_0x2f957c[_0x37a3('0x3f')]),_0x16dcc3);if(_0x33767b[_0x37a3('0x3d')][_0x37a3('0x49')]){_0x383b67[_0x37a3('0x47')]=_[_0x37a3('0x4a')](_0x383b67['where'],{'$or':_['map'](_0x16dcc3,function(_0x4ad2fc){if(_0x4ad2fc['type']!==_0x37a3('0x4b')){var _0x426c40={};_0x426c40[_0x4ad2fc[_0x37a3('0x36')]]={'$like':'%'+_0x33767b[_0x37a3('0x3d')]['filter']+'%'};return _0x426c40;}})});}_0x383b67=_['merge']({},_0x383b67,_0x33767b[_0x37a3('0x4c')]);var _0x282127={'where':_0x383b67['where']};return db[_0x37a3('0x39')][_0x37a3('0x31')](_0x282127)['then'](function(_0x355ade){_0x550a00['count']=_0x355ade;if(_0x33767b['query'][_0x37a3('0x4d')]){_0x383b67[_0x37a3('0x4e')]=[{'all':!![]}];}return db[_0x37a3('0x39')]['findAll'](_0x383b67);})[_0x37a3('0x20')](function(_0x30e0ee){_0x550a00[_0x37a3('0x4f')]=_0x30e0ee;return _0x550a00;})[_0x37a3('0x20')](respondWithFilteredResult(_0x5969de,_0x383b67))[_0x37a3('0x2a')](handleError(_0x5969de,null));};exports[_0x37a3('0x50')]=function(_0x3669d5,_0xd18e98){var _0x342d42={'raw':!![],'where':{'id':_0x3669d5['params']['id']}},_0x4baec1={};_0x4baec1[_0x37a3('0x3c')]=_[_0x37a3('0x3e')](db['FaxMessage']['rawAttributes']);_0x4baec1[_0x37a3('0x3d')]=_[_0x37a3('0x3e')](_0x3669d5[_0x37a3('0x3d')]);_0x4baec1[_0x37a3('0x3f')]=_['intersection'](_0x4baec1[_0x37a3('0x3c')],_0x4baec1[_0x37a3('0x3d')]);_0x342d42[_0x37a3('0x42')]=_[_0x37a3('0x40')](_0x4baec1[_0x37a3('0x3c')],qs[_0x37a3('0x41')](_0x3669d5[_0x37a3('0x3d')][_0x37a3('0x41')]));_0x342d42[_0x37a3('0x42')]=_0x342d42['attributes'][_0x37a3('0x43')]?_0x342d42[_0x37a3('0x42')]:_0x4baec1[_0x37a3('0x3c')];if(_0x3669d5['query'][_0x37a3('0x4d')]){_0x342d42[_0x37a3('0x4e')]=[{'all':!![]}];}_0x342d42=_[_0x37a3('0x4a')]({},_0x342d42,_0x3669d5[_0x37a3('0x4c')]);return db[_0x37a3('0x39')]['find'](_0x342d42)[_0x37a3('0x20')](handleEntityNotFound(_0xd18e98,null))['then'](respondWithResult(_0xd18e98,null))[_0x37a3('0x2a')](handleError(_0xd18e98,null));};exports[_0x37a3('0x34')]=function(_0x5f2f03,_0xa1f873){if(_0x5f2f03['body']['id']){delete _0x5f2f03[_0x37a3('0x51')]['id'];}return db[_0x37a3('0x39')][_0x37a3('0x52')]({'where':{'id':_0x5f2f03['params']['id']}})[_0x37a3('0x20')](handleEntityNotFound(_0xa1f873,null))[_0x37a3('0x20')](saveUpdates(_0x5f2f03[_0x37a3('0x51')],null))[_0x37a3('0x20')](respondWithResult(_0xa1f873,null))[_0x37a3('0x2a')](handleError(_0xa1f873,null));};exports[_0x37a3('0x35')]=function(_0x2fb836,_0x411fdc){return db[_0x37a3('0x39')]['find']({'where':{'id':_0x2fb836[_0x37a3('0x53')]['id']}})[_0x37a3('0x20')](handleEntityNotFound(_0x411fdc,null))[_0x37a3('0x20')](removeEntity(_0x411fdc,null))[_0x37a3('0x2a')](handleError(_0x411fdc,null));};exports[_0x37a3('0x54')]=function(_0xadaf0c,_0x5b977b){return db[_0x37a3('0x39')]['describe']()[_0x37a3('0x20')](respondWithResult(_0x5b977b,null))['catch'](handleError(_0x5b977b,null));};var interaction_log=require('../../config/logger')(_0x37a3('0x55'));exports[_0x37a3('0x56')]=function(_0x9acee8,_0x5316ae,_0x3cf446){var _0xe323f8={'agent':{},'channel':'fax'};if(_0x9acee8['body']['id']){delete _0x9acee8['body']['id'];}_0x9acee8['body'][_0x37a3('0x57')]=!![];_0x9acee8['body'][_0x37a3('0x58')]=moment()[_0x37a3('0x59')](_0x37a3('0x5a'));_0x9acee8[_0x37a3('0x51')]['UserId']=_0x9acee8[_0x37a3('0x51')]['UserId']||_0x9acee8['user']['id'];_0xe323f8[_0x37a3('0x5b')]['id']=_0x9acee8[_0x37a3('0x51')]['UserId'];return db[_0x37a3('0x39')][_0x37a3('0x52')]({'where':{'id':_0x9acee8['params']['id'],'UserId':null}})[_0x37a3('0x20')](handleEntityNotFound(_0x5316ae,null))[_0x37a3('0x20')](saveUpdates(_0x9acee8['body'],null))[_0x37a3('0x20')](function(_0x5bd006){if(_0x5bd006){_0xe323f8[_0x37a3('0x28')]=_0x5bd006[_0x37a3('0x5c')]({'plain':!![]});return db[_0x37a3('0x5d')]['find']({'where':{'id':_0x5bd006[_0x37a3('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x5316ae,null))[_0x37a3('0x20')](function(_0x20a5fd){if(_0x20a5fd){return _0x20a5fd['update']({'UserId':_0x9acee8[_0x37a3('0x51')][_0x37a3('0x5f')],'read1stAt':_['isNil'](_0x20a5fd[_0x37a3('0x60')])?moment()[_0x37a3('0x59')](_0x37a3('0x5a')):undefined});}return null;})[_0x37a3('0x20')](function(_0x29f361){if(_0x29f361){_0xe323f8[_0x37a3('0x61')]=_0x29f361[_0x37a3('0x5c')]({'plain':!![]});interaction_log[_0x37a3('0x21')](_0x37a3('0x62'),_0x9acee8[_0x37a3('0x63')]['id'],_0x9acee8[_0x37a3('0x63')][_0x37a3('0x36')],_0x9acee8[_0x37a3('0x63')][_0x37a3('0x64')],_0xe323f8[_0x37a3('0x61')]['id'],_0x9acee8['body']?JSON[_0x37a3('0x25')](_0x9acee8[_0x37a3('0x51')]):_0x37a3('0x65'));return respondWithRpcPromise(_0x37a3('0x66'),_0x37a3('0x67'),_0xe323f8);}return null;})[_0x37a3('0x20')](function(_0x2ff48c){var _0x21aade=_0x37a3('0x68')+_0x2ff48c[_0x37a3('0x28')][_0x37a3('0x69')];return db[_0x37a3('0x6a')][_0x37a3('0x3d')](_0x21aade,{'type':db[_0x37a3('0x6b')][_0x37a3('0x6c')][_0x37a3('0x6d')],'raw':!![]})['then'](function(_0x4dfa12){return _0x4dfa12;});})[_0x37a3('0x20')](function(_0x53a6d1){if(_0x53a6d1){_0xe323f8[_0x37a3('0x28')]['contact']=_0x53a6d1[0x0];if(!_0x9acee8[_0x37a3('0x51')][_0x37a3('0x5f')])return;return db['User'][_0x37a3('0x52')]({'where':{'id':_0x9acee8[_0x37a3('0x51')]['UserId'],'role':'agent'},'attributes':['id',_0x37a3('0x36'),_0x37a3('0x6e'),_0x37a3('0x6f'),_0x37a3('0x70')],'raw':!![]});}return null;})[_0x37a3('0x20')](function(_0x572954){if(!_0x572954)return null;_0xe323f8[_0x37a3('0x28')][_0x37a3('0x5b')]=_0x572954;return _0xe323f8;})[_0x37a3('0x20')](function(_0x3f0fd5){if(_0x3f0fd5){if(_0x9acee8[_0x37a3('0x51')][_0x37a3('0x71')]){_0xe323f8[_0x37a3('0x28')][_0x37a3('0x72')]=util['format'](_0x37a3('0x73'),_0x9acee8[_0x37a3('0x63')][_0x37a3('0x36')]);_0xe323f8['message']['channel']=_0xe323f8['channel'];_0xe323f8[_0x37a3('0x28')]['motionChannel']=_0xe323f8[_0x37a3('0x74')];_0xe323f8[_0x37a3('0x28')][_0x37a3('0x75')]=_0x37a3('0x56');return respondWithRpcPromise(_0x37a3('0x76'),_0x37a3('0x76'),{'event':_0x37a3('0x77'),'message':_0xe323f8['message']},client9002)[_0x37a3('0x20')](function(){return _0xe323f8;});}return _0xe323f8;}return null;})[_0x37a3('0x20')](respondWithResult(_0x5316ae,null))[_0x37a3('0x2a')](handleError(_0x5316ae,null));};var interaction_log=require(_0x37a3('0x14'))(_0x37a3('0x55'));exports['reject']=function(_0x17fd71,_0x379088,_0x40a041){var _0x33658b={'agent':{},'channel':_0x37a3('0x78')};if(_0x17fd71['body']['id']){delete _0x17fd71[_0x37a3('0x51')]['id'];}_0x17fd71[_0x37a3('0x51')]['UserId']=_0x17fd71['body']['UserId']||_0x17fd71['user']['id'];_0x33658b[_0x37a3('0x5b')]['id']=_0x17fd71['body'][_0x37a3('0x5f')];return db[_0x37a3('0x39')][_0x37a3('0x52')]({'where':{'id':_0x17fd71[_0x37a3('0x53')]['id'],'UserId':null}})[_0x37a3('0x20')](handleEntityNotFound(_0x379088,null))[_0x37a3('0x20')](function(_0x6a722e){if(_0x6a722e){_0x33658b[_0x37a3('0x28')]=_0x6a722e[_0x37a3('0x5c')]({'plain':!![]});return db[_0x37a3('0x5d')][_0x37a3('0x52')]({'where':{'id':_0x6a722e[_0x37a3('0x5e')]}});}return null;})[_0x37a3('0x20')](handleEntityNotFound(_0x379088,null))[_0x37a3('0x20')](function(_0x18e16c){if(_0x18e16c){_0x33658b['interaction']=_0x18e16c['get']({'plain':!![]});interaction_log['info'](_0x37a3('0x79'),_0x17fd71[_0x37a3('0x63')]['id'],_0x17fd71['user']['name'],_0x17fd71[_0x37a3('0x63')][_0x37a3('0x64')],_0x33658b[_0x37a3('0x61')]['id'],_0x17fd71[_0x37a3('0x51')]?JSON[_0x37a3('0x25')](_0x17fd71[_0x37a3('0x51')]):'null');return respondWithRpcPromise('RejectMessage',_0x37a3('0x7a'),_0x33658b);}return null;})[_0x37a3('0x20')](function(_0xd6f182){var _0x119ec8=_0x37a3('0x68')+_0xd6f182[_0x37a3('0x28')]['ContactId'];return db[_0x37a3('0x6a')][_0x37a3('0x3d')](_0x119ec8,{'type':db[_0x37a3('0x6b')][_0x37a3('0x6c')][_0x37a3('0x6d')],'raw':!![]})[_0x37a3('0x20')](function(_0x3e095b){return _0x3e095b;});})[_0x37a3('0x20')](function(_0x257fea){if(_0x257fea){_0x33658b['message'][_0x37a3('0x7b')]=_0x257fea[0x0];if(!_0x17fd71[_0x37a3('0x51')][_0x37a3('0x5f')])return;return db['User'][_0x37a3('0x52')]({'where':{'id':_0x17fd71[_0x37a3('0x51')][_0x37a3('0x5f')],'role':_0x37a3('0x5b')},'attributes':['id','name',_0x37a3('0x6e'),_0x37a3('0x6f'),_0x37a3('0x70')],'raw':!![]});}return null;})['then'](function(_0xfb5565){if(!_0xfb5565)return null;_0x33658b[_0x37a3('0x28')][_0x37a3('0x5b')]=_0xfb5565;return _0x33658b;})[_0x37a3('0x20')](function(_0x3b309b){if(_0x3b309b){_0x3b309b[_0x37a3('0x28')][_0x37a3('0x72')]=util[_0x37a3('0x59')](_0x37a3('0x73'),_0x17fd71[_0x37a3('0x63')][_0x37a3('0x36')]);_0x3b309b[_0x37a3('0x28')][_0x37a3('0x74')]=_0x33658b['channel'];_0x3b309b[_0x37a3('0x28')]['motionChannel']=_0x33658b[_0x37a3('0x74')];_0x3b309b[_0x37a3('0x28')][_0x37a3('0x75')]=_0x37a3('0x33');respondWithRpcPromise(_0x37a3('0x76'),_0x37a3('0x76'),{'event':'rejectmessage','message':_0x3b309b[_0x37a3('0x28')]},client9002);return _0x33658b;}return null;})[_0x37a3('0x20')](respondWithResult(_0x379088,null))['catch'](handleError(_0x379088,null));};exports['create']=function(_0x159967,_0x20f362){var _0x4dcda8;return db['FaxMessage'][_0x37a3('0x7c')](_0x159967[_0x37a3('0x51')],{})['then'](function(_0x5df7f9){_0x4dcda8=_0x5df7f9;return db['CmContact'][_0x37a3('0x7d')]({'where':{'id':_0x4dcda8['ContactId']}});})[_0x37a3('0x20')](function(_0x109f50){if(_[_0x37a3('0x7e')](_0x109f50)){return;}else{_0x4dcda8[_0x37a3('0x78')]=_0x109f50[_0x37a3('0x78')];return db[_0x37a3('0x7f')]['findOne']({'where':{'id':_0x4dcda8[_0x37a3('0x80')]}});}})[_0x37a3('0x20')](function(_0x3d807d){return respondWithRpcPromise(_0x37a3('0x81'),'SendFax',{'FaxAccountId':_[_0x37a3('0x7e')](_0x159967[_0x37a3('0x51')])?undefined:_0x159967[_0x37a3('0x51')][_0x37a3('0x82')],'path':_[_0x37a3('0x7e')](_0x3d807d)?undefined:util[_0x37a3('0x59')](_0x37a3('0x83'),_0x3d807d[_0x37a3('0x84')]),'fax':_['isNil'](_0x4dcda8['fax'])?undefined:_0x4dcda8[_0x37a3('0x78')],'AttachmentId':_0x4dcda8[_0x37a3('0x80')]},client9002);})[_0x37a3('0x20')](respondWithResult(_0x20f362,0xc9))[_0x37a3('0x2a')](handleError(_0x20f362,null));};exports['download']=function(_0x2ab674,_0x1bb2d6){var _0x14e7ad=path['join'](config['root'],_0x37a3('0x85'),_0x37a3('0x86'),'attachments');return db[_0x37a3('0x39')][_0x37a3('0x52')]({'where':{'id':_0x2ab674[_0x37a3('0x53')]['id']},'include':[{'model':db['Attachment'],'as':_0x37a3('0x7f')}]})[_0x37a3('0x20')](handleEntityNotFound(_0x1bb2d6,null))[_0x37a3('0x20')](function(_0x300ee7){if(_0x300ee7){return _0x1bb2d6[_0x37a3('0x87')](path[_0x37a3('0x88')](_0x14e7ad,_0x300ee7[_0x37a3('0x7f')][_0x37a3('0x84')]));}})[_0x37a3('0x2a')](handleError(_0x1bb2d6,null));}; \ No newline at end of file +var _0x42dd=['send','index','map','fieldName','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','type','filter','options','FaxMessage','includeAll','include','findAll','rows','params','rawAttributes','merge','find','update','body','destroy','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','FaxInteraction','FaxInteractionId','isNil','read1stAt','format','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','internal','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','User','fullname','email','rejectmessage','create','CmContact','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','join','server','files','attachments','Attachment','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','info','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','FaxMessage,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','reject','then','stack','name'];(function(_0x24f230,_0x4bd9e6){var _0x3503b9=function(_0x4ed9b1){while(--_0x4ed9b1){_0x24f230['push'](_0x24f230['shift']());}};_0x3503b9(++_0x4bd9e6);}(_0x42dd,0xef));var _0xd42d=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x42dd[_0x47a349];return _0x18ab75;};'use strict';var emlformat=require(_0xd42d('0x0'));var rimraf=require(_0xd42d('0x1'));var zipdir=require(_0xd42d('0x2'));var jsonpatch=require(_0xd42d('0x3'));var rp=require(_0xd42d('0x4'));var moment=require(_0xd42d('0x5'));var BPromise=require(_0xd42d('0x6'));var Mustache=require(_0xd42d('0x7'));var util=require(_0xd42d('0x8'));var path=require(_0xd42d('0x9'));var sox=require(_0xd42d('0xa'));var csv=require('to-csv');var ejs=require(_0xd42d('0xb'));var fs=require('fs');var fs_extra=require(_0xd42d('0xc'));var _=require(_0xd42d('0xd'));var squel=require(_0xd42d('0xe'));var crypto=require(_0xd42d('0xf'));var jsforce=require(_0xd42d('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xd42d('0x11'));var querystring=require(_0xd42d('0x12'));var Papa=require(_0xd42d('0x13'));var Redis=require(_0xd42d('0x14'));var authService=require(_0xd42d('0x15'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd42d('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xd42d('0x17'));var config=require(_0xd42d('0x18'));var licenseUtil=require(_0xd42d('0x19'));var db=require(_0xd42d('0x1a'))['db'];config['redis']=_['defaults'](config[_0xd42d('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0xd42d('0x1c'))(new Redis(config[_0xd42d('0x1b')]));require(_0xd42d('0x1d'))[_0xd42d('0x1e')](socket);var jayson=require(_0xd42d('0x1f'));var client=jayson[_0xd42d('0x20')][_0xd42d('0x21')]({'port':0x232c});var client9002=jayson[_0xd42d('0x20')][_0xd42d('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x393532,_0x1f1f0b,_0x50b301,_0x5ced7d){return new BPromise(function(_0x1a63a4,_0x3447d8){var _0x3f2b41=_0x5ced7d||client;return _0x3f2b41[_0xd42d('0x22')](_0x393532,_0x50b301)['then'](function(_0x496364){logger[_0xd42d('0x23')]('FaxMessage,\x20%s,\x20%s',_0x1f1f0b,'request\x20sent');logger[_0xd42d('0x24')](_0xd42d('0x25'),_0x1f1f0b,_0xd42d('0x26'),JSON[_0xd42d('0x27')](_0x496364));if(_0x496364[_0xd42d('0x28')]){if(_0x496364[_0xd42d('0x28')]['code']===0x1f4){logger[_0xd42d('0x28')](_0xd42d('0x29'),_0x1f1f0b,_0x496364[_0xd42d('0x28')][_0xd42d('0x2a')]);return _0x3447d8(_0x496364['error'][_0xd42d('0x2a')]);}logger[_0xd42d('0x28')](_0xd42d('0x29'),_0x1f1f0b,_0x496364['error'][_0xd42d('0x2a')]);return _0x1a63a4(_0x496364['error'][_0xd42d('0x2a')]);}else{logger[_0xd42d('0x23')](_0xd42d('0x29'),_0x1f1f0b,_0xd42d('0x26'));_0x1a63a4(_0x496364[_0xd42d('0x2b')][_0xd42d('0x2a')]);}})[_0xd42d('0x2c')](function(_0x2ba304){logger[_0xd42d('0x28')](_0xd42d('0x29'),_0x1f1f0b,_0x2ba304);_0x3447d8(_0x2ba304);});});}function respondWithStatusCode(_0x3b037e,_0x514a6b){_0x514a6b=_0x514a6b||0xcc;return function(_0x63e994){if(_0x63e994){return _0x3b037e[_0xd42d('0x2d')](_0x514a6b);}return _0x3b037e['status'](_0x514a6b)[_0xd42d('0x2e')]();};}function respondWithResult(_0x1c16e1,_0xc9ea9a){_0xc9ea9a=_0xc9ea9a||0xc8;return function(_0x2375aa){if(_0x2375aa){return _0x1c16e1[_0xd42d('0x2f')](_0xc9ea9a)[_0xd42d('0x30')](_0x2375aa);}};}function respondWithFilteredResult(_0x24ee27,_0x203f81){return function(_0x51a5e5){if(_0x51a5e5){var _0x27755e=typeof _0x203f81['offset']===_0xd42d('0x31')&&typeof _0x203f81[_0xd42d('0x32')]==='undefined';var _0x17216a=_0x51a5e5['count'];var _0x5f02d8=_0x27755e?0x0:_0x203f81[_0xd42d('0x33')];var _0x551de2=_0x27755e?_0x51a5e5[_0xd42d('0x34')]:_0x203f81[_0xd42d('0x33')]+_0x203f81[_0xd42d('0x32')];var _0xd74762;if(_0x551de2>=_0x17216a){_0x551de2=_0x17216a;_0xd74762=0xc8;}else{_0xd74762=0xce;}_0x24ee27[_0xd42d('0x2f')](_0xd74762);return _0x24ee27[_0xd42d('0x35')](_0xd42d('0x36'),_0x5f02d8+'-'+_0x551de2+'/'+_0x17216a)[_0xd42d('0x30')](_0x51a5e5);}return null;};}function patchUpdates(_0x1c918e){return function(_0x2dc647){try{jsonpatch['apply'](_0x2dc647,_0x1c918e,!![]);}catch(_0x18e056){return BPromise[_0xd42d('0x37')](_0x18e056);}return _0x2dc647['save']();};}function saveUpdates(_0x3a780d,_0x5c4659){return function(_0x31695b){if(_0x31695b){return _0x31695b['update'](_0x3a780d)[_0xd42d('0x38')](function(_0x307ec1){return _0x307ec1;});}return null;};}function removeEntity(_0x50ae10,_0x386660){return function(_0x51c1bd){if(_0x51c1bd){return _0x51c1bd['destroy']()['then'](function(){_0x50ae10[_0xd42d('0x2f')](0xcc)[_0xd42d('0x2e')]();});}};}function handleEntityNotFound(_0x7e1ff3,_0x45fc68){return function(_0xbc049){if(!_0xbc049){_0x7e1ff3[_0xd42d('0x2d')](0x194);}return _0xbc049;};}function handleError(_0x16ba13,_0x45106f){_0x45106f=_0x45106f||0x1f4;return function(_0x3ba979){logger[_0xd42d('0x28')](_0x3ba979[_0xd42d('0x39')]);if(_0x3ba979[_0xd42d('0x3a')]){delete _0x3ba979[_0xd42d('0x3a')];}_0x16ba13[_0xd42d('0x2f')](_0x45106f)[_0xd42d('0x3b')](_0x3ba979);};}exports[_0xd42d('0x3c')]=function(_0x5cdba9,_0x5696be){var _0x191f21={},_0x5d8d86={},_0x1c9181={'count':0x0,'rows':[]};var _0x5b69dd=_[_0xd42d('0x3d')](db['FaxMessage']['rawAttributes'],function(_0x55db14){return{'name':_0x55db14[_0xd42d('0x3e')],'type':_0x55db14['type'][_0xd42d('0x3f')]};});_0x5d8d86[_0xd42d('0x40')]=_['map'](_0x5b69dd,'name');_0x5d8d86['query']=_[_0xd42d('0x41')](_0x5cdba9['query']);_0x5d8d86[_0xd42d('0x42')]=_[_0xd42d('0x43')](_0x5d8d86['model'],_0x5d8d86[_0xd42d('0x44')]);_0x191f21['attributes']=_[_0xd42d('0x43')](_0x5d8d86['model'],qs['fields'](_0x5cdba9[_0xd42d('0x44')][_0xd42d('0x45')]));_0x191f21[_0xd42d('0x46')]=_0x191f21[_0xd42d('0x46')][_0xd42d('0x47')]?_0x191f21['attributes']:_0x5d8d86[_0xd42d('0x40')];if(!_0x5cdba9[_0xd42d('0x44')][_0xd42d('0x48')](_0xd42d('0x49'))){_0x191f21[_0xd42d('0x32')]=qs[_0xd42d('0x32')](_0x5cdba9[_0xd42d('0x44')][_0xd42d('0x32')]);_0x191f21[_0xd42d('0x33')]=qs[_0xd42d('0x33')](_0x5cdba9[_0xd42d('0x44')]['offset']);}_0x191f21[_0xd42d('0x4a')]=qs[_0xd42d('0x4b')](_0x5cdba9[_0xd42d('0x44')]['sort']);_0x191f21[_0xd42d('0x4c')]=qs['filters'](_['pick'](_0x5cdba9[_0xd42d('0x44')],_0x5d8d86['filters']),_0x5b69dd);if(_0x5cdba9[_0xd42d('0x44')]['filter']){_0x191f21[_0xd42d('0x4c')]=_['merge'](_0x191f21[_0xd42d('0x4c')],{'$or':_[_0xd42d('0x3d')](_0x5b69dd,function(_0x185e32){if(_0x185e32[_0xd42d('0x4d')]!=='VIRTUAL'){var _0x173fe0={};_0x173fe0[_0x185e32['name']]={'$like':'%'+_0x5cdba9[_0xd42d('0x44')][_0xd42d('0x4e')]+'%'};return _0x173fe0;}})});}_0x191f21=_['merge']({},_0x191f21,_0x5cdba9[_0xd42d('0x4f')]);var _0x404055={'where':_0x191f21[_0xd42d('0x4c')]};return db[_0xd42d('0x50')][_0xd42d('0x34')](_0x404055)['then'](function(_0x538772){_0x1c9181[_0xd42d('0x34')]=_0x538772;if(_0x5cdba9[_0xd42d('0x44')][_0xd42d('0x51')]){_0x191f21[_0xd42d('0x52')]=[{'all':!![]}];}return db[_0xd42d('0x50')][_0xd42d('0x53')](_0x191f21);})[_0xd42d('0x38')](function(_0x5597fa){_0x1c9181[_0xd42d('0x54')]=_0x5597fa;return _0x1c9181;})['then'](respondWithFilteredResult(_0x5696be,_0x191f21))[_0xd42d('0x2c')](handleError(_0x5696be,null));};exports['show']=function(_0x4ca0c1,_0x2c0291){var _0x1c4afe={'raw':!![],'where':{'id':_0x4ca0c1[_0xd42d('0x55')]['id']}},_0x3241cd={};_0x3241cd[_0xd42d('0x40')]=_[_0xd42d('0x41')](db[_0xd42d('0x50')][_0xd42d('0x56')]);_0x3241cd[_0xd42d('0x44')]=_['keys'](_0x4ca0c1['query']);_0x3241cd[_0xd42d('0x42')]=_[_0xd42d('0x43')](_0x3241cd[_0xd42d('0x40')],_0x3241cd[_0xd42d('0x44')]);_0x1c4afe[_0xd42d('0x46')]=_[_0xd42d('0x43')](_0x3241cd[_0xd42d('0x40')],qs[_0xd42d('0x45')](_0x4ca0c1[_0xd42d('0x44')][_0xd42d('0x45')]));_0x1c4afe['attributes']=_0x1c4afe[_0xd42d('0x46')][_0xd42d('0x47')]?_0x1c4afe[_0xd42d('0x46')]:_0x3241cd[_0xd42d('0x40')];if(_0x4ca0c1[_0xd42d('0x44')][_0xd42d('0x51')]){_0x1c4afe[_0xd42d('0x52')]=[{'all':!![]}];}_0x1c4afe=_[_0xd42d('0x57')]({},_0x1c4afe,_0x4ca0c1[_0xd42d('0x4f')]);return db[_0xd42d('0x50')][_0xd42d('0x58')](_0x1c4afe)[_0xd42d('0x38')](handleEntityNotFound(_0x2c0291,null))[_0xd42d('0x38')](respondWithResult(_0x2c0291,null))[_0xd42d('0x2c')](handleError(_0x2c0291,null));};exports[_0xd42d('0x59')]=function(_0x5f272f,_0x35ebb9){if(_0x5f272f[_0xd42d('0x5a')]['id']){delete _0x5f272f['body']['id'];}return db[_0xd42d('0x50')]['find']({'where':{'id':_0x5f272f[_0xd42d('0x55')]['id']}})[_0xd42d('0x38')](handleEntityNotFound(_0x35ebb9,null))['then'](saveUpdates(_0x5f272f['body'],null))[_0xd42d('0x38')](respondWithResult(_0x35ebb9,null))[_0xd42d('0x2c')](handleError(_0x35ebb9,null));};exports[_0xd42d('0x5b')]=function(_0x2af9db,_0x527358){return db[_0xd42d('0x50')][_0xd42d('0x58')]({'where':{'id':_0x2af9db[_0xd42d('0x55')]['id']}})[_0xd42d('0x38')](handleEntityNotFound(_0x527358,null))[_0xd42d('0x38')](removeEntity(_0x527358,null))['catch'](handleError(_0x527358,null));};exports['describe']=function(_0x33dcae,_0x41d35d){return db['FaxMessage'][_0xd42d('0x5c')]()[_0xd42d('0x38')](respondWithResult(_0x41d35d,null))[_0xd42d('0x2c')](handleError(_0x41d35d,null));};var interaction_log=require(_0xd42d('0x5d'))(_0xd42d('0x5e'));exports[_0xd42d('0x5f')]=function(_0x2ac55f,_0x78b96c,_0x4b1a49){var _0x537212={'agent':{},'channel':_0xd42d('0x60')};if(_0x2ac55f[_0xd42d('0x5a')]['id']){delete _0x2ac55f['body']['id'];}_0x2ac55f[_0xd42d('0x5a')][_0xd42d('0x61')]=!![];_0x2ac55f[_0xd42d('0x5a')][_0xd42d('0x62')]=moment()['format'](_0xd42d('0x63'));_0x2ac55f[_0xd42d('0x5a')][_0xd42d('0x64')]=_0x2ac55f[_0xd42d('0x5a')][_0xd42d('0x64')]||_0x2ac55f['user']['id'];_0x537212[_0xd42d('0x65')]['id']=_0x2ac55f['body'][_0xd42d('0x64')];return db[_0xd42d('0x50')][_0xd42d('0x58')]({'where':{'id':_0x2ac55f[_0xd42d('0x55')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x78b96c,null))[_0xd42d('0x38')](saveUpdates(_0x2ac55f[_0xd42d('0x5a')],null))['then'](function(_0x2787c5){if(_0x2787c5){_0x537212[_0xd42d('0x2a')]=_0x2787c5['get']({'plain':!![]});return db[_0xd42d('0x66')][_0xd42d('0x58')]({'where':{'id':_0x2787c5[_0xd42d('0x67')]}});}return null;})[_0xd42d('0x38')](handleEntityNotFound(_0x78b96c,null))[_0xd42d('0x38')](function(_0x57d4ad){if(_0x57d4ad){return _0x57d4ad[_0xd42d('0x59')]({'UserId':_0x2ac55f[_0xd42d('0x5a')][_0xd42d('0x64')],'read1stAt':_[_0xd42d('0x68')](_0x57d4ad[_0xd42d('0x69')])?moment()[_0xd42d('0x6a')](_0xd42d('0x63')):undefined});}return null;})['then'](function(_0x3eb440){if(_0x3eb440){_0x537212['interaction']=_0x3eb440[_0xd42d('0x6b')]({'plain':!![]});interaction_log[_0xd42d('0x23')](_0xd42d('0x6c'),_0x2ac55f[_0xd42d('0x6d')]['id'],_0x2ac55f[_0xd42d('0x6d')]['name'],_0x2ac55f['user'][_0xd42d('0x6e')],_0x537212[_0xd42d('0x6f')]['id'],_0x2ac55f[_0xd42d('0x5a')]?JSON[_0xd42d('0x27')](_0x2ac55f[_0xd42d('0x5a')]):_0xd42d('0x70'));return respondWithRpcPromise(_0xd42d('0x71'),_0xd42d('0x72'),_0x537212);}return null;})['then'](function(_0x1c8f71){var _0x3f116d=_0xd42d('0x73')+_0x1c8f71['message'][_0xd42d('0x74')];return db[_0xd42d('0x75')][_0xd42d('0x44')](_0x3f116d,{'type':db[_0xd42d('0x76')][_0xd42d('0x77')][_0xd42d('0x78')],'raw':!![]})['then'](function(_0x428da5){return _0x428da5;});})['then'](function(_0x3d6878){if(_0x3d6878){_0x537212[_0xd42d('0x2a')]['contact']=_0x3d6878[0x0];if(!_0x2ac55f[_0xd42d('0x5a')][_0xd42d('0x64')])return;return db['User'][_0xd42d('0x58')]({'where':{'id':_0x2ac55f[_0xd42d('0x5a')][_0xd42d('0x64')],'role':_0xd42d('0x65')},'attributes':['id',_0xd42d('0x3a'),'fullname','email',_0xd42d('0x79')],'raw':!![]});}return null;})[_0xd42d('0x38')](function(_0x437177){if(!_0x437177)return null;_0x537212[_0xd42d('0x2a')][_0xd42d('0x65')]=_0x437177;return _0x537212;})[_0xd42d('0x38')](function(_0x1c6af8){if(_0x1c6af8){if(_0x2ac55f[_0xd42d('0x5a')]['manual']){_0x537212[_0xd42d('0x2a')][_0xd42d('0x7a')]=util[_0xd42d('0x6a')](_0xd42d('0x7b'),_0x2ac55f[_0xd42d('0x6d')][_0xd42d('0x3a')]);_0x537212[_0xd42d('0x2a')][_0xd42d('0x7c')]=_0x537212[_0xd42d('0x7c')];_0x537212[_0xd42d('0x2a')][_0xd42d('0x7d')]=_0x537212[_0xd42d('0x7c')];_0x537212['message'][_0xd42d('0x7e')]=_0xd42d('0x5f');return respondWithRpcPromise(_0xd42d('0x7f'),_0xd42d('0x7f'),{'event':_0xd42d('0x80'),'message':_0x537212['message']},client9002)[_0xd42d('0x38')](function(){return _0x537212;});}return _0x537212;}return null;})[_0xd42d('0x38')](respondWithResult(_0x78b96c,null))['catch'](handleError(_0x78b96c,null));};var interaction_log=require('../../config/logger')(_0xd42d('0x5e'));exports[_0xd42d('0x37')]=function(_0x29808d,_0x3c29f9,_0xadf2c5){var _0x113feb={'agent':{},'channel':_0xd42d('0x60')};if(_0x29808d[_0xd42d('0x5a')]['id']){delete _0x29808d['body']['id'];}_0x29808d[_0xd42d('0x5a')][_0xd42d('0x64')]=_0x29808d['body'][_0xd42d('0x64')]||_0x29808d[_0xd42d('0x6d')]['id'];_0x113feb['agent']['id']=_0x29808d[_0xd42d('0x5a')][_0xd42d('0x64')];return db['FaxMessage']['find']({'where':{'id':_0x29808d['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3c29f9,null))[_0xd42d('0x38')](function(_0x7ff432){if(_0x7ff432){_0x113feb[_0xd42d('0x2a')]=_0x7ff432[_0xd42d('0x6b')]({'plain':!![]});return db[_0xd42d('0x66')][_0xd42d('0x58')]({'where':{'id':_0x7ff432[_0xd42d('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x3c29f9,null))[_0xd42d('0x38')](function(_0x36feb0){if(_0x36feb0){_0x113feb[_0xd42d('0x6f')]=_0x36feb0['get']({'plain':!![]});interaction_log['info'](_0xd42d('0x81'),_0x29808d[_0xd42d('0x6d')]['id'],_0x29808d['user'][_0xd42d('0x3a')],_0x29808d[_0xd42d('0x6d')][_0xd42d('0x6e')],_0x113feb[_0xd42d('0x6f')]['id'],_0x29808d[_0xd42d('0x5a')]?JSON[_0xd42d('0x27')](_0x29808d[_0xd42d('0x5a')]):_0xd42d('0x70'));return respondWithRpcPromise(_0xd42d('0x82'),_0xd42d('0x83'),_0x113feb);}return null;})[_0xd42d('0x38')](function(_0x5d5f2a){var _0x10839d=_0xd42d('0x73')+_0x5d5f2a[_0xd42d('0x2a')][_0xd42d('0x74')];return db['sequelize'][_0xd42d('0x44')](_0x10839d,{'type':db[_0xd42d('0x76')]['QueryTypes'][_0xd42d('0x78')],'raw':!![]})[_0xd42d('0x38')](function(_0x3d347a){return _0x3d347a;});})[_0xd42d('0x38')](function(_0x3d1e2a){if(_0x3d1e2a){_0x113feb[_0xd42d('0x2a')]['contact']=_0x3d1e2a[0x0];if(!_0x29808d[_0xd42d('0x5a')][_0xd42d('0x64')])return;return db[_0xd42d('0x84')][_0xd42d('0x58')]({'where':{'id':_0x29808d[_0xd42d('0x5a')][_0xd42d('0x64')],'role':'agent'},'attributes':['id',_0xd42d('0x3a'),_0xd42d('0x85'),_0xd42d('0x86'),_0xd42d('0x79')],'raw':!![]});}return null;})['then'](function(_0x5de1ea){if(!_0x5de1ea)return null;_0x113feb[_0xd42d('0x2a')]['agent']=_0x5de1ea;return _0x113feb;})[_0xd42d('0x38')](function(_0x471f7c){if(_0x471f7c){_0x471f7c[_0xd42d('0x2a')]['interface']=util[_0xd42d('0x6a')](_0xd42d('0x7b'),_0x29808d[_0xd42d('0x6d')][_0xd42d('0x3a')]);_0x471f7c[_0xd42d('0x2a')][_0xd42d('0x7c')]=_0x113feb['channel'];_0x471f7c[_0xd42d('0x2a')][_0xd42d('0x7d')]=_0x113feb[_0xd42d('0x7c')];_0x471f7c['message'][_0xd42d('0x7e')]='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0xd42d('0x87'),'message':_0x471f7c[_0xd42d('0x2a')]},client9002);return _0x113feb;}return null;})['then'](respondWithResult(_0x3c29f9,null))[_0xd42d('0x2c')](handleError(_0x3c29f9,null));};exports[_0xd42d('0x88')]=function(_0x3303e3,_0x4d246f){var _0x11d113;return db[_0xd42d('0x50')]['create'](_0x3303e3[_0xd42d('0x5a')],{})[_0xd42d('0x38')](function(_0x5728fb){_0x11d113=_0x5728fb;return db[_0xd42d('0x89')]['findOne']({'where':{'id':_0x11d113[_0xd42d('0x74')]}});})['then'](function(_0x19ce7a){if(_['isNil'](_0x19ce7a)){return;}else{_0x11d113['fax']=_0x19ce7a['fax'];return db['Attachment'][_0xd42d('0x8a')]({'where':{'id':_0x11d113[_0xd42d('0x8b')]}});}})[_0xd42d('0x38')](function(_0x23b17a){return respondWithRpcPromise(_0xd42d('0x8c'),_0xd42d('0x8c'),{'FaxAccountId':_[_0xd42d('0x68')](_0x3303e3[_0xd42d('0x5a')])?undefined:_0x3303e3[_0xd42d('0x5a')][_0xd42d('0x8d')],'path':_[_0xd42d('0x68')](_0x23b17a)?undefined:util[_0xd42d('0x6a')](_0xd42d('0x8e'),_0x23b17a['basename']),'fax':_['isNil'](_0x11d113[_0xd42d('0x60')])?undefined:_0x11d113[_0xd42d('0x60')],'AttachmentId':_0x11d113[_0xd42d('0x8b')]},client9002);})[_0xd42d('0x38')](respondWithResult(_0x4d246f,0xc9))[_0xd42d('0x2c')](handleError(_0x4d246f,null));};exports[_0xd42d('0x8f')]=function(_0x2d3c07,_0x3042c3){var _0x2286bc=path[_0xd42d('0x90')](config['root'],_0xd42d('0x91'),_0xd42d('0x92'),_0xd42d('0x93'));return db[_0xd42d('0x50')]['find']({'where':{'id':_0x2d3c07[_0xd42d('0x55')]['id']},'include':[{'model':db['Attachment'],'as':_0xd42d('0x94')}]})[_0xd42d('0x38')](handleEntityNotFound(_0x3042c3,null))[_0xd42d('0x38')](function(_0x374104){if(_0x374104){return _0x3042c3[_0xd42d('0x8f')](path[_0xd42d('0x90')](_0x2286bc,_0x374104[_0xd42d('0x94')]['basename']));}})[_0xd42d('0x2c')](handleError(_0x3042c3,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 6ba9a91..bebde96 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 _0x855f=['remove','emit','hasOwnProperty','hook','exports','events','FaxMessage','setMaxListeners','save','update'];(function(_0x54de5d,_0x1f8b26){var _0x1b349e=function(_0xe199cc){while(--_0xe199cc){_0x54de5d['push'](_0x54de5d['shift']());}};_0x1b349e(++_0x1f8b26);}(_0x855f,0x145));var _0xf855=function(_0x2a5ebe,_0x386556){_0x2a5ebe=_0x2a5ebe-0x0;var _0x221517=_0x855f[_0x2a5ebe];return _0x221517;};'use strict';var EventEmitter=require(_0xf855('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0xf855('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xf855('0x2')](0x0);var events={'afterCreate':_0xf855('0x3'),'afterUpdate':_0xf855('0x4'),'afterDestroy':_0xf855('0x5')};function emitEvent(_0x5046aa){return function(_0x4620ba,_0x33ad4f,_0x4887c0){FaxMessageEvents['emit'](_0x5046aa+':'+_0x4620ba['id'],_0x4620ba);FaxMessageEvents[_0xf855('0x6')](_0x5046aa,_0x4620ba);_0x4887c0(null);};}for(var e in events){if(events[_0xf855('0x7')](e)){var event=events[e];FaxMessage[_0xf855('0x8')](e,emitEvent(event));}}module[_0xf855('0x9')]=FaxMessageEvents; \ No newline at end of file +var _0xdb7e=['hook','exports','events','../../mysqldb','FaxMessage','save','update','remove','emit','hasOwnProperty'];(function(_0x45b29d,_0x44ce43){var _0x32d74=function(_0x559eff){while(--_0x559eff){_0x45b29d['push'](_0x45b29d['shift']());}};_0x32d74(++_0x44ce43);}(_0xdb7e,0x11a));var _0xedb7=function(_0x2ec3e1,_0x367c86){_0x2ec3e1=_0x2ec3e1-0x0;var _0x368238=_0xdb7e[_0x2ec3e1];return _0x368238;};'use strict';var EventEmitter=require(_0xedb7('0x0'));var FaxMessage=require(_0xedb7('0x1'))['db'][_0xedb7('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xedb7('0x3'),'afterUpdate':_0xedb7('0x4'),'afterDestroy':_0xedb7('0x5')};function emitEvent(_0x58fc55){return function(_0x16179a,_0x4130d2,_0x40f048){FaxMessageEvents[_0xedb7('0x6')](_0x58fc55+':'+_0x16179a['id'],_0x16179a);FaxMessageEvents[_0xedb7('0x6')](_0x58fc55,_0x16179a);_0x40f048(null);};}for(var e in events){if(events[_0xedb7('0x7')](e)){var event=events[e];FaxMessage[_0xedb7('0x8')](e,emitEvent(event));}}module[_0xedb7('0x9')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 6614ab1..2a136a3 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 _0xb3c1=['FaxInteractionId','then','update','createdAt','catch','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','fti_fax_messages','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil'];(function(_0x2c6a71,_0x245a2b){var _0x2d8e58=function(_0x3a811a){while(--_0x3a811a){_0x2c6a71['push'](_0x2c6a71['shift']());}};_0x2d8e58(++_0x245a2b);}(_0xb3c1,0xa7));var _0x1b3c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3c1[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x1b3c('0x0'));var util=require(_0x1b3c('0x1'));var logger=require(_0x1b3c('0x2'))(_0x1b3c('0x3'));var moment=require('moment');var BPromise=require(_0x1b3c('0x4'));var rp=require(_0x1b3c('0x5'));var fs=require('fs');var path=require(_0x1b3c('0x6'));var rimraf=require(_0x1b3c('0x7'));var config=require('../../config/environment');var attributes=require(_0x1b3c('0x8'));module[_0x1b3c('0x9')]=function(_0x52c83d,_0x24859c){return _0x52c83d[_0x1b3c('0xa')](_0x1b3c('0xb'),attributes,{'tableName':_0x1b3c('0xc'),'paranoid':![],'indexes':[{'name':_0x1b3c('0xd'),'fields':['body'],'type':_0x1b3c('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ba39b,_0x5bf1c8,_0x48fc89){var _0x596547=_0x52c83d[_0x1b3c('0xf')];var _0x2f557a=_0x2ba39b[_0x1b3c('0x10')]({'plain':!![]});if(_0x2f557a[_0x1b3c('0x11')][_0x1b3c('0x12')]()==='in'||_0x2f557a[_0x1b3c('0x11')][_0x1b3c('0x12')]()===_0x1b3c('0x13')&&!_0x2f557a[_0x1b3c('0x14')]&&!_[_0x1b3c('0x15')](_0x2f557a['UserId'])){_0x596547['FaxInteraction']['findOne']({'where':{'id':_0x2f557a[_0x1b3c('0x16')]}})[_0x1b3c('0x17')](function(_0x4dc0ab){if(_0x4dc0ab){_0x4dc0ab[_0x1b3c('0x18')]({'lastMsgAt':_0x2f557a[_0x1b3c('0x19')],'lastMsgDirection':_0x2f557a[_0x1b3c('0x11')]['toLowerCase']()});}})[_0x1b3c('0x1a')](function(_0x4a5ae0){console['error'](_0x4a5ae0);});}_0x48fc89();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x7fe4=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','FaxMessage','body','FULLTEXT','models','toLowerCase','direction','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt'];(function(_0x228932,_0x23509a){var _0x56929b=function(_0x4199e1){while(--_0x4199e1){_0x228932['push'](_0x228932['shift']());}};_0x56929b(++_0x23509a);}(_0x7fe4,0x107));var _0x47fe=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x7fe4[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0x47fe('0x0'));var util=require(_0x47fe('0x1'));var logger=require('../../config/logger')(_0x47fe('0x2'));var moment=require(_0x47fe('0x3'));var BPromise=require(_0x47fe('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47fe('0x5'));var rimraf=require(_0x47fe('0x6'));var config=require(_0x47fe('0x7'));var attributes=require('./faxMessage.attributes');module[_0x47fe('0x8')]=function(_0x4d7473,_0x304cf4){return _0x4d7473[_0x47fe('0x9')](_0x47fe('0xa'),attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x47fe('0xb')],'type':_0x47fe('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x55d112,_0x4b08e1,_0x438764){var _0x4f675a=_0x4d7473[_0x47fe('0xd')];var _0x2fa00b=_0x55d112['get']({'plain':!![]});if(_0x2fa00b['direction'][_0x47fe('0xe')]()==='in'||_0x2fa00b[_0x47fe('0xf')]['toLowerCase']()==='out'&&!_0x2fa00b['secret']&&!_[_0x47fe('0x10')](_0x2fa00b[_0x47fe('0x11')])){_0x4f675a['FaxInteraction'][_0x47fe('0x12')]({'where':{'id':_0x2fa00b[_0x47fe('0x13')]}})[_0x47fe('0x14')](function(_0x3ed203){if(_0x3ed203){_0x3ed203[_0x47fe('0x15')]({'lastMsgAt':_0x2fa00b[_0x47fe('0x16')],'lastMsgDirection':_0x2fa00b[_0x47fe('0xf')][_0x47fe('0xe')]()});}})['catch'](function(_0xa57761){console[_0x47fe('0x17')](_0xa57761);});}_0x438764();}},'charset':_0x47fe('0x18'),'collate':_0x47fe('0x19')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index b8e3079..e415501 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 _0x4ea3=['message','result','catch','body','options','CreateFaxMessage','update','where','attributes','UpdateFaxMessage','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./faxMessage.socket','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x442214,_0x3a869f){var _0x2bddf9=function(_0x34b9c7){while(--_0x34b9c7){_0x442214['push'](_0x442214['shift']());}};_0x2bddf9(++_0x3a869f);}(_0x4ea3,0x70));var _0x34ea=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x4ea3[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x34ea('0x0'));var util=require(_0x34ea('0x1'));var moment=require(_0x34ea('0x2'));var BPromise=require(_0x34ea('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x34ea('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x34ea('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x34ea('0x6'));var jayson=require(_0x34ea('0x7'));var client=jayson[_0x34ea('0x8')][_0x34ea('0x9')]({'port':0x232a});config[_0x34ea('0xa')]=_[_0x34ea('0xb')](config[_0x34ea('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x34ea('0xc'))(new Redis(config[_0x34ea('0xa')]));require(_0x34ea('0xd'))['register'](socket);function respondWithRpcPromise(_0x301b98,_0xea1be2,_0x5126de){return new BPromise(function(_0x4a76b1,_0x5bd8b6){return client[_0x34ea('0xe')](_0x301b98,_0x5126de)[_0x34ea('0xf')](function(_0x58bb0d){logger[_0x34ea('0x10')](_0x34ea('0x11'),_0xea1be2,_0x34ea('0x12'));logger[_0x34ea('0x13')](_0x34ea('0x14'),_0xea1be2,_0x34ea('0x12'),JSON[_0x34ea('0x15')](_0x58bb0d));if(_0x58bb0d[_0x34ea('0x16')]){if(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x17')]===0x1f4){logger[_0x34ea('0x16')]('FaxMessage,\x20%s,\x20%s',_0xea1be2,_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);return _0x5bd8b6(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);}logger[_0x34ea('0x16')]('FaxMessage,\x20%s,\x20%s',_0xea1be2,_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);return _0x4a76b1(_0x58bb0d[_0x34ea('0x16')][_0x34ea('0x18')]);}else{logger['info'](_0x34ea('0x11'),_0xea1be2,_0x34ea('0x12'));_0x4a76b1(_0x58bb0d[_0x34ea('0x19')]['message']);}})[_0x34ea('0x1a')](function(_0x1353de){logger[_0x34ea('0x16')](_0x34ea('0x11'),_0xea1be2,_0x1353de);_0x5bd8b6(_0x1353de);});});}exports['CreateFaxMessage']=function(_0x2eea57){var _0x35328c=this;return new Promise(function(_0x287aaa,_0x247ee7){return db['FaxMessage']['create'](_0x2eea57[_0x34ea('0x1b')],{'raw':_0x2eea57[_0x34ea('0x1c')]?_0x2eea57[_0x34ea('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2eafc6){logger[_0x34ea('0x10')](_0x34ea('0x1d'),_0x2eea57);logger[_0x34ea('0x13')](_0x34ea('0x1d'),_0x2eea57,JSON[_0x34ea('0x15')](_0x2eafc6));_0x287aaa(_0x2eafc6);})['catch'](function(_0xf24962){logger[_0x34ea('0x16')](_0x34ea('0x1d'),_0xf24962[_0x34ea('0x18')],_0x2eea57);_0x247ee7(_0x35328c['error'](0x1f4,_0xf24962['message']));});});};exports['UpdateFaxMessage']=function(_0x142709){var _0x187306=this;return new Promise(function(_0x37c214,_0x4204d7){return db['FaxMessage'][_0x34ea('0x1e')](_0x142709[_0x34ea('0x1b')],{'raw':_0x142709[_0x34ea('0x1c')]?_0x142709['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x142709['options']?_0x142709['options'][_0x34ea('0x1f')]||null:null,'attributes':_0x142709[_0x34ea('0x1c')]?_0x142709[_0x34ea('0x1c')][_0x34ea('0x20')]||null:null,'limit':_0x142709['options']?_0x142709[_0x34ea('0x1c')]['limit']||null:null})[_0x34ea('0xf')](function(_0x4f2b77){logger[_0x34ea('0x10')](_0x34ea('0x21'),_0x142709);logger[_0x34ea('0x13')]('UpdateFaxMessage',_0x142709,JSON[_0x34ea('0x15')](_0x4f2b77));_0x37c214(_0x4f2b77);})[_0x34ea('0x1a')](function(_0x55c8ba){logger[_0x34ea('0x16')]('UpdateFaxMessage',_0x55c8ba[_0x34ea('0x18')],_0x142709);_0x4204d7(_0x187306[_0x34ea('0x16')](0x1f4,_0x55c8ba[_0x34ea('0x18')]));});});}; \ No newline at end of file +var _0xb821=['register','request','then','info','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateFaxMessage','create','body','options','raw','stringify','UpdateFaxMessage','FaxMessage','update','where','attributes','limit','util','moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket'];(function(_0x58a872,_0x50d43a){var _0x3e1577=function(_0x21c808){while(--_0x21c808){_0x58a872['push'](_0x58a872['shift']());}};_0x3e1577(++_0x50d43a);}(_0xb821,0xa7));var _0x1b82=function(_0xd199e9,_0x48405c){_0xd199e9=_0xd199e9-0x0;var _0x1f5271=_0xb821[_0xd199e9];return _0x1f5271;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var moment=require(_0x1b82('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1b82('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1b82('0x3'))(_0x1b82('0x4'));var config=require(_0x1b82('0x5'));var jayson=require(_0x1b82('0x6'));var client=jayson['client'][_0x1b82('0x7')]({'port':0x232a});config[_0x1b82('0x8')]=_[_0x1b82('0x9')](config[_0x1b82('0x8')],{'host':_0x1b82('0xa'),'port':0x18eb});var socket=require(_0x1b82('0xb'))(new Redis(config[_0x1b82('0x8')]));require(_0x1b82('0xc'))[_0x1b82('0xd')](socket);function respondWithRpcPromise(_0x4955b5,_0x4011f2,_0x30c6ee){return new BPromise(function(_0x44dfd4,_0x14c57a){return client[_0x1b82('0xe')](_0x4955b5,_0x30c6ee)[_0x1b82('0xf')](function(_0x739f99){logger[_0x1b82('0x10')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x1b82('0x11'));logger[_0x1b82('0x12')](_0x1b82('0x13'),_0x4011f2,_0x1b82('0x11'),JSON['stringify'](_0x739f99));if(_0x739f99[_0x1b82('0x14')]){if(_0x739f99['error']['code']===0x1f4){logger[_0x1b82('0x14')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x739f99[_0x1b82('0x14')][_0x1b82('0x15')]);return _0x14c57a(_0x739f99['error'][_0x1b82('0x15')]);}logger['error']('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x739f99[_0x1b82('0x14')]['message']);return _0x44dfd4(_0x739f99[_0x1b82('0x14')][_0x1b82('0x15')]);}else{logger[_0x1b82('0x10')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,'request\x20sent');_0x44dfd4(_0x739f99[_0x1b82('0x16')]['message']);}})[_0x1b82('0x17')](function(_0x1002a1){logger[_0x1b82('0x14')]('FaxMessage,\x20%s,\x20%s',_0x4011f2,_0x1002a1);_0x14c57a(_0x1002a1);});});}exports[_0x1b82('0x18')]=function(_0x2b6ee8){var _0x11af50=this;return new Promise(function(_0x46e5e2,_0x10d45c){return db['FaxMessage'][_0x1b82('0x19')](_0x2b6ee8[_0x1b82('0x1a')],{'raw':_0x2b6ee8[_0x1b82('0x1b')]?_0x2b6ee8[_0x1b82('0x1b')][_0x1b82('0x1c')]===undefined?!![]:![]:!![]})[_0x1b82('0xf')](function(_0x2d07f4){logger['info'](_0x1b82('0x18'),_0x2b6ee8);logger[_0x1b82('0x12')]('CreateFaxMessage',_0x2b6ee8,JSON[_0x1b82('0x1d')](_0x2d07f4));_0x46e5e2(_0x2d07f4);})[_0x1b82('0x17')](function(_0x1ad9d6){logger['error'](_0x1b82('0x18'),_0x1ad9d6['message'],_0x2b6ee8);_0x10d45c(_0x11af50['error'](0x1f4,_0x1ad9d6['message']));});});};exports[_0x1b82('0x1e')]=function(_0x149d0f){var _0xfd00d1=this;return new Promise(function(_0x257b79,_0x548a3b){return db[_0x1b82('0x1f')][_0x1b82('0x20')](_0x149d0f[_0x1b82('0x1a')],{'raw':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x21')]||null:null,'attributes':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f[_0x1b82('0x1b')][_0x1b82('0x22')]||null:null,'limit':_0x149d0f[_0x1b82('0x1b')]?_0x149d0f['options'][_0x1b82('0x23')]||null:null})[_0x1b82('0xf')](function(_0x155a34){logger[_0x1b82('0x10')](_0x1b82('0x1e'),_0x149d0f);logger[_0x1b82('0x12')](_0x1b82('0x1e'),_0x149d0f,JSON[_0x1b82('0x1d')](_0x155a34));_0x257b79(_0x155a34);})[_0x1b82('0x17')](function(_0x362657){logger['error'](_0x1b82('0x1e'),_0x362657[_0x1b82('0x15')],_0x149d0f);_0x548a3b(_0xfd00d1[_0x1b82('0x14')](0x1f4,_0x362657[_0x1b82('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 408714d..7da1572 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 _0x1601=['./faxMessage.events','save','remove','update','emit','register','faxMessage:'];(function(_0x28d23b,_0x145cbf){var _0x910bf0=function(_0x555de7){while(--_0x555de7){_0x28d23b['push'](_0x28d23b['shift']());}};_0x910bf0(++_0x145cbf);}(_0x1601,0xbd));var _0x1160=function(_0x348e46,_0x5187dc){_0x348e46=_0x348e46-0x0;var _0x58b74f=_0x1601[_0x348e46];return _0x58b74f;};'use strict';var FaxMessageEvents=require(_0x1160('0x0'));var events=[_0x1160('0x1'),_0x1160('0x2'),_0x1160('0x3')];function createListener(_0x5ea87b,_0x4d8cab){return function(_0x3de1c5){_0x4d8cab[_0x1160('0x4')](_0x5ea87b,_0x3de1c5);};}function removeListener(_0x3c161f,_0x4a092f){return function(){FaxMessageEvents['removeListener'](_0x3c161f,_0x4a092f);};}exports[_0x1160('0x5')]=function(_0x24e404){for(var _0xb2ef24=0x0,_0x1f7319=events['length'];_0xb2ef24<_0x1f7319;_0xb2ef24++){var _0x54db4a=events[_0xb2ef24];var _0x18ab66=createListener(_0x1160('0x6')+_0x54db4a,_0x24e404);FaxMessageEvents['on'](_0x54db4a,_0x18ab66);}}; \ No newline at end of file +var _0x6b67=['length','update','emit','register'];(function(_0x2a9197,_0x5225eb){var _0x588c8a=function(_0x4698ee){while(--_0x4698ee){_0x2a9197['push'](_0x2a9197['shift']());}};_0x588c8a(++_0x5225eb);}(_0x6b67,0xf9));var _0x76b6=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0x6b67[_0x1b2422];return _0x376573;};'use strict';var FaxMessageEvents=require('./faxMessage.events');var events=['save','remove',_0x76b6('0x0')];function createListener(_0x107e38,_0x45b265){return function(_0x302eba){_0x45b265[_0x76b6('0x1')](_0x107e38,_0x302eba);};}function removeListener(_0x74f590,_0x10025b){return function(){FaxMessageEvents['removeListener'](_0x74f590,_0x10025b);};}exports[_0x76b6('0x2')]=function(_0x3e690c){for(var _0x33a6f2=0x0,_0x168db1=events[_0x76b6('0x3')];_0x33a6f2<_0x168db1;_0x33a6f2++){var _0x2930d8=events[_0x33a6f2];var _0x3545e8=createListener('faxMessage:'+_0x2930d8,_0x3e690c);FaxMessageEvents['on'](_0x2930d8,_0x3545e8);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 5daf701..b5a7641 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 _0x4ded=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','index','/describe','isAuthenticated','describe','download','fax','create','put','/:id','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util'];(function(_0x165514,_0x1b2758){var _0x44a5e0=function(_0x2ad624){while(--_0x2ad624){_0x165514['push'](_0x165514['shift']());}};_0x44a5e0(++_0x1b2758);}(_0x4ded,0x116));var _0xd4de=function(_0x3e8f45,_0x17059f){_0x3e8f45=_0x3e8f45-0x0;var _0x362216=_0x4ded[_0x3e8f45];return _0x362216;};'use strict';var multer=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var path=require(_0xd4de('0x2'));var timeout=require(_0xd4de('0x3'));var express=require(_0xd4de('0x4'));var router=express[_0xd4de('0x5')]();var fs_extra=require(_0xd4de('0x6'));var auth=require(_0xd4de('0x7'));var interaction=require(_0xd4de('0x8'));var config=require(_0xd4de('0x9'));var controller=require(_0xd4de('0xa'));router[_0xd4de('0xb')]('/',auth['isAuthenticated'](),controller[_0xd4de('0xc')]);router[_0xd4de('0xb')](_0xd4de('0xd'),auth[_0xd4de('0xe')](),controller[_0xd4de('0xf')]);router[_0xd4de('0xb')]('/:id',auth[_0xd4de('0xe')](),controller['show']);router['get']('/:id/download',auth[_0xd4de('0xe')](),controller[_0xd4de('0x10')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xd4de('0x11'),'faxmessage:create'),controller[_0xd4de('0x12')]);router[_0xd4de('0x13')](_0xd4de('0x14'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x15')]);router[_0xd4de('0x13')](_0xd4de('0x16'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x17')]);router[_0xd4de('0x13')](_0xd4de('0x18'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x19')]);router[_0xd4de('0x1a')](_0xd4de('0x14'),auth[_0xd4de('0xe')](),controller[_0xd4de('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x3f8c=['/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','get','isAuthenticated','index','/describe','/:id','show','/:id/download','post','tracked','fax','create','put'];(function(_0x412818,_0xe8171a){var _0x2d40d1=function(_0xa3099a){while(--_0xa3099a){_0x412818['push'](_0x412818['shift']());}};_0x2d40d1(++_0xe8171a);}(_0x3f8c,0x104));var _0xc3f8=function(_0x30c3d1,_0x2ebf84){_0x30c3d1=_0x30c3d1-0x0;var _0x25384f=_0x3f8c[_0x30c3d1];return _0x25384f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc3f8('0x0'));var timeout=require(_0xc3f8('0x1'));var express=require(_0xc3f8('0x2'));var router=express[_0xc3f8('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xc3f8('0x4')]('/',auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x6')]);router[_0xc3f8('0x4')](_0xc3f8('0x7'),auth[_0xc3f8('0x5')](),controller['describe']);router[_0xc3f8('0x4')](_0xc3f8('0x8'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x9')]);router[_0xc3f8('0x4')](_0xc3f8('0xa'),auth[_0xc3f8('0x5')](),controller['download']);router[_0xc3f8('0xb')]('/',auth[_0xc3f8('0x5')](),interaction[_0xc3f8('0xc')](_0xc3f8('0xd'),'faxmessage:create'),controller[_0xc3f8('0xe')]);router[_0xc3f8('0xf')](_0xc3f8('0x8'),auth[_0xc3f8('0x5')](),controller['update']);router[_0xc3f8('0xf')](_0xc3f8('0x10'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x11')]);router[_0xc3f8('0xf')](_0xc3f8('0x12'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x13')]);router[_0xc3f8('0x14')](_0xc3f8('0x8'),auth[_0xc3f8('0x5')](),controller[_0xc3f8('0x15')]);module[_0xc3f8('0x16')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 6f8a658..015dbdb 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 _0x0a9a=['rrmemory','beepall','roundrobin','sequelize','INTEGER','ENUM'];(function(_0x660f86,_0x49283f){var _0x4e1ac8=function(_0x3620f9){while(--_0x3620f9){_0x660f86['push'](_0x660f86['shift']());}};_0x4e1ac8(++_0x49283f);}(_0x0a9a,0x1a7));var _0xa0a9=function(_0xcf5cf4,_0x4158d8){_0xcf5cf4=_0xcf5cf4-0x0;var _0xf79146=_0x0a9a[_0xcf5cf4];return _0xf79146;};'use strict';var Sequelize=require(_0xa0a9('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xa0a9('0x1')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xa0a9('0x2')](_0xa0a9('0x3'),_0xa0a9('0x4'),_0xa0a9('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xa0a9('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3e4d=['STRING','ENUM','rrmemory','beepall','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x2eb3e0,_0x5f1c2d){_0x2eb3e0=_0x2eb3e0-0x0;var _0xbd221a=_0x3e4d[_0x2eb3e0];return _0xbd221a;};'use strict';var Sequelize=require(_0xd3e4('0x0'));module['exports']={'name':{'type':Sequelize[_0xd3e4('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd3e4('0x2')](_0xd3e4('0x3'),_0xd3e4('0x4'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xd3e4('0x5')],'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 b7e8ad2..a4df2bf 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 _0x8921=['transaction','each','findOrCreate','forEach','userFaxQueue:save','ids','select','tq.TeamId','team_has_fax_queues','join','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','removeTeams','isEmpty','emit','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./faxQueue.socket','register','status','end','json','undefined','limit','count','offset','Content-Range','update','destroy','get','FaxQueues','UserProfileResource','then','error','name','send','map','FaxQueue','rawAttributes','fieldName','type','getOptions','include','findAll','rows','catch','show','params','model','query','filters','intersection','attributes','fields','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','describe','findOne','keys','hasOwnProperty','nolimit','order','sort','pick','where','FaxQueueId','filter','UserFaxQueue','User','findAndCountAll','UserId','agent','faxPause','%s/%s','SIP','createdAt','updatedAt','Team','length','getTeams','addTeams','Agents','online','interface','sequelize'];(function(_0x2713a1,_0x3cc8de){var _0x5bd7a5=function(_0x1db877){while(--_0x1db877){_0x2713a1['push'](_0x2713a1['shift']());}};_0x5bd7a5(++_0x3cc8de);}(_0x8921,0x9a));var _0x1892=function(_0xcec75b,_0x1436da){_0xcec75b=_0xcec75b-0x0;var _0x2d2554=_0x8921[_0xcec75b];return _0x2d2554;};'use strict';var BPromise=require(_0x1892('0x0'));var util=require('util');var _=require(_0x1892('0x1'));var squel=require(_0x1892('0x2'));var Redis=require(_0x1892('0x3'));var qs=require(_0x1892('0x4'));var logger=require(_0x1892('0x5'))(_0x1892('0x6'));var config=require(_0x1892('0x7'));var db=require(_0x1892('0x8'))['db'];config[_0x1892('0x9')]=_[_0x1892('0xa')](config[_0x1892('0x9')],{'host':_0x1892('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1892('0x9')]));require(_0x1892('0xc'))[_0x1892('0xd')](socket);function respondWithStatusCode(_0x18d62f,_0x1e8c17){_0x1e8c17=_0x1e8c17||0xcc;return function(_0xb50f8a){if(_0xb50f8a){return _0x18d62f['sendStatus'](_0x1e8c17);}return _0x18d62f[_0x1892('0xe')](_0x1e8c17)[_0x1892('0xf')]();};}function respondWithResult(_0x7435c2,_0x25683b){_0x25683b=_0x25683b||0xc8;return function(_0x1efeed){if(_0x1efeed){return _0x7435c2[_0x1892('0xe')](_0x25683b)[_0x1892('0x10')](_0x1efeed);}};}function respondWithFilteredResult(_0x531383,_0x3b2927){return function(_0x22baab){if(_0x22baab){var _0xe5ef78=typeof _0x3b2927['offset']===_0x1892('0x11')&&typeof _0x3b2927[_0x1892('0x12')]===_0x1892('0x11');var _0x53c709=_0x22baab[_0x1892('0x13')];var _0xeb57f7=_0xe5ef78?0x0:_0x3b2927[_0x1892('0x14')];var _0xf11b26=_0xe5ef78?_0x22baab['count']:_0x3b2927['offset']+_0x3b2927[_0x1892('0x12')];var _0x4b15ec;if(_0xf11b26>=_0x53c709){_0xf11b26=_0x53c709;_0x4b15ec=0xc8;}else{_0x4b15ec=0xce;}_0x531383[_0x1892('0xe')](_0x4b15ec);return _0x531383['set'](_0x1892('0x15'),_0xeb57f7+'-'+_0xf11b26+'/'+_0x53c709)[_0x1892('0x10')](_0x22baab);}return null;};}function saveUpdates(_0x237451){return function(_0x3dc9a4){if(_0x3dc9a4){return _0x3dc9a4[_0x1892('0x16')](_0x237451)['then'](function(_0x5d28fc){return _0x5d28fc;});}return null;};}function removeEntity(_0x349b58){return function(_0x49937d){if(_0x49937d){return _0x49937d[_0x1892('0x17')]()['then'](function(){var _0x11c2e6=_0x49937d[_0x1892('0x18')]({'plain':!![]});var _0x4c2e74=_0x1892('0x19');return db[_0x1892('0x1a')][_0x1892('0x17')]({'where':{'type':_0x4c2e74,'resourceId':_0x11c2e6['id']}})[_0x1892('0x1b')](function(){return _0x49937d;});})['then'](function(){_0x349b58['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f5759){return function(_0x1fd123){if(!_0x1fd123){_0x3f5759['sendStatus'](0x194);}return _0x1fd123;};}function handleError(_0xa9a3e0,_0x8fd69a){_0x8fd69a=_0x8fd69a||0x1f4;return function(_0x27a514){logger[_0x1892('0x1c')](_0x27a514['stack']);if(_0x27a514[_0x1892('0x1d')]){delete _0x27a514[_0x1892('0x1d')];}_0xa9a3e0[_0x1892('0xe')](_0x8fd69a)[_0x1892('0x1e')](_0x27a514);};}exports['index']=function(_0x8e9dd4,_0x17ed21){var _0x25cd30={};var _0x38aac3={'count':0x0,'rows':[]};var _0x296c45=_[_0x1892('0x1f')](db[_0x1892('0x20')][_0x1892('0x21')],function(_0x3b6628){return{'name':_0x3b6628[_0x1892('0x22')],'type':_0x3b6628[_0x1892('0x23')]['key']};});_0x25cd30=qs[_0x1892('0x24')](_0x296c45,_0x8e9dd4);var _0x280a18={'where':_0x25cd30['where']};return db[_0x1892('0x20')]['count'](_0x280a18)[_0x1892('0x1b')](function(_0x1ca4db){_0x38aac3[_0x1892('0x13')]=_0x1ca4db;_0x25cd30[_0x1892('0x25')]=qs[_0x1892('0x25')](_0x8e9dd4['query']);return db[_0x1892('0x20')][_0x1892('0x26')](_0x25cd30);})[_0x1892('0x1b')](function(_0x1e3e4c){_0x38aac3[_0x1892('0x27')]=_0x1e3e4c;return _0x38aac3;})[_0x1892('0x1b')](respondWithFilteredResult(_0x17ed21,_0x25cd30))[_0x1892('0x28')](handleError(_0x17ed21,null));};exports[_0x1892('0x29')]=function(_0x6dda79,_0x504ba1){var _0x5f2b7b={'raw':!![],'where':{'id':_0x6dda79[_0x1892('0x2a')]['id']}},_0x49d5d4={};_0x49d5d4[_0x1892('0x2b')]=_['keys'](db['FaxQueue'][_0x1892('0x21')]);_0x49d5d4[_0x1892('0x2c')]=_['keys'](_0x6dda79[_0x1892('0x2c')]);_0x49d5d4[_0x1892('0x2d')]=_[_0x1892('0x2e')](_0x49d5d4[_0x1892('0x2b')],_0x49d5d4['query']);_0x5f2b7b[_0x1892('0x2f')]=_[_0x1892('0x2e')](_0x49d5d4['model'],qs[_0x1892('0x30')](_0x6dda79['query']['fields']));_0x5f2b7b[_0x1892('0x2f')]=_0x5f2b7b[_0x1892('0x2f')]['length']?_0x5f2b7b[_0x1892('0x2f')]:_0x49d5d4[_0x1892('0x2b')];if(_0x6dda79[_0x1892('0x2c')][_0x1892('0x31')]){_0x5f2b7b[_0x1892('0x25')]=[{'all':!![]}];}_0x5f2b7b=_[_0x1892('0x32')]({},_0x5f2b7b,_0x6dda79[_0x1892('0x33')]);return db[_0x1892('0x20')][_0x1892('0x34')](_0x5f2b7b)[_0x1892('0x1b')](handleEntityNotFound(_0x504ba1,null))['then'](respondWithResult(_0x504ba1,null))[_0x1892('0x28')](handleError(_0x504ba1,null));};exports[_0x1892('0x35')]=function(_0x1ac7bd,_0x532134){return db[_0x1892('0x20')][_0x1892('0x35')](_0x1ac7bd[_0x1892('0x36')],{})[_0x1892('0x1b')](function(_0x4b6e29){var _0x1f0f47=_0x1ac7bd[_0x1892('0x37')][_0x1892('0x18')]({'plain':!![]});if(!_0x1f0f47)throw new Error(_0x1892('0x38'));if(_0x1f0f47[_0x1892('0x39')]===_0x1892('0x37')){var _0x2e9b01=_0x4b6e29[_0x1892('0x18')]({'plain':!![]});var _0x13e72c=_0x1892('0x19');return db[_0x1892('0x3a')]['find']({'where':{'name':_0x13e72c,'userProfileId':_0x1f0f47[_0x1892('0x3b')]},'raw':!![]})[_0x1892('0x1b')](function(_0x118bfb){if(_0x118bfb&&_0x118bfb[_0x1892('0x3c')]===0x0){return db[_0x1892('0x1a')][_0x1892('0x35')]({'name':_0x2e9b01[_0x1892('0x1d')],'resourceId':_0x2e9b01['id'],'type':_0x118bfb[_0x1892('0x1d')],'sectionId':_0x118bfb['id']},{})[_0x1892('0x1b')](function(){return _0x4b6e29;});}else{return _0x4b6e29;}})[_0x1892('0x28')](function(_0x2ded54){logger[_0x1892('0x1c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ded54);throw _0x2ded54;});}return _0x4b6e29;})['then'](respondWithResult(_0x532134,0xc9))['catch'](handleError(_0x532134,null));};exports['update']=function(_0x53a7cc,_0x17b833){if(_0x53a7cc['body']['id']){delete _0x53a7cc[_0x1892('0x36')]['id'];}return db['FaxQueue'][_0x1892('0x34')]({'where':{'id':_0x53a7cc[_0x1892('0x2a')]['id']}})[_0x1892('0x1b')](handleEntityNotFound(_0x17b833,null))[_0x1892('0x1b')](saveUpdates(_0x53a7cc[_0x1892('0x36')],null))[_0x1892('0x1b')](respondWithResult(_0x17b833,null))[_0x1892('0x28')](handleError(_0x17b833,null));};exports[_0x1892('0x17')]=function(_0x170ebc,_0x1f5cbd){return db[_0x1892('0x20')][_0x1892('0x34')]({'where':{'id':_0x170ebc[_0x1892('0x2a')]['id']}})['then'](handleEntityNotFound(_0x1f5cbd,null))[_0x1892('0x1b')](removeEntity(_0x1f5cbd,null))['catch'](handleError(_0x1f5cbd,null));};exports['describe']=function(_0x49571,_0x5886cf){return db[_0x1892('0x20')][_0x1892('0x3d')]()[_0x1892('0x1b')](respondWithResult(_0x5886cf,null))[_0x1892('0x28')](handleError(_0x5886cf,null));};exports['getMembers']=function(_0x5f431f,_0x11ab70){var _0x68b91e={'raw':!![],'where':{}},_0x55d78f={},_0xd56892;return db['FaxQueue'][_0x1892('0x3e')]({'where':{'id':_0x5f431f[_0x1892('0x2a')]['id']}})[_0x1892('0x1b')](handleEntityNotFound(_0x11ab70,null))[_0x1892('0x1b')](function(_0x3f9135){if(_0x3f9135){_0xd56892=_0x3f9135['get']({'plain':!![]});_0x55d78f[_0x1892('0x2b')]=_['keys'](db['UserFaxQueue'][_0x1892('0x21')]);_0x55d78f[_0x1892('0x2c')]=_[_0x1892('0x3f')](_0x5f431f[_0x1892('0x2c')]);_0x55d78f[_0x1892('0x2d')]=_[_0x1892('0x2e')](_0x55d78f[_0x1892('0x2b')],_0x55d78f['query']);_0x68b91e[_0x1892('0x2f')]=_[_0x1892('0x2e')](_0x55d78f[_0x1892('0x2b')],qs[_0x1892('0x30')](_0x5f431f[_0x1892('0x2c')][_0x1892('0x30')]));_0x68b91e['attributes']=_0x68b91e[_0x1892('0x2f')]['length']?_0x68b91e[_0x1892('0x2f')]:_0x55d78f[_0x1892('0x2b')];if(!_0x5f431f['query'][_0x1892('0x40')](_0x1892('0x41'))){_0x68b91e['limit']=qs[_0x1892('0x12')](_0x5f431f[_0x1892('0x2c')]['limit']);_0x68b91e[_0x1892('0x14')]=qs[_0x1892('0x14')](_0x5f431f[_0x1892('0x2c')][_0x1892('0x14')]);}_0x68b91e[_0x1892('0x42')]=qs[_0x1892('0x43')](_0x5f431f[_0x1892('0x2c')][_0x1892('0x43')]);_0x68b91e['where']=qs[_0x1892('0x2d')](_[_0x1892('0x44')](_0x5f431f[_0x1892('0x2c')],_0x55d78f['filters']));_0x68b91e[_0x1892('0x45')][_0x1892('0x46')]=_0x3f9135['id'];if(_0x5f431f['query'][_0x1892('0x47')]){_0x68b91e[_0x1892('0x45')]=_[_0x1892('0x32')](_0x68b91e['where'],{'$or':_[_0x1892('0x1f')](_0x68b91e[_0x1892('0x2f')],function(_0x5c4305){var _0x448304={};_0x448304[_0x5c4305]={'$like':'%'+_0x5f431f['query'][_0x1892('0x47')]+'%'};return _0x448304;})});}_0x68b91e=_[_0x1892('0x32')]({},_0x68b91e,_0x5f431f['options']);return db[_0x1892('0x48')]['findAll'](_0x68b91e);}})[_0x1892('0x1b')](function(_0xc4139c){if(_0xc4139c){return db[_0x1892('0x49')][_0x1892('0x4a')]({'where':{'id':_['map'](_0xc4139c,_0x1892('0x4b')),'role':_0x1892('0x4c')},'attributes':['id',_0x1892('0x1d'),_0x1892('0x4d'),'updatedAt','createdAt']});}})['then'](function(_0x907913){if(_0x907913){return{'count':_0x907913[_0x1892('0x13')],'rows':_[_0x1892('0x1f')](_0x907913[_0x1892('0x27')],function(_0x2af629){return{'membername':_0x2af629[_0x1892('0x1d')],'UserId':_0x2af629['id'],'queue_name':_0xd56892[_0x1892('0x1d')],'FaxQueueId':_0xd56892['id'],'interface':util['format'](_0x1892('0x4e'),_0x1892('0x4f'),_0x2af629['name']),'penalty':0x0,'paused':_0x2af629[_0x1892('0x4d')],'createdAt':_0x2af629[_0x1892('0x50')],'updatedAt':_0x2af629[_0x1892('0x51')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x1892('0x1b')](respondWithFilteredResult(_0x11ab70,_0x68b91e))[_0x1892('0x28')](handleError(_0x11ab70,null));};exports['getTeams']=function(_0x155b54,_0x4d1e21){var _0x3ad2={};var _0x2e419c={};var _0x16aca4;var _0x56abd;return db['FaxQueue'][_0x1892('0x3e')]({'where':{'id':_0x155b54[_0x1892('0x2a')]['id']}})[_0x1892('0x1b')](handleEntityNotFound(_0x4d1e21,null))[_0x1892('0x1b')](function(_0x691aaf){if(_0x691aaf){_0x16aca4=_0x691aaf;_0x2e419c['model']=_['keys'](db[_0x1892('0x52')][_0x1892('0x21')]);_0x2e419c[_0x1892('0x2c')]=_[_0x1892('0x3f')](_0x155b54[_0x1892('0x2c')]);_0x2e419c[_0x1892('0x2d')]=_[_0x1892('0x2e')](_0x2e419c['model'],_0x2e419c[_0x1892('0x2c')]);_0x3ad2['attributes']=_['intersection'](_0x2e419c['model'],qs[_0x1892('0x30')](_0x155b54['query']['fields']));_0x3ad2[_0x1892('0x2f')]=_0x3ad2[_0x1892('0x2f')][_0x1892('0x53')]?_0x3ad2[_0x1892('0x2f')]:_0x2e419c[_0x1892('0x2b')];_0x3ad2['order']=qs['sort'](_0x155b54[_0x1892('0x2c')][_0x1892('0x43')]);_0x3ad2['where']=qs[_0x1892('0x2d')](_[_0x1892('0x44')](_0x155b54[_0x1892('0x2c')],_0x2e419c['filters']));if(_0x155b54[_0x1892('0x2c')][_0x1892('0x47')]){_0x3ad2[_0x1892('0x45')]=_[_0x1892('0x32')](_0x3ad2[_0x1892('0x45')],{'$or':_[_0x1892('0x1f')](_0x3ad2[_0x1892('0x2f')],function(_0x4bd538){var _0xa64578={};_0xa64578[_0x4bd538]={'$like':'%'+_0x155b54[_0x1892('0x2c')]['filter']+'%'};return _0xa64578;})});}_0x3ad2=_[_0x1892('0x32')]({},_0x3ad2,_0x155b54['options']);return _0x16aca4['getTeams'](_0x3ad2);}})['then'](function(_0x3be81b){if(_0x3be81b){_0x56abd=_0x3be81b[_0x1892('0x53')];if(!_0x155b54[_0x1892('0x2c')]['hasOwnProperty'](_0x1892('0x41'))){_0x3ad2['limit']=qs[_0x1892('0x12')](_0x155b54[_0x1892('0x2c')][_0x1892('0x12')]);_0x3ad2['offset']=qs['offset'](_0x155b54[_0x1892('0x2c')][_0x1892('0x14')]);}return _0x16aca4[_0x1892('0x54')](_0x3ad2);}})[_0x1892('0x1b')](function(_0x5c1693){if(_0x5c1693){return _0x5c1693?{'count':_0x56abd,'rows':_0x5c1693}:null;}})['then'](respondWithResult(_0x4d1e21,null))[_0x1892('0x28')](handleError(_0x4d1e21,null));};exports[_0x1892('0x55')]=function(_0x3e7b42,_0x4be458){var _0xf976d7=_0x3e7b42[_0x1892('0x36')]['ids'];return db[_0x1892('0x52')][_0x1892('0x26')]({'where':{'id':_0xf976d7},'attributes':['id'],'include':[{'model':db[_0x1892('0x49')],'as':_0x1892('0x56'),'attributes':['id',_0x1892('0x1d'),_0x1892('0x57'),'voicePause',_0x1892('0x58')],'raw':!![]}]})[_0x1892('0x1b')](function(_0x5f1b33){if(_0x5f1b33){var _0x554c2f=_['flatMap'](_0x5f1b33,function(_0x166fd8){var _0x44d0ce=_0x166fd8[_0x1892('0x18')]({'plain':!![]});return _0x44d0ce[_0x1892('0x56')];});return db[_0x1892('0x20')][_0x1892('0x34')]({'where':{'id':_0x3e7b42[_0x1892('0x2a')]['id']}})['then'](function(_0x5a9abe){return db[_0x1892('0x59')][_0x1892('0x5a')](function(_0x4234f2){return _0x5a9abe[_0x1892('0x55')](_0xf976d7,{'transaction':_0x4234f2})[_0x1892('0x1b')](function(){return BPromise[_0x1892('0x5b')](_0x554c2f,function(_0x41dd8d){return db['UserFaxQueue'][_0x1892('0x5c')]({'where':{'UserId':_0x41dd8d['id'],'FaxQueueId':_0x3e7b42['params']['id']},'transaction':_0x4234f2});});})[_0x1892('0x1b')](function(){_0x554c2f[_0x1892('0x5d')](function(_0x453f0d){socket['emit'](_0x1892('0x5e'),{'UserId':_0x453f0d['id'],'FaxQueueId':_0x5a9abe['id']});});});});});}})[_0x1892('0x1b')](respondWithStatusCode(_0x4be458,null))[_0x1892('0x28')](handleError(_0x4be458,null));};exports['removeTeams']=function(_0x572889,_0x4d3122){return db['Team']['findAll']({'where':{'id':_0x572889[_0x1892('0x2c')][_0x1892('0x5f')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x1892('0x56'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d3122,null))[_0x1892('0x1b')](function(_0x34c62e){var _0x452ab5=_['map'](_0x34c62e,'id');var _0x464a9a=[];var _0x2dfd9a=[];var _0x211c9c=squel[_0x1892('0x60')]();_0x211c9c['field'](_0x1892('0x61'))['from'](_0x1892('0x62'),'tq')[_0x1892('0x63')]('user_has_teams','ut',_0x1892('0x64'))[_0x1892('0x45')](_0x1892('0x65'),_0x572889[_0x1892('0x2a')]['id']);for(var _0x3059a9=0x0;_0x3059a9<_0x34c62e[_0x1892('0x53')];_0x3059a9+=0x1){let _0x3d7097=_0x34c62e[_0x3059a9];for(var _0x1bf24e=0x0;_0x1bf24e<_0x3d7097['Agents'][_0x1892('0x53')];_0x1bf24e+=0x1){let _0x405cd0=_0x3d7097[_0x1892('0x56')][_0x1bf24e];var _0x5812dc=_0x211c9c[_0x1892('0x66')]();_0x5812dc[_0x1892('0x45')](_0x1892('0x67'),_0x405cd0['id']);_0x2dfd9a[_0x1892('0x68')](db['sequelize'][_0x1892('0x2c')](_0x5812dc[_0x1892('0x69')](),{'type':db[_0x1892('0x59')][_0x1892('0x6a')][_0x1892('0x6b')]})[_0x1892('0x1b')](function(_0x233698){if(_0x233698[_0x1892('0x53')]===0x1){return _0x405cd0['id'];}else{var _0x45ab5d=_[_0x1892('0x6c')](_[_0x1892('0x1f')](_0x233698,_0x1892('0x6d')),function(_0x109e83){return _[_0x1892('0x6e')](_0x452ab5,_0x109e83);});if(_0x45ab5d){return _0x405cd0['id'];}}}));}}return BPromise[_0x1892('0x6f')](_0x2dfd9a)[_0x1892('0x1b')](function(_0x18dd0d){_0x464a9a=_(_0x464a9a)['union'](_0x18dd0d)['compact']()['value']();return db[_0x1892('0x20')][_0x1892('0x34')]({'where':{'id':_0x572889[_0x1892('0x2a')]['id']}})[_0x1892('0x1b')](function(_0x251c17){return db['sequelize'][_0x1892('0x5a')](function(_0x426e69){return _0x251c17[_0x1892('0x70')](_0x572889[_0x1892('0x2c')][_0x1892('0x5f')],{'transaction':_0x426e69})[_0x1892('0x1b')](function(){if(!_[_0x1892('0x71')](_0x464a9a)){return _0x251c17['removeAgents'](_0x464a9a,{'transaction':_0x426e69});}})[_0x1892('0x1b')](function(){_0x464a9a[_0x1892('0x5d')](function(_0x585018){socket[_0x1892('0x72')](_0x1892('0x73'),{'UserId':_0x585018,'FaxQueueId':_0x251c17['id']});});});});});});})['then'](respondWithStatusCode(_0x4d3122,null))[_0x1892('0x28')](handleError(_0x4d3122,null));};exports[_0x1892('0x74')]=function(_0x46eb60,_0x43e2fe){return db[_0x1892('0x20')][_0x1892('0x34')]({'where':{'id':_0x46eb60[_0x1892('0x2a')]['id']}})[_0x1892('0x1b')](handleEntityNotFound(_0x43e2fe,null))[_0x1892('0x1b')](function(_0x12d35d){if(_0x12d35d){return _0x12d35d[_0x1892('0x74')](_0x46eb60['body'][_0x1892('0x5f')],_[_0x1892('0x75')](_0x46eb60[_0x1892('0x36')],[_0x1892('0x5f'),'id'])||{})[_0x1892('0x76')](function(_0x15daa7){for(var _0x41f17f=0x0;_0x41f17f<_0x46eb60[_0x1892('0x36')][_0x1892('0x5f')][_0x1892('0x53')];_0x41f17f+=0x1){socket[_0x1892('0x72')](_0x1892('0x5e'),{'UserId':Number(_0x46eb60[_0x1892('0x36')][_0x1892('0x5f')][_0x41f17f]),'FaxQueueId':Number(_0x46eb60[_0x1892('0x2a')]['id'])});}return _0x15daa7;});}})[_0x1892('0x1b')](respondWithResult(_0x43e2fe,null))[_0x1892('0x28')](handleError(_0x43e2fe,null));};exports[_0x1892('0x77')]=function(_0x22a8ec,_0x1ca156){return db[_0x1892('0x20')][_0x1892('0x34')]({'where':{'id':_0x22a8ec[_0x1892('0x2a')]['id']}})[_0x1892('0x1b')](handleEntityNotFound(_0x1ca156,null))[_0x1892('0x1b')](function(_0x46221c){if(_0x46221c){return _0x46221c[_0x1892('0x77')](_0x22a8ec[_0x1892('0x2c')][_0x1892('0x5f')])[_0x1892('0x1b')](function(){if(_[_0x1892('0x78')](_0x22a8ec[_0x1892('0x2c')][_0x1892('0x5f')])){for(var _0x55f447=0x0;_0x55f447<_0x22a8ec['query']['ids'][_0x1892('0x53')];_0x55f447+=0x1){socket['emit'](_0x1892('0x73'),{'UserId':Number(_0x22a8ec[_0x1892('0x2c')][_0x1892('0x5f')][_0x55f447]),'FaxQueueId':Number(_0x22a8ec[_0x1892('0x2a')]['id'])});}}else{socket[_0x1892('0x72')](_0x1892('0x73'),{'UserId':Number(_0x22a8ec[_0x1892('0x2c')][_0x1892('0x5f')]),'FaxQueueId':Number(_0x22a8ec['params']['id'])});}});}})[_0x1892('0x1b')](respondWithStatusCode(_0x1ca156,null))[_0x1892('0x28')](handleError(_0x1ca156,null));};exports[_0x1892('0x79')]=function(_0x683898,_0x40feba){var _0x2868fe={};var _0xb1a1b4={};var _0x5485d6;var _0x105d88;return db['FaxQueue'][_0x1892('0x3e')]({'where':{'id':_0x683898['params']['id']}})[_0x1892('0x1b')](handleEntityNotFound(_0x40feba,null))[_0x1892('0x1b')](function(_0x4e68ff){if(_0x4e68ff){_0x5485d6=_0x4e68ff;_0xb1a1b4[_0x1892('0x2b')]=_[_0x1892('0x3f')](db[_0x1892('0x49')][_0x1892('0x21')]);_0xb1a1b4[_0x1892('0x2c')]=_[_0x1892('0x3f')](_0x683898['query']);_0xb1a1b4[_0x1892('0x2d')]=_[_0x1892('0x2e')](_0xb1a1b4['model'],_0xb1a1b4['query']);_0x2868fe['attributes']=_[_0x1892('0x2e')](_0xb1a1b4[_0x1892('0x2b')],qs[_0x1892('0x30')](_0x683898[_0x1892('0x2c')][_0x1892('0x30')]));_0x2868fe[_0x1892('0x2f')]=_0x2868fe[_0x1892('0x2f')][_0x1892('0x53')]?_0x2868fe[_0x1892('0x2f')]:_0xb1a1b4['model'];_0x2868fe[_0x1892('0x42')]=qs[_0x1892('0x43')](_0x683898['query'][_0x1892('0x43')]);_0x2868fe[_0x1892('0x45')]=qs[_0x1892('0x2d')](_['pick'](_0x683898[_0x1892('0x2c')],_0xb1a1b4[_0x1892('0x2d')]));if(_0x683898[_0x1892('0x2c')][_0x1892('0x47')]){_0x2868fe[_0x1892('0x45')]=_[_0x1892('0x32')](_0x2868fe[_0x1892('0x45')],{'$or':_[_0x1892('0x1f')](_0x2868fe['attributes'],function(_0x1c78e0){var _0x4d7f03={};_0x4d7f03[_0x1c78e0]={'$like':'%'+_0x683898[_0x1892('0x2c')][_0x1892('0x47')]+'%'};return _0x4d7f03;})});}_0x2868fe=_[_0x1892('0x32')]({},_0x2868fe,_0x683898[_0x1892('0x33')]);return _0x5485d6[_0x1892('0x79')](_0x2868fe);}})['then'](function(_0x301484){if(_0x301484){_0x105d88=_0x301484[_0x1892('0x53')];if(!_0x683898[_0x1892('0x2c')][_0x1892('0x40')](_0x1892('0x41'))){_0x2868fe[_0x1892('0x12')]=qs[_0x1892('0x12')](_0x683898[_0x1892('0x2c')][_0x1892('0x12')]);_0x2868fe[_0x1892('0x14')]=qs[_0x1892('0x14')](_0x683898[_0x1892('0x2c')][_0x1892('0x14')]);}return _0x5485d6[_0x1892('0x79')](_0x2868fe);}})[_0x1892('0x1b')](function(_0x60f292){if(_0x60f292){return _0x60f292?{'count':_0x105d88,'rows':_0x60f292}:null;}})[_0x1892('0x1b')](respondWithResult(_0x40feba,null))['catch'](handleError(_0x40feba,null));}; \ No newline at end of file +var _0x539d=['clone','push','toString','QueryTypes','SELECT','TeamId','includes','all','union','compact','removeTeams','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','bluebird','lodash','squel','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./faxQueue.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','then','destroy','get','UserProfileResource','end','error','stack','name','send','FaxQueue','fieldName','type','key','where','include','query','findAll','rows','catch','show','params','keys','rawAttributes','filters','intersection','model','attributes','merge','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','FaxQueues','find','autoAssociation','update','describe','getMembers','findOne','UserFaxQueue','fields','length','nolimit','order','sort','pick','FaxQueueId','filter','map','findAndCountAll','UserId','faxPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','hasOwnProperty','addTeams','Team','User','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','ids','select','join','user_has_teams','FaxQueueId\x20=\x20?'];(function(_0x1b9c3b,_0x43c1eb){var _0x56c260=function(_0x4d050c){while(--_0x4d050c){_0x1b9c3b['push'](_0x1b9c3b['shift']());}};_0x56c260(++_0x43c1eb);}(_0x539d,0x17b));var _0xd539=function(_0x5e9a69,_0x40c0ec){_0x5e9a69=_0x5e9a69-0x0;var _0x5979c8=_0x539d[_0x5e9a69];return _0x5979c8;};'use strict';var BPromise=require(_0xd539('0x0'));var util=require('util');var _=require(_0xd539('0x1'));var squel=require(_0xd539('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0xd539('0x3'))(_0xd539('0x4'));var config=require(_0xd539('0x5'));var db=require(_0xd539('0x6'))['db'];config[_0xd539('0x7')]=_['defaults'](config[_0xd539('0x7')],{'host':_0xd539('0x8'),'port':0x18eb});var socket=require(_0xd539('0x9'))(new Redis(config[_0xd539('0x7')]));require(_0xd539('0xa'))[_0xd539('0xb')](socket);function respondWithStatusCode(_0x555080,_0x372cb9){_0x372cb9=_0x372cb9||0xcc;return function(_0x2015a5){if(_0x2015a5){return _0x555080[_0xd539('0xc')](_0x372cb9);}return _0x555080[_0xd539('0xd')](_0x372cb9)['end']();};}function respondWithResult(_0x586ce8,_0x3f0805){_0x3f0805=_0x3f0805||0xc8;return function(_0x36027a){if(_0x36027a){return _0x586ce8[_0xd539('0xd')](_0x3f0805)[_0xd539('0xe')](_0x36027a);}};}function respondWithFilteredResult(_0x424b1a,_0x3c59d1){return function(_0x2367f1){if(_0x2367f1){var _0x3860dc=typeof _0x3c59d1['offset']===_0xd539('0xf')&&typeof _0x3c59d1[_0xd539('0x10')]===_0xd539('0xf');var _0x4b3461=_0x2367f1[_0xd539('0x11')];var _0xac445e=_0x3860dc?0x0:_0x3c59d1['offset'];var _0x278f49=_0x3860dc?_0x2367f1[_0xd539('0x11')]:_0x3c59d1[_0xd539('0x12')]+_0x3c59d1[_0xd539('0x10')];var _0x23bce1;if(_0x278f49>=_0x4b3461){_0x278f49=_0x4b3461;_0x23bce1=0xc8;}else{_0x23bce1=0xce;}_0x424b1a[_0xd539('0xd')](_0x23bce1);return _0x424b1a[_0xd539('0x13')](_0xd539('0x14'),_0xac445e+'-'+_0x278f49+'/'+_0x4b3461)[_0xd539('0xe')](_0x2367f1);}return null;};}function saveUpdates(_0x17f7bf){return function(_0x460f3c){if(_0x460f3c){return _0x460f3c['update'](_0x17f7bf)[_0xd539('0x15')](function(_0x41fb1e){return _0x41fb1e;});}return null;};}function removeEntity(_0x6d6bbe){return function(_0x99327a){if(_0x99327a){return _0x99327a[_0xd539('0x16')]()[_0xd539('0x15')](function(){var _0x3debbf=_0x99327a[_0xd539('0x17')]({'plain':!![]});var _0x4cde7e='FaxQueues';return db[_0xd539('0x18')][_0xd539('0x16')]({'where':{'type':_0x4cde7e,'resourceId':_0x3debbf['id']}})[_0xd539('0x15')](function(){return _0x99327a;});})[_0xd539('0x15')](function(){_0x6d6bbe['status'](0xcc)[_0xd539('0x19')]();});}};}function handleEntityNotFound(_0x14abea){return function(_0x46076e){if(!_0x46076e){_0x14abea[_0xd539('0xc')](0x194);}return _0x46076e;};}function handleError(_0x11c993,_0x13445e){_0x13445e=_0x13445e||0x1f4;return function(_0x38985c){logger[_0xd539('0x1a')](_0x38985c[_0xd539('0x1b')]);if(_0x38985c['name']){delete _0x38985c[_0xd539('0x1c')];}_0x11c993[_0xd539('0xd')](_0x13445e)[_0xd539('0x1d')](_0x38985c);};}exports['index']=function(_0x564cf2,_0x3e3398){var _0xfd3352={};var _0x1280c2={'count':0x0,'rows':[]};var _0xc1789e=_['map'](db[_0xd539('0x1e')]['rawAttributes'],function(_0x1343de){return{'name':_0x1343de[_0xd539('0x1f')],'type':_0x1343de[_0xd539('0x20')][_0xd539('0x21')]};});_0xfd3352=qs['getOptions'](_0xc1789e,_0x564cf2);var _0x4c836d={'where':_0xfd3352[_0xd539('0x22')]};return db[_0xd539('0x1e')]['count'](_0x4c836d)['then'](function(_0x575b63){_0x1280c2[_0xd539('0x11')]=_0x575b63;_0xfd3352[_0xd539('0x23')]=qs[_0xd539('0x23')](_0x564cf2[_0xd539('0x24')]);return db['FaxQueue'][_0xd539('0x25')](_0xfd3352);})[_0xd539('0x15')](function(_0x516806){_0x1280c2[_0xd539('0x26')]=_0x516806;return _0x1280c2;})[_0xd539('0x15')](respondWithFilteredResult(_0x3e3398,_0xfd3352))[_0xd539('0x27')](handleError(_0x3e3398,null));};exports[_0xd539('0x28')]=function(_0x2f0121,_0x4808e6){var _0x2510eb={'raw':!![],'where':{'id':_0x2f0121[_0xd539('0x29')]['id']}},_0x4e10c0={};_0x4e10c0['model']=_[_0xd539('0x2a')](db['FaxQueue'][_0xd539('0x2b')]);_0x4e10c0[_0xd539('0x24')]=_[_0xd539('0x2a')](_0x2f0121[_0xd539('0x24')]);_0x4e10c0[_0xd539('0x2c')]=_[_0xd539('0x2d')](_0x4e10c0[_0xd539('0x2e')],_0x4e10c0[_0xd539('0x24')]);_0x2510eb[_0xd539('0x2f')]=_[_0xd539('0x2d')](_0x4e10c0[_0xd539('0x2e')],qs['fields'](_0x2f0121[_0xd539('0x24')]['fields']));_0x2510eb[_0xd539('0x2f')]=_0x2510eb[_0xd539('0x2f')]['length']?_0x2510eb[_0xd539('0x2f')]:_0x4e10c0[_0xd539('0x2e')];if(_0x2f0121['query']['includeAll']){_0x2510eb[_0xd539('0x23')]=[{'all':!![]}];}_0x2510eb=_[_0xd539('0x30')]({},_0x2510eb,_0x2f0121[_0xd539('0x31')]);return db[_0xd539('0x1e')]['find'](_0x2510eb)[_0xd539('0x15')](handleEntityNotFound(_0x4808e6,null))[_0xd539('0x15')](respondWithResult(_0x4808e6,null))[_0xd539('0x27')](handleError(_0x4808e6,null));};exports[_0xd539('0x32')]=function(_0x5172e3,_0x443832){return db[_0xd539('0x1e')][_0xd539('0x32')](_0x5172e3[_0xd539('0x33')],{})[_0xd539('0x15')](function(_0x3deb9b){var _0x4b5059=_0x5172e3['user'][_0xd539('0x17')]({'plain':!![]});if(!_0x4b5059)throw new Error(_0xd539('0x34'));if(_0x4b5059[_0xd539('0x35')]===_0xd539('0x36')){var _0x56a96c=_0x3deb9b[_0xd539('0x17')]({'plain':!![]});var _0x1c5106=_0xd539('0x37');return db['UserProfileSection'][_0xd539('0x38')]({'where':{'name':_0x1c5106,'userProfileId':_0x4b5059['userProfileId']},'raw':!![]})[_0xd539('0x15')](function(_0x4b44cf){if(_0x4b44cf&&_0x4b44cf[_0xd539('0x39')]===0x0){return db['UserProfileResource']['create']({'name':_0x56a96c[_0xd539('0x1c')],'resourceId':_0x56a96c['id'],'type':_0x4b44cf[_0xd539('0x1c')],'sectionId':_0x4b44cf['id']},{})[_0xd539('0x15')](function(){return _0x3deb9b;});}else{return _0x3deb9b;}})[_0xd539('0x27')](function(_0x1917c4){logger[_0xd539('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1917c4);throw _0x1917c4;});}return _0x3deb9b;})[_0xd539('0x15')](respondWithResult(_0x443832,0xc9))[_0xd539('0x27')](handleError(_0x443832,null));};exports[_0xd539('0x3a')]=function(_0x5d1d2c,_0x3e9320){if(_0x5d1d2c['body']['id']){delete _0x5d1d2c['body']['id'];}return db[_0xd539('0x1e')][_0xd539('0x38')]({'where':{'id':_0x5d1d2c[_0xd539('0x29')]['id']}})[_0xd539('0x15')](handleEntityNotFound(_0x3e9320,null))['then'](saveUpdates(_0x5d1d2c[_0xd539('0x33')],null))[_0xd539('0x15')](respondWithResult(_0x3e9320,null))[_0xd539('0x27')](handleError(_0x3e9320,null));};exports[_0xd539('0x16')]=function(_0x4e577c,_0x158e21){return db[_0xd539('0x1e')]['find']({'where':{'id':_0x4e577c[_0xd539('0x29')]['id']}})[_0xd539('0x15')](handleEntityNotFound(_0x158e21,null))[_0xd539('0x15')](removeEntity(_0x158e21,null))[_0xd539('0x27')](handleError(_0x158e21,null));};exports['describe']=function(_0x3f26e7,_0x433b1f){return db[_0xd539('0x1e')][_0xd539('0x3b')]()[_0xd539('0x15')](respondWithResult(_0x433b1f,null))[_0xd539('0x27')](handleError(_0x433b1f,null));};exports[_0xd539('0x3c')]=function(_0x25fb47,_0x2dc6b0){var _0x203e42={'raw':!![],'where':{}},_0x54d65a={},_0x14027c;return db[_0xd539('0x1e')][_0xd539('0x3d')]({'where':{'id':_0x25fb47[_0xd539('0x29')]['id']}})['then'](handleEntityNotFound(_0x2dc6b0,null))[_0xd539('0x15')](function(_0x1baf59){if(_0x1baf59){_0x14027c=_0x1baf59[_0xd539('0x17')]({'plain':!![]});_0x54d65a[_0xd539('0x2e')]=_[_0xd539('0x2a')](db[_0xd539('0x3e')][_0xd539('0x2b')]);_0x54d65a['query']=_[_0xd539('0x2a')](_0x25fb47[_0xd539('0x24')]);_0x54d65a[_0xd539('0x2c')]=_[_0xd539('0x2d')](_0x54d65a[_0xd539('0x2e')],_0x54d65a[_0xd539('0x24')]);_0x203e42['attributes']=_[_0xd539('0x2d')](_0x54d65a[_0xd539('0x2e')],qs['fields'](_0x25fb47['query'][_0xd539('0x3f')]));_0x203e42[_0xd539('0x2f')]=_0x203e42['attributes'][_0xd539('0x40')]?_0x203e42[_0xd539('0x2f')]:_0x54d65a[_0xd539('0x2e')];if(!_0x25fb47[_0xd539('0x24')]['hasOwnProperty'](_0xd539('0x41'))){_0x203e42[_0xd539('0x10')]=qs[_0xd539('0x10')](_0x25fb47[_0xd539('0x24')]['limit']);_0x203e42[_0xd539('0x12')]=qs[_0xd539('0x12')](_0x25fb47[_0xd539('0x24')]['offset']);}_0x203e42[_0xd539('0x42')]=qs[_0xd539('0x43')](_0x25fb47[_0xd539('0x24')][_0xd539('0x43')]);_0x203e42[_0xd539('0x22')]=qs[_0xd539('0x2c')](_[_0xd539('0x44')](_0x25fb47[_0xd539('0x24')],_0x54d65a[_0xd539('0x2c')]));_0x203e42[_0xd539('0x22')][_0xd539('0x45')]=_0x1baf59['id'];if(_0x25fb47[_0xd539('0x24')][_0xd539('0x46')]){_0x203e42[_0xd539('0x22')]=_[_0xd539('0x30')](_0x203e42['where'],{'$or':_[_0xd539('0x47')](_0x203e42[_0xd539('0x2f')],function(_0x4a9178){var _0x4a653f={};_0x4a653f[_0x4a9178]={'$like':'%'+_0x25fb47['query'][_0xd539('0x46')]+'%'};return _0x4a653f;})});}_0x203e42=_[_0xd539('0x30')]({},_0x203e42,_0x25fb47[_0xd539('0x31')]);return db[_0xd539('0x3e')]['findAll'](_0x203e42);}})[_0xd539('0x15')](function(_0x392d4a){if(_0x392d4a){return db['User'][_0xd539('0x48')]({'where':{'id':_[_0xd539('0x47')](_0x392d4a,_0xd539('0x49')),'role':'agent'},'attributes':['id',_0xd539('0x1c'),_0xd539('0x4a'),_0xd539('0x4b'),'createdAt']});}})[_0xd539('0x15')](function(_0x3becf4){if(_0x3becf4){return{'count':_0x3becf4[_0xd539('0x11')],'rows':_['map'](_0x3becf4[_0xd539('0x26')],function(_0x1b4c8e){return{'membername':_0x1b4c8e[_0xd539('0x1c')],'UserId':_0x1b4c8e['id'],'queue_name':_0x14027c[_0xd539('0x1c')],'FaxQueueId':_0x14027c['id'],'interface':util[_0xd539('0x4c')](_0xd539('0x4d'),_0xd539('0x4e'),_0x1b4c8e[_0xd539('0x1c')]),'penalty':0x0,'paused':_0x1b4c8e[_0xd539('0x4a')],'createdAt':_0x1b4c8e[_0xd539('0x4f')],'updatedAt':_0x1b4c8e[_0xd539('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xd539('0x15')](respondWithFilteredResult(_0x2dc6b0,_0x203e42))['catch'](handleError(_0x2dc6b0,null));};exports[_0xd539('0x50')]=function(_0x1c1f46,_0x38e93b){var _0x535929={};var _0x2af7a3={};var _0x1831e7;var _0x4d006a;return db[_0xd539('0x1e')][_0xd539('0x3d')]({'where':{'id':_0x1c1f46[_0xd539('0x29')]['id']}})[_0xd539('0x15')](handleEntityNotFound(_0x38e93b,null))[_0xd539('0x15')](function(_0x1b46be){if(_0x1b46be){_0x1831e7=_0x1b46be;_0x2af7a3[_0xd539('0x2e')]=_[_0xd539('0x2a')](db['Team']['rawAttributes']);_0x2af7a3[_0xd539('0x24')]=_[_0xd539('0x2a')](_0x1c1f46[_0xd539('0x24')]);_0x2af7a3[_0xd539('0x2c')]=_[_0xd539('0x2d')](_0x2af7a3[_0xd539('0x2e')],_0x2af7a3[_0xd539('0x24')]);_0x535929['attributes']=_[_0xd539('0x2d')](_0x2af7a3[_0xd539('0x2e')],qs[_0xd539('0x3f')](_0x1c1f46[_0xd539('0x24')][_0xd539('0x3f')]));_0x535929['attributes']=_0x535929[_0xd539('0x2f')]['length']?_0x535929['attributes']:_0x2af7a3['model'];_0x535929[_0xd539('0x42')]=qs[_0xd539('0x43')](_0x1c1f46[_0xd539('0x24')][_0xd539('0x43')]);_0x535929[_0xd539('0x22')]=qs[_0xd539('0x2c')](_['pick'](_0x1c1f46['query'],_0x2af7a3[_0xd539('0x2c')]));if(_0x1c1f46['query']['filter']){_0x535929['where']=_[_0xd539('0x30')](_0x535929['where'],{'$or':_['map'](_0x535929[_0xd539('0x2f')],function(_0x1d79ce){var _0x20a721={};_0x20a721[_0x1d79ce]={'$like':'%'+_0x1c1f46['query'][_0xd539('0x46')]+'%'};return _0x20a721;})});}_0x535929=_[_0xd539('0x30')]({},_0x535929,_0x1c1f46[_0xd539('0x31')]);return _0x1831e7[_0xd539('0x50')](_0x535929);}})[_0xd539('0x15')](function(_0x5b82b7){if(_0x5b82b7){_0x4d006a=_0x5b82b7[_0xd539('0x40')];if(!_0x1c1f46[_0xd539('0x24')][_0xd539('0x51')](_0xd539('0x41'))){_0x535929[_0xd539('0x10')]=qs[_0xd539('0x10')](_0x1c1f46[_0xd539('0x24')][_0xd539('0x10')]);_0x535929[_0xd539('0x12')]=qs[_0xd539('0x12')](_0x1c1f46[_0xd539('0x24')][_0xd539('0x12')]);}return _0x1831e7[_0xd539('0x50')](_0x535929);}})[_0xd539('0x15')](function(_0x53584c){if(_0x53584c){return _0x53584c?{'count':_0x4d006a,'rows':_0x53584c}:null;}})[_0xd539('0x15')](respondWithResult(_0x38e93b,null))[_0xd539('0x27')](handleError(_0x38e93b,null));};exports[_0xd539('0x52')]=function(_0x32fcb9,_0x26c6b9){var _0x56f549=_0x32fcb9[_0xd539('0x33')]['ids'];return db[_0xd539('0x53')][_0xd539('0x25')]({'where':{'id':_0x56f549},'attributes':['id'],'include':[{'model':db[_0xd539('0x54')],'as':_0xd539('0x55'),'attributes':['id',_0xd539('0x1c'),_0xd539('0x56'),'voicePause',_0xd539('0x57')],'raw':!![]}]})[_0xd539('0x15')](function(_0x5a0c9a){if(_0x5a0c9a){var _0x4cfcfb=_[_0xd539('0x58')](_0x5a0c9a,function(_0x2e4b86){var _0x384439=_0x2e4b86[_0xd539('0x17')]({'plain':!![]});return _0x384439[_0xd539('0x55')];});return db['FaxQueue'][_0xd539('0x38')]({'where':{'id':_0x32fcb9['params']['id']}})[_0xd539('0x15')](function(_0x17865f){return db[_0xd539('0x59')][_0xd539('0x5a')](function(_0x3597b3){return _0x17865f['addTeams'](_0x56f549,{'transaction':_0x3597b3})[_0xd539('0x15')](function(){return BPromise[_0xd539('0x5b')](_0x4cfcfb,function(_0x14032b){return db[_0xd539('0x3e')][_0xd539('0x5c')]({'where':{'UserId':_0x14032b['id'],'FaxQueueId':_0x32fcb9[_0xd539('0x29')]['id']},'transaction':_0x3597b3});});})['then'](function(){_0x4cfcfb[_0xd539('0x5d')](function(_0x36b311){socket[_0xd539('0x5e')](_0xd539('0x5f'),{'UserId':_0x36b311['id'],'FaxQueueId':_0x17865f['id']});});});});});}})[_0xd539('0x15')](respondWithStatusCode(_0x26c6b9,null))[_0xd539('0x27')](handleError(_0x26c6b9,null));};exports['removeTeams']=function(_0x24dbe0,_0xeb8d7a){return db[_0xd539('0x53')]['findAll']({'where':{'id':_0x24dbe0['query'][_0xd539('0x60')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd539('0x55'),'attributes':['id'],'raw':!![]}]})[_0xd539('0x15')](handleEntityNotFound(_0xeb8d7a,null))['then'](function(_0x2c97d3){var _0x342a99=_[_0xd539('0x47')](_0x2c97d3,'id');var _0x32b06d=[];var _0x42e6bb=[];var _0xbaa486=squel[_0xd539('0x61')]();_0xbaa486['field']('tq.TeamId')['from']('team_has_fax_queues','tq')[_0xd539('0x62')](_0xd539('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd539('0x64'),_0x24dbe0[_0xd539('0x29')]['id']);for(var _0x5966aa=0x0;_0x5966aa<_0x2c97d3[_0xd539('0x40')];_0x5966aa+=0x1){let _0x1dc82d=_0x2c97d3[_0x5966aa];for(var _0x16f229=0x0;_0x16f229<_0x1dc82d['Agents']['length'];_0x16f229+=0x1){let _0x31004c=_0x1dc82d[_0xd539('0x55')][_0x16f229];var _0x460325=_0xbaa486[_0xd539('0x65')]();_0x460325[_0xd539('0x22')]('ut.UserId\x20=\x20?',_0x31004c['id']);_0x42e6bb[_0xd539('0x66')](db[_0xd539('0x59')]['query'](_0x460325[_0xd539('0x67')](),{'type':db[_0xd539('0x59')][_0xd539('0x68')][_0xd539('0x69')]})[_0xd539('0x15')](function(_0x194ae9){if(_0x194ae9[_0xd539('0x40')]===0x1){return _0x31004c['id'];}else{var _0x411213=_['every'](_[_0xd539('0x47')](_0x194ae9,_0xd539('0x6a')),function(_0x1c8881){return _[_0xd539('0x6b')](_0x342a99,_0x1c8881);});if(_0x411213){return _0x31004c['id'];}}}));}}return BPromise[_0xd539('0x6c')](_0x42e6bb)[_0xd539('0x15')](function(_0x45a1b6){_0x32b06d=_(_0x32b06d)[_0xd539('0x6d')](_0x45a1b6)[_0xd539('0x6e')]()['value']();return db['FaxQueue'][_0xd539('0x38')]({'where':{'id':_0x24dbe0[_0xd539('0x29')]['id']}})[_0xd539('0x15')](function(_0x328a4c){return db[_0xd539('0x59')][_0xd539('0x5a')](function(_0x451bd3){return _0x328a4c[_0xd539('0x6f')](_0x24dbe0[_0xd539('0x24')][_0xd539('0x60')],{'transaction':_0x451bd3})[_0xd539('0x15')](function(){if(!_[_0xd539('0x70')](_0x32b06d)){return _0x328a4c['removeAgents'](_0x32b06d,{'transaction':_0x451bd3});}})['then'](function(){_0x32b06d[_0xd539('0x5d')](function(_0x62baac){socket[_0xd539('0x5e')](_0xd539('0x71'),{'UserId':_0x62baac,'FaxQueueId':_0x328a4c['id']});});});});});});})[_0xd539('0x15')](respondWithStatusCode(_0xeb8d7a,null))[_0xd539('0x27')](handleError(_0xeb8d7a,null));};exports['addAgents']=function(_0x3a530d,_0x1054dd){return db[_0xd539('0x1e')][_0xd539('0x38')]({'where':{'id':_0x3a530d[_0xd539('0x29')]['id']}})[_0xd539('0x15')](handleEntityNotFound(_0x1054dd,null))[_0xd539('0x15')](function(_0x404d28){if(_0x404d28){return _0x404d28[_0xd539('0x72')](_0x3a530d['body'][_0xd539('0x60')],_[_0xd539('0x73')](_0x3a530d[_0xd539('0x33')],[_0xd539('0x60'),'id'])||{})[_0xd539('0x74')](function(_0x4a5819){for(var _0x39c881=0x0;_0x39c881<_0x3a530d[_0xd539('0x33')][_0xd539('0x60')][_0xd539('0x40')];_0x39c881+=0x1){socket[_0xd539('0x5e')](_0xd539('0x5f'),{'UserId':Number(_0x3a530d[_0xd539('0x33')][_0xd539('0x60')][_0x39c881]),'FaxQueueId':Number(_0x3a530d[_0xd539('0x29')]['id'])});}return _0x4a5819;});}})[_0xd539('0x15')](respondWithResult(_0x1054dd,null))['catch'](handleError(_0x1054dd,null));};exports['removeAgents']=function(_0x4365d9,_0x50972a){return db[_0xd539('0x1e')][_0xd539('0x38')]({'where':{'id':_0x4365d9[_0xd539('0x29')]['id']}})['then'](handleEntityNotFound(_0x50972a,null))[_0xd539('0x15')](function(_0x574c1a){if(_0x574c1a){return _0x574c1a[_0xd539('0x75')](_0x4365d9['query'][_0xd539('0x60')])['then'](function(){if(_[_0xd539('0x76')](_0x4365d9[_0xd539('0x24')][_0xd539('0x60')])){for(var _0x252f83=0x0;_0x252f83<_0x4365d9[_0xd539('0x24')][_0xd539('0x60')][_0xd539('0x40')];_0x252f83+=0x1){socket['emit'](_0xd539('0x71'),{'UserId':Number(_0x4365d9['query'][_0xd539('0x60')][_0x252f83]),'FaxQueueId':Number(_0x4365d9['params']['id'])});}}else{socket[_0xd539('0x5e')](_0xd539('0x71'),{'UserId':Number(_0x4365d9[_0xd539('0x24')]['ids']),'FaxQueueId':Number(_0x4365d9[_0xd539('0x29')]['id'])});}});}})['then'](respondWithStatusCode(_0x50972a,null))[_0xd539('0x27')](handleError(_0x50972a,null));};exports[_0xd539('0x77')]=function(_0x5d83d9,_0x29faa1){var _0x4bb8ee={};var _0x27c569={};var _0x1f820d;var _0x34724d;return db[_0xd539('0x1e')][_0xd539('0x3d')]({'where':{'id':_0x5d83d9[_0xd539('0x29')]['id']}})[_0xd539('0x15')](handleEntityNotFound(_0x29faa1,null))['then'](function(_0x2e1d53){if(_0x2e1d53){_0x1f820d=_0x2e1d53;_0x27c569[_0xd539('0x2e')]=_['keys'](db[_0xd539('0x54')][_0xd539('0x2b')]);_0x27c569[_0xd539('0x24')]=_['keys'](_0x5d83d9[_0xd539('0x24')]);_0x27c569[_0xd539('0x2c')]=_[_0xd539('0x2d')](_0x27c569[_0xd539('0x2e')],_0x27c569[_0xd539('0x24')]);_0x4bb8ee['attributes']=_[_0xd539('0x2d')](_0x27c569[_0xd539('0x2e')],qs['fields'](_0x5d83d9[_0xd539('0x24')]['fields']));_0x4bb8ee[_0xd539('0x2f')]=_0x4bb8ee[_0xd539('0x2f')][_0xd539('0x40')]?_0x4bb8ee[_0xd539('0x2f')]:_0x27c569[_0xd539('0x2e')];_0x4bb8ee[_0xd539('0x42')]=qs[_0xd539('0x43')](_0x5d83d9[_0xd539('0x24')][_0xd539('0x43')]);_0x4bb8ee[_0xd539('0x22')]=qs[_0xd539('0x2c')](_[_0xd539('0x44')](_0x5d83d9[_0xd539('0x24')],_0x27c569[_0xd539('0x2c')]));if(_0x5d83d9[_0xd539('0x24')]['filter']){_0x4bb8ee[_0xd539('0x22')]=_['merge'](_0x4bb8ee[_0xd539('0x22')],{'$or':_[_0xd539('0x47')](_0x4bb8ee[_0xd539('0x2f')],function(_0x1e93f3){var _0x34f316={};_0x34f316[_0x1e93f3]={'$like':'%'+_0x5d83d9[_0xd539('0x24')]['filter']+'%'};return _0x34f316;})});}_0x4bb8ee=_[_0xd539('0x30')]({},_0x4bb8ee,_0x5d83d9[_0xd539('0x31')]);return _0x1f820d[_0xd539('0x77')](_0x4bb8ee);}})[_0xd539('0x15')](function(_0x2dfe87){if(_0x2dfe87){_0x34724d=_0x2dfe87[_0xd539('0x40')];if(!_0x5d83d9[_0xd539('0x24')]['hasOwnProperty']('nolimit')){_0x4bb8ee[_0xd539('0x10')]=qs[_0xd539('0x10')](_0x5d83d9['query'][_0xd539('0x10')]);_0x4bb8ee['offset']=qs[_0xd539('0x12')](_0x5d83d9[_0xd539('0x24')][_0xd539('0x12')]);}return _0x1f820d[_0xd539('0x77')](_0x4bb8ee);}})[_0xd539('0x15')](function(_0x371b4e){if(_0x371b4e){return _0x371b4e?{'count':_0x34724d,'rows':_0x371b4e}:null;}})[_0xd539('0x15')](respondWithResult(_0x29faa1,null))[_0xd539('0x27')](handleError(_0x29faa1,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index f9a60a5..8866c81 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 _0x9a01=['hook','exports','../../mysqldb','FaxQueue','setMaxListeners','save','emit','hasOwnProperty'];(function(_0x4a0480,_0x17582d){var _0x47e240=function(_0x8ad609){while(--_0x8ad609){_0x4a0480['push'](_0x4a0480['shift']());}};_0x47e240(++_0x17582d);}(_0x9a01,0xe2));var _0x19a0=function(_0x1f00b5,_0x94861d){_0x1f00b5=_0x1f00b5-0x0;var _0x1204db=_0x9a01[_0x1f00b5];return _0x1204db;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0x19a0('0x0'))['db'][_0x19a0('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x19a0('0x2')](0x0);var events={'afterCreate':_0x19a0('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5daf03){return function(_0x2c1b25,_0x1604fd,_0x4bf651){FaxQueueEvents[_0x19a0('0x4')](_0x5daf03+':'+_0x2c1b25['id'],_0x2c1b25);FaxQueueEvents[_0x19a0('0x4')](_0x5daf03,_0x2c1b25);_0x4bf651(null);};}for(var e in events){if(events[_0x19a0('0x5')](e)){var event=events[e];FaxQueue[_0x19a0('0x6')](e,emitEvent(event));}}module[_0x19a0('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x70f1=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','save','update','remove'];(function(_0x56d856,_0x4ed94e){var _0x375e02=function(_0x4d700c){while(--_0x4d700c){_0x56d856['push'](_0x56d856['shift']());}};_0x375e02(++_0x4ed94e);}(_0x70f1,0x122));var _0x170f=function(_0x129e45,_0x405d67){_0x129e45=_0x129e45-0x0;var _0x718901=_0x70f1[_0x129e45];return _0x718901;};'use strict';var EventEmitter=require(_0x170f('0x0'));var FaxQueue=require(_0x170f('0x1'))['db'][_0x170f('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0x170f('0x3')](0x0);var events={'afterCreate':_0x170f('0x4'),'afterUpdate':_0x170f('0x5'),'afterDestroy':_0x170f('0x6')};function emitEvent(_0x5db9bf){return function(_0x4ee505,_0x7948d7,_0x33e034){FaxQueueEvents['emit'](_0x5db9bf+':'+_0x4ee505['id'],_0x4ee505);FaxQueueEvents[_0x170f('0x7')](_0x5db9bf,_0x4ee505);_0x33e034(null);};}for(var e in events){if(events[_0x170f('0x8')](e)){var event=events[e];FaxQueue[_0x170f('0x9')](e,emitEvent(event));}}module[_0x170f('0xa')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 67096eb..240e270 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 _0xb285=['exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','moment','path','rimraf'];(function(_0x3fd53b,_0x1a3e99){var _0x43d561=function(_0x56f39d){while(--_0x56f39d){_0x3fd53b['push'](_0x3fd53b['shift']());}};_0x43d561(++_0x1a3e99);}(_0xb285,0x1c6));var _0x5b28=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0xb285[_0x4bdf64];return _0x9a1a19;};'use strict';var _=require(_0x5b28('0x0'));var util=require(_0x5b28('0x1'));var logger=require(_0x5b28('0x2'))('api');var moment=require(_0x5b28('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5b28('0x4'));var rimraf=require(_0x5b28('0x5'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0x5b28('0x6')]=function(_0xd0c209,_0x5b842b){return _0xd0c209[_0x5b28('0x7')](_0x5b28('0x8'),attributes,{'tableName':_0x5b28('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4985=['./faxQueue.attributes','exports','define','FaxQueue','fax_queues','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4985,0xdd));var _0x5498=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x4985[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x5498('0x0'));var util=require(_0x5498('0x1'));var logger=require(_0x5498('0x2'))('api');var moment=require(_0x5498('0x3'));var BPromise=require('bluebird');var rp=require(_0x5498('0x4'));var fs=require('fs');var path=require(_0x5498('0x5'));var rimraf=require('rimraf');var config=require(_0x5498('0x6'));var attributes=require(_0x5498('0x7'));module[_0x5498('0x8')]=function(_0x1f3508,_0x3975ea){return _0x1f3508[_0x5498('0x9')](_0x5498('0xa'),attributes,{'tableName':_0x5498('0xb'),'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 8d76a83..6fdcbab 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 _0xf095=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxQueue.socket','register','request','then','FaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','FaxQueue','findAll','options','raw','where','attributes','include','map','model','GetFaxQueue','ShowFaxQueue','debug','lodash','util','moment','bluebird','ioredis'];(function(_0x100dea,_0x2ca828){var _0x785cb5=function(_0x1827ec){while(--_0x1827ec){_0x100dea['push'](_0x100dea['shift']());}};_0x785cb5(++_0x2ca828);}(_0xf095,0x163));var _0x5f09=function(_0x1ff7f9,_0x7f4e5d){_0x1ff7f9=_0x1ff7f9-0x0;var _0x42f261=_0xf095[_0x1ff7f9];return _0x42f261;};'use strict';var _=require(_0x5f09('0x0'));var util=require(_0x5f09('0x1'));var moment=require(_0x5f09('0x2'));var BPromise=require(_0x5f09('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f09('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5f09('0x5'));var logger=require(_0x5f09('0x6'))(_0x5f09('0x7'));var config=require(_0x5f09('0x8'));var jayson=require(_0x5f09('0x9'));var client=jayson[_0x5f09('0xa')][_0x5f09('0xb')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5f09('0xc')],{'host':_0x5f09('0xd'),'port':0x18eb});var socket=require(_0x5f09('0xe'))(new Redis(config[_0x5f09('0xc')]));require(_0x5f09('0xf'))[_0x5f09('0x10')](socket);function respondWithRpcPromise(_0x35666c,_0x39e6be,_0x1f5b7f){return new BPromise(function(_0x4d697c,_0x37e7e0){return client[_0x5f09('0x11')](_0x35666c,_0x1f5b7f)[_0x5f09('0x12')](function(_0x57d2d2){logger['info'](_0x5f09('0x13'),_0x39e6be,_0x5f09('0x14'));logger['debug']('FaxQueue,\x20%s,\x20%s,\x20%s',_0x39e6be,'request\x20sent',JSON[_0x5f09('0x15')](_0x57d2d2));if(_0x57d2d2[_0x5f09('0x16')]){if(_0x57d2d2['error'][_0x5f09('0x17')]===0x1f4){logger[_0x5f09('0x16')](_0x5f09('0x13'),_0x39e6be,_0x57d2d2[_0x5f09('0x16')][_0x5f09('0x18')]);return _0x37e7e0(_0x57d2d2[_0x5f09('0x16')][_0x5f09('0x18')]);}logger[_0x5f09('0x16')]('FaxQueue,\x20%s,\x20%s',_0x39e6be,_0x57d2d2['error']['message']);return _0x4d697c(_0x57d2d2[_0x5f09('0x16')]['message']);}else{logger[_0x5f09('0x19')](_0x5f09('0x13'),_0x39e6be,_0x5f09('0x14'));_0x4d697c(_0x57d2d2[_0x5f09('0x1a')][_0x5f09('0x18')]);}})[_0x5f09('0x1b')](function(_0x1d62be){logger['error']('FaxQueue,\x20%s,\x20%s',_0x39e6be,_0x1d62be);_0x37e7e0(_0x1d62be);});});}exports['GetFaxQueue']=function(_0x1aeba3){var _0x2bd56e=this;return new Promise(function(_0x1c1f45,_0x4bacdf){return db[_0x5f09('0x1c')][_0x5f09('0x1d')]({'raw':_0x1aeba3[_0x5f09('0x1e')]?_0x1aeba3[_0x5f09('0x1e')][_0x5f09('0x1f')]===undefined?!![]:![]:!![],'where':_0x1aeba3['options']?_0x1aeba3[_0x5f09('0x1e')][_0x5f09('0x20')]||null:null,'attributes':_0x1aeba3['options']?_0x1aeba3['options'][_0x5f09('0x21')]||null:null,'limit':_0x1aeba3[_0x5f09('0x1e')]?_0x1aeba3[_0x5f09('0x1e')]['limit']||null:null,'include':_0x1aeba3[_0x5f09('0x1e')]?_0x1aeba3[_0x5f09('0x1e')][_0x5f09('0x22')]?_[_0x5f09('0x23')](_0x1aeba3[_0x5f09('0x1e')]['include'],function(_0x396d27){return{'model':db[_0x396d27[_0x5f09('0x24')]],'as':_0x396d27['as'],'attributes':_0x396d27['attributes'],'include':_0x396d27[_0x5f09('0x22')]?_[_0x5f09('0x23')](_0x396d27[_0x5f09('0x22')],function(_0x55d765){return{'model':db[_0x55d765[_0x5f09('0x24')]],'as':_0x55d765['as'],'attributes':_0x55d765[_0x5f09('0x21')],'include':_0x55d765[_0x5f09('0x22')]?_[_0x5f09('0x23')](_0x55d765[_0x5f09('0x22')],function(_0x9bc00f){return{'model':db[_0x9bc00f[_0x5f09('0x24')]],'as':_0x9bc00f['as'],'attributes':_0x9bc00f[_0x5f09('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5f09('0x12')](function(_0x55aaf6){logger['info'](_0x5f09('0x25'),_0x1aeba3);logger['debug'](_0x5f09('0x25'),_0x1aeba3,JSON[_0x5f09('0x15')](_0x55aaf6));_0x1c1f45(_0x55aaf6);})[_0x5f09('0x1b')](function(_0x3d73a3){logger['error']('GetFaxQueue',_0x3d73a3[_0x5f09('0x18')],_0x1aeba3);_0x4bacdf(_0x2bd56e[_0x5f09('0x16')](0x1f4,_0x3d73a3[_0x5f09('0x18')]));});});};exports[_0x5f09('0x26')]=function(_0x1a24ef){var _0x432e10=this;return new Promise(function(_0x314393,_0x15a21f){return db[_0x5f09('0x1c')]['find']({'raw':_0x1a24ef[_0x5f09('0x1e')]?_0x1a24ef[_0x5f09('0x1e')][_0x5f09('0x1f')]===undefined?!![]:![]:!![],'where':_0x1a24ef['options']?_0x1a24ef[_0x5f09('0x1e')]['where']||null:null,'attributes':_0x1a24ef[_0x5f09('0x1e')]?_0x1a24ef[_0x5f09('0x1e')][_0x5f09('0x21')]||null:null,'include':_0x1a24ef[_0x5f09('0x1e')]?_0x1a24ef[_0x5f09('0x1e')][_0x5f09('0x22')]?_[_0x5f09('0x23')](_0x1a24ef[_0x5f09('0x1e')][_0x5f09('0x22')],function(_0x54877d){return{'model':db[_0x54877d[_0x5f09('0x24')]],'as':_0x54877d['as'],'attributes':_0x54877d[_0x5f09('0x21')],'include':_0x54877d['include']?_[_0x5f09('0x23')](_0x54877d[_0x5f09('0x22')],function(_0x67acd7){return{'model':db[_0x67acd7['model']],'as':_0x67acd7['as'],'attributes':_0x67acd7['attributes'],'include':_0x67acd7[_0x5f09('0x22')]?_[_0x5f09('0x23')](_0x67acd7[_0x5f09('0x22')],function(_0x2cb60b){return{'model':db[_0x2cb60b['model']],'as':_0x2cb60b['as'],'attributes':_0x2cb60b[_0x5f09('0x21')]};}):[]};}):[]};}):[]:[]})[_0x5f09('0x12')](function(_0x341977){logger['info'](_0x5f09('0x26'),_0x1a24ef);logger[_0x5f09('0x27')](_0x5f09('0x26'),_0x1a24ef,JSON[_0x5f09('0x15')](_0x341977));_0x314393(_0x341977);})[_0x5f09('0x1b')](function(_0x4c92d3){logger[_0x5f09('0x16')](_0x5f09('0x26'),_0x4c92d3[_0x5f09('0x18')],_0x1a24ef);_0x15a21f(_0x432e10['error'](0x1f4,_0x4c92d3[_0x5f09('0x18')]));});});}; \ No newline at end of file +var _0x36ab=['code','message','info','result','catch','GetFaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','ShowFaxQueue','FaxQueue','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','then','FaxQueue,\x20%s,\x20%s','debug','FaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x36ab,0x1ab));var _0xb36a=function(_0x1992f1,_0x5c61f0){_0x1992f1=_0x1992f1-0x0;var _0x413dfe=_0x36ab[_0x1992f1];return _0x413dfe;};'use strict';var _=require('lodash');var util=require(_0xb36a('0x0'));var moment=require(_0xb36a('0x1'));var BPromise=require(_0xb36a('0x2'));var rs=require(_0xb36a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb36a('0x4'))['db'];var utils=require(_0xb36a('0x5'));var logger=require(_0xb36a('0x6'))(_0xb36a('0x7'));var config=require(_0xb36a('0x8'));var jayson=require(_0xb36a('0x9'));var client=jayson[_0xb36a('0xa')][_0xb36a('0xb')]({'port':0x232a});config[_0xb36a('0xc')]=_[_0xb36a('0xd')](config[_0xb36a('0xc')],{'host':_0xb36a('0xe'),'port':0x18eb});var socket=require(_0xb36a('0xf'))(new Redis(config[_0xb36a('0xc')]));require(_0xb36a('0x10'))['register'](socket);function respondWithRpcPromise(_0x34c81e,_0x497f58,_0x56822d){return new BPromise(function(_0x46ea0e,_0x23e407){return client['request'](_0x34c81e,_0x56822d)[_0xb36a('0x11')](function(_0x29ef5b){logger['info'](_0xb36a('0x12'),_0x497f58,'request\x20sent');logger[_0xb36a('0x13')](_0xb36a('0x14'),_0x497f58,_0xb36a('0x15'),JSON[_0xb36a('0x16')](_0x29ef5b));if(_0x29ef5b[_0xb36a('0x17')]){if(_0x29ef5b[_0xb36a('0x17')][_0xb36a('0x18')]===0x1f4){logger['error'](_0xb36a('0x12'),_0x497f58,_0x29ef5b[_0xb36a('0x17')][_0xb36a('0x19')]);return _0x23e407(_0x29ef5b[_0xb36a('0x17')][_0xb36a('0x19')]);}logger['error'](_0xb36a('0x12'),_0x497f58,_0x29ef5b['error'][_0xb36a('0x19')]);return _0x46ea0e(_0x29ef5b['error'][_0xb36a('0x19')]);}else{logger[_0xb36a('0x1a')](_0xb36a('0x12'),_0x497f58,_0xb36a('0x15'));_0x46ea0e(_0x29ef5b[_0xb36a('0x1b')]['message']);}})[_0xb36a('0x1c')](function(_0x4fd521){logger[_0xb36a('0x17')](_0xb36a('0x12'),_0x497f58,_0x4fd521);_0x23e407(_0x4fd521);});});}exports[_0xb36a('0x1d')]=function(_0x5b4f86){var _0x39197a=this;return new Promise(function(_0x48a908,_0xb33c26){return db['FaxQueue'][_0xb36a('0x1e')]({'raw':_0x5b4f86[_0xb36a('0x1f')]?_0x5b4f86['options'][_0xb36a('0x20')]===undefined?!![]:![]:!![],'where':_0x5b4f86[_0xb36a('0x1f')]?_0x5b4f86[_0xb36a('0x1f')][_0xb36a('0x21')]||null:null,'attributes':_0x5b4f86[_0xb36a('0x1f')]?_0x5b4f86[_0xb36a('0x1f')][_0xb36a('0x22')]||null:null,'limit':_0x5b4f86[_0xb36a('0x1f')]?_0x5b4f86['options'][_0xb36a('0x23')]||null:null,'include':_0x5b4f86[_0xb36a('0x1f')]?_0x5b4f86[_0xb36a('0x1f')][_0xb36a('0x24')]?_['map'](_0x5b4f86[_0xb36a('0x1f')][_0xb36a('0x24')],function(_0x2d0948){return{'model':db[_0x2d0948[_0xb36a('0x25')]],'as':_0x2d0948['as'],'attributes':_0x2d0948['attributes'],'include':_0x2d0948[_0xb36a('0x24')]?_[_0xb36a('0x26')](_0x2d0948[_0xb36a('0x24')],function(_0x3ae3f8){return{'model':db[_0x3ae3f8['model']],'as':_0x3ae3f8['as'],'attributes':_0x3ae3f8[_0xb36a('0x22')],'include':_0x3ae3f8[_0xb36a('0x24')]?_['map'](_0x3ae3f8[_0xb36a('0x24')],function(_0x5af1f4){return{'model':db[_0x5af1f4[_0xb36a('0x25')]],'as':_0x5af1f4['as'],'attributes':_0x5af1f4['attributes']};}):[]};}):[]};}):[]:[]})[_0xb36a('0x11')](function(_0x25620a){logger[_0xb36a('0x1a')]('GetFaxQueue',_0x5b4f86);logger[_0xb36a('0x13')](_0xb36a('0x1d'),_0x5b4f86,JSON[_0xb36a('0x16')](_0x25620a));_0x48a908(_0x25620a);})['catch'](function(_0x42fba0){logger['error'](_0xb36a('0x1d'),_0x42fba0['message'],_0x5b4f86);_0xb33c26(_0x39197a[_0xb36a('0x17')](0x1f4,_0x42fba0[_0xb36a('0x19')]));});});};exports[_0xb36a('0x27')]=function(_0x4680d1){var _0x2d4130=this;return new Promise(function(_0x5cde2a,_0x24b8a8){return db[_0xb36a('0x28')]['find']({'raw':_0x4680d1[_0xb36a('0x1f')]?_0x4680d1['options'][_0xb36a('0x20')]===undefined?!![]:![]:!![],'where':_0x4680d1['options']?_0x4680d1['options'][_0xb36a('0x21')]||null:null,'attributes':_0x4680d1[_0xb36a('0x1f')]?_0x4680d1[_0xb36a('0x1f')]['attributes']||null:null,'include':_0x4680d1[_0xb36a('0x1f')]?_0x4680d1['options'][_0xb36a('0x24')]?_['map'](_0x4680d1['options'][_0xb36a('0x24')],function(_0xa42869){return{'model':db[_0xa42869[_0xb36a('0x25')]],'as':_0xa42869['as'],'attributes':_0xa42869[_0xb36a('0x22')],'include':_0xa42869[_0xb36a('0x24')]?_[_0xb36a('0x26')](_0xa42869['include'],function(_0x331f2f){return{'model':db[_0x331f2f[_0xb36a('0x25')]],'as':_0x331f2f['as'],'attributes':_0x331f2f[_0xb36a('0x22')],'include':_0x331f2f[_0xb36a('0x24')]?_['map'](_0x331f2f[_0xb36a('0x24')],function(_0x4f23bb){return{'model':db[_0x4f23bb[_0xb36a('0x25')]],'as':_0x4f23bb['as'],'attributes':_0x4f23bb[_0xb36a('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb36a('0x11')](function(_0x4a4af3){logger[_0xb36a('0x1a')](_0xb36a('0x27'),_0x4680d1);logger['debug'](_0xb36a('0x27'),_0x4680d1,JSON['stringify'](_0x4a4af3));_0x5cde2a(_0x4a4af3);})[_0xb36a('0x1c')](function(_0x4a5a69){logger[_0xb36a('0x17')]('ShowFaxQueue',_0x4a5a69['message'],_0x4680d1);_0x24b8a8(_0x2d4130[_0xb36a('0x17')](0x1f4,_0x4a5a69[_0xb36a('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index a37f556..4b4deb4 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 _0x7163=['removeListener','length','faxQueue:','./faxQueue.events','update','emit'];(function(_0x4b34a5,_0x45d59d){var _0x54b7f6=function(_0x199155){while(--_0x199155){_0x4b34a5['push'](_0x4b34a5['shift']());}};_0x54b7f6(++_0x45d59d);}(_0x7163,0x1ef));var _0x3716=function(_0x622035,_0x1a4b91){_0x622035=_0x622035-0x0;var _0x326cf2=_0x7163[_0x622035];return _0x326cf2;};'use strict';var FaxQueueEvents=require(_0x3716('0x0'));var events=['save','remove',_0x3716('0x1')];function createListener(_0x396758,_0x138388){return function(_0x58e0ce){_0x138388[_0x3716('0x2')](_0x396758,_0x58e0ce);};}function removeListener(_0x3da057,_0x1ec9df){return function(){FaxQueueEvents[_0x3716('0x3')](_0x3da057,_0x1ec9df);};}exports['register']=function(_0x5c81bb){for(var _0x3112a7=0x0,_0x4549b2=events[_0x3716('0x4')];_0x3112a7<_0x4549b2;_0x3112a7++){var _0x14bfe0=events[_0x3112a7];var _0x3c84bf=createListener(_0x3716('0x5')+_0x14bfe0,_0x5c81bb);FaxQueueEvents['on'](_0x14bfe0,_0x3c84bf);}}; \ No newline at end of file +var _0x98a8=['save','remove','update','removeListener','register','faxQueue:','./faxQueue.events'];(function(_0x304466,_0x2103fe){var _0x152a94=function(_0x3f63f2){while(--_0x3f63f2){_0x304466['push'](_0x304466['shift']());}};_0x152a94(++_0x2103fe);}(_0x98a8,0x12c));var _0x898a=function(_0x30c374,_0x8afacd){_0x30c374=_0x30c374-0x0;var _0x565ed4=_0x98a8[_0x30c374];return _0x565ed4;};'use strict';var FaxQueueEvents=require(_0x898a('0x0'));var events=[_0x898a('0x1'),_0x898a('0x2'),_0x898a('0x3')];function createListener(_0x213c5d,_0x226db7){return function(_0x69c61f){_0x226db7['emit'](_0x213c5d,_0x69c61f);};}function removeListener(_0x2bb3e2,_0xf84a19){return function(){FaxQueueEvents[_0x898a('0x4')](_0x2bb3e2,_0xf84a19);};}exports[_0x898a('0x5')]=function(_0x3e7ddd){for(var _0x5d7e59=0x0,_0x3aadc2=events['length'];_0x5d7e59<_0x3aadc2;_0x5d7e59++){var _0xfa8c50=events[_0x5d7e59];var _0x4fbce5=createListener(_0x898a('0x6')+_0xfa8c50,_0x3e7ddd);FaxQueueEvents['on'](_0xfa8c50,_0x4fbce5);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 2e9c5e6..1ec2617 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 _0xde46=['path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','update','delete','removeTeams','removeAgents','exports','multer','util'];(function(_0x15098c,_0x55b5e4){var _0x6af41=function(_0x1eed08){while(--_0x1eed08){_0x15098c['push'](_0x15098c['shift']());}};_0x6af41(++_0x55b5e4);}(_0xde46,0x14e));var _0x6de4=function(_0x2ff9e3,_0x14f2be){_0x2ff9e3=_0x2ff9e3-0x0;var _0x2aba67=_0xde46[_0x2ff9e3];return _0x2aba67;};'use strict';var multer=require(_0x6de4('0x0'));var util=require(_0x6de4('0x1'));var path=require(_0x6de4('0x2'));var timeout=require(_0x6de4('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6de4('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6de4('0x5'));var config=require(_0x6de4('0x6'));var controller=require(_0x6de4('0x7'));router[_0x6de4('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6de4('0x8')]('/describe',auth[_0x6de4('0x9')](),controller[_0x6de4('0xa')]);router['get'](_0x6de4('0xb'),auth[_0x6de4('0x9')](),controller[_0x6de4('0xc')]);router[_0x6de4('0x8')](_0x6de4('0xd'),auth[_0x6de4('0x9')](),controller[_0x6de4('0xe')]);router[_0x6de4('0x8')](_0x6de4('0xf'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x10')]);router['get'](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x12')]);router[_0x6de4('0x13')]('/',auth[_0x6de4('0x9')](),controller[_0x6de4('0x14')]);router[_0x6de4('0x13')](_0x6de4('0xf'),auth['isAuthenticated'](),controller[_0x6de4('0x15')]);router['post'](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x16')]);router['put'](_0x6de4('0xb'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x17')]);router[_0x6de4('0x18')]('/:id',auth[_0x6de4('0x9')](),controller['destroy']);router['delete'](_0x6de4('0xf'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x19')]);router[_0x6de4('0x18')](_0x6de4('0x11'),auth[_0x6de4('0x9')](),controller[_0x6de4('0x1a')]);module[_0x6de4('0x1b')]=router; \ No newline at end of file +var _0xd9eb=['/:id','show','/:id/members','getMembers','/:id/teams','getAgents','post','create','/:id/users','addAgents','put','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','/describe','describe'];(function(_0x4c172c,_0x260443){var _0x461d6f=function(_0x2fc84b){while(--_0x2fc84b){_0x4c172c['push'](_0x4c172c['shift']());}};_0x461d6f(++_0x260443);}(_0xd9eb,0xca));var _0xbd9e=function(_0x2e5981,_0xe4e846){_0x2e5981=_0x2e5981-0x0;var _0x6e4fef=_0xd9eb[_0x2e5981];return _0x6e4fef;};'use strict';var multer=require(_0xbd9e('0x0'));var util=require(_0xbd9e('0x1'));var path=require(_0xbd9e('0x2'));var timeout=require(_0xbd9e('0x3'));var express=require(_0xbd9e('0x4'));var router=express[_0xbd9e('0x5')]();var fs_extra=require(_0xbd9e('0x6'));var auth=require(_0xbd9e('0x7'));var interaction=require(_0xbd9e('0x8'));var config=require(_0xbd9e('0x9'));var controller=require(_0xbd9e('0xa'));router[_0xbd9e('0xb')]('/',auth[_0xbd9e('0xc')](),controller['index']);router[_0xbd9e('0xb')](_0xbd9e('0xd'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0xe')]);router[_0xbd9e('0xb')](_0xbd9e('0xf'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x10')]);router[_0xbd9e('0xb')](_0xbd9e('0x11'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x12')]);router['get'](_0xbd9e('0x13'),auth[_0xbd9e('0xc')](),controller['getTeams']);router[_0xbd9e('0xb')]('/:id/users',auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x14')]);router[_0xbd9e('0x15')]('/',auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x16')]);router[_0xbd9e('0x15')](_0xbd9e('0x13'),auth[_0xbd9e('0xc')](),controller['addTeams']);router[_0xbd9e('0x15')](_0xbd9e('0x17'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x18')]);router[_0xbd9e('0x19')](_0xbd9e('0xf'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x1a')]);router[_0xbd9e('0x1b')](_0xbd9e('0xf'),auth[_0xbd9e('0xc')](),controller['destroy']);router[_0xbd9e('0x1b')](_0xbd9e('0x13'),auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x1c')]);router[_0xbd9e('0x1b')]('/:id/users',auth[_0xbd9e('0xc')](),controller[_0xbd9e('0x1d')]);module[_0xbd9e('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index f01e2c3..7ab91a6 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 _0x62dd=['exports','STRING','DATE','moment','sequelize'];(function(_0x10d52b,_0xc6a4f1){var _0x2bf44a=function(_0x286009){while(--_0x286009){_0x10d52b['push'](_0x10d52b['shift']());}};_0x2bf44a(++_0xc6a4f1);}(_0x62dd,0x6c));var _0xd62d=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x62dd[_0x2641f9];return _0x585741;};'use strict';var moment=require(_0xd62d('0x0'));var Sequelize=require(_0xd62d('0x1'));module[_0xd62d('0x2')]={'uniqueid':{'type':Sequelize[_0xd62d('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xd62d('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xd62d('0x4')]},'acceptAt':{'type':Sequelize[_0xd62d('0x4')]},'exitAt':{'type':Sequelize[_0xd62d('0x4')]},'reason':{'type':Sequelize[_0xd62d('0x3')]}}; \ No newline at end of file +var _0xd8a7=['DATE','moment','STRING'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xd8a7,0xdf));var _0x7d8a=function(_0x3fa44d,_0x4c190d){_0x3fa44d=_0x3fa44d-0x0;var _0x603bce=_0xd8a7[_0x3fa44d];return _0x603bce;};'use strict';var moment=require(_0x7d8a('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x7d8a('0x1')]},'joinAt':{'type':Sequelize[_0x7d8a('0x2')]},'leaveAt':{'type':Sequelize[_0x7d8a('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x7d8a('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 573485a..af88e5c 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 _0xcd31=['util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','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','sendStatus','status','offset','count','limit','set','Content-Range','reject','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','where','pick','VIRTUAL','filter','merge','FaxQueueReport','includeAll','include','rows','catch','intersection','options','create','body','find','destroy','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xcd31,0x15d));var _0x1cd3=function(_0x53f51f,_0x208fe1){_0x53f51f=_0x53f51f-0x0;var _0x208c04=_0xcd31[_0x53f51f];return _0x208c04;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1cd3('0x0'));var zipdir=require(_0x1cd3('0x1'));var jsonpatch=require(_0x1cd3('0x2'));var rp=require('request-promise');var moment=require(_0x1cd3('0x3'));var BPromise=require(_0x1cd3('0x4'));var Mustache=require(_0x1cd3('0x5'));var util=require(_0x1cd3('0x6'));var path=require(_0x1cd3('0x7'));var sox=require(_0x1cd3('0x8'));var csv=require('to-csv');var ejs=require(_0x1cd3('0x9'));var fs=require('fs');var fs_extra=require(_0x1cd3('0xa'));var _=require(_0x1cd3('0xb'));var squel=require('squel');var crypto=require(_0x1cd3('0xc'));var jsforce=require(_0x1cd3('0xd'));var deskjs=require(_0x1cd3('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1cd3('0xf'));var Papa=require(_0x1cd3('0x10'));var Redis=require(_0x1cd3('0x11'));var authService=require(_0x1cd3('0x12'));var qs=require(_0x1cd3('0x13'));var as=require(_0x1cd3('0x14'));var hardwareService=require(_0x1cd3('0x15'));var logger=require('../../config/logger')(_0x1cd3('0x16'));var utils=require(_0x1cd3('0x17'));var config=require(_0x1cd3('0x18'));var licenseUtil=require(_0x1cd3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xfe288e,_0x4c9c6d){_0x4c9c6d=_0x4c9c6d||0xcc;return function(_0x41016f){if(_0x41016f){return _0xfe288e[_0x1cd3('0x1a')](_0x4c9c6d);}return _0xfe288e[_0x1cd3('0x1b')](_0x4c9c6d)['end']();};}function respondWithResult(_0x5b885f,_0x1a874c){_0x1a874c=_0x1a874c||0xc8;return function(_0x1def57){if(_0x1def57){return _0x5b885f[_0x1cd3('0x1b')](_0x1a874c)['json'](_0x1def57);}};}function respondWithFilteredResult(_0x2b28cf,_0x40cbbf){return function(_0x5a2b84){if(_0x5a2b84){var _0x418da3=typeof _0x40cbbf['offset']==='undefined'&&typeof _0x40cbbf['limit']==='undefined';var _0x5ca15c=_0x5a2b84['count'];var _0x14c491=_0x418da3?0x0:_0x40cbbf[_0x1cd3('0x1c')];var _0xf82a46=_0x418da3?_0x5a2b84[_0x1cd3('0x1d')]:_0x40cbbf[_0x1cd3('0x1c')]+_0x40cbbf[_0x1cd3('0x1e')];var _0x35870b;if(_0xf82a46>=_0x5ca15c){_0xf82a46=_0x5ca15c;_0x35870b=0xc8;}else{_0x35870b=0xce;}_0x2b28cf[_0x1cd3('0x1b')](_0x35870b);return _0x2b28cf[_0x1cd3('0x1f')](_0x1cd3('0x20'),_0x14c491+'-'+_0xf82a46+'/'+_0x5ca15c)['json'](_0x5a2b84);}return null;};}function patchUpdates(_0x33fc72){return function(_0x2368b3){try{jsonpatch['apply'](_0x2368b3,_0x33fc72,!![]);}catch(_0x26b59a){return BPromise[_0x1cd3('0x21')](_0x26b59a);}return _0x2368b3['save']();};}function saveUpdates(_0x20cda5,_0x159d22){return function(_0x330741){if(_0x330741){return _0x330741[_0x1cd3('0x22')](_0x20cda5)['then'](function(_0x4f6920){return _0x4f6920;});}return null;};}function removeEntity(_0x29ff8c,_0x1a6dad){return function(_0x49c7b1){if(_0x49c7b1){return _0x49c7b1['destroy']()[_0x1cd3('0x23')](function(){_0x29ff8c[_0x1cd3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x55aa9c,_0x34b15f){return function(_0x1589fa){if(!_0x1589fa){_0x55aa9c['sendStatus'](0x194);}return _0x1589fa;};}function handleError(_0x5635f9,_0x1c86f6){_0x1c86f6=_0x1c86f6||0x1f4;return function(_0xc311a9){logger[_0x1cd3('0x24')](_0xc311a9['stack']);if(_0xc311a9['name']){delete _0xc311a9[_0x1cd3('0x25')];}_0x5635f9['status'](_0x1c86f6)[_0x1cd3('0x26')](_0xc311a9);};}exports[_0x1cd3('0x27')]=function(_0x268501,_0x4b7c0b){var _0xae9d0c={},_0x53979a={},_0x47578c={'count':0x0,'rows':[]};var _0x3e3afb=_[_0x1cd3('0x28')](db['FaxQueueReport'][_0x1cd3('0x29')],function(_0x909bc6){return{'name':_0x909bc6[_0x1cd3('0x2a')],'type':_0x909bc6[_0x1cd3('0x2b')][_0x1cd3('0x2c')]};});_0x53979a['model']=_[_0x1cd3('0x28')](_0x3e3afb,_0x1cd3('0x25'));_0x53979a[_0x1cd3('0x2d')]=_[_0x1cd3('0x2e')](_0x268501[_0x1cd3('0x2d')]);_0x53979a[_0x1cd3('0x2f')]=_['intersection'](_0x53979a[_0x1cd3('0x30')],_0x53979a[_0x1cd3('0x2d')]);_0xae9d0c['attributes']=_['intersection'](_0x53979a[_0x1cd3('0x30')],qs[_0x1cd3('0x31')](_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x31')]));_0xae9d0c[_0x1cd3('0x32')]=_0xae9d0c['attributes'][_0x1cd3('0x33')]?_0xae9d0c['attributes']:_0x53979a['model'];if(!_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x34')](_0x1cd3('0x35'))){_0xae9d0c[_0x1cd3('0x1e')]=qs['limit'](_0x268501[_0x1cd3('0x2d')]['limit']);_0xae9d0c[_0x1cd3('0x1c')]=qs[_0x1cd3('0x1c')](_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x1c')]);}_0xae9d0c['order']=qs['sort'](_0x268501[_0x1cd3('0x2d')]['sort']);_0xae9d0c[_0x1cd3('0x36')]=qs[_0x1cd3('0x2f')](_[_0x1cd3('0x37')](_0x268501[_0x1cd3('0x2d')],_0x53979a[_0x1cd3('0x2f')]),_0x3e3afb);if(_0x268501['query']['filter']){_0xae9d0c['where']=_['merge'](_0xae9d0c[_0x1cd3('0x36')],{'$or':_['map'](_0x3e3afb,function(_0x285845){if(_0x285845['type']!==_0x1cd3('0x38')){var _0x1af9a6={};_0x1af9a6[_0x285845['name']]={'$like':'%'+_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x39')]+'%'};return _0x1af9a6;}})});}_0xae9d0c=_[_0x1cd3('0x3a')]({},_0xae9d0c,_0x268501['options']);var _0x53e2dd={'where':_0xae9d0c[_0x1cd3('0x36')]};return db[_0x1cd3('0x3b')][_0x1cd3('0x1d')](_0x53e2dd)[_0x1cd3('0x23')](function(_0x2cc3a3){_0x47578c[_0x1cd3('0x1d')]=_0x2cc3a3;if(_0x268501[_0x1cd3('0x2d')][_0x1cd3('0x3c')]){_0xae9d0c[_0x1cd3('0x3d')]=[{'all':!![]}];}return db['FaxQueueReport']['findAll'](_0xae9d0c);})['then'](function(_0x42a2ed){_0x47578c[_0x1cd3('0x3e')]=_0x42a2ed;return _0x47578c;})['then'](respondWithFilteredResult(_0x4b7c0b,_0xae9d0c))[_0x1cd3('0x3f')](handleError(_0x4b7c0b,null));};exports['show']=function(_0x40b662,_0x2f6a00){var _0x2109a2={'raw':!![],'where':{'id':_0x40b662['params']['id']}},_0x326f08={};_0x326f08['model']=_['keys'](db[_0x1cd3('0x3b')]['rawAttributes']);_0x326f08['query']=_[_0x1cd3('0x2e')](_0x40b662['query']);_0x326f08[_0x1cd3('0x2f')]=_[_0x1cd3('0x40')](_0x326f08[_0x1cd3('0x30')],_0x326f08[_0x1cd3('0x2d')]);_0x2109a2[_0x1cd3('0x32')]=_[_0x1cd3('0x40')](_0x326f08[_0x1cd3('0x30')],qs[_0x1cd3('0x31')](_0x40b662['query'][_0x1cd3('0x31')]));_0x2109a2[_0x1cd3('0x32')]=_0x2109a2[_0x1cd3('0x32')]['length']?_0x2109a2['attributes']:_0x326f08[_0x1cd3('0x30')];if(_0x40b662[_0x1cd3('0x2d')][_0x1cd3('0x3c')]){_0x2109a2[_0x1cd3('0x3d')]=[{'all':!![]}];}_0x2109a2=_[_0x1cd3('0x3a')]({},_0x2109a2,_0x40b662[_0x1cd3('0x41')]);return db[_0x1cd3('0x3b')]['find'](_0x2109a2)[_0x1cd3('0x23')](handleEntityNotFound(_0x2f6a00,null))[_0x1cd3('0x23')](respondWithResult(_0x2f6a00,null))[_0x1cd3('0x3f')](handleError(_0x2f6a00,null));};exports['create']=function(_0x57c84d,_0x2605c5){return db[_0x1cd3('0x3b')][_0x1cd3('0x42')](_0x57c84d[_0x1cd3('0x43')],{})[_0x1cd3('0x23')](respondWithResult(_0x2605c5,0xc9))['catch'](handleError(_0x2605c5,null));};exports['update']=function(_0x500fcf,_0x3cde0b){if(_0x500fcf[_0x1cd3('0x43')]['id']){delete _0x500fcf[_0x1cd3('0x43')]['id'];}return db[_0x1cd3('0x3b')][_0x1cd3('0x44')]({'where':{'id':_0x500fcf['params']['id']}})['then'](handleEntityNotFound(_0x3cde0b,null))[_0x1cd3('0x23')](saveUpdates(_0x500fcf[_0x1cd3('0x43')],null))['then'](respondWithResult(_0x3cde0b,null))[_0x1cd3('0x3f')](handleError(_0x3cde0b,null));};exports[_0x1cd3('0x45')]=function(_0x2542f6,_0x5c7d9c){return db['FaxQueueReport'][_0x1cd3('0x44')]({'where':{'id':_0x2542f6['params']['id']}})[_0x1cd3('0x23')](handleEntityNotFound(_0x5c7d9c,null))[_0x1cd3('0x23')](removeEntity(_0x5c7d9c,null))[_0x1cd3('0x3f')](handleError(_0x5c7d9c,null));};exports[_0x1cd3('0x46')]=function(_0x44037e,_0xfaecf0){return db[_0x1cd3('0x3b')][_0x1cd3('0x46')]()['then'](respondWithResult(_0xfaecf0,null))[_0x1cd3('0x3f')](handleError(_0xfaecf0,null));}; \ No newline at end of file +var _0x49e9=['count','offset','set','Content-Range','json','apply','reject','save','then','destroy','error','name','send','index','FaxQueueReport','rawAttributes','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch','params','include','options','find','create','body','update','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit'];(function(_0x33e840,_0x120983){var _0x363891=function(_0x276d39){while(--_0x276d39){_0x33e840['push'](_0x33e840['shift']());}};_0x363891(++_0x120983);}(_0x49e9,0x10f));var _0x949e=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49e9[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x949e('0x0'));var rimraf=require(_0x949e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x949e('0x2'));var rp=require(_0x949e('0x3'));var moment=require(_0x949e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x949e('0x5'));var path=require('path');var sox=require(_0x949e('0x6'));var csv=require(_0x949e('0x7'));var ejs=require(_0x949e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x949e('0x9'));var squel=require(_0x949e('0xa'));var crypto=require(_0x949e('0xb'));var jsforce=require(_0x949e('0xc'));var deskjs=require(_0x949e('0xd'));var toCsv=require(_0x949e('0x7'));var querystring=require(_0x949e('0xe'));var Papa=require('papaparse');var Redis=require(_0x949e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x949e('0x10'));var as=require(_0x949e('0x11'));var hardwareService=require(_0x949e('0x12'));var logger=require('../../config/logger')(_0x949e('0x13'));var utils=require(_0x949e('0x14'));var config=require(_0x949e('0x15'));var licenseUtil=require(_0x949e('0x16'));var db=require(_0x949e('0x17'))['db'];function respondWithStatusCode(_0x253d5e,_0x1871a5){_0x1871a5=_0x1871a5||0xcc;return function(_0x17d1f3){if(_0x17d1f3){return _0x253d5e[_0x949e('0x18')](_0x1871a5);}return _0x253d5e[_0x949e('0x19')](_0x1871a5)[_0x949e('0x1a')]();};}function respondWithResult(_0x7a8954,_0x3e0e54){_0x3e0e54=_0x3e0e54||0xc8;return function(_0x7f8be2){if(_0x7f8be2){return _0x7a8954[_0x949e('0x19')](_0x3e0e54)['json'](_0x7f8be2);}};}function respondWithFilteredResult(_0x257981,_0x3d81cd){return function(_0x587bff){if(_0x587bff){var _0xf1f41a=typeof _0x3d81cd['offset']===_0x949e('0x1b')&&typeof _0x3d81cd[_0x949e('0x1c')]==='undefined';var _0x37fd96=_0x587bff[_0x949e('0x1d')];var _0x43498d=_0xf1f41a?0x0:_0x3d81cd[_0x949e('0x1e')];var _0x20333c=_0xf1f41a?_0x587bff['count']:_0x3d81cd[_0x949e('0x1e')]+_0x3d81cd[_0x949e('0x1c')];var _0x476fa8;if(_0x20333c>=_0x37fd96){_0x20333c=_0x37fd96;_0x476fa8=0xc8;}else{_0x476fa8=0xce;}_0x257981[_0x949e('0x19')](_0x476fa8);return _0x257981[_0x949e('0x1f')](_0x949e('0x20'),_0x43498d+'-'+_0x20333c+'/'+_0x37fd96)[_0x949e('0x21')](_0x587bff);}return null;};}function patchUpdates(_0x2f21bd){return function(_0x104740){try{jsonpatch[_0x949e('0x22')](_0x104740,_0x2f21bd,!![]);}catch(_0x23fc20){return BPromise[_0x949e('0x23')](_0x23fc20);}return _0x104740[_0x949e('0x24')]();};}function saveUpdates(_0x1927ab,_0x199d53){return function(_0x2e81f2){if(_0x2e81f2){return _0x2e81f2['update'](_0x1927ab)[_0x949e('0x25')](function(_0x44ffb4){return _0x44ffb4;});}return null;};}function removeEntity(_0x5572ae,_0x48a1d1){return function(_0x23b38e){if(_0x23b38e){return _0x23b38e[_0x949e('0x26')]()[_0x949e('0x25')](function(){_0x5572ae[_0x949e('0x19')](0xcc)[_0x949e('0x1a')]();});}};}function handleEntityNotFound(_0x1185b3,_0x29e07b){return function(_0x255b11){if(!_0x255b11){_0x1185b3[_0x949e('0x18')](0x194);}return _0x255b11;};}function handleError(_0x20258c,_0x5dcc46){_0x5dcc46=_0x5dcc46||0x1f4;return function(_0x212224){logger[_0x949e('0x27')](_0x212224['stack']);if(_0x212224[_0x949e('0x28')]){delete _0x212224[_0x949e('0x28')];}_0x20258c['status'](_0x5dcc46)[_0x949e('0x29')](_0x212224);};}exports[_0x949e('0x2a')]=function(_0x5b9f28,_0x1867d9){var _0x5b2b0b={},_0x5e6e34={},_0x4e169d={'count':0x0,'rows':[]};var _0x54ad5d=_['map'](db[_0x949e('0x2b')][_0x949e('0x2c')],function(_0x3051ec){return{'name':_0x3051ec['fieldName'],'type':_0x3051ec['type']['key']};});_0x5e6e34['model']=_[_0x949e('0x2d')](_0x54ad5d,_0x949e('0x28'));_0x5e6e34[_0x949e('0x2e')]=_[_0x949e('0x2f')](_0x5b9f28['query']);_0x5e6e34[_0x949e('0x30')]=_[_0x949e('0x31')](_0x5e6e34[_0x949e('0x32')],_0x5e6e34['query']);_0x5b2b0b[_0x949e('0x33')]=_[_0x949e('0x31')](_0x5e6e34[_0x949e('0x32')],qs['fields'](_0x5b9f28['query'][_0x949e('0x34')]));_0x5b2b0b[_0x949e('0x33')]=_0x5b2b0b[_0x949e('0x33')][_0x949e('0x35')]?_0x5b2b0b['attributes']:_0x5e6e34[_0x949e('0x32')];if(!_0x5b9f28[_0x949e('0x2e')][_0x949e('0x36')](_0x949e('0x37'))){_0x5b2b0b[_0x949e('0x1c')]=qs[_0x949e('0x1c')](_0x5b9f28[_0x949e('0x2e')][_0x949e('0x1c')]);_0x5b2b0b['offset']=qs['offset'](_0x5b9f28[_0x949e('0x2e')]['offset']);}_0x5b2b0b['order']=qs[_0x949e('0x38')](_0x5b9f28[_0x949e('0x2e')][_0x949e('0x38')]);_0x5b2b0b[_0x949e('0x39')]=qs[_0x949e('0x30')](_[_0x949e('0x3a')](_0x5b9f28[_0x949e('0x2e')],_0x5e6e34[_0x949e('0x30')]),_0x54ad5d);if(_0x5b9f28[_0x949e('0x2e')][_0x949e('0x3b')]){_0x5b2b0b[_0x949e('0x39')]=_[_0x949e('0x3c')](_0x5b2b0b[_0x949e('0x39')],{'$or':_[_0x949e('0x2d')](_0x54ad5d,function(_0x26ad2b){if(_0x26ad2b[_0x949e('0x3d')]!==_0x949e('0x3e')){var _0x498fa3={};_0x498fa3[_0x26ad2b[_0x949e('0x28')]]={'$like':'%'+_0x5b9f28['query'][_0x949e('0x3b')]+'%'};return _0x498fa3;}})});}_0x5b2b0b=_[_0x949e('0x3c')]({},_0x5b2b0b,_0x5b9f28['options']);var _0x5084dc={'where':_0x5b2b0b['where']};return db[_0x949e('0x2b')][_0x949e('0x1d')](_0x5084dc)['then'](function(_0x59c024){_0x4e169d['count']=_0x59c024;if(_0x5b9f28[_0x949e('0x2e')][_0x949e('0x3f')]){_0x5b2b0b['include']=[{'all':!![]}];}return db[_0x949e('0x2b')][_0x949e('0x40')](_0x5b2b0b);})['then'](function(_0x3a1bc7){_0x4e169d[_0x949e('0x41')]=_0x3a1bc7;return _0x4e169d;})[_0x949e('0x25')](respondWithFilteredResult(_0x1867d9,_0x5b2b0b))[_0x949e('0x42')](handleError(_0x1867d9,null));};exports['show']=function(_0x58b34b,_0x2bca69){var _0x590aa7={'raw':!![],'where':{'id':_0x58b34b[_0x949e('0x43')]['id']}},_0x7201da={};_0x7201da[_0x949e('0x32')]=_[_0x949e('0x2f')](db[_0x949e('0x2b')]['rawAttributes']);_0x7201da['query']=_[_0x949e('0x2f')](_0x58b34b['query']);_0x7201da[_0x949e('0x30')]=_[_0x949e('0x31')](_0x7201da[_0x949e('0x32')],_0x7201da[_0x949e('0x2e')]);_0x590aa7[_0x949e('0x33')]=_[_0x949e('0x31')](_0x7201da['model'],qs['fields'](_0x58b34b[_0x949e('0x2e')][_0x949e('0x34')]));_0x590aa7[_0x949e('0x33')]=_0x590aa7[_0x949e('0x33')][_0x949e('0x35')]?_0x590aa7['attributes']:_0x7201da[_0x949e('0x32')];if(_0x58b34b[_0x949e('0x2e')]['includeAll']){_0x590aa7[_0x949e('0x44')]=[{'all':!![]}];}_0x590aa7=_[_0x949e('0x3c')]({},_0x590aa7,_0x58b34b[_0x949e('0x45')]);return db[_0x949e('0x2b')][_0x949e('0x46')](_0x590aa7)[_0x949e('0x25')](handleEntityNotFound(_0x2bca69,null))[_0x949e('0x25')](respondWithResult(_0x2bca69,null))[_0x949e('0x42')](handleError(_0x2bca69,null));};exports[_0x949e('0x47')]=function(_0x4913f5,_0x1599ea){return db['FaxQueueReport'][_0x949e('0x47')](_0x4913f5[_0x949e('0x48')],{})['then'](respondWithResult(_0x1599ea,0xc9))[_0x949e('0x42')](handleError(_0x1599ea,null));};exports[_0x949e('0x49')]=function(_0x121355,_0x2e2b6a){if(_0x121355[_0x949e('0x48')]['id']){delete _0x121355[_0x949e('0x48')]['id'];}return db[_0x949e('0x2b')][_0x949e('0x46')]({'where':{'id':_0x121355['params']['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x2e2b6a,null))[_0x949e('0x25')](saveUpdates(_0x121355[_0x949e('0x48')],null))[_0x949e('0x25')](respondWithResult(_0x2e2b6a,null))[_0x949e('0x42')](handleError(_0x2e2b6a,null));};exports['destroy']=function(_0x5f23b2,_0x46a4fe){return db[_0x949e('0x2b')]['find']({'where':{'id':_0x5f23b2[_0x949e('0x43')]['id']}})[_0x949e('0x25')](handleEntityNotFound(_0x46a4fe,null))[_0x949e('0x25')](removeEntity(_0x46a4fe,null))[_0x949e('0x42')](handleError(_0x46a4fe,null));};exports['describe']=function(_0x4b990e,_0x450d16){return db[_0x949e('0x2b')][_0x949e('0x4a')]()[_0x949e('0x25')](respondWithResult(_0x450d16,null))[_0x949e('0x42')](handleError(_0x450d16,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index af21e0a..d143b94 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 _0xf494=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','uniqueid','lodash'];(function(_0x55a057,_0x5df5c8){var _0x9187d4=function(_0x33f4ee){while(--_0x33f4ee){_0x55a057['push'](_0x55a057['shift']());}};_0x9187d4(++_0x5df5c8);}(_0xf494,0x1c6));var _0x4f49=function(_0x423fe7,_0x200e4e){_0x423fe7=_0x423fe7-0x0;var _0x50d618=_0xf494[_0x423fe7];return _0x50d618;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var logger=require(_0x4f49('0x2'))('api');var moment=require(_0x4f49('0x3'));var BPromise=require(_0x4f49('0x4'));var rp=require(_0x4f49('0x5'));var fs=require('fs');var path=require(_0x4f49('0x6'));var rimraf=require(_0x4f49('0x7'));var config=require(_0x4f49('0x8'));var attributes=require(_0x4f49('0x9'));module[_0x4f49('0xa')]=function(_0xc5e778,_0x413530){return _0xc5e778[_0x4f49('0xb')]('FaxQueueReport',attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x4f49('0xc'),'fields':[_0x4f49('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x590fc4,_0x44de6f){var _0x59c99d=function(_0x4bf657){while(--_0x4bf657){_0x590fc4['push'](_0x590fc4['shift']());}};_0x59c99d(++_0x44de6f);}(_0x4975,0x86));var _0x5497=function(_0x1ad8f,_0x2cd4f4){_0x1ad8f=_0x1ad8f-0x0;var _0xbfcab=_0x4975[_0x1ad8f];return _0xbfcab;};'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':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 195efe4..a876580 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 _0xc1df=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','catch','UpdateFaxQueueReport','where','attributes','limit','lodash','moment','bluebird'];(function(_0x1b776e,_0x1d341e){var _0x3b8294=function(_0x352b9a){while(--_0x352b9a){_0x1b776e['push'](_0x1b776e['shift']());}};_0x3b8294(++_0x1d341e);}(_0xc1df,0xfd));var _0xfc1d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xc1df[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xfc1d('0x0'));var util=require('util');var moment=require(_0xfc1d('0x1'));var BPromise=require(_0xfc1d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc1d('0x3'));var db=require(_0xfc1d('0x4'))['db'];var utils=require(_0xfc1d('0x5'));var logger=require(_0xfc1d('0x6'))(_0xfc1d('0x7'));var config=require('../../config/environment');var jayson=require(_0xfc1d('0x8'));var client=jayson[_0xfc1d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x460cf9,_0x569ff3,_0x21cec6){return new BPromise(function(_0x5a1258,_0x133d29){return client[_0xfc1d('0xa')](_0x460cf9,_0x21cec6)[_0xfc1d('0xb')](function(_0x53b0a4){logger['info'](_0xfc1d('0xc'),_0x569ff3,_0xfc1d('0xd'));logger[_0xfc1d('0xe')](_0xfc1d('0xf'),_0x569ff3,_0xfc1d('0xd'),JSON[_0xfc1d('0x10')](_0x53b0a4));if(_0x53b0a4[_0xfc1d('0x11')]){if(_0x53b0a4[_0xfc1d('0x11')][_0xfc1d('0x12')]===0x1f4){logger[_0xfc1d('0x11')](_0xfc1d('0xc'),_0x569ff3,_0x53b0a4['error'][_0xfc1d('0x13')]);return _0x133d29(_0x53b0a4[_0xfc1d('0x11')][_0xfc1d('0x13')]);}logger[_0xfc1d('0x11')](_0xfc1d('0xc'),_0x569ff3,_0x53b0a4[_0xfc1d('0x11')]['message']);return _0x5a1258(_0x53b0a4[_0xfc1d('0x11')][_0xfc1d('0x13')]);}else{logger[_0xfc1d('0x14')](_0xfc1d('0xc'),_0x569ff3,_0xfc1d('0xd'));_0x5a1258(_0x53b0a4['result'][_0xfc1d('0x13')]);}})['catch'](function(_0x346660){logger[_0xfc1d('0x11')](_0xfc1d('0xc'),_0x569ff3,_0x346660);_0x133d29(_0x346660);});});}exports[_0xfc1d('0x15')]=function(_0x3a9d3e){var _0xf0f528=this;return new Promise(function(_0x567547,_0x530499){return db[_0xfc1d('0x16')][_0xfc1d('0x17')](_0x3a9d3e[_0xfc1d('0x18')],{'raw':_0x3a9d3e['options']?_0x3a9d3e[_0xfc1d('0x19')][_0xfc1d('0x1a')]===undefined?!![]:![]:!![]})[_0xfc1d('0xb')](function(_0x3e53d5){logger[_0xfc1d('0x14')](_0xfc1d('0x15'),_0x3a9d3e);logger[_0xfc1d('0xe')](_0xfc1d('0x15'),_0x3a9d3e,JSON[_0xfc1d('0x10')](_0x3e53d5));_0x567547(_0x3e53d5);})[_0xfc1d('0x1b')](function(_0x167ac4){logger[_0xfc1d('0x11')](_0xfc1d('0x15'),_0x167ac4[_0xfc1d('0x13')],_0x3a9d3e);_0x530499(_0xf0f528[_0xfc1d('0x11')](0x1f4,_0x167ac4[_0xfc1d('0x13')]));});});};exports[_0xfc1d('0x1c')]=function(_0x3741e3){var _0x126188=this;return new Promise(function(_0x406e1c,_0x5f26e0){return db['FaxQueueReport']['update'](_0x3741e3[_0xfc1d('0x18')],{'raw':_0x3741e3[_0xfc1d('0x19')]?_0x3741e3[_0xfc1d('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3741e3[_0xfc1d('0x19')]?_0x3741e3[_0xfc1d('0x19')][_0xfc1d('0x1d')]||null:null,'attributes':_0x3741e3[_0xfc1d('0x19')]?_0x3741e3[_0xfc1d('0x19')][_0xfc1d('0x1e')]||null:null,'limit':_0x3741e3[_0xfc1d('0x19')]?_0x3741e3[_0xfc1d('0x19')][_0xfc1d('0x1f')]||null:null})[_0xfc1d('0xb')](function(_0x563239){logger['info'](_0xfc1d('0x1c'),_0x3741e3);logger[_0xfc1d('0xe')](_0xfc1d('0x1c'),_0x3741e3,JSON[_0xfc1d('0x10')](_0x563239));_0x406e1c(_0x563239);})[_0xfc1d('0x1b')](function(_0x495b62){logger['error']('UpdateFaxQueueReport',_0x495b62[_0xfc1d('0x13')],_0x3741e3);_0x5f26e0(_0x126188[_0xfc1d('0x11')](0x1f4,_0x495b62['message']));});});}; \ No newline at end of file +var _0x2f54=['../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','where','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5c47f7,_0xc34ca6){var _0x53037a=function(_0x1fbca4){while(--_0x1fbca4){_0x5c47f7['push'](_0x5c47f7['shift']());}};_0x53037a(++_0xc34ca6);}(_0x2f54,0x142));var _0x42f5=function(_0x1602fd,_0x847115){_0x1602fd=_0x1602fd-0x0;var _0x1eaf42=_0x2f54[_0x1602fd];return _0x1eaf42;};'use strict';var _=require(_0x42f5('0x0'));var util=require(_0x42f5('0x1'));var moment=require(_0x42f5('0x2'));var BPromise=require('bluebird');var rs=require(_0x42f5('0x3'));var fs=require('fs');var Redis=require(_0x42f5('0x4'));var db=require(_0x42f5('0x5'))['db'];var utils=require(_0x42f5('0x6'));var logger=require(_0x42f5('0x7'))('rpc');var config=require(_0x42f5('0x8'));var jayson=require(_0x42f5('0x9'));var client=jayson['client'][_0x42f5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4db778,_0x1512e1,_0x1446de){return new BPromise(function(_0x1764f6,_0x2ea43d){return client[_0x42f5('0xb')](_0x4db778,_0x1446de)[_0x42f5('0xc')](function(_0x890696){logger[_0x42f5('0xd')](_0x42f5('0xe'),_0x1512e1,_0x42f5('0xf'));logger[_0x42f5('0x10')]('FaxQueueReport,\x20%s,\x20%s,\x20%s',_0x1512e1,'request\x20sent',JSON[_0x42f5('0x11')](_0x890696));if(_0x890696[_0x42f5('0x12')]){if(_0x890696[_0x42f5('0x12')][_0x42f5('0x13')]===0x1f4){logger[_0x42f5('0x12')](_0x42f5('0xe'),_0x1512e1,_0x890696[_0x42f5('0x12')][_0x42f5('0x14')]);return _0x2ea43d(_0x890696[_0x42f5('0x12')][_0x42f5('0x14')]);}logger[_0x42f5('0x12')](_0x42f5('0xe'),_0x1512e1,_0x890696[_0x42f5('0x12')][_0x42f5('0x14')]);return _0x1764f6(_0x890696[_0x42f5('0x12')]['message']);}else{logger[_0x42f5('0xd')](_0x42f5('0xe'),_0x1512e1,_0x42f5('0xf'));_0x1764f6(_0x890696[_0x42f5('0x15')][_0x42f5('0x14')]);}})[_0x42f5('0x16')](function(_0x1ccdcc){logger[_0x42f5('0x12')](_0x42f5('0xe'),_0x1512e1,_0x1ccdcc);_0x2ea43d(_0x1ccdcc);});});}exports[_0x42f5('0x17')]=function(_0x59feb3){var _0x5a85bd=this;return new Promise(function(_0x32c21a,_0x34dd2b){return db[_0x42f5('0x18')][_0x42f5('0x19')](_0x59feb3[_0x42f5('0x1a')],{'raw':_0x59feb3[_0x42f5('0x1b')]?_0x59feb3[_0x42f5('0x1b')][_0x42f5('0x1c')]===undefined?!![]:![]:!![]})[_0x42f5('0xc')](function(_0x70b1da){logger[_0x42f5('0xd')](_0x42f5('0x17'),_0x59feb3);logger[_0x42f5('0x10')](_0x42f5('0x17'),_0x59feb3,JSON[_0x42f5('0x11')](_0x70b1da));_0x32c21a(_0x70b1da);})[_0x42f5('0x16')](function(_0x4f4286){logger[_0x42f5('0x12')](_0x42f5('0x17'),_0x4f4286[_0x42f5('0x14')],_0x59feb3);_0x34dd2b(_0x5a85bd[_0x42f5('0x12')](0x1f4,_0x4f4286[_0x42f5('0x14')]));});});};exports[_0x42f5('0x1d')]=function(_0x2be155){var _0x1c86fc=this;return new Promise(function(_0x3761c1,_0x19dd26){return db[_0x42f5('0x18')][_0x42f5('0x1e')](_0x2be155[_0x42f5('0x1a')],{'raw':_0x2be155[_0x42f5('0x1b')]?_0x2be155['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2be155[_0x42f5('0x1b')]?_0x2be155['options'][_0x42f5('0x1f')]||null:null,'attributes':_0x2be155[_0x42f5('0x1b')]?_0x2be155[_0x42f5('0x1b')]['attributes']||null:null,'limit':_0x2be155[_0x42f5('0x1b')]?_0x2be155[_0x42f5('0x1b')][_0x42f5('0x20')]||null:null})[_0x42f5('0xc')](function(_0x6b4ced){logger[_0x42f5('0xd')](_0x42f5('0x1d'),_0x2be155);logger[_0x42f5('0x10')](_0x42f5('0x1d'),_0x2be155,JSON[_0x42f5('0x11')](_0x6b4ced));_0x3761c1(_0x6b4ced);})['catch'](function(_0x484067){logger[_0x42f5('0x12')]('UpdateFaxQueueReport',_0x484067['message'],_0x2be155);_0x19dd26(_0x1c86fc[_0x42f5('0x12')](0x1f4,_0x484067[_0x42f5('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 89d4870..4f22c82 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 _0xda7b=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./faxQueueReport.controller','get','isAuthenticated','index','describe','show','post','/:id','destroy'];(function(_0x623ba0,_0x54601b){var _0x55c115=function(_0xfeb9b8){while(--_0xfeb9b8){_0x623ba0['push'](_0x623ba0['shift']());}};_0x55c115(++_0x54601b);}(_0xda7b,0x191));var _0xbda7=function(_0x41cd5a,_0x591467){_0x41cd5a=_0x41cd5a-0x0;var _0x264696=_0xda7b[_0x41cd5a];return _0x264696;};'use strict';var multer=require('multer');var util=require(_0xbda7('0x0'));var path=require(_0xbda7('0x1'));var timeout=require(_0xbda7('0x2'));var express=require('express');var router=express[_0xbda7('0x3')]();var fs_extra=require(_0xbda7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xbda7('0x5'));var config=require('../../config/environment');var controller=require(_0xbda7('0x6'));router[_0xbda7('0x7')]('/',auth[_0xbda7('0x8')](),controller[_0xbda7('0x9')]);router['get']('/describe',auth[_0xbda7('0x8')](),controller[_0xbda7('0xa')]);router[_0xbda7('0x7')]('/:id',auth[_0xbda7('0x8')](),controller[_0xbda7('0xb')]);router[_0xbda7('0xc')]('/',auth[_0xbda7('0x8')](),controller['create']);router['put'](_0xbda7('0xd'),auth[_0xbda7('0x8')](),controller['update']);router['delete'](_0xbda7('0xd'),auth[_0xbda7('0x8')](),controller[_0xbda7('0xe')]);module[_0xbda7('0xf')]=router; \ No newline at end of file +var _0x47c6=['destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./faxQueueReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','put','/:id','delete'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x47c6,0xb5));var _0x647c=function(_0x1630f1,_0x2eba83){_0x1630f1=_0x1630f1-0x0;var _0x1531e6=_0x47c6[_0x1630f1];return _0x1531e6;};'use strict';var multer=require(_0x647c('0x0'));var util=require(_0x647c('0x1'));var path=require(_0x647c('0x2'));var timeout=require(_0x647c('0x3'));var express=require('express');var router=express[_0x647c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x647c('0x5'));var interaction=require(_0x647c('0x6'));var config=require('../../config/environment');var controller=require(_0x647c('0x7'));router[_0x647c('0x8')]('/',auth['isAuthenticated'](),controller[_0x647c('0x9')]);router[_0x647c('0x8')](_0x647c('0xa'),auth[_0x647c('0xb')](),controller[_0x647c('0xc')]);router[_0x647c('0x8')]('/:id',auth[_0x647c('0xb')](),controller[_0x647c('0xd')]);router[_0x647c('0xe')]('/',auth[_0x647c('0xb')](),controller[_0x647c('0xf')]);router[_0x647c('0x10')](_0x647c('0x11'),auth[_0x647c('0xb')](),controller['update']);router[_0x647c('0x12')](_0x647c('0x11'),auth['isAuthenticated'](),controller[_0x647c('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index ed7e488..b4f7923 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 _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x335f5c,_0xce622c){var _0x27458c=function(_0x108b7f){while(--_0x108b7f){_0x335f5c['push'](_0x335f5c['shift']());}};_0x27458c(++_0xce622c);}(_0x9c44,0x178));var _0x49c4=function(_0x422905,_0x3bce3a){_0x422905=_0x422905-0x0;var _0x33dc6c=_0x9c44[_0x422905];return _0x33dc6c;};'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 _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x29fcaf,_0x20c943){var _0x4adcb2=function(_0x59e82a){while(--_0x59e82a){_0x29fcaf['push'](_0x29fcaf['shift']());}};_0x4adcb2(++_0x20c943);}(_0x54ef,0x112));var _0xf54e=function(_0x335627,_0x24face){_0x335627=_0x335627-0x0;var _0x4c0082=_0x54ef[_0x335627];return _0x4c0082;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 321689e..6362963 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 _0x4d85=['hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','fields','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','sendStatus','stack','name','send','index','map','FaxTransferReport','rawAttributes','key','query','keys','filters','intersection','model','attributes'];(function(_0x43d47b,_0x5e96d2){var _0x1d20a0=function(_0x5af880){while(--_0x5af880){_0x43d47b['push'](_0x43d47b['shift']());}};_0x1d20a0(++_0x5e96d2);}(_0x4d85,0x1cb));var _0x54d8=function(_0x136087,_0x34881c){_0x136087=_0x136087-0x0;var _0x2e750f=_0x4d85[_0x136087];return _0x2e750f;};'use strict';var emlformat=require(_0x54d8('0x0'));var rimraf=require(_0x54d8('0x1'));var zipdir=require(_0x54d8('0x2'));var jsonpatch=require(_0x54d8('0x3'));var rp=require('request-promise');var moment=require(_0x54d8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x54d8('0x5'));var util=require(_0x54d8('0x6'));var path=require(_0x54d8('0x7'));var sox=require(_0x54d8('0x8'));var csv=require(_0x54d8('0x9'));var ejs=require(_0x54d8('0xa'));var fs=require('fs');var fs_extra=require(_0x54d8('0xb'));var _=require(_0x54d8('0xc'));var squel=require(_0x54d8('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x54d8('0x9'));var querystring=require(_0x54d8('0xe'));var Papa=require(_0x54d8('0xf'));var Redis=require('ioredis');var authService=require(_0x54d8('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54d8('0x11'));var logger=require(_0x54d8('0x12'))(_0x54d8('0x13'));var utils=require(_0x54d8('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x54d8('0x15'));var db=require(_0x54d8('0x16'))['db'];function respondWithStatusCode(_0x3ebffe,_0x42af84){_0x42af84=_0x42af84||0xcc;return function(_0x536292){if(_0x536292){return _0x3ebffe['sendStatus'](_0x42af84);}return _0x3ebffe[_0x54d8('0x17')](_0x42af84)[_0x54d8('0x18')]();};}function respondWithResult(_0x5d4b72,_0x1b762d){_0x1b762d=_0x1b762d||0xc8;return function(_0x882796){if(_0x882796){return _0x5d4b72[_0x54d8('0x17')](_0x1b762d)[_0x54d8('0x19')](_0x882796);}};}function respondWithFilteredResult(_0x2f5062,_0x45cd0d){return function(_0x3b819e){if(_0x3b819e){var _0x468a5a=typeof _0x45cd0d[_0x54d8('0x1a')]==='undefined'&&typeof _0x45cd0d[_0x54d8('0x1b')]===_0x54d8('0x1c');var _0x34fd4d=_0x3b819e[_0x54d8('0x1d')];var _0x284cfa=_0x468a5a?0x0:_0x45cd0d[_0x54d8('0x1a')];var _0x29cbbf=_0x468a5a?_0x3b819e[_0x54d8('0x1d')]:_0x45cd0d[_0x54d8('0x1a')]+_0x45cd0d[_0x54d8('0x1b')];var _0x1f4232;if(_0x29cbbf>=_0x34fd4d){_0x29cbbf=_0x34fd4d;_0x1f4232=0xc8;}else{_0x1f4232=0xce;}_0x2f5062[_0x54d8('0x17')](_0x1f4232);return _0x2f5062[_0x54d8('0x1e')](_0x54d8('0x1f'),_0x284cfa+'-'+_0x29cbbf+'/'+_0x34fd4d)[_0x54d8('0x19')](_0x3b819e);}return null;};}function patchUpdates(_0x57d284){return function(_0x412f8a){try{jsonpatch[_0x54d8('0x20')](_0x412f8a,_0x57d284,!![]);}catch(_0x1bf3eb){return BPromise[_0x54d8('0x21')](_0x1bf3eb);}return _0x412f8a['save']();};}function saveUpdates(_0x546880,_0x70f7e1){return function(_0x3f25cb){if(_0x3f25cb){return _0x3f25cb[_0x54d8('0x22')](_0x546880)[_0x54d8('0x23')](function(_0x454756){return _0x454756;});}return null;};}function removeEntity(_0x4f94f8,_0x3350ff){return function(_0x2a3a67){if(_0x2a3a67){return _0x2a3a67[_0x54d8('0x24')]()['then'](function(){_0x4f94f8['status'](0xcc)[_0x54d8('0x18')]();});}};}function handleEntityNotFound(_0x28fe5e,_0x237fd3){return function(_0x260ed7){if(!_0x260ed7){_0x28fe5e[_0x54d8('0x25')](0x194);}return _0x260ed7;};}function handleError(_0x342822,_0x3dea23){_0x3dea23=_0x3dea23||0x1f4;return function(_0x3a11fa){logger['error'](_0x3a11fa[_0x54d8('0x26')]);if(_0x3a11fa['name']){delete _0x3a11fa[_0x54d8('0x27')];}_0x342822[_0x54d8('0x17')](_0x3dea23)[_0x54d8('0x28')](_0x3a11fa);};}exports[_0x54d8('0x29')]=function(_0x5bdb47,_0xaccc80){var _0x172205={},_0xb1dbb7={},_0x1f9cba={'count':0x0,'rows':[]};var _0x1b0cd3=_[_0x54d8('0x2a')](db[_0x54d8('0x2b')][_0x54d8('0x2c')],function(_0x8c7ee5){return{'name':_0x8c7ee5['fieldName'],'type':_0x8c7ee5['type'][_0x54d8('0x2d')]};});_0xb1dbb7['model']=_[_0x54d8('0x2a')](_0x1b0cd3,'name');_0xb1dbb7[_0x54d8('0x2e')]=_[_0x54d8('0x2f')](_0x5bdb47['query']);_0xb1dbb7[_0x54d8('0x30')]=_[_0x54d8('0x31')](_0xb1dbb7[_0x54d8('0x32')],_0xb1dbb7['query']);_0x172205['attributes']=_['intersection'](_0xb1dbb7[_0x54d8('0x32')],qs['fields'](_0x5bdb47[_0x54d8('0x2e')]['fields']));_0x172205[_0x54d8('0x33')]=_0x172205[_0x54d8('0x33')]['length']?_0x172205[_0x54d8('0x33')]:_0xb1dbb7[_0x54d8('0x32')];if(!_0x5bdb47[_0x54d8('0x2e')][_0x54d8('0x34')]('nolimit')){_0x172205[_0x54d8('0x1b')]=qs[_0x54d8('0x1b')](_0x5bdb47[_0x54d8('0x2e')][_0x54d8('0x1b')]);_0x172205[_0x54d8('0x1a')]=qs[_0x54d8('0x1a')](_0x5bdb47[_0x54d8('0x2e')][_0x54d8('0x1a')]);}_0x172205[_0x54d8('0x35')]=qs[_0x54d8('0x36')](_0x5bdb47[_0x54d8('0x2e')]['sort']);_0x172205[_0x54d8('0x37')]=qs[_0x54d8('0x30')](_[_0x54d8('0x38')](_0x5bdb47[_0x54d8('0x2e')],_0xb1dbb7[_0x54d8('0x30')]),_0x1b0cd3);if(_0x5bdb47[_0x54d8('0x2e')][_0x54d8('0x39')]){_0x172205[_0x54d8('0x37')]=_[_0x54d8('0x3a')](_0x172205[_0x54d8('0x37')],{'$or':_[_0x54d8('0x2a')](_0x1b0cd3,function(_0x2953b3){if(_0x2953b3[_0x54d8('0x3b')]!==_0x54d8('0x3c')){var _0x44100d={};_0x44100d[_0x2953b3[_0x54d8('0x27')]]={'$like':'%'+_0x5bdb47[_0x54d8('0x2e')][_0x54d8('0x39')]+'%'};return _0x44100d;}})});}_0x172205=_[_0x54d8('0x3a')]({},_0x172205,_0x5bdb47[_0x54d8('0x3d')]);var _0x2adafd={'where':_0x172205[_0x54d8('0x37')]};return db[_0x54d8('0x2b')]['count'](_0x2adafd)['then'](function(_0x43c51a){_0x1f9cba[_0x54d8('0x1d')]=_0x43c51a;if(_0x5bdb47['query'][_0x54d8('0x3e')]){_0x172205[_0x54d8('0x3f')]=[{'all':!![]}];}return db[_0x54d8('0x2b')][_0x54d8('0x40')](_0x172205);})[_0x54d8('0x23')](function(_0x323192){_0x1f9cba[_0x54d8('0x41')]=_0x323192;return _0x1f9cba;})[_0x54d8('0x23')](respondWithFilteredResult(_0xaccc80,_0x172205))[_0x54d8('0x42')](handleError(_0xaccc80,null));};exports['show']=function(_0x1617a9,_0x3b6f84){var _0x1e02c3={'raw':!![],'where':{'id':_0x1617a9['params']['id']}},_0x1c9d6f={};_0x1c9d6f[_0x54d8('0x32')]=_[_0x54d8('0x2f')](db['FaxTransferReport'][_0x54d8('0x2c')]);_0x1c9d6f[_0x54d8('0x2e')]=_[_0x54d8('0x2f')](_0x1617a9[_0x54d8('0x2e')]);_0x1c9d6f['filters']=_[_0x54d8('0x31')](_0x1c9d6f[_0x54d8('0x32')],_0x1c9d6f[_0x54d8('0x2e')]);_0x1e02c3[_0x54d8('0x33')]=_[_0x54d8('0x31')](_0x1c9d6f[_0x54d8('0x32')],qs[_0x54d8('0x43')](_0x1617a9[_0x54d8('0x2e')][_0x54d8('0x43')]));_0x1e02c3[_0x54d8('0x33')]=_0x1e02c3[_0x54d8('0x33')]['length']?_0x1e02c3['attributes']:_0x1c9d6f[_0x54d8('0x32')];if(_0x1617a9[_0x54d8('0x2e')]['includeAll']){_0x1e02c3[_0x54d8('0x3f')]=[{'all':!![]}];}_0x1e02c3=_[_0x54d8('0x3a')]({},_0x1e02c3,_0x1617a9['options']);return db['FaxTransferReport'][_0x54d8('0x44')](_0x1e02c3)[_0x54d8('0x23')](handleEntityNotFound(_0x3b6f84,null))[_0x54d8('0x23')](respondWithResult(_0x3b6f84,null))[_0x54d8('0x42')](handleError(_0x3b6f84,null));};exports[_0x54d8('0x45')]=function(_0x529fe5,_0x9be070){return db[_0x54d8('0x2b')][_0x54d8('0x45')](_0x529fe5['body'],{})[_0x54d8('0x23')](respondWithResult(_0x9be070,0xc9))[_0x54d8('0x42')](handleError(_0x9be070,null));};exports[_0x54d8('0x22')]=function(_0x40b06a,_0x2ddbba){if(_0x40b06a[_0x54d8('0x46')]['id']){delete _0x40b06a[_0x54d8('0x46')]['id'];}return db[_0x54d8('0x2b')][_0x54d8('0x44')]({'where':{'id':_0x40b06a[_0x54d8('0x47')]['id']}})['then'](handleEntityNotFound(_0x2ddbba,null))[_0x54d8('0x23')](saveUpdates(_0x40b06a[_0x54d8('0x46')],null))[_0x54d8('0x23')](respondWithResult(_0x2ddbba,null))['catch'](handleError(_0x2ddbba,null));};exports[_0x54d8('0x24')]=function(_0x191c12,_0x25c983){return db['FaxTransferReport']['find']({'where':{'id':_0x191c12['params']['id']}})['then'](handleEntityNotFound(_0x25c983,null))[_0x54d8('0x23')](removeEntity(_0x25c983,null))['catch'](handleError(_0x25c983,null));};exports[_0x54d8('0x48')]=function(_0xee5558,_0x4a326d){return db[_0x54d8('0x2b')][_0x54d8('0x48')]()['then'](respondWithResult(_0x4a326d,null))[_0x54d8('0x42')](handleError(_0x4a326d,null));}; \ No newline at end of file +var _0xbd94=['type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','create','body','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','send','index','map','FaxTransferReport','rawAttributes','fieldName'];(function(_0x2f3b82,_0x368cc2){var _0x52139d=function(_0x35ebf1){while(--_0x35ebf1){_0x2f3b82['push'](_0x2f3b82['shift']());}};_0x52139d(++_0x368cc2);}(_0xbd94,0x1d3));var _0x4bd9=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0xbd94[_0x39096d];return _0x13da4f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4bd9('0x0'));var zipdir=require(_0x4bd9('0x1'));var jsonpatch=require(_0x4bd9('0x2'));var rp=require(_0x4bd9('0x3'));var moment=require('moment');var BPromise=require(_0x4bd9('0x4'));var Mustache=require(_0x4bd9('0x5'));var util=require(_0x4bd9('0x6'));var path=require('path');var sox=require(_0x4bd9('0x7'));var csv=require(_0x4bd9('0x8'));var ejs=require(_0x4bd9('0x9'));var fs=require('fs');var fs_extra=require(_0x4bd9('0xa'));var _=require('lodash');var squel=require(_0x4bd9('0xb'));var crypto=require('crypto');var jsforce=require(_0x4bd9('0xc'));var deskjs=require(_0x4bd9('0xd'));var toCsv=require(_0x4bd9('0x8'));var querystring=require(_0x4bd9('0xe'));var Papa=require('papaparse');var Redis=require(_0x4bd9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4bd9('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4bd9('0x11'))('api');var utils=require(_0x4bd9('0x12'));var config=require(_0x4bd9('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x4bd9('0x14'))['db'];function respondWithStatusCode(_0x2cc3ea,_0x8633b){_0x8633b=_0x8633b||0xcc;return function(_0x5c878a){if(_0x5c878a){return _0x2cc3ea[_0x4bd9('0x15')](_0x8633b);}return _0x2cc3ea[_0x4bd9('0x16')](_0x8633b)[_0x4bd9('0x17')]();};}function respondWithResult(_0x2ae61e,_0x62bc9a){_0x62bc9a=_0x62bc9a||0xc8;return function(_0x4628d2){if(_0x4628d2){return _0x2ae61e['status'](_0x62bc9a)[_0x4bd9('0x18')](_0x4628d2);}};}function respondWithFilteredResult(_0x3cc512,_0xe7a236){return function(_0x839efb){if(_0x839efb){var _0x75d268=typeof _0xe7a236[_0x4bd9('0x19')]===_0x4bd9('0x1a')&&typeof _0xe7a236[_0x4bd9('0x1b')]===_0x4bd9('0x1a');var _0x404bc6=_0x839efb[_0x4bd9('0x1c')];var _0x2999bf=_0x75d268?0x0:_0xe7a236[_0x4bd9('0x19')];var _0x475174=_0x75d268?_0x839efb[_0x4bd9('0x1c')]:_0xe7a236['offset']+_0xe7a236[_0x4bd9('0x1b')];var _0xf746b1;if(_0x475174>=_0x404bc6){_0x475174=_0x404bc6;_0xf746b1=0xc8;}else{_0xf746b1=0xce;}_0x3cc512[_0x4bd9('0x16')](_0xf746b1);return _0x3cc512[_0x4bd9('0x1d')](_0x4bd9('0x1e'),_0x2999bf+'-'+_0x475174+'/'+_0x404bc6)[_0x4bd9('0x18')](_0x839efb);}return null;};}function patchUpdates(_0x47149b){return function(_0x5ab13b){try{jsonpatch[_0x4bd9('0x1f')](_0x5ab13b,_0x47149b,!![]);}catch(_0x36c634){return BPromise[_0x4bd9('0x20')](_0x36c634);}return _0x5ab13b['save']();};}function saveUpdates(_0x53b803,_0x2cb947){return function(_0x5ab731){if(_0x5ab731){return _0x5ab731[_0x4bd9('0x21')](_0x53b803)[_0x4bd9('0x22')](function(_0x22ef4d){return _0x22ef4d;});}return null;};}function removeEntity(_0x3c46d4,_0x2fb544){return function(_0x338e58){if(_0x338e58){return _0x338e58[_0x4bd9('0x23')]()[_0x4bd9('0x22')](function(){_0x3c46d4[_0x4bd9('0x16')](0xcc)[_0x4bd9('0x17')]();});}};}function handleEntityNotFound(_0x4e5f08,_0x3b13e0){return function(_0x32ecd4){if(!_0x32ecd4){_0x4e5f08[_0x4bd9('0x15')](0x194);}return _0x32ecd4;};}function handleError(_0x18eeaa,_0x42f02c){_0x42f02c=_0x42f02c||0x1f4;return function(_0x2e1a35){logger[_0x4bd9('0x24')](_0x2e1a35[_0x4bd9('0x25')]);if(_0x2e1a35['name']){delete _0x2e1a35['name'];}_0x18eeaa[_0x4bd9('0x16')](_0x42f02c)[_0x4bd9('0x26')](_0x2e1a35);};}exports[_0x4bd9('0x27')]=function(_0x131aa6,_0xcf7464){var _0x3c9326={},_0x10d1b2={},_0x5ec02c={'count':0x0,'rows':[]};var _0xe8a5bb=_[_0x4bd9('0x28')](db[_0x4bd9('0x29')][_0x4bd9('0x2a')],function(_0x291554){return{'name':_0x291554[_0x4bd9('0x2b')],'type':_0x291554[_0x4bd9('0x2c')]['key']};});_0x10d1b2[_0x4bd9('0x2d')]=_[_0x4bd9('0x28')](_0xe8a5bb,_0x4bd9('0x2e'));_0x10d1b2[_0x4bd9('0x2f')]=_[_0x4bd9('0x30')](_0x131aa6['query']);_0x10d1b2[_0x4bd9('0x31')]=_[_0x4bd9('0x32')](_0x10d1b2[_0x4bd9('0x2d')],_0x10d1b2[_0x4bd9('0x2f')]);_0x3c9326[_0x4bd9('0x33')]=_[_0x4bd9('0x32')](_0x10d1b2[_0x4bd9('0x2d')],qs[_0x4bd9('0x34')](_0x131aa6['query']['fields']));_0x3c9326['attributes']=_0x3c9326[_0x4bd9('0x33')][_0x4bd9('0x35')]?_0x3c9326[_0x4bd9('0x33')]:_0x10d1b2['model'];if(!_0x131aa6[_0x4bd9('0x2f')][_0x4bd9('0x36')](_0x4bd9('0x37'))){_0x3c9326['limit']=qs[_0x4bd9('0x1b')](_0x131aa6[_0x4bd9('0x2f')][_0x4bd9('0x1b')]);_0x3c9326[_0x4bd9('0x19')]=qs[_0x4bd9('0x19')](_0x131aa6['query']['offset']);}_0x3c9326[_0x4bd9('0x38')]=qs[_0x4bd9('0x39')](_0x131aa6[_0x4bd9('0x2f')]['sort']);_0x3c9326[_0x4bd9('0x3a')]=qs[_0x4bd9('0x31')](_[_0x4bd9('0x3b')](_0x131aa6[_0x4bd9('0x2f')],_0x10d1b2[_0x4bd9('0x31')]),_0xe8a5bb);if(_0x131aa6[_0x4bd9('0x2f')][_0x4bd9('0x3c')]){_0x3c9326[_0x4bd9('0x3a')]=_[_0x4bd9('0x3d')](_0x3c9326[_0x4bd9('0x3a')],{'$or':_[_0x4bd9('0x28')](_0xe8a5bb,function(_0x2d0bee){if(_0x2d0bee[_0x4bd9('0x2c')]!==_0x4bd9('0x3e')){var _0x5613be={};_0x5613be[_0x2d0bee[_0x4bd9('0x2e')]]={'$like':'%'+_0x131aa6[_0x4bd9('0x2f')]['filter']+'%'};return _0x5613be;}})});}_0x3c9326=_[_0x4bd9('0x3d')]({},_0x3c9326,_0x131aa6[_0x4bd9('0x3f')]);var _0x31b58e={'where':_0x3c9326[_0x4bd9('0x3a')]};return db[_0x4bd9('0x29')][_0x4bd9('0x1c')](_0x31b58e)[_0x4bd9('0x22')](function(_0x36d772){_0x5ec02c[_0x4bd9('0x1c')]=_0x36d772;if(_0x131aa6['query'][_0x4bd9('0x40')]){_0x3c9326[_0x4bd9('0x41')]=[{'all':!![]}];}return db[_0x4bd9('0x29')]['findAll'](_0x3c9326);})[_0x4bd9('0x22')](function(_0x4dcac5){_0x5ec02c[_0x4bd9('0x42')]=_0x4dcac5;return _0x5ec02c;})[_0x4bd9('0x22')](respondWithFilteredResult(_0xcf7464,_0x3c9326))[_0x4bd9('0x43')](handleError(_0xcf7464,null));};exports['show']=function(_0x54fad4,_0xbb473d){var _0x2d6422={'raw':!![],'where':{'id':_0x54fad4['params']['id']}},_0x24c664={};_0x24c664['model']=_[_0x4bd9('0x30')](db[_0x4bd9('0x29')][_0x4bd9('0x2a')]);_0x24c664['query']=_[_0x4bd9('0x30')](_0x54fad4[_0x4bd9('0x2f')]);_0x24c664['filters']=_[_0x4bd9('0x32')](_0x24c664[_0x4bd9('0x2d')],_0x24c664[_0x4bd9('0x2f')]);_0x2d6422[_0x4bd9('0x33')]=_[_0x4bd9('0x32')](_0x24c664[_0x4bd9('0x2d')],qs[_0x4bd9('0x34')](_0x54fad4[_0x4bd9('0x2f')][_0x4bd9('0x34')]));_0x2d6422[_0x4bd9('0x33')]=_0x2d6422['attributes']['length']?_0x2d6422['attributes']:_0x24c664[_0x4bd9('0x2d')];if(_0x54fad4[_0x4bd9('0x2f')]['includeAll']){_0x2d6422[_0x4bd9('0x41')]=[{'all':!![]}];}_0x2d6422=_[_0x4bd9('0x3d')]({},_0x2d6422,_0x54fad4[_0x4bd9('0x3f')]);return db[_0x4bd9('0x29')]['find'](_0x2d6422)[_0x4bd9('0x22')](handleEntityNotFound(_0xbb473d,null))[_0x4bd9('0x22')](respondWithResult(_0xbb473d,null))[_0x4bd9('0x43')](handleError(_0xbb473d,null));};exports[_0x4bd9('0x44')]=function(_0x199f95,_0x3e610a){return db[_0x4bd9('0x29')][_0x4bd9('0x44')](_0x199f95[_0x4bd9('0x45')],{})['then'](respondWithResult(_0x3e610a,0xc9))[_0x4bd9('0x43')](handleError(_0x3e610a,null));};exports[_0x4bd9('0x21')]=function(_0x2ec46d,_0x4a791d){if(_0x2ec46d[_0x4bd9('0x45')]['id']){delete _0x2ec46d[_0x4bd9('0x45')]['id'];}return db['FaxTransferReport'][_0x4bd9('0x46')]({'where':{'id':_0x2ec46d['params']['id']}})[_0x4bd9('0x22')](handleEntityNotFound(_0x4a791d,null))[_0x4bd9('0x22')](saveUpdates(_0x2ec46d['body'],null))[_0x4bd9('0x22')](respondWithResult(_0x4a791d,null))[_0x4bd9('0x43')](handleError(_0x4a791d,null));};exports[_0x4bd9('0x23')]=function(_0x20063c,_0x5f0a15){return db['FaxTransferReport'][_0x4bd9('0x46')]({'where':{'id':_0x20063c[_0x4bd9('0x47')]['id']}})[_0x4bd9('0x22')](handleEntityNotFound(_0x5f0a15,null))[_0x4bd9('0x22')](removeEntity(_0x5f0a15,null))[_0x4bd9('0x43')](handleError(_0x5f0a15,null));};exports[_0x4bd9('0x48')]=function(_0x1db535,_0xd83e89){return db['FaxTransferReport'][_0x4bd9('0x48')]()['then'](respondWithResult(_0xd83e89,null))[_0x4bd9('0x43')](handleError(_0xd83e89,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 9d7fa80..392c0fb 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 _0x9f08=['util','../../config/logger','api','moment','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid','lodash'];(function(_0x46361e,_0x243aaf){var _0x14e302=function(_0x9ebecf){while(--_0x9ebecf){_0x46361e['push'](_0x46361e['shift']());}};_0x14e302(++_0x243aaf);}(_0x9f08,0x8f));var _0x89f0=function(_0x2a6551,_0x1f6f40){_0x2a6551=_0x2a6551-0x0;var _0x58df1d=_0x9f08[_0x2a6551];return _0x58df1d;};'use strict';var _=require(_0x89f0('0x0'));var util=require(_0x89f0('0x1'));var logger=require(_0x89f0('0x2'))(_0x89f0('0x3'));var moment=require(_0x89f0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x89f0('0x5'));var attributes=require(_0x89f0('0x6'));module[_0x89f0('0x7')]=function(_0x43ab31,_0x33e629){return _0x43ab31[_0x89f0('0x8')](_0x89f0('0x9'),attributes,{'tableName':_0x89f0('0xa'),'paranoid':![],'indexes':[{'name':_0x89f0('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb44f=['util','api','moment','bluebird','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','uniqueid','lodash'];(function(_0x263d88,_0x5cd913){var _0x212585=function(_0x2dccc4){while(--_0x2dccc4){_0x263d88['push'](_0x263d88['shift']());}};_0x212585(++_0x5cd913);}(_0xb44f,0xe3));var _0xfb44=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb44f[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xfb44('0x0'));var util=require(_0xfb44('0x1'));var logger=require('../../config/logger')(_0xfb44('0x2'));var moment=require(_0xfb44('0x3'));var BPromise=require(_0xfb44('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfb44('0x5'));var config=require(_0xfb44('0x6'));var attributes=require(_0xfb44('0x7'));module[_0xfb44('0x8')]=function(_0x1d2e44,_0x45c1e4){return _0x1d2e44[_0xfb44('0x9')](_0xfb44('0xa'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xfb44('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 30f86ee..ddf97ff 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 _0x1651=['code','FaxTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x33576b,_0x411759){var _0x199404=function(_0x416d80){while(--_0x416d80){_0x33576b['push'](_0x33576b['shift']());}};_0x199404(++_0x411759);}(_0x1651,0x191));var _0x1165=function(_0x277f59,_0x4aba20){_0x277f59=_0x277f59-0x0;var _0x494adf=_0x1651[_0x277f59];return _0x494adf;};'use strict';var _=require(_0x1165('0x0'));var util=require(_0x1165('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1165('0x2'));var fs=require('fs');var Redis=require(_0x1165('0x3'));var db=require(_0x1165('0x4'))['db'];var utils=require(_0x1165('0x5'));var logger=require(_0x1165('0x6'))(_0x1165('0x7'));var config=require(_0x1165('0x8'));var jayson=require(_0x1165('0x9'));var client=jayson[_0x1165('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3374cc,_0x17a4af,_0x23f998){return new BPromise(function(_0x38cfa0,_0x4b479a){return client['request'](_0x3374cc,_0x23f998)[_0x1165('0xb')](function(_0x51de4e){logger[_0x1165('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x17a4af,_0x1165('0xd'));logger['debug'](_0x1165('0xe'),_0x17a4af,'request\x20sent',JSON[_0x1165('0xf')](_0x51de4e));if(_0x51de4e['error']){if(_0x51de4e[_0x1165('0x10')][_0x1165('0x11')]===0x1f4){logger[_0x1165('0x10')](_0x1165('0x12'),_0x17a4af,_0x51de4e['error'][_0x1165('0x13')]);return _0x4b479a(_0x51de4e[_0x1165('0x10')][_0x1165('0x13')]);}logger[_0x1165('0x10')](_0x1165('0x12'),_0x17a4af,_0x51de4e[_0x1165('0x10')][_0x1165('0x13')]);return _0x38cfa0(_0x51de4e[_0x1165('0x10')][_0x1165('0x13')]);}else{logger['info']('FaxTransferReport,\x20%s,\x20%s',_0x17a4af,_0x1165('0xd'));_0x38cfa0(_0x51de4e[_0x1165('0x14')][_0x1165('0x13')]);}})[_0x1165('0x15')](function(_0x1b6f1c){logger[_0x1165('0x10')]('FaxTransferReport,\x20%s,\x20%s',_0x17a4af,_0x1b6f1c);_0x4b479a(_0x1b6f1c);});});} \ No newline at end of file +var _0x5bc9=['moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util'];(function(_0x361399,_0x1d48e4){var _0x542f74=function(_0x4b03df){while(--_0x4b03df){_0x361399['push'](_0x361399['shift']());}};_0x542f74(++_0x1d48e4);}(_0x5bc9,0x12a));var _0x95bc=function(_0x2466cd,_0x34974d){_0x2466cd=_0x2466cd-0x0;var _0x42a025=_0x5bc9[_0x2466cd];return _0x42a025;};'use strict';var _=require(_0x95bc('0x0'));var util=require(_0x95bc('0x1'));var moment=require(_0x95bc('0x2'));var BPromise=require(_0x95bc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x95bc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x95bc('0x5'))(_0x95bc('0x6'));var config=require(_0x95bc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x95bc('0x8')][_0x95bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4eeefb,_0x2f85e7,_0xee502e){return new BPromise(function(_0x31bb9c,_0x593fbc){return client[_0x95bc('0xa')](_0x4eeefb,_0xee502e)['then'](function(_0x456eb7){logger[_0x95bc('0xb')](_0x95bc('0xc'),_0x2f85e7,_0x95bc('0xd'));logger[_0x95bc('0xe')](_0x95bc('0xf'),_0x2f85e7,'request\x20sent',JSON[_0x95bc('0x10')](_0x456eb7));if(_0x456eb7[_0x95bc('0x11')]){if(_0x456eb7['error'][_0x95bc('0x12')]===0x1f4){logger[_0x95bc('0x11')](_0x95bc('0xc'),_0x2f85e7,_0x456eb7[_0x95bc('0x11')][_0x95bc('0x13')]);return _0x593fbc(_0x456eb7['error']['message']);}logger[_0x95bc('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x2f85e7,_0x456eb7[_0x95bc('0x11')][_0x95bc('0x13')]);return _0x31bb9c(_0x456eb7[_0x95bc('0x11')]['message']);}else{logger[_0x95bc('0xb')](_0x95bc('0xc'),_0x2f85e7,_0x95bc('0xd'));_0x31bb9c(_0x456eb7['result'][_0x95bc('0x13')]);}})['catch'](function(_0x1f23a9){logger[_0x95bc('0x11')]('FaxTransferReport,\x20%s,\x20%s',_0x2f85e7,_0x1f23a9);_0x593fbc(_0x1f23a9);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index c9bc8ec..762e2db 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 _0x38df=['get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','express','../../config/environment','./faxTransferReport.controller'];(function(_0x335348,_0x3f5544){var _0x188b9b=function(_0x50dfe7){while(--_0x50dfe7){_0x335348['push'](_0x335348['shift']());}};_0x188b9b(++_0x3f5544);}(_0x38df,0x1e1));var _0xf38d=function(_0x3ddbc4,_0xe5be24){_0x3ddbc4=_0x3ddbc4-0x0;var _0x4f51ff=_0x38df[_0x3ddbc4];return _0x4f51ff;};'use strict';var multer=require(_0xf38d('0x0'));var util=require(_0xf38d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf38d('0x2'));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(_0xf38d('0x3'));var controller=require(_0xf38d('0x4'));router[_0xf38d('0x5')]('/',auth['isAuthenticated'](),controller[_0xf38d('0x6')]);router[_0xf38d('0x5')](_0xf38d('0x7'),auth[_0xf38d('0x8')](),controller[_0xf38d('0x9')]);router[_0xf38d('0x5')](_0xf38d('0xa'),auth[_0xf38d('0x8')](),controller[_0xf38d('0xb')]);router[_0xf38d('0xc')]('/',auth[_0xf38d('0x8')](),controller[_0xf38d('0xd')]);router[_0xf38d('0xe')](_0xf38d('0xa'),auth[_0xf38d('0x8')](),controller['update']);router[_0xf38d('0xf')](_0xf38d('0xa'),auth[_0xf38d('0x8')](),controller[_0xf38d('0x10')]);module[_0xf38d('0x11')]=router; \ No newline at end of file +var _0x6b2b=['express','Router','fs-extra','../../components/auth/service','./faxTransferReport.controller','get','/describe','isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','multer','util','path','connect-timeout'];(function(_0x476c7,_0x298ee0){var _0x47ae56=function(_0x4acf5a){while(--_0x4acf5a){_0x476c7['push'](_0x476c7['shift']());}};_0x47ae56(++_0x298ee0);}(_0x6b2b,0x178));var _0xb6b2=function(_0x3740fe,_0x6c543c){_0x3740fe=_0x3740fe-0x0;var _0x55492b=_0x6b2b[_0x3740fe];return _0x55492b;};'use strict';var multer=require(_0xb6b2('0x0'));var util=require(_0xb6b2('0x1'));var path=require(_0xb6b2('0x2'));var timeout=require(_0xb6b2('0x3'));var express=require(_0xb6b2('0x4'));var router=express[_0xb6b2('0x5')]();var fs_extra=require(_0xb6b2('0x6'));var auth=require(_0xb6b2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb6b2('0x8'));router[_0xb6b2('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xb6b2('0xa'),auth[_0xb6b2('0xb')](),controller[_0xb6b2('0xc')]);router[_0xb6b2('0x9')](_0xb6b2('0xd'),auth[_0xb6b2('0xb')](),controller[_0xb6b2('0xe')]);router[_0xb6b2('0xf')]('/',auth[_0xb6b2('0xb')](),controller['create']);router[_0xb6b2('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xb6b2('0x11')]);router[_0xb6b2('0x12')](_0xb6b2('0xd'),auth['isAuthenticated'](),controller[_0xb6b2('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index f1a1a68..3eb0bdf 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 _0x2c5e=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./intDeskAccount.controller','get'];(function(_0x40ddc0,_0x41c082){var _0x1aebf1=function(_0x3ba1f6){while(--_0x3ba1f6){_0x40ddc0['push'](_0x40ddc0['shift']());}};_0x1aebf1(++_0x41c082);}(_0x2c5e,0x1ee));var _0xe2c5=function(_0x1499c4,_0x57c5c3){_0x1499c4=_0x1499c4-0x0;var _0x3cf45a=_0x2c5e[_0x1499c4];return _0x3cf45a;};'use strict';var multer=require(_0xe2c5('0x0'));var util=require(_0xe2c5('0x1'));var path=require(_0xe2c5('0x2'));var timeout=require(_0xe2c5('0x3'));var express=require(_0xe2c5('0x4'));var router=express[_0xe2c5('0x5')]();var fs_extra=require(_0xe2c5('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe2c5('0x7'));var config=require('../../config/environment');var controller=require(_0xe2c5('0x8'));router[_0xe2c5('0x9')]('/',auth[_0xe2c5('0xa')](),controller['index']);router[_0xe2c5('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe2c5('0xb')]);router[_0xe2c5('0x9')](_0xe2c5('0xc'),auth[_0xe2c5('0xa')](),controller[_0xe2c5('0xd')]);router[_0xe2c5('0x9')](_0xe2c5('0xe'),auth[_0xe2c5('0xa')](),controller[_0xe2c5('0xf')]);router[_0xe2c5('0x10')]('/',auth['isAuthenticated'](),controller[_0xe2c5('0x11')]);router[_0xe2c5('0x10')](_0xe2c5('0xc'),auth[_0xe2c5('0xa')](),controller[_0xe2c5('0x12')]);router[_0xe2c5('0x13')](_0xe2c5('0x14'),auth[_0xe2c5('0xa')](),controller[_0xe2c5('0x15')]);router[_0xe2c5('0x16')]('/:id',auth[_0xe2c5('0xa')](),controller['destroy']);module[_0xe2c5('0x17')]=router; \ No newline at end of file +var _0xb2f9=['update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','index','/:id','isAuthenticated','get','/:id/configurations','getConfigurations','/:id/fields','getFields','put'];(function(_0x5e5edd,_0x4a5af1){var _0x274a03=function(_0x2b271c){while(--_0x2b271c){_0x5e5edd['push'](_0x5e5edd['shift']());}};_0x274a03(++_0x4a5af1);}(_0xb2f9,0xb6));var _0x9b2f=function(_0x5b6199,_0x303ccc){_0x5b6199=_0x5b6199-0x0;var _0x12853d=_0xb2f9[_0x5b6199];return _0x12853d;};'use strict';var multer=require('multer');var util=require(_0x9b2f('0x0'));var path=require(_0x9b2f('0x1'));var timeout=require(_0x9b2f('0x2'));var express=require(_0x9b2f('0x3'));var router=express[_0x9b2f('0x4')]();var fs_extra=require(_0x9b2f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9b2f('0x6'));var config=require(_0x9b2f('0x7'));var controller=require(_0x9b2f('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x9b2f('0x9')]);router['get'](_0x9b2f('0xa'),auth[_0x9b2f('0xb')](),controller['show']);router[_0x9b2f('0xc')](_0x9b2f('0xd'),auth[_0x9b2f('0xb')](),controller[_0x9b2f('0xe')]);router[_0x9b2f('0xc')](_0x9b2f('0xf'),auth['isAuthenticated'](),controller[_0x9b2f('0x10')]);router['post']('/',auth[_0x9b2f('0xb')](),controller['create']);router['post'](_0x9b2f('0xd'),auth[_0x9b2f('0xb')](),controller['addConfiguration']);router[_0x9b2f('0x11')](_0x9b2f('0xa'),auth[_0x9b2f('0xb')](),controller[_0x9b2f('0x12')]);router[_0x9b2f('0x13')](_0x9b2f('0xa'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 7deea6d..cadaef7 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 _0x9e41=['exports','STRING','ENUM','basic','integrationTab','newTab','sequelize'];(function(_0x250ae1,_0x44b348){var _0x2a5b4a=function(_0x3c3760){while(--_0x3c3760){_0x250ae1['push'](_0x250ae1['shift']());}};_0x2a5b4a(++_0x44b348);}(_0x9e41,0xca));var _0x19e4=function(_0x59f30e,_0x1bba87){_0x59f30e=_0x59f30e-0x0;var _0x300177=_0x9e41[_0x59f30e];return _0x300177;};'use strict';var Sequelize=require(_0x19e4('0x0'));module[_0x19e4('0x1')]={'name':{'type':Sequelize[_0x19e4('0x2')]},'description':{'type':Sequelize[_0x19e4('0x2')]},'username':{'type':Sequelize[_0x19e4('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x19e4('0x3')]('basic'),'defaultValue':_0x19e4('0x4')},'password':{'type':Sequelize[_0x19e4('0x2')]},'consumerKey':{'type':Sequelize[_0x19e4('0x2')]},'consumerSecret':{'type':Sequelize[_0x19e4('0x2')]},'token':{'type':Sequelize[_0x19e4('0x2')]},'tokenSecret':{'type':Sequelize[_0x19e4('0x2')]},'serverUrl':{'type':Sequelize[_0x19e4('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x19e4('0x3')](_0x19e4('0x5'),_0x19e4('0x6')),'defaultValue':_0x19e4('0x5')}}; \ No newline at end of file +var _0xd384=['newTab','sequelize','exports','STRING','ENUM','basic','integrationTab'];(function(_0x32a4b2,_0xf534c7){var _0x2582d5=function(_0x5c21aa){while(--_0x5c21aa){_0x32a4b2['push'](_0x32a4b2['shift']());}};_0x2582d5(++_0xf534c7);}(_0xd384,0x86));var _0x4d38=function(_0x55debd,_0x2c9d19){_0x55debd=_0x55debd-0x0;var _0x569b06=_0xd384[_0x55debd];return _0x569b06;};'use strict';var Sequelize=require(_0x4d38('0x0'));module[_0x4d38('0x1')]={'name':{'type':Sequelize[_0x4d38('0x2')]},'description':{'type':Sequelize[_0x4d38('0x2')]},'username':{'type':Sequelize[_0x4d38('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'authType':{'type':Sequelize[_0x4d38('0x3')]('basic'),'defaultValue':_0x4d38('0x4')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0x4d38('0x2')]},'consumerSecret':{'type':Sequelize[_0x4d38('0x2')]},'token':{'type':Sequelize[_0x4d38('0x2')]},'tokenSecret':{'type':Sequelize[_0x4d38('0x2')]},'serverUrl':{'type':Sequelize[_0x4d38('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4d38('0x3')](_0x4d38('0x5'),_0x4d38('0x6')),'defaultValue':_0x4d38('0x5')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 37b0fd3..156e4e4 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 _0xe8e4=['substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','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','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','count','set','Content-Range','json','apply','then','sendStatus','error','stack','name','send','index','DeskAccount','fieldName','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','show','params','keys','include','catch','create','body','destroy','getConfigurations','findOne','DeskConfiguration','pick','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','type','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','token','tokenSecret'];(function(_0x55abd9,_0x1148af){var _0x3e5669=function(_0x6f2105){while(--_0x6f2105){_0x55abd9['push'](_0x55abd9['shift']());}};_0x3e5669(++_0x1148af);}(_0xe8e4,0xfb));var _0x4e8e=function(_0x57f7a0,_0x208a9c){_0x57f7a0=_0x57f7a0-0x0;var _0x214331=_0xe8e4[_0x57f7a0];return _0x214331;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4e8e('0x0'));var zipdir=require(_0x4e8e('0x1'));var jsonpatch=require(_0x4e8e('0x2'));var rp=require(_0x4e8e('0x3'));var moment=require(_0x4e8e('0x4'));var BPromise=require(_0x4e8e('0x5'));var Mustache=require(_0x4e8e('0x6'));var util=require(_0x4e8e('0x7'));var path=require(_0x4e8e('0x8'));var sox=require(_0x4e8e('0x9'));var csv=require('to-csv');var ejs=require(_0x4e8e('0xa'));var fs=require('fs');var fs_extra=require(_0x4e8e('0xb'));var _=require('lodash');var squel=require(_0x4e8e('0xc'));var crypto=require(_0x4e8e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4e8e('0xe'));var toCsv=require(_0x4e8e('0xf'));var querystring=require('querystring');var Papa=require(_0x4e8e('0x10'));var Redis=require(_0x4e8e('0x11'));var authService=require(_0x4e8e('0x12'));var qs=require(_0x4e8e('0x13'));var as=require(_0x4e8e('0x14'));var hardwareService=require(_0x4e8e('0x15'));var logger=require(_0x4e8e('0x16'))(_0x4e8e('0x17'));var utils=require(_0x4e8e('0x18'));var config=require(_0x4e8e('0x19'));var licenseUtil=require(_0x4e8e('0x1a'));var db=require(_0x4e8e('0x1b'))['db'];var integrations=require(_0x4e8e('0x1c'));function respondWithStatusCode(_0xfc271e,_0x377d6d){_0x377d6d=_0x377d6d||0xcc;return function(_0x256467){if(_0x256467){return _0xfc271e['sendStatus'](_0x377d6d);}return _0xfc271e[_0x4e8e('0x1d')](_0x377d6d)[_0x4e8e('0x1e')]();};}function respondWithResult(_0x2d4c00,_0xbef08c){_0xbef08c=_0xbef08c||0xc8;return function(_0x547f9c){if(_0x547f9c){return _0x2d4c00['status'](_0xbef08c)['json'](_0x547f9c);}};}function respondWithFilteredResult(_0x4fe61e,_0xfd0ee6){return function(_0x3cd028){if(_0x3cd028){var _0x287ed0=typeof _0xfd0ee6[_0x4e8e('0x1f')]==='undefined'&&typeof _0xfd0ee6['limit']===_0x4e8e('0x20');var _0xc07abd=_0x3cd028['count'];var _0xf8c3f2=_0x287ed0?0x0:_0xfd0ee6[_0x4e8e('0x1f')];var _0x35a1c7=_0x287ed0?_0x3cd028[_0x4e8e('0x21')]:_0xfd0ee6[_0x4e8e('0x1f')]+_0xfd0ee6['limit'];var _0xd8bf71;if(_0x35a1c7>=_0xc07abd){_0x35a1c7=_0xc07abd;_0xd8bf71=0xc8;}else{_0xd8bf71=0xce;}_0x4fe61e[_0x4e8e('0x1d')](_0xd8bf71);return _0x4fe61e[_0x4e8e('0x22')](_0x4e8e('0x23'),_0xf8c3f2+'-'+_0x35a1c7+'/'+_0xc07abd)[_0x4e8e('0x24')](_0x3cd028);}return null;};}function patchUpdates(_0x48d1fe){return function(_0x51a5bc){try{jsonpatch[_0x4e8e('0x25')](_0x51a5bc,_0x48d1fe,!![]);}catch(_0x54d08a){return BPromise['reject'](_0x54d08a);}return _0x51a5bc['save']();};}function saveUpdates(_0x12c182,_0x54e06c){return function(_0x2412b1){if(_0x2412b1){return _0x2412b1['update'](_0x12c182)[_0x4e8e('0x26')](function(_0x1cd99d){return _0x1cd99d;});}return null;};}function removeEntity(_0x14a3b4,_0x58fbbe){return function(_0x1765e0){if(_0x1765e0){return _0x1765e0['destroy']()[_0x4e8e('0x26')](function(){_0x14a3b4['status'](0xcc)[_0x4e8e('0x1e')]();});}};}function handleEntityNotFound(_0x39dbdc,_0x5a03b6){return function(_0x28c7f6){if(!_0x28c7f6){_0x39dbdc[_0x4e8e('0x27')](0x194);}return _0x28c7f6;};}function handleError(_0x2e683e,_0x3fb459){_0x3fb459=_0x3fb459||0x1f4;return function(_0x37a78b){logger[_0x4e8e('0x28')](_0x37a78b[_0x4e8e('0x29')]);if(_0x37a78b[_0x4e8e('0x2a')]){delete _0x37a78b['name'];}_0x2e683e['status'](_0x3fb459)[_0x4e8e('0x2b')](_0x37a78b);};}exports[_0x4e8e('0x2c')]=function(_0x13a325,_0x1a4130){var _0x1589db={},_0x42235f={},_0x1b2286={'count':0x0,'rows':[]};var _0x3b3aee=_['map'](db[_0x4e8e('0x2d')]['rawAttributes'],function(_0x537f86){return{'name':_0x537f86[_0x4e8e('0x2e')],'type':_0x537f86['type']['key']};});_0x42235f[_0x4e8e('0x2f')]=_[_0x4e8e('0x30')](_0x3b3aee,'name');_0x42235f[_0x4e8e('0x31')]=_['keys'](_0x13a325[_0x4e8e('0x31')]);_0x42235f[_0x4e8e('0x32')]=_[_0x4e8e('0x33')](_0x42235f[_0x4e8e('0x2f')],_0x42235f['query']);_0x1589db['attributes']=_[_0x4e8e('0x33')](_0x42235f[_0x4e8e('0x2f')],qs[_0x4e8e('0x34')](_0x13a325['query']['fields']));_0x1589db[_0x4e8e('0x35')]=_0x1589db['attributes'][_0x4e8e('0x36')]?_0x1589db[_0x4e8e('0x35')]:_0x42235f[_0x4e8e('0x2f')];if(!_0x13a325['query'][_0x4e8e('0x37')]('nolimit')){_0x1589db['limit']=qs[_0x4e8e('0x38')](_0x13a325[_0x4e8e('0x31')][_0x4e8e('0x38')]);_0x1589db[_0x4e8e('0x1f')]=qs[_0x4e8e('0x1f')](_0x13a325[_0x4e8e('0x31')]['offset']);}_0x1589db[_0x4e8e('0x39')]=qs['sort'](_0x13a325['query'][_0x4e8e('0x3a')]);_0x1589db[_0x4e8e('0x3b')]=qs[_0x4e8e('0x32')](_['pick'](_0x13a325[_0x4e8e('0x31')],_0x42235f[_0x4e8e('0x32')]),_0x3b3aee);if(_0x13a325['query'][_0x4e8e('0x3c')]){_0x1589db[_0x4e8e('0x3b')]=_['merge'](_0x1589db['where'],{'$or':_[_0x4e8e('0x30')](_0x3b3aee,function(_0x3a51e7){if(_0x3a51e7['type']!==_0x4e8e('0x3d')){var _0x3a8446={};_0x3a8446[_0x3a51e7['name']]={'$like':'%'+_0x13a325[_0x4e8e('0x31')]['filter']+'%'};return _0x3a8446;}})});}_0x1589db=_[_0x4e8e('0x3e')]({},_0x1589db,_0x13a325[_0x4e8e('0x3f')]);var _0x30021e={'where':_0x1589db[_0x4e8e('0x3b')]};return db[_0x4e8e('0x2d')][_0x4e8e('0x21')](_0x30021e)[_0x4e8e('0x26')](function(_0x1383c0){_0x1b2286[_0x4e8e('0x21')]=_0x1383c0;if(_0x13a325['query'][_0x4e8e('0x40')]){_0x1589db['include']=[{'all':!![]}];}return db[_0x4e8e('0x2d')][_0x4e8e('0x41')](_0x1589db);})[_0x4e8e('0x26')](function(_0x5c4520){_0x1b2286['rows']=_0x5c4520;return _0x1b2286;})[_0x4e8e('0x26')](respondWithFilteredResult(_0x1a4130,_0x1589db))['catch'](handleError(_0x1a4130,null));};exports[_0x4e8e('0x42')]=function(_0x55bd2d,_0x2b2c54){var _0x39863d={'raw':![],'where':{'id':_0x55bd2d[_0x4e8e('0x43')]['id']}},_0x114f3f={};_0x114f3f[_0x4e8e('0x2f')]=_[_0x4e8e('0x44')](db[_0x4e8e('0x2d')]['rawAttributes']);_0x114f3f['query']=_[_0x4e8e('0x44')](_0x55bd2d[_0x4e8e('0x31')]);_0x114f3f['filters']=_[_0x4e8e('0x33')](_0x114f3f['model'],_0x114f3f[_0x4e8e('0x31')]);_0x39863d[_0x4e8e('0x35')]=_[_0x4e8e('0x33')](_0x114f3f[_0x4e8e('0x2f')],qs['fields'](_0x55bd2d[_0x4e8e('0x31')][_0x4e8e('0x34')]));_0x39863d[_0x4e8e('0x35')]=_0x39863d['attributes']['length']?_0x39863d['attributes']:_0x114f3f[_0x4e8e('0x2f')];if(_0x55bd2d[_0x4e8e('0x31')][_0x4e8e('0x40')]){_0x39863d[_0x4e8e('0x45')]=[{'all':!![]}];}_0x39863d=_[_0x4e8e('0x3e')]({},_0x39863d,_0x55bd2d[_0x4e8e('0x3f')]);return db['DeskAccount']['find'](_0x39863d)[_0x4e8e('0x26')](handleEntityNotFound(_0x2b2c54,null))[_0x4e8e('0x26')](respondWithResult(_0x2b2c54,null))[_0x4e8e('0x46')](handleError(_0x2b2c54,null));};exports[_0x4e8e('0x47')]=function(_0x5aa3cd,_0x5df61b){return db[_0x4e8e('0x2d')][_0x4e8e('0x47')](_0x5aa3cd[_0x4e8e('0x48')],{})[_0x4e8e('0x26')](respondWithResult(_0x5df61b,0xc9))[_0x4e8e('0x46')](handleError(_0x5df61b,null));};exports['update']=function(_0x19a5f1,_0x28c11a){if(_0x19a5f1[_0x4e8e('0x48')]['id']){delete _0x19a5f1[_0x4e8e('0x48')]['id'];}return db[_0x4e8e('0x2d')]['find']({'where':{'id':_0x19a5f1[_0x4e8e('0x43')]['id']}})['then'](handleEntityNotFound(_0x28c11a,null))[_0x4e8e('0x26')](saveUpdates(_0x19a5f1['body'],null))['then'](respondWithResult(_0x28c11a,null))[_0x4e8e('0x46')](handleError(_0x28c11a,null));};exports[_0x4e8e('0x49')]=function(_0x5de5b1,_0x4c7068){return db[_0x4e8e('0x2d')]['find']({'where':{'id':_0x5de5b1[_0x4e8e('0x43')]['id']}})[_0x4e8e('0x26')](handleEntityNotFound(_0x4c7068,null))[_0x4e8e('0x26')](removeEntity(_0x4c7068,null))['catch'](handleError(_0x4c7068,null));};exports[_0x4e8e('0x4a')]=function(_0x34cc45,_0x790788,_0x8cc9b7){var _0x441053={};var _0x342d1a={};var _0x3fe2cf;var _0x43d32a;return db[_0x4e8e('0x2d')][_0x4e8e('0x4b')]({'where':{'id':_0x34cc45[_0x4e8e('0x43')]['id']}})[_0x4e8e('0x26')](handleEntityNotFound(_0x790788,null))[_0x4e8e('0x26')](function(_0x12b2a9){if(_0x12b2a9){_0x3fe2cf=_0x12b2a9;_0x342d1a[_0x4e8e('0x2f')]=_[_0x4e8e('0x44')](db[_0x4e8e('0x4c')]['rawAttributes']);_0x342d1a[_0x4e8e('0x31')]=_[_0x4e8e('0x44')](_0x34cc45[_0x4e8e('0x31')]);_0x342d1a['filters']=_[_0x4e8e('0x33')](_0x342d1a[_0x4e8e('0x2f')],_0x342d1a['query']);_0x441053[_0x4e8e('0x35')]=_['intersection'](_0x342d1a[_0x4e8e('0x2f')],qs[_0x4e8e('0x34')](_0x34cc45[_0x4e8e('0x31')][_0x4e8e('0x34')]));_0x441053[_0x4e8e('0x35')]=_0x441053['attributes']['length']?_0x441053['attributes']:_0x342d1a[_0x4e8e('0x2f')];_0x441053['order']=qs[_0x4e8e('0x3a')](_0x34cc45[_0x4e8e('0x31')]['sort']);_0x441053[_0x4e8e('0x3b')]=qs[_0x4e8e('0x32')](_[_0x4e8e('0x4d')](_0x34cc45[_0x4e8e('0x31')],_0x342d1a[_0x4e8e('0x32')]));if(_0x34cc45['query'][_0x4e8e('0x3c')]){_0x441053['where']=_[_0x4e8e('0x3e')](_0x441053[_0x4e8e('0x3b')],{'$or':_[_0x4e8e('0x30')](_0x441053['attributes'],function(_0x147d23){var _0x130373={};_0x130373[_0x147d23]={'$like':'%'+_0x34cc45[_0x4e8e('0x31')][_0x4e8e('0x3c')]+'%'};return _0x130373;})});}_0x441053=_[_0x4e8e('0x3e')]({},_0x441053,_0x34cc45[_0x4e8e('0x3f')]);return _0x3fe2cf[_0x4e8e('0x4a')](_0x441053);}})[_0x4e8e('0x26')](function(_0x4f6d74){if(_0x4f6d74){_0x43d32a=_0x4f6d74[_0x4e8e('0x36')];if(!_0x34cc45[_0x4e8e('0x31')][_0x4e8e('0x37')](_0x4e8e('0x4e'))){_0x441053[_0x4e8e('0x38')]=qs['limit'](_0x34cc45[_0x4e8e('0x31')][_0x4e8e('0x38')]);_0x441053[_0x4e8e('0x1f')]=qs['offset'](_0x34cc45[_0x4e8e('0x31')][_0x4e8e('0x1f')]);}return _0x3fe2cf['getConfigurations'](_0x441053);}})[_0x4e8e('0x26')](function(_0x49afe0){if(_0x49afe0){return _0x49afe0?{'count':_0x43d32a,'rows':_0x49afe0}:null;}})[_0x4e8e('0x26')](respondWithResult(_0x790788,null))['catch'](handleError(_0x790788,null));};exports[_0x4e8e('0x4f')]=function(_0x461391,_0x56d4e9,_0x13738b){if(_0x461391[_0x4e8e('0x48')]['id']){delete _0x461391['body']['id'];}return db[_0x4e8e('0x2d')][_0x4e8e('0x4b')]({'where':{'id':_0x461391[_0x4e8e('0x43')]['id']}})[_0x4e8e('0x26')](handleEntityNotFound(_0x56d4e9,null))[_0x4e8e('0x26')](function(_0x451feb){if(_0x451feb){_0x461391[_0x4e8e('0x48')][_0x4e8e('0x50')]=_0x451feb['id'];_0x461391[_0x4e8e('0x48')][_0x4e8e('0x51')]=integrations[_0x4e8e('0x52')](_0x461391[_0x4e8e('0x48')]['channel'],_0x461391[_0x4e8e('0x48')]['type']);_0x461391['body'][_0x4e8e('0x53')]=integrations[_0x4e8e('0x54')](_0x461391[_0x4e8e('0x48')][_0x4e8e('0x55')],_0x461391[_0x4e8e('0x48')][_0x4e8e('0x56')]);return db[_0x4e8e('0x4c')][_0x4e8e('0x47')](_0x461391[_0x4e8e('0x48')],{'include':[{'model':db[_0x4e8e('0x57')],'as':_0x4e8e('0x51')},{'model':db[_0x4e8e('0x57')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x56d4e9,null))[_0x4e8e('0x46')](handleError(_0x56d4e9,null));};exports[_0x4e8e('0x58')]=function(_0x3ab8ce,_0x51ab35,_0x4d3304){var _0x2d92f1=[{'name':_0x4e8e('0x59'),'label':'priority','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 _0x552081='';return db[_0x4e8e('0x2d')]['findOne']({'where':{'id':_0x3ab8ce['params']['id']},'attributes':['id',_0x4e8e('0x5a'),_0x4e8e('0x5b'),_0x4e8e('0x5c'),_0x4e8e('0x5d'),_0x4e8e('0x5e'),'consumerSecret',_0x4e8e('0x5f'),_0x4e8e('0x60')]})[_0x4e8e('0x26')](handleEntityNotFound(_0x51ab35,null))[_0x4e8e('0x26')](function(_0x5cd6db){if(_0x5cd6db){_0x552081=_0x5cd6db['remoteUri'];var _0x47d5c1=_0x552081['slice'](-0x1);if(_0x47d5c1==='/'){_0x552081=_0x552081[_0x4e8e('0x61')](0x0,_0x552081[_0x4e8e('0x62')](_0x47d5c1));}var _0x1a9f8c={'method':_0x4e8e('0x63'),'uri':util[_0x4e8e('0x64')](_0x4e8e('0x65'),_0x552081),'headers':{'Content-Type':_0x4e8e('0x66'),'Accept':_0x4e8e('0x66')},'json':!![]};if(_0x5cd6db[_0x4e8e('0x5b')]===_0x4e8e('0x67')){_0x1a9f8c['headers']['Authorization']=util[_0x4e8e('0x64')](_0x4e8e('0x68'),new Buffer(util[_0x4e8e('0x64')](_0x4e8e('0x69'),_0x5cd6db['username'],_0x5cd6db[_0x4e8e('0x5d')]))[_0x4e8e('0x6a')](_0x4e8e('0x6b')));}return rp(_0x1a9f8c)['then'](function(_0x390eee){return _0x2d92f1[_0x4e8e('0x6c')](_[_0x4e8e('0x30')](_0x390eee[_0x4e8e('0x6d')]['entries'],function(_0x4f301a){return{'id':_0x4f301a[_0x4e8e('0x2a')],'name':_0x4f301a[_0x4e8e('0x2a')],'type':_0x4f301a['type'],'active':_0x4f301a[_0x4e8e('0x6e')],'label':_0x4f301a[_0x4e8e('0x6f')],'custom':!![]};}));});}})['then'](function(_0x43c375){return{'count':_0x43c375[_0x4e8e('0x36')],'rows':_0x43c375};})[_0x4e8e('0x26')](respondWithResult(_0x51ab35,null))[_0x4e8e('0x46')](function(_0x4bc551){var _0x8bd4a6=_0x3ab8ce[_0x4e8e('0x31')]['test']?0x1f4:_0x4bc551[_0x4e8e('0x70')]||0x1f4;logger[_0x4e8e('0x28')](_0x4e8e('0x71'),'getFields',_0x8bd4a6,JSON[_0x4e8e('0x72')](_0x4bc551));delete _0x4bc551[_0x4e8e('0x2a')];if(_0x8bd4a6===0x191){_0x8bd4a6=0x190;}_0x51ab35[_0x4e8e('0x1d')](_0x8bd4a6)['send'](_0x3ab8ce[_0x4e8e('0x31')][_0x4e8e('0x73')]?{'message':'Wrong\x20credentials','statusCode':_0x4bc551[_0x4e8e('0x70')]}:_0x4bc551);});}; \ No newline at end of file +var _0xd596=['concat','_embedded','active','test','getFields,\x20%s,\x20%s,\x20%s','stringify','statusCode','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','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','end','status','json','offset','undefined','limit','set','Content-Range','apply','save','update','destroy','then','sendStatus','error','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','count','includeAll','include','findAll','rows','catch','find','create','body','params','findOne','options','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','DeskConfiguration','DeskField','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','application/json','basic','headers','Authorization','Basic\x20%s','format','toString','base64'];(function(_0x3fc875,_0x2a47ae){var _0x166fde=function(_0x4a631f){while(--_0x4a631f){_0x3fc875['push'](_0x3fc875['shift']());}};_0x166fde(++_0x2a47ae);}(_0xd596,0x1d3));var _0x6d59=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0xd596[_0x1064bc];return _0x5edc45;};'use strict';var emlformat=require(_0x6d59('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6d59('0x1'));var rp=require(_0x6d59('0x2'));var moment=require('moment');var BPromise=require(_0x6d59('0x3'));var Mustache=require(_0x6d59('0x4'));var util=require(_0x6d59('0x5'));var path=require(_0x6d59('0x6'));var sox=require(_0x6d59('0x7'));var csv=require(_0x6d59('0x8'));var ejs=require(_0x6d59('0x9'));var fs=require('fs');var fs_extra=require(_0x6d59('0xa'));var _=require(_0x6d59('0xb'));var squel=require(_0x6d59('0xc'));var crypto=require(_0x6d59('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6d59('0xe'));var toCsv=require(_0x6d59('0x8'));var querystring=require(_0x6d59('0xf'));var Papa=require(_0x6d59('0x10'));var Redis=require('ioredis');var authService=require(_0x6d59('0x11'));var qs=require(_0x6d59('0x12'));var as=require(_0x6d59('0x13'));var hardwareService=require(_0x6d59('0x14'));var logger=require(_0x6d59('0x15'))(_0x6d59('0x16'));var utils=require(_0x6d59('0x17'));var config=require(_0x6d59('0x18'));var licenseUtil=require(_0x6d59('0x19'));var db=require(_0x6d59('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x284d22,_0x3d1a96){_0x3d1a96=_0x3d1a96||0xcc;return function(_0x2359a6){if(_0x2359a6){return _0x284d22['sendStatus'](_0x3d1a96);}return _0x284d22['status'](_0x3d1a96)[_0x6d59('0x1b')]();};}function respondWithResult(_0x2dddc1,_0x5e270a){_0x5e270a=_0x5e270a||0xc8;return function(_0x59f2fc){if(_0x59f2fc){return _0x2dddc1[_0x6d59('0x1c')](_0x5e270a)[_0x6d59('0x1d')](_0x59f2fc);}};}function respondWithFilteredResult(_0x2d0089,_0x2c54ac){return function(_0x205f07){if(_0x205f07){var _0x1332b9=typeof _0x2c54ac[_0x6d59('0x1e')]===_0x6d59('0x1f')&&typeof _0x2c54ac[_0x6d59('0x20')]==='undefined';var _0x2bc005=_0x205f07['count'];var _0x33f41e=_0x1332b9?0x0:_0x2c54ac[_0x6d59('0x1e')];var _0x5beb35=_0x1332b9?_0x205f07['count']:_0x2c54ac[_0x6d59('0x1e')]+_0x2c54ac['limit'];var _0x29d652;if(_0x5beb35>=_0x2bc005){_0x5beb35=_0x2bc005;_0x29d652=0xc8;}else{_0x29d652=0xce;}_0x2d0089[_0x6d59('0x1c')](_0x29d652);return _0x2d0089[_0x6d59('0x21')](_0x6d59('0x22'),_0x33f41e+'-'+_0x5beb35+'/'+_0x2bc005)[_0x6d59('0x1d')](_0x205f07);}return null;};}function patchUpdates(_0x46a922){return function(_0x260145){try{jsonpatch[_0x6d59('0x23')](_0x260145,_0x46a922,!![]);}catch(_0x233cb9){return BPromise['reject'](_0x233cb9);}return _0x260145[_0x6d59('0x24')]();};}function saveUpdates(_0x3e59c7,_0x541e32){return function(_0x346aa6){if(_0x346aa6){return _0x346aa6[_0x6d59('0x25')](_0x3e59c7)['then'](function(_0x437d0b){return _0x437d0b;});}return null;};}function removeEntity(_0x386a12,_0x585e0c){return function(_0x401170){if(_0x401170){return _0x401170[_0x6d59('0x26')]()[_0x6d59('0x27')](function(){_0x386a12[_0x6d59('0x1c')](0xcc)[_0x6d59('0x1b')]();});}};}function handleEntityNotFound(_0x363b6a,_0x542fea){return function(_0x4d20d4){if(!_0x4d20d4){_0x363b6a[_0x6d59('0x28')](0x194);}return _0x4d20d4;};}function handleError(_0x5c2975,_0x30e3ca){_0x30e3ca=_0x30e3ca||0x1f4;return function(_0x4ed0e3){logger[_0x6d59('0x29')](_0x4ed0e3['stack']);if(_0x4ed0e3[_0x6d59('0x2a')]){delete _0x4ed0e3['name'];}_0x5c2975[_0x6d59('0x1c')](_0x30e3ca)[_0x6d59('0x2b')](_0x4ed0e3);};}exports[_0x6d59('0x2c')]=function(_0x51e73d,_0x3df80e){var _0x4a5156={},_0x2f4567={},_0x421732={'count':0x0,'rows':[]};var _0x4e2b36=_[_0x6d59('0x2d')](db[_0x6d59('0x2e')][_0x6d59('0x2f')],function(_0x52a738){return{'name':_0x52a738[_0x6d59('0x30')],'type':_0x52a738[_0x6d59('0x31')]['key']};});_0x2f4567['model']=_[_0x6d59('0x2d')](_0x4e2b36,'name');_0x2f4567[_0x6d59('0x32')]=_[_0x6d59('0x33')](_0x51e73d[_0x6d59('0x32')]);_0x2f4567[_0x6d59('0x34')]=_[_0x6d59('0x35')](_0x2f4567['model'],_0x2f4567[_0x6d59('0x32')]);_0x4a5156[_0x6d59('0x36')]=_[_0x6d59('0x35')](_0x2f4567[_0x6d59('0x37')],qs['fields'](_0x51e73d[_0x6d59('0x32')][_0x6d59('0x38')]));_0x4a5156[_0x6d59('0x36')]=_0x4a5156['attributes'][_0x6d59('0x39')]?_0x4a5156['attributes']:_0x2f4567[_0x6d59('0x37')];if(!_0x51e73d[_0x6d59('0x32')][_0x6d59('0x3a')](_0x6d59('0x3b'))){_0x4a5156[_0x6d59('0x20')]=qs['limit'](_0x51e73d[_0x6d59('0x32')][_0x6d59('0x20')]);_0x4a5156['offset']=qs[_0x6d59('0x1e')](_0x51e73d[_0x6d59('0x32')]['offset']);}_0x4a5156[_0x6d59('0x3c')]=qs['sort'](_0x51e73d[_0x6d59('0x32')][_0x6d59('0x3d')]);_0x4a5156[_0x6d59('0x3e')]=qs[_0x6d59('0x34')](_[_0x6d59('0x3f')](_0x51e73d[_0x6d59('0x32')],_0x2f4567[_0x6d59('0x34')]),_0x4e2b36);if(_0x51e73d[_0x6d59('0x32')][_0x6d59('0x40')]){_0x4a5156[_0x6d59('0x3e')]=_[_0x6d59('0x41')](_0x4a5156[_0x6d59('0x3e')],{'$or':_[_0x6d59('0x2d')](_0x4e2b36,function(_0x576080){if(_0x576080['type']!=='VIRTUAL'){var _0xe66b4d={};_0xe66b4d[_0x576080[_0x6d59('0x2a')]]={'$like':'%'+_0x51e73d[_0x6d59('0x32')]['filter']+'%'};return _0xe66b4d;}})});}_0x4a5156=_['merge']({},_0x4a5156,_0x51e73d['options']);var _0x47a023={'where':_0x4a5156[_0x6d59('0x3e')]};return db['DeskAccount']['count'](_0x47a023)[_0x6d59('0x27')](function(_0x3bbc5b){_0x421732[_0x6d59('0x42')]=_0x3bbc5b;if(_0x51e73d[_0x6d59('0x32')][_0x6d59('0x43')]){_0x4a5156[_0x6d59('0x44')]=[{'all':!![]}];}return db[_0x6d59('0x2e')][_0x6d59('0x45')](_0x4a5156);})[_0x6d59('0x27')](function(_0x38df3d){_0x421732[_0x6d59('0x46')]=_0x38df3d;return _0x421732;})['then'](respondWithFilteredResult(_0x3df80e,_0x4a5156))[_0x6d59('0x47')](handleError(_0x3df80e,null));};exports['show']=function(_0x7f94d,_0x9ddf75){var _0x37e295={'raw':![],'where':{'id':_0x7f94d['params']['id']}},_0x506d09={};_0x506d09[_0x6d59('0x37')]=_[_0x6d59('0x33')](db[_0x6d59('0x2e')][_0x6d59('0x2f')]);_0x506d09['query']=_[_0x6d59('0x33')](_0x7f94d[_0x6d59('0x32')]);_0x506d09[_0x6d59('0x34')]=_[_0x6d59('0x35')](_0x506d09[_0x6d59('0x37')],_0x506d09[_0x6d59('0x32')]);_0x37e295[_0x6d59('0x36')]=_[_0x6d59('0x35')](_0x506d09[_0x6d59('0x37')],qs[_0x6d59('0x38')](_0x7f94d[_0x6d59('0x32')][_0x6d59('0x38')]));_0x37e295['attributes']=_0x37e295[_0x6d59('0x36')][_0x6d59('0x39')]?_0x37e295[_0x6d59('0x36')]:_0x506d09[_0x6d59('0x37')];if(_0x7f94d[_0x6d59('0x32')][_0x6d59('0x43')]){_0x37e295[_0x6d59('0x44')]=[{'all':!![]}];}_0x37e295=_[_0x6d59('0x41')]({},_0x37e295,_0x7f94d['options']);return db[_0x6d59('0x2e')][_0x6d59('0x48')](_0x37e295)['then'](handleEntityNotFound(_0x9ddf75,null))[_0x6d59('0x27')](respondWithResult(_0x9ddf75,null))['catch'](handleError(_0x9ddf75,null));};exports[_0x6d59('0x49')]=function(_0x3f847a,_0x38a2fc){return db[_0x6d59('0x2e')]['create'](_0x3f847a[_0x6d59('0x4a')],{})[_0x6d59('0x27')](respondWithResult(_0x38a2fc,0xc9))[_0x6d59('0x47')](handleError(_0x38a2fc,null));};exports['update']=function(_0x2c7161,_0x78d107){if(_0x2c7161[_0x6d59('0x4a')]['id']){delete _0x2c7161[_0x6d59('0x4a')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x2c7161['params']['id']}})[_0x6d59('0x27')](handleEntityNotFound(_0x78d107,null))[_0x6d59('0x27')](saveUpdates(_0x2c7161[_0x6d59('0x4a')],null))['then'](respondWithResult(_0x78d107,null))[_0x6d59('0x47')](handleError(_0x78d107,null));};exports[_0x6d59('0x26')]=function(_0x3978be,_0x4e00fd){return db[_0x6d59('0x2e')][_0x6d59('0x48')]({'where':{'id':_0x3978be[_0x6d59('0x4b')]['id']}})[_0x6d59('0x27')](handleEntityNotFound(_0x4e00fd,null))[_0x6d59('0x27')](removeEntity(_0x4e00fd,null))[_0x6d59('0x47')](handleError(_0x4e00fd,null));};exports['getConfigurations']=function(_0x10d8dd,_0x51e56c,_0x5b452f){var _0x1d994a={};var _0x166c2f={};var _0x27eccc;var _0x5486b1;return db['DeskAccount'][_0x6d59('0x4c')]({'where':{'id':_0x10d8dd['params']['id']}})[_0x6d59('0x27')](handleEntityNotFound(_0x51e56c,null))[_0x6d59('0x27')](function(_0x5e3fa5){if(_0x5e3fa5){_0x27eccc=_0x5e3fa5;_0x166c2f[_0x6d59('0x37')]=_[_0x6d59('0x33')](db['DeskConfiguration']['rawAttributes']);_0x166c2f[_0x6d59('0x32')]=_[_0x6d59('0x33')](_0x10d8dd[_0x6d59('0x32')]);_0x166c2f[_0x6d59('0x34')]=_[_0x6d59('0x35')](_0x166c2f[_0x6d59('0x37')],_0x166c2f[_0x6d59('0x32')]);_0x1d994a['attributes']=_[_0x6d59('0x35')](_0x166c2f[_0x6d59('0x37')],qs[_0x6d59('0x38')](_0x10d8dd[_0x6d59('0x32')][_0x6d59('0x38')]));_0x1d994a[_0x6d59('0x36')]=_0x1d994a['attributes']['length']?_0x1d994a[_0x6d59('0x36')]:_0x166c2f[_0x6d59('0x37')];_0x1d994a[_0x6d59('0x3c')]=qs['sort'](_0x10d8dd[_0x6d59('0x32')]['sort']);_0x1d994a[_0x6d59('0x3e')]=qs[_0x6d59('0x34')](_[_0x6d59('0x3f')](_0x10d8dd[_0x6d59('0x32')],_0x166c2f['filters']));if(_0x10d8dd[_0x6d59('0x32')][_0x6d59('0x40')]){_0x1d994a[_0x6d59('0x3e')]=_[_0x6d59('0x41')](_0x1d994a[_0x6d59('0x3e')],{'$or':_['map'](_0x1d994a['attributes'],function(_0x405b02){var _0x431f03={};_0x431f03[_0x405b02]={'$like':'%'+_0x10d8dd['query'][_0x6d59('0x40')]+'%'};return _0x431f03;})});}_0x1d994a=_[_0x6d59('0x41')]({},_0x1d994a,_0x10d8dd[_0x6d59('0x4d')]);return _0x27eccc[_0x6d59('0x4e')](_0x1d994a);}})[_0x6d59('0x27')](function(_0x49dc40){if(_0x49dc40){_0x5486b1=_0x49dc40[_0x6d59('0x39')];if(!_0x10d8dd[_0x6d59('0x32')][_0x6d59('0x3a')]('nolimit')){_0x1d994a[_0x6d59('0x20')]=qs[_0x6d59('0x20')](_0x10d8dd[_0x6d59('0x32')][_0x6d59('0x20')]);_0x1d994a[_0x6d59('0x1e')]=qs['offset'](_0x10d8dd[_0x6d59('0x32')][_0x6d59('0x1e')]);}return _0x27eccc['getConfigurations'](_0x1d994a);}})[_0x6d59('0x27')](function(_0x188a41){if(_0x188a41){return _0x188a41?{'count':_0x5486b1,'rows':_0x188a41}:null;}})[_0x6d59('0x27')](respondWithResult(_0x51e56c,null))[_0x6d59('0x47')](handleError(_0x51e56c,null));};exports[_0x6d59('0x4f')]=function(_0x2bf298,_0x55fa04,_0x17280c){if(_0x2bf298[_0x6d59('0x4a')]['id']){delete _0x2bf298[_0x6d59('0x4a')]['id'];}return db[_0x6d59('0x2e')][_0x6d59('0x4c')]({'where':{'id':_0x2bf298['params']['id']}})[_0x6d59('0x27')](handleEntityNotFound(_0x55fa04,null))[_0x6d59('0x27')](function(_0x39f15e){if(_0x39f15e){_0x2bf298[_0x6d59('0x4a')][_0x6d59('0x50')]=_0x39f15e['id'];_0x2bf298['body'][_0x6d59('0x51')]=integrations[_0x6d59('0x52')](_0x2bf298[_0x6d59('0x4a')]['channel'],_0x2bf298[_0x6d59('0x4a')][_0x6d59('0x31')]);_0x2bf298[_0x6d59('0x4a')][_0x6d59('0x53')]=integrations[_0x6d59('0x54')](_0x2bf298[_0x6d59('0x4a')]['channel'],_0x2bf298[_0x6d59('0x4a')]['type']);return db[_0x6d59('0x55')]['create'](_0x2bf298[_0x6d59('0x4a')],{'include':[{'model':db[_0x6d59('0x56')],'as':'Subjects'},{'model':db['DeskField'],'as':_0x6d59('0x53')}]});}return null;})[_0x6d59('0x27')](respondWithResult(_0x55fa04,null))[_0x6d59('0x47')](handleError(_0x55fa04,null));};exports['getFields']=function(_0x554c4c,_0x506126,_0x2f2633){var _0x43a7c0=[{'name':_0x6d59('0x57'),'label':_0x6d59('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 _0x46c094='';return db[_0x6d59('0x2e')]['findOne']({'where':{'id':_0x554c4c[_0x6d59('0x4b')]['id']},'attributes':['id',_0x6d59('0x58'),_0x6d59('0x59'),_0x6d59('0x5a'),_0x6d59('0x5b'),_0x6d59('0x5c'),_0x6d59('0x5d'),_0x6d59('0x5e'),_0x6d59('0x5f')]})[_0x6d59('0x27')](handleEntityNotFound(_0x506126,null))[_0x6d59('0x27')](function(_0x46ff83){if(_0x46ff83){_0x46c094=_0x46ff83[_0x6d59('0x58')];var _0x349693=_0x46c094[_0x6d59('0x60')](-0x1);if(_0x349693==='/'){_0x46c094=_0x46c094[_0x6d59('0x61')](0x0,_0x46c094[_0x6d59('0x62')](_0x349693));}var _0x5561b8={'method':_0x6d59('0x63'),'uri':util['format']('%s/custom_fields',_0x46c094),'headers':{'Content-Type':_0x6d59('0x64'),'Accept':_0x6d59('0x64')},'json':!![]};if(_0x46ff83['authType']===_0x6d59('0x65')){_0x5561b8[_0x6d59('0x66')][_0x6d59('0x67')]=util['format'](_0x6d59('0x68'),new Buffer(util[_0x6d59('0x69')]('%s:%s',_0x46ff83['username'],_0x46ff83[_0x6d59('0x5b')]))[_0x6d59('0x6a')](_0x6d59('0x6b')));}return rp(_0x5561b8)[_0x6d59('0x27')](function(_0x5af00a){return _0x43a7c0[_0x6d59('0x6c')](_[_0x6d59('0x2d')](_0x5af00a[_0x6d59('0x6d')]['entries'],function(_0x475300){return{'id':_0x475300[_0x6d59('0x2a')],'name':_0x475300['name'],'type':_0x475300[_0x6d59('0x31')],'active':_0x475300[_0x6d59('0x6e')],'label':_0x475300['label'],'custom':!![]};}));});}})[_0x6d59('0x27')](function(_0x3fa259){return{'count':_0x3fa259['length'],'rows':_0x3fa259};})[_0x6d59('0x27')](respondWithResult(_0x506126,null))['catch'](function(_0x4e24b7){var _0x172a2a=_0x554c4c['query'][_0x6d59('0x6f')]?0x1f4:_0x4e24b7['statusCode']||0x1f4;logger[_0x6d59('0x29')](_0x6d59('0x70'),'getFields',_0x172a2a,JSON[_0x6d59('0x71')](_0x4e24b7));delete _0x4e24b7['name'];if(_0x172a2a===0x191){_0x172a2a=0x190;}_0x506126['status'](_0x172a2a)[_0x6d59('0x2b')](_0x554c4c[_0x6d59('0x32')][_0x6d59('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x4e24b7[_0x6d59('0x72')]}:_0x4e24b7);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 9ebb3c0..9dbb8af 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 _0xb199=['./intDeskAccount.attributes','define','DeskAccount','int_desk_accounts','util','moment','bluebird','request-promise','path','rimraf'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xb199,0x72));var _0x9b19=function(_0x1c87fe,_0x43bdc8){_0x1c87fe=_0x1c87fe-0x0;var _0x4f19e5=_0xb199[_0x1c87fe];return _0x4f19e5;};'use strict';var _=require('lodash');var util=require(_0x9b19('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9b19('0x1'));var BPromise=require(_0x9b19('0x2'));var rp=require(_0x9b19('0x3'));var fs=require('fs');var path=require(_0x9b19('0x4'));var rimraf=require(_0x9b19('0x5'));var config=require('../../config/environment');var attributes=require(_0x9b19('0x6'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x130008,_0x2bdd74){return _0x130008[_0x9b19('0x7')](_0x9b19('0x8'),attributes,{'tableName':_0x9b19('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x159e=['exports','define','DeskAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration'];(function(_0x1d080d,_0x3d075a){var _0x54925d=function(_0x25284c){while(--_0x25284c){_0x1d080d['push'](_0x1d080d['shift']());}};_0x54925d(++_0x3d075a);}(_0x159e,0x145));var _0xe159=function(_0x34a8ee,_0x5a1bf4){_0x34a8ee=_0x34a8ee-0x0;var _0x4126f1=_0x159e[_0x34a8ee];return _0x4126f1;};'use strict';var _=require(_0xe159('0x0'));var util=require('util');var logger=require(_0xe159('0x1'))(_0xe159('0x2'));var moment=require(_0xe159('0x3'));var BPromise=require(_0xe159('0x4'));var rp=require(_0xe159('0x5'));var fs=require('fs');var path=require(_0xe159('0x6'));var rimraf=require(_0xe159('0x7'));var config=require(_0xe159('0x8'));var attributes=require(_0xe159('0x9'));var integrations=require(_0xe159('0xa'));module[_0xe159('0xb')]=function(_0xa9ae9b,_0x16bb1f){return _0xa9ae9b[_0xe159('0xc')](_0xe159('0xd'),attributes,{'tableName':'int_desk_accounts','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 4f54e32..fcd3fd2 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 _0xc5fb=['findAll','options','where','attributes','limit','include','map','model','then','raw','ShowDeskAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','GetDeskAccount','DeskAccount'];(function(_0x4bc56e,_0x4f2fc0){var _0x29c230=function(_0x2068d2){while(--_0x2068d2){_0x4bc56e['push'](_0x4bc56e['shift']());}};_0x29c230(++_0x4f2fc0);}(_0xc5fb,0x115));var _0xbc5f=function(_0x3f3026,_0x35d62a){_0x3f3026=_0x3f3026-0x0;var _0x4e87bf=_0xc5fb[_0x3f3026];return _0x4e87bf;};'use strict';var _=require(_0xbc5f('0x0'));var util=require(_0xbc5f('0x1'));var moment=require(_0xbc5f('0x2'));var BPromise=require(_0xbc5f('0x3'));var rs=require(_0xbc5f('0x4'));var fs=require('fs');var Redis=require(_0xbc5f('0x5'));var db=require(_0xbc5f('0x6'))['db'];var utils=require(_0xbc5f('0x7'));var logger=require(_0xbc5f('0x8'))(_0xbc5f('0x9'));var config=require(_0xbc5f('0xa'));var jayson=require(_0xbc5f('0xb'));var client=jayson[_0xbc5f('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18871a,_0x147418,_0x2e9282){return new BPromise(function(_0x3c4697,_0x212df0){return client[_0xbc5f('0xd')](_0x18871a,_0x2e9282)['then'](function(_0x38ba5b){logger[_0xbc5f('0xe')]('DeskAccount,\x20%s,\x20%s',_0x147418,_0xbc5f('0xf'));logger[_0xbc5f('0x10')](_0xbc5f('0x11'),_0x147418,'request\x20sent',JSON[_0xbc5f('0x12')](_0x38ba5b));if(_0x38ba5b[_0xbc5f('0x13')]){if(_0x38ba5b[_0xbc5f('0x13')][_0xbc5f('0x14')]===0x1f4){logger[_0xbc5f('0x13')](_0xbc5f('0x15'),_0x147418,_0x38ba5b[_0xbc5f('0x13')][_0xbc5f('0x16')]);return _0x212df0(_0x38ba5b['error'][_0xbc5f('0x16')]);}logger[_0xbc5f('0x13')]('DeskAccount,\x20%s,\x20%s',_0x147418,_0x38ba5b['error'][_0xbc5f('0x16')]);return _0x3c4697(_0x38ba5b[_0xbc5f('0x13')][_0xbc5f('0x16')]);}else{logger[_0xbc5f('0xe')](_0xbc5f('0x15'),_0x147418,'request\x20sent');_0x3c4697(_0x38ba5b[_0xbc5f('0x17')][_0xbc5f('0x16')]);}})[_0xbc5f('0x18')](function(_0x3ffee0){logger[_0xbc5f('0x13')]('DeskAccount,\x20%s,\x20%s',_0x147418,_0x3ffee0);_0x212df0(_0x3ffee0);});});}exports[_0xbc5f('0x19')]=function(_0x107b30){var _0x467b11=this;return new Promise(function(_0x172e97,_0x5e91a6){return db[_0xbc5f('0x1a')][_0xbc5f('0x1b')]({'raw':_0x107b30['options']?_0x107b30[_0xbc5f('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x107b30['options']?_0x107b30[_0xbc5f('0x1c')][_0xbc5f('0x1d')]||null:null,'attributes':_0x107b30[_0xbc5f('0x1c')]?_0x107b30[_0xbc5f('0x1c')][_0xbc5f('0x1e')]||null:null,'limit':_0x107b30[_0xbc5f('0x1c')]?_0x107b30[_0xbc5f('0x1c')][_0xbc5f('0x1f')]||null:null,'include':_0x107b30[_0xbc5f('0x1c')]?_0x107b30['options'][_0xbc5f('0x20')]?_[_0xbc5f('0x21')](_0x107b30[_0xbc5f('0x1c')][_0xbc5f('0x20')],function(_0x9d57b5){return{'model':db[_0x9d57b5['model']],'as':_0x9d57b5['as'],'attributes':_0x9d57b5[_0xbc5f('0x1e')],'include':_0x9d57b5[_0xbc5f('0x20')]?_['map'](_0x9d57b5[_0xbc5f('0x20')],function(_0x1c0cd0){return{'model':db[_0x1c0cd0[_0xbc5f('0x22')]],'as':_0x1c0cd0['as'],'attributes':_0x1c0cd0[_0xbc5f('0x1e')],'include':_0x1c0cd0[_0xbc5f('0x20')]?_['map'](_0x1c0cd0['include'],function(_0x4b4756){return{'model':db[_0x4b4756[_0xbc5f('0x22')]],'as':_0x4b4756['as'],'attributes':_0x4b4756[_0xbc5f('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbc5f('0x23')](function(_0x28e531){logger[_0xbc5f('0xe')](_0xbc5f('0x19'),_0x107b30);logger['debug'](_0xbc5f('0x19'),_0x107b30,JSON[_0xbc5f('0x12')](_0x28e531));_0x172e97(_0x28e531);})[_0xbc5f('0x18')](function(_0x534a30){logger['error'](_0xbc5f('0x19'),_0x534a30[_0xbc5f('0x16')],_0x107b30);_0x5e91a6(_0x467b11[_0xbc5f('0x13')](0x1f4,_0x534a30[_0xbc5f('0x16')]));});});};exports['ShowDeskAccount']=function(_0xe523d5){var _0x8622e=this;return new Promise(function(_0x581281,_0x2ab54e){return db['DeskAccount']['find']({'raw':_0xe523d5['options']?_0xe523d5['options'][_0xbc5f('0x24')]===undefined?!![]:![]:!![],'where':_0xe523d5[_0xbc5f('0x1c')]?_0xe523d5[_0xbc5f('0x1c')][_0xbc5f('0x1d')]||null:null,'attributes':_0xe523d5[_0xbc5f('0x1c')]?_0xe523d5[_0xbc5f('0x1c')]['attributes']||null:null,'include':_0xe523d5[_0xbc5f('0x1c')]?_0xe523d5[_0xbc5f('0x1c')][_0xbc5f('0x20')]?_[_0xbc5f('0x21')](_0xe523d5['options'][_0xbc5f('0x20')],function(_0x206322){return{'model':db[_0x206322[_0xbc5f('0x22')]],'as':_0x206322['as'],'attributes':_0x206322[_0xbc5f('0x1e')],'include':_0x206322[_0xbc5f('0x20')]?_[_0xbc5f('0x21')](_0x206322[_0xbc5f('0x20')],function(_0x4f8d81){return{'model':db[_0x4f8d81[_0xbc5f('0x22')]],'as':_0x4f8d81['as'],'attributes':_0x4f8d81[_0xbc5f('0x1e')],'include':_0x4f8d81[_0xbc5f('0x20')]?_['map'](_0x4f8d81[_0xbc5f('0x20')],function(_0x39030d){return{'model':db[_0x39030d[_0xbc5f('0x22')]],'as':_0x39030d['as'],'attributes':_0x39030d['attributes']};}):[]};}):[]};}):[]:[]})[_0xbc5f('0x23')](function(_0xe77d95){logger[_0xbc5f('0xe')](_0xbc5f('0x25'),_0xe523d5);logger[_0xbc5f('0x10')]('ShowDeskAccount',_0xe523d5,JSON[_0xbc5f('0x12')](_0xe77d95));_0x581281(_0xe77d95);})['catch'](function(_0xca4a34){logger[_0xbc5f('0x13')]('ShowDeskAccount',_0xca4a34[_0xbc5f('0x16')],_0xe523d5);_0x2ab54e(_0x8622e[_0xbc5f('0x13')](0x1f4,_0xca4a34['message']));});});}; \ No newline at end of file +var _0xaf4e=['attributes','stringify','catch','ShowDeskAccount','find','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','GetDeskAccount','DeskAccount','findAll','options','raw','where','include','map','model'];(function(_0x5ddbd8,_0xcc7237){var _0x4e5cac=function(_0x4dc562){while(--_0x4dc562){_0x5ddbd8['push'](_0x5ddbd8['shift']());}};_0x4e5cac(++_0xcc7237);}(_0xaf4e,0x19d));var _0xeaf4=function(_0x392de5,_0x326dce){_0x392de5=_0x392de5-0x0;var _0x19d104=_0xaf4e[_0x392de5];return _0x19d104;};'use strict';var _=require(_0xeaf4('0x0'));var util=require(_0xeaf4('0x1'));var moment=require(_0xeaf4('0x2'));var BPromise=require(_0xeaf4('0x3'));var rs=require(_0xeaf4('0x4'));var fs=require('fs');var Redis=require(_0xeaf4('0x5'));var db=require(_0xeaf4('0x6'))['db'];var utils=require(_0xeaf4('0x7'));var logger=require(_0xeaf4('0x8'))(_0xeaf4('0x9'));var config=require(_0xeaf4('0xa'));var jayson=require(_0xeaf4('0xb'));var client=jayson[_0xeaf4('0xc')][_0xeaf4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0xa40d78,_0x12469d,_0xc73960){return new BPromise(function(_0x1e8b86,_0xf605b8){return client['request'](_0xa40d78,_0xc73960)[_0xeaf4('0xe')](function(_0x41fa75){logger[_0xeaf4('0xf')](_0xeaf4('0x10'),_0x12469d,_0xeaf4('0x11'));logger['debug'](_0xeaf4('0x12'),_0x12469d,_0xeaf4('0x11'),JSON['stringify'](_0x41fa75));if(_0x41fa75[_0xeaf4('0x13')]){if(_0x41fa75['error'][_0xeaf4('0x14')]===0x1f4){logger[_0xeaf4('0x13')](_0xeaf4('0x10'),_0x12469d,_0x41fa75[_0xeaf4('0x13')][_0xeaf4('0x15')]);return _0xf605b8(_0x41fa75[_0xeaf4('0x13')]['message']);}logger[_0xeaf4('0x13')](_0xeaf4('0x10'),_0x12469d,_0x41fa75[_0xeaf4('0x13')][_0xeaf4('0x15')]);return _0x1e8b86(_0x41fa75[_0xeaf4('0x13')]['message']);}else{logger[_0xeaf4('0xf')](_0xeaf4('0x10'),_0x12469d,_0xeaf4('0x11'));_0x1e8b86(_0x41fa75['result'][_0xeaf4('0x15')]);}})['catch'](function(_0x4ce4eb){logger['error'](_0xeaf4('0x10'),_0x12469d,_0x4ce4eb);_0xf605b8(_0x4ce4eb);});});}exports[_0xeaf4('0x16')]=function(_0x5881a5){var _0x6b0864=this;return new Promise(function(_0xdad785,_0x438c91){return db[_0xeaf4('0x17')][_0xeaf4('0x18')]({'raw':_0x5881a5[_0xeaf4('0x19')]?_0x5881a5[_0xeaf4('0x19')][_0xeaf4('0x1a')]===undefined?!![]:![]:!![],'where':_0x5881a5[_0xeaf4('0x19')]?_0x5881a5[_0xeaf4('0x19')][_0xeaf4('0x1b')]||null:null,'attributes':_0x5881a5[_0xeaf4('0x19')]?_0x5881a5[_0xeaf4('0x19')]['attributes']||null:null,'limit':_0x5881a5[_0xeaf4('0x19')]?_0x5881a5['options']['limit']||null:null,'include':_0x5881a5[_0xeaf4('0x19')]?_0x5881a5['options'][_0xeaf4('0x1c')]?_[_0xeaf4('0x1d')](_0x5881a5[_0xeaf4('0x19')][_0xeaf4('0x1c')],function(_0x1beabe){return{'model':db[_0x1beabe[_0xeaf4('0x1e')]],'as':_0x1beabe['as'],'attributes':_0x1beabe[_0xeaf4('0x1f')],'include':_0x1beabe[_0xeaf4('0x1c')]?_[_0xeaf4('0x1d')](_0x1beabe['include'],function(_0x12c49e){return{'model':db[_0x12c49e[_0xeaf4('0x1e')]],'as':_0x12c49e['as'],'attributes':_0x12c49e[_0xeaf4('0x1f')],'include':_0x12c49e[_0xeaf4('0x1c')]?_[_0xeaf4('0x1d')](_0x12c49e[_0xeaf4('0x1c')],function(_0x53a001){return{'model':db[_0x53a001[_0xeaf4('0x1e')]],'as':_0x53a001['as'],'attributes':_0x53a001[_0xeaf4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xeaf4('0xe')](function(_0x2c1ee1){logger['info'](_0xeaf4('0x16'),_0x5881a5);logger['debug'](_0xeaf4('0x16'),_0x5881a5,JSON[_0xeaf4('0x20')](_0x2c1ee1));_0xdad785(_0x2c1ee1);})[_0xeaf4('0x21')](function(_0x51c052){logger[_0xeaf4('0x13')](_0xeaf4('0x16'),_0x51c052[_0xeaf4('0x15')],_0x5881a5);_0x438c91(_0x6b0864['error'](0x1f4,_0x51c052[_0xeaf4('0x15')]));});});};exports[_0xeaf4('0x22')]=function(_0x4bff77){var _0x27a92b=this;return new Promise(function(_0x54c8c3,_0xeda649){return db[_0xeaf4('0x17')][_0xeaf4('0x23')]({'raw':_0x4bff77[_0xeaf4('0x19')]?_0x4bff77['options'][_0xeaf4('0x1a')]===undefined?!![]:![]:!![],'where':_0x4bff77[_0xeaf4('0x19')]?_0x4bff77[_0xeaf4('0x19')][_0xeaf4('0x1b')]||null:null,'attributes':_0x4bff77[_0xeaf4('0x19')]?_0x4bff77[_0xeaf4('0x19')]['attributes']||null:null,'include':_0x4bff77[_0xeaf4('0x19')]?_0x4bff77[_0xeaf4('0x19')]['include']?_['map'](_0x4bff77[_0xeaf4('0x19')][_0xeaf4('0x1c')],function(_0x5d3b8b){return{'model':db[_0x5d3b8b[_0xeaf4('0x1e')]],'as':_0x5d3b8b['as'],'attributes':_0x5d3b8b['attributes'],'include':_0x5d3b8b[_0xeaf4('0x1c')]?_[_0xeaf4('0x1d')](_0x5d3b8b[_0xeaf4('0x1c')],function(_0x3a4177){return{'model':db[_0x3a4177[_0xeaf4('0x1e')]],'as':_0x3a4177['as'],'attributes':_0x3a4177[_0xeaf4('0x1f')],'include':_0x3a4177['include']?_[_0xeaf4('0x1d')](_0x3a4177[_0xeaf4('0x1c')],function(_0x928565){return{'model':db[_0x928565[_0xeaf4('0x1e')]],'as':_0x928565['as'],'attributes':_0x928565[_0xeaf4('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1da972){logger['info']('ShowDeskAccount',_0x4bff77);logger[_0xeaf4('0x24')](_0xeaf4('0x22'),_0x4bff77,JSON[_0xeaf4('0x20')](_0x1da972));_0x54c8c3(_0x1da972);})[_0xeaf4('0x21')](function(_0x15f6dd){logger['error'](_0xeaf4('0x22'),_0x15f6dd[_0xeaf4('0x15')],_0x4bff77);_0xeda649(_0x27a92b[_0xeaf4('0x13')](0x1f4,_0x15f6dd[_0xeaf4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 1823adb..7f3a757 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 _0x55ca=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','setTags','put','/:id','update','destroy','exports','multer','util','Router','fs-extra','../../components/interaction/service'];(function(_0x431c26,_0x4b8f47){var _0x3092fd=function(_0x4dca59){while(--_0x4dca59){_0x431c26['push'](_0x431c26['shift']());}};_0x3092fd(++_0x4b8f47);}(_0x55ca,0x126));var _0xa55c=function(_0x2c34ff,_0x1e8bee){_0x2c34ff=_0x2c34ff-0x0;var _0x476508=_0x55ca[_0x2c34ff];return _0x476508;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')]('/',auth[_0xa55c('0x8')](),controller[_0xa55c('0x9')]);router[_0xa55c('0x7')]('/:id',auth[_0xa55c('0x8')](),controller[_0xa55c('0xa')]);router['get'](_0xa55c('0xb'),auth[_0xa55c('0x8')](),controller['getFields']);router['get'](_0xa55c('0xc'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xd')]);router[_0xa55c('0x7')](_0xa55c('0xe'),auth[_0xa55c('0x8')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x7')](_0xa55c('0x10'),auth[_0xa55c('0x8')](),controller['getTags']);router['post']('/',auth[_0xa55c('0x8')](),controller['create']);router['post']('/:id/tags',auth[_0xa55c('0x8')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x14')]);router['delete'](_0xa55c('0x13'),auth[_0xa55c('0x8')](),controller[_0xa55c('0x15')]);module[_0xa55c('0x16')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x35de9d,_0x39d81c){var _0x2b3874=function(_0xf633dd){while(--_0xf633dd){_0x35de9d['push'](_0x35de9d['shift']());}};_0x2b3874(++_0x39d81c);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'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');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 6432248..ed8b10c 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 _0x7a1e=['STRING','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a1e,0x1a1));var _0xe7a1=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7a1e[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0xe7a1('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe7a1('0x1')]}}; \ No newline at end of file +var _0x9bf7=['sequelize','exports','STRING'];(function(_0x5d12bd,_0x30c47c){var _0x520b8b=function(_0x3a1d3d){while(--_0x3a1d3d){_0x5d12bd['push'](_0x5d12bd['shift']());}};_0x520b8b(++_0x30c47c);}(_0x9bf7,0x1ce));var _0x79bf=function(_0x4f16b5,_0xfb1151){_0x4f16b5=_0x4f16b5-0x0;var _0x3d471b=_0x9bf7[_0x4f16b5];return _0x3d471b;};'use strict';var Sequelize=require(_0x79bf('0x0'));module[_0x79bf('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x79bf('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 7e8caae..8bb8aff 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 _0x6a65=['find','create','body','getFields','DeskField','nolimit','getSubjects','findOne','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','ejs','crypto','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','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','then','error','name','map','DeskConfiguration','rawAttributes','type','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params'];(function(_0x1ef202,_0x56ed5c){var _0x2166ef=function(_0x280116){while(--_0x280116){_0x1ef202['push'](_0x1ef202['shift']());}};_0x2166ef(++_0x56ed5c);}(_0x6a65,0xf6));var _0x56a6=function(_0x4d6bc6,_0x1baffa){_0x4d6bc6=_0x4d6bc6-0x0;var _0x1c8865=_0x6a65[_0x4d6bc6];return _0x1c8865;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56a6('0x0'));var zipdir=require(_0x56a6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x56a6('0x2'));var moment=require(_0x56a6('0x3'));var BPromise=require(_0x56a6('0x4'));var Mustache=require(_0x56a6('0x5'));var util=require(_0x56a6('0x6'));var path=require(_0x56a6('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x56a6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x56a6('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x56a6('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x56a6('0xb'));var Redis=require(_0x56a6('0xc'));var authService=require(_0x56a6('0xd'));var qs=require(_0x56a6('0xe'));var as=require(_0x56a6('0xf'));var hardwareService=require(_0x56a6('0x10'));var logger=require(_0x56a6('0x11'))(_0x56a6('0x12'));var utils=require(_0x56a6('0x13'));var config=require(_0x56a6('0x14'));var licenseUtil=require(_0x56a6('0x15'));var db=require(_0x56a6('0x16'))['db'];function respondWithStatusCode(_0x27e2ec,_0x3e532f){_0x3e532f=_0x3e532f||0xcc;return function(_0x433cf2){if(_0x433cf2){return _0x27e2ec[_0x56a6('0x17')](_0x3e532f);}return _0x27e2ec[_0x56a6('0x18')](_0x3e532f)[_0x56a6('0x19')]();};}function respondWithResult(_0x28d214,_0x58dfce){_0x58dfce=_0x58dfce||0xc8;return function(_0x23456a){if(_0x23456a){return _0x28d214[_0x56a6('0x18')](_0x58dfce)[_0x56a6('0x1a')](_0x23456a);}};}function respondWithFilteredResult(_0x1cb26f,_0x128094){return function(_0xa8efc5){if(_0xa8efc5){var _0x4b6a95=typeof _0x128094['offset']===_0x56a6('0x1b')&&typeof _0x128094['limit']===_0x56a6('0x1b');var _0x4e6c2b=_0xa8efc5[_0x56a6('0x1c')];var _0x3d7f29=_0x4b6a95?0x0:_0x128094[_0x56a6('0x1d')];var _0x4cf391=_0x4b6a95?_0xa8efc5[_0x56a6('0x1c')]:_0x128094[_0x56a6('0x1d')]+_0x128094[_0x56a6('0x1e')];var _0x3ae264;if(_0x4cf391>=_0x4e6c2b){_0x4cf391=_0x4e6c2b;_0x3ae264=0xc8;}else{_0x3ae264=0xce;}_0x1cb26f[_0x56a6('0x18')](_0x3ae264);return _0x1cb26f[_0x56a6('0x1f')](_0x56a6('0x20'),_0x3d7f29+'-'+_0x4cf391+'/'+_0x4e6c2b)[_0x56a6('0x1a')](_0xa8efc5);}return null;};}function patchUpdates(_0x57c92f){return function(_0x395163){try{jsonpatch[_0x56a6('0x21')](_0x395163,_0x57c92f,!![]);}catch(_0x8401d5){return BPromise[_0x56a6('0x22')](_0x8401d5);}return _0x395163['save']();};}function saveUpdates(_0x372c4e,_0x13760e){return function(_0x263802){if(_0x263802){return _0x263802[_0x56a6('0x23')](_0x372c4e)['then'](function(_0x4c439f){return _0x4c439f;});}return null;};}function removeEntity(_0xc8f6d8,_0x446890){return function(_0x4839c6){if(_0x4839c6){return _0x4839c6[_0x56a6('0x24')]()[_0x56a6('0x25')](function(){_0xc8f6d8[_0x56a6('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cc905,_0x8260b4){return function(_0x18107e){if(!_0x18107e){_0x1cc905[_0x56a6('0x17')](0x194);}return _0x18107e;};}function handleError(_0x2225de,_0x4431fb){_0x4431fb=_0x4431fb||0x1f4;return function(_0x18ceb7){logger[_0x56a6('0x26')](_0x18ceb7['stack']);if(_0x18ceb7[_0x56a6('0x27')]){delete _0x18ceb7[_0x56a6('0x27')];}_0x2225de[_0x56a6('0x18')](_0x4431fb)['send'](_0x18ceb7);};}exports['index']=function(_0x1130ba,_0x27ccbd){var _0xe11ea2={},_0x299b45={},_0x4c1aff={'count':0x0,'rows':[]};var _0xeab7af=_[_0x56a6('0x28')](db[_0x56a6('0x29')][_0x56a6('0x2a')],function(_0x36da04){return{'name':_0x36da04['fieldName'],'type':_0x36da04[_0x56a6('0x2b')]['key']};});_0x299b45['model']=_[_0x56a6('0x28')](_0xeab7af,'name');_0x299b45[_0x56a6('0x2c')]=_[_0x56a6('0x2d')](_0x1130ba[_0x56a6('0x2c')]);_0x299b45['filters']=_[_0x56a6('0x2e')](_0x299b45[_0x56a6('0x2f')],_0x299b45[_0x56a6('0x2c')]);_0xe11ea2['attributes']=_[_0x56a6('0x2e')](_0x299b45[_0x56a6('0x2f')],qs['fields'](_0x1130ba[_0x56a6('0x2c')][_0x56a6('0x30')]));_0xe11ea2[_0x56a6('0x31')]=_0xe11ea2[_0x56a6('0x31')][_0x56a6('0x32')]?_0xe11ea2['attributes']:_0x299b45[_0x56a6('0x2f')];if(!_0x1130ba[_0x56a6('0x2c')][_0x56a6('0x33')]('nolimit')){_0xe11ea2[_0x56a6('0x1e')]=qs[_0x56a6('0x1e')](_0x1130ba[_0x56a6('0x2c')][_0x56a6('0x1e')]);_0xe11ea2[_0x56a6('0x1d')]=qs[_0x56a6('0x1d')](_0x1130ba[_0x56a6('0x2c')][_0x56a6('0x1d')]);}_0xe11ea2[_0x56a6('0x34')]=qs[_0x56a6('0x35')](_0x1130ba[_0x56a6('0x2c')]['sort']);_0xe11ea2[_0x56a6('0x36')]=qs[_0x56a6('0x37')](_[_0x56a6('0x38')](_0x1130ba[_0x56a6('0x2c')],_0x299b45[_0x56a6('0x37')]),_0xeab7af);if(_0x1130ba[_0x56a6('0x2c')][_0x56a6('0x39')]){_0xe11ea2[_0x56a6('0x36')]=_[_0x56a6('0x3a')](_0xe11ea2[_0x56a6('0x36')],{'$or':_['map'](_0xeab7af,function(_0x9f8a71){if(_0x9f8a71[_0x56a6('0x2b')]!==_0x56a6('0x3b')){var _0x536512={};_0x536512[_0x9f8a71[_0x56a6('0x27')]]={'$like':'%'+_0x1130ba[_0x56a6('0x2c')][_0x56a6('0x39')]+'%'};return _0x536512;}})});}_0xe11ea2=_['merge']({},_0xe11ea2,_0x1130ba[_0x56a6('0x3c')]);var _0x3127fa={'where':_0xe11ea2[_0x56a6('0x36')]};return db[_0x56a6('0x29')][_0x56a6('0x1c')](_0x3127fa)['then'](function(_0x477e2b){_0x4c1aff[_0x56a6('0x1c')]=_0x477e2b;if(_0x1130ba['query'][_0x56a6('0x3d')]){_0xe11ea2[_0x56a6('0x3e')]=[{'all':!![]}];}return db[_0x56a6('0x29')]['findAll'](_0xe11ea2);})[_0x56a6('0x25')](function(_0x579ae3){_0x4c1aff['rows']=_0x579ae3;return _0x4c1aff;})['then'](respondWithFilteredResult(_0x27ccbd,_0xe11ea2))[_0x56a6('0x3f')](handleError(_0x27ccbd,null));};exports[_0x56a6('0x40')]=function(_0x5b2eab,_0x3fdf28){var _0xed86b={'raw':![],'where':{'id':_0x5b2eab[_0x56a6('0x41')]['id']}},_0x28689b={};_0x28689b['model']=_['keys'](db[_0x56a6('0x29')][_0x56a6('0x2a')]);_0x28689b[_0x56a6('0x2c')]=_['keys'](_0x5b2eab[_0x56a6('0x2c')]);_0x28689b[_0x56a6('0x37')]=_['intersection'](_0x28689b['model'],_0x28689b[_0x56a6('0x2c')]);_0xed86b[_0x56a6('0x31')]=_[_0x56a6('0x2e')](_0x28689b[_0x56a6('0x2f')],qs[_0x56a6('0x30')](_0x5b2eab[_0x56a6('0x2c')][_0x56a6('0x30')]));_0xed86b['attributes']=_0xed86b['attributes']['length']?_0xed86b['attributes']:_0x28689b[_0x56a6('0x2f')];if(_0x5b2eab[_0x56a6('0x2c')][_0x56a6('0x3d')]){_0xed86b[_0x56a6('0x3e')]=[{'all':!![]}];}_0xed86b=_[_0x56a6('0x3a')]({},_0xed86b,_0x5b2eab[_0x56a6('0x3c')]);return db[_0x56a6('0x29')][_0x56a6('0x42')](_0xed86b)[_0x56a6('0x25')](handleEntityNotFound(_0x3fdf28,null))[_0x56a6('0x25')](respondWithResult(_0x3fdf28,null))[_0x56a6('0x3f')](handleError(_0x3fdf28,null));};exports[_0x56a6('0x43')]=function(_0x45ffe1,_0x3fdc90){return db[_0x56a6('0x29')][_0x56a6('0x43')](_0x45ffe1[_0x56a6('0x44')],{})[_0x56a6('0x25')](respondWithResult(_0x3fdc90,0xc9))['catch'](handleError(_0x3fdc90,null));};exports[_0x56a6('0x23')]=function(_0x2536fd,_0x292a0e){if(_0x2536fd['body']['id']){delete _0x2536fd[_0x56a6('0x44')]['id'];}return db[_0x56a6('0x29')][_0x56a6('0x42')]({'where':{'id':_0x2536fd[_0x56a6('0x41')]['id']}})[_0x56a6('0x25')](handleEntityNotFound(_0x292a0e,null))[_0x56a6('0x25')](saveUpdates(_0x2536fd[_0x56a6('0x44')],null))['then'](respondWithResult(_0x292a0e,null))[_0x56a6('0x3f')](handleError(_0x292a0e,null));};exports['destroy']=function(_0x2d0e67,_0x4a35bc){return db[_0x56a6('0x29')][_0x56a6('0x42')]({'where':{'id':_0x2d0e67[_0x56a6('0x41')]['id']}})[_0x56a6('0x25')](handleEntityNotFound(_0x4a35bc,null))['then'](removeEntity(_0x4a35bc,null))[_0x56a6('0x3f')](handleError(_0x4a35bc,null));};exports[_0x56a6('0x45')]=function(_0x1d82c8,_0x3d9a9c,_0x161188){var _0x1239f2={};var _0x4059b1={};var _0x3e74c8;var _0x2a9ee5;return db[_0x56a6('0x29')]['findOne']({'where':{'id':_0x1d82c8[_0x56a6('0x41')]['id']}})[_0x56a6('0x25')](handleEntityNotFound(_0x3d9a9c,null))[_0x56a6('0x25')](function(_0x12cc8e){if(_0x12cc8e){_0x3e74c8=_0x12cc8e;_0x4059b1[_0x56a6('0x2f')]=_[_0x56a6('0x2d')](db[_0x56a6('0x46')][_0x56a6('0x2a')]);_0x4059b1[_0x56a6('0x2c')]=_[_0x56a6('0x2d')](_0x1d82c8['query']);_0x4059b1[_0x56a6('0x37')]=_[_0x56a6('0x2e')](_0x4059b1[_0x56a6('0x2f')],_0x4059b1['query']);_0x1239f2[_0x56a6('0x31')]=_['intersection'](_0x4059b1[_0x56a6('0x2f')],qs[_0x56a6('0x30')](_0x1d82c8[_0x56a6('0x2c')]['fields']));_0x1239f2['attributes']=_0x1239f2[_0x56a6('0x31')][_0x56a6('0x32')]?_0x1239f2['attributes']:_0x4059b1['model'];_0x1239f2[_0x56a6('0x34')]=qs[_0x56a6('0x35')](_0x1d82c8['query']['sort']);_0x1239f2[_0x56a6('0x36')]=qs[_0x56a6('0x37')](_[_0x56a6('0x38')](_0x1d82c8['query'],_0x4059b1[_0x56a6('0x37')]));if(_0x1d82c8[_0x56a6('0x2c')][_0x56a6('0x39')]){_0x1239f2['where']=_[_0x56a6('0x3a')](_0x1239f2[_0x56a6('0x36')],{'$or':_[_0x56a6('0x28')](_0x1239f2[_0x56a6('0x31')],function(_0x30b26f){var _0x1f96b5={};_0x1f96b5[_0x30b26f]={'$like':'%'+_0x1d82c8[_0x56a6('0x2c')][_0x56a6('0x39')]+'%'};return _0x1f96b5;})});}_0x1239f2=_[_0x56a6('0x3a')]({},_0x1239f2,_0x1d82c8[_0x56a6('0x3c')]);return _0x3e74c8['getFields'](_0x1239f2);}})[_0x56a6('0x25')](function(_0x299a9e){if(_0x299a9e){_0x2a9ee5=_0x299a9e['length'];if(!_0x1d82c8[_0x56a6('0x2c')][_0x56a6('0x33')](_0x56a6('0x47'))){_0x1239f2['limit']=qs[_0x56a6('0x1e')](_0x1d82c8[_0x56a6('0x2c')][_0x56a6('0x1e')]);_0x1239f2[_0x56a6('0x1d')]=qs['offset'](_0x1d82c8[_0x56a6('0x2c')][_0x56a6('0x1d')]);}return _0x3e74c8[_0x56a6('0x45')](_0x1239f2);}})[_0x56a6('0x25')](function(_0xcd88cb){if(_0xcd88cb){return _0xcd88cb?{'count':_0x2a9ee5,'rows':_0xcd88cb}:null;}})[_0x56a6('0x25')](respondWithResult(_0x3d9a9c,null))[_0x56a6('0x3f')](handleError(_0x3d9a9c,null));};exports[_0x56a6('0x48')]=function(_0x2b253d,_0x1fa62,_0x5d4bd8){var _0x2a8642={};var _0x100fab={};var _0x720bd8;var _0x21b8a4;return db[_0x56a6('0x29')][_0x56a6('0x49')]({'where':{'id':_0x2b253d[_0x56a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x1fa62,null))[_0x56a6('0x25')](function(_0x5b7b59){if(_0x5b7b59){_0x720bd8=_0x5b7b59;_0x100fab['model']=_[_0x56a6('0x2d')](db[_0x56a6('0x46')][_0x56a6('0x2a')]);_0x100fab[_0x56a6('0x2c')]=_[_0x56a6('0x2d')](_0x2b253d[_0x56a6('0x2c')]);_0x100fab['filters']=_[_0x56a6('0x2e')](_0x100fab[_0x56a6('0x2f')],_0x100fab['query']);_0x2a8642['attributes']=_[_0x56a6('0x2e')](_0x100fab[_0x56a6('0x2f')],qs[_0x56a6('0x30')](_0x2b253d[_0x56a6('0x2c')]['fields']));_0x2a8642[_0x56a6('0x31')]=_0x2a8642[_0x56a6('0x31')]['length']?_0x2a8642[_0x56a6('0x31')]:_0x100fab[_0x56a6('0x2f')];_0x2a8642[_0x56a6('0x34')]=qs[_0x56a6('0x35')](_0x2b253d[_0x56a6('0x2c')][_0x56a6('0x35')]);_0x2a8642[_0x56a6('0x36')]=qs[_0x56a6('0x37')](_[_0x56a6('0x38')](_0x2b253d[_0x56a6('0x2c')],_0x100fab[_0x56a6('0x37')]));if(_0x2b253d['query'][_0x56a6('0x39')]){_0x2a8642[_0x56a6('0x36')]=_[_0x56a6('0x3a')](_0x2a8642['where'],{'$or':_['map'](_0x2a8642['attributes'],function(_0x1d5a41){var _0x43b74e={};_0x43b74e[_0x1d5a41]={'$like':'%'+_0x2b253d['query'][_0x56a6('0x39')]+'%'};return _0x43b74e;})});}_0x2a8642=_[_0x56a6('0x3a')]({},_0x2a8642,_0x2b253d[_0x56a6('0x3c')]);return _0x720bd8[_0x56a6('0x48')](_0x2a8642);}})[_0x56a6('0x25')](function(_0x544e81){if(_0x544e81){_0x21b8a4=_0x544e81[_0x56a6('0x32')];if(!_0x2b253d[_0x56a6('0x2c')]['hasOwnProperty']('nolimit')){_0x2a8642[_0x56a6('0x1e')]=qs[_0x56a6('0x1e')](_0x2b253d['query'][_0x56a6('0x1e')]);_0x2a8642[_0x56a6('0x1d')]=qs['offset'](_0x2b253d[_0x56a6('0x2c')][_0x56a6('0x1d')]);}return _0x720bd8['getSubjects'](_0x2a8642);}})['then'](function(_0x38502f){if(_0x38502f){return _0x38502f?{'count':_0x21b8a4,'rows':_0x38502f}:null;}})[_0x56a6('0x25')](respondWithResult(_0x1fa62,null))[_0x56a6('0x3f')](handleError(_0x1fa62,null));};exports['getDescriptions']=function(_0x39397f,_0x383670,_0x43a938){var _0x2a38dd={};var _0x56332a={};var _0x1aa679;var _0x42318c;return db['DeskConfiguration'][_0x56a6('0x49')]({'where':{'id':_0x39397f['params']['id']}})['then'](handleEntityNotFound(_0x383670,null))[_0x56a6('0x25')](function(_0x14b131){if(_0x14b131){_0x1aa679=_0x14b131;_0x56332a[_0x56a6('0x2f')]=_[_0x56a6('0x2d')](db[_0x56a6('0x46')]['rawAttributes']);_0x56332a[_0x56a6('0x2c')]=_['keys'](_0x39397f['query']);_0x56332a[_0x56a6('0x37')]=_[_0x56a6('0x2e')](_0x56332a[_0x56a6('0x2f')],_0x56332a[_0x56a6('0x2c')]);_0x2a38dd['attributes']=_[_0x56a6('0x2e')](_0x56332a[_0x56a6('0x2f')],qs[_0x56a6('0x30')](_0x39397f[_0x56a6('0x2c')][_0x56a6('0x30')]));_0x2a38dd[_0x56a6('0x31')]=_0x2a38dd['attributes'][_0x56a6('0x32')]?_0x2a38dd['attributes']:_0x56332a[_0x56a6('0x2f')];_0x2a38dd[_0x56a6('0x34')]=qs[_0x56a6('0x35')](_0x39397f[_0x56a6('0x2c')][_0x56a6('0x35')]);_0x2a38dd['where']=qs[_0x56a6('0x37')](_['pick'](_0x39397f[_0x56a6('0x2c')],_0x56332a[_0x56a6('0x37')]));if(_0x39397f[_0x56a6('0x2c')]['filter']){_0x2a38dd[_0x56a6('0x36')]=_[_0x56a6('0x3a')](_0x2a38dd['where'],{'$or':_[_0x56a6('0x28')](_0x2a38dd[_0x56a6('0x31')],function(_0x4555c0){var _0x498fb1={};_0x498fb1[_0x4555c0]={'$like':'%'+_0x39397f[_0x56a6('0x2c')][_0x56a6('0x39')]+'%'};return _0x498fb1;})});}_0x2a38dd=_[_0x56a6('0x3a')]({},_0x2a38dd,_0x39397f[_0x56a6('0x3c')]);return _0x1aa679[_0x56a6('0x4a')](_0x2a38dd);}})[_0x56a6('0x25')](function(_0x82ca59){if(_0x82ca59){_0x42318c=_0x82ca59[_0x56a6('0x32')];if(!_0x39397f['query'][_0x56a6('0x33')](_0x56a6('0x47'))){_0x2a38dd[_0x56a6('0x1e')]=qs[_0x56a6('0x1e')](_0x39397f['query'][_0x56a6('0x1e')]);_0x2a38dd[_0x56a6('0x1d')]=qs[_0x56a6('0x1d')](_0x39397f[_0x56a6('0x2c')][_0x56a6('0x1d')]);}return _0x1aa679[_0x56a6('0x4a')](_0x2a38dd);}})[_0x56a6('0x25')](function(_0x460507){if(_0x460507){return _0x460507?{'count':_0x42318c,'rows':_0x460507}:null;}})[_0x56a6('0x25')](respondWithResult(_0x383670,null))[_0x56a6('0x3f')](handleError(_0x383670,null));};exports[_0x56a6('0x4b')]=function(_0x18de0e,_0x435405,_0x301c35){var _0xdb6c3f={};var _0x4e9b9a={};var _0x4729e1;var _0x395f6b;return db[_0x56a6('0x29')][_0x56a6('0x49')]({'where':{'id':_0x18de0e[_0x56a6('0x41')]['id']}})['then'](handleEntityNotFound(_0x435405,null))[_0x56a6('0x25')](function(_0x4f7540){if(_0x4f7540){_0x4729e1=_0x4f7540;_0x4e9b9a[_0x56a6('0x2f')]=_[_0x56a6('0x2d')](db['Tag']['rawAttributes']);_0x4e9b9a[_0x56a6('0x2c')]=_['keys'](_0x18de0e[_0x56a6('0x2c')]);_0x4e9b9a['filters']=_[_0x56a6('0x2e')](_0x4e9b9a[_0x56a6('0x2f')],_0x4e9b9a[_0x56a6('0x2c')]);_0xdb6c3f[_0x56a6('0x31')]=_['intersection'](_0x4e9b9a[_0x56a6('0x2f')],qs[_0x56a6('0x30')](_0x18de0e[_0x56a6('0x2c')]['fields']));_0xdb6c3f[_0x56a6('0x31')]=_0xdb6c3f['attributes']['length']?_0xdb6c3f[_0x56a6('0x31')]:_0x4e9b9a[_0x56a6('0x2f')];_0xdb6c3f[_0x56a6('0x34')]=qs[_0x56a6('0x35')](_0x18de0e[_0x56a6('0x2c')]['sort']);_0xdb6c3f['where']=qs[_0x56a6('0x37')](_[_0x56a6('0x38')](_0x18de0e[_0x56a6('0x2c')],_0x4e9b9a[_0x56a6('0x37')]));if(_0x18de0e[_0x56a6('0x2c')]['filter']){_0xdb6c3f[_0x56a6('0x36')]=_[_0x56a6('0x3a')](_0xdb6c3f[_0x56a6('0x36')],{'$or':_[_0x56a6('0x28')](_0xdb6c3f['attributes'],function(_0x20c4f2){var _0x1bae0f={};_0x1bae0f[_0x20c4f2]={'$like':'%'+_0x18de0e[_0x56a6('0x2c')][_0x56a6('0x39')]+'%'};return _0x1bae0f;})});}_0xdb6c3f=_[_0x56a6('0x3a')]({},_0xdb6c3f,_0x18de0e[_0x56a6('0x3c')]);return _0x4729e1['getTags'](_0xdb6c3f);}})['then'](function(_0x35b42a){if(_0x35b42a){_0x395f6b=_0x35b42a[_0x56a6('0x32')];if(!_0x18de0e['query']['hasOwnProperty'](_0x56a6('0x47'))){_0xdb6c3f[_0x56a6('0x1e')]=qs[_0x56a6('0x1e')](_0x18de0e[_0x56a6('0x2c')][_0x56a6('0x1e')]);_0xdb6c3f['offset']=qs[_0x56a6('0x1d')](_0x18de0e[_0x56a6('0x2c')]['offset']);}return _0x4729e1[_0x56a6('0x4b')](_0xdb6c3f);}})['then'](function(_0x1f1cb6){if(_0x1f1cb6){return _0x1f1cb6?{'count':_0x395f6b,'rows':_0x1f1cb6}:null;}})['then'](respondWithResult(_0x435405,null))[_0x56a6('0x3f')](handleError(_0x435405,null));};exports[_0x56a6('0x4c')]=function(_0x5a6338,_0x150ee1,_0x50affe){if(_0x5a6338[_0x56a6('0x44')]['id']){delete _0x5a6338[_0x56a6('0x44')]['id'];}return db[_0x56a6('0x29')][_0x56a6('0x49')]({'where':{'id':_0x5a6338[_0x56a6('0x41')]['id']}})[_0x56a6('0x25')](handleEntityNotFound(_0x150ee1,null))[_0x56a6('0x25')](function(_0x2f5a48){if(_0x2f5a48){return _0x2f5a48[_0x56a6('0x4c')](_0x5a6338[_0x56a6('0x44')][_0x56a6('0x4d')]||[]);}return null;})[_0x56a6('0x25')](respondWithResult(_0x150ee1,null))[_0x56a6('0x3f')](handleError(_0x150ee1,null));}; \ No newline at end of file +var _0xcba0=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','count','includeAll','include','rows','show','params','keys','rawAttributes','find','create','body','catch','destroy','getFields','findOne','DeskField','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','fs-extra','lodash','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','status','json','limit','offset','set','Content-Range','apply','save','update','then','end','name','send','map','DeskConfiguration','fieldName','model','query'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xcba0,0xc0));var _0x0cba=function(_0x18c8b0,_0x3e1c87){_0x18c8b0=_0x18c8b0-0x0;var _0x1dc91c=_0xcba0[_0x18c8b0];return _0x1dc91c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0cba('0x0'));var zipdir=require(_0x0cba('0x1'));var jsonpatch=require(_0x0cba('0x2'));var rp=require(_0x0cba('0x3'));var moment=require(_0x0cba('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x0cba('0x5'));var path=require('path');var sox=require(_0x0cba('0x6'));var csv=require(_0x0cba('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0cba('0x8'));var _=require(_0x0cba('0x9'));var squel=require('squel');var crypto=require(_0x0cba('0xa'));var jsforce=require(_0x0cba('0xb'));var deskjs=require(_0x0cba('0xc'));var toCsv=require(_0x0cba('0x7'));var querystring=require(_0x0cba('0xd'));var Papa=require('papaparse');var Redis=require(_0x0cba('0xe'));var authService=require(_0x0cba('0xf'));var qs=require(_0x0cba('0x10'));var as=require(_0x0cba('0x11'));var hardwareService=require(_0x0cba('0x12'));var logger=require(_0x0cba('0x13'))(_0x0cba('0x14'));var utils=require(_0x0cba('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0cba('0x16'));var db=require(_0x0cba('0x17'))['db'];function respondWithStatusCode(_0xff5e4e,_0x4fcaa0){_0x4fcaa0=_0x4fcaa0||0xcc;return function(_0x590c3e){if(_0x590c3e){return _0xff5e4e['sendStatus'](_0x4fcaa0);}return _0xff5e4e[_0x0cba('0x18')](_0x4fcaa0)['end']();};}function respondWithResult(_0x464714,_0x1e882b){_0x1e882b=_0x1e882b||0xc8;return function(_0x51c060){if(_0x51c060){return _0x464714[_0x0cba('0x18')](_0x1e882b)[_0x0cba('0x19')](_0x51c060);}};}function respondWithFilteredResult(_0x3deb0f,_0x1fde35){return function(_0x24058b){if(_0x24058b){var _0x24dbd4=typeof _0x1fde35['offset']==='undefined'&&typeof _0x1fde35[_0x0cba('0x1a')]==='undefined';var _0x4ff241=_0x24058b['count'];var _0x157e27=_0x24dbd4?0x0:_0x1fde35['offset'];var _0x56ef96=_0x24dbd4?_0x24058b['count']:_0x1fde35[_0x0cba('0x1b')]+_0x1fde35['limit'];var _0xabe120;if(_0x56ef96>=_0x4ff241){_0x56ef96=_0x4ff241;_0xabe120=0xc8;}else{_0xabe120=0xce;}_0x3deb0f['status'](_0xabe120);return _0x3deb0f[_0x0cba('0x1c')](_0x0cba('0x1d'),_0x157e27+'-'+_0x56ef96+'/'+_0x4ff241)[_0x0cba('0x19')](_0x24058b);}return null;};}function patchUpdates(_0x135927){return function(_0x48478d){try{jsonpatch[_0x0cba('0x1e')](_0x48478d,_0x135927,!![]);}catch(_0xfe4969){return BPromise['reject'](_0xfe4969);}return _0x48478d[_0x0cba('0x1f')]();};}function saveUpdates(_0xe24a4e,_0x2d6800){return function(_0x3e7181){if(_0x3e7181){return _0x3e7181[_0x0cba('0x20')](_0xe24a4e)[_0x0cba('0x21')](function(_0x11a292){return _0x11a292;});}return null;};}function removeEntity(_0xf4504,_0x4028b9){return function(_0x265fa6){if(_0x265fa6){return _0x265fa6['destroy']()[_0x0cba('0x21')](function(){_0xf4504[_0x0cba('0x18')](0xcc)[_0x0cba('0x22')]();});}};}function handleEntityNotFound(_0x290f2c,_0x11ee31){return function(_0x5d5a47){if(!_0x5d5a47){_0x290f2c['sendStatus'](0x194);}return _0x5d5a47;};}function handleError(_0x43f289,_0x5c5464){_0x5c5464=_0x5c5464||0x1f4;return function(_0x3df455){logger['error'](_0x3df455['stack']);if(_0x3df455[_0x0cba('0x23')]){delete _0x3df455[_0x0cba('0x23')];}_0x43f289['status'](_0x5c5464)[_0x0cba('0x24')](_0x3df455);};}exports['index']=function(_0x569f6b,_0x4e2d0f){var _0x4aace9={},_0x1d3bd7={},_0x3edef8={'count':0x0,'rows':[]};var _0x17df40=_[_0x0cba('0x25')](db[_0x0cba('0x26')]['rawAttributes'],function(_0xf413c2){return{'name':_0xf413c2[_0x0cba('0x27')],'type':_0xf413c2['type']['key']};});_0x1d3bd7[_0x0cba('0x28')]=_[_0x0cba('0x25')](_0x17df40,'name');_0x1d3bd7[_0x0cba('0x29')]=_['keys'](_0x569f6b[_0x0cba('0x29')]);_0x1d3bd7[_0x0cba('0x2a')]=_[_0x0cba('0x2b')](_0x1d3bd7[_0x0cba('0x28')],_0x1d3bd7[_0x0cba('0x29')]);_0x4aace9['attributes']=_[_0x0cba('0x2b')](_0x1d3bd7[_0x0cba('0x28')],qs[_0x0cba('0x2c')](_0x569f6b[_0x0cba('0x29')][_0x0cba('0x2c')]));_0x4aace9['attributes']=_0x4aace9[_0x0cba('0x2d')][_0x0cba('0x2e')]?_0x4aace9['attributes']:_0x1d3bd7[_0x0cba('0x28')];if(!_0x569f6b['query'][_0x0cba('0x2f')](_0x0cba('0x30'))){_0x4aace9['limit']=qs['limit'](_0x569f6b[_0x0cba('0x29')][_0x0cba('0x1a')]);_0x4aace9[_0x0cba('0x1b')]=qs[_0x0cba('0x1b')](_0x569f6b[_0x0cba('0x29')]['offset']);}_0x4aace9[_0x0cba('0x31')]=qs[_0x0cba('0x32')](_0x569f6b[_0x0cba('0x29')][_0x0cba('0x32')]);_0x4aace9[_0x0cba('0x33')]=qs[_0x0cba('0x2a')](_[_0x0cba('0x34')](_0x569f6b[_0x0cba('0x29')],_0x1d3bd7['filters']),_0x17df40);if(_0x569f6b[_0x0cba('0x29')][_0x0cba('0x35')]){_0x4aace9[_0x0cba('0x33')]=_[_0x0cba('0x36')](_0x4aace9['where'],{'$or':_[_0x0cba('0x25')](_0x17df40,function(_0xccd189){if(_0xccd189[_0x0cba('0x37')]!=='VIRTUAL'){var _0x429688={};_0x429688[_0xccd189[_0x0cba('0x23')]]={'$like':'%'+_0x569f6b[_0x0cba('0x29')][_0x0cba('0x35')]+'%'};return _0x429688;}})});}_0x4aace9=_[_0x0cba('0x36')]({},_0x4aace9,_0x569f6b[_0x0cba('0x38')]);var _0x5b71ac={'where':_0x4aace9[_0x0cba('0x33')]};return db[_0x0cba('0x26')][_0x0cba('0x39')](_0x5b71ac)['then'](function(_0x22ac83){_0x3edef8['count']=_0x22ac83;if(_0x569f6b[_0x0cba('0x29')][_0x0cba('0x3a')]){_0x4aace9[_0x0cba('0x3b')]=[{'all':!![]}];}return db[_0x0cba('0x26')]['findAll'](_0x4aace9);})[_0x0cba('0x21')](function(_0x29efea){_0x3edef8[_0x0cba('0x3c')]=_0x29efea;return _0x3edef8;})[_0x0cba('0x21')](respondWithFilteredResult(_0x4e2d0f,_0x4aace9))['catch'](handleError(_0x4e2d0f,null));};exports[_0x0cba('0x3d')]=function(_0x46ae0,_0x4c1dff){var _0x56b7c5={'raw':![],'where':{'id':_0x46ae0[_0x0cba('0x3e')]['id']}},_0x146495={};_0x146495[_0x0cba('0x28')]=_[_0x0cba('0x3f')](db[_0x0cba('0x26')][_0x0cba('0x40')]);_0x146495[_0x0cba('0x29')]=_[_0x0cba('0x3f')](_0x46ae0[_0x0cba('0x29')]);_0x146495['filters']=_['intersection'](_0x146495['model'],_0x146495['query']);_0x56b7c5[_0x0cba('0x2d')]=_[_0x0cba('0x2b')](_0x146495[_0x0cba('0x28')],qs['fields'](_0x46ae0[_0x0cba('0x29')][_0x0cba('0x2c')]));_0x56b7c5[_0x0cba('0x2d')]=_0x56b7c5[_0x0cba('0x2d')][_0x0cba('0x2e')]?_0x56b7c5[_0x0cba('0x2d')]:_0x146495['model'];if(_0x46ae0[_0x0cba('0x29')][_0x0cba('0x3a')]){_0x56b7c5[_0x0cba('0x3b')]=[{'all':!![]}];}_0x56b7c5=_[_0x0cba('0x36')]({},_0x56b7c5,_0x46ae0[_0x0cba('0x38')]);return db[_0x0cba('0x26')][_0x0cba('0x41')](_0x56b7c5)[_0x0cba('0x21')](handleEntityNotFound(_0x4c1dff,null))[_0x0cba('0x21')](respondWithResult(_0x4c1dff,null))['catch'](handleError(_0x4c1dff,null));};exports[_0x0cba('0x42')]=function(_0x229f5d,_0x317cc4){return db[_0x0cba('0x26')][_0x0cba('0x42')](_0x229f5d[_0x0cba('0x43')],{})['then'](respondWithResult(_0x317cc4,0xc9))[_0x0cba('0x44')](handleError(_0x317cc4,null));};exports[_0x0cba('0x20')]=function(_0x5aaa21,_0x405076){if(_0x5aaa21[_0x0cba('0x43')]['id']){delete _0x5aaa21['body']['id'];}return db['DeskConfiguration'][_0x0cba('0x41')]({'where':{'id':_0x5aaa21[_0x0cba('0x3e')]['id']}})[_0x0cba('0x21')](handleEntityNotFound(_0x405076,null))[_0x0cba('0x21')](saveUpdates(_0x5aaa21['body'],null))[_0x0cba('0x21')](respondWithResult(_0x405076,null))[_0x0cba('0x44')](handleError(_0x405076,null));};exports[_0x0cba('0x45')]=function(_0x59e5b3,_0x316782){return db[_0x0cba('0x26')]['find']({'where':{'id':_0x59e5b3['params']['id']}})['then'](handleEntityNotFound(_0x316782,null))[_0x0cba('0x21')](removeEntity(_0x316782,null))[_0x0cba('0x44')](handleError(_0x316782,null));};exports[_0x0cba('0x46')]=function(_0x1d56df,_0x25d667,_0x365826){var _0x481f4e={};var _0x30797f={};var _0x51fe3f;var _0x5038c4;return db[_0x0cba('0x26')][_0x0cba('0x47')]({'where':{'id':_0x1d56df[_0x0cba('0x3e')]['id']}})[_0x0cba('0x21')](handleEntityNotFound(_0x25d667,null))['then'](function(_0x26f293){if(_0x26f293){_0x51fe3f=_0x26f293;_0x30797f[_0x0cba('0x28')]=_[_0x0cba('0x3f')](db[_0x0cba('0x48')]['rawAttributes']);_0x30797f[_0x0cba('0x29')]=_[_0x0cba('0x3f')](_0x1d56df[_0x0cba('0x29')]);_0x30797f[_0x0cba('0x2a')]=_[_0x0cba('0x2b')](_0x30797f['model'],_0x30797f[_0x0cba('0x29')]);_0x481f4e['attributes']=_[_0x0cba('0x2b')](_0x30797f['model'],qs[_0x0cba('0x2c')](_0x1d56df['query'][_0x0cba('0x2c')]));_0x481f4e['attributes']=_0x481f4e[_0x0cba('0x2d')]['length']?_0x481f4e['attributes']:_0x30797f[_0x0cba('0x28')];_0x481f4e[_0x0cba('0x31')]=qs[_0x0cba('0x32')](_0x1d56df['query']['sort']);_0x481f4e[_0x0cba('0x33')]=qs[_0x0cba('0x2a')](_[_0x0cba('0x34')](_0x1d56df['query'],_0x30797f[_0x0cba('0x2a')]));if(_0x1d56df[_0x0cba('0x29')][_0x0cba('0x35')]){_0x481f4e[_0x0cba('0x33')]=_[_0x0cba('0x36')](_0x481f4e[_0x0cba('0x33')],{'$or':_['map'](_0x481f4e[_0x0cba('0x2d')],function(_0x1458eb){var _0x1264c9={};_0x1264c9[_0x1458eb]={'$like':'%'+_0x1d56df[_0x0cba('0x29')]['filter']+'%'};return _0x1264c9;})});}_0x481f4e=_[_0x0cba('0x36')]({},_0x481f4e,_0x1d56df[_0x0cba('0x38')]);return _0x51fe3f['getFields'](_0x481f4e);}})[_0x0cba('0x21')](function(_0x32f410){if(_0x32f410){_0x5038c4=_0x32f410[_0x0cba('0x2e')];if(!_0x1d56df[_0x0cba('0x29')][_0x0cba('0x2f')]('nolimit')){_0x481f4e[_0x0cba('0x1a')]=qs[_0x0cba('0x1a')](_0x1d56df['query'][_0x0cba('0x1a')]);_0x481f4e[_0x0cba('0x1b')]=qs[_0x0cba('0x1b')](_0x1d56df['query'][_0x0cba('0x1b')]);}return _0x51fe3f['getFields'](_0x481f4e);}})[_0x0cba('0x21')](function(_0x5888fe){if(_0x5888fe){return _0x5888fe?{'count':_0x5038c4,'rows':_0x5888fe}:null;}})[_0x0cba('0x21')](respondWithResult(_0x25d667,null))[_0x0cba('0x44')](handleError(_0x25d667,null));};exports[_0x0cba('0x49')]=function(_0x21b021,_0x451095,_0x555a69){var _0xf5636={};var _0xf3dd7={};var _0x59bf9f;var _0x199eb9;return db['DeskConfiguration'][_0x0cba('0x47')]({'where':{'id':_0x21b021[_0x0cba('0x3e')]['id']}})['then'](handleEntityNotFound(_0x451095,null))[_0x0cba('0x21')](function(_0x157dec){if(_0x157dec){_0x59bf9f=_0x157dec;_0xf3dd7['model']=_[_0x0cba('0x3f')](db['DeskField'][_0x0cba('0x40')]);_0xf3dd7[_0x0cba('0x29')]=_[_0x0cba('0x3f')](_0x21b021[_0x0cba('0x29')]);_0xf3dd7['filters']=_['intersection'](_0xf3dd7[_0x0cba('0x28')],_0xf3dd7[_0x0cba('0x29')]);_0xf5636[_0x0cba('0x2d')]=_['intersection'](_0xf3dd7[_0x0cba('0x28')],qs[_0x0cba('0x2c')](_0x21b021[_0x0cba('0x29')][_0x0cba('0x2c')]));_0xf5636['attributes']=_0xf5636[_0x0cba('0x2d')][_0x0cba('0x2e')]?_0xf5636[_0x0cba('0x2d')]:_0xf3dd7['model'];_0xf5636['order']=qs[_0x0cba('0x32')](_0x21b021['query'][_0x0cba('0x32')]);_0xf5636[_0x0cba('0x33')]=qs[_0x0cba('0x2a')](_[_0x0cba('0x34')](_0x21b021[_0x0cba('0x29')],_0xf3dd7['filters']));if(_0x21b021[_0x0cba('0x29')][_0x0cba('0x35')]){_0xf5636[_0x0cba('0x33')]=_[_0x0cba('0x36')](_0xf5636[_0x0cba('0x33')],{'$or':_[_0x0cba('0x25')](_0xf5636['attributes'],function(_0x35e5b1){var _0x2fe6d0={};_0x2fe6d0[_0x35e5b1]={'$like':'%'+_0x21b021[_0x0cba('0x29')][_0x0cba('0x35')]+'%'};return _0x2fe6d0;})});}_0xf5636=_[_0x0cba('0x36')]({},_0xf5636,_0x21b021['options']);return _0x59bf9f['getSubjects'](_0xf5636);}})[_0x0cba('0x21')](function(_0x17be79){if(_0x17be79){_0x199eb9=_0x17be79['length'];if(!_0x21b021[_0x0cba('0x29')][_0x0cba('0x2f')](_0x0cba('0x30'))){_0xf5636[_0x0cba('0x1a')]=qs[_0x0cba('0x1a')](_0x21b021[_0x0cba('0x29')][_0x0cba('0x1a')]);_0xf5636[_0x0cba('0x1b')]=qs[_0x0cba('0x1b')](_0x21b021[_0x0cba('0x29')][_0x0cba('0x1b')]);}return _0x59bf9f[_0x0cba('0x49')](_0xf5636);}})[_0x0cba('0x21')](function(_0x1eed6b){if(_0x1eed6b){return _0x1eed6b?{'count':_0x199eb9,'rows':_0x1eed6b}:null;}})['then'](respondWithResult(_0x451095,null))[_0x0cba('0x44')](handleError(_0x451095,null));};exports[_0x0cba('0x4a')]=function(_0x3df64a,_0x44131b,_0x5183c7){var _0x5d1d19={};var _0x55708d={};var _0x2354dd;var _0x15960c;return db[_0x0cba('0x26')][_0x0cba('0x47')]({'where':{'id':_0x3df64a[_0x0cba('0x3e')]['id']}})[_0x0cba('0x21')](handleEntityNotFound(_0x44131b,null))[_0x0cba('0x21')](function(_0x301bd7){if(_0x301bd7){_0x2354dd=_0x301bd7;_0x55708d['model']=_[_0x0cba('0x3f')](db['DeskField'][_0x0cba('0x40')]);_0x55708d[_0x0cba('0x29')]=_[_0x0cba('0x3f')](_0x3df64a['query']);_0x55708d[_0x0cba('0x2a')]=_[_0x0cba('0x2b')](_0x55708d[_0x0cba('0x28')],_0x55708d[_0x0cba('0x29')]);_0x5d1d19[_0x0cba('0x2d')]=_[_0x0cba('0x2b')](_0x55708d[_0x0cba('0x28')],qs['fields'](_0x3df64a[_0x0cba('0x29')][_0x0cba('0x2c')]));_0x5d1d19[_0x0cba('0x2d')]=_0x5d1d19[_0x0cba('0x2d')][_0x0cba('0x2e')]?_0x5d1d19['attributes']:_0x55708d[_0x0cba('0x28')];_0x5d1d19[_0x0cba('0x31')]=qs['sort'](_0x3df64a['query'][_0x0cba('0x32')]);_0x5d1d19[_0x0cba('0x33')]=qs[_0x0cba('0x2a')](_[_0x0cba('0x34')](_0x3df64a[_0x0cba('0x29')],_0x55708d[_0x0cba('0x2a')]));if(_0x3df64a['query'][_0x0cba('0x35')]){_0x5d1d19[_0x0cba('0x33')]=_[_0x0cba('0x36')](_0x5d1d19[_0x0cba('0x33')],{'$or':_[_0x0cba('0x25')](_0x5d1d19[_0x0cba('0x2d')],function(_0x15cf14){var _0x597c05={};_0x597c05[_0x15cf14]={'$like':'%'+_0x3df64a[_0x0cba('0x29')]['filter']+'%'};return _0x597c05;})});}_0x5d1d19=_[_0x0cba('0x36')]({},_0x5d1d19,_0x3df64a['options']);return _0x2354dd[_0x0cba('0x4a')](_0x5d1d19);}})[_0x0cba('0x21')](function(_0xeb62f3){if(_0xeb62f3){_0x15960c=_0xeb62f3['length'];if(!_0x3df64a[_0x0cba('0x29')][_0x0cba('0x2f')](_0x0cba('0x30'))){_0x5d1d19[_0x0cba('0x1a')]=qs['limit'](_0x3df64a[_0x0cba('0x29')]['limit']);_0x5d1d19[_0x0cba('0x1b')]=qs['offset'](_0x3df64a[_0x0cba('0x29')][_0x0cba('0x1b')]);}return _0x2354dd[_0x0cba('0x4a')](_0x5d1d19);}})[_0x0cba('0x21')](function(_0x4c3586){if(_0x4c3586){return _0x4c3586?{'count':_0x15960c,'rows':_0x4c3586}:null;}})['then'](respondWithResult(_0x44131b,null))[_0x0cba('0x44')](handleError(_0x44131b,null));};exports[_0x0cba('0x4b')]=function(_0x10685f,_0x5927b1,_0x271c3e){var _0x2508ad={};var _0x2ad37c={};var _0x124165;var _0x534cb7;return db[_0x0cba('0x26')][_0x0cba('0x47')]({'where':{'id':_0x10685f[_0x0cba('0x3e')]['id']}})[_0x0cba('0x21')](handleEntityNotFound(_0x5927b1,null))['then'](function(_0x51bbe3){if(_0x51bbe3){_0x124165=_0x51bbe3;_0x2ad37c[_0x0cba('0x28')]=_['keys'](db['Tag'][_0x0cba('0x40')]);_0x2ad37c['query']=_[_0x0cba('0x3f')](_0x10685f[_0x0cba('0x29')]);_0x2ad37c[_0x0cba('0x2a')]=_[_0x0cba('0x2b')](_0x2ad37c[_0x0cba('0x28')],_0x2ad37c['query']);_0x2508ad['attributes']=_[_0x0cba('0x2b')](_0x2ad37c[_0x0cba('0x28')],qs['fields'](_0x10685f['query'][_0x0cba('0x2c')]));_0x2508ad[_0x0cba('0x2d')]=_0x2508ad[_0x0cba('0x2d')]['length']?_0x2508ad[_0x0cba('0x2d')]:_0x2ad37c[_0x0cba('0x28')];_0x2508ad[_0x0cba('0x31')]=qs[_0x0cba('0x32')](_0x10685f[_0x0cba('0x29')][_0x0cba('0x32')]);_0x2508ad[_0x0cba('0x33')]=qs[_0x0cba('0x2a')](_[_0x0cba('0x34')](_0x10685f['query'],_0x2ad37c[_0x0cba('0x2a')]));if(_0x10685f[_0x0cba('0x29')][_0x0cba('0x35')]){_0x2508ad[_0x0cba('0x33')]=_['merge'](_0x2508ad['where'],{'$or':_['map'](_0x2508ad['attributes'],function(_0x463eb2){var _0xaf660f={};_0xaf660f[_0x463eb2]={'$like':'%'+_0x10685f[_0x0cba('0x29')][_0x0cba('0x35')]+'%'};return _0xaf660f;})});}_0x2508ad=_[_0x0cba('0x36')]({},_0x2508ad,_0x10685f[_0x0cba('0x38')]);return _0x124165[_0x0cba('0x4b')](_0x2508ad);}})['then'](function(_0x3ee2c6){if(_0x3ee2c6){_0x534cb7=_0x3ee2c6[_0x0cba('0x2e')];if(!_0x10685f[_0x0cba('0x29')][_0x0cba('0x2f')](_0x0cba('0x30'))){_0x2508ad['limit']=qs[_0x0cba('0x1a')](_0x10685f[_0x0cba('0x29')][_0x0cba('0x1a')]);_0x2508ad['offset']=qs[_0x0cba('0x1b')](_0x10685f[_0x0cba('0x29')]['offset']);}return _0x124165['getTags'](_0x2508ad);}})[_0x0cba('0x21')](function(_0x14e701){if(_0x14e701){return _0x14e701?{'count':_0x534cb7,'rows':_0x14e701}:null;}})[_0x0cba('0x21')](respondWithResult(_0x5927b1,null))[_0x0cba('0x44')](handleError(_0x5927b1,null));};exports['setTags']=function(_0x11981a,_0x114c48,_0x156f84){if(_0x11981a[_0x0cba('0x43')]['id']){delete _0x11981a[_0x0cba('0x43')]['id'];}return db[_0x0cba('0x26')][_0x0cba('0x47')]({'where':{'id':_0x11981a['params']['id']}})[_0x0cba('0x21')](handleEntityNotFound(_0x114c48,null))[_0x0cba('0x21')](function(_0x46cf04){if(_0x46cf04){return _0x46cf04[_0x0cba('0x4c')](_0x11981a[_0x0cba('0x43')][_0x0cba('0x4d')]||[]);}return null;})[_0x0cba('0x21')](respondWithResult(_0x114c48,null))['catch'](handleError(_0x114c48,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 1e974ee..ddc6945 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 _0x35d4=['exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskConfiguration.attributes'];(function(_0x2ac187,_0x510b7c){var _0x1e8846=function(_0xc341da){while(--_0xc341da){_0x2ac187['push'](_0x2ac187['shift']());}};_0x1e8846(++_0x510b7c);}(_0x35d4,0x170));var _0x435d=function(_0x1ee0ed,_0x48798f){_0x1ee0ed=_0x1ee0ed-0x0;var _0x1a21a6=_0x35d4[_0x1ee0ed];return _0x1a21a6;};'use strict';var _=require(_0x435d('0x0'));var util=require(_0x435d('0x1'));var logger=require('../../config/logger')(_0x435d('0x2'));var moment=require(_0x435d('0x3'));var BPromise=require(_0x435d('0x4'));var rp=require(_0x435d('0x5'));var fs=require('fs');var path=require(_0x435d('0x6'));var rimraf=require(_0x435d('0x7'));var config=require(_0x435d('0x8'));var attributes=require(_0x435d('0x9'));module[_0x435d('0xa')]=function(_0x2ca508,_0x4cf66c){return _0x2ca508[_0x435d('0xb')](_0x435d('0xc'),attributes,{'tableName':_0x435d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd596=['../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','api','bluebird','request-promise','path','rimraf'];(function(_0x4e99fd,_0x3a2f2c){var _0x46b44e=function(_0x2ecebe){while(--_0x2ecebe){_0x4e99fd['push'](_0x4e99fd['shift']());}};_0x46b44e(++_0x3a2f2c);}(_0xd596,0x199));var _0x6d59=function(_0x209941,_0x5c9988){_0x209941=_0x209941-0x0;var _0x1e8729=_0xd596[_0x209941];return _0x1e8729;};'use strict';var _=require(_0x6d59('0x0'));var util=require(_0x6d59('0x1'));var logger=require('../../config/logger')(_0x6d59('0x2'));var moment=require('moment');var BPromise=require(_0x6d59('0x3'));var rp=require(_0x6d59('0x4'));var fs=require('fs');var path=require(_0x6d59('0x5'));var rimraf=require(_0x6d59('0x6'));var config=require(_0x6d59('0x7'));var attributes=require(_0x6d59('0x8'));module[_0x6d59('0x9')]=function(_0x54d5f9,_0x588a9b){return _0x54d5f9[_0x6d59('0xa')](_0x6d59('0xb'),attributes,{'tableName':_0x6d59('0xc'),'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 7ac724e..890c97a 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 _0xcbe2=['error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4db8bd,_0x1ddb2e){var _0x5db7ec=function(_0x9c98ec){while(--_0x9c98ec){_0x4db8bd['push'](_0x4db8bd['shift']());}};_0x5db7ec(++_0x1ddb2e);}(_0xcbe2,0x148));var _0x2cbe=function(_0x239528,_0x1efe70){_0x239528=_0x239528-0x0;var _0x4e355d=_0xcbe2[_0x239528];return _0x4e355d;};'use strict';var _=require(_0x2cbe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2cbe('0x1'));var rs=require(_0x2cbe('0x2'));var fs=require('fs');var Redis=require(_0x2cbe('0x3'));var db=require(_0x2cbe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2cbe('0x5'))(_0x2cbe('0x6'));var config=require(_0x2cbe('0x7'));var jayson=require(_0x2cbe('0x8'));var client=jayson[_0x2cbe('0x9')][_0x2cbe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4bb0ea,_0x267166,_0xcbecb0){return new BPromise(function(_0x3756d6,_0x230742){return client[_0x2cbe('0xb')](_0x4bb0ea,_0xcbecb0)['then'](function(_0x47b0fd){logger[_0x2cbe('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x267166,_0x2cbe('0xd'));logger[_0x2cbe('0xe')](_0x2cbe('0xf'),_0x267166,'request\x20sent',JSON[_0x2cbe('0x10')](_0x47b0fd));if(_0x47b0fd[_0x2cbe('0x11')]){if(_0x47b0fd[_0x2cbe('0x11')][_0x2cbe('0x12')]===0x1f4){logger[_0x2cbe('0x11')](_0x2cbe('0x13'),_0x267166,_0x47b0fd['error'][_0x2cbe('0x14')]);return _0x230742(_0x47b0fd[_0x2cbe('0x11')][_0x2cbe('0x14')]);}logger[_0x2cbe('0x11')](_0x2cbe('0x13'),_0x267166,_0x47b0fd[_0x2cbe('0x11')][_0x2cbe('0x14')]);return _0x3756d6(_0x47b0fd[_0x2cbe('0x11')]['message']);}else{logger[_0x2cbe('0xc')]('DeskConfiguration,\x20%s,\x20%s',_0x267166,'request\x20sent');_0x3756d6(_0x47b0fd[_0x2cbe('0x15')]['message']);}})[_0x2cbe('0x16')](function(_0x472aee){logger['error'](_0x2cbe('0x13'),_0x267166,_0x472aee);_0x230742(_0x472aee);});});} \ No newline at end of file +var _0x4849=['moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x1cdcab,_0x17a516){var _0x4393d0=function(_0x53b841){while(--_0x53b841){_0x1cdcab['push'](_0x1cdcab['shift']());}};_0x4393d0(++_0x17a516);}(_0x4849,0xf8));var _0x9484=function(_0x15a2f1,_0xdfe6d6){_0x15a2f1=_0x15a2f1-0x0;var _0xf57a96=_0x4849[_0x15a2f1];return _0xf57a96;};'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')]('DeskConfiguration,\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')]('DeskConfiguration,\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);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index f11ff5a..5f6b358 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 _0xf960=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports'];(function(_0x39d1b8,_0x1ae09a){var _0x9b9e1c=function(_0x8aeb5f){while(--_0x8aeb5f){_0x39d1b8['push'](_0x39d1b8['shift']());}};_0x9b9e1c(++_0x1ae09a);}(_0xf960,0x190));var _0x0f96=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xf960[_0x101e7b];return _0x4995c0;};'use strict';var multer=require(_0x0f96('0x0'));var util=require(_0x0f96('0x1'));var path=require(_0x0f96('0x2'));var timeout=require(_0x0f96('0x3'));var express=require(_0x0f96('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0f96('0x5'));var interaction=require(_0x0f96('0x6'));var config=require(_0x0f96('0x7'));var controller=require(_0x0f96('0x8'));router[_0x0f96('0x9')]('/',auth[_0x0f96('0xa')](),controller[_0x0f96('0xb')]);router[_0x0f96('0x9')](_0x0f96('0xc'),auth[_0x0f96('0xa')](),controller[_0x0f96('0xd')]);router[_0x0f96('0xe')]('/',auth[_0x0f96('0xa')](),controller[_0x0f96('0xf')]);router[_0x0f96('0x10')]('/:id',auth[_0x0f96('0xa')](),controller['update']);router[_0x0f96('0x11')](_0x0f96('0xc'),auth[_0x0f96('0xa')](),controller[_0x0f96('0x12')]);module[_0x0f96('0x13')]=router; \ No newline at end of file +var _0xb016=['put','/:id','update','destroy','exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','create'];(function(_0x1c6b59,_0x28b966){var _0x5279a0=function(_0x2d994a){while(--_0x2d994a){_0x1c6b59['push'](_0x1c6b59['shift']());}};_0x5279a0(++_0x28b966);}(_0xb016,0x159));var _0x6b01=function(_0x5a8d07,_0x54069c){_0x5a8d07=_0x5a8d07-0x0;var _0x5d635e=_0xb016[_0x5a8d07];return _0x5d635e;};'use strict';var multer=require(_0x6b01('0x0'));var util=require(_0x6b01('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6b01('0x2'));var router=express['Router']();var fs_extra=require(_0x6b01('0x3'));var auth=require(_0x6b01('0x4'));var interaction=require(_0x6b01('0x5'));var config=require(_0x6b01('0x6'));var controller=require('./intDeskField.controller');router[_0x6b01('0x7')]('/',auth[_0x6b01('0x8')](),controller[_0x6b01('0x9')]);router['get']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xa')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6b01('0xb')]);router[_0x6b01('0xc')](_0x6b01('0xd'),auth[_0x6b01('0x8')](),controller[_0x6b01('0xe')]);router['delete']('/:id',auth[_0x6b01('0x8')](),controller[_0x6b01('0xf')]);module[_0x6b01('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 279794a..b9aeedf 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 _0xcd0e=['customVariable','picklist','STRING','variable','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x494da7,_0x35652b){var _0x32fa83=function(_0x59485d){while(--_0x59485d){_0x494da7['push'](_0x494da7['shift']());}};_0x32fa83(++_0x35652b);}(_0xcd0e,0x9e));var _0xecd0=function(_0x5d7227,_0x12aebe){_0x5d7227=_0x5d7227-0x0;var _0x15ac55=_0xcd0e[_0x5d7227];return _0x15ac55;};'use strict';var Sequelize=require(_0xecd0('0x0'));module[_0xecd0('0x1')]={'type':{'type':Sequelize[_0xecd0('0x2')](_0xecd0('0x3'),'variable',_0xecd0('0x4'),'keyValue',_0xecd0('0x5')),'defaultValue':_0xecd0('0x3')},'content':{'type':Sequelize[_0xecd0('0x6')]},'key':{'type':Sequelize[_0xecd0('0x6')]},'keyType':{'type':Sequelize[_0xecd0('0x2')](_0xecd0('0x3'),_0xecd0('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xecd0('0x6')]},'idField':{'type':Sequelize[_0xecd0('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xecd0('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xecd0('0x6')]}}; \ No newline at end of file +var _0x3410=['sequelize','exports','string','variable','customVariable','keyValue','picklist','STRING','ENUM','BOOLEAN'];(function(_0x5e9755,_0x3f9347){var _0x14064f=function(_0x20a79c){while(--_0x20a79c){_0x5e9755['push'](_0x5e9755['shift']());}};_0x14064f(++_0x3f9347);}(_0x3410,0x172));var _0x0341=function(_0x146e50,_0x2d6755){_0x146e50=_0x146e50-0x0;var _0x418f9a=_0x3410[_0x146e50];return _0x418f9a;};'use strict';var Sequelize=require(_0x0341('0x0'));module[_0x0341('0x1')]={'type':{'type':Sequelize['ENUM'](_0x0341('0x2'),_0x0341('0x3'),_0x0341('0x4'),_0x0341('0x5'),_0x0341('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0341('0x7')]},'key':{'type':Sequelize[_0x0341('0x7')]},'keyType':{'type':Sequelize[_0x0341('0x8')](_0x0341('0x2'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x0341('0x7')]},'idField':{'type':Sequelize[_0x0341('0x7')]},'nameField':{'type':Sequelize[_0x0341('0x7')]},'customField':{'type':Sequelize[_0x0341('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0341('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 61c2430..78c688e 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 _0xfca0=['bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../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','error','stack','name','index','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','catch','show','params','length','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x5b835e,_0x3882cc){var _0x55572b=function(_0x4a3472){while(--_0x4a3472){_0x5b835e['push'](_0x5b835e['shift']());}};_0x55572b(++_0x3882cc);}(_0xfca0,0x171));var _0x0fca=function(_0x2a81aa,_0x557f0f){_0x2a81aa=_0x2a81aa-0x0;var _0x1a4a41=_0xfca0[_0x2a81aa];return _0x1a4a41;};'use strict';var emlformat=require(_0x0fca('0x0'));var rimraf=require(_0x0fca('0x1'));var zipdir=require(_0x0fca('0x2'));var jsonpatch=require(_0x0fca('0x3'));var rp=require(_0x0fca('0x4'));var moment=require(_0x0fca('0x5'));var BPromise=require(_0x0fca('0x6'));var Mustache=require(_0x0fca('0x7'));var util=require('util');var path=require(_0x0fca('0x8'));var sox=require(_0x0fca('0x9'));var csv=require(_0x0fca('0xa'));var ejs=require(_0x0fca('0xb'));var fs=require('fs');var fs_extra=require(_0x0fca('0xc'));var _=require(_0x0fca('0xd'));var squel=require(_0x0fca('0xe'));var crypto=require(_0x0fca('0xf'));var jsforce=require(_0x0fca('0x10'));var deskjs=require(_0x0fca('0x11'));var toCsv=require(_0x0fca('0xa'));var querystring=require(_0x0fca('0x12'));var Papa=require(_0x0fca('0x13'));var Redis=require(_0x0fca('0x14'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x0fca('0x15'));var hardwareService=require(_0x0fca('0x16'));var logger=require('../../config/logger')(_0x0fca('0x17'));var utils=require('../../config/utils');var config=require(_0x0fca('0x18'));var licenseUtil=require(_0x0fca('0x19'));var db=require(_0x0fca('0x1a'))['db'];function respondWithStatusCode(_0x1ad9fa,_0x3b8bf2){_0x3b8bf2=_0x3b8bf2||0xcc;return function(_0x56c66f){if(_0x56c66f){return _0x1ad9fa[_0x0fca('0x1b')](_0x3b8bf2);}return _0x1ad9fa[_0x0fca('0x1c')](_0x3b8bf2)[_0x0fca('0x1d')]();};}function respondWithResult(_0x44a894,_0x2fe06c){_0x2fe06c=_0x2fe06c||0xc8;return function(_0x1b8277){if(_0x1b8277){return _0x44a894[_0x0fca('0x1c')](_0x2fe06c)[_0x0fca('0x1e')](_0x1b8277);}};}function respondWithFilteredResult(_0x19526f,_0x11fcfd){return function(_0x3e8387){if(_0x3e8387){var _0xe6c8fd=typeof _0x11fcfd[_0x0fca('0x1f')]===_0x0fca('0x20')&&typeof _0x11fcfd[_0x0fca('0x21')]===_0x0fca('0x20');var _0x5adc55=_0x3e8387[_0x0fca('0x22')];var _0x864681=_0xe6c8fd?0x0:_0x11fcfd[_0x0fca('0x1f')];var _0x387d53=_0xe6c8fd?_0x3e8387['count']:_0x11fcfd['offset']+_0x11fcfd[_0x0fca('0x21')];var _0x35aba9;if(_0x387d53>=_0x5adc55){_0x387d53=_0x5adc55;_0x35aba9=0xc8;}else{_0x35aba9=0xce;}_0x19526f[_0x0fca('0x1c')](_0x35aba9);return _0x19526f[_0x0fca('0x23')](_0x0fca('0x24'),_0x864681+'-'+_0x387d53+'/'+_0x5adc55)['json'](_0x3e8387);}return null;};}function patchUpdates(_0x4b6ff0){return function(_0xd7e72){try{jsonpatch[_0x0fca('0x25')](_0xd7e72,_0x4b6ff0,!![]);}catch(_0xc636a2){return BPromise[_0x0fca('0x26')](_0xc636a2);}return _0xd7e72['save']();};}function saveUpdates(_0x437859,_0x43ac51){return function(_0x401d4b){if(_0x401d4b){return _0x401d4b[_0x0fca('0x27')](_0x437859)[_0x0fca('0x28')](function(_0x395f84){return _0x395f84;});}return null;};}function removeEntity(_0xf20c39,_0x513997){return function(_0x465695){if(_0x465695){return _0x465695['destroy']()[_0x0fca('0x28')](function(){_0xf20c39[_0x0fca('0x1c')](0xcc)[_0x0fca('0x1d')]();});}};}function handleEntityNotFound(_0x1ed9b0,_0x21bd9b){return function(_0x2e5d05){if(!_0x2e5d05){_0x1ed9b0['sendStatus'](0x194);}return _0x2e5d05;};}function handleError(_0xb8bee6,_0x4defbb){_0x4defbb=_0x4defbb||0x1f4;return function(_0x39f02d){logger[_0x0fca('0x29')](_0x39f02d[_0x0fca('0x2a')]);if(_0x39f02d[_0x0fca('0x2b')]){delete _0x39f02d[_0x0fca('0x2b')];}_0xb8bee6[_0x0fca('0x1c')](_0x4defbb)['send'](_0x39f02d);};}exports[_0x0fca('0x2c')]=function(_0x1b7474,_0xd56047){var _0x1bcf6d={},_0x5b98fb={},_0x4313cf={'count':0x0,'rows':[]};var _0x51a464=_['map'](db[_0x0fca('0x2d')][_0x0fca('0x2e')],function(_0x64f0c9){return{'name':_0x64f0c9[_0x0fca('0x2f')],'type':_0x64f0c9[_0x0fca('0x30')][_0x0fca('0x31')]};});_0x5b98fb[_0x0fca('0x32')]=_['map'](_0x51a464,_0x0fca('0x2b'));_0x5b98fb['query']=_[_0x0fca('0x33')](_0x1b7474[_0x0fca('0x34')]);_0x5b98fb[_0x0fca('0x35')]=_[_0x0fca('0x36')](_0x5b98fb[_0x0fca('0x32')],_0x5b98fb['query']);_0x1bcf6d[_0x0fca('0x37')]=_[_0x0fca('0x36')](_0x5b98fb[_0x0fca('0x32')],qs['fields'](_0x1b7474[_0x0fca('0x34')][_0x0fca('0x38')]));_0x1bcf6d[_0x0fca('0x37')]=_0x1bcf6d['attributes']['length']?_0x1bcf6d[_0x0fca('0x37')]:_0x5b98fb['model'];if(!_0x1b7474[_0x0fca('0x34')]['hasOwnProperty'](_0x0fca('0x39'))){_0x1bcf6d[_0x0fca('0x21')]=qs[_0x0fca('0x21')](_0x1b7474[_0x0fca('0x34')]['limit']);_0x1bcf6d[_0x0fca('0x1f')]=qs[_0x0fca('0x1f')](_0x1b7474[_0x0fca('0x34')]['offset']);}_0x1bcf6d['order']=qs['sort'](_0x1b7474['query'][_0x0fca('0x3a')]);_0x1bcf6d['where']=qs['filters'](_[_0x0fca('0x3b')](_0x1b7474[_0x0fca('0x34')],_0x5b98fb[_0x0fca('0x35')]),_0x51a464);if(_0x1b7474[_0x0fca('0x34')][_0x0fca('0x3c')]){_0x1bcf6d[_0x0fca('0x3d')]=_[_0x0fca('0x3e')](_0x1bcf6d['where'],{'$or':_['map'](_0x51a464,function(_0x2bc9a1){if(_0x2bc9a1[_0x0fca('0x30')]!==_0x0fca('0x3f')){var _0x4f2bda={};_0x4f2bda[_0x2bc9a1['name']]={'$like':'%'+_0x1b7474[_0x0fca('0x34')]['filter']+'%'};return _0x4f2bda;}})});}_0x1bcf6d=_[_0x0fca('0x3e')]({},_0x1bcf6d,_0x1b7474[_0x0fca('0x40')]);var _0x318f24={'where':_0x1bcf6d['where']};return db[_0x0fca('0x2d')][_0x0fca('0x22')](_0x318f24)['then'](function(_0x19aa2f){_0x4313cf[_0x0fca('0x22')]=_0x19aa2f;if(_0x1b7474[_0x0fca('0x34')][_0x0fca('0x41')]){_0x1bcf6d['include']=[{'all':!![]}];}return db[_0x0fca('0x2d')]['findAll'](_0x1bcf6d);})['then'](function(_0x37b604){_0x4313cf['rows']=_0x37b604;return _0x4313cf;})['then'](respondWithFilteredResult(_0xd56047,_0x1bcf6d))[_0x0fca('0x42')](handleError(_0xd56047,null));};exports[_0x0fca('0x43')]=function(_0x2c71f2,_0x2efdb6){var _0x3211a6={'raw':!![],'where':{'id':_0x2c71f2[_0x0fca('0x44')]['id']}},_0xa3d3ff={};_0xa3d3ff[_0x0fca('0x32')]=_['keys'](db['DeskField'][_0x0fca('0x2e')]);_0xa3d3ff['query']=_['keys'](_0x2c71f2['query']);_0xa3d3ff[_0x0fca('0x35')]=_[_0x0fca('0x36')](_0xa3d3ff[_0x0fca('0x32')],_0xa3d3ff[_0x0fca('0x34')]);_0x3211a6[_0x0fca('0x37')]=_['intersection'](_0xa3d3ff[_0x0fca('0x32')],qs[_0x0fca('0x38')](_0x2c71f2[_0x0fca('0x34')][_0x0fca('0x38')]));_0x3211a6[_0x0fca('0x37')]=_0x3211a6[_0x0fca('0x37')][_0x0fca('0x45')]?_0x3211a6[_0x0fca('0x37')]:_0xa3d3ff[_0x0fca('0x32')];if(_0x2c71f2['query']['includeAll']){_0x3211a6[_0x0fca('0x46')]=[{'all':!![]}];}_0x3211a6=_[_0x0fca('0x3e')]({},_0x3211a6,_0x2c71f2[_0x0fca('0x40')]);return db[_0x0fca('0x2d')][_0x0fca('0x47')](_0x3211a6)[_0x0fca('0x28')](handleEntityNotFound(_0x2efdb6,null))[_0x0fca('0x28')](respondWithResult(_0x2efdb6,null))[_0x0fca('0x42')](handleError(_0x2efdb6,null));};exports[_0x0fca('0x48')]=function(_0x200496,_0x47971c){return db[_0x0fca('0x2d')][_0x0fca('0x48')](_0x200496[_0x0fca('0x49')],{})['then'](respondWithResult(_0x47971c,0xc9))[_0x0fca('0x42')](handleError(_0x47971c,null));};exports[_0x0fca('0x27')]=function(_0xcccfda,_0x5720ad){if(_0xcccfda[_0x0fca('0x49')]['id']){delete _0xcccfda[_0x0fca('0x49')]['id'];}return db[_0x0fca('0x2d')][_0x0fca('0x47')]({'where':{'id':_0xcccfda[_0x0fca('0x44')]['id']}})[_0x0fca('0x28')](handleEntityNotFound(_0x5720ad,null))[_0x0fca('0x28')](saveUpdates(_0xcccfda[_0x0fca('0x49')],null))[_0x0fca('0x28')](respondWithResult(_0x5720ad,null))[_0x0fca('0x42')](handleError(_0x5720ad,null));};exports[_0x0fca('0x4a')]=function(_0x37285e,_0x81b62f){return db[_0x0fca('0x2d')][_0x0fca('0x47')]({'where':{'id':_0x37285e['params']['id']}})[_0x0fca('0x28')](handleEntityNotFound(_0x81b62f,null))[_0x0fca('0x28')](removeEntity(_0x81b62f,null))[_0x0fca('0x42')](handleError(_0x81b62f,null));}; \ No newline at end of file +var _0xd1f9=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','error','stack','send','index','map','DeskField','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','nolimit','order','sort','filters','pick','filter','VIRTUAL','name','merge','options','where','includeAll','include','findAll','rows','show','params','length','find','create','body','catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0xd1f9,0x88));var _0x9d1f=function(_0x4e8286,_0x4eaeb4){_0x4e8286=_0x4e8286-0x0;var _0x44a440=_0xd1f9[_0x4e8286];return _0x44a440;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x9d1f('0x0'));var jsonpatch=require(_0x9d1f('0x1'));var rp=require(_0x9d1f('0x2'));var moment=require(_0x9d1f('0x3'));var BPromise=require(_0x9d1f('0x4'));var Mustache=require(_0x9d1f('0x5'));var util=require(_0x9d1f('0x6'));var path=require(_0x9d1f('0x7'));var sox=require(_0x9d1f('0x8'));var csv=require('to-csv');var ejs=require(_0x9d1f('0x9'));var fs=require('fs');var fs_extra=require(_0x9d1f('0xa'));var _=require(_0x9d1f('0xb'));var squel=require(_0x9d1f('0xc'));var crypto=require(_0x9d1f('0xd'));var jsforce=require(_0x9d1f('0xe'));var deskjs=require(_0x9d1f('0xf'));var toCsv=require(_0x9d1f('0x10'));var querystring=require(_0x9d1f('0x11'));var Papa=require(_0x9d1f('0x12'));var Redis=require(_0x9d1f('0x13'));var authService=require(_0x9d1f('0x14'));var qs=require(_0x9d1f('0x15'));var as=require(_0x9d1f('0x16'));var hardwareService=require(_0x9d1f('0x17'));var logger=require(_0x9d1f('0x18'))(_0x9d1f('0x19'));var utils=require(_0x9d1f('0x1a'));var config=require(_0x9d1f('0x1b'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d1f('0x1c'))['db'];function respondWithStatusCode(_0x15a999,_0x7edbfa){_0x7edbfa=_0x7edbfa||0xcc;return function(_0x5a4d43){if(_0x5a4d43){return _0x15a999[_0x9d1f('0x1d')](_0x7edbfa);}return _0x15a999['status'](_0x7edbfa)['end']();};}function respondWithResult(_0x71e9c9,_0x38395d){_0x38395d=_0x38395d||0xc8;return function(_0x25c0b0){if(_0x25c0b0){return _0x71e9c9[_0x9d1f('0x1e')](_0x38395d)[_0x9d1f('0x1f')](_0x25c0b0);}};}function respondWithFilteredResult(_0x40a87f,_0x9f8cfc){return function(_0x2488a3){if(_0x2488a3){var _0x24cd8a=typeof _0x9f8cfc[_0x9d1f('0x20')]===_0x9d1f('0x21')&&typeof _0x9f8cfc[_0x9d1f('0x22')]===_0x9d1f('0x21');var _0x57ba11=_0x2488a3[_0x9d1f('0x23')];var _0x42a2b4=_0x24cd8a?0x0:_0x9f8cfc['offset'];var _0x329b69=_0x24cd8a?_0x2488a3['count']:_0x9f8cfc['offset']+_0x9f8cfc['limit'];var _0x2d39f3;if(_0x329b69>=_0x57ba11){_0x329b69=_0x57ba11;_0x2d39f3=0xc8;}else{_0x2d39f3=0xce;}_0x40a87f[_0x9d1f('0x1e')](_0x2d39f3);return _0x40a87f[_0x9d1f('0x24')]('Content-Range',_0x42a2b4+'-'+_0x329b69+'/'+_0x57ba11)[_0x9d1f('0x1f')](_0x2488a3);}return null;};}function patchUpdates(_0x4cfcf5){return function(_0x1c0280){try{jsonpatch['apply'](_0x1c0280,_0x4cfcf5,!![]);}catch(_0x552a84){return BPromise[_0x9d1f('0x25')](_0x552a84);}return _0x1c0280[_0x9d1f('0x26')]();};}function saveUpdates(_0x35a80d,_0x2d861b){return function(_0x44ef15){if(_0x44ef15){return _0x44ef15[_0x9d1f('0x27')](_0x35a80d)[_0x9d1f('0x28')](function(_0x3b10f7){return _0x3b10f7;});}return null;};}function removeEntity(_0x2c6417,_0xc05aa){return function(_0x1ab0f4){if(_0x1ab0f4){return _0x1ab0f4[_0x9d1f('0x29')]()[_0x9d1f('0x28')](function(){_0x2c6417[_0x9d1f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b234d,_0xa2392f){return function(_0x48245c){if(!_0x48245c){_0x2b234d['sendStatus'](0x194);}return _0x48245c;};}function handleError(_0x1f2b0e,_0xfdd4ae){_0xfdd4ae=_0xfdd4ae||0x1f4;return function(_0x3ca450){logger[_0x9d1f('0x2a')](_0x3ca450[_0x9d1f('0x2b')]);if(_0x3ca450['name']){delete _0x3ca450['name'];}_0x1f2b0e[_0x9d1f('0x1e')](_0xfdd4ae)[_0x9d1f('0x2c')](_0x3ca450);};}exports[_0x9d1f('0x2d')]=function(_0x44515d,_0x1df1b8){var _0x1d8ffe={},_0x48fbf5={},_0x2b11db={'count':0x0,'rows':[]};var _0x4daec3=_[_0x9d1f('0x2e')](db[_0x9d1f('0x2f')][_0x9d1f('0x30')],function(_0x579c46){return{'name':_0x579c46[_0x9d1f('0x31')],'type':_0x579c46['type'][_0x9d1f('0x32')]};});_0x48fbf5[_0x9d1f('0x33')]=_[_0x9d1f('0x2e')](_0x4daec3,'name');_0x48fbf5['query']=_[_0x9d1f('0x34')](_0x44515d[_0x9d1f('0x35')]);_0x48fbf5['filters']=_[_0x9d1f('0x36')](_0x48fbf5[_0x9d1f('0x33')],_0x48fbf5[_0x9d1f('0x35')]);_0x1d8ffe[_0x9d1f('0x37')]=_['intersection'](_0x48fbf5[_0x9d1f('0x33')],qs[_0x9d1f('0x38')](_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x38')]));_0x1d8ffe['attributes']=_0x1d8ffe[_0x9d1f('0x37')]['length']?_0x1d8ffe[_0x9d1f('0x37')]:_0x48fbf5[_0x9d1f('0x33')];if(!_0x44515d[_0x9d1f('0x35')]['hasOwnProperty'](_0x9d1f('0x39'))){_0x1d8ffe[_0x9d1f('0x22')]=qs[_0x9d1f('0x22')](_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x22')]);_0x1d8ffe['offset']=qs[_0x9d1f('0x20')](_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x20')]);}_0x1d8ffe[_0x9d1f('0x3a')]=qs[_0x9d1f('0x3b')](_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x3b')]);_0x1d8ffe['where']=qs[_0x9d1f('0x3c')](_[_0x9d1f('0x3d')](_0x44515d[_0x9d1f('0x35')],_0x48fbf5[_0x9d1f('0x3c')]),_0x4daec3);if(_0x44515d['query'][_0x9d1f('0x3e')]){_0x1d8ffe['where']=_['merge'](_0x1d8ffe['where'],{'$or':_[_0x9d1f('0x2e')](_0x4daec3,function(_0x1253e2){if(_0x1253e2['type']!==_0x9d1f('0x3f')){var _0x28fde6={};_0x28fde6[_0x1253e2[_0x9d1f('0x40')]]={'$like':'%'+_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x3e')]+'%'};return _0x28fde6;}})});}_0x1d8ffe=_[_0x9d1f('0x41')]({},_0x1d8ffe,_0x44515d[_0x9d1f('0x42')]);var _0x537407={'where':_0x1d8ffe[_0x9d1f('0x43')]};return db['DeskField'][_0x9d1f('0x23')](_0x537407)[_0x9d1f('0x28')](function(_0x5f2ae9){_0x2b11db[_0x9d1f('0x23')]=_0x5f2ae9;if(_0x44515d[_0x9d1f('0x35')][_0x9d1f('0x44')]){_0x1d8ffe[_0x9d1f('0x45')]=[{'all':!![]}];}return db[_0x9d1f('0x2f')][_0x9d1f('0x46')](_0x1d8ffe);})[_0x9d1f('0x28')](function(_0x54c0c0){_0x2b11db[_0x9d1f('0x47')]=_0x54c0c0;return _0x2b11db;})[_0x9d1f('0x28')](respondWithFilteredResult(_0x1df1b8,_0x1d8ffe))['catch'](handleError(_0x1df1b8,null));};exports[_0x9d1f('0x48')]=function(_0x4ab238,_0x3555de){var _0x185185={'raw':!![],'where':{'id':_0x4ab238[_0x9d1f('0x49')]['id']}},_0x48dc9a={};_0x48dc9a[_0x9d1f('0x33')]=_[_0x9d1f('0x34')](db[_0x9d1f('0x2f')][_0x9d1f('0x30')]);_0x48dc9a['query']=_[_0x9d1f('0x34')](_0x4ab238[_0x9d1f('0x35')]);_0x48dc9a['filters']=_[_0x9d1f('0x36')](_0x48dc9a[_0x9d1f('0x33')],_0x48dc9a[_0x9d1f('0x35')]);_0x185185[_0x9d1f('0x37')]=_[_0x9d1f('0x36')](_0x48dc9a[_0x9d1f('0x33')],qs[_0x9d1f('0x38')](_0x4ab238[_0x9d1f('0x35')][_0x9d1f('0x38')]));_0x185185[_0x9d1f('0x37')]=_0x185185[_0x9d1f('0x37')][_0x9d1f('0x4a')]?_0x185185[_0x9d1f('0x37')]:_0x48dc9a[_0x9d1f('0x33')];if(_0x4ab238['query'][_0x9d1f('0x44')]){_0x185185[_0x9d1f('0x45')]=[{'all':!![]}];}_0x185185=_[_0x9d1f('0x41')]({},_0x185185,_0x4ab238[_0x9d1f('0x42')]);return db[_0x9d1f('0x2f')][_0x9d1f('0x4b')](_0x185185)[_0x9d1f('0x28')](handleEntityNotFound(_0x3555de,null))[_0x9d1f('0x28')](respondWithResult(_0x3555de,null))['catch'](handleError(_0x3555de,null));};exports[_0x9d1f('0x4c')]=function(_0x132904,_0xea9cae){return db[_0x9d1f('0x2f')]['create'](_0x132904[_0x9d1f('0x4d')],{})['then'](respondWithResult(_0xea9cae,0xc9))['catch'](handleError(_0xea9cae,null));};exports[_0x9d1f('0x27')]=function(_0x4306ec,_0x272357){if(_0x4306ec[_0x9d1f('0x4d')]['id']){delete _0x4306ec[_0x9d1f('0x4d')]['id'];}return db['DeskField'][_0x9d1f('0x4b')]({'where':{'id':_0x4306ec[_0x9d1f('0x49')]['id']}})[_0x9d1f('0x28')](handleEntityNotFound(_0x272357,null))[_0x9d1f('0x28')](saveUpdates(_0x4306ec[_0x9d1f('0x4d')],null))['then'](respondWithResult(_0x272357,null))[_0x9d1f('0x4e')](handleError(_0x272357,null));};exports[_0x9d1f('0x29')]=function(_0x4c0f05,_0x5a9b0d){return db[_0x9d1f('0x2f')][_0x9d1f('0x4b')]({'where':{'id':_0x4c0f05[_0x9d1f('0x49')]['id']}})[_0x9d1f('0x28')](handleEntityNotFound(_0x5a9b0d,null))[_0x9d1f('0x28')](removeEntity(_0x5a9b0d,null))['catch'](handleError(_0x5a9b0d,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index ee2c748..a13e896 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 _0xecad=['request-promise','path','../../config/environment','define','int_desk_fields','desk_unique_index','idField','util','../../config/logger','moment','bluebird'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0xecad,0x151));var _0xdeca=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xecad[_0x17406a];return _0x1501ff;};'use strict';var _=require('lodash');var util=require(_0xdeca('0x0'));var logger=require(_0xdeca('0x1'))('api');var moment=require(_0xdeca('0x2'));var BPromise=require(_0xdeca('0x3'));var rp=require(_0xdeca('0x4'));var fs=require('fs');var path=require(_0xdeca('0x5'));var rimraf=require('rimraf');var config=require(_0xdeca('0x6'));var attributes=require('./intDeskField.attributes');module['exports']=function(_0x5f50fc,_0x3aa953){return _0x5f50fc[_0xdeca('0x7')]('DeskField',attributes,{'tableName':_0xdeca('0x8'),'paranoid':![],'indexes':[{'name':_0xdeca('0x9'),'fields':[_0xdeca('0xa'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfcf2=['util','../../config/logger','api','moment','bluebird','rimraf','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','lodash'];(function(_0x2b93a5,_0x31934c){var _0x4111dc=function(_0x3d4f71){while(--_0x3d4f71){_0x2b93a5['push'](_0x2b93a5['shift']());}};_0x4111dc(++_0x31934c);}(_0xfcf2,0xb3));var _0x2fcf=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xfcf2[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0x2fcf('0x0'));var util=require(_0x2fcf('0x1'));var logger=require(_0x2fcf('0x2'))(_0x2fcf('0x3'));var moment=require(_0x2fcf('0x4'));var BPromise=require(_0x2fcf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2fcf('0x6'));var config=require('../../config/environment');var attributes=require(_0x2fcf('0x7'));module[_0x2fcf('0x8')]=function(_0x21320a,_0x1bd4fb){return _0x21320a[_0x2fcf('0x9')](_0x2fcf('0xa'),attributes,{'tableName':_0x2fcf('0xb'),'paranoid':![],'indexes':[{'name':_0x2fcf('0xc'),'fields':[_0x2fcf('0xd'),_0x2fcf('0xe')],'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 a65bb79..827e109 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 _0x085f=['DeskField,\x20%s,\x20%s','message','result','catch','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','DeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0xc0d066,_0xdcc6d1){var _0x33ef28=function(_0x195c9e){while(--_0x195c9e){_0xc0d066['push'](_0xc0d066['shift']());}};_0x33ef28(++_0xdcc6d1);}(_0x085f,0x17e));var _0xf085=function(_0x46071a,_0x32c3fa){_0x46071a=_0x46071a-0x0;var _0x2d04c8=_0x085f[_0x46071a];return _0x2d04c8;};'use strict';var _=require(_0xf085('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xf085('0x1'));var fs=require('fs');var Redis=require(_0xf085('0x2'));var db=require(_0xf085('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xf085('0x4'))(_0xf085('0x5'));var config=require(_0xf085('0x6'));var jayson=require(_0xf085('0x7'));var client=jayson[_0xf085('0x8')][_0xf085('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd64bf9,_0x2c0a10,_0x455b62){return new BPromise(function(_0x4eab66,_0x4e6907){return client[_0xf085('0xa')](_0xd64bf9,_0x455b62)[_0xf085('0xb')](function(_0x560127){logger[_0xf085('0xc')]('DeskField,\x20%s,\x20%s',_0x2c0a10,'request\x20sent');logger[_0xf085('0xd')](_0xf085('0xe'),_0x2c0a10,_0xf085('0xf'),JSON['stringify'](_0x560127));if(_0x560127[_0xf085('0x10')]){if(_0x560127[_0xf085('0x10')]['code']===0x1f4){logger[_0xf085('0x10')](_0xf085('0x11'),_0x2c0a10,_0x560127[_0xf085('0x10')][_0xf085('0x12')]);return _0x4e6907(_0x560127[_0xf085('0x10')][_0xf085('0x12')]);}logger[_0xf085('0x10')](_0xf085('0x11'),_0x2c0a10,_0x560127[_0xf085('0x10')][_0xf085('0x12')]);return _0x4eab66(_0x560127[_0xf085('0x10')]['message']);}else{logger[_0xf085('0xc')](_0xf085('0x11'),_0x2c0a10,_0xf085('0xf'));_0x4eab66(_0x560127[_0xf085('0x13')][_0xf085('0x12')]);}})[_0xf085('0x14')](function(_0x29e66d){logger['error'](_0xf085('0x11'),_0x2c0a10,_0x29e66d);_0x4e6907(_0x29e66d);});});} \ No newline at end of file +var _0x2566=['request','DeskField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http'];(function(_0x279a3b,_0x505197){var _0x4eb520=function(_0x233300){while(--_0x233300){_0x279a3b['push'](_0x279a3b['shift']());}};_0x4eb520(++_0x505197);}(_0x2566,0x87));var _0x6256=function(_0x37d332,_0x5c62a7){_0x37d332=_0x37d332-0x0;var _0x1d5751=_0x2566[_0x37d332];return _0x1d5751;};'use strict';var _=require(_0x6256('0x0'));var util=require(_0x6256('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6256('0x2'));var fs=require('fs');var Redis=require(_0x6256('0x3'));var db=require(_0x6256('0x4'))['db'];var utils=require(_0x6256('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x6256('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6256('0x7')][_0x6256('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x89bef0,_0xfccdb6,_0x728a2e){return new BPromise(function(_0x1a3cd3,_0x57fe28){return client[_0x6256('0x9')](_0x89bef0,_0x728a2e)['then'](function(_0x1de9d8){logger['info'](_0x6256('0xa'),_0xfccdb6,'request\x20sent');logger[_0x6256('0xb')]('DeskField,\x20%s,\x20%s,\x20%s',_0xfccdb6,_0x6256('0xc'),JSON[_0x6256('0xd')](_0x1de9d8));if(_0x1de9d8[_0x6256('0xe')]){if(_0x1de9d8['error']['code']===0x1f4){logger[_0x6256('0xe')]('DeskField,\x20%s,\x20%s',_0xfccdb6,_0x1de9d8['error'][_0x6256('0xf')]);return _0x57fe28(_0x1de9d8[_0x6256('0xe')][_0x6256('0xf')]);}logger[_0x6256('0xe')](_0x6256('0xa'),_0xfccdb6,_0x1de9d8[_0x6256('0xe')][_0x6256('0xf')]);return _0x1a3cd3(_0x1de9d8[_0x6256('0xe')]['message']);}else{logger[_0x6256('0x10')](_0x6256('0xa'),_0xfccdb6,_0x6256('0xc'));_0x1a3cd3(_0x1de9d8['result']['message']);}})[_0x6256('0x11')](function(_0x412ce9){logger['error'](_0x6256('0xa'),_0xfccdb6,_0x412ce9);_0x57fe28(_0x412ce9);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 255a7d3..6b36453 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 _0xd212=['post','create','put','update','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','./intDynamics365Account.controller','get','index','/:id','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xd212,0x90));var _0x2d21=function(_0x2550ce,_0x45209b){_0x2550ce=_0x2550ce-0x0;var _0x25748d=_0xd212[_0x2550ce];return _0x25748d;};'use strict';var multer=require(_0x2d21('0x0'));var util=require(_0x2d21('0x1'));var path=require(_0x2d21('0x2'));var timeout=require('connect-timeout');var express=require(_0x2d21('0x3'));var router=express[_0x2d21('0x4')]();var fs_extra=require(_0x2d21('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2d21('0x6'));var config=require('../../config/environment');var controller=require(_0x2d21('0x7'));router[_0x2d21('0x8')]('/',auth['isAuthenticated'](),controller[_0x2d21('0x9')]);router[_0x2d21('0x8')](_0x2d21('0xa'),auth[_0x2d21('0xb')](),controller[_0x2d21('0xc')]);router[_0x2d21('0x8')](_0x2d21('0xd'),auth[_0x2d21('0xb')](),controller[_0x2d21('0xe')]);router[_0x2d21('0x8')](_0x2d21('0xf'),auth[_0x2d21('0xb')](),controller[_0x2d21('0x10')]);router[_0x2d21('0x11')]('/',auth['isAuthenticated'](),controller[_0x2d21('0x12')]);router[_0x2d21('0x11')](_0x2d21('0xd'),auth[_0x2d21('0xb')](),controller['addConfiguration']);router[_0x2d21('0x13')](_0x2d21('0xa'),auth[_0x2d21('0xb')](),controller[_0x2d21('0x14')]);router['delete'](_0x2d21('0xa'),auth[_0x2d21('0xb')](),controller[_0x2d21('0x15')]);module[_0x2d21('0x16')]=router; \ No newline at end of file +var _0x92e8=['get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','update','delete','destroy','path','connect-timeout','express','fs-extra','../../config/environment','./intDynamics365Account.controller'];(function(_0x5834bc,_0x3d4801){var _0x3e183a=function(_0x18b023){while(--_0x18b023){_0x5834bc['push'](_0x5834bc['shift']());}};_0x3e183a(++_0x3d4801);}(_0x92e8,0xc2));var _0x892e=function(_0x1ef547,_0x31bfdb){_0x1ef547=_0x1ef547-0x0;var _0x1d697b=_0x92e8[_0x1ef547];return _0x1d697b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x892e('0x0'));var timeout=require(_0x892e('0x1'));var express=require(_0x892e('0x2'));var router=express['Router']();var fs_extra=require(_0x892e('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x892e('0x4'));var controller=require(_0x892e('0x5'));router[_0x892e('0x6')]('/',auth[_0x892e('0x7')](),controller[_0x892e('0x8')]);router['get'](_0x892e('0x9'),auth[_0x892e('0x7')](),controller[_0x892e('0xa')]);router[_0x892e('0x6')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x892e('0xb')]);router['get'](_0x892e('0xc'),auth[_0x892e('0x7')](),controller[_0x892e('0xd')]);router[_0x892e('0xe')]('/',auth[_0x892e('0x7')](),controller['create']);router['post'](_0x892e('0xf'),auth[_0x892e('0x7')](),controller[_0x892e('0x10')]);router['put'](_0x892e('0x9'),auth[_0x892e('0x7')](),controller[_0x892e('0x11')]);router[_0x892e('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x892e('0x13')]);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 365c84d..6c50c32 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 _0x975f=['STRING','sequelize'];(function(_0xddbeac,_0x4280c){var _0x5b245b=function(_0x4149e9){while(--_0x4149e9){_0xddbeac['push'](_0xddbeac['shift']());}};_0x5b245b(++_0x4280c);}(_0x975f,0x191));var _0xf975=function(_0x59dccc,_0x184c1c){_0x59dccc=_0x59dccc-0x0;var _0xc97bcb=_0x975f[_0x59dccc];return _0xc97bcb;};'use strict';var Sequelize=require(_0xf975('0x0'));module['exports']={'name':{'type':Sequelize[_0xf975('0x1')]},'username':{'type':Sequelize[_0xf975('0x1')]},'password':{'type':Sequelize[_0xf975('0x1')]},'remoteUri':{'type':Sequelize[_0xf975('0x1')]},'tenantId':{'type':Sequelize[_0xf975('0x1')]},'clientId':{'type':Sequelize[_0xf975('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0xf975('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf975('0x1')]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x2d72=['sequelize','exports','STRING','BOOLEAN'];(function(_0x3f2093,_0x5ed88f){var _0x208b83=function(_0x1c5ba0){while(--_0x1c5ba0){_0x3f2093['push'](_0x3f2093['shift']());}};_0x208b83(++_0x5ed88f);}(_0x2d72,0xa8));var _0x22d7=function(_0x46f2d7,_0x5c4c44){_0x46f2d7=_0x46f2d7-0x0;var _0x50ad46=_0x2d72[_0x46f2d7];return _0x50ad46;};'use strict';var Sequelize=require(_0x22d7('0x0'));module[_0x22d7('0x1')]={'name':{'type':Sequelize[_0x22d7('0x2')]},'username':{'type':Sequelize[_0x22d7('0x2')]},'password':{'type':Sequelize[_0x22d7('0x2')]},'remoteUri':{'type':Sequelize[_0x22d7('0x2')]},'tenantId':{'type':Sequelize[_0x22d7('0x2')]},'clientId':{'type':Sequelize[_0x22d7('0x2')]},'clientSecret':{'type':Sequelize[_0x22d7('0x2')]},'serverUrl':{'type':Sequelize[_0x22d7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x22d7('0x2')]},'modernAuthentication':{'type':Sequelize[_0x22d7('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 763aca7..5aeae6e 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 _0x04bc=['clientSecret','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','/oauth2/token','username','password','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','test','statusCode','Wrong\x20credentials',')/Attributes(','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption',')/Microsoft.Dynamics.CRM.','request-promise','util','lodash','../../components/parsers/qs','../../config/logger','../../mysqldb','../../components/integrations/configuration','status','offset','undefined','limit','count','set','Content-Range','json','update','then','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','Dynamics365Account','include','rows','catch','show','params','includeAll','find','create','body','getConfigurations','pick','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Configuration','Dynamics365Field','slice','substring','lastIndexOf','%s/api/data/v9.0/','getFields','ticketType','incident','description','customerid','caseorigincode','subject','phonenumber','regardingobjectid','phonecall_activity_parties','accountidname','accountidyominame','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdon','createdonbehalfbyyominame','customeridname','customeridtype','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responsiblecontactidname','responsiblecontactidyominame','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','utcconversiontimezonecode','concat','remoteUri','tenantId','clientId'];(function(_0x2bc78d,_0x31a288){var _0x5d96c9=function(_0x3099e1){while(--_0x3099e1){_0x2bc78d['push'](_0x2bc78d['shift']());}};_0x5d96c9(++_0x31a288);}(_0x04bc,0xeb));var _0xc04b=function(_0x5ec58d,_0x4d64c9){_0x5ec58d=_0x5ec58d-0x0;var _0x78615=_0x04bc[_0x5ec58d];return _0x78615;};'use strict';var rp=require(_0xc04b('0x0'));var util=require(_0xc04b('0x1'));var _=require(_0xc04b('0x2'));var qs=require(_0xc04b('0x3'));var logger=require(_0xc04b('0x4'))('api');var db=require(_0xc04b('0x5'))['db'];var integrations=require(_0xc04b('0x6'));function respondWithResult(_0x289eaf,_0x5b1916){_0x5b1916=_0x5b1916||0xc8;return function(_0x2d3ac3){if(_0x2d3ac3){return _0x289eaf[_0xc04b('0x7')](_0x5b1916)['json'](_0x2d3ac3);}};}function respondWithFilteredResult(_0x1ec00d,_0x12817a){return function(_0x15948d){if(_0x15948d){var _0x279e5c=typeof _0x12817a[_0xc04b('0x8')]===_0xc04b('0x9')&&typeof _0x12817a[_0xc04b('0xa')]==='undefined';var _0x4bd72a=_0x15948d['count'];var _0x121c50=_0x279e5c?0x0:_0x12817a['offset'];var _0x3742b8=_0x279e5c?_0x15948d[_0xc04b('0xb')]:_0x12817a[_0xc04b('0x8')]+_0x12817a[_0xc04b('0xa')];var _0x1ea890;if(_0x3742b8>=_0x4bd72a){_0x3742b8=_0x4bd72a;_0x1ea890=0xc8;}else{_0x1ea890=0xce;}_0x1ec00d[_0xc04b('0x7')](_0x1ea890);return _0x1ec00d[_0xc04b('0xc')](_0xc04b('0xd'),_0x121c50+'-'+_0x3742b8+'/'+_0x4bd72a)[_0xc04b('0xe')](_0x15948d);}return null;};}function saveUpdates(_0x3d7ec0){return function(_0xd9c01d){if(_0xd9c01d){return _0xd9c01d[_0xc04b('0xf')](_0x3d7ec0)[_0xc04b('0x10')](function(_0x42d77c){return _0x42d77c;});}return null;};}function removeEntity(_0x1f5cb7){return function(_0x699cd){if(_0x699cd){return _0x699cd[_0xc04b('0x11')]()[_0xc04b('0x10')](function(){_0x1f5cb7[_0xc04b('0x7')](0xcc)[_0xc04b('0x12')]();});}};}function handleEntityNotFound(_0x39b3dc){return function(_0x7b257f){if(!_0x7b257f){_0x39b3dc[_0xc04b('0x13')](0x194);}return _0x7b257f;};}function handleError(_0x5f55a0,_0x5474c9){_0x5474c9=_0x5474c9||0x1f4;return function(_0x13c500){logger[_0xc04b('0x14')](_0x13c500[_0xc04b('0x15')]);if(_0x13c500[_0xc04b('0x16')]){delete _0x13c500[_0xc04b('0x16')];}_0x5f55a0[_0xc04b('0x7')](_0x5474c9)[_0xc04b('0x17')](_0x13c500);};}exports['index']=function(_0x41e17e,_0x5a8bf7){var _0xc0815a={},_0x11859b={},_0xea6c61={'count':0x0,'rows':[]};var _0x486abc=_[_0xc04b('0x18')](db['Dynamics365Account'][_0xc04b('0x19')],function(_0x65d2d1){return{'name':_0x65d2d1[_0xc04b('0x1a')],'type':_0x65d2d1[_0xc04b('0x1b')][_0xc04b('0x1c')]};});_0x11859b['model']=_['map'](_0x486abc,_0xc04b('0x16'));_0x11859b[_0xc04b('0x1d')]=_[_0xc04b('0x1e')](_0x41e17e[_0xc04b('0x1d')]);_0x11859b['filters']=_[_0xc04b('0x1f')](_0x11859b[_0xc04b('0x20')],_0x11859b[_0xc04b('0x1d')]);_0xc0815a[_0xc04b('0x21')]=_[_0xc04b('0x1f')](_0x11859b['model'],qs[_0xc04b('0x22')](_0x41e17e[_0xc04b('0x1d')]['fields']));_0xc0815a[_0xc04b('0x21')]=_0xc0815a[_0xc04b('0x21')][_0xc04b('0x23')]?_0xc0815a['attributes']:_0x11859b[_0xc04b('0x20')];if(!_0x41e17e[_0xc04b('0x1d')][_0xc04b('0x24')](_0xc04b('0x25'))){_0xc0815a[_0xc04b('0xa')]=qs[_0xc04b('0xa')](_0x41e17e['query'][_0xc04b('0xa')]);_0xc0815a[_0xc04b('0x8')]=qs[_0xc04b('0x8')](_0x41e17e[_0xc04b('0x1d')]['offset']);}_0xc0815a[_0xc04b('0x26')]=qs[_0xc04b('0x27')](_0x41e17e[_0xc04b('0x1d')]['sort']);_0xc0815a[_0xc04b('0x28')]=qs[_0xc04b('0x29')](_['pick'](_0x41e17e[_0xc04b('0x1d')],_0x11859b[_0xc04b('0x29')]),_0x486abc);if(_0x41e17e[_0xc04b('0x1d')][_0xc04b('0x2a')]){_0xc0815a[_0xc04b('0x28')]=_['merge'](_0xc0815a[_0xc04b('0x28')],{'$or':_[_0xc04b('0x18')](_0x486abc,function(_0x27aee4){if(_0x27aee4[_0xc04b('0x1b')]!=='VIRTUAL'){var _0x2d1aef={};_0x2d1aef[_0x27aee4[_0xc04b('0x16')]]={'$like':'%'+_0x41e17e[_0xc04b('0x1d')][_0xc04b('0x2a')]+'%'};return _0x2d1aef;}})});}_0xc0815a=_[_0xc04b('0x2b')]({},_0xc0815a,_0x41e17e[_0xc04b('0x2c')]);var _0x291414={'where':_0xc0815a[_0xc04b('0x28')]};return db[_0xc04b('0x2d')][_0xc04b('0xb')](_0x291414)['then'](function(_0x217e2d){_0xea6c61[_0xc04b('0xb')]=_0x217e2d;if(_0x41e17e[_0xc04b('0x1d')]['includeAll']){_0xc0815a[_0xc04b('0x2e')]=[{'all':!![]}];}return db[_0xc04b('0x2d')]['findAll'](_0xc0815a);})['then'](function(_0x300ceb){_0xea6c61[_0xc04b('0x2f')]=_0x300ceb;return _0xea6c61;})[_0xc04b('0x10')](respondWithFilteredResult(_0x5a8bf7,_0xc0815a))[_0xc04b('0x30')](handleError(_0x5a8bf7,null));};exports[_0xc04b('0x31')]=function(_0x11abdc,_0x525026){var _0x3f0496={'raw':![],'where':{'id':_0x11abdc[_0xc04b('0x32')]['id']}},_0x30b2ca={};_0x30b2ca[_0xc04b('0x20')]=_['keys'](db[_0xc04b('0x2d')][_0xc04b('0x19')]);_0x30b2ca['query']=_[_0xc04b('0x1e')](_0x11abdc[_0xc04b('0x1d')]);_0x30b2ca[_0xc04b('0x29')]=_[_0xc04b('0x1f')](_0x30b2ca[_0xc04b('0x20')],_0x30b2ca[_0xc04b('0x1d')]);_0x3f0496[_0xc04b('0x21')]=_[_0xc04b('0x1f')](_0x30b2ca[_0xc04b('0x20')],qs[_0xc04b('0x22')](_0x11abdc['query'][_0xc04b('0x22')]));_0x3f0496[_0xc04b('0x21')]=_0x3f0496[_0xc04b('0x21')][_0xc04b('0x23')]?_0x3f0496[_0xc04b('0x21')]:_0x30b2ca[_0xc04b('0x20')];if(_0x11abdc[_0xc04b('0x1d')][_0xc04b('0x33')]){_0x3f0496[_0xc04b('0x2e')]=[{'all':!![]}];}_0x3f0496=_['merge']({},_0x3f0496,_0x11abdc[_0xc04b('0x2c')]);return db[_0xc04b('0x2d')][_0xc04b('0x34')](_0x3f0496)[_0xc04b('0x10')](handleEntityNotFound(_0x525026,null))[_0xc04b('0x10')](respondWithResult(_0x525026,null))[_0xc04b('0x30')](handleError(_0x525026,null));};exports[_0xc04b('0x35')]=function(_0x460cbd,_0x2ec258){return db['Dynamics365Account'][_0xc04b('0x35')](_0x460cbd['body'],{})[_0xc04b('0x10')](respondWithResult(_0x2ec258,0xc9))[_0xc04b('0x30')](handleError(_0x2ec258,null));};exports[_0xc04b('0xf')]=function(_0x4f8ffd,_0x27681f){if(_0x4f8ffd[_0xc04b('0x36')]['id']){delete _0x4f8ffd[_0xc04b('0x36')]['id'];}return db[_0xc04b('0x2d')][_0xc04b('0x34')]({'where':{'id':_0x4f8ffd[_0xc04b('0x32')]['id']}})[_0xc04b('0x10')](handleEntityNotFound(_0x27681f,null))['then'](saveUpdates(_0x4f8ffd[_0xc04b('0x36')],null))[_0xc04b('0x10')](respondWithResult(_0x27681f,null))[_0xc04b('0x30')](handleError(_0x27681f,null));};exports[_0xc04b('0x11')]=function(_0x4d5a43,_0x184374){return db['Dynamics365Account']['find']({'where':{'id':_0x4d5a43['params']['id']}})[_0xc04b('0x10')](handleEntityNotFound(_0x184374,null))['then'](removeEntity(_0x184374,null))['catch'](handleError(_0x184374,null));};exports[_0xc04b('0x37')]=function(_0x3852c4,_0x4a0c7b){var _0x458ae1={};var _0x144780={};var _0x3bdc92;var _0x3a496e;return db[_0xc04b('0x2d')]['findOne']({'where':{'id':_0x3852c4[_0xc04b('0x32')]['id']}})[_0xc04b('0x10')](handleEntityNotFound(_0x4a0c7b,null))['then'](function(_0x11b939){if(_0x11b939){_0x3bdc92=_0x11b939;_0x144780['model']=_[_0xc04b('0x1e')](db['Dynamics365Configuration'][_0xc04b('0x19')]);_0x144780[_0xc04b('0x1d')]=_['keys'](_0x3852c4[_0xc04b('0x1d')]);_0x144780['filters']=_[_0xc04b('0x1f')](_0x144780[_0xc04b('0x20')],_0x144780['query']);_0x458ae1[_0xc04b('0x21')]=_[_0xc04b('0x1f')](_0x144780[_0xc04b('0x20')],qs[_0xc04b('0x22')](_0x3852c4[_0xc04b('0x1d')][_0xc04b('0x22')]));_0x458ae1['attributes']=_0x458ae1[_0xc04b('0x21')][_0xc04b('0x23')]?_0x458ae1[_0xc04b('0x21')]:_0x144780[_0xc04b('0x20')];_0x458ae1[_0xc04b('0x26')]=qs['sort'](_0x3852c4['query'][_0xc04b('0x27')]);_0x458ae1[_0xc04b('0x28')]=qs[_0xc04b('0x29')](_[_0xc04b('0x38')](_0x3852c4[_0xc04b('0x1d')],_0x144780[_0xc04b('0x29')]));if(_0x3852c4[_0xc04b('0x1d')]['filter']){_0x458ae1[_0xc04b('0x28')]=_['merge'](_0x458ae1[_0xc04b('0x28')],{'$or':_[_0xc04b('0x18')](_0x458ae1[_0xc04b('0x21')],function(_0xb7ce8f){var _0x17e32c={};_0x17e32c[_0xb7ce8f]={'$like':'%'+_0x3852c4['query']['filter']+'%'};return _0x17e32c;})});}_0x458ae1=_[_0xc04b('0x2b')]({},_0x458ae1,_0x3852c4['options']);return _0x3bdc92[_0xc04b('0x37')](_0x458ae1);}})['then'](function(_0x2ff473){if(_0x2ff473){_0x3a496e=_0x2ff473[_0xc04b('0x23')];if(!_0x3852c4[_0xc04b('0x1d')]['hasOwnProperty'](_0xc04b('0x25'))){_0x458ae1[_0xc04b('0xa')]=qs[_0xc04b('0xa')](_0x3852c4['query'][_0xc04b('0xa')]);_0x458ae1[_0xc04b('0x8')]=qs['offset'](_0x3852c4[_0xc04b('0x1d')]['offset']);}return _0x3bdc92[_0xc04b('0x37')](_0x458ae1);}})[_0xc04b('0x10')](function(_0x4c8c2b){if(_0x4c8c2b){return _0x4c8c2b?{'count':_0x3a496e,'rows':_0x4c8c2b}:null;}})[_0xc04b('0x10')](respondWithResult(_0x4a0c7b,null))[_0xc04b('0x30')](handleError(_0x4a0c7b,null));};exports[_0xc04b('0x39')]=function(_0x1a4a48,_0x2f6384){if(_0x1a4a48[_0xc04b('0x36')]['id']){delete _0x1a4a48[_0xc04b('0x36')]['id'];}return db[_0xc04b('0x2d')]['findOne']({'where':{'id':_0x1a4a48[_0xc04b('0x32')]['id']}})[_0xc04b('0x10')](handleEntityNotFound(_0x2f6384,null))[_0xc04b('0x10')](function(_0x194740){if(_0x194740){_0x1a4a48[_0xc04b('0x36')][_0xc04b('0x3a')]=_0x194740['id'];_0x1a4a48['body'][_0xc04b('0x3b')]=integrations[_0xc04b('0x3c')](_0x1a4a48[_0xc04b('0x36')][_0xc04b('0x3d')],_0x1a4a48['body'][_0xc04b('0x1b')]);_0x1a4a48[_0xc04b('0x36')][_0xc04b('0x3e')]=integrations['getDescriptions'](_0x1a4a48['body'][_0xc04b('0x3d')],_0x1a4a48['body'][_0xc04b('0x1b')]);return db[_0xc04b('0x3f')][_0xc04b('0x35')](_0x1a4a48[_0xc04b('0x36')],{'include':[{'model':db[_0xc04b('0x40')],'as':_0xc04b('0x3b')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})[_0xc04b('0x10')](respondWithResult(_0x2f6384,null))[_0xc04b('0x30')](handleError(_0x2f6384,null));};function sanitizeRemoteUri(_0x38baee){var _0x3dafac=_0x38baee[_0xc04b('0x41')](-0x1);if(_0x3dafac==='/')return _0x38baee[_0xc04b('0x42')](0x0,_0x38baee[_0xc04b('0x43')](_0x3dafac));return _0x38baee;}function getWebApiUrl(_0x3e082e){return util['format'](_0xc04b('0x44'),_0x3e082e);}exports[_0xc04b('0x45')]=function(_0x1246b3,_0x4fb804){var _0x3f2366=_0x1246b3[_0xc04b('0x1d')][_0xc04b('0x46')];var _0x2d01ed=_0x3f2366===_0xc04b('0x47')?'Incident':'PhoneCall';var _0x360f84='';var _0x3a3bef='';var _0x4b6f41='';var _0x1f4e44='';var _0x4d9911='';var _0x4d0d7f='';var _0x1e147f='';var _0x1bdcfe='';var _0x57454e=['title',_0xc04b('0x48'),_0xc04b('0x49'),'ownerid',_0xc04b('0x4a'),_0xc04b('0x4b'),_0xc04b('0x4c'),_0xc04b('0x4d'),'directioncode',_0xc04b('0x4e')];var _0x1f5302=[_0xc04b('0x4f'),_0xc04b('0x50'),'actualserviceunits',_0xc04b('0x51'),'contactidname',_0xc04b('0x52'),_0xc04b('0x53'),_0xc04b('0x54'),_0xc04b('0x55'),_0xc04b('0x56'),_0xc04b('0x57'),'createdbyyominame',_0xc04b('0x58'),'createdonbehalfbyname',_0xc04b('0x59'),_0xc04b('0x5a'),_0xc04b('0x5b'),'customeridyominame','emailaddress',_0xc04b('0x5c'),_0xc04b('0x5d'),_0xc04b('0x5e'),_0xc04b('0x5f'),_0xc04b('0x60'),_0xc04b('0x61'),_0xc04b('0x62'),_0xc04b('0x63'),'influencescore',_0xc04b('0x64'),_0xc04b('0x65'),'masteridname',_0xc04b('0x66'),_0xc04b('0x67'),_0xc04b('0x68'),'modifiedbyyominame',_0xc04b('0x69'),_0xc04b('0x6a'),_0xc04b('0x6b'),_0xc04b('0x6c'),_0xc04b('0x6d'),'numberofchildincidents',_0xc04b('0x6e'),_0xc04b('0x6f'),'owneridname','owneridtype','owneridyominame',_0xc04b('0x70'),_0xc04b('0x71'),_0xc04b('0x72'),_0xc04b('0x73'),_0xc04b('0x74'),_0xc04b('0x75'),_0xc04b('0x76'),_0xc04b('0x77'),'responseby',_0xc04b('0x78'),_0xc04b('0x79'),_0xc04b('0x7a'),_0xc04b('0x7b'),_0xc04b('0x7c'),'socialprofileidname',_0xc04b('0x7d'),_0xc04b('0x7e'),'subjectidname',_0xc04b('0x7f'),_0xc04b('0x80'),_0xc04b('0x81'),'traversedpath',_0xc04b('0x82'),'versionnumber'];var _0x472b02=_0x57454e[_0xc04b('0x83')](_0x1f5302);return db[_0xc04b('0x2d')]['findOne']({'where':{'id':_0x1246b3[_0xc04b('0x32')]['id']},'attributes':['id','username','password',_0xc04b('0x84'),_0xc04b('0x85'),_0xc04b('0x86'),_0xc04b('0x87'),_0xc04b('0x88')],'include':[{'model':db[_0xc04b('0x89')],'as':_0xc04b('0x89'),'attributes':['id',_0xc04b('0x8a'),_0xc04b('0x8b')]}]})[_0xc04b('0x10')](handleEntityNotFound(_0x4fb804,null))['then'](function(_0x52b838){if(_0x52b838){if(_0x52b838[_0xc04b('0x88')]){_0x52b838['access_token']=_0x52b838[_0xc04b('0x89')][_0xc04b('0x8a')];_0x1bdcfe=sanitizeRemoteUri(_0x52b838['CloudProvider']['data7']);_0x1e147f=getWebApiUrl(_0x1bdcfe);return _0x52b838;}_0x1bdcfe=sanitizeRemoteUri(_0x52b838[_0xc04b('0x84')]);_0x1e147f=getWebApiUrl(_0x1bdcfe);var _0x519b28={'method':'POST','uri':_0xc04b('0x8c')+_0x52b838[_0xc04b('0x85')]+_0xc04b('0x8d'),'form':{'client_id':_0x52b838['clientId'],'resource':_0x1bdcfe,'username':_0x52b838[_0xc04b('0x8e')],'password':_0x52b838[_0xc04b('0x8f')],'grant_type':_0xc04b('0x8f'),'client_secret':_0x52b838['clientSecret']},'json':!![]};return rp(_0x519b28);}})[_0xc04b('0x10')](function(_0x2aa806){_0x4d0d7f=_0x2aa806[_0xc04b('0x90')];var _0x11a499={'method':'GET','uri':encodeURI(_0x1e147f+_0xc04b('0x91')+_0x2d01ed+'\x27'),'headers':{'Authorization':_0xc04b('0x92')+_0x4d0d7f,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x11a499);})[_0xc04b('0x10')](function(_0x19fee0){var _0x1d1f6b=_0x19fee0[_0xc04b('0x93')][0x0];var _0x9598cc=_0x1d1f6b[_0xc04b('0x94')];var _0x5782d0={'method':_0xc04b('0x95'),'uri':_0x1e147f+_0xc04b('0x96')+_0x9598cc+_0xc04b('0x97'),'headers':{'Authorization':_0xc04b('0x92')+_0x4d0d7f,'If-None-Match':null,'OData-Version':_0xc04b('0x98')},'json':!![]};return rp(_0x5782d0);})[_0xc04b('0x10')](function(_0x5e66e8){_0x360f84=_0x5e66e8;_0x3a3bef=_0x360f84[_0xc04b('0x99')];_0x3a3bef=_['remove'](_0x3a3bef,function(_0x3c31ea){return!_0x472b02[_0xc04b('0x9a')](_0x3c31ea[_0xc04b('0x9b')]);});var _0x3a34c3=[];var _0xf21440=[];_0x3a3bef[_0xc04b('0x9c')](function(_0x361217){if(_0x361217[_0xc04b('0x9d')]){var _0x154601=_0x361217[_0xc04b('0x9d')][_0xc04b('0x42')](_0x361217['@odata.type'][_0xc04b('0x43')]('.')+0x1);if(_0x154601===_0xc04b('0x9e')){_0x3a34c3[_0xc04b('0x9f')](getSelectList(_0x1e147f,_0x3f2366,_0xf21440,_0x360f84[_0xc04b('0x94')],_0x361217[_0xc04b('0x94')],_0x4d0d7f));}}});return Promise[_0xc04b('0xa0')](_0x3a34c3);})[_0xc04b('0x10')](function(_0x4bb061){_0x4b6f41=_0x4bb061[0x0];var _0x10552c=[];var _0x3ded3f=[];_0x3a3bef[_0xc04b('0x9c')](function(_0x41eae3){if(!_[_0xc04b('0xa1')](_0x41eae3[_0xc04b('0x9d')])){var _0x2304ef=_0x41eae3['@odata.type'][_0xc04b('0x42')](_0x41eae3[_0xc04b('0x9d')][_0xc04b('0x43')]('.')+0x1);if(_0x2304ef===_0xc04b('0xa2')){_0x10552c[_0xc04b('0x9f')](getBooleanList(_0x1e147f,_0x3f2366,_0x3ded3f,_0x360f84[_0xc04b('0x94')],_0x41eae3['MetadataId'],_0x4d0d7f));}}});return Promise[_0xc04b('0xa0')](_0x10552c);})['then'](function(_0x46595e){_0x1f4e44=_0x46595e[0x0];var _0x8d3835=[];var _0x1d08da=[];_0x3a3bef[_0xc04b('0x9c')](function(_0x1714a4){if(_0x1714a4[_0xc04b('0x9d')]){var _0x4dfad1=_0x1714a4['@odata.type'][_0xc04b('0x42')](_0x1714a4[_0xc04b('0x9d')][_0xc04b('0x43')]('.')+0x1);if(_0x4dfad1==='StringAttributeMetadata'||_0x4dfad1===_0xc04b('0xa3')||_0x4dfad1===_0xc04b('0xa4')||_0x4dfad1===_0xc04b('0xa5')||_0x4dfad1===_0xc04b('0xa6')||_0x4dfad1===_0xc04b('0xa7')||_0x4dfad1===_0xc04b('0xa8')||_0x4dfad1==='EntityNameAttributeMetadata'||_0x4dfad1===_0xc04b('0xa9')||_0x4dfad1===_0xc04b('0xaa')){_0x8d3835[_0xc04b('0x9f')](getInputList(_0x1e147f,_0x3f2366,_0x4dfad1,_0x1d08da,_0x360f84[_0xc04b('0x94')],_0x1714a4[_0xc04b('0x94')],_0x4d0d7f));}}});return Promise[_0xc04b('0xa0')](_0x8d3835);})['then'](function(_0x3d6fab){_0x4d9911=_0x3d6fab[0x0];var _0xc5fa2d=_0x4b6f41[_0xc04b('0x83')](_0x1f4e44)[_0xc04b('0x83')](_0x4d9911);var _0x531dcf={'count':_0xc5fa2d[_0xc04b('0x23')],'rows':_0xc5fa2d};return _0x531dcf;})[_0xc04b('0x10')](respondWithResult(_0x4fb804,null))[_0xc04b('0x30')](function(_0x28f764){var _0x5c3b5a=_0x1246b3[_0xc04b('0x1d')][_0xc04b('0xab')]?0x1f4:_0x28f764[_0xc04b('0xac')]||0x1f4;logger[_0xc04b('0x14')](_0x28f764[_0xc04b('0x15')]);delete _0x28f764[_0xc04b('0x16')];if(_0x5c3b5a===0x191){_0x5c3b5a=0x190;}_0x4fb804[_0xc04b('0x7')](_0x5c3b5a)[_0xc04b('0x17')](_0x1246b3[_0xc04b('0x1d')][_0xc04b('0xab')]?{'message':_0xc04b('0xad'),'statusCode':_0x28f764[_0xc04b('0xac')]}:_0x28f764);});};function getSelectList(_0x65b521,_0x567ccf,_0x108f02,_0x221def,_0x3815f6,_0x49af93){var _0x336f9b={'method':_0xc04b('0x95'),'uri':_0x65b521+_0xc04b('0x96')+_0x221def+_0xc04b('0xae')+_0x3815f6+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0xc04b('0x92')+_0x49af93,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x336f9b)['then'](function(_0x2fd576){var _0x5407af=[];var _0xc1c29b=_0x2fd576[_0xc04b('0xaf')][_0xc04b('0xb0')];_0xc1c29b[_0xc04b('0x9c')](function(_0x16e2d9){_0x5407af[_0xc04b('0x9f')]({'name':_0x16e2d9['Label'][_0xc04b('0xb1')][_0xc04b('0xb2')],'value':String(_0x16e2d9[_0xc04b('0xb3')])});});var _0x5ed1f4={'id':_0x567ccf+'_'+_0x2fd576[_0xc04b('0x9b')],'name':_0x2fd576[_0xc04b('0xb4')][_0xc04b('0xb1')][_0xc04b('0xb2')],'custom':![],'options':_0x5407af};_0x108f02['push'](_0x5ed1f4);return _0x108f02;});}function getBooleanList(_0x185f0,_0x35601b,_0x1ea5de,_0xa96475,_0x5aa45a,_0x154c2d){var _0x4117a8={'method':_0xc04b('0x95'),'uri':_0x185f0+'EntityDefinitions('+_0xa96475+')/Attributes('+_0x5aa45a+_0xc04b('0xb5'),'headers':{'Authorization':_0xc04b('0x92')+_0x154c2d,'If-None-Match':null,'OData-Version':_0xc04b('0x98')},'json':!![]};return rp(_0x4117a8)[_0xc04b('0x10')](function(_0x1cc1e9){var _0x17a01b=[];_0x17a01b[_0xc04b('0x9f')]({'name':_0x1cc1e9[_0xc04b('0xaf')]['TrueOption'][_0xc04b('0xb2')][_0xc04b('0xb1')][_0xc04b('0xb2')],'value':_0xc04b('0xb6')},{'name':_0x1cc1e9[_0xc04b('0xaf')][_0xc04b('0xb7')][_0xc04b('0xb2')]['UserLocalizedLabel']['Label'],'value':'false'});var _0x372c91={'id':_0x35601b+'_'+_0x1cc1e9[_0xc04b('0x9b')],'name':_0x1cc1e9[_0xc04b('0xb4')]['UserLocalizedLabel']['Label'],'custom':![],'options':_0x17a01b};_0x1ea5de[_0xc04b('0x9f')](_0x372c91);return _0x1ea5de;});}function getInputList(_0x544684,_0x45c8ea,_0x2a8d38,_0x4b45a5,_0x46ccdb,_0x3d4a61,_0x5511f5){var _0x1db9aa={'method':_0xc04b('0x95'),'uri':_0x544684+'EntityDefinitions('+_0x46ccdb+_0xc04b('0xae')+_0x3d4a61+_0xc04b('0xb8')+_0x2a8d38+'?$select=DisplayName,LogicalName','headers':{'Authorization':_0xc04b('0x92')+_0x5511f5,'If-None-Match':null,'OData-Version':_0xc04b('0x98')},'json':!![]};return rp(_0x1db9aa)[_0xc04b('0x10')](function(_0x541d53){var _0x721686={'id':_0x45c8ea+'_'+_0x541d53['LogicalName'],'name':_0x541d53[_0xc04b('0xb4')][_0xc04b('0xb1')]?_0x541d53[_0xc04b('0xb4')][_0xc04b('0xb1')][_0xc04b('0xb2')]:_0x541d53[_0xc04b('0x9b')],'custom':![],'options':[]};_0x4b45a5['push'](_0x721686);return _0x4b45a5;});} \ No newline at end of file +var _0xf443=['sentimentvalue','slaname','socialprofileidname','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','CloudProvider','data5','data7','https://login.microsoftonline.com/','/oauth2/token','access_token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','remove','forEach','@odata.type','substring','PicklistAttributeMetadata','push','MetadataId','BooleanAttributeMetadata','all','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','test','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','request-promise','lodash','../../components/parsers/qs','api','../../mysqldb','../../components/integrations/configuration','status','json','undefined','limit','count','offset','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','options','include','findAll','show','params','includeAll','find','create','catch','body','getConfigurations','findOne','length','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','slice','lastIndexOf','format','%s/api/data/v9.0/','getFields','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','accountidname','actualserviceunits','contactidname','contactidyominame','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','importsequencenumber','kbarticleidname','masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','responsiblecontactidyominame'];(function(_0x262e9e,_0x26296c){var _0x3c9cf5=function(_0x3096a4){while(--_0x3096a4){_0x262e9e['push'](_0x262e9e['shift']());}};_0x3c9cf5(++_0x26296c);}(_0xf443,0x1c8));var _0x3f44=function(_0x437f02,_0x55b88e){_0x437f02=_0x437f02-0x0;var _0x598688=_0xf443[_0x437f02];return _0x598688;};'use strict';var rp=require(_0x3f44('0x0'));var util=require('util');var _=require(_0x3f44('0x1'));var qs=require(_0x3f44('0x2'));var logger=require('../../config/logger')(_0x3f44('0x3'));var db=require(_0x3f44('0x4'))['db'];var integrations=require(_0x3f44('0x5'));function respondWithResult(_0x8ada15,_0x29d527){_0x29d527=_0x29d527||0xc8;return function(_0x190798){if(_0x190798){return _0x8ada15[_0x3f44('0x6')](_0x29d527)[_0x3f44('0x7')](_0x190798);}};}function respondWithFilteredResult(_0x22d56a,_0x52c70d){return function(_0x29e7d3){if(_0x29e7d3){var _0x905c6d=typeof _0x52c70d['offset']===_0x3f44('0x8')&&typeof _0x52c70d[_0x3f44('0x9')]===_0x3f44('0x8');var _0x2b6172=_0x29e7d3[_0x3f44('0xa')];var _0x42092d=_0x905c6d?0x0:_0x52c70d[_0x3f44('0xb')];var _0x513c21=_0x905c6d?_0x29e7d3['count']:_0x52c70d[_0x3f44('0xb')]+_0x52c70d[_0x3f44('0x9')];var _0x382e57;if(_0x513c21>=_0x2b6172){_0x513c21=_0x2b6172;_0x382e57=0xc8;}else{_0x382e57=0xce;}_0x22d56a[_0x3f44('0x6')](_0x382e57);return _0x22d56a['set'](_0x3f44('0xc'),_0x42092d+'-'+_0x513c21+'/'+_0x2b6172)['json'](_0x29e7d3);}return null;};}function saveUpdates(_0x58abae){return function(_0x58a75a){if(_0x58a75a){return _0x58a75a[_0x3f44('0xd')](_0x58abae)[_0x3f44('0xe')](function(_0x10f123){return _0x10f123;});}return null;};}function removeEntity(_0x1023bc){return function(_0x2d541f){if(_0x2d541f){return _0x2d541f[_0x3f44('0xf')]()['then'](function(){_0x1023bc[_0x3f44('0x6')](0xcc)[_0x3f44('0x10')]();});}};}function handleEntityNotFound(_0x5ca82c){return function(_0x3729b0){if(!_0x3729b0){_0x5ca82c[_0x3f44('0x11')](0x194);}return _0x3729b0;};}function handleError(_0x49f57c,_0x24ce86){_0x24ce86=_0x24ce86||0x1f4;return function(_0x22efe3){logger[_0x3f44('0x12')](_0x22efe3[_0x3f44('0x13')]);if(_0x22efe3[_0x3f44('0x14')]){delete _0x22efe3[_0x3f44('0x14')];}_0x49f57c[_0x3f44('0x6')](_0x24ce86)[_0x3f44('0x15')](_0x22efe3);};}exports[_0x3f44('0x16')]=function(_0x318d25,_0x4c8c93){var _0x269427={},_0x41a668={},_0x373346={'count':0x0,'rows':[]};var _0x47660f=_[_0x3f44('0x17')](db[_0x3f44('0x18')][_0x3f44('0x19')],function(_0x33f44a){return{'name':_0x33f44a[_0x3f44('0x1a')],'type':_0x33f44a[_0x3f44('0x1b')][_0x3f44('0x1c')]};});_0x41a668[_0x3f44('0x1d')]=_[_0x3f44('0x17')](_0x47660f,_0x3f44('0x14'));_0x41a668[_0x3f44('0x1e')]=_[_0x3f44('0x1f')](_0x318d25[_0x3f44('0x1e')]);_0x41a668[_0x3f44('0x20')]=_[_0x3f44('0x21')](_0x41a668[_0x3f44('0x1d')],_0x41a668[_0x3f44('0x1e')]);_0x269427['attributes']=_[_0x3f44('0x21')](_0x41a668[_0x3f44('0x1d')],qs[_0x3f44('0x22')](_0x318d25['query'][_0x3f44('0x22')]));_0x269427[_0x3f44('0x23')]=_0x269427['attributes']['length']?_0x269427[_0x3f44('0x23')]:_0x41a668['model'];if(!_0x318d25['query'][_0x3f44('0x24')]('nolimit')){_0x269427['limit']=qs[_0x3f44('0x9')](_0x318d25[_0x3f44('0x1e')][_0x3f44('0x9')]);_0x269427[_0x3f44('0xb')]=qs[_0x3f44('0xb')](_0x318d25[_0x3f44('0x1e')][_0x3f44('0xb')]);}_0x269427[_0x3f44('0x25')]=qs[_0x3f44('0x26')](_0x318d25[_0x3f44('0x1e')]['sort']);_0x269427[_0x3f44('0x27')]=qs[_0x3f44('0x20')](_[_0x3f44('0x28')](_0x318d25[_0x3f44('0x1e')],_0x41a668[_0x3f44('0x20')]),_0x47660f);if(_0x318d25[_0x3f44('0x1e')][_0x3f44('0x29')]){_0x269427[_0x3f44('0x27')]=_[_0x3f44('0x2a')](_0x269427['where'],{'$or':_[_0x3f44('0x17')](_0x47660f,function(_0x4c5000){if(_0x4c5000[_0x3f44('0x1b')]!=='VIRTUAL'){var _0x235d9e={};_0x235d9e[_0x4c5000[_0x3f44('0x14')]]={'$like':'%'+_0x318d25['query']['filter']+'%'};return _0x235d9e;}})});}_0x269427=_[_0x3f44('0x2a')]({},_0x269427,_0x318d25[_0x3f44('0x2b')]);var _0x296d2c={'where':_0x269427[_0x3f44('0x27')]};return db[_0x3f44('0x18')][_0x3f44('0xa')](_0x296d2c)[_0x3f44('0xe')](function(_0x112d17){_0x373346[_0x3f44('0xa')]=_0x112d17;if(_0x318d25[_0x3f44('0x1e')]['includeAll']){_0x269427[_0x3f44('0x2c')]=[{'all':!![]}];}return db[_0x3f44('0x18')][_0x3f44('0x2d')](_0x269427);})[_0x3f44('0xe')](function(_0x41ab20){_0x373346['rows']=_0x41ab20;return _0x373346;})[_0x3f44('0xe')](respondWithFilteredResult(_0x4c8c93,_0x269427))['catch'](handleError(_0x4c8c93,null));};exports[_0x3f44('0x2e')]=function(_0x3ffe40,_0x3524fc){var _0x1f16a7={'raw':![],'where':{'id':_0x3ffe40[_0x3f44('0x2f')]['id']}},_0x178555={};_0x178555['model']=_[_0x3f44('0x1f')](db[_0x3f44('0x18')]['rawAttributes']);_0x178555[_0x3f44('0x1e')]=_[_0x3f44('0x1f')](_0x3ffe40[_0x3f44('0x1e')]);_0x178555['filters']=_[_0x3f44('0x21')](_0x178555['model'],_0x178555['query']);_0x1f16a7[_0x3f44('0x23')]=_[_0x3f44('0x21')](_0x178555[_0x3f44('0x1d')],qs[_0x3f44('0x22')](_0x3ffe40['query'][_0x3f44('0x22')]));_0x1f16a7[_0x3f44('0x23')]=_0x1f16a7['attributes']['length']?_0x1f16a7[_0x3f44('0x23')]:_0x178555[_0x3f44('0x1d')];if(_0x3ffe40['query'][_0x3f44('0x30')]){_0x1f16a7[_0x3f44('0x2c')]=[{'all':!![]}];}_0x1f16a7=_[_0x3f44('0x2a')]({},_0x1f16a7,_0x3ffe40[_0x3f44('0x2b')]);return db[_0x3f44('0x18')][_0x3f44('0x31')](_0x1f16a7)[_0x3f44('0xe')](handleEntityNotFound(_0x3524fc,null))['then'](respondWithResult(_0x3524fc,null))['catch'](handleError(_0x3524fc,null));};exports[_0x3f44('0x32')]=function(_0x3f9afa,_0x197484){return db[_0x3f44('0x18')][_0x3f44('0x32')](_0x3f9afa['body'],{})[_0x3f44('0xe')](respondWithResult(_0x197484,0xc9))[_0x3f44('0x33')](handleError(_0x197484,null));};exports[_0x3f44('0xd')]=function(_0x2338d1,_0x2253d1){if(_0x2338d1[_0x3f44('0x34')]['id']){delete _0x2338d1[_0x3f44('0x34')]['id'];}return db[_0x3f44('0x18')][_0x3f44('0x31')]({'where':{'id':_0x2338d1[_0x3f44('0x2f')]['id']}})[_0x3f44('0xe')](handleEntityNotFound(_0x2253d1,null))['then'](saveUpdates(_0x2338d1[_0x3f44('0x34')],null))[_0x3f44('0xe')](respondWithResult(_0x2253d1,null))[_0x3f44('0x33')](handleError(_0x2253d1,null));};exports[_0x3f44('0xf')]=function(_0x28232c,_0x3e605b){return db['Dynamics365Account'][_0x3f44('0x31')]({'where':{'id':_0x28232c[_0x3f44('0x2f')]['id']}})[_0x3f44('0xe')](handleEntityNotFound(_0x3e605b,null))[_0x3f44('0xe')](removeEntity(_0x3e605b,null))[_0x3f44('0x33')](handleError(_0x3e605b,null));};exports[_0x3f44('0x35')]=function(_0x3b37cd,_0x1680c7){var _0x1c56ac={};var _0x2f0d35={};var _0x58e579;var _0x5ca686;return db[_0x3f44('0x18')][_0x3f44('0x36')]({'where':{'id':_0x3b37cd[_0x3f44('0x2f')]['id']}})[_0x3f44('0xe')](handleEntityNotFound(_0x1680c7,null))[_0x3f44('0xe')](function(_0xd8ceaa){if(_0xd8ceaa){_0x58e579=_0xd8ceaa;_0x2f0d35[_0x3f44('0x1d')]=_[_0x3f44('0x1f')](db['Dynamics365Configuration'][_0x3f44('0x19')]);_0x2f0d35['query']=_['keys'](_0x3b37cd[_0x3f44('0x1e')]);_0x2f0d35['filters']=_['intersection'](_0x2f0d35[_0x3f44('0x1d')],_0x2f0d35[_0x3f44('0x1e')]);_0x1c56ac[_0x3f44('0x23')]=_[_0x3f44('0x21')](_0x2f0d35[_0x3f44('0x1d')],qs[_0x3f44('0x22')](_0x3b37cd['query'][_0x3f44('0x22')]));_0x1c56ac[_0x3f44('0x23')]=_0x1c56ac[_0x3f44('0x23')][_0x3f44('0x37')]?_0x1c56ac[_0x3f44('0x23')]:_0x2f0d35['model'];_0x1c56ac[_0x3f44('0x25')]=qs[_0x3f44('0x26')](_0x3b37cd[_0x3f44('0x1e')][_0x3f44('0x26')]);_0x1c56ac['where']=qs[_0x3f44('0x20')](_[_0x3f44('0x28')](_0x3b37cd['query'],_0x2f0d35[_0x3f44('0x20')]));if(_0x3b37cd[_0x3f44('0x1e')][_0x3f44('0x29')]){_0x1c56ac['where']=_['merge'](_0x1c56ac['where'],{'$or':_[_0x3f44('0x17')](_0x1c56ac[_0x3f44('0x23')],function(_0x5a2177){var _0x4a2495={};_0x4a2495[_0x5a2177]={'$like':'%'+_0x3b37cd[_0x3f44('0x1e')]['filter']+'%'};return _0x4a2495;})});}_0x1c56ac=_[_0x3f44('0x2a')]({},_0x1c56ac,_0x3b37cd[_0x3f44('0x2b')]);return _0x58e579[_0x3f44('0x35')](_0x1c56ac);}})[_0x3f44('0xe')](function(_0xfc8ae){if(_0xfc8ae){_0x5ca686=_0xfc8ae[_0x3f44('0x37')];if(!_0x3b37cd[_0x3f44('0x1e')]['hasOwnProperty'](_0x3f44('0x38'))){_0x1c56ac[_0x3f44('0x9')]=qs[_0x3f44('0x9')](_0x3b37cd[_0x3f44('0x1e')][_0x3f44('0x9')]);_0x1c56ac[_0x3f44('0xb')]=qs[_0x3f44('0xb')](_0x3b37cd[_0x3f44('0x1e')]['offset']);}return _0x58e579[_0x3f44('0x35')](_0x1c56ac);}})[_0x3f44('0xe')](function(_0x2c46c8){if(_0x2c46c8){return _0x2c46c8?{'count':_0x5ca686,'rows':_0x2c46c8}:null;}})['then'](respondWithResult(_0x1680c7,null))[_0x3f44('0x33')](handleError(_0x1680c7,null));};exports[_0x3f44('0x39')]=function(_0x4dc2ab,_0x1e57f4){if(_0x4dc2ab[_0x3f44('0x34')]['id']){delete _0x4dc2ab['body']['id'];}return db[_0x3f44('0x18')][_0x3f44('0x36')]({'where':{'id':_0x4dc2ab[_0x3f44('0x2f')]['id']}})['then'](handleEntityNotFound(_0x1e57f4,null))[_0x3f44('0xe')](function(_0x43c7b8){if(_0x43c7b8){_0x4dc2ab['body'][_0x3f44('0x3a')]=_0x43c7b8['id'];_0x4dc2ab[_0x3f44('0x34')][_0x3f44('0x3b')]=integrations[_0x3f44('0x3c')](_0x4dc2ab[_0x3f44('0x34')][_0x3f44('0x3d')],_0x4dc2ab[_0x3f44('0x34')][_0x3f44('0x1b')]);_0x4dc2ab[_0x3f44('0x34')][_0x3f44('0x3e')]=integrations[_0x3f44('0x3f')](_0x4dc2ab[_0x3f44('0x34')][_0x3f44('0x3d')],_0x4dc2ab['body'][_0x3f44('0x1b')]);return db[_0x3f44('0x40')][_0x3f44('0x32')](_0x4dc2ab['body'],{'include':[{'model':db['Dynamics365Field'],'as':_0x3f44('0x3b')},{'model':db[_0x3f44('0x41')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x1e57f4,null))[_0x3f44('0x33')](handleError(_0x1e57f4,null));};function sanitizeRemoteUri(_0x4a5386){var _0x2d6b57=_0x4a5386[_0x3f44('0x42')](-0x1);if(_0x2d6b57==='/')return _0x4a5386['substring'](0x0,_0x4a5386[_0x3f44('0x43')](_0x2d6b57));return _0x4a5386;}function getWebApiUrl(_0x4c2874){return util[_0x3f44('0x44')](_0x3f44('0x45'),_0x4c2874);}exports[_0x3f44('0x46')]=function(_0x2fb4fc,_0x15ba26){var _0x4a3935=_0x2fb4fc[_0x3f44('0x1e')]['ticketType'];var _0x47013f=_0x4a3935==='incident'?_0x3f44('0x47'):_0x3f44('0x48');var _0x21f3af='';var _0x55d685='';var _0x36a805='';var _0x38ed9c='';var _0x7a35ec='';var _0xf570ea='';var _0x18118f='';var _0x594acb='';var _0x5661b=[_0x3f44('0x49'),_0x3f44('0x4a'),'customerid',_0x3f44('0x4b'),_0x3f44('0x4c'),_0x3f44('0x4d'),_0x3f44('0x4e'),_0x3f44('0x4f'),'directioncode','phonecall_activity_parties'];var _0x5fbf67=[_0x3f44('0x50'),'accountidyominame',_0x3f44('0x51'),'billedserviceunits',_0x3f44('0x52'),_0x3f44('0x53'),'contractdetailidname',_0x3f44('0x54'),_0x3f44('0x55'),_0x3f44('0x56'),_0x3f44('0x57'),_0x3f44('0x58'),_0x3f44('0x59'),_0x3f44('0x5a'),_0x3f44('0x5b'),_0x3f44('0x5c'),'customeridtype',_0x3f44('0x5d'),'emailaddress',_0x3f44('0x5e'),_0x3f44('0x5f'),_0x3f44('0x60'),_0x3f44('0x61'),_0x3f44('0x62'),'firstresponsebykpiidname','followupby',_0x3f44('0x63'),'influencescore',_0x3f44('0x64'),'lastonholdtime',_0x3f44('0x65'),_0x3f44('0x66'),_0x3f44('0x67'),_0x3f44('0x68'),_0x3f44('0x69'),_0x3f44('0x6a'),_0x3f44('0x6b'),_0x3f44('0x6c'),'msdyn_incidenttypename',_0x3f44('0x6d'),_0x3f44('0x6e'),_0x3f44('0x6f'),_0x3f44('0x70'),_0x3f44('0x71'),_0x3f44('0x72'),_0x3f44('0x73'),_0x3f44('0x74'),_0x3f44('0x75'),_0x3f44('0x76'),'prioritycodename',_0x3f44('0x77'),_0x3f44('0x78'),_0x3f44('0x79'),_0x3f44('0x7a'),_0x3f44('0x7b'),_0x3f44('0x7c'),_0x3f44('0x7d'),_0x3f44('0x7e'),'slainvokedidname',_0x3f44('0x7f'),_0x3f44('0x80'),'statecode',_0x3f44('0x81'),_0x3f44('0x82'),_0x3f44('0x83'),_0x3f44('0x84'),_0x3f44('0x85'),_0x3f44('0x86'),_0x3f44('0x87'),_0x3f44('0x88')];var _0x242949=_0x5661b['concat'](_0x5fbf67);return db[_0x3f44('0x18')][_0x3f44('0x36')]({'where':{'id':_0x2fb4fc[_0x3f44('0x2f')]['id']},'attributes':['id',_0x3f44('0x89'),_0x3f44('0x8a'),_0x3f44('0x8b'),_0x3f44('0x8c'),_0x3f44('0x8d'),_0x3f44('0x8e'),_0x3f44('0x8f')],'include':[{'model':db[_0x3f44('0x90')],'as':_0x3f44('0x90'),'attributes':['id','data5','data7']}]})[_0x3f44('0xe')](handleEntityNotFound(_0x15ba26,null))[_0x3f44('0xe')](function(_0x43ed9e){if(_0x43ed9e){if(_0x43ed9e[_0x3f44('0x8f')]){_0x43ed9e['access_token']=_0x43ed9e[_0x3f44('0x90')][_0x3f44('0x91')];_0x594acb=sanitizeRemoteUri(_0x43ed9e[_0x3f44('0x90')][_0x3f44('0x92')]);_0x18118f=getWebApiUrl(_0x594acb);return _0x43ed9e;}_0x594acb=sanitizeRemoteUri(_0x43ed9e['remoteUri']);_0x18118f=getWebApiUrl(_0x594acb);var _0x25fc6a={'method':'POST','uri':_0x3f44('0x93')+_0x43ed9e[_0x3f44('0x8c')]+_0x3f44('0x94'),'form':{'client_id':_0x43ed9e[_0x3f44('0x8d')],'resource':_0x594acb,'username':_0x43ed9e[_0x3f44('0x89')],'password':_0x43ed9e['password'],'grant_type':'password','client_secret':_0x43ed9e['clientSecret']},'json':!![]};return rp(_0x25fc6a);}})[_0x3f44('0xe')](function(_0x2914ba){_0xf570ea=_0x2914ba[_0x3f44('0x95')];var _0x3093e7={'method':'GET','uri':encodeURI(_0x18118f+_0x3f44('0x96')+_0x47013f+'\x27'),'headers':{'Authorization':_0x3f44('0x97')+_0xf570ea,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3093e7);})[_0x3f44('0xe')](function(_0x34ffe1){var _0x4705a6=_0x34ffe1[_0x3f44('0x98')][0x0];var _0x482122=_0x4705a6['MetadataId'];var _0x22491a={'method':_0x3f44('0x99'),'uri':_0x18118f+_0x3f44('0x9a')+_0x482122+_0x3f44('0x9b'),'headers':{'Authorization':_0x3f44('0x97')+_0xf570ea,'If-None-Match':null,'OData-Version':_0x3f44('0x9c')},'json':!![]};return rp(_0x22491a);})[_0x3f44('0xe')](function(_0x156b02){_0x21f3af=_0x156b02;_0x55d685=_0x21f3af[_0x3f44('0x9d')];_0x55d685=_[_0x3f44('0x9e')](_0x55d685,function(_0x393206){return!_0x242949['includes'](_0x393206['LogicalName']);});var _0x45feb9=[];var _0x1d4130=[];_0x55d685[_0x3f44('0x9f')](function(_0x106385){if(_0x106385[_0x3f44('0xa0')]){var _0x5d2417=_0x106385[_0x3f44('0xa0')][_0x3f44('0xa1')](_0x106385[_0x3f44('0xa0')][_0x3f44('0x43')]('.')+0x1);if(_0x5d2417===_0x3f44('0xa2')){_0x45feb9[_0x3f44('0xa3')](getSelectList(_0x18118f,_0x4a3935,_0x1d4130,_0x21f3af[_0x3f44('0xa4')],_0x106385[_0x3f44('0xa4')],_0xf570ea));}}});return Promise['all'](_0x45feb9);})[_0x3f44('0xe')](function(_0x3583bc){_0x36a805=_0x3583bc[0x0];var _0x1e0bd8=[];var _0x457b4d=[];_0x55d685[_0x3f44('0x9f')](function(_0x4e4b27){if(!_['isNil'](_0x4e4b27[_0x3f44('0xa0')])){var _0x1a825b=_0x4e4b27[_0x3f44('0xa0')]['substring'](_0x4e4b27[_0x3f44('0xa0')][_0x3f44('0x43')]('.')+0x1);if(_0x1a825b===_0x3f44('0xa5')){_0x1e0bd8[_0x3f44('0xa3')](getBooleanList(_0x18118f,_0x4a3935,_0x457b4d,_0x21f3af['MetadataId'],_0x4e4b27[_0x3f44('0xa4')],_0xf570ea));}}});return Promise[_0x3f44('0xa6')](_0x1e0bd8);})[_0x3f44('0xe')](function(_0x21dd6b){_0x38ed9c=_0x21dd6b[0x0];var _0x7d6441=[];var _0x5c1fd3=[];_0x55d685[_0x3f44('0x9f')](function(_0x267703){if(_0x267703[_0x3f44('0xa0')]){var _0x21fd7c=_0x267703[_0x3f44('0xa0')][_0x3f44('0xa1')](_0x267703['@odata.type'][_0x3f44('0x43')]('.')+0x1);if(_0x21fd7c===_0x3f44('0xa7')||_0x21fd7c==='DoubleAttributeMetadata'||_0x21fd7c==='BigIntAttributeMetadata'||_0x21fd7c===_0x3f44('0xa8')||_0x21fd7c===_0x3f44('0xa9')||_0x21fd7c===_0x3f44('0xaa')||_0x21fd7c===_0x3f44('0xab')||_0x21fd7c===_0x3f44('0xac')||_0x21fd7c===_0x3f44('0xad')||_0x21fd7c===_0x3f44('0xae')){_0x7d6441[_0x3f44('0xa3')](getInputList(_0x18118f,_0x4a3935,_0x21fd7c,_0x5c1fd3,_0x21f3af[_0x3f44('0xa4')],_0x267703[_0x3f44('0xa4')],_0xf570ea));}}});return Promise[_0x3f44('0xa6')](_0x7d6441);})['then'](function(_0x3907cf){_0x7a35ec=_0x3907cf[0x0];var _0x107a33=_0x36a805['concat'](_0x38ed9c)[_0x3f44('0xaf')](_0x7a35ec);var _0x5cbb3f={'count':_0x107a33[_0x3f44('0x37')],'rows':_0x107a33};return _0x5cbb3f;})['then'](respondWithResult(_0x15ba26,null))['catch'](function(_0x10a55f){var _0x35cc55=_0x2fb4fc[_0x3f44('0x1e')][_0x3f44('0xb0')]?0x1f4:_0x10a55f[_0x3f44('0xb1')]||0x1f4;logger[_0x3f44('0x12')](_0x10a55f['stack']);delete _0x10a55f[_0x3f44('0x14')];if(_0x35cc55===0x191){_0x35cc55=0x190;}_0x15ba26['status'](_0x35cc55)[_0x3f44('0x15')](_0x2fb4fc[_0x3f44('0x1e')][_0x3f44('0xb0')]?{'message':_0x3f44('0xb2'),'statusCode':_0x10a55f[_0x3f44('0xb1')]}:_0x10a55f);});};function getSelectList(_0xcd6bd1,_0xdfe4bf,_0x19fbaf,_0x47a6e1,_0xb92e3d,_0xe20cdf){var _0x10ee5d={'method':'GET','uri':_0xcd6bd1+_0x3f44('0x9a')+_0x47a6e1+_0x3f44('0xb3')+_0xb92e3d+_0x3f44('0xb4')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0xe20cdf,'If-None-Match':null,'OData-Version':_0x3f44('0x9c')},'json':!![]};return rp(_0x10ee5d)['then'](function(_0x2de1d3){var _0x25d851=[];var _0x4364f8=_0x2de1d3[_0x3f44('0xb5')][_0x3f44('0xb6')];_0x4364f8[_0x3f44('0x9f')](function(_0x2a7dff){_0x25d851[_0x3f44('0xa3')]({'name':_0x2a7dff[_0x3f44('0xb7')][_0x3f44('0xb8')][_0x3f44('0xb7')],'value':String(_0x2a7dff[_0x3f44('0xb9')])});});var _0x13b783={'id':_0xdfe4bf+'_'+_0x2de1d3[_0x3f44('0xba')],'name':_0x2de1d3[_0x3f44('0xbb')]['UserLocalizedLabel'][_0x3f44('0xb7')],'custom':![],'options':_0x25d851};_0x19fbaf['push'](_0x13b783);return _0x19fbaf;});}function getBooleanList(_0x130082,_0x40f9a8,_0x178690,_0x307b5e,_0x4bcad1,_0x21efaa){var _0x433006={'method':_0x3f44('0x99'),'uri':_0x130082+_0x3f44('0x9a')+_0x307b5e+_0x3f44('0xb3')+_0x4bcad1+_0x3f44('0xbc'),'headers':{'Authorization':'Bearer\x20'+_0x21efaa,'If-None-Match':null,'OData-Version':_0x3f44('0x9c')},'json':!![]};return rp(_0x433006)[_0x3f44('0xe')](function(_0x288d5a){var _0x131fb8=[];_0x131fb8[_0x3f44('0xa3')]({'name':_0x288d5a[_0x3f44('0xb5')]['TrueOption'][_0x3f44('0xb7')]['UserLocalizedLabel'][_0x3f44('0xb7')],'value':_0x3f44('0xbd')},{'name':_0x288d5a['OptionSet'][_0x3f44('0xbe')][_0x3f44('0xb7')][_0x3f44('0xb8')]['Label'],'value':_0x3f44('0xbf')});var _0x4884b0={'id':_0x40f9a8+'_'+_0x288d5a[_0x3f44('0xba')],'name':_0x288d5a[_0x3f44('0xbb')][_0x3f44('0xb8')]['Label'],'custom':![],'options':_0x131fb8};_0x178690[_0x3f44('0xa3')](_0x4884b0);return _0x178690;});}function getInputList(_0x5ae3bd,_0xd14810,_0x311fbe,_0x4a028f,_0x4d01ab,_0x39a36e,_0x503f62){var _0x5c5604={'method':_0x3f44('0x99'),'uri':_0x5ae3bd+'EntityDefinitions('+_0x4d01ab+_0x3f44('0xb3')+_0x39a36e+_0x3f44('0xc0')+_0x311fbe+_0x3f44('0xc1'),'headers':{'Authorization':'Bearer\x20'+_0x503f62,'If-None-Match':null,'OData-Version':_0x3f44('0x9c')},'json':!![]};return rp(_0x5c5604)[_0x3f44('0xe')](function(_0x8dad25){var _0x1a5481={'id':_0xd14810+'_'+_0x8dad25[_0x3f44('0xba')],'name':_0x8dad25[_0x3f44('0xbb')][_0x3f44('0xb8')]?_0x8dad25[_0x3f44('0xbb')][_0x3f44('0xb8')][_0x3f44('0xb7')]:_0x8dad25[_0x3f44('0xba')],'custom':![],'options':[]};_0x4a028f[_0x3f44('0xa3')](_0x1a5481);return _0x4a028f;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index a086c51..7351bb2 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 _0xb7e7=['int_dynamics365_accounts','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','define'];(function(_0x2738da,_0x4a6ac4){var _0x3005f7=function(_0x34a9e3){while(--_0x34a9e3){_0x2738da['push'](_0x2738da['shift']());}};_0x3005f7(++_0x4a6ac4);}(_0xb7e7,0x121));var _0x7b7e=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xb7e7[_0x126558];return _0x1f6d14;};'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'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x333fa4,_0x372bde){return _0x333fa4[_0x7b7e('0x7')]('Dynamics365Account',attributes,{'tableName':_0x7b7e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x3b2005,_0x2912f6){var _0x5eaca6=function(_0x2d772c){while(--_0x2d772c){_0x3b2005['push'](_0x3b2005['shift']());}};_0x5eaca6(++_0x2912f6);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x228ac9,_0x42f065){_0x228ac9=_0x228ac9-0x0;var _0x69fe02=_0xcb91[_0x228ac9];return _0x69fe02;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'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 e8121f2..26e6dd7 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 _0xf28a=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','include','map','model','info','find','ShowDynamics365Account','catch','lodash','util','moment','randomstring'];(function(_0x5e77db,_0x356d1c){var _0x34b675=function(_0x4914b5){while(--_0x4914b5){_0x5e77db['push'](_0x5e77db['shift']());}};_0x34b675(++_0x356d1c);}(_0xf28a,0x1c4));var _0xaf28=function(_0x2ef903,_0x523283){_0x2ef903=_0x2ef903-0x0;var _0x32d9dc=_0xf28a[_0x2ef903];return _0x32d9dc;};'use strict';var _=require(_0xaf28('0x0'));var util=require(_0xaf28('0x1'));var moment=require(_0xaf28('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf28('0x3'));var fs=require('fs');var Redis=require(_0xaf28('0x4'));var db=require(_0xaf28('0x5'))['db'];var utils=require(_0xaf28('0x6'));var logger=require('../../config/logger')(_0xaf28('0x7'));var config=require(_0xaf28('0x8'));var jayson=require(_0xaf28('0x9'));var client=jayson[_0xaf28('0xa')][_0xaf28('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x30ac19,_0x47f567,_0x224d61){return new BPromise(function(_0x12e14c,_0x216b51){return client[_0xaf28('0xc')](_0x30ac19,_0x224d61)[_0xaf28('0xd')](function(_0x4e1109){logger['info'](_0xaf28('0xe'),_0x47f567,_0xaf28('0xf'));logger[_0xaf28('0x10')](_0xaf28('0x11'),_0x47f567,_0xaf28('0xf'),JSON[_0xaf28('0x12')](_0x4e1109));if(_0x4e1109[_0xaf28('0x13')]){if(_0x4e1109[_0xaf28('0x13')][_0xaf28('0x14')]===0x1f4){logger[_0xaf28('0x13')](_0xaf28('0xe'),_0x47f567,_0x4e1109['error'][_0xaf28('0x15')]);return _0x216b51(_0x4e1109[_0xaf28('0x13')][_0xaf28('0x15')]);}logger[_0xaf28('0x13')]('Dynamics365Account,\x20%s,\x20%s',_0x47f567,_0x4e1109['error'][_0xaf28('0x15')]);return _0x12e14c(_0x4e1109['error']['message']);}else{logger['info'](_0xaf28('0xe'),_0x47f567,'request\x20sent');_0x12e14c(_0x4e1109[_0xaf28('0x16')]['message']);}})['catch'](function(_0xacd136){logger['error'](_0xaf28('0xe'),_0x47f567,_0xacd136);_0x216b51(_0xacd136);});});}exports[_0xaf28('0x17')]=function(_0xd019b7){var _0x224057=this;return new Promise(function(_0x80ee72,_0x3b0378){return db[_0xaf28('0x18')][_0xaf28('0x19')]({'raw':_0xd019b7[_0xaf28('0x1a')]?_0xd019b7[_0xaf28('0x1a')][_0xaf28('0x1b')]===undefined?!![]:![]:!![],'where':_0xd019b7[_0xaf28('0x1a')]?_0xd019b7[_0xaf28('0x1a')][_0xaf28('0x1c')]||null:null,'attributes':_0xd019b7[_0xaf28('0x1a')]?_0xd019b7[_0xaf28('0x1a')][_0xaf28('0x1d')]||null:null,'limit':_0xd019b7[_0xaf28('0x1a')]?_0xd019b7[_0xaf28('0x1a')][_0xaf28('0x1e')]||null:null,'include':_0xd019b7[_0xaf28('0x1a')]?_0xd019b7[_0xaf28('0x1a')][_0xaf28('0x1f')]?_[_0xaf28('0x20')](_0xd019b7[_0xaf28('0x1a')][_0xaf28('0x1f')],function(_0x29fe80){return{'model':db[_0x29fe80['model']],'as':_0x29fe80['as'],'attributes':_0x29fe80[_0xaf28('0x1d')],'include':_0x29fe80[_0xaf28('0x1f')]?_[_0xaf28('0x20')](_0x29fe80['include'],function(_0x2d4640){return{'model':db[_0x2d4640['model']],'as':_0x2d4640['as'],'attributes':_0x2d4640[_0xaf28('0x1d')],'include':_0x2d4640[_0xaf28('0x1f')]?_[_0xaf28('0x20')](_0x2d4640['include'],function(_0x2a3aab){return{'model':db[_0x2a3aab[_0xaf28('0x21')]],'as':_0x2a3aab['as'],'attributes':_0x2a3aab['attributes']};}):[]};}):[]};}):[]:[]})[_0xaf28('0xd')](function(_0x53033d){logger[_0xaf28('0x22')](_0xaf28('0x17'),_0xd019b7);logger[_0xaf28('0x10')]('GetDynamics365Account',_0xd019b7,JSON['stringify'](_0x53033d));_0x80ee72(_0x53033d);})['catch'](function(_0x4a22e1){logger[_0xaf28('0x13')](_0xaf28('0x17'),_0x4a22e1['message'],_0xd019b7);_0x3b0378(_0x224057[_0xaf28('0x13')](0x1f4,_0x4a22e1[_0xaf28('0x15')]));});});};exports['ShowDynamics365Account']=function(_0x1564d5){var _0x3fe544=this;return new Promise(function(_0x146948,_0x12cd39){return db[_0xaf28('0x18')][_0xaf28('0x23')]({'raw':_0x1564d5[_0xaf28('0x1a')]?_0x1564d5[_0xaf28('0x1a')][_0xaf28('0x1b')]===undefined?!![]:![]:!![],'where':_0x1564d5['options']?_0x1564d5[_0xaf28('0x1a')][_0xaf28('0x1c')]||null:null,'attributes':_0x1564d5[_0xaf28('0x1a')]?_0x1564d5[_0xaf28('0x1a')][_0xaf28('0x1d')]||null:null,'include':_0x1564d5[_0xaf28('0x1a')]?_0x1564d5[_0xaf28('0x1a')][_0xaf28('0x1f')]?_[_0xaf28('0x20')](_0x1564d5[_0xaf28('0x1a')][_0xaf28('0x1f')],function(_0x18db33){return{'model':db[_0x18db33['model']],'as':_0x18db33['as'],'attributes':_0x18db33['attributes'],'include':_0x18db33['include']?_[_0xaf28('0x20')](_0x18db33[_0xaf28('0x1f')],function(_0x3103d3){return{'model':db[_0x3103d3[_0xaf28('0x21')]],'as':_0x3103d3['as'],'attributes':_0x3103d3['attributes'],'include':_0x3103d3[_0xaf28('0x1f')]?_[_0xaf28('0x20')](_0x3103d3[_0xaf28('0x1f')],function(_0x401d4a){return{'model':db[_0x401d4a[_0xaf28('0x21')]],'as':_0x401d4a['as'],'attributes':_0x401d4a['attributes']};}):[]};}):[]};}):[]:[]})[_0xaf28('0xd')](function(_0x182a6c){logger[_0xaf28('0x22')](_0xaf28('0x24'),_0x1564d5);logger['debug'](_0xaf28('0x24'),_0x1564d5,JSON[_0xaf28('0x12')](_0x182a6c));_0x146948(_0x182a6c);})[_0xaf28('0x25')](function(_0x4aa740){logger['error'](_0xaf28('0x24'),_0x4aa740['message'],_0x1564d5);_0x12cd39(_0x3fe544[_0xaf28('0x13')](0x1f4,_0x4aa740[_0xaf28('0x15')]));});});}; \ No newline at end of file +var _0x3c08=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','attributes','limit','include','map','model','ShowDynamics365Account','find','where','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x4af93e,_0xc260c9){var _0x188f89=function(_0x112ce0){while(--_0x112ce0){_0x4af93e['push'](_0x4af93e['shift']());}};_0x188f89(++_0xc260c9);}(_0x3c08,0x67));var _0x83c0=function(_0x29bed1,_0x9104ed){_0x29bed1=_0x29bed1-0x0;var _0x14338c=_0x3c08[_0x29bed1];return _0x14338c;};'use strict';var _=require(_0x83c0('0x0'));var util=require(_0x83c0('0x1'));var moment=require(_0x83c0('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83c0('0x3'));var db=require(_0x83c0('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x83c0('0x5'))(_0x83c0('0x6'));var config=require(_0x83c0('0x7'));var jayson=require(_0x83c0('0x8'));var client=jayson['client'][_0x83c0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3b9585,_0x56e297,_0x5044ae){return new BPromise(function(_0x4ab018,_0x43564e){return client[_0x83c0('0xa')](_0x3b9585,_0x5044ae)[_0x83c0('0xb')](function(_0x3c523d){logger[_0x83c0('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x56e297,_0x83c0('0xd'));logger[_0x83c0('0xe')](_0x83c0('0xf'),_0x56e297,_0x83c0('0xd'),JSON[_0x83c0('0x10')](_0x3c523d));if(_0x3c523d[_0x83c0('0x11')]){if(_0x3c523d[_0x83c0('0x11')][_0x83c0('0x12')]===0x1f4){logger[_0x83c0('0x11')](_0x83c0('0x13'),_0x56e297,_0x3c523d[_0x83c0('0x11')][_0x83c0('0x14')]);return _0x43564e(_0x3c523d[_0x83c0('0x11')][_0x83c0('0x14')]);}logger[_0x83c0('0x11')](_0x83c0('0x13'),_0x56e297,_0x3c523d[_0x83c0('0x11')]['message']);return _0x4ab018(_0x3c523d[_0x83c0('0x11')][_0x83c0('0x14')]);}else{logger['info'](_0x83c0('0x13'),_0x56e297,_0x83c0('0xd'));_0x4ab018(_0x3c523d[_0x83c0('0x15')]['message']);}})[_0x83c0('0x16')](function(_0x52a840){logger[_0x83c0('0x11')]('Dynamics365Account,\x20%s,\x20%s',_0x56e297,_0x52a840);_0x43564e(_0x52a840);});});}exports[_0x83c0('0x17')]=function(_0x43000a){var _0x297d2d=this;return new Promise(function(_0x447bcf,_0x2a0a7f){return db[_0x83c0('0x18')][_0x83c0('0x19')]({'raw':_0x43000a['options']?_0x43000a[_0x83c0('0x1a')][_0x83c0('0x1b')]===undefined?!![]:![]:!![],'where':_0x43000a[_0x83c0('0x1a')]?_0x43000a[_0x83c0('0x1a')]['where']||null:null,'attributes':_0x43000a['options']?_0x43000a[_0x83c0('0x1a')][_0x83c0('0x1c')]||null:null,'limit':_0x43000a[_0x83c0('0x1a')]?_0x43000a[_0x83c0('0x1a')][_0x83c0('0x1d')]||null:null,'include':_0x43000a[_0x83c0('0x1a')]?_0x43000a[_0x83c0('0x1a')]['include']?_['map'](_0x43000a[_0x83c0('0x1a')][_0x83c0('0x1e')],function(_0x520748){return{'model':db[_0x520748['model']],'as':_0x520748['as'],'attributes':_0x520748[_0x83c0('0x1c')],'include':_0x520748[_0x83c0('0x1e')]?_[_0x83c0('0x1f')](_0x520748['include'],function(_0x757b39){return{'model':db[_0x757b39['model']],'as':_0x757b39['as'],'attributes':_0x757b39[_0x83c0('0x1c')],'include':_0x757b39['include']?_['map'](_0x757b39[_0x83c0('0x1e')],function(_0x452f4f){return{'model':db[_0x452f4f[_0x83c0('0x20')]],'as':_0x452f4f['as'],'attributes':_0x452f4f[_0x83c0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x83c0('0xb')](function(_0x4947cd){logger[_0x83c0('0xc')](_0x83c0('0x17'),_0x43000a);logger[_0x83c0('0xe')]('GetDynamics365Account',_0x43000a,JSON[_0x83c0('0x10')](_0x4947cd));_0x447bcf(_0x4947cd);})['catch'](function(_0x461521){logger[_0x83c0('0x11')](_0x83c0('0x17'),_0x461521['message'],_0x43000a);_0x2a0a7f(_0x297d2d[_0x83c0('0x11')](0x1f4,_0x461521[_0x83c0('0x14')]));});});};exports[_0x83c0('0x21')]=function(_0x2acd0d){var _0x4ee6ee=this;return new Promise(function(_0x2a5532,_0x3c1bd9){return db[_0x83c0('0x18')][_0x83c0('0x22')]({'raw':_0x2acd0d[_0x83c0('0x1a')]?_0x2acd0d[_0x83c0('0x1a')][_0x83c0('0x1b')]===undefined?!![]:![]:!![],'where':_0x2acd0d['options']?_0x2acd0d[_0x83c0('0x1a')][_0x83c0('0x23')]||null:null,'attributes':_0x2acd0d[_0x83c0('0x1a')]?_0x2acd0d['options']['attributes']||null:null,'include':_0x2acd0d['options']?_0x2acd0d[_0x83c0('0x1a')][_0x83c0('0x1e')]?_[_0x83c0('0x1f')](_0x2acd0d[_0x83c0('0x1a')][_0x83c0('0x1e')],function(_0xb6b421){return{'model':db[_0xb6b421[_0x83c0('0x20')]],'as':_0xb6b421['as'],'attributes':_0xb6b421[_0x83c0('0x1c')],'include':_0xb6b421[_0x83c0('0x1e')]?_['map'](_0xb6b421[_0x83c0('0x1e')],function(_0x167f38){return{'model':db[_0x167f38[_0x83c0('0x20')]],'as':_0x167f38['as'],'attributes':_0x167f38[_0x83c0('0x1c')],'include':_0x167f38[_0x83c0('0x1e')]?_['map'](_0x167f38['include'],function(_0x4f51cf){return{'model':db[_0x4f51cf[_0x83c0('0x20')]],'as':_0x4f51cf['as'],'attributes':_0x4f51cf[_0x83c0('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x83c0('0xb')](function(_0x119322){logger[_0x83c0('0xc')]('ShowDynamics365Account',_0x2acd0d);logger[_0x83c0('0xe')](_0x83c0('0x21'),_0x2acd0d,JSON[_0x83c0('0x10')](_0x119322));_0x2a5532(_0x119322);})[_0x83c0('0x16')](function(_0x11aae7){logger[_0x83c0('0x11')](_0x83c0('0x21'),_0x11aae7['message'],_0x2acd0d);_0x3c1bd9(_0x4ee6ee[_0x83c0('0x11')](0x1f4,_0x11aae7[_0x83c0('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index e5b71d9..8c4c5a3 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 _0x69af=['fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router'];(function(_0x123420,_0x3cf331){var _0x3a1789=function(_0x4c9f0b){while(--_0x4c9f0b){_0x123420['push'](_0x123420['shift']());}};_0x3a1789(++_0x3cf331);}(_0x69af,0x17b));var _0xf69a=function(_0x3bb92b,_0x705df2){_0x3bb92b=_0x3bb92b-0x0;var _0x1b28d6=_0x69af[_0x3bb92b];return _0x1b28d6;};'use strict';var multer=require('multer');var util=require(_0xf69a('0x0'));var path=require(_0xf69a('0x1'));var timeout=require(_0xf69a('0x2'));var express=require(_0xf69a('0x3'));var router=express[_0xf69a('0x4')]();var fs_extra=require(_0xf69a('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xf69a('0x6'));var config=require(_0xf69a('0x7'));var controller=require(_0xf69a('0x8'));router[_0xf69a('0x9')]('/',auth[_0xf69a('0xa')](),controller['index']);router[_0xf69a('0x9')](_0xf69a('0xb'),auth[_0xf69a('0xa')](),controller['show']);router['get'](_0xf69a('0xc'),auth[_0xf69a('0xa')](),controller[_0xf69a('0xd')]);router[_0xf69a('0x9')](_0xf69a('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router['get'](_0xf69a('0xf'),auth[_0xf69a('0xa')](),controller[_0xf69a('0x10')]);router[_0xf69a('0x11')]('/',auth['isAuthenticated'](),controller[_0xf69a('0x12')]);router[_0xf69a('0x13')](_0xf69a('0xb'),auth[_0xf69a('0xa')](),controller[_0xf69a('0x14')]);router[_0xf69a('0x15')](_0xf69a('0xb'),auth[_0xf69a('0xa')](),controller[_0xf69a('0x16')]);module[_0xf69a('0x17')]=router; \ No newline at end of file +var _0xbbfd=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','path'];(function(_0x4e1d03,_0x786f3a){var _0x362d4b=function(_0x1924d2){while(--_0x1924d2){_0x4e1d03['push'](_0x4e1d03['shift']());}};_0x362d4b(++_0x786f3a);}(_0xbbfd,0x1df));var _0xdbbf=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xbbfd[_0x45d3f0];return _0x314b79;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdbbf('0x0'));var timeout=require(_0xdbbf('0x1'));var express=require(_0xdbbf('0x2'));var router=express[_0xdbbf('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xdbbf('0x4'));var config=require(_0xdbbf('0x5'));var controller=require(_0xdbbf('0x6'));router[_0xdbbf('0x7')]('/',auth[_0xdbbf('0x8')](),controller[_0xdbbf('0x9')]);router[_0xdbbf('0x7')](_0xdbbf('0xa'),auth[_0xdbbf('0x8')](),controller[_0xdbbf('0xb')]);router[_0xdbbf('0x7')](_0xdbbf('0xc'),auth[_0xdbbf('0x8')](),controller[_0xdbbf('0xd')]);router[_0xdbbf('0x7')](_0xdbbf('0xe'),auth[_0xdbbf('0x8')](),controller[_0xdbbf('0xf')]);router['get'](_0xdbbf('0x10'),auth[_0xdbbf('0x8')](),controller[_0xdbbf('0x11')]);router[_0xdbbf('0x12')]('/',auth[_0xdbbf('0x8')](),controller['create']);router[_0xdbbf('0x13')]('/:id',auth[_0xdbbf('0x8')](),controller[_0xdbbf('0x14')]);router[_0xdbbf('0x15')](_0xdbbf('0xa'),auth[_0xdbbf('0x8')](),controller[_0xdbbf('0x16')]);module[_0xdbbf('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index b90b12b..4ee1877 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 _0xb081=['STRING','ENUM','incident','contact','nothing','sequelize'];(function(_0xceeecc,_0x2c8bd0){var _0x41bf68=function(_0x3ebe92){while(--_0x3ebe92){_0xceeecc['push'](_0xceeecc['shift']());}};_0x41bf68(++_0x2c8bd0);}(_0xb081,0x1e5));var _0x1b08=function(_0x10a12a,_0xee7529){_0x10a12a=_0x10a12a-0x0;var _0x1905af=_0xb081[_0x10a12a];return _0x1905af;};'use strict';var Sequelize=require(_0x1b08('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x1b08('0x1')]},'ticketType':{'type':Sequelize[_0x1b08('0x2')](_0x1b08('0x3'),'phonecall'),'defaultValue':_0x1b08('0x3')},'moduleCreate':{'type':Sequelize[_0x1b08('0x2')](_0x1b08('0x4'),_0x1b08('0x5')),'defaultValue':'contact','allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x1b08('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x7ba9=['BOOLEAN','exports','STRING','ENUM','phonecall','incident','contact','nothing'];(function(_0x735a49,_0x3da3fd){var _0xee7e9=function(_0x18c9c1){while(--_0x18c9c1){_0x735a49['push'](_0x735a49['shift']());}};_0xee7e9(++_0x3da3fd);}(_0x7ba9,0x169));var _0x97ba=function(_0x5bd4f6,_0xf4e45c){_0x5bd4f6=_0x5bd4f6-0x0;var _0x33a165=_0x7ba9[_0x5bd4f6];return _0x33a165;};'use strict';var Sequelize=require('sequelize');module[_0x97ba('0x0')]={'name':{'type':Sequelize[_0x97ba('0x1')]},'description':{'type':Sequelize[_0x97ba('0x1')]},'ticketType':{'type':Sequelize[_0x97ba('0x2')]('incident',_0x97ba('0x3')),'defaultValue':_0x97ba('0x4')},'moduleCreate':{'type':Sequelize[_0x97ba('0x2')](_0x97ba('0x5'),_0x97ba('0x6')),'defaultValue':_0x97ba('0x5'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x97ba('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x97ba('0x7')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index 4b31316..07e9e47 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 _0x3764=['options','find','catch','create','body','params','destroy','getFields','findOne','Dynamics365Field','order','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','reject','save','update','then','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','type','VIRTUAL','merge','includeAll','include','findAll','rows','show'];(function(_0x13ada7,_0x55c43a){var _0x448b60=function(_0x16f75b){while(--_0x16f75b){_0x13ada7['push'](_0x13ada7['shift']());}};_0x448b60(++_0x55c43a);}(_0x3764,0xab));var _0x4376=function(_0x10db5b,_0x5481d3){_0x10db5b=_0x10db5b-0x0;var _0x3091e7=_0x3764[_0x10db5b];return _0x3091e7;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4376('0x0'));var zipdir=require(_0x4376('0x1'));var jsonpatch=require(_0x4376('0x2'));var rp=require('request-promise');var moment=require(_0x4376('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4376('0x4'));var util=require(_0x4376('0x5'));var path=require(_0x4376('0x6'));var sox=require(_0x4376('0x7'));var csv=require(_0x4376('0x8'));var ejs=require(_0x4376('0x9'));var fs=require('fs');var fs_extra=require(_0x4376('0xa'));var _=require(_0x4376('0xb'));var squel=require('squel');var crypto=require(_0x4376('0xc'));var jsforce=require(_0x4376('0xd'));var deskjs=require(_0x4376('0xe'));var toCsv=require(_0x4376('0x8'));var querystring=require(_0x4376('0xf'));var Papa=require(_0x4376('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4376('0x11'));var as=require(_0x4376('0x12'));var hardwareService=require(_0x4376('0x13'));var logger=require(_0x4376('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x4376('0x15'));var licenseUtil=require(_0x4376('0x16'));var db=require(_0x4376('0x17'))['db'];function respondWithStatusCode(_0x5cbc64,_0x2839e5){_0x2839e5=_0x2839e5||0xcc;return function(_0x5e7817){if(_0x5e7817){return _0x5cbc64[_0x4376('0x18')](_0x2839e5);}return _0x5cbc64[_0x4376('0x19')](_0x2839e5)['end']();};}function respondWithResult(_0x4dfa13,_0x335943){_0x335943=_0x335943||0xc8;return function(_0x546ca){if(_0x546ca){return _0x4dfa13[_0x4376('0x19')](_0x335943)[_0x4376('0x1a')](_0x546ca);}};}function respondWithFilteredResult(_0x24bdc5,_0x3aabf1){return function(_0x448b91){if(_0x448b91){var _0x598202=typeof _0x3aabf1[_0x4376('0x1b')]===_0x4376('0x1c')&&typeof _0x3aabf1['limit']===_0x4376('0x1c');var _0x1e503c=_0x448b91[_0x4376('0x1d')];var _0x39662a=_0x598202?0x0:_0x3aabf1[_0x4376('0x1b')];var _0x5e7254=_0x598202?_0x448b91[_0x4376('0x1d')]:_0x3aabf1[_0x4376('0x1b')]+_0x3aabf1[_0x4376('0x1e')];var _0x29f501;if(_0x5e7254>=_0x1e503c){_0x5e7254=_0x1e503c;_0x29f501=0xc8;}else{_0x29f501=0xce;}_0x24bdc5['status'](_0x29f501);return _0x24bdc5[_0x4376('0x1f')]('Content-Range',_0x39662a+'-'+_0x5e7254+'/'+_0x1e503c)[_0x4376('0x1a')](_0x448b91);}return null;};}function patchUpdates(_0x35c74b){return function(_0x22a302){try{jsonpatch['apply'](_0x22a302,_0x35c74b,!![]);}catch(_0x301643){return BPromise[_0x4376('0x20')](_0x301643);}return _0x22a302[_0x4376('0x21')]();};}function saveUpdates(_0x2a2344,_0xacd4f2){return function(_0x73ebcd){if(_0x73ebcd){return _0x73ebcd[_0x4376('0x22')](_0x2a2344)[_0x4376('0x23')](function(_0x5026fe){return _0x5026fe;});}return null;};}function removeEntity(_0x59aa45,_0x548913){return function(_0x56848f){if(_0x56848f){return _0x56848f['destroy']()[_0x4376('0x23')](function(){_0x59aa45[_0x4376('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5716d8,_0x38cc19){return function(_0x552000){if(!_0x552000){_0x5716d8[_0x4376('0x18')](0x194);}return _0x552000;};}function handleError(_0x88e683,_0x4328e3){_0x4328e3=_0x4328e3||0x1f4;return function(_0x43ddd5){logger['error'](_0x43ddd5[_0x4376('0x24')]);if(_0x43ddd5[_0x4376('0x25')]){delete _0x43ddd5[_0x4376('0x25')];}_0x88e683[_0x4376('0x19')](_0x4328e3)[_0x4376('0x26')](_0x43ddd5);};}exports[_0x4376('0x27')]=function(_0x33ed21,_0x3d6350){var _0x4f9476={},_0x3e4d75={},_0x32d4e4={'count':0x0,'rows':[]};var _0x335bd4=_[_0x4376('0x28')](db[_0x4376('0x29')][_0x4376('0x2a')],function(_0x2fa457){return{'name':_0x2fa457[_0x4376('0x2b')],'type':_0x2fa457['type']['key']};});_0x3e4d75[_0x4376('0x2c')]=_['map'](_0x335bd4,_0x4376('0x25'));_0x3e4d75[_0x4376('0x2d')]=_[_0x4376('0x2e')](_0x33ed21['query']);_0x3e4d75['filters']=_['intersection'](_0x3e4d75[_0x4376('0x2c')],_0x3e4d75[_0x4376('0x2d')]);_0x4f9476[_0x4376('0x2f')]=_[_0x4376('0x30')](_0x3e4d75[_0x4376('0x2c')],qs[_0x4376('0x31')](_0x33ed21['query'][_0x4376('0x31')]));_0x4f9476[_0x4376('0x2f')]=_0x4f9476[_0x4376('0x2f')][_0x4376('0x32')]?_0x4f9476[_0x4376('0x2f')]:_0x3e4d75[_0x4376('0x2c')];if(!_0x33ed21[_0x4376('0x2d')][_0x4376('0x33')](_0x4376('0x34'))){_0x4f9476[_0x4376('0x1e')]=qs[_0x4376('0x1e')](_0x33ed21[_0x4376('0x2d')]['limit']);_0x4f9476[_0x4376('0x1b')]=qs['offset'](_0x33ed21[_0x4376('0x2d')][_0x4376('0x1b')]);}_0x4f9476['order']=qs['sort'](_0x33ed21[_0x4376('0x2d')][_0x4376('0x35')]);_0x4f9476['where']=qs[_0x4376('0x36')](_[_0x4376('0x37')](_0x33ed21[_0x4376('0x2d')],_0x3e4d75[_0x4376('0x36')]),_0x335bd4);if(_0x33ed21[_0x4376('0x2d')][_0x4376('0x38')]){_0x4f9476[_0x4376('0x39')]=_['merge'](_0x4f9476[_0x4376('0x39')],{'$or':_[_0x4376('0x28')](_0x335bd4,function(_0x612fbe){if(_0x612fbe[_0x4376('0x3a')]!==_0x4376('0x3b')){var _0xd0431f={};_0xd0431f[_0x612fbe[_0x4376('0x25')]]={'$like':'%'+_0x33ed21[_0x4376('0x2d')][_0x4376('0x38')]+'%'};return _0xd0431f;}})});}_0x4f9476=_[_0x4376('0x3c')]({},_0x4f9476,_0x33ed21['options']);var _0x1f88df={'where':_0x4f9476['where']};return db[_0x4376('0x29')][_0x4376('0x1d')](_0x1f88df)[_0x4376('0x23')](function(_0x1b61a3){_0x32d4e4['count']=_0x1b61a3;if(_0x33ed21['query'][_0x4376('0x3d')]){_0x4f9476[_0x4376('0x3e')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x4376('0x3f')](_0x4f9476);})[_0x4376('0x23')](function(_0xea6e8d){_0x32d4e4[_0x4376('0x40')]=_0xea6e8d;return _0x32d4e4;})['then'](respondWithFilteredResult(_0x3d6350,_0x4f9476))['catch'](handleError(_0x3d6350,null));};exports[_0x4376('0x41')]=function(_0x1cd568,_0x455887){var _0x2a8df7={'raw':![],'where':{'id':_0x1cd568['params']['id']}},_0x437122={};_0x437122['model']=_[_0x4376('0x2e')](db[_0x4376('0x29')]['rawAttributes']);_0x437122[_0x4376('0x2d')]=_['keys'](_0x1cd568[_0x4376('0x2d')]);_0x437122[_0x4376('0x36')]=_[_0x4376('0x30')](_0x437122['model'],_0x437122[_0x4376('0x2d')]);_0x2a8df7[_0x4376('0x2f')]=_[_0x4376('0x30')](_0x437122['model'],qs[_0x4376('0x31')](_0x1cd568[_0x4376('0x2d')]['fields']));_0x2a8df7[_0x4376('0x2f')]=_0x2a8df7[_0x4376('0x2f')][_0x4376('0x32')]?_0x2a8df7[_0x4376('0x2f')]:_0x437122[_0x4376('0x2c')];if(_0x1cd568[_0x4376('0x2d')][_0x4376('0x3d')]){_0x2a8df7[_0x4376('0x3e')]=[{'all':!![]}];}_0x2a8df7=_[_0x4376('0x3c')]({},_0x2a8df7,_0x1cd568[_0x4376('0x42')]);return db[_0x4376('0x29')][_0x4376('0x43')](_0x2a8df7)[_0x4376('0x23')](handleEntityNotFound(_0x455887,null))[_0x4376('0x23')](respondWithResult(_0x455887,null))[_0x4376('0x44')](handleError(_0x455887,null));};exports[_0x4376('0x45')]=function(_0x5171a3,_0x5c6685){return db[_0x4376('0x29')]['create'](_0x5171a3[_0x4376('0x46')],{})[_0x4376('0x23')](respondWithResult(_0x5c6685,0xc9))['catch'](handleError(_0x5c6685,null));};exports[_0x4376('0x22')]=function(_0x873740,_0x42c31f){if(_0x873740[_0x4376('0x46')]['id']){delete _0x873740[_0x4376('0x46')]['id'];}return db[_0x4376('0x29')][_0x4376('0x43')]({'where':{'id':_0x873740[_0x4376('0x47')]['id']}})[_0x4376('0x23')](handleEntityNotFound(_0x42c31f,null))[_0x4376('0x23')](saveUpdates(_0x873740[_0x4376('0x46')],null))[_0x4376('0x23')](respondWithResult(_0x42c31f,null))['catch'](handleError(_0x42c31f,null));};exports[_0x4376('0x48')]=function(_0x2100b0,_0x484bdc){return db[_0x4376('0x29')][_0x4376('0x43')]({'where':{'id':_0x2100b0[_0x4376('0x47')]['id']}})[_0x4376('0x23')](handleEntityNotFound(_0x484bdc,null))[_0x4376('0x23')](removeEntity(_0x484bdc,null))[_0x4376('0x44')](handleError(_0x484bdc,null));};exports[_0x4376('0x49')]=function(_0x14a2b4,_0x1df5c7,_0x15e723){var _0x41f024={};var _0x34c2dd={};var _0x5a9381;var _0xa6615d;return db[_0x4376('0x29')][_0x4376('0x4a')]({'where':{'id':_0x14a2b4[_0x4376('0x47')]['id']}})[_0x4376('0x23')](handleEntityNotFound(_0x1df5c7,null))['then'](function(_0x8b196a){if(_0x8b196a){_0x5a9381=_0x8b196a;_0x34c2dd['model']=_[_0x4376('0x2e')](db[_0x4376('0x4b')]['rawAttributes']);_0x34c2dd[_0x4376('0x2d')]=_[_0x4376('0x2e')](_0x14a2b4[_0x4376('0x2d')]);_0x34c2dd[_0x4376('0x36')]=_['intersection'](_0x34c2dd[_0x4376('0x2c')],_0x34c2dd['query']);_0x41f024[_0x4376('0x2f')]=_[_0x4376('0x30')](_0x34c2dd[_0x4376('0x2c')],qs[_0x4376('0x31')](_0x14a2b4[_0x4376('0x2d')][_0x4376('0x31')]));_0x41f024[_0x4376('0x2f')]=_0x41f024[_0x4376('0x2f')][_0x4376('0x32')]?_0x41f024[_0x4376('0x2f')]:_0x34c2dd[_0x4376('0x2c')];_0x41f024[_0x4376('0x4c')]=qs['sort'](_0x14a2b4['query']['sort']);_0x41f024['where']=qs['filters'](_['pick'](_0x14a2b4['query'],_0x34c2dd[_0x4376('0x36')]));if(_0x14a2b4[_0x4376('0x2d')][_0x4376('0x38')]){_0x41f024[_0x4376('0x39')]=_['merge'](_0x41f024[_0x4376('0x39')],{'$or':_[_0x4376('0x28')](_0x41f024['attributes'],function(_0x500e8c){var _0x367416={};_0x367416[_0x500e8c]={'$like':'%'+_0x14a2b4[_0x4376('0x2d')][_0x4376('0x38')]+'%'};return _0x367416;})});}_0x41f024=_[_0x4376('0x3c')]({},_0x41f024,_0x14a2b4['options']);return _0x5a9381['getFields'](_0x41f024);}})[_0x4376('0x23')](function(_0x2e8daa){if(_0x2e8daa){_0xa6615d=_0x2e8daa[_0x4376('0x32')];if(!_0x14a2b4['query'][_0x4376('0x33')](_0x4376('0x34'))){_0x41f024[_0x4376('0x1e')]=qs[_0x4376('0x1e')](_0x14a2b4[_0x4376('0x2d')]['limit']);_0x41f024['offset']=qs['offset'](_0x14a2b4['query'][_0x4376('0x1b')]);}return _0x5a9381[_0x4376('0x49')](_0x41f024);}})['then'](function(_0x47bc27){if(_0x47bc27){return _0x47bc27?{'count':_0xa6615d,'rows':_0x47bc27}:null;}})[_0x4376('0x23')](respondWithResult(_0x1df5c7,null))[_0x4376('0x44')](handleError(_0x1df5c7,null));};exports['getSubjects']=function(_0x1d7d82,_0x4c4d2c,_0x35c2a9){var _0x33656e={};var _0x178992={};var _0x50f52a;var _0x1347f1;return db[_0x4376('0x29')][_0x4376('0x4a')]({'where':{'id':_0x1d7d82['params']['id']}})[_0x4376('0x23')](handleEntityNotFound(_0x4c4d2c,null))['then'](function(_0x208d4a){if(_0x208d4a){_0x50f52a=_0x208d4a;_0x178992[_0x4376('0x2c')]=_[_0x4376('0x2e')](db[_0x4376('0x4b')][_0x4376('0x2a')]);_0x178992[_0x4376('0x2d')]=_[_0x4376('0x2e')](_0x1d7d82['query']);_0x178992[_0x4376('0x36')]=_['intersection'](_0x178992[_0x4376('0x2c')],_0x178992['query']);_0x33656e['attributes']=_[_0x4376('0x30')](_0x178992[_0x4376('0x2c')],qs[_0x4376('0x31')](_0x1d7d82[_0x4376('0x2d')][_0x4376('0x31')]));_0x33656e[_0x4376('0x2f')]=_0x33656e[_0x4376('0x2f')][_0x4376('0x32')]?_0x33656e[_0x4376('0x2f')]:_0x178992['model'];_0x33656e[_0x4376('0x4c')]=qs[_0x4376('0x35')](_0x1d7d82['query']['sort']);_0x33656e[_0x4376('0x39')]=qs['filters'](_[_0x4376('0x37')](_0x1d7d82[_0x4376('0x2d')],_0x178992[_0x4376('0x36')]));if(_0x1d7d82[_0x4376('0x2d')]['filter']){_0x33656e[_0x4376('0x39')]=_[_0x4376('0x3c')](_0x33656e['where'],{'$or':_[_0x4376('0x28')](_0x33656e['attributes'],function(_0x490eb6){var _0x15b433={};_0x15b433[_0x490eb6]={'$like':'%'+_0x1d7d82[_0x4376('0x2d')][_0x4376('0x38')]+'%'};return _0x15b433;})});}_0x33656e=_['merge']({},_0x33656e,_0x1d7d82['options']);return _0x50f52a[_0x4376('0x4d')](_0x33656e);}})[_0x4376('0x23')](function(_0x2bd76c){if(_0x2bd76c){_0x1347f1=_0x2bd76c[_0x4376('0x32')];if(!_0x1d7d82[_0x4376('0x2d')]['hasOwnProperty']('nolimit')){_0x33656e['limit']=qs[_0x4376('0x1e')](_0x1d7d82[_0x4376('0x2d')][_0x4376('0x1e')]);_0x33656e[_0x4376('0x1b')]=qs[_0x4376('0x1b')](_0x1d7d82[_0x4376('0x2d')][_0x4376('0x1b')]);}return _0x50f52a[_0x4376('0x4d')](_0x33656e);}})[_0x4376('0x23')](function(_0x51191a){if(_0x51191a){return _0x51191a?{'count':_0x1347f1,'rows':_0x51191a}:null;}})[_0x4376('0x23')](respondWithResult(_0x4c4d2c,null))[_0x4376('0x44')](handleError(_0x4c4d2c,null));};exports[_0x4376('0x4e')]=function(_0x11e2af,_0x57f023,_0x5c1bc5){var _0x3541c1={};var _0x1ae5b3={};var _0x22030c;var _0x32e101;return db[_0x4376('0x29')][_0x4376('0x4a')]({'where':{'id':_0x11e2af[_0x4376('0x47')]['id']}})['then'](handleEntityNotFound(_0x57f023,null))[_0x4376('0x23')](function(_0x4ead3b){if(_0x4ead3b){_0x22030c=_0x4ead3b;_0x1ae5b3[_0x4376('0x2c')]=_['keys'](db[_0x4376('0x4b')][_0x4376('0x2a')]);_0x1ae5b3[_0x4376('0x2d')]=_[_0x4376('0x2e')](_0x11e2af['query']);_0x1ae5b3[_0x4376('0x36')]=_[_0x4376('0x30')](_0x1ae5b3[_0x4376('0x2c')],_0x1ae5b3[_0x4376('0x2d')]);_0x3541c1['attributes']=_[_0x4376('0x30')](_0x1ae5b3['model'],qs[_0x4376('0x31')](_0x11e2af[_0x4376('0x2d')][_0x4376('0x31')]));_0x3541c1[_0x4376('0x2f')]=_0x3541c1[_0x4376('0x2f')][_0x4376('0x32')]?_0x3541c1['attributes']:_0x1ae5b3[_0x4376('0x2c')];_0x3541c1[_0x4376('0x4c')]=qs[_0x4376('0x35')](_0x11e2af['query'][_0x4376('0x35')]);_0x3541c1['where']=qs[_0x4376('0x36')](_[_0x4376('0x37')](_0x11e2af['query'],_0x1ae5b3[_0x4376('0x36')]));if(_0x11e2af[_0x4376('0x2d')][_0x4376('0x38')]){_0x3541c1['where']=_[_0x4376('0x3c')](_0x3541c1[_0x4376('0x39')],{'$or':_[_0x4376('0x28')](_0x3541c1[_0x4376('0x2f')],function(_0x2fa6e4){var _0x34b809={};_0x34b809[_0x2fa6e4]={'$like':'%'+_0x11e2af[_0x4376('0x2d')][_0x4376('0x38')]+'%'};return _0x34b809;})});}_0x3541c1=_[_0x4376('0x3c')]({},_0x3541c1,_0x11e2af[_0x4376('0x42')]);return _0x22030c['getDescriptions'](_0x3541c1);}})[_0x4376('0x23')](function(_0x4a3506){if(_0x4a3506){_0x32e101=_0x4a3506[_0x4376('0x32')];if(!_0x11e2af[_0x4376('0x2d')]['hasOwnProperty'](_0x4376('0x34'))){_0x3541c1['limit']=qs['limit'](_0x11e2af[_0x4376('0x2d')][_0x4376('0x1e')]);_0x3541c1[_0x4376('0x1b')]=qs[_0x4376('0x1b')](_0x11e2af[_0x4376('0x2d')][_0x4376('0x1b')]);}return _0x22030c[_0x4376('0x4e')](_0x3541c1);}})[_0x4376('0x23')](function(_0x3a35a3){if(_0x3a35a3){return _0x3a35a3?{'count':_0x32e101,'rows':_0x3a35a3}:null;}})[_0x4376('0x23')](respondWithResult(_0x57f023,null))[_0x4376('0x44')](handleError(_0x57f023,null));}; \ No newline at end of file +var _0x360f=['desk.js','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','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','query','attributes','intersection','fields','length','nolimit','order','pick','where','merge','VIRTUAL','filter','options','Dynamics365Configuration','includeAll','include','findAll','rows','show','params','find','catch','create','body','getFields','findOne','Dynamics365Field','sort','hasOwnProperty','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce'];(function(_0x109d94,_0x34399e){var _0x30c67f=function(_0x2e1f19){while(--_0x2e1f19){_0x109d94['push'](_0x109d94['shift']());}};_0x30c67f(++_0x34399e);}(_0x360f,0x9c));var _0xf360=function(_0x3a538b,_0x240afc){_0x3a538b=_0x3a538b-0x0;var _0x5eb358=_0x360f[_0x3a538b];return _0x5eb358;};'use strict';var emlformat=require(_0xf360('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf360('0x1'));var jsonpatch=require(_0xf360('0x2'));var rp=require('request-promise');var moment=require(_0xf360('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf360('0x4'));var util=require(_0xf360('0x5'));var path=require('path');var sox=require(_0xf360('0x6'));var csv=require(_0xf360('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf360('0x8'));var squel=require(_0xf360('0x9'));var crypto=require(_0xf360('0xa'));var jsforce=require(_0xf360('0xb'));var deskjs=require(_0xf360('0xc'));var toCsv=require(_0xf360('0x7'));var querystring=require(_0xf360('0xd'));var Papa=require('papaparse');var Redis=require(_0xf360('0xe'));var authService=require(_0xf360('0xf'));var qs=require(_0xf360('0x10'));var as=require(_0xf360('0x11'));var hardwareService=require(_0xf360('0x12'));var logger=require(_0xf360('0x13'))(_0xf360('0x14'));var utils=require(_0xf360('0x15'));var config=require(_0xf360('0x16'));var licenseUtil=require(_0xf360('0x17'));var db=require(_0xf360('0x18'))['db'];function respondWithStatusCode(_0x21e6a9,_0x3ea84d){_0x3ea84d=_0x3ea84d||0xcc;return function(_0x9e17ea){if(_0x9e17ea){return _0x21e6a9[_0xf360('0x19')](_0x3ea84d);}return _0x21e6a9[_0xf360('0x1a')](_0x3ea84d)[_0xf360('0x1b')]();};}function respondWithResult(_0x2ee506,_0x28e9c5){_0x28e9c5=_0x28e9c5||0xc8;return function(_0x351bb4){if(_0x351bb4){return _0x2ee506[_0xf360('0x1a')](_0x28e9c5)[_0xf360('0x1c')](_0x351bb4);}};}function respondWithFilteredResult(_0xf99797,_0x4049da){return function(_0x32acec){if(_0x32acec){var _0x541c6c=typeof _0x4049da[_0xf360('0x1d')]===_0xf360('0x1e')&&typeof _0x4049da[_0xf360('0x1f')]===_0xf360('0x1e');var _0x19a53d=_0x32acec[_0xf360('0x20')];var _0x412ae9=_0x541c6c?0x0:_0x4049da['offset'];var _0x3b53e6=_0x541c6c?_0x32acec[_0xf360('0x20')]:_0x4049da[_0xf360('0x1d')]+_0x4049da[_0xf360('0x1f')];var _0x3bfecf;if(_0x3b53e6>=_0x19a53d){_0x3b53e6=_0x19a53d;_0x3bfecf=0xc8;}else{_0x3bfecf=0xce;}_0xf99797[_0xf360('0x1a')](_0x3bfecf);return _0xf99797[_0xf360('0x21')](_0xf360('0x22'),_0x412ae9+'-'+_0x3b53e6+'/'+_0x19a53d)[_0xf360('0x1c')](_0x32acec);}return null;};}function patchUpdates(_0x6c2071){return function(_0x29c253){try{jsonpatch['apply'](_0x29c253,_0x6c2071,!![]);}catch(_0x2824f7){return BPromise[_0xf360('0x23')](_0x2824f7);}return _0x29c253[_0xf360('0x24')]();};}function saveUpdates(_0x32f4ee,_0x44d17c){return function(_0x38215b){if(_0x38215b){return _0x38215b[_0xf360('0x25')](_0x32f4ee)[_0xf360('0x26')](function(_0x131bd2){return _0x131bd2;});}return null;};}function removeEntity(_0x3b298e,_0x55c97a){return function(_0x4a90c4){if(_0x4a90c4){return _0x4a90c4[_0xf360('0x27')]()[_0xf360('0x26')](function(){_0x3b298e[_0xf360('0x1a')](0xcc)[_0xf360('0x1b')]();});}};}function handleEntityNotFound(_0x14f17d,_0x434546){return function(_0x7c4173){if(!_0x7c4173){_0x14f17d[_0xf360('0x19')](0x194);}return _0x7c4173;};}function handleError(_0x2e4d19,_0x475614){_0x475614=_0x475614||0x1f4;return function(_0x18ff11){logger[_0xf360('0x28')](_0x18ff11[_0xf360('0x29')]);if(_0x18ff11['name']){delete _0x18ff11[_0xf360('0x2a')];}_0x2e4d19[_0xf360('0x1a')](_0x475614)[_0xf360('0x2b')](_0x18ff11);};}exports[_0xf360('0x2c')]=function(_0x39e944,_0x418049){var _0x558c1d={},_0x23f6eb={},_0x12c255={'count':0x0,'rows':[]};var _0x47f2e3=_[_0xf360('0x2d')](db['Dynamics365Configuration'][_0xf360('0x2e')],function(_0x2d6b8b){return{'name':_0x2d6b8b[_0xf360('0x2f')],'type':_0x2d6b8b[_0xf360('0x30')][_0xf360('0x31')]};});_0x23f6eb[_0xf360('0x32')]=_[_0xf360('0x2d')](_0x47f2e3,_0xf360('0x2a'));_0x23f6eb['query']=_[_0xf360('0x33')](_0x39e944['query']);_0x23f6eb[_0xf360('0x34')]=_['intersection'](_0x23f6eb[_0xf360('0x32')],_0x23f6eb[_0xf360('0x35')]);_0x558c1d[_0xf360('0x36')]=_[_0xf360('0x37')](_0x23f6eb[_0xf360('0x32')],qs['fields'](_0x39e944[_0xf360('0x35')][_0xf360('0x38')]));_0x558c1d[_0xf360('0x36')]=_0x558c1d['attributes'][_0xf360('0x39')]?_0x558c1d[_0xf360('0x36')]:_0x23f6eb[_0xf360('0x32')];if(!_0x39e944[_0xf360('0x35')]['hasOwnProperty'](_0xf360('0x3a'))){_0x558c1d[_0xf360('0x1f')]=qs['limit'](_0x39e944['query']['limit']);_0x558c1d[_0xf360('0x1d')]=qs['offset'](_0x39e944['query'][_0xf360('0x1d')]);}_0x558c1d[_0xf360('0x3b')]=qs['sort'](_0x39e944['query']['sort']);_0x558c1d['where']=qs[_0xf360('0x34')](_[_0xf360('0x3c')](_0x39e944['query'],_0x23f6eb[_0xf360('0x34')]),_0x47f2e3);if(_0x39e944[_0xf360('0x35')]['filter']){_0x558c1d[_0xf360('0x3d')]=_[_0xf360('0x3e')](_0x558c1d[_0xf360('0x3d')],{'$or':_[_0xf360('0x2d')](_0x47f2e3,function(_0x314d7e){if(_0x314d7e['type']!==_0xf360('0x3f')){var _0x477317={};_0x477317[_0x314d7e['name']]={'$like':'%'+_0x39e944[_0xf360('0x35')][_0xf360('0x40')]+'%'};return _0x477317;}})});}_0x558c1d=_['merge']({},_0x558c1d,_0x39e944[_0xf360('0x41')]);var _0xd72cc5={'where':_0x558c1d[_0xf360('0x3d')]};return db[_0xf360('0x42')]['count'](_0xd72cc5)['then'](function(_0x543d95){_0x12c255[_0xf360('0x20')]=_0x543d95;if(_0x39e944['query'][_0xf360('0x43')]){_0x558c1d[_0xf360('0x44')]=[{'all':!![]}];}return db[_0xf360('0x42')][_0xf360('0x45')](_0x558c1d);})[_0xf360('0x26')](function(_0x263e58){_0x12c255[_0xf360('0x46')]=_0x263e58;return _0x12c255;})[_0xf360('0x26')](respondWithFilteredResult(_0x418049,_0x558c1d))['catch'](handleError(_0x418049,null));};exports[_0xf360('0x47')]=function(_0x19616c,_0x581d4a){var _0x494eb2={'raw':![],'where':{'id':_0x19616c[_0xf360('0x48')]['id']}},_0x16ea5e={};_0x16ea5e[_0xf360('0x32')]=_['keys'](db[_0xf360('0x42')][_0xf360('0x2e')]);_0x16ea5e['query']=_[_0xf360('0x33')](_0x19616c[_0xf360('0x35')]);_0x16ea5e[_0xf360('0x34')]=_[_0xf360('0x37')](_0x16ea5e[_0xf360('0x32')],_0x16ea5e['query']);_0x494eb2[_0xf360('0x36')]=_[_0xf360('0x37')](_0x16ea5e[_0xf360('0x32')],qs[_0xf360('0x38')](_0x19616c[_0xf360('0x35')][_0xf360('0x38')]));_0x494eb2[_0xf360('0x36')]=_0x494eb2['attributes']['length']?_0x494eb2[_0xf360('0x36')]:_0x16ea5e[_0xf360('0x32')];if(_0x19616c[_0xf360('0x35')][_0xf360('0x43')]){_0x494eb2[_0xf360('0x44')]=[{'all':!![]}];}_0x494eb2=_[_0xf360('0x3e')]({},_0x494eb2,_0x19616c[_0xf360('0x41')]);return db[_0xf360('0x42')][_0xf360('0x49')](_0x494eb2)[_0xf360('0x26')](handleEntityNotFound(_0x581d4a,null))['then'](respondWithResult(_0x581d4a,null))[_0xf360('0x4a')](handleError(_0x581d4a,null));};exports[_0xf360('0x4b')]=function(_0x109886,_0x3c777d){return db[_0xf360('0x42')]['create'](_0x109886['body'],{})[_0xf360('0x26')](respondWithResult(_0x3c777d,0xc9))[_0xf360('0x4a')](handleError(_0x3c777d,null));};exports[_0xf360('0x25')]=function(_0x485dd2,_0x3439f6){if(_0x485dd2[_0xf360('0x4c')]['id']){delete _0x485dd2[_0xf360('0x4c')]['id'];}return db[_0xf360('0x42')][_0xf360('0x49')]({'where':{'id':_0x485dd2['params']['id']}})[_0xf360('0x26')](handleEntityNotFound(_0x3439f6,null))[_0xf360('0x26')](saveUpdates(_0x485dd2[_0xf360('0x4c')],null))[_0xf360('0x26')](respondWithResult(_0x3439f6,null))[_0xf360('0x4a')](handleError(_0x3439f6,null));};exports[_0xf360('0x27')]=function(_0x21b367,_0x422474){return db[_0xf360('0x42')][_0xf360('0x49')]({'where':{'id':_0x21b367[_0xf360('0x48')]['id']}})[_0xf360('0x26')](handleEntityNotFound(_0x422474,null))[_0xf360('0x26')](removeEntity(_0x422474,null))[_0xf360('0x4a')](handleError(_0x422474,null));};exports[_0xf360('0x4d')]=function(_0x17d8c1,_0x14fa1d,_0x56e615){var _0x2abd23={};var _0x529cb8={};var _0xb53b68;var _0x1c42d3;return db[_0xf360('0x42')][_0xf360('0x4e')]({'where':{'id':_0x17d8c1['params']['id']}})[_0xf360('0x26')](handleEntityNotFound(_0x14fa1d,null))['then'](function(_0x52a0c0){if(_0x52a0c0){_0xb53b68=_0x52a0c0;_0x529cb8[_0xf360('0x32')]=_[_0xf360('0x33')](db[_0xf360('0x4f')][_0xf360('0x2e')]);_0x529cb8[_0xf360('0x35')]=_[_0xf360('0x33')](_0x17d8c1[_0xf360('0x35')]);_0x529cb8[_0xf360('0x34')]=_[_0xf360('0x37')](_0x529cb8[_0xf360('0x32')],_0x529cb8[_0xf360('0x35')]);_0x2abd23[_0xf360('0x36')]=_[_0xf360('0x37')](_0x529cb8['model'],qs[_0xf360('0x38')](_0x17d8c1[_0xf360('0x35')][_0xf360('0x38')]));_0x2abd23[_0xf360('0x36')]=_0x2abd23[_0xf360('0x36')][_0xf360('0x39')]?_0x2abd23['attributes']:_0x529cb8[_0xf360('0x32')];_0x2abd23[_0xf360('0x3b')]=qs[_0xf360('0x50')](_0x17d8c1['query']['sort']);_0x2abd23['where']=qs[_0xf360('0x34')](_[_0xf360('0x3c')](_0x17d8c1[_0xf360('0x35')],_0x529cb8[_0xf360('0x34')]));if(_0x17d8c1[_0xf360('0x35')][_0xf360('0x40')]){_0x2abd23[_0xf360('0x3d')]=_[_0xf360('0x3e')](_0x2abd23[_0xf360('0x3d')],{'$or':_['map'](_0x2abd23[_0xf360('0x36')],function(_0x55d740){var _0x1b9229={};_0x1b9229[_0x55d740]={'$like':'%'+_0x17d8c1[_0xf360('0x35')][_0xf360('0x40')]+'%'};return _0x1b9229;})});}_0x2abd23=_['merge']({},_0x2abd23,_0x17d8c1[_0xf360('0x41')]);return _0xb53b68[_0xf360('0x4d')](_0x2abd23);}})['then'](function(_0x598c38){if(_0x598c38){_0x1c42d3=_0x598c38[_0xf360('0x39')];if(!_0x17d8c1[_0xf360('0x35')][_0xf360('0x51')](_0xf360('0x3a'))){_0x2abd23[_0xf360('0x1f')]=qs[_0xf360('0x1f')](_0x17d8c1[_0xf360('0x35')][_0xf360('0x1f')]);_0x2abd23[_0xf360('0x1d')]=qs[_0xf360('0x1d')](_0x17d8c1[_0xf360('0x35')][_0xf360('0x1d')]);}return _0xb53b68[_0xf360('0x4d')](_0x2abd23);}})['then'](function(_0x56caed){if(_0x56caed){return _0x56caed?{'count':_0x1c42d3,'rows':_0x56caed}:null;}})[_0xf360('0x26')](respondWithResult(_0x14fa1d,null))[_0xf360('0x4a')](handleError(_0x14fa1d,null));};exports['getSubjects']=function(_0x5bf633,_0x1ef3b7,_0x48d6dd){var _0x54d75d={};var _0x13994d={};var _0x362d99;var _0x359d4f;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x5bf633[_0xf360('0x48')]['id']}})[_0xf360('0x26')](handleEntityNotFound(_0x1ef3b7,null))['then'](function(_0x54c090){if(_0x54c090){_0x362d99=_0x54c090;_0x13994d[_0xf360('0x32')]=_[_0xf360('0x33')](db[_0xf360('0x4f')][_0xf360('0x2e')]);_0x13994d['query']=_['keys'](_0x5bf633[_0xf360('0x35')]);_0x13994d[_0xf360('0x34')]=_['intersection'](_0x13994d[_0xf360('0x32')],_0x13994d[_0xf360('0x35')]);_0x54d75d[_0xf360('0x36')]=_[_0xf360('0x37')](_0x13994d[_0xf360('0x32')],qs['fields'](_0x5bf633[_0xf360('0x35')][_0xf360('0x38')]));_0x54d75d[_0xf360('0x36')]=_0x54d75d['attributes'][_0xf360('0x39')]?_0x54d75d[_0xf360('0x36')]:_0x13994d['model'];_0x54d75d[_0xf360('0x3b')]=qs[_0xf360('0x50')](_0x5bf633[_0xf360('0x35')][_0xf360('0x50')]);_0x54d75d[_0xf360('0x3d')]=qs['filters'](_[_0xf360('0x3c')](_0x5bf633['query'],_0x13994d[_0xf360('0x34')]));if(_0x5bf633[_0xf360('0x35')][_0xf360('0x40')]){_0x54d75d[_0xf360('0x3d')]=_[_0xf360('0x3e')](_0x54d75d[_0xf360('0x3d')],{'$or':_['map'](_0x54d75d[_0xf360('0x36')],function(_0x3a1c6a){var _0x2c8d37={};_0x2c8d37[_0x3a1c6a]={'$like':'%'+_0x5bf633[_0xf360('0x35')]['filter']+'%'};return _0x2c8d37;})});}_0x54d75d=_[_0xf360('0x3e')]({},_0x54d75d,_0x5bf633['options']);return _0x362d99[_0xf360('0x52')](_0x54d75d);}})[_0xf360('0x26')](function(_0x3fdfa0){if(_0x3fdfa0){_0x359d4f=_0x3fdfa0[_0xf360('0x39')];if(!_0x5bf633[_0xf360('0x35')][_0xf360('0x51')](_0xf360('0x3a'))){_0x54d75d[_0xf360('0x1f')]=qs[_0xf360('0x1f')](_0x5bf633[_0xf360('0x35')][_0xf360('0x1f')]);_0x54d75d[_0xf360('0x1d')]=qs[_0xf360('0x1d')](_0x5bf633[_0xf360('0x35')][_0xf360('0x1d')]);}return _0x362d99['getSubjects'](_0x54d75d);}})['then'](function(_0x37131e){if(_0x37131e){return _0x37131e?{'count':_0x359d4f,'rows':_0x37131e}:null;}})[_0xf360('0x26')](respondWithResult(_0x1ef3b7,null))[_0xf360('0x4a')](handleError(_0x1ef3b7,null));};exports[_0xf360('0x53')]=function(_0x57c5e1,_0x33d23c,_0x30454c){var _0x22b8b7={};var _0x1ca804={};var _0x41e7a9;var _0x3fbeb2;return db[_0xf360('0x42')][_0xf360('0x4e')]({'where':{'id':_0x57c5e1[_0xf360('0x48')]['id']}})[_0xf360('0x26')](handleEntityNotFound(_0x33d23c,null))['then'](function(_0x350feb){if(_0x350feb){_0x41e7a9=_0x350feb;_0x1ca804[_0xf360('0x32')]=_[_0xf360('0x33')](db[_0xf360('0x4f')]['rawAttributes']);_0x1ca804[_0xf360('0x35')]=_[_0xf360('0x33')](_0x57c5e1[_0xf360('0x35')]);_0x1ca804['filters']=_['intersection'](_0x1ca804[_0xf360('0x32')],_0x1ca804['query']);_0x22b8b7[_0xf360('0x36')]=_['intersection'](_0x1ca804['model'],qs[_0xf360('0x38')](_0x57c5e1['query'][_0xf360('0x38')]));_0x22b8b7[_0xf360('0x36')]=_0x22b8b7[_0xf360('0x36')][_0xf360('0x39')]?_0x22b8b7['attributes']:_0x1ca804[_0xf360('0x32')];_0x22b8b7['order']=qs[_0xf360('0x50')](_0x57c5e1[_0xf360('0x35')][_0xf360('0x50')]);_0x22b8b7[_0xf360('0x3d')]=qs[_0xf360('0x34')](_[_0xf360('0x3c')](_0x57c5e1[_0xf360('0x35')],_0x1ca804['filters']));if(_0x57c5e1[_0xf360('0x35')]['filter']){_0x22b8b7[_0xf360('0x3d')]=_[_0xf360('0x3e')](_0x22b8b7[_0xf360('0x3d')],{'$or':_[_0xf360('0x2d')](_0x22b8b7[_0xf360('0x36')],function(_0x192605){var _0x21360a={};_0x21360a[_0x192605]={'$like':'%'+_0x57c5e1[_0xf360('0x35')][_0xf360('0x40')]+'%'};return _0x21360a;})});}_0x22b8b7=_[_0xf360('0x3e')]({},_0x22b8b7,_0x57c5e1['options']);return _0x41e7a9[_0xf360('0x53')](_0x22b8b7);}})[_0xf360('0x26')](function(_0x19e5fe){if(_0x19e5fe){_0x3fbeb2=_0x19e5fe[_0xf360('0x39')];if(!_0x57c5e1[_0xf360('0x35')][_0xf360('0x51')](_0xf360('0x3a'))){_0x22b8b7[_0xf360('0x1f')]=qs['limit'](_0x57c5e1['query']['limit']);_0x22b8b7[_0xf360('0x1d')]=qs['offset'](_0x57c5e1[_0xf360('0x35')][_0xf360('0x1d')]);}return _0x41e7a9[_0xf360('0x53')](_0x22b8b7);}})[_0xf360('0x26')](function(_0x4a02a4){if(_0x4a02a4){return _0x4a02a4?{'count':_0x3fbeb2,'rows':_0x4a02a4}:null;}})['then'](respondWithResult(_0x33d23c,null))[_0xf360('0x4a')](handleError(_0x33d23c,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 041d422..d4f56c4 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 _0xaa88=['util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','Dynamics365Configuration','int_dynamics365_configurations','lodash'];(function(_0x3336aa,_0x1d61a6){var _0x71dd96=function(_0x38f561){while(--_0x38f561){_0x3336aa['push'](_0x3336aa['shift']());}};_0x71dd96(++_0x1d61a6);}(_0xaa88,0x137));var _0x8aa8=function(_0x27bd2c,_0x24bd98){_0x27bd2c=_0x27bd2c-0x0;var _0x3784ea=_0xaa88[_0x27bd2c];return _0x3784ea;};'use strict';var _=require(_0x8aa8('0x0'));var util=require(_0x8aa8('0x1'));var logger=require(_0x8aa8('0x2'))(_0x8aa8('0x3'));var moment=require('moment');var BPromise=require(_0x8aa8('0x4'));var rp=require(_0x8aa8('0x5'));var fs=require('fs');var path=require(_0x8aa8('0x6'));var rimraf=require(_0x8aa8('0x7'));var config=require(_0x8aa8('0x8'));var attributes=require(_0x8aa8('0x9'));module['exports']=function(_0x5bda0d,_0x460042){return _0x5bda0d['define'](_0x8aa8('0xa'),attributes,{'tableName':_0x8aa8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14d=['util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','int_dynamics365_configurations','lodash'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0xe14d,0x1ee));var _0xde14=function(_0x2fc012,_0x503e5b){_0x2fc012=_0x2fc012-0x0;var _0x2891f9=_0xe14d[_0x2fc012];return _0x2891f9;};'use strict';var _=require(_0xde14('0x0'));var util=require(_0xde14('0x1'));var logger=require(_0xde14('0x2'))(_0xde14('0x3'));var moment=require('moment');var BPromise=require(_0xde14('0x4'));var rp=require(_0xde14('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde14('0x6'));var config=require(_0xde14('0x7'));var attributes=require(_0xde14('0x8'));module[_0xde14('0x9')]=function(_0x461af3,_0xba1514){return _0x461af3['define']('Dynamics365Configuration',attributes,{'tableName':_0xde14('0xa'),'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 8fc26cb..30c5d9f 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 _0x57bb=['request\x20sent','debug','stringify','code','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Configuration,\x20%s,\x20%s'];(function(_0x12d033,_0x25fa2f){var _0x3b4e80=function(_0x46c1f4){while(--_0x46c1f4){_0x12d033['push'](_0x12d033['shift']());}};_0x3b4e80(++_0x25fa2f);}(_0x57bb,0x8b));var _0xb57b=function(_0x56f92a,_0x1db612){_0x56f92a=_0x56f92a-0x0;var _0x36c063=_0x57bb[_0x56f92a];return _0x36c063;};'use strict';var _=require('lodash');var util=require(_0xb57b('0x0'));var moment=require(_0xb57b('0x1'));var BPromise=require(_0xb57b('0x2'));var rs=require(_0xb57b('0x3'));var fs=require('fs');var Redis=require(_0xb57b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb57b('0x5'));var logger=require(_0xb57b('0x6'))(_0xb57b('0x7'));var config=require(_0xb57b('0x8'));var jayson=require(_0xb57b('0x9'));var client=jayson[_0xb57b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x350293,_0x3a067c,_0x354bc6){return new BPromise(function(_0x390e6f,_0xfcd8b2){return client[_0xb57b('0xb')](_0x350293,_0x354bc6)[_0xb57b('0xc')](function(_0x316877){logger[_0xb57b('0xd')](_0xb57b('0xe'),_0x3a067c,_0xb57b('0xf'));logger[_0xb57b('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x3a067c,_0xb57b('0xf'),JSON[_0xb57b('0x11')](_0x316877));if(_0x316877['error']){if(_0x316877['error'][_0xb57b('0x12')]===0x1f4){logger['error'](_0xb57b('0xe'),_0x3a067c,_0x316877[_0xb57b('0x13')][_0xb57b('0x14')]);return _0xfcd8b2(_0x316877[_0xb57b('0x13')][_0xb57b('0x14')]);}logger[_0xb57b('0x13')](_0xb57b('0xe'),_0x3a067c,_0x316877[_0xb57b('0x13')]['message']);return _0x390e6f(_0x316877[_0xb57b('0x13')][_0xb57b('0x14')]);}else{logger[_0xb57b('0xd')](_0xb57b('0xe'),_0x3a067c,'request\x20sent');_0x390e6f(_0x316877['result']['message']);}})[_0xb57b('0x15')](function(_0x25501b){logger['error'](_0xb57b('0xe'),_0x3a067c,_0x25501b);_0xfcd8b2(_0x25501b);});});} \ No newline at end of file +var _0x09ba=['http','request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Configuration,\x20%s,\x20%s','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x28e74e,_0x53ed3b){var _0x3e1d22=function(_0x3783b8){while(--_0x3783b8){_0x28e74e['push'](_0x28e74e['shift']());}};_0x3e1d22(++_0x53ed3b);}(_0x09ba,0x140));var _0xa09b=function(_0x3f7830,_0x2ef515){_0x3f7830=_0x3f7830-0x0;var _0x392bcf=_0x09ba[_0x3f7830];return _0x392bcf;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xa09b('0x0'));var rs=require(_0xa09b('0x1'));var fs=require('fs');var Redis=require(_0xa09b('0x2'));var db=require(_0xa09b('0x3'))['db'];var utils=require(_0xa09b('0x4'));var logger=require(_0xa09b('0x5'))(_0xa09b('0x6'));var config=require(_0xa09b('0x7'));var jayson=require(_0xa09b('0x8'));var client=jayson[_0xa09b('0x9')][_0xa09b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41b29c,_0x3ca80e,_0x2df368){return new BPromise(function(_0x3bf305,_0x112a04){return client[_0xa09b('0xb')](_0x41b29c,_0x2df368)[_0xa09b('0xc')](function(_0x4c0793){logger[_0xa09b('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3ca80e,_0xa09b('0xe'));logger[_0xa09b('0xf')](_0xa09b('0x10'),_0x3ca80e,'request\x20sent',JSON[_0xa09b('0x11')](_0x4c0793));if(_0x4c0793[_0xa09b('0x12')]){if(_0x4c0793[_0xa09b('0x12')]['code']===0x1f4){logger[_0xa09b('0x12')](_0xa09b('0x13'),_0x3ca80e,_0x4c0793[_0xa09b('0x12')][_0xa09b('0x14')]);return _0x112a04(_0x4c0793[_0xa09b('0x12')][_0xa09b('0x14')]);}logger[_0xa09b('0x12')](_0xa09b('0x13'),_0x3ca80e,_0x4c0793[_0xa09b('0x12')][_0xa09b('0x14')]);return _0x3bf305(_0x4c0793[_0xa09b('0x12')][_0xa09b('0x14')]);}else{logger[_0xa09b('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x3ca80e,_0xa09b('0xe'));_0x3bf305(_0x4c0793['result'][_0xa09b('0x14')]);}})[_0xa09b('0x15')](function(_0x25ff56){logger[_0xa09b('0x12')](_0xa09b('0x13'),_0x3ca80e,_0x25ff56);_0x112a04(_0x25ff56);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index b35e400..1441ca0 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 _0xee86=['exports','multer','util','connect-timeout','fs-extra','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','put','delete'];(function(_0x23521f,_0x661e98){var _0x3db7ff=function(_0x1aeb70){while(--_0x1aeb70){_0x23521f['push'](_0x23521f['shift']());}};_0x3db7ff(++_0x661e98);}(_0xee86,0x151));var _0x6ee8=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xee86[_0x341e0f];return _0x59555a;};'use strict';var multer=require(_0x6ee8('0x0'));var util=require(_0x6ee8('0x1'));var path=require('path');var timeout=require(_0x6ee8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6ee8('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6ee8('0x4'));var controller=require(_0x6ee8('0x5'));router[_0x6ee8('0x6')]('/',auth[_0x6ee8('0x7')](),controller[_0x6ee8('0x8')]);router['get'](_0x6ee8('0x9'),auth[_0x6ee8('0x7')](),controller['show']);router[_0x6ee8('0xa')]('/',auth[_0x6ee8('0x7')](),controller['create']);router[_0x6ee8('0xb')](_0x6ee8('0x9'),auth[_0x6ee8('0x7')](),controller['update']);router[_0x6ee8('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6ee8('0xd')]=router; \ No newline at end of file +var _0x39af=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x39af,0x69));var _0xf39a=function(_0x3899a4,_0x3d6515){_0x3899a4=_0x3899a4-0x0;var _0x31f606=_0x39af[_0x3899a4];return _0x31f606;};'use strict';var multer=require(_0xf39a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf39a('0x1'));var express=require(_0xf39a('0x2'));var router=express[_0xf39a('0x3')]();var fs_extra=require(_0xf39a('0x4'));var auth=require(_0xf39a('0x5'));var interaction=require(_0xf39a('0x6'));var config=require(_0xf39a('0x7'));var controller=require('./intDynamics365Field.controller');router[_0xf39a('0x8')]('/',auth[_0xf39a('0x9')](),controller['index']);router['get'](_0xf39a('0xa'),auth[_0xf39a('0x9')](),controller[_0xf39a('0xb')]);router[_0xf39a('0xc')]('/',auth[_0xf39a('0x9')](),controller[_0xf39a('0xd')]);router[_0xf39a('0xe')](_0xf39a('0xa'),auth[_0xf39a('0x9')](),controller[_0xf39a('0xf')]);router[_0xf39a('0x10')](_0xf39a('0xa'),auth['isAuthenticated'](),controller[_0xf39a('0x11')]);module[_0xf39a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 5230b11..f0072db 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 _0xe14f=['string','variable','keyValue','STRING','BOOLEAN','ENUM'];(function(_0x559953,_0x356e8c){var _0x5b821b=function(_0x44b78c){while(--_0x44b78c){_0x559953['push'](_0x559953['shift']());}};_0x5b821b(++_0x356e8c);}(_0xe14f,0x101));var _0xfe14=function(_0x5583f5,_0x2c648e){_0x5583f5=_0x5583f5-0x0;var _0x19c333=_0xe14f[_0x5583f5];return _0x19c333;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xfe14('0x0')](_0xfe14('0x1'),_0xfe14('0x2'),'customVariable',_0xfe14('0x3'),'picklist'),'defaultValue':_0xfe14('0x1')},'content':{'type':Sequelize[_0xfe14('0x4')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xfe14('0x0')](_0xfe14('0x1'),_0xfe14('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xfe14('0x4')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfe14('0x4')]},'customField':{'type':Sequelize[_0xfe14('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xa95a=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0xa95a,0xe6));var _0xaa95=function(_0x4ca53a,_0x48ba3d){_0x4ca53a=_0x4ca53a-0x0;var _0x47b0d8=_0xa95a[_0x4ca53a];return _0x47b0d8;};'use strict';var Sequelize=require(_0xaa95('0x0'));module[_0xaa95('0x1')]={'type':{'type':Sequelize[_0xaa95('0x2')](_0xaa95('0x3'),_0xaa95('0x4'),_0xaa95('0x5'),_0xaa95('0x6'),_0xaa95('0x7')),'defaultValue':_0xaa95('0x3')},'content':{'type':Sequelize[_0xaa95('0x8')]},'key':{'type':Sequelize[_0xaa95('0x8')]},'keyType':{'type':Sequelize[_0xaa95('0x2')](_0xaa95('0x3'),_0xaa95('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xaa95('0x8')]},'idField':{'type':Sequelize[_0xaa95('0x8')]},'nameField':{'type':Sequelize[_0xaa95('0x8')]},'customField':{'type':Sequelize[_0xaa95('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 1a05751..9284232 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 _0x2b7c=['fields','length','hasOwnProperty','order','sort','pick','filter','where','merge','options','include','rows','show','params','keys','rawAttributes','includeAll','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','index','Dynamics365Field','fieldName','type','model','map','query','filters','intersection','attributes'];(function(_0x304e27,_0x475f41){var _0x5f1953=function(_0x4511d7){while(--_0x4511d7){_0x304e27['push'](_0x304e27['shift']());}};_0x5f1953(++_0x475f41);}(_0x2b7c,0x146));var _0xc2b7=function(_0x18c9a6,_0xafde82){_0x18c9a6=_0x18c9a6-0x0;var _0x1f2b1e=_0x2b7c[_0x18c9a6];return _0x1f2b1e;};'use strict';var emlformat=require(_0xc2b7('0x0'));var rimraf=require(_0xc2b7('0x1'));var zipdir=require(_0xc2b7('0x2'));var jsonpatch=require(_0xc2b7('0x3'));var rp=require(_0xc2b7('0x4'));var moment=require('moment');var BPromise=require(_0xc2b7('0x5'));var Mustache=require(_0xc2b7('0x6'));var util=require(_0xc2b7('0x7'));var path=require(_0xc2b7('0x8'));var sox=require(_0xc2b7('0x9'));var csv=require(_0xc2b7('0xa'));var ejs=require(_0xc2b7('0xb'));var fs=require('fs');var fs_extra=require(_0xc2b7('0xc'));var _=require(_0xc2b7('0xd'));var squel=require(_0xc2b7('0xe'));var crypto=require(_0xc2b7('0xf'));var jsforce=require(_0xc2b7('0x10'));var deskjs=require(_0xc2b7('0x11'));var toCsv=require(_0xc2b7('0xa'));var querystring=require(_0xc2b7('0x12'));var Papa=require(_0xc2b7('0x13'));var Redis=require(_0xc2b7('0x14'));var authService=require(_0xc2b7('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0xc2b7('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc2b7('0x17'))(_0xc2b7('0x18'));var utils=require('../../config/utils');var config=require(_0xc2b7('0x19'));var licenseUtil=require(_0xc2b7('0x1a'));var db=require(_0xc2b7('0x1b'))['db'];function respondWithStatusCode(_0x2380c9,_0x2e2999){_0x2e2999=_0x2e2999||0xcc;return function(_0x4097cc){if(_0x4097cc){return _0x2380c9['sendStatus'](_0x2e2999);}return _0x2380c9[_0xc2b7('0x1c')](_0x2e2999)[_0xc2b7('0x1d')]();};}function respondWithResult(_0x491d67,_0x42f82a){_0x42f82a=_0x42f82a||0xc8;return function(_0x4a68f5){if(_0x4a68f5){return _0x491d67[_0xc2b7('0x1c')](_0x42f82a)[_0xc2b7('0x1e')](_0x4a68f5);}};}function respondWithFilteredResult(_0x1c5e31,_0x1246f9){return function(_0x5716a2){if(_0x5716a2){var _0x53fef0=typeof _0x1246f9[_0xc2b7('0x1f')]===_0xc2b7('0x20')&&typeof _0x1246f9['limit']===_0xc2b7('0x20');var _0x52d307=_0x5716a2[_0xc2b7('0x21')];var _0x43fb0c=_0x53fef0?0x0:_0x1246f9['offset'];var _0x4291cf=_0x53fef0?_0x5716a2['count']:_0x1246f9['offset']+_0x1246f9[_0xc2b7('0x22')];var _0x1a62b2;if(_0x4291cf>=_0x52d307){_0x4291cf=_0x52d307;_0x1a62b2=0xc8;}else{_0x1a62b2=0xce;}_0x1c5e31['status'](_0x1a62b2);return _0x1c5e31[_0xc2b7('0x23')](_0xc2b7('0x24'),_0x43fb0c+'-'+_0x4291cf+'/'+_0x52d307)[_0xc2b7('0x1e')](_0x5716a2);}return null;};}function patchUpdates(_0x5a8c2d){return function(_0x5dcab){try{jsonpatch[_0xc2b7('0x25')](_0x5dcab,_0x5a8c2d,!![]);}catch(_0x487ca0){return BPromise['reject'](_0x487ca0);}return _0x5dcab[_0xc2b7('0x26')]();};}function saveUpdates(_0x58f715,_0x541e74){return function(_0x4158ed){if(_0x4158ed){return _0x4158ed['update'](_0x58f715)[_0xc2b7('0x27')](function(_0x58bdb2){return _0x58bdb2;});}return null;};}function removeEntity(_0x1ef49d,_0x95d417){return function(_0xb5fdb2){if(_0xb5fdb2){return _0xb5fdb2[_0xc2b7('0x28')]()[_0xc2b7('0x27')](function(){_0x1ef49d['status'](0xcc)[_0xc2b7('0x1d')]();});}};}function handleEntityNotFound(_0x33d885,_0x11db6f){return function(_0x4247b6){if(!_0x4247b6){_0x33d885['sendStatus'](0x194);}return _0x4247b6;};}function handleError(_0xd19614,_0x1cf410){_0x1cf410=_0x1cf410||0x1f4;return function(_0x47e774){logger[_0xc2b7('0x29')](_0x47e774[_0xc2b7('0x2a')]);if(_0x47e774[_0xc2b7('0x2b')]){delete _0x47e774['name'];}_0xd19614[_0xc2b7('0x1c')](_0x1cf410)['send'](_0x47e774);};}exports[_0xc2b7('0x2c')]=function(_0x47bb08,_0x5cb8f1){var _0x4f920b={},_0x47f942={},_0x20d4d0={'count':0x0,'rows':[]};var _0x2d86da=_['map'](db[_0xc2b7('0x2d')]['rawAttributes'],function(_0x338829){return{'name':_0x338829[_0xc2b7('0x2e')],'type':_0x338829[_0xc2b7('0x2f')]['key']};});_0x47f942[_0xc2b7('0x30')]=_[_0xc2b7('0x31')](_0x2d86da,_0xc2b7('0x2b'));_0x47f942['query']=_['keys'](_0x47bb08[_0xc2b7('0x32')]);_0x47f942[_0xc2b7('0x33')]=_[_0xc2b7('0x34')](_0x47f942[_0xc2b7('0x30')],_0x47f942[_0xc2b7('0x32')]);_0x4f920b[_0xc2b7('0x35')]=_[_0xc2b7('0x34')](_0x47f942['model'],qs[_0xc2b7('0x36')](_0x47bb08[_0xc2b7('0x32')]['fields']));_0x4f920b[_0xc2b7('0x35')]=_0x4f920b[_0xc2b7('0x35')][_0xc2b7('0x37')]?_0x4f920b['attributes']:_0x47f942[_0xc2b7('0x30')];if(!_0x47bb08[_0xc2b7('0x32')][_0xc2b7('0x38')]('nolimit')){_0x4f920b[_0xc2b7('0x22')]=qs[_0xc2b7('0x22')](_0x47bb08[_0xc2b7('0x32')][_0xc2b7('0x22')]);_0x4f920b[_0xc2b7('0x1f')]=qs[_0xc2b7('0x1f')](_0x47bb08[_0xc2b7('0x32')][_0xc2b7('0x1f')]);}_0x4f920b[_0xc2b7('0x39')]=qs[_0xc2b7('0x3a')](_0x47bb08['query'][_0xc2b7('0x3a')]);_0x4f920b['where']=qs[_0xc2b7('0x33')](_[_0xc2b7('0x3b')](_0x47bb08[_0xc2b7('0x32')],_0x47f942['filters']),_0x2d86da);if(_0x47bb08[_0xc2b7('0x32')][_0xc2b7('0x3c')]){_0x4f920b[_0xc2b7('0x3d')]=_[_0xc2b7('0x3e')](_0x4f920b[_0xc2b7('0x3d')],{'$or':_[_0xc2b7('0x31')](_0x2d86da,function(_0x584420){if(_0x584420['type']!=='VIRTUAL'){var _0x5a6ec4={};_0x5a6ec4[_0x584420['name']]={'$like':'%'+_0x47bb08['query'][_0xc2b7('0x3c')]+'%'};return _0x5a6ec4;}})});}_0x4f920b=_[_0xc2b7('0x3e')]({},_0x4f920b,_0x47bb08[_0xc2b7('0x3f')]);var _0x38e4d9={'where':_0x4f920b[_0xc2b7('0x3d')]};return db[_0xc2b7('0x2d')][_0xc2b7('0x21')](_0x38e4d9)[_0xc2b7('0x27')](function(_0x423ed0){_0x20d4d0[_0xc2b7('0x21')]=_0x423ed0;if(_0x47bb08[_0xc2b7('0x32')]['includeAll']){_0x4f920b[_0xc2b7('0x40')]=[{'all':!![]}];}return db['Dynamics365Field']['findAll'](_0x4f920b);})['then'](function(_0x4e3b7c){_0x20d4d0[_0xc2b7('0x41')]=_0x4e3b7c;return _0x20d4d0;})[_0xc2b7('0x27')](respondWithFilteredResult(_0x5cb8f1,_0x4f920b))['catch'](handleError(_0x5cb8f1,null));};exports[_0xc2b7('0x42')]=function(_0x3a0298,_0x172230){var _0x4faba7={'raw':!![],'where':{'id':_0x3a0298[_0xc2b7('0x43')]['id']}},_0x48e93d={};_0x48e93d[_0xc2b7('0x30')]=_[_0xc2b7('0x44')](db[_0xc2b7('0x2d')][_0xc2b7('0x45')]);_0x48e93d[_0xc2b7('0x32')]=_[_0xc2b7('0x44')](_0x3a0298[_0xc2b7('0x32')]);_0x48e93d[_0xc2b7('0x33')]=_[_0xc2b7('0x34')](_0x48e93d['model'],_0x48e93d[_0xc2b7('0x32')]);_0x4faba7[_0xc2b7('0x35')]=_[_0xc2b7('0x34')](_0x48e93d[_0xc2b7('0x30')],qs['fields'](_0x3a0298[_0xc2b7('0x32')]['fields']));_0x4faba7[_0xc2b7('0x35')]=_0x4faba7[_0xc2b7('0x35')]['length']?_0x4faba7[_0xc2b7('0x35')]:_0x48e93d[_0xc2b7('0x30')];if(_0x3a0298[_0xc2b7('0x32')][_0xc2b7('0x46')]){_0x4faba7[_0xc2b7('0x40')]=[{'all':!![]}];}_0x4faba7=_[_0xc2b7('0x3e')]({},_0x4faba7,_0x3a0298[_0xc2b7('0x3f')]);return db[_0xc2b7('0x2d')][_0xc2b7('0x47')](_0x4faba7)[_0xc2b7('0x27')](handleEntityNotFound(_0x172230,null))[_0xc2b7('0x27')](respondWithResult(_0x172230,null))[_0xc2b7('0x48')](handleError(_0x172230,null));};exports[_0xc2b7('0x49')]=function(_0x265bde,_0xe0b540){return db[_0xc2b7('0x2d')][_0xc2b7('0x49')](_0x265bde[_0xc2b7('0x4a')],{})[_0xc2b7('0x27')](respondWithResult(_0xe0b540,0xc9))[_0xc2b7('0x48')](handleError(_0xe0b540,null));};exports[_0xc2b7('0x4b')]=function(_0x1263f1,_0x321893){if(_0x1263f1[_0xc2b7('0x4a')]['id']){delete _0x1263f1[_0xc2b7('0x4a')]['id'];}return db[_0xc2b7('0x2d')][_0xc2b7('0x47')]({'where':{'id':_0x1263f1['params']['id']}})[_0xc2b7('0x27')](handleEntityNotFound(_0x321893,null))[_0xc2b7('0x27')](saveUpdates(_0x1263f1[_0xc2b7('0x4a')],null))['then'](respondWithResult(_0x321893,null))[_0xc2b7('0x48')](handleError(_0x321893,null));};exports[_0xc2b7('0x28')]=function(_0x19ffc0,_0x4ac1c2){return db[_0xc2b7('0x2d')]['find']({'where':{'id':_0x19ffc0[_0xc2b7('0x43')]['id']}})[_0xc2b7('0x27')](handleEntityNotFound(_0x4ac1c2,null))[_0xc2b7('0x27')](removeEntity(_0x4ac1c2,null))[_0xc2b7('0x48')](handleError(_0x4ac1c2,null));}; \ No newline at end of file +var _0x4bd0=['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','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','Dynamics365Field','rawAttributes','fieldName','key','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','keys','find','create','catch','body','params','eml-format','zip-dir','request-promise','moment','bluebird','util','path','to-csv','ejs'];(function(_0xc069,_0x3005d6){var _0x3f143c=function(_0x2de702){while(--_0x2de702){_0xc069['push'](_0xc069['shift']());}};_0x3f143c(++_0x3005d6);}(_0x4bd0,0x93));var _0x04bd=function(_0x50811d,_0x17d91c){_0x50811d=_0x50811d-0x0;var _0x4f1582=_0x4bd0[_0x50811d];return _0x4f1582;};'use strict';var emlformat=require(_0x04bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x04bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x04bd('0x2'));var moment=require(_0x04bd('0x3'));var BPromise=require(_0x04bd('0x4'));var Mustache=require('mustache');var util=require(_0x04bd('0x5'));var path=require(_0x04bd('0x6'));var sox=require('sox');var csv=require(_0x04bd('0x7'));var ejs=require(_0x04bd('0x8'));var fs=require('fs');var fs_extra=require(_0x04bd('0x9'));var _=require(_0x04bd('0xa'));var squel=require(_0x04bd('0xb'));var crypto=require(_0x04bd('0xc'));var jsforce=require(_0x04bd('0xd'));var deskjs=require(_0x04bd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x04bd('0xf'));var Papa=require(_0x04bd('0x10'));var Redis=require(_0x04bd('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x04bd('0x12'));var as=require(_0x04bd('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x04bd('0x14'))(_0x04bd('0x15'));var utils=require(_0x04bd('0x16'));var config=require(_0x04bd('0x17'));var licenseUtil=require(_0x04bd('0x18'));var db=require(_0x04bd('0x19'))['db'];function respondWithStatusCode(_0x3e52ce,_0x5d51aa){_0x5d51aa=_0x5d51aa||0xcc;return function(_0x4827f5){if(_0x4827f5){return _0x3e52ce[_0x04bd('0x1a')](_0x5d51aa);}return _0x3e52ce['status'](_0x5d51aa)[_0x04bd('0x1b')]();};}function respondWithResult(_0x2ad8c2,_0xf5af18){_0xf5af18=_0xf5af18||0xc8;return function(_0x1e0208){if(_0x1e0208){return _0x2ad8c2[_0x04bd('0x1c')](_0xf5af18)[_0x04bd('0x1d')](_0x1e0208);}};}function respondWithFilteredResult(_0x50e9f4,_0xde69ea){return function(_0x3e9ac3){if(_0x3e9ac3){var _0x59c791=typeof _0xde69ea[_0x04bd('0x1e')]===_0x04bd('0x1f')&&typeof _0xde69ea['limit']===_0x04bd('0x1f');var _0x1ca9f8=_0x3e9ac3[_0x04bd('0x20')];var _0x348c99=_0x59c791?0x0:_0xde69ea[_0x04bd('0x1e')];var _0x687bdb=_0x59c791?_0x3e9ac3[_0x04bd('0x20')]:_0xde69ea['offset']+_0xde69ea['limit'];var _0x3782a7;if(_0x687bdb>=_0x1ca9f8){_0x687bdb=_0x1ca9f8;_0x3782a7=0xc8;}else{_0x3782a7=0xce;}_0x50e9f4[_0x04bd('0x1c')](_0x3782a7);return _0x50e9f4[_0x04bd('0x21')](_0x04bd('0x22'),_0x348c99+'-'+_0x687bdb+'/'+_0x1ca9f8)['json'](_0x3e9ac3);}return null;};}function patchUpdates(_0x557042){return function(_0x30adf5){try{jsonpatch['apply'](_0x30adf5,_0x557042,!![]);}catch(_0x1d74a7){return BPromise[_0x04bd('0x23')](_0x1d74a7);}return _0x30adf5[_0x04bd('0x24')]();};}function saveUpdates(_0x20e0a5,_0x48db21){return function(_0x545d81){if(_0x545d81){return _0x545d81[_0x04bd('0x25')](_0x20e0a5)['then'](function(_0x433816){return _0x433816;});}return null;};}function removeEntity(_0x217df5,_0x585c5a){return function(_0x1546d0){if(_0x1546d0){return _0x1546d0[_0x04bd('0x26')]()[_0x04bd('0x27')](function(){_0x217df5['status'](0xcc)[_0x04bd('0x1b')]();});}};}function handleEntityNotFound(_0x5e91cf,_0x2b48a6){return function(_0x3607af){if(!_0x3607af){_0x5e91cf[_0x04bd('0x1a')](0x194);}return _0x3607af;};}function handleError(_0x77134b,_0x1f1e8b){_0x1f1e8b=_0x1f1e8b||0x1f4;return function(_0x2feca6){logger[_0x04bd('0x28')](_0x2feca6[_0x04bd('0x29')]);if(_0x2feca6[_0x04bd('0x2a')]){delete _0x2feca6['name'];}_0x77134b['status'](_0x1f1e8b)[_0x04bd('0x2b')](_0x2feca6);};}exports[_0x04bd('0x2c')]=function(_0x397969,_0xe5aed1){var _0x213a82={},_0x4a19fb={},_0x2c5bc7={'count':0x0,'rows':[]};var _0x248e97=_[_0x04bd('0x2d')](db[_0x04bd('0x2e')][_0x04bd('0x2f')],function(_0xc41c7d){return{'name':_0xc41c7d[_0x04bd('0x30')],'type':_0xc41c7d['type'][_0x04bd('0x31')]};});_0x4a19fb['model']=_[_0x04bd('0x2d')](_0x248e97,_0x04bd('0x2a'));_0x4a19fb['query']=_['keys'](_0x397969['query']);_0x4a19fb[_0x04bd('0x32')]=_[_0x04bd('0x33')](_0x4a19fb[_0x04bd('0x34')],_0x4a19fb[_0x04bd('0x35')]);_0x213a82['attributes']=_[_0x04bd('0x33')](_0x4a19fb[_0x04bd('0x34')],qs[_0x04bd('0x36')](_0x397969[_0x04bd('0x35')][_0x04bd('0x36')]));_0x213a82[_0x04bd('0x37')]=_0x213a82['attributes'][_0x04bd('0x38')]?_0x213a82[_0x04bd('0x37')]:_0x4a19fb['model'];if(!_0x397969[_0x04bd('0x35')][_0x04bd('0x39')]('nolimit')){_0x213a82[_0x04bd('0x3a')]=qs[_0x04bd('0x3a')](_0x397969[_0x04bd('0x35')][_0x04bd('0x3a')]);_0x213a82[_0x04bd('0x1e')]=qs[_0x04bd('0x1e')](_0x397969['query'][_0x04bd('0x1e')]);}_0x213a82[_0x04bd('0x3b')]=qs[_0x04bd('0x3c')](_0x397969['query']['sort']);_0x213a82[_0x04bd('0x3d')]=qs['filters'](_[_0x04bd('0x3e')](_0x397969[_0x04bd('0x35')],_0x4a19fb[_0x04bd('0x32')]),_0x248e97);if(_0x397969[_0x04bd('0x35')][_0x04bd('0x3f')]){_0x213a82[_0x04bd('0x3d')]=_[_0x04bd('0x40')](_0x213a82[_0x04bd('0x3d')],{'$or':_[_0x04bd('0x2d')](_0x248e97,function(_0x553619){if(_0x553619[_0x04bd('0x41')]!==_0x04bd('0x42')){var _0x5ddb15={};_0x5ddb15[_0x553619[_0x04bd('0x2a')]]={'$like':'%'+_0x397969['query']['filter']+'%'};return _0x5ddb15;}})});}_0x213a82=_[_0x04bd('0x40')]({},_0x213a82,_0x397969[_0x04bd('0x43')]);var _0x269320={'where':_0x213a82['where']};return db['Dynamics365Field'][_0x04bd('0x20')](_0x269320)[_0x04bd('0x27')](function(_0x21049f){_0x2c5bc7[_0x04bd('0x20')]=_0x21049f;if(_0x397969[_0x04bd('0x35')][_0x04bd('0x44')]){_0x213a82['include']=[{'all':!![]}];}return db[_0x04bd('0x2e')][_0x04bd('0x45')](_0x213a82);})[_0x04bd('0x27')](function(_0x35c4d0){_0x2c5bc7[_0x04bd('0x46')]=_0x35c4d0;return _0x2c5bc7;})[_0x04bd('0x27')](respondWithFilteredResult(_0xe5aed1,_0x213a82))['catch'](handleError(_0xe5aed1,null));};exports[_0x04bd('0x47')]=function(_0x357145,_0x444991){var _0xcd4c0={'raw':!![],'where':{'id':_0x357145['params']['id']}},_0x5b7837={};_0x5b7837['model']=_[_0x04bd('0x48')](db['Dynamics365Field'][_0x04bd('0x2f')]);_0x5b7837['query']=_['keys'](_0x357145[_0x04bd('0x35')]);_0x5b7837[_0x04bd('0x32')]=_[_0x04bd('0x33')](_0x5b7837[_0x04bd('0x34')],_0x5b7837['query']);_0xcd4c0[_0x04bd('0x37')]=_['intersection'](_0x5b7837[_0x04bd('0x34')],qs[_0x04bd('0x36')](_0x357145['query'][_0x04bd('0x36')]));_0xcd4c0[_0x04bd('0x37')]=_0xcd4c0[_0x04bd('0x37')]['length']?_0xcd4c0['attributes']:_0x5b7837[_0x04bd('0x34')];if(_0x357145[_0x04bd('0x35')][_0x04bd('0x44')]){_0xcd4c0['include']=[{'all':!![]}];}_0xcd4c0=_[_0x04bd('0x40')]({},_0xcd4c0,_0x357145[_0x04bd('0x43')]);return db[_0x04bd('0x2e')][_0x04bd('0x49')](_0xcd4c0)['then'](handleEntityNotFound(_0x444991,null))['then'](respondWithResult(_0x444991,null))['catch'](handleError(_0x444991,null));};exports[_0x04bd('0x4a')]=function(_0x2a9822,_0x13a1b3){return db[_0x04bd('0x2e')][_0x04bd('0x4a')](_0x2a9822['body'],{})[_0x04bd('0x27')](respondWithResult(_0x13a1b3,0xc9))[_0x04bd('0x4b')](handleError(_0x13a1b3,null));};exports['update']=function(_0x3bacb1,_0x3df294){if(_0x3bacb1['body']['id']){delete _0x3bacb1[_0x04bd('0x4c')]['id'];}return db[_0x04bd('0x2e')]['find']({'where':{'id':_0x3bacb1[_0x04bd('0x4d')]['id']}})[_0x04bd('0x27')](handleEntityNotFound(_0x3df294,null))[_0x04bd('0x27')](saveUpdates(_0x3bacb1['body'],null))[_0x04bd('0x27')](respondWithResult(_0x3df294,null))[_0x04bd('0x4b')](handleError(_0x3df294,null));};exports[_0x04bd('0x26')]=function(_0x123539,_0x457d66){return db[_0x04bd('0x2e')][_0x04bd('0x49')]({'where':{'id':_0x123539[_0x04bd('0x4d')]['id']}})[_0x04bd('0x27')](handleEntityNotFound(_0x457d66,null))['then'](removeEntity(_0x457d66,null))[_0x04bd('0x4b')](handleError(_0x457d66,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 9a11ab4..454df99 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 _0x5c86=['Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','lodash','api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define'];(function(_0x1808b2,_0x35f5a6){var _0x498147=function(_0x17d30a){while(--_0x17d30a){_0x1808b2['push'](_0x1808b2['shift']());}};_0x498147(++_0x35f5a6);}(_0x5c86,0x93));var _0x65c8=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x5c86[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x65c8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x65c8('0x1'));var moment=require(_0x65c8('0x2'));var BPromise=require(_0x65c8('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x65c8('0x4'));var config=require(_0x65c8('0x5'));var attributes=require(_0x65c8('0x6'));module[_0x65c8('0x7')]=function(_0x54fef2,_0x5edf29){return _0x54fef2[_0x65c8('0x8')](_0x65c8('0x9'),attributes,{'tableName':_0x65c8('0xa'),'paranoid':![],'indexes':[{'name':_0x65c8('0xb'),'fields':[_0x65c8('0xc'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5e77=['./intDynamics365Field.attributes','exports','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3b941f,_0x1fd7ed){var _0x42506b=function(_0x538b41){while(--_0x538b41){_0x3b941f['push'](_0x3b941f['shift']());}};_0x42506b(++_0x1fd7ed);}(_0x5e77,0x1b6));var _0x75e7=function(_0x388bfa,_0x1f518c){_0x388bfa=_0x388bfa-0x0;var _0x11d6a6=_0x5e77[_0x388bfa];return _0x11d6a6;};'use strict';var _=require(_0x75e7('0x0'));var util=require(_0x75e7('0x1'));var logger=require(_0x75e7('0x2'))(_0x75e7('0x3'));var moment=require(_0x75e7('0x4'));var BPromise=require(_0x75e7('0x5'));var rp=require(_0x75e7('0x6'));var fs=require('fs');var path=require(_0x75e7('0x7'));var rimraf=require(_0x75e7('0x8'));var config=require(_0x75e7('0x9'));var attributes=require(_0x75e7('0xa'));module[_0x75e7('0xb')]=function(_0x288736,_0x3a3eb7){return _0x288736['define']('Dynamics365Field',attributes,{'tableName':_0x75e7('0xc'),'paranoid':![],'indexes':[{'name':_0x75e7('0xd'),'fields':[_0x75e7('0xe'),_0x75e7('0xf')],'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 6daeca8..6863aaa 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 _0x4616=['randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','result','moment','bluebird'];(function(_0xac947d,_0x2f26de){var _0x1d9c87=function(_0x121a36){while(--_0x121a36){_0xac947d['push'](_0xac947d['shift']());}};_0x1d9c87(++_0x2f26de);}(_0x4616,0xfa));var _0x6461=function(_0xd0868c,_0x4d3f80){_0xd0868c=_0xd0868c-0x0;var _0x1eb994=_0x4616[_0xd0868c];return _0x1eb994;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6461('0x0'));var BPromise=require(_0x6461('0x1'));var rs=require(_0x6461('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6461('0x3'))['db'];var utils=require(_0x6461('0x4'));var logger=require(_0x6461('0x5'))(_0x6461('0x6'));var config=require(_0x6461('0x7'));var jayson=require(_0x6461('0x8'));var client=jayson['client'][_0x6461('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1962b8,_0x1b3f4a,_0x1fbe29){return new BPromise(function(_0x341056,_0x11479a){return client[_0x6461('0xa')](_0x1962b8,_0x1fbe29)[_0x6461('0xb')](function(_0x5bc09a){logger[_0x6461('0xc')]('Dynamics365Field,\x20%s,\x20%s',_0x1b3f4a,_0x6461('0xd'));logger[_0x6461('0xe')](_0x6461('0xf'),_0x1b3f4a,_0x6461('0xd'),JSON[_0x6461('0x10')](_0x5bc09a));if(_0x5bc09a[_0x6461('0x11')]){if(_0x5bc09a['error']['code']===0x1f4){logger[_0x6461('0x11')](_0x6461('0x12'),_0x1b3f4a,_0x5bc09a['error'][_0x6461('0x13')]);return _0x11479a(_0x5bc09a[_0x6461('0x11')]['message']);}logger[_0x6461('0x11')](_0x6461('0x12'),_0x1b3f4a,_0x5bc09a[_0x6461('0x11')][_0x6461('0x13')]);return _0x341056(_0x5bc09a[_0x6461('0x11')][_0x6461('0x13')]);}else{logger[_0x6461('0xc')](_0x6461('0x12'),_0x1b3f4a,'request\x20sent');_0x341056(_0x5bc09a[_0x6461('0x14')][_0x6461('0x13')]);}})['catch'](function(_0x27635b){logger[_0x6461('0x11')](_0x6461('0x12'),_0x1b3f4a,_0x27635b);_0x11479a(_0x27635b);});});} \ No newline at end of file +var _0xc0dc=['http','request','then','info','Dynamics365Field,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x4a541f,_0x291599){var _0x55c122=function(_0xd5a351){while(--_0xd5a351){_0x4a541f['push'](_0x4a541f['shift']());}};_0x55c122(++_0x291599);}(_0xc0dc,0xf2));var _0xcc0d=function(_0x49e4b1,_0x44a5ab){_0x49e4b1=_0x49e4b1-0x0;var _0x269c98=_0xc0dc[_0x49e4b1];return _0x269c98;};'use strict';var _=require(_0xcc0d('0x0'));var util=require(_0xcc0d('0x1'));var moment=require(_0xcc0d('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcc0d('0x3'));var db=require(_0xcc0d('0x4'))['db'];var utils=require(_0xcc0d('0x5'));var logger=require(_0xcc0d('0x6'))(_0xcc0d('0x7'));var config=require(_0xcc0d('0x8'));var jayson=require(_0xcc0d('0x9'));var client=jayson[_0xcc0d('0xa')][_0xcc0d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xa2f963,_0x45a3ae,_0x3bd6c3){return new BPromise(function(_0xf3b7c1,_0x46ebe6){return client[_0xcc0d('0xc')](_0xa2f963,_0x3bd6c3)[_0xcc0d('0xd')](function(_0x28db81){logger[_0xcc0d('0xe')](_0xcc0d('0xf'),_0x45a3ae,'request\x20sent');logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0x45a3ae,'request\x20sent',JSON[_0xcc0d('0x10')](_0x28db81));if(_0x28db81[_0xcc0d('0x11')]){if(_0x28db81[_0xcc0d('0x11')][_0xcc0d('0x12')]===0x1f4){logger[_0xcc0d('0x11')](_0xcc0d('0xf'),_0x45a3ae,_0x28db81[_0xcc0d('0x11')]['message']);return _0x46ebe6(_0x28db81[_0xcc0d('0x11')][_0xcc0d('0x13')]);}logger[_0xcc0d('0x11')](_0xcc0d('0xf'),_0x45a3ae,_0x28db81[_0xcc0d('0x11')][_0xcc0d('0x13')]);return _0xf3b7c1(_0x28db81[_0xcc0d('0x11')]['message']);}else{logger[_0xcc0d('0xe')](_0xcc0d('0xf'),_0x45a3ae,_0xcc0d('0x14'));_0xf3b7c1(_0x28db81[_0xcc0d('0x15')][_0xcc0d('0x13')]);}})[_0xcc0d('0x16')](function(_0x3d2be3){logger['error'](_0xcc0d('0xf'),_0x45a3ae,_0x3d2be3);_0x46ebe6(_0x3d2be3);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index f024a1f..7e3fc30 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 _0x29b2=['../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x176e9e,_0x3dfe11){var _0x1b675f=function(_0x508167){while(--_0x508167){_0x176e9e['push'](_0x176e9e['shift']());}};_0x1b675f(++_0x3dfe11);}(_0x29b2,0x95));var _0x229b=function(_0x2ac298,_0x52179d){_0x2ac298=_0x2ac298-0x0;var _0x50d9f8=_0x29b2[_0x2ac298];return _0x50d9f8;};'use strict';var multer=require('multer');var util=require(_0x229b('0x0'));var path=require('path');var timeout=require(_0x229b('0x1'));var express=require(_0x229b('0x2'));var router=express['Router']();var fs_extra=require(_0x229b('0x3'));var auth=require(_0x229b('0x4'));var interaction=require(_0x229b('0x5'));var config=require(_0x229b('0x6'));var controller=require(_0x229b('0x7'));router[_0x229b('0x8')]('/',auth[_0x229b('0x9')](),controller[_0x229b('0xa')]);router['get'](_0x229b('0xb'),auth[_0x229b('0x9')](),controller['show']);router[_0x229b('0x8')](_0x229b('0xc'),auth[_0x229b('0x9')](),controller[_0x229b('0xd')]);router[_0x229b('0x8')]('/:id/fields',auth['isAuthenticated'](),controller[_0x229b('0xe')]);router[_0x229b('0xf')]('/',auth[_0x229b('0x9')](),controller[_0x229b('0x10')]);router['post'](_0x229b('0xc'),auth[_0x229b('0x9')](),controller[_0x229b('0x11')]);router[_0x229b('0x12')](_0x229b('0xb'),auth[_0x229b('0x9')](),controller['update']);router[_0x229b('0x13')](_0x229b('0xb'),auth[_0x229b('0x9')](),controller[_0x229b('0x14')]);module[_0x229b('0x15')]=router; \ No newline at end of file +var _0xd5fd=['isAuthenticated','show','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x5087c7,_0xcbedbf){var _0x33e9a0=function(_0x8a93ce){while(--_0x8a93ce){_0x5087c7['push'](_0x5087c7['shift']());}};_0x33e9a0(++_0xcbedbf);}(_0xd5fd,0x6d));var _0xdd5f=function(_0x1c78dd,_0x117d6e){_0x1c78dd=_0x1c78dd-0x0;var _0x927903=_0xd5fd[_0x1c78dd];return _0x927903;};'use strict';var multer=require(_0xdd5f('0x0'));var util=require(_0xdd5f('0x1'));var path=require(_0xdd5f('0x2'));var timeout=require('connect-timeout');var express=require(_0xdd5f('0x3'));var router=express[_0xdd5f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xdd5f('0x5'));var interaction=require(_0xdd5f('0x6'));var config=require(_0xdd5f('0x7'));var controller=require('./intFreshdeskAccount.controller');router[_0xdd5f('0x8')]('/',auth['isAuthenticated'](),controller[_0xdd5f('0x9')]);router[_0xdd5f('0x8')](_0xdd5f('0xa'),auth[_0xdd5f('0xb')](),controller[_0xdd5f('0xc')]);router[_0xdd5f('0x8')](_0xdd5f('0xd'),auth[_0xdd5f('0xb')](),controller['getConfigurations']);router[_0xdd5f('0x8')](_0xdd5f('0xe'),auth[_0xdd5f('0xb')](),controller[_0xdd5f('0xf')]);router['post']('/',auth[_0xdd5f('0xb')](),controller[_0xdd5f('0x10')]);router[_0xdd5f('0x11')](_0xdd5f('0xd'),auth[_0xdd5f('0xb')](),controller[_0xdd5f('0x12')]);router[_0xdd5f('0x13')]('/:id',auth[_0xdd5f('0xb')](),controller['update']);router['delete'](_0xdd5f('0xa'),auth[_0xdd5f('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index 906b951..0ecff5b 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 _0x7096=['exports','STRING','username','remoteUri'];(function(_0x5d8d1a,_0x1fda6b){var _0x462ab1=function(_0x4a02b8){while(--_0x4a02b8){_0x5d8d1a['push'](_0x5d8d1a['shift']());}};_0x462ab1(++_0x1fda6b);}(_0x7096,0x10c));var _0x6709=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x7096[_0x1d9aa0];return _0x226868;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6709('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6709('0x2')},'apiKey':{'type':Sequelize[_0x6709('0x1')]},'remoteUri':{'type':Sequelize[_0x6709('0x1')],'unique':_0x6709('0x3')},'serverUrl':{'type':Sequelize[_0x6709('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x2da6=['username','sequelize','exports','STRING'];(function(_0x124e34,_0x543943){var _0x41d899=function(_0x2770c8){while(--_0x2770c8){_0x124e34['push'](_0x124e34['shift']());}};_0x41d899(++_0x543943);}(_0x2da6,0x1dd));var _0x62da=function(_0x44df09,_0x223d0b){_0x44df09=_0x44df09-0x0;var _0x4d96ce=_0x2da6[_0x44df09];return _0x4d96ce;};'use strict';var Sequelize=require(_0x62da('0x0'));module[_0x62da('0x1')]={'name':{'type':Sequelize[_0x62da('0x2')]},'description':{'type':Sequelize[_0x62da('0x2')]},'username':{'type':Sequelize[_0x62da('0x2')],'unique':_0x62da('0x3')},'apiKey':{'type':Sequelize[_0x62da('0x2')]},'remoteUri':{'type':Sequelize[_0x62da('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 1326b1d..aeb9f6a 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 _0x477a=['getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','slice','substring','GET','%s/%s','api/v2/ticket_fields','format','Basic\x20%s','%s:X','apiKey','toString','base64','requester','agent','priority','group','source','remove','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','destroy','then','error','name','send','index','map','FreshdeskAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x477a,0x1e2));var _0xa477=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x477a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xa477('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa477('0x1'));var jsonpatch=require(_0xa477('0x2'));var rp=require('request-promise');var moment=require(_0xa477('0x3'));var BPromise=require(_0xa477('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa477('0x5'));var sox=require(_0xa477('0x6'));var csv=require('to-csv');var ejs=require(_0xa477('0x7'));var fs=require('fs');var fs_extra=require(_0xa477('0x8'));var _=require(_0xa477('0x9'));var squel=require(_0xa477('0xa'));var crypto=require(_0xa477('0xb'));var jsforce=require(_0xa477('0xc'));var deskjs=require(_0xa477('0xd'));var toCsv=require(_0xa477('0xe'));var querystring=require(_0xa477('0xf'));var Papa=require('papaparse');var Redis=require(_0xa477('0x10'));var authService=require(_0xa477('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xa477('0x12'));var config=require(_0xa477('0x13'));var licenseUtil=require(_0xa477('0x14'));var db=require('../../mysqldb')['db'];var integrations=require(_0xa477('0x15'));function respondWithStatusCode(_0x3d2a17,_0x70e1c1){_0x70e1c1=_0x70e1c1||0xcc;return function(_0x5e09ef){if(_0x5e09ef){return _0x3d2a17[_0xa477('0x16')](_0x70e1c1);}return _0x3d2a17[_0xa477('0x17')](_0x70e1c1)[_0xa477('0x18')]();};}function respondWithResult(_0x185c76,_0xe878a){_0xe878a=_0xe878a||0xc8;return function(_0x484706){if(_0x484706){return _0x185c76[_0xa477('0x17')](_0xe878a)[_0xa477('0x19')](_0x484706);}};}function respondWithFilteredResult(_0xa607d0,_0x45ecc1){return function(_0x22a156){if(_0x22a156){var _0x1659cb=typeof _0x45ecc1[_0xa477('0x1a')]===_0xa477('0x1b')&&typeof _0x45ecc1[_0xa477('0x1c')]===_0xa477('0x1b');var _0xc21f88=_0x22a156[_0xa477('0x1d')];var _0xd9cdae=_0x1659cb?0x0:_0x45ecc1['offset'];var _0x6d645=_0x1659cb?_0x22a156[_0xa477('0x1d')]:_0x45ecc1[_0xa477('0x1a')]+_0x45ecc1[_0xa477('0x1c')];var _0x4596bd;if(_0x6d645>=_0xc21f88){_0x6d645=_0xc21f88;_0x4596bd=0xc8;}else{_0x4596bd=0xce;}_0xa607d0[_0xa477('0x17')](_0x4596bd);return _0xa607d0[_0xa477('0x1e')](_0xa477('0x1f'),_0xd9cdae+'-'+_0x6d645+'/'+_0xc21f88)['json'](_0x22a156);}return null;};}function patchUpdates(_0x434ef1){return function(_0x240956){try{jsonpatch[_0xa477('0x20')](_0x240956,_0x434ef1,!![]);}catch(_0x5ed526){return BPromise['reject'](_0x5ed526);}return _0x240956['save']();};}function saveUpdates(_0x14d01e,_0x2debae){return function(_0x571501){if(_0x571501){return _0x571501[_0xa477('0x21')](_0x14d01e)['then'](function(_0x5b6e98){return _0x5b6e98;});}return null;};}function removeEntity(_0x7aa4ac,_0x166694){return function(_0x1bb568){if(_0x1bb568){return _0x1bb568[_0xa477('0x22')]()[_0xa477('0x23')](function(){_0x7aa4ac[_0xa477('0x17')](0xcc)[_0xa477('0x18')]();});}};}function handleEntityNotFound(_0x48209e,_0x3cafd9){return function(_0x1e444e){if(!_0x1e444e){_0x48209e[_0xa477('0x16')](0x194);}return _0x1e444e;};}function handleError(_0x236416,_0x18e8c3){_0x18e8c3=_0x18e8c3||0x1f4;return function(_0x27ec39){logger[_0xa477('0x24')](_0x27ec39['stack']);if(_0x27ec39[_0xa477('0x25')]){delete _0x27ec39[_0xa477('0x25')];}_0x236416[_0xa477('0x17')](_0x18e8c3)[_0xa477('0x26')](_0x27ec39);};}exports[_0xa477('0x27')]=function(_0xdb15a9,_0x14b0e8){var _0x5aed5d={},_0x169089={},_0x5819c8={'count':0x0,'rows':[]};var _0x599371=_[_0xa477('0x28')](db[_0xa477('0x29')]['rawAttributes'],function(_0x15e476){return{'name':_0x15e476[_0xa477('0x2a')],'type':_0x15e476[_0xa477('0x2b')][_0xa477('0x2c')]};});_0x169089[_0xa477('0x2d')]=_[_0xa477('0x28')](_0x599371,_0xa477('0x25'));_0x169089[_0xa477('0x2e')]=_[_0xa477('0x2f')](_0xdb15a9[_0xa477('0x2e')]);_0x169089[_0xa477('0x30')]=_[_0xa477('0x31')](_0x169089[_0xa477('0x2d')],_0x169089['query']);_0x5aed5d[_0xa477('0x32')]=_[_0xa477('0x31')](_0x169089[_0xa477('0x2d')],qs[_0xa477('0x33')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x33')]));_0x5aed5d[_0xa477('0x32')]=_0x5aed5d[_0xa477('0x32')]['length']?_0x5aed5d[_0xa477('0x32')]:_0x169089[_0xa477('0x2d')];if(!_0xdb15a9[_0xa477('0x2e')][_0xa477('0x34')](_0xa477('0x35'))){_0x5aed5d[_0xa477('0x1c')]=qs[_0xa477('0x1c')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x1c')]);_0x5aed5d[_0xa477('0x1a')]=qs[_0xa477('0x1a')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x1a')]);}_0x5aed5d[_0xa477('0x36')]=qs[_0xa477('0x37')](_0xdb15a9[_0xa477('0x2e')][_0xa477('0x37')]);_0x5aed5d[_0xa477('0x38')]=qs[_0xa477('0x30')](_['pick'](_0xdb15a9[_0xa477('0x2e')],_0x169089[_0xa477('0x30')]),_0x599371);if(_0xdb15a9[_0xa477('0x2e')][_0xa477('0x39')]){_0x5aed5d[_0xa477('0x38')]=_[_0xa477('0x3a')](_0x5aed5d['where'],{'$or':_['map'](_0x599371,function(_0x3065e7){if(_0x3065e7[_0xa477('0x2b')]!==_0xa477('0x3b')){var _0x764cef={};_0x764cef[_0x3065e7['name']]={'$like':'%'+_0xdb15a9['query'][_0xa477('0x39')]+'%'};return _0x764cef;}})});}_0x5aed5d=_[_0xa477('0x3a')]({},_0x5aed5d,_0xdb15a9[_0xa477('0x3c')]);var _0x3db1a6={'where':_0x5aed5d[_0xa477('0x38')]};return db[_0xa477('0x29')][_0xa477('0x1d')](_0x3db1a6)[_0xa477('0x23')](function(_0x365f1a){_0x5819c8['count']=_0x365f1a;if(_0xdb15a9[_0xa477('0x2e')][_0xa477('0x3d')]){_0x5aed5d[_0xa477('0x3e')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xa477('0x3f')](_0x5aed5d);})['then'](function(_0x3d9ba0){_0x5819c8[_0xa477('0x40')]=_0x3d9ba0;return _0x5819c8;})['then'](respondWithFilteredResult(_0x14b0e8,_0x5aed5d))[_0xa477('0x41')](handleError(_0x14b0e8,null));};exports[_0xa477('0x42')]=function(_0x5c1e58,_0x240ad9){var _0x37f18c={'raw':![],'where':{'id':_0x5c1e58[_0xa477('0x43')]['id']}},_0x289080={};_0x289080[_0xa477('0x2d')]=_[_0xa477('0x2f')](db[_0xa477('0x29')][_0xa477('0x44')]);_0x289080[_0xa477('0x2e')]=_[_0xa477('0x2f')](_0x5c1e58['query']);_0x289080[_0xa477('0x30')]=_[_0xa477('0x31')](_0x289080[_0xa477('0x2d')],_0x289080[_0xa477('0x2e')]);_0x37f18c[_0xa477('0x32')]=_['intersection'](_0x289080[_0xa477('0x2d')],qs['fields'](_0x5c1e58[_0xa477('0x2e')][_0xa477('0x33')]));_0x37f18c[_0xa477('0x32')]=_0x37f18c['attributes'][_0xa477('0x45')]?_0x37f18c[_0xa477('0x32')]:_0x289080[_0xa477('0x2d')];if(_0x5c1e58[_0xa477('0x2e')][_0xa477('0x3d')]){_0x37f18c[_0xa477('0x3e')]=[{'all':!![]}];}_0x37f18c=_[_0xa477('0x3a')]({},_0x37f18c,_0x5c1e58[_0xa477('0x3c')]);return db[_0xa477('0x29')][_0xa477('0x46')](_0x37f18c)[_0xa477('0x23')](handleEntityNotFound(_0x240ad9,null))['then'](respondWithResult(_0x240ad9,null))[_0xa477('0x41')](handleError(_0x240ad9,null));};exports[_0xa477('0x47')]=function(_0xeacd33,_0x545410){return db[_0xa477('0x29')][_0xa477('0x47')](_0xeacd33['body'],{})[_0xa477('0x23')](respondWithResult(_0x545410,0xc9))[_0xa477('0x41')](handleError(_0x545410,null));};exports[_0xa477('0x21')]=function(_0x543a19,_0xcb8c41){if(_0x543a19['body']['id']){delete _0x543a19[_0xa477('0x48')]['id'];}return db['FreshdeskAccount'][_0xa477('0x46')]({'where':{'id':_0x543a19[_0xa477('0x43')]['id']}})[_0xa477('0x23')](handleEntityNotFound(_0xcb8c41,null))[_0xa477('0x23')](saveUpdates(_0x543a19['body'],null))[_0xa477('0x23')](respondWithResult(_0xcb8c41,null))[_0xa477('0x41')](handleError(_0xcb8c41,null));};exports[_0xa477('0x22')]=function(_0x59b17a,_0x4fb38b){return db[_0xa477('0x29')][_0xa477('0x46')]({'where':{'id':_0x59b17a[_0xa477('0x43')]['id']}})[_0xa477('0x23')](handleEntityNotFound(_0x4fb38b,null))[_0xa477('0x23')](removeEntity(_0x4fb38b,null))[_0xa477('0x41')](handleError(_0x4fb38b,null));};exports[_0xa477('0x49')]=function(_0x3f03c0,_0x596eb5,_0x53e55e){var _0x4052e0={};var _0x16f491={};var _0x2c1d27;var _0xadf7b9;return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x3f03c0['params']['id']}})[_0xa477('0x23')](handleEntityNotFound(_0x596eb5,null))[_0xa477('0x23')](function(_0x219417){if(_0x219417){_0x2c1d27=_0x219417;_0x16f491[_0xa477('0x2d')]=_[_0xa477('0x2f')](db[_0xa477('0x4b')][_0xa477('0x44')]);_0x16f491['query']=_['keys'](_0x3f03c0[_0xa477('0x2e')]);_0x16f491[_0xa477('0x30')]=_[_0xa477('0x31')](_0x16f491['model'],_0x16f491[_0xa477('0x2e')]);_0x4052e0[_0xa477('0x32')]=_[_0xa477('0x31')](_0x16f491['model'],qs[_0xa477('0x33')](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x33')]));_0x4052e0[_0xa477('0x32')]=_0x4052e0[_0xa477('0x32')][_0xa477('0x45')]?_0x4052e0[_0xa477('0x32')]:_0x16f491[_0xa477('0x2d')];_0x4052e0['order']=qs['sort'](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x37')]);_0x4052e0[_0xa477('0x38')]=qs[_0xa477('0x30')](_['pick'](_0x3f03c0['query'],_0x16f491[_0xa477('0x30')]));if(_0x3f03c0[_0xa477('0x2e')][_0xa477('0x39')]){_0x4052e0[_0xa477('0x38')]=_['merge'](_0x4052e0[_0xa477('0x38')],{'$or':_['map'](_0x4052e0['attributes'],function(_0x460ccf){var _0x2e20ca={};_0x2e20ca[_0x460ccf]={'$like':'%'+_0x3f03c0[_0xa477('0x2e')]['filter']+'%'};return _0x2e20ca;})});}_0x4052e0=_[_0xa477('0x3a')]({},_0x4052e0,_0x3f03c0['options']);return _0x2c1d27[_0xa477('0x49')](_0x4052e0);}})['then'](function(_0x1a0b6b){if(_0x1a0b6b){_0xadf7b9=_0x1a0b6b[_0xa477('0x45')];if(!_0x3f03c0[_0xa477('0x2e')]['hasOwnProperty'](_0xa477('0x35'))){_0x4052e0[_0xa477('0x1c')]=qs[_0xa477('0x1c')](_0x3f03c0[_0xa477('0x2e')][_0xa477('0x1c')]);_0x4052e0[_0xa477('0x1a')]=qs[_0xa477('0x1a')](_0x3f03c0[_0xa477('0x2e')]['offset']);}return _0x2c1d27[_0xa477('0x49')](_0x4052e0);}})[_0xa477('0x23')](function(_0x31cde3){if(_0x31cde3){return _0x31cde3?{'count':_0xadf7b9,'rows':_0x31cde3}:null;}})[_0xa477('0x23')](respondWithResult(_0x596eb5,null))['catch'](handleError(_0x596eb5,null));};exports[_0xa477('0x4c')]=function(_0x5a4eb2,_0x48189b,_0x3df3bf){if(_0x5a4eb2[_0xa477('0x48')]['id']){delete _0x5a4eb2['body']['id'];}return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x5a4eb2[_0xa477('0x43')]['id']}})['then'](handleEntityNotFound(_0x48189b,null))[_0xa477('0x23')](function(_0x578d64){if(_0x578d64){_0x5a4eb2[_0xa477('0x48')][_0xa477('0x4d')]=_0x578d64['id'];_0x5a4eb2[_0xa477('0x48')][_0xa477('0x4e')]=integrations[_0xa477('0x4f')](_0x5a4eb2['body']['channel'],_0x5a4eb2[_0xa477('0x48')][_0xa477('0x2b')]);_0x5a4eb2[_0xa477('0x48')]['Descriptions']=integrations[_0xa477('0x50')](_0x5a4eb2['body']['channel'],_0x5a4eb2[_0xa477('0x48')]['type']);return db['FreshdeskConfiguration']['create'](_0x5a4eb2[_0xa477('0x48')],{'include':[{'model':db[_0xa477('0x51')],'as':_0xa477('0x4e')},{'model':db[_0xa477('0x51')],'as':_0xa477('0x52')}]});}return null;})[_0xa477('0x23')](respondWithResult(_0x48189b,null))['catch'](handleError(_0x48189b,null));};exports[_0xa477('0x53')]=function(_0x3378a1,_0x1254fd,_0x4eb045){var _0x2b9139='';return db[_0xa477('0x29')][_0xa477('0x4a')]({'where':{'id':_0x3378a1['params']['id']},'attributes':['id','remoteUri','apiKey']})['then'](handleEntityNotFound(_0x1254fd,null))[_0xa477('0x23')](function(_0x452834){if(_0x452834){_0x2b9139=_0x452834[_0xa477('0x54')];var _0x1a48a4=_0x2b9139[_0xa477('0x55')](-0x1);if(_0x1a48a4==='/'){_0x2b9139=_0x2b9139[_0xa477('0x56')](0x0,_0x2b9139['lastIndexOf'](_0x1a48a4));}return rp({'method':_0xa477('0x57'),'uri':util['format'](_0xa477('0x58'),_0x2b9139,_0xa477('0x59')),'headers':{'Authorization':util[_0xa477('0x5a')](_0xa477('0x5b'),new Buffer(util[_0xa477('0x5a')](_0xa477('0x5c'),_0x452834[_0xa477('0x5d')]))[_0xa477('0x5e')](_0xa477('0x5f')))},'json':!![]});}})['then'](function(_0x16fcec){if(_0x16fcec){var _0x47be0a=[_0xa477('0x60'),'subject',_0xa477('0x61'),'description',_0xa477('0x17'),_0xa477('0x62'),_0xa477('0x63'),_0xa477('0x64'),'ticket_type',_0xa477('0x63'),'company'];_[_0xa477('0x65')](_0x16fcec,function(_0x3c8b35){return _0x47be0a['includes'](_0x3c8b35[_0xa477('0x25')])||!_0x3c8b35[_0xa477('0x66')]&&_0x3c8b35[_0xa477('0x2b')]!==_0xa477('0x67')&&_0x3c8b35['type']!==_0xa477('0x68');});return{'count':_0x16fcec[_0xa477('0x45')],'rows':_[_0xa477('0x28')](_0x16fcec,function(_0x4596ce){return{'id':_0x4596ce[_0xa477('0x25')],'name':_0x4596ce[_0xa477('0x69')],'custom':!_0x4596ce[_0xa477('0x66')],'options':_0x4596ce['choices']?_[_0xa477('0x28')](_0x4596ce[_0xa477('0x6a')],function(_0x7a28a7){return{'name':_[_0xa477('0x6b')](_0x7a28a7),'value':_0x7a28a7};}):[]};})};}})['then'](respondWithResult(_0x1254fd,null))[_0xa477('0x41')](function(_0x23dd79){var _0xa25710=_0x3378a1[_0xa477('0x2e')][_0xa477('0x6c')]?0x1f4:_0x23dd79[_0xa477('0x6d')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xa477('0x53'),_0xa25710,JSON['stringify'](_0x23dd79));delete _0x23dd79['name'];if(_0xa25710===0x191){_0xa25710=0x190;}_0x1254fd[_0xa477('0x17')](_0xa25710)[_0xa477('0x26')](_0x3378a1[_0xa477('0x2e')][_0xa477('0x6c')]?{'message':_0xa477('0x6e'),'statusCode':_0x23dd79[_0xa477('0x6d')]}:_0x23dd79);});}; \ No newline at end of file +var _0x81a4=['includeAll','FreshdeskAccount','rows','catch','params','rawAttributes','create','body','find','getConfigurations','findOne','FreshdeskConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','FreshdeskField','getFields','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','apiKey','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','includes','custom_text','custom_dropdown','label','default','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','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','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x5695e5,_0xa00d0d){var _0x3784ad=function(_0x306cd6){while(--_0x306cd6){_0x5695e5['push'](_0x5695e5['shift']());}};_0x3784ad(++_0xa00d0d);}(_0x81a4,0x1a6));var _0x481a=function(_0x2e914,_0x1c7566){_0x2e914=_0x2e914-0x0;var _0x936e45=_0x81a4[_0x2e914];return _0x936e45;};'use strict';var emlformat=require(_0x481a('0x0'));var rimraf=require(_0x481a('0x1'));var zipdir=require(_0x481a('0x2'));var jsonpatch=require(_0x481a('0x3'));var rp=require('request-promise');var moment=require(_0x481a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x481a('0x5'));var util=require(_0x481a('0x6'));var path=require(_0x481a('0x7'));var sox=require('sox');var csv=require(_0x481a('0x8'));var ejs=require(_0x481a('0x9'));var fs=require('fs');var fs_extra=require(_0x481a('0xa'));var _=require(_0x481a('0xb'));var squel=require('squel');var crypto=require(_0x481a('0xc'));var jsforce=require(_0x481a('0xd'));var deskjs=require(_0x481a('0xe'));var toCsv=require(_0x481a('0x8'));var querystring=require(_0x481a('0xf'));var Papa=require(_0x481a('0x10'));var Redis=require('ioredis');var authService=require(_0x481a('0x11'));var qs=require(_0x481a('0x12'));var as=require(_0x481a('0x13'));var hardwareService=require(_0x481a('0x14'));var logger=require(_0x481a('0x15'))(_0x481a('0x16'));var utils=require(_0x481a('0x17'));var config=require(_0x481a('0x18'));var licenseUtil=require(_0x481a('0x19'));var db=require(_0x481a('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5838af,_0x28a189){_0x28a189=_0x28a189||0xcc;return function(_0x12a690){if(_0x12a690){return _0x5838af[_0x481a('0x1b')](_0x28a189);}return _0x5838af[_0x481a('0x1c')](_0x28a189)[_0x481a('0x1d')]();};}function respondWithResult(_0x2e520b,_0x5637bd){_0x5637bd=_0x5637bd||0xc8;return function(_0x2b20ed){if(_0x2b20ed){return _0x2e520b['status'](_0x5637bd)[_0x481a('0x1e')](_0x2b20ed);}};}function respondWithFilteredResult(_0x1410c1,_0x40f691){return function(_0x507a5b){if(_0x507a5b){var _0x488d6a=typeof _0x40f691[_0x481a('0x1f')]===_0x481a('0x20')&&typeof _0x40f691[_0x481a('0x21')]===_0x481a('0x20');var _0x263755=_0x507a5b[_0x481a('0x22')];var _0xe4e8fe=_0x488d6a?0x0:_0x40f691[_0x481a('0x1f')];var _0x38c15e=_0x488d6a?_0x507a5b[_0x481a('0x22')]:_0x40f691['offset']+_0x40f691[_0x481a('0x21')];var _0x2e81be;if(_0x38c15e>=_0x263755){_0x38c15e=_0x263755;_0x2e81be=0xc8;}else{_0x2e81be=0xce;}_0x1410c1[_0x481a('0x1c')](_0x2e81be);return _0x1410c1[_0x481a('0x23')](_0x481a('0x24'),_0xe4e8fe+'-'+_0x38c15e+'/'+_0x263755)['json'](_0x507a5b);}return null;};}function patchUpdates(_0x2e3549){return function(_0x46db3c){try{jsonpatch[_0x481a('0x25')](_0x46db3c,_0x2e3549,!![]);}catch(_0x35c3c3){return BPromise['reject'](_0x35c3c3);}return _0x46db3c[_0x481a('0x26')]();};}function saveUpdates(_0x1afd59,_0x44673f){return function(_0x2f3ea0){if(_0x2f3ea0){return _0x2f3ea0[_0x481a('0x27')](_0x1afd59)[_0x481a('0x28')](function(_0x336ea1){return _0x336ea1;});}return null;};}function removeEntity(_0x6a554b,_0x56dc8f){return function(_0x333866){if(_0x333866){return _0x333866[_0x481a('0x29')]()['then'](function(){_0x6a554b[_0x481a('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f7c7d,_0x2ab2ed){return function(_0x3b36b1){if(!_0x3b36b1){_0x1f7c7d[_0x481a('0x1b')](0x194);}return _0x3b36b1;};}function handleError(_0x542639,_0x42acf4){_0x42acf4=_0x42acf4||0x1f4;return function(_0x3ecd24){logger[_0x481a('0x2a')](_0x3ecd24[_0x481a('0x2b')]);if(_0x3ecd24[_0x481a('0x2c')]){delete _0x3ecd24[_0x481a('0x2c')];}_0x542639['status'](_0x42acf4)[_0x481a('0x2d')](_0x3ecd24);};}exports[_0x481a('0x2e')]=function(_0xde418d,_0x428e55){var _0x4e9d26={},_0x14317e={},_0x39d776={'count':0x0,'rows':[]};var _0x25ea29=_[_0x481a('0x2f')](db['FreshdeskAccount']['rawAttributes'],function(_0x56275e){return{'name':_0x56275e['fieldName'],'type':_0x56275e[_0x481a('0x30')][_0x481a('0x31')]};});_0x14317e[_0x481a('0x32')]=_['map'](_0x25ea29,_0x481a('0x2c'));_0x14317e[_0x481a('0x33')]=_[_0x481a('0x34')](_0xde418d['query']);_0x14317e[_0x481a('0x35')]=_[_0x481a('0x36')](_0x14317e['model'],_0x14317e['query']);_0x4e9d26[_0x481a('0x37')]=_[_0x481a('0x36')](_0x14317e[_0x481a('0x32')],qs[_0x481a('0x38')](_0xde418d[_0x481a('0x33')]['fields']));_0x4e9d26[_0x481a('0x37')]=_0x4e9d26[_0x481a('0x37')][_0x481a('0x39')]?_0x4e9d26[_0x481a('0x37')]:_0x14317e['model'];if(!_0xde418d['query']['hasOwnProperty'](_0x481a('0x3a'))){_0x4e9d26[_0x481a('0x21')]=qs['limit'](_0xde418d[_0x481a('0x33')][_0x481a('0x21')]);_0x4e9d26['offset']=qs[_0x481a('0x1f')](_0xde418d['query']['offset']);}_0x4e9d26['order']=qs[_0x481a('0x3b')](_0xde418d['query'][_0x481a('0x3b')]);_0x4e9d26[_0x481a('0x3c')]=qs[_0x481a('0x35')](_[_0x481a('0x3d')](_0xde418d['query'],_0x14317e[_0x481a('0x35')]),_0x25ea29);if(_0xde418d[_0x481a('0x33')][_0x481a('0x3e')]){_0x4e9d26[_0x481a('0x3c')]=_[_0x481a('0x3f')](_0x4e9d26[_0x481a('0x3c')],{'$or':_['map'](_0x25ea29,function(_0x37972e){if(_0x37972e[_0x481a('0x30')]!==_0x481a('0x40')){var _0x5e6227={};_0x5e6227[_0x37972e['name']]={'$like':'%'+_0xde418d[_0x481a('0x33')][_0x481a('0x3e')]+'%'};return _0x5e6227;}})});}_0x4e9d26=_[_0x481a('0x3f')]({},_0x4e9d26,_0xde418d[_0x481a('0x41')]);var _0x5776b6={'where':_0x4e9d26['where']};return db['FreshdeskAccount']['count'](_0x5776b6)[_0x481a('0x28')](function(_0x221ebc){_0x39d776[_0x481a('0x22')]=_0x221ebc;if(_0xde418d['query'][_0x481a('0x42')]){_0x4e9d26['include']=[{'all':!![]}];}return db[_0x481a('0x43')]['findAll'](_0x4e9d26);})[_0x481a('0x28')](function(_0x30b6ab){_0x39d776[_0x481a('0x44')]=_0x30b6ab;return _0x39d776;})['then'](respondWithFilteredResult(_0x428e55,_0x4e9d26))[_0x481a('0x45')](handleError(_0x428e55,null));};exports['show']=function(_0x5c25b5,_0x4aaa5c){var _0x1c77b7={'raw':![],'where':{'id':_0x5c25b5[_0x481a('0x46')]['id']}},_0x260593={};_0x260593[_0x481a('0x32')]=_[_0x481a('0x34')](db[_0x481a('0x43')][_0x481a('0x47')]);_0x260593['query']=_['keys'](_0x5c25b5[_0x481a('0x33')]);_0x260593[_0x481a('0x35')]=_[_0x481a('0x36')](_0x260593['model'],_0x260593[_0x481a('0x33')]);_0x1c77b7[_0x481a('0x37')]=_[_0x481a('0x36')](_0x260593['model'],qs['fields'](_0x5c25b5[_0x481a('0x33')][_0x481a('0x38')]));_0x1c77b7[_0x481a('0x37')]=_0x1c77b7[_0x481a('0x37')][_0x481a('0x39')]?_0x1c77b7[_0x481a('0x37')]:_0x260593[_0x481a('0x32')];if(_0x5c25b5[_0x481a('0x33')][_0x481a('0x42')]){_0x1c77b7['include']=[{'all':!![]}];}_0x1c77b7=_[_0x481a('0x3f')]({},_0x1c77b7,_0x5c25b5['options']);return db[_0x481a('0x43')]['find'](_0x1c77b7)[_0x481a('0x28')](handleEntityNotFound(_0x4aaa5c,null))[_0x481a('0x28')](respondWithResult(_0x4aaa5c,null))[_0x481a('0x45')](handleError(_0x4aaa5c,null));};exports[_0x481a('0x48')]=function(_0x52fc2c,_0x31796b){return db[_0x481a('0x43')]['create'](_0x52fc2c[_0x481a('0x49')],{})[_0x481a('0x28')](respondWithResult(_0x31796b,0xc9))['catch'](handleError(_0x31796b,null));};exports['update']=function(_0x35dff1,_0x4a8120){if(_0x35dff1['body']['id']){delete _0x35dff1[_0x481a('0x49')]['id'];}return db[_0x481a('0x43')][_0x481a('0x4a')]({'where':{'id':_0x35dff1[_0x481a('0x46')]['id']}})[_0x481a('0x28')](handleEntityNotFound(_0x4a8120,null))['then'](saveUpdates(_0x35dff1['body'],null))['then'](respondWithResult(_0x4a8120,null))['catch'](handleError(_0x4a8120,null));};exports['destroy']=function(_0x1c8a1f,_0xd6cbb){return db['FreshdeskAccount']['find']({'where':{'id':_0x1c8a1f[_0x481a('0x46')]['id']}})[_0x481a('0x28')](handleEntityNotFound(_0xd6cbb,null))[_0x481a('0x28')](removeEntity(_0xd6cbb,null))[_0x481a('0x45')](handleError(_0xd6cbb,null));};exports[_0x481a('0x4b')]=function(_0x4b4e74,_0x35ba2f,_0x4825f3){var _0x151523={};var _0x121557={};var _0x32b619;var _0x10585b;return db['FreshdeskAccount'][_0x481a('0x4c')]({'where':{'id':_0x4b4e74['params']['id']}})[_0x481a('0x28')](handleEntityNotFound(_0x35ba2f,null))['then'](function(_0x161924){if(_0x161924){_0x32b619=_0x161924;_0x121557['model']=_[_0x481a('0x34')](db[_0x481a('0x4d')][_0x481a('0x47')]);_0x121557[_0x481a('0x33')]=_[_0x481a('0x34')](_0x4b4e74[_0x481a('0x33')]);_0x121557[_0x481a('0x35')]=_[_0x481a('0x36')](_0x121557[_0x481a('0x32')],_0x121557[_0x481a('0x33')]);_0x151523[_0x481a('0x37')]=_[_0x481a('0x36')](_0x121557[_0x481a('0x32')],qs[_0x481a('0x38')](_0x4b4e74[_0x481a('0x33')]['fields']));_0x151523[_0x481a('0x37')]=_0x151523['attributes']['length']?_0x151523['attributes']:_0x121557[_0x481a('0x32')];_0x151523[_0x481a('0x4e')]=qs[_0x481a('0x3b')](_0x4b4e74[_0x481a('0x33')][_0x481a('0x3b')]);_0x151523[_0x481a('0x3c')]=qs['filters'](_[_0x481a('0x3d')](_0x4b4e74[_0x481a('0x33')],_0x121557[_0x481a('0x35')]));if(_0x4b4e74[_0x481a('0x33')][_0x481a('0x3e')]){_0x151523[_0x481a('0x3c')]=_[_0x481a('0x3f')](_0x151523[_0x481a('0x3c')],{'$or':_[_0x481a('0x2f')](_0x151523[_0x481a('0x37')],function(_0x312b36){var _0x15c6a0={};_0x15c6a0[_0x312b36]={'$like':'%'+_0x4b4e74['query'][_0x481a('0x3e')]+'%'};return _0x15c6a0;})});}_0x151523=_[_0x481a('0x3f')]({},_0x151523,_0x4b4e74[_0x481a('0x41')]);return _0x32b619[_0x481a('0x4b')](_0x151523);}})[_0x481a('0x28')](function(_0x244cfe){if(_0x244cfe){_0x10585b=_0x244cfe[_0x481a('0x39')];if(!_0x4b4e74[_0x481a('0x33')][_0x481a('0x4f')]('nolimit')){_0x151523[_0x481a('0x21')]=qs[_0x481a('0x21')](_0x4b4e74[_0x481a('0x33')][_0x481a('0x21')]);_0x151523[_0x481a('0x1f')]=qs[_0x481a('0x1f')](_0x4b4e74['query'][_0x481a('0x1f')]);}return _0x32b619[_0x481a('0x4b')](_0x151523);}})['then'](function(_0x1e41bf){if(_0x1e41bf){return _0x1e41bf?{'count':_0x10585b,'rows':_0x1e41bf}:null;}})['then'](respondWithResult(_0x35ba2f,null))[_0x481a('0x45')](handleError(_0x35ba2f,null));};exports[_0x481a('0x50')]=function(_0x54e80d,_0x13139e,_0x5e565d){if(_0x54e80d[_0x481a('0x49')]['id']){delete _0x54e80d['body']['id'];}return db[_0x481a('0x43')][_0x481a('0x4c')]({'where':{'id':_0x54e80d['params']['id']}})[_0x481a('0x28')](handleEntityNotFound(_0x13139e,null))[_0x481a('0x28')](function(_0x39af88){if(_0x39af88){_0x54e80d[_0x481a('0x49')][_0x481a('0x51')]=_0x39af88['id'];_0x54e80d[_0x481a('0x49')][_0x481a('0x52')]=integrations[_0x481a('0x53')](_0x54e80d[_0x481a('0x49')]['channel'],_0x54e80d['body'][_0x481a('0x30')]);_0x54e80d['body'][_0x481a('0x54')]=integrations[_0x481a('0x55')](_0x54e80d['body'][_0x481a('0x56')],_0x54e80d[_0x481a('0x49')][_0x481a('0x30')]);return db[_0x481a('0x4d')][_0x481a('0x48')](_0x54e80d['body'],{'include':[{'model':db[_0x481a('0x57')],'as':'Subjects'},{'model':db[_0x481a('0x57')],'as':_0x481a('0x54')}]});}return null;})['then'](respondWithResult(_0x13139e,null))[_0x481a('0x45')](handleError(_0x13139e,null));};exports[_0x481a('0x58')]=function(_0x50a5a6,_0x95a29b,_0x2a9035){var _0x5ee0e5='';return db['FreshdeskAccount'][_0x481a('0x4c')]({'where':{'id':_0x50a5a6[_0x481a('0x46')]['id']},'attributes':['id',_0x481a('0x59'),'apiKey']})[_0x481a('0x28')](handleEntityNotFound(_0x95a29b,null))[_0x481a('0x28')](function(_0x10e30e){if(_0x10e30e){_0x5ee0e5=_0x10e30e[_0x481a('0x59')];var _0x25f209=_0x5ee0e5[_0x481a('0x5a')](-0x1);if(_0x25f209==='/'){_0x5ee0e5=_0x5ee0e5[_0x481a('0x5b')](0x0,_0x5ee0e5[_0x481a('0x5c')](_0x25f209));}return rp({'method':_0x481a('0x5d'),'uri':util[_0x481a('0x5e')](_0x481a('0x5f'),_0x5ee0e5,_0x481a('0x60')),'headers':{'Authorization':util[_0x481a('0x5e')](_0x481a('0x61'),new Buffer(util[_0x481a('0x5e')](_0x481a('0x62'),_0x10e30e[_0x481a('0x63')]))[_0x481a('0x64')](_0x481a('0x65')))},'json':!![]});}})['then'](function(_0x14e40b){if(_0x14e40b){var _0x33e5b0=[_0x481a('0x66'),_0x481a('0x67'),_0x481a('0x68'),_0x481a('0x69'),_0x481a('0x1c'),_0x481a('0x6a'),_0x481a('0x6b'),_0x481a('0x6c'),_0x481a('0x6d'),'group',_0x481a('0x6e')];_['remove'](_0x14e40b,function(_0xffe41){return _0x33e5b0[_0x481a('0x6f')](_0xffe41[_0x481a('0x2c')])||!_0xffe41['default']&&_0xffe41[_0x481a('0x30')]!==_0x481a('0x70')&&_0xffe41[_0x481a('0x30')]!==_0x481a('0x71');});return{'count':_0x14e40b[_0x481a('0x39')],'rows':_[_0x481a('0x2f')](_0x14e40b,function(_0x598126){return{'id':_0x598126['name'],'name':_0x598126[_0x481a('0x72')],'custom':!_0x598126[_0x481a('0x73')],'options':_0x598126['choices']?_['map'](_0x598126[_0x481a('0x74')],function(_0x3f8965){return{'name':_[_0x481a('0x75')](_0x3f8965),'value':_0x3f8965};}):[]};})};}})['then'](respondWithResult(_0x95a29b,null))[_0x481a('0x45')](function(_0x2ad632){var _0x540024=_0x50a5a6['query'][_0x481a('0x76')]?0x1f4:_0x2ad632[_0x481a('0x77')]||0x1f4;logger[_0x481a('0x2a')](_0x481a('0x78'),_0x481a('0x58'),_0x540024,JSON[_0x481a('0x79')](_0x2ad632));delete _0x2ad632[_0x481a('0x2c')];if(_0x540024===0x191){_0x540024=0x190;}_0x95a29b['status'](_0x540024)[_0x481a('0x2d')](_0x50a5a6[_0x481a('0x33')][_0x481a('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x2ad632[_0x481a('0x77')]}:_0x2ad632);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 0a7d296..ceb306c 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 _0x5ba1=['define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x2162e0,_0xd18181){var _0x162d05=function(_0x421403){while(--_0x421403){_0x2162e0['push'](_0x2162e0['shift']());}};_0x162d05(++_0xd18181);}(_0x5ba1,0x1d1));var _0x15ba=function(_0x13d4db,_0x1fdc98){_0x13d4db=_0x13d4db-0x0;var _0x149258=_0x5ba1[_0x13d4db];return _0x149258;};'use strict';var _=require(_0x15ba('0x0'));var util=require(_0x15ba('0x1'));var logger=require(_0x15ba('0x2'))('api');var moment=require('moment');var BPromise=require(_0x15ba('0x3'));var rp=require(_0x15ba('0x4'));var fs=require('fs');var path=require(_0x15ba('0x5'));var rimraf=require(_0x15ba('0x6'));var config=require(_0x15ba('0x7'));var attributes=require(_0x15ba('0x8'));var integrations=require(_0x15ba('0x9'));module[_0x15ba('0xa')]=function(_0x100c4c,_0x557e14){return _0x100c4c[_0x15ba('0xb')](_0x15ba('0xc'),attributes,{'tableName':_0x15ba('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bab=['moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger','api'];(function(_0x373516,_0x52f67e){var _0x745a3f=function(_0x14c3b7){while(--_0x14c3b7){_0x373516['push'](_0x373516['shift']());}};_0x745a3f(++_0x52f67e);}(_0x1bab,0x122));var _0xb1ba=function(_0x1f510f,_0x3c6858){_0x1f510f=_0x1f510f-0x0;var _0x1400b5=_0x1bab[_0x1f510f];return _0x1400b5;};'use strict';var _=require(_0xb1ba('0x0'));var util=require(_0xb1ba('0x1'));var logger=require(_0xb1ba('0x2'))(_0xb1ba('0x3'));var moment=require(_0xb1ba('0x4'));var BPromise=require(_0xb1ba('0x5'));var rp=require(_0xb1ba('0x6'));var fs=require('fs');var path=require(_0xb1ba('0x7'));var rimraf=require(_0xb1ba('0x8'));var config=require(_0xb1ba('0x9'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xb1ba('0xa'));module['exports']=function(_0x24dec3,_0x14a0ad){return _0x24dec3[_0xb1ba('0xb')](_0xb1ba('0xc'),attributes,{'tableName':_0xb1ba('0xd'),'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 8108ffd..e431a8a 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 _0x8530=['moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','limit','map','include','model','attributes','then','GetFreshdeskAccount','ShowFreshdeskAccount','where','lodash','util'];(function(_0x28d624,_0xbf2056){var _0x198bc7=function(_0x67bf81){while(--_0x67bf81){_0x28d624['push'](_0x28d624['shift']());}};_0x198bc7(++_0xbf2056);}(_0x8530,0x1ae));var _0x0853=function(_0x1abf76,_0x5112c1){_0x1abf76=_0x1abf76-0x0;var _0x5e6837=_0x8530[_0x1abf76];return _0x5e6837;};'use strict';var _=require(_0x0853('0x0'));var util=require(_0x0853('0x1'));var moment=require(_0x0853('0x2'));var BPromise=require('bluebird');var rs=require(_0x0853('0x3'));var fs=require('fs');var Redis=require(_0x0853('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0853('0x5'));var logger=require(_0x0853('0x6'))('rpc');var config=require(_0x0853('0x7'));var jayson=require(_0x0853('0x8'));var client=jayson[_0x0853('0x9')][_0x0853('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34899b,_0x1f6168,_0x16fa40){return new BPromise(function(_0xfc0790,_0x4da1de){return client[_0x0853('0xb')](_0x34899b,_0x16fa40)['then'](function(_0x4d9516){logger[_0x0853('0xc')](_0x0853('0xd'),_0x1f6168,_0x0853('0xe'));logger[_0x0853('0xf')](_0x0853('0x10'),_0x1f6168,'request\x20sent',JSON[_0x0853('0x11')](_0x4d9516));if(_0x4d9516[_0x0853('0x12')]){if(_0x4d9516[_0x0853('0x12')][_0x0853('0x13')]===0x1f4){logger[_0x0853('0x12')](_0x0853('0xd'),_0x1f6168,_0x4d9516[_0x0853('0x12')][_0x0853('0x14')]);return _0x4da1de(_0x4d9516[_0x0853('0x12')][_0x0853('0x14')]);}logger[_0x0853('0x12')](_0x0853('0xd'),_0x1f6168,_0x4d9516[_0x0853('0x12')]['message']);return _0xfc0790(_0x4d9516[_0x0853('0x12')]['message']);}else{logger[_0x0853('0xc')](_0x0853('0xd'),_0x1f6168,'request\x20sent');_0xfc0790(_0x4d9516[_0x0853('0x15')][_0x0853('0x14')]);}})[_0x0853('0x16')](function(_0x4d2812){logger[_0x0853('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x1f6168,_0x4d2812);_0x4da1de(_0x4d2812);});});}exports['GetFreshdeskAccount']=function(_0x40bdef){var _0x4e64c4=this;return new Promise(function(_0x4de6e9,_0x191599){return db[_0x0853('0x17')][_0x0853('0x18')]({'raw':_0x40bdef[_0x0853('0x19')]?_0x40bdef[_0x0853('0x19')][_0x0853('0x1a')]===undefined?!![]:![]:!![],'where':_0x40bdef[_0x0853('0x19')]?_0x40bdef[_0x0853('0x19')]['where']||null:null,'attributes':_0x40bdef[_0x0853('0x19')]?_0x40bdef['options']['attributes']||null:null,'limit':_0x40bdef[_0x0853('0x19')]?_0x40bdef[_0x0853('0x19')][_0x0853('0x1b')]||null:null,'include':_0x40bdef[_0x0853('0x19')]?_0x40bdef[_0x0853('0x19')]['include']?_[_0x0853('0x1c')](_0x40bdef['options'][_0x0853('0x1d')],function(_0x51e0bd){return{'model':db[_0x51e0bd[_0x0853('0x1e')]],'as':_0x51e0bd['as'],'attributes':_0x51e0bd[_0x0853('0x1f')],'include':_0x51e0bd[_0x0853('0x1d')]?_[_0x0853('0x1c')](_0x51e0bd[_0x0853('0x1d')],function(_0x2d12e9){return{'model':db[_0x2d12e9[_0x0853('0x1e')]],'as':_0x2d12e9['as'],'attributes':_0x2d12e9['attributes'],'include':_0x2d12e9['include']?_[_0x0853('0x1c')](_0x2d12e9[_0x0853('0x1d')],function(_0x102f47){return{'model':db[_0x102f47[_0x0853('0x1e')]],'as':_0x102f47['as'],'attributes':_0x102f47['attributes']};}):[]};}):[]};}):[]:[]})[_0x0853('0x20')](function(_0x3596dc){logger[_0x0853('0xc')](_0x0853('0x21'),_0x40bdef);logger[_0x0853('0xf')](_0x0853('0x21'),_0x40bdef,JSON[_0x0853('0x11')](_0x3596dc));_0x4de6e9(_0x3596dc);})[_0x0853('0x16')](function(_0x4bb23c){logger[_0x0853('0x12')]('GetFreshdeskAccount',_0x4bb23c[_0x0853('0x14')],_0x40bdef);_0x191599(_0x4e64c4[_0x0853('0x12')](0x1f4,_0x4bb23c['message']));});});};exports[_0x0853('0x22')]=function(_0x23369f){var _0x68a96b=this;return new Promise(function(_0x505b6c,_0x3e3adb){return db[_0x0853('0x17')]['find']({'raw':_0x23369f[_0x0853('0x19')]?_0x23369f[_0x0853('0x19')][_0x0853('0x1a')]===undefined?!![]:![]:!![],'where':_0x23369f['options']?_0x23369f[_0x0853('0x19')][_0x0853('0x23')]||null:null,'attributes':_0x23369f[_0x0853('0x19')]?_0x23369f['options'][_0x0853('0x1f')]||null:null,'include':_0x23369f[_0x0853('0x19')]?_0x23369f['options']['include']?_['map'](_0x23369f[_0x0853('0x19')][_0x0853('0x1d')],function(_0x51c04d){return{'model':db[_0x51c04d['model']],'as':_0x51c04d['as'],'attributes':_0x51c04d[_0x0853('0x1f')],'include':_0x51c04d[_0x0853('0x1d')]?_[_0x0853('0x1c')](_0x51c04d[_0x0853('0x1d')],function(_0x27d0de){return{'model':db[_0x27d0de[_0x0853('0x1e')]],'as':_0x27d0de['as'],'attributes':_0x27d0de[_0x0853('0x1f')],'include':_0x27d0de[_0x0853('0x1d')]?_[_0x0853('0x1c')](_0x27d0de[_0x0853('0x1d')],function(_0x460b86){return{'model':db[_0x460b86[_0x0853('0x1e')]],'as':_0x460b86['as'],'attributes':_0x460b86[_0x0853('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0853('0x20')](function(_0x15f5d5){logger['info'](_0x0853('0x22'),_0x23369f);logger[_0x0853('0xf')]('ShowFreshdeskAccount',_0x23369f,JSON[_0x0853('0x11')](_0x15f5d5));_0x505b6c(_0x15f5d5);})[_0x0853('0x16')](function(_0x16b842){logger[_0x0853('0x12')]('ShowFreshdeskAccount',_0x16b842[_0x0853('0x14')],_0x23369f);_0x3e3adb(_0x68a96b['error'](0x1f4,_0x16b842['message']));});});}; \ No newline at end of file +var _0x0902=['FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','attributes','include','map','model','ShowFreshdeskAccount','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0902,0xaf));var _0x2090=function(_0x26ecab,_0x574afc){_0x26ecab=_0x26ecab-0x0;var _0x168cd2=_0x0902[_0x26ecab];return _0x168cd2;};'use strict';var _=require(_0x2090('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2090('0x1'));var rs=require(_0x2090('0x2'));var fs=require('fs');var Redis=require(_0x2090('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x2090('0x4'));var logger=require('../../config/logger')(_0x2090('0x5'));var config=require('../../config/environment');var jayson=require(_0x2090('0x6'));var client=jayson[_0x2090('0x7')][_0x2090('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5a11e4,_0x56eb2f,_0x1bbde3){return new BPromise(function(_0x55851d,_0x55a499){return client['request'](_0x5a11e4,_0x1bbde3)[_0x2090('0x9')](function(_0x443d46){logger[_0x2090('0xa')](_0x2090('0xb'),_0x56eb2f,_0x2090('0xc'));logger[_0x2090('0xd')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x56eb2f,_0x2090('0xc'),JSON[_0x2090('0xe')](_0x443d46));if(_0x443d46[_0x2090('0xf')]){if(_0x443d46[_0x2090('0xf')][_0x2090('0x10')]===0x1f4){logger[_0x2090('0xf')](_0x2090('0xb'),_0x56eb2f,_0x443d46[_0x2090('0xf')][_0x2090('0x11')]);return _0x55a499(_0x443d46[_0x2090('0xf')]['message']);}logger[_0x2090('0xf')]('FreshdeskAccount,\x20%s,\x20%s',_0x56eb2f,_0x443d46[_0x2090('0xf')]['message']);return _0x55851d(_0x443d46[_0x2090('0xf')][_0x2090('0x11')]);}else{logger[_0x2090('0xa')](_0x2090('0xb'),_0x56eb2f,'request\x20sent');_0x55851d(_0x443d46[_0x2090('0x12')][_0x2090('0x11')]);}})[_0x2090('0x13')](function(_0x1e7255){logger[_0x2090('0xf')](_0x2090('0xb'),_0x56eb2f,_0x1e7255);_0x55a499(_0x1e7255);});});}exports[_0x2090('0x14')]=function(_0x3ae762){var _0x58615d=this;return new Promise(function(_0x580e42,_0x167eee){return db[_0x2090('0x15')][_0x2090('0x16')]({'raw':_0x3ae762['options']?_0x3ae762[_0x2090('0x17')][_0x2090('0x18')]===undefined?!![]:![]:!![],'where':_0x3ae762[_0x2090('0x17')]?_0x3ae762[_0x2090('0x17')][_0x2090('0x19')]||null:null,'attributes':_0x3ae762[_0x2090('0x17')]?_0x3ae762['options'][_0x2090('0x1a')]||null:null,'limit':_0x3ae762[_0x2090('0x17')]?_0x3ae762[_0x2090('0x17')]['limit']||null:null,'include':_0x3ae762[_0x2090('0x17')]?_0x3ae762[_0x2090('0x17')][_0x2090('0x1b')]?_[_0x2090('0x1c')](_0x3ae762[_0x2090('0x17')][_0x2090('0x1b')],function(_0x554c0a){return{'model':db[_0x554c0a[_0x2090('0x1d')]],'as':_0x554c0a['as'],'attributes':_0x554c0a[_0x2090('0x1a')],'include':_0x554c0a[_0x2090('0x1b')]?_[_0x2090('0x1c')](_0x554c0a[_0x2090('0x1b')],function(_0xe614e){return{'model':db[_0xe614e[_0x2090('0x1d')]],'as':_0xe614e['as'],'attributes':_0xe614e[_0x2090('0x1a')],'include':_0xe614e[_0x2090('0x1b')]?_[_0x2090('0x1c')](_0xe614e['include'],function(_0x332dc1){return{'model':db[_0x332dc1['model']],'as':_0x332dc1['as'],'attributes':_0x332dc1[_0x2090('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x2090('0x9')](function(_0x5de4ac){logger['info'](_0x2090('0x14'),_0x3ae762);logger[_0x2090('0xd')](_0x2090('0x14'),_0x3ae762,JSON[_0x2090('0xe')](_0x5de4ac));_0x580e42(_0x5de4ac);})[_0x2090('0x13')](function(_0x949b92){logger[_0x2090('0xf')](_0x2090('0x14'),_0x949b92[_0x2090('0x11')],_0x3ae762);_0x167eee(_0x58615d['error'](0x1f4,_0x949b92[_0x2090('0x11')]));});});};exports['ShowFreshdeskAccount']=function(_0x203ce1){var _0x219df7=this;return new Promise(function(_0x151627,_0x1f838f){return db['FreshdeskAccount']['find']({'raw':_0x203ce1[_0x2090('0x17')]?_0x203ce1[_0x2090('0x17')][_0x2090('0x18')]===undefined?!![]:![]:!![],'where':_0x203ce1[_0x2090('0x17')]?_0x203ce1['options'][_0x2090('0x19')]||null:null,'attributes':_0x203ce1[_0x2090('0x17')]?_0x203ce1[_0x2090('0x17')][_0x2090('0x1a')]||null:null,'include':_0x203ce1[_0x2090('0x17')]?_0x203ce1['options']['include']?_[_0x2090('0x1c')](_0x203ce1[_0x2090('0x17')][_0x2090('0x1b')],function(_0x12ad06){return{'model':db[_0x12ad06[_0x2090('0x1d')]],'as':_0x12ad06['as'],'attributes':_0x12ad06[_0x2090('0x1a')],'include':_0x12ad06[_0x2090('0x1b')]?_[_0x2090('0x1c')](_0x12ad06[_0x2090('0x1b')],function(_0x90438){return{'model':db[_0x90438[_0x2090('0x1d')]],'as':_0x90438['as'],'attributes':_0x90438[_0x2090('0x1a')],'include':_0x90438['include']?_[_0x2090('0x1c')](_0x90438[_0x2090('0x1b')],function(_0x30e2e8){return{'model':db[_0x30e2e8[_0x2090('0x1d')]],'as':_0x30e2e8['as'],'attributes':_0x30e2e8['attributes']};}):[]};}):[]};}):[]:[]})[_0x2090('0x9')](function(_0x3ba854){logger[_0x2090('0xa')](_0x2090('0x1e'),_0x203ce1);logger[_0x2090('0xd')]('ShowFreshdeskAccount',_0x203ce1,JSON[_0x2090('0xe')](_0x3ba854));_0x151627(_0x3ba854);})[_0x2090('0x13')](function(_0x2f76ad){logger[_0x2090('0xf')]('ShowFreshdeskAccount',_0x2f76ad[_0x2090('0x11')],_0x203ce1);_0x1f838f(_0x219df7[_0x2090('0xf')](0x1f4,_0x2f76ad[_0x2090('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 3b7a5b0..51f4d89 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 _0x12ae=['delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','create','post','setTags','update'];(function(_0x57a98d,_0x472f08){var _0x553630=function(_0x542b76){while(--_0x542b76){_0x57a98d['push'](_0x57a98d['shift']());}};_0x553630(++_0x472f08);}(_0x12ae,0x17d));var _0xe12a=function(_0x2aa0e6,_0x4880fa){_0x2aa0e6=_0x2aa0e6-0x0;var _0x2e45ff=_0x12ae[_0x2aa0e6];return _0x2e45ff;};'use strict';var multer=require(_0xe12a('0x0'));var util=require(_0xe12a('0x1'));var path=require(_0xe12a('0x2'));var timeout=require(_0xe12a('0x3'));var express=require(_0xe12a('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe12a('0x5'));var config=require(_0xe12a('0x6'));var controller=require(_0xe12a('0x7'));router['get']('/',auth[_0xe12a('0x8')](),controller[_0xe12a('0x9')]);router[_0xe12a('0xa')](_0xe12a('0xb'),auth['isAuthenticated'](),controller[_0xe12a('0xc')]);router[_0xe12a('0xa')](_0xe12a('0xd'),auth[_0xe12a('0x8')](),controller[_0xe12a('0xe')]);router[_0xe12a('0xa')](_0xe12a('0xf'),auth[_0xe12a('0x8')](),controller[_0xe12a('0x10')]);router[_0xe12a('0xa')]('/:id/descriptions',auth[_0xe12a('0x8')](),controller[_0xe12a('0x11')]);router[_0xe12a('0xa')](_0xe12a('0x12'),auth[_0xe12a('0x8')](),controller[_0xe12a('0x13')]);router['post']('/',auth[_0xe12a('0x8')](),controller[_0xe12a('0x14')]);router[_0xe12a('0x15')](_0xe12a('0x12'),auth[_0xe12a('0x8')](),controller[_0xe12a('0x16')]);router['put'](_0xe12a('0xb'),auth['isAuthenticated'](),controller[_0xe12a('0x17')]);router[_0xe12a('0x18')](_0xe12a('0xb'),auth[_0xe12a('0x8')](),controller[_0xe12a('0x19')]);module[_0xe12a('0x1a')]=router; \ No newline at end of file +var _0x37b9=['/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show'];(function(_0x322f92,_0x11a209){var _0x1a42ee=function(_0x49f740){while(--_0x49f740){_0x322f92['push'](_0x322f92['shift']());}};_0x1a42ee(++_0x11a209);}(_0x37b9,0x1bd));var _0x937b=function(_0x5a4400,_0xfae3b6){_0x5a4400=_0x5a4400-0x0;var _0xf9b532=_0x37b9[_0x5a4400];return _0xf9b532;};'use strict';var multer=require(_0x937b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x937b('0x1'));var express=require(_0x937b('0x2'));var router=express['Router']();var fs_extra=require(_0x937b('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x937b('0x4'));var config=require(_0x937b('0x5'));var controller=require(_0x937b('0x6'));router[_0x937b('0x7')]('/',auth[_0x937b('0x8')](),controller['index']);router[_0x937b('0x7')](_0x937b('0x9'),auth[_0x937b('0x8')](),controller[_0x937b('0xa')]);router[_0x937b('0x7')](_0x937b('0xb'),auth[_0x937b('0x8')](),controller[_0x937b('0xc')]);router['get']('/:id/subjects',auth[_0x937b('0x8')](),controller[_0x937b('0xd')]);router[_0x937b('0x7')](_0x937b('0xe'),auth[_0x937b('0x8')](),controller[_0x937b('0xf')]);router['get'](_0x937b('0x10'),auth[_0x937b('0x8')](),controller[_0x937b('0x11')]);router[_0x937b('0x12')]('/',auth['isAuthenticated'](),controller[_0x937b('0x13')]);router[_0x937b('0x12')](_0x937b('0x10'),auth[_0x937b('0x8')](),controller[_0x937b('0x14')]);router[_0x937b('0x15')](_0x937b('0x9'),auth[_0x937b('0x8')](),controller['update']);router[_0x937b('0x16')](_0x937b('0x9'),auth[_0x937b('0x8')](),controller[_0x937b('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 275960b..ab0790d 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. * // * * // ************************************************************************* -var _0x5375=['exports','STRING'];(function(_0x59803f,_0x4c9f86){var _0x22929d=function(_0x24e1ce){while(--_0x24e1ce){_0x59803f['push'](_0x59803f['shift']());}};_0x22929d(++_0x4c9f86);}(_0x5375,0x17c));var _0x5537=function(_0x3a905d,_0x1ca0d6){_0x3a905d=_0x3a905d-0x0;var _0x4889cd=_0x5375[_0x3a905d];return _0x4889cd;};'use strict';var Sequelize=require('sequelize');module[_0x5537('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5537('0x1')]}}; \ No newline at end of file +var _0x1a35=['sequelize','exports','STRING'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1a35,0xc6));var _0x51a3=function(_0x2877fd,_0x221e60){_0x2877fd=_0x2877fd-0x0;var _0x4c0501=_0x1a35[_0x2877fd];return _0x4c0501;};'use strict';var Sequelize=require(_0x51a3('0x0'));module[_0x51a3('0x1')]={'name':{'type':Sequelize[_0x51a3('0x2')]},'description':{'type':Sequelize[_0x51a3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index c29d3eb..67831cc 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 _0xf4ee=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','set','apply','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','offset','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','FreshdeskConfiguration','include','findAll','rows','catch','show','keys','includeAll','find','create','body','params','getFields','FreshdeskField','findOne','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf4ee,0x146));var _0xef4e=function(_0x1434e6,_0x31ba96){_0x1434e6=_0x1434e6-0x0;var _0x2866ee=_0xf4ee[_0x1434e6];return _0x2866ee;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xef4e('0x0'));var zipdir=require(_0xef4e('0x1'));var jsonpatch=require(_0xef4e('0x2'));var rp=require(_0xef4e('0x3'));var moment=require(_0xef4e('0x4'));var BPromise=require(_0xef4e('0x5'));var Mustache=require(_0xef4e('0x6'));var util=require('util');var path=require(_0xef4e('0x7'));var sox=require('sox');var csv=require(_0xef4e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xef4e('0x9'));var _=require(_0xef4e('0xa'));var squel=require(_0xef4e('0xb'));var crypto=require(_0xef4e('0xc'));var jsforce=require(_0xef4e('0xd'));var deskjs=require(_0xef4e('0xe'));var toCsv=require(_0xef4e('0x8'));var querystring=require(_0xef4e('0xf'));var Papa=require(_0xef4e('0x10'));var Redis=require('ioredis');var authService=require(_0xef4e('0x11'));var qs=require(_0xef4e('0x12'));var as=require(_0xef4e('0x13'));var hardwareService=require(_0xef4e('0x14'));var logger=require(_0xef4e('0x15'))(_0xef4e('0x16'));var utils=require(_0xef4e('0x17'));var config=require(_0xef4e('0x18'));var licenseUtil=require(_0xef4e('0x19'));var db=require(_0xef4e('0x1a'))['db'];function respondWithStatusCode(_0x58edc5,_0xbf651a){_0xbf651a=_0xbf651a||0xcc;return function(_0x284428){if(_0x284428){return _0x58edc5[_0xef4e('0x1b')](_0xbf651a);}return _0x58edc5[_0xef4e('0x1c')](_0xbf651a)[_0xef4e('0x1d')]();};}function respondWithResult(_0x59b2f7,_0x190a43){_0x190a43=_0x190a43||0xc8;return function(_0x510d99){if(_0x510d99){return _0x59b2f7[_0xef4e('0x1c')](_0x190a43)[_0xef4e('0x1e')](_0x510d99);}};}function respondWithFilteredResult(_0xc4b9ba,_0x5dce04){return function(_0x47c69a){if(_0x47c69a){var _0x474436=typeof _0x5dce04['offset']==='undefined'&&typeof _0x5dce04[_0xef4e('0x1f')]===_0xef4e('0x20');var _0x4c0e76=_0x47c69a[_0xef4e('0x21')];var _0x203dbb=_0x474436?0x0:_0x5dce04['offset'];var _0x49bd42=_0x474436?_0x47c69a[_0xef4e('0x21')]:_0x5dce04['offset']+_0x5dce04[_0xef4e('0x1f')];var _0xd5d5d4;if(_0x49bd42>=_0x4c0e76){_0x49bd42=_0x4c0e76;_0xd5d5d4=0xc8;}else{_0xd5d5d4=0xce;}_0xc4b9ba[_0xef4e('0x1c')](_0xd5d5d4);return _0xc4b9ba[_0xef4e('0x22')]('Content-Range',_0x203dbb+'-'+_0x49bd42+'/'+_0x4c0e76)['json'](_0x47c69a);}return null;};}function patchUpdates(_0x966d97){return function(_0x4e1ce6){try{jsonpatch[_0xef4e('0x23')](_0x4e1ce6,_0x966d97,!![]);}catch(_0x186c6a){return BPromise[_0xef4e('0x24')](_0x186c6a);}return _0x4e1ce6[_0xef4e('0x25')]();};}function saveUpdates(_0x303ca0,_0x401e3e){return function(_0x48ada1){if(_0x48ada1){return _0x48ada1[_0xef4e('0x26')](_0x303ca0)[_0xef4e('0x27')](function(_0x4e0206){return _0x4e0206;});}return null;};}function removeEntity(_0x20c12c,_0x5eadcb){return function(_0x1aa0b0){if(_0x1aa0b0){return _0x1aa0b0['destroy']()[_0xef4e('0x27')](function(){_0x20c12c[_0xef4e('0x1c')](0xcc)[_0xef4e('0x1d')]();});}};}function handleEntityNotFound(_0x2424a5,_0xe986b8){return function(_0x3d6d0f){if(!_0x3d6d0f){_0x2424a5['sendStatus'](0x194);}return _0x3d6d0f;};}function handleError(_0x78e85c,_0x4171){_0x4171=_0x4171||0x1f4;return function(_0x4a69c9){logger['error'](_0x4a69c9[_0xef4e('0x28')]);if(_0x4a69c9[_0xef4e('0x29')]){delete _0x4a69c9[_0xef4e('0x29')];}_0x78e85c['status'](_0x4171)[_0xef4e('0x2a')](_0x4a69c9);};}exports[_0xef4e('0x2b')]=function(_0x1f1233,_0x1b26f1){var _0x127850={},_0x3b2e60={},_0x39013e={'count':0x0,'rows':[]};var _0x2f6fd9=_[_0xef4e('0x2c')](db['FreshdeskConfiguration'][_0xef4e('0x2d')],function(_0x187764){return{'name':_0x187764[_0xef4e('0x2e')],'type':_0x187764[_0xef4e('0x2f')][_0xef4e('0x30')]};});_0x3b2e60[_0xef4e('0x31')]=_[_0xef4e('0x2c')](_0x2f6fd9,_0xef4e('0x29'));_0x3b2e60['query']=_['keys'](_0x1f1233[_0xef4e('0x32')]);_0x3b2e60['filters']=_['intersection'](_0x3b2e60[_0xef4e('0x31')],_0x3b2e60[_0xef4e('0x32')]);_0x127850['attributes']=_[_0xef4e('0x33')](_0x3b2e60[_0xef4e('0x31')],qs[_0xef4e('0x34')](_0x1f1233[_0xef4e('0x32')][_0xef4e('0x34')]));_0x127850[_0xef4e('0x35')]=_0x127850[_0xef4e('0x35')][_0xef4e('0x36')]?_0x127850[_0xef4e('0x35')]:_0x3b2e60[_0xef4e('0x31')];if(!_0x1f1233['query'][_0xef4e('0x37')](_0xef4e('0x38'))){_0x127850['limit']=qs[_0xef4e('0x1f')](_0x1f1233[_0xef4e('0x32')][_0xef4e('0x1f')]);_0x127850['offset']=qs[_0xef4e('0x39')](_0x1f1233[_0xef4e('0x32')][_0xef4e('0x39')]);}_0x127850[_0xef4e('0x3a')]=qs[_0xef4e('0x3b')](_0x1f1233['query']['sort']);_0x127850[_0xef4e('0x3c')]=qs[_0xef4e('0x3d')](_[_0xef4e('0x3e')](_0x1f1233[_0xef4e('0x32')],_0x3b2e60[_0xef4e('0x3d')]),_0x2f6fd9);if(_0x1f1233[_0xef4e('0x32')][_0xef4e('0x3f')]){_0x127850[_0xef4e('0x3c')]=_['merge'](_0x127850[_0xef4e('0x3c')],{'$or':_['map'](_0x2f6fd9,function(_0x35d7e5){if(_0x35d7e5[_0xef4e('0x2f')]!==_0xef4e('0x40')){var _0xf50201={};_0xf50201[_0x35d7e5[_0xef4e('0x29')]]={'$like':'%'+_0x1f1233['query'][_0xef4e('0x3f')]+'%'};return _0xf50201;}})});}_0x127850=_[_0xef4e('0x41')]({},_0x127850,_0x1f1233[_0xef4e('0x42')]);var _0x187331={'where':_0x127850[_0xef4e('0x3c')]};return db[_0xef4e('0x43')][_0xef4e('0x21')](_0x187331)[_0xef4e('0x27')](function(_0x5928f5){_0x39013e[_0xef4e('0x21')]=_0x5928f5;if(_0x1f1233[_0xef4e('0x32')]['includeAll']){_0x127850[_0xef4e('0x44')]=[{'all':!![]}];}return db['FreshdeskConfiguration'][_0xef4e('0x45')](_0x127850);})[_0xef4e('0x27')](function(_0x3110fa){_0x39013e[_0xef4e('0x46')]=_0x3110fa;return _0x39013e;})[_0xef4e('0x27')](respondWithFilteredResult(_0x1b26f1,_0x127850))[_0xef4e('0x47')](handleError(_0x1b26f1,null));};exports[_0xef4e('0x48')]=function(_0x36f74c,_0x3ab48e){var _0x5e0f8a={'raw':![],'where':{'id':_0x36f74c['params']['id']}},_0xb4c87={};_0xb4c87['model']=_[_0xef4e('0x49')](db[_0xef4e('0x43')][_0xef4e('0x2d')]);_0xb4c87['query']=_[_0xef4e('0x49')](_0x36f74c['query']);_0xb4c87[_0xef4e('0x3d')]=_[_0xef4e('0x33')](_0xb4c87['model'],_0xb4c87[_0xef4e('0x32')]);_0x5e0f8a[_0xef4e('0x35')]=_['intersection'](_0xb4c87[_0xef4e('0x31')],qs['fields'](_0x36f74c['query'][_0xef4e('0x34')]));_0x5e0f8a[_0xef4e('0x35')]=_0x5e0f8a[_0xef4e('0x35')][_0xef4e('0x36')]?_0x5e0f8a[_0xef4e('0x35')]:_0xb4c87[_0xef4e('0x31')];if(_0x36f74c[_0xef4e('0x32')][_0xef4e('0x4a')]){_0x5e0f8a[_0xef4e('0x44')]=[{'all':!![]}];}_0x5e0f8a=_[_0xef4e('0x41')]({},_0x5e0f8a,_0x36f74c[_0xef4e('0x42')]);return db[_0xef4e('0x43')][_0xef4e('0x4b')](_0x5e0f8a)[_0xef4e('0x27')](handleEntityNotFound(_0x3ab48e,null))[_0xef4e('0x27')](respondWithResult(_0x3ab48e,null))['catch'](handleError(_0x3ab48e,null));};exports[_0xef4e('0x4c')]=function(_0x1b09b9,_0x4bfbac){return db['FreshdeskConfiguration'][_0xef4e('0x4c')](_0x1b09b9[_0xef4e('0x4d')],{})[_0xef4e('0x27')](respondWithResult(_0x4bfbac,0xc9))[_0xef4e('0x47')](handleError(_0x4bfbac,null));};exports['update']=function(_0x54c3fb,_0x3b3076){if(_0x54c3fb[_0xef4e('0x4d')]['id']){delete _0x54c3fb['body']['id'];}return db[_0xef4e('0x43')][_0xef4e('0x4b')]({'where':{'id':_0x54c3fb['params']['id']}})[_0xef4e('0x27')](handleEntityNotFound(_0x3b3076,null))[_0xef4e('0x27')](saveUpdates(_0x54c3fb['body'],null))[_0xef4e('0x27')](respondWithResult(_0x3b3076,null))['catch'](handleError(_0x3b3076,null));};exports['destroy']=function(_0x62c091,_0x1a50c5){return db[_0xef4e('0x43')][_0xef4e('0x4b')]({'where':{'id':_0x62c091[_0xef4e('0x4e')]['id']}})[_0xef4e('0x27')](handleEntityNotFound(_0x1a50c5,null))[_0xef4e('0x27')](removeEntity(_0x1a50c5,null))[_0xef4e('0x47')](handleError(_0x1a50c5,null));};exports[_0xef4e('0x4f')]=function(_0x25dc35,_0xab8c88,_0x37ee30){var _0x16f407={};var _0x1d692c={};var _0x94c406;var _0x5cddcc;return db[_0xef4e('0x43')]['findOne']({'where':{'id':_0x25dc35[_0xef4e('0x4e')]['id']}})['then'](handleEntityNotFound(_0xab8c88,null))[_0xef4e('0x27')](function(_0x36bcb0){if(_0x36bcb0){_0x94c406=_0x36bcb0;_0x1d692c[_0xef4e('0x31')]=_[_0xef4e('0x49')](db[_0xef4e('0x50')]['rawAttributes']);_0x1d692c[_0xef4e('0x32')]=_[_0xef4e('0x49')](_0x25dc35['query']);_0x1d692c['filters']=_['intersection'](_0x1d692c[_0xef4e('0x31')],_0x1d692c[_0xef4e('0x32')]);_0x16f407[_0xef4e('0x35')]=_['intersection'](_0x1d692c[_0xef4e('0x31')],qs[_0xef4e('0x34')](_0x25dc35['query']['fields']));_0x16f407[_0xef4e('0x35')]=_0x16f407[_0xef4e('0x35')][_0xef4e('0x36')]?_0x16f407[_0xef4e('0x35')]:_0x1d692c[_0xef4e('0x31')];_0x16f407[_0xef4e('0x3a')]=qs[_0xef4e('0x3b')](_0x25dc35['query'][_0xef4e('0x3b')]);_0x16f407['where']=qs[_0xef4e('0x3d')](_['pick'](_0x25dc35[_0xef4e('0x32')],_0x1d692c['filters']));if(_0x25dc35[_0xef4e('0x32')]['filter']){_0x16f407[_0xef4e('0x3c')]=_[_0xef4e('0x41')](_0x16f407[_0xef4e('0x3c')],{'$or':_[_0xef4e('0x2c')](_0x16f407[_0xef4e('0x35')],function(_0x74faf0){var _0x3482f9={};_0x3482f9[_0x74faf0]={'$like':'%'+_0x25dc35[_0xef4e('0x32')][_0xef4e('0x3f')]+'%'};return _0x3482f9;})});}_0x16f407=_[_0xef4e('0x41')]({},_0x16f407,_0x25dc35[_0xef4e('0x42')]);return _0x94c406[_0xef4e('0x4f')](_0x16f407);}})[_0xef4e('0x27')](function(_0x48d497){if(_0x48d497){_0x5cddcc=_0x48d497[_0xef4e('0x36')];if(!_0x25dc35[_0xef4e('0x32')][_0xef4e('0x37')](_0xef4e('0x38'))){_0x16f407['limit']=qs[_0xef4e('0x1f')](_0x25dc35[_0xef4e('0x32')][_0xef4e('0x1f')]);_0x16f407[_0xef4e('0x39')]=qs['offset'](_0x25dc35[_0xef4e('0x32')]['offset']);}return _0x94c406[_0xef4e('0x4f')](_0x16f407);}})[_0xef4e('0x27')](function(_0x54c0c5){if(_0x54c0c5){return _0x54c0c5?{'count':_0x5cddcc,'rows':_0x54c0c5}:null;}})[_0xef4e('0x27')](respondWithResult(_0xab8c88,null))[_0xef4e('0x47')](handleError(_0xab8c88,null));};exports['getSubjects']=function(_0x30ef9e,_0xda720c,_0x2be7a8){var _0x32be12={};var _0x59e9ff={};var _0x2b0ff5;var _0x5b6ee0;return db['FreshdeskConfiguration'][_0xef4e('0x51')]({'where':{'id':_0x30ef9e[_0xef4e('0x4e')]['id']}})[_0xef4e('0x27')](handleEntityNotFound(_0xda720c,null))[_0xef4e('0x27')](function(_0x4aab4b){if(_0x4aab4b){_0x2b0ff5=_0x4aab4b;_0x59e9ff[_0xef4e('0x31')]=_[_0xef4e('0x49')](db['FreshdeskField'][_0xef4e('0x2d')]);_0x59e9ff[_0xef4e('0x32')]=_[_0xef4e('0x49')](_0x30ef9e['query']);_0x59e9ff['filters']=_[_0xef4e('0x33')](_0x59e9ff[_0xef4e('0x31')],_0x59e9ff['query']);_0x32be12['attributes']=_[_0xef4e('0x33')](_0x59e9ff[_0xef4e('0x31')],qs[_0xef4e('0x34')](_0x30ef9e[_0xef4e('0x32')][_0xef4e('0x34')]));_0x32be12[_0xef4e('0x35')]=_0x32be12[_0xef4e('0x35')][_0xef4e('0x36')]?_0x32be12[_0xef4e('0x35')]:_0x59e9ff[_0xef4e('0x31')];_0x32be12[_0xef4e('0x3a')]=qs[_0xef4e('0x3b')](_0x30ef9e[_0xef4e('0x32')][_0xef4e('0x3b')]);_0x32be12['where']=qs[_0xef4e('0x3d')](_[_0xef4e('0x3e')](_0x30ef9e[_0xef4e('0x32')],_0x59e9ff[_0xef4e('0x3d')]));if(_0x30ef9e[_0xef4e('0x32')][_0xef4e('0x3f')]){_0x32be12[_0xef4e('0x3c')]=_['merge'](_0x32be12['where'],{'$or':_[_0xef4e('0x2c')](_0x32be12[_0xef4e('0x35')],function(_0x275152){var _0x69291d={};_0x69291d[_0x275152]={'$like':'%'+_0x30ef9e['query']['filter']+'%'};return _0x69291d;})});}_0x32be12=_[_0xef4e('0x41')]({},_0x32be12,_0x30ef9e[_0xef4e('0x42')]);return _0x2b0ff5[_0xef4e('0x52')](_0x32be12);}})[_0xef4e('0x27')](function(_0x178636){if(_0x178636){_0x5b6ee0=_0x178636['length'];if(!_0x30ef9e[_0xef4e('0x32')][_0xef4e('0x37')](_0xef4e('0x38'))){_0x32be12['limit']=qs[_0xef4e('0x1f')](_0x30ef9e[_0xef4e('0x32')][_0xef4e('0x1f')]);_0x32be12[_0xef4e('0x39')]=qs[_0xef4e('0x39')](_0x30ef9e[_0xef4e('0x32')][_0xef4e('0x39')]);}return _0x2b0ff5[_0xef4e('0x52')](_0x32be12);}})[_0xef4e('0x27')](function(_0x5a77c0){if(_0x5a77c0){return _0x5a77c0?{'count':_0x5b6ee0,'rows':_0x5a77c0}:null;}})[_0xef4e('0x27')](respondWithResult(_0xda720c,null))[_0xef4e('0x47')](handleError(_0xda720c,null));};exports[_0xef4e('0x53')]=function(_0x25ff54,_0x26d28c,_0x30b4c8){var _0x16ff0d={};var _0x46aac4={};var _0x38b406;var _0x276fda;return db['FreshdeskConfiguration'][_0xef4e('0x51')]({'where':{'id':_0x25ff54['params']['id']}})[_0xef4e('0x27')](handleEntityNotFound(_0x26d28c,null))[_0xef4e('0x27')](function(_0xf3c631){if(_0xf3c631){_0x38b406=_0xf3c631;_0x46aac4[_0xef4e('0x31')]=_['keys'](db[_0xef4e('0x50')][_0xef4e('0x2d')]);_0x46aac4[_0xef4e('0x32')]=_['keys'](_0x25ff54[_0xef4e('0x32')]);_0x46aac4[_0xef4e('0x3d')]=_[_0xef4e('0x33')](_0x46aac4['model'],_0x46aac4['query']);_0x16ff0d['attributes']=_[_0xef4e('0x33')](_0x46aac4[_0xef4e('0x31')],qs[_0xef4e('0x34')](_0x25ff54[_0xef4e('0x32')][_0xef4e('0x34')]));_0x16ff0d[_0xef4e('0x35')]=_0x16ff0d[_0xef4e('0x35')][_0xef4e('0x36')]?_0x16ff0d[_0xef4e('0x35')]:_0x46aac4[_0xef4e('0x31')];_0x16ff0d['order']=qs[_0xef4e('0x3b')](_0x25ff54['query']['sort']);_0x16ff0d[_0xef4e('0x3c')]=qs[_0xef4e('0x3d')](_['pick'](_0x25ff54[_0xef4e('0x32')],_0x46aac4[_0xef4e('0x3d')]));if(_0x25ff54[_0xef4e('0x32')][_0xef4e('0x3f')]){_0x16ff0d[_0xef4e('0x3c')]=_[_0xef4e('0x41')](_0x16ff0d['where'],{'$or':_[_0xef4e('0x2c')](_0x16ff0d[_0xef4e('0x35')],function(_0x2c4d87){var _0x35f969={};_0x35f969[_0x2c4d87]={'$like':'%'+_0x25ff54[_0xef4e('0x32')][_0xef4e('0x3f')]+'%'};return _0x35f969;})});}_0x16ff0d=_[_0xef4e('0x41')]({},_0x16ff0d,_0x25ff54['options']);return _0x38b406['getDescriptions'](_0x16ff0d);}})[_0xef4e('0x27')](function(_0x4160b7){if(_0x4160b7){_0x276fda=_0x4160b7[_0xef4e('0x36')];if(!_0x25ff54['query']['hasOwnProperty'](_0xef4e('0x38'))){_0x16ff0d[_0xef4e('0x1f')]=qs[_0xef4e('0x1f')](_0x25ff54['query'][_0xef4e('0x1f')]);_0x16ff0d[_0xef4e('0x39')]=qs[_0xef4e('0x39')](_0x25ff54[_0xef4e('0x32')]['offset']);}return _0x38b406[_0xef4e('0x53')](_0x16ff0d);}})[_0xef4e('0x27')](function(_0x5a80d0){if(_0x5a80d0){return _0x5a80d0?{'count':_0x276fda,'rows':_0x5a80d0}:null;}})[_0xef4e('0x27')](respondWithResult(_0x26d28c,null))['catch'](handleError(_0x26d28c,null));};exports[_0xef4e('0x54')]=function(_0x2fc170,_0x4788b4,_0x10d1a7){var _0x3aff6a={};var _0x58cbd7={};var _0x55b640;var _0x3aa331;return db[_0xef4e('0x43')][_0xef4e('0x51')]({'where':{'id':_0x2fc170[_0xef4e('0x4e')]['id']}})[_0xef4e('0x27')](handleEntityNotFound(_0x4788b4,null))['then'](function(_0x466970){if(_0x466970){_0x55b640=_0x466970;_0x58cbd7['model']=_[_0xef4e('0x49')](db['Tag'][_0xef4e('0x2d')]);_0x58cbd7[_0xef4e('0x32')]=_[_0xef4e('0x49')](_0x2fc170[_0xef4e('0x32')]);_0x58cbd7[_0xef4e('0x3d')]=_['intersection'](_0x58cbd7[_0xef4e('0x31')],_0x58cbd7[_0xef4e('0x32')]);_0x3aff6a[_0xef4e('0x35')]=_[_0xef4e('0x33')](_0x58cbd7['model'],qs['fields'](_0x2fc170[_0xef4e('0x32')][_0xef4e('0x34')]));_0x3aff6a[_0xef4e('0x35')]=_0x3aff6a[_0xef4e('0x35')][_0xef4e('0x36')]?_0x3aff6a[_0xef4e('0x35')]:_0x58cbd7[_0xef4e('0x31')];_0x3aff6a[_0xef4e('0x3a')]=qs[_0xef4e('0x3b')](_0x2fc170[_0xef4e('0x32')]['sort']);_0x3aff6a[_0xef4e('0x3c')]=qs[_0xef4e('0x3d')](_['pick'](_0x2fc170[_0xef4e('0x32')],_0x58cbd7[_0xef4e('0x3d')]));if(_0x2fc170['query'][_0xef4e('0x3f')]){_0x3aff6a['where']=_[_0xef4e('0x41')](_0x3aff6a['where'],{'$or':_[_0xef4e('0x2c')](_0x3aff6a['attributes'],function(_0x24b2eb){var _0xd93365={};_0xd93365[_0x24b2eb]={'$like':'%'+_0x2fc170[_0xef4e('0x32')][_0xef4e('0x3f')]+'%'};return _0xd93365;})});}_0x3aff6a=_[_0xef4e('0x41')]({},_0x3aff6a,_0x2fc170[_0xef4e('0x42')]);return _0x55b640[_0xef4e('0x54')](_0x3aff6a);}})['then'](function(_0x588357){if(_0x588357){_0x3aa331=_0x588357[_0xef4e('0x36')];if(!_0x2fc170[_0xef4e('0x32')]['hasOwnProperty'](_0xef4e('0x38'))){_0x3aff6a[_0xef4e('0x1f')]=qs[_0xef4e('0x1f')](_0x2fc170[_0xef4e('0x32')][_0xef4e('0x1f')]);_0x3aff6a[_0xef4e('0x39')]=qs[_0xef4e('0x39')](_0x2fc170[_0xef4e('0x32')]['offset']);}return _0x55b640[_0xef4e('0x54')](_0x3aff6a);}})['then'](function(_0x2b341e){if(_0x2b341e){return _0x2b341e?{'count':_0x3aa331,'rows':_0x2b341e}:null;}})[_0xef4e('0x27')](respondWithResult(_0x4788b4,null))[_0xef4e('0x47')](handleError(_0x4788b4,null));};exports[_0xef4e('0x55')]=function(_0x379882,_0x249dde,_0x83224a){if(_0x379882['body']['id']){delete _0x379882[_0xef4e('0x4d')]['id'];}return db[_0xef4e('0x43')][_0xef4e('0x51')]({'where':{'id':_0x379882[_0xef4e('0x4e')]['id']}})[_0xef4e('0x27')](handleEntityNotFound(_0x249dde,null))[_0xef4e('0x27')](function(_0x5371fa){if(_0x5371fa){return _0x5371fa['setTags'](_0x379882[_0xef4e('0x4d')][_0xef4e('0x56')]||[]);}return null;})[_0xef4e('0x27')](respondWithResult(_0x249dde,null))[_0xef4e('0x47')](handleError(_0x249dde,null));}; \ No newline at end of file +var _0x8e23=['undefined','count','set','reject','save','then','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','FreshdeskConfiguration','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','FreshdeskField','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit'];(function(_0x3b4835,_0x217455){var _0x3057f9=function(_0x3917fc){while(--_0x3917fc){_0x3b4835['push'](_0x3b4835['shift']());}};_0x3057f9(++_0x217455);}(_0x8e23,0xdf));var _0x38e2=function(_0x363033,_0x482d4e){_0x363033=_0x363033-0x0;var _0x472b1a=_0x8e23[_0x363033];return _0x472b1a;};'use strict';var emlformat=require(_0x38e2('0x0'));var rimraf=require(_0x38e2('0x1'));var zipdir=require(_0x38e2('0x2'));var jsonpatch=require(_0x38e2('0x3'));var rp=require('request-promise');var moment=require(_0x38e2('0x4'));var BPromise=require(_0x38e2('0x5'));var Mustache=require('mustache');var util=require(_0x38e2('0x6'));var path=require(_0x38e2('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x38e2('0x8'));var fs=require('fs');var fs_extra=require(_0x38e2('0x9'));var _=require(_0x38e2('0xa'));var squel=require(_0x38e2('0xb'));var crypto=require(_0x38e2('0xc'));var jsforce=require(_0x38e2('0xd'));var deskjs=require(_0x38e2('0xe'));var toCsv=require(_0x38e2('0xf'));var querystring=require(_0x38e2('0x10'));var Papa=require(_0x38e2('0x11'));var Redis=require(_0x38e2('0x12'));var authService=require(_0x38e2('0x13'));var qs=require(_0x38e2('0x14'));var as=require(_0x38e2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x38e2('0x16'));var utils=require(_0x38e2('0x17'));var config=require(_0x38e2('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x38e2('0x19'))['db'];function respondWithStatusCode(_0x58a6be,_0x2a71b7){_0x2a71b7=_0x2a71b7||0xcc;return function(_0x5f278d){if(_0x5f278d){return _0x58a6be[_0x38e2('0x1a')](_0x2a71b7);}return _0x58a6be[_0x38e2('0x1b')](_0x2a71b7)[_0x38e2('0x1c')]();};}function respondWithResult(_0x114f63,_0x96ca28){_0x96ca28=_0x96ca28||0xc8;return function(_0x1fa728){if(_0x1fa728){return _0x114f63['status'](_0x96ca28)[_0x38e2('0x1d')](_0x1fa728);}};}function respondWithFilteredResult(_0x539c43,_0x2b35de){return function(_0x9a9b){if(_0x9a9b){var _0x1a453c=typeof _0x2b35de[_0x38e2('0x1e')]==='undefined'&&typeof _0x2b35de[_0x38e2('0x1f')]===_0x38e2('0x20');var _0x52adbe=_0x9a9b['count'];var _0x1942cf=_0x1a453c?0x0:_0x2b35de[_0x38e2('0x1e')];var _0x4723b0=_0x1a453c?_0x9a9b[_0x38e2('0x21')]:_0x2b35de[_0x38e2('0x1e')]+_0x2b35de[_0x38e2('0x1f')];var _0x5ee9be;if(_0x4723b0>=_0x52adbe){_0x4723b0=_0x52adbe;_0x5ee9be=0xc8;}else{_0x5ee9be=0xce;}_0x539c43[_0x38e2('0x1b')](_0x5ee9be);return _0x539c43[_0x38e2('0x22')]('Content-Range',_0x1942cf+'-'+_0x4723b0+'/'+_0x52adbe)[_0x38e2('0x1d')](_0x9a9b);}return null;};}function patchUpdates(_0x1587c4){return function(_0x334680){try{jsonpatch['apply'](_0x334680,_0x1587c4,!![]);}catch(_0x1dc94a){return BPromise[_0x38e2('0x23')](_0x1dc94a);}return _0x334680[_0x38e2('0x24')]();};}function saveUpdates(_0x51c2dc,_0x4f05ca){return function(_0x3c59e5){if(_0x3c59e5){return _0x3c59e5['update'](_0x51c2dc)[_0x38e2('0x25')](function(_0x2591c1){return _0x2591c1;});}return null;};}function removeEntity(_0x562452,_0x1cfd17){return function(_0x284f1e){if(_0x284f1e){return _0x284f1e[_0x38e2('0x26')]()['then'](function(){_0x562452[_0x38e2('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d164,_0x178028){return function(_0x4c0b29){if(!_0x4c0b29){_0x50d164['sendStatus'](0x194);}return _0x4c0b29;};}function handleError(_0x10e055,_0x5b4b0c){_0x5b4b0c=_0x5b4b0c||0x1f4;return function(_0x33740b){logger[_0x38e2('0x27')](_0x33740b[_0x38e2('0x28')]);if(_0x33740b[_0x38e2('0x29')]){delete _0x33740b[_0x38e2('0x29')];}_0x10e055['status'](_0x5b4b0c)[_0x38e2('0x2a')](_0x33740b);};}exports['index']=function(_0x4188ad,_0x540a14){var _0xf20e={},_0x254ddc={},_0x1bea3e={'count':0x0,'rows':[]};var _0x7458e9=_[_0x38e2('0x2b')](db['FreshdeskConfiguration'][_0x38e2('0x2c')],function(_0x4e7993){return{'name':_0x4e7993[_0x38e2('0x2d')],'type':_0x4e7993[_0x38e2('0x2e')][_0x38e2('0x2f')]};});_0x254ddc[_0x38e2('0x30')]=_['map'](_0x7458e9,'name');_0x254ddc[_0x38e2('0x31')]=_[_0x38e2('0x32')](_0x4188ad[_0x38e2('0x31')]);_0x254ddc[_0x38e2('0x33')]=_[_0x38e2('0x34')](_0x254ddc['model'],_0x254ddc[_0x38e2('0x31')]);_0xf20e[_0x38e2('0x35')]=_['intersection'](_0x254ddc['model'],qs[_0x38e2('0x36')](_0x4188ad[_0x38e2('0x31')][_0x38e2('0x36')]));_0xf20e[_0x38e2('0x35')]=_0xf20e[_0x38e2('0x35')][_0x38e2('0x37')]?_0xf20e[_0x38e2('0x35')]:_0x254ddc[_0x38e2('0x30')];if(!_0x4188ad[_0x38e2('0x31')][_0x38e2('0x38')](_0x38e2('0x39'))){_0xf20e['limit']=qs[_0x38e2('0x1f')](_0x4188ad['query'][_0x38e2('0x1f')]);_0xf20e[_0x38e2('0x1e')]=qs['offset'](_0x4188ad['query'][_0x38e2('0x1e')]);}_0xf20e[_0x38e2('0x3a')]=qs[_0x38e2('0x3b')](_0x4188ad[_0x38e2('0x31')][_0x38e2('0x3b')]);_0xf20e[_0x38e2('0x3c')]=qs[_0x38e2('0x33')](_[_0x38e2('0x3d')](_0x4188ad[_0x38e2('0x31')],_0x254ddc[_0x38e2('0x33')]),_0x7458e9);if(_0x4188ad[_0x38e2('0x31')][_0x38e2('0x3e')]){_0xf20e[_0x38e2('0x3c')]=_[_0x38e2('0x3f')](_0xf20e[_0x38e2('0x3c')],{'$or':_[_0x38e2('0x2b')](_0x7458e9,function(_0x2aeb03){if(_0x2aeb03['type']!==_0x38e2('0x40')){var _0x440aa9={};_0x440aa9[_0x2aeb03[_0x38e2('0x29')]]={'$like':'%'+_0x4188ad[_0x38e2('0x31')][_0x38e2('0x3e')]+'%'};return _0x440aa9;}})});}_0xf20e=_[_0x38e2('0x3f')]({},_0xf20e,_0x4188ad[_0x38e2('0x41')]);var _0x5464a3={'where':_0xf20e['where']};return db[_0x38e2('0x42')][_0x38e2('0x21')](_0x5464a3)['then'](function(_0x999c5){_0x1bea3e[_0x38e2('0x21')]=_0x999c5;if(_0x4188ad[_0x38e2('0x31')]['includeAll']){_0xf20e[_0x38e2('0x43')]=[{'all':!![]}];}return db[_0x38e2('0x42')][_0x38e2('0x44')](_0xf20e);})[_0x38e2('0x25')](function(_0x219e4d){_0x1bea3e[_0x38e2('0x45')]=_0x219e4d;return _0x1bea3e;})[_0x38e2('0x25')](respondWithFilteredResult(_0x540a14,_0xf20e))[_0x38e2('0x46')](handleError(_0x540a14,null));};exports[_0x38e2('0x47')]=function(_0x34f5ea,_0x478274){var _0x424b33={'raw':![],'where':{'id':_0x34f5ea[_0x38e2('0x48')]['id']}},_0x4f6c07={};_0x4f6c07[_0x38e2('0x30')]=_[_0x38e2('0x32')](db['FreshdeskConfiguration'][_0x38e2('0x2c')]);_0x4f6c07[_0x38e2('0x31')]=_[_0x38e2('0x32')](_0x34f5ea[_0x38e2('0x31')]);_0x4f6c07[_0x38e2('0x33')]=_[_0x38e2('0x34')](_0x4f6c07[_0x38e2('0x30')],_0x4f6c07[_0x38e2('0x31')]);_0x424b33[_0x38e2('0x35')]=_[_0x38e2('0x34')](_0x4f6c07[_0x38e2('0x30')],qs[_0x38e2('0x36')](_0x34f5ea[_0x38e2('0x31')][_0x38e2('0x36')]));_0x424b33[_0x38e2('0x35')]=_0x424b33[_0x38e2('0x35')][_0x38e2('0x37')]?_0x424b33[_0x38e2('0x35')]:_0x4f6c07[_0x38e2('0x30')];if(_0x34f5ea[_0x38e2('0x31')]['includeAll']){_0x424b33[_0x38e2('0x43')]=[{'all':!![]}];}_0x424b33=_[_0x38e2('0x3f')]({},_0x424b33,_0x34f5ea[_0x38e2('0x41')]);return db[_0x38e2('0x42')][_0x38e2('0x49')](_0x424b33)[_0x38e2('0x25')](handleEntityNotFound(_0x478274,null))[_0x38e2('0x25')](respondWithResult(_0x478274,null))[_0x38e2('0x46')](handleError(_0x478274,null));};exports[_0x38e2('0x4a')]=function(_0x5e8b1e,_0x1fa82b){return db[_0x38e2('0x42')][_0x38e2('0x4a')](_0x5e8b1e['body'],{})[_0x38e2('0x25')](respondWithResult(_0x1fa82b,0xc9))[_0x38e2('0x46')](handleError(_0x1fa82b,null));};exports['update']=function(_0x417dbc,_0x7ef3b){if(_0x417dbc[_0x38e2('0x4b')]['id']){delete _0x417dbc[_0x38e2('0x4b')]['id'];}return db['FreshdeskConfiguration'][_0x38e2('0x49')]({'where':{'id':_0x417dbc[_0x38e2('0x48')]['id']}})[_0x38e2('0x25')](handleEntityNotFound(_0x7ef3b,null))[_0x38e2('0x25')](saveUpdates(_0x417dbc['body'],null))['then'](respondWithResult(_0x7ef3b,null))[_0x38e2('0x46')](handleError(_0x7ef3b,null));};exports[_0x38e2('0x26')]=function(_0x4cf47b,_0x5e1408){return db[_0x38e2('0x42')]['find']({'where':{'id':_0x4cf47b[_0x38e2('0x48')]['id']}})[_0x38e2('0x25')](handleEntityNotFound(_0x5e1408,null))[_0x38e2('0x25')](removeEntity(_0x5e1408,null))[_0x38e2('0x46')](handleError(_0x5e1408,null));};exports[_0x38e2('0x4c')]=function(_0x3cd71f,_0x5c60e4,_0x243dec){var _0x2f7b37={};var _0x41aeda={};var _0x35ac9e;var _0x331d1a;return db[_0x38e2('0x42')][_0x38e2('0x4d')]({'where':{'id':_0x3cd71f[_0x38e2('0x48')]['id']}})[_0x38e2('0x25')](handleEntityNotFound(_0x5c60e4,null))['then'](function(_0x3649db){if(_0x3649db){_0x35ac9e=_0x3649db;_0x41aeda['model']=_[_0x38e2('0x32')](db[_0x38e2('0x4e')][_0x38e2('0x2c')]);_0x41aeda['query']=_[_0x38e2('0x32')](_0x3cd71f[_0x38e2('0x31')]);_0x41aeda['filters']=_[_0x38e2('0x34')](_0x41aeda['model'],_0x41aeda[_0x38e2('0x31')]);_0x2f7b37['attributes']=_[_0x38e2('0x34')](_0x41aeda[_0x38e2('0x30')],qs[_0x38e2('0x36')](_0x3cd71f['query'][_0x38e2('0x36')]));_0x2f7b37[_0x38e2('0x35')]=_0x2f7b37[_0x38e2('0x35')]['length']?_0x2f7b37[_0x38e2('0x35')]:_0x41aeda[_0x38e2('0x30')];_0x2f7b37['order']=qs[_0x38e2('0x3b')](_0x3cd71f['query']['sort']);_0x2f7b37['where']=qs[_0x38e2('0x33')](_[_0x38e2('0x3d')](_0x3cd71f[_0x38e2('0x31')],_0x41aeda[_0x38e2('0x33')]));if(_0x3cd71f[_0x38e2('0x31')][_0x38e2('0x3e')]){_0x2f7b37[_0x38e2('0x3c')]=_['merge'](_0x2f7b37[_0x38e2('0x3c')],{'$or':_[_0x38e2('0x2b')](_0x2f7b37[_0x38e2('0x35')],function(_0xb9f82d){var _0x316ef1={};_0x316ef1[_0xb9f82d]={'$like':'%'+_0x3cd71f[_0x38e2('0x31')][_0x38e2('0x3e')]+'%'};return _0x316ef1;})});}_0x2f7b37=_[_0x38e2('0x3f')]({},_0x2f7b37,_0x3cd71f[_0x38e2('0x41')]);return _0x35ac9e[_0x38e2('0x4c')](_0x2f7b37);}})[_0x38e2('0x25')](function(_0x1ef861){if(_0x1ef861){_0x331d1a=_0x1ef861[_0x38e2('0x37')];if(!_0x3cd71f[_0x38e2('0x31')]['hasOwnProperty']('nolimit')){_0x2f7b37['limit']=qs[_0x38e2('0x1f')](_0x3cd71f[_0x38e2('0x31')][_0x38e2('0x1f')]);_0x2f7b37[_0x38e2('0x1e')]=qs[_0x38e2('0x1e')](_0x3cd71f['query'][_0x38e2('0x1e')]);}return _0x35ac9e[_0x38e2('0x4c')](_0x2f7b37);}})[_0x38e2('0x25')](function(_0x205a03){if(_0x205a03){return _0x205a03?{'count':_0x331d1a,'rows':_0x205a03}:null;}})['then'](respondWithResult(_0x5c60e4,null))[_0x38e2('0x46')](handleError(_0x5c60e4,null));};exports[_0x38e2('0x4f')]=function(_0x2a6f43,_0xdd708e,_0x2a6f9e){var _0x130d0e={};var _0x34ea81={};var _0x13c00b;var _0x366740;return db[_0x38e2('0x42')][_0x38e2('0x4d')]({'where':{'id':_0x2a6f43['params']['id']}})[_0x38e2('0x25')](handleEntityNotFound(_0xdd708e,null))[_0x38e2('0x25')](function(_0x2c2dea){if(_0x2c2dea){_0x13c00b=_0x2c2dea;_0x34ea81[_0x38e2('0x30')]=_[_0x38e2('0x32')](db[_0x38e2('0x4e')][_0x38e2('0x2c')]);_0x34ea81['query']=_['keys'](_0x2a6f43[_0x38e2('0x31')]);_0x34ea81[_0x38e2('0x33')]=_[_0x38e2('0x34')](_0x34ea81['model'],_0x34ea81['query']);_0x130d0e['attributes']=_[_0x38e2('0x34')](_0x34ea81['model'],qs['fields'](_0x2a6f43[_0x38e2('0x31')][_0x38e2('0x36')]));_0x130d0e[_0x38e2('0x35')]=_0x130d0e[_0x38e2('0x35')]['length']?_0x130d0e[_0x38e2('0x35')]:_0x34ea81[_0x38e2('0x30')];_0x130d0e['order']=qs[_0x38e2('0x3b')](_0x2a6f43[_0x38e2('0x31')][_0x38e2('0x3b')]);_0x130d0e[_0x38e2('0x3c')]=qs[_0x38e2('0x33')](_[_0x38e2('0x3d')](_0x2a6f43[_0x38e2('0x31')],_0x34ea81[_0x38e2('0x33')]));if(_0x2a6f43[_0x38e2('0x31')][_0x38e2('0x3e')]){_0x130d0e['where']=_[_0x38e2('0x3f')](_0x130d0e['where'],{'$or':_[_0x38e2('0x2b')](_0x130d0e[_0x38e2('0x35')],function(_0x3b73d8){var _0x253f26={};_0x253f26[_0x3b73d8]={'$like':'%'+_0x2a6f43[_0x38e2('0x31')]['filter']+'%'};return _0x253f26;})});}_0x130d0e=_[_0x38e2('0x3f')]({},_0x130d0e,_0x2a6f43[_0x38e2('0x41')]);return _0x13c00b[_0x38e2('0x4f')](_0x130d0e);}})[_0x38e2('0x25')](function(_0x32653c){if(_0x32653c){_0x366740=_0x32653c[_0x38e2('0x37')];if(!_0x2a6f43[_0x38e2('0x31')][_0x38e2('0x38')](_0x38e2('0x39'))){_0x130d0e[_0x38e2('0x1f')]=qs['limit'](_0x2a6f43[_0x38e2('0x31')][_0x38e2('0x1f')]);_0x130d0e[_0x38e2('0x1e')]=qs[_0x38e2('0x1e')](_0x2a6f43[_0x38e2('0x31')][_0x38e2('0x1e')]);}return _0x13c00b['getSubjects'](_0x130d0e);}})[_0x38e2('0x25')](function(_0x22cd21){if(_0x22cd21){return _0x22cd21?{'count':_0x366740,'rows':_0x22cd21}:null;}})['then'](respondWithResult(_0xdd708e,null))[_0x38e2('0x46')](handleError(_0xdd708e,null));};exports['getDescriptions']=function(_0x1e01f9,_0x9db21e,_0x3309ac){var _0x4a440b={};var _0x145b2e={};var _0x30ec27;var _0x1674f9;return db[_0x38e2('0x42')]['findOne']({'where':{'id':_0x1e01f9[_0x38e2('0x48')]['id']}})[_0x38e2('0x25')](handleEntityNotFound(_0x9db21e,null))['then'](function(_0x1022f3){if(_0x1022f3){_0x30ec27=_0x1022f3;_0x145b2e[_0x38e2('0x30')]=_[_0x38e2('0x32')](db['FreshdeskField'][_0x38e2('0x2c')]);_0x145b2e['query']=_[_0x38e2('0x32')](_0x1e01f9['query']);_0x145b2e[_0x38e2('0x33')]=_[_0x38e2('0x34')](_0x145b2e[_0x38e2('0x30')],_0x145b2e[_0x38e2('0x31')]);_0x4a440b[_0x38e2('0x35')]=_[_0x38e2('0x34')](_0x145b2e[_0x38e2('0x30')],qs['fields'](_0x1e01f9['query'][_0x38e2('0x36')]));_0x4a440b['attributes']=_0x4a440b[_0x38e2('0x35')][_0x38e2('0x37')]?_0x4a440b[_0x38e2('0x35')]:_0x145b2e[_0x38e2('0x30')];_0x4a440b['order']=qs['sort'](_0x1e01f9[_0x38e2('0x31')]['sort']);_0x4a440b[_0x38e2('0x3c')]=qs[_0x38e2('0x33')](_[_0x38e2('0x3d')](_0x1e01f9['query'],_0x145b2e['filters']));if(_0x1e01f9[_0x38e2('0x31')][_0x38e2('0x3e')]){_0x4a440b['where']=_[_0x38e2('0x3f')](_0x4a440b[_0x38e2('0x3c')],{'$or':_['map'](_0x4a440b[_0x38e2('0x35')],function(_0x46b1f5){var _0x37b35b={};_0x37b35b[_0x46b1f5]={'$like':'%'+_0x1e01f9[_0x38e2('0x31')][_0x38e2('0x3e')]+'%'};return _0x37b35b;})});}_0x4a440b=_[_0x38e2('0x3f')]({},_0x4a440b,_0x1e01f9[_0x38e2('0x41')]);return _0x30ec27[_0x38e2('0x50')](_0x4a440b);}})[_0x38e2('0x25')](function(_0x3d5b3a){if(_0x3d5b3a){_0x1674f9=_0x3d5b3a[_0x38e2('0x37')];if(!_0x1e01f9[_0x38e2('0x31')]['hasOwnProperty'](_0x38e2('0x39'))){_0x4a440b[_0x38e2('0x1f')]=qs['limit'](_0x1e01f9['query'][_0x38e2('0x1f')]);_0x4a440b['offset']=qs[_0x38e2('0x1e')](_0x1e01f9[_0x38e2('0x31')][_0x38e2('0x1e')]);}return _0x30ec27[_0x38e2('0x50')](_0x4a440b);}})[_0x38e2('0x25')](function(_0x1f4dbf){if(_0x1f4dbf){return _0x1f4dbf?{'count':_0x1674f9,'rows':_0x1f4dbf}:null;}})[_0x38e2('0x25')](respondWithResult(_0x9db21e,null))[_0x38e2('0x46')](handleError(_0x9db21e,null));};exports[_0x38e2('0x51')]=function(_0x21e6ed,_0x3482c7,_0xc9d660){var _0x44a073={};var _0x23d64b={};var _0xfac275;var _0xde208f;return db[_0x38e2('0x42')][_0x38e2('0x4d')]({'where':{'id':_0x21e6ed[_0x38e2('0x48')]['id']}})['then'](handleEntityNotFound(_0x3482c7,null))[_0x38e2('0x25')](function(_0x25fac6){if(_0x25fac6){_0xfac275=_0x25fac6;_0x23d64b[_0x38e2('0x30')]=_[_0x38e2('0x32')](db[_0x38e2('0x52')][_0x38e2('0x2c')]);_0x23d64b['query']=_['keys'](_0x21e6ed[_0x38e2('0x31')]);_0x23d64b['filters']=_[_0x38e2('0x34')](_0x23d64b[_0x38e2('0x30')],_0x23d64b[_0x38e2('0x31')]);_0x44a073['attributes']=_['intersection'](_0x23d64b[_0x38e2('0x30')],qs[_0x38e2('0x36')](_0x21e6ed[_0x38e2('0x31')]['fields']));_0x44a073['attributes']=_0x44a073[_0x38e2('0x35')][_0x38e2('0x37')]?_0x44a073['attributes']:_0x23d64b[_0x38e2('0x30')];_0x44a073[_0x38e2('0x3a')]=qs[_0x38e2('0x3b')](_0x21e6ed[_0x38e2('0x31')][_0x38e2('0x3b')]);_0x44a073[_0x38e2('0x3c')]=qs[_0x38e2('0x33')](_['pick'](_0x21e6ed[_0x38e2('0x31')],_0x23d64b[_0x38e2('0x33')]));if(_0x21e6ed[_0x38e2('0x31')][_0x38e2('0x3e')]){_0x44a073[_0x38e2('0x3c')]=_[_0x38e2('0x3f')](_0x44a073[_0x38e2('0x3c')],{'$or':_[_0x38e2('0x2b')](_0x44a073['attributes'],function(_0x4a8b97){var _0x4ef863={};_0x4ef863[_0x4a8b97]={'$like':'%'+_0x21e6ed[_0x38e2('0x31')]['filter']+'%'};return _0x4ef863;})});}_0x44a073=_['merge']({},_0x44a073,_0x21e6ed['options']);return _0xfac275[_0x38e2('0x51')](_0x44a073);}})[_0x38e2('0x25')](function(_0x5dd9f5){if(_0x5dd9f5){_0xde208f=_0x5dd9f5[_0x38e2('0x37')];if(!_0x21e6ed['query']['hasOwnProperty'](_0x38e2('0x39'))){_0x44a073['limit']=qs[_0x38e2('0x1f')](_0x21e6ed[_0x38e2('0x31')][_0x38e2('0x1f')]);_0x44a073[_0x38e2('0x1e')]=qs['offset'](_0x21e6ed[_0x38e2('0x31')][_0x38e2('0x1e')]);}return _0xfac275[_0x38e2('0x51')](_0x44a073);}})['then'](function(_0x5cfab8){if(_0x5cfab8){return _0x5cfab8?{'count':_0xde208f,'rows':_0x5cfab8}:null;}})['then'](respondWithResult(_0x3482c7,null))[_0x38e2('0x46')](handleError(_0x3482c7,null));};exports[_0x38e2('0x53')]=function(_0x673e72,_0xccf201,_0x33f68f){if(_0x673e72['body']['id']){delete _0x673e72[_0x38e2('0x4b')]['id'];}return db[_0x38e2('0x42')][_0x38e2('0x4d')]({'where':{'id':_0x673e72[_0x38e2('0x48')]['id']}})[_0x38e2('0x25')](handleEntityNotFound(_0xccf201,null))['then'](function(_0x40844f){if(_0x40844f){return _0x40844f[_0x38e2('0x53')](_0x673e72[_0x38e2('0x4b')][_0x38e2('0x54')]||[]);}return null;})['then'](respondWithResult(_0xccf201,null))[_0x38e2('0x46')](handleError(_0xccf201,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index 6676079..ec6d251 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 _0x0a87=['api','bluebird','rimraf','FreshdeskConfiguration','../../config/logger'];(function(_0x2e913b,_0x4b7071){var _0x173899=function(_0x2a7d22){while(--_0x2a7d22){_0x2e913b['push'](_0x2e913b['shift']());}};_0x173899(++_0x4b7071);}(_0x0a87,0x13f));var _0x70a8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0a87[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x70a8('0x0'))(_0x70a8('0x1'));var moment=require('moment');var BPromise=require(_0x70a8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x70a8('0x3'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module['exports']=function(_0x11ccae,_0xc17241){return _0x11ccae['define'](_0x70a8('0x4'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfeda=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','int_freshdesk_configurations','../../config/logger'];(function(_0x297c01,_0x5cd190){var _0x4fb8ff=function(_0x255757){while(--_0x255757){_0x297c01['push'](_0x297c01['shift']());}};_0x4fb8ff(++_0x5cd190);}(_0xfeda,0x137));var _0xafed=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xfeda[_0x55f8b4];return _0x2475f9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xafed('0x0'))(_0xafed('0x1'));var moment=require('moment');var BPromise=require(_0xafed('0x2'));var rp=require(_0xafed('0x3'));var fs=require('fs');var path=require(_0xafed('0x4'));var rimraf=require(_0xafed('0x5'));var config=require(_0xafed('0x6'));var attributes=require(_0xafed('0x7'));module[_0xafed('0x8')]=function(_0x18bbb2,_0x3b29e0){return _0x18bbb2[_0xafed('0x9')](_0xafed('0xa'),attributes,{'tableName':_0xafed('0xb'),'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 d6be7b3..1c13fe0 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 _0x0f88=['http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x0f88,0x114));var _0x80f8=function(_0x3a7368,_0x185789){_0x3a7368=_0x3a7368-0x0;var _0x1aa883=_0x0f88[_0x3a7368];return _0x1aa883;};'use strict';var _=require(_0x80f8('0x0'));var util=require(_0x80f8('0x1'));var moment=require(_0x80f8('0x2'));var BPromise=require(_0x80f8('0x3'));var rs=require(_0x80f8('0x4'));var fs=require('fs');var Redis=require(_0x80f8('0x5'));var db=require(_0x80f8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x80f8('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x80f8('0x8')][_0x80f8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x310415,_0x2a4a04,_0x428ce4){return new BPromise(function(_0x59943b,_0x554a6f){return client[_0x80f8('0xa')](_0x310415,_0x428ce4)[_0x80f8('0xb')](function(_0xa5dd9d){logger[_0x80f8('0xc')](_0x80f8('0xd'),_0x2a4a04,_0x80f8('0xe'));logger[_0x80f8('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x2a4a04,_0x80f8('0xe'),JSON[_0x80f8('0x10')](_0xa5dd9d));if(_0xa5dd9d[_0x80f8('0x11')]){if(_0xa5dd9d['error']['code']===0x1f4){logger[_0x80f8('0x11')](_0x80f8('0xd'),_0x2a4a04,_0xa5dd9d['error'][_0x80f8('0x12')]);return _0x554a6f(_0xa5dd9d[_0x80f8('0x11')][_0x80f8('0x12')]);}logger['error'](_0x80f8('0xd'),_0x2a4a04,_0xa5dd9d[_0x80f8('0x11')][_0x80f8('0x12')]);return _0x59943b(_0xa5dd9d[_0x80f8('0x11')]['message']);}else{logger['info'](_0x80f8('0xd'),_0x2a4a04,_0x80f8('0xe'));_0x59943b(_0xa5dd9d['result'][_0x80f8('0x12')]);}})['catch'](function(_0x3695a8){logger[_0x80f8('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x2a4a04,_0x3695a8);_0x554a6f(_0x3695a8);});});} \ No newline at end of file +var _0x7d74=['error','code','FreshdeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x6a912b,_0xef43c3){var _0x226f7c=function(_0x2d20ea){while(--_0x2d20ea){_0x6a912b['push'](_0x6a912b['shift']());}};_0x226f7c(++_0xef43c3);}(_0x7d74,0xcf));var _0x47d7=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7d74[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x47d7('0x0'));var util=require('util');var moment=require(_0x47d7('0x1'));var BPromise=require(_0x47d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x47d7('0x3'));var db=require(_0x47d7('0x4'))['db'];var utils=require(_0x47d7('0x5'));var logger=require(_0x47d7('0x6'))(_0x47d7('0x7'));var config=require(_0x47d7('0x8'));var jayson=require(_0x47d7('0x9'));var client=jayson[_0x47d7('0xa')][_0x47d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd27003,_0x3e803f,_0x449d15){return new BPromise(function(_0xf88054,_0x26cfba){return client[_0x47d7('0xc')](_0xd27003,_0x449d15)[_0x47d7('0xd')](function(_0x584e25){logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3e803f,_0x47d7('0xe'));logger[_0x47d7('0xf')](_0x47d7('0x10'),_0x3e803f,_0x47d7('0xe'),JSON[_0x47d7('0x11')](_0x584e25));if(_0x584e25['error']){if(_0x584e25[_0x47d7('0x12')][_0x47d7('0x13')]===0x1f4){logger[_0x47d7('0x12')](_0x47d7('0x14'),_0x3e803f,_0x584e25['error']['message']);return _0x26cfba(_0x584e25[_0x47d7('0x12')]['message']);}logger[_0x47d7('0x12')](_0x47d7('0x14'),_0x3e803f,_0x584e25[_0x47d7('0x12')][_0x47d7('0x15')]);return _0xf88054(_0x584e25[_0x47d7('0x12')]['message']);}else{logger[_0x47d7('0x16')](_0x47d7('0x14'),_0x3e803f,'request\x20sent');_0xf88054(_0x584e25[_0x47d7('0x17')][_0x47d7('0x15')]);}})[_0x47d7('0x18')](function(_0x3d97af){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0x3e803f,_0x3d97af);_0x26cfba(_0x3d97af);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index f74b326..03ed5bc 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 _0xb228=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','exports'];(function(_0x1d045a,_0x5c6778){var _0x24ce3b=function(_0x234d3a){while(--_0x234d3a){_0x1d045a['push'](_0x1d045a['shift']());}};_0x24ce3b(++_0x5c6778);}(_0xb228,0x17c));var _0x8b22=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xb228[_0x1beef3];return _0x5af964;};'use strict';var multer=require(_0x8b22('0x0'));var util=require(_0x8b22('0x1'));var path=require('path');var timeout=require(_0x8b22('0x2'));var express=require(_0x8b22('0x3'));var router=express[_0x8b22('0x4')]();var fs_extra=require(_0x8b22('0x5'));var auth=require(_0x8b22('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8b22('0x7'));var controller=require(_0x8b22('0x8'));router[_0x8b22('0x9')]('/',auth[_0x8b22('0xa')](),controller[_0x8b22('0xb')]);router[_0x8b22('0x9')](_0x8b22('0xc'),auth[_0x8b22('0xa')](),controller[_0x8b22('0xd')]);router[_0x8b22('0xe')]('/',auth[_0x8b22('0xa')](),controller[_0x8b22('0xf')]);router[_0x8b22('0x10')](_0x8b22('0xc'),auth[_0x8b22('0xa')](),controller[_0x8b22('0x11')]);router[_0x8b22('0x12')](_0x8b22('0xc'),auth[_0x8b22('0xa')](),controller['destroy']);module[_0x8b22('0x13')]=router; \ No newline at end of file +var _0x3936=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','/:id','isAuthenticated','show','post','create','put','destroy','exports'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0x3936,0xd0));var _0x6393=function(_0xbb1add,_0x489d26){_0xbb1add=_0xbb1add-0x0;var _0x1620b1=_0x3936[_0xbb1add];return _0x1620b1;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x6393('0x0'));var express=require(_0x6393('0x1'));var router=express[_0x6393('0x2')]();var fs_extra=require(_0x6393('0x3'));var auth=require(_0x6393('0x4'));var interaction=require(_0x6393('0x5'));var config=require(_0x6393('0x6'));var controller=require(_0x6393('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x6393('0x8'),auth[_0x6393('0x9')](),controller[_0x6393('0xa')]);router[_0x6393('0xb')]('/',auth[_0x6393('0x9')](),controller[_0x6393('0xc')]);router[_0x6393('0xd')]('/:id',auth[_0x6393('0x9')](),controller['update']);router['delete'](_0x6393('0x8'),auth[_0x6393('0x9')](),controller[_0x6393('0xe')]);module[_0x6393('0xf')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 5d87673..6d2056f 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 _0x3700=['picklist','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue'];(function(_0x24d5a0,_0x54ed3a){var _0x2b6d87=function(_0x488cfb){while(--_0x488cfb){_0x24d5a0['push'](_0x24d5a0['shift']());}};_0x2b6d87(++_0x54ed3a);}(_0x3700,0xe1));var _0x0370=function(_0x4a96d2,_0x689504){_0x4a96d2=_0x4a96d2-0x0;var _0x38af04=_0x3700[_0x4a96d2];return _0x38af04;};'use strict';var Sequelize=require(_0x0370('0x0'));module[_0x0370('0x1')]={'type':{'type':Sequelize[_0x0370('0x2')](_0x0370('0x3'),'variable','customVariable',_0x0370('0x4'),_0x0370('0x5')),'defaultValue':_0x0370('0x3')},'content':{'type':Sequelize[_0x0370('0x6')]},'key':{'type':Sequelize[_0x0370('0x6')]},'keyType':{'type':Sequelize[_0x0370('0x2')]('string',_0x0370('0x7'),_0x0370('0x8'))},'keyContent':{'type':Sequelize[_0x0370('0x6')]},'idField':{'type':Sequelize[_0x0370('0x6')]},'nameField':{'type':Sequelize[_0x0370('0x6')]},'customField':{'type':Sequelize[_0x0370('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2f47=['picklist','STRING','exports','ENUM','string','variable','customVariable'];(function(_0x4abd0b,_0x5b65f1){var _0x5356fc=function(_0x4a10b0){while(--_0x4a10b0){_0x4abd0b['push'](_0x4abd0b['shift']());}};_0x5356fc(++_0x5b65f1);}(_0x2f47,0x1a6));var _0x72f4=function(_0x52bf69,_0x5d797c){_0x52bf69=_0x52bf69-0x0;var _0x370826=_0x2f47[_0x52bf69];return _0x370826;};'use strict';var Sequelize=require('sequelize');module[_0x72f4('0x0')]={'type':{'type':Sequelize[_0x72f4('0x1')](_0x72f4('0x2'),_0x72f4('0x3'),_0x72f4('0x4'),'keyValue',_0x72f4('0x5')),'defaultValue':_0x72f4('0x2')},'content':{'type':Sequelize[_0x72f4('0x6')]},'key':{'type':Sequelize[_0x72f4('0x6')]},'keyType':{'type':Sequelize[_0x72f4('0x1')]('string',_0x72f4('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x72f4('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'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 793aa0f..5153077 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 _0xaaa2=['model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','includeAll','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','send','index','map','FreshdeskField','type','key'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xaaa2,0xac));var _0x2aaa=function(_0x5e7693,_0x44aae1){_0x5e7693=_0x5e7693-0x0;var _0x3701e3=_0xaaa2[_0x5e7693];return _0x3701e3;};'use strict';var emlformat=require(_0x2aaa('0x0'));var rimraf=require(_0x2aaa('0x1'));var zipdir=require(_0x2aaa('0x2'));var jsonpatch=require(_0x2aaa('0x3'));var rp=require(_0x2aaa('0x4'));var moment=require(_0x2aaa('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2aaa('0x6'));var util=require('util');var path=require(_0x2aaa('0x7'));var sox=require(_0x2aaa('0x8'));var csv=require(_0x2aaa('0x9'));var ejs=require(_0x2aaa('0xa'));var fs=require('fs');var fs_extra=require(_0x2aaa('0xb'));var _=require(_0x2aaa('0xc'));var squel=require('squel');var crypto=require(_0x2aaa('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2aaa('0x9'));var querystring=require('querystring');var Papa=require(_0x2aaa('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2aaa('0xf'));var as=require(_0x2aaa('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2aaa('0x11'))(_0x2aaa('0x12'));var utils=require(_0x2aaa('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x2aaa('0x14'));var db=require(_0x2aaa('0x15'))['db'];function respondWithStatusCode(_0x8a5be3,_0x2b51f0){_0x2b51f0=_0x2b51f0||0xcc;return function(_0xd38d6d){if(_0xd38d6d){return _0x8a5be3[_0x2aaa('0x16')](_0x2b51f0);}return _0x8a5be3[_0x2aaa('0x17')](_0x2b51f0)[_0x2aaa('0x18')]();};}function respondWithResult(_0x32dfbf,_0xe22151){_0xe22151=_0xe22151||0xc8;return function(_0x314366){if(_0x314366){return _0x32dfbf[_0x2aaa('0x17')](_0xe22151)['json'](_0x314366);}};}function respondWithFilteredResult(_0x166321,_0x4df56b){return function(_0x35fbc1){if(_0x35fbc1){var _0x1a5573=typeof _0x4df56b['offset']==='undefined'&&typeof _0x4df56b['limit']===_0x2aaa('0x19');var _0x1dc0ba=_0x35fbc1[_0x2aaa('0x1a')];var _0x3b94bf=_0x1a5573?0x0:_0x4df56b[_0x2aaa('0x1b')];var _0xdaa445=_0x1a5573?_0x35fbc1[_0x2aaa('0x1a')]:_0x4df56b['offset']+_0x4df56b[_0x2aaa('0x1c')];var _0x30951c;if(_0xdaa445>=_0x1dc0ba){_0xdaa445=_0x1dc0ba;_0x30951c=0xc8;}else{_0x30951c=0xce;}_0x166321['status'](_0x30951c);return _0x166321[_0x2aaa('0x1d')]('Content-Range',_0x3b94bf+'-'+_0xdaa445+'/'+_0x1dc0ba)['json'](_0x35fbc1);}return null;};}function patchUpdates(_0x1ec32e){return function(_0x5052eb){try{jsonpatch[_0x2aaa('0x1e')](_0x5052eb,_0x1ec32e,!![]);}catch(_0x3e7649){return BPromise[_0x2aaa('0x1f')](_0x3e7649);}return _0x5052eb[_0x2aaa('0x20')]();};}function saveUpdates(_0x2c255f,_0x24da1e){return function(_0x4f581f){if(_0x4f581f){return _0x4f581f[_0x2aaa('0x21')](_0x2c255f)[_0x2aaa('0x22')](function(_0x4836b2){return _0x4836b2;});}return null;};}function removeEntity(_0x4d35aa,_0x19153e){return function(_0x4d7151){if(_0x4d7151){return _0x4d7151[_0x2aaa('0x23')]()[_0x2aaa('0x22')](function(){_0x4d35aa['status'](0xcc)[_0x2aaa('0x18')]();});}};}function handleEntityNotFound(_0x3b99d8,_0x4e1c0f){return function(_0x2ab888){if(!_0x2ab888){_0x3b99d8[_0x2aaa('0x16')](0x194);}return _0x2ab888;};}function handleError(_0x41253c,_0x5371cd){_0x5371cd=_0x5371cd||0x1f4;return function(_0x1f626b){logger[_0x2aaa('0x24')](_0x1f626b['stack']);if(_0x1f626b['name']){delete _0x1f626b[_0x2aaa('0x25')];}_0x41253c[_0x2aaa('0x17')](_0x5371cd)[_0x2aaa('0x26')](_0x1f626b);};}exports[_0x2aaa('0x27')]=function(_0x3a6a63,_0x292297){var _0x2f8305={},_0x166dc0={},_0x12cd47={'count':0x0,'rows':[]};var _0x19472b=_[_0x2aaa('0x28')](db[_0x2aaa('0x29')]['rawAttributes'],function(_0x101b6e){return{'name':_0x101b6e['fieldName'],'type':_0x101b6e[_0x2aaa('0x2a')][_0x2aaa('0x2b')]};});_0x166dc0[_0x2aaa('0x2c')]=_[_0x2aaa('0x28')](_0x19472b,_0x2aaa('0x25'));_0x166dc0[_0x2aaa('0x2d')]=_[_0x2aaa('0x2e')](_0x3a6a63[_0x2aaa('0x2d')]);_0x166dc0[_0x2aaa('0x2f')]=_[_0x2aaa('0x30')](_0x166dc0['model'],_0x166dc0['query']);_0x2f8305['attributes']=_['intersection'](_0x166dc0['model'],qs[_0x2aaa('0x31')](_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x31')]));_0x2f8305[_0x2aaa('0x32')]=_0x2f8305[_0x2aaa('0x32')][_0x2aaa('0x33')]?_0x2f8305[_0x2aaa('0x32')]:_0x166dc0[_0x2aaa('0x2c')];if(!_0x3a6a63['query'][_0x2aaa('0x34')](_0x2aaa('0x35'))){_0x2f8305['limit']=qs[_0x2aaa('0x1c')](_0x3a6a63[_0x2aaa('0x2d')]['limit']);_0x2f8305[_0x2aaa('0x1b')]=qs[_0x2aaa('0x1b')](_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x1b')]);}_0x2f8305[_0x2aaa('0x36')]=qs[_0x2aaa('0x37')](_0x3a6a63[_0x2aaa('0x2d')]['sort']);_0x2f8305['where']=qs[_0x2aaa('0x2f')](_['pick'](_0x3a6a63[_0x2aaa('0x2d')],_0x166dc0[_0x2aaa('0x2f')]),_0x19472b);if(_0x3a6a63['query'][_0x2aaa('0x38')]){_0x2f8305[_0x2aaa('0x39')]=_[_0x2aaa('0x3a')](_0x2f8305['where'],{'$or':_[_0x2aaa('0x28')](_0x19472b,function(_0x337ae8){if(_0x337ae8[_0x2aaa('0x2a')]!==_0x2aaa('0x3b')){var _0x5023d2={};_0x5023d2[_0x337ae8[_0x2aaa('0x25')]]={'$like':'%'+_0x3a6a63[_0x2aaa('0x2d')][_0x2aaa('0x38')]+'%'};return _0x5023d2;}})});}_0x2f8305=_[_0x2aaa('0x3a')]({},_0x2f8305,_0x3a6a63[_0x2aaa('0x3c')]);var _0x362060={'where':_0x2f8305[_0x2aaa('0x39')]};return db[_0x2aaa('0x29')][_0x2aaa('0x1a')](_0x362060)[_0x2aaa('0x22')](function(_0x127f7e){_0x12cd47[_0x2aaa('0x1a')]=_0x127f7e;if(_0x3a6a63[_0x2aaa('0x2d')]['includeAll']){_0x2f8305[_0x2aaa('0x3d')]=[{'all':!![]}];}return db[_0x2aaa('0x29')][_0x2aaa('0x3e')](_0x2f8305);})['then'](function(_0x17042f){_0x12cd47[_0x2aaa('0x3f')]=_0x17042f;return _0x12cd47;})[_0x2aaa('0x22')](respondWithFilteredResult(_0x292297,_0x2f8305))['catch'](handleError(_0x292297,null));};exports[_0x2aaa('0x40')]=function(_0x1bb225,_0x25b932){var _0x4ad537={'raw':!![],'where':{'id':_0x1bb225[_0x2aaa('0x41')]['id']}},_0x57554e={};_0x57554e[_0x2aaa('0x2c')]=_[_0x2aaa('0x2e')](db['FreshdeskField'][_0x2aaa('0x42')]);_0x57554e[_0x2aaa('0x2d')]=_[_0x2aaa('0x2e')](_0x1bb225[_0x2aaa('0x2d')]);_0x57554e[_0x2aaa('0x2f')]=_[_0x2aaa('0x30')](_0x57554e[_0x2aaa('0x2c')],_0x57554e[_0x2aaa('0x2d')]);_0x4ad537['attributes']=_['intersection'](_0x57554e[_0x2aaa('0x2c')],qs['fields'](_0x1bb225[_0x2aaa('0x2d')]['fields']));_0x4ad537['attributes']=_0x4ad537['attributes'][_0x2aaa('0x33')]?_0x4ad537[_0x2aaa('0x32')]:_0x57554e['model'];if(_0x1bb225[_0x2aaa('0x2d')][_0x2aaa('0x43')]){_0x4ad537['include']=[{'all':!![]}];}_0x4ad537=_[_0x2aaa('0x3a')]({},_0x4ad537,_0x1bb225['options']);return db[_0x2aaa('0x29')][_0x2aaa('0x44')](_0x4ad537)['then'](handleEntityNotFound(_0x25b932,null))[_0x2aaa('0x22')](respondWithResult(_0x25b932,null))[_0x2aaa('0x45')](handleError(_0x25b932,null));};exports[_0x2aaa('0x46')]=function(_0x367a63,_0x745414){return db['FreshdeskField']['create'](_0x367a63['body'],{})[_0x2aaa('0x22')](respondWithResult(_0x745414,0xc9))[_0x2aaa('0x45')](handleError(_0x745414,null));};exports[_0x2aaa('0x21')]=function(_0x393073,_0x23290d){if(_0x393073[_0x2aaa('0x47')]['id']){delete _0x393073[_0x2aaa('0x47')]['id'];}return db[_0x2aaa('0x29')][_0x2aaa('0x44')]({'where':{'id':_0x393073['params']['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x23290d,null))[_0x2aaa('0x22')](saveUpdates(_0x393073[_0x2aaa('0x47')],null))[_0x2aaa('0x22')](respondWithResult(_0x23290d,null))['catch'](handleError(_0x23290d,null));};exports[_0x2aaa('0x23')]=function(_0xe935c3,_0x3906f8){return db['FreshdeskField']['find']({'where':{'id':_0xe935c3[_0x2aaa('0x41')]['id']}})[_0x2aaa('0x22')](handleEntityNotFound(_0x3906f8,null))[_0x2aaa('0x22')](removeEntity(_0x3906f8,null))[_0x2aaa('0x45')](handleError(_0x3906f8,null));}; \ No newline at end of file +var _0x8cc8=['jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','index','FreshdeskField','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','merge','map','VIRTUAL','filter','options','where','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x8cc8,0x177));var _0x88cc=function(_0x31aee9,_0x389bb6){_0x31aee9=_0x31aee9-0x0;var _0x4d664d=_0x8cc8[_0x31aee9];return _0x4d664d;};'use strict';var emlformat=require(_0x88cc('0x0'));var rimraf=require(_0x88cc('0x1'));var zipdir=require(_0x88cc('0x2'));var jsonpatch=require(_0x88cc('0x3'));var rp=require(_0x88cc('0x4'));var moment=require(_0x88cc('0x5'));var BPromise=require(_0x88cc('0x6'));var Mustache=require(_0x88cc('0x7'));var util=require(_0x88cc('0x8'));var path=require(_0x88cc('0x9'));var sox=require(_0x88cc('0xa'));var csv=require(_0x88cc('0xb'));var ejs=require(_0x88cc('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x88cc('0xd'));var crypto=require(_0x88cc('0xe'));var jsforce=require(_0x88cc('0xf'));var deskjs=require(_0x88cc('0x10'));var toCsv=require('to-csv');var querystring=require(_0x88cc('0x11'));var Papa=require(_0x88cc('0x12'));var Redis=require('ioredis');var authService=require(_0x88cc('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x88cc('0x14'));var hardwareService=require(_0x88cc('0x15'));var logger=require(_0x88cc('0x16'))(_0x88cc('0x17'));var utils=require('../../config/utils');var config=require(_0x88cc('0x18'));var licenseUtil=require(_0x88cc('0x19'));var db=require(_0x88cc('0x1a'))['db'];function respondWithStatusCode(_0x2219e1,_0x297ca5){_0x297ca5=_0x297ca5||0xcc;return function(_0x1289d0){if(_0x1289d0){return _0x2219e1[_0x88cc('0x1b')](_0x297ca5);}return _0x2219e1[_0x88cc('0x1c')](_0x297ca5)['end']();};}function respondWithResult(_0x20193f,_0x3d1a38){_0x3d1a38=_0x3d1a38||0xc8;return function(_0x3d462b){if(_0x3d462b){return _0x20193f[_0x88cc('0x1c')](_0x3d1a38)[_0x88cc('0x1d')](_0x3d462b);}};}function respondWithFilteredResult(_0x4255bb,_0x49741f){return function(_0x3305f3){if(_0x3305f3){var _0x468101=typeof _0x49741f[_0x88cc('0x1e')]===_0x88cc('0x1f')&&typeof _0x49741f[_0x88cc('0x20')]==='undefined';var _0x30edea=_0x3305f3[_0x88cc('0x21')];var _0x34fb65=_0x468101?0x0:_0x49741f[_0x88cc('0x1e')];var _0x33144a=_0x468101?_0x3305f3['count']:_0x49741f[_0x88cc('0x1e')]+_0x49741f[_0x88cc('0x20')];var _0x5dbfef;if(_0x33144a>=_0x30edea){_0x33144a=_0x30edea;_0x5dbfef=0xc8;}else{_0x5dbfef=0xce;}_0x4255bb[_0x88cc('0x1c')](_0x5dbfef);return _0x4255bb['set'](_0x88cc('0x22'),_0x34fb65+'-'+_0x33144a+'/'+_0x30edea)[_0x88cc('0x1d')](_0x3305f3);}return null;};}function patchUpdates(_0x50cdaf){return function(_0x2cfe2d){try{jsonpatch[_0x88cc('0x23')](_0x2cfe2d,_0x50cdaf,!![]);}catch(_0xe55e9d){return BPromise[_0x88cc('0x24')](_0xe55e9d);}return _0x2cfe2d[_0x88cc('0x25')]();};}function saveUpdates(_0xa2e3eb,_0x4e5edb){return function(_0x155635){if(_0x155635){return _0x155635[_0x88cc('0x26')](_0xa2e3eb)[_0x88cc('0x27')](function(_0xac6e45){return _0xac6e45;});}return null;};}function removeEntity(_0x443631,_0x3c2353){return function(_0x420279){if(_0x420279){return _0x420279[_0x88cc('0x28')]()[_0x88cc('0x27')](function(){_0x443631[_0x88cc('0x1c')](0xcc)[_0x88cc('0x29')]();});}};}function handleEntityNotFound(_0x35c695,_0x22d711){return function(_0x5657ef){if(!_0x5657ef){_0x35c695[_0x88cc('0x1b')](0x194);}return _0x5657ef;};}function handleError(_0x337bab,_0x44ae48){_0x44ae48=_0x44ae48||0x1f4;return function(_0x3474b6){logger[_0x88cc('0x2a')](_0x3474b6[_0x88cc('0x2b')]);if(_0x3474b6[_0x88cc('0x2c')]){delete _0x3474b6[_0x88cc('0x2c')];}_0x337bab['status'](_0x44ae48)['send'](_0x3474b6);};}exports[_0x88cc('0x2d')]=function(_0x45f1c6,_0x1c1d57){var _0x5b77ae={},_0x570ea0={},_0x18ced1={'count':0x0,'rows':[]};var _0x2cc552=_['map'](db[_0x88cc('0x2e')][_0x88cc('0x2f')],function(_0x10248e){return{'name':_0x10248e['fieldName'],'type':_0x10248e[_0x88cc('0x30')][_0x88cc('0x31')]};});_0x570ea0[_0x88cc('0x32')]=_['map'](_0x2cc552,_0x88cc('0x2c'));_0x570ea0[_0x88cc('0x33')]=_[_0x88cc('0x34')](_0x45f1c6[_0x88cc('0x33')]);_0x570ea0[_0x88cc('0x35')]=_[_0x88cc('0x36')](_0x570ea0['model'],_0x570ea0[_0x88cc('0x33')]);_0x5b77ae[_0x88cc('0x37')]=_[_0x88cc('0x36')](_0x570ea0[_0x88cc('0x32')],qs[_0x88cc('0x38')](_0x45f1c6[_0x88cc('0x33')][_0x88cc('0x38')]));_0x5b77ae['attributes']=_0x5b77ae['attributes'][_0x88cc('0x39')]?_0x5b77ae[_0x88cc('0x37')]:_0x570ea0[_0x88cc('0x32')];if(!_0x45f1c6[_0x88cc('0x33')][_0x88cc('0x3a')]('nolimit')){_0x5b77ae[_0x88cc('0x20')]=qs[_0x88cc('0x20')](_0x45f1c6[_0x88cc('0x33')][_0x88cc('0x20')]);_0x5b77ae[_0x88cc('0x1e')]=qs[_0x88cc('0x1e')](_0x45f1c6[_0x88cc('0x33')][_0x88cc('0x1e')]);}_0x5b77ae[_0x88cc('0x3b')]=qs[_0x88cc('0x3c')](_0x45f1c6[_0x88cc('0x33')][_0x88cc('0x3c')]);_0x5b77ae['where']=qs[_0x88cc('0x35')](_[_0x88cc('0x3d')](_0x45f1c6['query'],_0x570ea0[_0x88cc('0x35')]),_0x2cc552);if(_0x45f1c6['query']['filter']){_0x5b77ae['where']=_[_0x88cc('0x3e')](_0x5b77ae['where'],{'$or':_[_0x88cc('0x3f')](_0x2cc552,function(_0x1fb2ca){if(_0x1fb2ca['type']!==_0x88cc('0x40')){var _0x57ecf7={};_0x57ecf7[_0x1fb2ca[_0x88cc('0x2c')]]={'$like':'%'+_0x45f1c6['query'][_0x88cc('0x41')]+'%'};return _0x57ecf7;}})});}_0x5b77ae=_['merge']({},_0x5b77ae,_0x45f1c6[_0x88cc('0x42')]);var _0x35342a={'where':_0x5b77ae[_0x88cc('0x43')]};return db[_0x88cc('0x2e')]['count'](_0x35342a)[_0x88cc('0x27')](function(_0x510e5b){_0x18ced1[_0x88cc('0x21')]=_0x510e5b;if(_0x45f1c6[_0x88cc('0x33')][_0x88cc('0x44')]){_0x5b77ae[_0x88cc('0x45')]=[{'all':!![]}];}return db[_0x88cc('0x2e')][_0x88cc('0x46')](_0x5b77ae);})[_0x88cc('0x27')](function(_0x2138dd){_0x18ced1[_0x88cc('0x47')]=_0x2138dd;return _0x18ced1;})['then'](respondWithFilteredResult(_0x1c1d57,_0x5b77ae))[_0x88cc('0x48')](handleError(_0x1c1d57,null));};exports[_0x88cc('0x49')]=function(_0x1481df,_0x5af511){var _0x188fee={'raw':!![],'where':{'id':_0x1481df[_0x88cc('0x4a')]['id']}},_0x37ad9f={};_0x37ad9f['model']=_[_0x88cc('0x34')](db[_0x88cc('0x2e')][_0x88cc('0x2f')]);_0x37ad9f[_0x88cc('0x33')]=_[_0x88cc('0x34')](_0x1481df['query']);_0x37ad9f[_0x88cc('0x35')]=_[_0x88cc('0x36')](_0x37ad9f[_0x88cc('0x32')],_0x37ad9f[_0x88cc('0x33')]);_0x188fee[_0x88cc('0x37')]=_['intersection'](_0x37ad9f[_0x88cc('0x32')],qs['fields'](_0x1481df['query'][_0x88cc('0x38')]));_0x188fee[_0x88cc('0x37')]=_0x188fee['attributes']['length']?_0x188fee[_0x88cc('0x37')]:_0x37ad9f[_0x88cc('0x32')];if(_0x1481df[_0x88cc('0x33')][_0x88cc('0x44')]){_0x188fee['include']=[{'all':!![]}];}_0x188fee=_[_0x88cc('0x3e')]({},_0x188fee,_0x1481df[_0x88cc('0x42')]);return db[_0x88cc('0x2e')][_0x88cc('0x4b')](_0x188fee)[_0x88cc('0x27')](handleEntityNotFound(_0x5af511,null))[_0x88cc('0x27')](respondWithResult(_0x5af511,null))[_0x88cc('0x48')](handleError(_0x5af511,null));};exports[_0x88cc('0x4c')]=function(_0x14e889,_0x6615dd){return db[_0x88cc('0x2e')]['create'](_0x14e889[_0x88cc('0x4d')],{})[_0x88cc('0x27')](respondWithResult(_0x6615dd,0xc9))[_0x88cc('0x48')](handleError(_0x6615dd,null));};exports['update']=function(_0x2e04e5,_0xdc32cb){if(_0x2e04e5['body']['id']){delete _0x2e04e5[_0x88cc('0x4d')]['id'];}return db[_0x88cc('0x2e')][_0x88cc('0x4b')]({'where':{'id':_0x2e04e5[_0x88cc('0x4a')]['id']}})['then'](handleEntityNotFound(_0xdc32cb,null))[_0x88cc('0x27')](saveUpdates(_0x2e04e5[_0x88cc('0x4d')],null))['then'](respondWithResult(_0xdc32cb,null))[_0x88cc('0x48')](handleError(_0xdc32cb,null));};exports[_0x88cc('0x28')]=function(_0x14912f,_0xa043e){return db[_0x88cc('0x2e')][_0x88cc('0x4b')]({'where':{'id':_0x14912f[_0x88cc('0x4a')]['id']}})[_0x88cc('0x27')](handleEntityNotFound(_0xa043e,null))[_0x88cc('0x27')](removeEntity(_0xa043e,null))[_0x88cc('0x48')](handleError(_0xa043e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 714c8e4..b337bea 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 _0xe852=['moment','bluebird','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define','FreshdeskField','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x2f5a22,_0x5e9f03){var _0x326b70=function(_0x1b7bf9){while(--_0x1b7bf9){_0x2f5a22['push'](_0x2f5a22['shift']());}};_0x326b70(++_0x5e9f03);}(_0xe852,0x123));var _0x2e85=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0xe852[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require(_0x2e85('0x0'));var logger=require(_0x2e85('0x1'))(_0x2e85('0x2'));var moment=require(_0x2e85('0x3'));var BPromise=require(_0x2e85('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2e85('0x5'));var config=require(_0x2e85('0x6'));var attributes=require(_0x2e85('0x7'));module[_0x2e85('0x8')]=function(_0x2ca9f5,_0x26cc44){return _0x2ca9f5[_0x2e85('0x9')](_0x2e85('0xa'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x2e85('0xb'),'fields':[_0x2e85('0xc'),_0x2e85('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xadec=['FreshdeskField','freshdesk_unique_index','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x148c57,_0x3a6ac1){var _0x1c7c69=function(_0x32e318){while(--_0x32e318){_0x148c57['push'](_0x148c57['shift']());}};_0x1c7c69(++_0x3a6ac1);}(_0xadec,0x156));var _0xcade=function(_0x2ef3db,_0x43b9eb){_0x2ef3db=_0x2ef3db-0x0;var _0x1fe796=_0xadec[_0x2ef3db];return _0x1fe796;};'use strict';var _=require(_0xcade('0x0'));var util=require(_0xcade('0x1'));var logger=require(_0xcade('0x2'))(_0xcade('0x3'));var moment=require(_0xcade('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcade('0x5'));var config=require(_0xcade('0x6'));var attributes=require(_0xcade('0x7'));module['exports']=function(_0x4da887,_0x5c8b77){return _0x4da887['define'](_0xcade('0x8'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0xcade('0x9'),'fields':['idField','FieldId'],'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 32ed2d7..0ab9094 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 _0x3b59=['lodash','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x342030,_0xf3d901){var _0x31fdfb=function(_0x443457){while(--_0x443457){_0x342030['push'](_0x342030['shift']());}};_0x31fdfb(++_0xf3d901);}(_0x3b59,0x64));var _0x93b5=function(_0x1083f0,_0x190add){_0x1083f0=_0x1083f0-0x0;var _0x3e671f=_0x3b59[_0x1083f0];return _0x3e671f;};'use strict';var _=require(_0x93b5('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x93b5('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93b5('0x2'))['db'];var utils=require(_0x93b5('0x3'));var logger=require('../../config/logger')(_0x93b5('0x4'));var config=require(_0x93b5('0x5'));var jayson=require(_0x93b5('0x6'));var client=jayson[_0x93b5('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35385b,_0x771590,_0x313345){return new BPromise(function(_0x28d3a7,_0x14de92){return client[_0x93b5('0x8')](_0x35385b,_0x313345)[_0x93b5('0x9')](function(_0xda8527){logger[_0x93b5('0xa')](_0x93b5('0xb'),_0x771590,_0x93b5('0xc'));logger[_0x93b5('0xd')](_0x93b5('0xe'),_0x771590,'request\x20sent',JSON['stringify'](_0xda8527));if(_0xda8527[_0x93b5('0xf')]){if(_0xda8527['error'][_0x93b5('0x10')]===0x1f4){logger[_0x93b5('0xf')](_0x93b5('0xb'),_0x771590,_0xda8527[_0x93b5('0xf')][_0x93b5('0x11')]);return _0x14de92(_0xda8527[_0x93b5('0xf')][_0x93b5('0x11')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x771590,_0xda8527['error']['message']);return _0x28d3a7(_0xda8527['error'][_0x93b5('0x11')]);}else{logger[_0x93b5('0xa')]('FreshdeskField,\x20%s,\x20%s',_0x771590,'request\x20sent');_0x28d3a7(_0xda8527[_0x93b5('0x12')][_0x93b5('0x11')]);}})[_0x93b5('0x13')](function(_0x12c77a){logger[_0x93b5('0xf')](_0x93b5('0xb'),_0x771590,_0x12c77a);_0x14de92(_0x12c77a);});});} \ No newline at end of file +var _0xa480=['jayson/promise','client','http','then','info','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0xa480,0x184));var _0x0a48=function(_0x2e2681,_0x4089c1){_0x2e2681=_0x2e2681-0x0;var _0x368a64=_0xa480[_0x2e2681];return _0x368a64;};'use strict';var _=require(_0x0a48('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x0a48('0x1'));var rs=require(_0x0a48('0x2'));var fs=require('fs');var Redis=require(_0x0a48('0x3'));var db=require(_0x0a48('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a48('0x5'))(_0x0a48('0x6'));var config=require(_0x0a48('0x7'));var jayson=require(_0x0a48('0x8'));var client=jayson[_0x0a48('0x9')][_0x0a48('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20bacf,_0x99e9c6,_0x354218){return new BPromise(function(_0x45ae79,_0x5d081f){return client['request'](_0x20bacf,_0x354218)[_0x0a48('0xb')](function(_0x57e820){logger[_0x0a48('0xc')](_0x0a48('0xd'),_0x99e9c6,_0x0a48('0xe'));logger[_0x0a48('0xf')](_0x0a48('0x10'),_0x99e9c6,_0x0a48('0xe'),JSON[_0x0a48('0x11')](_0x57e820));if(_0x57e820['error']){if(_0x57e820[_0x0a48('0x12')][_0x0a48('0x13')]===0x1f4){logger[_0x0a48('0x12')](_0x0a48('0xd'),_0x99e9c6,_0x57e820[_0x0a48('0x12')][_0x0a48('0x14')]);return _0x5d081f(_0x57e820[_0x0a48('0x12')][_0x0a48('0x14')]);}logger[_0x0a48('0x12')](_0x0a48('0xd'),_0x99e9c6,_0x57e820['error'][_0x0a48('0x14')]);return _0x45ae79(_0x57e820[_0x0a48('0x12')]['message']);}else{logger[_0x0a48('0xc')](_0x0a48('0xd'),_0x99e9c6,_0x0a48('0xe'));_0x45ae79(_0x57e820[_0x0a48('0x15')][_0x0a48('0x14')]);}})['catch'](function(_0x5eee95){logger[_0x0a48('0x12')](_0x0a48('0xd'),_0x99e9c6,_0x5eee95);_0x5d081f(_0x5eee95);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index db0552e..9cc07cc 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 _0xe205=['./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','/:id','update','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xc0a3d3,_0x2c8d00){var _0x3386e8=function(_0x3f9df4){while(--_0x3f9df4){_0xc0a3d3['push'](_0xc0a3d3['shift']());}};_0x3386e8(++_0x2c8d00);}(_0xe205,0xa7));var _0x5e20=function(_0x1d40b3,_0x35397f){_0x1d40b3=_0x1d40b3-0x0;var _0x18129d=_0xe205[_0x1d40b3];return _0x18129d;};'use strict';var multer=require(_0x5e20('0x0'));var util=require(_0x5e20('0x1'));var path=require(_0x5e20('0x2'));var timeout=require(_0x5e20('0x3'));var express=require(_0x5e20('0x4'));var router=express[_0x5e20('0x5')]();var fs_extra=require(_0x5e20('0x6'));var auth=require(_0x5e20('0x7'));var interaction=require(_0x5e20('0x8'));var config=require('../../config/environment');var controller=require(_0x5e20('0x9'));router[_0x5e20('0xa')]('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0xc')]);router['get']('/:id',auth[_0x5e20('0xb')](),controller['show']);router['get'](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller['getConfigurations']);router[_0x5e20('0xa')](_0x5e20('0xe'),auth[_0x5e20('0xb')](),controller[_0x5e20('0xf')]);router['post']('/',auth[_0x5e20('0xb')](),controller[_0x5e20('0x10')]);router[_0x5e20('0x11')](_0x5e20('0xd'),auth[_0x5e20('0xb')](),controller[_0x5e20('0x12')]);router['put'](_0x5e20('0x13'),auth[_0x5e20('0xb')](),controller[_0x5e20('0x14')]);router['delete'](_0x5e20('0x13'),auth['isAuthenticated'](),controller[_0x5e20('0x15')]);module['exports']=router; \ No newline at end of file +var _0x34b7=['getFields','post','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','show'];(function(_0x39e283,_0x247e6b){var _0x7de89f=function(_0x2f8c50){while(--_0x2f8c50){_0x39e283['push'](_0x39e283['shift']());}};_0x7de89f(++_0x247e6b);}(_0x34b7,0x196));var _0x734b=function(_0x1ca993,_0x243c1e){_0x1ca993=_0x1ca993-0x0;var _0x150e5e=_0x34b7[_0x1ca993];return _0x150e5e;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x734b('0x0'));var timeout=require(_0x734b('0x1'));var express=require(_0x734b('0x2'));var router=express[_0x734b('0x3')]();var fs_extra=require(_0x734b('0x4'));var auth=require(_0x734b('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x734b('0x6'));router[_0x734b('0x7')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0x9')]);router[_0x734b('0x7')](_0x734b('0xa'),auth['isAuthenticated'](),controller[_0x734b('0xb')]);router[_0x734b('0x7')]('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router[_0x734b('0x7')]('/:id/fields',auth[_0x734b('0x8')](),controller[_0x734b('0xc')]);router[_0x734b('0xd')]('/',auth[_0x734b('0x8')](),controller[_0x734b('0xe')]);router[_0x734b('0xd')](_0x734b('0xf'),auth[_0x734b('0x8')](),controller[_0x734b('0x10')]);router[_0x734b('0x11')](_0x734b('0xa'),auth[_0x734b('0x8')](),controller[_0x734b('0x12')]);router[_0x734b('0x13')]('/:id',auth[_0x734b('0x8')](),controller[_0x734b('0x14')]);module[_0x734b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 1f12b07..5293efc 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 _0x77d4=['exports','STRING','username'];(function(_0x3c719e,_0x19719d){var _0x2d09af=function(_0x5b1e8a){while(--_0x5b1e8a){_0x3c719e['push'](_0x3c719e['shift']());}};_0x2d09af(++_0x19719d);}(_0x77d4,0x108));var _0x477d=function(_0x2bd66c,_0x4c3f5d){_0x2bd66c=_0x2bd66c-0x0;var _0x2cdcf5=_0x77d4[_0x2bd66c];return _0x2cdcf5;};'use strict';var Sequelize=require('sequelize');module[_0x477d('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x477d('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x477d('0x2')},'apiKey':{'type':Sequelize[_0x477d('0x1')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x477d('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x524e=['username','remoteUri','STRING'];(function(_0x7538c5,_0xa5d8ac){var _0x8b56be=function(_0x2036c0){while(--_0x2036c0){_0x7538c5['push'](_0x7538c5['shift']());}};_0x8b56be(++_0xa5d8ac);}(_0x524e,0x15e));var _0xe524=function(_0x5d2b99,_0x2cc6cf){_0x5d2b99=_0x5d2b99-0x0;var _0xe12851=_0x524e[_0x5d2b99];return _0xe12851;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe524('0x0')]},'description':{'type':Sequelize[_0xe524('0x0')]},'username':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x1')},'apiKey':{'type':Sequelize[_0xe524('0x0')]},'remoteUri':{'type':Sequelize[_0xe524('0x0')],'unique':_0xe524('0x2')},'serverUrl':{'type':Sequelize[_0xe524('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index 3e29fd9..f6f8f59 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 _0x9b5a=['mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','merge','include','findAll','rows','show','params','includeAll','options','find','create','catch','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','FreshsalesConfiguration','FreshsalesField','Descriptions','getFields','username','remoteUri','substring','GET','format','%s%s','Token\x20token=','apiKey','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x38b78b,_0x110ea6){var _0x55a5ce=function(_0x23d241){while(--_0x23d241){_0x38b78b['push'](_0x38b78b['shift']());}};_0x55a5ce(++_0x110ea6);}(_0x9b5a,0x129));var _0xa9b5=function(_0x22b398,_0x28095d){_0x22b398=_0x22b398-0x0;var _0x34276f=_0x9b5a[_0x22b398];return _0x34276f;};'use strict';var emlformat=require(_0xa9b5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa9b5('0x1'));var jsonpatch=require(_0xa9b5('0x2'));var rp=require(_0xa9b5('0x3'));var moment=require(_0xa9b5('0x4'));var BPromise=require(_0xa9b5('0x5'));var Mustache=require(_0xa9b5('0x6'));var util=require(_0xa9b5('0x7'));var path=require(_0xa9b5('0x8'));var sox=require(_0xa9b5('0x9'));var csv=require(_0xa9b5('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa9b5('0xb'));var squel=require(_0xa9b5('0xc'));var crypto=require(_0xa9b5('0xd'));var jsforce=require(_0xa9b5('0xe'));var deskjs=require(_0xa9b5('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa9b5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa9b5('0x11'));var logger=require(_0xa9b5('0x12'))('api');var utils=require(_0xa9b5('0x13'));var config=require(_0xa9b5('0x14'));var licenseUtil=require(_0xa9b5('0x15'));var db=require(_0xa9b5('0x16'))['db'];var integrations=require(_0xa9b5('0x17'));function respondWithStatusCode(_0x42656c,_0x491828){_0x491828=_0x491828||0xcc;return function(_0x7f532a){if(_0x7f532a){return _0x42656c[_0xa9b5('0x18')](_0x491828);}return _0x42656c[_0xa9b5('0x19')](_0x491828)[_0xa9b5('0x1a')]();};}function respondWithResult(_0x319547,_0x328c39){_0x328c39=_0x328c39||0xc8;return function(_0x37afe6){if(_0x37afe6){return _0x319547[_0xa9b5('0x19')](_0x328c39)[_0xa9b5('0x1b')](_0x37afe6);}};}function respondWithFilteredResult(_0x584e19,_0x3c992e){return function(_0x136127){if(_0x136127){var _0xd6a1b7=typeof _0x3c992e['offset']===_0xa9b5('0x1c')&&typeof _0x3c992e[_0xa9b5('0x1d')]===_0xa9b5('0x1c');var _0x3aabab=_0x136127['count'];var _0x20cb7f=_0xd6a1b7?0x0:_0x3c992e['offset'];var _0x13b981=_0xd6a1b7?_0x136127[_0xa9b5('0x1e')]:_0x3c992e[_0xa9b5('0x1f')]+_0x3c992e['limit'];var _0x1b5b77;if(_0x13b981>=_0x3aabab){_0x13b981=_0x3aabab;_0x1b5b77=0xc8;}else{_0x1b5b77=0xce;}_0x584e19[_0xa9b5('0x19')](_0x1b5b77);return _0x584e19[_0xa9b5('0x20')](_0xa9b5('0x21'),_0x20cb7f+'-'+_0x13b981+'/'+_0x3aabab)[_0xa9b5('0x1b')](_0x136127);}return null;};}function patchUpdates(_0x58746c){return function(_0xd50c5b){try{jsonpatch['apply'](_0xd50c5b,_0x58746c,!![]);}catch(_0x3e1f36){return BPromise[_0xa9b5('0x22')](_0x3e1f36);}return _0xd50c5b[_0xa9b5('0x23')]();};}function saveUpdates(_0x4df124,_0x1e2627){return function(_0xdce162){if(_0xdce162){return _0xdce162[_0xa9b5('0x24')](_0x4df124)[_0xa9b5('0x25')](function(_0x2501b3){return _0x2501b3;});}return null;};}function removeEntity(_0x1490ea,_0x2f5b5e){return function(_0x577b26){if(_0x577b26){return _0x577b26['destroy']()[_0xa9b5('0x25')](function(){_0x1490ea[_0xa9b5('0x19')](0xcc)[_0xa9b5('0x1a')]();});}};}function handleEntityNotFound(_0x33c33f,_0x5c8b69){return function(_0x3b2acf){if(!_0x3b2acf){_0x33c33f[_0xa9b5('0x18')](0x194);}return _0x3b2acf;};}function handleError(_0x3afbea,_0x56a1fd){_0x56a1fd=_0x56a1fd||0x1f4;return function(_0x304f3d){logger[_0xa9b5('0x26')](_0x304f3d[_0xa9b5('0x27')]);if(_0x304f3d[_0xa9b5('0x28')]){delete _0x304f3d[_0xa9b5('0x28')];}_0x3afbea[_0xa9b5('0x19')](_0x56a1fd)[_0xa9b5('0x29')](_0x304f3d);};}exports[_0xa9b5('0x2a')]=function(_0x2b4f34,_0xef4807){var _0x24aa5f={},_0x3d9014={},_0x477d31={'count':0x0,'rows':[]};var _0x39791e=_[_0xa9b5('0x2b')](db[_0xa9b5('0x2c')][_0xa9b5('0x2d')],function(_0x636d6e){return{'name':_0x636d6e[_0xa9b5('0x2e')],'type':_0x636d6e[_0xa9b5('0x2f')][_0xa9b5('0x30')]};});_0x3d9014[_0xa9b5('0x31')]=_['map'](_0x39791e,'name');_0x3d9014[_0xa9b5('0x32')]=_[_0xa9b5('0x33')](_0x2b4f34[_0xa9b5('0x32')]);_0x3d9014['filters']=_[_0xa9b5('0x34')](_0x3d9014[_0xa9b5('0x31')],_0x3d9014[_0xa9b5('0x32')]);_0x24aa5f[_0xa9b5('0x35')]=_[_0xa9b5('0x34')](_0x3d9014[_0xa9b5('0x31')],qs[_0xa9b5('0x36')](_0x2b4f34[_0xa9b5('0x32')][_0xa9b5('0x36')]));_0x24aa5f['attributes']=_0x24aa5f[_0xa9b5('0x35')][_0xa9b5('0x37')]?_0x24aa5f[_0xa9b5('0x35')]:_0x3d9014[_0xa9b5('0x31')];if(!_0x2b4f34[_0xa9b5('0x32')][_0xa9b5('0x38')]('nolimit')){_0x24aa5f[_0xa9b5('0x1d')]=qs[_0xa9b5('0x1d')](_0x2b4f34[_0xa9b5('0x32')]['limit']);_0x24aa5f[_0xa9b5('0x1f')]=qs['offset'](_0x2b4f34[_0xa9b5('0x32')][_0xa9b5('0x1f')]);}_0x24aa5f[_0xa9b5('0x39')]=qs[_0xa9b5('0x3a')](_0x2b4f34[_0xa9b5('0x32')][_0xa9b5('0x3a')]);_0x24aa5f[_0xa9b5('0x3b')]=qs[_0xa9b5('0x3c')](_[_0xa9b5('0x3d')](_0x2b4f34[_0xa9b5('0x32')],_0x3d9014[_0xa9b5('0x3c')]),_0x39791e);if(_0x2b4f34['query'][_0xa9b5('0x3e')]){_0x24aa5f[_0xa9b5('0x3b')]=_['merge'](_0x24aa5f['where'],{'$or':_[_0xa9b5('0x2b')](_0x39791e,function(_0x4a49b0){if(_0x4a49b0[_0xa9b5('0x2f')]!==_0xa9b5('0x3f')){var _0x3f4dbf={};_0x3f4dbf[_0x4a49b0['name']]={'$like':'%'+_0x2b4f34[_0xa9b5('0x32')][_0xa9b5('0x3e')]+'%'};return _0x3f4dbf;}})});}_0x24aa5f=_[_0xa9b5('0x40')]({},_0x24aa5f,_0x2b4f34['options']);var _0x3b1e37={'where':_0x24aa5f['where']};return db['FreshsalesAccount'][_0xa9b5('0x1e')](_0x3b1e37)[_0xa9b5('0x25')](function(_0x4e4e53){_0x477d31[_0xa9b5('0x1e')]=_0x4e4e53;if(_0x2b4f34[_0xa9b5('0x32')]['includeAll']){_0x24aa5f[_0xa9b5('0x41')]=[{'all':!![]}];}return db[_0xa9b5('0x2c')][_0xa9b5('0x42')](_0x24aa5f);})[_0xa9b5('0x25')](function(_0x536b94){_0x477d31[_0xa9b5('0x43')]=_0x536b94;return _0x477d31;})[_0xa9b5('0x25')](respondWithFilteredResult(_0xef4807,_0x24aa5f))['catch'](handleError(_0xef4807,null));};exports[_0xa9b5('0x44')]=function(_0x224447,_0x3f376b){var _0x344026={'raw':![],'where':{'id':_0x224447[_0xa9b5('0x45')]['id']}},_0x3874ec={};_0x3874ec[_0xa9b5('0x31')]=_[_0xa9b5('0x33')](db[_0xa9b5('0x2c')][_0xa9b5('0x2d')]);_0x3874ec['query']=_[_0xa9b5('0x33')](_0x224447[_0xa9b5('0x32')]);_0x3874ec[_0xa9b5('0x3c')]=_[_0xa9b5('0x34')](_0x3874ec[_0xa9b5('0x31')],_0x3874ec[_0xa9b5('0x32')]);_0x344026[_0xa9b5('0x35')]=_[_0xa9b5('0x34')](_0x3874ec[_0xa9b5('0x31')],qs[_0xa9b5('0x36')](_0x224447[_0xa9b5('0x32')][_0xa9b5('0x36')]));_0x344026[_0xa9b5('0x35')]=_0x344026['attributes'][_0xa9b5('0x37')]?_0x344026[_0xa9b5('0x35')]:_0x3874ec[_0xa9b5('0x31')];if(_0x224447[_0xa9b5('0x32')][_0xa9b5('0x46')]){_0x344026[_0xa9b5('0x41')]=[{'all':!![]}];}_0x344026=_[_0xa9b5('0x40')]({},_0x344026,_0x224447[_0xa9b5('0x47')]);return db['FreshsalesAccount'][_0xa9b5('0x48')](_0x344026)[_0xa9b5('0x25')](handleEntityNotFound(_0x3f376b,null))[_0xa9b5('0x25')](respondWithResult(_0x3f376b,null))['catch'](handleError(_0x3f376b,null));};exports[_0xa9b5('0x49')]=function(_0x14d68d,_0x3ea06b){return db[_0xa9b5('0x2c')][_0xa9b5('0x49')](_0x14d68d['body'],{})['then'](respondWithResult(_0x3ea06b,0xc9))[_0xa9b5('0x4a')](handleError(_0x3ea06b,null));};exports[_0xa9b5('0x24')]=function(_0x5313fc,_0x3a75bc){if(_0x5313fc[_0xa9b5('0x4b')]['id']){delete _0x5313fc['body']['id'];}return db['FreshsalesAccount']['find']({'where':{'id':_0x5313fc[_0xa9b5('0x45')]['id']}})['then'](handleEntityNotFound(_0x3a75bc,null))['then'](saveUpdates(_0x5313fc[_0xa9b5('0x4b')],null))[_0xa9b5('0x25')](respondWithResult(_0x3a75bc,null))['catch'](handleError(_0x3a75bc,null));};exports['destroy']=function(_0x2be3b6,_0x28580c){return db[_0xa9b5('0x2c')][_0xa9b5('0x48')]({'where':{'id':_0x2be3b6['params']['id']}})['then'](handleEntityNotFound(_0x28580c,null))[_0xa9b5('0x25')](removeEntity(_0x28580c,null))[_0xa9b5('0x4a')](handleError(_0x28580c,null));};exports[_0xa9b5('0x4c')]=function(_0x34c7c9,_0x24ca91,_0x19c37b){var _0x4a29d7={};var _0x5bb65f={};var _0x5ee9fa;var _0x50a3d1;return db[_0xa9b5('0x2c')][_0xa9b5('0x4d')]({'where':{'id':_0x34c7c9[_0xa9b5('0x45')]['id']}})['then'](handleEntityNotFound(_0x24ca91,null))[_0xa9b5('0x25')](function(_0x33bed8){if(_0x33bed8){_0x5ee9fa=_0x33bed8;_0x5bb65f['model']=_[_0xa9b5('0x33')](db['FreshsalesConfiguration']['rawAttributes']);_0x5bb65f[_0xa9b5('0x32')]=_[_0xa9b5('0x33')](_0x34c7c9[_0xa9b5('0x32')]);_0x5bb65f[_0xa9b5('0x3c')]=_[_0xa9b5('0x34')](_0x5bb65f[_0xa9b5('0x31')],_0x5bb65f[_0xa9b5('0x32')]);_0x4a29d7[_0xa9b5('0x35')]=_[_0xa9b5('0x34')](_0x5bb65f['model'],qs['fields'](_0x34c7c9[_0xa9b5('0x32')][_0xa9b5('0x36')]));_0x4a29d7[_0xa9b5('0x35')]=_0x4a29d7[_0xa9b5('0x35')][_0xa9b5('0x37')]?_0x4a29d7[_0xa9b5('0x35')]:_0x5bb65f[_0xa9b5('0x31')];_0x4a29d7[_0xa9b5('0x39')]=qs[_0xa9b5('0x3a')](_0x34c7c9['query']['sort']);_0x4a29d7[_0xa9b5('0x3b')]=qs[_0xa9b5('0x3c')](_[_0xa9b5('0x3d')](_0x34c7c9['query'],_0x5bb65f[_0xa9b5('0x3c')]));if(_0x34c7c9[_0xa9b5('0x32')][_0xa9b5('0x3e')]){_0x4a29d7[_0xa9b5('0x3b')]=_[_0xa9b5('0x40')](_0x4a29d7[_0xa9b5('0x3b')],{'$or':_[_0xa9b5('0x2b')](_0x4a29d7[_0xa9b5('0x35')],function(_0x203f13){var _0x525c53={};_0x525c53[_0x203f13]={'$like':'%'+_0x34c7c9[_0xa9b5('0x32')][_0xa9b5('0x3e')]+'%'};return _0x525c53;})});}_0x4a29d7=_[_0xa9b5('0x40')]({},_0x4a29d7,_0x34c7c9[_0xa9b5('0x47')]);return _0x5ee9fa[_0xa9b5('0x4c')](_0x4a29d7);}})['then'](function(_0x5c8560){if(_0x5c8560){_0x50a3d1=_0x5c8560[_0xa9b5('0x37')];if(!_0x34c7c9['query'][_0xa9b5('0x38')]('nolimit')){_0x4a29d7['limit']=qs[_0xa9b5('0x1d')](_0x34c7c9[_0xa9b5('0x32')][_0xa9b5('0x1d')]);_0x4a29d7['offset']=qs[_0xa9b5('0x1f')](_0x34c7c9[_0xa9b5('0x32')]['offset']);}return _0x5ee9fa[_0xa9b5('0x4c')](_0x4a29d7);}})[_0xa9b5('0x25')](function(_0x352d03){if(_0x352d03){return _0x352d03?{'count':_0x50a3d1,'rows':_0x352d03}:null;}})[_0xa9b5('0x25')](respondWithResult(_0x24ca91,null))[_0xa9b5('0x4a')](handleError(_0x24ca91,null));};exports[_0xa9b5('0x4e')]=function(_0x3d0a21,_0x200960,_0x4767c2){if(_0x3d0a21[_0xa9b5('0x4b')]['id']){delete _0x3d0a21[_0xa9b5('0x4b')]['id'];}return db[_0xa9b5('0x2c')][_0xa9b5('0x4d')]({'where':{'id':_0x3d0a21['params']['id']}})[_0xa9b5('0x25')](handleEntityNotFound(_0x200960,null))[_0xa9b5('0x25')](function(_0x3d23ae){if(_0x3d23ae){_0x3d0a21[_0xa9b5('0x4b')][_0xa9b5('0x4f')]=_0x3d23ae['id'];_0x3d0a21[_0xa9b5('0x4b')][_0xa9b5('0x50')]=integrations[_0xa9b5('0x51')](_0x3d0a21[_0xa9b5('0x4b')][_0xa9b5('0x52')],_0x3d0a21['body']['type']);_0x3d0a21[_0xa9b5('0x4b')]['Descriptions']=integrations['getDescriptions'](_0x3d0a21[_0xa9b5('0x4b')][_0xa9b5('0x52')],_0x3d0a21['body'][_0xa9b5('0x2f')]);return db[_0xa9b5('0x53')][_0xa9b5('0x49')](_0x3d0a21[_0xa9b5('0x4b')],{'include':[{'model':db[_0xa9b5('0x54')],'as':'Subjects'},{'model':db['FreshsalesField'],'as':_0xa9b5('0x55')}]});}return null;})[_0xa9b5('0x25')](respondWithResult(_0x200960,null))['catch'](handleError(_0x200960,null));};exports[_0xa9b5('0x56')]=function(_0x1ad68f,_0x4d7b83,_0xe9558e){var _0x58946f='';var _0x1f370a='';return db[_0xa9b5('0x2c')]['findOne']({'where':{'id':_0x1ad68f['params']['id']},'attributes':['id',_0xa9b5('0x57'),_0xa9b5('0x58'),'apiKey']})[_0xa9b5('0x25')](handleEntityNotFound(_0x4d7b83,null))[_0xa9b5('0x25')](function(_0x4c93ac){if(_0x4c93ac){_0x1f370a=_0x4c93ac[_0xa9b5('0x57')];_0x58946f=_0x4c93ac[_0xa9b5('0x58')];var _0x4ad354=_0x4c93ac[_0xa9b5('0x58')]['slice'](-0x1);if(_0x4ad354==='/'){_0x58946f=_0x58946f[_0xa9b5('0x59')](0x0,_0x58946f['lastIndexOf'](_0x4ad354));}return rp({'method':_0xa9b5('0x5a'),'uri':util[_0xa9b5('0x5b')](_0xa9b5('0x5c'),_0x58946f,'/api/selector/owners'),'headers':{'Authorization':_0xa9b5('0x5d')+_0x4c93ac[_0xa9b5('0x5e')]},'json':!![]});}})[_0xa9b5('0x25')](function(_0x3968f1){if(_0x3968f1){var _0x5211f0=_0x3968f1['users'];var _0x570398=![];var _0x63416c=null;for(_0x63416c=0x0;_0x63416c<_0x5211f0[_0xa9b5('0x37')];_0x63416c++){if(_0x5211f0[_0x63416c][_0xa9b5('0x5f')]===_0x1f370a){_0x570398=!![];}}if(_0x570398){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa9b5('0x60')});}}})[_0xa9b5('0x25')](respondWithResult(_0x4d7b83,null))[_0xa9b5('0x4a')](function(_0x591888){var _0x5f16ae=_0x1ad68f[_0xa9b5('0x32')][_0xa9b5('0x61')]?0x1f4:_0x591888[_0xa9b5('0x62')]||0x1f4;logger['error'](_0xa9b5('0x63'),_0xa9b5('0x56'),_0x5f16ae,JSON[_0xa9b5('0x64')](_0x591888));delete _0x591888['name'];if(_0x5f16ae===0x191){_0x5f16ae=0x190;}_0x4d7b83['status'](_0x5f16ae)['send'](_0x1ad68f[_0xa9b5('0x32')][_0xa9b5('0x61')]?{'message':'Wrong\x20credentials','statusCode':_0x591888[_0xa9b5('0x62')]}:_0x591888);});}; \ No newline at end of file +var _0x5fe2=['../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','error','stack','name','send','index','map','FreshsalesAccount','rawAttributes','fieldName','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','getConfigurations','findOne','FreshsalesConfiguration','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','channel','FreshsalesField','username','remoteUri','slice','substring','GET','/api/selector/owners','Token\x20token=','apiKey','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','moment','sox','ejs','lodash','squel','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils'];(function(_0x49a4e3,_0x1cc52e){var _0x1e96be=function(_0x184bdd){while(--_0x184bdd){_0x49a4e3['push'](_0x49a4e3['shift']());}};_0x1e96be(++_0x1cc52e);}(_0x5fe2,0x1df));var _0x25fe=function(_0xe83615,_0x336c25){_0xe83615=_0xe83615-0x0;var _0x201b0b=_0x5fe2[_0xe83615];return _0x201b0b;};'use strict';var emlformat=require(_0x25fe('0x0'));var rimraf=require(_0x25fe('0x1'));var zipdir=require(_0x25fe('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x25fe('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x25fe('0x4'));var csv=require('to-csv');var ejs=require(_0x25fe('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x25fe('0x6'));var squel=require(_0x25fe('0x7'));var crypto=require('crypto');var jsforce=require(_0x25fe('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x25fe('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x25fe('0xa'));var authService=require(_0x25fe('0xb'));var qs=require(_0x25fe('0xc'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x25fe('0xd'));var logger=require('../../config/logger')(_0x25fe('0xe'));var utils=require(_0x25fe('0xf'));var config=require(_0x25fe('0x10'));var licenseUtil=require(_0x25fe('0x11'));var db=require(_0x25fe('0x12'))['db'];var integrations=require(_0x25fe('0x13'));function respondWithStatusCode(_0x1482ec,_0x4a420b){_0x4a420b=_0x4a420b||0xcc;return function(_0x16fe30){if(_0x16fe30){return _0x1482ec[_0x25fe('0x14')](_0x4a420b);}return _0x1482ec['status'](_0x4a420b)[_0x25fe('0x15')]();};}function respondWithResult(_0x39736d,_0x33a185){_0x33a185=_0x33a185||0xc8;return function(_0x1e2066){if(_0x1e2066){return _0x39736d[_0x25fe('0x16')](_0x33a185)[_0x25fe('0x17')](_0x1e2066);}};}function respondWithFilteredResult(_0x2e86a3,_0x39ba20){return function(_0x6b7d7f){if(_0x6b7d7f){var _0xa2068f=typeof _0x39ba20[_0x25fe('0x18')]===_0x25fe('0x19')&&typeof _0x39ba20[_0x25fe('0x1a')]===_0x25fe('0x19');var _0x2ec098=_0x6b7d7f[_0x25fe('0x1b')];var _0x441b34=_0xa2068f?0x0:_0x39ba20[_0x25fe('0x18')];var _0x1158ef=_0xa2068f?_0x6b7d7f['count']:_0x39ba20[_0x25fe('0x18')]+_0x39ba20['limit'];var _0x46fda9;if(_0x1158ef>=_0x2ec098){_0x1158ef=_0x2ec098;_0x46fda9=0xc8;}else{_0x46fda9=0xce;}_0x2e86a3[_0x25fe('0x16')](_0x46fda9);return _0x2e86a3[_0x25fe('0x1c')](_0x25fe('0x1d'),_0x441b34+'-'+_0x1158ef+'/'+_0x2ec098)[_0x25fe('0x17')](_0x6b7d7f);}return null;};}function patchUpdates(_0x47aff4){return function(_0x537925){try{jsonpatch['apply'](_0x537925,_0x47aff4,!![]);}catch(_0x1bb365){return BPromise[_0x25fe('0x1e')](_0x1bb365);}return _0x537925[_0x25fe('0x1f')]();};}function saveUpdates(_0x36938f,_0x359a96){return function(_0x421661){if(_0x421661){return _0x421661['update'](_0x36938f)['then'](function(_0x191493){return _0x191493;});}return null;};}function removeEntity(_0x103798,_0x3558f6){return function(_0x53cdbe){if(_0x53cdbe){return _0x53cdbe[_0x25fe('0x20')]()[_0x25fe('0x21')](function(){_0x103798['status'](0xcc)[_0x25fe('0x15')]();});}};}function handleEntityNotFound(_0x18d986,_0x5ec09c){return function(_0x32c0df){if(!_0x32c0df){_0x18d986['sendStatus'](0x194);}return _0x32c0df;};}function handleError(_0x4f0ca1,_0x716c1f){_0x716c1f=_0x716c1f||0x1f4;return function(_0x4eed3f){logger[_0x25fe('0x22')](_0x4eed3f[_0x25fe('0x23')]);if(_0x4eed3f[_0x25fe('0x24')]){delete _0x4eed3f['name'];}_0x4f0ca1['status'](_0x716c1f)[_0x25fe('0x25')](_0x4eed3f);};}exports[_0x25fe('0x26')]=function(_0xf1a2e3,_0x1e3782){var _0x42f0af={},_0xd32d12={},_0x4be870={'count':0x0,'rows':[]};var _0x4c5281=_[_0x25fe('0x27')](db[_0x25fe('0x28')][_0x25fe('0x29')],function(_0x30872f){return{'name':_0x30872f[_0x25fe('0x2a')],'type':_0x30872f['type'][_0x25fe('0x2b')]};});_0xd32d12['model']=_[_0x25fe('0x27')](_0x4c5281,_0x25fe('0x24'));_0xd32d12[_0x25fe('0x2c')]=_[_0x25fe('0x2d')](_0xf1a2e3['query']);_0xd32d12['filters']=_[_0x25fe('0x2e')](_0xd32d12[_0x25fe('0x2f')],_0xd32d12['query']);_0x42f0af[_0x25fe('0x30')]=_['intersection'](_0xd32d12[_0x25fe('0x2f')],qs['fields'](_0xf1a2e3[_0x25fe('0x2c')][_0x25fe('0x31')]));_0x42f0af[_0x25fe('0x30')]=_0x42f0af[_0x25fe('0x30')]['length']?_0x42f0af[_0x25fe('0x30')]:_0xd32d12['model'];if(!_0xf1a2e3['query'][_0x25fe('0x32')](_0x25fe('0x33'))){_0x42f0af[_0x25fe('0x1a')]=qs[_0x25fe('0x1a')](_0xf1a2e3['query'][_0x25fe('0x1a')]);_0x42f0af[_0x25fe('0x18')]=qs[_0x25fe('0x18')](_0xf1a2e3[_0x25fe('0x2c')]['offset']);}_0x42f0af['order']=qs[_0x25fe('0x34')](_0xf1a2e3[_0x25fe('0x2c')][_0x25fe('0x34')]);_0x42f0af[_0x25fe('0x35')]=qs[_0x25fe('0x36')](_[_0x25fe('0x37')](_0xf1a2e3['query'],_0xd32d12['filters']),_0x4c5281);if(_0xf1a2e3['query'][_0x25fe('0x38')]){_0x42f0af[_0x25fe('0x35')]=_[_0x25fe('0x39')](_0x42f0af['where'],{'$or':_['map'](_0x4c5281,function(_0x3b0672){if(_0x3b0672[_0x25fe('0x3a')]!=='VIRTUAL'){var _0x5994f0={};_0x5994f0[_0x3b0672[_0x25fe('0x24')]]={'$like':'%'+_0xf1a2e3['query'][_0x25fe('0x38')]+'%'};return _0x5994f0;}})});}_0x42f0af=_[_0x25fe('0x39')]({},_0x42f0af,_0xf1a2e3[_0x25fe('0x3b')]);var _0x7735e3={'where':_0x42f0af[_0x25fe('0x35')]};return db[_0x25fe('0x28')]['count'](_0x7735e3)[_0x25fe('0x21')](function(_0x1da71a){_0x4be870[_0x25fe('0x1b')]=_0x1da71a;if(_0xf1a2e3[_0x25fe('0x2c')][_0x25fe('0x3c')]){_0x42f0af[_0x25fe('0x3d')]=[{'all':!![]}];}return db[_0x25fe('0x28')][_0x25fe('0x3e')](_0x42f0af);})[_0x25fe('0x21')](function(_0x582d24){_0x4be870[_0x25fe('0x3f')]=_0x582d24;return _0x4be870;})[_0x25fe('0x21')](respondWithFilteredResult(_0x1e3782,_0x42f0af))[_0x25fe('0x40')](handleError(_0x1e3782,null));};exports[_0x25fe('0x41')]=function(_0x43e1a2,_0x1d757b){var _0x2af039={'raw':![],'where':{'id':_0x43e1a2[_0x25fe('0x42')]['id']}},_0x2bf88b={};_0x2bf88b['model']=_['keys'](db[_0x25fe('0x28')]['rawAttributes']);_0x2bf88b['query']=_[_0x25fe('0x2d')](_0x43e1a2[_0x25fe('0x2c')]);_0x2bf88b[_0x25fe('0x36')]=_[_0x25fe('0x2e')](_0x2bf88b[_0x25fe('0x2f')],_0x2bf88b[_0x25fe('0x2c')]);_0x2af039[_0x25fe('0x30')]=_[_0x25fe('0x2e')](_0x2bf88b[_0x25fe('0x2f')],qs[_0x25fe('0x31')](_0x43e1a2['query'][_0x25fe('0x31')]));_0x2af039[_0x25fe('0x30')]=_0x2af039[_0x25fe('0x30')][_0x25fe('0x43')]?_0x2af039[_0x25fe('0x30')]:_0x2bf88b['model'];if(_0x43e1a2['query'][_0x25fe('0x3c')]){_0x2af039[_0x25fe('0x3d')]=[{'all':!![]}];}_0x2af039=_[_0x25fe('0x39')]({},_0x2af039,_0x43e1a2[_0x25fe('0x3b')]);return db[_0x25fe('0x28')][_0x25fe('0x44')](_0x2af039)['then'](handleEntityNotFound(_0x1d757b,null))[_0x25fe('0x21')](respondWithResult(_0x1d757b,null))[_0x25fe('0x40')](handleError(_0x1d757b,null));};exports[_0x25fe('0x45')]=function(_0x1a23d7,_0x5445ac){return db[_0x25fe('0x28')][_0x25fe('0x45')](_0x1a23d7[_0x25fe('0x46')],{})[_0x25fe('0x21')](respondWithResult(_0x5445ac,0xc9))[_0x25fe('0x40')](handleError(_0x5445ac,null));};exports[_0x25fe('0x47')]=function(_0x3d61a8,_0x59ecc7){if(_0x3d61a8[_0x25fe('0x46')]['id']){delete _0x3d61a8[_0x25fe('0x46')]['id'];}return db[_0x25fe('0x28')][_0x25fe('0x44')]({'where':{'id':_0x3d61a8[_0x25fe('0x42')]['id']}})['then'](handleEntityNotFound(_0x59ecc7,null))[_0x25fe('0x21')](saveUpdates(_0x3d61a8['body'],null))[_0x25fe('0x21')](respondWithResult(_0x59ecc7,null))[_0x25fe('0x40')](handleError(_0x59ecc7,null));};exports['destroy']=function(_0x437311,_0x2bf3d4){return db[_0x25fe('0x28')][_0x25fe('0x44')]({'where':{'id':_0x437311[_0x25fe('0x42')]['id']}})[_0x25fe('0x21')](handleEntityNotFound(_0x2bf3d4,null))[_0x25fe('0x21')](removeEntity(_0x2bf3d4,null))['catch'](handleError(_0x2bf3d4,null));};exports[_0x25fe('0x48')]=function(_0x424b59,_0x269000,_0x49e615){var _0xb05cc9={};var _0x1bd824={};var _0xe434ef;var _0x1cdc3c;return db['FreshsalesAccount'][_0x25fe('0x49')]({'where':{'id':_0x424b59[_0x25fe('0x42')]['id']}})[_0x25fe('0x21')](handleEntityNotFound(_0x269000,null))[_0x25fe('0x21')](function(_0x30c34a){if(_0x30c34a){_0xe434ef=_0x30c34a;_0x1bd824[_0x25fe('0x2f')]=_['keys'](db[_0x25fe('0x4a')][_0x25fe('0x29')]);_0x1bd824['query']=_['keys'](_0x424b59[_0x25fe('0x2c')]);_0x1bd824[_0x25fe('0x36')]=_[_0x25fe('0x2e')](_0x1bd824[_0x25fe('0x2f')],_0x1bd824[_0x25fe('0x2c')]);_0xb05cc9['attributes']=_[_0x25fe('0x2e')](_0x1bd824[_0x25fe('0x2f')],qs[_0x25fe('0x31')](_0x424b59['query'][_0x25fe('0x31')]));_0xb05cc9[_0x25fe('0x30')]=_0xb05cc9[_0x25fe('0x30')][_0x25fe('0x43')]?_0xb05cc9[_0x25fe('0x30')]:_0x1bd824['model'];_0xb05cc9['order']=qs[_0x25fe('0x34')](_0x424b59['query'][_0x25fe('0x34')]);_0xb05cc9[_0x25fe('0x35')]=qs['filters'](_['pick'](_0x424b59['query'],_0x1bd824[_0x25fe('0x36')]));if(_0x424b59[_0x25fe('0x2c')][_0x25fe('0x38')]){_0xb05cc9['where']=_['merge'](_0xb05cc9['where'],{'$or':_[_0x25fe('0x27')](_0xb05cc9[_0x25fe('0x30')],function(_0x16d393){var _0x1299a3={};_0x1299a3[_0x16d393]={'$like':'%'+_0x424b59[_0x25fe('0x2c')][_0x25fe('0x38')]+'%'};return _0x1299a3;})});}_0xb05cc9=_[_0x25fe('0x39')]({},_0xb05cc9,_0x424b59[_0x25fe('0x3b')]);return _0xe434ef[_0x25fe('0x48')](_0xb05cc9);}})[_0x25fe('0x21')](function(_0xab5eff){if(_0xab5eff){_0x1cdc3c=_0xab5eff['length'];if(!_0x424b59[_0x25fe('0x2c')][_0x25fe('0x32')](_0x25fe('0x33'))){_0xb05cc9['limit']=qs[_0x25fe('0x1a')](_0x424b59['query'][_0x25fe('0x1a')]);_0xb05cc9[_0x25fe('0x18')]=qs[_0x25fe('0x18')](_0x424b59[_0x25fe('0x2c')][_0x25fe('0x18')]);}return _0xe434ef['getConfigurations'](_0xb05cc9);}})[_0x25fe('0x21')](function(_0x1a1ce7){if(_0x1a1ce7){return _0x1a1ce7?{'count':_0x1cdc3c,'rows':_0x1a1ce7}:null;}})['then'](respondWithResult(_0x269000,null))[_0x25fe('0x40')](handleError(_0x269000,null));};exports[_0x25fe('0x4b')]=function(_0x91b288,_0x54aee9,_0x55bbf5){if(_0x91b288['body']['id']){delete _0x91b288[_0x25fe('0x46')]['id'];}return db[_0x25fe('0x28')]['findOne']({'where':{'id':_0x91b288[_0x25fe('0x42')]['id']}})[_0x25fe('0x21')](handleEntityNotFound(_0x54aee9,null))['then'](function(_0x55ae36){if(_0x55ae36){_0x91b288['body'][_0x25fe('0x4c')]=_0x55ae36['id'];_0x91b288[_0x25fe('0x46')]['Subjects']=integrations[_0x25fe('0x4d')](_0x91b288[_0x25fe('0x46')]['channel'],_0x91b288[_0x25fe('0x46')]['type']);_0x91b288['body'][_0x25fe('0x4e')]=integrations[_0x25fe('0x4f')](_0x91b288[_0x25fe('0x46')][_0x25fe('0x50')],_0x91b288[_0x25fe('0x46')]['type']);return db[_0x25fe('0x4a')]['create'](_0x91b288[_0x25fe('0x46')],{'include':[{'model':db[_0x25fe('0x51')],'as':'Subjects'},{'model':db[_0x25fe('0x51')],'as':'Descriptions'}]});}return null;})[_0x25fe('0x21')](respondWithResult(_0x54aee9,null))['catch'](handleError(_0x54aee9,null));};exports['getFields']=function(_0x4154ba,_0x1a7293,_0x16a64a){var _0x53abf2='';var _0x879fac='';return db[_0x25fe('0x28')][_0x25fe('0x49')]({'where':{'id':_0x4154ba[_0x25fe('0x42')]['id']},'attributes':['id','username','remoteUri','apiKey']})[_0x25fe('0x21')](handleEntityNotFound(_0x1a7293,null))['then'](function(_0x4245d6){if(_0x4245d6){_0x879fac=_0x4245d6[_0x25fe('0x52')];_0x53abf2=_0x4245d6['remoteUri'];var _0x1b61c0=_0x4245d6[_0x25fe('0x53')][_0x25fe('0x54')](-0x1);if(_0x1b61c0==='/'){_0x53abf2=_0x53abf2[_0x25fe('0x55')](0x0,_0x53abf2['lastIndexOf'](_0x1b61c0));}return rp({'method':_0x25fe('0x56'),'uri':util['format']('%s%s',_0x53abf2,_0x25fe('0x57')),'headers':{'Authorization':_0x25fe('0x58')+_0x4245d6[_0x25fe('0x59')]},'json':!![]});}})[_0x25fe('0x21')](function(_0x33e3a2){if(_0x33e3a2){var _0x4b6c8e=_0x33e3a2[_0x25fe('0x5a')];var _0x241836=![];var _0xf15500=null;for(_0xf15500=0x0;_0xf15500<_0x4b6c8e[_0x25fe('0x43')];_0xf15500++){if(_0x4b6c8e[_0xf15500][_0x25fe('0x5b')]===_0x879fac){_0x241836=!![];}}if(_0x241836){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x25fe('0x5c')});}}})[_0x25fe('0x21')](respondWithResult(_0x1a7293,null))['catch'](function(_0x31dd18){var _0x330f75=_0x4154ba[_0x25fe('0x2c')][_0x25fe('0x5d')]?0x1f4:_0x31dd18[_0x25fe('0x5e')]||0x1f4;logger[_0x25fe('0x22')](_0x25fe('0x5f'),_0x25fe('0x60'),_0x330f75,JSON[_0x25fe('0x61')](_0x31dd18));delete _0x31dd18['name'];if(_0x330f75===0x191){_0x330f75=0x190;}_0x1a7293['status'](_0x330f75)[_0x25fe('0x25')](_0x4154ba[_0x25fe('0x2c')]['test']?{'message':_0x25fe('0x62'),'statusCode':_0x31dd18[_0x25fe('0x5e')]}:_0x31dd18);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index c8e4d04..f2561de 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 _0x0295=['exports','lodash','api','request-promise','path','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x0295,0x1f0));var _0x5029=function(_0x11ce46,_0x7a1715){_0x11ce46=_0x11ce46-0x0;var _0x272001=_0x0295[_0x11ce46];return _0x272001;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));var integrations=require(_0x5029('0x7'));module[_0x5029('0x8')]=function(_0x215955,_0x5b3cd){return _0x215955['define']('FreshsalesAccount',attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshsalesAccount','lodash','util'];(function(_0xa63ea3,_0x4367ff){var _0x2aa5ff=function(_0x30dc84){while(--_0x30dc84){_0xa63ea3['push'](_0xa63ea3['shift']());}};_0x2aa5ff(++_0x4367ff);}(_0x1a37,0xb4));var _0x71a3=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0x1a37[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x71a3('0xa'));module['exports']=function(_0xd09f7,_0x45050a){return _0xd09f7[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':'int_freshsales_accounts','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 fa18242..c7c6e4d 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 _0x323f=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshsalesAccount','FreshsalesAccount','options','where','attributes','include','map','model','catch','ShowFreshsalesAccount','find','raw','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x9995c4,_0x2cee6a){var _0x213e4c=function(_0x17ba8f){while(--_0x17ba8f){_0x9995c4['push'](_0x9995c4['shift']());}};_0x213e4c(++_0x2cee6a);}(_0x323f,0x1ee));var _0xf323=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x323f[_0x618414];return _0x21c19a;};'use strict';var _=require('lodash');var util=require(_0xf323('0x0'));var moment=require('moment');var BPromise=require(_0xf323('0x1'));var rs=require(_0xf323('0x2'));var fs=require('fs');var Redis=require(_0xf323('0x3'));var db=require(_0xf323('0x4'))['db'];var utils=require(_0xf323('0x5'));var logger=require(_0xf323('0x6'))(_0xf323('0x7'));var config=require(_0xf323('0x8'));var jayson=require(_0xf323('0x9'));var client=jayson[_0xf323('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb9a667,_0x444cba,_0x1af70d){return new BPromise(function(_0x2c8271,_0x8abeac){return client[_0xf323('0xb')](_0xb9a667,_0x1af70d)[_0xf323('0xc')](function(_0x2b24a2){logger[_0xf323('0xd')](_0xf323('0xe'),_0x444cba,_0xf323('0xf'));logger[_0xf323('0x10')](_0xf323('0x11'),_0x444cba,_0xf323('0xf'),JSON[_0xf323('0x12')](_0x2b24a2));if(_0x2b24a2[_0xf323('0x13')]){if(_0x2b24a2[_0xf323('0x13')]['code']===0x1f4){logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0x2b24a2[_0xf323('0x13')]['message']);return _0x8abeac(_0x2b24a2[_0xf323('0x13')][_0xf323('0x14')]);}logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0x2b24a2[_0xf323('0x13')][_0xf323('0x14')]);return _0x2c8271(_0x2b24a2['error']['message']);}else{logger[_0xf323('0xd')](_0xf323('0xe'),_0x444cba,_0xf323('0xf'));_0x2c8271(_0x2b24a2[_0xf323('0x15')][_0xf323('0x14')]);}})['catch'](function(_0xd6c25){logger[_0xf323('0x13')](_0xf323('0xe'),_0x444cba,_0xd6c25);_0x8abeac(_0xd6c25);});});}exports[_0xf323('0x16')]=function(_0x49b115){var _0x2db977=this;return new Promise(function(_0x272aec,_0x1a459d){return db[_0xf323('0x17')]['findAll']({'raw':_0x49b115[_0xf323('0x18')]?_0x49b115[_0xf323('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x49b115[_0xf323('0x18')]?_0x49b115[_0xf323('0x18')][_0xf323('0x19')]||null:null,'attributes':_0x49b115[_0xf323('0x18')]?_0x49b115['options'][_0xf323('0x1a')]||null:null,'limit':_0x49b115[_0xf323('0x18')]?_0x49b115[_0xf323('0x18')]['limit']||null:null,'include':_0x49b115[_0xf323('0x18')]?_0x49b115[_0xf323('0x18')][_0xf323('0x1b')]?_[_0xf323('0x1c')](_0x49b115[_0xf323('0x18')][_0xf323('0x1b')],function(_0x189b23){return{'model':db[_0x189b23[_0xf323('0x1d')]],'as':_0x189b23['as'],'attributes':_0x189b23[_0xf323('0x1a')],'include':_0x189b23['include']?_[_0xf323('0x1c')](_0x189b23[_0xf323('0x1b')],function(_0x33dc52){return{'model':db[_0x33dc52[_0xf323('0x1d')]],'as':_0x33dc52['as'],'attributes':_0x33dc52[_0xf323('0x1a')],'include':_0x33dc52[_0xf323('0x1b')]?_['map'](_0x33dc52[_0xf323('0x1b')],function(_0x56ce33){return{'model':db[_0x56ce33[_0xf323('0x1d')]],'as':_0x56ce33['as'],'attributes':_0x56ce33[_0xf323('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x46663b){logger[_0xf323('0xd')](_0xf323('0x16'),_0x49b115);logger[_0xf323('0x10')](_0xf323('0x16'),_0x49b115,JSON['stringify'](_0x46663b));_0x272aec(_0x46663b);})[_0xf323('0x1e')](function(_0x34b536){logger[_0xf323('0x13')](_0xf323('0x16'),_0x34b536[_0xf323('0x14')],_0x49b115);_0x1a459d(_0x2db977[_0xf323('0x13')](0x1f4,_0x34b536[_0xf323('0x14')]));});});};exports[_0xf323('0x1f')]=function(_0x139adc){var _0x52300b=this;return new Promise(function(_0x3f23cf,_0x15187c){return db[_0xf323('0x17')][_0xf323('0x20')]({'raw':_0x139adc[_0xf323('0x18')]?_0x139adc['options'][_0xf323('0x21')]===undefined?!![]:![]:!![],'where':_0x139adc[_0xf323('0x18')]?_0x139adc[_0xf323('0x18')][_0xf323('0x19')]||null:null,'attributes':_0x139adc[_0xf323('0x18')]?_0x139adc['options'][_0xf323('0x1a')]||null:null,'include':_0x139adc[_0xf323('0x18')]?_0x139adc[_0xf323('0x18')][_0xf323('0x1b')]?_['map'](_0x139adc[_0xf323('0x18')]['include'],function(_0x372c47){return{'model':db[_0x372c47[_0xf323('0x1d')]],'as':_0x372c47['as'],'attributes':_0x372c47['attributes'],'include':_0x372c47[_0xf323('0x1b')]?_['map'](_0x372c47[_0xf323('0x1b')],function(_0x4a49d2){return{'model':db[_0x4a49d2[_0xf323('0x1d')]],'as':_0x4a49d2['as'],'attributes':_0x4a49d2['attributes'],'include':_0x4a49d2[_0xf323('0x1b')]?_[_0xf323('0x1c')](_0x4a49d2['include'],function(_0x4964a5){return{'model':db[_0x4964a5['model']],'as':_0x4964a5['as'],'attributes':_0x4964a5[_0xf323('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xf323('0xc')](function(_0x79e636){logger[_0xf323('0xd')](_0xf323('0x1f'),_0x139adc);logger['debug']('ShowFreshsalesAccount',_0x139adc,JSON['stringify'](_0x79e636));_0x3f23cf(_0x79e636);})[_0xf323('0x1e')](function(_0x59fee2){logger[_0xf323('0x13')]('ShowFreshsalesAccount',_0x59fee2[_0xf323('0x14')],_0x139adc);_0x15187c(_0x52300b[_0xf323('0x13')](0x1f4,_0x59fee2[_0xf323('0x14')]));});});}; \ No newline at end of file +var _0x82c4=['findAll','options','raw','attributes','include','map','model','ShowFreshsalesAccount','FreshsalesAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetFreshsalesAccount'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x82c4,0x1ca));var _0x482c=function(_0x18515d,_0x5c442b){_0x18515d=_0x18515d-0x0;var _0x175db2=_0x82c4[_0x18515d];return _0x175db2;};'use strict';var _=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var moment=require(_0x482c('0x2'));var BPromise=require(_0x482c('0x3'));var rs=require(_0x482c('0x4'));var fs=require('fs');var Redis=require(_0x482c('0x5'));var db=require(_0x482c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x482c('0x7'))('rpc');var config=require(_0x482c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x482c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfdb92,_0x32a503,_0x35cdab){return new BPromise(function(_0x1c10f2,_0x3846d8){return client['request'](_0xfdb92,_0x35cdab)[_0x482c('0xa')](function(_0x135cc1){logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));logger[_0x482c('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x32a503,_0x482c('0xd'),JSON[_0x482c('0xf')](_0x135cc1));if(_0x135cc1[_0x482c('0x10')]){if(_0x135cc1['error'][_0x482c('0x11')]===0x1f4){logger[_0x482c('0x10')](_0x482c('0xc'),_0x32a503,_0x135cc1['error']['message']);return _0x3846d8(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x32a503,_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);return _0x1c10f2(_0x135cc1[_0x482c('0x10')][_0x482c('0x12')]);}else{logger[_0x482c('0xb')](_0x482c('0xc'),_0x32a503,_0x482c('0xd'));_0x1c10f2(_0x135cc1[_0x482c('0x13')][_0x482c('0x12')]);}})[_0x482c('0x14')](function(_0x363403){logger[_0x482c('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x32a503,_0x363403);_0x3846d8(_0x363403);});});}exports[_0x482c('0x15')]=function(_0x5b6f7e){var _0x3aed45=this;return new Promise(function(_0x258148,_0x4af05a){return db['FreshsalesAccount'][_0x482c('0x16')]({'raw':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['where']||null:null,'attributes':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x19')]||null:null,'limit':_0x5b6f7e[_0x482c('0x17')]?_0x5b6f7e[_0x482c('0x17')]['limit']||null:null,'include':_0x5b6f7e['options']?_0x5b6f7e[_0x482c('0x17')][_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x5b6f7e['options'][_0x482c('0x1a')],function(_0x579d2f){return{'model':db[_0x579d2f[_0x482c('0x1c')]],'as':_0x579d2f['as'],'attributes':_0x579d2f[_0x482c('0x19')],'include':_0x579d2f['include']?_[_0x482c('0x1b')](_0x579d2f['include'],function(_0x589bc6){return{'model':db[_0x589bc6[_0x482c('0x1c')]],'as':_0x589bc6['as'],'attributes':_0x589bc6[_0x482c('0x19')],'include':_0x589bc6[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x589bc6[_0x482c('0x1a')],function(_0x215826){return{'model':db[_0x215826[_0x482c('0x1c')]],'as':_0x215826['as'],'attributes':_0x215826['attributes']};}):[]};}):[]};}):[]:[]})[_0x482c('0xa')](function(_0x255417){logger['info'](_0x482c('0x15'),_0x5b6f7e);logger['debug']('GetFreshsalesAccount',_0x5b6f7e,JSON[_0x482c('0xf')](_0x255417));_0x258148(_0x255417);})['catch'](function(_0x1ac1c4){logger[_0x482c('0x10')](_0x482c('0x15'),_0x1ac1c4[_0x482c('0x12')],_0x5b6f7e);_0x4af05a(_0x3aed45[_0x482c('0x10')](0x1f4,_0x1ac1c4[_0x482c('0x12')]));});});};exports[_0x482c('0x1d')]=function(_0x3e9b22){var _0x24b4df=this;return new Promise(function(_0x2d3800,_0x3135a7){return db[_0x482c('0x1e')][_0x482c('0x1f')]({'raw':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x18')]===undefined?!![]:![]:!![],'where':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')]['where']||null:null,'attributes':_0x3e9b22['options']?_0x3e9b22['options'][_0x482c('0x19')]||null:null,'include':_0x3e9b22[_0x482c('0x17')]?_0x3e9b22[_0x482c('0x17')][_0x482c('0x1a')]?_['map'](_0x3e9b22[_0x482c('0x17')]['include'],function(_0x31428c){return{'model':db[_0x31428c[_0x482c('0x1c')]],'as':_0x31428c['as'],'attributes':_0x31428c[_0x482c('0x19')],'include':_0x31428c[_0x482c('0x1a')]?_[_0x482c('0x1b')](_0x31428c[_0x482c('0x1a')],function(_0x129a31){return{'model':db[_0x129a31[_0x482c('0x1c')]],'as':_0x129a31['as'],'attributes':_0x129a31['attributes'],'include':_0x129a31['include']?_[_0x482c('0x1b')](_0x129a31['include'],function(_0xe62a02){return{'model':db[_0xe62a02[_0x482c('0x1c')]],'as':_0xe62a02['as'],'attributes':_0xe62a02[_0x482c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x29cbaa){logger[_0x482c('0xb')](_0x482c('0x1d'),_0x3e9b22);logger[_0x482c('0xe')]('ShowFreshsalesAccount',_0x3e9b22,JSON[_0x482c('0xf')](_0x29cbaa));_0x2d3800(_0x29cbaa);})['catch'](function(_0x1de7f4){logger['error'](_0x482c('0x1d'),_0x1de7f4['message'],_0x3e9b22);_0x3135a7(_0x24b4df[_0x482c('0x10')](0x1f4,_0x1de7f4[_0x482c('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 00e3210..b70f69b 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 _0x53ff=['./intFreshsalesConfiguration.controller','isAuthenticated','index','get','show','/:id/subjects','/:id/fields','post','update','/:id','destroy','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x68c979,_0x431cff){var _0x4f0001=function(_0xa7595d){while(--_0xa7595d){_0x68c979['push'](_0x68c979['shift']());}};_0x4f0001(++_0x431cff);}(_0x53ff,0x19a));var _0xf53f=function(_0x5172a3,_0x1a1e39){_0x5172a3=_0x5172a3-0x0;var _0x50c69b=_0x53ff[_0x5172a3];return _0x50c69b;};'use strict';var multer=require(_0xf53f('0x0'));var util=require(_0xf53f('0x1'));var path=require(_0xf53f('0x2'));var timeout=require(_0xf53f('0x3'));var express=require(_0xf53f('0x4'));var router=express['Router']();var fs_extra=require(_0xf53f('0x5'));var auth=require(_0xf53f('0x6'));var interaction=require(_0xf53f('0x7'));var config=require('../../config/environment');var controller=require(_0xf53f('0x8'));router['get']('/',auth[_0xf53f('0x9')](),controller[_0xf53f('0xa')]);router[_0xf53f('0xb')]('/:id',auth[_0xf53f('0x9')](),controller[_0xf53f('0xc')]);router[_0xf53f('0xb')](_0xf53f('0xd'),auth[_0xf53f('0x9')](),controller['getSubjects']);router[_0xf53f('0xb')]('/:id/descriptions',auth[_0xf53f('0x9')](),controller['getDescriptions']);router[_0xf53f('0xb')](_0xf53f('0xe'),auth[_0xf53f('0x9')](),controller['getFields']);router[_0xf53f('0xf')]('/',auth[_0xf53f('0x9')](),controller['create']);router['put']('/:id',auth[_0xf53f('0x9')](),controller[_0xf53f('0x10')]);router['delete'](_0xf53f('0x11'),auth['isAuthenticated'](),controller[_0xf53f('0x12')]);module['exports']=router; \ No newline at end of file +var _0x5488=['show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getFields','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','get','/:id'];(function(_0x132b2d,_0xddfb7d){var _0x441508=function(_0x598ee0){while(--_0x598ee0){_0x132b2d['push'](_0x132b2d['shift']());}};_0x441508(++_0xddfb7d);}(_0x5488,0xa2));var _0x8548=function(_0x2134b7,_0x1eb5e2){_0x2134b7=_0x2134b7-0x0;var _0x6c5914=_0x5488[_0x2134b7];return _0x6c5914;};'use strict';var multer=require(_0x8548('0x0'));var util=require(_0x8548('0x1'));var path=require(_0x8548('0x2'));var timeout=require(_0x8548('0x3'));var express=require('express');var router=express[_0x8548('0x4')]();var fs_extra=require(_0x8548('0x5'));var auth=require(_0x8548('0x6'));var interaction=require(_0x8548('0x7'));var config=require(_0x8548('0x8'));var controller=require(_0x8548('0x9'));router['get']('/',auth[_0x8548('0xa')](),controller['index']);router[_0x8548('0xb')](_0x8548('0xc'),auth[_0x8548('0xa')](),controller[_0x8548('0xd')]);router[_0x8548('0xb')](_0x8548('0xe'),auth[_0x8548('0xa')](),controller[_0x8548('0xf')]);router[_0x8548('0xb')](_0x8548('0x10'),auth[_0x8548('0xa')](),controller[_0x8548('0x11')]);router[_0x8548('0xb')]('/:id/fields',auth[_0x8548('0xa')](),controller[_0x8548('0x12')]);router['post']('/',auth[_0x8548('0xa')](),controller[_0x8548('0x13')]);router[_0x8548('0x14')](_0x8548('0xc'),auth[_0x8548('0xa')](),controller[_0x8548('0x15')]);router[_0x8548('0x16')](_0x8548('0xc'),auth[_0x8548('0xa')](),controller[_0x8548('0x17')]);module[_0x8548('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index df49dd5..f48e89a 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 _0x8241=['exports','STRING'];(function(_0x1ef13a,_0xea5b02){var _0x22aa5b=function(_0x5c1bfe){while(--_0x5c1bfe){_0x1ef13a['push'](_0x1ef13a['shift']());}};_0x22aa5b(++_0xea5b02);}(_0x8241,0xa4));var _0x1824=function(_0x40d308,_0x52c7c0){_0x40d308=_0x40d308-0x0;var _0x106283=_0x8241[_0x40d308];return _0x106283;};'use strict';var Sequelize=require('sequelize');module[_0x1824('0x0')]={'name':{'type':Sequelize[_0x1824('0x1')]},'description':{'type':Sequelize[_0x1824('0x1')]}}; \ No newline at end of file +var _0x2d26=['STRING'];(function(_0x5401ae,_0x5e58ac){var _0x286068=function(_0x2cac88){while(--_0x2cac88){_0x5401ae['push'](_0x5401ae['shift']());}};_0x286068(++_0x5e58ac);}(_0x2d26,0xd7));var _0x62d2=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x2d26[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x62d2('0x0')]},'description':{'type':Sequelize[_0x62d2('0x0')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index cb66311..d0f227c 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 _0x3abc=['find','destroy','getSubjects','findOne','nolimit','getDescriptions','FreshsalesField','getFields','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','type','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','create','body'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0x3abc,0xfe));var _0xc3ab=function(_0x186376,_0x5d988a){_0x186376=_0x186376-0x0;var _0x2dbdd9=_0x3abc[_0x186376];return _0x2dbdd9;};'use strict';var emlformat=require(_0xc3ab('0x0'));var rimraf=require(_0xc3ab('0x1'));var zipdir=require(_0xc3ab('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc3ab('0x3'));var BPromise=require(_0xc3ab('0x4'));var Mustache=require('mustache');var util=require(_0xc3ab('0x5'));var path=require(_0xc3ab('0x6'));var sox=require(_0xc3ab('0x7'));var csv=require('to-csv');var ejs=require(_0xc3ab('0x8'));var fs=require('fs');var fs_extra=require(_0xc3ab('0x9'));var _=require(_0xc3ab('0xa'));var squel=require(_0xc3ab('0xb'));var crypto=require(_0xc3ab('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xc3ab('0xd'));var Papa=require(_0xc3ab('0xe'));var Redis=require(_0xc3ab('0xf'));var authService=require(_0xc3ab('0x10'));var qs=require(_0xc3ab('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc3ab('0x12'));var logger=require(_0xc3ab('0x13'))(_0xc3ab('0x14'));var utils=require(_0xc3ab('0x15'));var config=require(_0xc3ab('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc3ab('0x17'))['db'];function respondWithStatusCode(_0x1f4820,_0x53d0bb){_0x53d0bb=_0x53d0bb||0xcc;return function(_0x10c2ce){if(_0x10c2ce){return _0x1f4820[_0xc3ab('0x18')](_0x53d0bb);}return _0x1f4820[_0xc3ab('0x19')](_0x53d0bb)[_0xc3ab('0x1a')]();};}function respondWithResult(_0x44b12f,_0x3f5f44){_0x3f5f44=_0x3f5f44||0xc8;return function(_0x1d146a){if(_0x1d146a){return _0x44b12f[_0xc3ab('0x19')](_0x3f5f44)[_0xc3ab('0x1b')](_0x1d146a);}};}function respondWithFilteredResult(_0x1e79dd,_0x2815a0){return function(_0x47ac10){if(_0x47ac10){var _0x3c0cfc=typeof _0x2815a0[_0xc3ab('0x1c')]===_0xc3ab('0x1d')&&typeof _0x2815a0[_0xc3ab('0x1e')]==='undefined';var _0x480524=_0x47ac10[_0xc3ab('0x1f')];var _0x4fe7ab=_0x3c0cfc?0x0:_0x2815a0[_0xc3ab('0x1c')];var _0x1a012e=_0x3c0cfc?_0x47ac10[_0xc3ab('0x1f')]:_0x2815a0[_0xc3ab('0x1c')]+_0x2815a0[_0xc3ab('0x1e')];var _0x305bda;if(_0x1a012e>=_0x480524){_0x1a012e=_0x480524;_0x305bda=0xc8;}else{_0x305bda=0xce;}_0x1e79dd[_0xc3ab('0x19')](_0x305bda);return _0x1e79dd[_0xc3ab('0x20')]('Content-Range',_0x4fe7ab+'-'+_0x1a012e+'/'+_0x480524)[_0xc3ab('0x1b')](_0x47ac10);}return null;};}function patchUpdates(_0x2b8a16){return function(_0x33ad49){try{jsonpatch[_0xc3ab('0x21')](_0x33ad49,_0x2b8a16,!![]);}catch(_0x211d3b){return BPromise[_0xc3ab('0x22')](_0x211d3b);}return _0x33ad49[_0xc3ab('0x23')]();};}function saveUpdates(_0x5cfa48,_0x14b66b){return function(_0x85e463){if(_0x85e463){return _0x85e463[_0xc3ab('0x24')](_0x5cfa48)[_0xc3ab('0x25')](function(_0x42a2f7){return _0x42a2f7;});}return null;};}function removeEntity(_0x20d8ae,_0x33f4b7){return function(_0x3dc8f7){if(_0x3dc8f7){return _0x3dc8f7['destroy']()[_0xc3ab('0x25')](function(){_0x20d8ae['status'](0xcc)[_0xc3ab('0x1a')]();});}};}function handleEntityNotFound(_0x1448d7,_0x34e3a0){return function(_0x282a3c){if(!_0x282a3c){_0x1448d7[_0xc3ab('0x18')](0x194);}return _0x282a3c;};}function handleError(_0x4a36b3,_0x56b27d){_0x56b27d=_0x56b27d||0x1f4;return function(_0x346008){logger[_0xc3ab('0x26')](_0x346008[_0xc3ab('0x27')]);if(_0x346008[_0xc3ab('0x28')]){delete _0x346008[_0xc3ab('0x28')];}_0x4a36b3[_0xc3ab('0x19')](_0x56b27d)[_0xc3ab('0x29')](_0x346008);};}exports[_0xc3ab('0x2a')]=function(_0xf0f1d6,_0x41b979){var _0x3d2953={},_0x27062a={},_0x371c21={'count':0x0,'rows':[]};var _0x38ec7c=_[_0xc3ab('0x2b')](db[_0xc3ab('0x2c')][_0xc3ab('0x2d')],function(_0x4d4d33){return{'name':_0x4d4d33[_0xc3ab('0x2e')],'type':_0x4d4d33['type'][_0xc3ab('0x2f')]};});_0x27062a[_0xc3ab('0x30')]=_[_0xc3ab('0x2b')](_0x38ec7c,'name');_0x27062a[_0xc3ab('0x31')]=_[_0xc3ab('0x32')](_0xf0f1d6[_0xc3ab('0x31')]);_0x27062a['filters']=_['intersection'](_0x27062a['model'],_0x27062a[_0xc3ab('0x31')]);_0x3d2953[_0xc3ab('0x33')]=_[_0xc3ab('0x34')](_0x27062a['model'],qs[_0xc3ab('0x35')](_0xf0f1d6['query'][_0xc3ab('0x35')]));_0x3d2953[_0xc3ab('0x33')]=_0x3d2953['attributes'][_0xc3ab('0x36')]?_0x3d2953[_0xc3ab('0x33')]:_0x27062a[_0xc3ab('0x30')];if(!_0xf0f1d6[_0xc3ab('0x31')][_0xc3ab('0x37')]('nolimit')){_0x3d2953['limit']=qs[_0xc3ab('0x1e')](_0xf0f1d6[_0xc3ab('0x31')][_0xc3ab('0x1e')]);_0x3d2953['offset']=qs[_0xc3ab('0x1c')](_0xf0f1d6[_0xc3ab('0x31')]['offset']);}_0x3d2953[_0xc3ab('0x38')]=qs['sort'](_0xf0f1d6[_0xc3ab('0x31')][_0xc3ab('0x39')]);_0x3d2953[_0xc3ab('0x3a')]=qs[_0xc3ab('0x3b')](_[_0xc3ab('0x3c')](_0xf0f1d6[_0xc3ab('0x31')],_0x27062a[_0xc3ab('0x3b')]),_0x38ec7c);if(_0xf0f1d6['query']['filter']){_0x3d2953[_0xc3ab('0x3a')]=_[_0xc3ab('0x3d')](_0x3d2953[_0xc3ab('0x3a')],{'$or':_[_0xc3ab('0x2b')](_0x38ec7c,function(_0x1638c8){if(_0x1638c8[_0xc3ab('0x3e')]!==_0xc3ab('0x3f')){var _0x4266d1={};_0x4266d1[_0x1638c8[_0xc3ab('0x28')]]={'$like':'%'+_0xf0f1d6[_0xc3ab('0x31')][_0xc3ab('0x40')]+'%'};return _0x4266d1;}})});}_0x3d2953=_[_0xc3ab('0x3d')]({},_0x3d2953,_0xf0f1d6[_0xc3ab('0x41')]);var _0x30779a={'where':_0x3d2953[_0xc3ab('0x3a')]};return db[_0xc3ab('0x2c')][_0xc3ab('0x1f')](_0x30779a)[_0xc3ab('0x25')](function(_0x42368d){_0x371c21[_0xc3ab('0x1f')]=_0x42368d;if(_0xf0f1d6[_0xc3ab('0x31')][_0xc3ab('0x42')]){_0x3d2953['include']=[{'all':!![]}];}return db[_0xc3ab('0x2c')][_0xc3ab('0x43')](_0x3d2953);})[_0xc3ab('0x25')](function(_0x28eb44){_0x371c21[_0xc3ab('0x44')]=_0x28eb44;return _0x371c21;})[_0xc3ab('0x25')](respondWithFilteredResult(_0x41b979,_0x3d2953))[_0xc3ab('0x45')](handleError(_0x41b979,null));};exports[_0xc3ab('0x46')]=function(_0x17a085,_0x585203){var _0x35e39d={'raw':![],'where':{'id':_0x17a085[_0xc3ab('0x47')]['id']}},_0x2ec6e5={};_0x2ec6e5[_0xc3ab('0x30')]=_[_0xc3ab('0x32')](db['FreshsalesConfiguration'][_0xc3ab('0x2d')]);_0x2ec6e5[_0xc3ab('0x31')]=_[_0xc3ab('0x32')](_0x17a085['query']);_0x2ec6e5[_0xc3ab('0x3b')]=_['intersection'](_0x2ec6e5['model'],_0x2ec6e5[_0xc3ab('0x31')]);_0x35e39d[_0xc3ab('0x33')]=_[_0xc3ab('0x34')](_0x2ec6e5['model'],qs[_0xc3ab('0x35')](_0x17a085[_0xc3ab('0x31')][_0xc3ab('0x35')]));_0x35e39d[_0xc3ab('0x33')]=_0x35e39d[_0xc3ab('0x33')]['length']?_0x35e39d[_0xc3ab('0x33')]:_0x2ec6e5[_0xc3ab('0x30')];if(_0x17a085[_0xc3ab('0x31')]['includeAll']){_0x35e39d['include']=[{'all':!![]}];}_0x35e39d=_['merge']({},_0x35e39d,_0x17a085[_0xc3ab('0x41')]);return db['FreshsalesConfiguration']['find'](_0x35e39d)[_0xc3ab('0x25')](handleEntityNotFound(_0x585203,null))[_0xc3ab('0x25')](respondWithResult(_0x585203,null))[_0xc3ab('0x45')](handleError(_0x585203,null));};exports[_0xc3ab('0x48')]=function(_0x1b3b8f,_0x17ae7d){return db[_0xc3ab('0x2c')][_0xc3ab('0x48')](_0x1b3b8f[_0xc3ab('0x49')],{})[_0xc3ab('0x25')](respondWithResult(_0x17ae7d,0xc9))[_0xc3ab('0x45')](handleError(_0x17ae7d,null));};exports[_0xc3ab('0x24')]=function(_0x315eaf,_0xbeff99){if(_0x315eaf[_0xc3ab('0x49')]['id']){delete _0x315eaf['body']['id'];}return db['FreshsalesConfiguration'][_0xc3ab('0x4a')]({'where':{'id':_0x315eaf['params']['id']}})[_0xc3ab('0x25')](handleEntityNotFound(_0xbeff99,null))['then'](saveUpdates(_0x315eaf['body'],null))[_0xc3ab('0x25')](respondWithResult(_0xbeff99,null))[_0xc3ab('0x45')](handleError(_0xbeff99,null));};exports[_0xc3ab('0x4b')]=function(_0xb6f645,_0x261251){return db['FreshsalesConfiguration'][_0xc3ab('0x4a')]({'where':{'id':_0xb6f645[_0xc3ab('0x47')]['id']}})[_0xc3ab('0x25')](handleEntityNotFound(_0x261251,null))[_0xc3ab('0x25')](removeEntity(_0x261251,null))[_0xc3ab('0x45')](handleError(_0x261251,null));};exports[_0xc3ab('0x4c')]=function(_0xe2fa89,_0x5ca4b3,_0x256b5e){var _0x5ecb91={};var _0x9fd999={};var _0x7b35ca;var _0x53c416;return db[_0xc3ab('0x2c')][_0xc3ab('0x4d')]({'where':{'id':_0xe2fa89[_0xc3ab('0x47')]['id']}})[_0xc3ab('0x25')](handleEntityNotFound(_0x5ca4b3,null))['then'](function(_0x2bf316){if(_0x2bf316){_0x7b35ca=_0x2bf316;_0x9fd999[_0xc3ab('0x30')]=_[_0xc3ab('0x32')](db['FreshsalesField']['rawAttributes']);_0x9fd999[_0xc3ab('0x31')]=_[_0xc3ab('0x32')](_0xe2fa89[_0xc3ab('0x31')]);_0x9fd999[_0xc3ab('0x3b')]=_['intersection'](_0x9fd999['model'],_0x9fd999[_0xc3ab('0x31')]);_0x5ecb91[_0xc3ab('0x33')]=_['intersection'](_0x9fd999[_0xc3ab('0x30')],qs[_0xc3ab('0x35')](_0xe2fa89['query'][_0xc3ab('0x35')]));_0x5ecb91[_0xc3ab('0x33')]=_0x5ecb91[_0xc3ab('0x33')][_0xc3ab('0x36')]?_0x5ecb91[_0xc3ab('0x33')]:_0x9fd999[_0xc3ab('0x30')];_0x5ecb91[_0xc3ab('0x38')]=qs[_0xc3ab('0x39')](_0xe2fa89['query'][_0xc3ab('0x39')]);_0x5ecb91[_0xc3ab('0x3a')]=qs[_0xc3ab('0x3b')](_['pick'](_0xe2fa89['query'],_0x9fd999['filters']));if(_0xe2fa89[_0xc3ab('0x31')][_0xc3ab('0x40')]){_0x5ecb91[_0xc3ab('0x3a')]=_[_0xc3ab('0x3d')](_0x5ecb91[_0xc3ab('0x3a')],{'$or':_[_0xc3ab('0x2b')](_0x5ecb91[_0xc3ab('0x33')],function(_0x34533f){var _0x738796={};_0x738796[_0x34533f]={'$like':'%'+_0xe2fa89[_0xc3ab('0x31')][_0xc3ab('0x40')]+'%'};return _0x738796;})});}_0x5ecb91=_[_0xc3ab('0x3d')]({},_0x5ecb91,_0xe2fa89[_0xc3ab('0x41')]);return _0x7b35ca[_0xc3ab('0x4c')](_0x5ecb91);}})[_0xc3ab('0x25')](function(_0x3aa8b8){if(_0x3aa8b8){_0x53c416=_0x3aa8b8[_0xc3ab('0x36')];if(!_0xe2fa89['query'][_0xc3ab('0x37')](_0xc3ab('0x4e'))){_0x5ecb91[_0xc3ab('0x1e')]=qs[_0xc3ab('0x1e')](_0xe2fa89['query']['limit']);_0x5ecb91[_0xc3ab('0x1c')]=qs[_0xc3ab('0x1c')](_0xe2fa89[_0xc3ab('0x31')][_0xc3ab('0x1c')]);}return _0x7b35ca['getSubjects'](_0x5ecb91);}})[_0xc3ab('0x25')](function(_0x14feab){if(_0x14feab){return _0x14feab?{'count':_0x53c416,'rows':_0x14feab}:null;}})[_0xc3ab('0x25')](respondWithResult(_0x5ca4b3,null))['catch'](handleError(_0x5ca4b3,null));};exports[_0xc3ab('0x4f')]=function(_0x558da9,_0x77cb9,_0x542999){var _0x2669a0={};var _0x41998c={};var _0x3fd17d;var _0x4074dc;return db['FreshsalesConfiguration'][_0xc3ab('0x4d')]({'where':{'id':_0x558da9[_0xc3ab('0x47')]['id']}})[_0xc3ab('0x25')](handleEntityNotFound(_0x77cb9,null))[_0xc3ab('0x25')](function(_0x206099){if(_0x206099){_0x3fd17d=_0x206099;_0x41998c[_0xc3ab('0x30')]=_[_0xc3ab('0x32')](db[_0xc3ab('0x50')][_0xc3ab('0x2d')]);_0x41998c[_0xc3ab('0x31')]=_[_0xc3ab('0x32')](_0x558da9['query']);_0x41998c[_0xc3ab('0x3b')]=_['intersection'](_0x41998c[_0xc3ab('0x30')],_0x41998c['query']);_0x2669a0['attributes']=_['intersection'](_0x41998c[_0xc3ab('0x30')],qs[_0xc3ab('0x35')](_0x558da9['query'][_0xc3ab('0x35')]));_0x2669a0[_0xc3ab('0x33')]=_0x2669a0[_0xc3ab('0x33')]['length']?_0x2669a0[_0xc3ab('0x33')]:_0x41998c[_0xc3ab('0x30')];_0x2669a0['order']=qs[_0xc3ab('0x39')](_0x558da9[_0xc3ab('0x31')][_0xc3ab('0x39')]);_0x2669a0[_0xc3ab('0x3a')]=qs[_0xc3ab('0x3b')](_[_0xc3ab('0x3c')](_0x558da9[_0xc3ab('0x31')],_0x41998c['filters']));if(_0x558da9['query'][_0xc3ab('0x40')]){_0x2669a0['where']=_['merge'](_0x2669a0[_0xc3ab('0x3a')],{'$or':_[_0xc3ab('0x2b')](_0x2669a0['attributes'],function(_0x1fee86){var _0x1cf7b2={};_0x1cf7b2[_0x1fee86]={'$like':'%'+_0x558da9[_0xc3ab('0x31')][_0xc3ab('0x40')]+'%'};return _0x1cf7b2;})});}_0x2669a0=_['merge']({},_0x2669a0,_0x558da9[_0xc3ab('0x41')]);return _0x3fd17d[_0xc3ab('0x4f')](_0x2669a0);}})[_0xc3ab('0x25')](function(_0x3e508e){if(_0x3e508e){_0x4074dc=_0x3e508e[_0xc3ab('0x36')];if(!_0x558da9['query']['hasOwnProperty'](_0xc3ab('0x4e'))){_0x2669a0[_0xc3ab('0x1e')]=qs[_0xc3ab('0x1e')](_0x558da9[_0xc3ab('0x31')][_0xc3ab('0x1e')]);_0x2669a0['offset']=qs[_0xc3ab('0x1c')](_0x558da9[_0xc3ab('0x31')][_0xc3ab('0x1c')]);}return _0x3fd17d[_0xc3ab('0x4f')](_0x2669a0);}})[_0xc3ab('0x25')](function(_0x69d002){if(_0x69d002){return _0x69d002?{'count':_0x4074dc,'rows':_0x69d002}:null;}})[_0xc3ab('0x25')](respondWithResult(_0x77cb9,null))[_0xc3ab('0x45')](handleError(_0x77cb9,null));};exports[_0xc3ab('0x51')]=function(_0x3570e5,_0x267129,_0x4b165a){var _0x1790b9={};var _0x459412={};var _0x10d177;var _0x13b58e;return db[_0xc3ab('0x2c')]['findOne']({'where':{'id':_0x3570e5[_0xc3ab('0x47')]['id']}})[_0xc3ab('0x25')](handleEntityNotFound(_0x267129,null))[_0xc3ab('0x25')](function(_0x3ad6e6){if(_0x3ad6e6){_0x10d177=_0x3ad6e6;_0x459412[_0xc3ab('0x30')]=_[_0xc3ab('0x32')](db[_0xc3ab('0x50')][_0xc3ab('0x2d')]);_0x459412[_0xc3ab('0x31')]=_[_0xc3ab('0x32')](_0x3570e5[_0xc3ab('0x31')]);_0x459412[_0xc3ab('0x3b')]=_[_0xc3ab('0x34')](_0x459412['model'],_0x459412[_0xc3ab('0x31')]);_0x1790b9[_0xc3ab('0x33')]=_[_0xc3ab('0x34')](_0x459412['model'],qs[_0xc3ab('0x35')](_0x3570e5[_0xc3ab('0x31')][_0xc3ab('0x35')]));_0x1790b9['attributes']=_0x1790b9[_0xc3ab('0x33')][_0xc3ab('0x36')]?_0x1790b9[_0xc3ab('0x33')]:_0x459412[_0xc3ab('0x30')];_0x1790b9[_0xc3ab('0x38')]=qs['sort'](_0x3570e5[_0xc3ab('0x31')][_0xc3ab('0x39')]);_0x1790b9[_0xc3ab('0x3a')]=qs[_0xc3ab('0x3b')](_[_0xc3ab('0x3c')](_0x3570e5[_0xc3ab('0x31')],_0x459412['filters']));if(_0x3570e5['query'][_0xc3ab('0x40')]){_0x1790b9[_0xc3ab('0x3a')]=_['merge'](_0x1790b9[_0xc3ab('0x3a')],{'$or':_['map'](_0x1790b9[_0xc3ab('0x33')],function(_0x33f8f9){var _0x4f8234={};_0x4f8234[_0x33f8f9]={'$like':'%'+_0x3570e5[_0xc3ab('0x31')][_0xc3ab('0x40')]+'%'};return _0x4f8234;})});}_0x1790b9=_['merge']({},_0x1790b9,_0x3570e5['options']);return _0x10d177[_0xc3ab('0x51')](_0x1790b9);}})[_0xc3ab('0x25')](function(_0x309df8){if(_0x309df8){_0x13b58e=_0x309df8['length'];if(!_0x3570e5[_0xc3ab('0x31')][_0xc3ab('0x37')](_0xc3ab('0x4e'))){_0x1790b9['limit']=qs[_0xc3ab('0x1e')](_0x3570e5[_0xc3ab('0x31')][_0xc3ab('0x1e')]);_0x1790b9[_0xc3ab('0x1c')]=qs[_0xc3ab('0x1c')](_0x3570e5[_0xc3ab('0x31')][_0xc3ab('0x1c')]);}return _0x10d177[_0xc3ab('0x51')](_0x1790b9);}})[_0xc3ab('0x25')](function(_0x5abcbe){if(_0x5abcbe){return _0x5abcbe?{'count':_0x13b58e,'rows':_0x5abcbe}:null;}})[_0xc3ab('0x25')](respondWithResult(_0x267129,null))[_0xc3ab('0x45')](handleError(_0x267129,null));}; \ No newline at end of file +var _0x0b65=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','to-csv','fs-extra','squel','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','fields','attributes','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','options','FreshsalesConfiguration','includeAll','rows','rawAttributes','intersection','length','find','catch','create','body','params','findOne','FreshsalesField','getSubjects','getDescriptions','order','getFields'];(function(_0x3f4891,_0x4e6f62){var _0x54f2d8=function(_0x2b11ee){while(--_0x2b11ee){_0x3f4891['push'](_0x3f4891['shift']());}};_0x54f2d8(++_0x4e6f62);}(_0x0b65,0x9c));var _0x50b6=function(_0x595631,_0x20dbca){_0x595631=_0x595631-0x0;var _0x22f823=_0x0b65[_0x595631];return _0x22f823;};'use strict';var emlformat=require(_0x50b6('0x0'));var rimraf=require(_0x50b6('0x1'));var zipdir=require(_0x50b6('0x2'));var jsonpatch=require(_0x50b6('0x3'));var rp=require(_0x50b6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x50b6('0x5'));var sox=require(_0x50b6('0x6'));var csv=require(_0x50b6('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x50b6('0x8'));var _=require('lodash');var squel=require(_0x50b6('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x50b6('0xa'));var toCsv=require(_0x50b6('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x50b6('0xb'));var authService=require(_0x50b6('0xc'));var qs=require(_0x50b6('0xd'));var as=require(_0x50b6('0xe'));var hardwareService=require(_0x50b6('0xf'));var logger=require(_0x50b6('0x10'))(_0x50b6('0x11'));var utils=require(_0x50b6('0x12'));var config=require(_0x50b6('0x13'));var licenseUtil=require(_0x50b6('0x14'));var db=require(_0x50b6('0x15'))['db'];function respondWithStatusCode(_0x48dd1f,_0xadc2b){_0xadc2b=_0xadc2b||0xcc;return function(_0x5a6335){if(_0x5a6335){return _0x48dd1f[_0x50b6('0x16')](_0xadc2b);}return _0x48dd1f[_0x50b6('0x17')](_0xadc2b)[_0x50b6('0x18')]();};}function respondWithResult(_0x1bddb4,_0x32e8b1){_0x32e8b1=_0x32e8b1||0xc8;return function(_0x394d16){if(_0x394d16){return _0x1bddb4[_0x50b6('0x17')](_0x32e8b1)[_0x50b6('0x19')](_0x394d16);}};}function respondWithFilteredResult(_0x352d16,_0x5ade09){return function(_0x25aa73){if(_0x25aa73){var _0x2834a4=typeof _0x5ade09[_0x50b6('0x1a')]===_0x50b6('0x1b')&&typeof _0x5ade09['limit']===_0x50b6('0x1b');var _0x120d63=_0x25aa73[_0x50b6('0x1c')];var _0x1b6858=_0x2834a4?0x0:_0x5ade09[_0x50b6('0x1a')];var _0x177591=_0x2834a4?_0x25aa73[_0x50b6('0x1c')]:_0x5ade09[_0x50b6('0x1a')]+_0x5ade09[_0x50b6('0x1d')];var _0x3648b5;if(_0x177591>=_0x120d63){_0x177591=_0x120d63;_0x3648b5=0xc8;}else{_0x3648b5=0xce;}_0x352d16[_0x50b6('0x17')](_0x3648b5);return _0x352d16[_0x50b6('0x1e')](_0x50b6('0x1f'),_0x1b6858+'-'+_0x177591+'/'+_0x120d63)[_0x50b6('0x19')](_0x25aa73);}return null;};}function patchUpdates(_0xe65ace){return function(_0x4bae66){try{jsonpatch[_0x50b6('0x20')](_0x4bae66,_0xe65ace,!![]);}catch(_0x1eb4f2){return BPromise[_0x50b6('0x21')](_0x1eb4f2);}return _0x4bae66[_0x50b6('0x22')]();};}function saveUpdates(_0x495bc5,_0x5ea339){return function(_0x16f668){if(_0x16f668){return _0x16f668[_0x50b6('0x23')](_0x495bc5)[_0x50b6('0x24')](function(_0x37ff43){return _0x37ff43;});}return null;};}function removeEntity(_0x12c41f,_0x1ab3ee){return function(_0x5b4860){if(_0x5b4860){return _0x5b4860[_0x50b6('0x25')]()[_0x50b6('0x24')](function(){_0x12c41f[_0x50b6('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17290f,_0x5dc7f3){return function(_0x1c4fa7){if(!_0x1c4fa7){_0x17290f[_0x50b6('0x16')](0x194);}return _0x1c4fa7;};}function handleError(_0x4d06bc,_0x43bd83){_0x43bd83=_0x43bd83||0x1f4;return function(_0x576591){logger[_0x50b6('0x26')](_0x576591[_0x50b6('0x27')]);if(_0x576591[_0x50b6('0x28')]){delete _0x576591[_0x50b6('0x28')];}_0x4d06bc[_0x50b6('0x17')](_0x43bd83)[_0x50b6('0x29')](_0x576591);};}exports[_0x50b6('0x2a')]=function(_0x58febc,_0x50535e){var _0x55693a={},_0x15395c={},_0x4852f9={'count':0x0,'rows':[]};var _0x49e8eb=_[_0x50b6('0x2b')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x3d3a9b){return{'name':_0x3d3a9b[_0x50b6('0x2c')],'type':_0x3d3a9b[_0x50b6('0x2d')][_0x50b6('0x2e')]};});_0x15395c[_0x50b6('0x2f')]=_[_0x50b6('0x2b')](_0x49e8eb,'name');_0x15395c[_0x50b6('0x30')]=_[_0x50b6('0x31')](_0x58febc['query']);_0x15395c['filters']=_['intersection'](_0x15395c['model'],_0x15395c[_0x50b6('0x30')]);_0x55693a['attributes']=_['intersection'](_0x15395c[_0x50b6('0x2f')],qs[_0x50b6('0x32')](_0x58febc['query'][_0x50b6('0x32')]));_0x55693a[_0x50b6('0x33')]=_0x55693a[_0x50b6('0x33')]['length']?_0x55693a[_0x50b6('0x33')]:_0x15395c['model'];if(!_0x58febc['query'][_0x50b6('0x34')](_0x50b6('0x35'))){_0x55693a[_0x50b6('0x1d')]=qs[_0x50b6('0x1d')](_0x58febc[_0x50b6('0x30')][_0x50b6('0x1d')]);_0x55693a[_0x50b6('0x1a')]=qs[_0x50b6('0x1a')](_0x58febc[_0x50b6('0x30')]['offset']);}_0x55693a['order']=qs[_0x50b6('0x36')](_0x58febc[_0x50b6('0x30')][_0x50b6('0x36')]);_0x55693a[_0x50b6('0x37')]=qs[_0x50b6('0x38')](_[_0x50b6('0x39')](_0x58febc[_0x50b6('0x30')],_0x15395c[_0x50b6('0x38')]),_0x49e8eb);if(_0x58febc[_0x50b6('0x30')][_0x50b6('0x3a')]){_0x55693a[_0x50b6('0x37')]=_[_0x50b6('0x3b')](_0x55693a[_0x50b6('0x37')],{'$or':_[_0x50b6('0x2b')](_0x49e8eb,function(_0x251052){if(_0x251052[_0x50b6('0x2d')]!=='VIRTUAL'){var _0x799373={};_0x799373[_0x251052[_0x50b6('0x28')]]={'$like':'%'+_0x58febc['query'][_0x50b6('0x3a')]+'%'};return _0x799373;}})});}_0x55693a=_[_0x50b6('0x3b')]({},_0x55693a,_0x58febc[_0x50b6('0x3c')]);var _0x689e7b={'where':_0x55693a[_0x50b6('0x37')]};return db[_0x50b6('0x3d')]['count'](_0x689e7b)[_0x50b6('0x24')](function(_0x23d302){_0x4852f9[_0x50b6('0x1c')]=_0x23d302;if(_0x58febc[_0x50b6('0x30')][_0x50b6('0x3e')]){_0x55693a['include']=[{'all':!![]}];}return db['FreshsalesConfiguration']['findAll'](_0x55693a);})['then'](function(_0x3428ed){_0x4852f9[_0x50b6('0x3f')]=_0x3428ed;return _0x4852f9;})['then'](respondWithFilteredResult(_0x50535e,_0x55693a))['catch'](handleError(_0x50535e,null));};exports['show']=function(_0x237e41,_0x4ad696){var _0x216a6e={'raw':![],'where':{'id':_0x237e41['params']['id']}},_0x21f0b8={};_0x21f0b8[_0x50b6('0x2f')]=_[_0x50b6('0x31')](db[_0x50b6('0x3d')][_0x50b6('0x40')]);_0x21f0b8['query']=_[_0x50b6('0x31')](_0x237e41[_0x50b6('0x30')]);_0x21f0b8[_0x50b6('0x38')]=_['intersection'](_0x21f0b8[_0x50b6('0x2f')],_0x21f0b8[_0x50b6('0x30')]);_0x216a6e['attributes']=_[_0x50b6('0x41')](_0x21f0b8['model'],qs['fields'](_0x237e41[_0x50b6('0x30')][_0x50b6('0x32')]));_0x216a6e[_0x50b6('0x33')]=_0x216a6e[_0x50b6('0x33')][_0x50b6('0x42')]?_0x216a6e['attributes']:_0x21f0b8['model'];if(_0x237e41[_0x50b6('0x30')][_0x50b6('0x3e')]){_0x216a6e['include']=[{'all':!![]}];}_0x216a6e=_['merge']({},_0x216a6e,_0x237e41[_0x50b6('0x3c')]);return db[_0x50b6('0x3d')][_0x50b6('0x43')](_0x216a6e)[_0x50b6('0x24')](handleEntityNotFound(_0x4ad696,null))[_0x50b6('0x24')](respondWithResult(_0x4ad696,null))[_0x50b6('0x44')](handleError(_0x4ad696,null));};exports[_0x50b6('0x45')]=function(_0x46a001,_0x5af8db){return db[_0x50b6('0x3d')][_0x50b6('0x45')](_0x46a001['body'],{})['then'](respondWithResult(_0x5af8db,0xc9))[_0x50b6('0x44')](handleError(_0x5af8db,null));};exports['update']=function(_0x792e27,_0x4c24a4){if(_0x792e27['body']['id']){delete _0x792e27[_0x50b6('0x46')]['id'];}return db[_0x50b6('0x3d')][_0x50b6('0x43')]({'where':{'id':_0x792e27['params']['id']}})[_0x50b6('0x24')](handleEntityNotFound(_0x4c24a4,null))[_0x50b6('0x24')](saveUpdates(_0x792e27['body'],null))[_0x50b6('0x24')](respondWithResult(_0x4c24a4,null))[_0x50b6('0x44')](handleError(_0x4c24a4,null));};exports[_0x50b6('0x25')]=function(_0x325fe1,_0x14a1b4){return db[_0x50b6('0x3d')][_0x50b6('0x43')]({'where':{'id':_0x325fe1[_0x50b6('0x47')]['id']}})[_0x50b6('0x24')](handleEntityNotFound(_0x14a1b4,null))[_0x50b6('0x24')](removeEntity(_0x14a1b4,null))[_0x50b6('0x44')](handleError(_0x14a1b4,null));};exports['getSubjects']=function(_0x2595bc,_0x498c51,_0x19b7c5){var _0x3c5de8={};var _0x66d778={};var _0xbccb0b;var _0x1c4b0f;return db['FreshsalesConfiguration'][_0x50b6('0x48')]({'where':{'id':_0x2595bc[_0x50b6('0x47')]['id']}})['then'](handleEntityNotFound(_0x498c51,null))[_0x50b6('0x24')](function(_0x21d345){if(_0x21d345){_0xbccb0b=_0x21d345;_0x66d778[_0x50b6('0x2f')]=_[_0x50b6('0x31')](db[_0x50b6('0x49')][_0x50b6('0x40')]);_0x66d778[_0x50b6('0x30')]=_[_0x50b6('0x31')](_0x2595bc['query']);_0x66d778['filters']=_['intersection'](_0x66d778[_0x50b6('0x2f')],_0x66d778['query']);_0x3c5de8[_0x50b6('0x33')]=_[_0x50b6('0x41')](_0x66d778[_0x50b6('0x2f')],qs[_0x50b6('0x32')](_0x2595bc['query'][_0x50b6('0x32')]));_0x3c5de8[_0x50b6('0x33')]=_0x3c5de8[_0x50b6('0x33')][_0x50b6('0x42')]?_0x3c5de8[_0x50b6('0x33')]:_0x66d778[_0x50b6('0x2f')];_0x3c5de8['order']=qs[_0x50b6('0x36')](_0x2595bc[_0x50b6('0x30')][_0x50b6('0x36')]);_0x3c5de8[_0x50b6('0x37')]=qs[_0x50b6('0x38')](_[_0x50b6('0x39')](_0x2595bc[_0x50b6('0x30')],_0x66d778[_0x50b6('0x38')]));if(_0x2595bc['query']['filter']){_0x3c5de8[_0x50b6('0x37')]=_[_0x50b6('0x3b')](_0x3c5de8[_0x50b6('0x37')],{'$or':_[_0x50b6('0x2b')](_0x3c5de8['attributes'],function(_0x284043){var _0x4ed56c={};_0x4ed56c[_0x284043]={'$like':'%'+_0x2595bc['query'][_0x50b6('0x3a')]+'%'};return _0x4ed56c;})});}_0x3c5de8=_[_0x50b6('0x3b')]({},_0x3c5de8,_0x2595bc[_0x50b6('0x3c')]);return _0xbccb0b[_0x50b6('0x4a')](_0x3c5de8);}})[_0x50b6('0x24')](function(_0x4151ce){if(_0x4151ce){_0x1c4b0f=_0x4151ce[_0x50b6('0x42')];if(!_0x2595bc[_0x50b6('0x30')][_0x50b6('0x34')]('nolimit')){_0x3c5de8[_0x50b6('0x1d')]=qs[_0x50b6('0x1d')](_0x2595bc['query'][_0x50b6('0x1d')]);_0x3c5de8[_0x50b6('0x1a')]=qs[_0x50b6('0x1a')](_0x2595bc[_0x50b6('0x30')][_0x50b6('0x1a')]);}return _0xbccb0b[_0x50b6('0x4a')](_0x3c5de8);}})[_0x50b6('0x24')](function(_0x47def9){if(_0x47def9){return _0x47def9?{'count':_0x1c4b0f,'rows':_0x47def9}:null;}})[_0x50b6('0x24')](respondWithResult(_0x498c51,null))['catch'](handleError(_0x498c51,null));};exports[_0x50b6('0x4b')]=function(_0x43737e,_0x45069e,_0x14131d){var _0x2d30c5={};var _0x1be42c={};var _0x2f730f;var _0x3dd6b4;return db[_0x50b6('0x3d')][_0x50b6('0x48')]({'where':{'id':_0x43737e['params']['id']}})['then'](handleEntityNotFound(_0x45069e,null))['then'](function(_0x19edcc){if(_0x19edcc){_0x2f730f=_0x19edcc;_0x1be42c['model']=_['keys'](db[_0x50b6('0x49')][_0x50b6('0x40')]);_0x1be42c[_0x50b6('0x30')]=_[_0x50b6('0x31')](_0x43737e[_0x50b6('0x30')]);_0x1be42c[_0x50b6('0x38')]=_[_0x50b6('0x41')](_0x1be42c[_0x50b6('0x2f')],_0x1be42c['query']);_0x2d30c5[_0x50b6('0x33')]=_[_0x50b6('0x41')](_0x1be42c[_0x50b6('0x2f')],qs[_0x50b6('0x32')](_0x43737e['query'][_0x50b6('0x32')]));_0x2d30c5['attributes']=_0x2d30c5['attributes'][_0x50b6('0x42')]?_0x2d30c5['attributes']:_0x1be42c[_0x50b6('0x2f')];_0x2d30c5[_0x50b6('0x4c')]=qs[_0x50b6('0x36')](_0x43737e[_0x50b6('0x30')][_0x50b6('0x36')]);_0x2d30c5[_0x50b6('0x37')]=qs[_0x50b6('0x38')](_[_0x50b6('0x39')](_0x43737e[_0x50b6('0x30')],_0x1be42c[_0x50b6('0x38')]));if(_0x43737e[_0x50b6('0x30')][_0x50b6('0x3a')]){_0x2d30c5[_0x50b6('0x37')]=_['merge'](_0x2d30c5['where'],{'$or':_['map'](_0x2d30c5[_0x50b6('0x33')],function(_0xeed55f){var _0x3f3a4c={};_0x3f3a4c[_0xeed55f]={'$like':'%'+_0x43737e[_0x50b6('0x30')][_0x50b6('0x3a')]+'%'};return _0x3f3a4c;})});}_0x2d30c5=_[_0x50b6('0x3b')]({},_0x2d30c5,_0x43737e[_0x50b6('0x3c')]);return _0x2f730f[_0x50b6('0x4b')](_0x2d30c5);}})[_0x50b6('0x24')](function(_0x196afa){if(_0x196afa){_0x3dd6b4=_0x196afa[_0x50b6('0x42')];if(!_0x43737e[_0x50b6('0x30')][_0x50b6('0x34')](_0x50b6('0x35'))){_0x2d30c5[_0x50b6('0x1d')]=qs[_0x50b6('0x1d')](_0x43737e[_0x50b6('0x30')]['limit']);_0x2d30c5[_0x50b6('0x1a')]=qs[_0x50b6('0x1a')](_0x43737e[_0x50b6('0x30')][_0x50b6('0x1a')]);}return _0x2f730f[_0x50b6('0x4b')](_0x2d30c5);}})[_0x50b6('0x24')](function(_0x12736b){if(_0x12736b){return _0x12736b?{'count':_0x3dd6b4,'rows':_0x12736b}:null;}})[_0x50b6('0x24')](respondWithResult(_0x45069e,null))[_0x50b6('0x44')](handleError(_0x45069e,null));};exports[_0x50b6('0x4d')]=function(_0x67a6a7,_0xcb352b,_0x39ab3f){var _0x56896a={};var _0x8b3f01={};var _0x440a51;var _0x2dcd81;return db[_0x50b6('0x3d')][_0x50b6('0x48')]({'where':{'id':_0x67a6a7[_0x50b6('0x47')]['id']}})[_0x50b6('0x24')](handleEntityNotFound(_0xcb352b,null))[_0x50b6('0x24')](function(_0x5388a3){if(_0x5388a3){_0x440a51=_0x5388a3;_0x8b3f01[_0x50b6('0x2f')]=_[_0x50b6('0x31')](db[_0x50b6('0x49')][_0x50b6('0x40')]);_0x8b3f01['query']=_['keys'](_0x67a6a7['query']);_0x8b3f01['filters']=_[_0x50b6('0x41')](_0x8b3f01[_0x50b6('0x2f')],_0x8b3f01[_0x50b6('0x30')]);_0x56896a[_0x50b6('0x33')]=_[_0x50b6('0x41')](_0x8b3f01[_0x50b6('0x2f')],qs[_0x50b6('0x32')](_0x67a6a7[_0x50b6('0x30')][_0x50b6('0x32')]));_0x56896a['attributes']=_0x56896a[_0x50b6('0x33')][_0x50b6('0x42')]?_0x56896a[_0x50b6('0x33')]:_0x8b3f01['model'];_0x56896a[_0x50b6('0x4c')]=qs['sort'](_0x67a6a7[_0x50b6('0x30')][_0x50b6('0x36')]);_0x56896a[_0x50b6('0x37')]=qs[_0x50b6('0x38')](_[_0x50b6('0x39')](_0x67a6a7['query'],_0x8b3f01[_0x50b6('0x38')]));if(_0x67a6a7['query'][_0x50b6('0x3a')]){_0x56896a[_0x50b6('0x37')]=_[_0x50b6('0x3b')](_0x56896a[_0x50b6('0x37')],{'$or':_[_0x50b6('0x2b')](_0x56896a[_0x50b6('0x33')],function(_0x304100){var _0x28e4e9={};_0x28e4e9[_0x304100]={'$like':'%'+_0x67a6a7['query'][_0x50b6('0x3a')]+'%'};return _0x28e4e9;})});}_0x56896a=_[_0x50b6('0x3b')]({},_0x56896a,_0x67a6a7[_0x50b6('0x3c')]);return _0x440a51[_0x50b6('0x4d')](_0x56896a);}})[_0x50b6('0x24')](function(_0x34f34e){if(_0x34f34e){_0x2dcd81=_0x34f34e[_0x50b6('0x42')];if(!_0x67a6a7['query']['hasOwnProperty'](_0x50b6('0x35'))){_0x56896a[_0x50b6('0x1d')]=qs[_0x50b6('0x1d')](_0x67a6a7['query'][_0x50b6('0x1d')]);_0x56896a[_0x50b6('0x1a')]=qs[_0x50b6('0x1a')](_0x67a6a7['query'][_0x50b6('0x1a')]);}return _0x440a51[_0x50b6('0x4d')](_0x56896a);}})[_0x50b6('0x24')](function(_0x253277){if(_0x253277){return _0x253277?{'count':_0x2dcd81,'rows':_0x253277}:null;}})[_0x50b6('0x24')](respondWithResult(_0xcb352b,null))['catch'](handleError(_0xcb352b,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index c1d798f..98ea26a 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 _0xcdd1=['rimraf','../../config/environment','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x365cc6,_0x188bf4){var _0x20a95c=function(_0x4b74d1){while(--_0x4b74d1){_0x365cc6['push'](_0x365cc6['shift']());}};_0x20a95c(++_0x188bf4);}(_0xcdd1,0xf1));var _0x1cdd=function(_0x50c599,_0x21de75){_0x50c599=_0x50c599-0x0;var _0x245ca1=_0xcdd1[_0x50c599];return _0x245ca1;};'use strict';var _=require(_0x1cdd('0x0'));var util=require(_0x1cdd('0x1'));var logger=require(_0x1cdd('0x2'))('api');var moment=require(_0x1cdd('0x3'));var BPromise=require(_0x1cdd('0x4'));var rp=require(_0x1cdd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1cdd('0x6'));var config=require(_0x1cdd('0x7'));var attributes=require(_0x1cdd('0x8'));module[_0x1cdd('0x9')]=function(_0x344af1,_0x1ceb5e){return _0x344af1[_0x1cdd('0xa')](_0x1cdd('0xb'),attributes,{'tableName':_0x1cdd('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe79d=['api','bluebird','request-promise','path','rimraf','exports','define','FreshsalesConfiguration','int_freshsales_configurations','util'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe79d,0xe5));var _0xde79=function(_0x1d5d72,_0x3a402a){_0x1d5d72=_0x1d5d72-0x0;var _0x4a10fa=_0xe79d[_0x1d5d72];return _0x4a10fa;};'use strict';var _=require('lodash');var util=require(_0xde79('0x0'));var logger=require('../../config/logger')(_0xde79('0x1'));var moment=require('moment');var BPromise=require(_0xde79('0x2'));var rp=require(_0xde79('0x3'));var fs=require('fs');var path=require(_0xde79('0x4'));var rimraf=require(_0xde79('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xde79('0x6')]=function(_0x37a089,_0x25f1ae){return _0x37a089[_0xde79('0x7')](_0xde79('0x8'),attributes,{'tableName':_0xde79('0x9'),'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 817087a..8a807d6 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 _0x03f1=['../../config/environment','client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','ioredis','../../config/logger'];(function(_0x5a89f4,_0x1bf871){var _0x3921c9=function(_0x4c9b29){while(--_0x4c9b29){_0x5a89f4['push'](_0x5a89f4['shift']());}};_0x3921c9(++_0x1bf871);}(_0x03f1,0x10d));var _0x103f=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x03f1[_0x21549c];return _0x426cbd;};'use strict';var _=require('lodash');var util=require(_0x103f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x103f('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x103f('0x2'))('rpc');var config=require(_0x103f('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x103f('0x4')][_0x103f('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x87cbb9,_0x2b5770,_0x5301dc){return new BPromise(function(_0x2b9bbf,_0x360fbc){return client[_0x103f('0x6')](_0x87cbb9,_0x5301dc)[_0x103f('0x7')](function(_0x15501b){logger[_0x103f('0x8')](_0x103f('0x9'),_0x2b5770,_0x103f('0xa'));logger['debug'](_0x103f('0xb'),_0x2b5770,'request\x20sent',JSON[_0x103f('0xc')](_0x15501b));if(_0x15501b[_0x103f('0xd')]){if(_0x15501b[_0x103f('0xd')]['code']===0x1f4){logger[_0x103f('0xd')](_0x103f('0x9'),_0x2b5770,_0x15501b['error'][_0x103f('0xe')]);return _0x360fbc(_0x15501b[_0x103f('0xd')]['message']);}logger[_0x103f('0xd')](_0x103f('0x9'),_0x2b5770,_0x15501b[_0x103f('0xd')][_0x103f('0xe')]);return _0x2b9bbf(_0x15501b['error'][_0x103f('0xe')]);}else{logger[_0x103f('0x8')](_0x103f('0x9'),_0x2b5770,_0x103f('0xa'));_0x2b9bbf(_0x15501b[_0x103f('0xf')][_0x103f('0xe')]);}})[_0x103f('0x10')](function(_0x147ac7){logger[_0x103f('0xd')](_0x103f('0x9'),_0x2b5770,_0x147ac7);_0x360fbc(_0x147ac7);});});} \ No newline at end of file +var _0xbfb2=['debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4d1bdc,_0x395c16){var _0x8db334=function(_0x52f13c){while(--_0x52f13c){_0x4d1bdc['push'](_0x4d1bdc['shift']());}};_0x8db334(++_0x395c16);}(_0xbfb2,0x1e8));var _0x2bfb=function(_0x648272,_0x1f4b6a){_0x648272=_0x648272-0x0;var _0x1b0624=_0xbfb2[_0x648272];return _0x1b0624;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x2bfb('0x0'));var BPromise=require(_0x2bfb('0x1'));var rs=require(_0x2bfb('0x2'));var fs=require('fs');var Redis=require(_0x2bfb('0x3'));var db=require(_0x2bfb('0x4'))['db'];var utils=require(_0x2bfb('0x5'));var logger=require(_0x2bfb('0x6'))(_0x2bfb('0x7'));var config=require(_0x2bfb('0x8'));var jayson=require(_0x2bfb('0x9'));var client=jayson[_0x2bfb('0xa')][_0x2bfb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x186824,_0x1522ee,_0x3536f7){return new BPromise(function(_0x289a59,_0x37f431){return client['request'](_0x186824,_0x3536f7)[_0x2bfb('0xc')](function(_0x5dd895){logger[_0x2bfb('0xd')](_0x2bfb('0xe'),_0x1522ee,_0x2bfb('0xf'));logger[_0x2bfb('0x10')](_0x2bfb('0x11'),_0x1522ee,_0x2bfb('0xf'),JSON['stringify'](_0x5dd895));if(_0x5dd895[_0x2bfb('0x12')]){if(_0x5dd895[_0x2bfb('0x12')]['code']===0x1f4){logger[_0x2bfb('0x12')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1522ee,_0x5dd895['error'][_0x2bfb('0x13')]);return _0x37f431(_0x5dd895['error'][_0x2bfb('0x13')]);}logger['error'](_0x2bfb('0xe'),_0x1522ee,_0x5dd895[_0x2bfb('0x12')][_0x2bfb('0x13')]);return _0x289a59(_0x5dd895['error']['message']);}else{logger['info'](_0x2bfb('0xe'),_0x1522ee,_0x2bfb('0xf'));_0x289a59(_0x5dd895[_0x2bfb('0x14')]['message']);}})['catch'](function(_0x394205){logger[_0x2bfb('0x12')](_0x2bfb('0xe'),_0x1522ee,_0x394205);_0x37f431(_0x394205);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 3f0dacb..02dd779 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 _0xd382=['path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','isAuthenticated','show','post','put','/:id','delete','destroy','exports','multer','util'];(function(_0x4fb9b1,_0x3025e8){var _0x5f0ccf=function(_0x1c60be){while(--_0x1c60be){_0x4fb9b1['push'](_0x4fb9b1['shift']());}};_0x5f0ccf(++_0x3025e8);}(_0xd382,0x1b6));var _0x2d38=function(_0x26b594,_0x3f7732){_0x26b594=_0x26b594-0x0;var _0x13ec71=_0xd382[_0x26b594];return _0x13ec71;};'use strict';var multer=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var path=require(_0x2d38('0x2'));var timeout=require(_0x2d38('0x3'));var express=require(_0x2d38('0x4'));var router=express[_0x2d38('0x5')]();var fs_extra=require(_0x2d38('0x6'));var auth=require(_0x2d38('0x7'));var interaction=require(_0x2d38('0x8'));var config=require(_0x2d38('0x9'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x2d38('0xa')]);router[_0x2d38('0xb')]('/:id',auth[_0x2d38('0xc')](),controller[_0x2d38('0xd')]);router[_0x2d38('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2d38('0xf')](_0x2d38('0x10'),auth[_0x2d38('0xc')](),controller['update']);router[_0x2d38('0x11')]('/:id',auth[_0x2d38('0xc')](),controller[_0x2d38('0x12')]);module[_0x2d38('0x13')]=router; \ No newline at end of file +var _0xc17f=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x3bdf9f,_0x506232){var _0x2b3e42=function(_0x2a302a){while(--_0x2a302a){_0x3bdf9f['push'](_0x3bdf9f['shift']());}};_0x2b3e42(++_0x506232);}(_0xc17f,0xb8));var _0xfc17=function(_0x4736dc,_0x237d41){_0x4736dc=_0x4736dc-0x0;var _0x519148=_0xc17f[_0x4736dc];return _0x519148;};'use strict';var multer=require(_0xfc17('0x0'));var util=require(_0xfc17('0x1'));var path=require(_0xfc17('0x2'));var timeout=require(_0xfc17('0x3'));var express=require(_0xfc17('0x4'));var router=express[_0xfc17('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xfc17('0x6'));var interaction=require(_0xfc17('0x7'));var config=require(_0xfc17('0x8'));var controller=require(_0xfc17('0x9'));router['get']('/',auth[_0xfc17('0xa')](),controller[_0xfc17('0xb')]);router[_0xfc17('0xc')](_0xfc17('0xd'),auth[_0xfc17('0xa')](),controller[_0xfc17('0xe')]);router[_0xfc17('0xf')]('/',auth[_0xfc17('0xa')](),controller['create']);router[_0xfc17('0x10')](_0xfc17('0xd'),auth[_0xfc17('0xa')](),controller[_0xfc17('0x11')]);router['delete']('/:id',auth[_0xfc17('0xa')](),controller[_0xfc17('0x12')]);module[_0xfc17('0x13')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 36af0e8..e038c95 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 _0xbb5f=['variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0xbb5f,0x150));var _0xfbb5=function(_0x53a9fb,_0x359190){_0x53a9fb=_0x53a9fb-0x0;var _0x529ad0=_0xbb5f[_0x53a9fb];return _0x529ad0;};'use strict';var Sequelize=require(_0xfbb5('0x0'));module[_0xfbb5('0x1')]={'type':{'type':Sequelize[_0xfbb5('0x2')](_0xfbb5('0x3'),_0xfbb5('0x4'),_0xfbb5('0x5'),_0xfbb5('0x6'),_0xfbb5('0x7')),'defaultValue':_0xfbb5('0x3')},'content':{'type':Sequelize[_0xfbb5('0x8')]},'key':{'type':Sequelize[_0xfbb5('0x8')]},'keyType':{'type':Sequelize[_0xfbb5('0x2')]('string','variable','customVariable')},'keyContent':{'type':Sequelize[_0xfbb5('0x8')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfbb5('0x8')]},'customField':{'type':Sequelize[_0xfbb5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xfbb5('0x8')]}}; \ No newline at end of file +var _0x4d64=['keyValue','string','STRING','customVariable','BOOLEAN','variable'];(function(_0x5aaed7,_0x5f0471){var _0xa2914e=function(_0x23ac30){while(--_0x23ac30){_0x5aaed7['push'](_0x5aaed7['shift']());}};_0xa2914e(++_0x5f0471);}(_0x4d64,0xbf));var _0x44d6=function(_0x43877f,_0x155848){_0x43877f=_0x43877f-0x0;var _0x574f28=_0x4d64[_0x43877f];return _0x574f28;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM']('string',_0x44d6('0x0'),'customVariable',_0x44d6('0x1'),'picklist'),'defaultValue':_0x44d6('0x2')},'content':{'type':Sequelize[_0x44d6('0x3')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM']('string',_0x44d6('0x0'),_0x44d6('0x4'))},'keyContent':{'type':Sequelize[_0x44d6('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x44d6('0x3')]},'customField':{'type':Sequelize[_0x44d6('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x44d6('0x3')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 490fb97..176096b 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 _0x6078=['hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','FreshsalesField','include','rows','catch','show','includeAll','merge','find','create','body','params','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length'];(function(_0x5403ec,_0x285bbf){var _0x14fbd4=function(_0x12a29f){while(--_0x12a29f){_0x5403ec['push'](_0x5403ec['shift']());}};_0x14fbd4(++_0x285bbf);}(_0x6078,0x150));var _0x8607=function(_0x510e91,_0x5bf2d9){_0x510e91=_0x510e91-0x0;var _0x369221=_0x6078[_0x510e91];return _0x369221;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8607('0x0'));var zipdir=require(_0x8607('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8607('0x2'));var moment=require(_0x8607('0x3'));var BPromise=require(_0x8607('0x4'));var Mustache=require(_0x8607('0x5'));var util=require(_0x8607('0x6'));var path=require(_0x8607('0x7'));var sox=require('sox');var csv=require(_0x8607('0x8'));var ejs=require(_0x8607('0x9'));var fs=require('fs');var fs_extra=require(_0x8607('0xa'));var _=require(_0x8607('0xb'));var squel=require(_0x8607('0xc'));var crypto=require(_0x8607('0xd'));var jsforce=require(_0x8607('0xe'));var deskjs=require(_0x8607('0xf'));var toCsv=require(_0x8607('0x8'));var querystring=require(_0x8607('0x10'));var Papa=require(_0x8607('0x11'));var Redis=require(_0x8607('0x12'));var authService=require(_0x8607('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8607('0x14'));var logger=require(_0x8607('0x15'))(_0x8607('0x16'));var utils=require(_0x8607('0x17'));var config=require(_0x8607('0x18'));var licenseUtil=require(_0x8607('0x19'));var db=require(_0x8607('0x1a'))['db'];function respondWithStatusCode(_0x272b06,_0x3302b5){_0x3302b5=_0x3302b5||0xcc;return function(_0x1ae9ad){if(_0x1ae9ad){return _0x272b06['sendStatus'](_0x3302b5);}return _0x272b06[_0x8607('0x1b')](_0x3302b5)[_0x8607('0x1c')]();};}function respondWithResult(_0x8e853a,_0x3dd9c5){_0x3dd9c5=_0x3dd9c5||0xc8;return function(_0x523769){if(_0x523769){return _0x8e853a[_0x8607('0x1b')](_0x3dd9c5)[_0x8607('0x1d')](_0x523769);}};}function respondWithFilteredResult(_0x33c7dd,_0xdc64c){return function(_0x58fbab){if(_0x58fbab){var _0x528bde=typeof _0xdc64c[_0x8607('0x1e')]===_0x8607('0x1f')&&typeof _0xdc64c[_0x8607('0x20')]===_0x8607('0x1f');var _0xbd62db=_0x58fbab[_0x8607('0x21')];var _0x3ae624=_0x528bde?0x0:_0xdc64c[_0x8607('0x1e')];var _0x31df04=_0x528bde?_0x58fbab[_0x8607('0x21')]:_0xdc64c[_0x8607('0x1e')]+_0xdc64c['limit'];var _0x12c35d;if(_0x31df04>=_0xbd62db){_0x31df04=_0xbd62db;_0x12c35d=0xc8;}else{_0x12c35d=0xce;}_0x33c7dd['status'](_0x12c35d);return _0x33c7dd[_0x8607('0x22')](_0x8607('0x23'),_0x3ae624+'-'+_0x31df04+'/'+_0xbd62db)[_0x8607('0x1d')](_0x58fbab);}return null;};}function patchUpdates(_0x4778b9){return function(_0x1cf6f6){try{jsonpatch[_0x8607('0x24')](_0x1cf6f6,_0x4778b9,!![]);}catch(_0x29a6a5){return BPromise[_0x8607('0x25')](_0x29a6a5);}return _0x1cf6f6[_0x8607('0x26')]();};}function saveUpdates(_0x295268,_0xcda4e){return function(_0x4b6ea6){if(_0x4b6ea6){return _0x4b6ea6[_0x8607('0x27')](_0x295268)[_0x8607('0x28')](function(_0xb105b3){return _0xb105b3;});}return null;};}function removeEntity(_0x584f7d,_0x458781){return function(_0x21a82b){if(_0x21a82b){return _0x21a82b[_0x8607('0x29')]()['then'](function(){_0x584f7d[_0x8607('0x1b')](0xcc)[_0x8607('0x1c')]();});}};}function handleEntityNotFound(_0x480b26,_0xb50668){return function(_0x29b9d0){if(!_0x29b9d0){_0x480b26[_0x8607('0x2a')](0x194);}return _0x29b9d0;};}function handleError(_0x44382c,_0x16c6b4){_0x16c6b4=_0x16c6b4||0x1f4;return function(_0x2efaef){logger['error'](_0x2efaef[_0x8607('0x2b')]);if(_0x2efaef[_0x8607('0x2c')]){delete _0x2efaef['name'];}_0x44382c[_0x8607('0x1b')](_0x16c6b4)[_0x8607('0x2d')](_0x2efaef);};}exports[_0x8607('0x2e')]=function(_0x5f1248,_0x7db202){var _0x3e9b4d={},_0x177c5a={},_0x475301={'count':0x0,'rows':[]};var _0x76622d=_['map'](db['FreshsalesField'][_0x8607('0x2f')],function(_0x49d0b2){return{'name':_0x49d0b2['fieldName'],'type':_0x49d0b2[_0x8607('0x30')][_0x8607('0x31')]};});_0x177c5a[_0x8607('0x32')]=_[_0x8607('0x33')](_0x76622d,'name');_0x177c5a['query']=_[_0x8607('0x34')](_0x5f1248[_0x8607('0x35')]);_0x177c5a[_0x8607('0x36')]=_[_0x8607('0x37')](_0x177c5a[_0x8607('0x32')],_0x177c5a[_0x8607('0x35')]);_0x3e9b4d[_0x8607('0x38')]=_[_0x8607('0x37')](_0x177c5a[_0x8607('0x32')],qs[_0x8607('0x39')](_0x5f1248[_0x8607('0x35')][_0x8607('0x39')]));_0x3e9b4d[_0x8607('0x38')]=_0x3e9b4d[_0x8607('0x38')][_0x8607('0x3a')]?_0x3e9b4d[_0x8607('0x38')]:_0x177c5a[_0x8607('0x32')];if(!_0x5f1248[_0x8607('0x35')][_0x8607('0x3b')](_0x8607('0x3c'))){_0x3e9b4d['limit']=qs['limit'](_0x5f1248[_0x8607('0x35')]['limit']);_0x3e9b4d[_0x8607('0x1e')]=qs[_0x8607('0x1e')](_0x5f1248[_0x8607('0x35')][_0x8607('0x1e')]);}_0x3e9b4d[_0x8607('0x3d')]=qs[_0x8607('0x3e')](_0x5f1248[_0x8607('0x35')][_0x8607('0x3e')]);_0x3e9b4d['where']=qs[_0x8607('0x36')](_[_0x8607('0x3f')](_0x5f1248[_0x8607('0x35')],_0x177c5a[_0x8607('0x36')]),_0x76622d);if(_0x5f1248[_0x8607('0x35')][_0x8607('0x40')]){_0x3e9b4d[_0x8607('0x41')]=_['merge'](_0x3e9b4d[_0x8607('0x41')],{'$or':_['map'](_0x76622d,function(_0x143018){if(_0x143018[_0x8607('0x30')]!==_0x8607('0x42')){var _0x4a19a4={};_0x4a19a4[_0x143018[_0x8607('0x2c')]]={'$like':'%'+_0x5f1248[_0x8607('0x35')][_0x8607('0x40')]+'%'};return _0x4a19a4;}})});}_0x3e9b4d=_['merge']({},_0x3e9b4d,_0x5f1248[_0x8607('0x43')]);var _0x2de8be={'where':_0x3e9b4d[_0x8607('0x41')]};return db[_0x8607('0x44')][_0x8607('0x21')](_0x2de8be)['then'](function(_0x477b3c){_0x475301[_0x8607('0x21')]=_0x477b3c;if(_0x5f1248[_0x8607('0x35')]['includeAll']){_0x3e9b4d[_0x8607('0x45')]=[{'all':!![]}];}return db[_0x8607('0x44')]['findAll'](_0x3e9b4d);})[_0x8607('0x28')](function(_0x34e9ed){_0x475301[_0x8607('0x46')]=_0x34e9ed;return _0x475301;})[_0x8607('0x28')](respondWithFilteredResult(_0x7db202,_0x3e9b4d))[_0x8607('0x47')](handleError(_0x7db202,null));};exports[_0x8607('0x48')]=function(_0x176800,_0x5a89fe){var _0x36f57f={'raw':!![],'where':{'id':_0x176800['params']['id']}},_0xf53d89={};_0xf53d89[_0x8607('0x32')]=_['keys'](db[_0x8607('0x44')][_0x8607('0x2f')]);_0xf53d89[_0x8607('0x35')]=_[_0x8607('0x34')](_0x176800[_0x8607('0x35')]);_0xf53d89[_0x8607('0x36')]=_[_0x8607('0x37')](_0xf53d89[_0x8607('0x32')],_0xf53d89[_0x8607('0x35')]);_0x36f57f['attributes']=_['intersection'](_0xf53d89[_0x8607('0x32')],qs[_0x8607('0x39')](_0x176800[_0x8607('0x35')]['fields']));_0x36f57f[_0x8607('0x38')]=_0x36f57f[_0x8607('0x38')][_0x8607('0x3a')]?_0x36f57f[_0x8607('0x38')]:_0xf53d89[_0x8607('0x32')];if(_0x176800[_0x8607('0x35')][_0x8607('0x49')]){_0x36f57f[_0x8607('0x45')]=[{'all':!![]}];}_0x36f57f=_[_0x8607('0x4a')]({},_0x36f57f,_0x176800[_0x8607('0x43')]);return db['FreshsalesField'][_0x8607('0x4b')](_0x36f57f)['then'](handleEntityNotFound(_0x5a89fe,null))[_0x8607('0x28')](respondWithResult(_0x5a89fe,null))[_0x8607('0x47')](handleError(_0x5a89fe,null));};exports[_0x8607('0x4c')]=function(_0x187742,_0x3f11f3){return db[_0x8607('0x44')][_0x8607('0x4c')](_0x187742[_0x8607('0x4d')],{})[_0x8607('0x28')](respondWithResult(_0x3f11f3,0xc9))['catch'](handleError(_0x3f11f3,null));};exports['update']=function(_0x1a3956,_0x1f47a6){if(_0x1a3956[_0x8607('0x4d')]['id']){delete _0x1a3956['body']['id'];}return db[_0x8607('0x44')][_0x8607('0x4b')]({'where':{'id':_0x1a3956[_0x8607('0x4e')]['id']}})[_0x8607('0x28')](handleEntityNotFound(_0x1f47a6,null))[_0x8607('0x28')](saveUpdates(_0x1a3956['body'],null))[_0x8607('0x28')](respondWithResult(_0x1f47a6,null))[_0x8607('0x47')](handleError(_0x1f47a6,null));};exports[_0x8607('0x29')]=function(_0x2f583a,_0x1d1771){return db[_0x8607('0x44')][_0x8607('0x4b')]({'where':{'id':_0x2f583a[_0x8607('0x4e')]['id']}})[_0x8607('0x28')](handleEntityNotFound(_0x1d1771,null))[_0x8607('0x28')](removeEntity(_0x1d1771,null))['catch'](handleError(_0x1d1771,null));}; \ No newline at end of file +var _0x3ea5=['catch','show','params','rawAttributes','include','find','create','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','FreshsalesField','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows'];(function(_0xf79bae,_0x263b2a){var _0x5d2cb7=function(_0x27c86b){while(--_0x27c86b){_0xf79bae['push'](_0xf79bae['shift']());}};_0x5d2cb7(++_0x263b2a);}(_0x3ea5,0x1e8));var _0x53ea=function(_0x3868c7,_0x165fa5){_0x3868c7=_0x3868c7-0x0;var _0x1c5042=_0x3ea5[_0x3868c7];return _0x1c5042;};'use strict';var emlformat=require(_0x53ea('0x0'));var rimraf=require(_0x53ea('0x1'));var zipdir=require(_0x53ea('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x53ea('0x3'));var moment=require(_0x53ea('0x4'));var BPromise=require(_0x53ea('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x53ea('0x6'));var sox=require(_0x53ea('0x7'));var csv=require(_0x53ea('0x8'));var ejs=require(_0x53ea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x53ea('0xa'));var squel=require(_0x53ea('0xb'));var crypto=require(_0x53ea('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x53ea('0xd'));var toCsv=require(_0x53ea('0x8'));var querystring=require(_0x53ea('0xe'));var Papa=require(_0x53ea('0xf'));var Redis=require(_0x53ea('0x10'));var authService=require(_0x53ea('0x11'));var qs=require(_0x53ea('0x12'));var as=require(_0x53ea('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x53ea('0x14'))(_0x53ea('0x15'));var utils=require(_0x53ea('0x16'));var config=require(_0x53ea('0x17'));var licenseUtil=require(_0x53ea('0x18'));var db=require(_0x53ea('0x19'))['db'];function respondWithStatusCode(_0x2b7bab,_0x15b8bb){_0x15b8bb=_0x15b8bb||0xcc;return function(_0x2ed2c3){if(_0x2ed2c3){return _0x2b7bab[_0x53ea('0x1a')](_0x15b8bb);}return _0x2b7bab[_0x53ea('0x1b')](_0x15b8bb)[_0x53ea('0x1c')]();};}function respondWithResult(_0x247eb0,_0x50ab20){_0x50ab20=_0x50ab20||0xc8;return function(_0x2cf55f){if(_0x2cf55f){return _0x247eb0[_0x53ea('0x1b')](_0x50ab20)[_0x53ea('0x1d')](_0x2cf55f);}};}function respondWithFilteredResult(_0x164da7,_0x3f0045){return function(_0x352173){if(_0x352173){var _0x1b2965=typeof _0x3f0045['offset']===_0x53ea('0x1e')&&typeof _0x3f0045[_0x53ea('0x1f')]==='undefined';var _0x5eac8c=_0x352173['count'];var _0x5efc82=_0x1b2965?0x0:_0x3f0045[_0x53ea('0x20')];var _0x404262=_0x1b2965?_0x352173[_0x53ea('0x21')]:_0x3f0045[_0x53ea('0x20')]+_0x3f0045['limit'];var _0x1efcc5;if(_0x404262>=_0x5eac8c){_0x404262=_0x5eac8c;_0x1efcc5=0xc8;}else{_0x1efcc5=0xce;}_0x164da7[_0x53ea('0x1b')](_0x1efcc5);return _0x164da7[_0x53ea('0x22')](_0x53ea('0x23'),_0x5efc82+'-'+_0x404262+'/'+_0x5eac8c)[_0x53ea('0x1d')](_0x352173);}return null;};}function patchUpdates(_0x4386ff){return function(_0xd7c41){try{jsonpatch[_0x53ea('0x24')](_0xd7c41,_0x4386ff,!![]);}catch(_0x243f11){return BPromise[_0x53ea('0x25')](_0x243f11);}return _0xd7c41[_0x53ea('0x26')]();};}function saveUpdates(_0x4738cf,_0x28b663){return function(_0x3c03a3){if(_0x3c03a3){return _0x3c03a3[_0x53ea('0x27')](_0x4738cf)[_0x53ea('0x28')](function(_0x23719a){return _0x23719a;});}return null;};}function removeEntity(_0x4b4110,_0x118c6a){return function(_0x34f1c3){if(_0x34f1c3){return _0x34f1c3[_0x53ea('0x29')]()[_0x53ea('0x28')](function(){_0x4b4110[_0x53ea('0x1b')](0xcc)[_0x53ea('0x1c')]();});}};}function handleEntityNotFound(_0x107d35,_0x332871){return function(_0x5283d2){if(!_0x5283d2){_0x107d35['sendStatus'](0x194);}return _0x5283d2;};}function handleError(_0x1d63a7,_0x1bbb3a){_0x1bbb3a=_0x1bbb3a||0x1f4;return function(_0x3c57a3){logger[_0x53ea('0x2a')](_0x3c57a3[_0x53ea('0x2b')]);if(_0x3c57a3[_0x53ea('0x2c')]){delete _0x3c57a3['name'];}_0x1d63a7[_0x53ea('0x1b')](_0x1bbb3a)[_0x53ea('0x2d')](_0x3c57a3);};}exports['index']=function(_0x40155a,_0x3356db){var _0x2a120f={},_0x4f4226={},_0x18d6da={'count':0x0,'rows':[]};var _0x32859f=_[_0x53ea('0x2e')](db[_0x53ea('0x2f')]['rawAttributes'],function(_0x5f50be){return{'name':_0x5f50be[_0x53ea('0x30')],'type':_0x5f50be['type'][_0x53ea('0x31')]};});_0x4f4226[_0x53ea('0x32')]=_[_0x53ea('0x2e')](_0x32859f,_0x53ea('0x2c'));_0x4f4226[_0x53ea('0x33')]=_[_0x53ea('0x34')](_0x40155a[_0x53ea('0x33')]);_0x4f4226[_0x53ea('0x35')]=_[_0x53ea('0x36')](_0x4f4226[_0x53ea('0x32')],_0x4f4226[_0x53ea('0x33')]);_0x2a120f['attributes']=_[_0x53ea('0x36')](_0x4f4226[_0x53ea('0x32')],qs[_0x53ea('0x37')](_0x40155a[_0x53ea('0x33')][_0x53ea('0x37')]));_0x2a120f[_0x53ea('0x38')]=_0x2a120f[_0x53ea('0x38')][_0x53ea('0x39')]?_0x2a120f[_0x53ea('0x38')]:_0x4f4226['model'];if(!_0x40155a[_0x53ea('0x33')][_0x53ea('0x3a')](_0x53ea('0x3b'))){_0x2a120f[_0x53ea('0x1f')]=qs['limit'](_0x40155a[_0x53ea('0x33')][_0x53ea('0x1f')]);_0x2a120f[_0x53ea('0x20')]=qs[_0x53ea('0x20')](_0x40155a[_0x53ea('0x33')][_0x53ea('0x20')]);}_0x2a120f[_0x53ea('0x3c')]=qs['sort'](_0x40155a[_0x53ea('0x33')][_0x53ea('0x3d')]);_0x2a120f[_0x53ea('0x3e')]=qs[_0x53ea('0x35')](_[_0x53ea('0x3f')](_0x40155a['query'],_0x4f4226[_0x53ea('0x35')]),_0x32859f);if(_0x40155a[_0x53ea('0x33')][_0x53ea('0x40')]){_0x2a120f[_0x53ea('0x3e')]=_[_0x53ea('0x41')](_0x2a120f[_0x53ea('0x3e')],{'$or':_[_0x53ea('0x2e')](_0x32859f,function(_0x2109fe){if(_0x2109fe[_0x53ea('0x42')]!==_0x53ea('0x43')){var _0x2caa5a={};_0x2caa5a[_0x2109fe[_0x53ea('0x2c')]]={'$like':'%'+_0x40155a[_0x53ea('0x33')][_0x53ea('0x40')]+'%'};return _0x2caa5a;}})});}_0x2a120f=_['merge']({},_0x2a120f,_0x40155a[_0x53ea('0x44')]);var _0x393da3={'where':_0x2a120f[_0x53ea('0x3e')]};return db[_0x53ea('0x2f')][_0x53ea('0x21')](_0x393da3)[_0x53ea('0x28')](function(_0xcc27e2){_0x18d6da[_0x53ea('0x21')]=_0xcc27e2;if(_0x40155a[_0x53ea('0x33')][_0x53ea('0x45')]){_0x2a120f['include']=[{'all':!![]}];}return db[_0x53ea('0x2f')][_0x53ea('0x46')](_0x2a120f);})[_0x53ea('0x28')](function(_0x342e1f){_0x18d6da[_0x53ea('0x47')]=_0x342e1f;return _0x18d6da;})[_0x53ea('0x28')](respondWithFilteredResult(_0x3356db,_0x2a120f))[_0x53ea('0x48')](handleError(_0x3356db,null));};exports[_0x53ea('0x49')]=function(_0x2ecc02,_0x3e550f){var _0x1c042f={'raw':!![],'where':{'id':_0x2ecc02[_0x53ea('0x4a')]['id']}},_0x191e36={};_0x191e36['model']=_[_0x53ea('0x34')](db[_0x53ea('0x2f')][_0x53ea('0x4b')]);_0x191e36['query']=_[_0x53ea('0x34')](_0x2ecc02[_0x53ea('0x33')]);_0x191e36[_0x53ea('0x35')]=_[_0x53ea('0x36')](_0x191e36[_0x53ea('0x32')],_0x191e36[_0x53ea('0x33')]);_0x1c042f['attributes']=_['intersection'](_0x191e36[_0x53ea('0x32')],qs[_0x53ea('0x37')](_0x2ecc02['query']['fields']));_0x1c042f['attributes']=_0x1c042f[_0x53ea('0x38')][_0x53ea('0x39')]?_0x1c042f['attributes']:_0x191e36[_0x53ea('0x32')];if(_0x2ecc02['query'][_0x53ea('0x45')]){_0x1c042f[_0x53ea('0x4c')]=[{'all':!![]}];}_0x1c042f=_[_0x53ea('0x41')]({},_0x1c042f,_0x2ecc02[_0x53ea('0x44')]);return db[_0x53ea('0x2f')][_0x53ea('0x4d')](_0x1c042f)[_0x53ea('0x28')](handleEntityNotFound(_0x3e550f,null))[_0x53ea('0x28')](respondWithResult(_0x3e550f,null))[_0x53ea('0x48')](handleError(_0x3e550f,null));};exports[_0x53ea('0x4e')]=function(_0x407fbc,_0x4f6f9f){return db[_0x53ea('0x2f')]['create'](_0x407fbc['body'],{})[_0x53ea('0x28')](respondWithResult(_0x4f6f9f,0xc9))[_0x53ea('0x48')](handleError(_0x4f6f9f,null));};exports[_0x53ea('0x27')]=function(_0xee7127,_0x2a0cd6){if(_0xee7127['body']['id']){delete _0xee7127[_0x53ea('0x4f')]['id'];}return db[_0x53ea('0x2f')][_0x53ea('0x4d')]({'where':{'id':_0xee7127[_0x53ea('0x4a')]['id']}})[_0x53ea('0x28')](handleEntityNotFound(_0x2a0cd6,null))[_0x53ea('0x28')](saveUpdates(_0xee7127[_0x53ea('0x4f')],null))['then'](respondWithResult(_0x2a0cd6,null))[_0x53ea('0x48')](handleError(_0x2a0cd6,null));};exports[_0x53ea('0x29')]=function(_0xaa4fb0,_0x228e40){return db[_0x53ea('0x2f')][_0x53ea('0x4d')]({'where':{'id':_0xaa4fb0[_0x53ea('0x4a')]['id']}})[_0x53ea('0x28')](handleEntityNotFound(_0x228e40,null))[_0x53ea('0x28')](removeEntity(_0x228e40,null))['catch'](handleError(_0x228e40,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index bcd333e..9e0c28a 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 _0x2ff5=['../../config/environment','exports','FreshsalesField','int_freshsales_fields','freshsales_unique_index','idField','FieldId','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4be3e7,_0x3a7f05){var _0x4d44a0=function(_0x3eafee){while(--_0x3eafee){_0x4be3e7['push'](_0x4be3e7['shift']());}};_0x4d44a0(++_0x3a7f05);}(_0x2ff5,0x1d5));var _0x52ff=function(_0x1d92ff,_0x21fc6a){_0x1d92ff=_0x1d92ff-0x0;var _0x4ac46b=_0x2ff5[_0x1d92ff];return _0x4ac46b;};'use strict';var _=require('lodash');var util=require(_0x52ff('0x0'));var logger=require(_0x52ff('0x1'))('api');var moment=require(_0x52ff('0x2'));var BPromise=require(_0x52ff('0x3'));var rp=require(_0x52ff('0x4'));var fs=require('fs');var path=require(_0x52ff('0x5'));var rimraf=require(_0x52ff('0x6'));var config=require(_0x52ff('0x7'));var attributes=require('./intFreshsalesField.attributes');module[_0x52ff('0x8')]=function(_0x285f60,_0x26906c){return _0x285f60['define'](_0x52ff('0x9'),attributes,{'tableName':_0x52ff('0xa'),'paranoid':![],'indexes':[{'name':_0x52ff('0xb'),'fields':[_0x52ff('0xc'),_0x52ff('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x01a6=['freshsales_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','./intFreshsalesField.attributes','exports','define'];(function(_0x2c8d85,_0x590fef){var _0x277ef4=function(_0x7c7a91){while(--_0x7c7a91){_0x2c8d85['push'](_0x2c8d85['shift']());}};_0x277ef4(++_0x590fef);}(_0x01a6,0x162));var _0x601a=function(_0x2f0577,_0x1ee479){_0x2f0577=_0x2f0577-0x0;var _0x2c789f=_0x01a6[_0x2f0577];return _0x2c789f;};'use strict';var _=require(_0x601a('0x0'));var util=require('util');var logger=require(_0x601a('0x1'))(_0x601a('0x2'));var moment=require(_0x601a('0x3'));var BPromise=require(_0x601a('0x4'));var rp=require(_0x601a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x601a('0x6'));var config=require('../../config/environment');var attributes=require(_0x601a('0x7'));module[_0x601a('0x8')]=function(_0x30df8c,_0x196c77){return _0x30df8c[_0x601a('0x9')]('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0x601a('0xa'),'fields':[_0x601a('0xb'),_0x601a('0xc')],'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 115adb0..420e7ad 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 _0x7c09=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','then','info','FreshsalesField,\x20%s,\x20%s','FreshsalesField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment'];(function(_0xdf5452,_0x19af67){var _0xf35e7b=function(_0x4a4ad8){while(--_0x4a4ad8){_0xdf5452['push'](_0xdf5452['shift']());}};_0xf35e7b(++_0x19af67);}(_0x7c09,0x102));var _0x97c0=function(_0x49a5c2,_0x1f0b88){_0x49a5c2=_0x49a5c2-0x0;var _0x5172a6=_0x7c09[_0x49a5c2];return _0x5172a6;};'use strict';var _=require('lodash');var util=require(_0x97c0('0x0'));var moment=require(_0x97c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x97c0('0x2'));var fs=require('fs');var Redis=require(_0x97c0('0x3'));var db=require(_0x97c0('0x4'))['db'];var utils=require(_0x97c0('0x5'));var logger=require(_0x97c0('0x6'))(_0x97c0('0x7'));var config=require(_0x97c0('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46fdd9,_0x42c6c7,_0x2c19fa){return new BPromise(function(_0x109bc8,_0x293785){return client['request'](_0x46fdd9,_0x2c19fa)[_0x97c0('0x9')](function(_0x4ac5f1){logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,'request\x20sent');logger['debug'](_0x97c0('0xc'),_0x42c6c7,_0x97c0('0xd'),JSON[_0x97c0('0xe')](_0x4ac5f1));if(_0x4ac5f1[_0x97c0('0xf')]){if(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x10')]===0x1f4){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x293785(_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);}logger[_0x97c0('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x42c6c7,_0x4ac5f1[_0x97c0('0xf')][_0x97c0('0x11')]);return _0x109bc8(_0x4ac5f1[_0x97c0('0xf')]['message']);}else{logger[_0x97c0('0xa')](_0x97c0('0xb'),_0x42c6c7,_0x97c0('0xd'));_0x109bc8(_0x4ac5f1[_0x97c0('0x12')][_0x97c0('0x11')]);}})[_0x97c0('0x13')](function(_0x49c0d9){logger[_0x97c0('0xf')](_0x97c0('0xb'),_0x42c6c7,_0x49c0d9);_0x293785(_0x49c0d9);});});} \ No newline at end of file +var _0x01d9=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x50503b,_0x3d28a8){var _0x7d499d=function(_0x1d247c){while(--_0x1d247c){_0x50503b['push'](_0x50503b['shift']());}};_0x7d499d(++_0x3d28a8);}(_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 moment=require(_0x901d('0x2'));var BPromise=require(_0x901d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x901d('0x4'));var db=require(_0x901d('0x5'))['db'];var utils=require(_0x901d('0x6'));var logger=require(_0x901d('0x7'))(_0x901d('0x8'));var config=require(_0x901d('0x9'));var jayson=require(_0x901d('0xa'));var client=jayson['client'][_0x901d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x6c9ac8,_0x21e1d7,_0x12c39f){return new BPromise(function(_0x313f85,_0x39fc94){return client[_0x901d('0xc')](_0x6c9ac8,_0x12c39f)[_0x901d('0xd')](function(_0x15076e){logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));logger[_0x901d('0x11')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x21e1d7,_0x901d('0x10'),JSON['stringify'](_0x15076e));if(_0x15076e[_0x901d('0x12')]){if(_0x15076e[_0x901d('0x12')][_0x901d('0x13')]===0x1f4){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e['error'][_0x901d('0x14')]);return _0x39fc94(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x15076e[_0x901d('0x12')]['message']);return _0x313f85(_0x15076e[_0x901d('0x12')][_0x901d('0x14')]);}else{logger[_0x901d('0xe')](_0x901d('0xf'),_0x21e1d7,_0x901d('0x10'));_0x313f85(_0x15076e[_0x901d('0x15')][_0x901d('0x14')]);}})[_0x901d('0x16')](function(_0x3368fc){logger[_0x901d('0x12')](_0x901d('0xf'),_0x21e1d7,_0x3368fc);_0x39fc94(_0x3368fc);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index dccb580..02e458f 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x11ac91,_0x20c725){var _0x5a63dc=function(_0x157380){while(--_0x157380){_0x11ac91['push'](_0x11ac91['shift']());}};_0x5a63dc(++_0x20c725);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'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/configurations',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/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x99c649,_0x512e81){var _0x355801=function(_0x14dee6){while(--_0x14dee6){_0x99c649['push'](_0x99c649['shift']());}};_0x355801(++_0x512e81);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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/configurations',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/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 86d100f..b77fdcf 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 _0x27eb=['STRING','username','integrationTab','newTab','sequelize','exports'];(function(_0x56a485,_0x3a7460){var _0x251950=function(_0x4f0588){while(--_0x4f0588){_0x56a485['push'](_0x56a485['shift']());}};_0x251950(++_0x3a7460);}(_0x27eb,0xd0));var _0xb27e=function(_0x58b665,_0x277208){_0x58b665=_0x58b665-0x0;var _0x4e1311=_0x27eb[_0x58b665];return _0x4e1311;};'use strict';var Sequelize=require(_0xb27e('0x0'));module[_0xb27e('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb27e('0x2')],'unique':_0xb27e('0x3')},'remoteUri':{'type':Sequelize[_0xb27e('0x2')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb27e('0x2')]},'clientSecret':{'type':Sequelize[_0xb27e('0x2')]},'securityToken':{'type':Sequelize[_0xb27e('0x2')]},'serverUrl':{'type':Sequelize[_0xb27e('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb27e('0x4'),_0xb27e('0x5')),'defaultValue':_0xb27e('0x4')}}; \ No newline at end of file +var _0xeec6=['STRING','username','ENUM','newTab','integrationTab','sequelize'];(function(_0x214caf,_0x59e8d2){var _0x2c977d=function(_0x54872e){while(--_0x54872e){_0x214caf['push'](_0x214caf['shift']());}};_0x2c977d(++_0x59e8d2);}(_0xeec6,0x125));var _0x6eec=function(_0x54eab6,_0x5e262f){_0x54eab6=_0x54eab6-0x0;var _0x1e7435=_0xeec6[_0x54eab6];return _0x1e7435;};'use strict';var Sequelize=require(_0x6eec('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6eec('0x1')]},'username':{'type':Sequelize[_0x6eec('0x1')],'unique':_0x6eec('0x2')},'remoteUri':{'type':Sequelize[_0x6eec('0x1')]},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6eec('0x1')]},'clientSecret':{'type':Sequelize[_0x6eec('0x1')]},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x6eec('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6eec('0x3')]('integrationTab',_0x6eec('0x4')),'defaultValue':_0x6eec('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index 840310a..037f357 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 _0x7cb5=['Task','remoteUri','clientId','clientSecret','username','password','securityToken','slice','lastIndexOf','concat','isNil','ticketType','sobject','describe','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','string','picklist','boolean','email','textarea','phone','remove','includes','custom','picklistValues','label','value','True','true','false','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','zip-dir','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','map','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','include','SalesforceAccount','rows','catch','show','params','includeAll','create','body','find','getConfigurations','findOne','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SalesforceConfiguration','SalesforceField','Descriptions'];(function(_0x62c958,_0x2bfdbc){var _0x57ec61=function(_0x5c0094){while(--_0x5c0094){_0x62c958['push'](_0x62c958['shift']());}};_0x57ec61(++_0x2bfdbc);}(_0x7cb5,0x1a2));var _0x57cb=function(_0x36fbfe,_0xadb2f7){_0x36fbfe=_0x36fbfe-0x0;var _0x1a69be=_0x7cb5[_0x36fbfe];return _0x1a69be;};'use strict';var emlformat=require(_0x57cb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x57cb('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x57cb('0x2'));var BPromise=require(_0x57cb('0x3'));var Mustache=require('mustache');var util=require(_0x57cb('0x4'));var path=require(_0x57cb('0x5'));var sox=require(_0x57cb('0x6'));var csv=require(_0x57cb('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x57cb('0x8'));var _=require(_0x57cb('0x9'));var squel=require(_0x57cb('0xa'));var crypto=require('crypto');var jsforce=require(_0x57cb('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x57cb('0x7'));var querystring=require(_0x57cb('0xc'));var Papa=require(_0x57cb('0xd'));var Redis=require(_0x57cb('0xe'));var authService=require(_0x57cb('0xf'));var qs=require(_0x57cb('0x10'));var as=require(_0x57cb('0x11'));var hardwareService=require(_0x57cb('0x12'));var logger=require('../../config/logger')(_0x57cb('0x13'));var utils=require(_0x57cb('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x57cb('0x15'));var db=require(_0x57cb('0x16'))['db'];var integrations=require(_0x57cb('0x17'));function respondWithStatusCode(_0x2db155,_0x5c473e){_0x5c473e=_0x5c473e||0xcc;return function(_0x14e858){if(_0x14e858){return _0x2db155[_0x57cb('0x18')](_0x5c473e);}return _0x2db155[_0x57cb('0x19')](_0x5c473e)[_0x57cb('0x1a')]();};}function respondWithResult(_0x16c146,_0x406d0c){_0x406d0c=_0x406d0c||0xc8;return function(_0x146a10){if(_0x146a10){return _0x16c146['status'](_0x406d0c)[_0x57cb('0x1b')](_0x146a10);}};}function respondWithFilteredResult(_0x59d3f1,_0x5d2eb4){return function(_0x4ba80){if(_0x4ba80){var _0x3fbd63=typeof _0x5d2eb4[_0x57cb('0x1c')]===_0x57cb('0x1d')&&typeof _0x5d2eb4[_0x57cb('0x1e')]==='undefined';var _0x193f5e=_0x4ba80['count'];var _0x2450e2=_0x3fbd63?0x0:_0x5d2eb4['offset'];var _0x918a3a=_0x3fbd63?_0x4ba80[_0x57cb('0x1f')]:_0x5d2eb4[_0x57cb('0x1c')]+_0x5d2eb4[_0x57cb('0x1e')];var _0xc416a9;if(_0x918a3a>=_0x193f5e){_0x918a3a=_0x193f5e;_0xc416a9=0xc8;}else{_0xc416a9=0xce;}_0x59d3f1[_0x57cb('0x19')](_0xc416a9);return _0x59d3f1[_0x57cb('0x20')](_0x57cb('0x21'),_0x2450e2+'-'+_0x918a3a+'/'+_0x193f5e)[_0x57cb('0x1b')](_0x4ba80);}return null;};}function patchUpdates(_0x483042){return function(_0x5d0c2a){try{jsonpatch[_0x57cb('0x22')](_0x5d0c2a,_0x483042,!![]);}catch(_0x2bf349){return BPromise[_0x57cb('0x23')](_0x2bf349);}return _0x5d0c2a[_0x57cb('0x24')]();};}function saveUpdates(_0x52ac14,_0xcb0848){return function(_0x132cc2){if(_0x132cc2){return _0x132cc2[_0x57cb('0x25')](_0x52ac14)[_0x57cb('0x26')](function(_0x29d5da){return _0x29d5da;});}return null;};}function removeEntity(_0x2457fc,_0x718e43){return function(_0xa4bd63){if(_0xa4bd63){return _0xa4bd63[_0x57cb('0x27')]()['then'](function(){_0x2457fc[_0x57cb('0x19')](0xcc)[_0x57cb('0x1a')]();});}};}function handleEntityNotFound(_0x540e8c,_0x4f406c){return function(_0x4f9172){if(!_0x4f9172){_0x540e8c['sendStatus'](0x194);}return _0x4f9172;};}function handleError(_0x2fddee,_0x5de497){_0x5de497=_0x5de497||0x1f4;return function(_0x30d263){logger['error'](_0x30d263[_0x57cb('0x28')]);if(_0x30d263[_0x57cb('0x29')]){delete _0x30d263[_0x57cb('0x29')];}_0x2fddee[_0x57cb('0x19')](_0x5de497)[_0x57cb('0x2a')](_0x30d263);};}exports['index']=function(_0x13dbd0,_0x281f18){var _0x33d760={},_0x4a1a36={},_0x40817e={'count':0x0,'rows':[]};var _0x322642=_[_0x57cb('0x2b')](db['SalesforceAccount'][_0x57cb('0x2c')],function(_0x8f830b){return{'name':_0x8f830b['fieldName'],'type':_0x8f830b['type'][_0x57cb('0x2d')]};});_0x4a1a36[_0x57cb('0x2e')]=_[_0x57cb('0x2b')](_0x322642,_0x57cb('0x29'));_0x4a1a36['query']=_[_0x57cb('0x2f')](_0x13dbd0[_0x57cb('0x30')]);_0x4a1a36[_0x57cb('0x31')]=_[_0x57cb('0x32')](_0x4a1a36[_0x57cb('0x2e')],_0x4a1a36[_0x57cb('0x30')]);_0x33d760['attributes']=_[_0x57cb('0x32')](_0x4a1a36[_0x57cb('0x2e')],qs[_0x57cb('0x33')](_0x13dbd0[_0x57cb('0x30')][_0x57cb('0x33')]));_0x33d760[_0x57cb('0x34')]=_0x33d760[_0x57cb('0x34')][_0x57cb('0x35')]?_0x33d760[_0x57cb('0x34')]:_0x4a1a36['model'];if(!_0x13dbd0['query']['hasOwnProperty'](_0x57cb('0x36'))){_0x33d760[_0x57cb('0x1e')]=qs[_0x57cb('0x1e')](_0x13dbd0[_0x57cb('0x30')]['limit']);_0x33d760['offset']=qs['offset'](_0x13dbd0[_0x57cb('0x30')][_0x57cb('0x1c')]);}_0x33d760[_0x57cb('0x37')]=qs[_0x57cb('0x38')](_0x13dbd0[_0x57cb('0x30')][_0x57cb('0x38')]);_0x33d760[_0x57cb('0x39')]=qs[_0x57cb('0x31')](_['pick'](_0x13dbd0[_0x57cb('0x30')],_0x4a1a36[_0x57cb('0x31')]),_0x322642);if(_0x13dbd0[_0x57cb('0x30')][_0x57cb('0x3a')]){_0x33d760[_0x57cb('0x39')]=_['merge'](_0x33d760[_0x57cb('0x39')],{'$or':_[_0x57cb('0x2b')](_0x322642,function(_0x3000b1){if(_0x3000b1[_0x57cb('0x3b')]!==_0x57cb('0x3c')){var _0x2de70f={};_0x2de70f[_0x3000b1[_0x57cb('0x29')]]={'$like':'%'+_0x13dbd0['query']['filter']+'%'};return _0x2de70f;}})});}_0x33d760=_[_0x57cb('0x3d')]({},_0x33d760,_0x13dbd0[_0x57cb('0x3e')]);var _0x65d5d0={'where':_0x33d760[_0x57cb('0x39')]};return db['SalesforceAccount']['count'](_0x65d5d0)['then'](function(_0x67fb5f){_0x40817e[_0x57cb('0x1f')]=_0x67fb5f;if(_0x13dbd0[_0x57cb('0x30')]['includeAll']){_0x33d760[_0x57cb('0x3f')]=[{'all':!![]}];}return db[_0x57cb('0x40')]['findAll'](_0x33d760);})['then'](function(_0xaf5127){_0x40817e[_0x57cb('0x41')]=_0xaf5127;return _0x40817e;})[_0x57cb('0x26')](respondWithFilteredResult(_0x281f18,_0x33d760))[_0x57cb('0x42')](handleError(_0x281f18,null));};exports[_0x57cb('0x43')]=function(_0x3ff6a3,_0x5f004e){var _0x4bec79={'raw':![],'where':{'id':_0x3ff6a3[_0x57cb('0x44')]['id']}},_0x5de6ce={};_0x5de6ce[_0x57cb('0x2e')]=_[_0x57cb('0x2f')](db['SalesforceAccount']['rawAttributes']);_0x5de6ce[_0x57cb('0x30')]=_[_0x57cb('0x2f')](_0x3ff6a3[_0x57cb('0x30')]);_0x5de6ce[_0x57cb('0x31')]=_[_0x57cb('0x32')](_0x5de6ce[_0x57cb('0x2e')],_0x5de6ce[_0x57cb('0x30')]);_0x4bec79[_0x57cb('0x34')]=_['intersection'](_0x5de6ce[_0x57cb('0x2e')],qs['fields'](_0x3ff6a3['query']['fields']));_0x4bec79['attributes']=_0x4bec79['attributes']['length']?_0x4bec79[_0x57cb('0x34')]:_0x5de6ce[_0x57cb('0x2e')];if(_0x3ff6a3[_0x57cb('0x30')][_0x57cb('0x45')]){_0x4bec79['include']=[{'all':!![]}];}_0x4bec79=_[_0x57cb('0x3d')]({},_0x4bec79,_0x3ff6a3['options']);return db[_0x57cb('0x40')]['find'](_0x4bec79)[_0x57cb('0x26')](handleEntityNotFound(_0x5f004e,null))[_0x57cb('0x26')](respondWithResult(_0x5f004e,null))[_0x57cb('0x42')](handleError(_0x5f004e,null));};exports[_0x57cb('0x46')]=function(_0x1a5e77,_0x32c1b5){return db['SalesforceAccount'][_0x57cb('0x46')](_0x1a5e77[_0x57cb('0x47')],{})[_0x57cb('0x26')](respondWithResult(_0x32c1b5,0xc9))[_0x57cb('0x42')](handleError(_0x32c1b5,null));};exports['update']=function(_0x40a54a,_0x58cd6b){if(_0x40a54a[_0x57cb('0x47')]['id']){delete _0x40a54a[_0x57cb('0x47')]['id'];}return db[_0x57cb('0x40')][_0x57cb('0x48')]({'where':{'id':_0x40a54a[_0x57cb('0x44')]['id']}})['then'](handleEntityNotFound(_0x58cd6b,null))[_0x57cb('0x26')](saveUpdates(_0x40a54a[_0x57cb('0x47')],null))[_0x57cb('0x26')](respondWithResult(_0x58cd6b,null))['catch'](handleError(_0x58cd6b,null));};exports[_0x57cb('0x27')]=function(_0x854b97,_0x19f863){return db['SalesforceAccount'][_0x57cb('0x48')]({'where':{'id':_0x854b97[_0x57cb('0x44')]['id']}})[_0x57cb('0x26')](handleEntityNotFound(_0x19f863,null))[_0x57cb('0x26')](removeEntity(_0x19f863,null))[_0x57cb('0x42')](handleError(_0x19f863,null));};exports[_0x57cb('0x49')]=function(_0x1d3d60,_0x37f972,_0x41e59e){var _0x49db1e={};var _0x3a6f44={};var _0x1e979a;var _0x4276bc;return db[_0x57cb('0x40')][_0x57cb('0x4a')]({'where':{'id':_0x1d3d60[_0x57cb('0x44')]['id']}})[_0x57cb('0x26')](handleEntityNotFound(_0x37f972,null))[_0x57cb('0x26')](function(_0x2263fa){if(_0x2263fa){_0x1e979a=_0x2263fa;_0x3a6f44[_0x57cb('0x2e')]=_[_0x57cb('0x2f')](db['SalesforceConfiguration'][_0x57cb('0x2c')]);_0x3a6f44[_0x57cb('0x30')]=_[_0x57cb('0x2f')](_0x1d3d60[_0x57cb('0x30')]);_0x3a6f44[_0x57cb('0x31')]=_[_0x57cb('0x32')](_0x3a6f44[_0x57cb('0x2e')],_0x3a6f44['query']);_0x49db1e[_0x57cb('0x34')]=_['intersection'](_0x3a6f44[_0x57cb('0x2e')],qs[_0x57cb('0x33')](_0x1d3d60['query']['fields']));_0x49db1e['attributes']=_0x49db1e[_0x57cb('0x34')]['length']?_0x49db1e[_0x57cb('0x34')]:_0x3a6f44[_0x57cb('0x2e')];_0x49db1e[_0x57cb('0x37')]=qs[_0x57cb('0x38')](_0x1d3d60[_0x57cb('0x30')][_0x57cb('0x38')]);_0x49db1e[_0x57cb('0x39')]=qs[_0x57cb('0x31')](_[_0x57cb('0x4b')](_0x1d3d60[_0x57cb('0x30')],_0x3a6f44[_0x57cb('0x31')]));if(_0x1d3d60[_0x57cb('0x30')]['filter']){_0x49db1e[_0x57cb('0x39')]=_[_0x57cb('0x3d')](_0x49db1e['where'],{'$or':_[_0x57cb('0x2b')](_0x49db1e['attributes'],function(_0x6fc6b1){var _0x2e76f4={};_0x2e76f4[_0x6fc6b1]={'$like':'%'+_0x1d3d60['query'][_0x57cb('0x3a')]+'%'};return _0x2e76f4;})});}_0x49db1e=_[_0x57cb('0x3d')]({},_0x49db1e,_0x1d3d60['options']);return _0x1e979a[_0x57cb('0x49')](_0x49db1e);}})['then'](function(_0x484c6a){if(_0x484c6a){_0x4276bc=_0x484c6a[_0x57cb('0x35')];if(!_0x1d3d60[_0x57cb('0x30')][_0x57cb('0x4c')](_0x57cb('0x36'))){_0x49db1e[_0x57cb('0x1e')]=qs[_0x57cb('0x1e')](_0x1d3d60['query'][_0x57cb('0x1e')]);_0x49db1e[_0x57cb('0x1c')]=qs['offset'](_0x1d3d60[_0x57cb('0x30')]['offset']);}return _0x1e979a[_0x57cb('0x49')](_0x49db1e);}})[_0x57cb('0x26')](function(_0x52d834){if(_0x52d834){return _0x52d834?{'count':_0x4276bc,'rows':_0x52d834}:null;}})['then'](respondWithResult(_0x37f972,null))['catch'](handleError(_0x37f972,null));};exports[_0x57cb('0x4d')]=function(_0x59f23e,_0x1ea126,_0x27536c){if(_0x59f23e[_0x57cb('0x47')]['id']){delete _0x59f23e[_0x57cb('0x47')]['id'];}return db[_0x57cb('0x40')][_0x57cb('0x4a')]({'where':{'id':_0x59f23e[_0x57cb('0x44')]['id']}})[_0x57cb('0x26')](handleEntityNotFound(_0x1ea126,null))[_0x57cb('0x26')](function(_0x3d8e5c){if(_0x3d8e5c){_0x59f23e[_0x57cb('0x47')][_0x57cb('0x4e')]=_0x3d8e5c['id'];_0x59f23e[_0x57cb('0x47')][_0x57cb('0x4f')]=integrations[_0x57cb('0x50')](_0x59f23e[_0x57cb('0x47')][_0x57cb('0x51')],_0x59f23e[_0x57cb('0x47')][_0x57cb('0x3b')]);_0x59f23e[_0x57cb('0x47')]['Descriptions']=integrations[_0x57cb('0x52')](_0x59f23e[_0x57cb('0x47')][_0x57cb('0x51')],_0x59f23e[_0x57cb('0x47')][_0x57cb('0x3b')]);return db[_0x57cb('0x53')][_0x57cb('0x46')](_0x59f23e[_0x57cb('0x47')],{'include':[{'model':db['SalesforceField'],'as':_0x57cb('0x4f')},{'model':db[_0x57cb('0x54')],'as':_0x57cb('0x55')}]});}return null;})[_0x57cb('0x26')](respondWithResult(_0x1ea126,null))[_0x57cb('0x42')](handleError(_0x1ea126,null));};exports['getFields']=function(_0x3b304a,_0x432c46,_0x2ba09d){var _0x516cc4;var _0xc59160='';var _0x1823d7=_0x57cb('0x56');return db[_0x57cb('0x40')][_0x57cb('0x4a')]({'where':{'id':_0x3b304a[_0x57cb('0x44')]['id']},'attributes':['id',_0x57cb('0x57'),_0x57cb('0x58'),_0x57cb('0x59'),_0x57cb('0x5a'),_0x57cb('0x5b'),_0x57cb('0x5c')]})['then'](handleEntityNotFound(_0x432c46,null))[_0x57cb('0x26')](function(_0x46cf9e){if(_0x46cf9e){_0xc59160=_0x46cf9e['remoteUri'];var _0xc16210=_0xc59160[_0x57cb('0x5d')](-0x1);if(_0xc16210==='/'){_0xc59160=_0xc59160['substring'](0x0,_0xc59160[_0x57cb('0x5e')](_0xc16210));}_0x516cc4=new jsforce['Connection']({'oauth2':{'loginUrl':_0xc59160,'clientId':_0x46cf9e[_0x57cb('0x58')],'clientSecret':_0x46cf9e[_0x57cb('0x59')]}});return _0x516cc4['login'](_0x46cf9e[_0x57cb('0x5a')],_0x46cf9e[_0x57cb('0x5b')][_0x57cb('0x5f')](_0x46cf9e[_0x57cb('0x5c')]));}})['then'](function(_0xbb9bc){if(_0xbb9bc){if(!_[_0x57cb('0x60')](_0x3b304a[_0x57cb('0x30')]['ticketType'])){_0x1823d7=_0x3b304a['query'][_0x57cb('0x61')];}return _0x516cc4[_0x57cb('0x62')](_0x1823d7)[_0x57cb('0x63')]();}})[_0x57cb('0x26')](function(_0x2e1142){var _0x831761=['OwnerId',_0x57cb('0x64'),_0x57cb('0x65'),_0x57cb('0x66'),_0x57cb('0x67'),_0x57cb('0x68')];var _0x7ea325=[_0x57cb('0x69'),'int',_0x57cb('0x6a'),_0x57cb('0x6b'),_0x57cb('0x6c'),_0x57cb('0x6d'),_0x57cb('0x6e')];if(_0x2e1142){_[_0x57cb('0x6f')](_0x2e1142[_0x57cb('0x33')],function(_0x1a4d1e){return _0x831761['includes'](_0x1a4d1e['name'])||!_0x7ea325[_0x57cb('0x70')](_0x1a4d1e[_0x57cb('0x3b')]);});return{'count':_0x2e1142[_0x57cb('0x33')][_0x57cb('0x35')],'rows':_[_0x57cb('0x2b')](_0x2e1142[_0x57cb('0x33')],function(_0x40acf7){return{'id':_0x40acf7[_0x57cb('0x29')],'name':_0x40acf7['label'],'custom':_0x40acf7[_0x57cb('0x71')],'options':_0x40acf7[_0x57cb('0x72')][_0x57cb('0x35')]>0x0?_[_0x57cb('0x2b')](_0x40acf7[_0x57cb('0x72')],function(_0x5e3f8a){return{'name':_0x5e3f8a[_0x57cb('0x73')],'value':_0x5e3f8a[_0x57cb('0x74')]};}):_0x40acf7[_0x57cb('0x3b')]=='boolean'?[{'name':_0x57cb('0x75'),'value':_0x57cb('0x76')},{'name':'False','value':_0x57cb('0x77')}]:[]};})};}})[_0x57cb('0x26')](respondWithResult(_0x432c46,null))[_0x57cb('0x42')](function(_0x3c2c00){var _0x12dfcb=_0x3b304a['query'][_0x57cb('0x78')]?0x1f4:_0x3c2c00[_0x57cb('0x79')]||0x1f4;logger[_0x57cb('0x7a')](_0x57cb('0x7b'),'getFields',_0x12dfcb,JSON[_0x57cb('0x7c')](_0x3c2c00));delete _0x3c2c00[_0x57cb('0x29')];if(_0x12dfcb===0x191){_0x12dfcb=0x190;}_0x432c46['status'](_0x12dfcb)['send'](_0x3b304a[_0x57cb('0x30')][_0x57cb('0x78')]?{'message':_0x57cb('0x7d'),'statusCode':_0x3c2c00[_0x57cb('0x79')]}:_0x3c2c00);});}; \ No newline at end of file +var _0x170a=['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/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','pick','merge','where','VIRTUAL','filter','includeAll','include','SalesforceAccount','findAll','rows','catch','params','find','create','body','getConfigurations','findOne','SalesforceConfiguration','sort','options','nolimit','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','SalesforceField','Subjects','getFields','Task','remoteUri','clientSecret','securityToken','substring','clientId','login','password','concat','isNil','ticketType','describe','OwnerId','ActivityDate','IsReminderSet','IsRecurrence','string','int','picklist','email','textarea','includes','label','custom','picklistValues','value','boolean','true','False','false','test','stringify','statusCode','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','sox','to-csv'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x170a,0xed));var _0xa170=function(_0x207aaa,_0x182043){_0x207aaa=_0x207aaa-0x0;var _0x35f7dc=_0x170a[_0x207aaa];return _0x35f7dc;};'use strict';var emlformat=require(_0xa170('0x0'));var rimraf=require(_0xa170('0x1'));var zipdir=require(_0xa170('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa170('0x3'));var moment=require('moment');var BPromise=require(_0xa170('0x4'));var Mustache=require('mustache');var util=require(_0xa170('0x5'));var path=require(_0xa170('0x6'));var sox=require(_0xa170('0x7'));var csv=require(_0xa170('0x8'));var ejs=require(_0xa170('0x9'));var fs=require('fs');var fs_extra=require(_0xa170('0xa'));var _=require(_0xa170('0xb'));var squel=require(_0xa170('0xc'));var crypto=require('crypto');var jsforce=require(_0xa170('0xd'));var deskjs=require(_0xa170('0xe'));var toCsv=require(_0xa170('0x8'));var querystring=require(_0xa170('0xf'));var Papa=require(_0xa170('0x10'));var Redis=require(_0xa170('0x11'));var authService=require(_0xa170('0x12'));var qs=require(_0xa170('0x13'));var as=require(_0xa170('0x14'));var hardwareService=require(_0xa170('0x15'));var logger=require('../../config/logger')(_0xa170('0x16'));var utils=require('../../config/utils');var config=require(_0xa170('0x17'));var licenseUtil=require(_0xa170('0x18'));var db=require(_0xa170('0x19'))['db'];var integrations=require(_0xa170('0x1a'));function respondWithStatusCode(_0xf3990,_0x3d3ecc){_0x3d3ecc=_0x3d3ecc||0xcc;return function(_0xb8d3fb){if(_0xb8d3fb){return _0xf3990[_0xa170('0x1b')](_0x3d3ecc);}return _0xf3990[_0xa170('0x1c')](_0x3d3ecc)[_0xa170('0x1d')]();};}function respondWithResult(_0x125516,_0xf7e664){_0xf7e664=_0xf7e664||0xc8;return function(_0x2937d2){if(_0x2937d2){return _0x125516['status'](_0xf7e664)['json'](_0x2937d2);}};}function respondWithFilteredResult(_0x4b1424,_0x330be3){return function(_0x563b3e){if(_0x563b3e){var _0xbd6325=typeof _0x330be3[_0xa170('0x1e')]===_0xa170('0x1f')&&typeof _0x330be3[_0xa170('0x20')]==='undefined';var _0x556c08=_0x563b3e[_0xa170('0x21')];var _0x30edbb=_0xbd6325?0x0:_0x330be3[_0xa170('0x1e')];var _0x34ade8=_0xbd6325?_0x563b3e['count']:_0x330be3['offset']+_0x330be3[_0xa170('0x20')];var _0x3f9fd2;if(_0x34ade8>=_0x556c08){_0x34ade8=_0x556c08;_0x3f9fd2=0xc8;}else{_0x3f9fd2=0xce;}_0x4b1424['status'](_0x3f9fd2);return _0x4b1424['set'](_0xa170('0x22'),_0x30edbb+'-'+_0x34ade8+'/'+_0x556c08)[_0xa170('0x23')](_0x563b3e);}return null;};}function patchUpdates(_0x38f10a){return function(_0x1c5baa){try{jsonpatch[_0xa170('0x24')](_0x1c5baa,_0x38f10a,!![]);}catch(_0x241284){return BPromise[_0xa170('0x25')](_0x241284);}return _0x1c5baa[_0xa170('0x26')]();};}function saveUpdates(_0x1324c2,_0x4bb40b){return function(_0x44df31){if(_0x44df31){return _0x44df31[_0xa170('0x27')](_0x1324c2)['then'](function(_0x18c44f){return _0x18c44f;});}return null;};}function removeEntity(_0x333bb0,_0x279430){return function(_0x27aa32){if(_0x27aa32){return _0x27aa32[_0xa170('0x28')]()[_0xa170('0x29')](function(){_0x333bb0[_0xa170('0x1c')](0xcc)[_0xa170('0x1d')]();});}};}function handleEntityNotFound(_0xb61e8f,_0x321eea){return function(_0x5834b0){if(!_0x5834b0){_0xb61e8f[_0xa170('0x1b')](0x194);}return _0x5834b0;};}function handleError(_0x41e4aa,_0x2884f9){_0x2884f9=_0x2884f9||0x1f4;return function(_0x2e8336){logger[_0xa170('0x2a')](_0x2e8336[_0xa170('0x2b')]);if(_0x2e8336[_0xa170('0x2c')]){delete _0x2e8336[_0xa170('0x2c')];}_0x41e4aa['status'](_0x2884f9)[_0xa170('0x2d')](_0x2e8336);};}exports[_0xa170('0x2e')]=function(_0x44df9c,_0x38b79e){var _0x2f10f3={},_0xab05a9={},_0x70149d={'count':0x0,'rows':[]};var _0x5bdf1d=_['map'](db['SalesforceAccount'][_0xa170('0x2f')],function(_0x7a9549){return{'name':_0x7a9549['fieldName'],'type':_0x7a9549[_0xa170('0x30')][_0xa170('0x31')]};});_0xab05a9[_0xa170('0x32')]=_[_0xa170('0x33')](_0x5bdf1d,'name');_0xab05a9[_0xa170('0x34')]=_[_0xa170('0x35')](_0x44df9c[_0xa170('0x34')]);_0xab05a9[_0xa170('0x36')]=_[_0xa170('0x37')](_0xab05a9[_0xa170('0x32')],_0xab05a9[_0xa170('0x34')]);_0x2f10f3['attributes']=_[_0xa170('0x37')](_0xab05a9[_0xa170('0x32')],qs['fields'](_0x44df9c[_0xa170('0x34')][_0xa170('0x38')]));_0x2f10f3[_0xa170('0x39')]=_0x2f10f3['attributes'][_0xa170('0x3a')]?_0x2f10f3['attributes']:_0xab05a9['model'];if(!_0x44df9c[_0xa170('0x34')][_0xa170('0x3b')]('nolimit')){_0x2f10f3[_0xa170('0x20')]=qs[_0xa170('0x20')](_0x44df9c[_0xa170('0x34')][_0xa170('0x20')]);_0x2f10f3[_0xa170('0x1e')]=qs['offset'](_0x44df9c['query'][_0xa170('0x1e')]);}_0x2f10f3[_0xa170('0x3c')]=qs['sort'](_0x44df9c[_0xa170('0x34')]['sort']);_0x2f10f3['where']=qs[_0xa170('0x36')](_[_0xa170('0x3d')](_0x44df9c['query'],_0xab05a9[_0xa170('0x36')]),_0x5bdf1d);if(_0x44df9c[_0xa170('0x34')]['filter']){_0x2f10f3['where']=_[_0xa170('0x3e')](_0x2f10f3[_0xa170('0x3f')],{'$or':_[_0xa170('0x33')](_0x5bdf1d,function(_0x2eaad6){if(_0x2eaad6[_0xa170('0x30')]!==_0xa170('0x40')){var _0x34b798={};_0x34b798[_0x2eaad6['name']]={'$like':'%'+_0x44df9c[_0xa170('0x34')][_0xa170('0x41')]+'%'};return _0x34b798;}})});}_0x2f10f3=_[_0xa170('0x3e')]({},_0x2f10f3,_0x44df9c['options']);var _0x5981a6={'where':_0x2f10f3[_0xa170('0x3f')]};return db['SalesforceAccount']['count'](_0x5981a6)[_0xa170('0x29')](function(_0x25dfe0){_0x70149d['count']=_0x25dfe0;if(_0x44df9c['query'][_0xa170('0x42')]){_0x2f10f3[_0xa170('0x43')]=[{'all':!![]}];}return db[_0xa170('0x44')][_0xa170('0x45')](_0x2f10f3);})[_0xa170('0x29')](function(_0x5708f3){_0x70149d[_0xa170('0x46')]=_0x5708f3;return _0x70149d;})[_0xa170('0x29')](respondWithFilteredResult(_0x38b79e,_0x2f10f3))[_0xa170('0x47')](handleError(_0x38b79e,null));};exports['show']=function(_0x20a438,_0x48c0c2){var _0x8bba79={'raw':![],'where':{'id':_0x20a438[_0xa170('0x48')]['id']}},_0x410464={};_0x410464[_0xa170('0x32')]=_['keys'](db['SalesforceAccount'][_0xa170('0x2f')]);_0x410464[_0xa170('0x34')]=_[_0xa170('0x35')](_0x20a438[_0xa170('0x34')]);_0x410464[_0xa170('0x36')]=_[_0xa170('0x37')](_0x410464[_0xa170('0x32')],_0x410464['query']);_0x8bba79[_0xa170('0x39')]=_[_0xa170('0x37')](_0x410464[_0xa170('0x32')],qs[_0xa170('0x38')](_0x20a438[_0xa170('0x34')][_0xa170('0x38')]));_0x8bba79[_0xa170('0x39')]=_0x8bba79[_0xa170('0x39')]['length']?_0x8bba79[_0xa170('0x39')]:_0x410464[_0xa170('0x32')];if(_0x20a438[_0xa170('0x34')]['includeAll']){_0x8bba79[_0xa170('0x43')]=[{'all':!![]}];}_0x8bba79=_[_0xa170('0x3e')]({},_0x8bba79,_0x20a438['options']);return db[_0xa170('0x44')][_0xa170('0x49')](_0x8bba79)[_0xa170('0x29')](handleEntityNotFound(_0x48c0c2,null))['then'](respondWithResult(_0x48c0c2,null))[_0xa170('0x47')](handleError(_0x48c0c2,null));};exports[_0xa170('0x4a')]=function(_0x59042b,_0x1e2843){return db['SalesforceAccount'][_0xa170('0x4a')](_0x59042b[_0xa170('0x4b')],{})['then'](respondWithResult(_0x1e2843,0xc9))['catch'](handleError(_0x1e2843,null));};exports[_0xa170('0x27')]=function(_0x735a34,_0x65b335){if(_0x735a34[_0xa170('0x4b')]['id']){delete _0x735a34[_0xa170('0x4b')]['id'];}return db[_0xa170('0x44')][_0xa170('0x49')]({'where':{'id':_0x735a34[_0xa170('0x48')]['id']}})[_0xa170('0x29')](handleEntityNotFound(_0x65b335,null))[_0xa170('0x29')](saveUpdates(_0x735a34[_0xa170('0x4b')],null))[_0xa170('0x29')](respondWithResult(_0x65b335,null))[_0xa170('0x47')](handleError(_0x65b335,null));};exports[_0xa170('0x28')]=function(_0x5cd5f7,_0xcbe0b5){return db[_0xa170('0x44')]['find']({'where':{'id':_0x5cd5f7[_0xa170('0x48')]['id']}})['then'](handleEntityNotFound(_0xcbe0b5,null))[_0xa170('0x29')](removeEntity(_0xcbe0b5,null))['catch'](handleError(_0xcbe0b5,null));};exports[_0xa170('0x4c')]=function(_0x1b2158,_0x420aa0,_0x5c3563){var _0x5bfcfa={};var _0x4801e1={};var _0x3c89fb;var _0x3bb144;return db['SalesforceAccount'][_0xa170('0x4d')]({'where':{'id':_0x1b2158[_0xa170('0x48')]['id']}})[_0xa170('0x29')](handleEntityNotFound(_0x420aa0,null))[_0xa170('0x29')](function(_0x24448f){if(_0x24448f){_0x3c89fb=_0x24448f;_0x4801e1[_0xa170('0x32')]=_['keys'](db[_0xa170('0x4e')][_0xa170('0x2f')]);_0x4801e1[_0xa170('0x34')]=_[_0xa170('0x35')](_0x1b2158[_0xa170('0x34')]);_0x4801e1[_0xa170('0x36')]=_[_0xa170('0x37')](_0x4801e1[_0xa170('0x32')],_0x4801e1[_0xa170('0x34')]);_0x5bfcfa[_0xa170('0x39')]=_[_0xa170('0x37')](_0x4801e1[_0xa170('0x32')],qs[_0xa170('0x38')](_0x1b2158[_0xa170('0x34')][_0xa170('0x38')]));_0x5bfcfa[_0xa170('0x39')]=_0x5bfcfa['attributes']['length']?_0x5bfcfa[_0xa170('0x39')]:_0x4801e1[_0xa170('0x32')];_0x5bfcfa['order']=qs[_0xa170('0x4f')](_0x1b2158[_0xa170('0x34')][_0xa170('0x4f')]);_0x5bfcfa[_0xa170('0x3f')]=qs[_0xa170('0x36')](_[_0xa170('0x3d')](_0x1b2158[_0xa170('0x34')],_0x4801e1['filters']));if(_0x1b2158[_0xa170('0x34')][_0xa170('0x41')]){_0x5bfcfa[_0xa170('0x3f')]=_['merge'](_0x5bfcfa['where'],{'$or':_['map'](_0x5bfcfa[_0xa170('0x39')],function(_0x30b8b5){var _0xd24e42={};_0xd24e42[_0x30b8b5]={'$like':'%'+_0x1b2158[_0xa170('0x34')][_0xa170('0x41')]+'%'};return _0xd24e42;})});}_0x5bfcfa=_[_0xa170('0x3e')]({},_0x5bfcfa,_0x1b2158[_0xa170('0x50')]);return _0x3c89fb[_0xa170('0x4c')](_0x5bfcfa);}})[_0xa170('0x29')](function(_0x5cebf1){if(_0x5cebf1){_0x3bb144=_0x5cebf1[_0xa170('0x3a')];if(!_0x1b2158[_0xa170('0x34')][_0xa170('0x3b')](_0xa170('0x51'))){_0x5bfcfa[_0xa170('0x20')]=qs[_0xa170('0x20')](_0x1b2158[_0xa170('0x34')]['limit']);_0x5bfcfa[_0xa170('0x1e')]=qs[_0xa170('0x1e')](_0x1b2158[_0xa170('0x34')][_0xa170('0x1e')]);}return _0x3c89fb[_0xa170('0x4c')](_0x5bfcfa);}})[_0xa170('0x29')](function(_0x3f6637){if(_0x3f6637){return _0x3f6637?{'count':_0x3bb144,'rows':_0x3f6637}:null;}})['then'](respondWithResult(_0x420aa0,null))['catch'](handleError(_0x420aa0,null));};exports[_0xa170('0x52')]=function(_0xe8bac5,_0x58797f,_0x50a87e){if(_0xe8bac5[_0xa170('0x4b')]['id']){delete _0xe8bac5[_0xa170('0x4b')]['id'];}return db[_0xa170('0x44')][_0xa170('0x4d')]({'where':{'id':_0xe8bac5[_0xa170('0x48')]['id']}})[_0xa170('0x29')](handleEntityNotFound(_0x58797f,null))[_0xa170('0x29')](function(_0x3a8bd5){if(_0x3a8bd5){_0xe8bac5[_0xa170('0x4b')]['AccountId']=_0x3a8bd5['id'];_0xe8bac5['body']['Subjects']=integrations[_0xa170('0x53')](_0xe8bac5['body'][_0xa170('0x54')],_0xe8bac5[_0xa170('0x4b')][_0xa170('0x30')]);_0xe8bac5['body'][_0xa170('0x55')]=integrations[_0xa170('0x56')](_0xe8bac5['body'][_0xa170('0x54')],_0xe8bac5[_0xa170('0x4b')][_0xa170('0x30')]);return db[_0xa170('0x4e')][_0xa170('0x4a')](_0xe8bac5[_0xa170('0x4b')],{'include':[{'model':db[_0xa170('0x57')],'as':_0xa170('0x58')},{'model':db['SalesforceField'],'as':'Descriptions'}]});}return null;})[_0xa170('0x29')](respondWithResult(_0x58797f,null))['catch'](handleError(_0x58797f,null));};exports[_0xa170('0x59')]=function(_0x3df7e8,_0x3c88fa,_0x3c3283){var _0x28fe7a;var _0x21844b='';var _0x5b5165=_0xa170('0x5a');return db['SalesforceAccount'][_0xa170('0x4d')]({'where':{'id':_0x3df7e8[_0xa170('0x48')]['id']},'attributes':['id',_0xa170('0x5b'),'clientId',_0xa170('0x5c'),'username','password',_0xa170('0x5d')]})[_0xa170('0x29')](handleEntityNotFound(_0x3c88fa,null))['then'](function(_0x4bb9da){if(_0x4bb9da){_0x21844b=_0x4bb9da[_0xa170('0x5b')];var _0x49b192=_0x21844b['slice'](-0x1);if(_0x49b192==='/'){_0x21844b=_0x21844b[_0xa170('0x5e')](0x0,_0x21844b['lastIndexOf'](_0x49b192));}_0x28fe7a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x21844b,'clientId':_0x4bb9da[_0xa170('0x5f')],'clientSecret':_0x4bb9da[_0xa170('0x5c')]}});return _0x28fe7a[_0xa170('0x60')](_0x4bb9da['username'],_0x4bb9da[_0xa170('0x61')][_0xa170('0x62')](_0x4bb9da['securityToken']));}})[_0xa170('0x29')](function(_0x581cbd){if(_0x581cbd){if(!_[_0xa170('0x63')](_0x3df7e8['query'][_0xa170('0x64')])){_0x5b5165=_0x3df7e8['query']['ticketType'];}return _0x28fe7a['sobject'](_0x5b5165)[_0xa170('0x65')]();}})['then'](function(_0x3344e6){var _0xdd8191=[_0xa170('0x66'),_0xa170('0x67'),_0xa170('0x68'),_0xa170('0x69'),'Subject','Description'];var _0x45baf7=[_0xa170('0x6a'),_0xa170('0x6b'),_0xa170('0x6c'),'boolean',_0xa170('0x6d'),_0xa170('0x6e'),'phone'];if(_0x3344e6){_['remove'](_0x3344e6[_0xa170('0x38')],function(_0x1c6e8b){return _0xdd8191[_0xa170('0x6f')](_0x1c6e8b['name'])||!_0x45baf7[_0xa170('0x6f')](_0x1c6e8b['type']);});return{'count':_0x3344e6['fields'][_0xa170('0x3a')],'rows':_[_0xa170('0x33')](_0x3344e6[_0xa170('0x38')],function(_0x3fdf56){return{'id':_0x3fdf56[_0xa170('0x2c')],'name':_0x3fdf56[_0xa170('0x70')],'custom':_0x3fdf56[_0xa170('0x71')],'options':_0x3fdf56[_0xa170('0x72')]['length']>0x0?_[_0xa170('0x33')](_0x3fdf56['picklistValues'],function(_0x5bb690){return{'name':_0x5bb690['label'],'value':_0x5bb690[_0xa170('0x73')]};}):_0x3fdf56[_0xa170('0x30')]==_0xa170('0x74')?[{'name':'True','value':_0xa170('0x75')},{'name':_0xa170('0x76'),'value':_0xa170('0x77')}]:[]};})};}})[_0xa170('0x29')](respondWithResult(_0x3c88fa,null))[_0xa170('0x47')](function(_0x427864){var _0x19e29e=_0x3df7e8[_0xa170('0x34')][_0xa170('0x78')]?0x1f4:_0x427864['statusCode']||0x1f4;logger[_0xa170('0x2a')]('getFields,\x20%s,\x20%s,\x20%s',_0xa170('0x59'),_0x19e29e,JSON[_0xa170('0x79')](_0x427864));delete _0x427864['name'];if(_0x19e29e===0x191){_0x19e29e=0x190;}_0x3c88fa[_0xa170('0x1c')](_0x19e29e)[_0xa170('0x2d')](_0x3df7e8['query'][_0xa170('0x78')]?{'message':'Wrong\x20credentials','statusCode':_0x427864[_0xa170('0x7a')]}:_0x427864);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 90a0a6a..9405d96 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 _0xf3f8=['rimraf','../../config/environment','exports','define','SalesforceAccount','lodash','util','api','moment','bluebird'];(function(_0x5b2c7e,_0x3d22f0){var _0x5ec399=function(_0x1a87ad){while(--_0x1a87ad){_0x5b2c7e['push'](_0x5b2c7e['shift']());}};_0x5ec399(++_0x3d22f0);}(_0xf3f8,0x109));var _0x8f3f=function(_0x1560fa,_0x1a7154){_0x1560fa=_0x1560fa-0x0;var _0x2f3ca1=_0xf3f8[_0x1560fa];return _0x2f3ca1;};'use strict';var _=require(_0x8f3f('0x0'));var util=require(_0x8f3f('0x1'));var logger=require('../../config/logger')(_0x8f3f('0x2'));var moment=require(_0x8f3f('0x3'));var BPromise=require(_0x8f3f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8f3f('0x5'));var config=require(_0x8f3f('0x6'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x8f3f('0x7')]=function(_0x390ca6,_0x5e1c24){return _0x390ca6[_0x8f3f('0x8')](_0x8f3f('0x9'),attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd89=['int_salesforce_accounts','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xdd89,0xc5));var _0x9dd8=function(_0x4cc492,_0x162c85){_0x4cc492=_0x4cc492-0x0;var _0x1f36b9=_0xdd89[_0x4cc492];return _0x1f36b9;};'use strict';var _=require(_0x9dd8('0x0'));var util=require(_0x9dd8('0x1'));var logger=require(_0x9dd8('0x2'))(_0x9dd8('0x3'));var moment=require(_0x9dd8('0x4'));var BPromise=require(_0x9dd8('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9dd8('0x6'));var config=require(_0x9dd8('0x7'));var attributes=require(_0x9dd8('0x8'));var integrations=require(_0x9dd8('0x9'));module[_0x9dd8('0xa')]=function(_0x2be577,_0x3ebe31){return _0x2be577[_0x9dd8('0xb')](_0x9dd8('0xc'),attributes,{'tableName':_0x9dd8('0xd'),'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 bcabcef..3bc7c70 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 _0xc6a6=['catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','map','include','debug','stringify','ShowSalesforceAccount','model','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x5dbb84,_0x1bbce9){var _0x1d6eae=function(_0xd93967){while(--_0xd93967){_0x5dbb84['push'](_0x5dbb84['shift']());}};_0x1d6eae(++_0x1bbce9);}(_0xc6a6,0x1a6));var _0x6c6a=function(_0x551708,_0x450cd4){_0x551708=_0x551708-0x0;var _0x3dbda2=_0xc6a6[_0x551708];return _0x3dbda2;};'use strict';var _=require('lodash');var util=require(_0x6c6a('0x0'));var moment=require(_0x6c6a('0x1'));var BPromise=require('bluebird');var rs=require(_0x6c6a('0x2'));var fs=require('fs');var Redis=require(_0x6c6a('0x3'));var db=require(_0x6c6a('0x4'))['db'];var utils=require(_0x6c6a('0x5'));var logger=require(_0x6c6a('0x6'))(_0x6c6a('0x7'));var config=require(_0x6c6a('0x8'));var jayson=require(_0x6c6a('0x9'));var client=jayson[_0x6c6a('0xa')][_0x6c6a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x454dc9,_0x387961,_0x35605f){return new BPromise(function(_0x52eb3c,_0x22671e){return client[_0x6c6a('0xc')](_0x454dc9,_0x35605f)[_0x6c6a('0xd')](function(_0x35940a){logger[_0x6c6a('0xe')](_0x6c6a('0xf'),_0x387961,_0x6c6a('0x10'));logger['debug'](_0x6c6a('0x11'),_0x387961,_0x6c6a('0x10'),JSON['stringify'](_0x35940a));if(_0x35940a[_0x6c6a('0x12')]){if(_0x35940a[_0x6c6a('0x12')]['code']===0x1f4){logger[_0x6c6a('0x12')](_0x6c6a('0xf'),_0x387961,_0x35940a[_0x6c6a('0x12')]['message']);return _0x22671e(_0x35940a[_0x6c6a('0x12')][_0x6c6a('0x13')]);}logger['error'](_0x6c6a('0xf'),_0x387961,_0x35940a['error'][_0x6c6a('0x13')]);return _0x52eb3c(_0x35940a[_0x6c6a('0x12')][_0x6c6a('0x13')]);}else{logger['info'](_0x6c6a('0xf'),_0x387961,_0x6c6a('0x10'));_0x52eb3c(_0x35940a['result'][_0x6c6a('0x13')]);}})[_0x6c6a('0x14')](function(_0xdb9b0a){logger[_0x6c6a('0x12')](_0x6c6a('0xf'),_0x387961,_0xdb9b0a);_0x22671e(_0xdb9b0a);});});}exports[_0x6c6a('0x15')]=function(_0x2ee948){var _0x5e4d22=this;return new Promise(function(_0x5083bc,_0x1a3355){return db[_0x6c6a('0x16')][_0x6c6a('0x17')]({'raw':_0x2ee948[_0x6c6a('0x18')]?_0x2ee948[_0x6c6a('0x18')][_0x6c6a('0x19')]===undefined?!![]:![]:!![],'where':_0x2ee948['options']?_0x2ee948[_0x6c6a('0x18')][_0x6c6a('0x1a')]||null:null,'attributes':_0x2ee948[_0x6c6a('0x18')]?_0x2ee948[_0x6c6a('0x18')][_0x6c6a('0x1b')]||null:null,'limit':_0x2ee948['options']?_0x2ee948[_0x6c6a('0x18')]['limit']||null:null,'include':_0x2ee948[_0x6c6a('0x18')]?_0x2ee948[_0x6c6a('0x18')]['include']?_[_0x6c6a('0x1c')](_0x2ee948[_0x6c6a('0x18')][_0x6c6a('0x1d')],function(_0x2a541a){return{'model':db[_0x2a541a['model']],'as':_0x2a541a['as'],'attributes':_0x2a541a[_0x6c6a('0x1b')],'include':_0x2a541a[_0x6c6a('0x1d')]?_[_0x6c6a('0x1c')](_0x2a541a[_0x6c6a('0x1d')],function(_0x4360a4){return{'model':db[_0x4360a4['model']],'as':_0x4360a4['as'],'attributes':_0x4360a4[_0x6c6a('0x1b')],'include':_0x4360a4[_0x6c6a('0x1d')]?_[_0x6c6a('0x1c')](_0x4360a4[_0x6c6a('0x1d')],function(_0xd3802f){return{'model':db[_0xd3802f['model']],'as':_0xd3802f['as'],'attributes':_0xd3802f[_0x6c6a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6c6a('0xd')](function(_0x4a77f7){logger['info'](_0x6c6a('0x15'),_0x2ee948);logger[_0x6c6a('0x1e')](_0x6c6a('0x15'),_0x2ee948,JSON[_0x6c6a('0x1f')](_0x4a77f7));_0x5083bc(_0x4a77f7);})['catch'](function(_0x38db3a){logger[_0x6c6a('0x12')](_0x6c6a('0x15'),_0x38db3a[_0x6c6a('0x13')],_0x2ee948);_0x1a3355(_0x5e4d22[_0x6c6a('0x12')](0x1f4,_0x38db3a[_0x6c6a('0x13')]));});});};exports[_0x6c6a('0x20')]=function(_0x4a2ace){var _0x1c04b5=this;return new Promise(function(_0x24ac52,_0x35ffdc){return db[_0x6c6a('0x16')]['find']({'raw':_0x4a2ace['options']?_0x4a2ace['options'][_0x6c6a('0x19')]===undefined?!![]:![]:!![],'where':_0x4a2ace[_0x6c6a('0x18')]?_0x4a2ace[_0x6c6a('0x18')][_0x6c6a('0x1a')]||null:null,'attributes':_0x4a2ace[_0x6c6a('0x18')]?_0x4a2ace[_0x6c6a('0x18')]['attributes']||null:null,'include':_0x4a2ace[_0x6c6a('0x18')]?_0x4a2ace[_0x6c6a('0x18')]['include']?_['map'](_0x4a2ace[_0x6c6a('0x18')]['include'],function(_0xbe5ded){return{'model':db[_0xbe5ded[_0x6c6a('0x21')]],'as':_0xbe5ded['as'],'attributes':_0xbe5ded[_0x6c6a('0x1b')],'include':_0xbe5ded[_0x6c6a('0x1d')]?_[_0x6c6a('0x1c')](_0xbe5ded['include'],function(_0x4d8cb3){return{'model':db[_0x4d8cb3[_0x6c6a('0x21')]],'as':_0x4d8cb3['as'],'attributes':_0x4d8cb3['attributes'],'include':_0x4d8cb3[_0x6c6a('0x1d')]?_[_0x6c6a('0x1c')](_0x4d8cb3[_0x6c6a('0x1d')],function(_0x504e95){return{'model':db[_0x504e95[_0x6c6a('0x21')]],'as':_0x504e95['as'],'attributes':_0x504e95[_0x6c6a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x6c6a('0xd')](function(_0x73cbdf){logger[_0x6c6a('0xe')](_0x6c6a('0x20'),_0x4a2ace);logger[_0x6c6a('0x1e')]('ShowSalesforceAccount',_0x4a2ace,JSON[_0x6c6a('0x1f')](_0x73cbdf));_0x24ac52(_0x73cbdf);})[_0x6c6a('0x14')](function(_0x43a065){logger[_0x6c6a('0x12')](_0x6c6a('0x20'),_0x43a065['message'],_0x4a2ace);_0x35ffdc(_0x1c04b5[_0x6c6a('0x12')](0x1f4,_0x43a065[_0x6c6a('0x13')]));});});}; \ No newline at end of file +var _0x266d=['where','include','map','model','attributes','ShowSalesforceAccount','SalesforceAccount','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','findAll','raw','options'];(function(_0x9d7ab8,_0x194a34){var _0x26d26e=function(_0x113d88){while(--_0x113d88){_0x9d7ab8['push'](_0x9d7ab8['shift']());}};_0x26d26e(++_0x194a34);}(_0x266d,0xb6));var _0xd266=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x266d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd266('0x0'));var util=require(_0xd266('0x1'));var moment=require(_0xd266('0x2'));var BPromise=require(_0xd266('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd266('0x4'));var db=require(_0xd266('0x5'))['db'];var utils=require(_0xd266('0x6'));var logger=require(_0xd266('0x7'))(_0xd266('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd266('0x9')][_0xd266('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x8d393,_0x43acd2,_0x186012){return new BPromise(function(_0x2f73f4,_0x2a3287){return client[_0xd266('0xb')](_0x8d393,_0x186012)[_0xd266('0xc')](function(_0x441c44){logger[_0xd266('0xd')](_0xd266('0xe'),_0x43acd2,_0xd266('0xf'));logger[_0xd266('0x10')](_0xd266('0x11'),_0x43acd2,_0xd266('0xf'),JSON[_0xd266('0x12')](_0x441c44));if(_0x441c44[_0xd266('0x13')]){if(_0x441c44[_0xd266('0x13')][_0xd266('0x14')]===0x1f4){logger[_0xd266('0x13')]('SalesforceAccount,\x20%s,\x20%s',_0x43acd2,_0x441c44['error']['message']);return _0x2a3287(_0x441c44[_0xd266('0x13')]['message']);}logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x43acd2,_0x441c44['error'][_0xd266('0x15')]);return _0x2f73f4(_0x441c44[_0xd266('0x13')][_0xd266('0x15')]);}else{logger[_0xd266('0xd')]('SalesforceAccount,\x20%s,\x20%s',_0x43acd2,_0xd266('0xf'));_0x2f73f4(_0x441c44[_0xd266('0x16')][_0xd266('0x15')]);}})[_0xd266('0x17')](function(_0x46fc6a){logger[_0xd266('0x13')](_0xd266('0xe'),_0x43acd2,_0x46fc6a);_0x2a3287(_0x46fc6a);});});}exports[_0xd266('0x18')]=function(_0x28c4d7){var _0x426fa1=this;return new Promise(function(_0x690f56,_0x309af6){return db['SalesforceAccount'][_0xd266('0x19')]({'raw':_0x28c4d7['options']?_0x28c4d7['options'][_0xd266('0x1a')]===undefined?!![]:![]:!![],'where':_0x28c4d7[_0xd266('0x1b')]?_0x28c4d7[_0xd266('0x1b')][_0xd266('0x1c')]||null:null,'attributes':_0x28c4d7[_0xd266('0x1b')]?_0x28c4d7[_0xd266('0x1b')]['attributes']||null:null,'limit':_0x28c4d7[_0xd266('0x1b')]?_0x28c4d7[_0xd266('0x1b')]['limit']||null:null,'include':_0x28c4d7[_0xd266('0x1b')]?_0x28c4d7['options'][_0xd266('0x1d')]?_[_0xd266('0x1e')](_0x28c4d7['options'][_0xd266('0x1d')],function(_0x5b9a20){return{'model':db[_0x5b9a20[_0xd266('0x1f')]],'as':_0x5b9a20['as'],'attributes':_0x5b9a20[_0xd266('0x20')],'include':_0x5b9a20[_0xd266('0x1d')]?_['map'](_0x5b9a20[_0xd266('0x1d')],function(_0x4d45c1){return{'model':db[_0x4d45c1['model']],'as':_0x4d45c1['as'],'attributes':_0x4d45c1[_0xd266('0x20')],'include':_0x4d45c1[_0xd266('0x1d')]?_[_0xd266('0x1e')](_0x4d45c1[_0xd266('0x1d')],function(_0x227564){return{'model':db[_0x227564['model']],'as':_0x227564['as'],'attributes':_0x227564[_0xd266('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x26f77a){logger[_0xd266('0xd')](_0xd266('0x18'),_0x28c4d7);logger[_0xd266('0x10')]('GetSalesforceAccount',_0x28c4d7,JSON[_0xd266('0x12')](_0x26f77a));_0x690f56(_0x26f77a);})['catch'](function(_0x28e88c){logger[_0xd266('0x13')]('GetSalesforceAccount',_0x28e88c['message'],_0x28c4d7);_0x309af6(_0x426fa1[_0xd266('0x13')](0x1f4,_0x28e88c[_0xd266('0x15')]));});});};exports[_0xd266('0x21')]=function(_0x3d6bd0){var _0x1443e8=this;return new Promise(function(_0x47cf61,_0xd583f0){return db[_0xd266('0x22')]['find']({'raw':_0x3d6bd0[_0xd266('0x1b')]?_0x3d6bd0['options'][_0xd266('0x1a')]===undefined?!![]:![]:!![],'where':_0x3d6bd0[_0xd266('0x1b')]?_0x3d6bd0[_0xd266('0x1b')][_0xd266('0x1c')]||null:null,'attributes':_0x3d6bd0['options']?_0x3d6bd0['options'][_0xd266('0x20')]||null:null,'include':_0x3d6bd0[_0xd266('0x1b')]?_0x3d6bd0['options'][_0xd266('0x1d')]?_[_0xd266('0x1e')](_0x3d6bd0[_0xd266('0x1b')]['include'],function(_0x1497e8){return{'model':db[_0x1497e8[_0xd266('0x1f')]],'as':_0x1497e8['as'],'attributes':_0x1497e8['attributes'],'include':_0x1497e8[_0xd266('0x1d')]?_[_0xd266('0x1e')](_0x1497e8[_0xd266('0x1d')],function(_0x38f118){return{'model':db[_0x38f118[_0xd266('0x1f')]],'as':_0x38f118['as'],'attributes':_0x38f118[_0xd266('0x20')],'include':_0x38f118[_0xd266('0x1d')]?_[_0xd266('0x1e')](_0x38f118[_0xd266('0x1d')],function(_0x4109ba){return{'model':db[_0x4109ba[_0xd266('0x1f')]],'as':_0x4109ba['as'],'attributes':_0x4109ba[_0xd266('0x20')]};}):[]};}):[]};}):[]:[]})[_0xd266('0xc')](function(_0x5981fd){logger[_0xd266('0xd')](_0xd266('0x21'),_0x3d6bd0);logger['debug']('ShowSalesforceAccount',_0x3d6bd0,JSON[_0xd266('0x12')](_0x5981fd));_0x47cf61(_0x5981fd);})[_0xd266('0x17')](function(_0x13b35d){logger[_0xd266('0x13')](_0xd266('0x21'),_0x13b35d[_0xd266('0x15')],_0x3d6bd0);_0xd583f0(_0x1443e8[_0xd266('0x13')](0x1f4,_0x13b35d[_0xd266('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index 9efb7a6..18c204a 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(_0x4709c0,_0x3396c7){var _0x13348b=function(_0x426235){while(--_0x426235){_0x4709c0['push'](_0x4709c0['shift']());}};_0x13348b(++_0x3396c7);}(_0x0b0e,0x187));var _0xe0b0=function(_0x323c7e,_0x3d16ec){_0x323c7e=_0x323c7e-0x0;var _0x2b0f72=_0x0b0e[_0x323c7e];return _0x2b0f72;};'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 _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(_0x236d24,_0x29e80a){var _0x1574cf=function(_0x5d1dad){while(--_0x5d1dad){_0x236d24['push'](_0x236d24['shift']());}};_0x1574cf(++_0x29e80a);}(_0x0b0e,0x187));var _0xe0b0=function(_0x50b1c5,_0x1cf2a9){_0x50b1c5=_0x50b1c5-0x0;var _0x344f99=_0x0b0e[_0x50b1c5];return _0x344f99;};'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 diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index d09d36e..1c88271 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 _0x105c=['contact','lead','account_contact_lead','account','nothing','exports','STRING','ENUM','Task','contact_lead'];(function(_0x5dc14c,_0x21645d){var _0x2fa297=function(_0x39d945){while(--_0x39d945){_0x5dc14c['push'](_0x5dc14c['shift']());}};_0x2fa297(++_0x21645d);}(_0x105c,0x87));var _0xc105=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0x105c[_0x261e29];return _0x25ef43;};'use strict';var Sequelize=require('sequelize');module[_0xc105('0x0')]={'name':{'type':Sequelize[_0xc105('0x1')]},'description':{'type':Sequelize[_0xc105('0x1')]},'ticketType':{'type':Sequelize[_0xc105('0x2')]('Task','Case'),'defaultValue':_0xc105('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xc105('0x4'),_0xc105('0x5'),_0xc105('0x6'),_0xc105('0x7'),_0xc105('0x8')),'defaultValue':_0xc105('0x4')},'moduleCreate':{'type':Sequelize['ENUM'](_0xc105('0x9'),_0xc105('0x5'),_0xc105('0x6'),_0xc105('0x8')),'defaultValue':'lead'},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0xc105('0x1')]},'additionalSearchLead':{'type':Sequelize[_0xc105('0x1')]}}; \ No newline at end of file +var _0x73c6=['Task','Case','ENUM','contact_lead','contact','account_contact_lead','account','nothing','lead','sequelize','STRING'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x73c6,0x195));var _0x673c=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x73c6[_0x5f3f88];return _0xd08119;};'use strict';var Sequelize=require(_0x673c('0x0'));module['exports']={'name':{'type':Sequelize[_0x673c('0x1')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize['ENUM'](_0x673c('0x2'),_0x673c('0x3')),'defaultValue':_0x673c('0x2')},'moduleSearch':{'type':Sequelize[_0x673c('0x4')](_0x673c('0x5'),_0x673c('0x6'),'lead',_0x673c('0x7'),_0x673c('0x8')),'defaultValue':_0x673c('0x5')},'moduleCreate':{'type':Sequelize[_0x673c('0x4')](_0x673c('0x9'),_0x673c('0x6'),'lead',_0x673c('0x8')),'defaultValue':_0x673c('0xa')},'leadId':{'type':Sequelize[_0x673c('0x1')]},'additionalSearchAccount':{'type':Sequelize['STRING']},'additionalSearchContact':{'type':Sequelize[_0x673c('0x1')]},'additionalSearchLead':{'type':Sequelize[_0x673c('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 78b6c37..414667b 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 _0xee87=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL','SalesforceConfiguration','then','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','getFields','findOne','sort','hasOwnProperty','getSubjects','getDescriptions','SalesforceField','rimraf','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee87,0x193));var _0x7ee8=function(_0x91c9b5,_0x4ad31a){_0x91c9b5=_0x91c9b5-0x0;var _0x1e267e=_0xee87[_0x91c9b5];return _0x1e267e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ee8('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7ee8('0x1'));var BPromise=require(_0x7ee8('0x2'));var Mustache=require(_0x7ee8('0x3'));var util=require('util');var path=require(_0x7ee8('0x4'));var sox=require(_0x7ee8('0x5'));var csv=require('to-csv');var ejs=require(_0x7ee8('0x6'));var fs=require('fs');var fs_extra=require(_0x7ee8('0x7'));var _=require(_0x7ee8('0x8'));var squel=require(_0x7ee8('0x9'));var crypto=require(_0x7ee8('0xa'));var jsforce=require(_0x7ee8('0xb'));var deskjs=require(_0x7ee8('0xc'));var toCsv=require(_0x7ee8('0xd'));var querystring=require(_0x7ee8('0xe'));var Papa=require(_0x7ee8('0xf'));var Redis=require(_0x7ee8('0x10'));var authService=require(_0x7ee8('0x11'));var qs=require(_0x7ee8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ee8('0x13'));var logger=require(_0x7ee8('0x14'))(_0x7ee8('0x15'));var utils=require(_0x7ee8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7ee8('0x17'));var db=require(_0x7ee8('0x18'))['db'];function respondWithStatusCode(_0x322707,_0x16ab62){_0x16ab62=_0x16ab62||0xcc;return function(_0x14a856){if(_0x14a856){return _0x322707[_0x7ee8('0x19')](_0x16ab62);}return _0x322707[_0x7ee8('0x1a')](_0x16ab62)[_0x7ee8('0x1b')]();};}function respondWithResult(_0x19dcd2,_0x170d84){_0x170d84=_0x170d84||0xc8;return function(_0x24d5e8){if(_0x24d5e8){return _0x19dcd2[_0x7ee8('0x1a')](_0x170d84)[_0x7ee8('0x1c')](_0x24d5e8);}};}function respondWithFilteredResult(_0x3ff469,_0x3a3b48){return function(_0xd275fb){if(_0xd275fb){var _0x1ddb6a=typeof _0x3a3b48[_0x7ee8('0x1d')]===_0x7ee8('0x1e')&&typeof _0x3a3b48[_0x7ee8('0x1f')]==='undefined';var _0x3b167c=_0xd275fb[_0x7ee8('0x20')];var _0x20fc7c=_0x1ddb6a?0x0:_0x3a3b48[_0x7ee8('0x1d')];var _0x2ef79f=_0x1ddb6a?_0xd275fb[_0x7ee8('0x20')]:_0x3a3b48[_0x7ee8('0x1d')]+_0x3a3b48['limit'];var _0x359da2;if(_0x2ef79f>=_0x3b167c){_0x2ef79f=_0x3b167c;_0x359da2=0xc8;}else{_0x359da2=0xce;}_0x3ff469['status'](_0x359da2);return _0x3ff469[_0x7ee8('0x21')]('Content-Range',_0x20fc7c+'-'+_0x2ef79f+'/'+_0x3b167c)[_0x7ee8('0x1c')](_0xd275fb);}return null;};}function patchUpdates(_0x1e3f04){return function(_0x37ca34){try{jsonpatch[_0x7ee8('0x22')](_0x37ca34,_0x1e3f04,!![]);}catch(_0x391035){return BPromise[_0x7ee8('0x23')](_0x391035);}return _0x37ca34[_0x7ee8('0x24')]();};}function saveUpdates(_0x13c3a7,_0x2ce7b5){return function(_0xb160a1){if(_0xb160a1){return _0xb160a1[_0x7ee8('0x25')](_0x13c3a7)['then'](function(_0x7d8f2f){return _0x7d8f2f;});}return null;};}function removeEntity(_0x3870d7,_0x252dde){return function(_0x314663){if(_0x314663){return _0x314663[_0x7ee8('0x26')]()['then'](function(){_0x3870d7[_0x7ee8('0x1a')](0xcc)[_0x7ee8('0x1b')]();});}};}function handleEntityNotFound(_0x1aaa8f,_0x330d08){return function(_0x411181){if(!_0x411181){_0x1aaa8f[_0x7ee8('0x19')](0x194);}return _0x411181;};}function handleError(_0x5698bd,_0x331966){_0x331966=_0x331966||0x1f4;return function(_0x57cf44){logger[_0x7ee8('0x27')](_0x57cf44[_0x7ee8('0x28')]);if(_0x57cf44[_0x7ee8('0x29')]){delete _0x57cf44[_0x7ee8('0x29')];}_0x5698bd['status'](_0x331966)[_0x7ee8('0x2a')](_0x57cf44);};}exports[_0x7ee8('0x2b')]=function(_0x3792fa,_0x43fe07){var _0x4a5e5c={},_0x1b604c={},_0x322cff={'count':0x0,'rows':[]};var _0x53c97e=_[_0x7ee8('0x2c')](db['SalesforceConfiguration'][_0x7ee8('0x2d')],function(_0x2b67ba){return{'name':_0x2b67ba[_0x7ee8('0x2e')],'type':_0x2b67ba[_0x7ee8('0x2f')][_0x7ee8('0x30')]};});_0x1b604c['model']=_['map'](_0x53c97e,_0x7ee8('0x29'));_0x1b604c[_0x7ee8('0x31')]=_[_0x7ee8('0x32')](_0x3792fa['query']);_0x1b604c[_0x7ee8('0x33')]=_[_0x7ee8('0x34')](_0x1b604c[_0x7ee8('0x35')],_0x1b604c['query']);_0x4a5e5c['attributes']=_['intersection'](_0x1b604c[_0x7ee8('0x35')],qs['fields'](_0x3792fa['query'][_0x7ee8('0x36')]));_0x4a5e5c[_0x7ee8('0x37')]=_0x4a5e5c[_0x7ee8('0x37')][_0x7ee8('0x38')]?_0x4a5e5c[_0x7ee8('0x37')]:_0x1b604c[_0x7ee8('0x35')];if(!_0x3792fa[_0x7ee8('0x31')]['hasOwnProperty'](_0x7ee8('0x39'))){_0x4a5e5c[_0x7ee8('0x1f')]=qs[_0x7ee8('0x1f')](_0x3792fa['query'][_0x7ee8('0x1f')]);_0x4a5e5c[_0x7ee8('0x1d')]=qs[_0x7ee8('0x1d')](_0x3792fa[_0x7ee8('0x31')][_0x7ee8('0x1d')]);}_0x4a5e5c[_0x7ee8('0x3a')]=qs['sort'](_0x3792fa['query']['sort']);_0x4a5e5c[_0x7ee8('0x3b')]=qs[_0x7ee8('0x33')](_[_0x7ee8('0x3c')](_0x3792fa[_0x7ee8('0x31')],_0x1b604c[_0x7ee8('0x33')]),_0x53c97e);if(_0x3792fa[_0x7ee8('0x31')][_0x7ee8('0x3d')]){_0x4a5e5c[_0x7ee8('0x3b')]=_[_0x7ee8('0x3e')](_0x4a5e5c['where'],{'$or':_[_0x7ee8('0x2c')](_0x53c97e,function(_0x320c8c){if(_0x320c8c[_0x7ee8('0x2f')]!==_0x7ee8('0x3f')){var _0x11dc71={};_0x11dc71[_0x320c8c[_0x7ee8('0x29')]]={'$like':'%'+_0x3792fa[_0x7ee8('0x31')][_0x7ee8('0x3d')]+'%'};return _0x11dc71;}})});}_0x4a5e5c=_[_0x7ee8('0x3e')]({},_0x4a5e5c,_0x3792fa['options']);var _0x9255f3={'where':_0x4a5e5c[_0x7ee8('0x3b')]};return db[_0x7ee8('0x40')][_0x7ee8('0x20')](_0x9255f3)[_0x7ee8('0x41')](function(_0xfce36a){_0x322cff['count']=_0xfce36a;if(_0x3792fa[_0x7ee8('0x31')]['includeAll']){_0x4a5e5c[_0x7ee8('0x42')]=[{'all':!![]}];}return db[_0x7ee8('0x40')][_0x7ee8('0x43')](_0x4a5e5c);})['then'](function(_0x4ce466){_0x322cff[_0x7ee8('0x44')]=_0x4ce466;return _0x322cff;})[_0x7ee8('0x41')](respondWithFilteredResult(_0x43fe07,_0x4a5e5c))[_0x7ee8('0x45')](handleError(_0x43fe07,null));};exports[_0x7ee8('0x46')]=function(_0x790d32,_0x685490){var _0x16b91f={'raw':![],'where':{'id':_0x790d32['params']['id']}},_0x128ad6={};_0x128ad6[_0x7ee8('0x35')]=_['keys'](db['SalesforceConfiguration']['rawAttributes']);_0x128ad6[_0x7ee8('0x31')]=_[_0x7ee8('0x32')](_0x790d32[_0x7ee8('0x31')]);_0x128ad6[_0x7ee8('0x33')]=_[_0x7ee8('0x34')](_0x128ad6[_0x7ee8('0x35')],_0x128ad6[_0x7ee8('0x31')]);_0x16b91f['attributes']=_[_0x7ee8('0x34')](_0x128ad6[_0x7ee8('0x35')],qs[_0x7ee8('0x36')](_0x790d32[_0x7ee8('0x31')][_0x7ee8('0x36')]));_0x16b91f['attributes']=_0x16b91f[_0x7ee8('0x37')][_0x7ee8('0x38')]?_0x16b91f[_0x7ee8('0x37')]:_0x128ad6[_0x7ee8('0x35')];if(_0x790d32[_0x7ee8('0x31')][_0x7ee8('0x47')]){_0x16b91f[_0x7ee8('0x42')]=[{'all':!![]}];}_0x16b91f=_['merge']({},_0x16b91f,_0x790d32[_0x7ee8('0x48')]);return db[_0x7ee8('0x40')][_0x7ee8('0x49')](_0x16b91f)[_0x7ee8('0x41')](handleEntityNotFound(_0x685490,null))[_0x7ee8('0x41')](respondWithResult(_0x685490,null))[_0x7ee8('0x45')](handleError(_0x685490,null));};exports[_0x7ee8('0x4a')]=function(_0x162049,_0x51e205){return db[_0x7ee8('0x40')][_0x7ee8('0x4a')](_0x162049[_0x7ee8('0x4b')],{})['then'](respondWithResult(_0x51e205,0xc9))[_0x7ee8('0x45')](handleError(_0x51e205,null));};exports['update']=function(_0x4d6b40,_0x379943){if(_0x4d6b40[_0x7ee8('0x4b')]['id']){delete _0x4d6b40[_0x7ee8('0x4b')]['id'];}return db[_0x7ee8('0x40')][_0x7ee8('0x49')]({'where':{'id':_0x4d6b40[_0x7ee8('0x4c')]['id']}})[_0x7ee8('0x41')](handleEntityNotFound(_0x379943,null))[_0x7ee8('0x41')](saveUpdates(_0x4d6b40[_0x7ee8('0x4b')],null))[_0x7ee8('0x41')](respondWithResult(_0x379943,null))[_0x7ee8('0x45')](handleError(_0x379943,null));};exports[_0x7ee8('0x26')]=function(_0x4ce4d6,_0x4b38e7){return db[_0x7ee8('0x40')][_0x7ee8('0x49')]({'where':{'id':_0x4ce4d6['params']['id']}})[_0x7ee8('0x41')](handleEntityNotFound(_0x4b38e7,null))[_0x7ee8('0x41')](removeEntity(_0x4b38e7,null))['catch'](handleError(_0x4b38e7,null));};exports[_0x7ee8('0x4d')]=function(_0xb3c3ee,_0x405a6b,_0x4b733d){var _0x5cc124={};var _0x30eda0={};var _0x5ab564;var _0x3fa83f;return db[_0x7ee8('0x40')][_0x7ee8('0x4e')]({'where':{'id':_0xb3c3ee['params']['id']}})[_0x7ee8('0x41')](handleEntityNotFound(_0x405a6b,null))[_0x7ee8('0x41')](function(_0xe0a576){if(_0xe0a576){_0x5ab564=_0xe0a576;_0x30eda0[_0x7ee8('0x35')]=_[_0x7ee8('0x32')](db['SalesforceField']['rawAttributes']);_0x30eda0[_0x7ee8('0x31')]=_[_0x7ee8('0x32')](_0xb3c3ee[_0x7ee8('0x31')]);_0x30eda0['filters']=_[_0x7ee8('0x34')](_0x30eda0[_0x7ee8('0x35')],_0x30eda0[_0x7ee8('0x31')]);_0x5cc124[_0x7ee8('0x37')]=_[_0x7ee8('0x34')](_0x30eda0['model'],qs[_0x7ee8('0x36')](_0xb3c3ee['query']['fields']));_0x5cc124[_0x7ee8('0x37')]=_0x5cc124[_0x7ee8('0x37')][_0x7ee8('0x38')]?_0x5cc124[_0x7ee8('0x37')]:_0x30eda0[_0x7ee8('0x35')];_0x5cc124[_0x7ee8('0x3a')]=qs[_0x7ee8('0x4f')](_0xb3c3ee[_0x7ee8('0x31')][_0x7ee8('0x4f')]);_0x5cc124[_0x7ee8('0x3b')]=qs[_0x7ee8('0x33')](_['pick'](_0xb3c3ee[_0x7ee8('0x31')],_0x30eda0[_0x7ee8('0x33')]));if(_0xb3c3ee[_0x7ee8('0x31')][_0x7ee8('0x3d')]){_0x5cc124[_0x7ee8('0x3b')]=_[_0x7ee8('0x3e')](_0x5cc124[_0x7ee8('0x3b')],{'$or':_[_0x7ee8('0x2c')](_0x5cc124[_0x7ee8('0x37')],function(_0xaffd8e){var _0x1dc80b={};_0x1dc80b[_0xaffd8e]={'$like':'%'+_0xb3c3ee[_0x7ee8('0x31')][_0x7ee8('0x3d')]+'%'};return _0x1dc80b;})});}_0x5cc124=_['merge']({},_0x5cc124,_0xb3c3ee[_0x7ee8('0x48')]);return _0x5ab564['getFields'](_0x5cc124);}})[_0x7ee8('0x41')](function(_0x12dcbf){if(_0x12dcbf){_0x3fa83f=_0x12dcbf[_0x7ee8('0x38')];if(!_0xb3c3ee['query'][_0x7ee8('0x50')](_0x7ee8('0x39'))){_0x5cc124[_0x7ee8('0x1f')]=qs['limit'](_0xb3c3ee[_0x7ee8('0x31')][_0x7ee8('0x1f')]);_0x5cc124[_0x7ee8('0x1d')]=qs['offset'](_0xb3c3ee['query']['offset']);}return _0x5ab564[_0x7ee8('0x4d')](_0x5cc124);}})[_0x7ee8('0x41')](function(_0x3330fd){if(_0x3330fd){return _0x3330fd?{'count':_0x3fa83f,'rows':_0x3330fd}:null;}})[_0x7ee8('0x41')](respondWithResult(_0x405a6b,null))[_0x7ee8('0x45')](handleError(_0x405a6b,null));};exports[_0x7ee8('0x51')]=function(_0x6848e1,_0x34c43a,_0x4d0243){var _0x492e77={};var _0x1c83a6={};var _0x3a7a3c;var _0x4febf7;return db[_0x7ee8('0x40')]['findOne']({'where':{'id':_0x6848e1['params']['id']}})[_0x7ee8('0x41')](handleEntityNotFound(_0x34c43a,null))[_0x7ee8('0x41')](function(_0x14ee81){if(_0x14ee81){_0x3a7a3c=_0x14ee81;_0x1c83a6[_0x7ee8('0x35')]=_[_0x7ee8('0x32')](db['SalesforceField']['rawAttributes']);_0x1c83a6[_0x7ee8('0x31')]=_['keys'](_0x6848e1[_0x7ee8('0x31')]);_0x1c83a6[_0x7ee8('0x33')]=_['intersection'](_0x1c83a6[_0x7ee8('0x35')],_0x1c83a6['query']);_0x492e77['attributes']=_['intersection'](_0x1c83a6[_0x7ee8('0x35')],qs['fields'](_0x6848e1[_0x7ee8('0x31')][_0x7ee8('0x36')]));_0x492e77[_0x7ee8('0x37')]=_0x492e77[_0x7ee8('0x37')][_0x7ee8('0x38')]?_0x492e77[_0x7ee8('0x37')]:_0x1c83a6['model'];_0x492e77[_0x7ee8('0x3a')]=qs[_0x7ee8('0x4f')](_0x6848e1[_0x7ee8('0x31')][_0x7ee8('0x4f')]);_0x492e77[_0x7ee8('0x3b')]=qs[_0x7ee8('0x33')](_[_0x7ee8('0x3c')](_0x6848e1[_0x7ee8('0x31')],_0x1c83a6['filters']));if(_0x6848e1['query'][_0x7ee8('0x3d')]){_0x492e77['where']=_[_0x7ee8('0x3e')](_0x492e77[_0x7ee8('0x3b')],{'$or':_[_0x7ee8('0x2c')](_0x492e77[_0x7ee8('0x37')],function(_0x4f47cd){var _0x4282df={};_0x4282df[_0x4f47cd]={'$like':'%'+_0x6848e1[_0x7ee8('0x31')][_0x7ee8('0x3d')]+'%'};return _0x4282df;})});}_0x492e77=_[_0x7ee8('0x3e')]({},_0x492e77,_0x6848e1['options']);return _0x3a7a3c[_0x7ee8('0x51')](_0x492e77);}})[_0x7ee8('0x41')](function(_0x5f4ab3){if(_0x5f4ab3){_0x4febf7=_0x5f4ab3['length'];if(!_0x6848e1[_0x7ee8('0x31')][_0x7ee8('0x50')](_0x7ee8('0x39'))){_0x492e77[_0x7ee8('0x1f')]=qs['limit'](_0x6848e1[_0x7ee8('0x31')][_0x7ee8('0x1f')]);_0x492e77[_0x7ee8('0x1d')]=qs[_0x7ee8('0x1d')](_0x6848e1[_0x7ee8('0x31')]['offset']);}return _0x3a7a3c[_0x7ee8('0x51')](_0x492e77);}})['then'](function(_0x7f0181){if(_0x7f0181){return _0x7f0181?{'count':_0x4febf7,'rows':_0x7f0181}:null;}})[_0x7ee8('0x41')](respondWithResult(_0x34c43a,null))['catch'](handleError(_0x34c43a,null));};exports[_0x7ee8('0x52')]=function(_0x1b4124,_0x493bdf,_0x236c1b){var _0x3e82e7={};var _0x164ce6={};var _0xd9c0ed;var _0x28f06a;return db['SalesforceConfiguration'][_0x7ee8('0x4e')]({'where':{'id':_0x1b4124[_0x7ee8('0x4c')]['id']}})[_0x7ee8('0x41')](handleEntityNotFound(_0x493bdf,null))[_0x7ee8('0x41')](function(_0x37810a){if(_0x37810a){_0xd9c0ed=_0x37810a;_0x164ce6[_0x7ee8('0x35')]=_[_0x7ee8('0x32')](db[_0x7ee8('0x53')][_0x7ee8('0x2d')]);_0x164ce6[_0x7ee8('0x31')]=_[_0x7ee8('0x32')](_0x1b4124[_0x7ee8('0x31')]);_0x164ce6[_0x7ee8('0x33')]=_[_0x7ee8('0x34')](_0x164ce6[_0x7ee8('0x35')],_0x164ce6[_0x7ee8('0x31')]);_0x3e82e7[_0x7ee8('0x37')]=_[_0x7ee8('0x34')](_0x164ce6[_0x7ee8('0x35')],qs[_0x7ee8('0x36')](_0x1b4124[_0x7ee8('0x31')][_0x7ee8('0x36')]));_0x3e82e7[_0x7ee8('0x37')]=_0x3e82e7['attributes'][_0x7ee8('0x38')]?_0x3e82e7[_0x7ee8('0x37')]:_0x164ce6[_0x7ee8('0x35')];_0x3e82e7[_0x7ee8('0x3a')]=qs['sort'](_0x1b4124[_0x7ee8('0x31')][_0x7ee8('0x4f')]);_0x3e82e7[_0x7ee8('0x3b')]=qs[_0x7ee8('0x33')](_[_0x7ee8('0x3c')](_0x1b4124[_0x7ee8('0x31')],_0x164ce6[_0x7ee8('0x33')]));if(_0x1b4124[_0x7ee8('0x31')][_0x7ee8('0x3d')]){_0x3e82e7[_0x7ee8('0x3b')]=_['merge'](_0x3e82e7['where'],{'$or':_[_0x7ee8('0x2c')](_0x3e82e7['attributes'],function(_0x45659e){var _0x2518e2={};_0x2518e2[_0x45659e]={'$like':'%'+_0x1b4124['query'][_0x7ee8('0x3d')]+'%'};return _0x2518e2;})});}_0x3e82e7=_[_0x7ee8('0x3e')]({},_0x3e82e7,_0x1b4124[_0x7ee8('0x48')]);return _0xd9c0ed[_0x7ee8('0x52')](_0x3e82e7);}})[_0x7ee8('0x41')](function(_0x1b4e6d){if(_0x1b4e6d){_0x28f06a=_0x1b4e6d[_0x7ee8('0x38')];if(!_0x1b4124[_0x7ee8('0x31')]['hasOwnProperty']('nolimit')){_0x3e82e7[_0x7ee8('0x1f')]=qs[_0x7ee8('0x1f')](_0x1b4124['query'][_0x7ee8('0x1f')]);_0x3e82e7[_0x7ee8('0x1d')]=qs['offset'](_0x1b4124[_0x7ee8('0x31')]['offset']);}return _0xd9c0ed[_0x7ee8('0x52')](_0x3e82e7);}})[_0x7ee8('0x41')](function(_0x26549a){if(_0x26549a){return _0x26549a?{'count':_0x28f06a,'rows':_0x26549a}:null;}})[_0x7ee8('0x41')](respondWithResult(_0x493bdf,null))[_0x7ee8('0x45')](handleError(_0x493bdf,null));}; \ No newline at end of file +var _0x2570=['includeAll','include','findAll','rows','catch','show','params','find','create','body','getFields','findOne','getSubjects','rawAttributes','getDescriptions','eml-format','zip-dir','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','SalesforceConfiguration','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options'];(function(_0x4ed955,_0x5b2b35){var _0x24bd1b=function(_0x93d4b6){while(--_0x93d4b6){_0x4ed955['push'](_0x4ed955['shift']());}};_0x24bd1b(++_0x5b2b35);}(_0x2570,0x1d7));var _0x0257=function(_0xdbff26,_0xfc8995){_0xdbff26=_0xdbff26-0x0;var _0x4adb23=_0x2570[_0xdbff26];return _0x4adb23;};'use strict';var emlformat=require(_0x0257('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0257('0x1'));var jsonpatch=require(_0x0257('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x0257('0x3'));var util=require(_0x0257('0x4'));var path=require(_0x0257('0x5'));var sox=require(_0x0257('0x6'));var csv=require(_0x0257('0x7'));var ejs=require(_0x0257('0x8'));var fs=require('fs');var fs_extra=require(_0x0257('0x9'));var _=require('lodash');var squel=require(_0x0257('0xa'));var crypto=require(_0x0257('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0257('0xc'));var toCsv=require(_0x0257('0x7'));var querystring=require(_0x0257('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0257('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0257('0xf'));var logger=require('../../config/logger')(_0x0257('0x10'));var utils=require(_0x0257('0x11'));var config=require(_0x0257('0x12'));var licenseUtil=require(_0x0257('0x13'));var db=require(_0x0257('0x14'))['db'];function respondWithStatusCode(_0xa57264,_0x5cfec7){_0x5cfec7=_0x5cfec7||0xcc;return function(_0x15c3ea){if(_0x15c3ea){return _0xa57264[_0x0257('0x15')](_0x5cfec7);}return _0xa57264['status'](_0x5cfec7)['end']();};}function respondWithResult(_0x4ae0df,_0x5dbb89){_0x5dbb89=_0x5dbb89||0xc8;return function(_0x2547dc){if(_0x2547dc){return _0x4ae0df[_0x0257('0x16')](_0x5dbb89)[_0x0257('0x17')](_0x2547dc);}};}function respondWithFilteredResult(_0x2e7c9e,_0x5d8dd8){return function(_0x4e0526){if(_0x4e0526){var _0x24c7eb=typeof _0x5d8dd8[_0x0257('0x18')]==='undefined'&&typeof _0x5d8dd8[_0x0257('0x19')]==='undefined';var _0x46b57e=_0x4e0526[_0x0257('0x1a')];var _0x5b73d8=_0x24c7eb?0x0:_0x5d8dd8[_0x0257('0x18')];var _0x2b57b6=_0x24c7eb?_0x4e0526[_0x0257('0x1a')]:_0x5d8dd8[_0x0257('0x18')]+_0x5d8dd8[_0x0257('0x19')];var _0x2a65b8;if(_0x2b57b6>=_0x46b57e){_0x2b57b6=_0x46b57e;_0x2a65b8=0xc8;}else{_0x2a65b8=0xce;}_0x2e7c9e[_0x0257('0x16')](_0x2a65b8);return _0x2e7c9e[_0x0257('0x1b')](_0x0257('0x1c'),_0x5b73d8+'-'+_0x2b57b6+'/'+_0x46b57e)['json'](_0x4e0526);}return null;};}function patchUpdates(_0xc21038){return function(_0x58bf79){try{jsonpatch[_0x0257('0x1d')](_0x58bf79,_0xc21038,!![]);}catch(_0x4a51fd){return BPromise[_0x0257('0x1e')](_0x4a51fd);}return _0x58bf79[_0x0257('0x1f')]();};}function saveUpdates(_0x3aaebe,_0x36676f){return function(_0x4db883){if(_0x4db883){return _0x4db883[_0x0257('0x20')](_0x3aaebe)['then'](function(_0x389ebe){return _0x389ebe;});}return null;};}function removeEntity(_0xb85c52,_0x43b3cd){return function(_0x3d1b6d){if(_0x3d1b6d){return _0x3d1b6d[_0x0257('0x21')]()[_0x0257('0x22')](function(){_0xb85c52[_0x0257('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cd513,_0x351a15){return function(_0x4b1df9){if(!_0x4b1df9){_0x1cd513[_0x0257('0x15')](0x194);}return _0x4b1df9;};}function handleError(_0x59eaa1,_0x5be36d){_0x5be36d=_0x5be36d||0x1f4;return function(_0x23b7dc){logger[_0x0257('0x23')](_0x23b7dc[_0x0257('0x24')]);if(_0x23b7dc[_0x0257('0x25')]){delete _0x23b7dc[_0x0257('0x25')];}_0x59eaa1['status'](_0x5be36d)[_0x0257('0x26')](_0x23b7dc);};}exports['index']=function(_0x5e55b6,_0x3d5820){var _0x225426={},_0x4c7c54={},_0x14bff5={'count':0x0,'rows':[]};var _0x2b929e=_['map'](db[_0x0257('0x27')]['rawAttributes'],function(_0x48b8d9){return{'name':_0x48b8d9['fieldName'],'type':_0x48b8d9[_0x0257('0x28')][_0x0257('0x29')]};});_0x4c7c54[_0x0257('0x2a')]=_[_0x0257('0x2b')](_0x2b929e,'name');_0x4c7c54[_0x0257('0x2c')]=_[_0x0257('0x2d')](_0x5e55b6[_0x0257('0x2c')]);_0x4c7c54[_0x0257('0x2e')]=_[_0x0257('0x2f')](_0x4c7c54[_0x0257('0x2a')],_0x4c7c54[_0x0257('0x2c')]);_0x225426[_0x0257('0x30')]=_['intersection'](_0x4c7c54['model'],qs[_0x0257('0x31')](_0x5e55b6[_0x0257('0x2c')][_0x0257('0x31')]));_0x225426[_0x0257('0x30')]=_0x225426[_0x0257('0x30')][_0x0257('0x32')]?_0x225426[_0x0257('0x30')]:_0x4c7c54[_0x0257('0x2a')];if(!_0x5e55b6[_0x0257('0x2c')][_0x0257('0x33')](_0x0257('0x34'))){_0x225426[_0x0257('0x19')]=qs['limit'](_0x5e55b6['query'][_0x0257('0x19')]);_0x225426[_0x0257('0x18')]=qs[_0x0257('0x18')](_0x5e55b6['query']['offset']);}_0x225426[_0x0257('0x35')]=qs[_0x0257('0x36')](_0x5e55b6[_0x0257('0x2c')][_0x0257('0x36')]);_0x225426['where']=qs['filters'](_[_0x0257('0x37')](_0x5e55b6['query'],_0x4c7c54['filters']),_0x2b929e);if(_0x5e55b6['query']['filter']){_0x225426[_0x0257('0x38')]=_[_0x0257('0x39')](_0x225426[_0x0257('0x38')],{'$or':_[_0x0257('0x2b')](_0x2b929e,function(_0x4fa4e6){if(_0x4fa4e6[_0x0257('0x28')]!==_0x0257('0x3a')){var _0x560b1b={};_0x560b1b[_0x4fa4e6[_0x0257('0x25')]]={'$like':'%'+_0x5e55b6[_0x0257('0x2c')][_0x0257('0x3b')]+'%'};return _0x560b1b;}})});}_0x225426=_[_0x0257('0x39')]({},_0x225426,_0x5e55b6[_0x0257('0x3c')]);var _0x5995e9={'where':_0x225426[_0x0257('0x38')]};return db[_0x0257('0x27')][_0x0257('0x1a')](_0x5995e9)[_0x0257('0x22')](function(_0x30ed34){_0x14bff5[_0x0257('0x1a')]=_0x30ed34;if(_0x5e55b6['query'][_0x0257('0x3d')]){_0x225426[_0x0257('0x3e')]=[{'all':!![]}];}return db[_0x0257('0x27')][_0x0257('0x3f')](_0x225426);})[_0x0257('0x22')](function(_0x545689){_0x14bff5[_0x0257('0x40')]=_0x545689;return _0x14bff5;})[_0x0257('0x22')](respondWithFilteredResult(_0x3d5820,_0x225426))[_0x0257('0x41')](handleError(_0x3d5820,null));};exports[_0x0257('0x42')]=function(_0x4a8100,_0x195ed8){var _0x228d0b={'raw':![],'where':{'id':_0x4a8100[_0x0257('0x43')]['id']}},_0x17bfe7={};_0x17bfe7[_0x0257('0x2a')]=_[_0x0257('0x2d')](db['SalesforceConfiguration']['rawAttributes']);_0x17bfe7[_0x0257('0x2c')]=_['keys'](_0x4a8100[_0x0257('0x2c')]);_0x17bfe7[_0x0257('0x2e')]=_[_0x0257('0x2f')](_0x17bfe7[_0x0257('0x2a')],_0x17bfe7['query']);_0x228d0b[_0x0257('0x30')]=_['intersection'](_0x17bfe7['model'],qs[_0x0257('0x31')](_0x4a8100[_0x0257('0x2c')]['fields']));_0x228d0b[_0x0257('0x30')]=_0x228d0b[_0x0257('0x30')][_0x0257('0x32')]?_0x228d0b[_0x0257('0x30')]:_0x17bfe7[_0x0257('0x2a')];if(_0x4a8100[_0x0257('0x2c')][_0x0257('0x3d')]){_0x228d0b['include']=[{'all':!![]}];}_0x228d0b=_['merge']({},_0x228d0b,_0x4a8100[_0x0257('0x3c')]);return db[_0x0257('0x27')][_0x0257('0x44')](_0x228d0b)[_0x0257('0x22')](handleEntityNotFound(_0x195ed8,null))['then'](respondWithResult(_0x195ed8,null))[_0x0257('0x41')](handleError(_0x195ed8,null));};exports[_0x0257('0x45')]=function(_0x2b2786,_0xb1de21){return db[_0x0257('0x27')][_0x0257('0x45')](_0x2b2786[_0x0257('0x46')],{})['then'](respondWithResult(_0xb1de21,0xc9))[_0x0257('0x41')](handleError(_0xb1de21,null));};exports[_0x0257('0x20')]=function(_0x4ae6cf,_0x27cdea){if(_0x4ae6cf['body']['id']){delete _0x4ae6cf['body']['id'];}return db[_0x0257('0x27')][_0x0257('0x44')]({'where':{'id':_0x4ae6cf[_0x0257('0x43')]['id']}})[_0x0257('0x22')](handleEntityNotFound(_0x27cdea,null))[_0x0257('0x22')](saveUpdates(_0x4ae6cf[_0x0257('0x46')],null))[_0x0257('0x22')](respondWithResult(_0x27cdea,null))['catch'](handleError(_0x27cdea,null));};exports[_0x0257('0x21')]=function(_0x3326f6,_0x472ee1){return db[_0x0257('0x27')][_0x0257('0x44')]({'where':{'id':_0x3326f6[_0x0257('0x43')]['id']}})['then'](handleEntityNotFound(_0x472ee1,null))[_0x0257('0x22')](removeEntity(_0x472ee1,null))[_0x0257('0x41')](handleError(_0x472ee1,null));};exports[_0x0257('0x47')]=function(_0x3b527e,_0x1839e3,_0x2d5ec8){var _0x55881f={};var _0x14a408={};var _0x1e1727;var _0x14d565;return db[_0x0257('0x27')][_0x0257('0x48')]({'where':{'id':_0x3b527e['params']['id']}})[_0x0257('0x22')](handleEntityNotFound(_0x1839e3,null))[_0x0257('0x22')](function(_0x3fb20d){if(_0x3fb20d){_0x1e1727=_0x3fb20d;_0x14a408[_0x0257('0x2a')]=_['keys'](db['SalesforceField']['rawAttributes']);_0x14a408[_0x0257('0x2c')]=_['keys'](_0x3b527e[_0x0257('0x2c')]);_0x14a408['filters']=_[_0x0257('0x2f')](_0x14a408['model'],_0x14a408[_0x0257('0x2c')]);_0x55881f[_0x0257('0x30')]=_[_0x0257('0x2f')](_0x14a408['model'],qs[_0x0257('0x31')](_0x3b527e[_0x0257('0x2c')]['fields']));_0x55881f[_0x0257('0x30')]=_0x55881f[_0x0257('0x30')][_0x0257('0x32')]?_0x55881f[_0x0257('0x30')]:_0x14a408['model'];_0x55881f[_0x0257('0x35')]=qs[_0x0257('0x36')](_0x3b527e[_0x0257('0x2c')]['sort']);_0x55881f[_0x0257('0x38')]=qs['filters'](_[_0x0257('0x37')](_0x3b527e[_0x0257('0x2c')],_0x14a408['filters']));if(_0x3b527e[_0x0257('0x2c')]['filter']){_0x55881f[_0x0257('0x38')]=_[_0x0257('0x39')](_0x55881f[_0x0257('0x38')],{'$or':_['map'](_0x55881f[_0x0257('0x30')],function(_0x1e799d){var _0x18f676={};_0x18f676[_0x1e799d]={'$like':'%'+_0x3b527e['query'][_0x0257('0x3b')]+'%'};return _0x18f676;})});}_0x55881f=_['merge']({},_0x55881f,_0x3b527e[_0x0257('0x3c')]);return _0x1e1727[_0x0257('0x47')](_0x55881f);}})[_0x0257('0x22')](function(_0xbef48d){if(_0xbef48d){_0x14d565=_0xbef48d[_0x0257('0x32')];if(!_0x3b527e[_0x0257('0x2c')][_0x0257('0x33')]('nolimit')){_0x55881f[_0x0257('0x19')]=qs[_0x0257('0x19')](_0x3b527e[_0x0257('0x2c')][_0x0257('0x19')]);_0x55881f[_0x0257('0x18')]=qs[_0x0257('0x18')](_0x3b527e[_0x0257('0x2c')][_0x0257('0x18')]);}return _0x1e1727['getFields'](_0x55881f);}})[_0x0257('0x22')](function(_0x6ceca4){if(_0x6ceca4){return _0x6ceca4?{'count':_0x14d565,'rows':_0x6ceca4}:null;}})[_0x0257('0x22')](respondWithResult(_0x1839e3,null))[_0x0257('0x41')](handleError(_0x1839e3,null));};exports[_0x0257('0x49')]=function(_0x57322d,_0x5d3914,_0x4ff427){var _0x5f343d={};var _0x268d63={};var _0x4d1e42;var _0x26e430;return db[_0x0257('0x27')][_0x0257('0x48')]({'where':{'id':_0x57322d[_0x0257('0x43')]['id']}})[_0x0257('0x22')](handleEntityNotFound(_0x5d3914,null))[_0x0257('0x22')](function(_0x4d19e8){if(_0x4d19e8){_0x4d1e42=_0x4d19e8;_0x268d63[_0x0257('0x2a')]=_[_0x0257('0x2d')](db['SalesforceField'][_0x0257('0x4a')]);_0x268d63[_0x0257('0x2c')]=_[_0x0257('0x2d')](_0x57322d[_0x0257('0x2c')]);_0x268d63[_0x0257('0x2e')]=_['intersection'](_0x268d63[_0x0257('0x2a')],_0x268d63['query']);_0x5f343d[_0x0257('0x30')]=_[_0x0257('0x2f')](_0x268d63[_0x0257('0x2a')],qs[_0x0257('0x31')](_0x57322d[_0x0257('0x2c')][_0x0257('0x31')]));_0x5f343d['attributes']=_0x5f343d[_0x0257('0x30')][_0x0257('0x32')]?_0x5f343d[_0x0257('0x30')]:_0x268d63[_0x0257('0x2a')];_0x5f343d[_0x0257('0x35')]=qs[_0x0257('0x36')](_0x57322d['query'][_0x0257('0x36')]);_0x5f343d[_0x0257('0x38')]=qs[_0x0257('0x2e')](_[_0x0257('0x37')](_0x57322d[_0x0257('0x2c')],_0x268d63[_0x0257('0x2e')]));if(_0x57322d[_0x0257('0x2c')][_0x0257('0x3b')]){_0x5f343d['where']=_[_0x0257('0x39')](_0x5f343d['where'],{'$or':_[_0x0257('0x2b')](_0x5f343d[_0x0257('0x30')],function(_0x16eee7){var _0x2d9be6={};_0x2d9be6[_0x16eee7]={'$like':'%'+_0x57322d[_0x0257('0x2c')]['filter']+'%'};return _0x2d9be6;})});}_0x5f343d=_[_0x0257('0x39')]({},_0x5f343d,_0x57322d['options']);return _0x4d1e42[_0x0257('0x49')](_0x5f343d);}})[_0x0257('0x22')](function(_0x2acacf){if(_0x2acacf){_0x26e430=_0x2acacf['length'];if(!_0x57322d[_0x0257('0x2c')]['hasOwnProperty'](_0x0257('0x34'))){_0x5f343d[_0x0257('0x19')]=qs['limit'](_0x57322d[_0x0257('0x2c')][_0x0257('0x19')]);_0x5f343d[_0x0257('0x18')]=qs[_0x0257('0x18')](_0x57322d[_0x0257('0x2c')][_0x0257('0x18')]);}return _0x4d1e42[_0x0257('0x49')](_0x5f343d);}})[_0x0257('0x22')](function(_0x5c2f20){if(_0x5c2f20){return _0x5c2f20?{'count':_0x26e430,'rows':_0x5c2f20}:null;}})[_0x0257('0x22')](respondWithResult(_0x5d3914,null))['catch'](handleError(_0x5d3914,null));};exports[_0x0257('0x4b')]=function(_0x1f6d45,_0x43ffe1,_0x2fe7ee){var _0x3b65c6={};var _0x3b488b={};var _0x1a5fdc;var _0x445990;return db['SalesforceConfiguration'][_0x0257('0x48')]({'where':{'id':_0x1f6d45[_0x0257('0x43')]['id']}})[_0x0257('0x22')](handleEntityNotFound(_0x43ffe1,null))[_0x0257('0x22')](function(_0x15ad36){if(_0x15ad36){_0x1a5fdc=_0x15ad36;_0x3b488b['model']=_[_0x0257('0x2d')](db['SalesforceField'][_0x0257('0x4a')]);_0x3b488b[_0x0257('0x2c')]=_[_0x0257('0x2d')](_0x1f6d45[_0x0257('0x2c')]);_0x3b488b[_0x0257('0x2e')]=_[_0x0257('0x2f')](_0x3b488b[_0x0257('0x2a')],_0x3b488b['query']);_0x3b65c6['attributes']=_[_0x0257('0x2f')](_0x3b488b[_0x0257('0x2a')],qs[_0x0257('0x31')](_0x1f6d45['query']['fields']));_0x3b65c6[_0x0257('0x30')]=_0x3b65c6['attributes'][_0x0257('0x32')]?_0x3b65c6['attributes']:_0x3b488b[_0x0257('0x2a')];_0x3b65c6[_0x0257('0x35')]=qs[_0x0257('0x36')](_0x1f6d45[_0x0257('0x2c')][_0x0257('0x36')]);_0x3b65c6[_0x0257('0x38')]=qs[_0x0257('0x2e')](_[_0x0257('0x37')](_0x1f6d45[_0x0257('0x2c')],_0x3b488b[_0x0257('0x2e')]));if(_0x1f6d45[_0x0257('0x2c')]['filter']){_0x3b65c6[_0x0257('0x38')]=_[_0x0257('0x39')](_0x3b65c6[_0x0257('0x38')],{'$or':_[_0x0257('0x2b')](_0x3b65c6[_0x0257('0x30')],function(_0x1f0b6f){var _0x368e32={};_0x368e32[_0x1f0b6f]={'$like':'%'+_0x1f6d45[_0x0257('0x2c')][_0x0257('0x3b')]+'%'};return _0x368e32;})});}_0x3b65c6=_[_0x0257('0x39')]({},_0x3b65c6,_0x1f6d45[_0x0257('0x3c')]);return _0x1a5fdc[_0x0257('0x4b')](_0x3b65c6);}})['then'](function(_0x447c43){if(_0x447c43){_0x445990=_0x447c43['length'];if(!_0x1f6d45[_0x0257('0x2c')][_0x0257('0x33')]('nolimit')){_0x3b65c6[_0x0257('0x19')]=qs[_0x0257('0x19')](_0x1f6d45[_0x0257('0x2c')][_0x0257('0x19')]);_0x3b65c6['offset']=qs['offset'](_0x1f6d45['query'][_0x0257('0x18')]);}return _0x1a5fdc[_0x0257('0x4b')](_0x3b65c6);}})[_0x0257('0x22')](function(_0x20afe8){if(_0x20afe8){return _0x20afe8?{'count':_0x445990,'rows':_0x20afe8}:null;}})[_0x0257('0x22')](respondWithResult(_0x43ffe1,null))[_0x0257('0x41')](handleError(_0x43ffe1,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index e1a9a62..f6bad72 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 _0x97e4=['moment','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','int_salesforce_configurations','lodash','../../config/logger','api'];(function(_0x45c262,_0x2e3ce5){var _0x4f2ba6=function(_0x4912d1){while(--_0x4912d1){_0x45c262['push'](_0x45c262['shift']());}};_0x4f2ba6(++_0x2e3ce5);}(_0x97e4,0x1a1));var _0x497e=function(_0x5b2433,_0x55e16e){_0x5b2433=_0x5b2433-0x0;var _0x43dfe0=_0x97e4[_0x5b2433];return _0x43dfe0;};'use strict';var _=require(_0x497e('0x0'));var util=require('util');var logger=require(_0x497e('0x1'))(_0x497e('0x2'));var moment=require(_0x497e('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x497e('0x4'));var rimraf=require(_0x497e('0x5'));var config=require(_0x497e('0x6'));var attributes=require(_0x497e('0x7'));module[_0x497e('0x8')]=function(_0x3d6dfd,_0x270a8d){return _0x3d6dfd['define']('SalesforceConfiguration',attributes,{'tableName':_0x497e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf72b=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x1972ba,_0x26a878){var _0x65ede6=function(_0x4de101){while(--_0x4de101){_0x1972ba['push'](_0x1972ba['shift']());}};_0x65ede6(++_0x26a878);}(_0xf72b,0x16d));var _0xbf72=function(_0x1abf45,_0x1cfbb9){_0x1abf45=_0x1abf45-0x0;var _0x39db58=_0xf72b[_0x1abf45];return _0x39db58;};'use strict';var _=require(_0xbf72('0x0'));var util=require(_0xbf72('0x1'));var logger=require(_0xbf72('0x2'))(_0xbf72('0x3'));var moment=require(_0xbf72('0x4'));var BPromise=require(_0xbf72('0x5'));var rp=require(_0xbf72('0x6'));var fs=require('fs');var path=require(_0xbf72('0x7'));var rimraf=require(_0xbf72('0x8'));var config=require(_0xbf72('0x9'));var attributes=require(_0xbf72('0xa'));module['exports']=function(_0x247d25,_0x4d7328){return _0x247d25[_0xbf72('0xb')]('SalesforceConfiguration',attributes,{'tableName':'int_salesforce_configurations','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 e7f90ea..487ab70 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 _0x4803=['debug','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x42d5ae,_0x5350a7){var _0x14a05a=function(_0x506154){while(--_0x506154){_0x42d5ae['push'](_0x42d5ae['shift']());}};_0x14a05a(++_0x5350a7);}(_0x4803,0x1e5));var _0x3480=function(_0x47ed1a,_0x34e1d8){_0x47ed1a=_0x47ed1a-0x0;var _0x23b059=_0x4803[_0x47ed1a];return _0x23b059;};'use strict';var _=require(_0x3480('0x0'));var util=require(_0x3480('0x1'));var moment=require('moment');var BPromise=require(_0x3480('0x2'));var rs=require(_0x3480('0x3'));var fs=require('fs');var Redis=require(_0x3480('0x4'));var db=require(_0x3480('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x3480('0x6'))(_0x3480('0x7'));var config=require(_0x3480('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3480('0x9')][_0x3480('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46168e,_0x4f54ca,_0xb57a9e){return new BPromise(function(_0x507a8c,_0x2b3e4f){return client[_0x3480('0xb')](_0x46168e,_0xb57a9e)[_0x3480('0xc')](function(_0x27d6b2){logger['info'](_0x3480('0xd'),_0x4f54ca,_0x3480('0xe'));logger[_0x3480('0xf')]('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x4f54ca,'request\x20sent',JSON[_0x3480('0x10')](_0x27d6b2));if(_0x27d6b2[_0x3480('0x11')]){if(_0x27d6b2[_0x3480('0x11')]['code']===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4f54ca,_0x27d6b2[_0x3480('0x11')][_0x3480('0x12')]);return _0x2b3e4f(_0x27d6b2['error'][_0x3480('0x12')]);}logger[_0x3480('0x11')](_0x3480('0xd'),_0x4f54ca,_0x27d6b2[_0x3480('0x11')][_0x3480('0x12')]);return _0x507a8c(_0x27d6b2[_0x3480('0x11')][_0x3480('0x12')]);}else{logger['info'](_0x3480('0xd'),_0x4f54ca,_0x3480('0xe'));_0x507a8c(_0x27d6b2['result']['message']);}})[_0x3480('0x13')](function(_0x49a4a1){logger[_0x3480('0x11')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4f54ca,_0x49a4a1);_0x2b3e4f(_0x49a4a1);});});} \ No newline at end of file +var _0xa323=['http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0xf8da14,_0x49b2f2){var _0x61d88c=function(_0x23c987){while(--_0x23c987){_0xf8da14['push'](_0xf8da14['shift']());}};_0x61d88c(++_0x49b2f2);}(_0xa323,0x1e6));var _0x3a32=function(_0x41ef02,_0x101e1a){_0x41ef02=_0x41ef02-0x0;var _0x5e6995=_0xa323[_0x41ef02];return _0x5e6995;};'use strict';var _=require(_0x3a32('0x0'));var util=require(_0x3a32('0x1'));var moment=require('moment');var BPromise=require(_0x3a32('0x2'));var rs=require(_0x3a32('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3a32('0x4'))['db'];var utils=require(_0x3a32('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x3a32('0x6'));var client=jayson[_0x3a32('0x7')][_0x3a32('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x18b522,_0x3bf993,_0x3c5a8f){return new BPromise(function(_0x4849db,_0x34c503){return client['request'](_0x18b522,_0x3c5a8f)[_0x3a32('0x9')](function(_0x314707){logger[_0x3a32('0xa')](_0x3a32('0xb'),_0x3bf993,_0x3a32('0xc'));logger['debug'](_0x3a32('0xd'),_0x3bf993,_0x3a32('0xc'),JSON[_0x3a32('0xe')](_0x314707));if(_0x314707[_0x3a32('0xf')]){if(_0x314707[_0x3a32('0xf')][_0x3a32('0x10')]===0x1f4){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x3bf993,_0x314707[_0x3a32('0xf')][_0x3a32('0x11')]);return _0x34c503(_0x314707['error'][_0x3a32('0x11')]);}logger[_0x3a32('0xf')](_0x3a32('0xb'),_0x3bf993,_0x314707['error'][_0x3a32('0x11')]);return _0x4849db(_0x314707[_0x3a32('0xf')][_0x3a32('0x11')]);}else{logger[_0x3a32('0xa')](_0x3a32('0xb'),_0x3bf993,_0x3a32('0xc'));_0x4849db(_0x314707['result'][_0x3a32('0x11')]);}})[_0x3a32('0x12')](function(_0x2d68fa){logger['error'](_0x3a32('0xb'),_0x3bf993,_0x2d68fa);_0x34c503(_0x2d68fa);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 3dfc670..332c681 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 _0x8818=['create','put','/:id','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','show','post'];(function(_0x214b04,_0x4ecd10){var _0x1a3a3e=function(_0x5bff2a){while(--_0x5bff2a){_0x214b04['push'](_0x214b04['shift']());}};_0x1a3a3e(++_0x4ecd10);}(_0x8818,0xea));var _0x8881=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0x8818[_0x550d12];return _0x12103d;};'use strict';var multer=require(_0x8881('0x0'));var util=require(_0x8881('0x1'));var path=require(_0x8881('0x2'));var timeout=require('connect-timeout');var express=require(_0x8881('0x3'));var router=express['Router']();var fs_extra=require(_0x8881('0x4'));var auth=require(_0x8881('0x5'));var interaction=require(_0x8881('0x6'));var config=require(_0x8881('0x7'));var controller=require(_0x8881('0x8'));router[_0x8881('0x9')]('/',auth[_0x8881('0xa')](),controller['index']);router[_0x8881('0x9')]('/:id',auth[_0x8881('0xa')](),controller[_0x8881('0xb')]);router[_0x8881('0xc')]('/',auth[_0x8881('0xa')](),controller[_0x8881('0xd')]);router[_0x8881('0xe')](_0x8881('0xf'),auth[_0x8881('0xa')](),controller[_0x8881('0x10')]);router[_0x8881('0x11')](_0x8881('0xf'),auth[_0x8881('0xa')](),controller['destroy']);module[_0x8881('0x12')]=router; \ No newline at end of file +var _0x649e=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','path','express','Router'];(function(_0x36bcb5,_0x13f5ff){var _0x46d0e6=function(_0x5e79ef){while(--_0x5e79ef){_0x36bcb5['push'](_0x36bcb5['shift']());}};_0x46d0e6(++_0x13f5ff);}(_0x649e,0x1f3));var _0xe649=function(_0x52a782,_0x2e1988){_0x52a782=_0x52a782-0x0;var _0xab1d0b=_0x649e[_0x52a782];return _0xab1d0b;};'use strict';var multer=require(_0xe649('0x0'));var util=require(_0xe649('0x1'));var path=require(_0xe649('0x2'));var timeout=require('connect-timeout');var express=require(_0xe649('0x3'));var router=express[_0xe649('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xe649('0x5'));var config=require(_0xe649('0x6'));var controller=require('./intSalesforceField.controller');router[_0xe649('0x7')]('/',auth[_0xe649('0x8')](),controller[_0xe649('0x9')]);router[_0xe649('0x7')]('/:id',auth[_0xe649('0x8')](),controller[_0xe649('0xa')]);router[_0xe649('0xb')]('/',auth[_0xe649('0x8')](),controller[_0xe649('0xc')]);router[_0xe649('0xd')](_0xe649('0xe'),auth['isAuthenticated'](),controller['update']);router[_0xe649('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xe649('0x10')]);module[_0xe649('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index bdac62f..0e3fb22 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 _0x832a=['ENUM','string','customVariable','STRING','variable','sequelize','exports'];(function(_0x17a057,_0x51ef19){var _0x5b34d2=function(_0x3f69f0){while(--_0x3f69f0){_0x17a057['push'](_0x17a057['shift']());}};_0x5b34d2(++_0x51ef19);}(_0x832a,0x1c5));var _0xa832=function(_0x5c6994,_0x19ad9a){_0x5c6994=_0x5c6994-0x0;var _0x1d5c84=_0x832a[_0x5c6994];return _0x1d5c84;};'use strict';var Sequelize=require(_0xa832('0x0'));module[_0xa832('0x1')]={'type':{'type':Sequelize[_0xa832('0x2')](_0xa832('0x3'),'variable',_0xa832('0x4'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xa832('0x5')]},'key':{'type':Sequelize[_0xa832('0x5')]},'keyType':{'type':Sequelize['ENUM'](_0xa832('0x3'),_0xa832('0x6'),_0xa832('0x4'))},'keyContent':{'type':Sequelize[_0xa832('0x5')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0xa832('0x5')]}}; \ No newline at end of file +var _0x20ed=['variable','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING'];(function(_0x3e25ba,_0x4d5399){var _0x393fb8=function(_0x4fc023){while(--_0x4fc023){_0x3e25ba['push'](_0x3e25ba['shift']());}};_0x393fb8(++_0x4d5399);}(_0x20ed,0xf4));var _0xd20e=function(_0x342700,_0x569f75){_0x342700=_0x342700-0x0;var _0x53406f=_0x20ed[_0x342700];return _0x53406f;};'use strict';var Sequelize=require(_0xd20e('0x0'));module[_0xd20e('0x1')]={'type':{'type':Sequelize[_0xd20e('0x2')](_0xd20e('0x3'),'variable',_0xd20e('0x4'),_0xd20e('0x5'),_0xd20e('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0xd20e('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xd20e('0x2')](_0xd20e('0x3'),_0xd20e('0x8'),_0xd20e('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd20e('0x7')]},'variableName':{'type':Sequelize[_0xd20e('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 39b7ae1..8708884 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 _0x0875=['sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map','SalesforceField','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','options','includeAll','findAll','params','keys','include','find','create','body','catch','eml-format','rimraf','bluebird','mustache','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/utils','../../config/environment','../../mysqldb'];(function(_0x4b076f,_0x2dee19){var _0xae69a=function(_0x55eb99){while(--_0x55eb99){_0x4b076f['push'](_0x4b076f['shift']());}};_0xae69a(++_0x2dee19);}(_0x0875,0x192));var _0x5087=function(_0x28a048,_0x5eca74){_0x28a048=_0x28a048-0x0;var _0x4cc1de=_0x0875[_0x28a048];return _0x4cc1de;};'use strict';var emlformat=require(_0x5087('0x0'));var rimraf=require(_0x5087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5087('0x2'));var Mustache=require(_0x5087('0x3'));var util=require('util');var path=require(_0x5087('0x4'));var sox=require(_0x5087('0x5'));var csv=require(_0x5087('0x6'));var ejs=require(_0x5087('0x7'));var fs=require('fs');var fs_extra=require(_0x5087('0x8'));var _=require(_0x5087('0x9'));var squel=require(_0x5087('0xa'));var crypto=require('crypto');var jsforce=require(_0x5087('0xb'));var deskjs=require(_0x5087('0xc'));var toCsv=require(_0x5087('0x6'));var querystring=require(_0x5087('0xd'));var Papa=require(_0x5087('0xe'));var Redis=require(_0x5087('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5087('0x10'));var as=require(_0x5087('0x11'));var hardwareService=require(_0x5087('0x12'));var logger=require(_0x5087('0x13'))(_0x5087('0x14'));var utils=require(_0x5087('0x15'));var config=require(_0x5087('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5087('0x17'))['db'];function respondWithStatusCode(_0x41be95,_0x45fd5c){_0x45fd5c=_0x45fd5c||0xcc;return function(_0xad8cac){if(_0xad8cac){return _0x41be95[_0x5087('0x18')](_0x45fd5c);}return _0x41be95[_0x5087('0x19')](_0x45fd5c)[_0x5087('0x1a')]();};}function respondWithResult(_0x28876a,_0x18d81d){_0x18d81d=_0x18d81d||0xc8;return function(_0x3d65dc){if(_0x3d65dc){return _0x28876a[_0x5087('0x19')](_0x18d81d)[_0x5087('0x1b')](_0x3d65dc);}};}function respondWithFilteredResult(_0xdbbb8e,_0x22dac6){return function(_0x2d653a){if(_0x2d653a){var _0x2b9cef=typeof _0x22dac6[_0x5087('0x1c')]===_0x5087('0x1d')&&typeof _0x22dac6[_0x5087('0x1e')]==='undefined';var _0x10403a=_0x2d653a['count'];var _0x4eea19=_0x2b9cef?0x0:_0x22dac6['offset'];var _0x55534b=_0x2b9cef?_0x2d653a[_0x5087('0x1f')]:_0x22dac6['offset']+_0x22dac6[_0x5087('0x1e')];var _0x4d1bb8;if(_0x55534b>=_0x10403a){_0x55534b=_0x10403a;_0x4d1bb8=0xc8;}else{_0x4d1bb8=0xce;}_0xdbbb8e[_0x5087('0x19')](_0x4d1bb8);return _0xdbbb8e[_0x5087('0x20')](_0x5087('0x21'),_0x4eea19+'-'+_0x55534b+'/'+_0x10403a)[_0x5087('0x1b')](_0x2d653a);}return null;};}function patchUpdates(_0x9e7b7b){return function(_0x13a0d8){try{jsonpatch['apply'](_0x13a0d8,_0x9e7b7b,!![]);}catch(_0x2859de){return BPromise[_0x5087('0x22')](_0x2859de);}return _0x13a0d8[_0x5087('0x23')]();};}function saveUpdates(_0xc101a1,_0x297c94){return function(_0x14bf14){if(_0x14bf14){return _0x14bf14[_0x5087('0x24')](_0xc101a1)[_0x5087('0x25')](function(_0xcbaa43){return _0xcbaa43;});}return null;};}function removeEntity(_0x4eac3b,_0x409ad6){return function(_0x1c185c){if(_0x1c185c){return _0x1c185c[_0x5087('0x26')]()[_0x5087('0x25')](function(){_0x4eac3b[_0x5087('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c0743,_0x5d55e9){return function(_0x353208){if(!_0x353208){_0x5c0743[_0x5087('0x18')](0x194);}return _0x353208;};}function handleError(_0x32bbf6,_0x3604f9){_0x3604f9=_0x3604f9||0x1f4;return function(_0x882def){logger[_0x5087('0x27')](_0x882def[_0x5087('0x28')]);if(_0x882def[_0x5087('0x29')]){delete _0x882def[_0x5087('0x29')];}_0x32bbf6[_0x5087('0x19')](_0x3604f9)['send'](_0x882def);};}exports[_0x5087('0x2a')]=function(_0x2afe13,_0x23240a){var _0x588106={},_0x56d570={},_0x4288fd={'count':0x0,'rows':[]};var _0x4e502f=_[_0x5087('0x2b')](db[_0x5087('0x2c')][_0x5087('0x2d')],function(_0x467cde){return{'name':_0x467cde[_0x5087('0x2e')],'type':_0x467cde['type'][_0x5087('0x2f')]};});_0x56d570[_0x5087('0x30')]=_[_0x5087('0x2b')](_0x4e502f,_0x5087('0x29'));_0x56d570[_0x5087('0x31')]=_['keys'](_0x2afe13['query']);_0x56d570[_0x5087('0x32')]=_[_0x5087('0x33')](_0x56d570[_0x5087('0x30')],_0x56d570[_0x5087('0x31')]);_0x588106['attributes']=_[_0x5087('0x33')](_0x56d570[_0x5087('0x30')],qs['fields'](_0x2afe13[_0x5087('0x31')][_0x5087('0x34')]));_0x588106['attributes']=_0x588106[_0x5087('0x35')][_0x5087('0x36')]?_0x588106['attributes']:_0x56d570['model'];if(!_0x2afe13['query'][_0x5087('0x37')](_0x5087('0x38'))){_0x588106[_0x5087('0x1e')]=qs[_0x5087('0x1e')](_0x2afe13[_0x5087('0x31')][_0x5087('0x1e')]);_0x588106[_0x5087('0x1c')]=qs[_0x5087('0x1c')](_0x2afe13[_0x5087('0x31')][_0x5087('0x1c')]);}_0x588106['order']=qs[_0x5087('0x39')](_0x2afe13[_0x5087('0x31')][_0x5087('0x39')]);_0x588106[_0x5087('0x3a')]=qs[_0x5087('0x32')](_['pick'](_0x2afe13['query'],_0x56d570[_0x5087('0x32')]),_0x4e502f);if(_0x2afe13[_0x5087('0x31')][_0x5087('0x3b')]){_0x588106[_0x5087('0x3a')]=_[_0x5087('0x3c')](_0x588106[_0x5087('0x3a')],{'$or':_[_0x5087('0x2b')](_0x4e502f,function(_0x25f73c){if(_0x25f73c['type']!=='VIRTUAL'){var _0x2203cc={};_0x2203cc[_0x25f73c[_0x5087('0x29')]]={'$like':'%'+_0x2afe13[_0x5087('0x31')][_0x5087('0x3b')]+'%'};return _0x2203cc;}})});}_0x588106=_[_0x5087('0x3c')]({},_0x588106,_0x2afe13[_0x5087('0x3d')]);var _0x276c6a={'where':_0x588106[_0x5087('0x3a')]};return db[_0x5087('0x2c')][_0x5087('0x1f')](_0x276c6a)[_0x5087('0x25')](function(_0x466a24){_0x4288fd['count']=_0x466a24;if(_0x2afe13[_0x5087('0x31')][_0x5087('0x3e')]){_0x588106['include']=[{'all':!![]}];}return db[_0x5087('0x2c')][_0x5087('0x3f')](_0x588106);})['then'](function(_0x2cbda3){_0x4288fd['rows']=_0x2cbda3;return _0x4288fd;})[_0x5087('0x25')](respondWithFilteredResult(_0x23240a,_0x588106))['catch'](handleError(_0x23240a,null));};exports['show']=function(_0x5c591d,_0x3ff1cc){var _0x271fd6={'raw':!![],'where':{'id':_0x5c591d[_0x5087('0x40')]['id']}},_0x398c6a={};_0x398c6a[_0x5087('0x30')]=_[_0x5087('0x41')](db[_0x5087('0x2c')][_0x5087('0x2d')]);_0x398c6a[_0x5087('0x31')]=_['keys'](_0x5c591d['query']);_0x398c6a[_0x5087('0x32')]=_[_0x5087('0x33')](_0x398c6a['model'],_0x398c6a[_0x5087('0x31')]);_0x271fd6[_0x5087('0x35')]=_['intersection'](_0x398c6a['model'],qs[_0x5087('0x34')](_0x5c591d['query'][_0x5087('0x34')]));_0x271fd6[_0x5087('0x35')]=_0x271fd6[_0x5087('0x35')][_0x5087('0x36')]?_0x271fd6['attributes']:_0x398c6a[_0x5087('0x30')];if(_0x5c591d[_0x5087('0x31')][_0x5087('0x3e')]){_0x271fd6[_0x5087('0x42')]=[{'all':!![]}];}_0x271fd6=_[_0x5087('0x3c')]({},_0x271fd6,_0x5c591d[_0x5087('0x3d')]);return db[_0x5087('0x2c')][_0x5087('0x43')](_0x271fd6)[_0x5087('0x25')](handleEntityNotFound(_0x3ff1cc,null))[_0x5087('0x25')](respondWithResult(_0x3ff1cc,null))['catch'](handleError(_0x3ff1cc,null));};exports['create']=function(_0x116269,_0x2d13bd){return db['SalesforceField'][_0x5087('0x44')](_0x116269[_0x5087('0x45')],{})[_0x5087('0x25')](respondWithResult(_0x2d13bd,0xc9))[_0x5087('0x46')](handleError(_0x2d13bd,null));};exports[_0x5087('0x24')]=function(_0x4a7d70,_0x40dda3){if(_0x4a7d70['body']['id']){delete _0x4a7d70['body']['id'];}return db['SalesforceField'][_0x5087('0x43')]({'where':{'id':_0x4a7d70[_0x5087('0x40')]['id']}})[_0x5087('0x25')](handleEntityNotFound(_0x40dda3,null))['then'](saveUpdates(_0x4a7d70[_0x5087('0x45')],null))[_0x5087('0x25')](respondWithResult(_0x40dda3,null))[_0x5087('0x46')](handleError(_0x40dda3,null));};exports[_0x5087('0x26')]=function(_0x11c8c8,_0x12a40f){return db[_0x5087('0x2c')][_0x5087('0x43')]({'where':{'id':_0x11c8c8[_0x5087('0x40')]['id']}})[_0x5087('0x25')](handleEntityNotFound(_0x12a40f,null))['then'](removeEntity(_0x12a40f,null))[_0x5087('0x46')](handleError(_0x12a40f,null));}; \ No newline at end of file +var _0x5dd2=['end','status','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','error','name','send','index','SalesforceField','rawAttributes','fieldName','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','show','params','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x348dff,_0x4f2c6c){var _0x5db9d9=function(_0x570bbe){while(--_0x570bbe){_0x348dff['push'](_0x348dff['shift']());}};_0x5db9d9(++_0x4f2c6c);}(_0x5dd2,0x118));var _0x25dd=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0x5dd2[_0x2064e5];return _0x21a233;};'use strict';var emlformat=require(_0x25dd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x25dd('0x1'));var jsonpatch=require(_0x25dd('0x2'));var rp=require(_0x25dd('0x3'));var moment=require(_0x25dd('0x4'));var BPromise=require(_0x25dd('0x5'));var Mustache=require(_0x25dd('0x6'));var util=require(_0x25dd('0x7'));var path=require(_0x25dd('0x8'));var sox=require('sox');var csv=require(_0x25dd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x25dd('0xa'));var _=require('lodash');var squel=require(_0x25dd('0xb'));var crypto=require(_0x25dd('0xc'));var jsforce=require(_0x25dd('0xd'));var deskjs=require(_0x25dd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x25dd('0xf'));var Papa=require(_0x25dd('0x10'));var Redis=require(_0x25dd('0x11'));var authService=require(_0x25dd('0x12'));var qs=require(_0x25dd('0x13'));var as=require(_0x25dd('0x14'));var hardwareService=require(_0x25dd('0x15'));var logger=require(_0x25dd('0x16'))(_0x25dd('0x17'));var utils=require('../../config/utils');var config=require(_0x25dd('0x18'));var licenseUtil=require(_0x25dd('0x19'));var db=require(_0x25dd('0x1a'))['db'];function respondWithStatusCode(_0x5a2355,_0x54b8d5){_0x54b8d5=_0x54b8d5||0xcc;return function(_0x3ffa13){if(_0x3ffa13){return _0x5a2355[_0x25dd('0x1b')](_0x54b8d5);}return _0x5a2355['status'](_0x54b8d5)[_0x25dd('0x1c')]();};}function respondWithResult(_0x216f2b,_0x2c8142){_0x2c8142=_0x2c8142||0xc8;return function(_0x1228ae){if(_0x1228ae){return _0x216f2b[_0x25dd('0x1d')](_0x2c8142)[_0x25dd('0x1e')](_0x1228ae);}};}function respondWithFilteredResult(_0x3c3a8e,_0x44c891){return function(_0x300601){if(_0x300601){var _0x2582d2=typeof _0x44c891[_0x25dd('0x1f')]==='undefined'&&typeof _0x44c891[_0x25dd('0x20')]===_0x25dd('0x21');var _0x47563e=_0x300601['count'];var _0x1604fd=_0x2582d2?0x0:_0x44c891[_0x25dd('0x1f')];var _0x39abec=_0x2582d2?_0x300601[_0x25dd('0x22')]:_0x44c891[_0x25dd('0x1f')]+_0x44c891[_0x25dd('0x20')];var _0x46e497;if(_0x39abec>=_0x47563e){_0x39abec=_0x47563e;_0x46e497=0xc8;}else{_0x46e497=0xce;}_0x3c3a8e[_0x25dd('0x1d')](_0x46e497);return _0x3c3a8e[_0x25dd('0x23')](_0x25dd('0x24'),_0x1604fd+'-'+_0x39abec+'/'+_0x47563e)[_0x25dd('0x1e')](_0x300601);}return null;};}function patchUpdates(_0x3f31a2){return function(_0x2c8d1a){try{jsonpatch['apply'](_0x2c8d1a,_0x3f31a2,!![]);}catch(_0x1000f9){return BPromise['reject'](_0x1000f9);}return _0x2c8d1a[_0x25dd('0x25')]();};}function saveUpdates(_0x1df760,_0x28e47b){return function(_0x4edeaf){if(_0x4edeaf){return _0x4edeaf[_0x25dd('0x26')](_0x1df760)[_0x25dd('0x27')](function(_0x576110){return _0x576110;});}return null;};}function removeEntity(_0xe8f970,_0x516fee){return function(_0x39f3f8){if(_0x39f3f8){return _0x39f3f8[_0x25dd('0x28')]()[_0x25dd('0x27')](function(){_0xe8f970[_0x25dd('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e74a9,_0x221135){return function(_0x4b2c5b){if(!_0x4b2c5b){_0x4e74a9[_0x25dd('0x1b')](0x194);}return _0x4b2c5b;};}function handleError(_0x4bacf9,_0x53cba2){_0x53cba2=_0x53cba2||0x1f4;return function(_0x3f867a){logger[_0x25dd('0x29')](_0x3f867a['stack']);if(_0x3f867a['name']){delete _0x3f867a[_0x25dd('0x2a')];}_0x4bacf9[_0x25dd('0x1d')](_0x53cba2)[_0x25dd('0x2b')](_0x3f867a);};}exports[_0x25dd('0x2c')]=function(_0x1fe82f,_0x4ba8a8){var _0x330e31={},_0x5c1562={},_0x10ad87={'count':0x0,'rows':[]};var _0x455068=_['map'](db[_0x25dd('0x2d')][_0x25dd('0x2e')],function(_0x156ee4){return{'name':_0x156ee4[_0x25dd('0x2f')],'type':_0x156ee4[_0x25dd('0x30')]['key']};});_0x5c1562['model']=_[_0x25dd('0x31')](_0x455068,_0x25dd('0x2a'));_0x5c1562[_0x25dd('0x32')]=_[_0x25dd('0x33')](_0x1fe82f[_0x25dd('0x32')]);_0x5c1562[_0x25dd('0x34')]=_[_0x25dd('0x35')](_0x5c1562[_0x25dd('0x36')],_0x5c1562[_0x25dd('0x32')]);_0x330e31[_0x25dd('0x37')]=_[_0x25dd('0x35')](_0x5c1562[_0x25dd('0x36')],qs['fields'](_0x1fe82f[_0x25dd('0x32')][_0x25dd('0x38')]));_0x330e31[_0x25dd('0x37')]=_0x330e31['attributes'][_0x25dd('0x39')]?_0x330e31[_0x25dd('0x37')]:_0x5c1562[_0x25dd('0x36')];if(!_0x1fe82f[_0x25dd('0x32')][_0x25dd('0x3a')](_0x25dd('0x3b'))){_0x330e31['limit']=qs[_0x25dd('0x20')](_0x1fe82f[_0x25dd('0x32')][_0x25dd('0x20')]);_0x330e31[_0x25dd('0x1f')]=qs[_0x25dd('0x1f')](_0x1fe82f[_0x25dd('0x32')][_0x25dd('0x1f')]);}_0x330e31[_0x25dd('0x3c')]=qs['sort'](_0x1fe82f['query'][_0x25dd('0x3d')]);_0x330e31[_0x25dd('0x3e')]=qs[_0x25dd('0x34')](_[_0x25dd('0x3f')](_0x1fe82f['query'],_0x5c1562['filters']),_0x455068);if(_0x1fe82f[_0x25dd('0x32')][_0x25dd('0x40')]){_0x330e31[_0x25dd('0x3e')]=_['merge'](_0x330e31[_0x25dd('0x3e')],{'$or':_[_0x25dd('0x31')](_0x455068,function(_0x4831d3){if(_0x4831d3[_0x25dd('0x30')]!==_0x25dd('0x41')){var _0x47f925={};_0x47f925[_0x4831d3['name']]={'$like':'%'+_0x1fe82f[_0x25dd('0x32')][_0x25dd('0x40')]+'%'};return _0x47f925;}})});}_0x330e31=_[_0x25dd('0x42')]({},_0x330e31,_0x1fe82f[_0x25dd('0x43')]);var _0x4b3048={'where':_0x330e31[_0x25dd('0x3e')]};return db[_0x25dd('0x2d')][_0x25dd('0x22')](_0x4b3048)['then'](function(_0x2a7f65){_0x10ad87[_0x25dd('0x22')]=_0x2a7f65;if(_0x1fe82f['query']['includeAll']){_0x330e31[_0x25dd('0x44')]=[{'all':!![]}];}return db[_0x25dd('0x2d')]['findAll'](_0x330e31);})[_0x25dd('0x27')](function(_0x422fe6){_0x10ad87[_0x25dd('0x45')]=_0x422fe6;return _0x10ad87;})[_0x25dd('0x27')](respondWithFilteredResult(_0x4ba8a8,_0x330e31))[_0x25dd('0x46')](handleError(_0x4ba8a8,null));};exports[_0x25dd('0x47')]=function(_0x31ff03,_0x49d4b4){var _0x1d1fb3={'raw':!![],'where':{'id':_0x31ff03[_0x25dd('0x48')]['id']}},_0x2f822c={};_0x2f822c['model']=_['keys'](db[_0x25dd('0x2d')][_0x25dd('0x2e')]);_0x2f822c[_0x25dd('0x32')]=_[_0x25dd('0x33')](_0x31ff03[_0x25dd('0x32')]);_0x2f822c['filters']=_[_0x25dd('0x35')](_0x2f822c[_0x25dd('0x36')],_0x2f822c[_0x25dd('0x32')]);_0x1d1fb3[_0x25dd('0x37')]=_[_0x25dd('0x35')](_0x2f822c['model'],qs[_0x25dd('0x38')](_0x31ff03['query'][_0x25dd('0x38')]));_0x1d1fb3[_0x25dd('0x37')]=_0x1d1fb3[_0x25dd('0x37')]['length']?_0x1d1fb3[_0x25dd('0x37')]:_0x2f822c[_0x25dd('0x36')];if(_0x31ff03['query'][_0x25dd('0x49')]){_0x1d1fb3[_0x25dd('0x44')]=[{'all':!![]}];}_0x1d1fb3=_[_0x25dd('0x42')]({},_0x1d1fb3,_0x31ff03[_0x25dd('0x43')]);return db[_0x25dd('0x2d')][_0x25dd('0x4a')](_0x1d1fb3)[_0x25dd('0x27')](handleEntityNotFound(_0x49d4b4,null))[_0x25dd('0x27')](respondWithResult(_0x49d4b4,null))[_0x25dd('0x46')](handleError(_0x49d4b4,null));};exports['create']=function(_0x3f9ae9,_0x598802){return db['SalesforceField'][_0x25dd('0x4b')](_0x3f9ae9[_0x25dd('0x4c')],{})['then'](respondWithResult(_0x598802,0xc9))['catch'](handleError(_0x598802,null));};exports['update']=function(_0x722ad5,_0xb252f){if(_0x722ad5[_0x25dd('0x4c')]['id']){delete _0x722ad5['body']['id'];}return db['SalesforceField']['find']({'where':{'id':_0x722ad5[_0x25dd('0x48')]['id']}})[_0x25dd('0x27')](handleEntityNotFound(_0xb252f,null))['then'](saveUpdates(_0x722ad5['body'],null))['then'](respondWithResult(_0xb252f,null))[_0x25dd('0x46')](handleError(_0xb252f,null));};exports[_0x25dd('0x28')]=function(_0x15d215,_0x29124d){return db[_0x25dd('0x2d')][_0x25dd('0x4a')]({'where':{'id':_0x15d215[_0x25dd('0x48')]['id']}})[_0x25dd('0x27')](handleEntityNotFound(_0x29124d,null))[_0x25dd('0x27')](removeEntity(_0x29124d,null))[_0x25dd('0x46')](handleError(_0x29124d,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index bdac0f7..a6d0d6d 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 _0x7405=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','util'];(function(_0x5116c3,_0x52b21c){var _0x832dfe=function(_0x1cbe1a){while(--_0x1cbe1a){_0x5116c3['push'](_0x5116c3['shift']());}};_0x832dfe(++_0x52b21c);}(_0x7405,0xbf));var _0x5740=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x7405[_0x2dadb9];return _0x2f0097;};'use strict';var _=require('lodash');var util=require(_0x5740('0x0'));var logger=require(_0x5740('0x1'))(_0x5740('0x2'));var moment=require(_0x5740('0x3'));var BPromise=require(_0x5740('0x4'));var rp=require(_0x5740('0x5'));var fs=require('fs');var path=require(_0x5740('0x6'));var rimraf=require(_0x5740('0x7'));var config=require(_0x5740('0x8'));var attributes=require(_0x5740('0x9'));module[_0x5740('0xa')]=function(_0x5f099d,_0x398301){return _0x5f099d[_0x5740('0xb')](_0x5740('0xc'),attributes,{'tableName':_0x5740('0xd'),'paranoid':![],'indexes':[{'name':_0x5740('0xe'),'fields':[_0x5740('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd614=['exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd614,0xd9));var _0x4d61=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0xd614[_0x2d7f0e];return _0x110b07;};'use strict';var _=require(_0x4d61('0x0'));var util=require('util');var logger=require(_0x4d61('0x1'))('api');var moment=require(_0x4d61('0x2'));var BPromise=require(_0x4d61('0x3'));var rp=require(_0x4d61('0x4'));var fs=require('fs');var path=require(_0x4d61('0x5'));var rimraf=require(_0x4d61('0x6'));var config=require(_0x4d61('0x7'));var attributes=require('./intSalesforceField.attributes');module[_0x4d61('0x8')]=function(_0x413da7,_0x163300){return _0x413da7[_0x4d61('0x9')](_0x4d61('0xa'),attributes,{'tableName':_0x4d61('0xb'),'paranoid':![],'indexes':[{'name':_0x4d61('0xc'),'fields':[_0x4d61('0xd'),_0x4d61('0xe')],'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 80c1d6e..30b8768 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 _0x627b=['info','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x3a321d,_0x4e66d5){var _0x27aeb5=function(_0x51688d){while(--_0x51688d){_0x3a321d['push'](_0x3a321d['shift']());}};_0x27aeb5(++_0x4e66d5);}(_0x627b,0x13e));var _0xb627=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0x627b[_0x8de54f];return _0x14cba4;};'use strict';var _=require(_0xb627('0x0'));var util=require(_0xb627('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb627('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb627('0x3'))['db'];var utils=require(_0xb627('0x4'));var logger=require(_0xb627('0x5'))('rpc');var config=require(_0xb627('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb627('0x7')][_0xb627('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x10cc74,_0x4be3d9,_0x23cf91){return new BPromise(function(_0x10dda6,_0x522359){return client[_0xb627('0x9')](_0x10cc74,_0x23cf91)[_0xb627('0xa')](function(_0xf96c62){logger['info'](_0xb627('0xb'),_0x4be3d9,_0xb627('0xc'));logger[_0xb627('0xd')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4be3d9,_0xb627('0xc'),JSON[_0xb627('0xe')](_0xf96c62));if(_0xf96c62[_0xb627('0xf')]){if(_0xf96c62[_0xb627('0xf')][_0xb627('0x10')]===0x1f4){logger[_0xb627('0xf')](_0xb627('0xb'),_0x4be3d9,_0xf96c62[_0xb627('0xf')]['message']);return _0x522359(_0xf96c62['error']['message']);}logger['error'](_0xb627('0xb'),_0x4be3d9,_0xf96c62[_0xb627('0xf')][_0xb627('0x11')]);return _0x10dda6(_0xf96c62[_0xb627('0xf')][_0xb627('0x11')]);}else{logger[_0xb627('0x12')](_0xb627('0xb'),_0x4be3d9,_0xb627('0xc'));_0x10dda6(_0xf96c62[_0xb627('0x13')][_0xb627('0x11')]);}})[_0xb627('0x14')](function(_0x463aaa){logger['error'](_0xb627('0xb'),_0x4be3d9,_0x463aaa);_0x522359(_0x463aaa);});});} \ No newline at end of file +var _0x268f=['request\x20sent','error','code','message','info','result','lodash','util','moment','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s'];(function(_0x5346d1,_0x2e0612){var _0x4adbc1=function(_0x3d3754){while(--_0x3d3754){_0x5346d1['push'](_0x5346d1['shift']());}};_0x4adbc1(++_0x2e0612);}(_0x268f,0x149));var _0xf268=function(_0x287ff1,_0x1cb44a){_0x287ff1=_0x287ff1-0x0;var _0xb4dac6=_0x268f[_0x287ff1];return _0xb4dac6;};'use strict';var _=require(_0xf268('0x0'));var util=require(_0xf268('0x1'));var moment=require(_0xf268('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf268('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf268('0x4'));var logger=require('../../config/logger')(_0xf268('0x5'));var config=require(_0xf268('0x6'));var jayson=require(_0xf268('0x7'));var client=jayson[_0xf268('0x8')][_0xf268('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5a6a6a,_0x1921bf,_0x216a8e){return new BPromise(function(_0x324c3f,_0x5be454){return client['request'](_0x5a6a6a,_0x216a8e)['then'](function(_0x8e30f6){logger['info'](_0xf268('0xa'),_0x1921bf,'request\x20sent');logger[_0xf268('0xb')](_0xf268('0xc'),_0x1921bf,_0xf268('0xd'),JSON['stringify'](_0x8e30f6));if(_0x8e30f6[_0xf268('0xe')]){if(_0x8e30f6[_0xf268('0xe')][_0xf268('0xf')]===0x1f4){logger['error']('SalesforceField,\x20%s,\x20%s',_0x1921bf,_0x8e30f6['error'][_0xf268('0x10')]);return _0x5be454(_0x8e30f6[_0xf268('0xe')][_0xf268('0x10')]);}logger[_0xf268('0xe')](_0xf268('0xa'),_0x1921bf,_0x8e30f6['error']['message']);return _0x324c3f(_0x8e30f6[_0xf268('0xe')][_0xf268('0x10')]);}else{logger[_0xf268('0x11')](_0xf268('0xa'),_0x1921bf,_0xf268('0xd'));_0x324c3f(_0x8e30f6[_0xf268('0x12')][_0xf268('0x10')]);}})['catch'](function(_0x34cd5e){logger['error']('SalesforceField,\x20%s,\x20%s',_0x1921bf,_0x34cd5e);_0x5be454(_0x34cd5e);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 285d047..44d9169 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 _0x2043=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get'];(function(_0x1790ab,_0x59eff1){var _0x556669=function(_0x4c18a8){while(--_0x4c18a8){_0x1790ab['push'](_0x1790ab['shift']());}};_0x556669(++_0x59eff1);}(_0x2043,0x122));var _0x3204=function(_0x3a98f0,_0x185d41){_0x3a98f0=_0x3a98f0-0x0;var _0x296191=_0x2043[_0x3a98f0];return _0x296191;};'use strict';var multer=require(_0x3204('0x0'));var util=require(_0x3204('0x1'));var path=require(_0x3204('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x3204('0x3')]();var fs_extra=require(_0x3204('0x4'));var auth=require(_0x3204('0x5'));var interaction=require(_0x3204('0x6'));var config=require(_0x3204('0x7'));var controller=require(_0x3204('0x8'));router[_0x3204('0x9')]('/',auth[_0x3204('0xa')](),controller[_0x3204('0xb')]);router[_0x3204('0x9')](_0x3204('0xc'),auth['isAuthenticated'](),controller[_0x3204('0xd')]);router['get'](_0x3204('0xe'),auth[_0x3204('0xa')](),controller[_0x3204('0xf')]);router[_0x3204('0x9')](_0x3204('0x10'),auth[_0x3204('0xa')](),controller[_0x3204('0x11')]);router[_0x3204('0x12')]('/',auth[_0x3204('0xa')](),controller[_0x3204('0x13')]);router[_0x3204('0x12')]('/:id/configurations',auth[_0x3204('0xa')](),controller[_0x3204('0x14')]);router[_0x3204('0x15')]('/:id',auth[_0x3204('0xa')](),controller[_0x3204('0x16')]);router[_0x3204('0x17')](_0x3204('0xc'),auth[_0x3204('0xa')](),controller['destroy']);module[_0x3204('0x18')]=router; \ No newline at end of file +var _0x8f37=['exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','/:id','update','delete','destroy'];(function(_0x337f7e,_0x35298d){var _0x3d0c0e=function(_0x405964){while(--_0x405964){_0x337f7e['push'](_0x337f7e['shift']());}};_0x3d0c0e(++_0x35298d);}(_0x8f37,0x190));var _0x78f3=function(_0x2f8ffe,_0x3fa93f){_0x2f8ffe=_0x2f8ffe-0x0;var _0x3d2a3f=_0x8f37[_0x2f8ffe];return _0x3d2a3f;};'use strict';var multer=require(_0x78f3('0x0'));var util=require(_0x78f3('0x1'));var path=require(_0x78f3('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x78f3('0x3')]();var fs_extra=require(_0x78f3('0x4'));var auth=require(_0x78f3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x78f3('0x6'));var controller=require('./intServicenowAccount.controller');router[_0x78f3('0x7')]('/',auth['isAuthenticated'](),controller[_0x78f3('0x8')]);router[_0x78f3('0x7')]('/:id',auth[_0x78f3('0x9')](),controller['show']);router[_0x78f3('0x7')](_0x78f3('0xa'),auth['isAuthenticated'](),controller[_0x78f3('0xb')]);router[_0x78f3('0x7')](_0x78f3('0xc'),auth[_0x78f3('0x9')](),controller[_0x78f3('0xd')]);router['post']('/',auth[_0x78f3('0x9')](),controller[_0x78f3('0xe')]);router['post'](_0x78f3('0xa'),auth[_0x78f3('0x9')](),controller[_0x78f3('0xf')]);router['put'](_0x78f3('0x10'),auth[_0x78f3('0x9')](),controller[_0x78f3('0x11')]);router[_0x78f3('0x12')](_0x78f3('0x10'),auth[_0x78f3('0x9')](),controller[_0x78f3('0x13')]);module[_0x78f3('0x14')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index b400b5f..29eddf0 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 _0xfe59=['exports','STRING','username','remoteUri'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe59,0x144));var _0x9fe5=function(_0x451f14,_0x4cb3d6){_0x451f14=_0x451f14-0x0;var _0x510cd4=_0xfe59[_0x451f14];return _0x510cd4;};'use strict';var Sequelize=require('sequelize');module[_0x9fe5('0x0')]={'name':{'type':Sequelize[_0x9fe5('0x1')]},'description':{'type':Sequelize[_0x9fe5('0x1')]},'username':{'type':Sequelize[_0x9fe5('0x1')],'unique':_0x9fe5('0x2')},'password':{'type':Sequelize[_0x9fe5('0x1')]},'email':{'type':Sequelize[_0x9fe5('0x1')]},'remoteUri':{'type':Sequelize[_0x9fe5('0x1')],'unique':_0x9fe5('0x3')},'serverUrl':{'type':Sequelize[_0x9fe5('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x1ef2=['remoteUri','sequelize','exports','STRING','username'];(function(_0x5b8f1a,_0x42a930){var _0xac26d6=function(_0x4eff39){while(--_0x4eff39){_0x5b8f1a['push'](_0x5b8f1a['shift']());}};_0xac26d6(++_0x42a930);}(_0x1ef2,0x123));var _0x21ef=function(_0x21b14f,_0x3ed9b9){_0x21b14f=_0x21b14f-0x0;var _0x4c0fd0=_0x1ef2[_0x21b14f];return _0x4c0fd0;};'use strict';var Sequelize=require(_0x21ef('0x0'));module[_0x21ef('0x1')]={'name':{'type':Sequelize[_0x21ef('0x2')]},'description':{'type':Sequelize[_0x21ef('0x2')]},'username':{'type':Sequelize[_0x21ef('0x2')],'unique':_0x21ef('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x21ef('0x2')]},'remoteUri':{'type':Sequelize[_0x21ef('0x2')],'unique':_0x21ef('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index e05e17a..f9bd6a7 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 _0x20e6=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','save','update','then','destroy','end','error','stack','name','send','index','rawAttributes','fieldName','map','keys','filters','intersection','attributes','model','fields','length','query','hasOwnProperty','order','sort','where','pick','filter','merge','ServicenowAccount','include','findAll','rows','catch','show','includeAll','options','find','create','body','params','getConfigurations','findOne','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ServicenowConfiguration','ServicenowField','hold_reason','subcategory','close_code','notify','severity','category','parent','caused_by','watch_list','sys_updated_on','child_incidents','approval_history','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','calendar_stc','closed_at','active','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','resolved_at','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','description','calendar_duration','close_notes','closed_by','follow_up','parent_incident','contact_type','reopened_by','urgency','problem_id','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','escalation','upon_approval','correlation_id','location','username','password','email','serverUrl','slice','substring','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','log','push','all','concat','ServiceNow\x20error:\x20','test','statusCode','Wrong\x20credentials','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','zip-dir'];(function(_0x3c504b,_0x437693){var _0x2e5354=function(_0x456709){while(--_0x456709){_0x3c504b['push'](_0x3c504b['shift']());}};_0x2e5354(++_0x437693);}(_0x20e6,0x169));var _0x620e=function(_0x334bf4,_0x530067){_0x334bf4=_0x334bf4-0x0;var _0x37de01=_0x20e6[_0x334bf4];return _0x37de01;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x620e('0x0'));var jsonpatch=require(_0x620e('0x1'));var rp=require(_0x620e('0x2'));var moment=require(_0x620e('0x3'));var BPromise=require(_0x620e('0x4'));var Mustache=require(_0x620e('0x5'));var util=require(_0x620e('0x6'));var path=require(_0x620e('0x7'));var sox=require(_0x620e('0x8'));var csv=require('to-csv');var ejs=require(_0x620e('0x9'));var fs=require('fs');var fs_extra=require(_0x620e('0xa'));var _=require(_0x620e('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x620e('0xc'));var deskjs=require(_0x620e('0xd'));var toCsv=require(_0x620e('0xe'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x620e('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x620e('0x10'));var hardwareService=require(_0x620e('0x11'));var logger=require(_0x620e('0x12'))(_0x620e('0x13'));var utils=require(_0x620e('0x14'));var config=require(_0x620e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x620e('0x16'))['db'];var integrations=require(_0x620e('0x17'));function respondWithStatusCode(_0x2edf15,_0x55d1ac){_0x55d1ac=_0x55d1ac||0xcc;return function(_0x18e6d8){if(_0x18e6d8){return _0x2edf15[_0x620e('0x18')](_0x55d1ac);}return _0x2edf15[_0x620e('0x19')](_0x55d1ac)['end']();};}function respondWithResult(_0x1bb783,_0x3c09c6){_0x3c09c6=_0x3c09c6||0xc8;return function(_0x22c759){if(_0x22c759){return _0x1bb783['status'](_0x3c09c6)['json'](_0x22c759);}};}function respondWithFilteredResult(_0x1dffdf,_0x1ddcb1){return function(_0x14d5bc){if(_0x14d5bc){var _0x456a4d=typeof _0x1ddcb1[_0x620e('0x1a')]===_0x620e('0x1b')&&typeof _0x1ddcb1[_0x620e('0x1c')]===_0x620e('0x1b');var _0x4bc892=_0x14d5bc[_0x620e('0x1d')];var _0xdbfa89=_0x456a4d?0x0:_0x1ddcb1[_0x620e('0x1a')];var _0x5d5e0b=_0x456a4d?_0x14d5bc[_0x620e('0x1d')]:_0x1ddcb1['offset']+_0x1ddcb1[_0x620e('0x1c')];var _0xc4c5f9;if(_0x5d5e0b>=_0x4bc892){_0x5d5e0b=_0x4bc892;_0xc4c5f9=0xc8;}else{_0xc4c5f9=0xce;}_0x1dffdf[_0x620e('0x19')](_0xc4c5f9);return _0x1dffdf[_0x620e('0x1e')](_0x620e('0x1f'),_0xdbfa89+'-'+_0x5d5e0b+'/'+_0x4bc892)[_0x620e('0x20')](_0x14d5bc);}return null;};}function patchUpdates(_0x313e0a){return function(_0x5e1693){try{jsonpatch['apply'](_0x5e1693,_0x313e0a,!![]);}catch(_0x5bcbfd){return BPromise['reject'](_0x5bcbfd);}return _0x5e1693[_0x620e('0x21')]();};}function saveUpdates(_0x30c4cc,_0xc7bc9b){return function(_0x2ed58e){if(_0x2ed58e){return _0x2ed58e[_0x620e('0x22')](_0x30c4cc)[_0x620e('0x23')](function(_0x10465a){return _0x10465a;});}return null;};}function removeEntity(_0x521c46,_0x3eafaa){return function(_0x1b0b35){if(_0x1b0b35){return _0x1b0b35[_0x620e('0x24')]()[_0x620e('0x23')](function(){_0x521c46[_0x620e('0x19')](0xcc)[_0x620e('0x25')]();});}};}function handleEntityNotFound(_0x28223f,_0x5ebc88){return function(_0x18b044){if(!_0x18b044){_0x28223f[_0x620e('0x18')](0x194);}return _0x18b044;};}function handleError(_0x3efec7,_0x554fdc){_0x554fdc=_0x554fdc||0x1f4;return function(_0x4bafb2){logger[_0x620e('0x26')](_0x4bafb2[_0x620e('0x27')]);if(_0x4bafb2[_0x620e('0x28')]){delete _0x4bafb2[_0x620e('0x28')];}_0x3efec7[_0x620e('0x19')](_0x554fdc)[_0x620e('0x29')](_0x4bafb2);};}exports[_0x620e('0x2a')]=function(_0xae358f,_0x368e5a){var _0x361cdb={},_0x48ef98={},_0x30cf9d={'count':0x0,'rows':[]};var _0x46ae87=_['map'](db['ServicenowAccount'][_0x620e('0x2b')],function(_0x1fcfb5){return{'name':_0x1fcfb5[_0x620e('0x2c')],'type':_0x1fcfb5['type']['key']};});_0x48ef98['model']=_[_0x620e('0x2d')](_0x46ae87,_0x620e('0x28'));_0x48ef98['query']=_[_0x620e('0x2e')](_0xae358f['query']);_0x48ef98[_0x620e('0x2f')]=_[_0x620e('0x30')](_0x48ef98['model'],_0x48ef98['query']);_0x361cdb[_0x620e('0x31')]=_[_0x620e('0x30')](_0x48ef98[_0x620e('0x32')],qs['fields'](_0xae358f['query'][_0x620e('0x33')]));_0x361cdb['attributes']=_0x361cdb[_0x620e('0x31')][_0x620e('0x34')]?_0x361cdb['attributes']:_0x48ef98['model'];if(!_0xae358f[_0x620e('0x35')][_0x620e('0x36')]('nolimit')){_0x361cdb[_0x620e('0x1c')]=qs[_0x620e('0x1c')](_0xae358f[_0x620e('0x35')][_0x620e('0x1c')]);_0x361cdb[_0x620e('0x1a')]=qs['offset'](_0xae358f[_0x620e('0x35')][_0x620e('0x1a')]);}_0x361cdb[_0x620e('0x37')]=qs[_0x620e('0x38')](_0xae358f[_0x620e('0x35')]['sort']);_0x361cdb[_0x620e('0x39')]=qs[_0x620e('0x2f')](_[_0x620e('0x3a')](_0xae358f[_0x620e('0x35')],_0x48ef98[_0x620e('0x2f')]),_0x46ae87);if(_0xae358f[_0x620e('0x35')][_0x620e('0x3b')]){_0x361cdb[_0x620e('0x39')]=_['merge'](_0x361cdb[_0x620e('0x39')],{'$or':_[_0x620e('0x2d')](_0x46ae87,function(_0x3a5fbe){if(_0x3a5fbe['type']!=='VIRTUAL'){var _0x38a8f1={};_0x38a8f1[_0x3a5fbe[_0x620e('0x28')]]={'$like':'%'+_0xae358f['query']['filter']+'%'};return _0x38a8f1;}})});}_0x361cdb=_[_0x620e('0x3c')]({},_0x361cdb,_0xae358f['options']);var _0x2fc3f0={'where':_0x361cdb[_0x620e('0x39')]};return db[_0x620e('0x3d')][_0x620e('0x1d')](_0x2fc3f0)[_0x620e('0x23')](function(_0x3aae12){_0x30cf9d['count']=_0x3aae12;if(_0xae358f[_0x620e('0x35')]['includeAll']){_0x361cdb[_0x620e('0x3e')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x620e('0x3f')](_0x361cdb);})[_0x620e('0x23')](function(_0x3b8863){_0x30cf9d[_0x620e('0x40')]=_0x3b8863;return _0x30cf9d;})['then'](respondWithFilteredResult(_0x368e5a,_0x361cdb))[_0x620e('0x41')](handleError(_0x368e5a,null));};exports[_0x620e('0x42')]=function(_0x14dc30,_0x504c0b){var _0x2cc5fb={'raw':![],'where':{'id':_0x14dc30['params']['id']}},_0x4c361b={};_0x4c361b[_0x620e('0x32')]=_['keys'](db['ServicenowAccount'][_0x620e('0x2b')]);_0x4c361b[_0x620e('0x35')]=_[_0x620e('0x2e')](_0x14dc30[_0x620e('0x35')]);_0x4c361b[_0x620e('0x2f')]=_['intersection'](_0x4c361b[_0x620e('0x32')],_0x4c361b[_0x620e('0x35')]);_0x2cc5fb[_0x620e('0x31')]=_[_0x620e('0x30')](_0x4c361b['model'],qs[_0x620e('0x33')](_0x14dc30['query'][_0x620e('0x33')]));_0x2cc5fb[_0x620e('0x31')]=_0x2cc5fb[_0x620e('0x31')]['length']?_0x2cc5fb[_0x620e('0x31')]:_0x4c361b[_0x620e('0x32')];if(_0x14dc30[_0x620e('0x35')][_0x620e('0x43')]){_0x2cc5fb[_0x620e('0x3e')]=[{'all':!![]}];}_0x2cc5fb=_[_0x620e('0x3c')]({},_0x2cc5fb,_0x14dc30[_0x620e('0x44')]);return db[_0x620e('0x3d')][_0x620e('0x45')](_0x2cc5fb)[_0x620e('0x23')](handleEntityNotFound(_0x504c0b,null))[_0x620e('0x23')](respondWithResult(_0x504c0b,null))[_0x620e('0x41')](handleError(_0x504c0b,null));};exports[_0x620e('0x46')]=function(_0x393e14,_0x350f37){return db[_0x620e('0x3d')][_0x620e('0x46')](_0x393e14['body'],{})[_0x620e('0x23')](respondWithResult(_0x350f37,0xc9))['catch'](handleError(_0x350f37,null));};exports['update']=function(_0x51aac8,_0x2bbce7){if(_0x51aac8[_0x620e('0x47')]['id']){delete _0x51aac8['body']['id'];}return db[_0x620e('0x3d')][_0x620e('0x45')]({'where':{'id':_0x51aac8[_0x620e('0x48')]['id']}})[_0x620e('0x23')](handleEntityNotFound(_0x2bbce7,null))[_0x620e('0x23')](saveUpdates(_0x51aac8['body'],null))[_0x620e('0x23')](respondWithResult(_0x2bbce7,null))[_0x620e('0x41')](handleError(_0x2bbce7,null));};exports[_0x620e('0x24')]=function(_0x2ea253,_0x410163){return db[_0x620e('0x3d')][_0x620e('0x45')]({'where':{'id':_0x2ea253['params']['id']}})['then'](handleEntityNotFound(_0x410163,null))['then'](removeEntity(_0x410163,null))[_0x620e('0x41')](handleError(_0x410163,null));};exports[_0x620e('0x49')]=function(_0x299472,_0x228cc1,_0x4cd626){var _0x26e758={};var _0x32da9b={};var _0x4c1022;var _0x3faf99;return db[_0x620e('0x3d')][_0x620e('0x4a')]({'where':{'id':_0x299472['params']['id']}})[_0x620e('0x23')](handleEntityNotFound(_0x228cc1,null))['then'](function(_0x12e5a7){if(_0x12e5a7){_0x4c1022=_0x12e5a7;_0x32da9b[_0x620e('0x32')]=_[_0x620e('0x2e')](db['ServicenowConfiguration'][_0x620e('0x2b')]);_0x32da9b[_0x620e('0x35')]=_[_0x620e('0x2e')](_0x299472['query']);_0x32da9b['filters']=_[_0x620e('0x30')](_0x32da9b[_0x620e('0x32')],_0x32da9b[_0x620e('0x35')]);_0x26e758[_0x620e('0x31')]=_[_0x620e('0x30')](_0x32da9b[_0x620e('0x32')],qs[_0x620e('0x33')](_0x299472[_0x620e('0x35')][_0x620e('0x33')]));_0x26e758[_0x620e('0x31')]=_0x26e758[_0x620e('0x31')][_0x620e('0x34')]?_0x26e758[_0x620e('0x31')]:_0x32da9b[_0x620e('0x32')];_0x26e758[_0x620e('0x37')]=qs[_0x620e('0x38')](_0x299472[_0x620e('0x35')][_0x620e('0x38')]);_0x26e758[_0x620e('0x39')]=qs['filters'](_[_0x620e('0x3a')](_0x299472[_0x620e('0x35')],_0x32da9b[_0x620e('0x2f')]));if(_0x299472['query'][_0x620e('0x3b')]){_0x26e758[_0x620e('0x39')]=_[_0x620e('0x3c')](_0x26e758['where'],{'$or':_['map'](_0x26e758[_0x620e('0x31')],function(_0x4862f4){var _0x1812a4={};_0x1812a4[_0x4862f4]={'$like':'%'+_0x299472[_0x620e('0x35')]['filter']+'%'};return _0x1812a4;})});}_0x26e758=_['merge']({},_0x26e758,_0x299472[_0x620e('0x44')]);return _0x4c1022[_0x620e('0x49')](_0x26e758);}})[_0x620e('0x23')](function(_0x35c389){if(_0x35c389){_0x3faf99=_0x35c389['length'];if(!_0x299472[_0x620e('0x35')][_0x620e('0x36')](_0x620e('0x4b'))){_0x26e758[_0x620e('0x1c')]=qs[_0x620e('0x1c')](_0x299472[_0x620e('0x35')][_0x620e('0x1c')]);_0x26e758[_0x620e('0x1a')]=qs['offset'](_0x299472[_0x620e('0x35')][_0x620e('0x1a')]);}return _0x4c1022['getConfigurations'](_0x26e758);}})[_0x620e('0x23')](function(_0x167581){if(_0x167581){return _0x167581?{'count':_0x3faf99,'rows':_0x167581}:null;}})[_0x620e('0x23')](respondWithResult(_0x228cc1,null))[_0x620e('0x41')](handleError(_0x228cc1,null));};exports[_0x620e('0x4c')]=function(_0x1d0b9d,_0x3aba13,_0xd0cf33){if(_0x1d0b9d[_0x620e('0x47')]['id']){delete _0x1d0b9d[_0x620e('0x47')]['id'];}return db[_0x620e('0x3d')]['findOne']({'where':{'id':_0x1d0b9d[_0x620e('0x48')]['id']}})[_0x620e('0x23')](handleEntityNotFound(_0x3aba13,null))[_0x620e('0x23')](function(_0x55faa0){if(_0x55faa0){_0x1d0b9d[_0x620e('0x47')][_0x620e('0x4d')]=_0x55faa0['id'];_0x1d0b9d[_0x620e('0x47')][_0x620e('0x4e')]=integrations[_0x620e('0x4f')](_0x1d0b9d['body'][_0x620e('0x50')],_0x1d0b9d[_0x620e('0x47')][_0x620e('0x51')]);_0x1d0b9d[_0x620e('0x47')][_0x620e('0x52')]=integrations[_0x620e('0x53')](_0x1d0b9d[_0x620e('0x47')][_0x620e('0x50')],_0x1d0b9d[_0x620e('0x47')][_0x620e('0x51')]);return db[_0x620e('0x54')][_0x620e('0x46')](_0x1d0b9d[_0x620e('0x47')],{'include':[{'model':db[_0x620e('0x55')],'as':_0x620e('0x4e')},{'model':db[_0x620e('0x55')],'as':_0x620e('0x52')}]});}return null;})[_0x620e('0x23')](respondWithResult(_0x3aba13,null))[_0x620e('0x41')](handleError(_0x3aba13,null));};exports['getFields']=function(_0x19faf3,_0x54418f,_0x46741d){var _0x182f9f=['made_sla',_0x620e('0x56'),'knowledge',_0x620e('0x57'),_0x620e('0x58'),_0x620e('0x59'),'incident_state',_0x620e('0x5a'),_0x620e('0x5b')];var _0x3c5018=[_0x620e('0x5c'),'made_sla',_0x620e('0x5d'),_0x620e('0x5e'),'upon_reject',_0x620e('0x5f'),_0x620e('0x60'),'hold_reason',_0x620e('0x61'),'number',_0x620e('0x62'),_0x620e('0x63'),_0x620e('0x64'),_0x620e('0x65'),_0x620e('0x66'),_0x620e('0x67'),_0x620e('0x68'),_0x620e('0x69'),'knowledge',_0x620e('0x37'),_0x620e('0x6a'),_0x620e('0x6b'),'cmdb_ci','delivery_plan','impact',_0x620e('0x6c'),'work_notes_list',_0x620e('0x6d'),'priority',_0x620e('0x6e'),_0x620e('0x6f'),_0x620e('0x70'),_0x620e('0x71'),_0x620e('0x72'),_0x620e('0x73'),_0x620e('0x74'),_0x620e('0x75'),_0x620e('0x76'),_0x620e('0x77'),'caller_id',_0x620e('0x78'),_0x620e('0x57'),_0x620e('0x79'),_0x620e('0x7a'),_0x620e('0x58'),_0x620e('0x7b'),_0x620e('0x7c'),_0x620e('0x7d'),_0x620e('0x7e'),'business_stc','additional_assignee_list',_0x620e('0x7f'),_0x620e('0x80'),_0x620e('0x59'),'sys_class_name',_0x620e('0x81'),_0x620e('0x82'),_0x620e('0x83'),_0x620e('0x84'),'sys_id',_0x620e('0x85'),_0x620e('0x86'),'incident_state',_0x620e('0x87'),_0x620e('0x88'),'company',_0x620e('0x89'),_0x620e('0x8a'),'assigned_to',_0x620e('0x5a'),_0x620e('0x8b'),_0x620e('0x8c'),_0x620e('0x8d'),_0x620e('0x8e'),_0x620e('0x8f'),'sys_mod_count','reopen_count','sys_tags',_0x620e('0x90'),_0x620e('0x91'),_0x620e('0x92'),_0x620e('0x93'),_0x620e('0x5b')];var _0x177fc6='';var _0x540245='';var _0x29a081=[];var _0x3cf1ea='';var _0x546678='';var _0x50eb7a=[];var _0x218936='';var _0x21d560='';var _0x2ac658={};var _0x3ebfc1='';return db[_0x620e('0x3d')][_0x620e('0x4a')]({'where':{'id':_0x19faf3[_0x620e('0x48')]['id']},'attributes':['id',_0x620e('0x94'),_0x620e('0x95'),_0x620e('0x96'),'remoteUri',_0x620e('0x97')]})[_0x620e('0x23')](handleEntityNotFound(_0x54418f,null))[_0x620e('0x23')](function(_0x4a10ee){if(_0x4a10ee){_0x3ebfc1=_0x4a10ee['remoteUri'];var _0x38fc15=_0x3ebfc1[_0x620e('0x98')](-0x1);if(_0x38fc15==='/'){_0x3ebfc1=_0x3ebfc1[_0x620e('0x99')](0x0,_0x3ebfc1['lastIndexOf'](_0x38fc15));}_0x21d560=util['format']('%s/api/now/doc/table/schema/',_0x3ebfc1);_0x218936=util[_0x620e('0x9a')](_0x620e('0x9b'),_0x3ebfc1);_0x2ac658={'user':_0x4a10ee['username'],'pass':_0x4a10ee[_0x620e('0x95')]};var _0x5e3f61={'method':_0x620e('0x9c'),'uri':_0x21d560+_0x620e('0x9d'),'auth':_0x2ac658,'json':!![]};return rp(_0x5e3f61);}})[_0x620e('0x23')](function(_0x64a5af){if(_0x64a5af[_0x620e('0x9e')][_0x620e('0x34')]>0x0){_0x177fc6=_0x64a5af[_0x620e('0x9e')];}console['log'](_0x620e('0x9f'),_0x177fc6);_0x50eb7a=[];_0x540245=Object[_0x620e('0xa0')]([],_0x177fc6);_[_0x620e('0xa1')](_0x540245,function(_0x19d034){return!_0x182f9f[_0x620e('0xa2')](_0x19d034[_0x620e('0x28')]);});_0x540245[_0x620e('0xa3')](function(_0x22464b){var _0xe7f7d4=createFieldObject(_0x218936,_0x2ac658,_0x22464b[_0x620e('0xa4')],_0x22464b[_0x620e('0x28')],_0x22464b[_0x620e('0xa5')],![]);_0x50eb7a['push'](_0xe7f7d4);});return Promise['all'](_0x50eb7a);})[_0x620e('0x23')](function(_0x499109){_0x29a081=_0x499109;_0x3cf1ea=Object[_0x620e('0xa0')]([],_0x177fc6);console[_0x620e('0xa6')]('TCL:\x20_object',_0x177fc6);_[_0x620e('0xa1')](_0x3cf1ea,function(_0x473d44){return _0x3c5018['includes'](_0x473d44[_0x620e('0x28')]);});console['log']('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x3cf1ea);_0x50eb7a=[];_0x3cf1ea['forEach'](function(_0x311571){var _0x4e2cd4=createFieldObject(_0x218936,_0x2ac658,_0x311571[_0x620e('0xa4')],_0x311571['name'],_0x311571['label'],!![]);_0x50eb7a[_0x620e('0xa7')](_0x4e2cd4);});return Promise[_0x620e('0xa8')](_0x50eb7a);})['then'](function(_0x2dd20a){_0x546678=_0x2dd20a;var _0x319ba1=_0x29a081[_0x620e('0xa9')](_0x546678);return{'count':_0x319ba1['length'],'rows':_0x319ba1};})[_0x620e('0x23')](respondWithResult(_0x54418f,null))[_0x620e('0x41')](function(_0x210558){console[_0x620e('0xa6')](_0x620e('0xaa')+_0x210558);var _0x3ccc86=_0x19faf3[_0x620e('0x35')][_0x620e('0xab')]?0x1f4:_0x210558[_0x620e('0xac')]||0x1f4;logger['error'](_0x210558[_0x620e('0x27')]);delete _0x210558['name'];if(_0x3ccc86===0x191){_0x3ccc86=0x190;}_0x54418f['status'](_0x3ccc86)[_0x620e('0x29')](_0x19faf3[_0x620e('0x35')][_0x620e('0xab')]?{'message':_0x620e('0xad'),'statusCode':_0x210558[_0x620e('0xac')]}:_0x210558);});};function createFieldObject(_0x249e6a,_0x4b3a5a,_0x247864,_0x33de4c,_0x626f30,_0x53c34c){return new Promise(function(_0x2f9e5b,_0xddf62c){var _0x170fe2={'id':_0x33de4c,'name':_0x626f30,'custom':_0x53c34c};if(_0x247864==='boolean'){_0x170fe2['options']=[{'name':_0x620e('0xae'),'value':_0x620e('0xaf')},{'name':_0x620e('0xb0'),'value':_0x620e('0xb1')}];_0x2f9e5b(_0x170fe2);}else{var _0x34501c={'method':_0x620e('0x9c'),'uri':_0x249e6a+_0x620e('0xb2')+_0x33de4c,'auth':_0x4b3a5a,'json':!![]};return rp(_0x34501c)['then'](function(_0x528b49){var _0x5da781=[];if(_0x528b49[_0x620e('0x9e')][_0x620e('0x34')]>0x0){_0x528b49[_0x620e('0x9e')][_0x620e('0xa3')](function(_0xac9e19){if(_0xac9e19[_0x620e('0xb3')]==='false'){var _0x426658={'name':_0xac9e19[_0x620e('0xa5')],'value':_0xac9e19[_0x620e('0xb4')]};_0x5da781[_0x620e('0xa7')](_0x426658);}});}_0x170fe2[_0x620e('0x44')]=_0x5da781;if(_0x170fe2[_0x620e('0x44')][_0x620e('0x34')]>0x0){_0x2f9e5b(_0x170fe2);}else{if(_0x53c34c==![]){_0x2f9e5b();}else{_0x2f9e5b(_0x170fe2);}}});}});} \ No newline at end of file +var _0xcaeb=['includes','internalType','label','push','all','assign','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','forEach','concat','ServiceNow\x20error:\x20','test','statusCode','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','keys','options','find','create','body','params','destroy','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','caused_by','upon_reject','child_incidents','approval_history','number','sys_updated_by','user_input','sys_domain','state','sys_created_by','calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','caller_id','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','urgency','comments','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','sys_tags','escalation','upon_approval','category','username','password','email','remoteUri','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','remove'];(function(_0x14222a,_0x15253e){var _0x1e6bc5=function(_0x3d0ee9){while(--_0x3d0ee9){_0x14222a['push'](_0x14222a['shift']());}};_0x1e6bc5(++_0x15253e);}(_0xcaeb,0x18e));var _0xbcae=function(_0x3ff685,_0x304b9e){_0x3ff685=_0x3ff685-0x0;var _0x2046c9=_0xcaeb[_0x3ff685];return _0x2046c9;};'use strict';var emlformat=require(_0xbcae('0x0'));var rimraf=require(_0xbcae('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbcae('0x2'));var rp=require(_0xbcae('0x3'));var moment=require(_0xbcae('0x4'));var BPromise=require(_0xbcae('0x5'));var Mustache=require('mustache');var util=require(_0xbcae('0x6'));var path=require(_0xbcae('0x7'));var sox=require('sox');var csv=require(_0xbcae('0x8'));var ejs=require(_0xbcae('0x9'));var fs=require('fs');var fs_extra=require(_0xbcae('0xa'));var _=require(_0xbcae('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbcae('0xc'));var deskjs=require(_0xbcae('0xd'));var toCsv=require(_0xbcae('0x8'));var querystring=require(_0xbcae('0xe'));var Papa=require(_0xbcae('0xf'));var Redis=require(_0xbcae('0x10'));var authService=require(_0xbcae('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xbcae('0x12'));var hardwareService=require(_0xbcae('0x13'));var logger=require(_0xbcae('0x14'))(_0xbcae('0x15'));var utils=require('../../config/utils');var config=require(_0xbcae('0x16'));var licenseUtil=require(_0xbcae('0x17'));var db=require(_0xbcae('0x18'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x53a705,_0x496733){_0x496733=_0x496733||0xcc;return function(_0x3ded3e){if(_0x3ded3e){return _0x53a705[_0xbcae('0x19')](_0x496733);}return _0x53a705[_0xbcae('0x1a')](_0x496733)[_0xbcae('0x1b')]();};}function respondWithResult(_0x38b005,_0x10aa6f){_0x10aa6f=_0x10aa6f||0xc8;return function(_0x1cb8a5){if(_0x1cb8a5){return _0x38b005['status'](_0x10aa6f)[_0xbcae('0x1c')](_0x1cb8a5);}};}function respondWithFilteredResult(_0x430634,_0x18c75b){return function(_0x4b329b){if(_0x4b329b){var _0x4364ac=typeof _0x18c75b[_0xbcae('0x1d')]==='undefined'&&typeof _0x18c75b[_0xbcae('0x1e')]===_0xbcae('0x1f');var _0x390b34=_0x4b329b[_0xbcae('0x20')];var _0x45a439=_0x4364ac?0x0:_0x18c75b[_0xbcae('0x1d')];var _0x2cf8a7=_0x4364ac?_0x4b329b[_0xbcae('0x20')]:_0x18c75b[_0xbcae('0x1d')]+_0x18c75b[_0xbcae('0x1e')];var _0x1d6f61;if(_0x2cf8a7>=_0x390b34){_0x2cf8a7=_0x390b34;_0x1d6f61=0xc8;}else{_0x1d6f61=0xce;}_0x430634[_0xbcae('0x1a')](_0x1d6f61);return _0x430634[_0xbcae('0x21')](_0xbcae('0x22'),_0x45a439+'-'+_0x2cf8a7+'/'+_0x390b34)[_0xbcae('0x1c')](_0x4b329b);}return null;};}function patchUpdates(_0x2d6d3c){return function(_0xc6f2a0){try{jsonpatch[_0xbcae('0x23')](_0xc6f2a0,_0x2d6d3c,!![]);}catch(_0x3d5ce2){return BPromise[_0xbcae('0x24')](_0x3d5ce2);}return _0xc6f2a0[_0xbcae('0x25')]();};}function saveUpdates(_0x543c9f,_0x4fa53e){return function(_0x4aa6be){if(_0x4aa6be){return _0x4aa6be[_0xbcae('0x26')](_0x543c9f)[_0xbcae('0x27')](function(_0x5ce789){return _0x5ce789;});}return null;};}function removeEntity(_0x1d19e6,_0x560b41){return function(_0x4c518d){if(_0x4c518d){return _0x4c518d['destroy']()[_0xbcae('0x27')](function(){_0x1d19e6[_0xbcae('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b7357,_0x48319b){return function(_0x3abf40){if(!_0x3abf40){_0x2b7357[_0xbcae('0x19')](0x194);}return _0x3abf40;};}function handleError(_0x52e288,_0x578247){_0x578247=_0x578247||0x1f4;return function(_0x45a4c6){logger[_0xbcae('0x28')](_0x45a4c6[_0xbcae('0x29')]);if(_0x45a4c6[_0xbcae('0x2a')]){delete _0x45a4c6[_0xbcae('0x2a')];}_0x52e288['status'](_0x578247)[_0xbcae('0x2b')](_0x45a4c6);};}exports[_0xbcae('0x2c')]=function(_0x565367,_0x466438){var _0x484ad5={},_0x6eb30a={},_0x244ce4={'count':0x0,'rows':[]};var _0x554db0=_[_0xbcae('0x2d')](db[_0xbcae('0x2e')][_0xbcae('0x2f')],function(_0x37dd4a){return{'name':_0x37dd4a[_0xbcae('0x30')],'type':_0x37dd4a[_0xbcae('0x31')][_0xbcae('0x32')]};});_0x6eb30a[_0xbcae('0x33')]=_[_0xbcae('0x2d')](_0x554db0,'name');_0x6eb30a[_0xbcae('0x34')]=_['keys'](_0x565367[_0xbcae('0x34')]);_0x6eb30a[_0xbcae('0x35')]=_[_0xbcae('0x36')](_0x6eb30a[_0xbcae('0x33')],_0x6eb30a[_0xbcae('0x34')]);_0x484ad5['attributes']=_[_0xbcae('0x36')](_0x6eb30a['model'],qs[_0xbcae('0x37')](_0x565367[_0xbcae('0x34')]['fields']));_0x484ad5[_0xbcae('0x38')]=_0x484ad5[_0xbcae('0x38')][_0xbcae('0x39')]?_0x484ad5[_0xbcae('0x38')]:_0x6eb30a[_0xbcae('0x33')];if(!_0x565367['query'][_0xbcae('0x3a')](_0xbcae('0x3b'))){_0x484ad5['limit']=qs['limit'](_0x565367[_0xbcae('0x34')]['limit']);_0x484ad5[_0xbcae('0x1d')]=qs[_0xbcae('0x1d')](_0x565367[_0xbcae('0x34')]['offset']);}_0x484ad5[_0xbcae('0x3c')]=qs[_0xbcae('0x3d')](_0x565367[_0xbcae('0x34')]['sort']);_0x484ad5[_0xbcae('0x3e')]=qs[_0xbcae('0x35')](_[_0xbcae('0x3f')](_0x565367[_0xbcae('0x34')],_0x6eb30a[_0xbcae('0x35')]),_0x554db0);if(_0x565367[_0xbcae('0x34')]['filter']){_0x484ad5['where']=_[_0xbcae('0x40')](_0x484ad5['where'],{'$or':_[_0xbcae('0x2d')](_0x554db0,function(_0x4f698f){if(_0x4f698f[_0xbcae('0x31')]!==_0xbcae('0x41')){var _0x5c92b8={};_0x5c92b8[_0x4f698f[_0xbcae('0x2a')]]={'$like':'%'+_0x565367['query'][_0xbcae('0x42')]+'%'};return _0x5c92b8;}})});}_0x484ad5=_[_0xbcae('0x40')]({},_0x484ad5,_0x565367['options']);var _0x1932ff={'where':_0x484ad5[_0xbcae('0x3e')]};return db['ServicenowAccount'][_0xbcae('0x20')](_0x1932ff)[_0xbcae('0x27')](function(_0x7e85fc){_0x244ce4[_0xbcae('0x20')]=_0x7e85fc;if(_0x565367[_0xbcae('0x34')][_0xbcae('0x43')]){_0x484ad5[_0xbcae('0x44')]=[{'all':!![]}];}return db[_0xbcae('0x2e')][_0xbcae('0x45')](_0x484ad5);})[_0xbcae('0x27')](function(_0x52a081){_0x244ce4[_0xbcae('0x46')]=_0x52a081;return _0x244ce4;})[_0xbcae('0x27')](respondWithFilteredResult(_0x466438,_0x484ad5))[_0xbcae('0x47')](handleError(_0x466438,null));};exports[_0xbcae('0x48')]=function(_0x5a4298,_0x41c50e){var _0x4fa825={'raw':![],'where':{'id':_0x5a4298['params']['id']}},_0x156ab6={};_0x156ab6[_0xbcae('0x33')]=_[_0xbcae('0x49')](db[_0xbcae('0x2e')][_0xbcae('0x2f')]);_0x156ab6[_0xbcae('0x34')]=_['keys'](_0x5a4298['query']);_0x156ab6[_0xbcae('0x35')]=_[_0xbcae('0x36')](_0x156ab6[_0xbcae('0x33')],_0x156ab6[_0xbcae('0x34')]);_0x4fa825[_0xbcae('0x38')]=_[_0xbcae('0x36')](_0x156ab6[_0xbcae('0x33')],qs[_0xbcae('0x37')](_0x5a4298[_0xbcae('0x34')][_0xbcae('0x37')]));_0x4fa825[_0xbcae('0x38')]=_0x4fa825[_0xbcae('0x38')]['length']?_0x4fa825[_0xbcae('0x38')]:_0x156ab6[_0xbcae('0x33')];if(_0x5a4298[_0xbcae('0x34')]['includeAll']){_0x4fa825[_0xbcae('0x44')]=[{'all':!![]}];}_0x4fa825=_['merge']({},_0x4fa825,_0x5a4298[_0xbcae('0x4a')]);return db['ServicenowAccount'][_0xbcae('0x4b')](_0x4fa825)['then'](handleEntityNotFound(_0x41c50e,null))[_0xbcae('0x27')](respondWithResult(_0x41c50e,null))['catch'](handleError(_0x41c50e,null));};exports['create']=function(_0x51f5cf,_0x3fac2c){return db[_0xbcae('0x2e')][_0xbcae('0x4c')](_0x51f5cf[_0xbcae('0x4d')],{})['then'](respondWithResult(_0x3fac2c,0xc9))[_0xbcae('0x47')](handleError(_0x3fac2c,null));};exports[_0xbcae('0x26')]=function(_0x350c4b,_0x19bbe6){if(_0x350c4b[_0xbcae('0x4d')]['id']){delete _0x350c4b[_0xbcae('0x4d')]['id'];}return db[_0xbcae('0x2e')][_0xbcae('0x4b')]({'where':{'id':_0x350c4b[_0xbcae('0x4e')]['id']}})['then'](handleEntityNotFound(_0x19bbe6,null))['then'](saveUpdates(_0x350c4b[_0xbcae('0x4d')],null))[_0xbcae('0x27')](respondWithResult(_0x19bbe6,null))['catch'](handleError(_0x19bbe6,null));};exports[_0xbcae('0x4f')]=function(_0x5d5cde,_0x44cfba){return db[_0xbcae('0x2e')][_0xbcae('0x4b')]({'where':{'id':_0x5d5cde[_0xbcae('0x4e')]['id']}})[_0xbcae('0x27')](handleEntityNotFound(_0x44cfba,null))['then'](removeEntity(_0x44cfba,null))[_0xbcae('0x47')](handleError(_0x44cfba,null));};exports[_0xbcae('0x50')]=function(_0x5bc962,_0x5efb4a,_0x264087){var _0x28bda8={};var _0x3461e9={};var _0x4d5adf;var _0x364129;return db[_0xbcae('0x2e')][_0xbcae('0x51')]({'where':{'id':_0x5bc962[_0xbcae('0x4e')]['id']}})[_0xbcae('0x27')](handleEntityNotFound(_0x5efb4a,null))[_0xbcae('0x27')](function(_0x436826){if(_0x436826){_0x4d5adf=_0x436826;_0x3461e9[_0xbcae('0x33')]=_['keys'](db[_0xbcae('0x52')][_0xbcae('0x2f')]);_0x3461e9['query']=_['keys'](_0x5bc962[_0xbcae('0x34')]);_0x3461e9[_0xbcae('0x35')]=_[_0xbcae('0x36')](_0x3461e9['model'],_0x3461e9[_0xbcae('0x34')]);_0x28bda8[_0xbcae('0x38')]=_[_0xbcae('0x36')](_0x3461e9['model'],qs['fields'](_0x5bc962[_0xbcae('0x34')][_0xbcae('0x37')]));_0x28bda8[_0xbcae('0x38')]=_0x28bda8[_0xbcae('0x38')]['length']?_0x28bda8[_0xbcae('0x38')]:_0x3461e9[_0xbcae('0x33')];_0x28bda8[_0xbcae('0x3c')]=qs[_0xbcae('0x3d')](_0x5bc962[_0xbcae('0x34')][_0xbcae('0x3d')]);_0x28bda8[_0xbcae('0x3e')]=qs['filters'](_[_0xbcae('0x3f')](_0x5bc962[_0xbcae('0x34')],_0x3461e9[_0xbcae('0x35')]));if(_0x5bc962[_0xbcae('0x34')][_0xbcae('0x42')]){_0x28bda8['where']=_['merge'](_0x28bda8[_0xbcae('0x3e')],{'$or':_['map'](_0x28bda8[_0xbcae('0x38')],function(_0x2c1559){var _0x49142d={};_0x49142d[_0x2c1559]={'$like':'%'+_0x5bc962[_0xbcae('0x34')][_0xbcae('0x42')]+'%'};return _0x49142d;})});}_0x28bda8=_['merge']({},_0x28bda8,_0x5bc962[_0xbcae('0x4a')]);return _0x4d5adf[_0xbcae('0x50')](_0x28bda8);}})[_0xbcae('0x27')](function(_0x2b7027){if(_0x2b7027){_0x364129=_0x2b7027['length'];if(!_0x5bc962[_0xbcae('0x34')]['hasOwnProperty'](_0xbcae('0x3b'))){_0x28bda8['limit']=qs[_0xbcae('0x1e')](_0x5bc962[_0xbcae('0x34')][_0xbcae('0x1e')]);_0x28bda8['offset']=qs[_0xbcae('0x1d')](_0x5bc962[_0xbcae('0x34')][_0xbcae('0x1d')]);}return _0x4d5adf[_0xbcae('0x50')](_0x28bda8);}})[_0xbcae('0x27')](function(_0x4f7388){if(_0x4f7388){return _0x4f7388?{'count':_0x364129,'rows':_0x4f7388}:null;}})[_0xbcae('0x27')](respondWithResult(_0x5efb4a,null))[_0xbcae('0x47')](handleError(_0x5efb4a,null));};exports[_0xbcae('0x53')]=function(_0x4b71f4,_0x109232,_0xd8d15a){if(_0x4b71f4['body']['id']){delete _0x4b71f4[_0xbcae('0x4d')]['id'];}return db['ServicenowAccount'][_0xbcae('0x51')]({'where':{'id':_0x4b71f4[_0xbcae('0x4e')]['id']}})[_0xbcae('0x27')](handleEntityNotFound(_0x109232,null))[_0xbcae('0x27')](function(_0x221088){if(_0x221088){_0x4b71f4['body'][_0xbcae('0x54')]=_0x221088['id'];_0x4b71f4[_0xbcae('0x4d')]['Subjects']=integrations[_0xbcae('0x55')](_0x4b71f4['body'][_0xbcae('0x56')],_0x4b71f4[_0xbcae('0x4d')][_0xbcae('0x31')]);_0x4b71f4['body'][_0xbcae('0x57')]=integrations[_0xbcae('0x58')](_0x4b71f4[_0xbcae('0x4d')]['channel'],_0x4b71f4['body']['type']);return db[_0xbcae('0x52')][_0xbcae('0x4c')](_0x4b71f4[_0xbcae('0x4d')],{'include':[{'model':db['ServicenowField'],'as':'Subjects'},{'model':db[_0xbcae('0x59')],'as':_0xbcae('0x57')}]});}return null;})['then'](respondWithResult(_0x109232,null))[_0xbcae('0x47')](handleError(_0x109232,null));};exports[_0xbcae('0x5a')]=function(_0x4a21bd,_0x5742ff,_0x4d42c4){var _0x2401c4=[_0xbcae('0x5b'),_0xbcae('0x5c'),_0xbcae('0x5d'),_0xbcae('0x5e'),_0xbcae('0x5f'),_0xbcae('0x60'),_0xbcae('0x61'),_0xbcae('0x62'),'category'];var _0x59f05b=['parent','made_sla',_0xbcae('0x63'),'watch_list',_0xbcae('0x64'),'sys_updated_on',_0xbcae('0x65'),_0xbcae('0x5c'),_0xbcae('0x66'),_0xbcae('0x67'),'resolved_by',_0xbcae('0x68'),'opened_by',_0xbcae('0x69'),'sys_created_on',_0xbcae('0x6a'),_0xbcae('0x6b'),_0xbcae('0x6c'),_0xbcae('0x5d'),_0xbcae('0x3c'),_0xbcae('0x6d'),_0xbcae('0x6e'),_0xbcae('0x6f'),_0xbcae('0x70'),_0xbcae('0x71'),_0xbcae('0x72'),'work_notes_list',_0xbcae('0x73'),'priority',_0xbcae('0x74'),_0xbcae('0x75'),_0xbcae('0x76'),_0xbcae('0x77'),_0xbcae('0x78'),_0xbcae('0x79'),'group_list',_0xbcae('0x7a'),_0xbcae('0x7b'),_0xbcae('0x7c'),_0xbcae('0x7d'),'approval_set',_0xbcae('0x5e'),_0xbcae('0x7e'),_0xbcae('0x7f'),_0xbcae('0x5f'),'correlation_display',_0xbcae('0x80'),_0xbcae('0x81'),_0xbcae('0x82'),_0xbcae('0x83'),_0xbcae('0x84'),_0xbcae('0x85'),_0xbcae('0x86'),_0xbcae('0x60'),_0xbcae('0x87'),_0xbcae('0x88'),_0xbcae('0x89'),_0xbcae('0x8a'),'parent_incident',_0xbcae('0x8b'),_0xbcae('0x8c'),_0xbcae('0x8d'),_0xbcae('0x61'),_0xbcae('0x8e'),'problem_id','company','reassignment_count','activity_due','assigned_to',_0xbcae('0x62'),_0xbcae('0x8f'),'sla_due',_0xbcae('0x90'),_0xbcae('0x91'),_0xbcae('0x92'),_0xbcae('0x93'),_0xbcae('0x94'),_0xbcae('0x95'),_0xbcae('0x96'),_0xbcae('0x97'),'correlation_id','location',_0xbcae('0x98')];var _0x310589='';var _0x3acf01='';var _0x596150=[];var _0x1a8b9f='';var _0xe12af='';var _0x194e20=[];var _0x3cbd9d='';var _0x2f711e='';var _0xd7a70d={};var _0x34c98d='';return db[_0xbcae('0x2e')][_0xbcae('0x51')]({'where':{'id':_0x4a21bd['params']['id']},'attributes':['id',_0xbcae('0x99'),_0xbcae('0x9a'),_0xbcae('0x9b'),_0xbcae('0x9c'),_0xbcae('0x9d')]})[_0xbcae('0x27')](handleEntityNotFound(_0x5742ff,null))[_0xbcae('0x27')](function(_0x570a11){if(_0x570a11){_0x34c98d=_0x570a11[_0xbcae('0x9c')];var _0x543c56=_0x34c98d[_0xbcae('0x9e')](-0x1);if(_0x543c56==='/'){_0x34c98d=_0x34c98d[_0xbcae('0x9f')](0x0,_0x34c98d[_0xbcae('0xa0')](_0x543c56));}_0x2f711e=util[_0xbcae('0xa1')](_0xbcae('0xa2'),_0x34c98d);_0x3cbd9d=util[_0xbcae('0xa1')](_0xbcae('0xa3'),_0x34c98d);_0xd7a70d={'user':_0x570a11['username'],'pass':_0x570a11[_0xbcae('0x9a')]};var _0xe50372={'method':_0xbcae('0xa4'),'uri':_0x2f711e+'incident?sysparm_display_value=all','auth':_0xd7a70d,'json':!![]};return rp(_0xe50372);}})['then'](function(_0x29cb88){if(_0x29cb88[_0xbcae('0xa5')][_0xbcae('0x39')]>0x0){_0x310589=_0x29cb88[_0xbcae('0xa5')];}console[_0xbcae('0xa6')](_0xbcae('0xa7'),_0x310589);_0x194e20=[];_0x3acf01=Object['assign']([],_0x310589);_[_0xbcae('0xa8')](_0x3acf01,function(_0x494119){return!_0x2401c4[_0xbcae('0xa9')](_0x494119[_0xbcae('0x2a')]);});_0x3acf01['forEach'](function(_0x2b5019){var _0x6947fc=createFieldObject(_0x3cbd9d,_0xd7a70d,_0x2b5019[_0xbcae('0xaa')],_0x2b5019[_0xbcae('0x2a')],_0x2b5019[_0xbcae('0xab')],![]);_0x194e20[_0xbcae('0xac')](_0x6947fc);});return Promise[_0xbcae('0xad')](_0x194e20);})[_0xbcae('0x27')](function(_0x456df5){_0x596150=_0x456df5;_0x1a8b9f=Object[_0xbcae('0xae')]([],_0x310589);console['log'](_0xbcae('0xaf'),_0x310589);_['remove'](_0x1a8b9f,function(_0x1bd477){return _0x59f05b[_0xbcae('0xa9')](_0x1bd477[_0xbcae('0x2a')]);});console[_0xbcae('0xa6')](_0xbcae('0xb0'),_0x1a8b9f);_0x194e20=[];_0x1a8b9f[_0xbcae('0xb1')](function(_0x27118c){var _0x5ead5b=createFieldObject(_0x3cbd9d,_0xd7a70d,_0x27118c[_0xbcae('0xaa')],_0x27118c[_0xbcae('0x2a')],_0x27118c[_0xbcae('0xab')],!![]);_0x194e20['push'](_0x5ead5b);});return Promise['all'](_0x194e20);})['then'](function(_0x2e0cdd){_0xe12af=_0x2e0cdd;var _0x13c080=_0x596150[_0xbcae('0xb2')](_0xe12af);return{'count':_0x13c080[_0xbcae('0x39')],'rows':_0x13c080};})['then'](respondWithResult(_0x5742ff,null))[_0xbcae('0x47')](function(_0x4ed31f){console[_0xbcae('0xa6')](_0xbcae('0xb3')+_0x4ed31f);var _0x3e491b=_0x4a21bd[_0xbcae('0x34')][_0xbcae('0xb4')]?0x1f4:_0x4ed31f[_0xbcae('0xb5')]||0x1f4;logger['error'](_0x4ed31f[_0xbcae('0x29')]);delete _0x4ed31f[_0xbcae('0x2a')];if(_0x3e491b===0x191){_0x3e491b=0x190;}_0x5742ff[_0xbcae('0x1a')](_0x3e491b)[_0xbcae('0x2b')](_0x4a21bd[_0xbcae('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4ed31f['statusCode']}:_0x4ed31f);});};function createFieldObject(_0x853349,_0x5c0d7a,_0x1ee45c,_0x2bcb13,_0x148e96,_0x3b0256){return new Promise(function(_0x1b3263,_0x478f8b){var _0x227d1b={'id':_0x2bcb13,'name':_0x148e96,'custom':_0x3b0256};if(_0x1ee45c==='boolean'){_0x227d1b['options']=[{'name':_0xbcae('0xb6'),'value':_0xbcae('0xb7')},{'name':_0xbcae('0xb8'),'value':_0xbcae('0xb9')}];_0x1b3263(_0x227d1b);}else{var _0x54affc={'method':_0xbcae('0xa4'),'uri':_0x853349+_0xbcae('0xba')+_0x2bcb13,'auth':_0x5c0d7a,'json':!![]};return rp(_0x54affc)['then'](function(_0x5789b5){var _0x277df0=[];if(_0x5789b5[_0xbcae('0xa5')][_0xbcae('0x39')]>0x0){_0x5789b5[_0xbcae('0xa5')][_0xbcae('0xb1')](function(_0xac3ae1){if(_0xac3ae1[_0xbcae('0xbb')]===_0xbcae('0xb9')){var _0x300600={'name':_0xac3ae1[_0xbcae('0xab')],'value':_0xac3ae1[_0xbcae('0xbc')]};_0x277df0[_0xbcae('0xac')](_0x300600);}});}_0x227d1b[_0xbcae('0x4a')]=_0x277df0;if(_0x227d1b[_0xbcae('0x4a')][_0xbcae('0x39')]>0x0){_0x1b3263(_0x227d1b);}else{if(_0x3b0256==![]){_0x1b3263();}else{_0x1b3263(_0x227d1b);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index 46b3ec2..8b8b5b1 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 _0xabce=['path','rimraf','../../config/environment','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','moment'];(function(_0x8afdd0,_0x548ad1){var _0x3de7ac=function(_0x2dc2c4){while(--_0x2dc2c4){_0x8afdd0['push'](_0x8afdd0['shift']());}};_0x3de7ac(++_0x548ad1);}(_0xabce,0x103));var _0xeabc=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xabce[_0x5b561d];return _0x431060;};'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('./intServicenowAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xeabc('0x8')]=function(_0x52a4d7,_0x229ba4){return _0x52a4d7['define'](_0xeabc('0x9'),attributes,{'tableName':_0xeabc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe2fe=['define','int_servicenow_accounts','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x5ac186,_0x11fe19){var _0x42afc1=function(_0x4f6c2c){while(--_0x4f6c2c){_0x5ac186['push'](_0x5ac186['shift']());}};_0x42afc1(++_0x11fe19);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xee2f('0x1'));var moment=require('moment');var BPromise=require(_0xee2f('0x2'));var rp=require(_0xee2f('0x3'));var fs=require('fs');var path=require(_0xee2f('0x4'));var rimraf=require(_0xee2f('0x5'));var config=require(_0xee2f('0x6'));var attributes=require('./intServicenowAccount.attributes');var integrations=require(_0xee2f('0x7'));module[_0xee2f('0x8')]=function(_0x49926b,_0x1533a0){return _0x49926b[_0xee2f('0x9')]('ServicenowAccount',attributes,{'tableName':_0xee2f('0xa'),'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 a54e8bf..50f1f64 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 _0xa410=['code','message','result','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','model','map','find','ShowServicenowAccount','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','ServicenowAccount,\x20%s,\x20%s','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3341a1,_0x11500b){var _0x53753b=function(_0x560edc){while(--_0x560edc){_0x3341a1['push'](_0x3341a1['shift']());}};_0x53753b(++_0x11500b);}(_0xa410,0xe3));var _0x0a41=function(_0x76ad19,_0x17a73d){_0x76ad19=_0x76ad19-0x0;var _0x3595b5=_0xa410[_0x76ad19];return _0x3595b5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x0a41('0x0'));var rs=require(_0x0a41('0x1'));var fs=require('fs');var Redis=require(_0x0a41('0x2'));var db=require(_0x0a41('0x3'))['db'];var utils=require(_0x0a41('0x4'));var logger=require(_0x0a41('0x5'))(_0x0a41('0x6'));var config=require(_0x0a41('0x7'));var jayson=require(_0x0a41('0x8'));var client=jayson['client'][_0x0a41('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3aa3a3,_0x4f59fa,_0x11666c){return new BPromise(function(_0x18fa3f,_0x2c66b6){return client['request'](_0x3aa3a3,_0x11666c)[_0x0a41('0xa')](function(_0x408a77){logger[_0x0a41('0xb')](_0x0a41('0xc'),_0x4f59fa,'request\x20sent');logger[_0x0a41('0xd')](_0x0a41('0xe'),_0x4f59fa,_0x0a41('0xf'),JSON[_0x0a41('0x10')](_0x408a77));if(_0x408a77[_0x0a41('0x11')]){if(_0x408a77[_0x0a41('0x11')][_0x0a41('0x12')]===0x1f4){logger[_0x0a41('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x4f59fa,_0x408a77[_0x0a41('0x11')][_0x0a41('0x13')]);return _0x2c66b6(_0x408a77[_0x0a41('0x11')][_0x0a41('0x13')]);}logger[_0x0a41('0x11')](_0x0a41('0xc'),_0x4f59fa,_0x408a77[_0x0a41('0x11')]['message']);return _0x18fa3f(_0x408a77['error'][_0x0a41('0x13')]);}else{logger['info'](_0x0a41('0xc'),_0x4f59fa,_0x0a41('0xf'));_0x18fa3f(_0x408a77[_0x0a41('0x14')][_0x0a41('0x13')]);}})[_0x0a41('0x15')](function(_0x975708){logger[_0x0a41('0x11')](_0x0a41('0xc'),_0x4f59fa,_0x975708);_0x2c66b6(_0x975708);});});}exports[_0x0a41('0x16')]=function(_0x44d0ba){var _0x75fa33=this;return new Promise(function(_0x57e58f,_0x5d96a4){return db[_0x0a41('0x17')][_0x0a41('0x18')]({'raw':_0x44d0ba[_0x0a41('0x19')]?_0x44d0ba[_0x0a41('0x19')][_0x0a41('0x1a')]===undefined?!![]:![]:!![],'where':_0x44d0ba[_0x0a41('0x19')]?_0x44d0ba['options'][_0x0a41('0x1b')]||null:null,'attributes':_0x44d0ba[_0x0a41('0x19')]?_0x44d0ba[_0x0a41('0x19')][_0x0a41('0x1c')]||null:null,'limit':_0x44d0ba[_0x0a41('0x19')]?_0x44d0ba[_0x0a41('0x19')][_0x0a41('0x1d')]||null:null,'include':_0x44d0ba[_0x0a41('0x19')]?_0x44d0ba[_0x0a41('0x19')]['include']?_['map'](_0x44d0ba[_0x0a41('0x19')][_0x0a41('0x1e')],function(_0x93ec3d){return{'model':db[_0x93ec3d[_0x0a41('0x1f')]],'as':_0x93ec3d['as'],'attributes':_0x93ec3d['attributes'],'include':_0x93ec3d[_0x0a41('0x1e')]?_['map'](_0x93ec3d[_0x0a41('0x1e')],function(_0x11d732){return{'model':db[_0x11d732[_0x0a41('0x1f')]],'as':_0x11d732['as'],'attributes':_0x11d732['attributes'],'include':_0x11d732[_0x0a41('0x1e')]?_[_0x0a41('0x20')](_0x11d732[_0x0a41('0x1e')],function(_0x94f718){return{'model':db[_0x94f718[_0x0a41('0x1f')]],'as':_0x94f718['as'],'attributes':_0x94f718[_0x0a41('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x487be6){logger[_0x0a41('0xb')](_0x0a41('0x16'),_0x44d0ba);logger[_0x0a41('0xd')](_0x0a41('0x16'),_0x44d0ba,JSON[_0x0a41('0x10')](_0x487be6));_0x57e58f(_0x487be6);})[_0x0a41('0x15')](function(_0x297891){logger[_0x0a41('0x11')](_0x0a41('0x16'),_0x297891['message'],_0x44d0ba);_0x5d96a4(_0x75fa33['error'](0x1f4,_0x297891[_0x0a41('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x7d8ac4){var _0x8d36c6=this;return new Promise(function(_0x5e68f8,_0x221f2f){return db['ServicenowAccount'][_0x0a41('0x21')]({'raw':_0x7d8ac4['options']?_0x7d8ac4[_0x0a41('0x19')][_0x0a41('0x1a')]===undefined?!![]:![]:!![],'where':_0x7d8ac4[_0x0a41('0x19')]?_0x7d8ac4[_0x0a41('0x19')][_0x0a41('0x1b')]||null:null,'attributes':_0x7d8ac4[_0x0a41('0x19')]?_0x7d8ac4[_0x0a41('0x19')][_0x0a41('0x1c')]||null:null,'include':_0x7d8ac4[_0x0a41('0x19')]?_0x7d8ac4[_0x0a41('0x19')][_0x0a41('0x1e')]?_[_0x0a41('0x20')](_0x7d8ac4[_0x0a41('0x19')][_0x0a41('0x1e')],function(_0x5be6d9){return{'model':db[_0x5be6d9['model']],'as':_0x5be6d9['as'],'attributes':_0x5be6d9[_0x0a41('0x1c')],'include':_0x5be6d9[_0x0a41('0x1e')]?_[_0x0a41('0x20')](_0x5be6d9[_0x0a41('0x1e')],function(_0x5200d7){return{'model':db[_0x5200d7['model']],'as':_0x5200d7['as'],'attributes':_0x5200d7[_0x0a41('0x1c')],'include':_0x5200d7['include']?_[_0x0a41('0x20')](_0x5200d7[_0x0a41('0x1e')],function(_0x38a329){return{'model':db[_0x38a329['model']],'as':_0x38a329['as'],'attributes':_0x38a329[_0x0a41('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0a41('0xa')](function(_0x2e3e28){logger[_0x0a41('0xb')](_0x0a41('0x22'),_0x7d8ac4);logger[_0x0a41('0xd')]('ShowServicenowAccount',_0x7d8ac4,JSON[_0x0a41('0x10')](_0x2e3e28));_0x5e68f8(_0x2e3e28);})[_0x0a41('0x15')](function(_0xfdf301){logger[_0x0a41('0x11')](_0x0a41('0x22'),_0xfdf301[_0x0a41('0x13')],_0x7d8ac4);_0x221f2f(_0x8d36c6[_0x0a41('0x11')](0x1f4,_0xfdf301[_0x0a41('0x13')]));});});}; \ No newline at end of file +var _0xf025=['where','ShowServicenowAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowAccount,\x20%s,\x20%s','message','result','GetServicenowAccount','ServicenowAccount','options','raw','limit','map','include','model','attributes'];(function(_0x1ecaba,_0x1f3eec){var _0x134ca1=function(_0x1c99d0){while(--_0x1c99d0){_0x1ecaba['push'](_0x1ecaba['shift']());}};_0x134ca1(++_0x1f3eec);}(_0xf025,0xce));var _0x5f02=function(_0x57da0a,_0x284aed){_0x57da0a=_0x57da0a-0x0;var _0x3145d5=_0xf025[_0x57da0a];return _0x3145d5;};'use strict';var _=require(_0x5f02('0x0'));var util=require(_0x5f02('0x1'));var moment=require(_0x5f02('0x2'));var BPromise=require('bluebird');var rs=require(_0x5f02('0x3'));var fs=require('fs');var Redis=require(_0x5f02('0x4'));var db=require(_0x5f02('0x5'))['db'];var utils=require(_0x5f02('0x6'));var logger=require(_0x5f02('0x7'))('rpc');var config=require(_0x5f02('0x8'));var jayson=require(_0x5f02('0x9'));var client=jayson[_0x5f02('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf9122,_0x3e906d,_0x2fb8e8){return new BPromise(function(_0x4af1e8,_0x54c630){return client[_0x5f02('0xb')](_0xf9122,_0x2fb8e8)[_0x5f02('0xc')](function(_0x7d7cf7){logger[_0x5f02('0xd')]('ServicenowAccount,\x20%s,\x20%s',_0x3e906d,_0x5f02('0xe'));logger[_0x5f02('0xf')](_0x5f02('0x10'),_0x3e906d,_0x5f02('0xe'),JSON[_0x5f02('0x11')](_0x7d7cf7));if(_0x7d7cf7[_0x5f02('0x12')]){if(_0x7d7cf7[_0x5f02('0x12')][_0x5f02('0x13')]===0x1f4){logger[_0x5f02('0x12')](_0x5f02('0x14'),_0x3e906d,_0x7d7cf7[_0x5f02('0x12')][_0x5f02('0x15')]);return _0x54c630(_0x7d7cf7[_0x5f02('0x12')]['message']);}logger[_0x5f02('0x12')]('ServicenowAccount,\x20%s,\x20%s',_0x3e906d,_0x7d7cf7[_0x5f02('0x12')][_0x5f02('0x15')]);return _0x4af1e8(_0x7d7cf7[_0x5f02('0x12')]['message']);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x3e906d,_0x5f02('0xe'));_0x4af1e8(_0x7d7cf7[_0x5f02('0x16')][_0x5f02('0x15')]);}})['catch'](function(_0x549e3b){logger[_0x5f02('0x12')](_0x5f02('0x14'),_0x3e906d,_0x549e3b);_0x54c630(_0x549e3b);});});}exports[_0x5f02('0x17')]=function(_0x141475){var _0x5c04f5=this;return new Promise(function(_0x3e0dad,_0x1da645){return db[_0x5f02('0x18')]['findAll']({'raw':_0x141475[_0x5f02('0x19')]?_0x141475[_0x5f02('0x19')][_0x5f02('0x1a')]===undefined?!![]:![]:!![],'where':_0x141475[_0x5f02('0x19')]?_0x141475[_0x5f02('0x19')]['where']||null:null,'attributes':_0x141475['options']?_0x141475[_0x5f02('0x19')]['attributes']||null:null,'limit':_0x141475[_0x5f02('0x19')]?_0x141475['options'][_0x5f02('0x1b')]||null:null,'include':_0x141475['options']?_0x141475[_0x5f02('0x19')]['include']?_[_0x5f02('0x1c')](_0x141475[_0x5f02('0x19')][_0x5f02('0x1d')],function(_0x29a473){return{'model':db[_0x29a473[_0x5f02('0x1e')]],'as':_0x29a473['as'],'attributes':_0x29a473[_0x5f02('0x1f')],'include':_0x29a473['include']?_[_0x5f02('0x1c')](_0x29a473['include'],function(_0xb70fd){return{'model':db[_0xb70fd[_0x5f02('0x1e')]],'as':_0xb70fd['as'],'attributes':_0xb70fd[_0x5f02('0x1f')],'include':_0xb70fd[_0x5f02('0x1d')]?_[_0x5f02('0x1c')](_0xb70fd[_0x5f02('0x1d')],function(_0xd5aa07){return{'model':db[_0xd5aa07[_0x5f02('0x1e')]],'as':_0xd5aa07['as'],'attributes':_0xd5aa07[_0x5f02('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x5f02('0xc')](function(_0xc8893){logger[_0x5f02('0xd')](_0x5f02('0x17'),_0x141475);logger[_0x5f02('0xf')]('GetServicenowAccount',_0x141475,JSON['stringify'](_0xc8893));_0x3e0dad(_0xc8893);})['catch'](function(_0x21d1e6){logger['error'](_0x5f02('0x17'),_0x21d1e6[_0x5f02('0x15')],_0x141475);_0x1da645(_0x5c04f5[_0x5f02('0x12')](0x1f4,_0x21d1e6[_0x5f02('0x15')]));});});};exports['ShowServicenowAccount']=function(_0x58041c){var _0x4bc523=this;return new Promise(function(_0x3a4b55,_0x38c65f){return db[_0x5f02('0x18')]['find']({'raw':_0x58041c[_0x5f02('0x19')]?_0x58041c[_0x5f02('0x19')][_0x5f02('0x1a')]===undefined?!![]:![]:!![],'where':_0x58041c[_0x5f02('0x19')]?_0x58041c[_0x5f02('0x19')][_0x5f02('0x20')]||null:null,'attributes':_0x58041c[_0x5f02('0x19')]?_0x58041c[_0x5f02('0x19')][_0x5f02('0x1f')]||null:null,'include':_0x58041c[_0x5f02('0x19')]?_0x58041c[_0x5f02('0x19')][_0x5f02('0x1d')]?_['map'](_0x58041c['options']['include'],function(_0x26cec9){return{'model':db[_0x26cec9[_0x5f02('0x1e')]],'as':_0x26cec9['as'],'attributes':_0x26cec9[_0x5f02('0x1f')],'include':_0x26cec9['include']?_[_0x5f02('0x1c')](_0x26cec9[_0x5f02('0x1d')],function(_0x2d4ed8){return{'model':db[_0x2d4ed8['model']],'as':_0x2d4ed8['as'],'attributes':_0x2d4ed8[_0x5f02('0x1f')],'include':_0x2d4ed8[_0x5f02('0x1d')]?_[_0x5f02('0x1c')](_0x2d4ed8['include'],function(_0x28f651){return{'model':db[_0x28f651[_0x5f02('0x1e')]],'as':_0x28f651['as'],'attributes':_0x28f651[_0x5f02('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4023ec){logger['info'](_0x5f02('0x21'),_0x58041c);logger[_0x5f02('0xf')](_0x5f02('0x21'),_0x58041c,JSON[_0x5f02('0x11')](_0x4023ec));_0x3a4b55(_0x4023ec);})['catch'](function(_0xf939d9){logger[_0x5f02('0x12')](_0x5f02('0x21'),_0xf939d9[_0x5f02('0x15')],_0x58041c);_0x38c65f(_0x4bc523[_0x5f02('0x12')](0x1f4,_0xf939d9[_0x5f02('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index 08331b2..580a584 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 _0xbd38=['put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','/:id/descriptions','getDescriptions','post','create'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xbd38,0x130));var _0x8bd3=function(_0x10ddfa,_0x2a8311){_0x10ddfa=_0x10ddfa-0x0;var _0x3dce4b=_0xbd38[_0x10ddfa];return _0x3dce4b;};'use strict';var multer=require('multer');var util=require(_0x8bd3('0x0'));var path=require(_0x8bd3('0x1'));var timeout=require(_0x8bd3('0x2'));var express=require(_0x8bd3('0x3'));var router=express[_0x8bd3('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8bd3('0x5'));var interaction=require(_0x8bd3('0x6'));var config=require('../../config/environment');var controller=require(_0x8bd3('0x7'));router[_0x8bd3('0x8')]('/',auth[_0x8bd3('0x9')](),controller[_0x8bd3('0xa')]);router[_0x8bd3('0x8')](_0x8bd3('0xb'),auth[_0x8bd3('0x9')](),controller[_0x8bd3('0xc')]);router[_0x8bd3('0x8')]('/:id/fields',auth[_0x8bd3('0x9')](),controller['getFields']);router[_0x8bd3('0x8')](_0x8bd3('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x8bd3('0x8')](_0x8bd3('0xe'),auth[_0x8bd3('0x9')](),controller[_0x8bd3('0xf')]);router[_0x8bd3('0x10')]('/',auth['isAuthenticated'](),controller[_0x8bd3('0x11')]);router[_0x8bd3('0x12')](_0x8bd3('0xb'),auth[_0x8bd3('0x9')](),controller[_0x8bd3('0x13')]);router[_0x8bd3('0x14')](_0x8bd3('0xb'),auth[_0x8bd3('0x9')](),controller[_0x8bd3('0x15')]);module[_0x8bd3('0x16')]=router; \ No newline at end of file +var _0xbea2=['../../components/interaction/service','./intServicenowConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0xd7a401,_0x292d95){var _0x3acf2e=function(_0xceab2a){while(--_0xceab2a){_0xd7a401['push'](_0xd7a401['shift']());}};_0x3acf2e(++_0x292d95);}(_0xbea2,0x1da));var _0x2bea=function(_0x51568e,_0x111a42){_0x51568e=_0x51568e-0x0;var _0x126b86=_0xbea2[_0x51568e];return _0x126b86;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2bea('0x0'));var timeout=require(_0x2bea('0x1'));var express=require(_0x2bea('0x2'));var router=express[_0x2bea('0x3')]();var fs_extra=require(_0x2bea('0x4'));var auth=require(_0x2bea('0x5'));var interaction=require(_0x2bea('0x6'));var config=require('../../config/environment');var controller=require(_0x2bea('0x7'));router[_0x2bea('0x8')]('/',auth['isAuthenticated'](),controller[_0x2bea('0x9')]);router[_0x2bea('0x8')](_0x2bea('0xa'),auth[_0x2bea('0xb')](),controller[_0x2bea('0xc')]);router[_0x2bea('0x8')](_0x2bea('0xd'),auth[_0x2bea('0xb')](),controller[_0x2bea('0xe')]);router[_0x2bea('0x8')](_0x2bea('0xf'),auth['isAuthenticated'](),controller[_0x2bea('0x10')]);router[_0x2bea('0x8')](_0x2bea('0x11'),auth[_0x2bea('0xb')](),controller[_0x2bea('0x12')]);router[_0x2bea('0x13')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2bea('0x14')]('/:id',auth[_0x2bea('0xb')](),controller[_0x2bea('0x15')]);router[_0x2bea('0x16')](_0x2bea('0xa'),auth[_0x2bea('0xb')](),controller[_0x2bea('0x17')]);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 c5fc32f..7f52444 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 _0x666d=['STRING','sequelize','exports'];(function(_0x2e41e8,_0x4180f1){var _0xc80793=function(_0x5965eb){while(--_0x5965eb){_0x2e41e8['push'](_0x2e41e8['shift']());}};_0xc80793(++_0x4180f1);}(_0x666d,0x130));var _0xd666=function(_0x1c8c28,_0x3ee093){_0x1c8c28=_0x1c8c28-0x0;var _0x1f59b4=_0x666d[_0x1c8c28];return _0x1f59b4;};'use strict';var Sequelize=require(_0xd666('0x0'));module[_0xd666('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd666('0x2')]}}; \ No newline at end of file +var _0x3528=['exports','STRING','sequelize'];(function(_0x5231bf,_0x9e19a3){var _0x250914=function(_0x49a6e1){while(--_0x49a6e1){_0x5231bf['push'](_0x5231bf['shift']());}};_0x250914(++_0x9e19a3);}(_0x3528,0x131));var _0x8352=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x3528[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x8352('0x0'));module[_0x8352('0x1')]={'name':{'type':Sequelize[_0x8352('0x2')]},'description':{'type':Sequelize[_0x8352('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index 4f5b367..64c2366 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 _0xb6dc=['api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','rows','show','length','find','catch','create','body','params','findOne','ServicenowField','getFields','hasOwnProperty','getSubjects','order','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x3a57b0,_0x23145a){var _0x2b8f3e=function(_0x1c721a){while(--_0x1c721a){_0x3a57b0['push'](_0x3a57b0['shift']());}};_0x2b8f3e(++_0x23145a);}(_0xb6dc,0x1d9));var _0xcb6d=function(_0x3b98d5,_0x31167c){_0x3b98d5=_0x3b98d5-0x0;var _0x3054dc=_0xb6dc[_0x3b98d5];return _0x3054dc;};'use strict';var emlformat=require(_0xcb6d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcb6d('0x1'));var jsonpatch=require(_0xcb6d('0x2'));var rp=require(_0xcb6d('0x3'));var moment=require('moment');var BPromise=require(_0xcb6d('0x4'));var Mustache=require(_0xcb6d('0x5'));var util=require(_0xcb6d('0x6'));var path=require('path');var sox=require(_0xcb6d('0x7'));var csv=require(_0xcb6d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcb6d('0x9'));var _=require(_0xcb6d('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcb6d('0xb'));var deskjs=require(_0xcb6d('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcb6d('0xd'));var Papa=require(_0xcb6d('0xe'));var Redis=require(_0xcb6d('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xcb6d('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcb6d('0x11'));var logger=require(_0xcb6d('0x12'))(_0xcb6d('0x13'));var utils=require(_0xcb6d('0x14'));var config=require(_0xcb6d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xcb6d('0x16'))['db'];function respondWithStatusCode(_0x1ae5ba,_0x38da4f){_0x38da4f=_0x38da4f||0xcc;return function(_0x1e6f87){if(_0x1e6f87){return _0x1ae5ba['sendStatus'](_0x38da4f);}return _0x1ae5ba['status'](_0x38da4f)[_0xcb6d('0x17')]();};}function respondWithResult(_0x3b10a1,_0x58a89c){_0x58a89c=_0x58a89c||0xc8;return function(_0x408e97){if(_0x408e97){return _0x3b10a1['status'](_0x58a89c)[_0xcb6d('0x18')](_0x408e97);}};}function respondWithFilteredResult(_0x3e6ece,_0x367b60){return function(_0x2d392c){if(_0x2d392c){var _0x530a60=typeof _0x367b60[_0xcb6d('0x19')]===_0xcb6d('0x1a')&&typeof _0x367b60[_0xcb6d('0x1b')]===_0xcb6d('0x1a');var _0x5d4a1d=_0x2d392c[_0xcb6d('0x1c')];var _0x2e2d1c=_0x530a60?0x0:_0x367b60[_0xcb6d('0x19')];var _0x2c5e46=_0x530a60?_0x2d392c[_0xcb6d('0x1c')]:_0x367b60[_0xcb6d('0x19')]+_0x367b60[_0xcb6d('0x1b')];var _0x3c1ad5;if(_0x2c5e46>=_0x5d4a1d){_0x2c5e46=_0x5d4a1d;_0x3c1ad5=0xc8;}else{_0x3c1ad5=0xce;}_0x3e6ece[_0xcb6d('0x1d')](_0x3c1ad5);return _0x3e6ece[_0xcb6d('0x1e')](_0xcb6d('0x1f'),_0x2e2d1c+'-'+_0x2c5e46+'/'+_0x5d4a1d)[_0xcb6d('0x18')](_0x2d392c);}return null;};}function patchUpdates(_0x16dd2e){return function(_0x35b648){try{jsonpatch[_0xcb6d('0x20')](_0x35b648,_0x16dd2e,!![]);}catch(_0x41a284){return BPromise[_0xcb6d('0x21')](_0x41a284);}return _0x35b648[_0xcb6d('0x22')]();};}function saveUpdates(_0xf7dbda,_0xa9763b){return function(_0x3d3b59){if(_0x3d3b59){return _0x3d3b59[_0xcb6d('0x23')](_0xf7dbda)[_0xcb6d('0x24')](function(_0x3c5183){return _0x3c5183;});}return null;};}function removeEntity(_0x29552c,_0x1be487){return function(_0x320b76){if(_0x320b76){return _0x320b76[_0xcb6d('0x25')]()[_0xcb6d('0x24')](function(){_0x29552c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x42cbdf,_0x27cb53){return function(_0x488f4d){if(!_0x488f4d){_0x42cbdf[_0xcb6d('0x26')](0x194);}return _0x488f4d;};}function handleError(_0x284990,_0x5d3604){_0x5d3604=_0x5d3604||0x1f4;return function(_0x196aab){logger[_0xcb6d('0x27')](_0x196aab[_0xcb6d('0x28')]);if(_0x196aab[_0xcb6d('0x29')]){delete _0x196aab[_0xcb6d('0x29')];}_0x284990[_0xcb6d('0x1d')](_0x5d3604)[_0xcb6d('0x2a')](_0x196aab);};}exports[_0xcb6d('0x2b')]=function(_0x2f89dd,_0x5309bb){var _0x3cadf3={},_0x2c2fc9={},_0x507f8c={'count':0x0,'rows':[]};var _0x3a22a1=_['map'](db[_0xcb6d('0x2c')][_0xcb6d('0x2d')],function(_0x592bcf){return{'name':_0x592bcf[_0xcb6d('0x2e')],'type':_0x592bcf[_0xcb6d('0x2f')][_0xcb6d('0x30')]};});_0x2c2fc9['model']=_['map'](_0x3a22a1,_0xcb6d('0x29'));_0x2c2fc9[_0xcb6d('0x31')]=_[_0xcb6d('0x32')](_0x2f89dd[_0xcb6d('0x31')]);_0x2c2fc9[_0xcb6d('0x33')]=_[_0xcb6d('0x34')](_0x2c2fc9['model'],_0x2c2fc9[_0xcb6d('0x31')]);_0x3cadf3['attributes']=_['intersection'](_0x2c2fc9[_0xcb6d('0x35')],qs['fields'](_0x2f89dd[_0xcb6d('0x31')][_0xcb6d('0x36')]));_0x3cadf3[_0xcb6d('0x37')]=_0x3cadf3[_0xcb6d('0x37')]['length']?_0x3cadf3[_0xcb6d('0x37')]:_0x2c2fc9[_0xcb6d('0x35')];if(!_0x2f89dd[_0xcb6d('0x31')]['hasOwnProperty'](_0xcb6d('0x38'))){_0x3cadf3[_0xcb6d('0x1b')]=qs[_0xcb6d('0x1b')](_0x2f89dd[_0xcb6d('0x31')][_0xcb6d('0x1b')]);_0x3cadf3[_0xcb6d('0x19')]=qs[_0xcb6d('0x19')](_0x2f89dd['query'][_0xcb6d('0x19')]);}_0x3cadf3['order']=qs[_0xcb6d('0x39')](_0x2f89dd[_0xcb6d('0x31')][_0xcb6d('0x39')]);_0x3cadf3[_0xcb6d('0x3a')]=qs[_0xcb6d('0x33')](_[_0xcb6d('0x3b')](_0x2f89dd[_0xcb6d('0x31')],_0x2c2fc9[_0xcb6d('0x33')]),_0x3a22a1);if(_0x2f89dd[_0xcb6d('0x31')][_0xcb6d('0x3c')]){_0x3cadf3[_0xcb6d('0x3a')]=_[_0xcb6d('0x3d')](_0x3cadf3['where'],{'$or':_[_0xcb6d('0x3e')](_0x3a22a1,function(_0x199a08){if(_0x199a08[_0xcb6d('0x2f')]!==_0xcb6d('0x3f')){var _0x21c8db={};_0x21c8db[_0x199a08[_0xcb6d('0x29')]]={'$like':'%'+_0x2f89dd[_0xcb6d('0x31')][_0xcb6d('0x3c')]+'%'};return _0x21c8db;}})});}_0x3cadf3=_[_0xcb6d('0x3d')]({},_0x3cadf3,_0x2f89dd[_0xcb6d('0x40')]);var _0x2a2cd6={'where':_0x3cadf3[_0xcb6d('0x3a')]};return db['ServicenowConfiguration'][_0xcb6d('0x1c')](_0x2a2cd6)[_0xcb6d('0x24')](function(_0x28a902){_0x507f8c[_0xcb6d('0x1c')]=_0x28a902;if(_0x2f89dd[_0xcb6d('0x31')][_0xcb6d('0x41')]){_0x3cadf3[_0xcb6d('0x42')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x3cadf3);})['then'](function(_0x857152){_0x507f8c[_0xcb6d('0x43')]=_0x857152;return _0x507f8c;})['then'](respondWithFilteredResult(_0x5309bb,_0x3cadf3))['catch'](handleError(_0x5309bb,null));};exports[_0xcb6d('0x44')]=function(_0x162a55,_0x114ed4){var _0x3e30a3={'raw':![],'where':{'id':_0x162a55['params']['id']}},_0x528002={};_0x528002[_0xcb6d('0x35')]=_[_0xcb6d('0x32')](db['ServicenowConfiguration'][_0xcb6d('0x2d')]);_0x528002['query']=_['keys'](_0x162a55[_0xcb6d('0x31')]);_0x528002[_0xcb6d('0x33')]=_['intersection'](_0x528002[_0xcb6d('0x35')],_0x528002['query']);_0x3e30a3[_0xcb6d('0x37')]=_['intersection'](_0x528002[_0xcb6d('0x35')],qs[_0xcb6d('0x36')](_0x162a55['query'][_0xcb6d('0x36')]));_0x3e30a3['attributes']=_0x3e30a3[_0xcb6d('0x37')][_0xcb6d('0x45')]?_0x3e30a3['attributes']:_0x528002[_0xcb6d('0x35')];if(_0x162a55[_0xcb6d('0x31')]['includeAll']){_0x3e30a3['include']=[{'all':!![]}];}_0x3e30a3=_[_0xcb6d('0x3d')]({},_0x3e30a3,_0x162a55[_0xcb6d('0x40')]);return db['ServicenowConfiguration'][_0xcb6d('0x46')](_0x3e30a3)[_0xcb6d('0x24')](handleEntityNotFound(_0x114ed4,null))[_0xcb6d('0x24')](respondWithResult(_0x114ed4,null))[_0xcb6d('0x47')](handleError(_0x114ed4,null));};exports['create']=function(_0x40cbc3,_0x1a76cd){return db[_0xcb6d('0x2c')][_0xcb6d('0x48')](_0x40cbc3[_0xcb6d('0x49')],{})[_0xcb6d('0x24')](respondWithResult(_0x1a76cd,0xc9))['catch'](handleError(_0x1a76cd,null));};exports['update']=function(_0x50ecd4,_0x1d9bfb){if(_0x50ecd4['body']['id']){delete _0x50ecd4[_0xcb6d('0x49')]['id'];}return db[_0xcb6d('0x2c')][_0xcb6d('0x46')]({'where':{'id':_0x50ecd4[_0xcb6d('0x4a')]['id']}})[_0xcb6d('0x24')](handleEntityNotFound(_0x1d9bfb,null))[_0xcb6d('0x24')](saveUpdates(_0x50ecd4[_0xcb6d('0x49')],null))[_0xcb6d('0x24')](respondWithResult(_0x1d9bfb,null))['catch'](handleError(_0x1d9bfb,null));};exports[_0xcb6d('0x25')]=function(_0x1ccf12,_0x4fb26f){return db[_0xcb6d('0x2c')][_0xcb6d('0x46')]({'where':{'id':_0x1ccf12['params']['id']}})[_0xcb6d('0x24')](handleEntityNotFound(_0x4fb26f,null))[_0xcb6d('0x24')](removeEntity(_0x4fb26f,null))[_0xcb6d('0x47')](handleError(_0x4fb26f,null));};exports['getFields']=function(_0x49b11b,_0x5256de,_0x24a4d0){var _0x2ca54b={};var _0x5e1188={};var _0x41eebc;var _0x23f8a9;return db[_0xcb6d('0x2c')][_0xcb6d('0x4b')]({'where':{'id':_0x49b11b[_0xcb6d('0x4a')]['id']}})[_0xcb6d('0x24')](handleEntityNotFound(_0x5256de,null))[_0xcb6d('0x24')](function(_0xbb44e7){if(_0xbb44e7){_0x41eebc=_0xbb44e7;_0x5e1188[_0xcb6d('0x35')]=_[_0xcb6d('0x32')](db[_0xcb6d('0x4c')][_0xcb6d('0x2d')]);_0x5e1188[_0xcb6d('0x31')]=_[_0xcb6d('0x32')](_0x49b11b[_0xcb6d('0x31')]);_0x5e1188['filters']=_[_0xcb6d('0x34')](_0x5e1188[_0xcb6d('0x35')],_0x5e1188[_0xcb6d('0x31')]);_0x2ca54b[_0xcb6d('0x37')]=_[_0xcb6d('0x34')](_0x5e1188[_0xcb6d('0x35')],qs[_0xcb6d('0x36')](_0x49b11b['query'][_0xcb6d('0x36')]));_0x2ca54b[_0xcb6d('0x37')]=_0x2ca54b[_0xcb6d('0x37')][_0xcb6d('0x45')]?_0x2ca54b[_0xcb6d('0x37')]:_0x5e1188[_0xcb6d('0x35')];_0x2ca54b['order']=qs[_0xcb6d('0x39')](_0x49b11b[_0xcb6d('0x31')][_0xcb6d('0x39')]);_0x2ca54b['where']=qs[_0xcb6d('0x33')](_[_0xcb6d('0x3b')](_0x49b11b[_0xcb6d('0x31')],_0x5e1188[_0xcb6d('0x33')]));if(_0x49b11b[_0xcb6d('0x31')][_0xcb6d('0x3c')]){_0x2ca54b['where']=_['merge'](_0x2ca54b['where'],{'$or':_[_0xcb6d('0x3e')](_0x2ca54b[_0xcb6d('0x37')],function(_0x231aec){var _0x2d3ad2={};_0x2d3ad2[_0x231aec]={'$like':'%'+_0x49b11b[_0xcb6d('0x31')][_0xcb6d('0x3c')]+'%'};return _0x2d3ad2;})});}_0x2ca54b=_[_0xcb6d('0x3d')]({},_0x2ca54b,_0x49b11b[_0xcb6d('0x40')]);return _0x41eebc[_0xcb6d('0x4d')](_0x2ca54b);}})[_0xcb6d('0x24')](function(_0xbbe69a){if(_0xbbe69a){_0x23f8a9=_0xbbe69a[_0xcb6d('0x45')];if(!_0x49b11b['query'][_0xcb6d('0x4e')](_0xcb6d('0x38'))){_0x2ca54b[_0xcb6d('0x1b')]=qs[_0xcb6d('0x1b')](_0x49b11b['query'][_0xcb6d('0x1b')]);_0x2ca54b['offset']=qs['offset'](_0x49b11b[_0xcb6d('0x31')][_0xcb6d('0x19')]);}return _0x41eebc[_0xcb6d('0x4d')](_0x2ca54b);}})[_0xcb6d('0x24')](function(_0x8be9d2){if(_0x8be9d2){return _0x8be9d2?{'count':_0x23f8a9,'rows':_0x8be9d2}:null;}})[_0xcb6d('0x24')](respondWithResult(_0x5256de,null))[_0xcb6d('0x47')](handleError(_0x5256de,null));};exports[_0xcb6d('0x4f')]=function(_0x1b91ce,_0x4222bb,_0xe67655){var _0x38ff00={};var _0xcc6cee={};var _0x5116a5;var _0x2e8288;return db[_0xcb6d('0x2c')][_0xcb6d('0x4b')]({'where':{'id':_0x1b91ce['params']['id']}})[_0xcb6d('0x24')](handleEntityNotFound(_0x4222bb,null))[_0xcb6d('0x24')](function(_0x437b1a){if(_0x437b1a){_0x5116a5=_0x437b1a;_0xcc6cee[_0xcb6d('0x35')]=_[_0xcb6d('0x32')](db[_0xcb6d('0x4c')]['rawAttributes']);_0xcc6cee[_0xcb6d('0x31')]=_[_0xcb6d('0x32')](_0x1b91ce[_0xcb6d('0x31')]);_0xcc6cee['filters']=_[_0xcb6d('0x34')](_0xcc6cee[_0xcb6d('0x35')],_0xcc6cee[_0xcb6d('0x31')]);_0x38ff00[_0xcb6d('0x37')]=_[_0xcb6d('0x34')](_0xcc6cee['model'],qs['fields'](_0x1b91ce[_0xcb6d('0x31')][_0xcb6d('0x36')]));_0x38ff00[_0xcb6d('0x37')]=_0x38ff00[_0xcb6d('0x37')]['length']?_0x38ff00[_0xcb6d('0x37')]:_0xcc6cee[_0xcb6d('0x35')];_0x38ff00[_0xcb6d('0x50')]=qs[_0xcb6d('0x39')](_0x1b91ce[_0xcb6d('0x31')][_0xcb6d('0x39')]);_0x38ff00[_0xcb6d('0x3a')]=qs['filters'](_['pick'](_0x1b91ce[_0xcb6d('0x31')],_0xcc6cee[_0xcb6d('0x33')]));if(_0x1b91ce['query']['filter']){_0x38ff00[_0xcb6d('0x3a')]=_[_0xcb6d('0x3d')](_0x38ff00[_0xcb6d('0x3a')],{'$or':_[_0xcb6d('0x3e')](_0x38ff00['attributes'],function(_0x5a3879){var _0x1c0273={};_0x1c0273[_0x5a3879]={'$like':'%'+_0x1b91ce[_0xcb6d('0x31')][_0xcb6d('0x3c')]+'%'};return _0x1c0273;})});}_0x38ff00=_[_0xcb6d('0x3d')]({},_0x38ff00,_0x1b91ce['options']);return _0x5116a5['getSubjects'](_0x38ff00);}})[_0xcb6d('0x24')](function(_0x2d4079){if(_0x2d4079){_0x2e8288=_0x2d4079[_0xcb6d('0x45')];if(!_0x1b91ce[_0xcb6d('0x31')][_0xcb6d('0x4e')](_0xcb6d('0x38'))){_0x38ff00[_0xcb6d('0x1b')]=qs['limit'](_0x1b91ce[_0xcb6d('0x31')][_0xcb6d('0x1b')]);_0x38ff00[_0xcb6d('0x19')]=qs[_0xcb6d('0x19')](_0x1b91ce['query'][_0xcb6d('0x19')]);}return _0x5116a5[_0xcb6d('0x4f')](_0x38ff00);}})[_0xcb6d('0x24')](function(_0x233293){if(_0x233293){return _0x233293?{'count':_0x2e8288,'rows':_0x233293}:null;}})['then'](respondWithResult(_0x4222bb,null))[_0xcb6d('0x47')](handleError(_0x4222bb,null));};exports[_0xcb6d('0x51')]=function(_0x320315,_0x46df46,_0x1c0637){var _0x374977={};var _0x5bfced={};var _0x2919d5;var _0x3ddfc8;return db[_0xcb6d('0x2c')]['findOne']({'where':{'id':_0x320315[_0xcb6d('0x4a')]['id']}})[_0xcb6d('0x24')](handleEntityNotFound(_0x46df46,null))['then'](function(_0x544cf5){if(_0x544cf5){_0x2919d5=_0x544cf5;_0x5bfced[_0xcb6d('0x35')]=_[_0xcb6d('0x32')](db[_0xcb6d('0x4c')]['rawAttributes']);_0x5bfced['query']=_[_0xcb6d('0x32')](_0x320315[_0xcb6d('0x31')]);_0x5bfced[_0xcb6d('0x33')]=_[_0xcb6d('0x34')](_0x5bfced['model'],_0x5bfced[_0xcb6d('0x31')]);_0x374977[_0xcb6d('0x37')]=_['intersection'](_0x5bfced['model'],qs[_0xcb6d('0x36')](_0x320315[_0xcb6d('0x31')][_0xcb6d('0x36')]));_0x374977[_0xcb6d('0x37')]=_0x374977[_0xcb6d('0x37')]['length']?_0x374977['attributes']:_0x5bfced[_0xcb6d('0x35')];_0x374977[_0xcb6d('0x50')]=qs['sort'](_0x320315[_0xcb6d('0x31')][_0xcb6d('0x39')]);_0x374977['where']=qs['filters'](_[_0xcb6d('0x3b')](_0x320315[_0xcb6d('0x31')],_0x5bfced[_0xcb6d('0x33')]));if(_0x320315[_0xcb6d('0x31')][_0xcb6d('0x3c')]){_0x374977['where']=_[_0xcb6d('0x3d')](_0x374977['where'],{'$or':_[_0xcb6d('0x3e')](_0x374977['attributes'],function(_0x3647df){var _0x36bc64={};_0x36bc64[_0x3647df]={'$like':'%'+_0x320315['query'][_0xcb6d('0x3c')]+'%'};return _0x36bc64;})});}_0x374977=_[_0xcb6d('0x3d')]({},_0x374977,_0x320315['options']);return _0x2919d5[_0xcb6d('0x51')](_0x374977);}})[_0xcb6d('0x24')](function(_0x3ad8b4){if(_0x3ad8b4){_0x3ddfc8=_0x3ad8b4[_0xcb6d('0x45')];if(!_0x320315[_0xcb6d('0x31')][_0xcb6d('0x4e')](_0xcb6d('0x38'))){_0x374977[_0xcb6d('0x1b')]=qs[_0xcb6d('0x1b')](_0x320315[_0xcb6d('0x31')][_0xcb6d('0x1b')]);_0x374977[_0xcb6d('0x19')]=qs[_0xcb6d('0x19')](_0x320315[_0xcb6d('0x31')][_0xcb6d('0x19')]);}return _0x2919d5['getDescriptions'](_0x374977);}})[_0xcb6d('0x24')](function(_0x2640f7){if(_0x2640f7){return _0x2640f7?{'count':_0x3ddfc8,'rows':_0x2640f7}:null;}})[_0xcb6d('0x24')](respondWithResult(_0x46df46,null))['catch'](handleError(_0x46df46,null));}; \ No newline at end of file +var _0x504d=['sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','catch','show','options','create','body','update','find','params','destroy','getFields','findOne','ServicenowField','getSubjects','nolimit','getDescriptions','eml-format','zip-dir','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','reject','then','end','name','index','map','ServicenowConfiguration','rawAttributes','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty'];(function(_0x24e51a,_0x2db38f){var _0x4eb61a=function(_0x598b54){while(--_0x598b54){_0x24e51a['push'](_0x24e51a['shift']());}};_0x4eb61a(++_0x2db38f);}(_0x504d,0x1bc));var _0xd504=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x504d[_0x243b2f];return _0xcb3c2d;};'use strict';var emlformat=require(_0xd504('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd504('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd504('0x2'));var BPromise=require(_0xd504('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd504('0x4'));var sox=require(_0xd504('0x5'));var csv=require(_0xd504('0x6'));var ejs=require(_0xd504('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd504('0x8'));var squel=require(_0xd504('0x9'));var crypto=require(_0xd504('0xa'));var jsforce=require(_0xd504('0xb'));var deskjs=require(_0xd504('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd504('0xd'));var Redis=require('ioredis');var authService=require(_0xd504('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xd504('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd504('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xd504('0x11'));var licenseUtil=require(_0xd504('0x12'));var db=require(_0xd504('0x13'))['db'];function respondWithStatusCode(_0x161a63,_0x3356f8){_0x3356f8=_0x3356f8||0xcc;return function(_0x5ba289){if(_0x5ba289){return _0x161a63[_0xd504('0x14')](_0x3356f8);}return _0x161a63[_0xd504('0x15')](_0x3356f8)['end']();};}function respondWithResult(_0x34ca07,_0x539aeb){_0x539aeb=_0x539aeb||0xc8;return function(_0x15064c){if(_0x15064c){return _0x34ca07[_0xd504('0x15')](_0x539aeb)[_0xd504('0x16')](_0x15064c);}};}function respondWithFilteredResult(_0x46d748,_0x4178e1){return function(_0x1b49ae){if(_0x1b49ae){var _0x554836=typeof _0x4178e1['offset']===_0xd504('0x17')&&typeof _0x4178e1[_0xd504('0x18')]==='undefined';var _0x2b341b=_0x1b49ae[_0xd504('0x19')];var _0x2839f8=_0x554836?0x0:_0x4178e1[_0xd504('0x1a')];var _0x3f6cae=_0x554836?_0x1b49ae[_0xd504('0x19')]:_0x4178e1[_0xd504('0x1a')]+_0x4178e1[_0xd504('0x18')];var _0x128239;if(_0x3f6cae>=_0x2b341b){_0x3f6cae=_0x2b341b;_0x128239=0xc8;}else{_0x128239=0xce;}_0x46d748[_0xd504('0x15')](_0x128239);return _0x46d748['set'](_0xd504('0x1b'),_0x2839f8+'-'+_0x3f6cae+'/'+_0x2b341b)[_0xd504('0x16')](_0x1b49ae);}return null;};}function patchUpdates(_0x407e7f){return function(_0x412de8){try{jsonpatch[_0xd504('0x1c')](_0x412de8,_0x407e7f,!![]);}catch(_0x1a5674){return BPromise[_0xd504('0x1d')](_0x1a5674);}return _0x412de8['save']();};}function saveUpdates(_0x15bebf,_0x3c6303){return function(_0x2f90ac){if(_0x2f90ac){return _0x2f90ac['update'](_0x15bebf)[_0xd504('0x1e')](function(_0x5393a1){return _0x5393a1;});}return null;};}function removeEntity(_0x306b67,_0x28f10e){return function(_0x31b830){if(_0x31b830){return _0x31b830['destroy']()[_0xd504('0x1e')](function(){_0x306b67[_0xd504('0x15')](0xcc)[_0xd504('0x1f')]();});}};}function handleEntityNotFound(_0xc8e7cc,_0x3d6ffa){return function(_0x587d89){if(!_0x587d89){_0xc8e7cc[_0xd504('0x14')](0x194);}return _0x587d89;};}function handleError(_0x5d09b6,_0x3dab4e){_0x3dab4e=_0x3dab4e||0x1f4;return function(_0x421a12){logger['error'](_0x421a12['stack']);if(_0x421a12[_0xd504('0x20')]){delete _0x421a12['name'];}_0x5d09b6[_0xd504('0x15')](_0x3dab4e)['send'](_0x421a12);};}exports[_0xd504('0x21')]=function(_0x458be3,_0x2d33b4){var _0x2aa339={},_0x596928={},_0x4355c7={'count':0x0,'rows':[]};var _0x5322da=_[_0xd504('0x22')](db[_0xd504('0x23')][_0xd504('0x24')],function(_0x1ea1ff){return{'name':_0x1ea1ff['fieldName'],'type':_0x1ea1ff['type']['key']};});_0x596928[_0xd504('0x25')]=_[_0xd504('0x22')](_0x5322da,_0xd504('0x20'));_0x596928[_0xd504('0x26')]=_[_0xd504('0x27')](_0x458be3['query']);_0x596928[_0xd504('0x28')]=_[_0xd504('0x29')](_0x596928[_0xd504('0x25')],_0x596928[_0xd504('0x26')]);_0x2aa339['attributes']=_['intersection'](_0x596928['model'],qs[_0xd504('0x2a')](_0x458be3[_0xd504('0x26')][_0xd504('0x2a')]));_0x2aa339[_0xd504('0x2b')]=_0x2aa339[_0xd504('0x2b')][_0xd504('0x2c')]?_0x2aa339[_0xd504('0x2b')]:_0x596928[_0xd504('0x25')];if(!_0x458be3[_0xd504('0x26')][_0xd504('0x2d')]('nolimit')){_0x2aa339[_0xd504('0x18')]=qs[_0xd504('0x18')](_0x458be3[_0xd504('0x26')][_0xd504('0x18')]);_0x2aa339['offset']=qs[_0xd504('0x1a')](_0x458be3['query'][_0xd504('0x1a')]);}_0x2aa339['order']=qs[_0xd504('0x2e')](_0x458be3[_0xd504('0x26')]['sort']);_0x2aa339[_0xd504('0x2f')]=qs[_0xd504('0x28')](_[_0xd504('0x30')](_0x458be3[_0xd504('0x26')],_0x596928[_0xd504('0x28')]),_0x5322da);if(_0x458be3[_0xd504('0x26')][_0xd504('0x31')]){_0x2aa339[_0xd504('0x2f')]=_[_0xd504('0x32')](_0x2aa339['where'],{'$or':_[_0xd504('0x22')](_0x5322da,function(_0x4982d9){if(_0x4982d9[_0xd504('0x33')]!==_0xd504('0x34')){var _0x30879e={};_0x30879e[_0x4982d9['name']]={'$like':'%'+_0x458be3[_0xd504('0x26')]['filter']+'%'};return _0x30879e;}})});}_0x2aa339=_[_0xd504('0x32')]({},_0x2aa339,_0x458be3['options']);var _0x32b3c8={'where':_0x2aa339['where']};return db[_0xd504('0x23')]['count'](_0x32b3c8)['then'](function(_0x423473){_0x4355c7[_0xd504('0x19')]=_0x423473;if(_0x458be3['query'][_0xd504('0x35')]){_0x2aa339[_0xd504('0x36')]=[{'all':!![]}];}return db['ServicenowConfiguration']['findAll'](_0x2aa339);})[_0xd504('0x1e')](function(_0x3f6007){_0x4355c7['rows']=_0x3f6007;return _0x4355c7;})['then'](respondWithFilteredResult(_0x2d33b4,_0x2aa339))[_0xd504('0x37')](handleError(_0x2d33b4,null));};exports[_0xd504('0x38')]=function(_0x13fb3f,_0xefdcc4){var _0x443460={'raw':![],'where':{'id':_0x13fb3f['params']['id']}},_0x26e9d4={};_0x26e9d4[_0xd504('0x25')]=_[_0xd504('0x27')](db[_0xd504('0x23')][_0xd504('0x24')]);_0x26e9d4['query']=_[_0xd504('0x27')](_0x13fb3f[_0xd504('0x26')]);_0x26e9d4[_0xd504('0x28')]=_[_0xd504('0x29')](_0x26e9d4[_0xd504('0x25')],_0x26e9d4[_0xd504('0x26')]);_0x443460['attributes']=_['intersection'](_0x26e9d4['model'],qs[_0xd504('0x2a')](_0x13fb3f['query']['fields']));_0x443460[_0xd504('0x2b')]=_0x443460[_0xd504('0x2b')][_0xd504('0x2c')]?_0x443460[_0xd504('0x2b')]:_0x26e9d4[_0xd504('0x25')];if(_0x13fb3f[_0xd504('0x26')][_0xd504('0x35')]){_0x443460[_0xd504('0x36')]=[{'all':!![]}];}_0x443460=_['merge']({},_0x443460,_0x13fb3f[_0xd504('0x39')]);return db[_0xd504('0x23')]['find'](_0x443460)['then'](handleEntityNotFound(_0xefdcc4,null))['then'](respondWithResult(_0xefdcc4,null))[_0xd504('0x37')](handleError(_0xefdcc4,null));};exports[_0xd504('0x3a')]=function(_0x29f13f,_0x20f316){return db[_0xd504('0x23')]['create'](_0x29f13f[_0xd504('0x3b')],{})[_0xd504('0x1e')](respondWithResult(_0x20f316,0xc9))[_0xd504('0x37')](handleError(_0x20f316,null));};exports[_0xd504('0x3c')]=function(_0x5f1cba,_0x5a3307){if(_0x5f1cba[_0xd504('0x3b')]['id']){delete _0x5f1cba[_0xd504('0x3b')]['id'];}return db['ServicenowConfiguration'][_0xd504('0x3d')]({'where':{'id':_0x5f1cba[_0xd504('0x3e')]['id']}})[_0xd504('0x1e')](handleEntityNotFound(_0x5a3307,null))['then'](saveUpdates(_0x5f1cba[_0xd504('0x3b')],null))[_0xd504('0x1e')](respondWithResult(_0x5a3307,null))[_0xd504('0x37')](handleError(_0x5a3307,null));};exports[_0xd504('0x3f')]=function(_0x4e04e8,_0x3918e1){return db['ServicenowConfiguration'][_0xd504('0x3d')]({'where':{'id':_0x4e04e8[_0xd504('0x3e')]['id']}})[_0xd504('0x1e')](handleEntityNotFound(_0x3918e1,null))[_0xd504('0x1e')](removeEntity(_0x3918e1,null))[_0xd504('0x37')](handleError(_0x3918e1,null));};exports[_0xd504('0x40')]=function(_0x3994d0,_0x40ef19,_0x90d3e8){var _0x2b9258={};var _0x56dc74={};var _0x3dc0c3;var _0x3ecd8a;return db[_0xd504('0x23')][_0xd504('0x41')]({'where':{'id':_0x3994d0[_0xd504('0x3e')]['id']}})[_0xd504('0x1e')](handleEntityNotFound(_0x40ef19,null))[_0xd504('0x1e')](function(_0x4c2ac9){if(_0x4c2ac9){_0x3dc0c3=_0x4c2ac9;_0x56dc74[_0xd504('0x25')]=_['keys'](db[_0xd504('0x42')]['rawAttributes']);_0x56dc74[_0xd504('0x26')]=_[_0xd504('0x27')](_0x3994d0[_0xd504('0x26')]);_0x56dc74[_0xd504('0x28')]=_[_0xd504('0x29')](_0x56dc74['model'],_0x56dc74['query']);_0x2b9258[_0xd504('0x2b')]=_[_0xd504('0x29')](_0x56dc74[_0xd504('0x25')],qs['fields'](_0x3994d0[_0xd504('0x26')]['fields']));_0x2b9258[_0xd504('0x2b')]=_0x2b9258[_0xd504('0x2b')]['length']?_0x2b9258[_0xd504('0x2b')]:_0x56dc74[_0xd504('0x25')];_0x2b9258['order']=qs[_0xd504('0x2e')](_0x3994d0[_0xd504('0x26')]['sort']);_0x2b9258['where']=qs[_0xd504('0x28')](_[_0xd504('0x30')](_0x3994d0[_0xd504('0x26')],_0x56dc74[_0xd504('0x28')]));if(_0x3994d0[_0xd504('0x26')][_0xd504('0x31')]){_0x2b9258[_0xd504('0x2f')]=_['merge'](_0x2b9258[_0xd504('0x2f')],{'$or':_['map'](_0x2b9258[_0xd504('0x2b')],function(_0x2e5eee){var _0x4f76cb={};_0x4f76cb[_0x2e5eee]={'$like':'%'+_0x3994d0[_0xd504('0x26')][_0xd504('0x31')]+'%'};return _0x4f76cb;})});}_0x2b9258=_['merge']({},_0x2b9258,_0x3994d0['options']);return _0x3dc0c3['getFields'](_0x2b9258);}})[_0xd504('0x1e')](function(_0xf04136){if(_0xf04136){_0x3ecd8a=_0xf04136[_0xd504('0x2c')];if(!_0x3994d0[_0xd504('0x26')][_0xd504('0x2d')]('nolimit')){_0x2b9258[_0xd504('0x18')]=qs[_0xd504('0x18')](_0x3994d0[_0xd504('0x26')][_0xd504('0x18')]);_0x2b9258[_0xd504('0x1a')]=qs[_0xd504('0x1a')](_0x3994d0[_0xd504('0x26')][_0xd504('0x1a')]);}return _0x3dc0c3['getFields'](_0x2b9258);}})[_0xd504('0x1e')](function(_0x541b22){if(_0x541b22){return _0x541b22?{'count':_0x3ecd8a,'rows':_0x541b22}:null;}})[_0xd504('0x1e')](respondWithResult(_0x40ef19,null))[_0xd504('0x37')](handleError(_0x40ef19,null));};exports[_0xd504('0x43')]=function(_0x2be231,_0xd76fc5,_0xc6a305){var _0x46a3c0={};var _0x572de2={};var _0x199221;var _0x1d9892;return db[_0xd504('0x23')][_0xd504('0x41')]({'where':{'id':_0x2be231[_0xd504('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd76fc5,null))[_0xd504('0x1e')](function(_0x295481){if(_0x295481){_0x199221=_0x295481;_0x572de2[_0xd504('0x25')]=_[_0xd504('0x27')](db[_0xd504('0x42')][_0xd504('0x24')]);_0x572de2[_0xd504('0x26')]=_[_0xd504('0x27')](_0x2be231[_0xd504('0x26')]);_0x572de2[_0xd504('0x28')]=_[_0xd504('0x29')](_0x572de2[_0xd504('0x25')],_0x572de2['query']);_0x46a3c0[_0xd504('0x2b')]=_['intersection'](_0x572de2[_0xd504('0x25')],qs[_0xd504('0x2a')](_0x2be231[_0xd504('0x26')][_0xd504('0x2a')]));_0x46a3c0[_0xd504('0x2b')]=_0x46a3c0[_0xd504('0x2b')][_0xd504('0x2c')]?_0x46a3c0[_0xd504('0x2b')]:_0x572de2[_0xd504('0x25')];_0x46a3c0['order']=qs[_0xd504('0x2e')](_0x2be231[_0xd504('0x26')][_0xd504('0x2e')]);_0x46a3c0[_0xd504('0x2f')]=qs['filters'](_[_0xd504('0x30')](_0x2be231[_0xd504('0x26')],_0x572de2[_0xd504('0x28')]));if(_0x2be231[_0xd504('0x26')][_0xd504('0x31')]){_0x46a3c0[_0xd504('0x2f')]=_[_0xd504('0x32')](_0x46a3c0[_0xd504('0x2f')],{'$or':_[_0xd504('0x22')](_0x46a3c0['attributes'],function(_0x4b32d9){var _0x7140fd={};_0x7140fd[_0x4b32d9]={'$like':'%'+_0x2be231['query'][_0xd504('0x31')]+'%'};return _0x7140fd;})});}_0x46a3c0=_['merge']({},_0x46a3c0,_0x2be231[_0xd504('0x39')]);return _0x199221[_0xd504('0x43')](_0x46a3c0);}})[_0xd504('0x1e')](function(_0x1023b1){if(_0x1023b1){_0x1d9892=_0x1023b1['length'];if(!_0x2be231[_0xd504('0x26')]['hasOwnProperty'](_0xd504('0x44'))){_0x46a3c0[_0xd504('0x18')]=qs[_0xd504('0x18')](_0x2be231['query'][_0xd504('0x18')]);_0x46a3c0[_0xd504('0x1a')]=qs[_0xd504('0x1a')](_0x2be231[_0xd504('0x26')][_0xd504('0x1a')]);}return _0x199221[_0xd504('0x43')](_0x46a3c0);}})['then'](function(_0x3f65d3){if(_0x3f65d3){return _0x3f65d3?{'count':_0x1d9892,'rows':_0x3f65d3}:null;}})['then'](respondWithResult(_0xd76fc5,null))[_0xd504('0x37')](handleError(_0xd76fc5,null));};exports['getDescriptions']=function(_0x2bb827,_0x479444,_0x48d27d){var _0x5d4f44={};var _0x3d6971={};var _0x86976c;var _0x559fc5;return db[_0xd504('0x23')][_0xd504('0x41')]({'where':{'id':_0x2bb827[_0xd504('0x3e')]['id']}})['then'](handleEntityNotFound(_0x479444,null))[_0xd504('0x1e')](function(_0x9b6c55){if(_0x9b6c55){_0x86976c=_0x9b6c55;_0x3d6971['model']=_[_0xd504('0x27')](db[_0xd504('0x42')][_0xd504('0x24')]);_0x3d6971[_0xd504('0x26')]=_[_0xd504('0x27')](_0x2bb827[_0xd504('0x26')]);_0x3d6971[_0xd504('0x28')]=_[_0xd504('0x29')](_0x3d6971[_0xd504('0x25')],_0x3d6971[_0xd504('0x26')]);_0x5d4f44['attributes']=_['intersection'](_0x3d6971[_0xd504('0x25')],qs['fields'](_0x2bb827[_0xd504('0x26')][_0xd504('0x2a')]));_0x5d4f44[_0xd504('0x2b')]=_0x5d4f44[_0xd504('0x2b')][_0xd504('0x2c')]?_0x5d4f44[_0xd504('0x2b')]:_0x3d6971['model'];_0x5d4f44['order']=qs[_0xd504('0x2e')](_0x2bb827[_0xd504('0x26')]['sort']);_0x5d4f44[_0xd504('0x2f')]=qs['filters'](_[_0xd504('0x30')](_0x2bb827[_0xd504('0x26')],_0x3d6971[_0xd504('0x28')]));if(_0x2bb827['query'][_0xd504('0x31')]){_0x5d4f44['where']=_['merge'](_0x5d4f44[_0xd504('0x2f')],{'$or':_['map'](_0x5d4f44['attributes'],function(_0x57aff1){var _0x25a827={};_0x25a827[_0x57aff1]={'$like':'%'+_0x2bb827[_0xd504('0x26')]['filter']+'%'};return _0x25a827;})});}_0x5d4f44=_[_0xd504('0x32')]({},_0x5d4f44,_0x2bb827[_0xd504('0x39')]);return _0x86976c[_0xd504('0x45')](_0x5d4f44);}})['then'](function(_0x478096){if(_0x478096){_0x559fc5=_0x478096['length'];if(!_0x2bb827[_0xd504('0x26')][_0xd504('0x2d')]('nolimit')){_0x5d4f44[_0xd504('0x18')]=qs[_0xd504('0x18')](_0x2bb827[_0xd504('0x26')][_0xd504('0x18')]);_0x5d4f44[_0xd504('0x1a')]=qs['offset'](_0x2bb827[_0xd504('0x26')][_0xd504('0x1a')]);}return _0x86976c['getDescriptions'](_0x5d4f44);}})[_0xd504('0x1e')](function(_0x175512){if(_0x175512){return _0x175512?{'count':_0x559fc5,'rows':_0x175512}:null;}})[_0xd504('0x1e')](respondWithResult(_0x479444,null))['catch'](handleError(_0x479444,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 80088fa..628c4da 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 _0x726f=['../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','api','request-promise','path','rimraf'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x726f,0xa2));var _0xf726=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x726f[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xf726('0x0'));var util=require(_0xf726('0x1'));var logger=require('../../config/logger')(_0xf726('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf726('0x3'));var fs=require('fs');var path=require(_0xf726('0x4'));var rimraf=require(_0xf726('0x5'));var config=require(_0xf726('0x6'));var attributes=require(_0xf726('0x7'));module[_0xf726('0x8')]=function(_0x26ba00,_0x1cae3f){return _0x26ba00[_0xf726('0x9')](_0xf726('0xa'),attributes,{'tableName':_0xf726('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f75=['exports','define','ServicenowConfiguration','int_servicenow_configurations','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x1f75,0x13c));var _0x51f7=function(_0x4a7631,_0x2c85b9){_0x4a7631=_0x4a7631-0x0;var _0x1a5a6f=_0x1f75[_0x4a7631];return _0x1a5a6f;};'use strict';var _=require('lodash');var util=require(_0x51f7('0x0'));var logger=require(_0x51f7('0x1'))(_0x51f7('0x2'));var moment=require(_0x51f7('0x3'));var BPromise=require(_0x51f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x51f7('0x5'));var rimraf=require(_0x51f7('0x6'));var config=require(_0x51f7('0x7'));var attributes=require(_0x51f7('0x8'));module[_0x51f7('0x9')]=function(_0x1fe16a,_0x244646){return _0x1fe16a[_0x51f7('0xa')](_0x51f7('0xb'),attributes,{'tableName':_0x51f7('0xc'),'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 25e8b22..1ab1b76 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 _0x21ff=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','error','code','ServicenowConfiguration,\x20%s,\x20%s','message'];(function(_0x4ffb4f,_0x4b73af){var _0x1e28b8=function(_0x211420){while(--_0x211420){_0x4ffb4f['push'](_0x4ffb4f['shift']());}};_0x1e28b8(++_0x4b73af);}(_0x21ff,0x8c));var _0xf21f=function(_0x56fb33,_0x37be08){_0x56fb33=_0x56fb33-0x0;var _0x435ee4=_0x21ff[_0x56fb33];return _0x435ee4;};'use strict';var _=require(_0xf21f('0x0'));var util=require(_0xf21f('0x1'));var moment=require(_0xf21f('0x2'));var BPromise=require(_0xf21f('0x3'));var rs=require(_0xf21f('0x4'));var fs=require('fs');var Redis=require(_0xf21f('0x5'));var db=require(_0xf21f('0x6'))['db'];var utils=require(_0xf21f('0x7'));var logger=require(_0xf21f('0x8'))(_0xf21f('0x9'));var config=require(_0xf21f('0xa'));var jayson=require(_0xf21f('0xb'));var client=jayson[_0xf21f('0xc')][_0xf21f('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x5d82be,_0x4d3a6c,_0x2b5312){return new BPromise(function(_0x3d1f0f,_0x30fa7f){return client[_0xf21f('0xe')](_0x5d82be,_0x2b5312)['then'](function(_0x4a26c4){logger[_0xf21f('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x4d3a6c,_0xf21f('0x10'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x4d3a6c,_0xf21f('0x10'),JSON['stringify'](_0x4a26c4));if(_0x4a26c4[_0xf21f('0x11')]){if(_0x4a26c4[_0xf21f('0x11')][_0xf21f('0x12')]===0x1f4){logger[_0xf21f('0x11')](_0xf21f('0x13'),_0x4d3a6c,_0x4a26c4[_0xf21f('0x11')][_0xf21f('0x14')]);return _0x30fa7f(_0x4a26c4[_0xf21f('0x11')]['message']);}logger[_0xf21f('0x11')](_0xf21f('0x13'),_0x4d3a6c,_0x4a26c4[_0xf21f('0x11')]['message']);return _0x3d1f0f(_0x4a26c4[_0xf21f('0x11')][_0xf21f('0x14')]);}else{logger['info'](_0xf21f('0x13'),_0x4d3a6c,_0xf21f('0x10'));_0x3d1f0f(_0x4a26c4[_0xf21f('0x15')]['message']);}})[_0xf21f('0x16')](function(_0x92f6fb){logger[_0xf21f('0x11')](_0xf21f('0x13'),_0x4d3a6c,_0x92f6fb);_0x30fa7f(_0x92f6fb);});});} \ No newline at end of file +var _0x2cc4=['code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x2cc4,0xdd));var _0x42cc=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0x2cc4[_0x1ee351];return _0x245aaf;};'use strict';var _=require(_0x42cc('0x0'));var util=require(_0x42cc('0x1'));var moment=require(_0x42cc('0x2'));var BPromise=require(_0x42cc('0x3'));var rs=require(_0x42cc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x42cc('0x5'))['db'];var utils=require(_0x42cc('0x6'));var logger=require('../../config/logger')(_0x42cc('0x7'));var config=require(_0x42cc('0x8'));var jayson=require(_0x42cc('0x9'));var client=jayson[_0x42cc('0xa')][_0x42cc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4fc8d2,_0x31df59,_0xd28d27){return new BPromise(function(_0x1342f8,_0x272915){return client[_0x42cc('0xc')](_0x4fc8d2,_0xd28d27)[_0x42cc('0xd')](function(_0x4717b7){logger[_0x42cc('0xe')](_0x42cc('0xf'),_0x31df59,_0x42cc('0x10'));logger[_0x42cc('0x11')](_0x42cc('0x12'),_0x31df59,'request\x20sent',JSON['stringify'](_0x4717b7));if(_0x4717b7['error']){if(_0x4717b7['error'][_0x42cc('0x13')]===0x1f4){logger[_0x42cc('0x14')](_0x42cc('0xf'),_0x31df59,_0x4717b7[_0x42cc('0x14')]['message']);return _0x272915(_0x4717b7[_0x42cc('0x14')][_0x42cc('0x15')]);}logger[_0x42cc('0x14')](_0x42cc('0xf'),_0x31df59,_0x4717b7[_0x42cc('0x14')][_0x42cc('0x15')]);return _0x1342f8(_0x4717b7[_0x42cc('0x14')][_0x42cc('0x15')]);}else{logger['info'](_0x42cc('0xf'),_0x31df59,_0x42cc('0x10'));_0x1342f8(_0x4717b7[_0x42cc('0x16')][_0x42cc('0x15')]);}})[_0x42cc('0x17')](function(_0x5ad460){logger[_0x42cc('0x14')]('ServicenowConfiguration,\x20%s,\x20%s',_0x31df59,_0x5ad460);_0x272915(_0x5ad460);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index f3b2bec..3ba3978 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 _0xdd92=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','index','/:id','isAuthenticated','create','put','update','destroy','exports'];(function(_0x4eb20a,_0x289be0){var _0x4f625b=function(_0x5124af){while(--_0x5124af){_0x4eb20a['push'](_0x4eb20a['shift']());}};_0x4f625b(++_0x289be0);}(_0xdd92,0xd8));var _0x2dd9=function(_0x1573ea,_0x434f02){_0x1573ea=_0x1573ea-0x0;var _0x51c0e2=_0xdd92[_0x1573ea];return _0x51c0e2;};'use strict';var multer=require('multer');var util=require(_0x2dd9('0x0'));var path=require(_0x2dd9('0x1'));var timeout=require(_0x2dd9('0x2'));var express=require(_0x2dd9('0x3'));var router=express[_0x2dd9('0x4')]();var fs_extra=require(_0x2dd9('0x5'));var auth=require(_0x2dd9('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2dd9('0x7'));var controller=require(_0x2dd9('0x8'));router[_0x2dd9('0x9')]('/',auth['isAuthenticated'](),controller[_0x2dd9('0xa')]);router[_0x2dd9('0x9')](_0x2dd9('0xb'),auth[_0x2dd9('0xc')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x2dd9('0xd')]);router[_0x2dd9('0xe')](_0x2dd9('0xb'),auth['isAuthenticated'](),controller[_0x2dd9('0xf')]);router['delete'](_0x2dd9('0xb'),auth[_0x2dd9('0xc')](),controller[_0x2dd9('0x10')]);module[_0x2dd9('0x11')]=router; \ No newline at end of file +var _0x395f=['index','show','post','create','put','/:id','delete','destroy','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated'];(function(_0x36290e,_0x328f43){var _0x56eba4=function(_0x42369c){while(--_0x42369c){_0x36290e['push'](_0x36290e['shift']());}};_0x56eba4(++_0x328f43);}(_0x395f,0x1a8));var _0xf395=function(_0x32957d,_0x3266d1){_0x32957d=_0x32957d-0x0;var _0x82d9d7=_0x395f[_0x32957d];return _0x82d9d7;};'use strict';var multer=require(_0xf395('0x0'));var util=require(_0xf395('0x1'));var path=require('path');var timeout=require(_0xf395('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xf395('0x3'));var auth=require(_0xf395('0x4'));var interaction=require(_0xf395('0x5'));var config=require('../../config/environment');var controller=require('./intServicenowField.controller');router[_0xf395('0x6')]('/',auth[_0xf395('0x7')](),controller[_0xf395('0x8')]);router[_0xf395('0x6')]('/:id',auth[_0xf395('0x7')](),controller[_0xf395('0x9')]);router[_0xf395('0xa')]('/',auth[_0xf395('0x7')](),controller[_0xf395('0xb')]);router[_0xf395('0xc')](_0xf395('0xd'),auth[_0xf395('0x7')](),controller['update']);router[_0xf395('0xe')](_0xf395('0xd'),auth[_0xf395('0x7')](),controller[_0xf395('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 227377d..a6ae050 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 _0x89b7=['STRING','ENUM','BOOLEAN','string','variable','keyValue','picklist'];(function(_0x2bb8ee,_0x442912){var _0xb597e7=function(_0x8e55d6){while(--_0x8e55d6){_0x2bb8ee['push'](_0x2bb8ee['shift']());}};_0xb597e7(++_0x442912);}(_0x89b7,0x129));var _0x789b=function(_0x3fe393,_0x234a3a){_0x3fe393=_0x3fe393-0x0;var _0x534d14=_0x89b7[_0x3fe393];return _0x534d14;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x789b('0x0'),_0x789b('0x1'),'customVariable',_0x789b('0x2'),_0x789b('0x3')),'defaultValue':_0x789b('0x0')},'content':{'type':Sequelize[_0x789b('0x4')]},'key':{'type':Sequelize[_0x789b('0x4')]},'keyType':{'type':Sequelize[_0x789b('0x5')](_0x789b('0x0'),_0x789b('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0x789b('0x4')]},'idField':{'type':Sequelize[_0x789b('0x4')]},'nameField':{'type':Sequelize[_0x789b('0x4')]},'customField':{'type':Sequelize[_0x789b('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x789b('0x4')]}}; \ No newline at end of file +var _0xcf83=['STRING','customVariable','string','keyValue','picklist'];(function(_0x7881e1,_0x22fd9a){var _0x3f051d=function(_0x57768c){while(--_0x57768c){_0x7881e1['push'](_0x7881e1['shift']());}};_0x3f051d(++_0x22fd9a);}(_0xcf83,0xf2));var _0x3cf8=function(_0x1aaa79,_0x310c50){_0x1aaa79=_0x1aaa79-0x0;var _0x59a250=_0xcf83[_0x1aaa79];return _0x59a250;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize['ENUM'](_0x3cf8('0x0'),'variable','customVariable',_0x3cf8('0x1'),_0x3cf8('0x2')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3cf8('0x3')]},'key':{'type':Sequelize[_0x3cf8('0x3')]},'keyType':{'type':Sequelize['ENUM'](_0x3cf8('0x0'),'variable',_0x3cf8('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x3cf8('0x3')]},'nameField':{'type':Sequelize[_0x3cf8('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3cf8('0x3')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 2ebd963..d8245ba 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 _0xcee8=['send','index','map','ServicenowField','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','findAll','rows','catch','show','params','keys','rawAttributes','include','options','find','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name'];(function(_0x328052,_0x1f13b2){var _0x2cce53=function(_0x3140ad){while(--_0x3140ad){_0x328052['push'](_0x328052['shift']());}};_0x2cce53(++_0x1f13b2);}(_0xcee8,0x6d));var _0x8cee=function(_0x3059e8,_0x282ba8){_0x3059e8=_0x3059e8-0x0;var _0x389011=_0xcee8[_0x3059e8];return _0x389011;};'use strict';var emlformat=require(_0x8cee('0x0'));var rimraf=require(_0x8cee('0x1'));var zipdir=require(_0x8cee('0x2'));var jsonpatch=require(_0x8cee('0x3'));var rp=require('request-promise');var moment=require(_0x8cee('0x4'));var BPromise=require(_0x8cee('0x5'));var Mustache=require(_0x8cee('0x6'));var util=require(_0x8cee('0x7'));var path=require(_0x8cee('0x8'));var sox=require('sox');var csv=require(_0x8cee('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8cee('0xa'));var _=require(_0x8cee('0xb'));var squel=require('squel');var crypto=require(_0x8cee('0xc'));var jsforce=require(_0x8cee('0xd'));var deskjs=require(_0x8cee('0xe'));var toCsv=require(_0x8cee('0x9'));var querystring=require('querystring');var Papa=require(_0x8cee('0xf'));var Redis=require(_0x8cee('0x10'));var authService=require(_0x8cee('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8cee('0x12'));var hardwareService=require(_0x8cee('0x13'));var logger=require(_0x8cee('0x14'))(_0x8cee('0x15'));var utils=require(_0x8cee('0x16'));var config=require(_0x8cee('0x17'));var licenseUtil=require(_0x8cee('0x18'));var db=require(_0x8cee('0x19'))['db'];function respondWithStatusCode(_0x39c12c,_0x418dab){_0x418dab=_0x418dab||0xcc;return function(_0xe03ec1){if(_0xe03ec1){return _0x39c12c[_0x8cee('0x1a')](_0x418dab);}return _0x39c12c[_0x8cee('0x1b')](_0x418dab)[_0x8cee('0x1c')]();};}function respondWithResult(_0x4fded0,_0x4d3072){_0x4d3072=_0x4d3072||0xc8;return function(_0x4f5143){if(_0x4f5143){return _0x4fded0[_0x8cee('0x1b')](_0x4d3072)[_0x8cee('0x1d')](_0x4f5143);}};}function respondWithFilteredResult(_0x2cfbba,_0x3c9793){return function(_0x3c0cef){if(_0x3c0cef){var _0xd03d89=typeof _0x3c9793[_0x8cee('0x1e')]==='undefined'&&typeof _0x3c9793['limit']==='undefined';var _0x4ed712=_0x3c0cef[_0x8cee('0x1f')];var _0x557f5f=_0xd03d89?0x0:_0x3c9793['offset'];var _0x2b246b=_0xd03d89?_0x3c0cef['count']:_0x3c9793[_0x8cee('0x1e')]+_0x3c9793[_0x8cee('0x20')];var _0x3831e5;if(_0x2b246b>=_0x4ed712){_0x2b246b=_0x4ed712;_0x3831e5=0xc8;}else{_0x3831e5=0xce;}_0x2cfbba[_0x8cee('0x1b')](_0x3831e5);return _0x2cfbba[_0x8cee('0x21')](_0x8cee('0x22'),_0x557f5f+'-'+_0x2b246b+'/'+_0x4ed712)['json'](_0x3c0cef);}return null;};}function patchUpdates(_0x3f470f){return function(_0xdd026e){try{jsonpatch[_0x8cee('0x23')](_0xdd026e,_0x3f470f,!![]);}catch(_0x4e55d6){return BPromise[_0x8cee('0x24')](_0x4e55d6);}return _0xdd026e[_0x8cee('0x25')]();};}function saveUpdates(_0x3f77b5,_0x5f17a6){return function(_0x2c2bce){if(_0x2c2bce){return _0x2c2bce[_0x8cee('0x26')](_0x3f77b5)[_0x8cee('0x27')](function(_0x49c14c){return _0x49c14c;});}return null;};}function removeEntity(_0x5cb840,_0x1a900f){return function(_0x2829da){if(_0x2829da){return _0x2829da[_0x8cee('0x28')]()[_0x8cee('0x27')](function(){_0x5cb840[_0x8cee('0x1b')](0xcc)[_0x8cee('0x1c')]();});}};}function handleEntityNotFound(_0x539a41,_0xaced8d){return function(_0xbeb761){if(!_0xbeb761){_0x539a41[_0x8cee('0x1a')](0x194);}return _0xbeb761;};}function handleError(_0x40a9d5,_0x40db9a){_0x40db9a=_0x40db9a||0x1f4;return function(_0x3ddb8d){logger['error'](_0x3ddb8d[_0x8cee('0x29')]);if(_0x3ddb8d[_0x8cee('0x2a')]){delete _0x3ddb8d[_0x8cee('0x2a')];}_0x40a9d5[_0x8cee('0x1b')](_0x40db9a)[_0x8cee('0x2b')](_0x3ddb8d);};}exports[_0x8cee('0x2c')]=function(_0x54d871,_0x5adce8){var _0x54b807={},_0x54c62f={},_0x1611ee={'count':0x0,'rows':[]};var _0x3745ed=_[_0x8cee('0x2d')](db[_0x8cee('0x2e')]['rawAttributes'],function(_0x24ff4f){return{'name':_0x24ff4f[_0x8cee('0x2f')],'type':_0x24ff4f[_0x8cee('0x30')][_0x8cee('0x31')]};});_0x54c62f['model']=_['map'](_0x3745ed,'name');_0x54c62f[_0x8cee('0x32')]=_['keys'](_0x54d871[_0x8cee('0x32')]);_0x54c62f[_0x8cee('0x33')]=_['intersection'](_0x54c62f[_0x8cee('0x34')],_0x54c62f[_0x8cee('0x32')]);_0x54b807['attributes']=_[_0x8cee('0x35')](_0x54c62f['model'],qs[_0x8cee('0x36')](_0x54d871[_0x8cee('0x32')][_0x8cee('0x36')]));_0x54b807[_0x8cee('0x37')]=_0x54b807['attributes'][_0x8cee('0x38')]?_0x54b807[_0x8cee('0x37')]:_0x54c62f['model'];if(!_0x54d871['query'][_0x8cee('0x39')](_0x8cee('0x3a'))){_0x54b807[_0x8cee('0x20')]=qs[_0x8cee('0x20')](_0x54d871[_0x8cee('0x32')][_0x8cee('0x20')]);_0x54b807[_0x8cee('0x1e')]=qs[_0x8cee('0x1e')](_0x54d871['query'][_0x8cee('0x1e')]);}_0x54b807[_0x8cee('0x3b')]=qs[_0x8cee('0x3c')](_0x54d871[_0x8cee('0x32')][_0x8cee('0x3c')]);_0x54b807[_0x8cee('0x3d')]=qs['filters'](_[_0x8cee('0x3e')](_0x54d871[_0x8cee('0x32')],_0x54c62f[_0x8cee('0x33')]),_0x3745ed);if(_0x54d871['query']['filter']){_0x54b807[_0x8cee('0x3d')]=_[_0x8cee('0x3f')](_0x54b807[_0x8cee('0x3d')],{'$or':_[_0x8cee('0x2d')](_0x3745ed,function(_0x23845e){if(_0x23845e[_0x8cee('0x30')]!=='VIRTUAL'){var _0x4860fb={};_0x4860fb[_0x23845e['name']]={'$like':'%'+_0x54d871[_0x8cee('0x32')][_0x8cee('0x40')]+'%'};return _0x4860fb;}})});}_0x54b807=_[_0x8cee('0x3f')]({},_0x54b807,_0x54d871['options']);var _0x226d82={'where':_0x54b807[_0x8cee('0x3d')]};return db[_0x8cee('0x2e')][_0x8cee('0x1f')](_0x226d82)['then'](function(_0x45dd65){_0x1611ee['count']=_0x45dd65;if(_0x54d871[_0x8cee('0x32')]['includeAll']){_0x54b807['include']=[{'all':!![]}];}return db[_0x8cee('0x2e')][_0x8cee('0x41')](_0x54b807);})[_0x8cee('0x27')](function(_0x2fa7d2){_0x1611ee[_0x8cee('0x42')]=_0x2fa7d2;return _0x1611ee;})[_0x8cee('0x27')](respondWithFilteredResult(_0x5adce8,_0x54b807))[_0x8cee('0x43')](handleError(_0x5adce8,null));};exports[_0x8cee('0x44')]=function(_0x32b5c5,_0xf1f872){var _0x1ca061={'raw':!![],'where':{'id':_0x32b5c5[_0x8cee('0x45')]['id']}},_0x3d2a28={};_0x3d2a28[_0x8cee('0x34')]=_[_0x8cee('0x46')](db[_0x8cee('0x2e')][_0x8cee('0x47')]);_0x3d2a28['query']=_[_0x8cee('0x46')](_0x32b5c5[_0x8cee('0x32')]);_0x3d2a28[_0x8cee('0x33')]=_[_0x8cee('0x35')](_0x3d2a28[_0x8cee('0x34')],_0x3d2a28[_0x8cee('0x32')]);_0x1ca061[_0x8cee('0x37')]=_[_0x8cee('0x35')](_0x3d2a28[_0x8cee('0x34')],qs[_0x8cee('0x36')](_0x32b5c5['query'][_0x8cee('0x36')]));_0x1ca061['attributes']=_0x1ca061[_0x8cee('0x37')]['length']?_0x1ca061[_0x8cee('0x37')]:_0x3d2a28[_0x8cee('0x34')];if(_0x32b5c5[_0x8cee('0x32')]['includeAll']){_0x1ca061[_0x8cee('0x48')]=[{'all':!![]}];}_0x1ca061=_['merge']({},_0x1ca061,_0x32b5c5[_0x8cee('0x49')]);return db[_0x8cee('0x2e')][_0x8cee('0x4a')](_0x1ca061)[_0x8cee('0x27')](handleEntityNotFound(_0xf1f872,null))[_0x8cee('0x27')](respondWithResult(_0xf1f872,null))['catch'](handleError(_0xf1f872,null));};exports['create']=function(_0x5b6e6c,_0x5116c8){return db[_0x8cee('0x2e')]['create'](_0x5b6e6c[_0x8cee('0x4b')],{})[_0x8cee('0x27')](respondWithResult(_0x5116c8,0xc9))[_0x8cee('0x43')](handleError(_0x5116c8,null));};exports[_0x8cee('0x26')]=function(_0x4442c4,_0x2c6124){if(_0x4442c4[_0x8cee('0x4b')]['id']){delete _0x4442c4[_0x8cee('0x4b')]['id'];}return db[_0x8cee('0x2e')][_0x8cee('0x4a')]({'where':{'id':_0x4442c4[_0x8cee('0x45')]['id']}})[_0x8cee('0x27')](handleEntityNotFound(_0x2c6124,null))['then'](saveUpdates(_0x4442c4['body'],null))[_0x8cee('0x27')](respondWithResult(_0x2c6124,null))[_0x8cee('0x43')](handleError(_0x2c6124,null));};exports[_0x8cee('0x28')]=function(_0x30436d,_0x4836e3){return db['ServicenowField'][_0x8cee('0x4a')]({'where':{'id':_0x30436d[_0x8cee('0x45')]['id']}})['then'](handleEntityNotFound(_0x4836e3,null))[_0x8cee('0x27')](removeEntity(_0x4836e3,null))[_0x8cee('0x43')](handleError(_0x4836e3,null));}; \ No newline at end of file +var _0x92ba=['name','send','index','map','ServicenowField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','include','rows','catch','show','create','body','find','params','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','error'];(function(_0x2cdb07,_0x2b9f74){var _0x1ad170=function(_0x5d1015){while(--_0x5d1015){_0x2cdb07['push'](_0x2cdb07['shift']());}};_0x1ad170(++_0x2b9f74);}(_0x92ba,0x1e1));var _0xa92b=function(_0x531e8f,_0x1bd935){_0x531e8f=_0x531e8f-0x0;var _0x2c79e9=_0x92ba[_0x531e8f];return _0x2c79e9;};'use strict';var emlformat=require(_0xa92b('0x0'));var rimraf=require(_0xa92b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa92b('0x2'));var rp=require(_0xa92b('0x3'));var moment=require(_0xa92b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa92b('0x5'));var util=require(_0xa92b('0x6'));var path=require(_0xa92b('0x7'));var sox=require(_0xa92b('0x8'));var csv=require('to-csv');var ejs=require(_0xa92b('0x9'));var fs=require('fs');var fs_extra=require(_0xa92b('0xa'));var _=require(_0xa92b('0xb'));var squel=require(_0xa92b('0xc'));var crypto=require(_0xa92b('0xd'));var jsforce=require(_0xa92b('0xe'));var deskjs=require(_0xa92b('0xf'));var toCsv=require(_0xa92b('0x10'));var querystring=require(_0xa92b('0x11'));var Papa=require(_0xa92b('0x12'));var Redis=require(_0xa92b('0x13'));var authService=require(_0xa92b('0x14'));var qs=require(_0xa92b('0x15'));var as=require(_0xa92b('0x16'));var hardwareService=require(_0xa92b('0x17'));var logger=require(_0xa92b('0x18'))('api');var utils=require(_0xa92b('0x19'));var config=require(_0xa92b('0x1a'));var licenseUtil=require(_0xa92b('0x1b'));var db=require(_0xa92b('0x1c'))['db'];function respondWithStatusCode(_0x26e7a7,_0x3b5cb9){_0x3b5cb9=_0x3b5cb9||0xcc;return function(_0x2cf83b){if(_0x2cf83b){return _0x26e7a7[_0xa92b('0x1d')](_0x3b5cb9);}return _0x26e7a7[_0xa92b('0x1e')](_0x3b5cb9)[_0xa92b('0x1f')]();};}function respondWithResult(_0xe273f7,_0x2e72af){_0x2e72af=_0x2e72af||0xc8;return function(_0x30b602){if(_0x30b602){return _0xe273f7[_0xa92b('0x1e')](_0x2e72af)[_0xa92b('0x20')](_0x30b602);}};}function respondWithFilteredResult(_0x13fc6f,_0x197523){return function(_0xdf4713){if(_0xdf4713){var _0x37fa3c=typeof _0x197523[_0xa92b('0x21')]==='undefined'&&typeof _0x197523[_0xa92b('0x22')]===_0xa92b('0x23');var _0x401f91=_0xdf4713[_0xa92b('0x24')];var _0x46894a=_0x37fa3c?0x0:_0x197523[_0xa92b('0x21')];var _0x5383ea=_0x37fa3c?_0xdf4713[_0xa92b('0x24')]:_0x197523[_0xa92b('0x21')]+_0x197523[_0xa92b('0x22')];var _0x382eb5;if(_0x5383ea>=_0x401f91){_0x5383ea=_0x401f91;_0x382eb5=0xc8;}else{_0x382eb5=0xce;}_0x13fc6f[_0xa92b('0x1e')](_0x382eb5);return _0x13fc6f['set'](_0xa92b('0x25'),_0x46894a+'-'+_0x5383ea+'/'+_0x401f91)[_0xa92b('0x20')](_0xdf4713);}return null;};}function patchUpdates(_0x19318a){return function(_0x29f52f){try{jsonpatch[_0xa92b('0x26')](_0x29f52f,_0x19318a,!![]);}catch(_0x5e60f0){return BPromise[_0xa92b('0x27')](_0x5e60f0);}return _0x29f52f[_0xa92b('0x28')]();};}function saveUpdates(_0x4e047f,_0x52b5f7){return function(_0x32bfd7){if(_0x32bfd7){return _0x32bfd7[_0xa92b('0x29')](_0x4e047f)['then'](function(_0x161c55){return _0x161c55;});}return null;};}function removeEntity(_0xe3adf2,_0x35191e){return function(_0x5169ef){if(_0x5169ef){return _0x5169ef['destroy']()[_0xa92b('0x2a')](function(){_0xe3adf2[_0xa92b('0x1e')](0xcc)[_0xa92b('0x1f')]();});}};}function handleEntityNotFound(_0x4be030,_0xd8eb03){return function(_0x3a2df3){if(!_0x3a2df3){_0x4be030[_0xa92b('0x1d')](0x194);}return _0x3a2df3;};}function handleError(_0x4b35eb,_0x55e473){_0x55e473=_0x55e473||0x1f4;return function(_0x44ecc5){logger[_0xa92b('0x2b')](_0x44ecc5['stack']);if(_0x44ecc5[_0xa92b('0x2c')]){delete _0x44ecc5[_0xa92b('0x2c')];}_0x4b35eb[_0xa92b('0x1e')](_0x55e473)[_0xa92b('0x2d')](_0x44ecc5);};}exports[_0xa92b('0x2e')]=function(_0x5f3295,_0x166113){var _0x240681={},_0x18fb82={},_0x31a952={'count':0x0,'rows':[]};var _0x16d2a5=_[_0xa92b('0x2f')](db[_0xa92b('0x30')][_0xa92b('0x31')],function(_0x1233ae){return{'name':_0x1233ae['fieldName'],'type':_0x1233ae[_0xa92b('0x32')][_0xa92b('0x33')]};});_0x18fb82[_0xa92b('0x34')]=_[_0xa92b('0x2f')](_0x16d2a5,_0xa92b('0x2c'));_0x18fb82[_0xa92b('0x35')]=_[_0xa92b('0x36')](_0x5f3295['query']);_0x18fb82[_0xa92b('0x37')]=_[_0xa92b('0x38')](_0x18fb82[_0xa92b('0x34')],_0x18fb82[_0xa92b('0x35')]);_0x240681['attributes']=_[_0xa92b('0x38')](_0x18fb82[_0xa92b('0x34')],qs[_0xa92b('0x39')](_0x5f3295['query'][_0xa92b('0x39')]));_0x240681['attributes']=_0x240681[_0xa92b('0x3a')]['length']?_0x240681[_0xa92b('0x3a')]:_0x18fb82[_0xa92b('0x34')];if(!_0x5f3295['query'][_0xa92b('0x3b')](_0xa92b('0x3c'))){_0x240681[_0xa92b('0x22')]=qs['limit'](_0x5f3295[_0xa92b('0x35')][_0xa92b('0x22')]);_0x240681[_0xa92b('0x21')]=qs[_0xa92b('0x21')](_0x5f3295[_0xa92b('0x35')]['offset']);}_0x240681['order']=qs['sort'](_0x5f3295['query']['sort']);_0x240681[_0xa92b('0x3d')]=qs[_0xa92b('0x37')](_[_0xa92b('0x3e')](_0x5f3295[_0xa92b('0x35')],_0x18fb82[_0xa92b('0x37')]),_0x16d2a5);if(_0x5f3295[_0xa92b('0x35')][_0xa92b('0x3f')]){_0x240681[_0xa92b('0x3d')]=_[_0xa92b('0x40')](_0x240681['where'],{'$or':_['map'](_0x16d2a5,function(_0x35d7de){if(_0x35d7de[_0xa92b('0x32')]!==_0xa92b('0x41')){var _0x63504d={};_0x63504d[_0x35d7de['name']]={'$like':'%'+_0x5f3295[_0xa92b('0x35')][_0xa92b('0x3f')]+'%'};return _0x63504d;}})});}_0x240681=_['merge']({},_0x240681,_0x5f3295[_0xa92b('0x42')]);var _0x39a207={'where':_0x240681[_0xa92b('0x3d')]};return db[_0xa92b('0x30')][_0xa92b('0x24')](_0x39a207)[_0xa92b('0x2a')](function(_0x336373){_0x31a952[_0xa92b('0x24')]=_0x336373;if(_0x5f3295[_0xa92b('0x35')]['includeAll']){_0x240681[_0xa92b('0x43')]=[{'all':!![]}];}return db['ServicenowField']['findAll'](_0x240681);})[_0xa92b('0x2a')](function(_0x12a2d3){_0x31a952[_0xa92b('0x44')]=_0x12a2d3;return _0x31a952;})[_0xa92b('0x2a')](respondWithFilteredResult(_0x166113,_0x240681))[_0xa92b('0x45')](handleError(_0x166113,null));};exports[_0xa92b('0x46')]=function(_0x50ed53,_0x648949){var _0x160b8f={'raw':!![],'where':{'id':_0x50ed53['params']['id']}},_0x44796c={};_0x44796c[_0xa92b('0x34')]=_['keys'](db[_0xa92b('0x30')][_0xa92b('0x31')]);_0x44796c[_0xa92b('0x35')]=_['keys'](_0x50ed53['query']);_0x44796c['filters']=_[_0xa92b('0x38')](_0x44796c[_0xa92b('0x34')],_0x44796c['query']);_0x160b8f[_0xa92b('0x3a')]=_[_0xa92b('0x38')](_0x44796c[_0xa92b('0x34')],qs[_0xa92b('0x39')](_0x50ed53[_0xa92b('0x35')][_0xa92b('0x39')]));_0x160b8f[_0xa92b('0x3a')]=_0x160b8f['attributes']['length']?_0x160b8f['attributes']:_0x44796c[_0xa92b('0x34')];if(_0x50ed53['query']['includeAll']){_0x160b8f[_0xa92b('0x43')]=[{'all':!![]}];}_0x160b8f=_[_0xa92b('0x40')]({},_0x160b8f,_0x50ed53['options']);return db[_0xa92b('0x30')]['find'](_0x160b8f)[_0xa92b('0x2a')](handleEntityNotFound(_0x648949,null))[_0xa92b('0x2a')](respondWithResult(_0x648949,null))[_0xa92b('0x45')](handleError(_0x648949,null));};exports[_0xa92b('0x47')]=function(_0x323d89,_0x21e398){return db[_0xa92b('0x30')]['create'](_0x323d89[_0xa92b('0x48')],{})[_0xa92b('0x2a')](respondWithResult(_0x21e398,0xc9))[_0xa92b('0x45')](handleError(_0x21e398,null));};exports[_0xa92b('0x29')]=function(_0xd1de3b,_0x998720){if(_0xd1de3b[_0xa92b('0x48')]['id']){delete _0xd1de3b['body']['id'];}return db[_0xa92b('0x30')][_0xa92b('0x49')]({'where':{'id':_0xd1de3b['params']['id']}})['then'](handleEntityNotFound(_0x998720,null))['then'](saveUpdates(_0xd1de3b[_0xa92b('0x48')],null))['then'](respondWithResult(_0x998720,null))[_0xa92b('0x45')](handleError(_0x998720,null));};exports['destroy']=function(_0x41b413,_0x2da094){return db[_0xa92b('0x30')][_0xa92b('0x49')]({'where':{'id':_0x41b413[_0xa92b('0x4a')]['id']}})[_0xa92b('0x2a')](handleEntityNotFound(_0x2da094,null))[_0xa92b('0x2a')](removeEntity(_0x2da094,null))[_0xa92b('0x45')](handleError(_0x2da094,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index d4b75d1..e1f93c7 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 _0xe305=['rimraf','../../config/environment','exports','ServicenowField','int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x521f7d,_0x2febe1){var _0x5a63da=function(_0x51f559){while(--_0x51f559){_0x521f7d['push'](_0x521f7d['shift']());}};_0x5a63da(++_0x2febe1);}(_0xe305,0x11f));var _0x5e30=function(_0x362c6a,_0xa80cbc){_0x362c6a=_0x362c6a-0x0;var _0x4231d9=_0xe305[_0x362c6a];return _0x4231d9;};'use strict';var _=require(_0x5e30('0x0'));var util=require(_0x5e30('0x1'));var logger=require(_0x5e30('0x2'))(_0x5e30('0x3'));var moment=require('moment');var BPromise=require(_0x5e30('0x4'));var rp=require(_0x5e30('0x5'));var fs=require('fs');var path=require(_0x5e30('0x6'));var rimraf=require(_0x5e30('0x7'));var config=require(_0x5e30('0x8'));var attributes=require('./intServicenowField.attributes');module[_0x5e30('0x9')]=function(_0x297dab,_0xea1d72){return _0x297dab['define'](_0x5e30('0xa'),attributes,{'tableName':_0x5e30('0xb'),'paranoid':![],'indexes':[{'name':_0x5e30('0xc'),'fields':['idField',_0x5e30('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcff2=['define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0xde0534,_0x209073){var _0x2e50db=function(_0x5dd2cf){while(--_0x5dd2cf){_0xde0534['push'](_0xde0534['shift']());}};_0x2e50db(++_0x209073);}(_0xcff2,0x131));var _0x2cff=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0xcff2[_0x1b64dd];return _0xeb464c;};'use strict';var _=require(_0x2cff('0x0'));var util=require(_0x2cff('0x1'));var logger=require(_0x2cff('0x2'))(_0x2cff('0x3'));var moment=require(_0x2cff('0x4'));var BPromise=require(_0x2cff('0x5'));var rp=require(_0x2cff('0x6'));var fs=require('fs');var path=require(_0x2cff('0x7'));var rimraf=require('rimraf');var config=require(_0x2cff('0x8'));var attributes=require('./intServicenowField.attributes');module[_0x2cff('0x9')]=function(_0x2145c7,_0x4f5410){return _0x2145c7[_0x2cff('0xa')](_0x2cff('0xb'),attributes,{'tableName':_0x2cff('0xc'),'paranoid':![],'indexes':[{'name':_0x2cff('0xd'),'fields':[_0x2cff('0xe'),'FieldId'],'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 ab31b8c..c78aa82 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0xda3f,0xec));var _0xfda3=function(_0xa89337,_0x417099){_0xa89337=_0xa89337-0x0;var _0xf6410d=_0xda3f[_0xa89337];return _0xf6410d;};'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')]('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('ServicenowField,\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 +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x410680,_0x450b2d){var _0x49dc01=function(_0x34cd93){while(--_0x34cd93){_0x410680['push'](_0x410680['shift']());}};_0x49dc01(++_0x450b2d);}(_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 moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index 72d59ee..1d8e96d 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x309f70,_0x4209e9){var _0x5578dc=function(_0x28159b){while(--_0x28159b){_0x309f70['push'](_0x309f70['shift']());}};_0x5578dc(++_0x4209e9);}(_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/configurations',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/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=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(_0x1b1ff6,_0x59c00e){var _0x515356=function(_0x1a5152){while(--_0x1a5152){_0x1b1ff6['push'](_0x1b1ff6['shift']());}};_0x515356(++_0x59c00e);}(_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/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 3713fa5..5112bce 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(_0x193a10,_0xb4fb8e){var _0x3a16ab=function(_0x9b5254){while(--_0x9b5254){_0x193a10['push'](_0x193a10['shift']());}};_0x3a16ab(++_0xb4fb8e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'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(_0x59716b,_0x1c8fc9){var _0x4b9ddf=function(_0x4ab902){while(--_0x4ab902){_0x59716b['push'](_0x59716b['shift']());}};_0x4b9ddf(++_0x1c8fc9);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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 48012d0..d6e9254 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 _0xf421=['limit','count','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','VIRTUAL','options','SugarcrmAccount','includeAll','include','findAll','rows','catch','rawAttributes','length','find','create','body','params','findOne','SugarcrmConfiguration','filter','getConfigurations','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','SugarcrmField','getFields','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','password','remoteUri','slice','substring','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','get_module_fields','JSON','values','module_fields','remove','includes','label','value','statusCode','Wrong\x20credentials','eml-format','fast-json-patch','request-promise','moment','mustache','util','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','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined'];(function(_0x523da0,_0x22623f){var _0x4d04b9=function(_0x185640){while(--_0x185640){_0x523da0['push'](_0x523da0['shift']());}};_0x4d04b9(++_0x22623f);}(_0xf421,0xd2));var _0x1f42=function(_0x39758d,_0x346423){_0x39758d=_0x39758d-0x0;var _0x44ac11=_0xf421[_0x39758d];return _0x44ac11;};'use strict';var emlformat=require(_0x1f42('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1f42('0x1'));var rp=require(_0x1f42('0x2'));var moment=require(_0x1f42('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x1f42('0x4'));var util=require(_0x1f42('0x5'));var path=require('path');var sox=require(_0x1f42('0x6'));var csv=require(_0x1f42('0x7'));var ejs=require(_0x1f42('0x8'));var fs=require('fs');var fs_extra=require(_0x1f42('0x9'));var _=require(_0x1f42('0xa'));var squel=require(_0x1f42('0xb'));var crypto=require(_0x1f42('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x1f42('0xd'));var Papa=require(_0x1f42('0xe'));var Redis=require('ioredis');var authService=require(_0x1f42('0xf'));var qs=require(_0x1f42('0x10'));var as=require(_0x1f42('0x11'));var hardwareService=require(_0x1f42('0x12'));var logger=require(_0x1f42('0x13'))(_0x1f42('0x14'));var utils=require(_0x1f42('0x15'));var config=require(_0x1f42('0x16'));var licenseUtil=require(_0x1f42('0x17'));var db=require(_0x1f42('0x18'))['db'];var integrations=require(_0x1f42('0x19'));function respondWithStatusCode(_0x16a952,_0x17e5d7){_0x17e5d7=_0x17e5d7||0xcc;return function(_0x236ea1){if(_0x236ea1){return _0x16a952[_0x1f42('0x1a')](_0x17e5d7);}return _0x16a952['status'](_0x17e5d7)[_0x1f42('0x1b')]();};}function respondWithResult(_0x3f9abc,_0x48b1e5){_0x48b1e5=_0x48b1e5||0xc8;return function(_0xa4f3b8){if(_0xa4f3b8){return _0x3f9abc[_0x1f42('0x1c')](_0x48b1e5)[_0x1f42('0x1d')](_0xa4f3b8);}};}function respondWithFilteredResult(_0x459da8,_0x4073ef){return function(_0x2155ac){if(_0x2155ac){var _0x53a4ea=typeof _0x4073ef[_0x1f42('0x1e')]===_0x1f42('0x1f')&&typeof _0x4073ef[_0x1f42('0x20')]===_0x1f42('0x1f');var _0x5d933c=_0x2155ac[_0x1f42('0x21')];var _0x1ebe26=_0x53a4ea?0x0:_0x4073ef['offset'];var _0x131291=_0x53a4ea?_0x2155ac[_0x1f42('0x21')]:_0x4073ef[_0x1f42('0x1e')]+_0x4073ef[_0x1f42('0x20')];var _0x368a40;if(_0x131291>=_0x5d933c){_0x131291=_0x5d933c;_0x368a40=0xc8;}else{_0x368a40=0xce;}_0x459da8[_0x1f42('0x1c')](_0x368a40);return _0x459da8[_0x1f42('0x22')](_0x1f42('0x23'),_0x1ebe26+'-'+_0x131291+'/'+_0x5d933c)[_0x1f42('0x1d')](_0x2155ac);}return null;};}function patchUpdates(_0x1f937e){return function(_0x4ce11f){try{jsonpatch['apply'](_0x4ce11f,_0x1f937e,!![]);}catch(_0x486dbb){return BPromise[_0x1f42('0x24')](_0x486dbb);}return _0x4ce11f[_0x1f42('0x25')]();};}function saveUpdates(_0x584b98,_0x56f82f){return function(_0x3997b0){if(_0x3997b0){return _0x3997b0[_0x1f42('0x26')](_0x584b98)[_0x1f42('0x27')](function(_0x1ecc4f){return _0x1ecc4f;});}return null;};}function removeEntity(_0x28a97d,_0x1a024b){return function(_0x3def34){if(_0x3def34){return _0x3def34[_0x1f42('0x28')]()[_0x1f42('0x27')](function(){_0x28a97d[_0x1f42('0x1c')](0xcc)[_0x1f42('0x1b')]();});}};}function handleEntityNotFound(_0x2ef756,_0x5ac79d){return function(_0x15c76b){if(!_0x15c76b){_0x2ef756[_0x1f42('0x1a')](0x194);}return _0x15c76b;};}function handleError(_0x4af6d7,_0x20cfe1){_0x20cfe1=_0x20cfe1||0x1f4;return function(_0x55f03c){logger[_0x1f42('0x29')](_0x55f03c[_0x1f42('0x2a')]);if(_0x55f03c[_0x1f42('0x2b')]){delete _0x55f03c[_0x1f42('0x2b')];}_0x4af6d7['status'](_0x20cfe1)[_0x1f42('0x2c')](_0x55f03c);};}exports['index']=function(_0x4e6492,_0x54718c){var _0x49e559={},_0x2fc423={},_0x1b6f53={'count':0x0,'rows':[]};var _0x4cfb57=_[_0x1f42('0x2d')](db['SugarcrmAccount']['rawAttributes'],function(_0x99362e){return{'name':_0x99362e[_0x1f42('0x2e')],'type':_0x99362e['type'][_0x1f42('0x2f')]};});_0x2fc423[_0x1f42('0x30')]=_[_0x1f42('0x2d')](_0x4cfb57,_0x1f42('0x2b'));_0x2fc423[_0x1f42('0x31')]=_[_0x1f42('0x32')](_0x4e6492[_0x1f42('0x31')]);_0x2fc423[_0x1f42('0x33')]=_[_0x1f42('0x34')](_0x2fc423[_0x1f42('0x30')],_0x2fc423[_0x1f42('0x31')]);_0x49e559[_0x1f42('0x35')]=_[_0x1f42('0x34')](_0x2fc423['model'],qs['fields'](_0x4e6492[_0x1f42('0x31')][_0x1f42('0x36')]));_0x49e559[_0x1f42('0x35')]=_0x49e559[_0x1f42('0x35')]['length']?_0x49e559['attributes']:_0x2fc423[_0x1f42('0x30')];if(!_0x4e6492[_0x1f42('0x31')][_0x1f42('0x37')](_0x1f42('0x38'))){_0x49e559[_0x1f42('0x20')]=qs[_0x1f42('0x20')](_0x4e6492[_0x1f42('0x31')][_0x1f42('0x20')]);_0x49e559['offset']=qs[_0x1f42('0x1e')](_0x4e6492[_0x1f42('0x31')][_0x1f42('0x1e')]);}_0x49e559[_0x1f42('0x39')]=qs[_0x1f42('0x3a')](_0x4e6492[_0x1f42('0x31')][_0x1f42('0x3a')]);_0x49e559['where']=qs[_0x1f42('0x33')](_[_0x1f42('0x3b')](_0x4e6492[_0x1f42('0x31')],_0x2fc423['filters']),_0x4cfb57);if(_0x4e6492[_0x1f42('0x31')]['filter']){_0x49e559[_0x1f42('0x3c')]=_[_0x1f42('0x3d')](_0x49e559[_0x1f42('0x3c')],{'$or':_[_0x1f42('0x2d')](_0x4cfb57,function(_0xa2572f){if(_0xa2572f[_0x1f42('0x3e')]!==_0x1f42('0x3f')){var _0x49c1b6={};_0x49c1b6[_0xa2572f[_0x1f42('0x2b')]]={'$like':'%'+_0x4e6492[_0x1f42('0x31')]['filter']+'%'};return _0x49c1b6;}})});}_0x49e559=_[_0x1f42('0x3d')]({},_0x49e559,_0x4e6492[_0x1f42('0x40')]);var _0x36c2a5={'where':_0x49e559[_0x1f42('0x3c')]};return db[_0x1f42('0x41')][_0x1f42('0x21')](_0x36c2a5)[_0x1f42('0x27')](function(_0x2218a8){_0x1b6f53[_0x1f42('0x21')]=_0x2218a8;if(_0x4e6492['query'][_0x1f42('0x42')]){_0x49e559[_0x1f42('0x43')]=[{'all':!![]}];}return db[_0x1f42('0x41')][_0x1f42('0x44')](_0x49e559);})['then'](function(_0x1a7194){_0x1b6f53[_0x1f42('0x45')]=_0x1a7194;return _0x1b6f53;})[_0x1f42('0x27')](respondWithFilteredResult(_0x54718c,_0x49e559))[_0x1f42('0x46')](handleError(_0x54718c,null));};exports['show']=function(_0x5dd9ac,_0x9abde7){var _0x2608bc={'raw':![],'where':{'id':_0x5dd9ac['params']['id']}},_0x3b7b4f={};_0x3b7b4f[_0x1f42('0x30')]=_['keys'](db['SugarcrmAccount'][_0x1f42('0x47')]);_0x3b7b4f[_0x1f42('0x31')]=_[_0x1f42('0x32')](_0x5dd9ac['query']);_0x3b7b4f['filters']=_['intersection'](_0x3b7b4f['model'],_0x3b7b4f[_0x1f42('0x31')]);_0x2608bc[_0x1f42('0x35')]=_['intersection'](_0x3b7b4f[_0x1f42('0x30')],qs[_0x1f42('0x36')](_0x5dd9ac['query']['fields']));_0x2608bc['attributes']=_0x2608bc[_0x1f42('0x35')][_0x1f42('0x48')]?_0x2608bc[_0x1f42('0x35')]:_0x3b7b4f[_0x1f42('0x30')];if(_0x5dd9ac['query'][_0x1f42('0x42')]){_0x2608bc[_0x1f42('0x43')]=[{'all':!![]}];}_0x2608bc=_[_0x1f42('0x3d')]({},_0x2608bc,_0x5dd9ac[_0x1f42('0x40')]);return db[_0x1f42('0x41')][_0x1f42('0x49')](_0x2608bc)[_0x1f42('0x27')](handleEntityNotFound(_0x9abde7,null))[_0x1f42('0x27')](respondWithResult(_0x9abde7,null))[_0x1f42('0x46')](handleError(_0x9abde7,null));};exports[_0x1f42('0x4a')]=function(_0x43afa3,_0x2691a4){return db[_0x1f42('0x41')][_0x1f42('0x4a')](_0x43afa3[_0x1f42('0x4b')],{})[_0x1f42('0x27')](respondWithResult(_0x2691a4,0xc9))[_0x1f42('0x46')](handleError(_0x2691a4,null));};exports[_0x1f42('0x26')]=function(_0x383107,_0x4f3be6){if(_0x383107[_0x1f42('0x4b')]['id']){delete _0x383107[_0x1f42('0x4b')]['id'];}return db['SugarcrmAccount'][_0x1f42('0x49')]({'where':{'id':_0x383107[_0x1f42('0x4c')]['id']}})[_0x1f42('0x27')](handleEntityNotFound(_0x4f3be6,null))[_0x1f42('0x27')](saveUpdates(_0x383107[_0x1f42('0x4b')],null))[_0x1f42('0x27')](respondWithResult(_0x4f3be6,null))[_0x1f42('0x46')](handleError(_0x4f3be6,null));};exports[_0x1f42('0x28')]=function(_0x165dce,_0x37ed46){return db['SugarcrmAccount']['find']({'where':{'id':_0x165dce[_0x1f42('0x4c')]['id']}})['then'](handleEntityNotFound(_0x37ed46,null))['then'](removeEntity(_0x37ed46,null))[_0x1f42('0x46')](handleError(_0x37ed46,null));};exports['getConfigurations']=function(_0x3df92a,_0x52f396,_0x41ce52){var _0x14bfbd={};var _0x4c5dd3={};var _0x328691;var _0x1b18c5;return db['SugarcrmAccount'][_0x1f42('0x4d')]({'where':{'id':_0x3df92a['params']['id']}})[_0x1f42('0x27')](handleEntityNotFound(_0x52f396,null))[_0x1f42('0x27')](function(_0x3d615a){if(_0x3d615a){_0x328691=_0x3d615a;_0x4c5dd3['model']=_[_0x1f42('0x32')](db[_0x1f42('0x4e')][_0x1f42('0x47')]);_0x4c5dd3[_0x1f42('0x31')]=_['keys'](_0x3df92a[_0x1f42('0x31')]);_0x4c5dd3[_0x1f42('0x33')]=_['intersection'](_0x4c5dd3[_0x1f42('0x30')],_0x4c5dd3[_0x1f42('0x31')]);_0x14bfbd[_0x1f42('0x35')]=_[_0x1f42('0x34')](_0x4c5dd3[_0x1f42('0x30')],qs[_0x1f42('0x36')](_0x3df92a[_0x1f42('0x31')]['fields']));_0x14bfbd[_0x1f42('0x35')]=_0x14bfbd[_0x1f42('0x35')][_0x1f42('0x48')]?_0x14bfbd[_0x1f42('0x35')]:_0x4c5dd3[_0x1f42('0x30')];_0x14bfbd[_0x1f42('0x39')]=qs['sort'](_0x3df92a[_0x1f42('0x31')]['sort']);_0x14bfbd['where']=qs[_0x1f42('0x33')](_[_0x1f42('0x3b')](_0x3df92a[_0x1f42('0x31')],_0x4c5dd3['filters']));if(_0x3df92a[_0x1f42('0x31')][_0x1f42('0x4f')]){_0x14bfbd[_0x1f42('0x3c')]=_['merge'](_0x14bfbd[_0x1f42('0x3c')],{'$or':_[_0x1f42('0x2d')](_0x14bfbd['attributes'],function(_0x5448cf){var _0x5c1aa5={};_0x5c1aa5[_0x5448cf]={'$like':'%'+_0x3df92a[_0x1f42('0x31')][_0x1f42('0x4f')]+'%'};return _0x5c1aa5;})});}_0x14bfbd=_['merge']({},_0x14bfbd,_0x3df92a['options']);return _0x328691[_0x1f42('0x50')](_0x14bfbd);}})[_0x1f42('0x27')](function(_0x5028b8){if(_0x5028b8){_0x1b18c5=_0x5028b8[_0x1f42('0x48')];if(!_0x3df92a['query'][_0x1f42('0x37')](_0x1f42('0x38'))){_0x14bfbd['limit']=qs[_0x1f42('0x20')](_0x3df92a[_0x1f42('0x31')][_0x1f42('0x20')]);_0x14bfbd[_0x1f42('0x1e')]=qs['offset'](_0x3df92a[_0x1f42('0x31')][_0x1f42('0x1e')]);}return _0x328691['getConfigurations'](_0x14bfbd);}})['then'](function(_0x446203){if(_0x446203){return _0x446203?{'count':_0x1b18c5,'rows':_0x446203}:null;}})[_0x1f42('0x27')](respondWithResult(_0x52f396,null))[_0x1f42('0x46')](handleError(_0x52f396,null));};exports['addConfiguration']=function(_0x2d22aa,_0x2e3f51,_0x30aa84){if(_0x2d22aa[_0x1f42('0x4b')]['id']){delete _0x2d22aa[_0x1f42('0x4b')]['id'];}return db[_0x1f42('0x41')][_0x1f42('0x4d')]({'where':{'id':_0x2d22aa[_0x1f42('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2e3f51,null))[_0x1f42('0x27')](function(_0x22d964){if(_0x22d964){_0x2d22aa[_0x1f42('0x4b')][_0x1f42('0x51')]=_0x22d964['id'];_0x2d22aa[_0x1f42('0x4b')][_0x1f42('0x52')]=integrations[_0x1f42('0x53')](_0x2d22aa['body']['channel'],_0x2d22aa[_0x1f42('0x4b')][_0x1f42('0x3e')]);_0x2d22aa[_0x1f42('0x4b')][_0x1f42('0x54')]=integrations[_0x1f42('0x55')](_0x2d22aa[_0x1f42('0x4b')][_0x1f42('0x56')],_0x2d22aa['body'][_0x1f42('0x3e')]);return db[_0x1f42('0x4e')][_0x1f42('0x4a')](_0x2d22aa[_0x1f42('0x4b')],{'include':[{'model':db[_0x1f42('0x57')],'as':_0x1f42('0x52')},{'model':db['SugarcrmField'],'as':_0x1f42('0x54')}]});}return null;})[_0x1f42('0x27')](respondWithResult(_0x2e3f51,null))[_0x1f42('0x46')](handleError(_0x2e3f51,null));};exports[_0x1f42('0x58')]=function(_0x21ef6e,_0x5168f4,_0x71a10b){var _0x5dc135='';var _0x29e28c=['id',_0x1f42('0x2b'),'assigned_user_id','created_by','description',_0x1f42('0x59'),_0x1f42('0x5a'),_0x1f42('0x5b'),_0x1f42('0x5c'),_0x1f42('0x5d'),'parent_name',_0x1f42('0x5e')];return db[_0x1f42('0x41')][_0x1f42('0x4d')]({'where':{'id':_0x21ef6e[_0x1f42('0x4c')]['id']},'attributes':['id',_0x1f42('0x5f'),_0x1f42('0x60'),_0x1f42('0x61')]})['then'](handleEntityNotFound(_0x5168f4,null))[_0x1f42('0x27')](function(_0x36a659){if(_0x36a659){_0x5dc135=_0x36a659[_0x1f42('0x61')];var _0x5d8f2b=_0x5dc135[_0x1f42('0x62')](-0x1);if(_0x5d8f2b==='/'){_0x5dc135=_0x5dc135[_0x1f42('0x63')](0x0,_0x5dc135[_0x1f42('0x64')](_0x5d8f2b));}return rp({'method':_0x1f42('0x65'),'uri':util[_0x1f42('0x66')](_0x1f42('0x67'),_0x5dc135,_0x1f42('0x68')),'json':!![],'form':{'method':_0x1f42('0x69'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x1f42('0x6a')]({'user_auth':{'user_name':_0x36a659[_0x1f42('0x5f')],'password':_0x36a659[_0x1f42('0x60')],'encryption':_0x1f42('0x6b')},'application':_0x1f42('0x6c')})}});}})[_0x1f42('0x27')](function(_0x37239a){if(_0x37239a&&_0x37239a[_0x1f42('0x2b')]!==_0x1f42('0x6d')&&_0x37239a[_0x1f42('0x2b')]!==_0x1f42('0x6e')){return rp({'method':'POST','uri':util[_0x1f42('0x66')](_0x1f42('0x67'),_0x5dc135,_0x1f42('0x68')),'json':!![],'form':{'method':_0x1f42('0x6f'),'input_type':_0x1f42('0x70'),'response_type':_0x1f42('0x70'),'rest_data':JSON['stringify']({'session':_0x37239a['id'],'module_name':'Calls'})}})[_0x1f42('0x27')](function(_0x72a8da){if(_0x72a8da){var _0x2a075f=_[_0x1f42('0x71')](_0x72a8da[_0x1f42('0x72')]);_[_0x1f42('0x73')](_0x2a075f,function(_0x4a3d62){return _0x29e28c[_0x1f42('0x74')](_0x4a3d62[_0x1f42('0x2b')]);});return{'count':_0x2a075f[_0x1f42('0x48')],'rows':_['map'](_0x2a075f,function(_0x4e23ec){return{'id':_0x4e23ec[_0x1f42('0x2b')],'name':_0x4e23ec[_0x1f42('0x75')],'custom':_['endsWith'](_0x4e23ec[_0x1f42('0x2b')],'_c')?!![]:![],'options':_0x4e23ec[_0x1f42('0x40')]?_[_0x1f42('0x2d')](_[_0x1f42('0x71')](_0x4e23ec[_0x1f42('0x40')]),function(_0x5e2432){return{'name':_0x5e2432[_0x1f42('0x76')],'value':_0x5e2432[_0x1f42('0x2b')]};}):[]};})};}})[_0x1f42('0x27')](respondWithResult(_0x5168f4,null))[_0x1f42('0x46')](function(_0x59724e){var _0x49c6aa=_0x21ef6e['query']['test']?0x1f4:_0x59724e[_0x1f42('0x77')]||0x1f4;logger[_0x1f42('0x29')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x49c6aa,JSON[_0x1f42('0x6a')](_0x59724e));delete _0x59724e['name'];if(_0x49c6aa===0x191){_0x49c6aa=0x190;}_0x5168f4['status'](_0x49c6aa)['send'](_0x21ef6e[_0x1f42('0x31')]['test']?{'message':_0x1f42('0x78'),'statusCode':_0x59724e['statusCode']}:_0x59724e);});}else{var _0x47202e=0x1f4;_0x5168f4[_0x1f42('0x1c')](_0x47202e)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file +var _0xaf6a=['remoteUri','slice','substring','lastIndexOf','format','%s%s','/service/v4_1/rest.php','JSON','stringify','username','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','POST','get_module_fields','Calls','values','module_fields','includes','label','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','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','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','limit','undefined','count','Content-Range','json','apply','update','then','error','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','SugarcrmAccount','include','rows','catch','show','params','options','create','body','find','destroy','findOne','SugarcrmConfiguration','nolimit','getConfigurations','Subjects','getSubjects','getDescriptions','channel','SugarcrmField','getFields','assigned_user_id','date_start','parent_type','parent_name','direction','password'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0xaf6a,0x105));var _0xaaf6=function(_0xb9622e,_0x91225d){_0xb9622e=_0xb9622e-0x0;var _0x12969e=_0xaf6a[_0xb9622e];return _0x12969e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaaf6('0x0'));var zipdir=require(_0xaaf6('0x1'));var jsonpatch=require(_0xaaf6('0x2'));var rp=require(_0xaaf6('0x3'));var moment=require(_0xaaf6('0x4'));var BPromise=require(_0xaaf6('0x5'));var Mustache=require('mustache');var util=require(_0xaaf6('0x6'));var path=require(_0xaaf6('0x7'));var sox=require(_0xaaf6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaaf6('0x9'));var _=require(_0xaaf6('0xa'));var squel=require(_0xaaf6('0xb'));var crypto=require(_0xaaf6('0xc'));var jsforce=require(_0xaaf6('0xd'));var deskjs=require(_0xaaf6('0xe'));var toCsv=require(_0xaaf6('0xf'));var querystring=require(_0xaaf6('0x10'));var Papa=require(_0xaaf6('0x11'));var Redis=require(_0xaaf6('0x12'));var authService=require(_0xaaf6('0x13'));var qs=require(_0xaaf6('0x14'));var as=require(_0xaaf6('0x15'));var hardwareService=require(_0xaaf6('0x16'));var logger=require(_0xaaf6('0x17'))(_0xaaf6('0x18'));var utils=require(_0xaaf6('0x19'));var config=require(_0xaaf6('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0xaaf6('0x1b'))['db'];var integrations=require(_0xaaf6('0x1c'));function respondWithStatusCode(_0x53d096,_0xb1083f){_0xb1083f=_0xb1083f||0xcc;return function(_0x1583a7){if(_0x1583a7){return _0x53d096[_0xaaf6('0x1d')](_0xb1083f);}return _0x53d096['status'](_0xb1083f)[_0xaaf6('0x1e')]();};}function respondWithResult(_0x1053d0,_0x181126){_0x181126=_0x181126||0xc8;return function(_0x54c99c){if(_0x54c99c){return _0x1053d0[_0xaaf6('0x1f')](_0x181126)['json'](_0x54c99c);}};}function respondWithFilteredResult(_0x3724b8,_0x4634b3){return function(_0x5bce0e){if(_0x5bce0e){var _0x33579e=typeof _0x4634b3[_0xaaf6('0x20')]==='undefined'&&typeof _0x4634b3[_0xaaf6('0x21')]===_0xaaf6('0x22');var _0x421bfa=_0x5bce0e[_0xaaf6('0x23')];var _0x36ed67=_0x33579e?0x0:_0x4634b3['offset'];var _0x6de3d9=_0x33579e?_0x5bce0e[_0xaaf6('0x23')]:_0x4634b3[_0xaaf6('0x20')]+_0x4634b3[_0xaaf6('0x21')];var _0x2f0539;if(_0x6de3d9>=_0x421bfa){_0x6de3d9=_0x421bfa;_0x2f0539=0xc8;}else{_0x2f0539=0xce;}_0x3724b8[_0xaaf6('0x1f')](_0x2f0539);return _0x3724b8['set'](_0xaaf6('0x24'),_0x36ed67+'-'+_0x6de3d9+'/'+_0x421bfa)[_0xaaf6('0x25')](_0x5bce0e);}return null;};}function patchUpdates(_0xca6dbb){return function(_0x25dd1e){try{jsonpatch[_0xaaf6('0x26')](_0x25dd1e,_0xca6dbb,!![]);}catch(_0x4ab975){return BPromise['reject'](_0x4ab975);}return _0x25dd1e['save']();};}function saveUpdates(_0x1cdd79,_0x293b06){return function(_0x5b56c1){if(_0x5b56c1){return _0x5b56c1[_0xaaf6('0x27')](_0x1cdd79)[_0xaaf6('0x28')](function(_0x14c4de){return _0x14c4de;});}return null;};}function removeEntity(_0x41ca10,_0x2e8033){return function(_0x540cfa){if(_0x540cfa){return _0x540cfa['destroy']()[_0xaaf6('0x28')](function(){_0x41ca10[_0xaaf6('0x1f')](0xcc)[_0xaaf6('0x1e')]();});}};}function handleEntityNotFound(_0x2b7698,_0x94f943){return function(_0x178e0e){if(!_0x178e0e){_0x2b7698[_0xaaf6('0x1d')](0x194);}return _0x178e0e;};}function handleError(_0x494966,_0x5c9efc){_0x5c9efc=_0x5c9efc||0x1f4;return function(_0x3738be){logger[_0xaaf6('0x29')](_0x3738be['stack']);if(_0x3738be['name']){delete _0x3738be[_0xaaf6('0x2a')];}_0x494966[_0xaaf6('0x1f')](_0x5c9efc)[_0xaaf6('0x2b')](_0x3738be);};}exports[_0xaaf6('0x2c')]=function(_0x347b23,_0x20818f){var _0x4df504={},_0x30f154={},_0x143fba={'count':0x0,'rows':[]};var _0x391780=_[_0xaaf6('0x2d')](db['SugarcrmAccount'][_0xaaf6('0x2e')],function(_0x3978fc){return{'name':_0x3978fc[_0xaaf6('0x2f')],'type':_0x3978fc[_0xaaf6('0x30')][_0xaaf6('0x31')]};});_0x30f154[_0xaaf6('0x32')]=_[_0xaaf6('0x2d')](_0x391780,'name');_0x30f154['query']=_[_0xaaf6('0x33')](_0x347b23['query']);_0x30f154[_0xaaf6('0x34')]=_[_0xaaf6('0x35')](_0x30f154[_0xaaf6('0x32')],_0x30f154[_0xaaf6('0x36')]);_0x4df504[_0xaaf6('0x37')]=_[_0xaaf6('0x35')](_0x30f154[_0xaaf6('0x32')],qs['fields'](_0x347b23['query'][_0xaaf6('0x38')]));_0x4df504[_0xaaf6('0x37')]=_0x4df504[_0xaaf6('0x37')][_0xaaf6('0x39')]?_0x4df504[_0xaaf6('0x37')]:_0x30f154[_0xaaf6('0x32')];if(!_0x347b23[_0xaaf6('0x36')][_0xaaf6('0x3a')]('nolimit')){_0x4df504[_0xaaf6('0x21')]=qs[_0xaaf6('0x21')](_0x347b23[_0xaaf6('0x36')]['limit']);_0x4df504[_0xaaf6('0x20')]=qs[_0xaaf6('0x20')](_0x347b23[_0xaaf6('0x36')]['offset']);}_0x4df504[_0xaaf6('0x3b')]=qs['sort'](_0x347b23['query'][_0xaaf6('0x3c')]);_0x4df504[_0xaaf6('0x3d')]=qs['filters'](_[_0xaaf6('0x3e')](_0x347b23[_0xaaf6('0x36')],_0x30f154['filters']),_0x391780);if(_0x347b23[_0xaaf6('0x36')][_0xaaf6('0x3f')]){_0x4df504['where']=_[_0xaaf6('0x40')](_0x4df504[_0xaaf6('0x3d')],{'$or':_[_0xaaf6('0x2d')](_0x391780,function(_0x464efa){if(_0x464efa[_0xaaf6('0x30')]!==_0xaaf6('0x41')){var _0x45699f={};_0x45699f[_0x464efa[_0xaaf6('0x2a')]]={'$like':'%'+_0x347b23['query'][_0xaaf6('0x3f')]+'%'};return _0x45699f;}})});}_0x4df504=_['merge']({},_0x4df504,_0x347b23['options']);var _0x28dcc6={'where':_0x4df504[_0xaaf6('0x3d')]};return db[_0xaaf6('0x42')][_0xaaf6('0x23')](_0x28dcc6)[_0xaaf6('0x28')](function(_0x22fbe3){_0x143fba['count']=_0x22fbe3;if(_0x347b23[_0xaaf6('0x36')]['includeAll']){_0x4df504[_0xaaf6('0x43')]=[{'all':!![]}];}return db['SugarcrmAccount']['findAll'](_0x4df504);})[_0xaaf6('0x28')](function(_0x4dfeb8){_0x143fba[_0xaaf6('0x44')]=_0x4dfeb8;return _0x143fba;})[_0xaaf6('0x28')](respondWithFilteredResult(_0x20818f,_0x4df504))[_0xaaf6('0x45')](handleError(_0x20818f,null));};exports[_0xaaf6('0x46')]=function(_0x1228d8,_0x3bf08f){var _0x409c52={'raw':![],'where':{'id':_0x1228d8[_0xaaf6('0x47')]['id']}},_0x3a819a={};_0x3a819a[_0xaaf6('0x32')]=_[_0xaaf6('0x33')](db['SugarcrmAccount']['rawAttributes']);_0x3a819a[_0xaaf6('0x36')]=_[_0xaaf6('0x33')](_0x1228d8[_0xaaf6('0x36')]);_0x3a819a[_0xaaf6('0x34')]=_[_0xaaf6('0x35')](_0x3a819a[_0xaaf6('0x32')],_0x3a819a[_0xaaf6('0x36')]);_0x409c52[_0xaaf6('0x37')]=_[_0xaaf6('0x35')](_0x3a819a[_0xaaf6('0x32')],qs[_0xaaf6('0x38')](_0x1228d8[_0xaaf6('0x36')]['fields']));_0x409c52[_0xaaf6('0x37')]=_0x409c52[_0xaaf6('0x37')][_0xaaf6('0x39')]?_0x409c52[_0xaaf6('0x37')]:_0x3a819a[_0xaaf6('0x32')];if(_0x1228d8[_0xaaf6('0x36')]['includeAll']){_0x409c52[_0xaaf6('0x43')]=[{'all':!![]}];}_0x409c52=_[_0xaaf6('0x40')]({},_0x409c52,_0x1228d8[_0xaaf6('0x48')]);return db[_0xaaf6('0x42')]['find'](_0x409c52)[_0xaaf6('0x28')](handleEntityNotFound(_0x3bf08f,null))['then'](respondWithResult(_0x3bf08f,null))[_0xaaf6('0x45')](handleError(_0x3bf08f,null));};exports[_0xaaf6('0x49')]=function(_0x465854,_0x2ea159){return db[_0xaaf6('0x42')][_0xaaf6('0x49')](_0x465854[_0xaaf6('0x4a')],{})[_0xaaf6('0x28')](respondWithResult(_0x2ea159,0xc9))[_0xaaf6('0x45')](handleError(_0x2ea159,null));};exports['update']=function(_0x30539c,_0x4412aa){if(_0x30539c[_0xaaf6('0x4a')]['id']){delete _0x30539c[_0xaaf6('0x4a')]['id'];}return db[_0xaaf6('0x42')][_0xaaf6('0x4b')]({'where':{'id':_0x30539c[_0xaaf6('0x47')]['id']}})[_0xaaf6('0x28')](handleEntityNotFound(_0x4412aa,null))[_0xaaf6('0x28')](saveUpdates(_0x30539c['body'],null))[_0xaaf6('0x28')](respondWithResult(_0x4412aa,null))[_0xaaf6('0x45')](handleError(_0x4412aa,null));};exports[_0xaaf6('0x4c')]=function(_0x16c70a,_0x8541b9){return db[_0xaaf6('0x42')][_0xaaf6('0x4b')]({'where':{'id':_0x16c70a[_0xaaf6('0x47')]['id']}})[_0xaaf6('0x28')](handleEntityNotFound(_0x8541b9,null))[_0xaaf6('0x28')](removeEntity(_0x8541b9,null))[_0xaaf6('0x45')](handleError(_0x8541b9,null));};exports['getConfigurations']=function(_0x5ee9b2,_0xd2771e,_0x546900){var _0x141dc2={};var _0x56e744={};var _0x2e39ef;var _0xb6a1a2;return db[_0xaaf6('0x42')][_0xaaf6('0x4d')]({'where':{'id':_0x5ee9b2[_0xaaf6('0x47')]['id']}})[_0xaaf6('0x28')](handleEntityNotFound(_0xd2771e,null))[_0xaaf6('0x28')](function(_0x4eea01){if(_0x4eea01){_0x2e39ef=_0x4eea01;_0x56e744[_0xaaf6('0x32')]=_[_0xaaf6('0x33')](db[_0xaaf6('0x4e')]['rawAttributes']);_0x56e744[_0xaaf6('0x36')]=_[_0xaaf6('0x33')](_0x5ee9b2['query']);_0x56e744['filters']=_[_0xaaf6('0x35')](_0x56e744[_0xaaf6('0x32')],_0x56e744['query']);_0x141dc2[_0xaaf6('0x37')]=_[_0xaaf6('0x35')](_0x56e744['model'],qs[_0xaaf6('0x38')](_0x5ee9b2['query'][_0xaaf6('0x38')]));_0x141dc2[_0xaaf6('0x37')]=_0x141dc2[_0xaaf6('0x37')][_0xaaf6('0x39')]?_0x141dc2[_0xaaf6('0x37')]:_0x56e744[_0xaaf6('0x32')];_0x141dc2[_0xaaf6('0x3b')]=qs['sort'](_0x5ee9b2['query']['sort']);_0x141dc2[_0xaaf6('0x3d')]=qs[_0xaaf6('0x34')](_[_0xaaf6('0x3e')](_0x5ee9b2[_0xaaf6('0x36')],_0x56e744[_0xaaf6('0x34')]));if(_0x5ee9b2[_0xaaf6('0x36')][_0xaaf6('0x3f')]){_0x141dc2[_0xaaf6('0x3d')]=_['merge'](_0x141dc2[_0xaaf6('0x3d')],{'$or':_[_0xaaf6('0x2d')](_0x141dc2['attributes'],function(_0x420429){var _0x58c32f={};_0x58c32f[_0x420429]={'$like':'%'+_0x5ee9b2[_0xaaf6('0x36')][_0xaaf6('0x3f')]+'%'};return _0x58c32f;})});}_0x141dc2=_[_0xaaf6('0x40')]({},_0x141dc2,_0x5ee9b2['options']);return _0x2e39ef['getConfigurations'](_0x141dc2);}})['then'](function(_0xc26874){if(_0xc26874){_0xb6a1a2=_0xc26874[_0xaaf6('0x39')];if(!_0x5ee9b2[_0xaaf6('0x36')][_0xaaf6('0x3a')](_0xaaf6('0x4f'))){_0x141dc2['limit']=qs['limit'](_0x5ee9b2['query'][_0xaaf6('0x21')]);_0x141dc2[_0xaaf6('0x20')]=qs['offset'](_0x5ee9b2[_0xaaf6('0x36')][_0xaaf6('0x20')]);}return _0x2e39ef[_0xaaf6('0x50')](_0x141dc2);}})['then'](function(_0x1ab608){if(_0x1ab608){return _0x1ab608?{'count':_0xb6a1a2,'rows':_0x1ab608}:null;}})['then'](respondWithResult(_0xd2771e,null))[_0xaaf6('0x45')](handleError(_0xd2771e,null));};exports['addConfiguration']=function(_0xdac63b,_0x19b4bd,_0x23ac98){if(_0xdac63b[_0xaaf6('0x4a')]['id']){delete _0xdac63b['body']['id'];}return db[_0xaaf6('0x42')][_0xaaf6('0x4d')]({'where':{'id':_0xdac63b['params']['id']}})[_0xaaf6('0x28')](handleEntityNotFound(_0x19b4bd,null))[_0xaaf6('0x28')](function(_0x2b2947){if(_0x2b2947){_0xdac63b[_0xaaf6('0x4a')]['AccountId']=_0x2b2947['id'];_0xdac63b[_0xaaf6('0x4a')][_0xaaf6('0x51')]=integrations[_0xaaf6('0x52')](_0xdac63b[_0xaaf6('0x4a')]['channel'],_0xdac63b[_0xaaf6('0x4a')][_0xaaf6('0x30')]);_0xdac63b[_0xaaf6('0x4a')]['Descriptions']=integrations[_0xaaf6('0x53')](_0xdac63b['body'][_0xaaf6('0x54')],_0xdac63b[_0xaaf6('0x4a')][_0xaaf6('0x30')]);return db[_0xaaf6('0x4e')]['create'](_0xdac63b[_0xaaf6('0x4a')],{'include':[{'model':db[_0xaaf6('0x55')],'as':_0xaaf6('0x51')},{'model':db[_0xaaf6('0x55')],'as':'Descriptions'}]});}return null;})[_0xaaf6('0x28')](respondWithResult(_0x19b4bd,null))[_0xaaf6('0x45')](handleError(_0x19b4bd,null));};exports[_0xaaf6('0x56')]=function(_0x138d2c,_0x2e33f6,_0x4f3a55){var _0x54b730='';var _0x5c3984=['id',_0xaaf6('0x2a'),_0xaaf6('0x57'),'created_by','description',_0xaaf6('0x58'),'duration_hours','duration_minutes','parent_id',_0xaaf6('0x59'),_0xaaf6('0x5a'),_0xaaf6('0x5b')];return db['SugarcrmAccount'][_0xaaf6('0x4d')]({'where':{'id':_0x138d2c[_0xaaf6('0x47')]['id']},'attributes':['id','username',_0xaaf6('0x5c'),'remoteUri']})[_0xaaf6('0x28')](handleEntityNotFound(_0x2e33f6,null))[_0xaaf6('0x28')](function(_0x84cde2){if(_0x84cde2){_0x54b730=_0x84cde2[_0xaaf6('0x5d')];var _0x34b97a=_0x54b730[_0xaaf6('0x5e')](-0x1);if(_0x34b97a==='/'){_0x54b730=_0x54b730[_0xaaf6('0x5f')](0x0,_0x54b730[_0xaaf6('0x60')](_0x34b97a));}return rp({'method':'POST','uri':util[_0xaaf6('0x61')](_0xaaf6('0x62'),_0x54b730,_0xaaf6('0x63')),'json':!![],'form':{'method':'login','input_type':'JSON','response_type':_0xaaf6('0x64'),'rest_data':JSON[_0xaaf6('0x65')]({'user_auth':{'user_name':_0x84cde2[_0xaaf6('0x66')],'password':_0x84cde2['password'],'encryption':'PLAIN'},'application':_0xaaf6('0x67')})}});}})[_0xaaf6('0x28')](function(_0x634f9c){if(_0x634f9c&&_0x634f9c[_0xaaf6('0x2a')]!==_0xaaf6('0x68')&&_0x634f9c[_0xaaf6('0x2a')]!==_0xaaf6('0x69')){return rp({'method':_0xaaf6('0x6a'),'uri':util[_0xaaf6('0x61')](_0xaaf6('0x62'),_0x54b730,_0xaaf6('0x63')),'json':!![],'form':{'method':_0xaaf6('0x6b'),'input_type':_0xaaf6('0x64'),'response_type':_0xaaf6('0x64'),'rest_data':JSON[_0xaaf6('0x65')]({'session':_0x634f9c['id'],'module_name':_0xaaf6('0x6c')})}})[_0xaaf6('0x28')](function(_0x288790){if(_0x288790){var _0x4de6f8=_[_0xaaf6('0x6d')](_0x288790[_0xaaf6('0x6e')]);_['remove'](_0x4de6f8,function(_0x3cb591){return _0x5c3984[_0xaaf6('0x6f')](_0x3cb591[_0xaaf6('0x2a')]);});return{'count':_0x4de6f8[_0xaaf6('0x39')],'rows':_[_0xaaf6('0x2d')](_0x4de6f8,function(_0x4a5ba8){return{'id':_0x4a5ba8[_0xaaf6('0x2a')],'name':_0x4a5ba8[_0xaaf6('0x70')],'custom':_['endsWith'](_0x4a5ba8[_0xaaf6('0x2a')],'_c')?!![]:![],'options':_0x4a5ba8[_0xaaf6('0x48')]?_[_0xaaf6('0x2d')](_[_0xaaf6('0x6d')](_0x4a5ba8[_0xaaf6('0x48')]),function(_0x364867){return{'name':_0x364867[_0xaaf6('0x71')],'value':_0x364867[_0xaaf6('0x2a')]};}):[]};})};}})[_0xaaf6('0x28')](respondWithResult(_0x2e33f6,null))[_0xaaf6('0x45')](function(_0x1ab78e){var _0x42db38=_0x138d2c[_0xaaf6('0x36')][_0xaaf6('0x72')]?0x1f4:_0x1ab78e[_0xaaf6('0x73')]||0x1f4;logger['error'](_0xaaf6('0x74'),_0xaaf6('0x56'),_0x42db38,JSON[_0xaaf6('0x65')](_0x1ab78e));delete _0x1ab78e['name'];if(_0x42db38===0x191){_0x42db38=0x190;}_0x2e33f6[_0xaaf6('0x1f')](_0x42db38)['send'](_0x138d2c[_0xaaf6('0x36')][_0xaaf6('0x72')]?{'message':_0xaaf6('0x75'),'statusCode':_0x1ab78e['statusCode']}:_0x1ab78e);});}else{var _0x52544e=0x1f4;_0x2e33f6[_0xaaf6('0x1f')](_0x52544e)[_0xaaf6('0x2b')]({'message':_0xaaf6('0x75'),'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 89dc092..4c27d0e 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 _0x1472=['request-promise','path','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x1472,0x166));var _0x2147=function(_0x45b1ba,_0x5a6a21){_0x45b1ba=_0x45b1ba-0x0;var _0x145ddb=_0x1472[_0x45b1ba];return _0x145ddb;};'use strict';var _=require(_0x2147('0x0'));var util=require(_0x2147('0x1'));var logger=require(_0x2147('0x2'))(_0x2147('0x3'));var moment=require(_0x2147('0x4'));var BPromise=require(_0x2147('0x5'));var rp=require(_0x2147('0x6'));var fs=require('fs');var path=require(_0x2147('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x2147('0x8'));var integrations=require(_0x2147('0x9'));module[_0x2147('0xa')]=function(_0x5593f4,_0x4b8324){return _0x5593f4[_0x2147('0xb')]('SugarcrmAccount',attributes,{'tableName':_0x2147('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcf37=['./intSugarcrmAccount.attributes','../../components/integrations/configuration','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xcf37,0xdc));var _0x7cf3=function(_0x608903,_0x42518e){_0x608903=_0x608903-0x0;var _0x92ba79=_0xcf37[_0x608903];return _0x92ba79;};'use strict';var _=require('lodash');var util=require(_0x7cf3('0x0'));var logger=require(_0x7cf3('0x1'))(_0x7cf3('0x2'));var moment=require(_0x7cf3('0x3'));var BPromise=require(_0x7cf3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7cf3('0x5'));var rimraf=require(_0x7cf3('0x6'));var config=require(_0x7cf3('0x7'));var attributes=require(_0x7cf3('0x8'));var integrations=require(_0x7cf3('0x9'));module['exports']=function(_0x488938,_0x4fd617){return _0x488938['define'](_0x7cf3('0xa'),attributes,{'tableName':_0x7cf3('0xb'),'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 fdcd561..ad7c0e3 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 _0xfc1c=['SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetSugarcrmAccount','SugarcrmAccount','options','where','attributes','limit','map','include','model','find','raw','ShowSugarcrmAccount','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x290d3a,_0x2e1b44){var _0x39f0cf=function(_0x4f4d01){while(--_0x4f4d01){_0x290d3a['push'](_0x290d3a['shift']());}};_0x39f0cf(++_0x2e1b44);}(_0xfc1c,0x18c));var _0xcfc1=function(_0x2158a8,_0x335f85){_0x2158a8=_0x2158a8-0x0;var _0x4b1071=_0xfc1c[_0x2158a8];return _0x4b1071;};'use strict';var _=require('lodash');var util=require(_0xcfc1('0x0'));var moment=require(_0xcfc1('0x1'));var BPromise=require(_0xcfc1('0x2'));var rs=require(_0xcfc1('0x3'));var fs=require('fs');var Redis=require(_0xcfc1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xcfc1('0x5'));var logger=require(_0xcfc1('0x6'))(_0xcfc1('0x7'));var config=require(_0xcfc1('0x8'));var jayson=require(_0xcfc1('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x114901,_0xbac019,_0x4efced){return new BPromise(function(_0x4dca8a,_0x31f2ca){return client[_0xcfc1('0xa')](_0x114901,_0x4efced)[_0xcfc1('0xb')](function(_0x3f99af){logger['info'](_0xcfc1('0xc'),_0xbac019,_0xcfc1('0xd'));logger[_0xcfc1('0xe')](_0xcfc1('0xf'),_0xbac019,_0xcfc1('0xd'),JSON[_0xcfc1('0x10')](_0x3f99af));if(_0x3f99af[_0xcfc1('0x11')]){if(_0x3f99af[_0xcfc1('0x11')]['code']===0x1f4){logger[_0xcfc1('0x11')](_0xcfc1('0xc'),_0xbac019,_0x3f99af['error'][_0xcfc1('0x12')]);return _0x31f2ca(_0x3f99af['error'][_0xcfc1('0x12')]);}logger[_0xcfc1('0x11')](_0xcfc1('0xc'),_0xbac019,_0x3f99af[_0xcfc1('0x11')][_0xcfc1('0x12')]);return _0x4dca8a(_0x3f99af[_0xcfc1('0x11')][_0xcfc1('0x12')]);}else{logger[_0xcfc1('0x13')](_0xcfc1('0xc'),_0xbac019,_0xcfc1('0xd'));_0x4dca8a(_0x3f99af[_0xcfc1('0x14')][_0xcfc1('0x12')]);}})[_0xcfc1('0x15')](function(_0x536264){logger[_0xcfc1('0x11')](_0xcfc1('0xc'),_0xbac019,_0x536264);_0x31f2ca(_0x536264);});});}exports[_0xcfc1('0x16')]=function(_0xfb5528){var _0x3c4b91=this;return new Promise(function(_0x2f7f4c,_0x4a5ee7){return db[_0xcfc1('0x17')]['findAll']({'raw':_0xfb5528[_0xcfc1('0x18')]?_0xfb5528[_0xcfc1('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xfb5528[_0xcfc1('0x18')]?_0xfb5528[_0xcfc1('0x18')][_0xcfc1('0x19')]||null:null,'attributes':_0xfb5528['options']?_0xfb5528[_0xcfc1('0x18')][_0xcfc1('0x1a')]||null:null,'limit':_0xfb5528['options']?_0xfb5528[_0xcfc1('0x18')][_0xcfc1('0x1b')]||null:null,'include':_0xfb5528[_0xcfc1('0x18')]?_0xfb5528['options']['include']?_[_0xcfc1('0x1c')](_0xfb5528[_0xcfc1('0x18')][_0xcfc1('0x1d')],function(_0x49e6b0){return{'model':db[_0x49e6b0[_0xcfc1('0x1e')]],'as':_0x49e6b0['as'],'attributes':_0x49e6b0[_0xcfc1('0x1a')],'include':_0x49e6b0[_0xcfc1('0x1d')]?_[_0xcfc1('0x1c')](_0x49e6b0[_0xcfc1('0x1d')],function(_0x56fe29){return{'model':db[_0x56fe29['model']],'as':_0x56fe29['as'],'attributes':_0x56fe29[_0xcfc1('0x1a')],'include':_0x56fe29[_0xcfc1('0x1d')]?_['map'](_0x56fe29[_0xcfc1('0x1d')],function(_0x5cfbb7){return{'model':db[_0x5cfbb7[_0xcfc1('0x1e')]],'as':_0x5cfbb7['as'],'attributes':_0x5cfbb7[_0xcfc1('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x189d9a){logger[_0xcfc1('0x13')]('GetSugarcrmAccount',_0xfb5528);logger['debug']('GetSugarcrmAccount',_0xfb5528,JSON[_0xcfc1('0x10')](_0x189d9a));_0x2f7f4c(_0x189d9a);})['catch'](function(_0x46d591){logger[_0xcfc1('0x11')](_0xcfc1('0x16'),_0x46d591[_0xcfc1('0x12')],_0xfb5528);_0x4a5ee7(_0x3c4b91[_0xcfc1('0x11')](0x1f4,_0x46d591[_0xcfc1('0x12')]));});});};exports['ShowSugarcrmAccount']=function(_0x28f3ec){var _0x350b85=this;return new Promise(function(_0x11d747,_0x9b2954){return db[_0xcfc1('0x17')][_0xcfc1('0x1f')]({'raw':_0x28f3ec[_0xcfc1('0x18')]?_0x28f3ec[_0xcfc1('0x18')][_0xcfc1('0x20')]===undefined?!![]:![]:!![],'where':_0x28f3ec[_0xcfc1('0x18')]?_0x28f3ec[_0xcfc1('0x18')][_0xcfc1('0x19')]||null:null,'attributes':_0x28f3ec[_0xcfc1('0x18')]?_0x28f3ec[_0xcfc1('0x18')][_0xcfc1('0x1a')]||null:null,'include':_0x28f3ec[_0xcfc1('0x18')]?_0x28f3ec[_0xcfc1('0x18')][_0xcfc1('0x1d')]?_[_0xcfc1('0x1c')](_0x28f3ec['options']['include'],function(_0x35c717){return{'model':db[_0x35c717[_0xcfc1('0x1e')]],'as':_0x35c717['as'],'attributes':_0x35c717[_0xcfc1('0x1a')],'include':_0x35c717[_0xcfc1('0x1d')]?_[_0xcfc1('0x1c')](_0x35c717[_0xcfc1('0x1d')],function(_0x524fac){return{'model':db[_0x524fac[_0xcfc1('0x1e')]],'as':_0x524fac['as'],'attributes':_0x524fac[_0xcfc1('0x1a')],'include':_0x524fac['include']?_[_0xcfc1('0x1c')](_0x524fac[_0xcfc1('0x1d')],function(_0x5cad08){return{'model':db[_0x5cad08[_0xcfc1('0x1e')]],'as':_0x5cad08['as'],'attributes':_0x5cad08[_0xcfc1('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xcfc1('0xb')](function(_0x19fd9d){logger['info'](_0xcfc1('0x21'),_0x28f3ec);logger[_0xcfc1('0xe')]('ShowSugarcrmAccount',_0x28f3ec,JSON[_0xcfc1('0x10')](_0x19fd9d));_0x11d747(_0x19fd9d);})[_0xcfc1('0x15')](function(_0x351a0e){logger[_0xcfc1('0x11')](_0xcfc1('0x21'),_0x351a0e[_0xcfc1('0x12')],_0x28f3ec);_0x9b2954(_0x350b85['error'](0x1f4,_0x351a0e[_0xcfc1('0x12')]));});});}; \ No newline at end of file +var _0xcf11=['result','findAll','options','raw','where','attributes','limit','include','map','model','GetSugarcrmAccount','catch','find','ShowSugarcrmAccount','util','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x5d0d7f,_0x1d0ded){var _0x4b2262=function(_0x486dca){while(--_0x486dca){_0x5d0d7f['push'](_0x5d0d7f['shift']());}};_0x4b2262(++_0x1d0ded);}(_0xcf11,0xfc));var _0x1cf1=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xcf11[_0x29e3b6];return _0x55d4b0;};'use strict';var _=require('lodash');var util=require(_0x1cf1('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1cf1('0x1'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cf1('0x2'));var logger=require(_0x1cf1('0x3'))(_0x1cf1('0x4'));var config=require(_0x1cf1('0x5'));var jayson=require(_0x1cf1('0x6'));var client=jayson[_0x1cf1('0x7')][_0x1cf1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c5fa,_0x1a32ed,_0xd30483){return new BPromise(function(_0x13fe9e,_0x46d0d9){return client[_0x1cf1('0x9')](_0x1c5fa,_0xd30483)[_0x1cf1('0xa')](function(_0x2ffda5){logger[_0x1cf1('0xb')](_0x1cf1('0xc'),_0x1a32ed,_0x1cf1('0xd'));logger[_0x1cf1('0xe')](_0x1cf1('0xf'),_0x1a32ed,_0x1cf1('0xd'),JSON[_0x1cf1('0x10')](_0x2ffda5));if(_0x2ffda5[_0x1cf1('0x11')]){if(_0x2ffda5[_0x1cf1('0x11')][_0x1cf1('0x12')]===0x1f4){logger['error'](_0x1cf1('0xc'),_0x1a32ed,_0x2ffda5['error']['message']);return _0x46d0d9(_0x2ffda5[_0x1cf1('0x11')][_0x1cf1('0x13')]);}logger[_0x1cf1('0x11')]('SugarcrmAccount,\x20%s,\x20%s',_0x1a32ed,_0x2ffda5[_0x1cf1('0x11')][_0x1cf1('0x13')]);return _0x13fe9e(_0x2ffda5[_0x1cf1('0x11')][_0x1cf1('0x13')]);}else{logger['info'](_0x1cf1('0xc'),_0x1a32ed,_0x1cf1('0xd'));_0x13fe9e(_0x2ffda5[_0x1cf1('0x14')]['message']);}})['catch'](function(_0x3cd354){logger[_0x1cf1('0x11')](_0x1cf1('0xc'),_0x1a32ed,_0x3cd354);_0x46d0d9(_0x3cd354);});});}exports['GetSugarcrmAccount']=function(_0x18bcc9){var _0x4b30f1=this;return new Promise(function(_0xc27a2d,_0x20f3fa){return db['SugarcrmAccount'][_0x1cf1('0x15')]({'raw':_0x18bcc9[_0x1cf1('0x16')]?_0x18bcc9['options'][_0x1cf1('0x17')]===undefined?!![]:![]:!![],'where':_0x18bcc9[_0x1cf1('0x16')]?_0x18bcc9[_0x1cf1('0x16')][_0x1cf1('0x18')]||null:null,'attributes':_0x18bcc9[_0x1cf1('0x16')]?_0x18bcc9[_0x1cf1('0x16')][_0x1cf1('0x19')]||null:null,'limit':_0x18bcc9[_0x1cf1('0x16')]?_0x18bcc9[_0x1cf1('0x16')][_0x1cf1('0x1a')]||null:null,'include':_0x18bcc9[_0x1cf1('0x16')]?_0x18bcc9['options'][_0x1cf1('0x1b')]?_[_0x1cf1('0x1c')](_0x18bcc9[_0x1cf1('0x16')][_0x1cf1('0x1b')],function(_0x517459){return{'model':db[_0x517459[_0x1cf1('0x1d')]],'as':_0x517459['as'],'attributes':_0x517459[_0x1cf1('0x19')],'include':_0x517459[_0x1cf1('0x1b')]?_[_0x1cf1('0x1c')](_0x517459[_0x1cf1('0x1b')],function(_0xfb4804){return{'model':db[_0xfb4804[_0x1cf1('0x1d')]],'as':_0xfb4804['as'],'attributes':_0xfb4804['attributes'],'include':_0xfb4804['include']?_[_0x1cf1('0x1c')](_0xfb4804[_0x1cf1('0x1b')],function(_0x2c1fd7){return{'model':db[_0x2c1fd7[_0x1cf1('0x1d')]],'as':_0x2c1fd7['as'],'attributes':_0x2c1fd7['attributes']};}):[]};}):[]};}):[]:[]})[_0x1cf1('0xa')](function(_0x53663a){logger[_0x1cf1('0xb')](_0x1cf1('0x1e'),_0x18bcc9);logger['debug']('GetSugarcrmAccount',_0x18bcc9,JSON['stringify'](_0x53663a));_0xc27a2d(_0x53663a);})[_0x1cf1('0x1f')](function(_0x342329){logger[_0x1cf1('0x11')](_0x1cf1('0x1e'),_0x342329[_0x1cf1('0x13')],_0x18bcc9);_0x20f3fa(_0x4b30f1[_0x1cf1('0x11')](0x1f4,_0x342329[_0x1cf1('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x632b2e){var _0x10f722=this;return new Promise(function(_0xec2cdd,_0x1385b3){return db['SugarcrmAccount'][_0x1cf1('0x20')]({'raw':_0x632b2e['options']?_0x632b2e[_0x1cf1('0x16')][_0x1cf1('0x17')]===undefined?!![]:![]:!![],'where':_0x632b2e[_0x1cf1('0x16')]?_0x632b2e[_0x1cf1('0x16')][_0x1cf1('0x18')]||null:null,'attributes':_0x632b2e[_0x1cf1('0x16')]?_0x632b2e[_0x1cf1('0x16')]['attributes']||null:null,'include':_0x632b2e[_0x1cf1('0x16')]?_0x632b2e[_0x1cf1('0x16')][_0x1cf1('0x1b')]?_['map'](_0x632b2e[_0x1cf1('0x16')][_0x1cf1('0x1b')],function(_0x55e53e){return{'model':db[_0x55e53e[_0x1cf1('0x1d')]],'as':_0x55e53e['as'],'attributes':_0x55e53e[_0x1cf1('0x19')],'include':_0x55e53e[_0x1cf1('0x1b')]?_[_0x1cf1('0x1c')](_0x55e53e[_0x1cf1('0x1b')],function(_0xf24711){return{'model':db[_0xf24711['model']],'as':_0xf24711['as'],'attributes':_0xf24711[_0x1cf1('0x19')],'include':_0xf24711[_0x1cf1('0x1b')]?_['map'](_0xf24711[_0x1cf1('0x1b')],function(_0x26a486){return{'model':db[_0x26a486[_0x1cf1('0x1d')]],'as':_0x26a486['as'],'attributes':_0x26a486[_0x1cf1('0x19')]};}):[]};}):[]};}):[]:[]})[_0x1cf1('0xa')](function(_0xf43271){logger[_0x1cf1('0xb')](_0x1cf1('0x21'),_0x632b2e);logger['debug'](_0x1cf1('0x21'),_0x632b2e,JSON['stringify'](_0xf43271));_0xec2cdd(_0xf43271);})['catch'](function(_0x266378){logger['error'](_0x1cf1('0x21'),_0x266378['message'],_0x632b2e);_0x1385b3(_0x10f722[_0x1cf1('0x11')](0x1f4,_0x266378['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index b2c8ee1..ded859f 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 _0xb504=['getDescriptions','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xb504,0xbd));var _0x4b50=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb504[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x4b50('0x0'));var util=require(_0x4b50('0x1'));var path=require(_0x4b50('0x2'));var timeout=require(_0x4b50('0x3'));var express=require(_0x4b50('0x4'));var router=express[_0x4b50('0x5')]();var fs_extra=require(_0x4b50('0x6'));var auth=require(_0x4b50('0x7'));var interaction=require(_0x4b50('0x8'));var config=require(_0x4b50('0x9'));var controller=require(_0x4b50('0xa'));router[_0x4b50('0xb')]('/',auth['isAuthenticated'](),controller[_0x4b50('0xc')]);router['get']('/:id',auth[_0x4b50('0xd')](),controller[_0x4b50('0xe')]);router[_0x4b50('0xb')](_0x4b50('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0x4b50('0xb')](_0x4b50('0x10'),auth['isAuthenticated'](),controller[_0x4b50('0x11')]);router[_0x4b50('0xb')](_0x4b50('0x12'),auth[_0x4b50('0xd')](),controller[_0x4b50('0x13')]);router[_0x4b50('0x14')]('/',auth[_0x4b50('0xd')](),controller[_0x4b50('0x15')]);router[_0x4b50('0x16')](_0x4b50('0x17'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x4b50('0x17'),auth['isAuthenticated'](),controller[_0x4b50('0x18')]);module[_0x4b50('0x19')]=router; \ No newline at end of file +var _0xa312=['create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmConfiguration.controller','get','/:id','show','/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa312,0x162));var _0x2a31=function(_0x35d775,_0x25431e){_0x35d775=_0x35d775-0x0;var _0x59384d=_0xa312[_0x35d775];return _0x59384d;};'use strict';var multer=require(_0x2a31('0x0'));var util=require(_0x2a31('0x1'));var path=require(_0x2a31('0x2'));var timeout=require(_0x2a31('0x3'));var express=require(_0x2a31('0x4'));var router=express[_0x2a31('0x5')]();var fs_extra=require(_0x2a31('0x6'));var auth=require(_0x2a31('0x7'));var interaction=require(_0x2a31('0x8'));var config=require('../../config/environment');var controller=require(_0x2a31('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2a31('0xa')](_0x2a31('0xb'),auth['isAuthenticated'](),controller[_0x2a31('0xc')]);router[_0x2a31('0xa')](_0x2a31('0xd'),auth[_0x2a31('0xe')](),controller[_0x2a31('0xf')]);router[_0x2a31('0xa')](_0x2a31('0x10'),auth[_0x2a31('0xe')](),controller[_0x2a31('0x11')]);router[_0x2a31('0xa')](_0x2a31('0x12'),auth[_0x2a31('0xe')](),controller[_0x2a31('0x13')]);router[_0x2a31('0x14')]('/',auth[_0x2a31('0xe')](),controller[_0x2a31('0x15')]);router['put'](_0x2a31('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x2a31('0x16')](_0x2a31('0xb'),auth[_0x2a31('0xe')](),controller[_0x2a31('0x17')]);module[_0x2a31('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 6f318fd..de3920e 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 _0xe987=['sequelize','exports','STRING'];(function(_0x598375,_0x3bedf8){var _0x119579=function(_0x352053){while(--_0x352053){_0x598375['push'](_0x598375['shift']());}};_0x119579(++_0x3bedf8);}(_0xe987,0xc9));var _0x7e98=function(_0x4845bc,_0x25e144){_0x4845bc=_0x4845bc-0x0;var _0x82713d=_0xe987[_0x4845bc];return _0x82713d;};'use strict';var Sequelize=require(_0x7e98('0x0'));module[_0x7e98('0x1')]={'name':{'type':Sequelize[_0x7e98('0x2')]},'description':{'type':Sequelize[_0x7e98('0x2')]}}; \ No newline at end of file +var _0xc73e=['sequelize','STRING'];(function(_0x452a27,_0x5a2b48){var _0x385c7b=function(_0x5bc06a){while(--_0x5bc06a){_0x452a27['push'](_0x452a27['shift']());}};_0x385c7b(++_0x5a2b48);}(_0xc73e,0x102));var _0xec73=function(_0x3f7c5c,_0x38dedf){_0x3f7c5c=_0x3f7c5c-0x0;var _0x384461=_0xc73e[_0x3f7c5c];return _0x384461;};'use strict';var Sequelize=require(_0xec73('0x0'));module['exports']={'name':{'type':Sequelize[_0xec73('0x1')]},'description':{'type':Sequelize[_0xec73('0x1')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 86948f0..bb4f20f 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 _0xc40e=['order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','find','create','body','getFields','findOne','params','SugarcrmField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','apply','reject','save','update','destroy','then','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x2a2166,_0x3a077f){var _0x3bcf50=function(_0x3f0300){while(--_0x3f0300){_0x2a2166['push'](_0x2a2166['shift']());}};_0x3bcf50(++_0x3a077f);}(_0xc40e,0x1a2));var _0xec40=function(_0xf974f4,_0x4c3f1c){_0xf974f4=_0xf974f4-0x0;var _0x1a1e47=_0xc40e[_0xf974f4];return _0x1a1e47;};'use strict';var emlformat=require(_0xec40('0x0'));var rimraf=require(_0xec40('0x1'));var zipdir=require(_0xec40('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xec40('0x3'));var moment=require(_0xec40('0x4'));var BPromise=require(_0xec40('0x5'));var Mustache=require(_0xec40('0x6'));var util=require(_0xec40('0x7'));var path=require(_0xec40('0x8'));var sox=require(_0xec40('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec40('0xa'));var _=require(_0xec40('0xb'));var squel=require(_0xec40('0xc'));var crypto=require(_0xec40('0xd'));var jsforce=require(_0xec40('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xec40('0xf'));var querystring=require('querystring');var Papa=require(_0xec40('0x10'));var Redis=require('ioredis');var authService=require(_0xec40('0x11'));var qs=require(_0xec40('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec40('0x13'));var logger=require(_0xec40('0x14'))(_0xec40('0x15'));var utils=require('../../config/utils');var config=require(_0xec40('0x16'));var licenseUtil=require(_0xec40('0x17'));var db=require(_0xec40('0x18'))['db'];function respondWithStatusCode(_0x354468,_0x25b9c4){_0x25b9c4=_0x25b9c4||0xcc;return function(_0xecb835){if(_0xecb835){return _0x354468[_0xec40('0x19')](_0x25b9c4);}return _0x354468[_0xec40('0x1a')](_0x25b9c4)['end']();};}function respondWithResult(_0x1268e6,_0x19575a){_0x19575a=_0x19575a||0xc8;return function(_0x4eea2e){if(_0x4eea2e){return _0x1268e6[_0xec40('0x1a')](_0x19575a)[_0xec40('0x1b')](_0x4eea2e);}};}function respondWithFilteredResult(_0x1c8914,_0x4b4a37){return function(_0x47ab59){if(_0x47ab59){var _0x1de5ac=typeof _0x4b4a37[_0xec40('0x1c')]===_0xec40('0x1d')&&typeof _0x4b4a37['limit']===_0xec40('0x1d');var _0x475111=_0x47ab59[_0xec40('0x1e')];var _0x205f60=_0x1de5ac?0x0:_0x4b4a37[_0xec40('0x1c')];var _0xffc8dd=_0x1de5ac?_0x47ab59['count']:_0x4b4a37[_0xec40('0x1c')]+_0x4b4a37['limit'];var _0x370be5;if(_0xffc8dd>=_0x475111){_0xffc8dd=_0x475111;_0x370be5=0xc8;}else{_0x370be5=0xce;}_0x1c8914[_0xec40('0x1a')](_0x370be5);return _0x1c8914['set']('Content-Range',_0x205f60+'-'+_0xffc8dd+'/'+_0x475111)[_0xec40('0x1b')](_0x47ab59);}return null;};}function patchUpdates(_0x53b2b8){return function(_0x5b72af){try{jsonpatch[_0xec40('0x1f')](_0x5b72af,_0x53b2b8,!![]);}catch(_0x36b2b0){return BPromise[_0xec40('0x20')](_0x36b2b0);}return _0x5b72af[_0xec40('0x21')]();};}function saveUpdates(_0x560d53,_0x206704){return function(_0x3bfbbb){if(_0x3bfbbb){return _0x3bfbbb[_0xec40('0x22')](_0x560d53)['then'](function(_0x5a3d87){return _0x5a3d87;});}return null;};}function removeEntity(_0x5a4e62,_0x1471f6){return function(_0x57a69e){if(_0x57a69e){return _0x57a69e[_0xec40('0x23')]()[_0xec40('0x24')](function(){_0x5a4e62['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x264796,_0x328db8){return function(_0x1d036d){if(!_0x1d036d){_0x264796['sendStatus'](0x194);}return _0x1d036d;};}function handleError(_0x31b465,_0x3f2ce8){_0x3f2ce8=_0x3f2ce8||0x1f4;return function(_0x2bf315){logger['error'](_0x2bf315['stack']);if(_0x2bf315[_0xec40('0x25')]){delete _0x2bf315['name'];}_0x31b465[_0xec40('0x1a')](_0x3f2ce8)[_0xec40('0x26')](_0x2bf315);};}exports[_0xec40('0x27')]=function(_0x42e1a5,_0x8e7c91){var _0x33ffc4={},_0x348e74={},_0xc95c6d={'count':0x0,'rows':[]};var _0x8d9884=_[_0xec40('0x28')](db[_0xec40('0x29')][_0xec40('0x2a')],function(_0x52fe8c){return{'name':_0x52fe8c[_0xec40('0x2b')],'type':_0x52fe8c[_0xec40('0x2c')]['key']};});_0x348e74[_0xec40('0x2d')]=_[_0xec40('0x28')](_0x8d9884,'name');_0x348e74[_0xec40('0x2e')]=_[_0xec40('0x2f')](_0x42e1a5[_0xec40('0x2e')]);_0x348e74[_0xec40('0x30')]=_[_0xec40('0x31')](_0x348e74[_0xec40('0x2d')],_0x348e74[_0xec40('0x2e')]);_0x33ffc4[_0xec40('0x32')]=_[_0xec40('0x31')](_0x348e74[_0xec40('0x2d')],qs[_0xec40('0x33')](_0x42e1a5[_0xec40('0x2e')][_0xec40('0x33')]));_0x33ffc4[_0xec40('0x32')]=_0x33ffc4[_0xec40('0x32')][_0xec40('0x34')]?_0x33ffc4[_0xec40('0x32')]:_0x348e74[_0xec40('0x2d')];if(!_0x42e1a5[_0xec40('0x2e')][_0xec40('0x35')](_0xec40('0x36'))){_0x33ffc4[_0xec40('0x37')]=qs[_0xec40('0x37')](_0x42e1a5['query'][_0xec40('0x37')]);_0x33ffc4['offset']=qs['offset'](_0x42e1a5['query'][_0xec40('0x1c')]);}_0x33ffc4[_0xec40('0x38')]=qs[_0xec40('0x39')](_0x42e1a5[_0xec40('0x2e')][_0xec40('0x39')]);_0x33ffc4[_0xec40('0x3a')]=qs[_0xec40('0x30')](_[_0xec40('0x3b')](_0x42e1a5[_0xec40('0x2e')],_0x348e74[_0xec40('0x30')]),_0x8d9884);if(_0x42e1a5[_0xec40('0x2e')][_0xec40('0x3c')]){_0x33ffc4[_0xec40('0x3a')]=_['merge'](_0x33ffc4[_0xec40('0x3a')],{'$or':_[_0xec40('0x28')](_0x8d9884,function(_0x2247d0){if(_0x2247d0[_0xec40('0x2c')]!==_0xec40('0x3d')){var _0x13e2b5={};_0x13e2b5[_0x2247d0[_0xec40('0x25')]]={'$like':'%'+_0x42e1a5[_0xec40('0x2e')][_0xec40('0x3c')]+'%'};return _0x13e2b5;}})});}_0x33ffc4=_[_0xec40('0x3e')]({},_0x33ffc4,_0x42e1a5[_0xec40('0x3f')]);var _0x33af87={'where':_0x33ffc4[_0xec40('0x3a')]};return db['SugarcrmConfiguration'][_0xec40('0x1e')](_0x33af87)['then'](function(_0x43368a){_0xc95c6d['count']=_0x43368a;if(_0x42e1a5[_0xec40('0x2e')][_0xec40('0x40')]){_0x33ffc4[_0xec40('0x41')]=[{'all':!![]}];}return db['SugarcrmConfiguration'][_0xec40('0x42')](_0x33ffc4);})[_0xec40('0x24')](function(_0x33665f){_0xc95c6d[_0xec40('0x43')]=_0x33665f;return _0xc95c6d;})[_0xec40('0x24')](respondWithFilteredResult(_0x8e7c91,_0x33ffc4))[_0xec40('0x44')](handleError(_0x8e7c91,null));};exports[_0xec40('0x45')]=function(_0x52d801,_0x64cb09){var _0x57c7df={'raw':![],'where':{'id':_0x52d801['params']['id']}},_0x26a50b={};_0x26a50b[_0xec40('0x2d')]=_[_0xec40('0x2f')](db['SugarcrmConfiguration'][_0xec40('0x2a')]);_0x26a50b[_0xec40('0x2e')]=_[_0xec40('0x2f')](_0x52d801[_0xec40('0x2e')]);_0x26a50b[_0xec40('0x30')]=_[_0xec40('0x31')](_0x26a50b[_0xec40('0x2d')],_0x26a50b[_0xec40('0x2e')]);_0x57c7df[_0xec40('0x32')]=_[_0xec40('0x31')](_0x26a50b[_0xec40('0x2d')],qs['fields'](_0x52d801['query']['fields']));_0x57c7df[_0xec40('0x32')]=_0x57c7df[_0xec40('0x32')][_0xec40('0x34')]?_0x57c7df[_0xec40('0x32')]:_0x26a50b['model'];if(_0x52d801[_0xec40('0x2e')][_0xec40('0x40')]){_0x57c7df['include']=[{'all':!![]}];}_0x57c7df=_[_0xec40('0x3e')]({},_0x57c7df,_0x52d801[_0xec40('0x3f')]);return db[_0xec40('0x29')][_0xec40('0x46')](_0x57c7df)[_0xec40('0x24')](handleEntityNotFound(_0x64cb09,null))[_0xec40('0x24')](respondWithResult(_0x64cb09,null))[_0xec40('0x44')](handleError(_0x64cb09,null));};exports[_0xec40('0x47')]=function(_0x37cf3e,_0x2e9f06){return db[_0xec40('0x29')][_0xec40('0x47')](_0x37cf3e[_0xec40('0x48')],{})[_0xec40('0x24')](respondWithResult(_0x2e9f06,0xc9))['catch'](handleError(_0x2e9f06,null));};exports[_0xec40('0x22')]=function(_0x54923f,_0x282793){if(_0x54923f[_0xec40('0x48')]['id']){delete _0x54923f['body']['id'];}return db[_0xec40('0x29')][_0xec40('0x46')]({'where':{'id':_0x54923f['params']['id']}})[_0xec40('0x24')](handleEntityNotFound(_0x282793,null))[_0xec40('0x24')](saveUpdates(_0x54923f[_0xec40('0x48')],null))[_0xec40('0x24')](respondWithResult(_0x282793,null))['catch'](handleError(_0x282793,null));};exports[_0xec40('0x23')]=function(_0x366bb1,_0x4ccd84){return db[_0xec40('0x29')][_0xec40('0x46')]({'where':{'id':_0x366bb1['params']['id']}})[_0xec40('0x24')](handleEntityNotFound(_0x4ccd84,null))[_0xec40('0x24')](removeEntity(_0x4ccd84,null))[_0xec40('0x44')](handleError(_0x4ccd84,null));};exports[_0xec40('0x49')]=function(_0x1f21e0,_0x5b10f3,_0x12b0c5){var _0x4ac962={};var _0x4c6d18={};var _0x31f887;var _0x103a8d;return db[_0xec40('0x29')][_0xec40('0x4a')]({'where':{'id':_0x1f21e0[_0xec40('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5b10f3,null))[_0xec40('0x24')](function(_0x1b397d){if(_0x1b397d){_0x31f887=_0x1b397d;_0x4c6d18[_0xec40('0x2d')]=_[_0xec40('0x2f')](db[_0xec40('0x4c')]['rawAttributes']);_0x4c6d18[_0xec40('0x2e')]=_['keys'](_0x1f21e0[_0xec40('0x2e')]);_0x4c6d18[_0xec40('0x30')]=_[_0xec40('0x31')](_0x4c6d18[_0xec40('0x2d')],_0x4c6d18['query']);_0x4ac962['attributes']=_[_0xec40('0x31')](_0x4c6d18[_0xec40('0x2d')],qs[_0xec40('0x33')](_0x1f21e0[_0xec40('0x2e')]['fields']));_0x4ac962[_0xec40('0x32')]=_0x4ac962[_0xec40('0x32')]['length']?_0x4ac962[_0xec40('0x32')]:_0x4c6d18[_0xec40('0x2d')];_0x4ac962[_0xec40('0x38')]=qs[_0xec40('0x39')](_0x1f21e0[_0xec40('0x2e')][_0xec40('0x39')]);_0x4ac962['where']=qs[_0xec40('0x30')](_['pick'](_0x1f21e0[_0xec40('0x2e')],_0x4c6d18[_0xec40('0x30')]));if(_0x1f21e0[_0xec40('0x2e')][_0xec40('0x3c')]){_0x4ac962['where']=_[_0xec40('0x3e')](_0x4ac962[_0xec40('0x3a')],{'$or':_[_0xec40('0x28')](_0x4ac962['attributes'],function(_0x60d131){var _0x576be4={};_0x576be4[_0x60d131]={'$like':'%'+_0x1f21e0[_0xec40('0x2e')][_0xec40('0x3c')]+'%'};return _0x576be4;})});}_0x4ac962=_[_0xec40('0x3e')]({},_0x4ac962,_0x1f21e0[_0xec40('0x3f')]);return _0x31f887[_0xec40('0x49')](_0x4ac962);}})[_0xec40('0x24')](function(_0x345157){if(_0x345157){_0x103a8d=_0x345157[_0xec40('0x34')];if(!_0x1f21e0[_0xec40('0x2e')][_0xec40('0x35')](_0xec40('0x36'))){_0x4ac962[_0xec40('0x37')]=qs[_0xec40('0x37')](_0x1f21e0[_0xec40('0x2e')][_0xec40('0x37')]);_0x4ac962['offset']=qs[_0xec40('0x1c')](_0x1f21e0[_0xec40('0x2e')][_0xec40('0x1c')]);}return _0x31f887[_0xec40('0x49')](_0x4ac962);}})[_0xec40('0x24')](function(_0x279461){if(_0x279461){return _0x279461?{'count':_0x103a8d,'rows':_0x279461}:null;}})[_0xec40('0x24')](respondWithResult(_0x5b10f3,null))[_0xec40('0x44')](handleError(_0x5b10f3,null));};exports[_0xec40('0x4d')]=function(_0x5e494d,_0x47309f,_0x46d0a8){var _0x304c99={};var _0x383e9e={};var _0x2c0335;var _0x30993d;return db[_0xec40('0x29')][_0xec40('0x4a')]({'where':{'id':_0x5e494d[_0xec40('0x4b')]['id']}})[_0xec40('0x24')](handleEntityNotFound(_0x47309f,null))[_0xec40('0x24')](function(_0x38caae){if(_0x38caae){_0x2c0335=_0x38caae;_0x383e9e[_0xec40('0x2d')]=_['keys'](db[_0xec40('0x4c')][_0xec40('0x2a')]);_0x383e9e[_0xec40('0x2e')]=_[_0xec40('0x2f')](_0x5e494d[_0xec40('0x2e')]);_0x383e9e[_0xec40('0x30')]=_[_0xec40('0x31')](_0x383e9e[_0xec40('0x2d')],_0x383e9e[_0xec40('0x2e')]);_0x304c99['attributes']=_[_0xec40('0x31')](_0x383e9e[_0xec40('0x2d')],qs[_0xec40('0x33')](_0x5e494d['query']['fields']));_0x304c99[_0xec40('0x32')]=_0x304c99['attributes'][_0xec40('0x34')]?_0x304c99[_0xec40('0x32')]:_0x383e9e['model'];_0x304c99[_0xec40('0x38')]=qs[_0xec40('0x39')](_0x5e494d[_0xec40('0x2e')][_0xec40('0x39')]);_0x304c99[_0xec40('0x3a')]=qs[_0xec40('0x30')](_[_0xec40('0x3b')](_0x5e494d[_0xec40('0x2e')],_0x383e9e[_0xec40('0x30')]));if(_0x5e494d[_0xec40('0x2e')][_0xec40('0x3c')]){_0x304c99['where']=_['merge'](_0x304c99[_0xec40('0x3a')],{'$or':_['map'](_0x304c99[_0xec40('0x32')],function(_0xa508f4){var _0x2c9028={};_0x2c9028[_0xa508f4]={'$like':'%'+_0x5e494d[_0xec40('0x2e')][_0xec40('0x3c')]+'%'};return _0x2c9028;})});}_0x304c99=_[_0xec40('0x3e')]({},_0x304c99,_0x5e494d[_0xec40('0x3f')]);return _0x2c0335[_0xec40('0x4d')](_0x304c99);}})[_0xec40('0x24')](function(_0x1a29b1){if(_0x1a29b1){_0x30993d=_0x1a29b1[_0xec40('0x34')];if(!_0x5e494d['query']['hasOwnProperty'](_0xec40('0x36'))){_0x304c99[_0xec40('0x37')]=qs[_0xec40('0x37')](_0x5e494d[_0xec40('0x2e')][_0xec40('0x37')]);_0x304c99[_0xec40('0x1c')]=qs[_0xec40('0x1c')](_0x5e494d[_0xec40('0x2e')]['offset']);}return _0x2c0335[_0xec40('0x4d')](_0x304c99);}})[_0xec40('0x24')](function(_0x489b6f){if(_0x489b6f){return _0x489b6f?{'count':_0x30993d,'rows':_0x489b6f}:null;}})['then'](respondWithResult(_0x47309f,null))[_0xec40('0x44')](handleError(_0x47309f,null));};exports[_0xec40('0x4e')]=function(_0x130118,_0x1d377c,_0x58a528){var _0x2370a5={};var _0x1bd113={};var _0x271084;var _0x45412d;return db['SugarcrmConfiguration'][_0xec40('0x4a')]({'where':{'id':_0x130118[_0xec40('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1d377c,null))['then'](function(_0x274743){if(_0x274743){_0x271084=_0x274743;_0x1bd113[_0xec40('0x2d')]=_[_0xec40('0x2f')](db[_0xec40('0x4c')][_0xec40('0x2a')]);_0x1bd113[_0xec40('0x2e')]=_['keys'](_0x130118['query']);_0x1bd113['filters']=_['intersection'](_0x1bd113['model'],_0x1bd113[_0xec40('0x2e')]);_0x2370a5[_0xec40('0x32')]=_[_0xec40('0x31')](_0x1bd113[_0xec40('0x2d')],qs[_0xec40('0x33')](_0x130118[_0xec40('0x2e')][_0xec40('0x33')]));_0x2370a5[_0xec40('0x32')]=_0x2370a5['attributes'][_0xec40('0x34')]?_0x2370a5['attributes']:_0x1bd113[_0xec40('0x2d')];_0x2370a5[_0xec40('0x38')]=qs[_0xec40('0x39')](_0x130118[_0xec40('0x2e')][_0xec40('0x39')]);_0x2370a5[_0xec40('0x3a')]=qs[_0xec40('0x30')](_[_0xec40('0x3b')](_0x130118['query'],_0x1bd113['filters']));if(_0x130118[_0xec40('0x2e')]['filter']){_0x2370a5[_0xec40('0x3a')]=_[_0xec40('0x3e')](_0x2370a5[_0xec40('0x3a')],{'$or':_[_0xec40('0x28')](_0x2370a5[_0xec40('0x32')],function(_0x54d039){var _0x3a8c16={};_0x3a8c16[_0x54d039]={'$like':'%'+_0x130118[_0xec40('0x2e')][_0xec40('0x3c')]+'%'};return _0x3a8c16;})});}_0x2370a5=_[_0xec40('0x3e')]({},_0x2370a5,_0x130118['options']);return _0x271084['getDescriptions'](_0x2370a5);}})[_0xec40('0x24')](function(_0x193aec){if(_0x193aec){_0x45412d=_0x193aec[_0xec40('0x34')];if(!_0x130118[_0xec40('0x2e')][_0xec40('0x35')](_0xec40('0x36'))){_0x2370a5[_0xec40('0x37')]=qs[_0xec40('0x37')](_0x130118[_0xec40('0x2e')]['limit']);_0x2370a5[_0xec40('0x1c')]=qs[_0xec40('0x1c')](_0x130118[_0xec40('0x2e')][_0xec40('0x1c')]);}return _0x271084[_0xec40('0x4e')](_0x2370a5);}})[_0xec40('0x24')](function(_0x591a33){if(_0x591a33){return _0x591a33?{'count':_0x45412d,'rows':_0x591a33}:null;}})[_0xec40('0x24')](respondWithResult(_0x1d377c,null))[_0xec40('0x44')](handleError(_0x1d377c,null));}; \ No newline at end of file +var _0x8bf4=['includeAll','findAll','rows','catch','params','length','include','find','create','body','getFields','findOne','SugarcrmField','pick','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','status','end','json','offset','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','map','SugarcrmConfiguration','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filter','merge','options'];(function(_0x1acfcd,_0x2b4bfc){var _0x5bfbca=function(_0x1ba587){while(--_0x1ba587){_0x1acfcd['push'](_0x1acfcd['shift']());}};_0x5bfbca(++_0x2b4bfc);}(_0x8bf4,0x1d8));var _0x48bf=function(_0x4ad095,_0x5f4d18){_0x4ad095=_0x4ad095-0x0;var _0x168ddf=_0x8bf4[_0x4ad095];return _0x168ddf;};'use strict';var emlformat=require(_0x48bf('0x0'));var rimraf=require(_0x48bf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x48bf('0x2'));var rp=require(_0x48bf('0x3'));var moment=require(_0x48bf('0x4'));var BPromise=require(_0x48bf('0x5'));var Mustache=require(_0x48bf('0x6'));var util=require(_0x48bf('0x7'));var path=require(_0x48bf('0x8'));var sox=require('sox');var csv=require(_0x48bf('0x9'));var ejs=require(_0x48bf('0xa'));var fs=require('fs');var fs_extra=require(_0x48bf('0xb'));var _=require(_0x48bf('0xc'));var squel=require(_0x48bf('0xd'));var crypto=require(_0x48bf('0xe'));var jsforce=require(_0x48bf('0xf'));var deskjs=require(_0x48bf('0x10'));var toCsv=require(_0x48bf('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x48bf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x48bf('0x12'));var as=require(_0x48bf('0x13'));var hardwareService=require(_0x48bf('0x14'));var logger=require(_0x48bf('0x15'))('api');var utils=require(_0x48bf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x48bf('0x17'))['db'];function respondWithStatusCode(_0x230a19,_0x3c3b2e){_0x3c3b2e=_0x3c3b2e||0xcc;return function(_0x5eb4a4){if(_0x5eb4a4){return _0x230a19['sendStatus'](_0x3c3b2e);}return _0x230a19[_0x48bf('0x18')](_0x3c3b2e)[_0x48bf('0x19')]();};}function respondWithResult(_0x16d66a,_0x297cd9){_0x297cd9=_0x297cd9||0xc8;return function(_0x41f4f1){if(_0x41f4f1){return _0x16d66a['status'](_0x297cd9)[_0x48bf('0x1a')](_0x41f4f1);}};}function respondWithFilteredResult(_0x562e57,_0x13864d){return function(_0x26008c){if(_0x26008c){var _0x1ddaf3=typeof _0x13864d[_0x48bf('0x1b')]==='undefined'&&typeof _0x13864d[_0x48bf('0x1c')]==='undefined';var _0x45a11=_0x26008c[_0x48bf('0x1d')];var _0x49e810=_0x1ddaf3?0x0:_0x13864d['offset'];var _0x6a040b=_0x1ddaf3?_0x26008c[_0x48bf('0x1d')]:_0x13864d[_0x48bf('0x1b')]+_0x13864d[_0x48bf('0x1c')];var _0x435a54;if(_0x6a040b>=_0x45a11){_0x6a040b=_0x45a11;_0x435a54=0xc8;}else{_0x435a54=0xce;}_0x562e57[_0x48bf('0x18')](_0x435a54);return _0x562e57[_0x48bf('0x1e')](_0x48bf('0x1f'),_0x49e810+'-'+_0x6a040b+'/'+_0x45a11)['json'](_0x26008c);}return null;};}function patchUpdates(_0x39b1a9){return function(_0x172ad9){try{jsonpatch[_0x48bf('0x20')](_0x172ad9,_0x39b1a9,!![]);}catch(_0x4bb803){return BPromise['reject'](_0x4bb803);}return _0x172ad9['save']();};}function saveUpdates(_0x585132,_0x32e083){return function(_0x463622){if(_0x463622){return _0x463622[_0x48bf('0x21')](_0x585132)[_0x48bf('0x22')](function(_0x3059ac){return _0x3059ac;});}return null;};}function removeEntity(_0x41c413,_0x591696){return function(_0x34b466){if(_0x34b466){return _0x34b466[_0x48bf('0x23')]()[_0x48bf('0x22')](function(){_0x41c413[_0x48bf('0x18')](0xcc)[_0x48bf('0x19')]();});}};}function handleEntityNotFound(_0x3bbd98,_0x36206e){return function(_0x16e3a8){if(!_0x16e3a8){_0x3bbd98[_0x48bf('0x24')](0x194);}return _0x16e3a8;};}function handleError(_0x1a7bc7,_0x46425d){_0x46425d=_0x46425d||0x1f4;return function(_0x4dab2c){logger[_0x48bf('0x25')](_0x4dab2c[_0x48bf('0x26')]);if(_0x4dab2c[_0x48bf('0x27')]){delete _0x4dab2c[_0x48bf('0x27')];}_0x1a7bc7[_0x48bf('0x18')](_0x46425d)[_0x48bf('0x28')](_0x4dab2c);};}exports['index']=function(_0x5ecbdf,_0x4bef12){var _0x4913e2={},_0x3975ef={},_0x218485={'count':0x0,'rows':[]};var _0x52a0eb=_[_0x48bf('0x29')](db[_0x48bf('0x2a')][_0x48bf('0x2b')],function(_0xcf46b4){return{'name':_0xcf46b4['fieldName'],'type':_0xcf46b4['type'][_0x48bf('0x2c')]};});_0x3975ef[_0x48bf('0x2d')]=_['map'](_0x52a0eb,_0x48bf('0x27'));_0x3975ef['query']=_[_0x48bf('0x2e')](_0x5ecbdf[_0x48bf('0x2f')]);_0x3975ef[_0x48bf('0x30')]=_['intersection'](_0x3975ef[_0x48bf('0x2d')],_0x3975ef[_0x48bf('0x2f')]);_0x4913e2['attributes']=_[_0x48bf('0x31')](_0x3975ef[_0x48bf('0x2d')],qs[_0x48bf('0x32')](_0x5ecbdf['query']['fields']));_0x4913e2[_0x48bf('0x33')]=_0x4913e2[_0x48bf('0x33')]['length']?_0x4913e2['attributes']:_0x3975ef[_0x48bf('0x2d')];if(!_0x5ecbdf['query'][_0x48bf('0x34')](_0x48bf('0x35'))){_0x4913e2[_0x48bf('0x1c')]=qs[_0x48bf('0x1c')](_0x5ecbdf[_0x48bf('0x2f')][_0x48bf('0x1c')]);_0x4913e2[_0x48bf('0x1b')]=qs[_0x48bf('0x1b')](_0x5ecbdf[_0x48bf('0x2f')][_0x48bf('0x1b')]);}_0x4913e2[_0x48bf('0x36')]=qs['sort'](_0x5ecbdf[_0x48bf('0x2f')][_0x48bf('0x37')]);_0x4913e2[_0x48bf('0x38')]=qs[_0x48bf('0x30')](_['pick'](_0x5ecbdf[_0x48bf('0x2f')],_0x3975ef[_0x48bf('0x30')]),_0x52a0eb);if(_0x5ecbdf[_0x48bf('0x2f')][_0x48bf('0x39')]){_0x4913e2[_0x48bf('0x38')]=_[_0x48bf('0x3a')](_0x4913e2[_0x48bf('0x38')],{'$or':_['map'](_0x52a0eb,function(_0x23aeac){if(_0x23aeac['type']!=='VIRTUAL'){var _0x1971e3={};_0x1971e3[_0x23aeac[_0x48bf('0x27')]]={'$like':'%'+_0x5ecbdf[_0x48bf('0x2f')][_0x48bf('0x39')]+'%'};return _0x1971e3;}})});}_0x4913e2=_[_0x48bf('0x3a')]({},_0x4913e2,_0x5ecbdf[_0x48bf('0x3b')]);var _0x4cef50={'where':_0x4913e2[_0x48bf('0x38')]};return db['SugarcrmConfiguration']['count'](_0x4cef50)[_0x48bf('0x22')](function(_0x4005c0){_0x218485[_0x48bf('0x1d')]=_0x4005c0;if(_0x5ecbdf[_0x48bf('0x2f')][_0x48bf('0x3c')]){_0x4913e2['include']=[{'all':!![]}];}return db[_0x48bf('0x2a')][_0x48bf('0x3d')](_0x4913e2);})[_0x48bf('0x22')](function(_0x20c464){_0x218485[_0x48bf('0x3e')]=_0x20c464;return _0x218485;})['then'](respondWithFilteredResult(_0x4bef12,_0x4913e2))[_0x48bf('0x3f')](handleError(_0x4bef12,null));};exports['show']=function(_0x2d7eb1,_0xa44cb0){var _0x20531c={'raw':![],'where':{'id':_0x2d7eb1[_0x48bf('0x40')]['id']}},_0x44e1d3={};_0x44e1d3['model']=_['keys'](db[_0x48bf('0x2a')][_0x48bf('0x2b')]);_0x44e1d3['query']=_[_0x48bf('0x2e')](_0x2d7eb1[_0x48bf('0x2f')]);_0x44e1d3[_0x48bf('0x30')]=_['intersection'](_0x44e1d3['model'],_0x44e1d3['query']);_0x20531c[_0x48bf('0x33')]=_[_0x48bf('0x31')](_0x44e1d3[_0x48bf('0x2d')],qs[_0x48bf('0x32')](_0x2d7eb1['query']['fields']));_0x20531c[_0x48bf('0x33')]=_0x20531c[_0x48bf('0x33')][_0x48bf('0x41')]?_0x20531c['attributes']:_0x44e1d3[_0x48bf('0x2d')];if(_0x2d7eb1['query'][_0x48bf('0x3c')]){_0x20531c[_0x48bf('0x42')]=[{'all':!![]}];}_0x20531c=_['merge']({},_0x20531c,_0x2d7eb1[_0x48bf('0x3b')]);return db['SugarcrmConfiguration'][_0x48bf('0x43')](_0x20531c)['then'](handleEntityNotFound(_0xa44cb0,null))[_0x48bf('0x22')](respondWithResult(_0xa44cb0,null))[_0x48bf('0x3f')](handleError(_0xa44cb0,null));};exports[_0x48bf('0x44')]=function(_0x2c3ed1,_0x160f79){return db[_0x48bf('0x2a')]['create'](_0x2c3ed1[_0x48bf('0x45')],{})[_0x48bf('0x22')](respondWithResult(_0x160f79,0xc9))['catch'](handleError(_0x160f79,null));};exports[_0x48bf('0x21')]=function(_0x510b41,_0x48b3e0){if(_0x510b41['body']['id']){delete _0x510b41[_0x48bf('0x45')]['id'];}return db[_0x48bf('0x2a')][_0x48bf('0x43')]({'where':{'id':_0x510b41[_0x48bf('0x40')]['id']}})['then'](handleEntityNotFound(_0x48b3e0,null))['then'](saveUpdates(_0x510b41[_0x48bf('0x45')],null))[_0x48bf('0x22')](respondWithResult(_0x48b3e0,null))[_0x48bf('0x3f')](handleError(_0x48b3e0,null));};exports['destroy']=function(_0x6926ef,_0x4d98ec){return db['SugarcrmConfiguration']['find']({'where':{'id':_0x6926ef['params']['id']}})[_0x48bf('0x22')](handleEntityNotFound(_0x4d98ec,null))[_0x48bf('0x22')](removeEntity(_0x4d98ec,null))[_0x48bf('0x3f')](handleError(_0x4d98ec,null));};exports[_0x48bf('0x46')]=function(_0x7d16ea,_0x17cb3c,_0x1bc6c8){var _0x584959={};var _0x2a41e3={};var _0x3cac7a;var _0x2f6b70;return db[_0x48bf('0x2a')][_0x48bf('0x47')]({'where':{'id':_0x7d16ea[_0x48bf('0x40')]['id']}})[_0x48bf('0x22')](handleEntityNotFound(_0x17cb3c,null))[_0x48bf('0x22')](function(_0x12e737){if(_0x12e737){_0x3cac7a=_0x12e737;_0x2a41e3['model']=_[_0x48bf('0x2e')](db[_0x48bf('0x48')][_0x48bf('0x2b')]);_0x2a41e3[_0x48bf('0x2f')]=_[_0x48bf('0x2e')](_0x7d16ea[_0x48bf('0x2f')]);_0x2a41e3[_0x48bf('0x30')]=_[_0x48bf('0x31')](_0x2a41e3['model'],_0x2a41e3['query']);_0x584959[_0x48bf('0x33')]=_[_0x48bf('0x31')](_0x2a41e3[_0x48bf('0x2d')],qs[_0x48bf('0x32')](_0x7d16ea[_0x48bf('0x2f')]['fields']));_0x584959[_0x48bf('0x33')]=_0x584959[_0x48bf('0x33')][_0x48bf('0x41')]?_0x584959[_0x48bf('0x33')]:_0x2a41e3[_0x48bf('0x2d')];_0x584959[_0x48bf('0x36')]=qs['sort'](_0x7d16ea[_0x48bf('0x2f')][_0x48bf('0x37')]);_0x584959[_0x48bf('0x38')]=qs[_0x48bf('0x30')](_[_0x48bf('0x49')](_0x7d16ea[_0x48bf('0x2f')],_0x2a41e3[_0x48bf('0x30')]));if(_0x7d16ea[_0x48bf('0x2f')][_0x48bf('0x39')]){_0x584959[_0x48bf('0x38')]=_[_0x48bf('0x3a')](_0x584959[_0x48bf('0x38')],{'$or':_['map'](_0x584959[_0x48bf('0x33')],function(_0x5a6948){var _0x4cc6aa={};_0x4cc6aa[_0x5a6948]={'$like':'%'+_0x7d16ea[_0x48bf('0x2f')][_0x48bf('0x39')]+'%'};return _0x4cc6aa;})});}_0x584959=_[_0x48bf('0x3a')]({},_0x584959,_0x7d16ea['options']);return _0x3cac7a[_0x48bf('0x46')](_0x584959);}})['then'](function(_0x21ecb3){if(_0x21ecb3){_0x2f6b70=_0x21ecb3[_0x48bf('0x41')];if(!_0x7d16ea[_0x48bf('0x2f')][_0x48bf('0x34')](_0x48bf('0x35'))){_0x584959[_0x48bf('0x1c')]=qs['limit'](_0x7d16ea[_0x48bf('0x2f')][_0x48bf('0x1c')]);_0x584959['offset']=qs[_0x48bf('0x1b')](_0x7d16ea[_0x48bf('0x2f')][_0x48bf('0x1b')]);}return _0x3cac7a[_0x48bf('0x46')](_0x584959);}})[_0x48bf('0x22')](function(_0x238b29){if(_0x238b29){return _0x238b29?{'count':_0x2f6b70,'rows':_0x238b29}:null;}})[_0x48bf('0x22')](respondWithResult(_0x17cb3c,null))[_0x48bf('0x3f')](handleError(_0x17cb3c,null));};exports['getSubjects']=function(_0xa44f13,_0x3f976b,_0x424701){var _0x48aae3={};var _0x32151d={};var _0x400e52;var _0x2f4ab6;return db[_0x48bf('0x2a')][_0x48bf('0x47')]({'where':{'id':_0xa44f13[_0x48bf('0x40')]['id']}})[_0x48bf('0x22')](handleEntityNotFound(_0x3f976b,null))[_0x48bf('0x22')](function(_0x43f7ea){if(_0x43f7ea){_0x400e52=_0x43f7ea;_0x32151d[_0x48bf('0x2d')]=_[_0x48bf('0x2e')](db[_0x48bf('0x48')]['rawAttributes']);_0x32151d[_0x48bf('0x2f')]=_[_0x48bf('0x2e')](_0xa44f13[_0x48bf('0x2f')]);_0x32151d[_0x48bf('0x30')]=_['intersection'](_0x32151d['model'],_0x32151d[_0x48bf('0x2f')]);_0x48aae3[_0x48bf('0x33')]=_[_0x48bf('0x31')](_0x32151d[_0x48bf('0x2d')],qs[_0x48bf('0x32')](_0xa44f13[_0x48bf('0x2f')][_0x48bf('0x32')]));_0x48aae3[_0x48bf('0x33')]=_0x48aae3['attributes'][_0x48bf('0x41')]?_0x48aae3['attributes']:_0x32151d[_0x48bf('0x2d')];_0x48aae3[_0x48bf('0x36')]=qs[_0x48bf('0x37')](_0xa44f13['query'][_0x48bf('0x37')]);_0x48aae3[_0x48bf('0x38')]=qs['filters'](_[_0x48bf('0x49')](_0xa44f13['query'],_0x32151d[_0x48bf('0x30')]));if(_0xa44f13[_0x48bf('0x2f')][_0x48bf('0x39')]){_0x48aae3[_0x48bf('0x38')]=_[_0x48bf('0x3a')](_0x48aae3[_0x48bf('0x38')],{'$or':_[_0x48bf('0x29')](_0x48aae3[_0x48bf('0x33')],function(_0x4f2f6a){var _0x5d52b0={};_0x5d52b0[_0x4f2f6a]={'$like':'%'+_0xa44f13[_0x48bf('0x2f')][_0x48bf('0x39')]+'%'};return _0x5d52b0;})});}_0x48aae3=_['merge']({},_0x48aae3,_0xa44f13[_0x48bf('0x3b')]);return _0x400e52[_0x48bf('0x4a')](_0x48aae3);}})[_0x48bf('0x22')](function(_0x4b962a){if(_0x4b962a){_0x2f4ab6=_0x4b962a[_0x48bf('0x41')];if(!_0xa44f13[_0x48bf('0x2f')]['hasOwnProperty'](_0x48bf('0x35'))){_0x48aae3[_0x48bf('0x1c')]=qs['limit'](_0xa44f13['query'][_0x48bf('0x1c')]);_0x48aae3[_0x48bf('0x1b')]=qs[_0x48bf('0x1b')](_0xa44f13[_0x48bf('0x2f')][_0x48bf('0x1b')]);}return _0x400e52['getSubjects'](_0x48aae3);}})[_0x48bf('0x22')](function(_0x1b4ad5){if(_0x1b4ad5){return _0x1b4ad5?{'count':_0x2f4ab6,'rows':_0x1b4ad5}:null;}})[_0x48bf('0x22')](respondWithResult(_0x3f976b,null))['catch'](handleError(_0x3f976b,null));};exports[_0x48bf('0x4b')]=function(_0x84025b,_0x29c17f,_0x4c7f08){var _0x184608={};var _0x246549={};var _0x369de1;var _0x1afa52;return db['SugarcrmConfiguration'][_0x48bf('0x47')]({'where':{'id':_0x84025b[_0x48bf('0x40')]['id']}})[_0x48bf('0x22')](handleEntityNotFound(_0x29c17f,null))['then'](function(_0x4ecf7a){if(_0x4ecf7a){_0x369de1=_0x4ecf7a;_0x246549['model']=_[_0x48bf('0x2e')](db['SugarcrmField'][_0x48bf('0x2b')]);_0x246549[_0x48bf('0x2f')]=_[_0x48bf('0x2e')](_0x84025b[_0x48bf('0x2f')]);_0x246549[_0x48bf('0x30')]=_[_0x48bf('0x31')](_0x246549['model'],_0x246549[_0x48bf('0x2f')]);_0x184608[_0x48bf('0x33')]=_['intersection'](_0x246549['model'],qs[_0x48bf('0x32')](_0x84025b[_0x48bf('0x2f')][_0x48bf('0x32')]));_0x184608['attributes']=_0x184608[_0x48bf('0x33')][_0x48bf('0x41')]?_0x184608[_0x48bf('0x33')]:_0x246549[_0x48bf('0x2d')];_0x184608[_0x48bf('0x36')]=qs['sort'](_0x84025b['query']['sort']);_0x184608[_0x48bf('0x38')]=qs[_0x48bf('0x30')](_[_0x48bf('0x49')](_0x84025b[_0x48bf('0x2f')],_0x246549[_0x48bf('0x30')]));if(_0x84025b[_0x48bf('0x2f')][_0x48bf('0x39')]){_0x184608[_0x48bf('0x38')]=_['merge'](_0x184608[_0x48bf('0x38')],{'$or':_[_0x48bf('0x29')](_0x184608['attributes'],function(_0x14136e){var _0x311a1e={};_0x311a1e[_0x14136e]={'$like':'%'+_0x84025b['query'][_0x48bf('0x39')]+'%'};return _0x311a1e;})});}_0x184608=_['merge']({},_0x184608,_0x84025b[_0x48bf('0x3b')]);return _0x369de1[_0x48bf('0x4b')](_0x184608);}})['then'](function(_0x27295f){if(_0x27295f){_0x1afa52=_0x27295f[_0x48bf('0x41')];if(!_0x84025b[_0x48bf('0x2f')]['hasOwnProperty']('nolimit')){_0x184608['limit']=qs['limit'](_0x84025b[_0x48bf('0x2f')][_0x48bf('0x1c')]);_0x184608[_0x48bf('0x1b')]=qs['offset'](_0x84025b[_0x48bf('0x2f')][_0x48bf('0x1b')]);}return _0x369de1[_0x48bf('0x4b')](_0x184608);}})[_0x48bf('0x22')](function(_0x93660d){if(_0x93660d){return _0x93660d?{'count':_0x1afa52,'rows':_0x93660d}:null;}})['then'](respondWithResult(_0x29c17f,null))[_0x48bf('0x3f')](handleError(_0x29c17f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index cc6fde4..ca0ba5b 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 _0x5954=['../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x53e1ae,_0x2e4b5b){var _0x3d4827=function(_0xc9a82a){while(--_0xc9a82a){_0x53e1ae['push'](_0x53e1ae['shift']());}};_0x3d4827(++_0x2e4b5b);}(_0x5954,0x16e));var _0x4595=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x5954[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x4595('0x0'));var util=require(_0x4595('0x1'));var logger=require(_0x4595('0x2'))(_0x4595('0x3'));var moment=require(_0x4595('0x4'));var BPromise=require(_0x4595('0x5'));var rp=require(_0x4595('0x6'));var fs=require('fs');var path=require(_0x4595('0x7'));var rimraf=require(_0x4595('0x8'));var config=require(_0x4595('0x9'));var attributes=require(_0x4595('0xa'));module[_0x4595('0xb')]=function(_0xa2e720,_0x1ce84c){return _0xa2e720[_0x4595('0xc')](_0x4595('0xd'),attributes,{'tableName':_0x4595('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bb2=['moment','bluebird','path','rimraf','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','../../config/logger','api'];(function(_0x361704,_0x3af61c){var _0x258953=function(_0x53ca46){while(--_0x53ca46){_0x361704['push'](_0x361704['shift']());}};_0x258953(++_0x3af61c);}(_0x4bb2,0x105));var _0x24bb=function(_0x5eee48,_0xd7d559){_0x5eee48=_0x5eee48-0x0;var _0x2ff2f7=_0x4bb2[_0x5eee48];return _0x2ff2f7;};'use strict';var _=require(_0x24bb('0x0'));var util=require('util');var logger=require(_0x24bb('0x1'))(_0x24bb('0x2'));var moment=require(_0x24bb('0x3'));var BPromise=require(_0x24bb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x24bb('0x5'));var rimraf=require(_0x24bb('0x6'));var config=require('../../config/environment');var attributes=require(_0x24bb('0x7'));module[_0x24bb('0x8')]=function(_0xdd07c9,_0x215fa0){return _0xdd07c9[_0x24bb('0x9')](_0x24bb('0xa'),attributes,{'tableName':_0x24bb('0xb'),'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 37533a3..d900aff 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 _0x7811=['error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x5cc8,_0x1faa02){var _0x450661=function(_0x237b05){while(--_0x237b05){_0x5cc8['push'](_0x5cc8['shift']());}};_0x450661(++_0x1faa02);}(_0x7811,0xea));var _0x1781=function(_0x3c86dc,_0x5d22fc){_0x3c86dc=_0x3c86dc-0x0;var _0x4aeb79=_0x7811[_0x3c86dc];return _0x4aeb79;};'use strict';var _=require(_0x1781('0x0'));var util=require(_0x1781('0x1'));var moment=require(_0x1781('0x2'));var BPromise=require(_0x1781('0x3'));var rs=require(_0x1781('0x4'));var fs=require('fs');var Redis=require(_0x1781('0x5'));var db=require(_0x1781('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1781('0x7'))(_0x1781('0x8'));var config=require(_0x1781('0x9'));var jayson=require(_0x1781('0xa'));var client=jayson['client'][_0x1781('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3aadf0,_0x185758,_0x1d3dc8){return new BPromise(function(_0x43b4ff,_0x46f5a2){return client[_0x1781('0xc')](_0x3aadf0,_0x1d3dc8)[_0x1781('0xd')](function(_0x52fd69){logger[_0x1781('0xe')](_0x1781('0xf'),_0x185758,_0x1781('0x10'));logger['debug']('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x185758,'request\x20sent',JSON[_0x1781('0x11')](_0x52fd69));if(_0x52fd69[_0x1781('0x12')]){if(_0x52fd69[_0x1781('0x12')]['code']===0x1f4){logger['error'](_0x1781('0xf'),_0x185758,_0x52fd69[_0x1781('0x12')][_0x1781('0x13')]);return _0x46f5a2(_0x52fd69[_0x1781('0x12')][_0x1781('0x13')]);}logger[_0x1781('0x12')](_0x1781('0xf'),_0x185758,_0x52fd69['error'][_0x1781('0x13')]);return _0x43b4ff(_0x52fd69['error'][_0x1781('0x13')]);}else{logger[_0x1781('0xe')](_0x1781('0xf'),_0x185758,'request\x20sent');_0x43b4ff(_0x52fd69['result'][_0x1781('0x13')]);}})[_0x1781('0x14')](function(_0x2286c7){logger[_0x1781('0x12')](_0x1781('0xf'),_0x185758,_0x2286c7);_0x46f5a2(_0x2286c7);});});} \ No newline at end of file +var _0xacc4=['client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','code','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4a874e,_0x166d48){var _0x4cb77c=function(_0x3d692e){while(--_0x3d692e){_0x4a874e['push'](_0x4a874e['shift']());}};_0x4cb77c(++_0x166d48);}(_0xacc4,0x13f));var _0x4acc=function(_0xd4636c,_0x34dbf6){_0xd4636c=_0xd4636c-0x0;var _0x5ee17d=_0xacc4[_0xd4636c];return _0x5ee17d;};'use strict';var _=require(_0x4acc('0x0'));var util=require(_0x4acc('0x1'));var moment=require(_0x4acc('0x2'));var BPromise=require(_0x4acc('0x3'));var rs=require(_0x4acc('0x4'));var fs=require('fs');var Redis=require(_0x4acc('0x5'));var db=require(_0x4acc('0x6'))['db'];var utils=require(_0x4acc('0x7'));var logger=require(_0x4acc('0x8'))('rpc');var config=require(_0x4acc('0x9'));var jayson=require(_0x4acc('0xa'));var client=jayson[_0x4acc('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1a0b10,_0x2ce389,_0x227756){return new BPromise(function(_0x1e8487,_0x1cac5a){return client[_0x4acc('0xc')](_0x1a0b10,_0x227756)[_0x4acc('0xd')](function(_0x4a4847){logger[_0x4acc('0xe')](_0x4acc('0xf'),_0x2ce389,_0x4acc('0x10'));logger['debug'](_0x4acc('0x11'),_0x2ce389,'request\x20sent',JSON['stringify'](_0x4a4847));if(_0x4a4847['error']){if(_0x4a4847['error'][_0x4acc('0x12')]===0x1f4){logger['error'](_0x4acc('0xf'),_0x2ce389,_0x4a4847[_0x4acc('0x13')][_0x4acc('0x14')]);return _0x1cac5a(_0x4a4847[_0x4acc('0x13')][_0x4acc('0x14')]);}logger[_0x4acc('0x13')](_0x4acc('0xf'),_0x2ce389,_0x4a4847[_0x4acc('0x13')][_0x4acc('0x14')]);return _0x1e8487(_0x4a4847[_0x4acc('0x13')][_0x4acc('0x14')]);}else{logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x2ce389,'request\x20sent');_0x1e8487(_0x4a4847[_0x4acc('0x15')][_0x4acc('0x14')]);}})['catch'](function(_0x261536){logger['error'](_0x4acc('0xf'),_0x2ce389,_0x261536);_0x1cac5a(_0x261536);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 2019184..ebc68f8 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 _0x3cbe=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSugarcrmField.controller','isAuthenticated','index','get','/:id','show','post','create','put','delete','destroy','exports','util'];(function(_0x108d48,_0x5c174b){var _0x241f2c=function(_0x20f8af){while(--_0x20f8af){_0x108d48['push'](_0x108d48['shift']());}};_0x241f2c(++_0x5c174b);}(_0x3cbe,0xfb));var _0xe3cb=function(_0x23a8ba,_0xab5848){_0x23a8ba=_0x23a8ba-0x0;var _0x468389=_0x3cbe[_0x23a8ba];return _0x468389;};'use strict';var multer=require('multer');var util=require(_0xe3cb('0x0'));var path=require('path');var timeout=require(_0xe3cb('0x1'));var express=require(_0xe3cb('0x2'));var router=express[_0xe3cb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe3cb('0x4'));var interaction=require(_0xe3cb('0x5'));var config=require('../../config/environment');var controller=require(_0xe3cb('0x6'));router['get']('/',auth[_0xe3cb('0x7')](),controller[_0xe3cb('0x8')]);router[_0xe3cb('0x9')](_0xe3cb('0xa'),auth['isAuthenticated'](),controller[_0xe3cb('0xb')]);router[_0xe3cb('0xc')]('/',auth[_0xe3cb('0x7')](),controller[_0xe3cb('0xd')]);router[_0xe3cb('0xe')](_0xe3cb('0xa'),auth[_0xe3cb('0x7')](),controller['update']);router[_0xe3cb('0xf')]('/:id',auth[_0xe3cb('0x7')](),controller[_0xe3cb('0x10')]);module[_0xe3cb('0x11')]=router; \ No newline at end of file +var _0xf14c=['path','Router','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','get','/:id','show','post','create','put','update','delete','destroy','multer','util'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xf14c,0x141));var _0xcf14=function(_0x43dae8,_0xac1de7){_0x43dae8=_0x43dae8-0x0;var _0x4e7ffe=_0xf14c[_0x43dae8];return _0x4e7ffe;};'use strict';var multer=require(_0xcf14('0x0'));var util=require(_0xcf14('0x1'));var path=require(_0xcf14('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xcf14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xcf14('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xcf14('0x5'));var controller=require(_0xcf14('0x6'));router['get']('/',auth[_0xcf14('0x7')](),controller['index']);router[_0xcf14('0x8')](_0xcf14('0x9'),auth['isAuthenticated'](),controller[_0xcf14('0xa')]);router[_0xcf14('0xb')]('/',auth[_0xcf14('0x7')](),controller[_0xcf14('0xc')]);router[_0xcf14('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xcf14('0xe')]);router[_0xcf14('0xf')](_0xcf14('0x9'),auth[_0xcf14('0x7')](),controller[_0xcf14('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 545e868..a655683 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 _0x53dd=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x407ae2,_0x3f15a6){var _0x397ab3=function(_0x53643d){while(--_0x53643d){_0x407ae2['push'](_0x407ae2['shift']());}};_0x397ab3(++_0x3f15a6);}(_0x53dd,0x81));var _0xd53d=function(_0x45c3a3,_0x310ada){_0x45c3a3=_0x45c3a3-0x0;var _0x62c7a5=_0x53dd[_0x45c3a3];return _0x62c7a5;};'use strict';var Sequelize=require(_0xd53d('0x0'));module[_0xd53d('0x1')]={'type':{'type':Sequelize[_0xd53d('0x2')](_0xd53d('0x3'),_0xd53d('0x4'),_0xd53d('0x5'),_0xd53d('0x6'),_0xd53d('0x7')),'defaultValue':_0xd53d('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xd53d('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0xd53d('0x3'),'variable',_0xd53d('0x5'))},'keyContent':{'type':Sequelize[_0xd53d('0x8')]},'idField':{'type':Sequelize[_0xd53d('0x8')]},'nameField':{'type':Sequelize[_0xd53d('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd53d('0x8')]}}; \ No newline at end of file +var _0x0543=['keyValue','picklist','STRING','customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable'];(function(_0x44606e,_0x2bf244){var _0xe68388=function(_0x488a30){while(--_0x488a30){_0x44606e['push'](_0x44606e['shift']());}};_0xe68388(++_0x2bf244);}(_0x0543,0x14f));var _0x3054=function(_0x12786e,_0x3347b5){_0x12786e=_0x12786e-0x0;var _0x15bf46=_0x0543[_0x12786e];return _0x15bf46;};'use strict';var Sequelize=require(_0x3054('0x0'));module[_0x3054('0x1')]={'type':{'type':Sequelize[_0x3054('0x2')](_0x3054('0x3'),_0x3054('0x4'),'customVariable',_0x3054('0x5'),_0x3054('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3054('0x7')]},'key':{'type':Sequelize[_0x3054('0x7')]},'keyType':{'type':Sequelize[_0x3054('0x2')](_0x3054('0x3'),'variable',_0x3054('0x8'))},'keyContent':{'type':Sequelize[_0x3054('0x7')]},'idField':{'type':Sequelize[_0x3054('0x7')]},'nameField':{'type':Sequelize[_0x3054('0x7')]},'customField':{'type':Sequelize[_0x3054('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3054('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index 158abe6..6a6b498 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 _0xed7b=['includeAll','options','find','create','body','catch','update','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','json','apply','reject','then','destroy','error','name','send','map','SugarcrmField','rawAttributes','type','key','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','rows','show','params','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed7b,0x11f));var _0xbed7=function(_0xf91cf6,_0x53a695){_0xf91cf6=_0xf91cf6-0x0;var _0x47ae5b=_0xed7b[_0xf91cf6];return _0x47ae5b;};'use strict';var emlformat=require(_0xbed7('0x0'));var rimraf=require(_0xbed7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbed7('0x2'));var rp=require(_0xbed7('0x3'));var moment=require(_0xbed7('0x4'));var BPromise=require(_0xbed7('0x5'));var Mustache=require(_0xbed7('0x6'));var util=require(_0xbed7('0x7'));var path=require('path');var sox=require(_0xbed7('0x8'));var csv=require(_0xbed7('0x9'));var ejs=require(_0xbed7('0xa'));var fs=require('fs');var fs_extra=require(_0xbed7('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xbed7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xbed7('0x9'));var querystring=require(_0xbed7('0xd'));var Papa=require(_0xbed7('0xe'));var Redis=require('ioredis');var authService=require(_0xbed7('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xbed7('0x10'));var hardwareService=require(_0xbed7('0x11'));var logger=require(_0xbed7('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xbed7('0x13'));var licenseUtil=require(_0xbed7('0x14'));var db=require(_0xbed7('0x15'))['db'];function respondWithStatusCode(_0x3935ee,_0x249596){_0x249596=_0x249596||0xcc;return function(_0xd746d5){if(_0xd746d5){return _0x3935ee[_0xbed7('0x16')](_0x249596);}return _0x3935ee[_0xbed7('0x17')](_0x249596)[_0xbed7('0x18')]();};}function respondWithResult(_0x5e0d5f,_0x222a93){_0x222a93=_0x222a93||0xc8;return function(_0x1e4d42){if(_0x1e4d42){return _0x5e0d5f[_0xbed7('0x17')](_0x222a93)['json'](_0x1e4d42);}};}function respondWithFilteredResult(_0x547e09,_0x159cbc){return function(_0x3d441c){if(_0x3d441c){var _0x1e6fa8=typeof _0x159cbc['offset']==='undefined'&&typeof _0x159cbc['limit']===_0xbed7('0x19');var _0x17077d=_0x3d441c['count'];var _0x23de00=_0x1e6fa8?0x0:_0x159cbc[_0xbed7('0x1a')];var _0x4cc333=_0x1e6fa8?_0x3d441c[_0xbed7('0x1b')]:_0x159cbc['offset']+_0x159cbc[_0xbed7('0x1c')];var _0x4bdfac;if(_0x4cc333>=_0x17077d){_0x4cc333=_0x17077d;_0x4bdfac=0xc8;}else{_0x4bdfac=0xce;}_0x547e09[_0xbed7('0x17')](_0x4bdfac);return _0x547e09[_0xbed7('0x1d')](_0xbed7('0x1e'),_0x23de00+'-'+_0x4cc333+'/'+_0x17077d)[_0xbed7('0x1f')](_0x3d441c);}return null;};}function patchUpdates(_0xefa115){return function(_0x4d17d7){try{jsonpatch[_0xbed7('0x20')](_0x4d17d7,_0xefa115,!![]);}catch(_0x35f1b3){return BPromise[_0xbed7('0x21')](_0x35f1b3);}return _0x4d17d7['save']();};}function saveUpdates(_0x3634e6,_0x3510d9){return function(_0x1ece83){if(_0x1ece83){return _0x1ece83['update'](_0x3634e6)[_0xbed7('0x22')](function(_0x40288e){return _0x40288e;});}return null;};}function removeEntity(_0x471218,_0x59326c){return function(_0x33dc3e){if(_0x33dc3e){return _0x33dc3e[_0xbed7('0x23')]()['then'](function(){_0x471218[_0xbed7('0x17')](0xcc)[_0xbed7('0x18')]();});}};}function handleEntityNotFound(_0x4b1ad5,_0x19c289){return function(_0x31a3d8){if(!_0x31a3d8){_0x4b1ad5[_0xbed7('0x16')](0x194);}return _0x31a3d8;};}function handleError(_0x1dfba9,_0x5bd75b){_0x5bd75b=_0x5bd75b||0x1f4;return function(_0x50383a){logger[_0xbed7('0x24')](_0x50383a['stack']);if(_0x50383a[_0xbed7('0x25')]){delete _0x50383a[_0xbed7('0x25')];}_0x1dfba9[_0xbed7('0x17')](_0x5bd75b)[_0xbed7('0x26')](_0x50383a);};}exports['index']=function(_0xb55008,_0xedbe0a){var _0x5c8a69={},_0x4814d7={},_0x27a916={'count':0x0,'rows':[]};var _0x3923b5=_[_0xbed7('0x27')](db[_0xbed7('0x28')][_0xbed7('0x29')],function(_0x5eda3c){return{'name':_0x5eda3c['fieldName'],'type':_0x5eda3c[_0xbed7('0x2a')][_0xbed7('0x2b')]};});_0x4814d7['model']=_[_0xbed7('0x27')](_0x3923b5,_0xbed7('0x25'));_0x4814d7[_0xbed7('0x2c')]=_['keys'](_0xb55008['query']);_0x4814d7[_0xbed7('0x2d')]=_[_0xbed7('0x2e')](_0x4814d7[_0xbed7('0x2f')],_0x4814d7[_0xbed7('0x2c')]);_0x5c8a69['attributes']=_[_0xbed7('0x2e')](_0x4814d7[_0xbed7('0x2f')],qs[_0xbed7('0x30')](_0xb55008[_0xbed7('0x2c')][_0xbed7('0x30')]));_0x5c8a69['attributes']=_0x5c8a69[_0xbed7('0x31')][_0xbed7('0x32')]?_0x5c8a69[_0xbed7('0x31')]:_0x4814d7[_0xbed7('0x2f')];if(!_0xb55008[_0xbed7('0x2c')]['hasOwnProperty'](_0xbed7('0x33'))){_0x5c8a69[_0xbed7('0x1c')]=qs['limit'](_0xb55008[_0xbed7('0x2c')]['limit']);_0x5c8a69['offset']=qs[_0xbed7('0x1a')](_0xb55008[_0xbed7('0x2c')][_0xbed7('0x1a')]);}_0x5c8a69[_0xbed7('0x34')]=qs[_0xbed7('0x35')](_0xb55008[_0xbed7('0x2c')][_0xbed7('0x35')]);_0x5c8a69[_0xbed7('0x36')]=qs[_0xbed7('0x2d')](_[_0xbed7('0x37')](_0xb55008[_0xbed7('0x2c')],_0x4814d7[_0xbed7('0x2d')]),_0x3923b5);if(_0xb55008[_0xbed7('0x2c')]['filter']){_0x5c8a69[_0xbed7('0x36')]=_[_0xbed7('0x38')](_0x5c8a69[_0xbed7('0x36')],{'$or':_[_0xbed7('0x27')](_0x3923b5,function(_0x2139c5){if(_0x2139c5[_0xbed7('0x2a')]!==_0xbed7('0x39')){var _0x15df59={};_0x15df59[_0x2139c5['name']]={'$like':'%'+_0xb55008[_0xbed7('0x2c')][_0xbed7('0x3a')]+'%'};return _0x15df59;}})});}_0x5c8a69=_[_0xbed7('0x38')]({},_0x5c8a69,_0xb55008['options']);var _0x88bd8a={'where':_0x5c8a69[_0xbed7('0x36')]};return db[_0xbed7('0x28')][_0xbed7('0x1b')](_0x88bd8a)[_0xbed7('0x22')](function(_0x2872eb){_0x27a916[_0xbed7('0x1b')]=_0x2872eb;if(_0xb55008[_0xbed7('0x2c')]['includeAll']){_0x5c8a69['include']=[{'all':!![]}];}return db[_0xbed7('0x28')]['findAll'](_0x5c8a69);})['then'](function(_0x5d78dd){_0x27a916[_0xbed7('0x3b')]=_0x5d78dd;return _0x27a916;})[_0xbed7('0x22')](respondWithFilteredResult(_0xedbe0a,_0x5c8a69))['catch'](handleError(_0xedbe0a,null));};exports[_0xbed7('0x3c')]=function(_0x2793b3,_0x254c73){var _0x1bc59c={'raw':!![],'where':{'id':_0x2793b3[_0xbed7('0x3d')]['id']}},_0x186001={};_0x186001['model']=_[_0xbed7('0x3e')](db[_0xbed7('0x28')][_0xbed7('0x29')]);_0x186001[_0xbed7('0x2c')]=_[_0xbed7('0x3e')](_0x2793b3['query']);_0x186001[_0xbed7('0x2d')]=_[_0xbed7('0x2e')](_0x186001[_0xbed7('0x2f')],_0x186001[_0xbed7('0x2c')]);_0x1bc59c[_0xbed7('0x31')]=_[_0xbed7('0x2e')](_0x186001['model'],qs[_0xbed7('0x30')](_0x2793b3[_0xbed7('0x2c')][_0xbed7('0x30')]));_0x1bc59c[_0xbed7('0x31')]=_0x1bc59c['attributes'][_0xbed7('0x32')]?_0x1bc59c[_0xbed7('0x31')]:_0x186001[_0xbed7('0x2f')];if(_0x2793b3[_0xbed7('0x2c')][_0xbed7('0x3f')]){_0x1bc59c['include']=[{'all':!![]}];}_0x1bc59c=_[_0xbed7('0x38')]({},_0x1bc59c,_0x2793b3[_0xbed7('0x40')]);return db[_0xbed7('0x28')][_0xbed7('0x41')](_0x1bc59c)[_0xbed7('0x22')](handleEntityNotFound(_0x254c73,null))[_0xbed7('0x22')](respondWithResult(_0x254c73,null))['catch'](handleError(_0x254c73,null));};exports[_0xbed7('0x42')]=function(_0x57ae13,_0x462ded){return db[_0xbed7('0x28')]['create'](_0x57ae13[_0xbed7('0x43')],{})['then'](respondWithResult(_0x462ded,0xc9))[_0xbed7('0x44')](handleError(_0x462ded,null));};exports[_0xbed7('0x45')]=function(_0x719855,_0x4bb627){if(_0x719855['body']['id']){delete _0x719855[_0xbed7('0x43')]['id'];}return db[_0xbed7('0x28')][_0xbed7('0x41')]({'where':{'id':_0x719855[_0xbed7('0x3d')]['id']}})[_0xbed7('0x22')](handleEntityNotFound(_0x4bb627,null))[_0xbed7('0x22')](saveUpdates(_0x719855[_0xbed7('0x43')],null))['then'](respondWithResult(_0x4bb627,null))[_0xbed7('0x44')](handleError(_0x4bb627,null));};exports['destroy']=function(_0x19e424,_0x507af0){return db[_0xbed7('0x28')][_0xbed7('0x41')]({'where':{'id':_0x19e424[_0xbed7('0x3d')]['id']}})['then'](handleEntityNotFound(_0x507af0,null))['then'](removeEntity(_0x507af0,null))['catch'](handleError(_0x507af0,null));}; \ No newline at end of file +var _0xf8e6=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','sendStatus','error','stack','index','map','SugarcrmField','fieldName','type','key','model','name','query','keys','filters','attributes','fields','length','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','findAll','rows','show','rawAttributes','intersection','includeAll','include','options','create','catch','body','params','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4063a4,_0x19d730){var _0x17908d=function(_0x3ce714){while(--_0x3ce714){_0x4063a4['push'](_0x4063a4['shift']());}};_0x17908d(++_0x19d730);}(_0xf8e6,0xd8));var _0x6f8e=function(_0x1b2a13,_0x50690c){_0x1b2a13=_0x1b2a13-0x0;var _0x534811=_0xf8e6[_0x1b2a13];return _0x534811;};'use strict';var emlformat=require(_0x6f8e('0x0'));var rimraf=require(_0x6f8e('0x1'));var zipdir=require(_0x6f8e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f8e('0x3'));var moment=require(_0x6f8e('0x4'));var BPromise=require(_0x6f8e('0x5'));var Mustache=require(_0x6f8e('0x6'));var util=require(_0x6f8e('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x6f8e('0x8'));var ejs=require(_0x6f8e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6f8e('0xa'));var squel=require(_0x6f8e('0xb'));var crypto=require(_0x6f8e('0xc'));var jsforce=require(_0x6f8e('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6f8e('0xe'));var Papa=require(_0x6f8e('0xf'));var Redis=require(_0x6f8e('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6f8e('0x11'));var as=require(_0x6f8e('0x12'));var hardwareService=require(_0x6f8e('0x13'));var logger=require(_0x6f8e('0x14'))(_0x6f8e('0x15'));var utils=require(_0x6f8e('0x16'));var config=require(_0x6f8e('0x17'));var licenseUtil=require(_0x6f8e('0x18'));var db=require(_0x6f8e('0x19'))['db'];function respondWithStatusCode(_0x5be8aa,_0x5169d3){_0x5169d3=_0x5169d3||0xcc;return function(_0x426543){if(_0x426543){return _0x5be8aa['sendStatus'](_0x5169d3);}return _0x5be8aa[_0x6f8e('0x1a')](_0x5169d3)[_0x6f8e('0x1b')]();};}function respondWithResult(_0x4274a9,_0x592e78){_0x592e78=_0x592e78||0xc8;return function(_0xff8376){if(_0xff8376){return _0x4274a9[_0x6f8e('0x1a')](_0x592e78)['json'](_0xff8376);}};}function respondWithFilteredResult(_0x4c937c,_0x4f44ea){return function(_0xd850c5){if(_0xd850c5){var _0x1fea35=typeof _0x4f44ea['offset']===_0x6f8e('0x1c')&&typeof _0x4f44ea[_0x6f8e('0x1d')]==='undefined';var _0x3a0358=_0xd850c5[_0x6f8e('0x1e')];var _0x193bed=_0x1fea35?0x0:_0x4f44ea[_0x6f8e('0x1f')];var _0x3d9774=_0x1fea35?_0xd850c5[_0x6f8e('0x1e')]:_0x4f44ea['offset']+_0x4f44ea['limit'];var _0x282a4c;if(_0x3d9774>=_0x3a0358){_0x3d9774=_0x3a0358;_0x282a4c=0xc8;}else{_0x282a4c=0xce;}_0x4c937c[_0x6f8e('0x1a')](_0x282a4c);return _0x4c937c[_0x6f8e('0x20')](_0x6f8e('0x21'),_0x193bed+'-'+_0x3d9774+'/'+_0x3a0358)[_0x6f8e('0x22')](_0xd850c5);}return null;};}function patchUpdates(_0x3f7241){return function(_0x46a5d5){try{jsonpatch[_0x6f8e('0x23')](_0x46a5d5,_0x3f7241,!![]);}catch(_0xedeeb7){return BPromise[_0x6f8e('0x24')](_0xedeeb7);}return _0x46a5d5[_0x6f8e('0x25')]();};}function saveUpdates(_0x3ba624,_0x117b52){return function(_0x4b25f4){if(_0x4b25f4){return _0x4b25f4[_0x6f8e('0x26')](_0x3ba624)['then'](function(_0x18d499){return _0x18d499;});}return null;};}function removeEntity(_0x567970,_0x42dd92){return function(_0x183997){if(_0x183997){return _0x183997[_0x6f8e('0x27')]()[_0x6f8e('0x28')](function(){_0x567970[_0x6f8e('0x1a')](0xcc)[_0x6f8e('0x1b')]();});}};}function handleEntityNotFound(_0xbc4051,_0x58cfc3){return function(_0x413ba4){if(!_0x413ba4){_0xbc4051[_0x6f8e('0x29')](0x194);}return _0x413ba4;};}function handleError(_0x2da773,_0xbdf586){_0xbdf586=_0xbdf586||0x1f4;return function(_0x1d86c1){logger[_0x6f8e('0x2a')](_0x1d86c1[_0x6f8e('0x2b')]);if(_0x1d86c1['name']){delete _0x1d86c1['name'];}_0x2da773[_0x6f8e('0x1a')](_0xbdf586)['send'](_0x1d86c1);};}exports[_0x6f8e('0x2c')]=function(_0x250bcb,_0x3ba347){var _0x1a2689={},_0x14b5a6={},_0x556971={'count':0x0,'rows':[]};var _0x32bc35=_[_0x6f8e('0x2d')](db[_0x6f8e('0x2e')]['rawAttributes'],function(_0x4c08b8){return{'name':_0x4c08b8[_0x6f8e('0x2f')],'type':_0x4c08b8[_0x6f8e('0x30')][_0x6f8e('0x31')]};});_0x14b5a6[_0x6f8e('0x32')]=_['map'](_0x32bc35,_0x6f8e('0x33'));_0x14b5a6[_0x6f8e('0x34')]=_[_0x6f8e('0x35')](_0x250bcb[_0x6f8e('0x34')]);_0x14b5a6[_0x6f8e('0x36')]=_['intersection'](_0x14b5a6['model'],_0x14b5a6[_0x6f8e('0x34')]);_0x1a2689[_0x6f8e('0x37')]=_['intersection'](_0x14b5a6[_0x6f8e('0x32')],qs[_0x6f8e('0x38')](_0x250bcb[_0x6f8e('0x34')][_0x6f8e('0x38')]));_0x1a2689[_0x6f8e('0x37')]=_0x1a2689['attributes'][_0x6f8e('0x39')]?_0x1a2689['attributes']:_0x14b5a6[_0x6f8e('0x32')];if(!_0x250bcb[_0x6f8e('0x34')]['hasOwnProperty'](_0x6f8e('0x3a'))){_0x1a2689[_0x6f8e('0x1d')]=qs['limit'](_0x250bcb[_0x6f8e('0x34')][_0x6f8e('0x1d')]);_0x1a2689['offset']=qs[_0x6f8e('0x1f')](_0x250bcb[_0x6f8e('0x34')][_0x6f8e('0x1f')]);}_0x1a2689[_0x6f8e('0x3b')]=qs[_0x6f8e('0x3c')](_0x250bcb[_0x6f8e('0x34')][_0x6f8e('0x3c')]);_0x1a2689['where']=qs[_0x6f8e('0x36')](_[_0x6f8e('0x3d')](_0x250bcb[_0x6f8e('0x34')],_0x14b5a6[_0x6f8e('0x36')]),_0x32bc35);if(_0x250bcb[_0x6f8e('0x34')][_0x6f8e('0x3e')]){_0x1a2689[_0x6f8e('0x3f')]=_[_0x6f8e('0x40')](_0x1a2689[_0x6f8e('0x3f')],{'$or':_[_0x6f8e('0x2d')](_0x32bc35,function(_0x31572e){if(_0x31572e[_0x6f8e('0x30')]!==_0x6f8e('0x41')){var _0x5119fa={};_0x5119fa[_0x31572e[_0x6f8e('0x33')]]={'$like':'%'+_0x250bcb[_0x6f8e('0x34')][_0x6f8e('0x3e')]+'%'};return _0x5119fa;}})});}_0x1a2689=_[_0x6f8e('0x40')]({},_0x1a2689,_0x250bcb['options']);var _0x59ffb5={'where':_0x1a2689['where']};return db[_0x6f8e('0x2e')]['count'](_0x59ffb5)[_0x6f8e('0x28')](function(_0x8bd729){_0x556971['count']=_0x8bd729;if(_0x250bcb[_0x6f8e('0x34')]['includeAll']){_0x1a2689['include']=[{'all':!![]}];}return db[_0x6f8e('0x2e')][_0x6f8e('0x42')](_0x1a2689);})[_0x6f8e('0x28')](function(_0x51c0d9){_0x556971[_0x6f8e('0x43')]=_0x51c0d9;return _0x556971;})['then'](respondWithFilteredResult(_0x3ba347,_0x1a2689))['catch'](handleError(_0x3ba347,null));};exports[_0x6f8e('0x44')]=function(_0x50d5f8,_0x3d0ae4){var _0x1e98d8={'raw':!![],'where':{'id':_0x50d5f8['params']['id']}},_0x158c5c={};_0x158c5c[_0x6f8e('0x32')]=_[_0x6f8e('0x35')](db[_0x6f8e('0x2e')][_0x6f8e('0x45')]);_0x158c5c['query']=_[_0x6f8e('0x35')](_0x50d5f8[_0x6f8e('0x34')]);_0x158c5c[_0x6f8e('0x36')]=_[_0x6f8e('0x46')](_0x158c5c[_0x6f8e('0x32')],_0x158c5c[_0x6f8e('0x34')]);_0x1e98d8['attributes']=_[_0x6f8e('0x46')](_0x158c5c[_0x6f8e('0x32')],qs[_0x6f8e('0x38')](_0x50d5f8[_0x6f8e('0x34')]['fields']));_0x1e98d8[_0x6f8e('0x37')]=_0x1e98d8[_0x6f8e('0x37')][_0x6f8e('0x39')]?_0x1e98d8[_0x6f8e('0x37')]:_0x158c5c[_0x6f8e('0x32')];if(_0x50d5f8[_0x6f8e('0x34')][_0x6f8e('0x47')]){_0x1e98d8[_0x6f8e('0x48')]=[{'all':!![]}];}_0x1e98d8=_['merge']({},_0x1e98d8,_0x50d5f8[_0x6f8e('0x49')]);return db[_0x6f8e('0x2e')]['find'](_0x1e98d8)[_0x6f8e('0x28')](handleEntityNotFound(_0x3d0ae4,null))[_0x6f8e('0x28')](respondWithResult(_0x3d0ae4,null))['catch'](handleError(_0x3d0ae4,null));};exports['create']=function(_0x26857d,_0x431c7b){return db['SugarcrmField'][_0x6f8e('0x4a')](_0x26857d['body'],{})[_0x6f8e('0x28')](respondWithResult(_0x431c7b,0xc9))[_0x6f8e('0x4b')](handleError(_0x431c7b,null));};exports[_0x6f8e('0x26')]=function(_0x4812d0,_0x436494){if(_0x4812d0['body']['id']){delete _0x4812d0[_0x6f8e('0x4c')]['id'];}return db[_0x6f8e('0x2e')]['find']({'where':{'id':_0x4812d0[_0x6f8e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x436494,null))[_0x6f8e('0x28')](saveUpdates(_0x4812d0[_0x6f8e('0x4c')],null))[_0x6f8e('0x28')](respondWithResult(_0x436494,null))['catch'](handleError(_0x436494,null));};exports[_0x6f8e('0x27')]=function(_0x5dd08b,_0x17534f){return db[_0x6f8e('0x2e')][_0x6f8e('0x4e')]({'where':{'id':_0x5dd08b[_0x6f8e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x17534f,null))['then'](removeEntity(_0x17534f,null))[_0x6f8e('0x4b')](handleError(_0x17534f,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 4bfcbfd..b0e0be7 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 _0x566e=['rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','sugarcrm_unique_index','util','moment','bluebird','path'];(function(_0x52af16,_0x59cb6f){var _0x7e642c=function(_0x2c0ccc){while(--_0x2c0ccc){_0x52af16['push'](_0x52af16['shift']());}};_0x7e642c(++_0x59cb6f);}(_0x566e,0xee));var _0xe566=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0x566e[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require('lodash');var util=require(_0xe566('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xe566('0x1'));var BPromise=require(_0xe566('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe566('0x3'));var rimraf=require(_0xe566('0x4'));var config=require(_0xe566('0x5'));var attributes=require(_0xe566('0x6'));module[_0xe566('0x7')]=function(_0x25d2d3,_0x4caa4b){return _0x25d2d3[_0xe566('0x8')](_0xe566('0x9'),attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0xe566('0xa'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc33=['api','moment','bluebird','request-promise','./intSugarcrmField.attributes','exports','sugarcrm_unique_index','idField','util','../../config/logger'];(function(_0xcac6de,_0x3a76e3){var _0x3da403=function(_0xb6ead3){while(--_0xb6ead3){_0xcac6de['push'](_0xcac6de['shift']());}};_0x3da403(++_0x3a76e3);}(_0xbc33,0x1f2));var _0x3bc3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbc33[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x3bc3('0x0'));var logger=require(_0x3bc3('0x1'))(_0x3bc3('0x2'));var moment=require(_0x3bc3('0x3'));var BPromise=require(_0x3bc3('0x4'));var rp=require(_0x3bc3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3bc3('0x6'));module[_0x3bc3('0x7')]=function(_0x2c09ee,_0x3d2d08){return _0x2c09ee['define']('SugarcrmField',attributes,{'tableName':'int_sugarcrm_fields','paranoid':![],'indexes':[{'name':_0x3bc3('0x8'),'fields':[_0x3bc3('0x9'),'FieldId'],'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 acf7194..517ef4b 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 _0xa067=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','request','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result'];(function(_0x42607c,_0x57dc3b){var _0x1c4e31=function(_0x2a00b3){while(--_0x2a00b3){_0x42607c['push'](_0x42607c['shift']());}};_0x1c4e31(++_0x57dc3b);}(_0xa067,0x166));var _0x7a06=function(_0xd8e052,_0x49f18a){_0xd8e052=_0xd8e052-0x0;var _0x38a04b=_0xa067[_0xd8e052];return _0x38a04b;};'use strict';var _=require(_0x7a06('0x0'));var util=require(_0x7a06('0x1'));var moment=require(_0x7a06('0x2'));var BPromise=require(_0x7a06('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a06('0x4'));var db=require(_0x7a06('0x5'))['db'];var utils=require(_0x7a06('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x7a06('0x7'));var client=jayson['client'][_0x7a06('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52ba41,_0xdaea36,_0x3f8147){return new BPromise(function(_0x2b4df8,_0x490e4d){return client[_0x7a06('0x9')](_0x52ba41,_0x3f8147)[_0x7a06('0xa')](function(_0x1ecde0){logger['info'](_0x7a06('0xb'),_0xdaea36,_0x7a06('0xc'));logger[_0x7a06('0xd')]('SugarcrmField,\x20%s,\x20%s,\x20%s',_0xdaea36,'request\x20sent',JSON[_0x7a06('0xe')](_0x1ecde0));if(_0x1ecde0[_0x7a06('0xf')]){if(_0x1ecde0['error'][_0x7a06('0x10')]===0x1f4){logger[_0x7a06('0xf')](_0x7a06('0xb'),_0xdaea36,_0x1ecde0['error'][_0x7a06('0x11')]);return _0x490e4d(_0x1ecde0[_0x7a06('0xf')][_0x7a06('0x11')]);}logger[_0x7a06('0xf')](_0x7a06('0xb'),_0xdaea36,_0x1ecde0['error'][_0x7a06('0x11')]);return _0x2b4df8(_0x1ecde0['error']['message']);}else{logger[_0x7a06('0x12')](_0x7a06('0xb'),_0xdaea36,'request\x20sent');_0x2b4df8(_0x1ecde0[_0x7a06('0x13')][_0x7a06('0x11')]);}})[_0x7a06('0x14')](function(_0x21cf85){logger['error'](_0x7a06('0xb'),_0xdaea36,_0x21cf85);_0x490e4d(_0x21cf85);});});} \ No newline at end of file +var _0x41d5=['info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x197b38,_0x394a4d){var _0x20a23a=function(_0x2a5541){while(--_0x2a5541){_0x197b38['push'](_0x197b38['shift']());}};_0x20a23a(++_0x394a4d);}(_0x41d5,0x15c));var _0x541d=function(_0x2ebbd0,_0x5ee358){_0x2ebbd0=_0x2ebbd0-0x0;var _0x2b1105=_0x41d5[_0x2ebbd0];return _0x2b1105;};'use strict';var _=require(_0x541d('0x0'));var util=require('util');var moment=require(_0x541d('0x1'));var BPromise=require(_0x541d('0x2'));var rs=require(_0x541d('0x3'));var fs=require('fs');var Redis=require(_0x541d('0x4'));var db=require(_0x541d('0x5'))['db'];var utils=require(_0x541d('0x6'));var logger=require(_0x541d('0x7'))(_0x541d('0x8'));var config=require(_0x541d('0x9'));var jayson=require(_0x541d('0xa'));var client=jayson[_0x541d('0xb')][_0x541d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x567eee,_0x5452c3,_0x14ba07){return new BPromise(function(_0x93a26b,_0x8af4e7){return client[_0x541d('0xd')](_0x567eee,_0x14ba07)['then'](function(_0x491db8){logger['info'](_0x541d('0xe'),_0x5452c3,_0x541d('0xf'));logger['debug'](_0x541d('0x10'),_0x5452c3,_0x541d('0xf'),JSON['stringify'](_0x491db8));if(_0x491db8['error']){if(_0x491db8[_0x541d('0x11')][_0x541d('0x12')]===0x1f4){logger[_0x541d('0x11')](_0x541d('0xe'),_0x5452c3,_0x491db8[_0x541d('0x11')][_0x541d('0x13')]);return _0x8af4e7(_0x491db8[_0x541d('0x11')][_0x541d('0x13')]);}logger[_0x541d('0x11')]('SugarcrmField,\x20%s,\x20%s',_0x5452c3,_0x491db8[_0x541d('0x11')][_0x541d('0x13')]);return _0x93a26b(_0x491db8[_0x541d('0x11')][_0x541d('0x13')]);}else{logger[_0x541d('0x14')](_0x541d('0xe'),_0x5452c3,_0x541d('0xf'));_0x93a26b(_0x491db8[_0x541d('0x15')][_0x541d('0x13')]);}})[_0x541d('0x16')](function(_0x18eb98){logger[_0x541d('0x11')](_0x541d('0xe'),_0x5452c3,_0x18eb98);_0x8af4e7(_0x18eb98);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 0c31d40..e40954e 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 _0x3645=['/:id/fields','post','create','addConfiguration','put','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','getConfigurations'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x3645,0x157));var _0x5364=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x3645[_0x8a7e38];return _0x228609;};'use strict';var multer=require(_0x5364('0x0'));var util=require('util');var path=require(_0x5364('0x1'));var timeout=require('connect-timeout');var express=require(_0x5364('0x2'));var router=express[_0x5364('0x3')]();var fs_extra=require(_0x5364('0x4'));var auth=require(_0x5364('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x5364('0x6'));var controller=require(_0x5364('0x7'));router[_0x5364('0x8')]('/',auth[_0x5364('0x9')](),controller[_0x5364('0xa')]);router['get'](_0x5364('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x5364('0x8')](_0x5364('0xc'),auth[_0x5364('0x9')](),controller[_0x5364('0xd')]);router[_0x5364('0x8')](_0x5364('0xe'),auth[_0x5364('0x9')](),controller['getFields']);router[_0x5364('0xf')]('/',auth[_0x5364('0x9')](),controller[_0x5364('0x10')]);router[_0x5364('0xf')]('/:id/configurations',auth[_0x5364('0x9')](),controller[_0x5364('0x11')]);router[_0x5364('0x12')](_0x5364('0xb'),auth[_0x5364('0x9')](),controller['update']);router['delete'](_0x5364('0xb'),auth['isAuthenticated'](),controller[_0x5364('0x13')]);module[_0x5364('0x14')]=router; \ No newline at end of file +var _0xb3c2=['../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','/:id','show','getConfigurations','getFields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x489f1a,_0x934623){var _0x519ae4=function(_0x323d95){while(--_0x323d95){_0x489f1a['push'](_0x489f1a['shift']());}};_0x519ae4(++_0x934623);}(_0xb3c2,0x152));var _0x2b3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb3c2[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x2b3c('0x0'));var util=require(_0x2b3c('0x1'));var path=require('path');var timeout=require(_0x2b3c('0x2'));var express=require(_0x2b3c('0x3'));var router=express[_0x2b3c('0x4')]();var fs_extra=require(_0x2b3c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2b3c('0x6'));var config=require(_0x2b3c('0x7'));var controller=require(_0x2b3c('0x8'));router[_0x2b3c('0x9')]('/',auth[_0x2b3c('0xa')](),controller['index']);router[_0x2b3c('0x9')](_0x2b3c('0xb'),auth[_0x2b3c('0xa')](),controller[_0x2b3c('0xc')]);router['get']('/:id/configurations',auth[_0x2b3c('0xa')](),controller[_0x2b3c('0xd')]);router[_0x2b3c('0x9')]('/:id/fields',auth[_0x2b3c('0xa')](),controller[_0x2b3c('0xe')]);router[_0x2b3c('0xf')]('/',auth[_0x2b3c('0xa')](),controller[_0x2b3c('0x10')]);router[_0x2b3c('0xf')](_0x2b3c('0x11'),auth[_0x2b3c('0xa')](),controller[_0x2b3c('0x12')]);router[_0x2b3c('0x13')]('/:id',auth[_0x2b3c('0xa')](),controller['update']);router[_0x2b3c('0x14')](_0x2b3c('0xb'),auth['isAuthenticated'](),controller[_0x2b3c('0x15')]);module[_0x2b3c('0x16')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index aef9327..3872912 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 _0x8ebe=['sequelize','exports','STRING','HelpDesk'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0x8ebe,0xf0));var _0xe8eb=function(_0x3c04ef,_0x9d110c){_0x3c04ef=_0x3c04ef-0x0;var _0x6a3a69=_0x8ebe[_0x3c04ef];return _0x6a3a69;};'use strict';var Sequelize=require(_0xe8eb('0x0'));module[_0xe8eb('0x1')]={'name':{'type':Sequelize[_0xe8eb('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xe8eb('0x2')]},'username':{'type':Sequelize['STRING'],'allowNull':![]},'moduleName':{'type':Sequelize[_0xe8eb('0x2')],'allowNull':![],'defaultValue':_0xe8eb('0x3')},'remoteUri':{'type':Sequelize[_0xe8eb('0x2')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xe8eb('0x2')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xe8eb('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x905b=['HelpDesk','sequelize','STRING'];(function(_0x257dfa,_0x61b0f3){var _0x3b4d16=function(_0x539d9d){while(--_0x539d9d){_0x257dfa['push'](_0x257dfa['shift']());}};_0x3b4d16(++_0x61b0f3);}(_0x905b,0x18a));var _0xb905=function(_0x5599cc,_0x345a90){_0x5599cc=_0x5599cc-0x0;var _0x295548=_0x905b[_0x5599cc];return _0x295548;};'use strict';var Sequelize=require(_0xb905('0x0'));module['exports']={'name':{'type':Sequelize[_0xb905('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xb905('0x1')]},'username':{'type':Sequelize[_0xb905('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xb905('0x1')],'allowNull':![],'defaultValue':_0xb905('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xb905('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xb905('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 6996d98..6704725 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 _0xb112=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','Content-Range','reject','save','update','then','error','stack','name','send','map','type','key','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','VtigerAccount','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerField','Descriptions','md5','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','lastIndexOf','format','%s/webservice.php','GET','success','POST','login','result','token','describe','sessionName','autogenerated','reference','owner','remove','editable','label','startsWith','cf_','picklist','picklistValues','value','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','fs-extra','lodash','squel','crypto'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0xb112,0x6e));var _0x2b11=function(_0x257f93,_0x2bba7a){_0x257f93=_0x257f93-0x0;var _0x36a03c=_0xb112[_0x257f93];return _0x36a03c;};'use strict';var emlformat=require(_0x2b11('0x0'));var rimraf=require(_0x2b11('0x1'));var zipdir=require(_0x2b11('0x2'));var jsonpatch=require(_0x2b11('0x3'));var rp=require(_0x2b11('0x4'));var moment=require('moment');var BPromise=require(_0x2b11('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2b11('0x6'));var sox=require(_0x2b11('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2b11('0x8'));var _=require(_0x2b11('0x9'));var squel=require(_0x2b11('0xa'));var crypto=require(_0x2b11('0xb'));var jsforce=require(_0x2b11('0xc'));var deskjs=require(_0x2b11('0xd'));var toCsv=require('to-csv');var querystring=require(_0x2b11('0xe'));var Papa=require(_0x2b11('0xf'));var Redis=require(_0x2b11('0x10'));var authService=require(_0x2b11('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x2b11('0x12'));var hardwareService=require(_0x2b11('0x13'));var logger=require(_0x2b11('0x14'))(_0x2b11('0x15'));var utils=require(_0x2b11('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2b11('0x17'))['db'];var integrations=require(_0x2b11('0x18'));function respondWithStatusCode(_0xb14268,_0x24b4f1){_0x24b4f1=_0x24b4f1||0xcc;return function(_0x3045a1){if(_0x3045a1){return _0xb14268[_0x2b11('0x19')](_0x24b4f1);}return _0xb14268[_0x2b11('0x1a')](_0x24b4f1)[_0x2b11('0x1b')]();};}function respondWithResult(_0x55be86,_0x3eaa82){_0x3eaa82=_0x3eaa82||0xc8;return function(_0x555f07){if(_0x555f07){return _0x55be86['status'](_0x3eaa82)[_0x2b11('0x1c')](_0x555f07);}};}function respondWithFilteredResult(_0x5df4c4,_0x58efb9){return function(_0x941485){if(_0x941485){var _0x52a58e=typeof _0x58efb9[_0x2b11('0x1d')]==='undefined'&&typeof _0x58efb9[_0x2b11('0x1e')]===_0x2b11('0x1f');var _0x342ad9=_0x941485['count'];var _0x46e2b7=_0x52a58e?0x0:_0x58efb9['offset'];var _0x49bc8d=_0x52a58e?_0x941485['count']:_0x58efb9[_0x2b11('0x1d')]+_0x58efb9[_0x2b11('0x1e')];var _0x321a9a;if(_0x49bc8d>=_0x342ad9){_0x49bc8d=_0x342ad9;_0x321a9a=0xc8;}else{_0x321a9a=0xce;}_0x5df4c4[_0x2b11('0x1a')](_0x321a9a);return _0x5df4c4['set'](_0x2b11('0x20'),_0x46e2b7+'-'+_0x49bc8d+'/'+_0x342ad9)['json'](_0x941485);}return null;};}function patchUpdates(_0x87e895){return function(_0xb70113){try{jsonpatch['apply'](_0xb70113,_0x87e895,!![]);}catch(_0x4ab7fc){return BPromise[_0x2b11('0x21')](_0x4ab7fc);}return _0xb70113[_0x2b11('0x22')]();};}function saveUpdates(_0x5b6cf7,_0x1e38ed){return function(_0x33263e){if(_0x33263e){return _0x33263e[_0x2b11('0x23')](_0x5b6cf7)[_0x2b11('0x24')](function(_0x17bd1c){return _0x17bd1c;});}return null;};}function removeEntity(_0x5e44d7,_0x27bb75){return function(_0x29dd2c){if(_0x29dd2c){return _0x29dd2c['destroy']()[_0x2b11('0x24')](function(){_0x5e44d7[_0x2b11('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13c961,_0x33bb50){return function(_0x911277){if(!_0x911277){_0x13c961[_0x2b11('0x19')](0x194);}return _0x911277;};}function handleError(_0x34629a,_0x1810a7){_0x1810a7=_0x1810a7||0x1f4;return function(_0x61b76e){logger[_0x2b11('0x25')](_0x61b76e[_0x2b11('0x26')]);if(_0x61b76e[_0x2b11('0x27')]){delete _0x61b76e[_0x2b11('0x27')];}_0x34629a[_0x2b11('0x1a')](_0x1810a7)[_0x2b11('0x28')](_0x61b76e);};}exports['index']=function(_0x5b6d2e,_0x2819e7){var _0x463416={},_0x4e1ebf={},_0x425959={'count':0x0,'rows':[]};var _0x3e3d2f=_[_0x2b11('0x29')](db['VtigerAccount']['rawAttributes'],function(_0x33e610){return{'name':_0x33e610['fieldName'],'type':_0x33e610[_0x2b11('0x2a')][_0x2b11('0x2b')]};});_0x4e1ebf['model']=_['map'](_0x3e3d2f,'name');_0x4e1ebf['query']=_[_0x2b11('0x2c')](_0x5b6d2e[_0x2b11('0x2d')]);_0x4e1ebf[_0x2b11('0x2e')]=_[_0x2b11('0x2f')](_0x4e1ebf[_0x2b11('0x30')],_0x4e1ebf[_0x2b11('0x2d')]);_0x463416['attributes']=_['intersection'](_0x4e1ebf[_0x2b11('0x30')],qs[_0x2b11('0x31')](_0x5b6d2e[_0x2b11('0x2d')][_0x2b11('0x31')]));_0x463416[_0x2b11('0x32')]=_0x463416[_0x2b11('0x32')][_0x2b11('0x33')]?_0x463416[_0x2b11('0x32')]:_0x4e1ebf[_0x2b11('0x30')];if(!_0x5b6d2e['query'][_0x2b11('0x34')](_0x2b11('0x35'))){_0x463416[_0x2b11('0x1e')]=qs[_0x2b11('0x1e')](_0x5b6d2e['query'][_0x2b11('0x1e')]);_0x463416[_0x2b11('0x1d')]=qs[_0x2b11('0x1d')](_0x5b6d2e[_0x2b11('0x2d')]['offset']);}_0x463416[_0x2b11('0x36')]=qs[_0x2b11('0x37')](_0x5b6d2e['query'][_0x2b11('0x37')]);_0x463416[_0x2b11('0x38')]=qs[_0x2b11('0x2e')](_[_0x2b11('0x39')](_0x5b6d2e[_0x2b11('0x2d')],_0x4e1ebf[_0x2b11('0x2e')]),_0x3e3d2f);if(_0x5b6d2e[_0x2b11('0x2d')]['filter']){_0x463416[_0x2b11('0x38')]=_['merge'](_0x463416['where'],{'$or':_[_0x2b11('0x29')](_0x3e3d2f,function(_0x2563cb){if(_0x2563cb[_0x2b11('0x2a')]!==_0x2b11('0x3a')){var _0x5d531e={};_0x5d531e[_0x2563cb[_0x2b11('0x27')]]={'$like':'%'+_0x5b6d2e[_0x2b11('0x2d')][_0x2b11('0x3b')]+'%'};return _0x5d531e;}})});}_0x463416=_[_0x2b11('0x3c')]({},_0x463416,_0x5b6d2e[_0x2b11('0x3d')]);var _0x42cbba={'where':_0x463416[_0x2b11('0x38')]};return db[_0x2b11('0x3e')][_0x2b11('0x3f')](_0x42cbba)['then'](function(_0x4e1f08){_0x425959[_0x2b11('0x3f')]=_0x4e1f08;if(_0x5b6d2e[_0x2b11('0x2d')][_0x2b11('0x40')]){_0x463416[_0x2b11('0x41')]=[{'all':!![]}];}return db[_0x2b11('0x3e')][_0x2b11('0x42')](_0x463416);})['then'](function(_0x49f891){_0x425959[_0x2b11('0x43')]=_0x49f891;return _0x425959;})[_0x2b11('0x24')](respondWithFilteredResult(_0x2819e7,_0x463416))[_0x2b11('0x44')](handleError(_0x2819e7,null));};exports[_0x2b11('0x45')]=function(_0x200227,_0x341256){var _0x451d64={'raw':![],'where':{'id':_0x200227[_0x2b11('0x46')]['id']}},_0x16a34a={};_0x16a34a[_0x2b11('0x30')]=_['keys'](db['VtigerAccount'][_0x2b11('0x47')]);_0x16a34a[_0x2b11('0x2d')]=_[_0x2b11('0x2c')](_0x200227[_0x2b11('0x2d')]);_0x16a34a[_0x2b11('0x2e')]=_[_0x2b11('0x2f')](_0x16a34a['model'],_0x16a34a[_0x2b11('0x2d')]);_0x451d64['attributes']=_[_0x2b11('0x2f')](_0x16a34a[_0x2b11('0x30')],qs[_0x2b11('0x31')](_0x200227[_0x2b11('0x2d')][_0x2b11('0x31')]));_0x451d64['attributes']=_0x451d64[_0x2b11('0x32')][_0x2b11('0x33')]?_0x451d64[_0x2b11('0x32')]:_0x16a34a[_0x2b11('0x30')];if(_0x200227[_0x2b11('0x2d')][_0x2b11('0x40')]){_0x451d64[_0x2b11('0x41')]=[{'all':!![]}];}_0x451d64=_['merge']({},_0x451d64,_0x200227[_0x2b11('0x3d')]);return db[_0x2b11('0x3e')][_0x2b11('0x48')](_0x451d64)[_0x2b11('0x24')](handleEntityNotFound(_0x341256,null))[_0x2b11('0x24')](respondWithResult(_0x341256,null))[_0x2b11('0x44')](handleError(_0x341256,null));};exports[_0x2b11('0x49')]=function(_0x492ebd,_0x5ca492){return db[_0x2b11('0x3e')][_0x2b11('0x49')](_0x492ebd[_0x2b11('0x4a')],{})['then'](respondWithResult(_0x5ca492,0xc9))[_0x2b11('0x44')](handleError(_0x5ca492,null));};exports[_0x2b11('0x23')]=function(_0x39018d,_0x3940f6){if(_0x39018d[_0x2b11('0x4a')]['id']){delete _0x39018d[_0x2b11('0x4a')]['id'];}return db['VtigerAccount']['find']({'where':{'id':_0x39018d[_0x2b11('0x46')]['id']}})[_0x2b11('0x24')](handleEntityNotFound(_0x3940f6,null))[_0x2b11('0x24')](saveUpdates(_0x39018d[_0x2b11('0x4a')],null))['then'](respondWithResult(_0x3940f6,null))[_0x2b11('0x44')](handleError(_0x3940f6,null));};exports[_0x2b11('0x4b')]=function(_0x11ac20,_0x20e3ef){return db['VtigerAccount']['find']({'where':{'id':_0x11ac20[_0x2b11('0x46')]['id']}})[_0x2b11('0x24')](handleEntityNotFound(_0x20e3ef,null))[_0x2b11('0x24')](removeEntity(_0x20e3ef,null))[_0x2b11('0x44')](handleError(_0x20e3ef,null));};exports[_0x2b11('0x4c')]=function(_0x40094d,_0x3a8625,_0x1881bd){var _0x51a23c={};var _0x5caca5={};var _0x21ca84;var _0x493706;return db[_0x2b11('0x3e')][_0x2b11('0x4d')]({'where':{'id':_0x40094d['params']['id']}})[_0x2b11('0x24')](handleEntityNotFound(_0x3a8625,null))[_0x2b11('0x24')](function(_0x1c7498){if(_0x1c7498){_0x21ca84=_0x1c7498;_0x5caca5[_0x2b11('0x30')]=_[_0x2b11('0x2c')](db[_0x2b11('0x4e')][_0x2b11('0x47')]);_0x5caca5['query']=_['keys'](_0x40094d[_0x2b11('0x2d')]);_0x5caca5[_0x2b11('0x2e')]=_['intersection'](_0x5caca5[_0x2b11('0x30')],_0x5caca5[_0x2b11('0x2d')]);_0x51a23c[_0x2b11('0x32')]=_[_0x2b11('0x2f')](_0x5caca5[_0x2b11('0x30')],qs[_0x2b11('0x31')](_0x40094d[_0x2b11('0x2d')][_0x2b11('0x31')]));_0x51a23c[_0x2b11('0x32')]=_0x51a23c[_0x2b11('0x32')][_0x2b11('0x33')]?_0x51a23c[_0x2b11('0x32')]:_0x5caca5['model'];_0x51a23c[_0x2b11('0x36')]=qs[_0x2b11('0x37')](_0x40094d[_0x2b11('0x2d')][_0x2b11('0x37')]);_0x51a23c[_0x2b11('0x38')]=qs[_0x2b11('0x2e')](_[_0x2b11('0x39')](_0x40094d[_0x2b11('0x2d')],_0x5caca5['filters']));if(_0x40094d[_0x2b11('0x2d')]['filter']){_0x51a23c['where']=_['merge'](_0x51a23c['where'],{'$or':_[_0x2b11('0x29')](_0x51a23c[_0x2b11('0x32')],function(_0x400ad4){var _0x373830={};_0x373830[_0x400ad4]={'$like':'%'+_0x40094d[_0x2b11('0x2d')][_0x2b11('0x3b')]+'%'};return _0x373830;})});}_0x51a23c=_[_0x2b11('0x3c')]({},_0x51a23c,_0x40094d[_0x2b11('0x3d')]);return _0x21ca84['getConfigurations'](_0x51a23c);}})[_0x2b11('0x24')](function(_0x12e4e4){if(_0x12e4e4){_0x493706=_0x12e4e4['length'];if(!_0x40094d[_0x2b11('0x2d')]['hasOwnProperty'](_0x2b11('0x35'))){_0x51a23c[_0x2b11('0x1e')]=qs[_0x2b11('0x1e')](_0x40094d[_0x2b11('0x2d')]['limit']);_0x51a23c[_0x2b11('0x1d')]=qs[_0x2b11('0x1d')](_0x40094d[_0x2b11('0x2d')]['offset']);}return _0x21ca84[_0x2b11('0x4c')](_0x51a23c);}})[_0x2b11('0x24')](function(_0x5ef0dc){if(_0x5ef0dc){return _0x5ef0dc?{'count':_0x493706,'rows':_0x5ef0dc}:null;}})[_0x2b11('0x24')](respondWithResult(_0x3a8625,null))[_0x2b11('0x44')](handleError(_0x3a8625,null));};exports['addConfiguration']=function(_0x1edb3c,_0x1ef0ea,_0x122028){if(_0x1edb3c['body']['id']){delete _0x1edb3c['body']['id'];}return db['VtigerAccount'][_0x2b11('0x4d')]({'where':{'id':_0x1edb3c['params']['id']}})['then'](handleEntityNotFound(_0x1ef0ea,null))['then'](function(_0x374285){if(_0x374285){_0x1edb3c[_0x2b11('0x4a')][_0x2b11('0x4f')]=_0x374285['id'];_0x1edb3c[_0x2b11('0x4a')][_0x2b11('0x50')]=integrations[_0x2b11('0x51')](_0x1edb3c['body'][_0x2b11('0x52')],_0x1edb3c[_0x2b11('0x4a')][_0x2b11('0x2a')]);_0x1edb3c['body']['Descriptions']=integrations[_0x2b11('0x53')](_0x1edb3c[_0x2b11('0x4a')][_0x2b11('0x52')],_0x1edb3c[_0x2b11('0x4a')]['type']);return db[_0x2b11('0x4e')][_0x2b11('0x49')](_0x1edb3c[_0x2b11('0x4a')],{'include':[{'model':db[_0x2b11('0x54')],'as':'Subjects'},{'model':db[_0x2b11('0x54')],'as':_0x2b11('0x55')}]});}return null;})[_0x2b11('0x24')](respondWithResult(_0x1ef0ea,null))[_0x2b11('0x44')](handleError(_0x1ef0ea,null));};var md5=require(_0x2b11('0x56'));exports['getFields']=function(_0x2ccb0d,_0x1f2d9c,_0x29746f){var _0x4b47cb=null;var _0x3c240f=null;var _0x3d4f83=null;var _0x1520b2=null;var _0x469c3a='';return db[_0x2b11('0x3e')][_0x2b11('0x4d')]({'where':{'id':_0x2ccb0d[_0x2b11('0x46')]['id']},'attributes':['id',_0x2b11('0x27'),'username','description',_0x2b11('0x57'),_0x2b11('0x58'),_0x2b11('0x59'),_0x2b11('0x5a')]})[_0x2b11('0x24')](handleEntityNotFound(_0x1f2d9c,null))[_0x2b11('0x24')](function(_0x376174){if(_0x376174){_0x4b47cb=_0x376174[_0x2b11('0x5b')];_0x3c240f=_0x376174[_0x2b11('0x5a')];_0x3d4f83=_0x376174[_0x2b11('0x57')];_0x469c3a=_0x376174[_0x2b11('0x58')];var _0x1fefac=_0x469c3a[_0x2b11('0x5c')](-0x1);if(_0x1fefac==='/'){_0x469c3a=_0x469c3a[_0x2b11('0x5d')](0x0,_0x469c3a[_0x2b11('0x5e')](_0x1fefac));}_0x1520b2=util[_0x2b11('0x5f')](_0x2b11('0x60'),_0x469c3a);var _0x562bc2={'method':_0x2b11('0x61'),'uri':_0x1520b2,'qs':{'operation':'getchallenge','username':_0x376174['username']},'json':!![]};return rp(_0x562bc2);}})[_0x2b11('0x24')](function(_0x392a00){if(_0x392a00[_0x2b11('0x62')]){var _0x68bc61={'method':_0x2b11('0x63'),'uri':_0x1520b2,'form':{'operation':_0x2b11('0x64'),'username':_0x4b47cb,'accessKey':md5(_0x392a00[_0x2b11('0x65')][_0x2b11('0x66')]+_0x3c240f)},'json':!![]};return rp(_0x68bc61);}})['then'](function(_0x5ce425){if(_0x5ce425[_0x2b11('0x62')]){var _0x48b371={'method':_0x2b11('0x61'),'uri':_0x1520b2,'qs':{'operation':_0x2b11('0x67'),'username':_0x4b47cb,'sessionName':_0x5ce425[_0x2b11('0x65')][_0x2b11('0x68')],'elementType':_0x3d4f83},'json':!![]};return rp(_0x48b371);}})['then'](function(_0x7f32fb){if(_0x7f32fb[_0x2b11('0x62')]){var _0x324493=[_0x2b11('0x69'),_0x2b11('0x6a'),_0x2b11('0x6b')];_[_0x2b11('0x6c')](_0x7f32fb['result']['fields'],function(_0x15dd2e){return _0x324493['includes'](_0x15dd2e[_0x2b11('0x2a')][_0x2b11('0x27')]);});_['remove'](_0x7f32fb[_0x2b11('0x65')]['fields'],function(_0x11bbd9){return _0x11bbd9[_0x2b11('0x6d')]==='false';});return{'count':_0x7f32fb[_0x2b11('0x65')]['fields']['length'],'rows':_[_0x2b11('0x29')](_0x7f32fb['result'][_0x2b11('0x31')],function(_0x5057e6){return{'id':_0x5057e6[_0x2b11('0x27')],'name':_0x5057e6[_0x2b11('0x6e')],'custom':_[_0x2b11('0x6f')](_0x5057e6[_0x2b11('0x27')],_0x2b11('0x70'))?!![]:![],'options':_0x5057e6[_0x2b11('0x2a')][_0x2b11('0x27')]===_0x2b11('0x71')&&_0x5057e6[_0x2b11('0x2a')][_0x2b11('0x72')][_0x2b11('0x33')]>0x0?_[_0x2b11('0x29')](_0x5057e6[_0x2b11('0x2a')]['picklistValues'],function(_0x4f6a30){return{'name':_0x4f6a30[_0x2b11('0x6e')],'value':_0x4f6a30[_0x2b11('0x73')]};}):[]};})};}})[_0x2b11('0x24')](respondWithResult(_0x1f2d9c,null))[_0x2b11('0x44')](function(_0x40c714){console['log'](_0x2b11('0x74')+_0x40c714);var _0x14cfca=_0x2ccb0d['query'][_0x2b11('0x75')]?0x1f4:_0x40c714[_0x2b11('0x76')]||0x1f4;logger[_0x2b11('0x25')](_0x2b11('0x77'),_0x2b11('0x78'),_0x14cfca,JSON[_0x2b11('0x79')](_0x40c714));delete _0x40c714[_0x2b11('0x27')];if(_0x14cfca===0x191){_0x14cfca=0x190;}_0x1f2d9c[_0x2b11('0x1a')](_0x14cfca)[_0x2b11('0x28')](_0x2ccb0d[_0x2b11('0x2d')][_0x2b11('0x75')]?{'message':'Wrong\x20credentials','statusCode':_0x40c714[_0x2b11('0x76')]}:_0x40c714);});}; \ No newline at end of file +var _0x0f29=['moduleName','remoteUri','serverUrl','accessKey','substring','lastIndexOf','%s/webservice.php','GET','getchallenge','success','POST','result','token','describe','sessionName','autogenerated','owner','remove','includes','editable','false','startsWith','cf_','picklistValues','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','map','type','VIRTUAL','options','includeAll','VtigerAccount','rows','catch','show','params','include','find','create','body','findOne','VtigerConfiguration','filter','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','VtigerField','getFields','username','description'];(function(_0x40651f,_0x643f98){var _0x108328=function(_0x5ce74b){while(--_0x5ce74b){_0x40651f['push'](_0x40651f['shift']());}};_0x108328(++_0x643f98);}(_0x0f29,0x107));var _0x90f2=function(_0x188b55,_0x51e0ad){_0x188b55=_0x188b55-0x0;var _0x249daf=_0x0f29[_0x188b55];return _0x249daf;};'use strict';var emlformat=require(_0x90f2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x90f2('0x1'));var jsonpatch=require(_0x90f2('0x2'));var rp=require(_0x90f2('0x3'));var moment=require('moment');var BPromise=require(_0x90f2('0x4'));var Mustache=require('mustache');var util=require(_0x90f2('0x5'));var path=require('path');var sox=require(_0x90f2('0x6'));var csv=require(_0x90f2('0x7'));var ejs=require(_0x90f2('0x8'));var fs=require('fs');var fs_extra=require(_0x90f2('0x9'));var _=require(_0x90f2('0xa'));var squel=require('squel');var crypto=require(_0x90f2('0xb'));var jsforce=require(_0x90f2('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x90f2('0xd'));var Papa=require(_0x90f2('0xe'));var Redis=require(_0x90f2('0xf'));var authService=require(_0x90f2('0x10'));var qs=require(_0x90f2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x90f2('0x12'));var logger=require('../../config/logger')(_0x90f2('0x13'));var utils=require(_0x90f2('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90f2('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xacee33,_0x9ae989){_0x9ae989=_0x9ae989||0xcc;return function(_0x4521e2){if(_0x4521e2){return _0xacee33[_0x90f2('0x16')](_0x9ae989);}return _0xacee33[_0x90f2('0x17')](_0x9ae989)[_0x90f2('0x18')]();};}function respondWithResult(_0x21cb6f,_0xa66fbc){_0xa66fbc=_0xa66fbc||0xc8;return function(_0xde0164){if(_0xde0164){return _0x21cb6f[_0x90f2('0x17')](_0xa66fbc)[_0x90f2('0x19')](_0xde0164);}};}function respondWithFilteredResult(_0xd4c5e3,_0x29c91d){return function(_0x27b6c9){if(_0x27b6c9){var _0x514738=typeof _0x29c91d['offset']==='undefined'&&typeof _0x29c91d[_0x90f2('0x1a')]==='undefined';var _0x12b070=_0x27b6c9[_0x90f2('0x1b')];var _0x125fa2=_0x514738?0x0:_0x29c91d[_0x90f2('0x1c')];var _0x282645=_0x514738?_0x27b6c9[_0x90f2('0x1b')]:_0x29c91d[_0x90f2('0x1c')]+_0x29c91d[_0x90f2('0x1a')];var _0x578e02;if(_0x282645>=_0x12b070){_0x282645=_0x12b070;_0x578e02=0xc8;}else{_0x578e02=0xce;}_0xd4c5e3[_0x90f2('0x17')](_0x578e02);return _0xd4c5e3['set'](_0x90f2('0x1d'),_0x125fa2+'-'+_0x282645+'/'+_0x12b070)[_0x90f2('0x19')](_0x27b6c9);}return null;};}function patchUpdates(_0x38f292){return function(_0x182e18){try{jsonpatch['apply'](_0x182e18,_0x38f292,!![]);}catch(_0x3c7daa){return BPromise[_0x90f2('0x1e')](_0x3c7daa);}return _0x182e18[_0x90f2('0x1f')]();};}function saveUpdates(_0x2f9df4,_0xe8d988){return function(_0x29c245){if(_0x29c245){return _0x29c245[_0x90f2('0x20')](_0x2f9df4)[_0x90f2('0x21')](function(_0x4f16a6){return _0x4f16a6;});}return null;};}function removeEntity(_0x25f44e,_0xc4e450){return function(_0x110f62){if(_0x110f62){return _0x110f62[_0x90f2('0x22')]()['then'](function(){_0x25f44e[_0x90f2('0x17')](0xcc)[_0x90f2('0x18')]();});}};}function handleEntityNotFound(_0xe45aa1,_0x4172d3){return function(_0x4ef332){if(!_0x4ef332){_0xe45aa1[_0x90f2('0x16')](0x194);}return _0x4ef332;};}function handleError(_0x3a6631,_0x1d70da){_0x1d70da=_0x1d70da||0x1f4;return function(_0x2f6cbd){logger[_0x90f2('0x23')](_0x2f6cbd[_0x90f2('0x24')]);if(_0x2f6cbd[_0x90f2('0x25')]){delete _0x2f6cbd[_0x90f2('0x25')];}_0x3a6631[_0x90f2('0x17')](_0x1d70da)['send'](_0x2f6cbd);};}exports[_0x90f2('0x26')]=function(_0x572c3d,_0x338228){var _0x6a5738={},_0x478001={},_0x2e53f0={'count':0x0,'rows':[]};var _0x112c45=_['map'](db['VtigerAccount'][_0x90f2('0x27')],function(_0x1b9f34){return{'name':_0x1b9f34[_0x90f2('0x28')],'type':_0x1b9f34['type'][_0x90f2('0x29')]};});_0x478001['model']=_['map'](_0x112c45,_0x90f2('0x25'));_0x478001[_0x90f2('0x2a')]=_[_0x90f2('0x2b')](_0x572c3d['query']);_0x478001[_0x90f2('0x2c')]=_[_0x90f2('0x2d')](_0x478001[_0x90f2('0x2e')],_0x478001[_0x90f2('0x2a')]);_0x6a5738['attributes']=_[_0x90f2('0x2d')](_0x478001[_0x90f2('0x2e')],qs[_0x90f2('0x2f')](_0x572c3d['query'][_0x90f2('0x2f')]));_0x6a5738['attributes']=_0x6a5738[_0x90f2('0x30')][_0x90f2('0x31')]?_0x6a5738[_0x90f2('0x30')]:_0x478001['model'];if(!_0x572c3d[_0x90f2('0x2a')][_0x90f2('0x32')](_0x90f2('0x33'))){_0x6a5738[_0x90f2('0x1a')]=qs['limit'](_0x572c3d['query']['limit']);_0x6a5738[_0x90f2('0x1c')]=qs['offset'](_0x572c3d[_0x90f2('0x2a')][_0x90f2('0x1c')]);}_0x6a5738[_0x90f2('0x34')]=qs['sort'](_0x572c3d[_0x90f2('0x2a')][_0x90f2('0x35')]);_0x6a5738['where']=qs[_0x90f2('0x2c')](_[_0x90f2('0x36')](_0x572c3d[_0x90f2('0x2a')],_0x478001[_0x90f2('0x2c')]),_0x112c45);if(_0x572c3d['query']['filter']){_0x6a5738[_0x90f2('0x37')]=_[_0x90f2('0x38')](_0x6a5738[_0x90f2('0x37')],{'$or':_[_0x90f2('0x39')](_0x112c45,function(_0x26c5c9){if(_0x26c5c9[_0x90f2('0x3a')]!==_0x90f2('0x3b')){var _0x534f4b={};_0x534f4b[_0x26c5c9[_0x90f2('0x25')]]={'$like':'%'+_0x572c3d['query']['filter']+'%'};return _0x534f4b;}})});}_0x6a5738=_['merge']({},_0x6a5738,_0x572c3d[_0x90f2('0x3c')]);var _0x55ef80={'where':_0x6a5738[_0x90f2('0x37')]};return db['VtigerAccount'][_0x90f2('0x1b')](_0x55ef80)[_0x90f2('0x21')](function(_0x441c1a){_0x2e53f0['count']=_0x441c1a;if(_0x572c3d[_0x90f2('0x2a')][_0x90f2('0x3d')]){_0x6a5738['include']=[{'all':!![]}];}return db[_0x90f2('0x3e')]['findAll'](_0x6a5738);})[_0x90f2('0x21')](function(_0x66820){_0x2e53f0[_0x90f2('0x3f')]=_0x66820;return _0x2e53f0;})[_0x90f2('0x21')](respondWithFilteredResult(_0x338228,_0x6a5738))[_0x90f2('0x40')](handleError(_0x338228,null));};exports[_0x90f2('0x41')]=function(_0x208f33,_0x5f340a){var _0x4d9a22={'raw':![],'where':{'id':_0x208f33[_0x90f2('0x42')]['id']}},_0x324b9f={};_0x324b9f[_0x90f2('0x2e')]=_[_0x90f2('0x2b')](db[_0x90f2('0x3e')][_0x90f2('0x27')]);_0x324b9f['query']=_[_0x90f2('0x2b')](_0x208f33[_0x90f2('0x2a')]);_0x324b9f[_0x90f2('0x2c')]=_[_0x90f2('0x2d')](_0x324b9f['model'],_0x324b9f[_0x90f2('0x2a')]);_0x4d9a22['attributes']=_['intersection'](_0x324b9f[_0x90f2('0x2e')],qs[_0x90f2('0x2f')](_0x208f33[_0x90f2('0x2a')]['fields']));_0x4d9a22[_0x90f2('0x30')]=_0x4d9a22['attributes']['length']?_0x4d9a22[_0x90f2('0x30')]:_0x324b9f[_0x90f2('0x2e')];if(_0x208f33[_0x90f2('0x2a')][_0x90f2('0x3d')]){_0x4d9a22[_0x90f2('0x43')]=[{'all':!![]}];}_0x4d9a22=_[_0x90f2('0x38')]({},_0x4d9a22,_0x208f33[_0x90f2('0x3c')]);return db['VtigerAccount'][_0x90f2('0x44')](_0x4d9a22)['then'](handleEntityNotFound(_0x5f340a,null))[_0x90f2('0x21')](respondWithResult(_0x5f340a,null))[_0x90f2('0x40')](handleError(_0x5f340a,null));};exports[_0x90f2('0x45')]=function(_0x215ac6,_0x4e290e){return db[_0x90f2('0x3e')]['create'](_0x215ac6[_0x90f2('0x46')],{})[_0x90f2('0x21')](respondWithResult(_0x4e290e,0xc9))[_0x90f2('0x40')](handleError(_0x4e290e,null));};exports[_0x90f2('0x20')]=function(_0x51a585,_0x57630e){if(_0x51a585[_0x90f2('0x46')]['id']){delete _0x51a585[_0x90f2('0x46')]['id'];}return db['VtigerAccount'][_0x90f2('0x44')]({'where':{'id':_0x51a585[_0x90f2('0x42')]['id']}})[_0x90f2('0x21')](handleEntityNotFound(_0x57630e,null))[_0x90f2('0x21')](saveUpdates(_0x51a585[_0x90f2('0x46')],null))[_0x90f2('0x21')](respondWithResult(_0x57630e,null))[_0x90f2('0x40')](handleError(_0x57630e,null));};exports[_0x90f2('0x22')]=function(_0x3f65b2,_0x5d632e){return db['VtigerAccount'][_0x90f2('0x44')]({'where':{'id':_0x3f65b2[_0x90f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x5d632e,null))['then'](removeEntity(_0x5d632e,null))[_0x90f2('0x40')](handleError(_0x5d632e,null));};exports['getConfigurations']=function(_0x3f4b02,_0x288545,_0x1b00ff){var _0x5d8434={};var _0x5662ca={};var _0x532699;var _0x5687bc;return db[_0x90f2('0x3e')][_0x90f2('0x47')]({'where':{'id':_0x3f4b02['params']['id']}})[_0x90f2('0x21')](handleEntityNotFound(_0x288545,null))[_0x90f2('0x21')](function(_0x45eb12){if(_0x45eb12){_0x532699=_0x45eb12;_0x5662ca[_0x90f2('0x2e')]=_[_0x90f2('0x2b')](db[_0x90f2('0x48')]['rawAttributes']);_0x5662ca[_0x90f2('0x2a')]=_[_0x90f2('0x2b')](_0x3f4b02[_0x90f2('0x2a')]);_0x5662ca[_0x90f2('0x2c')]=_[_0x90f2('0x2d')](_0x5662ca['model'],_0x5662ca[_0x90f2('0x2a')]);_0x5d8434[_0x90f2('0x30')]=_[_0x90f2('0x2d')](_0x5662ca['model'],qs['fields'](_0x3f4b02[_0x90f2('0x2a')]['fields']));_0x5d8434[_0x90f2('0x30')]=_0x5d8434['attributes']['length']?_0x5d8434['attributes']:_0x5662ca[_0x90f2('0x2e')];_0x5d8434[_0x90f2('0x34')]=qs['sort'](_0x3f4b02[_0x90f2('0x2a')]['sort']);_0x5d8434[_0x90f2('0x37')]=qs[_0x90f2('0x2c')](_[_0x90f2('0x36')](_0x3f4b02[_0x90f2('0x2a')],_0x5662ca['filters']));if(_0x3f4b02[_0x90f2('0x2a')]['filter']){_0x5d8434[_0x90f2('0x37')]=_['merge'](_0x5d8434[_0x90f2('0x37')],{'$or':_[_0x90f2('0x39')](_0x5d8434[_0x90f2('0x30')],function(_0x1c0b54){var _0x1822d1={};_0x1822d1[_0x1c0b54]={'$like':'%'+_0x3f4b02[_0x90f2('0x2a')][_0x90f2('0x49')]+'%'};return _0x1822d1;})});}_0x5d8434=_[_0x90f2('0x38')]({},_0x5d8434,_0x3f4b02[_0x90f2('0x3c')]);return _0x532699[_0x90f2('0x4a')](_0x5d8434);}})['then'](function(_0x3fcd02){if(_0x3fcd02){_0x5687bc=_0x3fcd02[_0x90f2('0x31')];if(!_0x3f4b02[_0x90f2('0x2a')][_0x90f2('0x32')](_0x90f2('0x33'))){_0x5d8434['limit']=qs[_0x90f2('0x1a')](_0x3f4b02['query'][_0x90f2('0x1a')]);_0x5d8434[_0x90f2('0x1c')]=qs[_0x90f2('0x1c')](_0x3f4b02[_0x90f2('0x2a')][_0x90f2('0x1c')]);}return _0x532699[_0x90f2('0x4a')](_0x5d8434);}})['then'](function(_0x34f060){if(_0x34f060){return _0x34f060?{'count':_0x5687bc,'rows':_0x34f060}:null;}})['then'](respondWithResult(_0x288545,null))[_0x90f2('0x40')](handleError(_0x288545,null));};exports[_0x90f2('0x4b')]=function(_0x19f9f7,_0x16bf3d,_0x5a1b38){if(_0x19f9f7[_0x90f2('0x46')]['id']){delete _0x19f9f7[_0x90f2('0x46')]['id'];}return db['VtigerAccount'][_0x90f2('0x47')]({'where':{'id':_0x19f9f7[_0x90f2('0x42')]['id']}})[_0x90f2('0x21')](handleEntityNotFound(_0x16bf3d,null))[_0x90f2('0x21')](function(_0x2e5eef){if(_0x2e5eef){_0x19f9f7[_0x90f2('0x46')][_0x90f2('0x4c')]=_0x2e5eef['id'];_0x19f9f7[_0x90f2('0x46')][_0x90f2('0x4d')]=integrations[_0x90f2('0x4e')](_0x19f9f7[_0x90f2('0x46')][_0x90f2('0x4f')],_0x19f9f7[_0x90f2('0x46')][_0x90f2('0x3a')]);_0x19f9f7['body'][_0x90f2('0x50')]=integrations['getDescriptions'](_0x19f9f7[_0x90f2('0x46')][_0x90f2('0x4f')],_0x19f9f7[_0x90f2('0x46')]['type']);return db[_0x90f2('0x48')][_0x90f2('0x45')](_0x19f9f7[_0x90f2('0x46')],{'include':[{'model':db[_0x90f2('0x51')],'as':_0x90f2('0x4d')},{'model':db[_0x90f2('0x51')],'as':_0x90f2('0x50')}]});}return null;})[_0x90f2('0x21')](respondWithResult(_0x16bf3d,null))[_0x90f2('0x40')](handleError(_0x16bf3d,null));};var md5=require('md5');exports[_0x90f2('0x52')]=function(_0x47ebca,_0x3eb93c,_0x521f33){var _0x3fc74f=null;var _0x51e4fe=null;var _0xe18b6c=null;var _0x43dbe8=null;var _0x2cd320='';return db['VtigerAccount'][_0x90f2('0x47')]({'where':{'id':_0x47ebca[_0x90f2('0x42')]['id']},'attributes':['id',_0x90f2('0x25'),_0x90f2('0x53'),_0x90f2('0x54'),_0x90f2('0x55'),_0x90f2('0x56'),_0x90f2('0x57'),_0x90f2('0x58')]})[_0x90f2('0x21')](handleEntityNotFound(_0x3eb93c,null))['then'](function(_0x175d5b){if(_0x175d5b){_0x3fc74f=_0x175d5b[_0x90f2('0x53')];_0x51e4fe=_0x175d5b[_0x90f2('0x58')];_0xe18b6c=_0x175d5b[_0x90f2('0x55')];_0x2cd320=_0x175d5b[_0x90f2('0x56')];var _0x32666f=_0x2cd320['slice'](-0x1);if(_0x32666f==='/'){_0x2cd320=_0x2cd320[_0x90f2('0x59')](0x0,_0x2cd320[_0x90f2('0x5a')](_0x32666f));}_0x43dbe8=util['format'](_0x90f2('0x5b'),_0x2cd320);var _0x1c201d={'method':_0x90f2('0x5c'),'uri':_0x43dbe8,'qs':{'operation':_0x90f2('0x5d'),'username':_0x175d5b[_0x90f2('0x53')]},'json':!![]};return rp(_0x1c201d);}})[_0x90f2('0x21')](function(_0x2a1929){if(_0x2a1929[_0x90f2('0x5e')]){var _0x38d3ae={'method':_0x90f2('0x5f'),'uri':_0x43dbe8,'form':{'operation':'login','username':_0x3fc74f,'accessKey':md5(_0x2a1929[_0x90f2('0x60')][_0x90f2('0x61')]+_0x51e4fe)},'json':!![]};return rp(_0x38d3ae);}})['then'](function(_0x219d73){if(_0x219d73['success']){var _0x528749={'method':_0x90f2('0x5c'),'uri':_0x43dbe8,'qs':{'operation':_0x90f2('0x62'),'username':_0x3fc74f,'sessionName':_0x219d73[_0x90f2('0x60')][_0x90f2('0x63')],'elementType':_0xe18b6c},'json':!![]};return rp(_0x528749);}})[_0x90f2('0x21')](function(_0x161687){if(_0x161687[_0x90f2('0x5e')]){var _0x1a8024=[_0x90f2('0x64'),'reference',_0x90f2('0x65')];_[_0x90f2('0x66')](_0x161687[_0x90f2('0x60')][_0x90f2('0x2f')],function(_0x2b816d){return _0x1a8024[_0x90f2('0x67')](_0x2b816d[_0x90f2('0x3a')]['name']);});_[_0x90f2('0x66')](_0x161687['result']['fields'],function(_0x32ca5b){return _0x32ca5b[_0x90f2('0x68')]===_0x90f2('0x69');});return{'count':_0x161687['result']['fields'][_0x90f2('0x31')],'rows':_[_0x90f2('0x39')](_0x161687[_0x90f2('0x60')]['fields'],function(_0x5afd0b){return{'id':_0x5afd0b[_0x90f2('0x25')],'name':_0x5afd0b['label'],'custom':_[_0x90f2('0x6a')](_0x5afd0b[_0x90f2('0x25')],_0x90f2('0x6b'))?!![]:![],'options':_0x5afd0b[_0x90f2('0x3a')][_0x90f2('0x25')]==='picklist'&&_0x5afd0b[_0x90f2('0x3a')][_0x90f2('0x6c')]['length']>0x0?_['map'](_0x5afd0b[_0x90f2('0x3a')][_0x90f2('0x6c')],function(_0x526a6d){return{'name':_0x526a6d['label'],'value':_0x526a6d['value']};}):[]};})};}})['then'](respondWithResult(_0x3eb93c,null))[_0x90f2('0x40')](function(_0x340edc){console['log'](_0x90f2('0x6d')+_0x340edc);var _0x12d846=_0x47ebca[_0x90f2('0x2a')][_0x90f2('0x6e')]?0x1f4:_0x340edc[_0x90f2('0x6f')]||0x1f4;logger['error'](_0x90f2('0x70'),_0x90f2('0x52'),_0x12d846,JSON[_0x90f2('0x71')](_0x340edc));delete _0x340edc['name'];if(_0x12d846===0x191){_0x12d846=0x190;}_0x3eb93c['status'](_0x12d846)[_0x90f2('0x72')](_0x47ebca[_0x90f2('0x2a')]['test']?{'message':_0x90f2('0x73'),'statusCode':_0x340edc[_0x90f2('0x6f')]}:_0x340edc);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 520084f..1c209ec 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 _0xfc9d=['VtigerAccount','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x86379c,_0x4e179b){var _0x1126f2=function(_0x544b61){while(--_0x544b61){_0x86379c['push'](_0x86379c['shift']());}};_0x1126f2(++_0x4e179b);}(_0xfc9d,0x191));var _0xdfc9=function(_0x5bf0f8,_0x5d316b){_0x5bf0f8=_0x5bf0f8-0x0;var _0x236a0c=_0xfc9d[_0x5bf0f8];return _0x236a0c;};'use strict';var _=require('lodash');var util=require(_0xdfc9('0x0'));var logger=require(_0xdfc9('0x1'))('api');var moment=require(_0xdfc9('0x2'));var BPromise=require('bluebird');var rp=require(_0xdfc9('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdfc9('0x4'));var config=require(_0xdfc9('0x5'));var attributes=require(_0xdfc9('0x6'));var integrations=require(_0xdfc9('0x7'));module[_0xdfc9('0x8')]=function(_0x4499b0,_0x66becd){return _0x4499b0['define'](_0xdfc9('0x9'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8120=['./intVtigerAccount.attributes','exports','define','VtigerAccount','lodash','util','../../config/logger','moment','bluebird'];(function(_0x141423,_0x23d999){var _0xfcc89e=function(_0xef114e){while(--_0xef114e){_0x141423['push'](_0x141423['shift']());}};_0xfcc89e(++_0x23d999);}(_0x8120,0xe5));var _0x0812=function(_0x17f759,_0x1301ad){_0x17f759=_0x17f759-0x0;var _0x952a00=_0x8120[_0x17f759];return _0x952a00;};'use strict';var _=require(_0x0812('0x0'));var util=require(_0x0812('0x1'));var logger=require(_0x0812('0x2'))('api');var moment=require(_0x0812('0x3'));var BPromise=require(_0x0812('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0812('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x0812('0x6')]=function(_0x393648,_0x2a7714){return _0x393648[_0x0812('0x7')](_0x0812('0x8'),attributes,{'tableName':'int_vtiger_accounts','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 268ca55..2be7e58 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 _0x7072=['model','then','ShowVtigerAccount','VtigerAccount','find','map','util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVtigerAccount','options','raw','where','attributes','limit','include'];(function(_0x2e04ef,_0x31a596){var _0x5722b0=function(_0x386fbd){while(--_0x386fbd){_0x2e04ef['push'](_0x2e04ef['shift']());}};_0x5722b0(++_0x31a596);}(_0x7072,0x138));var _0x2707=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x7072[_0x231e16];return _0x570a7c;};'use strict';var _=require('lodash');var util=require(_0x2707('0x0'));var moment=require(_0x2707('0x1'));var BPromise=require(_0x2707('0x2'));var rs=require(_0x2707('0x3'));var fs=require('fs');var Redis=require(_0x2707('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2707('0x5'))('rpc');var config=require(_0x2707('0x6'));var jayson=require(_0x2707('0x7'));var client=jayson[_0x2707('0x8')][_0x2707('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2fd8ff,_0x128205,_0x21b0a0){return new BPromise(function(_0x745cfd,_0x4062b6){return client[_0x2707('0xa')](_0x2fd8ff,_0x21b0a0)['then'](function(_0x597ff9){logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));logger[_0x2707('0xe')](_0x2707('0xf'),_0x128205,_0x2707('0xd'),JSON[_0x2707('0x10')](_0x597ff9));if(_0x597ff9[_0x2707('0x11')]){if(_0x597ff9[_0x2707('0x11')][_0x2707('0x12')]===0x1f4){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')]['message']);return _0x4062b6(_0x597ff9[_0x2707('0x11')]['message']);}logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x597ff9[_0x2707('0x11')][_0x2707('0x13')]);return _0x745cfd(_0x597ff9[_0x2707('0x11')]['message']);}else{logger[_0x2707('0xb')](_0x2707('0xc'),_0x128205,_0x2707('0xd'));_0x745cfd(_0x597ff9['result'][_0x2707('0x13')]);}})[_0x2707('0x14')](function(_0x1a979e){logger[_0x2707('0x11')](_0x2707('0xc'),_0x128205,_0x1a979e);_0x4062b6(_0x1a979e);});});}exports[_0x2707('0x15')]=function(_0x4a8b7f){var _0x119ac4=this;return new Promise(function(_0x449a61,_0x4009f3){return db['VtigerAccount']['findAll']({'raw':_0x4a8b7f['options']?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x17')]===undefined?!![]:![]:!![],'where':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x18')]||null:null,'attributes':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x19')]||null:null,'limit':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1a')]||null:null,'include':_0x4a8b7f[_0x2707('0x16')]?_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1b')]?_['map'](_0x4a8b7f[_0x2707('0x16')][_0x2707('0x1b')],function(_0x46259e){return{'model':db[_0x46259e[_0x2707('0x1c')]],'as':_0x46259e['as'],'attributes':_0x46259e[_0x2707('0x19')],'include':_0x46259e[_0x2707('0x1b')]?_['map'](_0x46259e[_0x2707('0x1b')],function(_0x3f6976){return{'model':db[_0x3f6976[_0x2707('0x1c')]],'as':_0x3f6976['as'],'attributes':_0x3f6976[_0x2707('0x19')],'include':_0x3f6976[_0x2707('0x1b')]?_['map'](_0x3f6976[_0x2707('0x1b')],function(_0x4ca05d){return{'model':db[_0x4ca05d[_0x2707('0x1c')]],'as':_0x4ca05d['as'],'attributes':_0x4ca05d[_0x2707('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2707('0x1d')](function(_0x57da26){logger[_0x2707('0xb')](_0x2707('0x15'),_0x4a8b7f);logger[_0x2707('0xe')]('GetVtigerAccount',_0x4a8b7f,JSON[_0x2707('0x10')](_0x57da26));_0x449a61(_0x57da26);})[_0x2707('0x14')](function(_0x4a99ce){logger[_0x2707('0x11')]('GetVtigerAccount',_0x4a99ce['message'],_0x4a8b7f);_0x4009f3(_0x119ac4[_0x2707('0x11')](0x1f4,_0x4a99ce['message']));});});};exports[_0x2707('0x1e')]=function(_0x3f153d){var _0x417a97=this;return new Promise(function(_0x36b2e9,_0x48832b){return db[_0x2707('0x1f')][_0x2707('0x20')]({'raw':_0x3f153d[_0x2707('0x16')]?_0x3f153d[_0x2707('0x16')][_0x2707('0x17')]===undefined?!![]:![]:!![],'where':_0x3f153d[_0x2707('0x16')]?_0x3f153d[_0x2707('0x16')][_0x2707('0x18')]||null:null,'attributes':_0x3f153d[_0x2707('0x16')]?_0x3f153d['options'][_0x2707('0x19')]||null:null,'include':_0x3f153d[_0x2707('0x16')]?_0x3f153d['options']['include']?_['map'](_0x3f153d['options']['include'],function(_0x137e04){return{'model':db[_0x137e04['model']],'as':_0x137e04['as'],'attributes':_0x137e04['attributes'],'include':_0x137e04[_0x2707('0x1b')]?_[_0x2707('0x21')](_0x137e04['include'],function(_0x473954){return{'model':db[_0x473954[_0x2707('0x1c')]],'as':_0x473954['as'],'attributes':_0x473954['attributes'],'include':_0x473954['include']?_[_0x2707('0x21')](_0x473954[_0x2707('0x1b')],function(_0x521edb){return{'model':db[_0x521edb['model']],'as':_0x521edb['as'],'attributes':_0x521edb[_0x2707('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2707('0x1d')](function(_0x5a18b0){logger[_0x2707('0xb')](_0x2707('0x1e'),_0x3f153d);logger[_0x2707('0xe')](_0x2707('0x1e'),_0x3f153d,JSON[_0x2707('0x10')](_0x5a18b0));_0x36b2e9(_0x5a18b0);})[_0x2707('0x14')](function(_0x5bd2e5){logger[_0x2707('0x11')](_0x2707('0x1e'),_0x5bd2e5[_0x2707('0x13')],_0x3f153d);_0x48832b(_0x417a97[_0x2707('0x11')](0x1f4,_0x5bd2e5[_0x2707('0x13')]));});});}; \ No newline at end of file +var _0xf290=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetVtigerAccount','findAll','options','raw','where','map','include','model','attributes','stringify','VtigerAccount','ShowVtigerAccount','util','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf290,0xde));var _0x0f29=function(_0x5a2d3f,_0x27b04e){_0x5a2d3f=_0x5a2d3f-0x0;var _0x5c65d8=_0xf290[_0x5a2d3f];return _0x5c65d8;};'use strict';var _=require('lodash');var util=require(_0x0f29('0x0'));var moment=require('moment');var BPromise=require(_0x0f29('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0f29('0x2'));var db=require(_0x0f29('0x3'))['db'];var utils=require(_0x0f29('0x4'));var logger=require(_0x0f29('0x5'))(_0x0f29('0x6'));var config=require('../../config/environment');var jayson=require(_0x0f29('0x7'));var client=jayson['client'][_0x0f29('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1c45ec,_0x355e21,_0xaa2675){return new BPromise(function(_0xc78ca2,_0x45350b){return client[_0x0f29('0x9')](_0x1c45ec,_0xaa2675)[_0x0f29('0xa')](function(_0x376de4){logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,_0x0f29('0xd'));logger[_0x0f29('0xe')](_0x0f29('0xf'),_0x355e21,_0x0f29('0xd'),JSON['stringify'](_0x376de4));if(_0x376de4[_0x0f29('0x10')]){if(_0x376de4['error'][_0x0f29('0x11')]===0x1f4){logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0x45350b(_0x376de4[_0x0f29('0x10')]['message']);}logger[_0x0f29('0x10')](_0x0f29('0xc'),_0x355e21,_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);return _0xc78ca2(_0x376de4[_0x0f29('0x10')][_0x0f29('0x12')]);}else{logger[_0x0f29('0xb')](_0x0f29('0xc'),_0x355e21,'request\x20sent');_0xc78ca2(_0x376de4['result'][_0x0f29('0x12')]);}})[_0x0f29('0x13')](function(_0x38031e){logger[_0x0f29('0x10')]('VtigerAccount,\x20%s,\x20%s',_0x355e21,_0x38031e);_0x45350b(_0x38031e);});});}exports[_0x0f29('0x14')]=function(_0x5d72a5){var _0x17b994=this;return new Promise(function(_0x4ca5e8,_0x5ddc74){return db['VtigerAccount'][_0x0f29('0x15')]({'raw':_0x5d72a5[_0x0f29('0x16')]?_0x5d72a5[_0x0f29('0x16')][_0x0f29('0x17')]===undefined?!![]:![]:!![],'where':_0x5d72a5[_0x0f29('0x16')]?_0x5d72a5[_0x0f29('0x16')][_0x0f29('0x18')]||null:null,'attributes':_0x5d72a5['options']?_0x5d72a5[_0x0f29('0x16')]['attributes']||null:null,'limit':_0x5d72a5['options']?_0x5d72a5['options']['limit']||null:null,'include':_0x5d72a5[_0x0f29('0x16')]?_0x5d72a5[_0x0f29('0x16')]['include']?_[_0x0f29('0x19')](_0x5d72a5[_0x0f29('0x16')][_0x0f29('0x1a')],function(_0x3402dc){return{'model':db[_0x3402dc[_0x0f29('0x1b')]],'as':_0x3402dc['as'],'attributes':_0x3402dc['attributes'],'include':_0x3402dc[_0x0f29('0x1a')]?_['map'](_0x3402dc[_0x0f29('0x1a')],function(_0x26f46f){return{'model':db[_0x26f46f[_0x0f29('0x1b')]],'as':_0x26f46f['as'],'attributes':_0x26f46f[_0x0f29('0x1c')],'include':_0x26f46f['include']?_[_0x0f29('0x19')](_0x26f46f['include'],function(_0x58b201){return{'model':db[_0x58b201[_0x0f29('0x1b')]],'as':_0x58b201['as'],'attributes':_0x58b201['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x57dcc7){logger['info'](_0x0f29('0x14'),_0x5d72a5);logger[_0x0f29('0xe')]('GetVtigerAccount',_0x5d72a5,JSON[_0x0f29('0x1d')](_0x57dcc7));_0x4ca5e8(_0x57dcc7);})[_0x0f29('0x13')](function(_0x274c9d){logger['error']('GetVtigerAccount',_0x274c9d[_0x0f29('0x12')],_0x5d72a5);_0x5ddc74(_0x17b994['error'](0x1f4,_0x274c9d[_0x0f29('0x12')]));});});};exports['ShowVtigerAccount']=function(_0x526364){var _0x7b10f=this;return new Promise(function(_0x409b19,_0xf59431){return db[_0x0f29('0x1e')]['find']({'raw':_0x526364['options']?_0x526364[_0x0f29('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x526364['options']?_0x526364[_0x0f29('0x16')]['where']||null:null,'attributes':_0x526364[_0x0f29('0x16')]?_0x526364['options']['attributes']||null:null,'include':_0x526364[_0x0f29('0x16')]?_0x526364[_0x0f29('0x16')][_0x0f29('0x1a')]?_[_0x0f29('0x19')](_0x526364[_0x0f29('0x16')]['include'],function(_0x426a3e){return{'model':db[_0x426a3e['model']],'as':_0x426a3e['as'],'attributes':_0x426a3e[_0x0f29('0x1c')],'include':_0x426a3e[_0x0f29('0x1a')]?_[_0x0f29('0x19')](_0x426a3e[_0x0f29('0x1a')],function(_0x4852a5){return{'model':db[_0x4852a5[_0x0f29('0x1b')]],'as':_0x4852a5['as'],'attributes':_0x4852a5[_0x0f29('0x1c')],'include':_0x4852a5['include']?_[_0x0f29('0x19')](_0x4852a5[_0x0f29('0x1a')],function(_0x5e40ac){return{'model':db[_0x5e40ac['model']],'as':_0x5e40ac['as'],'attributes':_0x5e40ac[_0x0f29('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0f29('0xa')](function(_0x3691d4){logger[_0x0f29('0xb')](_0x0f29('0x1f'),_0x526364);logger[_0x0f29('0xe')]('ShowVtigerAccount',_0x526364,JSON[_0x0f29('0x1d')](_0x3691d4));_0x409b19(_0x3691d4);})['catch'](function(_0x331dc7){logger['error'](_0x0f29('0x1f'),_0x331dc7[_0x0f29('0x12')],_0x526364);_0xf59431(_0x7b10f[_0x0f29('0x10')](0x1f4,_0x331dc7['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index f03bbc6..3784920 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 _0x49c1=['fs-extra','../../components/auth/service','./intVtigerConfiguration.controller','get','isAuthenticated','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x444a08,_0x55bbf7){var _0x3440ae=function(_0x49c24e){while(--_0x49c24e){_0x444a08['push'](_0x444a08['shift']());}};_0x3440ae(++_0x55bbf7);}(_0x49c1,0xff));var _0x149c=function(_0x1753db,_0x38ec8c){_0x1753db=_0x1753db-0x0;var _0xd90cfb=_0x49c1[_0x1753db];return _0xd90cfb;};'use strict';var multer=require(_0x149c('0x0'));var util=require(_0x149c('0x1'));var path=require(_0x149c('0x2'));var timeout=require('connect-timeout');var express=require(_0x149c('0x3'));var router=express[_0x149c('0x4')]();var fs_extra=require(_0x149c('0x5'));var auth=require(_0x149c('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x149c('0x7'));router[_0x149c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/:id',auth[_0x149c('0x9')](),controller['show']);router[_0x149c('0x8')](_0x149c('0xa'),auth[_0x149c('0x9')](),controller[_0x149c('0xb')]);router['get'](_0x149c('0xc'),auth[_0x149c('0x9')](),controller['getSubjects']);router['get'](_0x149c('0xd'),auth[_0x149c('0x9')](),controller[_0x149c('0xe')]);router[_0x149c('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x149c('0x10')]('/:id',auth[_0x149c('0x9')](),controller[_0x149c('0x11')]);router[_0x149c('0x12')]('/:id',auth[_0x149c('0x9')](),controller['destroy']);module[_0x149c('0x13')]=router; \ No newline at end of file +var _0xb4ab=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','show'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb4ab,0x1e9));var _0xbb4a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb4ab[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xbb4a('0x0'));var util=require(_0xbb4a('0x1'));var path=require(_0xbb4a('0x2'));var timeout=require(_0xbb4a('0x3'));var express=require(_0xbb4a('0x4'));var router=express[_0xbb4a('0x5')]();var fs_extra=require(_0xbb4a('0x6'));var auth=require(_0xbb4a('0x7'));var interaction=require(_0xbb4a('0x8'));var config=require(_0xbb4a('0x9'));var controller=require(_0xbb4a('0xa'));router[_0xbb4a('0xb')]('/',auth[_0xbb4a('0xc')](),controller[_0xbb4a('0xd')]);router['get']('/:id',auth[_0xbb4a('0xc')](),controller[_0xbb4a('0xe')]);router[_0xbb4a('0xb')](_0xbb4a('0xf'),auth['isAuthenticated'](),controller[_0xbb4a('0x10')]);router[_0xbb4a('0xb')](_0xbb4a('0x11'),auth['isAuthenticated'](),controller[_0xbb4a('0x12')]);router[_0xbb4a('0xb')](_0xbb4a('0x13'),auth[_0xbb4a('0xc')](),controller[_0xbb4a('0x14')]);router[_0xbb4a('0x15')]('/',auth[_0xbb4a('0xc')](),controller[_0xbb4a('0x16')]);router[_0xbb4a('0x17')](_0xbb4a('0x18'),auth['isAuthenticated'](),controller['update']);router[_0xbb4a('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xbb4a('0x1a')]);module[_0xbb4a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 9505f74..66cac29 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 _0xa412=['sequelize','STRING'];(function(_0x857282,_0x396f1a){var _0x412164=function(_0x1a31c1){while(--_0x1a31c1){_0x857282['push'](_0x857282['shift']());}};_0x412164(++_0x396f1a);}(_0xa412,0x1c2));var _0x2a41=function(_0x368772,_0x59ae74){_0x368772=_0x368772-0x0;var _0x1acd0d=_0xa412[_0x368772];return _0x1acd0d;};'use strict';var Sequelize=require(_0x2a41('0x0'));module['exports']={'name':{'type':Sequelize[_0x2a41('0x1')]},'description':{'type':Sequelize[_0x2a41('0x1')]}}; \ No newline at end of file +var _0x0a5b=['sequelize','STRING'];(function(_0x545bf3,_0x518ed5){var _0x41b0f8=function(_0x412fa7){while(--_0x412fa7){_0x545bf3['push'](_0x545bf3['shift']());}};_0x41b0f8(++_0x518ed5);}(_0x0a5b,0x1ce));var _0xb0a5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0a5b[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xb0a5('0x0'));module['exports']={'name':{'type':Sequelize[_0xb0a5('0x1')]},'description':{'type':Sequelize[_0xb0a5('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index a5513eb..9c9f0ab 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 _0xa1aa=['json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','end','error','name','index','VtigerConfiguration','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','length','find','create','update','getFields','findOne','VtigerField','hasOwnProperty','nolimit','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa1aa,0x81));var _0xaa1a=function(_0x419722,_0x43ced3){_0x419722=_0x419722-0x0;var _0x45fbee=_0xa1aa[_0x419722];return _0x45fbee;};'use strict';var emlformat=require(_0xaa1a('0x0'));var rimraf=require(_0xaa1a('0x1'));var zipdir=require(_0xaa1a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa1a('0x3'));var moment=require(_0xaa1a('0x4'));var BPromise=require(_0xaa1a('0x5'));var Mustache=require(_0xaa1a('0x6'));var util=require(_0xaa1a('0x7'));var path=require('path');var sox=require(_0xaa1a('0x8'));var csv=require(_0xaa1a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xaa1a('0xa'));var _=require(_0xaa1a('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xaa1a('0xc'));var deskjs=require(_0xaa1a('0xd'));var toCsv=require(_0xaa1a('0x9'));var querystring=require('querystring');var Papa=require(_0xaa1a('0xe'));var Redis=require(_0xaa1a('0xf'));var authService=require(_0xaa1a('0x10'));var qs=require(_0xaa1a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa1a('0x12'));var logger=require(_0xaa1a('0x13'))(_0xaa1a('0x14'));var utils=require(_0xaa1a('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaa1a('0x16'))['db'];function respondWithStatusCode(_0x11c5cf,_0x58a39e){_0x58a39e=_0x58a39e||0xcc;return function(_0x5e978e){if(_0x5e978e){return _0x11c5cf[_0xaa1a('0x17')](_0x58a39e);}return _0x11c5cf['status'](_0x58a39e)['end']();};}function respondWithResult(_0x4c80ef,_0x535d7d){_0x535d7d=_0x535d7d||0xc8;return function(_0x4c152c){if(_0x4c152c){return _0x4c80ef[_0xaa1a('0x18')](_0x535d7d)[_0xaa1a('0x19')](_0x4c152c);}};}function respondWithFilteredResult(_0x4d619c,_0x49b190){return function(_0x615231){if(_0x615231){var _0x47e263=typeof _0x49b190[_0xaa1a('0x1a')]===_0xaa1a('0x1b')&&typeof _0x49b190[_0xaa1a('0x1c')]===_0xaa1a('0x1b');var _0x166a23=_0x615231[_0xaa1a('0x1d')];var _0x5e9e97=_0x47e263?0x0:_0x49b190[_0xaa1a('0x1a')];var _0x18571d=_0x47e263?_0x615231[_0xaa1a('0x1d')]:_0x49b190[_0xaa1a('0x1a')]+_0x49b190[_0xaa1a('0x1c')];var _0x2b165c;if(_0x18571d>=_0x166a23){_0x18571d=_0x166a23;_0x2b165c=0xc8;}else{_0x2b165c=0xce;}_0x4d619c[_0xaa1a('0x18')](_0x2b165c);return _0x4d619c['set'](_0xaa1a('0x1e'),_0x5e9e97+'-'+_0x18571d+'/'+_0x166a23)[_0xaa1a('0x19')](_0x615231);}return null;};}function patchUpdates(_0x5b0f2f){return function(_0x43c9ba){try{jsonpatch[_0xaa1a('0x1f')](_0x43c9ba,_0x5b0f2f,!![]);}catch(_0x97f631){return BPromise[_0xaa1a('0x20')](_0x97f631);}return _0x43c9ba['save']();};}function saveUpdates(_0x218155,_0x475bdb){return function(_0x259669){if(_0x259669){return _0x259669['update'](_0x218155)[_0xaa1a('0x21')](function(_0x4a75dd){return _0x4a75dd;});}return null;};}function removeEntity(_0x1cf05b,_0x52763e){return function(_0x78c1fa){if(_0x78c1fa){return _0x78c1fa[_0xaa1a('0x22')]()['then'](function(){_0x1cf05b[_0xaa1a('0x18')](0xcc)[_0xaa1a('0x23')]();});}};}function handleEntityNotFound(_0x22cffe,_0x1ee88f){return function(_0x3b931e){if(!_0x3b931e){_0x22cffe[_0xaa1a('0x17')](0x194);}return _0x3b931e;};}function handleError(_0x5aacec,_0x4b99c1){_0x4b99c1=_0x4b99c1||0x1f4;return function(_0x5abcd6){logger[_0xaa1a('0x24')](_0x5abcd6['stack']);if(_0x5abcd6[_0xaa1a('0x25')]){delete _0x5abcd6[_0xaa1a('0x25')];}_0x5aacec[_0xaa1a('0x18')](_0x4b99c1)['send'](_0x5abcd6);};}exports[_0xaa1a('0x26')]=function(_0x470fcf,_0x39dd97){var _0x591a37={},_0x40d85d={},_0xe959f9={'count':0x0,'rows':[]};var _0x47cc9f=_['map'](db[_0xaa1a('0x27')][_0xaa1a('0x28')],function(_0x583f8f){return{'name':_0x583f8f[_0xaa1a('0x29')],'type':_0x583f8f[_0xaa1a('0x2a')][_0xaa1a('0x2b')]};});_0x40d85d[_0xaa1a('0x2c')]=_[_0xaa1a('0x2d')](_0x47cc9f,'name');_0x40d85d[_0xaa1a('0x2e')]=_[_0xaa1a('0x2f')](_0x470fcf[_0xaa1a('0x2e')]);_0x40d85d['filters']=_[_0xaa1a('0x30')](_0x40d85d[_0xaa1a('0x2c')],_0x40d85d[_0xaa1a('0x2e')]);_0x591a37[_0xaa1a('0x31')]=_[_0xaa1a('0x30')](_0x40d85d[_0xaa1a('0x2c')],qs[_0xaa1a('0x32')](_0x470fcf[_0xaa1a('0x2e')]['fields']));_0x591a37[_0xaa1a('0x31')]=_0x591a37[_0xaa1a('0x31')]['length']?_0x591a37[_0xaa1a('0x31')]:_0x40d85d[_0xaa1a('0x2c')];if(!_0x470fcf['query']['hasOwnProperty']('nolimit')){_0x591a37['limit']=qs[_0xaa1a('0x1c')](_0x470fcf['query'][_0xaa1a('0x1c')]);_0x591a37[_0xaa1a('0x1a')]=qs[_0xaa1a('0x1a')](_0x470fcf[_0xaa1a('0x2e')][_0xaa1a('0x1a')]);}_0x591a37[_0xaa1a('0x33')]=qs[_0xaa1a('0x34')](_0x470fcf[_0xaa1a('0x2e')][_0xaa1a('0x34')]);_0x591a37[_0xaa1a('0x35')]=qs[_0xaa1a('0x36')](_[_0xaa1a('0x37')](_0x470fcf[_0xaa1a('0x2e')],_0x40d85d[_0xaa1a('0x36')]),_0x47cc9f);if(_0x470fcf[_0xaa1a('0x2e')][_0xaa1a('0x38')]){_0x591a37[_0xaa1a('0x35')]=_[_0xaa1a('0x39')](_0x591a37[_0xaa1a('0x35')],{'$or':_[_0xaa1a('0x2d')](_0x47cc9f,function(_0x594be0){if(_0x594be0['type']!==_0xaa1a('0x3a')){var _0x1b55d5={};_0x1b55d5[_0x594be0[_0xaa1a('0x25')]]={'$like':'%'+_0x470fcf['query'][_0xaa1a('0x38')]+'%'};return _0x1b55d5;}})});}_0x591a37=_['merge']({},_0x591a37,_0x470fcf[_0xaa1a('0x3b')]);var _0x415c47={'where':_0x591a37[_0xaa1a('0x35')]};return db[_0xaa1a('0x27')][_0xaa1a('0x1d')](_0x415c47)['then'](function(_0x21ea50){_0xe959f9[_0xaa1a('0x1d')]=_0x21ea50;if(_0x470fcf[_0xaa1a('0x2e')][_0xaa1a('0x3c')]){_0x591a37[_0xaa1a('0x3d')]=[{'all':!![]}];}return db[_0xaa1a('0x27')]['findAll'](_0x591a37);})[_0xaa1a('0x21')](function(_0x247fdc){_0xe959f9[_0xaa1a('0x3e')]=_0x247fdc;return _0xe959f9;})['then'](respondWithFilteredResult(_0x39dd97,_0x591a37))[_0xaa1a('0x3f')](handleError(_0x39dd97,null));};exports[_0xaa1a('0x40')]=function(_0x565dc9,_0x156588){var _0x268948={'raw':![],'where':{'id':_0x565dc9[_0xaa1a('0x41')]['id']}},_0x56fabf={};_0x56fabf[_0xaa1a('0x2c')]=_[_0xaa1a('0x2f')](db[_0xaa1a('0x27')][_0xaa1a('0x28')]);_0x56fabf['query']=_[_0xaa1a('0x2f')](_0x565dc9['query']);_0x56fabf[_0xaa1a('0x36')]=_['intersection'](_0x56fabf[_0xaa1a('0x2c')],_0x56fabf['query']);_0x268948['attributes']=_[_0xaa1a('0x30')](_0x56fabf[_0xaa1a('0x2c')],qs[_0xaa1a('0x32')](_0x565dc9[_0xaa1a('0x2e')]['fields']));_0x268948[_0xaa1a('0x31')]=_0x268948['attributes'][_0xaa1a('0x42')]?_0x268948[_0xaa1a('0x31')]:_0x56fabf[_0xaa1a('0x2c')];if(_0x565dc9['query'][_0xaa1a('0x3c')]){_0x268948[_0xaa1a('0x3d')]=[{'all':!![]}];}_0x268948=_['merge']({},_0x268948,_0x565dc9['options']);return db[_0xaa1a('0x27')][_0xaa1a('0x43')](_0x268948)[_0xaa1a('0x21')](handleEntityNotFound(_0x156588,null))[_0xaa1a('0x21')](respondWithResult(_0x156588,null))['catch'](handleError(_0x156588,null));};exports[_0xaa1a('0x44')]=function(_0x5281a4,_0x51e8ae){return db[_0xaa1a('0x27')][_0xaa1a('0x44')](_0x5281a4['body'],{})[_0xaa1a('0x21')](respondWithResult(_0x51e8ae,0xc9))[_0xaa1a('0x3f')](handleError(_0x51e8ae,null));};exports[_0xaa1a('0x45')]=function(_0x35ac07,_0x932673){if(_0x35ac07['body']['id']){delete _0x35ac07['body']['id'];}return db[_0xaa1a('0x27')][_0xaa1a('0x43')]({'where':{'id':_0x35ac07['params']['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x932673,null))[_0xaa1a('0x21')](saveUpdates(_0x35ac07['body'],null))[_0xaa1a('0x21')](respondWithResult(_0x932673,null))['catch'](handleError(_0x932673,null));};exports[_0xaa1a('0x22')]=function(_0x4de0b3,_0x28a485){return db[_0xaa1a('0x27')][_0xaa1a('0x43')]({'where':{'id':_0x4de0b3[_0xaa1a('0x41')]['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x28a485,null))[_0xaa1a('0x21')](removeEntity(_0x28a485,null))['catch'](handleError(_0x28a485,null));};exports[_0xaa1a('0x46')]=function(_0x78a098,_0x27b132,_0x1d1084){var _0x1d0bf5={};var _0x325955={};var _0x6eeb91;var _0x3561b1;return db[_0xaa1a('0x27')][_0xaa1a('0x47')]({'where':{'id':_0x78a098[_0xaa1a('0x41')]['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x27b132,null))[_0xaa1a('0x21')](function(_0x5b936b){if(_0x5b936b){_0x6eeb91=_0x5b936b;_0x325955[_0xaa1a('0x2c')]=_['keys'](db[_0xaa1a('0x48')][_0xaa1a('0x28')]);_0x325955[_0xaa1a('0x2e')]=_[_0xaa1a('0x2f')](_0x78a098['query']);_0x325955[_0xaa1a('0x36')]=_['intersection'](_0x325955[_0xaa1a('0x2c')],_0x325955[_0xaa1a('0x2e')]);_0x1d0bf5['attributes']=_[_0xaa1a('0x30')](_0x325955[_0xaa1a('0x2c')],qs[_0xaa1a('0x32')](_0x78a098[_0xaa1a('0x2e')][_0xaa1a('0x32')]));_0x1d0bf5[_0xaa1a('0x31')]=_0x1d0bf5[_0xaa1a('0x31')][_0xaa1a('0x42')]?_0x1d0bf5[_0xaa1a('0x31')]:_0x325955['model'];_0x1d0bf5[_0xaa1a('0x33')]=qs[_0xaa1a('0x34')](_0x78a098[_0xaa1a('0x2e')][_0xaa1a('0x34')]);_0x1d0bf5[_0xaa1a('0x35')]=qs[_0xaa1a('0x36')](_[_0xaa1a('0x37')](_0x78a098[_0xaa1a('0x2e')],_0x325955[_0xaa1a('0x36')]));if(_0x78a098[_0xaa1a('0x2e')]['filter']){_0x1d0bf5['where']=_[_0xaa1a('0x39')](_0x1d0bf5['where'],{'$or':_[_0xaa1a('0x2d')](_0x1d0bf5['attributes'],function(_0x14d842){var _0x2a7f03={};_0x2a7f03[_0x14d842]={'$like':'%'+_0x78a098[_0xaa1a('0x2e')][_0xaa1a('0x38')]+'%'};return _0x2a7f03;})});}_0x1d0bf5=_['merge']({},_0x1d0bf5,_0x78a098[_0xaa1a('0x3b')]);return _0x6eeb91[_0xaa1a('0x46')](_0x1d0bf5);}})[_0xaa1a('0x21')](function(_0x17f324){if(_0x17f324){_0x3561b1=_0x17f324['length'];if(!_0x78a098[_0xaa1a('0x2e')][_0xaa1a('0x49')](_0xaa1a('0x4a'))){_0x1d0bf5[_0xaa1a('0x1c')]=qs[_0xaa1a('0x1c')](_0x78a098[_0xaa1a('0x2e')][_0xaa1a('0x1c')]);_0x1d0bf5[_0xaa1a('0x1a')]=qs[_0xaa1a('0x1a')](_0x78a098[_0xaa1a('0x2e')][_0xaa1a('0x1a')]);}return _0x6eeb91[_0xaa1a('0x46')](_0x1d0bf5);}})['then'](function(_0x2fd2c2){if(_0x2fd2c2){return _0x2fd2c2?{'count':_0x3561b1,'rows':_0x2fd2c2}:null;}})['then'](respondWithResult(_0x27b132,null))[_0xaa1a('0x3f')](handleError(_0x27b132,null));};exports[_0xaa1a('0x4b')]=function(_0x3930f2,_0x557134,_0x1534a8){var _0x12a912={};var _0xa20561={};var _0x1aa866;var _0x504f5d;return db['VtigerConfiguration'][_0xaa1a('0x47')]({'where':{'id':_0x3930f2['params']['id']}})['then'](handleEntityNotFound(_0x557134,null))[_0xaa1a('0x21')](function(_0x2bfd8e){if(_0x2bfd8e){_0x1aa866=_0x2bfd8e;_0xa20561[_0xaa1a('0x2c')]=_['keys'](db[_0xaa1a('0x48')]['rawAttributes']);_0xa20561[_0xaa1a('0x2e')]=_[_0xaa1a('0x2f')](_0x3930f2[_0xaa1a('0x2e')]);_0xa20561[_0xaa1a('0x36')]=_[_0xaa1a('0x30')](_0xa20561[_0xaa1a('0x2c')],_0xa20561[_0xaa1a('0x2e')]);_0x12a912[_0xaa1a('0x31')]=_[_0xaa1a('0x30')](_0xa20561[_0xaa1a('0x2c')],qs[_0xaa1a('0x32')](_0x3930f2[_0xaa1a('0x2e')][_0xaa1a('0x32')]));_0x12a912[_0xaa1a('0x31')]=_0x12a912['attributes']['length']?_0x12a912[_0xaa1a('0x31')]:_0xa20561['model'];_0x12a912['order']=qs[_0xaa1a('0x34')](_0x3930f2[_0xaa1a('0x2e')][_0xaa1a('0x34')]);_0x12a912[_0xaa1a('0x35')]=qs[_0xaa1a('0x36')](_[_0xaa1a('0x37')](_0x3930f2[_0xaa1a('0x2e')],_0xa20561[_0xaa1a('0x36')]));if(_0x3930f2[_0xaa1a('0x2e')][_0xaa1a('0x38')]){_0x12a912['where']=_[_0xaa1a('0x39')](_0x12a912[_0xaa1a('0x35')],{'$or':_[_0xaa1a('0x2d')](_0x12a912[_0xaa1a('0x31')],function(_0x9640bf){var _0x1d8054={};_0x1d8054[_0x9640bf]={'$like':'%'+_0x3930f2[_0xaa1a('0x2e')][_0xaa1a('0x38')]+'%'};return _0x1d8054;})});}_0x12a912=_[_0xaa1a('0x39')]({},_0x12a912,_0x3930f2['options']);return _0x1aa866[_0xaa1a('0x4b')](_0x12a912);}})[_0xaa1a('0x21')](function(_0x3a094d){if(_0x3a094d){_0x504f5d=_0x3a094d[_0xaa1a('0x42')];if(!_0x3930f2[_0xaa1a('0x2e')][_0xaa1a('0x49')](_0xaa1a('0x4a'))){_0x12a912[_0xaa1a('0x1c')]=qs['limit'](_0x3930f2[_0xaa1a('0x2e')][_0xaa1a('0x1c')]);_0x12a912[_0xaa1a('0x1a')]=qs[_0xaa1a('0x1a')](_0x3930f2[_0xaa1a('0x2e')]['offset']);}return _0x1aa866['getSubjects'](_0x12a912);}})[_0xaa1a('0x21')](function(_0x34adde){if(_0x34adde){return _0x34adde?{'count':_0x504f5d,'rows':_0x34adde}:null;}})[_0xaa1a('0x21')](respondWithResult(_0x557134,null))[_0xaa1a('0x3f')](handleError(_0x557134,null));};exports['getDescriptions']=function(_0x11f4a1,_0x11716b,_0x2e160d){var _0x31c478={};var _0x48d8c2={};var _0x5b6da4;var _0x41144a;return db[_0xaa1a('0x27')][_0xaa1a('0x47')]({'where':{'id':_0x11f4a1[_0xaa1a('0x41')]['id']}})[_0xaa1a('0x21')](handleEntityNotFound(_0x11716b,null))['then'](function(_0x5a4e05){if(_0x5a4e05){_0x5b6da4=_0x5a4e05;_0x48d8c2[_0xaa1a('0x2c')]=_[_0xaa1a('0x2f')](db[_0xaa1a('0x48')][_0xaa1a('0x28')]);_0x48d8c2[_0xaa1a('0x2e')]=_[_0xaa1a('0x2f')](_0x11f4a1[_0xaa1a('0x2e')]);_0x48d8c2[_0xaa1a('0x36')]=_[_0xaa1a('0x30')](_0x48d8c2[_0xaa1a('0x2c')],_0x48d8c2[_0xaa1a('0x2e')]);_0x31c478[_0xaa1a('0x31')]=_[_0xaa1a('0x30')](_0x48d8c2[_0xaa1a('0x2c')],qs[_0xaa1a('0x32')](_0x11f4a1[_0xaa1a('0x2e')][_0xaa1a('0x32')]));_0x31c478[_0xaa1a('0x31')]=_0x31c478[_0xaa1a('0x31')]['length']?_0x31c478[_0xaa1a('0x31')]:_0x48d8c2[_0xaa1a('0x2c')];_0x31c478[_0xaa1a('0x33')]=qs[_0xaa1a('0x34')](_0x11f4a1[_0xaa1a('0x2e')]['sort']);_0x31c478[_0xaa1a('0x35')]=qs[_0xaa1a('0x36')](_[_0xaa1a('0x37')](_0x11f4a1[_0xaa1a('0x2e')],_0x48d8c2[_0xaa1a('0x36')]));if(_0x11f4a1['query'][_0xaa1a('0x38')]){_0x31c478[_0xaa1a('0x35')]=_[_0xaa1a('0x39')](_0x31c478[_0xaa1a('0x35')],{'$or':_['map'](_0x31c478[_0xaa1a('0x31')],function(_0x2517cb){var _0x316f67={};_0x316f67[_0x2517cb]={'$like':'%'+_0x11f4a1[_0xaa1a('0x2e')]['filter']+'%'};return _0x316f67;})});}_0x31c478=_[_0xaa1a('0x39')]({},_0x31c478,_0x11f4a1['options']);return _0x5b6da4[_0xaa1a('0x4c')](_0x31c478);}})['then'](function(_0xbda37){if(_0xbda37){_0x41144a=_0xbda37[_0xaa1a('0x42')];if(!_0x11f4a1[_0xaa1a('0x2e')][_0xaa1a('0x49')](_0xaa1a('0x4a'))){_0x31c478[_0xaa1a('0x1c')]=qs[_0xaa1a('0x1c')](_0x11f4a1['query']['limit']);_0x31c478[_0xaa1a('0x1a')]=qs[_0xaa1a('0x1a')](_0x11f4a1['query'][_0xaa1a('0x1a')]);}return _0x5b6da4[_0xaa1a('0x4c')](_0x31c478);}})[_0xaa1a('0x21')](function(_0x1a8b39){if(_0x1a8b39){return _0x1a8b39?{'count':_0x41144a,'rows':_0x1a8b39}:null;}})[_0xaa1a('0x21')](respondWithResult(_0x11716b,null))[_0xaa1a('0x3f')](handleError(_0x11716b,null));}; \ No newline at end of file +var _0x4c18=['rows','catch','params','rawAttributes','fields','includeAll','find','create','body','destroy','getFields','findOne','VtigerField','order','pick','nolimit','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','error','send','map','VtigerConfiguration','fieldName','type','key','model','name','query','keys','intersection','attributes','length','hasOwnProperty','sort','where','filters','filter','VIRTUAL','merge','options','include','findAll'];(function(_0x369a98,_0x32250c){var _0x29565c=function(_0x1a6973){while(--_0x1a6973){_0x369a98['push'](_0x369a98['shift']());}};_0x29565c(++_0x32250c);}(_0x4c18,0x18e));var _0x84c1=function(_0x16deb1,_0x5cc91f){_0x16deb1=_0x16deb1-0x0;var _0x18abc0=_0x4c18[_0x16deb1];return _0x18abc0;};'use strict';var emlformat=require(_0x84c1('0x0'));var rimraf=require(_0x84c1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x84c1('0x2'));var rp=require('request-promise');var moment=require(_0x84c1('0x3'));var BPromise=require(_0x84c1('0x4'));var Mustache=require('mustache');var util=require(_0x84c1('0x5'));var path=require(_0x84c1('0x6'));var sox=require(_0x84c1('0x7'));var csv=require(_0x84c1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x84c1('0x9'));var squel=require('squel');var crypto=require(_0x84c1('0xa'));var jsforce=require(_0x84c1('0xb'));var deskjs=require(_0x84c1('0xc'));var toCsv=require(_0x84c1('0x8'));var querystring=require(_0x84c1('0xd'));var Papa=require('papaparse');var Redis=require(_0x84c1('0xe'));var authService=require(_0x84c1('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x84c1('0x10'));var logger=require(_0x84c1('0x11'))(_0x84c1('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x84c1('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x58d79b,_0x2bdb9c){_0x2bdb9c=_0x2bdb9c||0xcc;return function(_0xcf7378){if(_0xcf7378){return _0x58d79b[_0x84c1('0x14')](_0x2bdb9c);}return _0x58d79b[_0x84c1('0x15')](_0x2bdb9c)[_0x84c1('0x16')]();};}function respondWithResult(_0x1931ee,_0x5c2f0f){_0x5c2f0f=_0x5c2f0f||0xc8;return function(_0x48648){if(_0x48648){return _0x1931ee[_0x84c1('0x15')](_0x5c2f0f)[_0x84c1('0x17')](_0x48648);}};}function respondWithFilteredResult(_0x3206c0,_0x4d8d8c){return function(_0x509bc3){if(_0x509bc3){var _0x4f7ffe=typeof _0x4d8d8c[_0x84c1('0x18')]==='undefined'&&typeof _0x4d8d8c[_0x84c1('0x19')]===_0x84c1('0x1a');var _0x31ee42=_0x509bc3[_0x84c1('0x1b')];var _0x3f14c8=_0x4f7ffe?0x0:_0x4d8d8c['offset'];var _0x2f6f00=_0x4f7ffe?_0x509bc3[_0x84c1('0x1b')]:_0x4d8d8c[_0x84c1('0x18')]+_0x4d8d8c[_0x84c1('0x19')];var _0x5b6c79;if(_0x2f6f00>=_0x31ee42){_0x2f6f00=_0x31ee42;_0x5b6c79=0xc8;}else{_0x5b6c79=0xce;}_0x3206c0[_0x84c1('0x15')](_0x5b6c79);return _0x3206c0[_0x84c1('0x1c')](_0x84c1('0x1d'),_0x3f14c8+'-'+_0x2f6f00+'/'+_0x31ee42)[_0x84c1('0x17')](_0x509bc3);}return null;};}function patchUpdates(_0x58430e){return function(_0xf0602a){try{jsonpatch[_0x84c1('0x1e')](_0xf0602a,_0x58430e,!![]);}catch(_0x5ba86c){return BPromise['reject'](_0x5ba86c);}return _0xf0602a[_0x84c1('0x1f')]();};}function saveUpdates(_0x576bd7,_0x192dea){return function(_0x38df49){if(_0x38df49){return _0x38df49[_0x84c1('0x20')](_0x576bd7)['then'](function(_0x147ee8){return _0x147ee8;});}return null;};}function removeEntity(_0x186d05,_0x2163d7){return function(_0x1c836d){if(_0x1c836d){return _0x1c836d['destroy']()[_0x84c1('0x21')](function(){_0x186d05['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49d719,_0x59547b){return function(_0x3a3747){if(!_0x3a3747){_0x49d719[_0x84c1('0x14')](0x194);}return _0x3a3747;};}function handleError(_0x416417,_0x413237){_0x413237=_0x413237||0x1f4;return function(_0xac978c){logger[_0x84c1('0x22')](_0xac978c['stack']);if(_0xac978c['name']){delete _0xac978c['name'];}_0x416417[_0x84c1('0x15')](_0x413237)[_0x84c1('0x23')](_0xac978c);};}exports['index']=function(_0x2bb76c,_0x14466f){var _0x436f0c={},_0x5dca7c={},_0x1956c1={'count':0x0,'rows':[]};var _0x36739e=_[_0x84c1('0x24')](db[_0x84c1('0x25')]['rawAttributes'],function(_0x22bbc6){return{'name':_0x22bbc6[_0x84c1('0x26')],'type':_0x22bbc6[_0x84c1('0x27')][_0x84c1('0x28')]};});_0x5dca7c[_0x84c1('0x29')]=_['map'](_0x36739e,_0x84c1('0x2a'));_0x5dca7c[_0x84c1('0x2b')]=_[_0x84c1('0x2c')](_0x2bb76c[_0x84c1('0x2b')]);_0x5dca7c['filters']=_[_0x84c1('0x2d')](_0x5dca7c['model'],_0x5dca7c[_0x84c1('0x2b')]);_0x436f0c['attributes']=_['intersection'](_0x5dca7c[_0x84c1('0x29')],qs['fields'](_0x2bb76c[_0x84c1('0x2b')]['fields']));_0x436f0c[_0x84c1('0x2e')]=_0x436f0c['attributes'][_0x84c1('0x2f')]?_0x436f0c[_0x84c1('0x2e')]:_0x5dca7c[_0x84c1('0x29')];if(!_0x2bb76c[_0x84c1('0x2b')][_0x84c1('0x30')]('nolimit')){_0x436f0c[_0x84c1('0x19')]=qs[_0x84c1('0x19')](_0x2bb76c[_0x84c1('0x2b')]['limit']);_0x436f0c[_0x84c1('0x18')]=qs[_0x84c1('0x18')](_0x2bb76c['query']['offset']);}_0x436f0c['order']=qs[_0x84c1('0x31')](_0x2bb76c[_0x84c1('0x2b')][_0x84c1('0x31')]);_0x436f0c[_0x84c1('0x32')]=qs[_0x84c1('0x33')](_['pick'](_0x2bb76c[_0x84c1('0x2b')],_0x5dca7c[_0x84c1('0x33')]),_0x36739e);if(_0x2bb76c[_0x84c1('0x2b')][_0x84c1('0x34')]){_0x436f0c[_0x84c1('0x32')]=_['merge'](_0x436f0c[_0x84c1('0x32')],{'$or':_['map'](_0x36739e,function(_0x2b1c6d){if(_0x2b1c6d[_0x84c1('0x27')]!==_0x84c1('0x35')){var _0x28641f={};_0x28641f[_0x2b1c6d[_0x84c1('0x2a')]]={'$like':'%'+_0x2bb76c[_0x84c1('0x2b')][_0x84c1('0x34')]+'%'};return _0x28641f;}})});}_0x436f0c=_[_0x84c1('0x36')]({},_0x436f0c,_0x2bb76c[_0x84c1('0x37')]);var _0x5c5911={'where':_0x436f0c[_0x84c1('0x32')]};return db[_0x84c1('0x25')][_0x84c1('0x1b')](_0x5c5911)['then'](function(_0x14a8d4){_0x1956c1[_0x84c1('0x1b')]=_0x14a8d4;if(_0x2bb76c[_0x84c1('0x2b')]['includeAll']){_0x436f0c[_0x84c1('0x38')]=[{'all':!![]}];}return db[_0x84c1('0x25')][_0x84c1('0x39')](_0x436f0c);})['then'](function(_0x1280e1){_0x1956c1[_0x84c1('0x3a')]=_0x1280e1;return _0x1956c1;})[_0x84c1('0x21')](respondWithFilteredResult(_0x14466f,_0x436f0c))[_0x84c1('0x3b')](handleError(_0x14466f,null));};exports['show']=function(_0x1f1eac,_0xf3a16d){var _0x5b2b1d={'raw':![],'where':{'id':_0x1f1eac[_0x84c1('0x3c')]['id']}},_0x10c5e7={};_0x10c5e7[_0x84c1('0x29')]=_[_0x84c1('0x2c')](db[_0x84c1('0x25')][_0x84c1('0x3d')]);_0x10c5e7[_0x84c1('0x2b')]=_[_0x84c1('0x2c')](_0x1f1eac[_0x84c1('0x2b')]);_0x10c5e7['filters']=_['intersection'](_0x10c5e7['model'],_0x10c5e7[_0x84c1('0x2b')]);_0x5b2b1d['attributes']=_['intersection'](_0x10c5e7[_0x84c1('0x29')],qs[_0x84c1('0x3e')](_0x1f1eac['query']['fields']));_0x5b2b1d['attributes']=_0x5b2b1d[_0x84c1('0x2e')][_0x84c1('0x2f')]?_0x5b2b1d[_0x84c1('0x2e')]:_0x10c5e7[_0x84c1('0x29')];if(_0x1f1eac[_0x84c1('0x2b')][_0x84c1('0x3f')]){_0x5b2b1d['include']=[{'all':!![]}];}_0x5b2b1d=_[_0x84c1('0x36')]({},_0x5b2b1d,_0x1f1eac[_0x84c1('0x37')]);return db['VtigerConfiguration'][_0x84c1('0x40')](_0x5b2b1d)[_0x84c1('0x21')](handleEntityNotFound(_0xf3a16d,null))[_0x84c1('0x21')](respondWithResult(_0xf3a16d,null))[_0x84c1('0x3b')](handleError(_0xf3a16d,null));};exports[_0x84c1('0x41')]=function(_0x58b91b,_0x257a5f){return db[_0x84c1('0x25')][_0x84c1('0x41')](_0x58b91b['body'],{})[_0x84c1('0x21')](respondWithResult(_0x257a5f,0xc9))['catch'](handleError(_0x257a5f,null));};exports[_0x84c1('0x20')]=function(_0x2a8b62,_0x3187ca){if(_0x2a8b62[_0x84c1('0x42')]['id']){delete _0x2a8b62[_0x84c1('0x42')]['id'];}return db[_0x84c1('0x25')][_0x84c1('0x40')]({'where':{'id':_0x2a8b62[_0x84c1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x3187ca,null))['then'](saveUpdates(_0x2a8b62['body'],null))[_0x84c1('0x21')](respondWithResult(_0x3187ca,null))[_0x84c1('0x3b')](handleError(_0x3187ca,null));};exports[_0x84c1('0x43')]=function(_0x20f5af,_0x2e597e){return db['VtigerConfiguration'][_0x84c1('0x40')]({'where':{'id':_0x20f5af[_0x84c1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x2e597e,null))[_0x84c1('0x21')](removeEntity(_0x2e597e,null))[_0x84c1('0x3b')](handleError(_0x2e597e,null));};exports[_0x84c1('0x44')]=function(_0x5cafa1,_0x20847d,_0x171083){var _0x1d74cd={};var _0x2505ae={};var _0x2d3386;var _0x25e7ca;return db['VtigerConfiguration'][_0x84c1('0x45')]({'where':{'id':_0x5cafa1[_0x84c1('0x3c')]['id']}})['then'](handleEntityNotFound(_0x20847d,null))[_0x84c1('0x21')](function(_0x3b257b){if(_0x3b257b){_0x2d3386=_0x3b257b;_0x2505ae[_0x84c1('0x29')]=_[_0x84c1('0x2c')](db[_0x84c1('0x46')][_0x84c1('0x3d')]);_0x2505ae['query']=_['keys'](_0x5cafa1['query']);_0x2505ae['filters']=_[_0x84c1('0x2d')](_0x2505ae[_0x84c1('0x29')],_0x2505ae['query']);_0x1d74cd['attributes']=_[_0x84c1('0x2d')](_0x2505ae['model'],qs[_0x84c1('0x3e')](_0x5cafa1[_0x84c1('0x2b')]['fields']));_0x1d74cd[_0x84c1('0x2e')]=_0x1d74cd['attributes'][_0x84c1('0x2f')]?_0x1d74cd['attributes']:_0x2505ae[_0x84c1('0x29')];_0x1d74cd[_0x84c1('0x47')]=qs[_0x84c1('0x31')](_0x5cafa1['query'][_0x84c1('0x31')]);_0x1d74cd['where']=qs['filters'](_[_0x84c1('0x48')](_0x5cafa1[_0x84c1('0x2b')],_0x2505ae[_0x84c1('0x33')]));if(_0x5cafa1[_0x84c1('0x2b')][_0x84c1('0x34')]){_0x1d74cd[_0x84c1('0x32')]=_[_0x84c1('0x36')](_0x1d74cd[_0x84c1('0x32')],{'$or':_[_0x84c1('0x24')](_0x1d74cd[_0x84c1('0x2e')],function(_0x55d062){var _0x5a85a2={};_0x5a85a2[_0x55d062]={'$like':'%'+_0x5cafa1[_0x84c1('0x2b')][_0x84c1('0x34')]+'%'};return _0x5a85a2;})});}_0x1d74cd=_[_0x84c1('0x36')]({},_0x1d74cd,_0x5cafa1[_0x84c1('0x37')]);return _0x2d3386[_0x84c1('0x44')](_0x1d74cd);}})[_0x84c1('0x21')](function(_0x29b202){if(_0x29b202){_0x25e7ca=_0x29b202[_0x84c1('0x2f')];if(!_0x5cafa1[_0x84c1('0x2b')][_0x84c1('0x30')](_0x84c1('0x49'))){_0x1d74cd[_0x84c1('0x19')]=qs[_0x84c1('0x19')](_0x5cafa1[_0x84c1('0x2b')][_0x84c1('0x19')]);_0x1d74cd[_0x84c1('0x18')]=qs[_0x84c1('0x18')](_0x5cafa1['query']['offset']);}return _0x2d3386[_0x84c1('0x44')](_0x1d74cd);}})[_0x84c1('0x21')](function(_0x5a9fd8){if(_0x5a9fd8){return _0x5a9fd8?{'count':_0x25e7ca,'rows':_0x5a9fd8}:null;}})[_0x84c1('0x21')](respondWithResult(_0x20847d,null))[_0x84c1('0x3b')](handleError(_0x20847d,null));};exports[_0x84c1('0x4a')]=function(_0x40e5fb,_0x169624,_0x14452a){var _0x710c1e={};var _0x3cf563={};var _0x284ecf;var _0x30613f;return db[_0x84c1('0x25')][_0x84c1('0x45')]({'where':{'id':_0x40e5fb['params']['id']}})['then'](handleEntityNotFound(_0x169624,null))[_0x84c1('0x21')](function(_0x35361e){if(_0x35361e){_0x284ecf=_0x35361e;_0x3cf563[_0x84c1('0x29')]=_[_0x84c1('0x2c')](db[_0x84c1('0x46')]['rawAttributes']);_0x3cf563['query']=_[_0x84c1('0x2c')](_0x40e5fb['query']);_0x3cf563[_0x84c1('0x33')]=_[_0x84c1('0x2d')](_0x3cf563['model'],_0x3cf563['query']);_0x710c1e['attributes']=_[_0x84c1('0x2d')](_0x3cf563['model'],qs[_0x84c1('0x3e')](_0x40e5fb[_0x84c1('0x2b')][_0x84c1('0x3e')]));_0x710c1e['attributes']=_0x710c1e[_0x84c1('0x2e')][_0x84c1('0x2f')]?_0x710c1e[_0x84c1('0x2e')]:_0x3cf563[_0x84c1('0x29')];_0x710c1e[_0x84c1('0x47')]=qs[_0x84c1('0x31')](_0x40e5fb[_0x84c1('0x2b')]['sort']);_0x710c1e['where']=qs['filters'](_[_0x84c1('0x48')](_0x40e5fb[_0x84c1('0x2b')],_0x3cf563['filters']));if(_0x40e5fb[_0x84c1('0x2b')][_0x84c1('0x34')]){_0x710c1e[_0x84c1('0x32')]=_[_0x84c1('0x36')](_0x710c1e[_0x84c1('0x32')],{'$or':_[_0x84c1('0x24')](_0x710c1e[_0x84c1('0x2e')],function(_0x3f3fea){var _0x2b458b={};_0x2b458b[_0x3f3fea]={'$like':'%'+_0x40e5fb[_0x84c1('0x2b')][_0x84c1('0x34')]+'%'};return _0x2b458b;})});}_0x710c1e=_[_0x84c1('0x36')]({},_0x710c1e,_0x40e5fb[_0x84c1('0x37')]);return _0x284ecf[_0x84c1('0x4a')](_0x710c1e);}})['then'](function(_0x175b29){if(_0x175b29){_0x30613f=_0x175b29[_0x84c1('0x2f')];if(!_0x40e5fb['query']['hasOwnProperty']('nolimit')){_0x710c1e[_0x84c1('0x19')]=qs[_0x84c1('0x19')](_0x40e5fb['query']['limit']);_0x710c1e['offset']=qs[_0x84c1('0x18')](_0x40e5fb[_0x84c1('0x2b')][_0x84c1('0x18')]);}return _0x284ecf[_0x84c1('0x4a')](_0x710c1e);}})[_0x84c1('0x21')](function(_0x3721da){if(_0x3721da){return _0x3721da?{'count':_0x30613f,'rows':_0x3721da}:null;}})['then'](respondWithResult(_0x169624,null))[_0x84c1('0x3b')](handleError(_0x169624,null));};exports[_0x84c1('0x4b')]=function(_0x777fad,_0x52c0ef,_0x1890ab){var _0x311367={};var _0x50a88f={};var _0x1cdc95;var _0x1f7bda;return db[_0x84c1('0x25')]['findOne']({'where':{'id':_0x777fad[_0x84c1('0x3c')]['id']}})[_0x84c1('0x21')](handleEntityNotFound(_0x52c0ef,null))[_0x84c1('0x21')](function(_0x574fa5){if(_0x574fa5){_0x1cdc95=_0x574fa5;_0x50a88f[_0x84c1('0x29')]=_[_0x84c1('0x2c')](db['VtigerField']['rawAttributes']);_0x50a88f['query']=_[_0x84c1('0x2c')](_0x777fad['query']);_0x50a88f[_0x84c1('0x33')]=_[_0x84c1('0x2d')](_0x50a88f[_0x84c1('0x29')],_0x50a88f[_0x84c1('0x2b')]);_0x311367[_0x84c1('0x2e')]=_[_0x84c1('0x2d')](_0x50a88f[_0x84c1('0x29')],qs['fields'](_0x777fad['query']['fields']));_0x311367[_0x84c1('0x2e')]=_0x311367[_0x84c1('0x2e')]['length']?_0x311367[_0x84c1('0x2e')]:_0x50a88f[_0x84c1('0x29')];_0x311367[_0x84c1('0x47')]=qs[_0x84c1('0x31')](_0x777fad['query'][_0x84c1('0x31')]);_0x311367[_0x84c1('0x32')]=qs[_0x84c1('0x33')](_[_0x84c1('0x48')](_0x777fad[_0x84c1('0x2b')],_0x50a88f[_0x84c1('0x33')]));if(_0x777fad['query'][_0x84c1('0x34')]){_0x311367[_0x84c1('0x32')]=_['merge'](_0x311367[_0x84c1('0x32')],{'$or':_[_0x84c1('0x24')](_0x311367[_0x84c1('0x2e')],function(_0x52d888){var _0x24012b={};_0x24012b[_0x52d888]={'$like':'%'+_0x777fad[_0x84c1('0x2b')]['filter']+'%'};return _0x24012b;})});}_0x311367=_[_0x84c1('0x36')]({},_0x311367,_0x777fad['options']);return _0x1cdc95['getDescriptions'](_0x311367);}})[_0x84c1('0x21')](function(_0xd5ff9d){if(_0xd5ff9d){_0x1f7bda=_0xd5ff9d['length'];if(!_0x777fad[_0x84c1('0x2b')][_0x84c1('0x30')](_0x84c1('0x49'))){_0x311367[_0x84c1('0x19')]=qs['limit'](_0x777fad['query']['limit']);_0x311367[_0x84c1('0x18')]=qs[_0x84c1('0x18')](_0x777fad['query']['offset']);}return _0x1cdc95[_0x84c1('0x4b')](_0x311367);}})[_0x84c1('0x21')](function(_0x3c8e99){if(_0x3c8e99){return _0x3c8e99?{'count':_0x1f7bda,'rows':_0x3c8e99}:null;}})[_0x84c1('0x21')](respondWithResult(_0x52c0ef,null))[_0x84c1('0x3b')](handleError(_0x52c0ef,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 4586dd9..bdbf2a8 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 _0x6ae0=['bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','lodash','util','../../config/logger','moment'];(function(_0x351736,_0x33a314){var _0x4f5a31=function(_0x17f005){while(--_0x17f005){_0x351736['push'](_0x351736['shift']());}};_0x4f5a31(++_0x33a314);}(_0x6ae0,0xe6));var _0x06ae=function(_0x5b9252,_0x4bc2f8){_0x5b9252=_0x5b9252-0x0;var _0x1a4284=_0x6ae0[_0x5b9252];return _0x1a4284;};'use strict';var _=require(_0x06ae('0x0'));var util=require(_0x06ae('0x1'));var logger=require(_0x06ae('0x2'))('api');var moment=require(_0x06ae('0x3'));var BPromise=require(_0x06ae('0x4'));var rp=require(_0x06ae('0x5'));var fs=require('fs');var path=require(_0x06ae('0x6'));var rimraf=require(_0x06ae('0x7'));var config=require(_0x06ae('0x8'));var attributes=require(_0x06ae('0x9'));module[_0x06ae('0xa')]=function(_0x115610,_0x578308){return _0x115610[_0x06ae('0xb')](_0x06ae('0xc'),attributes,{'tableName':'int_vtiger_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf06c=['moment','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','lodash','util','api'];(function(_0x4a2966,_0x37c4f2){var _0x386edb=function(_0x426d08){while(--_0x426d08){_0x4a2966['push'](_0x4a2966['shift']());}};_0x386edb(++_0x37c4f2);}(_0xf06c,0x1c5));var _0xcf06=function(_0x2bb7d7,_0x2d024e){_0x2bb7d7=_0x2bb7d7-0x0;var _0x480ae3=_0xf06c[_0x2bb7d7];return _0x480ae3;};'use strict';var _=require(_0xcf06('0x0'));var util=require(_0xcf06('0x1'));var logger=require('../../config/logger')(_0xcf06('0x2'));var moment=require(_0xcf06('0x3'));var BPromise=require(_0xcf06('0x4'));var rp=require(_0xcf06('0x5'));var fs=require('fs');var path=require(_0xcf06('0x6'));var rimraf=require('rimraf');var config=require(_0xcf06('0x7'));var attributes=require(_0xcf06('0x8'));module[_0xcf06('0x9')]=function(_0x5b819d,_0x2fa02d){return _0x5b819d['define'](_0xcf06('0xa'),attributes,{'tableName':_0xcf06('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 f53568a..e899b35 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 _0x5ac3=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5ac3,0x13d));var _0x35ac=function(_0x426f98,_0x2546da){_0x426f98=_0x426f98-0x0;var _0x525500=_0x5ac3[_0x426f98];return _0x525500;};'use strict';var _=require('lodash');var util=require(_0x35ac('0x0'));var moment=require(_0x35ac('0x1'));var BPromise=require(_0x35ac('0x2'));var rs=require(_0x35ac('0x3'));var fs=require('fs');var Redis=require(_0x35ac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x35ac('0x5'));var logger=require(_0x35ac('0x6'))(_0x35ac('0x7'));var config=require(_0x35ac('0x8'));var jayson=require(_0x35ac('0x9'));var client=jayson[_0x35ac('0xa')][_0x35ac('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x185753,_0x1c28be,_0x17c5a4){return new BPromise(function(_0x37d385,_0x3a6bd0){return client['request'](_0x185753,_0x17c5a4)['then'](function(_0x1557d1){logger[_0x35ac('0xc')](_0x35ac('0xd'),_0x1c28be,_0x35ac('0xe'));logger[_0x35ac('0xf')](_0x35ac('0x10'),_0x1c28be,_0x35ac('0xe'),JSON[_0x35ac('0x11')](_0x1557d1));if(_0x1557d1[_0x35ac('0x12')]){if(_0x1557d1[_0x35ac('0x12')][_0x35ac('0x13')]===0x1f4){logger[_0x35ac('0x12')](_0x35ac('0xd'),_0x1c28be,_0x1557d1[_0x35ac('0x12')][_0x35ac('0x14')]);return _0x3a6bd0(_0x1557d1[_0x35ac('0x12')][_0x35ac('0x14')]);}logger[_0x35ac('0x12')](_0x35ac('0xd'),_0x1c28be,_0x1557d1['error']['message']);return _0x37d385(_0x1557d1[_0x35ac('0x12')][_0x35ac('0x14')]);}else{logger[_0x35ac('0xc')]('VtigerConfiguration,\x20%s,\x20%s',_0x1c28be,_0x35ac('0xe'));_0x37d385(_0x1557d1[_0x35ac('0x15')]['message']);}})[_0x35ac('0x16')](function(_0x2ef1df){logger[_0x35ac('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x1c28be,_0x2ef1df);_0x3a6bd0(_0x2ef1df);});});} \ No newline at end of file +var _0x7e67=['http','info','request\x20sent','VtigerConfiguration,\x20%s,\x20%s,\x20%s','error','code','VtigerConfiguration,\x20%s,\x20%s','result','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x17dd1d,_0x31f1b5){var _0x5e9d0c=function(_0x2a4c95){while(--_0x2a4c95){_0x17dd1d['push'](_0x17dd1d['shift']());}};_0x5e9d0c(++_0x31f1b5);}(_0x7e67,0xa4));var _0x77e6=function(_0x223e85,_0x36a0b7){_0x223e85=_0x223e85-0x0;var _0x1bacaa=_0x7e67[_0x223e85];return _0x1bacaa;};'use strict';var _=require(_0x77e6('0x0'));var util=require(_0x77e6('0x1'));var moment=require(_0x77e6('0x2'));var BPromise=require(_0x77e6('0x3'));var rs=require(_0x77e6('0x4'));var fs=require('fs');var Redis=require(_0x77e6('0x5'));var db=require(_0x77e6('0x6'))['db'];var utils=require(_0x77e6('0x7'));var logger=require(_0x77e6('0x8'))(_0x77e6('0x9'));var config=require(_0x77e6('0xa'));var jayson=require(_0x77e6('0xb'));var client=jayson['client'][_0x77e6('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4e7fb2,_0x39201b,_0x148f72){return new BPromise(function(_0x535397,_0x2a2b41){return client['request'](_0x4e7fb2,_0x148f72)['then'](function(_0x645940){logger[_0x77e6('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x39201b,_0x77e6('0xe'));logger['debug'](_0x77e6('0xf'),_0x39201b,_0x77e6('0xe'),JSON['stringify'](_0x645940));if(_0x645940[_0x77e6('0x10')]){if(_0x645940[_0x77e6('0x10')][_0x77e6('0x11')]===0x1f4){logger[_0x77e6('0x10')](_0x77e6('0x12'),_0x39201b,_0x645940[_0x77e6('0x10')]['message']);return _0x2a2b41(_0x645940['error']['message']);}logger[_0x77e6('0x10')](_0x77e6('0x12'),_0x39201b,_0x645940[_0x77e6('0x10')]['message']);return _0x535397(_0x645940[_0x77e6('0x10')]['message']);}else{logger[_0x77e6('0xd')](_0x77e6('0x12'),_0x39201b,'request\x20sent');_0x535397(_0x645940[_0x77e6('0x13')][_0x77e6('0x14')]);}})[_0x77e6('0x15')](function(_0x565372){logger[_0x77e6('0x10')](_0x77e6('0x12'),_0x39201b,_0x565372);_0x2a2b41(_0x565372);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index ad39334..f1d9ecf 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 _0x1ec6=['show','create','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerField.controller','get','isAuthenticated','index','/:id'];(function(_0x4d3230,_0x26e969){var _0x29dbc7=function(_0x30f47b){while(--_0x30f47b){_0x4d3230['push'](_0x4d3230['shift']());}};_0x29dbc7(++_0x26e969);}(_0x1ec6,0xe9));var _0x61ec=function(_0x51d585,_0x1da116){_0x51d585=_0x51d585-0x0;var _0x362f08=_0x1ec6[_0x51d585];return _0x362f08;};'use strict';var multer=require(_0x61ec('0x0'));var util=require(_0x61ec('0x1'));var path=require(_0x61ec('0x2'));var timeout=require(_0x61ec('0x3'));var express=require(_0x61ec('0x4'));var router=express[_0x61ec('0x5')]();var fs_extra=require(_0x61ec('0x6'));var auth=require(_0x61ec('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x61ec('0x8'));var controller=require(_0x61ec('0x9'));router[_0x61ec('0xa')]('/',auth[_0x61ec('0xb')](),controller[_0x61ec('0xc')]);router[_0x61ec('0xa')](_0x61ec('0xd'),auth[_0x61ec('0xb')](),controller[_0x61ec('0xe')]);router['post']('/',auth[_0x61ec('0xb')](),controller[_0x61ec('0xf')]);router[_0x61ec('0x10')](_0x61ec('0xd'),auth['isAuthenticated'](),controller[_0x61ec('0x11')]);router[_0x61ec('0x12')](_0x61ec('0xd'),auth[_0x61ec('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x567c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','update','delete','destroy','exports','multer','util','path'];(function(_0x423e4b,_0x1bb75b){var _0x626fd4=function(_0x1e731e){while(--_0x1e731e){_0x423e4b['push'](_0x423e4b['shift']());}};_0x626fd4(++_0x1bb75b);}(_0x567c,0xb1));var _0xc567=function(_0x34f331,_0xa9e329){_0x34f331=_0x34f331-0x0;var _0x240b3c=_0x567c[_0x34f331];return _0x240b3c;};'use strict';var multer=require(_0xc567('0x0'));var util=require(_0xc567('0x1'));var path=require(_0xc567('0x2'));var timeout=require(_0xc567('0x3'));var express=require(_0xc567('0x4'));var router=express[_0xc567('0x5')]();var fs_extra=require(_0xc567('0x6'));var auth=require(_0xc567('0x7'));var interaction=require(_0xc567('0x8'));var config=require(_0xc567('0x9'));var controller=require('./intVtigerField.controller');router[_0xc567('0xa')]('/',auth[_0xc567('0xb')](),controller['index']);router[_0xc567('0xa')](_0xc567('0xc'),auth[_0xc567('0xb')](),controller[_0xc567('0xd')]);router['post']('/',auth[_0xc567('0xb')](),controller['create']);router['put'](_0xc567('0xc'),auth['isAuthenticated'](),controller[_0xc567('0xe')]);router[_0xc567('0xf')](_0xc567('0xc'),auth[_0xc567('0xb')](),controller[_0xc567('0x10')]);module[_0xc567('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 4256e50..303d736 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 _0x8d1b=['keyValue','string','STRING','sequelize','ENUM','variable','customVariable'];(function(_0x24e185,_0x4563bf){var _0x3b1910=function(_0x592bd8){while(--_0x592bd8){_0x24e185['push'](_0x24e185['shift']());}};_0x3b1910(++_0x4563bf);}(_0x8d1b,0x73));var _0xb8d1=function(_0x30e0cc,_0x3dd556){_0x30e0cc=_0x30e0cc-0x0;var _0xb085d7=_0x8d1b[_0x30e0cc];return _0xb085d7;};'use strict';var Sequelize=require(_0xb8d1('0x0'));module['exports']={'type':{'type':Sequelize[_0xb8d1('0x1')]('string',_0xb8d1('0x2'),_0xb8d1('0x3'),_0xb8d1('0x4'),'picklist'),'defaultValue':_0xb8d1('0x5')},'content':{'type':Sequelize[_0xb8d1('0x6')]},'key':{'type':Sequelize[_0xb8d1('0x6')]},'keyType':{'type':Sequelize[_0xb8d1('0x1')](_0xb8d1('0x5'),_0xb8d1('0x2'),_0xb8d1('0x3'))},'keyContent':{'type':Sequelize[_0xb8d1('0x6')]},'idField':{'type':Sequelize[_0xb8d1('0x6')]},'nameField':{'type':Sequelize[_0xb8d1('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb8d1('0x6')]}}; \ No newline at end of file +var _0xbd4f=['BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING','customVariable'];(function(_0x2011d8,_0x3e5ece){var _0x2dfc8d=function(_0x457291){while(--_0x457291){_0x2011d8['push'](_0x2011d8['shift']());}};_0x2dfc8d(++_0x3e5ece);}(_0xbd4f,0x17d));var _0xfbd4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xbd4f[_0x4b055c];return _0x4b62bb;};'use strict';var Sequelize=require(_0xfbd4('0x0'));module[_0xfbd4('0x1')]={'type':{'type':Sequelize[_0xfbd4('0x2')](_0xfbd4('0x3'),_0xfbd4('0x4'),'customVariable',_0xfbd4('0x5'),_0xfbd4('0x6')),'defaultValue':_0xfbd4('0x3')},'content':{'type':Sequelize[_0xfbd4('0x7')]},'key':{'type':Sequelize[_0xfbd4('0x7')]},'keyType':{'type':Sequelize[_0xfbd4('0x2')](_0xfbd4('0x3'),'variable',_0xfbd4('0x8'))},'keyContent':{'type':Sequelize[_0xfbd4('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xfbd4('0x7')]},'customField':{'type':Sequelize[_0xfbd4('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 625e276..2bb4453 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 _0xc36f=['limit','set','Content-Range','reject','save','then','destroy','end','error','name','send','index','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','type','options','findAll','rows','catch','show','params','includeAll','find','create','body','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','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count'];(function(_0x215f2c,_0x4dbda1){var _0x193f9d=function(_0x4f3b3f){while(--_0x4f3b3f){_0x215f2c['push'](_0x215f2c['shift']());}};_0x193f9d(++_0x4dbda1);}(_0xc36f,0x15b));var _0xfc36=function(_0x35e0d0,_0x49e69e){_0x35e0d0=_0x35e0d0-0x0;var _0x2f7dd0=_0xc36f[_0x35e0d0];return _0x2f7dd0;};'use strict';var emlformat=require(_0xfc36('0x0'));var rimraf=require(_0xfc36('0x1'));var zipdir=require(_0xfc36('0x2'));var jsonpatch=require(_0xfc36('0x3'));var rp=require(_0xfc36('0x4'));var moment=require(_0xfc36('0x5'));var BPromise=require(_0xfc36('0x6'));var Mustache=require(_0xfc36('0x7'));var util=require(_0xfc36('0x8'));var path=require(_0xfc36('0x9'));var sox=require(_0xfc36('0xa'));var csv=require(_0xfc36('0xb'));var ejs=require(_0xfc36('0xc'));var fs=require('fs');var fs_extra=require(_0xfc36('0xd'));var _=require(_0xfc36('0xe'));var squel=require(_0xfc36('0xf'));var crypto=require(_0xfc36('0x10'));var jsforce=require(_0xfc36('0x11'));var deskjs=require(_0xfc36('0x12'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xfc36('0x13'));var Redis=require('ioredis');var authService=require(_0xfc36('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xfc36('0x15'));var hardwareService=require(_0xfc36('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xfc36('0x17'));var config=require(_0xfc36('0x18'));var licenseUtil=require(_0xfc36('0x19'));var db=require(_0xfc36('0x1a'))['db'];function respondWithStatusCode(_0x320dc5,_0x155edd){_0x155edd=_0x155edd||0xcc;return function(_0x47dbe9){if(_0x47dbe9){return _0x320dc5[_0xfc36('0x1b')](_0x155edd);}return _0x320dc5[_0xfc36('0x1c')](_0x155edd)['end']();};}function respondWithResult(_0x55ed8f,_0x504f9a){_0x504f9a=_0x504f9a||0xc8;return function(_0x529eb4){if(_0x529eb4){return _0x55ed8f[_0xfc36('0x1c')](_0x504f9a)[_0xfc36('0x1d')](_0x529eb4);}};}function respondWithFilteredResult(_0x1efa1d,_0x50c7f0){return function(_0x34aa67){if(_0x34aa67){var _0x482397=typeof _0x50c7f0[_0xfc36('0x1e')]===_0xfc36('0x1f')&&typeof _0x50c7f0['limit']===_0xfc36('0x1f');var _0x486cdd=_0x34aa67['count'];var _0x1e0f48=_0x482397?0x0:_0x50c7f0[_0xfc36('0x1e')];var _0x4a002c=_0x482397?_0x34aa67[_0xfc36('0x20')]:_0x50c7f0[_0xfc36('0x1e')]+_0x50c7f0[_0xfc36('0x21')];var _0x5cb7ea;if(_0x4a002c>=_0x486cdd){_0x4a002c=_0x486cdd;_0x5cb7ea=0xc8;}else{_0x5cb7ea=0xce;}_0x1efa1d[_0xfc36('0x1c')](_0x5cb7ea);return _0x1efa1d[_0xfc36('0x22')](_0xfc36('0x23'),_0x1e0f48+'-'+_0x4a002c+'/'+_0x486cdd)['json'](_0x34aa67);}return null;};}function patchUpdates(_0xe86989){return function(_0x270aa2){try{jsonpatch['apply'](_0x270aa2,_0xe86989,!![]);}catch(_0xe841bb){return BPromise[_0xfc36('0x24')](_0xe841bb);}return _0x270aa2[_0xfc36('0x25')]();};}function saveUpdates(_0x280d94,_0x7583b0){return function(_0x2977c9){if(_0x2977c9){return _0x2977c9['update'](_0x280d94)[_0xfc36('0x26')](function(_0x40ba88){return _0x40ba88;});}return null;};}function removeEntity(_0x5c2cf6,_0x109f00){return function(_0x99c87d){if(_0x99c87d){return _0x99c87d[_0xfc36('0x27')]()[_0xfc36('0x26')](function(){_0x5c2cf6['status'](0xcc)[_0xfc36('0x28')]();});}};}function handleEntityNotFound(_0x207ee9,_0x4cc4bd){return function(_0x138e28){if(!_0x138e28){_0x207ee9['sendStatus'](0x194);}return _0x138e28;};}function handleError(_0x582df,_0x483126){_0x483126=_0x483126||0x1f4;return function(_0x5f1927){logger[_0xfc36('0x29')](_0x5f1927['stack']);if(_0x5f1927[_0xfc36('0x2a')]){delete _0x5f1927[_0xfc36('0x2a')];}_0x582df['status'](_0x483126)[_0xfc36('0x2b')](_0x5f1927);};}exports[_0xfc36('0x2c')]=function(_0x1eaa74,_0x370ff5){var _0x13db89={},_0x577e75={},_0xa97b75={'count':0x0,'rows':[]};var _0x3b2801=_[_0xfc36('0x2d')](db[_0xfc36('0x2e')][_0xfc36('0x2f')],function(_0x101e22){return{'name':_0x101e22[_0xfc36('0x30')],'type':_0x101e22['type'][_0xfc36('0x31')]};});_0x577e75[_0xfc36('0x32')]=_[_0xfc36('0x2d')](_0x3b2801,_0xfc36('0x2a'));_0x577e75[_0xfc36('0x33')]=_[_0xfc36('0x34')](_0x1eaa74[_0xfc36('0x33')]);_0x577e75[_0xfc36('0x35')]=_[_0xfc36('0x36')](_0x577e75[_0xfc36('0x32')],_0x577e75[_0xfc36('0x33')]);_0x13db89[_0xfc36('0x37')]=_[_0xfc36('0x36')](_0x577e75['model'],qs[_0xfc36('0x38')](_0x1eaa74[_0xfc36('0x33')][_0xfc36('0x38')]));_0x13db89[_0xfc36('0x37')]=_0x13db89[_0xfc36('0x37')][_0xfc36('0x39')]?_0x13db89['attributes']:_0x577e75[_0xfc36('0x32')];if(!_0x1eaa74[_0xfc36('0x33')]['hasOwnProperty'](_0xfc36('0x3a'))){_0x13db89[_0xfc36('0x21')]=qs['limit'](_0x1eaa74[_0xfc36('0x33')][_0xfc36('0x21')]);_0x13db89[_0xfc36('0x1e')]=qs[_0xfc36('0x1e')](_0x1eaa74[_0xfc36('0x33')][_0xfc36('0x1e')]);}_0x13db89[_0xfc36('0x3b')]=qs[_0xfc36('0x3c')](_0x1eaa74[_0xfc36('0x33')]['sort']);_0x13db89[_0xfc36('0x3d')]=qs['filters'](_[_0xfc36('0x3e')](_0x1eaa74[_0xfc36('0x33')],_0x577e75['filters']),_0x3b2801);if(_0x1eaa74[_0xfc36('0x33')][_0xfc36('0x3f')]){_0x13db89[_0xfc36('0x3d')]=_[_0xfc36('0x40')](_0x13db89[_0xfc36('0x3d')],{'$or':_[_0xfc36('0x2d')](_0x3b2801,function(_0x21f389){if(_0x21f389[_0xfc36('0x41')]!=='VIRTUAL'){var _0x4de22c={};_0x4de22c[_0x21f389['name']]={'$like':'%'+_0x1eaa74[_0xfc36('0x33')]['filter']+'%'};return _0x4de22c;}})});}_0x13db89=_[_0xfc36('0x40')]({},_0x13db89,_0x1eaa74[_0xfc36('0x42')]);var _0x312964={'where':_0x13db89[_0xfc36('0x3d')]};return db[_0xfc36('0x2e')][_0xfc36('0x20')](_0x312964)[_0xfc36('0x26')](function(_0x53b23c){_0xa97b75[_0xfc36('0x20')]=_0x53b23c;if(_0x1eaa74[_0xfc36('0x33')]['includeAll']){_0x13db89['include']=[{'all':!![]}];}return db[_0xfc36('0x2e')][_0xfc36('0x43')](_0x13db89);})[_0xfc36('0x26')](function(_0x2eb692){_0xa97b75[_0xfc36('0x44')]=_0x2eb692;return _0xa97b75;})[_0xfc36('0x26')](respondWithFilteredResult(_0x370ff5,_0x13db89))[_0xfc36('0x45')](handleError(_0x370ff5,null));};exports[_0xfc36('0x46')]=function(_0x5f3e40,_0x2f4478){var _0x5d7534={'raw':!![],'where':{'id':_0x5f3e40[_0xfc36('0x47')]['id']}},_0x22db24={};_0x22db24[_0xfc36('0x32')]=_[_0xfc36('0x34')](db[_0xfc36('0x2e')][_0xfc36('0x2f')]);_0x22db24[_0xfc36('0x33')]=_[_0xfc36('0x34')](_0x5f3e40[_0xfc36('0x33')]);_0x22db24[_0xfc36('0x35')]=_[_0xfc36('0x36')](_0x22db24['model'],_0x22db24['query']);_0x5d7534[_0xfc36('0x37')]=_[_0xfc36('0x36')](_0x22db24[_0xfc36('0x32')],qs[_0xfc36('0x38')](_0x5f3e40['query'][_0xfc36('0x38')]));_0x5d7534[_0xfc36('0x37')]=_0x5d7534[_0xfc36('0x37')][_0xfc36('0x39')]?_0x5d7534[_0xfc36('0x37')]:_0x22db24[_0xfc36('0x32')];if(_0x5f3e40[_0xfc36('0x33')][_0xfc36('0x48')]){_0x5d7534['include']=[{'all':!![]}];}_0x5d7534=_['merge']({},_0x5d7534,_0x5f3e40[_0xfc36('0x42')]);return db[_0xfc36('0x2e')][_0xfc36('0x49')](_0x5d7534)[_0xfc36('0x26')](handleEntityNotFound(_0x2f4478,null))[_0xfc36('0x26')](respondWithResult(_0x2f4478,null))['catch'](handleError(_0x2f4478,null));};exports['create']=function(_0x3f7cb4,_0x4a97d4){return db['VtigerField'][_0xfc36('0x4a')](_0x3f7cb4[_0xfc36('0x4b')],{})[_0xfc36('0x26')](respondWithResult(_0x4a97d4,0xc9))[_0xfc36('0x45')](handleError(_0x4a97d4,null));};exports['update']=function(_0x121296,_0x2da37f){if(_0x121296[_0xfc36('0x4b')]['id']){delete _0x121296[_0xfc36('0x4b')]['id'];}return db['VtigerField']['find']({'where':{'id':_0x121296[_0xfc36('0x47')]['id']}})['then'](handleEntityNotFound(_0x2da37f,null))[_0xfc36('0x26')](saveUpdates(_0x121296[_0xfc36('0x4b')],null))[_0xfc36('0x26')](respondWithResult(_0x2da37f,null))[_0xfc36('0x45')](handleError(_0x2da37f,null));};exports[_0xfc36('0x27')]=function(_0x18f3c1,_0x3c16dd){return db[_0xfc36('0x2e')][_0xfc36('0x49')]({'where':{'id':_0x18f3c1[_0xfc36('0x47')]['id']}})[_0xfc36('0x26')](handleEntityNotFound(_0x3c16dd,null))[_0xfc36('0x26')](removeEntity(_0x3c16dd,null))[_0xfc36('0x45')](handleError(_0x3c16dd,null));}; \ No newline at end of file +var _0xf605=['findAll','rows','catch','show','params','keys','length','create','body','find','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','reject','update','then','end','error','stack','name','send','index','VtigerField','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xf605,0x1cd));var _0x5f60=function(_0x1158d5,_0x4e7ee8){_0x1158d5=_0x1158d5-0x0;var _0x3e9d61=_0xf605[_0x1158d5];return _0x3e9d61;};'use strict';var emlformat=require(_0x5f60('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5f60('0x1'));var rp=require(_0x5f60('0x2'));var moment=require(_0x5f60('0x3'));var BPromise=require(_0x5f60('0x4'));var Mustache=require(_0x5f60('0x5'));var util=require(_0x5f60('0x6'));var path=require(_0x5f60('0x7'));var sox=require(_0x5f60('0x8'));var csv=require(_0x5f60('0x9'));var ejs=require(_0x5f60('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x5f60('0xb'));var crypto=require('crypto');var jsforce=require(_0x5f60('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5f60('0xd'));var Papa=require(_0x5f60('0xe'));var Redis=require('ioredis');var authService=require(_0x5f60('0xf'));var qs=require(_0x5f60('0x10'));var as=require(_0x5f60('0x11'));var hardwareService=require(_0x5f60('0x12'));var logger=require(_0x5f60('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5f60('0x14'));var db=require(_0x5f60('0x15'))['db'];function respondWithStatusCode(_0x2da996,_0x4af0ec){_0x4af0ec=_0x4af0ec||0xcc;return function(_0x1196f9){if(_0x1196f9){return _0x2da996[_0x5f60('0x16')](_0x4af0ec);}return _0x2da996[_0x5f60('0x17')](_0x4af0ec)['end']();};}function respondWithResult(_0x118b61,_0x248096){_0x248096=_0x248096||0xc8;return function(_0x4f122e){if(_0x4f122e){return _0x118b61[_0x5f60('0x17')](_0x248096)['json'](_0x4f122e);}};}function respondWithFilteredResult(_0x442b1b,_0xcc9c2d){return function(_0x2c20c5){if(_0x2c20c5){var _0x3c7c8e=typeof _0xcc9c2d[_0x5f60('0x18')]===_0x5f60('0x19')&&typeof _0xcc9c2d[_0x5f60('0x1a')]===_0x5f60('0x19');var _0x446bdd=_0x2c20c5[_0x5f60('0x1b')];var _0x35b3ef=_0x3c7c8e?0x0:_0xcc9c2d['offset'];var _0x376fa=_0x3c7c8e?_0x2c20c5[_0x5f60('0x1b')]:_0xcc9c2d[_0x5f60('0x18')]+_0xcc9c2d[_0x5f60('0x1a')];var _0x3c314e;if(_0x376fa>=_0x446bdd){_0x376fa=_0x446bdd;_0x3c314e=0xc8;}else{_0x3c314e=0xce;}_0x442b1b['status'](_0x3c314e);return _0x442b1b[_0x5f60('0x1c')]('Content-Range',_0x35b3ef+'-'+_0x376fa+'/'+_0x446bdd)[_0x5f60('0x1d')](_0x2c20c5);}return null;};}function patchUpdates(_0x2686bf){return function(_0x2b1865){try{jsonpatch[_0x5f60('0x1e')](_0x2b1865,_0x2686bf,!![]);}catch(_0x31df40){return BPromise[_0x5f60('0x1f')](_0x31df40);}return _0x2b1865['save']();};}function saveUpdates(_0x35c117,_0x30e243){return function(_0x59d7a5){if(_0x59d7a5){return _0x59d7a5[_0x5f60('0x20')](_0x35c117)['then'](function(_0xbf58c5){return _0xbf58c5;});}return null;};}function removeEntity(_0x5e0e1a,_0x333078){return function(_0x6ec7e0){if(_0x6ec7e0){return _0x6ec7e0['destroy']()[_0x5f60('0x21')](function(){_0x5e0e1a[_0x5f60('0x17')](0xcc)[_0x5f60('0x22')]();});}};}function handleEntityNotFound(_0x402078,_0x1dbed8){return function(_0x5b28a0){if(!_0x5b28a0){_0x402078[_0x5f60('0x16')](0x194);}return _0x5b28a0;};}function handleError(_0x589cd9,_0x1c943c){_0x1c943c=_0x1c943c||0x1f4;return function(_0x21fe16){logger[_0x5f60('0x23')](_0x21fe16[_0x5f60('0x24')]);if(_0x21fe16[_0x5f60('0x25')]){delete _0x21fe16[_0x5f60('0x25')];}_0x589cd9['status'](_0x1c943c)[_0x5f60('0x26')](_0x21fe16);};}exports[_0x5f60('0x27')]=function(_0x206afe,_0xc4eaf6){var _0x449c45={},_0x1a92d8={},_0x27e439={'count':0x0,'rows':[]};var _0x33fe77=_['map'](db[_0x5f60('0x28')][_0x5f60('0x29')],function(_0x583878){return{'name':_0x583878[_0x5f60('0x2a')],'type':_0x583878[_0x5f60('0x2b')][_0x5f60('0x2c')]};});_0x1a92d8[_0x5f60('0x2d')]=_[_0x5f60('0x2e')](_0x33fe77,_0x5f60('0x25'));_0x1a92d8[_0x5f60('0x2f')]=_['keys'](_0x206afe[_0x5f60('0x2f')]);_0x1a92d8[_0x5f60('0x30')]=_[_0x5f60('0x31')](_0x1a92d8[_0x5f60('0x2d')],_0x1a92d8[_0x5f60('0x2f')]);_0x449c45[_0x5f60('0x32')]=_[_0x5f60('0x31')](_0x1a92d8[_0x5f60('0x2d')],qs['fields'](_0x206afe[_0x5f60('0x2f')][_0x5f60('0x33')]));_0x449c45[_0x5f60('0x32')]=_0x449c45[_0x5f60('0x32')]['length']?_0x449c45[_0x5f60('0x32')]:_0x1a92d8[_0x5f60('0x2d')];if(!_0x206afe[_0x5f60('0x2f')][_0x5f60('0x34')](_0x5f60('0x35'))){_0x449c45['limit']=qs[_0x5f60('0x1a')](_0x206afe[_0x5f60('0x2f')]['limit']);_0x449c45['offset']=qs[_0x5f60('0x18')](_0x206afe[_0x5f60('0x2f')][_0x5f60('0x18')]);}_0x449c45[_0x5f60('0x36')]=qs[_0x5f60('0x37')](_0x206afe[_0x5f60('0x2f')][_0x5f60('0x37')]);_0x449c45[_0x5f60('0x38')]=qs[_0x5f60('0x30')](_[_0x5f60('0x39')](_0x206afe['query'],_0x1a92d8['filters']),_0x33fe77);if(_0x206afe[_0x5f60('0x2f')][_0x5f60('0x3a')]){_0x449c45[_0x5f60('0x38')]=_['merge'](_0x449c45[_0x5f60('0x38')],{'$or':_['map'](_0x33fe77,function(_0x3dccba){if(_0x3dccba[_0x5f60('0x2b')]!==_0x5f60('0x3b')){var _0x8e298b={};_0x8e298b[_0x3dccba[_0x5f60('0x25')]]={'$like':'%'+_0x206afe[_0x5f60('0x2f')][_0x5f60('0x3a')]+'%'};return _0x8e298b;}})});}_0x449c45=_[_0x5f60('0x3c')]({},_0x449c45,_0x206afe[_0x5f60('0x3d')]);var _0x4f3ea4={'where':_0x449c45[_0x5f60('0x38')]};return db[_0x5f60('0x28')]['count'](_0x4f3ea4)['then'](function(_0x3973b9){_0x27e439[_0x5f60('0x1b')]=_0x3973b9;if(_0x206afe[_0x5f60('0x2f')][_0x5f60('0x3e')]){_0x449c45[_0x5f60('0x3f')]=[{'all':!![]}];}return db[_0x5f60('0x28')][_0x5f60('0x40')](_0x449c45);})[_0x5f60('0x21')](function(_0x283a21){_0x27e439[_0x5f60('0x41')]=_0x283a21;return _0x27e439;})[_0x5f60('0x21')](respondWithFilteredResult(_0xc4eaf6,_0x449c45))[_0x5f60('0x42')](handleError(_0xc4eaf6,null));};exports[_0x5f60('0x43')]=function(_0x245957,_0xd06cf2){var _0x85d992={'raw':!![],'where':{'id':_0x245957[_0x5f60('0x44')]['id']}},_0x2839e1={};_0x2839e1[_0x5f60('0x2d')]=_['keys'](db[_0x5f60('0x28')][_0x5f60('0x29')]);_0x2839e1[_0x5f60('0x2f')]=_[_0x5f60('0x45')](_0x245957[_0x5f60('0x2f')]);_0x2839e1[_0x5f60('0x30')]=_[_0x5f60('0x31')](_0x2839e1[_0x5f60('0x2d')],_0x2839e1[_0x5f60('0x2f')]);_0x85d992[_0x5f60('0x32')]=_['intersection'](_0x2839e1['model'],qs[_0x5f60('0x33')](_0x245957[_0x5f60('0x2f')][_0x5f60('0x33')]));_0x85d992[_0x5f60('0x32')]=_0x85d992['attributes'][_0x5f60('0x46')]?_0x85d992['attributes']:_0x2839e1[_0x5f60('0x2d')];if(_0x245957[_0x5f60('0x2f')]['includeAll']){_0x85d992[_0x5f60('0x3f')]=[{'all':!![]}];}_0x85d992=_['merge']({},_0x85d992,_0x245957[_0x5f60('0x3d')]);return db['VtigerField']['find'](_0x85d992)[_0x5f60('0x21')](handleEntityNotFound(_0xd06cf2,null))[_0x5f60('0x21')](respondWithResult(_0xd06cf2,null))['catch'](handleError(_0xd06cf2,null));};exports['create']=function(_0x567e3f,_0x1ff915){return db[_0x5f60('0x28')][_0x5f60('0x47')](_0x567e3f[_0x5f60('0x48')],{})[_0x5f60('0x21')](respondWithResult(_0x1ff915,0xc9))[_0x5f60('0x42')](handleError(_0x1ff915,null));};exports[_0x5f60('0x20')]=function(_0x5b56c6,_0x3e5222){if(_0x5b56c6['body']['id']){delete _0x5b56c6[_0x5f60('0x48')]['id'];}return db[_0x5f60('0x28')][_0x5f60('0x49')]({'where':{'id':_0x5b56c6[_0x5f60('0x44')]['id']}})[_0x5f60('0x21')](handleEntityNotFound(_0x3e5222,null))['then'](saveUpdates(_0x5b56c6[_0x5f60('0x48')],null))[_0x5f60('0x21')](respondWithResult(_0x3e5222,null))['catch'](handleError(_0x3e5222,null));};exports[_0x5f60('0x4a')]=function(_0x21e059,_0x4c00a4){return db[_0x5f60('0x28')][_0x5f60('0x49')]({'where':{'id':_0x21e059[_0x5f60('0x44')]['id']}})['then'](handleEntityNotFound(_0x4c00a4,null))[_0x5f60('0x21')](removeEntity(_0x4c00a4,null))['catch'](handleError(_0x4c00a4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 1e53e34..ae2ae42 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 _0x9cf9=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','lodash','util'];(function(_0x1e8d5a,_0x12229a){var _0x5ebdb8=function(_0x403f36){while(--_0x403f36){_0x1e8d5a['push'](_0x1e8d5a['shift']());}};_0x5ebdb8(++_0x12229a);}(_0x9cf9,0x14e));var _0x99cf=function(_0x5526b8,_0x353f11){_0x5526b8=_0x5526b8-0x0;var _0x2e202d=_0x9cf9[_0x5526b8];return _0x2e202d;};'use strict';var _=require(_0x99cf('0x0'));var util=require(_0x99cf('0x1'));var logger=require(_0x99cf('0x2'))(_0x99cf('0x3'));var moment=require(_0x99cf('0x4'));var BPromise=require(_0x99cf('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x99cf('0x6'));var rimraf=require(_0x99cf('0x7'));var config=require(_0x99cf('0x8'));var attributes=require('./intVtigerField.attributes');module[_0x99cf('0x9')]=function(_0x156ca1,_0x1c6c9e){return _0x156ca1[_0x99cf('0xa')](_0x99cf('0xb'),attributes,{'tableName':_0x99cf('0xc'),'paranoid':![],'indexes':[{'name':_0x99cf('0xd'),'fields':[_0x99cf('0xe'),_0x99cf('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4d88=['bluebird','request-promise','./intVtigerField.attributes','exports','int_vtiger_fields','idField','FieldId','util','../../config/logger','api','moment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x4d88,0x80));var _0x84d8=function(_0x1e83ba,_0x1e483e){_0x1e83ba=_0x1e83ba-0x0;var _0x5607f2=_0x4d88[_0x1e83ba];return _0x5607f2;};'use strict';var _=require('lodash');var util=require(_0x84d8('0x0'));var logger=require(_0x84d8('0x1'))(_0x84d8('0x2'));var moment=require(_0x84d8('0x3'));var BPromise=require(_0x84d8('0x4'));var rp=require(_0x84d8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x84d8('0x6'));module[_0x84d8('0x7')]=function(_0x13c378,_0x114e7d){return _0x13c378['define']('VtigerField',attributes,{'tableName':_0x84d8('0x8'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x84d8('0x9'),_0x84d8('0xa')],'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 b816319..1325ece 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 _0xe01b=['request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','VtigerField,\x20%s,\x20%s'];(function(_0x10f6e8,_0x351db6){var _0x35bb3c=function(_0x30a39b){while(--_0x30a39b){_0x10f6e8['push'](_0x10f6e8['shift']());}};_0x35bb3c(++_0x351db6);}(_0xe01b,0x64));var _0xbe01=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xe01b[_0x543084];return _0x306a57;};'use strict';var _=require(_0xbe01('0x0'));var util=require(_0xbe01('0x1'));var moment=require(_0xbe01('0x2'));var BPromise=require('bluebird');var rs=require(_0xbe01('0x3'));var fs=require('fs');var Redis=require(_0xbe01('0x4'));var db=require(_0xbe01('0x5'))['db'];var utils=require(_0xbe01('0x6'));var logger=require(_0xbe01('0x7'))(_0xbe01('0x8'));var config=require(_0xbe01('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbe01('0xa')][_0xbe01('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1aefaa,_0xec2b8e,_0x3007d6){return new BPromise(function(_0x55cf64,_0x587698){return client['request'](_0x1aefaa,_0x3007d6)[_0xbe01('0xc')](function(_0x238985){logger[_0xbe01('0xd')](_0xbe01('0xe'),_0xec2b8e,_0xbe01('0xf'));logger[_0xbe01('0x10')](_0xbe01('0x11'),_0xec2b8e,_0xbe01('0xf'),JSON[_0xbe01('0x12')](_0x238985));if(_0x238985['error']){if(_0x238985['error'][_0xbe01('0x13')]===0x1f4){logger[_0xbe01('0x14')]('VtigerField,\x20%s,\x20%s',_0xec2b8e,_0x238985[_0xbe01('0x14')][_0xbe01('0x15')]);return _0x587698(_0x238985[_0xbe01('0x14')][_0xbe01('0x15')]);}logger[_0xbe01('0x14')](_0xbe01('0xe'),_0xec2b8e,_0x238985[_0xbe01('0x14')]['message']);return _0x55cf64(_0x238985['error'][_0xbe01('0x15')]);}else{logger[_0xbe01('0xd')](_0xbe01('0xe'),_0xec2b8e,'request\x20sent');_0x55cf64(_0x238985[_0xbe01('0x16')][_0xbe01('0x15')]);}})['catch'](function(_0x119450){logger[_0xbe01('0x14')](_0xbe01('0xe'),_0xec2b8e,_0x119450);_0x587698(_0x119450);});});} \ No newline at end of file +var _0x2a4f=['message','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VtigerField,\x20%s,\x20%s'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x2a4f,0xf3));var _0xf2a4=function(_0x1f5834,_0x421950){_0x1f5834=_0x1f5834-0x0;var _0x418e31=_0x2a4f[_0x1f5834];return _0x418e31;};'use strict';var _=require(_0xf2a4('0x0'));var util=require(_0xf2a4('0x1'));var moment=require(_0xf2a4('0x2'));var BPromise=require(_0xf2a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf2a4('0x4'));var db=require(_0xf2a4('0x5'))['db'];var utils=require(_0xf2a4('0x6'));var logger=require(_0xf2a4('0x7'))(_0xf2a4('0x8'));var config=require(_0xf2a4('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf2a4('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d1d9c,_0x388f60,_0x1f74c0){return new BPromise(function(_0x2b11cc,_0x368e40){return client[_0xf2a4('0xb')](_0x4d1d9c,_0x1f74c0)[_0xf2a4('0xc')](function(_0x57e2fc){logger[_0xf2a4('0xd')]('VtigerField,\x20%s,\x20%s',_0x388f60,'request\x20sent');logger[_0xf2a4('0xe')](_0xf2a4('0xf'),_0x388f60,_0xf2a4('0x10'),JSON[_0xf2a4('0x11')](_0x57e2fc));if(_0x57e2fc[_0xf2a4('0x12')]){if(_0x57e2fc['error'][_0xf2a4('0x13')]===0x1f4){logger['error'](_0xf2a4('0x14'),_0x388f60,_0x57e2fc[_0xf2a4('0x12')][_0xf2a4('0x15')]);return _0x368e40(_0x57e2fc[_0xf2a4('0x12')][_0xf2a4('0x15')]);}logger[_0xf2a4('0x12')](_0xf2a4('0x14'),_0x388f60,_0x57e2fc[_0xf2a4('0x12')][_0xf2a4('0x15')]);return _0x2b11cc(_0x57e2fc[_0xf2a4('0x12')][_0xf2a4('0x15')]);}else{logger['info'](_0xf2a4('0x14'),_0x388f60,'request\x20sent');_0x2b11cc(_0x57e2fc['result'][_0xf2a4('0x15')]);}})['catch'](function(_0x14485e){logger['error'](_0xf2a4('0x14'),_0x388f60,_0x14485e);_0x368e40(_0x14485e);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 545d020..549b58d 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 _0x6e64=['../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','show','/:id/configurations','getConfigurations','/:id/fields','getFields','addConfiguration','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0x2359c5,_0x27c819){var _0x4f8179=function(_0x165a89){while(--_0x165a89){_0x2359c5['push'](_0x2359c5['shift']());}};_0x4f8179(++_0x27c819);}(_0x6e64,0x10f));var _0x46e6=function(_0x256513,_0x433740){_0x256513=_0x256513-0x0;var _0x226fa9=_0x6e64[_0x256513];return _0x226fa9;};'use strict';var multer=require(_0x46e6('0x0'));var util=require(_0x46e6('0x1'));var path=require(_0x46e6('0x2'));var timeout=require(_0x46e6('0x3'));var express=require('express');var router=express[_0x46e6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x46e6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x46e6('0x6'));var controller=require(_0x46e6('0x7'));router[_0x46e6('0x8')]('/',auth[_0x46e6('0x9')](),controller[_0x46e6('0xa')]);router[_0x46e6('0x8')]('/:id',auth[_0x46e6('0x9')](),controller[_0x46e6('0xb')]);router[_0x46e6('0x8')](_0x46e6('0xc'),auth[_0x46e6('0x9')](),controller[_0x46e6('0xd')]);router[_0x46e6('0x8')](_0x46e6('0xe'),auth[_0x46e6('0x9')](),controller[_0x46e6('0xf')]);router['post']('/',auth[_0x46e6('0x9')](),controller['create']);router['post'](_0x46e6('0xc'),auth[_0x46e6('0x9')](),controller[_0x46e6('0x10')]);router[_0x46e6('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x46e6('0x12')]);router[_0x46e6('0x13')](_0x46e6('0x14'),auth[_0x46e6('0x9')](),controller[_0x46e6('0x15')]);module[_0x46e6('0x16')]=router; \ No newline at end of file +var _0x82e7=['delete','destroy','exports','multer','path','connect-timeout','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update'];(function(_0xc87a46,_0x310eec){var _0x49632d=function(_0x44a3b1){while(--_0x44a3b1){_0xc87a46['push'](_0xc87a46['shift']());}};_0x49632d(++_0x310eec);}(_0x82e7,0x1e3));var _0x782e=function(_0xb7b269,_0xf52b7c){_0xb7b269=_0xb7b269-0x0;var _0x50e687=_0x82e7[_0xb7b269];return _0x50e687;};'use strict';var multer=require(_0x782e('0x0'));var util=require('util');var path=require(_0x782e('0x1'));var timeout=require(_0x782e('0x2'));var express=require('express');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(_0x782e('0x3'));var controller=require(_0x782e('0x4'));router[_0x782e('0x5')]('/',auth[_0x782e('0x6')](),controller[_0x782e('0x7')]);router[_0x782e('0x5')](_0x782e('0x8'),auth[_0x782e('0x6')](),controller[_0x782e('0x9')]);router[_0x782e('0x5')](_0x782e('0xa'),auth[_0x782e('0x6')](),controller[_0x782e('0xb')]);router['get'](_0x782e('0xc'),auth[_0x782e('0x6')](),controller['getFields']);router[_0x782e('0xd')]('/',auth[_0x782e('0x6')](),controller['create']);router[_0x782e('0xd')](_0x782e('0xa'),auth[_0x782e('0x6')](),controller[_0x782e('0xe')]);router[_0x782e('0xf')](_0x782e('0x8'),auth[_0x782e('0x6')](),controller[_0x782e('0x10')]);router[_0x782e('0x11')](_0x782e('0x8'),auth[_0x782e('0x6')](),controller[_0x782e('0x12')]);module[_0x782e('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 d35b562..1f0d439 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 _0x7ea9=['password','token','integrationTab','newTab','exports','STRING','username','remoteUri'];(function(_0x5933f6,_0x10c665){var _0x14ce1e=function(_0xeba59a){while(--_0xeba59a){_0x5933f6['push'](_0x5933f6['shift']());}};_0x14ce1e(++_0x10c665);}(_0x7ea9,0xec));var _0x97ea=function(_0x593e87,_0x3678e2){_0x593e87=_0x593e87-0x0;var _0x59235b=_0x7ea9[_0x593e87];return _0x59235b;};'use strict';var Sequelize=require('sequelize');module[_0x97ea('0x0')]={'name':{'type':Sequelize[_0x97ea('0x1')]},'description':{'type':Sequelize[_0x97ea('0x1')]},'username':{'type':Sequelize[_0x97ea('0x1')],'unique':_0x97ea('0x2')},'password':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x97ea('0x1')]},'remoteUri':{'type':Sequelize[_0x97ea('0x1')],'unique':_0x97ea('0x3')},'authType':{'type':Sequelize['ENUM'](_0x97ea('0x4'),_0x97ea('0x5')),'defaultValue':_0x97ea('0x4')},'serverUrl':{'type':Sequelize[_0x97ea('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x97ea('0x6'),_0x97ea('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x2484=['STRING','username','remoteUri','password','token','ENUM','integrationTab','sequelize','exports'];(function(_0x46e515,_0x390228){var _0x3753f0=function(_0x182426){while(--_0x182426){_0x46e515['push'](_0x46e515['shift']());}};_0x3753f0(++_0x390228);}(_0x2484,0x178));var _0x4248=function(_0x4c41c4,_0x75bc8a){_0x4c41c4=_0x4c41c4-0x0;var _0x2bdc48=_0x2484[_0x4c41c4];return _0x2bdc48;};'use strict';var Sequelize=require(_0x4248('0x0'));module[_0x4248('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4248('0x2')]},'username':{'type':Sequelize[_0x4248('0x2')],'unique':_0x4248('0x3')},'password':{'type':Sequelize[_0x4248('0x2')]},'token':{'type':Sequelize[_0x4248('0x2')]},'remoteUri':{'type':Sequelize[_0x4248('0x2')],'unique':_0x4248('0x4')},'authType':{'type':Sequelize['ENUM'](_0x4248('0x5'),_0x4248('0x6')),'defaultValue':_0x4248('0x5')},'serverUrl':{'type':Sequelize[_0x4248('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x4248('0x7')](_0x4248('0x8'),'newTab'),'defaultValue':_0x4248('0x8')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 73cb020..b841628 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 _0x84a0=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','name','index','map','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','ZendeskAccount','findAll','rows','show','length','include','find','catch','create','body','update','params','findOne','ZendeskConfiguration','order','getConfigurations','hasOwnProperty','AccountId','Subjects','getSubjects','channel','getDescriptions','ZendeskField','Descriptions','username','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','password','headers','Basic\x20%s','%s:%s','toString','%s/token:%s','token','ValidationError','Unknown\x20authentication\x20type','subject','description','assignee','remove','ticket_fields','includes','position','title','system_field_options','custom_field_options','error','getFields,\x20%s,\x20%s,\x20%s','stringify','send','test','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch'];(function(_0x255765,_0x458859){var _0x17d578=function(_0x14678a){while(--_0x14678a){_0x255765['push'](_0x255765['shift']());}};_0x17d578(++_0x458859);}(_0x84a0,0x66));var _0x084a=function(_0x30ba78,_0x3b3808){_0x30ba78=_0x30ba78-0x0;var _0x4806b3=_0x84a0[_0x30ba78];return _0x4806b3;};'use strict';var emlformat=require(_0x084a('0x0'));var rimraf=require(_0x084a('0x1'));var zipdir=require(_0x084a('0x2'));var jsonpatch=require(_0x084a('0x3'));var rp=require('request-promise');var moment=require(_0x084a('0x4'));var BPromise=require(_0x084a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x084a('0x6'));var sox=require(_0x084a('0x7'));var csv=require('to-csv');var ejs=require(_0x084a('0x8'));var fs=require('fs');var fs_extra=require(_0x084a('0x9'));var _=require(_0x084a('0xa'));var squel=require(_0x084a('0xb'));var crypto=require(_0x084a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x084a('0xd'));var toCsv=require(_0x084a('0xe'));var querystring=require(_0x084a('0xf'));var Papa=require(_0x084a('0x10'));var Redis=require(_0x084a('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x084a('0x12'));var hardwareService=require(_0x084a('0x13'));var logger=require(_0x084a('0x14'))(_0x084a('0x15'));var utils=require(_0x084a('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x084a('0x17'))['db'];var integrations=require(_0x084a('0x18'));function respondWithStatusCode(_0xec90a5,_0x9245b1){_0x9245b1=_0x9245b1||0xcc;return function(_0x1bdfb8){if(_0x1bdfb8){return _0xec90a5[_0x084a('0x19')](_0x9245b1);}return _0xec90a5[_0x084a('0x1a')](_0x9245b1)[_0x084a('0x1b')]();};}function respondWithResult(_0x5aef40,_0x4277c9){_0x4277c9=_0x4277c9||0xc8;return function(_0x4b9cc5){if(_0x4b9cc5){return _0x5aef40[_0x084a('0x1a')](_0x4277c9)[_0x084a('0x1c')](_0x4b9cc5);}};}function respondWithFilteredResult(_0x366624,_0x2d35b8){return function(_0xd20527){if(_0xd20527){var _0x4cbd16=typeof _0x2d35b8[_0x084a('0x1d')]==='undefined'&&typeof _0x2d35b8[_0x084a('0x1e')]===_0x084a('0x1f');var _0x4af43e=_0xd20527[_0x084a('0x20')];var _0x32c729=_0x4cbd16?0x0:_0x2d35b8[_0x084a('0x1d')];var _0x14bb19=_0x4cbd16?_0xd20527[_0x084a('0x20')]:_0x2d35b8[_0x084a('0x1d')]+_0x2d35b8[_0x084a('0x1e')];var _0x34e86e;if(_0x14bb19>=_0x4af43e){_0x14bb19=_0x4af43e;_0x34e86e=0xc8;}else{_0x34e86e=0xce;}_0x366624[_0x084a('0x1a')](_0x34e86e);return _0x366624[_0x084a('0x21')](_0x084a('0x22'),_0x32c729+'-'+_0x14bb19+'/'+_0x4af43e)[_0x084a('0x1c')](_0xd20527);}return null;};}function patchUpdates(_0x116328){return function(_0x126efb){try{jsonpatch[_0x084a('0x23')](_0x126efb,_0x116328,!![]);}catch(_0x506f71){return BPromise[_0x084a('0x24')](_0x506f71);}return _0x126efb[_0x084a('0x25')]();};}function saveUpdates(_0x41a90f,_0x2d62bf){return function(_0x1c3f6c){if(_0x1c3f6c){return _0x1c3f6c['update'](_0x41a90f)[_0x084a('0x26')](function(_0x288e9e){return _0x288e9e;});}return null;};}function removeEntity(_0x6346a5,_0x1f2c9f){return function(_0x18b43d){if(_0x18b43d){return _0x18b43d[_0x084a('0x27')]()['then'](function(){_0x6346a5[_0x084a('0x1a')](0xcc)[_0x084a('0x1b')]();});}};}function handleEntityNotFound(_0x54233b,_0x5b1474){return function(_0x8806d5){if(!_0x8806d5){_0x54233b[_0x084a('0x19')](0x194);}return _0x8806d5;};}function handleError(_0xfc9b8c,_0x4c5658){_0x4c5658=_0x4c5658||0x1f4;return function(_0x5596ac){logger['error'](_0x5596ac['stack']);if(_0x5596ac[_0x084a('0x28')]){delete _0x5596ac['name'];}_0xfc9b8c['status'](_0x4c5658)['send'](_0x5596ac);};}exports[_0x084a('0x29')]=function(_0x4651e6,_0x388062){var _0x2c4149={},_0x3be7a6={},_0x25a2a1={'count':0x0,'rows':[]};var _0x378de6=_[_0x084a('0x2a')](db['ZendeskAccount'][_0x084a('0x2b')],function(_0x3b2b38){return{'name':_0x3b2b38['fieldName'],'type':_0x3b2b38[_0x084a('0x2c')][_0x084a('0x2d')]};});_0x3be7a6[_0x084a('0x2e')]=_[_0x084a('0x2a')](_0x378de6,_0x084a('0x28'));_0x3be7a6[_0x084a('0x2f')]=_[_0x084a('0x30')](_0x4651e6[_0x084a('0x2f')]);_0x3be7a6[_0x084a('0x31')]=_[_0x084a('0x32')](_0x3be7a6[_0x084a('0x2e')],_0x3be7a6[_0x084a('0x2f')]);_0x2c4149[_0x084a('0x33')]=_['intersection'](_0x3be7a6['model'],qs[_0x084a('0x34')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x34')]));_0x2c4149[_0x084a('0x33')]=_0x2c4149[_0x084a('0x33')]['length']?_0x2c4149[_0x084a('0x33')]:_0x3be7a6[_0x084a('0x2e')];if(!_0x4651e6[_0x084a('0x2f')]['hasOwnProperty'](_0x084a('0x35'))){_0x2c4149[_0x084a('0x1e')]=qs[_0x084a('0x1e')](_0x4651e6['query']['limit']);_0x2c4149['offset']=qs[_0x084a('0x1d')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x1d')]);}_0x2c4149['order']=qs[_0x084a('0x36')](_0x4651e6[_0x084a('0x2f')][_0x084a('0x36')]);_0x2c4149[_0x084a('0x37')]=qs[_0x084a('0x31')](_[_0x084a('0x38')](_0x4651e6[_0x084a('0x2f')],_0x3be7a6[_0x084a('0x31')]),_0x378de6);if(_0x4651e6[_0x084a('0x2f')][_0x084a('0x39')]){_0x2c4149[_0x084a('0x37')]=_[_0x084a('0x3a')](_0x2c4149[_0x084a('0x37')],{'$or':_[_0x084a('0x2a')](_0x378de6,function(_0x10983f){if(_0x10983f['type']!==_0x084a('0x3b')){var _0x1dada8={};_0x1dada8[_0x10983f[_0x084a('0x28')]]={'$like':'%'+_0x4651e6[_0x084a('0x2f')][_0x084a('0x39')]+'%'};return _0x1dada8;}})});}_0x2c4149=_[_0x084a('0x3a')]({},_0x2c4149,_0x4651e6[_0x084a('0x3c')]);var _0x183e10={'where':_0x2c4149[_0x084a('0x37')]};return db['ZendeskAccount'][_0x084a('0x20')](_0x183e10)[_0x084a('0x26')](function(_0x25a081){_0x25a2a1[_0x084a('0x20')]=_0x25a081;if(_0x4651e6[_0x084a('0x2f')][_0x084a('0x3d')]){_0x2c4149['include']=[{'all':!![]}];}return db[_0x084a('0x3e')][_0x084a('0x3f')](_0x2c4149);})['then'](function(_0x410fdb){_0x25a2a1[_0x084a('0x40')]=_0x410fdb;return _0x25a2a1;})[_0x084a('0x26')](respondWithFilteredResult(_0x388062,_0x2c4149))['catch'](handleError(_0x388062,null));};exports[_0x084a('0x41')]=function(_0xba1081,_0x4fe9c2){var _0x3e2b92={'raw':![],'where':{'id':_0xba1081['params']['id']}},_0xfb565c={};_0xfb565c['model']=_[_0x084a('0x30')](db[_0x084a('0x3e')][_0x084a('0x2b')]);_0xfb565c[_0x084a('0x2f')]=_[_0x084a('0x30')](_0xba1081[_0x084a('0x2f')]);_0xfb565c[_0x084a('0x31')]=_[_0x084a('0x32')](_0xfb565c[_0x084a('0x2e')],_0xfb565c[_0x084a('0x2f')]);_0x3e2b92[_0x084a('0x33')]=_['intersection'](_0xfb565c['model'],qs[_0x084a('0x34')](_0xba1081[_0x084a('0x2f')][_0x084a('0x34')]));_0x3e2b92['attributes']=_0x3e2b92[_0x084a('0x33')][_0x084a('0x42')]?_0x3e2b92[_0x084a('0x33')]:_0xfb565c[_0x084a('0x2e')];if(_0xba1081[_0x084a('0x2f')]['includeAll']){_0x3e2b92[_0x084a('0x43')]=[{'all':!![]}];}_0x3e2b92=_['merge']({},_0x3e2b92,_0xba1081[_0x084a('0x3c')]);return db[_0x084a('0x3e')][_0x084a('0x44')](_0x3e2b92)['then'](handleEntityNotFound(_0x4fe9c2,null))['then'](respondWithResult(_0x4fe9c2,null))[_0x084a('0x45')](handleError(_0x4fe9c2,null));};exports[_0x084a('0x46')]=function(_0x505965,_0x29d8c2){return db[_0x084a('0x3e')][_0x084a('0x46')](_0x505965[_0x084a('0x47')],{})['then'](respondWithResult(_0x29d8c2,0xc9))[_0x084a('0x45')](handleError(_0x29d8c2,null));};exports[_0x084a('0x48')]=function(_0x31677b,_0x10856d){if(_0x31677b['body']['id']){delete _0x31677b[_0x084a('0x47')]['id'];}return db[_0x084a('0x3e')][_0x084a('0x44')]({'where':{'id':_0x31677b[_0x084a('0x49')]['id']}})['then'](handleEntityNotFound(_0x10856d,null))['then'](saveUpdates(_0x31677b[_0x084a('0x47')],null))[_0x084a('0x26')](respondWithResult(_0x10856d,null))[_0x084a('0x45')](handleError(_0x10856d,null));};exports[_0x084a('0x27')]=function(_0xf936e,_0x3b2df4){return db[_0x084a('0x3e')][_0x084a('0x44')]({'where':{'id':_0xf936e[_0x084a('0x49')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x3b2df4,null))[_0x084a('0x26')](removeEntity(_0x3b2df4,null))[_0x084a('0x45')](handleError(_0x3b2df4,null));};exports['getConfigurations']=function(_0xcdd5b,_0x37fce4,_0x29fa4b){var _0x39edc1={};var _0x2091b1={};var _0x1c972c;var _0xa5362;return db['ZendeskAccount'][_0x084a('0x4a')]({'where':{'id':_0xcdd5b[_0x084a('0x49')]['id']}})[_0x084a('0x26')](handleEntityNotFound(_0x37fce4,null))['then'](function(_0x54ca1f){if(_0x54ca1f){_0x1c972c=_0x54ca1f;_0x2091b1[_0x084a('0x2e')]=_['keys'](db[_0x084a('0x4b')][_0x084a('0x2b')]);_0x2091b1['query']=_[_0x084a('0x30')](_0xcdd5b['query']);_0x2091b1['filters']=_[_0x084a('0x32')](_0x2091b1[_0x084a('0x2e')],_0x2091b1[_0x084a('0x2f')]);_0x39edc1[_0x084a('0x33')]=_[_0x084a('0x32')](_0x2091b1[_0x084a('0x2e')],qs[_0x084a('0x34')](_0xcdd5b['query'][_0x084a('0x34')]));_0x39edc1[_0x084a('0x33')]=_0x39edc1[_0x084a('0x33')]['length']?_0x39edc1[_0x084a('0x33')]:_0x2091b1[_0x084a('0x2e')];_0x39edc1[_0x084a('0x4c')]=qs[_0x084a('0x36')](_0xcdd5b['query'][_0x084a('0x36')]);_0x39edc1['where']=qs[_0x084a('0x31')](_[_0x084a('0x38')](_0xcdd5b[_0x084a('0x2f')],_0x2091b1['filters']));if(_0xcdd5b['query'][_0x084a('0x39')]){_0x39edc1[_0x084a('0x37')]=_['merge'](_0x39edc1[_0x084a('0x37')],{'$or':_['map'](_0x39edc1['attributes'],function(_0x195ae2){var _0x3f3fd7={};_0x3f3fd7[_0x195ae2]={'$like':'%'+_0xcdd5b[_0x084a('0x2f')][_0x084a('0x39')]+'%'};return _0x3f3fd7;})});}_0x39edc1=_[_0x084a('0x3a')]({},_0x39edc1,_0xcdd5b[_0x084a('0x3c')]);return _0x1c972c[_0x084a('0x4d')](_0x39edc1);}})[_0x084a('0x26')](function(_0x114aa5){if(_0x114aa5){_0xa5362=_0x114aa5['length'];if(!_0xcdd5b[_0x084a('0x2f')][_0x084a('0x4e')](_0x084a('0x35'))){_0x39edc1['limit']=qs[_0x084a('0x1e')](_0xcdd5b[_0x084a('0x2f')]['limit']);_0x39edc1[_0x084a('0x1d')]=qs['offset'](_0xcdd5b['query'][_0x084a('0x1d')]);}return _0x1c972c['getConfigurations'](_0x39edc1);}})['then'](function(_0x2368f5){if(_0x2368f5){return _0x2368f5?{'count':_0xa5362,'rows':_0x2368f5}:null;}})[_0x084a('0x26')](respondWithResult(_0x37fce4,null))[_0x084a('0x45')](handleError(_0x37fce4,null));};exports['addConfiguration']=function(_0xff6c9e,_0xbd063c,_0x2311f5){if(_0xff6c9e[_0x084a('0x47')]['id']){delete _0xff6c9e[_0x084a('0x47')]['id'];}return db[_0x084a('0x3e')][_0x084a('0x4a')]({'where':{'id':_0xff6c9e['params']['id']}})['then'](handleEntityNotFound(_0xbd063c,null))[_0x084a('0x26')](function(_0x36ba24){if(_0x36ba24){_0xff6c9e['body'][_0x084a('0x4f')]=_0x36ba24['id'];_0xff6c9e[_0x084a('0x47')][_0x084a('0x50')]=integrations[_0x084a('0x51')](_0xff6c9e['body'][_0x084a('0x52')],_0xff6c9e[_0x084a('0x47')][_0x084a('0x2c')]);_0xff6c9e['body']['Descriptions']=integrations[_0x084a('0x53')](_0xff6c9e[_0x084a('0x47')][_0x084a('0x52')],_0xff6c9e[_0x084a('0x47')][_0x084a('0x2c')]);return db[_0x084a('0x4b')][_0x084a('0x46')](_0xff6c9e['body'],{'include':[{'model':db[_0x084a('0x54')],'as':'Subjects'},{'model':db['ZendeskField'],'as':_0x084a('0x55')}]});}return null;})[_0x084a('0x26')](respondWithResult(_0xbd063c,null))[_0x084a('0x45')](handleError(_0xbd063c,null));};exports['getFields']=function(_0x163a5d,_0x57729c,_0x1eb7be){var _0x1054ea='';return db[_0x084a('0x3e')][_0x084a('0x4a')]({'where':{'id':_0x163a5d[_0x084a('0x49')]['id']},'attributes':['id',_0x084a('0x56'),'password','token',_0x084a('0x57'),_0x084a('0x58')]})[_0x084a('0x26')](handleEntityNotFound(_0x57729c,null))[_0x084a('0x26')](function(_0x22abf5){if(_0x22abf5){_0x1054ea=_0x22abf5[_0x084a('0x58')];var _0x5c655f=_0x1054ea[_0x084a('0x59')](-0x1);if(_0x5c655f==='/'){_0x1054ea=_0x1054ea[_0x084a('0x5a')](0x0,_0x1054ea[_0x084a('0x5b')](_0x5c655f));}var _0x33c040={'method':_0x084a('0x5c'),'uri':util[_0x084a('0x5d')](_0x084a('0x5e'),_0x1054ea,'ticket_fields'),'json':!![]};switch(_0x22abf5[_0x084a('0x57')]){case _0x084a('0x5f'):_0x33c040[_0x084a('0x60')]={'Authorization':util[_0x084a('0x5d')](_0x084a('0x61'),new Buffer(util[_0x084a('0x5d')](_0x084a('0x62'),_0x22abf5[_0x084a('0x56')],_0x22abf5[_0x084a('0x5f')]))[_0x084a('0x63')]('base64'))};break;case'token':_0x33c040['headers']={'Authorization':util[_0x084a('0x5d')](_0x084a('0x61'),new Buffer(util['format'](_0x084a('0x64'),_0x22abf5[_0x084a('0x56')],_0x22abf5[_0x084a('0x65')]))[_0x084a('0x63')]('base64'))};break;default:throw new db['Sequelize'][(_0x084a('0x66'))](_0x084a('0x67'));}return rp(_0x33c040);}})[_0x084a('0x26')](function(_0x37d05a){if(_0x37d05a){var _0x155450=[_0x084a('0x68'),_0x084a('0x69'),'group',_0x084a('0x6a')];_[_0x084a('0x6b')](_0x37d05a[_0x084a('0x6c')],function(_0x137bba){return _0x155450[_0x084a('0x6d')](_0x137bba[_0x084a('0x2c')]);});return{'count':_0x37d05a[_0x084a('0x6c')]['length'],'rows':_[_0x084a('0x2a')](_0x37d05a[_0x084a('0x6c')],function(_0x26a88c){return{'id':_0x26a88c['id'],'name':_0x26a88c[_0x084a('0x6e')]>0x7?_0x26a88c[_0x084a('0x6f')]:_0x26a88c[_0x084a('0x2c')],'custom':_0x26a88c[_0x084a('0x6e')]>0x7?!![]:![],'options':_0x26a88c[_0x084a('0x70')]?_0x26a88c[_0x084a('0x70')]:_0x26a88c[_0x084a('0x71')]?_0x26a88c[_0x084a('0x71')]:[]};})};}})['then'](respondWithResult(_0x57729c,null))[_0x084a('0x45')](function(_0x29916a){var _0x4b8f1f=_0x163a5d[_0x084a('0x2f')]['test']?0x1f4:_0x29916a['statusCode']||0x1f4;logger[_0x084a('0x72')](_0x084a('0x73'),'getFields',_0x4b8f1f,JSON[_0x084a('0x74')](_0x29916a));delete _0x29916a[_0x084a('0x28')];if(_0x4b8f1f===0x191){_0x4b8f1f=0x190;}_0x57729c[_0x084a('0x1a')](_0x4b8f1f)[_0x084a('0x75')](_0x163a5d[_0x084a('0x2f')][_0x084a('0x76')]?{'message':_0x084a('0x77'),'statusCode':_0x29916a[_0x084a('0x78')]}:_0x29916a);});}; \ No newline at end of file +var _0x5ec6=['Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','title','position','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ZendeskAccount','rawAttributes','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','body','findOne','ZendeskConfiguration','length','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','ZendeskField','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','%s/%s','ticket_fields','Basic\x20%s','%s:%s','toString','base64','headers'];(function(_0x4e23a9,_0x2fa6f2){var _0x1080ee=function(_0x5492ea){while(--_0x5492ea){_0x4e23a9['push'](_0x4e23a9['shift']());}};_0x1080ee(++_0x2fa6f2);}(_0x5ec6,0x7f));var _0x65ec=function(_0x25848d,_0x5c2cf0){_0x25848d=_0x25848d-0x0;var _0x37618c=_0x5ec6[_0x25848d];return _0x37618c;};'use strict';var emlformat=require(_0x65ec('0x0'));var rimraf=require(_0x65ec('0x1'));var zipdir=require(_0x65ec('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x65ec('0x3'));var moment=require('moment');var BPromise=require(_0x65ec('0x4'));var Mustache=require('mustache');var util=require(_0x65ec('0x5'));var path=require('path');var sox=require(_0x65ec('0x6'));var csv=require('to-csv');var ejs=require(_0x65ec('0x7'));var fs=require('fs');var fs_extra=require(_0x65ec('0x8'));var _=require('lodash');var squel=require(_0x65ec('0x9'));var crypto=require(_0x65ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x65ec('0xb'));var toCsv=require(_0x65ec('0xc'));var querystring=require(_0x65ec('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65ec('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x65ec('0xf'));var hardwareService=require(_0x65ec('0x10'));var logger=require('../../config/logger')(_0x65ec('0x11'));var utils=require(_0x65ec('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x65ec('0x13'));var db=require(_0x65ec('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x3e52c8,_0x2af7d6){_0x2af7d6=_0x2af7d6||0xcc;return function(_0x411a7b){if(_0x411a7b){return _0x3e52c8[_0x65ec('0x15')](_0x2af7d6);}return _0x3e52c8[_0x65ec('0x16')](_0x2af7d6)[_0x65ec('0x17')]();};}function respondWithResult(_0x344724,_0x3edbfd){_0x3edbfd=_0x3edbfd||0xc8;return function(_0x58c81f){if(_0x58c81f){return _0x344724[_0x65ec('0x16')](_0x3edbfd)[_0x65ec('0x18')](_0x58c81f);}};}function respondWithFilteredResult(_0x35d06b,_0x4bbe88){return function(_0x5a0442){if(_0x5a0442){var _0x25cdd4=typeof _0x4bbe88[_0x65ec('0x19')]===_0x65ec('0x1a')&&typeof _0x4bbe88['limit']===_0x65ec('0x1a');var _0x286eac=_0x5a0442[_0x65ec('0x1b')];var _0xb4ed90=_0x25cdd4?0x0:_0x4bbe88[_0x65ec('0x19')];var _0xd81ed3=_0x25cdd4?_0x5a0442[_0x65ec('0x1b')]:_0x4bbe88[_0x65ec('0x19')]+_0x4bbe88[_0x65ec('0x1c')];var _0x441ad0;if(_0xd81ed3>=_0x286eac){_0xd81ed3=_0x286eac;_0x441ad0=0xc8;}else{_0x441ad0=0xce;}_0x35d06b[_0x65ec('0x16')](_0x441ad0);return _0x35d06b[_0x65ec('0x1d')](_0x65ec('0x1e'),_0xb4ed90+'-'+_0xd81ed3+'/'+_0x286eac)[_0x65ec('0x18')](_0x5a0442);}return null;};}function patchUpdates(_0x3804a4){return function(_0x1d538c){try{jsonpatch[_0x65ec('0x1f')](_0x1d538c,_0x3804a4,!![]);}catch(_0x130d4e){return BPromise[_0x65ec('0x20')](_0x130d4e);}return _0x1d538c['save']();};}function saveUpdates(_0x170703,_0x297fba){return function(_0x89e640){if(_0x89e640){return _0x89e640[_0x65ec('0x21')](_0x170703)[_0x65ec('0x22')](function(_0x163e55){return _0x163e55;});}return null;};}function removeEntity(_0x47288d,_0x58239f){return function(_0xf1ff97){if(_0xf1ff97){return _0xf1ff97[_0x65ec('0x23')]()[_0x65ec('0x22')](function(){_0x47288d[_0x65ec('0x16')](0xcc)[_0x65ec('0x17')]();});}};}function handleEntityNotFound(_0x156793,_0x21426b){return function(_0xf5adc7){if(!_0xf5adc7){_0x156793[_0x65ec('0x15')](0x194);}return _0xf5adc7;};}function handleError(_0x4c846b,_0x10baef){_0x10baef=_0x10baef||0x1f4;return function(_0x30f0cf){logger[_0x65ec('0x24')](_0x30f0cf[_0x65ec('0x25')]);if(_0x30f0cf['name']){delete _0x30f0cf[_0x65ec('0x26')];}_0x4c846b['status'](_0x10baef)[_0x65ec('0x27')](_0x30f0cf);};}exports[_0x65ec('0x28')]=function(_0x1d0b5c,_0x30366c){var _0x14431d={},_0x46d4c1={},_0x46bf66={'count':0x0,'rows':[]};var _0x39410f=_[_0x65ec('0x29')](db[_0x65ec('0x2a')][_0x65ec('0x2b')],function(_0x4b435c){return{'name':_0x4b435c['fieldName'],'type':_0x4b435c[_0x65ec('0x2c')]['key']};});_0x46d4c1[_0x65ec('0x2d')]=_[_0x65ec('0x29')](_0x39410f,'name');_0x46d4c1[_0x65ec('0x2e')]=_[_0x65ec('0x2f')](_0x1d0b5c[_0x65ec('0x2e')]);_0x46d4c1[_0x65ec('0x30')]=_['intersection'](_0x46d4c1[_0x65ec('0x2d')],_0x46d4c1[_0x65ec('0x2e')]);_0x14431d[_0x65ec('0x31')]=_[_0x65ec('0x32')](_0x46d4c1[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x14431d[_0x65ec('0x31')]=_0x14431d[_0x65ec('0x31')]['length']?_0x14431d[_0x65ec('0x31')]:_0x46d4c1[_0x65ec('0x2d')];if(!_0x1d0b5c['query'][_0x65ec('0x34')](_0x65ec('0x35'))){_0x14431d[_0x65ec('0x1c')]=qs[_0x65ec('0x1c')](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x1c')]);_0x14431d[_0x65ec('0x19')]=qs['offset'](_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x19')]);}_0x14431d[_0x65ec('0x36')]=qs[_0x65ec('0x37')](_0x1d0b5c['query'][_0x65ec('0x37')]);_0x14431d[_0x65ec('0x38')]=qs[_0x65ec('0x30')](_[_0x65ec('0x39')](_0x1d0b5c['query'],_0x46d4c1['filters']),_0x39410f);if(_0x1d0b5c[_0x65ec('0x2e')]['filter']){_0x14431d[_0x65ec('0x38')]=_[_0x65ec('0x3a')](_0x14431d['where'],{'$or':_[_0x65ec('0x29')](_0x39410f,function(_0x1fbc2b){if(_0x1fbc2b[_0x65ec('0x2c')]!==_0x65ec('0x3b')){var _0x3cffbf={};_0x3cffbf[_0x1fbc2b[_0x65ec('0x26')]]={'$like':'%'+_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x3c')]+'%'};return _0x3cffbf;}})});}_0x14431d=_[_0x65ec('0x3a')]({},_0x14431d,_0x1d0b5c[_0x65ec('0x3d')]);var _0x3561ef={'where':_0x14431d['where']};return db[_0x65ec('0x2a')]['count'](_0x3561ef)[_0x65ec('0x22')](function(_0x278d43){_0x46bf66[_0x65ec('0x1b')]=_0x278d43;if(_0x1d0b5c[_0x65ec('0x2e')][_0x65ec('0x3e')]){_0x14431d[_0x65ec('0x3f')]=[{'all':!![]}];}return db['ZendeskAccount'][_0x65ec('0x40')](_0x14431d);})['then'](function(_0x5d8d57){_0x46bf66[_0x65ec('0x41')]=_0x5d8d57;return _0x46bf66;})[_0x65ec('0x22')](respondWithFilteredResult(_0x30366c,_0x14431d))[_0x65ec('0x42')](handleError(_0x30366c,null));};exports[_0x65ec('0x43')]=function(_0x1d475e,_0x524235){var _0x4843ca={'raw':![],'where':{'id':_0x1d475e[_0x65ec('0x44')]['id']}},_0x1aef6d={};_0x1aef6d[_0x65ec('0x2d')]=_[_0x65ec('0x2f')](db[_0x65ec('0x2a')]['rawAttributes']);_0x1aef6d['query']=_[_0x65ec('0x2f')](_0x1d475e[_0x65ec('0x2e')]);_0x1aef6d[_0x65ec('0x30')]=_[_0x65ec('0x32')](_0x1aef6d[_0x65ec('0x2d')],_0x1aef6d[_0x65ec('0x2e')]);_0x4843ca[_0x65ec('0x31')]=_['intersection'](_0x1aef6d[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x1d475e[_0x65ec('0x2e')]['fields']));_0x4843ca[_0x65ec('0x31')]=_0x4843ca[_0x65ec('0x31')]['length']?_0x4843ca[_0x65ec('0x31')]:_0x1aef6d[_0x65ec('0x2d')];if(_0x1d475e[_0x65ec('0x2e')][_0x65ec('0x3e')]){_0x4843ca[_0x65ec('0x3f')]=[{'all':!![]}];}_0x4843ca=_['merge']({},_0x4843ca,_0x1d475e[_0x65ec('0x3d')]);return db[_0x65ec('0x2a')][_0x65ec('0x45')](_0x4843ca)[_0x65ec('0x22')](handleEntityNotFound(_0x524235,null))['then'](respondWithResult(_0x524235,null))[_0x65ec('0x42')](handleError(_0x524235,null));};exports['create']=function(_0x1ed0f9,_0x169890){return db[_0x65ec('0x2a')]['create'](_0x1ed0f9['body'],{})[_0x65ec('0x22')](respondWithResult(_0x169890,0xc9))[_0x65ec('0x42')](handleError(_0x169890,null));};exports[_0x65ec('0x21')]=function(_0x2111af,_0x1b3732){if(_0x2111af[_0x65ec('0x46')]['id']){delete _0x2111af[_0x65ec('0x46')]['id'];}return db[_0x65ec('0x2a')][_0x65ec('0x45')]({'where':{'id':_0x2111af[_0x65ec('0x44')]['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x1b3732,null))[_0x65ec('0x22')](saveUpdates(_0x2111af[_0x65ec('0x46')],null))[_0x65ec('0x22')](respondWithResult(_0x1b3732,null))[_0x65ec('0x42')](handleError(_0x1b3732,null));};exports[_0x65ec('0x23')]=function(_0x22c28c,_0x5eb6d3){return db[_0x65ec('0x2a')][_0x65ec('0x45')]({'where':{'id':_0x22c28c['params']['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x5eb6d3,null))[_0x65ec('0x22')](removeEntity(_0x5eb6d3,null))[_0x65ec('0x42')](handleError(_0x5eb6d3,null));};exports['getConfigurations']=function(_0x3eee1e,_0x2b2756,_0x27843b){var _0x50f1c3={};var _0xabb4e3={};var _0x5e5e48;var _0x4c9905;return db[_0x65ec('0x2a')][_0x65ec('0x47')]({'where':{'id':_0x3eee1e[_0x65ec('0x44')]['id']}})['then'](handleEntityNotFound(_0x2b2756,null))[_0x65ec('0x22')](function(_0x28a686){if(_0x28a686){_0x5e5e48=_0x28a686;_0xabb4e3[_0x65ec('0x2d')]=_[_0x65ec('0x2f')](db[_0x65ec('0x48')][_0x65ec('0x2b')]);_0xabb4e3[_0x65ec('0x2e')]=_[_0x65ec('0x2f')](_0x3eee1e[_0x65ec('0x2e')]);_0xabb4e3['filters']=_['intersection'](_0xabb4e3[_0x65ec('0x2d')],_0xabb4e3['query']);_0x50f1c3[_0x65ec('0x31')]=_['intersection'](_0xabb4e3[_0x65ec('0x2d')],qs[_0x65ec('0x33')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x33')]));_0x50f1c3[_0x65ec('0x31')]=_0x50f1c3[_0x65ec('0x31')][_0x65ec('0x49')]?_0x50f1c3['attributes']:_0xabb4e3[_0x65ec('0x2d')];_0x50f1c3[_0x65ec('0x36')]=qs[_0x65ec('0x37')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x37')]);_0x50f1c3['where']=qs[_0x65ec('0x30')](_[_0x65ec('0x39')](_0x3eee1e[_0x65ec('0x2e')],_0xabb4e3[_0x65ec('0x30')]));if(_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x3c')]){_0x50f1c3[_0x65ec('0x38')]=_[_0x65ec('0x3a')](_0x50f1c3['where'],{'$or':_[_0x65ec('0x29')](_0x50f1c3[_0x65ec('0x31')],function(_0x12bb9b){var _0x233b9b={};_0x233b9b[_0x12bb9b]={'$like':'%'+_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x3c')]+'%'};return _0x233b9b;})});}_0x50f1c3=_[_0x65ec('0x3a')]({},_0x50f1c3,_0x3eee1e['options']);return _0x5e5e48['getConfigurations'](_0x50f1c3);}})[_0x65ec('0x22')](function(_0x56dd47){if(_0x56dd47){_0x4c9905=_0x56dd47[_0x65ec('0x49')];if(!_0x3eee1e[_0x65ec('0x2e')]['hasOwnProperty'](_0x65ec('0x35'))){_0x50f1c3[_0x65ec('0x1c')]=qs[_0x65ec('0x1c')](_0x3eee1e[_0x65ec('0x2e')][_0x65ec('0x1c')]);_0x50f1c3[_0x65ec('0x19')]=qs[_0x65ec('0x19')](_0x3eee1e['query']['offset']);}return _0x5e5e48[_0x65ec('0x4a')](_0x50f1c3);}})[_0x65ec('0x22')](function(_0xd14e5){if(_0xd14e5){return _0xd14e5?{'count':_0x4c9905,'rows':_0xd14e5}:null;}})['then'](respondWithResult(_0x2b2756,null))[_0x65ec('0x42')](handleError(_0x2b2756,null));};exports[_0x65ec('0x4b')]=function(_0x17059d,_0x3d761f,_0x21096d){if(_0x17059d[_0x65ec('0x46')]['id']){delete _0x17059d[_0x65ec('0x46')]['id'];}return db['ZendeskAccount'][_0x65ec('0x47')]({'where':{'id':_0x17059d[_0x65ec('0x44')]['id']}})[_0x65ec('0x22')](handleEntityNotFound(_0x3d761f,null))[_0x65ec('0x22')](function(_0x3da824){if(_0x3da824){_0x17059d[_0x65ec('0x46')][_0x65ec('0x4c')]=_0x3da824['id'];_0x17059d[_0x65ec('0x46')][_0x65ec('0x4d')]=integrations['getSubjects'](_0x17059d['body'][_0x65ec('0x4e')],_0x17059d['body']['type']);_0x17059d[_0x65ec('0x46')][_0x65ec('0x4f')]=integrations[_0x65ec('0x50')](_0x17059d['body']['channel'],_0x17059d[_0x65ec('0x46')]['type']);return db['ZendeskConfiguration']['create'](_0x17059d[_0x65ec('0x46')],{'include':[{'model':db['ZendeskField'],'as':_0x65ec('0x4d')},{'model':db[_0x65ec('0x51')],'as':_0x65ec('0x4f')}]});}return null;})['then'](respondWithResult(_0x3d761f,null))['catch'](handleError(_0x3d761f,null));};exports[_0x65ec('0x52')]=function(_0x54f1cb,_0x244d12,_0x1c2972){var _0xf78f6a='';return db[_0x65ec('0x2a')][_0x65ec('0x47')]({'where':{'id':_0x54f1cb[_0x65ec('0x44')]['id']},'attributes':['id',_0x65ec('0x53'),_0x65ec('0x54'),_0x65ec('0x55'),_0x65ec('0x56'),'remoteUri']})[_0x65ec('0x22')](handleEntityNotFound(_0x244d12,null))['then'](function(_0x46e454){if(_0x46e454){_0xf78f6a=_0x46e454[_0x65ec('0x57')];var _0x292f81=_0xf78f6a[_0x65ec('0x58')](-0x1);if(_0x292f81==='/'){_0xf78f6a=_0xf78f6a['substring'](0x0,_0xf78f6a[_0x65ec('0x59')](_0x292f81));}var _0x556c5e={'method':_0x65ec('0x5a'),'uri':util[_0x65ec('0x5b')](_0x65ec('0x5c'),_0xf78f6a,_0x65ec('0x5d')),'json':!![]};switch(_0x46e454['authType']){case'password':_0x556c5e['headers']={'Authorization':util[_0x65ec('0x5b')](_0x65ec('0x5e'),new Buffer(util[_0x65ec('0x5b')](_0x65ec('0x5f'),_0x46e454[_0x65ec('0x53')],_0x46e454[_0x65ec('0x54')]))[_0x65ec('0x60')](_0x65ec('0x61')))};break;case _0x65ec('0x55'):_0x556c5e[_0x65ec('0x62')]={'Authorization':util[_0x65ec('0x5b')](_0x65ec('0x5e'),new Buffer(util[_0x65ec('0x5b')]('%s/token:%s',_0x46e454[_0x65ec('0x53')],_0x46e454[_0x65ec('0x55')]))[_0x65ec('0x60')](_0x65ec('0x61')))};break;default:throw new db[(_0x65ec('0x63'))][(_0x65ec('0x64'))](_0x65ec('0x65'));}return rp(_0x556c5e);}})[_0x65ec('0x22')](function(_0x3b5640){if(_0x3b5640){var _0x26ac0e=['subject',_0x65ec('0x66'),'group','assignee'];_[_0x65ec('0x67')](_0x3b5640[_0x65ec('0x5d')],function(_0x272432){return _0x26ac0e[_0x65ec('0x68')](_0x272432[_0x65ec('0x2c')]);});return{'count':_0x3b5640[_0x65ec('0x5d')][_0x65ec('0x49')],'rows':_[_0x65ec('0x29')](_0x3b5640['ticket_fields'],function(_0x1f5fe7){return{'id':_0x1f5fe7['id'],'name':_0x1f5fe7['position']>0x7?_0x1f5fe7[_0x65ec('0x69')]:_0x1f5fe7[_0x65ec('0x2c')],'custom':_0x1f5fe7[_0x65ec('0x6a')]>0x7?!![]:![],'options':_0x1f5fe7['system_field_options']?_0x1f5fe7[_0x65ec('0x6b')]:_0x1f5fe7[_0x65ec('0x6c')]?_0x1f5fe7[_0x65ec('0x6c')]:[]};})};}})[_0x65ec('0x22')](respondWithResult(_0x244d12,null))[_0x65ec('0x42')](function(_0x77ebd2){var _0x1172f3=_0x54f1cb['query'][_0x65ec('0x6d')]?0x1f4:_0x77ebd2[_0x65ec('0x6e')]||0x1f4;logger[_0x65ec('0x24')](_0x65ec('0x6f'),'getFields',_0x1172f3,JSON['stringify'](_0x77ebd2));delete _0x77ebd2[_0x65ec('0x26')];if(_0x1172f3===0x191){_0x1172f3=0x190;}_0x244d12[_0x65ec('0x16')](_0x1172f3)[_0x65ec('0x27')](_0x54f1cb[_0x65ec('0x2e')][_0x65ec('0x6d')]?{'message':_0x65ec('0x70'),'statusCode':_0x77ebd2['statusCode']}:_0x77ebd2);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index c0e39f1..509b37b 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 _0xf460=['./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','util','../../config/logger','api','moment','rimraf','../../config/environment'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0xf460,0xf6));var _0x0f46=function(_0x439ee3,_0x1af8c1){_0x439ee3=_0x439ee3-0x0;var _0x174204=_0xf460[_0x439ee3];return _0x174204;};'use strict';var _=require('lodash');var util=require(_0x0f46('0x0'));var logger=require(_0x0f46('0x1'))(_0x0f46('0x2'));var moment=require(_0x0f46('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0f46('0x4'));var config=require(_0x0f46('0x5'));var attributes=require(_0x0f46('0x6'));var integrations=require(_0x0f46('0x7'));module[_0x0f46('0x8')]=function(_0x29a082,_0x1ac4d2){return _0x29a082[_0x0f46('0x9')](_0x0f46('0xa'),attributes,{'tableName':_0x0f46('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2b06=['../../components/integrations/configuration','exports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskAccount.attributes'];(function(_0x2e6f02,_0x20186d){var _0x2358ff=function(_0x329450){while(--_0x329450){_0x2e6f02['push'](_0x2e6f02['shift']());}};_0x2358ff(++_0x20186d);}(_0x2b06,0xd3));var _0x62b0=function(_0x473b41,_0x1c320f){_0x473b41=_0x473b41-0x0;var _0x4e521d=_0x2b06[_0x473b41];return _0x4e521d;};'use strict';var _=require('lodash');var util=require(_0x62b0('0x0'));var logger=require(_0x62b0('0x1'))(_0x62b0('0x2'));var moment=require(_0x62b0('0x3'));var BPromise=require(_0x62b0('0x4'));var rp=require(_0x62b0('0x5'));var fs=require('fs');var path=require(_0x62b0('0x6'));var rimraf=require(_0x62b0('0x7'));var config=require('../../config/environment');var attributes=require(_0x62b0('0x8'));var integrations=require(_0x62b0('0x9'));module[_0x62b0('0xa')]=function(_0x5871c7,_0x4b8fe1){return _0x5871c7['define']('ZendeskAccount',attributes,{'tableName':'int_zendesk_accounts','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 d40425d..6faa219 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 _0x0500=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetZendeskAccount','options','raw','where','attributes','limit','map','include','model','ShowZendeskAccount','ZendeskAccount','then','lodash'];(function(_0xf7a1d8,_0x322ba2){var _0x52e28d=function(_0x561293){while(--_0x561293){_0xf7a1d8['push'](_0xf7a1d8['shift']());}};_0x52e28d(++_0x322ba2);}(_0x0500,0x1db));var _0x0050=function(_0x28d6e1,_0x3bd067){_0x28d6e1=_0x28d6e1-0x0;var _0x529cf3=_0x0500[_0x28d6e1];return _0x529cf3;};'use strict';var _=require(_0x0050('0x0'));var util=require('util');var moment=require(_0x0050('0x1'));var BPromise=require(_0x0050('0x2'));var rs=require(_0x0050('0x3'));var fs=require('fs');var Redis=require(_0x0050('0x4'));var db=require(_0x0050('0x5'))['db'];var utils=require(_0x0050('0x6'));var logger=require(_0x0050('0x7'))(_0x0050('0x8'));var config=require(_0x0050('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0050('0xa')][_0x0050('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x249ee2,_0x5b0c26,_0x14b977){return new BPromise(function(_0x2798fa,_0x171228){return client[_0x0050('0xc')](_0x249ee2,_0x14b977)['then'](function(_0x529f7f){logger[_0x0050('0xd')](_0x0050('0xe'),_0x5b0c26,_0x0050('0xf'));logger[_0x0050('0x10')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x5b0c26,_0x0050('0xf'),JSON[_0x0050('0x11')](_0x529f7f));if(_0x529f7f['error']){if(_0x529f7f[_0x0050('0x12')][_0x0050('0x13')]===0x1f4){logger[_0x0050('0x12')](_0x0050('0xe'),_0x5b0c26,_0x529f7f[_0x0050('0x12')][_0x0050('0x14')]);return _0x171228(_0x529f7f['error'][_0x0050('0x14')]);}logger[_0x0050('0x12')](_0x0050('0xe'),_0x5b0c26,_0x529f7f[_0x0050('0x12')][_0x0050('0x14')]);return _0x2798fa(_0x529f7f[_0x0050('0x12')][_0x0050('0x14')]);}else{logger['info'](_0x0050('0xe'),_0x5b0c26,_0x0050('0xf'));_0x2798fa(_0x529f7f['result']['message']);}})[_0x0050('0x15')](function(_0x4694ea){logger[_0x0050('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x5b0c26,_0x4694ea);_0x171228(_0x4694ea);});});}exports[_0x0050('0x16')]=function(_0x5948a6){var _0x241277=this;return new Promise(function(_0x2726d1,_0x15fd37){return db['ZendeskAccount']['findAll']({'raw':_0x5948a6['options']?_0x5948a6[_0x0050('0x17')][_0x0050('0x18')]===undefined?!![]:![]:!![],'where':_0x5948a6[_0x0050('0x17')]?_0x5948a6['options'][_0x0050('0x19')]||null:null,'attributes':_0x5948a6['options']?_0x5948a6['options'][_0x0050('0x1a')]||null:null,'limit':_0x5948a6[_0x0050('0x17')]?_0x5948a6['options'][_0x0050('0x1b')]||null:null,'include':_0x5948a6['options']?_0x5948a6[_0x0050('0x17')]['include']?_[_0x0050('0x1c')](_0x5948a6[_0x0050('0x17')][_0x0050('0x1d')],function(_0x382a47){return{'model':db[_0x382a47[_0x0050('0x1e')]],'as':_0x382a47['as'],'attributes':_0x382a47[_0x0050('0x1a')],'include':_0x382a47[_0x0050('0x1d')]?_[_0x0050('0x1c')](_0x382a47[_0x0050('0x1d')],function(_0x80b062){return{'model':db[_0x80b062[_0x0050('0x1e')]],'as':_0x80b062['as'],'attributes':_0x80b062[_0x0050('0x1a')],'include':_0x80b062['include']?_[_0x0050('0x1c')](_0x80b062[_0x0050('0x1d')],function(_0x550ee){return{'model':db[_0x550ee[_0x0050('0x1e')]],'as':_0x550ee['as'],'attributes':_0x550ee[_0x0050('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xefefdd){logger[_0x0050('0xd')](_0x0050('0x16'),_0x5948a6);logger[_0x0050('0x10')](_0x0050('0x16'),_0x5948a6,JSON[_0x0050('0x11')](_0xefefdd));_0x2726d1(_0xefefdd);})[_0x0050('0x15')](function(_0x3ee69a){logger[_0x0050('0x12')](_0x0050('0x16'),_0x3ee69a[_0x0050('0x14')],_0x5948a6);_0x15fd37(_0x241277[_0x0050('0x12')](0x1f4,_0x3ee69a['message']));});});};exports[_0x0050('0x1f')]=function(_0x3edfeb){var _0x52e8c1=this;return new Promise(function(_0x43b8ac,_0x5c80bd){return db[_0x0050('0x20')]['find']({'raw':_0x3edfeb['options']?_0x3edfeb[_0x0050('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x3edfeb[_0x0050('0x17')]?_0x3edfeb[_0x0050('0x17')][_0x0050('0x19')]||null:null,'attributes':_0x3edfeb[_0x0050('0x17')]?_0x3edfeb[_0x0050('0x17')]['attributes']||null:null,'include':_0x3edfeb[_0x0050('0x17')]?_0x3edfeb[_0x0050('0x17')][_0x0050('0x1d')]?_[_0x0050('0x1c')](_0x3edfeb['options']['include'],function(_0x5586a2){return{'model':db[_0x5586a2[_0x0050('0x1e')]],'as':_0x5586a2['as'],'attributes':_0x5586a2[_0x0050('0x1a')],'include':_0x5586a2[_0x0050('0x1d')]?_['map'](_0x5586a2[_0x0050('0x1d')],function(_0x40bac4){return{'model':db[_0x40bac4['model']],'as':_0x40bac4['as'],'attributes':_0x40bac4['attributes'],'include':_0x40bac4[_0x0050('0x1d')]?_[_0x0050('0x1c')](_0x40bac4[_0x0050('0x1d')],function(_0x21a0fe){return{'model':db[_0x21a0fe[_0x0050('0x1e')]],'as':_0x21a0fe['as'],'attributes':_0x21a0fe['attributes']};}):[]};}):[]};}):[]:[]})[_0x0050('0x21')](function(_0x2b8e55){logger[_0x0050('0xd')](_0x0050('0x1f'),_0x3edfeb);logger['debug']('ShowZendeskAccount',_0x3edfeb,JSON[_0x0050('0x11')](_0x2b8e55));_0x43b8ac(_0x2b8e55);})[_0x0050('0x15')](function(_0x18dc8c){logger['error'](_0x0050('0x1f'),_0x18dc8c[_0x0050('0x14')],_0x3edfeb);_0x5c80bd(_0x52e8c1[_0x0050('0x12')](0x1f4,_0x18dc8c[_0x0050('0x14')]));});});}; \ No newline at end of file +var _0x1eae=['GetZendeskAccount','options','raw','where','attributes','limit','include','model','debug','catch','ShowZendeskAccount','ZendeskAccount','find','map','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1eae,0x12e));var _0xe1ea=function(_0x532451,_0x21109a){_0x532451=_0x532451-0x0;var _0x2981f9=_0x1eae[_0x532451];return _0x2981f9;};'use strict';var _=require(_0xe1ea('0x0'));var util=require(_0xe1ea('0x1'));var moment=require(_0xe1ea('0x2'));var BPromise=require(_0xe1ea('0x3'));var rs=require(_0xe1ea('0x4'));var fs=require('fs');var Redis=require(_0xe1ea('0x5'));var db=require(_0xe1ea('0x6'))['db'];var utils=require(_0xe1ea('0x7'));var logger=require('../../config/logger')(_0xe1ea('0x8'));var config=require(_0xe1ea('0x9'));var jayson=require(_0xe1ea('0xa'));var client=jayson['client'][_0xe1ea('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45ca78,_0x4a7271,_0x3a4707){return new BPromise(function(_0x2bc78a,_0xec4571){return client[_0xe1ea('0xc')](_0x45ca78,_0x3a4707)[_0xe1ea('0xd')](function(_0x78f43d){logger[_0xe1ea('0xe')](_0xe1ea('0xf'),_0x4a7271,_0xe1ea('0x10'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x4a7271,_0xe1ea('0x10'),JSON[_0xe1ea('0x11')](_0x78f43d));if(_0x78f43d[_0xe1ea('0x12')]){if(_0x78f43d[_0xe1ea('0x12')][_0xe1ea('0x13')]===0x1f4){logger[_0xe1ea('0x12')](_0xe1ea('0xf'),_0x4a7271,_0x78f43d['error'][_0xe1ea('0x14')]);return _0xec4571(_0x78f43d[_0xe1ea('0x12')][_0xe1ea('0x14')]);}logger[_0xe1ea('0x12')]('ZendeskAccount,\x20%s,\x20%s',_0x4a7271,_0x78f43d['error'][_0xe1ea('0x14')]);return _0x2bc78a(_0x78f43d[_0xe1ea('0x12')][_0xe1ea('0x14')]);}else{logger[_0xe1ea('0xe')](_0xe1ea('0xf'),_0x4a7271,'request\x20sent');_0x2bc78a(_0x78f43d[_0xe1ea('0x15')][_0xe1ea('0x14')]);}})['catch'](function(_0xaa9233){logger[_0xe1ea('0x12')](_0xe1ea('0xf'),_0x4a7271,_0xaa9233);_0xec4571(_0xaa9233);});});}exports[_0xe1ea('0x16')]=function(_0x47f18b){var _0x5f512a=this;return new Promise(function(_0x5bc6a5,_0x1d56fb){return db['ZendeskAccount']['findAll']({'raw':_0x47f18b[_0xe1ea('0x17')]?_0x47f18b['options'][_0xe1ea('0x18')]===undefined?!![]:![]:!![],'where':_0x47f18b[_0xe1ea('0x17')]?_0x47f18b['options'][_0xe1ea('0x19')]||null:null,'attributes':_0x47f18b[_0xe1ea('0x17')]?_0x47f18b[_0xe1ea('0x17')][_0xe1ea('0x1a')]||null:null,'limit':_0x47f18b['options']?_0x47f18b[_0xe1ea('0x17')][_0xe1ea('0x1b')]||null:null,'include':_0x47f18b['options']?_0x47f18b[_0xe1ea('0x17')]['include']?_['map'](_0x47f18b[_0xe1ea('0x17')][_0xe1ea('0x1c')],function(_0x29ecb2){return{'model':db[_0x29ecb2[_0xe1ea('0x1d')]],'as':_0x29ecb2['as'],'attributes':_0x29ecb2[_0xe1ea('0x1a')],'include':_0x29ecb2[_0xe1ea('0x1c')]?_['map'](_0x29ecb2[_0xe1ea('0x1c')],function(_0x45524e){return{'model':db[_0x45524e[_0xe1ea('0x1d')]],'as':_0x45524e['as'],'attributes':_0x45524e['attributes'],'include':_0x45524e[_0xe1ea('0x1c')]?_['map'](_0x45524e[_0xe1ea('0x1c')],function(_0x5859da){return{'model':db[_0x5859da[_0xe1ea('0x1d')]],'as':_0x5859da['as'],'attributes':_0x5859da[_0xe1ea('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe1ea('0xd')](function(_0x45a1d3){logger[_0xe1ea('0xe')]('GetZendeskAccount',_0x47f18b);logger[_0xe1ea('0x1e')]('GetZendeskAccount',_0x47f18b,JSON[_0xe1ea('0x11')](_0x45a1d3));_0x5bc6a5(_0x45a1d3);})[_0xe1ea('0x1f')](function(_0x3a2254){logger[_0xe1ea('0x12')]('GetZendeskAccount',_0x3a2254[_0xe1ea('0x14')],_0x47f18b);_0x1d56fb(_0x5f512a[_0xe1ea('0x12')](0x1f4,_0x3a2254[_0xe1ea('0x14')]));});});};exports[_0xe1ea('0x20')]=function(_0xaadc4c){var _0x394a28=this;return new Promise(function(_0x1be5cd,_0x18c28b){return db[_0xe1ea('0x21')][_0xe1ea('0x22')]({'raw':_0xaadc4c[_0xe1ea('0x17')]?_0xaadc4c['options'][_0xe1ea('0x18')]===undefined?!![]:![]:!![],'where':_0xaadc4c['options']?_0xaadc4c[_0xe1ea('0x17')][_0xe1ea('0x19')]||null:null,'attributes':_0xaadc4c[_0xe1ea('0x17')]?_0xaadc4c[_0xe1ea('0x17')]['attributes']||null:null,'include':_0xaadc4c[_0xe1ea('0x17')]?_0xaadc4c[_0xe1ea('0x17')][_0xe1ea('0x1c')]?_[_0xe1ea('0x23')](_0xaadc4c[_0xe1ea('0x17')]['include'],function(_0x24e0e5){return{'model':db[_0x24e0e5['model']],'as':_0x24e0e5['as'],'attributes':_0x24e0e5[_0xe1ea('0x1a')],'include':_0x24e0e5[_0xe1ea('0x1c')]?_['map'](_0x24e0e5[_0xe1ea('0x1c')],function(_0x12c2c7){return{'model':db[_0x12c2c7[_0xe1ea('0x1d')]],'as':_0x12c2c7['as'],'attributes':_0x12c2c7[_0xe1ea('0x1a')],'include':_0x12c2c7[_0xe1ea('0x1c')]?_[_0xe1ea('0x23')](_0x12c2c7[_0xe1ea('0x1c')],function(_0x103aa4){return{'model':db[_0x103aa4[_0xe1ea('0x1d')]],'as':_0x103aa4['as'],'attributes':_0x103aa4[_0xe1ea('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe1ea('0xd')](function(_0x5c4692){logger[_0xe1ea('0xe')](_0xe1ea('0x20'),_0xaadc4c);logger['debug']('ShowZendeskAccount',_0xaadc4c,JSON[_0xe1ea('0x11')](_0x5c4692));_0x1be5cd(_0x5c4692);})['catch'](function(_0x3e9c26){logger['error']('ShowZendeskAccount',_0x3e9c26[_0xe1ea('0x14')],_0xaadc4c);_0x18c28b(_0x394a28[_0xe1ea('0x12')](0x1f4,_0x3e9c26[_0xe1ea('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 91c9024..9d5f5e5 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 _0x91a7=['util','path','connect-timeout','Router','../../components/auth/service','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','create','put','update','destroy','exports'];(function(_0x5e9fc1,_0x55da46){var _0x185f78=function(_0x50c23a){while(--_0x50c23a){_0x5e9fc1['push'](_0x5e9fc1['shift']());}};_0x185f78(++_0x55da46);}(_0x91a7,0xe7));var _0x791a=function(_0x310227,_0x25eb57){_0x310227=_0x310227-0x0;var _0x4a3da3=_0x91a7[_0x310227];return _0x4a3da3;};'use strict';var multer=require('multer');var util=require(_0x791a('0x0'));var path=require(_0x791a('0x1'));var timeout=require(_0x791a('0x2'));var express=require('express');var router=express[_0x791a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x791a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x791a('0x5'));router[_0x791a('0x6')]('/',auth['isAuthenticated'](),controller[_0x791a('0x7')]);router['get'](_0x791a('0x8'),auth[_0x791a('0x9')](),controller['show']);router[_0x791a('0x6')](_0x791a('0xa'),auth[_0x791a('0x9')](),controller[_0x791a('0xb')]);router[_0x791a('0x6')]('/:id/subjects',auth[_0x791a('0x9')](),controller[_0x791a('0xc')]);router['get'](_0x791a('0xd'),auth[_0x791a('0x9')](),controller[_0x791a('0xe')]);router[_0x791a('0x6')](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['getTags']);router['post']('/',auth[_0x791a('0x9')](),controller[_0x791a('0x10')]);router['post'](_0x791a('0xf'),auth[_0x791a('0x9')](),controller['setTags']);router[_0x791a('0x11')](_0x791a('0x8'),auth[_0x791a('0x9')](),controller[_0x791a('0x12')]);router['delete'](_0x791a('0x8'),auth['isAuthenticated'](),controller[_0x791a('0x13')]);module[_0x791a('0x14')]=router; \ No newline at end of file +var _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x3a9497,_0x1f2bd5){var _0x438741=function(_0x533615){while(--_0x533615){_0x3a9497['push'](_0x3a9497['shift']());}};_0x438741(++_0x1f2bd5);}(_0xb10b,0x12a));var _0xbb10=function(_0x1c97c8,_0x28d564){_0x1c97c8=_0x1c97c8-0x0;var _0x2c096d=_0xb10b[_0x1c97c8];return _0x2c096d;};'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['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 8972b8b..8344846 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 _0x5c1c=['STRING','sequelize'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0x5c1c,0x1cd));var _0xc5c1=function(_0x2ccde1,_0x517b95){_0x2ccde1=_0x2ccde1-0x0;var _0x5ace01=_0x5c1c[_0x2ccde1];return _0x5ace01;};'use strict';var Sequelize=require(_0xc5c1('0x0'));module['exports']={'name':{'type':Sequelize[_0xc5c1('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x700c=['STRING','sequelize','exports'];(function(_0x950c48,_0x3acdaf){var _0x20398c=function(_0x1c5aa8){while(--_0x1c5aa8){_0x950c48['push'](_0x950c48['shift']());}};_0x20398c(++_0x3acdaf);}(_0x700c,0x7f));var _0xc700=function(_0x482f29,_0x50af2f){_0x482f29=_0x482f29-0x0;var _0x2b74b8=_0x700c[_0x482f29];return _0x2b74b8;};'use strict';var Sequelize=require(_0xc700('0x0'));module[_0xc700('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc700('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index b3a6e38..efa75b6 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 _0xa1bc=['../../config/license/util','status','json','offset','undefined','limit','count','set','apply','destroy','error','stack','name','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','findAll','rows','then','catch','show','params','include','options','find','create','body','getFields','findOne','pick','ZendeskField','getSubjects','getDescriptions','getTags','Tag','nolimit','setTags','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x59e21c,_0x4d77b9){var _0x199b4c=function(_0x3034f0){while(--_0x3034f0){_0x59e21c['push'](_0x59e21c['shift']());}};_0x199b4c(++_0x4d77b9);}(_0xa1bc,0x1be));var _0xca1b=function(_0x3d5988,_0x241784){_0x3d5988=_0x3d5988-0x0;var _0x1f30a2=_0xa1bc[_0x3d5988];return _0x1f30a2;};'use strict';var emlformat=require(_0xca1b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xca1b('0x1'));var jsonpatch=require(_0xca1b('0x2'));var rp=require('request-promise');var moment=require(_0xca1b('0x3'));var BPromise=require(_0xca1b('0x4'));var Mustache=require('mustache');var util=require(_0xca1b('0x5'));var path=require(_0xca1b('0x6'));var sox=require(_0xca1b('0x7'));var csv=require('to-csv');var ejs=require(_0xca1b('0x8'));var fs=require('fs');var fs_extra=require(_0xca1b('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xca1b('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xca1b('0xb'));var toCsv=require(_0xca1b('0xc'));var querystring=require(_0xca1b('0xd'));var Papa=require(_0xca1b('0xe'));var Redis=require(_0xca1b('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xca1b('0x10'));var hardwareService=require(_0xca1b('0x11'));var logger=require(_0xca1b('0x12'))(_0xca1b('0x13'));var utils=require(_0xca1b('0x14'));var config=require(_0xca1b('0x15'));var licenseUtil=require(_0xca1b('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x90a9c1,_0xabd88c){_0xabd88c=_0xabd88c||0xcc;return function(_0x212912){if(_0x212912){return _0x90a9c1['sendStatus'](_0xabd88c);}return _0x90a9c1[_0xca1b('0x17')](_0xabd88c)['end']();};}function respondWithResult(_0x1e876e,_0x3dc614){_0x3dc614=_0x3dc614||0xc8;return function(_0x1c9a9d){if(_0x1c9a9d){return _0x1e876e[_0xca1b('0x17')](_0x3dc614)[_0xca1b('0x18')](_0x1c9a9d);}};}function respondWithFilteredResult(_0x3659f3,_0x221e2f){return function(_0x1bf453){if(_0x1bf453){var _0x3b1b02=typeof _0x221e2f[_0xca1b('0x19')]===_0xca1b('0x1a')&&typeof _0x221e2f[_0xca1b('0x1b')]==='undefined';var _0x4033e2=_0x1bf453[_0xca1b('0x1c')];var _0x13301e=_0x3b1b02?0x0:_0x221e2f[_0xca1b('0x19')];var _0x562bd2=_0x3b1b02?_0x1bf453[_0xca1b('0x1c')]:_0x221e2f[_0xca1b('0x19')]+_0x221e2f[_0xca1b('0x1b')];var _0x37c4d8;if(_0x562bd2>=_0x4033e2){_0x562bd2=_0x4033e2;_0x37c4d8=0xc8;}else{_0x37c4d8=0xce;}_0x3659f3[_0xca1b('0x17')](_0x37c4d8);return _0x3659f3[_0xca1b('0x1d')]('Content-Range',_0x13301e+'-'+_0x562bd2+'/'+_0x4033e2)[_0xca1b('0x18')](_0x1bf453);}return null;};}function patchUpdates(_0x177b40){return function(_0x23e406){try{jsonpatch[_0xca1b('0x1e')](_0x23e406,_0x177b40,!![]);}catch(_0x5d2386){return BPromise['reject'](_0x5d2386);}return _0x23e406['save']();};}function saveUpdates(_0x415207,_0x46a067){return function(_0x19e528){if(_0x19e528){return _0x19e528['update'](_0x415207)['then'](function(_0x430bfa){return _0x430bfa;});}return null;};}function removeEntity(_0x58d3fb,_0x4ec176){return function(_0x1cb20d){if(_0x1cb20d){return _0x1cb20d[_0xca1b('0x1f')]()['then'](function(){_0x58d3fb[_0xca1b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e6a96,_0x5083b3){return function(_0x5586bf){if(!_0x5586bf){_0x1e6a96['sendStatus'](0x194);}return _0x5586bf;};}function handleError(_0x25fdf5,_0x3daf6f){_0x3daf6f=_0x3daf6f||0x1f4;return function(_0x5af9fe){logger[_0xca1b('0x20')](_0x5af9fe[_0xca1b('0x21')]);if(_0x5af9fe['name']){delete _0x5af9fe[_0xca1b('0x22')];}_0x25fdf5[_0xca1b('0x17')](_0x3daf6f)['send'](_0x5af9fe);};}exports[_0xca1b('0x23')]=function(_0x15323a,_0x201b58){var _0x422179={},_0x4d2b00={},_0x1fc19f={'count':0x0,'rows':[]};var _0x63357e=_[_0xca1b('0x24')](db[_0xca1b('0x25')][_0xca1b('0x26')],function(_0x14a55d){return{'name':_0x14a55d[_0xca1b('0x27')],'type':_0x14a55d[_0xca1b('0x28')][_0xca1b('0x29')]};});_0x4d2b00[_0xca1b('0x2a')]=_['map'](_0x63357e,_0xca1b('0x22'));_0x4d2b00[_0xca1b('0x2b')]=_[_0xca1b('0x2c')](_0x15323a[_0xca1b('0x2b')]);_0x4d2b00[_0xca1b('0x2d')]=_[_0xca1b('0x2e')](_0x4d2b00[_0xca1b('0x2a')],_0x4d2b00['query']);_0x422179[_0xca1b('0x2f')]=_['intersection'](_0x4d2b00['model'],qs[_0xca1b('0x30')](_0x15323a[_0xca1b('0x2b')][_0xca1b('0x30')]));_0x422179[_0xca1b('0x2f')]=_0x422179[_0xca1b('0x2f')][_0xca1b('0x31')]?_0x422179['attributes']:_0x4d2b00['model'];if(!_0x15323a[_0xca1b('0x2b')][_0xca1b('0x32')]('nolimit')){_0x422179[_0xca1b('0x1b')]=qs[_0xca1b('0x1b')](_0x15323a['query']['limit']);_0x422179['offset']=qs[_0xca1b('0x19')](_0x15323a[_0xca1b('0x2b')][_0xca1b('0x19')]);}_0x422179[_0xca1b('0x33')]=qs[_0xca1b('0x34')](_0x15323a['query']['sort']);_0x422179[_0xca1b('0x35')]=qs[_0xca1b('0x2d')](_['pick'](_0x15323a['query'],_0x4d2b00[_0xca1b('0x2d')]),_0x63357e);if(_0x15323a[_0xca1b('0x2b')][_0xca1b('0x36')]){_0x422179['where']=_[_0xca1b('0x37')](_0x422179['where'],{'$or':_[_0xca1b('0x24')](_0x63357e,function(_0x4eba9c){if(_0x4eba9c[_0xca1b('0x28')]!=='VIRTUAL'){var _0x422b31={};_0x422b31[_0x4eba9c[_0xca1b('0x22')]]={'$like':'%'+_0x15323a['query'][_0xca1b('0x36')]+'%'};return _0x422b31;}})});}_0x422179=_[_0xca1b('0x37')]({},_0x422179,_0x15323a['options']);var _0xa5ca12={'where':_0x422179[_0xca1b('0x35')]};return db['ZendeskConfiguration'][_0xca1b('0x1c')](_0xa5ca12)['then'](function(_0xf43548){_0x1fc19f[_0xca1b('0x1c')]=_0xf43548;if(_0x15323a[_0xca1b('0x2b')][_0xca1b('0x38')]){_0x422179['include']=[{'all':!![]}];}return db[_0xca1b('0x25')][_0xca1b('0x39')](_0x422179);})['then'](function(_0x24e387){_0x1fc19f[_0xca1b('0x3a')]=_0x24e387;return _0x1fc19f;})[_0xca1b('0x3b')](respondWithFilteredResult(_0x201b58,_0x422179))[_0xca1b('0x3c')](handleError(_0x201b58,null));};exports[_0xca1b('0x3d')]=function(_0x40c46f,_0x74496f){var _0x389ac3={'raw':![],'where':{'id':_0x40c46f[_0xca1b('0x3e')]['id']}},_0x151f9d={};_0x151f9d['model']=_[_0xca1b('0x2c')](db[_0xca1b('0x25')][_0xca1b('0x26')]);_0x151f9d[_0xca1b('0x2b')]=_[_0xca1b('0x2c')](_0x40c46f[_0xca1b('0x2b')]);_0x151f9d[_0xca1b('0x2d')]=_['intersection'](_0x151f9d['model'],_0x151f9d[_0xca1b('0x2b')]);_0x389ac3['attributes']=_['intersection'](_0x151f9d['model'],qs[_0xca1b('0x30')](_0x40c46f[_0xca1b('0x2b')][_0xca1b('0x30')]));_0x389ac3['attributes']=_0x389ac3[_0xca1b('0x2f')][_0xca1b('0x31')]?_0x389ac3['attributes']:_0x151f9d[_0xca1b('0x2a')];if(_0x40c46f[_0xca1b('0x2b')][_0xca1b('0x38')]){_0x389ac3[_0xca1b('0x3f')]=[{'all':!![]}];}_0x389ac3=_[_0xca1b('0x37')]({},_0x389ac3,_0x40c46f[_0xca1b('0x40')]);return db[_0xca1b('0x25')][_0xca1b('0x41')](_0x389ac3)[_0xca1b('0x3b')](handleEntityNotFound(_0x74496f,null))[_0xca1b('0x3b')](respondWithResult(_0x74496f,null))['catch'](handleError(_0x74496f,null));};exports['create']=function(_0x1754f4,_0x1aaed0){return db[_0xca1b('0x25')][_0xca1b('0x42')](_0x1754f4[_0xca1b('0x43')],{})['then'](respondWithResult(_0x1aaed0,0xc9))[_0xca1b('0x3c')](handleError(_0x1aaed0,null));};exports['update']=function(_0x17e990,_0x330bee){if(_0x17e990['body']['id']){delete _0x17e990['body']['id'];}return db[_0xca1b('0x25')][_0xca1b('0x41')]({'where':{'id':_0x17e990[_0xca1b('0x3e')]['id']}})[_0xca1b('0x3b')](handleEntityNotFound(_0x330bee,null))['then'](saveUpdates(_0x17e990['body'],null))['then'](respondWithResult(_0x330bee,null))[_0xca1b('0x3c')](handleError(_0x330bee,null));};exports[_0xca1b('0x1f')]=function(_0x170238,_0x2595a6){return db[_0xca1b('0x25')][_0xca1b('0x41')]({'where':{'id':_0x170238[_0xca1b('0x3e')]['id']}})[_0xca1b('0x3b')](handleEntityNotFound(_0x2595a6,null))[_0xca1b('0x3b')](removeEntity(_0x2595a6,null))[_0xca1b('0x3c')](handleError(_0x2595a6,null));};exports[_0xca1b('0x44')]=function(_0xe2417c,_0x4ff6ce,_0x344caa){var _0x323929={};var _0x20a4ed={};var _0x238865;var _0x373c33;return db[_0xca1b('0x25')][_0xca1b('0x45')]({'where':{'id':_0xe2417c[_0xca1b('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4ff6ce,null))['then'](function(_0x217861){if(_0x217861){_0x238865=_0x217861;_0x20a4ed[_0xca1b('0x2a')]=_['keys'](db['ZendeskField']['rawAttributes']);_0x20a4ed[_0xca1b('0x2b')]=_[_0xca1b('0x2c')](_0xe2417c[_0xca1b('0x2b')]);_0x20a4ed[_0xca1b('0x2d')]=_[_0xca1b('0x2e')](_0x20a4ed[_0xca1b('0x2a')],_0x20a4ed[_0xca1b('0x2b')]);_0x323929[_0xca1b('0x2f')]=_[_0xca1b('0x2e')](_0x20a4ed[_0xca1b('0x2a')],qs[_0xca1b('0x30')](_0xe2417c[_0xca1b('0x2b')][_0xca1b('0x30')]));_0x323929[_0xca1b('0x2f')]=_0x323929['attributes']['length']?_0x323929[_0xca1b('0x2f')]:_0x20a4ed['model'];_0x323929[_0xca1b('0x33')]=qs['sort'](_0xe2417c[_0xca1b('0x2b')][_0xca1b('0x34')]);_0x323929['where']=qs[_0xca1b('0x2d')](_[_0xca1b('0x46')](_0xe2417c['query'],_0x20a4ed[_0xca1b('0x2d')]));if(_0xe2417c[_0xca1b('0x2b')][_0xca1b('0x36')]){_0x323929[_0xca1b('0x35')]=_['merge'](_0x323929[_0xca1b('0x35')],{'$or':_[_0xca1b('0x24')](_0x323929[_0xca1b('0x2f')],function(_0x2d3ac0){var _0x597231={};_0x597231[_0x2d3ac0]={'$like':'%'+_0xe2417c['query']['filter']+'%'};return _0x597231;})});}_0x323929=_[_0xca1b('0x37')]({},_0x323929,_0xe2417c['options']);return _0x238865['getFields'](_0x323929);}})['then'](function(_0x5dc450){if(_0x5dc450){_0x373c33=_0x5dc450[_0xca1b('0x31')];if(!_0xe2417c[_0xca1b('0x2b')][_0xca1b('0x32')]('nolimit')){_0x323929[_0xca1b('0x1b')]=qs['limit'](_0xe2417c['query'][_0xca1b('0x1b')]);_0x323929['offset']=qs[_0xca1b('0x19')](_0xe2417c[_0xca1b('0x2b')][_0xca1b('0x19')]);}return _0x238865[_0xca1b('0x44')](_0x323929);}})['then'](function(_0x2fc220){if(_0x2fc220){return _0x2fc220?{'count':_0x373c33,'rows':_0x2fc220}:null;}})[_0xca1b('0x3b')](respondWithResult(_0x4ff6ce,null))[_0xca1b('0x3c')](handleError(_0x4ff6ce,null));};exports['getSubjects']=function(_0x1d3baa,_0x423100,_0x3945c4){var _0x4ce132={};var _0x3576b9={};var _0x15d412;var _0x3b350c;return db['ZendeskConfiguration'][_0xca1b('0x45')]({'where':{'id':_0x1d3baa[_0xca1b('0x3e')]['id']}})[_0xca1b('0x3b')](handleEntityNotFound(_0x423100,null))['then'](function(_0x51496f){if(_0x51496f){_0x15d412=_0x51496f;_0x3576b9[_0xca1b('0x2a')]=_['keys'](db[_0xca1b('0x47')][_0xca1b('0x26')]);_0x3576b9[_0xca1b('0x2b')]=_[_0xca1b('0x2c')](_0x1d3baa[_0xca1b('0x2b')]);_0x3576b9[_0xca1b('0x2d')]=_[_0xca1b('0x2e')](_0x3576b9['model'],_0x3576b9[_0xca1b('0x2b')]);_0x4ce132[_0xca1b('0x2f')]=_['intersection'](_0x3576b9[_0xca1b('0x2a')],qs[_0xca1b('0x30')](_0x1d3baa[_0xca1b('0x2b')][_0xca1b('0x30')]));_0x4ce132[_0xca1b('0x2f')]=_0x4ce132[_0xca1b('0x2f')][_0xca1b('0x31')]?_0x4ce132[_0xca1b('0x2f')]:_0x3576b9[_0xca1b('0x2a')];_0x4ce132['order']=qs[_0xca1b('0x34')](_0x1d3baa[_0xca1b('0x2b')]['sort']);_0x4ce132[_0xca1b('0x35')]=qs[_0xca1b('0x2d')](_[_0xca1b('0x46')](_0x1d3baa[_0xca1b('0x2b')],_0x3576b9[_0xca1b('0x2d')]));if(_0x1d3baa[_0xca1b('0x2b')]['filter']){_0x4ce132[_0xca1b('0x35')]=_[_0xca1b('0x37')](_0x4ce132[_0xca1b('0x35')],{'$or':_['map'](_0x4ce132[_0xca1b('0x2f')],function(_0x5a3714){var _0x3085a3={};_0x3085a3[_0x5a3714]={'$like':'%'+_0x1d3baa[_0xca1b('0x2b')][_0xca1b('0x36')]+'%'};return _0x3085a3;})});}_0x4ce132=_['merge']({},_0x4ce132,_0x1d3baa[_0xca1b('0x40')]);return _0x15d412['getSubjects'](_0x4ce132);}})[_0xca1b('0x3b')](function(_0x496537){if(_0x496537){_0x3b350c=_0x496537[_0xca1b('0x31')];if(!_0x1d3baa['query']['hasOwnProperty']('nolimit')){_0x4ce132[_0xca1b('0x1b')]=qs['limit'](_0x1d3baa[_0xca1b('0x2b')]['limit']);_0x4ce132['offset']=qs[_0xca1b('0x19')](_0x1d3baa[_0xca1b('0x2b')][_0xca1b('0x19')]);}return _0x15d412[_0xca1b('0x48')](_0x4ce132);}})[_0xca1b('0x3b')](function(_0xf62435){if(_0xf62435){return _0xf62435?{'count':_0x3b350c,'rows':_0xf62435}:null;}})[_0xca1b('0x3b')](respondWithResult(_0x423100,null))['catch'](handleError(_0x423100,null));};exports[_0xca1b('0x49')]=function(_0x214019,_0x292d3b,_0x46eb26){var _0x46fa8c={};var _0x54056b={};var _0x3db795;var _0x2e4498;return db[_0xca1b('0x25')][_0xca1b('0x45')]({'where':{'id':_0x214019[_0xca1b('0x3e')]['id']}})[_0xca1b('0x3b')](handleEntityNotFound(_0x292d3b,null))[_0xca1b('0x3b')](function(_0xf0bf31){if(_0xf0bf31){_0x3db795=_0xf0bf31;_0x54056b[_0xca1b('0x2a')]=_[_0xca1b('0x2c')](db[_0xca1b('0x47')][_0xca1b('0x26')]);_0x54056b[_0xca1b('0x2b')]=_['keys'](_0x214019[_0xca1b('0x2b')]);_0x54056b[_0xca1b('0x2d')]=_[_0xca1b('0x2e')](_0x54056b['model'],_0x54056b['query']);_0x46fa8c[_0xca1b('0x2f')]=_[_0xca1b('0x2e')](_0x54056b[_0xca1b('0x2a')],qs[_0xca1b('0x30')](_0x214019['query'][_0xca1b('0x30')]));_0x46fa8c[_0xca1b('0x2f')]=_0x46fa8c[_0xca1b('0x2f')][_0xca1b('0x31')]?_0x46fa8c[_0xca1b('0x2f')]:_0x54056b['model'];_0x46fa8c[_0xca1b('0x33')]=qs[_0xca1b('0x34')](_0x214019[_0xca1b('0x2b')][_0xca1b('0x34')]);_0x46fa8c[_0xca1b('0x35')]=qs['filters'](_[_0xca1b('0x46')](_0x214019[_0xca1b('0x2b')],_0x54056b[_0xca1b('0x2d')]));if(_0x214019[_0xca1b('0x2b')][_0xca1b('0x36')]){_0x46fa8c['where']=_[_0xca1b('0x37')](_0x46fa8c[_0xca1b('0x35')],{'$or':_[_0xca1b('0x24')](_0x46fa8c[_0xca1b('0x2f')],function(_0x13a747){var _0x53b9c4={};_0x53b9c4[_0x13a747]={'$like':'%'+_0x214019['query'][_0xca1b('0x36')]+'%'};return _0x53b9c4;})});}_0x46fa8c=_['merge']({},_0x46fa8c,_0x214019[_0xca1b('0x40')]);return _0x3db795[_0xca1b('0x49')](_0x46fa8c);}})[_0xca1b('0x3b')](function(_0x423638){if(_0x423638){_0x2e4498=_0x423638[_0xca1b('0x31')];if(!_0x214019['query']['hasOwnProperty']('nolimit')){_0x46fa8c[_0xca1b('0x1b')]=qs['limit'](_0x214019[_0xca1b('0x2b')][_0xca1b('0x1b')]);_0x46fa8c[_0xca1b('0x19')]=qs[_0xca1b('0x19')](_0x214019[_0xca1b('0x2b')]['offset']);}return _0x3db795['getDescriptions'](_0x46fa8c);}})['then'](function(_0x4efacb){if(_0x4efacb){return _0x4efacb?{'count':_0x2e4498,'rows':_0x4efacb}:null;}})['then'](respondWithResult(_0x292d3b,null))[_0xca1b('0x3c')](handleError(_0x292d3b,null));};exports[_0xca1b('0x4a')]=function(_0xe06cf9,_0xec8601,_0x44ea91){var _0x4a3abf={};var _0x252053={};var _0x1721b6;var _0x55506a;return db['ZendeskConfiguration'][_0xca1b('0x45')]({'where':{'id':_0xe06cf9[_0xca1b('0x3e')]['id']}})[_0xca1b('0x3b')](handleEntityNotFound(_0xec8601,null))[_0xca1b('0x3b')](function(_0x43565a){if(_0x43565a){_0x1721b6=_0x43565a;_0x252053[_0xca1b('0x2a')]=_[_0xca1b('0x2c')](db[_0xca1b('0x4b')][_0xca1b('0x26')]);_0x252053[_0xca1b('0x2b')]=_[_0xca1b('0x2c')](_0xe06cf9[_0xca1b('0x2b')]);_0x252053[_0xca1b('0x2d')]=_[_0xca1b('0x2e')](_0x252053[_0xca1b('0x2a')],_0x252053['query']);_0x4a3abf[_0xca1b('0x2f')]=_[_0xca1b('0x2e')](_0x252053[_0xca1b('0x2a')],qs[_0xca1b('0x30')](_0xe06cf9[_0xca1b('0x2b')][_0xca1b('0x30')]));_0x4a3abf[_0xca1b('0x2f')]=_0x4a3abf['attributes'][_0xca1b('0x31')]?_0x4a3abf['attributes']:_0x252053[_0xca1b('0x2a')];_0x4a3abf[_0xca1b('0x33')]=qs['sort'](_0xe06cf9[_0xca1b('0x2b')][_0xca1b('0x34')]);_0x4a3abf[_0xca1b('0x35')]=qs[_0xca1b('0x2d')](_[_0xca1b('0x46')](_0xe06cf9['query'],_0x252053[_0xca1b('0x2d')]));if(_0xe06cf9[_0xca1b('0x2b')][_0xca1b('0x36')]){_0x4a3abf['where']=_['merge'](_0x4a3abf[_0xca1b('0x35')],{'$or':_[_0xca1b('0x24')](_0x4a3abf[_0xca1b('0x2f')],function(_0x179774){var _0x20d9c1={};_0x20d9c1[_0x179774]={'$like':'%'+_0xe06cf9[_0xca1b('0x2b')]['filter']+'%'};return _0x20d9c1;})});}_0x4a3abf=_[_0xca1b('0x37')]({},_0x4a3abf,_0xe06cf9[_0xca1b('0x40')]);return _0x1721b6[_0xca1b('0x4a')](_0x4a3abf);}})[_0xca1b('0x3b')](function(_0x3d9889){if(_0x3d9889){_0x55506a=_0x3d9889[_0xca1b('0x31')];if(!_0xe06cf9[_0xca1b('0x2b')][_0xca1b('0x32')](_0xca1b('0x4c'))){_0x4a3abf[_0xca1b('0x1b')]=qs[_0xca1b('0x1b')](_0xe06cf9[_0xca1b('0x2b')][_0xca1b('0x1b')]);_0x4a3abf[_0xca1b('0x19')]=qs[_0xca1b('0x19')](_0xe06cf9[_0xca1b('0x2b')]['offset']);}return _0x1721b6[_0xca1b('0x4a')](_0x4a3abf);}})[_0xca1b('0x3b')](function(_0x1940b6){if(_0x1940b6){return _0x1940b6?{'count':_0x55506a,'rows':_0x1940b6}:null;}})['then'](respondWithResult(_0xec8601,null))[_0xca1b('0x3c')](handleError(_0xec8601,null));};exports[_0xca1b('0x4d')]=function(_0x5cf916,_0x7dd06c,_0x124e2d){if(_0x5cf916[_0xca1b('0x43')]['id']){delete _0x5cf916[_0xca1b('0x43')]['id'];}return db[_0xca1b('0x25')][_0xca1b('0x45')]({'where':{'id':_0x5cf916['params']['id']}})[_0xca1b('0x3b')](handleEntityNotFound(_0x7dd06c,null))[_0xca1b('0x3b')](function(_0x21d0db){if(_0x21d0db){return _0x21d0db[_0xca1b('0x4d')](_0x5cf916[_0xca1b('0x43')]['ids']||[]);}return null;})[_0xca1b('0x3b')](respondWithResult(_0x7dd06c,null))[_0xca1b('0x3c')](handleError(_0x7dd06c,null));}; \ No newline at end of file +var _0x5564=['show','params','catch','create','body','find','getFields','ZendeskField','map','getSubjects','findOne','getDescriptions','getTags','setTags','ids','fast-json-patch','request-promise','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','ZendeskConfiguration','rawAttributes','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows'];(function(_0x62a1b7,_0x277a85){var _0x4fd666=function(_0xa125e8){while(--_0xa125e8){_0x62a1b7['push'](_0x62a1b7['shift']());}};_0x4fd666(++_0x277a85);}(_0x5564,0x1a9));var _0x4556=function(_0x138379,_0x58ed3d){_0x138379=_0x138379-0x0;var _0x334b91=_0x5564[_0x138379];return _0x334b91;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4556('0x0'));var rp=require(_0x4556('0x1'));var moment=require('moment');var BPromise=require(_0x4556('0x2'));var Mustache=require(_0x4556('0x3'));var util=require(_0x4556('0x4'));var path=require(_0x4556('0x5'));var sox=require(_0x4556('0x6'));var csv=require(_0x4556('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4556('0x8'));var _=require(_0x4556('0x9'));var squel=require('squel');var crypto=require(_0x4556('0xa'));var jsforce=require(_0x4556('0xb'));var deskjs=require(_0x4556('0xc'));var toCsv=require('to-csv');var querystring=require(_0x4556('0xd'));var Papa=require('papaparse');var Redis=require(_0x4556('0xe'));var authService=require(_0x4556('0xf'));var qs=require(_0x4556('0x10'));var as=require(_0x4556('0x11'));var hardwareService=require(_0x4556('0x12'));var logger=require(_0x4556('0x13'))(_0x4556('0x14'));var utils=require(_0x4556('0x15'));var config=require(_0x4556('0x16'));var licenseUtil=require(_0x4556('0x17'));var db=require(_0x4556('0x18'))['db'];function respondWithStatusCode(_0x509c38,_0x15bf99){_0x15bf99=_0x15bf99||0xcc;return function(_0x294585){if(_0x294585){return _0x509c38[_0x4556('0x19')](_0x15bf99);}return _0x509c38[_0x4556('0x1a')](_0x15bf99)['end']();};}function respondWithResult(_0x339f43,_0x34b37e){_0x34b37e=_0x34b37e||0xc8;return function(_0xe4cd95){if(_0xe4cd95){return _0x339f43[_0x4556('0x1a')](_0x34b37e)[_0x4556('0x1b')](_0xe4cd95);}};}function respondWithFilteredResult(_0x1b0e1a,_0x20f8e2){return function(_0x58df6f){if(_0x58df6f){var _0x28819e=typeof _0x20f8e2['offset']==='undefined'&&typeof _0x20f8e2['limit']===_0x4556('0x1c');var _0x2d8957=_0x58df6f['count'];var _0x47f117=_0x28819e?0x0:_0x20f8e2[_0x4556('0x1d')];var _0x7d325c=_0x28819e?_0x58df6f['count']:_0x20f8e2['offset']+_0x20f8e2['limit'];var _0x42986f;if(_0x7d325c>=_0x2d8957){_0x7d325c=_0x2d8957;_0x42986f=0xc8;}else{_0x42986f=0xce;}_0x1b0e1a[_0x4556('0x1a')](_0x42986f);return _0x1b0e1a[_0x4556('0x1e')](_0x4556('0x1f'),_0x47f117+'-'+_0x7d325c+'/'+_0x2d8957)['json'](_0x58df6f);}return null;};}function patchUpdates(_0xf828cd){return function(_0x32b3f3){try{jsonpatch[_0x4556('0x20')](_0x32b3f3,_0xf828cd,!![]);}catch(_0x2b2bf5){return BPromise[_0x4556('0x21')](_0x2b2bf5);}return _0x32b3f3[_0x4556('0x22')]();};}function saveUpdates(_0x1acafa,_0x5a69f1){return function(_0x189204){if(_0x189204){return _0x189204[_0x4556('0x23')](_0x1acafa)[_0x4556('0x24')](function(_0x2ae67c){return _0x2ae67c;});}return null;};}function removeEntity(_0x528888,_0x5c492e){return function(_0x2aab19){if(_0x2aab19){return _0x2aab19[_0x4556('0x25')]()[_0x4556('0x24')](function(){_0x528888[_0x4556('0x1a')](0xcc)[_0x4556('0x26')]();});}};}function handleEntityNotFound(_0x94522,_0x1c4eaa){return function(_0x1636a9){if(!_0x1636a9){_0x94522[_0x4556('0x19')](0x194);}return _0x1636a9;};}function handleError(_0x2dc544,_0x54664e){_0x54664e=_0x54664e||0x1f4;return function(_0x409ca8){logger['error'](_0x409ca8[_0x4556('0x27')]);if(_0x409ca8[_0x4556('0x28')]){delete _0x409ca8[_0x4556('0x28')];}_0x2dc544[_0x4556('0x1a')](_0x54664e)[_0x4556('0x29')](_0x409ca8);};}exports['index']=function(_0x741a7b,_0x2d596f){var _0x478288={},_0x369802={},_0x2bda9e={'count':0x0,'rows':[]};var _0x118e9b=_['map'](db[_0x4556('0x2a')][_0x4556('0x2b')],function(_0x247e7a){return{'name':_0x247e7a['fieldName'],'type':_0x247e7a[_0x4556('0x2c')]['key']};});_0x369802[_0x4556('0x2d')]=_['map'](_0x118e9b,'name');_0x369802['query']=_[_0x4556('0x2e')](_0x741a7b[_0x4556('0x2f')]);_0x369802[_0x4556('0x30')]=_[_0x4556('0x31')](_0x369802['model'],_0x369802['query']);_0x478288[_0x4556('0x32')]=_[_0x4556('0x31')](_0x369802[_0x4556('0x2d')],qs[_0x4556('0x33')](_0x741a7b[_0x4556('0x2f')][_0x4556('0x33')]));_0x478288[_0x4556('0x32')]=_0x478288[_0x4556('0x32')][_0x4556('0x34')]?_0x478288[_0x4556('0x32')]:_0x369802[_0x4556('0x2d')];if(!_0x741a7b[_0x4556('0x2f')][_0x4556('0x35')](_0x4556('0x36'))){_0x478288['limit']=qs['limit'](_0x741a7b['query'][_0x4556('0x37')]);_0x478288[_0x4556('0x1d')]=qs[_0x4556('0x1d')](_0x741a7b[_0x4556('0x2f')][_0x4556('0x1d')]);}_0x478288[_0x4556('0x38')]=qs['sort'](_0x741a7b[_0x4556('0x2f')][_0x4556('0x39')]);_0x478288[_0x4556('0x3a')]=qs[_0x4556('0x30')](_[_0x4556('0x3b')](_0x741a7b[_0x4556('0x2f')],_0x369802[_0x4556('0x30')]),_0x118e9b);if(_0x741a7b[_0x4556('0x2f')][_0x4556('0x3c')]){_0x478288[_0x4556('0x3a')]=_[_0x4556('0x3d')](_0x478288[_0x4556('0x3a')],{'$or':_['map'](_0x118e9b,function(_0x16ca92){if(_0x16ca92[_0x4556('0x2c')]!=='VIRTUAL'){var _0x44d76c={};_0x44d76c[_0x16ca92[_0x4556('0x28')]]={'$like':'%'+_0x741a7b[_0x4556('0x2f')][_0x4556('0x3c')]+'%'};return _0x44d76c;}})});}_0x478288=_['merge']({},_0x478288,_0x741a7b[_0x4556('0x3e')]);var _0x526cc7={'where':_0x478288['where']};return db[_0x4556('0x2a')]['count'](_0x526cc7)[_0x4556('0x24')](function(_0x33dca4){_0x2bda9e['count']=_0x33dca4;if(_0x741a7b[_0x4556('0x2f')][_0x4556('0x3f')]){_0x478288[_0x4556('0x40')]=[{'all':!![]}];}return db[_0x4556('0x2a')][_0x4556('0x41')](_0x478288);})[_0x4556('0x24')](function(_0x593639){_0x2bda9e[_0x4556('0x42')]=_0x593639;return _0x2bda9e;})[_0x4556('0x24')](respondWithFilteredResult(_0x2d596f,_0x478288))['catch'](handleError(_0x2d596f,null));};exports[_0x4556('0x43')]=function(_0x12f821,_0x2bbf75){var _0x799e54={'raw':![],'where':{'id':_0x12f821[_0x4556('0x44')]['id']}},_0x325f68={};_0x325f68['model']=_['keys'](db[_0x4556('0x2a')][_0x4556('0x2b')]);_0x325f68[_0x4556('0x2f')]=_[_0x4556('0x2e')](_0x12f821[_0x4556('0x2f')]);_0x325f68['filters']=_[_0x4556('0x31')](_0x325f68[_0x4556('0x2d')],_0x325f68[_0x4556('0x2f')]);_0x799e54['attributes']=_['intersection'](_0x325f68['model'],qs[_0x4556('0x33')](_0x12f821[_0x4556('0x2f')][_0x4556('0x33')]));_0x799e54[_0x4556('0x32')]=_0x799e54['attributes'][_0x4556('0x34')]?_0x799e54[_0x4556('0x32')]:_0x325f68[_0x4556('0x2d')];if(_0x12f821[_0x4556('0x2f')][_0x4556('0x3f')]){_0x799e54[_0x4556('0x40')]=[{'all':!![]}];}_0x799e54=_['merge']({},_0x799e54,_0x12f821[_0x4556('0x3e')]);return db[_0x4556('0x2a')]['find'](_0x799e54)[_0x4556('0x24')](handleEntityNotFound(_0x2bbf75,null))[_0x4556('0x24')](respondWithResult(_0x2bbf75,null))[_0x4556('0x45')](handleError(_0x2bbf75,null));};exports[_0x4556('0x46')]=function(_0x4b2e96,_0xe925cf){return db[_0x4556('0x2a')][_0x4556('0x46')](_0x4b2e96[_0x4556('0x47')],{})[_0x4556('0x24')](respondWithResult(_0xe925cf,0xc9))[_0x4556('0x45')](handleError(_0xe925cf,null));};exports[_0x4556('0x23')]=function(_0x35ca36,_0x877b9c){if(_0x35ca36['body']['id']){delete _0x35ca36[_0x4556('0x47')]['id'];}return db[_0x4556('0x2a')][_0x4556('0x48')]({'where':{'id':_0x35ca36['params']['id']}})[_0x4556('0x24')](handleEntityNotFound(_0x877b9c,null))[_0x4556('0x24')](saveUpdates(_0x35ca36['body'],null))['then'](respondWithResult(_0x877b9c,null))[_0x4556('0x45')](handleError(_0x877b9c,null));};exports[_0x4556('0x25')]=function(_0x2ad512,_0x1793c0){return db[_0x4556('0x2a')]['find']({'where':{'id':_0x2ad512['params']['id']}})[_0x4556('0x24')](handleEntityNotFound(_0x1793c0,null))[_0x4556('0x24')](removeEntity(_0x1793c0,null))[_0x4556('0x45')](handleError(_0x1793c0,null));};exports[_0x4556('0x49')]=function(_0x71fc4c,_0x2385ab,_0x2381da){var _0x1df25c={};var _0x5217c7={};var _0x507394;var _0x532a9d;return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x71fc4c[_0x4556('0x44')]['id']}})[_0x4556('0x24')](handleEntityNotFound(_0x2385ab,null))['then'](function(_0x1f6d75){if(_0x1f6d75){_0x507394=_0x1f6d75;_0x5217c7[_0x4556('0x2d')]=_[_0x4556('0x2e')](db[_0x4556('0x4a')][_0x4556('0x2b')]);_0x5217c7[_0x4556('0x2f')]=_[_0x4556('0x2e')](_0x71fc4c[_0x4556('0x2f')]);_0x5217c7['filters']=_[_0x4556('0x31')](_0x5217c7[_0x4556('0x2d')],_0x5217c7[_0x4556('0x2f')]);_0x1df25c[_0x4556('0x32')]=_[_0x4556('0x31')](_0x5217c7[_0x4556('0x2d')],qs['fields'](_0x71fc4c[_0x4556('0x2f')][_0x4556('0x33')]));_0x1df25c['attributes']=_0x1df25c[_0x4556('0x32')][_0x4556('0x34')]?_0x1df25c[_0x4556('0x32')]:_0x5217c7[_0x4556('0x2d')];_0x1df25c[_0x4556('0x38')]=qs[_0x4556('0x39')](_0x71fc4c[_0x4556('0x2f')][_0x4556('0x39')]);_0x1df25c['where']=qs['filters'](_[_0x4556('0x3b')](_0x71fc4c['query'],_0x5217c7[_0x4556('0x30')]));if(_0x71fc4c['query'][_0x4556('0x3c')]){_0x1df25c[_0x4556('0x3a')]=_[_0x4556('0x3d')](_0x1df25c[_0x4556('0x3a')],{'$or':_[_0x4556('0x4b')](_0x1df25c['attributes'],function(_0xfd0c92){var _0x3a7624={};_0x3a7624[_0xfd0c92]={'$like':'%'+_0x71fc4c[_0x4556('0x2f')]['filter']+'%'};return _0x3a7624;})});}_0x1df25c=_[_0x4556('0x3d')]({},_0x1df25c,_0x71fc4c[_0x4556('0x3e')]);return _0x507394[_0x4556('0x49')](_0x1df25c);}})['then'](function(_0x50cf3f){if(_0x50cf3f){_0x532a9d=_0x50cf3f['length'];if(!_0x71fc4c['query'][_0x4556('0x35')]('nolimit')){_0x1df25c[_0x4556('0x37')]=qs[_0x4556('0x37')](_0x71fc4c[_0x4556('0x2f')][_0x4556('0x37')]);_0x1df25c[_0x4556('0x1d')]=qs[_0x4556('0x1d')](_0x71fc4c['query'][_0x4556('0x1d')]);}return _0x507394[_0x4556('0x49')](_0x1df25c);}})[_0x4556('0x24')](function(_0x163de2){if(_0x163de2){return _0x163de2?{'count':_0x532a9d,'rows':_0x163de2}:null;}})[_0x4556('0x24')](respondWithResult(_0x2385ab,null))['catch'](handleError(_0x2385ab,null));};exports[_0x4556('0x4c')]=function(_0x315722,_0x3f2f6b,_0x43cbb4){var _0x3dff24={};var _0x12d619={};var _0x183639;var _0x2557de;return db[_0x4556('0x2a')][_0x4556('0x4d')]({'where':{'id':_0x315722[_0x4556('0x44')]['id']}})[_0x4556('0x24')](handleEntityNotFound(_0x3f2f6b,null))[_0x4556('0x24')](function(_0xf0f5d9){if(_0xf0f5d9){_0x183639=_0xf0f5d9;_0x12d619[_0x4556('0x2d')]=_[_0x4556('0x2e')](db[_0x4556('0x4a')][_0x4556('0x2b')]);_0x12d619['query']=_[_0x4556('0x2e')](_0x315722[_0x4556('0x2f')]);_0x12d619[_0x4556('0x30')]=_['intersection'](_0x12d619[_0x4556('0x2d')],_0x12d619['query']);_0x3dff24['attributes']=_['intersection'](_0x12d619[_0x4556('0x2d')],qs['fields'](_0x315722[_0x4556('0x2f')][_0x4556('0x33')]));_0x3dff24[_0x4556('0x32')]=_0x3dff24[_0x4556('0x32')][_0x4556('0x34')]?_0x3dff24[_0x4556('0x32')]:_0x12d619[_0x4556('0x2d')];_0x3dff24[_0x4556('0x38')]=qs[_0x4556('0x39')](_0x315722[_0x4556('0x2f')][_0x4556('0x39')]);_0x3dff24[_0x4556('0x3a')]=qs['filters'](_['pick'](_0x315722['query'],_0x12d619[_0x4556('0x30')]));if(_0x315722[_0x4556('0x2f')][_0x4556('0x3c')]){_0x3dff24[_0x4556('0x3a')]=_['merge'](_0x3dff24[_0x4556('0x3a')],{'$or':_[_0x4556('0x4b')](_0x3dff24[_0x4556('0x32')],function(_0x26f46d){var _0x2e0e70={};_0x2e0e70[_0x26f46d]={'$like':'%'+_0x315722[_0x4556('0x2f')][_0x4556('0x3c')]+'%'};return _0x2e0e70;})});}_0x3dff24=_[_0x4556('0x3d')]({},_0x3dff24,_0x315722[_0x4556('0x3e')]);return _0x183639[_0x4556('0x4c')](_0x3dff24);}})[_0x4556('0x24')](function(_0x31c72f){if(_0x31c72f){_0x2557de=_0x31c72f[_0x4556('0x34')];if(!_0x315722[_0x4556('0x2f')]['hasOwnProperty'](_0x4556('0x36'))){_0x3dff24[_0x4556('0x37')]=qs[_0x4556('0x37')](_0x315722[_0x4556('0x2f')][_0x4556('0x37')]);_0x3dff24[_0x4556('0x1d')]=qs[_0x4556('0x1d')](_0x315722[_0x4556('0x2f')]['offset']);}return _0x183639[_0x4556('0x4c')](_0x3dff24);}})[_0x4556('0x24')](function(_0x1c1424){if(_0x1c1424){return _0x1c1424?{'count':_0x2557de,'rows':_0x1c1424}:null;}})[_0x4556('0x24')](respondWithResult(_0x3f2f6b,null))[_0x4556('0x45')](handleError(_0x3f2f6b,null));};exports[_0x4556('0x4e')]=function(_0x2ae031,_0x6accf1,_0x34c9cb){var _0x16c390={};var _0x33ed06={};var _0x56f17b;var _0x5a2006;return db[_0x4556('0x2a')][_0x4556('0x4d')]({'where':{'id':_0x2ae031['params']['id']}})[_0x4556('0x24')](handleEntityNotFound(_0x6accf1,null))[_0x4556('0x24')](function(_0x3bb49a){if(_0x3bb49a){_0x56f17b=_0x3bb49a;_0x33ed06[_0x4556('0x2d')]=_[_0x4556('0x2e')](db[_0x4556('0x4a')][_0x4556('0x2b')]);_0x33ed06[_0x4556('0x2f')]=_['keys'](_0x2ae031[_0x4556('0x2f')]);_0x33ed06[_0x4556('0x30')]=_[_0x4556('0x31')](_0x33ed06[_0x4556('0x2d')],_0x33ed06[_0x4556('0x2f')]);_0x16c390[_0x4556('0x32')]=_[_0x4556('0x31')](_0x33ed06['model'],qs['fields'](_0x2ae031['query'][_0x4556('0x33')]));_0x16c390[_0x4556('0x32')]=_0x16c390[_0x4556('0x32')][_0x4556('0x34')]?_0x16c390[_0x4556('0x32')]:_0x33ed06['model'];_0x16c390[_0x4556('0x38')]=qs[_0x4556('0x39')](_0x2ae031['query'][_0x4556('0x39')]);_0x16c390[_0x4556('0x3a')]=qs[_0x4556('0x30')](_['pick'](_0x2ae031[_0x4556('0x2f')],_0x33ed06['filters']));if(_0x2ae031[_0x4556('0x2f')][_0x4556('0x3c')]){_0x16c390[_0x4556('0x3a')]=_[_0x4556('0x3d')](_0x16c390[_0x4556('0x3a')],{'$or':_[_0x4556('0x4b')](_0x16c390['attributes'],function(_0xfa5dd7){var _0x1fb1cd={};_0x1fb1cd[_0xfa5dd7]={'$like':'%'+_0x2ae031[_0x4556('0x2f')]['filter']+'%'};return _0x1fb1cd;})});}_0x16c390=_['merge']({},_0x16c390,_0x2ae031[_0x4556('0x3e')]);return _0x56f17b[_0x4556('0x4e')](_0x16c390);}})[_0x4556('0x24')](function(_0x35f2f1){if(_0x35f2f1){_0x5a2006=_0x35f2f1[_0x4556('0x34')];if(!_0x2ae031[_0x4556('0x2f')][_0x4556('0x35')](_0x4556('0x36'))){_0x16c390[_0x4556('0x37')]=qs[_0x4556('0x37')](_0x2ae031[_0x4556('0x2f')][_0x4556('0x37')]);_0x16c390[_0x4556('0x1d')]=qs[_0x4556('0x1d')](_0x2ae031[_0x4556('0x2f')][_0x4556('0x1d')]);}return _0x56f17b[_0x4556('0x4e')](_0x16c390);}})[_0x4556('0x24')](function(_0x41903a){if(_0x41903a){return _0x41903a?{'count':_0x5a2006,'rows':_0x41903a}:null;}})[_0x4556('0x24')](respondWithResult(_0x6accf1,null))[_0x4556('0x45')](handleError(_0x6accf1,null));};exports[_0x4556('0x4f')]=function(_0x3d5adc,_0x4b8b79,_0x1e2eeb){var _0x10ec4a={};var _0x27c307={};var _0x438229;var _0x3aa62e;return db[_0x4556('0x2a')]['findOne']({'where':{'id':_0x3d5adc[_0x4556('0x44')]['id']}})[_0x4556('0x24')](handleEntityNotFound(_0x4b8b79,null))[_0x4556('0x24')](function(_0xbd4a7c){if(_0xbd4a7c){_0x438229=_0xbd4a7c;_0x27c307[_0x4556('0x2d')]=_[_0x4556('0x2e')](db['Tag'][_0x4556('0x2b')]);_0x27c307[_0x4556('0x2f')]=_[_0x4556('0x2e')](_0x3d5adc[_0x4556('0x2f')]);_0x27c307[_0x4556('0x30')]=_[_0x4556('0x31')](_0x27c307[_0x4556('0x2d')],_0x27c307['query']);_0x10ec4a['attributes']=_[_0x4556('0x31')](_0x27c307[_0x4556('0x2d')],qs[_0x4556('0x33')](_0x3d5adc[_0x4556('0x2f')]['fields']));_0x10ec4a['attributes']=_0x10ec4a[_0x4556('0x32')][_0x4556('0x34')]?_0x10ec4a[_0x4556('0x32')]:_0x27c307[_0x4556('0x2d')];_0x10ec4a[_0x4556('0x38')]=qs[_0x4556('0x39')](_0x3d5adc[_0x4556('0x2f')][_0x4556('0x39')]);_0x10ec4a[_0x4556('0x3a')]=qs[_0x4556('0x30')](_['pick'](_0x3d5adc['query'],_0x27c307[_0x4556('0x30')]));if(_0x3d5adc[_0x4556('0x2f')]['filter']){_0x10ec4a[_0x4556('0x3a')]=_[_0x4556('0x3d')](_0x10ec4a['where'],{'$or':_['map'](_0x10ec4a['attributes'],function(_0x8acaa1){var _0x2717eb={};_0x2717eb[_0x8acaa1]={'$like':'%'+_0x3d5adc[_0x4556('0x2f')][_0x4556('0x3c')]+'%'};return _0x2717eb;})});}_0x10ec4a=_[_0x4556('0x3d')]({},_0x10ec4a,_0x3d5adc['options']);return _0x438229['getTags'](_0x10ec4a);}})[_0x4556('0x24')](function(_0x4571bd){if(_0x4571bd){_0x3aa62e=_0x4571bd[_0x4556('0x34')];if(!_0x3d5adc[_0x4556('0x2f')][_0x4556('0x35')](_0x4556('0x36'))){_0x10ec4a[_0x4556('0x37')]=qs[_0x4556('0x37')](_0x3d5adc[_0x4556('0x2f')][_0x4556('0x37')]);_0x10ec4a[_0x4556('0x1d')]=qs[_0x4556('0x1d')](_0x3d5adc[_0x4556('0x2f')][_0x4556('0x1d')]);}return _0x438229['getTags'](_0x10ec4a);}})[_0x4556('0x24')](function(_0x3684b0){if(_0x3684b0){return _0x3684b0?{'count':_0x3aa62e,'rows':_0x3684b0}:null;}})[_0x4556('0x24')](respondWithResult(_0x4b8b79,null))[_0x4556('0x45')](handleError(_0x4b8b79,null));};exports[_0x4556('0x50')]=function(_0x1b7baf,_0x16e457,_0x228839){if(_0x1b7baf[_0x4556('0x47')]['id']){delete _0x1b7baf[_0x4556('0x47')]['id'];}return db['ZendeskConfiguration'][_0x4556('0x4d')]({'where':{'id':_0x1b7baf[_0x4556('0x44')]['id']}})[_0x4556('0x24')](handleEntityNotFound(_0x16e457,null))['then'](function(_0x1b5c51){if(_0x1b5c51){return _0x1b5c51[_0x4556('0x50')](_0x1b7baf[_0x4556('0x47')][_0x4556('0x51')]||[]);}return null;})[_0x4556('0x24')](respondWithResult(_0x16e457,null))[_0x4556('0x45')](handleError(_0x16e457,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index ad9f91a..72c2437 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 _0x373d=['define','ZendeskConfiguration','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x4b2436,_0x452299){var _0x4f5ab2=function(_0x5c6679){while(--_0x5c6679){_0x4b2436['push'](_0x4b2436['shift']());}};_0x4f5ab2(++_0x452299);}(_0x373d,0x1e2));var _0xd373=function(_0x3145af,_0x53a1d5){_0x3145af=_0x3145af-0x0;var _0x37758a=_0x373d[_0x3145af];return _0x37758a;};'use strict';var _=require(_0xd373('0x0'));var util=require('util');var logger=require(_0xd373('0x1'))(_0xd373('0x2'));var moment=require(_0xd373('0x3'));var BPromise=require(_0xd373('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd373('0x5'));var rimraf=require(_0xd373('0x6'));var config=require(_0xd373('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x31a0fb,_0x3e4443){return _0x31a0fb[_0xd373('0x8')](_0xd373('0x9'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5eb8=['request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','../../config/logger','api','moment','bluebird'];(function(_0x208e9f,_0x1efbed){var _0x4620d2=function(_0x1924e5){while(--_0x1924e5){_0x208e9f['push'](_0x208e9f['shift']());}};_0x4620d2(++_0x1efbed);}(_0x5eb8,0xb0));var _0x85eb=function(_0x599041,_0x40fbea){_0x599041=_0x599041-0x0;var _0x1c4969=_0x5eb8[_0x599041];return _0x1c4969;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require(_0x85eb('0x3'));var rp=require(_0x85eb('0x4'));var fs=require('fs');var path=require(_0x85eb('0x5'));var rimraf=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var attributes=require(_0x85eb('0x8'));module[_0x85eb('0x9')]=function(_0x2bf83c,_0x1ba1d8){return _0x2bf83c['define'](_0x85eb('0xa'),attributes,{'tableName':_0x85eb('0xb'),'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 3e679f2..161250d 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 _0xaf0e=['ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch','lodash','util','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskConfiguration,\x20%s,\x20%s','debug'];(function(_0x25b429,_0x44d90d){var _0x3e634c=function(_0x99ca6b){while(--_0x99ca6b){_0x25b429['push'](_0x25b429['shift']());}};_0x3e634c(++_0x44d90d);}(_0xaf0e,0xa2));var _0xeaf0=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xaf0e[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0xeaf0('0x0'));var util=require(_0xeaf0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeaf0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xeaf0('0x3'));var logger=require(_0xeaf0('0x4'))(_0xeaf0('0x5'));var config=require(_0xeaf0('0x6'));var jayson=require(_0xeaf0('0x7'));var client=jayson['client'][_0xeaf0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4f1054,_0xfbeb58,_0x4b3f0f){return new BPromise(function(_0x56419f,_0x33202c){return client[_0xeaf0('0x9')](_0x4f1054,_0x4b3f0f)[_0xeaf0('0xa')](function(_0x13f11d){logger[_0xeaf0('0xb')](_0xeaf0('0xc'),_0xfbeb58,'request\x20sent');logger[_0xeaf0('0xd')](_0xeaf0('0xe'),_0xfbeb58,_0xeaf0('0xf'),JSON[_0xeaf0('0x10')](_0x13f11d));if(_0x13f11d['error']){if(_0x13f11d['error'][_0xeaf0('0x11')]===0x1f4){logger[_0xeaf0('0x12')](_0xeaf0('0xc'),_0xfbeb58,_0x13f11d[_0xeaf0('0x12')][_0xeaf0('0x13')]);return _0x33202c(_0x13f11d[_0xeaf0('0x12')][_0xeaf0('0x13')]);}logger['error'](_0xeaf0('0xc'),_0xfbeb58,_0x13f11d[_0xeaf0('0x12')][_0xeaf0('0x13')]);return _0x56419f(_0x13f11d[_0xeaf0('0x12')][_0xeaf0('0x13')]);}else{logger[_0xeaf0('0xb')](_0xeaf0('0xc'),_0xfbeb58,_0xeaf0('0xf'));_0x56419f(_0x13f11d[_0xeaf0('0x14')]['message']);}})[_0xeaf0('0x15')](function(_0x1fc05a){logger[_0xeaf0('0x12')](_0xeaf0('0xc'),_0xfbeb58,_0x1fc05a);_0x33202c(_0x1fc05a);});});} \ No newline at end of file +var _0xcb4d=['code','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','request','then','ZendeskConfiguration,\x20%s,\x20%s','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3e4fbe,_0x1a550d){var _0x158ba5=function(_0x446f40){while(--_0x446f40){_0x3e4fbe['push'](_0x3e4fbe['shift']());}};_0x158ba5(++_0x1a550d);}(_0xcb4d,0x10a));var _0xdcb4=function(_0x4722f1,_0x599430){_0x4722f1=_0x4722f1-0x0;var _0x4c4e93=_0xcb4d[_0x4722f1];return _0x4c4e93;};'use strict';var _=require(_0xdcb4('0x0'));var util=require(_0xdcb4('0x1'));var moment=require(_0xdcb4('0x2'));var BPromise=require('bluebird');var rs=require(_0xdcb4('0x3'));var fs=require('fs');var Redis=require(_0xdcb4('0x4'));var db=require(_0xdcb4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcb4('0x6'))(_0xdcb4('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4c7b39,_0x3ab85e,_0x2a6223){return new BPromise(function(_0x516ad0,_0x4b9d70){return client[_0xdcb4('0x8')](_0x4c7b39,_0x2a6223)[_0xdcb4('0x9')](function(_0x3c1e06){logger['info'](_0xdcb4('0xa'),_0x3ab85e,'request\x20sent');logger[_0xdcb4('0xb')](_0xdcb4('0xc'),_0x3ab85e,_0xdcb4('0xd'),JSON['stringify'](_0x3c1e06));if(_0x3c1e06['error']){if(_0x3c1e06['error'][_0xdcb4('0xe')]===0x1f4){logger[_0xdcb4('0xf')](_0xdcb4('0xa'),_0x3ab85e,_0x3c1e06[_0xdcb4('0xf')][_0xdcb4('0x10')]);return _0x4b9d70(_0x3c1e06[_0xdcb4('0xf')]['message']);}logger[_0xdcb4('0xf')](_0xdcb4('0xa'),_0x3ab85e,_0x3c1e06[_0xdcb4('0xf')][_0xdcb4('0x10')]);return _0x516ad0(_0x3c1e06[_0xdcb4('0xf')]['message']);}else{logger[_0xdcb4('0x11')]('ZendeskConfiguration,\x20%s,\x20%s',_0x3ab85e,'request\x20sent');_0x516ad0(_0x3c1e06[_0xdcb4('0x12')]['message']);}})[_0xdcb4('0x13')](function(_0x89dce1){logger['error'](_0xdcb4('0xa'),_0x3ab85e,_0x89dce1);_0x4b9d70(_0x89dce1);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index c34e891..60df399 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 _0x88e9=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','multer','util','path'];(function(_0x2cac24,_0x5cb546){var _0x3f8b07=function(_0x395adb){while(--_0x395adb){_0x2cac24['push'](_0x2cac24['shift']());}};_0x3f8b07(++_0x5cb546);}(_0x88e9,0x189));var _0x988e=function(_0x3715de,_0x4db6bd){_0x3715de=_0x3715de-0x0;var _0x392a26=_0x88e9[_0x3715de];return _0x392a26;};'use strict';var multer=require(_0x988e('0x0'));var util=require(_0x988e('0x1'));var path=require(_0x988e('0x2'));var timeout=require(_0x988e('0x3'));var express=require('express');var router=express[_0x988e('0x4')]();var fs_extra=require(_0x988e('0x5'));var auth=require(_0x988e('0x6'));var interaction=require(_0x988e('0x7'));var config=require('../../config/environment');var controller=require(_0x988e('0x8'));router[_0x988e('0x9')]('/',auth[_0x988e('0xa')](),controller[_0x988e('0xb')]);router[_0x988e('0x9')](_0x988e('0xc'),auth[_0x988e('0xa')](),controller[_0x988e('0xd')]);router[_0x988e('0xe')]('/',auth[_0x988e('0xa')](),controller['create']);router[_0x988e('0xf')](_0x988e('0xc'),auth[_0x988e('0xa')](),controller[_0x988e('0x10')]);router[_0x988e('0x11')](_0x988e('0xc'),auth[_0x988e('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc8a2=['../../config/environment','./intZendeskField.controller','get','index','/:id','show','post','put','isAuthenticated','update','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x3b4c9c,_0x4c697c){var _0x5955ce=function(_0x162bc1){while(--_0x162bc1){_0x3b4c9c['push'](_0x3b4c9c['shift']());}};_0x5955ce(++_0x4c697c);}(_0xc8a2,0x1c2));var _0x2c8a=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xc8a2[_0x2be8c2];return _0x97f531;};'use strict';var multer=require('multer');var util=require(_0x2c8a('0x0'));var path=require('path');var timeout=require(_0x2c8a('0x1'));var express=require(_0x2c8a('0x2'));var router=express['Router']();var fs_extra=require(_0x2c8a('0x3'));var auth=require(_0x2c8a('0x4'));var interaction=require(_0x2c8a('0x5'));var config=require(_0x2c8a('0x6'));var controller=require(_0x2c8a('0x7'));router[_0x2c8a('0x8')]('/',auth['isAuthenticated'](),controller[_0x2c8a('0x9')]);router[_0x2c8a('0x8')](_0x2c8a('0xa'),auth['isAuthenticated'](),controller[_0x2c8a('0xb')]);router[_0x2c8a('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2c8a('0xd')](_0x2c8a('0xa'),auth[_0x2c8a('0xe')](),controller[_0x2c8a('0xf')]);router[_0x2c8a('0x10')](_0x2c8a('0xa'),auth[_0x2c8a('0xe')](),controller[_0x2c8a('0x11')]);module[_0x2c8a('0x12')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index d124cc7..a7b79f4 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 _0x193a=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','picklist','STRING'];(function(_0x111b29,_0x57139e){var _0x56fe78=function(_0x4a9673){while(--_0x4a9673){_0x111b29['push'](_0x111b29['shift']());}};_0x56fe78(++_0x57139e);}(_0x193a,0x13c));var _0xa193=function(_0x59be65,_0x5ce713){_0x59be65=_0x59be65-0x0;var _0x458a07=_0x193a[_0x59be65];return _0x458a07;};'use strict';var Sequelize=require(_0xa193('0x0'));module[_0xa193('0x1')]={'type':{'type':Sequelize[_0xa193('0x2')](_0xa193('0x3'),_0xa193('0x4'),_0xa193('0x5'),'keyValue',_0xa193('0x6')),'defaultValue':_0xa193('0x3')},'content':{'type':Sequelize[_0xa193('0x7')]},'key':{'type':Sequelize[_0xa193('0x7')]},'keyType':{'type':Sequelize[_0xa193('0x2')](_0xa193('0x3'),_0xa193('0x4'),_0xa193('0x5'))},'keyContent':{'type':Sequelize[_0xa193('0x7')]},'idField':{'type':Sequelize[_0xa193('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xa193('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x0ebb=['picklist','STRING','ENUM','BOOLEAN','sequelize','string','variable','keyValue'];(function(_0xe28c66,_0x57beac){var _0x130116=function(_0x1b9b1c){while(--_0x1b9b1c){_0xe28c66['push'](_0xe28c66['shift']());}};_0x130116(++_0x57beac);}(_0x0ebb,0xdc));var _0xb0eb=function(_0x40994e,_0x50fc7f){_0x40994e=_0x40994e-0x0;var _0x23c718=_0x0ebb[_0x40994e];return _0x23c718;};'use strict';var Sequelize=require(_0xb0eb('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xb0eb('0x1'),_0xb0eb('0x2'),'customVariable',_0xb0eb('0x3'),_0xb0eb('0x4')),'defaultValue':_0xb0eb('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xb0eb('0x5')]},'keyType':{'type':Sequelize[_0xb0eb('0x6')](_0xb0eb('0x1'),_0xb0eb('0x2'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xb0eb('0x5')]},'nameField':{'type':Sequelize[_0xb0eb('0x5')]},'customField':{'type':Sequelize[_0xb0eb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb0eb('0x5')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index 896a660..8424bdc 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 _0x81a9=['../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','stack','name','send','index','ZendeskField','fieldName','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','keys','includeAll','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x59e9ff,_0x5080c3){var _0xa71d5e=function(_0x7d1718){while(--_0x7d1718){_0x59e9ff['push'](_0x59e9ff['shift']());}};_0xa71d5e(++_0x5080c3);}(_0x81a9,0x81));var _0x981a=function(_0x5e4009,_0x491526){_0x5e4009=_0x5e4009-0x0;var _0x5e5f5c=_0x81a9[_0x5e4009];return _0x5e5f5c;};'use strict';var emlformat=require(_0x981a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x981a('0x1'));var jsonpatch=require(_0x981a('0x2'));var rp=require(_0x981a('0x3'));var moment=require(_0x981a('0x4'));var BPromise=require(_0x981a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x981a('0x6'));var csv=require(_0x981a('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x981a('0x8'));var _=require(_0x981a('0x9'));var squel=require(_0x981a('0xa'));var crypto=require(_0x981a('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x981a('0x7'));var querystring=require(_0x981a('0xc'));var Papa=require(_0x981a('0xd'));var Redis=require(_0x981a('0xe'));var authService=require(_0x981a('0xf'));var qs=require(_0x981a('0x10'));var as=require(_0x981a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x981a('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x981a('0x13'));var licenseUtil=require(_0x981a('0x14'));var db=require(_0x981a('0x15'))['db'];function respondWithStatusCode(_0x36843a,_0x47cbd4){_0x47cbd4=_0x47cbd4||0xcc;return function(_0x5db4e8){if(_0x5db4e8){return _0x36843a[_0x981a('0x16')](_0x47cbd4);}return _0x36843a[_0x981a('0x17')](_0x47cbd4)['end']();};}function respondWithResult(_0x31df7c,_0x809245){_0x809245=_0x809245||0xc8;return function(_0x1d8593){if(_0x1d8593){return _0x31df7c[_0x981a('0x17')](_0x809245)[_0x981a('0x18')](_0x1d8593);}};}function respondWithFilteredResult(_0x23a73a,_0x531b77){return function(_0x28f864){if(_0x28f864){var _0xe0c0ea=typeof _0x531b77[_0x981a('0x19')]===_0x981a('0x1a')&&typeof _0x531b77['limit']==='undefined';var _0x52baa3=_0x28f864[_0x981a('0x1b')];var _0x261e60=_0xe0c0ea?0x0:_0x531b77['offset'];var _0xcb617a=_0xe0c0ea?_0x28f864[_0x981a('0x1b')]:_0x531b77[_0x981a('0x19')]+_0x531b77[_0x981a('0x1c')];var _0x59be66;if(_0xcb617a>=_0x52baa3){_0xcb617a=_0x52baa3;_0x59be66=0xc8;}else{_0x59be66=0xce;}_0x23a73a[_0x981a('0x17')](_0x59be66);return _0x23a73a[_0x981a('0x1d')](_0x981a('0x1e'),_0x261e60+'-'+_0xcb617a+'/'+_0x52baa3)[_0x981a('0x18')](_0x28f864);}return null;};}function patchUpdates(_0x88474a){return function(_0x412d68){try{jsonpatch[_0x981a('0x1f')](_0x412d68,_0x88474a,!![]);}catch(_0x5f169c){return BPromise[_0x981a('0x20')](_0x5f169c);}return _0x412d68[_0x981a('0x21')]();};}function saveUpdates(_0x3cf1f6,_0x3ea2db){return function(_0x3c315f){if(_0x3c315f){return _0x3c315f[_0x981a('0x22')](_0x3cf1f6)['then'](function(_0x3f8b39){return _0x3f8b39;});}return null;};}function removeEntity(_0x2c2569,_0x5b42c2){return function(_0x56fa7d){if(_0x56fa7d){return _0x56fa7d[_0x981a('0x23')]()[_0x981a('0x24')](function(){_0x2c2569['status'](0xcc)[_0x981a('0x25')]();});}};}function handleEntityNotFound(_0x249ebb,_0x479371){return function(_0x36a0fc){if(!_0x36a0fc){_0x249ebb[_0x981a('0x16')](0x194);}return _0x36a0fc;};}function handleError(_0x17f994,_0x11dd66){_0x11dd66=_0x11dd66||0x1f4;return function(_0x9d600a){logger['error'](_0x9d600a[_0x981a('0x26')]);if(_0x9d600a[_0x981a('0x27')]){delete _0x9d600a[_0x981a('0x27')];}_0x17f994[_0x981a('0x17')](_0x11dd66)[_0x981a('0x28')](_0x9d600a);};}exports[_0x981a('0x29')]=function(_0x41b031,_0x4a91d4){var _0x41be00={},_0x1ddc7f={},_0x4dba5c={'count':0x0,'rows':[]};var _0x381d11=_['map'](db[_0x981a('0x2a')]['rawAttributes'],function(_0x394bdb){return{'name':_0x394bdb[_0x981a('0x2b')],'type':_0x394bdb['type'][_0x981a('0x2c')]};});_0x1ddc7f[_0x981a('0x2d')]=_[_0x981a('0x2e')](_0x381d11,_0x981a('0x27'));_0x1ddc7f[_0x981a('0x2f')]=_['keys'](_0x41b031['query']);_0x1ddc7f[_0x981a('0x30')]=_['intersection'](_0x1ddc7f[_0x981a('0x2d')],_0x1ddc7f['query']);_0x41be00[_0x981a('0x31')]=_[_0x981a('0x32')](_0x1ddc7f[_0x981a('0x2d')],qs[_0x981a('0x33')](_0x41b031['query'][_0x981a('0x33')]));_0x41be00[_0x981a('0x31')]=_0x41be00['attributes'][_0x981a('0x34')]?_0x41be00[_0x981a('0x31')]:_0x1ddc7f['model'];if(!_0x41b031['query'][_0x981a('0x35')](_0x981a('0x36'))){_0x41be00['limit']=qs[_0x981a('0x1c')](_0x41b031['query'][_0x981a('0x1c')]);_0x41be00[_0x981a('0x19')]=qs[_0x981a('0x19')](_0x41b031[_0x981a('0x2f')][_0x981a('0x19')]);}_0x41be00[_0x981a('0x37')]=qs['sort'](_0x41b031[_0x981a('0x2f')][_0x981a('0x38')]);_0x41be00[_0x981a('0x39')]=qs[_0x981a('0x30')](_[_0x981a('0x3a')](_0x41b031[_0x981a('0x2f')],_0x1ddc7f['filters']),_0x381d11);if(_0x41b031[_0x981a('0x2f')][_0x981a('0x3b')]){_0x41be00['where']=_[_0x981a('0x3c')](_0x41be00['where'],{'$or':_[_0x981a('0x2e')](_0x381d11,function(_0x117a51){if(_0x117a51['type']!==_0x981a('0x3d')){var _0x37afa3={};_0x37afa3[_0x117a51[_0x981a('0x27')]]={'$like':'%'+_0x41b031[_0x981a('0x2f')][_0x981a('0x3b')]+'%'};return _0x37afa3;}})});}_0x41be00=_[_0x981a('0x3c')]({},_0x41be00,_0x41b031[_0x981a('0x3e')]);var _0x1e074f={'where':_0x41be00[_0x981a('0x39')]};return db['ZendeskField'][_0x981a('0x1b')](_0x1e074f)['then'](function(_0x1992df){_0x4dba5c['count']=_0x1992df;if(_0x41b031[_0x981a('0x2f')]['includeAll']){_0x41be00[_0x981a('0x3f')]=[{'all':!![]}];}return db[_0x981a('0x2a')][_0x981a('0x40')](_0x41be00);})[_0x981a('0x24')](function(_0x42f195){_0x4dba5c[_0x981a('0x41')]=_0x42f195;return _0x4dba5c;})[_0x981a('0x24')](respondWithFilteredResult(_0x4a91d4,_0x41be00))[_0x981a('0x42')](handleError(_0x4a91d4,null));};exports['show']=function(_0x200b01,_0x3348ef){var _0x5a184a={'raw':!![],'where':{'id':_0x200b01[_0x981a('0x43')]['id']}},_0xf15cc6={};_0xf15cc6[_0x981a('0x2d')]=_[_0x981a('0x44')](db[_0x981a('0x2a')]['rawAttributes']);_0xf15cc6['query']=_[_0x981a('0x44')](_0x200b01[_0x981a('0x2f')]);_0xf15cc6[_0x981a('0x30')]=_[_0x981a('0x32')](_0xf15cc6[_0x981a('0x2d')],_0xf15cc6[_0x981a('0x2f')]);_0x5a184a[_0x981a('0x31')]=_[_0x981a('0x32')](_0xf15cc6[_0x981a('0x2d')],qs[_0x981a('0x33')](_0x200b01[_0x981a('0x2f')][_0x981a('0x33')]));_0x5a184a[_0x981a('0x31')]=_0x5a184a[_0x981a('0x31')]['length']?_0x5a184a[_0x981a('0x31')]:_0xf15cc6[_0x981a('0x2d')];if(_0x200b01['query'][_0x981a('0x45')]){_0x5a184a[_0x981a('0x3f')]=[{'all':!![]}];}_0x5a184a=_[_0x981a('0x3c')]({},_0x5a184a,_0x200b01[_0x981a('0x3e')]);return db['ZendeskField'][_0x981a('0x46')](_0x5a184a)['then'](handleEntityNotFound(_0x3348ef,null))[_0x981a('0x24')](respondWithResult(_0x3348ef,null))[_0x981a('0x42')](handleError(_0x3348ef,null));};exports[_0x981a('0x47')]=function(_0x1d38ac,_0x9500a3){return db['ZendeskField'][_0x981a('0x47')](_0x1d38ac[_0x981a('0x48')],{})[_0x981a('0x24')](respondWithResult(_0x9500a3,0xc9))[_0x981a('0x42')](handleError(_0x9500a3,null));};exports[_0x981a('0x22')]=function(_0x5412d8,_0x4dd8a0){if(_0x5412d8[_0x981a('0x48')]['id']){delete _0x5412d8['body']['id'];}return db[_0x981a('0x2a')][_0x981a('0x46')]({'where':{'id':_0x5412d8[_0x981a('0x43')]['id']}})[_0x981a('0x24')](handleEntityNotFound(_0x4dd8a0,null))[_0x981a('0x24')](saveUpdates(_0x5412d8[_0x981a('0x48')],null))['then'](respondWithResult(_0x4dd8a0,null))['catch'](handleError(_0x4dd8a0,null));};exports[_0x981a('0x23')]=function(_0x369d2f,_0x5d17a0){return db[_0x981a('0x2a')][_0x981a('0x46')]({'where':{'id':_0x369d2f['params']['id']}})['then'](handleEntityNotFound(_0x5d17a0,null))[_0x981a('0x24')](removeEntity(_0x5d17a0,null))[_0x981a('0x42')](handleError(_0x5d17a0,null));}; \ No newline at end of file +var _0x3877=['fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','rimraf'];(function(_0x55b806,_0xe47221){var _0x4531be=function(_0xb16878){while(--_0xb16878){_0x55b806['push'](_0x55b806['shift']());}};_0x4531be(++_0xe47221);}(_0x3877,0x1c1));var _0x7387=function(_0x1f8a2c,_0x1823ed){_0x1f8a2c=_0x1f8a2c-0x0;var _0x2a8d99=_0x3877[_0x1f8a2c];return _0x2a8d99;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7387('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7387('0x1'));var rp=require(_0x7387('0x2'));var moment=require(_0x7387('0x3'));var BPromise=require(_0x7387('0x4'));var Mustache=require(_0x7387('0x5'));var util=require(_0x7387('0x6'));var path=require('path');var sox=require(_0x7387('0x7'));var csv=require(_0x7387('0x8'));var ejs=require(_0x7387('0x9'));var fs=require('fs');var fs_extra=require(_0x7387('0xa'));var _=require(_0x7387('0xb'));var squel=require(_0x7387('0xc'));var crypto=require(_0x7387('0xd'));var jsforce=require(_0x7387('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7387('0xf'));var Papa=require(_0x7387('0x10'));var Redis=require(_0x7387('0x11'));var authService=require(_0x7387('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x7387('0x13'));var hardwareService=require(_0x7387('0x14'));var logger=require(_0x7387('0x15'))('api');var utils=require(_0x7387('0x16'));var config=require(_0x7387('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x7387('0x18'))['db'];function respondWithStatusCode(_0xe3221e,_0x272a9f){_0x272a9f=_0x272a9f||0xcc;return function(_0x521b98){if(_0x521b98){return _0xe3221e['sendStatus'](_0x272a9f);}return _0xe3221e[_0x7387('0x19')](_0x272a9f)[_0x7387('0x1a')]();};}function respondWithResult(_0x5b4271,_0x507c6a){_0x507c6a=_0x507c6a||0xc8;return function(_0xe885bf){if(_0xe885bf){return _0x5b4271['status'](_0x507c6a)[_0x7387('0x1b')](_0xe885bf);}};}function respondWithFilteredResult(_0x450986,_0x2e053b){return function(_0x3576eb){if(_0x3576eb){var _0x5e9c1c=typeof _0x2e053b[_0x7387('0x1c')]===_0x7387('0x1d')&&typeof _0x2e053b[_0x7387('0x1e')]==='undefined';var _0x33ddbd=_0x3576eb[_0x7387('0x1f')];var _0x442f87=_0x5e9c1c?0x0:_0x2e053b['offset'];var _0x23878d=_0x5e9c1c?_0x3576eb[_0x7387('0x1f')]:_0x2e053b[_0x7387('0x1c')]+_0x2e053b[_0x7387('0x1e')];var _0x1cd228;if(_0x23878d>=_0x33ddbd){_0x23878d=_0x33ddbd;_0x1cd228=0xc8;}else{_0x1cd228=0xce;}_0x450986[_0x7387('0x19')](_0x1cd228);return _0x450986['set'](_0x7387('0x20'),_0x442f87+'-'+_0x23878d+'/'+_0x33ddbd)[_0x7387('0x1b')](_0x3576eb);}return null;};}function patchUpdates(_0x25b45f){return function(_0x84656a){try{jsonpatch[_0x7387('0x21')](_0x84656a,_0x25b45f,!![]);}catch(_0x11b72d){return BPromise['reject'](_0x11b72d);}return _0x84656a[_0x7387('0x22')]();};}function saveUpdates(_0x1b88e5,_0x5473ef){return function(_0xdb1804){if(_0xdb1804){return _0xdb1804[_0x7387('0x23')](_0x1b88e5)[_0x7387('0x24')](function(_0x5d1ea8){return _0x5d1ea8;});}return null;};}function removeEntity(_0x486af1,_0xa20900){return function(_0x3b2b3d){if(_0x3b2b3d){return _0x3b2b3d[_0x7387('0x25')]()[_0x7387('0x24')](function(){_0x486af1[_0x7387('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x536193,_0x5afc24){return function(_0x1b132a){if(!_0x1b132a){_0x536193['sendStatus'](0x194);}return _0x1b132a;};}function handleError(_0x3d4a80,_0x42e369){_0x42e369=_0x42e369||0x1f4;return function(_0x197777){logger['error'](_0x197777[_0x7387('0x26')]);if(_0x197777['name']){delete _0x197777[_0x7387('0x27')];}_0x3d4a80[_0x7387('0x19')](_0x42e369)[_0x7387('0x28')](_0x197777);};}exports[_0x7387('0x29')]=function(_0x336e52,_0xdb7fc2){var _0x227f5d={},_0x3b0b3e={},_0x42c6ba={'count':0x0,'rows':[]};var _0x3525b1=_[_0x7387('0x2a')](db[_0x7387('0x2b')][_0x7387('0x2c')],function(_0x189419){return{'name':_0x189419[_0x7387('0x2d')],'type':_0x189419[_0x7387('0x2e')][_0x7387('0x2f')]};});_0x3b0b3e[_0x7387('0x30')]=_[_0x7387('0x2a')](_0x3525b1,_0x7387('0x27'));_0x3b0b3e[_0x7387('0x31')]=_[_0x7387('0x32')](_0x336e52[_0x7387('0x31')]);_0x3b0b3e['filters']=_[_0x7387('0x33')](_0x3b0b3e['model'],_0x3b0b3e[_0x7387('0x31')]);_0x227f5d[_0x7387('0x34')]=_['intersection'](_0x3b0b3e[_0x7387('0x30')],qs[_0x7387('0x35')](_0x336e52['query'][_0x7387('0x35')]));_0x227f5d[_0x7387('0x34')]=_0x227f5d[_0x7387('0x34')][_0x7387('0x36')]?_0x227f5d[_0x7387('0x34')]:_0x3b0b3e[_0x7387('0x30')];if(!_0x336e52[_0x7387('0x31')][_0x7387('0x37')](_0x7387('0x38'))){_0x227f5d[_0x7387('0x1e')]=qs[_0x7387('0x1e')](_0x336e52[_0x7387('0x31')][_0x7387('0x1e')]);_0x227f5d[_0x7387('0x1c')]=qs[_0x7387('0x1c')](_0x336e52['query'][_0x7387('0x1c')]);}_0x227f5d[_0x7387('0x39')]=qs[_0x7387('0x3a')](_0x336e52[_0x7387('0x31')]['sort']);_0x227f5d[_0x7387('0x3b')]=qs[_0x7387('0x3c')](_[_0x7387('0x3d')](_0x336e52[_0x7387('0x31')],_0x3b0b3e['filters']),_0x3525b1);if(_0x336e52['query'][_0x7387('0x3e')]){_0x227f5d[_0x7387('0x3b')]=_[_0x7387('0x3f')](_0x227f5d[_0x7387('0x3b')],{'$or':_[_0x7387('0x2a')](_0x3525b1,function(_0x16cb4c){if(_0x16cb4c[_0x7387('0x2e')]!==_0x7387('0x40')){var _0x6d4201={};_0x6d4201[_0x16cb4c[_0x7387('0x27')]]={'$like':'%'+_0x336e52['query'][_0x7387('0x3e')]+'%'};return _0x6d4201;}})});}_0x227f5d=_['merge']({},_0x227f5d,_0x336e52[_0x7387('0x41')]);var _0x6a2565={'where':_0x227f5d[_0x7387('0x3b')]};return db['ZendeskField'][_0x7387('0x1f')](_0x6a2565)[_0x7387('0x24')](function(_0x49bb5e){_0x42c6ba[_0x7387('0x1f')]=_0x49bb5e;if(_0x336e52['query'][_0x7387('0x42')]){_0x227f5d[_0x7387('0x43')]=[{'all':!![]}];}return db[_0x7387('0x2b')][_0x7387('0x44')](_0x227f5d);})['then'](function(_0x3f7552){_0x42c6ba[_0x7387('0x45')]=_0x3f7552;return _0x42c6ba;})[_0x7387('0x24')](respondWithFilteredResult(_0xdb7fc2,_0x227f5d))[_0x7387('0x46')](handleError(_0xdb7fc2,null));};exports['show']=function(_0x357e5e,_0x47cfdb){var _0x5ecf={'raw':!![],'where':{'id':_0x357e5e[_0x7387('0x47')]['id']}},_0x3560f0={};_0x3560f0[_0x7387('0x30')]=_[_0x7387('0x32')](db[_0x7387('0x2b')][_0x7387('0x2c')]);_0x3560f0[_0x7387('0x31')]=_[_0x7387('0x32')](_0x357e5e[_0x7387('0x31')]);_0x3560f0['filters']=_[_0x7387('0x33')](_0x3560f0[_0x7387('0x30')],_0x3560f0[_0x7387('0x31')]);_0x5ecf[_0x7387('0x34')]=_[_0x7387('0x33')](_0x3560f0[_0x7387('0x30')],qs[_0x7387('0x35')](_0x357e5e['query']['fields']));_0x5ecf['attributes']=_0x5ecf['attributes'][_0x7387('0x36')]?_0x5ecf[_0x7387('0x34')]:_0x3560f0[_0x7387('0x30')];if(_0x357e5e[_0x7387('0x31')]['includeAll']){_0x5ecf[_0x7387('0x43')]=[{'all':!![]}];}_0x5ecf=_[_0x7387('0x3f')]({},_0x5ecf,_0x357e5e[_0x7387('0x41')]);return db[_0x7387('0x2b')][_0x7387('0x48')](_0x5ecf)['then'](handleEntityNotFound(_0x47cfdb,null))['then'](respondWithResult(_0x47cfdb,null))[_0x7387('0x46')](handleError(_0x47cfdb,null));};exports[_0x7387('0x49')]=function(_0x341b8b,_0x1524b4){return db[_0x7387('0x2b')][_0x7387('0x49')](_0x341b8b[_0x7387('0x4a')],{})[_0x7387('0x24')](respondWithResult(_0x1524b4,0xc9))[_0x7387('0x46')](handleError(_0x1524b4,null));};exports[_0x7387('0x23')]=function(_0x4143dd,_0x7cfa7d){if(_0x4143dd['body']['id']){delete _0x4143dd[_0x7387('0x4a')]['id'];}return db[_0x7387('0x2b')]['find']({'where':{'id':_0x4143dd[_0x7387('0x47')]['id']}})[_0x7387('0x24')](handleEntityNotFound(_0x7cfa7d,null))[_0x7387('0x24')](saveUpdates(_0x4143dd['body'],null))[_0x7387('0x24')](respondWithResult(_0x7cfa7d,null))['catch'](handleError(_0x7cfa7d,null));};exports[_0x7387('0x25')]=function(_0x18075d,_0x2546b1){return db[_0x7387('0x2b')][_0x7387('0x48')]({'where':{'id':_0x18075d[_0x7387('0x47')]['id']}})[_0x7387('0x24')](handleEntityNotFound(_0x2546b1,null))[_0x7387('0x24')](removeEntity(_0x2546b1,null))[_0x7387('0x46')](handleError(_0x2546b1,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 6b930c8..b72c598 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 _0x5a28=['int_zendesk_fields','zendesk_unique_index','FieldId','util','api','moment','bluebird','request-promise','path','exports','define'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5a28,0x1bb));var _0x85a2=function(_0x3b231a,_0x53a00d){_0x3b231a=_0x3b231a-0x0;var _0x18d67a=_0x5a28[_0x3b231a];return _0x18d67a;};'use strict';var _=require('lodash');var util=require(_0x85a2('0x0'));var logger=require('../../config/logger')(_0x85a2('0x1'));var moment=require(_0x85a2('0x2'));var BPromise=require(_0x85a2('0x3'));var rp=require(_0x85a2('0x4'));var fs=require('fs');var path=require(_0x85a2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskField.attributes');module[_0x85a2('0x6')]=function(_0x2be423,_0x3f2cdc){return _0x2be423[_0x85a2('0x7')]('ZendeskField',attributes,{'tableName':_0x85a2('0x8'),'paranoid':![],'indexes':[{'name':_0x85a2('0x9'),'fields':['idField',_0x85a2('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc5da=['ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','exports','define'];(function(_0x336873,_0x177bc2){var _0x104864=function(_0xa04bcb){while(--_0xa04bcb){_0x336873['push'](_0x336873['shift']());}};_0x104864(++_0x177bc2);}(_0xc5da,0x1f2));var _0xac5d=function(_0x3b90e9,_0x4bdfb1){_0x3b90e9=_0x3b90e9-0x0;var _0x37cc1f=_0xc5da[_0x3b90e9];return _0x37cc1f;};'use strict';var _=require(_0xac5d('0x0'));var util=require(_0xac5d('0x1'));var logger=require(_0xac5d('0x2'))(_0xac5d('0x3'));var moment=require('moment');var BPromise=require(_0xac5d('0x4'));var rp=require(_0xac5d('0x5'));var fs=require('fs');var path=require(_0xac5d('0x6'));var rimraf=require(_0xac5d('0x7'));var config=require(_0xac5d('0x8'));var attributes=require(_0xac5d('0x9'));module[_0xac5d('0xa')]=function(_0x44c789,_0x37c130){return _0x44c789[_0xac5d('0xb')](_0xac5d('0xc'),attributes,{'tableName':_0xac5d('0xd'),'paranoid':![],'indexes':[{'name':_0xac5d('0xe'),'fields':[_0xac5d('0xf'),_0xac5d('0x10')],'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 f69fcd5..7c72295 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 _0x0033=['catch','lodash','util','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result'];(function(_0x4e4154,_0x1ffe63){var _0x53a194=function(_0x42bea1){while(--_0x42bea1){_0x4e4154['push'](_0x4e4154['shift']());}};_0x53a194(++_0x1ffe63);}(_0x0033,0x121));var _0x3003=function(_0x253476,_0x16b31a){_0x253476=_0x253476-0x0;var _0x134271=_0x0033[_0x253476];return _0x134271;};'use strict';var _=require(_0x3003('0x0'));var util=require(_0x3003('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3003('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3003('0x3'))(_0x3003('0x4'));var config=require('../../config/environment');var jayson=require(_0x3003('0x5'));var client=jayson[_0x3003('0x6')][_0x3003('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x327e67,_0x12c830,_0x345912){return new BPromise(function(_0x435e55,_0x194e8a){return client['request'](_0x327e67,_0x345912)['then'](function(_0xe7a207){logger['info'](_0x3003('0x8'),_0x12c830,_0x3003('0x9'));logger[_0x3003('0xa')](_0x3003('0xb'),_0x12c830,'request\x20sent',JSON[_0x3003('0xc')](_0xe7a207));if(_0xe7a207[_0x3003('0xd')]){if(_0xe7a207[_0x3003('0xd')]['code']===0x1f4){logger[_0x3003('0xd')](_0x3003('0x8'),_0x12c830,_0xe7a207[_0x3003('0xd')][_0x3003('0xe')]);return _0x194e8a(_0xe7a207[_0x3003('0xd')][_0x3003('0xe')]);}logger[_0x3003('0xd')](_0x3003('0x8'),_0x12c830,_0xe7a207[_0x3003('0xd')]['message']);return _0x435e55(_0xe7a207[_0x3003('0xd')][_0x3003('0xe')]);}else{logger[_0x3003('0xf')](_0x3003('0x8'),_0x12c830,_0x3003('0x9'));_0x435e55(_0xe7a207[_0x3003('0x10')][_0x3003('0xe')]);}})[_0x3003('0x11')](function(_0x2337f){logger['error'](_0x3003('0x8'),_0x12c830,_0x2337f);_0x194e8a(_0x2337f);});});} \ No newline at end of file +var _0xa094=['code','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4d22f4,_0x1b5bd6){var _0x4047be=function(_0x3501a1){while(--_0x3501a1){_0x4d22f4['push'](_0x4d22f4['shift']());}};_0x4047be(++_0x1b5bd6);}(_0xa094,0x193));var _0x4a09=function(_0x28d16d,_0x4c9a21){_0x28d16d=_0x28d16d-0x0;var _0x34a8eb=_0xa094[_0x28d16d];return _0x34a8eb;};'use strict';var _=require(_0x4a09('0x0'));var util=require(_0x4a09('0x1'));var moment=require(_0x4a09('0x2'));var BPromise=require(_0x4a09('0x3'));var rs=require(_0x4a09('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a09('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a09('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4a09('0x7'));var client=jayson[_0x4a09('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2159c7,_0x5cc82c,_0x2706f8){return new BPromise(function(_0x50de52,_0x178d13){return client[_0x4a09('0x9')](_0x2159c7,_0x2706f8)[_0x4a09('0xa')](function(_0x289cb5){logger[_0x4a09('0xb')](_0x4a09('0xc'),_0x5cc82c,'request\x20sent');logger[_0x4a09('0xd')](_0x4a09('0xe'),_0x5cc82c,_0x4a09('0xf'),JSON['stringify'](_0x289cb5));if(_0x289cb5[_0x4a09('0x10')]){if(_0x289cb5[_0x4a09('0x10')][_0x4a09('0x11')]===0x1f4){logger[_0x4a09('0x10')](_0x4a09('0xc'),_0x5cc82c,_0x289cb5['error'][_0x4a09('0x12')]);return _0x178d13(_0x289cb5['error'][_0x4a09('0x12')]);}logger[_0x4a09('0x10')]('ZendeskField,\x20%s,\x20%s',_0x5cc82c,_0x289cb5[_0x4a09('0x10')][_0x4a09('0x12')]);return _0x50de52(_0x289cb5[_0x4a09('0x10')][_0x4a09('0x12')]);}else{logger[_0x4a09('0xb')](_0x4a09('0xc'),_0x5cc82c,'request\x20sent');_0x50de52(_0x289cb5['result'][_0x4a09('0x12')]);}})[_0x4a09('0x13')](function(_0x5295a6){logger[_0x4a09('0x10')](_0x4a09('0xc'),_0x5cc82c,_0x5295a6);_0x178d13(_0x5295a6);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index edee8b6..a8b09a2 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 _0x4cec=['get','isAuthenticated','/:id','getConfigurations','/:id/fields','getFields','post','/:id/configurations','addConfiguration','update','destroy','multer','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1da08f,_0x4c155d){var _0x35856b=function(_0xe6fb31){while(--_0xe6fb31){_0x1da08f['push'](_0x1da08f['shift']());}};_0x35856b(++_0x4c155d);}(_0x4cec,0xdb));var _0xc4ce=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x4cec[_0x25e7cb];return _0x375d92;};'use strict';var multer=require(_0xc4ce('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc4ce('0x1')]();var fs_extra=require(_0xc4ce('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xc4ce('0x3'));var config=require(_0xc4ce('0x4'));var controller=require('./intZohoAccount.controller');router[_0xc4ce('0x5')]('/',auth[_0xc4ce('0x6')](),controller['index']);router[_0xc4ce('0x5')](_0xc4ce('0x7'),auth[_0xc4ce('0x6')](),controller['show']);router[_0xc4ce('0x5')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xc4ce('0x8')]);router['get'](_0xc4ce('0x9'),auth['isAuthenticated'](),controller[_0xc4ce('0xa')]);router[_0xc4ce('0xb')]('/',auth[_0xc4ce('0x6')](),controller['create']);router['post'](_0xc4ce('0xc'),auth[_0xc4ce('0x6')](),controller[_0xc4ce('0xd')]);router['put'](_0xc4ce('0x7'),auth[_0xc4ce('0x6')](),controller[_0xc4ce('0xe')]);router['delete'](_0xc4ce('0x7'),auth[_0xc4ce('0x6')](),controller[_0xc4ce('0xf')]);module['exports']=router; \ No newline at end of file +var _0x01f1=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','/:id/configurations','getConfigurations','/:id/fields','post','addConfiguration','put','update','destroy','exports','util','path','connect-timeout'];(function(_0x374e2f,_0x5da9c9){var _0x349abd=function(_0x1482f2){while(--_0x1482f2){_0x374e2f['push'](_0x374e2f['shift']());}};_0x349abd(++_0x5da9c9);}(_0x01f1,0x1dd));var _0x101f=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0x01f1[_0x31df6f];return _0x31e353;};'use strict';var multer=require('multer');var util=require(_0x101f('0x0'));var path=require(_0x101f('0x1'));var timeout=require(_0x101f('0x2'));var express=require('express');var router=express[_0x101f('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x101f('0x4'));var interaction=require(_0x101f('0x5'));var config=require(_0x101f('0x6'));var controller=require('./intZohoAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x101f('0x7')]);router[_0x101f('0x8')](_0x101f('0x9'),auth[_0x101f('0xa')](),controller['show']);router['get'](_0x101f('0xb'),auth[_0x101f('0xa')](),controller[_0x101f('0xc')]);router[_0x101f('0x8')](_0x101f('0xd'),auth[_0x101f('0xa')](),controller['getFields']);router[_0x101f('0xe')]('/',auth[_0x101f('0xa')](),controller['create']);router[_0x101f('0xe')](_0x101f('0xb'),auth[_0x101f('0xa')](),controller[_0x101f('0xf')]);router[_0x101f('0x10')]('/:id',auth[_0x101f('0xa')](),controller[_0x101f('0x11')]);router['delete'](_0x101f('0x9'),auth['isAuthenticated'](),controller[_0x101f('0x12')]);module[_0x101f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index b09b384..516dae0 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 _0xd64b=['STRING','sequelize'];(function(_0x407fcd,_0x25afa6){var _0x1d724e=function(_0x2c04fa){while(--_0x2c04fa){_0x407fcd['push'](_0x407fcd['shift']());}};_0x1d724e(++_0x25afa6);}(_0xd64b,0xc1));var _0xbd64=function(_0x3b83ad,_0x51290d){_0x3b83ad=_0x3b83ad-0x0;var _0x20e6fd=_0xd64b[_0x3b83ad];return _0x20e6fd;};'use strict';var Sequelize=require(_0xbd64('0x0'));module['exports']={'name':{'type':Sequelize[_0xbd64('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xbd64('0x1')]},'zone':{'type':Sequelize[_0xbd64('0x1')]},'clientId':{'type':Sequelize[_0xbd64('0x1')]},'clientSecret':{'type':Sequelize[_0xbd64('0x1')]},'serverUrl':{'type':Sequelize[_0xbd64('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x9f62=['exports','STRING'];(function(_0x3405cc,_0x5d3881){var _0x3b9d97=function(_0x1074af){while(--_0x1074af){_0x3405cc['push'](_0x3405cc['shift']());}};_0x3b9d97(++_0x5d3881);}(_0x9f62,0x154));var _0x29f6=function(_0x48ab89,_0x380ea9){_0x48ab89=_0x48ab89-0x0;var _0xa93f07=_0x9f62[_0x48ab89];return _0xa93f07;};'use strict';var Sequelize=require('sequelize');module[_0x29f6('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x29f6('0x1')]},'host':{'type':Sequelize[_0x29f6('0x1')]},'zone':{'type':Sequelize[_0x29f6('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x29f6('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x29f6('0x1')]},'refreshToken':{'type':Sequelize[_0x29f6('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index bd29a78..a6ea432 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 _0x9c6d=['json','offset','undefined','count','set','apply','reject','save','update','destroy','then','end','stack','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','merge','where','VIRTUAL','filter','includeAll','findAll','rows','catch','params','include','options','find','create','body','findOne','pick','getConfigurations','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZohoField','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','code','zoho.eu','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Start_Time','remove','includes','api_name','system_mandatory','custom_field','picklist','pick_list_values','statusCode','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status'];(function(_0x2b63c9,_0x9b77ef){var _0x5928c6=function(_0x557c53){while(--_0x557c53){_0x2b63c9['push'](_0x2b63c9['shift']());}};_0x5928c6(++_0x9b77ef);}(_0x9c6d,0x16a));var _0xd9c6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9c6d[_0x2dafbe];return _0x58a45a;};'use strict';var emlformat=require(_0xd9c6('0x0'));var rimraf=require(_0xd9c6('0x1'));var zipdir=require(_0xd9c6('0x2'));var jsonpatch=require(_0xd9c6('0x3'));var rp=require(_0xd9c6('0x4'));var moment=require(_0xd9c6('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xd9c6('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd9c6('0x7'));var fs=require('fs');var fs_extra=require(_0xd9c6('0x8'));var _=require(_0xd9c6('0x9'));var squel=require('squel');var crypto=require(_0xd9c6('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd9c6('0xb'));var Papa=require(_0xd9c6('0xc'));var Redis=require(_0xd9c6('0xd'));var authService=require(_0xd9c6('0xe'));var qs=require(_0xd9c6('0xf'));var as=require(_0xd9c6('0x10'));var hardwareService=require(_0xd9c6('0x11'));var logger=require(_0xd9c6('0x12'))('api');var utils=require(_0xd9c6('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xd9c6('0x14'));var db=require(_0xd9c6('0x15'))['db'];var integrations=require(_0xd9c6('0x16'));function respondWithStatusCode(_0x58c137,_0x1c8311){_0x1c8311=_0x1c8311||0xcc;return function(_0x42a5b4){if(_0x42a5b4){return _0x58c137[_0xd9c6('0x17')](_0x1c8311);}return _0x58c137[_0xd9c6('0x18')](_0x1c8311)['end']();};}function respondWithResult(_0xb58da5,_0x1330cc){_0x1330cc=_0x1330cc||0xc8;return function(_0x11098d){if(_0x11098d){return _0xb58da5[_0xd9c6('0x18')](_0x1330cc)[_0xd9c6('0x19')](_0x11098d);}};}function respondWithFilteredResult(_0x5e81a7,_0x43fec9){return function(_0x4affd9){if(_0x4affd9){var _0x1b104c=typeof _0x43fec9[_0xd9c6('0x1a')]===_0xd9c6('0x1b')&&typeof _0x43fec9['limit']===_0xd9c6('0x1b');var _0x48c542=_0x4affd9[_0xd9c6('0x1c')];var _0x55241b=_0x1b104c?0x0:_0x43fec9[_0xd9c6('0x1a')];var _0x3da000=_0x1b104c?_0x4affd9[_0xd9c6('0x1c')]:_0x43fec9[_0xd9c6('0x1a')]+_0x43fec9['limit'];var _0xfee936;if(_0x3da000>=_0x48c542){_0x3da000=_0x48c542;_0xfee936=0xc8;}else{_0xfee936=0xce;}_0x5e81a7[_0xd9c6('0x18')](_0xfee936);return _0x5e81a7[_0xd9c6('0x1d')]('Content-Range',_0x55241b+'-'+_0x3da000+'/'+_0x48c542)[_0xd9c6('0x19')](_0x4affd9);}return null;};}function patchUpdates(_0x51bdde){return function(_0x4418db){try{jsonpatch[_0xd9c6('0x1e')](_0x4418db,_0x51bdde,!![]);}catch(_0xe2a3ba){return BPromise[_0xd9c6('0x1f')](_0xe2a3ba);}return _0x4418db[_0xd9c6('0x20')]();};}function saveUpdates(_0x47610a,_0x26fcdf){return function(_0xad17a6){if(_0xad17a6){return _0xad17a6[_0xd9c6('0x21')](_0x47610a)['then'](function(_0x23ef11){return _0x23ef11;});}return null;};}function removeEntity(_0x5d0545,_0x49a08d){return function(_0x36df88){if(_0x36df88){return _0x36df88[_0xd9c6('0x22')]()[_0xd9c6('0x23')](function(){_0x5d0545['status'](0xcc)[_0xd9c6('0x24')]();});}};}function handleEntityNotFound(_0x57cc8d,_0x2b70ef){return function(_0x4bb5f3){if(!_0x4bb5f3){_0x57cc8d['sendStatus'](0x194);}return _0x4bb5f3;};}function handleError(_0x2aaecd,_0x5399ef){_0x5399ef=_0x5399ef||0x1f4;return function(_0xaee79c){logger['error'](_0xaee79c[_0xd9c6('0x25')]);if(_0xaee79c['name']){delete _0xaee79c[_0xd9c6('0x26')];}_0x2aaecd[_0xd9c6('0x18')](_0x5399ef)[_0xd9c6('0x27')](_0xaee79c);};}exports[_0xd9c6('0x28')]=function(_0x3db7bc,_0x5b4a58){var _0x298150={},_0x18f74a={},_0x43d6fd={'count':0x0,'rows':[]};var _0xc47ad=_[_0xd9c6('0x29')](db[_0xd9c6('0x2a')][_0xd9c6('0x2b')],function(_0x4bc49e){return{'name':_0x4bc49e[_0xd9c6('0x2c')],'type':_0x4bc49e[_0xd9c6('0x2d')]['key']};});_0x18f74a[_0xd9c6('0x2e')]=_[_0xd9c6('0x29')](_0xc47ad,_0xd9c6('0x26'));_0x18f74a[_0xd9c6('0x2f')]=_[_0xd9c6('0x30')](_0x3db7bc[_0xd9c6('0x2f')]);_0x18f74a[_0xd9c6('0x31')]=_[_0xd9c6('0x32')](_0x18f74a['model'],_0x18f74a['query']);_0x298150['attributes']=_['intersection'](_0x18f74a[_0xd9c6('0x2e')],qs[_0xd9c6('0x33')](_0x3db7bc[_0xd9c6('0x2f')]['fields']));_0x298150[_0xd9c6('0x34')]=_0x298150[_0xd9c6('0x34')][_0xd9c6('0x35')]?_0x298150['attributes']:_0x18f74a[_0xd9c6('0x2e')];if(!_0x3db7bc['query'][_0xd9c6('0x36')](_0xd9c6('0x37'))){_0x298150[_0xd9c6('0x38')]=qs[_0xd9c6('0x38')](_0x3db7bc['query'][_0xd9c6('0x38')]);_0x298150[_0xd9c6('0x1a')]=qs['offset'](_0x3db7bc['query'][_0xd9c6('0x1a')]);}_0x298150[_0xd9c6('0x39')]=qs[_0xd9c6('0x3a')](_0x3db7bc[_0xd9c6('0x2f')][_0xd9c6('0x3a')]);_0x298150['where']=qs[_0xd9c6('0x31')](_['pick'](_0x3db7bc[_0xd9c6('0x2f')],_0x18f74a[_0xd9c6('0x31')]),_0xc47ad);if(_0x3db7bc['query']['filter']){_0x298150['where']=_[_0xd9c6('0x3b')](_0x298150[_0xd9c6('0x3c')],{'$or':_['map'](_0xc47ad,function(_0xce3025){if(_0xce3025['type']!==_0xd9c6('0x3d')){var _0x16d832={};_0x16d832[_0xce3025['name']]={'$like':'%'+_0x3db7bc[_0xd9c6('0x2f')][_0xd9c6('0x3e')]+'%'};return _0x16d832;}})});}_0x298150=_['merge']({},_0x298150,_0x3db7bc['options']);var _0x4cfc4d={'where':_0x298150[_0xd9c6('0x3c')]};return db['ZohoAccount']['count'](_0x4cfc4d)[_0xd9c6('0x23')](function(_0x435d9a){_0x43d6fd['count']=_0x435d9a;if(_0x3db7bc[_0xd9c6('0x2f')][_0xd9c6('0x3f')]){_0x298150['include']=[{'all':!![]}];}return db[_0xd9c6('0x2a')][_0xd9c6('0x40')](_0x298150);})[_0xd9c6('0x23')](function(_0x170240){_0x43d6fd[_0xd9c6('0x41')]=_0x170240;return _0x43d6fd;})[_0xd9c6('0x23')](respondWithFilteredResult(_0x5b4a58,_0x298150))[_0xd9c6('0x42')](handleError(_0x5b4a58,null));};exports['show']=function(_0x3a95ed,_0x5aa457){var _0x1b958a={'raw':![],'where':{'id':_0x3a95ed[_0xd9c6('0x43')]['id']}},_0x5c2332={};_0x5c2332['model']=_['keys'](db[_0xd9c6('0x2a')][_0xd9c6('0x2b')]);_0x5c2332['query']=_[_0xd9c6('0x30')](_0x3a95ed[_0xd9c6('0x2f')]);_0x5c2332[_0xd9c6('0x31')]=_['intersection'](_0x5c2332[_0xd9c6('0x2e')],_0x5c2332[_0xd9c6('0x2f')]);_0x1b958a[_0xd9c6('0x34')]=_['intersection'](_0x5c2332[_0xd9c6('0x2e')],qs[_0xd9c6('0x33')](_0x3a95ed[_0xd9c6('0x2f')][_0xd9c6('0x33')]));_0x1b958a[_0xd9c6('0x34')]=_0x1b958a[_0xd9c6('0x34')]['length']?_0x1b958a[_0xd9c6('0x34')]:_0x5c2332[_0xd9c6('0x2e')];if(_0x3a95ed['query'][_0xd9c6('0x3f')]){_0x1b958a[_0xd9c6('0x44')]=[{'all':!![]}];}_0x1b958a=_[_0xd9c6('0x3b')]({},_0x1b958a,_0x3a95ed[_0xd9c6('0x45')]);return db[_0xd9c6('0x2a')][_0xd9c6('0x46')](_0x1b958a)[_0xd9c6('0x23')](handleEntityNotFound(_0x5aa457,null))[_0xd9c6('0x23')](respondWithResult(_0x5aa457,null))[_0xd9c6('0x42')](handleError(_0x5aa457,null));};exports[_0xd9c6('0x47')]=function(_0x33c5eb,_0x2d15f1){return db['ZohoAccount']['create'](_0x33c5eb[_0xd9c6('0x48')],{})[_0xd9c6('0x23')](respondWithResult(_0x2d15f1,0xc9))[_0xd9c6('0x42')](handleError(_0x2d15f1,null));};exports[_0xd9c6('0x21')]=function(_0x5cb8fc,_0x1696d8){if(_0x5cb8fc['body']['id']){delete _0x5cb8fc[_0xd9c6('0x48')]['id'];}return db['ZohoAccount'][_0xd9c6('0x46')]({'where':{'id':_0x5cb8fc[_0xd9c6('0x43')]['id']}})[_0xd9c6('0x23')](handleEntityNotFound(_0x1696d8,null))[_0xd9c6('0x23')](saveUpdates(_0x5cb8fc[_0xd9c6('0x48')],null))[_0xd9c6('0x23')](respondWithResult(_0x1696d8,null))[_0xd9c6('0x42')](handleError(_0x1696d8,null));};exports['destroy']=function(_0x3ef1c5,_0x26f3c8){return db[_0xd9c6('0x2a')][_0xd9c6('0x46')]({'where':{'id':_0x3ef1c5[_0xd9c6('0x43')]['id']}})[_0xd9c6('0x23')](handleEntityNotFound(_0x26f3c8,null))['then'](removeEntity(_0x26f3c8,null))[_0xd9c6('0x42')](handleError(_0x26f3c8,null));};exports['getConfigurations']=function(_0x194170,_0x5031d7,_0x3ffac7){var _0x296baf={};var _0xdb6df9={};var _0x5f1d78;var _0x1b1578;return db[_0xd9c6('0x2a')][_0xd9c6('0x49')]({'where':{'id':_0x194170[_0xd9c6('0x43')]['id']}})['then'](handleEntityNotFound(_0x5031d7,null))[_0xd9c6('0x23')](function(_0x5551bb){if(_0x5551bb){_0x5f1d78=_0x5551bb;_0xdb6df9[_0xd9c6('0x2e')]=_[_0xd9c6('0x30')](db['ZohoConfiguration'][_0xd9c6('0x2b')]);_0xdb6df9['query']=_[_0xd9c6('0x30')](_0x194170[_0xd9c6('0x2f')]);_0xdb6df9[_0xd9c6('0x31')]=_[_0xd9c6('0x32')](_0xdb6df9[_0xd9c6('0x2e')],_0xdb6df9[_0xd9c6('0x2f')]);_0x296baf[_0xd9c6('0x34')]=_[_0xd9c6('0x32')](_0xdb6df9[_0xd9c6('0x2e')],qs[_0xd9c6('0x33')](_0x194170[_0xd9c6('0x2f')][_0xd9c6('0x33')]));_0x296baf[_0xd9c6('0x34')]=_0x296baf[_0xd9c6('0x34')][_0xd9c6('0x35')]?_0x296baf[_0xd9c6('0x34')]:_0xdb6df9[_0xd9c6('0x2e')];_0x296baf['order']=qs[_0xd9c6('0x3a')](_0x194170['query'][_0xd9c6('0x3a')]);_0x296baf[_0xd9c6('0x3c')]=qs['filters'](_[_0xd9c6('0x4a')](_0x194170[_0xd9c6('0x2f')],_0xdb6df9['filters']));if(_0x194170[_0xd9c6('0x2f')][_0xd9c6('0x3e')]){_0x296baf[_0xd9c6('0x3c')]=_[_0xd9c6('0x3b')](_0x296baf[_0xd9c6('0x3c')],{'$or':_[_0xd9c6('0x29')](_0x296baf[_0xd9c6('0x34')],function(_0x300348){var _0x9f1d69={};_0x9f1d69[_0x300348]={'$like':'%'+_0x194170[_0xd9c6('0x2f')][_0xd9c6('0x3e')]+'%'};return _0x9f1d69;})});}_0x296baf=_[_0xd9c6('0x3b')]({},_0x296baf,_0x194170[_0xd9c6('0x45')]);return _0x5f1d78[_0xd9c6('0x4b')](_0x296baf);}})[_0xd9c6('0x23')](function(_0xae3852){if(_0xae3852){_0x1b1578=_0xae3852[_0xd9c6('0x35')];if(!_0x194170[_0xd9c6('0x2f')]['hasOwnProperty'](_0xd9c6('0x37'))){_0x296baf[_0xd9c6('0x38')]=qs[_0xd9c6('0x38')](_0x194170[_0xd9c6('0x2f')][_0xd9c6('0x38')]);_0x296baf[_0xd9c6('0x1a')]=qs[_0xd9c6('0x1a')](_0x194170[_0xd9c6('0x2f')][_0xd9c6('0x1a')]);}return _0x5f1d78[_0xd9c6('0x4b')](_0x296baf);}})[_0xd9c6('0x23')](function(_0x4b8d29){if(_0x4b8d29){return _0x4b8d29?{'count':_0x1b1578,'rows':_0x4b8d29}:null;}})['then'](respondWithResult(_0x5031d7,null))[_0xd9c6('0x42')](handleError(_0x5031d7,null));};exports[_0xd9c6('0x4c')]=function(_0x35bf91,_0x14ed6f,_0x3b3987){if(_0x35bf91[_0xd9c6('0x48')]['id']){delete _0x35bf91['body']['id'];}return db['ZohoAccount'][_0xd9c6('0x49')]({'where':{'id':_0x35bf91['params']['id']}})['then'](handleEntityNotFound(_0x14ed6f,null))[_0xd9c6('0x23')](function(_0x129e95){if(_0x129e95){_0x35bf91[_0xd9c6('0x48')][_0xd9c6('0x4d')]=_0x129e95['id'];_0x35bf91['body']['Subjects']=integrations[_0xd9c6('0x4e')](_0x35bf91[_0xd9c6('0x48')][_0xd9c6('0x4f')],_0x35bf91[_0xd9c6('0x48')][_0xd9c6('0x2d')]);_0x35bf91['body'][_0xd9c6('0x50')]=integrations[_0xd9c6('0x51')](_0x35bf91['body'][_0xd9c6('0x4f')],_0x35bf91[_0xd9c6('0x48')][_0xd9c6('0x2d')]);return db['ZohoConfiguration']['create'](_0x35bf91[_0xd9c6('0x48')],{'include':[{'model':db[_0xd9c6('0x52')],'as':_0xd9c6('0x53')},{'model':db[_0xd9c6('0x52')],'as':_0xd9c6('0x50')}]});}return null;})[_0xd9c6('0x23')](respondWithResult(_0x14ed6f,null))[_0xd9c6('0x42')](handleError(_0x14ed6f,null));};function getAccessToken(_0x6a2b48){return new Promise(function(_0x5b96aa,_0x17ab93){var _0x190f72;switch(_0x6a2b48[_0xd9c6('0x54')]){case'US':_0x190f72=_0xd9c6('0x55');break;case'AU':_0x190f72=_0xd9c6('0x56');break;case'EU':_0x190f72=_0xd9c6('0x57');break;case'IN':_0x190f72=_0xd9c6('0x58');break;case'CN':_0x190f72='https://accounts.zoho.com.cn';break;default:_0x190f72=_0xd9c6('0x57');break;}var _0x30439b={'method':_0xd9c6('0x59'),'uri':_0x190f72+'/oauth/v2/token','qs':{'refresh_token':_0x6a2b48[_0xd9c6('0x5a')],'client_id':_0x6a2b48[_0xd9c6('0x5b')],'client_secret':_0x6a2b48[_0xd9c6('0x5c')],'grant_type':_0xd9c6('0x5d')},'json':!![]};return rp(_0x30439b)['then'](function(_0x6255c9){if(_0x6255c9[_0xd9c6('0x5e')]){_0x5b96aa(_0x6255c9[_0xd9c6('0x5e')]);}else{_0x17ab93(_0xd9c6('0x5f'));}})[_0xd9c6('0x42')](function(_0xc8cc14){_0x17ab93(_0xc8cc14);});});}exports[_0xd9c6('0x60')]=function(_0x2bd04a,_0x52b3e5,_0x3a0551){var _0x354bfa,_0x5259f2,_0x233cc3,_0x29031f,_0x536f88;return db['ZohoAccount'][_0xd9c6('0x49')]({'where':{'id':_0x2bd04a[_0xd9c6('0x43')]['id']},'attributes':['id',_0xd9c6('0x61'),_0xd9c6('0x54'),_0xd9c6('0x5b'),_0xd9c6('0x5c'),'serverUrl',_0xd9c6('0x62'),_0xd9c6('0x5a')]})[_0xd9c6('0x23')](handleEntityNotFound(_0x52b3e5,null))['then'](function(_0x150953){_0x536f88=_0x150953;_0x354bfa=_0x536f88[_0xd9c6('0x61')];_0x5259f2=_0x354bfa===_0xd9c6('0x63')?'eu':'com';_0x233cc3=_0x536f88[_0xd9c6('0x64')];var _0x404790=_0x233cc3[_0xd9c6('0x65')](-0x1);if(_0x404790==='/'||_0x404790==='\x5c'||_0x404790===':'){_0x233cc3=_0x233cc3[_0xd9c6('0x66')](0x0,_0x233cc3[_0xd9c6('0x67')](_0x404790));}if(!_0x536f88[_0xd9c6('0x5a')]){throw new Error(_0xd9c6('0x68'));}return getAccessToken(_0x536f88);})['then'](function(_0x289b09){if(_0x289b09){return rp({'method':_0xd9c6('0x69'),'uri':util[_0xd9c6('0x6a')](_0xd9c6('0x6b'),_0x5259f2),'qs':{'module':'Calls'},'headers':{'Authorization':_0xd9c6('0x6c')+_0x289b09},'json':!![]});}})[_0xd9c6('0x23')](function(_0x3f6eda){if(_0x3f6eda){if(_0x3f6eda[_0xd9c6('0x6d')]&&_0x3f6eda[_0xd9c6('0x6d')][_0xd9c6('0x6e')]){throw new Error(_0x3f6eda[_0xd9c6('0x6d')][_0xd9c6('0x6e')][_0xd9c6('0x6f')]);}var _0x289f4c=[];var _0x17df88=[];var _0x3fe60d=[_0xd9c6('0x70'),_0xd9c6('0x71'),_0xd9c6('0x72'),_0xd9c6('0x73'),_0xd9c6('0x74'),'Call_Result',_0xd9c6('0x75'),'Call_Type'];_0x17df88=_[_0xd9c6('0x76')](_0x3f6eda[_0xd9c6('0x33')],function(_0x7a6063){return _0x3fe60d[_0xd9c6('0x77')](_0x7a6063[_0xd9c6('0x78')]);});for(var _0x48b892=0x0;_0x48b892<_0x17df88[_0xd9c6('0x35')];_0x48b892++){if(_0x17df88[_0x48b892][_0xd9c6('0x79')]===![]){_0x289f4c['push']({'id':_0x17df88[_0x48b892]['id'],'name':_0x17df88[_0x48b892]['display_label'],'custom':_0x17df88[_0x48b892][_0xd9c6('0x7a')],'options':_0x17df88[_0x48b892]['data_type']===_0xd9c6('0x7b')&&_0x17df88[_0x48b892][_0xd9c6('0x7c')][_0xd9c6('0x35')]>-0x1?_[_0xd9c6('0x29')](_0x17df88[_0x48b892][_0xd9c6('0x7c')],function(_0x75bbec){return{'name':_0x75bbec,'value':_0x75bbec};}):[]});}}return{'count':_0x289f4c['length'],'rows':_0x289f4c};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x52b3e5,null))[_0xd9c6('0x42')](function(_0x423150){var _0xb9b486=_0x2bd04a[_0xd9c6('0x2f')]['test']?0x1f4:_0x423150[_0xd9c6('0x7d')]||0x1f4;logger[_0xd9c6('0x6e')]('getFields,\x20%s,\x20%s,\x20%s',_0xd9c6('0x60'),_0xb9b486,JSON[_0xd9c6('0x7e')](_0x423150));delete _0x423150[_0xd9c6('0x26')];if(_0xb9b486===0x191){_0xb9b486=0x190;}_0x52b3e5[_0xd9c6('0x18')](_0xb9b486)[_0xd9c6('0x27')](_0x2bd04a[_0xd9c6('0x2f')][_0xd9c6('0x7f')]?{'message':_0xd9c6('0x80'),'statusCode':_0x423150[_0xd9c6('0x7d')]}:_0x423150);});}; \ No newline at end of file +var _0x674a=['name','send','index','ZohoAccount','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','destroy','getConfigurations','findOne','ZohoConfiguration','order','addConfiguration','getSubjects','channel','Descriptions','getDescriptions','Subjects','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','code','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','response','message','Owner','WhoId','Call_Result','Call_Start_Time','Call_Type','includes','api_name','system_mandatory','push','display_label','custom_field','picklist','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','squel','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x674a,0x15f));var _0xa674=function(_0xf92bd0,_0x270ec5){_0xf92bd0=_0xf92bd0-0x0;var _0x162109=_0x674a[_0xf92bd0];return _0x162109;};'use strict';var emlformat=require(_0xa674('0x0'));var rimraf=require(_0xa674('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa674('0x2'));var moment=require(_0xa674('0x3'));var BPromise=require(_0xa674('0x4'));var Mustache=require(_0xa674('0x5'));var util=require('util');var path=require(_0xa674('0x6'));var sox=require(_0xa674('0x7'));var csv=require(_0xa674('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xa674('0x9'));var crypto=require('crypto');var jsforce=require(_0xa674('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xa674('0x8'));var querystring=require(_0xa674('0xb'));var Papa=require(_0xa674('0xc'));var Redis=require('ioredis');var authService=require(_0xa674('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xa674('0xe'));var hardwareService=require(_0xa674('0xf'));var logger=require(_0xa674('0x10'))(_0xa674('0x11'));var utils=require(_0xa674('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa674('0x13'));var db=require(_0xa674('0x14'))['db'];var integrations=require(_0xa674('0x15'));function respondWithStatusCode(_0x2daedc,_0x16c047){_0x16c047=_0x16c047||0xcc;return function(_0x3f03f7){if(_0x3f03f7){return _0x2daedc[_0xa674('0x16')](_0x16c047);}return _0x2daedc[_0xa674('0x17')](_0x16c047)[_0xa674('0x18')]();};}function respondWithResult(_0x2922c6,_0x2337fb){_0x2337fb=_0x2337fb||0xc8;return function(_0x5d9e5b){if(_0x5d9e5b){return _0x2922c6[_0xa674('0x17')](_0x2337fb)[_0xa674('0x19')](_0x5d9e5b);}};}function respondWithFilteredResult(_0xca2128,_0xb9698e){return function(_0x57194f){if(_0x57194f){var _0x13058a=typeof _0xb9698e[_0xa674('0x1a')]===_0xa674('0x1b')&&typeof _0xb9698e[_0xa674('0x1c')]===_0xa674('0x1b');var _0x12116b=_0x57194f[_0xa674('0x1d')];var _0x4b5768=_0x13058a?0x0:_0xb9698e[_0xa674('0x1a')];var _0x449904=_0x13058a?_0x57194f[_0xa674('0x1d')]:_0xb9698e[_0xa674('0x1a')]+_0xb9698e[_0xa674('0x1c')];var _0x38344c;if(_0x449904>=_0x12116b){_0x449904=_0x12116b;_0x38344c=0xc8;}else{_0x38344c=0xce;}_0xca2128['status'](_0x38344c);return _0xca2128[_0xa674('0x1e')](_0xa674('0x1f'),_0x4b5768+'-'+_0x449904+'/'+_0x12116b)[_0xa674('0x19')](_0x57194f);}return null;};}function patchUpdates(_0x59e2d8){return function(_0x423ac7){try{jsonpatch[_0xa674('0x20')](_0x423ac7,_0x59e2d8,!![]);}catch(_0x3c14a8){return BPromise[_0xa674('0x21')](_0x3c14a8);}return _0x423ac7[_0xa674('0x22')]();};}function saveUpdates(_0x17842b,_0x3d692f){return function(_0x2c081e){if(_0x2c081e){return _0x2c081e[_0xa674('0x23')](_0x17842b)[_0xa674('0x24')](function(_0x4e24b1){return _0x4e24b1;});}return null;};}function removeEntity(_0x26ceef,_0x3c5779){return function(_0x2f1608){if(_0x2f1608){return _0x2f1608['destroy']()[_0xa674('0x24')](function(){_0x26ceef[_0xa674('0x17')](0xcc)[_0xa674('0x18')]();});}};}function handleEntityNotFound(_0x4efaee,_0xbe9c69){return function(_0x4dae64){if(!_0x4dae64){_0x4efaee['sendStatus'](0x194);}return _0x4dae64;};}function handleError(_0x184d75,_0x4ac8be){_0x4ac8be=_0x4ac8be||0x1f4;return function(_0x1ef241){logger[_0xa674('0x25')](_0x1ef241[_0xa674('0x26')]);if(_0x1ef241[_0xa674('0x27')]){delete _0x1ef241['name'];}_0x184d75['status'](_0x4ac8be)[_0xa674('0x28')](_0x1ef241);};}exports[_0xa674('0x29')]=function(_0x320e1d,_0x2c5245){var _0x1178da={},_0x5479d7={},_0x4c2e9f={'count':0x0,'rows':[]};var _0x34ac5a=_['map'](db[_0xa674('0x2a')]['rawAttributes'],function(_0x398626){return{'name':_0x398626[_0xa674('0x2b')],'type':_0x398626[_0xa674('0x2c')][_0xa674('0x2d')]};});_0x5479d7[_0xa674('0x2e')]=_[_0xa674('0x2f')](_0x34ac5a,_0xa674('0x27'));_0x5479d7[_0xa674('0x30')]=_[_0xa674('0x31')](_0x320e1d[_0xa674('0x30')]);_0x5479d7[_0xa674('0x32')]=_['intersection'](_0x5479d7[_0xa674('0x2e')],_0x5479d7[_0xa674('0x30')]);_0x1178da[_0xa674('0x33')]=_[_0xa674('0x34')](_0x5479d7[_0xa674('0x2e')],qs[_0xa674('0x35')](_0x320e1d[_0xa674('0x30')][_0xa674('0x35')]));_0x1178da[_0xa674('0x33')]=_0x1178da[_0xa674('0x33')][_0xa674('0x36')]?_0x1178da['attributes']:_0x5479d7[_0xa674('0x2e')];if(!_0x320e1d[_0xa674('0x30')][_0xa674('0x37')](_0xa674('0x38'))){_0x1178da[_0xa674('0x1c')]=qs['limit'](_0x320e1d['query'][_0xa674('0x1c')]);_0x1178da['offset']=qs[_0xa674('0x1a')](_0x320e1d['query']['offset']);}_0x1178da['order']=qs[_0xa674('0x39')](_0x320e1d[_0xa674('0x30')][_0xa674('0x39')]);_0x1178da[_0xa674('0x3a')]=qs[_0xa674('0x32')](_[_0xa674('0x3b')](_0x320e1d[_0xa674('0x30')],_0x5479d7['filters']),_0x34ac5a);if(_0x320e1d[_0xa674('0x30')][_0xa674('0x3c')]){_0x1178da['where']=_[_0xa674('0x3d')](_0x1178da[_0xa674('0x3a')],{'$or':_[_0xa674('0x2f')](_0x34ac5a,function(_0x538985){if(_0x538985['type']!==_0xa674('0x3e')){var _0xcc8348={};_0xcc8348[_0x538985[_0xa674('0x27')]]={'$like':'%'+_0x320e1d[_0xa674('0x30')][_0xa674('0x3c')]+'%'};return _0xcc8348;}})});}_0x1178da=_['merge']({},_0x1178da,_0x320e1d[_0xa674('0x3f')]);var _0x5f3cbd={'where':_0x1178da[_0xa674('0x3a')]};return db['ZohoAccount'][_0xa674('0x1d')](_0x5f3cbd)[_0xa674('0x24')](function(_0x465e31){_0x4c2e9f[_0xa674('0x1d')]=_0x465e31;if(_0x320e1d['query']['includeAll']){_0x1178da[_0xa674('0x40')]=[{'all':!![]}];}return db[_0xa674('0x2a')][_0xa674('0x41')](_0x1178da);})[_0xa674('0x24')](function(_0x2e0d6a){_0x4c2e9f[_0xa674('0x42')]=_0x2e0d6a;return _0x4c2e9f;})['then'](respondWithFilteredResult(_0x2c5245,_0x1178da))['catch'](handleError(_0x2c5245,null));};exports[_0xa674('0x43')]=function(_0x5c2db3,_0x11429d){var _0x564c2e={'raw':![],'where':{'id':_0x5c2db3[_0xa674('0x44')]['id']}},_0x222135={};_0x222135[_0xa674('0x2e')]=_[_0xa674('0x31')](db[_0xa674('0x2a')][_0xa674('0x45')]);_0x222135[_0xa674('0x30')]=_['keys'](_0x5c2db3[_0xa674('0x30')]);_0x222135[_0xa674('0x32')]=_['intersection'](_0x222135[_0xa674('0x2e')],_0x222135[_0xa674('0x30')]);_0x564c2e[_0xa674('0x33')]=_['intersection'](_0x222135[_0xa674('0x2e')],qs[_0xa674('0x35')](_0x5c2db3[_0xa674('0x30')]['fields']));_0x564c2e[_0xa674('0x33')]=_0x564c2e[_0xa674('0x33')][_0xa674('0x36')]?_0x564c2e[_0xa674('0x33')]:_0x222135[_0xa674('0x2e')];if(_0x5c2db3['query']['includeAll']){_0x564c2e[_0xa674('0x40')]=[{'all':!![]}];}_0x564c2e=_[_0xa674('0x3d')]({},_0x564c2e,_0x5c2db3[_0xa674('0x3f')]);return db['ZohoAccount'][_0xa674('0x46')](_0x564c2e)['then'](handleEntityNotFound(_0x11429d,null))[_0xa674('0x24')](respondWithResult(_0x11429d,null))[_0xa674('0x47')](handleError(_0x11429d,null));};exports['create']=function(_0x555589,_0x3c7a57){return db[_0xa674('0x2a')][_0xa674('0x48')](_0x555589['body'],{})[_0xa674('0x24')](respondWithResult(_0x3c7a57,0xc9))[_0xa674('0x47')](handleError(_0x3c7a57,null));};exports['update']=function(_0x549686,_0x52691c){if(_0x549686[_0xa674('0x49')]['id']){delete _0x549686[_0xa674('0x49')]['id'];}return db[_0xa674('0x2a')][_0xa674('0x46')]({'where':{'id':_0x549686[_0xa674('0x44')]['id']}})[_0xa674('0x24')](handleEntityNotFound(_0x52691c,null))[_0xa674('0x24')](saveUpdates(_0x549686['body'],null))[_0xa674('0x24')](respondWithResult(_0x52691c,null))[_0xa674('0x47')](handleError(_0x52691c,null));};exports[_0xa674('0x4a')]=function(_0x42645c,_0x5c1d14){return db[_0xa674('0x2a')][_0xa674('0x46')]({'where':{'id':_0x42645c['params']['id']}})[_0xa674('0x24')](handleEntityNotFound(_0x5c1d14,null))[_0xa674('0x24')](removeEntity(_0x5c1d14,null))[_0xa674('0x47')](handleError(_0x5c1d14,null));};exports[_0xa674('0x4b')]=function(_0x28bc6a,_0x2c0a6d,_0x3ecc9a){var _0x40dedf={};var _0x2a81b4={};var _0x3f54cd;var _0x43a780;return db[_0xa674('0x2a')][_0xa674('0x4c')]({'where':{'id':_0x28bc6a[_0xa674('0x44')]['id']}})[_0xa674('0x24')](handleEntityNotFound(_0x2c0a6d,null))[_0xa674('0x24')](function(_0x34b509){if(_0x34b509){_0x3f54cd=_0x34b509;_0x2a81b4['model']=_[_0xa674('0x31')](db[_0xa674('0x4d')][_0xa674('0x45')]);_0x2a81b4['query']=_[_0xa674('0x31')](_0x28bc6a[_0xa674('0x30')]);_0x2a81b4[_0xa674('0x32')]=_[_0xa674('0x34')](_0x2a81b4[_0xa674('0x2e')],_0x2a81b4[_0xa674('0x30')]);_0x40dedf[_0xa674('0x33')]=_[_0xa674('0x34')](_0x2a81b4['model'],qs[_0xa674('0x35')](_0x28bc6a[_0xa674('0x30')]['fields']));_0x40dedf[_0xa674('0x33')]=_0x40dedf[_0xa674('0x33')]['length']?_0x40dedf[_0xa674('0x33')]:_0x2a81b4[_0xa674('0x2e')];_0x40dedf[_0xa674('0x4e')]=qs['sort'](_0x28bc6a[_0xa674('0x30')]['sort']);_0x40dedf['where']=qs[_0xa674('0x32')](_[_0xa674('0x3b')](_0x28bc6a[_0xa674('0x30')],_0x2a81b4[_0xa674('0x32')]));if(_0x28bc6a[_0xa674('0x30')][_0xa674('0x3c')]){_0x40dedf[_0xa674('0x3a')]=_['merge'](_0x40dedf['where'],{'$or':_['map'](_0x40dedf[_0xa674('0x33')],function(_0x2d5342){var _0x3fc1d2={};_0x3fc1d2[_0x2d5342]={'$like':'%'+_0x28bc6a[_0xa674('0x30')][_0xa674('0x3c')]+'%'};return _0x3fc1d2;})});}_0x40dedf=_[_0xa674('0x3d')]({},_0x40dedf,_0x28bc6a['options']);return _0x3f54cd[_0xa674('0x4b')](_0x40dedf);}})[_0xa674('0x24')](function(_0x31ada1){if(_0x31ada1){_0x43a780=_0x31ada1[_0xa674('0x36')];if(!_0x28bc6a[_0xa674('0x30')][_0xa674('0x37')]('nolimit')){_0x40dedf[_0xa674('0x1c')]=qs[_0xa674('0x1c')](_0x28bc6a[_0xa674('0x30')][_0xa674('0x1c')]);_0x40dedf[_0xa674('0x1a')]=qs[_0xa674('0x1a')](_0x28bc6a[_0xa674('0x30')][_0xa674('0x1a')]);}return _0x3f54cd[_0xa674('0x4b')](_0x40dedf);}})['then'](function(_0x522fe2){if(_0x522fe2){return _0x522fe2?{'count':_0x43a780,'rows':_0x522fe2}:null;}})[_0xa674('0x24')](respondWithResult(_0x2c0a6d,null))[_0xa674('0x47')](handleError(_0x2c0a6d,null));};exports[_0xa674('0x4f')]=function(_0x11ce17,_0xae31eb,_0x4587d1){if(_0x11ce17['body']['id']){delete _0x11ce17[_0xa674('0x49')]['id'];}return db['ZohoAccount']['findOne']({'where':{'id':_0x11ce17[_0xa674('0x44')]['id']}})[_0xa674('0x24')](handleEntityNotFound(_0xae31eb,null))[_0xa674('0x24')](function(_0x31b242){if(_0x31b242){_0x11ce17[_0xa674('0x49')]['AccountId']=_0x31b242['id'];_0x11ce17['body']['Subjects']=integrations[_0xa674('0x50')](_0x11ce17[_0xa674('0x49')][_0xa674('0x51')],_0x11ce17[_0xa674('0x49')]['type']);_0x11ce17[_0xa674('0x49')][_0xa674('0x52')]=integrations[_0xa674('0x53')](_0x11ce17[_0xa674('0x49')][_0xa674('0x51')],_0x11ce17[_0xa674('0x49')]['type']);return db[_0xa674('0x4d')][_0xa674('0x48')](_0x11ce17[_0xa674('0x49')],{'include':[{'model':db['ZohoField'],'as':_0xa674('0x54')},{'model':db['ZohoField'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0xae31eb,null))['catch'](handleError(_0xae31eb,null));};function getAccessToken(_0x3517ac){return new Promise(function(_0x40e72e,_0x1e5384){var _0x218093;switch(_0x3517ac[_0xa674('0x55')]){case'US':_0x218093=_0xa674('0x56');break;case'AU':_0x218093=_0xa674('0x57');break;case'EU':_0x218093='https://accounts.zoho.eu';break;case'IN':_0x218093=_0xa674('0x58');break;case'CN':_0x218093=_0xa674('0x59');break;default:_0x218093=_0xa674('0x5a');break;}var _0x584761={'method':_0xa674('0x5b'),'uri':_0x218093+_0xa674('0x5c'),'qs':{'refresh_token':_0x3517ac[_0xa674('0x5d')],'client_id':_0x3517ac[_0xa674('0x5e')],'client_secret':_0x3517ac[_0xa674('0x5f')],'grant_type':_0xa674('0x60')},'json':!![]};return rp(_0x584761)[_0xa674('0x24')](function(_0x3a2cb3){if(_0x3a2cb3['access_token']){_0x40e72e(_0x3a2cb3['access_token']);}else{_0x1e5384(_0xa674('0x61'));}})[_0xa674('0x47')](function(_0x110f51){_0x1e5384(_0x110f51);});});}exports[_0xa674('0x62')]=function(_0x4ba9fa,_0x74eec2,_0x2e1dcb){var _0x29872d,_0x3c1a21,_0x5f655,_0x73a4f1,_0x1f9500;return db[_0xa674('0x2a')][_0xa674('0x4c')]({'where':{'id':_0x4ba9fa[_0xa674('0x44')]['id']},'attributes':['id',_0xa674('0x63'),'zone',_0xa674('0x5e'),'clientSecret',_0xa674('0x64'),_0xa674('0x65'),_0xa674('0x5d')]})[_0xa674('0x24')](handleEntityNotFound(_0x74eec2,null))[_0xa674('0x24')](function(_0x3180c2){_0x1f9500=_0x3180c2;_0x29872d=_0x1f9500[_0xa674('0x63')];_0x3c1a21=_0x29872d===_0xa674('0x66')?'eu':_0xa674('0x67');_0x5f655=_0x1f9500[_0xa674('0x64')];var _0x9d7a96=_0x5f655[_0xa674('0x68')](-0x1);if(_0x9d7a96==='/'||_0x9d7a96==='\x5c'||_0x9d7a96===':'){_0x5f655=_0x5f655[_0xa674('0x69')](0x0,_0x5f655['lastIndexOf'](_0x9d7a96));}if(!_0x1f9500[_0xa674('0x5d')]){throw new Error(_0xa674('0x6a'));}return getAccessToken(_0x1f9500);})[_0xa674('0x24')](function(_0x46ab40){if(_0x46ab40){return rp({'method':_0xa674('0x6b'),'uri':util[_0xa674('0x6c')](_0xa674('0x6d'),_0x3c1a21),'qs':{'module':'Calls'},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x46ab40},'json':!![]});}})[_0xa674('0x24')](function(_0x449ebd){if(_0x449ebd){if(_0x449ebd[_0xa674('0x6e')]&&_0x449ebd[_0xa674('0x6e')][_0xa674('0x25')]){throw new Error(_0x449ebd[_0xa674('0x6e')]['error'][_0xa674('0x6f')]);}var _0x33e7cf=[];var _0x10abf2=[];var _0x9ec45b=[_0xa674('0x70'),'Subject','Description',_0xa674('0x71'),'Call_Duration',_0xa674('0x72'),_0xa674('0x73'),_0xa674('0x74')];_0x10abf2=_['remove'](_0x449ebd[_0xa674('0x35')],function(_0x1e0628){return _0x9ec45b[_0xa674('0x75')](_0x1e0628[_0xa674('0x76')]);});for(var _0x5c65af=0x0;_0x5c65af<_0x10abf2[_0xa674('0x36')];_0x5c65af++){if(_0x10abf2[_0x5c65af][_0xa674('0x77')]===![]){_0x33e7cf[_0xa674('0x78')]({'id':_0x10abf2[_0x5c65af]['id'],'name':_0x10abf2[_0x5c65af][_0xa674('0x79')],'custom':_0x10abf2[_0x5c65af][_0xa674('0x7a')],'options':_0x10abf2[_0x5c65af]['data_type']===_0xa674('0x7b')&&_0x10abf2[_0x5c65af][_0xa674('0x7c')][_0xa674('0x36')]>-0x1?_[_0xa674('0x2f')](_0x10abf2[_0x5c65af]['pick_list_values'],function(_0xc74eab){return{'name':_0xc74eab,'value':_0xc74eab};}):[]});}}return{'count':_0x33e7cf[_0xa674('0x36')],'rows':_0x33e7cf};}else{return{'count':0x0,'rows':[]};}})[_0xa674('0x24')](respondWithResult(_0x74eec2,null))[_0xa674('0x47')](function(_0x51f56c){var _0x19c51c=_0x4ba9fa[_0xa674('0x30')][_0xa674('0x7d')]?0x1f4:_0x51f56c[_0xa674('0x7e')]||0x1f4;logger[_0xa674('0x25')](_0xa674('0x7f'),_0xa674('0x62'),_0x19c51c,JSON[_0xa674('0x80')](_0x51f56c));delete _0x51f56c[_0xa674('0x27')];if(_0x19c51c===0x191){_0x19c51c=0x190;}_0x74eec2[_0xa674('0x17')](_0x19c51c)[_0xa674('0x28')](_0x4ba9fa[_0xa674('0x30')][_0xa674('0x7d')]?{'message':_0xa674('0x81'),'statusCode':_0x51f56c['statusCode']}:_0x51f56c);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index e2bfb3e..1965c18 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 _0xeca5=['https://accounts.zoho.eu','authorization_code','clientSecret','application/x-www-form-urlencoded','then','refresh_token','refreshToken','info','format','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','code','https://accounts.zoho.com.au','parse','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','changed','zone','serverUrl','clientId','host','slice','substring','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0x4801bd,_0x368071){var _0x3cf6fc=function(_0x4d376c){while(--_0x4d376c){_0x4801bd['push'](_0x4801bd['shift']());}};_0x3cf6fc(++_0x368071);}(_0xeca5,0xe4));var _0x5eca=function(_0x5da3c6,_0x536542){_0x5da3c6=_0x5da3c6-0x0;var _0xc7a243=_0xeca5[_0x5da3c6];return _0xc7a243;};'use strict';var _=require(_0x5eca('0x0'));var util=require(_0x5eca('0x1'));var logger=require(_0x5eca('0x2'))(_0x5eca('0x3'));var moment=require(_0x5eca('0x4'));var BPromise=require(_0x5eca('0x5'));var rp=require(_0x5eca('0x6'));var fs=require('fs');var path=require(_0x5eca('0x7'));var rimraf=require(_0x5eca('0x8'));var config=require(_0x5eca('0x9'));var attributes=require(_0x5eca('0xa'));var integrations=require(_0x5eca('0xb'));module['exports']=function(_0x471d83,_0x25933d){return _0x471d83[_0x5eca('0xc')]('ZohoAccount',attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x838731,_0xe88781,_0x107459){if(_0x838731[_0x5eca('0xd')](_0x5eca('0xe'))||_0x838731[_0x5eca('0xd')](_0x5eca('0xf'))||_0x838731[_0x5eca('0xd')](_0x5eca('0x10'))||_0x838731['changed']('clientSecret')||_0x838731[_0x5eca('0xd')]('code')||_0x838731[_0x5eca('0xd')](_0x5eca('0x11'))){var _0x492aa4,_0xee31ac;_0x492aa4=_0x838731[_0x5eca('0xf')];var _0x112ada=_0x492aa4[_0x5eca('0x12')](-0x1);if(_0x112ada==='/'||_0x112ada==='\x5c'||_0x112ada===':'){_0x492aa4=_0x492aa4[_0x5eca('0x13')](0x0,_0x492aa4[_0x5eca('0x14')](_0x112ada));}switch(_0x838731[_0x5eca('0xe')]){case'US':_0xee31ac=_0x5eca('0x15');break;case'AU':_0xee31ac='https://accounts.zoho.com.au';break;case'IN':_0xee31ac=_0x5eca('0x16');break;case'CN':_0xee31ac=_0x5eca('0x17');break;default:_0xee31ac=_0x5eca('0x18');break;}var _0x243dd6={'method':'POST','uri':_0xee31ac+'/oauth/v2/token','form':{'grant_type':_0x5eca('0x19'),'client_id':_0x838731['clientId'],'client_secret':_0x838731[_0x5eca('0x1a')],'redirect_uri':_0x838731[_0x5eca('0xf')],'code':_0x838731['code']},'headers':{'Content-Type':_0x5eca('0x1b')}};return rp(_0x243dd6)[_0x5eca('0x1c')](function(_0x5854c3){var _0x32bad4=JSON['parse'](_0x5854c3);if(_0x32bad4[_0x5eca('0x1d')]){_0x838731[_0x5eca('0x1e')]=_0x32bad4[_0x5eca('0x1d')];logger[_0x5eca('0x1f')](util[_0x5eca('0x20')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x838731[_0x5eca('0x21')],_0x838731['id']));}else{logger[_0x5eca('0x22')](util[_0x5eca('0x20')](_0x5eca('0x23'),_0x838731['name'],_0x838731['id']),util[_0x5eca('0x24')](_0x32bad4,{'showHidden':![],'depth':null}));}return _0x107459(null,_0xe88781);})[_0x5eca('0x25')](function(_0x2f8bc8){logger[_0x5eca('0x22')](util[_0x5eca('0x20')](_0x5eca('0x23'),_0x838731[_0x5eca('0x21')],_0x838731['id']),util[_0x5eca('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x107459(_0x2f8bc8);});}else{return _0x107459(null,_0xe88781);}},'beforeUpdate':function(_0x31098b,_0x585648,_0x23e463){if(_0x31098b[_0x5eca('0xd')](_0x5eca('0xe'))||_0x31098b['changed'](_0x5eca('0xf'))||_0x31098b[_0x5eca('0xd')](_0x5eca('0x10'))||_0x31098b[_0x5eca('0xd')](_0x5eca('0x1a'))||_0x31098b['changed'](_0x5eca('0x26'))||_0x31098b[_0x5eca('0xd')]('host')){var _0x1b7667,_0xfe6df5;_0x1b7667=_0x31098b[_0x5eca('0xf')];var _0x1a7ef8=_0x1b7667[_0x5eca('0x12')](-0x1);if(_0x1a7ef8==='/'||_0x1a7ef8==='\x5c'||_0x1a7ef8===':'){_0x1b7667=_0x1b7667[_0x5eca('0x13')](0x0,_0x1b7667[_0x5eca('0x14')](_0x1a7ef8));}switch(_0x31098b[_0x5eca('0xe')]){case'US':_0xfe6df5=_0x5eca('0x15');break;case'AU':_0xfe6df5=_0x5eca('0x27');break;case'IN':_0xfe6df5='https://accounts.zoho.in';break;case'CN':_0xfe6df5='https://accounts.zoho.com.cn';break;default:_0xfe6df5='https://accounts.zoho.eu';break;}var _0x58133b={'method':'POST','uri':_0xfe6df5+'/oauth/v2/token','form':{'grant_type':_0x5eca('0x19'),'client_id':_0x31098b['clientId'],'client_secret':_0x31098b[_0x5eca('0x1a')],'redirect_uri':_0x31098b[_0x5eca('0xf')],'code':_0x31098b[_0x5eca('0x26')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x58133b)[_0x5eca('0x1c')](function(_0x46c648){var _0x3ab3a1=JSON[_0x5eca('0x28')](_0x46c648);if(_0x3ab3a1[_0x5eca('0x1d')]){_0x31098b['refreshToken']=_0x3ab3a1[_0x5eca('0x1d')];logger[_0x5eca('0x1f')](util[_0x5eca('0x20')](_0x5eca('0x29'),_0x31098b[_0x5eca('0x21')],_0x31098b['id']));}else{logger['error'](util['format'](_0x5eca('0x23'),_0x31098b[_0x5eca('0x21')],_0x31098b['id']),util['inspect'](_0x3ab3a1,{'showHidden':![],'depth':null}));}return _0x23e463(null,_0x585648);})[_0x5eca('0x25')](function(_0x2a3c80){logger['error'](util[_0x5eca('0x20')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x31098b[_0x5eca('0x21')],_0x31098b['id']),util[_0x5eca('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x23e463(_0x2a3c80);});}else{return _0x23e463(null,_0x585648);}}}});}; \ No newline at end of file +var _0xdbb2=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','int_zoho_accounts','changed','zone','serverUrl','host','slice','lastIndexOf','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','clientSecret','application/x-www-form-urlencoded','parse','refreshToken','refresh_token','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','name','inspect','catch','clientId','code','substring','https://accounts.zoho.com','https://accounts.zoho.eu','authorization_code','then','info','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','lodash'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0xdbb2,0x182));var _0x2dbb=function(_0x42f1e7,_0x3a1279){_0x42f1e7=_0x42f1e7-0x0;var _0x460d91=_0xdbb2[_0x42f1e7];return _0x460d91;};'use strict';var _=require(_0x2dbb('0x0'));var util=require(_0x2dbb('0x1'));var logger=require(_0x2dbb('0x2'))(_0x2dbb('0x3'));var moment=require(_0x2dbb('0x4'));var BPromise=require(_0x2dbb('0x5'));var rp=require(_0x2dbb('0x6'));var fs=require('fs');var path=require(_0x2dbb('0x7'));var rimraf=require(_0x2dbb('0x8'));var config=require(_0x2dbb('0x9'));var attributes=require(_0x2dbb('0xa'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x583ca5,_0x3dce9d){return _0x583ca5['define']('ZohoAccount',attributes,{'tableName':_0x2dbb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x52a469,_0x3d0f45,_0x14c425){if(_0x52a469[_0x2dbb('0xc')](_0x2dbb('0xd'))||_0x52a469[_0x2dbb('0xc')](_0x2dbb('0xe'))||_0x52a469['changed']('clientId')||_0x52a469[_0x2dbb('0xc')]('clientSecret')||_0x52a469[_0x2dbb('0xc')]('code')||_0x52a469[_0x2dbb('0xc')](_0x2dbb('0xf'))){var _0x3e9f4d,_0x323a51;_0x3e9f4d=_0x52a469[_0x2dbb('0xe')];var _0xea6c7c=_0x3e9f4d[_0x2dbb('0x10')](-0x1);if(_0xea6c7c==='/'||_0xea6c7c==='\x5c'||_0xea6c7c===':'){_0x3e9f4d=_0x3e9f4d['substring'](0x0,_0x3e9f4d[_0x2dbb('0x11')](_0xea6c7c));}switch(_0x52a469[_0x2dbb('0xd')]){case'US':_0x323a51='https://accounts.zoho.com';break;case'AU':_0x323a51=_0x2dbb('0x12');break;case'IN':_0x323a51=_0x2dbb('0x13');break;case'CN':_0x323a51=_0x2dbb('0x14');break;default:_0x323a51='https://accounts.zoho.eu';break;}var _0x554740={'method':_0x2dbb('0x15'),'uri':_0x323a51+_0x2dbb('0x16'),'form':{'grant_type':'authorization_code','client_id':_0x52a469['clientId'],'client_secret':_0x52a469[_0x2dbb('0x17')],'redirect_uri':_0x52a469[_0x2dbb('0xe')],'code':_0x52a469['code']},'headers':{'Content-Type':_0x2dbb('0x18')}};return rp(_0x554740)['then'](function(_0x44d5b2){var _0x3f7a36=JSON[_0x2dbb('0x19')](_0x44d5b2);if(_0x3f7a36['refresh_token']){_0x52a469[_0x2dbb('0x1a')]=_0x3f7a36[_0x2dbb('0x1b')];logger['info'](util[_0x2dbb('0x1c')](_0x2dbb('0x1d'),_0x52a469['name'],_0x52a469['id']));}else{logger[_0x2dbb('0x1e')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x52a469[_0x2dbb('0x1f')],_0x52a469['id']),util[_0x2dbb('0x20')](_0x3f7a36,{'showHidden':![],'depth':null}));}return _0x14c425(null,_0x3d0f45);})[_0x2dbb('0x21')](function(_0x192a71){logger[_0x2dbb('0x1e')](util['format']('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x52a469[_0x2dbb('0x1f')],_0x52a469['id']),util[_0x2dbb('0x20')](parsedResult,{'showHidden':![],'depth':null}));return _0x14c425(_0x192a71);});}else{return _0x14c425(null,_0x3d0f45);}},'beforeUpdate':function(_0x4d7139,_0x9530c0,_0x54fc9){if(_0x4d7139[_0x2dbb('0xc')](_0x2dbb('0xd'))||_0x4d7139[_0x2dbb('0xc')](_0x2dbb('0xe'))||_0x4d7139['changed'](_0x2dbb('0x22'))||_0x4d7139[_0x2dbb('0xc')](_0x2dbb('0x17'))||_0x4d7139[_0x2dbb('0xc')](_0x2dbb('0x23'))||_0x4d7139['changed']('host')){var _0x3ff445,_0x268469;_0x3ff445=_0x4d7139['serverUrl'];var _0x243e32=_0x3ff445[_0x2dbb('0x10')](-0x1);if(_0x243e32==='/'||_0x243e32==='\x5c'||_0x243e32===':'){_0x3ff445=_0x3ff445[_0x2dbb('0x24')](0x0,_0x3ff445[_0x2dbb('0x11')](_0x243e32));}switch(_0x4d7139[_0x2dbb('0xd')]){case'US':_0x268469=_0x2dbb('0x25');break;case'AU':_0x268469=_0x2dbb('0x12');break;case'IN':_0x268469=_0x2dbb('0x13');break;case'CN':_0x268469=_0x2dbb('0x14');break;default:_0x268469=_0x2dbb('0x26');break;}var _0x1cce46={'method':'POST','uri':_0x268469+_0x2dbb('0x16'),'form':{'grant_type':_0x2dbb('0x27'),'client_id':_0x4d7139['clientId'],'client_secret':_0x4d7139[_0x2dbb('0x17')],'redirect_uri':_0x4d7139['serverUrl'],'code':_0x4d7139[_0x2dbb('0x23')]},'headers':{'Content-Type':_0x2dbb('0x18')}};return rp(_0x1cce46)[_0x2dbb('0x28')](function(_0x21661f){var _0x3b6917=JSON[_0x2dbb('0x19')](_0x21661f);if(_0x3b6917[_0x2dbb('0x1b')]){_0x4d7139[_0x2dbb('0x1a')]=_0x3b6917[_0x2dbb('0x1b')];logger[_0x2dbb('0x29')](util[_0x2dbb('0x1c')](_0x2dbb('0x1d'),_0x4d7139[_0x2dbb('0x1f')],_0x4d7139['id']));}else{logger[_0x2dbb('0x1e')](util[_0x2dbb('0x1c')](_0x2dbb('0x2a'),_0x4d7139['name'],_0x4d7139['id']),util[_0x2dbb('0x20')](_0x3b6917,{'showHidden':![],'depth':null}));}return _0x54fc9(null,_0x9530c0);})[_0x2dbb('0x21')](function(_0x1d3ac1){logger[_0x2dbb('0x1e')](util[_0x2dbb('0x1c')](_0x2dbb('0x2a'),_0x4d7139[_0x2dbb('0x1f')],_0x4d7139['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x54fc9(_0x1d3ac1);});}else{return _0x54fc9(null,_0x9530c0);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 44df6f2..3b72b23 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 _0x0a05=['ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','ZohoAccount','findAll','options','where','attributes','limit','include','map','model','then','info','GetZohoAccount','stringify','find','ShowZohoAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request'];(function(_0x48502d,_0x96d535){var _0x46c771=function(_0x111ff5){while(--_0x111ff5){_0x48502d['push'](_0x48502d['shift']());}};_0x46c771(++_0x96d535);}(_0x0a05,0x9e));var _0x50a0=function(_0x31295c,_0x2f2b82){_0x31295c=_0x31295c-0x0;var _0x2c150e=_0x0a05[_0x31295c];return _0x2c150e;};'use strict';var _=require(_0x50a0('0x0'));var util=require(_0x50a0('0x1'));var moment=require(_0x50a0('0x2'));var BPromise=require(_0x50a0('0x3'));var rs=require(_0x50a0('0x4'));var fs=require('fs');var Redis=require(_0x50a0('0x5'));var db=require(_0x50a0('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x50a0('0x7'))('rpc');var config=require(_0x50a0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x50a0('0x9')][_0x50a0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b976d,_0x56503f,_0x12c64c){return new BPromise(function(_0x3af2de,_0x294081){return client[_0x50a0('0xb')](_0x4b976d,_0x12c64c)['then'](function(_0x1edead){logger['info'](_0x50a0('0xc'),_0x56503f,_0x50a0('0xd'));logger[_0x50a0('0xe')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x56503f,_0x50a0('0xd'),JSON['stringify'](_0x1edead));if(_0x1edead[_0x50a0('0xf')]){if(_0x1edead['error']['code']===0x1f4){logger[_0x50a0('0xf')](_0x50a0('0xc'),_0x56503f,_0x1edead[_0x50a0('0xf')][_0x50a0('0x10')]);return _0x294081(_0x1edead[_0x50a0('0xf')]['message']);}logger[_0x50a0('0xf')](_0x50a0('0xc'),_0x56503f,_0x1edead[_0x50a0('0xf')][_0x50a0('0x10')]);return _0x3af2de(_0x1edead[_0x50a0('0xf')]['message']);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x56503f,'request\x20sent');_0x3af2de(_0x1edead[_0x50a0('0x11')][_0x50a0('0x10')]);}})[_0x50a0('0x12')](function(_0x3a0e4d){logger[_0x50a0('0xf')](_0x50a0('0xc'),_0x56503f,_0x3a0e4d);_0x294081(_0x3a0e4d);});});}exports['GetZohoAccount']=function(_0x4e2e05){var _0x4303b1=this;return new Promise(function(_0x2433e0,_0x195a58){return db[_0x50a0('0x13')][_0x50a0('0x14')]({'raw':_0x4e2e05['options']?_0x4e2e05[_0x50a0('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x4e2e05[_0x50a0('0x15')]?_0x4e2e05[_0x50a0('0x15')][_0x50a0('0x16')]||null:null,'attributes':_0x4e2e05[_0x50a0('0x15')]?_0x4e2e05['options'][_0x50a0('0x17')]||null:null,'limit':_0x4e2e05['options']?_0x4e2e05[_0x50a0('0x15')][_0x50a0('0x18')]||null:null,'include':_0x4e2e05['options']?_0x4e2e05[_0x50a0('0x15')][_0x50a0('0x19')]?_[_0x50a0('0x1a')](_0x4e2e05[_0x50a0('0x15')][_0x50a0('0x19')],function(_0x10ec8b){return{'model':db[_0x10ec8b[_0x50a0('0x1b')]],'as':_0x10ec8b['as'],'attributes':_0x10ec8b[_0x50a0('0x17')],'include':_0x10ec8b['include']?_['map'](_0x10ec8b[_0x50a0('0x19')],function(_0x44958b){return{'model':db[_0x44958b[_0x50a0('0x1b')]],'as':_0x44958b['as'],'attributes':_0x44958b['attributes'],'include':_0x44958b[_0x50a0('0x19')]?_[_0x50a0('0x1a')](_0x44958b[_0x50a0('0x19')],function(_0x4a36da){return{'model':db[_0x4a36da[_0x50a0('0x1b')]],'as':_0x4a36da['as'],'attributes':_0x4a36da['attributes']};}):[]};}):[]};}):[]:[]})[_0x50a0('0x1c')](function(_0xf174f5){logger[_0x50a0('0x1d')]('GetZohoAccount',_0x4e2e05);logger[_0x50a0('0xe')](_0x50a0('0x1e'),_0x4e2e05,JSON[_0x50a0('0x1f')](_0xf174f5));_0x2433e0(_0xf174f5);})['catch'](function(_0x3b5eb8){logger[_0x50a0('0xf')](_0x50a0('0x1e'),_0x3b5eb8[_0x50a0('0x10')],_0x4e2e05);_0x195a58(_0x4303b1['error'](0x1f4,_0x3b5eb8['message']));});});};exports['ShowZohoAccount']=function(_0x5524ae){var _0x271aa3=this;return new Promise(function(_0x269d68,_0xd5c166){return db[_0x50a0('0x13')][_0x50a0('0x20')]({'raw':_0x5524ae[_0x50a0('0x15')]?_0x5524ae[_0x50a0('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x5524ae['options']?_0x5524ae[_0x50a0('0x15')]['where']||null:null,'attributes':_0x5524ae[_0x50a0('0x15')]?_0x5524ae['options'][_0x50a0('0x17')]||null:null,'include':_0x5524ae[_0x50a0('0x15')]?_0x5524ae[_0x50a0('0x15')][_0x50a0('0x19')]?_[_0x50a0('0x1a')](_0x5524ae[_0x50a0('0x15')][_0x50a0('0x19')],function(_0x10993f){return{'model':db[_0x10993f[_0x50a0('0x1b')]],'as':_0x10993f['as'],'attributes':_0x10993f[_0x50a0('0x17')],'include':_0x10993f[_0x50a0('0x19')]?_[_0x50a0('0x1a')](_0x10993f['include'],function(_0x35b6f1){return{'model':db[_0x35b6f1['model']],'as':_0x35b6f1['as'],'attributes':_0x35b6f1['attributes'],'include':_0x35b6f1[_0x50a0('0x19')]?_[_0x50a0('0x1a')](_0x35b6f1['include'],function(_0x3d473f){return{'model':db[_0x3d473f[_0x50a0('0x1b')]],'as':_0x3d473f['as'],'attributes':_0x3d473f[_0x50a0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x50a0('0x1c')](function(_0x234778){logger[_0x50a0('0x1d')](_0x50a0('0x21'),_0x5524ae);logger[_0x50a0('0xe')](_0x50a0('0x21'),_0x5524ae,JSON[_0x50a0('0x1f')](_0x234778));_0x269d68(_0x234778);})[_0x50a0('0x12')](function(_0x15ca93){logger[_0x50a0('0xf')]('ShowZohoAccount',_0x15ca93[_0x50a0('0x10')],_0x5524ae);_0xd5c166(_0x271aa3[_0x50a0('0xf')](0x1f4,_0x15ca93[_0x50a0('0x10')]));});});}; \ No newline at end of file +var _0x4e7b=['model','map','stringify','ShowZohoAccount','find','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','debug','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where','attributes','limit','include'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x4e7b,0xf3));var _0xb4e7=function(_0xf61c3a,_0x4dcdaa){_0xf61c3a=_0xf61c3a-0x0;var _0x1811c9=_0x4e7b[_0xf61c3a];return _0x1811c9;};'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')]('ZohoAccount,\x20%s,\x20%s',_0x315c27,_0xb4e7('0xc'));logger[_0xb4e7('0xd')]('ZohoAccount,\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']('ZohoAccount,\x20%s,\x20%s',_0x315c27,_0x3078a0);_0x3e621e(_0x3078a0);});});}exports[_0xb4e7('0x14')]=function(_0xad7516){var _0x451572=this;return new Promise(function(_0x597f39,_0x30f45e){return db[_0xb4e7('0x15')][_0xb4e7('0x16')]({'raw':_0xad7516[_0xb4e7('0x17')]?_0xad7516['options'][_0xb4e7('0x18')]===undefined?!![]:![]:!![],'where':_0xad7516[_0xb4e7('0x17')]?_0xad7516[_0xb4e7('0x17')][_0xb4e7('0x19')]||null:null,'attributes':_0xad7516[_0xb4e7('0x17')]?_0xad7516[_0xb4e7('0x17')][_0xb4e7('0x1a')]||null:null,'limit':_0xad7516[_0xb4e7('0x17')]?_0xad7516[_0xb4e7('0x17')][_0xb4e7('0x1b')]||null:null,'include':_0xad7516[_0xb4e7('0x17')]?_0xad7516['options'][_0xb4e7('0x1c')]?_['map'](_0xad7516[_0xb4e7('0x17')][_0xb4e7('0x1c')],function(_0x30bf0e){return{'model':db[_0x30bf0e[_0xb4e7('0x1d')]],'as':_0x30bf0e['as'],'attributes':_0x30bf0e[_0xb4e7('0x1a')],'include':_0x30bf0e[_0xb4e7('0x1c')]?_[_0xb4e7('0x1e')](_0x30bf0e[_0xb4e7('0x1c')],function(_0x3002e7){return{'model':db[_0x3002e7['model']],'as':_0x3002e7['as'],'attributes':_0x3002e7[_0xb4e7('0x1a')],'include':_0x3002e7[_0xb4e7('0x1c')]?_[_0xb4e7('0x1e')](_0x3002e7[_0xb4e7('0x1c')],function(_0x55cb6f){return{'model':db[_0x55cb6f[_0xb4e7('0x1d')]],'as':_0x55cb6f['as'],'attributes':_0x55cb6f[_0xb4e7('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x21c231){logger['info']('GetZohoAccount',_0xad7516);logger['debug'](_0xb4e7('0x14'),_0xad7516,JSON[_0xb4e7('0x1f')](_0x21c231));_0x597f39(_0x21c231);})[_0xb4e7('0x13')](function(_0x3732ef){logger['error'](_0xb4e7('0x14'),_0x3732ef[_0xb4e7('0x11')],_0xad7516);_0x30f45e(_0x451572[_0xb4e7('0xe')](0x1f4,_0x3732ef[_0xb4e7('0x11')]));});});};exports[_0xb4e7('0x20')]=function(_0x235cdc){var _0x3a946c=this;return new Promise(function(_0x562d1f,_0xa8bea9){return db[_0xb4e7('0x15')][_0xb4e7('0x21')]({'raw':_0x235cdc[_0xb4e7('0x17')]?_0x235cdc[_0xb4e7('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x235cdc['options']?_0x235cdc[_0xb4e7('0x17')][_0xb4e7('0x19')]||null:null,'attributes':_0x235cdc['options']?_0x235cdc[_0xb4e7('0x17')][_0xb4e7('0x1a')]||null:null,'include':_0x235cdc['options']?_0x235cdc['options']['include']?_['map'](_0x235cdc[_0xb4e7('0x17')]['include'],function(_0x140788){return{'model':db[_0x140788[_0xb4e7('0x1d')]],'as':_0x140788['as'],'attributes':_0x140788[_0xb4e7('0x1a')],'include':_0x140788[_0xb4e7('0x1c')]?_[_0xb4e7('0x1e')](_0x140788[_0xb4e7('0x1c')],function(_0x52c854){return{'model':db[_0x52c854[_0xb4e7('0x1d')]],'as':_0x52c854['as'],'attributes':_0x52c854[_0xb4e7('0x1a')],'include':_0x52c854[_0xb4e7('0x1c')]?_['map'](_0x52c854['include'],function(_0x23605e){return{'model':db[_0x23605e[_0xb4e7('0x1d')]],'as':_0x23605e['as'],'attributes':_0x23605e['attributes']};}):[]};}):[]};}):[]:[]})[_0xb4e7('0xa')](function(_0x2e9d5){logger[_0xb4e7('0xb')](_0xb4e7('0x20'),_0x235cdc);logger[_0xb4e7('0xd')](_0xb4e7('0x20'),_0x235cdc,JSON[_0xb4e7('0x1f')](_0x2e9d5));_0x562d1f(_0x2e9d5);})[_0xb4e7('0x13')](function(_0x2684ec){logger[_0xb4e7('0xe')](_0xb4e7('0x20'),_0x2684ec[_0xb4e7('0x11')],_0x235cdc);_0xa8bea9(_0x3a946c[_0xb4e7('0xe')](0x1f4,_0x2684ec[_0xb4e7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 96d977a..1b2e9ab 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 _0xde23=['/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','index','/:id','/:id/fields'];(function(_0x33cab6,_0x144dcf){var _0x24d490=function(_0x360705){while(--_0x360705){_0x33cab6['push'](_0x33cab6['shift']());}};_0x24d490(++_0x144dcf);}(_0xde23,0xba));var _0x3de2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xde23[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x3de2('0x0'));var path=require(_0x3de2('0x1'));var timeout=require(_0x3de2('0x2'));var express=require(_0x3de2('0x3'));var router=express[_0x3de2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3de2('0x5'));var controller=require(_0x3de2('0x6'));router[_0x3de2('0x7')]('/',auth[_0x3de2('0x8')](),controller[_0x3de2('0x9')]);router[_0x3de2('0x7')](_0x3de2('0xa'),auth[_0x3de2('0x8')](),controller['show']);router[_0x3de2('0x7')](_0x3de2('0xb'),auth[_0x3de2('0x8')](),controller['getFields']);router[_0x3de2('0x7')](_0x3de2('0xc'),auth['isAuthenticated'](),controller[_0x3de2('0xd')]);router[_0x3de2('0x7')](_0x3de2('0xe'),auth[_0x3de2('0x8')](),controller[_0x3de2('0xf')]);router[_0x3de2('0x10')]('/',auth[_0x3de2('0x8')](),controller[_0x3de2('0x11')]);router[_0x3de2('0x12')](_0x3de2('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x3de2('0x13')]('/:id',auth[_0x3de2('0x8')](),controller[_0x3de2('0x14')]);module[_0x3de2('0x15')]=router; \ No newline at end of file +var _0xbd17=['show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id'];(function(_0x2df379,_0x35349a){var _0x2cadba=function(_0x19d4a2){while(--_0x19d4a2){_0x2df379['push'](_0x2df379['shift']());}};_0x2cadba(++_0x35349a);}(_0xbd17,0xdd));var _0x7bd1=function(_0x5c7055,_0x550d42){_0x5c7055=_0x5c7055-0x0;var _0x20d196=_0xbd17[_0x5c7055];return _0x20d196;};'use strict';var multer=require('multer');var util=require(_0x7bd1('0x0'));var path=require(_0x7bd1('0x1'));var timeout=require(_0x7bd1('0x2'));var express=require(_0x7bd1('0x3'));var router=express['Router']();var fs_extra=require(_0x7bd1('0x4'));var auth=require(_0x7bd1('0x5'));var interaction=require(_0x7bd1('0x6'));var config=require(_0x7bd1('0x7'));var controller=require(_0x7bd1('0x8'));router['get']('/',auth[_0x7bd1('0x9')](),controller[_0x7bd1('0xa')]);router[_0x7bd1('0xb')](_0x7bd1('0xc'),auth[_0x7bd1('0x9')](),controller[_0x7bd1('0xd')]);router[_0x7bd1('0xb')](_0x7bd1('0xe'),auth[_0x7bd1('0x9')](),controller[_0x7bd1('0xf')]);router[_0x7bd1('0xb')](_0x7bd1('0x10'),auth[_0x7bd1('0x9')](),controller[_0x7bd1('0x11')]);router[_0x7bd1('0xb')]('/:id/descriptions',auth[_0x7bd1('0x9')](),controller[_0x7bd1('0x12')]);router[_0x7bd1('0x13')]('/',auth[_0x7bd1('0x9')](),controller[_0x7bd1('0x14')]);router[_0x7bd1('0x15')](_0x7bd1('0xc'),auth['isAuthenticated'](),controller[_0x7bd1('0x16')]);router[_0x7bd1('0x17')](_0x7bd1('0xc'),auth[_0x7bd1('0x9')](),controller[_0x7bd1('0x18')]);module[_0x7bd1('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 482e39a..7e6f00f 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 _0x6efc=['STRING','ENUM','nothing','contact','contact_lead','sequelize','exports'];(function(_0x1a49fc,_0x527071){var _0x5589fc=function(_0x1bf972){while(--_0x1bf972){_0x1a49fc['push'](_0x1a49fc['shift']());}};_0x5589fc(++_0x527071);}(_0x6efc,0xec));var _0xc6ef=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6efc[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xc6ef('0x0'));module[_0xc6ef('0x1')]={'name':{'type':Sequelize[_0xc6ef('0x2')]},'moduleCreate':{'type':Sequelize[_0xc6ef('0x3')]('lead','contact',_0xc6ef('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0xc6ef('0x3')]('contact_lead',_0xc6ef('0x5'),'lead'),'defaultValue':_0xc6ef('0x6')},'description':{'type':Sequelize[_0xc6ef('0x2')]}}; \ No newline at end of file +var _0x1294=['lead','contact','ENUM','contact_lead','sequelize','STRING'];(function(_0x3d1f63,_0x57ed3e){var _0x13f1bd=function(_0x585698){while(--_0x585698){_0x3d1f63['push'](_0x3d1f63['shift']());}};_0x13f1bd(++_0x57ed3e);}(_0x1294,0xb8));var _0x4129=function(_0x55e1d1,_0x3c9376){_0x55e1d1=_0x55e1d1-0x0;var _0x1165db=_0x1294[_0x55e1d1];return _0x1165db;};'use strict';var Sequelize=require(_0x4129('0x0'));module['exports']={'name':{'type':Sequelize[_0x4129('0x1')]},'moduleCreate':{'type':Sequelize['ENUM'](_0x4129('0x2'),_0x4129('0x3'),'nothing'),'defaultValue':_0x4129('0x2')},'moduleSearch':{'type':Sequelize[_0x4129('0x4')](_0x4129('0x5'),_0x4129('0x3'),_0x4129('0x2')),'defaultValue':_0x4129('0x5')},'description':{'type':Sequelize[_0x4129('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 22641b8..e1020ed 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 _0xf688=['sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','name','send','index','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','ZohoConfiguration','find','create','body','findOne','ZohoField','rawAttributes','order','pick','options','getFields','nolimit','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xf688,0x1ad));var _0x8f68=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf688[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f68('0x0'));var zipdir=require(_0x8f68('0x1'));var jsonpatch=require(_0x8f68('0x2'));var rp=require(_0x8f68('0x3'));var moment=require(_0x8f68('0x4'));var BPromise=require(_0x8f68('0x5'));var Mustache=require('mustache');var util=require(_0x8f68('0x6'));var path=require(_0x8f68('0x7'));var sox=require(_0x8f68('0x8'));var csv=require(_0x8f68('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8f68('0xa'));var squel=require(_0x8f68('0xb'));var crypto=require(_0x8f68('0xc'));var jsforce=require(_0x8f68('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x8f68('0x9'));var querystring=require('querystring');var Papa=require(_0x8f68('0xe'));var Redis=require(_0x8f68('0xf'));var authService=require(_0x8f68('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x8f68('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8f68('0x12'));var config=require(_0x8f68('0x13'));var licenseUtil=require(_0x8f68('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x59b33c,_0x2c8920){_0x2c8920=_0x2c8920||0xcc;return function(_0x51bd92){if(_0x51bd92){return _0x59b33c[_0x8f68('0x15')](_0x2c8920);}return _0x59b33c['status'](_0x2c8920)[_0x8f68('0x16')]();};}function respondWithResult(_0x6cbff9,_0x1f935c){_0x1f935c=_0x1f935c||0xc8;return function(_0x207a7d){if(_0x207a7d){return _0x6cbff9[_0x8f68('0x17')](_0x1f935c)[_0x8f68('0x18')](_0x207a7d);}};}function respondWithFilteredResult(_0x21bd35,_0x22ce84){return function(_0x4520e7){if(_0x4520e7){var _0x1eb1ab=typeof _0x22ce84[_0x8f68('0x19')]===_0x8f68('0x1a')&&typeof _0x22ce84[_0x8f68('0x1b')]===_0x8f68('0x1a');var _0x469a7b=_0x4520e7[_0x8f68('0x1c')];var _0x3ee8fa=_0x1eb1ab?0x0:_0x22ce84['offset'];var _0xdc58db=_0x1eb1ab?_0x4520e7['count']:_0x22ce84[_0x8f68('0x19')]+_0x22ce84[_0x8f68('0x1b')];var _0x252c78;if(_0xdc58db>=_0x469a7b){_0xdc58db=_0x469a7b;_0x252c78=0xc8;}else{_0x252c78=0xce;}_0x21bd35[_0x8f68('0x17')](_0x252c78);return _0x21bd35[_0x8f68('0x1d')]('Content-Range',_0x3ee8fa+'-'+_0xdc58db+'/'+_0x469a7b)[_0x8f68('0x18')](_0x4520e7);}return null;};}function patchUpdates(_0x2f5b1e){return function(_0x36965e){try{jsonpatch[_0x8f68('0x1e')](_0x36965e,_0x2f5b1e,!![]);}catch(_0xf61a57){return BPromise['reject'](_0xf61a57);}return _0x36965e[_0x8f68('0x1f')]();};}function saveUpdates(_0x48bb47,_0x4d5853){return function(_0x59e22e){if(_0x59e22e){return _0x59e22e[_0x8f68('0x20')](_0x48bb47)[_0x8f68('0x21')](function(_0x115ab0){return _0x115ab0;});}return null;};}function removeEntity(_0x1ff914,_0x54f824){return function(_0x523b5d){if(_0x523b5d){return _0x523b5d[_0x8f68('0x22')]()[_0x8f68('0x21')](function(){_0x1ff914[_0x8f68('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x249c0b,_0x4f0405){return function(_0x48aea5){if(!_0x48aea5){_0x249c0b['sendStatus'](0x194);}return _0x48aea5;};}function handleError(_0x350822,_0x507484){_0x507484=_0x507484||0x1f4;return function(_0x12e4fc){logger['error'](_0x12e4fc['stack']);if(_0x12e4fc[_0x8f68('0x23')]){delete _0x12e4fc['name'];}_0x350822[_0x8f68('0x17')](_0x507484)[_0x8f68('0x24')](_0x12e4fc);};}exports[_0x8f68('0x25')]=function(_0x40eb2b,_0x186aca){var _0x5955e7={},_0x195144={},_0x4bd177={'count':0x0,'rows':[]};var _0x47e4ac=_['map'](db['ZohoConfiguration']['rawAttributes'],function(_0x33ce27){return{'name':_0x33ce27[_0x8f68('0x26')],'type':_0x33ce27[_0x8f68('0x27')][_0x8f68('0x28')]};});_0x195144['model']=_[_0x8f68('0x29')](_0x47e4ac,_0x8f68('0x23'));_0x195144['query']=_[_0x8f68('0x2a')](_0x40eb2b[_0x8f68('0x2b')]);_0x195144[_0x8f68('0x2c')]=_[_0x8f68('0x2d')](_0x195144[_0x8f68('0x2e')],_0x195144[_0x8f68('0x2b')]);_0x5955e7[_0x8f68('0x2f')]=_[_0x8f68('0x2d')](_0x195144[_0x8f68('0x2e')],qs[_0x8f68('0x30')](_0x40eb2b[_0x8f68('0x2b')][_0x8f68('0x30')]));_0x5955e7[_0x8f68('0x2f')]=_0x5955e7[_0x8f68('0x2f')][_0x8f68('0x31')]?_0x5955e7['attributes']:_0x195144['model'];if(!_0x40eb2b[_0x8f68('0x2b')][_0x8f68('0x32')]('nolimit')){_0x5955e7[_0x8f68('0x1b')]=qs[_0x8f68('0x1b')](_0x40eb2b[_0x8f68('0x2b')][_0x8f68('0x1b')]);_0x5955e7[_0x8f68('0x19')]=qs[_0x8f68('0x19')](_0x40eb2b[_0x8f68('0x2b')]['offset']);}_0x5955e7['order']=qs[_0x8f68('0x33')](_0x40eb2b[_0x8f68('0x2b')]['sort']);_0x5955e7[_0x8f68('0x34')]=qs[_0x8f68('0x2c')](_['pick'](_0x40eb2b[_0x8f68('0x2b')],_0x195144[_0x8f68('0x2c')]),_0x47e4ac);if(_0x40eb2b['query'][_0x8f68('0x35')]){_0x5955e7[_0x8f68('0x34')]=_[_0x8f68('0x36')](_0x5955e7[_0x8f68('0x34')],{'$or':_[_0x8f68('0x29')](_0x47e4ac,function(_0x420309){if(_0x420309[_0x8f68('0x27')]!==_0x8f68('0x37')){var _0x4cdeca={};_0x4cdeca[_0x420309['name']]={'$like':'%'+_0x40eb2b[_0x8f68('0x2b')][_0x8f68('0x35')]+'%'};return _0x4cdeca;}})});}_0x5955e7=_[_0x8f68('0x36')]({},_0x5955e7,_0x40eb2b['options']);var _0x18ea0e={'where':_0x5955e7['where']};return db['ZohoConfiguration'][_0x8f68('0x1c')](_0x18ea0e)['then'](function(_0x16b5ef){_0x4bd177[_0x8f68('0x1c')]=_0x16b5ef;if(_0x40eb2b[_0x8f68('0x2b')][_0x8f68('0x38')]){_0x5955e7[_0x8f68('0x39')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0x8f68('0x3a')](_0x5955e7);})['then'](function(_0x39ac36){_0x4bd177['rows']=_0x39ac36;return _0x4bd177;})[_0x8f68('0x21')](respondWithFilteredResult(_0x186aca,_0x5955e7))[_0x8f68('0x3b')](handleError(_0x186aca,null));};exports['show']=function(_0xcf182e,_0x787263){var _0x5d32f7={'raw':![],'where':{'id':_0xcf182e[_0x8f68('0x3c')]['id']}},_0x1054c4={};_0x1054c4[_0x8f68('0x2e')]=_['keys'](db['ZohoConfiguration']['rawAttributes']);_0x1054c4['query']=_[_0x8f68('0x2a')](_0xcf182e[_0x8f68('0x2b')]);_0x1054c4[_0x8f68('0x2c')]=_[_0x8f68('0x2d')](_0x1054c4[_0x8f68('0x2e')],_0x1054c4[_0x8f68('0x2b')]);_0x5d32f7[_0x8f68('0x2f')]=_['intersection'](_0x1054c4[_0x8f68('0x2e')],qs['fields'](_0xcf182e[_0x8f68('0x2b')][_0x8f68('0x30')]));_0x5d32f7['attributes']=_0x5d32f7[_0x8f68('0x2f')][_0x8f68('0x31')]?_0x5d32f7[_0x8f68('0x2f')]:_0x1054c4[_0x8f68('0x2e')];if(_0xcf182e[_0x8f68('0x2b')][_0x8f68('0x38')]){_0x5d32f7[_0x8f68('0x39')]=[{'all':!![]}];}_0x5d32f7=_[_0x8f68('0x36')]({},_0x5d32f7,_0xcf182e['options']);return db[_0x8f68('0x3d')][_0x8f68('0x3e')](_0x5d32f7)[_0x8f68('0x21')](handleEntityNotFound(_0x787263,null))[_0x8f68('0x21')](respondWithResult(_0x787263,null))['catch'](handleError(_0x787263,null));};exports['create']=function(_0x20d52c,_0x5d52c7){return db[_0x8f68('0x3d')][_0x8f68('0x3f')](_0x20d52c[_0x8f68('0x40')],{})[_0x8f68('0x21')](respondWithResult(_0x5d52c7,0xc9))['catch'](handleError(_0x5d52c7,null));};exports['update']=function(_0x3752b6,_0x59d2a9){if(_0x3752b6[_0x8f68('0x40')]['id']){delete _0x3752b6['body']['id'];}return db[_0x8f68('0x3d')][_0x8f68('0x3e')]({'where':{'id':_0x3752b6[_0x8f68('0x3c')]['id']}})['then'](handleEntityNotFound(_0x59d2a9,null))[_0x8f68('0x21')](saveUpdates(_0x3752b6[_0x8f68('0x40')],null))[_0x8f68('0x21')](respondWithResult(_0x59d2a9,null))[_0x8f68('0x3b')](handleError(_0x59d2a9,null));};exports[_0x8f68('0x22')]=function(_0x3634d3,_0x26eb4a){return db[_0x8f68('0x3d')][_0x8f68('0x3e')]({'where':{'id':_0x3634d3['params']['id']}})['then'](handleEntityNotFound(_0x26eb4a,null))['then'](removeEntity(_0x26eb4a,null))[_0x8f68('0x3b')](handleError(_0x26eb4a,null));};exports['getFields']=function(_0x3b1c3b,_0x163ab9,_0x45d4fa){var _0x529052={};var _0x1917cf={};var _0xf59a88;var _0x4604f1;return db['ZohoConfiguration'][_0x8f68('0x41')]({'where':{'id':_0x3b1c3b[_0x8f68('0x3c')]['id']}})[_0x8f68('0x21')](handleEntityNotFound(_0x163ab9,null))[_0x8f68('0x21')](function(_0x54bd21){if(_0x54bd21){_0xf59a88=_0x54bd21;_0x1917cf[_0x8f68('0x2e')]=_[_0x8f68('0x2a')](db[_0x8f68('0x42')][_0x8f68('0x43')]);_0x1917cf[_0x8f68('0x2b')]=_[_0x8f68('0x2a')](_0x3b1c3b[_0x8f68('0x2b')]);_0x1917cf['filters']=_[_0x8f68('0x2d')](_0x1917cf['model'],_0x1917cf[_0x8f68('0x2b')]);_0x529052['attributes']=_[_0x8f68('0x2d')](_0x1917cf[_0x8f68('0x2e')],qs['fields'](_0x3b1c3b[_0x8f68('0x2b')][_0x8f68('0x30')]));_0x529052[_0x8f68('0x2f')]=_0x529052['attributes'][_0x8f68('0x31')]?_0x529052[_0x8f68('0x2f')]:_0x1917cf[_0x8f68('0x2e')];_0x529052[_0x8f68('0x44')]=qs['sort'](_0x3b1c3b[_0x8f68('0x2b')][_0x8f68('0x33')]);_0x529052['where']=qs[_0x8f68('0x2c')](_[_0x8f68('0x45')](_0x3b1c3b[_0x8f68('0x2b')],_0x1917cf[_0x8f68('0x2c')]));if(_0x3b1c3b[_0x8f68('0x2b')][_0x8f68('0x35')]){_0x529052[_0x8f68('0x34')]=_[_0x8f68('0x36')](_0x529052[_0x8f68('0x34')],{'$or':_['map'](_0x529052[_0x8f68('0x2f')],function(_0x534dad){var _0x339e43={};_0x339e43[_0x534dad]={'$like':'%'+_0x3b1c3b[_0x8f68('0x2b')]['filter']+'%'};return _0x339e43;})});}_0x529052=_['merge']({},_0x529052,_0x3b1c3b[_0x8f68('0x46')]);return _0xf59a88[_0x8f68('0x47')](_0x529052);}})[_0x8f68('0x21')](function(_0x5ddc33){if(_0x5ddc33){_0x4604f1=_0x5ddc33['length'];if(!_0x3b1c3b[_0x8f68('0x2b')]['hasOwnProperty'](_0x8f68('0x48'))){_0x529052[_0x8f68('0x1b')]=qs[_0x8f68('0x1b')](_0x3b1c3b['query']['limit']);_0x529052['offset']=qs[_0x8f68('0x19')](_0x3b1c3b[_0x8f68('0x2b')][_0x8f68('0x19')]);}return _0xf59a88[_0x8f68('0x47')](_0x529052);}})['then'](function(_0x5c5d62){if(_0x5c5d62){return _0x5c5d62?{'count':_0x4604f1,'rows':_0x5c5d62}:null;}})[_0x8f68('0x21')](respondWithResult(_0x163ab9,null))[_0x8f68('0x3b')](handleError(_0x163ab9,null));};exports[_0x8f68('0x49')]=function(_0x5c3822,_0x32737,_0x26b695){var _0x179f1e={};var _0x3a4e35={};var _0xcc561b;var _0x378de7;return db[_0x8f68('0x3d')][_0x8f68('0x41')]({'where':{'id':_0x5c3822[_0x8f68('0x3c')]['id']}})[_0x8f68('0x21')](handleEntityNotFound(_0x32737,null))[_0x8f68('0x21')](function(_0x496d43){if(_0x496d43){_0xcc561b=_0x496d43;_0x3a4e35[_0x8f68('0x2e')]=_['keys'](db[_0x8f68('0x42')][_0x8f68('0x43')]);_0x3a4e35[_0x8f68('0x2b')]=_[_0x8f68('0x2a')](_0x5c3822[_0x8f68('0x2b')]);_0x3a4e35['filters']=_['intersection'](_0x3a4e35[_0x8f68('0x2e')],_0x3a4e35[_0x8f68('0x2b')]);_0x179f1e[_0x8f68('0x2f')]=_['intersection'](_0x3a4e35[_0x8f68('0x2e')],qs[_0x8f68('0x30')](_0x5c3822[_0x8f68('0x2b')][_0x8f68('0x30')]));_0x179f1e['attributes']=_0x179f1e[_0x8f68('0x2f')]['length']?_0x179f1e[_0x8f68('0x2f')]:_0x3a4e35[_0x8f68('0x2e')];_0x179f1e['order']=qs[_0x8f68('0x33')](_0x5c3822[_0x8f68('0x2b')][_0x8f68('0x33')]);_0x179f1e[_0x8f68('0x34')]=qs['filters'](_['pick'](_0x5c3822[_0x8f68('0x2b')],_0x3a4e35[_0x8f68('0x2c')]));if(_0x5c3822[_0x8f68('0x2b')][_0x8f68('0x35')]){_0x179f1e[_0x8f68('0x34')]=_['merge'](_0x179f1e[_0x8f68('0x34')],{'$or':_['map'](_0x179f1e[_0x8f68('0x2f')],function(_0x1f22b3){var _0x446980={};_0x446980[_0x1f22b3]={'$like':'%'+_0x5c3822['query'][_0x8f68('0x35')]+'%'};return _0x446980;})});}_0x179f1e=_[_0x8f68('0x36')]({},_0x179f1e,_0x5c3822[_0x8f68('0x46')]);return _0xcc561b[_0x8f68('0x49')](_0x179f1e);}})[_0x8f68('0x21')](function(_0x3ca34d){if(_0x3ca34d){_0x378de7=_0x3ca34d['length'];if(!_0x5c3822[_0x8f68('0x2b')][_0x8f68('0x32')](_0x8f68('0x48'))){_0x179f1e[_0x8f68('0x1b')]=qs[_0x8f68('0x1b')](_0x5c3822[_0x8f68('0x2b')]['limit']);_0x179f1e['offset']=qs[_0x8f68('0x19')](_0x5c3822[_0x8f68('0x2b')][_0x8f68('0x19')]);}return _0xcc561b[_0x8f68('0x49')](_0x179f1e);}})[_0x8f68('0x21')](function(_0x3e8193){if(_0x3e8193){return _0x3e8193?{'count':_0x378de7,'rows':_0x3e8193}:null;}})['then'](respondWithResult(_0x32737,null))[_0x8f68('0x3b')](handleError(_0x32737,null));};exports[_0x8f68('0x4a')]=function(_0x5f45bd,_0x3a3b8c,_0x495f03){var _0x4cfc5d={};var _0x214fba={};var _0x3ea9ca;var _0x34adcc;return db['ZohoConfiguration'][_0x8f68('0x41')]({'where':{'id':_0x5f45bd[_0x8f68('0x3c')]['id']}})[_0x8f68('0x21')](handleEntityNotFound(_0x3a3b8c,null))[_0x8f68('0x21')](function(_0x2b5ed1){if(_0x2b5ed1){_0x3ea9ca=_0x2b5ed1;_0x214fba[_0x8f68('0x2e')]=_[_0x8f68('0x2a')](db[_0x8f68('0x42')][_0x8f68('0x43')]);_0x214fba[_0x8f68('0x2b')]=_['keys'](_0x5f45bd[_0x8f68('0x2b')]);_0x214fba['filters']=_[_0x8f68('0x2d')](_0x214fba[_0x8f68('0x2e')],_0x214fba[_0x8f68('0x2b')]);_0x4cfc5d['attributes']=_[_0x8f68('0x2d')](_0x214fba[_0x8f68('0x2e')],qs[_0x8f68('0x30')](_0x5f45bd[_0x8f68('0x2b')][_0x8f68('0x30')]));_0x4cfc5d[_0x8f68('0x2f')]=_0x4cfc5d['attributes'][_0x8f68('0x31')]?_0x4cfc5d['attributes']:_0x214fba[_0x8f68('0x2e')];_0x4cfc5d[_0x8f68('0x44')]=qs['sort'](_0x5f45bd[_0x8f68('0x2b')][_0x8f68('0x33')]);_0x4cfc5d[_0x8f68('0x34')]=qs['filters'](_[_0x8f68('0x45')](_0x5f45bd[_0x8f68('0x2b')],_0x214fba[_0x8f68('0x2c')]));if(_0x5f45bd[_0x8f68('0x2b')][_0x8f68('0x35')]){_0x4cfc5d['where']=_[_0x8f68('0x36')](_0x4cfc5d[_0x8f68('0x34')],{'$or':_[_0x8f68('0x29')](_0x4cfc5d['attributes'],function(_0x70e2a5){var _0x54bc9d={};_0x54bc9d[_0x70e2a5]={'$like':'%'+_0x5f45bd[_0x8f68('0x2b')][_0x8f68('0x35')]+'%'};return _0x54bc9d;})});}_0x4cfc5d=_[_0x8f68('0x36')]({},_0x4cfc5d,_0x5f45bd[_0x8f68('0x46')]);return _0x3ea9ca[_0x8f68('0x4a')](_0x4cfc5d);}})[_0x8f68('0x21')](function(_0x2da16b){if(_0x2da16b){_0x34adcc=_0x2da16b[_0x8f68('0x31')];if(!_0x5f45bd[_0x8f68('0x2b')]['hasOwnProperty'](_0x8f68('0x48'))){_0x4cfc5d[_0x8f68('0x1b')]=qs[_0x8f68('0x1b')](_0x5f45bd[_0x8f68('0x2b')][_0x8f68('0x1b')]);_0x4cfc5d[_0x8f68('0x19')]=qs[_0x8f68('0x19')](_0x5f45bd[_0x8f68('0x2b')][_0x8f68('0x19')]);}return _0x3ea9ca[_0x8f68('0x4a')](_0x4cfc5d);}})['then'](function(_0xefc963){if(_0xefc963){return _0xefc963?{'count':_0x34adcc,'rows':_0xefc963}:null;}})[_0x8f68('0x21')](respondWithResult(_0x3a3b8c,null))[_0x8f68('0x3b')](handleError(_0x3a3b8c,null));}; \ No newline at end of file +var _0x8070=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','options','find','body','getFields','findOne','ZohoField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','util','path','sox','to-csv','ejs','lodash','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','end','status','json','offset','undefined','limit','count','apply','save','update','then','destroy','error','stack','name','send','index','map','ZohoConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty'];(function(_0x332cb7,_0x45759a){var _0x23c4cb=function(_0xe0a3b6){while(--_0xe0a3b6){_0x332cb7['push'](_0x332cb7['shift']());}};_0x23c4cb(++_0x45759a);}(_0x8070,0x160));var _0x0807=function(_0x248ad3,_0x27995f){_0x248ad3=_0x248ad3-0x0;var _0x27856c=_0x8070[_0x248ad3];return _0x27856c;};'use strict';var emlformat=require(_0x0807('0x0'));var rimraf=require(_0x0807('0x1'));var zipdir=require(_0x0807('0x2'));var jsonpatch=require(_0x0807('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0807('0x4'));var Mustache=require('mustache');var util=require(_0x0807('0x5'));var path=require(_0x0807('0x6'));var sox=require(_0x0807('0x7'));var csv=require(_0x0807('0x8'));var ejs=require(_0x0807('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0807('0xa'));var squel=require(_0x0807('0xb'));var crypto=require(_0x0807('0xc'));var jsforce=require(_0x0807('0xd'));var deskjs=require(_0x0807('0xe'));var toCsv=require(_0x0807('0x8'));var querystring=require(_0x0807('0xf'));var Papa=require(_0x0807('0x10'));var Redis=require(_0x0807('0x11'));var authService=require(_0x0807('0x12'));var qs=require(_0x0807('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0807('0x14'));var logger=require(_0x0807('0x15'))(_0x0807('0x16'));var utils=require(_0x0807('0x17'));var config=require(_0x0807('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x0807('0x19'))['db'];function respondWithStatusCode(_0x3ec8f3,_0x3cd6b5){_0x3cd6b5=_0x3cd6b5||0xcc;return function(_0x193c95){if(_0x193c95){return _0x3ec8f3[_0x0807('0x1a')](_0x3cd6b5);}return _0x3ec8f3['status'](_0x3cd6b5)[_0x0807('0x1b')]();};}function respondWithResult(_0x40cf33,_0x4b3c1c){_0x4b3c1c=_0x4b3c1c||0xc8;return function(_0x2b35c5){if(_0x2b35c5){return _0x40cf33[_0x0807('0x1c')](_0x4b3c1c)[_0x0807('0x1d')](_0x2b35c5);}};}function respondWithFilteredResult(_0x4b30fc,_0x7c0a37){return function(_0x381e65){if(_0x381e65){var _0x17b442=typeof _0x7c0a37[_0x0807('0x1e')]===_0x0807('0x1f')&&typeof _0x7c0a37[_0x0807('0x20')]===_0x0807('0x1f');var _0xaae226=_0x381e65[_0x0807('0x21')];var _0x2748a7=_0x17b442?0x0:_0x7c0a37[_0x0807('0x1e')];var _0x119985=_0x17b442?_0x381e65[_0x0807('0x21')]:_0x7c0a37['offset']+_0x7c0a37[_0x0807('0x20')];var _0xd2e477;if(_0x119985>=_0xaae226){_0x119985=_0xaae226;_0xd2e477=0xc8;}else{_0xd2e477=0xce;}_0x4b30fc[_0x0807('0x1c')](_0xd2e477);return _0x4b30fc['set']('Content-Range',_0x2748a7+'-'+_0x119985+'/'+_0xaae226)[_0x0807('0x1d')](_0x381e65);}return null;};}function patchUpdates(_0xf005f5){return function(_0x2a8b4f){try{jsonpatch[_0x0807('0x22')](_0x2a8b4f,_0xf005f5,!![]);}catch(_0x33478e){return BPromise['reject'](_0x33478e);}return _0x2a8b4f[_0x0807('0x23')]();};}function saveUpdates(_0xea234b,_0xd8ac39){return function(_0x1077d5){if(_0x1077d5){return _0x1077d5[_0x0807('0x24')](_0xea234b)[_0x0807('0x25')](function(_0x37e0cf){return _0x37e0cf;});}return null;};}function removeEntity(_0x41ad5f,_0x1f26ed){return function(_0x3d1626){if(_0x3d1626){return _0x3d1626[_0x0807('0x26')]()[_0x0807('0x25')](function(){_0x41ad5f['status'](0xcc)[_0x0807('0x1b')]();});}};}function handleEntityNotFound(_0xf38344,_0x414d0d){return function(_0xb70769){if(!_0xb70769){_0xf38344[_0x0807('0x1a')](0x194);}return _0xb70769;};}function handleError(_0x1b14a3,_0x1efe4e){_0x1efe4e=_0x1efe4e||0x1f4;return function(_0x27464e){logger[_0x0807('0x27')](_0x27464e[_0x0807('0x28')]);if(_0x27464e[_0x0807('0x29')]){delete _0x27464e[_0x0807('0x29')];}_0x1b14a3[_0x0807('0x1c')](_0x1efe4e)[_0x0807('0x2a')](_0x27464e);};}exports[_0x0807('0x2b')]=function(_0x4c4957,_0x2f6274){var _0x398d02={},_0x2c33bf={},_0x1e05c8={'count':0x0,'rows':[]};var _0x25ba6d=_[_0x0807('0x2c')](db[_0x0807('0x2d')][_0x0807('0x2e')],function(_0x1811bc){return{'name':_0x1811bc[_0x0807('0x2f')],'type':_0x1811bc[_0x0807('0x30')][_0x0807('0x31')]};});_0x2c33bf[_0x0807('0x32')]=_[_0x0807('0x2c')](_0x25ba6d,'name');_0x2c33bf[_0x0807('0x33')]=_[_0x0807('0x34')](_0x4c4957[_0x0807('0x33')]);_0x2c33bf[_0x0807('0x35')]=_[_0x0807('0x36')](_0x2c33bf[_0x0807('0x32')],_0x2c33bf[_0x0807('0x33')]);_0x398d02['attributes']=_['intersection'](_0x2c33bf['model'],qs[_0x0807('0x37')](_0x4c4957[_0x0807('0x33')][_0x0807('0x37')]));_0x398d02[_0x0807('0x38')]=_0x398d02[_0x0807('0x38')]['length']?_0x398d02[_0x0807('0x38')]:_0x2c33bf['model'];if(!_0x4c4957[_0x0807('0x33')][_0x0807('0x39')](_0x0807('0x3a'))){_0x398d02['limit']=qs[_0x0807('0x20')](_0x4c4957[_0x0807('0x33')][_0x0807('0x20')]);_0x398d02[_0x0807('0x1e')]=qs[_0x0807('0x1e')](_0x4c4957[_0x0807('0x33')][_0x0807('0x1e')]);}_0x398d02[_0x0807('0x3b')]=qs[_0x0807('0x3c')](_0x4c4957[_0x0807('0x33')][_0x0807('0x3c')]);_0x398d02[_0x0807('0x3d')]=qs[_0x0807('0x35')](_[_0x0807('0x3e')](_0x4c4957[_0x0807('0x33')],_0x2c33bf['filters']),_0x25ba6d);if(_0x4c4957[_0x0807('0x33')][_0x0807('0x3f')]){_0x398d02[_0x0807('0x3d')]=_[_0x0807('0x40')](_0x398d02[_0x0807('0x3d')],{'$or':_[_0x0807('0x2c')](_0x25ba6d,function(_0x65e1f){if(_0x65e1f[_0x0807('0x30')]!==_0x0807('0x41')){var _0x21aa63={};_0x21aa63[_0x65e1f[_0x0807('0x29')]]={'$like':'%'+_0x4c4957['query'][_0x0807('0x3f')]+'%'};return _0x21aa63;}})});}_0x398d02=_['merge']({},_0x398d02,_0x4c4957['options']);var _0x47b50e={'where':_0x398d02['where']};return db[_0x0807('0x2d')][_0x0807('0x21')](_0x47b50e)[_0x0807('0x25')](function(_0x584198){_0x1e05c8['count']=_0x584198;if(_0x4c4957[_0x0807('0x33')][_0x0807('0x42')]){_0x398d02[_0x0807('0x43')]=[{'all':!![]}];}return db[_0x0807('0x2d')][_0x0807('0x44')](_0x398d02);})[_0x0807('0x25')](function(_0x30d6cc){_0x1e05c8[_0x0807('0x45')]=_0x30d6cc;return _0x1e05c8;})[_0x0807('0x25')](respondWithFilteredResult(_0x2f6274,_0x398d02))[_0x0807('0x46')](handleError(_0x2f6274,null));};exports[_0x0807('0x47')]=function(_0x43ebbf,_0x4cd4d3){var _0x1c2daf={'raw':![],'where':{'id':_0x43ebbf[_0x0807('0x48')]['id']}},_0x54e193={};_0x54e193[_0x0807('0x32')]=_[_0x0807('0x34')](db[_0x0807('0x2d')][_0x0807('0x2e')]);_0x54e193[_0x0807('0x33')]=_[_0x0807('0x34')](_0x43ebbf[_0x0807('0x33')]);_0x54e193[_0x0807('0x35')]=_['intersection'](_0x54e193[_0x0807('0x32')],_0x54e193['query']);_0x1c2daf[_0x0807('0x38')]=_[_0x0807('0x36')](_0x54e193[_0x0807('0x32')],qs[_0x0807('0x37')](_0x43ebbf['query'][_0x0807('0x37')]));_0x1c2daf['attributes']=_0x1c2daf[_0x0807('0x38')][_0x0807('0x49')]?_0x1c2daf[_0x0807('0x38')]:_0x54e193[_0x0807('0x32')];if(_0x43ebbf[_0x0807('0x33')]['includeAll']){_0x1c2daf[_0x0807('0x43')]=[{'all':!![]}];}_0x1c2daf=_[_0x0807('0x40')]({},_0x1c2daf,_0x43ebbf[_0x0807('0x4a')]);return db[_0x0807('0x2d')][_0x0807('0x4b')](_0x1c2daf)[_0x0807('0x25')](handleEntityNotFound(_0x4cd4d3,null))[_0x0807('0x25')](respondWithResult(_0x4cd4d3,null))[_0x0807('0x46')](handleError(_0x4cd4d3,null));};exports['create']=function(_0x1ead12,_0x17ebe5){return db[_0x0807('0x2d')]['create'](_0x1ead12['body'],{})[_0x0807('0x25')](respondWithResult(_0x17ebe5,0xc9))['catch'](handleError(_0x17ebe5,null));};exports[_0x0807('0x24')]=function(_0x5dea6f,_0x115809){if(_0x5dea6f[_0x0807('0x4c')]['id']){delete _0x5dea6f[_0x0807('0x4c')]['id'];}return db[_0x0807('0x2d')][_0x0807('0x4b')]({'where':{'id':_0x5dea6f[_0x0807('0x48')]['id']}})[_0x0807('0x25')](handleEntityNotFound(_0x115809,null))[_0x0807('0x25')](saveUpdates(_0x5dea6f[_0x0807('0x4c')],null))[_0x0807('0x25')](respondWithResult(_0x115809,null))[_0x0807('0x46')](handleError(_0x115809,null));};exports[_0x0807('0x26')]=function(_0x556e1c,_0x282908){return db[_0x0807('0x2d')]['find']({'where':{'id':_0x556e1c[_0x0807('0x48')]['id']}})[_0x0807('0x25')](handleEntityNotFound(_0x282908,null))['then'](removeEntity(_0x282908,null))[_0x0807('0x46')](handleError(_0x282908,null));};exports[_0x0807('0x4d')]=function(_0x5c740a,_0x1c4cc4,_0xfd8555){var _0x5bc5fc={};var _0xfd4392={};var _0x449f59;var _0x28b00c;return db[_0x0807('0x2d')][_0x0807('0x4e')]({'where':{'id':_0x5c740a[_0x0807('0x48')]['id']}})[_0x0807('0x25')](handleEntityNotFound(_0x1c4cc4,null))[_0x0807('0x25')](function(_0x55a80a){if(_0x55a80a){_0x449f59=_0x55a80a;_0xfd4392[_0x0807('0x32')]=_[_0x0807('0x34')](db[_0x0807('0x4f')][_0x0807('0x2e')]);_0xfd4392[_0x0807('0x33')]=_[_0x0807('0x34')](_0x5c740a[_0x0807('0x33')]);_0xfd4392[_0x0807('0x35')]=_[_0x0807('0x36')](_0xfd4392[_0x0807('0x32')],_0xfd4392[_0x0807('0x33')]);_0x5bc5fc[_0x0807('0x38')]=_[_0x0807('0x36')](_0xfd4392[_0x0807('0x32')],qs[_0x0807('0x37')](_0x5c740a[_0x0807('0x33')][_0x0807('0x37')]));_0x5bc5fc['attributes']=_0x5bc5fc[_0x0807('0x38')][_0x0807('0x49')]?_0x5bc5fc[_0x0807('0x38')]:_0xfd4392[_0x0807('0x32')];_0x5bc5fc[_0x0807('0x3b')]=qs[_0x0807('0x3c')](_0x5c740a['query'][_0x0807('0x3c')]);_0x5bc5fc[_0x0807('0x3d')]=qs[_0x0807('0x35')](_[_0x0807('0x3e')](_0x5c740a['query'],_0xfd4392[_0x0807('0x35')]));if(_0x5c740a[_0x0807('0x33')]['filter']){_0x5bc5fc[_0x0807('0x3d')]=_['merge'](_0x5bc5fc['where'],{'$or':_[_0x0807('0x2c')](_0x5bc5fc[_0x0807('0x38')],function(_0x5d7650){var _0x4928e1={};_0x4928e1[_0x5d7650]={'$like':'%'+_0x5c740a[_0x0807('0x33')]['filter']+'%'};return _0x4928e1;})});}_0x5bc5fc=_[_0x0807('0x40')]({},_0x5bc5fc,_0x5c740a[_0x0807('0x4a')]);return _0x449f59[_0x0807('0x4d')](_0x5bc5fc);}})[_0x0807('0x25')](function(_0x2fb957){if(_0x2fb957){_0x28b00c=_0x2fb957[_0x0807('0x49')];if(!_0x5c740a['query'][_0x0807('0x39')](_0x0807('0x3a'))){_0x5bc5fc[_0x0807('0x20')]=qs[_0x0807('0x20')](_0x5c740a['query']['limit']);_0x5bc5fc[_0x0807('0x1e')]=qs[_0x0807('0x1e')](_0x5c740a[_0x0807('0x33')]['offset']);}return _0x449f59['getFields'](_0x5bc5fc);}})[_0x0807('0x25')](function(_0xd4459f){if(_0xd4459f){return _0xd4459f?{'count':_0x28b00c,'rows':_0xd4459f}:null;}})[_0x0807('0x25')](respondWithResult(_0x1c4cc4,null))[_0x0807('0x46')](handleError(_0x1c4cc4,null));};exports[_0x0807('0x50')]=function(_0x349c03,_0x23ee39,_0x2d4902){var _0x5a610a={};var _0x1bb7da={};var _0x45ace8;var _0x68891c;return db[_0x0807('0x2d')]['findOne']({'where':{'id':_0x349c03[_0x0807('0x48')]['id']}})[_0x0807('0x25')](handleEntityNotFound(_0x23ee39,null))[_0x0807('0x25')](function(_0x1bb91f){if(_0x1bb91f){_0x45ace8=_0x1bb91f;_0x1bb7da['model']=_[_0x0807('0x34')](db['ZohoField'][_0x0807('0x2e')]);_0x1bb7da['query']=_[_0x0807('0x34')](_0x349c03['query']);_0x1bb7da[_0x0807('0x35')]=_[_0x0807('0x36')](_0x1bb7da[_0x0807('0x32')],_0x1bb7da[_0x0807('0x33')]);_0x5a610a[_0x0807('0x38')]=_[_0x0807('0x36')](_0x1bb7da['model'],qs[_0x0807('0x37')](_0x349c03['query']['fields']));_0x5a610a[_0x0807('0x38')]=_0x5a610a[_0x0807('0x38')][_0x0807('0x49')]?_0x5a610a['attributes']:_0x1bb7da[_0x0807('0x32')];_0x5a610a[_0x0807('0x3b')]=qs['sort'](_0x349c03[_0x0807('0x33')][_0x0807('0x3c')]);_0x5a610a[_0x0807('0x3d')]=qs['filters'](_[_0x0807('0x3e')](_0x349c03[_0x0807('0x33')],_0x1bb7da['filters']));if(_0x349c03[_0x0807('0x33')][_0x0807('0x3f')]){_0x5a610a[_0x0807('0x3d')]=_[_0x0807('0x40')](_0x5a610a[_0x0807('0x3d')],{'$or':_[_0x0807('0x2c')](_0x5a610a[_0x0807('0x38')],function(_0x28b176){var _0x303302={};_0x303302[_0x28b176]={'$like':'%'+_0x349c03[_0x0807('0x33')]['filter']+'%'};return _0x303302;})});}_0x5a610a=_[_0x0807('0x40')]({},_0x5a610a,_0x349c03[_0x0807('0x4a')]);return _0x45ace8[_0x0807('0x50')](_0x5a610a);}})[_0x0807('0x25')](function(_0x343ffa){if(_0x343ffa){_0x68891c=_0x343ffa['length'];if(!_0x349c03[_0x0807('0x33')][_0x0807('0x39')](_0x0807('0x3a'))){_0x5a610a[_0x0807('0x20')]=qs[_0x0807('0x20')](_0x349c03[_0x0807('0x33')]['limit']);_0x5a610a[_0x0807('0x1e')]=qs[_0x0807('0x1e')](_0x349c03[_0x0807('0x33')][_0x0807('0x1e')]);}return _0x45ace8[_0x0807('0x50')](_0x5a610a);}})[_0x0807('0x25')](function(_0x8fd979){if(_0x8fd979){return _0x8fd979?{'count':_0x68891c,'rows':_0x8fd979}:null;}})['then'](respondWithResult(_0x23ee39,null))['catch'](handleError(_0x23ee39,null));};exports[_0x0807('0x51')]=function(_0x30d54b,_0x118164,_0xc1f2c2){var _0x17ad5c={};var _0x50d7c3={};var _0x57cc73;var _0x563bf4;return db[_0x0807('0x2d')][_0x0807('0x4e')]({'where':{'id':_0x30d54b[_0x0807('0x48')]['id']}})['then'](handleEntityNotFound(_0x118164,null))[_0x0807('0x25')](function(_0x89edb1){if(_0x89edb1){_0x57cc73=_0x89edb1;_0x50d7c3[_0x0807('0x32')]=_[_0x0807('0x34')](db[_0x0807('0x4f')][_0x0807('0x2e')]);_0x50d7c3['query']=_[_0x0807('0x34')](_0x30d54b[_0x0807('0x33')]);_0x50d7c3[_0x0807('0x35')]=_[_0x0807('0x36')](_0x50d7c3[_0x0807('0x32')],_0x50d7c3[_0x0807('0x33')]);_0x17ad5c[_0x0807('0x38')]=_[_0x0807('0x36')](_0x50d7c3[_0x0807('0x32')],qs[_0x0807('0x37')](_0x30d54b[_0x0807('0x33')][_0x0807('0x37')]));_0x17ad5c[_0x0807('0x38')]=_0x17ad5c[_0x0807('0x38')][_0x0807('0x49')]?_0x17ad5c['attributes']:_0x50d7c3['model'];_0x17ad5c[_0x0807('0x3b')]=qs[_0x0807('0x3c')](_0x30d54b[_0x0807('0x33')][_0x0807('0x3c')]);_0x17ad5c[_0x0807('0x3d')]=qs[_0x0807('0x35')](_[_0x0807('0x3e')](_0x30d54b[_0x0807('0x33')],_0x50d7c3['filters']));if(_0x30d54b[_0x0807('0x33')][_0x0807('0x3f')]){_0x17ad5c[_0x0807('0x3d')]=_[_0x0807('0x40')](_0x17ad5c[_0x0807('0x3d')],{'$or':_['map'](_0x17ad5c[_0x0807('0x38')],function(_0x392934){var _0x5a3293={};_0x5a3293[_0x392934]={'$like':'%'+_0x30d54b[_0x0807('0x33')][_0x0807('0x3f')]+'%'};return _0x5a3293;})});}_0x17ad5c=_[_0x0807('0x40')]({},_0x17ad5c,_0x30d54b['options']);return _0x57cc73[_0x0807('0x51')](_0x17ad5c);}})[_0x0807('0x25')](function(_0x25847a){if(_0x25847a){_0x563bf4=_0x25847a[_0x0807('0x49')];if(!_0x30d54b[_0x0807('0x33')]['hasOwnProperty'](_0x0807('0x3a'))){_0x17ad5c[_0x0807('0x20')]=qs[_0x0807('0x20')](_0x30d54b[_0x0807('0x33')][_0x0807('0x20')]);_0x17ad5c[_0x0807('0x1e')]=qs[_0x0807('0x1e')](_0x30d54b[_0x0807('0x33')][_0x0807('0x1e')]);}return _0x57cc73[_0x0807('0x51')](_0x17ad5c);}})[_0x0807('0x25')](function(_0x21ba9d){if(_0x21ba9d){return _0x21ba9d?{'count':_0x563bf4,'rows':_0x21ba9d}:null;}})[_0x0807('0x25')](respondWithResult(_0x118164,null))[_0x0807('0x46')](handleError(_0x118164,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 625a787..999f25e 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 _0x172f=['ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define'];(function(_0x489b95,_0x548b2b){var _0x469850=function(_0x11484d){while(--_0x11484d){_0x489b95['push'](_0x489b95['shift']());}};_0x469850(++_0x548b2b);}(_0x172f,0xec));var _0xf172=function(_0x2d37d6,_0x11f9e8){_0x2d37d6=_0x2d37d6-0x0;var _0x4595b5=_0x172f[_0x2d37d6];return _0x4595b5;};'use strict';var _=require(_0xf172('0x0'));var util=require(_0xf172('0x1'));var logger=require(_0xf172('0x2'))(_0xf172('0x3'));var moment=require('moment');var BPromise=require(_0xf172('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf172('0x5'));var rimraf=require(_0xf172('0x6'));var config=require(_0xf172('0x7'));var attributes=require(_0xf172('0x8'));module[_0xf172('0x9')]=function(_0x284ef4,_0x465e89){return _0x284ef4[_0xf172('0xa')](_0xf172('0xb'),attributes,{'tableName':_0xf172('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x436a=['bluebird','request-promise','rimraf','./intZohoConfiguration.attributes','ZohoConfiguration','int_zoho_configurations','lodash','util','moment'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0x436a,0x10b));var _0xa436=function(_0x1f214b,_0x2fc240){_0x1f214b=_0x1f214b-0x0;var _0x472309=_0x436a[_0x1f214b];return _0x472309;};'use strict';var _=require(_0xa436('0x0'));var util=require(_0xa436('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa436('0x2'));var BPromise=require(_0xa436('0x3'));var rp=require(_0xa436('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa436('0x5'));var config=require('../../config/environment');var attributes=require(_0xa436('0x6'));module['exports']=function(_0x32933d,_0x3bd8df){return _0x32933d['define'](_0xa436('0x7'),attributes,{'tableName':_0xa436('0x8'),'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 fc5bf64..3962a46 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 _0xbc2f=['rpc','http','request','then','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc2f,0xd4));var _0xfbc2=function(_0x135c44,_0xe65e71){_0x135c44=_0x135c44-0x0;var _0x4ece8a=_0xbc2f[_0x135c44];return _0x4ece8a;};'use strict';var _=require(_0xfbc2('0x0'));var util=require(_0xfbc2('0x1'));var moment=require(_0xfbc2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfbc2('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xfbc2('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xfbc2('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5545ad,_0xcddd79,_0x3478f1){return new BPromise(function(_0x208e47,_0x159db8){return client[_0xfbc2('0x6')](_0x5545ad,_0x3478f1)[_0xfbc2('0x7')](function(_0x1f3ccc){logger['info'](_0xfbc2('0x8'),_0xcddd79,_0xfbc2('0x9'));logger[_0xfbc2('0xa')](_0xfbc2('0xb'),_0xcddd79,_0xfbc2('0x9'),JSON[_0xfbc2('0xc')](_0x1f3ccc));if(_0x1f3ccc[_0xfbc2('0xd')]){if(_0x1f3ccc[_0xfbc2('0xd')][_0xfbc2('0xe')]===0x1f4){logger[_0xfbc2('0xd')](_0xfbc2('0x8'),_0xcddd79,_0x1f3ccc[_0xfbc2('0xd')][_0xfbc2('0xf')]);return _0x159db8(_0x1f3ccc[_0xfbc2('0xd')][_0xfbc2('0xf')]);}logger[_0xfbc2('0xd')](_0xfbc2('0x8'),_0xcddd79,_0x1f3ccc['error'][_0xfbc2('0xf')]);return _0x208e47(_0x1f3ccc['error'][_0xfbc2('0xf')]);}else{logger[_0xfbc2('0x10')](_0xfbc2('0x8'),_0xcddd79,_0xfbc2('0x9'));_0x208e47(_0x1f3ccc['result']['message']);}})[_0xfbc2('0x11')](function(_0x2e2755){logger[_0xfbc2('0xd')](_0xfbc2('0x8'),_0xcddd79,_0x2e2755);_0x159db8(_0x2e2755);});});} \ No newline at end of file +var _0x4943=['catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','request\x20sent','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result'];(function(_0x3076f9,_0x379308){var _0x552d12=function(_0x58627e){while(--_0x58627e){_0x3076f9['push'](_0x3076f9['shift']());}};_0x552d12(++_0x379308);}(_0x4943,0x15a));var _0x3494=function(_0x2166df,_0x2f1bca){_0x2166df=_0x2166df-0x0;var _0x1e591a=_0x4943[_0x2166df];return _0x1e591a;};'use strict';var _=require('lodash');var util=require(_0x3494('0x0'));var moment=require(_0x3494('0x1'));var BPromise=require(_0x3494('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3494('0x3'));var db=require(_0x3494('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3494('0x5'))(_0x3494('0x6'));var config=require(_0x3494('0x7'));var jayson=require(_0x3494('0x8'));var client=jayson[_0x3494('0x9')][_0x3494('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x219afe,_0x1909ac,_0x1cbbbd){return new BPromise(function(_0xe6120d,_0x483060){return client[_0x3494('0xb')](_0x219afe,_0x1cbbbd)[_0x3494('0xc')](function(_0x2ef0d0){logger[_0x3494('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x1909ac,'request\x20sent');logger[_0x3494('0xe')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x1909ac,_0x3494('0xf'),JSON[_0x3494('0x10')](_0x2ef0d0));if(_0x2ef0d0[_0x3494('0x11')]){if(_0x2ef0d0[_0x3494('0x11')][_0x3494('0x12')]===0x1f4){logger[_0x3494('0x11')](_0x3494('0x13'),_0x1909ac,_0x2ef0d0[_0x3494('0x11')][_0x3494('0x14')]);return _0x483060(_0x2ef0d0['error'][_0x3494('0x14')]);}logger[_0x3494('0x11')](_0x3494('0x13'),_0x1909ac,_0x2ef0d0[_0x3494('0x11')][_0x3494('0x14')]);return _0xe6120d(_0x2ef0d0[_0x3494('0x11')][_0x3494('0x14')]);}else{logger['info'](_0x3494('0x13'),_0x1909ac,_0x3494('0xf'));_0xe6120d(_0x2ef0d0[_0x3494('0x15')][_0x3494('0x14')]);}})[_0x3494('0x16')](function(_0x3ce297){logger['error'](_0x3494('0x13'),_0x1909ac,_0x3ce297);_0x483060(_0x3ce297);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index ca1917b..d9a2306 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 _0xae31=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','/:id','show','create','put','delete','exports'];(function(_0x490b21,_0x27b88d){var _0x306fe4=function(_0x3d8c36){while(--_0x3d8c36){_0x490b21['push'](_0x490b21['shift']());}};_0x306fe4(++_0x27b88d);}(_0xae31,0x100));var _0x1ae3=function(_0x454e59,_0x29181d){_0x454e59=_0x454e59-0x0;var _0x34b913=_0xae31[_0x454e59];return _0x34b913;};'use strict';var multer=require('multer');var util=require(_0x1ae3('0x0'));var path=require(_0x1ae3('0x1'));var timeout=require(_0x1ae3('0x2'));var express=require('express');var router=express[_0x1ae3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1ae3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x1ae3('0x5'));var controller=require(_0x1ae3('0x6'));router[_0x1ae3('0x7')]('/',auth[_0x1ae3('0x8')](),controller[_0x1ae3('0x9')]);router[_0x1ae3('0x7')](_0x1ae3('0xa'),auth[_0x1ae3('0x8')](),controller[_0x1ae3('0xb')]);router['post']('/',auth[_0x1ae3('0x8')](),controller[_0x1ae3('0xc')]);router[_0x1ae3('0xd')]('/:id',auth[_0x1ae3('0x8')](),controller['update']);router[_0x1ae3('0xe')]('/:id',auth[_0x1ae3('0x8')](),controller['destroy']);module[_0x1ae3('0xf')]=router; \ No newline at end of file +var _0x9ab8=['get','isAuthenticated','index','/:id','show','put','update','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0xfc455,_0x13a853){var _0x3f6eab=function(_0x56699a){while(--_0x56699a){_0xfc455['push'](_0xfc455['shift']());}};_0x3f6eab(++_0x13a853);}(_0x9ab8,0x87));var _0x89ab=function(_0x221cd4,_0x3269e9){_0x221cd4=_0x221cd4-0x0;var _0x5811eb=_0x9ab8[_0x221cd4];return _0x5811eb;};'use strict';var multer=require(_0x89ab('0x0'));var util=require(_0x89ab('0x1'));var path=require('path');var timeout=require(_0x89ab('0x2'));var express=require(_0x89ab('0x3'));var router=express[_0x89ab('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x89ab('0x5'));var interaction=require(_0x89ab('0x6'));var config=require(_0x89ab('0x7'));var controller=require(_0x89ab('0x8'));router[_0x89ab('0x9')]('/',auth[_0x89ab('0xa')](),controller[_0x89ab('0xb')]);router[_0x89ab('0x9')](_0x89ab('0xc'),auth[_0x89ab('0xa')](),controller[_0x89ab('0xd')]);router['post']('/',auth[_0x89ab('0xa')](),controller['create']);router[_0x89ab('0xe')](_0x89ab('0xc'),auth[_0x89ab('0xa')](),controller[_0x89ab('0xf')]);router[_0x89ab('0x10')](_0x89ab('0xc'),auth[_0x89ab('0xa')](),controller[_0x89ab('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 84e6638..3ebe6b8 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 _0x260d=['ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN','sequelize'];(function(_0x2a4938,_0x29f76f){var _0x51d753=function(_0x1df0fa){while(--_0x1df0fa){_0x2a4938['push'](_0x2a4938['shift']());}};_0x51d753(++_0x29f76f);}(_0x260d,0xff));var _0xd260=function(_0x11cd4a,_0x293e80){_0x11cd4a=_0x11cd4a-0x0;var _0x1ca30c=_0x260d[_0x11cd4a];return _0x1ca30c;};'use strict';var Sequelize=require(_0xd260('0x0'));module['exports']={'type':{'type':Sequelize[_0xd260('0x1')](_0xd260('0x2'),_0xd260('0x3'),_0xd260('0x4'),'keyValue',_0xd260('0x5')),'defaultValue':_0xd260('0x2')},'content':{'type':Sequelize[_0xd260('0x6')]},'key':{'type':Sequelize[_0xd260('0x6')]},'keyType':{'type':Sequelize[_0xd260('0x1')](_0xd260('0x2'),_0xd260('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xd260('0x6')]},'idField':{'type':Sequelize[_0xd260('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xd260('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd260('0x6')]}}; \ No newline at end of file +var _0x403b=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','keyValue'];(function(_0x5b78e8,_0x55096b){var _0xf2c321=function(_0x4e0cff){while(--_0x4e0cff){_0x5b78e8['push'](_0x5b78e8['shift']());}};_0xf2c321(++_0x55096b);}(_0x403b,0x146));var _0xb403=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x403b[_0x19950b];return _0x3c6b41;};'use strict';var Sequelize=require(_0xb403('0x0'));module[_0xb403('0x1')]={'type':{'type':Sequelize[_0xb403('0x2')](_0xb403('0x3'),_0xb403('0x4'),_0xb403('0x5'),_0xb403('0x6'),'picklist'),'defaultValue':_0xb403('0x3')},'content':{'type':Sequelize[_0xb403('0x7')]},'key':{'type':Sequelize[_0xb403('0x7')]},'keyType':{'type':Sequelize['ENUM']('string',_0xb403('0x4'),_0xb403('0x5'))},'keyContent':{'type':Sequelize[_0xb403('0x7')]},'idField':{'type':Sequelize[_0xb403('0x7')]},'nameField':{'type':Sequelize[_0xb403('0x7')]},'customField':{'type':Sequelize[_0xb403('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xb403('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 48c5793..8b71aa3 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 _0x9a86=['stack','name','send','map','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','sort','where','pick','filter','merge','options','include','ZohoField','findAll','show','params','includeAll','create','body','find','catch','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','count','limit','set','Content-Range','reject','save','update','then','destroy','end','error'];(function(_0x3244a8,_0x113d30){var _0x510ed4=function(_0xe7485a){while(--_0xe7485a){_0x3244a8['push'](_0x3244a8['shift']());}};_0x510ed4(++_0x113d30);}(_0x9a86,0xae));var _0x69a8=function(_0x34bc6c,_0x10d089){_0x34bc6c=_0x34bc6c-0x0;var _0x168820=_0x9a86[_0x34bc6c];return _0x168820;};'use strict';var emlformat=require(_0x69a8('0x0'));var rimraf=require(_0x69a8('0x1'));var zipdir=require(_0x69a8('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x69a8('0x3'));var BPromise=require(_0x69a8('0x4'));var Mustache=require(_0x69a8('0x5'));var util=require(_0x69a8('0x6'));var path=require(_0x69a8('0x7'));var sox=require(_0x69a8('0x8'));var csv=require(_0x69a8('0x9'));var ejs=require(_0x69a8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x69a8('0xb'));var squel=require(_0x69a8('0xc'));var crypto=require(_0x69a8('0xd'));var jsforce=require(_0x69a8('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x69a8('0x9'));var querystring=require('querystring');var Papa=require(_0x69a8('0xf'));var Redis=require(_0x69a8('0x10'));var authService=require(_0x69a8('0x11'));var qs=require(_0x69a8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x69a8('0x13'));var logger=require(_0x69a8('0x14'))('api');var utils=require(_0x69a8('0x15'));var config=require(_0x69a8('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x69a8('0x17'))['db'];function respondWithStatusCode(_0x2520f8,_0x3e6b54){_0x3e6b54=_0x3e6b54||0xcc;return function(_0x236c1d){if(_0x236c1d){return _0x2520f8[_0x69a8('0x18')](_0x3e6b54);}return _0x2520f8['status'](_0x3e6b54)['end']();};}function respondWithResult(_0x5af70a,_0x24563b){_0x24563b=_0x24563b||0xc8;return function(_0x4ec32b){if(_0x4ec32b){return _0x5af70a[_0x69a8('0x19')](_0x24563b)[_0x69a8('0x1a')](_0x4ec32b);}};}function respondWithFilteredResult(_0x23125c,_0x15967a){return function(_0x3ee08c){if(_0x3ee08c){var _0x5dab23=typeof _0x15967a[_0x69a8('0x1b')]==='undefined'&&typeof _0x15967a['limit']==='undefined';var _0x41a22a=_0x3ee08c[_0x69a8('0x1c')];var _0x225e0b=_0x5dab23?0x0:_0x15967a['offset'];var _0x5234f7=_0x5dab23?_0x3ee08c[_0x69a8('0x1c')]:_0x15967a['offset']+_0x15967a[_0x69a8('0x1d')];var _0x8daa2b;if(_0x5234f7>=_0x41a22a){_0x5234f7=_0x41a22a;_0x8daa2b=0xc8;}else{_0x8daa2b=0xce;}_0x23125c[_0x69a8('0x19')](_0x8daa2b);return _0x23125c[_0x69a8('0x1e')](_0x69a8('0x1f'),_0x225e0b+'-'+_0x5234f7+'/'+_0x41a22a)[_0x69a8('0x1a')](_0x3ee08c);}return null;};}function patchUpdates(_0x42365b){return function(_0x493ef9){try{jsonpatch['apply'](_0x493ef9,_0x42365b,!![]);}catch(_0x50fbf6){return BPromise[_0x69a8('0x20')](_0x50fbf6);}return _0x493ef9[_0x69a8('0x21')]();};}function saveUpdates(_0x5a7935,_0x21f9a8){return function(_0x3ae9d9){if(_0x3ae9d9){return _0x3ae9d9[_0x69a8('0x22')](_0x5a7935)[_0x69a8('0x23')](function(_0xa2cc45){return _0xa2cc45;});}return null;};}function removeEntity(_0x1263e4,_0x3f9602){return function(_0x1f50a9){if(_0x1f50a9){return _0x1f50a9[_0x69a8('0x24')]()[_0x69a8('0x23')](function(){_0x1263e4[_0x69a8('0x19')](0xcc)[_0x69a8('0x25')]();});}};}function handleEntityNotFound(_0x4db10d,_0x3b7757){return function(_0x7dccc3){if(!_0x7dccc3){_0x4db10d[_0x69a8('0x18')](0x194);}return _0x7dccc3;};}function handleError(_0x515e59,_0x466201){_0x466201=_0x466201||0x1f4;return function(_0x47a259){logger[_0x69a8('0x26')](_0x47a259[_0x69a8('0x27')]);if(_0x47a259['name']){delete _0x47a259[_0x69a8('0x28')];}_0x515e59[_0x69a8('0x19')](_0x466201)[_0x69a8('0x29')](_0x47a259);};}exports['index']=function(_0x4d7e11,_0x5e923b){var _0x45853d={},_0x52fa00={},_0x3e72d1={'count':0x0,'rows':[]};var _0x29443a=_[_0x69a8('0x2a')](db['ZohoField'][_0x69a8('0x2b')],function(_0xbe7da3){return{'name':_0xbe7da3[_0x69a8('0x2c')],'type':_0xbe7da3[_0x69a8('0x2d')][_0x69a8('0x2e')]};});_0x52fa00[_0x69a8('0x2f')]=_[_0x69a8('0x2a')](_0x29443a,_0x69a8('0x28'));_0x52fa00['query']=_[_0x69a8('0x30')](_0x4d7e11[_0x69a8('0x31')]);_0x52fa00[_0x69a8('0x32')]=_['intersection'](_0x52fa00[_0x69a8('0x2f')],_0x52fa00[_0x69a8('0x31')]);_0x45853d[_0x69a8('0x33')]=_[_0x69a8('0x34')](_0x52fa00[_0x69a8('0x2f')],qs['fields'](_0x4d7e11[_0x69a8('0x31')][_0x69a8('0x35')]));_0x45853d[_0x69a8('0x33')]=_0x45853d[_0x69a8('0x33')][_0x69a8('0x36')]?_0x45853d[_0x69a8('0x33')]:_0x52fa00[_0x69a8('0x2f')];if(!_0x4d7e11[_0x69a8('0x31')]['hasOwnProperty']('nolimit')){_0x45853d[_0x69a8('0x1d')]=qs['limit'](_0x4d7e11[_0x69a8('0x31')]['limit']);_0x45853d[_0x69a8('0x1b')]=qs[_0x69a8('0x1b')](_0x4d7e11[_0x69a8('0x31')][_0x69a8('0x1b')]);}_0x45853d['order']=qs['sort'](_0x4d7e11['query'][_0x69a8('0x37')]);_0x45853d[_0x69a8('0x38')]=qs[_0x69a8('0x32')](_[_0x69a8('0x39')](_0x4d7e11[_0x69a8('0x31')],_0x52fa00[_0x69a8('0x32')]),_0x29443a);if(_0x4d7e11['query'][_0x69a8('0x3a')]){_0x45853d[_0x69a8('0x38')]=_['merge'](_0x45853d[_0x69a8('0x38')],{'$or':_[_0x69a8('0x2a')](_0x29443a,function(_0x55608a){if(_0x55608a['type']!=='VIRTUAL'){var _0x97a545={};_0x97a545[_0x55608a[_0x69a8('0x28')]]={'$like':'%'+_0x4d7e11[_0x69a8('0x31')][_0x69a8('0x3a')]+'%'};return _0x97a545;}})});}_0x45853d=_[_0x69a8('0x3b')]({},_0x45853d,_0x4d7e11[_0x69a8('0x3c')]);var _0x308cdf={'where':_0x45853d[_0x69a8('0x38')]};return db['ZohoField'][_0x69a8('0x1c')](_0x308cdf)['then'](function(_0x3727bf){_0x3e72d1[_0x69a8('0x1c')]=_0x3727bf;if(_0x4d7e11[_0x69a8('0x31')]['includeAll']){_0x45853d[_0x69a8('0x3d')]=[{'all':!![]}];}return db[_0x69a8('0x3e')][_0x69a8('0x3f')](_0x45853d);})[_0x69a8('0x23')](function(_0x2c93a2){_0x3e72d1['rows']=_0x2c93a2;return _0x3e72d1;})[_0x69a8('0x23')](respondWithFilteredResult(_0x5e923b,_0x45853d))['catch'](handleError(_0x5e923b,null));};exports[_0x69a8('0x40')]=function(_0x43f2ac,_0x253a41){var _0x136a95={'raw':!![],'where':{'id':_0x43f2ac[_0x69a8('0x41')]['id']}},_0x342162={};_0x342162[_0x69a8('0x2f')]=_[_0x69a8('0x30')](db[_0x69a8('0x3e')]['rawAttributes']);_0x342162[_0x69a8('0x31')]=_[_0x69a8('0x30')](_0x43f2ac['query']);_0x342162[_0x69a8('0x32')]=_[_0x69a8('0x34')](_0x342162[_0x69a8('0x2f')],_0x342162[_0x69a8('0x31')]);_0x136a95[_0x69a8('0x33')]=_['intersection'](_0x342162['model'],qs[_0x69a8('0x35')](_0x43f2ac[_0x69a8('0x31')][_0x69a8('0x35')]));_0x136a95[_0x69a8('0x33')]=_0x136a95[_0x69a8('0x33')][_0x69a8('0x36')]?_0x136a95[_0x69a8('0x33')]:_0x342162[_0x69a8('0x2f')];if(_0x43f2ac[_0x69a8('0x31')][_0x69a8('0x42')]){_0x136a95[_0x69a8('0x3d')]=[{'all':!![]}];}_0x136a95=_[_0x69a8('0x3b')]({},_0x136a95,_0x43f2ac[_0x69a8('0x3c')]);return db[_0x69a8('0x3e')]['find'](_0x136a95)[_0x69a8('0x23')](handleEntityNotFound(_0x253a41,null))[_0x69a8('0x23')](respondWithResult(_0x253a41,null))['catch'](handleError(_0x253a41,null));};exports[_0x69a8('0x43')]=function(_0x4094c5,_0x44fb5b){return db[_0x69a8('0x3e')]['create'](_0x4094c5[_0x69a8('0x44')],{})[_0x69a8('0x23')](respondWithResult(_0x44fb5b,0xc9))['catch'](handleError(_0x44fb5b,null));};exports[_0x69a8('0x22')]=function(_0x2b4dc,_0x2f0a64){if(_0x2b4dc[_0x69a8('0x44')]['id']){delete _0x2b4dc[_0x69a8('0x44')]['id'];}return db['ZohoField'][_0x69a8('0x45')]({'where':{'id':_0x2b4dc[_0x69a8('0x41')]['id']}})['then'](handleEntityNotFound(_0x2f0a64,null))[_0x69a8('0x23')](saveUpdates(_0x2b4dc['body'],null))[_0x69a8('0x23')](respondWithResult(_0x2f0a64,null))[_0x69a8('0x46')](handleError(_0x2f0a64,null));};exports[_0x69a8('0x24')]=function(_0x2a0aff,_0x1e24b5){return db[_0x69a8('0x3e')]['find']({'where':{'id':_0x2a0aff['params']['id']}})[_0x69a8('0x23')](handleEntityNotFound(_0x1e24b5,null))[_0x69a8('0x23')](removeEntity(_0x1e24b5,null))['catch'](handleError(_0x1e24b5,null));}; \ No newline at end of file +var _0x7e70=['find','create','body','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','map','ZohoField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','filters','pick','filter','where','merge','includeAll','include','findAll','rows','catch','show','params','length','options'];(function(_0x554eff,_0x515dd9){var _0x416215=function(_0x5a0921){while(--_0x5a0921){_0x554eff['push'](_0x554eff['shift']());}};_0x416215(++_0x515dd9);}(_0x7e70,0x98));var _0x07e7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7e70[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x07e7('0x0'));var zipdir=require(_0x07e7('0x1'));var jsonpatch=require(_0x07e7('0x2'));var rp=require(_0x07e7('0x3'));var moment=require(_0x07e7('0x4'));var BPromise=require(_0x07e7('0x5'));var Mustache=require('mustache');var util=require(_0x07e7('0x6'));var path=require(_0x07e7('0x7'));var sox=require(_0x07e7('0x8'));var csv=require(_0x07e7('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x07e7('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x07e7('0xb'));var jsforce=require(_0x07e7('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x07e7('0xd'));var Papa=require(_0x07e7('0xe'));var Redis=require(_0x07e7('0xf'));var authService=require(_0x07e7('0x10'));var qs=require(_0x07e7('0x11'));var as=require(_0x07e7('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x07e7('0x13'))('api');var utils=require(_0x07e7('0x14'));var config=require(_0x07e7('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x07e7('0x16'))['db'];function respondWithStatusCode(_0x1c83b2,_0x2f1513){_0x2f1513=_0x2f1513||0xcc;return function(_0xd9709){if(_0xd9709){return _0x1c83b2[_0x07e7('0x17')](_0x2f1513);}return _0x1c83b2['status'](_0x2f1513)[_0x07e7('0x18')]();};}function respondWithResult(_0x475754,_0x581d95){_0x581d95=_0x581d95||0xc8;return function(_0x141227){if(_0x141227){return _0x475754[_0x07e7('0x19')](_0x581d95)[_0x07e7('0x1a')](_0x141227);}};}function respondWithFilteredResult(_0xc663fc,_0x418860){return function(_0x2f408c){if(_0x2f408c){var _0x53a711=typeof _0x418860[_0x07e7('0x1b')]===_0x07e7('0x1c')&&typeof _0x418860[_0x07e7('0x1d')]===_0x07e7('0x1c');var _0x2b1a01=_0x2f408c[_0x07e7('0x1e')];var _0x466eb8=_0x53a711?0x0:_0x418860[_0x07e7('0x1b')];var _0x34819b=_0x53a711?_0x2f408c['count']:_0x418860[_0x07e7('0x1b')]+_0x418860['limit'];var _0x137efb;if(_0x34819b>=_0x2b1a01){_0x34819b=_0x2b1a01;_0x137efb=0xc8;}else{_0x137efb=0xce;}_0xc663fc[_0x07e7('0x19')](_0x137efb);return _0xc663fc['set'](_0x07e7('0x1f'),_0x466eb8+'-'+_0x34819b+'/'+_0x2b1a01)[_0x07e7('0x1a')](_0x2f408c);}return null;};}function patchUpdates(_0x4aa5fe){return function(_0x18a1fb){try{jsonpatch[_0x07e7('0x20')](_0x18a1fb,_0x4aa5fe,!![]);}catch(_0x2e7730){return BPromise[_0x07e7('0x21')](_0x2e7730);}return _0x18a1fb[_0x07e7('0x22')]();};}function saveUpdates(_0x5555bc,_0x59cb60){return function(_0x4abb62){if(_0x4abb62){return _0x4abb62[_0x07e7('0x23')](_0x5555bc)[_0x07e7('0x24')](function(_0x5ec840){return _0x5ec840;});}return null;};}function removeEntity(_0x252ef7,_0x4a3cc2){return function(_0x1be39f){if(_0x1be39f){return _0x1be39f['destroy']()['then'](function(){_0x252ef7['status'](0xcc)[_0x07e7('0x18')]();});}};}function handleEntityNotFound(_0x348962,_0x5cc39b){return function(_0x354c37){if(!_0x354c37){_0x348962[_0x07e7('0x17')](0x194);}return _0x354c37;};}function handleError(_0x91e01d,_0x496db4){_0x496db4=_0x496db4||0x1f4;return function(_0x16e231){logger[_0x07e7('0x25')](_0x16e231[_0x07e7('0x26')]);if(_0x16e231[_0x07e7('0x27')]){delete _0x16e231['name'];}_0x91e01d[_0x07e7('0x19')](_0x496db4)[_0x07e7('0x28')](_0x16e231);};}exports['index']=function(_0x1d1a21,_0x15e007){var _0x36d201={},_0x4b7d8f={},_0xb4e7a7={'count':0x0,'rows':[]};var _0x5a7fd5=_[_0x07e7('0x29')](db[_0x07e7('0x2a')][_0x07e7('0x2b')],function(_0x39ac6f){return{'name':_0x39ac6f[_0x07e7('0x2c')],'type':_0x39ac6f[_0x07e7('0x2d')][_0x07e7('0x2e')]};});_0x4b7d8f[_0x07e7('0x2f')]=_[_0x07e7('0x29')](_0x5a7fd5,'name');_0x4b7d8f[_0x07e7('0x30')]=_[_0x07e7('0x31')](_0x1d1a21[_0x07e7('0x30')]);_0x4b7d8f['filters']=_[_0x07e7('0x32')](_0x4b7d8f[_0x07e7('0x2f')],_0x4b7d8f[_0x07e7('0x30')]);_0x36d201[_0x07e7('0x33')]=_['intersection'](_0x4b7d8f['model'],qs[_0x07e7('0x34')](_0x1d1a21[_0x07e7('0x30')][_0x07e7('0x34')]));_0x36d201['attributes']=_0x36d201[_0x07e7('0x33')]['length']?_0x36d201[_0x07e7('0x33')]:_0x4b7d8f[_0x07e7('0x2f')];if(!_0x1d1a21[_0x07e7('0x30')][_0x07e7('0x35')](_0x07e7('0x36'))){_0x36d201[_0x07e7('0x1d')]=qs[_0x07e7('0x1d')](_0x1d1a21['query'][_0x07e7('0x1d')]);_0x36d201[_0x07e7('0x1b')]=qs['offset'](_0x1d1a21[_0x07e7('0x30')]['offset']);}_0x36d201[_0x07e7('0x37')]=qs['sort'](_0x1d1a21[_0x07e7('0x30')]['sort']);_0x36d201['where']=qs[_0x07e7('0x38')](_[_0x07e7('0x39')](_0x1d1a21['query'],_0x4b7d8f[_0x07e7('0x38')]),_0x5a7fd5);if(_0x1d1a21[_0x07e7('0x30')][_0x07e7('0x3a')]){_0x36d201[_0x07e7('0x3b')]=_[_0x07e7('0x3c')](_0x36d201['where'],{'$or':_[_0x07e7('0x29')](_0x5a7fd5,function(_0x331586){if(_0x331586['type']!=='VIRTUAL'){var _0x1da4e4={};_0x1da4e4[_0x331586[_0x07e7('0x27')]]={'$like':'%'+_0x1d1a21[_0x07e7('0x30')]['filter']+'%'};return _0x1da4e4;}})});}_0x36d201=_[_0x07e7('0x3c')]({},_0x36d201,_0x1d1a21['options']);var _0x22f02c={'where':_0x36d201[_0x07e7('0x3b')]};return db[_0x07e7('0x2a')][_0x07e7('0x1e')](_0x22f02c)[_0x07e7('0x24')](function(_0xa7ca15){_0xb4e7a7[_0x07e7('0x1e')]=_0xa7ca15;if(_0x1d1a21[_0x07e7('0x30')][_0x07e7('0x3d')]){_0x36d201[_0x07e7('0x3e')]=[{'all':!![]}];}return db[_0x07e7('0x2a')][_0x07e7('0x3f')](_0x36d201);})[_0x07e7('0x24')](function(_0x1c16d9){_0xb4e7a7[_0x07e7('0x40')]=_0x1c16d9;return _0xb4e7a7;})['then'](respondWithFilteredResult(_0x15e007,_0x36d201))[_0x07e7('0x41')](handleError(_0x15e007,null));};exports[_0x07e7('0x42')]=function(_0x127cf8,_0x468226){var _0x2bf5f7={'raw':!![],'where':{'id':_0x127cf8[_0x07e7('0x43')]['id']}},_0x367793={};_0x367793['model']=_[_0x07e7('0x31')](db[_0x07e7('0x2a')][_0x07e7('0x2b')]);_0x367793[_0x07e7('0x30')]=_[_0x07e7('0x31')](_0x127cf8[_0x07e7('0x30')]);_0x367793[_0x07e7('0x38')]=_[_0x07e7('0x32')](_0x367793[_0x07e7('0x2f')],_0x367793['query']);_0x2bf5f7[_0x07e7('0x33')]=_[_0x07e7('0x32')](_0x367793[_0x07e7('0x2f')],qs[_0x07e7('0x34')](_0x127cf8[_0x07e7('0x30')][_0x07e7('0x34')]));_0x2bf5f7[_0x07e7('0x33')]=_0x2bf5f7['attributes'][_0x07e7('0x44')]?_0x2bf5f7['attributes']:_0x367793[_0x07e7('0x2f')];if(_0x127cf8[_0x07e7('0x30')][_0x07e7('0x3d')]){_0x2bf5f7[_0x07e7('0x3e')]=[{'all':!![]}];}_0x2bf5f7=_['merge']({},_0x2bf5f7,_0x127cf8[_0x07e7('0x45')]);return db[_0x07e7('0x2a')][_0x07e7('0x46')](_0x2bf5f7)['then'](handleEntityNotFound(_0x468226,null))['then'](respondWithResult(_0x468226,null))['catch'](handleError(_0x468226,null));};exports['create']=function(_0x4fadb6,_0xf0f714){return db['ZohoField'][_0x07e7('0x47')](_0x4fadb6[_0x07e7('0x48')],{})['then'](respondWithResult(_0xf0f714,0xc9))['catch'](handleError(_0xf0f714,null));};exports[_0x07e7('0x23')]=function(_0x27e898,_0x4bd468){if(_0x27e898[_0x07e7('0x48')]['id']){delete _0x27e898[_0x07e7('0x48')]['id'];}return db[_0x07e7('0x2a')][_0x07e7('0x46')]({'where':{'id':_0x27e898[_0x07e7('0x43')]['id']}})[_0x07e7('0x24')](handleEntityNotFound(_0x4bd468,null))[_0x07e7('0x24')](saveUpdates(_0x27e898[_0x07e7('0x48')],null))[_0x07e7('0x24')](respondWithResult(_0x4bd468,null))[_0x07e7('0x41')](handleError(_0x4bd468,null));};exports[_0x07e7('0x49')]=function(_0x11abe5,_0x391fb6){return db['ZohoField']['find']({'where':{'id':_0x11abe5[_0x07e7('0x43')]['id']}})[_0x07e7('0x24')](handleEntityNotFound(_0x391fb6,null))[_0x07e7('0x24')](removeEntity(_0x391fb6,null))['catch'](handleError(_0x391fb6,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 74ab001..69809c9 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 _0x7ee1=['request-promise','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','idField','FieldId','lodash','moment','bluebird'];(function(_0x387274,_0x5d43b5){var _0x2bccd8=function(_0x56bb78){while(--_0x56bb78){_0x387274['push'](_0x387274['shift']());}};_0x2bccd8(++_0x5d43b5);}(_0x7ee1,0x8d));var _0x17ee=function(_0x267481,_0x5ad01d){_0x267481=_0x267481-0x0;var _0x112984=_0x7ee1[_0x267481];return _0x112984;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rp=require(_0x17ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require(_0x17ee('0x6'));module[_0x17ee('0x7')]=function(_0x5c0617,_0x52b1db){return _0x5c0617[_0x17ee('0x8')]('ZohoField',attributes,{'tableName':_0x17ee('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x17ee('0xa'),_0x17ee('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xba34=['FieldId','lodash','util','../../config/logger','api','moment','rimraf','../../config/environment','./intZohoField.attributes','exports','define','int_zoho_fields','zoho_unique_index','idField'];(function(_0xf0bcac,_0x531755){var _0x4e4c65=function(_0x35a77a){while(--_0x35a77a){_0xf0bcac['push'](_0xf0bcac['shift']());}};_0x4e4c65(++_0x531755);}(_0xba34,0x119));var _0x4ba3=function(_0x266ae2,_0x274cf5){_0x266ae2=_0x266ae2-0x0;var _0x5117d2=_0xba34[_0x266ae2];return _0x5117d2;};'use strict';var _=require(_0x4ba3('0x0'));var util=require(_0x4ba3('0x1'));var logger=require(_0x4ba3('0x2'))(_0x4ba3('0x3'));var moment=require(_0x4ba3('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4ba3('0x5'));var config=require(_0x4ba3('0x6'));var attributes=require(_0x4ba3('0x7'));module[_0x4ba3('0x8')]=function(_0x3590a1,_0xb88621){return _0x3590a1[_0x4ba3('0x9')]('ZohoField',attributes,{'tableName':_0x4ba3('0xa'),'paranoid':![],'indexes':[{'name':_0x4ba3('0xb'),'fields':[_0x4ba3('0xc'),_0x4ba3('0xd')],'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 5b81d7c..1fced97 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 _0x6cad=['then','info','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http'];(function(_0x2b5eae,_0x55010d){var _0x5f3ac9=function(_0x397bfc){while(--_0x397bfc){_0x2b5eae['push'](_0x2b5eae['shift']());}};_0x5f3ac9(++_0x55010d);}(_0x6cad,0xe5));var _0xd6ca=function(_0x4fc216,_0x393bbb){_0x4fc216=_0x4fc216-0x0;var _0x410b63=_0x6cad[_0x4fc216];return _0x410b63;};'use strict';var _=require('lodash');var util=require(_0xd6ca('0x0'));var moment=require(_0xd6ca('0x1'));var BPromise=require(_0xd6ca('0x2'));var rs=require(_0xd6ca('0x3'));var fs=require('fs');var Redis=require(_0xd6ca('0x4'));var db=require(_0xd6ca('0x5'))['db'];var utils=require(_0xd6ca('0x6'));var logger=require('../../config/logger')(_0xd6ca('0x7'));var config=require('../../config/environment');var jayson=require(_0xd6ca('0x8'));var client=jayson[_0xd6ca('0x9')][_0xd6ca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x536e40,_0x426623,_0x3ed044){return new BPromise(function(_0x21ca89,_0x123ac6){return client['request'](_0x536e40,_0x3ed044)[_0xd6ca('0xb')](function(_0x3a4e7c){logger[_0xd6ca('0xc')](_0xd6ca('0xd'),_0x426623,_0xd6ca('0xe'));logger['debug'](_0xd6ca('0xf'),_0x426623,_0xd6ca('0xe'),JSON['stringify'](_0x3a4e7c));if(_0x3a4e7c['error']){if(_0x3a4e7c[_0xd6ca('0x10')][_0xd6ca('0x11')]===0x1f4){logger[_0xd6ca('0x10')](_0xd6ca('0xd'),_0x426623,_0x3a4e7c[_0xd6ca('0x10')][_0xd6ca('0x12')]);return _0x123ac6(_0x3a4e7c['error'][_0xd6ca('0x12')]);}logger[_0xd6ca('0x10')](_0xd6ca('0xd'),_0x426623,_0x3a4e7c['error'][_0xd6ca('0x12')]);return _0x21ca89(_0x3a4e7c[_0xd6ca('0x10')]['message']);}else{logger[_0xd6ca('0xc')](_0xd6ca('0xd'),_0x426623,_0xd6ca('0xe'));_0x21ca89(_0x3a4e7c[_0xd6ca('0x13')][_0xd6ca('0x12')]);}})['catch'](function(_0x5c79a0){logger[_0xd6ca('0x10')]('ZohoField,\x20%s,\x20%s',_0x426623,_0x5c79a0);_0x123ac6(_0x5c79a0);});});} \ No newline at end of file +var _0x8e57=['ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info'];(function(_0xb7d2ee,_0x44552d){var _0x4556e9=function(_0x1bd052){while(--_0x1bd052){_0xb7d2ee['push'](_0xb7d2ee['shift']());}};_0x4556e9(++_0x44552d);}(_0x8e57,0x92));var _0x78e5=function(_0x19517b,_0x3413d6){_0x19517b=_0x19517b-0x0;var _0x45b6f0=_0x8e57[_0x19517b];return _0x45b6f0;};'use strict';var _=require(_0x78e5('0x0'));var util=require(_0x78e5('0x1'));var moment=require(_0x78e5('0x2'));var BPromise=require(_0x78e5('0x3'));var rs=require(_0x78e5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x78e5('0x5'))['db'];var utils=require(_0x78e5('0x6'));var logger=require(_0x78e5('0x7'))(_0x78e5('0x8'));var config=require(_0x78e5('0x9'));var jayson=require(_0x78e5('0xa'));var client=jayson[_0x78e5('0xb')][_0x78e5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x25ee19,_0x10c455,_0x125f44){return new BPromise(function(_0xa1e2de,_0x4fa140){return client[_0x78e5('0xd')](_0x25ee19,_0x125f44)['then'](function(_0x382517){logger[_0x78e5('0xe')](_0x78e5('0xf'),_0x10c455,_0x78e5('0x10'));logger['debug'](_0x78e5('0x11'),_0x10c455,_0x78e5('0x10'),JSON[_0x78e5('0x12')](_0x382517));if(_0x382517[_0x78e5('0x13')]){if(_0x382517[_0x78e5('0x13')][_0x78e5('0x14')]===0x1f4){logger[_0x78e5('0x13')](_0x78e5('0xf'),_0x10c455,_0x382517['error'][_0x78e5('0x15')]);return _0x4fa140(_0x382517[_0x78e5('0x13')][_0x78e5('0x15')]);}logger[_0x78e5('0x13')](_0x78e5('0xf'),_0x10c455,_0x382517['error']['message']);return _0xa1e2de(_0x382517[_0x78e5('0x13')][_0x78e5('0x15')]);}else{logger['info'](_0x78e5('0xf'),_0x10c455,_0x78e5('0x10'));_0xa1e2de(_0x382517[_0x78e5('0x16')][_0x78e5('0x15')]);}})['catch'](function(_0x13d7b1){logger[_0x78e5('0x13')](_0x78e5('0xf'),_0x10c455,_0x13d7b1);_0x4fa140(_0x13d7b1);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index b47ce82..ba11e3b 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1c8489,_0x80368c){var _0x16a60f=function(_0x9629e8){while(--_0x9629e8){_0x1c8489['push'](_0x1c8489['shift']());}};_0x16a60f(++_0x80368c);}(_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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x397b40,_0x56e7fc){var _0x258261=function(_0x4d249e){while(--_0x4d249e){_0x397b40['push'](_0x397b40['shift']());}};_0x258261(++_0x56e7fc);}(_0x70e0,0x17b));var _0x070e=function(_0x4ffdcc,_0x4e7fec){_0x4ffdcc=_0x4ffdcc-0x0;var _0x4e66c8=_0x70e0[_0x4ffdcc];return _0x4e66c8;};'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/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index e5c873d..ec7b6e7 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 _0x8b9d=['state','sequelize','exports','STRING','unique_name_and_version','INTEGER','BOOLEAN'];(function(_0x5e16ba,_0x24eb73){var _0x536a76=function(_0x1cc4b3){while(--_0x1cc4b3){_0x5e16ba['push'](_0x5e16ba['shift']());}};_0x536a76(++_0x24eb73);}(_0x8b9d,0x6a));var _0xd8b9=function(_0x5a23e5,_0x235f58){_0x5a23e5=_0x5a23e5-0x0;var _0x4f4e67=_0x8b9d[_0x5a23e5];return _0x4f4e67;};'use strict';var Sequelize=require(_0xd8b9('0x0'));module[_0xd8b9('0x1')]={'name':{'type':Sequelize[_0xd8b9('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xd8b9('0x3')},'main':{'type':Sequelize['STRING'],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0xd8b9('0x2')]},'path':{'type':Sequelize[_0xd8b9('0x2')]},'type':{'type':Sequelize[_0xd8b9('0x2')]},'size':{'type':Sequelize[_0xd8b9('0x4')]},'active':{'type':Sequelize[_0xd8b9('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0xd8b9('0x2')]},'logo':{'type':Sequelize[_0xd8b9('0x2')]},'state':{'type':Sequelize['STRING'],'unique':_0xd8b9('0x6')},'description':{'type':Sequelize[_0xd8b9('0x2')]},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd8b9('0x2')]},'link':{'type':Sequelize[_0xd8b9('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xde44=['STRING','unique_name_and_version','app.js','INTEGER','sequelize','exports'];(function(_0x5cf4ef,_0x2d360f){var _0x4a8082=function(_0x4c6a9e){while(--_0x4c6a9e){_0x5cf4ef['push'](_0x5cf4ef['shift']());}};_0x4a8082(++_0x2d360f);}(_0xde44,0x160));var _0x4de4=function(_0x37f7a9,_0x41bf4c){_0x37f7a9=_0x37f7a9-0x0;var _0x2824b5=_0xde44[_0x37f7a9];return _0x2824b5;};'use strict';var Sequelize=require(_0x4de4('0x0'));module[_0x4de4('0x1')]={'name':{'type':Sequelize[_0x4de4('0x2')],'allowNull':![],'unique':_0x4de4('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x4de4('0x3')},'main':{'type':Sequelize[_0x4de4('0x2')],'defaultValue':_0x4de4('0x4')},'filename':{'type':Sequelize[_0x4de4('0x2')]},'path':{'type':Sequelize[_0x4de4('0x2')]},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize[_0x4de4('0x5')]},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x4de4('0x2')]},'logo':{'type':Sequelize[_0x4de4('0x2')]},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0x4de4('0x2')]},'title':{'type':Sequelize[_0x4de4('0x2')]},'remoteUri':{'type':Sequelize[_0x4de4('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 1227e5c..d2734ab 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 _0xacf4=['VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','map','Integration','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type'];(function(_0x3630dd,_0x4cf50a){var _0x2a213c=function(_0x1a3d1a){while(--_0x1a3d1a){_0x3630dd['push'](_0x3630dd['shift']());}};_0x2a213c(++_0x4cf50a);}(_0xacf4,0xe7));var _0x4acf=function(_0x521a45,_0x5734bd){_0x521a45=_0x521a45-0x0;var _0x25dfa4=_0xacf4[_0x521a45];return _0x25dfa4;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['Integration'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['Integration']['create'](_0x1bd7d0[_0x4acf('0x47')],{})[_0x4acf('0x21')](respondWithResult(_0x2d946c,0xc9))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x287406,_0x859247){if(_0x287406[_0x4acf('0x47')]['id']){delete _0x287406[_0x4acf('0x47')]['id'];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x287406[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x859247,null))['then'](saveUpdates(_0x287406[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x859247,null))[_0x4acf('0x3f')](handleError(_0x859247,null));};exports[_0x4acf('0x22')]=function(_0x392dac,_0x3cf54a){return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'id':_0x392dac[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x3cf54a,null))[_0x4acf('0x21')](removeEntity(_0x3cf54a,null))[_0x4acf('0x3f')](handleError(_0x3cf54a,null));}; \ No newline at end of file +var _0xfcf0=['intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','includeAll','include','catch','params','merge','options','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','error','stack','name','send','index','Integration','rawAttributes','fieldName','type','key','model','map','keys','query','filters'];(function(_0x291618,_0x204fc6){var _0x1f7a49=function(_0x45128b){while(--_0x45128b){_0x291618['push'](_0x291618['shift']());}};_0x1f7a49(++_0x204fc6);}(_0xfcf0,0x138));var _0x0fcf=function(_0x284bc3,_0x22dffe){_0x284bc3=_0x284bc3-0x0;var _0x41ac81=_0xfcf0[_0x284bc3];return _0x41ac81;};'use strict';var emlformat=require(_0x0fcf('0x0'));var rimraf=require(_0x0fcf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0fcf('0x2'));var rp=require(_0x0fcf('0x3'));var moment=require(_0x0fcf('0x4'));var BPromise=require(_0x0fcf('0x5'));var Mustache=require('mustache');var util=require(_0x0fcf('0x6'));var path=require(_0x0fcf('0x7'));var sox=require(_0x0fcf('0x8'));var csv=require(_0x0fcf('0x9'));var ejs=require(_0x0fcf('0xa'));var fs=require('fs');var fs_extra=require(_0x0fcf('0xb'));var _=require(_0x0fcf('0xc'));var squel=require(_0x0fcf('0xd'));var crypto=require('crypto');var jsforce=require(_0x0fcf('0xe'));var deskjs=require(_0x0fcf('0xf'));var toCsv=require(_0x0fcf('0x9'));var querystring=require('querystring');var Papa=require(_0x0fcf('0x10'));var Redis=require(_0x0fcf('0x11'));var authService=require(_0x0fcf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x0fcf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fcf('0x14'))(_0x0fcf('0x15'));var utils=require(_0x0fcf('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x0fcf('0x17'))['db'];function respondWithStatusCode(_0x3c999e,_0x4b4904){_0x4b4904=_0x4b4904||0xcc;return function(_0x20153d){if(_0x20153d){return _0x3c999e[_0x0fcf('0x18')](_0x4b4904);}return _0x3c999e[_0x0fcf('0x19')](_0x4b4904)[_0x0fcf('0x1a')]();};}function respondWithResult(_0x25fadc,_0x48bba6){_0x48bba6=_0x48bba6||0xc8;return function(_0xa32692){if(_0xa32692){return _0x25fadc[_0x0fcf('0x19')](_0x48bba6)[_0x0fcf('0x1b')](_0xa32692);}};}function respondWithFilteredResult(_0x5e867f,_0x3c09c4){return function(_0x610106){if(_0x610106){var _0x445207=typeof _0x3c09c4[_0x0fcf('0x1c')]==='undefined'&&typeof _0x3c09c4[_0x0fcf('0x1d')]===_0x0fcf('0x1e');var _0x1a8477=_0x610106[_0x0fcf('0x1f')];var _0x19cfbd=_0x445207?0x0:_0x3c09c4['offset'];var _0x18ea32=_0x445207?_0x610106[_0x0fcf('0x1f')]:_0x3c09c4['offset']+_0x3c09c4[_0x0fcf('0x1d')];var _0x1b9a90;if(_0x18ea32>=_0x1a8477){_0x18ea32=_0x1a8477;_0x1b9a90=0xc8;}else{_0x1b9a90=0xce;}_0x5e867f['status'](_0x1b9a90);return _0x5e867f[_0x0fcf('0x20')]('Content-Range',_0x19cfbd+'-'+_0x18ea32+'/'+_0x1a8477)[_0x0fcf('0x1b')](_0x610106);}return null;};}function patchUpdates(_0x13454e){return function(_0x5c8279){try{jsonpatch[_0x0fcf('0x21')](_0x5c8279,_0x13454e,!![]);}catch(_0x3f28d0){return BPromise[_0x0fcf('0x22')](_0x3f28d0);}return _0x5c8279['save']();};}function saveUpdates(_0x2f03ce,_0x1dafc8){return function(_0x196d30){if(_0x196d30){return _0x196d30[_0x0fcf('0x23')](_0x2f03ce)[_0x0fcf('0x24')](function(_0x30e1b0){return _0x30e1b0;});}return null;};}function removeEntity(_0x5841a9,_0x2eef74){return function(_0x253641){if(_0x253641){return _0x253641[_0x0fcf('0x25')]()[_0x0fcf('0x24')](function(){_0x5841a9[_0x0fcf('0x19')](0xcc)[_0x0fcf('0x1a')]();});}};}function handleEntityNotFound(_0x2ce990,_0x18f269){return function(_0x117510){if(!_0x117510){_0x2ce990['sendStatus'](0x194);}return _0x117510;};}function handleError(_0x18965e,_0xc107a){_0xc107a=_0xc107a||0x1f4;return function(_0x41b7a2){logger[_0x0fcf('0x26')](_0x41b7a2[_0x0fcf('0x27')]);if(_0x41b7a2[_0x0fcf('0x28')]){delete _0x41b7a2[_0x0fcf('0x28')];}_0x18965e['status'](_0xc107a)[_0x0fcf('0x29')](_0x41b7a2);};}exports[_0x0fcf('0x2a')]=function(_0x200517,_0x35180d){var _0x49fd0e={},_0x5d9bcd={},_0x4af80d={'count':0x0,'rows':[]};var _0x428194=_['map'](db[_0x0fcf('0x2b')][_0x0fcf('0x2c')],function(_0x56a416){return{'name':_0x56a416[_0x0fcf('0x2d')],'type':_0x56a416[_0x0fcf('0x2e')][_0x0fcf('0x2f')]};});_0x5d9bcd[_0x0fcf('0x30')]=_[_0x0fcf('0x31')](_0x428194,_0x0fcf('0x28'));_0x5d9bcd['query']=_[_0x0fcf('0x32')](_0x200517[_0x0fcf('0x33')]);_0x5d9bcd[_0x0fcf('0x34')]=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],_0x5d9bcd[_0x0fcf('0x33')]);_0x49fd0e['attributes']=_[_0x0fcf('0x35')](_0x5d9bcd[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x49fd0e[_0x0fcf('0x37')]=_0x49fd0e[_0x0fcf('0x37')][_0x0fcf('0x38')]?_0x49fd0e[_0x0fcf('0x37')]:_0x5d9bcd[_0x0fcf('0x30')];if(!_0x200517[_0x0fcf('0x33')][_0x0fcf('0x39')](_0x0fcf('0x3a'))){_0x49fd0e[_0x0fcf('0x1d')]=qs['limit'](_0x200517['query'][_0x0fcf('0x1d')]);_0x49fd0e['offset']=qs['offset'](_0x200517[_0x0fcf('0x33')][_0x0fcf('0x1c')]);}_0x49fd0e[_0x0fcf('0x3b')]=qs['sort'](_0x200517['query'][_0x0fcf('0x3c')]);_0x49fd0e[_0x0fcf('0x3d')]=qs[_0x0fcf('0x34')](_['pick'](_0x200517[_0x0fcf('0x33')],_0x5d9bcd[_0x0fcf('0x34')]),_0x428194);if(_0x200517[_0x0fcf('0x33')]['filter']){_0x49fd0e['where']=_['merge'](_0x49fd0e[_0x0fcf('0x3d')],{'$or':_[_0x0fcf('0x31')](_0x428194,function(_0xdfdd1){if(_0xdfdd1[_0x0fcf('0x2e')]!==_0x0fcf('0x3e')){var _0x4be8eb={};_0x4be8eb[_0xdfdd1[_0x0fcf('0x28')]]={'$like':'%'+_0x200517[_0x0fcf('0x33')][_0x0fcf('0x3f')]+'%'};return _0x4be8eb;}})});}_0x49fd0e=_['merge']({},_0x49fd0e,_0x200517['options']);var _0x13e4b2={'where':_0x49fd0e[_0x0fcf('0x3d')]};return db[_0x0fcf('0x2b')][_0x0fcf('0x1f')](_0x13e4b2)[_0x0fcf('0x24')](function(_0x4c6669){_0x4af80d[_0x0fcf('0x1f')]=_0x4c6669;if(_0x200517[_0x0fcf('0x33')][_0x0fcf('0x40')]){_0x49fd0e[_0x0fcf('0x41')]=[{'all':!![]}];}return db['Integration']['findAll'](_0x49fd0e);})[_0x0fcf('0x24')](function(_0x2444a6){_0x4af80d['rows']=_0x2444a6;return _0x4af80d;})[_0x0fcf('0x24')](respondWithFilteredResult(_0x35180d,_0x49fd0e))[_0x0fcf('0x42')](handleError(_0x35180d,null));};exports['show']=function(_0x237fa6,_0xfc2f2b){var _0x44eb03={'raw':![],'where':{'id':_0x237fa6[_0x0fcf('0x43')]['id']}},_0x1f322b={};_0x1f322b['model']=_[_0x0fcf('0x32')](db[_0x0fcf('0x2b')]['rawAttributes']);_0x1f322b['query']=_[_0x0fcf('0x32')](_0x237fa6['query']);_0x1f322b['filters']=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],_0x1f322b[_0x0fcf('0x33')]);_0x44eb03[_0x0fcf('0x37')]=_[_0x0fcf('0x35')](_0x1f322b[_0x0fcf('0x30')],qs[_0x0fcf('0x36')](_0x237fa6[_0x0fcf('0x33')][_0x0fcf('0x36')]));_0x44eb03[_0x0fcf('0x37')]=_0x44eb03['attributes'][_0x0fcf('0x38')]?_0x44eb03[_0x0fcf('0x37')]:_0x1f322b[_0x0fcf('0x30')];if(_0x237fa6['query']['includeAll']){_0x44eb03[_0x0fcf('0x41')]=[{'all':!![]}];}_0x44eb03=_[_0x0fcf('0x44')]({},_0x44eb03,_0x237fa6[_0x0fcf('0x45')]);return db[_0x0fcf('0x2b')]['find'](_0x44eb03)['then'](handleEntityNotFound(_0xfc2f2b,null))[_0x0fcf('0x24')](respondWithResult(_0xfc2f2b,null))[_0x0fcf('0x42')](handleError(_0xfc2f2b,null));};exports[_0x0fcf('0x46')]=function(_0x1fb83d,_0x345188){return db[_0x0fcf('0x2b')][_0x0fcf('0x46')](_0x1fb83d[_0x0fcf('0x47')],{})['then'](respondWithResult(_0x345188,0xc9))['catch'](handleError(_0x345188,null));};exports[_0x0fcf('0x23')]=function(_0x243699,_0x28d2f4){if(_0x243699[_0x0fcf('0x47')]['id']){delete _0x243699[_0x0fcf('0x47')]['id'];}return db[_0x0fcf('0x2b')]['find']({'where':{'id':_0x243699[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0x28d2f4,null))['then'](saveUpdates(_0x243699[_0x0fcf('0x47')],null))[_0x0fcf('0x24')](respondWithResult(_0x28d2f4,null))[_0x0fcf('0x42')](handleError(_0x28d2f4,null));};exports[_0x0fcf('0x25')]=function(_0x5435c0,_0xc514bf){return db[_0x0fcf('0x2b')][_0x0fcf('0x48')]({'where':{'id':_0x5435c0[_0x0fcf('0x43')]['id']}})[_0x0fcf('0x24')](handleEntityNotFound(_0xc514bf,null))[_0x0fcf('0x24')](removeEntity(_0xc514bf,null))[_0x0fcf('0x42')](handleError(_0xc514bf,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index cc511ae..0eb23f8 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 _0xebd2=['rimraf','../../config/environment','exports','define','Integration','integrations','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5cce57,_0x3cbadd){var _0x114fc2=function(_0x5776de){while(--_0x5776de){_0x5cce57['push'](_0x5cce57['shift']());}};_0x114fc2(++_0x3cbadd);}(_0xebd2,0x162));var _0x2ebd=function(_0x1852cd,_0x4f3c3d){_0x1852cd=_0x1852cd-0x0;var _0x40b35d=_0xebd2[_0x1852cd];return _0x40b35d;};'use strict';var _=require(_0x2ebd('0x0'));var util=require(_0x2ebd('0x1'));var logger=require(_0x2ebd('0x2'))('api');var moment=require(_0x2ebd('0x3'));var BPromise=require(_0x2ebd('0x4'));var rp=require(_0x2ebd('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2ebd('0x6'));var config=require(_0x2ebd('0x7'));var attributes=require('./integration.attributes');module[_0x2ebd('0x8')]=function(_0x507e05,_0x4a72ed){return _0x507e05[_0x2ebd('0x9')](_0x2ebd('0xa'),attributes,{'tableName':_0x2ebd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb755=['request-promise','rimraf','./integration.attributes','exports','Integration','integrations','lodash','../../config/logger','api','moment','bluebird'];(function(_0x22a6f6,_0x5d6ea9){var _0x464440=function(_0x147c88){while(--_0x147c88){_0x22a6f6['push'](_0x22a6f6['shift']());}};_0x464440(++_0x5d6ea9);}(_0xb755,0x1be));var _0x5b75=function(_0x4bb45,_0x987859){_0x4bb45=_0x4bb45-0x0;var _0x4c5fc0=_0xb755[_0x4bb45];return _0x4c5fc0;};'use strict';var _=require(_0x5b75('0x0'));var util=require('util');var logger=require(_0x5b75('0x1'))(_0x5b75('0x2'));var moment=require(_0x5b75('0x3'));var BPromise=require(_0x5b75('0x4'));var rp=require(_0x5b75('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5b75('0x6'));var config=require('../../config/environment');var attributes=require(_0x5b75('0x7'));module[_0x5b75('0x8')]=function(_0x19db77,_0x2f9bba){return _0x19db77['define'](_0x5b75('0x9'),attributes,{'tableName':_0x5b75('0xa'),'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 62b2b39..9bcac63 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 _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x568719,_0x7fdc9c){var _0xcb6e38=function(_0x3449da){while(--_0x3449da){_0x568719['push'](_0x568719['shift']());}};_0xcb6e38(++_0x7fdc9c);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file +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(_0x156ecd,_0x583c64){var _0x26e833=function(_0xe43a4){while(--_0xe43a4){_0x156ecd['push'](_0x156ecd['shift']());}};_0x26e833(++_0x583c64);}(_0x6d38,0x1ef));var _0x86d3=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x6d38[_0x2b4411];return _0x8e41ef;};'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 diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 1401893..9968632 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 _0xadb5=['delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update'];(function(_0x28014d,_0x383e2f){var _0x2572cc=function(_0x17aabd){while(--_0x17aabd){_0x28014d['push'](_0x28014d['shift']());}};_0x2572cc(++_0x383e2f);}(_0xadb5,0xad));var _0x5adb=function(_0x3eb369,_0x23a65e){_0x3eb369=_0x3eb369-0x0;var _0x303596=_0xadb5[_0x3eb369];return _0x303596;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x5adb('0x4'));var interaction=require(_0x5adb('0x5'));var config=require(_0x5adb('0x6'));var controller=require('./integrationReport.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);router['put']('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller['destroy']);module[_0x5adb('0x12')]=router; \ No newline at end of file +var _0xef0f=['update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./integrationReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put'];(function(_0x548e8d,_0x2345b6){var _0x38c2de=function(_0x58fde9){while(--_0x58fde9){_0x548e8d['push'](_0x548e8d['shift']());}};_0x38c2de(++_0x2345b6);}(_0xef0f,0x168));var _0xfef0=function(_0x2684a8,_0x49f0d9){_0x2684a8=_0x2684a8-0x0;var _0x33c0c4=_0xef0f[_0x2684a8];return _0x33c0c4;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0xf')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x11')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x13')](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index a05a0c3..2ba9910 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 _0x4f39=['DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','STRING','INTEGER'];(function(_0xb12c26,_0x26a2f5){var _0x2e8295=function(_0x207e55){while(--_0x207e55){_0xb12c26['push'](_0xb12c26['shift']());}};_0x2e8295(++_0x26a2f5);}(_0x4f39,0x126));var _0x94f3=function(_0x479137,_0x433ebd){_0x479137=_0x479137-0x0;var _0x2ec14f=_0x4f39[_0x479137];return _0x2ec14f;};'use strict';var Sequelize=require(_0x94f3('0x0'));module['exports']={'integration':{'type':Sequelize[_0x94f3('0x1')]},'eventChannel':{'type':Sequelize[_0x94f3('0x1')]},'exitStatus':{'type':Sequelize[_0x94f3('0x1')]},'ticketId':{'type':Sequelize[_0x94f3('0x1')]},'integrationId':{'type':Sequelize[_0x94f3('0x2')]},'contacts':{'type':Sequelize[_0x94f3('0x1')]},'uniqueid':{'type':Sequelize[_0x94f3('0x1')]},'calleridnum':{'type':Sequelize[_0x94f3('0x1')]},'calleridname':{'type':Sequelize[_0x94f3('0x1')]},'queue':{'type':Sequelize[_0x94f3('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x94f3('0x3')]},'agentconnectAt':{'type':Sequelize[_0x94f3('0x3')]},'holdtime':{'type':Sequelize[_0x94f3('0x2')]},'agentcomplete':{'type':Sequelize[_0x94f3('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x94f3('0x3')]},'talktime':{'type':Sequelize[_0x94f3('0x2')]},'agentacw':{'type':Sequelize[_0x94f3('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x94f3('0x1')]},'agentringnoanswer':{'type':Sequelize[_0x94f3('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x94f3('0x3')]},'agentdump':{'type':Sequelize[_0x94f3('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x94f3('0x3')]},'lastevent':{'type':Sequelize[_0x94f3('0x1')]},'channel':{'type':Sequelize[_0x94f3('0x1')]},'channelstate':{'type':Sequelize[_0x94f3('0x2')]},'channelstatedesc':{'type':Sequelize[_0x94f3('0x1')]},'connectedlinenum':{'type':Sequelize[_0x94f3('0x1')]},'connectedlinename':{'type':Sequelize[_0x94f3('0x1')]},'language':{'type':Sequelize[_0x94f3('0x1')]},'accountcode':{'type':Sequelize[_0x94f3('0x1')]},'context':{'type':Sequelize[_0x94f3('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x94f3('0x1')]},'destchannel':{'type':Sequelize[_0x94f3('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x94f3('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x94f3('0x1')]},'destlanguage':{'type':Sequelize[_0x94f3('0x1')]},'destaccountcode':{'type':Sequelize[_0x94f3('0x1')]},'destcontext':{'type':Sequelize[_0x94f3('0x1')]},'destexten':{'type':Sequelize[_0x94f3('0x1')]},'destpriority':{'type':Sequelize[_0x94f3('0x1')]},'destuniqueid':{'type':Sequelize[_0x94f3('0x1')]},'messageId':{'type':Sequelize[_0x94f3('0x1')]},'inReplyTo':{'type':Sequelize[_0x94f3('0x1')]},'subject':{'type':Sequelize[_0x94f3('0x1')]},'from':{'type':Sequelize[_0x94f3('0x1')]},'to':{'type':Sequelize[_0x94f3('0x1')]},'cc':{'type':Sequelize[_0x94f3('0x1')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x94f3('0x5')]},'text':{'type':Sequelize[_0x94f3('0x5')]},'status':{'type':Sequelize[_0x94f3('0x6')](_0x94f3('0x7'),_0x94f3('0x8'),_0x94f3('0x9'),_0x94f3('0xa'))},'url':{'type':Sequelize[_0x94f3('0x1')]},'app':{'type':Sequelize[_0x94f3('0x1')]},'appdata':{'type':Sequelize[_0x94f3('0x1')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x292d=['ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT'];(function(_0xdf757d,_0x7f7088){var _0x24f61b=function(_0x14ce54){while(--_0x14ce54){_0xdf757d['push'](_0xdf757d['shift']());}};_0x24f61b(++_0x7f7088);}(_0x292d,0x191));var _0xd292=function(_0x562faa,_0x23adc7){_0x562faa=_0x562faa-0x0;var _0xc70f59=_0x292d[_0x562faa];return _0xc70f59;};'use strict';var Sequelize=require(_0xd292('0x0'));module[_0xd292('0x1')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xd292('0x2')]},'ticketId':{'type':Sequelize[_0xd292('0x2')]},'integrationId':{'type':Sequelize[_0xd292('0x3')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xd292('0x2')]},'calleridnum':{'type':Sequelize[_0xd292('0x2')]},'calleridname':{'type':Sequelize[_0xd292('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd292('0x2')]},'membername':{'type':Sequelize[_0xd292('0x2')]},'agentcalledAt':{'type':Sequelize[_0xd292('0x4')]},'agentconnectAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xd292('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xd292('0x4')]},'talktime':{'type':Sequelize[_0xd292('0x3')]},'agentacw':{'type':Sequelize[_0xd292('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xd292('0x3')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xd292('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xd292('0x4')]},'agentdump':{'type':Sequelize[_0xd292('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xd292('0x4')]},'lastevent':{'type':Sequelize[_0xd292('0x2')]},'channel':{'type':Sequelize[_0xd292('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xd292('0x2')]},'language':{'type':Sequelize[_0xd292('0x2')]},'accountcode':{'type':Sequelize[_0xd292('0x2')]},'context':{'type':Sequelize[_0xd292('0x2')]},'exten':{'type':Sequelize[_0xd292('0x2')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xd292('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd292('0x2')]},'destcalleridnum':{'type':Sequelize[_0xd292('0x2')]},'destcalleridname':{'type':Sequelize[_0xd292('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xd292('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xd292('0x2')]},'destlanguage':{'type':Sequelize[_0xd292('0x2')]},'destaccountcode':{'type':Sequelize[_0xd292('0x2')]},'destcontext':{'type':Sequelize[_0xd292('0x2')]},'destexten':{'type':Sequelize[_0xd292('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xd292('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xd292('0x2')]},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xd292('0x2')]},'attachment':{'type':Sequelize[_0xd292('0x6')]},'html':{'type':Sequelize[_0xd292('0x6')]},'text':{'type':Sequelize[_0xd292('0x6')]},'status':{'type':Sequelize[_0xd292('0x7')](_0xd292('0x8'),_0xd292('0x9'),_0xd292('0xa'),_0xd292('0xb'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0xd292('0x2')]},'appdata':{'type':Sequelize[_0xd292('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 0c32cd6..a1eb58b 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 _0x711a=['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/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','destroy','then','stack','name','index','map','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','type','filter','options','where','IntegrationReport','includeAll','include','findAll','rows','catch','show','params','rawAttributes','intersection','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x355ce8,_0x5f1d0a){var _0x1db8b8=function(_0x277eb2){while(--_0x277eb2){_0x355ce8['push'](_0x355ce8['shift']());}};_0x1db8b8(++_0x5f1d0a);}(_0x711a,0x1cd));var _0xa711=function(_0x576fe9,_0x558e03){_0x576fe9=_0x576fe9-0x0;var _0x120c93=_0x711a[_0x576fe9];return _0x120c93;};'use strict';var emlformat=require(_0xa711('0x0'));var rimraf=require(_0xa711('0x1'));var zipdir=require(_0xa711('0x2'));var jsonpatch=require(_0xa711('0x3'));var rp=require(_0xa711('0x4'));var moment=require(_0xa711('0x5'));var BPromise=require(_0xa711('0x6'));var Mustache=require(_0xa711('0x7'));var util=require('util');var path=require(_0xa711('0x8'));var sox=require('sox');var csv=require(_0xa711('0x9'));var ejs=require(_0xa711('0xa'));var fs=require('fs');var fs_extra=require(_0xa711('0xb'));var _=require(_0xa711('0xc'));var squel=require(_0xa711('0xd'));var crypto=require(_0xa711('0xe'));var jsforce=require(_0xa711('0xf'));var deskjs=require(_0xa711('0x10'));var toCsv=require(_0xa711('0x9'));var querystring=require(_0xa711('0x11'));var Papa=require(_0xa711('0x12'));var Redis=require(_0xa711('0x13'));var authService=require(_0xa711('0x14'));var qs=require(_0xa711('0x15'));var as=require(_0xa711('0x16'));var hardwareService=require(_0xa711('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xa711('0x18'));var config=require(_0xa711('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa711('0x1a'))['db'];function respondWithStatusCode(_0xbba66d,_0x541f34){_0x541f34=_0x541f34||0xcc;return function(_0x157323){if(_0x157323){return _0xbba66d[_0xa711('0x1b')](_0x541f34);}return _0xbba66d[_0xa711('0x1c')](_0x541f34)[_0xa711('0x1d')]();};}function respondWithResult(_0x319218,_0x3bf7d0){_0x3bf7d0=_0x3bf7d0||0xc8;return function(_0x1f74ca){if(_0x1f74ca){return _0x319218[_0xa711('0x1c')](_0x3bf7d0)[_0xa711('0x1e')](_0x1f74ca);}};}function respondWithFilteredResult(_0x5f499c,_0x5cbf08){return function(_0x2c3409){if(_0x2c3409){var _0x4affd0=typeof _0x5cbf08[_0xa711('0x1f')]===_0xa711('0x20')&&typeof _0x5cbf08['limit']==='undefined';var _0x3ad1eb=_0x2c3409[_0xa711('0x21')];var _0x2bb0d4=_0x4affd0?0x0:_0x5cbf08['offset'];var _0x32a6a8=_0x4affd0?_0x2c3409[_0xa711('0x21')]:_0x5cbf08['offset']+_0x5cbf08[_0xa711('0x22')];var _0x4fde32;if(_0x32a6a8>=_0x3ad1eb){_0x32a6a8=_0x3ad1eb;_0x4fde32=0xc8;}else{_0x4fde32=0xce;}_0x5f499c[_0xa711('0x1c')](_0x4fde32);return _0x5f499c[_0xa711('0x23')](_0xa711('0x24'),_0x2bb0d4+'-'+_0x32a6a8+'/'+_0x3ad1eb)[_0xa711('0x1e')](_0x2c3409);}return null;};}function patchUpdates(_0x162663){return function(_0xcbf26e){try{jsonpatch[_0xa711('0x25')](_0xcbf26e,_0x162663,!![]);}catch(_0x208698){return BPromise['reject'](_0x208698);}return _0xcbf26e[_0xa711('0x26')]();};}function saveUpdates(_0x2bbda2,_0x58524e){return function(_0x11a376){if(_0x11a376){return _0x11a376['update'](_0x2bbda2)['then'](function(_0x11f780){return _0x11f780;});}return null;};}function removeEntity(_0x1391a1,_0x36bdbb){return function(_0x21b9c6){if(_0x21b9c6){return _0x21b9c6[_0xa711('0x27')]()[_0xa711('0x28')](function(){_0x1391a1[_0xa711('0x1c')](0xcc)[_0xa711('0x1d')]();});}};}function handleEntityNotFound(_0x386538,_0x3c91c2){return function(_0x124a1d){if(!_0x124a1d){_0x386538[_0xa711('0x1b')](0x194);}return _0x124a1d;};}function handleError(_0x414ee0,_0x1de545){_0x1de545=_0x1de545||0x1f4;return function(_0x333e75){logger['error'](_0x333e75[_0xa711('0x29')]);if(_0x333e75[_0xa711('0x2a')]){delete _0x333e75[_0xa711('0x2a')];}_0x414ee0[_0xa711('0x1c')](_0x1de545)['send'](_0x333e75);};}exports[_0xa711('0x2b')]=function(_0x1c584c,_0x3b9003){var _0x3348b8={},_0x49f50d={},_0x514c68={'count':0x0,'rows':[]};var _0x4b3a5a=_[_0xa711('0x2c')](db['IntegrationReport']['rawAttributes'],function(_0x13fec4){return{'name':_0x13fec4['fieldName'],'type':_0x13fec4['type'][_0xa711('0x2d')]};});_0x49f50d[_0xa711('0x2e')]=_[_0xa711('0x2c')](_0x4b3a5a,_0xa711('0x2a'));_0x49f50d[_0xa711('0x2f')]=_[_0xa711('0x30')](_0x1c584c[_0xa711('0x2f')]);_0x49f50d[_0xa711('0x31')]=_['intersection'](_0x49f50d[_0xa711('0x2e')],_0x49f50d[_0xa711('0x2f')]);_0x3348b8[_0xa711('0x32')]=_['intersection'](_0x49f50d[_0xa711('0x2e')],qs[_0xa711('0x33')](_0x1c584c[_0xa711('0x2f')]['fields']));_0x3348b8[_0xa711('0x32')]=_0x3348b8['attributes'][_0xa711('0x34')]?_0x3348b8[_0xa711('0x32')]:_0x49f50d['model'];if(!_0x1c584c[_0xa711('0x2f')][_0xa711('0x35')](_0xa711('0x36'))){_0x3348b8[_0xa711('0x22')]=qs[_0xa711('0x22')](_0x1c584c['query']['limit']);_0x3348b8['offset']=qs[_0xa711('0x1f')](_0x1c584c[_0xa711('0x2f')][_0xa711('0x1f')]);}_0x3348b8[_0xa711('0x37')]=qs[_0xa711('0x38')](_0x1c584c[_0xa711('0x2f')][_0xa711('0x38')]);_0x3348b8['where']=qs['filters'](_[_0xa711('0x39')](_0x1c584c[_0xa711('0x2f')],_0x49f50d[_0xa711('0x31')]),_0x4b3a5a);if(_0x1c584c[_0xa711('0x2f')]['filter']){_0x3348b8['where']=_[_0xa711('0x3a')](_0x3348b8['where'],{'$or':_[_0xa711('0x2c')](_0x4b3a5a,function(_0xa6fecb){if(_0xa6fecb[_0xa711('0x3b')]!=='VIRTUAL'){var _0x4d793e={};_0x4d793e[_0xa6fecb[_0xa711('0x2a')]]={'$like':'%'+_0x1c584c[_0xa711('0x2f')][_0xa711('0x3c')]+'%'};return _0x4d793e;}})});}_0x3348b8=_[_0xa711('0x3a')]({},_0x3348b8,_0x1c584c[_0xa711('0x3d')]);var _0xcf61b2={'where':_0x3348b8[_0xa711('0x3e')]};return db[_0xa711('0x3f')][_0xa711('0x21')](_0xcf61b2)[_0xa711('0x28')](function(_0x52c5e8){_0x514c68[_0xa711('0x21')]=_0x52c5e8;if(_0x1c584c['query'][_0xa711('0x40')]){_0x3348b8[_0xa711('0x41')]=[{'all':!![]}];}return db[_0xa711('0x3f')][_0xa711('0x42')](_0x3348b8);})[_0xa711('0x28')](function(_0x3392c8){_0x514c68[_0xa711('0x43')]=_0x3392c8;return _0x514c68;})['then'](respondWithFilteredResult(_0x3b9003,_0x3348b8))[_0xa711('0x44')](handleError(_0x3b9003,null));};exports[_0xa711('0x45')]=function(_0x90f26a,_0x35349e){var _0x52a561={'raw':![],'where':{'id':_0x90f26a[_0xa711('0x46')]['id']}},_0x1745fa={};_0x1745fa[_0xa711('0x2e')]=_['keys'](db[_0xa711('0x3f')][_0xa711('0x47')]);_0x1745fa['query']=_[_0xa711('0x30')](_0x90f26a[_0xa711('0x2f')]);_0x1745fa[_0xa711('0x31')]=_['intersection'](_0x1745fa[_0xa711('0x2e')],_0x1745fa[_0xa711('0x2f')]);_0x52a561[_0xa711('0x32')]=_[_0xa711('0x48')](_0x1745fa['model'],qs[_0xa711('0x33')](_0x90f26a['query'][_0xa711('0x33')]));_0x52a561['attributes']=_0x52a561[_0xa711('0x32')]['length']?_0x52a561[_0xa711('0x32')]:_0x1745fa['model'];if(_0x90f26a['query']['includeAll']){_0x52a561[_0xa711('0x41')]=[{'all':!![]}];}_0x52a561=_[_0xa711('0x3a')]({},_0x52a561,_0x90f26a[_0xa711('0x3d')]);return db[_0xa711('0x3f')][_0xa711('0x49')](_0x52a561)[_0xa711('0x28')](handleEntityNotFound(_0x35349e,null))['then'](respondWithResult(_0x35349e,null))[_0xa711('0x44')](handleError(_0x35349e,null));};exports[_0xa711('0x4a')]=function(_0x46c8aa,_0x1c70cd){return db[_0xa711('0x3f')][_0xa711('0x4a')](_0x46c8aa[_0xa711('0x4b')],{})[_0xa711('0x28')](respondWithResult(_0x1c70cd,0xc9))[_0xa711('0x44')](handleError(_0x1c70cd,null));};exports[_0xa711('0x4c')]=function(_0x173724,_0xa164b2){if(_0x173724[_0xa711('0x4b')]['id']){delete _0x173724[_0xa711('0x4b')]['id'];}return db[_0xa711('0x3f')][_0xa711('0x49')]({'where':{'id':_0x173724[_0xa711('0x46')]['id']}})[_0xa711('0x28')](handleEntityNotFound(_0xa164b2,null))['then'](saveUpdates(_0x173724[_0xa711('0x4b')],null))[_0xa711('0x28')](respondWithResult(_0xa164b2,null))[_0xa711('0x44')](handleError(_0xa164b2,null));};exports[_0xa711('0x27')]=function(_0x3f06ee,_0x10056a){return db['IntegrationReport'][_0xa711('0x49')]({'where':{'id':_0x3f06ee['params']['id']}})[_0xa711('0x28')](handleEntityNotFound(_0x10056a,null))[_0xa711('0x28')](removeEntity(_0x10056a,null))[_0xa711('0x44')](handleError(_0x10056a,null));};exports['describe']=function(_0x4a88a1,_0x2419ae){return db[_0xa711('0x3f')][_0xa711('0x4d')]()[_0xa711('0x28')](respondWithResult(_0x2419ae,null))[_0xa711('0x44')](handleError(_0x2419ae,null));}; \ No newline at end of file +var _0xfd7d=['json','offset','limit','undefined','count','set','reject','save','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','IntegrationReport','findAll','rows','catch','length','include','options','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','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/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xfd7d,0x19a));var _0xdfd7=function(_0x401f2e,_0x119d0d){_0x401f2e=_0x401f2e-0x0;var _0x4ef876=_0xfd7d[_0x401f2e];return _0x4ef876;};'use strict';var emlformat=require(_0xdfd7('0x0'));var rimraf=require(_0xdfd7('0x1'));var zipdir=require(_0xdfd7('0x2'));var jsonpatch=require(_0xdfd7('0x3'));var rp=require('request-promise');var moment=require(_0xdfd7('0x4'));var BPromise=require(_0xdfd7('0x5'));var Mustache=require('mustache');var util=require(_0xdfd7('0x6'));var path=require(_0xdfd7('0x7'));var sox=require(_0xdfd7('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdfd7('0x9'));var _=require(_0xdfd7('0xa'));var squel=require(_0xdfd7('0xb'));var crypto=require(_0xdfd7('0xc'));var jsforce=require(_0xdfd7('0xd'));var deskjs=require(_0xdfd7('0xe'));var toCsv=require(_0xdfd7('0xf'));var querystring=require(_0xdfd7('0x10'));var Papa=require(_0xdfd7('0x11'));var Redis=require('ioredis');var authService=require(_0xdfd7('0x12'));var qs=require(_0xdfd7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdfd7('0x14'));var logger=require(_0xdfd7('0x15'))(_0xdfd7('0x16'));var utils=require(_0xdfd7('0x17'));var config=require(_0xdfd7('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xdfd7('0x19'))['db'];function respondWithStatusCode(_0x380c44,_0x3c982f){_0x3c982f=_0x3c982f||0xcc;return function(_0x3d64f6){if(_0x3d64f6){return _0x380c44[_0xdfd7('0x1a')](_0x3c982f);}return _0x380c44[_0xdfd7('0x1b')](_0x3c982f)['end']();};}function respondWithResult(_0x1d4b20,_0x169b1f){_0x169b1f=_0x169b1f||0xc8;return function(_0x43cfa1){if(_0x43cfa1){return _0x1d4b20['status'](_0x169b1f)[_0xdfd7('0x1c')](_0x43cfa1);}};}function respondWithFilteredResult(_0x331d71,_0x1a0511){return function(_0x49599a){if(_0x49599a){var _0x54c8d7=typeof _0x1a0511[_0xdfd7('0x1d')]==='undefined'&&typeof _0x1a0511[_0xdfd7('0x1e')]===_0xdfd7('0x1f');var _0x1ee4f4=_0x49599a[_0xdfd7('0x20')];var _0x15b176=_0x54c8d7?0x0:_0x1a0511[_0xdfd7('0x1d')];var _0x3af519=_0x54c8d7?_0x49599a[_0xdfd7('0x20')]:_0x1a0511['offset']+_0x1a0511[_0xdfd7('0x1e')];var _0x53598f;if(_0x3af519>=_0x1ee4f4){_0x3af519=_0x1ee4f4;_0x53598f=0xc8;}else{_0x53598f=0xce;}_0x331d71[_0xdfd7('0x1b')](_0x53598f);return _0x331d71[_0xdfd7('0x21')]('Content-Range',_0x15b176+'-'+_0x3af519+'/'+_0x1ee4f4)[_0xdfd7('0x1c')](_0x49599a);}return null;};}function patchUpdates(_0x533e38){return function(_0x520367){try{jsonpatch['apply'](_0x520367,_0x533e38,!![]);}catch(_0x4cbad6){return BPromise[_0xdfd7('0x22')](_0x4cbad6);}return _0x520367[_0xdfd7('0x23')]();};}function saveUpdates(_0x11a306,_0x38f1ca){return function(_0x415282){if(_0x415282){return _0x415282['update'](_0x11a306)[_0xdfd7('0x24')](function(_0xb49e15){return _0xb49e15;});}return null;};}function removeEntity(_0x16398f,_0x3a870b){return function(_0x2cade5){if(_0x2cade5){return _0x2cade5[_0xdfd7('0x25')]()[_0xdfd7('0x24')](function(){_0x16398f[_0xdfd7('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2708a2,_0xeb9903){return function(_0x39ae7d){if(!_0x39ae7d){_0x2708a2[_0xdfd7('0x1a')](0x194);}return _0x39ae7d;};}function handleError(_0x1ecd8c,_0x3dad58){_0x3dad58=_0x3dad58||0x1f4;return function(_0x17db2d){logger[_0xdfd7('0x26')](_0x17db2d[_0xdfd7('0x27')]);if(_0x17db2d[_0xdfd7('0x28')]){delete _0x17db2d[_0xdfd7('0x28')];}_0x1ecd8c['status'](_0x3dad58)['send'](_0x17db2d);};}exports[_0xdfd7('0x29')]=function(_0x42062c,_0x4e8001){var _0x15fa62={},_0x2c1a72={},_0x3fa105={'count':0x0,'rows':[]};var _0x5af324=_[_0xdfd7('0x2a')](db['IntegrationReport'][_0xdfd7('0x2b')],function(_0x1bdc93){return{'name':_0x1bdc93[_0xdfd7('0x2c')],'type':_0x1bdc93['type']['key']};});_0x2c1a72[_0xdfd7('0x2d')]=_['map'](_0x5af324,_0xdfd7('0x28'));_0x2c1a72[_0xdfd7('0x2e')]=_[_0xdfd7('0x2f')](_0x42062c[_0xdfd7('0x2e')]);_0x2c1a72[_0xdfd7('0x30')]=_['intersection'](_0x2c1a72[_0xdfd7('0x2d')],_0x2c1a72[_0xdfd7('0x2e')]);_0x15fa62[_0xdfd7('0x31')]=_[_0xdfd7('0x32')](_0x2c1a72[_0xdfd7('0x2d')],qs[_0xdfd7('0x33')](_0x42062c[_0xdfd7('0x2e')][_0xdfd7('0x33')]));_0x15fa62[_0xdfd7('0x31')]=_0x15fa62[_0xdfd7('0x31')]['length']?_0x15fa62[_0xdfd7('0x31')]:_0x2c1a72[_0xdfd7('0x2d')];if(!_0x42062c[_0xdfd7('0x2e')][_0xdfd7('0x34')](_0xdfd7('0x35'))){_0x15fa62[_0xdfd7('0x1e')]=qs[_0xdfd7('0x1e')](_0x42062c[_0xdfd7('0x2e')][_0xdfd7('0x1e')]);_0x15fa62[_0xdfd7('0x1d')]=qs['offset'](_0x42062c[_0xdfd7('0x2e')][_0xdfd7('0x1d')]);}_0x15fa62[_0xdfd7('0x36')]=qs[_0xdfd7('0x37')](_0x42062c[_0xdfd7('0x2e')][_0xdfd7('0x37')]);_0x15fa62[_0xdfd7('0x38')]=qs[_0xdfd7('0x30')](_['pick'](_0x42062c[_0xdfd7('0x2e')],_0x2c1a72['filters']),_0x5af324);if(_0x42062c['query'][_0xdfd7('0x39')]){_0x15fa62['where']=_[_0xdfd7('0x3a')](_0x15fa62[_0xdfd7('0x38')],{'$or':_[_0xdfd7('0x2a')](_0x5af324,function(_0x4ccb9b){if(_0x4ccb9b['type']!=='VIRTUAL'){var _0x2968e0={};_0x2968e0[_0x4ccb9b[_0xdfd7('0x28')]]={'$like':'%'+_0x42062c[_0xdfd7('0x2e')][_0xdfd7('0x39')]+'%'};return _0x2968e0;}})});}_0x15fa62=_['merge']({},_0x15fa62,_0x42062c['options']);var _0x80991c={'where':_0x15fa62[_0xdfd7('0x38')]};return db['IntegrationReport'][_0xdfd7('0x20')](_0x80991c)[_0xdfd7('0x24')](function(_0x3ad2a8){_0x3fa105['count']=_0x3ad2a8;if(_0x42062c['query'][_0xdfd7('0x3b')]){_0x15fa62['include']=[{'all':!![]}];}return db[_0xdfd7('0x3c')][_0xdfd7('0x3d')](_0x15fa62);})['then'](function(_0x42c1b1){_0x3fa105[_0xdfd7('0x3e')]=_0x42c1b1;return _0x3fa105;})[_0xdfd7('0x24')](respondWithFilteredResult(_0x4e8001,_0x15fa62))[_0xdfd7('0x3f')](handleError(_0x4e8001,null));};exports['show']=function(_0x121abb,_0xfd5099){var _0x555ac0={'raw':![],'where':{'id':_0x121abb['params']['id']}},_0x50ad96={};_0x50ad96['model']=_[_0xdfd7('0x2f')](db['IntegrationReport'][_0xdfd7('0x2b')]);_0x50ad96['query']=_[_0xdfd7('0x2f')](_0x121abb[_0xdfd7('0x2e')]);_0x50ad96[_0xdfd7('0x30')]=_[_0xdfd7('0x32')](_0x50ad96[_0xdfd7('0x2d')],_0x50ad96[_0xdfd7('0x2e')]);_0x555ac0['attributes']=_[_0xdfd7('0x32')](_0x50ad96[_0xdfd7('0x2d')],qs[_0xdfd7('0x33')](_0x121abb['query'][_0xdfd7('0x33')]));_0x555ac0[_0xdfd7('0x31')]=_0x555ac0[_0xdfd7('0x31')][_0xdfd7('0x40')]?_0x555ac0[_0xdfd7('0x31')]:_0x50ad96[_0xdfd7('0x2d')];if(_0x121abb['query']['includeAll']){_0x555ac0[_0xdfd7('0x41')]=[{'all':!![]}];}_0x555ac0=_['merge']({},_0x555ac0,_0x121abb[_0xdfd7('0x42')]);return db[_0xdfd7('0x3c')][_0xdfd7('0x43')](_0x555ac0)[_0xdfd7('0x24')](handleEntityNotFound(_0xfd5099,null))['then'](respondWithResult(_0xfd5099,null))[_0xdfd7('0x3f')](handleError(_0xfd5099,null));};exports[_0xdfd7('0x44')]=function(_0x3d37d8,_0x376679){return db[_0xdfd7('0x3c')][_0xdfd7('0x44')](_0x3d37d8[_0xdfd7('0x45')],{})['then'](respondWithResult(_0x376679,0xc9))[_0xdfd7('0x3f')](handleError(_0x376679,null));};exports[_0xdfd7('0x46')]=function(_0x3525d6,_0x410634){if(_0x3525d6['body']['id']){delete _0x3525d6['body']['id'];}return db['IntegrationReport']['find']({'where':{'id':_0x3525d6['params']['id']}})[_0xdfd7('0x24')](handleEntityNotFound(_0x410634,null))[_0xdfd7('0x24')](saveUpdates(_0x3525d6['body'],null))['then'](respondWithResult(_0x410634,null))[_0xdfd7('0x3f')](handleError(_0x410634,null));};exports[_0xdfd7('0x25')]=function(_0x46e290,_0x250304){return db[_0xdfd7('0x3c')][_0xdfd7('0x43')]({'where':{'id':_0x46e290[_0xdfd7('0x47')]['id']}})[_0xdfd7('0x24')](handleEntityNotFound(_0x250304,null))[_0xdfd7('0x24')](removeEntity(_0x250304,null))[_0xdfd7('0x3f')](handleError(_0x250304,null));};exports[_0xdfd7('0x48')]=function(_0x35548f,_0xa7de25){return db['IntegrationReport'][_0xdfd7('0x48')]()['then'](respondWithResult(_0xa7de25,null))[_0xdfd7('0x3f')](handleError(_0xa7de25,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 3bd784a..188e51a 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 _0xd711=['../../config/environment','./integrationReport.attributes','exports','util','../../config/logger','api','moment','request-promise'];(function(_0x4adbd4,_0xf8d7cb){var _0x4535a7=function(_0x5873fa){while(--_0x5873fa){_0x4adbd4['push'](_0x4adbd4['shift']());}};_0x4535a7(++_0xf8d7cb);}(_0xd711,0x173));var _0x1d71=function(_0x10eed1,_0x177cc1){_0x10eed1=_0x10eed1-0x0;var _0x42c493=_0xd711[_0x10eed1];return _0x42c493;};'use strict';var _=require('lodash');var util=require(_0x1d71('0x0'));var logger=require(_0x1d71('0x1'))(_0x1d71('0x2'));var moment=require(_0x1d71('0x3'));var BPromise=require('bluebird');var rp=require(_0x1d71('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1d71('0x5'));var attributes=require(_0x1d71('0x6'));module[_0x1d71('0x7')]=function(_0x191554,_0x13c76d){return _0x191554['define']('IntegrationReport',attributes,{'tableName':'report_integration','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3861=['define','report_integration','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x556a41,_0x482566){var _0x338ae8=function(_0x2ca412){while(--_0x2ca412){_0x556a41['push'](_0x556a41['shift']());}};_0x338ae8(++_0x482566);}(_0x3861,0x91));var _0x1386=function(_0x4d692a,_0x25088e){_0x4d692a=_0x4d692a-0x0;var _0xb08e94=_0x3861[_0x4d692a];return _0xb08e94;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1386('0x0'))(_0x1386('0x1'));var moment=require(_0x1386('0x2'));var BPromise=require(_0x1386('0x3'));var rp=require(_0x1386('0x4'));var fs=require('fs');var path=require(_0x1386('0x5'));var rimraf=require(_0x1386('0x6'));var config=require(_0x1386('0x7'));var attributes=require(_0x1386('0x8'));module['exports']=function(_0x4b6709,_0x1d4300){return _0x4b6709[_0x1386('0x9')]('IntegrationReport',attributes,{'tableName':_0x1386('0xa'),'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 3b07980..f31eaf2 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 _0xc2c7=['../../config/logger','jayson/promise','client','http','request','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xc2c7,0x134));var _0x7c2c=function(_0x8a222b,_0x4e3660){_0x8a222b=_0x8a222b-0x0;var _0x2b6252=_0xc2c7[_0x8a222b];return _0x2b6252;};'use strict';var _=require('lodash');var util=require(_0x7c2c('0x0'));var moment=require(_0x7c2c('0x1'));var BPromise=require(_0x7c2c('0x2'));var rs=require(_0x7c2c('0x3'));var fs=require('fs');var Redis=require(_0x7c2c('0x4'));var db=require(_0x7c2c('0x5'))['db'];var utils=require(_0x7c2c('0x6'));var logger=require(_0x7c2c('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7c2c('0x8'));var client=jayson[_0x7c2c('0x9')][_0x7c2c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x54f027,_0x4abe93,_0x5a1027){return new BPromise(function(_0x2274cd,_0x29638d){return client[_0x7c2c('0xb')](_0x54f027,_0x5a1027)[_0x7c2c('0xc')](function(_0x279cff){logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));logger[_0x7c2c('0xf')](_0x7c2c('0x10'),_0x4abe93,_0x7c2c('0xe'),JSON[_0x7c2c('0x11')](_0x279cff));if(_0x279cff[_0x7c2c('0x12')]){if(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x13')]===0x1f4){logger[_0x7c2c('0x12')](_0x7c2c('0xd'),_0x4abe93,_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);return _0x29638d(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}logger[_0x7c2c('0x12')]('IntegrationReport,\x20%s,\x20%s',_0x4abe93,_0x279cff['error'][_0x7c2c('0x14')]);return _0x2274cd(_0x279cff[_0x7c2c('0x12')][_0x7c2c('0x14')]);}else{logger['info'](_0x7c2c('0xd'),_0x4abe93,_0x7c2c('0xe'));_0x2274cd(_0x279cff['result'][_0x7c2c('0x14')]);}})['catch'](function(_0x1aa355){logger['error'](_0x7c2c('0xd'),_0x4abe93,_0x1aa355);_0x29638d(_0x1aa355);});});} \ No newline at end of file +var _0x57ca=['client','http','request','info','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error','code','IntegrationReport,\x20%s,\x20%s','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0xe930d7,_0x3c8653){var _0x1adb1d=function(_0x5ce974){while(--_0x5ce974){_0xe930d7['push'](_0xe930d7['shift']());}};_0x1adb1d(++_0x3c8653);}(_0x57ca,0x108));var _0xa57c=function(_0x2926c1,_0x4ea7c2){_0x2926c1=_0x2926c1-0x0;var _0x48e509=_0x57ca[_0x2926c1];return _0x48e509;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xbdfffb,_0x314574,_0x19e28e){return new BPromise(function(_0x271ccc,_0x5e3962){return client[_0xa57c('0xb')](_0xbdfffb,_0x19e28e)['then'](function(_0x46ba92){logger[_0xa57c('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0xa57c('0xd'));logger['debug'](_0xa57c('0xe'),_0x314574,_0xa57c('0xd'),JSON['stringify'](_0x46ba92));if(_0x46ba92[_0xa57c('0xf')]){if(_0x46ba92['error'][_0xa57c('0x10')]===0x1f4){logger[_0xa57c('0xf')](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x5e3962(_0x46ba92['error'][_0xa57c('0x12')]);}logger['error'](_0xa57c('0x11'),_0x314574,_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);return _0x271ccc(_0x46ba92[_0xa57c('0xf')][_0xa57c('0x12')]);}else{logger[_0xa57c('0xc')](_0xa57c('0x11'),_0x314574,'request\x20sent');_0x271ccc(_0x46ba92[_0xa57c('0x13')][_0xa57c('0x12')]);}})[_0xa57c('0x14')](function(_0x5a6024){logger[_0xa57c('0xf')]('IntegrationReport,\x20%s,\x20%s',_0x314574,_0x5a6024);_0x5e3962(_0x5a6024);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 2d60c4b..7af17ec 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 _0x2f74=['post','create','/:id/sub_intervals/create_many','addIntervals','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','isAuthenticated','show','/:id/sub_intervals'];(function(_0x4b6165,_0x167c5a){var _0x723b63=function(_0x23175a){while(--_0x23175a){_0x4b6165['push'](_0x4b6165['shift']());}};_0x723b63(++_0x167c5a);}(_0x2f74,0x7b));var _0x42f7=function(_0x3ebb04,_0x1a63a6){_0x3ebb04=_0x3ebb04-0x0;var _0x535db0=_0x2f74[_0x3ebb04];return _0x535db0;};'use strict';var multer=require(_0x42f7('0x0'));var util=require('util');var path=require(_0x42f7('0x1'));var timeout=require(_0x42f7('0x2'));var express=require(_0x42f7('0x3'));var router=express[_0x42f7('0x4')]();var fs_extra=require(_0x42f7('0x5'));var auth=require(_0x42f7('0x6'));var interaction=require(_0x42f7('0x7'));var config=require(_0x42f7('0x8'));var controller=require('./interval.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x42f7('0x9')]);router[_0x42f7('0xa')](_0x42f7('0xb'),auth[_0x42f7('0xc')](),controller[_0x42f7('0xd')]);router[_0x42f7('0xa')](_0x42f7('0xe'),auth[_0x42f7('0xc')](),controller['getIntervals']);router[_0x42f7('0xf')]('/',auth[_0x42f7('0xc')](),controller[_0x42f7('0x10')]);router[_0x42f7('0xf')](_0x42f7('0xe'),auth[_0x42f7('0xc')](),controller['addInterval']);router[_0x42f7('0xf')](_0x42f7('0x11'),auth[_0x42f7('0xc')](),controller[_0x42f7('0x12')]);router[_0x42f7('0x13')](_0x42f7('0xb'),auth[_0x42f7('0xc')](),controller[_0x42f7('0x14')]);router['delete']('/:id',auth[_0x42f7('0xc')](),controller[_0x42f7('0x15')]);module[_0x42f7('0x16')]=router; \ No newline at end of file +var _0x323e=['/:id','isAuthenticated','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller','get','index'];(function(_0x34e415,_0x25856b){var _0x2f867a=function(_0x299903){while(--_0x299903){_0x34e415['push'](_0x34e415['shift']());}};_0x2f867a(++_0x25856b);}(_0x323e,0x188));var _0xe323=function(_0x1ccaca,_0x10887f){_0x1ccaca=_0x1ccaca-0x0;var _0x3729a6=_0x323e[_0x1ccaca];return _0x3729a6;};'use strict';var multer=require(_0xe323('0x0'));var util=require(_0xe323('0x1'));var path=require(_0xe323('0x2'));var timeout=require(_0xe323('0x3'));var express=require(_0xe323('0x4'));var router=express[_0xe323('0x5')]();var fs_extra=require(_0xe323('0x6'));var auth=require(_0xe323('0x7'));var interaction=require(_0xe323('0x8'));var config=require(_0xe323('0x9'));var controller=require(_0xe323('0xa'));router[_0xe323('0xb')]('/',auth['isAuthenticated'](),controller[_0xe323('0xc')]);router['get'](_0xe323('0xd'),auth[_0xe323('0xe')](),controller['show']);router[_0xe323('0xb')](_0xe323('0xf'),auth[_0xe323('0xe')](),controller[_0xe323('0x10')]);router[_0xe323('0x11')]('/',auth['isAuthenticated'](),controller[_0xe323('0x12')]);router[_0xe323('0x11')](_0xe323('0xf'),auth[_0xe323('0xe')](),controller[_0xe323('0x13')]);router[_0xe323('0x11')](_0xe323('0x14'),auth[_0xe323('0xe')](),controller[_0xe323('0x15')]);router[_0xe323('0x16')](_0xe323('0xd'),auth['isAuthenticated'](),controller[_0xe323('0x17')]);router[_0xe323('0x18')](_0xe323('0xd'),auth[_0xe323('0xe')](),controller[_0xe323('0x19')]);module[_0xe323('0x1a')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 46d16ab..d356d0c 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 _0x95f4=['sequelize'];(function(_0x4fafac,_0x3a1c4d){var _0x3d2b43=function(_0x7fa4fe){while(--_0x7fa4fe){_0x4fafac['push'](_0x4fafac['shift']());}};_0x3d2b43(++_0x3a1c4d);}(_0x95f4,0x114));var _0x495f=function(_0x2e45f4,_0x58d3af){_0x2e45f4=_0x2e45f4-0x0;var _0x1c9bac=_0x95f4[_0x2e45f4];return _0x1c9bac;};'use strict';var Sequelize=require(_0x495f('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0x78ff=['sequelize','STRING'];(function(_0x4b9c09,_0xfd409f){var _0x186cd5=function(_0x5cc76a){while(--_0x5cc76a){_0x4b9c09['push'](_0x4b9c09['shift']());}};_0x186cd5(++_0xfd409f);}(_0x78ff,0x16a));var _0xf78f=function(_0x9ad71f,_0x18c4d5){_0x9ad71f=_0x9ad71f-0x0;var _0x1b7ab2=_0x78ff[_0x9ad71f];return _0x1b7ab2;};'use strict';var Sequelize=require(_0xf78f('0x0'));module['exports']={'name':{'type':Sequelize[_0xf78f('0x1')]},'description':{'type':Sequelize[_0xf78f('0x1')]},'interval':{'type':Sequelize[_0xf78f('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index 23ba78d..9699251 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 _0x21fd=['body','user','UserProfileSection','autoAssociation','create','addInterval','IntervalId','getIntervals','findOne','hasOwnProperty','addIntervals','sequelize','bulkCreate','findAll','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','json','undefined','offset','count','limit','status','set','apply','update','then','destroy','get','Intervals','UserProfileResource','name','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','rows','catch','params','options','find'];(function(_0x509083,_0xa6676b){var _0x4b2495=function(_0x2a14f5){while(--_0x2a14f5){_0x509083['push'](_0x509083['shift']());}};_0x4b2495(++_0xa6676b);}(_0x21fd,0xfe));var _0xd21f=function(_0x3d1ec3,_0x5e2d7c){_0x3d1ec3=_0x3d1ec3-0x0;var _0x998c76=_0x21fd[_0x3d1ec3];return _0x998c76;};'use strict';var emlformat=require(_0xd21f('0x0'));var rimraf=require(_0xd21f('0x1'));var zipdir=require(_0xd21f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd21f('0x3'));var moment=require(_0xd21f('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd21f('0x5'));var util=require(_0xd21f('0x6'));var path=require(_0xd21f('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd21f('0x8'));var _=require('lodash');var squel=require(_0xd21f('0x9'));var crypto=require('crypto');var jsforce=require(_0xd21f('0xa'));var deskjs=require(_0xd21f('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd21f('0xc'));var Papa=require('papaparse');var Redis=require(_0xd21f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xd21f('0xe'));var as=require(_0xd21f('0xf'));var hardwareService=require(_0xd21f('0x10'));var logger=require(_0xd21f('0x11'))(_0xd21f('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd21f('0x13'));var db=require(_0xd21f('0x14'))['db'];var extensions=require(_0xd21f('0x15'));function respondWithStatusCode(_0x519982,_0xfd9f5d){_0xfd9f5d=_0xfd9f5d||0xcc;return function(_0x472de8){if(_0x472de8){return _0x519982[_0xd21f('0x16')](_0xfd9f5d);}return _0x519982['status'](_0xfd9f5d)[_0xd21f('0x17')]();};}function respondWithResult(_0x1b6da9,_0x2b24e9){_0x2b24e9=_0x2b24e9||0xc8;return function(_0x5b4636){if(_0x5b4636){return _0x1b6da9['status'](_0x2b24e9)[_0xd21f('0x18')](_0x5b4636);}};}function respondWithFilteredResult(_0x297ac2,_0x1b01dc){return function(_0x1c51e3){if(_0x1c51e3){var _0x17c7a1=typeof _0x1b01dc['offset']===_0xd21f('0x19')&&typeof _0x1b01dc['limit']===_0xd21f('0x19');var _0x1c9b74=_0x1c51e3['count'];var _0x13cef7=_0x17c7a1?0x0:_0x1b01dc[_0xd21f('0x1a')];var _0x47d38d=_0x17c7a1?_0x1c51e3[_0xd21f('0x1b')]:_0x1b01dc[_0xd21f('0x1a')]+_0x1b01dc[_0xd21f('0x1c')];var _0x1ba7c9;if(_0x47d38d>=_0x1c9b74){_0x47d38d=_0x1c9b74;_0x1ba7c9=0xc8;}else{_0x1ba7c9=0xce;}_0x297ac2[_0xd21f('0x1d')](_0x1ba7c9);return _0x297ac2[_0xd21f('0x1e')]('Content-Range',_0x13cef7+'-'+_0x47d38d+'/'+_0x1c9b74)[_0xd21f('0x18')](_0x1c51e3);}return null;};}function patchUpdates(_0x4fac28){return function(_0x20f73d){try{jsonpatch[_0xd21f('0x1f')](_0x20f73d,_0x4fac28,!![]);}catch(_0x4fed0d){return BPromise['reject'](_0x4fed0d);}return _0x20f73d['save']();};}function saveUpdates(_0x12c5d9,_0x55b3ae){return function(_0x3eaec8){if(_0x3eaec8){return _0x3eaec8[_0xd21f('0x20')](_0x12c5d9)[_0xd21f('0x21')](function(_0x1844b3){return _0x1844b3;});}return null;};}function removeEntity(_0x26c299,_0x3f81de){return function(_0x490f46){if(_0x490f46){return _0x490f46[_0xd21f('0x22')]()[_0xd21f('0x21')](function(){var _0x4694c9=_0x490f46[_0xd21f('0x23')]({'plain':!![]});var _0xea93ba=_0xd21f('0x24');return db[_0xd21f('0x25')]['destroy']({'where':{'type':_0xea93ba,'resourceId':_0x4694c9['id']}})[_0xd21f('0x21')](function(){return _0x490f46;});})['then'](function(){_0x26c299['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c6d95,_0x16f5d8){return function(_0x5732b7){if(!_0x5732b7){_0x2c6d95['sendStatus'](0x194);}return _0x5732b7;};}function handleError(_0x390c35,_0x5f5671){_0x5f5671=_0x5f5671||0x1f4;return function(_0x18f8a){logger['error'](_0x18f8a['stack']);if(_0x18f8a[_0xd21f('0x26')]){delete _0x18f8a['name'];}_0x390c35[_0xd21f('0x1d')](_0x5f5671)['send'](_0x18f8a);};}exports['index']=function(_0x33b82a,_0x3cc0f7){var _0x5ce062={},_0x2aa45e={},_0x4b95ae={'count':0x0,'rows':[]};var _0x3173f5=_[_0xd21f('0x27')](db[_0xd21f('0x28')][_0xd21f('0x29')],function(_0x463695){return{'name':_0x463695[_0xd21f('0x2a')],'type':_0x463695[_0xd21f('0x2b')][_0xd21f('0x2c')]};});_0x2aa45e[_0xd21f('0x2d')]=_[_0xd21f('0x27')](_0x3173f5,_0xd21f('0x26'));_0x2aa45e[_0xd21f('0x2e')]=_[_0xd21f('0x2f')](_0x33b82a[_0xd21f('0x2e')]);_0x2aa45e['filters']=_[_0xd21f('0x30')](_0x2aa45e['model'],_0x2aa45e[_0xd21f('0x2e')]);_0x5ce062[_0xd21f('0x31')]=_[_0xd21f('0x30')](_0x2aa45e[_0xd21f('0x2d')],qs[_0xd21f('0x32')](_0x33b82a[_0xd21f('0x2e')]['fields']));_0x5ce062[_0xd21f('0x31')]=_0x5ce062[_0xd21f('0x31')][_0xd21f('0x33')]?_0x5ce062[_0xd21f('0x31')]:_0x2aa45e['model'];if(!_0x33b82a['query']['hasOwnProperty']('nolimit')){_0x5ce062[_0xd21f('0x1c')]=qs[_0xd21f('0x1c')](_0x33b82a[_0xd21f('0x2e')]['limit']);_0x5ce062['offset']=qs['offset'](_0x33b82a[_0xd21f('0x2e')][_0xd21f('0x1a')]);}_0x5ce062[_0xd21f('0x34')]=qs[_0xd21f('0x35')](_0x33b82a[_0xd21f('0x2e')][_0xd21f('0x35')]);_0x5ce062[_0xd21f('0x36')]=qs['filters'](_[_0xd21f('0x37')](_0x33b82a['query'],_0x2aa45e[_0xd21f('0x38')]),_0x3173f5);if(_0x33b82a['query'][_0xd21f('0x39')]){_0x5ce062[_0xd21f('0x36')]=_[_0xd21f('0x3a')](_0x5ce062[_0xd21f('0x36')],{'$or':_[_0xd21f('0x27')](_0x3173f5,function(_0x2c0dc3){if(_0x2c0dc3[_0xd21f('0x2b')]!==_0xd21f('0x3b')){var _0xc64f47={};_0xc64f47[_0x2c0dc3[_0xd21f('0x26')]]={'$like':'%'+_0x33b82a['query'][_0xd21f('0x39')]+'%'};return _0xc64f47;}})});}_0x5ce062=_[_0xd21f('0x3a')]({},_0x5ce062,_0x33b82a['options']);var _0x1eb359={'where':_0x5ce062[_0xd21f('0x36')]};return db[_0xd21f('0x28')][_0xd21f('0x1b')](_0x1eb359)[_0xd21f('0x21')](function(_0x4a0d7a){_0x4b95ae[_0xd21f('0x1b')]=_0x4a0d7a;if(_0x33b82a[_0xd21f('0x2e')][_0xd21f('0x3c')]){_0x5ce062['include']=[{'all':!![]}];}return db[_0xd21f('0x28')]['findAll'](_0x5ce062);})[_0xd21f('0x21')](function(_0x5c08d3){_0x4b95ae[_0xd21f('0x3d')]=_0x5c08d3;return _0x4b95ae;})[_0xd21f('0x21')](respondWithFilteredResult(_0x3cc0f7,_0x5ce062))[_0xd21f('0x3e')](handleError(_0x3cc0f7,null));};exports['show']=function(_0x46a449,_0x3d0845){var _0x4ebca5={'raw':!![],'where':{'id':_0x46a449[_0xd21f('0x3f')]['id']}},_0x412995={};_0x412995[_0xd21f('0x2d')]=_['keys'](db[_0xd21f('0x28')][_0xd21f('0x29')]);_0x412995[_0xd21f('0x2e')]=_[_0xd21f('0x2f')](_0x46a449[_0xd21f('0x2e')]);_0x412995[_0xd21f('0x38')]=_['intersection'](_0x412995[_0xd21f('0x2d')],_0x412995['query']);_0x4ebca5[_0xd21f('0x31')]=_[_0xd21f('0x30')](_0x412995[_0xd21f('0x2d')],qs['fields'](_0x46a449[_0xd21f('0x2e')][_0xd21f('0x32')]));_0x4ebca5[_0xd21f('0x31')]=_0x4ebca5[_0xd21f('0x31')][_0xd21f('0x33')]?_0x4ebca5['attributes']:_0x412995[_0xd21f('0x2d')];if(_0x46a449[_0xd21f('0x2e')]['includeAll']){_0x4ebca5['include']=[{'all':!![]}];}_0x4ebca5=_[_0xd21f('0x3a')]({},_0x4ebca5,_0x46a449[_0xd21f('0x40')]);return db[_0xd21f('0x28')][_0xd21f('0x41')](_0x4ebca5)[_0xd21f('0x21')](handleEntityNotFound(_0x3d0845,null))[_0xd21f('0x21')](respondWithResult(_0x3d0845,null))[_0xd21f('0x3e')](handleError(_0x3d0845,null));};exports['create']=function(_0x4d0177,_0x5aff4b){return db['Interval']['create'](_0x4d0177[_0xd21f('0x42')],{})[_0xd21f('0x21')](function(_0x16d2be){var _0x234141=_0x4d0177['user'][_0xd21f('0x23')]({'plain':!![]});if(!_0x234141)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x234141['role']===_0xd21f('0x43')){var _0x28d53b=_0x16d2be[_0xd21f('0x23')]({'plain':!![]});var _0x27be4c='Intervals';return db[_0xd21f('0x44')][_0xd21f('0x41')]({'where':{'name':_0x27be4c,'userProfileId':_0x234141['userProfileId']},'raw':!![]})[_0xd21f('0x21')](function(_0x3d94b1){if(_0x3d94b1&&_0x3d94b1[_0xd21f('0x45')]===0x0){return db['UserProfileResource'][_0xd21f('0x46')]({'name':_0x28d53b[_0xd21f('0x26')],'resourceId':_0x28d53b['id'],'type':_0x3d94b1[_0xd21f('0x26')],'sectionId':_0x3d94b1['id']},{})[_0xd21f('0x21')](function(){return _0x16d2be;});}else{return _0x16d2be;}})[_0xd21f('0x3e')](function(_0x2bbf63){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bbf63);throw _0x2bbf63;});}return _0x16d2be;})['then'](respondWithResult(_0x5aff4b,0xc9))[_0xd21f('0x3e')](handleError(_0x5aff4b,null));};exports[_0xd21f('0x20')]=function(_0x514ae2,_0x16097c){if(_0x514ae2['body']['id']){delete _0x514ae2['body']['id'];}return db[_0xd21f('0x28')][_0xd21f('0x41')]({'where':{'id':_0x514ae2[_0xd21f('0x3f')]['id']}})[_0xd21f('0x21')](handleEntityNotFound(_0x16097c,null))[_0xd21f('0x21')](saveUpdates(_0x514ae2[_0xd21f('0x42')],null))['then'](respondWithResult(_0x16097c,null))[_0xd21f('0x3e')](handleError(_0x16097c,null));};exports[_0xd21f('0x22')]=function(_0x3c3c65,_0x3c6755){return db[_0xd21f('0x28')][_0xd21f('0x41')]({'where':{'id':_0x3c3c65[_0xd21f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x3c6755,null))[_0xd21f('0x21')](removeEntity(_0x3c6755,null))[_0xd21f('0x3e')](handleError(_0x3c6755,null));};exports[_0xd21f('0x47')]=function(_0x3a8b26,_0x12f432,_0x66c8db){if(_0x3a8b26[_0xd21f('0x42')]['id']){delete _0x3a8b26['body']['id'];}return db[_0xd21f('0x28')][_0xd21f('0x41')]({'where':{'id':_0x3a8b26[_0xd21f('0x3f')]['id']}})[_0xd21f('0x21')](handleEntityNotFound(_0x12f432,null))['then'](function(_0x10768a){if(_0x10768a){_0x3a8b26[_0xd21f('0x42')][_0xd21f('0x48')]=_0x10768a['id'];return db[_0xd21f('0x28')][_0xd21f('0x46')](_0x3a8b26['body']);}})[_0xd21f('0x21')](respondWithResult(_0x12f432,null))[_0xd21f('0x3e')](handleError(_0x12f432,null));};exports[_0xd21f('0x49')]=function(_0x244e5f,_0x64137c,_0x2cea75){var _0x278ddb={};var _0x5c3ec9={};var _0x2d5689;var _0x52b1dc;return db[_0xd21f('0x28')][_0xd21f('0x4a')]({'where':{'id':_0x244e5f['params']['id']}})[_0xd21f('0x21')](handleEntityNotFound(_0x64137c,null))['then'](function(_0x1676d9){if(_0x1676d9){_0x2d5689=_0x1676d9;_0x5c3ec9['model']=_[_0xd21f('0x2f')](db[_0xd21f('0x28')]['rawAttributes']);_0x5c3ec9[_0xd21f('0x2e')]=_[_0xd21f('0x2f')](_0x244e5f['query']);_0x5c3ec9['filters']=_[_0xd21f('0x30')](_0x5c3ec9['model'],_0x5c3ec9[_0xd21f('0x2e')]);_0x278ddb[_0xd21f('0x31')]=_[_0xd21f('0x30')](_0x5c3ec9[_0xd21f('0x2d')],qs['fields'](_0x244e5f[_0xd21f('0x2e')][_0xd21f('0x32')]));_0x278ddb['attributes']=_0x278ddb[_0xd21f('0x31')][_0xd21f('0x33')]?_0x278ddb[_0xd21f('0x31')]:_0x5c3ec9[_0xd21f('0x2d')];_0x278ddb[_0xd21f('0x34')]=qs[_0xd21f('0x35')](_0x244e5f[_0xd21f('0x2e')][_0xd21f('0x35')]);_0x278ddb['where']=qs['filters'](_[_0xd21f('0x37')](_0x244e5f[_0xd21f('0x2e')],_0x5c3ec9[_0xd21f('0x38')]));if(_0x244e5f[_0xd21f('0x2e')][_0xd21f('0x39')]){_0x278ddb['where']=_[_0xd21f('0x3a')](_0x278ddb[_0xd21f('0x36')],{'$or':_[_0xd21f('0x27')](_0x278ddb[_0xd21f('0x31')],function(_0x34fce7){var _0x4da540={};_0x4da540[_0x34fce7]={'$like':'%'+_0x244e5f[_0xd21f('0x2e')][_0xd21f('0x39')]+'%'};return _0x4da540;})});}_0x278ddb=_[_0xd21f('0x3a')]({},_0x278ddb,_0x244e5f[_0xd21f('0x40')]);return _0x2d5689[_0xd21f('0x49')](_0x278ddb);}})[_0xd21f('0x21')](function(_0x53a79d){if(_0x53a79d){_0x52b1dc=_0x53a79d[_0xd21f('0x33')];if(!_0x244e5f[_0xd21f('0x2e')][_0xd21f('0x4b')]('nolimit')){_0x278ddb['limit']=qs[_0xd21f('0x1c')](_0x244e5f[_0xd21f('0x2e')]['limit']);_0x278ddb[_0xd21f('0x1a')]=qs['offset'](_0x244e5f[_0xd21f('0x2e')][_0xd21f('0x1a')]);}return _0x2d5689['getIntervals'](_0x278ddb);}})[_0xd21f('0x21')](function(_0x8046e7){if(_0x8046e7){return _0x8046e7?{'count':_0x52b1dc,'rows':_0x8046e7}:null;}})[_0xd21f('0x21')](respondWithResult(_0x64137c,null))['catch'](handleError(_0x64137c,null));};exports[_0xd21f('0x4c')]=function(_0x3df3ad,_0x5a59ae,_0x195cf7){return db[_0xd21f('0x28')][_0xd21f('0x4a')]({'where':{'id':_0x3df3ad['params']['id']}})[_0xd21f('0x21')](handleEntityNotFound(_0x5a59ae,null))[_0xd21f('0x21')](function(_0x4a86be){if(_0x4a86be){return db[_0xd21f('0x4d')]['transaction'](function(_0x152874){return db['Interval']['destroy']({'where':{'IntervalId':_0x3df3ad[_0xd21f('0x3f')]['id']},'transaction':_0x152874})[_0xd21f('0x21')](function(_0x55f53b){var _0x4fa30e=_[_0xd21f('0x27')](_0x3df3ad['body'],function(_0x1becbf){delete _0x1becbf['id'];_0x1becbf[_0xd21f('0x48')]=_0x3df3ad['params']['id'];return _0x1becbf;});return db[_0xd21f('0x28')][_0xd21f('0x4e')](_0x4fa30e,{'transaction':_0x152874});});})[_0xd21f('0x21')](function(){return db[_0xd21f('0x28')][_0xd21f('0x4f')]({'where':{'IntervalId':_0x3df3ad[_0xd21f('0x3f')]['id']}});});}})['then'](respondWithResult(_0x5a59ae,null))[_0xd21f('0x3e')](handleError(_0x5a59ae,null));}; \ No newline at end of file +var _0x45d5=['end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Intervals','UserProfileResource','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','create','body','role','user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','addInterval','IntervalId','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x110109,_0x192c62){var _0x41b4e4=function(_0x39e861){while(--_0x39e861){_0x110109['push'](_0x110109['shift']());}};_0x41b4e4(++_0x192c62);}(_0x45d5,0x157));var _0x545d=function(_0x27ea1b,_0x1ad811){_0x27ea1b=_0x27ea1b-0x0;var _0x44b914=_0x45d5[_0x27ea1b];return _0x44b914;};'use strict';var emlformat=require(_0x545d('0x0'));var rimraf=require(_0x545d('0x1'));var zipdir=require(_0x545d('0x2'));var jsonpatch=require(_0x545d('0x3'));var rp=require('request-promise');var moment=require(_0x545d('0x4'));var BPromise=require(_0x545d('0x5'));var Mustache=require(_0x545d('0x6'));var util=require(_0x545d('0x7'));var path=require(_0x545d('0x8'));var sox=require(_0x545d('0x9'));var csv=require(_0x545d('0xa'));var ejs=require(_0x545d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x545d('0xc'));var squel=require(_0x545d('0xd'));var crypto=require('crypto');var jsforce=require(_0x545d('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x545d('0xa'));var querystring=require('querystring');var Papa=require(_0x545d('0xf'));var Redis=require(_0x545d('0x10'));var authService=require(_0x545d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x545d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x545d('0x13'))('api');var utils=require(_0x545d('0x14'));var config=require(_0x545d('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x545d('0x16'))['db'];var extensions=require('../../components/extensions/rewrite');function respondWithStatusCode(_0x106473,_0x4498a5){_0x4498a5=_0x4498a5||0xcc;return function(_0x31fbab){if(_0x31fbab){return _0x106473[_0x545d('0x17')](_0x4498a5);}return _0x106473[_0x545d('0x18')](_0x4498a5)[_0x545d('0x19')]();};}function respondWithResult(_0x2d599d,_0x535e71){_0x535e71=_0x535e71||0xc8;return function(_0x282290){if(_0x282290){return _0x2d599d[_0x545d('0x18')](_0x535e71)[_0x545d('0x1a')](_0x282290);}};}function respondWithFilteredResult(_0x1905a9,_0x387561){return function(_0x115c1c){if(_0x115c1c){var _0x20138b=typeof _0x387561[_0x545d('0x1b')]==='undefined'&&typeof _0x387561[_0x545d('0x1c')]===_0x545d('0x1d');var _0x5b35d4=_0x115c1c['count'];var _0x481f57=_0x20138b?0x0:_0x387561['offset'];var _0x4d3d8e=_0x20138b?_0x115c1c[_0x545d('0x1e')]:_0x387561['offset']+_0x387561[_0x545d('0x1c')];var _0x12073c;if(_0x4d3d8e>=_0x5b35d4){_0x4d3d8e=_0x5b35d4;_0x12073c=0xc8;}else{_0x12073c=0xce;}_0x1905a9['status'](_0x12073c);return _0x1905a9[_0x545d('0x1f')](_0x545d('0x20'),_0x481f57+'-'+_0x4d3d8e+'/'+_0x5b35d4)['json'](_0x115c1c);}return null;};}function patchUpdates(_0x122734){return function(_0x351c71){try{jsonpatch[_0x545d('0x21')](_0x351c71,_0x122734,!![]);}catch(_0x2aa3ab){return BPromise[_0x545d('0x22')](_0x2aa3ab);}return _0x351c71[_0x545d('0x23')]();};}function saveUpdates(_0x495681,_0x2c4e51){return function(_0x1c2d43){if(_0x1c2d43){return _0x1c2d43[_0x545d('0x24')](_0x495681)[_0x545d('0x25')](function(_0x1a99fe){return _0x1a99fe;});}return null;};}function removeEntity(_0x95ced5,_0x143573){return function(_0x33b86a){if(_0x33b86a){return _0x33b86a[_0x545d('0x26')]()[_0x545d('0x25')](function(){var _0x5a4e1d=_0x33b86a[_0x545d('0x27')]({'plain':!![]});var _0x32750a=_0x545d('0x28');return db[_0x545d('0x29')]['destroy']({'where':{'type':_0x32750a,'resourceId':_0x5a4e1d['id']}})['then'](function(){return _0x33b86a;});})[_0x545d('0x25')](function(){_0x95ced5[_0x545d('0x18')](0xcc)[_0x545d('0x19')]();});}};}function handleEntityNotFound(_0x5a091e,_0x54e8a6){return function(_0x482f2b){if(!_0x482f2b){_0x5a091e[_0x545d('0x17')](0x194);}return _0x482f2b;};}function handleError(_0x17c5c0,_0x3802b1){_0x3802b1=_0x3802b1||0x1f4;return function(_0x5bf68f){logger['error'](_0x5bf68f[_0x545d('0x2a')]);if(_0x5bf68f[_0x545d('0x2b')]){delete _0x5bf68f[_0x545d('0x2b')];}_0x17c5c0[_0x545d('0x18')](_0x3802b1)[_0x545d('0x2c')](_0x5bf68f);};}exports[_0x545d('0x2d')]=function(_0x14e88e,_0x56e628){var _0x57a38f={},_0x23b7c4={},_0x4bee55={'count':0x0,'rows':[]};var _0x137bd4=_[_0x545d('0x2e')](db[_0x545d('0x2f')][_0x545d('0x30')],function(_0x1dc0b1){return{'name':_0x1dc0b1[_0x545d('0x31')],'type':_0x1dc0b1[_0x545d('0x32')][_0x545d('0x33')]};});_0x23b7c4[_0x545d('0x34')]=_['map'](_0x137bd4,_0x545d('0x2b'));_0x23b7c4[_0x545d('0x35')]=_[_0x545d('0x36')](_0x14e88e[_0x545d('0x35')]);_0x23b7c4[_0x545d('0x37')]=_[_0x545d('0x38')](_0x23b7c4['model'],_0x23b7c4[_0x545d('0x35')]);_0x57a38f[_0x545d('0x39')]=_[_0x545d('0x38')](_0x23b7c4[_0x545d('0x34')],qs['fields'](_0x14e88e[_0x545d('0x35')][_0x545d('0x3a')]));_0x57a38f[_0x545d('0x39')]=_0x57a38f[_0x545d('0x39')]['length']?_0x57a38f[_0x545d('0x39')]:_0x23b7c4[_0x545d('0x34')];if(!_0x14e88e['query'][_0x545d('0x3b')](_0x545d('0x3c'))){_0x57a38f[_0x545d('0x1c')]=qs[_0x545d('0x1c')](_0x14e88e[_0x545d('0x35')]['limit']);_0x57a38f[_0x545d('0x1b')]=qs[_0x545d('0x1b')](_0x14e88e[_0x545d('0x35')][_0x545d('0x1b')]);}_0x57a38f['order']=qs[_0x545d('0x3d')](_0x14e88e[_0x545d('0x35')][_0x545d('0x3d')]);_0x57a38f[_0x545d('0x3e')]=qs['filters'](_[_0x545d('0x3f')](_0x14e88e[_0x545d('0x35')],_0x23b7c4[_0x545d('0x37')]),_0x137bd4);if(_0x14e88e[_0x545d('0x35')][_0x545d('0x40')]){_0x57a38f['where']=_[_0x545d('0x41')](_0x57a38f[_0x545d('0x3e')],{'$or':_['map'](_0x137bd4,function(_0x3968b5){if(_0x3968b5['type']!==_0x545d('0x42')){var _0x1ada3f={};_0x1ada3f[_0x3968b5[_0x545d('0x2b')]]={'$like':'%'+_0x14e88e[_0x545d('0x35')][_0x545d('0x40')]+'%'};return _0x1ada3f;}})});}_0x57a38f=_[_0x545d('0x41')]({},_0x57a38f,_0x14e88e[_0x545d('0x43')]);var _0x27666a={'where':_0x57a38f[_0x545d('0x3e')]};return db[_0x545d('0x2f')][_0x545d('0x1e')](_0x27666a)[_0x545d('0x25')](function(_0x325162){_0x4bee55[_0x545d('0x1e')]=_0x325162;if(_0x14e88e['query'][_0x545d('0x44')]){_0x57a38f['include']=[{'all':!![]}];}return db[_0x545d('0x2f')][_0x545d('0x45')](_0x57a38f);})['then'](function(_0x54667f){_0x4bee55[_0x545d('0x46')]=_0x54667f;return _0x4bee55;})[_0x545d('0x25')](respondWithFilteredResult(_0x56e628,_0x57a38f))[_0x545d('0x47')](handleError(_0x56e628,null));};exports['show']=function(_0x4b6c77,_0xf2dc84){var _0x5bba22={'raw':!![],'where':{'id':_0x4b6c77[_0x545d('0x48')]['id']}},_0x345070={};_0x345070['model']=_[_0x545d('0x36')](db[_0x545d('0x2f')][_0x545d('0x30')]);_0x345070[_0x545d('0x35')]=_[_0x545d('0x36')](_0x4b6c77[_0x545d('0x35')]);_0x345070[_0x545d('0x37')]=_[_0x545d('0x38')](_0x345070['model'],_0x345070[_0x545d('0x35')]);_0x5bba22[_0x545d('0x39')]=_[_0x545d('0x38')](_0x345070[_0x545d('0x34')],qs['fields'](_0x4b6c77[_0x545d('0x35')][_0x545d('0x3a')]));_0x5bba22[_0x545d('0x39')]=_0x5bba22[_0x545d('0x39')][_0x545d('0x49')]?_0x5bba22['attributes']:_0x345070['model'];if(_0x4b6c77[_0x545d('0x35')]['includeAll']){_0x5bba22[_0x545d('0x4a')]=[{'all':!![]}];}_0x5bba22=_[_0x545d('0x41')]({},_0x5bba22,_0x4b6c77['options']);return db['Interval']['find'](_0x5bba22)[_0x545d('0x25')](handleEntityNotFound(_0xf2dc84,null))[_0x545d('0x25')](respondWithResult(_0xf2dc84,null))[_0x545d('0x47')](handleError(_0xf2dc84,null));};exports['create']=function(_0xc1b84e,_0x413fec){return db[_0x545d('0x2f')][_0x545d('0x4b')](_0xc1b84e[_0x545d('0x4c')],{})[_0x545d('0x25')](function(_0x87bdbd){var _0x3f51ac=_0xc1b84e['user'][_0x545d('0x27')]({'plain':!![]});if(!_0x3f51ac)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3f51ac[_0x545d('0x4d')]===_0x545d('0x4e')){var _0x3461ef=_0x87bdbd['get']({'plain':!![]});var _0x2ebe3d=_0x545d('0x28');return db[_0x545d('0x4f')]['find']({'where':{'name':_0x2ebe3d,'userProfileId':_0x3f51ac['userProfileId']},'raw':!![]})['then'](function(_0x46a947){if(_0x46a947&&_0x46a947[_0x545d('0x50')]===0x0){return db[_0x545d('0x29')]['create']({'name':_0x3461ef[_0x545d('0x2b')],'resourceId':_0x3461ef['id'],'type':_0x46a947[_0x545d('0x2b')],'sectionId':_0x46a947['id']},{})[_0x545d('0x25')](function(){return _0x87bdbd;});}else{return _0x87bdbd;}})[_0x545d('0x47')](function(_0x1dc065){logger[_0x545d('0x51')](_0x545d('0x52'),_0x1dc065);throw _0x1dc065;});}return _0x87bdbd;})['then'](respondWithResult(_0x413fec,0xc9))['catch'](handleError(_0x413fec,null));};exports[_0x545d('0x24')]=function(_0x454bdb,_0xdccc2d){if(_0x454bdb[_0x545d('0x4c')]['id']){delete _0x454bdb[_0x545d('0x4c')]['id'];}return db[_0x545d('0x2f')][_0x545d('0x53')]({'where':{'id':_0x454bdb[_0x545d('0x48')]['id']}})['then'](handleEntityNotFound(_0xdccc2d,null))[_0x545d('0x25')](saveUpdates(_0x454bdb['body'],null))[_0x545d('0x25')](respondWithResult(_0xdccc2d,null))[_0x545d('0x47')](handleError(_0xdccc2d,null));};exports[_0x545d('0x26')]=function(_0xf6448c,_0x184df1){return db[_0x545d('0x2f')][_0x545d('0x53')]({'where':{'id':_0xf6448c['params']['id']}})[_0x545d('0x25')](handleEntityNotFound(_0x184df1,null))[_0x545d('0x25')](removeEntity(_0x184df1,null))[_0x545d('0x47')](handleError(_0x184df1,null));};exports[_0x545d('0x54')]=function(_0x52f103,_0x4614eb,_0x11f3a7){if(_0x52f103[_0x545d('0x4c')]['id']){delete _0x52f103[_0x545d('0x4c')]['id'];}return db['Interval'][_0x545d('0x53')]({'where':{'id':_0x52f103[_0x545d('0x48')]['id']}})['then'](handleEntityNotFound(_0x4614eb,null))['then'](function(_0x52a3c8){if(_0x52a3c8){_0x52f103[_0x545d('0x4c')][_0x545d('0x55')]=_0x52a3c8['id'];return db[_0x545d('0x2f')]['create'](_0x52f103['body']);}})[_0x545d('0x25')](respondWithResult(_0x4614eb,null))[_0x545d('0x47')](handleError(_0x4614eb,null));};exports[_0x545d('0x56')]=function(_0x4f3d79,_0x406a1d,_0x4bf26c){var _0x4b7fc1={};var _0x206978={};var _0x4e9c55;var _0x3582ae;return db[_0x545d('0x2f')]['findOne']({'where':{'id':_0x4f3d79[_0x545d('0x48')]['id']}})['then'](handleEntityNotFound(_0x406a1d,null))[_0x545d('0x25')](function(_0x12ae5c){if(_0x12ae5c){_0x4e9c55=_0x12ae5c;_0x206978[_0x545d('0x34')]=_[_0x545d('0x36')](db[_0x545d('0x2f')]['rawAttributes']);_0x206978[_0x545d('0x35')]=_[_0x545d('0x36')](_0x4f3d79[_0x545d('0x35')]);_0x206978[_0x545d('0x37')]=_['intersection'](_0x206978['model'],_0x206978[_0x545d('0x35')]);_0x4b7fc1[_0x545d('0x39')]=_[_0x545d('0x38')](_0x206978['model'],qs[_0x545d('0x3a')](_0x4f3d79[_0x545d('0x35')]['fields']));_0x4b7fc1[_0x545d('0x39')]=_0x4b7fc1['attributes']['length']?_0x4b7fc1['attributes']:_0x206978[_0x545d('0x34')];_0x4b7fc1['order']=qs['sort'](_0x4f3d79[_0x545d('0x35')][_0x545d('0x3d')]);_0x4b7fc1[_0x545d('0x3e')]=qs[_0x545d('0x37')](_['pick'](_0x4f3d79[_0x545d('0x35')],_0x206978[_0x545d('0x37')]));if(_0x4f3d79['query']['filter']){_0x4b7fc1[_0x545d('0x3e')]=_[_0x545d('0x41')](_0x4b7fc1['where'],{'$or':_[_0x545d('0x2e')](_0x4b7fc1['attributes'],function(_0x226086){var _0xcaa0c1={};_0xcaa0c1[_0x226086]={'$like':'%'+_0x4f3d79[_0x545d('0x35')]['filter']+'%'};return _0xcaa0c1;})});}_0x4b7fc1=_[_0x545d('0x41')]({},_0x4b7fc1,_0x4f3d79['options']);return _0x4e9c55[_0x545d('0x56')](_0x4b7fc1);}})[_0x545d('0x25')](function(_0x58d0ec){if(_0x58d0ec){_0x3582ae=_0x58d0ec['length'];if(!_0x4f3d79[_0x545d('0x35')]['hasOwnProperty']('nolimit')){_0x4b7fc1[_0x545d('0x1c')]=qs[_0x545d('0x1c')](_0x4f3d79[_0x545d('0x35')][_0x545d('0x1c')]);_0x4b7fc1['offset']=qs[_0x545d('0x1b')](_0x4f3d79[_0x545d('0x35')][_0x545d('0x1b')]);}return _0x4e9c55[_0x545d('0x56')](_0x4b7fc1);}})[_0x545d('0x25')](function(_0xbbf2cf){if(_0xbbf2cf){return _0xbbf2cf?{'count':_0x3582ae,'rows':_0xbbf2cf}:null;}})['then'](respondWithResult(_0x406a1d,null))[_0x545d('0x47')](handleError(_0x406a1d,null));};exports[_0x545d('0x57')]=function(_0x3c868e,_0x4e54ab,_0xfe8cef){return db[_0x545d('0x2f')][_0x545d('0x58')]({'where':{'id':_0x3c868e['params']['id']}})[_0x545d('0x25')](handleEntityNotFound(_0x4e54ab,null))['then'](function(_0x49a8e9){if(_0x49a8e9){return db[_0x545d('0x59')][_0x545d('0x5a')](function(_0x2d22ae){return db[_0x545d('0x2f')]['destroy']({'where':{'IntervalId':_0x3c868e[_0x545d('0x48')]['id']},'transaction':_0x2d22ae})[_0x545d('0x25')](function(_0x5a38cf){var _0x3e9bc5=_[_0x545d('0x2e')](_0x3c868e[_0x545d('0x4c')],function(_0x314739){delete _0x314739['id'];_0x314739[_0x545d('0x55')]=_0x3c868e[_0x545d('0x48')]['id'];return _0x314739;});return db['Interval'][_0x545d('0x5b')](_0x3e9bc5,{'transaction':_0x2d22ae});});})[_0x545d('0x25')](function(){return db['Interval']['findAll']({'where':{'IntervalId':_0x3c868e[_0x545d('0x48')]['id']}});});}})['then'](respondWithResult(_0x4e54ab,null))[_0x545d('0x47')](handleError(_0x4e54ab,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 44e9230..aa9290b 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 _0x13ea=['define','Interval','tools_intervals','rewrite','string','then','all','map','ifTime','reduce','../../components/extensions/rewrite','../../utils/iftime','iftime','exports'];(function(_0x130899,_0x47bc29){var _0x253db1=function(_0x248011){while(--_0x248011){_0x130899['push'](_0x130899['shift']());}};_0x253db1(++_0x47bc29);}(_0x13ea,0x88));var _0xa13e=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x13ea[_0x565c49];return _0x20ca34;};'use strict';var attributes=require('./interval.attributes');var extensions=require(_0xa13e('0x0'));var iftime=require(_0xa13e('0x1'))[_0xa13e('0x2')];module[_0xa13e('0x3')]=function(_0x1b5fc6){return _0x1b5fc6[_0xa13e('0x4')](_0xa13e('0x5'),attributes,{'tableName':_0xa13e('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3a20e2){extensions[_0xa13e('0x7')](_0x1b5fc6,_0x3a20e2);},'afterBulkCreate':function(_0x249cee,_0x22889f,_0x56dd49){_0x56dd49();extensions[_0xa13e('0x7')](_0x1b5fc6,_0x249cee[0x0]);},'afterUpdate':function(_0x31a33e){extensions[_0xa13e('0x7')](_0x1b5fc6,_0x31a33e);},'afterDestroy':function(_0x2e5bba){extensions[_0xa13e('0x7')](_0x1b5fc6,_0x2e5bba);}},'instanceMethods':{'ifTime':function(_0x1b396e=undefined,_0x32a0af=new Date()){if(typeof this['interval']===_0xa13e('0x8')){return iftime(this['interval'],_0x1b396e,_0x32a0af);}else{return this['getIntervals']()[_0xa13e('0x9')](function(_0x1ec645){return Promise[_0xa13e('0xa')](_0x1ec645[_0xa13e('0xb')](function(_0x1b2533){return _0x1b2533[_0xa13e('0xc')](_0x1b396e,_0x32a0af);}));})[_0xa13e('0x9')](function(_0xcee063){return _0xcee063[_0xa13e('0xd')](function(_0x561158,_0x19832b){return _0x561158||_0x19832b;},![]);});}}}});}; \ No newline at end of file +var _0x03cb=['./interval.attributes','../../components/extensions/rewrite','iftime','exports','tools_intervals','rewrite','interval','string','getIntervals','then','reduce'];(function(_0x1f9b23,_0x4fec1f){var _0x39a610=function(_0x3aaaa9){while(--_0x3aaaa9){_0x1f9b23['push'](_0x1f9b23['shift']());}};_0x39a610(++_0x4fec1f);}(_0x03cb,0xf2));var _0xb03c=function(_0x20a887,_0x3570f2){_0x20a887=_0x20a887-0x0;var _0x34217e=_0x03cb[_0x20a887];return _0x34217e;};'use strict';var attributes=require(_0xb03c('0x0'));var extensions=require(_0xb03c('0x1'));var iftime=require('../../utils/iftime')[_0xb03c('0x2')];module[_0xb03c('0x3')]=function(_0x58c30d){return _0x58c30d['define']('Interval',attributes,{'tableName':_0xb03c('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xb3787e){extensions['rewrite'](_0x58c30d,_0xb3787e);},'afterBulkCreate':function(_0x308346,_0x36b237,_0x268cdf){_0x268cdf();extensions[_0xb03c('0x5')](_0x58c30d,_0x308346[0x0]);},'afterUpdate':function(_0x7cb552){extensions['rewrite'](_0x58c30d,_0x7cb552);},'afterDestroy':function(_0x49adbf){extensions[_0xb03c('0x5')](_0x58c30d,_0x49adbf);}},'instanceMethods':{'ifTime':function(_0x155d40=undefined,_0x2475ca=new Date()){if(typeof this[_0xb03c('0x6')]===_0xb03c('0x7')){return iftime(this['interval'],_0x155d40,_0x2475ca);}else{return this[_0xb03c('0x8')]()[_0xb03c('0x9')](function(_0x581508){return Promise['all'](_0x581508['map'](function(_0x40e346){return _0x40e346['ifTime'](_0x155d40,_0x2475ca);}));})['then'](function(_0x46f370){return _0x46f370[_0xb03c('0xa')](function(_0x49353d,_0x52a03f){return _0x49353d||_0x52a03f;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index 5347e01..1907dd1 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 _0x31b7=['length','Iftime','silly','IntervalIftime','lodash','../../utils/iftime','iftime','../../config/logger','rpc','Interval','findAll','options','raw','where','limit','map','include','model','attributes','then','GetInterval','debug','stringify','message','error','info','ShowInterval','catch','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','name','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','intervalIds','isArray','intervals','string','timezone'];(function(_0x147e24,_0x5a5716){var _0x585211=function(_0x5031f9){while(--_0x5031f9){_0x147e24['push'](_0x147e24['shift']());}};_0x585211(++_0x5a5716);}(_0x31b7,0xa8));var _0x731b=function(_0xd39a12,_0x52711b){_0xd39a12=_0xd39a12-0x0;var _0x19b6d2=_0x31b7[_0xd39a12];return _0x19b6d2;};'use strict';var _=require(_0x731b('0x0'));var util=require('util');var db=require('../../mysqldb')['db'];var iftime=require(_0x731b('0x1'))[_0x731b('0x2')];var logger=require(_0x731b('0x3'))(_0x731b('0x4'));exports['GetInterval']=function(_0x571be3){var _0x6e304b=this;return new Promise(function(_0x457cdf,_0x1d8873){return db[_0x731b('0x5')][_0x731b('0x6')]({'raw':_0x571be3['options']?_0x571be3[_0x731b('0x7')][_0x731b('0x8')]===undefined?!![]:![]:!![],'where':_0x571be3['options']?_0x571be3[_0x731b('0x7')][_0x731b('0x9')]||null:null,'attributes':_0x571be3['options']?_0x571be3[_0x731b('0x7')]['attributes']||null:null,'limit':_0x571be3[_0x731b('0x7')]?_0x571be3[_0x731b('0x7')][_0x731b('0xa')]||null:null,'include':_0x571be3[_0x731b('0x7')]?_0x571be3[_0x731b('0x7')]['include']?_['map'](_0x571be3['options']['include'],function(_0x14af39){return{'model':db[_0x14af39['model']],'as':_0x14af39['as'],'attributes':_0x14af39['attributes'],'include':_0x14af39['include']?_[_0x731b('0xb')](_0x14af39[_0x731b('0xc')],function(_0x5e6028){return{'model':db[_0x5e6028[_0x731b('0xd')]],'as':_0x5e6028['as'],'attributes':_0x5e6028[_0x731b('0xe')],'include':_0x5e6028['include']?_[_0x731b('0xb')](_0x5e6028[_0x731b('0xc')],function(_0x568a13){return{'model':db[_0x568a13[_0x731b('0xd')]],'as':_0x568a13['as'],'attributes':_0x568a13[_0x731b('0xe')]};}):[]};}):[]};}):[]:[]})[_0x731b('0xf')](function(_0x5b5967){logger['info'](_0x731b('0x10'),_0x571be3);logger[_0x731b('0x11')](_0x731b('0x10'),_0x571be3,JSON[_0x731b('0x12')](_0x5b5967));_0x457cdf(_0x5b5967);})['catch'](function(_0x50b925){logger['error']('GetInterval',_0x50b925[_0x731b('0x13')],_0x571be3);_0x1d8873(_0x6e304b[_0x731b('0x14')](0x1f4,_0x50b925['message']));});});};exports['ShowInterval']=function(_0x596b49){var _0x31e9ab=this;return new Promise(function(_0x42ec23,_0x4bc2f1){return db[_0x731b('0x5')]['find']({'raw':_0x596b49['options']?_0x596b49['options'][_0x731b('0x8')]===undefined?!![]:![]:!![],'where':_0x596b49['options']?_0x596b49[_0x731b('0x7')][_0x731b('0x9')]||null:null,'attributes':_0x596b49[_0x731b('0x7')]?_0x596b49[_0x731b('0x7')][_0x731b('0xe')]||null:null,'include':_0x596b49[_0x731b('0x7')]?_0x596b49[_0x731b('0x7')][_0x731b('0xc')]?_[_0x731b('0xb')](_0x596b49['options'][_0x731b('0xc')],function(_0x452c71){return{'model':db[_0x452c71['model']],'as':_0x452c71['as'],'attributes':_0x452c71['attributes'],'include':_0x452c71[_0x731b('0xc')]?_[_0x731b('0xb')](_0x452c71['include'],function(_0x2bf1f8){return{'model':db[_0x2bf1f8[_0x731b('0xd')]],'as':_0x2bf1f8['as'],'attributes':_0x2bf1f8[_0x731b('0xe')],'include':_0x2bf1f8[_0x731b('0xc')]?_[_0x731b('0xb')](_0x2bf1f8['include'],function(_0x3419a0){return{'model':db[_0x3419a0['model']],'as':_0x3419a0['as'],'attributes':_0x3419a0[_0x731b('0xe')]};}):[]};}):[]};}):[]:[]})[_0x731b('0xf')](function(_0xf2fe9a){logger[_0x731b('0x15')](_0x731b('0x16'),_0x596b49);logger['debug']('ShowInterval',_0x596b49,JSON[_0x731b('0x12')](_0xf2fe9a));_0x42ec23(_0xf2fe9a);})[_0x731b('0x17')](function(_0x325d6f){logger[_0x731b('0x14')](_0x731b('0x16'),_0x325d6f['message'],_0x596b49);_0x4bc2f1(_0x31e9ab[_0x731b('0x14')](0x1f4,_0x325d6f[_0x731b('0x13')]));});});};function checkArrayOfIntervals(_0x57ff2b,_0x3ec556){var _0x4795ea=[];return db[_0x731b('0x5')][_0x731b('0x6')]({'where':{'id':_0x57ff2b}})[_0x731b('0xf')](function(_0x36ac25){_0x4795ea=_0x36ac25;return Promise['all'](_0x4795ea[_0x731b('0xb')](function(_0x4304c9){return _0x4304c9['ifTime'](_0x3ec556);}));})[_0x731b('0xf')](function(_0x1e7e87){var _0x1610fb=_0x1e7e87[_0x731b('0x18')](function(_0x79c91,_0x1c0a1c){return _0x79c91||_0x1c0a1c;},![]);logger[_0x731b('0x15')](util['format'](_0x731b('0x19'),_0x4795ea['map'](function(_0x826243){return _0x826243[_0x731b('0x1a')];})[_0x731b('0x1b')](',\x20'),_0x4795ea[_0x731b('0xb')](function(_0x190a42){return _0x190a42['id'];})[_0x731b('0x1b')](',\x20')));return _0x1610fb;});}function checkSingleInterval(_0x4f1c35,_0x2a595b){return db[_0x731b('0x5')][_0x731b('0x1c')](_0x4f1c35)[_0x731b('0xf')](function(_0x19d404){if(_0x19d404){logger[_0x731b('0x15')](util[_0x731b('0x1d')](_0x731b('0x1e'),_0x19d404[_0x731b('0x1a')],_0x19d404['id']));return _0x19d404[_0x731b('0x1f')](_0x2a595b);}});}exports['IntervalIftime']=function(_0xf01398){var _0x375c19=_0xf01398[_0x731b('0x20')];var _0x5c7147=Array[_0x731b('0x21')](_0xf01398['intervals'])?_0xf01398['intervals']:typeof _0xf01398[_0x731b('0x22')]===_0x731b('0x23')?[_0xf01398[_0x731b('0x22')]]:[];var _0x41bcae=_0xf01398[_0x731b('0x24')]||undefined;var _0x3d6445=![];if(_0x5c7147[_0x731b('0x25')]){logger[_0x731b('0x15')](util[_0x731b('0x1d')]('IntervalIftime:\x20interval\x20strings\x20=\x20%s',_0x5c7147[_0x731b('0x1b')](';\x20')));}if(_0x41bcae){logger[_0x731b('0x15')](util[_0x731b('0x1d')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x41bcae));}logger['debug'](_0x731b('0x26'),_0x3d6445);logger[_0x731b('0x27')](_0x731b('0x28'),_0xf01398);return Promise['resolve']()[_0x731b('0xf')](function(){if(Array[_0x731b('0x21')](_0x375c19)){return checkArrayOfIntervals(_0x375c19,_0x41bcae);}else if(_0x375c19){return checkSingleInterval(_0x375c19,_0x41bcae);}})[_0x731b('0xf')](function(_0x443ccc){var _0x3f78c9=_0x5c7147['reduce'](function(_0x4c773f,_0x1a56f2){return _0x4c773f||iftime(_0x1a56f2,_0x41bcae);},![]);_0x3d6445=_0x443ccc||_0x3f78c9;return _0x3d6445;})[_0x731b('0x17')](function(_0x10cbc5){logger[_0x731b('0x14')](_0x731b('0x28'),_0xf01398,_0x10cbc5);throw this[_0x731b('0x14')](0x1f4,_0x10cbc5['message']);});}; \ No newline at end of file +var _0x2911=['all','reduce','name','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','ifTime','IntervalIftime','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','Iftime','util','../../mysqldb','../../utils/iftime','iftime','rpc','GetInterval','findAll','options','raw','where','attributes','limit','map','include','model','then','info','error','message','ShowInterval','Interval','find','debug','stringify','catch'];(function(_0x766a5d,_0xb9ef6b){var _0x3f1568=function(_0x4d466a){while(--_0x4d466a){_0x766a5d['push'](_0x766a5d['shift']());}};_0x3f1568(++_0xb9ef6b);}(_0x2911,0x1e2));var _0x1291=function(_0x272cb2,_0x40f4b4){_0x272cb2=_0x272cb2-0x0;var _0x4f4acb=_0x2911[_0x272cb2];return _0x4f4acb;};'use strict';var _=require('lodash');var util=require(_0x1291('0x0'));var db=require(_0x1291('0x1'))['db'];var iftime=require(_0x1291('0x2'))[_0x1291('0x3')];var logger=require('../../config/logger')(_0x1291('0x4'));exports[_0x1291('0x5')]=function(_0x378d01){var _0x3b45d1=this;return new Promise(function(_0x32a669,_0x8641cc){return db['Interval'][_0x1291('0x6')]({'raw':_0x378d01[_0x1291('0x7')]?_0x378d01[_0x1291('0x7')][_0x1291('0x8')]===undefined?!![]:![]:!![],'where':_0x378d01[_0x1291('0x7')]?_0x378d01[_0x1291('0x7')][_0x1291('0x9')]||null:null,'attributes':_0x378d01[_0x1291('0x7')]?_0x378d01[_0x1291('0x7')][_0x1291('0xa')]||null:null,'limit':_0x378d01[_0x1291('0x7')]?_0x378d01[_0x1291('0x7')][_0x1291('0xb')]||null:null,'include':_0x378d01[_0x1291('0x7')]?_0x378d01[_0x1291('0x7')]['include']?_[_0x1291('0xc')](_0x378d01[_0x1291('0x7')][_0x1291('0xd')],function(_0x55aaa9){return{'model':db[_0x55aaa9[_0x1291('0xe')]],'as':_0x55aaa9['as'],'attributes':_0x55aaa9[_0x1291('0xa')],'include':_0x55aaa9[_0x1291('0xd')]?_[_0x1291('0xc')](_0x55aaa9[_0x1291('0xd')],function(_0x17d43d){return{'model':db[_0x17d43d[_0x1291('0xe')]],'as':_0x17d43d['as'],'attributes':_0x17d43d[_0x1291('0xa')],'include':_0x17d43d[_0x1291('0xd')]?_['map'](_0x17d43d[_0x1291('0xd')],function(_0x365001){return{'model':db[_0x365001[_0x1291('0xe')]],'as':_0x365001['as'],'attributes':_0x365001[_0x1291('0xa')]};}):[]};}):[]};}):[]:[]})[_0x1291('0xf')](function(_0x768d2e){logger[_0x1291('0x10')](_0x1291('0x5'),_0x378d01);logger['debug'](_0x1291('0x5'),_0x378d01,JSON['stringify'](_0x768d2e));_0x32a669(_0x768d2e);})['catch'](function(_0x15da41){logger[_0x1291('0x11')](_0x1291('0x5'),_0x15da41[_0x1291('0x12')],_0x378d01);_0x8641cc(_0x3b45d1[_0x1291('0x11')](0x1f4,_0x15da41[_0x1291('0x12')]));});});};exports[_0x1291('0x13')]=function(_0x25b66b){var _0x3c061f=this;return new Promise(function(_0x2833b9,_0x36b46a){return db[_0x1291('0x14')][_0x1291('0x15')]({'raw':_0x25b66b['options']?_0x25b66b['options'][_0x1291('0x8')]===undefined?!![]:![]:!![],'where':_0x25b66b[_0x1291('0x7')]?_0x25b66b[_0x1291('0x7')]['where']||null:null,'attributes':_0x25b66b[_0x1291('0x7')]?_0x25b66b[_0x1291('0x7')]['attributes']||null:null,'include':_0x25b66b[_0x1291('0x7')]?_0x25b66b[_0x1291('0x7')]['include']?_[_0x1291('0xc')](_0x25b66b['options']['include'],function(_0x305e61){return{'model':db[_0x305e61[_0x1291('0xe')]],'as':_0x305e61['as'],'attributes':_0x305e61['attributes'],'include':_0x305e61[_0x1291('0xd')]?_['map'](_0x305e61[_0x1291('0xd')],function(_0x198785){return{'model':db[_0x198785[_0x1291('0xe')]],'as':_0x198785['as'],'attributes':_0x198785[_0x1291('0xa')],'include':_0x198785[_0x1291('0xd')]?_[_0x1291('0xc')](_0x198785[_0x1291('0xd')],function(_0x344461){return{'model':db[_0x344461['model']],'as':_0x344461['as'],'attributes':_0x344461[_0x1291('0xa')]};}):[]};}):[]};}):[]:[]})[_0x1291('0xf')](function(_0x2b0839){logger[_0x1291('0x10')](_0x1291('0x13'),_0x25b66b);logger[_0x1291('0x16')]('ShowInterval',_0x25b66b,JSON[_0x1291('0x17')](_0x2b0839));_0x2833b9(_0x2b0839);})[_0x1291('0x18')](function(_0x1606a1){logger['error'](_0x1291('0x13'),_0x1606a1[_0x1291('0x12')],_0x25b66b);_0x36b46a(_0x3c061f[_0x1291('0x11')](0x1f4,_0x1606a1[_0x1291('0x12')]));});});};function checkArrayOfIntervals(_0x1946b1,_0x958e36){var _0x3ad43f=[];return db[_0x1291('0x14')]['findAll']({'where':{'id':_0x1946b1}})[_0x1291('0xf')](function(_0x41f17c){_0x3ad43f=_0x41f17c;return Promise[_0x1291('0x19')](_0x3ad43f['map'](function(_0x5570ed){return _0x5570ed['ifTime'](_0x958e36);}));})[_0x1291('0xf')](function(_0x1c3afc){var _0x2e47f1=_0x1c3afc[_0x1291('0x1a')](function(_0x1b8425,_0x5b9ce9){return _0x1b8425||_0x5b9ce9;},![]);logger['info'](util['format']('IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)',_0x3ad43f[_0x1291('0xc')](function(_0x3cade4){return _0x3cade4[_0x1291('0x1b')];})[_0x1291('0x1c')](',\x20'),_0x3ad43f['map'](function(_0xa10813){return _0xa10813['id'];})[_0x1291('0x1c')](',\x20')));return _0x2e47f1;});}function checkSingleInterval(_0x4396ea,_0x5dd840){return db['Interval'][_0x1291('0x1d')](_0x4396ea)[_0x1291('0xf')](function(_0x37c821){if(_0x37c821){logger['info'](util[_0x1291('0x1e')](_0x1291('0x1f'),_0x37c821['name'],_0x37c821['id']));return _0x37c821[_0x1291('0x20')](_0x5dd840);}});}exports[_0x1291('0x21')]=function(_0x519b85){var _0x340a62=_0x519b85['intervalIds'];var _0x1def6b=Array['isArray'](_0x519b85[_0x1291('0x22')])?_0x519b85['intervals']:typeof _0x519b85[_0x1291('0x22')]===_0x1291('0x23')?[_0x519b85[_0x1291('0x22')]]:[];var _0x553448=_0x519b85['timezone']||undefined;var _0x3cb47e=![];if(_0x1def6b[_0x1291('0x24')]){logger[_0x1291('0x10')](util['format'](_0x1291('0x25'),_0x1def6b[_0x1291('0x1c')](';\x20')));}if(_0x553448){logger[_0x1291('0x10')](util[_0x1291('0x1e')]('IntervalIftime:\x20timezone\x20=\x20%s',_0x553448));}logger[_0x1291('0x16')](_0x1291('0x26'),_0x3cb47e);logger['silly'](_0x1291('0x21'),_0x519b85);return Promise['resolve']()[_0x1291('0xf')](function(){if(Array['isArray'](_0x340a62)){return checkArrayOfIntervals(_0x340a62,_0x553448);}else if(_0x340a62){return checkSingleInterval(_0x340a62,_0x553448);}})['then'](function(_0x5260b3){var _0x167dbe=_0x1def6b[_0x1291('0x1a')](function(_0x39da17,_0x772f75){return _0x39da17||iftime(_0x772f75,_0x553448);},![]);_0x3cb47e=_0x5260b3||_0x167dbe;return _0x3cb47e;})['catch'](function(_0x232da8){logger[_0x1291('0x11')]('IntervalIftime',_0x519b85,_0x232da8);throw this[_0x1291('0x11')](0x1f4,_0x232da8[_0x1291('0x12')]);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 8643de6..6fa2df5 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 _0xadb5=['post','isAuthenticated','exports','Router','./jira.controller'];(function(_0x48fe4b,_0x294a8c){var _0x49048b=function(_0x4134fe){while(--_0x4134fe){_0x48fe4b['push'](_0x48fe4b['shift']());}};_0x49048b(++_0x294a8c);}(_0xadb5,0xad));var _0x5adb=function(_0x4d378a,_0x17fb02){_0x4d378a=_0x4d378a-0x0;var _0x5e83a2=_0xadb5[_0x4d378a];return _0x5e83a2;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['send']);module[_0x5adb('0x4')]=router; \ No newline at end of file +var _0x0b0e=['exports','express','../../components/auth/service','post','isAuthenticated','send'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x9a29ea,_0x5b8b29){_0x9a29ea=_0x9a29ea-0x0;var _0x11f261=_0x0b0e[_0x9a29ea];return _0x11f261;};'use strict';var express=require(_0xe0b0('0x0'));var router=express['Router']();var auth=require(_0xe0b0('0x1'));var controller=require('./jira.controller');router[_0xe0b0('0x2')]('/',auth[_0xe0b0('0x3')](),controller[_0xe0b0('0x4')]);module[_0xe0b0('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index fb67aff..2617ece 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 _0x8c42=['api.jira','write','end','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','3eAmWpBVP0','MOTGUI','summary','\x20from\x20','issuetype','customfield_11500','email','fields','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','application/json','Basic\x20','base64','request','utf8','status','statusCode','json','parse','error'];(function(_0xe6ae34,_0x234589){var _0x4c5f04=function(_0x29bd0d){while(--_0x29bd0d){_0xe6ae34['push'](_0xe6ae34['shift']());}};_0x4c5f04(++_0x234589);}(_0x8c42,0x19b));var _0x28c4=function(_0x3f2a90,_0x50baf1){_0x3f2a90=_0x3f2a90-0x0;var _0xb46279=_0x8c42[_0x3f2a90];return _0xb46279;};'use strict';var BPromise=require(_0x28c4('0x0'));var https=require(_0x28c4('0x1'));var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD=_0x28c4('0x2');function openIssue(_0x53763e,_0x411c68){var _0x3b2f60={'fields':{'project':{'key':_0x53763e['key']||_0x28c4('0x3')},'summary':(_0x53763e[_0x28c4('0x4')]||'Report')+_0x28c4('0x5')+_0x53763e['ip'],'description':_0x53763e['description']||JSON['stringify'](_0x53763e),'issuetype':{'name':_0x53763e[_0x28c4('0x6')]||'Bug'}}};_0x3b2f60['fields'][_0x28c4('0x7')]=_0x53763e[_0x28c4('0x8')];_0x3b2f60[_0x28c4('0x9')]['customfield_11501']=_0x53763e['oldToken'];_0x3b2f60[_0x28c4('0x9')][_0x28c4('0xa')]=_0x53763e[_0x28c4('0xb')];_0x3b2f60[_0x28c4('0x9')][_0x28c4('0xc')]=_0x53763e[_0x28c4('0xd')];_0x3b2f60[_0x28c4('0x9')][_0x28c4('0xe')]=_0x53763e[_0x28c4('0xf')];_0x3b2f60[_0x28c4('0x9')][_0x28c4('0x10')]=_0x53763e['ip'];var _0x3b9d5d={'host':_0x28c4('0x11'),'port':0x1bb,'path':_0x28c4('0x12'),'method':'POST','timeout':0x4e20,'headers':{'Content-Type':_0x28c4('0x13'),'Authorization':_0x28c4('0x14')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0x28c4('0x15'))}};var _0x67e29a=JSON['stringify'](_0x3b2f60);var _0x38cb75=https[_0x28c4('0x16')](_0x3b9d5d,function(_0x5da94){_0x5da94['setEncoding'](_0x28c4('0x17'));var _0x95e364='';_0x5da94['on']('data',function(_0x34e394){_0x95e364+=_0x34e394;});_0x5da94['on']('end',function(){if(_0x411c68){return _0x411c68[_0x28c4('0x18')](_0x5da94[_0x28c4('0x19')])[_0x28c4('0x1a')](JSON[_0x28c4('0x1b')](_0x95e364));}});});_0x38cb75['on'](_0x28c4('0x1c'),function(_0x5f21ce){if(_0x411c68){return _0x411c68[_0x28c4('0x18')](0x1f4)[_0x28c4('0x1a')]({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':_0x28c4('0x1d')}]});}});_0x38cb75[_0x28c4('0x1e')](_0x67e29a);_0x38cb75[_0x28c4('0x1f')]();}exports[_0x28c4('0x20')]=openIssue;exports[_0x28c4('0x21')]=function(_0x42dc0d,_0x3d4551){_0x42dc0d[_0x28c4('0x22')]['ip']=_0x42dc0d[_0x28c4('0x23')][_0x28c4('0x24')]||_0x42dc0d[_0x28c4('0x25')][_0x28c4('0x26')]||_0x42dc0d[_0x28c4('0x27')][_0x28c4('0x26')]||_0x42dc0d[_0x28c4('0x25')]['socket'][_0x28c4('0x26')];return openIssue(_0x42dc0d[_0x28c4('0x22')],_0x3d4551);}; \ No newline at end of file +var _0xfcd8=['../../config/logger','api','support','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','Bug','fields','customfield_11500','email','customfield_11501','customfield_11502','newToken','name','customfield_11504','reason','customfield_10102','/rest/api/2/issue','POST','Basic\x20','request','utf8','data','status','statusCode','json','error','write','end','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','bluebird','https'];(function(_0x346737,_0x3e6081){var _0x1ade2e=function(_0x15e50e){while(--_0x15e50e){_0x346737['push'](_0x346737['shift']());}};_0x1ade2e(++_0x3e6081);}(_0xfcd8,0x156));var _0x8fcd=function(_0x271c67,_0x999308){_0x271c67=_0x271c67-0x0;var _0x127789=_0xfcd8[_0x271c67];return _0x127789;};'use strict';var BPromise=require(_0x8fcd('0x0'));var https=require(_0x8fcd('0x1'));var logger=require(_0x8fcd('0x2'))(_0x8fcd('0x3'));var USERNAME=_0x8fcd('0x4');var PASSWORD=_0x8fcd('0x5');function openIssue(_0xf22c99,_0x2bd653){var _0x14f263={'fields':{'project':{'key':_0xf22c99[_0x8fcd('0x6')]||_0x8fcd('0x7')},'summary':(_0xf22c99[_0x8fcd('0x8')]||_0x8fcd('0x9'))+'\x20from\x20'+_0xf22c99['ip'],'description':_0xf22c99[_0x8fcd('0xa')]||JSON[_0x8fcd('0xb')](_0xf22c99),'issuetype':{'name':_0xf22c99['issuetype']||_0x8fcd('0xc')}}};_0x14f263[_0x8fcd('0xd')][_0x8fcd('0xe')]=_0xf22c99[_0x8fcd('0xf')];_0x14f263[_0x8fcd('0xd')][_0x8fcd('0x10')]=_0xf22c99['oldToken'];_0x14f263[_0x8fcd('0xd')][_0x8fcd('0x11')]=_0xf22c99[_0x8fcd('0x12')];_0x14f263[_0x8fcd('0xd')]['customfield_11503']=_0xf22c99[_0x8fcd('0x13')];_0x14f263[_0x8fcd('0xd')][_0x8fcd('0x14')]=_0xf22c99[_0x8fcd('0x15')];_0x14f263[_0x8fcd('0xd')][_0x8fcd('0x16')]=_0xf22c99['ip'];var _0x219baf={'host':'track.xcallymotion.com','port':0x1bb,'path':_0x8fcd('0x17'),'method':_0x8fcd('0x18'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x8fcd('0x19')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x436d9d=JSON[_0x8fcd('0xb')](_0x14f263);var _0x344138=https[_0x8fcd('0x1a')](_0x219baf,function(_0x1c648d){_0x1c648d['setEncoding'](_0x8fcd('0x1b'));var _0x19b4dc='';_0x1c648d['on'](_0x8fcd('0x1c'),function(_0x5ed0df){_0x19b4dc+=_0x5ed0df;});_0x1c648d['on']('end',function(){if(_0x2bd653){return _0x2bd653[_0x8fcd('0x1d')](_0x1c648d[_0x8fcd('0x1e')])[_0x8fcd('0x1f')](JSON['parse'](_0x19b4dc));}});});_0x344138['on'](_0x8fcd('0x20'),function(_0x403894){if(_0x2bd653){return _0x2bd653['status'](0x1f4)['json']({'errors':[{'message':'Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','type':'api.jira'}]});}});_0x344138[_0x8fcd('0x21')](_0x436d9d);_0x344138[_0x8fcd('0x22')]();}exports[_0x8fcd('0x23')]=openIssue;exports[_0x8fcd('0x24')]=function(_0x3edf0d,_0x5a2276){_0x3edf0d[_0x8fcd('0x25')]['ip']=_0x3edf0d[_0x8fcd('0x26')][_0x8fcd('0x27')]||_0x3edf0d[_0x8fcd('0x28')][_0x8fcd('0x29')]||_0x3edf0d[_0x8fcd('0x2a')][_0x8fcd('0x29')]||_0x3edf0d['connection'][_0x8fcd('0x2a')][_0x8fcd('0x29')];return openIssue(_0x3edf0d[_0x8fcd('0x25')],_0x5a2276);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index c89e9a6..bdaba99 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 _0x6f7a=['isAuthenticated','index','/describe','/:id','show','post','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get'];(function(_0x320019,_0x18352c){var _0x5e36ea=function(_0x559611){while(--_0x559611){_0x320019['push'](_0x320019['shift']());}};_0x5e36ea(++_0x18352c);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x93f659,_0x16aaac){_0x93f659=_0x93f659-0x0;var _0x4e5a07=_0x6f7a[_0x93f659];return _0x4e5a07;};'use strict';var multer=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var path=require(_0xa6f7('0x2'));var timeout=require(_0xa6f7('0x3'));var express=require('express');var router=express[_0xa6f7('0x4')]();var fs_extra=require(_0xa6f7('0x5'));var auth=require(_0xa6f7('0x6'));var interaction=require(_0xa6f7('0x7'));var config=require(_0xa6f7('0x8'));var controller=require(_0xa6f7('0x9'));router[_0xa6f7('0xa')]('/',auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xc')]);router[_0xa6f7('0xa')](_0xa6f7('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xa6f7('0xa')](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0xf')]);router[_0xa6f7('0x10')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa6f7('0x11')](_0xa6f7('0xe'),auth['isAuthenticated'](),controller[_0xa6f7('0x12')]);router['delete'](_0xa6f7('0xe'),auth[_0xa6f7('0xb')](),controller[_0xa6f7('0x13')]);module[_0xa6f7('0x14')]=router; \ No newline at end of file +var _0x22fb=['./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x187357,_0x37862f){var _0x5631ae=function(_0x42ef8d){while(--_0x42ef8d){_0x187357['push'](_0x187357['shift']());}};_0x5631ae(++_0x37862f);}(_0x22fb,0x192));var _0xb22f=function(_0x1f8b77,_0x54d83b){_0x1f8b77=_0x1f8b77-0x0;var _0x169e04=_0x22fb[_0x1f8b77];return _0x169e04;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb22f('0x0'));var timeout=require('connect-timeout');var express=require(_0xb22f('0x1'));var router=express[_0xb22f('0x2')]();var fs_extra=require(_0xb22f('0x3'));var auth=require(_0xb22f('0x4'));var interaction=require(_0xb22f('0x5'));var config=require('../../config/environment');var controller=require(_0xb22f('0x6'));router[_0xb22f('0x7')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0x9')]);router[_0xb22f('0x7')](_0xb22f('0xa'),auth['isAuthenticated'](),controller[_0xb22f('0xb')]);router[_0xb22f('0x7')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller[_0xb22f('0xd')]);router[_0xb22f('0xe')]('/',auth[_0xb22f('0x8')](),controller[_0xb22f('0xf')]);router[_0xb22f('0x10')](_0xb22f('0xc'),auth[_0xb22f('0x8')](),controller['update']);router['delete']('/:id',auth[_0xb22f('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index f4f3a96..2fae676 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(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x3f9214,_0x2fe21a){_0x3f9214=_0x3f9214-0x0;var _0x3c7175=_0x7a54[_0x3f9214];return _0x3c7175;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x7a54,0x106));var _0x47a5=function(_0x53c9c7,_0x1ca420){_0x53c9c7=_0x53c9c7-0x0;var _0x1d2ae2=_0x7a54[_0x53c9c7];return _0x1d2ae2;};'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 7d34500..33dcc06 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 _0xcb66=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','then','end','name','send','index','JscriptyAnswerReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','findAll','rows','find','create','body','catch','params','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x480bc8,_0x1fac40){var _0x28c245=function(_0x22a049){while(--_0x22a049){_0x480bc8['push'](_0x480bc8['shift']());}};_0x28c245(++_0x1fac40);}(_0xcb66,0x19f));var _0x6cb6=function(_0x350343,_0x256f69){_0x350343=_0x350343-0x0;var _0x9afc1c=_0xcb66[_0x350343];return _0x9afc1c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6cb6('0x0'));var zipdir=require(_0x6cb6('0x1'));var jsonpatch=require(_0x6cb6('0x2'));var rp=require(_0x6cb6('0x3'));var moment=require(_0x6cb6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6cb6('0x5'));var util=require(_0x6cb6('0x6'));var path=require(_0x6cb6('0x7'));var sox=require(_0x6cb6('0x8'));var csv=require(_0x6cb6('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6cb6('0xa'));var squel=require(_0x6cb6('0xb'));var crypto=require(_0x6cb6('0xc'));var jsforce=require(_0x6cb6('0xd'));var deskjs=require(_0x6cb6('0xe'));var toCsv=require(_0x6cb6('0x9'));var querystring=require(_0x6cb6('0xf'));var Papa=require(_0x6cb6('0x10'));var Redis=require(_0x6cb6('0x11'));var authService=require(_0x6cb6('0x12'));var qs=require(_0x6cb6('0x13'));var as=require(_0x6cb6('0x14'));var hardwareService=require(_0x6cb6('0x15'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x6cb6('0x16'));var db=require(_0x6cb6('0x17'))['db'];function respondWithStatusCode(_0xad49d9,_0x2604e7){_0x2604e7=_0x2604e7||0xcc;return function(_0x585233){if(_0x585233){return _0xad49d9[_0x6cb6('0x18')](_0x2604e7);}return _0xad49d9[_0x6cb6('0x19')](_0x2604e7)['end']();};}function respondWithResult(_0x1e5468,_0x14a581){_0x14a581=_0x14a581||0xc8;return function(_0x5af476){if(_0x5af476){return _0x1e5468[_0x6cb6('0x19')](_0x14a581)[_0x6cb6('0x1a')](_0x5af476);}};}function respondWithFilteredResult(_0x492629,_0x5ab865){return function(_0x505b4d){if(_0x505b4d){var _0x5dd4cd=typeof _0x5ab865[_0x6cb6('0x1b')]===_0x6cb6('0x1c')&&typeof _0x5ab865[_0x6cb6('0x1d')]===_0x6cb6('0x1c');var _0x432e48=_0x505b4d[_0x6cb6('0x1e')];var _0x5b8a17=_0x5dd4cd?0x0:_0x5ab865[_0x6cb6('0x1b')];var _0xc0bdea=_0x5dd4cd?_0x505b4d['count']:_0x5ab865['offset']+_0x5ab865['limit'];var _0x5b5dab;if(_0xc0bdea>=_0x432e48){_0xc0bdea=_0x432e48;_0x5b5dab=0xc8;}else{_0x5b5dab=0xce;}_0x492629['status'](_0x5b5dab);return _0x492629['set'](_0x6cb6('0x1f'),_0x5b8a17+'-'+_0xc0bdea+'/'+_0x432e48)[_0x6cb6('0x1a')](_0x505b4d);}return null;};}function patchUpdates(_0x407455){return function(_0x2d41c4){try{jsonpatch[_0x6cb6('0x20')](_0x2d41c4,_0x407455,!![]);}catch(_0x5e14c8){return BPromise['reject'](_0x5e14c8);}return _0x2d41c4[_0x6cb6('0x21')]();};}function saveUpdates(_0x1d35d1,_0x1c4bcd){return function(_0x153915){if(_0x153915){return _0x153915['update'](_0x1d35d1)[_0x6cb6('0x22')](function(_0x19837e){return _0x19837e;});}return null;};}function removeEntity(_0x58a6ed,_0x5ad4f2){return function(_0xea5ee5){if(_0xea5ee5){return _0xea5ee5['destroy']()[_0x6cb6('0x22')](function(){_0x58a6ed[_0x6cb6('0x19')](0xcc)[_0x6cb6('0x23')]();});}};}function handleEntityNotFound(_0x18ecb9,_0x299830){return function(_0x16db1d){if(!_0x16db1d){_0x18ecb9[_0x6cb6('0x18')](0x194);}return _0x16db1d;};}function handleError(_0xcae6af,_0x1cc1ed){_0x1cc1ed=_0x1cc1ed||0x1f4;return function(_0x112e47){logger['error'](_0x112e47['stack']);if(_0x112e47['name']){delete _0x112e47[_0x6cb6('0x24')];}_0xcae6af[_0x6cb6('0x19')](_0x1cc1ed)[_0x6cb6('0x25')](_0x112e47);};}exports[_0x6cb6('0x26')]=function(_0x1f8c9d,_0x3b62e6){var _0x57cd74={},_0x124291={},_0x4d4ad9={'count':0x0,'rows':[]};var _0x2b2c4b=_['map'](db[_0x6cb6('0x27')][_0x6cb6('0x28')],function(_0x32c373){return{'name':_0x32c373['fieldName'],'type':_0x32c373[_0x6cb6('0x29')][_0x6cb6('0x2a')]};});_0x124291[_0x6cb6('0x2b')]=_['map'](_0x2b2c4b,_0x6cb6('0x24'));_0x124291[_0x6cb6('0x2c')]=_[_0x6cb6('0x2d')](_0x1f8c9d['query']);_0x124291[_0x6cb6('0x2e')]=_[_0x6cb6('0x2f')](_0x124291['model'],_0x124291[_0x6cb6('0x2c')]);_0x57cd74[_0x6cb6('0x30')]=_[_0x6cb6('0x2f')](_0x124291[_0x6cb6('0x2b')],qs[_0x6cb6('0x31')](_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x31')]));_0x57cd74[_0x6cb6('0x30')]=_0x57cd74[_0x6cb6('0x30')][_0x6cb6('0x32')]?_0x57cd74['attributes']:_0x124291[_0x6cb6('0x2b')];if(!_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x33')](_0x6cb6('0x34'))){_0x57cd74['limit']=qs['limit'](_0x1f8c9d['query'][_0x6cb6('0x1d')]);_0x57cd74[_0x6cb6('0x1b')]=qs[_0x6cb6('0x1b')](_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x1b')]);}_0x57cd74[_0x6cb6('0x35')]=qs[_0x6cb6('0x36')](_0x1f8c9d[_0x6cb6('0x2c')]['sort']);_0x57cd74[_0x6cb6('0x37')]=qs['filters'](_[_0x6cb6('0x38')](_0x1f8c9d[_0x6cb6('0x2c')],_0x124291[_0x6cb6('0x2e')]),_0x2b2c4b);if(_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x39')]){_0x57cd74[_0x6cb6('0x37')]=_[_0x6cb6('0x3a')](_0x57cd74['where'],{'$or':_[_0x6cb6('0x3b')](_0x2b2c4b,function(_0x58a304){if(_0x58a304[_0x6cb6('0x29')]!==_0x6cb6('0x3c')){var _0x3bb13d={};_0x3bb13d[_0x58a304['name']]={'$like':'%'+_0x1f8c9d['query'][_0x6cb6('0x39')]+'%'};return _0x3bb13d;}})});}_0x57cd74=_['merge']({},_0x57cd74,_0x1f8c9d[_0x6cb6('0x3d')]);var _0x296a3b={'where':_0x57cd74[_0x6cb6('0x37')]};return db[_0x6cb6('0x27')][_0x6cb6('0x1e')](_0x296a3b)[_0x6cb6('0x22')](function(_0x3652ca){_0x4d4ad9['count']=_0x3652ca;if(_0x1f8c9d[_0x6cb6('0x2c')][_0x6cb6('0x3e')]){_0x57cd74['include']=[{'all':!![]}];}return db[_0x6cb6('0x27')][_0x6cb6('0x3f')](_0x57cd74);})[_0x6cb6('0x22')](function(_0x31a391){_0x4d4ad9[_0x6cb6('0x40')]=_0x31a391;return _0x4d4ad9;})[_0x6cb6('0x22')](respondWithFilteredResult(_0x3b62e6,_0x57cd74))['catch'](handleError(_0x3b62e6,null));};exports['show']=function(_0x1f4e94,_0x5d3770){var _0x588ea4={'raw':!![],'where':{'id':_0x1f4e94['params']['id']}},_0x605673={};_0x605673[_0x6cb6('0x2b')]=_[_0x6cb6('0x2d')](db['JscriptyAnswerReport']['rawAttributes']);_0x605673[_0x6cb6('0x2c')]=_['keys'](_0x1f4e94[_0x6cb6('0x2c')]);_0x605673[_0x6cb6('0x2e')]=_['intersection'](_0x605673[_0x6cb6('0x2b')],_0x605673[_0x6cb6('0x2c')]);_0x588ea4['attributes']=_[_0x6cb6('0x2f')](_0x605673['model'],qs[_0x6cb6('0x31')](_0x1f4e94[_0x6cb6('0x2c')]['fields']));_0x588ea4[_0x6cb6('0x30')]=_0x588ea4[_0x6cb6('0x30')]['length']?_0x588ea4['attributes']:_0x605673[_0x6cb6('0x2b')];if(_0x1f4e94[_0x6cb6('0x2c')][_0x6cb6('0x3e')]){_0x588ea4['include']=[{'all':!![]}];}_0x588ea4=_[_0x6cb6('0x3a')]({},_0x588ea4,_0x1f4e94[_0x6cb6('0x3d')]);return db['JscriptyAnswerReport'][_0x6cb6('0x41')](_0x588ea4)[_0x6cb6('0x22')](handleEntityNotFound(_0x5d3770,null))[_0x6cb6('0x22')](respondWithResult(_0x5d3770,null))['catch'](handleError(_0x5d3770,null));};exports[_0x6cb6('0x42')]=function(_0x4444a4,_0x42dc72){return db[_0x6cb6('0x27')][_0x6cb6('0x42')](_0x4444a4[_0x6cb6('0x43')],{})['then'](respondWithResult(_0x42dc72,0xc9))[_0x6cb6('0x44')](handleError(_0x42dc72,null));};exports['update']=function(_0x4c3a3a,_0x29cb39){if(_0x4c3a3a[_0x6cb6('0x43')]['id']){delete _0x4c3a3a['body']['id'];}return db[_0x6cb6('0x27')]['find']({'where':{'id':_0x4c3a3a[_0x6cb6('0x45')]['id']}})[_0x6cb6('0x22')](handleEntityNotFound(_0x29cb39,null))[_0x6cb6('0x22')](saveUpdates(_0x4c3a3a['body'],null))[_0x6cb6('0x22')](respondWithResult(_0x29cb39,null))[_0x6cb6('0x44')](handleError(_0x29cb39,null));};exports[_0x6cb6('0x46')]=function(_0x567d52,_0x2668a3){return db['JscriptyAnswerReport'][_0x6cb6('0x41')]({'where':{'id':_0x567d52[_0x6cb6('0x45')]['id']}})[_0x6cb6('0x22')](handleEntityNotFound(_0x2668a3,null))['then'](removeEntity(_0x2668a3,null))['catch'](handleError(_0x2668a3,null));};exports[_0x6cb6('0x47')]=function(_0x3dca6c,_0x1d12da){return db['JscriptyAnswerReport'][_0x6cb6('0x47')]()[_0x6cb6('0x22')](respondWithResult(_0x1d12da,null))[_0x6cb6('0x44')](handleError(_0x1d12da,null));}; \ No newline at end of file +var _0x6363=['destroy','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','error','stack','name','index','map','JscriptyAnswerReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6363,0x13a));var _0x3636=function(_0x52f66b,_0x35240e){_0x52f66b=_0x52f66b-0x0;var _0x53e3ff=_0x6363[_0x52f66b];return _0x53e3ff;};'use strict';var emlformat=require(_0x3636('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x3636('0x1'));var jsonpatch=require(_0x3636('0x2'));var rp=require(_0x3636('0x3'));var moment=require(_0x3636('0x4'));var BPromise=require(_0x3636('0x5'));var Mustache=require(_0x3636('0x6'));var util=require(_0x3636('0x7'));var path=require(_0x3636('0x8'));var sox=require(_0x3636('0x9'));var csv=require(_0x3636('0xa'));var ejs=require(_0x3636('0xb'));var fs=require('fs');var fs_extra=require(_0x3636('0xc'));var _=require(_0x3636('0xd'));var squel=require(_0x3636('0xe'));var crypto=require('crypto');var jsforce=require(_0x3636('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x3636('0xa'));var querystring=require(_0x3636('0x10'));var Papa=require(_0x3636('0x11'));var Redis=require(_0x3636('0x12'));var authService=require(_0x3636('0x13'));var qs=require(_0x3636('0x14'));var as=require(_0x3636('0x15'));var hardwareService=require(_0x3636('0x16'));var logger=require(_0x3636('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x3636('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3636('0x19'))['db'];function respondWithStatusCode(_0x41ddae,_0x62d6f9){_0x62d6f9=_0x62d6f9||0xcc;return function(_0x13ca35){if(_0x13ca35){return _0x41ddae[_0x3636('0x1a')](_0x62d6f9);}return _0x41ddae[_0x3636('0x1b')](_0x62d6f9)[_0x3636('0x1c')]();};}function respondWithResult(_0x12dfa9,_0x3295ab){_0x3295ab=_0x3295ab||0xc8;return function(_0x7b4b16){if(_0x7b4b16){return _0x12dfa9[_0x3636('0x1b')](_0x3295ab)[_0x3636('0x1d')](_0x7b4b16);}};}function respondWithFilteredResult(_0xcb2aa3,_0x3fc712){return function(_0x23cc34){if(_0x23cc34){var _0x3cbd0d=typeof _0x3fc712[_0x3636('0x1e')]==='undefined'&&typeof _0x3fc712[_0x3636('0x1f')]===_0x3636('0x20');var _0x4aa7fc=_0x23cc34[_0x3636('0x21')];var _0x5aa0ff=_0x3cbd0d?0x0:_0x3fc712['offset'];var _0xae6469=_0x3cbd0d?_0x23cc34[_0x3636('0x21')]:_0x3fc712[_0x3636('0x1e')]+_0x3fc712[_0x3636('0x1f')];var _0xe0e633;if(_0xae6469>=_0x4aa7fc){_0xae6469=_0x4aa7fc;_0xe0e633=0xc8;}else{_0xe0e633=0xce;}_0xcb2aa3[_0x3636('0x1b')](_0xe0e633);return _0xcb2aa3[_0x3636('0x22')](_0x3636('0x23'),_0x5aa0ff+'-'+_0xae6469+'/'+_0x4aa7fc)['json'](_0x23cc34);}return null;};}function patchUpdates(_0x48f598){return function(_0x316930){try{jsonpatch[_0x3636('0x24')](_0x316930,_0x48f598,!![]);}catch(_0x42b271){return BPromise['reject'](_0x42b271);}return _0x316930[_0x3636('0x25')]();};}function saveUpdates(_0xa46471,_0x15a0b3){return function(_0xe34cd9){if(_0xe34cd9){return _0xe34cd9[_0x3636('0x26')](_0xa46471)[_0x3636('0x27')](function(_0x4f5b0e){return _0x4f5b0e;});}return null;};}function removeEntity(_0x517fda,_0x368356){return function(_0x4ee098){if(_0x4ee098){return _0x4ee098['destroy']()[_0x3636('0x27')](function(){_0x517fda['status'](0xcc)[_0x3636('0x1c')]();});}};}function handleEntityNotFound(_0x4c24cf,_0x36f4c5){return function(_0x477c34){if(!_0x477c34){_0x4c24cf[_0x3636('0x1a')](0x194);}return _0x477c34;};}function handleError(_0x201ea1,_0x112b96){_0x112b96=_0x112b96||0x1f4;return function(_0x20ca8b){logger[_0x3636('0x28')](_0x20ca8b[_0x3636('0x29')]);if(_0x20ca8b[_0x3636('0x2a')]){delete _0x20ca8b[_0x3636('0x2a')];}_0x201ea1[_0x3636('0x1b')](_0x112b96)['send'](_0x20ca8b);};}exports[_0x3636('0x2b')]=function(_0x236f54,_0x2d644c){var _0x22b12f={},_0xd37c62={},_0x17e062={'count':0x0,'rows':[]};var _0x52ad91=_[_0x3636('0x2c')](db[_0x3636('0x2d')]['rawAttributes'],function(_0x8fffb0){return{'name':_0x8fffb0[_0x3636('0x2e')],'type':_0x8fffb0[_0x3636('0x2f')][_0x3636('0x30')]};});_0xd37c62[_0x3636('0x31')]=_['map'](_0x52ad91,_0x3636('0x2a'));_0xd37c62[_0x3636('0x32')]=_[_0x3636('0x33')](_0x236f54[_0x3636('0x32')]);_0xd37c62[_0x3636('0x34')]=_[_0x3636('0x35')](_0xd37c62[_0x3636('0x31')],_0xd37c62[_0x3636('0x32')]);_0x22b12f[_0x3636('0x36')]=_['intersection'](_0xd37c62['model'],qs[_0x3636('0x37')](_0x236f54['query']['fields']));_0x22b12f[_0x3636('0x36')]=_0x22b12f[_0x3636('0x36')][_0x3636('0x38')]?_0x22b12f['attributes']:_0xd37c62[_0x3636('0x31')];if(!_0x236f54[_0x3636('0x32')][_0x3636('0x39')](_0x3636('0x3a'))){_0x22b12f[_0x3636('0x1f')]=qs[_0x3636('0x1f')](_0x236f54[_0x3636('0x32')][_0x3636('0x1f')]);_0x22b12f[_0x3636('0x1e')]=qs[_0x3636('0x1e')](_0x236f54[_0x3636('0x32')][_0x3636('0x1e')]);}_0x22b12f[_0x3636('0x3b')]=qs['sort'](_0x236f54[_0x3636('0x32')][_0x3636('0x3c')]);_0x22b12f[_0x3636('0x3d')]=qs[_0x3636('0x34')](_['pick'](_0x236f54['query'],_0xd37c62[_0x3636('0x34')]),_0x52ad91);if(_0x236f54[_0x3636('0x32')][_0x3636('0x3e')]){_0x22b12f['where']=_[_0x3636('0x3f')](_0x22b12f[_0x3636('0x3d')],{'$or':_['map'](_0x52ad91,function(_0x58f03d){if(_0x58f03d[_0x3636('0x2f')]!=='VIRTUAL'){var _0x8c04cf={};_0x8c04cf[_0x58f03d[_0x3636('0x2a')]]={'$like':'%'+_0x236f54[_0x3636('0x32')][_0x3636('0x3e')]+'%'};return _0x8c04cf;}})});}_0x22b12f=_[_0x3636('0x3f')]({},_0x22b12f,_0x236f54[_0x3636('0x40')]);var _0x448397={'where':_0x22b12f[_0x3636('0x3d')]};return db[_0x3636('0x2d')]['count'](_0x448397)[_0x3636('0x27')](function(_0x44cb9c){_0x17e062[_0x3636('0x21')]=_0x44cb9c;if(_0x236f54[_0x3636('0x32')][_0x3636('0x41')]){_0x22b12f[_0x3636('0x42')]=[{'all':!![]}];}return db[_0x3636('0x2d')][_0x3636('0x43')](_0x22b12f);})[_0x3636('0x27')](function(_0x4df331){_0x17e062[_0x3636('0x44')]=_0x4df331;return _0x17e062;})[_0x3636('0x27')](respondWithFilteredResult(_0x2d644c,_0x22b12f))[_0x3636('0x45')](handleError(_0x2d644c,null));};exports[_0x3636('0x46')]=function(_0x9c59e0,_0x122cb2){var _0x201e2c={'raw':!![],'where':{'id':_0x9c59e0[_0x3636('0x47')]['id']}},_0x401281={};_0x401281[_0x3636('0x31')]=_[_0x3636('0x33')](db[_0x3636('0x2d')][_0x3636('0x48')]);_0x401281[_0x3636('0x32')]=_[_0x3636('0x33')](_0x9c59e0['query']);_0x401281[_0x3636('0x34')]=_[_0x3636('0x35')](_0x401281[_0x3636('0x31')],_0x401281[_0x3636('0x32')]);_0x201e2c[_0x3636('0x36')]=_[_0x3636('0x35')](_0x401281[_0x3636('0x31')],qs[_0x3636('0x37')](_0x9c59e0[_0x3636('0x32')][_0x3636('0x37')]));_0x201e2c[_0x3636('0x36')]=_0x201e2c[_0x3636('0x36')][_0x3636('0x38')]?_0x201e2c['attributes']:_0x401281['model'];if(_0x9c59e0['query'][_0x3636('0x41')]){_0x201e2c['include']=[{'all':!![]}];}_0x201e2c=_['merge']({},_0x201e2c,_0x9c59e0[_0x3636('0x40')]);return db[_0x3636('0x2d')][_0x3636('0x49')](_0x201e2c)['then'](handleEntityNotFound(_0x122cb2,null))[_0x3636('0x27')](respondWithResult(_0x122cb2,null))[_0x3636('0x45')](handleError(_0x122cb2,null));};exports[_0x3636('0x4a')]=function(_0x179410,_0x37a33e){return db[_0x3636('0x2d')][_0x3636('0x4a')](_0x179410[_0x3636('0x4b')],{})[_0x3636('0x27')](respondWithResult(_0x37a33e,0xc9))['catch'](handleError(_0x37a33e,null));};exports[_0x3636('0x26')]=function(_0x33c140,_0x16b65a){if(_0x33c140[_0x3636('0x4b')]['id']){delete _0x33c140[_0x3636('0x4b')]['id'];}return db[_0x3636('0x2d')]['find']({'where':{'id':_0x33c140[_0x3636('0x47')]['id']}})[_0x3636('0x27')](handleEntityNotFound(_0x16b65a,null))[_0x3636('0x27')](saveUpdates(_0x33c140[_0x3636('0x4b')],null))[_0x3636('0x27')](respondWithResult(_0x16b65a,null))['catch'](handleError(_0x16b65a,null));};exports[_0x3636('0x4c')]=function(_0x285ff1,_0xa61651){return db[_0x3636('0x2d')][_0x3636('0x49')]({'where':{'id':_0x285ff1['params']['id']}})[_0x3636('0x27')](handleEntityNotFound(_0xa61651,null))['then'](removeEntity(_0xa61651,null))['catch'](handleError(_0xa61651,null));};exports[_0x3636('0x4d')]=function(_0x1c1ec0,_0x2575ba){return db[_0x3636('0x2d')]['describe']()['then'](respondWithResult(_0x2575ba,null))[_0x3636('0x45')](handleError(_0x2575ba,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 9e34f65..9f1748c 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 _0xc9af=['bluebird','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','define','report_jscripty_answers','lodash','util','../../config/logger','api','moment'];(function(_0x560baf,_0x574319){var _0xbdd6e2=function(_0x1ece6d){while(--_0x1ece6d){_0x560baf['push'](_0x560baf['shift']());}};_0xbdd6e2(++_0x574319);}(_0xc9af,0x163));var _0xfc9a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc9af[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xfc9a('0x0'));var util=require(_0xfc9a('0x1'));var logger=require(_0xfc9a('0x2'))(_0xfc9a('0x3'));var moment=require(_0xfc9a('0x4'));var BPromise=require(_0xfc9a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xfc9a('0x6'));var config=require(_0xfc9a('0x7'));var attributes=require(_0xfc9a('0x8'));module[_0xfc9a('0x9')]=function(_0x42ba33,_0x26cb3d){return _0x42ba33[_0xfc9a('0xa')]('JscriptyAnswerReport',attributes,{'tableName':_0xfc9a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d42=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','JscriptyAnswerReport','report_jscripty_answers'];(function(_0x343b71,_0x1f93d8){var _0x152cb9=function(_0x3631f6){while(--_0x3631f6){_0x343b71['push'](_0x343b71['shift']());}};_0x152cb9(++_0x1f93d8);}(_0x5d42,0x99));var _0x25d4=function(_0xec9857,_0x5566ff){_0xec9857=_0xec9857-0x0;var _0x429309=_0x5d42[_0xec9857];return _0x429309;};'use strict';var _=require('lodash');var util=require(_0x25d4('0x0'));var logger=require(_0x25d4('0x1'))(_0x25d4('0x2'));var moment=require('moment');var BPromise=require(_0x25d4('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x25d4('0x4'));var rimraf=require(_0x25d4('0x5'));var config=require(_0x25d4('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module['exports']=function(_0x3585b7,_0x2ce7ec){return _0x3585b7['define'](_0x25d4('0x7'),attributes,{'tableName':_0x25d4('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 f314cab..81197b2 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 _0xb291=['JscriptyAnswerReport,\x20%s,\x20%s','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','request\x20sent','debug','stringify','error','message'];(function(_0x228d7c,_0xf01e7d){var _0x1ffa97=function(_0x5418dd){while(--_0x5418dd){_0x228d7c['push'](_0x228d7c['shift']());}};_0x1ffa97(++_0xf01e7d);}(_0xb291,0xde));var _0x1b29=function(_0x1c8ce3,_0x3bab0f){_0x1c8ce3=_0x1c8ce3-0x0;var _0x417035=_0xb291[_0x1c8ce3];return _0x417035;};'use strict';var _=require(_0x1b29('0x0'));var util=require(_0x1b29('0x1'));var moment=require('moment');var BPromise=require(_0x1b29('0x2'));var rs=require(_0x1b29('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b29('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b29('0x5'))(_0x1b29('0x6'));var config=require(_0x1b29('0x7'));var jayson=require(_0x1b29('0x8'));var client=jayson[_0x1b29('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4647a3,_0x5e24cd,_0x4e2440){return new BPromise(function(_0x3bc6ae,_0x2eeac4){return client['request'](_0x4647a3,_0x4e2440)['then'](function(_0x2a2779){logger[_0x1b29('0xa')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5e24cd,_0x1b29('0xb'));logger[_0x1b29('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s,\x20%s',_0x5e24cd,_0x1b29('0xb'),JSON[_0x1b29('0xd')](_0x2a2779));if(_0x2a2779[_0x1b29('0xe')]){if(_0x2a2779['error']['code']===0x1f4){logger[_0x1b29('0xe')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x5e24cd,_0x2a2779[_0x1b29('0xe')][_0x1b29('0xf')]);return _0x2eeac4(_0x2a2779[_0x1b29('0xe')][_0x1b29('0xf')]);}logger[_0x1b29('0xe')](_0x1b29('0x10'),_0x5e24cd,_0x2a2779['error'][_0x1b29('0xf')]);return _0x3bc6ae(_0x2a2779[_0x1b29('0xe')]['message']);}else{logger[_0x1b29('0xa')](_0x1b29('0x10'),_0x5e24cd,_0x1b29('0xb'));_0x3bc6ae(_0x2a2779['result'][_0x1b29('0xf')]);}})['catch'](function(_0x1cf9c0){logger['error'](_0x1b29('0x10'),_0x5e24cd,_0x1cf9c0);_0x2eeac4(_0x1cf9c0);});});} \ No newline at end of file +var _0x77e0=['request','then','info','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptyAnswerReport,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','http'];(function(_0x1c7e96,_0x209dcb){var _0x2d1fb1=function(_0x51b84c){while(--_0x51b84c){_0x1c7e96['push'](_0x1c7e96['shift']());}};_0x2d1fb1(++_0x209dcb);}(_0x77e0,0x90));var _0x077e=function(_0x5b5ebe,_0x591543){_0x5b5ebe=_0x5b5ebe-0x0;var _0x534500=_0x77e0[_0x5b5ebe];return _0x534500;};'use strict';var _=require(_0x077e('0x0'));var util=require('util');var moment=require(_0x077e('0x1'));var BPromise=require(_0x077e('0x2'));var rs=require(_0x077e('0x3'));var fs=require('fs');var Redis=require(_0x077e('0x4'));var db=require(_0x077e('0x5'))['db'];var utils=require(_0x077e('0x6'));var logger=require('../../config/logger')(_0x077e('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x077e('0x8')][_0x077e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e156e,_0x3cc5a3,_0x4087a7){return new BPromise(function(_0x5e6937,_0x2798a8){return client[_0x077e('0xa')](_0x3e156e,_0x4087a7)[_0x077e('0xb')](function(_0x464129){logger[_0x077e('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x3cc5a3,_0x077e('0xd'));logger[_0x077e('0xe')](_0x077e('0xf'),_0x3cc5a3,_0x077e('0xd'),JSON[_0x077e('0x10')](_0x464129));if(_0x464129[_0x077e('0x11')]){if(_0x464129[_0x077e('0x11')][_0x077e('0x12')]===0x1f4){logger[_0x077e('0x11')](_0x077e('0x13'),_0x3cc5a3,_0x464129['error']['message']);return _0x2798a8(_0x464129[_0x077e('0x11')][_0x077e('0x14')]);}logger['error'](_0x077e('0x13'),_0x3cc5a3,_0x464129[_0x077e('0x11')][_0x077e('0x14')]);return _0x5e6937(_0x464129[_0x077e('0x11')]['message']);}else{logger[_0x077e('0xc')](_0x077e('0x13'),_0x3cc5a3,_0x077e('0xd'));_0x5e6937(_0x464129[_0x077e('0x15')][_0x077e('0x14')]);}})['catch'](function(_0x13b6a5){logger[_0x077e('0x11')](_0x077e('0x13'),_0x3cc5a3,_0x13b6a5);_0x2798a8(_0x13b6a5);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 3d95766..3c88390 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 _0x01f7=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','update','delete','destroy','exports','multer'];(function(_0x3c5a6d,_0x21c507){var _0x33fe8e=function(_0x327cf7){while(--_0x327cf7){_0x3c5a6d['push'](_0x3c5a6d['shift']());}};_0x33fe8e(++_0x21c507);}(_0x01f7,0xae));var _0x701f=function(_0x373f3c,_0x44e12b){_0x373f3c=_0x373f3c-0x0;var _0x555326=_0x01f7[_0x373f3c];return _0x555326;};'use strict';var multer=require(_0x701f('0x0'));var util=require('util');var path=require(_0x701f('0x1'));var timeout=require(_0x701f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x701f('0x3'));var auth=require(_0x701f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x701f('0x5'));var controller=require('./jscriptyProject.controller');router[_0x701f('0x6')]('/',auth['isAuthenticated'](),controller[_0x701f('0x7')]);router[_0x701f('0x6')](_0x701f('0x8'),auth[_0x701f('0x9')](),controller[_0x701f('0xa')]);router[_0x701f('0x6')](_0x701f('0xb'),auth[_0x701f('0x9')](),controller[_0x701f('0xc')]);router[_0x701f('0x6')]('/:id/answers',auth[_0x701f('0x9')](),controller[_0x701f('0xd')]);router['get'](_0x701f('0xe'),auth['isAuthenticated'](),timeout(_0x701f('0xf')),controller[_0x701f('0x10')]);router[_0x701f('0x11')]('/',auth[_0x701f('0x9')](),controller[_0x701f('0x12')]);router[_0x701f('0x11')](_0x701f('0x13'),auth[_0x701f('0x9')](),controller[_0x701f('0x14')]);router['put'](_0x701f('0x8'),auth[_0x701f('0x9')](),controller[_0x701f('0x15')]);router[_0x701f('0x16')](_0x701f('0x8'),auth[_0x701f('0x9')](),controller[_0x701f('0x17')]);module[_0x701f('0x18')]=router; \ No newline at end of file +var _0x3be7=['post','/:id/clone','clone','put','update','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated','show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','create'];(function(_0x180ad5,_0x290f3a){var _0x5ca23b=function(_0x544aeb){while(--_0x544aeb){_0x180ad5['push'](_0x180ad5['shift']());}};_0x5ca23b(++_0x290f3a);}(_0x3be7,0x172));var _0x73be=function(_0x3e75f2,_0x7b3f4f){_0x3e75f2=_0x3e75f2-0x0;var _0xcf25cc=_0x3be7[_0x3e75f2];return _0xcf25cc;};'use strict';var multer=require(_0x73be('0x0'));var util=require(_0x73be('0x1'));var path=require('path');var timeout=require(_0x73be('0x2'));var express=require('express');var router=express[_0x73be('0x3')]();var fs_extra=require(_0x73be('0x4'));var auth=require(_0x73be('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x73be('0x6'));var controller=require(_0x73be('0x7'));router[_0x73be('0x8')]('/',auth['isAuthenticated'](),controller[_0x73be('0x9')]);router['get'](_0x73be('0xa'),auth[_0x73be('0xb')](),controller[_0x73be('0xc')]);router['get'](_0x73be('0xd'),auth[_0x73be('0xb')](),controller[_0x73be('0xe')]);router[_0x73be('0x8')](_0x73be('0xf'),auth[_0x73be('0xb')](),controller[_0x73be('0x10')]);router[_0x73be('0x8')]('/:id/summary',auth[_0x73be('0xb')](),timeout(_0x73be('0x11')),controller[_0x73be('0x12')]);router['post']('/',auth[_0x73be('0xb')](),controller[_0x73be('0x13')]);router[_0x73be('0x14')](_0x73be('0x15'),auth['isAuthenticated'](),controller[_0x73be('0x16')]);router[_0x73be('0x17')](_0x73be('0xa'),auth[_0x73be('0xb')](),controller[_0x73be('0x18')]);router['delete']('/:id',auth[_0x73be('0xb')](),controller['destroy']);module[_0x73be('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index d710518..a7341d9 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 _0xf862=['sequelize','lodash','exports','STRING','name','TEXT','isObjectLike','setDataValue','stringify','isString','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN'];(function(_0x4164f2,_0x38669f){var _0x2575c7=function(_0x24dca1){while(--_0x24dca1){_0x4164f2['push'](_0x4164f2['shift']());}};_0x2575c7(++_0x38669f);}(_0xf862,0x1c0));var _0x2f86=function(_0x46c1d5,_0x5ca335){_0x46c1d5=_0x46c1d5-0x0;var _0x40fe7b=_0xf862[_0x46c1d5];return _0x40fe7b;};'use strict';var Sequelize=require(_0x2f86('0x0'));var _=require(_0x2f86('0x1'));var util=require('util');module[_0x2f86('0x2')]={'name':{'type':Sequelize[_0x2f86('0x3')],'unique':_0x2f86('0x4')},'description':{'type':Sequelize[_0x2f86('0x3')]},'formData':{'type':Sequelize[_0x2f86('0x5')]('long'),'set':function(_0x39d65c){if(_[_0x2f86('0x6')](_0x39d65c)){this[_0x2f86('0x7')]('formData',JSON[_0x2f86('0x8')](_0x39d65c));}else if(_[_0x2f86('0x9')](_0x39d65c)){this[_0x2f86('0x7')](_0x2f86('0xa'),_0x39d65c);}else{this[_0x2f86('0x7')]('formData',util[_0x2f86('0xb')](_0x2f86('0xc'),this['getDataValue'](_0x2f86('0x4'))||'',this[_0x2f86('0xd')](_0x2f86('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x2f86('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x8423=['exports','STRING','name','TEXT','long','setDataValue','formData','stringify','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util'];(function(_0x336376,_0xe4b28d){var _0x1d2a8e=function(_0x3afe68){while(--_0x3afe68){_0x336376['push'](_0x336376['shift']());}};_0x1d2a8e(++_0xe4b28d);}(_0x8423,0xb1));var _0x3842=function(_0x5e88ce,_0x585263){_0x5e88ce=_0x5e88ce-0x0;var _0x544aa9=_0x8423[_0x5e88ce];return _0x544aa9;};'use strict';var Sequelize=require(_0x3842('0x0'));var _=require(_0x3842('0x1'));var util=require(_0x3842('0x2'));module[_0x3842('0x3')]={'name':{'type':Sequelize[_0x3842('0x4')],'unique':_0x3842('0x5')},'description':{'type':Sequelize[_0x3842('0x4')]},'formData':{'type':Sequelize[_0x3842('0x6')](_0x3842('0x7')),'set':function(_0x653cbc){if(_['isObjectLike'](_0x653cbc)){this[_0x3842('0x8')](_0x3842('0x9'),JSON[_0x3842('0xa')](_0x653cbc));}else if(_['isString'](_0x653cbc)){this[_0x3842('0x8')](_0x3842('0x9'),_0x653cbc);}else{this[_0x3842('0x8')](_0x3842('0x9'),util[_0x3842('0xb')](_0x3842('0xc'),this['getDataValue'](_0x3842('0x5'))||'',this[_0x3842('0xd')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x3842('0xe')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x3842('0xe')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 041076e..b76649f 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 _0x1364=['indexOf','replace','getSummary','starttime','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','writeFileSync','format','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','zip-dir','fast-json-patch','moment','mustache','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','json','undefined','count','offset','status','set','apply','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','merge','JscriptyProject','includeAll','include','findAll','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','clone','options','omit','createdAt','updatedAt','UserProfileSection','getSessions','findOne','JscriptySessionReport','hasOwnProperty','pick','ProjectId','filter','getAnswers','JscriptyAnswerReport','fromCharCode','toString'];(function(_0x4bb581,_0x6f7037){var _0x316bf5=function(_0x1f6ed0){while(--_0x1f6ed0){_0x4bb581['push'](_0x4bb581['shift']());}};_0x316bf5(++_0x6f7037);}(_0x1364,0x1eb));var _0x4136=function(_0x38d947,_0x2522ce){_0x38d947=_0x38d947-0x0;var _0x1f0af9=_0x1364[_0x38d947];return _0x1f0af9;};'use strict';var emlformat=require(_0x4136('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4136('0x1'));var jsonpatch=require(_0x4136('0x2'));var rp=require('request-promise');var moment=require(_0x4136('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4136('0x4'));var util=require(_0x4136('0x5'));var path=require(_0x4136('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4136('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4136('0x8'));var squel=require(_0x4136('0x9'));var crypto=require(_0x4136('0xa'));var jsforce=require(_0x4136('0xb'));var deskjs=require(_0x4136('0xc'));var toCsv=require(_0x4136('0xd'));var querystring=require('querystring');var Papa=require(_0x4136('0xe'));var Redis=require(_0x4136('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x4136('0x10'));var as=require(_0x4136('0x11'));var hardwareService=require(_0x4136('0x12'));var logger=require(_0x4136('0x13'))(_0x4136('0x14'));var utils=require('../../config/utils');var config=require(_0x4136('0x15'));var licenseUtil=require(_0x4136('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x541de0,_0x1535db){_0x1535db=_0x1535db||0xcc;return function(_0x2d7db8){if(_0x2d7db8){return _0x541de0[_0x4136('0x17')](_0x1535db);}return _0x541de0['status'](_0x1535db)[_0x4136('0x18')]();};}function respondWithResult(_0x319c9e,_0x40ccf5){_0x40ccf5=_0x40ccf5||0xc8;return function(_0x1ef62d){if(_0x1ef62d){return _0x319c9e['status'](_0x40ccf5)[_0x4136('0x19')](_0x1ef62d);}};}function respondWithFilteredResult(_0x2ecd6d,_0x3089ed){return function(_0x2b0d5c){if(_0x2b0d5c){var _0x3b3292=typeof _0x3089ed['offset']===_0x4136('0x1a')&&typeof _0x3089ed['limit']==='undefined';var _0x348bb2=_0x2b0d5c[_0x4136('0x1b')];var _0x566544=_0x3b3292?0x0:_0x3089ed['offset'];var _0x55f05a=_0x3b3292?_0x2b0d5c[_0x4136('0x1b')]:_0x3089ed[_0x4136('0x1c')]+_0x3089ed['limit'];var _0x196c07;if(_0x55f05a>=_0x348bb2){_0x55f05a=_0x348bb2;_0x196c07=0xc8;}else{_0x196c07=0xce;}_0x2ecd6d[_0x4136('0x1d')](_0x196c07);return _0x2ecd6d[_0x4136('0x1e')]('Content-Range',_0x566544+'-'+_0x55f05a+'/'+_0x348bb2)['json'](_0x2b0d5c);}return null;};}function patchUpdates(_0x13a1db){return function(_0x5c5cd7){try{jsonpatch[_0x4136('0x1f')](_0x5c5cd7,_0x13a1db,!![]);}catch(_0x994ac3){return BPromise['reject'](_0x994ac3);}return _0x5c5cd7[_0x4136('0x20')]();};}function saveUpdates(_0x44568b,_0x55f4df){return function(_0x2e6a48){if(_0x2e6a48){return _0x2e6a48[_0x4136('0x21')](_0x44568b)[_0x4136('0x22')](function(_0x46ab04){return _0x46ab04;});}return null;};}function removeEntity(_0x308b1c,_0x14ca0b){return function(_0x4155ea){if(_0x4155ea){return _0x4155ea[_0x4136('0x23')]()[_0x4136('0x22')](function(){var _0x49229b=_0x4155ea[_0x4136('0x24')]({'plain':!![]});var _0x5a59f6=_0x4136('0x25');return db[_0x4136('0x26')]['destroy']({'where':{'type':_0x5a59f6,'resourceId':_0x49229b['id']}})[_0x4136('0x22')](function(){return _0x4155ea;});})[_0x4136('0x22')](function(){_0x308b1c['status'](0xcc)[_0x4136('0x18')]();});}};}function handleEntityNotFound(_0x492d89,_0x7ce50){return function(_0x4b54df){if(!_0x4b54df){_0x492d89[_0x4136('0x17')](0x194);}return _0x4b54df;};}function handleError(_0x31ea19,_0x5bf046){_0x5bf046=_0x5bf046||0x1f4;return function(_0x270cd4){logger[_0x4136('0x27')](_0x270cd4[_0x4136('0x28')]);if(_0x270cd4[_0x4136('0x29')]){delete _0x270cd4['name'];}_0x31ea19[_0x4136('0x1d')](_0x5bf046)[_0x4136('0x2a')](_0x270cd4);};}exports['index']=function(_0x473a73,_0x4801f0){var _0x1d1e61={},_0x3f33b3={},_0x2577f8={'count':0x0,'rows':[]};var _0x45f657=_[_0x4136('0x2b')](db['JscriptyProject'][_0x4136('0x2c')],function(_0x468a5d){return{'name':_0x468a5d[_0x4136('0x2d')],'type':_0x468a5d[_0x4136('0x2e')][_0x4136('0x2f')]};});_0x3f33b3[_0x4136('0x30')]=_[_0x4136('0x2b')](_0x45f657,_0x4136('0x29'));_0x3f33b3[_0x4136('0x31')]=_[_0x4136('0x32')](_0x473a73['query']);_0x3f33b3[_0x4136('0x33')]=_[_0x4136('0x34')](_0x3f33b3[_0x4136('0x30')],_0x3f33b3[_0x4136('0x31')]);_0x1d1e61[_0x4136('0x35')]=_[_0x4136('0x34')](_0x3f33b3[_0x4136('0x30')],qs[_0x4136('0x36')](_0x473a73[_0x4136('0x31')][_0x4136('0x36')]));_0x1d1e61[_0x4136('0x35')]=_0x1d1e61['attributes'][_0x4136('0x37')]?_0x1d1e61[_0x4136('0x35')]:_0x3f33b3[_0x4136('0x30')];if(!_0x473a73[_0x4136('0x31')]['hasOwnProperty'](_0x4136('0x38'))){_0x1d1e61[_0x4136('0x39')]=qs[_0x4136('0x39')](_0x473a73[_0x4136('0x31')][_0x4136('0x39')]);_0x1d1e61[_0x4136('0x1c')]=qs[_0x4136('0x1c')](_0x473a73[_0x4136('0x31')][_0x4136('0x1c')]);}_0x1d1e61[_0x4136('0x3a')]=qs[_0x4136('0x3b')](_0x473a73[_0x4136('0x31')][_0x4136('0x3b')]);_0x1d1e61[_0x4136('0x3c')]=qs[_0x4136('0x33')](_['pick'](_0x473a73[_0x4136('0x31')],_0x3f33b3['filters']),_0x45f657);if(_0x473a73[_0x4136('0x31')]['filter']){_0x1d1e61[_0x4136('0x3c')]=_[_0x4136('0x3d')](_0x1d1e61[_0x4136('0x3c')],{'$or':_[_0x4136('0x2b')](_0x45f657,function(_0xbdfd5f){if(_0xbdfd5f[_0x4136('0x2e')]!=='VIRTUAL'){var _0x153d5d={};_0x153d5d[_0xbdfd5f['name']]={'$like':'%'+_0x473a73[_0x4136('0x31')]['filter']+'%'};return _0x153d5d;}})});}_0x1d1e61=_[_0x4136('0x3d')]({},_0x1d1e61,_0x473a73['options']);var _0x434252={'where':_0x1d1e61[_0x4136('0x3c')]};return db[_0x4136('0x3e')][_0x4136('0x1b')](_0x434252)[_0x4136('0x22')](function(_0x238524){_0x2577f8['count']=_0x238524;if(_0x473a73['query'][_0x4136('0x3f')]){_0x1d1e61[_0x4136('0x40')]=[{'all':!![]}];}return db[_0x4136('0x3e')][_0x4136('0x41')](_0x1d1e61);})[_0x4136('0x22')](function(_0x2f6183){_0x2577f8[_0x4136('0x42')]=_0x2f6183;return _0x2577f8;})[_0x4136('0x22')](respondWithFilteredResult(_0x4801f0,_0x1d1e61))[_0x4136('0x43')](handleError(_0x4801f0,null));};exports['show']=function(_0x373030,_0x5de6e0){var _0xb6d7ca={'raw':![],'where':{'id':_0x373030[_0x4136('0x44')]['id']}},_0x5b9891={};_0x5b9891['model']=_[_0x4136('0x32')](db[_0x4136('0x3e')][_0x4136('0x2c')]);_0x5b9891['query']=_['keys'](_0x373030[_0x4136('0x31')]);_0x5b9891[_0x4136('0x33')]=_[_0x4136('0x34')](_0x5b9891[_0x4136('0x30')],_0x5b9891[_0x4136('0x31')]);_0xb6d7ca[_0x4136('0x35')]=_[_0x4136('0x34')](_0x5b9891[_0x4136('0x30')],qs[_0x4136('0x36')](_0x373030[_0x4136('0x31')][_0x4136('0x36')]));_0xb6d7ca['attributes']=_0xb6d7ca[_0x4136('0x35')]['length']?_0xb6d7ca[_0x4136('0x35')]:_0x5b9891[_0x4136('0x30')];if(_0x373030[_0x4136('0x31')][_0x4136('0x3f')]){_0xb6d7ca[_0x4136('0x40')]=[{'all':!![]}];}_0xb6d7ca=_[_0x4136('0x3d')]({},_0xb6d7ca,_0x373030['options']);return db['JscriptyProject'][_0x4136('0x45')](_0xb6d7ca)[_0x4136('0x22')](handleEntityNotFound(_0x5de6e0,null))[_0x4136('0x22')](respondWithResult(_0x5de6e0,null))[_0x4136('0x43')](handleError(_0x5de6e0,null));};exports[_0x4136('0x46')]=function(_0x10e0bf,_0x41d62a){return db[_0x4136('0x3e')][_0x4136('0x46')](_0x10e0bf[_0x4136('0x47')],{})['then'](function(_0x15a27f){var _0x29ef9d=_0x10e0bf[_0x4136('0x48')][_0x4136('0x24')]({'plain':!![]});if(!_0x29ef9d)throw new Error(_0x4136('0x49'));if(_0x29ef9d[_0x4136('0x4a')]===_0x4136('0x48')){var _0x16c780=_0x15a27f['get']({'plain':!![]});var _0x12df69=_0x4136('0x25');return db['UserProfileSection'][_0x4136('0x45')]({'where':{'name':_0x12df69,'userProfileId':_0x29ef9d[_0x4136('0x4b')]},'raw':!![]})[_0x4136('0x22')](function(_0x2f0bf8){if(_0x2f0bf8&&_0x2f0bf8[_0x4136('0x4c')]===0x0){return db['UserProfileResource'][_0x4136('0x46')]({'name':_0x16c780[_0x4136('0x29')],'resourceId':_0x16c780['id'],'type':_0x2f0bf8['name'],'sectionId':_0x2f0bf8['id']},{})[_0x4136('0x22')](function(){return _0x15a27f;});}else{return _0x15a27f;}})[_0x4136('0x43')](function(_0x1153b6){logger[_0x4136('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1153b6);throw _0x1153b6;});}return _0x15a27f;})[_0x4136('0x22')](respondWithResult(_0x41d62a,0xc9))[_0x4136('0x43')](handleError(_0x41d62a,null));};exports[_0x4136('0x4d')]=function(_0x4d43bf,_0x561c34){var _0x44c254={'where':{'id':_0x4d43bf['params']['id']}},_0x48f0cc={};_0x48f0cc['model']=_[_0x4136('0x32')](db[_0x4136('0x3e')][_0x4136('0x2c')]);_0x44c254[_0x4136('0x35')]=_[_0x4136('0x34')](_0x48f0cc[_0x4136('0x30')],qs[_0x4136('0x36')](_0x4d43bf[_0x4136('0x31')][_0x4136('0x36')]));_0x44c254['attributes']=_0x44c254['attributes'][_0x4136('0x37')]?_0x44c254[_0x4136('0x35')]:_0x48f0cc['model'];if(_0x4d43bf[_0x4136('0x31')][_0x4136('0x3f')]){_0x44c254[_0x4136('0x40')]=[{'all':!![]}];}_0x44c254=_['merge']({},_0x44c254,_0x4d43bf[_0x4136('0x4e')]);return db['JscriptyProject'][_0x4136('0x45')](_0x44c254)[_0x4136('0x22')](handleEntityNotFound(_0x561c34,null))[_0x4136('0x22')](function(_0x4df6ae){if(_0x4df6ae){var _0x2e4de6=_0x4df6ae[_0x4136('0x24')]({'plain':!![]});_0x2e4de6=qs[_0x4136('0x4f')](_0x2e4de6,['id',_0x4136('0x50'),_0x4136('0x51')]);_0x4d43bf['body']=_[_0x4136('0x4f')](_0x4d43bf[_0x4136('0x47')],['id','createdAt',_0x4136('0x51')]);return db['JscriptyProject']['create'](_[_0x4136('0x3d')](_0x2e4de6,_0x4d43bf[_0x4136('0x47')]),{'include':_0x4d43bf[_0x4136('0x31')][_0x4136('0x3f')]?[{'all':!![]}]:undefined})[_0x4136('0x22')](function(_0x1199c1){var _0x36d580=_0x4d43bf[_0x4136('0x48')][_0x4136('0x24')]({'plain':!![]});if(!_0x36d580)throw new Error(_0x4136('0x49'));if(_0x36d580['role']===_0x4136('0x48')){var _0x255a33=_0x1199c1[_0x4136('0x24')]({'plain':!![]});var _0x46d3b7=_0x4136('0x25');return db[_0x4136('0x52')][_0x4136('0x45')]({'where':{'name':_0x46d3b7,'userProfileId':_0x36d580[_0x4136('0x4b')]},'raw':!![]})[_0x4136('0x22')](function(_0x28ee6f){if(_0x28ee6f&&_0x28ee6f[_0x4136('0x4c')]===0x0){return db[_0x4136('0x26')][_0x4136('0x46')]({'name':_0x255a33[_0x4136('0x29')],'resourceId':_0x255a33['id'],'type':_0x28ee6f[_0x4136('0x29')],'sectionId':_0x28ee6f['id']},{})[_0x4136('0x22')](function(){return _0x1199c1;});}else{return _0x1199c1;}})[_0x4136('0x43')](function(_0xce9712){logger[_0x4136('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xce9712);throw _0xce9712;});}return _0x1199c1;});}})[_0x4136('0x22')](respondWithResult(_0x561c34,0xc9))['catch'](handleError(_0x561c34,null));};exports[_0x4136('0x21')]=function(_0x336436,_0x2d3f9c){if(_0x336436[_0x4136('0x47')]['id']){delete _0x336436[_0x4136('0x47')]['id'];}return db['JscriptyProject'][_0x4136('0x45')]({'where':{'id':_0x336436[_0x4136('0x44')]['id']}})[_0x4136('0x22')](handleEntityNotFound(_0x2d3f9c,null))[_0x4136('0x22')](saveUpdates(_0x336436[_0x4136('0x47')],null))[_0x4136('0x22')](respondWithResult(_0x2d3f9c,null))[_0x4136('0x43')](handleError(_0x2d3f9c,null));};exports[_0x4136('0x23')]=function(_0x2c5846,_0x1e2959){return db[_0x4136('0x3e')][_0x4136('0x45')]({'where':{'id':_0x2c5846[_0x4136('0x44')]['id']}})[_0x4136('0x22')](handleEntityNotFound(_0x1e2959,null))['then'](removeEntity(_0x1e2959,null))[_0x4136('0x43')](handleError(_0x1e2959,null));};exports[_0x4136('0x53')]=function(_0x379c85,_0x5847d5,_0x3e873b){var _0x3c9004={'raw':!![],'where':{}};var _0x461c00={};var _0x6482f={'count':0x0,'rows':[]};return db[_0x4136('0x3e')][_0x4136('0x54')]({'where':{'id':_0x379c85[_0x4136('0x44')]['id']}})[_0x4136('0x22')](handleEntityNotFound(_0x5847d5,null))[_0x4136('0x22')](function(_0x296f23){if(_0x296f23){_0x461c00[_0x4136('0x30')]=_[_0x4136('0x32')](db[_0x4136('0x55')][_0x4136('0x2c')]);_0x461c00['query']=_[_0x4136('0x32')](_0x379c85['query']);_0x461c00[_0x4136('0x33')]=_[_0x4136('0x34')](_0x461c00[_0x4136('0x30')],_0x461c00[_0x4136('0x31')]);_0x3c9004['attributes']=_[_0x4136('0x34')](_0x461c00[_0x4136('0x30')],qs['fields'](_0x379c85[_0x4136('0x31')][_0x4136('0x36')]));_0x3c9004['attributes']=_0x3c9004['attributes'][_0x4136('0x37')]?_0x3c9004[_0x4136('0x35')]:_0x461c00[_0x4136('0x30')];if(!_0x379c85[_0x4136('0x31')][_0x4136('0x56')](_0x4136('0x38'))){_0x3c9004[_0x4136('0x39')]=qs['limit'](_0x379c85['query'][_0x4136('0x39')]);_0x3c9004[_0x4136('0x1c')]=qs[_0x4136('0x1c')](_0x379c85[_0x4136('0x31')][_0x4136('0x1c')]);}_0x3c9004[_0x4136('0x3a')]=qs[_0x4136('0x3b')](_0x379c85[_0x4136('0x31')][_0x4136('0x3b')]);_0x3c9004[_0x4136('0x3c')]=qs[_0x4136('0x33')](_[_0x4136('0x57')](_0x379c85[_0x4136('0x31')],_0x461c00[_0x4136('0x33')]));_0x3c9004[_0x4136('0x3c')][_0x4136('0x58')]=_0x296f23['id'];if(_0x379c85['query'][_0x4136('0x59')]){_0x3c9004['where']=_[_0x4136('0x3d')](_0x3c9004[_0x4136('0x3c')],{'$or':_[_0x4136('0x2b')](_0x3c9004['attributes'],function(_0x5f38bf){var _0x49fb5f={};_0x49fb5f[_0x5f38bf]={'$like':'%'+_0x379c85[_0x4136('0x31')][_0x4136('0x59')]+'%'};return _0x49fb5f;})});}_0x3c9004=_['merge']({},_0x3c9004,_0x379c85['options']);return db[_0x4136('0x55')][_0x4136('0x1b')]({'where':_0x3c9004['where']})[_0x4136('0x22')](function(_0x1b3411){_0x6482f[_0x4136('0x1b')]=_0x1b3411;if(_0x379c85[_0x4136('0x31')]['includeAll']){_0x3c9004[_0x4136('0x40')]=[{'all':!![]}];}return db[_0x4136('0x55')][_0x4136('0x41')](_0x3c9004);})[_0x4136('0x22')](function(_0x42c9a2){_0x6482f[_0x4136('0x42')]=_0x42c9a2;return _0x6482f;});}})[_0x4136('0x22')](respondWithFilteredResult(_0x5847d5,_0x3c9004))[_0x4136('0x43')](handleError(_0x5847d5,null));};exports[_0x4136('0x5a')]=function(_0x34567f,_0x3de663,_0x49d744){var _0x4daa7a={'raw':!![],'where':{}};var _0x3ab949={};var _0xc7069={'count':0x0,'rows':[]};return db[_0x4136('0x3e')][_0x4136('0x54')]({'where':{'id':_0x34567f['params']['id']}})[_0x4136('0x22')](handleEntityNotFound(_0x3de663,null))[_0x4136('0x22')](function(_0x5ab8c7){if(_0x5ab8c7){_0x3ab949[_0x4136('0x30')]=_[_0x4136('0x32')](db[_0x4136('0x5b')][_0x4136('0x2c')]);_0x3ab949[_0x4136('0x31')]=_[_0x4136('0x32')](_0x34567f['query']);_0x3ab949['filters']=_[_0x4136('0x34')](_0x3ab949['model'],_0x3ab949[_0x4136('0x31')]);_0x4daa7a[_0x4136('0x35')]=_[_0x4136('0x34')](_0x3ab949[_0x4136('0x30')],qs[_0x4136('0x36')](_0x34567f[_0x4136('0x31')][_0x4136('0x36')]));_0x4daa7a['attributes']=_0x4daa7a[_0x4136('0x35')]['length']?_0x4daa7a[_0x4136('0x35')]:_0x3ab949['model'];if(!_0x34567f[_0x4136('0x31')][_0x4136('0x56')]('nolimit')){_0x4daa7a[_0x4136('0x39')]=qs['limit'](_0x34567f[_0x4136('0x31')]['limit']);_0x4daa7a[_0x4136('0x1c')]=qs['offset'](_0x34567f['query'][_0x4136('0x1c')]);}_0x4daa7a[_0x4136('0x3a')]=qs[_0x4136('0x3b')](_0x34567f[_0x4136('0x31')][_0x4136('0x3b')]);_0x4daa7a['where']=qs[_0x4136('0x33')](_[_0x4136('0x57')](_0x34567f[_0x4136('0x31')],_0x3ab949['filters']));_0x4daa7a[_0x4136('0x3c')]['ProjectId']=_0x5ab8c7['id'];if(_0x34567f[_0x4136('0x31')][_0x4136('0x59')]){_0x4daa7a[_0x4136('0x3c')]=_['merge'](_0x4daa7a['where'],{'$or':_['map'](_0x4daa7a[_0x4136('0x35')],function(_0x41b80d){var _0x52b782={};_0x52b782[_0x41b80d]={'$like':'%'+_0x34567f[_0x4136('0x31')][_0x4136('0x59')]+'%'};return _0x52b782;})});}_0x4daa7a=_['merge']({},_0x4daa7a,_0x34567f[_0x4136('0x4e')]);return db[_0x4136('0x5b')]['count']({'where':_0x4daa7a[_0x4136('0x3c')]})[_0x4136('0x22')](function(_0x5e2fe6){_0xc7069[_0x4136('0x1b')]=_0x5e2fe6;if(_0x34567f[_0x4136('0x31')][_0x4136('0x3f')]){_0x4daa7a['include']=[{'all':!![]}];}return db[_0x4136('0x5b')][_0x4136('0x41')](_0x4daa7a);})[_0x4136('0x22')](function(_0x5c4d0e){_0xc7069[_0x4136('0x42')]=_0x5c4d0e;return _0xc7069;});}})[_0x4136('0x22')](respondWithFilteredResult(_0x3de663,_0x4daa7a))['catch'](handleError(_0x3de663,null));};function char(_0x391914){return'number'===typeof _0x391914?String[_0x4136('0x5c')][_0x4136('0x1f')](null,arguments):_0x391914;}function needsEncapsulation(_0x1c2336){return!!_0x1c2336&&(_0x1c2336[_0x4136('0x5d')]()[_0x4136('0x5e')](char(0xd))>=0x0||_0x1c2336['toString']()['indexOf'](char(0xa))>=0x0||_0x1c2336[_0x4136('0x5d')]()[_0x4136('0x5e')](char(0x2c))>=0x0||_0x1c2336[_0x4136('0x5d')]()[_0x4136('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x1e5c30){var _0x2b0d66=char(0x22),_0xb5ce9e='\x5c'+char(0x22),_0x560e7d=_0x1e5c30[_0x4136('0x5d')]()[_0x4136('0x5f')](new RegExp(_0x2b0d66,'g'),_0xb5ce9e);return _0x2b0d66+_0x560e7d+_0x2b0d66;}exports[_0x4136('0x60')]=function(_0x175b30,_0x526ff8,_0x1df346){var _0x215405,_0x3898c0;var _0xee0402={'where':{'ProjectId':_0x175b30[_0x4136('0x44')]['id']}};if(_0x175b30[_0x4136('0x31')]['startTime']){_0xee0402[_0x4136('0x3c')][_0x4136('0x61')]=JSON[_0x4136('0x62')](_0x175b30[_0x4136('0x31')][_0x4136('0x63')]);}return db[_0x4136('0x55')][_0x4136('0x41')](_0xee0402)[_0x4136('0x22')](handleEntityNotFound(_0x526ff8,null))[_0x4136('0x22')](function(_0x4d54d7){if(_0x4d54d7){_0x215405=_0x4d54d7;return db[_0x4136('0x64')]['findAll']({'where':{'SessionId':{'$in':_[_0x4136('0x2b')](_0x215405,'id')},'ProjectId':_0x175b30[_0x4136('0x44')]['id']},'order':_0x4136('0x65')});}})[_0x4136('0x22')](handleEntityNotFound(_0x526ff8,null))['then'](function(_0x11d089){if(_0x11d089){_0x3898c0=_0x11d089;var _0x1a91ca={};for(var _0x237bcf=0x0,_0x97f1c5=_0x3898c0[_0x4136('0x37')];_0x237bcf<_0x97f1c5;_0x237bcf++){if(!_0x1a91ca[_0x4136('0x56')](_0x3898c0[_0x237bcf][_0x4136('0x66')])){_0x1a91ca[_0x3898c0[_0x237bcf]['questionId']]=needsEncapsulation(_0x3898c0[_0x237bcf][_0x4136('0x67')])?encapsulate(_0x3898c0[_0x237bcf][_0x4136('0x67')]):_0x3898c0[_0x237bcf][_0x4136('0x67')];}}var _0x57979f=[],_0x2e1908={};for(var _0x205bac=0x0,_0x5c6145=_0x215405['length'];_0x205bac<_0x5c6145;_0x205bac++){_0x2e1908={'ProjectId':_0x175b30['params']['id'],'SessionId':_0x215405[_0x205bac]['id'],'StartTime':moment(_0x215405[_0x205bac][_0x4136('0x61')])['format'](_0x4136('0x68'))};for(var _0x440dff=0x0,_0x8d33ca=_0x3898c0[_0x4136('0x37')];_0x440dff<_0x8d33ca;_0x440dff++){if(_0x3898c0[_0x440dff][_0x4136('0x69')]==_0x215405[_0x205bac]['id']&&_0x1a91ca[_0x4136('0x56')](_0x3898c0[_0x440dff][_0x4136('0x66')])){_0x2e1908[_0x1a91ca[_0x3898c0[_0x440dff][_0x4136('0x66')]]]=_0x3898c0[_0x440dff][_0x4136('0x6a')];}}for(var _0x548742 in _0x1a91ca){if(!_0x2e1908[_0x4136('0x56')](_0x1a91ca[_0x548742])){_0x2e1908[_0x1a91ca[_0x548742]]=null;}}_0x57979f[_0x4136('0x6b')](_0x2e1908);}return _0x57979f;}})[_0x4136('0x22')](function(_0x5239b6){if(!_[_0x4136('0x6c')](_0x5239b6)){var _0x13183d=toCsv(_0x5239b6);var _0x3f4cf3=Date['now']();fs[_0x4136('0x6d')](util[_0x4136('0x6e')](_0x4136('0x6f'),_0x175b30[_0x4136('0x44')]['id'],_0x3f4cf3),_0x13183d);_0x526ff8[_0x4136('0x70')](_0x4136('0x71'),'attachment;\x20filename='+util[_0x4136('0x6e')](_0x4136('0x72'),_0x175b30['params']['id'],_0x3f4cf3));_0x526ff8[_0x4136('0x70')]('Content-type',_0x4136('0x73'));return _0x526ff8[_0x4136('0x74')](util[_0x4136('0x6e')](_0x4136('0x6f'),_0x175b30['params']['id'],_0x3f4cf3));}else{return _0x526ff8[_0x4136('0x17')](0xcc);}})[_0x4136('0x43')](handleError(_0x526ff8,null));}; \ No newline at end of file +var _0x6ea9=['YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','isEmpty','now','writeFileSync','format','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','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','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','Projects','end','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','JscriptyProject','includeAll','include','findAll','rows','catch','params','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','body','omit','userProfileId','update','getSessions','findOne','JscriptySessionReport','JscriptyAnswerReport','ProjectId','number','fromCharCode','toString','indexOf','replace','startTime','starttime','parse','-createdAt','questionId','question'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x6ea9,0x89));var _0x96ea=function(_0x3fc2c9,_0x4fbfc5){_0x3fc2c9=_0x3fc2c9-0x0;var _0x13547d=_0x6ea9[_0x3fc2c9];return _0x13547d;};'use strict';var emlformat=require(_0x96ea('0x0'));var rimraf=require(_0x96ea('0x1'));var zipdir=require(_0x96ea('0x2'));var jsonpatch=require(_0x96ea('0x3'));var rp=require(_0x96ea('0x4'));var moment=require('moment');var BPromise=require(_0x96ea('0x5'));var Mustache=require(_0x96ea('0x6'));var util=require(_0x96ea('0x7'));var path=require('path');var sox=require(_0x96ea('0x8'));var csv=require('to-csv');var ejs=require(_0x96ea('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x96ea('0xa'));var squel=require('squel');var crypto=require(_0x96ea('0xb'));var jsforce=require(_0x96ea('0xc'));var deskjs=require(_0x96ea('0xd'));var toCsv=require(_0x96ea('0xe'));var querystring=require(_0x96ea('0xf'));var Papa=require(_0x96ea('0x10'));var Redis=require('ioredis');var authService=require(_0x96ea('0x11'));var qs=require(_0x96ea('0x12'));var as=require(_0x96ea('0x13'));var hardwareService=require(_0x96ea('0x14'));var logger=require(_0x96ea('0x15'))(_0x96ea('0x16'));var utils=require(_0x96ea('0x17'));var config=require(_0x96ea('0x18'));var licenseUtil=require(_0x96ea('0x19'));var db=require(_0x96ea('0x1a'))['db'];function respondWithStatusCode(_0x593f80,_0x2384b1){_0x2384b1=_0x2384b1||0xcc;return function(_0x5f4c12){if(_0x5f4c12){return _0x593f80[_0x96ea('0x1b')](_0x2384b1);}return _0x593f80[_0x96ea('0x1c')](_0x2384b1)['end']();};}function respondWithResult(_0x1df101,_0x1ce6e9){_0x1ce6e9=_0x1ce6e9||0xc8;return function(_0xc1059e){if(_0xc1059e){return _0x1df101[_0x96ea('0x1c')](_0x1ce6e9)[_0x96ea('0x1d')](_0xc1059e);}};}function respondWithFilteredResult(_0x19308f,_0x1dd4f1){return function(_0x237f2c){if(_0x237f2c){var _0x4a847d=typeof _0x1dd4f1[_0x96ea('0x1e')]==='undefined'&&typeof _0x1dd4f1['limit']===_0x96ea('0x1f');var _0x3cb1e0=_0x237f2c['count'];var _0x47444c=_0x4a847d?0x0:_0x1dd4f1[_0x96ea('0x1e')];var _0x24c940=_0x4a847d?_0x237f2c[_0x96ea('0x20')]:_0x1dd4f1[_0x96ea('0x1e')]+_0x1dd4f1[_0x96ea('0x21')];var _0x43dd6f;if(_0x24c940>=_0x3cb1e0){_0x24c940=_0x3cb1e0;_0x43dd6f=0xc8;}else{_0x43dd6f=0xce;}_0x19308f['status'](_0x43dd6f);return _0x19308f['set'](_0x96ea('0x22'),_0x47444c+'-'+_0x24c940+'/'+_0x3cb1e0)[_0x96ea('0x1d')](_0x237f2c);}return null;};}function patchUpdates(_0xfaec11){return function(_0x1e1bcd){try{jsonpatch[_0x96ea('0x23')](_0x1e1bcd,_0xfaec11,!![]);}catch(_0xa3941){return BPromise[_0x96ea('0x24')](_0xa3941);}return _0x1e1bcd[_0x96ea('0x25')]();};}function saveUpdates(_0x2235e7,_0x3a618c){return function(_0x3a99f6){if(_0x3a99f6){return _0x3a99f6['update'](_0x2235e7)[_0x96ea('0x26')](function(_0x22cdc4){return _0x22cdc4;});}return null;};}function removeEntity(_0x3dc8bd,_0x3634e7){return function(_0x396117){if(_0x396117){return _0x396117[_0x96ea('0x27')]()['then'](function(){var _0x33e05b=_0x396117['get']({'plain':!![]});var _0x36143a=_0x96ea('0x28');return db['UserProfileResource']['destroy']({'where':{'type':_0x36143a,'resourceId':_0x33e05b['id']}})[_0x96ea('0x26')](function(){return _0x396117;});})[_0x96ea('0x26')](function(){_0x3dc8bd[_0x96ea('0x1c')](0xcc)[_0x96ea('0x29')]();});}};}function handleEntityNotFound(_0x197af7,_0x49a7bd){return function(_0xf31340){if(!_0xf31340){_0x197af7[_0x96ea('0x1b')](0x194);}return _0xf31340;};}function handleError(_0x108043,_0x247c8c){_0x247c8c=_0x247c8c||0x1f4;return function(_0x2aa9e9){logger[_0x96ea('0x2a')](_0x2aa9e9[_0x96ea('0x2b')]);if(_0x2aa9e9[_0x96ea('0x2c')]){delete _0x2aa9e9[_0x96ea('0x2c')];}_0x108043[_0x96ea('0x1c')](_0x247c8c)[_0x96ea('0x2d')](_0x2aa9e9);};}exports[_0x96ea('0x2e')]=function(_0x91a2a2,_0x30ec3f){var _0x1c6f08={},_0x5a73a2={},_0x114450={'count':0x0,'rows':[]};var _0x13be02=_[_0x96ea('0x2f')](db['JscriptyProject'][_0x96ea('0x30')],function(_0x4e60e8){return{'name':_0x4e60e8['fieldName'],'type':_0x4e60e8[_0x96ea('0x31')][_0x96ea('0x32')]};});_0x5a73a2['model']=_[_0x96ea('0x2f')](_0x13be02,_0x96ea('0x2c'));_0x5a73a2[_0x96ea('0x33')]=_[_0x96ea('0x34')](_0x91a2a2[_0x96ea('0x33')]);_0x5a73a2[_0x96ea('0x35')]=_[_0x96ea('0x36')](_0x5a73a2[_0x96ea('0x37')],_0x5a73a2['query']);_0x1c6f08[_0x96ea('0x38')]=_[_0x96ea('0x36')](_0x5a73a2['model'],qs[_0x96ea('0x39')](_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x39')]));_0x1c6f08[_0x96ea('0x38')]=_0x1c6f08[_0x96ea('0x38')][_0x96ea('0x3a')]?_0x1c6f08[_0x96ea('0x38')]:_0x5a73a2['model'];if(!_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x3b')](_0x96ea('0x3c'))){_0x1c6f08[_0x96ea('0x21')]=qs[_0x96ea('0x21')](_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x21')]);_0x1c6f08[_0x96ea('0x1e')]=qs[_0x96ea('0x1e')](_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x1e')]);}_0x1c6f08[_0x96ea('0x3d')]=qs[_0x96ea('0x3e')](_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x3e')]);_0x1c6f08[_0x96ea('0x3f')]=qs[_0x96ea('0x35')](_[_0x96ea('0x40')](_0x91a2a2[_0x96ea('0x33')],_0x5a73a2['filters']),_0x13be02);if(_0x91a2a2[_0x96ea('0x33')]['filter']){_0x1c6f08[_0x96ea('0x3f')]=_[_0x96ea('0x41')](_0x1c6f08[_0x96ea('0x3f')],{'$or':_[_0x96ea('0x2f')](_0x13be02,function(_0x2b9966){if(_0x2b9966['type']!==_0x96ea('0x42')){var _0x35266f={};_0x35266f[_0x2b9966[_0x96ea('0x2c')]]={'$like':'%'+_0x91a2a2['query'][_0x96ea('0x43')]+'%'};return _0x35266f;}})});}_0x1c6f08=_['merge']({},_0x1c6f08,_0x91a2a2[_0x96ea('0x44')]);var _0x47ed8e={'where':_0x1c6f08['where']};return db[_0x96ea('0x45')][_0x96ea('0x20')](_0x47ed8e)[_0x96ea('0x26')](function(_0x249456){_0x114450['count']=_0x249456;if(_0x91a2a2[_0x96ea('0x33')][_0x96ea('0x46')]){_0x1c6f08[_0x96ea('0x47')]=[{'all':!![]}];}return db[_0x96ea('0x45')][_0x96ea('0x48')](_0x1c6f08);})['then'](function(_0x5a346a){_0x114450[_0x96ea('0x49')]=_0x5a346a;return _0x114450;})[_0x96ea('0x26')](respondWithFilteredResult(_0x30ec3f,_0x1c6f08))[_0x96ea('0x4a')](handleError(_0x30ec3f,null));};exports['show']=function(_0x3d46ec,_0x2430b8){var _0x496dd9={'raw':![],'where':{'id':_0x3d46ec[_0x96ea('0x4b')]['id']}},_0x48d9be={};_0x48d9be[_0x96ea('0x37')]=_['keys'](db['JscriptyProject'][_0x96ea('0x30')]);_0x48d9be[_0x96ea('0x33')]=_[_0x96ea('0x34')](_0x3d46ec['query']);_0x48d9be[_0x96ea('0x35')]=_[_0x96ea('0x36')](_0x48d9be[_0x96ea('0x37')],_0x48d9be[_0x96ea('0x33')]);_0x496dd9['attributes']=_[_0x96ea('0x36')](_0x48d9be[_0x96ea('0x37')],qs[_0x96ea('0x39')](_0x3d46ec['query'][_0x96ea('0x39')]));_0x496dd9[_0x96ea('0x38')]=_0x496dd9[_0x96ea('0x38')]['length']?_0x496dd9[_0x96ea('0x38')]:_0x48d9be[_0x96ea('0x37')];if(_0x3d46ec[_0x96ea('0x33')][_0x96ea('0x46')]){_0x496dd9[_0x96ea('0x47')]=[{'all':!![]}];}_0x496dd9=_[_0x96ea('0x41')]({},_0x496dd9,_0x3d46ec[_0x96ea('0x44')]);return db['JscriptyProject']['find'](_0x496dd9)[_0x96ea('0x26')](handleEntityNotFound(_0x2430b8,null))[_0x96ea('0x26')](respondWithResult(_0x2430b8,null))[_0x96ea('0x4a')](handleError(_0x2430b8,null));};exports[_0x96ea('0x4c')]=function(_0x31a8af,_0xf921c5){return db[_0x96ea('0x45')]['create'](_0x31a8af['body'],{})[_0x96ea('0x26')](function(_0x131395){var _0x351440=_0x31a8af[_0x96ea('0x4d')][_0x96ea('0x4e')]({'plain':!![]});if(!_0x351440)throw new Error(_0x96ea('0x4f'));if(_0x351440[_0x96ea('0x50')]==='user'){var _0x440b35=_0x131395[_0x96ea('0x4e')]({'plain':!![]});var _0x5dc96a=_0x96ea('0x28');return db[_0x96ea('0x51')][_0x96ea('0x52')]({'where':{'name':_0x5dc96a,'userProfileId':_0x351440['userProfileId']},'raw':!![]})['then'](function(_0x4b15af){if(_0x4b15af&&_0x4b15af[_0x96ea('0x53')]===0x0){return db[_0x96ea('0x54')][_0x96ea('0x4c')]({'name':_0x440b35[_0x96ea('0x2c')],'resourceId':_0x440b35['id'],'type':_0x4b15af[_0x96ea('0x2c')],'sectionId':_0x4b15af['id']},{})[_0x96ea('0x26')](function(){return _0x131395;});}else{return _0x131395;}})['catch'](function(_0x3ef29b){logger[_0x96ea('0x2a')](_0x96ea('0x55'),_0x3ef29b);throw _0x3ef29b;});}return _0x131395;})['then'](respondWithResult(_0xf921c5,0xc9))[_0x96ea('0x4a')](handleError(_0xf921c5,null));};exports[_0x96ea('0x56')]=function(_0x9e64c4,_0x28db59){var _0x2faa1f={'where':{'id':_0x9e64c4['params']['id']}},_0x26e92f={};_0x26e92f['model']=_['keys'](db[_0x96ea('0x45')]['rawAttributes']);_0x2faa1f[_0x96ea('0x38')]=_[_0x96ea('0x36')](_0x26e92f[_0x96ea('0x37')],qs[_0x96ea('0x39')](_0x9e64c4[_0x96ea('0x33')]['fields']));_0x2faa1f[_0x96ea('0x38')]=_0x2faa1f['attributes'][_0x96ea('0x3a')]?_0x2faa1f['attributes']:_0x26e92f[_0x96ea('0x37')];if(_0x9e64c4[_0x96ea('0x33')][_0x96ea('0x46')]){_0x2faa1f[_0x96ea('0x47')]=[{'all':!![]}];}_0x2faa1f=_[_0x96ea('0x41')]({},_0x2faa1f,_0x9e64c4[_0x96ea('0x44')]);return db['JscriptyProject'][_0x96ea('0x52')](_0x2faa1f)[_0x96ea('0x26')](handleEntityNotFound(_0x28db59,null))[_0x96ea('0x26')](function(_0x31a532){if(_0x31a532){var _0x3ed8eb=_0x31a532[_0x96ea('0x4e')]({'plain':!![]});_0x3ed8eb=qs['omit'](_0x3ed8eb,['id',_0x96ea('0x57'),_0x96ea('0x58')]);_0x9e64c4[_0x96ea('0x59')]=_[_0x96ea('0x5a')](_0x9e64c4['body'],['id',_0x96ea('0x57'),_0x96ea('0x58')]);return db[_0x96ea('0x45')][_0x96ea('0x4c')](_[_0x96ea('0x41')](_0x3ed8eb,_0x9e64c4[_0x96ea('0x59')]),{'include':_0x9e64c4[_0x96ea('0x33')][_0x96ea('0x46')]?[{'all':!![]}]:undefined})['then'](function(_0x5744b7){var _0x3d9461=_0x9e64c4[_0x96ea('0x4d')]['get']({'plain':!![]});if(!_0x3d9461)throw new Error(_0x96ea('0x4f'));if(_0x3d9461[_0x96ea('0x50')]===_0x96ea('0x4d')){var _0x34cc52=_0x5744b7['get']({'plain':!![]});var _0x73a0f6=_0x96ea('0x28');return db['UserProfileSection'][_0x96ea('0x52')]({'where':{'name':_0x73a0f6,'userProfileId':_0x3d9461[_0x96ea('0x5b')]},'raw':!![]})['then'](function(_0x246392){if(_0x246392&&_0x246392['autoAssociation']===0x0){return db[_0x96ea('0x54')][_0x96ea('0x4c')]({'name':_0x34cc52[_0x96ea('0x2c')],'resourceId':_0x34cc52['id'],'type':_0x246392[_0x96ea('0x2c')],'sectionId':_0x246392['id']},{})[_0x96ea('0x26')](function(){return _0x5744b7;});}else{return _0x5744b7;}})[_0x96ea('0x4a')](function(_0x1d199f){logger[_0x96ea('0x2a')](_0x96ea('0x55'),_0x1d199f);throw _0x1d199f;});}return _0x5744b7;});}})[_0x96ea('0x26')](respondWithResult(_0x28db59,0xc9))['catch'](handleError(_0x28db59,null));};exports[_0x96ea('0x5c')]=function(_0x2536ff,_0x38e94f){if(_0x2536ff[_0x96ea('0x59')]['id']){delete _0x2536ff['body']['id'];}return db['JscriptyProject']['find']({'where':{'id':_0x2536ff[_0x96ea('0x4b')]['id']}})[_0x96ea('0x26')](handleEntityNotFound(_0x38e94f,null))['then'](saveUpdates(_0x2536ff[_0x96ea('0x59')],null))['then'](respondWithResult(_0x38e94f,null))['catch'](handleError(_0x38e94f,null));};exports[_0x96ea('0x27')]=function(_0x42fd19,_0x37756d){return db[_0x96ea('0x45')][_0x96ea('0x52')]({'where':{'id':_0x42fd19[_0x96ea('0x4b')]['id']}})[_0x96ea('0x26')](handleEntityNotFound(_0x37756d,null))['then'](removeEntity(_0x37756d,null))[_0x96ea('0x4a')](handleError(_0x37756d,null));};exports[_0x96ea('0x5d')]=function(_0x22a4d2,_0x4960ea,_0x4f6831){var _0x3701b5={'raw':!![],'where':{}};var _0x1737d3={};var _0x25f8ee={'count':0x0,'rows':[]};return db[_0x96ea('0x45')][_0x96ea('0x5e')]({'where':{'id':_0x22a4d2[_0x96ea('0x4b')]['id']}})[_0x96ea('0x26')](handleEntityNotFound(_0x4960ea,null))[_0x96ea('0x26')](function(_0xd56ef0){if(_0xd56ef0){_0x1737d3['model']=_[_0x96ea('0x34')](db[_0x96ea('0x5f')][_0x96ea('0x30')]);_0x1737d3['query']=_[_0x96ea('0x34')](_0x22a4d2['query']);_0x1737d3[_0x96ea('0x35')]=_[_0x96ea('0x36')](_0x1737d3[_0x96ea('0x37')],_0x1737d3[_0x96ea('0x33')]);_0x3701b5[_0x96ea('0x38')]=_[_0x96ea('0x36')](_0x1737d3[_0x96ea('0x37')],qs['fields'](_0x22a4d2[_0x96ea('0x33')]['fields']));_0x3701b5[_0x96ea('0x38')]=_0x3701b5['attributes'][_0x96ea('0x3a')]?_0x3701b5['attributes']:_0x1737d3['model'];if(!_0x22a4d2[_0x96ea('0x33')]['hasOwnProperty'](_0x96ea('0x3c'))){_0x3701b5[_0x96ea('0x21')]=qs[_0x96ea('0x21')](_0x22a4d2[_0x96ea('0x33')][_0x96ea('0x21')]);_0x3701b5['offset']=qs['offset'](_0x22a4d2['query']['offset']);}_0x3701b5['order']=qs[_0x96ea('0x3e')](_0x22a4d2['query'][_0x96ea('0x3e')]);_0x3701b5[_0x96ea('0x3f')]=qs[_0x96ea('0x35')](_['pick'](_0x22a4d2[_0x96ea('0x33')],_0x1737d3[_0x96ea('0x35')]));_0x3701b5[_0x96ea('0x3f')]['ProjectId']=_0xd56ef0['id'];if(_0x22a4d2['query'][_0x96ea('0x43')]){_0x3701b5[_0x96ea('0x3f')]=_[_0x96ea('0x41')](_0x3701b5[_0x96ea('0x3f')],{'$or':_[_0x96ea('0x2f')](_0x3701b5['attributes'],function(_0x35401a){var _0x566692={};_0x566692[_0x35401a]={'$like':'%'+_0x22a4d2['query'][_0x96ea('0x43')]+'%'};return _0x566692;})});}_0x3701b5=_['merge']({},_0x3701b5,_0x22a4d2['options']);return db[_0x96ea('0x5f')]['count']({'where':_0x3701b5[_0x96ea('0x3f')]})[_0x96ea('0x26')](function(_0x3f2eab){_0x25f8ee[_0x96ea('0x20')]=_0x3f2eab;if(_0x22a4d2[_0x96ea('0x33')][_0x96ea('0x46')]){_0x3701b5[_0x96ea('0x47')]=[{'all':!![]}];}return db[_0x96ea('0x5f')][_0x96ea('0x48')](_0x3701b5);})['then'](function(_0x33534b){_0x25f8ee['rows']=_0x33534b;return _0x25f8ee;});}})[_0x96ea('0x26')](respondWithFilteredResult(_0x4960ea,_0x3701b5))[_0x96ea('0x4a')](handleError(_0x4960ea,null));};exports['getAnswers']=function(_0x25ed8a,_0x53ab95,_0x2f5434){var _0x2612c3={'raw':!![],'where':{}};var _0x123936={};var _0x33f9ef={'count':0x0,'rows':[]};return db[_0x96ea('0x45')]['findOne']({'where':{'id':_0x25ed8a[_0x96ea('0x4b')]['id']}})[_0x96ea('0x26')](handleEntityNotFound(_0x53ab95,null))[_0x96ea('0x26')](function(_0x2d8098){if(_0x2d8098){_0x123936[_0x96ea('0x37')]=_[_0x96ea('0x34')](db[_0x96ea('0x60')][_0x96ea('0x30')]);_0x123936[_0x96ea('0x33')]=_['keys'](_0x25ed8a[_0x96ea('0x33')]);_0x123936[_0x96ea('0x35')]=_[_0x96ea('0x36')](_0x123936['model'],_0x123936[_0x96ea('0x33')]);_0x2612c3[_0x96ea('0x38')]=_[_0x96ea('0x36')](_0x123936[_0x96ea('0x37')],qs[_0x96ea('0x39')](_0x25ed8a['query'][_0x96ea('0x39')]));_0x2612c3[_0x96ea('0x38')]=_0x2612c3['attributes'][_0x96ea('0x3a')]?_0x2612c3['attributes']:_0x123936['model'];if(!_0x25ed8a['query']['hasOwnProperty'](_0x96ea('0x3c'))){_0x2612c3[_0x96ea('0x21')]=qs[_0x96ea('0x21')](_0x25ed8a['query'][_0x96ea('0x21')]);_0x2612c3['offset']=qs['offset'](_0x25ed8a[_0x96ea('0x33')]['offset']);}_0x2612c3[_0x96ea('0x3d')]=qs[_0x96ea('0x3e')](_0x25ed8a[_0x96ea('0x33')][_0x96ea('0x3e')]);_0x2612c3[_0x96ea('0x3f')]=qs[_0x96ea('0x35')](_[_0x96ea('0x40')](_0x25ed8a[_0x96ea('0x33')],_0x123936[_0x96ea('0x35')]));_0x2612c3['where'][_0x96ea('0x61')]=_0x2d8098['id'];if(_0x25ed8a[_0x96ea('0x33')]['filter']){_0x2612c3[_0x96ea('0x3f')]=_['merge'](_0x2612c3[_0x96ea('0x3f')],{'$or':_[_0x96ea('0x2f')](_0x2612c3[_0x96ea('0x38')],function(_0x3419bf){var _0xdba9dd={};_0xdba9dd[_0x3419bf]={'$like':'%'+_0x25ed8a[_0x96ea('0x33')]['filter']+'%'};return _0xdba9dd;})});}_0x2612c3=_[_0x96ea('0x41')]({},_0x2612c3,_0x25ed8a[_0x96ea('0x44')]);return db[_0x96ea('0x60')][_0x96ea('0x20')]({'where':_0x2612c3[_0x96ea('0x3f')]})[_0x96ea('0x26')](function(_0x3b06e7){_0x33f9ef['count']=_0x3b06e7;if(_0x25ed8a[_0x96ea('0x33')]['includeAll']){_0x2612c3['include']=[{'all':!![]}];}return db[_0x96ea('0x60')][_0x96ea('0x48')](_0x2612c3);})[_0x96ea('0x26')](function(_0x53833a){_0x33f9ef[_0x96ea('0x49')]=_0x53833a;return _0x33f9ef;});}})['then'](respondWithFilteredResult(_0x53ab95,_0x2612c3))[_0x96ea('0x4a')](handleError(_0x53ab95,null));};function char(_0x171e94){return _0x96ea('0x62')===typeof _0x171e94?String[_0x96ea('0x63')][_0x96ea('0x23')](null,arguments):_0x171e94;}function needsEncapsulation(_0x15da1b){return!!_0x15da1b&&(_0x15da1b[_0x96ea('0x64')]()[_0x96ea('0x65')](char(0xd))>=0x0||_0x15da1b['toString']()[_0x96ea('0x65')](char(0xa))>=0x0||_0x15da1b[_0x96ea('0x64')]()[_0x96ea('0x65')](char(0x2c))>=0x0||_0x15da1b['toString']()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x1baced){var _0x426ec2=char(0x22),_0x50f372='\x5c'+char(0x22),_0x917222=_0x1baced[_0x96ea('0x64')]()[_0x96ea('0x66')](new RegExp(_0x426ec2,'g'),_0x50f372);return _0x426ec2+_0x917222+_0x426ec2;}exports['getSummary']=function(_0x1906c0,_0x2691c4,_0x4691ec){var _0x125773,_0x362eeb;var _0x1601cc={'where':{'ProjectId':_0x1906c0[_0x96ea('0x4b')]['id']}};if(_0x1906c0['query'][_0x96ea('0x67')]){_0x1601cc[_0x96ea('0x3f')][_0x96ea('0x68')]=JSON[_0x96ea('0x69')](_0x1906c0[_0x96ea('0x33')][_0x96ea('0x67')]);}return db[_0x96ea('0x5f')][_0x96ea('0x48')](_0x1601cc)[_0x96ea('0x26')](handleEntityNotFound(_0x2691c4,null))[_0x96ea('0x26')](function(_0x1977d5){if(_0x1977d5){_0x125773=_0x1977d5;return db['JscriptyQuestionReport'][_0x96ea('0x48')]({'where':{'SessionId':{'$in':_['map'](_0x125773,'id')},'ProjectId':_0x1906c0['params']['id']},'order':_0x96ea('0x6a')});}})['then'](handleEntityNotFound(_0x2691c4,null))[_0x96ea('0x26')](function(_0x21a30e){if(_0x21a30e){_0x362eeb=_0x21a30e;var _0x468643={};for(var _0x3678d0=0x0,_0x551348=_0x362eeb['length'];_0x3678d0<_0x551348;_0x3678d0++){if(!_0x468643[_0x96ea('0x3b')](_0x362eeb[_0x3678d0][_0x96ea('0x6b')])){_0x468643[_0x362eeb[_0x3678d0][_0x96ea('0x6b')]]=needsEncapsulation(_0x362eeb[_0x3678d0][_0x96ea('0x6c')])?encapsulate(_0x362eeb[_0x3678d0][_0x96ea('0x6c')]):_0x362eeb[_0x3678d0][_0x96ea('0x6c')];}}var _0x467740=[],_0x2d0f41={};for(var _0x5cb296=0x0,_0x105ddb=_0x125773[_0x96ea('0x3a')];_0x5cb296<_0x105ddb;_0x5cb296++){_0x2d0f41={'ProjectId':_0x1906c0[_0x96ea('0x4b')]['id'],'SessionId':_0x125773[_0x5cb296]['id'],'StartTime':moment(_0x125773[_0x5cb296][_0x96ea('0x68')])['format'](_0x96ea('0x6d'))};for(var _0x295b10=0x0,_0x14e08c=_0x362eeb['length'];_0x295b10<_0x14e08c;_0x295b10++){if(_0x362eeb[_0x295b10][_0x96ea('0x6e')]==_0x125773[_0x5cb296]['id']&&_0x468643[_0x96ea('0x3b')](_0x362eeb[_0x295b10][_0x96ea('0x6b')])){_0x2d0f41[_0x468643[_0x362eeb[_0x295b10][_0x96ea('0x6b')]]]=_0x362eeb[_0x295b10][_0x96ea('0x6f')];}}for(var _0x5ecf7f in _0x468643){if(!_0x2d0f41[_0x96ea('0x3b')](_0x468643[_0x5ecf7f])){_0x2d0f41[_0x468643[_0x5ecf7f]]=null;}}_0x467740[_0x96ea('0x70')](_0x2d0f41);}return _0x467740;}})['then'](function(_0x42a085){if(!_[_0x96ea('0x71')](_0x42a085)){var _0x5ef086=toCsv(_0x42a085);var _0x370cbe=Date[_0x96ea('0x72')]();fs[_0x96ea('0x73')](util[_0x96ea('0x74')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x1906c0[_0x96ea('0x4b')]['id'],_0x370cbe),_0x5ef086);_0x2691c4[_0x96ea('0x75')](_0x96ea('0x76'),_0x96ea('0x77')+util[_0x96ea('0x74')](_0x96ea('0x78'),_0x1906c0['params']['id'],_0x370cbe));_0x2691c4[_0x96ea('0x75')]('Content-type','text/csv');return _0x2691c4[_0x96ea('0x79')](util[_0x96ea('0x74')](_0x96ea('0x7a'),_0x1906c0[_0x96ea('0x4b')]['id'],_0x370cbe));}else{return _0x2691c4['sendStatus'](0xcc);}})['catch'](handleError(_0x2691c4,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 378d946..8e77d4b 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 _0xcdd0=['api','bluebird','rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger'];(function(_0x200d3c,_0x360dc6){var _0x250736=function(_0x2dccdf){while(--_0x2dccdf){_0x200d3c['push'](_0x200d3c['shift']());}};_0x250736(++_0x360dc6);}(_0xcdd0,0xd9));var _0x0cdd=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xcdd0[_0x53cf8e];return _0x459197;};'use strict';var _=require(_0x0cdd('0x0'));var util=require(_0x0cdd('0x1'));var logger=require(_0x0cdd('0x2'))(_0x0cdd('0x3'));var moment=require('moment');var BPromise=require(_0x0cdd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0cdd('0x5'));var config=require('../../config/environment');var attributes=require(_0x0cdd('0x6'));module[_0x0cdd('0x7')]=function(_0xe80a73,_0x5ca0f9){return _0xe80a73[_0x0cdd('0x8')](_0x0cdd('0x9'),attributes,{'tableName':_0x0cdd('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe1dc=['request-promise','rimraf','exports','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3d93ae,_0x2e7a5d){var _0x563fe2=function(_0x35920f){while(--_0x35920f){_0x3d93ae['push'](_0x3d93ae['shift']());}};_0x563fe2(++_0x2e7a5d);}(_0xe1dc,0x8a));var _0xce1d=function(_0x41b94d,_0x197fd1){_0x41b94d=_0x41b94d-0x0;var _0x4274a3=_0xe1dc[_0x41b94d];return _0x4274a3;};'use strict';var _=require(_0xce1d('0x0'));var util=require(_0xce1d('0x1'));var logger=require(_0xce1d('0x2'))(_0xce1d('0x3'));var moment=require(_0xce1d('0x4'));var BPromise=require(_0xce1d('0x5'));var rp=require(_0xce1d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xce1d('0x7'));var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module[_0xce1d('0x8')]=function(_0x232005,_0x2782b7){return _0x232005[_0xce1d('0x9')](_0xce1d('0xa'),attributes,{'tableName':_0xce1d('0xb'),'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 306d469..8f06497 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 _0x70e0=['code','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x22cbc7,_0x7e43c9){var _0x26d9fd=function(_0x2fd176){while(--_0x2fd176){_0x22cbc7['push'](_0x22cbc7['shift']());}};_0x26d9fd(++_0x7e43c9);}(_0x70e0,0x17b));var _0x070e=function(_0x109bc4,_0x1164b8){_0x109bc4=_0x109bc4-0x0;var _0x541037=_0x70e0[_0x109bc4];return _0x541037;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('JscriptyProject,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ 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(_0x2ff4bd,_0x4780a6){var _0x28edc6=function(_0x792380){while(--_0x792380){_0x2ff4bd['push'](_0x2ff4bd['shift']());}};_0x28edc6(++_0x4780a6);}(_0xda3f,0xec));var _0xfda3=function(_0x25c77b,_0x23dea4){_0x25c77b=_0x25c77b-0x0;var _0x2d041a=_0xda3f[_0x25c77b];return _0x2d041a;};'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 c106c4c..b4d6411 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 _0x9572=['/describe','isAuthenticated','show','post','create','/:id','update','delete','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index'];(function(_0x37ed6e,_0x40a32c){var _0x12dc35=function(_0x3a824f){while(--_0x3a824f){_0x37ed6e['push'](_0x37ed6e['shift']());}};_0x12dc35(++_0x40a32c);}(_0x9572,0xf8));var _0x2957=function(_0x15b4a2,_0x24c946){_0x15b4a2=_0x15b4a2-0x0;var _0x4f6b52=_0x9572[_0x15b4a2];return _0x4f6b52;};'use strict';var multer=require(_0x2957('0x0'));var util=require(_0x2957('0x1'));var path=require(_0x2957('0x2'));var timeout=require('connect-timeout');var express=require(_0x2957('0x3'));var router=express[_0x2957('0x4')]();var fs_extra=require(_0x2957('0x5'));var auth=require(_0x2957('0x6'));var interaction=require(_0x2957('0x7'));var config=require(_0x2957('0x8'));var controller=require(_0x2957('0x9'));router[_0x2957('0xa')]('/',auth['isAuthenticated'](),controller[_0x2957('0xb')]);router[_0x2957('0xa')](_0x2957('0xc'),auth[_0x2957('0xd')](),controller['describe']);router[_0x2957('0xa')]('/:id',auth[_0x2957('0xd')](),controller[_0x2957('0xe')]);router[_0x2957('0xf')]('/',auth[_0x2957('0xd')](),controller[_0x2957('0x10')]);router['put'](_0x2957('0x11'),auth[_0x2957('0xd')](),controller[_0x2957('0x12')]);router[_0x2957('0x13')](_0x2957('0x11'),auth[_0x2957('0xd')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4c77=['../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','describe','show','post','create','put','/:id','delete','exports','multer','util','path','connect-timeout','Router','fs-extra'];(function(_0x47a12a,_0x70f591){var _0x30cd40=function(_0x46b68f){while(--_0x46b68f){_0x47a12a['push'](_0x47a12a['shift']());}};_0x30cd40(++_0x70f591);}(_0x4c77,0x72));var _0x74c7=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4c77[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x74c7('0x0'));var util=require(_0x74c7('0x1'));var path=require(_0x74c7('0x2'));var timeout=require(_0x74c7('0x3'));var express=require('express');var router=express[_0x74c7('0x4')]();var fs_extra=require(_0x74c7('0x5'));var auth=require(_0x74c7('0x6'));var interaction=require(_0x74c7('0x7'));var config=require(_0x74c7('0x8'));var controller=require(_0x74c7('0x9'));router[_0x74c7('0xa')]('/',auth[_0x74c7('0xb')](),controller['index']);router[_0x74c7('0xa')]('/describe',auth[_0x74c7('0xb')](),controller[_0x74c7('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x74c7('0xd')]);router[_0x74c7('0xe')]('/',auth[_0x74c7('0xb')](),controller[_0x74c7('0xf')]);router[_0x74c7('0x10')](_0x74c7('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x74c7('0x12')](_0x74c7('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x74c7('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 012d8f5..c77d04b 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(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x7a54,0x106));var _0x47a5=function(_0x46d122,_0x449ac9){_0x46d122=_0x46d122-0x0;var _0x1bd733=_0x7a54[_0x46d122];return _0x1bd733;};'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(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x7a54,0x106));var _0x47a5=function(_0x3e9ee0,_0x214be2){_0x3e9ee0=_0x3e9ee0-0x0;var _0x1fe9fc=_0x7a54[_0x3e9ee0];return _0x1fe9fc;};'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 440079e..a934456 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 _0x5074=['name','map','JscriptyQuestionReport','fieldName','key','keys','query','intersection','attributes','length','model','hasOwnProperty','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','destroy','describe','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','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','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','end','error'];(function(_0x5c81b2,_0x46590a){var _0x4cbed6=function(_0x221f19){while(--_0x221f19){_0x5c81b2['push'](_0x5c81b2['shift']());}};_0x4cbed6(++_0x46590a);}(_0x5074,0x6e));var _0x4507=function(_0x1627ae,_0x2aaa24){_0x1627ae=_0x1627ae-0x0;var _0x34b38f=_0x5074[_0x1627ae];return _0x34b38f;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4507('0x0'));var jsonpatch=require(_0x4507('0x1'));var rp=require(_0x4507('0x2'));var moment=require(_0x4507('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4507('0x4'));var util=require(_0x4507('0x5'));var path=require(_0x4507('0x6'));var sox=require(_0x4507('0x7'));var csv=require(_0x4507('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4507('0x9'));var _=require(_0x4507('0xa'));var squel=require(_0x4507('0xb'));var crypto=require(_0x4507('0xc'));var jsforce=require(_0x4507('0xd'));var deskjs=require(_0x4507('0xe'));var toCsv=require(_0x4507('0x8'));var querystring=require(_0x4507('0xf'));var Papa=require(_0x4507('0x10'));var Redis=require(_0x4507('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4507('0x12'));var as=require(_0x4507('0x13'));var hardwareService=require(_0x4507('0x14'));var logger=require(_0x4507('0x15'))(_0x4507('0x16'));var utils=require(_0x4507('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4507('0x18'));var db=require(_0x4507('0x19'))['db'];function respondWithStatusCode(_0x2e50b8,_0xcc64b1){_0xcc64b1=_0xcc64b1||0xcc;return function(_0x52ae3b){if(_0x52ae3b){return _0x2e50b8[_0x4507('0x1a')](_0xcc64b1);}return _0x2e50b8['status'](_0xcc64b1)['end']();};}function respondWithResult(_0x1ab82b,_0x5375a7){_0x5375a7=_0x5375a7||0xc8;return function(_0x5378ec){if(_0x5378ec){return _0x1ab82b[_0x4507('0x1b')](_0x5375a7)[_0x4507('0x1c')](_0x5378ec);}};}function respondWithFilteredResult(_0x4c4fce,_0x483739){return function(_0x1b15b8){if(_0x1b15b8){var _0xc72652=typeof _0x483739[_0x4507('0x1d')]==='undefined'&&typeof _0x483739[_0x4507('0x1e')]===_0x4507('0x1f');var _0x2f338b=_0x1b15b8['count'];var _0x422644=_0xc72652?0x0:_0x483739[_0x4507('0x1d')];var _0x1a7fca=_0xc72652?_0x1b15b8[_0x4507('0x20')]:_0x483739[_0x4507('0x1d')]+_0x483739[_0x4507('0x1e')];var _0x327a0a;if(_0x1a7fca>=_0x2f338b){_0x1a7fca=_0x2f338b;_0x327a0a=0xc8;}else{_0x327a0a=0xce;}_0x4c4fce[_0x4507('0x1b')](_0x327a0a);return _0x4c4fce[_0x4507('0x21')](_0x4507('0x22'),_0x422644+'-'+_0x1a7fca+'/'+_0x2f338b)[_0x4507('0x1c')](_0x1b15b8);}return null;};}function patchUpdates(_0x4035b8){return function(_0x1742d8){try{jsonpatch[_0x4507('0x23')](_0x1742d8,_0x4035b8,!![]);}catch(_0x4a412f){return BPromise[_0x4507('0x24')](_0x4a412f);}return _0x1742d8[_0x4507('0x25')]();};}function saveUpdates(_0x40bb7e,_0x4845dd){return function(_0x1e60f7){if(_0x1e60f7){return _0x1e60f7[_0x4507('0x26')](_0x40bb7e)[_0x4507('0x27')](function(_0x543c6f){return _0x543c6f;});}return null;};}function removeEntity(_0x7e1106,_0x396558){return function(_0x4ef590){if(_0x4ef590){return _0x4ef590['destroy']()[_0x4507('0x27')](function(){_0x7e1106[_0x4507('0x1b')](0xcc)[_0x4507('0x28')]();});}};}function handleEntityNotFound(_0x173460,_0x12ad48){return function(_0x2e2c00){if(!_0x2e2c00){_0x173460[_0x4507('0x1a')](0x194);}return _0x2e2c00;};}function handleError(_0x5b91dc,_0x3239ae){_0x3239ae=_0x3239ae||0x1f4;return function(_0x2cd2c6){logger[_0x4507('0x29')](_0x2cd2c6['stack']);if(_0x2cd2c6[_0x4507('0x2a')]){delete _0x2cd2c6[_0x4507('0x2a')];}_0x5b91dc[_0x4507('0x1b')](_0x3239ae)['send'](_0x2cd2c6);};}exports['index']=function(_0x515b0c,_0x517e22){var _0x1f4a9c={},_0x36aac8={},_0x32c7fb={'count':0x0,'rows':[]};var _0x3cc44f=_[_0x4507('0x2b')](db[_0x4507('0x2c')]['rawAttributes'],function(_0xd21d9a){return{'name':_0xd21d9a[_0x4507('0x2d')],'type':_0xd21d9a['type'][_0x4507('0x2e')]};});_0x36aac8['model']=_[_0x4507('0x2b')](_0x3cc44f,_0x4507('0x2a'));_0x36aac8['query']=_[_0x4507('0x2f')](_0x515b0c[_0x4507('0x30')]);_0x36aac8['filters']=_[_0x4507('0x31')](_0x36aac8['model'],_0x36aac8[_0x4507('0x30')]);_0x1f4a9c[_0x4507('0x32')]=_[_0x4507('0x31')](_0x36aac8['model'],qs['fields'](_0x515b0c[_0x4507('0x30')]['fields']));_0x1f4a9c[_0x4507('0x32')]=_0x1f4a9c['attributes'][_0x4507('0x33')]?_0x1f4a9c['attributes']:_0x36aac8[_0x4507('0x34')];if(!_0x515b0c[_0x4507('0x30')][_0x4507('0x35')]('nolimit')){_0x1f4a9c[_0x4507('0x1e')]=qs[_0x4507('0x1e')](_0x515b0c['query']['limit']);_0x1f4a9c[_0x4507('0x1d')]=qs[_0x4507('0x1d')](_0x515b0c[_0x4507('0x30')][_0x4507('0x1d')]);}_0x1f4a9c['order']=qs[_0x4507('0x36')](_0x515b0c[_0x4507('0x30')][_0x4507('0x36')]);_0x1f4a9c[_0x4507('0x37')]=qs[_0x4507('0x38')](_[_0x4507('0x39')](_0x515b0c[_0x4507('0x30')],_0x36aac8[_0x4507('0x38')]),_0x3cc44f);if(_0x515b0c[_0x4507('0x30')][_0x4507('0x3a')]){_0x1f4a9c[_0x4507('0x37')]=_[_0x4507('0x3b')](_0x1f4a9c['where'],{'$or':_['map'](_0x3cc44f,function(_0x2b5c90){if(_0x2b5c90[_0x4507('0x3c')]!==_0x4507('0x3d')){var _0x2dd400={};_0x2dd400[_0x2b5c90[_0x4507('0x2a')]]={'$like':'%'+_0x515b0c[_0x4507('0x30')][_0x4507('0x3a')]+'%'};return _0x2dd400;}})});}_0x1f4a9c=_[_0x4507('0x3b')]({},_0x1f4a9c,_0x515b0c[_0x4507('0x3e')]);var _0x320b10={'where':_0x1f4a9c[_0x4507('0x37')]};return db[_0x4507('0x2c')][_0x4507('0x20')](_0x320b10)[_0x4507('0x27')](function(_0x2d6f32){_0x32c7fb[_0x4507('0x20')]=_0x2d6f32;if(_0x515b0c['query'][_0x4507('0x3f')]){_0x1f4a9c[_0x4507('0x40')]=[{'all':!![]}];}return db[_0x4507('0x2c')][_0x4507('0x41')](_0x1f4a9c);})['then'](function(_0x40edc4){_0x32c7fb[_0x4507('0x42')]=_0x40edc4;return _0x32c7fb;})[_0x4507('0x27')](respondWithFilteredResult(_0x517e22,_0x1f4a9c))[_0x4507('0x43')](handleError(_0x517e22,null));};exports[_0x4507('0x44')]=function(_0x2e7d03,_0x442ae0){var _0x5aa991={'raw':!![],'where':{'id':_0x2e7d03[_0x4507('0x45')]['id']}},_0x5ddf92={};_0x5ddf92[_0x4507('0x34')]=_[_0x4507('0x2f')](db[_0x4507('0x2c')]['rawAttributes']);_0x5ddf92[_0x4507('0x30')]=_['keys'](_0x2e7d03[_0x4507('0x30')]);_0x5ddf92[_0x4507('0x38')]=_[_0x4507('0x31')](_0x5ddf92[_0x4507('0x34')],_0x5ddf92[_0x4507('0x30')]);_0x5aa991['attributes']=_[_0x4507('0x31')](_0x5ddf92[_0x4507('0x34')],qs[_0x4507('0x46')](_0x2e7d03[_0x4507('0x30')][_0x4507('0x46')]));_0x5aa991[_0x4507('0x32')]=_0x5aa991['attributes'][_0x4507('0x33')]?_0x5aa991[_0x4507('0x32')]:_0x5ddf92[_0x4507('0x34')];if(_0x2e7d03['query'][_0x4507('0x3f')]){_0x5aa991['include']=[{'all':!![]}];}_0x5aa991=_[_0x4507('0x3b')]({},_0x5aa991,_0x2e7d03[_0x4507('0x3e')]);return db[_0x4507('0x2c')][_0x4507('0x47')](_0x5aa991)[_0x4507('0x27')](handleEntityNotFound(_0x442ae0,null))[_0x4507('0x27')](respondWithResult(_0x442ae0,null))['catch'](handleError(_0x442ae0,null));};exports[_0x4507('0x48')]=function(_0x2c79ef,_0x27aa7d){return db[_0x4507('0x2c')][_0x4507('0x48')](_0x2c79ef[_0x4507('0x49')],{})[_0x4507('0x27')](respondWithResult(_0x27aa7d,0xc9))[_0x4507('0x43')](handleError(_0x27aa7d,null));};exports[_0x4507('0x26')]=function(_0x59a993,_0x504506){if(_0x59a993[_0x4507('0x49')]['id']){delete _0x59a993[_0x4507('0x49')]['id'];}return db[_0x4507('0x2c')][_0x4507('0x47')]({'where':{'id':_0x59a993[_0x4507('0x45')]['id']}})[_0x4507('0x27')](handleEntityNotFound(_0x504506,null))[_0x4507('0x27')](saveUpdates(_0x59a993[_0x4507('0x49')],null))[_0x4507('0x27')](respondWithResult(_0x504506,null))['catch'](handleError(_0x504506,null));};exports[_0x4507('0x4a')]=function(_0x15ece4,_0x4a0f37){return db[_0x4507('0x2c')][_0x4507('0x47')]({'where':{'id':_0x15ece4['params']['id']}})['then'](handleEntityNotFound(_0x4a0f37,null))[_0x4507('0x27')](removeEntity(_0x4a0f37,null))[_0x4507('0x43')](handleError(_0x4a0f37,null));};exports['describe']=function(_0x42a9f2,_0x50e892){return db[_0x4507('0x2c')][_0x4507('0x4b')]()[_0x4507('0x27')](respondWithResult(_0x50e892,null))[_0x4507('0x43')](handleError(_0x50e892,null));}; \ No newline at end of file +var _0x092e=['fs-extra','lodash','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','status','end','json','offset','undefined','count','limit','set','reject','update','destroy','then','sendStatus','error','stack','name','send','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','JscriptyQuestionReport','findAll','rows','catch','keys','rawAttributes','create','body','find','describe','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x3c4702,_0x315207){var _0x186a83=function(_0x5a2786){while(--_0x5a2786){_0x3c4702['push'](_0x3c4702['shift']());}};_0x186a83(++_0x315207);}(_0x092e,0x1ad));var _0xe092=function(_0x4c7aa5,_0x408285){_0x4c7aa5=_0x4c7aa5-0x0;var _0x168532=_0x092e[_0x4c7aa5];return _0x168532;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe092('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xe092('0x1'));var moment=require(_0xe092('0x2'));var BPromise=require(_0xe092('0x3'));var Mustache=require(_0xe092('0x4'));var util=require(_0xe092('0x5'));var path=require(_0xe092('0x6'));var sox=require(_0xe092('0x7'));var csv=require('to-csv');var ejs=require(_0xe092('0x8'));var fs=require('fs');var fs_extra=require(_0xe092('0x9'));var _=require(_0xe092('0xa'));var squel=require('squel');var crypto=require(_0xe092('0xb'));var jsforce=require(_0xe092('0xc'));var deskjs=require(_0xe092('0xd'));var toCsv=require(_0xe092('0xe'));var querystring=require(_0xe092('0xf'));var Papa=require('papaparse');var Redis=require(_0xe092('0x10'));var authService=require(_0xe092('0x11'));var qs=require(_0xe092('0x12'));var as=require(_0xe092('0x13'));var hardwareService=require(_0xe092('0x14'));var logger=require(_0xe092('0x15'))(_0xe092('0x16'));var utils=require(_0xe092('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c1e0d,_0x12319b){_0x12319b=_0x12319b||0xcc;return function(_0x3bb1d6){if(_0x3bb1d6){return _0x5c1e0d['sendStatus'](_0x12319b);}return _0x5c1e0d[_0xe092('0x18')](_0x12319b)[_0xe092('0x19')]();};}function respondWithResult(_0x2fba07,_0x475c52){_0x475c52=_0x475c52||0xc8;return function(_0x1ba42d){if(_0x1ba42d){return _0x2fba07[_0xe092('0x18')](_0x475c52)[_0xe092('0x1a')](_0x1ba42d);}};}function respondWithFilteredResult(_0x4cd907,_0x2cab0e){return function(_0x41a177){if(_0x41a177){var _0x2277ee=typeof _0x2cab0e[_0xe092('0x1b')]===_0xe092('0x1c')&&typeof _0x2cab0e['limit']===_0xe092('0x1c');var _0x297fad=_0x41a177[_0xe092('0x1d')];var _0x39e6b1=_0x2277ee?0x0:_0x2cab0e[_0xe092('0x1b')];var _0x502d33=_0x2277ee?_0x41a177['count']:_0x2cab0e['offset']+_0x2cab0e[_0xe092('0x1e')];var _0x5389f1;if(_0x502d33>=_0x297fad){_0x502d33=_0x297fad;_0x5389f1=0xc8;}else{_0x5389f1=0xce;}_0x4cd907[_0xe092('0x18')](_0x5389f1);return _0x4cd907[_0xe092('0x1f')]('Content-Range',_0x39e6b1+'-'+_0x502d33+'/'+_0x297fad)[_0xe092('0x1a')](_0x41a177);}return null;};}function patchUpdates(_0x135b15){return function(_0x33c1fb){try{jsonpatch['apply'](_0x33c1fb,_0x135b15,!![]);}catch(_0x1ba214){return BPromise[_0xe092('0x20')](_0x1ba214);}return _0x33c1fb['save']();};}function saveUpdates(_0x96ea74,_0x2d149d){return function(_0x596fa2){if(_0x596fa2){return _0x596fa2[_0xe092('0x21')](_0x96ea74)['then'](function(_0x2087ed){return _0x2087ed;});}return null;};}function removeEntity(_0x5457ac,_0x88cbf){return function(_0x311e28){if(_0x311e28){return _0x311e28[_0xe092('0x22')]()[_0xe092('0x23')](function(){_0x5457ac[_0xe092('0x18')](0xcc)[_0xe092('0x19')]();});}};}function handleEntityNotFound(_0x5d5020,_0x10e6b1){return function(_0x599ddf){if(!_0x599ddf){_0x5d5020[_0xe092('0x24')](0x194);}return _0x599ddf;};}function handleError(_0x7586b3,_0x22d2c7){_0x22d2c7=_0x22d2c7||0x1f4;return function(_0x283e6d){logger[_0xe092('0x25')](_0x283e6d[_0xe092('0x26')]);if(_0x283e6d[_0xe092('0x27')]){delete _0x283e6d['name'];}_0x7586b3[_0xe092('0x18')](_0x22d2c7)[_0xe092('0x28')](_0x283e6d);};}exports['index']=function(_0x3bb832,_0x57e8ae){var _0x1bc31a={},_0x4bb39c={},_0x2f3ab0={'count':0x0,'rows':[]};var _0x1bb1a7=_['map'](db['JscriptyQuestionReport']['rawAttributes'],function(_0x2b30c5){return{'name':_0x2b30c5['fieldName'],'type':_0x2b30c5[_0xe092('0x29')][_0xe092('0x2a')]};});_0x4bb39c[_0xe092('0x2b')]=_[_0xe092('0x2c')](_0x1bb1a7,_0xe092('0x27'));_0x4bb39c[_0xe092('0x2d')]=_['keys'](_0x3bb832[_0xe092('0x2d')]);_0x4bb39c[_0xe092('0x2e')]=_[_0xe092('0x2f')](_0x4bb39c[_0xe092('0x2b')],_0x4bb39c[_0xe092('0x2d')]);_0x1bc31a[_0xe092('0x30')]=_[_0xe092('0x2f')](_0x4bb39c['model'],qs['fields'](_0x3bb832[_0xe092('0x2d')][_0xe092('0x31')]));_0x1bc31a[_0xe092('0x30')]=_0x1bc31a['attributes'][_0xe092('0x32')]?_0x1bc31a[_0xe092('0x30')]:_0x4bb39c[_0xe092('0x2b')];if(!_0x3bb832[_0xe092('0x2d')][_0xe092('0x33')](_0xe092('0x34'))){_0x1bc31a[_0xe092('0x1e')]=qs[_0xe092('0x1e')](_0x3bb832[_0xe092('0x2d')][_0xe092('0x1e')]);_0x1bc31a[_0xe092('0x1b')]=qs[_0xe092('0x1b')](_0x3bb832['query'][_0xe092('0x1b')]);}_0x1bc31a[_0xe092('0x35')]=qs[_0xe092('0x36')](_0x3bb832[_0xe092('0x2d')][_0xe092('0x36')]);_0x1bc31a[_0xe092('0x37')]=qs['filters'](_[_0xe092('0x38')](_0x3bb832['query'],_0x4bb39c[_0xe092('0x2e')]),_0x1bb1a7);if(_0x3bb832[_0xe092('0x2d')]['filter']){_0x1bc31a[_0xe092('0x37')]=_[_0xe092('0x39')](_0x1bc31a[_0xe092('0x37')],{'$or':_['map'](_0x1bb1a7,function(_0x2a78e3){if(_0x2a78e3['type']!==_0xe092('0x3a')){var _0x29fb79={};_0x29fb79[_0x2a78e3[_0xe092('0x27')]]={'$like':'%'+_0x3bb832[_0xe092('0x2d')][_0xe092('0x3b')]+'%'};return _0x29fb79;}})});}_0x1bc31a=_[_0xe092('0x39')]({},_0x1bc31a,_0x3bb832[_0xe092('0x3c')]);var _0x3a034c={'where':_0x1bc31a['where']};return db['JscriptyQuestionReport'][_0xe092('0x1d')](_0x3a034c)[_0xe092('0x23')](function(_0x48bad9){_0x2f3ab0[_0xe092('0x1d')]=_0x48bad9;if(_0x3bb832[_0xe092('0x2d')][_0xe092('0x3d')]){_0x1bc31a[_0xe092('0x3e')]=[{'all':!![]}];}return db[_0xe092('0x3f')][_0xe092('0x40')](_0x1bc31a);})[_0xe092('0x23')](function(_0x26fa60){_0x2f3ab0[_0xe092('0x41')]=_0x26fa60;return _0x2f3ab0;})['then'](respondWithFilteredResult(_0x57e8ae,_0x1bc31a))[_0xe092('0x42')](handleError(_0x57e8ae,null));};exports['show']=function(_0x40dbe9,_0x1b4b60){var _0x4537f6={'raw':!![],'where':{'id':_0x40dbe9['params']['id']}},_0x385b56={};_0x385b56[_0xe092('0x2b')]=_[_0xe092('0x43')](db[_0xe092('0x3f')][_0xe092('0x44')]);_0x385b56[_0xe092('0x2d')]=_[_0xe092('0x43')](_0x40dbe9[_0xe092('0x2d')]);_0x385b56[_0xe092('0x2e')]=_[_0xe092('0x2f')](_0x385b56['model'],_0x385b56[_0xe092('0x2d')]);_0x4537f6[_0xe092('0x30')]=_['intersection'](_0x385b56[_0xe092('0x2b')],qs[_0xe092('0x31')](_0x40dbe9[_0xe092('0x2d')]['fields']));_0x4537f6[_0xe092('0x30')]=_0x4537f6['attributes'][_0xe092('0x32')]?_0x4537f6[_0xe092('0x30')]:_0x385b56[_0xe092('0x2b')];if(_0x40dbe9['query']['includeAll']){_0x4537f6[_0xe092('0x3e')]=[{'all':!![]}];}_0x4537f6=_['merge']({},_0x4537f6,_0x40dbe9[_0xe092('0x3c')]);return db['JscriptyQuestionReport']['find'](_0x4537f6)['then'](handleEntityNotFound(_0x1b4b60,null))[_0xe092('0x23')](respondWithResult(_0x1b4b60,null))['catch'](handleError(_0x1b4b60,null));};exports['create']=function(_0x9c74bb,_0x772470){return db[_0xe092('0x3f')][_0xe092('0x45')](_0x9c74bb[_0xe092('0x46')],{})[_0xe092('0x23')](respondWithResult(_0x772470,0xc9))['catch'](handleError(_0x772470,null));};exports['update']=function(_0x42d2ac,_0x6af0){if(_0x42d2ac[_0xe092('0x46')]['id']){delete _0x42d2ac['body']['id'];}return db['JscriptyQuestionReport'][_0xe092('0x47')]({'where':{'id':_0x42d2ac['params']['id']}})[_0xe092('0x23')](handleEntityNotFound(_0x6af0,null))['then'](saveUpdates(_0x42d2ac[_0xe092('0x46')],null))['then'](respondWithResult(_0x6af0,null))[_0xe092('0x42')](handleError(_0x6af0,null));};exports['destroy']=function(_0x32f525,_0x40cafb){return db[_0xe092('0x3f')][_0xe092('0x47')]({'where':{'id':_0x32f525['params']['id']}})[_0xe092('0x23')](handleEntityNotFound(_0x40cafb,null))[_0xe092('0x23')](removeEntity(_0x40cafb,null))[_0xe092('0x42')](handleError(_0x40cafb,null));};exports[_0xe092('0x48')]=function(_0x46f315,_0x5339a9){return db[_0xe092('0x3f')][_0xe092('0x48')]()[_0xe092('0x23')](respondWithResult(_0x5339a9,null))[_0xe092('0x42')](handleError(_0x5339a9,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 79c94d2..a1940e3 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 _0xa3e4=['moment','bluebird','request-promise','path','rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash'];(function(_0x8333c3,_0x4dc628){var _0x46a701=function(_0x592d50){while(--_0x592d50){_0x8333c3['push'](_0x8333c3['shift']());}};_0x46a701(++_0x4dc628);}(_0xa3e4,0x107));var _0x4a3e=function(_0x5826da,_0x4ffb7f){_0x5826da=_0x5826da-0x0;var _0x127236=_0xa3e4[_0x5826da];return _0x127236;};'use strict';var _=require(_0x4a3e('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4a3e('0x1'));var BPromise=require(_0x4a3e('0x2'));var rp=require(_0x4a3e('0x3'));var fs=require('fs');var path=require(_0x4a3e('0x4'));var rimraf=require(_0x4a3e('0x5'));var config=require('../../config/environment');var attributes=require(_0x4a3e('0x6'));module[_0x4a3e('0x7')]=function(_0x3e312d,_0xbb9ea){return _0x3e312d[_0x4a3e('0x8')](_0x4a3e('0x9'),attributes,{'tableName':_0x4a3e('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xce82=['../../config/environment','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x520506,_0x193e4f){var _0x45c1bc=function(_0x1e55d3){while(--_0x1e55d3){_0x520506['push'](_0x520506['shift']());}};_0x45c1bc(++_0x193e4f);}(_0xce82,0xbc));var _0x2ce8=function(_0x321324,_0x5da231){_0x321324=_0x321324-0x0;var _0x8336d1=_0xce82[_0x321324];return _0x8336d1;};'use strict';var _=require(_0x2ce8('0x0'));var util=require(_0x2ce8('0x1'));var logger=require(_0x2ce8('0x2'))(_0x2ce8('0x3'));var moment=require('moment');var BPromise=require(_0x2ce8('0x4'));var rp=require(_0x2ce8('0x5'));var fs=require('fs');var path=require(_0x2ce8('0x6'));var rimraf=require('rimraf');var config=require(_0x2ce8('0x7'));var attributes=require(_0x2ce8('0x8'));module[_0x2ce8('0x9')]=function(_0x5986db,_0xf67e5c){return _0x5986db[_0x2ce8('0xa')](_0x2ce8('0xb'),attributes,{'tableName':_0x2ce8('0xc'),'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 befc59a..e91ed99 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 _0x4a57=['randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird'];(function(_0x2aea9e,_0x1f587f){var _0x430b92=function(_0x416c37){while(--_0x416c37){_0x2aea9e['push'](_0x2aea9e['shift']());}};_0x430b92(++_0x1f587f);}(_0x4a57,0xcb));var _0x74a5=function(_0x23402b,_0x421ac9){_0x23402b=_0x23402b-0x0;var _0x3a21c7=_0x4a57[_0x23402b];return _0x3a21c7;};'use strict';var _=require(_0x74a5('0x0'));var util=require(_0x74a5('0x1'));var moment=require(_0x74a5('0x2'));var BPromise=require(_0x74a5('0x3'));var rs=require(_0x74a5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74a5('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x74a5('0x6'))('rpc');var config=require(_0x74a5('0x7'));var jayson=require(_0x74a5('0x8'));var client=jayson[_0x74a5('0x9')][_0x74a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92d3f4,_0x315b49,_0x55672f){return new BPromise(function(_0x3e3f3c,_0x2fd5b5){return client[_0x74a5('0xb')](_0x92d3f4,_0x55672f)[_0x74a5('0xc')](function(_0x1669fe){logger['info'](_0x74a5('0xd'),_0x315b49,_0x74a5('0xe'));logger[_0x74a5('0xf')](_0x74a5('0x10'),_0x315b49,_0x74a5('0xe'),JSON[_0x74a5('0x11')](_0x1669fe));if(_0x1669fe[_0x74a5('0x12')]){if(_0x1669fe[_0x74a5('0x12')][_0x74a5('0x13')]===0x1f4){logger[_0x74a5('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x315b49,_0x1669fe['error'][_0x74a5('0x14')]);return _0x2fd5b5(_0x1669fe[_0x74a5('0x12')][_0x74a5('0x14')]);}logger[_0x74a5('0x12')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x315b49,_0x1669fe[_0x74a5('0x12')][_0x74a5('0x14')]);return _0x3e3f3c(_0x1669fe[_0x74a5('0x12')][_0x74a5('0x14')]);}else{logger[_0x74a5('0x15')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x315b49,'request\x20sent');_0x3e3f3c(_0x1669fe['result']['message']);}})[_0x74a5('0x16')](function(_0x289a2f){logger['error'](_0x74a5('0xd'),_0x315b49,_0x289a2f);_0x2fd5b5(_0x289a2f);});});} \ No newline at end of file +var _0x4f96=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis'];(function(_0x30fd84,_0x41c9e0){var _0x160be9=function(_0xdd139f){while(--_0xdd139f){_0x30fd84['push'](_0x30fd84['shift']());}};_0x160be9(++_0x41c9e0);}(_0x4f96,0xd7));var _0x64f9=function(_0x41bcb3,_0x1a0627){_0x41bcb3=_0x41bcb3-0x0;var _0x141019=_0x4f96[_0x41bcb3];return _0x141019;};'use strict';var _=require(_0x64f9('0x0'));var util=require(_0x64f9('0x1'));var moment=require('moment');var BPromise=require(_0x64f9('0x2'));var rs=require(_0x64f9('0x3'));var fs=require('fs');var Redis=require(_0x64f9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x64f9('0x5'));var logger=require(_0x64f9('0x6'))(_0x64f9('0x7'));var config=require(_0x64f9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x64f9('0x9')][_0x64f9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42cc24,_0x303b55,_0x290948){return new BPromise(function(_0x1f42f7,_0x32b239){return client[_0x64f9('0xb')](_0x42cc24,_0x290948)[_0x64f9('0xc')](function(_0x2f4a9e){logger['info'](_0x64f9('0xd'),_0x303b55,_0x64f9('0xe'));logger['debug'](_0x64f9('0xf'),_0x303b55,'request\x20sent',JSON['stringify'](_0x2f4a9e));if(_0x2f4a9e[_0x64f9('0x10')]){if(_0x2f4a9e[_0x64f9('0x10')][_0x64f9('0x11')]===0x1f4){logger[_0x64f9('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x303b55,_0x2f4a9e[_0x64f9('0x10')]['message']);return _0x32b239(_0x2f4a9e[_0x64f9('0x10')][_0x64f9('0x12')]);}logger[_0x64f9('0x10')](_0x64f9('0xd'),_0x303b55,_0x2f4a9e[_0x64f9('0x10')][_0x64f9('0x12')]);return _0x1f42f7(_0x2f4a9e[_0x64f9('0x10')][_0x64f9('0x12')]);}else{logger[_0x64f9('0x13')](_0x64f9('0xd'),_0x303b55,_0x64f9('0xe'));_0x1f42f7(_0x2f4a9e[_0x64f9('0x14')]['message']);}})[_0x64f9('0x15')](function(_0x2f18e8){logger[_0x64f9('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x303b55,_0x2f18e8);_0x32b239(_0x2f18e8);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index e4ae76a..3669dd0 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 _0x17fe=['get','index','/describe','describe','/:id','isAuthenticated','show','/:id/questions','getQuestions','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptySessionReport.controller'];(function(_0x265aa2,_0x220072){var _0x447a3a=function(_0x1512cc){while(--_0x1512cc){_0x265aa2['push'](_0x265aa2['shift']());}};_0x447a3a(++_0x220072);}(_0x17fe,0x199));var _0xe17f=function(_0x333326,_0x305ddb){_0x333326=_0x333326-0x0;var _0x3d4223=_0x17fe[_0x333326];return _0x3d4223;};'use strict';var multer=require(_0xe17f('0x0'));var util=require(_0xe17f('0x1'));var path=require(_0xe17f('0x2'));var timeout=require(_0xe17f('0x3'));var express=require('express');var router=express[_0xe17f('0x4')]();var fs_extra=require(_0xe17f('0x5'));var auth=require(_0xe17f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe17f('0x7'));var controller=require(_0xe17f('0x8'));router[_0xe17f('0x9')]('/',auth['isAuthenticated'](),controller[_0xe17f('0xa')]);router[_0xe17f('0x9')](_0xe17f('0xb'),auth['isAuthenticated'](),controller[_0xe17f('0xc')]);router['get'](_0xe17f('0xd'),auth[_0xe17f('0xe')](),controller[_0xe17f('0xf')]);router['get'](_0xe17f('0x10'),auth['isAuthenticated'](),controller[_0xe17f('0x11')]);router['post']('/',auth[_0xe17f('0xe')](),controller['create']);router[_0xe17f('0x12')](_0xe17f('0xd'),auth['isAuthenticated'](),controller[_0xe17f('0x13')]);router['delete'](_0xe17f('0xd'),auth[_0xe17f('0xe')](),controller[_0xe17f('0x14')]);module[_0xe17f('0x15')]=router; \ No newline at end of file +var _0x7830=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','index','/describe','describe','isAuthenticated','show','getQuestions','post','/:id','exports','util','path','express','Router'];(function(_0x219536,_0x8e0b9b){var _0x231e4d=function(_0x37b376){while(--_0x37b376){_0x219536['push'](_0x219536['shift']());}};_0x231e4d(++_0x8e0b9b);}(_0x7830,0x119));var _0x0783=function(_0x33b147,_0x1450d8){_0x33b147=_0x33b147-0x0;var _0x461a75=_0x7830[_0x33b147];return _0x461a75;};'use strict';var multer=require('multer');var util=require(_0x0783('0x0'));var path=require(_0x0783('0x1'));var timeout=require('connect-timeout');var express=require(_0x0783('0x2'));var router=express[_0x0783('0x3')]();var fs_extra=require(_0x0783('0x4'));var auth=require(_0x0783('0x5'));var interaction=require(_0x0783('0x6'));var config=require(_0x0783('0x7'));var controller=require(_0x0783('0x8'));router[_0x0783('0x9')]('/',auth['isAuthenticated'](),controller[_0x0783('0xa')]);router['get'](_0x0783('0xb'),auth['isAuthenticated'](),controller[_0x0783('0xc')]);router[_0x0783('0x9')]('/:id',auth[_0x0783('0xd')](),controller[_0x0783('0xe')]);router[_0x0783('0x9')]('/:id/questions',auth[_0x0783('0xd')](),controller[_0x0783('0xf')]);router[_0x0783('0x10')]('/',auth[_0x0783('0xd')](),controller['create']);router['put'](_0x0783('0x11'),auth[_0x0783('0xd')](),controller['update']);router['delete'](_0x0783('0x11'),auth[_0x0783('0xd')](),controller['destroy']);module[_0x0783('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 952609d..332fb13 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 _0x9333=['STRING','BOOLEAN','moment','sequelize','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','DATE'];(function(_0x3e19b9,_0xe2b180){var _0x81c052=function(_0x1010dd){while(--_0x1010dd){_0x3e19b9['push'](_0x3e19b9['shift']());}};_0x81c052(++_0xe2b180);}(_0x9333,0x122));var _0x3933=function(_0x248fd5,_0x13e9a0){_0x248fd5=_0x248fd5-0x0;var _0x56bb6e=_0x9333[_0x248fd5];return _0x56bb6e;};'use strict';var moment=require(_0x3933('0x0'));var Sequelize=require(_0x3933('0x1'));module['exports']={'starttime':{'type':Sequelize['DATE'],'set':function(_0x1ea0b1){this[_0x3933('0x2')]('starttime',_0x1ea0b1);this['setDataValue'](_0x3933('0x3'),moment()[_0x3933('0x4')](_0x3933('0x5')));}},'endtime':{'type':Sequelize[_0x3933('0x6')]},'membername':{'type':Sequelize[_0x3933('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3933('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0x3933('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0xf326=['BOOLEAN','sequelize','exports','DATE','starttime','setDataValue','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0xf326,0x17d));var _0x6f32=function(_0x1aa7b1,_0xe9e31d){_0x1aa7b1=_0x1aa7b1-0x0;var _0x5d4ff4=_0xf326[_0x1aa7b1];return _0x5d4ff4;};'use strict';var moment=require('moment');var Sequelize=require(_0x6f32('0x0'));module[_0x6f32('0x1')]={'starttime':{'type':Sequelize[_0x6f32('0x2')],'set':function(_0x2a1e7a){this['setDataValue'](_0x6f32('0x3'),_0x2a1e7a);this[_0x6f32('0x4')](_0x6f32('0x5'),moment()[_0x6f32('0x6')](_0x6f32('0x7')));}},'endtime':{'type':Sequelize[_0x6f32('0x2')]},'membername':{'type':Sequelize[_0x6f32('0x8')]},'projectname':{'type':Sequelize[_0x6f32('0x8')]},'queue':{'type':Sequelize[_0x6f32('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6f32('0x8')]},'calleridnum':{'type':Sequelize[_0x6f32('0x8')]},'completed':{'type':Sequelize[_0x6f32('0x9')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 15dea55..992070b 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 _0xae65=['order','sort','SessionId','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','then','destroy','stack','name','index','JscriptySessionReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','filter','map','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','body','update','find','describe','getQuestions','JscriptyQuestionReport'];(function(_0x4afac5,_0x1ab4ed){var _0x2404b3=function(_0x5c700b){while(--_0x5c700b){_0x4afac5['push'](_0x4afac5['shift']());}};_0x2404b3(++_0x1ab4ed);}(_0xae65,0x18e));var _0x5ae6=function(_0x47b262,_0x45a382){_0x47b262=_0x47b262-0x0;var _0x223475=_0xae65[_0x47b262];return _0x223475;};'use strict';var emlformat=require(_0x5ae6('0x0'));var rimraf=require(_0x5ae6('0x1'));var zipdir=require(_0x5ae6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ae6('0x3'));var moment=require(_0x5ae6('0x4'));var BPromise=require(_0x5ae6('0x5'));var Mustache=require(_0x5ae6('0x6'));var util=require(_0x5ae6('0x7'));var path=require(_0x5ae6('0x8'));var sox=require(_0x5ae6('0x9'));var csv=require('to-csv');var ejs=require(_0x5ae6('0xa'));var fs=require('fs');var fs_extra=require(_0x5ae6('0xb'));var _=require('lodash');var squel=require(_0x5ae6('0xc'));var crypto=require(_0x5ae6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x5ae6('0xe'));var toCsv=require(_0x5ae6('0xf'));var querystring=require(_0x5ae6('0x10'));var Papa=require(_0x5ae6('0x11'));var Redis=require(_0x5ae6('0x12'));var authService=require(_0x5ae6('0x13'));var qs=require(_0x5ae6('0x14'));var as=require(_0x5ae6('0x15'));var hardwareService=require(_0x5ae6('0x16'));var logger=require('../../config/logger')(_0x5ae6('0x17'));var utils=require(_0x5ae6('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x5ae6('0x19'));var db=require(_0x5ae6('0x1a'))['db'];function respondWithStatusCode(_0x4e4dc5,_0x1433e0){_0x1433e0=_0x1433e0||0xcc;return function(_0x1d0f78){if(_0x1d0f78){return _0x4e4dc5['sendStatus'](_0x1433e0);}return _0x4e4dc5[_0x5ae6('0x1b')](_0x1433e0)['end']();};}function respondWithResult(_0x270118,_0x1698a5){_0x1698a5=_0x1698a5||0xc8;return function(_0x52e703){if(_0x52e703){return _0x270118[_0x5ae6('0x1b')](_0x1698a5)['json'](_0x52e703);}};}function respondWithFilteredResult(_0x47a62e,_0x345d90){return function(_0x1ba222){if(_0x1ba222){var _0x3cd933=typeof _0x345d90[_0x5ae6('0x1c')]===_0x5ae6('0x1d')&&typeof _0x345d90[_0x5ae6('0x1e')]==='undefined';var _0xc8ba28=_0x1ba222[_0x5ae6('0x1f')];var _0x676369=_0x3cd933?0x0:_0x345d90[_0x5ae6('0x1c')];var _0x57bf55=_0x3cd933?_0x1ba222[_0x5ae6('0x1f')]:_0x345d90[_0x5ae6('0x1c')]+_0x345d90[_0x5ae6('0x1e')];var _0x132ff7;if(_0x57bf55>=_0xc8ba28){_0x57bf55=_0xc8ba28;_0x132ff7=0xc8;}else{_0x132ff7=0xce;}_0x47a62e[_0x5ae6('0x1b')](_0x132ff7);return _0x47a62e[_0x5ae6('0x20')](_0x5ae6('0x21'),_0x676369+'-'+_0x57bf55+'/'+_0xc8ba28)['json'](_0x1ba222);}return null;};}function patchUpdates(_0x5e3f52){return function(_0x34e68f){try{jsonpatch[_0x5ae6('0x22')](_0x34e68f,_0x5e3f52,!![]);}catch(_0x186fee){return BPromise[_0x5ae6('0x23')](_0x186fee);}return _0x34e68f['save']();};}function saveUpdates(_0x24da77,_0x11d406){return function(_0x3bce66){if(_0x3bce66){return _0x3bce66['update'](_0x24da77)[_0x5ae6('0x24')](function(_0x4f4ecc){return _0x4f4ecc;});}return null;};}function removeEntity(_0x2256c2,_0x117567){return function(_0x1ff030){if(_0x1ff030){return _0x1ff030[_0x5ae6('0x25')]()[_0x5ae6('0x24')](function(){_0x2256c2[_0x5ae6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1e6d65,_0x3fffe8){return function(_0x4227f0){if(!_0x4227f0){_0x1e6d65['sendStatus'](0x194);}return _0x4227f0;};}function handleError(_0x7da868,_0x2fdedc){_0x2fdedc=_0x2fdedc||0x1f4;return function(_0x4887ad){logger['error'](_0x4887ad[_0x5ae6('0x26')]);if(_0x4887ad[_0x5ae6('0x27')]){delete _0x4887ad[_0x5ae6('0x27')];}_0x7da868[_0x5ae6('0x1b')](_0x2fdedc)['send'](_0x4887ad);};}exports[_0x5ae6('0x28')]=function(_0x5f2533,_0x140fe2){var _0x31aedd={},_0x4fde8f={},_0x468b95={'count':0x0,'rows':[]};var _0x13aa06=_['map'](db[_0x5ae6('0x29')][_0x5ae6('0x2a')],function(_0x4176de){return{'name':_0x4176de[_0x5ae6('0x2b')],'type':_0x4176de['type'][_0x5ae6('0x2c')]};});_0x4fde8f[_0x5ae6('0x2d')]=_['map'](_0x13aa06,_0x5ae6('0x27'));_0x4fde8f[_0x5ae6('0x2e')]=_[_0x5ae6('0x2f')](_0x5f2533[_0x5ae6('0x2e')]);_0x4fde8f['filters']=_[_0x5ae6('0x30')](_0x4fde8f[_0x5ae6('0x2d')],_0x4fde8f[_0x5ae6('0x2e')]);_0x31aedd[_0x5ae6('0x31')]=_['intersection'](_0x4fde8f[_0x5ae6('0x2d')],qs[_0x5ae6('0x32')](_0x5f2533[_0x5ae6('0x2e')][_0x5ae6('0x32')]));_0x31aedd['attributes']=_0x31aedd['attributes'][_0x5ae6('0x33')]?_0x31aedd[_0x5ae6('0x31')]:_0x4fde8f[_0x5ae6('0x2d')];if(!_0x5f2533[_0x5ae6('0x2e')][_0x5ae6('0x34')](_0x5ae6('0x35'))){_0x31aedd['limit']=qs[_0x5ae6('0x1e')](_0x5f2533[_0x5ae6('0x2e')][_0x5ae6('0x1e')]);_0x31aedd[_0x5ae6('0x1c')]=qs[_0x5ae6('0x1c')](_0x5f2533[_0x5ae6('0x2e')][_0x5ae6('0x1c')]);}_0x31aedd['order']=qs['sort'](_0x5f2533[_0x5ae6('0x2e')]['sort']);_0x31aedd[_0x5ae6('0x36')]=qs[_0x5ae6('0x37')](_[_0x5ae6('0x38')](_0x5f2533['query'],_0x4fde8f['filters']),_0x13aa06);if(_0x5f2533[_0x5ae6('0x2e')][_0x5ae6('0x39')]){_0x31aedd[_0x5ae6('0x36')]=_['merge'](_0x31aedd[_0x5ae6('0x36')],{'$or':_[_0x5ae6('0x3a')](_0x13aa06,function(_0x45d85e){if(_0x45d85e[_0x5ae6('0x3b')]!==_0x5ae6('0x3c')){var _0x2f5dc6={};_0x2f5dc6[_0x45d85e[_0x5ae6('0x27')]]={'$like':'%'+_0x5f2533[_0x5ae6('0x2e')]['filter']+'%'};return _0x2f5dc6;}})});}_0x31aedd=_[_0x5ae6('0x3d')]({},_0x31aedd,_0x5f2533[_0x5ae6('0x3e')]);var _0x44f9b9={'where':_0x31aedd[_0x5ae6('0x36')]};return db['JscriptySessionReport']['count'](_0x44f9b9)['then'](function(_0x2f68fe){_0x468b95[_0x5ae6('0x1f')]=_0x2f68fe;if(_0x5f2533[_0x5ae6('0x2e')][_0x5ae6('0x3f')]){_0x31aedd[_0x5ae6('0x40')]=[{'all':!![]}];}return db[_0x5ae6('0x29')][_0x5ae6('0x41')](_0x31aedd);})[_0x5ae6('0x24')](function(_0x41661b){_0x468b95[_0x5ae6('0x42')]=_0x41661b;return _0x468b95;})[_0x5ae6('0x24')](respondWithFilteredResult(_0x140fe2,_0x31aedd))[_0x5ae6('0x43')](handleError(_0x140fe2,null));};exports[_0x5ae6('0x44')]=function(_0x12b6ba,_0x3f7cba){var _0x3a70fd={'raw':!![],'where':{'id':_0x12b6ba[_0x5ae6('0x45')]['id']}},_0x3b606d={};_0x3b606d[_0x5ae6('0x2d')]=_['keys'](db[_0x5ae6('0x29')][_0x5ae6('0x2a')]);_0x3b606d[_0x5ae6('0x2e')]=_[_0x5ae6('0x2f')](_0x12b6ba[_0x5ae6('0x2e')]);_0x3b606d[_0x5ae6('0x37')]=_[_0x5ae6('0x30')](_0x3b606d['model'],_0x3b606d[_0x5ae6('0x2e')]);_0x3a70fd[_0x5ae6('0x31')]=_[_0x5ae6('0x30')](_0x3b606d[_0x5ae6('0x2d')],qs[_0x5ae6('0x32')](_0x12b6ba[_0x5ae6('0x2e')][_0x5ae6('0x32')]));_0x3a70fd['attributes']=_0x3a70fd['attributes'][_0x5ae6('0x33')]?_0x3a70fd[_0x5ae6('0x31')]:_0x3b606d['model'];if(_0x12b6ba[_0x5ae6('0x2e')][_0x5ae6('0x3f')]){_0x3a70fd[_0x5ae6('0x40')]=[{'all':!![]}];}_0x3a70fd=_[_0x5ae6('0x3d')]({},_0x3a70fd,_0x12b6ba['options']);return db[_0x5ae6('0x29')]['find'](_0x3a70fd)[_0x5ae6('0x24')](handleEntityNotFound(_0x3f7cba,null))[_0x5ae6('0x24')](respondWithResult(_0x3f7cba,null))[_0x5ae6('0x43')](handleError(_0x3f7cba,null));};exports['create']=function(_0x2f93bf,_0x28a65f){return db[_0x5ae6('0x29')]['create'](_0x2f93bf[_0x5ae6('0x46')],{})[_0x5ae6('0x24')](respondWithResult(_0x28a65f,0xc9))['catch'](handleError(_0x28a65f,null));};exports[_0x5ae6('0x47')]=function(_0xe13252,_0x115fe7){if(_0xe13252[_0x5ae6('0x46')]['id']){delete _0xe13252[_0x5ae6('0x46')]['id'];}return db[_0x5ae6('0x29')][_0x5ae6('0x48')]({'where':{'id':_0xe13252['params']['id']}})['then'](handleEntityNotFound(_0x115fe7,null))['then'](saveUpdates(_0xe13252[_0x5ae6('0x46')],null))['then'](respondWithResult(_0x115fe7,null))[_0x5ae6('0x43')](handleError(_0x115fe7,null));};exports[_0x5ae6('0x25')]=function(_0x43e4ad,_0x5d666b){return db[_0x5ae6('0x29')]['find']({'where':{'id':_0x43e4ad['params']['id']}})[_0x5ae6('0x24')](handleEntityNotFound(_0x5d666b,null))[_0x5ae6('0x24')](removeEntity(_0x5d666b,null))[_0x5ae6('0x43')](handleError(_0x5d666b,null));};exports[_0x5ae6('0x49')]=function(_0x36fda8,_0x33921d){return db['JscriptySessionReport'][_0x5ae6('0x49')]()['then'](respondWithResult(_0x33921d,null))[_0x5ae6('0x43')](handleError(_0x33921d,null));};exports[_0x5ae6('0x4a')]=function(_0x249180,_0x130bea,_0xe2f943){var _0x3877f3={'raw':!![],'where':{}};var _0x29a082={};var _0x13b80d={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x249180[_0x5ae6('0x45')]['id']}})[_0x5ae6('0x24')](handleEntityNotFound(_0x130bea,null))[_0x5ae6('0x24')](function(_0x2e3d30){if(_0x2e3d30){_0x29a082['model']=_[_0x5ae6('0x2f')](db[_0x5ae6('0x4b')][_0x5ae6('0x2a')]);_0x29a082['query']=_[_0x5ae6('0x2f')](_0x249180[_0x5ae6('0x2e')]);_0x29a082[_0x5ae6('0x37')]=_[_0x5ae6('0x30')](_0x29a082['model'],_0x29a082['query']);_0x3877f3['attributes']=_[_0x5ae6('0x30')](_0x29a082['model'],qs[_0x5ae6('0x32')](_0x249180['query']['fields']));_0x3877f3[_0x5ae6('0x31')]=_0x3877f3[_0x5ae6('0x31')]['length']?_0x3877f3[_0x5ae6('0x31')]:_0x29a082[_0x5ae6('0x2d')];if(!_0x249180[_0x5ae6('0x2e')]['hasOwnProperty'](_0x5ae6('0x35'))){_0x3877f3['limit']=qs[_0x5ae6('0x1e')](_0x249180['query'][_0x5ae6('0x1e')]);_0x3877f3[_0x5ae6('0x1c')]=qs['offset'](_0x249180[_0x5ae6('0x2e')][_0x5ae6('0x1c')]);}_0x3877f3[_0x5ae6('0x4c')]=qs['sort'](_0x249180[_0x5ae6('0x2e')][_0x5ae6('0x4d')]);_0x3877f3[_0x5ae6('0x36')]=qs['filters'](_[_0x5ae6('0x38')](_0x249180[_0x5ae6('0x2e')],_0x29a082['filters']));_0x3877f3[_0x5ae6('0x36')][_0x5ae6('0x4e')]=_0x2e3d30['id'];if(_0x249180[_0x5ae6('0x2e')]['filter']){_0x3877f3[_0x5ae6('0x36')]=_[_0x5ae6('0x3d')](_0x3877f3['where'],{'$or':_[_0x5ae6('0x3a')](_0x3877f3[_0x5ae6('0x31')],function(_0x118a99){var _0x3bbca4={};_0x3bbca4[_0x118a99]={'$like':'%'+_0x249180[_0x5ae6('0x2e')][_0x5ae6('0x39')]+'%'};return _0x3bbca4;})});}_0x3877f3=_['merge']({},_0x3877f3,_0x249180[_0x5ae6('0x3e')]);return db[_0x5ae6('0x4b')][_0x5ae6('0x1f')]({'where':_0x3877f3[_0x5ae6('0x36')]})['then'](function(_0x553e6d){_0x13b80d[_0x5ae6('0x1f')]=_0x553e6d;if(_0x249180[_0x5ae6('0x2e')][_0x5ae6('0x3f')]){_0x3877f3[_0x5ae6('0x40')]=[{'all':!![]}];}return db[_0x5ae6('0x4b')][_0x5ae6('0x41')](_0x3877f3);})[_0x5ae6('0x24')](function(_0x458bd1){_0x13b80d['rows']=_0x458bd1;return _0x13b80d;});}})[_0x5ae6('0x24')](respondWithFilteredResult(_0x130bea,_0x3877f3))[_0x5ae6('0x43')](handleError(_0x130bea,null));}; \ No newline at end of file +var _0xc99e=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','JscriptySessionReport','includeAll','include','findAll','rows','merge','catch','create','body','params','find','describe','getQuestions','findOne','JscriptyQuestionReport','eml-format','rimraf','zip-dir','mustache','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis'];(function(_0x46aabc,_0x1b0b24){var _0x10c273=function(_0x341129){while(--_0x341129){_0x46aabc['push'](_0x46aabc['shift']());}};_0x10c273(++_0x1b0b24);}(_0xc99e,0x1a8));var _0xec99=function(_0x163913,_0x4b2a6a){_0x163913=_0x163913-0x0;var _0x51cc2e=_0xc99e[_0x163913];return _0x51cc2e;};'use strict';var emlformat=require(_0xec99('0x0'));var rimraf=require(_0xec99('0x1'));var zipdir=require(_0xec99('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xec99('0x3'));var util=require('util');var path=require(_0xec99('0x4'));var sox=require('sox');var csv=require(_0xec99('0x5'));var ejs=require(_0xec99('0x6'));var fs=require('fs');var fs_extra=require(_0xec99('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xec99('0x8'));var jsforce=require(_0xec99('0x9'));var deskjs=require(_0xec99('0xa'));var toCsv=require(_0xec99('0x5'));var querystring=require(_0xec99('0xb'));var Papa=require(_0xec99('0xc'));var Redis=require(_0xec99('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xec99('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xec99('0xf'));var logger=require(_0xec99('0x10'))(_0xec99('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xec99('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5cce87,_0x1f987a){_0x1f987a=_0x1f987a||0xcc;return function(_0x44c657){if(_0x44c657){return _0x5cce87[_0xec99('0x13')](_0x1f987a);}return _0x5cce87[_0xec99('0x14')](_0x1f987a)[_0xec99('0x15')]();};}function respondWithResult(_0xe2dab5,_0x259539){_0x259539=_0x259539||0xc8;return function(_0x283a03){if(_0x283a03){return _0xe2dab5[_0xec99('0x14')](_0x259539)[_0xec99('0x16')](_0x283a03);}};}function respondWithFilteredResult(_0x1e5708,_0x524138){return function(_0x19a2fb){if(_0x19a2fb){var _0x26704a=typeof _0x524138[_0xec99('0x17')]==='undefined'&&typeof _0x524138[_0xec99('0x18')]===_0xec99('0x19');var _0x49be0d=_0x19a2fb['count'];var _0x4deca5=_0x26704a?0x0:_0x524138['offset'];var _0x552107=_0x26704a?_0x19a2fb[_0xec99('0x1a')]:_0x524138[_0xec99('0x17')]+_0x524138[_0xec99('0x18')];var _0x3ced25;if(_0x552107>=_0x49be0d){_0x552107=_0x49be0d;_0x3ced25=0xc8;}else{_0x3ced25=0xce;}_0x1e5708[_0xec99('0x14')](_0x3ced25);return _0x1e5708['set'](_0xec99('0x1b'),_0x4deca5+'-'+_0x552107+'/'+_0x49be0d)[_0xec99('0x16')](_0x19a2fb);}return null;};}function patchUpdates(_0x49abc1){return function(_0x1af0d6){try{jsonpatch[_0xec99('0x1c')](_0x1af0d6,_0x49abc1,!![]);}catch(_0x1a99b9){return BPromise[_0xec99('0x1d')](_0x1a99b9);}return _0x1af0d6[_0xec99('0x1e')]();};}function saveUpdates(_0x43f22b,_0x12012f){return function(_0x199471){if(_0x199471){return _0x199471[_0xec99('0x1f')](_0x43f22b)[_0xec99('0x20')](function(_0x419da8){return _0x419da8;});}return null;};}function removeEntity(_0x35f38f,_0x30405a){return function(_0x470302){if(_0x470302){return _0x470302[_0xec99('0x21')]()[_0xec99('0x20')](function(){_0x35f38f[_0xec99('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x38cd08,_0x165fd1){return function(_0x174179){if(!_0x174179){_0x38cd08['sendStatus'](0x194);}return _0x174179;};}function handleError(_0x1daa06,_0x2948ad){_0x2948ad=_0x2948ad||0x1f4;return function(_0x16f3cf){logger[_0xec99('0x22')](_0x16f3cf[_0xec99('0x23')]);if(_0x16f3cf[_0xec99('0x24')]){delete _0x16f3cf[_0xec99('0x24')];}_0x1daa06[_0xec99('0x14')](_0x2948ad)[_0xec99('0x25')](_0x16f3cf);};}exports['index']=function(_0x21883b,_0x7fddf6){var _0x41b2c9={},_0x2b55bd={},_0x47509e={'count':0x0,'rows':[]};var _0x278e64=_[_0xec99('0x26')](db['JscriptySessionReport'][_0xec99('0x27')],function(_0x4b514b){return{'name':_0x4b514b['fieldName'],'type':_0x4b514b['type'][_0xec99('0x28')]};});_0x2b55bd['model']=_[_0xec99('0x26')](_0x278e64,_0xec99('0x24'));_0x2b55bd[_0xec99('0x29')]=_[_0xec99('0x2a')](_0x21883b['query']);_0x2b55bd[_0xec99('0x2b')]=_[_0xec99('0x2c')](_0x2b55bd[_0xec99('0x2d')],_0x2b55bd[_0xec99('0x29')]);_0x41b2c9[_0xec99('0x2e')]=_['intersection'](_0x2b55bd[_0xec99('0x2d')],qs[_0xec99('0x2f')](_0x21883b[_0xec99('0x29')][_0xec99('0x2f')]));_0x41b2c9[_0xec99('0x2e')]=_0x41b2c9[_0xec99('0x2e')][_0xec99('0x30')]?_0x41b2c9[_0xec99('0x2e')]:_0x2b55bd[_0xec99('0x2d')];if(!_0x21883b[_0xec99('0x29')][_0xec99('0x31')](_0xec99('0x32'))){_0x41b2c9[_0xec99('0x18')]=qs[_0xec99('0x18')](_0x21883b['query'][_0xec99('0x18')]);_0x41b2c9[_0xec99('0x17')]=qs[_0xec99('0x17')](_0x21883b[_0xec99('0x29')][_0xec99('0x17')]);}_0x41b2c9[_0xec99('0x33')]=qs[_0xec99('0x34')](_0x21883b[_0xec99('0x29')]['sort']);_0x41b2c9[_0xec99('0x35')]=qs[_0xec99('0x2b')](_[_0xec99('0x36')](_0x21883b[_0xec99('0x29')],_0x2b55bd[_0xec99('0x2b')]),_0x278e64);if(_0x21883b[_0xec99('0x29')][_0xec99('0x37')]){_0x41b2c9[_0xec99('0x35')]=_['merge'](_0x41b2c9['where'],{'$or':_['map'](_0x278e64,function(_0x4809df){if(_0x4809df['type']!==_0xec99('0x38')){var _0x8e276c={};_0x8e276c[_0x4809df['name']]={'$like':'%'+_0x21883b[_0xec99('0x29')][_0xec99('0x37')]+'%'};return _0x8e276c;}})});}_0x41b2c9=_['merge']({},_0x41b2c9,_0x21883b[_0xec99('0x39')]);var _0x2ca74b={'where':_0x41b2c9['where']};return db[_0xec99('0x3a')][_0xec99('0x1a')](_0x2ca74b)['then'](function(_0x38978d){_0x47509e['count']=_0x38978d;if(_0x21883b[_0xec99('0x29')][_0xec99('0x3b')]){_0x41b2c9[_0xec99('0x3c')]=[{'all':!![]}];}return db[_0xec99('0x3a')][_0xec99('0x3d')](_0x41b2c9);})[_0xec99('0x20')](function(_0x5b70dd){_0x47509e[_0xec99('0x3e')]=_0x5b70dd;return _0x47509e;})[_0xec99('0x20')](respondWithFilteredResult(_0x7fddf6,_0x41b2c9))['catch'](handleError(_0x7fddf6,null));};exports['show']=function(_0x1a641b,_0x353137){var _0x2b817f={'raw':!![],'where':{'id':_0x1a641b['params']['id']}},_0x3f143f={};_0x3f143f[_0xec99('0x2d')]=_[_0xec99('0x2a')](db[_0xec99('0x3a')][_0xec99('0x27')]);_0x3f143f[_0xec99('0x29')]=_[_0xec99('0x2a')](_0x1a641b[_0xec99('0x29')]);_0x3f143f[_0xec99('0x2b')]=_[_0xec99('0x2c')](_0x3f143f[_0xec99('0x2d')],_0x3f143f['query']);_0x2b817f[_0xec99('0x2e')]=_[_0xec99('0x2c')](_0x3f143f['model'],qs[_0xec99('0x2f')](_0x1a641b[_0xec99('0x29')][_0xec99('0x2f')]));_0x2b817f['attributes']=_0x2b817f[_0xec99('0x2e')][_0xec99('0x30')]?_0x2b817f[_0xec99('0x2e')]:_0x3f143f['model'];if(_0x1a641b[_0xec99('0x29')][_0xec99('0x3b')]){_0x2b817f[_0xec99('0x3c')]=[{'all':!![]}];}_0x2b817f=_[_0xec99('0x3f')]({},_0x2b817f,_0x1a641b[_0xec99('0x39')]);return db[_0xec99('0x3a')]['find'](_0x2b817f)[_0xec99('0x20')](handleEntityNotFound(_0x353137,null))[_0xec99('0x20')](respondWithResult(_0x353137,null))[_0xec99('0x40')](handleError(_0x353137,null));};exports[_0xec99('0x41')]=function(_0x2fb54d,_0x1b16d6){return db[_0xec99('0x3a')][_0xec99('0x41')](_0x2fb54d[_0xec99('0x42')],{})['then'](respondWithResult(_0x1b16d6,0xc9))[_0xec99('0x40')](handleError(_0x1b16d6,null));};exports['update']=function(_0x403aea,_0x231673){if(_0x403aea[_0xec99('0x42')]['id']){delete _0x403aea[_0xec99('0x42')]['id'];}return db[_0xec99('0x3a')]['find']({'where':{'id':_0x403aea[_0xec99('0x43')]['id']}})[_0xec99('0x20')](handleEntityNotFound(_0x231673,null))[_0xec99('0x20')](saveUpdates(_0x403aea[_0xec99('0x42')],null))['then'](respondWithResult(_0x231673,null))[_0xec99('0x40')](handleError(_0x231673,null));};exports[_0xec99('0x21')]=function(_0x1078e6,_0x11e36e){return db[_0xec99('0x3a')][_0xec99('0x44')]({'where':{'id':_0x1078e6[_0xec99('0x43')]['id']}})[_0xec99('0x20')](handleEntityNotFound(_0x11e36e,null))[_0xec99('0x20')](removeEntity(_0x11e36e,null))[_0xec99('0x40')](handleError(_0x11e36e,null));};exports[_0xec99('0x45')]=function(_0x5be2f5,_0x5ba492){return db[_0xec99('0x3a')][_0xec99('0x45')]()[_0xec99('0x20')](respondWithResult(_0x5ba492,null))['catch'](handleError(_0x5ba492,null));};exports[_0xec99('0x46')]=function(_0xf14251,_0x5995fb,_0x3763d2){var _0x2c49c8={'raw':!![],'where':{}};var _0x4753e3={};var _0x5849e3={'count':0x0,'rows':[]};return db[_0xec99('0x3a')][_0xec99('0x47')]({'where':{'id':_0xf14251[_0xec99('0x43')]['id']}})[_0xec99('0x20')](handleEntityNotFound(_0x5995fb,null))[_0xec99('0x20')](function(_0x54cdc3){if(_0x54cdc3){_0x4753e3[_0xec99('0x2d')]=_[_0xec99('0x2a')](db[_0xec99('0x48')][_0xec99('0x27')]);_0x4753e3[_0xec99('0x29')]=_[_0xec99('0x2a')](_0xf14251['query']);_0x4753e3[_0xec99('0x2b')]=_[_0xec99('0x2c')](_0x4753e3[_0xec99('0x2d')],_0x4753e3[_0xec99('0x29')]);_0x2c49c8[_0xec99('0x2e')]=_[_0xec99('0x2c')](_0x4753e3[_0xec99('0x2d')],qs[_0xec99('0x2f')](_0xf14251[_0xec99('0x29')]['fields']));_0x2c49c8[_0xec99('0x2e')]=_0x2c49c8[_0xec99('0x2e')][_0xec99('0x30')]?_0x2c49c8[_0xec99('0x2e')]:_0x4753e3[_0xec99('0x2d')];if(!_0xf14251[_0xec99('0x29')]['hasOwnProperty'](_0xec99('0x32'))){_0x2c49c8[_0xec99('0x18')]=qs[_0xec99('0x18')](_0xf14251[_0xec99('0x29')][_0xec99('0x18')]);_0x2c49c8[_0xec99('0x17')]=qs[_0xec99('0x17')](_0xf14251['query'][_0xec99('0x17')]);}_0x2c49c8[_0xec99('0x33')]=qs['sort'](_0xf14251['query'][_0xec99('0x34')]);_0x2c49c8[_0xec99('0x35')]=qs[_0xec99('0x2b')](_[_0xec99('0x36')](_0xf14251[_0xec99('0x29')],_0x4753e3[_0xec99('0x2b')]));_0x2c49c8[_0xec99('0x35')]['SessionId']=_0x54cdc3['id'];if(_0xf14251[_0xec99('0x29')]['filter']){_0x2c49c8[_0xec99('0x35')]=_[_0xec99('0x3f')](_0x2c49c8['where'],{'$or':_['map'](_0x2c49c8[_0xec99('0x2e')],function(_0x353dcd){var _0x5420fc={};_0x5420fc[_0x353dcd]={'$like':'%'+_0xf14251['query'][_0xec99('0x37')]+'%'};return _0x5420fc;})});}_0x2c49c8=_['merge']({},_0x2c49c8,_0xf14251[_0xec99('0x39')]);return db['JscriptyQuestionReport'][_0xec99('0x1a')]({'where':_0x2c49c8['where']})['then'](function(_0x11eb49){_0x5849e3[_0xec99('0x1a')]=_0x11eb49;if(_0xf14251[_0xec99('0x29')][_0xec99('0x3b')]){_0x2c49c8['include']=[{'all':!![]}];}return db[_0xec99('0x48')][_0xec99('0x3d')](_0x2c49c8);})[_0xec99('0x20')](function(_0xdd6495){_0x5849e3[_0xec99('0x3e')]=_0xdd6495;return _0x5849e3;});}})[_0xec99('0x20')](respondWithFilteredResult(_0x5995fb,_0x2c49c8))['catch'](handleError(_0x5995fb,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 84ac7c2..4e967b0 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 _0xa46e=['api','moment','bluebird','path','../../config/environment','exports','define','report_jscripty_sessions','lodash','util'];(function(_0x40be86,_0x68fe5d){var _0xda3c3b=function(_0x39deab){while(--_0x39deab){_0x40be86['push'](_0x40be86['shift']());}};_0xda3c3b(++_0x68fe5d);}(_0xa46e,0x8a));var _0xea46=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa46e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var logger=require('../../config/logger')(_0xea46('0x2'));var moment=require(_0xea46('0x3'));var BPromise=require(_0xea46('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xea46('0x5'));var rimraf=require('rimraf');var config=require(_0xea46('0x6'));var attributes=require('./jscriptySessionReport.attributes');module[_0xea46('0x7')]=function(_0x528404,_0x10bee5){return _0x528404[_0xea46('0x8')]('JscriptySessionReport',attributes,{'tableName':_0xea46('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x277c=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','report_jscripty_sessions','lodash','../../config/logger'];(function(_0x4ed638,_0x3980f6){var _0x1cdfec=function(_0x35f493){while(--_0x35f493){_0x4ed638['push'](_0x4ed638['shift']());}};_0x1cdfec(++_0x3980f6);}(_0x277c,0x153));var _0xc277=function(_0x5846ed,_0x2fa366){_0x5846ed=_0x5846ed-0x0;var _0x6fc50f=_0x277c[_0x5846ed];return _0x6fc50f;};'use strict';var _=require(_0xc277('0x0'));var util=require('util');var logger=require(_0xc277('0x1'))(_0xc277('0x2'));var moment=require(_0xc277('0x3'));var BPromise=require(_0xc277('0x4'));var rp=require(_0xc277('0x5'));var fs=require('fs');var path=require(_0xc277('0x6'));var rimraf=require(_0xc277('0x7'));var config=require(_0xc277('0x8'));var attributes=require('./jscriptySessionReport.attributes');module['exports']=function(_0x1a6582,_0x5a4f03){return _0x1a6582[_0xc277('0x9')]('JscriptySessionReport',attributes,{'tableName':_0xc277('0xa'),'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 17b3025..b91f6d0 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 _0x7b84=['jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x345adf,_0x436de3){var _0x494cb9=function(_0x1c8ac6){while(--_0x1c8ac6){_0x345adf['push'](_0x345adf['shift']());}};_0x494cb9(++_0x436de3);}(_0x7b84,0x17c));var _0x47b8=function(_0x930774,_0x38c07f){_0x930774=_0x930774-0x0;var _0x43de76=_0x7b84[_0x930774];return _0x43de76;};'use strict';var _=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var moment=require(_0x47b8('0x2'));var BPromise=require(_0x47b8('0x3'));var rs=require(_0x47b8('0x4'));var fs=require('fs');var Redis=require(_0x47b8('0x5'));var db=require(_0x47b8('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x47b8('0x7'))(_0x47b8('0x8'));var config=require(_0x47b8('0x9'));var jayson=require(_0x47b8('0xa'));var client=jayson[_0x47b8('0xb')][_0x47b8('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x53e656,_0x3867ca,_0x3ce846){return new BPromise(function(_0x46245a,_0xb845c9){return client[_0x47b8('0xd')](_0x53e656,_0x3ce846)[_0x47b8('0xe')](function(_0x24d240){logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));logger[_0x47b8('0x12')](_0x47b8('0x13'),_0x3867ca,_0x47b8('0x11'),JSON[_0x47b8('0x14')](_0x24d240));if(_0x24d240[_0x47b8('0x15')]){if(_0x24d240[_0x47b8('0x15')][_0x47b8('0x16')]===0x1f4){logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0xb845c9(_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);}logger[_0x47b8('0x15')](_0x47b8('0x10'),_0x3867ca,_0x24d240[_0x47b8('0x15')][_0x47b8('0x17')]);return _0x46245a(_0x24d240['error'][_0x47b8('0x17')]);}else{logger[_0x47b8('0xf')](_0x47b8('0x10'),_0x3867ca,_0x47b8('0x11'));_0x46245a(_0x24d240[_0x47b8('0x18')][_0x47b8('0x17')]);}})[_0x47b8('0x19')](function(_0x5ad3ae){logger[_0x47b8('0x15')]('JscriptySessionReport,\x20%s,\x20%s',_0x3867ca,_0x5ad3ae);_0xb845c9(_0x5ad3ae);});});} \ No newline at end of file +var _0xdf55=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptySessionReport,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x191b8c,_0x6cc2e){var _0x1f231b=function(_0x339ee9){while(--_0x339ee9){_0x191b8c['push'](_0x191b8c['shift']());}};_0x1f231b(++_0x6cc2e);}(_0xdf55,0x83));var _0x5df5=function(_0x34eb0d,_0x43448b){_0x34eb0d=_0x34eb0d-0x0;var _0x309bb3=_0xdf55[_0x34eb0d];return _0x309bb3;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('JscriptySessionReport,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 44c1ca6..7060764 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 _0x1380=['../../components/interaction/service','./license.controller','get','index','put','/:id','update','/download_log_file','isAuthenticated','downloadLogFile','exports','multer','path','connect-timeout','express'];(function(_0x157eb6,_0x39d9c0){var _0x5da78c=function(_0x38418c){while(--_0x38418c){_0x157eb6['push'](_0x157eb6['shift']());}};_0x5da78c(++_0x39d9c0);}(_0x1380,0x182));var _0x0138=function(_0x495cb0,_0x534076){_0x495cb0=_0x495cb0-0x0;var _0x2601d9=_0x1380[_0x495cb0];return _0x2601d9;};'use strict';var multer=require(_0x0138('0x0'));var util=require('util');var path=require(_0x0138('0x1'));var timeout=require(_0x0138('0x2'));var express=require(_0x0138('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0138('0x4'));var config=require('../../config/environment');var controller=require(_0x0138('0x5'));router[_0x0138('0x6')]('/',controller[_0x0138('0x7')]);router[_0x0138('0x8')](_0x0138('0x9'),auth['isAuthenticated'](),controller[_0x0138('0xa')]);router[_0x0138('0x6')](_0x0138('0xb'),auth[_0x0138('0xc')](),controller[_0x0138('0xd')]);module[_0x0138('0xe')]=router; \ No newline at end of file +var _0x80b9=['multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','/:id','isAuthenticated','update','/download_log_file','exports'];(function(_0x57fa92,_0x2f0492){var _0x303ffd=function(_0x5eaa18){while(--_0x5eaa18){_0x57fa92['push'](_0x57fa92['shift']());}};_0x303ffd(++_0x2f0492);}(_0x80b9,0x9a));var _0x980b=function(_0x33a7e9,_0x2dd7cb){_0x33a7e9=_0x33a7e9-0x0;var _0x480fe0=_0x80b9[_0x33a7e9];return _0x480fe0;};'use strict';var multer=require(_0x980b('0x0'));var util=require(_0x980b('0x1'));var path=require(_0x980b('0x2'));var timeout=require(_0x980b('0x3'));var express=require('express');var router=express[_0x980b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x980b('0x5'));var interaction=require(_0x980b('0x6'));var config=require(_0x980b('0x7'));var controller=require(_0x980b('0x8'));router['get']('/',controller['index']);router['put'](_0x980b('0x9'),auth[_0x980b('0xa')](),controller[_0x980b('0xb')]);router['get'](_0x980b('0xc'),auth['isAuthenticated'](),controller['downloadLogFile']);module[_0x980b('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 fdc3063..4372c69 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 _0x74f1=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0xb8c217,_0x3ce564){var _0x1f3aad=function(_0x20e644){while(--_0x20e644){_0xb8c217['push'](_0xb8c217['shift']());}};_0x1f3aad(++_0x3ce564);}(_0x74f1,0x11f));var _0x174f=function(_0x590b71,_0xf2162b){_0x590b71=_0x590b71-0x0;var _0x4bbc59=_0x74f1[_0x590b71];return _0x4bbc59;};'use strict';var Sequelize=require(_0x174f('0x0'));module[_0x174f('0x1')]={'license':{'type':Sequelize[_0x174f('0x2')]},'data1':{'type':Sequelize[_0x174f('0x3')]},'data2':{'type':Sequelize[_0x174f('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x174f('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xdec1=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x4d5cce,_0x3082d7){var _0x5e2e77=function(_0xd79ddf){while(--_0xd79ddf){_0x4d5cce['push'](_0x4d5cce['shift']());}};_0x5e2e77(++_0x3082d7);}(_0xdec1,0x17e));var _0x1dec=function(_0x2687ff,_0x190caf){_0x2687ff=_0x2687ff-0x0;var _0x5a4160=_0xdec1[_0x2687ff];return _0x5a4160;};'use strict';var Sequelize=require(_0x1dec('0x0'));module[_0x1dec('0x1')]={'license':{'type':Sequelize[_0x1dec('0x2')]},'data1':{'type':Sequelize[_0x1dec('0x3')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize[_0x1dec('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 d067b43..f7d4be9 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 _0xd54e=['zip-dir','fast-json-patch','moment','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/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','keys','rawAttributes','query','filters','intersection','model','attributes','fields','length','options','getLicense','body','find','get','catch','downloadLogFile','license-info.log','join','log','setHeader','attachment;\x20filename=','Content-Type','text/plain','download','rimraf'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd54e,0x107));var _0xed54=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd54e[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xed54('0x0'));var zipdir=require(_0xed54('0x1'));var jsonpatch=require(_0xed54('0x2'));var rp=require('request-promise');var moment=require(_0xed54('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xed54('0x4'));var util=require(_0xed54('0x5'));var path=require(_0xed54('0x6'));var sox=require(_0xed54('0x7'));var csv=require(_0xed54('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xed54('0x9'));var squel=require(_0xed54('0xa'));var crypto=require(_0xed54('0xb'));var jsforce=require(_0xed54('0xc'));var deskjs=require(_0xed54('0xd'));var toCsv=require(_0xed54('0x8'));var querystring=require(_0xed54('0xe'));var Papa=require('papaparse');var Redis=require(_0xed54('0xf'));var authService=require(_0xed54('0x10'));var qs=require(_0xed54('0x11'));var as=require(_0xed54('0x12'));var hardwareService=require(_0xed54('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xed54('0x14'));var licenseUtil=require(_0xed54('0x15'));var db=require(_0xed54('0x16'))['db'];function respondWithStatusCode(_0x3f5974,_0x53194a){_0x53194a=_0x53194a||0xcc;return function(_0x214289){if(_0x214289){return _0x3f5974[_0xed54('0x17')](_0x53194a);}return _0x3f5974['status'](_0x53194a)[_0xed54('0x18')]();};}function respondWithResult(_0x46f756,_0x22b72f){_0x22b72f=_0x22b72f||0xc8;return function(_0x237528){if(_0x237528){return _0x46f756[_0xed54('0x19')](_0x22b72f)[_0xed54('0x1a')](_0x237528);}};}function respondWithFilteredResult(_0x13fd5a,_0x386e3d){return function(_0x4d1a0a){if(_0x4d1a0a){var _0x385484=typeof _0x386e3d[_0xed54('0x1b')]===_0xed54('0x1c')&&typeof _0x386e3d[_0xed54('0x1d')]==='undefined';var _0x136514=_0x4d1a0a['count'];var _0x44d55c=_0x385484?0x0:_0x386e3d[_0xed54('0x1b')];var _0x17d19e=_0x385484?_0x4d1a0a[_0xed54('0x1e')]:_0x386e3d['offset']+_0x386e3d[_0xed54('0x1d')];var _0x165adb;if(_0x17d19e>=_0x136514){_0x17d19e=_0x136514;_0x165adb=0xc8;}else{_0x165adb=0xce;}_0x13fd5a[_0xed54('0x19')](_0x165adb);return _0x13fd5a[_0xed54('0x1f')](_0xed54('0x20'),_0x44d55c+'-'+_0x17d19e+'/'+_0x136514)[_0xed54('0x1a')](_0x4d1a0a);}return null;};}function patchUpdates(_0xae972e){return function(_0x4b0bac){try{jsonpatch[_0xed54('0x21')](_0x4b0bac,_0xae972e,!![]);}catch(_0x59832b){return BPromise[_0xed54('0x22')](_0x59832b);}return _0x4b0bac[_0xed54('0x23')]();};}function saveUpdates(_0x2d389a,_0x22c450){return function(_0x2516f6){if(_0x2516f6){return _0x2516f6[_0xed54('0x24')](_0x2d389a)[_0xed54('0x25')](function(_0xca2dc4){return _0xca2dc4;});}return null;};}function removeEntity(_0x2ae161,_0x34d45e){return function(_0x2b7f5a){if(_0x2b7f5a){return _0x2b7f5a[_0xed54('0x26')]()['then'](function(){_0x2ae161[_0xed54('0x19')](0xcc)[_0xed54('0x18')]();});}};}function handleEntityNotFound(_0x145341,_0x58cd0a){return function(_0x176e25){if(!_0x176e25){_0x145341[_0xed54('0x17')](0x194);}return _0x176e25;};}function handleError(_0x241b4d,_0x5b545f){_0x5b545f=_0x5b545f||0x1f4;return function(_0x26fedc){logger['error'](_0x26fedc[_0xed54('0x27')]);if(_0x26fedc[_0xed54('0x28')]){delete _0x26fedc[_0xed54('0x28')];}_0x241b4d[_0xed54('0x19')](_0x5b545f)['send'](_0x26fedc);};}var utilLicense=require(_0xed54('0x15'));exports[_0xed54('0x29')]=function(_0x21a723,_0x31b3e9){var _0x1fc9e0={'raw':!![],'where':{'id':0x1}},_0x14ddb7={};_0x14ddb7['model']=_[_0xed54('0x2a')](db['License'][_0xed54('0x2b')]);_0x14ddb7[_0xed54('0x2c')]=_[_0xed54('0x2a')](_0x21a723[_0xed54('0x2c')]);_0x14ddb7[_0xed54('0x2d')]=_[_0xed54('0x2e')](_0x14ddb7[_0xed54('0x2f')],_0x14ddb7[_0xed54('0x2c')]);_0x1fc9e0[_0xed54('0x30')]=_[_0xed54('0x2e')](_0x14ddb7[_0xed54('0x2f')],qs[_0xed54('0x31')](_0x21a723[_0xed54('0x2c')][_0xed54('0x31')]));_0x1fc9e0[_0xed54('0x30')]=_0x1fc9e0[_0xed54('0x30')][_0xed54('0x32')]?_0x1fc9e0[_0xed54('0x30')]:_0x14ddb7[_0xed54('0x2f')];_0x1fc9e0=_['merge']({},_0x1fc9e0,_0x21a723[_0xed54('0x33')]);return utilLicense[_0xed54('0x34')](_0x1fc9e0)['then'](respondWithResult(_0x31b3e9,null))['catch'](handleError(_0x31b3e9,null));};exports[_0xed54('0x24')]=function(_0x6ab092,_0x3277b1){if(_0x6ab092[_0xed54('0x35')]['id']){delete _0x6ab092[_0xed54('0x35')]['id'];}return db['License'][_0xed54('0x36')]({'where':{'id':_0x6ab092['params']['id']}})[_0xed54('0x25')](handleEntityNotFound(_0x3277b1,null))[_0xed54('0x25')](function(_0xe38deb){var _0x214b1f=_0xe38deb[_0xed54('0x37')]({'plain':!![]});return utilLicense['checkLicense'](_0x214b1f,_0x6ab092[_0xed54('0x35')]['key']);})[_0xed54('0x25')](function(_0x417417){if(!_0x417417['demo']){return saveUpdates(_0x6ab092['body'],null);}return _0x417417;})[_0xed54('0x25')](respondWithResult(_0x3277b1,null))[_0xed54('0x38')](handleError(_0x3277b1,null));};exports[_0xed54('0x39')]=function(_0x18c7dd,_0x55c05e){var _0x3a15ac=_0xed54('0x3a');var _0x59d2aa=path[_0xed54('0x3b')]('/var',_0xed54('0x3c'),'xcally',_0x3a15ac);_0x55c05e[_0xed54('0x3d')]('Content-disposition',_0xed54('0x3e')+_0x3a15ac);_0x55c05e['set'](_0xed54('0x3f'),_0xed54('0x40'));_0x55c05e[_0xed54('0x41')](_0x59d2aa);}; \ No newline at end of file +var _0xcfc7=['merge','getLicense','catch','body','find','checkLicense','key','demo','join','/var','log','Content-disposition','attachment;\x20filename=','text/plain','download','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','model','License','rawAttributes','keys','filters','intersection','query','fields','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcfc7,0x107));var _0x7cfc=function(_0x1bdc52,_0x4876a9){_0x1bdc52=_0x1bdc52-0x0;var _0xdf3fa3=_0xcfc7[_0x1bdc52];return _0xdf3fa3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x7cfc('0x0'));var jsonpatch=require(_0x7cfc('0x1'));var rp=require(_0x7cfc('0x2'));var moment=require(_0x7cfc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x7cfc('0x4'));var util=require(_0x7cfc('0x5'));var path=require(_0x7cfc('0x6'));var sox=require('sox');var csv=require(_0x7cfc('0x7'));var ejs=require(_0x7cfc('0x8'));var fs=require('fs');var fs_extra=require(_0x7cfc('0x9'));var _=require(_0x7cfc('0xa'));var squel=require('squel');var crypto=require(_0x7cfc('0xb'));var jsforce=require(_0x7cfc('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7cfc('0xd'));var qs=require(_0x7cfc('0xe'));var as=require(_0x7cfc('0xf'));var hardwareService=require(_0x7cfc('0x10'));var logger=require('../../config/logger')(_0x7cfc('0x11'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7cfc('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x22406f,_0x2e951f){_0x2e951f=_0x2e951f||0xcc;return function(_0x373ba3){if(_0x373ba3){return _0x22406f[_0x7cfc('0x13')](_0x2e951f);}return _0x22406f[_0x7cfc('0x14')](_0x2e951f)[_0x7cfc('0x15')]();};}function respondWithResult(_0x13ead7,_0x30fdc3){_0x30fdc3=_0x30fdc3||0xc8;return function(_0x4a4009){if(_0x4a4009){return _0x13ead7[_0x7cfc('0x14')](_0x30fdc3)[_0x7cfc('0x16')](_0x4a4009);}};}function respondWithFilteredResult(_0x2653db,_0x100f9b){return function(_0x2537db){if(_0x2537db){var _0x3cb2ad=typeof _0x100f9b[_0x7cfc('0x17')]===_0x7cfc('0x18')&&typeof _0x100f9b['limit']===_0x7cfc('0x18');var _0x1f6a76=_0x2537db['count'];var _0x231331=_0x3cb2ad?0x0:_0x100f9b[_0x7cfc('0x17')];var _0x4c2bae=_0x3cb2ad?_0x2537db[_0x7cfc('0x19')]:_0x100f9b[_0x7cfc('0x17')]+_0x100f9b[_0x7cfc('0x1a')];var _0x19344c;if(_0x4c2bae>=_0x1f6a76){_0x4c2bae=_0x1f6a76;_0x19344c=0xc8;}else{_0x19344c=0xce;}_0x2653db['status'](_0x19344c);return _0x2653db[_0x7cfc('0x1b')](_0x7cfc('0x1c'),_0x231331+'-'+_0x4c2bae+'/'+_0x1f6a76)[_0x7cfc('0x16')](_0x2537db);}return null;};}function patchUpdates(_0x50cece){return function(_0x2489fd){try{jsonpatch[_0x7cfc('0x1d')](_0x2489fd,_0x50cece,!![]);}catch(_0x3797b8){return BPromise[_0x7cfc('0x1e')](_0x3797b8);}return _0x2489fd[_0x7cfc('0x1f')]();};}function saveUpdates(_0x227267,_0x4c8a43){return function(_0x3fa68f){if(_0x3fa68f){return _0x3fa68f['update'](_0x227267)['then'](function(_0x26f281){return _0x26f281;});}return null;};}function removeEntity(_0x1b24e9,_0x26be44){return function(_0x4c0f95){if(_0x4c0f95){return _0x4c0f95[_0x7cfc('0x20')]()[_0x7cfc('0x21')](function(){_0x1b24e9[_0x7cfc('0x14')](0xcc)[_0x7cfc('0x15')]();});}};}function handleEntityNotFound(_0x56925f,_0x3b5acc){return function(_0x24188e){if(!_0x24188e){_0x56925f[_0x7cfc('0x13')](0x194);}return _0x24188e;};}function handleError(_0x527797,_0xf1ba50){_0xf1ba50=_0xf1ba50||0x1f4;return function(_0x587a80){logger[_0x7cfc('0x22')](_0x587a80[_0x7cfc('0x23')]);if(_0x587a80[_0x7cfc('0x24')]){delete _0x587a80[_0x7cfc('0x24')];}_0x527797[_0x7cfc('0x14')](_0xf1ba50)[_0x7cfc('0x25')](_0x587a80);};}var utilLicense=require(_0x7cfc('0x12'));exports['index']=function(_0x506823,_0x4c836e){var _0x2a611b={'raw':!![],'where':{'id':0x1}},_0x54fb43={};_0x54fb43[_0x7cfc('0x26')]=_['keys'](db[_0x7cfc('0x27')][_0x7cfc('0x28')]);_0x54fb43['query']=_[_0x7cfc('0x29')](_0x506823['query']);_0x54fb43[_0x7cfc('0x2a')]=_[_0x7cfc('0x2b')](_0x54fb43[_0x7cfc('0x26')],_0x54fb43[_0x7cfc('0x2c')]);_0x2a611b['attributes']=_['intersection'](_0x54fb43['model'],qs['fields'](_0x506823['query'][_0x7cfc('0x2d')]));_0x2a611b['attributes']=_0x2a611b[_0x7cfc('0x2e')]['length']?_0x2a611b['attributes']:_0x54fb43[_0x7cfc('0x26')];_0x2a611b=_[_0x7cfc('0x2f')]({},_0x2a611b,_0x506823['options']);return utilLicense[_0x7cfc('0x30')](_0x2a611b)[_0x7cfc('0x21')](respondWithResult(_0x4c836e,null))[_0x7cfc('0x31')](handleError(_0x4c836e,null));};exports['update']=function(_0x17392d,_0x5a6a25){if(_0x17392d['body']['id']){delete _0x17392d[_0x7cfc('0x32')]['id'];}return db['License'][_0x7cfc('0x33')]({'where':{'id':_0x17392d['params']['id']}})[_0x7cfc('0x21')](handleEntityNotFound(_0x5a6a25,null))['then'](function(_0x23c964){var _0x68f4e8=_0x23c964['get']({'plain':!![]});return utilLicense[_0x7cfc('0x34')](_0x68f4e8,_0x17392d['body'][_0x7cfc('0x35')]);})[_0x7cfc('0x21')](function(_0x382576){if(!_0x382576[_0x7cfc('0x36')]){return saveUpdates(_0x17392d[_0x7cfc('0x32')],null);}return _0x382576;})[_0x7cfc('0x21')](respondWithResult(_0x5a6a25,null))['catch'](handleError(_0x5a6a25,null));};exports['downloadLogFile']=function(_0x5dcdc2,_0x3a9c3b){var _0x5cf7d2='license-info.log';var _0x839feb=path[_0x7cfc('0x37')](_0x7cfc('0x38'),_0x7cfc('0x39'),'xcally',_0x5cf7d2);_0x3a9c3b['setHeader'](_0x7cfc('0x3a'),_0x7cfc('0x3b')+_0x5cf7d2);_0x3a9c3b[_0x7cfc('0x1b')]('Content-Type',_0x7cfc('0x3c'));_0x3a9c3b[_0x7cfc('0x3d')](_0x839feb);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index cb453a9..a83bc16 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 _0xc7b3=['api','moment','bluebird','request-promise','path','rimraf','./license.attributes','exports','define','License','lodash','util'];(function(_0x56df75,_0x3b68f2){var _0x19feee=function(_0x4f950c){while(--_0x4f950c){_0x56df75['push'](_0x56df75['shift']());}};_0x19feee(++_0x3b68f2);}(_0xc7b3,0x1c6));var _0x3c7b=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xc7b3[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x3c7b('0x0'));var util=require(_0x3c7b('0x1'));var logger=require('../../config/logger')(_0x3c7b('0x2'));var moment=require(_0x3c7b('0x3'));var BPromise=require(_0x3c7b('0x4'));var rp=require(_0x3c7b('0x5'));var fs=require('fs');var path=require(_0x3c7b('0x6'));var rimraf=require(_0x3c7b('0x7'));var config=require('../../config/environment');var attributes=require(_0x3c7b('0x8'));module[_0x3c7b('0x9')]=function(_0x1fa371,_0x55975f){return _0x1fa371[_0x3c7b('0xa')](_0x3c7b('0xb'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x15da=['../../config/logger','api','moment','bluebird','request-promise','path','define','License','license','util'];(function(_0x533676,_0x2be01c){var _0x32f7bd=function(_0x5b28fd){while(--_0x5b28fd){_0x533676['push'](_0x533676['shift']());}};_0x32f7bd(++_0x2be01c);}(_0x15da,0xf9));var _0xa15d=function(_0x5d5b69,_0x1111ab){_0x5d5b69=_0x5d5b69-0x0;var _0xf82413=_0x15da[_0x5d5b69];return _0xf82413;};'use strict';var _=require('lodash');var util=require(_0xa15d('0x0'));var logger=require(_0xa15d('0x1'))(_0xa15d('0x2'));var moment=require(_0xa15d('0x3'));var BPromise=require(_0xa15d('0x4'));var rp=require(_0xa15d('0x5'));var fs=require('fs');var path=require(_0xa15d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./license.attributes');module['exports']=function(_0x5b0882,_0x2eb69a){return _0x5b0882[_0xa15d('0x7')](_0xa15d('0x8'),attributes,{'tableName':_0xa15d('0x9'),'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 5c87767..ca3b3b8 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 _0xd536=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','License,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x242225,_0x23e175){var _0x272125=function(_0x494143){while(--_0x494143){_0x242225['push'](_0x242225['shift']());}};_0x272125(++_0x23e175);}(_0xd536,0x105));var _0x6d53=function(_0x26de3f,_0x503295){_0x26de3f=_0x26de3f-0x0;var _0x22fed9=_0xd536[_0x26de3f];return _0x22fed9;};'use strict';var _=require(_0x6d53('0x0'));var util=require(_0x6d53('0x1'));var moment=require(_0x6d53('0x2'));var BPromise=require('bluebird');var rs=require(_0x6d53('0x3'));var fs=require('fs');var Redis=require(_0x6d53('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6d53('0x5'));var logger=require(_0x6d53('0x6'))(_0x6d53('0x7'));var config=require(_0x6d53('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6d53('0x9')][_0x6d53('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x269d24,_0x42c6c1,_0x2dccc9){return new BPromise(function(_0x2d56d1,_0x53f626){return client['request'](_0x269d24,_0x2dccc9)['then'](function(_0x376018){logger[_0x6d53('0xb')]('License,\x20%s,\x20%s',_0x42c6c1,'request\x20sent');logger[_0x6d53('0xc')](_0x6d53('0xd'),_0x42c6c1,_0x6d53('0xe'),JSON[_0x6d53('0xf')](_0x376018));if(_0x376018[_0x6d53('0x10')]){if(_0x376018['error'][_0x6d53('0x11')]===0x1f4){logger['error'](_0x6d53('0x12'),_0x42c6c1,_0x376018[_0x6d53('0x10')][_0x6d53('0x13')]);return _0x53f626(_0x376018[_0x6d53('0x10')][_0x6d53('0x13')]);}logger[_0x6d53('0x10')](_0x6d53('0x12'),_0x42c6c1,_0x376018[_0x6d53('0x10')][_0x6d53('0x13')]);return _0x2d56d1(_0x376018[_0x6d53('0x10')][_0x6d53('0x13')]);}else{logger['info'](_0x6d53('0x12'),_0x42c6c1,_0x6d53('0xe'));_0x2d56d1(_0x376018[_0x6d53('0x14')]['message']);}})[_0x6d53('0x15')](function(_0x572f9e){logger[_0x6d53('0x10')]('License,\x20%s,\x20%s',_0x42c6c1,_0x572f9e);_0x53f626(_0x572f9e);});});} \ No newline at end of file +var _0xdb4a=['result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x3a7189,_0x3a4f03){var _0x11e42e=function(_0x217838){while(--_0x217838){_0x3a7189['push'](_0x3a7189['shift']());}};_0x11e42e(++_0x3a4f03);}(_0xdb4a,0x66));var _0xadb4=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0xdb4a[_0x40220a];return _0x3903cc;};'use strict';var _=require(_0xadb4('0x0'));var util=require('util');var moment=require(_0xadb4('0x1'));var BPromise=require(_0xadb4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xadb4('0x3'))['db'];var utils=require(_0xadb4('0x4'));var logger=require(_0xadb4('0x5'))(_0xadb4('0x6'));var config=require('../../config/environment');var jayson=require(_0xadb4('0x7'));var client=jayson[_0xadb4('0x8')][_0xadb4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x693fba,_0x28fffe,_0x1a2d92){return new BPromise(function(_0x47c7f3,_0x37bd0b){return client[_0xadb4('0xa')](_0x693fba,_0x1a2d92)['then'](function(_0x1e63bd){logger[_0xadb4('0xb')](_0xadb4('0xc'),_0x28fffe,_0xadb4('0xd'));logger['debug']('License,\x20%s,\x20%s,\x20%s',_0x28fffe,'request\x20sent',JSON[_0xadb4('0xe')](_0x1e63bd));if(_0x1e63bd[_0xadb4('0xf')]){if(_0x1e63bd[_0xadb4('0xf')][_0xadb4('0x10')]===0x1f4){logger[_0xadb4('0xf')]('License,\x20%s,\x20%s',_0x28fffe,_0x1e63bd[_0xadb4('0xf')][_0xadb4('0x11')]);return _0x37bd0b(_0x1e63bd[_0xadb4('0xf')][_0xadb4('0x11')]);}logger['error'](_0xadb4('0xc'),_0x28fffe,_0x1e63bd['error']['message']);return _0x47c7f3(_0x1e63bd[_0xadb4('0xf')]['message']);}else{logger[_0xadb4('0xb')](_0xadb4('0xc'),_0x28fffe,_0xadb4('0xd'));_0x47c7f3(_0x1e63bd[_0xadb4('0x12')][_0xadb4('0x11')]);}})[_0xadb4('0x13')](function(_0x2c7622){logger[_0xadb4('0xf')](_0xadb4('0xc'),_0x28fffe,_0x2c7622);_0x37bd0b(_0x2c7622);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 16c32b2..8ce891a 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 _0x6db6=['addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeImap','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/describe','describe','/:id','isAuthenticated','show','getDispositions','/:id/canned_answers','getImap','/:id/out_servers','/:id/interactions','getInteractions','getApplications','getMessages','/:id/verify','/:id/users','getAgents','/:id/dispositions','addDisposition','create','post','/:id/in_servers','addSmtp'];(function(_0x21cb7f,_0x48cd16){var _0x5a079a=function(_0x569a4f){while(--_0x569a4f){_0x21cb7f['push'](_0x21cb7f['shift']());}};_0x5a079a(++_0x48cd16);}(_0x6db6,0xce));var _0x66db=function(_0x3293ff,_0x5892a0){_0x3293ff=_0x3293ff-0x0;var _0x5173ce=_0x6db6[_0x3293ff];return _0x5173ce;};'use strict';var multer=require(_0x66db('0x0'));var util=require(_0x66db('0x1'));var path=require(_0x66db('0x2'));var timeout=require(_0x66db('0x3'));var express=require(_0x66db('0x4'));var router=express[_0x66db('0x5')]();var fs_extra=require(_0x66db('0x6'));var auth=require(_0x66db('0x7'));var interaction=require(_0x66db('0x8'));var config=require(_0x66db('0x9'));var controller=require('./mailAccount.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x66db('0xa')]);router[_0x66db('0xb')](_0x66db('0xc'),auth['isAuthenticated'](),controller[_0x66db('0xd')]);router[_0x66db('0xb')](_0x66db('0xe'),auth[_0x66db('0xf')](),controller[_0x66db('0x10')]);router[_0x66db('0xb')]('/:id/dispositions',auth[_0x66db('0xf')](),controller[_0x66db('0x11')]);router[_0x66db('0xb')](_0x66db('0x12'),auth['isAuthenticated'](),controller['getAnswers']);router[_0x66db('0xb')]('/:id/in_servers',auth[_0x66db('0xf')](),controller[_0x66db('0x13')]);router['get'](_0x66db('0x14'),auth[_0x66db('0xf')](),controller['getSmtp']);router['get'](_0x66db('0x15'),auth['isAuthenticated'](),controller[_0x66db('0x16')]);router[_0x66db('0xb')]('/:id/applications',auth[_0x66db('0xf')](),controller[_0x66db('0x17')]);router[_0x66db('0xb')]('/:id/messages',auth[_0x66db('0xf')](),controller[_0x66db('0x18')]);router[_0x66db('0xb')](_0x66db('0x19'),auth[_0x66db('0xf')](),controller['verifySmtp']);router['get'](_0x66db('0x1a'),auth[_0x66db('0xf')](),controller[_0x66db('0x1b')]);router['post'](_0x66db('0x1c'),auth[_0x66db('0xf')](),controller[_0x66db('0x1d')]);router['post'](_0x66db('0x12'),auth[_0x66db('0xf')](),controller['addAnswer']);router['post']('/',auth['isAuthenticated'](),controller[_0x66db('0x1e')]);router[_0x66db('0x1f')](_0x66db('0x20'),auth['isAuthenticated'](),controller['addImap']);router[_0x66db('0x1f')](_0x66db('0x14'),auth[_0x66db('0xf')](),controller[_0x66db('0x21')]);router[_0x66db('0x1f')](_0x66db('0x15'),auth[_0x66db('0xf')](),controller[_0x66db('0x22')]);router['post'](_0x66db('0x23'),auth[_0x66db('0xf')](),controller[_0x66db('0x24')]);router['post'](_0x66db('0x25'),auth[_0x66db('0xf')](),controller[_0x66db('0x26')]);router[_0x66db('0x1f')](_0x66db('0x1a'),auth['isAuthenticated'](),controller[_0x66db('0x27')]);router[_0x66db('0x28')](_0x66db('0xe'),auth[_0x66db('0xf')](),controller[_0x66db('0x29')]);router[_0x66db('0x2a')](_0x66db('0x1c'),auth[_0x66db('0xf')](),controller[_0x66db('0x2b')]);router[_0x66db('0x2a')](_0x66db('0x12'),auth[_0x66db('0xf')](),controller['removeAnswers']);router[_0x66db('0x2a')](_0x66db('0x20'),auth['isAuthenticated'](),controller[_0x66db('0x2c')]);router[_0x66db('0x2a')]('/:id/out_servers',auth[_0x66db('0xf')](),controller[_0x66db('0x2d')]);router[_0x66db('0x2a')](_0x66db('0xe'),auth[_0x66db('0xf')](),controller['destroy']);router['delete'](_0x66db('0x1a'),auth[_0x66db('0xf')](),controller[_0x66db('0x2e')]);module[_0x66db('0x2f')]=router; \ No newline at end of file +var _0x3bce=['/:id/applications','getApplications','/:id/messages','/:id/verify','verifySmtp','/:id/users','getAgents','post','addDisposition','addAnswer','create','addImap','addInteraction','addAgents','put','/:id','update','delete','/:id/dispositions','removeDispositions','/:id/canned_answers','removeSmtp','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','show','getAnswers','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3bce,0x168));var _0xe3bc=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x3bce[_0x46e363];return _0x3fb059;};'use strict';var multer=require('multer');var util=require(_0xe3bc('0x0'));var path=require(_0xe3bc('0x1'));var timeout=require(_0xe3bc('0x2'));var express=require('express');var router=express[_0xe3bc('0x3')]();var fs_extra=require(_0xe3bc('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xe3bc('0x5'));var controller=require(_0xe3bc('0x6'));router[_0xe3bc('0x7')]('/',auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x9')]);router[_0xe3bc('0x7')]('/describe',auth[_0xe3bc('0x8')](),controller['describe']);router['get']('/:id',auth[_0xe3bc('0x8')](),controller[_0xe3bc('0xa')]);router[_0xe3bc('0x7')]('/:id/dispositions',auth[_0xe3bc('0x8')](),controller['getDispositions']);router['get']('/:id/canned_answers',auth[_0xe3bc('0x8')](),controller[_0xe3bc('0xb')]);router['get'](_0xe3bc('0xc'),auth['isAuthenticated'](),controller[_0xe3bc('0xd')]);router[_0xe3bc('0x7')](_0xe3bc('0xe'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0xf')]);router['get'](_0xe3bc('0x10'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x11')]);router[_0xe3bc('0x7')](_0xe3bc('0x12'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x13')]);router['get'](_0xe3bc('0x14'),auth[_0xe3bc('0x8')](),controller['getMessages']);router[_0xe3bc('0x7')](_0xe3bc('0x15'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x16')]);router[_0xe3bc('0x7')](_0xe3bc('0x17'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x18')]);router[_0xe3bc('0x19')]('/:id/dispositions',auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x1a')]);router[_0xe3bc('0x19')]('/:id/canned_answers',auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x1b')]);router[_0xe3bc('0x19')]('/',auth['isAuthenticated'](),controller[_0xe3bc('0x1c')]);router[_0xe3bc('0x19')](_0xe3bc('0xc'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x1d')]);router[_0xe3bc('0x19')]('/:id/out_servers',auth[_0xe3bc('0x8')](),controller['addSmtp']);router[_0xe3bc('0x19')](_0xe3bc('0x10'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x1e')]);router[_0xe3bc('0x19')](_0xe3bc('0x12'),auth[_0xe3bc('0x8')](),controller['addApplications']);router[_0xe3bc('0x19')]('/:id/send',auth[_0xe3bc('0x8')](),controller['send']);router[_0xe3bc('0x19')]('/:id/users',auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x1f')]);router[_0xe3bc('0x20')](_0xe3bc('0x21'),auth['isAuthenticated'](),controller[_0xe3bc('0x22')]);router[_0xe3bc('0x23')](_0xe3bc('0x24'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x25')]);router[_0xe3bc('0x23')](_0xe3bc('0x26'),auth[_0xe3bc('0x8')](),controller['removeAnswers']);router[_0xe3bc('0x23')](_0xe3bc('0xc'),auth[_0xe3bc('0x8')](),controller['removeImap']);router[_0xe3bc('0x23')]('/:id/out_servers',auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x27')]);router[_0xe3bc('0x23')](_0xe3bc('0x21'),auth[_0xe3bc('0x8')](),controller[_0xe3bc('0x28')]);router['delete'](_0xe3bc('0x17'),auth[_0xe3bc('0x8')](),controller['removeAgents']);module[_0xe3bc('0x29')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 763f11b..d4b04ea 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 _0x2007=['mandatoryDisposition','ENUM','gmail','hotmail','yahoo','getDataValue','custom','provider','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','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','mandatoryDispositionPauseId','setDataValue'];(function(_0x269fd4,_0x190536){var _0x346145=function(_0x4e1722){while(--_0x4e1722){_0x269fd4['push'](_0x269fd4['shift']());}};_0x346145(++_0x190536);}(_0x2007,0x9b));var _0x7200=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2007[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0x7200('0x0'));module[_0x7200('0x1')]={'description':{'type':Sequelize[_0x7200('0x2')]},'name':{'type':Sequelize[_0x7200('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x7200('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x7200('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x7200('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x7200('0x4')]},'markAsUnread':{'type':Sequelize[_0x7200('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x7200('0x2')],'allowNull':![],'defaultValue':_0x7200('0x5')},'fontSize':{'type':Sequelize[_0x7200('0x6')](0x2)[_0x7200('0x7')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x7200('0x8');}},'notificationSound':{'type':Sequelize[_0x7200('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7200('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7200('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7200('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7200('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7200('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x7200('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x7200('0x3')],'defaultValue':![],'comment':_0x7200('0xa'),'set':function(_0x543b1d){if(!_0x543b1d)this['setDataValue'](_0x7200('0xb'),null);this[_0x7200('0xc')](_0x7200('0xd'),_0x543b1d);}},'provider':{'type':Sequelize[_0x7200('0xe')](_0x7200('0xf'),_0x7200('0x10'),_0x7200('0x11'),'outlook365'),'defaultValue':null,'get':function(){var _0x5645c7=this[_0x7200('0x12')]('provider');return _0x5645c7||_0x7200('0x13');},'set':function(_0x2ba17c){if(_0x2ba17c===_0x7200('0x13')){_0x2ba17c=null;}return this[_0x7200('0xc')](_0x7200('0x14'),_0x2ba17c);}}}; \ No newline at end of file +var _0xf7fc=['mandatoryDispositionPauseId','setDataValue','gmail','hotmail','yahoo','outlook365','provider','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif','UNSIGNED','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','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xf7fc,0x1a5));var _0xcf7f=function(_0x359959,_0x108408){_0x359959=_0x359959-0x0;var _0x28ef2d=_0xf7fc[_0x359959];return _0x28ef2d;};'use strict';var Sequelize=require(_0xcf7f('0x0'));module[_0xcf7f('0x1')]={'description':{'type':Sequelize[_0xcf7f('0x2')]},'name':{'type':Sequelize[_0xcf7f('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xcf7f('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xcf7f('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0xcf7f('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0xcf7f('0x4')]},'markAsUnread':{'type':Sequelize[_0xcf7f('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xcf7f('0x2')],'allowNull':![],'defaultValue':_0xcf7f('0x5')},'fontSize':{'type':Sequelize['INTEGER'](0x2)[_0xcf7f('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xcf7f('0x4')],'defaultValue':function(){return _0xcf7f('0x7');}},'notificationSound':{'type':Sequelize[_0xcf7f('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcf7f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcf7f('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcf7f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcf7f('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcf7f('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcf7f('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xcf7f('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xcf7f('0x3')],'defaultValue':![],'comment':_0xcf7f('0xa'),'set':function(_0x423af1){if(!_0x423af1)this['setDataValue'](_0xcf7f('0xb'),null);this[_0xcf7f('0xc')]('mandatoryDisposition',_0x423af1);}},'provider':{'type':Sequelize['ENUM'](_0xcf7f('0xd'),_0xcf7f('0xe'),_0xcf7f('0xf'),_0xcf7f('0x10')),'defaultValue':null,'get':function(){var _0xb956e1=this['getDataValue'](_0xcf7f('0x11'));return _0xb956e1||'custom';},'set':function(_0x376e73){if(_0x376e73==='custom'){_0x376e73=null;}return this[_0xcf7f('0xc')](_0xcf7f('0x11'),_0x376e73);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 708c7a1..21bfcfe 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 _0xdee4=['intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','show','Pause','options','find','update','body','provider','params','Mail\x20Account\x20not\x20found','service','describe','addDisposition','Disposition','create','getDispositions','findOne','rawAttributes','hasOwnProperty','MailAccountId','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','transaction','ISOLATION_LEVELS','MailApplication','findAndCountAll','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>','attachments','join','root','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','messageId','subject','out','Interaction','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','spread','emit','userMailAccount:save','isArray','userMailAccount:remove','getAgents','bluebird','util','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','code','MailAccount,\x20%s,\x20%s','message','catch','status','end','json','offset','undefined','limit','count','destroy','get','MailAccounts','sendStatus','stack','name','send','hotmail','imap-mail.outlook.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','authentication','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','MailAccount','fieldName','type','key','model','map','query','keys','filters'];(function(_0x2cef86,_0xbae0a6){var _0x46dfd6=function(_0x52e464){while(--_0x52e464){_0x2cef86['push'](_0x2cef86['shift']());}};_0x46dfd6(++_0xbae0a6);}(_0xdee4,0x137));var _0x4dee=function(_0x5391ef,_0x3c8788){_0x5391ef=_0x5391ef-0x0;var _0x136499=_0xdee4[_0x5391ef];return _0x136499;};'use strict';var moment=require('moment');var BPromise=require(_0x4dee('0x0'));var util=require(_0x4dee('0x1'));var path=require('path');var _=require('lodash');var juice=require(_0x4dee('0x2'));var Redis=require('ioredis');var qs=require(_0x4dee('0x3'));var logger=require(_0x4dee('0x4'))(_0x4dee('0x5'));var config=require(_0x4dee('0x6'));var db=require(_0x4dee('0x7'))['db'];config[_0x4dee('0x8')]=_[_0x4dee('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4dee('0xa'))(new Redis(config['redis']));require(_0x4dee('0xb'))[_0x4dee('0xc')](socket);var jayson=require(_0x4dee('0xd'));var client=jayson['client'][_0x4dee('0xe')]({'port':0x232b});function respondWithRpcPromise(_0x13c47d,_0x3a84ec,_0x666103,_0x2e56e2){return new BPromise(function(_0x283043,_0x31e781){var _0x3357f0=_0x2e56e2||client;return _0x3357f0[_0x4dee('0xf')](_0x13c47d,_0x666103)[_0x4dee('0x10')](function(_0x492a04){logger[_0x4dee('0x11')]('MailAccount,\x20%s,\x20%s',_0x3a84ec,_0x4dee('0x12'));logger[_0x4dee('0x13')](_0x4dee('0x14'),_0x3a84ec,'request\x20sent',JSON['stringify'](_0x492a04));if(_0x492a04['error']){if(_0x492a04[_0x4dee('0x15')][_0x4dee('0x16')]===0x1f4){logger[_0x4dee('0x15')](_0x4dee('0x17'),_0x3a84ec,_0x492a04[_0x4dee('0x15')][_0x4dee('0x18')]);return _0x31e781(_0x492a04[_0x4dee('0x15')]['message']);}logger['error'](_0x4dee('0x17'),_0x3a84ec,_0x492a04[_0x4dee('0x15')][_0x4dee('0x18')]);return _0x283043(_0x492a04[_0x4dee('0x15')][_0x4dee('0x18')]);}else{logger[_0x4dee('0x11')]('MailAccount,\x20%s,\x20%s',_0x3a84ec,_0x4dee('0x12'));_0x283043(_0x492a04['result'][_0x4dee('0x18')]);}})[_0x4dee('0x19')](function(_0x363f23){logger[_0x4dee('0x15')](_0x4dee('0x17'),_0x3a84ec,_0x363f23);_0x31e781(_0x363f23);});});}function respondWithStatusCode(_0x95c345,_0xe86e40){_0xe86e40=_0xe86e40||0xcc;return function(_0x379320){if(_0x379320){return _0x95c345['sendStatus'](_0xe86e40);}return _0x95c345[_0x4dee('0x1a')](_0xe86e40)[_0x4dee('0x1b')]();};}function respondWithResult(_0x4de30b,_0x26515c){_0x26515c=_0x26515c||0xc8;return function(_0x311198){if(_0x311198){return _0x4de30b[_0x4dee('0x1a')](_0x26515c)[_0x4dee('0x1c')](_0x311198);}};}function respondWithFilteredResult(_0x35dda8,_0x17ef4b){return function(_0x1f7385){if(_0x1f7385){var _0x19c8c0=typeof _0x17ef4b[_0x4dee('0x1d')]===_0x4dee('0x1e')&&typeof _0x17ef4b[_0x4dee('0x1f')]===_0x4dee('0x1e');var _0x3f5477=_0x1f7385['count'];var _0x5582b9=_0x19c8c0?0x0:_0x17ef4b['offset'];var _0x10f6ca=_0x19c8c0?_0x1f7385[_0x4dee('0x20')]:_0x17ef4b['offset']+_0x17ef4b[_0x4dee('0x1f')];var _0xa4452f;if(_0x10f6ca>=_0x3f5477){_0x10f6ca=_0x3f5477;_0xa4452f=0xc8;}else{_0xa4452f=0xce;}_0x35dda8[_0x4dee('0x1a')](_0xa4452f);return _0x35dda8['set']('Content-Range',_0x5582b9+'-'+_0x10f6ca+'/'+_0x3f5477)['json'](_0x1f7385);}return null;};}function saveUpdates(_0x4dbf2d){return function(_0x41db3c){if(_0x41db3c){return _0x41db3c['update'](_0x4dbf2d)[_0x4dee('0x10')](function(_0x4634a0){return _0x4634a0;});}return null;};}function removeEntity(_0x3e1dac){return function(_0x2125f7){if(_0x2125f7){return _0x2125f7[_0x4dee('0x21')]()[_0x4dee('0x10')](function(){var _0x266173=_0x2125f7[_0x4dee('0x22')]({'plain':!![]});var _0x27ac12=_0x4dee('0x23');return db['UserProfileResource']['destroy']({'where':{'type':_0x27ac12,'resourceId':_0x266173['id']}})['then'](function(){return _0x2125f7;});})[_0x4dee('0x10')](function(){_0x3e1dac['status'](0xcc)[_0x4dee('0x1b')]();});}};}function handleEntityNotFound(_0x20ba07){return function(_0xc660ed){if(!_0xc660ed){_0x20ba07[_0x4dee('0x24')](0x194);}return _0xc660ed;};}function handleError(_0x5680c0,_0x127602){_0x127602=_0x127602||0x1f4;return function(_0x1af7e1){logger[_0x4dee('0x15')](_0x1af7e1[_0x4dee('0x25')]);if(_0x1af7e1[_0x4dee('0x26')]){delete _0x1af7e1[_0x4dee('0x26')];}_0x5680c0[_0x4dee('0x1a')](_0x127602)[_0x4dee('0x27')](_0x1af7e1);};}function getImapHost(_0x407444){switch(_0x407444){case'gmail':return'imap.gmail.com';case'yahoo':return'imap.mail.yahoo.com';case _0x4dee('0x28'):return _0x4dee('0x29');case'outlook365':return'outlook.office365.com';}throw new Error(_0x4dee('0x2a'),_0x407444);}function getSmtpHost(_0x41ff37){switch(_0x41ff37){case'gmail':return _0x4dee('0x2b');case _0x4dee('0x2c'):return _0x4dee('0x2d');case _0x4dee('0x28'):return _0x4dee('0x2e');case'outlook365':return'smtp.office365.com';}throw new Error(_0x4dee('0x2a'),_0x41ff37);}function getAuthenticationOptions(_0x1dba04,_0x3ef50d){var _0x289b3c={};var _0x3b6d71={};if(_0x1dba04){_0x289b3c[_0x4dee('0x2f')]=_0x3b6d71[_0x4dee('0x2f')]=_0x3ef50d[_0x4dee('0x30')];_0x289b3c[_0x4dee('0x31')]=_0x3b6d71[_0x4dee('0x32')]=_0x3ef50d[_0x4dee('0x31')];if(_0x3ef50d[_0x4dee('0x33')]){_0x289b3c[_0x4dee('0x33')]=_0x3b6d71[_0x4dee('0x33')]=!![];_0x289b3c[_0x4dee('0x34')]=_0x3b6d71[_0x4dee('0x34')]=_0x3ef50d[_0x4dee('0x34')];_0x289b3c[_0x4dee('0x31')]=_0x3b6d71[_0x4dee('0x32')]=null;}else{_0x289b3c[_0x4dee('0x34')]=_0x3b6d71['CloudProviderId']=null;}_0x289b3c[_0x4dee('0x35')]=getImapHost(_0x1dba04);_0x289b3c[_0x4dee('0x36')]=0x3e1;_0x3b6d71[_0x4dee('0x35')]=getSmtpHost(_0x1dba04);_0x3b6d71[_0x4dee('0x36')]=0x24b;_0x3b6d71['secure']=![];_0x289b3c['service']=_0x3b6d71['service']=null;}else{if(_0x3ef50d[_0x4dee('0x37')]){_0x289b3c[_0x4dee('0x2f')]=_0x3b6d71['user']=_0x3ef50d[_0x4dee('0x30')];_0x289b3c[_0x4dee('0x31')]=_0x3b6d71[_0x4dee('0x32')]=_0x3ef50d[_0x4dee('0x31')];}else{_0x289b3c['authentication']=_0x3b6d71[_0x4dee('0x37')]=![];_0x289b3c[_0x4dee('0x2f')]=_0x3b6d71[_0x4dee('0x2f')]=null;_0x289b3c['password']=_0x3b6d71['pass']=null;}_0x289b3c['host']=_0x3ef50d[_0x4dee('0x38')][_0x4dee('0x35')];_0x289b3c[_0x4dee('0x36')]=_0x3ef50d['Imap'][_0x4dee('0x36')];_0x3b6d71[_0x4dee('0x35')]=_0x3ef50d[_0x4dee('0x39')][_0x4dee('0x35')];_0x3b6d71[_0x4dee('0x36')]=_0x3ef50d[_0x4dee('0x39')]['port'];}return{'Imap':_0x289b3c,'Smtp':_0x3b6d71};}exports[_0x4dee('0x3a')]=function(_0x5afc6c,_0x45bc02){var _0x47af25={'include':[{'model':db[_0x4dee('0x3b')],'as':_0x4dee('0x38')},{'model':db[_0x4dee('0x3c')],'as':_0x4dee('0x39')},{'model':db['Pause'],'as':_0x4dee('0x3d')}]},_0x165fa5={},_0x38f086={'count':0x0,'rows':[]};var _0x2f1518=_['map'](db[_0x4dee('0x3e')]['rawAttributes'],function(_0x11b5ac){return{'name':_0x11b5ac[_0x4dee('0x3f')],'type':_0x11b5ac[_0x4dee('0x40')][_0x4dee('0x41')]};});_0x165fa5[_0x4dee('0x42')]=_[_0x4dee('0x43')](_0x2f1518,_0x4dee('0x26'));_0x165fa5[_0x4dee('0x44')]=_[_0x4dee('0x45')](_0x5afc6c[_0x4dee('0x44')]);_0x165fa5[_0x4dee('0x46')]=_[_0x4dee('0x47')](_0x165fa5[_0x4dee('0x42')],_0x165fa5['query']);_0x47af25[_0x4dee('0x48')]=_[_0x4dee('0x47')](_0x165fa5['model'],qs[_0x4dee('0x49')](_0x5afc6c[_0x4dee('0x44')]['fields']));_0x47af25[_0x4dee('0x48')]=_0x47af25[_0x4dee('0x48')][_0x4dee('0x4a')]?_0x47af25[_0x4dee('0x48')]:_0x165fa5[_0x4dee('0x42')];if(!_0x5afc6c['query']['hasOwnProperty'](_0x4dee('0x4b'))){_0x47af25[_0x4dee('0x1f')]=qs['limit'](_0x5afc6c[_0x4dee('0x44')]['limit']);_0x47af25['offset']=qs[_0x4dee('0x1d')](_0x5afc6c['query']['offset']);}_0x47af25[_0x4dee('0x4c')]=qs['sort'](_0x5afc6c[_0x4dee('0x44')][_0x4dee('0x4d')]);_0x47af25[_0x4dee('0x4e')]=qs[_0x4dee('0x46')](_[_0x4dee('0x4f')](_0x5afc6c[_0x4dee('0x44')],_0x165fa5[_0x4dee('0x46')]),_0x2f1518);if(_0x5afc6c['query']['filter']){_0x47af25[_0x4dee('0x4e')]=_[_0x4dee('0x50')](_0x47af25[_0x4dee('0x4e')],{'$or':_[_0x4dee('0x43')](_0x2f1518,function(_0x30c511){if(_0x30c511[_0x4dee('0x40')]!==_0x4dee('0x51')){var _0x1fa9ef={};_0x1fa9ef[_0x30c511['name']]={'$like':'%'+_0x5afc6c['query'][_0x4dee('0x52')]+'%'};return _0x1fa9ef;}})});}_0x47af25=_['merge']({},_0x47af25,_0x5afc6c['options']);var _0x353360={'where':_0x47af25['where']};return db[_0x4dee('0x3e')][_0x4dee('0x20')](_0x353360)[_0x4dee('0x10')](function(_0xc9630f){_0x38f086[_0x4dee('0x20')]=_0xc9630f;if(_0x5afc6c[_0x4dee('0x44')][_0x4dee('0x53')]){_0x47af25[_0x4dee('0x54')]=[{'all':!![]}];}return db['MailAccount'][_0x4dee('0x55')](_0x47af25);})[_0x4dee('0x10')](function(_0x5a3525){_0x38f086['rows']=_0x5a3525;return _0x38f086;})[_0x4dee('0x10')](respondWithFilteredResult(_0x45bc02,_0x47af25))[_0x4dee('0x19')](handleError(_0x45bc02,null));};exports[_0x4dee('0x56')]=function(_0x3539cd,_0x4eb3a2){var _0x597cc9={'raw':![],'where':{'id':_0x3539cd['params']['id']},'include':[{'model':db[_0x4dee('0x3b')],'as':_0x4dee('0x38')},{'model':db[_0x4dee('0x3c')],'as':_0x4dee('0x39')},{'model':db[_0x4dee('0x57')],'as':'mandatoryDispositionPause'}]},_0x3057d9={};_0x3057d9[_0x4dee('0x42')]=_['keys'](db['MailAccount']['rawAttributes']);_0x3057d9[_0x4dee('0x44')]=_['keys'](_0x3539cd[_0x4dee('0x44')]);_0x3057d9[_0x4dee('0x46')]=_[_0x4dee('0x47')](_0x3057d9[_0x4dee('0x42')],_0x3057d9[_0x4dee('0x44')]);_0x597cc9['attributes']=_['intersection'](_0x3057d9[_0x4dee('0x42')],qs['fields'](_0x3539cd['query'][_0x4dee('0x49')]));_0x597cc9[_0x4dee('0x48')]=_0x597cc9['attributes'][_0x4dee('0x4a')]?_0x597cc9[_0x4dee('0x48')]:_0x3057d9[_0x4dee('0x42')];if(_0x3539cd[_0x4dee('0x44')][_0x4dee('0x53')]){_0x597cc9['include']=[{'all':!![]}];}_0x597cc9=_['merge']({},_0x597cc9,_0x3539cd[_0x4dee('0x58')]);return db['MailAccount'][_0x4dee('0x59')](_0x597cc9)[_0x4dee('0x10')](handleEntityNotFound(_0x4eb3a2,null))[_0x4dee('0x10')](respondWithResult(_0x4eb3a2,null))[_0x4dee('0x19')](handleError(_0x4eb3a2,null));};exports[_0x4dee('0x5a')]=function(_0x3fdbb3,_0x1867df){if(_0x3fdbb3[_0x4dee('0x5b')]['id']){delete _0x3fdbb3[_0x4dee('0x5b')]['id'];}var _0x266c1e=_0x3fdbb3['body'][_0x4dee('0x5c')]==='custom'?null:_0x3fdbb3[_0x4dee('0x5b')][_0x4dee('0x5c')];var _0x1ee901=_0x3fdbb3[_0x4dee('0x5b')]['Imap']||{};var _0xac566c=_0x3fdbb3['body']['Smtp']||{};if(_0x266c1e){_0x1ee901['host']=getImapHost(_0x266c1e);_0x1ee901['port']=0x3e1;_0xac566c[_0x4dee('0x35')]=getSmtpHost(_0x266c1e);_0xac566c[_0x4dee('0x36')]=0x24b;_0xac566c['secure']=![];}if(_0xac566c[_0x4dee('0x33')]){_0xac566c['secure']=![];}else{_0xac566c[_0x4dee('0x34')]=null;}if(!_0x1ee901['modernAuthentication'])_0x1ee901[_0x4dee('0x34')]=null;_0x3fdbb3['body']['Imap']=_0x1ee901;_0x3fdbb3[_0x4dee('0x5b')][_0x4dee('0x39')]=_0xac566c;return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0x3fdbb3[_0x4dee('0x5d')]['id']},'include':[{'model':db[_0x4dee('0x3b')],'as':'Imap'},{'model':db['MailServerOut'],'as':_0x4dee('0x39')},{'model':db[_0x4dee('0x57')],'as':_0x4dee('0x3d')}]})[_0x4dee('0x10')](handleEntityNotFound(_0x1867df,null))[_0x4dee('0x10')](function(_0x526e1e){if(!_0x526e1e)throw new Error(_0x4dee('0x5e'));if(_0x526e1e[_0x4dee('0x5f')])delete _0x3fdbb3[_0x4dee('0x5b')][_0x4dee('0x38')];return _0x526e1e;})[_0x4dee('0x10')](saveUpdates(_0x3fdbb3['body'],null))[_0x4dee('0x10')](function(_0x486ef8){if(!_0x3fdbb3[_0x4dee('0x5b')][_0x4dee('0x38')])return _0x486ef8;return db['MailServerIn'][_0x4dee('0x5a')](_0x3fdbb3[_0x4dee('0x5b')][_0x4dee('0x38')],{'where':{'MailAccountId':_0x486ef8['id']}})[_0x4dee('0x10')](function(){return _0x486ef8;});})[_0x4dee('0x10')](function(_0x344f1f){if(!_0x3fdbb3[_0x4dee('0x5b')]['Smtp'])return _0x344f1f;return db[_0x4dee('0x3c')][_0x4dee('0x5a')](_0x3fdbb3['body']['Smtp'],{'where':{'MailAccountId':_0x344f1f['id']}})[_0x4dee('0x10')](function(){return _0x344f1f;});})[_0x4dee('0x10')](respondWithResult(_0x1867df,null))[_0x4dee('0x19')](handleError(_0x1867df,null));};exports[_0x4dee('0x60')]=function(_0x4a0821,_0x3e31a5){return db[_0x4dee('0x3e')][_0x4dee('0x60')]()['then'](respondWithResult(_0x3e31a5,null))[_0x4dee('0x19')](handleError(_0x3e31a5,null));};exports[_0x4dee('0x61')]=function(_0xd70f92,_0x197f1a){if(_0xd70f92['body']['id']){delete _0xd70f92[_0x4dee('0x5b')]['id'];}return db[_0x4dee('0x3e')]['find']({'where':{'id':_0xd70f92[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x197f1a,null))['then'](function(_0x42fa08){if(_0x42fa08){_0xd70f92[_0x4dee('0x5b')]['MailAccountId']=_0x42fa08['id'];return db[_0x4dee('0x62')][_0x4dee('0x63')](_0xd70f92[_0x4dee('0x5b')]);}})['then'](respondWithResult(_0x197f1a,null))['catch'](handleError(_0x197f1a,null));};exports[_0x4dee('0x64')]=function(_0x2d3e9c,_0x3ad22e){var _0x33613f={'raw':![],'where':{}};var _0x2d1442={};var _0x4e2875={'count':0x0,'rows':[]};return db['MailAccount'][_0x4dee('0x65')]({'where':{'id':_0x2d3e9c['params']['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x3ad22e,null))[_0x4dee('0x10')](function(_0x4d182d){if(_0x4d182d){_0x2d1442[_0x4dee('0x42')]=_[_0x4dee('0x45')](db[_0x4dee('0x62')][_0x4dee('0x66')]);_0x2d1442[_0x4dee('0x44')]=_['keys'](_0x2d3e9c[_0x4dee('0x44')]);_0x2d1442['filters']=_[_0x4dee('0x47')](_0x2d1442[_0x4dee('0x42')],_0x2d1442[_0x4dee('0x44')]);_0x33613f[_0x4dee('0x48')]=_[_0x4dee('0x47')](_0x2d1442[_0x4dee('0x42')],qs[_0x4dee('0x49')](_0x2d3e9c[_0x4dee('0x44')][_0x4dee('0x49')]));_0x33613f[_0x4dee('0x48')]=_0x33613f[_0x4dee('0x48')]['length']?_0x33613f[_0x4dee('0x48')]:_0x2d1442[_0x4dee('0x42')];if(!_0x2d3e9c[_0x4dee('0x44')][_0x4dee('0x67')]('nolimit')){_0x33613f[_0x4dee('0x1f')]=qs[_0x4dee('0x1f')](_0x2d3e9c[_0x4dee('0x44')][_0x4dee('0x1f')]);_0x33613f[_0x4dee('0x1d')]=qs['offset'](_0x2d3e9c['query'][_0x4dee('0x1d')]);}_0x33613f['order']=qs[_0x4dee('0x4d')](_0x2d3e9c['query'][_0x4dee('0x4d')]);_0x33613f[_0x4dee('0x4e')]=qs['filters'](_[_0x4dee('0x4f')](_0x2d3e9c[_0x4dee('0x44')],_0x2d1442['filters']));_0x33613f[_0x4dee('0x4e')][_0x4dee('0x68')]=_0x4d182d['id'];if(_0x2d3e9c['query']['filter']){_0x33613f[_0x4dee('0x4e')]=_[_0x4dee('0x50')](_0x33613f[_0x4dee('0x4e')],{'$or':_['map'](_0x33613f[_0x4dee('0x48')],function(_0x1e1ee3){var _0x1e3b9c={};_0x1e3b9c[_0x1e1ee3]={'$like':'%'+_0x2d3e9c[_0x4dee('0x44')]['filter']+'%'};return _0x1e3b9c;})});}_0x33613f=_[_0x4dee('0x50')]({},_0x33613f,_0x2d3e9c[_0x4dee('0x58')]);return db[_0x4dee('0x62')][_0x4dee('0x20')]({'where':_0x33613f[_0x4dee('0x4e')]})[_0x4dee('0x10')](function(_0x2557ff){_0x4e2875[_0x4dee('0x20')]=_0x2557ff;if(_0x2d3e9c[_0x4dee('0x44')][_0x4dee('0x53')]){_0x33613f[_0x4dee('0x54')]=[{'all':!![]}];}return db[_0x4dee('0x62')]['findAll'](_0x33613f);})[_0x4dee('0x10')](function(_0x1d8d87){_0x4e2875[_0x4dee('0x69')]=_0x1d8d87;return _0x4e2875;});}})['then'](respondWithFilteredResult(_0x3ad22e,_0x33613f))[_0x4dee('0x19')](handleError(_0x3ad22e,null));};exports[_0x4dee('0x6a')]=function(_0x2f11f3,_0x4582f2){return db['MailAccount'][_0x4dee('0x59')]({'where':{'id':_0x2f11f3[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x4582f2,null))[_0x4dee('0x10')](function(_0x197de2){if(_0x197de2){return _0x197de2['removeDispositions'](_0x2f11f3['query'][_0x4dee('0x6b')]);}})['then'](respondWithStatusCode(_0x4582f2,null))['catch'](handleError(_0x4582f2,null));};exports[_0x4dee('0x6c')]=function(_0x429adf,_0x13514c){if(_0x429adf[_0x4dee('0x5b')]['id']){delete _0x429adf[_0x4dee('0x5b')]['id'];}return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0x429adf[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x13514c,null))[_0x4dee('0x10')](function(_0x2ae874){if(_0x2ae874){_0x429adf['body']['MailAccountId']=_0x2ae874['id'];return db[_0x4dee('0x6d')][_0x4dee('0x63')](_0x429adf[_0x4dee('0x5b')]);}})[_0x4dee('0x10')](respondWithResult(_0x13514c,null))[_0x4dee('0x19')](handleError(_0x13514c,null));};exports[_0x4dee('0x6e')]=function(_0x5000ba,_0x14b8d9){var _0x2bdf71={'raw':![],'where':{}};var _0x380a44={};var _0x4aa9d1={'count':0x0,'rows':[]};return db[_0x4dee('0x3e')][_0x4dee('0x65')]({'where':{'id':_0x5000ba['params']['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x14b8d9,null))['then'](function(_0x5e7bf2){if(_0x5e7bf2){_0x380a44['model']=_[_0x4dee('0x45')](db[_0x4dee('0x6d')][_0x4dee('0x66')]);_0x380a44[_0x4dee('0x44')]=_['keys'](_0x5000ba[_0x4dee('0x44')]);_0x380a44[_0x4dee('0x46')]=_[_0x4dee('0x47')](_0x380a44[_0x4dee('0x42')],_0x380a44['query']);_0x2bdf71[_0x4dee('0x48')]=_[_0x4dee('0x47')](_0x380a44['model'],qs['fields'](_0x5000ba[_0x4dee('0x44')][_0x4dee('0x49')]));_0x2bdf71[_0x4dee('0x48')]=_0x2bdf71[_0x4dee('0x48')][_0x4dee('0x4a')]?_0x2bdf71[_0x4dee('0x48')]:_0x380a44['model'];if(!_0x5000ba['query'][_0x4dee('0x67')](_0x4dee('0x4b'))){_0x2bdf71['limit']=qs[_0x4dee('0x1f')](_0x5000ba[_0x4dee('0x44')]['limit']);_0x2bdf71['offset']=qs['offset'](_0x5000ba[_0x4dee('0x44')][_0x4dee('0x1d')]);}_0x2bdf71[_0x4dee('0x4c')]=qs['sort'](_0x5000ba[_0x4dee('0x44')][_0x4dee('0x4d')]);_0x2bdf71[_0x4dee('0x4e')]=qs[_0x4dee('0x46')](_[_0x4dee('0x4f')](_0x5000ba[_0x4dee('0x44')],_0x380a44[_0x4dee('0x46')]));_0x2bdf71[_0x4dee('0x4e')][_0x4dee('0x68')]=_0x5e7bf2['id'];if(_0x5000ba[_0x4dee('0x44')][_0x4dee('0x52')]){_0x2bdf71[_0x4dee('0x4e')]=_[_0x4dee('0x50')](_0x2bdf71[_0x4dee('0x4e')],{'$or':_[_0x4dee('0x43')](_0x2bdf71[_0x4dee('0x48')],function(_0x249be2){var _0x11f6c6={};_0x11f6c6[_0x249be2]={'$like':'%'+_0x5000ba['query'][_0x4dee('0x52')]+'%'};return _0x11f6c6;})});}_0x2bdf71=_[_0x4dee('0x50')]({},_0x2bdf71,_0x5000ba[_0x4dee('0x58')]);return db[_0x4dee('0x6d')][_0x4dee('0x20')]({'where':_0x2bdf71[_0x4dee('0x4e')]})[_0x4dee('0x10')](function(_0x6b0c06){_0x4aa9d1['count']=_0x6b0c06;if(_0x5000ba[_0x4dee('0x44')][_0x4dee('0x53')]){_0x2bdf71['include']=[{'all':!![]}];}return db[_0x4dee('0x6d')]['findAll'](_0x2bdf71);})[_0x4dee('0x10')](function(_0x14fdc3){_0x4aa9d1['rows']=_0x14fdc3;return _0x4aa9d1;});}})[_0x4dee('0x10')](respondWithFilteredResult(_0x14b8d9,_0x2bdf71))[_0x4dee('0x19')](handleError(_0x14b8d9,null));};exports[_0x4dee('0x6f')]=function(_0x14f12d,_0x44a200){return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0x14f12d['params']['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x44a200,null))[_0x4dee('0x10')](function(_0xec3afe){if(_0xec3afe){return _0xec3afe['removeAnswers'](_0x14f12d[_0x4dee('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x44a200,null))[_0x4dee('0x19')](handleError(_0x44a200,null));};exports[_0x4dee('0x63')]=function(_0x2ad292,_0x45c309){var _0x55bcc0={'name':_0x2ad292[_0x4dee('0x5b')]['name'],'key':_0x2ad292[_0x4dee('0x5b')]['key'],'provider':_0x2ad292[_0x4dee('0x5b')][_0x4dee('0x5c')]==='custom'?null:_0x2ad292['body'][_0x4dee('0x5c')],'email':_0x2ad292[_0x4dee('0x5b')][_0x4dee('0x70')],'ListId':_0x2ad292[_0x4dee('0x5b')][_0x4dee('0x71')],'active':!_[_0x4dee('0x72')](_0x2ad292['body']['active'])?_0x2ad292[_0x4dee('0x5b')][_0x4dee('0x73')]:!![],'description':_0x2ad292[_0x4dee('0x5b')]['description']||null};var _0x2bc148=getAuthenticationOptions(_0x55bcc0['provider'],_0x2ad292['body']);_0x55bcc0[_0x4dee('0x38')]=_0x2bc148[_0x4dee('0x38')];_0x55bcc0[_0x4dee('0x39')]=_0x2bc148[_0x4dee('0x39')];return db[_0x4dee('0x3e')][_0x4dee('0x63')](_0x55bcc0,{'include':[{'model':db[_0x4dee('0x3c')],'as':_0x4dee('0x39')},{'model':db[_0x4dee('0x3b')],'as':'Imap'}]})[_0x4dee('0x10')](function(_0x262385){var _0x22b665=_0x2ad292[_0x4dee('0x2f')][_0x4dee('0x22')]({'plain':!![]});if(!_0x22b665)throw new Error(_0x4dee('0x74'));if(_0x22b665[_0x4dee('0x75')]==='user'){var _0x2daf9d=_0x262385[_0x4dee('0x22')]({'plain':!![]});return db[_0x4dee('0x76')]['find']({'where':{'name':_0x4dee('0x23'),'userProfileId':_0x22b665[_0x4dee('0x77')]},'raw':!![]})[_0x4dee('0x10')](function(_0x5b032c){if(_0x5b032c&&_0x5b032c[_0x4dee('0x78')]===0x0){return db[_0x4dee('0x79')][_0x4dee('0x63')]({'name':_0x2daf9d['name'],'resourceId':_0x2daf9d['id'],'type':_0x5b032c[_0x4dee('0x26')],'sectionId':_0x5b032c['id']},{})[_0x4dee('0x10')](function(){return _0x262385;});}else{return _0x262385;}})[_0x4dee('0x19')](function(_0x2a8de1){logger[_0x4dee('0x15')](_0x4dee('0x7a'),_0x2a8de1);throw _0x2a8de1;});}return _0x262385;})['then'](respondWithResult(_0x45c309,0xc9))[_0x4dee('0x19')](handleError(_0x45c309,null));};exports[_0x4dee('0x7b')]=function(_0x590627,_0x43c9f1){return db['MailAccount'][_0x4dee('0x65')]({'where':{'id':_0x590627[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x43c9f1,null))[_0x4dee('0x10')](function(_0x1ddceb){if(_0x1ddceb){return _0x1ddceb['getImap']();}return null;})['then'](respondWithResult(_0x43c9f1,null))['catch'](handleError(_0x43c9f1,null));};exports[_0x4dee('0x7c')]=function(_0xa227cf,_0x3aebfe){if(_0xa227cf[_0x4dee('0x5b')]['id']){delete _0xa227cf['body']['id'];}return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0xa227cf[_0x4dee('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3aebfe,null))['then'](function(_0x40623a){if(_0x40623a){_0xa227cf[_0x4dee('0x5b')][_0x4dee('0x68')]=_0x40623a['id'];return db[_0x4dee('0x3b')][_0x4dee('0x63')](_0xa227cf[_0x4dee('0x5b')]);}})[_0x4dee('0x10')](respondWithResult(_0x3aebfe,null))[_0x4dee('0x19')](handleError(_0x3aebfe,null));};exports[_0x4dee('0x7d')]=function(_0x26fa67,_0x1585ae){return db[_0x4dee('0x3e')][_0x4dee('0x65')]({'where':{'id':_0x26fa67['params']['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x1585ae,null))[_0x4dee('0x10')](function(_0x264347){if(_0x264347){return _0x264347[_0x4dee('0x7e')](null);}return null;})[_0x4dee('0x10')](respondWithStatusCode(_0x1585ae,null))[_0x4dee('0x19')](handleError(_0x1585ae,null));};exports[_0x4dee('0x7f')]=function(_0x476f34,_0x48c318){return db[_0x4dee('0x3e')][_0x4dee('0x65')]({'where':{'id':_0x476f34['params']['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x48c318,null))[_0x4dee('0x10')](function(_0x197bd7){if(_0x197bd7){return _0x197bd7[_0x4dee('0x7f')]();}return null;})[_0x4dee('0x10')](respondWithResult(_0x48c318,null))[_0x4dee('0x19')](handleError(_0x48c318,null));};exports[_0x4dee('0x80')]=function(_0x34b8d2,_0xffab25){if(_0x34b8d2[_0x4dee('0x5b')]['id']){delete _0x34b8d2[_0x4dee('0x5b')]['id'];}return db[_0x4dee('0x3e')]['find']({'where':{'id':_0x34b8d2[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0xffab25,null))[_0x4dee('0x10')](function(_0x31882f){if(_0x31882f){_0x34b8d2[_0x4dee('0x5b')][_0x4dee('0x68')]=_0x31882f['id'];return db[_0x4dee('0x3c')][_0x4dee('0x63')](_0x34b8d2[_0x4dee('0x5b')]);}})['then'](respondWithResult(_0xffab25,null))[_0x4dee('0x19')](handleError(_0xffab25,null));};exports[_0x4dee('0x81')]=function(_0x3568eb,_0x3ca50c){return db['MailAccount'][_0x4dee('0x65')]({'where':{'id':_0x3568eb[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x3ca50c,null))[_0x4dee('0x10')](function(_0x29e2a5){if(_0x29e2a5){return _0x29e2a5['setSmtp'](null);}return null;})[_0x4dee('0x10')](respondWithStatusCode(_0x3ca50c,null))[_0x4dee('0x19')](handleError(_0x3ca50c,null));};exports[_0x4dee('0x82')]=function(_0x58968e,_0x9418a){return db[_0x4dee('0x83')][_0x4dee('0x59')]({'where':{'id':_0x58968e[_0x4dee('0x5d')]['id']}})['then'](handleEntityNotFound(_0x9418a,null))[_0x4dee('0x10')](function(_0x5c6a53){if(_0x5c6a53){return _0x5c6a53['addInteraction'](_0x58968e[_0x4dee('0x5b')][_0x4dee('0x6b')],_[_0x4dee('0x84')](_0x58968e[_0x4dee('0x5b')],[_0x4dee('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x9418a,null))['catch'](handleError(_0x9418a,null));};exports[_0x4dee('0x85')]=function(_0x426fc6,_0x2f2065){var _0x33904d={'raw':![],'where':{}};var _0x128cf2={};var _0x52e466={'count':0x0,'rows':[]};return db[_0x4dee('0x3e')]['findOne']({'where':{'id':_0x426fc6[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x2f2065,null))[_0x4dee('0x10')](function(_0x570d17){if(_0x570d17){_0x128cf2['model']=_[_0x4dee('0x45')](db[_0x4dee('0x83')][_0x4dee('0x66')]);_0x128cf2[_0x4dee('0x44')]=_['keys'](_0x426fc6['query']);_0x128cf2[_0x4dee('0x46')]=_[_0x4dee('0x47')](_0x128cf2['model'],_0x128cf2[_0x4dee('0x44')]);_0x33904d[_0x4dee('0x48')]=_['intersection'](_0x128cf2[_0x4dee('0x42')],qs[_0x4dee('0x49')](_0x426fc6[_0x4dee('0x44')]['fields']));_0x33904d['attributes']=_0x33904d[_0x4dee('0x48')][_0x4dee('0x4a')]?_0x33904d[_0x4dee('0x48')]:_0x128cf2[_0x4dee('0x42')];if(!_0x426fc6[_0x4dee('0x44')][_0x4dee('0x67')](_0x4dee('0x4b'))){_0x33904d['limit']=qs[_0x4dee('0x1f')](_0x426fc6[_0x4dee('0x44')][_0x4dee('0x1f')]);_0x33904d[_0x4dee('0x1d')]=qs[_0x4dee('0x1d')](_0x426fc6[_0x4dee('0x44')][_0x4dee('0x1d')]);}_0x33904d[_0x4dee('0x4c')]=qs['sort'](_0x426fc6[_0x4dee('0x44')][_0x4dee('0x4d')]);_0x33904d[_0x4dee('0x4e')]=qs[_0x4dee('0x46')](_[_0x4dee('0x4f')](_0x426fc6[_0x4dee('0x44')],_0x128cf2[_0x4dee('0x46')]));_0x33904d[_0x4dee('0x4e')][_0x4dee('0x68')]=_0x570d17['id'];if(_0x426fc6[_0x4dee('0x44')]['filter']){_0x33904d[_0x4dee('0x4e')]=_[_0x4dee('0x50')](_0x33904d[_0x4dee('0x4e')],{'$or':_[_0x4dee('0x43')](_0x33904d[_0x4dee('0x48')],function(_0x502c96){var _0xf02ee0={};_0xf02ee0[_0x502c96]={'$like':'%'+_0x426fc6[_0x4dee('0x44')]['filter']+'%'};return _0xf02ee0;})});}_0x33904d=_[_0x4dee('0x50')]({},_0x33904d,_0x426fc6[_0x4dee('0x58')]);return db[_0x4dee('0x83')][_0x4dee('0x20')]({'where':_0x33904d[_0x4dee('0x4e')]})[_0x4dee('0x10')](function(_0x44b772){_0x52e466['count']=_0x44b772;if(_0x426fc6[_0x4dee('0x44')][_0x4dee('0x53')]){_0x33904d[_0x4dee('0x54')]=[{'model':db[_0x4dee('0x86')],'as':_0x4dee('0x87'),'required':![]},{'model':db[_0x4dee('0x88')],'as':'Owner','attributes':[_0x4dee('0x26'),_0x4dee('0x89'),_0x4dee('0x8a')],'required':![]},{'model':db[_0x4dee('0x8b')],'as':_0x4dee('0x8c'),'attributes':['id',_0x4dee('0x26'),_0x4dee('0x8d')],'where':_0x426fc6[_0x4dee('0x44')][_0x4dee('0x8e')]?{'id':_0x426fc6[_0x4dee('0x44')][_0x4dee('0x8e')]}:undefined,'required':_0x426fc6[_0x4dee('0x44')][_0x4dee('0x8e')]?!![]:![]}];}return db[_0x4dee('0x83')][_0x4dee('0x55')](_0x33904d);})[_0x4dee('0x10')](function(_0x1398ce){_0x52e466[_0x4dee('0x69')]=_0x1398ce;return _0x52e466;});}})['then'](respondWithFilteredResult(_0x2f2065,_0x33904d))[_0x4dee('0x19')](handleError(_0x2f2065,null));};exports[_0x4dee('0x8f')]=function addApplications(_0xeb7162,_0x4c9eb4){var _0xab1fd3=_0xeb7162[_0x4dee('0x5d')]['id'];var _0x4bab7e=_0xeb7162['body'];var _0x8cc1bd=0xc8;var _0x5e4c9e=null;return db[_0x4dee('0x90')][_0x4dee('0x91')]({'isolationLevel':db[_0x4dee('0x90')]['Transaction'][_0x4dee('0x92')]['READ_COMMITTED']},function(_0x35da46){return db['MailAccount'][_0x4dee('0x65')]({'where':{'id':_0xab1fd3},'transaction':_0x35da46})[_0x4dee('0x10')](function(_0x513e10){if(_0x513e10){return db['MailApplication'][_0x4dee('0x21')]({'where':{'MailAccountId':_0xab1fd3},'transaction':_0x35da46})[_0x4dee('0x10')](function(){var _0x24ff3d=_[_0x4dee('0x43')](_0x4bab7e,function(_0x177321){_0x177321[_0x4dee('0x68')]=_0xab1fd3;return _0x177321;});return db[_0x4dee('0x93')]['bulkCreate'](_0x24ff3d,{'transaction':_0x35da46});});}else{_0x8cc1bd=0x194;_0x5e4c9e=[];}});})[_0x4dee('0x10')](function(){if(_0x8cc1bd!==0x194){return db[_0x4dee('0x93')][_0x4dee('0x94')]({'where':{'MailAccountId':_0xab1fd3},'order':_0x4dee('0x95')})[_0x4dee('0x10')](function(_0x239b5d){_0x5e4c9e=_0x239b5d;});}})[_0x4dee('0x19')](function(_0x253904){_0x8cc1bd=0x1f4;logger[_0x4dee('0x15')](_0x253904[_0x4dee('0x25')]);if(_0x253904[_0x4dee('0x26')]){delete _0x253904[_0x4dee('0x26')];}_0x5e4c9e=_0x253904;})[_0x4dee('0x96')](function(){if(_0x5e4c9e===null){_0x4c9eb4[_0x4dee('0x24')](_0x8cc1bd);}else{if(_0x8cc1bd===0x1f4){_0x4c9eb4[_0x4dee('0x1a')](_0x8cc1bd)['send'](_0x5e4c9e);}else{_0x4c9eb4[_0x4dee('0x1a')](_0x8cc1bd)[_0x4dee('0x1c')](_0x5e4c9e);}}});};exports[_0x4dee('0x97')]=function(_0xd71d7d,_0x17cbe8){var _0x553a78={};var _0xdc8070={};var _0x170b10;var _0x1116ec;return db[_0x4dee('0x3e')][_0x4dee('0x65')]({'where':{'id':_0xd71d7d['params']['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x17cbe8,null))[_0x4dee('0x10')](function(_0x2bc7e3){if(_0x2bc7e3){_0x170b10=_0x2bc7e3;_0xdc8070[_0x4dee('0x42')]=_['keys'](db[_0x4dee('0x93')][_0x4dee('0x66')]);_0xdc8070[_0x4dee('0x44')]=_[_0x4dee('0x45')](_0xd71d7d[_0x4dee('0x44')]);_0xdc8070[_0x4dee('0x46')]=_['intersection'](_0xdc8070[_0x4dee('0x42')],_0xdc8070[_0x4dee('0x44')]);_0x553a78[_0x4dee('0x48')]=_['intersection'](_0xdc8070[_0x4dee('0x42')],qs[_0x4dee('0x49')](_0xd71d7d[_0x4dee('0x44')][_0x4dee('0x49')]));_0x553a78[_0x4dee('0x48')]=_0x553a78[_0x4dee('0x48')][_0x4dee('0x4a')]?_0x553a78[_0x4dee('0x48')]:_0xdc8070[_0x4dee('0x42')];_0x553a78[_0x4dee('0x4c')]=qs[_0x4dee('0x4d')](_0xd71d7d[_0x4dee('0x44')][_0x4dee('0x4d')]);_0x553a78['where']=qs[_0x4dee('0x46')](_[_0x4dee('0x4f')](_0xd71d7d[_0x4dee('0x44')],_0xdc8070[_0x4dee('0x46')]));if(_0xd71d7d['query'][_0x4dee('0x52')]){_0x553a78[_0x4dee('0x4e')]=_[_0x4dee('0x50')](_0x553a78[_0x4dee('0x4e')],{'$or':_[_0x4dee('0x43')](_0x553a78[_0x4dee('0x48')],function(_0x2bafcb){var _0x53393b={};_0x53393b[_0x2bafcb]={'$like':'%'+_0xd71d7d[_0x4dee('0x44')]['filter']+'%'};return _0x53393b;})});}_0x553a78=_[_0x4dee('0x50')]({},_0x553a78,_0xd71d7d[_0x4dee('0x58')]);return _0x170b10[_0x4dee('0x97')](_0x553a78);}})[_0x4dee('0x10')](function(_0x3353f6){if(_0x3353f6){_0x1116ec=_0x3353f6[_0x4dee('0x4a')];if(!_0xd71d7d[_0x4dee('0x44')][_0x4dee('0x67')](_0x4dee('0x4b'))){_0x553a78[_0x4dee('0x1f')]=qs['limit'](_0xd71d7d[_0x4dee('0x44')][_0x4dee('0x1f')]);_0x553a78[_0x4dee('0x1d')]=qs[_0x4dee('0x1d')](_0xd71d7d[_0x4dee('0x44')]['offset']);}return _0x170b10[_0x4dee('0x97')](_0x553a78);}})[_0x4dee('0x10')](function(_0x5e1c73){if(_0x5e1c73){return _0x5e1c73?{'count':_0x1116ec,'rows':_0x5e1c73}:null;}})[_0x4dee('0x10')](respondWithResult(_0x17cbe8,null))[_0x4dee('0x19')](handleError(_0x17cbe8,null));};exports['getMessages']=function(_0x54fd1f,_0x9b1a82){var _0x12eb44={'raw':!![],'where':{}};var _0x56b268={};var _0x202d10={'count':0x0,'rows':[]};return db[_0x4dee('0x3e')]['findOne']({'where':{'id':_0x54fd1f[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x9b1a82,null))['then'](function(_0x20df04){if(_0x20df04){_0x56b268[_0x4dee('0x42')]=_[_0x4dee('0x45')](db[_0x4dee('0x98')]['rawAttributes']);_0x56b268[_0x4dee('0x44')]=_[_0x4dee('0x45')](_0x54fd1f[_0x4dee('0x44')]);_0x56b268['filters']=_[_0x4dee('0x47')](_0x56b268['model'],_0x56b268[_0x4dee('0x44')]);_0x12eb44['attributes']=_[_0x4dee('0x47')](_0x56b268[_0x4dee('0x42')],qs[_0x4dee('0x49')](_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x49')]));_0x12eb44[_0x4dee('0x48')]=_0x12eb44[_0x4dee('0x48')][_0x4dee('0x4a')]?_0x12eb44[_0x4dee('0x48')]:_0x56b268[_0x4dee('0x42')];if(!_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x67')](_0x4dee('0x4b'))){_0x12eb44['limit']=qs[_0x4dee('0x1f')](_0x54fd1f[_0x4dee('0x44')]['limit']);_0x12eb44[_0x4dee('0x1d')]=qs['offset'](_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x1d')]);}_0x12eb44[_0x4dee('0x4c')]=qs['sort'](_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x4d')]);_0x12eb44[_0x4dee('0x4e')]=qs['filters'](_[_0x4dee('0x4f')](_0x54fd1f[_0x4dee('0x44')],_0x56b268[_0x4dee('0x46')]));_0x12eb44[_0x4dee('0x4e')][_0x4dee('0x68')]=_0x20df04['id'];if(_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x52')]){_0x12eb44[_0x4dee('0x4e')]=_['merge'](_0x12eb44[_0x4dee('0x4e')],{'$or':_[_0x4dee('0x43')](_0x12eb44['attributes'],function(_0x4877ec){var _0x1f1b0b={};_0x1f1b0b[_0x4877ec]={'$like':'%'+_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x52')]+'%'};return _0x1f1b0b;})});}if(_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x99')]){var _0x424e26=_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x99')][_0x4dee('0x9a')](',');var _0x38dff2={};_0x38dff2[_0x424e26[0x0]]={'$gte':moment(_0x424e26[0x1])[_0x4dee('0x9b')](_0x4dee('0x9c'))};_0x12eb44[_0x4dee('0x4e')]=_[_0x4dee('0x50')](_0x12eb44[_0x4dee('0x4e')],_0x38dff2);}_0x12eb44=_[_0x4dee('0x50')]({},_0x12eb44,_0x54fd1f['options']);return db['MailMessage']['count']({'where':_0x12eb44['where']})['then'](function(_0x17fba3){_0x202d10['count']=_0x17fba3;if(_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x53')]){_0x12eb44[_0x4dee('0x54')]=[{'all':!![]}];}return db['MailMessage']['findAll'](_0x12eb44);})[_0x4dee('0x10')](function(_0x21f596){if(_0x54fd1f[_0x4dee('0x44')][_0x4dee('0x9d')]===_0x4dee('0x9e')){for(var _0x32dcf4=0x0;_0x32dcf4<_0x21f596[_0x4dee('0x4a')];_0x32dcf4++){_0x21f596[_0x32dcf4][_0x4dee('0x5b')]=juice(_0x21f596[_0x32dcf4][_0x4dee('0x5b')]);}}_0x202d10[_0x4dee('0x69')]=_0x21f596;return _0x202d10;});}})[_0x4dee('0x10')](respondWithFilteredResult(_0x9b1a82,_0x12eb44))[_0x4dee('0x19')](handleError(_0x9b1a82,null));};exports[_0x4dee('0x27')]=function(_0xddcd85,_0x586d9a){var _0x1097ba,_0x1fbdef={},_0x180d2a;if(_0xddcd85['body']['to']){_0x180d2a=_0xddcd85['body']['to']['split'](',')[0x0];}return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0xddcd85[_0x4dee('0x5d')]['id']},'include':[{'model':db[_0x4dee('0x9f')],'as':_0x4dee('0xa0'),'include':[{'model':db[_0x4dee('0x86')],'as':_0x4dee('0xa1'),'where':{'email':_0x180d2a},'limit':0x1,'order':[[_0x4dee('0xa2'),'DESC']]}]},{'model':db[_0x4dee('0x3c')],'as':_0x4dee('0x39'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x4dee('0xa3'),'raw':!![]}]}]})[_0x4dee('0x10')](handleEntityNotFound(_0x586d9a,null))[_0x4dee('0x10')](function(_0x11ea2e){if(!_0x11ea2e)return;_0x1097ba=_0x11ea2e;if(!_0x11ea2e[_0x4dee('0x39')])throw new Error(_0x4dee('0xa4'));if(_[_0x4dee('0x72')](_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xa5')])){_0xddcd85['body']['from']=util[_0x4dee('0x9b')](_0x4dee('0xa6'),_0x11ea2e[_0x4dee('0x26')],_0x11ea2e['email']||_0x11ea2e[_0x4dee('0x39')][_0x4dee('0x2f')]);}if(_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xa7')]&&_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xa7')][_0x4dee('0x4a')]){for(var _0x633dd8=0x0;_0x633dd8<_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xa7')][_0x4dee('0x4a')];_0x633dd8+=0x1){_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xa7')][_0x633dd8]={'filename':_0xddcd85['body'][_0x4dee('0xa7')][_0x633dd8][_0x4dee('0x26')],'path':path[_0x4dee('0xa8')](config[_0x4dee('0xa9')],_0x4dee('0xaa'),_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xa7')][_0x633dd8][_0x4dee('0xab')])};}}var _0x595aff=_0x11ea2e[_0x4dee('0xac')]();return respondWithRpcPromise(_0x4dee('0xad'),_0x4dee('0xae'),{'account':_0x595aff,'message':_0xddcd85[_0x4dee('0x5b')]});})[_0x4dee('0x10')](function(_0x4478bb){if(!_0x4478bb)return;_0x1fbdef=_0x4478bb;if(!_0x1097ba['List'])throw new Error(_0x4dee('0xaf'));if(_0x1097ba[_0x4dee('0xa0')][_0x4dee('0xa1')][_0x4dee('0x4a')])return _0x1097ba[_0x4dee('0xa0')][_0x4dee('0xa1')][0x0];return db[_0x4dee('0x86')][_0x4dee('0x63')](_[_0x4dee('0x9')](_0xddcd85[_0x4dee('0x5b')],{'firstName':_0xddcd85['body']['to'],'email':_0xddcd85[_0x4dee('0x5b')]['to'],'phone':_0xddcd85[_0x4dee('0x5b')]['to'],'ListId':_0x1097ba[_0x4dee('0x71')]}));})[_0x4dee('0x10')](function(_0xde5863){if(!_0xde5863)return;var _0x88624d={'UserId':_0xddcd85[_0x4dee('0x2f')]['id'],'ContactId':_0xde5863['id'],'MailAccountId':_0x1097ba['id'],'inReplyTo':_0x1fbdef[_0x4dee('0xb0')],'to':_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xa5')],'cc':_0xddcd85[_0x4dee('0x5b')]['cc'],'subject':_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xb1')],'attach':_0xddcd85['body']['attach'],'firstMsgDirection':_0x4dee('0xb2'),'lastMsgAt':moment()['format'](_0x4dee('0x9c')),'lastMsgDirection':'out','Messages':[_[_0x4dee('0x50')](_0xddcd85[_0x4dee('0x5b')],{'messageId':_0x1fbdef[_0x4dee('0xb0')],'sentAt':moment()[_0x4dee('0x9b')](_0x4dee('0x9c')),'read':!![],'MailAccountId':_0x1097ba['id'],'UserId':_0xddcd85[_0x4dee('0x2f')]['id'],'ContactId':_0xde5863['id']})]};if(_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xb3')]){_0x88624d=_['merge'](_0x88624d,_0xddcd85[_0x4dee('0x5b')][_0x4dee('0xb3')]);}return db[_0x4dee('0x83')][_0x4dee('0x63')](_0x88624d,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});})[_0x4dee('0x10')](respondWithResult(_0x586d9a,null))[_0x4dee('0x19')](handleError(_0x586d9a,null));};exports[_0x4dee('0xb4')]=function(_0x56b7e6,_0x462439){return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0x56b7e6[_0x4dee('0x5d')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x4dee('0x39'),'raw':!![],'include':[{'model':db[_0x4dee('0xa3')],'as':_0x4dee('0xa3'),'raw':!![]}]}]})[_0x4dee('0x10')](handleEntityNotFound(_0x462439,null))[_0x4dee('0x10')](function(_0x9ebc58){if(!_0x9ebc58[_0x4dee('0x39')])return;var _0x5ce427=_0x9ebc58[_0x4dee('0xac')]();return respondWithRpcPromise(_0x4dee('0xb5'),_0x4dee('0xb4'),{'account':_0x5ce427});})['then'](respondWithResult(_0x462439,null))[_0x4dee('0x19')](handleError(_0x462439,null));};exports[_0x4dee('0x21')]=function(_0x470733,_0x379791){return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0x470733[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x379791,null))[_0x4dee('0x10')](function(_0x229abf){if(_0x229abf&&_0x229abf[_0x4dee('0x5f')]){throw new db[(_0x4dee('0xb6'))]['ValidationError'](_0x4dee('0xb7'));}return _0x229abf;})[_0x4dee('0x10')](removeEntity(_0x379791,null))['catch'](handleError(_0x379791,null));};exports[_0x4dee('0xb8')]=function(_0x5c1d8c,_0x203d2f){return db[_0x4dee('0x3e')][_0x4dee('0x59')]({'where':{'id':_0x5c1d8c[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x203d2f,null))[_0x4dee('0x10')](function(_0x56b9e0){if(_0x56b9e0){return _0x56b9e0[_0x4dee('0xb8')](_0x5c1d8c['body'][_0x4dee('0x6b')],_[_0x4dee('0x84')](_0x5c1d8c[_0x4dee('0x5b')],[_0x4dee('0x6b'),'id'])||{})[_0x4dee('0xb9')](function(_0x279437){for(var _0x16fee2=0x0;_0x16fee2<_0x5c1d8c[_0x4dee('0x5b')][_0x4dee('0x6b')][_0x4dee('0x4a')];_0x16fee2+=0x1){socket[_0x4dee('0xba')](_0x4dee('0xbb'),{'UserId':Number(_0x5c1d8c[_0x4dee('0x5b')]['ids'][_0x16fee2]),'MailAccountId':Number(_0x5c1d8c[_0x4dee('0x5d')]['id'])});}return _0x279437;});}})[_0x4dee('0x10')](respondWithResult(_0x203d2f,null))[_0x4dee('0x19')](handleError(_0x203d2f,null));};exports['removeAgents']=function(_0x176dc3,_0xa80262){return db['MailAccount']['find']({'where':{'id':_0x176dc3[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0xa80262,null))[_0x4dee('0x10')](function(_0x268550){if(_0x268550){return _0x268550['removeAgents'](_0x176dc3[_0x4dee('0x44')][_0x4dee('0x6b')])[_0x4dee('0x10')](function(){if(_[_0x4dee('0xbc')](_0x176dc3[_0x4dee('0x44')][_0x4dee('0x6b')])){for(var _0x46c742=0x0;_0x46c742<_0x176dc3[_0x4dee('0x44')][_0x4dee('0x6b')][_0x4dee('0x4a')];_0x46c742+=0x1){socket[_0x4dee('0xba')](_0x4dee('0xbd'),{'UserId':Number(_0x176dc3['query'][_0x4dee('0x6b')][_0x46c742]),'MailAccountId':Number(_0x176dc3[_0x4dee('0x5d')]['id'])});}}else{socket[_0x4dee('0xba')](_0x4dee('0xbd'),{'UserId':Number(_0x176dc3['query'][_0x4dee('0x6b')]),'MailAccountId':Number(_0x176dc3[_0x4dee('0x5d')]['id'])});}});}})[_0x4dee('0x10')](respondWithStatusCode(_0xa80262,null))[_0x4dee('0x19')](handleError(_0xa80262,null));};exports[_0x4dee('0xbe')]=function(_0xbfd50c,_0x333ad6){var _0x13a86f={};var _0x266a65={};var _0x19e202;var _0x568ceb;return db[_0x4dee('0x3e')][_0x4dee('0x65')]({'where':{'id':_0xbfd50c[_0x4dee('0x5d')]['id']}})[_0x4dee('0x10')](handleEntityNotFound(_0x333ad6,null))[_0x4dee('0x10')](function(_0x5aed79){if(_0x5aed79){_0x19e202=_0x5aed79;_0x266a65['model']=_['keys'](db[_0x4dee('0x88')][_0x4dee('0x66')]);_0x266a65[_0x4dee('0x44')]=_[_0x4dee('0x45')](_0xbfd50c['query']);_0x266a65[_0x4dee('0x46')]=_[_0x4dee('0x47')](_0x266a65[_0x4dee('0x42')],_0x266a65[_0x4dee('0x44')]);_0x13a86f['attributes']=_[_0x4dee('0x47')](_0x266a65[_0x4dee('0x42')],qs[_0x4dee('0x49')](_0xbfd50c['query']['fields']));_0x13a86f[_0x4dee('0x48')]=_0x13a86f[_0x4dee('0x48')][_0x4dee('0x4a')]?_0x13a86f[_0x4dee('0x48')]:_0x266a65[_0x4dee('0x42')];_0x13a86f['order']=qs['sort'](_0xbfd50c[_0x4dee('0x44')][_0x4dee('0x4d')]);_0x13a86f[_0x4dee('0x4e')]=qs[_0x4dee('0x46')](_[_0x4dee('0x4f')](_0xbfd50c[_0x4dee('0x44')],_0x266a65[_0x4dee('0x46')]));if(_0xbfd50c['query']['filter']){_0x13a86f[_0x4dee('0x4e')]=_['merge'](_0x13a86f['where'],{'$or':_[_0x4dee('0x43')](_0x13a86f[_0x4dee('0x48')],function(_0x1ab7fd){var _0x3f69f6={};_0x3f69f6[_0x1ab7fd]={'$like':'%'+_0xbfd50c['query'][_0x4dee('0x52')]+'%'};return _0x3f69f6;})});}_0x13a86f=_[_0x4dee('0x50')]({},_0x13a86f,_0xbfd50c[_0x4dee('0x58')]);return _0x19e202[_0x4dee('0xbe')](_0x13a86f);}})[_0x4dee('0x10')](function(_0x2b4317){if(_0x2b4317){_0x568ceb=_0x2b4317[_0x4dee('0x4a')];if(!_0xbfd50c[_0x4dee('0x44')]['hasOwnProperty']('nolimit')){_0x13a86f[_0x4dee('0x1f')]=qs[_0x4dee('0x1f')](_0xbfd50c[_0x4dee('0x44')]['limit']);_0x13a86f[_0x4dee('0x1d')]=qs[_0x4dee('0x1d')](_0xbfd50c[_0x4dee('0x44')][_0x4dee('0x1d')]);}return _0x19e202[_0x4dee('0xbe')](_0x13a86f);}})[_0x4dee('0x10')](function(_0x177fc3){if(_0x177fc3){return _0x177fc3?{'count':_0x568ceb,'rows':_0x177fc3}:null;}})[_0x4dee('0x10')](respondWithResult(_0x333ad6,null))[_0x4dee('0x19')](handleError(_0x333ad6,null));}; \ No newline at end of file +var _0x7f14=['out','Interaction','Messages','VerifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','userMailAccount:remove','getAgents','moment','util','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','jayson/promise','client','http','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','json','offset','undefined','set','Content-Range','then','destroy','get','MailAccounts','UserProfileResource','end','stack','name','gmail','hotmail','imap-mail.outlook.com','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','yahoo','smtp.mail.yahoo.com','outlook365','smtp.office365.com','user','password','modernAuthentication','CloudProviderId','host','port','secure','service','authentication','username','pass','Imap','Smtp','index','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','type','model','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','MailServerIn','keys','find','body','provider','custom','update','describe','addDisposition','MailAccountId','create','getDispositions','Disposition','addAnswer','CannedAnswer','findOne','removeAnswers','key','email','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','ids','getInteractions','CmContact','User','fullname','internal','Tags','color','tag','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','priority','finally','getApplications','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','inlineCss','send','split','Contacts','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','attachments','join','server/files/attachments','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','List','ListId','messageId','attach'];(function(_0x28bb8d,_0x564dda){var _0x3c2d86=function(_0x21160e){while(--_0x21160e){_0x28bb8d['push'](_0x28bb8d['shift']());}};_0x3c2d86(++_0x564dda);}(_0x7f14,0xd1));var _0x47f1=function(_0xcf9a4e,_0x4315a1){_0xcf9a4e=_0xcf9a4e-0x0;var _0x315bab=_0x7f14[_0xcf9a4e];return _0x315bab;};'use strict';var moment=require(_0x47f1('0x0'));var BPromise=require('bluebird');var util=require(_0x47f1('0x1'));var path=require(_0x47f1('0x2'));var _=require(_0x47f1('0x3'));var juice=require(_0x47f1('0x4'));var Redis=require('ioredis');var qs=require(_0x47f1('0x5'));var logger=require(_0x47f1('0x6'))(_0x47f1('0x7'));var config=require(_0x47f1('0x8'));var db=require(_0x47f1('0x9'))['db'];config[_0x47f1('0xa')]=_[_0x47f1('0xb')](config[_0x47f1('0xa')],{'host':_0x47f1('0xc'),'port':0x18eb});var socket=require(_0x47f1('0xd'))(new Redis(config[_0x47f1('0xa')]));require('./mailAccount.socket')['register'](socket);var jayson=require(_0x47f1('0xe'));var client=jayson[_0x47f1('0xf')][_0x47f1('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x457f66,_0x27bf58,_0x112721,_0x834295){return new BPromise(function(_0x5cce9e,_0x23ddf7){var _0x12ef03=_0x834295||client;return _0x12ef03['request'](_0x457f66,_0x112721)['then'](function(_0x24a394){logger[_0x47f1('0x11')](_0x47f1('0x12'),_0x27bf58,_0x47f1('0x13'));logger[_0x47f1('0x14')](_0x47f1('0x15'),_0x27bf58,'request\x20sent',JSON['stringify'](_0x24a394));if(_0x24a394[_0x47f1('0x16')]){if(_0x24a394[_0x47f1('0x16')]['code']===0x1f4){logger[_0x47f1('0x16')](_0x47f1('0x12'),_0x27bf58,_0x24a394['error']['message']);return _0x23ddf7(_0x24a394[_0x47f1('0x16')]['message']);}logger[_0x47f1('0x16')](_0x47f1('0x12'),_0x27bf58,_0x24a394[_0x47f1('0x16')]['message']);return _0x5cce9e(_0x24a394['error'][_0x47f1('0x17')]);}else{logger['info'](_0x47f1('0x12'),_0x27bf58,_0x47f1('0x13'));_0x5cce9e(_0x24a394[_0x47f1('0x18')]['message']);}})[_0x47f1('0x19')](function(_0x5b4ab7){logger[_0x47f1('0x16')](_0x47f1('0x12'),_0x27bf58,_0x5b4ab7);_0x23ddf7(_0x5b4ab7);});});}function respondWithStatusCode(_0x28de05,_0x3d2b61){_0x3d2b61=_0x3d2b61||0xcc;return function(_0x41fc82){if(_0x41fc82){return _0x28de05[_0x47f1('0x1a')](_0x3d2b61);}return _0x28de05[_0x47f1('0x1b')](_0x3d2b61)['end']();};}function respondWithResult(_0x1fd6a0,_0x101ea8){_0x101ea8=_0x101ea8||0xc8;return function(_0x52dfe9){if(_0x52dfe9){return _0x1fd6a0[_0x47f1('0x1b')](_0x101ea8)[_0x47f1('0x1c')](_0x52dfe9);}};}function respondWithFilteredResult(_0x2931fc,_0x153d86){return function(_0x3a92c6){if(_0x3a92c6){var _0x529a3a=typeof _0x153d86[_0x47f1('0x1d')]===_0x47f1('0x1e')&&typeof _0x153d86['limit']===_0x47f1('0x1e');var _0xc9cd00=_0x3a92c6['count'];var _0x2904f6=_0x529a3a?0x0:_0x153d86['offset'];var _0x9f676=_0x529a3a?_0x3a92c6['count']:_0x153d86['offset']+_0x153d86['limit'];var _0x3172df;if(_0x9f676>=_0xc9cd00){_0x9f676=_0xc9cd00;_0x3172df=0xc8;}else{_0x3172df=0xce;}_0x2931fc[_0x47f1('0x1b')](_0x3172df);return _0x2931fc[_0x47f1('0x1f')](_0x47f1('0x20'),_0x2904f6+'-'+_0x9f676+'/'+_0xc9cd00)[_0x47f1('0x1c')](_0x3a92c6);}return null;};}function saveUpdates(_0x436263){return function(_0x3c0c42){if(_0x3c0c42){return _0x3c0c42['update'](_0x436263)[_0x47f1('0x21')](function(_0x4d2880){return _0x4d2880;});}return null;};}function removeEntity(_0x578266){return function(_0x36dd62){if(_0x36dd62){return _0x36dd62[_0x47f1('0x22')]()['then'](function(){var _0xa8e8b0=_0x36dd62[_0x47f1('0x23')]({'plain':!![]});var _0x41f413=_0x47f1('0x24');return db[_0x47f1('0x25')][_0x47f1('0x22')]({'where':{'type':_0x41f413,'resourceId':_0xa8e8b0['id']}})[_0x47f1('0x21')](function(){return _0x36dd62;});})[_0x47f1('0x21')](function(){_0x578266['status'](0xcc)[_0x47f1('0x26')]();});}};}function handleEntityNotFound(_0x419bdc){return function(_0x4f09b3){if(!_0x4f09b3){_0x419bdc[_0x47f1('0x1a')](0x194);}return _0x4f09b3;};}function handleError(_0x58841d,_0x22148d){_0x22148d=_0x22148d||0x1f4;return function(_0x363252){logger[_0x47f1('0x16')](_0x363252[_0x47f1('0x27')]);if(_0x363252['name']){delete _0x363252[_0x47f1('0x28')];}_0x58841d[_0x47f1('0x1b')](_0x22148d)['send'](_0x363252);};}function getImapHost(_0x4da62b){switch(_0x4da62b){case _0x47f1('0x29'):return'imap.gmail.com';case'yahoo':return'imap.mail.yahoo.com';case _0x47f1('0x2a'):return _0x47f1('0x2b');case'outlook365':return _0x47f1('0x2c');}throw new Error(_0x47f1('0x2d'),_0x4da62b);}function getSmtpHost(_0x341026){switch(_0x341026){case'gmail':return _0x47f1('0x2e');case _0x47f1('0x2f'):return _0x47f1('0x30');case _0x47f1('0x2a'):return'smtp-mail.outlook.com';case _0x47f1('0x31'):return _0x47f1('0x32');}throw new Error('Unknown\x20email\x20service\x20provider',_0x341026);}function getAuthenticationOptions(_0x4ba095,_0x53dc12){var _0x2fd026={};var _0x3f4833={};if(_0x4ba095){_0x2fd026['user']=_0x3f4833[_0x47f1('0x33')]=_0x53dc12['username'];_0x2fd026['password']=_0x3f4833['pass']=_0x53dc12[_0x47f1('0x34')];if(_0x53dc12['modernAuthentication']){_0x2fd026[_0x47f1('0x35')]=_0x3f4833['modernAuthentication']=!![];_0x2fd026[_0x47f1('0x36')]=_0x3f4833['CloudProviderId']=_0x53dc12['CloudProviderId'];_0x2fd026[_0x47f1('0x34')]=_0x3f4833['pass']=null;}else{_0x2fd026['CloudProviderId']=_0x3f4833[_0x47f1('0x36')]=null;}_0x2fd026['host']=getImapHost(_0x4ba095);_0x2fd026['port']=0x3e1;_0x3f4833[_0x47f1('0x37')]=getSmtpHost(_0x4ba095);_0x3f4833[_0x47f1('0x38')]=0x24b;_0x3f4833[_0x47f1('0x39')]=![];_0x2fd026['service']=_0x3f4833[_0x47f1('0x3a')]=null;}else{if(_0x53dc12[_0x47f1('0x3b')]){_0x2fd026[_0x47f1('0x33')]=_0x3f4833[_0x47f1('0x33')]=_0x53dc12[_0x47f1('0x3c')];_0x2fd026[_0x47f1('0x34')]=_0x3f4833[_0x47f1('0x3d')]=_0x53dc12[_0x47f1('0x34')];}else{_0x2fd026[_0x47f1('0x3b')]=_0x3f4833[_0x47f1('0x3b')]=![];_0x2fd026[_0x47f1('0x33')]=_0x3f4833['user']=null;_0x2fd026[_0x47f1('0x34')]=_0x3f4833['pass']=null;}_0x2fd026[_0x47f1('0x37')]=_0x53dc12[_0x47f1('0x3e')]['host'];_0x2fd026['port']=_0x53dc12[_0x47f1('0x3e')][_0x47f1('0x38')];_0x3f4833[_0x47f1('0x37')]=_0x53dc12[_0x47f1('0x3f')][_0x47f1('0x37')];_0x3f4833[_0x47f1('0x38')]=_0x53dc12[_0x47f1('0x3f')][_0x47f1('0x38')];}return{'Imap':_0x2fd026,'Smtp':_0x3f4833};}exports[_0x47f1('0x40')]=function(_0x4e1df2,_0x333e1b){var _0x4994e7={'include':[{'model':db['MailServerIn'],'as':_0x47f1('0x3e')},{'model':db[_0x47f1('0x41')],'as':_0x47f1('0x3f')},{'model':db[_0x47f1('0x42')],'as':_0x47f1('0x43')}]},_0x28b565={},_0x42b6e8={'count':0x0,'rows':[]};var _0x5ba7d7=_[_0x47f1('0x44')](db[_0x47f1('0x45')][_0x47f1('0x46')],function(_0x317557){return{'name':_0x317557[_0x47f1('0x47')],'type':_0x317557[_0x47f1('0x48')]['key']};});_0x28b565[_0x47f1('0x49')]=_[_0x47f1('0x44')](_0x5ba7d7,_0x47f1('0x28'));_0x28b565['query']=_['keys'](_0x4e1df2['query']);_0x28b565[_0x47f1('0x4a')]=_[_0x47f1('0x4b')](_0x28b565[_0x47f1('0x49')],_0x28b565['query']);_0x4994e7['attributes']=_[_0x47f1('0x4b')](_0x28b565['model'],qs[_0x47f1('0x4c')](_0x4e1df2[_0x47f1('0x4d')][_0x47f1('0x4c')]));_0x4994e7[_0x47f1('0x4e')]=_0x4994e7[_0x47f1('0x4e')][_0x47f1('0x4f')]?_0x4994e7[_0x47f1('0x4e')]:_0x28b565[_0x47f1('0x49')];if(!_0x4e1df2['query'][_0x47f1('0x50')](_0x47f1('0x51'))){_0x4994e7[_0x47f1('0x52')]=qs[_0x47f1('0x52')](_0x4e1df2[_0x47f1('0x4d')][_0x47f1('0x52')]);_0x4994e7[_0x47f1('0x1d')]=qs[_0x47f1('0x1d')](_0x4e1df2[_0x47f1('0x4d')]['offset']);}_0x4994e7[_0x47f1('0x53')]=qs[_0x47f1('0x54')](_0x4e1df2[_0x47f1('0x4d')]['sort']);_0x4994e7[_0x47f1('0x55')]=qs['filters'](_[_0x47f1('0x56')](_0x4e1df2[_0x47f1('0x4d')],_0x28b565[_0x47f1('0x4a')]),_0x5ba7d7);if(_0x4e1df2[_0x47f1('0x4d')][_0x47f1('0x57')]){_0x4994e7['where']=_[_0x47f1('0x58')](_0x4994e7[_0x47f1('0x55')],{'$or':_[_0x47f1('0x44')](_0x5ba7d7,function(_0x6e1db){if(_0x6e1db[_0x47f1('0x48')]!==_0x47f1('0x59')){var _0x47f054={};_0x47f054[_0x6e1db[_0x47f1('0x28')]]={'$like':'%'+_0x4e1df2[_0x47f1('0x4d')]['filter']+'%'};return _0x47f054;}})});}_0x4994e7=_[_0x47f1('0x58')]({},_0x4994e7,_0x4e1df2[_0x47f1('0x5a')]);var _0x44cbf1={'where':_0x4994e7['where']};return db[_0x47f1('0x45')][_0x47f1('0x5b')](_0x44cbf1)['then'](function(_0x51fc86){_0x42b6e8[_0x47f1('0x5b')]=_0x51fc86;if(_0x4e1df2[_0x47f1('0x4d')][_0x47f1('0x5c')]){_0x4994e7[_0x47f1('0x5d')]=[{'all':!![]}];}return db[_0x47f1('0x45')][_0x47f1('0x5e')](_0x4994e7);})[_0x47f1('0x21')](function(_0x13c29b){_0x42b6e8[_0x47f1('0x5f')]=_0x13c29b;return _0x42b6e8;})[_0x47f1('0x21')](respondWithFilteredResult(_0x333e1b,_0x4994e7))[_0x47f1('0x19')](handleError(_0x333e1b,null));};exports[_0x47f1('0x60')]=function(_0x368da4,_0x39e43e){var _0x54d834={'raw':![],'where':{'id':_0x368da4[_0x47f1('0x61')]['id']},'include':[{'model':db[_0x47f1('0x62')],'as':_0x47f1('0x3e')},{'model':db['MailServerOut'],'as':_0x47f1('0x3f')},{'model':db['Pause'],'as':_0x47f1('0x43')}]},_0x293469={};_0x293469[_0x47f1('0x49')]=_[_0x47f1('0x63')](db[_0x47f1('0x45')][_0x47f1('0x46')]);_0x293469[_0x47f1('0x4d')]=_[_0x47f1('0x63')](_0x368da4[_0x47f1('0x4d')]);_0x293469[_0x47f1('0x4a')]=_[_0x47f1('0x4b')](_0x293469[_0x47f1('0x49')],_0x293469[_0x47f1('0x4d')]);_0x54d834['attributes']=_[_0x47f1('0x4b')](_0x293469[_0x47f1('0x49')],qs[_0x47f1('0x4c')](_0x368da4[_0x47f1('0x4d')][_0x47f1('0x4c')]));_0x54d834[_0x47f1('0x4e')]=_0x54d834[_0x47f1('0x4e')]['length']?_0x54d834['attributes']:_0x293469[_0x47f1('0x49')];if(_0x368da4[_0x47f1('0x4d')][_0x47f1('0x5c')]){_0x54d834[_0x47f1('0x5d')]=[{'all':!![]}];}_0x54d834=_[_0x47f1('0x58')]({},_0x54d834,_0x368da4['options']);return db['MailAccount'][_0x47f1('0x64')](_0x54d834)[_0x47f1('0x21')](handleEntityNotFound(_0x39e43e,null))[_0x47f1('0x21')](respondWithResult(_0x39e43e,null))[_0x47f1('0x19')](handleError(_0x39e43e,null));};exports['update']=function(_0x16f44a,_0x2bf2a2){if(_0x16f44a[_0x47f1('0x65')]['id']){delete _0x16f44a[_0x47f1('0x65')]['id'];}var _0x6988f1=_0x16f44a[_0x47f1('0x65')][_0x47f1('0x66')]===_0x47f1('0x67')?null:_0x16f44a[_0x47f1('0x65')][_0x47f1('0x66')];var _0x545fda=_0x16f44a['body'][_0x47f1('0x3e')]||{};var _0x522200=_0x16f44a[_0x47f1('0x65')][_0x47f1('0x3f')]||{};if(_0x6988f1){_0x545fda[_0x47f1('0x37')]=getImapHost(_0x6988f1);_0x545fda[_0x47f1('0x38')]=0x3e1;_0x522200[_0x47f1('0x37')]=getSmtpHost(_0x6988f1);_0x522200[_0x47f1('0x38')]=0x24b;_0x522200[_0x47f1('0x39')]=![];}if(_0x522200['modernAuthentication']){_0x522200[_0x47f1('0x39')]=![];}else{_0x522200[_0x47f1('0x36')]=null;}if(!_0x545fda[_0x47f1('0x35')])_0x545fda['CloudProviderId']=null;_0x16f44a[_0x47f1('0x65')][_0x47f1('0x3e')]=_0x545fda;_0x16f44a[_0x47f1('0x65')][_0x47f1('0x3f')]=_0x522200;return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0x16f44a[_0x47f1('0x61')]['id']},'include':[{'model':db['MailServerIn'],'as':_0x47f1('0x3e')},{'model':db[_0x47f1('0x41')],'as':_0x47f1('0x3f')},{'model':db[_0x47f1('0x42')],'as':'mandatoryDispositionPause'}]})[_0x47f1('0x21')](handleEntityNotFound(_0x2bf2a2,null))[_0x47f1('0x21')](function(_0x4d7113){if(!_0x4d7113)throw new Error('Mail\x20Account\x20not\x20found');if(_0x4d7113[_0x47f1('0x3a')])delete _0x16f44a[_0x47f1('0x65')][_0x47f1('0x3e')];return _0x4d7113;})[_0x47f1('0x21')](saveUpdates(_0x16f44a[_0x47f1('0x65')],null))['then'](function(_0x593950){if(!_0x16f44a[_0x47f1('0x65')]['Imap'])return _0x593950;return db[_0x47f1('0x62')][_0x47f1('0x68')](_0x16f44a[_0x47f1('0x65')][_0x47f1('0x3e')],{'where':{'MailAccountId':_0x593950['id']}})[_0x47f1('0x21')](function(){return _0x593950;});})['then'](function(_0x118eef){if(!_0x16f44a[_0x47f1('0x65')]['Smtp'])return _0x118eef;return db[_0x47f1('0x41')][_0x47f1('0x68')](_0x16f44a['body'][_0x47f1('0x3f')],{'where':{'MailAccountId':_0x118eef['id']}})['then'](function(){return _0x118eef;});})[_0x47f1('0x21')](respondWithResult(_0x2bf2a2,null))[_0x47f1('0x19')](handleError(_0x2bf2a2,null));};exports['describe']=function(_0x2b4f13,_0x291f46){return db[_0x47f1('0x45')][_0x47f1('0x69')]()[_0x47f1('0x21')](respondWithResult(_0x291f46,null))[_0x47f1('0x19')](handleError(_0x291f46,null));};exports[_0x47f1('0x6a')]=function(_0x2e69e9,_0x130f1b){if(_0x2e69e9['body']['id']){delete _0x2e69e9[_0x47f1('0x65')]['id'];}return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0x2e69e9[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x130f1b,null))['then'](function(_0x29758b){if(_0x29758b){_0x2e69e9[_0x47f1('0x65')][_0x47f1('0x6b')]=_0x29758b['id'];return db['Disposition'][_0x47f1('0x6c')](_0x2e69e9['body']);}})[_0x47f1('0x21')](respondWithResult(_0x130f1b,null))[_0x47f1('0x19')](handleError(_0x130f1b,null));};exports[_0x47f1('0x6d')]=function(_0x1d3ac0,_0x208720){var _0x36e150={'raw':![],'where':{}};var _0x556119={};var _0x1efda2={'count':0x0,'rows':[]};return db[_0x47f1('0x45')]['findOne']({'where':{'id':_0x1d3ac0[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x208720,null))[_0x47f1('0x21')](function(_0x3cbf94){if(_0x3cbf94){_0x556119[_0x47f1('0x49')]=_['keys'](db[_0x47f1('0x6e')][_0x47f1('0x46')]);_0x556119[_0x47f1('0x4d')]=_[_0x47f1('0x63')](_0x1d3ac0['query']);_0x556119[_0x47f1('0x4a')]=_['intersection'](_0x556119[_0x47f1('0x49')],_0x556119[_0x47f1('0x4d')]);_0x36e150[_0x47f1('0x4e')]=_[_0x47f1('0x4b')](_0x556119[_0x47f1('0x49')],qs[_0x47f1('0x4c')](_0x1d3ac0[_0x47f1('0x4d')]['fields']));_0x36e150['attributes']=_0x36e150[_0x47f1('0x4e')]['length']?_0x36e150[_0x47f1('0x4e')]:_0x556119[_0x47f1('0x49')];if(!_0x1d3ac0['query'][_0x47f1('0x50')]('nolimit')){_0x36e150[_0x47f1('0x52')]=qs[_0x47f1('0x52')](_0x1d3ac0[_0x47f1('0x4d')][_0x47f1('0x52')]);_0x36e150[_0x47f1('0x1d')]=qs['offset'](_0x1d3ac0[_0x47f1('0x4d')]['offset']);}_0x36e150[_0x47f1('0x53')]=qs[_0x47f1('0x54')](_0x1d3ac0['query'][_0x47f1('0x54')]);_0x36e150[_0x47f1('0x55')]=qs[_0x47f1('0x4a')](_['pick'](_0x1d3ac0[_0x47f1('0x4d')],_0x556119[_0x47f1('0x4a')]));_0x36e150[_0x47f1('0x55')][_0x47f1('0x6b')]=_0x3cbf94['id'];if(_0x1d3ac0['query']['filter']){_0x36e150[_0x47f1('0x55')]=_[_0x47f1('0x58')](_0x36e150['where'],{'$or':_[_0x47f1('0x44')](_0x36e150[_0x47f1('0x4e')],function(_0x20e3aa){var _0x6bb988={};_0x6bb988[_0x20e3aa]={'$like':'%'+_0x1d3ac0['query'][_0x47f1('0x57')]+'%'};return _0x6bb988;})});}_0x36e150=_['merge']({},_0x36e150,_0x1d3ac0[_0x47f1('0x5a')]);return db[_0x47f1('0x6e')]['count']({'where':_0x36e150['where']})['then'](function(_0x4b6775){_0x1efda2[_0x47f1('0x5b')]=_0x4b6775;if(_0x1d3ac0[_0x47f1('0x4d')][_0x47f1('0x5c')]){_0x36e150[_0x47f1('0x5d')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x36e150);})[_0x47f1('0x21')](function(_0x56ba30){_0x1efda2[_0x47f1('0x5f')]=_0x56ba30;return _0x1efda2;});}})['then'](respondWithFilteredResult(_0x208720,_0x36e150))[_0x47f1('0x19')](handleError(_0x208720,null));};exports['removeDispositions']=function(_0x59a63a,_0x45b894){return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0x59a63a[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x45b894,null))['then'](function(_0x252258){if(_0x252258){return _0x252258['removeDispositions'](_0x59a63a[_0x47f1('0x4d')]['ids']);}})['then'](respondWithStatusCode(_0x45b894,null))[_0x47f1('0x19')](handleError(_0x45b894,null));};exports[_0x47f1('0x6f')]=function(_0x2f81c5,_0x563789){if(_0x2f81c5['body']['id']){delete _0x2f81c5[_0x47f1('0x65')]['id'];}return db[_0x47f1('0x45')]['find']({'where':{'id':_0x2f81c5[_0x47f1('0x61')]['id']}})['then'](handleEntityNotFound(_0x563789,null))['then'](function(_0x801198){if(_0x801198){_0x2f81c5[_0x47f1('0x65')]['MailAccountId']=_0x801198['id'];return db[_0x47f1('0x70')]['create'](_0x2f81c5[_0x47f1('0x65')]);}})['then'](respondWithResult(_0x563789,null))[_0x47f1('0x19')](handleError(_0x563789,null));};exports['getAnswers']=function(_0x4a7142,_0xb338a6){var _0x42c773={'raw':![],'where':{}};var _0x5afc75={};var _0x7b7a00={'count':0x0,'rows':[]};return db[_0x47f1('0x45')][_0x47f1('0x71')]({'where':{'id':_0x4a7142[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0xb338a6,null))[_0x47f1('0x21')](function(_0xd1bdf1){if(_0xd1bdf1){_0x5afc75['model']=_[_0x47f1('0x63')](db[_0x47f1('0x70')][_0x47f1('0x46')]);_0x5afc75[_0x47f1('0x4d')]=_['keys'](_0x4a7142[_0x47f1('0x4d')]);_0x5afc75['filters']=_[_0x47f1('0x4b')](_0x5afc75[_0x47f1('0x49')],_0x5afc75[_0x47f1('0x4d')]);_0x42c773[_0x47f1('0x4e')]=_[_0x47f1('0x4b')](_0x5afc75[_0x47f1('0x49')],qs[_0x47f1('0x4c')](_0x4a7142['query'][_0x47f1('0x4c')]));_0x42c773[_0x47f1('0x4e')]=_0x42c773[_0x47f1('0x4e')]['length']?_0x42c773[_0x47f1('0x4e')]:_0x5afc75[_0x47f1('0x49')];if(!_0x4a7142[_0x47f1('0x4d')][_0x47f1('0x50')](_0x47f1('0x51'))){_0x42c773['limit']=qs[_0x47f1('0x52')](_0x4a7142[_0x47f1('0x4d')][_0x47f1('0x52')]);_0x42c773['offset']=qs[_0x47f1('0x1d')](_0x4a7142[_0x47f1('0x4d')]['offset']);}_0x42c773[_0x47f1('0x53')]=qs['sort'](_0x4a7142[_0x47f1('0x4d')][_0x47f1('0x54')]);_0x42c773[_0x47f1('0x55')]=qs[_0x47f1('0x4a')](_[_0x47f1('0x56')](_0x4a7142['query'],_0x5afc75['filters']));_0x42c773[_0x47f1('0x55')][_0x47f1('0x6b')]=_0xd1bdf1['id'];if(_0x4a7142[_0x47f1('0x4d')][_0x47f1('0x57')]){_0x42c773['where']=_[_0x47f1('0x58')](_0x42c773[_0x47f1('0x55')],{'$or':_[_0x47f1('0x44')](_0x42c773[_0x47f1('0x4e')],function(_0x3f303a){var _0x33e2b5={};_0x33e2b5[_0x3f303a]={'$like':'%'+_0x4a7142['query']['filter']+'%'};return _0x33e2b5;})});}_0x42c773=_[_0x47f1('0x58')]({},_0x42c773,_0x4a7142[_0x47f1('0x5a')]);return db[_0x47f1('0x70')][_0x47f1('0x5b')]({'where':_0x42c773[_0x47f1('0x55')]})['then'](function(_0x3e0c5d){_0x7b7a00['count']=_0x3e0c5d;if(_0x4a7142[_0x47f1('0x4d')]['includeAll']){_0x42c773['include']=[{'all':!![]}];}return db[_0x47f1('0x70')]['findAll'](_0x42c773);})[_0x47f1('0x21')](function(_0x4c4d11){_0x7b7a00[_0x47f1('0x5f')]=_0x4c4d11;return _0x7b7a00;});}})[_0x47f1('0x21')](respondWithFilteredResult(_0xb338a6,_0x42c773))[_0x47f1('0x19')](handleError(_0xb338a6,null));};exports[_0x47f1('0x72')]=function(_0xff0456,_0x1128b0){return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0xff0456['params']['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x1128b0,null))[_0x47f1('0x21')](function(_0x4e89f0){if(_0x4e89f0){return _0x4e89f0['removeAnswers'](_0xff0456[_0x47f1('0x4d')]['ids']);}})[_0x47f1('0x21')](respondWithStatusCode(_0x1128b0,null))[_0x47f1('0x19')](handleError(_0x1128b0,null));};exports['create']=function(_0xe24d9,_0x33c012){var _0x3eca96={'name':_0xe24d9[_0x47f1('0x65')]['name'],'key':_0xe24d9[_0x47f1('0x65')][_0x47f1('0x73')],'provider':_0xe24d9[_0x47f1('0x65')][_0x47f1('0x66')]===_0x47f1('0x67')?null:_0xe24d9[_0x47f1('0x65')][_0x47f1('0x66')],'email':_0xe24d9['body'][_0x47f1('0x74')],'ListId':_0xe24d9['body']['ListId'],'active':!_[_0x47f1('0x75')](_0xe24d9['body']['active'])?_0xe24d9[_0x47f1('0x65')][_0x47f1('0x76')]:!![],'description':_0xe24d9[_0x47f1('0x65')][_0x47f1('0x77')]||null};var _0x246384=getAuthenticationOptions(_0x3eca96[_0x47f1('0x66')],_0xe24d9[_0x47f1('0x65')]);_0x3eca96[_0x47f1('0x3e')]=_0x246384['Imap'];_0x3eca96[_0x47f1('0x3f')]=_0x246384[_0x47f1('0x3f')];return db['MailAccount'][_0x47f1('0x6c')](_0x3eca96,{'include':[{'model':db[_0x47f1('0x41')],'as':'Smtp'},{'model':db[_0x47f1('0x62')],'as':'Imap'}]})[_0x47f1('0x21')](function(_0x5ac283){var _0x3fe6b1=_0xe24d9['user'][_0x47f1('0x23')]({'plain':!![]});if(!_0x3fe6b1)throw new Error(_0x47f1('0x78'));if(_0x3fe6b1[_0x47f1('0x79')]==='user'){var _0x239cb6=_0x5ac283[_0x47f1('0x23')]({'plain':!![]});return db[_0x47f1('0x7a')][_0x47f1('0x64')]({'where':{'name':_0x47f1('0x24'),'userProfileId':_0x3fe6b1['userProfileId']},'raw':!![]})['then'](function(_0x3bff4c){if(_0x3bff4c&&_0x3bff4c[_0x47f1('0x7b')]===0x0){return db[_0x47f1('0x25')][_0x47f1('0x6c')]({'name':_0x239cb6['name'],'resourceId':_0x239cb6['id'],'type':_0x3bff4c[_0x47f1('0x28')],'sectionId':_0x3bff4c['id']},{})[_0x47f1('0x21')](function(){return _0x5ac283;});}else{return _0x5ac283;}})[_0x47f1('0x19')](function(_0x334151){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x334151);throw _0x334151;});}return _0x5ac283;})[_0x47f1('0x21')](respondWithResult(_0x33c012,0xc9))[_0x47f1('0x19')](handleError(_0x33c012,null));};exports[_0x47f1('0x7c')]=function(_0x27b6ad,_0x1bcb99){return db[_0x47f1('0x45')][_0x47f1('0x71')]({'where':{'id':_0x27b6ad['params']['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x1bcb99,null))[_0x47f1('0x21')](function(_0x3bed3b){if(_0x3bed3b){return _0x3bed3b[_0x47f1('0x7c')]();}return null;})['then'](respondWithResult(_0x1bcb99,null))[_0x47f1('0x19')](handleError(_0x1bcb99,null));};exports[_0x47f1('0x7d')]=function(_0x49b593,_0x249046){if(_0x49b593[_0x47f1('0x65')]['id']){delete _0x49b593['body']['id'];}return db[_0x47f1('0x45')]['find']({'where':{'id':_0x49b593[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x249046,null))[_0x47f1('0x21')](function(_0x560df9){if(_0x560df9){_0x49b593[_0x47f1('0x65')][_0x47f1('0x6b')]=_0x560df9['id'];return db['MailServerIn'][_0x47f1('0x6c')](_0x49b593[_0x47f1('0x65')]);}})[_0x47f1('0x21')](respondWithResult(_0x249046,null))[_0x47f1('0x19')](handleError(_0x249046,null));};exports[_0x47f1('0x7e')]=function(_0x4f7acf,_0x311191){return db['MailAccount'][_0x47f1('0x71')]({'where':{'id':_0x4f7acf[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x311191,null))[_0x47f1('0x21')](function(_0x3d251c){if(_0x3d251c){return _0x3d251c[_0x47f1('0x7f')](null);}return null;})['then'](respondWithStatusCode(_0x311191,null))[_0x47f1('0x19')](handleError(_0x311191,null));};exports[_0x47f1('0x80')]=function(_0xf10ebe,_0x214b0e){return db[_0x47f1('0x45')][_0x47f1('0x71')]({'where':{'id':_0xf10ebe[_0x47f1('0x61')]['id']}})['then'](handleEntityNotFound(_0x214b0e,null))['then'](function(_0x24ccad){if(_0x24ccad){return _0x24ccad[_0x47f1('0x80')]();}return null;})['then'](respondWithResult(_0x214b0e,null))[_0x47f1('0x19')](handleError(_0x214b0e,null));};exports[_0x47f1('0x81')]=function(_0x51b940,_0x492336){if(_0x51b940['body']['id']){delete _0x51b940[_0x47f1('0x65')]['id'];}return db[_0x47f1('0x45')]['find']({'where':{'id':_0x51b940[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x492336,null))[_0x47f1('0x21')](function(_0x1f6efc){if(_0x1f6efc){_0x51b940[_0x47f1('0x65')][_0x47f1('0x6b')]=_0x1f6efc['id'];return db['MailServerOut']['create'](_0x51b940[_0x47f1('0x65')]);}})[_0x47f1('0x21')](respondWithResult(_0x492336,null))[_0x47f1('0x19')](handleError(_0x492336,null));};exports[_0x47f1('0x82')]=function(_0xac3686,_0x267089){return db['MailAccount'][_0x47f1('0x71')]({'where':{'id':_0xac3686[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x267089,null))[_0x47f1('0x21')](function(_0x28dd5d){if(_0x28dd5d){return _0x28dd5d[_0x47f1('0x83')](null);}return null;})[_0x47f1('0x21')](respondWithStatusCode(_0x267089,null))[_0x47f1('0x19')](handleError(_0x267089,null));};exports[_0x47f1('0x84')]=function(_0x499d0f,_0x3e4da8){return db[_0x47f1('0x85')][_0x47f1('0x64')]({'where':{'id':_0x499d0f[_0x47f1('0x61')]['id']}})['then'](handleEntityNotFound(_0x3e4da8,null))[_0x47f1('0x21')](function(_0x5277d4){if(_0x5277d4){return _0x5277d4['addInteraction'](_0x499d0f[_0x47f1('0x65')][_0x47f1('0x86')],_['omit'](_0x499d0f[_0x47f1('0x65')],['ids','id'])||{});}})[_0x47f1('0x21')](respondWithResult(_0x3e4da8,null))[_0x47f1('0x19')](handleError(_0x3e4da8,null));};exports[_0x47f1('0x87')]=function(_0x2cdfae,_0x426a21){var _0x131158={'raw':![],'where':{}};var _0x3a1b06={};var _0x4be35b={'count':0x0,'rows':[]};return db[_0x47f1('0x45')][_0x47f1('0x71')]({'where':{'id':_0x2cdfae['params']['id']}})['then'](handleEntityNotFound(_0x426a21,null))[_0x47f1('0x21')](function(_0x2d9d5b){if(_0x2d9d5b){_0x3a1b06[_0x47f1('0x49')]=_[_0x47f1('0x63')](db[_0x47f1('0x85')][_0x47f1('0x46')]);_0x3a1b06[_0x47f1('0x4d')]=_[_0x47f1('0x63')](_0x2cdfae[_0x47f1('0x4d')]);_0x3a1b06[_0x47f1('0x4a')]=_[_0x47f1('0x4b')](_0x3a1b06[_0x47f1('0x49')],_0x3a1b06[_0x47f1('0x4d')]);_0x131158[_0x47f1('0x4e')]=_[_0x47f1('0x4b')](_0x3a1b06[_0x47f1('0x49')],qs['fields'](_0x2cdfae[_0x47f1('0x4d')][_0x47f1('0x4c')]));_0x131158[_0x47f1('0x4e')]=_0x131158['attributes']['length']?_0x131158['attributes']:_0x3a1b06['model'];if(!_0x2cdfae[_0x47f1('0x4d')]['hasOwnProperty'](_0x47f1('0x51'))){_0x131158[_0x47f1('0x52')]=qs[_0x47f1('0x52')](_0x2cdfae['query']['limit']);_0x131158[_0x47f1('0x1d')]=qs[_0x47f1('0x1d')](_0x2cdfae[_0x47f1('0x4d')]['offset']);}_0x131158[_0x47f1('0x53')]=qs[_0x47f1('0x54')](_0x2cdfae['query'][_0x47f1('0x54')]);_0x131158[_0x47f1('0x55')]=qs['filters'](_[_0x47f1('0x56')](_0x2cdfae[_0x47f1('0x4d')],_0x3a1b06[_0x47f1('0x4a')]));_0x131158['where']['MailAccountId']=_0x2d9d5b['id'];if(_0x2cdfae['query'][_0x47f1('0x57')]){_0x131158['where']=_[_0x47f1('0x58')](_0x131158[_0x47f1('0x55')],{'$or':_['map'](_0x131158[_0x47f1('0x4e')],function(_0x20fb38){var _0x1d08a7={};_0x1d08a7[_0x20fb38]={'$like':'%'+_0x2cdfae[_0x47f1('0x4d')]['filter']+'%'};return _0x1d08a7;})});}_0x131158=_[_0x47f1('0x58')]({},_0x131158,_0x2cdfae[_0x47f1('0x5a')]);return db[_0x47f1('0x85')][_0x47f1('0x5b')]({'where':_0x131158[_0x47f1('0x55')]})['then'](function(_0x4fd603){_0x4be35b[_0x47f1('0x5b')]=_0x4fd603;if(_0x2cdfae['query']['includeAll']){_0x131158['include']=[{'model':db[_0x47f1('0x88')],'as':'Contact','required':![]},{'model':db[_0x47f1('0x89')],'as':'Owner','attributes':[_0x47f1('0x28'),_0x47f1('0x8a'),_0x47f1('0x8b')],'required':![]},{'model':db['Tag'],'as':_0x47f1('0x8c'),'attributes':['id',_0x47f1('0x28'),_0x47f1('0x8d')],'where':_0x2cdfae[_0x47f1('0x4d')][_0x47f1('0x8e')]?{'id':_0x2cdfae[_0x47f1('0x4d')][_0x47f1('0x8e')]}:undefined,'required':_0x2cdfae[_0x47f1('0x4d')][_0x47f1('0x8e')]?!![]:![]}];}return db[_0x47f1('0x85')][_0x47f1('0x5e')](_0x131158);})['then'](function(_0x3b699a){_0x4be35b[_0x47f1('0x5f')]=_0x3b699a;return _0x4be35b;});}})['then'](respondWithFilteredResult(_0x426a21,_0x131158))[_0x47f1('0x19')](handleError(_0x426a21,null));};exports[_0x47f1('0x8f')]=function addApplications(_0x4b81df,_0xcc8c1b){var _0x3aa3ef=_0x4b81df['params']['id'];var _0x43f539=_0x4b81df[_0x47f1('0x65')];var _0x350e8f=0xc8;var _0x22946a=null;return db[_0x47f1('0x90')][_0x47f1('0x91')]({'isolationLevel':db['sequelize'][_0x47f1('0x92')][_0x47f1('0x93')][_0x47f1('0x94')]},function(_0x422780){return db[_0x47f1('0x45')][_0x47f1('0x71')]({'where':{'id':_0x3aa3ef},'transaction':_0x422780})['then'](function(_0x598bb3){if(_0x598bb3){return db[_0x47f1('0x95')][_0x47f1('0x22')]({'where':{'MailAccountId':_0x3aa3ef},'transaction':_0x422780})[_0x47f1('0x21')](function(){var _0x52715e=_[_0x47f1('0x44')](_0x43f539,function(_0x1aec8a){_0x1aec8a[_0x47f1('0x6b')]=_0x3aa3ef;return _0x1aec8a;});return db['MailApplication'][_0x47f1('0x96')](_0x52715e,{'transaction':_0x422780});});}else{_0x350e8f=0x194;_0x22946a=[];}});})[_0x47f1('0x21')](function(){if(_0x350e8f!==0x194){return db[_0x47f1('0x95')]['findAndCountAll']({'where':{'MailAccountId':_0x3aa3ef},'order':_0x47f1('0x97')})[_0x47f1('0x21')](function(_0x5ddd7d){_0x22946a=_0x5ddd7d;});}})['catch'](function(_0x291fdb){_0x350e8f=0x1f4;logger[_0x47f1('0x16')](_0x291fdb[_0x47f1('0x27')]);if(_0x291fdb[_0x47f1('0x28')]){delete _0x291fdb[_0x47f1('0x28')];}_0x22946a=_0x291fdb;})[_0x47f1('0x98')](function(){if(_0x22946a===null){_0xcc8c1b[_0x47f1('0x1a')](_0x350e8f);}else{if(_0x350e8f===0x1f4){_0xcc8c1b[_0x47f1('0x1b')](_0x350e8f)['send'](_0x22946a);}else{_0xcc8c1b['status'](_0x350e8f)[_0x47f1('0x1c')](_0x22946a);}}});};exports[_0x47f1('0x99')]=function(_0x3eb662,_0x1a6605){var _0x24ef40={};var _0x3e7cbb={};var _0x21feef;var _0x3acd43;return db['MailAccount'][_0x47f1('0x71')]({'where':{'id':_0x3eb662[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x1a6605,null))[_0x47f1('0x21')](function(_0x19e98b){if(_0x19e98b){_0x21feef=_0x19e98b;_0x3e7cbb['model']=_[_0x47f1('0x63')](db[_0x47f1('0x95')][_0x47f1('0x46')]);_0x3e7cbb[_0x47f1('0x4d')]=_[_0x47f1('0x63')](_0x3eb662[_0x47f1('0x4d')]);_0x3e7cbb['filters']=_[_0x47f1('0x4b')](_0x3e7cbb[_0x47f1('0x49')],_0x3e7cbb['query']);_0x24ef40['attributes']=_[_0x47f1('0x4b')](_0x3e7cbb[_0x47f1('0x49')],qs['fields'](_0x3eb662[_0x47f1('0x4d')]['fields']));_0x24ef40['attributes']=_0x24ef40[_0x47f1('0x4e')][_0x47f1('0x4f')]?_0x24ef40[_0x47f1('0x4e')]:_0x3e7cbb[_0x47f1('0x49')];_0x24ef40['order']=qs[_0x47f1('0x54')](_0x3eb662['query'][_0x47f1('0x54')]);_0x24ef40[_0x47f1('0x55')]=qs[_0x47f1('0x4a')](_[_0x47f1('0x56')](_0x3eb662[_0x47f1('0x4d')],_0x3e7cbb[_0x47f1('0x4a')]));if(_0x3eb662[_0x47f1('0x4d')][_0x47f1('0x57')]){_0x24ef40[_0x47f1('0x55')]=_[_0x47f1('0x58')](_0x24ef40[_0x47f1('0x55')],{'$or':_['map'](_0x24ef40[_0x47f1('0x4e')],function(_0x2b8438){var _0x287755={};_0x287755[_0x2b8438]={'$like':'%'+_0x3eb662[_0x47f1('0x4d')][_0x47f1('0x57')]+'%'};return _0x287755;})});}_0x24ef40=_[_0x47f1('0x58')]({},_0x24ef40,_0x3eb662[_0x47f1('0x5a')]);return _0x21feef['getApplications'](_0x24ef40);}})[_0x47f1('0x21')](function(_0x18da62){if(_0x18da62){_0x3acd43=_0x18da62['length'];if(!_0x3eb662[_0x47f1('0x4d')][_0x47f1('0x50')](_0x47f1('0x51'))){_0x24ef40['limit']=qs[_0x47f1('0x52')](_0x3eb662['query'][_0x47f1('0x52')]);_0x24ef40[_0x47f1('0x1d')]=qs[_0x47f1('0x1d')](_0x3eb662[_0x47f1('0x4d')][_0x47f1('0x1d')]);}return _0x21feef[_0x47f1('0x99')](_0x24ef40);}})[_0x47f1('0x21')](function(_0x11499d){if(_0x11499d){return _0x11499d?{'count':_0x3acd43,'rows':_0x11499d}:null;}})[_0x47f1('0x21')](respondWithResult(_0x1a6605,null))['catch'](handleError(_0x1a6605,null));};exports[_0x47f1('0x9a')]=function(_0x2bbcec,_0x536957){var _0x448f61={'raw':!![],'where':{}};var _0x36f2df={};var _0x4fd7b7={'count':0x0,'rows':[]};return db[_0x47f1('0x45')][_0x47f1('0x71')]({'where':{'id':_0x2bbcec[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x536957,null))['then'](function(_0x10606a){if(_0x10606a){_0x36f2df[_0x47f1('0x49')]=_['keys'](db['MailMessage']['rawAttributes']);_0x36f2df[_0x47f1('0x4d')]=_[_0x47f1('0x63')](_0x2bbcec['query']);_0x36f2df[_0x47f1('0x4a')]=_[_0x47f1('0x4b')](_0x36f2df['model'],_0x36f2df[_0x47f1('0x4d')]);_0x448f61[_0x47f1('0x4e')]=_[_0x47f1('0x4b')](_0x36f2df[_0x47f1('0x49')],qs[_0x47f1('0x4c')](_0x2bbcec[_0x47f1('0x4d')]['fields']));_0x448f61['attributes']=_0x448f61[_0x47f1('0x4e')]['length']?_0x448f61[_0x47f1('0x4e')]:_0x36f2df[_0x47f1('0x49')];if(!_0x2bbcec[_0x47f1('0x4d')]['hasOwnProperty']('nolimit')){_0x448f61['limit']=qs[_0x47f1('0x52')](_0x2bbcec[_0x47f1('0x4d')]['limit']);_0x448f61[_0x47f1('0x1d')]=qs['offset'](_0x2bbcec[_0x47f1('0x4d')][_0x47f1('0x1d')]);}_0x448f61[_0x47f1('0x53')]=qs[_0x47f1('0x54')](_0x2bbcec[_0x47f1('0x4d')]['sort']);_0x448f61[_0x47f1('0x55')]=qs['filters'](_[_0x47f1('0x56')](_0x2bbcec['query'],_0x36f2df[_0x47f1('0x4a')]));_0x448f61[_0x47f1('0x55')][_0x47f1('0x6b')]=_0x10606a['id'];if(_0x2bbcec[_0x47f1('0x4d')]['filter']){_0x448f61[_0x47f1('0x55')]=_[_0x47f1('0x58')](_0x448f61[_0x47f1('0x55')],{'$or':_[_0x47f1('0x44')](_0x448f61[_0x47f1('0x4e')],function(_0x45bcbc){var _0x14fd82={};_0x14fd82[_0x45bcbc]={'$like':'%'+_0x2bbcec['query'][_0x47f1('0x57')]+'%'};return _0x14fd82;})});}if(_0x2bbcec[_0x47f1('0x4d')]['$gte']){var _0x3e2767=_0x2bbcec[_0x47f1('0x4d')][_0x47f1('0x9b')]['split'](',');var _0x5f055b={};_0x5f055b[_0x3e2767[0x0]]={'$gte':moment(_0x3e2767[0x1])[_0x47f1('0x9c')](_0x47f1('0x9d'))};_0x448f61[_0x47f1('0x55')]=_[_0x47f1('0x58')](_0x448f61['where'],_0x5f055b);}_0x448f61=_[_0x47f1('0x58')]({},_0x448f61,_0x2bbcec[_0x47f1('0x5a')]);return db[_0x47f1('0x9e')][_0x47f1('0x5b')]({'where':_0x448f61[_0x47f1('0x55')]})[_0x47f1('0x21')](function(_0x10a524){_0x4fd7b7[_0x47f1('0x5b')]=_0x10a524;if(_0x2bbcec[_0x47f1('0x4d')]['includeAll']){_0x448f61[_0x47f1('0x5d')]=[{'all':!![]}];}return db['MailMessage'][_0x47f1('0x5e')](_0x448f61);})['then'](function(_0x445602){if(_0x2bbcec[_0x47f1('0x4d')][_0x47f1('0x9f')]==='true'){for(var _0x476416=0x0;_0x476416<_0x445602['length'];_0x476416++){_0x445602[_0x476416][_0x47f1('0x65')]=juice(_0x445602[_0x476416][_0x47f1('0x65')]);}}_0x4fd7b7[_0x47f1('0x5f')]=_0x445602;return _0x4fd7b7;});}})[_0x47f1('0x21')](respondWithFilteredResult(_0x536957,_0x448f61))[_0x47f1('0x19')](handleError(_0x536957,null));};exports[_0x47f1('0xa0')]=function(_0x48b2e5,_0x367d57){var _0x4eab17,_0x1ffdce={},_0x2f32f0;if(_0x48b2e5[_0x47f1('0x65')]['to']){_0x2f32f0=_0x48b2e5[_0x47f1('0x65')]['to'][_0x47f1('0xa1')](',')[0x0];}return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0x48b2e5['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x47f1('0x88')],'as':_0x47f1('0xa2'),'where':{'email':_0x2f32f0},'limit':0x1,'order':[[_0x47f1('0xa3'),_0x47f1('0xa4')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x47f1('0xa5')],'as':'CloudProvider','raw':!![]}]}]})['then'](handleEntityNotFound(_0x367d57,null))[_0x47f1('0x21')](function(_0x3ae501){if(!_0x3ae501)return;_0x4eab17=_0x3ae501;if(!_0x3ae501[_0x47f1('0x3f')])throw new Error(_0x47f1('0xa6'));if(_['isNil'](_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xa7')])){_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xa7')]=util['format']('%s\x20<%s>',_0x3ae501['name'],_0x3ae501[_0x47f1('0x74')]||_0x3ae501['Smtp'][_0x47f1('0x33')]);}if(_0x48b2e5['body'][_0x47f1('0xa8')]&&_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xa8')][_0x47f1('0x4f')]){for(var _0x563056=0x0;_0x563056<_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xa8')][_0x47f1('0x4f')];_0x563056+=0x1){_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xa8')][_0x563056]={'filename':_0x48b2e5['body'][_0x47f1('0xa8')][_0x563056][_0x47f1('0x28')],'path':path[_0x47f1('0xa9')](config['root'],_0x47f1('0xaa'),_0x48b2e5[_0x47f1('0x65')]['attachments'][_0x563056]['basename'])};}}var _0x19a1d0=_0x3ae501[_0x47f1('0xab')]();return respondWithRpcPromise(_0x47f1('0xac'),_0x47f1('0xad'),{'account':_0x19a1d0,'message':_0x48b2e5[_0x47f1('0x65')]});})[_0x47f1('0x21')](function(_0x3896b9){if(!_0x3896b9)return;_0x1ffdce=_0x3896b9;if(!_0x4eab17['List'])throw new Error(_0x47f1('0xae'));if(_0x4eab17[_0x47f1('0xaf')][_0x47f1('0xa2')][_0x47f1('0x4f')])return _0x4eab17[_0x47f1('0xaf')]['Contacts'][0x0];return db[_0x47f1('0x88')][_0x47f1('0x6c')](_[_0x47f1('0xb')](_0x48b2e5[_0x47f1('0x65')],{'firstName':_0x48b2e5[_0x47f1('0x65')]['to'],'email':_0x48b2e5[_0x47f1('0x65')]['to'],'phone':_0x48b2e5[_0x47f1('0x65')]['to'],'ListId':_0x4eab17[_0x47f1('0xb0')]}));})['then'](function(_0x522340){if(!_0x522340)return;var _0x1e2413={'UserId':_0x48b2e5[_0x47f1('0x33')]['id'],'ContactId':_0x522340['id'],'MailAccountId':_0x4eab17['id'],'inReplyTo':_0x1ffdce[_0x47f1('0xb1')],'to':_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xa7')],'cc':_0x48b2e5[_0x47f1('0x65')]['cc'],'subject':_0x48b2e5[_0x47f1('0x65')]['subject'],'attach':_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xb2')],'firstMsgDirection':_0x47f1('0xb3'),'lastMsgAt':moment()['format'](_0x47f1('0x9d')),'lastMsgDirection':_0x47f1('0xb3'),'Messages':[_[_0x47f1('0x58')](_0x48b2e5[_0x47f1('0x65')],{'messageId':_0x1ffdce[_0x47f1('0xb1')],'sentAt':moment()[_0x47f1('0x9c')](_0x47f1('0x9d')),'read':!![],'MailAccountId':_0x4eab17['id'],'UserId':_0x48b2e5['user']['id'],'ContactId':_0x522340['id']})]};if(_0x48b2e5[_0x47f1('0x65')]['Interaction']){_0x1e2413=_['merge'](_0x1e2413,_0x48b2e5[_0x47f1('0x65')][_0x47f1('0xb4')]);}return db[_0x47f1('0x85')][_0x47f1('0x6c')](_0x1e2413,{'include':[{'model':db['MailMessage'],'as':_0x47f1('0xb5')}]});})[_0x47f1('0x21')](respondWithResult(_0x367d57,null))[_0x47f1('0x19')](handleError(_0x367d57,null));};exports['verifySmtp']=function(_0x333dfc,_0x148a57){return db[_0x47f1('0x45')]['find']({'where':{'id':_0x333dfc[_0x47f1('0x61')]['id']},'include':[{'model':db['MailServerOut'],'as':_0x47f1('0x3f'),'raw':!![],'include':[{'model':db[_0x47f1('0xa5')],'as':_0x47f1('0xa5'),'raw':!![]}]}]})[_0x47f1('0x21')](handleEntityNotFound(_0x148a57,null))['then'](function(_0x4a58c7){if(!_0x4a58c7[_0x47f1('0x3f')])return;var _0x23b9af=_0x4a58c7[_0x47f1('0xab')]();return respondWithRpcPromise(_0x47f1('0xb6'),'verifySmtp',{'account':_0x23b9af});})[_0x47f1('0x21')](respondWithResult(_0x148a57,null))['catch'](handleError(_0x148a57,null));};exports[_0x47f1('0x22')]=function(_0xd6fba0,_0xf5425b){return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0xd6fba0[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0xf5425b,null))['then'](function(_0x46de77){if(_0x46de77&&_0x46de77[_0x47f1('0x3a')]){throw new db[(_0x47f1('0xb7'))][(_0x47f1('0xb8'))](_0x47f1('0xb9'));}return _0x46de77;})[_0x47f1('0x21')](removeEntity(_0xf5425b,null))['catch'](handleError(_0xf5425b,null));};exports[_0x47f1('0xba')]=function(_0x398c95,_0x579692){return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0x398c95[_0x47f1('0x61')]['id']}})[_0x47f1('0x21')](handleEntityNotFound(_0x579692,null))[_0x47f1('0x21')](function(_0x3d8ebc){if(_0x3d8ebc){return _0x3d8ebc[_0x47f1('0xba')](_0x398c95[_0x47f1('0x65')]['ids'],_[_0x47f1('0xbb')](_0x398c95[_0x47f1('0x65')],['ids','id'])||{})[_0x47f1('0xbc')](function(_0x2d57af){for(var _0x149cd8=0x0;_0x149cd8<_0x398c95[_0x47f1('0x65')][_0x47f1('0x86')][_0x47f1('0x4f')];_0x149cd8+=0x1){socket[_0x47f1('0xbd')](_0x47f1('0xbe'),{'UserId':Number(_0x398c95[_0x47f1('0x65')][_0x47f1('0x86')][_0x149cd8]),'MailAccountId':Number(_0x398c95[_0x47f1('0x61')]['id'])});}return _0x2d57af;});}})[_0x47f1('0x21')](respondWithResult(_0x579692,null))['catch'](handleError(_0x579692,null));};exports[_0x47f1('0xbf')]=function(_0x16e1ed,_0x542bf7){return db[_0x47f1('0x45')][_0x47f1('0x64')]({'where':{'id':_0x16e1ed[_0x47f1('0x61')]['id']}})['then'](handleEntityNotFound(_0x542bf7,null))[_0x47f1('0x21')](function(_0x530aba){if(_0x530aba){return _0x530aba['removeAgents'](_0x16e1ed[_0x47f1('0x4d')]['ids'])['then'](function(){if(_['isArray'](_0x16e1ed[_0x47f1('0x4d')]['ids'])){for(var _0x4e68aa=0x0;_0x4e68aa<_0x16e1ed[_0x47f1('0x4d')][_0x47f1('0x86')]['length'];_0x4e68aa+=0x1){socket[_0x47f1('0xbd')](_0x47f1('0xc0'),{'UserId':Number(_0x16e1ed[_0x47f1('0x4d')][_0x47f1('0x86')][_0x4e68aa]),'MailAccountId':Number(_0x16e1ed[_0x47f1('0x61')]['id'])});}}else{socket[_0x47f1('0xbd')]('userMailAccount:remove',{'UserId':Number(_0x16e1ed[_0x47f1('0x4d')][_0x47f1('0x86')]),'MailAccountId':Number(_0x16e1ed['params']['id'])});}});}})[_0x47f1('0x21')](respondWithStatusCode(_0x542bf7,null))[_0x47f1('0x19')](handleError(_0x542bf7,null));};exports[_0x47f1('0xc1')]=function(_0x4c3b3d,_0x550f34){var _0x5ce2fb={};var _0x28bf9a={};var _0x1bb494;var _0x641e91;return db['MailAccount'][_0x47f1('0x71')]({'where':{'id':_0x4c3b3d[_0x47f1('0x61')]['id']}})['then'](handleEntityNotFound(_0x550f34,null))[_0x47f1('0x21')](function(_0x29f8ff){if(_0x29f8ff){_0x1bb494=_0x29f8ff;_0x28bf9a['model']=_[_0x47f1('0x63')](db['User']['rawAttributes']);_0x28bf9a[_0x47f1('0x4d')]=_['keys'](_0x4c3b3d['query']);_0x28bf9a[_0x47f1('0x4a')]=_['intersection'](_0x28bf9a['model'],_0x28bf9a[_0x47f1('0x4d')]);_0x5ce2fb[_0x47f1('0x4e')]=_[_0x47f1('0x4b')](_0x28bf9a[_0x47f1('0x49')],qs['fields'](_0x4c3b3d[_0x47f1('0x4d')]['fields']));_0x5ce2fb['attributes']=_0x5ce2fb[_0x47f1('0x4e')]['length']?_0x5ce2fb[_0x47f1('0x4e')]:_0x28bf9a[_0x47f1('0x49')];_0x5ce2fb[_0x47f1('0x53')]=qs[_0x47f1('0x54')](_0x4c3b3d[_0x47f1('0x4d')]['sort']);_0x5ce2fb[_0x47f1('0x55')]=qs[_0x47f1('0x4a')](_['pick'](_0x4c3b3d['query'],_0x28bf9a[_0x47f1('0x4a')]));if(_0x4c3b3d['query']['filter']){_0x5ce2fb['where']=_[_0x47f1('0x58')](_0x5ce2fb[_0x47f1('0x55')],{'$or':_[_0x47f1('0x44')](_0x5ce2fb[_0x47f1('0x4e')],function(_0x560845){var _0x16c10e={};_0x16c10e[_0x560845]={'$like':'%'+_0x4c3b3d[_0x47f1('0x4d')][_0x47f1('0x57')]+'%'};return _0x16c10e;})});}_0x5ce2fb=_['merge']({},_0x5ce2fb,_0x4c3b3d[_0x47f1('0x5a')]);return _0x1bb494[_0x47f1('0xc1')](_0x5ce2fb);}})[_0x47f1('0x21')](function(_0x2a9712){if(_0x2a9712){_0x641e91=_0x2a9712['length'];if(!_0x4c3b3d[_0x47f1('0x4d')][_0x47f1('0x50')](_0x47f1('0x51'))){_0x5ce2fb[_0x47f1('0x52')]=qs[_0x47f1('0x52')](_0x4c3b3d[_0x47f1('0x4d')]['limit']);_0x5ce2fb['offset']=qs['offset'](_0x4c3b3d[_0x47f1('0x4d')]['offset']);}return _0x1bb494[_0x47f1('0xc1')](_0x5ce2fb);}})['then'](function(_0x32aea4){if(_0x32aea4){return _0x32aea4?{'count':_0x641e91,'rows':_0x32aea4}:null;}})[_0x47f1('0x21')](respondWithResult(_0x550f34,null))[_0x47f1('0x19')](handleError(_0x550f34,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index fec8fde..9a5b849 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 _0x1a54=['save','update','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x47d804,_0x5cc88f){var _0x284c47=function(_0x271c22){while(--_0x271c22){_0x47d804['push'](_0x47d804['shift']());}};_0x284c47(++_0x5cc88f);}(_0x1a54,0x12e));var _0x41a5=function(_0x39e338,_0x1cd155){_0x39e338=_0x39e338-0x0;var _0x5da81f=_0x1a54[_0x39e338];return _0x5da81f;};'use strict';var EventEmitter=require(_0x41a5('0x0'));var MailAccount=require('../../mysqldb')['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x41a5('0x1')](0x0);var events={'afterCreate':_0x41a5('0x2'),'afterUpdate':_0x41a5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x217f68){return function(_0x3ba60a,_0x39fe63,_0x3b3d6e){MailAccountEvents[_0x41a5('0x4')](_0x217f68+':'+_0x3ba60a['id'],_0x3ba60a);MailAccountEvents['emit'](_0x217f68,_0x3ba60a);_0x3b3d6e(null);};}for(var e in events){if(events[_0x41a5('0x5')](e)){var event=events[e];MailAccount[_0x41a5('0x6')](e,emitEvent(event));}}module[_0x41a5('0x7')]=MailAccountEvents; \ No newline at end of file +var _0x3914=['emit','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','remove'];(function(_0x55afc6,_0x58ad8c){var _0x2758d3=function(_0x4b8f14){while(--_0x4b8f14){_0x55afc6['push'](_0x55afc6['shift']());}};_0x2758d3(++_0x58ad8c);}(_0x3914,0xeb));var _0x4391=function(_0x3e478c,_0x152670){_0x3e478c=_0x3e478c-0x0;var _0x29ef89=_0x3914[_0x3e478c];return _0x29ef89;};'use strict';var EventEmitter=require(_0x4391('0x0'));var MailAccount=require(_0x4391('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x4391('0x2')](0x0);var events={'afterCreate':_0x4391('0x3'),'afterUpdate':'update','afterDestroy':_0x4391('0x4')};function emitEvent(_0x343fb7){return function(_0x175dbc,_0x5b5acb,_0x1eecd4){MailAccountEvents[_0x4391('0x5')](_0x343fb7+':'+_0x175dbc['id'],_0x175dbc);MailAccountEvents['emit'](_0x343fb7,_0x175dbc);_0x1eecd4(null);};}for(var e in events){if(events[_0x4391('0x6')](e)){var event=events[e];MailAccount['hook'](e,emitEvent(event));}}module[_0x4391('0x7')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index c66d2cd..16b025d 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 _0xf556=['modernAuthentication','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','CloudProvider','data5','pass','exports','mail_accounts','provider','custom','service','host','Smtp','port','secure'];(function(_0x4a26e7,_0x232272){var _0x13c81b=function(_0x15c69f){while(--_0x15c69f){_0x4a26e7['push'](_0x4a26e7['shift']());}};_0x13c81b(++_0x232272);}(_0xf556,0xc3));var _0x6f55=function(_0x4c82af,_0x362c51){_0x4c82af=_0x4c82af-0x0;var _0x21d4ec=_0xf556[_0x4c82af];return _0x21d4ec;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x6f55('0x0')]=function(_0x1a16fb){return _0x1a16fb['define']('MailAccount',attributes,{'tableName':_0x6f55('0x1'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x97cad1=this;var _0x74740a={'id':_0x97cad1['id'],'tls':{'rejectUnauthorized':![]}};if(_0x97cad1[_0x6f55('0x2')]!==_0x6f55('0x3')){_0x74740a[_0x6f55('0x4')]=_0x97cad1[_0x6f55('0x2')];}else{_0x74740a[_0x6f55('0x5')]=_0x97cad1[_0x6f55('0x6')][_0x6f55('0x5')];_0x74740a['port']=_0x97cad1['Smtp'][_0x6f55('0x7')];_0x74740a[_0x6f55('0x8')]=_0x97cad1['Smtp'][_0x6f55('0x8')];}if(_0x97cad1[_0x6f55('0x6')]['authentication']){if(_0x97cad1['Smtp'][_0x6f55('0x9')]){if(!_0x97cad1[_0x6f55('0x6')]['CloudProvider'])throw new Error(_0x6f55('0xa'));_0x74740a[_0x6f55('0xb')]={'type':_0x6f55('0xc'),'user':_0x97cad1['Smtp'][_0x6f55('0xd')],'accessToken':_0x97cad1['Smtp'][_0x6f55('0xe')][_0x6f55('0xf')]};}else{_0x74740a[_0x6f55('0xb')]={'user':_0x97cad1[_0x6f55('0x6')][_0x6f55('0xd')],'pass':_0x97cad1[_0x6f55('0x6')][_0x6f55('0x10')]};}}return _0x74740a;}}});}; \ No newline at end of file +var _0x1bd3=['./mailAccount.attributes','exports','define','mail_accounts','provider','Smtp','host','port','secure','modernAuthentication','auth','user','CloudProvider','pass'];(function(_0x3ce937,_0x24bd88){var _0x3e6188=function(_0x45d2a9){while(--_0x45d2a9){_0x3ce937['push'](_0x3ce937['shift']());}};_0x3e6188(++_0x24bd88);}(_0x1bd3,0x1c0));var _0x31bd=function(_0x5e2db0,_0x5e9ffd){_0x5e2db0=_0x5e2db0-0x0;var _0x320e13=_0x1bd3[_0x5e2db0];return _0x320e13;};'use strict';var attributes=require(_0x31bd('0x0'));module[_0x31bd('0x1')]=function(_0x42fc37){return _0x42fc37[_0x31bd('0x2')]('MailAccount',attributes,{'tableName':_0x31bd('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0xe77116=this;var _0x41bb91={'id':_0xe77116['id'],'tls':{'rejectUnauthorized':![]}};if(_0xe77116['provider']!=='custom'){_0x41bb91['service']=_0xe77116[_0x31bd('0x4')];}else{_0x41bb91['host']=_0xe77116[_0x31bd('0x5')][_0x31bd('0x6')];_0x41bb91[_0x31bd('0x7')]=_0xe77116[_0x31bd('0x5')][_0x31bd('0x7')];_0x41bb91[_0x31bd('0x8')]=_0xe77116[_0x31bd('0x5')][_0x31bd('0x8')];}if(_0xe77116[_0x31bd('0x5')]['authentication']){if(_0xe77116[_0x31bd('0x5')][_0x31bd('0x9')]){if(!_0xe77116[_0x31bd('0x5')]['CloudProvider'])throw new Error('Cloud\x20Provider\x20configuration\x20not\x20found');_0x41bb91[_0x31bd('0xa')]={'type':'OAuth2','user':_0xe77116[_0x31bd('0x5')][_0x31bd('0xb')],'accessToken':_0xe77116['Smtp'][_0x31bd('0xc')]['data5']};}else{_0x41bb91[_0x31bd('0xa')]={'user':_0xe77116[_0x31bd('0x5')][_0x31bd('0xb')],'pass':_0xe77116[_0x31bd('0x5')][_0x31bd('0xd')]};}}return _0x41bb91;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index 5d2e64d..c863df7 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 _0xf987=['autoclose','push','length','close','*,*,*,*','List\x20not\x20found','contact','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','messageId','inReplyTo','create','Contact\x20not\x20found','update','attach','interaction','created','attachments','originTo','originCc','bcc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','queueId','MailQueue','queue','waitForTheAssignedQueue','Start','startRouting','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','MailAccount','findAll','options','raw','where','attributes','limit','include','model','map','then','GetMailAccount','debug','catch','ShowMailAccount','find','smtp','setDataValue','smtpOptions','getSmtpOptions','difference','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','body','from\x20is\x20mandatory','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','from','account','CmList','List','Contacts','DESC','MailApplication','Applications','Smtp','CloudProvider','get','omit','list','applications','orderBy','priority','asc'];(function(_0x438ddc,_0x3fc4ac){var _0x1483e7=function(_0x38f90a){while(--_0x38f90a){_0x438ddc['push'](_0x438ddc['shift']());}};_0x1483e7(++_0x3fc4ac);}(_0xf987,0x18a));var _0x7f98=function(_0x2798d7,_0x1bd381){_0x2798d7=_0x2798d7-0x0;var _0x129d8f=_0xf987[_0x2798d7];return _0x129d8f;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0x7f98('0x0'));var rs=require(_0x7f98('0x1'));var Redis=require('ioredis');var db=require(_0x7f98('0x2'))['db'];var logger=require(_0x7f98('0x3'))(_0x7f98('0x4'));var config=require(_0x7f98('0x5'));var jayson=require(_0x7f98('0x6'));var client=jayson[_0x7f98('0x7')][_0x7f98('0x8')]({'port':0x232c});config[_0x7f98('0x9')]=_[_0x7f98('0xa')](config[_0x7f98('0x9')],{'host':_0x7f98('0xb'),'port':0x18eb});var socket=require(_0x7f98('0xc'))(new Redis(config['redis']));require(_0x7f98('0xd'))[_0x7f98('0xe')](socket);function respondWithRpcPromise(_0x229951,_0xc579d0,_0x3c21a1){return new BPromise(function(_0x5c6389,_0x256256){return client['request'](_0x229951,_0x3c21a1)['then'](function(_0x2b425d){logger[_0x7f98('0xf')](_0x7f98('0x10'),_0xc579d0,_0x7f98('0x11'));logger['debug'](_0x7f98('0x12'),_0xc579d0,'request\x20sent',JSON[_0x7f98('0x13')](_0x2b425d));if(_0x2b425d[_0x7f98('0x14')]){if(_0x2b425d[_0x7f98('0x14')][_0x7f98('0x15')]===0x1f4){logger[_0x7f98('0x14')](_0x7f98('0x10'),_0xc579d0,_0x2b425d[_0x7f98('0x14')][_0x7f98('0x16')]);return _0x256256(_0x2b425d[_0x7f98('0x14')][_0x7f98('0x16')]);}logger[_0x7f98('0x14')](_0x7f98('0x10'),_0xc579d0,_0x2b425d['error'][_0x7f98('0x16')]);return _0x5c6389(_0x2b425d['error']['message']);}else{logger[_0x7f98('0xf')](_0x7f98('0x10'),_0xc579d0,'request\x20sent');_0x5c6389(_0x2b425d['result']['message']);}})['catch'](function(_0x111385){logger[_0x7f98('0x14')]('MailAccount,\x20%s,\x20%s',_0xc579d0,_0x111385);_0x256256(_0x111385);});});}exports['GetMailAccount']=function(_0x4f3ac0){var _0x364377=this;return new Promise(function(_0x5e45a2,_0xe3e55a){return db[_0x7f98('0x17')][_0x7f98('0x18')]({'raw':_0x4f3ac0[_0x7f98('0x19')]?_0x4f3ac0[_0x7f98('0x19')][_0x7f98('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f3ac0[_0x7f98('0x19')]?_0x4f3ac0[_0x7f98('0x19')][_0x7f98('0x1b')]||null:null,'attributes':_0x4f3ac0['options']?_0x4f3ac0['options'][_0x7f98('0x1c')]||null:null,'limit':_0x4f3ac0['options']?_0x4f3ac0[_0x7f98('0x19')][_0x7f98('0x1d')]||null:null,'include':_0x4f3ac0['options']?_0x4f3ac0[_0x7f98('0x19')][_0x7f98('0x1e')]?_['map'](_0x4f3ac0[_0x7f98('0x19')][_0x7f98('0x1e')],function(_0x1d6bdb){return{'model':db[_0x1d6bdb[_0x7f98('0x1f')]],'as':_0x1d6bdb['as'],'attributes':_0x1d6bdb[_0x7f98('0x1c')],'include':_0x1d6bdb[_0x7f98('0x1e')]?_[_0x7f98('0x20')](_0x1d6bdb[_0x7f98('0x1e')],function(_0x1d086f){return{'model':db[_0x1d086f[_0x7f98('0x1f')]],'as':_0x1d086f['as'],'attributes':_0x1d086f[_0x7f98('0x1c')],'include':_0x1d086f[_0x7f98('0x1e')]?_[_0x7f98('0x20')](_0x1d086f['include'],function(_0x4c9809){return{'model':db[_0x4c9809[_0x7f98('0x1f')]],'as':_0x4c9809['as'],'attributes':_0x4c9809[_0x7f98('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7f98('0x21')](function(_0x1dd8d5){logger[_0x7f98('0xf')](_0x7f98('0x22'),_0x4f3ac0);logger[_0x7f98('0x23')](_0x7f98('0x22'),_0x4f3ac0,JSON[_0x7f98('0x13')](_0x1dd8d5));_0x5e45a2(_0x1dd8d5);})[_0x7f98('0x24')](function(_0x544bae){logger[_0x7f98('0x14')](_0x7f98('0x22'),_0x544bae['message'],_0x4f3ac0);_0xe3e55a(_0x364377[_0x7f98('0x14')](0x1f4,_0x544bae[_0x7f98('0x16')]));});});};exports[_0x7f98('0x25')]=function(_0x4e86fd){var _0x23acb7=this;return new Promise(function(_0x5182d9,_0x400ff3){return db['MailAccount'][_0x7f98('0x26')]({'raw':_0x4e86fd[_0x7f98('0x19')]?_0x4e86fd[_0x7f98('0x19')][_0x7f98('0x1a')]===undefined?!![]:![]:!![],'where':_0x4e86fd[_0x7f98('0x19')]?_0x4e86fd[_0x7f98('0x19')][_0x7f98('0x1b')]||null:null,'attributes':_0x4e86fd['options']?_0x4e86fd['options'][_0x7f98('0x1c')]||null:null,'include':_0x4e86fd[_0x7f98('0x19')]?_0x4e86fd[_0x7f98('0x19')][_0x7f98('0x1e')]?_[_0x7f98('0x20')](_0x4e86fd[_0x7f98('0x19')][_0x7f98('0x1e')],function(_0x51a15d){return{'model':db[_0x51a15d['model']],'as':_0x51a15d['as'],'attributes':_0x51a15d[_0x7f98('0x1c')],'include':_0x51a15d['include']?_[_0x7f98('0x20')](_0x51a15d['include'],function(_0x376dd3){return{'model':db[_0x376dd3[_0x7f98('0x1f')]],'as':_0x376dd3['as'],'attributes':_0x376dd3[_0x7f98('0x1c')],'include':_0x376dd3[_0x7f98('0x1e')]?_[_0x7f98('0x20')](_0x376dd3[_0x7f98('0x1e')],function(_0x172d5){return{'model':db[_0x172d5[_0x7f98('0x1f')]],'as':_0x172d5['as'],'attributes':_0x172d5[_0x7f98('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7f98('0x21')](function(_0x1595d0){if(_0x4e86fd[_0x7f98('0x19')][_0x7f98('0x27')]===!![])_0x1595d0[_0x7f98('0x28')](_0x7f98('0x29'),_0x1595d0[_0x7f98('0x2a')]());logger[_0x7f98('0xf')](_0x7f98('0x25'),_0x4e86fd);logger[_0x7f98('0x23')](_0x7f98('0x25'),_0x4e86fd,JSON[_0x7f98('0x13')](_0x1595d0));_0x5182d9(_0x1595d0);})[_0x7f98('0x24')](function(_0x3f7f50){logger['error'](_0x7f98('0x25'),_0x3f7f50[_0x7f98('0x16')],_0x4e86fd);_0x400ff3(_0x23acb7[_0x7f98('0x14')](0x1f4,_0x3f7f50[_0x7f98('0x16')]));});});};exports['NotifyMailAccount']=function(_0x55c9a0){var _0x1fdeeb=this;return new Promise(function(_0x24bbdc,_0x491cba){var _0x7d4998={'body':_0x55c9a0['body'],'channel':'mail'};var _0x4e4e35=_[_0x7f98('0x2b')](_['keys'](db[_0x7f98('0x2c')]['rawAttributes']),[_0x7f98('0x2d'),_0x7f98('0x2e'),_0x7f98('0x2f'),_0x7f98('0x30')]);var _0x48ede9=![];if(_0x55c9a0['body']['id']){delete _0x55c9a0['body']['id'];}if(_[_0x7f98('0x31')](_0x55c9a0[_0x7f98('0x32')]['from'])){return _0x491cba(_0x1fdeeb['error'](0x1f4,_0x7f98('0x33')));}if(_[_0x7f98('0x31')](_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x32')])||_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x32')]===''){return _0x491cba(_0x1fdeeb['error'](0x1f4,_0x7f98('0x34')));}if(_[_0x7f98('0x31')](_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x35')])){return _0x491cba(_0x1fdeeb[_0x7f98('0x14')](0x1f4,_0x7f98('0x36')+_0x4e4e35));}if(!_[_0x7f98('0x37')](_0x4e4e35,_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x35')])){return _0x491cba(_0x1fdeeb[_0x7f98('0x14')](0x1f4,_0x7f98('0x38')+_0x4e4e35));}var _0x3b3210={};_0x3b3210[_0x55c9a0['body']['mapKey']]=_0x55c9a0['body'][_0x7f98('0x39')];return db[_0x7f98('0x17')]['find']({'where':{'id':_0x55c9a0[_0x7f98('0x3a')]['id']},'include':[{'model':db[_0x7f98('0x3b')],'as':_0x7f98('0x3c'),'include':[{'model':db[_0x7f98('0x2c')],'as':_0x7f98('0x3d'),'where':_0x3b3210,'limit':0x1,'order':[[_0x7f98('0x2e'),_0x7f98('0x3e')]]}]},{'model':db[_0x7f98('0x3f')],'as':_0x7f98('0x40')},{'model':db['MailServerOut'],'as':_0x7f98('0x41'),'include':[{'model':db[_0x7f98('0x42')],'as':_0x7f98('0x42')}]}]})[_0x7f98('0x21')](function(_0x3396a7){if(_0x3396a7&&_0x3396a7['List']){var _0x414b85=_0x3396a7[_0x7f98('0x43')]({'plain':!![]});_0x7d4998['account']=_[_0x7f98('0x44')](_0x414b85,[_0x7f98('0x40'),_0x7f98('0x3c')]);_0x7d4998[_0x7f98('0x3a')]['smtpOptions']=_0x3396a7[_0x7f98('0x2a')]();_0x7d4998['applications']=_0x414b85['Applications'];_0x7d4998[_0x7f98('0x45')]=_0x414b85[_0x7f98('0x3c')];_0x7d4998[_0x7f98('0x46')]=_[_0x7f98('0x47')](_0x7d4998[_0x7f98('0x46')],[_0x7f98('0x48')],[_0x7f98('0x49')]);if(_0x7d4998[_0x7f98('0x3a')]&&_0x7d4998[_0x7f98('0x3a')][_0x7f98('0x4a')]){_0x7d4998['applications'][_0x7f98('0x4b')]({'id':0x0,'priority':_0x7d4998[_0x7f98('0x46')][_0x7f98('0x4c')]+0x1,'app':_0x7f98('0x4d'),'appdata':_0x7f98('0x4a'),'interval':_0x7f98('0x4e')});}if(_0x7d4998[_0x7f98('0x3a')][_0x7f98('0x40')]){delete _0x7d4998[_0x7f98('0x3a')][_0x7f98('0x40')];}if(_0x7d4998[_0x7f98('0x3a')]['List']){delete _0x7d4998[_0x7f98('0x3a')][_0x7f98('0x3c')];}if(_0x414b85[_0x7f98('0x3c')]['Contacts']['length']){return _0x414b85['List']['Contacts'][0x0];}var _0x53a94d=_[_0x7f98('0xa')](_0x55c9a0[_0x7f98('0x32')],{'firstName':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x39')],'ListId':_0x414b85['ListId']});_0x53a94d[_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x35')]]=_0x55c9a0['body'][_0x7f98('0x39')];return db[_0x7f98('0x2c')]['create'](_0x53a94d);}else{throw new Error(_0x7f98('0x4f'));}})[_0x7f98('0x21')](function(_0x273de9){_0x7d4998[_0x7f98('0x50')]=_0x273de9;if(_0x273de9){if(!_0x55c9a0[_0x7f98('0x32')]['message']['messageId']){_0x55c9a0[_0x7f98('0x32')]['message']['messageId']=rs[_0x7f98('0x51')]()+'\x20'+_0x55c9a0[_0x7f98('0x32')]['message']['from'];}var _0x560d18={'ContactId':_0x273de9['id'],'MailAccountId':_0x55c9a0['account']['id'],'inReplyTo':_0x55c9a0['body'][_0x7f98('0x16')]['messageId'],'to':_0x55c9a0['body'][_0x7f98('0x16')][_0x7f98('0x39')],'cc':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')]['cc'],'subject':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x52')],'attach':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')]['attach'],'lastMsgAt':moment()[_0x7f98('0x53')](_0x7f98('0x54')),'lastMsgDirection':'in'};return db[_0x7f98('0x55')]['find']({'where':{'closed':![],'MailAccountId':_0x55c9a0[_0x7f98('0x3a')]['id']},'include':[{'model':db[_0x7f98('0x56')],'as':_0x7f98('0x57'),'attributes':[_0x7f98('0x58')],'where':{'messageId':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x59')]}}]})[_0x7f98('0x21')](function(_0x46fb9b){if(_0x46fb9b){return[_0x46fb9b,![]];}return db[_0x7f98('0x55')][_0x7f98('0x5a')](_0x560d18)[_0x7f98('0x21')](function(_0x3cb03a){return[_0x3cb03a,!![]];});});}else{throw new Error(_0x7f98('0x5b'));}})['spread'](function(_0x2e4f7e,_0x297508){if(_0x2e4f7e){_0x48ede9=_0x297508;if(!_0x297508){return _0x2e4f7e[_0x7f98('0x5c')]({'inReplyTo':_0x55c9a0['body']['message'][_0x7f98('0x58')],'to':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x39')],'cc':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')]['cc'],'subject':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')]['subject'],'attach':_0x2e4f7e[_0x7f98('0x5d')]?_0x2e4f7e[_0x7f98('0x5d')]:_0x55c9a0[_0x7f98('0x32')]['message'][_0x7f98('0x5d')],'substatus':null,'substatusAt':moment()[_0x7f98('0x53')](_0x7f98('0x54')),'lastMsgAt':moment()['format'](_0x7f98('0x54')),'lastMsgDirection':'in'});}else{return _0x2e4f7e;}}})[_0x7f98('0x21')](function(_0x2f155b){_0x7d4998[_0x7f98('0x5e')]=_0x2f155b[_0x7f98('0x43')]({'plain':!![]});_0x7d4998[_0x7f98('0x5e')][_0x7f98('0x5f')]=_0x48ede9;return db['MailMessage'][_0x7f98('0x5a')]({'body':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x32')],'MailAccountId':_0x55c9a0[_0x7f98('0x3a')]['id'],'MailInteractionId':_0x2f155b['id'],'direction':'in','ContactId':_0x7d4998[_0x7f98('0x50')]['id'],'messageId':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x58')],'from':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')]['from'],'to':_0x55c9a0[_0x7f98('0x32')]['message']['to'],'cc':_0x55c9a0[_0x7f98('0x32')]['message']['cc'],'subject':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')]['subject'],'attach':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')]['attach'],'Attachments':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x60')],'originTo':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x61')],'originCc':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x62')],'bcc':_0x55c9a0['body'][_0x7f98('0x16')][_0x7f98('0x63')],'ChatWebsiteId':_0x55c9a0['body'][_0x7f98('0x16')][_0x7f98('0x64')]||null,'originChannel':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x65')]||_0x7f98('0x66'),'ChatOfflineMessageId':_0x55c9a0[_0x7f98('0x32')][_0x7f98('0x16')][_0x7f98('0x67')]||null},{'include':[{'model':db[_0x7f98('0x68')],'as':'Attachments'}]});})[_0x7f98('0x21')](function(_0x240f5a){_0x7d4998['message']=_0x240f5a;if(!_0x7d4998[_0x7f98('0x5e')][_0x7f98('0x69')]){return;}return db[_0x7f98('0x6a')][_0x7f98('0x26')]({'attributes':['id',_0x7f98('0x6b')],'where':{'id':_0x7d4998[_0x7f98('0x5e')][_0x7f98('0x69')]}});})[_0x7f98('0x21')](function(_0x2c9f0a){if(_0x2c9f0a){_0x7d4998[_0x7f98('0x46')][_0x7f98('0x6c')]({'id':0x0,'priority':0x0,'app':_0x7f98('0x6d'),'appdata':_0x2c9f0a[_0x7f98('0x6b')]+','+(_0x7d4998['account'][_0x7f98('0x6e')]||0xa),'interval':_0x7f98('0x4e')});}if(!_0x7d4998[_0x7f98('0x5e')][_0x7f98('0x6f')]){return;}return db[_0x7f98('0x70')]['find']({'attributes':['id','name'],'where':{'id':_0x7d4998[_0x7f98('0x5e')][_0x7f98('0x6f')]}});})[_0x7f98('0x21')](function(_0x35c7ab){if(_0x35c7ab){_0x7d4998[_0x7f98('0x46')][_0x7f98('0x6c')]({'id':0x0,'priority':0x1,'app':_0x7f98('0x71'),'appdata':_0x35c7ab[_0x7f98('0x6b')]+','+(_0x7d4998[_0x7f98('0x3a')][_0x7f98('0x72')]||0x12c),'interval':_0x7f98('0x4e')});}return respondWithRpcPromise(_0x7f98('0x73'),_0x7f98('0x74'),_0x7d4998);})[_0x7f98('0x21')](function(_0x535373){_0x24bbdc(_0x535373);})['catch'](function(_0x5947fa){_0x491cba(_0x1fdeeb[_0x7f98('0x14')](0x1f4,_0x5947fa[_0x7f98('0x16')]));});});}; \ No newline at end of file +var _0x24ca=['localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','options','raw','attributes','limit','include','map','model','GetMailAccount','debug','ShowMailAccount','MailAccount','smtp','setDataValue','smtpOptions','getSmtpOptions','NotifyMailAccount','body','difference','keys','CmContact','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','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','from','find','account','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','omit','list','applications','orderBy','priority','asc','autoclose','push','length','close','create','List\x20not\x20found','contact','messageId','generate','attach','format','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originCc','bcc','ChatWebsiteId','Email','ChatOfflineMessageId','Attachment','Attachments','UserId','name','unshift','agent','*,*,*,*','MailQueue','queue','waitForTheAssignedQueue','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults'];(function(_0x504df1,_0x289598){var _0x1063b5=function(_0x627abd){while(--_0x627abd){_0x504df1['push'](_0x504df1['shift']());}};_0x1063b5(++_0x289598);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3ed054,_0x4d4f16){_0x3ed054=_0x3ed054-0x0;var _0x16dd95=_0x24ca[_0x3ed054];return _0x16dd95;};'use strict';var _=require(_0xa24c('0x0'));var moment=require('moment');var BPromise=require(_0xa24c('0x1'));var rs=require(_0xa24c('0x2'));var Redis=require(_0xa24c('0x3'));var db=require('../../mysqldb')['db'];var logger=require(_0xa24c('0x4'))(_0xa24c('0x5'));var config=require(_0xa24c('0x6'));var jayson=require(_0xa24c('0x7'));var client=jayson[_0xa24c('0x8')][_0xa24c('0x9')]({'port':0x232c});config[_0xa24c('0xa')]=_[_0xa24c('0xb')](config[_0xa24c('0xa')],{'host':_0xa24c('0xc'),'port':0x18eb});var socket=require(_0xa24c('0xd'))(new Redis(config['redis']));require(_0xa24c('0xe'))[_0xa24c('0xf')](socket);function respondWithRpcPromise(_0x2d645c,_0x5eac78,_0x399f32){return new BPromise(function(_0x325c6d,_0x288f76){return client[_0xa24c('0x10')](_0x2d645c,_0x399f32)[_0xa24c('0x11')](function(_0x43aa5a){logger[_0xa24c('0x12')](_0xa24c('0x13'),_0x5eac78,_0xa24c('0x14'));logger['debug'](_0xa24c('0x15'),_0x5eac78,_0xa24c('0x14'),JSON[_0xa24c('0x16')](_0x43aa5a));if(_0x43aa5a[_0xa24c('0x17')]){if(_0x43aa5a['error'][_0xa24c('0x18')]===0x1f4){logger[_0xa24c('0x17')](_0xa24c('0x13'),_0x5eac78,_0x43aa5a[_0xa24c('0x17')][_0xa24c('0x19')]);return _0x288f76(_0x43aa5a[_0xa24c('0x17')][_0xa24c('0x19')]);}logger['error']('MailAccount,\x20%s,\x20%s',_0x5eac78,_0x43aa5a[_0xa24c('0x17')][_0xa24c('0x19')]);return _0x325c6d(_0x43aa5a['error']['message']);}else{logger[_0xa24c('0x12')](_0xa24c('0x13'),_0x5eac78,'request\x20sent');_0x325c6d(_0x43aa5a[_0xa24c('0x1a')]['message']);}})[_0xa24c('0x1b')](function(_0x2a610a){logger[_0xa24c('0x17')](_0xa24c('0x13'),_0x5eac78,_0x2a610a);_0x288f76(_0x2a610a);});});}exports['GetMailAccount']=function(_0x16d363){var _0x18b7e0=this;return new Promise(function(_0x773f70,_0x4d4bab){return db['MailAccount']['findAll']({'raw':_0x16d363['options']?_0x16d363[_0xa24c('0x1c')][_0xa24c('0x1d')]===undefined?!![]:![]:!![],'where':_0x16d363[_0xa24c('0x1c')]?_0x16d363[_0xa24c('0x1c')]['where']||null:null,'attributes':_0x16d363[_0xa24c('0x1c')]?_0x16d363['options'][_0xa24c('0x1e')]||null:null,'limit':_0x16d363[_0xa24c('0x1c')]?_0x16d363['options'][_0xa24c('0x1f')]||null:null,'include':_0x16d363[_0xa24c('0x1c')]?_0x16d363[_0xa24c('0x1c')][_0xa24c('0x20')]?_[_0xa24c('0x21')](_0x16d363['options'][_0xa24c('0x20')],function(_0x5cc9cb){return{'model':db[_0x5cc9cb[_0xa24c('0x22')]],'as':_0x5cc9cb['as'],'attributes':_0x5cc9cb[_0xa24c('0x1e')],'include':_0x5cc9cb[_0xa24c('0x20')]?_['map'](_0x5cc9cb[_0xa24c('0x20')],function(_0x31c4d9){return{'model':db[_0x31c4d9[_0xa24c('0x22')]],'as':_0x31c4d9['as'],'attributes':_0x31c4d9[_0xa24c('0x1e')],'include':_0x31c4d9[_0xa24c('0x20')]?_[_0xa24c('0x21')](_0x31c4d9[_0xa24c('0x20')],function(_0x5b23f4){return{'model':db[_0x5b23f4[_0xa24c('0x22')]],'as':_0x5b23f4['as'],'attributes':_0x5b23f4[_0xa24c('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xa24c('0x11')](function(_0x12dbdc){logger['info'](_0xa24c('0x23'),_0x16d363);logger[_0xa24c('0x24')](_0xa24c('0x23'),_0x16d363,JSON['stringify'](_0x12dbdc));_0x773f70(_0x12dbdc);})[_0xa24c('0x1b')](function(_0x3dcb1b){logger[_0xa24c('0x17')]('GetMailAccount',_0x3dcb1b[_0xa24c('0x19')],_0x16d363);_0x4d4bab(_0x18b7e0['error'](0x1f4,_0x3dcb1b[_0xa24c('0x19')]));});});};exports[_0xa24c('0x25')]=function(_0x1a247b){var _0x5d025a=this;return new Promise(function(_0x1f52f8,_0x53f90){return db[_0xa24c('0x26')]['find']({'raw':_0x1a247b[_0xa24c('0x1c')]?_0x1a247b['options'][_0xa24c('0x1d')]===undefined?!![]:![]:!![],'where':_0x1a247b[_0xa24c('0x1c')]?_0x1a247b['options']['where']||null:null,'attributes':_0x1a247b[_0xa24c('0x1c')]?_0x1a247b[_0xa24c('0x1c')][_0xa24c('0x1e')]||null:null,'include':_0x1a247b[_0xa24c('0x1c')]?_0x1a247b[_0xa24c('0x1c')][_0xa24c('0x20')]?_[_0xa24c('0x21')](_0x1a247b['options'][_0xa24c('0x20')],function(_0x3ea442){return{'model':db[_0x3ea442[_0xa24c('0x22')]],'as':_0x3ea442['as'],'attributes':_0x3ea442[_0xa24c('0x1e')],'include':_0x3ea442[_0xa24c('0x20')]?_[_0xa24c('0x21')](_0x3ea442[_0xa24c('0x20')],function(_0x81d471){return{'model':db[_0x81d471[_0xa24c('0x22')]],'as':_0x81d471['as'],'attributes':_0x81d471[_0xa24c('0x1e')],'include':_0x81d471['include']?_[_0xa24c('0x21')](_0x81d471[_0xa24c('0x20')],function(_0x2b362d){return{'model':db[_0x2b362d[_0xa24c('0x22')]],'as':_0x2b362d['as'],'attributes':_0x2b362d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x19a65f){if(_0x1a247b['options'][_0xa24c('0x27')]===!![])_0x19a65f[_0xa24c('0x28')](_0xa24c('0x29'),_0x19a65f[_0xa24c('0x2a')]());logger[_0xa24c('0x12')]('ShowMailAccount',_0x1a247b);logger['debug'](_0xa24c('0x25'),_0x1a247b,JSON[_0xa24c('0x16')](_0x19a65f));_0x1f52f8(_0x19a65f);})[_0xa24c('0x1b')](function(_0x213dc3){logger[_0xa24c('0x17')](_0xa24c('0x25'),_0x213dc3['message'],_0x1a247b);_0x53f90(_0x5d025a['error'](0x1f4,_0x213dc3[_0xa24c('0x19')]));});});};exports[_0xa24c('0x2b')]=function(_0x4037d6){var _0x2101f8=this;return new Promise(function(_0x43beff,_0x4c5b7e){var _0x171c51={'body':_0x4037d6[_0xa24c('0x2c')],'channel':'mail'};var _0x599627=_[_0xa24c('0x2d')](_[_0xa24c('0x2e')](db[_0xa24c('0x2f')]['rawAttributes']),['createdAt',_0xa24c('0x30'),_0xa24c('0x31'),_0xa24c('0x32')]);var _0x3ccc37=![];if(_0x4037d6[_0xa24c('0x2c')]['id']){delete _0x4037d6[_0xa24c('0x2c')]['id'];}if(_[_0xa24c('0x33')](_0x4037d6[_0xa24c('0x2c')]['from'])){return _0x4c5b7e(_0x2101f8['error'](0x1f4,_0xa24c('0x34')));}if(_[_0xa24c('0x33')](_0x4037d6[_0xa24c('0x2c')]['body'])||_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x2c')]===''){return _0x4c5b7e(_0x2101f8[_0xa24c('0x17')](0x1f4,_0xa24c('0x35')));}if(_[_0xa24c('0x33')](_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x36')])){return _0x4c5b7e(_0x2101f8[_0xa24c('0x17')](0x1f4,_0xa24c('0x37')+_0x599627));}if(!_[_0xa24c('0x38')](_0x599627,_0x4037d6['body'][_0xa24c('0x36')])){return _0x4c5b7e(_0x2101f8[_0xa24c('0x17')](0x1f4,_0xa24c('0x39')+_0x599627));}var _0x5aa2b2={};_0x5aa2b2[_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x36')]]=_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x3a')];return db[_0xa24c('0x26')][_0xa24c('0x3b')]({'where':{'id':_0x4037d6[_0xa24c('0x3c')]['id']},'include':[{'model':db[_0xa24c('0x3d')],'as':_0xa24c('0x3e'),'include':[{'model':db[_0xa24c('0x2f')],'as':_0xa24c('0x3f'),'where':_0x5aa2b2,'limit':0x1,'order':[['updatedAt',_0xa24c('0x40')]]}]},{'model':db[_0xa24c('0x41')],'as':_0xa24c('0x42')},{'model':db[_0xa24c('0x43')],'as':_0xa24c('0x44'),'include':[{'model':db[_0xa24c('0x45')],'as':_0xa24c('0x45')}]}]})[_0xa24c('0x11')](function(_0x184179){if(_0x184179&&_0x184179['List']){var _0x540da8=_0x184179[_0xa24c('0x46')]({'plain':!![]});_0x171c51['account']=_[_0xa24c('0x47')](_0x540da8,[_0xa24c('0x42'),'List']);_0x171c51[_0xa24c('0x3c')][_0xa24c('0x29')]=_0x184179[_0xa24c('0x2a')]();_0x171c51['applications']=_0x540da8['Applications'];_0x171c51[_0xa24c('0x48')]=_0x540da8['List'];_0x171c51[_0xa24c('0x49')]=_[_0xa24c('0x4a')](_0x171c51[_0xa24c('0x49')],[_0xa24c('0x4b')],[_0xa24c('0x4c')]);if(_0x171c51[_0xa24c('0x3c')]&&_0x171c51[_0xa24c('0x3c')][_0xa24c('0x4d')]){_0x171c51[_0xa24c('0x49')][_0xa24c('0x4e')]({'id':0x0,'priority':_0x171c51['applications'][_0xa24c('0x4f')]+0x1,'app':_0xa24c('0x50'),'appdata':_0xa24c('0x4d'),'interval':'*,*,*,*'});}if(_0x171c51['account']['Applications']){delete _0x171c51[_0xa24c('0x3c')]['Applications'];}if(_0x171c51[_0xa24c('0x3c')][_0xa24c('0x3e')]){delete _0x171c51['account'][_0xa24c('0x3e')];}if(_0x540da8[_0xa24c('0x3e')][_0xa24c('0x3f')][_0xa24c('0x4f')]){return _0x540da8[_0xa24c('0x3e')][_0xa24c('0x3f')][0x0];}var _0x3816f7=_[_0xa24c('0xb')](_0x4037d6['body'],{'firstName':_0x4037d6[_0xa24c('0x2c')]['from'],'ListId':_0x540da8['ListId']});_0x3816f7[_0x4037d6['body']['mapKey']]=_0x4037d6['body'][_0xa24c('0x3a')];return db['CmContact'][_0xa24c('0x51')](_0x3816f7);}else{throw new Error(_0xa24c('0x52'));}})[_0xa24c('0x11')](function(_0x1a5f17){_0x171c51[_0xa24c('0x53')]=_0x1a5f17;if(_0x1a5f17){if(!_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x54')]){_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x54')]=rs[_0xa24c('0x55')]()+'\x20'+_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x3a')];}var _0x5c3d11={'ContactId':_0x1a5f17['id'],'MailAccountId':_0x4037d6[_0xa24c('0x3c')]['id'],'inReplyTo':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x54')],'to':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x3a')],'cc':_0x4037d6['body']['message']['cc'],'subject':_0x4037d6[_0xa24c('0x2c')]['message']['subject'],'attach':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x56')],'lastMsgAt':moment()[_0xa24c('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db['MailInteraction'][_0xa24c('0x3b')]({'where':{'closed':![],'MailAccountId':_0x4037d6['account']['id']},'include':[{'model':db['MailMessage'],'as':_0xa24c('0x58'),'attributes':[_0xa24c('0x54')],'where':{'messageId':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x59')]}}]})[_0xa24c('0x11')](function(_0x5c3285){if(_0x5c3285){return[_0x5c3285,![]];}return db[_0xa24c('0x5a')][_0xa24c('0x51')](_0x5c3d11)[_0xa24c('0x11')](function(_0x4bee5c){return[_0x4bee5c,!![]];});});}else{throw new Error(_0xa24c('0x5b'));}})[_0xa24c('0x5c')](function(_0x21439a,_0x7aab6e){if(_0x21439a){_0x3ccc37=_0x7aab6e;if(!_0x7aab6e){return _0x21439a[_0xa24c('0x5d')]({'inReplyTo':_0x4037d6['body'][_0xa24c('0x19')][_0xa24c('0x54')],'to':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x3a')],'cc':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')]['cc'],'subject':_0x4037d6['body'][_0xa24c('0x19')][_0xa24c('0x5e')],'attach':_0x21439a['attach']?_0x21439a[_0xa24c('0x56')]:_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x56')],'substatus':null,'substatusAt':moment()[_0xa24c('0x57')](_0xa24c('0x5f')),'lastMsgAt':moment()[_0xa24c('0x57')](_0xa24c('0x5f')),'lastMsgDirection':'in'});}else{return _0x21439a;}}})[_0xa24c('0x11')](function(_0x32ddc3){_0x171c51['interaction']=_0x32ddc3[_0xa24c('0x46')]({'plain':!![]});_0x171c51[_0xa24c('0x60')][_0xa24c('0x61')]=_0x3ccc37;return db['MailMessage'][_0xa24c('0x51')]({'body':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x2c')],'MailAccountId':_0x4037d6['account']['id'],'MailInteractionId':_0x32ddc3['id'],'direction':'in','ContactId':_0x171c51[_0xa24c('0x53')]['id'],'messageId':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x54')],'from':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')]['from'],'to':_0x4037d6['body'][_0xa24c('0x19')]['to'],'cc':_0x4037d6['body'][_0xa24c('0x19')]['cc'],'subject':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x5e')],'attach':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x56')],'Attachments':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x62')],'originTo':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')]['originTo'],'originCc':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')][_0xa24c('0x63')],'bcc':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x64')],'ChatWebsiteId':_0x4037d6['body'][_0xa24c('0x19')][_0xa24c('0x65')]||null,'originChannel':_0x4037d6[_0xa24c('0x2c')][_0xa24c('0x19')]['originChannel']||_0xa24c('0x66'),'ChatOfflineMessageId':_0x4037d6[_0xa24c('0x2c')]['message'][_0xa24c('0x67')]||null},{'include':[{'model':db[_0xa24c('0x68')],'as':_0xa24c('0x69')}]});})[_0xa24c('0x11')](function(_0x8bd3fb){_0x171c51[_0xa24c('0x19')]=_0x8bd3fb;if(!_0x171c51[_0xa24c('0x60')][_0xa24c('0x6a')]){return;}return db['User'][_0xa24c('0x3b')]({'attributes':['id',_0xa24c('0x6b')],'where':{'id':_0x171c51[_0xa24c('0x60')][_0xa24c('0x6a')]}});})[_0xa24c('0x11')](function(_0x209b42){if(_0x209b42){_0x171c51[_0xa24c('0x49')][_0xa24c('0x6c')]({'id':0x0,'priority':0x0,'app':_0xa24c('0x6d'),'appdata':_0x209b42[_0xa24c('0x6b')]+','+(_0x171c51[_0xa24c('0x3c')]['waitForTheAssignedAgent']||0xa),'interval':_0xa24c('0x6e')});}if(!_0x171c51[_0xa24c('0x60')]['queueId']){return;}return db[_0xa24c('0x6f')][_0xa24c('0x3b')]({'attributes':['id',_0xa24c('0x6b')],'where':{'id':_0x171c51['interaction']['queueId']}});})[_0xa24c('0x11')](function(_0x4c9b19){if(_0x4c9b19){_0x171c51['applications'][_0xa24c('0x6c')]({'id':0x0,'priority':0x1,'app':_0xa24c('0x70'),'appdata':_0x4c9b19[_0xa24c('0x6b')]+','+(_0x171c51[_0xa24c('0x3c')][_0xa24c('0x71')]||0x12c),'interval':_0xa24c('0x6e')});}return respondWithRpcPromise('Start','startRouting',_0x171c51);})['then'](function(_0x263dab){_0x43beff(_0x263dab);})['catch'](function(_0x53462e){_0x4c5b7e(_0x2101f8[_0xa24c('0x17')](0x1f4,_0x53462e[_0xa24c('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index dec3b88..b34a89c 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 _0x0bf7=['./mailAccount.events','remove','update','emit','length','mailAccount:'];(function(_0x39e717,_0x3061e3){var _0x19b182=function(_0x599889){while(--_0x599889){_0x39e717['push'](_0x39e717['shift']());}};_0x19b182(++_0x3061e3);}(_0x0bf7,0x14a));var _0x70bf=function(_0x228a5c,_0x345739){_0x228a5c=_0x228a5c-0x0;var _0x8f90b1=_0x0bf7[_0x228a5c];return _0x8f90b1;};'use strict';var MailAccountEvents=require(_0x70bf('0x0'));var events=['save',_0x70bf('0x1'),_0x70bf('0x2')];function createListener(_0x214a6f,_0x448f57){return function(_0xee2152){_0x448f57[_0x70bf('0x3')](_0x214a6f,_0xee2152);};}function removeListener(_0x4f6e52,_0x1cad23){return function(){MailAccountEvents['removeListener'](_0x4f6e52,_0x1cad23);};}exports['register']=function(_0x57a9d3){for(var _0x4179e4=0x0,_0x410444=events[_0x70bf('0x4')];_0x4179e4<_0x410444;_0x4179e4++){var _0x24b8b0=events[_0x4179e4];var _0x2ba2ce=createListener(_0x70bf('0x5')+_0x24b8b0,_0x57a9d3);MailAccountEvents['on'](_0x24b8b0,_0x2ba2ce);}}; \ No newline at end of file +var _0x5713=['./mailAccount.events','save','update','emit','register','length','mailAccount:'];(function(_0x5be1d6,_0x52ab2a){var _0x5d9bd4=function(_0x4f05ba){while(--_0x4f05ba){_0x5be1d6['push'](_0x5be1d6['shift']());}};_0x5d9bd4(++_0x52ab2a);}(_0x5713,0x1c7));var _0x3571=function(_0x3b8403,_0x1bd949){_0x3b8403=_0x3b8403-0x0;var _0x1f9678=_0x5713[_0x3b8403];return _0x1f9678;};'use strict';var MailAccountEvents=require(_0x3571('0x0'));var events=[_0x3571('0x1'),'remove',_0x3571('0x2')];function createListener(_0x4b2dab,_0x40ac99){return function(_0x14a8fc){_0x40ac99[_0x3571('0x3')](_0x4b2dab,_0x14a8fc);};}function removeListener(_0x3ee837,_0x577a08){return function(){MailAccountEvents['removeListener'](_0x3ee837,_0x577a08);};}exports[_0x3571('0x4')]=function(_0x415378){for(var _0x3e114a=0x0,_0x432a48=events[_0x3571('0x5')];_0x3e114a<_0x432a48;_0x3e114a++){var _0x1f8f0f=events[_0x3e114a];var _0x48b06d=createListener(_0x3571('0x6')+_0x1f8f0f,_0x415378);MailAccountEvents['on'](_0x1f8f0f,_0x48b06d);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index ea3e359..e81740c 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 _0x5718=['/:id','isAuthenticated','delete','destroy','exports','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailApplication.controller','get'];(function(_0x3b2e0a,_0x49a3f9){var _0x4a84bd=function(_0x3aa487){while(--_0x3aa487){_0x3b2e0a['push'](_0x3b2e0a['shift']());}};_0x4a84bd(++_0x49a3f9);}(_0x5718,0x130));var _0x8571=function(_0xe4d310,_0x420e38){_0xe4d310=_0xe4d310-0x0;var _0x407706=_0x5718[_0xe4d310];return _0x407706;};'use strict';var multer=require('multer');var util=require(_0x8571('0x0'));var path=require('path');var timeout=require(_0x8571('0x1'));var express=require('express');var router=express[_0x8571('0x2')]();var fs_extra=require(_0x8571('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8571('0x4'));var config=require(_0x8571('0x5'));var controller=require(_0x8571('0x6'));router[_0x8571('0x7')](_0x8571('0x8'),auth[_0x8571('0x9')](),controller['show']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8571('0xa')](_0x8571('0x8'),auth[_0x8571('0x9')](),controller[_0x8571('0xb')]);module[_0x8571('0xc')]=router; \ No newline at end of file +var _0xbb7a=['put','/:id','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','show'];(function(_0x58f57d,_0x36e8e0){var _0x50b52f=function(_0x50bc3b){while(--_0x50bc3b){_0x58f57d['push'](_0x58f57d['shift']());}};_0x50b52f(++_0x36e8e0);}(_0xbb7a,0x124));var _0xabb7=function(_0x294d96,_0x2a7812){_0x294d96=_0x294d96-0x0;var _0x5ceb37=_0xbb7a[_0x294d96];return _0x5ceb37;};'use strict';var multer=require(_0xabb7('0x0'));var util=require(_0xabb7('0x1'));var path=require(_0xabb7('0x2'));var timeout=require(_0xabb7('0x3'));var express=require(_0xabb7('0x4'));var router=express[_0xabb7('0x5')]();var fs_extra=require(_0xabb7('0x6'));var auth=require(_0xabb7('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xabb7('0x8'));var controller=require('./mailApplication.controller');router[_0xabb7('0x9')]('/:id',auth[_0xabb7('0xa')](),controller[_0xabb7('0xb')]);router[_0xabb7('0xc')](_0xabb7('0xd'),auth[_0xabb7('0xa')](),controller['update']);router[_0xabb7('0xe')]('/:id',auth[_0xabb7('0xa')](),controller[_0xabb7('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 8d6f76c..186cb87 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 _0x1ee6=['INTEGER','STRING','TEXT','sequelize','exports'];(function(_0xc7ff2e,_0x4a9dac){var _0x2cc041=function(_0x1e3288){while(--_0x1e3288){_0xc7ff2e['push'](_0xc7ff2e['shift']());}};_0x2cc041(++_0x4a9dac);}(_0x1ee6,0xd0));var _0x61ee=function(_0x473c81,_0x305907){_0x473c81=_0x473c81-0x0;var _0x336fdd=_0x1ee6[_0x473c81];return _0x336fdd;};'use strict';var Sequelize=require(_0x61ee('0x0'));module[_0x61ee('0x1')]={'priority':{'type':Sequelize[_0x61ee('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x61ee('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x61ee('0x4')]()},'description':{'type':Sequelize[_0x61ee('0x3')]},'interval':{'type':Sequelize[_0x61ee('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x02d3=['sequelize','STRING','TEXT','*,*,*,*'];(function(_0x1f4c0b,_0x28f740){var _0xa2eddb=function(_0x51f179){while(--_0x51f179){_0x1f4c0b['push'](_0x1f4c0b['shift']());}};_0xa2eddb(++_0x28f740);}(_0x02d3,0x160));var _0x302d=function(_0xc37dba,_0x374c5e){_0xc37dba=_0xc37dba-0x0;var _0x1fb90f=_0x02d3[_0xc37dba];return _0x1fb90f;};'use strict';var Sequelize=require(_0x302d('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x302d('0x1')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x302d('0x2')]()},'description':{'type':Sequelize[_0x302d('0x1')]},'interval':{'type':Sequelize[_0x302d('0x1')],'defaultValue':_0x302d('0x3')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index d290e5d..04dcf29 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 _0x0713=['catch','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','stack','name','send','show','params','MailApplication','rawAttributes','query','keys','filters','intersection','model','fields','attributes','length','includeAll','include','merge','options','find','body'];(function(_0x396e4d,_0x5f32f1){var _0x272d39=function(_0x539e92){while(--_0x539e92){_0x396e4d['push'](_0x396e4d['shift']());}};_0x272d39(++_0x5f32f1);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3071('0x0'));var jsonpatch=require(_0x3071('0x1'));var rp=require(_0x3071('0x2'));var moment=require(_0x3071('0x3'));var BPromise=require(_0x3071('0x4'));var Mustache=require('mustache');var util=require(_0x3071('0x5'));var path=require(_0x3071('0x6'));var sox=require(_0x3071('0x7'));var csv=require(_0x3071('0x8'));var ejs=require(_0x3071('0x9'));var fs=require('fs');var fs_extra=require(_0x3071('0xa'));var _=require(_0x3071('0xb'));var squel=require(_0x3071('0xc'));var crypto=require(_0x3071('0xd'));var jsforce=require(_0x3071('0xe'));var deskjs=require(_0x3071('0xf'));var toCsv=require(_0x3071('0x8'));var querystring=require(_0x3071('0x10'));var Papa=require('papaparse');var Redis=require(_0x3071('0x11'));var authService=require(_0x3071('0x12'));var qs=require(_0x3071('0x13'));var as=require(_0x3071('0x14'));var hardwareService=require(_0x3071('0x15'));var logger=require('../../config/logger')(_0x3071('0x16'));var utils=require(_0x3071('0x17'));var config=require(_0x3071('0x18'));var licenseUtil=require(_0x3071('0x19'));var db=require(_0x3071('0x1a'))['db'];function respondWithStatusCode(_0x4a8cc7,_0x5330a8){_0x5330a8=_0x5330a8||0xcc;return function(_0x1826ca){if(_0x1826ca){return _0x4a8cc7['sendStatus'](_0x5330a8);}return _0x4a8cc7[_0x3071('0x1b')](_0x5330a8)[_0x3071('0x1c')]();};}function respondWithResult(_0x5d4883,_0x104e73){_0x104e73=_0x104e73||0xc8;return function(_0x4e1219){if(_0x4e1219){return _0x5d4883[_0x3071('0x1b')](_0x104e73)[_0x3071('0x1d')](_0x4e1219);}};}function respondWithFilteredResult(_0x1271d0,_0x1f14e1){return function(_0x1caa5d){if(_0x1caa5d){var _0x2a6a4b=typeof _0x1f14e1[_0x3071('0x1e')]===_0x3071('0x1f')&&typeof _0x1f14e1[_0x3071('0x20')]===_0x3071('0x1f');var _0x5f3c22=_0x1caa5d[_0x3071('0x21')];var _0x17dbda=_0x2a6a4b?0x0:_0x1f14e1[_0x3071('0x1e')];var _0x108a83=_0x2a6a4b?_0x1caa5d[_0x3071('0x21')]:_0x1f14e1[_0x3071('0x1e')]+_0x1f14e1[_0x3071('0x20')];var _0x26f113;if(_0x108a83>=_0x5f3c22){_0x108a83=_0x5f3c22;_0x26f113=0xc8;}else{_0x26f113=0xce;}_0x1271d0['status'](_0x26f113);return _0x1271d0[_0x3071('0x22')](_0x3071('0x23'),_0x17dbda+'-'+_0x108a83+'/'+_0x5f3c22)[_0x3071('0x1d')](_0x1caa5d);}return null;};}function patchUpdates(_0x56c267){return function(_0xb8f4e3){try{jsonpatch['apply'](_0xb8f4e3,_0x56c267,!![]);}catch(_0x833074){return BPromise[_0x3071('0x24')](_0x833074);}return _0xb8f4e3[_0x3071('0x25')]();};}function saveUpdates(_0x457b57,_0x33090c){return function(_0x34c50e){if(_0x34c50e){return _0x34c50e[_0x3071('0x26')](_0x457b57)[_0x3071('0x27')](function(_0x542646){return _0x542646;});}return null;};}function removeEntity(_0x481a51,_0x2ce48a){return function(_0xb05b1d){if(_0xb05b1d){return _0xb05b1d[_0x3071('0x28')]()[_0x3071('0x27')](function(){_0x481a51[_0x3071('0x1b')](0xcc)[_0x3071('0x1c')]();});}};}function handleEntityNotFound(_0x7a4cb4,_0x1fe727){return function(_0x1de5fb){if(!_0x1de5fb){_0x7a4cb4['sendStatus'](0x194);}return _0x1de5fb;};}function handleError(_0x2e5f93,_0x3f1e6e){_0x3f1e6e=_0x3f1e6e||0x1f4;return function(_0x177138){logger['error'](_0x177138[_0x3071('0x29')]);if(_0x177138[_0x3071('0x2a')]){delete _0x177138[_0x3071('0x2a')];}_0x2e5f93[_0x3071('0x1b')](_0x3f1e6e)[_0x3071('0x2b')](_0x177138);};}exports[_0x3071('0x2c')]=function(_0x177b5f,_0x3921a1){var _0x32f1b4={'raw':!![],'where':{'id':_0x177b5f[_0x3071('0x2d')]['id']}},_0x292205={};_0x292205['model']=_['keys'](db[_0x3071('0x2e')][_0x3071('0x2f')]);_0x292205[_0x3071('0x30')]=_[_0x3071('0x31')](_0x177b5f[_0x3071('0x30')]);_0x292205[_0x3071('0x32')]=_[_0x3071('0x33')](_0x292205[_0x3071('0x34')],_0x292205['query']);_0x32f1b4['attributes']=_['intersection'](_0x292205[_0x3071('0x34')],qs[_0x3071('0x35')](_0x177b5f['query'][_0x3071('0x35')]));_0x32f1b4[_0x3071('0x36')]=_0x32f1b4[_0x3071('0x36')][_0x3071('0x37')]?_0x32f1b4['attributes']:_0x292205[_0x3071('0x34')];if(_0x177b5f[_0x3071('0x30')][_0x3071('0x38')]){_0x32f1b4[_0x3071('0x39')]=[{'all':!![]}];}_0x32f1b4=_[_0x3071('0x3a')]({},_0x32f1b4,_0x177b5f[_0x3071('0x3b')]);return db[_0x3071('0x2e')][_0x3071('0x3c')](_0x32f1b4)['then'](handleEntityNotFound(_0x3921a1,null))[_0x3071('0x27')](respondWithResult(_0x3921a1,null))['catch'](handleError(_0x3921a1,null));};exports['update']=function(_0x1a1a64,_0xa3a7ae){if(_0x1a1a64['body']['id']){delete _0x1a1a64[_0x3071('0x3d')]['id'];}return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x1a1a64[_0x3071('0x2d')]['id']}})[_0x3071('0x27')](handleEntityNotFound(_0xa3a7ae,null))[_0x3071('0x27')](saveUpdates(_0x1a1a64['body'],null))[_0x3071('0x27')](respondWithResult(_0xa3a7ae,null))[_0x3071('0x3e')](handleError(_0xa3a7ae,null));};exports['destroy']=function(_0x44ad05,_0x5b1392){return db[_0x3071('0x2e')][_0x3071('0x3c')]({'where':{'id':_0x44ad05['params']['id']}})['then'](handleEntityNotFound(_0x5b1392,null))[_0x3071('0x27')](removeEntity(_0x5b1392,null))[_0x3071('0x3e')](handleError(_0x5b1392,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(_0x1d8b10,_0x9603a6){var _0x123f31=function(_0x675fd8){while(--_0x675fd8){_0x1d8b10['push'](_0x1d8b10['shift']());}};_0x123f31(++_0x9603a6);}(_0x9c44,0x178));var _0x49c4=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x9c44[_0x36c5b0];return _0xf19333;};'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 c71ef66..90fe0da 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 _0xb8f9=['bluebird','path','rimraf','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','../../config/logger','api','moment'];(function(_0x3bc15b,_0x299ccc){var _0x389630=function(_0xe9686){while(--_0xe9686){_0x3bc15b['push'](_0x3bc15b['shift']());}};_0x389630(++_0x299ccc);}(_0xb8f9,0x81));var _0x9b8f=function(_0x507965,_0x4944f4){_0x507965=_0x507965-0x0;var _0x3608fc=_0xb8f9[_0x507965];return _0x3608fc;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9b8f('0x0'))(_0x9b8f('0x1'));var moment=require(_0x9b8f('0x2'));var BPromise=require(_0x9b8f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b8f('0x4'));var rimraf=require(_0x9b8f('0x5'));var config=require('../../config/environment');var attributes=require(_0x9b8f('0x6'));module[_0x9b8f('0x7')]=function(_0x16c072,_0x5c7415){return _0x16c072[_0x9b8f('0x8')](_0x9b8f('0x9'),attributes,{'tableName':_0x9b8f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9b8f('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4bc1=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x417eab,_0x2bf7e2){var _0x1fe23e=function(_0x4bb250){while(--_0x4bb250){_0x417eab['push'](_0x417eab['shift']());}};_0x1fe23e(++_0x2bf7e2);}(_0x4bc1,0xb3));var _0x14bc=function(_0x12b036,_0x4d8743){_0x12b036=_0x12b036-0x0;var _0x428c86=_0x4bc1[_0x12b036];return _0x428c86;};'use strict';var _=require(_0x14bc('0x0'));var util=require(_0x14bc('0x1'));var logger=require(_0x14bc('0x2'))(_0x14bc('0x3'));var moment=require(_0x14bc('0x4'));var BPromise=require('bluebird');var rp=require(_0x14bc('0x5'));var fs=require('fs');var path=require(_0x14bc('0x6'));var rimraf=require(_0x14bc('0x7'));var config=require(_0x14bc('0x8'));var attributes=require(_0x14bc('0x9'));module['exports']=function(_0x38d0db,_0x3073fe){return _0x38d0db['define']('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x14bc('0xa'),'collate':_0x14bc('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 0824af1..2baaefb 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 _0x5f39=['request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','result','catch','MailApplication','body','options','raw','where','attributes','limit','then','UpdateMailApplication','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','info'];(function(_0x3fbfbc,_0x166a27){var _0x5f5121=function(_0x7cef3){while(--_0x7cef3){_0x3fbfbc['push'](_0x3fbfbc['shift']());}};_0x5f5121(++_0x166a27);}(_0x5f39,0x6a));var _0x95f3=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0x5f39[_0x178e48];return _0x440d7e;};'use strict';var _=require('lodash');var util=require(_0x95f3('0x0'));var moment=require(_0x95f3('0x1'));var BPromise=require(_0x95f3('0x2'));var rs=require(_0x95f3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x95f3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x95f3('0x5'))(_0x95f3('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x95f3('0x7')][_0x95f3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x514c04,_0x236f6d,_0x58dd7d){return new BPromise(function(_0x28792a,_0x333666){return client['request'](_0x514c04,_0x58dd7d)['then'](function(_0xc79df4){logger[_0x95f3('0x9')]('MailApplication,\x20%s,\x20%s',_0x236f6d,_0x95f3('0xa'));logger[_0x95f3('0xb')](_0x95f3('0xc'),_0x236f6d,'request\x20sent',JSON[_0x95f3('0xd')](_0xc79df4));if(_0xc79df4[_0x95f3('0xe')]){if(_0xc79df4[_0x95f3('0xe')][_0x95f3('0xf')]===0x1f4){logger[_0x95f3('0xe')](_0x95f3('0x10'),_0x236f6d,_0xc79df4[_0x95f3('0xe')][_0x95f3('0x11')]);return _0x333666(_0xc79df4['error'][_0x95f3('0x11')]);}logger[_0x95f3('0xe')](_0x95f3('0x10'),_0x236f6d,_0xc79df4[_0x95f3('0xe')][_0x95f3('0x11')]);return _0x28792a(_0xc79df4[_0x95f3('0xe')][_0x95f3('0x11')]);}else{logger[_0x95f3('0x9')](_0x95f3('0x10'),_0x236f6d,_0x95f3('0xa'));_0x28792a(_0xc79df4[_0x95f3('0x12')][_0x95f3('0x11')]);}})[_0x95f3('0x13')](function(_0xe8919d){logger[_0x95f3('0xe')](_0x95f3('0x10'),_0x236f6d,_0xe8919d);_0x333666(_0xe8919d);});});}exports['UpdateMailApplication']=function(_0x317815){var _0x44bbcc=this;return new Promise(function(_0x43435f,_0x59e18a){return db[_0x95f3('0x14')]['update'](_0x317815[_0x95f3('0x15')],{'raw':_0x317815['options']?_0x317815[_0x95f3('0x16')][_0x95f3('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x317815['options']?_0x317815[_0x95f3('0x16')][_0x95f3('0x18')]||null:null,'attributes':_0x317815[_0x95f3('0x16')]?_0x317815[_0x95f3('0x16')][_0x95f3('0x19')]||null:null,'limit':_0x317815[_0x95f3('0x16')]?_0x317815[_0x95f3('0x16')][_0x95f3('0x1a')]||null:null})[_0x95f3('0x1b')](function(_0x35edad){logger[_0x95f3('0x9')](_0x95f3('0x1c'),_0x317815);logger[_0x95f3('0xb')](_0x95f3('0x1c'),_0x317815,JSON[_0x95f3('0xd')](_0x35edad));_0x43435f(_0x35edad);})['catch'](function(_0x338082){logger[_0x95f3('0xe')]('UpdateMailApplication',_0x338082['message'],_0x317815);_0x59e18a(_0x44bbcc[_0x95f3('0xe')](0x1f4,_0x338082['message']));});});}; \ No newline at end of file +var _0x41ab=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','error','message','result','UpdateMailApplication','MailApplication','update','body','options','where','debug','stringify','util','bluebird','randomstring'];(function(_0x27c05c,_0x3f8ffa){var _0x32c1de=function(_0x5826ff){while(--_0x5826ff){_0x27c05c['push'](_0x27c05c['shift']());}};_0x32c1de(++_0x3f8ffa);}(_0x41ab,0x177));var _0xb41a=function(_0x1a7866,_0x5a7f40){_0x1a7866=_0x1a7866-0x0;var _0x689179=_0x41ab[_0x1a7866];return _0x689179;};'use strict';var _=require('lodash');var util=require(_0xb41a('0x0'));var moment=require('moment');var BPromise=require(_0xb41a('0x1'));var rs=require(_0xb41a('0x2'));var fs=require('fs');var Redis=require(_0xb41a('0x3'));var db=require(_0xb41a('0x4'))['db'];var utils=require(_0xb41a('0x5'));var logger=require(_0xb41a('0x6'))(_0xb41a('0x7'));var config=require(_0xb41a('0x8'));var jayson=require(_0xb41a('0x9'));var client=jayson[_0xb41a('0xa')][_0xb41a('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3245d1,_0x338936,_0x535603){return new BPromise(function(_0x2d8f34,_0x3a968d){return client['request'](_0x3245d1,_0x535603)[_0xb41a('0xc')](function(_0x5a084e){logger[_0xb41a('0xd')](_0xb41a('0xe'),_0x338936,_0xb41a('0xf'));logger['debug']('MailApplication,\x20%s,\x20%s,\x20%s',_0x338936,_0xb41a('0xf'),JSON['stringify'](_0x5a084e));if(_0x5a084e[_0xb41a('0x10')]){if(_0x5a084e['error']['code']===0x1f4){logger[_0xb41a('0x10')](_0xb41a('0xe'),_0x338936,_0x5a084e['error']['message']);return _0x3a968d(_0x5a084e[_0xb41a('0x10')][_0xb41a('0x11')]);}logger[_0xb41a('0x10')](_0xb41a('0xe'),_0x338936,_0x5a084e[_0xb41a('0x10')][_0xb41a('0x11')]);return _0x2d8f34(_0x5a084e[_0xb41a('0x10')]['message']);}else{logger[_0xb41a('0xd')]('MailApplication,\x20%s,\x20%s',_0x338936,_0xb41a('0xf'));_0x2d8f34(_0x5a084e[_0xb41a('0x12')][_0xb41a('0x11')]);}})['catch'](function(_0x3765aa){logger[_0xb41a('0x10')](_0xb41a('0xe'),_0x338936,_0x3765aa);_0x3a968d(_0x3765aa);});});}exports[_0xb41a('0x13')]=function(_0x2b6368){var _0x1cda3d=this;return new Promise(function(_0x2f90a0,_0x5821e0){return db[_0xb41a('0x14')][_0xb41a('0x15')](_0x2b6368[_0xb41a('0x16')],{'raw':_0x2b6368[_0xb41a('0x17')]?_0x2b6368['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b6368[_0xb41a('0x17')]?_0x2b6368[_0xb41a('0x17')][_0xb41a('0x18')]||null:null,'attributes':_0x2b6368['options']?_0x2b6368[_0xb41a('0x17')]['attributes']||null:null,'limit':_0x2b6368[_0xb41a('0x17')]?_0x2b6368['options']['limit']||null:null})['then'](function(_0x5787f3){logger[_0xb41a('0xd')](_0xb41a('0x13'),_0x2b6368);logger[_0xb41a('0x19')](_0xb41a('0x13'),_0x2b6368,JSON[_0xb41a('0x1a')](_0x5787f3));_0x2f90a0(_0x5787f3);})['catch'](function(_0x558cb9){logger[_0xb41a('0x10')]('UpdateMailApplication',_0x558cb9[_0xb41a('0x11')],_0x2b6368);_0x5821e0(_0x1cda3d[_0xb41a('0x10')](0x1f4,_0x558cb9['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 80002f0..5d6b1bf 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 _0x27b3=['Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/messages','getMessages','download','create','addMessage','post','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','delete','destroy','removeTags'];(function(_0x10e8ed,_0x384a0d){var _0x4aea4a=function(_0x486ad1){while(--_0x486ad1){_0x10e8ed['push'](_0x10e8ed['shift']());}};_0x4aea4a(++_0x384a0d);}(_0x27b3,0xc8));var _0x327b=function(_0xb87c9d,_0x149fa2){_0xb87c9d=_0xb87c9d-0x0;var _0x31ba11=_0x27b3[_0xb87c9d];return _0x31ba11;};'use strict';var express=require('express');var router=express[_0x327b('0x0')]();var auth=require(_0x327b('0x1'));var interaction=require(_0x327b('0x2'));var controller=require(_0x327b('0x3'));router[_0x327b('0x4')]('/',auth[_0x327b('0x5')](),controller[_0x327b('0x6')]);router[_0x327b('0x4')](_0x327b('0x7'),auth[_0x327b('0x5')](),controller[_0x327b('0x8')]);router[_0x327b('0x4')](_0x327b('0x9'),auth[_0x327b('0x5')](),controller['show']);router['get'](_0x327b('0xa'),auth[_0x327b('0x5')](),controller[_0x327b('0xb')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x327b('0xc')]);router['post']('/',auth[_0x327b('0x5')](),controller[_0x327b('0xd')]);router['post'](_0x327b('0xa'),auth[_0x327b('0x5')](),controller[_0x327b('0xe')]);router[_0x327b('0xf')](_0x327b('0x10'),auth['isAuthenticated'](),interaction[_0x327b('0x11')](_0x327b('0x12'),'mailinteraction:addtags'),controller[_0x327b('0x13')]);router[_0x327b('0x14')](_0x327b('0x9'),auth[_0x327b('0x5')](),interaction['tracked'](_0x327b('0x12'),_0x327b('0x15')),controller['update']);router[_0x327b('0x16')](_0x327b('0x9'),auth[_0x327b('0x5')](),interaction['tracked'](_0x327b('0x12'),'mailinteraction:destroy'),controller[_0x327b('0x17')]);router[_0x327b('0x16')]('/:id/tags',auth[_0x327b('0x5')](),controller[_0x327b('0x18')]);module['exports']=router; \ No newline at end of file +var _0x1bde=['/:id/messages','/:id/tags','mail','mailinteraction:update','update','delete','tracked','mailinteraction:destroy','destroy','exports','express','Router','../../components/auth/service','../../components/interaction/service','./mailInteraction.controller','get','index','/describe','isAuthenticated','describe','/:id','show','getMessages','/:id/download','download','post','create'];(function(_0x1e5bc3,_0x360ef2){var _0x5a9e14=function(_0x36d95e){while(--_0x36d95e){_0x1e5bc3['push'](_0x1e5bc3['shift']());}};_0x5a9e14(++_0x360ef2);}(_0x1bde,0x118));var _0xe1bd=function(_0x5dcd95,_0x1e72d4){_0x5dcd95=_0x5dcd95-0x0;var _0x271b17=_0x1bde[_0x5dcd95];return _0x271b17;};'use strict';var express=require(_0xe1bd('0x0'));var router=express[_0xe1bd('0x1')]();var auth=require(_0xe1bd('0x2'));var interaction=require(_0xe1bd('0x3'));var controller=require(_0xe1bd('0x4'));router[_0xe1bd('0x5')]('/',auth['isAuthenticated'](),controller[_0xe1bd('0x6')]);router[_0xe1bd('0x5')](_0xe1bd('0x7'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x9')]);router[_0xe1bd('0x5')](_0xe1bd('0xa'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0xb')]);router[_0xe1bd('0x5')]('/:id/messages',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0xc')]);router['get'](_0xe1bd('0xd'),auth[_0xe1bd('0x8')](),controller[_0xe1bd('0xe')]);router[_0xe1bd('0xf')]('/',auth[_0xe1bd('0x8')](),controller[_0xe1bd('0x10')]);router[_0xe1bd('0xf')](_0xe1bd('0x11'),auth[_0xe1bd('0x8')](),controller['addMessage']);router[_0xe1bd('0xf')](_0xe1bd('0x12'),auth[_0xe1bd('0x8')](),interaction['tracked'](_0xe1bd('0x13'),'mailinteraction:addtags'),controller['addTags']);router['put'](_0xe1bd('0xa'),auth[_0xe1bd('0x8')](),interaction['tracked'](_0xe1bd('0x13'),_0xe1bd('0x14')),controller[_0xe1bd('0x15')]);router[_0xe1bd('0x16')](_0xe1bd('0xa'),auth[_0xe1bd('0x8')](),interaction[_0xe1bd('0x17')](_0xe1bd('0x13'),_0xe1bd('0x18')),controller[_0xe1bd('0x19')]);router[_0xe1bd('0x16')]('/:id/tags',auth['isAuthenticated'](),controller['removeTags']);module[_0xe1bd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index bc28a03..7d3ceb3 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 _0x5759=['TEXT','ENUM','out','INTEGER','sequelize','BOOLEAN','DATE','STRING'];(function(_0x3d3e41,_0x225a72){var _0x1ad548=function(_0x3b5cde){while(--_0x3b5cde){_0x3d3e41['push'](_0x3d3e41['shift']());}};_0x1ad548(++_0x225a72);}(_0x5759,0x174));var _0x9575=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x5759[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require(_0x9575('0x0'));var iconv=require('iconv');module['exports']={'closed':{'type':Sequelize[_0x9575('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9575('0x2')]},'disposition':{'type':Sequelize[_0x9575('0x3')]},'secondDisposition':{'type':Sequelize[_0x9575('0x3')]},'thirdDisposition':{'type':Sequelize[_0x9575('0x3')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0x9575('0x3')](0x1fe)},'to':{'type':Sequelize[_0x9575('0x3')]},'cc':{'type':Sequelize[_0x9575('0x4')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0x9575('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x9575('0x2')]},'substatus':{'type':Sequelize[_0x9575('0x3')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0x9575('0x5')]('in',_0x9575('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9575('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x9575('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9575('0x1')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9575('0x7')]}}; \ No newline at end of file +var _0xb915=['out','INTEGER','sequelize','iconv','exports','DATE','STRING','TEXT','long','BOOLEAN','ENUM'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb915,0x183));var _0x5b91=function(_0xc0a3d3,_0x2c8d00){_0xc0a3d3=_0xc0a3d3-0x0;var _0x3386e8=_0xb915[_0xc0a3d3];return _0x3386e8;};'use strict';var Sequelize=require(_0x5b91('0x0'));var iconv=require(_0x5b91('0x1'));module[_0x5b91('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5b91('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x5b91('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x5b91('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x5b91('0x4')]},'cc':{'type':Sequelize[_0x5b91('0x5')](_0x5b91('0x6'))},'subject':{'type':Sequelize[_0x5b91('0x5')]()},'attach':{'type':Sequelize[_0x5b91('0x7')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x5b91('0x3')]},'substatus':{'type':Sequelize['STRING'](0x3c)},'substatusAt':{'type':Sequelize[_0x5b91('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x5b91('0x8')]('in',_0x5b91('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x5b91('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x5b91('0x8')]('in',_0x5b91('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5b91('0x7')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x5b91('0xa')]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index ad4710b..972b5a1 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 _0xb7b8=['toString','root','server','tmp','join','files','attachments','push','Attachment','Attachments','Messages','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','html-entities','redis','defaults','./mailInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','json','update','then','error','name','send','map','MailInteraction','rawAttributes','fieldName','type','key','findAll','mail','user','catch','show','params','model','query','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','find','create','body','destroy','describe','addMessage','MailMessage','ids','nolimit','sort','where','MailInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','inlineCss','rows','addTags','setTags','omit','spread','Tag','color','emit','mailInteractionTags:save','removeTags','download','unix'];(function(_0x25fef3,_0x2238b0){var _0x5d9ea1=function(_0x1b469e){while(--_0x1b469e){_0x25fef3['push'](_0x25fef3['shift']());}};_0x5d9ea1(++_0x2238b0);}(_0xb7b8,0x8a));var _0x8b7b=function(_0x5dd434,_0x3ae8c9){_0x5dd434=_0x5dd434-0x0;var _0x3f5a7a=_0xb7b8[_0x5dd434];return _0x3f5a7a;};'use strict';var emlformat=require(_0x8b7b('0x0'));var rimraf=require(_0x8b7b('0x1'));var zipdir=require(_0x8b7b('0x2'));var moment=require(_0x8b7b('0x3'));var BPromise=require(_0x8b7b('0x4'));var util=require('util');var path=require(_0x8b7b('0x5'));var fs=require('fs');var _=require(_0x8b7b('0x6'));var juice=require(_0x8b7b('0x7'));var Redis=require(_0x8b7b('0x8'));var interaction=require(_0x8b7b('0x9'));var qs=require(_0x8b7b('0xa'));var logger=require(_0x8b7b('0xb'))('api');var config=require(_0x8b7b('0xc'));var db=require(_0x8b7b('0xd'))['db'];var htmlEntities=require(_0x8b7b('0xe'));config[_0x8b7b('0xf')]=_[_0x8b7b('0x10')](config[_0x8b7b('0xf')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b7b('0xf')]));require(_0x8b7b('0x11'))[_0x8b7b('0x12')](socket);function respondWithStatusCode(_0x428d9d,_0xe59f71){_0xe59f71=_0xe59f71||0xcc;return function(_0x26830a){if(_0x26830a){return _0x428d9d[_0x8b7b('0x13')](_0xe59f71);}return _0x428d9d[_0x8b7b('0x14')](_0xe59f71)[_0x8b7b('0x15')]();};}function respondWithResult(_0x4e3e18,_0x2aec62){_0x2aec62=_0x2aec62||0xc8;return function(_0x85b8f){if(_0x85b8f){return _0x4e3e18[_0x8b7b('0x14')](_0x2aec62)['json'](_0x85b8f);}};}function respondWithFilteredResult(_0x2adfec,_0x320e83){return function(_0x3436f8){if(_0x3436f8){var _0xe277fa=typeof _0x320e83[_0x8b7b('0x16')]===_0x8b7b('0x17')&&typeof _0x320e83[_0x8b7b('0x18')]===_0x8b7b('0x17');var _0x2220ff=_0x3436f8[_0x8b7b('0x19')];var _0x6b7b87=_0xe277fa?0x0:_0x320e83[_0x8b7b('0x16')];var _0x7e3e83=_0xe277fa?_0x3436f8[_0x8b7b('0x19')]:_0x320e83['offset']+_0x320e83[_0x8b7b('0x18')];var _0xd87412;if(_0x7e3e83>=_0x2220ff){_0x7e3e83=_0x2220ff;_0xd87412=0xc8;}else{_0xd87412=0xce;}_0x2adfec[_0x8b7b('0x14')](_0xd87412);return _0x2adfec['set']('Content-Range',_0x6b7b87+'-'+_0x7e3e83+'/'+_0x2220ff)[_0x8b7b('0x1a')](_0x3436f8);}return null;};}function saveUpdates(_0x44584b){return function(_0x45d416){if(_0x45d416){return _0x45d416[_0x8b7b('0x1b')](_0x44584b)[_0x8b7b('0x1c')](function(_0x59620d){return _0x59620d;});}return null;};}function removeEntity(_0x4b7247){return function(_0x157e12){if(_0x157e12){return _0x157e12['destroy']()[_0x8b7b('0x1c')](function(){_0x4b7247[_0x8b7b('0x14')](0xcc)[_0x8b7b('0x15')]();});}};}function handleEntityNotFound(_0x48461e){return function(_0x1cbc5e){if(!_0x1cbc5e){_0x48461e['sendStatus'](0x194);}return _0x1cbc5e;};}function handleError(_0x32c150,_0x2ccf24){_0x2ccf24=_0x2ccf24||0x1f4;return function(_0x40dc80){logger[_0x8b7b('0x1d')](_0x40dc80['stack']);if(_0x40dc80[_0x8b7b('0x1e')]){delete _0x40dc80[_0x8b7b('0x1e')];}_0x32c150[_0x8b7b('0x14')](_0x2ccf24)[_0x8b7b('0x1f')](_0x40dc80);};}exports['index']=function(_0x2bedf7,_0x5c93f6){var _0x3f896b={};var _0x27ea7d=_[_0x8b7b('0x20')](db[_0x8b7b('0x21')][_0x8b7b('0x22')],function(_0x56a037){return{'name':_0x56a037[_0x8b7b('0x23')],'type':_0x56a037[_0x8b7b('0x24')][_0x8b7b('0x25')]};});_0x3f896b=qs['getOptions'](_0x27ea7d,_0x2bedf7);return interaction[_0x8b7b('0x26')](_0x8b7b('0x27'),_0x2bedf7['query'],_0x2bedf7[_0x8b7b('0x28')],_0x3f896b,_0x27ea7d)[_0x8b7b('0x1c')](respondWithFilteredResult(_0x5c93f6,_0x3f896b))[_0x8b7b('0x29')](handleError(_0x5c93f6,null));};exports[_0x8b7b('0x2a')]=function(_0xb169ac,_0x2b90f8){var _0x3d7dc7={'raw':![],'where':{'id':_0xb169ac[_0x8b7b('0x2b')]['id']}},_0x75c6db={};_0x75c6db[_0x8b7b('0x2c')]=_['keys'](db[_0x8b7b('0x21')]['rawAttributes']);_0x75c6db[_0x8b7b('0x2d')]=_[_0x8b7b('0x2e')](_0xb169ac['query']);_0x75c6db[_0x8b7b('0x2f')]=_[_0x8b7b('0x30')](_0x75c6db[_0x8b7b('0x2c')],_0x75c6db['query']);_0x3d7dc7[_0x8b7b('0x31')]=_[_0x8b7b('0x30')](_0x75c6db[_0x8b7b('0x2c')],qs[_0x8b7b('0x32')](_0xb169ac[_0x8b7b('0x2d')][_0x8b7b('0x32')]));_0x3d7dc7[_0x8b7b('0x31')]=_0x3d7dc7['attributes'][_0x8b7b('0x33')]?_0x3d7dc7[_0x8b7b('0x31')]:_0x75c6db['model'];if(_0xb169ac[_0x8b7b('0x2d')][_0x8b7b('0x34')]){_0x3d7dc7['include']=[{'all':!![]}];}_0x3d7dc7=_[_0x8b7b('0x35')]({},_0x3d7dc7,_0xb169ac[_0x8b7b('0x36')]);return db[_0x8b7b('0x21')][_0x8b7b('0x37')](_0x3d7dc7)[_0x8b7b('0x1c')](handleEntityNotFound(_0x2b90f8,null))[_0x8b7b('0x1c')](respondWithResult(_0x2b90f8,null))[_0x8b7b('0x29')](handleError(_0x2b90f8,null));};exports[_0x8b7b('0x38')]=function(_0x346f9a,_0x35a0ca){return db[_0x8b7b('0x21')][_0x8b7b('0x38')](_0x346f9a['body'],{})[_0x8b7b('0x1c')](respondWithResult(_0x35a0ca,0xc9))[_0x8b7b('0x29')](handleError(_0x35a0ca,null));};exports[_0x8b7b('0x1b')]=function(_0x5456b9,_0x3f0157){if(_0x5456b9[_0x8b7b('0x39')]['id']){delete _0x5456b9[_0x8b7b('0x39')]['id'];}return db[_0x8b7b('0x21')]['find']({'where':{'id':_0x5456b9[_0x8b7b('0x2b')]['id']}})[_0x8b7b('0x1c')](handleEntityNotFound(_0x3f0157,null))[_0x8b7b('0x1c')](saveUpdates(_0x5456b9[_0x8b7b('0x39')],null))['then'](respondWithResult(_0x3f0157,null))[_0x8b7b('0x29')](handleError(_0x3f0157,null));};exports[_0x8b7b('0x3a')]=function(_0x4e1de7,_0xa9ab2a){return db['MailInteraction'][_0x8b7b('0x37')]({'where':{'id':_0x4e1de7[_0x8b7b('0x2b')]['id']}})[_0x8b7b('0x1c')](handleEntityNotFound(_0xa9ab2a,null))[_0x8b7b('0x1c')](removeEntity(_0xa9ab2a,null))[_0x8b7b('0x29')](handleError(_0xa9ab2a,null));};exports[_0x8b7b('0x3b')]=function(_0x8e7fe7,_0xb8cc30){return db[_0x8b7b('0x21')][_0x8b7b('0x3b')]()[_0x8b7b('0x1c')](respondWithResult(_0xb8cc30,null))[_0x8b7b('0x29')](handleError(_0xb8cc30,null));};exports[_0x8b7b('0x3c')]=function(_0x56220f,_0x13cbbd){return db[_0x8b7b('0x3d')][_0x8b7b('0x37')]({'where':{'id':_0x56220f['params']['id']}})['then'](handleEntityNotFound(_0x13cbbd,null))['then'](function(_0x1eeaae){if(_0x1eeaae){return _0x1eeaae[_0x8b7b('0x3c')](_0x56220f[_0x8b7b('0x39')][_0x8b7b('0x3e')],_['omit'](_0x56220f[_0x8b7b('0x39')],[_0x8b7b('0x3e'),'id'])||{});}})[_0x8b7b('0x1c')](respondWithResult(_0x13cbbd,null))['catch'](handleError(_0x13cbbd,null));};exports['getMessages']=function(_0x38203c,_0x248883){var _0x9c12dc={'raw':![],'where':{}};var _0x53b930={};var _0x45ac88={'count':0x0,'rows':[]};return db[_0x8b7b('0x21')]['findOne']({'where':{'id':_0x38203c[_0x8b7b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x248883,null))[_0x8b7b('0x1c')](function(_0x3993cf){if(_0x3993cf){_0x53b930['model']=_['keys'](db[_0x8b7b('0x3d')][_0x8b7b('0x22')]);_0x53b930['query']=_[_0x8b7b('0x2e')](_0x38203c[_0x8b7b('0x2d')]);_0x53b930[_0x8b7b('0x2f')]=_[_0x8b7b('0x30')](_0x53b930[_0x8b7b('0x2c')],_0x53b930[_0x8b7b('0x2d')]);_0x9c12dc[_0x8b7b('0x31')]=_['intersection'](_0x53b930[_0x8b7b('0x2c')],qs[_0x8b7b('0x32')](_0x38203c[_0x8b7b('0x2d')]['fields']));_0x9c12dc['attributes']=_0x9c12dc[_0x8b7b('0x31')][_0x8b7b('0x33')]?_0x9c12dc['attributes']:_0x53b930[_0x8b7b('0x2c')];if(!_0x38203c['query']['hasOwnProperty'](_0x8b7b('0x3f'))){_0x9c12dc['limit']=qs[_0x8b7b('0x18')](_0x38203c['query'][_0x8b7b('0x18')]);_0x9c12dc['offset']=qs['offset'](_0x38203c[_0x8b7b('0x2d')][_0x8b7b('0x16')]);}_0x9c12dc['order']=qs[_0x8b7b('0x40')](_0x38203c[_0x8b7b('0x2d')]['sort']);_0x9c12dc[_0x8b7b('0x41')]=qs[_0x8b7b('0x2f')](_['pick'](_0x38203c[_0x8b7b('0x2d')],_0x53b930[_0x8b7b('0x2f')]));_0x9c12dc['where'][_0x8b7b('0x42')]=_0x3993cf['id'];if(_0x38203c[_0x8b7b('0x2d')][_0x8b7b('0x43')]){_0x9c12dc['where']=_[_0x8b7b('0x35')](_0x9c12dc[_0x8b7b('0x41')],{'$or':_[_0x8b7b('0x20')](_0x9c12dc[_0x8b7b('0x31')],function(_0x33888f){var _0x18bc3e={};_0x18bc3e[_0x33888f]={'$like':'%'+_0x38203c[_0x8b7b('0x2d')][_0x8b7b('0x43')]+'%'};return _0x18bc3e;})});}if(_0x38203c['query']['$gte']){var _0x2cc4ef=_0x38203c[_0x8b7b('0x2d')][_0x8b7b('0x44')][_0x8b7b('0x45')](',');var _0x222020={};_0x222020[_0x2cc4ef[0x0]]={'$gte':moment(_0x2cc4ef[0x1])[_0x8b7b('0x46')](_0x8b7b('0x47'))};_0x9c12dc['where']=_[_0x8b7b('0x35')](_0x9c12dc[_0x8b7b('0x41')],_0x222020);}_0x9c12dc=_['merge']({},_0x9c12dc,_0x38203c[_0x8b7b('0x36')]);return db['MailMessage'][_0x8b7b('0x19')]({'where':_0x9c12dc[_0x8b7b('0x41')]})[_0x8b7b('0x1c')](function(_0x3dea34){_0x45ac88[_0x8b7b('0x19')]=_0x3dea34;if(_0x38203c[_0x8b7b('0x2d')][_0x8b7b('0x34')]){_0x9c12dc[_0x8b7b('0x48')]=[{'all':!![]}];}return db[_0x8b7b('0x3d')][_0x8b7b('0x26')](_0x9c12dc);})['then'](function(_0x5dcbd7){if(_0x38203c['query'][_0x8b7b('0x49')]==='true'){for(var _0x7d29d=0x0;_0x7d29d<_0x5dcbd7[_0x8b7b('0x33')];_0x7d29d++){_0x5dcbd7[_0x7d29d][_0x8b7b('0x39')]=juice(_0x5dcbd7[_0x7d29d]['body']);}}_0x45ac88[_0x8b7b('0x4a')]=_0x5dcbd7;return _0x45ac88;});}})[_0x8b7b('0x1c')](respondWithFilteredResult(_0x248883,_0x9c12dc))[_0x8b7b('0x29')](handleError(_0x248883,null));};exports[_0x8b7b('0x4b')]=function(_0xaa993f,_0x4d4fba){return db['MailInteraction'][_0x8b7b('0x37')]({'where':{'id':_0xaa993f['params']['id']}})[_0x8b7b('0x1c')](handleEntityNotFound(_0x4d4fba,null))[_0x8b7b('0x1c')](function(_0x3bb419){if(_0x3bb419){return _0x3bb419[_0x8b7b('0x4c')](_0xaa993f[_0x8b7b('0x39')][_0x8b7b('0x3e')],_[_0x8b7b('0x4d')](_0xaa993f[_0x8b7b('0x39')],[_0x8b7b('0x3e'),'id'])||{})[_0x8b7b('0x4e')](function(){return db[_0x8b7b('0x4f')]['findAll']({'attributes':['id','name',_0x8b7b('0x50')],'where':{'id':_0xaa993f['body']['ids']}});})[_0x8b7b('0x1c')](function(_0xdab480){socket[_0x8b7b('0x51')](_0x8b7b('0x52'),{'id':Number(_0xaa993f[_0x8b7b('0x2b')]['id']),'tags':_0xdab480||[]});return{'id':Number(_0xaa993f[_0x8b7b('0x2b')]['id']),'tags':_0xdab480||[]};});}})[_0x8b7b('0x1c')](respondWithResult(_0x4d4fba,null))['catch'](handleError(_0x4d4fba,null));};exports['removeTags']=function(_0x12135c,_0x2ff25b){return db[_0x8b7b('0x21')][_0x8b7b('0x37')]({'where':{'id':_0x12135c[_0x8b7b('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2ff25b,null))[_0x8b7b('0x1c')](function(_0x5e0fee){if(_0x5e0fee){return _0x5e0fee[_0x8b7b('0x53')](_0x12135c[_0x8b7b('0x2d')][_0x8b7b('0x3e')]);}})[_0x8b7b('0x1c')](respondWithStatusCode(_0x2ff25b,null))[_0x8b7b('0x29')](handleError(_0x2ff25b,null));};exports[_0x8b7b('0x54')]=function(_0x36980f,_0x331812){var _0x3c0f6f=moment()[_0x8b7b('0x55')]()[_0x8b7b('0x56')]();var _0x5e1dac=path['join'](config[_0x8b7b('0x57')],_0x8b7b('0x58'),'files',_0x8b7b('0x59'));var _0x4879e7=path[_0x8b7b('0x5a')](config[_0x8b7b('0x57')],_0x8b7b('0x58'),_0x8b7b('0x5b'),_0x8b7b('0x5c'));var _0x24d517=path[_0x8b7b('0x5a')](_0x5e1dac,_0x3c0f6f);var _0x2197b4=util[_0x8b7b('0x46')]('transcript-%d-%s.zip',_0x36980f[_0x8b7b('0x2b')]['id'],_0x3c0f6f);var _0x42734b=path[_0x8b7b('0x5a')](_0x5e1dac,_0x2197b4);var _0x14cd36=[];if(_0x36980f[_0x8b7b('0x2d')][_0x8b7b('0x5c')]){_0x14cd36[_0x8b7b('0x5d')]({'model':db[_0x8b7b('0x5e')],'as':_0x8b7b('0x5f'),'raw':!![]});}var _0x55bc58=[{'model':db[_0x8b7b('0x3d')],'as':_0x8b7b('0x60'),'attributes':['id',_0x8b7b('0x39'),'from','to','cc','bcc',_0x8b7b('0x61'),_0x8b7b('0x62')],'where':{'secret':![]},'order':qs[_0x8b7b('0x40')]('id'),'include':_0x14cd36}];return db[_0x8b7b('0x21')][_0x8b7b('0x37')]({'where':{'id':_0x36980f[_0x8b7b('0x2b')]['id']},'include':_0x55bc58})[_0x8b7b('0x1c')](handleEntityNotFound(_0x331812,null))[_0x8b7b('0x1c')](function(_0x42c53b){if(_0x42c53b&&_0x42c53b[_0x8b7b('0x60')]){var _0x2bed85=_0x42c53b[_0x8b7b('0x63')]({'plain':!![]});fs[_0x8b7b('0x64')](_0x24d517);return BPromise[_0x8b7b('0x65')](_0x2bed85['Messages'],function(_0x986fb8,_0x22880e){var _0x30756b={'from':_0x986fb8['from'],'to':_0x986fb8['to']||_0x8b7b('0x66'),'subject':_0x986fb8['subject'],'html':htmlEntities['decode'](_0x986fb8['body']),'headers':{'Date':moment(_0x986fb8[_0x8b7b('0x62')])[_0x8b7b('0x46')](_0x8b7b('0x67'))},'attachments':[]};if(_0x986fb8['cc']){_0x30756b[_0x8b7b('0x68')]['Cc']=_0x986fb8['cc'];}if(_0x986fb8[_0x8b7b('0x69')]){_0x30756b[_0x8b7b('0x68')]['Bcc']=_0x986fb8['bcc'];}return new BPromise(function(_0x34d037,_0x1d1785){if(_0x986fb8[_0x8b7b('0x5f')]){for(var _0x22d932=0x0;_0x22d932<_0x986fb8[_0x8b7b('0x5f')][_0x8b7b('0x33')];_0x22d932++){var _0x1a7204=_0x986fb8['Attachments'][_0x22d932];var _0x40ca8d=path[_0x8b7b('0x5a')](_0x4879e7,_0x1a7204[_0x8b7b('0x6a')]);if(fs[_0x8b7b('0x6b')](_0x40ca8d)){_0x30756b[_0x8b7b('0x5c')]['push']({'name':_0x1a7204[_0x8b7b('0x1e')],'contentType':_0x1a7204[_0x8b7b('0x24')],'data':fs[_0x8b7b('0x6c')](_0x40ca8d)});}}}emlformat[_0x8b7b('0x6d')](_0x30756b,function(_0x1a2275,_0x3ba2ed){if(_0x1a2275)return _0x1d1785(_0x1a2275);fs[_0x8b7b('0x6e')](path[_0x8b7b('0x5a')](_0x24d517,util[_0x8b7b('0x46')](_0x8b7b('0x6f'),_0x22880e)),_0x3ba2ed);return _0x34d037(_0x3ba2ed);});});})[_0x8b7b('0x1c')](function(){return new BPromise(function(_0x5ea4e2,_0x46c51c){zipdir(_0x24d517,{'saveTo':_0x42734b},function(_0x291ddd,_0x32ca54){if(_0x291ddd)return _0x46c51c(_0x291ddd);return _0x5ea4e2(_0x32ca54);});})[_0x8b7b('0x1c')](function(){return new BPromise(function(_0x3eb72c,_0x40b849){rimraf(_0x24d517,function(_0x13dee4){if(_0x13dee4)_0x40b849(_0x13dee4);return _0x3eb72c();});});})[_0x8b7b('0x1c')](function(){return _0x331812[_0x8b7b('0x54')](_0x42734b,_0x2197b4,function(_0x7b8640){if(!_0x7b8640)fs['unlinkSync'](_0x42734b);});});});}else{return _0x331812[_0x8b7b('0x13')](0xc8);}})[_0x8b7b('0x29')](handleError(_0x331812,null));}; \ No newline at end of file +var _0x3ff4=['tmp','join','attachments','format','transcript-%d-%s.zip','push','Attachments','Messages','from','subject','createdAt','get','mkdirSync','each','missing.recipient@your.company.com','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','basename','type','readFileSync','build','unlinkSync','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','juice','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','./mailInteraction.socket','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','end','stack','name','send','rawAttributes','fieldName','key','getOptions','mail','query','user','catch','params','model','MailInteraction','keys','filters','intersection','attributes','fields','length','merge','options','create','body','find','describe','addMessage','MailMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','map','$gte','includeAll','include','findAll','inlineCss','true','rows','addTags','setTags','spread','Tag','color','mailInteractionTags:save','download','toString','root','server','files'];(function(_0x1c64a0,_0xac6406){var _0x5ea2d9=function(_0x2a045b){while(--_0x2a045b){_0x1c64a0['push'](_0x1c64a0['shift']());}};_0x5ea2d9(++_0xac6406);}(_0x3ff4,0xf5));var _0x43ff=function(_0x24f31b,_0x44b8f3){_0x24f31b=_0x24f31b-0x0;var _0x488401=_0x3ff4[_0x24f31b];return _0x488401;};'use strict';var emlformat=require(_0x43ff('0x0'));var rimraf=require(_0x43ff('0x1'));var zipdir=require(_0x43ff('0x2'));var moment=require(_0x43ff('0x3'));var BPromise=require(_0x43ff('0x4'));var util=require('util');var path=require(_0x43ff('0x5'));var fs=require('fs');var _=require(_0x43ff('0x6'));var juice=require(_0x43ff('0x7'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x43ff('0x8'));var logger=require(_0x43ff('0x9'))(_0x43ff('0xa'));var config=require(_0x43ff('0xb'));var db=require('../../mysqldb')['db'];var htmlEntities=require('html-entities');config['redis']=_['defaults'](config[_0x43ff('0xc')],{'host':_0x43ff('0xd'),'port':0x18eb});var socket=require(_0x43ff('0xe'))(new Redis(config[_0x43ff('0xc')]));require(_0x43ff('0xf'))['register'](socket);function respondWithStatusCode(_0x50e40e,_0x1485ee){_0x1485ee=_0x1485ee||0xcc;return function(_0x1a49ed){if(_0x1a49ed){return _0x50e40e[_0x43ff('0x10')](_0x1485ee);}return _0x50e40e[_0x43ff('0x11')](_0x1485ee)['end']();};}function respondWithResult(_0x8c1853,_0x1332c7){_0x1332c7=_0x1332c7||0xc8;return function(_0x50c714){if(_0x50c714){return _0x8c1853[_0x43ff('0x11')](_0x1332c7)[_0x43ff('0x12')](_0x50c714);}};}function respondWithFilteredResult(_0x32590e,_0x13a273){return function(_0x89e16f){if(_0x89e16f){var _0x4317f0=typeof _0x13a273[_0x43ff('0x13')]===_0x43ff('0x14')&&typeof _0x13a273[_0x43ff('0x15')]===_0x43ff('0x14');var _0x4b562a=_0x89e16f[_0x43ff('0x16')];var _0x80890a=_0x4317f0?0x0:_0x13a273[_0x43ff('0x13')];var _0x25c197=_0x4317f0?_0x89e16f[_0x43ff('0x16')]:_0x13a273[_0x43ff('0x13')]+_0x13a273[_0x43ff('0x15')];var _0x142caa;if(_0x25c197>=_0x4b562a){_0x25c197=_0x4b562a;_0x142caa=0xc8;}else{_0x142caa=0xce;}_0x32590e[_0x43ff('0x11')](_0x142caa);return _0x32590e['set'](_0x43ff('0x17'),_0x80890a+'-'+_0x25c197+'/'+_0x4b562a)[_0x43ff('0x12')](_0x89e16f);}return null;};}function saveUpdates(_0x45f960){return function(_0x1307ef){if(_0x1307ef){return _0x1307ef[_0x43ff('0x18')](_0x45f960)[_0x43ff('0x19')](function(_0x6f1ff4){return _0x6f1ff4;});}return null;};}function removeEntity(_0x5ae4c4){return function(_0x2f5c93){if(_0x2f5c93){return _0x2f5c93[_0x43ff('0x1a')]()[_0x43ff('0x19')](function(){_0x5ae4c4[_0x43ff('0x11')](0xcc)[_0x43ff('0x1b')]();});}};}function handleEntityNotFound(_0x1319eb){return function(_0x5193ee){if(!_0x5193ee){_0x1319eb[_0x43ff('0x10')](0x194);}return _0x5193ee;};}function handleError(_0x3dd7e0,_0x5a0973){_0x5a0973=_0x5a0973||0x1f4;return function(_0x1b8ae3){logger['error'](_0x1b8ae3[_0x43ff('0x1c')]);if(_0x1b8ae3[_0x43ff('0x1d')]){delete _0x1b8ae3[_0x43ff('0x1d')];}_0x3dd7e0[_0x43ff('0x11')](_0x5a0973)[_0x43ff('0x1e')](_0x1b8ae3);};}exports['index']=function(_0xbee9a8,_0x1502d5){var _0x2c239c={};var _0x3a4383=_['map'](db['MailInteraction'][_0x43ff('0x1f')],function(_0x2eda71){return{'name':_0x2eda71[_0x43ff('0x20')],'type':_0x2eda71['type'][_0x43ff('0x21')]};});_0x2c239c=qs[_0x43ff('0x22')](_0x3a4383,_0xbee9a8);return interaction['findAll'](_0x43ff('0x23'),_0xbee9a8[_0x43ff('0x24')],_0xbee9a8[_0x43ff('0x25')],_0x2c239c,_0x3a4383)['then'](respondWithFilteredResult(_0x1502d5,_0x2c239c))[_0x43ff('0x26')](handleError(_0x1502d5,null));};exports['show']=function(_0x1d7d66,_0x2632fd){var _0x576dda={'raw':![],'where':{'id':_0x1d7d66[_0x43ff('0x27')]['id']}},_0x420cfd={};_0x420cfd[_0x43ff('0x28')]=_['keys'](db[_0x43ff('0x29')]['rawAttributes']);_0x420cfd['query']=_[_0x43ff('0x2a')](_0x1d7d66['query']);_0x420cfd[_0x43ff('0x2b')]=_[_0x43ff('0x2c')](_0x420cfd[_0x43ff('0x28')],_0x420cfd[_0x43ff('0x24')]);_0x576dda[_0x43ff('0x2d')]=_[_0x43ff('0x2c')](_0x420cfd['model'],qs[_0x43ff('0x2e')](_0x1d7d66['query'][_0x43ff('0x2e')]));_0x576dda['attributes']=_0x576dda[_0x43ff('0x2d')][_0x43ff('0x2f')]?_0x576dda[_0x43ff('0x2d')]:_0x420cfd[_0x43ff('0x28')];if(_0x1d7d66[_0x43ff('0x24')]['includeAll']){_0x576dda['include']=[{'all':!![]}];}_0x576dda=_[_0x43ff('0x30')]({},_0x576dda,_0x1d7d66[_0x43ff('0x31')]);return db[_0x43ff('0x29')]['find'](_0x576dda)['then'](handleEntityNotFound(_0x2632fd,null))['then'](respondWithResult(_0x2632fd,null))['catch'](handleError(_0x2632fd,null));};exports[_0x43ff('0x32')]=function(_0x1539f9,_0x2b945a){return db[_0x43ff('0x29')][_0x43ff('0x32')](_0x1539f9[_0x43ff('0x33')],{})['then'](respondWithResult(_0x2b945a,0xc9))[_0x43ff('0x26')](handleError(_0x2b945a,null));};exports[_0x43ff('0x18')]=function(_0x522d73,_0x30a8bd){if(_0x522d73[_0x43ff('0x33')]['id']){delete _0x522d73[_0x43ff('0x33')]['id'];}return db[_0x43ff('0x29')][_0x43ff('0x34')]({'where':{'id':_0x522d73[_0x43ff('0x27')]['id']}})[_0x43ff('0x19')](handleEntityNotFound(_0x30a8bd,null))[_0x43ff('0x19')](saveUpdates(_0x522d73['body'],null))[_0x43ff('0x19')](respondWithResult(_0x30a8bd,null))[_0x43ff('0x26')](handleError(_0x30a8bd,null));};exports[_0x43ff('0x1a')]=function(_0x157251,_0x5ed16c){return db[_0x43ff('0x29')][_0x43ff('0x34')]({'where':{'id':_0x157251[_0x43ff('0x27')]['id']}})[_0x43ff('0x19')](handleEntityNotFound(_0x5ed16c,null))[_0x43ff('0x19')](removeEntity(_0x5ed16c,null))[_0x43ff('0x26')](handleError(_0x5ed16c,null));};exports[_0x43ff('0x35')]=function(_0x10cbdc,_0x3e0ac9){return db[_0x43ff('0x29')][_0x43ff('0x35')]()[_0x43ff('0x19')](respondWithResult(_0x3e0ac9,null))[_0x43ff('0x26')](handleError(_0x3e0ac9,null));};exports[_0x43ff('0x36')]=function(_0x1d328a,_0x402c15){return db[_0x43ff('0x37')]['find']({'where':{'id':_0x1d328a['params']['id']}})[_0x43ff('0x19')](handleEntityNotFound(_0x402c15,null))[_0x43ff('0x19')](function(_0x994565){if(_0x994565){return _0x994565[_0x43ff('0x36')](_0x1d328a['body']['ids'],_[_0x43ff('0x38')](_0x1d328a['body'],[_0x43ff('0x39'),'id'])||{});}})['then'](respondWithResult(_0x402c15,null))['catch'](handleError(_0x402c15,null));};exports[_0x43ff('0x3a')]=function(_0x4d76c0,_0x2e4824){var _0x1c404a={'raw':![],'where':{}};var _0x51238b={};var _0x1a1e36={'count':0x0,'rows':[]};return db[_0x43ff('0x29')][_0x43ff('0x3b')]({'where':{'id':_0x4d76c0[_0x43ff('0x27')]['id']}})[_0x43ff('0x19')](handleEntityNotFound(_0x2e4824,null))['then'](function(_0x36492c){if(_0x36492c){_0x51238b[_0x43ff('0x28')]=_['keys'](db[_0x43ff('0x37')]['rawAttributes']);_0x51238b[_0x43ff('0x24')]=_['keys'](_0x4d76c0[_0x43ff('0x24')]);_0x51238b['filters']=_[_0x43ff('0x2c')](_0x51238b[_0x43ff('0x28')],_0x51238b['query']);_0x1c404a[_0x43ff('0x2d')]=_[_0x43ff('0x2c')](_0x51238b['model'],qs[_0x43ff('0x2e')](_0x4d76c0[_0x43ff('0x24')][_0x43ff('0x2e')]));_0x1c404a[_0x43ff('0x2d')]=_0x1c404a[_0x43ff('0x2d')][_0x43ff('0x2f')]?_0x1c404a[_0x43ff('0x2d')]:_0x51238b['model'];if(!_0x4d76c0['query'][_0x43ff('0x3c')](_0x43ff('0x3d'))){_0x1c404a['limit']=qs[_0x43ff('0x15')](_0x4d76c0[_0x43ff('0x24')][_0x43ff('0x15')]);_0x1c404a['offset']=qs[_0x43ff('0x13')](_0x4d76c0[_0x43ff('0x24')][_0x43ff('0x13')]);}_0x1c404a[_0x43ff('0x3e')]=qs[_0x43ff('0x3f')](_0x4d76c0[_0x43ff('0x24')][_0x43ff('0x3f')]);_0x1c404a[_0x43ff('0x40')]=qs[_0x43ff('0x2b')](_[_0x43ff('0x41')](_0x4d76c0['query'],_0x51238b['filters']));_0x1c404a[_0x43ff('0x40')]['MailInteractionId']=_0x36492c['id'];if(_0x4d76c0[_0x43ff('0x24')]['filter']){_0x1c404a[_0x43ff('0x40')]=_[_0x43ff('0x30')](_0x1c404a[_0x43ff('0x40')],{'$or':_[_0x43ff('0x42')](_0x1c404a[_0x43ff('0x2d')],function(_0x155085){var _0x61bf79={};_0x61bf79[_0x155085]={'$like':'%'+_0x4d76c0['query']['filter']+'%'};return _0x61bf79;})});}if(_0x4d76c0[_0x43ff('0x24')][_0x43ff('0x43')]){var _0x48f172=_0x4d76c0[_0x43ff('0x24')][_0x43ff('0x43')]['split'](',');var _0x143b29={};_0x143b29[_0x48f172[0x0]]={'$gte':moment(_0x48f172[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x1c404a[_0x43ff('0x40')]=_['merge'](_0x1c404a[_0x43ff('0x40')],_0x143b29);}_0x1c404a=_[_0x43ff('0x30')]({},_0x1c404a,_0x4d76c0['options']);return db['MailMessage']['count']({'where':_0x1c404a[_0x43ff('0x40')]})[_0x43ff('0x19')](function(_0x53462d){_0x1a1e36[_0x43ff('0x16')]=_0x53462d;if(_0x4d76c0['query'][_0x43ff('0x44')]){_0x1c404a[_0x43ff('0x45')]=[{'all':!![]}];}return db[_0x43ff('0x37')][_0x43ff('0x46')](_0x1c404a);})[_0x43ff('0x19')](function(_0x4eca58){if(_0x4d76c0[_0x43ff('0x24')][_0x43ff('0x47')]===_0x43ff('0x48')){for(var _0x406062=0x0;_0x406062<_0x4eca58['length'];_0x406062++){_0x4eca58[_0x406062][_0x43ff('0x33')]=juice(_0x4eca58[_0x406062][_0x43ff('0x33')]);}}_0x1a1e36[_0x43ff('0x49')]=_0x4eca58;return _0x1a1e36;});}})['then'](respondWithFilteredResult(_0x2e4824,_0x1c404a))['catch'](handleError(_0x2e4824,null));};exports[_0x43ff('0x4a')]=function(_0xd4d30e,_0x57de87){return db[_0x43ff('0x29')][_0x43ff('0x34')]({'where':{'id':_0xd4d30e[_0x43ff('0x27')]['id']}})[_0x43ff('0x19')](handleEntityNotFound(_0x57de87,null))[_0x43ff('0x19')](function(_0x3fc31e){if(_0x3fc31e){return _0x3fc31e[_0x43ff('0x4b')](_0xd4d30e['body'][_0x43ff('0x39')],_[_0x43ff('0x38')](_0xd4d30e[_0x43ff('0x33')],[_0x43ff('0x39'),'id'])||{})[_0x43ff('0x4c')](function(){return db[_0x43ff('0x4d')][_0x43ff('0x46')]({'attributes':['id','name',_0x43ff('0x4e')],'where':{'id':_0xd4d30e[_0x43ff('0x33')][_0x43ff('0x39')]}});})[_0x43ff('0x19')](function(_0x18bd99){socket['emit'](_0x43ff('0x4f'),{'id':Number(_0xd4d30e[_0x43ff('0x27')]['id']),'tags':_0x18bd99||[]});return{'id':Number(_0xd4d30e[_0x43ff('0x27')]['id']),'tags':_0x18bd99||[]};});}})['then'](respondWithResult(_0x57de87,null))[_0x43ff('0x26')](handleError(_0x57de87,null));};exports['removeTags']=function(_0x431eb7,_0x5d4f65){return db[_0x43ff('0x29')][_0x43ff('0x34')]({'where':{'id':_0x431eb7[_0x43ff('0x27')]['id']}})[_0x43ff('0x19')](handleEntityNotFound(_0x5d4f65,null))[_0x43ff('0x19')](function(_0x20ffbf){if(_0x20ffbf){return _0x20ffbf['removeTags'](_0x431eb7[_0x43ff('0x24')][_0x43ff('0x39')]);}})[_0x43ff('0x19')](respondWithStatusCode(_0x5d4f65,null))[_0x43ff('0x26')](handleError(_0x5d4f65,null));};exports[_0x43ff('0x50')]=function(_0x4e51a8,_0x492fda){var _0x39bc05=moment()['unix']()[_0x43ff('0x51')]();var _0x119484=path['join'](config[_0x43ff('0x52')],_0x43ff('0x53'),_0x43ff('0x54'),_0x43ff('0x55'));var _0x1ed72b=path[_0x43ff('0x56')](config[_0x43ff('0x52')],_0x43ff('0x53'),'files',_0x43ff('0x57'));var _0x592fb7=path[_0x43ff('0x56')](_0x119484,_0x39bc05);var _0x3273ca=util[_0x43ff('0x58')](_0x43ff('0x59'),_0x4e51a8[_0x43ff('0x27')]['id'],_0x39bc05);var _0x46ea32=path['join'](_0x119484,_0x3273ca);var _0x812f65=[];if(_0x4e51a8[_0x43ff('0x24')][_0x43ff('0x57')]){_0x812f65[_0x43ff('0x5a')]({'model':db['Attachment'],'as':_0x43ff('0x5b'),'raw':!![]});}var _0x5bb397=[{'model':db[_0x43ff('0x37')],'as':_0x43ff('0x5c'),'attributes':['id',_0x43ff('0x33'),_0x43ff('0x5d'),'to','cc','bcc',_0x43ff('0x5e'),_0x43ff('0x5f')],'where':{'secret':![]},'order':qs[_0x43ff('0x3f')]('id'),'include':_0x812f65}];return db[_0x43ff('0x29')][_0x43ff('0x34')]({'where':{'id':_0x4e51a8[_0x43ff('0x27')]['id']},'include':_0x5bb397})[_0x43ff('0x19')](handleEntityNotFound(_0x492fda,null))[_0x43ff('0x19')](function(_0x3c826d){if(_0x3c826d&&_0x3c826d[_0x43ff('0x5c')]){var _0xe628d3=_0x3c826d[_0x43ff('0x60')]({'plain':!![]});fs[_0x43ff('0x61')](_0x592fb7);return BPromise[_0x43ff('0x62')](_0xe628d3[_0x43ff('0x5c')],function(_0x2ed4ac,_0x851dd9){var _0x42f877={'from':_0x2ed4ac[_0x43ff('0x5d')],'to':_0x2ed4ac['to']||_0x43ff('0x63'),'subject':_0x2ed4ac[_0x43ff('0x5e')],'html':htmlEntities[_0x43ff('0x64')](_0x2ed4ac[_0x43ff('0x33')]),'headers':{'Date':moment(_0x2ed4ac[_0x43ff('0x5f')])[_0x43ff('0x58')](_0x43ff('0x65'))},'attachments':[]};if(_0x2ed4ac['cc']){_0x42f877[_0x43ff('0x66')]['Cc']=_0x2ed4ac['cc'];}if(_0x2ed4ac[_0x43ff('0x67')]){_0x42f877['headers'][_0x43ff('0x68')]=_0x2ed4ac[_0x43ff('0x67')];}return new BPromise(function(_0x37e51b,_0x4fd8aa){if(_0x2ed4ac[_0x43ff('0x5b')]){for(var _0xce6e22=0x0;_0xce6e22<_0x2ed4ac[_0x43ff('0x5b')][_0x43ff('0x2f')];_0xce6e22++){var _0x5c37f1=_0x2ed4ac[_0x43ff('0x5b')][_0xce6e22];var _0x201c34=path['join'](_0x1ed72b,_0x5c37f1[_0x43ff('0x69')]);if(fs['existsSync'](_0x201c34)){_0x42f877[_0x43ff('0x57')][_0x43ff('0x5a')]({'name':_0x5c37f1[_0x43ff('0x1d')],'contentType':_0x5c37f1[_0x43ff('0x6a')],'data':fs[_0x43ff('0x6b')](_0x201c34)});}}}emlformat[_0x43ff('0x6c')](_0x42f877,function(_0xa568d9,_0x3d8f10){if(_0xa568d9)return _0x4fd8aa(_0xa568d9);fs['writeFileSync'](path[_0x43ff('0x56')](_0x592fb7,util[_0x43ff('0x58')]('message%d.eml',_0x851dd9)),_0x3d8f10);return _0x37e51b(_0x3d8f10);});});})[_0x43ff('0x19')](function(){return new BPromise(function(_0x136185,_0x3a2f61){zipdir(_0x592fb7,{'saveTo':_0x46ea32},function(_0x11a65e,_0x5a527e){if(_0x11a65e)return _0x3a2f61(_0x11a65e);return _0x136185(_0x5a527e);});})['then'](function(){return new BPromise(function(_0x361e4f,_0x1f77c4){rimraf(_0x592fb7,function(_0x1d2596){if(_0x1d2596)_0x1f77c4(_0x1d2596);return _0x361e4f();});});})[_0x43ff('0x19')](function(){return _0x492fda['download'](_0x46ea32,_0x3273ca,function(_0x57c0b4){if(!_0x57c0b4)fs[_0x43ff('0x6d')](_0x46ea32);});});});}else{return _0x492fda[_0x43ff('0x10')](0xc8);}})[_0x43ff('0x26')](handleError(_0x492fda,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index c1a4f15..f2c91b0 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 _0x255d=['update','remove','getUsers','then','setDataValue','Users','findAll','length','emit','catch','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners'];(function(_0x4ecedb,_0x2dffa3){var _0x3544cc=function(_0x107383){while(--_0x107383){_0x4ecedb['push'](_0x4ecedb['shift']());}};_0x3544cc(++_0x2dffa3);}(_0x255d,0xc1));var _0xd255=function(_0xd67296,_0x2cbbc9){_0xd67296=_0xd67296-0x0;var _0x45cd4e=_0x255d[_0xd67296];return _0x45cd4e;};'use strict';var EventEmitter=require(_0xd255('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0xd255('0x1')];var MailMessage=require(_0xd255('0x2'))['db'][_0xd255('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xd255('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xd255('0x5'),'afterDestroy':_0xd255('0x6')};function emitEvent(_0x419f45){return function(_0x39548b,_0x176c51,_0x20c5bb){_0x39548b[_0xd255('0x7')]({'attributes':['id'],'raw':!![]})[_0xd255('0x8')](function(_0xf3facd){_0x39548b[_0xd255('0x9')](_0xd255('0xa'),_0xf3facd['map'](function(_0x2c7ba2){return{'id':_0x2c7ba2['id']};}));return MailMessage[_0xd255('0xb')]({'where':{'MailInteractionId':_0x39548b['id'],'direction':'in','read':![]},'raw':!![]});})[_0xd255('0x8')](function(_0x2635a2){_0x39548b[_0xd255('0x9')]('unreadMessages',_0x2635a2[_0xd255('0xc')]);MailInteractionEvents['emit'](_0x419f45+':'+_0x39548b['id'],_0x39548b);MailInteractionEvents[_0xd255('0xd')](_0x419f45,_0x39548b);_0x20c5bb(null);})[_0xd255('0xe')](_0x20c5bb(null));};}for(var e in events){if(events[_0xd255('0xf')](e)){var event=events[e];MailInteraction[_0xd255('0x10')](e,emitEvent(event));}}module[_0xd255('0x11')]=MailInteractionEvents; \ No newline at end of file +var _0xb33d=['remove','getUsers','setDataValue','Users','map','then','unreadMessages','length','catch','hook','exports','../../mysqldb','MailMessage','setMaxListeners','update'];(function(_0x3d9ffe,_0x42655e){var _0xf68164=function(_0x5e075a){while(--_0x5e075a){_0x3d9ffe['push'](_0x3d9ffe['shift']());}};_0xf68164(++_0x42655e);}(_0xb33d,0x128));var _0xdb33=function(_0x5e80a1,_0x5558fa){_0x5e80a1=_0x5e80a1-0x0;var _0x2290fc=_0xb33d[_0x5e80a1];return _0x2290fc;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db']['MailInteraction'];var MailMessage=require(_0xdb33('0x0'))['db'][_0xdb33('0x1')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0xdb33('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdb33('0x3'),'afterDestroy':_0xdb33('0x4')};function emitEvent(_0x2fd94b){return function(_0x5619ec,_0xeedfc5,_0x532e4c){_0x5619ec[_0xdb33('0x5')]({'attributes':['id'],'raw':!![]})['then'](function(_0x3bfd18){_0x5619ec[_0xdb33('0x6')](_0xdb33('0x7'),_0x3bfd18[_0xdb33('0x8')](function(_0x1ad352){return{'id':_0x1ad352['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5619ec['id'],'direction':'in','read':![]},'raw':!![]});})[_0xdb33('0x9')](function(_0x2c8270){_0x5619ec[_0xdb33('0x6')](_0xdb33('0xa'),_0x2c8270[_0xdb33('0xb')]);MailInteractionEvents['emit'](_0x2fd94b+':'+_0x5619ec['id'],_0x5619ec);MailInteractionEvents['emit'](_0x2fd94b,_0x5619ec);_0x532e4c(null);})[_0xdb33('0xc')](_0x532e4c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0xdb33('0xd')](e,emitEvent(event));}}module[_0xdb33('0xe')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index ac07a8e..e9b91ae 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 _0x000d=['closed','closedAt','models','get','MailMessage','update','catch','utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','MailInteraction','mail_interactions','FULLTEXT','substatus','substatusAt','format','changed','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x000d,0xc8));var _0xd000=function(_0x53a696,_0x580053){_0x53a696=_0x53a696-0x0;var _0x81db7a=_0x000d[_0x53a696];return _0x81db7a;};'use strict';var _=require(_0xd000('0x0'));var util=require('util');var logger=require(_0xd000('0x1'))(_0xd000('0x2'));var moment=require('moment');var BPromise=require(_0xd000('0x3'));var rp=require(_0xd000('0x4'));var fs=require('fs');var path=require(_0xd000('0x5'));var rimraf=require(_0xd000('0x6'));var config=require('../../config/environment');var attributes=require('./mailInteraction.attributes');module[_0xd000('0x7')]=function(_0x1eed34,_0x4b0984){return _0x1eed34['define'](_0xd000('0x8'),attributes,{'tableName':_0xd000('0x9'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':['subject','to'],'type':_0xd000('0xa')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x53d8e2,_0x5b9048,_0x4d72d9){if(_0x53d8e2[_0xd000('0xb')]){_0x53d8e2[_0xd000('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x53d8e2['closed']){_0x53d8e2['closedAt']=moment()[_0xd000('0xd')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4d72d9(null,_0x5b9048);},'beforeUpdate':function(_0x5c224c,_0x1fb984,_0x3980cc){if(_0x5c224c[_0xd000('0xe')]('substatus')){_0x5c224c[_0xd000('0xc')]=_0x5c224c[_0xd000('0xb')]?moment()[_0xd000('0xd')](_0xd000('0xf')):null;}if(_0x5c224c[_0xd000('0xe')](_0xd000('0x10'))){_0x5c224c[_0xd000('0x11')]=moment()[_0xd000('0xd')](_0xd000('0xf'));_0x5c224c['substatus']=null;_0x5c224c['substatusAt']=null;}_0x3980cc(null,_0x5c224c);},'afterUpdate':function(_0x558091,_0x2b5abb,_0x59d2e5){var _0xf46db6=_0x1eed34[_0xd000('0x12')];var _0x46cc9e=_0x558091[_0xd000('0x13')]({'plain':!![]});if(_0x46cc9e['closed']){return _0xf46db6[_0xd000('0x14')][_0xd000('0x15')]({'read':!![]},{'where':{'MailInteractionId':_0x46cc9e['id']}})['then'](function(){_0x59d2e5();})[_0xd000('0x16')](function(_0x2eacc1){_0x59d2e5(_0x2eacc1);});}else{_0x59d2e5();}}},'charset':_0xd000('0x17'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x59c4=['YYYY-MM-DD\x20HH:mm:ss','changed','models','get','MailMessage','update','then','catch','util','api','moment','bluebird','path','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','closed','closedAt'];(function(_0x1e2b63,_0x4ce707){var _0x76be2d=function(_0x3789ce){while(--_0x3789ce){_0x1e2b63['push'](_0x1e2b63['shift']());}};_0x76be2d(++_0x4ce707);}(_0x59c4,0xd8));var _0x459c=function(_0x10b472,_0x2208b1){_0x10b472=_0x10b472-0x0;var _0x3f0cf1=_0x59c4[_0x10b472];return _0x3f0cf1;};'use strict';var _=require('lodash');var util=require(_0x459c('0x0'));var logger=require('../../config/logger')(_0x459c('0x1'));var moment=require(_0x459c('0x2'));var BPromise=require(_0x459c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x459c('0x4'));var rimraf=require('rimraf');var config=require(_0x459c('0x5'));var attributes=require(_0x459c('0x6'));module[_0x459c('0x7')]=function(_0x55995a,_0x4ab77c){return _0x55995a['define'](_0x459c('0x8'),attributes,{'tableName':_0x459c('0x9'),'paranoid':![],'indexes':[{'name':_0x459c('0xa'),'fields':[_0x459c('0xb'),'to'],'type':_0x459c('0xc')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x390e17,_0x313a9a,_0x3e2241){if(_0x390e17[_0x459c('0xd')]){_0x390e17[_0x459c('0xe')]=moment()[_0x459c('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x390e17[_0x459c('0x10')]){_0x390e17[_0x459c('0x11')]=moment()['format'](_0x459c('0x12'));}_0x3e2241(null,_0x313a9a);},'beforeUpdate':function(_0x33b13a,_0x44cc25,_0x172efa){if(_0x33b13a[_0x459c('0x13')](_0x459c('0xd'))){_0x33b13a[_0x459c('0xe')]=_0x33b13a['substatus']?moment()[_0x459c('0xf')](_0x459c('0x12')):null;}if(_0x33b13a[_0x459c('0x13')]('closed')){_0x33b13a[_0x459c('0x11')]=moment()[_0x459c('0xf')](_0x459c('0x12'));_0x33b13a[_0x459c('0xd')]=null;_0x33b13a[_0x459c('0xe')]=null;}_0x172efa(null,_0x33b13a);},'afterUpdate':function(_0x153d72,_0x51c819,_0x1ce341){var _0x50ccce=_0x55995a[_0x459c('0x14')];var _0x529bfc=_0x153d72[_0x459c('0x15')]({'plain':!![]});if(_0x529bfc['closed']){return _0x50ccce[_0x459c('0x16')][_0x459c('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x529bfc['id']}})[_0x459c('0x18')](function(){_0x1ce341();})[_0x459c('0x19')](function(_0x3b1a20){_0x1ce341(_0x3b1a20);});}else{_0x1ce341();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 4eefd58..d55f967 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 _0x07d7=['AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./mailInteraction.socket','register','then','info','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','MailInteraction,\x20%s,\x20%s','message','result','UpdateMailInteraction','MailInteraction','update','body','options','raw','where','limit','debug','catch','AddTagsToMailInteraction','find','omit','ids','spread'];(function(_0x5a13d9,_0x322a85){var _0x3dd00d=function(_0x50d74c){while(--_0x50d74c){_0x5a13d9['push'](_0x5a13d9['shift']());}};_0x3dd00d(++_0x322a85);}(_0x07d7,0x85));var _0x707d=function(_0x442f02,_0x47d845){_0x442f02=_0x442f02-0x0;var _0xab6ef1=_0x07d7[_0x442f02];return _0xab6ef1;};'use strict';var _=require(_0x707d('0x0'));var util=require(_0x707d('0x1'));var moment=require(_0x707d('0x2'));var BPromise=require(_0x707d('0x3'));var rs=require(_0x707d('0x4'));var fs=require('fs');var Redis=require(_0x707d('0x5'));var db=require(_0x707d('0x6'))['db'];var utils=require(_0x707d('0x7'));var logger=require(_0x707d('0x8'))(_0x707d('0x9'));var config=require(_0x707d('0xa'));var jayson=require(_0x707d('0xb'));var client=jayson[_0x707d('0xc')][_0x707d('0xd')]({'port':0x232a});config[_0x707d('0xe')]=_[_0x707d('0xf')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x707d('0x10'))(new Redis(config[_0x707d('0xe')]));require(_0x707d('0x11'))[_0x707d('0x12')](socket);function respondWithRpcPromise(_0x51750,_0x5af425,_0x3f45f5){return new BPromise(function(_0x107bc3,_0xd87d5d){return client['request'](_0x51750,_0x3f45f5)[_0x707d('0x13')](function(_0x355ce4){logger[_0x707d('0x14')]('MailInteraction,\x20%s,\x20%s',_0x5af425,'request\x20sent');logger['debug'](_0x707d('0x15'),_0x5af425,_0x707d('0x16'),JSON[_0x707d('0x17')](_0x355ce4));if(_0x355ce4['error']){if(_0x355ce4[_0x707d('0x18')]['code']===0x1f4){logger[_0x707d('0x18')](_0x707d('0x19'),_0x5af425,_0x355ce4['error']['message']);return _0xd87d5d(_0x355ce4[_0x707d('0x18')]['message']);}logger[_0x707d('0x18')](_0x707d('0x19'),_0x5af425,_0x355ce4[_0x707d('0x18')][_0x707d('0x1a')]);return _0x107bc3(_0x355ce4[_0x707d('0x18')][_0x707d('0x1a')]);}else{logger[_0x707d('0x14')]('MailInteraction,\x20%s,\x20%s',_0x5af425,_0x707d('0x16'));_0x107bc3(_0x355ce4[_0x707d('0x1b')][_0x707d('0x1a')]);}})['catch'](function(_0x291864){logger[_0x707d('0x18')](_0x707d('0x19'),_0x5af425,_0x291864);_0xd87d5d(_0x291864);});});}exports[_0x707d('0x1c')]=function(_0x81f93f){var _0x178be9=this;return new Promise(function(_0xb7171a,_0x446629){return db[_0x707d('0x1d')][_0x707d('0x1e')](_0x81f93f[_0x707d('0x1f')],{'raw':_0x81f93f[_0x707d('0x20')]?_0x81f93f[_0x707d('0x20')][_0x707d('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x81f93f[_0x707d('0x20')]?_0x81f93f[_0x707d('0x20')][_0x707d('0x22')]||null:null,'attributes':_0x81f93f['options']?_0x81f93f[_0x707d('0x20')]['attributes']||null:null,'limit':_0x81f93f[_0x707d('0x20')]?_0x81f93f[_0x707d('0x20')][_0x707d('0x23')]||null:null})[_0x707d('0x13')](function(_0x12d4da){logger['info'](_0x707d('0x1c'),_0x81f93f);logger[_0x707d('0x24')](_0x707d('0x1c'),_0x81f93f,JSON[_0x707d('0x17')](_0x12d4da));_0xb7171a(_0x12d4da);})[_0x707d('0x25')](function(_0x26d4ee){logger[_0x707d('0x18')](_0x707d('0x1c'),_0x26d4ee[_0x707d('0x1a')],_0x81f93f);_0x446629(_0x178be9[_0x707d('0x18')](0x1f4,_0x26d4ee[_0x707d('0x1a')]));});});};exports[_0x707d('0x26')]=function(_0x2c5ace){return new Promise(function(_0x4274e9,_0x38b44b){return db[_0x707d('0x1d')][_0x707d('0x27')]({'where':_0x2c5ace[_0x707d('0x20')]?_0x2c5ace['options'][_0x707d('0x22')]||null:null})[_0x707d('0x13')](function(_0x1784ce){if(_0x1784ce){return _0x1784ce['addTags'](_0x2c5ace['body']['ids'],_[_0x707d('0x28')](_0x2c5ace[_0x707d('0x1f')],[_0x707d('0x29'),'id'])||{});}})[_0x707d('0x2a')](function(_0x177524){logger[_0x707d('0x14')](_0x707d('0x2b'),_0x2c5ace);logger[_0x707d('0x24')](_0x707d('0x2b'),_0x2c5ace,JSON[_0x707d('0x17')](_0x177524));_0x4274e9(_0x177524);})[_0x707d('0x25')](function(_0x455841){logger['error'](_0x707d('0x2b'),_0x455841[_0x707d('0x1a')],_0x2c5ace);_0x38b44b(_this[_0x707d('0x18')](0x1f4,_0x455841[_0x707d('0x1a')]));});});}; \ No newline at end of file +var _0x930b=['ioredis','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','MailInteraction,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','raw','attributes','limit','debug','find','where','addTags','ids','spread','AddTags','lodash','util','bluebird','randomstring'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x930b,0x106));var _0xb930=function(_0x57b106,_0x46b310){_0x57b106=_0x57b106-0x0;var _0x2452eb=_0x930b[_0x57b106];return _0x2452eb;};'use strict';var _=require(_0xb930('0x0'));var util=require(_0xb930('0x1'));var moment=require('moment');var BPromise=require(_0xb930('0x2'));var rs=require(_0xb930('0x3'));var fs=require('fs');var Redis=require(_0xb930('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb930('0x5'))(_0xb930('0x6'));var config=require(_0xb930('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb930('0x8')][_0xb930('0x9')]({'port':0x232a});config[_0xb930('0xa')]=_['defaults'](config[_0xb930('0xa')],{'host':_0xb930('0xb'),'port':0x18eb});var socket=require(_0xb930('0xc'))(new Redis(config[_0xb930('0xa')]));require(_0xb930('0xd'))['register'](socket);function respondWithRpcPromise(_0x4b9d0e,_0x373a77,_0x47c05a){return new BPromise(function(_0x400032,_0x117654){return client[_0xb930('0xe')](_0x4b9d0e,_0x47c05a)[_0xb930('0xf')](function(_0x28dcb0){logger[_0xb930('0x10')](_0xb930('0x11'),_0x373a77,_0xb930('0x12'));logger['debug']('MailInteraction,\x20%s,\x20%s,\x20%s',_0x373a77,_0xb930('0x12'),JSON['stringify'](_0x28dcb0));if(_0x28dcb0[_0xb930('0x13')]){if(_0x28dcb0[_0xb930('0x13')]['code']===0x1f4){logger[_0xb930('0x13')](_0xb930('0x11'),_0x373a77,_0x28dcb0[_0xb930('0x13')][_0xb930('0x14')]);return _0x117654(_0x28dcb0['error'][_0xb930('0x14')]);}logger[_0xb930('0x13')](_0xb930('0x11'),_0x373a77,_0x28dcb0[_0xb930('0x13')][_0xb930('0x14')]);return _0x400032(_0x28dcb0['error'][_0xb930('0x14')]);}else{logger[_0xb930('0x10')](_0xb930('0x11'),_0x373a77,_0xb930('0x12'));_0x400032(_0x28dcb0[_0xb930('0x15')][_0xb930('0x14')]);}})[_0xb930('0x16')](function(_0x435460){logger[_0xb930('0x13')](_0xb930('0x11'),_0x373a77,_0x435460);_0x117654(_0x435460);});});}exports[_0xb930('0x17')]=function(_0x56281b){var _0x134c7f=this;return new Promise(function(_0x5de749,_0x27b0d3){return db[_0xb930('0x18')][_0xb930('0x19')](_0x56281b[_0xb930('0x1a')],{'raw':_0x56281b[_0xb930('0x1b')]?_0x56281b['options'][_0xb930('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x56281b['options']?_0x56281b[_0xb930('0x1b')]['where']||null:null,'attributes':_0x56281b[_0xb930('0x1b')]?_0x56281b[_0xb930('0x1b')][_0xb930('0x1d')]||null:null,'limit':_0x56281b[_0xb930('0x1b')]?_0x56281b[_0xb930('0x1b')][_0xb930('0x1e')]||null:null})[_0xb930('0xf')](function(_0x599c76){logger[_0xb930('0x10')](_0xb930('0x17'),_0x56281b);logger[_0xb930('0x1f')](_0xb930('0x17'),_0x56281b,JSON['stringify'](_0x599c76));_0x5de749(_0x599c76);})[_0xb930('0x16')](function(_0x56f524){logger['error'](_0xb930('0x17'),_0x56f524[_0xb930('0x14')],_0x56281b);_0x27b0d3(_0x134c7f[_0xb930('0x13')](0x1f4,_0x56f524[_0xb930('0x14')]));});});};exports['AddTagsToMailInteraction']=function(_0x4206ea){return new Promise(function(_0x2b0cab,_0x4f79ef){return db[_0xb930('0x18')][_0xb930('0x20')]({'where':_0x4206ea[_0xb930('0x1b')]?_0x4206ea[_0xb930('0x1b')][_0xb930('0x21')]||null:null})[_0xb930('0xf')](function(_0x36a00e){if(_0x36a00e){return _0x36a00e[_0xb930('0x22')](_0x4206ea[_0xb930('0x1a')][_0xb930('0x23')],_['omit'](_0x4206ea[_0xb930('0x1a')],[_0xb930('0x23'),'id'])||{});}})[_0xb930('0x24')](function(_0x115df0){logger[_0xb930('0x10')]('AddTags',_0x4206ea);logger['debug'](_0xb930('0x25'),_0x4206ea,JSON['stringify'](_0x115df0));_0x2b0cab(_0x115df0);})[_0xb930('0x16')](function(_0x1c7e5a){logger[_0xb930('0x13')](_0xb930('0x25'),_0x1c7e5a[_0xb930('0x14')],_0x4206ea);_0x4f79ef(_this[_0xb930('0x13')](0x1f4,_0x1c7e5a[_0xb930('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 93ff706..404769d 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 _0xd58a=['length','mailInteraction:','./mailInteraction.events','save','emit','removeListener'];(function(_0x5b26cb,_0x527ab0){var _0x563d12=function(_0x472b38){while(--_0x472b38){_0x5b26cb['push'](_0x5b26cb['shift']());}};_0x563d12(++_0x527ab0);}(_0xd58a,0x14c));var _0xad58=function(_0x2f79ab,_0x177978){_0x2f79ab=_0x2f79ab-0x0;var _0x22d41c=_0xd58a[_0x2f79ab];return _0x22d41c;};'use strict';var MailInteractionEvents=require(_0xad58('0x0'));var events=[_0xad58('0x1'),'remove','update'];function createListener(_0x32b8f1,_0x16c69a){return function(_0x5106a7){_0x16c69a[_0xad58('0x2')](_0x32b8f1,_0x5106a7);};}function removeListener(_0x30be3d,_0x1f672d){return function(){MailInteractionEvents[_0xad58('0x3')](_0x30be3d,_0x1f672d);};}exports['register']=function(_0x2adcf9){for(var _0x1f6e77=0x0,_0x354ed7=events[_0xad58('0x4')];_0x1f6e77<_0x354ed7;_0x1f6e77++){var _0x3f21af=events[_0x1f6e77];var _0x1c237c=createListener(_0xad58('0x5')+_0x3f21af,_0x2adcf9);MailInteractionEvents['on'](_0x3f21af,_0x1c237c);}}; \ No newline at end of file +var _0x2b55=['length','mailInteraction:','./mailInteraction.events','save','remove','update','register'];(function(_0x14aba7,_0x44971f){var _0xd61156=function(_0x1bdd1b){while(--_0x1bdd1b){_0x14aba7['push'](_0x14aba7['shift']());}};_0xd61156(++_0x44971f);}(_0x2b55,0x95));var _0x52b5=function(_0x167c2a,_0x140850){_0x167c2a=_0x167c2a-0x0;var _0x352979=_0x2b55[_0x167c2a];return _0x352979;};'use strict';var MailInteractionEvents=require(_0x52b5('0x0'));var events=[_0x52b5('0x1'),_0x52b5('0x2'),_0x52b5('0x3')];function createListener(_0x250c97,_0x2a6acf){return function(_0x2600b7){_0x2a6acf['emit'](_0x250c97,_0x2600b7);};}function removeListener(_0x3b04a8,_0x4f173){return function(){MailInteractionEvents['removeListener'](_0x3b04a8,_0x4f173);};}exports[_0x52b5('0x4')]=function(_0x418e00){for(var _0x1a6d37=0x0,_0x57ec40=events[_0x52b5('0x5')];_0x1a6d37<_0x57ec40;_0x1a6d37++){var _0x2e9f72=events[_0x1a6d37];var _0x3f9b25=createListener(_0x52b5('0x6')+_0x2e9f72,_0x418e00);MailInteractionEvents['on'](_0x2e9f72,_0x3f9b25);}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/index.js b/server/api/mailInteractionHasTag/index.js index 1f16bdc..dc53557 100644 --- a/server/api/mailInteractionHasTag/index.js +++ b/server/api/mailInteractionHasTag/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x89b8=['Router','../../components/auth/service','./mailInteractionHasTag.controller','get','/describe','describe','exports','express'];(function(_0x1b975d,_0x3e78fc){var _0x1b7993=function(_0x396729){while(--_0x396729){_0x1b975d['push'](_0x1b975d['shift']());}};_0x1b7993(++_0x3e78fc);}(_0x89b8,0x19f));var _0x889b=function(_0x4cfc11,_0x18bb97){_0x4cfc11=_0x4cfc11-0x0;var _0x47b97f=_0x89b8[_0x4cfc11];return _0x47b97f;};'use strict';var express=require(_0x889b('0x0'));var router=express[_0x889b('0x1')]();var auth=require(_0x889b('0x2'));var controller=require(_0x889b('0x3'));router[_0x889b('0x4')](_0x889b('0x5'),auth['isAuthenticated'](),controller[_0x889b('0x6')]);module[_0x889b('0x7')]=router; \ No newline at end of file +var _0xf981=['Router','../../components/auth/service','get','describe','exports','express'];(function(_0x140202,_0x4245c7){var _0x3037c2=function(_0x525d19){while(--_0x525d19){_0x140202['push'](_0x140202['shift']());}};_0x3037c2(++_0x4245c7);}(_0xf981,0x1af));var _0x1f98=function(_0x7835e3,_0x21309b){_0x7835e3=_0x7835e3-0x0;var _0x1b296f=_0xf981[_0x7835e3];return _0x1b296f;};'use strict';var express=require(_0x1f98('0x0'));var router=express[_0x1f98('0x1')]();var auth=require(_0x1f98('0x2'));var controller=require('./mailInteractionHasTag.controller');router[_0x1f98('0x3')]('/describe',auth['isAuthenticated'](),controller[_0x1f98('0x4')]);module[_0x1f98('0x5')]=router; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js index c8f53ec..76f13aa 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x3e8098,_0xccabfc){var _0x4a72f9=function(_0x30d02d){while(--_0x30d02d){_0x3e8098['push'](_0x3e8098['shift']());}};_0x4a72f9(++_0xccabfc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file +var _0xa9e0=['catch','../../config/logger','api','../../mysqldb','json','error','name','status','describe','then'];(function(_0x411ab3,_0x2b8d1d){var _0x410bcf=function(_0x331359){while(--_0x331359){_0x411ab3['push'](_0x411ab3['shift']());}};_0x410bcf(++_0x2b8d1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var logger=require(_0x0a9e('0x0'))(_0x0a9e('0x1'));var db=require(_0x0a9e('0x2'))['db'];function respondWithResult(_0x5dd881,_0x550fbc){_0x550fbc=_0x550fbc||0xc8;return function(_0x18d5c9){if(_0x18d5c9){return _0x5dd881['status'](_0x550fbc)[_0x0a9e('0x3')](_0x18d5c9);}};}function handleError(_0x432180,_0x2ab90b){_0x2ab90b=_0x2ab90b||0x1f4;return function(_0x991246){logger[_0x0a9e('0x4')](_0x991246['stack']);if(_0x991246[_0x0a9e('0x5')]){delete _0x991246[_0x0a9e('0x5')];}_0x432180[_0x0a9e('0x6')](_0x2ab90b)['send'](_0x991246);};}exports['describe']=function(_0xe42b77,_0x56465b){return db['MailInteractionHasTag'][_0x0a9e('0x7')]()[_0x0a9e('0x8')](respondWithResult(_0x56465b,null))[_0x0a9e('0x9')](handleError(_0x56465b,null));}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.js index 9b0dec5..a601878 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb82=['INTEGER','sequelize'];(function(_0x1e7482,_0x5c6d65){var _0x43f4f6=function(_0x4c9aef){while(--_0x4c9aef){_0x1e7482['push'](_0x1e7482['shift']());}};_0x43f4f6(++_0x5c6d65);}(_0xbb82,0x143));var _0x2bb8=function(_0x315add,_0x5e9ace){_0x315add=_0x315add-0x0;var _0x40956b=_0xbb82[_0x315add];return _0x40956b;};'use strict';var Sequelize=require(_0x2bb8('0x0'));module['exports']={'MailInteractionId':{'type':Sequelize[_0x2bb8('0x1')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0x2bb8('0x1')],'defaultValue':null}}; \ No newline at end of file +var _0xca8f=['INTEGER','sequelize','exports'];(function(_0x3029ed,_0x5d617e){var _0x227757=function(_0x7585f3){while(--_0x7585f3){_0x3029ed['push'](_0x3029ed['shift']());}};_0x227757(++_0x5d617e);}(_0xca8f,0x1db));var _0xfca8=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xca8f[_0x3b0731];return _0x4204d7;};'use strict';var Sequelize=require(_0xfca8('0x0'));module[_0xfca8('0x1')]={'MailInteractionId':{'type':Sequelize[_0xfca8('0x2')],'primaryKey':!![]},'TagId':{'type':Sequelize[_0xfca8('0x2')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js index 80a582b..d935a33 100644 --- a/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js +++ b/server/api/mailInteractionHasTag/mailInteractionHasTag.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x90bb=['define','mail_interaction_has_tags','./mailInteractionHasTag','exports'];(function(_0x2eb35d,_0x4a7a45){var _0x1f9854=function(_0x5eb6f9){while(--_0x5eb6f9){_0x2eb35d['push'](_0x2eb35d['shift']());}};_0x1f9854(++_0x4a7a45);}(_0x90bb,0xf6));var _0xb90b=function(_0x924de0,_0x196369){_0x924de0=_0x924de0-0x0;var _0x480228=_0x90bb[_0x924de0];return _0x480228;};'use strict';var attributes=require(_0xb90b('0x0'));module[_0xb90b('0x1')]=function(_0x46bfdd){return _0x46bfdd[_0xb90b('0x2')]('MailInteractionHasTag',attributes,{'tableName':_0xb90b('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x372d=['define','MailInteractionHasTag','mail_interaction_has_tags','./mailInteractionHasTag'];(function(_0x351449,_0x152f5a){var _0x513969=function(_0x15cfc8){while(--_0x15cfc8){_0x351449['push'](_0x351449['shift']());}};_0x513969(++_0x152f5a);}(_0x372d,0x9f));var _0xd372=function(_0x78eeee,_0x53aceb){_0x78eeee=_0x78eeee-0x0;var _0x365b9a=_0x372d[_0x78eeee];return _0x365b9a;};'use strict';var attributes=require(_0xd372('0x0'));module['exports']=function(_0x2484b9){return _0x2484b9[_0xd372('0x1')](_0xd372('0x2'),attributes,{'tableName':_0xd372('0x3'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 8555ff1..6cf4038 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 _0x8aa7=['update','put','/:id/accept','accept','/:id/reject','reject','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','mailmessage:create','create'];(function(_0x55ef8b,_0x5deb5e){var _0x359c84=function(_0x437673){while(--_0x437673){_0x55ef8b['push'](_0x55ef8b['shift']());}};_0x359c84(++_0x5deb5e);}(_0x8aa7,0xb6));var _0x78aa=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x8aa7[_0x49d41c];return _0xb64c5f;};'use strict';var multer=require('multer');var util=require(_0x78aa('0x0'));var path=require(_0x78aa('0x1'));var timeout=require(_0x78aa('0x2'));var express=require(_0x78aa('0x3'));var router=express[_0x78aa('0x4')]();var fs_extra=require(_0x78aa('0x5'));var auth=require(_0x78aa('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x78aa('0x7'));var controller=require(_0x78aa('0x8'));router[_0x78aa('0x9')]('/',auth[_0x78aa('0xa')](),controller[_0x78aa('0xb')]);router[_0x78aa('0x9')](_0x78aa('0xc'),auth[_0x78aa('0xa')](),controller[_0x78aa('0xd')]);router[_0x78aa('0x9')](_0x78aa('0xe'),auth[_0x78aa('0xa')](),controller[_0x78aa('0xf')]);router[_0x78aa('0x9')](_0x78aa('0x10'),auth[_0x78aa('0xa')](),controller[_0x78aa('0x11')]);router[_0x78aa('0x12')]('/',auth[_0x78aa('0xa')](),interaction['tracked']('mail',_0x78aa('0x13')),controller[_0x78aa('0x14')]);router['put'](_0x78aa('0xe'),auth[_0x78aa('0xa')](),controller[_0x78aa('0x15')]);router[_0x78aa('0x16')](_0x78aa('0x17'),auth['isAuthenticated'](),controller[_0x78aa('0x18')]);router[_0x78aa('0x16')](_0x78aa('0x19'),auth[_0x78aa('0xa')](),controller[_0x78aa('0x1a')]);router['delete'](_0x78aa('0xe'),auth[_0x78aa('0xa')](),controller[_0x78aa('0x1b')]);module[_0x78aa('0x1c')]=router; \ No newline at end of file +var _0x2c59=['exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','download','tracked','create','put','update','/:id/accept','accept','/:id/reject','reject','delete'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x2c59,0xb7));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x92c5('0x0'));var timeout=require(_0x92c5('0x1'));var express=require(_0x92c5('0x2'));var router=express[_0x92c5('0x3')]();var fs_extra=require(_0x92c5('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x92c5('0x5'));var config=require(_0x92c5('0x6'));var controller=require(_0x92c5('0x7'));router[_0x92c5('0x8')]('/',auth[_0x92c5('0x9')](),controller[_0x92c5('0xa')]);router[_0x92c5('0x8')](_0x92c5('0xb'),auth[_0x92c5('0x9')](),controller[_0x92c5('0xc')]);router[_0x92c5('0x8')](_0x92c5('0xd'),auth[_0x92c5('0x9')](),controller[_0x92c5('0xe')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x92c5('0xf')]);router['post']('/',auth[_0x92c5('0x9')](),interaction[_0x92c5('0x10')]('mail','mailmessage:create'),controller[_0x92c5('0x11')]);router[_0x92c5('0x12')](_0x92c5('0xd'),auth['isAuthenticated'](),controller[_0x92c5('0x13')]);router[_0x92c5('0x12')](_0x92c5('0x14'),auth['isAuthenticated'](),controller[_0x92c5('0x15')]);router[_0x92c5('0x12')](_0x92c5('0x16'),auth[_0x92c5('0x9')](),controller[_0x92c5('0x17')]);router[_0x92c5('0x18')](_0x92c5('0xd'),auth[_0x92c5('0x9')](),controller['destroy']);module[_0x92c5('0x19')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index e13538d..5ba37d1 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 _0xbdb0=['out','STRING','INTEGER','DATE','Email','sequelize','lodash','TEXT','long','medium','ENUM'];(function(_0xdbb7cd,_0x25d816){var _0x2a50c1=function(_0x36910a){while(--_0x36910a){_0xdbb7cd['push'](_0xdbb7cd['shift']());}};_0x2a50c1(++_0x25d816);}(_0xbdb0,0x165));var _0x0bdb=function(_0x99facc,_0x548cd6){_0x99facc=_0x99facc-0x0;var _0xd39ed0=_0xbdb0[_0x99facc];return _0xd39ed0;};'use strict';var Sequelize=require(_0x0bdb('0x0'));var _=require(_0x0bdb('0x1'));module['exports']={'body':{'type':Sequelize[_0x0bdb('0x2')](_0x0bdb('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x0bdb('0x2')](_0x0bdb('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x0bdb('0x5')]('in',_0x0bdb('0x6')),'defaultValue':_0x0bdb('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x0bdb('0x7')](0x1fe)},'from':{'type':Sequelize[_0x0bdb('0x7')]},'to':{'type':Sequelize['TEXT']('long')},'cc':{'type':Sequelize[_0x0bdb('0x2')](_0x0bdb('0x3'))},'bcc':{'type':Sequelize[_0x0bdb('0x2')](_0x0bdb('0x3'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0x0bdb('0x8')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x0bdb('0x9')]},'originTo':{'type':Sequelize['TEXT'](_0x0bdb('0x3'))},'originCc':{'type':Sequelize[_0x0bdb('0x2')](_0x0bdb('0x3'))},'originChannel':{'type':Sequelize[_0x0bdb('0x5')](_0x0bdb('0xa'),'Chat'),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0x2d1a=['BOOLEAN','out','STRING','DATE','ENUM','Email','Chat','sequelize','TEXT','long','medium'];(function(_0x42ae96,_0x48c45b){var _0x5ada45=function(_0x1ccad8){while(--_0x1ccad8){_0x42ae96['push'](_0x42ae96['shift']());}};_0x5ada45(++_0x48c45b);}(_0x2d1a,0xe3));var _0xa2d1=function(_0x2868ec,_0x3aef29){_0x2868ec=_0x2868ec-0x0;var _0x2ad998=_0x2d1a[_0x2868ec];return _0x2ad998;};'use strict';var Sequelize=require(_0xa2d1('0x0'));var _=require('lodash');module['exports']={'body':{'type':Sequelize[_0xa2d1('0x1')](_0xa2d1('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xa2d1('0x1')](_0xa2d1('0x3'))},'read':{'type':Sequelize[_0xa2d1('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xa2d1('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xa2d1('0x6')](0x1fe)},'from':{'type':Sequelize[_0xa2d1('0x6')]},'to':{'type':Sequelize['TEXT'](_0xa2d1('0x2'))},'cc':{'type':Sequelize['TEXT'](_0xa2d1('0x2'))},'bcc':{'type':Sequelize[_0xa2d1('0x1')](_0xa2d1('0x2'))},'subject':{'type':Sequelize[_0xa2d1('0x1')]},'sentAt':{'type':Sequelize[_0xa2d1('0x7')]},'attach':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'secret':{'type':Sequelize[_0xa2d1('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xa2d1('0x7')]},'originTo':{'type':Sequelize[_0xa2d1('0x1')]('long')},'originCc':{'type':Sequelize['TEXT']('long')},'originChannel':{'type':Sequelize[_0xa2d1('0x8')](_0xa2d1('0x9'),_0xa2d1('0xa')),'defaultValue':_0xa2d1('0x9'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index dc12609..dc99583 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 _0x7119=['http','then','info','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','MailMessage,\x20%s,\x20%s','message','catch','status','offset','undefined','count','limit','set','Content-Range','json','update','destroy','end','sendStatus','stack','name','send','index','MailMessage','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','show','params','length','find','body','describe','create','direction','out','secret','split','MailAccount','MailAccountId','List','CmContact','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','server/files/attachments','Contacts','ListId','List\x20not\x20found','messageId','stringify','accept','mail','format','UserId','user','agent','get','MailInteraction','MailInteractionId','isNil','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','email','interface','SIP/%s','channel','event','fromString','reject','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','User','internal','motionChannel','EventManager','download','toString','root','server','files','message-%s.eml','from','bcc','subject','createdAt','Attachment','Attachments','decode','headers','Bcc','basename','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','lodash','ioredis','html-to-text','../../components/parsers/qs','api','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','client'];(function(_0x2ad833,_0x3fa5b9){var _0x4ec259=function(_0x1f8772){while(--_0x1f8772){_0x2ad833['push'](_0x2ad833['shift']());}};_0x4ec259(++_0x3fa5b9);}(_0x7119,0x126));var _0x9711=function(_0x248fc8,_0x121ebf){_0x248fc8=_0x248fc8-0x0;var _0x1ec5d1=_0x7119[_0x248fc8];return _0x1ec5d1;};'use strict';var emlformat=require(_0x9711('0x0'));var moment=require(_0x9711('0x1'));var BPromise=require('bluebird');var util=require('util');var path=require('path');var fs=require('fs');var _=require(_0x9711('0x2'));var Redis=require(_0x9711('0x3'));var htmlToText=require(_0x9711('0x4'));var qs=require(_0x9711('0x5'));var logger=require('../../config/logger')(_0x9711('0x6'));var interaction_log=require(_0x9711('0x7'))('mail-interactions');var config=require(_0x9711('0x8'));var db=require(_0x9711('0x9'))['db'];config[_0x9711('0xa')]=_[_0x9711('0xb')](config[_0x9711('0xa')],{'host':_0x9711('0xc'),'port':0x18eb});var socket=require(_0x9711('0xd'))(new Redis(config[_0x9711('0xa')]));var htmlEntities=require(_0x9711('0xe'));require(_0x9711('0xf'))[_0x9711('0x10')](socket);var jayson=require('jayson/promise');var client=jayson[_0x9711('0x11')][_0x9711('0x12')]({'port':0x232c});var client9003=jayson['client']['http']({'port':0x232b});var client9002=jayson[_0x9711('0x11')][_0x9711('0x12')]({'port':0x232a});function respondWithRpcPromise(_0x39c38f,_0x3462cd,_0x5b9705,_0x4e09c1){return new BPromise(function(_0x5a371c,_0x11d2df){var _0x5915aa=_0x4e09c1||client;return _0x5915aa['request'](_0x39c38f,_0x5b9705)[_0x9711('0x13')](function(_0x24b14b){logger[_0x9711('0x14')]('MailMessage,\x20%s,\x20%s',_0x3462cd,_0x9711('0x15'));logger[_0x9711('0x16')](_0x9711('0x17'),_0x3462cd,_0x9711('0x15'),JSON['stringify'](_0x24b14b));if(_0x24b14b[_0x9711('0x18')]){if(_0x24b14b[_0x9711('0x18')]['code']===0x1f4){logger[_0x9711('0x18')](_0x9711('0x19'),_0x3462cd,_0x24b14b['error'][_0x9711('0x1a')]);return _0x11d2df(_0x24b14b[_0x9711('0x18')][_0x9711('0x1a')]);}logger[_0x9711('0x18')](_0x9711('0x19'),_0x3462cd,_0x24b14b['error'][_0x9711('0x1a')]);return _0x5a371c(_0x24b14b[_0x9711('0x18')][_0x9711('0x1a')]);}else{logger[_0x9711('0x14')]('MailMessage,\x20%s,\x20%s',_0x3462cd,_0x9711('0x15'));_0x5a371c(_0x24b14b['result']['message']);}})[_0x9711('0x1b')](function(_0x531751){logger[_0x9711('0x18')]('MailMessage,\x20%s,\x20%s',_0x3462cd,_0x531751);_0x11d2df(_0x531751);});});}function respondWithResult(_0x5343d7,_0x22de3b){_0x22de3b=_0x22de3b||0xc8;return function(_0x1a02c5){if(_0x1a02c5){return _0x5343d7[_0x9711('0x1c')](_0x22de3b)['json'](_0x1a02c5);}};}function respondWithFilteredResult(_0x3bd033,_0x1fbbb6){return function(_0x3feebd){if(_0x3feebd){var _0x3b7940=typeof _0x1fbbb6[_0x9711('0x1d')]===_0x9711('0x1e')&&typeof _0x1fbbb6['limit']==='undefined';var _0x9ec7b8=_0x3feebd[_0x9711('0x1f')];var _0x1926d4=_0x3b7940?0x0:_0x1fbbb6[_0x9711('0x1d')];var _0xafa5=_0x3b7940?_0x3feebd[_0x9711('0x1f')]:_0x1fbbb6[_0x9711('0x1d')]+_0x1fbbb6[_0x9711('0x20')];var _0x423a82;if(_0xafa5>=_0x9ec7b8){_0xafa5=_0x9ec7b8;_0x423a82=0xc8;}else{_0x423a82=0xce;}_0x3bd033[_0x9711('0x1c')](_0x423a82);return _0x3bd033[_0x9711('0x21')](_0x9711('0x22'),_0x1926d4+'-'+_0xafa5+'/'+_0x9ec7b8)[_0x9711('0x23')](_0x3feebd);}return null;};}function saveUpdates(_0x199bec){return function(_0x314c53){if(_0x314c53){return _0x314c53[_0x9711('0x24')](_0x199bec)[_0x9711('0x13')](function(_0x8ebae3){return _0x8ebae3;});}return null;};}function removeEntity(_0x1da4a8){return function(_0x105faa){if(_0x105faa){return _0x105faa[_0x9711('0x25')]()['then'](function(){_0x1da4a8[_0x9711('0x1c')](0xcc)[_0x9711('0x26')]();});}};}function handleEntityNotFound(_0x5a6b94){return function(_0x2066e6){if(!_0x2066e6){_0x5a6b94[_0x9711('0x27')](0x194);}return _0x2066e6;};}function handleError(_0x4c07df,_0x44a4d9){_0x44a4d9=_0x44a4d9||0x1f4;return function(_0x5da093){logger[_0x9711('0x18')](_0x5da093[_0x9711('0x28')]);if(_0x5da093[_0x9711('0x29')]){delete _0x5da093[_0x9711('0x29')];}_0x4c07df[_0x9711('0x1c')](_0x44a4d9)[_0x9711('0x2a')](_0x5da093);};}exports[_0x9711('0x2b')]=function(_0x12b5fb,_0x76c128){var _0x4a8406={},_0x5b4dfb={},_0x448ae6={'count':0x0,'rows':[]};var _0xeb3939=_['map'](db[_0x9711('0x2c')][_0x9711('0x2d')],function(_0x4eb538){return{'name':_0x4eb538[_0x9711('0x2e')],'type':_0x4eb538['type'][_0x9711('0x2f')]};});_0x5b4dfb[_0x9711('0x30')]=_[_0x9711('0x31')](_0xeb3939,'name');_0x5b4dfb[_0x9711('0x32')]=_[_0x9711('0x33')](_0x12b5fb[_0x9711('0x32')]);_0x5b4dfb[_0x9711('0x34')]=_[_0x9711('0x35')](_0x5b4dfb[_0x9711('0x30')],_0x5b4dfb[_0x9711('0x32')]);_0x4a8406['attributes']=_['intersection'](_0x5b4dfb['model'],qs[_0x9711('0x36')](_0x12b5fb[_0x9711('0x32')][_0x9711('0x36')]));_0x4a8406['attributes']=_0x4a8406['attributes']['length']?_0x4a8406[_0x9711('0x37')]:_0x5b4dfb[_0x9711('0x30')];if(!_0x12b5fb['query'][_0x9711('0x38')](_0x9711('0x39'))){_0x4a8406[_0x9711('0x20')]=qs['limit'](_0x12b5fb[_0x9711('0x32')][_0x9711('0x20')]);_0x4a8406[_0x9711('0x1d')]=qs['offset'](_0x12b5fb[_0x9711('0x32')][_0x9711('0x1d')]);}_0x4a8406[_0x9711('0x3a')]=qs[_0x9711('0x3b')](_0x12b5fb['query'][_0x9711('0x3b')]);_0x4a8406[_0x9711('0x3c')]=qs[_0x9711('0x34')](_[_0x9711('0x3d')](_0x12b5fb[_0x9711('0x32')],_0x5b4dfb[_0x9711('0x34')]),_0xeb3939);if(_0x12b5fb['query'][_0x9711('0x3e')]){_0x4a8406['where']=_['merge'](_0x4a8406[_0x9711('0x3c')],{'$or':_['map'](_0xeb3939,function(_0x198c71){if(_0x198c71['type']!==_0x9711('0x3f')){var _0x3f6652={};_0x3f6652[_0x198c71['name']]={'$like':'%'+_0x12b5fb[_0x9711('0x32')][_0x9711('0x3e')]+'%'};return _0x3f6652;}})});}_0x4a8406=_[_0x9711('0x40')]({},_0x4a8406,_0x12b5fb['options']);var _0x1498a9={'where':_0x4a8406[_0x9711('0x3c')]};return db[_0x9711('0x2c')][_0x9711('0x1f')](_0x1498a9)['then'](function(_0x557fcb){_0x448ae6[_0x9711('0x1f')]=_0x557fcb;if(_0x12b5fb[_0x9711('0x32')][_0x9711('0x41')]){_0x4a8406[_0x9711('0x42')]=[{'all':!![]}];}return db[_0x9711('0x2c')]['findAll'](_0x4a8406);})[_0x9711('0x13')](function(_0xa00a05){_0x448ae6[_0x9711('0x43')]=_0xa00a05;return _0x448ae6;})['then'](respondWithFilteredResult(_0x76c128,_0x4a8406))[_0x9711('0x1b')](handleError(_0x76c128,null));};exports[_0x9711('0x44')]=function(_0x52707c,_0x5d96ea){var _0x278c83={'raw':!![],'where':{'id':_0x52707c[_0x9711('0x45')]['id']}},_0x1c523f={};_0x1c523f['model']=_['keys'](db[_0x9711('0x2c')][_0x9711('0x2d')]);_0x1c523f['query']=_[_0x9711('0x33')](_0x52707c[_0x9711('0x32')]);_0x1c523f[_0x9711('0x34')]=_[_0x9711('0x35')](_0x1c523f['model'],_0x1c523f[_0x9711('0x32')]);_0x278c83[_0x9711('0x37')]=_['intersection'](_0x1c523f[_0x9711('0x30')],qs[_0x9711('0x36')](_0x52707c[_0x9711('0x32')]['fields']));_0x278c83[_0x9711('0x37')]=_0x278c83[_0x9711('0x37')][_0x9711('0x46')]?_0x278c83['attributes']:_0x1c523f['model'];if(_0x52707c[_0x9711('0x32')][_0x9711('0x41')]){_0x278c83[_0x9711('0x42')]=[{'all':!![]}];}_0x278c83=_[_0x9711('0x40')]({},_0x278c83,_0x52707c['options']);return db[_0x9711('0x2c')][_0x9711('0x47')](_0x278c83)[_0x9711('0x13')](handleEntityNotFound(_0x5d96ea,null))['then'](respondWithResult(_0x5d96ea,null))[_0x9711('0x1b')](handleError(_0x5d96ea,null));};exports[_0x9711('0x24')]=function(_0x26a4cf,_0x54f2dc){if(_0x26a4cf[_0x9711('0x48')]['id']){delete _0x26a4cf[_0x9711('0x48')]['id'];}return db['MailMessage']['find']({'where':{'id':_0x26a4cf[_0x9711('0x45')]['id']}})['then'](handleEntityNotFound(_0x54f2dc,null))[_0x9711('0x13')](saveUpdates(_0x26a4cf[_0x9711('0x48')],null))[_0x9711('0x13')](respondWithResult(_0x54f2dc,null))['catch'](handleError(_0x54f2dc,null));};exports['destroy']=function(_0x52e633,_0x8cb625){return db[_0x9711('0x2c')][_0x9711('0x47')]({'where':{'id':_0x52e633[_0x9711('0x45')]['id']}})[_0x9711('0x13')](handleEntityNotFound(_0x8cb625,null))[_0x9711('0x13')](removeEntity(_0x8cb625,null))[_0x9711('0x1b')](handleError(_0x8cb625,null));};exports[_0x9711('0x49')]=function(_0x43097c,_0x3e79bb){return db[_0x9711('0x2c')][_0x9711('0x49')]()[_0x9711('0x13')](respondWithResult(_0x3e79bb,null))[_0x9711('0x1b')](handleError(_0x3e79bb,null));};exports[_0x9711('0x4a')]=function(_0x52a7bb,_0x139eb2){return db[_0x9711('0x2c')][_0x9711('0x4a')](_0x52a7bb[_0x9711('0x48')])[_0x9711('0x13')](function(_0x45f63f){if(_0x45f63f){if(_0x45f63f[_0x9711('0x4b')]===_0x9711('0x4c')&&!_0x45f63f[_0x9711('0x4d')]){var _0x22256a,_0x3dbaaf,_0x45fc0d;if(_0x52a7bb[_0x9711('0x48')]['to']){_0x3dbaaf=_0x52a7bb['body']['to'][_0x9711('0x4e')](',')[0x0];}return db[_0x9711('0x4f')]['findOne']({'where':{'id':_0x45f63f[_0x9711('0x50')]},'include':[{'model':db['CmList'],'as':_0x9711('0x51'),'include':[{'model':db[_0x9711('0x52')],'as':'Contacts','where':{'email':_0x3dbaaf},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x9711('0x53')],'as':_0x9711('0x54'),'raw':!![],'include':[{'model':db[_0x9711('0x55')],'as':_0x9711('0x55'),'raw':!![]}]}]})[_0x9711('0x13')](function(_0x2a97a8){_0x22256a=_0x2a97a8;if(!_0x22256a||!_0x22256a[_0x9711('0x54')])return;var _0x43d7d9=_0x22256a[_0x9711('0x56')]();if(_0x52a7bb[_0x9711('0x48')][_0x9711('0x57')]&&_0x52a7bb[_0x9711('0x48')][_0x9711('0x57')]['length']){for(var _0x13acd8=0x0;_0x13acd8<_0x52a7bb[_0x9711('0x48')]['attachments'][_0x9711('0x46')];_0x13acd8+=0x1){_0x52a7bb[_0x9711('0x48')]['attachments'][_0x13acd8]={'filename':_0x52a7bb[_0x9711('0x48')][_0x9711('0x57')][_0x13acd8][_0x9711('0x29')],'path':path[_0x9711('0x58')](config['root'],_0x9711('0x59'),_0x52a7bb[_0x9711('0x48')][_0x9711('0x57')][_0x13acd8]['basename'])};}}_0x45fc0d={'account':_0x43d7d9,'message':_0x52a7bb[_0x9711('0x48')]};return;})[_0x9711('0x13')](function(){if(_0x22256a['List']){if(_0x22256a['List']['Contacts']['length']){return _0x22256a[_0x9711('0x51')][_0x9711('0x5a')][0x0];}else{return db[_0x9711('0x52')][_0x9711('0x4a')](_['defaults'](_0x52a7bb['body'],{'firstName':_0x52a7bb[_0x9711('0x48')]['to'],'email':_0x52a7bb[_0x9711('0x48')]['to'],'phone':_0x52a7bb[_0x9711('0x48')]['to'],'ListId':_0x22256a[_0x9711('0x5b')]}));}}else{throw new Error(_0x9711('0x5c'));}})[_0x9711('0x13')](function(){if(_0x45fc0d){return respondWithRpcPromise('SendMail','sendMail',_0x45fc0d,client9003)[_0x9711('0x13')](function(_0x2eaeee){return _0x45f63f[_0x9711('0x24')]({'read':!![],'messageId':_0x2eaeee[_0x9711('0x5d')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})['catch'](function(_0x3f3102){logger['error']('%s',JSON[_0x9711('0x5e')](_0x3f3102));return _0x45f63f;});}return _0x45f63f;});}return _0x45f63f;}})[_0x9711('0x13')](respondWithResult(_0x139eb2,0xc9))[_0x9711('0x1b')](handleError(_0x139eb2,null));};exports[_0x9711('0x5f')]=function(_0x8daa32,_0x3cf293){var _0x26eaa3={'agent':{},'channel':_0x9711('0x60')};if(_0x8daa32[_0x9711('0x48')]['id']){delete _0x8daa32['body']['id'];}_0x8daa32[_0x9711('0x48')]['read']=!![];_0x8daa32['body']['readAt']=moment()[_0x9711('0x61')]('YYYY-MM-DD\x20HH:mm:ss');_0x8daa32[_0x9711('0x48')]['UserId']=_0x8daa32[_0x9711('0x48')][_0x9711('0x62')]||_0x8daa32[_0x9711('0x63')]['id'];_0x26eaa3[_0x9711('0x64')]['id']=_0x8daa32[_0x9711('0x48')]['UserId'];return db['MailMessage'][_0x9711('0x47')]({'where':{'id':_0x8daa32[_0x9711('0x45')]['id'],'UserId':null}})[_0x9711('0x13')](handleEntityNotFound(_0x3cf293,null))['then'](saveUpdates(_0x8daa32['body'],null))[_0x9711('0x13')](function(_0x5b041f){if(_0x5b041f){_0x26eaa3[_0x9711('0x1a')]=_0x5b041f[_0x9711('0x65')]({'plain':!![]});return db[_0x9711('0x66')]['find']({'where':{'id':_0x5b041f[_0x9711('0x67')]}});}return null;})[_0x9711('0x13')](handleEntityNotFound(_0x3cf293,null))[_0x9711('0x13')](function(_0x1c70be){if(_0x1c70be){return _0x1c70be['update']({'UserId':_0x8daa32[_0x9711('0x48')][_0x9711('0x62')],'read1stAt':_[_0x9711('0x68')](_0x1c70be[_0x9711('0x69')])?moment()[_0x9711('0x61')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x9711('0x13')](function(_0x179791){if(_0x179791){_0x26eaa3[_0x9711('0x6a')]=_0x179791[_0x9711('0x65')]({'plain':!![]});interaction_log[_0x9711('0x14')](_0x9711('0x6b'),_0x8daa32[_0x9711('0x63')]['id'],_0x8daa32[_0x9711('0x63')]['name'],_0x8daa32[_0x9711('0x63')][_0x9711('0x6c')],_0x26eaa3['interaction']['id'],_0x8daa32[_0x9711('0x48')]?JSON[_0x9711('0x5e')](_0x8daa32[_0x9711('0x48')]):_0x9711('0x6d'));return respondWithRpcPromise(_0x9711('0x6e'),_0x9711('0x6f'),_0x26eaa3);}return null;})[_0x9711('0x13')](function(_0x573cb3){var _0x3c22eb='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x573cb3[_0x9711('0x1a')][_0x9711('0x70')];return db[_0x9711('0x71')][_0x9711('0x32')](_0x3c22eb,{'type':db['Sequelize'][_0x9711('0x72')][_0x9711('0x73')],'raw':!![]})[_0x9711('0x13')](function(_0x14e627){return _0x14e627;});})['then'](function(_0x345c35){if(_0x345c35){_0x26eaa3[_0x9711('0x1a')][_0x9711('0x74')]=_0x345c35[0x0];if(!_0x8daa32['body']['UserId'])return;return db['User'][_0x9711('0x47')]({'where':{'id':_0x8daa32[_0x9711('0x48')]['UserId'],'role':_0x9711('0x64')},'attributes':['id',_0x9711('0x29'),_0x9711('0x75'),_0x9711('0x76'),'internal'],'raw':!![]});}return null;})[_0x9711('0x13')](function(_0x2040a0){if(!_0x2040a0)return null;_0x26eaa3[_0x9711('0x1a')][_0x9711('0x64')]=_0x2040a0;return _0x26eaa3;})[_0x9711('0x13')](function(_0x4d8cb1){if(_0x4d8cb1){if(_0x8daa32[_0x9711('0x48')]['manual']){_0x26eaa3[_0x9711('0x1a')][_0x9711('0x77')]=util[_0x9711('0x61')](_0x9711('0x78'),_0x8daa32[_0x9711('0x63')]['name']);_0x26eaa3[_0x9711('0x1a')][_0x9711('0x79')]=_0x26eaa3[_0x9711('0x79')];_0x26eaa3[_0x9711('0x1a')]['motionChannel']=_0x26eaa3[_0x9711('0x79')];_0x26eaa3['message'][_0x9711('0x7a')]=_0x9711('0x5f');_0x26eaa3['message'][_0x9711('0x48')]=htmlToText[_0x9711('0x7b')](_0x26eaa3[_0x9711('0x1a')]['body']);return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x26eaa3['message']},client9002)[_0x9711('0x13')](function(){return _0x26eaa3;});}return _0x26eaa3;}return null;})[_0x9711('0x13')](respondWithResult(_0x3cf293,null))[_0x9711('0x1b')](handleError(_0x3cf293,null));};exports[_0x9711('0x7c')]=function(_0x5917c0,_0xf0b042){var _0x3cbfd5={'agent':{},'channel':_0x9711('0x60')};if(_0x5917c0[_0x9711('0x48')]['id']){delete _0x5917c0[_0x9711('0x48')]['id'];}_0x5917c0[_0x9711('0x48')][_0x9711('0x62')]=_0x5917c0[_0x9711('0x48')][_0x9711('0x62')]||_0x5917c0[_0x9711('0x63')]['id'];_0x3cbfd5['agent']['id']=_0x5917c0[_0x9711('0x48')][_0x9711('0x62')];return db[_0x9711('0x2c')][_0x9711('0x47')]({'where':{'id':_0x5917c0[_0x9711('0x45')]['id'],'UserId':null}})[_0x9711('0x13')](handleEntityNotFound(_0xf0b042,null))[_0x9711('0x13')](function(_0x2b7d66){if(_0x2b7d66){_0x3cbfd5[_0x9711('0x1a')]=_0x2b7d66[_0x9711('0x65')]({'plain':!![]});return db[_0x9711('0x66')][_0x9711('0x47')]({'where':{'id':_0x2b7d66[_0x9711('0x67')]}});}return null;})[_0x9711('0x13')](handleEntityNotFound(_0xf0b042,null))[_0x9711('0x13')](function(_0x39526a){if(_0x39526a){_0x3cbfd5[_0x9711('0x6a')]=_0x39526a[_0x9711('0x65')]({'plain':!![]});interaction_log['info'](_0x9711('0x7d'),_0x5917c0[_0x9711('0x63')]['id'],_0x5917c0[_0x9711('0x63')][_0x9711('0x29')],_0x5917c0[_0x9711('0x63')][_0x9711('0x6c')],_0x3cbfd5['interaction']['id'],_0x5917c0['body']?JSON['stringify'](_0x5917c0['body']):_0x9711('0x6d'));return respondWithRpcPromise(_0x9711('0x7e'),_0x9711('0x7f'),_0x3cbfd5);}return null;})[_0x9711('0x13')](function(_0x496afe){var _0x1c0880=_0x9711('0x80')+_0x496afe['message'][_0x9711('0x70')];return db[_0x9711('0x71')][_0x9711('0x32')](_0x1c0880,{'type':db[_0x9711('0x81')][_0x9711('0x72')][_0x9711('0x73')],'raw':!![]})[_0x9711('0x13')](function(_0xc37036){return _0xc37036;});})[_0x9711('0x13')](function(_0x151911){if(_0x151911){_0x3cbfd5[_0x9711('0x1a')][_0x9711('0x74')]=_0x151911[0x0];if(!_0x5917c0[_0x9711('0x48')][_0x9711('0x62')])return;return db[_0x9711('0x82')]['find']({'where':{'id':_0x5917c0[_0x9711('0x48')][_0x9711('0x62')],'role':_0x9711('0x64')},'attributes':['id',_0x9711('0x29'),_0x9711('0x75'),_0x9711('0x76'),_0x9711('0x83')],'raw':!![]});}return null;})['then'](function(_0x954772){if(!_0x954772)return null;_0x3cbfd5[_0x9711('0x1a')][_0x9711('0x64')]=_0x954772;return _0x3cbfd5;})[_0x9711('0x13')](function(_0x1011c6){if(_0x1011c6){_0x1011c6[_0x9711('0x1a')][_0x9711('0x77')]=util['format']('SIP/%s',_0x5917c0[_0x9711('0x63')][_0x9711('0x29')]);_0x1011c6[_0x9711('0x1a')][_0x9711('0x79')]=_0x3cbfd5[_0x9711('0x79')];_0x1011c6[_0x9711('0x1a')][_0x9711('0x84')]=_0x3cbfd5[_0x9711('0x79')];_0x1011c6[_0x9711('0x1a')][_0x9711('0x7a')]=_0x9711('0x7c');_0x1011c6[_0x9711('0x1a')][_0x9711('0x48')]=htmlToText[_0x9711('0x7b')](_0x3cbfd5['message'][_0x9711('0x48')]);respondWithRpcPromise(_0x9711('0x85'),'EventManager',{'event':'rejectmessage','message':_0x1011c6[_0x9711('0x1a')]},client9002);return _0x3cbfd5;}return null;})['then'](respondWithResult(_0xf0b042,null))[_0x9711('0x1b')](handleError(_0xf0b042,null));};exports[_0x9711('0x86')]=function(_0x12a1fc,_0x583f5e){var _0x4a1470=moment()['unix']()[_0x9711('0x87')]();var _0x368d8b=path[_0x9711('0x58')](config[_0x9711('0x88')],_0x9711('0x89'),_0x9711('0x8a'),'tmp');var _0x1564d8=path[_0x9711('0x58')](config['root'],_0x9711('0x89'),_0x9711('0x8a'),_0x9711('0x57'));var _0x4caf24=util[_0x9711('0x61')](_0x9711('0x8b'),_0x4a1470);return db[_0x9711('0x2c')][_0x9711('0x47')]({'where':{'id':_0x12a1fc[_0x9711('0x45')]['id']},'attributes':['id','body',_0x9711('0x8c'),'to','cc',_0x9711('0x8d'),_0x9711('0x8e'),_0x9711('0x8f')],'include':_0x12a1fc[_0x9711('0x32')][_0x9711('0x57')]?[{'model':db[_0x9711('0x90')],'as':_0x9711('0x91')}]:undefined})[_0x9711('0x13')](handleEntityNotFound(_0x583f5e,null))[_0x9711('0x13')](function(_0x31dc66){if(_0x31dc66){var _0x479c30=_0x31dc66;var _0x3395ee={'from':_0x479c30[_0x9711('0x8c')],'to':_0x479c30['to'],'subject':_0x479c30[_0x9711('0x8e')],'html':htmlEntities[_0x9711('0x92')](_0x479c30[_0x9711('0x48')]),'headers':{'Date':moment(_0x479c30[_0x9711('0x8f')])[_0x9711('0x61')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x31dc66['cc']){_0x3395ee[_0x9711('0x93')]['Cc']=_0x31dc66['cc'];}if(_0x31dc66[_0x9711('0x8d')]){_0x3395ee[_0x9711('0x93')][_0x9711('0x94')]=_0x31dc66[_0x9711('0x8d')];}return new BPromise(function(_0x306e25,_0x3c4820){if(_0x31dc66[_0x9711('0x91')]){for(var _0x31c55a=0x0;_0x31c55a<_0x31dc66[_0x9711('0x91')][_0x9711('0x46')];_0x31c55a++){var _0x4de483=_0x31dc66['Attachments'][_0x31c55a];var _0x131d64=path[_0x9711('0x58')](_0x1564d8,_0x4de483[_0x9711('0x95')]);if(fs[_0x9711('0x96')](_0x131d64)){_0x3395ee[_0x9711('0x57')][_0x9711('0x97')]({'name':_0x4de483[_0x9711('0x29')],'contentType':_0x4de483['type'],'data':fs[_0x9711('0x98')](_0x131d64)});}}}emlformat[_0x9711('0x99')](_0x3395ee,function(_0x525c57,_0xa720b2){if(_0x525c57)return _0x3c4820(_0x525c57);fs[_0x9711('0x9a')](path[_0x9711('0x58')](_0x368d8b,_0x4caf24),_0xa720b2);return _0x306e25(_0xa720b2);});});}})[_0x9711('0x13')](function(_0x3d3958){if(_0x3d3958){return _0x583f5e[_0x9711('0x86')](path['join'](_0x368d8b,_0x4caf24),_0x4caf24,function(_0x46abe3){if(!_0x46abe3)fs[_0x9711('0x9b')](path[_0x9711('0x58')](_0x368d8b,_0x4caf24));});}})[_0x9711('0x1b')](handleError(_0x583f5e,null));}; \ No newline at end of file +var _0x4ad6=['stringify','error','code','message','info','result','catch','status','limit','undefined','count','offset','set','Content-Range','json','update','destroy','name','index','MailMessage','rawAttributes','type','model','map','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','body','describe','create','out','secret','split','MailAccount','List','CmContact','Contacts','DESC','MailServerOut','CloudProvider','Smtp','getSmtpOptions','attachments','join','root','server/files/attachments','basename','defaults','ListId','List\x20not\x20found','SendMail','format','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','get','MailInteraction','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','agent','fullname','email','internal','manual','interface','channel','motionChannel','fromString','EventManager','acceptmessage','reject','mail','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','sequelize','event','rejectmessage','download','unix','toString','server','tmp','files','message-%s.eml','from','bcc','subject','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','readFileSync','build','unlinkSync','eml-format','moment','bluebird','path','lodash','ioredis','../../config/logger','api','mail-interactions','redis','socket.io-emitter','./mailMessage.socket','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2c8802,_0x4ad8e4){var _0x29fefc=function(_0x92772b){while(--_0x92772b){_0x2c8802['push'](_0x2c8802['shift']());}};_0x29fefc(++_0x4ad8e4);}(_0x4ad6,0x82));var _0x64ad=function(_0x57601a,_0x26f5b2){_0x57601a=_0x57601a-0x0;var _0x3aeee5=_0x4ad6[_0x57601a];return _0x3aeee5;};'use strict';var emlformat=require(_0x64ad('0x0'));var moment=require(_0x64ad('0x1'));var BPromise=require(_0x64ad('0x2'));var util=require('util');var path=require(_0x64ad('0x3'));var fs=require('fs');var _=require(_0x64ad('0x4'));var Redis=require(_0x64ad('0x5'));var htmlToText=require('html-to-text');var qs=require('../../components/parsers/qs');var logger=require(_0x64ad('0x6'))(_0x64ad('0x7'));var interaction_log=require(_0x64ad('0x6'))(_0x64ad('0x8'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x64ad('0x9')]=_['defaults'](config[_0x64ad('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x64ad('0xa'))(new Redis(config[_0x64ad('0x9')]));var htmlEntities=require('html-entities');require(_0x64ad('0xb'))[_0x64ad('0xc')](socket);var jayson=require(_0x64ad('0xd'));var client=jayson[_0x64ad('0xe')]['http']({'port':0x232c});var client9003=jayson['client'][_0x64ad('0xf')]({'port':0x232b});var client9002=jayson['client'][_0x64ad('0xf')]({'port':0x232a});function respondWithRpcPromise(_0x35d9f1,_0x4c1382,_0x3bfc84,_0x72b79d){return new BPromise(function(_0x1c4230,_0x5da656){var _0x9c8b6=_0x72b79d||client;return _0x9c8b6[_0x64ad('0x10')](_0x35d9f1,_0x3bfc84)[_0x64ad('0x11')](function(_0x582cc0){logger['info'](_0x64ad('0x12'),_0x4c1382,_0x64ad('0x13'));logger[_0x64ad('0x14')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x4c1382,_0x64ad('0x13'),JSON[_0x64ad('0x15')](_0x582cc0));if(_0x582cc0['error']){if(_0x582cc0[_0x64ad('0x16')][_0x64ad('0x17')]===0x1f4){logger[_0x64ad('0x16')](_0x64ad('0x12'),_0x4c1382,_0x582cc0[_0x64ad('0x16')][_0x64ad('0x18')]);return _0x5da656(_0x582cc0[_0x64ad('0x16')][_0x64ad('0x18')]);}logger[_0x64ad('0x16')](_0x64ad('0x12'),_0x4c1382,_0x582cc0[_0x64ad('0x16')][_0x64ad('0x18')]);return _0x1c4230(_0x582cc0[_0x64ad('0x16')][_0x64ad('0x18')]);}else{logger[_0x64ad('0x19')](_0x64ad('0x12'),_0x4c1382,'request\x20sent');_0x1c4230(_0x582cc0[_0x64ad('0x1a')][_0x64ad('0x18')]);}})[_0x64ad('0x1b')](function(_0x31b993){logger[_0x64ad('0x16')](_0x64ad('0x12'),_0x4c1382,_0x31b993);_0x5da656(_0x31b993);});});}function respondWithResult(_0x387c56,_0x1a85b3){_0x1a85b3=_0x1a85b3||0xc8;return function(_0x59e102){if(_0x59e102){return _0x387c56[_0x64ad('0x1c')](_0x1a85b3)['json'](_0x59e102);}};}function respondWithFilteredResult(_0x3a9037,_0x183fac){return function(_0x4378ce){if(_0x4378ce){var _0x1f23b5=typeof _0x183fac['offset']==='undefined'&&typeof _0x183fac[_0x64ad('0x1d')]===_0x64ad('0x1e');var _0x5073c9=_0x4378ce[_0x64ad('0x1f')];var _0x613a9e=_0x1f23b5?0x0:_0x183fac['offset'];var _0x42b74e=_0x1f23b5?_0x4378ce['count']:_0x183fac[_0x64ad('0x20')]+_0x183fac[_0x64ad('0x1d')];var _0x5a3fa9;if(_0x42b74e>=_0x5073c9){_0x42b74e=_0x5073c9;_0x5a3fa9=0xc8;}else{_0x5a3fa9=0xce;}_0x3a9037[_0x64ad('0x1c')](_0x5a3fa9);return _0x3a9037[_0x64ad('0x21')](_0x64ad('0x22'),_0x613a9e+'-'+_0x42b74e+'/'+_0x5073c9)[_0x64ad('0x23')](_0x4378ce);}return null;};}function saveUpdates(_0x1caaff){return function(_0xdcad30){if(_0xdcad30){return _0xdcad30[_0x64ad('0x24')](_0x1caaff)['then'](function(_0x34f7a9){return _0x34f7a9;});}return null;};}function removeEntity(_0x26b8fb){return function(_0x20af7c){if(_0x20af7c){return _0x20af7c[_0x64ad('0x25')]()[_0x64ad('0x11')](function(){_0x26b8fb[_0x64ad('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a29e6){return function(_0x47efbd){if(!_0x47efbd){_0x2a29e6['sendStatus'](0x194);}return _0x47efbd;};}function handleError(_0x2b3ab2,_0x5c3bd8){_0x5c3bd8=_0x5c3bd8||0x1f4;return function(_0x781f42){logger[_0x64ad('0x16')](_0x781f42['stack']);if(_0x781f42['name']){delete _0x781f42[_0x64ad('0x26')];}_0x2b3ab2[_0x64ad('0x1c')](_0x5c3bd8)['send'](_0x781f42);};}exports[_0x64ad('0x27')]=function(_0x41ac38,_0x840902){var _0x1d55ad={},_0x44d0dd={},_0x4ad518={'count':0x0,'rows':[]};var _0x14a7b1=_['map'](db[_0x64ad('0x28')][_0x64ad('0x29')],function(_0x7375f3){return{'name':_0x7375f3['fieldName'],'type':_0x7375f3[_0x64ad('0x2a')]['key']};});_0x44d0dd[_0x64ad('0x2b')]=_[_0x64ad('0x2c')](_0x14a7b1,_0x64ad('0x26'));_0x44d0dd['query']=_[_0x64ad('0x2d')](_0x41ac38[_0x64ad('0x2e')]);_0x44d0dd[_0x64ad('0x2f')]=_[_0x64ad('0x30')](_0x44d0dd[_0x64ad('0x2b')],_0x44d0dd['query']);_0x1d55ad['attributes']=_[_0x64ad('0x30')](_0x44d0dd[_0x64ad('0x2b')],qs[_0x64ad('0x31')](_0x41ac38[_0x64ad('0x2e')]['fields']));_0x1d55ad[_0x64ad('0x32')]=_0x1d55ad[_0x64ad('0x32')][_0x64ad('0x33')]?_0x1d55ad[_0x64ad('0x32')]:_0x44d0dd[_0x64ad('0x2b')];if(!_0x41ac38[_0x64ad('0x2e')]['hasOwnProperty'](_0x64ad('0x34'))){_0x1d55ad[_0x64ad('0x1d')]=qs[_0x64ad('0x1d')](_0x41ac38[_0x64ad('0x2e')]['limit']);_0x1d55ad['offset']=qs[_0x64ad('0x20')](_0x41ac38[_0x64ad('0x2e')][_0x64ad('0x20')]);}_0x1d55ad[_0x64ad('0x35')]=qs[_0x64ad('0x36')](_0x41ac38['query'][_0x64ad('0x36')]);_0x1d55ad['where']=qs[_0x64ad('0x2f')](_[_0x64ad('0x37')](_0x41ac38['query'],_0x44d0dd[_0x64ad('0x2f')]),_0x14a7b1);if(_0x41ac38[_0x64ad('0x2e')]['filter']){_0x1d55ad[_0x64ad('0x38')]=_[_0x64ad('0x39')](_0x1d55ad[_0x64ad('0x38')],{'$or':_[_0x64ad('0x2c')](_0x14a7b1,function(_0x106f24){if(_0x106f24[_0x64ad('0x2a')]!==_0x64ad('0x3a')){var _0x25c1ed={};_0x25c1ed[_0x106f24['name']]={'$like':'%'+_0x41ac38['query'][_0x64ad('0x3b')]+'%'};return _0x25c1ed;}})});}_0x1d55ad=_[_0x64ad('0x39')]({},_0x1d55ad,_0x41ac38[_0x64ad('0x3c')]);var _0x4fa0e6={'where':_0x1d55ad[_0x64ad('0x38')]};return db[_0x64ad('0x28')]['count'](_0x4fa0e6)[_0x64ad('0x11')](function(_0x4c6109){_0x4ad518[_0x64ad('0x1f')]=_0x4c6109;if(_0x41ac38[_0x64ad('0x2e')][_0x64ad('0x3d')]){_0x1d55ad['include']=[{'all':!![]}];}return db['MailMessage'][_0x64ad('0x3e')](_0x1d55ad);})[_0x64ad('0x11')](function(_0x1e1a27){_0x4ad518[_0x64ad('0x3f')]=_0x1e1a27;return _0x4ad518;})[_0x64ad('0x11')](respondWithFilteredResult(_0x840902,_0x1d55ad))[_0x64ad('0x1b')](handleError(_0x840902,null));};exports[_0x64ad('0x40')]=function(_0x2ec983,_0xe8e881){var _0xb797a3={'raw':!![],'where':{'id':_0x2ec983[_0x64ad('0x41')]['id']}},_0x350b1c={};_0x350b1c[_0x64ad('0x2b')]=_[_0x64ad('0x2d')](db[_0x64ad('0x28')]['rawAttributes']);_0x350b1c[_0x64ad('0x2e')]=_[_0x64ad('0x2d')](_0x2ec983[_0x64ad('0x2e')]);_0x350b1c[_0x64ad('0x2f')]=_[_0x64ad('0x30')](_0x350b1c[_0x64ad('0x2b')],_0x350b1c['query']);_0xb797a3[_0x64ad('0x32')]=_[_0x64ad('0x30')](_0x350b1c['model'],qs['fields'](_0x2ec983[_0x64ad('0x2e')][_0x64ad('0x31')]));_0xb797a3['attributes']=_0xb797a3[_0x64ad('0x32')][_0x64ad('0x33')]?_0xb797a3[_0x64ad('0x32')]:_0x350b1c['model'];if(_0x2ec983[_0x64ad('0x2e')][_0x64ad('0x3d')]){_0xb797a3[_0x64ad('0x42')]=[{'all':!![]}];}_0xb797a3=_['merge']({},_0xb797a3,_0x2ec983[_0x64ad('0x3c')]);return db[_0x64ad('0x28')][_0x64ad('0x43')](_0xb797a3)[_0x64ad('0x11')](handleEntityNotFound(_0xe8e881,null))['then'](respondWithResult(_0xe8e881,null))[_0x64ad('0x1b')](handleError(_0xe8e881,null));};exports[_0x64ad('0x24')]=function(_0x4f68c1,_0x3b440f){if(_0x4f68c1[_0x64ad('0x44')]['id']){delete _0x4f68c1[_0x64ad('0x44')]['id'];}return db[_0x64ad('0x28')][_0x64ad('0x43')]({'where':{'id':_0x4f68c1['params']['id']}})['then'](handleEntityNotFound(_0x3b440f,null))[_0x64ad('0x11')](saveUpdates(_0x4f68c1[_0x64ad('0x44')],null))[_0x64ad('0x11')](respondWithResult(_0x3b440f,null))[_0x64ad('0x1b')](handleError(_0x3b440f,null));};exports[_0x64ad('0x25')]=function(_0x55a217,_0x43b3bb){return db[_0x64ad('0x28')]['find']({'where':{'id':_0x55a217[_0x64ad('0x41')]['id']}})['then'](handleEntityNotFound(_0x43b3bb,null))['then'](removeEntity(_0x43b3bb,null))[_0x64ad('0x1b')](handleError(_0x43b3bb,null));};exports[_0x64ad('0x45')]=function(_0x898e31,_0x16ebd4){return db[_0x64ad('0x28')][_0x64ad('0x45')]()[_0x64ad('0x11')](respondWithResult(_0x16ebd4,null))[_0x64ad('0x1b')](handleError(_0x16ebd4,null));};exports[_0x64ad('0x46')]=function(_0x3eb394,_0x3d3852){return db['MailMessage']['create'](_0x3eb394[_0x64ad('0x44')])[_0x64ad('0x11')](function(_0x821289){if(_0x821289){if(_0x821289['direction']===_0x64ad('0x47')&&!_0x821289[_0x64ad('0x48')]){var _0x24f86e,_0x968e53,_0x560941;if(_0x3eb394[_0x64ad('0x44')]['to']){_0x968e53=_0x3eb394['body']['to'][_0x64ad('0x49')](',')[0x0];}return db[_0x64ad('0x4a')]['findOne']({'where':{'id':_0x821289['MailAccountId']},'include':[{'model':db['CmList'],'as':_0x64ad('0x4b'),'include':[{'model':db[_0x64ad('0x4c')],'as':_0x64ad('0x4d'),'where':{'email':_0x968e53},'limit':0x1,'order':[['updatedAt',_0x64ad('0x4e')]]}]},{'model':db[_0x64ad('0x4f')],'as':'Smtp','raw':!![],'include':[{'model':db[_0x64ad('0x50')],'as':_0x64ad('0x50'),'raw':!![]}]}]})['then'](function(_0x31868f){_0x24f86e=_0x31868f;if(!_0x24f86e||!_0x24f86e[_0x64ad('0x51')])return;var _0x54d053=_0x24f86e[_0x64ad('0x52')]();if(_0x3eb394[_0x64ad('0x44')][_0x64ad('0x53')]&&_0x3eb394['body'][_0x64ad('0x53')][_0x64ad('0x33')]){for(var _0x2e8f19=0x0;_0x2e8f19<_0x3eb394[_0x64ad('0x44')]['attachments'][_0x64ad('0x33')];_0x2e8f19+=0x1){_0x3eb394[_0x64ad('0x44')]['attachments'][_0x2e8f19]={'filename':_0x3eb394[_0x64ad('0x44')]['attachments'][_0x2e8f19][_0x64ad('0x26')],'path':path[_0x64ad('0x54')](config[_0x64ad('0x55')],_0x64ad('0x56'),_0x3eb394[_0x64ad('0x44')]['attachments'][_0x2e8f19][_0x64ad('0x57')])};}}_0x560941={'account':_0x54d053,'message':_0x3eb394[_0x64ad('0x44')]};return;})[_0x64ad('0x11')](function(){if(_0x24f86e['List']){if(_0x24f86e[_0x64ad('0x4b')][_0x64ad('0x4d')]['length']){return _0x24f86e[_0x64ad('0x4b')][_0x64ad('0x4d')][0x0];}else{return db[_0x64ad('0x4c')]['create'](_[_0x64ad('0x58')](_0x3eb394['body'],{'firstName':_0x3eb394[_0x64ad('0x44')]['to'],'email':_0x3eb394[_0x64ad('0x44')]['to'],'phone':_0x3eb394[_0x64ad('0x44')]['to'],'ListId':_0x24f86e[_0x64ad('0x59')]}));}}else{throw new Error(_0x64ad('0x5a'));}})[_0x64ad('0x11')](function(){if(_0x560941){return respondWithRpcPromise(_0x64ad('0x5b'),'sendMail',_0x560941,client9003)[_0x64ad('0x11')](function(_0x50a741){return _0x821289[_0x64ad('0x24')]({'read':!![],'messageId':_0x50a741['messageId'],'sentAt':moment()[_0x64ad('0x5c')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x64ad('0x1b')](function(_0x1a324d){logger[_0x64ad('0x16')]('%s',JSON[_0x64ad('0x15')](_0x1a324d));return _0x821289;});}return _0x821289;});}return _0x821289;}})['then'](respondWithResult(_0x3d3852,0xc9))[_0x64ad('0x1b')](handleError(_0x3d3852,null));};exports[_0x64ad('0x5d')]=function(_0x135c92,_0x4655b8){var _0x276abd={'agent':{},'channel':'mail'};if(_0x135c92['body']['id']){delete _0x135c92[_0x64ad('0x44')]['id'];}_0x135c92[_0x64ad('0x44')][_0x64ad('0x5e')]=!![];_0x135c92[_0x64ad('0x44')][_0x64ad('0x5f')]=moment()[_0x64ad('0x5c')](_0x64ad('0x60'));_0x135c92[_0x64ad('0x44')][_0x64ad('0x61')]=_0x135c92[_0x64ad('0x44')]['UserId']||_0x135c92['user']['id'];_0x276abd['agent']['id']=_0x135c92[_0x64ad('0x44')][_0x64ad('0x61')];return db[_0x64ad('0x28')]['find']({'where':{'id':_0x135c92[_0x64ad('0x41')]['id'],'UserId':null}})[_0x64ad('0x11')](handleEntityNotFound(_0x4655b8,null))[_0x64ad('0x11')](saveUpdates(_0x135c92[_0x64ad('0x44')],null))[_0x64ad('0x11')](function(_0x544977){if(_0x544977){_0x276abd[_0x64ad('0x18')]=_0x544977[_0x64ad('0x62')]({'plain':!![]});return db[_0x64ad('0x63')][_0x64ad('0x43')]({'where':{'id':_0x544977['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x4655b8,null))[_0x64ad('0x11')](function(_0x1ac5ed){if(_0x1ac5ed){return _0x1ac5ed[_0x64ad('0x24')]({'UserId':_0x135c92[_0x64ad('0x44')][_0x64ad('0x61')],'read1stAt':_['isNil'](_0x1ac5ed['read1stAt'])?moment()[_0x64ad('0x5c')](_0x64ad('0x60')):undefined});}return null;})['then'](function(_0x4bd40e){if(_0x4bd40e){_0x276abd[_0x64ad('0x64')]=_0x4bd40e[_0x64ad('0x62')]({'plain':!![]});interaction_log[_0x64ad('0x19')](_0x64ad('0x65'),_0x135c92['user']['id'],_0x135c92[_0x64ad('0x66')][_0x64ad('0x26')],_0x135c92[_0x64ad('0x66')][_0x64ad('0x67')],_0x276abd[_0x64ad('0x64')]['id'],_0x135c92[_0x64ad('0x44')]?JSON['stringify'](_0x135c92[_0x64ad('0x44')]):'null');return respondWithRpcPromise(_0x64ad('0x68'),_0x64ad('0x69'),_0x276abd);}return null;})['then'](function(_0xa0e895){var _0xb4d3c5=_0x64ad('0x6a')+_0xa0e895[_0x64ad('0x18')][_0x64ad('0x6b')];return db['sequelize'][_0x64ad('0x2e')](_0xb4d3c5,{'type':db[_0x64ad('0x6c')][_0x64ad('0x6d')]['SELECT'],'raw':!![]})[_0x64ad('0x11')](function(_0xaf01b7){return _0xaf01b7;});})[_0x64ad('0x11')](function(_0x55af81){if(_0x55af81){_0x276abd[_0x64ad('0x18')][_0x64ad('0x6e')]=_0x55af81[0x0];if(!_0x135c92[_0x64ad('0x44')][_0x64ad('0x61')])return;return db[_0x64ad('0x6f')]['find']({'where':{'id':_0x135c92[_0x64ad('0x44')][_0x64ad('0x61')],'role':_0x64ad('0x70')},'attributes':['id','name',_0x64ad('0x71'),_0x64ad('0x72'),_0x64ad('0x73')],'raw':!![]});}return null;})[_0x64ad('0x11')](function(_0x2b0e01){if(!_0x2b0e01)return null;_0x276abd['message'][_0x64ad('0x70')]=_0x2b0e01;return _0x276abd;})['then'](function(_0x5bf7a7){if(_0x5bf7a7){if(_0x135c92[_0x64ad('0x44')][_0x64ad('0x74')]){_0x276abd[_0x64ad('0x18')][_0x64ad('0x75')]=util[_0x64ad('0x5c')]('SIP/%s',_0x135c92[_0x64ad('0x66')][_0x64ad('0x26')]);_0x276abd[_0x64ad('0x18')][_0x64ad('0x76')]=_0x276abd[_0x64ad('0x76')];_0x276abd[_0x64ad('0x18')][_0x64ad('0x77')]=_0x276abd[_0x64ad('0x76')];_0x276abd['message']['event']=_0x64ad('0x5d');_0x276abd['message'][_0x64ad('0x44')]=htmlToText[_0x64ad('0x78')](_0x276abd['message'][_0x64ad('0x44')]);return respondWithRpcPromise(_0x64ad('0x79'),_0x64ad('0x79'),{'event':_0x64ad('0x7a'),'message':_0x276abd[_0x64ad('0x18')]},client9002)[_0x64ad('0x11')](function(){return _0x276abd;});}return _0x276abd;}return null;})[_0x64ad('0x11')](respondWithResult(_0x4655b8,null))[_0x64ad('0x1b')](handleError(_0x4655b8,null));};exports[_0x64ad('0x7b')]=function(_0x13c4d6,_0x291f92){var _0x41a084={'agent':{},'channel':_0x64ad('0x7c')};if(_0x13c4d6[_0x64ad('0x44')]['id']){delete _0x13c4d6[_0x64ad('0x44')]['id'];}_0x13c4d6[_0x64ad('0x44')][_0x64ad('0x61')]=_0x13c4d6[_0x64ad('0x44')]['UserId']||_0x13c4d6[_0x64ad('0x66')]['id'];_0x41a084[_0x64ad('0x70')]['id']=_0x13c4d6[_0x64ad('0x44')][_0x64ad('0x61')];return db[_0x64ad('0x28')]['find']({'where':{'id':_0x13c4d6[_0x64ad('0x41')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x291f92,null))[_0x64ad('0x11')](function(_0x5b85da){if(_0x5b85da){_0x41a084[_0x64ad('0x18')]=_0x5b85da[_0x64ad('0x62')]({'plain':!![]});return db['MailInteraction'][_0x64ad('0x43')]({'where':{'id':_0x5b85da[_0x64ad('0x7d')]}});}return null;})[_0x64ad('0x11')](handleEntityNotFound(_0x291f92,null))[_0x64ad('0x11')](function(_0x4a328b){if(_0x4a328b){_0x41a084[_0x64ad('0x64')]=_0x4a328b[_0x64ad('0x62')]({'plain':!![]});interaction_log['info'](_0x64ad('0x7e'),_0x13c4d6[_0x64ad('0x66')]['id'],_0x13c4d6[_0x64ad('0x66')]['name'],_0x13c4d6[_0x64ad('0x66')]['role'],_0x41a084[_0x64ad('0x64')]['id'],_0x13c4d6[_0x64ad('0x44')]?JSON[_0x64ad('0x15')](_0x13c4d6[_0x64ad('0x44')]):_0x64ad('0x7f'));return respondWithRpcPromise(_0x64ad('0x80'),_0x64ad('0x81'),_0x41a084);}return null;})[_0x64ad('0x11')](function(_0x934185){var _0x457915='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x934185[_0x64ad('0x18')][_0x64ad('0x6b')];return db[_0x64ad('0x82')][_0x64ad('0x2e')](_0x457915,{'type':db[_0x64ad('0x6c')][_0x64ad('0x6d')]['SELECT'],'raw':!![]})[_0x64ad('0x11')](function(_0x197643){return _0x197643;});})[_0x64ad('0x11')](function(_0x25cbdb){if(_0x25cbdb){_0x41a084[_0x64ad('0x18')][_0x64ad('0x6e')]=_0x25cbdb[0x0];if(!_0x13c4d6[_0x64ad('0x44')]['UserId'])return;return db[_0x64ad('0x6f')][_0x64ad('0x43')]({'where':{'id':_0x13c4d6['body'][_0x64ad('0x61')],'role':_0x64ad('0x70')},'attributes':['id','name',_0x64ad('0x71'),_0x64ad('0x72'),'internal'],'raw':!![]});}return null;})['then'](function(_0x4d293e){if(!_0x4d293e)return null;_0x41a084[_0x64ad('0x18')]['agent']=_0x4d293e;return _0x41a084;})[_0x64ad('0x11')](function(_0x35e8ec){if(_0x35e8ec){_0x35e8ec[_0x64ad('0x18')][_0x64ad('0x75')]=util['format']('SIP/%s',_0x13c4d6[_0x64ad('0x66')]['name']);_0x35e8ec[_0x64ad('0x18')][_0x64ad('0x76')]=_0x41a084[_0x64ad('0x76')];_0x35e8ec[_0x64ad('0x18')][_0x64ad('0x77')]=_0x41a084[_0x64ad('0x76')];_0x35e8ec[_0x64ad('0x18')][_0x64ad('0x83')]='reject';_0x35e8ec[_0x64ad('0x18')][_0x64ad('0x44')]=htmlToText[_0x64ad('0x78')](_0x41a084[_0x64ad('0x18')][_0x64ad('0x44')]);respondWithRpcPromise(_0x64ad('0x79'),_0x64ad('0x79'),{'event':_0x64ad('0x84'),'message':_0x35e8ec[_0x64ad('0x18')]},client9002);return _0x41a084;}return null;})[_0x64ad('0x11')](respondWithResult(_0x291f92,null))['catch'](handleError(_0x291f92,null));};exports[_0x64ad('0x85')]=function(_0x2e8120,_0x31cd5a){var _0x3b2775=moment()[_0x64ad('0x86')]()[_0x64ad('0x87')]();var _0x89f8b6=path[_0x64ad('0x54')](config['root'],_0x64ad('0x88'),'files',_0x64ad('0x89'));var _0xa077ee=path[_0x64ad('0x54')](config['root'],_0x64ad('0x88'),_0x64ad('0x8a'),_0x64ad('0x53'));var _0x30124b=util[_0x64ad('0x5c')](_0x64ad('0x8b'),_0x3b2775);return db['MailMessage'][_0x64ad('0x43')]({'where':{'id':_0x2e8120[_0x64ad('0x41')]['id']},'attributes':['id',_0x64ad('0x44'),_0x64ad('0x8c'),'to','cc',_0x64ad('0x8d'),'subject','createdAt'],'include':_0x2e8120[_0x64ad('0x2e')]['attachments']?[{'model':db['Attachment'],'as':'Attachments'}]:undefined})[_0x64ad('0x11')](handleEntityNotFound(_0x31cd5a,null))['then'](function(_0x4eb2d9){if(_0x4eb2d9){var _0x184749=_0x4eb2d9;var _0x444fc9={'from':_0x184749[_0x64ad('0x8c')],'to':_0x184749['to'],'subject':_0x184749[_0x64ad('0x8e')],'html':htmlEntities[_0x64ad('0x8f')](_0x184749[_0x64ad('0x44')]),'headers':{'Date':moment(_0x184749['createdAt'])[_0x64ad('0x5c')](_0x64ad('0x90'))},'attachments':[]};if(_0x4eb2d9['cc']){_0x444fc9[_0x64ad('0x91')]['Cc']=_0x4eb2d9['cc'];}if(_0x4eb2d9[_0x64ad('0x8d')]){_0x444fc9[_0x64ad('0x91')][_0x64ad('0x92')]=_0x4eb2d9['bcc'];}return new BPromise(function(_0x440566,_0x49dbfd){if(_0x4eb2d9[_0x64ad('0x93')]){for(var _0x348047=0x0;_0x348047<_0x4eb2d9[_0x64ad('0x93')]['length'];_0x348047++){var _0x534776=_0x4eb2d9['Attachments'][_0x348047];var _0x1b7249=path[_0x64ad('0x54')](_0xa077ee,_0x534776[_0x64ad('0x57')]);if(fs['existsSync'](_0x1b7249)){_0x444fc9[_0x64ad('0x53')]['push']({'name':_0x534776['name'],'contentType':_0x534776[_0x64ad('0x2a')],'data':fs[_0x64ad('0x94')](_0x1b7249)});}}}emlformat[_0x64ad('0x95')](_0x444fc9,function(_0x3f2d84,_0x2692a0){if(_0x3f2d84)return _0x49dbfd(_0x3f2d84);fs['writeFileSync'](path[_0x64ad('0x54')](_0x89f8b6,_0x30124b),_0x2692a0);return _0x440566(_0x2692a0);});});}})[_0x64ad('0x11')](function(_0x144400){if(_0x144400){return _0x31cd5a[_0x64ad('0x85')](path[_0x64ad('0x54')](_0x89f8b6,_0x30124b),_0x30124b,function(_0x1d21a7){if(!_0x1d21a7)fs[_0x64ad('0x96')](path[_0x64ad('0x54')](_0x89f8b6,_0x30124b));});}})[_0x64ad('0x1b')](handleError(_0x31cd5a,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index d09450a..45adbef 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 _0xfb54=['../../mysqldb','setMaxListeners','update','emit','hasOwnProperty','hook','events'];(function(_0x425dbc,_0x3f9342){var _0x1a5f1e=function(_0x401b59){while(--_0x401b59){_0x425dbc['push'](_0x425dbc['shift']());}};_0x1a5f1e(++_0x3f9342);}(_0xfb54,0xa0));var _0x4fb5=function(_0x354a6f,_0x1b674e){_0x354a6f=_0x354a6f-0x0;var _0x3d2468=_0xfb54[_0x354a6f];return _0x3d2468;};'use strict';var EventEmitter=require(_0x4fb5('0x0'));var MailMessage=require(_0x4fb5('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x4fb5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4fb5('0x3'),'afterDestroy':'remove'};function emitEvent(_0x540822){return function(_0x10fe45,_0x135e4d,_0x4b9a90){MailMessageEvents[_0x4fb5('0x4')](_0x540822+':'+_0x10fe45['id'],_0x10fe45);MailMessageEvents[_0x4fb5('0x4')](_0x540822,_0x10fe45);_0x4b9a90(null);};}for(var e in events){if(events[_0x4fb5('0x5')](e)){var event=events[e];MailMessage[_0x4fb5('0x6')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0x1c5c=['../../mysqldb','MailMessage','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x4d7145,_0x1270c7){var _0x441d1d=function(_0x3933b2){while(--_0x3933b2){_0x4d7145['push'](_0x4d7145['shift']());}};_0x441d1d(++_0x1270c7);}(_0x1c5c,0xa1));var _0xc1c5=function(_0x5cda1d,_0x48a0c5){_0x5cda1d=_0x5cda1d-0x0;var _0x17c014=_0x1c5c[_0x5cda1d];return _0x17c014;};'use strict';var EventEmitter=require(_0xc1c5('0x0'));var MailMessage=require(_0xc1c5('0x1'))['db'][_0xc1c5('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc1c5('0x3'),'afterUpdate':_0xc1c5('0x4'),'afterDestroy':_0xc1c5('0x5')};function emitEvent(_0x57052e){return function(_0xb84111,_0x6cdf86,_0x134966){MailMessageEvents[_0xc1c5('0x6')](_0x57052e+':'+_0xb84111['id'],_0xb84111);MailMessageEvents['emit'](_0x57052e,_0xb84111);_0x134966(null);};}for(var e in events){if(events[_0xc1c5('0x7')](e)){var event=events[e];MailMessage[_0xc1c5('0x8')](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index f299449..d97aec7 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 _0x3861=['messageId','fti_mail_messages','subject','FULLTEXT','body','plainBody','fromString','models','get','direction','toLowerCase','out','secret','isNil','MailInteraction','findOne','then','update','createdAt','catch','error','utf8mb4_unicode_ci','lodash','api','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x3861,0xbb));var _0x1386=function(_0x5e638f,_0x3aad42){_0x5e638f=_0x5e638f-0x0;var _0xf7a0cc=_0x3861[_0x5e638f];return _0xf7a0cc;};'use strict';var _=require(_0x1386('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1386('0x1'));var moment=require('moment');var BPromise=require(_0x1386('0x2'));var rp=require(_0x1386('0x3'));var htmlToText=require(_0x1386('0x4'));var fs=require('fs');var path=require(_0x1386('0x5'));var rimraf=require(_0x1386('0x6'));var config=require(_0x1386('0x7'));var attributes=require(_0x1386('0x8'));module[_0x1386('0x9')]=function(_0x5030f5,_0xc11bb2){return _0x5030f5[_0x1386('0xa')]('MailMessage',attributes,{'tableName':'mail_messages','paranoid':![],'indexes':[{'name':'messageId','fields':[_0x1386('0xb')]},{'name':_0x1386('0xc'),'fields':['plainBody',_0x1386('0xd')],'type':_0x1386('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x309e42,_0x3436c0,_0x127026){if(_0x309e42[_0x1386('0xf')]){_0x309e42[_0x1386('0x10')]=htmlToText[_0x1386('0x11')](_0x309e42[_0x1386('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x127026(null,_0x3436c0);},'afterCreate':function(_0x2dbb0a,_0x1ab5ef,_0xfcfe5a){var _0x2be6d0=_0x5030f5[_0x1386('0x12')];var _0x8aac76=_0x2dbb0a[_0x1386('0x13')]({'plain':!![]});if(_0x8aac76['direction']['toLowerCase']()==='in'||_0x8aac76[_0x1386('0x14')][_0x1386('0x15')]()===_0x1386('0x16')&&!_0x8aac76[_0x1386('0x17')]&&!_[_0x1386('0x18')](_0x8aac76['UserId'])){_0x2be6d0[_0x1386('0x19')][_0x1386('0x1a')]({'where':{'id':_0x8aac76['MailInteractionId']}})[_0x1386('0x1b')](function(_0x485abe){if(_0x485abe){_0x485abe[_0x1386('0x1c')]({'lastMsgAt':_0x8aac76[_0x1386('0x1d')],'lastMsgDirection':_0x8aac76[_0x1386('0x14')][_0x1386('0x15')]()});}})[_0x1386('0x1e')](function(_0x41ed38){console[_0x1386('0x1f')](_0x41ed38);});}_0xfcfe5a();}},'charset':'utf8mb4','collate':_0x1386('0x20')});}; \ No newline at end of file +var _0x6f82=['rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','subject','body','plainBody','fromString','models','get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','html-to-text','path'];(function(_0x1629a9,_0x3b1393){var _0x534939=function(_0x25f54e){while(--_0x25f54e){_0x1629a9['push'](_0x1629a9['shift']());}};_0x534939(++_0x3b1393);}(_0x6f82,0x165));var _0x26f8=function(_0x1deee5,_0x1d4485){_0x1deee5=_0x1deee5-0x0;var _0x1d6c3a=_0x6f82[_0x1deee5];return _0x1d6c3a;};'use strict';var _=require(_0x26f8('0x0'));var util=require('util');var logger=require(_0x26f8('0x1'))('api');var moment=require(_0x26f8('0x2'));var BPromise=require(_0x26f8('0x3'));var rp=require('request-promise');var htmlToText=require(_0x26f8('0x4'));var fs=require('fs');var path=require(_0x26f8('0x5'));var rimraf=require(_0x26f8('0x6'));var config=require(_0x26f8('0x7'));var attributes=require(_0x26f8('0x8'));module[_0x26f8('0x9')]=function(_0x4944e9,_0xcee3b8){return _0x4944e9[_0x26f8('0xa')]('MailMessage',attributes,{'tableName':_0x26f8('0xb'),'paranoid':![],'indexes':[{'name':_0x26f8('0xc'),'fields':[_0x26f8('0xc')]},{'name':_0x26f8('0xd'),'fields':['plainBody',_0x26f8('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x1b3849,_0x5656d6,_0x895fcb){if(_0x1b3849[_0x26f8('0xf')]){_0x1b3849[_0x26f8('0x10')]=htmlToText[_0x26f8('0x11')](_0x1b3849[_0x26f8('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x895fcb(null,_0x5656d6);},'afterCreate':function(_0x35f41e,_0x54e8d8,_0x55717a){var _0x2a8722=_0x4944e9[_0x26f8('0x12')];var _0x21f558=_0x35f41e[_0x26f8('0x13')]({'plain':!![]});if(_0x21f558[_0x26f8('0x14')][_0x26f8('0x15')]()==='in'||_0x21f558['direction'][_0x26f8('0x15')]()===_0x26f8('0x16')&&!_0x21f558[_0x26f8('0x17')]&&!_['isNil'](_0x21f558[_0x26f8('0x18')])){_0x2a8722[_0x26f8('0x19')][_0x26f8('0x1a')]({'where':{'id':_0x21f558['MailInteractionId']}})['then'](function(_0x1474e9){if(_0x1474e9){_0x1474e9[_0x26f8('0x1b')]({'lastMsgAt':_0x21f558[_0x26f8('0x1c')],'lastMsgDirection':_0x21f558[_0x26f8('0x14')][_0x26f8('0x15')]()});}})[_0x26f8('0x1d')](function(_0x1062d9){console[_0x26f8('0x1e')](_0x1062d9);});}_0x55717a();}},'charset':_0x26f8('0x1f'),'collate':_0x26f8('0x20')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 4fac2bc..9fc262a 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 _0x958a=['./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost'];(function(_0x2dc35d,_0x2ef6f9){var _0x484204=function(_0x52267e){while(--_0x52267e){_0x2dc35d['push'](_0x2dc35d['shift']());}};_0x484204(++_0x2ef6f9);}(_0x958a,0x128));var _0xa958=function(_0x495adc,_0x1edd2a){_0x495adc=_0x495adc-0x0;var _0x4494c2=_0x958a[_0x495adc];return _0x4494c2;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});config[_0xa958('0xb')]=_[_0xa958('0xc')](config[_0xa958('0xb')],{'host':_0xa958('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa958('0xe'))[_0xa958('0xf')](socket);function respondWithRpcPromise(_0x11f090,_0x44b66e,_0x37afa0){return new BPromise(function(_0x94caac,_0xebb1c6){return client[_0xa958('0x10')](_0x11f090,_0x37afa0)[_0xa958('0x11')](function(_0x250999){logger[_0xa958('0x12')](_0xa958('0x13'),_0x44b66e,_0xa958('0x14'));logger['debug']('MailMessage,\x20%s,\x20%s,\x20%s',_0x44b66e,'request\x20sent',JSON[_0xa958('0x15')](_0x250999));if(_0x250999[_0xa958('0x16')]){if(_0x250999[_0xa958('0x16')]['code']===0x1f4){logger[_0xa958('0x16')]('MailMessage,\x20%s,\x20%s',_0x44b66e,_0x250999['error']['message']);return _0xebb1c6(_0x250999[_0xa958('0x16')][_0xa958('0x17')]);}logger[_0xa958('0x16')](_0xa958('0x13'),_0x44b66e,_0x250999[_0xa958('0x16')][_0xa958('0x17')]);return _0x94caac(_0x250999[_0xa958('0x16')][_0xa958('0x17')]);}else{logger['info'](_0xa958('0x13'),_0x44b66e,'request\x20sent');_0x94caac(_0x250999[_0xa958('0x18')][_0xa958('0x17')]);}})['catch'](function(_0xe4129a){logger[_0xa958('0x16')](_0xa958('0x13'),_0x44b66e,_0xe4129a);_0xebb1c6(_0xe4129a);});});}exports[_0xa958('0x19')]=function(_0x2759ad){var _0x1f82aa=this;return new Promise(function(_0x56314b,_0x4a90c2){return db[_0xa958('0x1a')][_0xa958('0x1b')](_0x2759ad[_0xa958('0x1c')],{'raw':_0x2759ad['options']?_0x2759ad[_0xa958('0x1d')][_0xa958('0x1e')]===undefined?!![]:![]:!![]})['then'](function(_0x28cf12){logger[_0xa958('0x12')]('CreateMailMessage',_0x2759ad);logger['debug'](_0xa958('0x19'),_0x2759ad,JSON[_0xa958('0x15')](_0x28cf12));_0x56314b(_0x28cf12);})['catch'](function(_0x25f461){logger[_0xa958('0x16')](_0xa958('0x19'),_0x25f461[_0xa958('0x17')],_0x2759ad);_0x4a90c2(_0x1f82aa[_0xa958('0x16')](0x1f4,_0x25f461[_0xa958('0x17')]));});});}; \ No newline at end of file +var _0x66fa=['lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','socket.io-emitter','./mailMessage.socket','request','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','CreateMailMessage','MailMessage','create','body','options','raw','stringify'];(function(_0x4a3f23,_0x4d2fed){var _0x5a6b22=function(_0x5ac4d6){while(--_0x5ac4d6){_0x4a3f23['push'](_0x4a3f23['shift']());}};_0x5a6b22(++_0x4d2fed);}(_0x66fa,0x117));var _0xa66f=function(_0x24e1aa,_0x203b42){_0x24e1aa=_0x24e1aa-0x0;var _0x3cfd6a=_0x66fa[_0x24e1aa];return _0x3cfd6a;};'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});config[_0xa66f('0xb')]=_[_0xa66f('0xc')](config[_0xa66f('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xa66f('0xd'))(new Redis(config['redis']));require(_0xa66f('0xe'))['register'](socket);function respondWithRpcPromise(_0x101e10,_0x53ca76,_0x52d802){return new BPromise(function(_0x55e6dc,_0x1e1997){return client[_0xa66f('0xf')](_0x101e10,_0x52d802)['then'](function(_0x14d31e){logger['info'](_0xa66f('0x10'),_0x53ca76,'request\x20sent');logger[_0xa66f('0x11')](_0xa66f('0x12'),_0x53ca76,_0xa66f('0x13'),JSON['stringify'](_0x14d31e));if(_0x14d31e['error']){if(_0x14d31e[_0xa66f('0x14')]['code']===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x53ca76,_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);return _0x1e1997(_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);}logger[_0xa66f('0x14')]('MailMessage,\x20%s,\x20%s',_0x53ca76,_0x14d31e['error'][_0xa66f('0x15')]);return _0x55e6dc(_0x14d31e[_0xa66f('0x14')][_0xa66f('0x15')]);}else{logger[_0xa66f('0x16')]('MailMessage,\x20%s,\x20%s',_0x53ca76,_0xa66f('0x13'));_0x55e6dc(_0x14d31e['result']['message']);}})[_0xa66f('0x17')](function(_0x413e80){logger[_0xa66f('0x14')](_0xa66f('0x10'),_0x53ca76,_0x413e80);_0x1e1997(_0x413e80);});});}exports[_0xa66f('0x18')]=function(_0x408bc7){var _0x251f60=this;return new Promise(function(_0x150291,_0x2033a4){return db[_0xa66f('0x19')][_0xa66f('0x1a')](_0x408bc7[_0xa66f('0x1b')],{'raw':_0x408bc7[_0xa66f('0x1c')]?_0x408bc7[_0xa66f('0x1c')][_0xa66f('0x1d')]===undefined?!![]:![]:!![]})['then'](function(_0x27f570){logger[_0xa66f('0x16')](_0xa66f('0x18'),_0x408bc7);logger[_0xa66f('0x11')]('CreateMailMessage',_0x408bc7,JSON[_0xa66f('0x1e')](_0x27f570));_0x150291(_0x27f570);})[_0xa66f('0x17')](function(_0x209f4d){logger[_0xa66f('0x14')]('CreateMailMessage',_0x209f4d['message'],_0x408bc7);_0x2033a4(_0x251f60[_0xa66f('0x14')](0x1f4,_0x209f4d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index a85b39e..17cd7bd 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 _0x9ba9=['emit','removeListener','length','save','remove'];(function(_0x231a47,_0x46a963){var _0x48d7c9=function(_0x1e69b1){while(--_0x1e69b1){_0x231a47['push'](_0x231a47['shift']());}};_0x48d7c9(++_0x46a963);}(_0x9ba9,0xb2));var _0x99ba=function(_0x4816b3,_0x10e8cb){_0x4816b3=_0x4816b3-0x0;var _0x2e6b77=_0x9ba9[_0x4816b3];return _0x2e6b77;};'use strict';var MailMessageEvents=require('./mailMessage.events');var events=[_0x99ba('0x0'),_0x99ba('0x1'),'update'];function createListener(_0x240be0,_0x49ec68){return function(_0x47d494){_0x49ec68[_0x99ba('0x2')](_0x240be0,_0x47d494);};}function removeListener(_0xe39c35,_0x5dfb1e){return function(){MailMessageEvents[_0x99ba('0x3')](_0xe39c35,_0x5dfb1e);};}exports['register']=function(_0x42c538){for(var _0x323f0c=0x0,_0x2c4f8b=events[_0x99ba('0x4')];_0x323f0c<_0x2c4f8b;_0x323f0c++){var _0x245aa4=events[_0x323f0c];var _0x29a914=createListener('mailMessage:'+_0x245aa4,_0x42c538);MailMessageEvents['on'](_0x245aa4,_0x29a914);}}; \ No newline at end of file +var _0xded4=['save','remove','update','removeListener','register','mailMessage:','./mailMessage.events'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xded4,0x19c));var _0x4ded=function(_0x59c4f0,_0x1e2bd5){_0x59c4f0=_0x59c4f0-0x0;var _0x2c0a2c=_0xded4[_0x59c4f0];return _0x2c0a2c;};'use strict';var MailMessageEvents=require(_0x4ded('0x0'));var events=[_0x4ded('0x1'),_0x4ded('0x2'),_0x4ded('0x3')];function createListener(_0x17a9a3,_0x2ec6bc){return function(_0x4c704b){_0x2ec6bc['emit'](_0x17a9a3,_0x4c704b);};}function removeListener(_0xe4e727,_0x5b35cc){return function(){MailMessageEvents[_0x4ded('0x4')](_0xe4e727,_0x5b35cc);};}exports[_0x4ded('0x5')]=function(_0x247ef5){for(var _0x54851c=0x0,_0x3ed48d=events['length'];_0x54851c<_0x3ed48d;_0x54851c++){var _0x233a04=events[_0x54851c];var _0x1828f4=createListener(_0x4ded('0x6')+_0x233a04,_0x247ef5);MailMessageEvents['on'](_0x233a04,_0x1828f4);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index eb860e0..91eba79 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 _0x2493=['removeAgents','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','describe','/:id','/:id/members','getMembers','/:id/users','create','/:id/teams','addTeams','post','addAgents','put','update','delete','destroy'];(function(_0x24169e,_0x4d07b1){var _0xa3b342=function(_0x5d234d){while(--_0x5d234d){_0x24169e['push'](_0x24169e['shift']());}};_0xa3b342(++_0x4d07b1);}(_0x2493,0x18a));var _0x3249=function(_0x4e7276,_0x2f9d62){_0x4e7276=_0x4e7276-0x0;var _0x2d35a4=_0x2493[_0x4e7276];return _0x2d35a4;};'use strict';var multer=require(_0x3249('0x0'));var util=require('util');var path=require(_0x3249('0x1'));var timeout=require(_0x3249('0x2'));var express=require(_0x3249('0x3'));var router=express[_0x3249('0x4')]();var fs_extra=require(_0x3249('0x5'));var auth=require(_0x3249('0x6'));var interaction=require(_0x3249('0x7'));var config=require(_0x3249('0x8'));var controller=require(_0x3249('0x9'));router[_0x3249('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x3249('0xa')]('/describe',auth[_0x3249('0xb')](),controller[_0x3249('0xc')]);router[_0x3249('0xa')](_0x3249('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x3249('0xa')](_0x3249('0xe'),auth['isAuthenticated'](),controller[_0x3249('0xf')]);router[_0x3249('0xa')]('/:id/teams',auth[_0x3249('0xb')](),controller['getTeams']);router[_0x3249('0xa')](_0x3249('0x10'),auth[_0x3249('0xb')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x3249('0x11')]);router['post'](_0x3249('0x12'),auth['isAuthenticated'](),controller[_0x3249('0x13')]);router[_0x3249('0x14')]('/:id/users',auth[_0x3249('0xb')](),controller[_0x3249('0x15')]);router[_0x3249('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x3249('0x17')]);router[_0x3249('0x18')]('/:id',auth[_0x3249('0xb')](),controller[_0x3249('0x19')]);router[_0x3249('0x18')](_0x3249('0x12'),auth[_0x3249('0xb')](),controller['removeTeams']);router[_0x3249('0x18')](_0x3249('0x10'),auth[_0x3249('0xb')](),controller[_0x3249('0x1a')]);module[_0x3249('0x1b')]=router; \ No newline at end of file +var _0xcb0b=['fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','describe','/:id','/:id/members','isAuthenticated','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router'];(function(_0x2becba,_0x4ea656){var _0x90b5dd=function(_0x26ae2b){while(--_0x26ae2b){_0x2becba['push'](_0x2becba['shift']());}};_0x90b5dd(++_0x4ea656);}(_0xcb0b,0xf7));var _0xbcb0=function(_0x25f642,_0x158db4){_0x25f642=_0x25f642-0x0;var _0x3c658e=_0xcb0b[_0x25f642];return _0x3c658e;};'use strict';var multer=require(_0xbcb0('0x0'));var util=require(_0xbcb0('0x1'));var path=require('path');var timeout=require(_0xbcb0('0x2'));var express=require(_0xbcb0('0x3'));var router=express[_0xbcb0('0x4')]();var fs_extra=require(_0xbcb0('0x5'));var auth=require(_0xbcb0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbcb0('0x7'));var controller=require(_0xbcb0('0x8'));router[_0xbcb0('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0xbcb0('0xa')]);router[_0xbcb0('0x9')](_0xbcb0('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xbcb0('0x9')](_0xbcb0('0xc'),auth[_0xbcb0('0xd')](),controller[_0xbcb0('0xe')]);router[_0xbcb0('0x9')](_0xbcb0('0xf'),auth[_0xbcb0('0xd')](),controller[_0xbcb0('0x10')]);router['get'](_0xbcb0('0x11'),auth[_0xbcb0('0xd')](),controller[_0xbcb0('0x12')]);router['post']('/',auth[_0xbcb0('0xd')](),controller[_0xbcb0('0x13')]);router[_0xbcb0('0x14')]('/:id/teams',auth[_0xbcb0('0xd')](),controller['addTeams']);router[_0xbcb0('0x14')](_0xbcb0('0x11'),auth['isAuthenticated'](),controller[_0xbcb0('0x15')]);router['put'](_0xbcb0('0xb'),auth['isAuthenticated'](),controller[_0xbcb0('0x16')]);router[_0xbcb0('0x17')](_0xbcb0('0xb'),auth[_0xbcb0('0xd')](),controller[_0xbcb0('0x18')]);router[_0xbcb0('0x17')](_0xbcb0('0xf'),auth[_0xbcb0('0xd')](),controller[_0xbcb0('0x19')]);router[_0xbcb0('0x17')](_0xbcb0('0x11'),auth[_0xbcb0('0xd')](),controller[_0xbcb0('0x1a')]);module[_0xbcb0('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 1515f9b..1982310 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 _0x32cc=['roundrobin','sequelize','exports','STRING','ENUM','beepall'];(function(_0x57c358,_0x250258){var _0x3b299c=function(_0x41b2de){while(--_0x41b2de){_0x57c358['push'](_0x57c358['shift']());}};_0x3b299c(++_0x250258);}(_0x32cc,0x85));var _0xc32c=function(_0x137842,_0x319515){_0x137842=_0x137842-0x0;var _0x505945=_0x32cc[_0x137842];return _0x505945;};'use strict';var Sequelize=require(_0xc32c('0x0'));module[_0xc32c('0x1')]={'name':{'type':Sequelize[_0xc32c('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xc32c('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xc32c('0x3')]('rrmemory',_0xc32c('0x4'),_0xc32c('0x5'))}}; \ No newline at end of file +var _0xe739=['INTEGER','ENUM','roundrobin','sequelize','exports','name','STRING'];(function(_0x4b6bb3,_0x2a5c7c){var _0x2ae946=function(_0xf65e57){while(--_0xf65e57){_0x4b6bb3['push'](_0x4b6bb3['shift']());}};_0x2ae946(++_0x2a5c7c);}(_0xe739,0x7a));var _0x9e73=function(_0x4e6e0c,_0x1def73){_0x4e6e0c=_0x4e6e0c-0x0;var _0x514e31=_0xe739[_0x4e6e0c];return _0x514e31;};'use strict';var Sequelize=require(_0x9e73('0x0'));module[_0x9e73('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9e73('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9e73('0x3')]},'timeout':{'type':Sequelize[_0x9e73('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9e73('0x5')]('rrmemory','beepall',_0x9e73('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index c064b0b..e14fbd9 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 _0x9d0d=['order','sort','MailQueueId','filter','merge','findAll','User','findAndCountAll','UserId','mailPause','updatedAt','format','SIP','createdAt','getTeams','Team','hasOwnProperty','nolimit','addTeams','ids','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','removeTeams','Agents','select','field','tq.TeamId','team_has_mail_queues','user_has_teams','MailQueueId\x20=\x20?','clone','push','toString','QueryTypes','SELECT','TeamId','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','isArray','getAgents','pick','bluebird','lodash','squel','ioredis','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./mailQueue.socket','register','end','status','json','offset','undefined','count','limit','set','update','then','get','MailQueues','UserProfileResource','destroy','error','stack','name','index','map','MailQueue','rawAttributes','type','key','getOptions','where','include','query','rows','show','model','keys','filters','intersection','attributes','fields','length','options','find','catch','create','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','UserMailQueue'];(function(_0x4fabbe,_0xc514f3){var _0x5510dd=function(_0x1e7d23){while(--_0x1e7d23){_0x4fabbe['push'](_0x4fabbe['shift']());}};_0x5510dd(++_0xc514f3);}(_0x9d0d,0xaa));var _0xd9d0=function(_0x4eff1d,_0x44a9f2){_0x4eff1d=_0x4eff1d-0x0;var _0x38173a=_0x9d0d[_0x4eff1d];return _0x38173a;};'use strict';var BPromise=require(_0xd9d0('0x0'));var util=require('util');var _=require(_0xd9d0('0x1'));var squel=require(_0xd9d0('0x2'));var Redis=require(_0xd9d0('0x3'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')('api');var config=require(_0xd9d0('0x4'));var db=require(_0xd9d0('0x5'))['db'];config[_0xd9d0('0x6')]=_['defaults'](config[_0xd9d0('0x6')],{'host':_0xd9d0('0x7'),'port':0x18eb});var socket=require(_0xd9d0('0x8'))(new Redis(config[_0xd9d0('0x6')]));require(_0xd9d0('0x9'))[_0xd9d0('0xa')](socket);function respondWithStatusCode(_0x238bc6,_0x49851d){_0x49851d=_0x49851d||0xcc;return function(_0x40e3f1){if(_0x40e3f1){return _0x238bc6['sendStatus'](_0x49851d);}return _0x238bc6['status'](_0x49851d)[_0xd9d0('0xb')]();};}function respondWithResult(_0xe2918a,_0x3a2a22){_0x3a2a22=_0x3a2a22||0xc8;return function(_0x30f632){if(_0x30f632){return _0xe2918a[_0xd9d0('0xc')](_0x3a2a22)[_0xd9d0('0xd')](_0x30f632);}};}function respondWithFilteredResult(_0x1f0ec2,_0x5b45b0){return function(_0x3264d){if(_0x3264d){var _0x358d25=typeof _0x5b45b0[_0xd9d0('0xe')]===_0xd9d0('0xf')&&typeof _0x5b45b0['limit']===_0xd9d0('0xf');var _0x3ede6f=_0x3264d['count'];var _0x30e3ef=_0x358d25?0x0:_0x5b45b0['offset'];var _0x8d755a=_0x358d25?_0x3264d[_0xd9d0('0x10')]:_0x5b45b0['offset']+_0x5b45b0[_0xd9d0('0x11')];var _0x3d5f31;if(_0x8d755a>=_0x3ede6f){_0x8d755a=_0x3ede6f;_0x3d5f31=0xc8;}else{_0x3d5f31=0xce;}_0x1f0ec2[_0xd9d0('0xc')](_0x3d5f31);return _0x1f0ec2[_0xd9d0('0x12')]('Content-Range',_0x30e3ef+'-'+_0x8d755a+'/'+_0x3ede6f)[_0xd9d0('0xd')](_0x3264d);}return null;};}function saveUpdates(_0x382b1c){return function(_0x1e72e4){if(_0x1e72e4){return _0x1e72e4[_0xd9d0('0x13')](_0x382b1c)[_0xd9d0('0x14')](function(_0x53cc99){return _0x53cc99;});}return null;};}function removeEntity(_0x4bae96){return function(_0x1e9f02){if(_0x1e9f02){return _0x1e9f02['destroy']()[_0xd9d0('0x14')](function(){var _0x324e2f=_0x1e9f02[_0xd9d0('0x15')]({'plain':!![]});var _0x567160=_0xd9d0('0x16');return db[_0xd9d0('0x17')][_0xd9d0('0x18')]({'where':{'type':_0x567160,'resourceId':_0x324e2f['id']}})['then'](function(){return _0x1e9f02;});})[_0xd9d0('0x14')](function(){_0x4bae96['status'](0xcc)[_0xd9d0('0xb')]();});}};}function handleEntityNotFound(_0x1772ca){return function(_0x1cda6c){if(!_0x1cda6c){_0x1772ca['sendStatus'](0x194);}return _0x1cda6c;};}function handleError(_0x147e8e,_0x5ea1a0){_0x5ea1a0=_0x5ea1a0||0x1f4;return function(_0x3de6da){logger[_0xd9d0('0x19')](_0x3de6da[_0xd9d0('0x1a')]);if(_0x3de6da[_0xd9d0('0x1b')]){delete _0x3de6da[_0xd9d0('0x1b')];}_0x147e8e['status'](_0x5ea1a0)['send'](_0x3de6da);};}exports[_0xd9d0('0x1c')]=function(_0x208a91,_0x413135){var _0x5d9a19={};var _0x161c36={'count':0x0,'rows':[]};var _0x5c64f3=_[_0xd9d0('0x1d')](db[_0xd9d0('0x1e')][_0xd9d0('0x1f')],function(_0x17b222){return{'name':_0x17b222['fieldName'],'type':_0x17b222[_0xd9d0('0x20')][_0xd9d0('0x21')]};});_0x5d9a19=qs[_0xd9d0('0x22')](_0x5c64f3,_0x208a91);var _0x43053d={'where':_0x5d9a19[_0xd9d0('0x23')]};return db[_0xd9d0('0x1e')][_0xd9d0('0x10')](_0x43053d)[_0xd9d0('0x14')](function(_0x3f4fa3){_0x161c36['count']=_0x3f4fa3;_0x5d9a19[_0xd9d0('0x24')]=qs[_0xd9d0('0x24')](_0x208a91[_0xd9d0('0x25')]);return db[_0xd9d0('0x1e')]['findAll'](_0x5d9a19);})[_0xd9d0('0x14')](function(_0x5ac041){_0x161c36[_0xd9d0('0x26')]=_0x5ac041;return _0x161c36;})[_0xd9d0('0x14')](respondWithFilteredResult(_0x413135,_0x5d9a19))['catch'](handleError(_0x413135,null));};exports[_0xd9d0('0x27')]=function(_0xa5ee82,_0x4cc0c7){var _0x20e2ab={'raw':!![],'where':{'id':_0xa5ee82['params']['id']}},_0x9cdcf0={};_0x9cdcf0[_0xd9d0('0x28')]=_[_0xd9d0('0x29')](db[_0xd9d0('0x1e')][_0xd9d0('0x1f')]);_0x9cdcf0[_0xd9d0('0x25')]=_[_0xd9d0('0x29')](_0xa5ee82[_0xd9d0('0x25')]);_0x9cdcf0[_0xd9d0('0x2a')]=_[_0xd9d0('0x2b')](_0x9cdcf0[_0xd9d0('0x28')],_0x9cdcf0[_0xd9d0('0x25')]);_0x20e2ab[_0xd9d0('0x2c')]=_[_0xd9d0('0x2b')](_0x9cdcf0['model'],qs[_0xd9d0('0x2d')](_0xa5ee82['query'][_0xd9d0('0x2d')]));_0x20e2ab['attributes']=_0x20e2ab[_0xd9d0('0x2c')][_0xd9d0('0x2e')]?_0x20e2ab[_0xd9d0('0x2c')]:_0x9cdcf0[_0xd9d0('0x28')];if(_0xa5ee82[_0xd9d0('0x25')]['includeAll']){_0x20e2ab[_0xd9d0('0x24')]=[{'all':!![]}];}_0x20e2ab=_['merge']({},_0x20e2ab,_0xa5ee82[_0xd9d0('0x2f')]);return db[_0xd9d0('0x1e')][_0xd9d0('0x30')](_0x20e2ab)[_0xd9d0('0x14')](handleEntityNotFound(_0x4cc0c7,null))['then'](respondWithResult(_0x4cc0c7,null))[_0xd9d0('0x31')](handleError(_0x4cc0c7,null));};exports['create']=function(_0x346209,_0x2794b3){return db[_0xd9d0('0x1e')][_0xd9d0('0x32')](_0x346209['body'],{})[_0xd9d0('0x14')](function(_0x535fc5){var _0x1ad11d=_0x346209[_0xd9d0('0x33')][_0xd9d0('0x15')]({'plain':!![]});if(!_0x1ad11d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ad11d[_0xd9d0('0x34')]===_0xd9d0('0x33')){var _0x57370d=_0x535fc5[_0xd9d0('0x15')]({'plain':!![]});var _0x4d348f=_0xd9d0('0x16');return db[_0xd9d0('0x35')]['find']({'where':{'name':_0x4d348f,'userProfileId':_0x1ad11d['userProfileId']},'raw':!![]})[_0xd9d0('0x14')](function(_0x1cb561){if(_0x1cb561&&_0x1cb561[_0xd9d0('0x36')]===0x0){return db[_0xd9d0('0x17')][_0xd9d0('0x32')]({'name':_0x57370d[_0xd9d0('0x1b')],'resourceId':_0x57370d['id'],'type':_0x1cb561[_0xd9d0('0x1b')],'sectionId':_0x1cb561['id']},{})[_0xd9d0('0x14')](function(){return _0x535fc5;});}else{return _0x535fc5;}})[_0xd9d0('0x31')](function(_0x2fa75b){logger['error'](_0xd9d0('0x37'),_0x2fa75b);throw _0x2fa75b;});}return _0x535fc5;})[_0xd9d0('0x14')](respondWithResult(_0x2794b3,0xc9))['catch'](handleError(_0x2794b3,null));};exports[_0xd9d0('0x13')]=function(_0x49770f,_0x46cf1f){if(_0x49770f['body']['id']){delete _0x49770f[_0xd9d0('0x38')]['id'];}return db[_0xd9d0('0x1e')][_0xd9d0('0x30')]({'where':{'id':_0x49770f[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](handleEntityNotFound(_0x46cf1f,null))['then'](saveUpdates(_0x49770f[_0xd9d0('0x38')],null))[_0xd9d0('0x14')](respondWithResult(_0x46cf1f,null))[_0xd9d0('0x31')](handleError(_0x46cf1f,null));};exports['destroy']=function(_0x229f7f,_0x21dd6c){return db['MailQueue']['find']({'where':{'id':_0x229f7f[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](handleEntityNotFound(_0x21dd6c,null))[_0xd9d0('0x14')](removeEntity(_0x21dd6c,null))[_0xd9d0('0x31')](handleError(_0x21dd6c,null));};exports[_0xd9d0('0x3a')]=function(_0x28e8a5,_0x19286b){return db[_0xd9d0('0x1e')]['describe']()[_0xd9d0('0x14')](respondWithResult(_0x19286b,null))[_0xd9d0('0x31')](handleError(_0x19286b,null));};exports[_0xd9d0('0x3b')]=function(_0x395c47,_0x48b2e3){var _0x42c275={'raw':!![],'where':{}},_0x2f5345={},_0x739024;return db['MailQueue'][_0xd9d0('0x3c')]({'where':{'id':_0x395c47[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](handleEntityNotFound(_0x48b2e3,null))[_0xd9d0('0x14')](function(_0x2d3516){if(_0x2d3516){_0x739024=_0x2d3516['get']({'plain':!![]});_0x2f5345[_0xd9d0('0x28')]=_[_0xd9d0('0x29')](db[_0xd9d0('0x3d')]['rawAttributes']);_0x2f5345['query']=_[_0xd9d0('0x29')](_0x395c47['query']);_0x2f5345['filters']=_['intersection'](_0x2f5345[_0xd9d0('0x28')],_0x2f5345[_0xd9d0('0x25')]);_0x42c275[_0xd9d0('0x2c')]=_[_0xd9d0('0x2b')](_0x2f5345[_0xd9d0('0x28')],qs['fields'](_0x395c47[_0xd9d0('0x25')][_0xd9d0('0x2d')]));_0x42c275['attributes']=_0x42c275[_0xd9d0('0x2c')][_0xd9d0('0x2e')]?_0x42c275['attributes']:_0x2f5345[_0xd9d0('0x28')];if(!_0x395c47[_0xd9d0('0x25')]['hasOwnProperty']('nolimit')){_0x42c275[_0xd9d0('0x11')]=qs['limit'](_0x395c47[_0xd9d0('0x25')][_0xd9d0('0x11')]);_0x42c275[_0xd9d0('0xe')]=qs['offset'](_0x395c47['query'][_0xd9d0('0xe')]);}_0x42c275[_0xd9d0('0x3e')]=qs[_0xd9d0('0x3f')](_0x395c47[_0xd9d0('0x25')][_0xd9d0('0x3f')]);_0x42c275[_0xd9d0('0x23')]=qs[_0xd9d0('0x2a')](_['pick'](_0x395c47[_0xd9d0('0x25')],_0x2f5345[_0xd9d0('0x2a')]));_0x42c275[_0xd9d0('0x23')][_0xd9d0('0x40')]=_0x2d3516['id'];if(_0x395c47[_0xd9d0('0x25')][_0xd9d0('0x41')]){_0x42c275[_0xd9d0('0x23')]=_[_0xd9d0('0x42')](_0x42c275[_0xd9d0('0x23')],{'$or':_[_0xd9d0('0x1d')](_0x42c275[_0xd9d0('0x2c')],function(_0x4f8de7){var _0x117e33={};_0x117e33[_0x4f8de7]={'$like':'%'+_0x395c47['query'][_0xd9d0('0x41')]+'%'};return _0x117e33;})});}_0x42c275=_['merge']({},_0x42c275,_0x395c47[_0xd9d0('0x2f')]);return db[_0xd9d0('0x3d')][_0xd9d0('0x43')](_0x42c275);}})[_0xd9d0('0x14')](function(_0x3eb230){if(_0x3eb230){return db[_0xd9d0('0x44')][_0xd9d0('0x45')]({'where':{'id':_['map'](_0x3eb230,_0xd9d0('0x46')),'role':'agent'},'attributes':['id',_0xd9d0('0x1b'),_0xd9d0('0x47'),_0xd9d0('0x48'),'createdAt']});}})[_0xd9d0('0x14')](function(_0x360a40){if(_0x360a40){return{'count':_0x360a40['count'],'rows':_[_0xd9d0('0x1d')](_0x360a40[_0xd9d0('0x26')],function(_0x4c58f6){return{'membername':_0x4c58f6['name'],'UserId':_0x4c58f6['id'],'queue_name':_0x739024[_0xd9d0('0x1b')],'MailQueueId':_0x739024['id'],'interface':util[_0xd9d0('0x49')]('%s/%s',_0xd9d0('0x4a'),_0x4c58f6[_0xd9d0('0x1b')]),'penalty':0x0,'paused':_0x4c58f6[_0xd9d0('0x47')],'createdAt':_0x4c58f6[_0xd9d0('0x4b')],'updatedAt':_0x4c58f6['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xd9d0('0x14')](respondWithFilteredResult(_0x48b2e3,_0x42c275))['catch'](handleError(_0x48b2e3,null));};exports[_0xd9d0('0x4c')]=function(_0x4b6ced,_0x17edca){var _0x25359e={};var _0x29298b={};var _0x1e3a3d;var _0x5a80e2;return db[_0xd9d0('0x1e')][_0xd9d0('0x3c')]({'where':{'id':_0x4b6ced[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](handleEntityNotFound(_0x17edca,null))[_0xd9d0('0x14')](function(_0x1a972c){if(_0x1a972c){_0x1e3a3d=_0x1a972c;_0x29298b[_0xd9d0('0x28')]=_[_0xd9d0('0x29')](db[_0xd9d0('0x4d')]['rawAttributes']);_0x29298b[_0xd9d0('0x25')]=_[_0xd9d0('0x29')](_0x4b6ced[_0xd9d0('0x25')]);_0x29298b['filters']=_[_0xd9d0('0x2b')](_0x29298b[_0xd9d0('0x28')],_0x29298b[_0xd9d0('0x25')]);_0x25359e[_0xd9d0('0x2c')]=_['intersection'](_0x29298b[_0xd9d0('0x28')],qs[_0xd9d0('0x2d')](_0x4b6ced[_0xd9d0('0x25')][_0xd9d0('0x2d')]));_0x25359e[_0xd9d0('0x2c')]=_0x25359e[_0xd9d0('0x2c')][_0xd9d0('0x2e')]?_0x25359e[_0xd9d0('0x2c')]:_0x29298b[_0xd9d0('0x28')];_0x25359e[_0xd9d0('0x3e')]=qs[_0xd9d0('0x3f')](_0x4b6ced['query'][_0xd9d0('0x3f')]);_0x25359e[_0xd9d0('0x23')]=qs[_0xd9d0('0x2a')](_['pick'](_0x4b6ced[_0xd9d0('0x25')],_0x29298b['filters']));if(_0x4b6ced[_0xd9d0('0x25')]['filter']){_0x25359e[_0xd9d0('0x23')]=_[_0xd9d0('0x42')](_0x25359e['where'],{'$or':_[_0xd9d0('0x1d')](_0x25359e[_0xd9d0('0x2c')],function(_0x188ad1){var _0x42dc0c={};_0x42dc0c[_0x188ad1]={'$like':'%'+_0x4b6ced[_0xd9d0('0x25')][_0xd9d0('0x41')]+'%'};return _0x42dc0c;})});}_0x25359e=_[_0xd9d0('0x42')]({},_0x25359e,_0x4b6ced[_0xd9d0('0x2f')]);return _0x1e3a3d['getTeams'](_0x25359e);}})[_0xd9d0('0x14')](function(_0x1c3c6b){if(_0x1c3c6b){_0x5a80e2=_0x1c3c6b[_0xd9d0('0x2e')];if(!_0x4b6ced[_0xd9d0('0x25')][_0xd9d0('0x4e')](_0xd9d0('0x4f'))){_0x25359e[_0xd9d0('0x11')]=qs['limit'](_0x4b6ced[_0xd9d0('0x25')][_0xd9d0('0x11')]);_0x25359e[_0xd9d0('0xe')]=qs['offset'](_0x4b6ced[_0xd9d0('0x25')][_0xd9d0('0xe')]);}return _0x1e3a3d['getTeams'](_0x25359e);}})['then'](function(_0x4cb032){if(_0x4cb032){return _0x4cb032?{'count':_0x5a80e2,'rows':_0x4cb032}:null;}})[_0xd9d0('0x14')](respondWithResult(_0x17edca,null))['catch'](handleError(_0x17edca,null));};exports[_0xd9d0('0x50')]=function(_0x49bafa,_0x5a6e7f){var _0x192e31=_0x49bafa[_0xd9d0('0x38')][_0xd9d0('0x51')];return db[_0xd9d0('0x4d')]['findAll']({'where':{'id':_0x192e31},'attributes':['id'],'include':[{'model':db[_0xd9d0('0x44')],'as':'Agents','attributes':['id',_0xd9d0('0x1b'),'online',_0xd9d0('0x52'),'interface'],'raw':!![]}]})[_0xd9d0('0x14')](function(_0x2f67b1){if(_0x2f67b1){var _0x24481b=_[_0xd9d0('0x53')](_0x2f67b1,function(_0x33d579){var _0x563c9d=_0x33d579[_0xd9d0('0x15')]({'plain':!![]});return _0x563c9d['Agents'];});return db['MailQueue'][_0xd9d0('0x30')]({'where':{'id':_0x49bafa[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](function(_0x4f1a4a){return db[_0xd9d0('0x54')][_0xd9d0('0x55')](function(_0x17736d){return _0x4f1a4a['addTeams'](_0x192e31,{'transaction':_0x17736d})[_0xd9d0('0x14')](function(){return BPromise[_0xd9d0('0x56')](_0x24481b,function(_0x42fa10){return db[_0xd9d0('0x3d')][_0xd9d0('0x57')]({'where':{'UserId':_0x42fa10['id'],'MailQueueId':_0x49bafa[_0xd9d0('0x39')]['id']},'transaction':_0x17736d});});})[_0xd9d0('0x14')](function(){_0x24481b[_0xd9d0('0x58')](function(_0x2c189b){socket[_0xd9d0('0x59')]('userMailQueue:save',{'UserId':_0x2c189b['id'],'MailQueueId':_0x4f1a4a['id']});});});});});}})[_0xd9d0('0x14')](respondWithStatusCode(_0x5a6e7f,null))['catch'](handleError(_0x5a6e7f,null));};exports[_0xd9d0('0x5a')]=function(_0x1c3576,_0x349a04){return db['Team']['findAll']({'where':{'id':_0x1c3576[_0xd9d0('0x25')][_0xd9d0('0x51')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xd9d0('0x5b'),'attributes':['id'],'raw':!![]}]})[_0xd9d0('0x14')](handleEntityNotFound(_0x349a04,null))[_0xd9d0('0x14')](function(_0x25e4f4){var _0x248511=_[_0xd9d0('0x1d')](_0x25e4f4,'id');var _0x2753d8=[];var _0x34aa11=[];var _0x171848=squel[_0xd9d0('0x5c')]();_0x171848[_0xd9d0('0x5d')](_0xd9d0('0x5e'))['from'](_0xd9d0('0x5f'),'tq')['join'](_0xd9d0('0x60'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0xd9d0('0x61'),_0x1c3576[_0xd9d0('0x39')]['id']);for(var _0x3d720a=0x0;_0x3d720a<_0x25e4f4[_0xd9d0('0x2e')];_0x3d720a+=0x1){let _0x3df714=_0x25e4f4[_0x3d720a];for(var _0x225b50=0x0;_0x225b50<_0x3df714['Agents'][_0xd9d0('0x2e')];_0x225b50+=0x1){let _0x5cdfd7=_0x3df714[_0xd9d0('0x5b')][_0x225b50];var _0xf7f359=_0x171848[_0xd9d0('0x62')]();_0xf7f359[_0xd9d0('0x23')]('ut.UserId\x20=\x20?',_0x5cdfd7['id']);_0x34aa11[_0xd9d0('0x63')](db['sequelize'][_0xd9d0('0x25')](_0xf7f359[_0xd9d0('0x64')](),{'type':db[_0xd9d0('0x54')][_0xd9d0('0x65')][_0xd9d0('0x66')]})['then'](function(_0x3f46b3){if(_0x3f46b3[_0xd9d0('0x2e')]===0x1){return _0x5cdfd7['id'];}else{var _0x5b2ac4=_['every'](_[_0xd9d0('0x1d')](_0x3f46b3,_0xd9d0('0x67')),function(_0x27fda1){return _['includes'](_0x248511,_0x27fda1);});if(_0x5b2ac4){return _0x5cdfd7['id'];}}}));}}return BPromise['all'](_0x34aa11)[_0xd9d0('0x14')](function(_0x1bd974){_0x2753d8=_(_0x2753d8)[_0xd9d0('0x68')](_0x1bd974)[_0xd9d0('0x69')]()[_0xd9d0('0x6a')]();return db[_0xd9d0('0x1e')]['find']({'where':{'id':_0x1c3576[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](function(_0x5e17a4){return db['sequelize'][_0xd9d0('0x55')](function(_0x570285){return _0x5e17a4[_0xd9d0('0x5a')](_0x1c3576[_0xd9d0('0x25')][_0xd9d0('0x51')],{'transaction':_0x570285})[_0xd9d0('0x14')](function(){if(!_[_0xd9d0('0x6b')](_0x2753d8)){return _0x5e17a4[_0xd9d0('0x6c')](_0x2753d8,{'transaction':_0x570285});}})[_0xd9d0('0x14')](function(){_0x2753d8['forEach'](function(_0x42b176){socket[_0xd9d0('0x59')](_0xd9d0('0x6d'),{'UserId':_0x42b176,'MailQueueId':_0x5e17a4['id']});});});});});});})[_0xd9d0('0x14')](respondWithStatusCode(_0x349a04,null))['catch'](handleError(_0x349a04,null));};exports[_0xd9d0('0x6e')]=function(_0x4a4302,_0x3d69da){return db['MailQueue'][_0xd9d0('0x30')]({'where':{'id':_0x4a4302[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](handleEntityNotFound(_0x3d69da,null))[_0xd9d0('0x14')](function(_0x295a76){if(_0x295a76){return _0x295a76[_0xd9d0('0x6e')](_0x4a4302[_0xd9d0('0x38')][_0xd9d0('0x51')],_[_0xd9d0('0x6f')](_0x4a4302[_0xd9d0('0x38')],['ids','id'])||{})[_0xd9d0('0x70')](function(_0x293d62){for(var _0x20c188=0x0;_0x20c188<_0x4a4302[_0xd9d0('0x38')][_0xd9d0('0x51')][_0xd9d0('0x2e')];_0x20c188+=0x1){socket[_0xd9d0('0x59')]('userMailQueue:save',{'UserId':Number(_0x4a4302[_0xd9d0('0x38')][_0xd9d0('0x51')][_0x20c188]),'MailQueueId':Number(_0x4a4302['params']['id'])});}return _0x293d62;});}})[_0xd9d0('0x14')](respondWithResult(_0x3d69da,null))['catch'](handleError(_0x3d69da,null));};exports[_0xd9d0('0x6c')]=function(_0x58a3ce,_0x2cb3cc){return db[_0xd9d0('0x1e')][_0xd9d0('0x30')]({'where':{'id':_0x58a3ce[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](handleEntityNotFound(_0x2cb3cc,null))['then'](function(_0x2baa40){if(_0x2baa40){return _0x2baa40[_0xd9d0('0x6c')](_0x58a3ce[_0xd9d0('0x25')]['ids'])[_0xd9d0('0x14')](function(){if(_[_0xd9d0('0x71')](_0x58a3ce[_0xd9d0('0x25')][_0xd9d0('0x51')])){for(var _0x5b36b1=0x0;_0x5b36b1<_0x58a3ce[_0xd9d0('0x25')][_0xd9d0('0x51')]['length'];_0x5b36b1+=0x1){socket[_0xd9d0('0x59')](_0xd9d0('0x6d'),{'UserId':Number(_0x58a3ce['query'][_0xd9d0('0x51')][_0x5b36b1]),'MailQueueId':Number(_0x58a3ce['params']['id'])});}}else{socket[_0xd9d0('0x59')](_0xd9d0('0x6d'),{'UserId':Number(_0x58a3ce[_0xd9d0('0x25')][_0xd9d0('0x51')]),'MailQueueId':Number(_0x58a3ce[_0xd9d0('0x39')]['id'])});}});}})[_0xd9d0('0x14')](respondWithStatusCode(_0x2cb3cc,null))[_0xd9d0('0x31')](handleError(_0x2cb3cc,null));};exports[_0xd9d0('0x72')]=function(_0x5865e7,_0x5f1985){var _0x33b056={};var _0x3a8902={};var _0x3f3def;var _0x30e404;return db[_0xd9d0('0x1e')][_0xd9d0('0x3c')]({'where':{'id':_0x5865e7[_0xd9d0('0x39')]['id']}})[_0xd9d0('0x14')](handleEntityNotFound(_0x5f1985,null))[_0xd9d0('0x14')](function(_0x596600){if(_0x596600){_0x3f3def=_0x596600;_0x3a8902['model']=_[_0xd9d0('0x29')](db[_0xd9d0('0x44')][_0xd9d0('0x1f')]);_0x3a8902[_0xd9d0('0x25')]=_['keys'](_0x5865e7[_0xd9d0('0x25')]);_0x3a8902[_0xd9d0('0x2a')]=_[_0xd9d0('0x2b')](_0x3a8902[_0xd9d0('0x28')],_0x3a8902[_0xd9d0('0x25')]);_0x33b056[_0xd9d0('0x2c')]=_[_0xd9d0('0x2b')](_0x3a8902[_0xd9d0('0x28')],qs['fields'](_0x5865e7[_0xd9d0('0x25')][_0xd9d0('0x2d')]));_0x33b056['attributes']=_0x33b056[_0xd9d0('0x2c')]['length']?_0x33b056[_0xd9d0('0x2c')]:_0x3a8902['model'];_0x33b056[_0xd9d0('0x3e')]=qs[_0xd9d0('0x3f')](_0x5865e7[_0xd9d0('0x25')][_0xd9d0('0x3f')]);_0x33b056[_0xd9d0('0x23')]=qs['filters'](_[_0xd9d0('0x73')](_0x5865e7[_0xd9d0('0x25')],_0x3a8902[_0xd9d0('0x2a')]));if(_0x5865e7[_0xd9d0('0x25')][_0xd9d0('0x41')]){_0x33b056[_0xd9d0('0x23')]=_[_0xd9d0('0x42')](_0x33b056[_0xd9d0('0x23')],{'$or':_['map'](_0x33b056[_0xd9d0('0x2c')],function(_0x4ef84f){var _0x1c8879={};_0x1c8879[_0x4ef84f]={'$like':'%'+_0x5865e7[_0xd9d0('0x25')][_0xd9d0('0x41')]+'%'};return _0x1c8879;})});}_0x33b056=_['merge']({},_0x33b056,_0x5865e7[_0xd9d0('0x2f')]);return _0x3f3def[_0xd9d0('0x72')](_0x33b056);}})[_0xd9d0('0x14')](function(_0x27b209){if(_0x27b209){_0x30e404=_0x27b209['length'];if(!_0x5865e7['query']['hasOwnProperty'](_0xd9d0('0x4f'))){_0x33b056[_0xd9d0('0x11')]=qs[_0xd9d0('0x11')](_0x5865e7[_0xd9d0('0x25')][_0xd9d0('0x11')]);_0x33b056['offset']=qs[_0xd9d0('0xe')](_0x5865e7[_0xd9d0('0x25')][_0xd9d0('0xe')]);}return _0x3f3def[_0xd9d0('0x72')](_0x33b056);}})[_0xd9d0('0x14')](function(_0x5530cd){if(_0x5530cd){return _0x5530cd?{'count':_0x30e404,'rows':_0x5530cd}:null;}})['then'](respondWithResult(_0x5f1985,null))[_0xd9d0('0x31')](handleError(_0x5f1985,null));}; \ No newline at end of file +var _0xd80e=['MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','omit','spread','getAgents','bluebird','squel','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./mailQueue.socket','sendStatus','status','json','undefined','count','offset','limit','Content-Range','update','then','destroy','get','end','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','model','keys','filters','intersection','attributes','fields','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserMailQueue','length','nolimit','order','sort','pick','MailQueueId','User','findAndCountAll','UserId','mailPause','updatedAt','createdAt','format','%s/%s','SIP','Team','filter','getTeams','hasOwnProperty','ids','Agents','online','flatMap','sequelize','transaction','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','field','from','join','user_has_teams'];(function(_0x5e4624,_0x3fc116){var _0x104047=function(_0x522799){while(--_0x522799){_0x5e4624['push'](_0x5e4624['shift']());}};_0x104047(++_0x3fc116);}(_0xd80e,0x174));var _0xed80=function(_0x797d7e,_0xc00354){_0x797d7e=_0x797d7e-0x0;var _0x36552c=_0xd80e[_0x797d7e];return _0x36552c;};'use strict';var BPromise=require(_0xed80('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0xed80('0x1'));var Redis=require('ioredis');var qs=require(_0xed80('0x2'));var logger=require(_0xed80('0x3'))(_0xed80('0x4'));var config=require(_0xed80('0x5'));var db=require(_0xed80('0x6'))['db'];config[_0xed80('0x7')]=_['defaults'](config[_0xed80('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xed80('0x8'))(new Redis(config[_0xed80('0x7')]));require(_0xed80('0x9'))['register'](socket);function respondWithStatusCode(_0x60766e,_0x47b190){_0x47b190=_0x47b190||0xcc;return function(_0x59ce4e){if(_0x59ce4e){return _0x60766e[_0xed80('0xa')](_0x47b190);}return _0x60766e[_0xed80('0xb')](_0x47b190)['end']();};}function respondWithResult(_0x26a7c1,_0x5648bd){_0x5648bd=_0x5648bd||0xc8;return function(_0x29a3b8){if(_0x29a3b8){return _0x26a7c1[_0xed80('0xb')](_0x5648bd)[_0xed80('0xc')](_0x29a3b8);}};}function respondWithFilteredResult(_0x3064ab,_0x20583f){return function(_0x2eb50b){if(_0x2eb50b){var _0x672ca8=typeof _0x20583f['offset']===_0xed80('0xd')&&typeof _0x20583f['limit']===_0xed80('0xd');var _0x53957f=_0x2eb50b[_0xed80('0xe')];var _0x16d243=_0x672ca8?0x0:_0x20583f[_0xed80('0xf')];var _0x5a38d0=_0x672ca8?_0x2eb50b[_0xed80('0xe')]:_0x20583f[_0xed80('0xf')]+_0x20583f[_0xed80('0x10')];var _0x190bec;if(_0x5a38d0>=_0x53957f){_0x5a38d0=_0x53957f;_0x190bec=0xc8;}else{_0x190bec=0xce;}_0x3064ab['status'](_0x190bec);return _0x3064ab['set'](_0xed80('0x11'),_0x16d243+'-'+_0x5a38d0+'/'+_0x53957f)[_0xed80('0xc')](_0x2eb50b);}return null;};}function saveUpdates(_0x43fe4d){return function(_0x2b13f5){if(_0x2b13f5){return _0x2b13f5[_0xed80('0x12')](_0x43fe4d)[_0xed80('0x13')](function(_0x2f92d5){return _0x2f92d5;});}return null;};}function removeEntity(_0x1b3d38){return function(_0xe1ae28){if(_0xe1ae28){return _0xe1ae28[_0xed80('0x14')]()[_0xed80('0x13')](function(){var _0x2e774d=_0xe1ae28[_0xed80('0x15')]({'plain':!![]});var _0x146f8a='MailQueues';return db['UserProfileResource']['destroy']({'where':{'type':_0x146f8a,'resourceId':_0x2e774d['id']}})[_0xed80('0x13')](function(){return _0xe1ae28;});})[_0xed80('0x13')](function(){_0x1b3d38[_0xed80('0xb')](0xcc)[_0xed80('0x16')]();});}};}function handleEntityNotFound(_0x2a02dc){return function(_0x331ea6){if(!_0x331ea6){_0x2a02dc[_0xed80('0xa')](0x194);}return _0x331ea6;};}function handleError(_0x24337b,_0xef516){_0xef516=_0xef516||0x1f4;return function(_0x5dbc10){logger['error'](_0x5dbc10[_0xed80('0x17')]);if(_0x5dbc10[_0xed80('0x18')]){delete _0x5dbc10[_0xed80('0x18')];}_0x24337b['status'](_0xef516)[_0xed80('0x19')](_0x5dbc10);};}exports[_0xed80('0x1a')]=function(_0x5dc7b8,_0x494b98){var _0xc6caa3={};var _0x221ece={'count':0x0,'rows':[]};var _0x4e2e46=_[_0xed80('0x1b')](db[_0xed80('0x1c')][_0xed80('0x1d')],function(_0x19f60b){return{'name':_0x19f60b[_0xed80('0x1e')],'type':_0x19f60b[_0xed80('0x1f')][_0xed80('0x20')]};});_0xc6caa3=qs[_0xed80('0x21')](_0x4e2e46,_0x5dc7b8);var _0x395a5a={'where':_0xc6caa3[_0xed80('0x22')]};return db[_0xed80('0x1c')][_0xed80('0xe')](_0x395a5a)[_0xed80('0x13')](function(_0x49ad20){_0x221ece[_0xed80('0xe')]=_0x49ad20;_0xc6caa3[_0xed80('0x23')]=qs[_0xed80('0x23')](_0x5dc7b8[_0xed80('0x24')]);return db[_0xed80('0x1c')][_0xed80('0x25')](_0xc6caa3);})[_0xed80('0x13')](function(_0x5b90bf){_0x221ece[_0xed80('0x26')]=_0x5b90bf;return _0x221ece;})[_0xed80('0x13')](respondWithFilteredResult(_0x494b98,_0xc6caa3))[_0xed80('0x27')](handleError(_0x494b98,null));};exports[_0xed80('0x28')]=function(_0x195946,_0xd7df44){var _0x50cfde={'raw':!![],'where':{'id':_0x195946[_0xed80('0x29')]['id']}},_0x8cc3a9={};_0x8cc3a9[_0xed80('0x2a')]=_[_0xed80('0x2b')](db[_0xed80('0x1c')][_0xed80('0x1d')]);_0x8cc3a9[_0xed80('0x24')]=_[_0xed80('0x2b')](_0x195946['query']);_0x8cc3a9[_0xed80('0x2c')]=_[_0xed80('0x2d')](_0x8cc3a9[_0xed80('0x2a')],_0x8cc3a9['query']);_0x50cfde[_0xed80('0x2e')]=_['intersection'](_0x8cc3a9['model'],qs[_0xed80('0x2f')](_0x195946[_0xed80('0x24')]['fields']));_0x50cfde[_0xed80('0x2e')]=_0x50cfde[_0xed80('0x2e')]['length']?_0x50cfde[_0xed80('0x2e')]:_0x8cc3a9['model'];if(_0x195946[_0xed80('0x24')]['includeAll']){_0x50cfde['include']=[{'all':!![]}];}_0x50cfde=_[_0xed80('0x30')]({},_0x50cfde,_0x195946[_0xed80('0x31')]);return db[_0xed80('0x1c')][_0xed80('0x32')](_0x50cfde)['then'](handleEntityNotFound(_0xd7df44,null))[_0xed80('0x13')](respondWithResult(_0xd7df44,null))[_0xed80('0x27')](handleError(_0xd7df44,null));};exports['create']=function(_0xf87901,_0x3c0a05){return db['MailQueue'][_0xed80('0x33')](_0xf87901[_0xed80('0x34')],{})[_0xed80('0x13')](function(_0x32901f){var _0x583b55=_0xf87901[_0xed80('0x35')][_0xed80('0x15')]({'plain':!![]});if(!_0x583b55)throw new Error(_0xed80('0x36'));if(_0x583b55[_0xed80('0x37')]==='user'){var _0x4fa547=_0x32901f[_0xed80('0x15')]({'plain':!![]});var _0x4eea2a=_0xed80('0x38');return db['UserProfileSection'][_0xed80('0x32')]({'where':{'name':_0x4eea2a,'userProfileId':_0x583b55[_0xed80('0x39')]},'raw':!![]})[_0xed80('0x13')](function(_0x5257e6){if(_0x5257e6&&_0x5257e6[_0xed80('0x3a')]===0x0){return db[_0xed80('0x3b')]['create']({'name':_0x4fa547[_0xed80('0x18')],'resourceId':_0x4fa547['id'],'type':_0x5257e6['name'],'sectionId':_0x5257e6['id']},{})[_0xed80('0x13')](function(){return _0x32901f;});}else{return _0x32901f;}})[_0xed80('0x27')](function(_0xf31278){logger[_0xed80('0x3c')](_0xed80('0x3d'),_0xf31278);throw _0xf31278;});}return _0x32901f;})['then'](respondWithResult(_0x3c0a05,0xc9))[_0xed80('0x27')](handleError(_0x3c0a05,null));};exports[_0xed80('0x12')]=function(_0x51cb4d,_0x3fafb4){if(_0x51cb4d[_0xed80('0x34')]['id']){delete _0x51cb4d[_0xed80('0x34')]['id'];}return db[_0xed80('0x1c')][_0xed80('0x32')]({'where':{'id':_0x51cb4d[_0xed80('0x29')]['id']}})['then'](handleEntityNotFound(_0x3fafb4,null))['then'](saveUpdates(_0x51cb4d['body'],null))[_0xed80('0x13')](respondWithResult(_0x3fafb4,null))[_0xed80('0x27')](handleError(_0x3fafb4,null));};exports['destroy']=function(_0x330be1,_0x5b7e69){return db[_0xed80('0x1c')]['find']({'where':{'id':_0x330be1[_0xed80('0x29')]['id']}})[_0xed80('0x13')](handleEntityNotFound(_0x5b7e69,null))['then'](removeEntity(_0x5b7e69,null))['catch'](handleError(_0x5b7e69,null));};exports[_0xed80('0x3e')]=function(_0x51a07f,_0x595436){return db[_0xed80('0x1c')][_0xed80('0x3e')]()[_0xed80('0x13')](respondWithResult(_0x595436,null))['catch'](handleError(_0x595436,null));};exports[_0xed80('0x3f')]=function(_0x154c69,_0x43487b){var _0x223f4a={'raw':!![],'where':{}},_0x5b24be={},_0x30a855;return db['MailQueue'][_0xed80('0x40')]({'where':{'id':_0x154c69[_0xed80('0x29')]['id']}})['then'](handleEntityNotFound(_0x43487b,null))[_0xed80('0x13')](function(_0x193a91){if(_0x193a91){_0x30a855=_0x193a91[_0xed80('0x15')]({'plain':!![]});_0x5b24be[_0xed80('0x2a')]=_[_0xed80('0x2b')](db[_0xed80('0x41')][_0xed80('0x1d')]);_0x5b24be['query']=_[_0xed80('0x2b')](_0x154c69[_0xed80('0x24')]);_0x5b24be['filters']=_[_0xed80('0x2d')](_0x5b24be[_0xed80('0x2a')],_0x5b24be[_0xed80('0x24')]);_0x223f4a[_0xed80('0x2e')]=_[_0xed80('0x2d')](_0x5b24be[_0xed80('0x2a')],qs[_0xed80('0x2f')](_0x154c69['query']['fields']));_0x223f4a['attributes']=_0x223f4a[_0xed80('0x2e')][_0xed80('0x42')]?_0x223f4a[_0xed80('0x2e')]:_0x5b24be[_0xed80('0x2a')];if(!_0x154c69['query']['hasOwnProperty'](_0xed80('0x43'))){_0x223f4a[_0xed80('0x10')]=qs[_0xed80('0x10')](_0x154c69[_0xed80('0x24')]['limit']);_0x223f4a[_0xed80('0xf')]=qs[_0xed80('0xf')](_0x154c69[_0xed80('0x24')][_0xed80('0xf')]);}_0x223f4a[_0xed80('0x44')]=qs[_0xed80('0x45')](_0x154c69[_0xed80('0x24')][_0xed80('0x45')]);_0x223f4a[_0xed80('0x22')]=qs[_0xed80('0x2c')](_[_0xed80('0x46')](_0x154c69[_0xed80('0x24')],_0x5b24be[_0xed80('0x2c')]));_0x223f4a[_0xed80('0x22')][_0xed80('0x47')]=_0x193a91['id'];if(_0x154c69[_0xed80('0x24')]['filter']){_0x223f4a['where']=_[_0xed80('0x30')](_0x223f4a[_0xed80('0x22')],{'$or':_[_0xed80('0x1b')](_0x223f4a[_0xed80('0x2e')],function(_0x14f3ee){var _0x546a60={};_0x546a60[_0x14f3ee]={'$like':'%'+_0x154c69['query']['filter']+'%'};return _0x546a60;})});}_0x223f4a=_[_0xed80('0x30')]({},_0x223f4a,_0x154c69['options']);return db[_0xed80('0x41')][_0xed80('0x25')](_0x223f4a);}})[_0xed80('0x13')](function(_0x35991d){if(_0x35991d){return db[_0xed80('0x48')][_0xed80('0x49')]({'where':{'id':_['map'](_0x35991d,_0xed80('0x4a')),'role':'agent'},'attributes':['id',_0xed80('0x18'),_0xed80('0x4b'),_0xed80('0x4c'),_0xed80('0x4d')]});}})[_0xed80('0x13')](function(_0x40a610){if(_0x40a610){return{'count':_0x40a610[_0xed80('0xe')],'rows':_[_0xed80('0x1b')](_0x40a610[_0xed80('0x26')],function(_0x3e7752){return{'membername':_0x3e7752[_0xed80('0x18')],'UserId':_0x3e7752['id'],'queue_name':_0x30a855['name'],'MailQueueId':_0x30a855['id'],'interface':util[_0xed80('0x4e')](_0xed80('0x4f'),_0xed80('0x50'),_0x3e7752['name']),'penalty':0x0,'paused':_0x3e7752[_0xed80('0x4b')],'createdAt':_0x3e7752[_0xed80('0x4d')],'updatedAt':_0x3e7752[_0xed80('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xed80('0x13')](respondWithFilteredResult(_0x43487b,_0x223f4a))[_0xed80('0x27')](handleError(_0x43487b,null));};exports['getTeams']=function(_0x388d99,_0x1d9a5a){var _0x2f1b56={};var _0x494070={};var _0x26edac;var _0x5ecd25;return db['MailQueue'][_0xed80('0x40')]({'where':{'id':_0x388d99['params']['id']}})[_0xed80('0x13')](handleEntityNotFound(_0x1d9a5a,null))[_0xed80('0x13')](function(_0x318078){if(_0x318078){_0x26edac=_0x318078;_0x494070[_0xed80('0x2a')]=_[_0xed80('0x2b')](db[_0xed80('0x51')][_0xed80('0x1d')]);_0x494070[_0xed80('0x24')]=_['keys'](_0x388d99[_0xed80('0x24')]);_0x494070['filters']=_['intersection'](_0x494070['model'],_0x494070['query']);_0x2f1b56[_0xed80('0x2e')]=_[_0xed80('0x2d')](_0x494070['model'],qs[_0xed80('0x2f')](_0x388d99[_0xed80('0x24')]['fields']));_0x2f1b56[_0xed80('0x2e')]=_0x2f1b56[_0xed80('0x2e')]['length']?_0x2f1b56[_0xed80('0x2e')]:_0x494070[_0xed80('0x2a')];_0x2f1b56['order']=qs[_0xed80('0x45')](_0x388d99[_0xed80('0x24')][_0xed80('0x45')]);_0x2f1b56[_0xed80('0x22')]=qs['filters'](_[_0xed80('0x46')](_0x388d99[_0xed80('0x24')],_0x494070[_0xed80('0x2c')]));if(_0x388d99['query'][_0xed80('0x52')]){_0x2f1b56[_0xed80('0x22')]=_[_0xed80('0x30')](_0x2f1b56[_0xed80('0x22')],{'$or':_[_0xed80('0x1b')](_0x2f1b56['attributes'],function(_0x2fbe46){var _0x4ce4a1={};_0x4ce4a1[_0x2fbe46]={'$like':'%'+_0x388d99['query'][_0xed80('0x52')]+'%'};return _0x4ce4a1;})});}_0x2f1b56=_[_0xed80('0x30')]({},_0x2f1b56,_0x388d99[_0xed80('0x31')]);return _0x26edac[_0xed80('0x53')](_0x2f1b56);}})['then'](function(_0x21e9d3){if(_0x21e9d3){_0x5ecd25=_0x21e9d3[_0xed80('0x42')];if(!_0x388d99[_0xed80('0x24')][_0xed80('0x54')](_0xed80('0x43'))){_0x2f1b56['limit']=qs[_0xed80('0x10')](_0x388d99[_0xed80('0x24')][_0xed80('0x10')]);_0x2f1b56['offset']=qs[_0xed80('0xf')](_0x388d99['query'][_0xed80('0xf')]);}return _0x26edac['getTeams'](_0x2f1b56);}})[_0xed80('0x13')](function(_0x1527ec){if(_0x1527ec){return _0x1527ec?{'count':_0x5ecd25,'rows':_0x1527ec}:null;}})['then'](respondWithResult(_0x1d9a5a,null))['catch'](handleError(_0x1d9a5a,null));};exports['addTeams']=function(_0x291d3f,_0x1729f7){var _0x320832=_0x291d3f[_0xed80('0x34')][_0xed80('0x55')];return db[_0xed80('0x51')][_0xed80('0x25')]({'where':{'id':_0x320832},'attributes':['id'],'include':[{'model':db[_0xed80('0x48')],'as':_0xed80('0x56'),'attributes':['id','name',_0xed80('0x57'),'voicePause','interface'],'raw':!![]}]})['then'](function(_0x539e69){if(_0x539e69){var _0x49ff9e=_[_0xed80('0x58')](_0x539e69,function(_0x1e4b2){var _0x5a0163=_0x1e4b2['get']({'plain':!![]});return _0x5a0163[_0xed80('0x56')];});return db[_0xed80('0x1c')][_0xed80('0x32')]({'where':{'id':_0x291d3f[_0xed80('0x29')]['id']}})['then'](function(_0x53f4ce){return db[_0xed80('0x59')][_0xed80('0x5a')](function(_0x5ba17e){return _0x53f4ce['addTeams'](_0x320832,{'transaction':_0x5ba17e})[_0xed80('0x13')](function(){return BPromise['each'](_0x49ff9e,function(_0x27a66a){return db['UserMailQueue'][_0xed80('0x5b')]({'where':{'UserId':_0x27a66a['id'],'MailQueueId':_0x291d3f['params']['id']},'transaction':_0x5ba17e});});})[_0xed80('0x13')](function(){_0x49ff9e[_0xed80('0x5c')](function(_0x26af72){socket[_0xed80('0x5d')](_0xed80('0x5e'),{'UserId':_0x26af72['id'],'MailQueueId':_0x53f4ce['id']});});});});});}})['then'](respondWithStatusCode(_0x1729f7,null))['catch'](handleError(_0x1729f7,null));};exports[_0xed80('0x5f')]=function(_0x47887c,_0x9ff647){return db[_0xed80('0x51')][_0xed80('0x25')]({'where':{'id':_0x47887c[_0xed80('0x24')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xed80('0x56'),'attributes':['id'],'raw':!![]}]})[_0xed80('0x13')](handleEntityNotFound(_0x9ff647,null))[_0xed80('0x13')](function(_0x33b143){var _0x4f884c=_[_0xed80('0x1b')](_0x33b143,'id');var _0x4fa5ee=[];var _0x3bdf13=[];var _0x3f2f23=squel['select']();_0x3f2f23[_0xed80('0x60')]('tq.TeamId')[_0xed80('0x61')]('team_has_mail_queues','tq')[_0xed80('0x62')](_0xed80('0x63'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xed80('0x22')](_0xed80('0x64'),_0x47887c[_0xed80('0x29')]['id']);for(var _0x56dce8=0x0;_0x56dce8<_0x33b143['length'];_0x56dce8+=0x1){let _0x1b21f7=_0x33b143[_0x56dce8];for(var _0x7cce84=0x0;_0x7cce84<_0x1b21f7[_0xed80('0x56')]['length'];_0x7cce84+=0x1){let _0x11af08=_0x1b21f7[_0xed80('0x56')][_0x7cce84];var _0x3431b7=_0x3f2f23[_0xed80('0x65')]();_0x3431b7['where'](_0xed80('0x66'),_0x11af08['id']);_0x3bdf13[_0xed80('0x67')](db[_0xed80('0x59')]['query'](_0x3431b7[_0xed80('0x68')](),{'type':db['sequelize'][_0xed80('0x69')][_0xed80('0x6a')]})[_0xed80('0x13')](function(_0x3200f9){if(_0x3200f9[_0xed80('0x42')]===0x1){return _0x11af08['id'];}else{var _0x56b954=_['every'](_[_0xed80('0x1b')](_0x3200f9,'TeamId'),function(_0x589ea1){return _[_0xed80('0x6b')](_0x4f884c,_0x589ea1);});if(_0x56b954){return _0x11af08['id'];}}}));}}return BPromise['all'](_0x3bdf13)[_0xed80('0x13')](function(_0x164659){_0x4fa5ee=_(_0x4fa5ee)[_0xed80('0x6c')](_0x164659)[_0xed80('0x6d')]()[_0xed80('0x6e')]();return db[_0xed80('0x1c')]['find']({'where':{'id':_0x47887c['params']['id']}})[_0xed80('0x13')](function(_0x1df050){return db[_0xed80('0x59')][_0xed80('0x5a')](function(_0x60c4e6){return _0x1df050['removeTeams'](_0x47887c[_0xed80('0x24')][_0xed80('0x55')],{'transaction':_0x60c4e6})[_0xed80('0x13')](function(){if(!_[_0xed80('0x6f')](_0x4fa5ee)){return _0x1df050[_0xed80('0x70')](_0x4fa5ee,{'transaction':_0x60c4e6});}})[_0xed80('0x13')](function(){_0x4fa5ee[_0xed80('0x5c')](function(_0x4b6925){socket[_0xed80('0x5d')](_0xed80('0x71'),{'UserId':_0x4b6925,'MailQueueId':_0x1df050['id']});});});});});});})['then'](respondWithStatusCode(_0x9ff647,null))[_0xed80('0x27')](handleError(_0x9ff647,null));};exports[_0xed80('0x72')]=function(_0x3abdb4,_0x1b4672){return db[_0xed80('0x1c')]['find']({'where':{'id':_0x3abdb4[_0xed80('0x29')]['id']}})[_0xed80('0x13')](handleEntityNotFound(_0x1b4672,null))['then'](function(_0x35a475){if(_0x35a475){return _0x35a475['addAgents'](_0x3abdb4['body'][_0xed80('0x55')],_[_0xed80('0x73')](_0x3abdb4['body'],['ids','id'])||{})[_0xed80('0x74')](function(_0x330d62){for(var _0x3143f5=0x0;_0x3143f5<_0x3abdb4[_0xed80('0x34')]['ids'][_0xed80('0x42')];_0x3143f5+=0x1){socket[_0xed80('0x5d')](_0xed80('0x5e'),{'UserId':Number(_0x3abdb4[_0xed80('0x34')][_0xed80('0x55')][_0x3143f5]),'MailQueueId':Number(_0x3abdb4[_0xed80('0x29')]['id'])});}return _0x330d62;});}})['then'](respondWithResult(_0x1b4672,null))[_0xed80('0x27')](handleError(_0x1b4672,null));};exports['removeAgents']=function(_0x3cbfdf,_0x21b56e){return db[_0xed80('0x1c')][_0xed80('0x32')]({'where':{'id':_0x3cbfdf[_0xed80('0x29')]['id']}})[_0xed80('0x13')](handleEntityNotFound(_0x21b56e,null))[_0xed80('0x13')](function(_0x3b48cb){if(_0x3b48cb){return _0x3b48cb[_0xed80('0x70')](_0x3cbfdf[_0xed80('0x24')][_0xed80('0x55')])[_0xed80('0x13')](function(){if(_['isArray'](_0x3cbfdf[_0xed80('0x24')][_0xed80('0x55')])){for(var _0xbce533=0x0;_0xbce533<_0x3cbfdf[_0xed80('0x24')][_0xed80('0x55')][_0xed80('0x42')];_0xbce533+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x3cbfdf[_0xed80('0x24')][_0xed80('0x55')][_0xbce533]),'MailQueueId':Number(_0x3cbfdf['params']['id'])});}}else{socket[_0xed80('0x5d')](_0xed80('0x71'),{'UserId':Number(_0x3cbfdf[_0xed80('0x24')][_0xed80('0x55')]),'MailQueueId':Number(_0x3cbfdf['params']['id'])});}});}})[_0xed80('0x13')](respondWithStatusCode(_0x21b56e,null))['catch'](handleError(_0x21b56e,null));};exports[_0xed80('0x75')]=function(_0x284d3e,_0x4b8e32){var _0x298d7b={};var _0x9b7c5c={};var _0xf85198;var _0x4f4d24;return db[_0xed80('0x1c')][_0xed80('0x40')]({'where':{'id':_0x284d3e[_0xed80('0x29')]['id']}})['then'](handleEntityNotFound(_0x4b8e32,null))[_0xed80('0x13')](function(_0x203250){if(_0x203250){_0xf85198=_0x203250;_0x9b7c5c[_0xed80('0x2a')]=_[_0xed80('0x2b')](db[_0xed80('0x48')][_0xed80('0x1d')]);_0x9b7c5c[_0xed80('0x24')]=_[_0xed80('0x2b')](_0x284d3e[_0xed80('0x24')]);_0x9b7c5c[_0xed80('0x2c')]=_['intersection'](_0x9b7c5c[_0xed80('0x2a')],_0x9b7c5c['query']);_0x298d7b[_0xed80('0x2e')]=_[_0xed80('0x2d')](_0x9b7c5c[_0xed80('0x2a')],qs['fields'](_0x284d3e[_0xed80('0x24')][_0xed80('0x2f')]));_0x298d7b[_0xed80('0x2e')]=_0x298d7b['attributes'][_0xed80('0x42')]?_0x298d7b[_0xed80('0x2e')]:_0x9b7c5c[_0xed80('0x2a')];_0x298d7b['order']=qs[_0xed80('0x45')](_0x284d3e[_0xed80('0x24')][_0xed80('0x45')]);_0x298d7b[_0xed80('0x22')]=qs[_0xed80('0x2c')](_[_0xed80('0x46')](_0x284d3e['query'],_0x9b7c5c['filters']));if(_0x284d3e[_0xed80('0x24')][_0xed80('0x52')]){_0x298d7b[_0xed80('0x22')]=_[_0xed80('0x30')](_0x298d7b[_0xed80('0x22')],{'$or':_[_0xed80('0x1b')](_0x298d7b[_0xed80('0x2e')],function(_0x1ad937){var _0x5b76b5={};_0x5b76b5[_0x1ad937]={'$like':'%'+_0x284d3e['query'][_0xed80('0x52')]+'%'};return _0x5b76b5;})});}_0x298d7b=_['merge']({},_0x298d7b,_0x284d3e[_0xed80('0x31')]);return _0xf85198[_0xed80('0x75')](_0x298d7b);}})[_0xed80('0x13')](function(_0x8b9103){if(_0x8b9103){_0x4f4d24=_0x8b9103['length'];if(!_0x284d3e[_0xed80('0x24')][_0xed80('0x54')](_0xed80('0x43'))){_0x298d7b[_0xed80('0x10')]=qs[_0xed80('0x10')](_0x284d3e[_0xed80('0x24')]['limit']);_0x298d7b[_0xed80('0xf')]=qs[_0xed80('0xf')](_0x284d3e[_0xed80('0x24')][_0xed80('0xf')]);}return _0xf85198['getAgents'](_0x298d7b);}})['then'](function(_0x1eb556){if(_0x1eb556){return _0x1eb556?{'count':_0x4f4d24,'rows':_0x1eb556}:null;}})[_0xed80('0x13')](respondWithResult(_0x4b8e32,null))[_0xed80('0x27')](handleError(_0x4b8e32,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 50fefee..5029321 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 _0xbfef=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','MailQueue','save','update'];(function(_0x390791,_0x473075){var _0x24f773=function(_0x325907){while(--_0x325907){_0x390791['push'](_0x390791['shift']());}};_0x24f773(++_0x473075);}(_0xbfef,0x13f));var _0xfbfe=function(_0x5413cb,_0x2303e1){_0x5413cb=_0x5413cb-0x0;var _0x1b4346=_0xbfef[_0x5413cb];return _0x1b4346;};'use strict';var EventEmitter=require(_0xfbfe('0x0'));var MailQueue=require(_0xfbfe('0x1'))['db'][_0xfbfe('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfbfe('0x3'),'afterUpdate':_0xfbfe('0x4'),'afterDestroy':_0xfbfe('0x5')};function emitEvent(_0x2429f1){return function(_0x90a31e,_0x2c9b01,_0x28a965){MailQueueEvents[_0xfbfe('0x6')](_0x2429f1+':'+_0x90a31e['id'],_0x90a31e);MailQueueEvents[_0xfbfe('0x6')](_0x2429f1,_0x90a31e);_0x28a965(null);};}for(var e in events){if(events[_0xfbfe('0x7')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xfbfe('0x8')]=MailQueueEvents; \ No newline at end of file +var _0xe67f=['exports','events','MailQueue','save','update','remove','hasOwnProperty'];(function(_0x540b03,_0x17311a){var _0x2fdd92=function(_0x434cf9){while(--_0x434cf9){_0x540b03['push'](_0x540b03['shift']());}};_0x2fdd92(++_0x17311a);}(_0xe67f,0x120));var _0xfe67=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe67f[_0x42cae2];return _0x5f256f;};'use strict';var EventEmitter=require(_0xfe67('0x0'));var MailQueue=require('../../mysqldb')['db'][_0xfe67('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfe67('0x2'),'afterUpdate':_0xfe67('0x3'),'afterDestroy':_0xfe67('0x4')};function emitEvent(_0x52e9a9){return function(_0x747362,_0xa300ce,_0x23e41e){MailQueueEvents['emit'](_0x52e9a9+':'+_0x747362['id'],_0x747362);MailQueueEvents['emit'](_0x52e9a9,_0x747362);_0x23e41e(null);};}for(var e in events){if(events[_0xfe67('0x5')](e)){var event=events[e];MailQueue['hook'](e,emitEvent(event));}}module[_0xfe67('0x6')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 30aab1c..c8e4e47 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 _0x4ca9=['mail_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailQueue.attributes'];(function(_0xc1a251,_0x1a2bdf){var _0x3860f0=function(_0xd6573c){while(--_0xd6573c){_0xc1a251['push'](_0xc1a251['shift']());}};_0x3860f0(++_0x1a2bdf);}(_0x4ca9,0xa6));var _0x94ca=function(_0x2adf30,_0x4c0ae8){_0x2adf30=_0x2adf30-0x0;var _0x5a1545=_0x4ca9[_0x2adf30];return _0x5a1545;};'use strict';var _=require(_0x94ca('0x0'));var util=require(_0x94ca('0x1'));var logger=require(_0x94ca('0x2'))(_0x94ca('0x3'));var moment=require(_0x94ca('0x4'));var BPromise=require(_0x94ca('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x94ca('0x6'));var rimraf=require(_0x94ca('0x7'));var config=require(_0x94ca('0x8'));var attributes=require(_0x94ca('0x9'));module['exports']=function(_0x25bb67,_0x190c2f){return _0x25bb67['define']('MailQueue',attributes,{'tableName':_0x94ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x027b=['define','MailQueue','mail_queues','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x113a6c,_0x10df30){var _0x1ac632=function(_0xbd4fb9){while(--_0xbd4fb9){_0x113a6c['push'](_0x113a6c['shift']());}};_0x1ac632(++_0x10df30);}(_0x027b,0x123));var _0xb027=function(_0x23cee9,_0xa0c8d){_0x23cee9=_0x23cee9-0x0;var _0x152648=_0x027b[_0x23cee9];return _0x152648;};'use strict';var _=require('lodash');var util=require(_0xb027('0x0'));var logger=require(_0xb027('0x1'))(_0xb027('0x2'));var moment=require(_0xb027('0x3'));var BPromise=require('bluebird');var rp=require(_0xb027('0x4'));var fs=require('fs');var path=require(_0xb027('0x5'));var rimraf=require(_0xb027('0x6'));var config=require(_0xb027('0x7'));var attributes=require('./mailQueue.attributes');module[_0xb027('0x8')]=function(_0x43dbd0,_0xa72a26){return _0x43dbd0[_0xb027('0x9')](_0xb027('0xa'),attributes,{'tableName':_0xb027('0xb'),'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 fb2ece5..6dd53a0 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 _0x5a97=['code','message','findAll','options','where','attributes','limit','include','map','model','then','GetMailQueue','ShowMailQueue','MailQueue','find','raw','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x116e2f,_0x5811f9){var _0x546a80=function(_0x4b9138){while(--_0x4b9138){_0x116e2f['push'](_0x116e2f['shift']());}};_0x546a80(++_0x5811f9);}(_0x5a97,0x69));var _0x75a9=function(_0x13068f,_0x1da78d){_0x13068f=_0x13068f-0x0;var _0x4fc6f3=_0x5a97[_0x13068f];return _0x4fc6f3;};'use strict';var _=require(_0x75a9('0x0'));var util=require(_0x75a9('0x1'));var moment=require('moment');var BPromise=require(_0x75a9('0x2'));var rs=require(_0x75a9('0x3'));var fs=require('fs');var Redis=require(_0x75a9('0x4'));var db=require(_0x75a9('0x5'))['db'];var utils=require(_0x75a9('0x6'));var logger=require(_0x75a9('0x7'))(_0x75a9('0x8'));var config=require(_0x75a9('0x9'));var jayson=require(_0x75a9('0xa'));var client=jayson[_0x75a9('0xb')][_0x75a9('0xc')]({'port':0x232a});config[_0x75a9('0xd')]=_[_0x75a9('0xe')](config[_0x75a9('0xd')],{'host':_0x75a9('0xf'),'port':0x18eb});var socket=require(_0x75a9('0x10'))(new Redis(config[_0x75a9('0xd')]));require(_0x75a9('0x11'))[_0x75a9('0x12')](socket);function respondWithRpcPromise(_0x284562,_0x42a953,_0x57205c){return new BPromise(function(_0x308744,_0x3003be){return client[_0x75a9('0x13')](_0x284562,_0x57205c)['then'](function(_0x4ba90b){logger[_0x75a9('0x14')](_0x75a9('0x15'),_0x42a953,_0x75a9('0x16'));logger[_0x75a9('0x17')](_0x75a9('0x18'),_0x42a953,_0x75a9('0x16'),JSON[_0x75a9('0x19')](_0x4ba90b));if(_0x4ba90b[_0x75a9('0x1a')]){if(_0x4ba90b['error'][_0x75a9('0x1b')]===0x1f4){logger[_0x75a9('0x1a')](_0x75a9('0x15'),_0x42a953,_0x4ba90b[_0x75a9('0x1a')][_0x75a9('0x1c')]);return _0x3003be(_0x4ba90b[_0x75a9('0x1a')][_0x75a9('0x1c')]);}logger[_0x75a9('0x1a')](_0x75a9('0x15'),_0x42a953,_0x4ba90b[_0x75a9('0x1a')][_0x75a9('0x1c')]);return _0x308744(_0x4ba90b[_0x75a9('0x1a')][_0x75a9('0x1c')]);}else{logger[_0x75a9('0x14')](_0x75a9('0x15'),_0x42a953,_0x75a9('0x16'));_0x308744(_0x4ba90b['result'][_0x75a9('0x1c')]);}})['catch'](function(_0x46cc5a){logger[_0x75a9('0x1a')](_0x75a9('0x15'),_0x42a953,_0x46cc5a);_0x3003be(_0x46cc5a);});});}exports['GetMailQueue']=function(_0x1ff9eb){var _0x40865f=this;return new Promise(function(_0x475ce9,_0x37c307){return db['MailQueue'][_0x75a9('0x1d')]({'raw':_0x1ff9eb[_0x75a9('0x1e')]?_0x1ff9eb[_0x75a9('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x1ff9eb['options']?_0x1ff9eb['options'][_0x75a9('0x1f')]||null:null,'attributes':_0x1ff9eb['options']?_0x1ff9eb[_0x75a9('0x1e')][_0x75a9('0x20')]||null:null,'limit':_0x1ff9eb[_0x75a9('0x1e')]?_0x1ff9eb[_0x75a9('0x1e')][_0x75a9('0x21')]||null:null,'include':_0x1ff9eb[_0x75a9('0x1e')]?_0x1ff9eb[_0x75a9('0x1e')][_0x75a9('0x22')]?_[_0x75a9('0x23')](_0x1ff9eb[_0x75a9('0x1e')][_0x75a9('0x22')],function(_0x4189fd){return{'model':db[_0x4189fd[_0x75a9('0x24')]],'as':_0x4189fd['as'],'attributes':_0x4189fd[_0x75a9('0x20')],'include':_0x4189fd[_0x75a9('0x22')]?_[_0x75a9('0x23')](_0x4189fd['include'],function(_0x38550b){return{'model':db[_0x38550b[_0x75a9('0x24')]],'as':_0x38550b['as'],'attributes':_0x38550b[_0x75a9('0x20')],'include':_0x38550b['include']?_[_0x75a9('0x23')](_0x38550b[_0x75a9('0x22')],function(_0x13062a){return{'model':db[_0x13062a[_0x75a9('0x24')]],'as':_0x13062a['as'],'attributes':_0x13062a[_0x75a9('0x20')]};}):[]};}):[]};}):[]:[]})[_0x75a9('0x25')](function(_0x1bea9b){logger[_0x75a9('0x14')](_0x75a9('0x26'),_0x1ff9eb);logger['debug'](_0x75a9('0x26'),_0x1ff9eb,JSON[_0x75a9('0x19')](_0x1bea9b));_0x475ce9(_0x1bea9b);})['catch'](function(_0x23f285){logger[_0x75a9('0x1a')](_0x75a9('0x26'),_0x23f285['message'],_0x1ff9eb);_0x37c307(_0x40865f[_0x75a9('0x1a')](0x1f4,_0x23f285['message']));});});};exports[_0x75a9('0x27')]=function(_0x388e6a){var _0x2bba5b=this;return new Promise(function(_0x4dead3,_0x4ec2fb){return db[_0x75a9('0x28')][_0x75a9('0x29')]({'raw':_0x388e6a[_0x75a9('0x1e')]?_0x388e6a['options'][_0x75a9('0x2a')]===undefined?!![]:![]:!![],'where':_0x388e6a[_0x75a9('0x1e')]?_0x388e6a['options'][_0x75a9('0x1f')]||null:null,'attributes':_0x388e6a[_0x75a9('0x1e')]?_0x388e6a[_0x75a9('0x1e')][_0x75a9('0x20')]||null:null,'include':_0x388e6a[_0x75a9('0x1e')]?_0x388e6a[_0x75a9('0x1e')][_0x75a9('0x22')]?_['map'](_0x388e6a[_0x75a9('0x1e')][_0x75a9('0x22')],function(_0x18dbae){return{'model':db[_0x18dbae[_0x75a9('0x24')]],'as':_0x18dbae['as'],'attributes':_0x18dbae['attributes'],'include':_0x18dbae['include']?_[_0x75a9('0x23')](_0x18dbae[_0x75a9('0x22')],function(_0x14c9ec){return{'model':db[_0x14c9ec[_0x75a9('0x24')]],'as':_0x14c9ec['as'],'attributes':_0x14c9ec[_0x75a9('0x20')],'include':_0x14c9ec[_0x75a9('0x22')]?_['map'](_0x14c9ec[_0x75a9('0x22')],function(_0x315d78){return{'model':db[_0x315d78[_0x75a9('0x24')]],'as':_0x315d78['as'],'attributes':_0x315d78['attributes']};}):[]};}):[]};}):[]:[]})[_0x75a9('0x25')](function(_0x3fd70e){logger['info'](_0x75a9('0x27'),_0x388e6a);logger[_0x75a9('0x17')](_0x75a9('0x27'),_0x388e6a,JSON['stringify'](_0x3fd70e));_0x4dead3(_0x3fd70e);})[_0x75a9('0x2b')](function(_0x22e92c){logger[_0x75a9('0x1a')]('ShowMailQueue',_0x22e92c['message'],_0x388e6a);_0x4ec2fb(_0x2bba5b[_0x75a9('0x1a')](0x1f4,_0x22e92c[_0x75a9('0x1c')]));});});}; \ No newline at end of file +var _0xada7=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','./mailQueue.socket','register','request','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','options','raw','attributes','include','map','model','then','GetMailQueue','ShowMailQueue','MailQueue','find','where'];(function(_0x366195,_0x50da84){var _0xf37646=function(_0x53a253){while(--_0x53a253){_0x366195['push'](_0x366195['shift']());}};_0xf37646(++_0x50da84);}(_0xada7,0x1ee));var _0x7ada=function(_0x99764b,_0xab9cb7){_0x99764b=_0x99764b-0x0;var _0x457a42=_0xada7[_0x99764b];return _0x457a42;};'use strict';var _=require(_0x7ada('0x0'));var util=require(_0x7ada('0x1'));var moment=require(_0x7ada('0x2'));var BPromise=require(_0x7ada('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7ada('0x4'));var db=require(_0x7ada('0x5'))['db'];var utils=require(_0x7ada('0x6'));var logger=require(_0x7ada('0x7'))(_0x7ada('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7ada('0x9')]['http']({'port':0x232a});config[_0x7ada('0xa')]=_[_0x7ada('0xb')](config[_0x7ada('0xa')],{'host':_0x7ada('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7ada('0xa')]));require(_0x7ada('0xd'))[_0x7ada('0xe')](socket);function respondWithRpcPromise(_0x25834f,_0x3be401,_0x2cac88){return new BPromise(function(_0x129c22,_0x3530a0){return client[_0x7ada('0xf')](_0x25834f,_0x2cac88)['then'](function(_0x21d33e){logger['info'](_0x7ada('0x10'),_0x3be401,'request\x20sent');logger[_0x7ada('0x11')](_0x7ada('0x12'),_0x3be401,_0x7ada('0x13'),JSON[_0x7ada('0x14')](_0x21d33e));if(_0x21d33e[_0x7ada('0x15')]){if(_0x21d33e[_0x7ada('0x15')]['code']===0x1f4){logger['error'](_0x7ada('0x10'),_0x3be401,_0x21d33e['error'][_0x7ada('0x16')]);return _0x3530a0(_0x21d33e['error'][_0x7ada('0x16')]);}logger[_0x7ada('0x15')]('MailQueue,\x20%s,\x20%s',_0x3be401,_0x21d33e['error'][_0x7ada('0x16')]);return _0x129c22(_0x21d33e[_0x7ada('0x15')]['message']);}else{logger[_0x7ada('0x17')](_0x7ada('0x10'),_0x3be401,_0x7ada('0x13'));_0x129c22(_0x21d33e[_0x7ada('0x18')][_0x7ada('0x16')]);}})[_0x7ada('0x19')](function(_0x5ab23e){logger[_0x7ada('0x15')]('MailQueue,\x20%s,\x20%s',_0x3be401,_0x5ab23e);_0x3530a0(_0x5ab23e);});});}exports['GetMailQueue']=function(_0x234097){var _0x2b7263=this;return new Promise(function(_0x742f66,_0x4fb5cd){return db['MailQueue']['findAll']({'raw':_0x234097[_0x7ada('0x1a')]?_0x234097['options'][_0x7ada('0x1b')]===undefined?!![]:![]:!![],'where':_0x234097[_0x7ada('0x1a')]?_0x234097[_0x7ada('0x1a')]['where']||null:null,'attributes':_0x234097[_0x7ada('0x1a')]?_0x234097[_0x7ada('0x1a')][_0x7ada('0x1c')]||null:null,'limit':_0x234097[_0x7ada('0x1a')]?_0x234097[_0x7ada('0x1a')]['limit']||null:null,'include':_0x234097['options']?_0x234097[_0x7ada('0x1a')][_0x7ada('0x1d')]?_[_0x7ada('0x1e')](_0x234097['options']['include'],function(_0x4298ef){return{'model':db[_0x4298ef[_0x7ada('0x1f')]],'as':_0x4298ef['as'],'attributes':_0x4298ef[_0x7ada('0x1c')],'include':_0x4298ef[_0x7ada('0x1d')]?_[_0x7ada('0x1e')](_0x4298ef[_0x7ada('0x1d')],function(_0x35d3b6){return{'model':db[_0x35d3b6['model']],'as':_0x35d3b6['as'],'attributes':_0x35d3b6[_0x7ada('0x1c')],'include':_0x35d3b6['include']?_[_0x7ada('0x1e')](_0x35d3b6[_0x7ada('0x1d')],function(_0x45cd55){return{'model':db[_0x45cd55['model']],'as':_0x45cd55['as'],'attributes':_0x45cd55[_0x7ada('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x7ada('0x20')](function(_0x17bbfd){logger[_0x7ada('0x17')]('GetMailQueue',_0x234097);logger[_0x7ada('0x11')](_0x7ada('0x21'),_0x234097,JSON[_0x7ada('0x14')](_0x17bbfd));_0x742f66(_0x17bbfd);})[_0x7ada('0x19')](function(_0x363d5c){logger[_0x7ada('0x15')](_0x7ada('0x21'),_0x363d5c[_0x7ada('0x16')],_0x234097);_0x4fb5cd(_0x2b7263['error'](0x1f4,_0x363d5c[_0x7ada('0x16')]));});});};exports[_0x7ada('0x22')]=function(_0x22bdf5){var _0x3ff9e1=this;return new Promise(function(_0x366bb6,_0x2afca6){return db[_0x7ada('0x23')][_0x7ada('0x24')]({'raw':_0x22bdf5[_0x7ada('0x1a')]?_0x22bdf5[_0x7ada('0x1a')][_0x7ada('0x1b')]===undefined?!![]:![]:!![],'where':_0x22bdf5[_0x7ada('0x1a')]?_0x22bdf5['options'][_0x7ada('0x25')]||null:null,'attributes':_0x22bdf5[_0x7ada('0x1a')]?_0x22bdf5[_0x7ada('0x1a')][_0x7ada('0x1c')]||null:null,'include':_0x22bdf5[_0x7ada('0x1a')]?_0x22bdf5['options'][_0x7ada('0x1d')]?_[_0x7ada('0x1e')](_0x22bdf5[_0x7ada('0x1a')][_0x7ada('0x1d')],function(_0xff6d5){return{'model':db[_0xff6d5['model']],'as':_0xff6d5['as'],'attributes':_0xff6d5['attributes'],'include':_0xff6d5[_0x7ada('0x1d')]?_[_0x7ada('0x1e')](_0xff6d5[_0x7ada('0x1d')],function(_0x1bf9ca){return{'model':db[_0x1bf9ca[_0x7ada('0x1f')]],'as':_0x1bf9ca['as'],'attributes':_0x1bf9ca[_0x7ada('0x1c')],'include':_0x1bf9ca[_0x7ada('0x1d')]?_[_0x7ada('0x1e')](_0x1bf9ca[_0x7ada('0x1d')],function(_0x3a0ece){return{'model':db[_0x3a0ece['model']],'as':_0x3a0ece['as'],'attributes':_0x3a0ece['attributes']};}):[]};}):[]};}):[]:[]})[_0x7ada('0x20')](function(_0x2e1064){logger[_0x7ada('0x17')](_0x7ada('0x22'),_0x22bdf5);logger[_0x7ada('0x11')]('ShowMailQueue',_0x22bdf5,JSON[_0x7ada('0x14')](_0x2e1064));_0x366bb6(_0x2e1064);})[_0x7ada('0x19')](function(_0x239a0c){logger['error'](_0x7ada('0x22'),_0x239a0c['message'],_0x22bdf5);_0x2afca6(_0x3ff9e1[_0x7ada('0x15')](0x1f4,_0x239a0c[_0x7ada('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 3d1995a..fd9a467 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 _0x2100=['update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove'];(function(_0x1fb1c1,_0x4ebe69){var _0x1622df=function(_0x52b793){while(--_0x52b793){_0x1fb1c1['push'](_0x1fb1c1['shift']());}};_0x1622df(++_0x4ebe69);}(_0x2100,0x9f));var _0x0210=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x2100[_0x135904];return _0x1ce7d5;};'use strict';var MailQueueEvents=require(_0x0210('0x0'));var events=[_0x0210('0x1'),_0x0210('0x2'),_0x0210('0x3')];function createListener(_0x12537c,_0x5c50fd){return function(_0x47e2d3){_0x5c50fd[_0x0210('0x4')](_0x12537c,_0x47e2d3);};}function removeListener(_0x213479,_0x2a498b){return function(){MailQueueEvents[_0x0210('0x5')](_0x213479,_0x2a498b);};}exports[_0x0210('0x6')]=function(_0x32c075){for(var _0x32db9c=0x0,_0x1e4f85=events[_0x0210('0x7')];_0x32db9c<_0x1e4f85;_0x32db9c++){var _0x36a008=events[_0x32db9c];var _0x48faf4=createListener(_0x0210('0x8')+_0x36a008,_0x32c075);MailQueueEvents['on'](_0x36a008,_0x48faf4);}}; \ No newline at end of file +var _0xa354=['remove','update','emit','removeListener','register','length','mailQueue:','./mailQueue.events','save'];(function(_0x218994,_0x2cf487){var _0x3f350b=function(_0x2e2065){while(--_0x2e2065){_0x218994['push'](_0x218994['shift']());}};_0x3f350b(++_0x2cf487);}(_0xa354,0xd6));var _0x4a35=function(_0x2f29c7,_0x31b7c9){_0x2f29c7=_0x2f29c7-0x0;var _0x2f6d18=_0xa354[_0x2f29c7];return _0x2f6d18;};'use strict';var MailQueueEvents=require(_0x4a35('0x0'));var events=[_0x4a35('0x1'),_0x4a35('0x2'),_0x4a35('0x3')];function createListener(_0x436d49,_0x53f8c4){return function(_0xd702bb){_0x53f8c4[_0x4a35('0x4')](_0x436d49,_0xd702bb);};}function removeListener(_0x531ded,_0x544487){return function(){MailQueueEvents[_0x4a35('0x5')](_0x531ded,_0x544487);};}exports[_0x4a35('0x6')]=function(_0x410a5c){for(var _0x131c03=0x0,_0x50e355=events[_0x4a35('0x7')];_0x131c03<_0x50e355;_0x131c03++){var _0x3ba7a4=events[_0x131c03];var _0x54d8b1=createListener(_0x4a35('0x8')+_0x3ba7a4,_0x410a5c);MailQueueEvents['on'](_0x3ba7a4,_0x54d8b1);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 4d92a60..5fcb9f3 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 _0x55f5=['describe','/:id','post','create','update','delete','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','get','/describe'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x55f5,0x167));var _0x555f=function(_0x415cf7,_0x1d3ca0){_0x415cf7=_0x415cf7-0x0;var _0x533c40=_0x55f5[_0x415cf7];return _0x533c40;};'use strict';var multer=require(_0x555f('0x0'));var util=require('util');var path=require(_0x555f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x555f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x555f('0x3'));var interaction=require(_0x555f('0x4'));var config=require('../../config/environment');var controller=require(_0x555f('0x5'));router['get']('/',auth[_0x555f('0x6')](),controller['index']);router[_0x555f('0x7')](_0x555f('0x8'),auth['isAuthenticated'](),controller[_0x555f('0x9')]);router[_0x555f('0x7')](_0x555f('0xa'),auth[_0x555f('0x6')](),controller['show']);router[_0x555f('0xb')]('/',auth[_0x555f('0x6')](),controller[_0x555f('0xc')]);router['put'](_0x555f('0xa'),auth[_0x555f('0x6')](),controller[_0x555f('0xd')]);router[_0x555f('0xe')](_0x555f('0xa'),auth[_0x555f('0x6')](),controller['destroy']);module[_0x555f('0xf')]=router; \ No newline at end of file +var _0x8c8a=['fs-extra','../../components/interaction/service','./mailQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','create','exports','multer','path','express','Router'];(function(_0x44dc99,_0x326111){var _0xe53489=function(_0x1b3344){while(--_0x1b3344){_0x44dc99['push'](_0x44dc99['shift']());}};_0xe53489(++_0x326111);}(_0x8c8a,0x8c));var _0xa8c8=function(_0x485539,_0x5491b7){_0x485539=_0x485539-0x0;var _0x2d3d75=_0x8c8a[_0x485539];return _0x2d3d75;};'use strict';var multer=require(_0xa8c8('0x0'));var util=require('util');var path=require(_0xa8c8('0x1'));var timeout=require('connect-timeout');var express=require(_0xa8c8('0x2'));var router=express[_0xa8c8('0x3')]();var fs_extra=require(_0xa8c8('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa8c8('0x5'));var config=require('../../config/environment');var controller=require(_0xa8c8('0x6'));router['get']('/',auth[_0xa8c8('0x7')](),controller[_0xa8c8('0x8')]);router[_0xa8c8('0x9')](_0xa8c8('0xa'),auth['isAuthenticated'](),controller[_0xa8c8('0xb')]);router[_0xa8c8('0x9')](_0xa8c8('0xc'),auth[_0xa8c8('0x7')](),controller[_0xa8c8('0xd')]);router['post']('/',auth[_0xa8c8('0x7')](),controller[_0xa8c8('0xe')]);router['put'](_0xa8c8('0xc'),auth[_0xa8c8('0x7')](),controller['update']);router['delete'](_0xa8c8('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xa8c8('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 9035d96..e0746fa 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 _0x8828=['moment','exports','STRING','DATE'];(function(_0x535780,_0x5d5d47){var _0x1a03fb=function(_0x3c9eaa){while(--_0x3c9eaa){_0x535780['push'](_0x535780['shift']());}};_0x1a03fb(++_0x5d5d47);}(_0x8828,0x184));var _0x8882=function(_0x361cfe,_0x600901){_0x361cfe=_0x361cfe-0x0;var _0x43951c=_0x8828[_0x361cfe];return _0x43951c;};'use strict';var moment=require(_0x8882('0x0'));var Sequelize=require('sequelize');module[_0x8882('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8882('0x2')]},'joinAt':{'type':Sequelize[_0x8882('0x3')]},'leaveAt':{'type':Sequelize[_0x8882('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8882('0x2')]}}; \ No newline at end of file +var _0xb733=['exports','DATE','STRING','moment'];(function(_0x4971a7,_0x2e9b32){var _0x4c754d=function(_0x9c56dc){while(--_0x9c56dc){_0x4971a7['push'](_0x4971a7['shift']());}};_0x4c754d(++_0x2e9b32);}(_0xb733,0xab));var _0x3b73=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb733[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0x3b73('0x0'));var Sequelize=require('sequelize');module[_0x3b73('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3b73('0x2')]},'leaveAt':{'type':Sequelize[_0x3b73('0x2')]},'acceptAt':{'type':Sequelize[_0x3b73('0x2')]},'exitAt':{'type':Sequelize[_0x3b73('0x2')]},'reason':{'type':Sequelize[_0x3b73('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 4ac05ed..86bc386 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 _0x2ef3=['name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','MailQueueReport','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','error','stack'];(function(_0x1a7aec,_0x17d0d0){var _0x101926=function(_0x4332b5){while(--_0x4332b5){_0x1a7aec['push'](_0x1a7aec['shift']());}};_0x101926(++_0x17d0d0);}(_0x2ef3,0xba));var _0x32ef=function(_0x407611,_0x3de779){_0x407611=_0x407611-0x0;var _0x9151a4=_0x2ef3[_0x407611];return _0x9151a4;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['MailQueueReport'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['MailQueueReport'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['MailQueueReport']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));};exports['describe']=function(_0x179c2f,_0x259c32){return db[_0x32ef('0x3d')][_0x32ef('0x4a')]()[_0x32ef('0x3e')](respondWithResult(_0x259c32,null))[_0x32ef('0x42')](handleError(_0x259c32,null));}; \ No newline at end of file +var _0x6050=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','fs-extra','jsforce','desk.js','to-csv','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','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','MailQueueReport','rawAttributes','type','key','model','query','keys'];(function(_0x40db41,_0x494d29){var _0x31f18b=function(_0x4e2f98){while(--_0x4e2f98){_0x40db41['push'](_0x40db41['shift']());}};_0x31f18b(++_0x494d29);}(_0x6050,0x196));var _0x0605=function(_0x14d8b5,_0x2e71d5){_0x14d8b5=_0x14d8b5-0x0;var _0x29e967=_0x6050[_0x14d8b5];return _0x29e967;};'use strict';var emlformat=require(_0x0605('0x0'));var rimraf=require(_0x0605('0x1'));var zipdir=require(_0x0605('0x2'));var jsonpatch=require(_0x0605('0x3'));var rp=require(_0x0605('0x4'));var moment=require(_0x0605('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0605('0x6'));var util=require(_0x0605('0x7'));var path=require(_0x0605('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0605('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0605('0xa'));var deskjs=require(_0x0605('0xb'));var toCsv=require(_0x0605('0xc'));var querystring=require(_0x0605('0xd'));var Papa=require(_0x0605('0xe'));var Redis=require('ioredis');var authService=require(_0x0605('0xf'));var qs=require(_0x0605('0x10'));var as=require(_0x0605('0x11'));var hardwareService=require(_0x0605('0x12'));var logger=require(_0x0605('0x13'))(_0x0605('0x14'));var utils=require(_0x0605('0x15'));var config=require(_0x0605('0x16'));var licenseUtil=require(_0x0605('0x17'));var db=require(_0x0605('0x18'))['db'];function respondWithStatusCode(_0xd22e35,_0x39e288){_0x39e288=_0x39e288||0xcc;return function(_0x34c9e6){if(_0x34c9e6){return _0xd22e35[_0x0605('0x19')](_0x39e288);}return _0xd22e35[_0x0605('0x1a')](_0x39e288)[_0x0605('0x1b')]();};}function respondWithResult(_0x169a70,_0x65a20b){_0x65a20b=_0x65a20b||0xc8;return function(_0x1b944f){if(_0x1b944f){return _0x169a70['status'](_0x65a20b)[_0x0605('0x1c')](_0x1b944f);}};}function respondWithFilteredResult(_0x1a802b,_0x4993ab){return function(_0x5ce56a){if(_0x5ce56a){var _0x4eefe9=typeof _0x4993ab[_0x0605('0x1d')]===_0x0605('0x1e')&&typeof _0x4993ab[_0x0605('0x1f')]===_0x0605('0x1e');var _0xefc557=_0x5ce56a[_0x0605('0x20')];var _0x2b7b5a=_0x4eefe9?0x0:_0x4993ab[_0x0605('0x1d')];var _0x193520=_0x4eefe9?_0x5ce56a[_0x0605('0x20')]:_0x4993ab[_0x0605('0x1d')]+_0x4993ab[_0x0605('0x1f')];var _0x2e2204;if(_0x193520>=_0xefc557){_0x193520=_0xefc557;_0x2e2204=0xc8;}else{_0x2e2204=0xce;}_0x1a802b[_0x0605('0x1a')](_0x2e2204);return _0x1a802b['set'](_0x0605('0x21'),_0x2b7b5a+'-'+_0x193520+'/'+_0xefc557)[_0x0605('0x1c')](_0x5ce56a);}return null;};}function patchUpdates(_0x430f28){return function(_0x443326){try{jsonpatch[_0x0605('0x22')](_0x443326,_0x430f28,!![]);}catch(_0x90b2e1){return BPromise[_0x0605('0x23')](_0x90b2e1);}return _0x443326[_0x0605('0x24')]();};}function saveUpdates(_0x226ef5,_0x5b0d44){return function(_0xc334b8){if(_0xc334b8){return _0xc334b8['update'](_0x226ef5)[_0x0605('0x25')](function(_0x118e9c){return _0x118e9c;});}return null;};}function removeEntity(_0x110098,_0xf182c4){return function(_0x10c575){if(_0x10c575){return _0x10c575[_0x0605('0x26')]()[_0x0605('0x25')](function(){_0x110098[_0x0605('0x1a')](0xcc)[_0x0605('0x1b')]();});}};}function handleEntityNotFound(_0x2896d7,_0x9f2833){return function(_0x1c3722){if(!_0x1c3722){_0x2896d7['sendStatus'](0x194);}return _0x1c3722;};}function handleError(_0x6bc204,_0x3c8e36){_0x3c8e36=_0x3c8e36||0x1f4;return function(_0x4b1e0c){logger['error'](_0x4b1e0c['stack']);if(_0x4b1e0c[_0x0605('0x27')]){delete _0x4b1e0c[_0x0605('0x27')];}_0x6bc204[_0x0605('0x1a')](_0x3c8e36)[_0x0605('0x28')](_0x4b1e0c);};}exports[_0x0605('0x29')]=function(_0x4554df,_0x4e32ef){var _0x34f25d={},_0x5daef6={},_0xa836f2={'count':0x0,'rows':[]};var _0x3640b9=_[_0x0605('0x2a')](db[_0x0605('0x2b')][_0x0605('0x2c')],function(_0x352dd6){return{'name':_0x352dd6['fieldName'],'type':_0x352dd6[_0x0605('0x2d')][_0x0605('0x2e')]};});_0x5daef6[_0x0605('0x2f')]=_[_0x0605('0x2a')](_0x3640b9,_0x0605('0x27'));_0x5daef6[_0x0605('0x30')]=_[_0x0605('0x31')](_0x4554df[_0x0605('0x30')]);_0x5daef6[_0x0605('0x32')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],_0x5daef6[_0x0605('0x30')]);_0x34f25d[_0x0605('0x34')]=_[_0x0605('0x33')](_0x5daef6[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x4554df[_0x0605('0x30')][_0x0605('0x35')]));_0x34f25d[_0x0605('0x34')]=_0x34f25d[_0x0605('0x34')][_0x0605('0x36')]?_0x34f25d[_0x0605('0x34')]:_0x5daef6[_0x0605('0x2f')];if(!_0x4554df[_0x0605('0x30')][_0x0605('0x37')](_0x0605('0x38'))){_0x34f25d[_0x0605('0x1f')]=qs['limit'](_0x4554df[_0x0605('0x30')][_0x0605('0x1f')]);_0x34f25d['offset']=qs[_0x0605('0x1d')](_0x4554df[_0x0605('0x30')]['offset']);}_0x34f25d[_0x0605('0x39')]=qs[_0x0605('0x3a')](_0x4554df[_0x0605('0x30')][_0x0605('0x3a')]);_0x34f25d[_0x0605('0x3b')]=qs[_0x0605('0x32')](_['pick'](_0x4554df['query'],_0x5daef6[_0x0605('0x32')]),_0x3640b9);if(_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]){_0x34f25d['where']=_[_0x0605('0x3d')](_0x34f25d['where'],{'$or':_[_0x0605('0x2a')](_0x3640b9,function(_0x1e98f6){if(_0x1e98f6[_0x0605('0x2d')]!==_0x0605('0x3e')){var _0x42f7ce={};_0x42f7ce[_0x1e98f6[_0x0605('0x27')]]={'$like':'%'+_0x4554df[_0x0605('0x30')][_0x0605('0x3c')]+'%'};return _0x42f7ce;}})});}_0x34f25d=_[_0x0605('0x3d')]({},_0x34f25d,_0x4554df[_0x0605('0x3f')]);var _0x57aa15={'where':_0x34f25d[_0x0605('0x3b')]};return db['MailQueueReport'][_0x0605('0x20')](_0x57aa15)[_0x0605('0x25')](function(_0x45787e){_0xa836f2['count']=_0x45787e;if(_0x4554df['query'][_0x0605('0x40')]){_0x34f25d['include']=[{'all':!![]}];}return db[_0x0605('0x2b')][_0x0605('0x41')](_0x34f25d);})[_0x0605('0x25')](function(_0x3de34a){_0xa836f2[_0x0605('0x42')]=_0x3de34a;return _0xa836f2;})[_0x0605('0x25')](respondWithFilteredResult(_0x4e32ef,_0x34f25d))[_0x0605('0x43')](handleError(_0x4e32ef,null));};exports[_0x0605('0x44')]=function(_0x3fa553,_0x10bb36){var _0x18d3ce={'raw':!![],'where':{'id':_0x3fa553[_0x0605('0x45')]['id']}},_0x3616a3={};_0x3616a3['model']=_['keys'](db[_0x0605('0x2b')]['rawAttributes']);_0x3616a3[_0x0605('0x30')]=_[_0x0605('0x31')](_0x3fa553['query']);_0x3616a3[_0x0605('0x32')]=_[_0x0605('0x33')](_0x3616a3['model'],_0x3616a3[_0x0605('0x30')]);_0x18d3ce[_0x0605('0x34')]=_['intersection'](_0x3616a3[_0x0605('0x2f')],qs[_0x0605('0x35')](_0x3fa553['query'][_0x0605('0x35')]));_0x18d3ce['attributes']=_0x18d3ce['attributes'][_0x0605('0x36')]?_0x18d3ce[_0x0605('0x34')]:_0x3616a3[_0x0605('0x2f')];if(_0x3fa553[_0x0605('0x30')][_0x0605('0x40')]){_0x18d3ce[_0x0605('0x46')]=[{'all':!![]}];}_0x18d3ce=_[_0x0605('0x3d')]({},_0x18d3ce,_0x3fa553[_0x0605('0x3f')]);return db['MailQueueReport'][_0x0605('0x47')](_0x18d3ce)[_0x0605('0x25')](handleEntityNotFound(_0x10bb36,null))[_0x0605('0x25')](respondWithResult(_0x10bb36,null))['catch'](handleError(_0x10bb36,null));};exports[_0x0605('0x48')]=function(_0x1fb70b,_0x45cc1a){return db[_0x0605('0x2b')][_0x0605('0x48')](_0x1fb70b[_0x0605('0x49')],{})[_0x0605('0x25')](respondWithResult(_0x45cc1a,0xc9))[_0x0605('0x43')](handleError(_0x45cc1a,null));};exports[_0x0605('0x4a')]=function(_0x4bc55e,_0x3c597c){if(_0x4bc55e[_0x0605('0x49')]['id']){delete _0x4bc55e[_0x0605('0x49')]['id'];}return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4bc55e[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x3c597c,null))[_0x0605('0x25')](saveUpdates(_0x4bc55e[_0x0605('0x49')],null))[_0x0605('0x25')](respondWithResult(_0x3c597c,null))['catch'](handleError(_0x3c597c,null));};exports['destroy']=function(_0x4876c7,_0x2687a8){return db[_0x0605('0x2b')][_0x0605('0x47')]({'where':{'id':_0x4876c7[_0x0605('0x45')]['id']}})[_0x0605('0x25')](handleEntityNotFound(_0x2687a8,null))[_0x0605('0x25')](removeEntity(_0x2687a8,null))['catch'](handleError(_0x2687a8,null));};exports[_0x0605('0x4b')]=function(_0x286485,_0x184232){return db[_0x0605('0x2b')]['describe']()[_0x0605('0x25')](respondWithResult(_0x184232,null))[_0x0605('0x43')](handleError(_0x184232,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 9d2bab3..3b447f5 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 _0x8c3d=['exports','define','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x553579,_0x269bd9){var _0x156ea3=function(_0x3bd6bb){while(--_0x3bd6bb){_0x553579['push'](_0x553579['shift']());}};_0x156ea3(++_0x269bd9);}(_0x8c3d,0x16a));var _0xd8c3=function(_0x4e8401,_0x51b328){_0x4e8401=_0x4e8401-0x0;var _0x17269f=_0x8c3d[_0x4e8401];return _0x17269f;};'use strict';var _=require(_0xd8c3('0x0'));var util=require(_0xd8c3('0x1'));var logger=require(_0xd8c3('0x2'))('api');var moment=require(_0xd8c3('0x3'));var BPromise=require(_0xd8c3('0x4'));var rp=require(_0xd8c3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd8c3('0x6'));var config=require('../../config/environment');var attributes=require('./mailQueueReport.attributes');module[_0xd8c3('0x7')]=function(_0x117b77,_0x153554){return _0x117b77[_0xd8c3('0x8')]('MailQueueReport',attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xf4de=['report_mail_queue','uniqueid','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','MailQueueReport'];(function(_0x8ba642,_0x4e13b4){var _0x3ba896=function(_0x55672d){while(--_0x55672d){_0x8ba642['push'](_0x8ba642['shift']());}};_0x3ba896(++_0x4e13b4);}(_0xf4de,0xdf));var _0xef4d=function(_0x21176a,_0x12a3c6){_0x21176a=_0x21176a-0x0;var _0x205749=_0xf4de[_0x21176a];return _0x205749;};'use strict';var _=require(_0xef4d('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xef4d('0x1'));var moment=require(_0xef4d('0x2'));var BPromise=require(_0xef4d('0x3'));var rp=require(_0xef4d('0x4'));var fs=require('fs');var path=require(_0xef4d('0x5'));var rimraf=require(_0xef4d('0x6'));var config=require(_0xef4d('0x7'));var attributes=require(_0xef4d('0x8'));module[_0xef4d('0x9')]=function(_0x183ea6,_0x2e4625){return _0x183ea6['define'](_0xef4d('0xa'),attributes,{'tableName':_0xef4d('0xb'),'paranoid':![],'indexes':[{'name':_0xef4d('0xc'),'fields':[_0xef4d('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 3fc2106..e9ab770 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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0x1d312c,_0x40ffb2){var _0x32fc37=function(_0x11db86){while(--_0x11db86){_0x1d312c['push'](_0x1d312c['shift']());}};_0x32fc37(++_0x40ffb2);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x5d6456,_0x58ecc7){_0x5d6456=_0x5d6456-0x0;var _0x4d66c1=_0xc4aa[_0x5d6456];return _0x4d66c1;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x23e608,_0x5a524f){var _0x2909e9=function(_0x30fe2c){while(--_0x30fe2c){_0x23e608['push'](_0x23e608['shift']());}};_0x2909e9(++_0x5a524f);}(_0x5f2f,0x73));var _0xf5f2=function(_0xfcc29e,_0x5a456d){_0xfcc29e=_0xfcc29e-0x0;var _0x340c45=_0x5f2f[_0xfcc29e];return _0x340c45;};'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')]('MailQueueReport,\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);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index b393a8e..d90cd13 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x438075,_0x59ca9e){var _0x3c2ff0=function(_0x305e6e){while(--_0x305e6e){_0x438075['push'](_0x438075['shift']());}};_0x3c2ff0(++_0x59ca9e);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x23322d,_0x2f503c){var _0x3e5152=function(_0x141687){while(--_0x141687){_0x23322d['push'](_0x23322d['shift']());}};_0x3e5152(++_0x2f503c);}(_0xedd9,0xfc));var _0x9edd=function(_0x447b93,_0x2670ae){_0x447b93=_0x447b93-0x0;var _0x1fd738=_0xedd9[_0x447b93];return _0x1fd738;};'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');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 68afaa7..f508839 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 _0xa77e=['exports','STRING','BOOLEAN','INTEGER','INBOX','sequelize'];(function(_0x2a4d7f,_0x3d0d40){var _0x36f0c7=function(_0xcf4aed){while(--_0xcf4aed){_0x2a4d7f['push'](_0x2a4d7f['shift']());}};_0x36f0c7(++_0x3d0d40);}(_0xa77e,0x197));var _0xea77=function(_0x1cefc2,_0x3cd675){_0x1cefc2=_0x1cefc2-0x0;var _0x5c1b6e=_0xa77e[_0x1cefc2];return _0x5c1b6e;};'use strict';var Sequelize=require(_0xea77('0x0'));module[_0xea77('0x1')]={'description':{'type':Sequelize[_0xea77('0x2')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0xea77('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xea77('0x2')]},'password':{'type':Sequelize[_0xea77('0x2')]},'port':{'type':Sequelize[_0xea77('0x4')]},'tls':{'type':Sequelize[_0xea77('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xea77('0x2')],'defaultValue':_0xea77('0x5')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xea77('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xea77('0x2')]},'modernAuthentication':{'type':Sequelize[_0xea77('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xcf85=['BOOLEAN','INBOX','exports','STRING'];(function(_0x483652,_0x52a991){var _0x1a9cff=function(_0x127bdd){while(--_0x127bdd){_0x483652['push'](_0x483652['shift']());}};_0x1a9cff(++_0x52a991);}(_0xcf85,0x13e));var _0x5cf8=function(_0x1e8a13,_0x150633){_0x1e8a13=_0x1e8a13-0x0;var _0x1b5c34=_0xcf85[_0x1e8a13];return _0x1b5c34;};'use strict';var Sequelize=require('sequelize');module[_0x5cf8('0x0')]={'description':{'type':Sequelize[_0x5cf8('0x1')]},'host':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0x5cf8('0x1')]},'password':{'type':Sequelize[_0x5cf8('0x1')]},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize[_0x5cf8('0x2')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x5cf8('0x1')],'defaultValue':_0x5cf8('0x3')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x5cf8('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 924f407..02d6857 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 _0xc248=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','define','mail_servers_in'];(function(_0x1f0bb3,_0x3a34f3){var _0x37c7c3=function(_0x9a157e){while(--_0x9a157e){_0x1f0bb3['push'](_0x1f0bb3['shift']());}};_0x37c7c3(++_0x3a34f3);}(_0xc248,0xfc));var _0x8c24=function(_0x1230e6,_0x1031ce){_0x1230e6=_0x1230e6-0x0;var _0x4e7cc5=_0xc248[_0x1230e6];return _0x4e7cc5;};'use strict';var _=require(_0x8c24('0x0'));var util=require(_0x8c24('0x1'));var logger=require(_0x8c24('0x2'))(_0x8c24('0x3'));var moment=require('moment');var BPromise=require(_0x8c24('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c24('0x5'));var rimraf=require(_0x8c24('0x6'));var config=require(_0x8c24('0x7'));var attributes=require(_0x8c24('0x8'));module[_0x8c24('0x9')]=function(_0xa54a12,_0x34f040){return _0xa54a12[_0x8c24('0xa')]('MailServerIn',attributes,{'tableName':_0x8c24('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4980=['lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn'];(function(_0x36ae3a,_0x39d3e5){var _0x11cd9a=function(_0x410c65){while(--_0x410c65){_0x36ae3a['push'](_0x36ae3a['shift']());}};_0x11cd9a(++_0x39d3e5);}(_0x4980,0x14a));var _0x0498=function(_0x30c0af,_0x17a5b5){_0x30c0af=_0x30c0af-0x0;var _0x3314fa=_0x4980[_0x30c0af];return _0x3314fa;};'use strict';var _=require(_0x0498('0x0'));var util=require(_0x0498('0x1'));var logger=require(_0x0498('0x2'))(_0x0498('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x0498('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0498('0x5'));var config=require(_0x0498('0x6'));var attributes=require(_0x0498('0x7'));module[_0x0498('0x8')]=function(_0x10f1fb,_0x79d518){return _0x10f1fb['define'](_0x0498('0x9'),attributes,{'tableName':'mail_servers_in','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 afa699e..e77ba13 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 _0x2720=['http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailServerIn','MailServerIn','options','raw','where','include','map','model','attributes','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5e352d,_0x32cafd){var _0x10c2b9=function(_0xe1e05d){while(--_0xe1e05d){_0x5e352d['push'](_0x5e352d['shift']());}};_0x10c2b9(++_0x32cafd);}(_0x2720,0xc1));var _0x0272=function(_0x55aab3,_0x50b5e1){_0x55aab3=_0x55aab3-0x0;var _0x5baa84=_0x2720[_0x55aab3];return _0x5baa84;};'use strict';var _=require(_0x0272('0x0'));var util=require(_0x0272('0x1'));var moment=require('moment');var BPromise=require(_0x0272('0x2'));var rs=require(_0x0272('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0272('0x4'))['db'];var utils=require(_0x0272('0x5'));var logger=require(_0x0272('0x6'))(_0x0272('0x7'));var config=require(_0x0272('0x8'));var jayson=require(_0x0272('0x9'));var client=jayson[_0x0272('0xa')][_0x0272('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45448c,_0x4a0420,_0x56afad){return new BPromise(function(_0x1d2b37,_0x51cebc){return client[_0x0272('0xc')](_0x45448c,_0x56afad)[_0x0272('0xd')](function(_0x198871){logger[_0x0272('0xe')](_0x0272('0xf'),_0x4a0420,_0x0272('0x10'));logger[_0x0272('0x11')](_0x0272('0x12'),_0x4a0420,_0x0272('0x10'),JSON[_0x0272('0x13')](_0x198871));if(_0x198871[_0x0272('0x14')]){if(_0x198871[_0x0272('0x14')][_0x0272('0x15')]===0x1f4){logger[_0x0272('0x14')]('MailServerIn,\x20%s,\x20%s',_0x4a0420,_0x198871[_0x0272('0x14')][_0x0272('0x16')]);return _0x51cebc(_0x198871[_0x0272('0x14')][_0x0272('0x16')]);}logger[_0x0272('0x14')]('MailServerIn,\x20%s,\x20%s',_0x4a0420,_0x198871[_0x0272('0x14')][_0x0272('0x16')]);return _0x1d2b37(_0x198871[_0x0272('0x14')][_0x0272('0x16')]);}else{logger[_0x0272('0xe')](_0x0272('0xf'),_0x4a0420,'request\x20sent');_0x1d2b37(_0x198871[_0x0272('0x17')]['message']);}})['catch'](function(_0x4ffd4a){logger['error'](_0x0272('0xf'),_0x4a0420,_0x4ffd4a);_0x51cebc(_0x4ffd4a);});});}exports[_0x0272('0x18')]=function(_0x2b9c50){var _0x4f0f07=this;return new Promise(function(_0x3816b4,_0x5bf735){return db[_0x0272('0x19')]['findAll']({'raw':_0x2b9c50[_0x0272('0x1a')]?_0x2b9c50[_0x0272('0x1a')][_0x0272('0x1b')]===undefined?!![]:![]:!![],'where':_0x2b9c50['options']?_0x2b9c50[_0x0272('0x1a')][_0x0272('0x1c')]||null:null,'attributes':_0x2b9c50[_0x0272('0x1a')]?_0x2b9c50[_0x0272('0x1a')]['attributes']||null:null,'limit':_0x2b9c50['options']?_0x2b9c50[_0x0272('0x1a')]['limit']||null:null,'include':_0x2b9c50['options']?_0x2b9c50[_0x0272('0x1a')][_0x0272('0x1d')]?_[_0x0272('0x1e')](_0x2b9c50[_0x0272('0x1a')]['include'],function(_0x3d22cb){return{'model':db[_0x3d22cb[_0x0272('0x1f')]],'as':_0x3d22cb['as'],'attributes':_0x3d22cb[_0x0272('0x20')],'include':_0x3d22cb[_0x0272('0x1d')]?_[_0x0272('0x1e')](_0x3d22cb[_0x0272('0x1d')],function(_0x1ed4d6){return{'model':db[_0x1ed4d6[_0x0272('0x1f')]],'as':_0x1ed4d6['as'],'attributes':_0x1ed4d6[_0x0272('0x20')],'include':_0x1ed4d6['include']?_[_0x0272('0x1e')](_0x1ed4d6[_0x0272('0x1d')],function(_0x50af7f){return{'model':db[_0x50af7f[_0x0272('0x1f')]],'as':_0x50af7f['as'],'attributes':_0x50af7f[_0x0272('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f7a28){logger[_0x0272('0xe')]('GetMailServerIn',_0x2b9c50);logger[_0x0272('0x11')]('GetMailServerIn',_0x2b9c50,JSON[_0x0272('0x13')](_0x3f7a28));_0x3816b4(_0x3f7a28);})[_0x0272('0x21')](function(_0x5a6a0e){logger[_0x0272('0x14')]('GetMailServerIn',_0x5a6a0e[_0x0272('0x16')],_0x2b9c50);_0x5bf735(_0x4f0f07['error'](0x1f4,_0x5a6a0e[_0x0272('0x16')]));});});}; \ No newline at end of file +var _0x8d84=['error','message','info','result','catch','findAll','options','attributes','limit','include','map','model','GetMailServerIn','stringify','lodash','util','moment','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s'];(function(_0x4814ff,_0x58c0e4){var _0x53e652=function(_0x1d8b71){while(--_0x1d8b71){_0x4814ff['push'](_0x4814ff['shift']());}};_0x53e652(++_0x58c0e4);}(_0x8d84,0xfe));var _0x48d8=function(_0x5e40e8,_0x12ad3a){_0x5e40e8=_0x5e40e8-0x0;var _0x5ae767=_0x8d84[_0x5e40e8];return _0x5ae767;};'use strict';var _=require(_0x48d8('0x0'));var util=require(_0x48d8('0x1'));var moment=require(_0x48d8('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x48d8('0x3'));var db=require(_0x48d8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x48d8('0x5'))(_0x48d8('0x6'));var config=require(_0x48d8('0x7'));var jayson=require(_0x48d8('0x8'));var client=jayson[_0x48d8('0x9')][_0x48d8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x185938,_0x159889,_0x400545){return new BPromise(function(_0x2543e1,_0x210d4e){return client['request'](_0x185938,_0x400545)[_0x48d8('0xb')](function(_0x389b5d){logger['info'](_0x48d8('0xc'),_0x159889,_0x48d8('0xd'));logger[_0x48d8('0xe')](_0x48d8('0xf'),_0x159889,'request\x20sent',JSON['stringify'](_0x389b5d));if(_0x389b5d[_0x48d8('0x10')]){if(_0x389b5d[_0x48d8('0x10')]['code']===0x1f4){logger[_0x48d8('0x10')](_0x48d8('0xc'),_0x159889,_0x389b5d[_0x48d8('0x10')][_0x48d8('0x11')]);return _0x210d4e(_0x389b5d[_0x48d8('0x10')]['message']);}logger[_0x48d8('0x10')](_0x48d8('0xc'),_0x159889,_0x389b5d[_0x48d8('0x10')]['message']);return _0x2543e1(_0x389b5d['error'][_0x48d8('0x11')]);}else{logger[_0x48d8('0x12')](_0x48d8('0xc'),_0x159889,'request\x20sent');_0x2543e1(_0x389b5d[_0x48d8('0x13')][_0x48d8('0x11')]);}})[_0x48d8('0x14')](function(_0x31ef49){logger[_0x48d8('0x10')](_0x48d8('0xc'),_0x159889,_0x31ef49);_0x210d4e(_0x31ef49);});});}exports['GetMailServerIn']=function(_0x521dab){var _0x28bea3=this;return new Promise(function(_0x32e271,_0x1d7567){return db['MailServerIn'][_0x48d8('0x15')]({'raw':_0x521dab['options']?_0x521dab['options']['raw']===undefined?!![]:![]:!![],'where':_0x521dab[_0x48d8('0x16')]?_0x521dab[_0x48d8('0x16')]['where']||null:null,'attributes':_0x521dab[_0x48d8('0x16')]?_0x521dab[_0x48d8('0x16')][_0x48d8('0x17')]||null:null,'limit':_0x521dab[_0x48d8('0x16')]?_0x521dab[_0x48d8('0x16')][_0x48d8('0x18')]||null:null,'include':_0x521dab[_0x48d8('0x16')]?_0x521dab[_0x48d8('0x16')][_0x48d8('0x19')]?_[_0x48d8('0x1a')](_0x521dab[_0x48d8('0x16')][_0x48d8('0x19')],function(_0x532ebb){return{'model':db[_0x532ebb[_0x48d8('0x1b')]],'as':_0x532ebb['as'],'attributes':_0x532ebb['attributes'],'include':_0x532ebb[_0x48d8('0x19')]?_['map'](_0x532ebb[_0x48d8('0x19')],function(_0x543628){return{'model':db[_0x543628[_0x48d8('0x1b')]],'as':_0x543628['as'],'attributes':_0x543628['attributes'],'include':_0x543628[_0x48d8('0x19')]?_[_0x48d8('0x1a')](_0x543628['include'],function(_0x4fc4a3){return{'model':db[_0x4fc4a3[_0x48d8('0x1b')]],'as':_0x4fc4a3['as'],'attributes':_0x4fc4a3[_0x48d8('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39892f){logger[_0x48d8('0x12')]('GetMailServerIn',_0x521dab);logger['debug'](_0x48d8('0x1c'),_0x521dab,JSON[_0x48d8('0x1d')](_0x39892f));_0x32e271(_0x39892f);})['catch'](function(_0x59dc6e){logger['error']('GetMailServerIn',_0x59dc6e[_0x48d8('0x11')],_0x521dab);_0x1d7567(_0x28bea3[_0x48d8('0x10')](0x1f4,_0x59dc6e[_0x48d8('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 9604652..7607c30 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(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x7a54,0x106));var _0x47a5=function(_0x194163,_0x3e3f4c){_0x194163=_0x194163-0x0;var _0x2e9254=_0x7a54[_0x194163];return _0x2e9254;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 7b02da1..584b14a 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 _0x6cb4=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x4f7ebd,_0x14fa97){var _0x279d40=function(_0x5a2770){while(--_0x5a2770){_0x4f7ebd['push'](_0x4f7ebd['shift']());}};_0x279d40(++_0x14fa97);}(_0x6cb4,0xff));var _0x46cb=function(_0x2375ba,_0x4a32fb){_0x2375ba=_0x2375ba-0x0;var _0x42e8b6=_0x6cb4[_0x2375ba];return _0x42e8b6;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'description':{'type':Sequelize[_0x46cb('0x2')]},'host':{'type':Sequelize[_0x46cb('0x2')]},'user':{'type':Sequelize[_0x46cb('0x2')]},'pass':{'type':Sequelize[_0x46cb('0x2')]},'port':{'type':Sequelize[_0x46cb('0x3')]},'secure':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x46cb('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xcf66=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3d3d2b,_0x3ede6a){var _0x538fce=function(_0x4c08cd){while(--_0x4c08cd){_0x3d3d2b['push'](_0x3d3d2b['shift']());}};_0x538fce(++_0x3ede6a);}(_0xcf66,0x71));var _0x6cf6=function(_0x346477,_0x51075d){_0x346477=_0x346477-0x0;var _0x15f4a0=_0xcf66[_0x346477];return _0x15f4a0;};'use strict';var Sequelize=require(_0x6cf6('0x0'));module[_0x6cf6('0x1')]={'description':{'type':Sequelize[_0x6cf6('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x6cf6('0x2')]},'pass':{'type':Sequelize[_0x6cf6('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'service':{'type':Sequelize[_0x6cf6('0x2')]},'authentication':{'type':Sequelize[_0x6cf6('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 4b992b2..024ac07 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 _0x57be=['bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','MailServerOut','include','findAll','rows','show','fields','includeAll','find','catch','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment'];(function(_0xa559be,_0x32f7c3){var _0x3cfa4a=function(_0x312a15){while(--_0x312a15){_0xa559be['push'](_0xa559be['shift']());}};_0x3cfa4a(++_0x32f7c3);}(_0x57be,0xdf));var _0xe57b=function(_0x238135,_0x510dc2){_0x238135=_0x238135-0x0;var _0x567521=_0x57be[_0x238135];return _0x567521;};'use strict';var emlformat=require(_0xe57b('0x0'));var rimraf=require(_0xe57b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe57b('0x2'));var rp=require(_0xe57b('0x3'));var moment=require(_0xe57b('0x4'));var BPromise=require(_0xe57b('0x5'));var Mustache=require(_0xe57b('0x6'));var util=require(_0xe57b('0x7'));var path=require(_0xe57b('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe57b('0x9'));var fs=require('fs');var fs_extra=require(_0xe57b('0xa'));var _=require('lodash');var squel=require(_0xe57b('0xb'));var crypto=require(_0xe57b('0xc'));var jsforce=require(_0xe57b('0xd'));var deskjs=require(_0xe57b('0xe'));var toCsv=require(_0xe57b('0xf'));var querystring=require(_0xe57b('0x10'));var Papa=require(_0xe57b('0x11'));var Redis=require(_0xe57b('0x12'));var authService=require(_0xe57b('0x13'));var qs=require(_0xe57b('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xe57b('0x15'))(_0xe57b('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe57b('0x17'));var db=require(_0xe57b('0x18'))['db'];function respondWithStatusCode(_0x509740,_0x6ea28c){_0x6ea28c=_0x6ea28c||0xcc;return function(_0x117dcc){if(_0x117dcc){return _0x509740[_0xe57b('0x19')](_0x6ea28c);}return _0x509740[_0xe57b('0x1a')](_0x6ea28c)[_0xe57b('0x1b')]();};}function respondWithResult(_0x43e0ee,_0x46e02a){_0x46e02a=_0x46e02a||0xc8;return function(_0x40e7f3){if(_0x40e7f3){return _0x43e0ee[_0xe57b('0x1a')](_0x46e02a)[_0xe57b('0x1c')](_0x40e7f3);}};}function respondWithFilteredResult(_0x1df8fe,_0x493534){return function(_0x407c7a){if(_0x407c7a){var _0x3adfee=typeof _0x493534[_0xe57b('0x1d')]===_0xe57b('0x1e')&&typeof _0x493534[_0xe57b('0x1f')]===_0xe57b('0x1e');var _0x4bdd80=_0x407c7a[_0xe57b('0x20')];var _0x13b357=_0x3adfee?0x0:_0x493534['offset'];var _0x10de0f=_0x3adfee?_0x407c7a['count']:_0x493534[_0xe57b('0x1d')]+_0x493534[_0xe57b('0x1f')];var _0x113d3b;if(_0x10de0f>=_0x4bdd80){_0x10de0f=_0x4bdd80;_0x113d3b=0xc8;}else{_0x113d3b=0xce;}_0x1df8fe[_0xe57b('0x1a')](_0x113d3b);return _0x1df8fe[_0xe57b('0x21')](_0xe57b('0x22'),_0x13b357+'-'+_0x10de0f+'/'+_0x4bdd80)['json'](_0x407c7a);}return null;};}function patchUpdates(_0x1adf0d){return function(_0x200145){try{jsonpatch[_0xe57b('0x23')](_0x200145,_0x1adf0d,!![]);}catch(_0x420763){return BPromise['reject'](_0x420763);}return _0x200145[_0xe57b('0x24')]();};}function saveUpdates(_0x3e4aef,_0x589f0e){return function(_0x31cd02){if(_0x31cd02){return _0x31cd02['update'](_0x3e4aef)[_0xe57b('0x25')](function(_0x45d82b){return _0x45d82b;});}return null;};}function removeEntity(_0x3c1a39,_0xbb0607){return function(_0x51dce3){if(_0x51dce3){return _0x51dce3[_0xe57b('0x26')]()[_0xe57b('0x25')](function(){_0x3c1a39[_0xe57b('0x1a')](0xcc)[_0xe57b('0x1b')]();});}};}function handleEntityNotFound(_0x33b0ea,_0x5ce67d){return function(_0x57c853){if(!_0x57c853){_0x33b0ea[_0xe57b('0x19')](0x194);}return _0x57c853;};}function handleError(_0x50f511,_0x59cea9){_0x59cea9=_0x59cea9||0x1f4;return function(_0x498f30){logger[_0xe57b('0x27')](_0x498f30[_0xe57b('0x28')]);if(_0x498f30['name']){delete _0x498f30[_0xe57b('0x29')];}_0x50f511[_0xe57b('0x1a')](_0x59cea9)[_0xe57b('0x2a')](_0x498f30);};}exports[_0xe57b('0x2b')]=function(_0x2d9e9c,_0x4cfcc5){var _0x3b22e7={},_0x562277={},_0x138a43={'count':0x0,'rows':[]};var _0x4956df=_['map'](db['MailServerOut'][_0xe57b('0x2c')],function(_0x1a2657){return{'name':_0x1a2657[_0xe57b('0x2d')],'type':_0x1a2657['type']['key']};});_0x562277[_0xe57b('0x2e')]=_[_0xe57b('0x2f')](_0x4956df,_0xe57b('0x29'));_0x562277[_0xe57b('0x30')]=_[_0xe57b('0x31')](_0x2d9e9c[_0xe57b('0x30')]);_0x562277[_0xe57b('0x32')]=_[_0xe57b('0x33')](_0x562277[_0xe57b('0x2e')],_0x562277['query']);_0x3b22e7[_0xe57b('0x34')]=_[_0xe57b('0x33')](_0x562277[_0xe57b('0x2e')],qs['fields'](_0x2d9e9c[_0xe57b('0x30')]['fields']));_0x3b22e7[_0xe57b('0x34')]=_0x3b22e7['attributes'][_0xe57b('0x35')]?_0x3b22e7['attributes']:_0x562277[_0xe57b('0x2e')];if(!_0x2d9e9c[_0xe57b('0x30')][_0xe57b('0x36')](_0xe57b('0x37'))){_0x3b22e7[_0xe57b('0x1f')]=qs[_0xe57b('0x1f')](_0x2d9e9c[_0xe57b('0x30')][_0xe57b('0x1f')]);_0x3b22e7[_0xe57b('0x1d')]=qs[_0xe57b('0x1d')](_0x2d9e9c[_0xe57b('0x30')][_0xe57b('0x1d')]);}_0x3b22e7['order']=qs[_0xe57b('0x38')](_0x2d9e9c['query'][_0xe57b('0x38')]);_0x3b22e7[_0xe57b('0x39')]=qs[_0xe57b('0x32')](_[_0xe57b('0x3a')](_0x2d9e9c[_0xe57b('0x30')],_0x562277[_0xe57b('0x32')]),_0x4956df);if(_0x2d9e9c[_0xe57b('0x30')][_0xe57b('0x3b')]){_0x3b22e7[_0xe57b('0x39')]=_[_0xe57b('0x3c')](_0x3b22e7[_0xe57b('0x39')],{'$or':_[_0xe57b('0x2f')](_0x4956df,function(_0x20b491){if(_0x20b491['type']!==_0xe57b('0x3d')){var _0x15f2fc={};_0x15f2fc[_0x20b491[_0xe57b('0x29')]]={'$like':'%'+_0x2d9e9c[_0xe57b('0x30')][_0xe57b('0x3b')]+'%'};return _0x15f2fc;}})});}_0x3b22e7=_[_0xe57b('0x3c')]({},_0x3b22e7,_0x2d9e9c[_0xe57b('0x3e')]);var _0x3226a6={'where':_0x3b22e7[_0xe57b('0x39')]};return db[_0xe57b('0x3f')]['count'](_0x3226a6)[_0xe57b('0x25')](function(_0x35f5a2){_0x138a43[_0xe57b('0x20')]=_0x35f5a2;if(_0x2d9e9c['query']['includeAll']){_0x3b22e7[_0xe57b('0x40')]=[{'all':!![]}];}return db[_0xe57b('0x3f')][_0xe57b('0x41')](_0x3b22e7);})[_0xe57b('0x25')](function(_0x4c0e5d){_0x138a43[_0xe57b('0x42')]=_0x4c0e5d;return _0x138a43;})[_0xe57b('0x25')](respondWithFilteredResult(_0x4cfcc5,_0x3b22e7))['catch'](handleError(_0x4cfcc5,null));};exports[_0xe57b('0x43')]=function(_0x21d49a,_0x3c3ca0){var _0x10e61b={'raw':!![],'where':{'id':_0x21d49a['params']['id']}},_0x1303e9={};_0x1303e9[_0xe57b('0x2e')]=_[_0xe57b('0x31')](db[_0xe57b('0x3f')][_0xe57b('0x2c')]);_0x1303e9[_0xe57b('0x30')]=_[_0xe57b('0x31')](_0x21d49a[_0xe57b('0x30')]);_0x1303e9[_0xe57b('0x32')]=_['intersection'](_0x1303e9[_0xe57b('0x2e')],_0x1303e9[_0xe57b('0x30')]);_0x10e61b[_0xe57b('0x34')]=_[_0xe57b('0x33')](_0x1303e9[_0xe57b('0x2e')],qs['fields'](_0x21d49a[_0xe57b('0x30')][_0xe57b('0x44')]));_0x10e61b[_0xe57b('0x34')]=_0x10e61b[_0xe57b('0x34')][_0xe57b('0x35')]?_0x10e61b['attributes']:_0x1303e9[_0xe57b('0x2e')];if(_0x21d49a[_0xe57b('0x30')][_0xe57b('0x45')]){_0x10e61b['include']=[{'all':!![]}];}_0x10e61b=_['merge']({},_0x10e61b,_0x21d49a[_0xe57b('0x3e')]);return db['MailServerOut'][_0xe57b('0x46')](_0x10e61b)[_0xe57b('0x25')](handleEntityNotFound(_0x3c3ca0,null))['then'](respondWithResult(_0x3c3ca0,null))[_0xe57b('0x47')](handleError(_0x3c3ca0,null));};exports[_0xe57b('0x48')]=function(_0xdb9181,_0x57e314){return db[_0xe57b('0x3f')][_0xe57b('0x48')](_0xdb9181[_0xe57b('0x49')],{})[_0xe57b('0x25')](respondWithResult(_0x57e314,0xc9))[_0xe57b('0x47')](handleError(_0x57e314,null));};exports[_0xe57b('0x4a')]=function(_0x3a6f1c,_0x19fac9){if(_0x3a6f1c[_0xe57b('0x49')]['id']){delete _0x3a6f1c[_0xe57b('0x49')]['id'];}return db[_0xe57b('0x3f')][_0xe57b('0x46')]({'where':{'id':_0x3a6f1c[_0xe57b('0x4b')]['id']}})[_0xe57b('0x25')](handleEntityNotFound(_0x19fac9,null))[_0xe57b('0x25')](saveUpdates(_0x3a6f1c[_0xe57b('0x49')],null))['then'](respondWithResult(_0x19fac9,null))[_0xe57b('0x47')](handleError(_0x19fac9,null));};exports[_0xe57b('0x26')]=function(_0x12be73,_0x428484){return db[_0xe57b('0x3f')]['find']({'where':{'id':_0x12be73['params']['id']}})['then'](handleEntityNotFound(_0x428484,null))[_0xe57b('0x25')](removeEntity(_0x428484,null))['catch'](handleError(_0x428484,null));}; \ No newline at end of file +var _0x48f1=['Content-Range','apply','reject','update','destroy','then','error','name','send','index','map','MailServerOut','fieldName','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','show','params','find','catch','create','body','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set'];(function(_0x16c9e6,_0x562403){var _0x3cb3f7=function(_0x3fadf8){while(--_0x3fadf8){_0x16c9e6['push'](_0x16c9e6['shift']());}};_0x3cb3f7(++_0x562403);}(_0x48f1,0x72));var _0x148f=function(_0x15771c,_0x1137e2){_0x15771c=_0x15771c-0x0;var _0x395924=_0x48f1[_0x15771c];return _0x395924;};'use strict';var emlformat=require(_0x148f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x148f('0x1'));var jsonpatch=require(_0x148f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x148f('0x3'));var Mustache=require(_0x148f('0x4'));var util=require(_0x148f('0x5'));var path=require(_0x148f('0x6'));var sox=require(_0x148f('0x7'));var csv=require(_0x148f('0x8'));var ejs=require(_0x148f('0x9'));var fs=require('fs');var fs_extra=require(_0x148f('0xa'));var _=require('lodash');var squel=require(_0x148f('0xb'));var crypto=require('crypto');var jsforce=require(_0x148f('0xc'));var deskjs=require(_0x148f('0xd'));var toCsv=require(_0x148f('0x8'));var querystring=require(_0x148f('0xe'));var Papa=require(_0x148f('0xf'));var Redis=require(_0x148f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x148f('0x11'));var as=require(_0x148f('0x12'));var hardwareService=require(_0x148f('0x13'));var logger=require('../../config/logger')(_0x148f('0x14'));var utils=require(_0x148f('0x15'));var config=require(_0x148f('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x148f('0x17'))['db'];function respondWithStatusCode(_0x4e251d,_0x269fa5){_0x269fa5=_0x269fa5||0xcc;return function(_0x8069de){if(_0x8069de){return _0x4e251d[_0x148f('0x18')](_0x269fa5);}return _0x4e251d[_0x148f('0x19')](_0x269fa5)[_0x148f('0x1a')]();};}function respondWithResult(_0x43a318,_0x1e8b38){_0x1e8b38=_0x1e8b38||0xc8;return function(_0x497a29){if(_0x497a29){return _0x43a318[_0x148f('0x19')](_0x1e8b38)[_0x148f('0x1b')](_0x497a29);}};}function respondWithFilteredResult(_0x5be8c9,_0x344f7a){return function(_0x12b145){if(_0x12b145){var _0x14fb3e=typeof _0x344f7a[_0x148f('0x1c')]===_0x148f('0x1d')&&typeof _0x344f7a['limit']===_0x148f('0x1d');var _0x1f3dcb=_0x12b145[_0x148f('0x1e')];var _0x3db5ca=_0x14fb3e?0x0:_0x344f7a[_0x148f('0x1c')];var _0x34c65d=_0x14fb3e?_0x12b145[_0x148f('0x1e')]:_0x344f7a[_0x148f('0x1c')]+_0x344f7a['limit'];var _0x1a5e84;if(_0x34c65d>=_0x1f3dcb){_0x34c65d=_0x1f3dcb;_0x1a5e84=0xc8;}else{_0x1a5e84=0xce;}_0x5be8c9['status'](_0x1a5e84);return _0x5be8c9[_0x148f('0x1f')](_0x148f('0x20'),_0x3db5ca+'-'+_0x34c65d+'/'+_0x1f3dcb)['json'](_0x12b145);}return null;};}function patchUpdates(_0x5373e3){return function(_0x152abe){try{jsonpatch[_0x148f('0x21')](_0x152abe,_0x5373e3,!![]);}catch(_0x12f250){return BPromise[_0x148f('0x22')](_0x12f250);}return _0x152abe['save']();};}function saveUpdates(_0x45eae2,_0x4c6d95){return function(_0x4ea5d6){if(_0x4ea5d6){return _0x4ea5d6[_0x148f('0x23')](_0x45eae2)['then'](function(_0x35d798){return _0x35d798;});}return null;};}function removeEntity(_0x5256f2,_0x5a6b7c){return function(_0x5d98ad){if(_0x5d98ad){return _0x5d98ad[_0x148f('0x24')]()[_0x148f('0x25')](function(){_0x5256f2[_0x148f('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3a9c96,_0x4c0fbe){return function(_0x2346c5){if(!_0x2346c5){_0x3a9c96[_0x148f('0x18')](0x194);}return _0x2346c5;};}function handleError(_0xf5f314,_0x1abff1){_0x1abff1=_0x1abff1||0x1f4;return function(_0x4de127){logger[_0x148f('0x26')](_0x4de127['stack']);if(_0x4de127[_0x148f('0x27')]){delete _0x4de127[_0x148f('0x27')];}_0xf5f314[_0x148f('0x19')](_0x1abff1)[_0x148f('0x28')](_0x4de127);};}exports[_0x148f('0x29')]=function(_0x17de5d,_0x2633ae){var _0x584bbd={},_0x5dd166={},_0x33b093={'count':0x0,'rows':[]};var _0xfc9a6b=_[_0x148f('0x2a')](db[_0x148f('0x2b')]['rawAttributes'],function(_0x8a7b75){return{'name':_0x8a7b75[_0x148f('0x2c')],'type':_0x8a7b75['type'][_0x148f('0x2d')]};});_0x5dd166['model']=_[_0x148f('0x2a')](_0xfc9a6b,_0x148f('0x27'));_0x5dd166[_0x148f('0x2e')]=_[_0x148f('0x2f')](_0x17de5d['query']);_0x5dd166[_0x148f('0x30')]=_[_0x148f('0x31')](_0x5dd166['model'],_0x5dd166[_0x148f('0x2e')]);_0x584bbd['attributes']=_[_0x148f('0x31')](_0x5dd166[_0x148f('0x32')],qs['fields'](_0x17de5d[_0x148f('0x2e')][_0x148f('0x33')]));_0x584bbd['attributes']=_0x584bbd[_0x148f('0x34')][_0x148f('0x35')]?_0x584bbd['attributes']:_0x5dd166[_0x148f('0x32')];if(!_0x17de5d[_0x148f('0x2e')][_0x148f('0x36')](_0x148f('0x37'))){_0x584bbd['limit']=qs[_0x148f('0x38')](_0x17de5d[_0x148f('0x2e')]['limit']);_0x584bbd[_0x148f('0x1c')]=qs[_0x148f('0x1c')](_0x17de5d[_0x148f('0x2e')]['offset']);}_0x584bbd['order']=qs[_0x148f('0x39')](_0x17de5d[_0x148f('0x2e')][_0x148f('0x39')]);_0x584bbd[_0x148f('0x3a')]=qs[_0x148f('0x30')](_[_0x148f('0x3b')](_0x17de5d[_0x148f('0x2e')],_0x5dd166[_0x148f('0x30')]),_0xfc9a6b);if(_0x17de5d[_0x148f('0x2e')][_0x148f('0x3c')]){_0x584bbd[_0x148f('0x3a')]=_[_0x148f('0x3d')](_0x584bbd[_0x148f('0x3a')],{'$or':_[_0x148f('0x2a')](_0xfc9a6b,function(_0x399246){if(_0x399246['type']!==_0x148f('0x3e')){var _0x4bc17e={};_0x4bc17e[_0x399246[_0x148f('0x27')]]={'$like':'%'+_0x17de5d[_0x148f('0x2e')][_0x148f('0x3c')]+'%'};return _0x4bc17e;}})});}_0x584bbd=_[_0x148f('0x3d')]({},_0x584bbd,_0x17de5d[_0x148f('0x3f')]);var _0xb3c534={'where':_0x584bbd[_0x148f('0x3a')]};return db[_0x148f('0x2b')][_0x148f('0x1e')](_0xb3c534)['then'](function(_0x33632d){_0x33b093[_0x148f('0x1e')]=_0x33632d;if(_0x17de5d['query'][_0x148f('0x40')]){_0x584bbd['include']=[{'all':!![]}];}return db[_0x148f('0x2b')][_0x148f('0x41')](_0x584bbd);})['then'](function(_0x185a86){_0x33b093[_0x148f('0x42')]=_0x185a86;return _0x33b093;})['then'](respondWithFilteredResult(_0x2633ae,_0x584bbd))['catch'](handleError(_0x2633ae,null));};exports[_0x148f('0x43')]=function(_0x201f4f,_0x59872d){var _0x5d4887={'raw':!![],'where':{'id':_0x201f4f[_0x148f('0x44')]['id']}},_0x5c17dd={};_0x5c17dd['model']=_[_0x148f('0x2f')](db[_0x148f('0x2b')]['rawAttributes']);_0x5c17dd[_0x148f('0x2e')]=_[_0x148f('0x2f')](_0x201f4f[_0x148f('0x2e')]);_0x5c17dd[_0x148f('0x30')]=_[_0x148f('0x31')](_0x5c17dd[_0x148f('0x32')],_0x5c17dd['query']);_0x5d4887[_0x148f('0x34')]=_[_0x148f('0x31')](_0x5c17dd[_0x148f('0x32')],qs[_0x148f('0x33')](_0x201f4f[_0x148f('0x2e')]['fields']));_0x5d4887[_0x148f('0x34')]=_0x5d4887[_0x148f('0x34')][_0x148f('0x35')]?_0x5d4887['attributes']:_0x5c17dd[_0x148f('0x32')];if(_0x201f4f['query'][_0x148f('0x40')]){_0x5d4887['include']=[{'all':!![]}];}_0x5d4887=_[_0x148f('0x3d')]({},_0x5d4887,_0x201f4f[_0x148f('0x3f')]);return db[_0x148f('0x2b')][_0x148f('0x45')](_0x5d4887)[_0x148f('0x25')](handleEntityNotFound(_0x59872d,null))[_0x148f('0x25')](respondWithResult(_0x59872d,null))[_0x148f('0x46')](handleError(_0x59872d,null));};exports['create']=function(_0x5a26d5,_0x333b62){return db[_0x148f('0x2b')][_0x148f('0x47')](_0x5a26d5['body'],{})['then'](respondWithResult(_0x333b62,0xc9))[_0x148f('0x46')](handleError(_0x333b62,null));};exports[_0x148f('0x23')]=function(_0x217bcc,_0x2cb521){if(_0x217bcc[_0x148f('0x48')]['id']){delete _0x217bcc[_0x148f('0x48')]['id'];}return db[_0x148f('0x2b')][_0x148f('0x45')]({'where':{'id':_0x217bcc[_0x148f('0x44')]['id']}})[_0x148f('0x25')](handleEntityNotFound(_0x2cb521,null))[_0x148f('0x25')](saveUpdates(_0x217bcc[_0x148f('0x48')],null))[_0x148f('0x25')](respondWithResult(_0x2cb521,null))[_0x148f('0x46')](handleError(_0x2cb521,null));};exports[_0x148f('0x24')]=function(_0x53c9d8,_0x48fc4d){return db[_0x148f('0x2b')][_0x148f('0x45')]({'where':{'id':_0x53c9d8[_0x148f('0x44')]['id']}})['then'](handleEntityNotFound(_0x48fc4d,null))[_0x148f('0x25')](removeEntity(_0x48fc4d,null))[_0x148f('0x46')](handleError(_0x48fc4d,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index c579995..c1197a9 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 _0x296d=['request-promise','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','moment'];(function(_0x1c5c8d,_0x298f71){var _0x34a831=function(_0x111fd1){while(--_0x111fd1){_0x1c5c8d['push'](_0x1c5c8d['shift']());}};_0x34a831(++_0x298f71);}(_0x296d,0x1cf));var _0xd296=function(_0x17784a,_0x42fe44){_0x17784a=_0x17784a-0x0;var _0x41aded=_0x296d[_0x17784a];return _0x41aded;};'use strict';var _=require(_0xd296('0x0'));var util=require(_0xd296('0x1'));var logger=require(_0xd296('0x2'))(_0xd296('0x3'));var moment=require(_0xd296('0x4'));var BPromise=require('bluebird');var rp=require(_0xd296('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd296('0x6'));var config=require(_0xd296('0x7'));var attributes=require(_0xd296('0x8'));module[_0xd296('0x9')]=function(_0x10e1c1,_0x1e8a4d){return _0x10e1c1[_0xd296('0xa')](_0xd296('0xb'),attributes,{'tableName':_0xd296('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5ad5=['lodash','util','api','bluebird','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out'];(function(_0x2e1db1,_0x963f33){var _0x2312d3=function(_0x5aece0){while(--_0x5aece0){_0x2e1db1['push'](_0x2e1db1['shift']());}};_0x2312d3(++_0x963f33);}(_0x5ad5,0xa5));var _0x55ad=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x5ad5[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x55ad('0x0'));var util=require(_0x55ad('0x1'));var logger=require('../../config/logger')(_0x55ad('0x2'));var moment=require('moment');var BPromise=require(_0x55ad('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x55ad('0x4'));var config=require(_0x55ad('0x5'));var attributes=require(_0x55ad('0x6'));module[_0x55ad('0x7')]=function(_0x2c1b27,_0x3f5df7){return _0x2c1b27[_0x55ad('0x8')](_0x55ad('0x9'),attributes,{'tableName':_0x55ad('0xa'),'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 2b24356..39e3a63 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 _0xdb28=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util'];(function(_0x236470,_0x29d279){var _0xf885b7=function(_0x392a3b){while(--_0x392a3b){_0x236470['push'](_0x236470['shift']());}};_0xf885b7(++_0x29d279);}(_0xdb28,0x106));var _0x8db2=function(_0x84a38a,_0x2f750a){_0x84a38a=_0x84a38a-0x0;var _0x58bf93=_0xdb28[_0x84a38a];return _0x58bf93;};'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')]('MailServerOut,\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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x1d0cc4,_0x51f97e){var _0x3a8204=function(_0x506396){while(--_0x506396){_0x1d0cc4['push'](_0x1d0cc4['shift']());}};_0x3a8204(++_0x51f97e);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc4aa[_0x1e4360];return _0x31e6b4;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 1807835..0bc0548 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 _0x6c01=['get','isAuthenticated','/describe','describe','/:id','show','post','create','destroy','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller'];(function(_0xcdff08,_0x17513a){var _0x1bb21b=function(_0x2bf3b0){while(--_0x2bf3b0){_0xcdff08['push'](_0xcdff08['shift']());}};_0x1bb21b(++_0x17513a);}(_0x6c01,0xa3));var _0x16c0=function(_0x5e347d,_0x2cc3fa){_0x5e347d=_0x5e347d-0x0;var _0x423647=_0x6c01[_0x5e347d];return _0x423647;};'use strict';var multer=require(_0x16c0('0x0'));var util=require(_0x16c0('0x1'));var path=require('path');var timeout=require(_0x16c0('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x16c0('0x3'));var interaction=require(_0x16c0('0x4'));var config=require(_0x16c0('0x5'));var controller=require(_0x16c0('0x6'));router[_0x16c0('0x7')]('/',auth[_0x16c0('0x8')](),controller['index']);router[_0x16c0('0x7')](_0x16c0('0x9'),auth[_0x16c0('0x8')](),controller[_0x16c0('0xa')]);router[_0x16c0('0x7')](_0x16c0('0xb'),auth['isAuthenticated'](),controller[_0x16c0('0xc')]);router[_0x16c0('0xd')]('/',auth[_0x16c0('0x8')](),controller[_0x16c0('0xe')]);router['put'](_0x16c0('0xb'),auth[_0x16c0('0x8')](),controller['update']);router['delete'](_0x16c0('0xb'),auth['isAuthenticated'](),controller[_0x16c0('0xf')]);module[_0x16c0('0x10')]=router; \ No newline at end of file +var _0xc72b=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x4ac1c6,_0x367224){var _0x141211=function(_0x116444){while(--_0x116444){_0x4ac1c6['push'](_0x4ac1c6['shift']());}};_0x141211(++_0x367224);}(_0xc72b,0x111));var _0xbc72=function(_0x3b7a0c,_0xf1a4c2){_0x3b7a0c=_0x3b7a0c-0x0;var _0x3bb70f=_0xc72b[_0x3b7a0c];return _0x3bb70f;};'use strict';var multer=require(_0xbc72('0x0'));var util=require(_0xbc72('0x1'));var path=require('path');var timeout=require(_0xbc72('0x2'));var express=require(_0xbc72('0x3'));var router=express[_0xbc72('0x4')]();var fs_extra=require(_0xbc72('0x5'));var auth=require(_0xbc72('0x6'));var interaction=require(_0xbc72('0x7'));var config=require('../../config/environment');var controller=require(_0xbc72('0x8'));router[_0xbc72('0x9')]('/',auth[_0xbc72('0xa')](),controller[_0xbc72('0xb')]);router['get'](_0xbc72('0xc'),auth[_0xbc72('0xa')](),controller[_0xbc72('0xd')]);router[_0xbc72('0x9')](_0xbc72('0xe'),auth[_0xbc72('0xa')](),controller[_0xbc72('0xf')]);router[_0xbc72('0x10')]('/',auth[_0xbc72('0xa')](),controller[_0xbc72('0x11')]);router[_0xbc72('0x12')](_0xbc72('0xe'),auth[_0xbc72('0xa')](),controller[_0xbc72('0x13')]);router[_0xbc72('0x14')]('/:id',auth[_0xbc72('0xa')](),controller[_0xbc72('0x15')]);module[_0xbc72('0x16')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 25befed..5eb58bb 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 _0x0e4b=['STRING','sequelize','exports'];(function(_0x235f49,_0x2992b4){var _0x551139=function(_0x35565c){while(--_0x35565c){_0x235f49['push'](_0x235f49['shift']());}};_0x551139(++_0x2992b4);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x5a516a,_0x541200){_0x5a516a=_0x5a516a-0x0;var _0x38c0d9=_0x0e4b[_0x5a516a];return _0x38c0d9;};'use strict';var Sequelize=require(_0xb0e4('0x0'));module[_0xb0e4('0x1')]={'name':{'type':Sequelize[_0xb0e4('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb0e4('0x2')]}}; \ No newline at end of file +var _0x6c45=['STRING','sequelize','exports','name'];(function(_0x45f6fd,_0x2620b9){var _0x328b60=function(_0x1d06ce){while(--_0x1d06ce){_0x45f6fd['push'](_0x45f6fd['shift']());}};_0x328b60(++_0x2620b9);}(_0x6c45,0xb1));var _0x56c4=function(_0x58b524,_0xdb96d7){_0x58b524=_0x58b524-0x0;var _0x305d75=_0x6c45[_0x58b524];return _0x305d75;};'use strict';var Sequelize=require(_0x56c4('0x0'));module[_0x56c4('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x56c4('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x56c4('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index c763c30..accd6e6 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 _0xf9d3=['path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','MailSubstatus','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util'];(function(_0x787995,_0x5dbdc7){var _0x4a75d6=function(_0x39a7e3){while(--_0x39a7e3){_0x787995['push'](_0x787995['shift']());}};_0x4a75d6(++_0x5dbdc7);}(_0xf9d3,0x1bf));var _0x3f9d=function(_0x29c76b,_0x4a6a17){_0x29c76b=_0x29c76b-0x0;var _0x6cda21=_0xf9d3[_0x29c76b];return _0x6cda21;};'use strict';var emlformat=require(_0x3f9d('0x0'));var rimraf=require(_0x3f9d('0x1'));var zipdir=require(_0x3f9d('0x2'));var jsonpatch=require(_0x3f9d('0x3'));var rp=require(_0x3f9d('0x4'));var moment=require(_0x3f9d('0x5'));var BPromise=require(_0x3f9d('0x6'));var Mustache=require(_0x3f9d('0x7'));var util=require(_0x3f9d('0x8'));var path=require(_0x3f9d('0x9'));var sox=require(_0x3f9d('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3f9d('0xb'));var _=require(_0x3f9d('0xc'));var squel=require('squel');var crypto=require(_0x3f9d('0xd'));var jsforce=require(_0x3f9d('0xe'));var deskjs=require(_0x3f9d('0xf'));var toCsv=require(_0x3f9d('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x3f9d('0x11'));var authService=require(_0x3f9d('0x12'));var qs=require(_0x3f9d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3f9d('0x14'))(_0x3f9d('0x15'));var utils=require(_0x3f9d('0x16'));var config=require(_0x3f9d('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x3f9d('0x18'))['db'];function respondWithStatusCode(_0x2c8aa0,_0xdc35ba){_0xdc35ba=_0xdc35ba||0xcc;return function(_0x1f89cf){if(_0x1f89cf){return _0x2c8aa0[_0x3f9d('0x19')](_0xdc35ba);}return _0x2c8aa0['status'](_0xdc35ba)[_0x3f9d('0x1a')]();};}function respondWithResult(_0x139f36,_0x2a93c9){_0x2a93c9=_0x2a93c9||0xc8;return function(_0xa0d345){if(_0xa0d345){return _0x139f36[_0x3f9d('0x1b')](_0x2a93c9)[_0x3f9d('0x1c')](_0xa0d345);}};}function respondWithFilteredResult(_0x51ac23,_0x57e169){return function(_0x5a58bb){if(_0x5a58bb){var _0x17138c=typeof _0x57e169[_0x3f9d('0x1d')]===_0x3f9d('0x1e')&&typeof _0x57e169['limit']==='undefined';var _0x47159f=_0x5a58bb[_0x3f9d('0x1f')];var _0x2d669c=_0x17138c?0x0:_0x57e169[_0x3f9d('0x1d')];var _0x55aabc=_0x17138c?_0x5a58bb[_0x3f9d('0x1f')]:_0x57e169['offset']+_0x57e169[_0x3f9d('0x20')];var _0x2f9609;if(_0x55aabc>=_0x47159f){_0x55aabc=_0x47159f;_0x2f9609=0xc8;}else{_0x2f9609=0xce;}_0x51ac23[_0x3f9d('0x1b')](_0x2f9609);return _0x51ac23[_0x3f9d('0x21')](_0x3f9d('0x22'),_0x2d669c+'-'+_0x55aabc+'/'+_0x47159f)[_0x3f9d('0x1c')](_0x5a58bb);}return null;};}function patchUpdates(_0x43789e){return function(_0x42e9d4){try{jsonpatch[_0x3f9d('0x23')](_0x42e9d4,_0x43789e,!![]);}catch(_0x489429){return BPromise[_0x3f9d('0x24')](_0x489429);}return _0x42e9d4[_0x3f9d('0x25')]();};}function saveUpdates(_0x547f9f,_0x418b91){return function(_0x4c42b1){if(_0x4c42b1){return _0x4c42b1[_0x3f9d('0x26')](_0x547f9f)[_0x3f9d('0x27')](function(_0x5aac45){return _0x5aac45;});}return null;};}function removeEntity(_0x3ec3ad,_0x532c1a){return function(_0x950f27){if(_0x950f27){return _0x950f27[_0x3f9d('0x28')]()[_0x3f9d('0x27')](function(){_0x3ec3ad[_0x3f9d('0x1b')](0xcc)[_0x3f9d('0x1a')]();});}};}function handleEntityNotFound(_0xa34b69,_0x56c68a){return function(_0x2b8d8b){if(!_0x2b8d8b){_0xa34b69[_0x3f9d('0x19')](0x194);}return _0x2b8d8b;};}function handleError(_0xb5d0a8,_0x3d46b0){_0x3d46b0=_0x3d46b0||0x1f4;return function(_0x5a0a2d){logger['error'](_0x5a0a2d[_0x3f9d('0x29')]);if(_0x5a0a2d[_0x3f9d('0x2a')]){delete _0x5a0a2d[_0x3f9d('0x2a')];}_0xb5d0a8[_0x3f9d('0x1b')](_0x3d46b0)['send'](_0x5a0a2d);};}exports[_0x3f9d('0x2b')]=function(_0x217a29,_0x1b4bfd){var _0x5001b6={},_0x4a5b7b={},_0x43641e={'count':0x0,'rows':[]};var _0x636e9a=_[_0x3f9d('0x2c')](db[_0x3f9d('0x2d')][_0x3f9d('0x2e')],function(_0x6e4fd1){return{'name':_0x6e4fd1[_0x3f9d('0x2f')],'type':_0x6e4fd1[_0x3f9d('0x30')]['key']};});_0x4a5b7b['model']=_[_0x3f9d('0x2c')](_0x636e9a,'name');_0x4a5b7b[_0x3f9d('0x31')]=_[_0x3f9d('0x32')](_0x217a29[_0x3f9d('0x31')]);_0x4a5b7b[_0x3f9d('0x33')]=_[_0x3f9d('0x34')](_0x4a5b7b[_0x3f9d('0x35')],_0x4a5b7b[_0x3f9d('0x31')]);_0x5001b6[_0x3f9d('0x36')]=_[_0x3f9d('0x34')](_0x4a5b7b[_0x3f9d('0x35')],qs['fields'](_0x217a29[_0x3f9d('0x31')][_0x3f9d('0x37')]));_0x5001b6['attributes']=_0x5001b6[_0x3f9d('0x36')][_0x3f9d('0x38')]?_0x5001b6[_0x3f9d('0x36')]:_0x4a5b7b[_0x3f9d('0x35')];if(!_0x217a29[_0x3f9d('0x31')][_0x3f9d('0x39')](_0x3f9d('0x3a'))){_0x5001b6['limit']=qs['limit'](_0x217a29[_0x3f9d('0x31')][_0x3f9d('0x20')]);_0x5001b6[_0x3f9d('0x1d')]=qs[_0x3f9d('0x1d')](_0x217a29[_0x3f9d('0x31')][_0x3f9d('0x1d')]);}_0x5001b6[_0x3f9d('0x3b')]=qs[_0x3f9d('0x3c')](_0x217a29[_0x3f9d('0x31')][_0x3f9d('0x3c')]);_0x5001b6['where']=qs['filters'](_[_0x3f9d('0x3d')](_0x217a29[_0x3f9d('0x31')],_0x4a5b7b[_0x3f9d('0x33')]),_0x636e9a);if(_0x217a29['query'][_0x3f9d('0x3e')]){_0x5001b6['where']=_['merge'](_0x5001b6[_0x3f9d('0x3f')],{'$or':_[_0x3f9d('0x2c')](_0x636e9a,function(_0x403aaa){if(_0x403aaa[_0x3f9d('0x30')]!=='VIRTUAL'){var _0x1215b3={};_0x1215b3[_0x403aaa[_0x3f9d('0x2a')]]={'$like':'%'+_0x217a29[_0x3f9d('0x31')][_0x3f9d('0x3e')]+'%'};return _0x1215b3;}})});}_0x5001b6=_[_0x3f9d('0x40')]({},_0x5001b6,_0x217a29[_0x3f9d('0x41')]);var _0xa2d0a1={'where':_0x5001b6[_0x3f9d('0x3f')]};return db[_0x3f9d('0x2d')][_0x3f9d('0x1f')](_0xa2d0a1)[_0x3f9d('0x27')](function(_0x4460d8){_0x43641e['count']=_0x4460d8;if(_0x217a29[_0x3f9d('0x31')]['includeAll']){_0x5001b6[_0x3f9d('0x42')]=[{'all':!![]}];}return db[_0x3f9d('0x2d')][_0x3f9d('0x43')](_0x5001b6);})[_0x3f9d('0x27')](function(_0x50e914){_0x43641e[_0x3f9d('0x44')]=_0x50e914;return _0x43641e;})[_0x3f9d('0x27')](respondWithFilteredResult(_0x1b4bfd,_0x5001b6))[_0x3f9d('0x45')](handleError(_0x1b4bfd,null));};exports[_0x3f9d('0x46')]=function(_0xb5bb04,_0x597d36){var _0x5e96ad={'raw':!![],'where':{'id':_0xb5bb04[_0x3f9d('0x47')]['id']}},_0x1a888d={};_0x1a888d[_0x3f9d('0x35')]=_[_0x3f9d('0x32')](db[_0x3f9d('0x2d')]['rawAttributes']);_0x1a888d[_0x3f9d('0x31')]=_[_0x3f9d('0x32')](_0xb5bb04[_0x3f9d('0x31')]);_0x1a888d[_0x3f9d('0x33')]=_[_0x3f9d('0x34')](_0x1a888d[_0x3f9d('0x35')],_0x1a888d['query']);_0x5e96ad['attributes']=_[_0x3f9d('0x34')](_0x1a888d[_0x3f9d('0x35')],qs[_0x3f9d('0x37')](_0xb5bb04[_0x3f9d('0x31')]['fields']));_0x5e96ad[_0x3f9d('0x36')]=_0x5e96ad['attributes'][_0x3f9d('0x38')]?_0x5e96ad['attributes']:_0x1a888d['model'];if(_0xb5bb04[_0x3f9d('0x31')]['includeAll']){_0x5e96ad[_0x3f9d('0x42')]=[{'all':!![]}];}_0x5e96ad=_[_0x3f9d('0x40')]({},_0x5e96ad,_0xb5bb04['options']);return db[_0x3f9d('0x2d')][_0x3f9d('0x48')](_0x5e96ad)[_0x3f9d('0x27')](handleEntityNotFound(_0x597d36,null))[_0x3f9d('0x27')](respondWithResult(_0x597d36,null))[_0x3f9d('0x45')](handleError(_0x597d36,null));};exports['create']=function(_0x320343,_0x29b7cb){return db[_0x3f9d('0x2d')][_0x3f9d('0x49')](_0x320343[_0x3f9d('0x4a')],{})[_0x3f9d('0x27')](respondWithResult(_0x29b7cb,0xc9))['catch'](handleError(_0x29b7cb,null));};exports[_0x3f9d('0x26')]=function(_0x42d3a2,_0x207ac1){if(_0x42d3a2['body']['id']){delete _0x42d3a2[_0x3f9d('0x4a')]['id'];}return db[_0x3f9d('0x2d')][_0x3f9d('0x48')]({'where':{'id':_0x42d3a2[_0x3f9d('0x47')]['id']}})[_0x3f9d('0x27')](handleEntityNotFound(_0x207ac1,null))['then'](saveUpdates(_0x42d3a2[_0x3f9d('0x4a')],null))[_0x3f9d('0x27')](respondWithResult(_0x207ac1,null))['catch'](handleError(_0x207ac1,null));};exports[_0x3f9d('0x28')]=function(_0x193d04,_0x5e878c){return db[_0x3f9d('0x2d')][_0x3f9d('0x48')]({'where':{'id':_0x193d04[_0x3f9d('0x47')]['id']}})[_0x3f9d('0x27')](handleEntityNotFound(_0x5e878c,null))[_0x3f9d('0x27')](removeEntity(_0x5e878c,null))[_0x3f9d('0x45')](handleError(_0x5e878c,null));};exports[_0x3f9d('0x4b')]=function(_0x26cb49,_0x5bc035){return db[_0x3f9d('0x2d')][_0x3f9d('0x4b')]()['then'](respondWithResult(_0x5bc035,null))[_0x3f9d('0x45')](handleError(_0x5bc035,null));}; \ No newline at end of file +var _0xc7d6=['util','path','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','../../config/logger','api','../../config/utils','sendStatus','end','status','json','offset','undefined','count','limit','apply','save','update','then','destroy','error','stack','name','send','index','map','MailSubstatus','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x485b5a,_0x2b289b){var _0xd2b34d=function(_0x34dcbd){while(--_0x34dcbd){_0x485b5a['push'](_0x485b5a['shift']());}};_0xd2b34d(++_0x2b289b);}(_0xc7d6,0x131));var _0x6c7d=function(_0x16eafb,_0x3ef74c){_0x16eafb=_0x16eafb-0x0;var _0x3ed035=_0xc7d6[_0x16eafb];return _0x3ed035;};'use strict';var emlformat=require(_0x6c7d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6c7d('0x1'));var jsonpatch=require(_0x6c7d('0x2'));var rp=require(_0x6c7d('0x3'));var moment=require(_0x6c7d('0x4'));var BPromise=require(_0x6c7d('0x5'));var Mustache=require(_0x6c7d('0x6'));var util=require(_0x6c7d('0x7'));var path=require(_0x6c7d('0x8'));var sox=require(_0x6c7d('0x9'));var csv=require(_0x6c7d('0xa'));var ejs=require(_0x6c7d('0xb'));var fs=require('fs');var fs_extra=require(_0x6c7d('0xc'));var _=require(_0x6c7d('0xd'));var squel=require(_0x6c7d('0xe'));var crypto=require('crypto');var jsforce=require(_0x6c7d('0xf'));var deskjs=require(_0x6c7d('0x10'));var toCsv=require('to-csv');var querystring=require(_0x6c7d('0x11'));var Papa=require(_0x6c7d('0x12'));var Redis=require(_0x6c7d('0x13'));var authService=require(_0x6c7d('0x14'));var qs=require(_0x6c7d('0x15'));var as=require(_0x6c7d('0x16'));var hardwareService=require(_0x6c7d('0x17'));var logger=require(_0x6c7d('0x18'))(_0x6c7d('0x19'));var utils=require(_0x6c7d('0x1a'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4691bd,_0x3013ee){_0x3013ee=_0x3013ee||0xcc;return function(_0x23cdb3){if(_0x23cdb3){return _0x4691bd[_0x6c7d('0x1b')](_0x3013ee);}return _0x4691bd['status'](_0x3013ee)[_0x6c7d('0x1c')]();};}function respondWithResult(_0x5edba3,_0x9728e4){_0x9728e4=_0x9728e4||0xc8;return function(_0x247986){if(_0x247986){return _0x5edba3[_0x6c7d('0x1d')](_0x9728e4)[_0x6c7d('0x1e')](_0x247986);}};}function respondWithFilteredResult(_0x3dc797,_0x331063){return function(_0x2e5ab6){if(_0x2e5ab6){var _0x534591=typeof _0x331063[_0x6c7d('0x1f')]===_0x6c7d('0x20')&&typeof _0x331063['limit']===_0x6c7d('0x20');var _0x15b40a=_0x2e5ab6[_0x6c7d('0x21')];var _0x318924=_0x534591?0x0:_0x331063[_0x6c7d('0x1f')];var _0x1d2f28=_0x534591?_0x2e5ab6['count']:_0x331063['offset']+_0x331063[_0x6c7d('0x22')];var _0x2f89d7;if(_0x1d2f28>=_0x15b40a){_0x1d2f28=_0x15b40a;_0x2f89d7=0xc8;}else{_0x2f89d7=0xce;}_0x3dc797[_0x6c7d('0x1d')](_0x2f89d7);return _0x3dc797['set']('Content-Range',_0x318924+'-'+_0x1d2f28+'/'+_0x15b40a)['json'](_0x2e5ab6);}return null;};}function patchUpdates(_0xf51bf9){return function(_0x538fea){try{jsonpatch[_0x6c7d('0x23')](_0x538fea,_0xf51bf9,!![]);}catch(_0x3119ae){return BPromise['reject'](_0x3119ae);}return _0x538fea[_0x6c7d('0x24')]();};}function saveUpdates(_0x51793b,_0x1f3219){return function(_0x5a8c06){if(_0x5a8c06){return _0x5a8c06[_0x6c7d('0x25')](_0x51793b)[_0x6c7d('0x26')](function(_0x481724){return _0x481724;});}return null;};}function removeEntity(_0x50010d,_0x1e8c75){return function(_0x3d110b){if(_0x3d110b){return _0x3d110b[_0x6c7d('0x27')]()[_0x6c7d('0x26')](function(){_0x50010d[_0x6c7d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27a474,_0x3fa6a9){return function(_0x5681e6){if(!_0x5681e6){_0x27a474[_0x6c7d('0x1b')](0x194);}return _0x5681e6;};}function handleError(_0x51f521,_0x1e1d71){_0x1e1d71=_0x1e1d71||0x1f4;return function(_0x22fa1c){logger[_0x6c7d('0x28')](_0x22fa1c[_0x6c7d('0x29')]);if(_0x22fa1c[_0x6c7d('0x2a')]){delete _0x22fa1c['name'];}_0x51f521[_0x6c7d('0x1d')](_0x1e1d71)[_0x6c7d('0x2b')](_0x22fa1c);};}exports[_0x6c7d('0x2c')]=function(_0x3a1107,_0x4a4337){var _0x2540e1={},_0x549bb3={},_0x225b77={'count':0x0,'rows':[]};var _0x571c23=_[_0x6c7d('0x2d')](db[_0x6c7d('0x2e')][_0x6c7d('0x2f')],function(_0x864c22){return{'name':_0x864c22[_0x6c7d('0x30')],'type':_0x864c22[_0x6c7d('0x31')]['key']};});_0x549bb3[_0x6c7d('0x32')]=_['map'](_0x571c23,'name');_0x549bb3[_0x6c7d('0x33')]=_[_0x6c7d('0x34')](_0x3a1107[_0x6c7d('0x33')]);_0x549bb3[_0x6c7d('0x35')]=_['intersection'](_0x549bb3[_0x6c7d('0x32')],_0x549bb3[_0x6c7d('0x33')]);_0x2540e1[_0x6c7d('0x36')]=_[_0x6c7d('0x37')](_0x549bb3[_0x6c7d('0x32')],qs[_0x6c7d('0x38')](_0x3a1107[_0x6c7d('0x33')][_0x6c7d('0x38')]));_0x2540e1[_0x6c7d('0x36')]=_0x2540e1['attributes'][_0x6c7d('0x39')]?_0x2540e1[_0x6c7d('0x36')]:_0x549bb3['model'];if(!_0x3a1107[_0x6c7d('0x33')][_0x6c7d('0x3a')](_0x6c7d('0x3b'))){_0x2540e1[_0x6c7d('0x22')]=qs[_0x6c7d('0x22')](_0x3a1107[_0x6c7d('0x33')]['limit']);_0x2540e1[_0x6c7d('0x1f')]=qs[_0x6c7d('0x1f')](_0x3a1107[_0x6c7d('0x33')][_0x6c7d('0x1f')]);}_0x2540e1[_0x6c7d('0x3c')]=qs[_0x6c7d('0x3d')](_0x3a1107[_0x6c7d('0x33')][_0x6c7d('0x3d')]);_0x2540e1[_0x6c7d('0x3e')]=qs[_0x6c7d('0x35')](_['pick'](_0x3a1107['query'],_0x549bb3[_0x6c7d('0x35')]),_0x571c23);if(_0x3a1107[_0x6c7d('0x33')][_0x6c7d('0x3f')]){_0x2540e1[_0x6c7d('0x3e')]=_[_0x6c7d('0x40')](_0x2540e1['where'],{'$or':_['map'](_0x571c23,function(_0x2e0096){if(_0x2e0096[_0x6c7d('0x31')]!==_0x6c7d('0x41')){var _0x1b3966={};_0x1b3966[_0x2e0096[_0x6c7d('0x2a')]]={'$like':'%'+_0x3a1107[_0x6c7d('0x33')][_0x6c7d('0x3f')]+'%'};return _0x1b3966;}})});}_0x2540e1=_[_0x6c7d('0x40')]({},_0x2540e1,_0x3a1107[_0x6c7d('0x42')]);var _0x2fc2ed={'where':_0x2540e1[_0x6c7d('0x3e')]};return db[_0x6c7d('0x2e')][_0x6c7d('0x21')](_0x2fc2ed)['then'](function(_0x423902){_0x225b77[_0x6c7d('0x21')]=_0x423902;if(_0x3a1107[_0x6c7d('0x33')][_0x6c7d('0x43')]){_0x2540e1[_0x6c7d('0x44')]=[{'all':!![]}];}return db[_0x6c7d('0x2e')][_0x6c7d('0x45')](_0x2540e1);})[_0x6c7d('0x26')](function(_0x30f087){_0x225b77[_0x6c7d('0x46')]=_0x30f087;return _0x225b77;})[_0x6c7d('0x26')](respondWithFilteredResult(_0x4a4337,_0x2540e1))[_0x6c7d('0x47')](handleError(_0x4a4337,null));};exports[_0x6c7d('0x48')]=function(_0x2b0cbb,_0x34d591){var _0x4eda5b={'raw':!![],'where':{'id':_0x2b0cbb[_0x6c7d('0x49')]['id']}},_0x138d2b={};_0x138d2b[_0x6c7d('0x32')]=_[_0x6c7d('0x34')](db[_0x6c7d('0x2e')][_0x6c7d('0x2f')]);_0x138d2b['query']=_[_0x6c7d('0x34')](_0x2b0cbb[_0x6c7d('0x33')]);_0x138d2b[_0x6c7d('0x35')]=_[_0x6c7d('0x37')](_0x138d2b[_0x6c7d('0x32')],_0x138d2b[_0x6c7d('0x33')]);_0x4eda5b['attributes']=_[_0x6c7d('0x37')](_0x138d2b[_0x6c7d('0x32')],qs[_0x6c7d('0x38')](_0x2b0cbb[_0x6c7d('0x33')]['fields']));_0x4eda5b[_0x6c7d('0x36')]=_0x4eda5b[_0x6c7d('0x36')][_0x6c7d('0x39')]?_0x4eda5b[_0x6c7d('0x36')]:_0x138d2b[_0x6c7d('0x32')];if(_0x2b0cbb[_0x6c7d('0x33')][_0x6c7d('0x43')]){_0x4eda5b['include']=[{'all':!![]}];}_0x4eda5b=_[_0x6c7d('0x40')]({},_0x4eda5b,_0x2b0cbb['options']);return db[_0x6c7d('0x2e')]['find'](_0x4eda5b)['then'](handleEntityNotFound(_0x34d591,null))[_0x6c7d('0x26')](respondWithResult(_0x34d591,null))[_0x6c7d('0x47')](handleError(_0x34d591,null));};exports[_0x6c7d('0x4a')]=function(_0x37d6dd,_0x5138ac){return db[_0x6c7d('0x2e')][_0x6c7d('0x4a')](_0x37d6dd[_0x6c7d('0x4b')],{})[_0x6c7d('0x26')](respondWithResult(_0x5138ac,0xc9))[_0x6c7d('0x47')](handleError(_0x5138ac,null));};exports['update']=function(_0x559992,_0x15d075){if(_0x559992[_0x6c7d('0x4b')]['id']){delete _0x559992[_0x6c7d('0x4b')]['id'];}return db['MailSubstatus'][_0x6c7d('0x4c')]({'where':{'id':_0x559992['params']['id']}})['then'](handleEntityNotFound(_0x15d075,null))[_0x6c7d('0x26')](saveUpdates(_0x559992[_0x6c7d('0x4b')],null))[_0x6c7d('0x26')](respondWithResult(_0x15d075,null))[_0x6c7d('0x47')](handleError(_0x15d075,null));};exports['destroy']=function(_0x61a725,_0x2aabd7){return db[_0x6c7d('0x2e')][_0x6c7d('0x4c')]({'where':{'id':_0x61a725[_0x6c7d('0x49')]['id']}})['then'](handleEntityNotFound(_0x2aabd7,null))['then'](removeEntity(_0x2aabd7,null))[_0x6c7d('0x47')](handleError(_0x2aabd7,null));};exports['describe']=function(_0x1f3c75,_0x3a998b){return db[_0x6c7d('0x2e')][_0x6c7d('0x4d')]()[_0x6c7d('0x26')](respondWithResult(_0x3a998b,null))['catch'](handleError(_0x3a998b,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 7bfc7c2..44c9358 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 _0xbf79=['hook','events','../../mysqldb','MailSubstatus','setMaxListeners','update','emit','hasOwnProperty'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0xbf79,0x1d1));var _0x9bf7=function(_0x7ee85f,_0x1a7be0){_0x7ee85f=_0x7ee85f-0x0;var _0x243ce1=_0xbf79[_0x7ee85f];return _0x243ce1;};'use strict';var EventEmitter=require(_0x9bf7('0x0'));var MailSubstatus=require(_0x9bf7('0x1'))['db'][_0x9bf7('0x2')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x9bf7('0x3')](0x0);var events={'afterUpdate':_0x9bf7('0x4')};function emitEvent(_0x521aab){return function(_0x13cc1c,_0x1350b2,_0x286ef8){MailSubstatusEvents[_0x9bf7('0x5')](_0x521aab+':'+_0x13cc1c['id'],_0x13cc1c);MailSubstatusEvents[_0x9bf7('0x5')](_0x521aab,_0x13cc1c);_0x286ef8(null);};}for(var e in events){if(events[_0x9bf7('0x6')](e)){var event=events[e];MailSubstatus[_0x9bf7('0x7')](e,emitEvent(event));}}module['exports']=MailSubstatusEvents; \ No newline at end of file +var _0x9735=['hasOwnProperty','exports','../../mysqldb','MailSubstatus','update','emit'];(function(_0x173fd1,_0x28db53){var _0x36a3d1=function(_0x2f72a4){while(--_0x2f72a4){_0x173fd1['push'](_0x173fd1['shift']());}};_0x36a3d1(++_0x28db53);}(_0x9735,0xc2));var _0x5973=function(_0x22e62f,_0x4c811a){_0x22e62f=_0x22e62f-0x0;var _0x2fef10=_0x9735[_0x22e62f];return _0x2fef10;};'use strict';var EventEmitter=require('events');var MailSubstatus=require(_0x5973('0x0'))['db'][_0x5973('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents['setMaxListeners'](0x0);var events={'afterUpdate':_0x5973('0x2')};function emitEvent(_0x57dcae){return function(_0x5c8ac8,_0x4126fa,_0x15006c){MailSubstatusEvents[_0x5973('0x3')](_0x57dcae+':'+_0x5c8ac8['id'],_0x5c8ac8);MailSubstatusEvents[_0x5973('0x3')](_0x57dcae,_0x5c8ac8);_0x15006c(null);};}for(var e in events){if(events[_0x5973('0x4')](e)){var event=events[e];MailSubstatus['hook'](e,emitEvent(event));}}module[_0x5973('0x5')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index c0a337b..345a44d 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 _0xc397=['_previousDataValues','name','then','catch','exports','models','define','MailSubstatus','Condition','update'];(function(_0x23bfd7,_0x289f3f){var _0x2631a1=function(_0x3c6d14){while(--_0x3c6d14){_0x23bfd7['push'](_0x23bfd7['shift']());}};_0x2631a1(++_0x289f3f);}(_0xc397,0x18a));var _0x7c39=function(_0x1f7c6d,_0x4faefb){_0x1f7c6d=_0x1f7c6d-0x0;var _0x564949=_0xc397[_0x1f7c6d];return _0x564949;};'use strict';var attributes=require('./mailSubstatus.attributes');module[_0x7c39('0x0')]=function(_0x406984){var _0x1e7508=_0x406984[_0x7c39('0x1')];return _0x406984[_0x7c39('0x2')](_0x7c39('0x3'),attributes,{'tableName':'mail_substatuses','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x576cb8,_0x88ae5b,_0x5cdebc){return _0x1e7508[_0x7c39('0x4')][_0x7c39('0x5')]({'value':_0x576cb8['name']},{'where':{'field':'mailSubstatus','value':_0x576cb8[_0x7c39('0x6')][_0x7c39('0x7')]}})[_0x7c39('0x8')](function(){_0x5cdebc();})[_0x7c39('0x9')](function(_0x5958d7){_0x5cdebc(_0x5958d7);});}}});}; \ No newline at end of file +var _0x9b67=['Condition','name','mailSubstatus','then','catch','./mailSubstatus.attributes','define','mail_substatuses'];(function(_0x4850af,_0x57348f){var _0x4b046d=function(_0x39009b){while(--_0x39009b){_0x4850af['push'](_0x4850af['shift']());}};_0x4b046d(++_0x57348f);}(_0x9b67,0xed));var _0x79b6=function(_0x2935fa,_0x2eef2b){_0x2935fa=_0x2935fa-0x0;var _0x283aff=_0x9b67[_0x2935fa];return _0x283aff;};'use strict';var attributes=require(_0x79b6('0x0'));module['exports']=function(_0x23503c){var _0x336ad8=_0x23503c['models'];return _0x23503c[_0x79b6('0x1')]('MailSubstatus',attributes,{'tableName':_0x79b6('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4f4e39,_0x4ca068,_0x2bee45){return _0x336ad8[_0x79b6('0x3')]['update']({'value':_0x4f4e39[_0x79b6('0x4')]},{'where':{'field':_0x79b6('0x5'),'value':_0x4f4e39['_previousDataValues'][_0x79b6('0x4')]}})[_0x79b6('0x6')](function(){_0x2bee45();})[_0x79b6('0x7')](function(_0x312585){_0x2bee45(_0x312585);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index d4c3fd3..89b426a 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 _0x1a14=['request','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x172692,_0x34dea2){var _0x4632f4=function(_0xd41a47){while(--_0xd41a47){_0x172692['push'](_0x172692['shift']());}};_0x4632f4(++_0x34dea2);}(_0x1a14,0x88));var _0x41a1=function(_0x5af293,_0x535fbb){_0x5af293=_0x5af293-0x0;var _0x482c50=_0x1a14[_0x5af293];return _0x482c50;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x41a1('0x0'));var BPromise=require(_0x41a1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x41a1('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x41a1('0x3'));var logger=require('../../config/logger')(_0x41a1('0x4'));var config=require(_0x41a1('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x41a1('0x6')][_0x41a1('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2c10bd,_0x2bfead,_0x3fd9ef){return new BPromise(function(_0x9a2c70,_0x3b0e85){return client[_0x41a1('0x8')](_0x2c10bd,_0x3fd9ef)['then'](function(_0x3f7ec1){logger['info'](_0x41a1('0x9'),_0x2bfead,_0x41a1('0xa'));logger[_0x41a1('0xb')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x2bfead,_0x41a1('0xa'),JSON['stringify'](_0x3f7ec1));if(_0x3f7ec1[_0x41a1('0xc')]){if(_0x3f7ec1['error'][_0x41a1('0xd')]===0x1f4){logger[_0x41a1('0xc')](_0x41a1('0x9'),_0x2bfead,_0x3f7ec1[_0x41a1('0xc')][_0x41a1('0xe')]);return _0x3b0e85(_0x3f7ec1[_0x41a1('0xc')][_0x41a1('0xe')]);}logger[_0x41a1('0xc')]('MailSubstatus,\x20%s,\x20%s',_0x2bfead,_0x3f7ec1[_0x41a1('0xc')][_0x41a1('0xe')]);return _0x9a2c70(_0x3f7ec1[_0x41a1('0xc')][_0x41a1('0xe')]);}else{logger[_0x41a1('0xf')](_0x41a1('0x9'),_0x2bfead,'request\x20sent');_0x9a2c70(_0x3f7ec1[_0x41a1('0x10')][_0x41a1('0xe')]);}})[_0x41a1('0x11')](function(_0x501f87){logger[_0x41a1('0xc')](_0x41a1('0x9'),_0x2bfead,_0x501f87);_0x3b0e85(_0x501f87);});});} \ No newline at end of file +var _0x25ea=['info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message'];(function(_0x4fb127,_0x11261a){var _0x2a656d=function(_0x33b23f){while(--_0x33b23f){_0x4fb127['push'](_0x4fb127['shift']());}};_0x2a656d(++_0x11261a);}(_0x25ea,0xc9));var _0xa25e=function(_0x1e91eb,_0x5829a3){_0x1e91eb=_0x1e91eb-0x0;var _0x2af75a=_0x25ea[_0x1e91eb];return _0x2af75a;};'use strict';var _=require('lodash');var util=require(_0xa25e('0x0'));var moment=require(_0xa25e('0x1'));var BPromise=require(_0xa25e('0x2'));var rs=require(_0xa25e('0x3'));var fs=require('fs');var Redis=require(_0xa25e('0x4'));var db=require(_0xa25e('0x5'))['db'];var utils=require(_0xa25e('0x6'));var logger=require('../../config/logger')(_0xa25e('0x7'));var config=require('../../config/environment');var jayson=require(_0xa25e('0x8'));var client=jayson[_0xa25e('0x9')][_0xa25e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f5787,_0x17b5e2,_0x1576d4){return new BPromise(function(_0x3e1fa,_0x54ea51){return client[_0xa25e('0xb')](_0x3f5787,_0x1576d4)[_0xa25e('0xc')](function(_0x468f94){logger['info'](_0xa25e('0xd'),_0x17b5e2,_0xa25e('0xe'));logger[_0xa25e('0xf')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x17b5e2,_0xa25e('0xe'),JSON[_0xa25e('0x10')](_0x468f94));if(_0x468f94[_0xa25e('0x11')]){if(_0x468f94[_0xa25e('0x11')]['code']===0x1f4){logger[_0xa25e('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x17b5e2,_0x468f94[_0xa25e('0x11')]['message']);return _0x54ea51(_0x468f94[_0xa25e('0x11')][_0xa25e('0x12')]);}logger[_0xa25e('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x17b5e2,_0x468f94['error'][_0xa25e('0x12')]);return _0x3e1fa(_0x468f94[_0xa25e('0x11')][_0xa25e('0x12')]);}else{logger[_0xa25e('0x13')](_0xa25e('0xd'),_0x17b5e2,_0xa25e('0xe'));_0x3e1fa(_0x468f94[_0xa25e('0x14')][_0xa25e('0x12')]);}})[_0xa25e('0x15')](function(_0xbe454e){logger[_0xa25e('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x17b5e2,_0xbe454e);_0x54ea51(_0xbe454e);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 6775fa5..ba35bcc 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 _0xf547=['isAuthenticated','index','/describe','/:id','post','put','update','delete','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0xe6e3bd,_0x12f283){var _0x3dc6a7=function(_0x19c720){while(--_0x19c720){_0xe6e3bd['push'](_0xe6e3bd['shift']());}};_0x3dc6a7(++_0x12f283);}(_0xf547,0xa1));var _0x7f54=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xf547[_0x45e98e];return _0x374dba;};'use strict';var multer=require(_0x7f54('0x0'));var util=require('util');var path=require(_0x7f54('0x1'));var timeout=require(_0x7f54('0x2'));var express=require(_0x7f54('0x3'));var router=express[_0x7f54('0x4')]();var fs_extra=require(_0x7f54('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7f54('0x6'));var config=require(_0x7f54('0x7'));var controller=require('./mailTransferReport.controller');router[_0x7f54('0x8')]('/',auth[_0x7f54('0x9')](),controller[_0x7f54('0xa')]);router[_0x7f54('0x8')](_0x7f54('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x7f54('0x8')](_0x7f54('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x7f54('0xd')]('/',auth[_0x7f54('0x9')](),controller['create']);router[_0x7f54('0xe')]('/:id',auth[_0x7f54('0x9')](),controller[_0x7f54('0xf')]);router[_0x7f54('0x10')](_0x7f54('0xc'),auth[_0x7f54('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4a25=['delete','destroy','multer','util','connect-timeout','express','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update'];(function(_0x33960d,_0x17cda5){var _0xb1742e=function(_0x5b5b95){while(--_0x5b5b95){_0x33960d['push'](_0x33960d['shift']());}};_0xb1742e(++_0x17cda5);}(_0x4a25,0xfe));var _0x54a2=function(_0x4f34d8,_0x40f022){_0x4f34d8=_0x4f34d8-0x0;var _0xc97536=_0x4a25[_0x4f34d8];return _0xc97536;};'use strict';var multer=require(_0x54a2('0x0'));var util=require(_0x54a2('0x1'));var path=require('path');var timeout=require(_0x54a2('0x2'));var express=require(_0x54a2('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(_0x54a2('0x4'));var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0x54a2('0x5')](),controller[_0x54a2('0x6')]);router[_0x54a2('0x7')](_0x54a2('0x8'),auth[_0x54a2('0x5')](),controller[_0x54a2('0x9')]);router[_0x54a2('0x7')](_0x54a2('0xa'),auth[_0x54a2('0x5')](),controller[_0x54a2('0xb')]);router[_0x54a2('0xc')]('/',auth['isAuthenticated'](),controller[_0x54a2('0xd')]);router[_0x54a2('0xe')](_0x54a2('0xa'),auth[_0x54a2('0x5')](),controller[_0x54a2('0xf')]);router[_0x54a2('0x10')]('/:id',auth[_0x54a2('0x5')](),controller[_0x54a2('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 2bfb62d..92cf595 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 _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x27828f,_0x2617e2){var _0x4c8b4f=function(_0x18c0b2){while(--_0x18c0b2){_0x27828f['push'](_0x27828f['shift']());}};_0x4c8b4f(++_0x2617e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'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 +var _0xe706=['NOW','moment','sequelize','exports','ENUM','account','agent','queue','DATE'];(function(_0x3599f2,_0x256be6){var _0x15a194=function(_0x2e28cf){while(--_0x2e28cf){_0x3599f2['push'](_0x3599f2['shift']());}};_0x15a194(++_0x256be6);}(_0xe706,0xa3));var _0x6e70=function(_0x1446fc,_0x13d287){_0x1446fc=_0x1446fc-0x0;var _0x184ce1=_0xe706[_0x1446fc];return _0x184ce1;};'use strict';var moment=require(_0x6e70('0x0'));var Sequelize=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6e70('0x3')](_0x6e70('0x4'),_0x6e70('0x5'),_0x6e70('0x6')),'allowNull':![],'defaultValue':_0x6e70('0x6')},'transferredAt':{'type':Sequelize[_0x6e70('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x6e70('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 812bc2b..55c37a1 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 _0xa73c=['json','undefined','limit','offset','count','set','apply','save','update','then','destroy','stack','name','MailTransferReport','rawAttributes','type','key','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x53ee09,_0x1ba9c4){var _0x138758=function(_0x24376d){while(--_0x24376d){_0x53ee09['push'](_0x53ee09['shift']());}};_0x138758(++_0x1ba9c4);}(_0xa73c,0x1c9));var _0xca73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa73c[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xca73('0x0'));var zipdir=require(_0xca73('0x1'));var jsonpatch=require(_0xca73('0x2'));var rp=require('request-promise');var moment=require(_0xca73('0x3'));var BPromise=require(_0xca73('0x4'));var Mustache=require(_0xca73('0x5'));var util=require('util');var path=require('path');var sox=require(_0xca73('0x6'));var csv=require(_0xca73('0x7'));var ejs=require(_0xca73('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xca73('0x9'));var squel=require(_0xca73('0xa'));var crypto=require(_0xca73('0xb'));var jsforce=require(_0xca73('0xc'));var deskjs=require(_0xca73('0xd'));var toCsv=require(_0xca73('0x7'));var querystring=require(_0xca73('0xe'));var Papa=require(_0xca73('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xca73('0x10'));var as=require(_0xca73('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xca73('0x12'));var utils=require(_0xca73('0x13'));var config=require(_0xca73('0x14'));var licenseUtil=require(_0xca73('0x15'));var db=require(_0xca73('0x16'))['db'];function respondWithStatusCode(_0x5d0d1f,_0x225f65){_0x225f65=_0x225f65||0xcc;return function(_0x4fddcf){if(_0x4fddcf){return _0x5d0d1f[_0xca73('0x17')](_0x225f65);}return _0x5d0d1f['status'](_0x225f65)[_0xca73('0x18')]();};}function respondWithResult(_0x109480,_0x5c27aa){_0x5c27aa=_0x5c27aa||0xc8;return function(_0x2e6e8){if(_0x2e6e8){return _0x109480[_0xca73('0x19')](_0x5c27aa)[_0xca73('0x1a')](_0x2e6e8);}};}function respondWithFilteredResult(_0x364093,_0x26c08f){return function(_0x2fe893){if(_0x2fe893){var _0x4ddc2a=typeof _0x26c08f['offset']===_0xca73('0x1b')&&typeof _0x26c08f[_0xca73('0x1c')]===_0xca73('0x1b');var _0x258188=_0x2fe893['count'];var _0x112b4a=_0x4ddc2a?0x0:_0x26c08f[_0xca73('0x1d')];var _0x2d1f6f=_0x4ddc2a?_0x2fe893[_0xca73('0x1e')]:_0x26c08f[_0xca73('0x1d')]+_0x26c08f[_0xca73('0x1c')];var _0x5ba928;if(_0x2d1f6f>=_0x258188){_0x2d1f6f=_0x258188;_0x5ba928=0xc8;}else{_0x5ba928=0xce;}_0x364093[_0xca73('0x19')](_0x5ba928);return _0x364093[_0xca73('0x1f')]('Content-Range',_0x112b4a+'-'+_0x2d1f6f+'/'+_0x258188)[_0xca73('0x1a')](_0x2fe893);}return null;};}function patchUpdates(_0x14000d){return function(_0x299b90){try{jsonpatch[_0xca73('0x20')](_0x299b90,_0x14000d,!![]);}catch(_0x4754e1){return BPromise['reject'](_0x4754e1);}return _0x299b90[_0xca73('0x21')]();};}function saveUpdates(_0x526d3d,_0x4f6bcc){return function(_0xe55ac8){if(_0xe55ac8){return _0xe55ac8[_0xca73('0x22')](_0x526d3d)[_0xca73('0x23')](function(_0x373f10){return _0x373f10;});}return null;};}function removeEntity(_0x1c6fdd,_0x37df6b){return function(_0x39ed12){if(_0x39ed12){return _0x39ed12[_0xca73('0x24')]()['then'](function(){_0x1c6fdd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f95af,_0x4f2fc2){return function(_0x27c565){if(!_0x27c565){_0x1f95af[_0xca73('0x17')](0x194);}return _0x27c565;};}function handleError(_0x43938b,_0x282213){_0x282213=_0x282213||0x1f4;return function(_0x49ee1e){logger['error'](_0x49ee1e[_0xca73('0x25')]);if(_0x49ee1e[_0xca73('0x26')]){delete _0x49ee1e[_0xca73('0x26')];}_0x43938b[_0xca73('0x19')](_0x282213)['send'](_0x49ee1e);};}exports['index']=function(_0x4b7696,_0x579425){var _0x2cfb25={},_0x18e862={},_0x459495={'count':0x0,'rows':[]};var _0x546a3a=_['map'](db[_0xca73('0x27')][_0xca73('0x28')],function(_0x2c0283){return{'name':_0x2c0283['fieldName'],'type':_0x2c0283[_0xca73('0x29')][_0xca73('0x2a')]};});_0x18e862[_0xca73('0x2b')]=_[_0xca73('0x2c')](_0x546a3a,_0xca73('0x26'));_0x18e862[_0xca73('0x2d')]=_[_0xca73('0x2e')](_0x4b7696[_0xca73('0x2d')]);_0x18e862[_0xca73('0x2f')]=_['intersection'](_0x18e862[_0xca73('0x2b')],_0x18e862[_0xca73('0x2d')]);_0x2cfb25[_0xca73('0x30')]=_['intersection'](_0x18e862[_0xca73('0x2b')],qs[_0xca73('0x31')](_0x4b7696['query'][_0xca73('0x31')]));_0x2cfb25[_0xca73('0x30')]=_0x2cfb25['attributes'][_0xca73('0x32')]?_0x2cfb25['attributes']:_0x18e862[_0xca73('0x2b')];if(!_0x4b7696[_0xca73('0x2d')][_0xca73('0x33')](_0xca73('0x34'))){_0x2cfb25[_0xca73('0x1c')]=qs[_0xca73('0x1c')](_0x4b7696['query'][_0xca73('0x1c')]);_0x2cfb25[_0xca73('0x1d')]=qs[_0xca73('0x1d')](_0x4b7696[_0xca73('0x2d')][_0xca73('0x1d')]);}_0x2cfb25[_0xca73('0x35')]=qs[_0xca73('0x36')](_0x4b7696['query'][_0xca73('0x36')]);_0x2cfb25[_0xca73('0x37')]=qs[_0xca73('0x2f')](_[_0xca73('0x38')](_0x4b7696[_0xca73('0x2d')],_0x18e862[_0xca73('0x2f')]),_0x546a3a);if(_0x4b7696[_0xca73('0x2d')][_0xca73('0x39')]){_0x2cfb25[_0xca73('0x37')]=_[_0xca73('0x3a')](_0x2cfb25[_0xca73('0x37')],{'$or':_[_0xca73('0x2c')](_0x546a3a,function(_0x7114){if(_0x7114[_0xca73('0x29')]!==_0xca73('0x3b')){var _0x517220={};_0x517220[_0x7114[_0xca73('0x26')]]={'$like':'%'+_0x4b7696[_0xca73('0x2d')][_0xca73('0x39')]+'%'};return _0x517220;}})});}_0x2cfb25=_[_0xca73('0x3a')]({},_0x2cfb25,_0x4b7696[_0xca73('0x3c')]);var _0x4e27f8={'where':_0x2cfb25['where']};return db[_0xca73('0x27')][_0xca73('0x1e')](_0x4e27f8)[_0xca73('0x23')](function(_0x2c2013){_0x459495[_0xca73('0x1e')]=_0x2c2013;if(_0x4b7696[_0xca73('0x2d')][_0xca73('0x3d')]){_0x2cfb25[_0xca73('0x3e')]=[{'all':!![]}];}return db[_0xca73('0x27')]['findAll'](_0x2cfb25);})[_0xca73('0x23')](function(_0x3b2ac6){_0x459495[_0xca73('0x3f')]=_0x3b2ac6;return _0x459495;})['then'](respondWithFilteredResult(_0x579425,_0x2cfb25))[_0xca73('0x40')](handleError(_0x579425,null));};exports['show']=function(_0x51deff,_0x314855){var _0x4e9c7e={'raw':!![],'where':{'id':_0x51deff[_0xca73('0x41')]['id']}},_0x2cea02={};_0x2cea02[_0xca73('0x2b')]=_[_0xca73('0x2e')](db[_0xca73('0x27')][_0xca73('0x28')]);_0x2cea02['query']=_[_0xca73('0x2e')](_0x51deff['query']);_0x2cea02[_0xca73('0x2f')]=_['intersection'](_0x2cea02[_0xca73('0x2b')],_0x2cea02['query']);_0x4e9c7e['attributes']=_['intersection'](_0x2cea02[_0xca73('0x2b')],qs[_0xca73('0x31')](_0x51deff['query']['fields']));_0x4e9c7e[_0xca73('0x30')]=_0x4e9c7e['attributes'][_0xca73('0x32')]?_0x4e9c7e[_0xca73('0x30')]:_0x2cea02[_0xca73('0x2b')];if(_0x51deff[_0xca73('0x2d')]['includeAll']){_0x4e9c7e[_0xca73('0x3e')]=[{'all':!![]}];}_0x4e9c7e=_[_0xca73('0x3a')]({},_0x4e9c7e,_0x51deff[_0xca73('0x3c')]);return db[_0xca73('0x27')][_0xca73('0x42')](_0x4e9c7e)[_0xca73('0x23')](handleEntityNotFound(_0x314855,null))[_0xca73('0x23')](respondWithResult(_0x314855,null))[_0xca73('0x40')](handleError(_0x314855,null));};exports[_0xca73('0x43')]=function(_0x277ca6,_0x5e8c8d){return db[_0xca73('0x27')][_0xca73('0x43')](_0x277ca6[_0xca73('0x44')],{})[_0xca73('0x23')](respondWithResult(_0x5e8c8d,0xc9))[_0xca73('0x40')](handleError(_0x5e8c8d,null));};exports['update']=function(_0x76a00,_0xd0ff8c){if(_0x76a00[_0xca73('0x44')]['id']){delete _0x76a00['body']['id'];}return db[_0xca73('0x27')][_0xca73('0x42')]({'where':{'id':_0x76a00[_0xca73('0x41')]['id']}})['then'](handleEntityNotFound(_0xd0ff8c,null))['then'](saveUpdates(_0x76a00['body'],null))[_0xca73('0x23')](respondWithResult(_0xd0ff8c,null))[_0xca73('0x40')](handleError(_0xd0ff8c,null));};exports[_0xca73('0x24')]=function(_0x21a5e6,_0x509deb){return db[_0xca73('0x27')][_0xca73('0x42')]({'where':{'id':_0x21a5e6['params']['id']}})[_0xca73('0x23')](handleEntityNotFound(_0x509deb,null))[_0xca73('0x23')](removeEntity(_0x509deb,null))[_0xca73('0x40')](handleError(_0x509deb,null));};exports['describe']=function(_0x33c22f,_0x4574e6){return db[_0xca73('0x27')]['describe']()[_0xca73('0x23')](respondWithResult(_0x4574e6,null))[_0xca73('0x40')](handleError(_0x4574e6,null));}; \ No newline at end of file +var _0x03d7=['fs-extra','lodash','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','limit','undefined','count','apply','reject','save','then','destroy','end','error','name','send','index','map','MailTransferReport','type','key','model','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','merge','VIRTUAL','filter','options','where','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv'];(function(_0x3a20f2,_0x4f68af){var _0x2fadd0=function(_0x142035){while(--_0x142035){_0x3a20f2['push'](_0x3a20f2['shift']());}};_0x2fadd0(++_0x4f68af);}(_0x03d7,0x8d));var _0x703d=function(_0x1c362a,_0x3b9fb8){_0x1c362a=_0x1c362a-0x0;var _0x475726=_0x03d7[_0x1c362a];return _0x475726;};'use strict';var emlformat=require(_0x703d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x703d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x703d('0x2'));var moment=require(_0x703d('0x3'));var BPromise=require(_0x703d('0x4'));var Mustache=require(_0x703d('0x5'));var util=require('util');var path=require(_0x703d('0x6'));var sox=require(_0x703d('0x7'));var csv=require(_0x703d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x703d('0x9'));var _=require(_0x703d('0xa'));var squel=require(_0x703d('0xb'));var crypto=require(_0x703d('0xc'));var jsforce=require(_0x703d('0xd'));var deskjs=require(_0x703d('0xe'));var toCsv=require('to-csv');var querystring=require(_0x703d('0xf'));var Papa=require(_0x703d('0x10'));var Redis=require(_0x703d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x703d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x703d('0x13'));var logger=require(_0x703d('0x14'))(_0x703d('0x15'));var utils=require(_0x703d('0x16'));var config=require(_0x703d('0x17'));var licenseUtil=require(_0x703d('0x18'));var db=require(_0x703d('0x19'))['db'];function respondWithStatusCode(_0x5ae69f,_0x224f15){_0x224f15=_0x224f15||0xcc;return function(_0x4b1167){if(_0x4b1167){return _0x5ae69f[_0x703d('0x1a')](_0x224f15);}return _0x5ae69f[_0x703d('0x1b')](_0x224f15)['end']();};}function respondWithResult(_0x5025f2,_0x234ac5){_0x234ac5=_0x234ac5||0xc8;return function(_0x461f0b){if(_0x461f0b){return _0x5025f2[_0x703d('0x1b')](_0x234ac5)[_0x703d('0x1c')](_0x461f0b);}};}function respondWithFilteredResult(_0x5a65a2,_0x514575){return function(_0x39bbf3){if(_0x39bbf3){var _0x38e016=typeof _0x514575[_0x703d('0x1d')]==='undefined'&&typeof _0x514575[_0x703d('0x1e')]===_0x703d('0x1f');var _0x555be3=_0x39bbf3['count'];var _0x593f58=_0x38e016?0x0:_0x514575['offset'];var _0x587752=_0x38e016?_0x39bbf3[_0x703d('0x20')]:_0x514575[_0x703d('0x1d')]+_0x514575[_0x703d('0x1e')];var _0xb35ef1;if(_0x587752>=_0x555be3){_0x587752=_0x555be3;_0xb35ef1=0xc8;}else{_0xb35ef1=0xce;}_0x5a65a2[_0x703d('0x1b')](_0xb35ef1);return _0x5a65a2['set']('Content-Range',_0x593f58+'-'+_0x587752+'/'+_0x555be3)['json'](_0x39bbf3);}return null;};}function patchUpdates(_0x16c3c1){return function(_0x2afb2c){try{jsonpatch[_0x703d('0x21')](_0x2afb2c,_0x16c3c1,!![]);}catch(_0x5289ec){return BPromise[_0x703d('0x22')](_0x5289ec);}return _0x2afb2c[_0x703d('0x23')]();};}function saveUpdates(_0x52817a,_0x2aaafd){return function(_0x43f62c){if(_0x43f62c){return _0x43f62c['update'](_0x52817a)[_0x703d('0x24')](function(_0x3eed35){return _0x3eed35;});}return null;};}function removeEntity(_0x477ed1,_0x6ed410){return function(_0x25d705){if(_0x25d705){return _0x25d705[_0x703d('0x25')]()[_0x703d('0x24')](function(){_0x477ed1['status'](0xcc)[_0x703d('0x26')]();});}};}function handleEntityNotFound(_0x35d48a,_0x2cc519){return function(_0x2c6e02){if(!_0x2c6e02){_0x35d48a['sendStatus'](0x194);}return _0x2c6e02;};}function handleError(_0x55ecba,_0x3fd83b){_0x3fd83b=_0x3fd83b||0x1f4;return function(_0x5cbcce){logger[_0x703d('0x27')](_0x5cbcce['stack']);if(_0x5cbcce[_0x703d('0x28')]){delete _0x5cbcce[_0x703d('0x28')];}_0x55ecba['status'](_0x3fd83b)[_0x703d('0x29')](_0x5cbcce);};}exports[_0x703d('0x2a')]=function(_0x18317b,_0x2162dd){var _0x447f20={},_0x3c67b2={},_0x23f76f={'count':0x0,'rows':[]};var _0x182524=_[_0x703d('0x2b')](db[_0x703d('0x2c')]['rawAttributes'],function(_0xc030cd){return{'name':_0xc030cd['fieldName'],'type':_0xc030cd[_0x703d('0x2d')][_0x703d('0x2e')]};});_0x3c67b2[_0x703d('0x2f')]=_['map'](_0x182524,_0x703d('0x28'));_0x3c67b2['query']=_['keys'](_0x18317b[_0x703d('0x30')]);_0x3c67b2[_0x703d('0x31')]=_[_0x703d('0x32')](_0x3c67b2['model'],_0x3c67b2[_0x703d('0x30')]);_0x447f20['attributes']=_[_0x703d('0x32')](_0x3c67b2[_0x703d('0x2f')],qs[_0x703d('0x33')](_0x18317b[_0x703d('0x30')][_0x703d('0x33')]));_0x447f20['attributes']=_0x447f20['attributes'][_0x703d('0x34')]?_0x447f20[_0x703d('0x35')]:_0x3c67b2[_0x703d('0x2f')];if(!_0x18317b[_0x703d('0x30')][_0x703d('0x36')](_0x703d('0x37'))){_0x447f20['limit']=qs[_0x703d('0x1e')](_0x18317b[_0x703d('0x30')][_0x703d('0x1e')]);_0x447f20['offset']=qs[_0x703d('0x1d')](_0x18317b[_0x703d('0x30')][_0x703d('0x1d')]);}_0x447f20[_0x703d('0x38')]=qs['sort'](_0x18317b[_0x703d('0x30')][_0x703d('0x39')]);_0x447f20['where']=qs[_0x703d('0x31')](_['pick'](_0x18317b['query'],_0x3c67b2[_0x703d('0x31')]),_0x182524);if(_0x18317b['query']['filter']){_0x447f20['where']=_[_0x703d('0x3a')](_0x447f20['where'],{'$or':_['map'](_0x182524,function(_0x1bb42c){if(_0x1bb42c[_0x703d('0x2d')]!==_0x703d('0x3b')){var _0x11d87b={};_0x11d87b[_0x1bb42c[_0x703d('0x28')]]={'$like':'%'+_0x18317b['query'][_0x703d('0x3c')]+'%'};return _0x11d87b;}})});}_0x447f20=_[_0x703d('0x3a')]({},_0x447f20,_0x18317b[_0x703d('0x3d')]);var _0x459533={'where':_0x447f20[_0x703d('0x3e')]};return db['MailTransferReport']['count'](_0x459533)[_0x703d('0x24')](function(_0x5cf384){_0x23f76f[_0x703d('0x20')]=_0x5cf384;if(_0x18317b[_0x703d('0x30')][_0x703d('0x3f')]){_0x447f20['include']=[{'all':!![]}];}return db[_0x703d('0x2c')][_0x703d('0x40')](_0x447f20);})[_0x703d('0x24')](function(_0x3c37d5){_0x23f76f[_0x703d('0x41')]=_0x3c37d5;return _0x23f76f;})[_0x703d('0x24')](respondWithFilteredResult(_0x2162dd,_0x447f20))[_0x703d('0x42')](handleError(_0x2162dd,null));};exports[_0x703d('0x43')]=function(_0x1e1066,_0x29a419){var _0x31cf50={'raw':!![],'where':{'id':_0x1e1066[_0x703d('0x44')]['id']}},_0xc79613={};_0xc79613[_0x703d('0x2f')]=_[_0x703d('0x45')](db[_0x703d('0x2c')]['rawAttributes']);_0xc79613[_0x703d('0x30')]=_['keys'](_0x1e1066[_0x703d('0x30')]);_0xc79613['filters']=_[_0x703d('0x32')](_0xc79613[_0x703d('0x2f')],_0xc79613['query']);_0x31cf50[_0x703d('0x35')]=_['intersection'](_0xc79613['model'],qs[_0x703d('0x33')](_0x1e1066[_0x703d('0x30')][_0x703d('0x33')]));_0x31cf50[_0x703d('0x35')]=_0x31cf50[_0x703d('0x35')][_0x703d('0x34')]?_0x31cf50[_0x703d('0x35')]:_0xc79613['model'];if(_0x1e1066[_0x703d('0x30')][_0x703d('0x3f')]){_0x31cf50[_0x703d('0x46')]=[{'all':!![]}];}_0x31cf50=_[_0x703d('0x3a')]({},_0x31cf50,_0x1e1066[_0x703d('0x3d')]);return db[_0x703d('0x2c')][_0x703d('0x47')](_0x31cf50)[_0x703d('0x24')](handleEntityNotFound(_0x29a419,null))['then'](respondWithResult(_0x29a419,null))[_0x703d('0x42')](handleError(_0x29a419,null));};exports[_0x703d('0x48')]=function(_0x253231,_0x4dc8b8){return db[_0x703d('0x2c')]['create'](_0x253231[_0x703d('0x49')],{})[_0x703d('0x24')](respondWithResult(_0x4dc8b8,0xc9))[_0x703d('0x42')](handleError(_0x4dc8b8,null));};exports['update']=function(_0x2bca84,_0x57bbfd){if(_0x2bca84[_0x703d('0x49')]['id']){delete _0x2bca84[_0x703d('0x49')]['id'];}return db[_0x703d('0x2c')][_0x703d('0x47')]({'where':{'id':_0x2bca84[_0x703d('0x44')]['id']}})[_0x703d('0x24')](handleEntityNotFound(_0x57bbfd,null))[_0x703d('0x24')](saveUpdates(_0x2bca84[_0x703d('0x49')],null))[_0x703d('0x24')](respondWithResult(_0x57bbfd,null))[_0x703d('0x42')](handleError(_0x57bbfd,null));};exports['destroy']=function(_0x4a6e71,_0x129f7e){return db['MailTransferReport'][_0x703d('0x47')]({'where':{'id':_0x4a6e71['params']['id']}})[_0x703d('0x24')](handleEntityNotFound(_0x129f7e,null))[_0x703d('0x24')](removeEntity(_0x129f7e,null))[_0x703d('0x42')](handleError(_0x129f7e,null));};exports[_0x703d('0x4a')]=function(_0x33ac03,_0x1072c0){return db[_0x703d('0x2c')][_0x703d('0x4a')]()[_0x703d('0x24')](respondWithResult(_0x1072c0,null))[_0x703d('0x42')](handleError(_0x1072c0,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 654f132..744679c 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 _0xf483=['report_mail_transfer','uniqueid','util','api','moment','bluebird','request-promise','path','rimraf','MailTransferReport'];(function(_0x1dafd7,_0xab3534){var _0x3b20fa=function(_0x465a27){while(--_0x465a27){_0x1dafd7['push'](_0x1dafd7['shift']());}};_0x3b20fa(++_0xab3534);}(_0xf483,0xf2));var _0x3f48=function(_0x5666e0,_0x1524d1){_0x5666e0=_0x5666e0-0x0;var _0x130fcb=_0xf483[_0x5666e0];return _0x130fcb;};'use strict';var _=require('lodash');var util=require(_0x3f48('0x0'));var logger=require('../../config/logger')(_0x3f48('0x1'));var moment=require(_0x3f48('0x2'));var BPromise=require(_0x3f48('0x3'));var rp=require(_0x3f48('0x4'));var fs=require('fs');var path=require(_0x3f48('0x5'));var rimraf=require(_0x3f48('0x6'));var config=require('../../config/environment');var attributes=require('./mailTransferReport.attributes');module['exports']=function(_0x1a3447,_0x16905e){return _0x1a3447['define'](_0x3f48('0x7'),attributes,{'tableName':_0x3f48('0x8'),'paranoid':![],'indexes':[{'name':_0x3f48('0x9'),'fields':[_0x3f48('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x386f=['report_mail_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./mailTransferReport.attributes','define','MailTransferReport'];(function(_0x24aa11,_0x4b8b35){var _0x41b154=function(_0x49b945){while(--_0x49b945){_0x24aa11['push'](_0x24aa11['shift']());}};_0x41b154(++_0x4b8b35);}(_0x386f,0x11a));var _0xf386=function(_0x277d9a,_0x864b9c){_0x277d9a=_0x277d9a-0x0;var _0x2ae33f=_0x386f[_0x277d9a];return _0x2ae33f;};'use strict';var _=require(_0xf386('0x0'));var util=require(_0xf386('0x1'));var logger=require(_0xf386('0x2'))(_0xf386('0x3'));var moment=require(_0xf386('0x4'));var BPromise=require(_0xf386('0x5'));var rp=require(_0xf386('0x6'));var fs=require('fs');var path=require(_0xf386('0x7'));var rimraf=require(_0xf386('0x8'));var config=require('../../config/environment');var attributes=require(_0xf386('0x9'));module['exports']=function(_0x445c3c,_0x288edc){return _0x445c3c[_0xf386('0xa')](_0xf386('0xb'),attributes,{'tableName':_0xf386('0xc'),'paranoid':![],'indexes':[{'name':_0xf386('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index c8a3b8d..dc2a469 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 _0x5f09=['ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x5f09,0x1df));var _0x95f0=function(_0x4b2bda,_0x261630){_0x4b2bda=_0x4b2bda-0x0;var _0x30a7d0=_0x5f09[_0x4b2bda];return _0x30a7d0;};'use strict';var _=require(_0x95f0('0x0'));var util=require(_0x95f0('0x1'));var moment=require('moment');var BPromise=require(_0x95f0('0x2'));var rs=require(_0x95f0('0x3'));var fs=require('fs');var Redis=require(_0x95f0('0x4'));var db=require(_0x95f0('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x95f0('0x6'))(_0x95f0('0x7'));var config=require('../../config/environment');var jayson=require(_0x95f0('0x8'));var client=jayson[_0x95f0('0x9')][_0x95f0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f1b0b,_0x917174,_0x25db45){return new BPromise(function(_0x5a35e1,_0x526b40){return client[_0x95f0('0xb')](_0x1f1b0b,_0x25db45)[_0x95f0('0xc')](function(_0x258811){logger[_0x95f0('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x917174,_0x95f0('0xe'));logger['debug'](_0x95f0('0xf'),_0x917174,_0x95f0('0xe'),JSON[_0x95f0('0x10')](_0x258811));if(_0x258811[_0x95f0('0x11')]){if(_0x258811[_0x95f0('0x11')][_0x95f0('0x12')]===0x1f4){logger[_0x95f0('0x11')](_0x95f0('0x13'),_0x917174,_0x258811['error']['message']);return _0x526b40(_0x258811[_0x95f0('0x11')]['message']);}logger[_0x95f0('0x11')](_0x95f0('0x13'),_0x917174,_0x258811['error'][_0x95f0('0x14')]);return _0x5a35e1(_0x258811[_0x95f0('0x11')][_0x95f0('0x14')]);}else{logger[_0x95f0('0xd')]('MailTransferReport,\x20%s,\x20%s',_0x917174,_0x95f0('0xe'));_0x5a35e1(_0x258811[_0x95f0('0x15')][_0x95f0('0x14')]);}})[_0x95f0('0x16')](function(_0x28853d){logger[_0x95f0('0x11')](_0x95f0('0x13'),_0x917174,_0x28853d);_0x526b40(_0x28853d);});});} \ No newline at end of file +var _0x9581=['client','http','request','request\x20sent','debug','stringify','error','code','MailTransferReport,\x20%s,\x20%s','message','info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9581,0x182));var _0x1958=function(_0x1e0876,_0x2e8dc5){_0x1e0876=_0x1e0876-0x0;var _0xccecf8=_0x9581[_0x1e0876];return _0xccecf8;};'use strict';var _=require('lodash');var util=require(_0x1958('0x0'));var moment=require(_0x1958('0x1'));var BPromise=require(_0x1958('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1958('0x3'));var db=require(_0x1958('0x4'))['db'];var utils=require(_0x1958('0x5'));var logger=require(_0x1958('0x6'))(_0x1958('0x7'));var config=require(_0x1958('0x8'));var jayson=require(_0x1958('0x9'));var client=jayson[_0x1958('0xa')][_0x1958('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33f3f0,_0x5095ba,_0x1de6c0){return new BPromise(function(_0x36c06f,_0x264e75){return client[_0x1958('0xc')](_0x33f3f0,_0x1de6c0)['then'](function(_0x12908b){logger['info']('MailTransferReport,\x20%s,\x20%s',_0x5095ba,_0x1958('0xd'));logger[_0x1958('0xe')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x5095ba,_0x1958('0xd'),JSON[_0x1958('0xf')](_0x12908b));if(_0x12908b[_0x1958('0x10')]){if(_0x12908b['error'][_0x1958('0x11')]===0x1f4){logger['error'](_0x1958('0x12'),_0x5095ba,_0x12908b['error'][_0x1958('0x13')]);return _0x264e75(_0x12908b['error'][_0x1958('0x13')]);}logger[_0x1958('0x10')](_0x1958('0x12'),_0x5095ba,_0x12908b[_0x1958('0x10')][_0x1958('0x13')]);return _0x36c06f(_0x12908b[_0x1958('0x10')][_0x1958('0x13')]);}else{logger[_0x1958('0x14')](_0x1958('0x12'),_0x5095ba,_0x1958('0xd'));_0x36c06f(_0x12908b[_0x1958('0x15')][_0x1958('0x13')]);}})['catch'](function(_0x4d750f){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x5095ba,_0x4d750f);_0x264e75(_0x4d750f);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 46e7dbd..f4875e3 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 _0xb921=['isAuthenticated','/:id','show','post','update','destroy','exports','connect-timeout','express','../../components/interaction/service','../../config/environment','./memberReport.controller','get'];(function(_0x5edaaa,_0x67916a){var _0x49097b=function(_0x2de377){while(--_0x2de377){_0x5edaaa['push'](_0x5edaaa['shift']());}};_0x49097b(++_0x67916a);}(_0xb921,0x1ce));var _0x1b92=function(_0x448cb3,_0x203c7b){_0x448cb3=_0x448cb3-0x0;var _0x1df8a7=_0xb921[_0x448cb3];return _0x1df8a7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x1b92('0x0'));var express=require(_0x1b92('0x1'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b92('0x2'));var config=require(_0x1b92('0x3'));var controller=require(_0x1b92('0x4'));router[_0x1b92('0x5')]('/',auth[_0x1b92('0x6')](),controller['index']);router[_0x1b92('0x5')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x1b92('0x5')](_0x1b92('0x7'),auth[_0x1b92('0x6')](),controller[_0x1b92('0x8')]);router[_0x1b92('0x9')]('/',auth[_0x1b92('0x6')](),controller['create']);router['put'](_0x1b92('0x7'),auth['isAuthenticated'](),controller[_0x1b92('0xa')]);router['delete']('/:id',auth[_0x1b92('0x6')](),controller[_0x1b92('0xb')]);module[_0x1b92('0xc')]=router; \ No newline at end of file +var _0xd1bf=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller','get','isAuthenticated','index','describe','/:id','show','create','put','update','destroy','exports'];(function(_0x540ad3,_0x390484){var _0x5acfbd=function(_0x381f60){while(--_0x381f60){_0x540ad3['push'](_0x540ad3['shift']());}};_0x5acfbd(++_0x390484);}(_0xd1bf,0x1a4));var _0xfd1b=function(_0x10f1e6,_0x42c9bd){_0x10f1e6=_0x10f1e6-0x0;var _0x173b3d=_0xd1bf[_0x10f1e6];return _0x173b3d;};'use strict';var multer=require(_0xfd1b('0x0'));var util=require(_0xfd1b('0x1'));var path=require(_0xfd1b('0x2'));var timeout=require(_0xfd1b('0x3'));var express=require(_0xfd1b('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfd1b('0x5'));var interaction=require(_0xfd1b('0x6'));var config=require(_0xfd1b('0x7'));var controller=require(_0xfd1b('0x8'));router[_0xfd1b('0x9')]('/',auth[_0xfd1b('0xa')](),controller[_0xfd1b('0xb')]);router['get']('/describe',auth[_0xfd1b('0xa')](),controller[_0xfd1b('0xc')]);router[_0xfd1b('0x9')](_0xfd1b('0xd'),auth[_0xfd1b('0xa')](),controller[_0xfd1b('0xe')]);router['post']('/',auth[_0xfd1b('0xa')](),controller[_0xfd1b('0xf')]);router[_0xfd1b('0x10')](_0xfd1b('0xd'),auth[_0xfd1b('0xa')](),controller[_0xfd1b('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xfd1b('0x12')]);module[_0xfd1b('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 27ed1a8..a9d2bc6 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 _0x8683=['DATE','getDataValue','diff','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER'];(function(_0x269c1d,_0x5a31c5){var _0x53f863=function(_0x1c7a5d){while(--_0x1c7a5d){_0x269c1d['push'](_0x269c1d['shift']());}};_0x53f863(++_0x5a31c5);}(_0x8683,0x14e));var _0x3868=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x8683[_0x297fd3];return _0x2af381;};'use strict';var Sequelize=require(_0x3868('0x0'));var moment=require('moment');module[_0x3868('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x3868('0x2')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3868('0x2')],'defaultValue':_0x3868('0x3'),'comment':_0x3868('0x4')},'duration':{'type':Sequelize[_0x3868('0x5')]},'enterAt':{'type':Sequelize[_0x3868('0x6')]},'exitAt':{'type':Sequelize[_0x3868('0x6')],'set':function(_0x35c9a5){var _0x50aa16=moment(_0x35c9a5);var _0x2c30ef=moment(this[_0x3868('0x7')]('enterAt'));var _0x9bdb06=_0x50aa16[_0x3868('0x8')](_0x2c30ef,_0x3868('0x9'));this[_0x3868('0xa')](_0x3868('0xb'),_0x35c9a5);this[_0x3868('0xa')]('duration',_0x9bdb06>=0x0?_0x9bdb06:null);}},'data1':{'type':Sequelize[_0x3868('0x2')],'comment':_0x3868('0xc')},'data2':{'type':Sequelize['STRING'],'comment':_0x3868('0xd')},'data3':{'type':Sequelize['STRING'],'comment':_0x3868('0xe')},'data4':{'type':Sequelize['STRING'],'comment':_0x3868('0xf')},'data5':{'type':Sequelize[_0x3868('0x2')],'comment':_0x3868('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize[_0x3868('0x5')]},'uniqueid':{'type':Sequelize[_0x3868('0x2')]}}; \ No newline at end of file +var _0xb007=['diff','exitAt','duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[dial\x20string]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','DATE','getDataValue','enterAt'];(function(_0x46f4fe,_0xd18ed){var _0x163a08=function(_0xb43dbc){while(--_0xb43dbc){_0x46f4fe['push'](_0x46f4fe['shift']());}};_0x163a08(++_0xd18ed);}(_0xb007,0x19b));var _0x7b00=function(_0x21b84d,_0x4da029){_0x21b84d=_0x21b84d-0x0;var _0x3bd8ef=_0xb007[_0x21b84d];return _0x3bd8ef;};'use strict';var Sequelize=require(_0x7b00('0x0'));var moment=require(_0x7b00('0x1'));module[_0x7b00('0x2')]={'channel':{'type':Sequelize[_0x7b00('0x3')]},'membername':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x7b00('0x3')]},'type':{'type':Sequelize[_0x7b00('0x3')],'defaultValue':_0x7b00('0x4'),'comment':_0x7b00('0x5')},'duration':{'type':Sequelize['INTEGER']},'enterAt':{'type':Sequelize[_0x7b00('0x6')]},'exitAt':{'type':Sequelize[_0x7b00('0x6')],'set':function(_0x4fe781){var _0x4bdd16=moment(_0x4fe781);var _0x35d4c5=moment(this[_0x7b00('0x7')](_0x7b00('0x8')));var _0x2a5c00=_0x4bdd16[_0x7b00('0x9')](_0x35d4c5,'seconds');this['setDataValue'](_0x7b00('0xa'),_0x4fe781);this['setDataValue'](_0x7b00('0xb'),_0x2a5c00>=0x0?_0x2a5c00:null);}},'data1':{'type':Sequelize[_0x7b00('0x3')],'comment':_0x7b00('0xc')},'data2':{'type':Sequelize[_0x7b00('0x3')],'comment':_0x7b00('0xd')},'data3':{'type':Sequelize[_0x7b00('0x3')],'comment':'talk:[destination]'},'data4':{'type':Sequelize[_0x7b00('0x3')],'comment':_0x7b00('0xe')},'data5':{'type':Sequelize[_0x7b00('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0x7b00('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x7b00('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index b91b1ce..1b7f42c 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 _0x3e74=['show','params','options','find','catch','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows'];(function(_0x3c4bcd,_0x59f4c3){var _0x335bce=function(_0x43405b){while(--_0x43405b){_0x3c4bcd['push'](_0x3c4bcd['shift']());}};_0x335bce(++_0x59f4c3);}(_0x3e74,0x175));var _0x43e7=function(_0x571949,_0x527d94){_0x571949=_0x571949-0x0;var _0x4b2e83=_0x3e74[_0x571949];return _0x4b2e83;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x27')](_0x50f9f5,_0x43e7('0x24'));_0x4690a6['query']=_[_0x43e7('0x2e')](_0xb1fc63[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],_0x4690a6['query']);_0x33a1a5[_0x43e7('0x32')]=_[_0x43e7('0x31')](_0x4690a6[_0x43e7('0x2d')],qs[_0x43e7('0x33')](_0xb1fc63['query']['fields']));_0x33a1a5['attributes']=_0x33a1a5[_0x43e7('0x32')][_0x43e7('0x34')]?_0x33a1a5[_0x43e7('0x32')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x35')]('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5['offset']=qs['offset'](_0xb1fc63[_0x43e7('0x2f')]['offset']);}_0x33a1a5[_0x43e7('0x36')]=qs[_0x43e7('0x37')](_0xb1fc63[_0x43e7('0x2f')][_0x43e7('0x37')]);_0x33a1a5[_0x43e7('0x38')]=qs[_0x43e7('0x30')](_[_0x43e7('0x39')](_0xb1fc63['query'],_0x4690a6['filters']),_0x50f9f5);if(_0xb1fc63['query'][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x38')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x38')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x1ed538){if(_0x1ed538[_0x43e7('0x2b')]!==_0x43e7('0x3c')){var _0x55c798={};_0x55c798[_0x1ed538[_0x43e7('0x24')]]={'$like':'%'+_0xb1fc63[_0x43e7('0x2f')]['filter']+'%'};return _0x55c798;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63['options']);var _0x44d8e4={'where':_0x33a1a5[_0x43e7('0x38')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x44d8e4)[_0x43e7('0x21')](function(_0x234d8f){_0x45b675['count']=_0x234d8f;if(_0xb1fc63['query'][_0x43e7('0x3d')]){_0x33a1a5[_0x43e7('0x3e')]=[{'all':!![]}];}return db[_0x43e7('0x28')][_0x43e7('0x3f')](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4a4a85){_0x45b675[_0x43e7('0x40')]=_0x4a4a85;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x41')]=function(_0x51a69c,_0x2ad8ef){var _0x504101={'raw':!![],'where':{'id':_0x51a69c[_0x43e7('0x42')]['id']}},_0x3d81ae={};_0x3d81ae[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](db['MemberReport']['rawAttributes']);_0x3d81ae[_0x43e7('0x2f')]=_[_0x43e7('0x2e')](_0x51a69c[_0x43e7('0x2f')]);_0x3d81ae[_0x43e7('0x30')]=_['intersection'](_0x3d81ae['model'],_0x3d81ae['query']);_0x504101[_0x43e7('0x32')]=_['intersection'](_0x3d81ae[_0x43e7('0x2d')],qs['fields'](_0x51a69c['query'][_0x43e7('0x33')]));_0x504101['attributes']=_0x504101[_0x43e7('0x32')][_0x43e7('0x34')]?_0x504101[_0x43e7('0x32')]:_0x3d81ae[_0x43e7('0x2d')];if(_0x51a69c['query'][_0x43e7('0x3d')]){_0x504101[_0x43e7('0x3e')]=[{'all':!![]}];}_0x504101=_[_0x43e7('0x3b')]({},_0x504101,_0x51a69c[_0x43e7('0x43')]);return db[_0x43e7('0x28')][_0x43e7('0x44')](_0x504101)['then'](handleEntityNotFound(_0x2ad8ef,null))['then'](respondWithResult(_0x2ad8ef,null))[_0x43e7('0x45')](handleError(_0x2ad8ef,null));};exports[_0x43e7('0x46')]=function(_0x212841,_0x4c00a8){return db['MemberReport']['create'](_0x212841[_0x43e7('0x47')],{})[_0x43e7('0x21')](respondWithResult(_0x4c00a8,0xc9))['catch'](handleError(_0x4c00a8,null));};exports[_0x43e7('0x20')]=function(_0x47686e,_0x3c96fe){if(_0x47686e['body']['id']){delete _0x47686e['body']['id'];}return db['MemberReport']['find']({'where':{'id':_0x47686e[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x3c96fe,null))['then'](saveUpdates(_0x47686e[_0x43e7('0x47')],null))[_0x43e7('0x21')](respondWithResult(_0x3c96fe,null))[_0x43e7('0x45')](handleError(_0x3c96fe,null));};exports[_0x43e7('0x22')]=function(_0x4a0ce5,_0x2718d5){return db['MemberReport']['find']({'where':{'id':_0x4a0ce5[_0x43e7('0x42')]['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x2718d5,null))[_0x43e7('0x21')](removeEntity(_0x2718d5,null))[_0x43e7('0x45')](handleError(_0x2718d5,null));};exports[_0x43e7('0x48')]=function(_0x2351cf,_0x1cd87c){return db[_0x43e7('0x28')][_0x43e7('0x48')]()[_0x43e7('0x21')](respondWithResult(_0x1cd87c,null))['catch'](handleError(_0x1cd87c,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(_0x238671,_0x34aea0){var _0x474844=function(_0x26cab4){while(--_0x26cab4){_0x238671['push'](_0x238671['shift']());}};_0x474844(++_0x34aea0);}(_0x34e8,0x12c));var _0x834e=function(_0x40f1e2,_0x33863a){_0x40f1e2=_0x40f1e2-0x0;var _0x2e6abe=_0x34e8[_0x40f1e2];return _0x2e6abe;};'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 00939be..16c18eb 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 _0xf35d=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','define','MemberReport','report_member','membername_interface','membername','interface'];(function(_0x827aa0,_0x26f731){var _0x5a8a43=function(_0x6dff55){while(--_0x6dff55){_0x827aa0['push'](_0x827aa0['shift']());}};_0x5a8a43(++_0x26f731);}(_0xf35d,0xcc));var _0xdf35=function(_0x2460a4,_0x5c1042){_0x2460a4=_0x2460a4-0x0;var _0x2c5154=_0xf35d[_0x2460a4];return _0x2c5154;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xdf35('0x0'))('api');var moment=require('moment');var BPromise=require(_0xdf35('0x1'));var rp=require(_0xdf35('0x2'));var fs=require('fs');var path=require(_0xdf35('0x3'));var rimraf=require(_0xdf35('0x4'));var config=require(_0xdf35('0x5'));var attributes=require('./memberReport.attributes');module['exports']=function(_0x3a4750,_0x1070e6){return _0x3a4750[_0xdf35('0x6')](_0xdf35('0x7'),attributes,{'tableName':_0xdf35('0x8'),'paranoid':![],'indexes':[{'name':_0xdf35('0x9'),'fields':[_0xdf35('0xa'),_0xdf35('0xb')]}],'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(_0x3872c3,_0x1d5a76){var _0x59939e=function(_0x1f6d66){while(--_0x1f6d66){_0x3872c3['push'](_0x3872c3['shift']());}};_0x59939e(++_0x1d5a76);}(_0xeac9,0xae));var _0x9eac=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xeac9[_0x122096];return _0x3d1966;};'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 5eb523b..8c63de2 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 _0x00cd=['info','result','catch','GetMemberReport','MemberReport','options','raw','where','limit','include','model','attributes','CreateMemberReport','create','body','UpdateMemberReport','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x23e0fd,_0x9765e2){var _0xa76872=function(_0xe2e03){while(--_0xe2e03){_0x23e0fd['push'](_0x23e0fd['shift']());}};_0xa76872(++_0x9765e2);}(_0x00cd,0xee));var _0xd00c=function(_0x4d337e,_0x2f7eed){_0x4d337e=_0x4d337e-0x0;var _0x247963=_0x00cd[_0x4d337e];return _0x247963;};'use strict';var _=require(_0xd00c('0x0'));var util=require(_0xd00c('0x1'));var moment=require(_0xd00c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd00c('0x3'));var db=require(_0xd00c('0x4'))['db'];var utils=require(_0xd00c('0x5'));var logger=require(_0xd00c('0x6'))(_0xd00c('0x7'));var config=require('../../config/environment');var jayson=require(_0xd00c('0x8'));var client=jayson[_0xd00c('0x9')][_0xd00c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6af060,_0x32bead,_0x751801){return new BPromise(function(_0x40c5ad,_0x11092f){return client[_0xd00c('0xb')](_0x6af060,_0x751801)[_0xd00c('0xc')](function(_0x51a639){logger['info'](_0xd00c('0xd'),_0x32bead,_0xd00c('0xe'));logger[_0xd00c('0xf')](_0xd00c('0x10'),_0x32bead,'request\x20sent',JSON[_0xd00c('0x11')](_0x51a639));if(_0x51a639['error']){if(_0x51a639[_0xd00c('0x12')][_0xd00c('0x13')]===0x1f4){logger['error']('MemberReport,\x20%s,\x20%s',_0x32bead,_0x51a639['error']['message']);return _0x11092f(_0x51a639[_0xd00c('0x12')][_0xd00c('0x14')]);}logger[_0xd00c('0x12')]('MemberReport,\x20%s,\x20%s',_0x32bead,_0x51a639[_0xd00c('0x12')]['message']);return _0x40c5ad(_0x51a639[_0xd00c('0x12')][_0xd00c('0x14')]);}else{logger[_0xd00c('0x15')]('MemberReport,\x20%s,\x20%s',_0x32bead,'request\x20sent');_0x40c5ad(_0x51a639[_0xd00c('0x16')][_0xd00c('0x14')]);}})[_0xd00c('0x17')](function(_0x1d7728){logger[_0xd00c('0x12')](_0xd00c('0xd'),_0x32bead,_0x1d7728);_0x11092f(_0x1d7728);});});}exports[_0xd00c('0x18')]=function(_0x3864a9){var _0x4e21ac=this;return new Promise(function(_0x2b167a,_0x2b5243){return db[_0xd00c('0x19')]['findAll']({'raw':_0x3864a9['options']?_0x3864a9[_0xd00c('0x1a')][_0xd00c('0x1b')]===undefined?!![]:![]:!![],'where':_0x3864a9[_0xd00c('0x1a')]?_0x3864a9[_0xd00c('0x1a')][_0xd00c('0x1c')]||null:null,'attributes':_0x3864a9[_0xd00c('0x1a')]?_0x3864a9[_0xd00c('0x1a')]['attributes']||null:null,'limit':_0x3864a9[_0xd00c('0x1a')]?_0x3864a9[_0xd00c('0x1a')][_0xd00c('0x1d')]||null:null,'include':_0x3864a9[_0xd00c('0x1a')]?_0x3864a9[_0xd00c('0x1a')]['include']?_['map'](_0x3864a9[_0xd00c('0x1a')][_0xd00c('0x1e')],function(_0x5bcf19){return{'model':db[_0x5bcf19['model']],'as':_0x5bcf19['as'],'attributes':_0x5bcf19['attributes'],'include':_0x5bcf19[_0xd00c('0x1e')]?_['map'](_0x5bcf19[_0xd00c('0x1e')],function(_0x4a918f){return{'model':db[_0x4a918f[_0xd00c('0x1f')]],'as':_0x4a918f['as'],'attributes':_0x4a918f[_0xd00c('0x20')],'include':_0x4a918f['include']?_['map'](_0x4a918f[_0xd00c('0x1e')],function(_0x32e998){return{'model':db[_0x32e998[_0xd00c('0x1f')]],'as':_0x32e998['as'],'attributes':_0x32e998[_0xd00c('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2f8853){logger[_0xd00c('0x15')](_0xd00c('0x18'),_0x3864a9);logger[_0xd00c('0xf')]('GetMemberReport',_0x3864a9,JSON[_0xd00c('0x11')](_0x2f8853));_0x2b167a(_0x2f8853);})['catch'](function(_0x3e7e2c){logger[_0xd00c('0x12')](_0xd00c('0x18'),_0x3e7e2c[_0xd00c('0x14')],_0x3864a9);_0x2b5243(_0x4e21ac[_0xd00c('0x12')](0x1f4,_0x3e7e2c[_0xd00c('0x14')]));});});};exports[_0xd00c('0x21')]=function(_0x2a4fa4){var _0x1345dd=this;return new Promise(function(_0x4ad9b0,_0x12759f){return db[_0xd00c('0x19')][_0xd00c('0x22')](_0x2a4fa4[_0xd00c('0x23')],{'raw':_0x2a4fa4[_0xd00c('0x1a')]?_0x2a4fa4[_0xd00c('0x1a')][_0xd00c('0x1b')]===undefined?!![]:![]:!![]})[_0xd00c('0xc')](function(_0x4af28e){logger['info'](_0xd00c('0x21'),_0x2a4fa4);logger['debug'](_0xd00c('0x21'),_0x2a4fa4,JSON[_0xd00c('0x11')](_0x4af28e));_0x4ad9b0(_0x4af28e);})[_0xd00c('0x17')](function(_0x1af90a){logger[_0xd00c('0x12')]('CreateMemberReport',_0x1af90a[_0xd00c('0x14')],_0x2a4fa4);_0x12759f(_0x1345dd[_0xd00c('0x12')](0x1f4,_0x1af90a['message']));});});};exports[_0xd00c('0x24')]=function(_0x400ca1){var _0xd3ce8b=this;return new Promise(function(_0x183207,_0x217867){return db[_0xd00c('0x19')]['update'](_0x400ca1[_0xd00c('0x23')],{'raw':_0x400ca1['options']?_0x400ca1[_0xd00c('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x400ca1['options']?_0x400ca1['options'][_0xd00c('0x1c')]||null:null,'attributes':_0x400ca1[_0xd00c('0x1a')]?_0x400ca1[_0xd00c('0x1a')]['attributes']||null:null,'limit':_0x400ca1[_0xd00c('0x1a')]?_0x400ca1[_0xd00c('0x1a')][_0xd00c('0x1d')]||null:null})['then'](function(_0x3ffd0a){logger[_0xd00c('0x15')](_0xd00c('0x24'),_0x400ca1);logger[_0xd00c('0xf')](_0xd00c('0x24'),_0x400ca1,JSON[_0xd00c('0x11')](_0x3ffd0a));_0x183207(_0x3ffd0a);})[_0xd00c('0x17')](function(_0x324f7a){logger[_0xd00c('0x12')](_0xd00c('0x24'),_0x324f7a['message'],_0x400ca1);_0x217867(_0xd3ce8b[_0xd00c('0x12')](0x1f4,_0x324f7a[_0xd00c('0x14')]));});});}; \ No newline at end of file +var _0xe75a=['include','map','model','info','create','body','then','CreateMemberReport','UpdateMemberReport','update','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request\x20sent','debug','stringify','error','code','message','MemberReport,\x20%s,\x20%s','result','catch','GetMemberReport','MemberReport','findAll','options','raw','where','attributes','limit'];(function(_0x370363,_0x15440a){var _0x1a941f=function(_0x584b05){while(--_0x584b05){_0x370363['push'](_0x370363['shift']());}};_0x1a941f(++_0x15440a);}(_0xe75a,0x1de));var _0xae75=function(_0x4a563b,_0x36f42d){_0x4a563b=_0x4a563b-0x0;var _0x2935ef=_0xe75a[_0x4a563b];return _0x2935ef;};'use strict';var _=require(_0xae75('0x0'));var util=require(_0xae75('0x1'));var moment=require('moment');var BPromise=require(_0xae75('0x2'));var rs=require(_0xae75('0x3'));var fs=require('fs');var Redis=require(_0xae75('0x4'));var db=require(_0xae75('0x5'))['db'];var utils=require(_0xae75('0x6'));var logger=require(_0xae75('0x7'))(_0xae75('0x8'));var config=require(_0xae75('0x9'));var jayson=require(_0xae75('0xa'));var client=jayson[_0xae75('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x207d6f,_0x55c165,_0x49ae5b){return new BPromise(function(_0x38e6b4,_0x56114b){return client['request'](_0x207d6f,_0x49ae5b)['then'](function(_0x2124be){logger['info']('MemberReport,\x20%s,\x20%s',_0x55c165,_0xae75('0xc'));logger[_0xae75('0xd')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x55c165,_0xae75('0xc'),JSON[_0xae75('0xe')](_0x2124be));if(_0x2124be['error']){if(_0x2124be[_0xae75('0xf')][_0xae75('0x10')]===0x1f4){logger[_0xae75('0xf')]('MemberReport,\x20%s,\x20%s',_0x55c165,_0x2124be[_0xae75('0xf')][_0xae75('0x11')]);return _0x56114b(_0x2124be[_0xae75('0xf')][_0xae75('0x11')]);}logger[_0xae75('0xf')](_0xae75('0x12'),_0x55c165,_0x2124be[_0xae75('0xf')][_0xae75('0x11')]);return _0x38e6b4(_0x2124be[_0xae75('0xf')][_0xae75('0x11')]);}else{logger['info'](_0xae75('0x12'),_0x55c165,_0xae75('0xc'));_0x38e6b4(_0x2124be[_0xae75('0x13')][_0xae75('0x11')]);}})[_0xae75('0x14')](function(_0x40f0c5){logger['error']('MemberReport,\x20%s,\x20%s',_0x55c165,_0x40f0c5);_0x56114b(_0x40f0c5);});});}exports[_0xae75('0x15')]=function(_0x2cffc8){var _0x3be46c=this;return new Promise(function(_0x582740,_0x6f3141){return db[_0xae75('0x16')][_0xae75('0x17')]({'raw':_0x2cffc8[_0xae75('0x18')]?_0x2cffc8[_0xae75('0x18')][_0xae75('0x19')]===undefined?!![]:![]:!![],'where':_0x2cffc8['options']?_0x2cffc8[_0xae75('0x18')][_0xae75('0x1a')]||null:null,'attributes':_0x2cffc8[_0xae75('0x18')]?_0x2cffc8[_0xae75('0x18')][_0xae75('0x1b')]||null:null,'limit':_0x2cffc8[_0xae75('0x18')]?_0x2cffc8[_0xae75('0x18')][_0xae75('0x1c')]||null:null,'include':_0x2cffc8[_0xae75('0x18')]?_0x2cffc8['options'][_0xae75('0x1d')]?_[_0xae75('0x1e')](_0x2cffc8[_0xae75('0x18')][_0xae75('0x1d')],function(_0x4bdbba){return{'model':db[_0x4bdbba['model']],'as':_0x4bdbba['as'],'attributes':_0x4bdbba[_0xae75('0x1b')],'include':_0x4bdbba['include']?_[_0xae75('0x1e')](_0x4bdbba[_0xae75('0x1d')],function(_0x3f8b21){return{'model':db[_0x3f8b21[_0xae75('0x1f')]],'as':_0x3f8b21['as'],'attributes':_0x3f8b21[_0xae75('0x1b')],'include':_0x3f8b21[_0xae75('0x1d')]?_[_0xae75('0x1e')](_0x3f8b21[_0xae75('0x1d')],function(_0x2af640){return{'model':db[_0x2af640['model']],'as':_0x2af640['as'],'attributes':_0x2af640[_0xae75('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x451304){logger[_0xae75('0x20')]('GetMemberReport',_0x2cffc8);logger['debug'](_0xae75('0x15'),_0x2cffc8,JSON['stringify'](_0x451304));_0x582740(_0x451304);})[_0xae75('0x14')](function(_0x1b5c2f){logger[_0xae75('0xf')](_0xae75('0x15'),_0x1b5c2f['message'],_0x2cffc8);_0x6f3141(_0x3be46c['error'](0x1f4,_0x1b5c2f[_0xae75('0x11')]));});});};exports['CreateMemberReport']=function(_0x182ad6){var _0x58104d=this;return new Promise(function(_0x3e5569,_0xa46550){return db[_0xae75('0x16')][_0xae75('0x21')](_0x182ad6[_0xae75('0x22')],{'raw':_0x182ad6[_0xae75('0x18')]?_0x182ad6[_0xae75('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xae75('0x23')](function(_0x21dcef){logger[_0xae75('0x20')](_0xae75('0x24'),_0x182ad6);logger['debug'](_0xae75('0x24'),_0x182ad6,JSON[_0xae75('0xe')](_0x21dcef));_0x3e5569(_0x21dcef);})[_0xae75('0x14')](function(_0x1b1b4a){logger[_0xae75('0xf')](_0xae75('0x24'),_0x1b1b4a['message'],_0x182ad6);_0xa46550(_0x58104d[_0xae75('0xf')](0x1f4,_0x1b1b4a[_0xae75('0x11')]));});});};exports[_0xae75('0x25')]=function(_0x5f29cd){var _0x2b2384=this;return new Promise(function(_0x298c59,_0x217d7d){return db[_0xae75('0x16')][_0xae75('0x26')](_0x5f29cd[_0xae75('0x22')],{'raw':_0x5f29cd[_0xae75('0x18')]?_0x5f29cd[_0xae75('0x18')][_0xae75('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5f29cd['options']?_0x5f29cd['options'][_0xae75('0x1a')]||null:null,'attributes':_0x5f29cd[_0xae75('0x18')]?_0x5f29cd[_0xae75('0x18')][_0xae75('0x1b')]||null:null,'limit':_0x5f29cd[_0xae75('0x18')]?_0x5f29cd['options']['limit']||null:null})[_0xae75('0x23')](function(_0x1c3aa8){logger[_0xae75('0x20')](_0xae75('0x25'),_0x5f29cd);logger[_0xae75('0xd')](_0xae75('0x25'),_0x5f29cd,JSON[_0xae75('0xe')](_0x1c3aa8));_0x298c59(_0x1c3aa8);})[_0xae75('0x14')](function(_0x41c3a3){logger['error'](_0xae75('0x25'),_0x41c3a3[_0xae75('0x11')],_0x5f29cd);_0x217d7d(_0x2b2384[_0xae75('0xf')](0x1f4,_0x41c3a3['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 6657b36..7b21bf6 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 _0xd983=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports','multer','util','path','express','Router'];(function(_0x3eb4a9,_0x359d73){var _0x48dbad=function(_0x3a3ca6){while(--_0x3a3ca6){_0x3eb4a9['push'](_0x3eb4a9['shift']());}};_0x48dbad(++_0x359d73);}(_0xd983,0x7d));var _0x3d98=function(_0x41fde2,_0x179e55){_0x41fde2=_0x41fde2-0x0;var _0x31a386=_0xd983[_0x41fde2];return _0x31a386;};'use strict';var multer=require(_0x3d98('0x0'));var util=require(_0x3d98('0x1'));var path=require(_0x3d98('0x2'));var timeout=require('connect-timeout');var express=require(_0x3d98('0x3'));var router=express[_0x3d98('0x4')]();var fs_extra=require(_0x3d98('0x5'));var auth=require(_0x3d98('0x6'));var interaction=require(_0x3d98('0x7'));var config=require(_0x3d98('0x8'));var controller=require(_0x3d98('0x9'));router[_0x3d98('0xa')]('/',controller[_0x3d98('0xb')]);module[_0x3d98('0xc')]=router; \ No newline at end of file +var _0xa921=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','multer','path','connect-timeout','express','Router'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xa921,0x181));var _0x1a92=function(_0x577cde,_0x5c6ffe){_0x577cde=_0x577cde-0x0;var _0x23edc1=_0xa921[_0x577cde];return _0x23edc1;};'use strict';var multer=require(_0x1a92('0x0'));var util=require('util');var path=require(_0x1a92('0x1'));var timeout=require(_0x1a92('0x2'));var express=require(_0x1a92('0x3'));var router=express[_0x1a92('0x4')]();var fs_extra=require(_0x1a92('0x5'));var auth=require(_0x1a92('0x6'));var interaction=require(_0x1a92('0x7'));var config=require(_0x1a92('0x8'));var controller=require('./migration.controller');router[_0x1a92('0x9')]('/',controller['index']);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index d49e8bd..2011c26 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 _0xb9aa=['exports','STRING','version'];(function(_0x9b7a64,_0x38d4a8){var _0x33fd98=function(_0x15c82b){while(--_0x15c82b){_0x9b7a64['push'](_0x9b7a64['shift']());}};_0x33fd98(++_0x38d4a8);}(_0xb9aa,0x111));var _0xab9a=function(_0x485bdb,_0x1f64e6){_0x485bdb=_0x485bdb-0x0;var _0x2848c4=_0xb9aa[_0x485bdb];return _0x2848c4;};'use strict';var Sequelize=require('sequelize');module[_0xab9a('0x0')]={'version':{'type':Sequelize[_0xab9a('0x1')],'unique':_0xab9a('0x2')}}; \ No newline at end of file +var _0xbe97=['version','exports','STRING'];(function(_0x399cdd,_0x38df94){var _0x2fefba=function(_0xd74909){while(--_0xd74909){_0x399cdd['push'](_0x399cdd['shift']());}};_0x2fefba(++_0x38df94);}(_0xbe97,0x163));var _0x7be9=function(_0x32e0b6,_0x43e20f){_0x32e0b6=_0x32e0b6-0x0;var _0x315dad=_0xbe97[_0x32e0b6];return _0x315dad;};'use strict';var Sequelize=require('sequelize');module[_0x7be9('0x0')]={'version':{'type':Sequelize[_0x7be9('0x1')],'unique':_0x7be9('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index d8a0866..03000c9 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 _0x1895=['intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','end','offset','limit','undefined','count','Content-Range','apply','update','then','sendStatus','error','stack','status','send','index','map','Migration','fieldName','key','model','name','keys','query','filters'];(function(_0x15fc7a,_0xd21741){var _0x3aa9f4=function(_0x313108){while(--_0x313108){_0x15fc7a['push'](_0x15fc7a['shift']());}};_0x3aa9f4(++_0xd21741);}(_0x1895,0x111));var _0x5189=function(_0x401f01,_0x4e0b18){_0x401f01=_0x401f01-0x0;var _0x2be648=_0x1895[_0x401f01];return _0x2be648;};'use strict';var emlformat=require(_0x5189('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5189('0x1'));var rp=require(_0x5189('0x2'));var moment=require(_0x5189('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5189('0x4'));var util=require('util');var path=require(_0x5189('0x5'));var sox=require(_0x5189('0x6'));var csv=require('to-csv');var ejs=require(_0x5189('0x7'));var fs=require('fs');var fs_extra=require(_0x5189('0x8'));var _=require(_0x5189('0x9'));var squel=require(_0x5189('0xa'));var crypto=require(_0x5189('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5189('0xc'));var toCsv=require(_0x5189('0xd'));var querystring=require(_0x5189('0xe'));var Papa=require(_0x5189('0xf'));var Redis=require('ioredis');var authService=require(_0x5189('0x10'));var qs=require(_0x5189('0x11'));var as=require(_0x5189('0x12'));var hardwareService=require(_0x5189('0x13'));var logger=require(_0x5189('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x5189('0x15'));var licenseUtil=require(_0x5189('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x488e75,_0x1df281){_0x1df281=_0x1df281||0xcc;return function(_0x43be93){if(_0x43be93){return _0x488e75['sendStatus'](_0x1df281);}return _0x488e75['status'](_0x1df281)[_0x5189('0x17')]();};}function respondWithResult(_0x4409d8,_0x95338b){_0x95338b=_0x95338b||0xc8;return function(_0x170466){if(_0x170466){return _0x4409d8['status'](_0x95338b)['json'](_0x170466);}};}function respondWithFilteredResult(_0x3be70d,_0x44f73c){return function(_0x119dbf){if(_0x119dbf){var _0x3f7d16=typeof _0x44f73c[_0x5189('0x18')]==='undefined'&&typeof _0x44f73c[_0x5189('0x19')]===_0x5189('0x1a');var _0x1a1262=_0x119dbf[_0x5189('0x1b')];var _0x2ba964=_0x3f7d16?0x0:_0x44f73c[_0x5189('0x18')];var _0x1211cb=_0x3f7d16?_0x119dbf[_0x5189('0x1b')]:_0x44f73c[_0x5189('0x18')]+_0x44f73c[_0x5189('0x19')];var _0x5c57af;if(_0x1211cb>=_0x1a1262){_0x1211cb=_0x1a1262;_0x5c57af=0xc8;}else{_0x5c57af=0xce;}_0x3be70d['status'](_0x5c57af);return _0x3be70d['set'](_0x5189('0x1c'),_0x2ba964+'-'+_0x1211cb+'/'+_0x1a1262)['json'](_0x119dbf);}return null;};}function patchUpdates(_0x2a3040){return function(_0x3ba344){try{jsonpatch[_0x5189('0x1d')](_0x3ba344,_0x2a3040,!![]);}catch(_0x4c698){return BPromise['reject'](_0x4c698);}return _0x3ba344['save']();};}function saveUpdates(_0x49e262,_0x87bf5c){return function(_0x52e5af){if(_0x52e5af){return _0x52e5af[_0x5189('0x1e')](_0x49e262)['then'](function(_0x3e069c){return _0x3e069c;});}return null;};}function removeEntity(_0x5691a5,_0x283278){return function(_0x2b5576){if(_0x2b5576){return _0x2b5576['destroy']()[_0x5189('0x1f')](function(){_0x5691a5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xa313e5,_0x50233e){return function(_0x2abd93){if(!_0x2abd93){_0xa313e5[_0x5189('0x20')](0x194);}return _0x2abd93;};}function handleError(_0x8308f5,_0x49d677){_0x49d677=_0x49d677||0x1f4;return function(_0x54fe7c){logger[_0x5189('0x21')](_0x54fe7c[_0x5189('0x22')]);if(_0x54fe7c['name']){delete _0x54fe7c['name'];}_0x8308f5[_0x5189('0x23')](_0x49d677)[_0x5189('0x24')](_0x54fe7c);};}exports[_0x5189('0x25')]=function(_0x55101f,_0x474fd6){var _0x40fba4={},_0x289b94={},_0x51debd={'count':0x0,'rows':[]};var _0xbef7c5=_[_0x5189('0x26')](db[_0x5189('0x27')]['rawAttributes'],function(_0x343cfb){return{'name':_0x343cfb[_0x5189('0x28')],'type':_0x343cfb['type'][_0x5189('0x29')]};});_0x289b94[_0x5189('0x2a')]=_[_0x5189('0x26')](_0xbef7c5,_0x5189('0x2b'));_0x289b94['query']=_[_0x5189('0x2c')](_0x55101f[_0x5189('0x2d')]);_0x289b94[_0x5189('0x2e')]=_[_0x5189('0x2f')](_0x289b94[_0x5189('0x2a')],_0x289b94[_0x5189('0x2d')]);_0x40fba4[_0x5189('0x30')]=_[_0x5189('0x2f')](_0x289b94[_0x5189('0x2a')],qs[_0x5189('0x31')](_0x55101f[_0x5189('0x2d')][_0x5189('0x31')]));_0x40fba4[_0x5189('0x30')]=_0x40fba4[_0x5189('0x30')]['length']?_0x40fba4[_0x5189('0x30')]:_0x289b94[_0x5189('0x2a')];if(!_0x55101f[_0x5189('0x2d')][_0x5189('0x32')](_0x5189('0x33'))){_0x40fba4[_0x5189('0x19')]=qs[_0x5189('0x19')](_0x55101f[_0x5189('0x2d')][_0x5189('0x19')]);_0x40fba4[_0x5189('0x18')]=qs[_0x5189('0x18')](_0x55101f[_0x5189('0x2d')]['offset']);}_0x40fba4['order']=qs[_0x5189('0x34')](_0x55101f[_0x5189('0x2d')][_0x5189('0x34')]);_0x40fba4[_0x5189('0x35')]=qs['filters'](_[_0x5189('0x36')](_0x55101f[_0x5189('0x2d')],_0x289b94['filters']),_0xbef7c5);if(_0x55101f[_0x5189('0x2d')]['filter']){_0x40fba4[_0x5189('0x35')]=_[_0x5189('0x37')](_0x40fba4[_0x5189('0x35')],{'$or':_['map'](_0xbef7c5,function(_0x5afa23){if(_0x5afa23['type']!==_0x5189('0x38')){var _0x480279={};_0x480279[_0x5afa23[_0x5189('0x2b')]]={'$like':'%'+_0x55101f[_0x5189('0x2d')][_0x5189('0x39')]+'%'};return _0x480279;}})});}_0x40fba4=_[_0x5189('0x37')]({},_0x40fba4,_0x55101f[_0x5189('0x3a')]);var _0x3629da={'where':_0x40fba4[_0x5189('0x35')]};return db['Migration'][_0x5189('0x1b')](_0x3629da)[_0x5189('0x1f')](function(_0x1a17ad){_0x51debd[_0x5189('0x1b')]=_0x1a17ad;if(_0x55101f[_0x5189('0x2d')][_0x5189('0x3b')]){_0x40fba4[_0x5189('0x3c')]=[{'all':!![]}];}return db['Migration'][_0x5189('0x3d')](_0x40fba4);})[_0x5189('0x1f')](function(_0x5ea52d){_0x51debd[_0x5189('0x3e')]=_0x5ea52d;return _0x51debd;})[_0x5189('0x1f')](respondWithFilteredResult(_0x474fd6,_0x40fba4))[_0x5189('0x3f')](handleError(_0x474fd6,null));}; \ No newline at end of file +var _0x5fd3=['hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','options','findAll','catch','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','map','Migration','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5fd3,0x191));var _0x35fd=function(_0x412433,_0x4245cc){_0x412433=_0x412433-0x0;var _0x505545=_0x5fd3[_0x412433];return _0x505545;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x35fd('0x0'));var zipdir=require(_0x35fd('0x1'));var jsonpatch=require(_0x35fd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x35fd('0x3'));var Mustache=require(_0x35fd('0x4'));var util=require(_0x35fd('0x5'));var path=require('path');var sox=require(_0x35fd('0x6'));var csv=require(_0x35fd('0x7'));var ejs=require(_0x35fd('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fd('0x9'));var squel=require(_0x35fd('0xa'));var crypto=require(_0x35fd('0xb'));var jsforce=require(_0x35fd('0xc'));var deskjs=require(_0x35fd('0xd'));var toCsv=require(_0x35fd('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x35fd('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x35fd('0xf'));var hardwareService=require(_0x35fd('0x10'));var logger=require(_0x35fd('0x11'))(_0x35fd('0x12'));var utils=require(_0x35fd('0x13'));var config=require(_0x35fd('0x14'));var licenseUtil=require(_0x35fd('0x15'));var db=require(_0x35fd('0x16'))['db'];function respondWithStatusCode(_0x12f545,_0x1779d6){_0x1779d6=_0x1779d6||0xcc;return function(_0x26c6fb){if(_0x26c6fb){return _0x12f545[_0x35fd('0x17')](_0x1779d6);}return _0x12f545[_0x35fd('0x18')](_0x1779d6)['end']();};}function respondWithResult(_0x30591d,_0x2b37c7){_0x2b37c7=_0x2b37c7||0xc8;return function(_0x5a63e9){if(_0x5a63e9){return _0x30591d[_0x35fd('0x18')](_0x2b37c7)[_0x35fd('0x19')](_0x5a63e9);}};}function respondWithFilteredResult(_0x5b5313,_0x5b03a7){return function(_0x412f47){if(_0x412f47){var _0x371eb1=typeof _0x5b03a7['offset']==='undefined'&&typeof _0x5b03a7[_0x35fd('0x1a')]===_0x35fd('0x1b');var _0x766d41=_0x412f47[_0x35fd('0x1c')];var _0x2f1513=_0x371eb1?0x0:_0x5b03a7['offset'];var _0x5e4719=_0x371eb1?_0x412f47[_0x35fd('0x1c')]:_0x5b03a7['offset']+_0x5b03a7[_0x35fd('0x1a')];var _0x4f5ba2;if(_0x5e4719>=_0x766d41){_0x5e4719=_0x766d41;_0x4f5ba2=0xc8;}else{_0x4f5ba2=0xce;}_0x5b5313[_0x35fd('0x18')](_0x4f5ba2);return _0x5b5313[_0x35fd('0x1d')](_0x35fd('0x1e'),_0x2f1513+'-'+_0x5e4719+'/'+_0x766d41)[_0x35fd('0x19')](_0x412f47);}return null;};}function patchUpdates(_0x369e7d){return function(_0xcd084){try{jsonpatch[_0x35fd('0x1f')](_0xcd084,_0x369e7d,!![]);}catch(_0x3eac95){return BPromise[_0x35fd('0x20')](_0x3eac95);}return _0xcd084[_0x35fd('0x21')]();};}function saveUpdates(_0x489b45,_0x3551fc){return function(_0x57f5bb){if(_0x57f5bb){return _0x57f5bb[_0x35fd('0x22')](_0x489b45)[_0x35fd('0x23')](function(_0x3b5c72){return _0x3b5c72;});}return null;};}function removeEntity(_0x2e8773,_0x1e287b){return function(_0x241da8){if(_0x241da8){return _0x241da8[_0x35fd('0x24')]()[_0x35fd('0x23')](function(){_0x2e8773[_0x35fd('0x18')](0xcc)[_0x35fd('0x25')]();});}};}function handleEntityNotFound(_0xc37ed3,_0x4d4762){return function(_0x363e5e){if(!_0x363e5e){_0xc37ed3[_0x35fd('0x17')](0x194);}return _0x363e5e;};}function handleError(_0x5971e7,_0x2b62a9){_0x2b62a9=_0x2b62a9||0x1f4;return function(_0x1d92f5){logger[_0x35fd('0x26')](_0x1d92f5['stack']);if(_0x1d92f5[_0x35fd('0x27')]){delete _0x1d92f5[_0x35fd('0x27')];}_0x5971e7[_0x35fd('0x18')](_0x2b62a9)[_0x35fd('0x28')](_0x1d92f5);};}exports['index']=function(_0xf746f6,_0x4e0210){var _0x45585f={},_0x409101={},_0x2a68f7={'count':0x0,'rows':[]};var _0x45f7c1=_[_0x35fd('0x29')](db[_0x35fd('0x2a')][_0x35fd('0x2b')],function(_0x7af4b2){return{'name':_0x7af4b2[_0x35fd('0x2c')],'type':_0x7af4b2[_0x35fd('0x2d')][_0x35fd('0x2e')]};});_0x409101[_0x35fd('0x2f')]=_['map'](_0x45f7c1,_0x35fd('0x27'));_0x409101[_0x35fd('0x30')]=_['keys'](_0xf746f6['query']);_0x409101[_0x35fd('0x31')]=_[_0x35fd('0x32')](_0x409101[_0x35fd('0x2f')],_0x409101[_0x35fd('0x30')]);_0x45585f[_0x35fd('0x33')]=_[_0x35fd('0x32')](_0x409101[_0x35fd('0x2f')],qs[_0x35fd('0x34')](_0xf746f6['query']['fields']));_0x45585f['attributes']=_0x45585f[_0x35fd('0x33')][_0x35fd('0x35')]?_0x45585f['attributes']:_0x409101['model'];if(!_0xf746f6['query'][_0x35fd('0x36')](_0x35fd('0x37'))){_0x45585f[_0x35fd('0x1a')]=qs[_0x35fd('0x1a')](_0xf746f6['query'][_0x35fd('0x1a')]);_0x45585f['offset']=qs[_0x35fd('0x38')](_0xf746f6[_0x35fd('0x30')][_0x35fd('0x38')]);}_0x45585f['order']=qs['sort'](_0xf746f6['query'][_0x35fd('0x39')]);_0x45585f[_0x35fd('0x3a')]=qs[_0x35fd('0x31')](_[_0x35fd('0x3b')](_0xf746f6[_0x35fd('0x30')],_0x409101[_0x35fd('0x31')]),_0x45f7c1);if(_0xf746f6[_0x35fd('0x30')][_0x35fd('0x3c')]){_0x45585f[_0x35fd('0x3a')]=_[_0x35fd('0x3d')](_0x45585f[_0x35fd('0x3a')],{'$or':_[_0x35fd('0x29')](_0x45f7c1,function(_0x5cf040){if(_0x5cf040[_0x35fd('0x2d')]!=='VIRTUAL'){var _0x24ab6c={};_0x24ab6c[_0x5cf040['name']]={'$like':'%'+_0xf746f6[_0x35fd('0x30')]['filter']+'%'};return _0x24ab6c;}})});}_0x45585f=_[_0x35fd('0x3d')]({},_0x45585f,_0xf746f6[_0x35fd('0x3e')]);var _0x481e21={'where':_0x45585f[_0x35fd('0x3a')]};return db[_0x35fd('0x2a')]['count'](_0x481e21)['then'](function(_0x1693be){_0x2a68f7[_0x35fd('0x1c')]=_0x1693be;if(_0xf746f6[_0x35fd('0x30')]['includeAll']){_0x45585f['include']=[{'all':!![]}];}return db['Migration'][_0x35fd('0x3f')](_0x45585f);})[_0x35fd('0x23')](function(_0x4e50e4){_0x2a68f7['rows']=_0x4e50e4;return _0x2a68f7;})['then'](respondWithFilteredResult(_0x4e0210,_0x45585f))[_0x35fd('0x40')](handleError(_0x4e0210,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 9ad624d..224f9b9 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 _0x6749=['moment','bluebird','request-promise','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','migrations','lodash','util','../../config/logger'];(function(_0x24bec0,_0x15707f){var _0x358562=function(_0x37c7af){while(--_0x37c7af){_0x24bec0['push'](_0x24bec0['shift']());}};_0x358562(++_0x15707f);}(_0x6749,0x19d));var _0x9674=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6749[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9674('0x0'));var util=require(_0x9674('0x1'));var logger=require(_0x9674('0x2'))('api');var moment=require(_0x9674('0x3'));var BPromise=require(_0x9674('0x4'));var rp=require(_0x9674('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9674('0x6'));var config=require(_0x9674('0x7'));var attributes=require(_0x9674('0x8'));module[_0x9674('0x9')]=function(_0x601b95,_0x229f4f){return _0x601b95[_0x9674('0xa')](_0x9674('0xb'),attributes,{'tableName':_0x9674('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7357=['lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','Migration','migrations'];(function(_0xd4e208,_0x10f34e){var _0x1d5ae3=function(_0x39d514){while(--_0x39d514){_0xd4e208['push'](_0xd4e208['shift']());}};_0x1d5ae3(++_0x10f34e);}(_0x7357,0x18c));var _0x7735=function(_0x14ef59,_0x331571){_0x14ef59=_0x14ef59-0x0;var _0x2cf4c5=_0x7357[_0x14ef59];return _0x2cf4c5;};'use strict';var _=require(_0x7735('0x0'));var util=require(_0x7735('0x1'));var logger=require(_0x7735('0x2'))(_0x7735('0x3'));var moment=require(_0x7735('0x4'));var BPromise=require('bluebird');var rp=require(_0x7735('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7735('0x6'));var config=require(_0x7735('0x7'));var attributes=require('./migration.attributes');module[_0x7735('0x8')]=function(_0x1c81a9,_0x18c90c){return _0x1c81a9[_0x7735('0x9')](_0x7735('0xa'),attributes,{'tableName':_0x7735('0xb'),'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 8c5b7d4..1ec7fd3 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 _0x0f88=['../../config/utils','rpc','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_0x0f88,0x1d9));var _0x80f8=function(_0x3588ba,_0x5c49f3){_0x3588ba=_0x3588ba-0x0;var _0x3695a2=_0x0f88[_0x3588ba];return _0x3695a2;};'use strict';var _=require(_0x80f8('0x0'));var util=require(_0x80f8('0x1'));var moment=require(_0x80f8('0x2'));var BPromise=require(_0x80f8('0x3'));var rs=require(_0x80f8('0x4'));var fs=require('fs');var Redis=require(_0x80f8('0x5'));var db=require(_0x80f8('0x6'))['db'];var utils=require(_0x80f8('0x7'));var logger=require('../../config/logger')(_0x80f8('0x8'));var config=require('../../config/environment');var jayson=require(_0x80f8('0x9'));var client=jayson[_0x80f8('0xa')][_0x80f8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18cd5e,_0x3db34c,_0x279479){return new BPromise(function(_0x3d6ad3,_0x2bb7aa){return client[_0x80f8('0xc')](_0x18cd5e,_0x279479)[_0x80f8('0xd')](function(_0x26c259){logger[_0x80f8('0xe')](_0x80f8('0xf'),_0x3db34c,_0x80f8('0x10'));logger[_0x80f8('0x11')](_0x80f8('0x12'),_0x3db34c,_0x80f8('0x10'),JSON[_0x80f8('0x13')](_0x26c259));if(_0x26c259[_0x80f8('0x14')]){if(_0x26c259[_0x80f8('0x14')]['code']===0x1f4){logger[_0x80f8('0x14')](_0x80f8('0xf'),_0x3db34c,_0x26c259[_0x80f8('0x14')]['message']);return _0x2bb7aa(_0x26c259[_0x80f8('0x14')][_0x80f8('0x15')]);}logger[_0x80f8('0x14')]('Migration,\x20%s,\x20%s',_0x3db34c,_0x26c259['error']['message']);return _0x3d6ad3(_0x26c259['error'][_0x80f8('0x15')]);}else{logger['info'](_0x80f8('0xf'),_0x3db34c,_0x80f8('0x10'));_0x3d6ad3(_0x26c259[_0x80f8('0x16')][_0x80f8('0x15')]);}})[_0x80f8('0x17')](function(_0x12e53c){logger[_0x80f8('0x14')](_0x80f8('0xf'),_0x3db34c,_0x12e53c);_0x2bb7aa(_0x12e53c);});});} \ No newline at end of file +var _0xa047=['rpc','../../config/environment','jayson/promise','http','then','Migration,\x20%s,\x20%s','Migration,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger'];(function(_0x7c4782,_0x14edc9){var _0x1c5595=function(_0x465e2a){while(--_0x465e2a){_0x7c4782['push'](_0x7c4782['shift']());}};_0x1c5595(++_0x14edc9);}(_0xa047,0x1c5));var _0x7a04=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0xa047[_0x37e845];return _0x59e55b;};'use strict';var _=require(_0x7a04('0x0'));var util=require(_0x7a04('0x1'));var moment=require(_0x7a04('0x2'));var BPromise=require(_0x7a04('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7a04('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7a04('0x5'));var logger=require(_0x7a04('0x6'))(_0x7a04('0x7'));var config=require(_0x7a04('0x8'));var jayson=require(_0x7a04('0x9'));var client=jayson['client'][_0x7a04('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3166ff,_0x1dc89f,_0x5c183c){return new BPromise(function(_0x10d92f,_0x10faf9){return client['request'](_0x3166ff,_0x5c183c)[_0x7a04('0xb')](function(_0xc64317){logger['info'](_0x7a04('0xc'),_0x1dc89f,'request\x20sent');logger['debug'](_0x7a04('0xd'),_0x1dc89f,_0x7a04('0xe'),JSON['stringify'](_0xc64317));if(_0xc64317['error']){if(_0xc64317['error'][_0x7a04('0xf')]===0x1f4){logger[_0x7a04('0x10')](_0x7a04('0xc'),_0x1dc89f,_0xc64317[_0x7a04('0x10')][_0x7a04('0x11')]);return _0x10faf9(_0xc64317[_0x7a04('0x10')][_0x7a04('0x11')]);}logger[_0x7a04('0x10')](_0x7a04('0xc'),_0x1dc89f,_0xc64317['error'][_0x7a04('0x11')]);return _0x10d92f(_0xc64317[_0x7a04('0x10')][_0x7a04('0x11')]);}else{logger[_0x7a04('0x12')](_0x7a04('0xc'),_0x1dc89f,_0x7a04('0xe'));_0x10d92f(_0xc64317['result'][_0x7a04('0x11')]);}})[_0x7a04('0x13')](function(_0x400468){logger['error']('Migration,\x20%s,\x20%s',_0x1dc89f,_0x400468);_0x10faf9(_0x400468);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index c314377..a9e88dc 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 _0xb758=['show','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./network.controller','isAuthenticated','index','get','/:id'];(function(_0x21233e,_0x2d39c1){var _0x3752c9=function(_0x1201f3){while(--_0x1201f3){_0x21233e['push'](_0x21233e['shift']());}};_0x3752c9(++_0x2d39c1);}(_0xb758,0x14a));var _0x8b75=function(_0x6aad74,_0x32ecf4){_0x6aad74=_0x6aad74-0x0;var _0x5b1c38=_0xb758[_0x6aad74];return _0x5b1c38;};'use strict';var multer=require(_0x8b75('0x0'));var util=require(_0x8b75('0x1'));var path=require(_0x8b75('0x2'));var timeout=require(_0x8b75('0x3'));var express=require('express');var router=express[_0x8b75('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8b75('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b75('0x6'));var controller=require(_0x8b75('0x7'));router['get']('/',auth[_0x8b75('0x8')](),controller[_0x8b75('0x9')]);router[_0x8b75('0xa')](_0x8b75('0xb'),auth[_0x8b75('0x8')](),controller[_0x8b75('0xc')]);router[_0x8b75('0xd')]('/',auth[_0x8b75('0x8')](),controller[_0x8b75('0xe')]);router[_0x8b75('0xf')](_0x8b75('0xb'),auth[_0x8b75('0x8')](),controller['update']);router[_0x8b75('0x10')](_0x8b75('0xb'),auth[_0x8b75('0x8')](),controller[_0x8b75('0x11')]);module[_0x8b75('0x12')]=router; \ No newline at end of file +var _0x9f37=['exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./network.controller','get','/:id','isAuthenticated','show','create','update','delete','destroy'];(function(_0x437757,_0x1ae060){var _0x37e514=function(_0x3d914f){while(--_0x3d914f){_0x437757['push'](_0x437757['shift']());}};_0x37e514(++_0x1ae060);}(_0x9f37,0xd1));var _0x79f3=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x9f37[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x79f3('0x0'));var util=require(_0x79f3('0x1'));var path=require('path');var timeout=require(_0x79f3('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x79f3('0x3'));var auth=require(_0x79f3('0x4'));var interaction=require(_0x79f3('0x5'));var config=require('../../config/environment');var controller=require(_0x79f3('0x6'));router[_0x79f3('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x79f3('0x7')](_0x79f3('0x8'),auth[_0x79f3('0x9')](),controller[_0x79f3('0xa')]);router['post']('/',auth[_0x79f3('0x9')](),controller[_0x79f3('0xb')]);router['put'](_0x79f3('0x8'),auth[_0x79f3('0x9')](),controller[_0x79f3('0xc')]);router[_0x79f3('0xd')](_0x79f3('0x8'),auth['isAuthenticated'](),controller[_0x79f3('0xe')]);module[_0x79f3('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 fcaf56b..006e497 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 _0xd8f3=['ENUM','localnet','stun','STRING','exports'];(function(_0xe34243,_0x2744e5){var _0x3db09d=function(_0xeef42b){while(--_0xeef42b){_0xe34243['push'](_0xe34243['shift']());}};_0x3db09d(++_0x2744e5);}(_0xd8f3,0xe0));var _0x3d8f=function(_0x26231c,_0xa8344a){_0x26231c=_0x26231c-0x0;var _0x33e4f4=_0xd8f3[_0x26231c];return _0x33e4f4;};'use strict';var Sequelize=require('sequelize');module[_0x3d8f('0x0')]={'type':{'type':Sequelize[_0x3d8f('0x1')](_0x3d8f('0x2'),'externip',_0x3d8f('0x3'),'turn')},'value':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x3d8f('0x4')]},'password':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb183=['ENUM','localnet','externip','turn','STRING','sequelize','exports'];(function(_0x506033,_0x7fe3c4){var _0x3d1e67=function(_0x19244c){while(--_0x19244c){_0x506033['push'](_0x506033['shift']());}};_0x3d1e67(++_0x7fe3c4);}(_0xb183,0x1e8));var _0x3b18=function(_0x2f5c6c,_0x5e3539){_0x2f5c6c=_0x2f5c6c-0x0;var _0x1c91a1=_0xb183[_0x2f5c6c];return _0x1c91a1;};'use strict';var Sequelize=require(_0x3b18('0x0'));module[_0x3b18('0x1')]={'type':{'type':Sequelize[_0x3b18('0x2')](_0x3b18('0x3'),_0x3b18('0x4'),'stun',_0x3b18('0x5'))},'value':{'type':Sequelize[_0x3b18('0x6')]},'username':{'type':Sequelize[_0x3b18('0x6')]},'password':{'type':Sequelize[_0x3b18('0x6')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index 4560cf8..9354417 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 _0x15a0=['chan_sip.so','util','path','ejs','lodash','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','json','offset','undefined','limit','count','status','set','update','destroy','end','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','Network','includeAll','include','findAll','rows','show','params','find','create','body','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','toUpperCase'];(function(_0x5ad190,_0xd39c9e){var _0x518ed3=function(_0x57f03a){while(--_0x57f03a){_0x5ad190['push'](_0x5ad190['shift']());}};_0x518ed3(++_0xd39c9e);}(_0x15a0,0x1aa));var _0x015a=function(_0x186d17,_0x9fa8ef){_0x186d17=_0x186d17-0x0;var _0x5d4b89=_0x15a0[_0x186d17];return _0x5d4b89;};'use strict';var util=require(_0x015a('0x0'));var path=require(_0x015a('0x1'));var ejs=require(_0x015a('0x2'));var fs=require('fs');var _=require(_0x015a('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x015a('0x4'))(_0x015a('0x5'));var config=require('../../config/environment');var db=require(_0x015a('0x6'))['db'];var jayson=require(_0x015a('0x7'));var client=jayson[_0x015a('0x8')][_0x015a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x49f95d,_0x4e3f07,_0x352be2,_0x5639fb){return new Promise(function(_0x39c587,_0x2e4d72){var _0x2e6346=_0x5639fb||client;return _0x2e6346[_0x015a('0xa')](_0x49f95d,_0x352be2)[_0x015a('0xb')](function(_0x1f253f){logger[_0x015a('0xc')](_0x015a('0xd'),_0x4e3f07,_0x015a('0xe'));logger[_0x015a('0xf')](_0x015a('0x10'),_0x4e3f07,_0x015a('0xe'),JSON[_0x015a('0x11')](_0x1f253f));if(_0x1f253f[_0x015a('0x12')]){if(_0x1f253f[_0x015a('0x12')][_0x015a('0x13')]===0x1f4){logger[_0x015a('0x12')](_0x015a('0xd'),_0x4e3f07,_0x1f253f[_0x015a('0x12')][_0x015a('0x14')]);return _0x2e4d72(_0x1f253f[_0x015a('0x12')][_0x015a('0x14')]);}logger[_0x015a('0x12')](_0x015a('0xd'),_0x4e3f07,_0x1f253f[_0x015a('0x12')][_0x015a('0x14')]);return _0x39c587(_0x1f253f[_0x015a('0x12')]['message']);}else{logger[_0x015a('0xc')]('Network,\x20%s,\x20%s',_0x4e3f07,'request\x20sent');_0x39c587(_0x1f253f[_0x015a('0x15')]['message']);}})[_0x015a('0x16')](function(_0x1b919e){logger[_0x015a('0x12')](_0x015a('0xd'),_0x4e3f07,_0x1b919e);_0x2e4d72(_0x1b919e);});});}function respondWithResult(_0x2a89ac,_0x48fbaf){_0x48fbaf=_0x48fbaf||0xc8;return function(_0x299270){if(_0x299270){return _0x2a89ac['status'](_0x48fbaf)[_0x015a('0x17')](_0x299270);}};}function respondWithFilteredResult(_0x4ee227,_0x550146){return function(_0x10b9cb){if(_0x10b9cb){var _0x2a1eed=typeof _0x550146[_0x015a('0x18')]===_0x015a('0x19')&&typeof _0x550146[_0x015a('0x1a')]===_0x015a('0x19');var _0x23435d=_0x10b9cb[_0x015a('0x1b')];var _0xdff349=_0x2a1eed?0x0:_0x550146['offset'];var _0x255d57=_0x2a1eed?_0x10b9cb[_0x015a('0x1b')]:_0x550146[_0x015a('0x18')]+_0x550146[_0x015a('0x1a')];var _0x32c010;if(_0x255d57>=_0x23435d){_0x255d57=_0x23435d;_0x32c010=0xc8;}else{_0x32c010=0xce;}_0x4ee227[_0x015a('0x1c')](_0x32c010);return _0x4ee227[_0x015a('0x1d')]('Content-Range',_0xdff349+'-'+_0x255d57+'/'+_0x23435d)[_0x015a('0x17')](_0x10b9cb);}return null;};}function saveUpdates(_0xea474b){return function(_0x3b2257){if(_0x3b2257){return _0x3b2257[_0x015a('0x1e')](_0xea474b)[_0x015a('0xb')](function(_0x295ec0){return _0x295ec0;});}return null;};}function removeEntity(_0x204ce3){return function(_0x229e40){if(_0x229e40){return _0x229e40[_0x015a('0x1f')]()[_0x015a('0xb')](function(){_0x204ce3[_0x015a('0x1c')](0xcc)[_0x015a('0x20')]();});}};}function handleEntityNotFound(_0x2910d6){return function(_0x7fc1cc){if(!_0x7fc1cc){_0x2910d6['sendStatus'](0x194);}return _0x7fc1cc;};}function handleError(_0x49ae2b,_0x441fcf){_0x441fcf=_0x441fcf||0x1f4;return function(_0x2f1066){logger['error'](_0x2f1066['stack']);if(_0x2f1066[_0x015a('0x21')]){delete _0x2f1066['name'];}_0x49ae2b[_0x015a('0x1c')](_0x441fcf)['send'](_0x2f1066);};}exports['index']=function(_0x5c50a9,_0x18d712){var _0xe831f4={},_0x348114={},_0x53ebc8={'count':0x0,'rows':[]};var _0x1a2544=_[_0x015a('0x22')](db['Network'][_0x015a('0x23')],function(_0x144e57){return{'name':_0x144e57[_0x015a('0x24')],'type':_0x144e57[_0x015a('0x25')][_0x015a('0x26')]};});_0x348114[_0x015a('0x27')]=_[_0x015a('0x22')](_0x1a2544,_0x015a('0x21'));_0x348114[_0x015a('0x28')]=_[_0x015a('0x29')](_0x5c50a9[_0x015a('0x28')]);_0x348114[_0x015a('0x2a')]=_[_0x015a('0x2b')](_0x348114[_0x015a('0x27')],_0x348114[_0x015a('0x28')]);_0xe831f4[_0x015a('0x2c')]=_[_0x015a('0x2b')](_0x348114[_0x015a('0x27')],qs[_0x015a('0x2d')](_0x5c50a9['query'][_0x015a('0x2d')]));_0xe831f4[_0x015a('0x2c')]=_0xe831f4[_0x015a('0x2c')][_0x015a('0x2e')]?_0xe831f4['attributes']:_0x348114['model'];if(!_0x5c50a9[_0x015a('0x28')][_0x015a('0x2f')](_0x015a('0x30'))){_0xe831f4[_0x015a('0x1a')]=qs[_0x015a('0x1a')](_0x5c50a9['query']['limit']);_0xe831f4[_0x015a('0x18')]=qs['offset'](_0x5c50a9[_0x015a('0x28')][_0x015a('0x18')]);}_0xe831f4[_0x015a('0x31')]=qs[_0x015a('0x32')](_0x5c50a9[_0x015a('0x28')][_0x015a('0x32')]);_0xe831f4[_0x015a('0x33')]=qs['filters'](_['pick'](_0x5c50a9['query'],_0x348114[_0x015a('0x2a')]),_0x1a2544);if(_0x5c50a9['query']['filter']){_0xe831f4[_0x015a('0x33')]=_['merge'](_0xe831f4[_0x015a('0x33')],{'$or':_[_0x015a('0x22')](_0x1a2544,function(_0x2bfdd2){if(_0x2bfdd2[_0x015a('0x25')]!=='VIRTUAL'){var _0x4f74d6={};_0x4f74d6[_0x2bfdd2[_0x015a('0x21')]]={'$like':'%'+_0x5c50a9['query'][_0x015a('0x34')]+'%'};return _0x4f74d6;}})});}_0xe831f4=_[_0x015a('0x35')]({},_0xe831f4,_0x5c50a9[_0x015a('0x36')]);var _0x550e9f={'where':_0xe831f4['where']};return db[_0x015a('0x37')][_0x015a('0x1b')](_0x550e9f)[_0x015a('0xb')](function(_0x1d64c3){_0x53ebc8[_0x015a('0x1b')]=_0x1d64c3;if(_0x5c50a9[_0x015a('0x28')][_0x015a('0x38')]){_0xe831f4[_0x015a('0x39')]=[{'all':!![]}];}return db[_0x015a('0x37')][_0x015a('0x3a')](_0xe831f4);})['then'](function(_0x43f0fc){_0x53ebc8[_0x015a('0x3b')]=_0x43f0fc;return _0x53ebc8;})[_0x015a('0xb')](respondWithFilteredResult(_0x18d712,_0xe831f4))[_0x015a('0x16')](handleError(_0x18d712,null));};exports[_0x015a('0x3c')]=function(_0x5ddd94,_0x3a4dce){var _0x484051={'raw':!![],'where':{'id':_0x5ddd94[_0x015a('0x3d')]['id']}},_0x30db32={};_0x30db32['model']=_[_0x015a('0x29')](db[_0x015a('0x37')]['rawAttributes']);_0x30db32['query']=_[_0x015a('0x29')](_0x5ddd94['query']);_0x30db32[_0x015a('0x2a')]=_['intersection'](_0x30db32[_0x015a('0x27')],_0x30db32[_0x015a('0x28')]);_0x484051[_0x015a('0x2c')]=_[_0x015a('0x2b')](_0x30db32[_0x015a('0x27')],qs[_0x015a('0x2d')](_0x5ddd94[_0x015a('0x28')][_0x015a('0x2d')]));_0x484051[_0x015a('0x2c')]=_0x484051[_0x015a('0x2c')]['length']?_0x484051[_0x015a('0x2c')]:_0x30db32[_0x015a('0x27')];if(_0x5ddd94[_0x015a('0x28')]['includeAll']){_0x484051[_0x015a('0x39')]=[{'all':!![]}];}_0x484051=_[_0x015a('0x35')]({},_0x484051,_0x5ddd94[_0x015a('0x36')]);return db[_0x015a('0x37')][_0x015a('0x3e')](_0x484051)['then'](handleEntityNotFound(_0x3a4dce,null))['then'](respondWithResult(_0x3a4dce,null))[_0x015a('0x16')](handleError(_0x3a4dce,null));};exports['create']=function(_0x5b14d3,_0x412b3f){var _0x11fc52;return db[_0x015a('0x37')][_0x015a('0x3f')](_0x5b14d3[_0x015a('0x40')],{'raw':!![]})[_0x015a('0xb')](function(_0x458571){_0x11fc52=_0x458571;return db[_0x015a('0x37')][_0x015a('0x3a')]({'where':{'type':_0x5b14d3[_0x015a('0x40')]['type']},'raw':!![]});})['then'](function(_0x3a1c7c){if(_0x11fc52[_0x015a('0x25')]['toUpperCase']()==_0x015a('0x41')){var _0x540be3=fs[_0x015a('0x42')](path[_0x015a('0x43')](config[_0x015a('0x44')],_0x015a('0x45')),_0x015a('0x46'));var _0x59dbef=ejs[_0x015a('0x47')](_0x540be3,{'networks':_0x3a1c7c||[]});fs[_0x015a('0x48')](_0x015a('0x49'),_0x59dbef);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x3f'),{'module':_0x015a('0x4b')});}else if(_0x11fc52[_0x015a('0x25')]['toUpperCase']()==_0x015a('0x4c')){var _0x479e9f=fs[_0x015a('0x42')](path[_0x015a('0x43')](config[_0x015a('0x44')],_0x015a('0x4d')),_0x015a('0x46'));var _0x5af999=ejs[_0x015a('0x47')](_0x479e9f,{'networks':_0x3a1c7c||[]});fs[_0x015a('0x48')](_0x015a('0x4e'),_0x5af999);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x3f'),{'module':_0x015a('0x4b')});}else{var _0x31ce57=fs['readFileSync'](path[_0x015a('0x43')](config['root'],_0x015a('0x4f')),_0x015a('0x46'));var _0x423366=ejs[_0x015a('0x47')](_0x31ce57,{'networks':_0x3a1c7c||[]});fs[_0x015a('0x48')](util[_0x015a('0x50')](_0x015a('0x51'),_0x5b14d3[_0x015a('0x40')][_0x015a('0x25')][_0x015a('0x52')]()),_0x423366);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x3f'),{'module':'chan_sip.so'});}})['then'](function(){return _0x11fc52;})[_0x015a('0xb')](respondWithResult(_0x412b3f,0xc9))[_0x015a('0x16')](handleError(_0x412b3f,null));};exports[_0x015a('0x1e')]=function(_0x12601d,_0x6b83a){var _0x3c770e;return db['Network'][_0x015a('0x3e')]({'where':{'id':_0x12601d[_0x015a('0x3d')]['id']}})[_0x015a('0xb')](handleEntityNotFound(_0x6b83a,null))[_0x015a('0xb')](saveUpdates(_0x12601d['body'],null))[_0x015a('0xb')](function(_0x2a560f){if(_0x2a560f){_0x3c770e=_0x2a560f;return db['Network'][_0x015a('0x3a')]({'where':{'type':_0x3c770e[_0x015a('0x25')]},'raw':!![]});}return null;})[_0x015a('0xb')](function(_0x4723f7){if(_0x3c770e[_0x015a('0x25')][_0x015a('0x53')]()==_0x015a('0x41')){var _0x24b897=fs['readFileSync'](path['join'](config[_0x015a('0x44')],'server/files/templates/stun_multiple.ejs'),_0x015a('0x46'));var _0x2dd86b=ejs['render'](_0x24b897,{'networks':_0x4723f7||[]});fs[_0x015a('0x48')]('/etc/asterisk/stun_xcally.conf',_0x2dd86b);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x1e'),{'module':_0x015a('0x4b')});}else if(_0x3c770e[_0x015a('0x25')][_0x015a('0x53')]()=='TURN'){var _0x846f03=fs[_0x015a('0x42')](path[_0x015a('0x43')](config[_0x015a('0x44')],_0x015a('0x4d')),_0x015a('0x46'));var _0x55d6ff=ejs[_0x015a('0x47')](_0x846f03,{'networks':_0x4723f7||[]});fs[_0x015a('0x48')]('/etc/asterisk/turn_xcally.conf',_0x55d6ff);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x1e'),{'module':_0x015a('0x4b')});}else{var _0x186f2d=fs[_0x015a('0x42')](path[_0x015a('0x43')](config[_0x015a('0x44')],_0x015a('0x4f')),_0x015a('0x46'));var _0x51fdec=ejs[_0x015a('0x47')](_0x186f2d,{'networks':_0x4723f7||[]});fs[_0x015a('0x48')](util['format'](_0x015a('0x51'),_0x12601d[_0x015a('0x40')]['type']['toLowerCase']()),_0x51fdec);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x1e'),{'module':'chan_sip.so'});}})[_0x015a('0xb')](function(_0xe6bac3){if(_0xe6bac3){return _0x3c770e;}return null;})[_0x015a('0xb')](respondWithResult(_0x6b83a,null))[_0x015a('0x16')](handleError(_0x6b83a,null));};exports[_0x015a('0x1f')]=function(_0x518040,_0x5a9c05){var _0x1cf8c8;return db['Network'][_0x015a('0x3e')]({'where':{'id':_0x518040[_0x015a('0x3d')]['id']}})[_0x015a('0xb')](function(_0x19fadc){_0x1cf8c8=_0x19fadc;return _0x19fadc;})[_0x015a('0xb')](handleEntityNotFound(_0x5a9c05,null))[_0x015a('0xb')](removeEntity(_0x5a9c05,null))[_0x015a('0xb')](function(){if(_0x1cf8c8){return db[_0x015a('0x37')]['findAll']({'where':{'type':_0x1cf8c8[_0x015a('0x25')]},'raw':!![]});}})[_0x015a('0xb')](function(_0x556d5b){if(_0x1cf8c8['type']['toUpperCase']()==_0x015a('0x41')){var _0x2e6773=fs[_0x015a('0x42')](path[_0x015a('0x43')](config[_0x015a('0x44')],_0x015a('0x45')),_0x015a('0x46'));var _0x3f5dcd=ejs[_0x015a('0x47')](_0x2e6773,{'networks':_0x556d5b||[]});fs[_0x015a('0x48')](_0x015a('0x49'),_0x3f5dcd);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x1f'),{'module':_0x015a('0x4b')});}else if(_0x1cf8c8[_0x015a('0x25')]['toUpperCase']()=='TURN'){var _0x547761=fs[_0x015a('0x42')](path[_0x015a('0x43')](config[_0x015a('0x44')],_0x015a('0x4d')),_0x015a('0x46'));var _0x10d9b0=ejs['render'](_0x547761,{'networks':_0x556d5b||[]});fs[_0x015a('0x48')]('/etc/asterisk/turn_xcally.conf',_0x10d9b0);return respondWithRpcPromise(_0x015a('0x4a'),_0x015a('0x1f'),{'module':_0x015a('0x4b')});}else{var _0x4bee53=fs[_0x015a('0x42')](path['join'](config[_0x015a('0x44')],_0x015a('0x4f')),'utf8');var _0x54bc40=ejs['render'](_0x4bee53,{'networks':_0x556d5b||[]});fs['writeFileSync'](util[_0x015a('0x50')](_0x015a('0x51'),_0x1cf8c8[_0x015a('0x25')][_0x015a('0x52')]()),_0x54bc40);return respondWithRpcPromise('Reload',_0x015a('0x1f'),{'module':_0x015a('0x54')});}})[_0x015a('0x16')](handleError(_0x5a9c05,null));}; \ No newline at end of file +var _0x2bc8=['server/files/templates/stun_multiple.ejs','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','toUpperCase','TURN','root','server/files/templates/turn_multiple.ejs','utf8','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','toLowerCase','destroy','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../mysqldb','client','request','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','undefined','limit','count','offset','Content-Range','update','sendStatus','stack','name','send','index','Network','fieldName','key','model','map','query','keys','filters','attributes','intersection','fields','hasOwnProperty','sort','where','pick','merge','filter','options','then','includeAll','include','findAll','rows','show','params','rawAttributes','length','find','create','body','type','STUN','readFileSync','join'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x2bc8,0x166));var _0x82bc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2bc8[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var path=require(_0x82bc('0x0'));var ejs=require(_0x82bc('0x1'));var fs=require('fs');var _=require(_0x82bc('0x2'));var qs=require(_0x82bc('0x3'));var logger=require(_0x82bc('0x4'))(_0x82bc('0x5'));var config=require('../../config/environment');var db=require(_0x82bc('0x6'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x82bc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x458391,_0x5522e9,_0x478686,_0x3b01f2){return new Promise(function(_0x4f9718,_0x49bcd0){var _0x15b9c8=_0x3b01f2||client;return _0x15b9c8[_0x82bc('0x8')](_0x458391,_0x478686)['then'](function(_0xba8c4b){logger[_0x82bc('0x9')](_0x82bc('0xa'),_0x5522e9,_0x82bc('0xb'));logger[_0x82bc('0xc')](_0x82bc('0xd'),_0x5522e9,_0x82bc('0xb'),JSON[_0x82bc('0xe')](_0xba8c4b));if(_0xba8c4b[_0x82bc('0xf')]){if(_0xba8c4b[_0x82bc('0xf')][_0x82bc('0x10')]===0x1f4){logger[_0x82bc('0xf')](_0x82bc('0xa'),_0x5522e9,_0xba8c4b['error'][_0x82bc('0x11')]);return _0x49bcd0(_0xba8c4b[_0x82bc('0xf')][_0x82bc('0x11')]);}logger[_0x82bc('0xf')](_0x82bc('0xa'),_0x5522e9,_0xba8c4b[_0x82bc('0xf')]['message']);return _0x4f9718(_0xba8c4b['error'][_0x82bc('0x11')]);}else{logger[_0x82bc('0x9')]('Network,\x20%s,\x20%s',_0x5522e9,_0x82bc('0xb'));_0x4f9718(_0xba8c4b[_0x82bc('0x12')]['message']);}})[_0x82bc('0x13')](function(_0x856da9){logger['error'](_0x82bc('0xa'),_0x5522e9,_0x856da9);_0x49bcd0(_0x856da9);});});}function respondWithResult(_0x13c3d7,_0xb48e44){_0xb48e44=_0xb48e44||0xc8;return function(_0x53a9ef){if(_0x53a9ef){return _0x13c3d7[_0x82bc('0x14')](_0xb48e44)[_0x82bc('0x15')](_0x53a9ef);}};}function respondWithFilteredResult(_0x9dd203,_0x4c5d21){return function(_0x1e2729){if(_0x1e2729){var _0x4b7d9b=typeof _0x4c5d21['offset']===_0x82bc('0x16')&&typeof _0x4c5d21[_0x82bc('0x17')]===_0x82bc('0x16');var _0x6573c9=_0x1e2729[_0x82bc('0x18')];var _0x50df49=_0x4b7d9b?0x0:_0x4c5d21['offset'];var _0x145ee6=_0x4b7d9b?_0x1e2729[_0x82bc('0x18')]:_0x4c5d21[_0x82bc('0x19')]+_0x4c5d21['limit'];var _0x344c4d;if(_0x145ee6>=_0x6573c9){_0x145ee6=_0x6573c9;_0x344c4d=0xc8;}else{_0x344c4d=0xce;}_0x9dd203['status'](_0x344c4d);return _0x9dd203['set'](_0x82bc('0x1a'),_0x50df49+'-'+_0x145ee6+'/'+_0x6573c9)['json'](_0x1e2729);}return null;};}function saveUpdates(_0x460688){return function(_0xfd1864){if(_0xfd1864){return _0xfd1864[_0x82bc('0x1b')](_0x460688)['then'](function(_0x15df05){return _0x15df05;});}return null;};}function removeEntity(_0x3c4068){return function(_0x3c9244){if(_0x3c9244){return _0x3c9244['destroy']()['then'](function(){_0x3c4068['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e4806){return function(_0x2eca81){if(!_0x2eca81){_0x3e4806[_0x82bc('0x1c')](0x194);}return _0x2eca81;};}function handleError(_0x35e89b,_0x2f510c){_0x2f510c=_0x2f510c||0x1f4;return function(_0x4aecec){logger[_0x82bc('0xf')](_0x4aecec[_0x82bc('0x1d')]);if(_0x4aecec[_0x82bc('0x1e')]){delete _0x4aecec[_0x82bc('0x1e')];}_0x35e89b['status'](_0x2f510c)[_0x82bc('0x1f')](_0x4aecec);};}exports[_0x82bc('0x20')]=function(_0xc1c907,_0x14d9ad){var _0x278cdf={},_0x2544a2={},_0x5bc7d9={'count':0x0,'rows':[]};var _0x3c61f8=_['map'](db[_0x82bc('0x21')]['rawAttributes'],function(_0xfe19b4){return{'name':_0xfe19b4[_0x82bc('0x22')],'type':_0xfe19b4['type'][_0x82bc('0x23')]};});_0x2544a2[_0x82bc('0x24')]=_[_0x82bc('0x25')](_0x3c61f8,_0x82bc('0x1e'));_0x2544a2[_0x82bc('0x26')]=_[_0x82bc('0x27')](_0xc1c907[_0x82bc('0x26')]);_0x2544a2[_0x82bc('0x28')]=_['intersection'](_0x2544a2[_0x82bc('0x24')],_0x2544a2['query']);_0x278cdf[_0x82bc('0x29')]=_[_0x82bc('0x2a')](_0x2544a2[_0x82bc('0x24')],qs[_0x82bc('0x2b')](_0xc1c907[_0x82bc('0x26')][_0x82bc('0x2b')]));_0x278cdf[_0x82bc('0x29')]=_0x278cdf[_0x82bc('0x29')]['length']?_0x278cdf[_0x82bc('0x29')]:_0x2544a2[_0x82bc('0x24')];if(!_0xc1c907['query'][_0x82bc('0x2c')]('nolimit')){_0x278cdf[_0x82bc('0x17')]=qs[_0x82bc('0x17')](_0xc1c907[_0x82bc('0x26')]['limit']);_0x278cdf['offset']=qs['offset'](_0xc1c907[_0x82bc('0x26')][_0x82bc('0x19')]);}_0x278cdf['order']=qs[_0x82bc('0x2d')](_0xc1c907[_0x82bc('0x26')][_0x82bc('0x2d')]);_0x278cdf[_0x82bc('0x2e')]=qs[_0x82bc('0x28')](_[_0x82bc('0x2f')](_0xc1c907['query'],_0x2544a2[_0x82bc('0x28')]),_0x3c61f8);if(_0xc1c907[_0x82bc('0x26')]['filter']){_0x278cdf[_0x82bc('0x2e')]=_[_0x82bc('0x30')](_0x278cdf[_0x82bc('0x2e')],{'$or':_['map'](_0x3c61f8,function(_0x525c30){if(_0x525c30['type']!=='VIRTUAL'){var _0x38767b={};_0x38767b[_0x525c30['name']]={'$like':'%'+_0xc1c907['query'][_0x82bc('0x31')]+'%'};return _0x38767b;}})});}_0x278cdf=_[_0x82bc('0x30')]({},_0x278cdf,_0xc1c907[_0x82bc('0x32')]);var _0x4d124c={'where':_0x278cdf['where']};return db[_0x82bc('0x21')][_0x82bc('0x18')](_0x4d124c)[_0x82bc('0x33')](function(_0xcb66a2){_0x5bc7d9[_0x82bc('0x18')]=_0xcb66a2;if(_0xc1c907[_0x82bc('0x26')][_0x82bc('0x34')]){_0x278cdf[_0x82bc('0x35')]=[{'all':!![]}];}return db[_0x82bc('0x21')][_0x82bc('0x36')](_0x278cdf);})[_0x82bc('0x33')](function(_0x26fbfb){_0x5bc7d9[_0x82bc('0x37')]=_0x26fbfb;return _0x5bc7d9;})[_0x82bc('0x33')](respondWithFilteredResult(_0x14d9ad,_0x278cdf))[_0x82bc('0x13')](handleError(_0x14d9ad,null));};exports[_0x82bc('0x38')]=function(_0x5c2274,_0x587c43){var _0x3d24fe={'raw':!![],'where':{'id':_0x5c2274[_0x82bc('0x39')]['id']}},_0x5dd0a3={};_0x5dd0a3[_0x82bc('0x24')]=_[_0x82bc('0x27')](db[_0x82bc('0x21')][_0x82bc('0x3a')]);_0x5dd0a3[_0x82bc('0x26')]=_[_0x82bc('0x27')](_0x5c2274[_0x82bc('0x26')]);_0x5dd0a3[_0x82bc('0x28')]=_[_0x82bc('0x2a')](_0x5dd0a3[_0x82bc('0x24')],_0x5dd0a3['query']);_0x3d24fe[_0x82bc('0x29')]=_['intersection'](_0x5dd0a3['model'],qs[_0x82bc('0x2b')](_0x5c2274[_0x82bc('0x26')][_0x82bc('0x2b')]));_0x3d24fe['attributes']=_0x3d24fe[_0x82bc('0x29')][_0x82bc('0x3b')]?_0x3d24fe[_0x82bc('0x29')]:_0x5dd0a3[_0x82bc('0x24')];if(_0x5c2274[_0x82bc('0x26')][_0x82bc('0x34')]){_0x3d24fe['include']=[{'all':!![]}];}_0x3d24fe=_['merge']({},_0x3d24fe,_0x5c2274[_0x82bc('0x32')]);return db[_0x82bc('0x21')][_0x82bc('0x3c')](_0x3d24fe)[_0x82bc('0x33')](handleEntityNotFound(_0x587c43,null))[_0x82bc('0x33')](respondWithResult(_0x587c43,null))[_0x82bc('0x13')](handleError(_0x587c43,null));};exports['create']=function(_0x5b6f05,_0x11138f){var _0x1a6cf2;return db[_0x82bc('0x21')][_0x82bc('0x3d')](_0x5b6f05['body'],{'raw':!![]})[_0x82bc('0x33')](function(_0x5519be){_0x1a6cf2=_0x5519be;return db['Network'][_0x82bc('0x36')]({'where':{'type':_0x5b6f05[_0x82bc('0x3e')][_0x82bc('0x3f')]},'raw':!![]});})[_0x82bc('0x33')](function(_0x7fa9a6){if(_0x1a6cf2[_0x82bc('0x3f')]['toUpperCase']()==_0x82bc('0x40')){var _0x3594ad=fs[_0x82bc('0x41')](path[_0x82bc('0x42')](config['root'],_0x82bc('0x43')),'utf8');var _0x594217=ejs[_0x82bc('0x44')](_0x3594ad,{'networks':_0x7fa9a6||[]});fs['writeFileSync'](_0x82bc('0x45'),_0x594217);return respondWithRpcPromise(_0x82bc('0x46'),_0x82bc('0x3d'),{'module':_0x82bc('0x47')});}else if(_0x1a6cf2['type'][_0x82bc('0x48')]()==_0x82bc('0x49')){var _0x44f291=fs[_0x82bc('0x41')](path[_0x82bc('0x42')](config[_0x82bc('0x4a')],_0x82bc('0x4b')),_0x82bc('0x4c'));var _0x56f8b6=ejs['render'](_0x44f291,{'networks':_0x7fa9a6||[]});fs[_0x82bc('0x4d')](_0x82bc('0x4e'),_0x56f8b6);return respondWithRpcPromise(_0x82bc('0x46'),_0x82bc('0x3d'),{'module':_0x82bc('0x47')});}else{var _0x2866d1=fs[_0x82bc('0x41')](path['join'](config['root'],_0x82bc('0x4f')),_0x82bc('0x4c'));var _0x3d91f3=ejs[_0x82bc('0x44')](_0x2866d1,{'networks':_0x7fa9a6||[]});fs['writeFileSync'](util[_0x82bc('0x50')](_0x82bc('0x51'),_0x5b6f05[_0x82bc('0x3e')][_0x82bc('0x3f')]['toLowerCase']()),_0x3d91f3);return respondWithRpcPromise(_0x82bc('0x46'),_0x82bc('0x3d'),{'module':_0x82bc('0x52')});}})[_0x82bc('0x33')](function(){return _0x1a6cf2;})[_0x82bc('0x33')](respondWithResult(_0x11138f,0xc9))[_0x82bc('0x13')](handleError(_0x11138f,null));};exports[_0x82bc('0x1b')]=function(_0x364a33,_0x340cbd){var _0x31d623;return db[_0x82bc('0x21')][_0x82bc('0x3c')]({'where':{'id':_0x364a33[_0x82bc('0x39')]['id']}})[_0x82bc('0x33')](handleEntityNotFound(_0x340cbd,null))['then'](saveUpdates(_0x364a33['body'],null))[_0x82bc('0x33')](function(_0x3e2bab){if(_0x3e2bab){_0x31d623=_0x3e2bab;return db[_0x82bc('0x21')][_0x82bc('0x36')]({'where':{'type':_0x31d623[_0x82bc('0x3f')]},'raw':!![]});}return null;})['then'](function(_0x126614){if(_0x31d623['type'][_0x82bc('0x48')]()==_0x82bc('0x40')){var _0x5071bb=fs[_0x82bc('0x41')](path[_0x82bc('0x42')](config[_0x82bc('0x4a')],_0x82bc('0x43')),'utf8');var _0x259fa5=ejs[_0x82bc('0x44')](_0x5071bb,{'networks':_0x126614||[]});fs[_0x82bc('0x4d')]('/etc/asterisk/stun_xcally.conf',_0x259fa5);return respondWithRpcPromise(_0x82bc('0x46'),'update',{'module':_0x82bc('0x47')});}else if(_0x31d623[_0x82bc('0x3f')]['toUpperCase']()=='TURN'){var _0x29c83a=fs['readFileSync'](path['join'](config[_0x82bc('0x4a')],'server/files/templates/turn_multiple.ejs'),_0x82bc('0x4c'));var _0x147a37=ejs[_0x82bc('0x44')](_0x29c83a,{'networks':_0x126614||[]});fs['writeFileSync']('/etc/asterisk/turn_xcally.conf',_0x147a37);return respondWithRpcPromise(_0x82bc('0x46'),_0x82bc('0x1b'),{'module':_0x82bc('0x47')});}else{var _0x359db6=fs['readFileSync'](path[_0x82bc('0x42')](config[_0x82bc('0x4a')],'server/files/templates/network.ejs'),_0x82bc('0x4c'));var _0x35b18f=ejs[_0x82bc('0x44')](_0x359db6,{'networks':_0x126614||[]});fs['writeFileSync'](util[_0x82bc('0x50')](_0x82bc('0x51'),_0x364a33[_0x82bc('0x3e')][_0x82bc('0x3f')][_0x82bc('0x53')]()),_0x35b18f);return respondWithRpcPromise(_0x82bc('0x46'),'update',{'module':'chan_sip.so'});}})['then'](function(_0x6d4d67){if(_0x6d4d67){return _0x31d623;}return null;})[_0x82bc('0x33')](respondWithResult(_0x340cbd,null))[_0x82bc('0x13')](handleError(_0x340cbd,null));};exports['destroy']=function(_0x371820,_0x19193d){var _0x17851e;return db[_0x82bc('0x21')][_0x82bc('0x3c')]({'where':{'id':_0x371820[_0x82bc('0x39')]['id']}})[_0x82bc('0x33')](function(_0x168531){_0x17851e=_0x168531;return _0x168531;})['then'](handleEntityNotFound(_0x19193d,null))[_0x82bc('0x33')](removeEntity(_0x19193d,null))[_0x82bc('0x33')](function(){if(_0x17851e){return db[_0x82bc('0x21')][_0x82bc('0x36')]({'where':{'type':_0x17851e[_0x82bc('0x3f')]},'raw':!![]});}})['then'](function(_0x26c366){if(_0x17851e['type'][_0x82bc('0x48')]()==_0x82bc('0x40')){var _0x2bb8ac=fs[_0x82bc('0x41')](path[_0x82bc('0x42')](config[_0x82bc('0x4a')],_0x82bc('0x43')),_0x82bc('0x4c'));var _0x1fc1f3=ejs[_0x82bc('0x44')](_0x2bb8ac,{'networks':_0x26c366||[]});fs[_0x82bc('0x4d')](_0x82bc('0x45'),_0x1fc1f3);return respondWithRpcPromise(_0x82bc('0x46'),'destroy',{'module':_0x82bc('0x47')});}else if(_0x17851e[_0x82bc('0x3f')][_0x82bc('0x48')]()==_0x82bc('0x49')){var _0x5845ab=fs['readFileSync'](path[_0x82bc('0x42')](config[_0x82bc('0x4a')],_0x82bc('0x4b')),_0x82bc('0x4c'));var _0x14f63b=ejs[_0x82bc('0x44')](_0x5845ab,{'networks':_0x26c366||[]});fs['writeFileSync'](_0x82bc('0x4e'),_0x14f63b);return respondWithRpcPromise(_0x82bc('0x46'),_0x82bc('0x54'),{'module':_0x82bc('0x47')});}else{var _0x4dd81e=fs[_0x82bc('0x41')](path[_0x82bc('0x42')](config[_0x82bc('0x4a')],_0x82bc('0x4f')),_0x82bc('0x4c'));var _0x2b278e=ejs[_0x82bc('0x44')](_0x4dd81e,{'networks':_0x26c366||[]});fs[_0x82bc('0x4d')](util['format'](_0x82bc('0x51'),_0x17851e['type'][_0x82bc('0x53')]()),_0x2b278e);return respondWithRpcPromise(_0x82bc('0x46'),'destroy',{'module':_0x82bc('0x52')});}})['catch'](handleError(_0x19193d,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 219a638..13a8da5 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 _0xe706=['request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define','Network','network','lodash','util','../../config/logger','moment','bluebird'];(function(_0x180d60,_0x2627f8){var _0x1056d6=function(_0x5dcf41){while(--_0x5dcf41){_0x180d60['push'](_0x180d60['shift']());}};_0x1056d6(++_0x2627f8);}(_0xe706,0xa3));var _0x6e70=function(_0x1ac6e5,_0x40f47f){_0x1ac6e5=_0x1ac6e5-0x0;var _0x5877dc=_0xe706[_0x1ac6e5];return _0x5877dc;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe644=['path','rimraf','../../config/environment','./network.attributes','exports','define','Network','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x12a7a3,_0x3a2bbb){var _0x335ac1=function(_0x422377){while(--_0x422377){_0x12a7a3['push'](_0x12a7a3['shift']());}};_0x335ac1(++_0x3a2bbb);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4e64('0x0'));var util=require(_0x4e64('0x1'));var logger=require(_0x4e64('0x2'))(_0x4e64('0x3'));var moment=require(_0x4e64('0x4'));var BPromise=require(_0x4e64('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4e64('0x6'));var rimraf=require(_0x4e64('0x7'));var config=require(_0x4e64('0x8'));var attributes=require(_0x4e64('0x9'));module[_0x4e64('0xa')]=function(_0x13fa90,_0x55c23b){return _0x13fa90[_0x4e64('0xb')](_0x4e64('0xc'),attributes,{'tableName':'network','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 992ef5f..f0d1602 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 _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x59a630,_0x44cb9a){var _0x411814=function(_0x176a8f){while(--_0x176a8f){_0x59a630['push'](_0x59a630['shift']());}};_0x411814(++_0x44cb9a);}(_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 moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ 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(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x84bb3f,_0x5a8e7f){_0x84bb3f=_0x84bb3f-0x0;var _0x1c2a91=_0x7a54[_0x84bb3f];return _0x1c2a91;};'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 a932b86..ba0f652 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 _0xd4a2=['/describe','describe','/:id','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','getAgents','create','post','addDisposition','/:id/canned_answers','addAnswer','/:id/notify','notify','addApplications','/:id/users','addAgents','send','put','update','delete','removeDispositions','removeAnswers','removeAgents','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xd4a2,0x173));var _0x2d4a=function(_0x2d3c51,_0x44c7af){_0x2d3c51=_0x2d3c51-0x0;var _0x1d3300=_0xd4a2[_0x2d3c51];return _0x1d3300;};'use strict';var multer=require(_0x2d4a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2d4a('0x1'));var express=require('express');var router=express[_0x2d4a('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d4a('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x2d4a('0x4'));var controller=require(_0x2d4a('0x5'));router[_0x2d4a('0x6')]('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x8')]);router['get'](_0x2d4a('0x9'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xa')]);router[_0x2d4a('0x6')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xc')]);router[_0x2d4a('0x6')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0xe')]);router[_0x2d4a('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x2d4a('0xf')]);router['get'](_0x2d4a('0x10'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x11')]);router[_0x2d4a('0x6')](_0x2d4a('0x12'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x13')]);router[_0x2d4a('0x6')]('/:id/users',auth['isAuthenticated'](),controller[_0x2d4a('0x14')]);router['post']('/',auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x15')]);router[_0x2d4a('0x16')](_0x2d4a('0xd'),auth['isAuthenticated'](),controller[_0x2d4a('0x17')]);router['post'](_0x2d4a('0x18'),auth['isAuthenticated'](),controller[_0x2d4a('0x19')]);router[_0x2d4a('0x16')](_0x2d4a('0x1a'),controller[_0x2d4a('0x1b')]);router['post']('/:id/applications',auth['isAuthenticated'](),controller[_0x2d4a('0x1c')]);router[_0x2d4a('0x16')](_0x2d4a('0x1d'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x1e')]);router[_0x2d4a('0x16')]('/:id/send',auth['isAuthenticated'](),controller[_0x2d4a('0x1f')]);router[_0x2d4a('0x20')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x21')]);router[_0x2d4a('0x22')](_0x2d4a('0xb'),auth[_0x2d4a('0x7')](),controller['destroy']);router[_0x2d4a('0x22')](_0x2d4a('0xd'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x23')]);router[_0x2d4a('0x22')](_0x2d4a('0x18'),auth[_0x2d4a('0x7')](),controller[_0x2d4a('0x24')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x2d4a('0x25')]);module['exports']=router; \ No newline at end of file +var _0x5204=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','addApplications','put','delete','removeDispositions','removeAnswers','removeAgents'];(function(_0x1438c4,_0x1a8cd6){var _0x30050e=function(_0x5cc971){while(--_0x5cc971){_0x1438c4['push'](_0x1438c4['shift']());}};_0x30050e(++_0x1a8cd6);}(_0x5204,0xdf));var _0x4520=function(_0x17882c,_0x4b964b){_0x17882c=_0x17882c-0x0;var _0x355a59=_0x5204[_0x17882c];return _0x355a59;};'use strict';var multer=require(_0x4520('0x0'));var util=require(_0x4520('0x1'));var path=require('path');var timeout=require(_0x4520('0x2'));var express=require(_0x4520('0x3'));var router=express[_0x4520('0x4')]();var fs_extra=require(_0x4520('0x5'));var auth=require(_0x4520('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4520('0x7'));var controller=require('./openchannelAccount.controller');router[_0x4520('0x8')]('/',auth[_0x4520('0x9')](),controller[_0x4520('0xa')]);router[_0x4520('0x8')](_0x4520('0xb'),auth[_0x4520('0x9')](),controller[_0x4520('0xc')]);router['get'](_0x4520('0xd'),auth['isAuthenticated'](),controller[_0x4520('0xe')]);router[_0x4520('0x8')](_0x4520('0xf'),auth[_0x4520('0x9')](),controller[_0x4520('0x10')]);router[_0x4520('0x8')](_0x4520('0x11'),auth[_0x4520('0x9')](),controller[_0x4520('0x12')]);router[_0x4520('0x8')](_0x4520('0x13'),auth[_0x4520('0x9')](),controller[_0x4520('0x14')]);router[_0x4520('0x8')](_0x4520('0x15'),auth[_0x4520('0x9')](),controller[_0x4520('0x16')]);router[_0x4520('0x8')](_0x4520('0x17'),auth[_0x4520('0x9')](),controller[_0x4520('0x18')]);router['post']('/',auth[_0x4520('0x9')](),controller[_0x4520('0x19')]);router[_0x4520('0x1a')](_0x4520('0xf'),auth[_0x4520('0x9')](),controller['addDisposition']);router[_0x4520('0x1a')](_0x4520('0x11'),auth[_0x4520('0x9')](),controller[_0x4520('0x1b')]);router[_0x4520('0x1a')](_0x4520('0x1c'),controller[_0x4520('0x1d')]);router[_0x4520('0x1a')](_0x4520('0x13'),auth[_0x4520('0x9')](),controller[_0x4520('0x1e')]);router[_0x4520('0x1a')]('/:id/users',auth[_0x4520('0x9')](),controller['addAgents']);router['post']('/:id/send',auth[_0x4520('0x9')](),controller['send']);router[_0x4520('0x1f')](_0x4520('0xd'),auth[_0x4520('0x9')](),controller['update']);router[_0x4520('0x20')](_0x4520('0xd'),auth[_0x4520('0x9')](),controller['destroy']);router[_0x4520('0x20')](_0x4520('0xf'),auth[_0x4520('0x9')](),controller[_0x4520('0x21')]);router[_0x4520('0x20')]('/:id/canned_answers',auth[_0x4520('0x9')](),controller[_0x4520('0x22')]);router[_0x4520('0x20')](_0x4520('0x17'),auth['isAuthenticated'](),controller[_0x4520('0x23')]);module[_0x4520('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 582ea3f..cb4210d 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 _0x867a=['randomstring','exports','STRING','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize'];(function(_0x53b6ae,_0x3cb9f4){var _0x34f4b2=function(_0x4b3169){while(--_0x4b3169){_0x53b6ae['push'](_0x53b6ae['shift']());}};_0x34f4b2(++_0x3cb9f4);}(_0x867a,0x151));var _0xa867=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x867a[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xa867('0x0'));var rs=require(_0xa867('0x1'));module[_0xa867('0x2')]={'name':{'type':Sequelize[_0xa867('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xa867('0x3')]},'token':{'type':Sequelize[_0xa867('0x3')],'defaultValue':function(){return rs[_0xa867('0x4')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xa867('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xa867('0x5')],'defaultValue':function(){return _0xa867('0x6');}},'notificationSound':{'type':Sequelize[_0xa867('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xa867('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa867('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0xa867('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xa867('0x3')]},'queueTransfer':{'type':Sequelize[_0xa867('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa867('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa867('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa867('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa867('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xa867('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xa867('0x7')],'defaultValue':![],'comment':_0xa867('0xa'),'set':function(_0x59c511){if(!_0x59c511)this[_0xa867('0xb')]('mandatoryDispositionPauseId',null);this[_0xa867('0xb')](_0xa867('0xc'),_0x59c511);}}}; \ No newline at end of file +var _0x3599=['generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','randomstring','exports','STRING','name'];(function(_0x2234a9,_0x468140){var _0x1410e2=function(_0x24b2f2){while(--_0x24b2f2){_0x2234a9['push'](_0x2234a9['shift']());}};_0x1410e2(++_0x468140);}(_0x3599,0x1eb));var _0x9359=function(_0x10cc8d,_0x1a423a){_0x10cc8d=_0x10cc8d-0x0;var _0x1af106=_0x3599[_0x10cc8d];return _0x1af106;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x9359('0x0'));module[_0x9359('0x1')]={'name':{'type':Sequelize[_0x9359('0x2')],'unique':_0x9359('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x9359('0x2')]},'token':{'type':Sequelize[_0x9359('0x2')],'defaultValue':function(){return rs[_0x9359('0x4')]();}},'replyUri':{'type':Sequelize[_0x9359('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9359('0x5');}},'notificationSound':{'type':Sequelize[_0x9359('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9359('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9359('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x9359('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9359('0x2')]},'queueTransfer':{'type':Sequelize[_0x9359('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9359('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9359('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x9359('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x9359('0x6')],'defaultValue':![],'comment':_0x9359('0x9'),'set':function(_0x4a02e4){if(!_0x4a02e4)this[_0x9359('0xa')]('mandatoryDispositionPauseId',null);this[_0x9359('0xa')]('mandatoryDisposition',_0x4a02e4);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index ddd9bd8..a1424d3 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 _0xe928=['filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','Pause','find','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','addDisposition','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','removeAnswers','notify','openchannel','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','updatedAt','createdAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','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','CmList','List','DESC','Applications','account','applications','list','orderBy','Contacts','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','contact','messageId','update','interaction','created','autoclose','close','unmanaged','AttachmentId','UserId','agent','*,*,*,*','queueId','OpenchannelQueue','unshift','queue','waitForTheAssignedQueue','Start','startRouting','EventManager','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','OpenchannelApplication','findAndCountAll','priority','finally','getApplications','getInteractions','User','fullname','Tags','color','tag','addAgents','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','send','out','OpenchannelMessage','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','UserProfileResource','stack','name','mandatoryDispositionPause','map','OpenchannelAccount','rawAttributes','type','key','model','query','keys'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe928,0x145));var _0x8e92=function(_0x49d033,_0x99e25a){_0x49d033=_0x49d033-0x0;var _0xaf160c=_0xe928[_0x49d033];return _0xaf160c;};'use strict';var emlformat=require(_0x8e92('0x0'));var rimraf=require(_0x8e92('0x1'));var zipdir=require(_0x8e92('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8e92('0x3'));var moment=require('moment');var BPromise=require(_0x8e92('0x4'));var Mustache=require(_0x8e92('0x5'));var util=require(_0x8e92('0x6'));var path=require(_0x8e92('0x7'));var sox=require('sox');var csv=require(_0x8e92('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8e92('0x9'));var _=require(_0x8e92('0xa'));var squel=require(_0x8e92('0xb'));var crypto=require(_0x8e92('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8e92('0xd'));var toCsv=require('to-csv');var querystring=require(_0x8e92('0xe'));var Papa=require(_0x8e92('0xf'));var Redis=require(_0x8e92('0x10'));var authService=require(_0x8e92('0x11'));var qs=require(_0x8e92('0x12'));var as=require(_0x8e92('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e92('0x14'))(_0x8e92('0x15'));var utils=require(_0x8e92('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x8e92('0x17'));var db=require(_0x8e92('0x18'))['db'];config[_0x8e92('0x19')]=_[_0x8e92('0x1a')](config[_0x8e92('0x19')],{'host':_0x8e92('0x1b'),'port':0x18eb});var socket=require(_0x8e92('0x1c'))(new Redis(config['redis']));require(_0x8e92('0x1d'))['register'](socket);var jayson=require(_0x8e92('0x1e'));var client=jayson[_0x8e92('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x8e92('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d866f,_0x26cce1,_0x43b20e,_0x1380ef){return new BPromise(function(_0x1c4b12,_0x1a80d2){var _0x182e05=_0x1380ef||client;return _0x182e05[_0x8e92('0x20')](_0x1d866f,_0x43b20e)['then'](function(_0x3dfb4c){logger[_0x8e92('0x21')](_0x8e92('0x22'),_0x26cce1,_0x8e92('0x23'));logger[_0x8e92('0x24')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x26cce1,_0x8e92('0x23'),JSON[_0x8e92('0x25')](_0x3dfb4c));if(_0x3dfb4c['error']){if(_0x3dfb4c['error']['code']===0x1f4){logger[_0x8e92('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x26cce1,_0x3dfb4c[_0x8e92('0x26')][_0x8e92('0x27')]);return _0x1a80d2(_0x3dfb4c[_0x8e92('0x26')][_0x8e92('0x27')]);}logger[_0x8e92('0x26')](_0x8e92('0x22'),_0x26cce1,_0x3dfb4c['error']['message']);return _0x1c4b12(_0x3dfb4c['error']['message']);}else{logger[_0x8e92('0x21')](_0x8e92('0x22'),_0x26cce1,_0x8e92('0x23'));_0x1c4b12(_0x3dfb4c[_0x8e92('0x28')][_0x8e92('0x27')]);}})[_0x8e92('0x29')](function(_0x585adb){logger[_0x8e92('0x26')](_0x8e92('0x22'),_0x26cce1,_0x585adb);_0x1a80d2(_0x585adb);});});}function respondWithStatusCode(_0x12eba1,_0x127fff){_0x127fff=_0x127fff||0xcc;return function(_0x40b576){if(_0x40b576){return _0x12eba1[_0x8e92('0x2a')](_0x127fff);}return _0x12eba1['status'](_0x127fff)['end']();};}function respondWithResult(_0x510349,_0x1d3df5){_0x1d3df5=_0x1d3df5||0xc8;return function(_0x59b173){if(_0x59b173){return _0x510349[_0x8e92('0x2b')](_0x1d3df5)['json'](_0x59b173);}};}function respondWithFilteredResult(_0x3bfb1e,_0x492c89){return function(_0x208384){if(_0x208384){var _0x57c4de=typeof _0x492c89[_0x8e92('0x2c')]===_0x8e92('0x2d')&&typeof _0x492c89[_0x8e92('0x2e')]===_0x8e92('0x2d');var _0x4dd47f=_0x208384[_0x8e92('0x2f')];var _0x405df5=_0x57c4de?0x0:_0x492c89['offset'];var _0x2dbd8f=_0x57c4de?_0x208384['count']:_0x492c89[_0x8e92('0x2c')]+_0x492c89[_0x8e92('0x2e')];var _0x4fb57b;if(_0x2dbd8f>=_0x4dd47f){_0x2dbd8f=_0x4dd47f;_0x4fb57b=0xc8;}else{_0x4fb57b=0xce;}_0x3bfb1e[_0x8e92('0x2b')](_0x4fb57b);return _0x3bfb1e[_0x8e92('0x30')](_0x8e92('0x31'),_0x405df5+'-'+_0x2dbd8f+'/'+_0x4dd47f)[_0x8e92('0x32')](_0x208384);}return null;};}function patchUpdates(_0x158fb2){return function(_0x2c8d24){try{jsonpatch[_0x8e92('0x33')](_0x2c8d24,_0x158fb2,!![]);}catch(_0x29d16e){return BPromise[_0x8e92('0x34')](_0x29d16e);}return _0x2c8d24['save']();};}function saveUpdates(_0x5c6609,_0x456914){return function(_0x4ca7c7){if(_0x4ca7c7){return _0x4ca7c7['update'](_0x5c6609)[_0x8e92('0x35')](function(_0x2b0030){return _0x2b0030;});}return null;};}function removeEntity(_0x3cea2c,_0x537313){return function(_0x2fdbe5){if(_0x2fdbe5){return _0x2fdbe5[_0x8e92('0x36')]()[_0x8e92('0x35')](function(){var _0x5c462b=_0x2fdbe5['get']({'plain':!![]});var _0x42789b='OpenchannelAccounts';return db[_0x8e92('0x37')][_0x8e92('0x36')]({'where':{'type':_0x42789b,'resourceId':_0x5c462b['id']}})[_0x8e92('0x35')](function(){return _0x2fdbe5;});})[_0x8e92('0x35')](function(){_0x3cea2c[_0x8e92('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4456da,_0x207d94){return function(_0x131754){if(!_0x131754){_0x4456da['sendStatus'](0x194);}return _0x131754;};}function handleError(_0x5a5d8c,_0xa2a8a2){_0xa2a8a2=_0xa2a8a2||0x1f4;return function(_0x54e964){logger[_0x8e92('0x26')](_0x54e964[_0x8e92('0x38')]);if(_0x54e964[_0x8e92('0x39')]){delete _0x54e964[_0x8e92('0x39')];}_0x5a5d8c['status'](_0xa2a8a2)['send'](_0x54e964);};}exports['index']=function(_0x206534,_0x5c5f5d){var _0x5fa2d9={'include':[{'model':db['Pause'],'as':_0x8e92('0x3a')}]},_0x502690={},_0x4c1cc6={'count':0x0,'rows':[]};var _0x3c3d83=_[_0x8e92('0x3b')](db[_0x8e92('0x3c')][_0x8e92('0x3d')],function(_0x3f1b3b){return{'name':_0x3f1b3b['fieldName'],'type':_0x3f1b3b[_0x8e92('0x3e')][_0x8e92('0x3f')]};});_0x502690[_0x8e92('0x40')]=_[_0x8e92('0x3b')](_0x3c3d83,'name');_0x502690[_0x8e92('0x41')]=_[_0x8e92('0x42')](_0x206534['query']);_0x502690[_0x8e92('0x43')]=_[_0x8e92('0x44')](_0x502690['model'],_0x502690['query']);_0x5fa2d9[_0x8e92('0x45')]=_['intersection'](_0x502690['model'],qs[_0x8e92('0x46')](_0x206534[_0x8e92('0x41')][_0x8e92('0x46')]));_0x5fa2d9['attributes']=_0x5fa2d9[_0x8e92('0x45')][_0x8e92('0x47')]?_0x5fa2d9[_0x8e92('0x45')]:_0x502690[_0x8e92('0x40')];if(!_0x206534['query'][_0x8e92('0x48')]('nolimit')){_0x5fa2d9[_0x8e92('0x2e')]=qs[_0x8e92('0x2e')](_0x206534['query'][_0x8e92('0x2e')]);_0x5fa2d9[_0x8e92('0x2c')]=qs[_0x8e92('0x2c')](_0x206534[_0x8e92('0x41')][_0x8e92('0x2c')]);}_0x5fa2d9[_0x8e92('0x49')]=qs[_0x8e92('0x4a')](_0x206534[_0x8e92('0x41')][_0x8e92('0x4a')]);_0x5fa2d9[_0x8e92('0x4b')]=qs[_0x8e92('0x43')](_[_0x8e92('0x4c')](_0x206534['query'],_0x502690[_0x8e92('0x43')]),_0x3c3d83);if(_0x206534[_0x8e92('0x41')][_0x8e92('0x4d')]){_0x5fa2d9[_0x8e92('0x4b')]=_['merge'](_0x5fa2d9[_0x8e92('0x4b')],{'$or':_[_0x8e92('0x3b')](_0x3c3d83,function(_0x3a1003){if(_0x3a1003['type']!==_0x8e92('0x4e')){var _0x268f4c={};_0x268f4c[_0x3a1003[_0x8e92('0x39')]]={'$like':'%'+_0x206534[_0x8e92('0x41')][_0x8e92('0x4d')]+'%'};return _0x268f4c;}})});}_0x5fa2d9=_[_0x8e92('0x4f')]({},_0x5fa2d9,_0x206534[_0x8e92('0x50')]);var _0x399047={'where':_0x5fa2d9[_0x8e92('0x4b')]};return db[_0x8e92('0x3c')][_0x8e92('0x2f')](_0x399047)[_0x8e92('0x35')](function(_0x5bbe17){_0x4c1cc6[_0x8e92('0x2f')]=_0x5bbe17;if(_0x206534[_0x8e92('0x41')][_0x8e92('0x51')]){_0x5fa2d9[_0x8e92('0x52')]=[{'all':!![]}];}return db[_0x8e92('0x3c')][_0x8e92('0x53')](_0x5fa2d9);})['then'](function(_0x2baafa){_0x4c1cc6[_0x8e92('0x54')]=_0x2baafa;return _0x4c1cc6;})[_0x8e92('0x35')](respondWithFilteredResult(_0x5c5f5d,_0x5fa2d9))[_0x8e92('0x29')](handleError(_0x5c5f5d,null));};exports[_0x8e92('0x55')]=function(_0x2a7ffe,_0x2197e7){var _0x389d80={'raw':![],'where':{'id':_0x2a7ffe[_0x8e92('0x56')]['id']},'include':[{'model':db[_0x8e92('0x57')],'as':_0x8e92('0x3a')}]},_0xe37dfe={};_0xe37dfe[_0x8e92('0x40')]=_[_0x8e92('0x42')](db['OpenchannelAccount'][_0x8e92('0x3d')]);_0xe37dfe['query']=_['keys'](_0x2a7ffe[_0x8e92('0x41')]);_0xe37dfe[_0x8e92('0x43')]=_['intersection'](_0xe37dfe['model'],_0xe37dfe[_0x8e92('0x41')]);_0x389d80[_0x8e92('0x45')]=_[_0x8e92('0x44')](_0xe37dfe[_0x8e92('0x40')],qs[_0x8e92('0x46')](_0x2a7ffe[_0x8e92('0x41')][_0x8e92('0x46')]));_0x389d80[_0x8e92('0x45')]=_0x389d80[_0x8e92('0x45')][_0x8e92('0x47')]?_0x389d80[_0x8e92('0x45')]:_0xe37dfe[_0x8e92('0x40')];if(_0x2a7ffe[_0x8e92('0x41')][_0x8e92('0x51')]){_0x389d80[_0x8e92('0x52')]=[{'all':!![]}];}_0x389d80=_[_0x8e92('0x4f')]({},_0x389d80,_0x2a7ffe['options']);return db[_0x8e92('0x3c')][_0x8e92('0x58')](_0x389d80)['then'](handleEntityNotFound(_0x2197e7,null))['then'](respondWithResult(_0x2197e7,null))[_0x8e92('0x29')](handleError(_0x2197e7,null));};exports[_0x8e92('0x59')]=function(_0x2bbc65,_0x37a56b){return db[_0x8e92('0x3c')]['create'](_0x2bbc65[_0x8e92('0x5a')],{})['then'](function(_0x46b717){var _0x5d7685=_0x2bbc65[_0x8e92('0x5b')][_0x8e92('0x5c')]({'plain':!![]});if(!_0x5d7685)throw new Error(_0x8e92('0x5d'));if(_0x5d7685[_0x8e92('0x5e')]===_0x8e92('0x5b')){var _0x649e06=_0x46b717[_0x8e92('0x5c')]({'plain':!![]});var _0x38adde='OpenchannelAccounts';return db[_0x8e92('0x5f')][_0x8e92('0x58')]({'where':{'name':_0x38adde,'userProfileId':_0x5d7685[_0x8e92('0x60')]},'raw':!![]})['then'](function(_0x408e5b){if(_0x408e5b&&_0x408e5b[_0x8e92('0x61')]===0x0){return db[_0x8e92('0x37')][_0x8e92('0x59')]({'name':_0x649e06[_0x8e92('0x39')],'resourceId':_0x649e06['id'],'type':_0x408e5b[_0x8e92('0x39')],'sectionId':_0x408e5b['id']},{})[_0x8e92('0x35')](function(){return _0x46b717;});}else{return _0x46b717;}})['catch'](function(_0x20654f){logger[_0x8e92('0x26')](_0x8e92('0x62'),_0x20654f);throw _0x20654f;});}return _0x46b717;})['then'](respondWithResult(_0x37a56b,0xc9))['catch'](handleError(_0x37a56b,null));};exports['update']=function(_0x111f0a,_0x1d9ee5){if(_0x111f0a[_0x8e92('0x5a')]['id']){delete _0x111f0a[_0x8e92('0x5a')]['id'];}return db[_0x8e92('0x3c')][_0x8e92('0x58')]({'where':{'id':_0x111f0a[_0x8e92('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x8e92('0x3a')}]})[_0x8e92('0x35')](handleEntityNotFound(_0x1d9ee5,null))[_0x8e92('0x35')](saveUpdates(_0x111f0a[_0x8e92('0x5a')],null))[_0x8e92('0x35')](respondWithResult(_0x1d9ee5,null))[_0x8e92('0x29')](handleError(_0x1d9ee5,null));};exports['destroy']=function(_0x22770c,_0x12895a){return db['OpenchannelAccount'][_0x8e92('0x58')]({'where':{'id':_0x22770c['params']['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x12895a,null))[_0x8e92('0x35')](removeEntity(_0x12895a,null))[_0x8e92('0x29')](handleError(_0x12895a,null));};exports['describe']=function(_0x41cbe0,_0x389d65){return db[_0x8e92('0x3c')]['describe']()[_0x8e92('0x35')](respondWithResult(_0x389d65,null))[_0x8e92('0x29')](handleError(_0x389d65,null));};exports[_0x8e92('0x63')]=function(_0x53111a,_0x63bb98,_0x5f451e){if(_0x53111a[_0x8e92('0x5a')]['id']){delete _0x53111a[_0x8e92('0x5a')]['id'];}return db['OpenchannelAccount'][_0x8e92('0x58')]({'where':{'id':_0x53111a[_0x8e92('0x56')]['id']}})['then'](handleEntityNotFound(_0x63bb98,null))[_0x8e92('0x35')](function(_0x403d00){if(_0x403d00){_0x53111a[_0x8e92('0x5a')]['OpenchannelAccountId']=_0x403d00['id'];return db[_0x8e92('0x64')][_0x8e92('0x59')](_0x53111a[_0x8e92('0x5a')]);}})['then'](respondWithResult(_0x63bb98,null))['catch'](handleError(_0x63bb98,null));};exports[_0x8e92('0x65')]=function(_0x401087,_0x227ef4,_0x4745e6){var _0x1d4d26={'raw':![],'where':{}};var _0x5ee152={};var _0x8f07c5={'count':0x0,'rows':[]};return db[_0x8e92('0x3c')][_0x8e92('0x66')]({'where':{'id':_0x401087[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x227ef4,null))['then'](function(_0x253d61){if(_0x253d61){_0x5ee152[_0x8e92('0x40')]=_[_0x8e92('0x42')](db[_0x8e92('0x64')][_0x8e92('0x3d')]);_0x5ee152[_0x8e92('0x41')]=_[_0x8e92('0x42')](_0x401087[_0x8e92('0x41')]);_0x5ee152['filters']=_[_0x8e92('0x44')](_0x5ee152[_0x8e92('0x40')],_0x5ee152[_0x8e92('0x41')]);_0x1d4d26[_0x8e92('0x45')]=_[_0x8e92('0x44')](_0x5ee152['model'],qs[_0x8e92('0x46')](_0x401087[_0x8e92('0x41')][_0x8e92('0x46')]));_0x1d4d26[_0x8e92('0x45')]=_0x1d4d26[_0x8e92('0x45')][_0x8e92('0x47')]?_0x1d4d26[_0x8e92('0x45')]:_0x5ee152['model'];if(!_0x401087['query']['hasOwnProperty'](_0x8e92('0x67'))){_0x1d4d26[_0x8e92('0x2e')]=qs[_0x8e92('0x2e')](_0x401087[_0x8e92('0x41')][_0x8e92('0x2e')]);_0x1d4d26[_0x8e92('0x2c')]=qs[_0x8e92('0x2c')](_0x401087[_0x8e92('0x41')][_0x8e92('0x2c')]);}_0x1d4d26[_0x8e92('0x49')]=qs[_0x8e92('0x4a')](_0x401087['query'][_0x8e92('0x4a')]);_0x1d4d26[_0x8e92('0x4b')]=qs[_0x8e92('0x43')](_[_0x8e92('0x4c')](_0x401087[_0x8e92('0x41')],_0x5ee152[_0x8e92('0x43')]));_0x1d4d26[_0x8e92('0x4b')]['OpenchannelAccountId']=_0x253d61['id'];if(_0x401087[_0x8e92('0x41')][_0x8e92('0x4d')]){_0x1d4d26[_0x8e92('0x4b')]=_[_0x8e92('0x4f')](_0x1d4d26[_0x8e92('0x4b')],{'$or':_[_0x8e92('0x3b')](_0x1d4d26[_0x8e92('0x45')],function(_0x27e766){var _0xf6187={};_0xf6187[_0x27e766]={'$like':'%'+_0x401087['query'][_0x8e92('0x4d')]+'%'};return _0xf6187;})});}_0x1d4d26=_[_0x8e92('0x4f')]({},_0x1d4d26,_0x401087[_0x8e92('0x50')]);return db[_0x8e92('0x64')][_0x8e92('0x2f')]({'where':_0x1d4d26[_0x8e92('0x4b')]})[_0x8e92('0x35')](function(_0x4815c4){_0x8f07c5[_0x8e92('0x2f')]=_0x4815c4;if(_0x401087[_0x8e92('0x41')]['includeAll']){_0x1d4d26[_0x8e92('0x52')]=[{'all':!![]}];}return db[_0x8e92('0x64')]['findAll'](_0x1d4d26);})[_0x8e92('0x35')](function(_0x4d4b58){_0x8f07c5[_0x8e92('0x54')]=_0x4d4b58;return _0x8f07c5;});}})[_0x8e92('0x35')](respondWithFilteredResult(_0x227ef4,_0x1d4d26))['catch'](handleError(_0x227ef4,null));};exports['removeDispositions']=function(_0x4a79d8,_0x40508b,_0x3c46ff){return db[_0x8e92('0x3c')]['find']({'where':{'id':_0x4a79d8[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x40508b,null))['then'](function(_0x449d3a){if(_0x449d3a){return _0x449d3a[_0x8e92('0x68')](_0x4a79d8[_0x8e92('0x41')][_0x8e92('0x69')]);}})[_0x8e92('0x35')](respondWithStatusCode(_0x40508b,null))[_0x8e92('0x29')](handleError(_0x40508b,null));};exports[_0x8e92('0x6a')]=function(_0x43b423,_0x4e19c1,_0x2c9e0f){if(_0x43b423[_0x8e92('0x5a')]['id']){delete _0x43b423[_0x8e92('0x5a')]['id'];}return db['OpenchannelAccount'][_0x8e92('0x58')]({'where':{'id':_0x43b423[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x4e19c1,null))['then'](function(_0x257229){if(_0x257229){_0x43b423[_0x8e92('0x5a')][_0x8e92('0x6b')]=_0x257229['id'];return db[_0x8e92('0x6c')][_0x8e92('0x59')](_0x43b423[_0x8e92('0x5a')]);}})[_0x8e92('0x35')](respondWithResult(_0x4e19c1,null))[_0x8e92('0x29')](handleError(_0x4e19c1,null));};exports[_0x8e92('0x6d')]=function(_0x256d1a,_0x3c7c50,_0x2467b1){var _0x47a6dc={'raw':![],'where':{}};var _0x5a02e2={};var _0x5f1a68={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x8e92('0x66')]({'where':{'id':_0x256d1a[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x3c7c50,null))[_0x8e92('0x35')](function(_0x1462d8){if(_0x1462d8){_0x5a02e2[_0x8e92('0x40')]=_['keys'](db[_0x8e92('0x6c')][_0x8e92('0x3d')]);_0x5a02e2['query']=_[_0x8e92('0x42')](_0x256d1a[_0x8e92('0x41')]);_0x5a02e2[_0x8e92('0x43')]=_['intersection'](_0x5a02e2[_0x8e92('0x40')],_0x5a02e2[_0x8e92('0x41')]);_0x47a6dc[_0x8e92('0x45')]=_['intersection'](_0x5a02e2[_0x8e92('0x40')],qs[_0x8e92('0x46')](_0x256d1a[_0x8e92('0x41')][_0x8e92('0x46')]));_0x47a6dc['attributes']=_0x47a6dc[_0x8e92('0x45')][_0x8e92('0x47')]?_0x47a6dc[_0x8e92('0x45')]:_0x5a02e2[_0x8e92('0x40')];if(!_0x256d1a[_0x8e92('0x41')][_0x8e92('0x48')](_0x8e92('0x67'))){_0x47a6dc[_0x8e92('0x2e')]=qs[_0x8e92('0x2e')](_0x256d1a[_0x8e92('0x41')][_0x8e92('0x2e')]);_0x47a6dc[_0x8e92('0x2c')]=qs[_0x8e92('0x2c')](_0x256d1a[_0x8e92('0x41')][_0x8e92('0x2c')]);}_0x47a6dc[_0x8e92('0x49')]=qs[_0x8e92('0x4a')](_0x256d1a[_0x8e92('0x41')][_0x8e92('0x4a')]);_0x47a6dc[_0x8e92('0x4b')]=qs['filters'](_[_0x8e92('0x4c')](_0x256d1a['query'],_0x5a02e2[_0x8e92('0x43')]));_0x47a6dc[_0x8e92('0x4b')][_0x8e92('0x6b')]=_0x1462d8['id'];if(_0x256d1a['query']['filter']){_0x47a6dc[_0x8e92('0x4b')]=_['merge'](_0x47a6dc[_0x8e92('0x4b')],{'$or':_[_0x8e92('0x3b')](_0x47a6dc[_0x8e92('0x45')],function(_0x4eb28c){var _0x927d2b={};_0x927d2b[_0x4eb28c]={'$like':'%'+_0x256d1a['query'][_0x8e92('0x4d')]+'%'};return _0x927d2b;})});}_0x47a6dc=_[_0x8e92('0x4f')]({},_0x47a6dc,_0x256d1a['options']);return db[_0x8e92('0x6c')][_0x8e92('0x2f')]({'where':_0x47a6dc['where']})[_0x8e92('0x35')](function(_0x597efe){_0x5f1a68[_0x8e92('0x2f')]=_0x597efe;if(_0x256d1a[_0x8e92('0x41')][_0x8e92('0x51')]){_0x47a6dc[_0x8e92('0x52')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x47a6dc);})[_0x8e92('0x35')](function(_0x404b0d){_0x5f1a68['rows']=_0x404b0d;return _0x5f1a68;});}})['then'](respondWithFilteredResult(_0x3c7c50,_0x47a6dc))[_0x8e92('0x29')](handleError(_0x3c7c50,null));};exports['removeAnswers']=function(_0xd321e2,_0x358808,_0x1552ce){return db[_0x8e92('0x3c')][_0x8e92('0x58')]({'where':{'id':_0xd321e2['params']['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x358808,null))[_0x8e92('0x35')](function(_0x4fa4bf){if(_0x4fa4bf){return _0x4fa4bf[_0x8e92('0x6e')](_0xd321e2[_0x8e92('0x41')]['ids']);}})[_0x8e92('0x35')](respondWithStatusCode(_0x358808,null))[_0x8e92('0x29')](handleError(_0x358808,null));};exports[_0x8e92('0x6f')]=function(_0x4c1426,_0x4d43c4,_0x15cd97){var _0x4de8f={'body':_0x4c1426[_0x8e92('0x5a')],'channel':_0x8e92('0x70')};var _0x2568b7=[];var _0x474d29=[];var _0xf0507e={};var _0x655a29=![];return db[_0x8e92('0x71')][_0x8e92('0x72')]()[_0x8e92('0x35')](function(_0x2b2b3f){if(!_0x2b2b3f){throw new db[(_0x8e92('0x73'))][(_0x8e92('0x74'))](_0x8e92('0x75'));}_0x2568b7=_[_0x8e92('0x76')](_['keys'](_0x2b2b3f),['createdAt',_0x8e92('0x77')]);_0x474d29=_[_0x8e92('0x76')](_['keys'](_0x2b2b3f),[_0x8e92('0x78'),_0x8e92('0x77'),_0x8e92('0x79'),_0x8e92('0x7a')]);if(_0x4c1426['body']['id']){delete _0x4c1426[_0x8e92('0x5a')]['id'];}if(_[_0x8e92('0x7b')](_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x7c')])){throw new db[(_0x8e92('0x73'))]['ValidationError'](_0x8e92('0x7d'));}if(_[_0x8e92('0x7b')](_0x4c1426[_0x8e92('0x5a')]['body'])||_0x4c1426[_0x8e92('0x5a')]['body']===''){throw new db[(_0x8e92('0x73'))][(_0x8e92('0x74'))](_0x8e92('0x7e'));}if(_[_0x8e92('0x7b')](_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x7f')])){throw new db['Sequelize'][(_0x8e92('0x74'))](_0x8e92('0x80')+_0x474d29);}if(!_[_0x8e92('0x81')](_0x474d29,_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x7f')])){throw new db[(_0x8e92('0x73'))]['ValidationError'](_0x8e92('0x82')+_0x474d29);}_0xf0507e[_0x4c1426['body'][_0x8e92('0x7f')]]=_0x4c1426['body']['from'];})[_0x8e92('0x35')](function(){return db[_0x8e92('0x3c')][_0x8e92('0x58')]({'where':{'id':_0x4c1426[_0x8e92('0x56')]['id']},'include':[{'model':db[_0x8e92('0x83')],'as':_0x8e92('0x84'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0xf0507e,'limit':0x1,'order':[[_0x8e92('0x77'),_0x8e92('0x85')]]}]},{'model':db['OpenchannelApplication'],'as':_0x8e92('0x86')}]});})['then'](handleEntityNotFound(_0x4d43c4,null))[_0x8e92('0x35')](function(_0x47a717){if(_0x47a717&&_0x47a717[_0x8e92('0x84')]){_0x4de8f[_0x8e92('0x87')]=_0x47a717;_0x4de8f[_0x8e92('0x88')]=_0x47a717[_0x8e92('0x86')];_0x4de8f[_0x8e92('0x89')]=_0x47a717[_0x8e92('0x84')];_0x4de8f[_0x8e92('0x88')]=_[_0x8e92('0x8a')](_0x4de8f[_0x8e92('0x88')],['priority'],['asc']);if(_0x4de8f[_0x8e92('0x87')][_0x8e92('0x86')]){delete _0x4de8f['account']['Applications'];}if(_0x4de8f[_0x8e92('0x87')]['List']&&_0x4de8f[_0x8e92('0x87')][_0x8e92('0x84')][_0x8e92('0x8b')]['length']){return _0x4de8f[_0x8e92('0x87')]['List'][_0x8e92('0x8b')][0x0];}var _0x2cfcfc=_[_0x8e92('0x1a')](_0x4c1426['body'],{'firstName':_0x4c1426[_0x8e92('0x5a')]['from'],'ListId':_0x47a717['ListId']});_0x2cfcfc[_0x4c1426['body'][_0x8e92('0x7f')]]=_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x7c')];return db['CmContact'][_0x8e92('0x59')](_0x2cfcfc,{'fields':_0x2568b7,'raw':!![]});}})[_0x8e92('0x35')](handleEntityNotFound(_0x4d43c4,null))[_0x8e92('0x35')](function(_0x5880ea){_0x4de8f['contact']=_0x5880ea;if(_0x5880ea){var _0x3841fc={'ContactId':_0x5880ea['id'],'OpenchannelAccountId':_0x4c1426[_0x8e92('0x56')]['id'],'from':(_0x5880ea[_0x8e92('0x8c')]||'')+'\x20'+(_0x5880ea[_0x8e92('0x8d')]||'')};var _0x20e50a={'OpenchannelAccountId':_0x4c1426[_0x8e92('0x56')]['id'],'closed':![]};if(_0x4c1426['body'][_0x8e92('0x8e')]){_0x20e50a[_0x8e92('0x8e')]=_0x4c1426['body'][_0x8e92('0x8e')];return db[_0x8e92('0x8f')][_0x8e92('0x58')]({'where':_0x20e50a})[_0x8e92('0x35')](function(_0x86bd10){if(_0x86bd10){return[_0x86bd10,![]];}_0x3841fc[_0x8e92('0x8e')]=_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x8e')];_0x3841fc[_0x8e92('0x90')]=_0x4c1426[_0x8e92('0x5a')]['externalUrl'];return db[_0x8e92('0x8f')][_0x8e92('0x59')](_0x3841fc)[_0x8e92('0x35')](function(_0x253362){return[_0x253362,!![]];});});}else{_0x20e50a[_0x8e92('0x8e')]=null;}_0x20e50a[_0x8e92('0x91')]=_0x5880ea['id'];return db[_0x8e92('0x8f')][_0x8e92('0x58')]({'where':_0x20e50a})['then'](function(_0x4c3b0f){if(_0x4c3b0f){return[_0x4c3b0f,![]];}return db[_0x8e92('0x8f')][_0x8e92('0x59')](_0x3841fc)[_0x8e92('0x35')](function(_0x4c61a7){return[_0x4c61a7,!![]];});});}})[_0x8e92('0x92')](function(_0x2e6119,_0x45a39d){if(_0x2e6119){_0x655a29=_0x45a39d;if(!_0x45a39d){var _0x1f86a2={'from':(_0x4de8f[_0x8e92('0x93')][_0x8e92('0x8c')]||'')+'\x20'+(_0x4de8f['contact'][_0x8e92('0x8d')]||'')};if(_0x4c1426['body'][_0x8e92('0x8e')]&&_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x94')]&&_0x4c1426['body'][_0x8e92('0x8e')]!=_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x94')]){_0x1f86a2[_0x8e92('0x8e')]=_0x4c1426[_0x8e92('0x5a')][_0x8e92('0x94')];}return _0x2e6119[_0x8e92('0x95')](_0x1f86a2);}else{return _0x2e6119;}}})[_0x8e92('0x35')](function(_0x3af9d8){_0x4de8f[_0x8e92('0x96')]=_0x3af9d8['get']({'plain':!![]});_0x4de8f['interaction'][_0x8e92('0x97')]=_0x655a29;if(_0x4de8f[_0x8e92('0x96')][_0x8e92('0x97')]){if(_0x4de8f[_0x8e92('0x87')][_0x8e92('0x98')]){_0x4de8f[_0x8e92('0x88')]['push']({'id':0x0,'priority':_0x4de8f[_0x8e92('0x88')][_0x8e92('0x47')]+0x1,'app':_0x8e92('0x99'),'appdata':_0x8e92('0x9a'),'interval':'*,*,*,*'});}}return db['OpenchannelMessage'][_0x8e92('0x59')]({'body':_0x4c1426['body'][_0x8e92('0x5a')],'OpenchannelAccountId':_0x4c1426[_0x8e92('0x56')]['id'],'OpenchannelInteractionId':_0x3af9d8['id'],'direction':'in','ContactId':_0x4de8f[_0x8e92('0x93')]['id'],'AttachmentId':_0x4c1426['body'][_0x8e92('0x9b')]});})['then'](function(_0x5ea555){_0x4de8f[_0x8e92('0x27')]=_0x5ea555;if(!_0x4de8f['interaction'][_0x8e92('0x9c')])return;return db['User'][_0x8e92('0x58')]({'attributes':['id',_0x8e92('0x39')],'where':{'id':_0x4de8f[_0x8e92('0x96')][_0x8e92('0x9c')]}});})['then'](function(_0x14e746){if(_0x14e746){_0x4de8f[_0x8e92('0x88')]['unshift']({'id':0x0,'priority':0x0,'app':_0x8e92('0x9d'),'appdata':_0x14e746[_0x8e92('0x39')]+','+(_0x4de8f[_0x8e92('0x87')]['waitForTheAssignedAgent']||0xa),'interval':_0x8e92('0x9e')});}if(!_0x4de8f[_0x8e92('0x96')][_0x8e92('0x9f')])return;return db[_0x8e92('0xa0')]['find']({'attributes':['id',_0x8e92('0x39')],'where':{'id':_0x4de8f[_0x8e92('0x96')][_0x8e92('0x9f')]}});})['then'](function(_0x52d2){if(_0x52d2){_0x4de8f['applications'][_0x8e92('0xa1')]({'id':0x0,'priority':0x1,'app':_0x8e92('0xa2'),'appdata':_0x52d2[_0x8e92('0x39')]+','+(_0x4de8f[_0x8e92('0x87')][_0x8e92('0xa3')]||0x12c),'interval':_0x8e92('0x9e')});}return respondWithRpcPromise(_0x8e92('0xa4'),_0x8e92('0xa5'),_0x4de8f);})[_0x8e92('0x35')](function(_0x3a5d78){respondWithRpcPromise(_0x8e92('0xa6'),_0x8e92('0xa6'),{'event':_0x8e92('0x6f'),'message':_0x3a5d78},client9002);return _0x3a5d78;})[_0x8e92('0x35')](respondWithResult(_0x4d43c4,null))[_0x8e92('0x29')](handleError(_0x4d43c4,null));};exports[_0x8e92('0xa7')]=function(_0xb9587,_0x2dfe61){var _0x3aa962=_0xb9587[_0x8e92('0x56')]['id'];var _0x3ac70c=_0xb9587[_0x8e92('0x5a')];var _0xab7bf5=0xc8;var _0x41b5f=null;return db['sequelize'][_0x8e92('0xa8')]({'isolationLevel':db[_0x8e92('0xa9')][_0x8e92('0xaa')][_0x8e92('0xab')][_0x8e92('0xac')]},function(_0x2d1cd4){return db[_0x8e92('0x3c')]['findOne']({'where':{'id':_0x3aa962},'transaction':_0x2d1cd4})[_0x8e92('0x35')](function(_0x2c8411){if(_0x2c8411){return db[_0x8e92('0xad')][_0x8e92('0x36')]({'where':{'OpenchannelAccountId':_0x3aa962},'transaction':_0x2d1cd4})[_0x8e92('0x35')](function(){var _0x1f8513=_[_0x8e92('0x3b')](_0x3ac70c,function(_0x391be3){_0x391be3[_0x8e92('0x6b')]=_0x3aa962;return _0x391be3;});return db[_0x8e92('0xad')]['bulkCreate'](_0x1f8513,{'transaction':_0x2d1cd4});});}else{_0xab7bf5=0x194;_0x41b5f=[];}});})['then'](function(){if(_0xab7bf5!==0x194){return db['OpenchannelApplication'][_0x8e92('0xae')]({'where':{'OpenchannelAccountId':_0x3aa962},'order':_0x8e92('0xaf')})[_0x8e92('0x35')](function(_0x1de4a3){_0x41b5f=_0x1de4a3;});}})['catch'](function(_0x2ba2f2){_0xab7bf5=0x1f4;logger['error'](_0x2ba2f2['stack']);if(_0x2ba2f2[_0x8e92('0x39')]){delete _0x2ba2f2[_0x8e92('0x39')];}_0x41b5f=_0x2ba2f2;})[_0x8e92('0xb0')](function(){if(_0x41b5f===null){_0x2dfe61[_0x8e92('0x2a')](_0xab7bf5);}else{if(_0xab7bf5===0x1f4){_0x2dfe61['status'](_0xab7bf5)['send'](_0x41b5f);}else{_0x2dfe61[_0x8e92('0x2b')](_0xab7bf5)['json'](_0x41b5f);}}});};exports[_0x8e92('0xb1')]=function(_0x19b911,_0x33e1ac,_0x6b7118){var _0x57d52a={};var _0x17d031={};var _0x1ca0e5;var _0x41fee4;return db[_0x8e92('0x3c')][_0x8e92('0x66')]({'where':{'id':_0x19b911[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x33e1ac,null))[_0x8e92('0x35')](function(_0x46d558){if(_0x46d558){_0x1ca0e5=_0x46d558;_0x17d031[_0x8e92('0x40')]=_[_0x8e92('0x42')](db['OpenchannelApplication']['rawAttributes']);_0x17d031['query']=_[_0x8e92('0x42')](_0x19b911[_0x8e92('0x41')]);_0x17d031[_0x8e92('0x43')]=_[_0x8e92('0x44')](_0x17d031[_0x8e92('0x40')],_0x17d031[_0x8e92('0x41')]);_0x57d52a[_0x8e92('0x45')]=_[_0x8e92('0x44')](_0x17d031[_0x8e92('0x40')],qs[_0x8e92('0x46')](_0x19b911['query'][_0x8e92('0x46')]));_0x57d52a[_0x8e92('0x45')]=_0x57d52a[_0x8e92('0x45')][_0x8e92('0x47')]?_0x57d52a['attributes']:_0x17d031[_0x8e92('0x40')];_0x57d52a[_0x8e92('0x49')]=qs[_0x8e92('0x4a')](_0x19b911[_0x8e92('0x41')]['sort']);_0x57d52a[_0x8e92('0x4b')]=qs[_0x8e92('0x43')](_['pick'](_0x19b911[_0x8e92('0x41')],_0x17d031[_0x8e92('0x43')]));if(_0x19b911['query'][_0x8e92('0x4d')]){_0x57d52a[_0x8e92('0x4b')]=_['merge'](_0x57d52a[_0x8e92('0x4b')],{'$or':_[_0x8e92('0x3b')](_0x57d52a[_0x8e92('0x45')],function(_0x3f4c7e){var _0x2b1c7a={};_0x2b1c7a[_0x3f4c7e]={'$like':'%'+_0x19b911[_0x8e92('0x41')][_0x8e92('0x4d')]+'%'};return _0x2b1c7a;})});}_0x57d52a=_['merge']({},_0x57d52a,_0x19b911[_0x8e92('0x50')]);return _0x1ca0e5[_0x8e92('0xb1')](_0x57d52a);}})[_0x8e92('0x35')](function(_0x5ccf89){if(_0x5ccf89){_0x41fee4=_0x5ccf89[_0x8e92('0x47')];if(!_0x19b911[_0x8e92('0x41')][_0x8e92('0x48')]('nolimit')){_0x57d52a[_0x8e92('0x2e')]=qs['limit'](_0x19b911[_0x8e92('0x41')][_0x8e92('0x2e')]);_0x57d52a[_0x8e92('0x2c')]=qs[_0x8e92('0x2c')](_0x19b911['query'][_0x8e92('0x2c')]);}return _0x1ca0e5[_0x8e92('0xb1')](_0x57d52a);}})[_0x8e92('0x35')](function(_0xd5f67c){if(_0xd5f67c){return _0xd5f67c?{'count':_0x41fee4,'rows':_0xd5f67c}:null;}})['then'](respondWithResult(_0x33e1ac,null))[_0x8e92('0x29')](handleError(_0x33e1ac,null));};exports[_0x8e92('0xb2')]=function(_0x33e535,_0x2c5f16,_0xacd1c4){var _0x103b88={'raw':![],'where':{}};var _0x4aaef4={};var _0x585c65={'count':0x0,'rows':[]};return db['OpenchannelAccount']['findOne']({'where':{'id':_0x33e535[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x2c5f16,null))[_0x8e92('0x35')](function(_0x5b2018){if(_0x5b2018){_0x4aaef4['model']=_[_0x8e92('0x42')](db[_0x8e92('0x8f')][_0x8e92('0x3d')]);_0x4aaef4[_0x8e92('0x41')]=_['keys'](_0x33e535[_0x8e92('0x41')]);_0x4aaef4['filters']=_[_0x8e92('0x44')](_0x4aaef4[_0x8e92('0x40')],_0x4aaef4[_0x8e92('0x41')]);_0x103b88[_0x8e92('0x45')]=_[_0x8e92('0x44')](_0x4aaef4['model'],qs['fields'](_0x33e535['query'][_0x8e92('0x46')]));_0x103b88[_0x8e92('0x45')]=_0x103b88[_0x8e92('0x45')][_0x8e92('0x47')]?_0x103b88[_0x8e92('0x45')]:_0x4aaef4[_0x8e92('0x40')];if(!_0x33e535[_0x8e92('0x41')]['hasOwnProperty']('nolimit')){_0x103b88['limit']=qs[_0x8e92('0x2e')](_0x33e535[_0x8e92('0x41')]['limit']);_0x103b88['offset']=qs['offset'](_0x33e535[_0x8e92('0x41')]['offset']);}_0x103b88[_0x8e92('0x49')]=qs[_0x8e92('0x4a')](_0x33e535[_0x8e92('0x41')][_0x8e92('0x4a')]);_0x103b88[_0x8e92('0x4b')]=qs[_0x8e92('0x43')](_['pick'](_0x33e535['query'],_0x4aaef4[_0x8e92('0x43')]));_0x103b88[_0x8e92('0x4b')][_0x8e92('0x6b')]=_0x5b2018['id'];if(_0x33e535[_0x8e92('0x41')][_0x8e92('0x4d')]){_0x103b88['where']=_[_0x8e92('0x4f')](_0x103b88[_0x8e92('0x4b')],{'$or':_[_0x8e92('0x3b')](_0x103b88[_0x8e92('0x45')],function(_0x224685){var _0x4e62ae={};_0x4e62ae[_0x224685]={'$like':'%'+_0x33e535[_0x8e92('0x41')]['filter']+'%'};return _0x4e62ae;})});}_0x103b88=_[_0x8e92('0x4f')]({},_0x103b88,_0x33e535[_0x8e92('0x50')]);return db[_0x8e92('0x8f')]['count']({'where':_0x103b88['where']})[_0x8e92('0x35')](function(_0x5010ab){_0x585c65[_0x8e92('0x2f')]=_0x5010ab;if(_0x33e535[_0x8e92('0x41')][_0x8e92('0x51')]){_0x103b88['include']=[{'model':db['CmContact'],'as':'Contact','required':![]},{'model':db[_0x8e92('0xb3')],'as':'Owner','attributes':['name',_0x8e92('0xb4'),'internal'],'required':![]},{'model':db['Tag'],'as':_0x8e92('0xb5'),'attributes':['id',_0x8e92('0x39'),_0x8e92('0xb6')],'where':_0x33e535['query'][_0x8e92('0xb7')]?{'id':_0x33e535[_0x8e92('0x41')][_0x8e92('0xb7')]}:undefined,'required':_0x33e535[_0x8e92('0x41')][_0x8e92('0xb7')]?!![]:![]}];}return db[_0x8e92('0x8f')]['findAll'](_0x103b88);})[_0x8e92('0x35')](function(_0x4a105e){_0x585c65[_0x8e92('0x54')]=_0x4a105e;return _0x585c65;});}})[_0x8e92('0x35')](respondWithFilteredResult(_0x2c5f16,_0x103b88))[_0x8e92('0x29')](handleError(_0x2c5f16,null));};exports[_0x8e92('0xb8')]=function(_0x153f63,_0x351579,_0x1b6186){return db[_0x8e92('0x3c')][_0x8e92('0x58')]({'where':{'id':_0x153f63[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x351579,null))[_0x8e92('0x35')](function(_0x596fd0){if(_0x596fd0){return _0x596fd0['addAgents'](_0x153f63[_0x8e92('0x5a')]['ids'],_['omit'](_0x153f63[_0x8e92('0x5a')],[_0x8e92('0x69'),'id'])||{})[_0x8e92('0x92')](function(_0x4e5439){for(var _0x302c28=0x0;_0x302c28<_0x153f63[_0x8e92('0x5a')][_0x8e92('0x69')]['length'];_0x302c28+=0x1){socket[_0x8e92('0xb9')]('userOpenchannelAccount:save',{'UserId':Number(_0x153f63['body']['ids'][_0x302c28]),'OpenchannelAccountId':Number(_0x153f63[_0x8e92('0x56')]['id'])});}return _0x4e5439;});}})[_0x8e92('0x35')](respondWithResult(_0x351579,null))[_0x8e92('0x29')](handleError(_0x351579,null));};exports[_0x8e92('0xba')]=function(_0x5d7bf4,_0x34f9e3,_0x5abbba){return db[_0x8e92('0x3c')]['find']({'where':{'id':_0x5d7bf4[_0x8e92('0x56')]['id']}})['then'](handleEntityNotFound(_0x34f9e3,null))[_0x8e92('0x35')](function(_0xd0999a){if(_0xd0999a){return _0xd0999a['removeAgents'](_0x5d7bf4[_0x8e92('0x41')]['ids'])[_0x8e92('0x35')](function(){if(_[_0x8e92('0xbb')](_0x5d7bf4['query'][_0x8e92('0x69')])){for(var _0x4f15a4=0x0;_0x4f15a4<_0x5d7bf4['query'][_0x8e92('0x69')][_0x8e92('0x47')];_0x4f15a4+=0x1){socket[_0x8e92('0xb9')](_0x8e92('0xbc'),{'UserId':Number(_0x5d7bf4[_0x8e92('0x41')][_0x8e92('0x69')][_0x4f15a4]),'OpenchannelAccountId':Number(_0x5d7bf4[_0x8e92('0x56')]['id'])});}}else{socket['emit'](_0x8e92('0xbc'),{'UserId':Number(_0x5d7bf4[_0x8e92('0x41')][_0x8e92('0x69')]),'OpenchannelAccountId':Number(_0x5d7bf4[_0x8e92('0x56')]['id'])});}});}})[_0x8e92('0x35')](respondWithStatusCode(_0x34f9e3,null))[_0x8e92('0x29')](handleError(_0x34f9e3,null));};exports[_0x8e92('0xbd')]=function(_0x42ef51,_0x862c72,_0x5ccdd9){var _0x2ea8a7={};var _0x3f7175={};var _0x43d4c9;var _0x541b04;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x42ef51[_0x8e92('0x56')]['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x862c72,null))['then'](function(_0x27a0c1){if(_0x27a0c1){_0x43d4c9=_0x27a0c1;_0x3f7175[_0x8e92('0x40')]=_['keys'](db['User'][_0x8e92('0x3d')]);_0x3f7175['query']=_[_0x8e92('0x42')](_0x42ef51['query']);_0x3f7175['filters']=_[_0x8e92('0x44')](_0x3f7175['model'],_0x3f7175[_0x8e92('0x41')]);_0x2ea8a7[_0x8e92('0x45')]=_[_0x8e92('0x44')](_0x3f7175['model'],qs[_0x8e92('0x46')](_0x42ef51[_0x8e92('0x41')]['fields']));_0x2ea8a7[_0x8e92('0x45')]=_0x2ea8a7[_0x8e92('0x45')][_0x8e92('0x47')]?_0x2ea8a7[_0x8e92('0x45')]:_0x3f7175[_0x8e92('0x40')];_0x2ea8a7[_0x8e92('0x49')]=qs[_0x8e92('0x4a')](_0x42ef51['query'][_0x8e92('0x4a')]);_0x2ea8a7['where']=qs[_0x8e92('0x43')](_['pick'](_0x42ef51[_0x8e92('0x41')],_0x3f7175['filters']));if(_0x42ef51['query'][_0x8e92('0x4d')]){_0x2ea8a7[_0x8e92('0x4b')]=_['merge'](_0x2ea8a7[_0x8e92('0x4b')],{'$or':_[_0x8e92('0x3b')](_0x2ea8a7[_0x8e92('0x45')],function(_0xf6a729){var _0x522c97={};_0x522c97[_0xf6a729]={'$like':'%'+_0x42ef51['query']['filter']+'%'};return _0x522c97;})});}_0x2ea8a7=_[_0x8e92('0x4f')]({},_0x2ea8a7,_0x42ef51[_0x8e92('0x50')]);return _0x43d4c9[_0x8e92('0xbd')](_0x2ea8a7);}})[_0x8e92('0x35')](function(_0x45b10c){if(_0x45b10c){_0x541b04=_0x45b10c[_0x8e92('0x47')];if(!_0x42ef51[_0x8e92('0x41')]['hasOwnProperty'](_0x8e92('0x67'))){_0x2ea8a7[_0x8e92('0x2e')]=qs[_0x8e92('0x2e')](_0x42ef51[_0x8e92('0x41')][_0x8e92('0x2e')]);_0x2ea8a7[_0x8e92('0x2c')]=qs[_0x8e92('0x2c')](_0x42ef51['query'][_0x8e92('0x2c')]);}return _0x43d4c9[_0x8e92('0xbd')](_0x2ea8a7);}})['then'](function(_0x2ad425){if(_0x2ad425){return _0x2ad425?{'count':_0x541b04,'rows':_0x2ad425}:null;}})[_0x8e92('0x35')](respondWithResult(_0x862c72,null))[_0x8e92('0x29')](handleError(_0x862c72,null));};exports[_0x8e92('0xbe')]=function(_0x79664b,_0x52e93a,_0x56ce24){var _0x2aaa95,_0x4b41e6,_0x48e96e;if(_[_0x8e92('0x7b')](_0x79664b[_0x8e92('0x5a')][_0x8e92('0x5a')])||_0x79664b[_0x8e92('0x5a')]['body']===''){throw new db[(_0x8e92('0x73'))][(_0x8e92('0x74'))](_0x8e92('0x7e'));}if(_[_0x8e92('0x7b')](_0x79664b[_0x8e92('0x5a')]['to'])){}_0x2aaa95=_0x79664b[_0x8e92('0x5a')]['to'];return db[_0x8e92('0x3c')][_0x8e92('0x66')]({'where':{'id':_0x79664b['params']['id']}})[_0x8e92('0x35')](handleEntityNotFound(_0x52e93a,null))[_0x8e92('0x35')](function(_0x55a85f){if(_0x55a85f){return db['OpenchannelAccount'][_0x8e92('0x58')]({'where':{'id':_0x55a85f['id']},'include':[{'model':db[_0x8e92('0x83')],'as':'List','include':[{'model':db['CmContact'],'as':_0x8e92('0x8b'),'where':{[_0x55a85f[_0x8e92('0x7f')]]:_0x2aaa95},'limit':0x1,'order':[['updatedAt',_0x8e92('0x85')]]}]}]})[_0x8e92('0x35')](handleEntityNotFound(_0x52e93a,null))[_0x8e92('0x35')](function(_0x24dc00){if(_0x24dc00&&_0x24dc00['List']){_0x4b41e6=_0x24dc00[_0x8e92('0x5c')]({'plain':!![]});if(_0x4b41e6[_0x8e92('0x84')]&&_0x4b41e6[_0x8e92('0x84')][_0x8e92('0x8b')][_0x8e92('0x47')]){return _0x4b41e6[_0x8e92('0x84')][_0x8e92('0x8b')][0x0];}return db[_0x8e92('0x71')][_0x8e92('0x59')](_[_0x8e92('0x1a')](_0x79664b[_0x8e92('0x5a')],{'firstName':_0x2aaa95,[_0x24dc00[_0x8e92('0x7f')]]:_0x2aaa95,'phone':_0x2aaa95,'ListId':_0x4b41e6[_0x8e92('0x7a')]}));}})[_0x8e92('0x35')](handleEntityNotFound(_0x52e93a,null))[_0x8e92('0x35')](function(_0x4a1b8f){if(_0x4a1b8f){_0x48e96e=_0x4a1b8f;return db['OpenchannelInteraction'][_0x8e92('0x58')]({'where':{'ContactId':_0x48e96e['id'],'closed':![],'OpenchannelAccountId':_0x4b41e6['id']}})['then'](function(_0x13698f){if(_0x13698f){return[_0x13698f,![]];}return db[_0x8e92('0x8f')][_0x8e92('0x59')]({'UserId':_0x79664b[_0x8e92('0x5b')]['id'],'ContactId':_0x48e96e['id'],'OpenchannelAccountId':_0x4b41e6['id'],'lastMsgDirection':_0x8e92('0xbf'),'firstMsgDirection':'out','Messages':[_['merge'](_0x79664b[_0x8e92('0x5a')],{'read':![],'body':_0x79664b[_0x8e92('0x5a')][_0x8e92('0x5a')],'OpenchannelAccountId':_0x4b41e6['id'],'UserId':_0x79664b['user']['id'],'ContactId':_0x48e96e['id']})]},{'include':[{'model':db[_0x8e92('0xc0')],'as':_0x8e92('0xc1')}]})[_0x8e92('0x35')](function(_0x32bcbd){return[_0x32bcbd,!![]];});});}})[_0x8e92('0x92')](function(_0x5b8b9c,_0x41ce38){if(_0x41ce38){return _0x5b8b9c;}return db[_0x8e92('0xc0')][_0x8e92('0x59')](_[_0x8e92('0x4f')](_0x79664b[_0x8e92('0x5a')],{'read':![],'body':_0x79664b[_0x8e92('0x5a')][_0x8e92('0x5a')],'OpenchannelAccountId':_0x4b41e6['id'],'OpenchannelInteractionId':_0x5b8b9c['id'],'UserId':_0x79664b[_0x8e92('0x5b')]['id'],'ContactId':_0x48e96e['id']}))[_0x8e92('0x35')](function(_0x45ac36){_0x5b8b9c[_0x8e92('0xc2')]['Messages']=[];_0x5b8b9c[_0x8e92('0xc2')][_0x8e92('0xc1')][_0x8e92('0xc3')](_0x45ac36[_0x8e92('0xc2')]);return _0x5b8b9c;});});}})[_0x8e92('0x35')](respondWithResult(_0x52e93a,null))['catch'](handleError(_0x52e93a,null));}; \ No newline at end of file +var _0xef66=['removeDispositions','ids','addAnswer','CannedAnswer','removeAnswers','CmContact','difference','createdAt','updatedAt','CompanyId','isNil','from','Sequelize','ValidationError','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','OpenchannelApplication','Applications','List','account','list','orderBy','applications','priority','asc','ListId','contact','lastName','threadId','OpenchannelInteraction','externalUrl','spread','messageId','interaction','created','autoclose','push','unmanaged','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','queueId','OpenchannelQueue','queue','waitForTheAssignedQueue','*,*,*,*','Start','startRouting','EventManager','notify','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','bulkCreate','findAndCountAll','stack','finally','getApplications','getInteractions','Contact','Owner','fullname','internal','Tag','Tags','color','tag','omit','emit','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','jayson/promise','client','http','request','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','UserProfileResource','then','name','send','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','get','OpenchannelAccounts','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','Pause','describe','addDisposition','OpenchannelAccountId','Disposition','findOne','map'];(function(_0xcf0d77,_0x2195aa){var _0x13b05f=function(_0x2e798b){while(--_0x2e798b){_0xcf0d77['push'](_0xcf0d77['shift']());}};_0x13b05f(++_0x2195aa);}(_0xef66,0x1db));var _0x6ef6=function(_0x4fd311,_0x29decd){_0x4fd311=_0x4fd311-0x0;var _0x281e83=_0xef66[_0x4fd311];return _0x281e83;};'use strict';var emlformat=require(_0x6ef6('0x0'));var rimraf=require(_0x6ef6('0x1'));var zipdir=require(_0x6ef6('0x2'));var jsonpatch=require(_0x6ef6('0x3'));var rp=require(_0x6ef6('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6ef6('0x5'));var util=require(_0x6ef6('0x6'));var path=require(_0x6ef6('0x7'));var sox=require(_0x6ef6('0x8'));var csv=require(_0x6ef6('0x9'));var ejs=require(_0x6ef6('0xa'));var fs=require('fs');var fs_extra=require(_0x6ef6('0xb'));var _=require(_0x6ef6('0xc'));var squel=require(_0x6ef6('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6ef6('0xe'));var toCsv=require(_0x6ef6('0x9'));var querystring=require(_0x6ef6('0xf'));var Papa=require(_0x6ef6('0x10'));var Redis=require(_0x6ef6('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6ef6('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ef6('0x13'))('api');var utils=require(_0x6ef6('0x14'));var config=require(_0x6ef6('0x15'));var licenseUtil=require(_0x6ef6('0x16'));var db=require(_0x6ef6('0x17'))['db'];config['redis']=_[_0x6ef6('0x18')](config[_0x6ef6('0x19')],{'host':_0x6ef6('0x1a'),'port':0x18eb});var socket=require(_0x6ef6('0x1b'))(new Redis(config['redis']));require(_0x6ef6('0x1c'))['register'](socket);var jayson=require(_0x6ef6('0x1d'));var client=jayson[_0x6ef6('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x6ef6('0x1e')][_0x6ef6('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x453aa3,_0x3f0a84,_0x3fa688,_0x2e6eb6){return new BPromise(function(_0x4ea222,_0x30b8e8){var _0x1ed381=_0x2e6eb6||client;return _0x1ed381[_0x6ef6('0x20')](_0x453aa3,_0x3fa688)['then'](function(_0x3fc3d1){logger[_0x6ef6('0x21')](_0x6ef6('0x22'),_0x3f0a84,_0x6ef6('0x23'));logger[_0x6ef6('0x24')](_0x6ef6('0x25'),_0x3f0a84,_0x6ef6('0x23'),JSON['stringify'](_0x3fc3d1));if(_0x3fc3d1[_0x6ef6('0x26')]){if(_0x3fc3d1[_0x6ef6('0x26')][_0x6ef6('0x27')]===0x1f4){logger[_0x6ef6('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x3f0a84,_0x3fc3d1[_0x6ef6('0x26')][_0x6ef6('0x28')]);return _0x30b8e8(_0x3fc3d1[_0x6ef6('0x26')]['message']);}logger[_0x6ef6('0x26')](_0x6ef6('0x22'),_0x3f0a84,_0x3fc3d1['error'][_0x6ef6('0x28')]);return _0x4ea222(_0x3fc3d1[_0x6ef6('0x26')]['message']);}else{logger[_0x6ef6('0x21')](_0x6ef6('0x22'),_0x3f0a84,_0x6ef6('0x23'));_0x4ea222(_0x3fc3d1[_0x6ef6('0x29')][_0x6ef6('0x28')]);}})[_0x6ef6('0x2a')](function(_0x1cd549){logger['error'](_0x6ef6('0x22'),_0x3f0a84,_0x1cd549);_0x30b8e8(_0x1cd549);});});}function respondWithStatusCode(_0x503379,_0x39d3cc){_0x39d3cc=_0x39d3cc||0xcc;return function(_0x692c3d){if(_0x692c3d){return _0x503379[_0x6ef6('0x2b')](_0x39d3cc);}return _0x503379[_0x6ef6('0x2c')](_0x39d3cc)[_0x6ef6('0x2d')]();};}function respondWithResult(_0xf69d3d,_0x23eb77){_0x23eb77=_0x23eb77||0xc8;return function(_0x3e027d){if(_0x3e027d){return _0xf69d3d[_0x6ef6('0x2c')](_0x23eb77)[_0x6ef6('0x2e')](_0x3e027d);}};}function respondWithFilteredResult(_0x136d20,_0x2d87a8){return function(_0x483f4d){if(_0x483f4d){var _0x40f9f6=typeof _0x2d87a8[_0x6ef6('0x2f')]===_0x6ef6('0x30')&&typeof _0x2d87a8[_0x6ef6('0x31')]===_0x6ef6('0x30');var _0x24eeae=_0x483f4d[_0x6ef6('0x32')];var _0x512dda=_0x40f9f6?0x0:_0x2d87a8[_0x6ef6('0x2f')];var _0x5f3179=_0x40f9f6?_0x483f4d[_0x6ef6('0x32')]:_0x2d87a8[_0x6ef6('0x2f')]+_0x2d87a8[_0x6ef6('0x31')];var _0x50c9e4;if(_0x5f3179>=_0x24eeae){_0x5f3179=_0x24eeae;_0x50c9e4=0xc8;}else{_0x50c9e4=0xce;}_0x136d20['status'](_0x50c9e4);return _0x136d20[_0x6ef6('0x33')](_0x6ef6('0x34'),_0x512dda+'-'+_0x5f3179+'/'+_0x24eeae)[_0x6ef6('0x2e')](_0x483f4d);}return null;};}function patchUpdates(_0x47b87b){return function(_0x364d4d){try{jsonpatch['apply'](_0x364d4d,_0x47b87b,!![]);}catch(_0x3cc6a3){return BPromise[_0x6ef6('0x35')](_0x3cc6a3);}return _0x364d4d['save']();};}function saveUpdates(_0x4830bf,_0x31a564){return function(_0x5395a3){if(_0x5395a3){return _0x5395a3[_0x6ef6('0x36')](_0x4830bf)['then'](function(_0x3f0ada){return _0x3f0ada;});}return null;};}function removeEntity(_0x4b8d24,_0x5e132a){return function(_0x72c277){if(_0x72c277){return _0x72c277[_0x6ef6('0x37')]()['then'](function(){var _0x3df4da=_0x72c277['get']({'plain':!![]});var _0xf1aaf2='OpenchannelAccounts';return db[_0x6ef6('0x38')]['destroy']({'where':{'type':_0xf1aaf2,'resourceId':_0x3df4da['id']}})[_0x6ef6('0x39')](function(){return _0x72c277;});})[_0x6ef6('0x39')](function(){_0x4b8d24[_0x6ef6('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x546bc3,_0xf186c1){return function(_0x101427){if(!_0x101427){_0x546bc3[_0x6ef6('0x2b')](0x194);}return _0x101427;};}function handleError(_0x2f3f3e,_0x47b474){_0x47b474=_0x47b474||0x1f4;return function(_0x538757){logger[_0x6ef6('0x26')](_0x538757['stack']);if(_0x538757['name']){delete _0x538757[_0x6ef6('0x3a')];}_0x2f3f3e['status'](_0x47b474)[_0x6ef6('0x3b')](_0x538757);};}exports[_0x6ef6('0x3c')]=function(_0x30649c,_0x31facc){var _0x2828ef={'include':[{'model':db['Pause'],'as':_0x6ef6('0x3d')}]},_0xed6093={},_0x13b3c0={'count':0x0,'rows':[]};var _0x58fed8=_['map'](db[_0x6ef6('0x3e')][_0x6ef6('0x3f')],function(_0x1e4375){return{'name':_0x1e4375['fieldName'],'type':_0x1e4375[_0x6ef6('0x40')][_0x6ef6('0x41')]};});_0xed6093[_0x6ef6('0x42')]=_['map'](_0x58fed8,_0x6ef6('0x3a'));_0xed6093[_0x6ef6('0x43')]=_[_0x6ef6('0x44')](_0x30649c[_0x6ef6('0x43')]);_0xed6093[_0x6ef6('0x45')]=_[_0x6ef6('0x46')](_0xed6093[_0x6ef6('0x42')],_0xed6093[_0x6ef6('0x43')]);_0x2828ef[_0x6ef6('0x47')]=_[_0x6ef6('0x46')](_0xed6093['model'],qs[_0x6ef6('0x48')](_0x30649c[_0x6ef6('0x43')][_0x6ef6('0x48')]));_0x2828ef[_0x6ef6('0x47')]=_0x2828ef[_0x6ef6('0x47')][_0x6ef6('0x49')]?_0x2828ef[_0x6ef6('0x47')]:_0xed6093[_0x6ef6('0x42')];if(!_0x30649c[_0x6ef6('0x43')][_0x6ef6('0x4a')](_0x6ef6('0x4b'))){_0x2828ef['limit']=qs[_0x6ef6('0x31')](_0x30649c['query'][_0x6ef6('0x31')]);_0x2828ef['offset']=qs[_0x6ef6('0x2f')](_0x30649c[_0x6ef6('0x43')]['offset']);}_0x2828ef[_0x6ef6('0x4c')]=qs[_0x6ef6('0x4d')](_0x30649c[_0x6ef6('0x43')][_0x6ef6('0x4d')]);_0x2828ef[_0x6ef6('0x4e')]=qs['filters'](_[_0x6ef6('0x4f')](_0x30649c[_0x6ef6('0x43')],_0xed6093[_0x6ef6('0x45')]),_0x58fed8);if(_0x30649c[_0x6ef6('0x43')][_0x6ef6('0x50')]){_0x2828ef[_0x6ef6('0x4e')]=_[_0x6ef6('0x51')](_0x2828ef[_0x6ef6('0x4e')],{'$or':_['map'](_0x58fed8,function(_0x367df3){if(_0x367df3[_0x6ef6('0x40')]!=='VIRTUAL'){var _0x5d6b40={};_0x5d6b40[_0x367df3[_0x6ef6('0x3a')]]={'$like':'%'+_0x30649c['query'][_0x6ef6('0x50')]+'%'};return _0x5d6b40;}})});}_0x2828ef=_['merge']({},_0x2828ef,_0x30649c[_0x6ef6('0x52')]);var _0x712015={'where':_0x2828ef[_0x6ef6('0x4e')]};return db[_0x6ef6('0x3e')]['count'](_0x712015)['then'](function(_0x560f19){_0x13b3c0['count']=_0x560f19;if(_0x30649c[_0x6ef6('0x43')][_0x6ef6('0x53')]){_0x2828ef[_0x6ef6('0x54')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0x6ef6('0x55')](_0x2828ef);})[_0x6ef6('0x39')](function(_0x30a2a5){_0x13b3c0[_0x6ef6('0x56')]=_0x30a2a5;return _0x13b3c0;})[_0x6ef6('0x39')](respondWithFilteredResult(_0x31facc,_0x2828ef))[_0x6ef6('0x2a')](handleError(_0x31facc,null));};exports[_0x6ef6('0x57')]=function(_0x4f547e,_0x260497){var _0x4bdaed={'raw':![],'where':{'id':_0x4f547e[_0x6ef6('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x36665e={};_0x36665e[_0x6ef6('0x42')]=_[_0x6ef6('0x44')](db[_0x6ef6('0x3e')][_0x6ef6('0x3f')]);_0x36665e[_0x6ef6('0x43')]=_[_0x6ef6('0x44')](_0x4f547e[_0x6ef6('0x43')]);_0x36665e['filters']=_[_0x6ef6('0x46')](_0x36665e[_0x6ef6('0x42')],_0x36665e[_0x6ef6('0x43')]);_0x4bdaed['attributes']=_[_0x6ef6('0x46')](_0x36665e[_0x6ef6('0x42')],qs['fields'](_0x4f547e[_0x6ef6('0x43')][_0x6ef6('0x48')]));_0x4bdaed[_0x6ef6('0x47')]=_0x4bdaed[_0x6ef6('0x47')][_0x6ef6('0x49')]?_0x4bdaed[_0x6ef6('0x47')]:_0x36665e[_0x6ef6('0x42')];if(_0x4f547e[_0x6ef6('0x43')]['includeAll']){_0x4bdaed[_0x6ef6('0x54')]=[{'all':!![]}];}_0x4bdaed=_[_0x6ef6('0x51')]({},_0x4bdaed,_0x4f547e[_0x6ef6('0x52')]);return db[_0x6ef6('0x3e')]['find'](_0x4bdaed)[_0x6ef6('0x39')](handleEntityNotFound(_0x260497,null))['then'](respondWithResult(_0x260497,null))[_0x6ef6('0x2a')](handleError(_0x260497,null));};exports[_0x6ef6('0x59')]=function(_0xf02140,_0x4b0066){return db[_0x6ef6('0x3e')][_0x6ef6('0x59')](_0xf02140['body'],{})['then'](function(_0xd33336){var _0x287f39=_0xf02140[_0x6ef6('0x5a')]['get']({'plain':!![]});if(!_0x287f39)throw new Error(_0x6ef6('0x5b'));if(_0x287f39['role']==='user'){var _0x3b951b=_0xd33336[_0x6ef6('0x5c')]({'plain':!![]});var _0x5d2c94=_0x6ef6('0x5d');return db[_0x6ef6('0x5e')][_0x6ef6('0x5f')]({'where':{'name':_0x5d2c94,'userProfileId':_0x287f39[_0x6ef6('0x60')]},'raw':!![]})['then'](function(_0x377a8f){if(_0x377a8f&&_0x377a8f[_0x6ef6('0x61')]===0x0){return db[_0x6ef6('0x38')][_0x6ef6('0x59')]({'name':_0x3b951b[_0x6ef6('0x3a')],'resourceId':_0x3b951b['id'],'type':_0x377a8f[_0x6ef6('0x3a')],'sectionId':_0x377a8f['id']},{})['then'](function(){return _0xd33336;});}else{return _0xd33336;}})['catch'](function(_0x549e4c){logger[_0x6ef6('0x26')](_0x6ef6('0x62'),_0x549e4c);throw _0x549e4c;});}return _0xd33336;})[_0x6ef6('0x39')](respondWithResult(_0x4b0066,0xc9))[_0x6ef6('0x2a')](handleError(_0x4b0066,null));};exports[_0x6ef6('0x36')]=function(_0x3de2f3,_0x1b8052){if(_0x3de2f3[_0x6ef6('0x63')]['id']){delete _0x3de2f3[_0x6ef6('0x63')]['id'];}return db[_0x6ef6('0x3e')][_0x6ef6('0x5f')]({'where':{'id':_0x3de2f3['params']['id']},'include':[{'model':db[_0x6ef6('0x64')],'as':_0x6ef6('0x3d')}]})[_0x6ef6('0x39')](handleEntityNotFound(_0x1b8052,null))[_0x6ef6('0x39')](saveUpdates(_0x3de2f3[_0x6ef6('0x63')],null))[_0x6ef6('0x39')](respondWithResult(_0x1b8052,null))[_0x6ef6('0x2a')](handleError(_0x1b8052,null));};exports[_0x6ef6('0x37')]=function(_0x5d3d70,_0x28f39b){return db['OpenchannelAccount'][_0x6ef6('0x5f')]({'where':{'id':_0x5d3d70[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x28f39b,null))['then'](removeEntity(_0x28f39b,null))[_0x6ef6('0x2a')](handleError(_0x28f39b,null));};exports[_0x6ef6('0x65')]=function(_0x1999df,_0x43e63b){return db['OpenchannelAccount'][_0x6ef6('0x65')]()[_0x6ef6('0x39')](respondWithResult(_0x43e63b,null))[_0x6ef6('0x2a')](handleError(_0x43e63b,null));};exports[_0x6ef6('0x66')]=function(_0x3c6975,_0x5b4005,_0x3593b3){if(_0x3c6975[_0x6ef6('0x63')]['id']){delete _0x3c6975[_0x6ef6('0x63')]['id'];}return db[_0x6ef6('0x3e')]['find']({'where':{'id':_0x3c6975[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x5b4005,null))[_0x6ef6('0x39')](function(_0x633850){if(_0x633850){_0x3c6975['body'][_0x6ef6('0x67')]=_0x633850['id'];return db[_0x6ef6('0x68')][_0x6ef6('0x59')](_0x3c6975[_0x6ef6('0x63')]);}})[_0x6ef6('0x39')](respondWithResult(_0x5b4005,null))['catch'](handleError(_0x5b4005,null));};exports['getDispositions']=function(_0x25ab5f,_0x49a26b,_0x34f9ea){var _0x2c69b8={'raw':![],'where':{}};var _0x2fb30f={};var _0x3f217a={'count':0x0,'rows':[]};return db[_0x6ef6('0x3e')][_0x6ef6('0x69')]({'where':{'id':_0x25ab5f[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x49a26b,null))['then'](function(_0x589f12){if(_0x589f12){_0x2fb30f['model']=_[_0x6ef6('0x44')](db[_0x6ef6('0x68')][_0x6ef6('0x3f')]);_0x2fb30f['query']=_[_0x6ef6('0x44')](_0x25ab5f['query']);_0x2fb30f['filters']=_[_0x6ef6('0x46')](_0x2fb30f[_0x6ef6('0x42')],_0x2fb30f['query']);_0x2c69b8['attributes']=_[_0x6ef6('0x46')](_0x2fb30f['model'],qs['fields'](_0x25ab5f[_0x6ef6('0x43')][_0x6ef6('0x48')]));_0x2c69b8[_0x6ef6('0x47')]=_0x2c69b8[_0x6ef6('0x47')][_0x6ef6('0x49')]?_0x2c69b8[_0x6ef6('0x47')]:_0x2fb30f['model'];if(!_0x25ab5f[_0x6ef6('0x43')][_0x6ef6('0x4a')](_0x6ef6('0x4b'))){_0x2c69b8['limit']=qs[_0x6ef6('0x31')](_0x25ab5f[_0x6ef6('0x43')][_0x6ef6('0x31')]);_0x2c69b8[_0x6ef6('0x2f')]=qs['offset'](_0x25ab5f[_0x6ef6('0x43')]['offset']);}_0x2c69b8[_0x6ef6('0x4c')]=qs[_0x6ef6('0x4d')](_0x25ab5f[_0x6ef6('0x43')][_0x6ef6('0x4d')]);_0x2c69b8[_0x6ef6('0x4e')]=qs[_0x6ef6('0x45')](_[_0x6ef6('0x4f')](_0x25ab5f[_0x6ef6('0x43')],_0x2fb30f[_0x6ef6('0x45')]));_0x2c69b8[_0x6ef6('0x4e')]['OpenchannelAccountId']=_0x589f12['id'];if(_0x25ab5f[_0x6ef6('0x43')][_0x6ef6('0x50')]){_0x2c69b8[_0x6ef6('0x4e')]=_[_0x6ef6('0x51')](_0x2c69b8[_0x6ef6('0x4e')],{'$or':_[_0x6ef6('0x6a')](_0x2c69b8[_0x6ef6('0x47')],function(_0x4028f1){var _0x5774ff={};_0x5774ff[_0x4028f1]={'$like':'%'+_0x25ab5f[_0x6ef6('0x43')]['filter']+'%'};return _0x5774ff;})});}_0x2c69b8=_[_0x6ef6('0x51')]({},_0x2c69b8,_0x25ab5f['options']);return db[_0x6ef6('0x68')][_0x6ef6('0x32')]({'where':_0x2c69b8[_0x6ef6('0x4e')]})['then'](function(_0x5677f2){_0x3f217a[_0x6ef6('0x32')]=_0x5677f2;if(_0x25ab5f[_0x6ef6('0x43')]['includeAll']){_0x2c69b8[_0x6ef6('0x54')]=[{'all':!![]}];}return db[_0x6ef6('0x68')][_0x6ef6('0x55')](_0x2c69b8);})[_0x6ef6('0x39')](function(_0x384231){_0x3f217a[_0x6ef6('0x56')]=_0x384231;return _0x3f217a;});}})[_0x6ef6('0x39')](respondWithFilteredResult(_0x49a26b,_0x2c69b8))[_0x6ef6('0x2a')](handleError(_0x49a26b,null));};exports[_0x6ef6('0x6b')]=function(_0x1d40ac,_0x37bffb,_0x1c0320){return db['OpenchannelAccount'][_0x6ef6('0x5f')]({'where':{'id':_0x1d40ac[_0x6ef6('0x58')]['id']}})['then'](handleEntityNotFound(_0x37bffb,null))['then'](function(_0x79816c){if(_0x79816c){return _0x79816c[_0x6ef6('0x6b')](_0x1d40ac[_0x6ef6('0x43')][_0x6ef6('0x6c')]);}})[_0x6ef6('0x39')](respondWithStatusCode(_0x37bffb,null))[_0x6ef6('0x2a')](handleError(_0x37bffb,null));};exports[_0x6ef6('0x6d')]=function(_0x562597,_0x26bb7c,_0x4ec67a){if(_0x562597[_0x6ef6('0x63')]['id']){delete _0x562597[_0x6ef6('0x63')]['id'];}return db[_0x6ef6('0x3e')][_0x6ef6('0x5f')]({'where':{'id':_0x562597[_0x6ef6('0x58')]['id']}})['then'](handleEntityNotFound(_0x26bb7c,null))[_0x6ef6('0x39')](function(_0x40d669){if(_0x40d669){_0x562597[_0x6ef6('0x63')]['OpenchannelAccountId']=_0x40d669['id'];return db[_0x6ef6('0x6e')]['create'](_0x562597[_0x6ef6('0x63')]);}})['then'](respondWithResult(_0x26bb7c,null))['catch'](handleError(_0x26bb7c,null));};exports['getAnswers']=function(_0x3287bc,_0x1fbfb5,_0x1209b4){var _0x116b08={'raw':![],'where':{}};var _0x31d0d4={};var _0x4c479a={'count':0x0,'rows':[]};return db[_0x6ef6('0x3e')][_0x6ef6('0x69')]({'where':{'id':_0x3287bc['params']['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x1fbfb5,null))[_0x6ef6('0x39')](function(_0x15ebf0){if(_0x15ebf0){_0x31d0d4['model']=_[_0x6ef6('0x44')](db['CannedAnswer'][_0x6ef6('0x3f')]);_0x31d0d4[_0x6ef6('0x43')]=_[_0x6ef6('0x44')](_0x3287bc[_0x6ef6('0x43')]);_0x31d0d4[_0x6ef6('0x45')]=_['intersection'](_0x31d0d4['model'],_0x31d0d4[_0x6ef6('0x43')]);_0x116b08[_0x6ef6('0x47')]=_['intersection'](_0x31d0d4[_0x6ef6('0x42')],qs[_0x6ef6('0x48')](_0x3287bc[_0x6ef6('0x43')][_0x6ef6('0x48')]));_0x116b08[_0x6ef6('0x47')]=_0x116b08['attributes'][_0x6ef6('0x49')]?_0x116b08['attributes']:_0x31d0d4['model'];if(!_0x3287bc[_0x6ef6('0x43')][_0x6ef6('0x4a')](_0x6ef6('0x4b'))){_0x116b08[_0x6ef6('0x31')]=qs[_0x6ef6('0x31')](_0x3287bc[_0x6ef6('0x43')]['limit']);_0x116b08[_0x6ef6('0x2f')]=qs[_0x6ef6('0x2f')](_0x3287bc['query'][_0x6ef6('0x2f')]);}_0x116b08['order']=qs[_0x6ef6('0x4d')](_0x3287bc[_0x6ef6('0x43')][_0x6ef6('0x4d')]);_0x116b08['where']=qs[_0x6ef6('0x45')](_[_0x6ef6('0x4f')](_0x3287bc[_0x6ef6('0x43')],_0x31d0d4[_0x6ef6('0x45')]));_0x116b08['where'][_0x6ef6('0x67')]=_0x15ebf0['id'];if(_0x3287bc[_0x6ef6('0x43')][_0x6ef6('0x50')]){_0x116b08[_0x6ef6('0x4e')]=_[_0x6ef6('0x51')](_0x116b08['where'],{'$or':_[_0x6ef6('0x6a')](_0x116b08[_0x6ef6('0x47')],function(_0x1b6cb6){var _0x2d3e60={};_0x2d3e60[_0x1b6cb6]={'$like':'%'+_0x3287bc[_0x6ef6('0x43')][_0x6ef6('0x50')]+'%'};return _0x2d3e60;})});}_0x116b08=_[_0x6ef6('0x51')]({},_0x116b08,_0x3287bc[_0x6ef6('0x52')]);return db['CannedAnswer'][_0x6ef6('0x32')]({'where':_0x116b08[_0x6ef6('0x4e')]})[_0x6ef6('0x39')](function(_0x5ec655){_0x4c479a['count']=_0x5ec655;if(_0x3287bc[_0x6ef6('0x43')][_0x6ef6('0x53')]){_0x116b08[_0x6ef6('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x6ef6('0x55')](_0x116b08);})[_0x6ef6('0x39')](function(_0x561a62){_0x4c479a['rows']=_0x561a62;return _0x4c479a;});}})['then'](respondWithFilteredResult(_0x1fbfb5,_0x116b08))['catch'](handleError(_0x1fbfb5,null));};exports[_0x6ef6('0x6f')]=function(_0x5cfa09,_0x2c70fe,_0x188949){return db[_0x6ef6('0x3e')][_0x6ef6('0x5f')]({'where':{'id':_0x5cfa09[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x2c70fe,null))[_0x6ef6('0x39')](function(_0x51b0d2){if(_0x51b0d2){return _0x51b0d2[_0x6ef6('0x6f')](_0x5cfa09[_0x6ef6('0x43')][_0x6ef6('0x6c')]);}})[_0x6ef6('0x39')](respondWithStatusCode(_0x2c70fe,null))[_0x6ef6('0x2a')](handleError(_0x2c70fe,null));};exports['notify']=function(_0x3144e8,_0xa61bf9,_0x4bf0fd){var _0x2dafc1={'body':_0x3144e8[_0x6ef6('0x63')],'channel':'openchannel'};var _0x450517=[];var _0x35eefa=[];var _0x2f7640={};var _0x1419cd=![];return db[_0x6ef6('0x70')][_0x6ef6('0x65')]()[_0x6ef6('0x39')](function(_0x50d124){if(!_0x50d124){throw new db['Sequelize']['ValidationError']('no\x20available\x20attributes');}_0x450517=_[_0x6ef6('0x71')](_[_0x6ef6('0x44')](_0x50d124),[_0x6ef6('0x72'),_0x6ef6('0x73')]);_0x35eefa=_[_0x6ef6('0x71')](_[_0x6ef6('0x44')](_0x50d124),[_0x6ef6('0x72'),'updatedAt',_0x6ef6('0x74'),'ListId']);if(_0x3144e8[_0x6ef6('0x63')]['id']){delete _0x3144e8[_0x6ef6('0x63')]['id'];}if(_[_0x6ef6('0x75')](_0x3144e8['body'][_0x6ef6('0x76')])){throw new db[(_0x6ef6('0x77'))][(_0x6ef6('0x78'))](_0x6ef6('0x79'));}if(_['isNil'](_0x3144e8[_0x6ef6('0x63')]['body'])||_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x63')]===''){throw new db[(_0x6ef6('0x77'))]['ValidationError']('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x3144e8[_0x6ef6('0x63')]['mapKey'])){throw new db['Sequelize'][(_0x6ef6('0x78'))](_0x6ef6('0x7a')+_0x35eefa);}if(!_['includes'](_0x35eefa,_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x7b')])){throw new db[(_0x6ef6('0x77'))][(_0x6ef6('0x78'))](_0x6ef6('0x7c')+_0x35eefa);}_0x2f7640[_0x3144e8['body'][_0x6ef6('0x7b')]]=_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x76')];})[_0x6ef6('0x39')](function(){return db[_0x6ef6('0x3e')][_0x6ef6('0x5f')]({'where':{'id':_0x3144e8['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x6ef6('0x70')],'as':_0x6ef6('0x7d'),'where':_0x2f7640,'limit':0x1,'order':[[_0x6ef6('0x73'),_0x6ef6('0x7e')]]}]},{'model':db[_0x6ef6('0x7f')],'as':_0x6ef6('0x80')}]});})['then'](handleEntityNotFound(_0xa61bf9,null))[_0x6ef6('0x39')](function(_0x47a73e){if(_0x47a73e&&_0x47a73e[_0x6ef6('0x81')]){_0x2dafc1[_0x6ef6('0x82')]=_0x47a73e;_0x2dafc1['applications']=_0x47a73e[_0x6ef6('0x80')];_0x2dafc1[_0x6ef6('0x83')]=_0x47a73e[_0x6ef6('0x81')];_0x2dafc1['applications']=_[_0x6ef6('0x84')](_0x2dafc1[_0x6ef6('0x85')],[_0x6ef6('0x86')],[_0x6ef6('0x87')]);if(_0x2dafc1[_0x6ef6('0x82')][_0x6ef6('0x80')]){delete _0x2dafc1[_0x6ef6('0x82')][_0x6ef6('0x80')];}if(_0x2dafc1['account']['List']&&_0x2dafc1[_0x6ef6('0x82')]['List'][_0x6ef6('0x7d')][_0x6ef6('0x49')]){return _0x2dafc1[_0x6ef6('0x82')][_0x6ef6('0x81')][_0x6ef6('0x7d')][0x0];}var _0x4c6dfa=_[_0x6ef6('0x18')](_0x3144e8[_0x6ef6('0x63')],{'firstName':_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x76')],'ListId':_0x47a73e[_0x6ef6('0x88')]});_0x4c6dfa[_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x7b')]]=_0x3144e8['body'][_0x6ef6('0x76')];return db[_0x6ef6('0x70')][_0x6ef6('0x59')](_0x4c6dfa,{'fields':_0x450517,'raw':!![]});}})['then'](handleEntityNotFound(_0xa61bf9,null))[_0x6ef6('0x39')](function(_0x4fe0b9){_0x2dafc1[_0x6ef6('0x89')]=_0x4fe0b9;if(_0x4fe0b9){var _0x29c581={'ContactId':_0x4fe0b9['id'],'OpenchannelAccountId':_0x3144e8['params']['id'],'from':(_0x4fe0b9['firstName']||'')+'\x20'+(_0x4fe0b9[_0x6ef6('0x8a')]||'')};var _0x5477a5={'OpenchannelAccountId':_0x3144e8['params']['id'],'closed':![]};if(_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x8b')]){_0x5477a5[_0x6ef6('0x8b')]=_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x8b')];return db[_0x6ef6('0x8c')][_0x6ef6('0x5f')]({'where':_0x5477a5})[_0x6ef6('0x39')](function(_0x3a344e){if(_0x3a344e){return[_0x3a344e,![]];}_0x29c581[_0x6ef6('0x8b')]=_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x8b')];_0x29c581[_0x6ef6('0x8d')]=_0x3144e8[_0x6ef6('0x63')]['externalUrl'];return db[_0x6ef6('0x8c')]['create'](_0x29c581)[_0x6ef6('0x39')](function(_0x5db9ff){return[_0x5db9ff,!![]];});});}else{_0x5477a5[_0x6ef6('0x8b')]=null;}_0x5477a5['ContactId']=_0x4fe0b9['id'];return db[_0x6ef6('0x8c')]['find']({'where':_0x5477a5})[_0x6ef6('0x39')](function(_0x4bd21c){if(_0x4bd21c){return[_0x4bd21c,![]];}return db[_0x6ef6('0x8c')][_0x6ef6('0x59')](_0x29c581)[_0x6ef6('0x39')](function(_0x1c571a){return[_0x1c571a,!![]];});});}})[_0x6ef6('0x8e')](function(_0x46fabd,_0x167473){if(_0x46fabd){_0x1419cd=_0x167473;if(!_0x167473){var _0x3e59e2={'from':(_0x2dafc1[_0x6ef6('0x89')]['firstName']||'')+'\x20'+(_0x2dafc1[_0x6ef6('0x89')]['lastName']||'')};if(_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x8b')]&&_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x8f')]&&_0x3144e8[_0x6ef6('0x63')]['threadId']!=_0x3144e8['body'][_0x6ef6('0x8f')]){_0x3e59e2['threadId']=_0x3144e8[_0x6ef6('0x63')]['messageId'];}return _0x46fabd[_0x6ef6('0x36')](_0x3e59e2);}else{return _0x46fabd;}}})[_0x6ef6('0x39')](function(_0x3c392c){_0x2dafc1[_0x6ef6('0x90')]=_0x3c392c[_0x6ef6('0x5c')]({'plain':!![]});_0x2dafc1[_0x6ef6('0x90')][_0x6ef6('0x91')]=_0x1419cd;if(_0x2dafc1[_0x6ef6('0x90')]['created']){if(_0x2dafc1[_0x6ef6('0x82')][_0x6ef6('0x92')]){_0x2dafc1['applications'][_0x6ef6('0x93')]({'id':0x0,'priority':_0x2dafc1[_0x6ef6('0x85')][_0x6ef6('0x49')]+0x1,'app':'close','appdata':_0x6ef6('0x94'),'interval':'*,*,*,*'});}}return db[_0x6ef6('0x95')][_0x6ef6('0x59')]({'body':_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x63')],'OpenchannelAccountId':_0x3144e8[_0x6ef6('0x58')]['id'],'OpenchannelInteractionId':_0x3c392c['id'],'direction':'in','ContactId':_0x2dafc1[_0x6ef6('0x89')]['id'],'AttachmentId':_0x3144e8[_0x6ef6('0x63')][_0x6ef6('0x96')]});})[_0x6ef6('0x39')](function(_0x162297){_0x2dafc1['message']=_0x162297;if(!_0x2dafc1[_0x6ef6('0x90')][_0x6ef6('0x97')])return;return db[_0x6ef6('0x98')][_0x6ef6('0x5f')]({'attributes':['id',_0x6ef6('0x3a')],'where':{'id':_0x2dafc1[_0x6ef6('0x90')][_0x6ef6('0x97')]}});})[_0x6ef6('0x39')](function(_0x216614){if(_0x216614){_0x2dafc1[_0x6ef6('0x85')][_0x6ef6('0x99')]({'id':0x0,'priority':0x0,'app':_0x6ef6('0x9a'),'appdata':_0x216614[_0x6ef6('0x3a')]+','+(_0x2dafc1['account'][_0x6ef6('0x9b')]||0xa),'interval':'*,*,*,*'});}if(!_0x2dafc1[_0x6ef6('0x90')][_0x6ef6('0x9c')])return;return db[_0x6ef6('0x9d')][_0x6ef6('0x5f')]({'attributes':['id',_0x6ef6('0x3a')],'where':{'id':_0x2dafc1['interaction'][_0x6ef6('0x9c')]}});})[_0x6ef6('0x39')](function(_0x3714ea){if(_0x3714ea){_0x2dafc1[_0x6ef6('0x85')][_0x6ef6('0x99')]({'id':0x0,'priority':0x1,'app':_0x6ef6('0x9e'),'appdata':_0x3714ea['name']+','+(_0x2dafc1[_0x6ef6('0x82')][_0x6ef6('0x9f')]||0x12c),'interval':_0x6ef6('0xa0')});}return respondWithRpcPromise(_0x6ef6('0xa1'),_0x6ef6('0xa2'),_0x2dafc1);})['then'](function(_0x36e4ce){respondWithRpcPromise(_0x6ef6('0xa3'),_0x6ef6('0xa3'),{'event':_0x6ef6('0xa4'),'message':_0x36e4ce},client9002);return _0x36e4ce;})[_0x6ef6('0x39')](respondWithResult(_0xa61bf9,null))[_0x6ef6('0x2a')](handleError(_0xa61bf9,null));};exports[_0x6ef6('0xa5')]=function(_0x2dd3d0,_0x34b762){var _0x2066ed=_0x2dd3d0[_0x6ef6('0x58')]['id'];var _0x326fd1=_0x2dd3d0['body'];var _0x53b9cc=0xc8;var _0x1326ba=null;return db['sequelize'][_0x6ef6('0xa6')]({'isolationLevel':db[_0x6ef6('0xa7')][_0x6ef6('0xa8')][_0x6ef6('0xa9')]['READ_COMMITTED']},function(_0x8db77e){return db[_0x6ef6('0x3e')]['findOne']({'where':{'id':_0x2066ed},'transaction':_0x8db77e})[_0x6ef6('0x39')](function(_0x18247b){if(_0x18247b){return db[_0x6ef6('0x7f')]['destroy']({'where':{'OpenchannelAccountId':_0x2066ed},'transaction':_0x8db77e})[_0x6ef6('0x39')](function(){var _0x1a935e=_[_0x6ef6('0x6a')](_0x326fd1,function(_0x1d3f9e){_0x1d3f9e[_0x6ef6('0x67')]=_0x2066ed;return _0x1d3f9e;});return db['OpenchannelApplication'][_0x6ef6('0xaa')](_0x1a935e,{'transaction':_0x8db77e});});}else{_0x53b9cc=0x194;_0x1326ba=[];}});})['then'](function(){if(_0x53b9cc!==0x194){return db[_0x6ef6('0x7f')][_0x6ef6('0xab')]({'where':{'OpenchannelAccountId':_0x2066ed},'order':_0x6ef6('0x86')})[_0x6ef6('0x39')](function(_0x2390d1){_0x1326ba=_0x2390d1;});}})['catch'](function(_0x427f0f){_0x53b9cc=0x1f4;logger[_0x6ef6('0x26')](_0x427f0f[_0x6ef6('0xac')]);if(_0x427f0f[_0x6ef6('0x3a')]){delete _0x427f0f['name'];}_0x1326ba=_0x427f0f;})[_0x6ef6('0xad')](function(){if(_0x1326ba===null){_0x34b762['sendStatus'](_0x53b9cc);}else{if(_0x53b9cc===0x1f4){_0x34b762[_0x6ef6('0x2c')](_0x53b9cc)['send'](_0x1326ba);}else{_0x34b762[_0x6ef6('0x2c')](_0x53b9cc)['json'](_0x1326ba);}}});};exports['getApplications']=function(_0x1f8c84,_0x25a137,_0x51dc28){var _0x56b52d={};var _0xee13cd={};var _0x4c6c6a;var _0x27eb7d;return db['OpenchannelAccount'][_0x6ef6('0x69')]({'where':{'id':_0x1f8c84[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x25a137,null))[_0x6ef6('0x39')](function(_0x5c952e){if(_0x5c952e){_0x4c6c6a=_0x5c952e;_0xee13cd['model']=_['keys'](db['OpenchannelApplication'][_0x6ef6('0x3f')]);_0xee13cd[_0x6ef6('0x43')]=_[_0x6ef6('0x44')](_0x1f8c84[_0x6ef6('0x43')]);_0xee13cd[_0x6ef6('0x45')]=_[_0x6ef6('0x46')](_0xee13cd[_0x6ef6('0x42')],_0xee13cd[_0x6ef6('0x43')]);_0x56b52d[_0x6ef6('0x47')]=_['intersection'](_0xee13cd['model'],qs['fields'](_0x1f8c84[_0x6ef6('0x43')][_0x6ef6('0x48')]));_0x56b52d[_0x6ef6('0x47')]=_0x56b52d['attributes'][_0x6ef6('0x49')]?_0x56b52d['attributes']:_0xee13cd[_0x6ef6('0x42')];_0x56b52d[_0x6ef6('0x4c')]=qs[_0x6ef6('0x4d')](_0x1f8c84['query'][_0x6ef6('0x4d')]);_0x56b52d[_0x6ef6('0x4e')]=qs[_0x6ef6('0x45')](_[_0x6ef6('0x4f')](_0x1f8c84[_0x6ef6('0x43')],_0xee13cd['filters']));if(_0x1f8c84['query'][_0x6ef6('0x50')]){_0x56b52d[_0x6ef6('0x4e')]=_[_0x6ef6('0x51')](_0x56b52d[_0x6ef6('0x4e')],{'$or':_['map'](_0x56b52d[_0x6ef6('0x47')],function(_0x36dfe3){var _0x479784={};_0x479784[_0x36dfe3]={'$like':'%'+_0x1f8c84['query'][_0x6ef6('0x50')]+'%'};return _0x479784;})});}_0x56b52d=_['merge']({},_0x56b52d,_0x1f8c84[_0x6ef6('0x52')]);return _0x4c6c6a[_0x6ef6('0xae')](_0x56b52d);}})[_0x6ef6('0x39')](function(_0x1b151a){if(_0x1b151a){_0x27eb7d=_0x1b151a['length'];if(!_0x1f8c84[_0x6ef6('0x43')][_0x6ef6('0x4a')](_0x6ef6('0x4b'))){_0x56b52d[_0x6ef6('0x31')]=qs[_0x6ef6('0x31')](_0x1f8c84[_0x6ef6('0x43')][_0x6ef6('0x31')]);_0x56b52d[_0x6ef6('0x2f')]=qs[_0x6ef6('0x2f')](_0x1f8c84[_0x6ef6('0x43')]['offset']);}return _0x4c6c6a['getApplications'](_0x56b52d);}})[_0x6ef6('0x39')](function(_0x4c5a8a){if(_0x4c5a8a){return _0x4c5a8a?{'count':_0x27eb7d,'rows':_0x4c5a8a}:null;}})['then'](respondWithResult(_0x25a137,null))[_0x6ef6('0x2a')](handleError(_0x25a137,null));};exports[_0x6ef6('0xaf')]=function(_0x5dee07,_0x4701a7,_0x248c75){var _0x176a63={'raw':![],'where':{}};var _0xa0357a={};var _0x229de1={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x6ef6('0x69')]({'where':{'id':_0x5dee07[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x4701a7,null))[_0x6ef6('0x39')](function(_0x3ebd90){if(_0x3ebd90){_0xa0357a['model']=_[_0x6ef6('0x44')](db[_0x6ef6('0x8c')][_0x6ef6('0x3f')]);_0xa0357a[_0x6ef6('0x43')]=_[_0x6ef6('0x44')](_0x5dee07[_0x6ef6('0x43')]);_0xa0357a['filters']=_[_0x6ef6('0x46')](_0xa0357a['model'],_0xa0357a[_0x6ef6('0x43')]);_0x176a63[_0x6ef6('0x47')]=_['intersection'](_0xa0357a['model'],qs[_0x6ef6('0x48')](_0x5dee07[_0x6ef6('0x43')][_0x6ef6('0x48')]));_0x176a63['attributes']=_0x176a63[_0x6ef6('0x47')][_0x6ef6('0x49')]?_0x176a63[_0x6ef6('0x47')]:_0xa0357a[_0x6ef6('0x42')];if(!_0x5dee07[_0x6ef6('0x43')]['hasOwnProperty']('nolimit')){_0x176a63[_0x6ef6('0x31')]=qs['limit'](_0x5dee07[_0x6ef6('0x43')][_0x6ef6('0x31')]);_0x176a63[_0x6ef6('0x2f')]=qs['offset'](_0x5dee07['query'][_0x6ef6('0x2f')]);}_0x176a63['order']=qs[_0x6ef6('0x4d')](_0x5dee07[_0x6ef6('0x43')][_0x6ef6('0x4d')]);_0x176a63[_0x6ef6('0x4e')]=qs['filters'](_[_0x6ef6('0x4f')](_0x5dee07[_0x6ef6('0x43')],_0xa0357a['filters']));_0x176a63['where'][_0x6ef6('0x67')]=_0x3ebd90['id'];if(_0x5dee07[_0x6ef6('0x43')]['filter']){_0x176a63[_0x6ef6('0x4e')]=_[_0x6ef6('0x51')](_0x176a63[_0x6ef6('0x4e')],{'$or':_[_0x6ef6('0x6a')](_0x176a63[_0x6ef6('0x47')],function(_0x365cab){var _0x15cb1e={};_0x15cb1e[_0x365cab]={'$like':'%'+_0x5dee07[_0x6ef6('0x43')]['filter']+'%'};return _0x15cb1e;})});}_0x176a63=_['merge']({},_0x176a63,_0x5dee07['options']);return db[_0x6ef6('0x8c')][_0x6ef6('0x32')]({'where':_0x176a63[_0x6ef6('0x4e')]})[_0x6ef6('0x39')](function(_0x108634){_0x229de1[_0x6ef6('0x32')]=_0x108634;if(_0x5dee07['query'][_0x6ef6('0x53')]){_0x176a63[_0x6ef6('0x54')]=[{'model':db[_0x6ef6('0x70')],'as':_0x6ef6('0xb0'),'required':![]},{'model':db[_0x6ef6('0x98')],'as':_0x6ef6('0xb1'),'attributes':[_0x6ef6('0x3a'),_0x6ef6('0xb2'),_0x6ef6('0xb3')],'required':![]},{'model':db[_0x6ef6('0xb4')],'as':_0x6ef6('0xb5'),'attributes':['id',_0x6ef6('0x3a'),_0x6ef6('0xb6')],'where':_0x5dee07['query'][_0x6ef6('0xb7')]?{'id':_0x5dee07['query'][_0x6ef6('0xb7')]}:undefined,'required':_0x5dee07['query'][_0x6ef6('0xb7')]?!![]:![]}];}return db['OpenchannelInteraction'][_0x6ef6('0x55')](_0x176a63);})[_0x6ef6('0x39')](function(_0x331c56){_0x229de1[_0x6ef6('0x56')]=_0x331c56;return _0x229de1;});}})[_0x6ef6('0x39')](respondWithFilteredResult(_0x4701a7,_0x176a63))[_0x6ef6('0x2a')](handleError(_0x4701a7,null));};exports['addAgents']=function(_0x1d8f7d,_0x4710cb,_0x5598e5){return db[_0x6ef6('0x3e')][_0x6ef6('0x5f')]({'where':{'id':_0x1d8f7d[_0x6ef6('0x58')]['id']}})['then'](handleEntityNotFound(_0x4710cb,null))[_0x6ef6('0x39')](function(_0x1e0f66){if(_0x1e0f66){return _0x1e0f66['addAgents'](_0x1d8f7d[_0x6ef6('0x63')][_0x6ef6('0x6c')],_[_0x6ef6('0xb8')](_0x1d8f7d[_0x6ef6('0x63')],[_0x6ef6('0x6c'),'id'])||{})[_0x6ef6('0x8e')](function(_0x1fd548){for(var _0x42ec5e=0x0;_0x42ec5e<_0x1d8f7d['body'][_0x6ef6('0x6c')][_0x6ef6('0x49')];_0x42ec5e+=0x1){socket[_0x6ef6('0xb9')]('userOpenchannelAccount:save',{'UserId':Number(_0x1d8f7d['body'][_0x6ef6('0x6c')][_0x42ec5e]),'OpenchannelAccountId':Number(_0x1d8f7d[_0x6ef6('0x58')]['id'])});}return _0x1fd548;});}})['then'](respondWithResult(_0x4710cb,null))[_0x6ef6('0x2a')](handleError(_0x4710cb,null));};exports[_0x6ef6('0xba')]=function(_0x5a24ef,_0x9e5aee,_0x5d9d65){return db[_0x6ef6('0x3e')]['find']({'where':{'id':_0x5a24ef[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x9e5aee,null))[_0x6ef6('0x39')](function(_0xa990f5){if(_0xa990f5){return _0xa990f5[_0x6ef6('0xba')](_0x5a24ef['query'][_0x6ef6('0x6c')])[_0x6ef6('0x39')](function(){if(_[_0x6ef6('0xbb')](_0x5a24ef['query'][_0x6ef6('0x6c')])){for(var _0x87c8c5=0x0;_0x87c8c5<_0x5a24ef[_0x6ef6('0x43')]['ids']['length'];_0x87c8c5+=0x1){socket['emit']('userOpenchannelAccount:remove',{'UserId':Number(_0x5a24ef['query'][_0x6ef6('0x6c')][_0x87c8c5]),'OpenchannelAccountId':Number(_0x5a24ef[_0x6ef6('0x58')]['id'])});}}else{socket[_0x6ef6('0xb9')](_0x6ef6('0xbc'),{'UserId':Number(_0x5a24ef['query']['ids']),'OpenchannelAccountId':Number(_0x5a24ef[_0x6ef6('0x58')]['id'])});}});}})[_0x6ef6('0x39')](respondWithStatusCode(_0x9e5aee,null))['catch'](handleError(_0x9e5aee,null));};exports['getAgents']=function(_0x535ef4,_0x5b48d5,_0x867242){var _0x331a15={};var _0x7e5bd3={};var _0x41997e;var _0xfe39c4;return db['OpenchannelAccount']['findOne']({'where':{'id':_0x535ef4[_0x6ef6('0x58')]['id']}})['then'](handleEntityNotFound(_0x5b48d5,null))['then'](function(_0x2a1f78){if(_0x2a1f78){_0x41997e=_0x2a1f78;_0x7e5bd3[_0x6ef6('0x42')]=_['keys'](db[_0x6ef6('0x98')]['rawAttributes']);_0x7e5bd3[_0x6ef6('0x43')]=_['keys'](_0x535ef4[_0x6ef6('0x43')]);_0x7e5bd3[_0x6ef6('0x45')]=_[_0x6ef6('0x46')](_0x7e5bd3[_0x6ef6('0x42')],_0x7e5bd3['query']);_0x331a15[_0x6ef6('0x47')]=_['intersection'](_0x7e5bd3[_0x6ef6('0x42')],qs['fields'](_0x535ef4[_0x6ef6('0x43')]['fields']));_0x331a15[_0x6ef6('0x47')]=_0x331a15[_0x6ef6('0x47')][_0x6ef6('0x49')]?_0x331a15[_0x6ef6('0x47')]:_0x7e5bd3[_0x6ef6('0x42')];_0x331a15[_0x6ef6('0x4c')]=qs[_0x6ef6('0x4d')](_0x535ef4['query'][_0x6ef6('0x4d')]);_0x331a15[_0x6ef6('0x4e')]=qs[_0x6ef6('0x45')](_[_0x6ef6('0x4f')](_0x535ef4[_0x6ef6('0x43')],_0x7e5bd3[_0x6ef6('0x45')]));if(_0x535ef4[_0x6ef6('0x43')][_0x6ef6('0x50')]){_0x331a15[_0x6ef6('0x4e')]=_[_0x6ef6('0x51')](_0x331a15[_0x6ef6('0x4e')],{'$or':_[_0x6ef6('0x6a')](_0x331a15['attributes'],function(_0x193508){var _0x47e358={};_0x47e358[_0x193508]={'$like':'%'+_0x535ef4[_0x6ef6('0x43')][_0x6ef6('0x50')]+'%'};return _0x47e358;})});}_0x331a15=_['merge']({},_0x331a15,_0x535ef4[_0x6ef6('0x52')]);return _0x41997e['getAgents'](_0x331a15);}})[_0x6ef6('0x39')](function(_0x367ae6){if(_0x367ae6){_0xfe39c4=_0x367ae6['length'];if(!_0x535ef4[_0x6ef6('0x43')]['hasOwnProperty'](_0x6ef6('0x4b'))){_0x331a15['limit']=qs[_0x6ef6('0x31')](_0x535ef4['query']['limit']);_0x331a15[_0x6ef6('0x2f')]=qs['offset'](_0x535ef4[_0x6ef6('0x43')][_0x6ef6('0x2f')]);}return _0x41997e[_0x6ef6('0xbd')](_0x331a15);}})['then'](function(_0x21530a){if(_0x21530a){return _0x21530a?{'count':_0xfe39c4,'rows':_0x21530a}:null;}})['then'](respondWithResult(_0x5b48d5,null))['catch'](handleError(_0x5b48d5,null));};exports['send']=function(_0x5ed26e,_0x25abb2,_0x2eadab){var _0x357172,_0x5ccd85,_0x43e1d4;if(_[_0x6ef6('0x75')](_0x5ed26e['body'][_0x6ef6('0x63')])||_0x5ed26e[_0x6ef6('0x63')]['body']===''){throw new db[(_0x6ef6('0x77'))][(_0x6ef6('0x78'))](_0x6ef6('0xbe'));}if(_['isNil'](_0x5ed26e[_0x6ef6('0x63')]['to'])){}_0x357172=_0x5ed26e[_0x6ef6('0x63')]['to'];return db[_0x6ef6('0x3e')][_0x6ef6('0x69')]({'where':{'id':_0x5ed26e[_0x6ef6('0x58')]['id']}})[_0x6ef6('0x39')](handleEntityNotFound(_0x25abb2,null))[_0x6ef6('0x39')](function(_0x2ae1d4){if(_0x2ae1d4){return db[_0x6ef6('0x3e')]['find']({'where':{'id':_0x2ae1d4['id']},'include':[{'model':db['CmList'],'as':_0x6ef6('0x81'),'include':[{'model':db[_0x6ef6('0x70')],'as':_0x6ef6('0x7d'),'where':{[_0x2ae1d4[_0x6ef6('0x7b')]]:_0x357172},'limit':0x1,'order':[[_0x6ef6('0x73'),_0x6ef6('0x7e')]]}]}]})[_0x6ef6('0x39')](handleEntityNotFound(_0x25abb2,null))[_0x6ef6('0x39')](function(_0x5b9a47){if(_0x5b9a47&&_0x5b9a47['List']){_0x5ccd85=_0x5b9a47[_0x6ef6('0x5c')]({'plain':!![]});if(_0x5ccd85[_0x6ef6('0x81')]&&_0x5ccd85[_0x6ef6('0x81')][_0x6ef6('0x7d')]['length']){return _0x5ccd85[_0x6ef6('0x81')][_0x6ef6('0x7d')][0x0];}return db[_0x6ef6('0x70')][_0x6ef6('0x59')](_['defaults'](_0x5ed26e['body'],{'firstName':_0x357172,[_0x5b9a47[_0x6ef6('0x7b')]]:_0x357172,'phone':_0x357172,'ListId':_0x5ccd85[_0x6ef6('0x88')]}));}})[_0x6ef6('0x39')](handleEntityNotFound(_0x25abb2,null))[_0x6ef6('0x39')](function(_0x354caa){if(_0x354caa){_0x43e1d4=_0x354caa;return db[_0x6ef6('0x8c')][_0x6ef6('0x5f')]({'where':{'ContactId':_0x43e1d4['id'],'closed':![],'OpenchannelAccountId':_0x5ccd85['id']}})['then'](function(_0x239f99){if(_0x239f99){return[_0x239f99,![]];}return db[_0x6ef6('0x8c')][_0x6ef6('0x59')]({'UserId':_0x5ed26e[_0x6ef6('0x5a')]['id'],'ContactId':_0x43e1d4['id'],'OpenchannelAccountId':_0x5ccd85['id'],'lastMsgDirection':_0x6ef6('0xbf'),'firstMsgDirection':_0x6ef6('0xbf'),'Messages':[_[_0x6ef6('0x51')](_0x5ed26e['body'],{'read':![],'body':_0x5ed26e[_0x6ef6('0x63')][_0x6ef6('0x63')],'OpenchannelAccountId':_0x5ccd85['id'],'UserId':_0x5ed26e['user']['id'],'ContactId':_0x43e1d4['id']})]},{'include':[{'model':db[_0x6ef6('0x95')],'as':_0x6ef6('0xc0')}]})[_0x6ef6('0x39')](function(_0x1e8216){return[_0x1e8216,!![]];});});}})['spread'](function(_0x42313a,_0x1e553f){if(_0x1e553f){return _0x42313a;}return db[_0x6ef6('0x95')]['create'](_['merge'](_0x5ed26e['body'],{'read':![],'body':_0x5ed26e[_0x6ef6('0x63')][_0x6ef6('0x63')],'OpenchannelAccountId':_0x5ccd85['id'],'OpenchannelInteractionId':_0x42313a['id'],'UserId':_0x5ed26e[_0x6ef6('0x5a')]['id'],'ContactId':_0x43e1d4['id']}))[_0x6ef6('0x39')](function(_0x358934){_0x42313a[_0x6ef6('0xc1')]['Messages']=[];_0x42313a[_0x6ef6('0xc1')][_0x6ef6('0xc0')][_0x6ef6('0x93')](_0x358934[_0x6ef6('0xc1')]);return _0x42313a;});});}})[_0x6ef6('0x39')](respondWithResult(_0x25abb2,null))[_0x6ef6('0x2a')](handleError(_0x25abb2,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index ec08007..add5b0e 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 _0xda3f=['exports','../../mysqldb','OpenchannelAccount','remove','emit'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0xda3f,0xec));var _0xfda3=function(_0x99d173,_0x344b46){_0x99d173=_0x99d173-0x0;var _0x42deed=_0xda3f[_0x99d173];return _0x42deed;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0xfda3('0x0'))['db'][_0xfda3('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfda3('0x2')};function emitEvent(_0x581693){return function(_0x36dc71,_0x22187d,_0x516500){OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693+':'+_0x36dc71['id'],_0x36dc71);OpenchannelAccountEvents[_0xfda3('0x3')](_0x581693,_0x36dc71);_0x516500(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0xfda3('0x4')]=OpenchannelAccountEvents; \ No newline at end of file +var _0xb821=['OpenchannelAccount','update','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x1f8c44,_0x1adff8){var _0x406e5a=function(_0x29097b){while(--_0x29097b){_0x1f8c44['push'](_0x1f8c44['shift']());}};_0x406e5a(++_0x1adff8);}(_0xb821,0xa7));var _0x1b82=function(_0x4f44db,_0x4e52a1){_0x4f44db=_0x4f44db-0x0;var _0x20d85d=_0xb821[_0x4f44db];return _0x20d85d;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x1b82('0x0'))['db'][_0x1b82('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x1b82('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4b1809){return function(_0x3b1d14,_0x1403ab,_0x3fadf0){OpenchannelAccountEvents[_0x1b82('0x3')](_0x4b1809+':'+_0x3b1d14['id'],_0x3b1d14);OpenchannelAccountEvents['emit'](_0x4b1809,_0x3b1d14);_0x3fadf0(null);};}for(var e in events){if(events[_0x1b82('0x4')](e)){var event=events[e];OpenchannelAccount[_0x1b82('0x5')](e,emitEvent(event));}}module[_0x1b82('0x6')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 388e2be..394ab13 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(_0x48654f,_0x2d86cc){var _0x39ea42=function(_0x565e54){while(--_0x565e54){_0x48654f['push'](_0x48654f['shift']());}};_0x39ea42(++_0x2d86cc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'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(_0x387585,_0x5e7203){var _0x776c31=function(_0x106441){while(--_0x106441){_0x387585['push'](_0x387585['shift']());}};_0x776c31(++_0x5e7203);}(_0xa9e0,0x123));var _0x0a9e=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa9e0[_0x56482c];return _0x5aae7a;};'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 f9ab528..8c2d557 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 _0x3f8c=['debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','register','request','then','OpenchannelAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1d128e,_0x2c87de){var _0x3d5236=function(_0x2374ff){while(--_0x2374ff){_0x1d128e['push'](_0x1d128e['shift']());}};_0x3d5236(++_0x2c87de);}(_0x3f8c,0x104));var _0xc3f8=function(_0x46548b,_0x4d753e){_0x46548b=_0x46548b-0x0;var _0x159fdf=_0x3f8c[_0x46548b];return _0x159fdf;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc3f8('0x0'));var BPromise=require(_0xc3f8('0x1'));var rs=require(_0xc3f8('0x2'));var fs=require('fs');var Redis=require(_0xc3f8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xc3f8('0x4'));var client=jayson[_0xc3f8('0x5')][_0xc3f8('0x6')]({'port':0x232a});config[_0xc3f8('0x7')]=_[_0xc3f8('0x8')](config[_0xc3f8('0x7')],{'host':'localhost','port':0x18eb});var socket=require(_0xc3f8('0x9'))(new Redis(config[_0xc3f8('0x7')]));require(_0xc3f8('0xa'))[_0xc3f8('0xb')](socket);function respondWithRpcPromise(_0x148e6f,_0x67f688,_0x445299){return new BPromise(function(_0x55ea74,_0x22736b){return client[_0xc3f8('0xc')](_0x148e6f,_0x445299)[_0xc3f8('0xd')](function(_0x4303aa){logger['info'](_0xc3f8('0xe'),_0x67f688,_0xc3f8('0xf'));logger[_0xc3f8('0x10')](_0xc3f8('0x11'),_0x67f688,'request\x20sent',JSON[_0xc3f8('0x12')](_0x4303aa));if(_0x4303aa[_0xc3f8('0x13')]){if(_0x4303aa[_0xc3f8('0x13')][_0xc3f8('0x14')]===0x1f4){logger[_0xc3f8('0x13')](_0xc3f8('0xe'),_0x67f688,_0x4303aa[_0xc3f8('0x13')][_0xc3f8('0x15')]);return _0x22736b(_0x4303aa[_0xc3f8('0x13')][_0xc3f8('0x15')]);}logger[_0xc3f8('0x13')](_0xc3f8('0xe'),_0x67f688,_0x4303aa[_0xc3f8('0x13')]['message']);return _0x55ea74(_0x4303aa[_0xc3f8('0x13')]['message']);}else{logger['info'](_0xc3f8('0xe'),_0x67f688,_0xc3f8('0xf'));_0x55ea74(_0x4303aa[_0xc3f8('0x16')][_0xc3f8('0x15')]);}})['catch'](function(_0x3e75a4){logger[_0xc3f8('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x67f688,_0x3e75a4);_0x22736b(_0x3e75a4);});});} \ No newline at end of file +var _0xe511=['jayson/promise','http','redis','localhost','socket.io-emitter','register','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe511,0x16f));var _0x1e51=function(_0x137f1a,_0x2887df){_0x137f1a=_0x137f1a-0x0;var _0x439923=_0xe511[_0x137f1a];return _0x439923;};'use strict';var _=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var moment=require('moment');var BPromise=require(_0x1e51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1e51('0x3'));var db=require(_0x1e51('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1e51('0x5'))(_0x1e51('0x6'));var config=require(_0x1e51('0x7'));var jayson=require(_0x1e51('0x8'));var client=jayson['client'][_0x1e51('0x9')]({'port':0x232a});config[_0x1e51('0xa')]=_['defaults'](config['redis'],{'host':_0x1e51('0xb'),'port':0x18eb});var socket=require(_0x1e51('0xc'))(new Redis(config['redis']));require('./openchannelAccount.socket')[_0x1e51('0xd')](socket);function respondWithRpcPromise(_0x2712e0,_0x29da1f,_0x706e60){return new BPromise(function(_0x4241a6,_0x141e2e){return client['request'](_0x2712e0,_0x706e60)[_0x1e51('0xe')](function(_0xcdfa5d){logger[_0x1e51('0xf')](_0x1e51('0x10'),_0x29da1f,_0x1e51('0x11'));logger[_0x1e51('0x12')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x29da1f,_0x1e51('0x11'),JSON[_0x1e51('0x13')](_0xcdfa5d));if(_0xcdfa5d[_0x1e51('0x14')]){if(_0xcdfa5d[_0x1e51('0x14')][_0x1e51('0x15')]===0x1f4){logger[_0x1e51('0x14')](_0x1e51('0x10'),_0x29da1f,_0xcdfa5d[_0x1e51('0x14')][_0x1e51('0x16')]);return _0x141e2e(_0xcdfa5d[_0x1e51('0x14')]['message']);}logger[_0x1e51('0x14')](_0x1e51('0x10'),_0x29da1f,_0xcdfa5d[_0x1e51('0x14')]['message']);return _0x4241a6(_0xcdfa5d[_0x1e51('0x14')]['message']);}else{logger['info'](_0x1e51('0x10'),_0x29da1f,_0x1e51('0x11'));_0x4241a6(_0xcdfa5d[_0x1e51('0x17')][_0x1e51('0x16')]);}})[_0x1e51('0x18')](function(_0x3e4234){logger['error'](_0x1e51('0x10'),_0x29da1f,_0x3e4234);_0x141e2e(_0x3e4234);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 539d7b1..91dbbb2 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 _0x0962=['./openchannelAccount.events','save','remove','update','removeListener','register','length','openchannelAccount:'];(function(_0x2c3830,_0x2d62e3){var _0xa36841=function(_0x1b6566){while(--_0x1b6566){_0x2c3830['push'](_0x2c3830['shift']());}};_0xa36841(++_0x2d62e3);}(_0x0962,0x198));var _0x2096=function(_0x5f01e6,_0x479ff7){_0x5f01e6=_0x5f01e6-0x0;var _0x2333ed=_0x0962[_0x5f01e6];return _0x2333ed;};'use strict';var OpenchannelAccountEvents=require(_0x2096('0x0'));var events=[_0x2096('0x1'),_0x2096('0x2'),_0x2096('0x3')];function createListener(_0x57617c,_0x38bed1){return function(_0x580e85){_0x38bed1['emit'](_0x57617c,_0x580e85);};}function removeListener(_0x2fe7b1,_0x2001d9){return function(){OpenchannelAccountEvents[_0x2096('0x4')](_0x2fe7b1,_0x2001d9);};}exports[_0x2096('0x5')]=function(_0x1ce10d){for(var _0x462564=0x0,_0x130711=events[_0x2096('0x6')];_0x462564<_0x130711;_0x462564++){var _0x4b5f76=events[_0x462564];var _0x16799f=createListener(_0x2096('0x7')+_0x4b5f76,_0x1ce10d);OpenchannelAccountEvents['on'](_0x4b5f76,_0x16799f);}}; \ No newline at end of file +var _0x36f1=['register','length','./openchannelAccount.events','remove','emit','removeListener'];(function(_0xd5a5f9,_0x44ea90){var _0xf05a30=function(_0x5e4701){while(--_0x5e4701){_0xd5a5f9['push'](_0xd5a5f9['shift']());}};_0xf05a30(++_0x44ea90);}(_0x36f1,0xb0));var _0x136f=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x36f1[_0x397e5f];return _0x5302b8;};'use strict';var OpenchannelAccountEvents=require(_0x136f('0x0'));var events=['save',_0x136f('0x1'),'update'];function createListener(_0x338a88,_0x31045f){return function(_0x5a7bbe){_0x31045f[_0x136f('0x2')](_0x338a88,_0x5a7bbe);};}function removeListener(_0x3c8abd,_0x46dc4d){return function(){OpenchannelAccountEvents[_0x136f('0x3')](_0x3c8abd,_0x46dc4d);};}exports[_0x136f('0x4')]=function(_0x5b00b5){for(var _0x430433=0x0,_0x525663=events[_0x136f('0x5')];_0x430433<_0x525663;_0x430433++){var _0x29e9c5=events[_0x430433];var _0x3c7a1c=createListener('openchannelAccount:'+_0x29e9c5,_0x5b00b5);OpenchannelAccountEvents['on'](_0x29e9c5,_0x3c7a1c);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index f1a7c70..c13abe8 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 _0x1a32=['path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports','multer'];(function(_0x27504e,_0x796b19){var _0x50554c=function(_0x1fc2cd){while(--_0x1fc2cd){_0x27504e['push'](_0x27504e['shift']());}};_0x50554c(++_0x796b19);}(_0x1a32,0x16f));var _0x21a3=function(_0x2a8c21,_0x163576){_0x2a8c21=_0x2a8c21-0x0;var _0x5f3061=_0x1a32[_0x2a8c21];return _0x5f3061;};'use strict';var multer=require(_0x21a3('0x0'));var util=require('util');var path=require(_0x21a3('0x1'));var timeout=require(_0x21a3('0x2'));var express=require('express');var router=express[_0x21a3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x21a3('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x21a3('0x5'));var controller=require('./openchannelApplication.controller');router[_0x21a3('0x6')]('/',auth[_0x21a3('0x7')](),controller[_0x21a3('0x8')]);router[_0x21a3('0x6')](_0x21a3('0x9'),auth[_0x21a3('0x7')](),controller[_0x21a3('0xa')]);router[_0x21a3('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x21a3('0x9'),auth[_0x21a3('0x7')](),controller[_0x21a3('0xc')]);router[_0x21a3('0xd')]('/:id',auth[_0x21a3('0x7')](),controller[_0x21a3('0xe')]);module[_0x21a3('0xf')]=router; \ No newline at end of file +var _0xbee3=['isAuthenticated','index','show','/:id','update','exports','multer','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelApplication.controller','get'];(function(_0x116246,_0x5c35d2){var _0x46d099=function(_0x25ddc9){while(--_0x25ddc9){_0x116246['push'](_0x116246['shift']());}};_0x46d099(++_0x5c35d2);}(_0xbee3,0x12c));var _0x3bee=function(_0x45d7c2,_0x1c3d69){_0x45d7c2=_0x45d7c2-0x0;var _0x1c181a=_0xbee3[_0x45d7c2];return _0x1c181a;};'use strict';var multer=require(_0x3bee('0x0'));var util=require('util');var path=require(_0x3bee('0x1'));var timeout=require('connect-timeout');var express=require(_0x3bee('0x2'));var router=express['Router']();var fs_extra=require(_0x3bee('0x3'));var auth=require(_0x3bee('0x4'));var interaction=require(_0x3bee('0x5'));var config=require('../../config/environment');var controller=require(_0x3bee('0x6'));router[_0x3bee('0x7')]('/',auth[_0x3bee('0x8')](),controller[_0x3bee('0x9')]);router[_0x3bee('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x3bee('0xa')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3bee('0xb'),auth[_0x3bee('0x8')](),controller[_0x3bee('0xc')]);router['delete']('/:id',auth[_0x3bee('0x8')](),controller['destroy']);module[_0x3bee('0xd')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 55e5fd8..e347021 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 _0x420d=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x3eb0a7,_0x27755d){var _0x317d1e=function(_0x4b9d75){while(--_0x4b9d75){_0x3eb0a7['push'](_0x3eb0a7['shift']());}};_0x317d1e(++_0x27755d);}(_0x420d,0x160));var _0xd420=function(_0xbc4f9f,_0x111984){_0xbc4f9f=_0xbc4f9f-0x0;var _0x3bec7d=_0x420d[_0xbc4f9f];return _0x3bec7d;};'use strict';var Sequelize=require(_0xd420('0x0'));module[_0xd420('0x1')]={'priority':{'type':Sequelize[_0xd420('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xd420('0x3')],'allowNull':![],'defaultValue':_0xd420('0x4')},'appdata':{'type':Sequelize[_0xd420('0x5')]()},'description':{'type':Sequelize[_0xd420('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd420('0x6')}}; \ No newline at end of file +var _0xad01=['exports','noop','TEXT','STRING','*,*,*,*','sequelize'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xad01,0x17f));var _0x1ad0=function(_0x4eea4b,_0x2df371){_0x4eea4b=_0x4eea4b-0x0;var _0xe8bec8=_0xad01[_0x4eea4b];return _0xe8bec8;};'use strict';var Sequelize=require(_0x1ad0('0x0'));module[_0x1ad0('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1ad0('0x2')},'appdata':{'type':Sequelize[_0x1ad0('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x1ad0('0x4')],'defaultValue':_0x1ad0('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index e45dfc5..56cd9d2 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 _0xda4e=['hasOwnProperty','sort','where','pick','VIRTUAL','filter','merge','options','includeAll','findAll','rows','show','params','length','include','find','create','catch','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','fs-extra','crypto','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','sendStatus','status','end','json','offset','count','limit','set','Content-Range','apply','reject','update','destroy','then','stack','name','send','map','OpenchannelApplication','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields'];(function(_0x542e14,_0x5dfd4b){var _0xe3bbb=function(_0x5c2ac7){while(--_0x5c2ac7){_0x542e14['push'](_0x542e14['shift']());}};_0xe3bbb(++_0x5dfd4b);}(_0xda4e,0x171));var _0xeda4=function(_0x4c3040,_0xa0d549){_0x4c3040=_0x4c3040-0x0;var _0x3fed5e=_0xda4e[_0x4c3040];return _0x3fed5e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xeda4('0x0'));var jsonpatch=require(_0xeda4('0x1'));var rp=require(_0xeda4('0x2'));var moment=require(_0xeda4('0x3'));var BPromise=require(_0xeda4('0x4'));var Mustache=require(_0xeda4('0x5'));var util=require('util');var path=require('path');var sox=require(_0xeda4('0x6'));var csv=require(_0xeda4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeda4('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xeda4('0x9'));var jsforce=require(_0xeda4('0xa'));var deskjs=require(_0xeda4('0xb'));var toCsv=require(_0xeda4('0x7'));var querystring=require(_0xeda4('0xc'));var Papa=require(_0xeda4('0xd'));var Redis=require(_0xeda4('0xe'));var authService=require(_0xeda4('0xf'));var qs=require(_0xeda4('0x10'));var as=require(_0xeda4('0x11'));var hardwareService=require(_0xeda4('0x12'));var logger=require('../../config/logger')(_0xeda4('0x13'));var utils=require(_0xeda4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xeda4('0x15'));var db=require(_0xeda4('0x16'))['db'];function respondWithStatusCode(_0x5322cb,_0x186f8b){_0x186f8b=_0x186f8b||0xcc;return function(_0x5bc567){if(_0x5bc567){return _0x5322cb[_0xeda4('0x17')](_0x186f8b);}return _0x5322cb[_0xeda4('0x18')](_0x186f8b)[_0xeda4('0x19')]();};}function respondWithResult(_0x24a646,_0x1edc55){_0x1edc55=_0x1edc55||0xc8;return function(_0x518307){if(_0x518307){return _0x24a646[_0xeda4('0x18')](_0x1edc55)[_0xeda4('0x1a')](_0x518307);}};}function respondWithFilteredResult(_0x25cd3d,_0x445eb2){return function(_0x4caef1){if(_0x4caef1){var _0x84982b=typeof _0x445eb2[_0xeda4('0x1b')]==='undefined'&&typeof _0x445eb2['limit']==='undefined';var _0x885119=_0x4caef1['count'];var _0x2688a1=_0x84982b?0x0:_0x445eb2['offset'];var _0x3e6309=_0x84982b?_0x4caef1[_0xeda4('0x1c')]:_0x445eb2[_0xeda4('0x1b')]+_0x445eb2[_0xeda4('0x1d')];var _0x5d6734;if(_0x3e6309>=_0x885119){_0x3e6309=_0x885119;_0x5d6734=0xc8;}else{_0x5d6734=0xce;}_0x25cd3d['status'](_0x5d6734);return _0x25cd3d[_0xeda4('0x1e')](_0xeda4('0x1f'),_0x2688a1+'-'+_0x3e6309+'/'+_0x885119)[_0xeda4('0x1a')](_0x4caef1);}return null;};}function patchUpdates(_0x4ae11d){return function(_0x1ba565){try{jsonpatch[_0xeda4('0x20')](_0x1ba565,_0x4ae11d,!![]);}catch(_0x293c58){return BPromise[_0xeda4('0x21')](_0x293c58);}return _0x1ba565['save']();};}function saveUpdates(_0x5aba78,_0x314fb4){return function(_0x3a9977){if(_0x3a9977){return _0x3a9977[_0xeda4('0x22')](_0x5aba78)['then'](function(_0x5c27c3){return _0x5c27c3;});}return null;};}function removeEntity(_0x1c3725,_0x5a7d58){return function(_0x2b94ee){if(_0x2b94ee){return _0x2b94ee[_0xeda4('0x23')]()[_0xeda4('0x24')](function(){_0x1c3725[_0xeda4('0x18')](0xcc)[_0xeda4('0x19')]();});}};}function handleEntityNotFound(_0x776b35,_0x25f181){return function(_0x16d375){if(!_0x16d375){_0x776b35[_0xeda4('0x17')](0x194);}return _0x16d375;};}function handleError(_0x26a48b,_0x4fc874){_0x4fc874=_0x4fc874||0x1f4;return function(_0x5a8414){logger['error'](_0x5a8414[_0xeda4('0x25')]);if(_0x5a8414[_0xeda4('0x26')]){delete _0x5a8414['name'];}_0x26a48b[_0xeda4('0x18')](_0x4fc874)[_0xeda4('0x27')](_0x5a8414);};}exports['index']=function(_0x1a9808,_0x4b91c4){var _0x1a0b78={},_0x176d2a={},_0x1ff37a={'count':0x0,'rows':[]};var _0x58d799=_[_0xeda4('0x28')](db[_0xeda4('0x29')][_0xeda4('0x2a')],function(_0x4cd3ea){return{'name':_0x4cd3ea['fieldName'],'type':_0x4cd3ea[_0xeda4('0x2b')]['key']};});_0x176d2a[_0xeda4('0x2c')]=_[_0xeda4('0x28')](_0x58d799,'name');_0x176d2a[_0xeda4('0x2d')]=_[_0xeda4('0x2e')](_0x1a9808['query']);_0x176d2a[_0xeda4('0x2f')]=_[_0xeda4('0x30')](_0x176d2a['model'],_0x176d2a[_0xeda4('0x2d')]);_0x1a0b78[_0xeda4('0x31')]=_[_0xeda4('0x30')](_0x176d2a[_0xeda4('0x2c')],qs[_0xeda4('0x32')](_0x1a9808[_0xeda4('0x2d')][_0xeda4('0x32')]));_0x1a0b78[_0xeda4('0x31')]=_0x1a0b78[_0xeda4('0x31')]['length']?_0x1a0b78['attributes']:_0x176d2a[_0xeda4('0x2c')];if(!_0x1a9808['query'][_0xeda4('0x33')]('nolimit')){_0x1a0b78[_0xeda4('0x1d')]=qs['limit'](_0x1a9808[_0xeda4('0x2d')][_0xeda4('0x1d')]);_0x1a0b78[_0xeda4('0x1b')]=qs[_0xeda4('0x1b')](_0x1a9808['query']['offset']);}_0x1a0b78['order']=qs['sort'](_0x1a9808[_0xeda4('0x2d')][_0xeda4('0x34')]);_0x1a0b78[_0xeda4('0x35')]=qs['filters'](_[_0xeda4('0x36')](_0x1a9808['query'],_0x176d2a[_0xeda4('0x2f')]),_0x58d799);if(_0x1a9808['query']['filter']){_0x1a0b78['where']=_['merge'](_0x1a0b78['where'],{'$or':_[_0xeda4('0x28')](_0x58d799,function(_0x2c2a1d){if(_0x2c2a1d['type']!==_0xeda4('0x37')){var _0x4fe91d={};_0x4fe91d[_0x2c2a1d[_0xeda4('0x26')]]={'$like':'%'+_0x1a9808[_0xeda4('0x2d')][_0xeda4('0x38')]+'%'};return _0x4fe91d;}})});}_0x1a0b78=_[_0xeda4('0x39')]({},_0x1a0b78,_0x1a9808[_0xeda4('0x3a')]);var _0x51cc4c={'where':_0x1a0b78['where']};return db[_0xeda4('0x29')][_0xeda4('0x1c')](_0x51cc4c)[_0xeda4('0x24')](function(_0x4a060b){_0x1ff37a[_0xeda4('0x1c')]=_0x4a060b;if(_0x1a9808[_0xeda4('0x2d')][_0xeda4('0x3b')]){_0x1a0b78['include']=[{'all':!![]}];}return db['OpenchannelApplication'][_0xeda4('0x3c')](_0x1a0b78);})[_0xeda4('0x24')](function(_0x13a7b8){_0x1ff37a[_0xeda4('0x3d')]=_0x13a7b8;return _0x1ff37a;})[_0xeda4('0x24')](respondWithFilteredResult(_0x4b91c4,_0x1a0b78))['catch'](handleError(_0x4b91c4,null));};exports[_0xeda4('0x3e')]=function(_0x395550,_0x1c61b6){var _0x3d2afd={'raw':!![],'where':{'id':_0x395550[_0xeda4('0x3f')]['id']}},_0x4e9577={};_0x4e9577['model']=_['keys'](db[_0xeda4('0x29')]['rawAttributes']);_0x4e9577[_0xeda4('0x2d')]=_[_0xeda4('0x2e')](_0x395550[_0xeda4('0x2d')]);_0x4e9577[_0xeda4('0x2f')]=_[_0xeda4('0x30')](_0x4e9577[_0xeda4('0x2c')],_0x4e9577[_0xeda4('0x2d')]);_0x3d2afd[_0xeda4('0x31')]=_[_0xeda4('0x30')](_0x4e9577[_0xeda4('0x2c')],qs[_0xeda4('0x32')](_0x395550[_0xeda4('0x2d')][_0xeda4('0x32')]));_0x3d2afd[_0xeda4('0x31')]=_0x3d2afd[_0xeda4('0x31')][_0xeda4('0x40')]?_0x3d2afd[_0xeda4('0x31')]:_0x4e9577[_0xeda4('0x2c')];if(_0x395550[_0xeda4('0x2d')][_0xeda4('0x3b')]){_0x3d2afd[_0xeda4('0x41')]=[{'all':!![]}];}_0x3d2afd=_[_0xeda4('0x39')]({},_0x3d2afd,_0x395550['options']);return db[_0xeda4('0x29')][_0xeda4('0x42')](_0x3d2afd)[_0xeda4('0x24')](handleEntityNotFound(_0x1c61b6,null))[_0xeda4('0x24')](respondWithResult(_0x1c61b6,null))['catch'](handleError(_0x1c61b6,null));};exports[_0xeda4('0x43')]=function(_0x561389,_0x1a1cf3){return db[_0xeda4('0x29')][_0xeda4('0x43')](_0x561389['body'],{})[_0xeda4('0x24')](respondWithResult(_0x1a1cf3,0xc9))[_0xeda4('0x44')](handleError(_0x1a1cf3,null));};exports['update']=function(_0x586047,_0x523cec){if(_0x586047['body']['id']){delete _0x586047[_0xeda4('0x45')]['id'];}return db['OpenchannelApplication'][_0xeda4('0x42')]({'where':{'id':_0x586047[_0xeda4('0x3f')]['id']}})['then'](handleEntityNotFound(_0x523cec,null))[_0xeda4('0x24')](saveUpdates(_0x586047[_0xeda4('0x45')],null))[_0xeda4('0x24')](respondWithResult(_0x523cec,null))['catch'](handleError(_0x523cec,null));};exports[_0xeda4('0x23')]=function(_0x3fe91,_0x45594b){return db[_0xeda4('0x29')]['find']({'where':{'id':_0x3fe91[_0xeda4('0x3f')]['id']}})[_0xeda4('0x24')](handleEntityNotFound(_0x45594b,null))[_0xeda4('0x24')](removeEntity(_0x45594b,null))[_0xeda4('0x44')](handleError(_0x45594b,null));}; \ No newline at end of file +var _0x13ef=['offset','undefined','limit','count','set','Content-Range','then','destroy','error','name','send','index','map','OpenchannelApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','show','params','merge','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json'];(function(_0x1dad08,_0x306709){var _0xab33f1=function(_0x2a75a5){while(--_0x2a75a5){_0x1dad08['push'](_0x1dad08['shift']());}};_0xab33f1(++_0x306709);}(_0x13ef,0x1e4));var _0xf13e=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x13ef[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0xf13e('0x0'));var rimraf=require(_0xf13e('0x1'));var zipdir=require(_0xf13e('0x2'));var jsonpatch=require(_0xf13e('0x3'));var rp=require(_0xf13e('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf13e('0x5'));var util=require('util');var path=require(_0xf13e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf13e('0x7'));var _=require('lodash');var squel=require(_0xf13e('0x8'));var crypto=require(_0xf13e('0x9'));var jsforce=require(_0xf13e('0xa'));var deskjs=require(_0xf13e('0xb'));var toCsv=require(_0xf13e('0xc'));var querystring=require(_0xf13e('0xd'));var Papa=require(_0xf13e('0xe'));var Redis=require('ioredis');var authService=require(_0xf13e('0xf'));var qs=require(_0xf13e('0x10'));var as=require(_0xf13e('0x11'));var hardwareService=require(_0xf13e('0x12'));var logger=require(_0xf13e('0x13'))('api');var utils=require(_0xf13e('0x14'));var config=require(_0xf13e('0x15'));var licenseUtil=require(_0xf13e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xa7596c,_0x5e69de){_0x5e69de=_0x5e69de||0xcc;return function(_0x102753){if(_0x102753){return _0xa7596c[_0xf13e('0x17')](_0x5e69de);}return _0xa7596c['status'](_0x5e69de)[_0xf13e('0x18')]();};}function respondWithResult(_0x252ca6,_0x10ce9c){_0x10ce9c=_0x10ce9c||0xc8;return function(_0x515941){if(_0x515941){return _0x252ca6[_0xf13e('0x19')](_0x10ce9c)[_0xf13e('0x1a')](_0x515941);}};}function respondWithFilteredResult(_0x5a4355,_0x1424ee){return function(_0x5a9c06){if(_0x5a9c06){var _0xea42b2=typeof _0x1424ee[_0xf13e('0x1b')]===_0xf13e('0x1c')&&typeof _0x1424ee[_0xf13e('0x1d')]===_0xf13e('0x1c');var _0x454600=_0x5a9c06[_0xf13e('0x1e')];var _0x4821fa=_0xea42b2?0x0:_0x1424ee[_0xf13e('0x1b')];var _0x188ea9=_0xea42b2?_0x5a9c06['count']:_0x1424ee[_0xf13e('0x1b')]+_0x1424ee['limit'];var _0x37f222;if(_0x188ea9>=_0x454600){_0x188ea9=_0x454600;_0x37f222=0xc8;}else{_0x37f222=0xce;}_0x5a4355['status'](_0x37f222);return _0x5a4355[_0xf13e('0x1f')](_0xf13e('0x20'),_0x4821fa+'-'+_0x188ea9+'/'+_0x454600)[_0xf13e('0x1a')](_0x5a9c06);}return null;};}function patchUpdates(_0x10d1d2){return function(_0xdd1234){try{jsonpatch['apply'](_0xdd1234,_0x10d1d2,!![]);}catch(_0x265a0b){return BPromise['reject'](_0x265a0b);}return _0xdd1234['save']();};}function saveUpdates(_0x4e2710,_0x3a0b7e){return function(_0x47b727){if(_0x47b727){return _0x47b727['update'](_0x4e2710)[_0xf13e('0x21')](function(_0x57803d){return _0x57803d;});}return null;};}function removeEntity(_0x2fd8cb,_0x3a7741){return function(_0x567c06){if(_0x567c06){return _0x567c06[_0xf13e('0x22')]()[_0xf13e('0x21')](function(){_0x2fd8cb[_0xf13e('0x19')](0xcc)[_0xf13e('0x18')]();});}};}function handleEntityNotFound(_0x210c54,_0x1292d9){return function(_0x5df80f){if(!_0x5df80f){_0x210c54[_0xf13e('0x17')](0x194);}return _0x5df80f;};}function handleError(_0x158ef4,_0x5b7bbe){_0x5b7bbe=_0x5b7bbe||0x1f4;return function(_0x160580){logger[_0xf13e('0x23')](_0x160580['stack']);if(_0x160580[_0xf13e('0x24')]){delete _0x160580['name'];}_0x158ef4['status'](_0x5b7bbe)[_0xf13e('0x25')](_0x160580);};}exports[_0xf13e('0x26')]=function(_0x331e0f,_0x283a35){var _0x32564b={},_0x573f0c={},_0x2a57c5={'count':0x0,'rows':[]};var _0x38bb0e=_[_0xf13e('0x27')](db[_0xf13e('0x28')][_0xf13e('0x29')],function(_0xfc51c4){return{'name':_0xfc51c4[_0xf13e('0x2a')],'type':_0xfc51c4[_0xf13e('0x2b')][_0xf13e('0x2c')]};});_0x573f0c[_0xf13e('0x2d')]=_[_0xf13e('0x27')](_0x38bb0e,_0xf13e('0x24'));_0x573f0c[_0xf13e('0x2e')]=_[_0xf13e('0x2f')](_0x331e0f[_0xf13e('0x2e')]);_0x573f0c[_0xf13e('0x30')]=_[_0xf13e('0x31')](_0x573f0c[_0xf13e('0x2d')],_0x573f0c[_0xf13e('0x2e')]);_0x32564b[_0xf13e('0x32')]=_[_0xf13e('0x31')](_0x573f0c['model'],qs['fields'](_0x331e0f[_0xf13e('0x2e')][_0xf13e('0x33')]));_0x32564b[_0xf13e('0x32')]=_0x32564b[_0xf13e('0x32')][_0xf13e('0x34')]?_0x32564b[_0xf13e('0x32')]:_0x573f0c[_0xf13e('0x2d')];if(!_0x331e0f[_0xf13e('0x2e')][_0xf13e('0x35')](_0xf13e('0x36'))){_0x32564b[_0xf13e('0x1d')]=qs[_0xf13e('0x1d')](_0x331e0f['query'][_0xf13e('0x1d')]);_0x32564b[_0xf13e('0x1b')]=qs[_0xf13e('0x1b')](_0x331e0f[_0xf13e('0x2e')]['offset']);}_0x32564b[_0xf13e('0x37')]=qs[_0xf13e('0x38')](_0x331e0f[_0xf13e('0x2e')][_0xf13e('0x38')]);_0x32564b[_0xf13e('0x39')]=qs[_0xf13e('0x30')](_[_0xf13e('0x3a')](_0x331e0f[_0xf13e('0x2e')],_0x573f0c[_0xf13e('0x30')]),_0x38bb0e);if(_0x331e0f['query'][_0xf13e('0x3b')]){_0x32564b[_0xf13e('0x39')]=_['merge'](_0x32564b[_0xf13e('0x39')],{'$or':_['map'](_0x38bb0e,function(_0x1ffbb8){if(_0x1ffbb8[_0xf13e('0x2b')]!=='VIRTUAL'){var _0x20b4ca={};_0x20b4ca[_0x1ffbb8[_0xf13e('0x24')]]={'$like':'%'+_0x331e0f['query'][_0xf13e('0x3b')]+'%'};return _0x20b4ca;}})});}_0x32564b=_['merge']({},_0x32564b,_0x331e0f[_0xf13e('0x3c')]);var _0x43570e={'where':_0x32564b[_0xf13e('0x39')]};return db[_0xf13e('0x28')][_0xf13e('0x1e')](_0x43570e)[_0xf13e('0x21')](function(_0x51bedd){_0x2a57c5[_0xf13e('0x1e')]=_0x51bedd;if(_0x331e0f['query'][_0xf13e('0x3d')]){_0x32564b[_0xf13e('0x3e')]=[{'all':!![]}];}return db['OpenchannelApplication'][_0xf13e('0x3f')](_0x32564b);})['then'](function(_0x173b64){_0x2a57c5[_0xf13e('0x40')]=_0x173b64;return _0x2a57c5;})[_0xf13e('0x21')](respondWithFilteredResult(_0x283a35,_0x32564b))[_0xf13e('0x41')](handleError(_0x283a35,null));};exports[_0xf13e('0x42')]=function(_0x5dd0af,_0x3d5cb6){var _0x1e06b0={'raw':!![],'where':{'id':_0x5dd0af[_0xf13e('0x43')]['id']}},_0x480426={};_0x480426['model']=_[_0xf13e('0x2f')](db[_0xf13e('0x28')][_0xf13e('0x29')]);_0x480426['query']=_[_0xf13e('0x2f')](_0x5dd0af[_0xf13e('0x2e')]);_0x480426[_0xf13e('0x30')]=_[_0xf13e('0x31')](_0x480426[_0xf13e('0x2d')],_0x480426[_0xf13e('0x2e')]);_0x1e06b0['attributes']=_[_0xf13e('0x31')](_0x480426[_0xf13e('0x2d')],qs[_0xf13e('0x33')](_0x5dd0af['query']['fields']));_0x1e06b0['attributes']=_0x1e06b0[_0xf13e('0x32')]['length']?_0x1e06b0['attributes']:_0x480426[_0xf13e('0x2d')];if(_0x5dd0af[_0xf13e('0x2e')]['includeAll']){_0x1e06b0[_0xf13e('0x3e')]=[{'all':!![]}];}_0x1e06b0=_[_0xf13e('0x44')]({},_0x1e06b0,_0x5dd0af[_0xf13e('0x3c')]);return db['OpenchannelApplication'][_0xf13e('0x45')](_0x1e06b0)[_0xf13e('0x21')](handleEntityNotFound(_0x3d5cb6,null))['then'](respondWithResult(_0x3d5cb6,null))['catch'](handleError(_0x3d5cb6,null));};exports[_0xf13e('0x46')]=function(_0x4cda77,_0x2100ca){return db['OpenchannelApplication'][_0xf13e('0x46')](_0x4cda77['body'],{})[_0xf13e('0x21')](respondWithResult(_0x2100ca,0xc9))['catch'](handleError(_0x2100ca,null));};exports[_0xf13e('0x47')]=function(_0xf3ff4f,_0x5818e4){if(_0xf3ff4f['body']['id']){delete _0xf3ff4f[_0xf13e('0x48')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0xf3ff4f[_0xf13e('0x43')]['id']}})[_0xf13e('0x21')](handleEntityNotFound(_0x5818e4,null))[_0xf13e('0x21')](saveUpdates(_0xf3ff4f[_0xf13e('0x48')],null))['then'](respondWithResult(_0x5818e4,null))[_0xf13e('0x41')](handleError(_0x5818e4,null));};exports[_0xf13e('0x22')]=function(_0x1fa915,_0x205056){return db[_0xf13e('0x28')][_0xf13e('0x45')]({'where':{'id':_0x1fa915[_0xf13e('0x43')]['id']}})[_0xf13e('0x21')](handleEntityNotFound(_0x205056,null))[_0xf13e('0x21')](removeEntity(_0x205056,null))[_0xf13e('0x41')](handleError(_0x205056,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 7628fab..b37af7c 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 _0xddff=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./openchannelApplication.attributes','define','openchannel_applications'];(function(_0x3575e6,_0x39ea27){var _0x943916=function(_0x3bb54c){while(--_0x3bb54c){_0x3575e6['push'](_0x3575e6['shift']());}};_0x943916(++_0x39ea27);}(_0xddff,0x128));var _0xfddf=function(_0x5af97c,_0x24a49f){_0x5af97c=_0x5af97c-0x0;var _0x3472ae=_0xddff[_0x5af97c];return _0x3472ae;};'use strict';var _=require(_0xfddf('0x0'));var util=require(_0xfddf('0x1'));var logger=require(_0xfddf('0x2'))(_0xfddf('0x3'));var moment=require(_0xfddf('0x4'));var BPromise=require(_0xfddf('0x5'));var rp=require(_0xfddf('0x6'));var fs=require('fs');var path=require(_0xfddf('0x7'));var rimraf=require(_0xfddf('0x8'));var config=require('../../config/environment');var attributes=require(_0xfddf('0x9'));module['exports']=function(_0x3c704b,_0x26aed9){return _0x3c704b[_0xfddf('0xa')]('OpenchannelApplication',attributes,{'tableName':_0xfddf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xfddf('0xc'),'collate':_0xfddf('0xd')});}; \ No newline at end of file +var _0x535a=['OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x535a,0xd5));var _0xa535=function(_0x1f8ed6,_0x280d14){_0x1f8ed6=_0x1f8ed6-0x0;var _0x1bdd65=_0x535a[_0x1f8ed6];return _0x1bdd65;};'use strict';var _=require(_0xa535('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa535('0x1'));var moment=require(_0xa535('0x2'));var BPromise=require(_0xa535('0x3'));var rp=require(_0xa535('0x4'));var fs=require('fs');var path=require(_0xa535('0x5'));var rimraf=require(_0xa535('0x6'));var config=require(_0xa535('0x7'));var attributes=require(_0xa535('0x8'));module[_0xa535('0x9')]=function(_0x35f6f2,_0x49684e){return _0x35f6f2[_0xa535('0xa')](_0xa535('0xb'),attributes,{'tableName':_0xa535('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xa535('0xd')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index b2227d3..8d2dac8 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 _0x1ec6=['options','raw','where','attributes','limit','then','UpdateOpenchannelApplication','stringify','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','body'];(function(_0x422905,_0x3bce3a){var _0x33dc6c=function(_0x4852c9){while(--_0x4852c9){_0x422905['push'](_0x422905['shift']());}};_0x33dc6c(++_0x3bce3a);}(_0x1ec6,0x152));var _0x61ec=function(_0x3f4dd9,_0xe0b819){_0x3f4dd9=_0x3f4dd9-0x0;var _0x31c54a=_0x1ec6[_0x3f4dd9];return _0x31c54a;};'use strict';var _=require(_0x61ec('0x0'));var util=require(_0x61ec('0x1'));var moment=require('moment');var BPromise=require(_0x61ec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x61ec('0x3'));var db=require(_0x61ec('0x4'))['db'];var utils=require(_0x61ec('0x5'));var logger=require(_0x61ec('0x6'))('rpc');var config=require(_0x61ec('0x7'));var jayson=require(_0x61ec('0x8'));var client=jayson['client'][_0x61ec('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x272384,_0x243058,_0x2e83b5){return new BPromise(function(_0x58fcd6,_0x56b9d3){return client[_0x61ec('0xa')](_0x272384,_0x2e83b5)['then'](function(_0x57c09e){logger[_0x61ec('0xb')](_0x61ec('0xc'),_0x243058,_0x61ec('0xd'));logger[_0x61ec('0xe')](_0x61ec('0xf'),_0x243058,_0x61ec('0xd'),JSON['stringify'](_0x57c09e));if(_0x57c09e[_0x61ec('0x10')]){if(_0x57c09e[_0x61ec('0x10')][_0x61ec('0x11')]===0x1f4){logger[_0x61ec('0x10')]('OpenchannelApplication,\x20%s,\x20%s',_0x243058,_0x57c09e[_0x61ec('0x10')]['message']);return _0x56b9d3(_0x57c09e[_0x61ec('0x10')][_0x61ec('0x12')]);}logger[_0x61ec('0x10')](_0x61ec('0xc'),_0x243058,_0x57c09e[_0x61ec('0x10')][_0x61ec('0x12')]);return _0x58fcd6(_0x57c09e['error'][_0x61ec('0x12')]);}else{logger[_0x61ec('0xb')](_0x61ec('0xc'),_0x243058,_0x61ec('0xd'));_0x58fcd6(_0x57c09e[_0x61ec('0x13')][_0x61ec('0x12')]);}})[_0x61ec('0x14')](function(_0x137744){logger['error'](_0x61ec('0xc'),_0x243058,_0x137744);_0x56b9d3(_0x137744);});});}exports['UpdateOpenchannelApplication']=function(_0x33fd6e){var _0x45202e=this;return new Promise(function(_0x2389b4,_0x666fbe){return db['OpenchannelApplication']['update'](_0x33fd6e[_0x61ec('0x15')],{'raw':_0x33fd6e[_0x61ec('0x16')]?_0x33fd6e['options'][_0x61ec('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x33fd6e[_0x61ec('0x16')]?_0x33fd6e[_0x61ec('0x16')][_0x61ec('0x18')]||null:null,'attributes':_0x33fd6e[_0x61ec('0x16')]?_0x33fd6e[_0x61ec('0x16')][_0x61ec('0x19')]||null:null,'limit':_0x33fd6e[_0x61ec('0x16')]?_0x33fd6e['options'][_0x61ec('0x1a')]||null:null})[_0x61ec('0x1b')](function(_0x3addad){logger[_0x61ec('0xb')](_0x61ec('0x1c'),_0x33fd6e);logger['debug'](_0x61ec('0x1c'),_0x33fd6e,JSON[_0x61ec('0x1d')](_0x3addad));_0x2389b4(_0x3addad);})[_0x61ec('0x14')](function(_0x25762a){logger[_0x61ec('0x10')](_0x61ec('0x1c'),_0x25762a[_0x61ec('0x12')],_0x33fd6e);_0x666fbe(_0x45202e['error'](0x1f4,_0x25762a[_0x61ec('0x12')]));});});}; \ No newline at end of file +var _0x7f24=['../../config/environment','jayson/promise','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','UpdateOpenchannelApplication','update','body','options','raw','where','attributes','limit','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4be58d,_0x58fa60){var _0x1eab79=function(_0x6d252f){while(--_0x6d252f){_0x4be58d['push'](_0x4be58d['shift']());}};_0x1eab79(++_0x58fa60);}(_0x7f24,0x10f));var _0x47f2=function(_0xfed299,_0x21b8d0){_0xfed299=_0xfed299-0x0;var _0x4ef1f2=_0x7f24[_0xfed299];return _0x4ef1f2;};'use strict';var _=require(_0x47f2('0x0'));var util=require(_0x47f2('0x1'));var moment=require(_0x47f2('0x2'));var BPromise=require(_0x47f2('0x3'));var rs=require(_0x47f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x47f2('0x5'))['db'];var utils=require(_0x47f2('0x6'));var logger=require(_0x47f2('0x7'))('rpc');var config=require(_0x47f2('0x8'));var jayson=require(_0x47f2('0x9'));var client=jayson['client'][_0x47f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5536b4,_0xa286f2,_0x49e869){return new BPromise(function(_0xb1b820,_0x3e062d){return client[_0x47f2('0xb')](_0x5536b4,_0x49e869)[_0x47f2('0xc')](function(_0x1a9e28){logger[_0x47f2('0xd')](_0x47f2('0xe'),_0xa286f2,_0x47f2('0xf'));logger[_0x47f2('0x10')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0xa286f2,'request\x20sent',JSON[_0x47f2('0x11')](_0x1a9e28));if(_0x1a9e28[_0x47f2('0x12')]){if(_0x1a9e28['error'][_0x47f2('0x13')]===0x1f4){logger[_0x47f2('0x12')](_0x47f2('0xe'),_0xa286f2,_0x1a9e28[_0x47f2('0x12')][_0x47f2('0x14')]);return _0x3e062d(_0x1a9e28[_0x47f2('0x12')][_0x47f2('0x14')]);}logger[_0x47f2('0x12')](_0x47f2('0xe'),_0xa286f2,_0x1a9e28[_0x47f2('0x12')][_0x47f2('0x14')]);return _0xb1b820(_0x1a9e28[_0x47f2('0x12')]['message']);}else{logger[_0x47f2('0xd')](_0x47f2('0xe'),_0xa286f2,_0x47f2('0xf'));_0xb1b820(_0x1a9e28[_0x47f2('0x15')][_0x47f2('0x14')]);}})[_0x47f2('0x16')](function(_0x55d5d4){logger[_0x47f2('0x12')](_0x47f2('0xe'),_0xa286f2,_0x55d5d4);_0x3e062d(_0x55d5d4);});});}exports[_0x47f2('0x17')]=function(_0x20b426){var _0x4a4a3f=this;return new Promise(function(_0x1ae761,_0x394062){return db['OpenchannelApplication'][_0x47f2('0x18')](_0x20b426[_0x47f2('0x19')],{'raw':_0x20b426[_0x47f2('0x1a')]?_0x20b426[_0x47f2('0x1a')][_0x47f2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20b426[_0x47f2('0x1a')]?_0x20b426[_0x47f2('0x1a')][_0x47f2('0x1c')]||null:null,'attributes':_0x20b426[_0x47f2('0x1a')]?_0x20b426[_0x47f2('0x1a')][_0x47f2('0x1d')]||null:null,'limit':_0x20b426[_0x47f2('0x1a')]?_0x20b426['options'][_0x47f2('0x1e')]||null:null})['then'](function(_0x238b02){logger[_0x47f2('0xd')]('UpdateOpenchannelApplication',_0x20b426);logger[_0x47f2('0x10')](_0x47f2('0x17'),_0x20b426,JSON[_0x47f2('0x11')](_0x238b02));_0x1ae761(_0x238b02);})[_0x47f2('0x16')](function(_0x215231){logger[_0x47f2('0x12')](_0x47f2('0x17'),_0x215231['message'],_0x20b426);_0x394062(_0x4a4a3f[_0x47f2('0x12')](0x1f4,_0x215231[_0x47f2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 3004ccd..3e8b14c 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 _0x839b=['delete','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','describe','show','/:id/messages','getMessages','/:id/download','download','post','create','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','put','/:id','openchannelinteraction:update'];(function(_0x374106,_0x33c8a6){var _0x2ac8cd=function(_0x5f1cba){while(--_0x5f1cba){_0x374106['push'](_0x374106['shift']());}};_0x2ac8cd(++_0x33c8a6);}(_0x839b,0xa9));var _0xb839=function(_0x33a77e,_0x8ee26d){_0x33a77e=_0x33a77e-0x0;var _0x19bb6c=_0x839b[_0x33a77e];return _0x19bb6c;};'use strict';var multer=require(_0xb839('0x0'));var util=require(_0xb839('0x1'));var path=require(_0xb839('0x2'));var timeout=require(_0xb839('0x3'));var express=require(_0xb839('0x4'));var router=express[_0xb839('0x5')]();var fs_extra=require(_0xb839('0x6'));var auth=require(_0xb839('0x7'));var interaction=require(_0xb839('0x8'));var config=require('../../config/environment');var controller=require(_0xb839('0x9'));router[_0xb839('0xa')]('/',auth[_0xb839('0xb')](),controller[_0xb839('0xc')]);router[_0xb839('0xa')](_0xb839('0xd'),auth[_0xb839('0xb')](),controller[_0xb839('0xe')]);router[_0xb839('0xa')]('/:id',auth[_0xb839('0xb')](),controller[_0xb839('0xf')]);router[_0xb839('0xa')](_0xb839('0x10'),auth['isAuthenticated'](),controller[_0xb839('0x11')]);router[_0xb839('0xa')](_0xb839('0x12'),auth[_0xb839('0xb')](),controller[_0xb839('0x13')]);router[_0xb839('0x14')]('/',auth[_0xb839('0xb')](),controller[_0xb839('0x15')]);router[_0xb839('0x14')](_0xb839('0x10'),auth[_0xb839('0xb')](),controller['addMessage']);router[_0xb839('0x14')](_0xb839('0x16'),auth[_0xb839('0xb')](),interaction[_0xb839('0x17')](_0xb839('0x18'),_0xb839('0x19')),controller['addTags']);router[_0xb839('0x1a')](_0xb839('0x1b'),auth['isAuthenticated'](),interaction['tracked'](_0xb839('0x18'),_0xb839('0x1c')),controller['update']);router[_0xb839('0x1d')]('/:id',auth['isAuthenticated'](),interaction['tracked'](_0xb839('0x18'),_0xb839('0x1e')),controller[_0xb839('0x1f')]);router[_0xb839('0x1d')](_0xb839('0x16'),auth[_0xb839('0xb')](),controller['removeTags']);module[_0xb839('0x20')]=router; \ No newline at end of file +var _0xf129=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','download','post','create','addMessage','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','destroy','/:id/tags','removeTags','exports','util','path','connect-timeout','express','Router'];(function(_0x90a39a,_0x32020d){var _0x2b62f7=function(_0x6841cc){while(--_0x6841cc){_0x90a39a['push'](_0x90a39a['shift']());}};_0x2b62f7(++_0x32020d);}(_0xf129,0x1ad));var _0x9f12=function(_0x3789dc,_0x4316a8){_0x3789dc=_0x3789dc-0x0;var _0x1a840f=_0xf129[_0x3789dc];return _0x1a840f;};'use strict';var multer=require('multer');var util=require(_0x9f12('0x0'));var path=require(_0x9f12('0x1'));var timeout=require(_0x9f12('0x2'));var express=require(_0x9f12('0x3'));var router=express[_0x9f12('0x4')]();var fs_extra=require(_0x9f12('0x5'));var auth=require(_0x9f12('0x6'));var interaction=require(_0x9f12('0x7'));var config=require(_0x9f12('0x8'));var controller=require(_0x9f12('0x9'));router[_0x9f12('0xa')]('/',auth[_0x9f12('0xb')](),controller[_0x9f12('0xc')]);router[_0x9f12('0xa')](_0x9f12('0xd'),auth[_0x9f12('0xb')](),controller['describe']);router['get'](_0x9f12('0xe'),auth[_0x9f12('0xb')](),controller['show']);router[_0x9f12('0xa')](_0x9f12('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0x9f12('0xa')]('/:id/download',auth[_0x9f12('0xb')](),controller[_0x9f12('0x10')]);router[_0x9f12('0x11')]('/',auth[_0x9f12('0xb')](),controller[_0x9f12('0x12')]);router[_0x9f12('0x11')](_0x9f12('0xf'),auth['isAuthenticated'](),controller[_0x9f12('0x13')]);router[_0x9f12('0x11')]('/:id/tags',auth[_0x9f12('0xb')](),interaction[_0x9f12('0x14')](_0x9f12('0x15'),_0x9f12('0x16')),controller[_0x9f12('0x17')]);router[_0x9f12('0x18')]('/:id',auth[_0x9f12('0xb')](),interaction['tracked']('openchannel',_0x9f12('0x19')),controller[_0x9f12('0x1a')]);router['delete'](_0x9f12('0xe'),auth[_0x9f12('0xb')](),interaction[_0x9f12('0x14')](_0x9f12('0x15'),'openchannelinteraction:destroy'),controller[_0x9f12('0x1b')]);router['delete'](_0x9f12('0x1c'),auth[_0x9f12('0xb')](),controller[_0x9f12('0x1d')]);module[_0x9f12('0x1e')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index ffae2e3..20bffa3 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 _0x84ae=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x37b1aa,_0x2ad8d9){var _0x2789c2=function(_0x30f50c){while(--_0x30f50c){_0x37b1aa['push'](_0x37b1aa['shift']());}};_0x2789c2(++_0x2ad8d9);}(_0x84ae,0x101));var _0xe84a=function(_0x4ac77d,_0x1152f0){_0x4ac77d=_0x4ac77d-0x0;var _0x571437=_0x84ae[_0x4ac77d];return _0x571437;};'use strict';var Sequelize=require(_0xe84a('0x0'));module[_0xe84a('0x1')]={'closed':{'type':Sequelize[_0xe84a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xe84a('0x3')]},'disposition':{'type':Sequelize[_0xe84a('0x4')]},'secondDisposition':{'type':Sequelize[_0xe84a('0x4')]},'thirdDisposition':{'type':Sequelize[_0xe84a('0x4')]},'note':{'type':Sequelize[_0xe84a('0x4')]},'read1stAt':{'type':Sequelize[_0xe84a('0x3')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xe84a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xe84a('0x5')]('in',_0xe84a('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xe84a('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0xe84a('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x1219=['STRING','ENUM','out','INTEGER','sequelize','exports','BOOLEAN','DATE'];(function(_0x7729b1,_0x468322){var _0x349504=function(_0x401cee){while(--_0x401cee){_0x7729b1['push'](_0x7729b1['shift']());}};_0x349504(++_0x468322);}(_0x1219,0x17c));var _0x9121=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1219[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x9121('0x0'));module[_0x9121('0x1')]={'closed':{'type':Sequelize[_0x9121('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9121('0x3')]},'disposition':{'type':Sequelize[_0x9121('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x9121('0x4')]},'note':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x9121('0x3')]},'threadId':{'type':Sequelize[_0x9121('0x4')]},'externalUrl':{'type':Sequelize[_0x9121('0x4')]},'lastMsgAt':{'type':Sequelize[_0x9121('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x9121('0x5')]('in',_0x9121('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0x9121('0x5')]('in',_0x9121('0x6')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x9121('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x9121('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x9121('0x7')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 93a954b..8cf0cfd 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 _0x5e6c=['params','model','rawAttributes','keys','intersection','attributes','fields','length','include','merge','options','find','create','body','destroy','addMessage','omit','ids','getMessages','findOne','OpenchannelMessage','filters','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','rows','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','root','files','server','join','User','fullname','CmContact','firstName','lastName','Attachment','Messages','createdAt','secret','read','push','Account','mkdirSync','Openchannel','Owner','N.A.','toString','closed','closedAt','threadId','Private','createReadStream','pipe','createWriteStream','basename','out','System','Contact','direction','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','Unable\x20to\x20delete\x20zip\x20file','rimraf','zip-dir','moment','util','path','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','../../mysqldb','redis','defaults','localhost','./openchannelInteraction.socket','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','update','then','error','stack','name','send','index','map','OpenchannelInteraction','type','key','getOptions','openchannel','query','user','catch','show','from'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5e6c,0x1ce));var _0xc5e6=function(_0x5a720c,_0x20c926){_0x5a720c=_0x5a720c-0x0;var _0xf7bdfc=_0x5e6c[_0x5a720c];return _0xf7bdfc;};'use strict';var rimraf=require(_0xc5e6('0x0'));var zipdir=require(_0xc5e6('0x1'));var moment=require(_0xc5e6('0x2'));var util=require(_0xc5e6('0x3'));var path=require(_0xc5e6('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require('ioredis');var interaction=require(_0xc5e6('0x5'));var qs=require(_0xc5e6('0x6'));var pdf=require(_0xc5e6('0x7'));var logger=require(_0xc5e6('0x8'))('api');var config=require('../../config/environment');var db=require(_0xc5e6('0x9'))['db'];config[_0xc5e6('0xa')]=_[_0xc5e6('0xb')](config['redis'],{'host':_0xc5e6('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc5e6('0xa')]));require(_0xc5e6('0xd'))['register'](socket);function respondWithStatusCode(_0x26337f,_0x22eb1b){_0x22eb1b=_0x22eb1b||0xcc;return function(_0x137bfc){if(_0x137bfc){return _0x26337f[_0xc5e6('0xe')](_0x22eb1b);}return _0x26337f[_0xc5e6('0xf')](_0x22eb1b)[_0xc5e6('0x10')]();};}function respondWithResult(_0xee8bdc,_0x37a583){_0x37a583=_0x37a583||0xc8;return function(_0x35a532){if(_0x35a532){return _0xee8bdc[_0xc5e6('0xf')](_0x37a583)[_0xc5e6('0x11')](_0x35a532);}};}function respondWithFilteredResult(_0x411669,_0x315d97){return function(_0x3aef03){if(_0x3aef03){var _0x1fa057=typeof _0x315d97['offset']===_0xc5e6('0x12')&&typeof _0x315d97[_0xc5e6('0x13')]===_0xc5e6('0x12');var _0x2ff74a=_0x3aef03['count'];var _0x4c5a59=_0x1fa057?0x0:_0x315d97['offset'];var _0x1c8f3c=_0x1fa057?_0x3aef03[_0xc5e6('0x14')]:_0x315d97[_0xc5e6('0x15')]+_0x315d97[_0xc5e6('0x13')];var _0x39d600;if(_0x1c8f3c>=_0x2ff74a){_0x1c8f3c=_0x2ff74a;_0x39d600=0xc8;}else{_0x39d600=0xce;}_0x411669[_0xc5e6('0xf')](_0x39d600);return _0x411669[_0xc5e6('0x16')](_0xc5e6('0x17'),_0x4c5a59+'-'+_0x1c8f3c+'/'+_0x2ff74a)[_0xc5e6('0x11')](_0x3aef03);}return null;};}function saveUpdates(_0x59327a){return function(_0x1a72e4){if(_0x1a72e4){return _0x1a72e4[_0xc5e6('0x18')](_0x59327a)['then'](function(_0x30a58e){return _0x30a58e;});}return null;};}function removeEntity(_0x58c0ab){return function(_0x5cb227){if(_0x5cb227){return _0x5cb227['destroy']()[_0xc5e6('0x19')](function(){_0x58c0ab[_0xc5e6('0xf')](0xcc)[_0xc5e6('0x10')]();});}};}function handleEntityNotFound(_0x1a92de){return function(_0x563c3b){if(!_0x563c3b){_0x1a92de[_0xc5e6('0xe')](0x194);}return _0x563c3b;};}function handleError(_0x1824b6,_0x5885da){_0x5885da=_0x5885da||0x1f4;return function(_0x1e4b56){logger[_0xc5e6('0x1a')](_0x1e4b56[_0xc5e6('0x1b')]);if(_0x1e4b56[_0xc5e6('0x1c')]){delete _0x1e4b56[_0xc5e6('0x1c')];}_0x1824b6[_0xc5e6('0xf')](_0x5885da)[_0xc5e6('0x1d')](_0x1e4b56);};}exports[_0xc5e6('0x1e')]=function(_0x41b451,_0x5ecb0c){var _0x522fda={};var _0x5ec880=_[_0xc5e6('0x1f')](db[_0xc5e6('0x20')]['rawAttributes'],function(_0x2e71e6){return{'name':_0x2e71e6['fieldName'],'type':_0x2e71e6[_0xc5e6('0x21')][_0xc5e6('0x22')]};});_0x522fda=qs[_0xc5e6('0x23')](_0x5ec880,_0x41b451);return interaction['findAll'](_0xc5e6('0x24'),_0x41b451[_0xc5e6('0x25')],_0x41b451[_0xc5e6('0x26')],_0x522fda,_0x5ec880)['then'](respondWithFilteredResult(_0x5ecb0c,_0x522fda))[_0xc5e6('0x27')](handleError(_0x5ecb0c,null));};exports[_0xc5e6('0x28')]=function(_0x2fbe88,_0x401f44){var _0x18acfb={};if(_0x2fbe88[_0xc5e6('0x25')][_0xc5e6('0x21')]&&_0x2fbe88[_0xc5e6('0x25')][_0xc5e6('0x21')]==='from'){_0x18acfb[_0xc5e6('0x29')]=_0x2fbe88[_0xc5e6('0x2a')]['id'];}else{_0x18acfb['id']=_0x2fbe88[_0xc5e6('0x2a')]['id'];}var _0x3c6d07={'raw':![],'where':_0x18acfb},_0x23fc36={};_0x23fc36[_0xc5e6('0x2b')]=_['keys'](db[_0xc5e6('0x20')][_0xc5e6('0x2c')]);_0x23fc36[_0xc5e6('0x25')]=_[_0xc5e6('0x2d')](_0x2fbe88['query']);_0x23fc36['filters']=_[_0xc5e6('0x2e')](_0x23fc36[_0xc5e6('0x2b')],_0x23fc36[_0xc5e6('0x25')]);_0x3c6d07[_0xc5e6('0x2f')]=_['intersection'](_0x23fc36[_0xc5e6('0x2b')],qs[_0xc5e6('0x30')](_0x2fbe88[_0xc5e6('0x25')]['fields']));_0x3c6d07[_0xc5e6('0x2f')]=_0x3c6d07['attributes'][_0xc5e6('0x31')]?_0x3c6d07[_0xc5e6('0x2f')]:_0x23fc36['model'];if(_0x2fbe88[_0xc5e6('0x25')]['includeAll']){_0x3c6d07[_0xc5e6('0x32')]=[{'all':!![]}];}_0x3c6d07=_[_0xc5e6('0x33')]({},_0x3c6d07,_0x2fbe88[_0xc5e6('0x34')]);return db['OpenchannelInteraction'][_0xc5e6('0x35')](_0x3c6d07)[_0xc5e6('0x19')](handleEntityNotFound(_0x401f44,null))['then'](respondWithResult(_0x401f44,null))[_0xc5e6('0x27')](handleError(_0x401f44,null));};exports['create']=function(_0x48750d,_0x2a6d53){return db[_0xc5e6('0x20')][_0xc5e6('0x36')](_0x48750d[_0xc5e6('0x37')],{})['then'](respondWithResult(_0x2a6d53,0xc9))[_0xc5e6('0x27')](handleError(_0x2a6d53,null));};exports[_0xc5e6('0x18')]=function(_0x561af2,_0x336100){if(_0x561af2['body']['id']){delete _0x561af2[_0xc5e6('0x37')]['id'];}return db[_0xc5e6('0x20')][_0xc5e6('0x35')]({'where':{'id':_0x561af2['params']['id']}})['then'](handleEntityNotFound(_0x336100,null))['then'](saveUpdates(_0x561af2['body'],null))['then'](respondWithResult(_0x336100,null))[_0xc5e6('0x27')](handleError(_0x336100,null));};exports[_0xc5e6('0x38')]=function(_0x228f47,_0x1b417c){return db[_0xc5e6('0x20')]['find']({'where':{'id':_0x228f47['params']['id']}})[_0xc5e6('0x19')](handleEntityNotFound(_0x1b417c,null))[_0xc5e6('0x19')](removeEntity(_0x1b417c,null))[_0xc5e6('0x27')](handleError(_0x1b417c,null));};exports['describe']=function(_0x572cbc,_0x22236b){return db[_0xc5e6('0x20')]['describe']()[_0xc5e6('0x19')](respondWithResult(_0x22236b,null))[_0xc5e6('0x27')](handleError(_0x22236b,null));};exports[_0xc5e6('0x39')]=function(_0x4df199,_0x255b46){return db['OpenchannelMessage'][_0xc5e6('0x35')]({'where':{'id':_0x4df199[_0xc5e6('0x2a')]['id']}})[_0xc5e6('0x19')](handleEntityNotFound(_0x255b46,null))[_0xc5e6('0x19')](function(_0x1fd459){if(_0x1fd459){return _0x1fd459[_0xc5e6('0x39')](_0x4df199[_0xc5e6('0x37')]['ids'],_[_0xc5e6('0x3a')](_0x4df199[_0xc5e6('0x37')],[_0xc5e6('0x3b'),'id'])||{});}})[_0xc5e6('0x19')](respondWithResult(_0x255b46,null))['catch'](handleError(_0x255b46,null));};exports[_0xc5e6('0x3c')]=function(_0x592e1d,_0x41d3a7){var _0x2e5867={'raw':![],'where':{}};var _0x4c466b={};var _0x21ead6={'count':0x0,'rows':[]};return db[_0xc5e6('0x20')][_0xc5e6('0x3d')]({'where':{'id':_0x592e1d['params']['id']}})['then'](handleEntityNotFound(_0x41d3a7,null))[_0xc5e6('0x19')](function(_0x1d7ba5){if(_0x1d7ba5){_0x4c466b['model']=_[_0xc5e6('0x2d')](db[_0xc5e6('0x3e')][_0xc5e6('0x2c')]);_0x4c466b['query']=_['keys'](_0x592e1d[_0xc5e6('0x25')]);_0x4c466b[_0xc5e6('0x3f')]=_[_0xc5e6('0x2e')](_0x4c466b[_0xc5e6('0x2b')],_0x4c466b[_0xc5e6('0x25')]);_0x2e5867[_0xc5e6('0x2f')]=_[_0xc5e6('0x2e')](_0x4c466b[_0xc5e6('0x2b')],qs[_0xc5e6('0x30')](_0x592e1d[_0xc5e6('0x25')]['fields']));_0x2e5867[_0xc5e6('0x2f')]=_0x2e5867[_0xc5e6('0x2f')][_0xc5e6('0x31')]?_0x2e5867[_0xc5e6('0x2f')]:_0x4c466b[_0xc5e6('0x2b')];if(!_0x592e1d[_0xc5e6('0x25')]['hasOwnProperty']('nolimit')){_0x2e5867[_0xc5e6('0x13')]=qs[_0xc5e6('0x13')](_0x592e1d['query']['limit']);_0x2e5867[_0xc5e6('0x15')]=qs['offset'](_0x592e1d[_0xc5e6('0x25')][_0xc5e6('0x15')]);}_0x2e5867[_0xc5e6('0x40')]=qs[_0xc5e6('0x41')](_0x592e1d[_0xc5e6('0x25')]['sort']);_0x2e5867[_0xc5e6('0x42')]=qs[_0xc5e6('0x3f')](_[_0xc5e6('0x43')](_0x592e1d[_0xc5e6('0x25')],_0x4c466b[_0xc5e6('0x3f')]));_0x2e5867[_0xc5e6('0x42')][_0xc5e6('0x44')]=_0x1d7ba5['id'];if(_0x592e1d[_0xc5e6('0x25')][_0xc5e6('0x45')]){_0x2e5867['where']=_[_0xc5e6('0x33')](_0x2e5867[_0xc5e6('0x42')],{'$or':_['map'](_0x2e5867[_0xc5e6('0x2f')],function(_0xcfc18f){var _0x5917fd={};_0x5917fd[_0xcfc18f]={'$like':'%'+_0x592e1d[_0xc5e6('0x25')][_0xc5e6('0x45')]+'%'};return _0x5917fd;})});}if(_0x592e1d[_0xc5e6('0x25')][_0xc5e6('0x46')]){var _0x1a4eec=_0x592e1d[_0xc5e6('0x25')][_0xc5e6('0x46')][_0xc5e6('0x47')](',');var _0x3b5f89={};_0x3b5f89[_0x1a4eec[0x0]]={'$gte':moment(_0x1a4eec[0x1])[_0xc5e6('0x48')](_0xc5e6('0x49'))};_0x2e5867[_0xc5e6('0x42')]=_['merge'](_0x2e5867[_0xc5e6('0x42')],_0x3b5f89);}_0x2e5867=_[_0xc5e6('0x33')]({},_0x2e5867,_0x592e1d[_0xc5e6('0x34')]);return db['OpenchannelMessage'][_0xc5e6('0x14')]({'where':_0x2e5867[_0xc5e6('0x42')]})[_0xc5e6('0x19')](function(_0x32cdd0){_0x21ead6['count']=_0x32cdd0;if(_0x592e1d[_0xc5e6('0x25')][_0xc5e6('0x4a')]){_0x2e5867[_0xc5e6('0x32')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0xc5e6('0x4b')](_0x2e5867);})[_0xc5e6('0x19')](function(_0x58340c){_0x21ead6[_0xc5e6('0x4c')]=_0x58340c;return _0x21ead6;});}})[_0xc5e6('0x19')](respondWithFilteredResult(_0x41d3a7,_0x2e5867))[_0xc5e6('0x27')](handleError(_0x41d3a7,null));};exports['addTags']=function(_0x4cb326,_0x40cf07){return db[_0xc5e6('0x20')][_0xc5e6('0x35')]({'where':{'id':_0x4cb326[_0xc5e6('0x2a')]['id']}})[_0xc5e6('0x19')](handleEntityNotFound(_0x40cf07,null))[_0xc5e6('0x19')](function(_0x54d1cf){if(_0x54d1cf){return _0x54d1cf[_0xc5e6('0x4d')](_0x4cb326[_0xc5e6('0x37')][_0xc5e6('0x3b')],_['omit'](_0x4cb326[_0xc5e6('0x37')],[_0xc5e6('0x3b'),'id'])||{})[_0xc5e6('0x4e')](function(){return db[_0xc5e6('0x4f')]['findAll']({'attributes':['id',_0xc5e6('0x1c'),_0xc5e6('0x50')],'where':{'id':_0x4cb326['body']['ids']}});})[_0xc5e6('0x19')](function(_0x1ce17b){socket[_0xc5e6('0x51')](_0xc5e6('0x52'),{'id':Number(_0x4cb326[_0xc5e6('0x2a')]['id']),'tags':_0x1ce17b||[]});return{'id':Number(_0x4cb326[_0xc5e6('0x2a')]['id']),'tags':_0x1ce17b||[]};});}})[_0xc5e6('0x19')](respondWithResult(_0x40cf07,null))[_0xc5e6('0x27')](handleError(_0x40cf07,null));};exports[_0xc5e6('0x53')]=function(_0x145720,_0xb9e32b){return db[_0xc5e6('0x20')][_0xc5e6('0x35')]({'where':{'id':_0x145720['params']['id']}})[_0xc5e6('0x19')](handleEntityNotFound(_0xb9e32b,null))[_0xc5e6('0x19')](function(_0x26ec37){if(_0x26ec37){return _0x26ec37[_0xc5e6('0x53')](_0x145720[_0xc5e6('0x25')][_0xc5e6('0x3b')]);}})['then'](respondWithStatusCode(_0xb9e32b,null))[_0xc5e6('0x27')](handleError(_0xb9e32b,null));};exports[_0xc5e6('0x54')]=function(_0x2b6c38,_0x2ede5f){var _0x52665b=moment()[_0xc5e6('0x55')]()['toString']();var _0x2d0a62=path['join'](config[_0xc5e6('0x56')],'server',_0xc5e6('0x57'),'tmp');var _0x1c1ba6=path['join'](config[_0xc5e6('0x56')],_0xc5e6('0x58'),_0xc5e6('0x57'),'attachments');var _0x43290b=path['join'](_0x2d0a62,_0x52665b);var _0x4d2a2e=util[_0xc5e6('0x48')]('transcript-%d-%s.zip',_0x2b6c38[_0xc5e6('0x2a')]['id'],_0x52665b);var _0x43aeb9=path[_0xc5e6('0x59')](_0x2d0a62,_0x4d2a2e);var _0x23df23=[];_0x23df23['push']({'model':db[_0xc5e6('0x5a')],'as':'User','attributes':['id',_0xc5e6('0x5b')],'raw':!![]});_0x23df23['push']({'model':db[_0xc5e6('0x5c')],'as':'Contact','attributes':['id',_0xc5e6('0x5d'),_0xc5e6('0x5e')],'raw':!![]});if(_0x2b6c38[_0xc5e6('0x25')]['attachments']){_0x23df23['push']({'model':db[_0xc5e6('0x5f')],'as':'Attachment','raw':!![]});}var _0x8dd8e1=[{'model':db[_0xc5e6('0x3e')],'as':_0xc5e6('0x60'),'attributes':['id',_0xc5e6('0x37'),_0xc5e6('0x61'),'direction',_0xc5e6('0x62'),_0xc5e6('0x63')],'include':_0x23df23}];_0x8dd8e1[_0xc5e6('0x64')]({'model':db['OpenchannelAccount'],'as':_0xc5e6('0x65'),'attributes':['id',_0xc5e6('0x1c')]});_0x8dd8e1[_0xc5e6('0x64')]({'model':db['User'],'as':'Owner','attributes':['id',_0xc5e6('0x5b')]});return db[_0xc5e6('0x20')][_0xc5e6('0x35')]({'where':{'id':_0x2b6c38[_0xc5e6('0x2a')]['id']},'include':_0x8dd8e1})[_0xc5e6('0x19')](handleEntityNotFound(_0x2ede5f,null))['then'](function(_0x15813f){if(_0x15813f){var _0x213422=_0x15813f['get']({'plain':!![]});fs[_0xc5e6('0x66')](_0x43290b);var _0x5d1915={'channel':_0xc5e6('0x67'),'account':_0x213422[_0xc5e6('0x65')]['name'],'agent':_0x213422['Owner']?_0x213422[_0xc5e6('0x68')][_0xc5e6('0x5b')]:_0xc5e6('0x69'),'createdAt':moment(_0x213422[_0xc5e6('0x61')])[_0xc5e6('0x48')](_0xc5e6('0x49'))[_0xc5e6('0x6a')](),'closedAt':_0x213422[_0xc5e6('0x6b')]?moment(_0x213422[_0xc5e6('0x6c')])['format'](_0xc5e6('0x49'))[_0xc5e6('0x6a')]():'','disposition':_0x213422['disposition'],'visibility':_0x213422[_0xc5e6('0x6d')]?'Public':_0xc5e6('0x6e'),'messages':_(_0x213422['Messages'])['filter']({'secret':![]})[_0xc5e6('0x1f')](function(_0x13a579){if(_0x13a579[_0xc5e6('0x5f')]){var _0x27de98=path[_0xc5e6('0x59')](_0x1c1ba6,_0x13a579[_0xc5e6('0x5f')]['basename']);if(fs['existsSync'](_0x27de98)){fs[_0xc5e6('0x6f')](_0x27de98)[_0xc5e6('0x70')](fs[_0xc5e6('0x71')](path[_0xc5e6('0x59')](_0x43290b,_0x13a579[_0xc5e6('0x5f')][_0xc5e6('0x72')])));}}return{'date':moment(_0x13a579[_0xc5e6('0x61')])[_0xc5e6('0x48')](_0xc5e6('0x49'))[_0xc5e6('0x6a')](),'sender':_0x13a579['direction']===_0xc5e6('0x73')?_0x13a579[_0xc5e6('0x5a')]?_0x13a579[_0xc5e6('0x5a')][_0xc5e6('0x5b')]:_0xc5e6('0x74'):_0x13a579[_0xc5e6('0x75')][_0xc5e6('0x5d')]+(_0x13a579[_0xc5e6('0x75')][_0xc5e6('0x5e')]?'\x20'+_0x13a579['Contact'][_0xc5e6('0x5e')]:''),'body':_0x13a579[_0xc5e6('0x5f')]?_0x13a579[_0xc5e6('0x5f')][_0xc5e6('0x72')]:_0x13a579[_0xc5e6('0x37')],'direction':_0x13a579[_0xc5e6('0x76')]===_0xc5e6('0x73')?'A':'C','secret':_0x13a579[_0xc5e6('0x62')],'read':_0x13a579[_0xc5e6('0x63')],'attachment':_0x13a579[_0xc5e6('0x5f')]};})[_0xc5e6('0x77')]()};return ejs[_0xc5e6('0x78')](path['join'](config[_0xc5e6('0x56')],_0xc5e6('0x58'),_0xc5e6('0x79'),_0xc5e6('0x7a')),{'interaction':_0x5d1915})[_0xc5e6('0x19')](function(_0x1458d3){var _0x4c322d=path[_0xc5e6('0x59')](_0x43290b,_0xc5e6('0x7b')+_0x213422['id']+'-'+_0x52665b+_0xc5e6('0x7c'));var _0x162bd2={'path':_0x4c322d,'channel':_0xc5e6('0x67'),'interactionId':_0x213422['id']};return pdf['createPdfFromHTML'](_0x1458d3,_0x162bd2);})['then'](function(){return new Promise(function(_0x2488f3,_0x46c8e9){zipdir(_0x43290b,{'saveTo':_0x43aeb9},function(_0x1df71a,_0x20cd1d){if(_0x1df71a)return _0x46c8e9(_0x1df71a);return _0x2488f3(_0x20cd1d);});})[_0xc5e6('0x19')](function(){return new Promise(function(_0x1ac7d8,_0x371e0d){rimraf(_0x43290b,function(_0x399bde){if(_0x399bde)_0x371e0d(_0x399bde);return _0x1ac7d8();});});})[_0xc5e6('0x19')](function(){return _0x2ede5f['download'](_0x43aeb9,_0x4d2a2e,function(_0x2ee4fb){if(_0x2ee4fb){logger[_0xc5e6('0x1a')](_0xc5e6('0x7d'),_0x2ee4fb);}else{fs['unlinkSync'](_0x43aeb9);}});});});}else{return _0x2ede5f[_0xc5e6('0xe')](0xc8);}})['catch'](handleError(_0x2ede5f,null));}; \ No newline at end of file +var _0x317e=['set','update','then','destroy','error','stack','name','send','rawAttributes','fieldName','type','key','findAll','openchannel','user','catch','show','query','from','params','model','keys','OpenchannelInteraction','intersection','attributes','fields','includeAll','include','options','find','create','body','describe','addMessage','ids','omit','getMessages','findOne','OpenchannelMessage','filters','hasOwnProperty','nolimit','sort','where','pick','OpenchannelInteractionId','filter','merge','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','join','server','files','tmp','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','firstName','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','Owner','mkdirSync','closed','closedAt','disposition','threadId','Public','createReadStream','pipe','createWriteStream','basename','out','System','Contact','lastName','direction','value','renderFile','root','downloadInteraction.ejs','transcript-','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit'];(function(_0x5c3aea,_0x15b367){var _0x3f8152=function(_0x2ab22e){while(--_0x2ab22e){_0x5c3aea['push'](_0x5c3aea['shift']());}};_0x3f8152(++_0x15b367);}(_0x317e,0x6b));var _0xe317=function(_0x999b85,_0x1edc2b){_0x999b85=_0x999b85-0x0;var _0x1d7124=_0x317e[_0x999b85];return _0x1d7124;};'use strict';var rimraf=require(_0xe317('0x0'));var zipdir=require('zip-dir');var moment=require(_0xe317('0x1'));var util=require(_0xe317('0x2'));var path=require(_0xe317('0x3'));var ejs=require(_0xe317('0x4'));var fs=require('fs');var _=require(_0xe317('0x5'));var Redis=require(_0xe317('0x6'));var interaction=require(_0xe317('0x7'));var qs=require(_0xe317('0x8'));var pdf=require('../../components/export/pdf');var logger=require(_0xe317('0x9'))(_0xe317('0xa'));var config=require(_0xe317('0xb'));var db=require(_0xe317('0xc'))['db'];config[_0xe317('0xd')]=_[_0xe317('0xe')](config[_0xe317('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xe317('0xf'))(new Redis(config['redis']));require(_0xe317('0x10'))[_0xe317('0x11')](socket);function respondWithStatusCode(_0x58575f,_0x3c48ca){_0x3c48ca=_0x3c48ca||0xcc;return function(_0x5c3834){if(_0x5c3834){return _0x58575f[_0xe317('0x12')](_0x3c48ca);}return _0x58575f[_0xe317('0x13')](_0x3c48ca)[_0xe317('0x14')]();};}function respondWithResult(_0x3e3560,_0x5860ba){_0x5860ba=_0x5860ba||0xc8;return function(_0x1991a3){if(_0x1991a3){return _0x3e3560[_0xe317('0x13')](_0x5860ba)[_0xe317('0x15')](_0x1991a3);}};}function respondWithFilteredResult(_0x44fb99,_0x1c3c39){return function(_0x4c8f3f){if(_0x4c8f3f){var _0x1c49ca=typeof _0x1c3c39[_0xe317('0x16')]===_0xe317('0x17')&&typeof _0x1c3c39['limit']===_0xe317('0x17');var _0x956642=_0x4c8f3f['count'];var _0x204824=_0x1c49ca?0x0:_0x1c3c39[_0xe317('0x16')];var _0x42d03f=_0x1c49ca?_0x4c8f3f[_0xe317('0x18')]:_0x1c3c39[_0xe317('0x16')]+_0x1c3c39[_0xe317('0x19')];var _0x2dfbfa;if(_0x42d03f>=_0x956642){_0x42d03f=_0x956642;_0x2dfbfa=0xc8;}else{_0x2dfbfa=0xce;}_0x44fb99['status'](_0x2dfbfa);return _0x44fb99[_0xe317('0x1a')]('Content-Range',_0x204824+'-'+_0x42d03f+'/'+_0x956642)[_0xe317('0x15')](_0x4c8f3f);}return null;};}function saveUpdates(_0x20cb7e){return function(_0x3e612d){if(_0x3e612d){return _0x3e612d[_0xe317('0x1b')](_0x20cb7e)[_0xe317('0x1c')](function(_0x2a281b){return _0x2a281b;});}return null;};}function removeEntity(_0x9a990e){return function(_0x55e038){if(_0x55e038){return _0x55e038[_0xe317('0x1d')]()[_0xe317('0x1c')](function(){_0x9a990e[_0xe317('0x13')](0xcc)[_0xe317('0x14')]();});}};}function handleEntityNotFound(_0x5c27ae){return function(_0xdccf15){if(!_0xdccf15){_0x5c27ae[_0xe317('0x12')](0x194);}return _0xdccf15;};}function handleError(_0x32596c,_0x51add3){_0x51add3=_0x51add3||0x1f4;return function(_0x58e005){logger[_0xe317('0x1e')](_0x58e005[_0xe317('0x1f')]);if(_0x58e005[_0xe317('0x20')]){delete _0x58e005[_0xe317('0x20')];}_0x32596c[_0xe317('0x13')](_0x51add3)[_0xe317('0x21')](_0x58e005);};}exports['index']=function(_0x291175,_0x3e7c36){var _0x56f9fe={};var _0x4fa1b6=_['map'](db['OpenchannelInteraction'][_0xe317('0x22')],function(_0x13d9de){return{'name':_0x13d9de[_0xe317('0x23')],'type':_0x13d9de[_0xe317('0x24')][_0xe317('0x25')]};});_0x56f9fe=qs['getOptions'](_0x4fa1b6,_0x291175);return interaction[_0xe317('0x26')](_0xe317('0x27'),_0x291175['query'],_0x291175[_0xe317('0x28')],_0x56f9fe,_0x4fa1b6)[_0xe317('0x1c')](respondWithFilteredResult(_0x3e7c36,_0x56f9fe))[_0xe317('0x29')](handleError(_0x3e7c36,null));};exports[_0xe317('0x2a')]=function(_0x254e30,_0xcdaeab){var _0x148d8a={};if(_0x254e30[_0xe317('0x2b')][_0xe317('0x24')]&&_0x254e30[_0xe317('0x2b')]['type']===_0xe317('0x2c')){_0x148d8a[_0xe317('0x2c')]=_0x254e30[_0xe317('0x2d')]['id'];}else{_0x148d8a['id']=_0x254e30[_0xe317('0x2d')]['id'];}var _0x1201e7={'raw':![],'where':_0x148d8a},_0x24727d={};_0x24727d[_0xe317('0x2e')]=_[_0xe317('0x2f')](db[_0xe317('0x30')][_0xe317('0x22')]);_0x24727d[_0xe317('0x2b')]=_['keys'](_0x254e30['query']);_0x24727d['filters']=_[_0xe317('0x31')](_0x24727d[_0xe317('0x2e')],_0x24727d[_0xe317('0x2b')]);_0x1201e7[_0xe317('0x32')]=_[_0xe317('0x31')](_0x24727d[_0xe317('0x2e')],qs[_0xe317('0x33')](_0x254e30[_0xe317('0x2b')][_0xe317('0x33')]));_0x1201e7[_0xe317('0x32')]=_0x1201e7[_0xe317('0x32')]['length']?_0x1201e7[_0xe317('0x32')]:_0x24727d[_0xe317('0x2e')];if(_0x254e30[_0xe317('0x2b')][_0xe317('0x34')]){_0x1201e7[_0xe317('0x35')]=[{'all':!![]}];}_0x1201e7=_['merge']({},_0x1201e7,_0x254e30[_0xe317('0x36')]);return db['OpenchannelInteraction'][_0xe317('0x37')](_0x1201e7)[_0xe317('0x1c')](handleEntityNotFound(_0xcdaeab,null))['then'](respondWithResult(_0xcdaeab,null))['catch'](handleError(_0xcdaeab,null));};exports['create']=function(_0x286e39,_0x503014){return db[_0xe317('0x30')][_0xe317('0x38')](_0x286e39['body'],{})['then'](respondWithResult(_0x503014,0xc9))[_0xe317('0x29')](handleError(_0x503014,null));};exports['update']=function(_0x46c931,_0x246796){if(_0x46c931[_0xe317('0x39')]['id']){delete _0x46c931['body']['id'];}return db[_0xe317('0x30')][_0xe317('0x37')]({'where':{'id':_0x46c931['params']['id']}})[_0xe317('0x1c')](handleEntityNotFound(_0x246796,null))['then'](saveUpdates(_0x46c931[_0xe317('0x39')],null))[_0xe317('0x1c')](respondWithResult(_0x246796,null))[_0xe317('0x29')](handleError(_0x246796,null));};exports[_0xe317('0x1d')]=function(_0x4f74ea,_0xc56b92){return db[_0xe317('0x30')][_0xe317('0x37')]({'where':{'id':_0x4f74ea['params']['id']}})[_0xe317('0x1c')](handleEntityNotFound(_0xc56b92,null))[_0xe317('0x1c')](removeEntity(_0xc56b92,null))[_0xe317('0x29')](handleError(_0xc56b92,null));};exports[_0xe317('0x3a')]=function(_0x387f02,_0x50e940){return db[_0xe317('0x30')][_0xe317('0x3a')]()[_0xe317('0x1c')](respondWithResult(_0x50e940,null))[_0xe317('0x29')](handleError(_0x50e940,null));};exports[_0xe317('0x3b')]=function(_0x495fea,_0x2074bf){return db['OpenchannelMessage']['find']({'where':{'id':_0x495fea[_0xe317('0x2d')]['id']}})[_0xe317('0x1c')](handleEntityNotFound(_0x2074bf,null))['then'](function(_0x29d93a){if(_0x29d93a){return _0x29d93a['addMessage'](_0x495fea[_0xe317('0x39')][_0xe317('0x3c')],_[_0xe317('0x3d')](_0x495fea['body'],[_0xe317('0x3c'),'id'])||{});}})[_0xe317('0x1c')](respondWithResult(_0x2074bf,null))['catch'](handleError(_0x2074bf,null));};exports[_0xe317('0x3e')]=function(_0x8b40a8,_0x59f73d){var _0x12259b={'raw':![],'where':{}};var _0x4ae973={};var _0x3177bb={'count':0x0,'rows':[]};return db[_0xe317('0x30')][_0xe317('0x3f')]({'where':{'id':_0x8b40a8[_0xe317('0x2d')]['id']}})[_0xe317('0x1c')](handleEntityNotFound(_0x59f73d,null))['then'](function(_0x400842){if(_0x400842){_0x4ae973[_0xe317('0x2e')]=_[_0xe317('0x2f')](db[_0xe317('0x40')][_0xe317('0x22')]);_0x4ae973[_0xe317('0x2b')]=_[_0xe317('0x2f')](_0x8b40a8['query']);_0x4ae973[_0xe317('0x41')]=_['intersection'](_0x4ae973[_0xe317('0x2e')],_0x4ae973['query']);_0x12259b['attributes']=_['intersection'](_0x4ae973[_0xe317('0x2e')],qs[_0xe317('0x33')](_0x8b40a8[_0xe317('0x2b')][_0xe317('0x33')]));_0x12259b[_0xe317('0x32')]=_0x12259b['attributes']['length']?_0x12259b[_0xe317('0x32')]:_0x4ae973['model'];if(!_0x8b40a8[_0xe317('0x2b')][_0xe317('0x42')](_0xe317('0x43'))){_0x12259b['limit']=qs[_0xe317('0x19')](_0x8b40a8[_0xe317('0x2b')][_0xe317('0x19')]);_0x12259b[_0xe317('0x16')]=qs[_0xe317('0x16')](_0x8b40a8[_0xe317('0x2b')]['offset']);}_0x12259b['order']=qs[_0xe317('0x44')](_0x8b40a8['query'][_0xe317('0x44')]);_0x12259b[_0xe317('0x45')]=qs['filters'](_[_0xe317('0x46')](_0x8b40a8[_0xe317('0x2b')],_0x4ae973[_0xe317('0x41')]));_0x12259b[_0xe317('0x45')][_0xe317('0x47')]=_0x400842['id'];if(_0x8b40a8['query'][_0xe317('0x48')]){_0x12259b[_0xe317('0x45')]=_[_0xe317('0x49')](_0x12259b[_0xe317('0x45')],{'$or':_['map'](_0x12259b[_0xe317('0x32')],function(_0x6ff752){var _0x5cbe77={};_0x5cbe77[_0x6ff752]={'$like':'%'+_0x8b40a8[_0xe317('0x2b')][_0xe317('0x48')]+'%'};return _0x5cbe77;})});}if(_0x8b40a8[_0xe317('0x2b')][_0xe317('0x4a')]){var _0x3592dd=_0x8b40a8['query']['$gte'][_0xe317('0x4b')](',');var _0x25d864={};_0x25d864[_0x3592dd[0x0]]={'$gte':moment(_0x3592dd[0x1])[_0xe317('0x4c')](_0xe317('0x4d'))};_0x12259b[_0xe317('0x45')]=_[_0xe317('0x49')](_0x12259b[_0xe317('0x45')],_0x25d864);}_0x12259b=_[_0xe317('0x49')]({},_0x12259b,_0x8b40a8[_0xe317('0x36')]);return db['OpenchannelMessage']['count']({'where':_0x12259b['where']})[_0xe317('0x1c')](function(_0x575a55){_0x3177bb[_0xe317('0x18')]=_0x575a55;if(_0x8b40a8[_0xe317('0x2b')][_0xe317('0x34')]){_0x12259b['include']=[{'all':!![]}];}return db[_0xe317('0x40')][_0xe317('0x26')](_0x12259b);})['then'](function(_0x64856){_0x3177bb[_0xe317('0x4e')]=_0x64856;return _0x3177bb;});}})['then'](respondWithFilteredResult(_0x59f73d,_0x12259b))[_0xe317('0x29')](handleError(_0x59f73d,null));};exports[_0xe317('0x4f')]=function(_0x25db33,_0x59ffd9){return db[_0xe317('0x30')]['find']({'where':{'id':_0x25db33[_0xe317('0x2d')]['id']}})['then'](handleEntityNotFound(_0x59ffd9,null))[_0xe317('0x1c')](function(_0x97c3f2){if(_0x97c3f2){return _0x97c3f2[_0xe317('0x50')](_0x25db33[_0xe317('0x39')]['ids'],_[_0xe317('0x3d')](_0x25db33[_0xe317('0x39')],[_0xe317('0x3c'),'id'])||{})[_0xe317('0x51')](function(){return db[_0xe317('0x52')]['findAll']({'attributes':['id','name',_0xe317('0x53')],'where':{'id':_0x25db33['body'][_0xe317('0x3c')]}});})[_0xe317('0x1c')](function(_0x1a0869){socket[_0xe317('0x54')]('openchannelInteractionTags:save',{'id':Number(_0x25db33[_0xe317('0x2d')]['id']),'tags':_0x1a0869||[]});return{'id':Number(_0x25db33['params']['id']),'tags':_0x1a0869||[]};});}})[_0xe317('0x1c')](respondWithResult(_0x59ffd9,null))['catch'](handleError(_0x59ffd9,null));};exports[_0xe317('0x55')]=function(_0x3a58e9,_0x78e9ac){return db[_0xe317('0x30')][_0xe317('0x37')]({'where':{'id':_0x3a58e9[_0xe317('0x2d')]['id']}})['then'](handleEntityNotFound(_0x78e9ac,null))[_0xe317('0x1c')](function(_0x45d5da){if(_0x45d5da){return _0x45d5da[_0xe317('0x55')](_0x3a58e9['query'][_0xe317('0x3c')]);}})[_0xe317('0x1c')](respondWithStatusCode(_0x78e9ac,null))[_0xe317('0x29')](handleError(_0x78e9ac,null));};exports[_0xe317('0x56')]=function(_0x16da29,_0x40af55){var _0x927291=moment()[_0xe317('0x57')]()[_0xe317('0x58')]();var _0x150221=path[_0xe317('0x59')](config['root'],_0xe317('0x5a'),_0xe317('0x5b'),_0xe317('0x5c'));var _0xa6df91=path[_0xe317('0x59')](config['root'],_0xe317('0x5a'),'files',_0xe317('0x5d'));var _0x40bd26=path[_0xe317('0x59')](_0x150221,_0x927291);var _0x59167f=util[_0xe317('0x4c')](_0xe317('0x5e'),_0x16da29[_0xe317('0x2d')]['id'],_0x927291);var _0x1b24f8=path[_0xe317('0x59')](_0x150221,_0x59167f);var _0x114670=[];_0x114670[_0xe317('0x5f')]({'model':db[_0xe317('0x60')],'as':_0xe317('0x60'),'attributes':['id',_0xe317('0x61')],'raw':!![]});_0x114670[_0xe317('0x5f')]({'model':db[_0xe317('0x62')],'as':'Contact','attributes':['id',_0xe317('0x63'),'lastName'],'raw':!![]});if(_0x16da29['query']['attachments']){_0x114670['push']({'model':db[_0xe317('0x64')],'as':_0xe317('0x64'),'raw':!![]});}var _0x76f5ee=[{'model':db[_0xe317('0x40')],'as':_0xe317('0x65'),'attributes':['id','body',_0xe317('0x66'),'direction',_0xe317('0x67'),_0xe317('0x68')],'include':_0x114670}];_0x76f5ee['push']({'model':db[_0xe317('0x69')],'as':_0xe317('0x6a'),'attributes':['id',_0xe317('0x20')]});_0x76f5ee['push']({'model':db[_0xe317('0x60')],'as':_0xe317('0x6b'),'attributes':['id',_0xe317('0x61')]});return db[_0xe317('0x30')][_0xe317('0x37')]({'where':{'id':_0x16da29[_0xe317('0x2d')]['id']},'include':_0x76f5ee})[_0xe317('0x1c')](handleEntityNotFound(_0x40af55,null))[_0xe317('0x1c')](function(_0x1a7a12){if(_0x1a7a12){var _0x3e17af=_0x1a7a12['get']({'plain':!![]});fs[_0xe317('0x6c')](_0x40bd26);var _0x3977d1={'channel':'Openchannel','account':_0x3e17af[_0xe317('0x6a')][_0xe317('0x20')],'agent':_0x3e17af[_0xe317('0x6b')]?_0x3e17af[_0xe317('0x6b')][_0xe317('0x61')]:'N.A.','createdAt':moment(_0x3e17af[_0xe317('0x66')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xe317('0x58')](),'closedAt':_0x3e17af[_0xe317('0x6d')]?moment(_0x3e17af[_0xe317('0x6e')])['format'](_0xe317('0x4d'))[_0xe317('0x58')]():'','disposition':_0x3e17af[_0xe317('0x6f')],'visibility':_0x3e17af[_0xe317('0x70')]?_0xe317('0x71'):'Private','messages':_(_0x3e17af[_0xe317('0x65')])['filter']({'secret':![]})['map'](function(_0x42f009){if(_0x42f009['Attachment']){var _0x42fd2d=path[_0xe317('0x59')](_0xa6df91,_0x42f009[_0xe317('0x64')]['basename']);if(fs['existsSync'](_0x42fd2d)){fs[_0xe317('0x72')](_0x42fd2d)[_0xe317('0x73')](fs[_0xe317('0x74')](path[_0xe317('0x59')](_0x40bd26,_0x42f009[_0xe317('0x64')][_0xe317('0x75')])));}}return{'date':moment(_0x42f009['createdAt'])['format'](_0xe317('0x4d'))[_0xe317('0x58')](),'sender':_0x42f009['direction']===_0xe317('0x76')?_0x42f009['User']?_0x42f009[_0xe317('0x60')][_0xe317('0x61')]:_0xe317('0x77'):_0x42f009[_0xe317('0x78')][_0xe317('0x63')]+(_0x42f009['Contact']['lastName']?'\x20'+_0x42f009[_0xe317('0x78')][_0xe317('0x79')]:''),'body':_0x42f009[_0xe317('0x64')]?_0x42f009[_0xe317('0x64')][_0xe317('0x75')]:_0x42f009[_0xe317('0x39')],'direction':_0x42f009[_0xe317('0x7a')]===_0xe317('0x76')?'A':'C','secret':_0x42f009[_0xe317('0x67')],'read':_0x42f009[_0xe317('0x68')],'attachment':_0x42f009[_0xe317('0x64')]};})[_0xe317('0x7b')]()};return ejs[_0xe317('0x7c')](path['join'](config[_0xe317('0x7d')],_0xe317('0x5a'),'views',_0xe317('0x7e')),{'interaction':_0x3977d1})[_0xe317('0x1c')](function(_0x40e6fa){var _0x4b7032=path['join'](_0x40bd26,_0xe317('0x7f')+_0x3e17af['id']+'-'+_0x927291+_0xe317('0x80'));var _0x38dc34={'path':_0x4b7032,'channel':_0xe317('0x81'),'interactionId':_0x3e17af['id']};return pdf[_0xe317('0x82')](_0x40e6fa,_0x38dc34);})['then'](function(){return new Promise(function(_0x47ce7e,_0x2bf127){zipdir(_0x40bd26,{'saveTo':_0x1b24f8},function(_0x2b8ee2,_0x5cdc45){if(_0x2b8ee2)return _0x2bf127(_0x2b8ee2);return _0x47ce7e(_0x5cdc45);});})[_0xe317('0x1c')](function(){return new Promise(function(_0x162d5a,_0x3805d0){rimraf(_0x40bd26,function(_0x41bd18){if(_0x41bd18)_0x3805d0(_0x41bd18);return _0x162d5a();});});})[_0xe317('0x1c')](function(){return _0x40af55[_0xe317('0x56')](_0x1b24f8,_0x59167f,function(_0xcd9f2e){if(_0xcd9f2e){logger[_0xe317('0x1e')](_0xe317('0x83'),_0xcd9f2e);}else{fs[_0xe317('0x84')](_0x1b24f8);}});});});}else{return _0x40af55[_0xe317('0x12')](0xc8);}})[_0xe317('0x29')](handleError(_0x40af55,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 7eb397a..d43393a 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 _0x4174=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','OpenchannelInteraction','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','getUsers','then','setDataValue','Users','findAll'];(function(_0x4d88e9,_0x37bd4a){var _0x5299a6=function(_0x274ee5){while(--_0x274ee5){_0x4d88e9['push'](_0x4d88e9['shift']());}};_0x5299a6(++_0x37bd4a);}(_0x4174,0x124));var _0x4417=function(_0x30a28b,_0x4dc624){_0x30a28b=_0x30a28b-0x0;var _0x3786fd=_0x4174[_0x30a28b];return _0x3786fd;};'use strict';var EventEmitter=require(_0x4417('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0x4417('0x1')];var OpenchannelMessage=require(_0x4417('0x2'))['db'][_0x4417('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x4417('0x4')](0x0);var events={'afterCreate':_0x4417('0x5'),'afterUpdate':_0x4417('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4ee719){return function(_0x29f397,_0x34150c,_0x5d09b9){_0x29f397[_0x4417('0x7')]({'attributes':['id'],'raw':!![]})[_0x4417('0x8')](function(_0x3885c0){_0x29f397[_0x4417('0x9')](_0x4417('0xa'),_0x3885c0['map'](function(_0x30ce82){return{'id':_0x30ce82['id']};}));return OpenchannelMessage[_0x4417('0xb')]({'where':{'OpenchannelInteractionId':_0x29f397['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4417('0x8')](function(_0xd95ee0){_0x29f397['setDataValue'](_0x4417('0xc'),_0xd95ee0[_0x4417('0xd')]);OpenchannelInteractionEvents['emit'](_0x4ee719+':'+_0x29f397['id'],_0x29f397);OpenchannelInteractionEvents[_0x4417('0xe')](_0x4ee719,_0x29f397);_0x5d09b9(null);})[_0x4417('0xf')](_0x5d09b9(null));};}for(var e in events){if(events[_0x4417('0x10')](e)){var event=events[e];OpenchannelInteraction[_0x4417('0x11')](e,emitEvent(event));}}module[_0x4417('0x12')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xb107=['findAll','setDataValue','unreadMessages','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','OpenchannelInteraction','setMaxListeners','getUsers','then'];(function(_0x1f909a,_0x15d56f){var _0x543f16=function(_0x17a991){while(--_0x17a991){_0x1f909a['push'](_0x1f909a['shift']());}};_0x543f16(++_0x15d56f);}(_0xb107,0x1c2));var _0x7b10=function(_0x47fe37,_0x43cb27){_0x47fe37=_0x47fe37-0x0;var _0x8d0e01=_0xb107[_0x47fe37];return _0x8d0e01;};'use strict';var EventEmitter=require('events');var OpenchannelInteraction=require(_0x7b10('0x0'))['db'][_0x7b10('0x1')];var OpenchannelMessage=require(_0x7b10('0x0'))['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0x7b10('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x145e23){return function(_0x563280,_0x2b89c3,_0x5f0075){_0x563280[_0x7b10('0x3')]({'attributes':['id'],'raw':!![]})[_0x7b10('0x4')](function(_0x1d5104){_0x563280['setDataValue']('Users',_0x1d5104['map'](function(_0x2ca06){return{'id':_0x2ca06['id']};}));return OpenchannelMessage[_0x7b10('0x5')]({'where':{'OpenchannelInteractionId':_0x563280['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x22d194){_0x563280[_0x7b10('0x6')](_0x7b10('0x7'),_0x22d194['length']);OpenchannelInteractionEvents['emit'](_0x145e23+':'+_0x563280['id'],_0x563280);OpenchannelInteractionEvents[_0x7b10('0x8')](_0x145e23,_0x563280);_0x5f0075(null);})[_0x7b10('0x9')](_0x5f0075(null));};}for(var e in events){if(events[_0x7b10('0xa')](e)){var event=events[e];OpenchannelInteraction[_0x7b10('0xb')](e,emitEvent(event));}}module[_0x7b10('0xc')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 88b7b15..66b8326 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 _0x0b56=['rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4_unicode_ci','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','path'];(function(_0x533132,_0xf5b6fa){var _0x1a7447=function(_0x44d580){while(--_0x44d580){_0x533132['push'](_0x533132['shift']());}};_0x1a7447(++_0xf5b6fa);}(_0x0b56,0x1bb));var _0x60b5=function(_0x3f242b,_0x3c6ebc){_0x3f242b=_0x3f242b-0x0;var _0x2aa496=_0x0b56[_0x3f242b];return _0x2aa496;};'use strict';var _=require(_0x60b5('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x60b5('0x1'));var moment=require(_0x60b5('0x2'));var BPromise=require(_0x60b5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x60b5('0x4'));var rimraf=require(_0x60b5('0x5'));var config=require(_0x60b5('0x6'));var attributes=require(_0x60b5('0x7'));module[_0x60b5('0x8')]=function(_0x56fbc0,_0x38b38d){return _0x56fbc0[_0x60b5('0x9')](_0x60b5('0xa'),attributes,{'tableName':_0x60b5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x60b5('0xc'),'hooks':{'beforeUpdate':function(_0x30f339,_0x2a0c0c,_0x12bbb4){if(_0x30f339[_0x60b5('0xd')]('closed')){_0x30f339[_0x60b5('0xe')]=moment()['format'](_0x60b5('0xf'));}_0x12bbb4(null,_0x30f339);}}});}; \ No newline at end of file +var _0x8185=['bluebird','rimraf','../../config/environment','exports','define','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment'];(function(_0x32244a,_0x4f2de2){var _0x15e26b=function(_0x117e05){while(--_0x117e05){_0x32244a['push'](_0x32244a['shift']());}};_0x15e26b(++_0x4f2de2);}(_0x8185,0x188));var _0x5818=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x8185[_0x50a0c2];return _0x5ebadd;};'use strict';var _=require(_0x5818('0x0'));var util=require(_0x5818('0x1'));var logger=require(_0x5818('0x2'))('api');var moment=require(_0x5818('0x3'));var BPromise=require(_0x5818('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x5818('0x5'));var config=require(_0x5818('0x6'));var attributes=require('./openchannelInteraction.attributes');module[_0x5818('0x7')]=function(_0x58388a,_0x1af0e3){return _0x58388a[_0x5818('0x8')](_0x5818('0x9'),attributes,{'tableName':_0x5818('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5818('0xb'),'collate':_0x5818('0xc'),'hooks':{'beforeUpdate':function(_0x1921b8,_0xb40883,_0x460b7f){if(_0x1921b8[_0x5818('0xd')](_0x5818('0xe'))){_0x1921b8[_0x5818('0xf')]=moment()[_0x5818('0x10')](_0x5818('0x11'));}_0x460b7f(null,_0x1921b8);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 2358155..dee81ea 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 _0x0a4c=['OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','where','AddTagsToOpenchannelInteraction','addTags','ids','omit','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x0a4c,0x83));var _0xc0a4=function(_0xb0337,_0x3f942f){_0xb0337=_0xb0337-0x0;var _0x444c68=_0x0a4c[_0xb0337];return _0x444c68;};'use strict';var _=require(_0xc0a4('0x0'));var util=require(_0xc0a4('0x1'));var moment=require(_0xc0a4('0x2'));var BPromise=require(_0xc0a4('0x3'));var rs=require(_0xc0a4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc0a4('0x5'))['db'];var utils=require(_0xc0a4('0x6'));var logger=require(_0xc0a4('0x7'))('rpc');var config=require(_0xc0a4('0x8'));var jayson=require(_0xc0a4('0x9'));var client=jayson[_0xc0a4('0xa')]['http']({'port':0x232a});config['redis']=_[_0xc0a4('0xb')](config[_0xc0a4('0xc')],{'host':_0xc0a4('0xd'),'port':0x18eb});var socket=require(_0xc0a4('0xe'))(new Redis(config[_0xc0a4('0xc')]));require(_0xc0a4('0xf'))['register'](socket);function respondWithRpcPromise(_0x22b734,_0x537f33,_0x2d5bfb){return new BPromise(function(_0x55f516,_0x1f640d){return client[_0xc0a4('0x10')](_0x22b734,_0x2d5bfb)[_0xc0a4('0x11')](function(_0x443be4){logger[_0xc0a4('0x12')](_0xc0a4('0x13'),_0x537f33,'request\x20sent');logger[_0xc0a4('0x14')](_0xc0a4('0x15'),_0x537f33,_0xc0a4('0x16'),JSON[_0xc0a4('0x17')](_0x443be4));if(_0x443be4[_0xc0a4('0x18')]){if(_0x443be4['error']['code']===0x1f4){logger['error'](_0xc0a4('0x13'),_0x537f33,_0x443be4[_0xc0a4('0x18')][_0xc0a4('0x19')]);return _0x1f640d(_0x443be4[_0xc0a4('0x18')][_0xc0a4('0x19')]);}logger[_0xc0a4('0x18')]('OpenchannelInteraction,\x20%s,\x20%s',_0x537f33,_0x443be4[_0xc0a4('0x18')][_0xc0a4('0x19')]);return _0x55f516(_0x443be4['error'][_0xc0a4('0x19')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x537f33,_0xc0a4('0x16'));_0x55f516(_0x443be4[_0xc0a4('0x1a')][_0xc0a4('0x19')]);}})[_0xc0a4('0x1b')](function(_0x4cb9f1){logger[_0xc0a4('0x18')](_0xc0a4('0x13'),_0x537f33,_0x4cb9f1);_0x1f640d(_0x4cb9f1);});});}exports[_0xc0a4('0x1c')]=function(_0x3b65ad){var _0x1e33ab=this;return new Promise(function(_0x2b45de,_0x299fe9){return db[_0xc0a4('0x1d')]['update'](_0x3b65ad[_0xc0a4('0x1e')],{'raw':_0x3b65ad[_0xc0a4('0x1f')]?_0x3b65ad['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b65ad[_0xc0a4('0x1f')]?_0x3b65ad[_0xc0a4('0x1f')][_0xc0a4('0x20')]||null:null,'attributes':_0x3b65ad[_0xc0a4('0x1f')]?_0x3b65ad['options']['attributes']||null:null,'limit':_0x3b65ad[_0xc0a4('0x1f')]?_0x3b65ad[_0xc0a4('0x1f')]['limit']||null:null})[_0xc0a4('0x11')](function(_0x5bfe27){logger['info'](_0xc0a4('0x1c'),_0x3b65ad);logger[_0xc0a4('0x14')]('UpdateOpenchannelInteraction',_0x3b65ad,JSON[_0xc0a4('0x17')](_0x5bfe27));_0x2b45de(_0x5bfe27);})[_0xc0a4('0x1b')](function(_0x465e13){logger[_0xc0a4('0x18')](_0xc0a4('0x1c'),_0x465e13[_0xc0a4('0x19')],_0x3b65ad);_0x299fe9(_0x1e33ab[_0xc0a4('0x18')](0x1f4,_0x465e13[_0xc0a4('0x19')]));});});};exports[_0xc0a4('0x21')]=function(_0x5d7c3d){return new Promise(function(_0x5b4686,_0x1591f5){return db['OpenchannelInteraction']['find']({'where':_0x5d7c3d[_0xc0a4('0x1f')]?_0x5d7c3d[_0xc0a4('0x1f')][_0xc0a4('0x20')]||null:null})[_0xc0a4('0x11')](function(_0x2ab39b){if(_0x2ab39b){return _0x2ab39b[_0xc0a4('0x22')](_0x5d7c3d[_0xc0a4('0x1e')][_0xc0a4('0x23')],_[_0xc0a4('0x24')](_0x5d7c3d[_0xc0a4('0x1e')],[_0xc0a4('0x23'),'id'])||{});}})['spread'](function(_0x4a932f){logger[_0xc0a4('0x12')](_0xc0a4('0x25'),_0x5d7c3d);logger[_0xc0a4('0x14')](_0xc0a4('0x25'),_0x5d7c3d,JSON['stringify'](_0x4a932f));_0x5b4686(_0x4a932f);})[_0xc0a4('0x1b')](function(_0x376170){logger['error'](_0xc0a4('0x25'),_0x376170['message'],_0x5d7c3d);_0x1591f5(_this[_0xc0a4('0x18')](0x1f4,_0x376170[_0xc0a4('0x19')]));});});}; \ No newline at end of file +var _0x087f=['find','addTags','ids','omit','spread','AddTags','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','request','then','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','body','options','raw','where','attributes','limit','AddTagsToOpenchannelInteraction'];(function(_0x441b1a,_0x1a470e){var _0x13a718=function(_0x3674c5){while(--_0x3674c5){_0x441b1a['push'](_0x441b1a['shift']());}};_0x13a718(++_0x1a470e);}(_0x087f,0x1be));var _0xf087=function(_0x934c00,_0x40d18d){_0x934c00=_0x934c00-0x0;var _0x323115=_0x087f[_0x934c00];return _0x323115;};'use strict';var _=require(_0xf087('0x0'));var util=require(_0xf087('0x1'));var moment=require(_0xf087('0x2'));var BPromise=require('bluebird');var rs=require(_0xf087('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf087('0x4'))['db'];var utils=require(_0xf087('0x5'));var logger=require(_0xf087('0x6'))('rpc');var config=require(_0xf087('0x7'));var jayson=require(_0xf087('0x8'));var client=jayson[_0xf087('0x9')][_0xf087('0xa')]({'port':0x232a});config[_0xf087('0xb')]=_[_0xf087('0xc')](config[_0xf087('0xb')],{'host':_0xf087('0xd'),'port':0x18eb});var socket=require(_0xf087('0xe'))(new Redis(config[_0xf087('0xb')]));require(_0xf087('0xf'))['register'](socket);function respondWithRpcPromise(_0x4d7116,_0x4e888e,_0x58160c){return new BPromise(function(_0x508449,_0x10cf74){return client[_0xf087('0x10')](_0x4d7116,_0x58160c)[_0xf087('0x11')](function(_0x1e56a3){logger['info'](_0xf087('0x12'),_0x4e888e,_0xf087('0x13'));logger[_0xf087('0x14')](_0xf087('0x15'),_0x4e888e,_0xf087('0x13'),JSON[_0xf087('0x16')](_0x1e56a3));if(_0x1e56a3[_0xf087('0x17')]){if(_0x1e56a3[_0xf087('0x17')][_0xf087('0x18')]===0x1f4){logger[_0xf087('0x17')](_0xf087('0x12'),_0x4e888e,_0x1e56a3[_0xf087('0x17')][_0xf087('0x19')]);return _0x10cf74(_0x1e56a3[_0xf087('0x17')][_0xf087('0x19')]);}logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x4e888e,_0x1e56a3[_0xf087('0x17')]['message']);return _0x508449(_0x1e56a3['error']['message']);}else{logger[_0xf087('0x1a')](_0xf087('0x12'),_0x4e888e,_0xf087('0x13'));_0x508449(_0x1e56a3[_0xf087('0x1b')][_0xf087('0x19')]);}})[_0xf087('0x1c')](function(_0x39dc7d){logger[_0xf087('0x17')](_0xf087('0x12'),_0x4e888e,_0x39dc7d);_0x10cf74(_0x39dc7d);});});}exports[_0xf087('0x1d')]=function(_0x5c61b5){var _0x267d2c=this;return new Promise(function(_0x48e392,_0x6a9c81){return db[_0xf087('0x1e')]['update'](_0x5c61b5[_0xf087('0x1f')],{'raw':_0x5c61b5[_0xf087('0x20')]?_0x5c61b5['options'][_0xf087('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5c61b5[_0xf087('0x20')]?_0x5c61b5[_0xf087('0x20')][_0xf087('0x22')]||null:null,'attributes':_0x5c61b5[_0xf087('0x20')]?_0x5c61b5[_0xf087('0x20')][_0xf087('0x23')]||null:null,'limit':_0x5c61b5[_0xf087('0x20')]?_0x5c61b5[_0xf087('0x20')][_0xf087('0x24')]||null:null})[_0xf087('0x11')](function(_0x4b0b81){logger['info']('UpdateOpenchannelInteraction',_0x5c61b5);logger[_0xf087('0x14')]('UpdateOpenchannelInteraction',_0x5c61b5,JSON[_0xf087('0x16')](_0x4b0b81));_0x48e392(_0x4b0b81);})['catch'](function(_0x508fe2){logger['error'](_0xf087('0x1d'),_0x508fe2[_0xf087('0x19')],_0x5c61b5);_0x6a9c81(_0x267d2c[_0xf087('0x17')](0x1f4,_0x508fe2['message']));});});};exports[_0xf087('0x25')]=function(_0x49ee12){return new Promise(function(_0xca6ad1,_0x1c4069){return db[_0xf087('0x1e')][_0xf087('0x26')]({'where':_0x49ee12[_0xf087('0x20')]?_0x49ee12['options'][_0xf087('0x22')]||null:null})[_0xf087('0x11')](function(_0x5ee35a){if(_0x5ee35a){return _0x5ee35a[_0xf087('0x27')](_0x49ee12['body'][_0xf087('0x28')],_[_0xf087('0x29')](_0x49ee12['body'],[_0xf087('0x28'),'id'])||{});}})[_0xf087('0x2a')](function(_0x3a98c4){logger['info']('AddTags',_0x49ee12);logger[_0xf087('0x14')](_0xf087('0x2b'),_0x49ee12,JSON[_0xf087('0x16')](_0x3a98c4));_0xca6ad1(_0x3a98c4);})['catch'](function(_0x2a87b8){logger[_0xf087('0x17')](_0xf087('0x2b'),_0x2a87b8['message'],_0x49ee12);_0x1c4069(_this[_0xf087('0x17')](0x1f4,_0x2a87b8[_0xf087('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 15a18eb..a37a31c 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 _0xb95a=['emit','removeListener','register','length','openchannelInteraction:','./openchannelInteraction.events','save','update'];(function(_0x455b06,_0x341c4a){var _0x5e916d=function(_0xbb3a84){while(--_0xbb3a84){_0x455b06['push'](_0x455b06['shift']());}};_0x5e916d(++_0x341c4a);}(_0xb95a,0xad));var _0xab95=function(_0x9e6209,_0x2f4a4a){_0x9e6209=_0x9e6209-0x0;var _0x3ae92e=_0xb95a[_0x9e6209];return _0x3ae92e;};'use strict';var OpenchannelInteractionEvents=require(_0xab95('0x0'));var events=[_0xab95('0x1'),'remove',_0xab95('0x2')];function createListener(_0x3a4ba2,_0x3fd204){return function(_0x47d19a){_0x3fd204[_0xab95('0x3')](_0x3a4ba2,_0x47d19a);};}function removeListener(_0x4b5ff0,_0x47cec9){return function(){OpenchannelInteractionEvents[_0xab95('0x4')](_0x4b5ff0,_0x47cec9);};}exports[_0xab95('0x5')]=function(_0x4b60c4){for(var _0xe2ca4c=0x0,_0x168379=events[_0xab95('0x6')];_0xe2ca4c<_0x168379;_0xe2ca4c++){var _0x3230df=events[_0xe2ca4c];var _0x3753d1=createListener(_0xab95('0x7')+_0x3230df,_0x4b60c4);OpenchannelInteractionEvents['on'](_0x3230df,_0x3753d1);}}; \ No newline at end of file +var _0xdc62=['emit','removeListener','register','length','openchannelInteraction:','save','remove'];(function(_0x41d476,_0xf9b1d2){var _0x29f30e=function(_0x48e4dd){while(--_0x48e4dd){_0x41d476['push'](_0x41d476['shift']());}};_0x29f30e(++_0xf9b1d2);}(_0xdc62,0x1c5));var _0x2dc6=function(_0x3513fd,_0x47aa02){_0x3513fd=_0x3513fd-0x0;var _0x478188=_0xdc62[_0x3513fd];return _0x478188;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x2dc6('0x0'),_0x2dc6('0x1'),'update'];function createListener(_0x3437b0,_0x661cb8){return function(_0x1fb01a){_0x661cb8[_0x2dc6('0x2')](_0x3437b0,_0x1fb01a);};}function removeListener(_0x5c5944,_0x124ae8){return function(){OpenchannelInteractionEvents[_0x2dc6('0x3')](_0x5c5944,_0x124ae8);};}exports[_0x2dc6('0x4')]=function(_0x18ab74){for(var _0x13f465=0x0,_0x878c0e=events[_0x2dc6('0x5')];_0x13f465<_0x878c0e;_0x13f465++){var _0x1db633=events[_0x13f465];var _0x15f9ec=createListener(_0x2dc6('0x6')+_0x1db633,_0x18ab74);OpenchannelInteractionEvents['on'](_0x1db633,_0x15f9ec);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 4e78d20..165c39e 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 _0x9c44=['index','get','/describe','/:id','show','tracked','openchannel','create','put','update','accept','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelMessage.controller','isAuthenticated'];(function(_0x55e4a9,_0xdb06c2){var _0x59f50e=function(_0x131de7){while(--_0x131de7){_0x55e4a9['push'](_0x55e4a9['shift']());}};_0x59f50e(++_0xdb06c2);}(_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');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['describe']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['post']('/',auth['isAuthenticated'](),interaction[_0x49c4('0xd')](_0x49c4('0xe'),'openchannelmessage:create'),controller[_0x49c4('0xf')]);router[_0x49c4('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x49c4('0x11')]);router[_0x49c4('0x10')]('/:id/accept',auth[_0x49c4('0x7')](),controller[_0x49c4('0x12')]);router['put'](_0x49c4('0x13'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);router[_0x49c4('0x15')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x16')]);module[_0x49c4('0x17')]=router; \ No newline at end of file +var _0x70e0=['put','update','/:id/accept','accept','destroy','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelMessage.controller','isAuthenticated','describe','get','/:id','show','post','openchannel','openchannelmessage:create','create'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x70e0,0x17b));var _0x070e=function(_0x19d5a0,_0x2892a3){_0x19d5a0=_0x19d5a0-0x0;var _0x5a368b=_0x70e0[_0x19d5a0];return _0x5a368b;};'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');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x070e('0xe'),_0x070e('0xf')),controller[_0x070e('0x10')]);router[_0x070e('0x11')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x12')]);router[_0x070e('0x11')](_0x070e('0x13'),auth[_0x070e('0x8')](),controller[_0x070e('0x14')]);router['put']('/:id/reject',auth[_0x070e('0x8')](),controller['reject']);router['delete']('/:id',auth[_0x070e('0x8')](),controller[_0x070e('0x15')]);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 41f1b48..abca6de 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 _0x6cb4=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize'];(function(_0x81f000,_0x15df85){var _0x337aa2=function(_0x37f6a4){while(--_0x37f6a4){_0x81f000['push'](_0x81f000['shift']());}};_0x337aa2(++_0x15df85);}(_0x6cb4,0xff));var _0x46cb=function(_0x2ca85e,_0x3018e3){_0x2ca85e=_0x2ca85e-0x0;var _0x1cb796=_0x6cb4[_0x2ca85e];return _0x1cb796;};'use strict';var Sequelize=require(_0x46cb('0x0'));module[_0x46cb('0x1')]={'body':{'type':Sequelize[_0x46cb('0x2')](_0x46cb('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x46cb('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x46cb('0x5')]('in',_0x46cb('0x6')),'defaultValue':_0x46cb('0x6'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x46cb('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x4dd3=['exports','TEXT','BOOLEAN','out','DATE','sequelize'];(function(_0x43112d,_0x56bd6c){var _0xc37ced=function(_0x2de066){while(--_0x2de066){_0x43112d['push'](_0x43112d['shift']());}};_0xc37ced(++_0x56bd6c);}(_0x4dd3,0xf5));var _0x34dd=function(_0x491cbe,_0x45c8ba){_0x491cbe=_0x491cbe-0x0;var _0x59449d=_0x4dd3[_0x491cbe];return _0x59449d;};'use strict';var Sequelize=require(_0x34dd('0x0'));module[_0x34dd('0x1')]={'body':{'type':Sequelize[_0x34dd('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x34dd('0x3')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x34dd('0x4')),'defaultValue':_0x34dd('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0x34dd('0x5')]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x34dd('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 38e01e6..708eae5 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 _0x2378=['jayson/promise','client','http','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','includeAll','include','OpenchannelMessage','findAll','rows','params','options','find','create','body','describe','openchannel-interactions','accept','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','OpenchannelInteraction','isNil','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','stringify','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','SELECT','User','fullname','email','internal','manual','interface','channel','motionChannel','EventManager','acceptmessage','OpenchannelInteractionId','RejectMessage','rejectMessage','ContactId','SIP/%s','event','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter'];(function(_0x54dcad,_0x554f46){var _0x537c56=function(_0x48ff85){while(--_0x48ff85){_0x54dcad['push'](_0x54dcad['shift']());}};_0x537c56(++_0x554f46);}(_0x2378,0x64));var _0x8237=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x2378[_0x264b9b];return _0x4c7a0e;};'use strict';var emlformat=require(_0x8237('0x0'));var rimraf=require(_0x8237('0x1'));var zipdir=require(_0x8237('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8237('0x3'));var moment=require(_0x8237('0x4'));var BPromise=require(_0x8237('0x5'));var Mustache=require(_0x8237('0x6'));var util=require(_0x8237('0x7'));var path=require(_0x8237('0x8'));var sox=require(_0x8237('0x9'));var csv=require(_0x8237('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8237('0xb'));var squel=require(_0x8237('0xc'));var crypto=require(_0x8237('0xd'));var jsforce=require(_0x8237('0xe'));var deskjs=require(_0x8237('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8237('0x10'));var Papa=require(_0x8237('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8237('0x12'));var as=require(_0x8237('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8237('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8237('0x15'));var db=require(_0x8237('0x16'))['db'];config[_0x8237('0x17')]=_[_0x8237('0x18')](config[_0x8237('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x8237('0x19'))(new Redis(config[_0x8237('0x17')]));require('./openchannelMessage.socket')['register'](socket);var jayson=require(_0x8237('0x1a'));var client=jayson[_0x8237('0x1b')][_0x8237('0x1c')]({'port':0x232c});var client9002=jayson[_0x8237('0x1b')][_0x8237('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xb5b9fd,_0x387d62,_0x25cbcb,_0xf35eea){return new BPromise(function(_0x4f1b8c,_0x62a753){var _0xd68afe=_0xf35eea||client;return _0xd68afe['request'](_0xb5b9fd,_0x25cbcb)[_0x8237('0x1d')](function(_0x292534){logger['info'](_0x8237('0x1e'),_0x387d62,_0x8237('0x1f'));logger[_0x8237('0x20')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x387d62,'request\x20sent',JSON['stringify'](_0x292534));if(_0x292534[_0x8237('0x21')]){if(_0x292534[_0x8237('0x21')][_0x8237('0x22')]===0x1f4){logger[_0x8237('0x21')]('OpenchannelMessage,\x20%s,\x20%s',_0x387d62,_0x292534[_0x8237('0x21')][_0x8237('0x23')]);return _0x62a753(_0x292534[_0x8237('0x21')][_0x8237('0x23')]);}logger[_0x8237('0x21')](_0x8237('0x1e'),_0x387d62,_0x292534[_0x8237('0x21')][_0x8237('0x23')]);return _0x4f1b8c(_0x292534[_0x8237('0x21')][_0x8237('0x23')]);}else{logger[_0x8237('0x24')](_0x8237('0x1e'),_0x387d62,_0x8237('0x1f'));_0x4f1b8c(_0x292534['result'][_0x8237('0x23')]);}})[_0x8237('0x25')](function(_0x5a3f25){logger[_0x8237('0x21')](_0x8237('0x1e'),_0x387d62,_0x5a3f25);_0x62a753(_0x5a3f25);});});}function respondWithStatusCode(_0x138d18,_0x23a065){_0x23a065=_0x23a065||0xcc;return function(_0x5ebb56){if(_0x5ebb56){return _0x138d18[_0x8237('0x26')](_0x23a065);}return _0x138d18[_0x8237('0x27')](_0x23a065)[_0x8237('0x28')]();};}function respondWithResult(_0x46a349,_0x1c85cc){_0x1c85cc=_0x1c85cc||0xc8;return function(_0x30a522){if(_0x30a522){return _0x46a349[_0x8237('0x27')](_0x1c85cc)[_0x8237('0x29')](_0x30a522);}};}function respondWithFilteredResult(_0x3a061b,_0x264b9b){return function(_0x422153){if(_0x422153){var _0xd31884=typeof _0x264b9b[_0x8237('0x2a')]===_0x8237('0x2b')&&typeof _0x264b9b['limit']===_0x8237('0x2b');var _0x566c83=_0x422153[_0x8237('0x2c')];var _0x290e9c=_0xd31884?0x0:_0x264b9b[_0x8237('0x2a')];var _0x47ae77=_0xd31884?_0x422153[_0x8237('0x2c')]:_0x264b9b['offset']+_0x264b9b[_0x8237('0x2d')];var _0x97be51;if(_0x47ae77>=_0x566c83){_0x47ae77=_0x566c83;_0x97be51=0xc8;}else{_0x97be51=0xce;}_0x3a061b['status'](_0x97be51);return _0x3a061b[_0x8237('0x2e')](_0x8237('0x2f'),_0x290e9c+'-'+_0x47ae77+'/'+_0x566c83)[_0x8237('0x29')](_0x422153);}return null;};}function patchUpdates(_0x3ccb23){return function(_0x48f52d){try{jsonpatch[_0x8237('0x30')](_0x48f52d,_0x3ccb23,!![]);}catch(_0x4a6038){return BPromise[_0x8237('0x31')](_0x4a6038);}return _0x48f52d[_0x8237('0x32')]();};}function saveUpdates(_0x459916,_0x8922e7){return function(_0x2d8b4f){if(_0x2d8b4f){return _0x2d8b4f[_0x8237('0x33')](_0x459916)[_0x8237('0x1d')](function(_0x4d1e76){return _0x4d1e76;});}return null;};}function removeEntity(_0x526c95,_0x4ca65b){return function(_0x53403e){if(_0x53403e){return _0x53403e[_0x8237('0x34')]()[_0x8237('0x1d')](function(){_0x526c95[_0x8237('0x27')](0xcc)[_0x8237('0x28')]();});}};}function handleEntityNotFound(_0x2f4f78,_0x599125){return function(_0x1f2c5f){if(!_0x1f2c5f){_0x2f4f78['sendStatus'](0x194);}return _0x1f2c5f;};}function handleError(_0x5461b7,_0x50bc72){_0x50bc72=_0x50bc72||0x1f4;return function(_0x27d934){logger['error'](_0x27d934[_0x8237('0x35')]);if(_0x27d934[_0x8237('0x36')]){delete _0x27d934[_0x8237('0x36')];}_0x5461b7[_0x8237('0x27')](_0x50bc72)[_0x8237('0x37')](_0x27d934);};}exports[_0x8237('0x38')]=function(_0x271faf,_0x4557aa){var _0x36fc9b={},_0xbeae4c={},_0x2a9100={'count':0x0,'rows':[]};var _0x2bda6c=_[_0x8237('0x39')](db['OpenchannelMessage'][_0x8237('0x3a')],function(_0x29b4f3){return{'name':_0x29b4f3[_0x8237('0x3b')],'type':_0x29b4f3[_0x8237('0x3c')]['key']};});_0xbeae4c[_0x8237('0x3d')]=_[_0x8237('0x39')](_0x2bda6c,_0x8237('0x36'));_0xbeae4c[_0x8237('0x3e')]=_[_0x8237('0x3f')](_0x271faf[_0x8237('0x3e')]);_0xbeae4c[_0x8237('0x40')]=_[_0x8237('0x41')](_0xbeae4c['model'],_0xbeae4c['query']);_0x36fc9b[_0x8237('0x42')]=_['intersection'](_0xbeae4c[_0x8237('0x3d')],qs['fields'](_0x271faf[_0x8237('0x3e')][_0x8237('0x43')]));_0x36fc9b[_0x8237('0x42')]=_0x36fc9b[_0x8237('0x42')][_0x8237('0x44')]?_0x36fc9b[_0x8237('0x42')]:_0xbeae4c['model'];if(!_0x271faf['query'][_0x8237('0x45')]('nolimit')){_0x36fc9b[_0x8237('0x2d')]=qs['limit'](_0x271faf[_0x8237('0x3e')]['limit']);_0x36fc9b[_0x8237('0x2a')]=qs[_0x8237('0x2a')](_0x271faf[_0x8237('0x3e')][_0x8237('0x2a')]);}_0x36fc9b[_0x8237('0x46')]=qs['sort'](_0x271faf[_0x8237('0x3e')][_0x8237('0x47')]);_0x36fc9b[_0x8237('0x48')]=qs[_0x8237('0x40')](_['pick'](_0x271faf[_0x8237('0x3e')],_0xbeae4c['filters']),_0x2bda6c);if(_0x271faf['query'][_0x8237('0x49')]){_0x36fc9b[_0x8237('0x48')]=_[_0x8237('0x4a')](_0x36fc9b[_0x8237('0x48')],{'$or':_['map'](_0x2bda6c,function(_0x209a3d){if(_0x209a3d[_0x8237('0x3c')]!=='VIRTUAL'){var _0x5c3cd6={};_0x5c3cd6[_0x209a3d['name']]={'$like':'%'+_0x271faf['query'][_0x8237('0x49')]+'%'};return _0x5c3cd6;}})});}_0x36fc9b=_[_0x8237('0x4a')]({},_0x36fc9b,_0x271faf['options']);var _0xec264f={'where':_0x36fc9b[_0x8237('0x48')]};return db['OpenchannelMessage'][_0x8237('0x2c')](_0xec264f)[_0x8237('0x1d')](function(_0x5dd406){_0x2a9100[_0x8237('0x2c')]=_0x5dd406;if(_0x271faf[_0x8237('0x3e')][_0x8237('0x4b')]){_0x36fc9b[_0x8237('0x4c')]=[{'all':!![]}];}return db[_0x8237('0x4d')][_0x8237('0x4e')](_0x36fc9b);})[_0x8237('0x1d')](function(_0x5d95c9){_0x2a9100[_0x8237('0x4f')]=_0x5d95c9;return _0x2a9100;})[_0x8237('0x1d')](respondWithFilteredResult(_0x4557aa,_0x36fc9b))[_0x8237('0x25')](handleError(_0x4557aa,null));};exports['show']=function(_0x3a678a,_0x38b8b2){var _0x5e46e5={'raw':!![],'where':{'id':_0x3a678a[_0x8237('0x50')]['id']}},_0xd08f3d={};_0xd08f3d[_0x8237('0x3d')]=_[_0x8237('0x3f')](db[_0x8237('0x4d')][_0x8237('0x3a')]);_0xd08f3d[_0x8237('0x3e')]=_[_0x8237('0x3f')](_0x3a678a['query']);_0xd08f3d[_0x8237('0x40')]=_[_0x8237('0x41')](_0xd08f3d[_0x8237('0x3d')],_0xd08f3d[_0x8237('0x3e')]);_0x5e46e5[_0x8237('0x42')]=_[_0x8237('0x41')](_0xd08f3d[_0x8237('0x3d')],qs[_0x8237('0x43')](_0x3a678a[_0x8237('0x3e')][_0x8237('0x43')]));_0x5e46e5[_0x8237('0x42')]=_0x5e46e5['attributes'][_0x8237('0x44')]?_0x5e46e5['attributes']:_0xd08f3d['model'];if(_0x3a678a[_0x8237('0x3e')][_0x8237('0x4b')]){_0x5e46e5[_0x8237('0x4c')]=[{'all':!![]}];}_0x5e46e5=_[_0x8237('0x4a')]({},_0x5e46e5,_0x3a678a[_0x8237('0x51')]);return db['OpenchannelMessage'][_0x8237('0x52')](_0x5e46e5)[_0x8237('0x1d')](handleEntityNotFound(_0x38b8b2,null))[_0x8237('0x1d')](respondWithResult(_0x38b8b2,null))['catch'](handleError(_0x38b8b2,null));};exports[_0x8237('0x53')]=function(_0x332779,_0x398e06){return db[_0x8237('0x4d')]['create'](_0x332779[_0x8237('0x54')],{})[_0x8237('0x1d')](respondWithResult(_0x398e06,0xc9))[_0x8237('0x25')](handleError(_0x398e06,null));};exports[_0x8237('0x33')]=function(_0x309593,_0x4c2888){if(_0x309593['body']['id']){delete _0x309593['body']['id'];}return db[_0x8237('0x4d')][_0x8237('0x52')]({'where':{'id':_0x309593[_0x8237('0x50')]['id']}})[_0x8237('0x1d')](handleEntityNotFound(_0x4c2888,null))['then'](saveUpdates(_0x309593[_0x8237('0x54')],null))['then'](respondWithResult(_0x4c2888,null))[_0x8237('0x25')](handleError(_0x4c2888,null));};exports[_0x8237('0x34')]=function(_0x40035d,_0x1d256c){return db['OpenchannelMessage']['find']({'where':{'id':_0x40035d[_0x8237('0x50')]['id']}})['then'](handleEntityNotFound(_0x1d256c,null))[_0x8237('0x1d')](removeEntity(_0x1d256c,null))[_0x8237('0x25')](handleError(_0x1d256c,null));};exports[_0x8237('0x55')]=function(_0x17ab41,_0xa6d894){return db[_0x8237('0x4d')][_0x8237('0x55')]()[_0x8237('0x1d')](respondWithResult(_0xa6d894,null))['catch'](handleError(_0xa6d894,null));};var interaction_log=require('../../config/logger')(_0x8237('0x56'));exports[_0x8237('0x57')]=function(_0x4dc5ec,_0x30bdcc,_0x1c739d){var _0x43d077={'agent':{},'channel':_0x8237('0x58')};if(_0x4dc5ec[_0x8237('0x54')]['id']){delete _0x4dc5ec[_0x8237('0x54')]['id'];}_0x4dc5ec[_0x8237('0x54')][_0x8237('0x59')]=!![];_0x4dc5ec[_0x8237('0x54')]['readAt']=moment()[_0x8237('0x5a')](_0x8237('0x5b'));_0x4dc5ec[_0x8237('0x54')][_0x8237('0x5c')]=_0x4dc5ec[_0x8237('0x54')][_0x8237('0x5c')]||_0x4dc5ec['user']['id'];_0x43d077[_0x8237('0x5d')]['id']=_0x4dc5ec[_0x8237('0x54')]['UserId'];return db[_0x8237('0x4d')][_0x8237('0x52')]({'where':{'id':_0x4dc5ec[_0x8237('0x50')]['id'],'UserId':null}})[_0x8237('0x1d')](handleEntityNotFound(_0x30bdcc,null))[_0x8237('0x1d')](saveUpdates(_0x4dc5ec[_0x8237('0x54')],null))[_0x8237('0x1d')](function(_0x12fdb1){if(_0x12fdb1){_0x43d077['message']=_0x12fdb1[_0x8237('0x5e')]({'plain':!![]});return db[_0x8237('0x5f')][_0x8237('0x52')]({'where':{'id':_0x12fdb1['OpenchannelInteractionId']}});}return null;})[_0x8237('0x1d')](handleEntityNotFound(_0x30bdcc,null))[_0x8237('0x1d')](function(_0x28dc5f){if(_0x28dc5f){return _0x28dc5f[_0x8237('0x33')]({'UserId':_0x4dc5ec[_0x8237('0x54')]['UserId'],'read1stAt':_[_0x8237('0x60')](_0x28dc5f['read1stAt'])?moment()[_0x8237('0x5a')](_0x8237('0x5b')):undefined});}return null;})[_0x8237('0x1d')](function(_0x4a85f0){if(_0x4a85f0){_0x43d077[_0x8237('0x61')]=_0x4a85f0['get']({'plain':!![]});interaction_log[_0x8237('0x24')](_0x8237('0x62'),_0x4dc5ec['user']['id'],_0x4dc5ec['user'][_0x8237('0x36')],_0x4dc5ec[_0x8237('0x63')][_0x8237('0x64')],_0x43d077[_0x8237('0x61')]['id'],_0x4dc5ec[_0x8237('0x54')]?JSON[_0x8237('0x65')](_0x4dc5ec[_0x8237('0x54')]):_0x8237('0x66'));return respondWithRpcPromise(_0x8237('0x67'),_0x8237('0x68'),_0x43d077);}return null;})[_0x8237('0x1d')](function(_0x2dae5b){var _0x2b9b3b=_0x8237('0x69')+_0x2dae5b['message']['ContactId'];return db[_0x8237('0x6a')][_0x8237('0x3e')](_0x2b9b3b,{'type':db[_0x8237('0x6b')][_0x8237('0x6c')][_0x8237('0x6d')],'raw':!![]})[_0x8237('0x1d')](function(_0x329955){return _0x329955;});})[_0x8237('0x1d')](function(_0x9c3893){if(_0x9c3893){_0x43d077[_0x8237('0x23')]['contact']=_0x9c3893[0x0];if(!_0x4dc5ec['body'][_0x8237('0x5c')])return;return db[_0x8237('0x6e')][_0x8237('0x52')]({'where':{'id':_0x4dc5ec[_0x8237('0x54')][_0x8237('0x5c')],'role':_0x8237('0x5d')},'attributes':['id',_0x8237('0x36'),_0x8237('0x6f'),_0x8237('0x70'),_0x8237('0x71')],'raw':!![]});}return null;})[_0x8237('0x1d')](function(_0x2a16f3){if(!_0x2a16f3)return null;_0x43d077[_0x8237('0x23')]['agent']=_0x2a16f3;return _0x43d077;})[_0x8237('0x1d')](function(_0x5d5f57){if(_0x5d5f57){if(_0x4dc5ec['body'][_0x8237('0x72')]){_0x43d077[_0x8237('0x23')][_0x8237('0x73')]=util[_0x8237('0x5a')]('SIP/%s',_0x4dc5ec[_0x8237('0x63')][_0x8237('0x36')]);_0x43d077[_0x8237('0x23')][_0x8237('0x74')]=_0x43d077['channel'];_0x43d077[_0x8237('0x23')][_0x8237('0x75')]=_0x43d077[_0x8237('0x74')];_0x43d077[_0x8237('0x23')]['event']=_0x8237('0x57');return respondWithRpcPromise(_0x8237('0x76'),_0x8237('0x76'),{'event':_0x8237('0x77'),'message':_0x43d077[_0x8237('0x23')]},client9002)[_0x8237('0x1d')](function(){return _0x43d077;});}return _0x43d077;}return null;})[_0x8237('0x1d')](respondWithResult(_0x30bdcc,null))[_0x8237('0x25')](handleError(_0x30bdcc,null));};var interaction_log=require(_0x8237('0x14'))(_0x8237('0x56'));exports['reject']=function(_0x4fea2b,_0x1fbbf2,_0x11f782){var _0x22619b={'agent':{},'channel':_0x8237('0x58')};if(_0x4fea2b['body']['id']){delete _0x4fea2b[_0x8237('0x54')]['id'];}_0x4fea2b['body'][_0x8237('0x5c')]=_0x4fea2b[_0x8237('0x54')][_0x8237('0x5c')]||_0x4fea2b['user']['id'];_0x22619b[_0x8237('0x5d')]['id']=_0x4fea2b[_0x8237('0x54')][_0x8237('0x5c')];return db[_0x8237('0x4d')][_0x8237('0x52')]({'where':{'id':_0x4fea2b[_0x8237('0x50')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1fbbf2,null))['then'](function(_0x10e1a5){if(_0x10e1a5){_0x22619b[_0x8237('0x23')]=_0x10e1a5[_0x8237('0x5e')]({'plain':!![]});return db[_0x8237('0x5f')][_0x8237('0x52')]({'where':{'id':_0x10e1a5[_0x8237('0x78')]}});}return null;})[_0x8237('0x1d')](handleEntityNotFound(_0x1fbbf2,null))[_0x8237('0x1d')](function(_0x26834d){if(_0x26834d){_0x22619b[_0x8237('0x61')]=_0x26834d[_0x8237('0x5e')]({'plain':!![]});interaction_log[_0x8237('0x24')]('[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4fea2b[_0x8237('0x63')]['id'],_0x4fea2b[_0x8237('0x63')]['name'],_0x4fea2b[_0x8237('0x63')][_0x8237('0x64')],_0x22619b['interaction']['id'],_0x4fea2b['body']?JSON['stringify'](_0x4fea2b[_0x8237('0x54')]):_0x8237('0x66'));return respondWithRpcPromise(_0x8237('0x79'),_0x8237('0x7a'),_0x22619b);}return null;})[_0x8237('0x1d')](function(_0x370635){var _0x125427=_0x8237('0x69')+_0x370635[_0x8237('0x23')][_0x8237('0x7b')];return db['sequelize'][_0x8237('0x3e')](_0x125427,{'type':db[_0x8237('0x6b')][_0x8237('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0x1ad43d){return _0x1ad43d;});})['then'](function(_0x4615fa){if(_0x4615fa){_0x22619b[_0x8237('0x23')]['contact']=_0x4615fa[0x0];if(!_0x4fea2b[_0x8237('0x54')][_0x8237('0x5c')])return;return db[_0x8237('0x6e')][_0x8237('0x52')]({'where':{'id':_0x4fea2b[_0x8237('0x54')][_0x8237('0x5c')],'role':_0x8237('0x5d')},'attributes':['id','name',_0x8237('0x6f'),'email','internal'],'raw':!![]});}return null;})[_0x8237('0x1d')](function(_0x1656bd){if(!_0x1656bd)return null;_0x22619b[_0x8237('0x23')][_0x8237('0x5d')]=_0x1656bd;return _0x22619b;})[_0x8237('0x1d')](function(_0x117a63){if(_0x117a63){_0x117a63['message'][_0x8237('0x73')]=util[_0x8237('0x5a')](_0x8237('0x7c'),_0x4fea2b[_0x8237('0x63')][_0x8237('0x36')]);_0x117a63[_0x8237('0x23')][_0x8237('0x74')]=_0x22619b[_0x8237('0x74')];_0x117a63[_0x8237('0x23')][_0x8237('0x75')]=_0x22619b[_0x8237('0x74')];_0x117a63[_0x8237('0x23')][_0x8237('0x7d')]='reject';respondWithRpcPromise(_0x8237('0x76'),_0x8237('0x76'),{'event':'rejectmessage','message':_0x117a63[_0x8237('0x23')]},client9002);return _0x22619b;}return null;})[_0x8237('0x1d')](respondWithResult(_0x1fbbf2,null))[_0x8237('0x25')](handleError(_0x1fbbf2,null));}; \ No newline at end of file +var _0x325a=['params','describe','openchannel-interactions','accept','openchannel','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','acceptMessage','ContactId','QueryTypes','SELECT','contact','User','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','fullname','email','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','json','offset','limit','undefined','count','status','apply','reject','end','stack','name','send','index','OpenchannelMessage','rawAttributes','fieldName','type','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','where','pick','merge','map','VIRTUAL','filter','options','includeAll','include','show','keys','find','create','body','update'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x325a,0x1b5));var _0xa325=function(_0x30a5d6,_0x27e5b2){_0x30a5d6=_0x30a5d6-0x0;var _0x2db33e=_0x325a[_0x30a5d6];return _0x2db33e;};'use strict';var emlformat=require(_0xa325('0x0'));var rimraf=require(_0xa325('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa325('0x2'));var rp=require(_0xa325('0x3'));var moment=require('moment');var BPromise=require(_0xa325('0x4'));var Mustache=require(_0xa325('0x5'));var util=require(_0xa325('0x6'));var path=require(_0xa325('0x7'));var sox=require(_0xa325('0x8'));var csv=require('to-csv');var ejs=require(_0xa325('0x9'));var fs=require('fs');var fs_extra=require(_0xa325('0xa'));var _=require(_0xa325('0xb'));var squel=require(_0xa325('0xc'));var crypto=require(_0xa325('0xd'));var jsforce=require(_0xa325('0xe'));var deskjs=require(_0xa325('0xf'));var toCsv=require(_0xa325('0x10'));var querystring=require('querystring');var Papa=require(_0xa325('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa325('0x12'));var as=require(_0xa325('0x13'));var hardwareService=require(_0xa325('0x14'));var logger=require(_0xa325('0x15'))('api');var utils=require(_0xa325('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xa325('0x17'));var db=require(_0xa325('0x18'))['db'];config['redis']=_['defaults'](config[_0xa325('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xa325('0x1a'))(new Redis(config[_0xa325('0x19')]));require(_0xa325('0x1b'))[_0xa325('0x1c')](socket);var jayson=require(_0xa325('0x1d'));var client=jayson[_0xa325('0x1e')][_0xa325('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0xa325('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x1fd878,_0xec3c75,_0x5d3e0c,_0x243fdc){return new BPromise(function(_0x2e0ec2,_0x49960b){var _0x3406b7=_0x243fdc||client;return _0x3406b7['request'](_0x1fd878,_0x5d3e0c)[_0xa325('0x20')](function(_0xe6a0c9){logger[_0xa325('0x21')](_0xa325('0x22'),_0xec3c75,_0xa325('0x23'));logger[_0xa325('0x24')](_0xa325('0x25'),_0xec3c75,_0xa325('0x23'),JSON[_0xa325('0x26')](_0xe6a0c9));if(_0xe6a0c9[_0xa325('0x27')]){if(_0xe6a0c9[_0xa325('0x27')]['code']===0x1f4){logger[_0xa325('0x27')](_0xa325('0x22'),_0xec3c75,_0xe6a0c9[_0xa325('0x27')][_0xa325('0x28')]);return _0x49960b(_0xe6a0c9[_0xa325('0x27')]['message']);}logger[_0xa325('0x27')]('OpenchannelMessage,\x20%s,\x20%s',_0xec3c75,_0xe6a0c9['error'][_0xa325('0x28')]);return _0x2e0ec2(_0xe6a0c9['error'][_0xa325('0x28')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0xec3c75,'request\x20sent');_0x2e0ec2(_0xe6a0c9[_0xa325('0x29')][_0xa325('0x28')]);}})[_0xa325('0x2a')](function(_0x495a25){logger['error'](_0xa325('0x22'),_0xec3c75,_0x495a25);_0x49960b(_0x495a25);});});}function respondWithStatusCode(_0x5d10ae,_0x34c8ac){_0x34c8ac=_0x34c8ac||0xcc;return function(_0xfceeeb){if(_0xfceeeb){return _0x5d10ae[_0xa325('0x2b')](_0x34c8ac);}return _0x5d10ae['status'](_0x34c8ac)['end']();};}function respondWithResult(_0x54e2f9,_0x137423){_0x137423=_0x137423||0xc8;return function(_0x206733){if(_0x206733){return _0x54e2f9['status'](_0x137423)[_0xa325('0x2c')](_0x206733);}};}function respondWithFilteredResult(_0x4e4ae8,_0x37473c){return function(_0x2427cf){if(_0x2427cf){var _0x4e80e7=typeof _0x37473c[_0xa325('0x2d')]==='undefined'&&typeof _0x37473c[_0xa325('0x2e')]===_0xa325('0x2f');var _0x23ad6f=_0x2427cf[_0xa325('0x30')];var _0x437dfe=_0x4e80e7?0x0:_0x37473c[_0xa325('0x2d')];var _0x373d56=_0x4e80e7?_0x2427cf[_0xa325('0x30')]:_0x37473c[_0xa325('0x2d')]+_0x37473c[_0xa325('0x2e')];var _0x15df43;if(_0x373d56>=_0x23ad6f){_0x373d56=_0x23ad6f;_0x15df43=0xc8;}else{_0x15df43=0xce;}_0x4e4ae8[_0xa325('0x31')](_0x15df43);return _0x4e4ae8['set']('Content-Range',_0x437dfe+'-'+_0x373d56+'/'+_0x23ad6f)[_0xa325('0x2c')](_0x2427cf);}return null;};}function patchUpdates(_0x2bdbd6){return function(_0x539d61){try{jsonpatch[_0xa325('0x32')](_0x539d61,_0x2bdbd6,!![]);}catch(_0x244956){return BPromise[_0xa325('0x33')](_0x244956);}return _0x539d61['save']();};}function saveUpdates(_0x1e9b4b,_0x988f48){return function(_0x5c7255){if(_0x5c7255){return _0x5c7255['update'](_0x1e9b4b)['then'](function(_0x17169f){return _0x17169f;});}return null;};}function removeEntity(_0x2d5895,_0x4f0a7b){return function(_0x25d489){if(_0x25d489){return _0x25d489['destroy']()['then'](function(){_0x2d5895['status'](0xcc)[_0xa325('0x34')]();});}};}function handleEntityNotFound(_0x22879e,_0x5210d3){return function(_0x401c1b){if(!_0x401c1b){_0x22879e[_0xa325('0x2b')](0x194);}return _0x401c1b;};}function handleError(_0x7b68f2,_0x4bfef1){_0x4bfef1=_0x4bfef1||0x1f4;return function(_0x24bc7a){logger[_0xa325('0x27')](_0x24bc7a[_0xa325('0x35')]);if(_0x24bc7a[_0xa325('0x36')]){delete _0x24bc7a[_0xa325('0x36')];}_0x7b68f2['status'](_0x4bfef1)[_0xa325('0x37')](_0x24bc7a);};}exports[_0xa325('0x38')]=function(_0x54d280,_0x4542c8){var _0x3f2968={},_0x2f6ec8={},_0x82547c={'count':0x0,'rows':[]};var _0x20ae80=_['map'](db[_0xa325('0x39')][_0xa325('0x3a')],function(_0x111846){return{'name':_0x111846[_0xa325('0x3b')],'type':_0x111846[_0xa325('0x3c')][_0xa325('0x3d')]};});_0x2f6ec8['model']=_['map'](_0x20ae80,_0xa325('0x36'));_0x2f6ec8[_0xa325('0x3e')]=_['keys'](_0x54d280['query']);_0x2f6ec8[_0xa325('0x3f')]=_[_0xa325('0x40')](_0x2f6ec8['model'],_0x2f6ec8['query']);_0x3f2968[_0xa325('0x41')]=_[_0xa325('0x40')](_0x2f6ec8[_0xa325('0x42')],qs[_0xa325('0x43')](_0x54d280[_0xa325('0x3e')][_0xa325('0x43')]));_0x3f2968[_0xa325('0x41')]=_0x3f2968[_0xa325('0x41')][_0xa325('0x44')]?_0x3f2968[_0xa325('0x41')]:_0x2f6ec8[_0xa325('0x42')];if(!_0x54d280[_0xa325('0x3e')][_0xa325('0x45')]('nolimit')){_0x3f2968[_0xa325('0x2e')]=qs[_0xa325('0x2e')](_0x54d280[_0xa325('0x3e')]['limit']);_0x3f2968[_0xa325('0x2d')]=qs[_0xa325('0x2d')](_0x54d280['query'][_0xa325('0x2d')]);}_0x3f2968[_0xa325('0x46')]=qs['sort'](_0x54d280[_0xa325('0x3e')][_0xa325('0x47')]);_0x3f2968[_0xa325('0x48')]=qs[_0xa325('0x3f')](_[_0xa325('0x49')](_0x54d280[_0xa325('0x3e')],_0x2f6ec8[_0xa325('0x3f')]),_0x20ae80);if(_0x54d280[_0xa325('0x3e')]['filter']){_0x3f2968[_0xa325('0x48')]=_[_0xa325('0x4a')](_0x3f2968['where'],{'$or':_[_0xa325('0x4b')](_0x20ae80,function(_0x1a6b4e){if(_0x1a6b4e['type']!==_0xa325('0x4c')){var _0x29a180={};_0x29a180[_0x1a6b4e[_0xa325('0x36')]]={'$like':'%'+_0x54d280[_0xa325('0x3e')][_0xa325('0x4d')]+'%'};return _0x29a180;}})});}_0x3f2968=_['merge']({},_0x3f2968,_0x54d280[_0xa325('0x4e')]);var _0x1e1ed8={'where':_0x3f2968[_0xa325('0x48')]};return db[_0xa325('0x39')][_0xa325('0x30')](_0x1e1ed8)[_0xa325('0x20')](function(_0x1ff39d){_0x82547c[_0xa325('0x30')]=_0x1ff39d;if(_0x54d280[_0xa325('0x3e')][_0xa325('0x4f')]){_0x3f2968[_0xa325('0x50')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x3f2968);})[_0xa325('0x20')](function(_0x490fca){_0x82547c['rows']=_0x490fca;return _0x82547c;})['then'](respondWithFilteredResult(_0x4542c8,_0x3f2968))['catch'](handleError(_0x4542c8,null));};exports[_0xa325('0x51')]=function(_0x3a4714,_0x1dcba1){var _0x7a3b42={'raw':!![],'where':{'id':_0x3a4714['params']['id']}},_0x98bbb9={};_0x98bbb9[_0xa325('0x42')]=_[_0xa325('0x52')](db[_0xa325('0x39')]['rawAttributes']);_0x98bbb9[_0xa325('0x3e')]=_['keys'](_0x3a4714['query']);_0x98bbb9[_0xa325('0x3f')]=_[_0xa325('0x40')](_0x98bbb9[_0xa325('0x42')],_0x98bbb9[_0xa325('0x3e')]);_0x7a3b42[_0xa325('0x41')]=_[_0xa325('0x40')](_0x98bbb9[_0xa325('0x42')],qs['fields'](_0x3a4714[_0xa325('0x3e')][_0xa325('0x43')]));_0x7a3b42[_0xa325('0x41')]=_0x7a3b42[_0xa325('0x41')][_0xa325('0x44')]?_0x7a3b42[_0xa325('0x41')]:_0x98bbb9['model'];if(_0x3a4714[_0xa325('0x3e')][_0xa325('0x4f')]){_0x7a3b42[_0xa325('0x50')]=[{'all':!![]}];}_0x7a3b42=_['merge']({},_0x7a3b42,_0x3a4714[_0xa325('0x4e')]);return db[_0xa325('0x39')][_0xa325('0x53')](_0x7a3b42)[_0xa325('0x20')](handleEntityNotFound(_0x1dcba1,null))['then'](respondWithResult(_0x1dcba1,null))['catch'](handleError(_0x1dcba1,null));};exports[_0xa325('0x54')]=function(_0x5d70ef,_0x4bab8a){return db[_0xa325('0x39')]['create'](_0x5d70ef[_0xa325('0x55')],{})[_0xa325('0x20')](respondWithResult(_0x4bab8a,0xc9))[_0xa325('0x2a')](handleError(_0x4bab8a,null));};exports[_0xa325('0x56')]=function(_0x11f9d7,_0x485f63){if(_0x11f9d7[_0xa325('0x55')]['id']){delete _0x11f9d7[_0xa325('0x55')]['id'];}return db['OpenchannelMessage']['find']({'where':{'id':_0x11f9d7[_0xa325('0x57')]['id']}})[_0xa325('0x20')](handleEntityNotFound(_0x485f63,null))[_0xa325('0x20')](saveUpdates(_0x11f9d7[_0xa325('0x55')],null))[_0xa325('0x20')](respondWithResult(_0x485f63,null))[_0xa325('0x2a')](handleError(_0x485f63,null));};exports['destroy']=function(_0x375c77,_0x1a5048){return db[_0xa325('0x39')][_0xa325('0x53')]({'where':{'id':_0x375c77['params']['id']}})['then'](handleEntityNotFound(_0x1a5048,null))['then'](removeEntity(_0x1a5048,null))[_0xa325('0x2a')](handleError(_0x1a5048,null));};exports['describe']=function(_0xfe42a2,_0x47b333){return db[_0xa325('0x39')][_0xa325('0x58')]()[_0xa325('0x20')](respondWithResult(_0x47b333,null))[_0xa325('0x2a')](handleError(_0x47b333,null));};var interaction_log=require(_0xa325('0x15'))(_0xa325('0x59'));exports[_0xa325('0x5a')]=function(_0x5bde69,_0x2ca780,_0x104335){var _0xf95c63={'agent':{},'channel':_0xa325('0x5b')};if(_0x5bde69[_0xa325('0x55')]['id']){delete _0x5bde69[_0xa325('0x55')]['id'];}_0x5bde69['body'][_0xa325('0x5c')]=!![];_0x5bde69[_0xa325('0x55')][_0xa325('0x5d')]=moment()[_0xa325('0x5e')](_0xa325('0x5f'));_0x5bde69[_0xa325('0x55')]['UserId']=_0x5bde69[_0xa325('0x55')][_0xa325('0x60')]||_0x5bde69[_0xa325('0x61')]['id'];_0xf95c63[_0xa325('0x62')]['id']=_0x5bde69[_0xa325('0x55')][_0xa325('0x60')];return db[_0xa325('0x39')][_0xa325('0x53')]({'where':{'id':_0x5bde69[_0xa325('0x57')]['id'],'UserId':null}})[_0xa325('0x20')](handleEntityNotFound(_0x2ca780,null))[_0xa325('0x20')](saveUpdates(_0x5bde69[_0xa325('0x55')],null))[_0xa325('0x20')](function(_0x21b631){if(_0x21b631){_0xf95c63[_0xa325('0x28')]=_0x21b631[_0xa325('0x63')]({'plain':!![]});return db[_0xa325('0x64')]['find']({'where':{'id':_0x21b631[_0xa325('0x65')]}});}return null;})[_0xa325('0x20')](handleEntityNotFound(_0x2ca780,null))['then'](function(_0x5888fd){if(_0x5888fd){return _0x5888fd['update']({'UserId':_0x5bde69[_0xa325('0x55')][_0xa325('0x60')],'read1stAt':_[_0xa325('0x66')](_0x5888fd[_0xa325('0x67')])?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xa325('0x20')](function(_0x566abf){if(_0x566abf){_0xf95c63[_0xa325('0x68')]=_0x566abf['get']({'plain':!![]});interaction_log[_0xa325('0x21')](_0xa325('0x69'),_0x5bde69[_0xa325('0x61')]['id'],_0x5bde69[_0xa325('0x61')][_0xa325('0x36')],_0x5bde69[_0xa325('0x61')][_0xa325('0x6a')],_0xf95c63['interaction']['id'],_0x5bde69[_0xa325('0x55')]?JSON[_0xa325('0x26')](_0x5bde69[_0xa325('0x55')]):_0xa325('0x6b'));return respondWithRpcPromise('AcceptMessage',_0xa325('0x6c'),_0xf95c63);}return null;})['then'](function(_0x5dc15d){var _0x2b9e4b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5dc15d[_0xa325('0x28')][_0xa325('0x6d')];return db['sequelize'][_0xa325('0x3e')](_0x2b9e4b,{'type':db['Sequelize'][_0xa325('0x6e')][_0xa325('0x6f')],'raw':!![]})[_0xa325('0x20')](function(_0xbe24ba){return _0xbe24ba;});})[_0xa325('0x20')](function(_0x227cff){if(_0x227cff){_0xf95c63[_0xa325('0x28')][_0xa325('0x70')]=_0x227cff[0x0];if(!_0x5bde69[_0xa325('0x55')][_0xa325('0x60')])return;return db[_0xa325('0x71')]['find']({'where':{'id':_0x5bde69[_0xa325('0x55')][_0xa325('0x60')],'role':_0xa325('0x62')},'attributes':['id','name','fullname','email',_0xa325('0x72')],'raw':!![]});}return null;})[_0xa325('0x20')](function(_0x42631e){if(!_0x42631e)return null;_0xf95c63[_0xa325('0x28')][_0xa325('0x62')]=_0x42631e;return _0xf95c63;})['then'](function(_0x2b4fda){if(_0x2b4fda){if(_0x5bde69[_0xa325('0x55')][_0xa325('0x73')]){_0xf95c63[_0xa325('0x28')][_0xa325('0x74')]=util[_0xa325('0x5e')](_0xa325('0x75'),_0x5bde69['user'][_0xa325('0x36')]);_0xf95c63['message'][_0xa325('0x76')]=_0xf95c63[_0xa325('0x76')];_0xf95c63['message'][_0xa325('0x77')]=_0xf95c63[_0xa325('0x76')];_0xf95c63[_0xa325('0x28')][_0xa325('0x78')]='accept';return respondWithRpcPromise(_0xa325('0x79'),_0xa325('0x79'),{'event':_0xa325('0x7a'),'message':_0xf95c63[_0xa325('0x28')]},client9002)[_0xa325('0x20')](function(){return _0xf95c63;});}return _0xf95c63;}return null;})[_0xa325('0x20')](respondWithResult(_0x2ca780,null))[_0xa325('0x2a')](handleError(_0x2ca780,null));};var interaction_log=require(_0xa325('0x15'))(_0xa325('0x59'));exports['reject']=function(_0x53010a,_0x7fb6a3,_0x5303d1){var _0x3df391={'agent':{},'channel':_0xa325('0x5b')};if(_0x53010a['body']['id']){delete _0x53010a['body']['id'];}_0x53010a[_0xa325('0x55')][_0xa325('0x60')]=_0x53010a[_0xa325('0x55')][_0xa325('0x60')]||_0x53010a[_0xa325('0x61')]['id'];_0x3df391[_0xa325('0x62')]['id']=_0x53010a['body']['UserId'];return db['OpenchannelMessage']['find']({'where':{'id':_0x53010a[_0xa325('0x57')]['id'],'UserId':null}})[_0xa325('0x20')](handleEntityNotFound(_0x7fb6a3,null))['then'](function(_0x340d22){if(_0x340d22){_0x3df391[_0xa325('0x28')]=_0x340d22[_0xa325('0x63')]({'plain':!![]});return db[_0xa325('0x64')][_0xa325('0x53')]({'where':{'id':_0x340d22['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x7fb6a3,null))[_0xa325('0x20')](function(_0x3abf3b){if(_0x3abf3b){_0x3df391[_0xa325('0x68')]=_0x3abf3b[_0xa325('0x63')]({'plain':!![]});interaction_log[_0xa325('0x21')](_0xa325('0x7b'),_0x53010a['user']['id'],_0x53010a[_0xa325('0x61')][_0xa325('0x36')],_0x53010a[_0xa325('0x61')][_0xa325('0x6a')],_0x3df391[_0xa325('0x68')]['id'],_0x53010a[_0xa325('0x55')]?JSON['stringify'](_0x53010a[_0xa325('0x55')]):_0xa325('0x6b'));return respondWithRpcPromise(_0xa325('0x7c'),_0xa325('0x7d'),_0x3df391);}return null;})[_0xa325('0x20')](function(_0x49a150){var _0x549068=_0xa325('0x7e')+_0x49a150[_0xa325('0x28')][_0xa325('0x6d')];return db[_0xa325('0x7f')][_0xa325('0x3e')](_0x549068,{'type':db[_0xa325('0x80')][_0xa325('0x6e')][_0xa325('0x6f')],'raw':!![]})['then'](function(_0x5d8f21){return _0x5d8f21;});})[_0xa325('0x20')](function(_0x33c43a){if(_0x33c43a){_0x3df391[_0xa325('0x28')][_0xa325('0x70')]=_0x33c43a[0x0];if(!_0x53010a[_0xa325('0x55')]['UserId'])return;return db[_0xa325('0x71')][_0xa325('0x53')]({'where':{'id':_0x53010a[_0xa325('0x55')][_0xa325('0x60')],'role':_0xa325('0x62')},'attributes':['id',_0xa325('0x36'),_0xa325('0x81'),_0xa325('0x82'),_0xa325('0x72')],'raw':!![]});}return null;})[_0xa325('0x20')](function(_0x21ade8){if(!_0x21ade8)return null;_0x3df391[_0xa325('0x28')][_0xa325('0x62')]=_0x21ade8;return _0x3df391;})[_0xa325('0x20')](function(_0x153e37){if(_0x153e37){_0x153e37[_0xa325('0x28')]['interface']=util['format'](_0xa325('0x75'),_0x53010a['user']['name']);_0x153e37['message'][_0xa325('0x76')]=_0x3df391['channel'];_0x153e37[_0xa325('0x28')][_0xa325('0x77')]=_0x3df391['channel'];_0x153e37[_0xa325('0x28')][_0xa325('0x78')]=_0xa325('0x33');respondWithRpcPromise(_0xa325('0x79'),'EventManager',{'event':'rejectmessage','message':_0x153e37[_0xa325('0x28')]},client9002);return _0x3df391;}return null;})['then'](respondWithResult(_0x7fb6a3,null))[_0xa325('0x2a')](handleError(_0x7fb6a3,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 6198aa8..e81a497 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 _0x7344=['../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x4c5f20,_0x3cce59){var _0x8e3e56=function(_0x43babf){while(--_0x43babf){_0x4c5f20['push'](_0x4c5f20['shift']());}};_0x8e3e56(++_0x3cce59);}(_0x7344,0x1df));var _0x4734=function(_0x141890,_0x4eeb62){_0x141890=_0x141890-0x0;var _0x5ab4c9=_0x7344[_0x141890];return _0x5ab4c9;};'use strict';var EventEmitter=require(_0x4734('0x0'));var OpenchannelMessage=require(_0x4734('0x1'))['db'][_0x4734('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x4734('0x3')](0x0);var events={'afterCreate':_0x4734('0x4'),'afterUpdate':_0x4734('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1de9ed){return function(_0x4364e5,_0x4c4488,_0x2fa02b){OpenchannelMessageEvents[_0x4734('0x6')](_0x1de9ed+':'+_0x4364e5['id'],_0x4364e5);OpenchannelMessageEvents[_0x4734('0x6')](_0x1de9ed,_0x4364e5);_0x2fa02b(null);};}for(var e in events){if(events[_0x4734('0x7')](e)){var event=events[e];OpenchannelMessage[_0x4734('0x8')](e,emitEvent(event));}}module[_0x4734('0x9')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x78d6=['remove','emit','hasOwnProperty','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0x78d6,0xa4));var _0x678d=function(_0x11c558,_0x1ba70c){_0x11c558=_0x11c558-0x0;var _0x447204=_0x78d6[_0x11c558];return _0x447204;};'use strict';var EventEmitter=require(_0x678d('0x0'));var OpenchannelMessage=require(_0x678d('0x1'))['db'][_0x678d('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x678d('0x3')](0x0);var events={'afterCreate':_0x678d('0x4'),'afterUpdate':_0x678d('0x5'),'afterDestroy':_0x678d('0x6')};function emitEvent(_0x159497){return function(_0x2dc16b,_0x435b71,_0x3967ef){OpenchannelMessageEvents['emit'](_0x159497+':'+_0x2dc16b['id'],_0x2dc16b);OpenchannelMessageEvents[_0x678d('0x7')](_0x159497,_0x2dc16b);_0x3967ef(null);};}for(var e in events){if(events[_0x678d('0x8')](e)){var event=events[e];OpenchannelMessage[_0x678d('0x9')](e,emitEvent(event));}}module['exports']=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index f924cd3..547aea8 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 _0xc74e=['fti_openchannel_messages','body','FULLTEXT','get','direction','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','update','createdAt','toLowerCase','catch','error','out','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','replyUri','info','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','length','omit','POST','method','OpenchannelMessage,\x20%s,\x20%s','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','inspect','finally','utf8mb4','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','openchannel_messages'];(function(_0x40741b,_0x380f1a){var _0x30e499=function(_0x1c8dbc){while(--_0x1c8dbc){_0x40741b['push'](_0x40741b['shift']());}};_0x30e499(++_0x380f1a);}(_0xc74e,0x90));var _0xec74=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xc74e[_0x21a9d9];return _0x46adce;};'use strict';var _=require('lodash');var util=require(_0xec74('0x0'));var logger=require(_0xec74('0x1'))(_0xec74('0x2'));var moment=require(_0xec74('0x3'));var BPromise=require(_0xec74('0x4'));var rp=require(_0xec74('0x5'));var fs=require('fs');var path=require(_0xec74('0x6'));var rimraf=require('rimraf');var config=require(_0xec74('0x7'));var attributes=require(_0xec74('0x8'));module[_0xec74('0x9')]=function(_0x7767d4,_0x1b076d){return _0x7767d4[_0xec74('0xa')]('OpenchannelMessage',attributes,{'tableName':_0xec74('0xb'),'paranoid':![],'indexes':[{'name':_0xec74('0xc'),'fields':[_0xec74('0xd')],'type':_0xec74('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3b2477,_0x2cef8c,_0x59df3a){var _0x264ddd=_0x7767d4['models'];var _0x124a31=_0x3b2477[_0xec74('0xf')]({'plain':!![]});if(_0x124a31[_0xec74('0x10')]['toLowerCase']()==='in'||_0x124a31[_0xec74('0x10')]['toLowerCase']()==='out'&&!_0x124a31['secret']&&!_[_0xec74('0x11')](_0x124a31[_0xec74('0x12')])){_0x264ddd[_0xec74('0x13')]['findOne']({'where':{'id':_0x124a31[_0xec74('0x14')]}})[_0xec74('0x15')](function(_0x107b4a){if(_0x107b4a){_0x107b4a[_0xec74('0x16')]({'lastMsgAt':_0x124a31[_0xec74('0x17')],'lastMsgDirection':_0x124a31[_0xec74('0x10')][_0xec74('0x18')]()});}})[_0xec74('0x19')](function(_0x3157ee){console[_0xec74('0x1a')](_0x3157ee);});}if(_0x124a31[_0xec74('0x10')]===_0xec74('0x1b')&&!_0x124a31['secret']){var _0xcaa8fc;_0x264ddd[_0xec74('0x1c')][_0xec74('0x1d')]()[_0xec74('0x15')](function(_0x42eccd){return _0x264ddd[_0xec74('0x1e')][_0xec74('0x1f')]({'where':{'id':_0x124a31[_0xec74('0x20')]},'include':[{'model':_0x264ddd[_0xec74('0x13')],'as':_0xec74('0x21'),'where':{'id':_0x124a31[_0xec74('0x14')]},'limit':0x1,'include':[{'model':_0x264ddd[_0xec74('0x1c')],'as':_0xec74('0x22'),'attributes':_[_0xec74('0x23')](_0x42eccd)}]}]});})[_0xec74('0x15')](function(_0xa009b4){_0xcaa8fc=_0xa009b4[_0xec74('0xf')]({'plain':!![]});if(_0xcaa8fc&&_0xcaa8fc[_0xec74('0x24')]){logger[_0xec74('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0xec74('0x26'),util[_0xec74('0x27')](_0xec74('0x28'),_0x124a31['id'],_0xcaa8fc[_0xec74('0x24')]));if(_0xcaa8fc[_0xec74('0x21')]&&_0xcaa8fc[_0xec74('0x21')][_0xec74('0x29')]){_0x124a31['Interaction']=_[_0xec74('0x2a')](_0xcaa8fc[_0xec74('0x21')][0x0],'Contact');_0x124a31[_0xec74('0x22')]=_0xcaa8fc[_0xec74('0x21')][0x0][_0xec74('0x22')];}var _0x2cef8c={'method':_0xec74('0x2b'),'uri':encodeURI(_0xcaa8fc[_0xec74('0x24')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x2cef8c[_0xec74('0x2c')]){case'GET':_0x2cef8c['qs']=_0x124a31;break;case _0xec74('0x2b'):_0x2cef8c[_0xec74('0xd')]=_0x124a31;break;}return rp(_0x2cef8c)['then'](function(_0x48e42a){logger[_0xec74('0x25')](_0xec74('0x2d'),_0xec74('0x26'),util[_0xec74('0x27')](_0xec74('0x2e'),_0x124a31['id'],_0xcaa8fc['replyUri']));if(_0x48e42a[_0xec74('0xd')][_0xec74('0x2f')]&&_0x48e42a[_0xec74('0xd')][_0xec74('0x2f')]!=_0x124a31[_0xec74('0x30')][_0xec74('0x2f')]){return _0x264ddd[_0xec74('0x13')]['update']({'threadId':_0x48e42a[_0xec74('0xd')]['threadId']},{'where':{'id':_0x124a31['Interaction']['id']}});}else{return;}})[_0xec74('0x15')](function(){return _0x3b2477[_0xec74('0x16')]({'read':!![]});})[_0xec74('0x19')](function(_0x522b78){logger['error'](_0xec74('0x2d'),_0xec74('0x26'),util[_0xec74('0x31')](_0x522b78,{'showHidden':![],'depth':null}));_0x59df3a();});}else{_0x59df3a();}})[_0xec74('0x32')](function(){_0x59df3a();});}else{_0x59df3a();}}},'charset':_0xec74('0x33'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x4269=['isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','createdAt','toLowerCase','catch','error','CmContact','describe','then','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','info','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','POST','replyUri','method','GET','body','afterCreate','format','threadId','update','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','out','secret'];(function(_0x40015a,_0x415db5){var _0x42f8a4=function(_0x5685ad){while(--_0x5685ad){_0x40015a['push'](_0x40015a['shift']());}};_0x42f8a4(++_0x415db5);}(_0x4269,0x11b));var _0x9426=function(_0x57ff3d,_0x551fbd){_0x57ff3d=_0x57ff3d-0x0;var _0xf4ab01=_0x4269[_0x57ff3d];return _0xf4ab01;};'use strict';var _=require(_0x9426('0x0'));var util=require(_0x9426('0x1'));var logger=require(_0x9426('0x2'))(_0x9426('0x3'));var moment=require(_0x9426('0x4'));var BPromise=require('bluebird');var rp=require(_0x9426('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9426('0x6'));module['exports']=function(_0xf1bd92,_0x4a382d){return _0xf1bd92[_0x9426('0x7')](_0x9426('0x8'),attributes,{'tableName':_0x9426('0x9'),'paranoid':![],'indexes':[{'name':_0x9426('0xa'),'fields':['body'],'type':_0x9426('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ff934,_0x1f05ff,_0x34867e){var _0x1f300a=_0xf1bd92[_0x9426('0xc')];var _0x26b261=_0x2ff934[_0x9426('0xd')]({'plain':!![]});if(_0x26b261[_0x9426('0xe')]['toLowerCase']()==='in'||_0x26b261['direction']['toLowerCase']()===_0x9426('0xf')&&!_0x26b261[_0x9426('0x10')]&&!_[_0x9426('0x11')](_0x26b261[_0x9426('0x12')])){_0x1f300a[_0x9426('0x13')]['findOne']({'where':{'id':_0x26b261[_0x9426('0x14')]}})['then'](function(_0x306f65){if(_0x306f65){_0x306f65['update']({'lastMsgAt':_0x26b261[_0x9426('0x15')],'lastMsgDirection':_0x26b261[_0x9426('0xe')][_0x9426('0x16')]()});}})[_0x9426('0x17')](function(_0x32d3e3){console[_0x9426('0x18')](_0x32d3e3);});}if(_0x26b261[_0x9426('0xe')]===_0x9426('0xf')&&!_0x26b261[_0x9426('0x10')]){var _0x25e30a;_0x1f300a[_0x9426('0x19')][_0x9426('0x1a')]()[_0x9426('0x1b')](function(_0x598a8){return _0x1f300a[_0x9426('0x1c')][_0x9426('0x1d')]({'where':{'id':_0x26b261[_0x9426('0x1e')]},'include':[{'model':_0x1f300a[_0x9426('0x13')],'as':_0x9426('0x1f'),'where':{'id':_0x26b261[_0x9426('0x14')]},'limit':0x1,'include':[{'model':_0x1f300a[_0x9426('0x19')],'as':_0x9426('0x20'),'attributes':_['keys'](_0x598a8)}]}]});})['then'](function(_0x37e77e){_0x25e30a=_0x37e77e[_0x9426('0xd')]({'plain':!![]});if(_0x25e30a&&_0x25e30a['replyUri']){logger[_0x9426('0x21')](_0x9426('0x22'),'afterCreate',util['format'](_0x9426('0x23'),_0x26b261['id'],_0x25e30a['replyUri']));if(_0x25e30a[_0x9426('0x1f')]&&_0x25e30a['Interactions']['length']){_0x26b261[_0x9426('0x24')]=_['omit'](_0x25e30a[_0x9426('0x1f')][0x0],_0x9426('0x20'));_0x26b261[_0x9426('0x20')]=_0x25e30a[_0x9426('0x1f')][0x0][_0x9426('0x20')];}var _0x1f05ff={'method':_0x9426('0x25'),'uri':encodeURI(_0x25e30a[_0x9426('0x26')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1f05ff[_0x9426('0x27')]){case _0x9426('0x28'):_0x1f05ff['qs']=_0x26b261;break;case _0x9426('0x25'):_0x1f05ff[_0x9426('0x29')]=_0x26b261;break;}return rp(_0x1f05ff)[_0x9426('0x1b')](function(_0x587d31){logger[_0x9426('0x21')](_0x9426('0x22'),_0x9426('0x2a'),util[_0x9426('0x2b')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x26b261['id'],_0x25e30a[_0x9426('0x26')]));if(_0x587d31[_0x9426('0x29')]['threadId']&&_0x587d31['body'][_0x9426('0x2c')]!=_0x26b261['Interaction'][_0x9426('0x2c')]){return _0x1f300a[_0x9426('0x13')][_0x9426('0x2d')]({'threadId':_0x587d31['body'][_0x9426('0x2c')]},{'where':{'id':_0x26b261['Interaction']['id']}});}else{return;}})[_0x9426('0x1b')](function(){return _0x2ff934['update']({'read':!![]});})['catch'](function(_0x2caa47){logger[_0x9426('0x18')](_0x9426('0x22'),'afterCreate',util[_0x9426('0x2e')](_0x2caa47,{'showHidden':![],'depth':null}));_0x34867e();});}else{_0x34867e();}})[_0x9426('0x2f')](function(){_0x34867e();});}else{_0x34867e();}}},'charset':_0x9426('0x30'),'collate':_0x9426('0x31')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index d19e3b4..41da733 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 _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x40f4c2,_0x52face){var _0x2f55aa=function(_0x407c95){while(--_0x407c95){_0x40f4c2['push'](_0x40f4c2['shift']());}};_0x2f55aa(++_0x52face);}(_0x5f66,0x1a0));var _0x65f6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x5f66[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ 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(_0x1da78e,_0x1fdd07){var _0x11685e=function(_0x32c492){while(--_0x32c492){_0x1da78e['push'](_0x1da78e['shift']());}};_0x11685e(++_0x1fdd07);}(_0x1261,0x144));var _0x1126=function(_0x3e948f,_0x19484d){_0x3e948f=_0x3e948f-0x0;var _0x4cc3de=_0x1261[_0x3e948f];return _0x4cc3de;};'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 2542a0b..7f0484e 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 _0xce2a=['openchannelMessage:','save','remove','update','emit','register','length'];(function(_0x87506e,_0x5680ec){var _0x5496a4=function(_0x1e29ab){while(--_0x1e29ab){_0x87506e['push'](_0x87506e['shift']());}};_0x5496a4(++_0x5680ec);}(_0xce2a,0xd3));var _0xace2=function(_0x49eff5,_0x16a431){_0x49eff5=_0x49eff5-0x0;var _0x3617d1=_0xce2a[_0x49eff5];return _0x3617d1;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xace2('0x0'),_0xace2('0x1'),_0xace2('0x2')];function createListener(_0x5753ff,_0x2435ad){return function(_0x88316){_0x2435ad[_0xace2('0x3')](_0x5753ff,_0x88316);};}function removeListener(_0x5eb117,_0x362167){return function(){OpenchannelMessageEvents['removeListener'](_0x5eb117,_0x362167);};}exports[_0xace2('0x4')]=function(_0x25fdde){for(var _0x5b68c3=0x0,_0x5295a0=events[_0xace2('0x5')];_0x5b68c3<_0x5295a0;_0x5b68c3++){var _0x1e6111=events[_0x5b68c3];var _0x3f6540=createListener(_0xace2('0x6')+_0x1e6111,_0x25fdde);OpenchannelMessageEvents['on'](_0x1e6111,_0x3f6540);}}; \ No newline at end of file +var _0x9a6e=['emit','removeListener','register','openchannelMessage:','./openchannelMessage.events','save','update'];(function(_0xfd5afd,_0x44dc0a){var _0x4110a9=function(_0x377e26){while(--_0x377e26){_0xfd5afd['push'](_0xfd5afd['shift']());}};_0x4110a9(++_0x44dc0a);}(_0x9a6e,0xc1));var _0xe9a6=function(_0x38d64b,_0x56a8ac){_0x38d64b=_0x38d64b-0x0;var _0x58868c=_0x9a6e[_0x38d64b];return _0x58868c;};'use strict';var OpenchannelMessageEvents=require(_0xe9a6('0x0'));var events=[_0xe9a6('0x1'),'remove',_0xe9a6('0x2')];function createListener(_0x3731b6,_0x2e8449){return function(_0x219397){_0x2e8449[_0xe9a6('0x3')](_0x3731b6,_0x219397);};}function removeListener(_0x9febd8,_0x5292c9){return function(){OpenchannelMessageEvents[_0xe9a6('0x4')](_0x9febd8,_0x5292c9);};}exports[_0xe9a6('0x5')]=function(_0x52d7b8){for(var _0x4a8fba=0x0,_0x4ed4a4=events['length'];_0x4a8fba<_0x4ed4a4;_0x4a8fba++){var _0x422d0d=events[_0x4a8fba];var _0x334b63=createListener(_0xe9a6('0x6')+_0x422d0d,_0x52d7b8);OpenchannelMessageEvents['on'](_0x422d0d,_0x334b63);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index f1ad1c2..ef3d25b 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 _0x4c4d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addAgents','put','/:id','update','delete','destroy','removeAgents','exports'];(function(_0xd9f981,_0x299d14){var _0xfbd729=function(_0x48d77b){while(--_0x48d77b){_0xd9f981['push'](_0xd9f981['shift']());}};_0xfbd729(++_0x299d14);}(_0x4c4d,0x195));var _0xd4c4=function(_0x3af6ed,_0x2f7f88){_0x3af6ed=_0x3af6ed-0x0;var _0x25b391=_0x4c4d[_0x3af6ed];return _0x25b391;};'use strict';var multer=require(_0xd4c4('0x0'));var util=require(_0xd4c4('0x1'));var path=require(_0xd4c4('0x2'));var timeout=require(_0xd4c4('0x3'));var express=require(_0xd4c4('0x4'));var router=express[_0xd4c4('0x5')]();var fs_extra=require(_0xd4c4('0x6'));var auth=require(_0xd4c4('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd4c4('0x8'));router[_0xd4c4('0x9')]('/',auth[_0xd4c4('0xa')](),controller[_0xd4c4('0xb')]);router[_0xd4c4('0x9')]('/describe',auth[_0xd4c4('0xa')](),controller[_0xd4c4('0xc')]);router[_0xd4c4('0x9')]('/:id',auth[_0xd4c4('0xa')](),controller['show']);router[_0xd4c4('0x9')](_0xd4c4('0xd'),auth[_0xd4c4('0xa')](),controller[_0xd4c4('0xe')]);router[_0xd4c4('0x9')](_0xd4c4('0xf'),auth[_0xd4c4('0xa')](),controller[_0xd4c4('0x10')]);router[_0xd4c4('0x9')](_0xd4c4('0x11'),auth[_0xd4c4('0xa')](),controller['getAgents']);router[_0xd4c4('0x12')]('/',auth[_0xd4c4('0xa')](),controller['create']);router[_0xd4c4('0x12')](_0xd4c4('0xf'),auth[_0xd4c4('0xa')](),controller['addTeams']);router['post'](_0xd4c4('0x11'),auth['isAuthenticated'](),controller[_0xd4c4('0x13')]);router[_0xd4c4('0x14')](_0xd4c4('0x15'),auth[_0xd4c4('0xa')](),controller[_0xd4c4('0x16')]);router[_0xd4c4('0x17')]('/:id',auth[_0xd4c4('0xa')](),controller[_0xd4c4('0x18')]);router['delete'](_0xd4c4('0xf'),auth[_0xd4c4('0xa')](),controller['removeTeams']);router[_0xd4c4('0x17')](_0xd4c4('0x11'),auth['isAuthenticated'](),controller[_0xd4c4('0x19')]);module[_0xd4c4('0x1a')]=router; \ No newline at end of file +var _0xf216=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addTeams','update','delete','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express'];(function(_0x456fb1,_0x859a1d){var _0x4083d6=function(_0xe1d0f2){while(--_0xe1d0f2){_0x456fb1['push'](_0x456fb1['shift']());}};_0x4083d6(++_0x859a1d);}(_0xf216,0x15a));var _0x6f21=function(_0x3207aa,_0xe86a72){_0x3207aa=_0x3207aa-0x0;var _0x51758f=_0xf216[_0x3207aa];return _0x51758f;};'use strict';var multer=require(_0x6f21('0x0'));var util=require(_0x6f21('0x1'));var path=require(_0x6f21('0x2'));var timeout=require(_0x6f21('0x3'));var express=require(_0x6f21('0x4'));var router=express[_0x6f21('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x6f21('0x6'));var interaction=require(_0x6f21('0x7'));var config=require(_0x6f21('0x8'));var controller=require(_0x6f21('0x9'));router[_0x6f21('0xa')]('/',auth[_0x6f21('0xb')](),controller['index']);router[_0x6f21('0xa')](_0x6f21('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x6f21('0xa')](_0x6f21('0xd'),auth[_0x6f21('0xb')](),controller[_0x6f21('0xe')]);router[_0x6f21('0xa')](_0x6f21('0xf'),auth[_0x6f21('0xb')](),controller['getMembers']);router['get'](_0x6f21('0x10'),auth['isAuthenticated'](),controller[_0x6f21('0x11')]);router[_0x6f21('0xa')](_0x6f21('0x12'),auth['isAuthenticated'](),controller['getAgents']);router[_0x6f21('0x13')]('/',auth['isAuthenticated'](),controller[_0x6f21('0x14')]);router[_0x6f21('0x13')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6f21('0x15')]);router[_0x6f21('0x13')](_0x6f21('0x12'),auth[_0x6f21('0xb')](),controller['addAgents']);router['put'](_0x6f21('0xd'),auth[_0x6f21('0xb')](),controller[_0x6f21('0x16')]);router[_0x6f21('0x17')](_0x6f21('0xd'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x6f21('0x10'),auth[_0x6f21('0xb')](),controller[_0x6f21('0x18')]);router[_0x6f21('0x17')](_0x6f21('0x12'),auth['isAuthenticated'](),controller[_0x6f21('0x19')]);module[_0x6f21('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 92c9642..f7cfbb6 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 _0x18eb=['beepall','sequelize','exports','STRING','ENUM','rrmemory'];(function(_0x418782,_0x755d5c){var _0x444610=function(_0x35ad31){while(--_0x35ad31){_0x418782['push'](_0x418782['shift']());}};_0x444610(++_0x755d5c);}(_0x18eb,0x1a5));var _0xb18e=function(_0x46bcec,_0x5bc91e){_0x46bcec=_0x46bcec-0x0;var _0xa23497=_0x18eb[_0x46bcec];return _0xa23497;};'use strict';var Sequelize=require(_0xb18e('0x0'));module[_0xb18e('0x1')]={'name':{'type':Sequelize[_0xb18e('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xb18e('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xb18e('0x3')](_0xb18e('0x4'),_0xb18e('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x9972=['rrmemory','beepall','roundrobin','sequelize','exports','name','STRING','ENUM'];(function(_0x5852b2,_0x41633c){var _0x304d23=function(_0x5f521a){while(--_0x5f521a){_0x5852b2['push'](_0x5852b2['shift']());}};_0x304d23(++_0x41633c);}(_0x9972,0xab));var _0x2997=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x9972[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x2997('0x0'));module[_0x2997('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2997('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x2997('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2997('0x4')](_0x2997('0x5'),_0x2997('0x6'),_0x2997('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 9e3b198..cdbb5d0 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 _0x2baa=['userOpenchannelQueue:remove','addAgents','spread','userOpenchannelQueue:save','removeAgents','isArray','getAgents','bluebird','squel','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./openchannelQueue.socket','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','get','OpenchannelQueues','UserProfileResource','then','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','type','getOptions','include','query','rows','catch','params','keys','filters','intersection','model','attributes','fields','includeAll','merge','options','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','findOne','UserOpenchannelQueue','length','hasOwnProperty','nolimit','order','sort','where','pick','OpenchannelQueueId','filter','User','findAndCountAll','agent','openchannelPause','updatedAt','createdAt','%s/%s','getTeams','Team','ids','findAll','Agents','voicePause','interface','flatMap','transaction','addTeams','findOrCreate','forEach','emit','field','tq.TeamId','from','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','push','sequelize','QueryTypes','SELECT','every','TeamId','includes','union','compact','value','removeTeams','isEmpty'];(function(_0x336264,_0x32e1d9){var _0x53cf91=function(_0x21026c){while(--_0x21026c){_0x336264['push'](_0x336264['shift']());}};_0x53cf91(++_0x32e1d9);}(_0x2baa,0x1df));var _0xa2ba=function(_0x392ea9,_0xfe8969){_0x392ea9=_0x392ea9-0x0;var _0x389de4=_0x2baa[_0x392ea9];return _0x389de4;};'use strict';var BPromise=require(_0xa2ba('0x0'));var util=require('util');var _=require('lodash');var squel=require(_0xa2ba('0x1'));var Redis=require('ioredis');var qs=require(_0xa2ba('0x2'));var logger=require(_0xa2ba('0x3'))(_0xa2ba('0x4'));var config=require('../../config/environment');var db=require(_0xa2ba('0x5'))['db'];config['redis']=_[_0xa2ba('0x6')](config['redis'],{'host':_0xa2ba('0x7'),'port':0x18eb});var socket=require(_0xa2ba('0x8'))(new Redis(config[_0xa2ba('0x9')]));require(_0xa2ba('0xa'))['register'](socket);function respondWithStatusCode(_0x4449d8,_0x5c23f0){_0x5c23f0=_0x5c23f0||0xcc;return function(_0x277ca7){if(_0x277ca7){return _0x4449d8[_0xa2ba('0xb')](_0x5c23f0);}return _0x4449d8[_0xa2ba('0xc')](_0x5c23f0)[_0xa2ba('0xd')]();};}function respondWithResult(_0x32774d,_0x4fe142){_0x4fe142=_0x4fe142||0xc8;return function(_0xfa87fb){if(_0xfa87fb){return _0x32774d['status'](_0x4fe142)[_0xa2ba('0xe')](_0xfa87fb);}};}function respondWithFilteredResult(_0x12be2b,_0x1903c2){return function(_0x3ee91e){if(_0x3ee91e){var _0x422e11=typeof _0x1903c2[_0xa2ba('0xf')]===_0xa2ba('0x10')&&typeof _0x1903c2[_0xa2ba('0x11')]===_0xa2ba('0x10');var _0x1eabac=_0x3ee91e['count'];var _0x3a7e4b=_0x422e11?0x0:_0x1903c2['offset'];var _0x193d58=_0x422e11?_0x3ee91e[_0xa2ba('0x12')]:_0x1903c2[_0xa2ba('0xf')]+_0x1903c2[_0xa2ba('0x11')];var _0x24b098;if(_0x193d58>=_0x1eabac){_0x193d58=_0x1eabac;_0x24b098=0xc8;}else{_0x24b098=0xce;}_0x12be2b[_0xa2ba('0xc')](_0x24b098);return _0x12be2b['set'](_0xa2ba('0x13'),_0x3a7e4b+'-'+_0x193d58+'/'+_0x1eabac)['json'](_0x3ee91e);}return null;};}function saveUpdates(_0x39b1ed){return function(_0x1fc786){if(_0x1fc786){return _0x1fc786['update'](_0x39b1ed)['then'](function(_0x4f468a){return _0x4f468a;});}return null;};}function removeEntity(_0x36edc1){return function(_0x323264){if(_0x323264){return _0x323264[_0xa2ba('0x14')]()['then'](function(){var _0x75f8ab=_0x323264[_0xa2ba('0x15')]({'plain':!![]});var _0x1c9a03=_0xa2ba('0x16');return db[_0xa2ba('0x17')][_0xa2ba('0x14')]({'where':{'type':_0x1c9a03,'resourceId':_0x75f8ab['id']}})[_0xa2ba('0x18')](function(){return _0x323264;});})['then'](function(){_0x36edc1[_0xa2ba('0xc')](0xcc)[_0xa2ba('0xd')]();});}};}function handleEntityNotFound(_0x5479c8){return function(_0x3a2109){if(!_0x3a2109){_0x5479c8[_0xa2ba('0xb')](0x194);}return _0x3a2109;};}function handleError(_0x4566bb,_0x256f07){_0x256f07=_0x256f07||0x1f4;return function(_0x137496){logger[_0xa2ba('0x19')](_0x137496[_0xa2ba('0x1a')]);if(_0x137496[_0xa2ba('0x1b')]){delete _0x137496[_0xa2ba('0x1b')];}_0x4566bb[_0xa2ba('0xc')](_0x256f07)[_0xa2ba('0x1c')](_0x137496);};}exports[_0xa2ba('0x1d')]=function(_0x2ee91c,_0x2b1964){var _0xecf10a={};var _0x23c87c={'count':0x0,'rows':[]};var _0x5f1f0b=_[_0xa2ba('0x1e')](db[_0xa2ba('0x1f')][_0xa2ba('0x20')],function(_0x106f31){return{'name':_0x106f31['fieldName'],'type':_0x106f31[_0xa2ba('0x21')]['key']};});_0xecf10a=qs[_0xa2ba('0x22')](_0x5f1f0b,_0x2ee91c);var _0x48dccd={'where':_0xecf10a['where']};return db[_0xa2ba('0x1f')][_0xa2ba('0x12')](_0x48dccd)['then'](function(_0x461b0b){_0x23c87c[_0xa2ba('0x12')]=_0x461b0b;_0xecf10a[_0xa2ba('0x23')]=qs[_0xa2ba('0x23')](_0x2ee91c[_0xa2ba('0x24')]);return db['OpenchannelQueue']['findAll'](_0xecf10a);})['then'](function(_0x5bfb4d){_0x23c87c[_0xa2ba('0x25')]=_0x5bfb4d;return _0x23c87c;})['then'](respondWithFilteredResult(_0x2b1964,_0xecf10a))[_0xa2ba('0x26')](handleError(_0x2b1964,null));};exports['show']=function(_0x1c0e1e,_0x334ca8){var _0x3e09b7={'raw':!![],'where':{'id':_0x1c0e1e[_0xa2ba('0x27')]['id']}},_0x66cbce={};_0x66cbce['model']=_[_0xa2ba('0x28')](db[_0xa2ba('0x1f')]['rawAttributes']);_0x66cbce['query']=_[_0xa2ba('0x28')](_0x1c0e1e[_0xa2ba('0x24')]);_0x66cbce[_0xa2ba('0x29')]=_[_0xa2ba('0x2a')](_0x66cbce[_0xa2ba('0x2b')],_0x66cbce['query']);_0x3e09b7[_0xa2ba('0x2c')]=_['intersection'](_0x66cbce[_0xa2ba('0x2b')],qs[_0xa2ba('0x2d')](_0x1c0e1e[_0xa2ba('0x24')][_0xa2ba('0x2d')]));_0x3e09b7['attributes']=_0x3e09b7['attributes']['length']?_0x3e09b7[_0xa2ba('0x2c')]:_0x66cbce[_0xa2ba('0x2b')];if(_0x1c0e1e[_0xa2ba('0x24')][_0xa2ba('0x2e')]){_0x3e09b7[_0xa2ba('0x23')]=[{'all':!![]}];}_0x3e09b7=_[_0xa2ba('0x2f')]({},_0x3e09b7,_0x1c0e1e[_0xa2ba('0x30')]);return db[_0xa2ba('0x1f')][_0xa2ba('0x31')](_0x3e09b7)[_0xa2ba('0x18')](handleEntityNotFound(_0x334ca8,null))[_0xa2ba('0x18')](respondWithResult(_0x334ca8,null))[_0xa2ba('0x26')](handleError(_0x334ca8,null));};exports[_0xa2ba('0x32')]=function(_0x17181c,_0x4fcdd9){return db[_0xa2ba('0x1f')][_0xa2ba('0x32')](_0x17181c['body'],{})[_0xa2ba('0x18')](function(_0x5477a8){var _0x147af0=_0x17181c['user'][_0xa2ba('0x15')]({'plain':!![]});if(!_0x147af0)throw new Error(_0xa2ba('0x33'));if(_0x147af0[_0xa2ba('0x34')]===_0xa2ba('0x35')){var _0x8a13e3=_0x5477a8[_0xa2ba('0x15')]({'plain':!![]});var _0x3aa5e4='OpenchannelQueues';return db[_0xa2ba('0x36')]['find']({'where':{'name':_0x3aa5e4,'userProfileId':_0x147af0['userProfileId']},'raw':!![]})[_0xa2ba('0x18')](function(_0x595732){if(_0x595732&&_0x595732[_0xa2ba('0x37')]===0x0){return db['UserProfileResource'][_0xa2ba('0x32')]({'name':_0x8a13e3[_0xa2ba('0x1b')],'resourceId':_0x8a13e3['id'],'type':_0x595732[_0xa2ba('0x1b')],'sectionId':_0x595732['id']},{})['then'](function(){return _0x5477a8;});}else{return _0x5477a8;}})[_0xa2ba('0x26')](function(_0x343023){logger[_0xa2ba('0x19')](_0xa2ba('0x38'),_0x343023);throw _0x343023;});}return _0x5477a8;})['then'](respondWithResult(_0x4fcdd9,0xc9))[_0xa2ba('0x26')](handleError(_0x4fcdd9,null));};exports[_0xa2ba('0x39')]=function(_0x1b8a33,_0x1670a9){if(_0x1b8a33[_0xa2ba('0x3a')]['id']){delete _0x1b8a33[_0xa2ba('0x3a')]['id'];}return db[_0xa2ba('0x1f')][_0xa2ba('0x31')]({'where':{'id':_0x1b8a33[_0xa2ba('0x27')]['id']}})[_0xa2ba('0x18')](handleEntityNotFound(_0x1670a9,null))[_0xa2ba('0x18')](saveUpdates(_0x1b8a33['body'],null))['then'](respondWithResult(_0x1670a9,null))[_0xa2ba('0x26')](handleError(_0x1670a9,null));};exports[_0xa2ba('0x14')]=function(_0x599c49,_0x50bc08){return db['OpenchannelQueue'][_0xa2ba('0x31')]({'where':{'id':_0x599c49['params']['id']}})[_0xa2ba('0x18')](handleEntityNotFound(_0x50bc08,null))['then'](removeEntity(_0x50bc08,null))[_0xa2ba('0x26')](handleError(_0x50bc08,null));};exports[_0xa2ba('0x3b')]=function(_0x369784,_0x113af2){return db[_0xa2ba('0x1f')][_0xa2ba('0x3b')]()[_0xa2ba('0x18')](respondWithResult(_0x113af2,null))[_0xa2ba('0x26')](handleError(_0x113af2,null));};exports['getMembers']=function(_0x2a4311,_0x459a9e){var _0x3c7e48={'raw':!![],'where':{}},_0x3fcdeb={},_0x6bb03b;return db[_0xa2ba('0x1f')][_0xa2ba('0x3c')]({'where':{'id':_0x2a4311['params']['id']}})[_0xa2ba('0x18')](handleEntityNotFound(_0x459a9e,null))['then'](function(_0x1ca881){if(_0x1ca881){_0x6bb03b=_0x1ca881['get']({'plain':!![]});_0x3fcdeb[_0xa2ba('0x2b')]=_['keys'](db[_0xa2ba('0x3d')][_0xa2ba('0x20')]);_0x3fcdeb['query']=_[_0xa2ba('0x28')](_0x2a4311[_0xa2ba('0x24')]);_0x3fcdeb[_0xa2ba('0x29')]=_[_0xa2ba('0x2a')](_0x3fcdeb[_0xa2ba('0x2b')],_0x3fcdeb[_0xa2ba('0x24')]);_0x3c7e48['attributes']=_[_0xa2ba('0x2a')](_0x3fcdeb[_0xa2ba('0x2b')],qs[_0xa2ba('0x2d')](_0x2a4311[_0xa2ba('0x24')][_0xa2ba('0x2d')]));_0x3c7e48[_0xa2ba('0x2c')]=_0x3c7e48['attributes'][_0xa2ba('0x3e')]?_0x3c7e48[_0xa2ba('0x2c')]:_0x3fcdeb['model'];if(!_0x2a4311[_0xa2ba('0x24')][_0xa2ba('0x3f')](_0xa2ba('0x40'))){_0x3c7e48[_0xa2ba('0x11')]=qs[_0xa2ba('0x11')](_0x2a4311[_0xa2ba('0x24')][_0xa2ba('0x11')]);_0x3c7e48[_0xa2ba('0xf')]=qs['offset'](_0x2a4311[_0xa2ba('0x24')][_0xa2ba('0xf')]);}_0x3c7e48[_0xa2ba('0x41')]=qs[_0xa2ba('0x42')](_0x2a4311[_0xa2ba('0x24')][_0xa2ba('0x42')]);_0x3c7e48[_0xa2ba('0x43')]=qs[_0xa2ba('0x29')](_[_0xa2ba('0x44')](_0x2a4311[_0xa2ba('0x24')],_0x3fcdeb[_0xa2ba('0x29')]));_0x3c7e48[_0xa2ba('0x43')][_0xa2ba('0x45')]=_0x1ca881['id'];if(_0x2a4311[_0xa2ba('0x24')][_0xa2ba('0x46')]){_0x3c7e48['where']=_[_0xa2ba('0x2f')](_0x3c7e48[_0xa2ba('0x43')],{'$or':_[_0xa2ba('0x1e')](_0x3c7e48[_0xa2ba('0x2c')],function(_0x24d424){var _0x245d1e={};_0x245d1e[_0x24d424]={'$like':'%'+_0x2a4311[_0xa2ba('0x24')][_0xa2ba('0x46')]+'%'};return _0x245d1e;})});}_0x3c7e48=_[_0xa2ba('0x2f')]({},_0x3c7e48,_0x2a4311[_0xa2ba('0x30')]);return db[_0xa2ba('0x3d')]['findAll'](_0x3c7e48);}})['then'](function(_0x45a4fd){if(_0x45a4fd){return db[_0xa2ba('0x47')][_0xa2ba('0x48')]({'where':{'id':_[_0xa2ba('0x1e')](_0x45a4fd,'UserId'),'role':_0xa2ba('0x49')},'attributes':['id','name',_0xa2ba('0x4a'),_0xa2ba('0x4b'),_0xa2ba('0x4c')]});}})[_0xa2ba('0x18')](function(_0x2f1949){if(_0x2f1949){return{'count':_0x2f1949[_0xa2ba('0x12')],'rows':_[_0xa2ba('0x1e')](_0x2f1949['rows'],function(_0x4aef2d){return{'membername':_0x4aef2d['name'],'UserId':_0x4aef2d['id'],'queue_name':_0x6bb03b['name'],'OpenchannelQueueId':_0x6bb03b['id'],'interface':util['format'](_0xa2ba('0x4d'),'SIP',_0x4aef2d[_0xa2ba('0x1b')]),'penalty':0x0,'paused':_0x4aef2d[_0xa2ba('0x4a')],'createdAt':_0x4aef2d[_0xa2ba('0x4c')],'updatedAt':_0x4aef2d[_0xa2ba('0x4b')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa2ba('0x18')](respondWithFilteredResult(_0x459a9e,_0x3c7e48))[_0xa2ba('0x26')](handleError(_0x459a9e,null));};exports[_0xa2ba('0x4e')]=function(_0x5b0ff5,_0x21e8c7){var _0x283abc={};var _0x550fbb={};var _0x25a53a;var _0xae30ef;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x5b0ff5[_0xa2ba('0x27')]['id']}})[_0xa2ba('0x18')](handleEntityNotFound(_0x21e8c7,null))[_0xa2ba('0x18')](function(_0xb886d6){if(_0xb886d6){_0x25a53a=_0xb886d6;_0x550fbb[_0xa2ba('0x2b')]=_[_0xa2ba('0x28')](db[_0xa2ba('0x4f')][_0xa2ba('0x20')]);_0x550fbb[_0xa2ba('0x24')]=_['keys'](_0x5b0ff5[_0xa2ba('0x24')]);_0x550fbb['filters']=_['intersection'](_0x550fbb['model'],_0x550fbb[_0xa2ba('0x24')]);_0x283abc[_0xa2ba('0x2c')]=_[_0xa2ba('0x2a')](_0x550fbb[_0xa2ba('0x2b')],qs[_0xa2ba('0x2d')](_0x5b0ff5['query'][_0xa2ba('0x2d')]));_0x283abc[_0xa2ba('0x2c')]=_0x283abc['attributes']['length']?_0x283abc['attributes']:_0x550fbb[_0xa2ba('0x2b')];_0x283abc[_0xa2ba('0x41')]=qs[_0xa2ba('0x42')](_0x5b0ff5[_0xa2ba('0x24')][_0xa2ba('0x42')]);_0x283abc[_0xa2ba('0x43')]=qs[_0xa2ba('0x29')](_[_0xa2ba('0x44')](_0x5b0ff5['query'],_0x550fbb[_0xa2ba('0x29')]));if(_0x5b0ff5['query'][_0xa2ba('0x46')]){_0x283abc[_0xa2ba('0x43')]=_['merge'](_0x283abc[_0xa2ba('0x43')],{'$or':_[_0xa2ba('0x1e')](_0x283abc[_0xa2ba('0x2c')],function(_0x58ccdd){var _0x465533={};_0x465533[_0x58ccdd]={'$like':'%'+_0x5b0ff5['query'][_0xa2ba('0x46')]+'%'};return _0x465533;})});}_0x283abc=_[_0xa2ba('0x2f')]({},_0x283abc,_0x5b0ff5[_0xa2ba('0x30')]);return _0x25a53a[_0xa2ba('0x4e')](_0x283abc);}})[_0xa2ba('0x18')](function(_0x24e8a5){if(_0x24e8a5){_0xae30ef=_0x24e8a5[_0xa2ba('0x3e')];if(!_0x5b0ff5[_0xa2ba('0x24')][_0xa2ba('0x3f')](_0xa2ba('0x40'))){_0x283abc[_0xa2ba('0x11')]=qs[_0xa2ba('0x11')](_0x5b0ff5['query'][_0xa2ba('0x11')]);_0x283abc[_0xa2ba('0xf')]=qs[_0xa2ba('0xf')](_0x5b0ff5[_0xa2ba('0x24')][_0xa2ba('0xf')]);}return _0x25a53a['getTeams'](_0x283abc);}})[_0xa2ba('0x18')](function(_0x27b0e9){if(_0x27b0e9){return _0x27b0e9?{'count':_0xae30ef,'rows':_0x27b0e9}:null;}})[_0xa2ba('0x18')](respondWithResult(_0x21e8c7,null))[_0xa2ba('0x26')](handleError(_0x21e8c7,null));};exports['addTeams']=function(_0x217c14,_0x30247f){var _0x1cf10f=_0x217c14[_0xa2ba('0x3a')][_0xa2ba('0x50')];return db[_0xa2ba('0x4f')][_0xa2ba('0x51')]({'where':{'id':_0x1cf10f},'attributes':['id'],'include':[{'model':db[_0xa2ba('0x47')],'as':_0xa2ba('0x52'),'attributes':['id',_0xa2ba('0x1b'),'online',_0xa2ba('0x53'),_0xa2ba('0x54')],'raw':!![]}]})[_0xa2ba('0x18')](function(_0x6a752){if(_0x6a752){var _0x3949c9=_[_0xa2ba('0x55')](_0x6a752,function(_0x28eafa){var _0x59317f=_0x28eafa[_0xa2ba('0x15')]({'plain':!![]});return _0x59317f[_0xa2ba('0x52')];});return db[_0xa2ba('0x1f')][_0xa2ba('0x31')]({'where':{'id':_0x217c14[_0xa2ba('0x27')]['id']}})['then'](function(_0x4ee093){return db['sequelize'][_0xa2ba('0x56')](function(_0xacc4c){return _0x4ee093[_0xa2ba('0x57')](_0x1cf10f,{'transaction':_0xacc4c})['then'](function(){return BPromise['each'](_0x3949c9,function(_0x59c82d){return db[_0xa2ba('0x3d')][_0xa2ba('0x58')]({'where':{'UserId':_0x59c82d['id'],'OpenchannelQueueId':_0x217c14[_0xa2ba('0x27')]['id']},'transaction':_0xacc4c});});})[_0xa2ba('0x18')](function(){_0x3949c9[_0xa2ba('0x59')](function(_0x490627){socket[_0xa2ba('0x5a')]('userOpenchannelQueue:save',{'UserId':_0x490627['id'],'OpenchannelQueueId':_0x4ee093['id']});});});});});}})['then'](respondWithStatusCode(_0x30247f,null))[_0xa2ba('0x26')](handleError(_0x30247f,null));};exports['removeTeams']=function(_0x4a9cb9,_0x3ab3d3){return db['Team'][_0xa2ba('0x51')]({'where':{'id':_0x4a9cb9[_0xa2ba('0x24')][_0xa2ba('0x50')]},'attributes':['id'],'include':[{'model':db[_0xa2ba('0x47')],'as':_0xa2ba('0x52'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3ab3d3,null))['then'](function(_0x264363){var _0x5e9135=_[_0xa2ba('0x1e')](_0x264363,'id');var _0x426c52=[];var _0x146a48=[];var _0x2ea015=squel['select']();_0x2ea015[_0xa2ba('0x5b')](_0xa2ba('0x5c'))[_0xa2ba('0x5d')](_0xa2ba('0x5e'),'tq')[_0xa2ba('0x5f')](_0xa2ba('0x60'),'ut',_0xa2ba('0x61'))[_0xa2ba('0x43')](_0xa2ba('0x62'),_0x4a9cb9[_0xa2ba('0x27')]['id']);for(var _0x466a52=0x0;_0x466a52<_0x264363[_0xa2ba('0x3e')];_0x466a52+=0x1){let _0x2d72a5=_0x264363[_0x466a52];for(var _0x36481a=0x0;_0x36481a<_0x2d72a5[_0xa2ba('0x52')][_0xa2ba('0x3e')];_0x36481a+=0x1){let _0x28cdcd=_0x2d72a5[_0xa2ba('0x52')][_0x36481a];var _0x4d010b=_0x2ea015['clone']();_0x4d010b[_0xa2ba('0x43')]('ut.UserId\x20=\x20?',_0x28cdcd['id']);_0x146a48[_0xa2ba('0x63')](db['sequelize'][_0xa2ba('0x24')](_0x4d010b['toString'](),{'type':db[_0xa2ba('0x64')][_0xa2ba('0x65')][_0xa2ba('0x66')]})[_0xa2ba('0x18')](function(_0x462def){if(_0x462def[_0xa2ba('0x3e')]===0x1){return _0x28cdcd['id'];}else{var _0x2a945d=_[_0xa2ba('0x67')](_[_0xa2ba('0x1e')](_0x462def,_0xa2ba('0x68')),function(_0x439a4f){return _[_0xa2ba('0x69')](_0x5e9135,_0x439a4f);});if(_0x2a945d){return _0x28cdcd['id'];}}}));}}return BPromise['all'](_0x146a48)[_0xa2ba('0x18')](function(_0x2edbac){_0x426c52=_(_0x426c52)[_0xa2ba('0x6a')](_0x2edbac)[_0xa2ba('0x6b')]()[_0xa2ba('0x6c')]();return db['OpenchannelQueue'][_0xa2ba('0x31')]({'where':{'id':_0x4a9cb9[_0xa2ba('0x27')]['id']}})['then'](function(_0x5b507e){return db[_0xa2ba('0x64')][_0xa2ba('0x56')](function(_0x280589){return _0x5b507e[_0xa2ba('0x6d')](_0x4a9cb9[_0xa2ba('0x24')][_0xa2ba('0x50')],{'transaction':_0x280589})[_0xa2ba('0x18')](function(){if(!_[_0xa2ba('0x6e')](_0x426c52)){return _0x5b507e['removeAgents'](_0x426c52,{'transaction':_0x280589});}})['then'](function(){_0x426c52[_0xa2ba('0x59')](function(_0x46f61b){socket['emit'](_0xa2ba('0x6f'),{'UserId':_0x46f61b,'OpenchannelQueueId':_0x5b507e['id']});});});});});});})['then'](respondWithStatusCode(_0x3ab3d3,null))[_0xa2ba('0x26')](handleError(_0x3ab3d3,null));};exports[_0xa2ba('0x70')]=function(_0x5a8795,_0x1df31c){return db[_0xa2ba('0x1f')]['find']({'where':{'id':_0x5a8795[_0xa2ba('0x27')]['id']}})[_0xa2ba('0x18')](handleEntityNotFound(_0x1df31c,null))[_0xa2ba('0x18')](function(_0x57cb05){if(_0x57cb05){return _0x57cb05[_0xa2ba('0x70')](_0x5a8795[_0xa2ba('0x3a')][_0xa2ba('0x50')],_['omit'](_0x5a8795['body'],['ids','id'])||{})[_0xa2ba('0x71')](function(_0x5b2e77){for(var _0x3392d7=0x0;_0x3392d7<_0x5a8795['body'][_0xa2ba('0x50')][_0xa2ba('0x3e')];_0x3392d7+=0x1){socket[_0xa2ba('0x5a')](_0xa2ba('0x72'),{'UserId':Number(_0x5a8795[_0xa2ba('0x3a')][_0xa2ba('0x50')][_0x3392d7]),'OpenchannelQueueId':Number(_0x5a8795[_0xa2ba('0x27')]['id'])});}return _0x5b2e77;});}})['then'](respondWithResult(_0x1df31c,null))['catch'](handleError(_0x1df31c,null));};exports['removeAgents']=function(_0x1cdc0b,_0x158773){return db[_0xa2ba('0x1f')][_0xa2ba('0x31')]({'where':{'id':_0x1cdc0b[_0xa2ba('0x27')]['id']}})['then'](handleEntityNotFound(_0x158773,null))[_0xa2ba('0x18')](function(_0x23893a){if(_0x23893a){return _0x23893a[_0xa2ba('0x73')](_0x1cdc0b[_0xa2ba('0x24')]['ids'])[_0xa2ba('0x18')](function(){if(_[_0xa2ba('0x74')](_0x1cdc0b[_0xa2ba('0x24')][_0xa2ba('0x50')])){for(var _0x3e69bf=0x0;_0x3e69bf<_0x1cdc0b[_0xa2ba('0x24')][_0xa2ba('0x50')][_0xa2ba('0x3e')];_0x3e69bf+=0x1){socket[_0xa2ba('0x5a')](_0xa2ba('0x6f'),{'UserId':Number(_0x1cdc0b[_0xa2ba('0x24')][_0xa2ba('0x50')][_0x3e69bf]),'OpenchannelQueueId':Number(_0x1cdc0b[_0xa2ba('0x27')]['id'])});}}else{socket['emit'](_0xa2ba('0x6f'),{'UserId':Number(_0x1cdc0b[_0xa2ba('0x24')]['ids']),'OpenchannelQueueId':Number(_0x1cdc0b[_0xa2ba('0x27')]['id'])});}});}})[_0xa2ba('0x18')](respondWithStatusCode(_0x158773,null))[_0xa2ba('0x26')](handleError(_0x158773,null));};exports[_0xa2ba('0x75')]=function(_0x1caabc,_0x185f82){var _0x7ce59={};var _0x322556={};var _0x360b74;var _0x436424;return db[_0xa2ba('0x1f')][_0xa2ba('0x3c')]({'where':{'id':_0x1caabc[_0xa2ba('0x27')]['id']}})['then'](handleEntityNotFound(_0x185f82,null))[_0xa2ba('0x18')](function(_0x446f49){if(_0x446f49){_0x360b74=_0x446f49;_0x322556[_0xa2ba('0x2b')]=_['keys'](db[_0xa2ba('0x47')][_0xa2ba('0x20')]);_0x322556[_0xa2ba('0x24')]=_[_0xa2ba('0x28')](_0x1caabc[_0xa2ba('0x24')]);_0x322556[_0xa2ba('0x29')]=_[_0xa2ba('0x2a')](_0x322556[_0xa2ba('0x2b')],_0x322556[_0xa2ba('0x24')]);_0x7ce59[_0xa2ba('0x2c')]=_[_0xa2ba('0x2a')](_0x322556['model'],qs[_0xa2ba('0x2d')](_0x1caabc[_0xa2ba('0x24')][_0xa2ba('0x2d')]));_0x7ce59[_0xa2ba('0x2c')]=_0x7ce59[_0xa2ba('0x2c')]['length']?_0x7ce59['attributes']:_0x322556['model'];_0x7ce59[_0xa2ba('0x41')]=qs[_0xa2ba('0x42')](_0x1caabc['query'][_0xa2ba('0x42')]);_0x7ce59[_0xa2ba('0x43')]=qs[_0xa2ba('0x29')](_[_0xa2ba('0x44')](_0x1caabc['query'],_0x322556[_0xa2ba('0x29')]));if(_0x1caabc[_0xa2ba('0x24')][_0xa2ba('0x46')]){_0x7ce59[_0xa2ba('0x43')]=_[_0xa2ba('0x2f')](_0x7ce59[_0xa2ba('0x43')],{'$or':_[_0xa2ba('0x1e')](_0x7ce59[_0xa2ba('0x2c')],function(_0xefd8f3){var _0x3ad193={};_0x3ad193[_0xefd8f3]={'$like':'%'+_0x1caabc['query'][_0xa2ba('0x46')]+'%'};return _0x3ad193;})});}_0x7ce59=_[_0xa2ba('0x2f')]({},_0x7ce59,_0x1caabc[_0xa2ba('0x30')]);return _0x360b74[_0xa2ba('0x75')](_0x7ce59);}})['then'](function(_0x3d04c7){if(_0x3d04c7){_0x436424=_0x3d04c7[_0xa2ba('0x3e')];if(!_0x1caabc[_0xa2ba('0x24')][_0xa2ba('0x3f')](_0xa2ba('0x40'))){_0x7ce59[_0xa2ba('0x11')]=qs[_0xa2ba('0x11')](_0x1caabc[_0xa2ba('0x24')]['limit']);_0x7ce59['offset']=qs[_0xa2ba('0xf')](_0x1caabc['query'][_0xa2ba('0xf')]);}return _0x360b74[_0xa2ba('0x75')](_0x7ce59);}})['then'](function(_0x358d7e){if(_0x358d7e){return _0x358d7e?{'count':_0x436424,'rows':_0x358d7e}:null;}})[_0xa2ba('0x18')](respondWithResult(_0x185f82,null))[_0xa2ba('0x26')](handleError(_0x185f82,null));}; \ No newline at end of file +var _0x78f0=['undefined','limit','Content-Range','update','destroy','then','UserProfileResource','end','stack','name','send','index','OpenchannelQueue','fieldName','type','getOptions','where','count','include','query','findAll','rows','catch','params','model','keys','rawAttributes','intersection','attributes','fields','length','options','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','filters','hasOwnProperty','nolimit','sort','pick','OpenchannelQueueId','map','filter','merge','User','findAndCountAll','UserId','agent','updatedAt','createdAt','format','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','forEach','emit','field','tq.TeamId','team_has_openchannel_queues','join','user_has_teams','clone','ut.UserId\x20=\x20?','push','toString','SELECT','every','includes','all','union','compact','value','removeTeams','removeAgents','userOpenchannelQueue:remove','addAgents','spread','userOpenchannelQueue:save','isArray','getAgents','order','util','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','sendStatus','status','json','offset'];(function(_0x341602,_0x22f918){var _0x257b25=function(_0x2b3140){while(--_0x2b3140){_0x341602['push'](_0x341602['shift']());}};_0x257b25(++_0x22f918);}(_0x78f0,0x67));var _0x078f=function(_0x2372dc,_0x3c7ce4){_0x2372dc=_0x2372dc-0x0;var _0x518fb1=_0x78f0[_0x2372dc];return _0x518fb1;};'use strict';var BPromise=require('bluebird');var util=require(_0x078f('0x0'));var _=require(_0x078f('0x1'));var squel=require('squel');var Redis=require(_0x078f('0x2'));var qs=require(_0x078f('0x3'));var logger=require(_0x078f('0x4'))(_0x078f('0x5'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x078f('0x6')]=_[_0x078f('0x7')](config[_0x078f('0x6')],{'host':_0x078f('0x8'),'port':0x18eb});var socket=require(_0x078f('0x9'))(new Redis(config['redis']));require(_0x078f('0xa'))[_0x078f('0xb')](socket);function respondWithStatusCode(_0x4f03ac,_0xde9f85){_0xde9f85=_0xde9f85||0xcc;return function(_0x4920e5){if(_0x4920e5){return _0x4f03ac[_0x078f('0xc')](_0xde9f85);}return _0x4f03ac[_0x078f('0xd')](_0xde9f85)['end']();};}function respondWithResult(_0x31d579,_0x36f44d){_0x36f44d=_0x36f44d||0xc8;return function(_0x461f4d){if(_0x461f4d){return _0x31d579[_0x078f('0xd')](_0x36f44d)[_0x078f('0xe')](_0x461f4d);}};}function respondWithFilteredResult(_0xfa972e,_0x132293){return function(_0x364fcc){if(_0x364fcc){var _0x24d990=typeof _0x132293[_0x078f('0xf')]===_0x078f('0x10')&&typeof _0x132293[_0x078f('0x11')]===_0x078f('0x10');var _0x4f54cc=_0x364fcc['count'];var _0x462f40=_0x24d990?0x0:_0x132293[_0x078f('0xf')];var _0x453a98=_0x24d990?_0x364fcc['count']:_0x132293[_0x078f('0xf')]+_0x132293[_0x078f('0x11')];var _0x297e69;if(_0x453a98>=_0x4f54cc){_0x453a98=_0x4f54cc;_0x297e69=0xc8;}else{_0x297e69=0xce;}_0xfa972e[_0x078f('0xd')](_0x297e69);return _0xfa972e['set'](_0x078f('0x12'),_0x462f40+'-'+_0x453a98+'/'+_0x4f54cc)[_0x078f('0xe')](_0x364fcc);}return null;};}function saveUpdates(_0xce2a0b){return function(_0x27595e){if(_0x27595e){return _0x27595e[_0x078f('0x13')](_0xce2a0b)['then'](function(_0x505a74){return _0x505a74;});}return null;};}function removeEntity(_0x3429ef){return function(_0x51683b){if(_0x51683b){return _0x51683b[_0x078f('0x14')]()[_0x078f('0x15')](function(){var _0x24cb33=_0x51683b['get']({'plain':!![]});var _0x567cde='OpenchannelQueues';return db[_0x078f('0x16')][_0x078f('0x14')]({'where':{'type':_0x567cde,'resourceId':_0x24cb33['id']}})[_0x078f('0x15')](function(){return _0x51683b;});})[_0x078f('0x15')](function(){_0x3429ef[_0x078f('0xd')](0xcc)[_0x078f('0x17')]();});}};}function handleEntityNotFound(_0x209338){return function(_0xee9a5d){if(!_0xee9a5d){_0x209338[_0x078f('0xc')](0x194);}return _0xee9a5d;};}function handleError(_0x2d5fcc,_0x246a8b){_0x246a8b=_0x246a8b||0x1f4;return function(_0xe5d9d){logger['error'](_0xe5d9d[_0x078f('0x18')]);if(_0xe5d9d['name']){delete _0xe5d9d[_0x078f('0x19')];}_0x2d5fcc[_0x078f('0xd')](_0x246a8b)[_0x078f('0x1a')](_0xe5d9d);};}exports[_0x078f('0x1b')]=function(_0x4ef4ac,_0xfefe7d){var _0x32bbf1={};var _0x4803cf={'count':0x0,'rows':[]};var _0x1c8006=_['map'](db[_0x078f('0x1c')]['rawAttributes'],function(_0x518743){return{'name':_0x518743[_0x078f('0x1d')],'type':_0x518743[_0x078f('0x1e')]['key']};});_0x32bbf1=qs[_0x078f('0x1f')](_0x1c8006,_0x4ef4ac);var _0x20f22a={'where':_0x32bbf1[_0x078f('0x20')]};return db[_0x078f('0x1c')][_0x078f('0x21')](_0x20f22a)['then'](function(_0x59da4a){_0x4803cf[_0x078f('0x21')]=_0x59da4a;_0x32bbf1['include']=qs[_0x078f('0x22')](_0x4ef4ac[_0x078f('0x23')]);return db[_0x078f('0x1c')][_0x078f('0x24')](_0x32bbf1);})[_0x078f('0x15')](function(_0x386840){_0x4803cf[_0x078f('0x25')]=_0x386840;return _0x4803cf;})['then'](respondWithFilteredResult(_0xfefe7d,_0x32bbf1))[_0x078f('0x26')](handleError(_0xfefe7d,null));};exports['show']=function(_0xdb63ef,_0x5480fb){var _0x5d308b={'raw':!![],'where':{'id':_0xdb63ef[_0x078f('0x27')]['id']}},_0x4a8b8e={};_0x4a8b8e[_0x078f('0x28')]=_[_0x078f('0x29')](db[_0x078f('0x1c')][_0x078f('0x2a')]);_0x4a8b8e[_0x078f('0x23')]=_[_0x078f('0x29')](_0xdb63ef['query']);_0x4a8b8e['filters']=_[_0x078f('0x2b')](_0x4a8b8e[_0x078f('0x28')],_0x4a8b8e[_0x078f('0x23')]);_0x5d308b[_0x078f('0x2c')]=_[_0x078f('0x2b')](_0x4a8b8e[_0x078f('0x28')],qs[_0x078f('0x2d')](_0xdb63ef[_0x078f('0x23')][_0x078f('0x2d')]));_0x5d308b[_0x078f('0x2c')]=_0x5d308b[_0x078f('0x2c')][_0x078f('0x2e')]?_0x5d308b[_0x078f('0x2c')]:_0x4a8b8e[_0x078f('0x28')];if(_0xdb63ef[_0x078f('0x23')]['includeAll']){_0x5d308b[_0x078f('0x22')]=[{'all':!![]}];}_0x5d308b=_['merge']({},_0x5d308b,_0xdb63ef[_0x078f('0x2f')]);return db[_0x078f('0x1c')][_0x078f('0x30')](_0x5d308b)['then'](handleEntityNotFound(_0x5480fb,null))[_0x078f('0x15')](respondWithResult(_0x5480fb,null))[_0x078f('0x26')](handleError(_0x5480fb,null));};exports[_0x078f('0x31')]=function(_0x87f017,_0x590b1c){return db['OpenchannelQueue'][_0x078f('0x31')](_0x87f017[_0x078f('0x32')],{})[_0x078f('0x15')](function(_0x561475){var _0x499b32=_0x87f017[_0x078f('0x33')][_0x078f('0x34')]({'plain':!![]});if(!_0x499b32)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x499b32[_0x078f('0x35')]===_0x078f('0x33')){var _0xbb0e6a=_0x561475[_0x078f('0x34')]({'plain':!![]});var _0x2ee201='OpenchannelQueues';return db[_0x078f('0x36')]['find']({'where':{'name':_0x2ee201,'userProfileId':_0x499b32[_0x078f('0x37')]},'raw':!![]})[_0x078f('0x15')](function(_0x5e5a4c){if(_0x5e5a4c&&_0x5e5a4c[_0x078f('0x38')]===0x0){return db['UserProfileResource']['create']({'name':_0xbb0e6a[_0x078f('0x19')],'resourceId':_0xbb0e6a['id'],'type':_0x5e5a4c[_0x078f('0x19')],'sectionId':_0x5e5a4c['id']},{})[_0x078f('0x15')](function(){return _0x561475;});}else{return _0x561475;}})[_0x078f('0x26')](function(_0x4adfda){logger[_0x078f('0x39')](_0x078f('0x3a'),_0x4adfda);throw _0x4adfda;});}return _0x561475;})[_0x078f('0x15')](respondWithResult(_0x590b1c,0xc9))[_0x078f('0x26')](handleError(_0x590b1c,null));};exports[_0x078f('0x13')]=function(_0x34b3b7,_0x58707c){if(_0x34b3b7[_0x078f('0x32')]['id']){delete _0x34b3b7[_0x078f('0x32')]['id'];}return db[_0x078f('0x1c')][_0x078f('0x30')]({'where':{'id':_0x34b3b7[_0x078f('0x27')]['id']}})[_0x078f('0x15')](handleEntityNotFound(_0x58707c,null))[_0x078f('0x15')](saveUpdates(_0x34b3b7['body'],null))[_0x078f('0x15')](respondWithResult(_0x58707c,null))[_0x078f('0x26')](handleError(_0x58707c,null));};exports['destroy']=function(_0x3dd593,_0x3702bf){return db['OpenchannelQueue']['find']({'where':{'id':_0x3dd593['params']['id']}})[_0x078f('0x15')](handleEntityNotFound(_0x3702bf,null))[_0x078f('0x15')](removeEntity(_0x3702bf,null))[_0x078f('0x26')](handleError(_0x3702bf,null));};exports['describe']=function(_0x40cae1,_0x3092ce){return db[_0x078f('0x1c')][_0x078f('0x3b')]()['then'](respondWithResult(_0x3092ce,null))[_0x078f('0x26')](handleError(_0x3092ce,null));};exports[_0x078f('0x3c')]=function(_0x2ce67c,_0x4052b7){var _0x5b8db7={'raw':!![],'where':{}},_0x44a493={},_0x1263be;return db[_0x078f('0x1c')][_0x078f('0x3d')]({'where':{'id':_0x2ce67c[_0x078f('0x27')]['id']}})['then'](handleEntityNotFound(_0x4052b7,null))['then'](function(_0x22f7da){if(_0x22f7da){_0x1263be=_0x22f7da[_0x078f('0x34')]({'plain':!![]});_0x44a493['model']=_['keys'](db[_0x078f('0x3e')]['rawAttributes']);_0x44a493['query']=_['keys'](_0x2ce67c[_0x078f('0x23')]);_0x44a493[_0x078f('0x3f')]=_['intersection'](_0x44a493[_0x078f('0x28')],_0x44a493['query']);_0x5b8db7[_0x078f('0x2c')]=_[_0x078f('0x2b')](_0x44a493[_0x078f('0x28')],qs[_0x078f('0x2d')](_0x2ce67c[_0x078f('0x23')]['fields']));_0x5b8db7[_0x078f('0x2c')]=_0x5b8db7[_0x078f('0x2c')][_0x078f('0x2e')]?_0x5b8db7[_0x078f('0x2c')]:_0x44a493[_0x078f('0x28')];if(!_0x2ce67c[_0x078f('0x23')][_0x078f('0x40')](_0x078f('0x41'))){_0x5b8db7[_0x078f('0x11')]=qs[_0x078f('0x11')](_0x2ce67c[_0x078f('0x23')][_0x078f('0x11')]);_0x5b8db7[_0x078f('0xf')]=qs[_0x078f('0xf')](_0x2ce67c['query'][_0x078f('0xf')]);}_0x5b8db7['order']=qs[_0x078f('0x42')](_0x2ce67c['query'][_0x078f('0x42')]);_0x5b8db7[_0x078f('0x20')]=qs[_0x078f('0x3f')](_[_0x078f('0x43')](_0x2ce67c[_0x078f('0x23')],_0x44a493[_0x078f('0x3f')]));_0x5b8db7[_0x078f('0x20')][_0x078f('0x44')]=_0x22f7da['id'];if(_0x2ce67c[_0x078f('0x23')]['filter']){_0x5b8db7[_0x078f('0x20')]=_['merge'](_0x5b8db7[_0x078f('0x20')],{'$or':_[_0x078f('0x45')](_0x5b8db7[_0x078f('0x2c')],function(_0xf4bf01){var _0x350a2b={};_0x350a2b[_0xf4bf01]={'$like':'%'+_0x2ce67c[_0x078f('0x23')][_0x078f('0x46')]+'%'};return _0x350a2b;})});}_0x5b8db7=_[_0x078f('0x47')]({},_0x5b8db7,_0x2ce67c[_0x078f('0x2f')]);return db[_0x078f('0x3e')][_0x078f('0x24')](_0x5b8db7);}})['then'](function(_0x2352fe){if(_0x2352fe){return db[_0x078f('0x48')][_0x078f('0x49')]({'where':{'id':_[_0x078f('0x45')](_0x2352fe,_0x078f('0x4a')),'role':_0x078f('0x4b')},'attributes':['id',_0x078f('0x19'),'openchannelPause',_0x078f('0x4c'),_0x078f('0x4d')]});}})[_0x078f('0x15')](function(_0x402842){if(_0x402842){return{'count':_0x402842[_0x078f('0x21')],'rows':_[_0x078f('0x45')](_0x402842['rows'],function(_0x50d8c5){return{'membername':_0x50d8c5[_0x078f('0x19')],'UserId':_0x50d8c5['id'],'queue_name':_0x1263be[_0x078f('0x19')],'OpenchannelQueueId':_0x1263be['id'],'interface':util[_0x078f('0x4e')]('%s/%s',_0x078f('0x4f'),_0x50d8c5[_0x078f('0x19')]),'penalty':0x0,'paused':_0x50d8c5['openchannelPause'],'createdAt':_0x50d8c5['createdAt'],'updatedAt':_0x50d8c5[_0x078f('0x4c')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4052b7,_0x5b8db7))[_0x078f('0x26')](handleError(_0x4052b7,null));};exports[_0x078f('0x50')]=function(_0x4f2105,_0x43a6b6){var _0x532957={};var _0x38cc2e={};var _0x57708d;var _0x532098;return db['OpenchannelQueue']['findOne']({'where':{'id':_0x4f2105[_0x078f('0x27')]['id']}})[_0x078f('0x15')](handleEntityNotFound(_0x43a6b6,null))[_0x078f('0x15')](function(_0x7196c3){if(_0x7196c3){_0x57708d=_0x7196c3;_0x38cc2e[_0x078f('0x28')]=_[_0x078f('0x29')](db[_0x078f('0x51')]['rawAttributes']);_0x38cc2e['query']=_[_0x078f('0x29')](_0x4f2105['query']);_0x38cc2e['filters']=_[_0x078f('0x2b')](_0x38cc2e[_0x078f('0x28')],_0x38cc2e[_0x078f('0x23')]);_0x532957[_0x078f('0x2c')]=_[_0x078f('0x2b')](_0x38cc2e[_0x078f('0x28')],qs[_0x078f('0x2d')](_0x4f2105[_0x078f('0x23')][_0x078f('0x2d')]));_0x532957[_0x078f('0x2c')]=_0x532957[_0x078f('0x2c')][_0x078f('0x2e')]?_0x532957[_0x078f('0x2c')]:_0x38cc2e[_0x078f('0x28')];_0x532957['order']=qs['sort'](_0x4f2105[_0x078f('0x23')][_0x078f('0x42')]);_0x532957[_0x078f('0x20')]=qs[_0x078f('0x3f')](_[_0x078f('0x43')](_0x4f2105[_0x078f('0x23')],_0x38cc2e[_0x078f('0x3f')]));if(_0x4f2105[_0x078f('0x23')][_0x078f('0x46')]){_0x532957[_0x078f('0x20')]=_[_0x078f('0x47')](_0x532957[_0x078f('0x20')],{'$or':_[_0x078f('0x45')](_0x532957['attributes'],function(_0x236321){var _0x5087c6={};_0x5087c6[_0x236321]={'$like':'%'+_0x4f2105[_0x078f('0x23')][_0x078f('0x46')]+'%'};return _0x5087c6;})});}_0x532957=_[_0x078f('0x47')]({},_0x532957,_0x4f2105[_0x078f('0x2f')]);return _0x57708d[_0x078f('0x50')](_0x532957);}})['then'](function(_0x8e1fae){if(_0x8e1fae){_0x532098=_0x8e1fae[_0x078f('0x2e')];if(!_0x4f2105['query'][_0x078f('0x40')]('nolimit')){_0x532957[_0x078f('0x11')]=qs[_0x078f('0x11')](_0x4f2105[_0x078f('0x23')][_0x078f('0x11')]);_0x532957[_0x078f('0xf')]=qs['offset'](_0x4f2105[_0x078f('0x23')][_0x078f('0xf')]);}return _0x57708d[_0x078f('0x50')](_0x532957);}})['then'](function(_0x59d969){if(_0x59d969){return _0x59d969?{'count':_0x532098,'rows':_0x59d969}:null;}})[_0x078f('0x15')](respondWithResult(_0x43a6b6,null))['catch'](handleError(_0x43a6b6,null));};exports['addTeams']=function(_0x4051c5,_0x45886f){var _0x44be81=_0x4051c5[_0x078f('0x32')][_0x078f('0x52')];return db[_0x078f('0x51')]['findAll']({'where':{'id':_0x44be81},'attributes':['id'],'include':[{'model':db[_0x078f('0x48')],'as':_0x078f('0x53'),'attributes':['id',_0x078f('0x19'),_0x078f('0x54'),_0x078f('0x55'),_0x078f('0x56')],'raw':!![]}]})[_0x078f('0x15')](function(_0x2cfbbd){if(_0x2cfbbd){var _0x377469=_[_0x078f('0x57')](_0x2cfbbd,function(_0x5b1cae){var _0x413fdd=_0x5b1cae[_0x078f('0x34')]({'plain':!![]});return _0x413fdd[_0x078f('0x53')];});return db['OpenchannelQueue'][_0x078f('0x30')]({'where':{'id':_0x4051c5['params']['id']}})[_0x078f('0x15')](function(_0x13fa59){return db[_0x078f('0x58')][_0x078f('0x59')](function(_0x1a1fc1){return _0x13fa59[_0x078f('0x5a')](_0x44be81,{'transaction':_0x1a1fc1})[_0x078f('0x15')](function(){return BPromise[_0x078f('0x5b')](_0x377469,function(_0x39157e){return db['UserOpenchannelQueue']['findOrCreate']({'where':{'UserId':_0x39157e['id'],'OpenchannelQueueId':_0x4051c5['params']['id']},'transaction':_0x1a1fc1});});})['then'](function(){_0x377469[_0x078f('0x5c')](function(_0x116556){socket[_0x078f('0x5d')]('userOpenchannelQueue:save',{'UserId':_0x116556['id'],'OpenchannelQueueId':_0x13fa59['id']});});});});});}})[_0x078f('0x15')](respondWithStatusCode(_0x45886f,null))[_0x078f('0x26')](handleError(_0x45886f,null));};exports['removeTeams']=function(_0x3c210f,_0x5bc776){return db[_0x078f('0x51')][_0x078f('0x24')]({'where':{'id':_0x3c210f[_0x078f('0x23')]['ids']},'attributes':['id'],'include':[{'model':db[_0x078f('0x48')],'as':_0x078f('0x53'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5bc776,null))[_0x078f('0x15')](function(_0x43edc3){var _0x1a8832=_[_0x078f('0x45')](_0x43edc3,'id');var _0x3be4a1=[];var _0x1491dc=[];var _0x1bb648=squel['select']();_0x1bb648[_0x078f('0x5e')](_0x078f('0x5f'))['from'](_0x078f('0x60'),'tq')[_0x078f('0x61')](_0x078f('0x62'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x078f('0x20')]('OpenchannelQueueId\x20=\x20?',_0x3c210f[_0x078f('0x27')]['id']);for(var _0x34c9fa=0x0;_0x34c9fa<_0x43edc3['length'];_0x34c9fa+=0x1){let _0xd5844d=_0x43edc3[_0x34c9fa];for(var _0x51c70a=0x0;_0x51c70a<_0xd5844d['Agents'][_0x078f('0x2e')];_0x51c70a+=0x1){let _0x3f27cf=_0xd5844d[_0x078f('0x53')][_0x51c70a];var _0x488b43=_0x1bb648[_0x078f('0x63')]();_0x488b43[_0x078f('0x20')](_0x078f('0x64'),_0x3f27cf['id']);_0x1491dc[_0x078f('0x65')](db[_0x078f('0x58')]['query'](_0x488b43[_0x078f('0x66')](),{'type':db[_0x078f('0x58')]['QueryTypes'][_0x078f('0x67')]})[_0x078f('0x15')](function(_0x7789f9){if(_0x7789f9['length']===0x1){return _0x3f27cf['id'];}else{var _0x54d9da=_[_0x078f('0x68')](_[_0x078f('0x45')](_0x7789f9,'TeamId'),function(_0x1c4124){return _[_0x078f('0x69')](_0x1a8832,_0x1c4124);});if(_0x54d9da){return _0x3f27cf['id'];}}}));}}return BPromise[_0x078f('0x6a')](_0x1491dc)['then'](function(_0x2ff726){_0x3be4a1=_(_0x3be4a1)[_0x078f('0x6b')](_0x2ff726)[_0x078f('0x6c')]()[_0x078f('0x6d')]();return db['OpenchannelQueue'][_0x078f('0x30')]({'where':{'id':_0x3c210f[_0x078f('0x27')]['id']}})[_0x078f('0x15')](function(_0x1428b2){return db[_0x078f('0x58')]['transaction'](function(_0x2da27d){return _0x1428b2[_0x078f('0x6e')](_0x3c210f[_0x078f('0x23')]['ids'],{'transaction':_0x2da27d})['then'](function(){if(!_['isEmpty'](_0x3be4a1)){return _0x1428b2[_0x078f('0x6f')](_0x3be4a1,{'transaction':_0x2da27d});}})[_0x078f('0x15')](function(){_0x3be4a1[_0x078f('0x5c')](function(_0x2b9fb9){socket['emit'](_0x078f('0x70'),{'UserId':_0x2b9fb9,'OpenchannelQueueId':_0x1428b2['id']});});});});});});})[_0x078f('0x15')](respondWithStatusCode(_0x5bc776,null))[_0x078f('0x26')](handleError(_0x5bc776,null));};exports[_0x078f('0x71')]=function(_0x3becb8,_0x601054){return db['OpenchannelQueue']['find']({'where':{'id':_0x3becb8[_0x078f('0x27')]['id']}})['then'](handleEntityNotFound(_0x601054,null))[_0x078f('0x15')](function(_0x310d0d){if(_0x310d0d){return _0x310d0d[_0x078f('0x71')](_0x3becb8[_0x078f('0x32')]['ids'],_['omit'](_0x3becb8[_0x078f('0x32')],['ids','id'])||{})[_0x078f('0x72')](function(_0x29cf6f){for(var _0x120bde=0x0;_0x120bde<_0x3becb8[_0x078f('0x32')][_0x078f('0x52')][_0x078f('0x2e')];_0x120bde+=0x1){socket[_0x078f('0x5d')](_0x078f('0x73'),{'UserId':Number(_0x3becb8[_0x078f('0x32')][_0x078f('0x52')][_0x120bde]),'OpenchannelQueueId':Number(_0x3becb8[_0x078f('0x27')]['id'])});}return _0x29cf6f;});}})[_0x078f('0x15')](respondWithResult(_0x601054,null))[_0x078f('0x26')](handleError(_0x601054,null));};exports[_0x078f('0x6f')]=function(_0x185788,_0x246d3d){return db[_0x078f('0x1c')]['find']({'where':{'id':_0x185788['params']['id']}})[_0x078f('0x15')](handleEntityNotFound(_0x246d3d,null))[_0x078f('0x15')](function(_0x3a191d){if(_0x3a191d){return _0x3a191d[_0x078f('0x6f')](_0x185788[_0x078f('0x23')][_0x078f('0x52')])[_0x078f('0x15')](function(){if(_[_0x078f('0x74')](_0x185788[_0x078f('0x23')][_0x078f('0x52')])){for(var _0x15902e=0x0;_0x15902e<_0x185788[_0x078f('0x23')]['ids'][_0x078f('0x2e')];_0x15902e+=0x1){socket['emit'](_0x078f('0x70'),{'UserId':Number(_0x185788[_0x078f('0x23')][_0x078f('0x52')][_0x15902e]),'OpenchannelQueueId':Number(_0x185788[_0x078f('0x27')]['id'])});}}else{socket[_0x078f('0x5d')](_0x078f('0x70'),{'UserId':Number(_0x185788[_0x078f('0x23')]['ids']),'OpenchannelQueueId':Number(_0x185788['params']['id'])});}});}})[_0x078f('0x15')](respondWithStatusCode(_0x246d3d,null))['catch'](handleError(_0x246d3d,null));};exports[_0x078f('0x75')]=function(_0x3eed6b,_0x38e3ba){var _0x597a63={};var _0xf9ac3={};var _0x5ae236;var _0x2727ab;return db[_0x078f('0x1c')]['findOne']({'where':{'id':_0x3eed6b[_0x078f('0x27')]['id']}})[_0x078f('0x15')](handleEntityNotFound(_0x38e3ba,null))[_0x078f('0x15')](function(_0x421c4e){if(_0x421c4e){_0x5ae236=_0x421c4e;_0xf9ac3[_0x078f('0x28')]=_['keys'](db[_0x078f('0x48')][_0x078f('0x2a')]);_0xf9ac3[_0x078f('0x23')]=_[_0x078f('0x29')](_0x3eed6b[_0x078f('0x23')]);_0xf9ac3[_0x078f('0x3f')]=_[_0x078f('0x2b')](_0xf9ac3[_0x078f('0x28')],_0xf9ac3[_0x078f('0x23')]);_0x597a63[_0x078f('0x2c')]=_[_0x078f('0x2b')](_0xf9ac3[_0x078f('0x28')],qs['fields'](_0x3eed6b[_0x078f('0x23')][_0x078f('0x2d')]));_0x597a63['attributes']=_0x597a63[_0x078f('0x2c')][_0x078f('0x2e')]?_0x597a63['attributes']:_0xf9ac3[_0x078f('0x28')];_0x597a63[_0x078f('0x76')]=qs[_0x078f('0x42')](_0x3eed6b[_0x078f('0x23')][_0x078f('0x42')]);_0x597a63[_0x078f('0x20')]=qs[_0x078f('0x3f')](_['pick'](_0x3eed6b['query'],_0xf9ac3[_0x078f('0x3f')]));if(_0x3eed6b[_0x078f('0x23')][_0x078f('0x46')]){_0x597a63[_0x078f('0x20')]=_[_0x078f('0x47')](_0x597a63[_0x078f('0x20')],{'$or':_['map'](_0x597a63[_0x078f('0x2c')],function(_0x16a867){var _0x27d2aa={};_0x27d2aa[_0x16a867]={'$like':'%'+_0x3eed6b[_0x078f('0x23')][_0x078f('0x46')]+'%'};return _0x27d2aa;})});}_0x597a63=_[_0x078f('0x47')]({},_0x597a63,_0x3eed6b['options']);return _0x5ae236['getAgents'](_0x597a63);}})[_0x078f('0x15')](function(_0x5c5122){if(_0x5c5122){_0x2727ab=_0x5c5122['length'];if(!_0x3eed6b[_0x078f('0x23')]['hasOwnProperty']('nolimit')){_0x597a63[_0x078f('0x11')]=qs[_0x078f('0x11')](_0x3eed6b[_0x078f('0x23')][_0x078f('0x11')]);_0x597a63[_0x078f('0xf')]=qs[_0x078f('0xf')](_0x3eed6b[_0x078f('0x23')][_0x078f('0xf')]);}return _0x5ae236['getAgents'](_0x597a63);}})['then'](function(_0x4d49cd){if(_0x4d49cd){return _0x4d49cd?{'count':_0x2727ab,'rows':_0x4d49cd}:null;}})[_0x078f('0x15')](respondWithResult(_0x38e3ba,null))[_0x078f('0x26')](handleError(_0x38e3ba,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index bcc074f..a30fd19 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 _0x33aa=['exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x267d29,_0x27f1fe){var _0x4cd7c9=function(_0x4526d4){while(--_0x4526d4){_0x267d29['push'](_0x267d29['shift']());}};_0x4cd7c9(++_0x27f1fe);}(_0x33aa,0x18d));var _0xa33a=function(_0x2c6fa1,_0x288773){_0x2c6fa1=_0x2c6fa1-0x0;var _0x3a0f72=_0x33aa[_0x2c6fa1];return _0x3a0f72;};'use strict';var EventEmitter=require(_0xa33a('0x0'));var OpenchannelQueue=require(_0xa33a('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xa33a('0x2')](0x0);var events={'afterCreate':_0xa33a('0x3'),'afterUpdate':_0xa33a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x2c2e08){return function(_0x3f94c2,_0x9162d9,_0x442cfd){OpenchannelQueueEvents[_0xa33a('0x5')](_0x2c2e08+':'+_0x3f94c2['id'],_0x3f94c2);OpenchannelQueueEvents[_0xa33a('0x5')](_0x2c2e08,_0x3f94c2);_0x442cfd(null);};}for(var e in events){if(events[_0xa33a('0x6')](e)){var event=events[e];OpenchannelQueue[_0xa33a('0x7')](e,emitEvent(event));}}module[_0xa33a('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x1a99=['hasOwnProperty','hook','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit'];(function(_0x56c358,_0x3c0712){var _0x4b0030=function(_0x54dd66){while(--_0x54dd66){_0x56c358['push'](_0x56c358['shift']());}};_0x4b0030(++_0x3c0712);}(_0x1a99,0x98));var _0x91a9=function(_0x153738,_0xe704c1){_0x153738=_0x153738-0x0;var _0x3028d9=_0x1a99[_0x153738];return _0x3028d9;};'use strict';var EventEmitter=require(_0x91a9('0x0'));var OpenchannelQueue=require(_0x91a9('0x1'))['db'][_0x91a9('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x91a9('0x3')](0x0);var events={'afterCreate':_0x91a9('0x4'),'afterUpdate':_0x91a9('0x5'),'afterDestroy':_0x91a9('0x6')};function emitEvent(_0x1f4645){return function(_0x53de9c,_0x200d60,_0x7ea080){OpenchannelQueueEvents['emit'](_0x1f4645+':'+_0x53de9c['id'],_0x53de9c);OpenchannelQueueEvents[_0x91a9('0x7')](_0x1f4645,_0x53de9c);_0x7ea080(null);};}for(var e in events){if(events[_0x91a9('0x8')](e)){var event=events[e];OpenchannelQueue[_0x91a9('0x9')](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 056651c..53e33a2 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 _0x41c9=['rimraf','../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','../../config/logger','moment','request-promise','path'];(function(_0x4783a4,_0x5850ad){var _0x48be62=function(_0x369583){while(--_0x369583){_0x4783a4['push'](_0x4783a4['shift']());}};_0x48be62(++_0x5850ad);}(_0x41c9,0xc2));var _0x941c=function(_0x156699,_0x2d2351){_0x156699=_0x156699-0x0;var _0x50d475=_0x41c9[_0x156699];return _0x50d475;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x941c('0x0'))('api');var moment=require(_0x941c('0x1'));var BPromise=require('bluebird');var rp=require(_0x941c('0x2'));var fs=require('fs');var path=require(_0x941c('0x3'));var rimraf=require(_0x941c('0x4'));var config=require(_0x941c('0x5'));var attributes=require(_0x941c('0x6'));module[_0x941c('0x7')]=function(_0x2bb6ac,_0x557d6f){return _0x2bb6ac[_0x941c('0x8')](_0x941c('0x9'),attributes,{'tableName':_0x941c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb64f=['../../config/logger','api','moment','bluebird','request-promise','path','./openchannelQueue.attributes','exports','OpenchannelQueue','lodash'];(function(_0x3b3362,_0x202631){var _0x223f5b=function(_0x21a21d){while(--_0x21a21d){_0x3b3362['push'](_0x3b3362['shift']());}};_0x223f5b(++_0x202631);}(_0xb64f,0x1b7));var _0xfb64=function(_0x5e3a45,_0x45f0c5){_0x5e3a45=_0x5e3a45-0x0;var _0x13419f=_0xb64f[_0x5e3a45];return _0x13419f;};'use strict';var _=require(_0xfb64('0x0'));var util=require('util');var logger=require(_0xfb64('0x1'))(_0xfb64('0x2'));var moment=require(_0xfb64('0x3'));var BPromise=require(_0xfb64('0x4'));var rp=require(_0xfb64('0x5'));var fs=require('fs');var path=require(_0xfb64('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfb64('0x7'));module[_0xfb64('0x8')]=function(_0x1aa76f,_0x340e46){return _0x1aa76f['define'](_0xfb64('0x9'),attributes,{'tableName':'openchannel_queues','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 21f02f6..831e841 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 _0x9c45=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','then','info','request\x20sent','debug','error','code','OpenchannelQueue,\x20%s,\x20%s','message','result','catch','GetOpenchannelQueue','findAll','options','where','limit','include','map','attributes','model','stringify','find','raw','ShowOpenchannelQueue','util','ioredis'];(function(_0x2d94f6,_0x12b913){var _0x4c0f45=function(_0x4cc7ea){while(--_0x4cc7ea){_0x2d94f6['push'](_0x2d94f6['shift']());}};_0x4c0f45(++_0x12b913);}(_0x9c45,0x101));var _0x59c4=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9c45[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x59c4('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59c4('0x1'));var db=require(_0x59c4('0x2'))['db'];var utils=require(_0x59c4('0x3'));var logger=require(_0x59c4('0x4'))(_0x59c4('0x5'));var config=require(_0x59c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x59c4('0x7')][_0x59c4('0x8')]({'port':0x232a});config[_0x59c4('0x9')]=_[_0x59c4('0xa')](config[_0x59c4('0x9')],{'host':_0x59c4('0xb'),'port':0x18eb});var socket=require(_0x59c4('0xc'))(new Redis(config[_0x59c4('0x9')]));require('./openchannelQueue.socket')[_0x59c4('0xd')](socket);function respondWithRpcPromise(_0x19114b,_0x905af2,_0x581b45){return new BPromise(function(_0x508392,_0x4b341d){return client['request'](_0x19114b,_0x581b45)[_0x59c4('0xe')](function(_0x35f571){logger[_0x59c4('0xf')]('OpenchannelQueue,\x20%s,\x20%s',_0x905af2,_0x59c4('0x10'));logger[_0x59c4('0x11')]('OpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x905af2,'request\x20sent',JSON['stringify'](_0x35f571));if(_0x35f571[_0x59c4('0x12')]){if(_0x35f571[_0x59c4('0x12')][_0x59c4('0x13')]===0x1f4){logger[_0x59c4('0x12')](_0x59c4('0x14'),_0x905af2,_0x35f571[_0x59c4('0x12')][_0x59c4('0x15')]);return _0x4b341d(_0x35f571[_0x59c4('0x12')][_0x59c4('0x15')]);}logger[_0x59c4('0x12')](_0x59c4('0x14'),_0x905af2,_0x35f571['error']['message']);return _0x508392(_0x35f571['error'][_0x59c4('0x15')]);}else{logger[_0x59c4('0xf')](_0x59c4('0x14'),_0x905af2,_0x59c4('0x10'));_0x508392(_0x35f571[_0x59c4('0x16')]['message']);}})[_0x59c4('0x17')](function(_0x57dbad){logger[_0x59c4('0x12')]('OpenchannelQueue,\x20%s,\x20%s',_0x905af2,_0x57dbad);_0x4b341d(_0x57dbad);});});}exports[_0x59c4('0x18')]=function(_0x5b1d94){var _0x2b1159=this;return new Promise(function(_0x232472,_0x12e159){return db['OpenchannelQueue'][_0x59c4('0x19')]({'raw':_0x5b1d94[_0x59c4('0x1a')]?_0x5b1d94[_0x59c4('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x5b1d94[_0x59c4('0x1a')]?_0x5b1d94['options'][_0x59c4('0x1b')]||null:null,'attributes':_0x5b1d94['options']?_0x5b1d94[_0x59c4('0x1a')]['attributes']||null:null,'limit':_0x5b1d94[_0x59c4('0x1a')]?_0x5b1d94[_0x59c4('0x1a')][_0x59c4('0x1c')]||null:null,'include':_0x5b1d94['options']?_0x5b1d94[_0x59c4('0x1a')][_0x59c4('0x1d')]?_[_0x59c4('0x1e')](_0x5b1d94[_0x59c4('0x1a')]['include'],function(_0x5e2611){return{'model':db[_0x5e2611['model']],'as':_0x5e2611['as'],'attributes':_0x5e2611[_0x59c4('0x1f')],'include':_0x5e2611[_0x59c4('0x1d')]?_['map'](_0x5e2611[_0x59c4('0x1d')],function(_0x1a1def){return{'model':db[_0x1a1def[_0x59c4('0x20')]],'as':_0x1a1def['as'],'attributes':_0x1a1def[_0x59c4('0x1f')],'include':_0x1a1def[_0x59c4('0x1d')]?_['map'](_0x1a1def[_0x59c4('0x1d')],function(_0x5a8c5a){return{'model':db[_0x5a8c5a[_0x59c4('0x20')]],'as':_0x5a8c5a['as'],'attributes':_0x5a8c5a[_0x59c4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x59c4('0xe')](function(_0x35a269){logger[_0x59c4('0xf')](_0x59c4('0x18'),_0x5b1d94);logger[_0x59c4('0x11')]('GetOpenchannelQueue',_0x5b1d94,JSON[_0x59c4('0x21')](_0x35a269));_0x232472(_0x35a269);})[_0x59c4('0x17')](function(_0x158515){logger[_0x59c4('0x12')](_0x59c4('0x18'),_0x158515[_0x59c4('0x15')],_0x5b1d94);_0x12e159(_0x2b1159[_0x59c4('0x12')](0x1f4,_0x158515[_0x59c4('0x15')]));});});};exports['ShowOpenchannelQueue']=function(_0x4630bc){var _0x402950=this;return new Promise(function(_0x267bc9,_0x508535){return db['OpenchannelQueue'][_0x59c4('0x22')]({'raw':_0x4630bc['options']?_0x4630bc[_0x59c4('0x1a')][_0x59c4('0x23')]===undefined?!![]:![]:!![],'where':_0x4630bc[_0x59c4('0x1a')]?_0x4630bc[_0x59c4('0x1a')][_0x59c4('0x1b')]||null:null,'attributes':_0x4630bc[_0x59c4('0x1a')]?_0x4630bc[_0x59c4('0x1a')][_0x59c4('0x1f')]||null:null,'include':_0x4630bc[_0x59c4('0x1a')]?_0x4630bc[_0x59c4('0x1a')][_0x59c4('0x1d')]?_[_0x59c4('0x1e')](_0x4630bc['options'][_0x59c4('0x1d')],function(_0x192141){return{'model':db[_0x192141['model']],'as':_0x192141['as'],'attributes':_0x192141[_0x59c4('0x1f')],'include':_0x192141[_0x59c4('0x1d')]?_[_0x59c4('0x1e')](_0x192141['include'],function(_0x113e83){return{'model':db[_0x113e83['model']],'as':_0x113e83['as'],'attributes':_0x113e83[_0x59c4('0x1f')],'include':_0x113e83[_0x59c4('0x1d')]?_[_0x59c4('0x1e')](_0x113e83[_0x59c4('0x1d')],function(_0x5f52fe){return{'model':db[_0x5f52fe['model']],'as':_0x5f52fe['as'],'attributes':_0x5f52fe['attributes']};}):[]};}):[]};}):[]:[]})[_0x59c4('0xe')](function(_0xeaa69e){logger['info'](_0x59c4('0x24'),_0x4630bc);logger[_0x59c4('0x11')]('ShowOpenchannelQueue',_0x4630bc,JSON[_0x59c4('0x21')](_0xeaa69e));_0x267bc9(_0xeaa69e);})[_0x59c4('0x17')](function(_0xa03c13){logger[_0x59c4('0x12')](_0x59c4('0x24'),_0xa03c13[_0x59c4('0x15')],_0x4630bc);_0x508535(_0x402950['error'](0x1f4,_0xa03c13[_0x59c4('0x15')]));});});}; \ No newline at end of file +var _0x6d4d=['OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','OpenchannelQueue','findAll','options','where','limit','include','map','model','attributes','then','GetOpenchannelQueue','debug','stringify','find','raw','ShowOpenchannelQueue','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','request'];(function(_0x5a4c60,_0x5a4a28){var _0xbc97b4=function(_0x928577){while(--_0x928577){_0x5a4c60['push'](_0x5a4c60['shift']());}};_0xbc97b4(++_0x5a4a28);}(_0x6d4d,0x16e));var _0xd6d4=function(_0x16e0c8,_0x4861eb){_0x16e0c8=_0x16e0c8-0x0;var _0xe4b5af=_0x6d4d[_0x16e0c8];return _0xe4b5af;};'use strict';var _=require('lodash');var util=require(_0xd6d4('0x0'));var moment=require(_0xd6d4('0x1'));var BPromise=require('bluebird');var rs=require(_0xd6d4('0x2'));var fs=require('fs');var Redis=require(_0xd6d4('0x3'));var db=require(_0xd6d4('0x4'))['db'];var utils=require(_0xd6d4('0x5'));var logger=require(_0xd6d4('0x6'))(_0xd6d4('0x7'));var config=require(_0xd6d4('0x8'));var jayson=require(_0xd6d4('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xd6d4('0xa')]=_[_0xd6d4('0xb')](config[_0xd6d4('0xa')],{'host':_0xd6d4('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd6d4('0xa')]));require('./openchannelQueue.socket')['register'](socket);function respondWithRpcPromise(_0x3fd830,_0x48f3ea,_0x44ba51){return new BPromise(function(_0x423faa,_0x12f90a){return client[_0xd6d4('0xd')](_0x3fd830,_0x44ba51)['then'](function(_0x2b5ad6){logger['info'](_0xd6d4('0xe'),_0x48f3ea,_0xd6d4('0xf'));logger['debug'](_0xd6d4('0x10'),_0x48f3ea,_0xd6d4('0xf'),JSON['stringify'](_0x2b5ad6));if(_0x2b5ad6[_0xd6d4('0x11')]){if(_0x2b5ad6['error']['code']===0x1f4){logger[_0xd6d4('0x11')](_0xd6d4('0xe'),_0x48f3ea,_0x2b5ad6['error'][_0xd6d4('0x12')]);return _0x12f90a(_0x2b5ad6[_0xd6d4('0x11')][_0xd6d4('0x12')]);}logger[_0xd6d4('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x48f3ea,_0x2b5ad6['error']['message']);return _0x423faa(_0x2b5ad6[_0xd6d4('0x11')][_0xd6d4('0x12')]);}else{logger[_0xd6d4('0x13')](_0xd6d4('0xe'),_0x48f3ea,_0xd6d4('0xf'));_0x423faa(_0x2b5ad6[_0xd6d4('0x14')][_0xd6d4('0x12')]);}})[_0xd6d4('0x15')](function(_0x5e7a64){logger[_0xd6d4('0x11')]('OpenchannelQueue,\x20%s,\x20%s',_0x48f3ea,_0x5e7a64);_0x12f90a(_0x5e7a64);});});}exports['GetOpenchannelQueue']=function(_0x45d513){var _0x3be668=this;return new Promise(function(_0x1fc5dd,_0x22f2e6){return db[_0xd6d4('0x16')][_0xd6d4('0x17')]({'raw':_0x45d513[_0xd6d4('0x18')]?_0x45d513[_0xd6d4('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x45d513[_0xd6d4('0x18')]?_0x45d513['options'][_0xd6d4('0x19')]||null:null,'attributes':_0x45d513[_0xd6d4('0x18')]?_0x45d513[_0xd6d4('0x18')]['attributes']||null:null,'limit':_0x45d513[_0xd6d4('0x18')]?_0x45d513[_0xd6d4('0x18')][_0xd6d4('0x1a')]||null:null,'include':_0x45d513['options']?_0x45d513[_0xd6d4('0x18')][_0xd6d4('0x1b')]?_[_0xd6d4('0x1c')](_0x45d513[_0xd6d4('0x18')][_0xd6d4('0x1b')],function(_0x4d5013){return{'model':db[_0x4d5013[_0xd6d4('0x1d')]],'as':_0x4d5013['as'],'attributes':_0x4d5013[_0xd6d4('0x1e')],'include':_0x4d5013[_0xd6d4('0x1b')]?_['map'](_0x4d5013[_0xd6d4('0x1b')],function(_0x5d169f){return{'model':db[_0x5d169f[_0xd6d4('0x1d')]],'as':_0x5d169f['as'],'attributes':_0x5d169f[_0xd6d4('0x1e')],'include':_0x5d169f[_0xd6d4('0x1b')]?_['map'](_0x5d169f['include'],function(_0x257f1e){return{'model':db[_0x257f1e[_0xd6d4('0x1d')]],'as':_0x257f1e['as'],'attributes':_0x257f1e[_0xd6d4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd6d4('0x1f')](function(_0x49e828){logger[_0xd6d4('0x13')](_0xd6d4('0x20'),_0x45d513);logger[_0xd6d4('0x21')]('GetOpenchannelQueue',_0x45d513,JSON[_0xd6d4('0x22')](_0x49e828));_0x1fc5dd(_0x49e828);})[_0xd6d4('0x15')](function(_0x124575){logger['error']('GetOpenchannelQueue',_0x124575['message'],_0x45d513);_0x22f2e6(_0x3be668[_0xd6d4('0x11')](0x1f4,_0x124575[_0xd6d4('0x12')]));});});};exports['ShowOpenchannelQueue']=function(_0x175f5a){var _0x6eff45=this;return new Promise(function(_0xb7f806,_0x67dd30){return db['OpenchannelQueue'][_0xd6d4('0x23')]({'raw':_0x175f5a[_0xd6d4('0x18')]?_0x175f5a[_0xd6d4('0x18')][_0xd6d4('0x24')]===undefined?!![]:![]:!![],'where':_0x175f5a[_0xd6d4('0x18')]?_0x175f5a[_0xd6d4('0x18')][_0xd6d4('0x19')]||null:null,'attributes':_0x175f5a['options']?_0x175f5a['options'][_0xd6d4('0x1e')]||null:null,'include':_0x175f5a[_0xd6d4('0x18')]?_0x175f5a[_0xd6d4('0x18')][_0xd6d4('0x1b')]?_[_0xd6d4('0x1c')](_0x175f5a[_0xd6d4('0x18')][_0xd6d4('0x1b')],function(_0x57f14a){return{'model':db[_0x57f14a['model']],'as':_0x57f14a['as'],'attributes':_0x57f14a['attributes'],'include':_0x57f14a[_0xd6d4('0x1b')]?_['map'](_0x57f14a[_0xd6d4('0x1b')],function(_0x36d902){return{'model':db[_0x36d902[_0xd6d4('0x1d')]],'as':_0x36d902['as'],'attributes':_0x36d902[_0xd6d4('0x1e')],'include':_0x36d902['include']?_[_0xd6d4('0x1c')](_0x36d902['include'],function(_0x24d61d){return{'model':db[_0x24d61d[_0xd6d4('0x1d')]],'as':_0x24d61d['as'],'attributes':_0x24d61d[_0xd6d4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xd6d4('0x1f')](function(_0x2bb048){logger['info']('ShowOpenchannelQueue',_0x175f5a);logger[_0xd6d4('0x21')](_0xd6d4('0x25'),_0x175f5a,JSON[_0xd6d4('0x22')](_0x2bb048));_0xb7f806(_0x2bb048);})[_0xd6d4('0x15')](function(_0x31c421){logger[_0xd6d4('0x11')]('ShowOpenchannelQueue',_0x31c421[_0xd6d4('0x12')],_0x175f5a);_0x67dd30(_0x6eff45[_0xd6d4('0x11')](0x1f4,_0x31c421[_0xd6d4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index 6edfc3f..b6ee1f7 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 _0x9ab1=['register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x9ab1,0x16b));var _0x19ab=function(_0x26c51c,_0x3d0b32){_0x26c51c=_0x26c51c-0x0;var _0x4285d3=_0x9ab1[_0x26c51c];return _0x4285d3;};'use strict';var OpenchannelQueueEvents=require(_0x19ab('0x0'));var events=[_0x19ab('0x1'),_0x19ab('0x2'),_0x19ab('0x3')];function createListener(_0x4e1e13,_0x5ad849){return function(_0x36169d){_0x5ad849[_0x19ab('0x4')](_0x4e1e13,_0x36169d);};}function removeListener(_0x4b6c8e,_0x1dce64){return function(){OpenchannelQueueEvents['removeListener'](_0x4b6c8e,_0x1dce64);};}exports[_0x19ab('0x5')]=function(_0x2608f3){for(var _0x297c10=0x0,_0x1e43da=events[_0x19ab('0x6')];_0x297c10<_0x1e43da;_0x297c10++){var _0x4d29be=events[_0x297c10];var _0x36ef19=createListener(_0x19ab('0x7')+_0x4d29be,_0x2608f3);OpenchannelQueueEvents['on'](_0x4d29be,_0x36ef19);}}; \ No newline at end of file +var _0x4fd0=['openchannelQueue:','update','removeListener','length'];(function(_0x20a310,_0x5e32b7){var _0x10ae7b=function(_0x57b81f){while(--_0x57b81f){_0x20a310['push'](_0x20a310['shift']());}};_0x10ae7b(++_0x5e32b7);}(_0x4fd0,0x1f1));var _0x04fd=function(_0x4b6a01,_0x386039){_0x4b6a01=_0x4b6a01-0x0;var _0xc374a3=_0x4fd0[_0x4b6a01];return _0xc374a3;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=['save','remove',_0x04fd('0x0')];function createListener(_0x56871b,_0xd72991){return function(_0x36f6cb){_0xd72991['emit'](_0x56871b,_0x36f6cb);};}function removeListener(_0x33c417,_0x27096a){return function(){OpenchannelQueueEvents[_0x04fd('0x1')](_0x33c417,_0x27096a);};}exports['register']=function(_0x516f33){for(var _0x7f8f7d=0x0,_0x5bc61c=events[_0x04fd('0x2')];_0x7f8f7d<_0x5bc61c;_0x7f8f7d++){var _0x44bdf6=events[_0x7f8f7d];var _0x3be3c2=createListener(_0x04fd('0x3')+_0x44bdf6,_0x516f33);OpenchannelQueueEvents['on'](_0x44bdf6,_0x3be3c2);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index eab71ad..b895551 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 _0x5623=['isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./openchannelQueueReport.controller','index','get','/describe'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x5623,0x181));var _0x3562=function(_0x5b0d70,_0x3d5e33){_0x5b0d70=_0x5b0d70-0x0;var _0x5b3eb9=_0x5623[_0x5b0d70];return _0x5b3eb9;};'use strict';var multer=require(_0x3562('0x0'));var util=require('util');var path=require(_0x3562('0x1'));var timeout=require(_0x3562('0x2'));var express=require(_0x3562('0x3'));var router=express[_0x3562('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3562('0x5'));var interaction=require(_0x3562('0x6'));var config=require('../../config/environment');var controller=require(_0x3562('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3562('0x8')]);router[_0x3562('0x9')](_0x3562('0xa'),auth[_0x3562('0xb')](),controller[_0x3562('0xc')]);router['get'](_0x3562('0xd'),auth[_0x3562('0xb')](),controller[_0x3562('0xe')]);router[_0x3562('0xf')]('/',auth[_0x3562('0xb')](),controller[_0x3562('0x10')]);router[_0x3562('0x11')](_0x3562('0xd'),auth[_0x3562('0xb')](),controller[_0x3562('0x12')]);router[_0x3562('0x13')](_0x3562('0xd'),auth['isAuthenticated'](),controller[_0x3562('0x14')]);module[_0x3562('0x15')]=router; \ No newline at end of file +var _0xe3a2=['index','describe','/:id','show','post','put','exports','util','path','connect-timeout','express','fs-extra','../../config/environment','get','isAuthenticated'];(function(_0x38a7ac,_0x45514b){var _0x53061a=function(_0x1d2469){while(--_0x1d2469){_0x38a7ac['push'](_0x38a7ac['shift']());}};_0x53061a(++_0x45514b);}(_0xe3a2,0x106));var _0x2e3a=function(_0x5bc680,_0x2d59f6){_0x5bc680=_0x5bc680-0x0;var _0x98254f=_0xe3a2[_0x5bc680];return _0x98254f;};'use strict';var multer=require('multer');var util=require(_0x2e3a('0x0'));var path=require(_0x2e3a('0x1'));var timeout=require(_0x2e3a('0x2'));var express=require(_0x2e3a('0x3'));var router=express['Router']();var fs_extra=require(_0x2e3a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x2e3a('0x5'));var controller=require('./openchannelQueueReport.controller');router[_0x2e3a('0x6')]('/',auth[_0x2e3a('0x7')](),controller[_0x2e3a('0x8')]);router[_0x2e3a('0x6')]('/describe',auth[_0x2e3a('0x7')](),controller[_0x2e3a('0x9')]);router['get'](_0x2e3a('0xa'),auth[_0x2e3a('0x7')](),controller[_0x2e3a('0xb')]);router[_0x2e3a('0xc')]('/',auth[_0x2e3a('0x7')](),controller['create']);router[_0x2e3a('0xd')](_0x2e3a('0xa'),auth[_0x2e3a('0x7')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2e3a('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index a90c3bc..3878dbd 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 _0x9b78=['STRING','DATE','moment','sequelize','exports'];(function(_0x5b5684,_0x525ccb){var _0x1bf041=function(_0x2df3e4){while(--_0x2df3e4){_0x5b5684['push'](_0x5b5684['shift']());}};_0x1bf041(++_0x525ccb);}(_0x9b78,0x66));var _0x89b7=function(_0x56756b,_0x3e8cc7){_0x56756b=_0x56756b-0x0;var _0xa3002=_0x9b78[_0x56756b];return _0xa3002;};'use strict';var moment=require(_0x89b7('0x0'));var Sequelize=require(_0x89b7('0x1'));module[_0x89b7('0x2')]={'uniqueid':{'type':Sequelize[_0x89b7('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x89b7('0x3')]},'joinAt':{'type':Sequelize[_0x89b7('0x4')]},'leaveAt':{'type':Sequelize[_0x89b7('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x89b7('0x3')]}}; \ No newline at end of file +var _0xf7ed=['DATE','sequelize','exports','STRING'];(function(_0xc575b1,_0x3f55d3){var _0x2779f0=function(_0x44e7da){while(--_0x44e7da){_0xc575b1['push'](_0xc575b1['shift']());}};_0x2779f0(++_0x3f55d3);}(_0xf7ed,0x1a1));var _0xdf7e=function(_0x5b474c,_0x426d87){_0x5b474c=_0x5b474c-0x0;var _0x273b2c=_0xf7ed[_0x5b474c];return _0x273b2c;};'use strict';var moment=require('moment');var Sequelize=require(_0xdf7e('0x0'));module[_0xdf7e('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xdf7e('0x2')]},'joinAt':{'type':Sequelize[_0xdf7e('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0xdf7e('0x3')]},'exitAt':{'type':Sequelize[_0xdf7e('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 8a36f88..d533c1b 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 _0x1e47=['path','sox','to-csv','ejs','lodash','squel','jsforce','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','limit','count','set','Content-Range','apply','reject','save','then','end','error','name','index','map','OpenchannelQueueReport','fieldName','type','model','query','keys','attributes','intersection','length','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','rawAttributes','fields','find','create','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache'];(function(_0x3d8631,_0x1a3b1b){var _0x5d8885=function(_0x374491){while(--_0x374491){_0x3d8631['push'](_0x3d8631['shift']());}};_0x5d8885(++_0x1a3b1b);}(_0x1e47,0xca));var _0x71e4=function(_0x592ed4,_0x5b002c){_0x592ed4=_0x592ed4-0x0;var _0x1c66fb=_0x1e47[_0x592ed4];return _0x1c66fb;};'use strict';var emlformat=require(_0x71e4('0x0'));var rimraf=require(_0x71e4('0x1'));var zipdir=require(_0x71e4('0x2'));var jsonpatch=require(_0x71e4('0x3'));var rp=require(_0x71e4('0x4'));var moment=require(_0x71e4('0x5'));var BPromise=require(_0x71e4('0x6'));var Mustache=require(_0x71e4('0x7'));var util=require('util');var path=require(_0x71e4('0x8'));var sox=require(_0x71e4('0x9'));var csv=require(_0x71e4('0xa'));var ejs=require(_0x71e4('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x71e4('0xc'));var squel=require(_0x71e4('0xd'));var crypto=require('crypto');var jsforce=require(_0x71e4('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x71e4('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x71e4('0x10'));var as=require(_0x71e4('0x11'));var hardwareService=require(_0x71e4('0x12'));var logger=require('../../config/logger')(_0x71e4('0x13'));var utils=require(_0x71e4('0x14'));var config=require(_0x71e4('0x15'));var licenseUtil=require(_0x71e4('0x16'));var db=require(_0x71e4('0x17'))['db'];function respondWithStatusCode(_0x3ae270,_0x2ef353){_0x2ef353=_0x2ef353||0xcc;return function(_0x5ba20e){if(_0x5ba20e){return _0x3ae270[_0x71e4('0x18')](_0x2ef353);}return _0x3ae270['status'](_0x2ef353)['end']();};}function respondWithResult(_0xc728bd,_0x322fc1){_0x322fc1=_0x322fc1||0xc8;return function(_0x310202){if(_0x310202){return _0xc728bd[_0x71e4('0x19')](_0x322fc1)['json'](_0x310202);}};}function respondWithFilteredResult(_0x2e9887,_0x53dbe2){return function(_0x415d66){if(_0x415d66){var _0x2de698=typeof _0x53dbe2[_0x71e4('0x1a')]==='undefined'&&typeof _0x53dbe2[_0x71e4('0x1b')]==='undefined';var _0x2e7832=_0x415d66[_0x71e4('0x1c')];var _0x55eee7=_0x2de698?0x0:_0x53dbe2[_0x71e4('0x1a')];var _0x4fe234=_0x2de698?_0x415d66['count']:_0x53dbe2['offset']+_0x53dbe2[_0x71e4('0x1b')];var _0x2b3884;if(_0x4fe234>=_0x2e7832){_0x4fe234=_0x2e7832;_0x2b3884=0xc8;}else{_0x2b3884=0xce;}_0x2e9887['status'](_0x2b3884);return _0x2e9887[_0x71e4('0x1d')](_0x71e4('0x1e'),_0x55eee7+'-'+_0x4fe234+'/'+_0x2e7832)['json'](_0x415d66);}return null;};}function patchUpdates(_0x4beed0){return function(_0x46b8c3){try{jsonpatch[_0x71e4('0x1f')](_0x46b8c3,_0x4beed0,!![]);}catch(_0x32bc10){return BPromise[_0x71e4('0x20')](_0x32bc10);}return _0x46b8c3[_0x71e4('0x21')]();};}function saveUpdates(_0x529514,_0x1f2ba3){return function(_0x38a86b){if(_0x38a86b){return _0x38a86b['update'](_0x529514)[_0x71e4('0x22')](function(_0x192cb4){return _0x192cb4;});}return null;};}function removeEntity(_0x2f7c42,_0x158748){return function(_0xac4aa8){if(_0xac4aa8){return _0xac4aa8['destroy']()[_0x71e4('0x22')](function(){_0x2f7c42[_0x71e4('0x19')](0xcc)[_0x71e4('0x23')]();});}};}function handleEntityNotFound(_0x48c435,_0x57c991){return function(_0x52de7f){if(!_0x52de7f){_0x48c435['sendStatus'](0x194);}return _0x52de7f;};}function handleError(_0xa3833f,_0xa5e733){_0xa5e733=_0xa5e733||0x1f4;return function(_0x474b45){logger[_0x71e4('0x24')](_0x474b45['stack']);if(_0x474b45[_0x71e4('0x25')]){delete _0x474b45[_0x71e4('0x25')];}_0xa3833f[_0x71e4('0x19')](_0xa5e733)['send'](_0x474b45);};}exports[_0x71e4('0x26')]=function(_0x27bb1e,_0x7150d9){var _0x39f7ce={},_0x37f507={},_0x1ee5e7={'count':0x0,'rows':[]};var _0xfbca3b=_[_0x71e4('0x27')](db[_0x71e4('0x28')]['rawAttributes'],function(_0x1d26a1){return{'name':_0x1d26a1[_0x71e4('0x29')],'type':_0x1d26a1[_0x71e4('0x2a')]['key']};});_0x37f507[_0x71e4('0x2b')]=_['map'](_0xfbca3b,_0x71e4('0x25'));_0x37f507[_0x71e4('0x2c')]=_[_0x71e4('0x2d')](_0x27bb1e['query']);_0x37f507['filters']=_['intersection'](_0x37f507[_0x71e4('0x2b')],_0x37f507['query']);_0x39f7ce[_0x71e4('0x2e')]=_[_0x71e4('0x2f')](_0x37f507['model'],qs['fields'](_0x27bb1e[_0x71e4('0x2c')]['fields']));_0x39f7ce[_0x71e4('0x2e')]=_0x39f7ce['attributes'][_0x71e4('0x30')]?_0x39f7ce[_0x71e4('0x2e')]:_0x37f507[_0x71e4('0x2b')];if(!_0x27bb1e['query']['hasOwnProperty']('nolimit')){_0x39f7ce['limit']=qs[_0x71e4('0x1b')](_0x27bb1e['query'][_0x71e4('0x1b')]);_0x39f7ce[_0x71e4('0x1a')]=qs[_0x71e4('0x1a')](_0x27bb1e[_0x71e4('0x2c')][_0x71e4('0x1a')]);}_0x39f7ce['order']=qs[_0x71e4('0x31')](_0x27bb1e[_0x71e4('0x2c')][_0x71e4('0x31')]);_0x39f7ce['where']=qs[_0x71e4('0x32')](_[_0x71e4('0x33')](_0x27bb1e['query'],_0x37f507['filters']),_0xfbca3b);if(_0x27bb1e[_0x71e4('0x2c')][_0x71e4('0x34')]){_0x39f7ce[_0x71e4('0x35')]=_[_0x71e4('0x36')](_0x39f7ce[_0x71e4('0x35')],{'$or':_[_0x71e4('0x27')](_0xfbca3b,function(_0x1a25e5){if(_0x1a25e5[_0x71e4('0x2a')]!==_0x71e4('0x37')){var _0x27551f={};_0x27551f[_0x1a25e5['name']]={'$like':'%'+_0x27bb1e[_0x71e4('0x2c')][_0x71e4('0x34')]+'%'};return _0x27551f;}})});}_0x39f7ce=_[_0x71e4('0x36')]({},_0x39f7ce,_0x27bb1e[_0x71e4('0x38')]);var _0x1ed2f0={'where':_0x39f7ce[_0x71e4('0x35')]};return db[_0x71e4('0x28')]['count'](_0x1ed2f0)[_0x71e4('0x22')](function(_0x1b7eb0){_0x1ee5e7['count']=_0x1b7eb0;if(_0x27bb1e[_0x71e4('0x2c')][_0x71e4('0x39')]){_0x39f7ce[_0x71e4('0x3a')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x71e4('0x3b')](_0x39f7ce);})[_0x71e4('0x22')](function(_0x4175a5){_0x1ee5e7['rows']=_0x4175a5;return _0x1ee5e7;})[_0x71e4('0x22')](respondWithFilteredResult(_0x7150d9,_0x39f7ce))[_0x71e4('0x3c')](handleError(_0x7150d9,null));};exports[_0x71e4('0x3d')]=function(_0x23f744,_0x25e48a){var _0xa6f3da={'raw':!![],'where':{'id':_0x23f744['params']['id']}},_0x268fb0={};_0x268fb0['model']=_[_0x71e4('0x2d')](db[_0x71e4('0x28')][_0x71e4('0x3e')]);_0x268fb0['query']=_[_0x71e4('0x2d')](_0x23f744[_0x71e4('0x2c')]);_0x268fb0[_0x71e4('0x32')]=_[_0x71e4('0x2f')](_0x268fb0[_0x71e4('0x2b')],_0x268fb0['query']);_0xa6f3da[_0x71e4('0x2e')]=_[_0x71e4('0x2f')](_0x268fb0[_0x71e4('0x2b')],qs[_0x71e4('0x3f')](_0x23f744[_0x71e4('0x2c')][_0x71e4('0x3f')]));_0xa6f3da['attributes']=_0xa6f3da[_0x71e4('0x2e')][_0x71e4('0x30')]?_0xa6f3da[_0x71e4('0x2e')]:_0x268fb0[_0x71e4('0x2b')];if(_0x23f744[_0x71e4('0x2c')][_0x71e4('0x39')]){_0xa6f3da[_0x71e4('0x3a')]=[{'all':!![]}];}_0xa6f3da=_[_0x71e4('0x36')]({},_0xa6f3da,_0x23f744[_0x71e4('0x38')]);return db[_0x71e4('0x28')][_0x71e4('0x40')](_0xa6f3da)[_0x71e4('0x22')](handleEntityNotFound(_0x25e48a,null))[_0x71e4('0x22')](respondWithResult(_0x25e48a,null))[_0x71e4('0x3c')](handleError(_0x25e48a,null));};exports[_0x71e4('0x41')]=function(_0x1ac2df,_0x5a6250){return db[_0x71e4('0x28')][_0x71e4('0x41')](_0x1ac2df['body'],{})[_0x71e4('0x22')](respondWithResult(_0x5a6250,0xc9))[_0x71e4('0x3c')](handleError(_0x5a6250,null));};exports['update']=function(_0x232df2,_0x38ece7){if(_0x232df2['body']['id']){delete _0x232df2[_0x71e4('0x42')]['id'];}return db[_0x71e4('0x28')][_0x71e4('0x40')]({'where':{'id':_0x232df2[_0x71e4('0x43')]['id']}})['then'](handleEntityNotFound(_0x38ece7,null))[_0x71e4('0x22')](saveUpdates(_0x232df2[_0x71e4('0x42')],null))[_0x71e4('0x22')](respondWithResult(_0x38ece7,null))[_0x71e4('0x3c')](handleError(_0x38ece7,null));};exports[_0x71e4('0x44')]=function(_0x1f33e8,_0x1b6e8a){return db[_0x71e4('0x28')][_0x71e4('0x40')]({'where':{'id':_0x1f33e8['params']['id']}})[_0x71e4('0x22')](handleEntityNotFound(_0x1b6e8a,null))['then'](removeEntity(_0x1b6e8a,null))[_0x71e4('0x3c')](handleError(_0x1b6e8a,null));};exports['describe']=function(_0x1fe39e,_0x4e765b){return db[_0x71e4('0x28')][_0x71e4('0x45')]()[_0x71e4('0x22')](respondWithResult(_0x4e765b,null))[_0x71e4('0x3c')](handleError(_0x4e765b,null));}; \ No newline at end of file +var _0x6967=['rows','catch','params','rawAttributes','include','options','find','create','body','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','OpenchannelQueueReport','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','offset','sort','where','filters','pick','filter','merge','type','VIRTUAL','includeAll','findAll'];(function(_0x43d11d,_0xccff91){var _0x38cd08=function(_0x131ae2){while(--_0x131ae2){_0x43d11d['push'](_0x43d11d['shift']());}};_0x38cd08(++_0xccff91);}(_0x6967,0x99));var _0x7696=function(_0x518365,_0x1eb1a3){_0x518365=_0x518365-0x0;var _0x1d904b=_0x6967[_0x518365];return _0x1d904b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7696('0x0'));var zipdir=require(_0x7696('0x1'));var jsonpatch=require(_0x7696('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7696('0x3'));var Mustache=require(_0x7696('0x4'));var util=require('util');var path=require(_0x7696('0x5'));var sox=require(_0x7696('0x6'));var csv=require(_0x7696('0x7'));var ejs=require(_0x7696('0x8'));var fs=require('fs');var fs_extra=require(_0x7696('0x9'));var _=require('lodash');var squel=require(_0x7696('0xa'));var crypto=require(_0x7696('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7696('0xc'));var Papa=require(_0x7696('0xd'));var Redis=require(_0x7696('0xe'));var authService=require(_0x7696('0xf'));var qs=require(_0x7696('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7696('0x11'));var logger=require(_0x7696('0x12'))('api');var utils=require(_0x7696('0x13'));var config=require(_0x7696('0x14'));var licenseUtil=require(_0x7696('0x15'));var db=require(_0x7696('0x16'))['db'];function respondWithStatusCode(_0x3d81cb,_0x425427){_0x425427=_0x425427||0xcc;return function(_0x5509e5){if(_0x5509e5){return _0x3d81cb[_0x7696('0x17')](_0x425427);}return _0x3d81cb[_0x7696('0x18')](_0x425427)[_0x7696('0x19')]();};}function respondWithResult(_0x3850bd,_0x277f1f){_0x277f1f=_0x277f1f||0xc8;return function(_0x57f642){if(_0x57f642){return _0x3850bd[_0x7696('0x18')](_0x277f1f)[_0x7696('0x1a')](_0x57f642);}};}function respondWithFilteredResult(_0x5f10cd,_0x2c745d){return function(_0x5f3ac3){if(_0x5f3ac3){var _0x2b7447=typeof _0x2c745d['offset']===_0x7696('0x1b')&&typeof _0x2c745d[_0x7696('0x1c')]==='undefined';var _0x2c7ec1=_0x5f3ac3['count'];var _0x41ad83=_0x2b7447?0x0:_0x2c745d['offset'];var _0x39d47e=_0x2b7447?_0x5f3ac3[_0x7696('0x1d')]:_0x2c745d['offset']+_0x2c745d[_0x7696('0x1c')];var _0x24d93f;if(_0x39d47e>=_0x2c7ec1){_0x39d47e=_0x2c7ec1;_0x24d93f=0xc8;}else{_0x24d93f=0xce;}_0x5f10cd[_0x7696('0x18')](_0x24d93f);return _0x5f10cd['set'](_0x7696('0x1e'),_0x41ad83+'-'+_0x39d47e+'/'+_0x2c7ec1)['json'](_0x5f3ac3);}return null;};}function patchUpdates(_0x22f578){return function(_0x243a33){try{jsonpatch[_0x7696('0x1f')](_0x243a33,_0x22f578,!![]);}catch(_0x85fbba){return BPromise[_0x7696('0x20')](_0x85fbba);}return _0x243a33[_0x7696('0x21')]();};}function saveUpdates(_0x36e3e2,_0x2f8dab){return function(_0x13512e){if(_0x13512e){return _0x13512e[_0x7696('0x22')](_0x36e3e2)[_0x7696('0x23')](function(_0x8e21cc){return _0x8e21cc;});}return null;};}function removeEntity(_0x46487f,_0x5ead0f){return function(_0x5c5069){if(_0x5c5069){return _0x5c5069[_0x7696('0x24')]()[_0x7696('0x23')](function(){_0x46487f[_0x7696('0x18')](0xcc)[_0x7696('0x19')]();});}};}function handleEntityNotFound(_0x54a582,_0x281f03){return function(_0x152e92){if(!_0x152e92){_0x54a582[_0x7696('0x17')](0x194);}return _0x152e92;};}function handleError(_0x404699,_0x5224b2){_0x5224b2=_0x5224b2||0x1f4;return function(_0x415b41){logger['error'](_0x415b41[_0x7696('0x25')]);if(_0x415b41[_0x7696('0x26')]){delete _0x415b41[_0x7696('0x26')];}_0x404699[_0x7696('0x18')](_0x5224b2)[_0x7696('0x27')](_0x415b41);};}exports[_0x7696('0x28')]=function(_0x4c7b8a,_0x1b3fa6){var _0x12eccd={},_0x45f52b={},_0x5ceec5={'count':0x0,'rows':[]};var _0x675238=_[_0x7696('0x29')](db[_0x7696('0x2a')]['rawAttributes'],function(_0xf13ecd){return{'name':_0xf13ecd['fieldName'],'type':_0xf13ecd['type'][_0x7696('0x2b')]};});_0x45f52b[_0x7696('0x2c')]=_[_0x7696('0x29')](_0x675238,_0x7696('0x26'));_0x45f52b[_0x7696('0x2d')]=_[_0x7696('0x2e')](_0x4c7b8a[_0x7696('0x2d')]);_0x45f52b['filters']=_[_0x7696('0x2f')](_0x45f52b['model'],_0x45f52b[_0x7696('0x2d')]);_0x12eccd[_0x7696('0x30')]=_[_0x7696('0x2f')](_0x45f52b[_0x7696('0x2c')],qs[_0x7696('0x31')](_0x4c7b8a[_0x7696('0x2d')]['fields']));_0x12eccd['attributes']=_0x12eccd[_0x7696('0x30')][_0x7696('0x32')]?_0x12eccd[_0x7696('0x30')]:_0x45f52b[_0x7696('0x2c')];if(!_0x4c7b8a[_0x7696('0x2d')][_0x7696('0x33')]('nolimit')){_0x12eccd[_0x7696('0x1c')]=qs[_0x7696('0x1c')](_0x4c7b8a[_0x7696('0x2d')][_0x7696('0x1c')]);_0x12eccd[_0x7696('0x34')]=qs[_0x7696('0x34')](_0x4c7b8a[_0x7696('0x2d')][_0x7696('0x34')]);}_0x12eccd['order']=qs[_0x7696('0x35')](_0x4c7b8a[_0x7696('0x2d')][_0x7696('0x35')]);_0x12eccd[_0x7696('0x36')]=qs[_0x7696('0x37')](_[_0x7696('0x38')](_0x4c7b8a[_0x7696('0x2d')],_0x45f52b[_0x7696('0x37')]),_0x675238);if(_0x4c7b8a[_0x7696('0x2d')][_0x7696('0x39')]){_0x12eccd['where']=_[_0x7696('0x3a')](_0x12eccd[_0x7696('0x36')],{'$or':_['map'](_0x675238,function(_0x366ec3){if(_0x366ec3[_0x7696('0x3b')]!==_0x7696('0x3c')){var _0x2bf0b1={};_0x2bf0b1[_0x366ec3[_0x7696('0x26')]]={'$like':'%'+_0x4c7b8a['query'][_0x7696('0x39')]+'%'};return _0x2bf0b1;}})});}_0x12eccd=_['merge']({},_0x12eccd,_0x4c7b8a['options']);var _0x47cded={'where':_0x12eccd[_0x7696('0x36')]};return db[_0x7696('0x2a')][_0x7696('0x1d')](_0x47cded)[_0x7696('0x23')](function(_0x2b583d){_0x5ceec5[_0x7696('0x1d')]=_0x2b583d;if(_0x4c7b8a['query'][_0x7696('0x3d')]){_0x12eccd['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x7696('0x3e')](_0x12eccd);})[_0x7696('0x23')](function(_0x412d53){_0x5ceec5[_0x7696('0x3f')]=_0x412d53;return _0x5ceec5;})[_0x7696('0x23')](respondWithFilteredResult(_0x1b3fa6,_0x12eccd))[_0x7696('0x40')](handleError(_0x1b3fa6,null));};exports['show']=function(_0x1d2192,_0x2463a6){var _0x25eacc={'raw':!![],'where':{'id':_0x1d2192[_0x7696('0x41')]['id']}},_0x3413e7={};_0x3413e7[_0x7696('0x2c')]=_[_0x7696('0x2e')](db[_0x7696('0x2a')][_0x7696('0x42')]);_0x3413e7[_0x7696('0x2d')]=_[_0x7696('0x2e')](_0x1d2192[_0x7696('0x2d')]);_0x3413e7[_0x7696('0x37')]=_[_0x7696('0x2f')](_0x3413e7['model'],_0x3413e7['query']);_0x25eacc[_0x7696('0x30')]=_[_0x7696('0x2f')](_0x3413e7[_0x7696('0x2c')],qs[_0x7696('0x31')](_0x1d2192[_0x7696('0x2d')][_0x7696('0x31')]));_0x25eacc[_0x7696('0x30')]=_0x25eacc[_0x7696('0x30')][_0x7696('0x32')]?_0x25eacc[_0x7696('0x30')]:_0x3413e7[_0x7696('0x2c')];if(_0x1d2192[_0x7696('0x2d')][_0x7696('0x3d')]){_0x25eacc[_0x7696('0x43')]=[{'all':!![]}];}_0x25eacc=_[_0x7696('0x3a')]({},_0x25eacc,_0x1d2192[_0x7696('0x44')]);return db[_0x7696('0x2a')][_0x7696('0x45')](_0x25eacc)[_0x7696('0x23')](handleEntityNotFound(_0x2463a6,null))['then'](respondWithResult(_0x2463a6,null))[_0x7696('0x40')](handleError(_0x2463a6,null));};exports[_0x7696('0x46')]=function(_0x14436f,_0x322b35){return db['OpenchannelQueueReport'][_0x7696('0x46')](_0x14436f['body'],{})[_0x7696('0x23')](respondWithResult(_0x322b35,0xc9))['catch'](handleError(_0x322b35,null));};exports['update']=function(_0x13a6e3,_0x5ce7e9){if(_0x13a6e3['body']['id']){delete _0x13a6e3[_0x7696('0x47')]['id'];}return db[_0x7696('0x2a')]['find']({'where':{'id':_0x13a6e3[_0x7696('0x41')]['id']}})['then'](handleEntityNotFound(_0x5ce7e9,null))['then'](saveUpdates(_0x13a6e3[_0x7696('0x47')],null))[_0x7696('0x23')](respondWithResult(_0x5ce7e9,null))[_0x7696('0x40')](handleError(_0x5ce7e9,null));};exports[_0x7696('0x24')]=function(_0x102565,_0xbe09){return db['OpenchannelQueueReport'][_0x7696('0x45')]({'where':{'id':_0x102565[_0x7696('0x41')]['id']}})['then'](handleEntityNotFound(_0xbe09,null))[_0x7696('0x23')](removeEntity(_0xbe09,null))[_0x7696('0x40')](handleError(_0xbe09,null));};exports['describe']=function(_0x188d61,_0x5ae711){return db[_0x7696('0x2a')]['describe']()[_0x7696('0x23')](respondWithResult(_0x5ae711,null))['catch'](handleError(_0x5ae711,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index afec3c2..129032f 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x581319,_0x50fb69){var _0x3f3b9b=function(_0x23c9ed){while(--_0x23c9ed){_0x581319['push'](_0x581319['shift']());}};_0x3f3b9b(++_0x50fb69);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x2f2bfa,_0x181de8){var _0x550a27=function(_0x50a970){while(--_0x50a970){_0x2f2bfa['push'](_0x2f2bfa['shift']());}};_0x550a27(++_0x181de8);}(_0x1261,0x144));var _0x1126=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0x1261[_0x4314d7];return _0x5c599b;};'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 diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index c978813..b78cd72 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 _0x160f=['stringify','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','UpdateOpenchannelQueueReport','where','attributes','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x3857c4,_0x131210){var _0x4c9878=function(_0x134da3){while(--_0x134da3){_0x3857c4['push'](_0x3857c4['shift']());}};_0x4c9878(++_0x131210);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});}exports[_0xf160('0x16')]=function(_0x4b8185){var _0x5388c7=this;return new Promise(function(_0x1cf6ba,_0x1e0c78){return db[_0xf160('0x17')][_0xf160('0x18')](_0x4b8185[_0xf160('0x19')],{'raw':_0x4b8185[_0xf160('0x1a')]?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x40ccf0){logger[_0xf160('0xd')](_0xf160('0x16'),_0x4b8185);logger['debug'](_0xf160('0x16'),_0x4b8185,JSON[_0xf160('0x11')](_0x40ccf0));_0x1cf6ba(_0x40ccf0);})[_0xf160('0x15')](function(_0x36d0cb){logger[_0xf160('0x12')](_0xf160('0x16'),_0x36d0cb[_0xf160('0x14')],_0x4b8185);_0x1e0c78(_0x5388c7['error'](0x1f4,_0x36d0cb[_0xf160('0x14')]));});});};exports[_0xf160('0x1c')]=function(_0x305f6a){var _0x49bb5c=this;return new Promise(function(_0x578f7d,_0x42458c){return db[_0xf160('0x17')]['update'](_0x305f6a['body'],{'raw':_0x305f6a[_0xf160('0x1a')]?_0x305f6a[_0xf160('0x1a')][_0xf160('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x305f6a['options']?_0x305f6a[_0xf160('0x1a')][_0xf160('0x1d')]||null:null,'attributes':_0x305f6a[_0xf160('0x1a')]?_0x305f6a[_0xf160('0x1a')][_0xf160('0x1e')]||null:null,'limit':_0x305f6a[_0xf160('0x1a')]?_0x305f6a['options']['limit']||null:null})['then'](function(_0x26e7b9){logger[_0xf160('0xd')](_0xf160('0x1c'),_0x305f6a);logger[_0xf160('0x1f')](_0xf160('0x1c'),_0x305f6a,JSON['stringify'](_0x26e7b9));_0x578f7d(_0x26e7b9);})['catch'](function(_0x329d6b){logger['error']('UpdateOpenchannelQueueReport',_0x329d6b[_0xf160('0x14')],_0x305f6a);_0x42458c(_0x49bb5c[_0xf160('0x12')](0x1f4,_0x329d6b['message']));});});}; \ No newline at end of file +var _0x4325=['result','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','raw','update','where','attributes','UpdateOpenchannelQueueReport','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','OpenchannelQueueReport,\x20%s,\x20%s','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','info'];(function(_0x56c2bd,_0x307141){var _0x1edc9c=function(_0x12d5e2){while(--_0x12d5e2){_0x56c2bd['push'](_0x56c2bd['shift']());}};_0x1edc9c(++_0x307141);}(_0x4325,0x1da));var _0x5432=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x4325[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});}exports[_0x5432('0x17')]=function(_0x32fe60){var _0x4221a8=this;return new Promise(function(_0x5f011f,_0x3f3873){return db[_0x5432('0x18')][_0x5432('0x19')](_0x32fe60[_0x5432('0x1a')],{'raw':_0x32fe60[_0x5432('0x1b')]?_0x32fe60[_0x5432('0x1b')][_0x5432('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x66911a){logger[_0x5432('0x14')](_0x5432('0x17'),_0x32fe60);logger[_0x5432('0xd')](_0x5432('0x17'),_0x32fe60,JSON['stringify'](_0x66911a));_0x5f011f(_0x66911a);})['catch'](function(_0x4d09cd){logger[_0x5432('0x12')](_0x5432('0x17'),_0x4d09cd[_0x5432('0x13')],_0x32fe60);_0x3f3873(_0x4221a8[_0x5432('0x12')](0x1f4,_0x4d09cd['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x3e0b66){var _0x8ed74b=this;return new Promise(function(_0x4a40fc,_0x19e6b2){return db[_0x5432('0x18')][_0x5432('0x1d')](_0x3e0b66['body'],{'raw':_0x3e0b66[_0x5432('0x1b')]?_0x3e0b66[_0x5432('0x1b')][_0x5432('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3e0b66['options']?_0x3e0b66['options'][_0x5432('0x1e')]||null:null,'attributes':_0x3e0b66[_0x5432('0x1b')]?_0x3e0b66['options'][_0x5432('0x1f')]||null:null,'limit':_0x3e0b66[_0x5432('0x1b')]?_0x3e0b66[_0x5432('0x1b')]['limit']||null:null})[_0x5432('0xb')](function(_0x5be867){logger['info'](_0x5432('0x20'),_0x3e0b66);logger['debug'](_0x5432('0x20'),_0x3e0b66,JSON['stringify'](_0x5be867));_0x4a40fc(_0x5be867);})['catch'](function(_0x465a09){logger[_0x5432('0x12')](_0x5432('0x20'),_0x465a09['message'],_0x3e0b66);_0x19e6b2(_0x8ed74b[_0x5432('0x12')](0x1f4,_0x465a09[_0x5432('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index f4b13f0..4e22352 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 _0x1999=['express','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/describe','/:id','show','post','put','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x4e8384,_0x5865c4){var _0x4deaa4=function(_0x242ee8){while(--_0x242ee8){_0x4e8384['push'](_0x4e8384['shift']());}};_0x4deaa4(++_0x5865c4);}(_0x1999,0x1bf));var _0x9199=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x1999[_0x413feb];return _0x40ee88;};'use strict';var multer=require('multer');var util=require(_0x9199('0x0'));var path=require(_0x9199('0x1'));var timeout=require(_0x9199('0x2'));var express=require(_0x9199('0x3'));var router=express['Router']();var fs_extra=require(_0x9199('0x4'));var auth=require(_0x9199('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x9199('0x6'));var controller=require('./openchannelTransferReport.controller');router[_0x9199('0x7')]('/',auth[_0x9199('0x8')](),controller['index']);router['get'](_0x9199('0x9'),auth[_0x9199('0x8')](),controller['describe']);router[_0x9199('0x7')](_0x9199('0xa'),auth['isAuthenticated'](),controller[_0x9199('0xb')]);router[_0x9199('0xc')]('/',auth[_0x9199('0x8')](),controller['create']);router[_0x9199('0xd')](_0x9199('0xa'),auth['isAuthenticated'](),controller[_0x9199('0xe')]);router[_0x9199('0xf')](_0x9199('0xa'),auth['isAuthenticated'](),controller[_0x9199('0x10')]);module[_0x9199('0x11')]=router; \ No newline at end of file +var _0xb8f3=['multer','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy'];(function(_0x422faf,_0x6967d5){var _0x341573=function(_0x5d2f0e){while(--_0x5d2f0e){_0x422faf['push'](_0x422faf['shift']());}};_0x341573(++_0x6967d5);}(_0xb8f3,0xbe));var _0x3b8f=function(_0x48df04,_0x1522b1){_0x48df04=_0x48df04-0x0;var _0x4de5fa=_0xb8f3[_0x48df04];return _0x4de5fa;};'use strict';var multer=require(_0x3b8f('0x0'));var util=require('util');var path=require(_0x3b8f('0x1'));var timeout=require(_0x3b8f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x3b8f('0x3'));var auth=require(_0x3b8f('0x4'));var interaction=require(_0x3b8f('0x5'));var config=require('../../config/environment');var controller=require(_0x3b8f('0x6'));router[_0x3b8f('0x7')]('/',auth['isAuthenticated'](),controller[_0x3b8f('0x8')]);router[_0x3b8f('0x7')](_0x3b8f('0x9'),auth[_0x3b8f('0xa')](),controller[_0x3b8f('0xb')]);router['get'](_0x3b8f('0xc'),auth[_0x3b8f('0xa')](),controller[_0x3b8f('0xd')]);router[_0x3b8f('0xe')]('/',auth['isAuthenticated'](),controller[_0x3b8f('0xf')]);router[_0x3b8f('0x10')](_0x3b8f('0xc'),auth[_0x3b8f('0xa')](),controller[_0x3b8f('0x11')]);router['delete']('/:id',auth[_0x3b8f('0xa')](),controller[_0x3b8f('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index e377cef..aee5afb 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(_0x45c107,_0x5c04b4){var _0x1f3bf3=function(_0x247a6b){while(--_0x247a6b){_0x45c107['push'](_0x45c107['shift']());}};_0x1f3bf3(++_0x5c04b4);}(_0x4b84,0x1cc));var _0x44b8=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0x4b84[_0x3635ce];return _0x97ecd0;};'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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0xb2b7a,_0x36536){var _0x126c5c=function(_0x5c7b44){while(--_0x5c7b44){_0xb2b7a['push'](_0xb2b7a['shift']());}};_0x126c5c(++_0x36536);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x57ee1d,_0x54111b){_0x57ee1d=_0x57ee1d-0x0;var _0x12a933=_0xf3cd[_0x57ee1d];return _0x12a933;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 0949f7e..5d56813 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 _0xf5d2=['json','reject','save','then','destroy','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','create','body','update','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','set','Content-Range'];(function(_0x3f9f17,_0x547eb3){var _0x1f1c46=function(_0x2843ea){while(--_0x2843ea){_0x3f9f17['push'](_0x3f9f17['shift']());}};_0x1f1c46(++_0x547eb3);}(_0xf5d2,0x77));var _0x2f5d=function(_0x5962eb,_0x27a854){_0x5962eb=_0x5962eb-0x0;var _0x42700b=_0xf5d2[_0x5962eb];return _0x42700b;};'use strict';var emlformat=require(_0x2f5d('0x0'));var rimraf=require(_0x2f5d('0x1'));var zipdir=require(_0x2f5d('0x2'));var jsonpatch=require(_0x2f5d('0x3'));var rp=require('request-promise');var moment=require(_0x2f5d('0x4'));var BPromise=require(_0x2f5d('0x5'));var Mustache=require(_0x2f5d('0x6'));var util=require('util');var path=require(_0x2f5d('0x7'));var sox=require('sox');var csv=require(_0x2f5d('0x8'));var ejs=require(_0x2f5d('0x9'));var fs=require('fs');var fs_extra=require(_0x2f5d('0xa'));var _=require('lodash');var squel=require(_0x2f5d('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2f5d('0xc'));var toCsv=require(_0x2f5d('0x8'));var querystring=require('querystring');var Papa=require(_0x2f5d('0xd'));var Redis=require(_0x2f5d('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x2f5d('0xf'));var as=require(_0x2f5d('0x10'));var hardwareService=require(_0x2f5d('0x11'));var logger=require('../../config/logger')(_0x2f5d('0x12'));var utils=require(_0x2f5d('0x13'));var config=require(_0x2f5d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f5d('0x15'))['db'];function respondWithStatusCode(_0x40e7e0,_0x5c8211){_0x5c8211=_0x5c8211||0xcc;return function(_0x140d62){if(_0x140d62){return _0x40e7e0[_0x2f5d('0x16')](_0x5c8211);}return _0x40e7e0[_0x2f5d('0x17')](_0x5c8211)[_0x2f5d('0x18')]();};}function respondWithResult(_0x581a94,_0x3a23d5){_0x3a23d5=_0x3a23d5||0xc8;return function(_0x3c1c7c){if(_0x3c1c7c){return _0x581a94['status'](_0x3a23d5)['json'](_0x3c1c7c);}};}function respondWithFilteredResult(_0x25354f,_0x2a2fca){return function(_0x2ef3e0){if(_0x2ef3e0){var _0x219f50=typeof _0x2a2fca[_0x2f5d('0x19')]===_0x2f5d('0x1a')&&typeof _0x2a2fca['limit']===_0x2f5d('0x1a');var _0x5b7931=_0x2ef3e0['count'];var _0x1400ff=_0x219f50?0x0:_0x2a2fca[_0x2f5d('0x19')];var _0x29b822=_0x219f50?_0x2ef3e0['count']:_0x2a2fca['offset']+_0x2a2fca['limit'];var _0x2c6f8d;if(_0x29b822>=_0x5b7931){_0x29b822=_0x5b7931;_0x2c6f8d=0xc8;}else{_0x2c6f8d=0xce;}_0x25354f[_0x2f5d('0x17')](_0x2c6f8d);return _0x25354f[_0x2f5d('0x1b')](_0x2f5d('0x1c'),_0x1400ff+'-'+_0x29b822+'/'+_0x5b7931)[_0x2f5d('0x1d')](_0x2ef3e0);}return null;};}function patchUpdates(_0x267e43){return function(_0xa3d049){try{jsonpatch['apply'](_0xa3d049,_0x267e43,!![]);}catch(_0x2d2dd8){return BPromise[_0x2f5d('0x1e')](_0x2d2dd8);}return _0xa3d049[_0x2f5d('0x1f')]();};}function saveUpdates(_0x2ac4cd,_0x2d011a){return function(_0x356bde){if(_0x356bde){return _0x356bde['update'](_0x2ac4cd)[_0x2f5d('0x20')](function(_0x250a61){return _0x250a61;});}return null;};}function removeEntity(_0x357c8e,_0xe427b6){return function(_0xa2aebc){if(_0xa2aebc){return _0xa2aebc[_0x2f5d('0x21')]()[_0x2f5d('0x20')](function(){_0x357c8e[_0x2f5d('0x17')](0xcc)[_0x2f5d('0x18')]();});}};}function handleEntityNotFound(_0x4d4e91,_0xbf6cb2){return function(_0x19a42a){if(!_0x19a42a){_0x4d4e91[_0x2f5d('0x16')](0x194);}return _0x19a42a;};}function handleError(_0x1f833c,_0x3dbdfa){_0x3dbdfa=_0x3dbdfa||0x1f4;return function(_0x4eda7a){logger['error'](_0x4eda7a[_0x2f5d('0x22')]);if(_0x4eda7a[_0x2f5d('0x23')]){delete _0x4eda7a['name'];}_0x1f833c[_0x2f5d('0x17')](_0x3dbdfa)[_0x2f5d('0x24')](_0x4eda7a);};}exports[_0x2f5d('0x25')]=function(_0x566c24,_0xd11c77){var _0x472805={},_0x1e2538={},_0x5e3a81={'count':0x0,'rows':[]};var _0x5ed5c3=_[_0x2f5d('0x26')](db[_0x2f5d('0x27')][_0x2f5d('0x28')],function(_0x301758){return{'name':_0x301758['fieldName'],'type':_0x301758['type'][_0x2f5d('0x29')]};});_0x1e2538[_0x2f5d('0x2a')]=_[_0x2f5d('0x26')](_0x5ed5c3,_0x2f5d('0x23'));_0x1e2538['query']=_[_0x2f5d('0x2b')](_0x566c24['query']);_0x1e2538[_0x2f5d('0x2c')]=_[_0x2f5d('0x2d')](_0x1e2538[_0x2f5d('0x2a')],_0x1e2538[_0x2f5d('0x2e')]);_0x472805[_0x2f5d('0x2f')]=_['intersection'](_0x1e2538[_0x2f5d('0x2a')],qs[_0x2f5d('0x30')](_0x566c24['query'][_0x2f5d('0x30')]));_0x472805['attributes']=_0x472805[_0x2f5d('0x2f')][_0x2f5d('0x31')]?_0x472805[_0x2f5d('0x2f')]:_0x1e2538[_0x2f5d('0x2a')];if(!_0x566c24[_0x2f5d('0x2e')][_0x2f5d('0x32')](_0x2f5d('0x33'))){_0x472805['limit']=qs['limit'](_0x566c24[_0x2f5d('0x2e')][_0x2f5d('0x34')]);_0x472805[_0x2f5d('0x19')]=qs[_0x2f5d('0x19')](_0x566c24['query'][_0x2f5d('0x19')]);}_0x472805[_0x2f5d('0x35')]=qs[_0x2f5d('0x36')](_0x566c24[_0x2f5d('0x2e')][_0x2f5d('0x36')]);_0x472805[_0x2f5d('0x37')]=qs[_0x2f5d('0x2c')](_[_0x2f5d('0x38')](_0x566c24['query'],_0x1e2538[_0x2f5d('0x2c')]),_0x5ed5c3);if(_0x566c24['query'][_0x2f5d('0x39')]){_0x472805[_0x2f5d('0x37')]=_[_0x2f5d('0x3a')](_0x472805[_0x2f5d('0x37')],{'$or':_[_0x2f5d('0x26')](_0x5ed5c3,function(_0x293442){if(_0x293442[_0x2f5d('0x3b')]!==_0x2f5d('0x3c')){var _0x2de25e={};_0x2de25e[_0x293442[_0x2f5d('0x23')]]={'$like':'%'+_0x566c24[_0x2f5d('0x2e')][_0x2f5d('0x39')]+'%'};return _0x2de25e;}})});}_0x472805=_[_0x2f5d('0x3a')]({},_0x472805,_0x566c24[_0x2f5d('0x3d')]);var _0xd345b0={'where':_0x472805['where']};return db['OpenchannelTransferReport'][_0x2f5d('0x3e')](_0xd345b0)[_0x2f5d('0x20')](function(_0x3d99a9){_0x5e3a81['count']=_0x3d99a9;if(_0x566c24[_0x2f5d('0x2e')][_0x2f5d('0x3f')]){_0x472805[_0x2f5d('0x40')]=[{'all':!![]}];}return db[_0x2f5d('0x27')][_0x2f5d('0x41')](_0x472805);})['then'](function(_0x3e9b95){_0x5e3a81[_0x2f5d('0x42')]=_0x3e9b95;return _0x5e3a81;})[_0x2f5d('0x20')](respondWithFilteredResult(_0xd11c77,_0x472805))['catch'](handleError(_0xd11c77,null));};exports['show']=function(_0x2edbe2,_0x4eb5d8){var _0x428657={'raw':!![],'where':{'id':_0x2edbe2['params']['id']}},_0x3630e3={};_0x3630e3[_0x2f5d('0x2a')]=_[_0x2f5d('0x2b')](db['OpenchannelTransferReport'][_0x2f5d('0x28')]);_0x3630e3[_0x2f5d('0x2e')]=_[_0x2f5d('0x2b')](_0x2edbe2[_0x2f5d('0x2e')]);_0x3630e3[_0x2f5d('0x2c')]=_[_0x2f5d('0x2d')](_0x3630e3['model'],_0x3630e3[_0x2f5d('0x2e')]);_0x428657['attributes']=_['intersection'](_0x3630e3[_0x2f5d('0x2a')],qs['fields'](_0x2edbe2[_0x2f5d('0x2e')][_0x2f5d('0x30')]));_0x428657[_0x2f5d('0x2f')]=_0x428657['attributes'][_0x2f5d('0x31')]?_0x428657['attributes']:_0x3630e3[_0x2f5d('0x2a')];if(_0x2edbe2[_0x2f5d('0x2e')]['includeAll']){_0x428657['include']=[{'all':!![]}];}_0x428657=_[_0x2f5d('0x3a')]({},_0x428657,_0x2edbe2[_0x2f5d('0x3d')]);return db[_0x2f5d('0x27')]['find'](_0x428657)[_0x2f5d('0x20')](handleEntityNotFound(_0x4eb5d8,null))[_0x2f5d('0x20')](respondWithResult(_0x4eb5d8,null))[_0x2f5d('0x43')](handleError(_0x4eb5d8,null));};exports['create']=function(_0x428c27,_0x7c0d2b){return db[_0x2f5d('0x27')][_0x2f5d('0x44')](_0x428c27[_0x2f5d('0x45')],{})[_0x2f5d('0x20')](respondWithResult(_0x7c0d2b,0xc9))[_0x2f5d('0x43')](handleError(_0x7c0d2b,null));};exports[_0x2f5d('0x46')]=function(_0x57ef9b,_0x32e607){if(_0x57ef9b[_0x2f5d('0x45')]['id']){delete _0x57ef9b[_0x2f5d('0x45')]['id'];}return db['OpenchannelTransferReport'][_0x2f5d('0x47')]({'where':{'id':_0x57ef9b[_0x2f5d('0x48')]['id']}})[_0x2f5d('0x20')](handleEntityNotFound(_0x32e607,null))[_0x2f5d('0x20')](saveUpdates(_0x57ef9b[_0x2f5d('0x45')],null))[_0x2f5d('0x20')](respondWithResult(_0x32e607,null))[_0x2f5d('0x43')](handleError(_0x32e607,null));};exports['destroy']=function(_0x4f701f,_0xa71328){return db['OpenchannelTransferReport']['find']({'where':{'id':_0x4f701f[_0x2f5d('0x48')]['id']}})[_0x2f5d('0x20')](handleEntityNotFound(_0xa71328,null))[_0x2f5d('0x20')](removeEntity(_0xa71328,null))[_0x2f5d('0x43')](handleError(_0xa71328,null));};exports['describe']=function(_0x19c1fc,_0x3840f6){return db[_0x2f5d('0x27')][_0x2f5d('0x49')]()['then'](respondWithResult(_0x3840f6,null))[_0x2f5d('0x43')](handleError(_0x3840f6,null));}; \ No newline at end of file +var _0x103f=['name','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','options','find','create','body','update','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','then','error','stack'];(function(_0x1c90a7,_0x115e4d){var _0x408b33=function(_0x4b2b46){while(--_0x4b2b46){_0x1c90a7['push'](_0x1c90a7['shift']());}};_0x408b33(++_0x115e4d);}(_0x103f,0x14c));var _0xf103=function(_0x33e9b2,_0x26890f){_0x33e9b2=_0x33e9b2-0x0;var _0x48c872=_0x103f[_0x33e9b2];return _0x48c872;};'use strict';var emlformat=require(_0xf103('0x0'));var rimraf=require(_0xf103('0x1'));var zipdir=require(_0xf103('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf103('0x3'));var moment=require(_0xf103('0x4'));var BPromise=require(_0xf103('0x5'));var Mustache=require('mustache');var util=require(_0xf103('0x6'));var path=require('path');var sox=require(_0xf103('0x7'));var csv=require(_0xf103('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf103('0x9'));var _=require(_0xf103('0xa'));var squel=require(_0xf103('0xb'));var crypto=require('crypto');var jsforce=require(_0xf103('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf103('0xd'));var Papa=require('papaparse');var Redis=require(_0xf103('0xe'));var authService=require(_0xf103('0xf'));var qs=require(_0xf103('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf103('0x11'))(_0xf103('0x12'));var utils=require(_0xf103('0x13'));var config=require(_0xf103('0x14'));var licenseUtil=require(_0xf103('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2091bc,_0x2c508e){_0x2c508e=_0x2c508e||0xcc;return function(_0x20ac9a){if(_0x20ac9a){return _0x2091bc[_0xf103('0x16')](_0x2c508e);}return _0x2091bc['status'](_0x2c508e)[_0xf103('0x17')]();};}function respondWithResult(_0x41a5fe,_0x2115a6){_0x2115a6=_0x2115a6||0xc8;return function(_0x481ebf){if(_0x481ebf){return _0x41a5fe[_0xf103('0x18')](_0x2115a6)[_0xf103('0x19')](_0x481ebf);}};}function respondWithFilteredResult(_0xdbca86,_0x104b6e){return function(_0x2a428c){if(_0x2a428c){var _0x21cd34=typeof _0x104b6e[_0xf103('0x1a')]===_0xf103('0x1b')&&typeof _0x104b6e[_0xf103('0x1c')]===_0xf103('0x1b');var _0x79be7c=_0x2a428c[_0xf103('0x1d')];var _0x2a8e5a=_0x21cd34?0x0:_0x104b6e[_0xf103('0x1a')];var _0x36ac3d=_0x21cd34?_0x2a428c[_0xf103('0x1d')]:_0x104b6e[_0xf103('0x1a')]+_0x104b6e[_0xf103('0x1c')];var _0xead0f9;if(_0x36ac3d>=_0x79be7c){_0x36ac3d=_0x79be7c;_0xead0f9=0xc8;}else{_0xead0f9=0xce;}_0xdbca86[_0xf103('0x18')](_0xead0f9);return _0xdbca86[_0xf103('0x1e')](_0xf103('0x1f'),_0x2a8e5a+'-'+_0x36ac3d+'/'+_0x79be7c)[_0xf103('0x19')](_0x2a428c);}return null;};}function patchUpdates(_0x563741){return function(_0x355a5e){try{jsonpatch['apply'](_0x355a5e,_0x563741,!![]);}catch(_0x4dccd9){return BPromise[_0xf103('0x20')](_0x4dccd9);}return _0x355a5e[_0xf103('0x21')]();};}function saveUpdates(_0x53151d,_0x4666ff){return function(_0x26d8ba){if(_0x26d8ba){return _0x26d8ba['update'](_0x53151d)['then'](function(_0x5854f6){return _0x5854f6;});}return null;};}function removeEntity(_0x58c562,_0x46249a){return function(_0x130548){if(_0x130548){return _0x130548[_0xf103('0x22')]()[_0xf103('0x23')](function(){_0x58c562[_0xf103('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21da6f,_0x233995){return function(_0xe0549){if(!_0xe0549){_0x21da6f['sendStatus'](0x194);}return _0xe0549;};}function handleError(_0x448f92,_0x22d0c0){_0x22d0c0=_0x22d0c0||0x1f4;return function(_0x12f4a5){logger[_0xf103('0x24')](_0x12f4a5[_0xf103('0x25')]);if(_0x12f4a5[_0xf103('0x26')]){delete _0x12f4a5[_0xf103('0x26')];}_0x448f92[_0xf103('0x18')](_0x22d0c0)['send'](_0x12f4a5);};}exports['index']=function(_0x7cac2d,_0x3715cc){var _0x40af05={},_0x296988={},_0x548415={'count':0x0,'rows':[]};var _0x12822e=_[_0xf103('0x27')](db[_0xf103('0x28')][_0xf103('0x29')],function(_0x452397){return{'name':_0x452397[_0xf103('0x2a')],'type':_0x452397[_0xf103('0x2b')][_0xf103('0x2c')]};});_0x296988['model']=_['map'](_0x12822e,_0xf103('0x26'));_0x296988['query']=_[_0xf103('0x2d')](_0x7cac2d[_0xf103('0x2e')]);_0x296988['filters']=_[_0xf103('0x2f')](_0x296988[_0xf103('0x30')],_0x296988['query']);_0x40af05[_0xf103('0x31')]=_[_0xf103('0x2f')](_0x296988['model'],qs['fields'](_0x7cac2d['query'][_0xf103('0x32')]));_0x40af05['attributes']=_0x40af05[_0xf103('0x31')][_0xf103('0x33')]?_0x40af05[_0xf103('0x31')]:_0x296988[_0xf103('0x30')];if(!_0x7cac2d[_0xf103('0x2e')][_0xf103('0x34')]('nolimit')){_0x40af05[_0xf103('0x1c')]=qs[_0xf103('0x1c')](_0x7cac2d[_0xf103('0x2e')][_0xf103('0x1c')]);_0x40af05['offset']=qs['offset'](_0x7cac2d[_0xf103('0x2e')][_0xf103('0x1a')]);}_0x40af05[_0xf103('0x35')]=qs['sort'](_0x7cac2d[_0xf103('0x2e')][_0xf103('0x36')]);_0x40af05[_0xf103('0x37')]=qs['filters'](_[_0xf103('0x38')](_0x7cac2d[_0xf103('0x2e')],_0x296988[_0xf103('0x39')]),_0x12822e);if(_0x7cac2d[_0xf103('0x2e')][_0xf103('0x3a')]){_0x40af05[_0xf103('0x37')]=_['merge'](_0x40af05[_0xf103('0x37')],{'$or':_[_0xf103('0x27')](_0x12822e,function(_0x14712a){if(_0x14712a[_0xf103('0x2b')]!==_0xf103('0x3b')){var _0x44c266={};_0x44c266[_0x14712a[_0xf103('0x26')]]={'$like':'%'+_0x7cac2d[_0xf103('0x2e')]['filter']+'%'};return _0x44c266;}})});}_0x40af05=_[_0xf103('0x3c')]({},_0x40af05,_0x7cac2d['options']);var _0x1a6c82={'where':_0x40af05['where']};return db['OpenchannelTransferReport'][_0xf103('0x1d')](_0x1a6c82)[_0xf103('0x23')](function(_0x5c4f51){_0x548415[_0xf103('0x1d')]=_0x5c4f51;if(_0x7cac2d[_0xf103('0x2e')][_0xf103('0x3d')]){_0x40af05[_0xf103('0x3e')]=[{'all':!![]}];}return db[_0xf103('0x28')][_0xf103('0x3f')](_0x40af05);})[_0xf103('0x23')](function(_0x2f2d61){_0x548415[_0xf103('0x40')]=_0x2f2d61;return _0x548415;})[_0xf103('0x23')](respondWithFilteredResult(_0x3715cc,_0x40af05))[_0xf103('0x41')](handleError(_0x3715cc,null));};exports[_0xf103('0x42')]=function(_0x270118,_0x138f0b){var _0x3c9576={'raw':!![],'where':{'id':_0x270118['params']['id']}},_0x52bfd8={};_0x52bfd8[_0xf103('0x30')]=_[_0xf103('0x2d')](db[_0xf103('0x28')][_0xf103('0x29')]);_0x52bfd8[_0xf103('0x2e')]=_[_0xf103('0x2d')](_0x270118['query']);_0x52bfd8[_0xf103('0x39')]=_[_0xf103('0x2f')](_0x52bfd8[_0xf103('0x30')],_0x52bfd8[_0xf103('0x2e')]);_0x3c9576[_0xf103('0x31')]=_[_0xf103('0x2f')](_0x52bfd8[_0xf103('0x30')],qs['fields'](_0x270118[_0xf103('0x2e')][_0xf103('0x32')]));_0x3c9576[_0xf103('0x31')]=_0x3c9576[_0xf103('0x31')][_0xf103('0x33')]?_0x3c9576[_0xf103('0x31')]:_0x52bfd8[_0xf103('0x30')];if(_0x270118['query'][_0xf103('0x3d')]){_0x3c9576[_0xf103('0x3e')]=[{'all':!![]}];}_0x3c9576=_[_0xf103('0x3c')]({},_0x3c9576,_0x270118[_0xf103('0x43')]);return db[_0xf103('0x28')][_0xf103('0x44')](_0x3c9576)['then'](handleEntityNotFound(_0x138f0b,null))[_0xf103('0x23')](respondWithResult(_0x138f0b,null))['catch'](handleError(_0x138f0b,null));};exports[_0xf103('0x45')]=function(_0x282f09,_0x2f6c46){return db[_0xf103('0x28')][_0xf103('0x45')](_0x282f09[_0xf103('0x46')],{})[_0xf103('0x23')](respondWithResult(_0x2f6c46,0xc9))[_0xf103('0x41')](handleError(_0x2f6c46,null));};exports[_0xf103('0x47')]=function(_0x29d5c8,_0x16d75a){if(_0x29d5c8['body']['id']){delete _0x29d5c8[_0xf103('0x46')]['id'];}return db['OpenchannelTransferReport']['find']({'where':{'id':_0x29d5c8[_0xf103('0x48')]['id']}})[_0xf103('0x23')](handleEntityNotFound(_0x16d75a,null))['then'](saveUpdates(_0x29d5c8[_0xf103('0x46')],null))[_0xf103('0x23')](respondWithResult(_0x16d75a,null))['catch'](handleError(_0x16d75a,null));};exports[_0xf103('0x22')]=function(_0x475f95,_0x1a3813){return db['OpenchannelTransferReport'][_0xf103('0x44')]({'where':{'id':_0x475f95['params']['id']}})[_0xf103('0x23')](handleEntityNotFound(_0x1a3813,null))[_0xf103('0x23')](removeEntity(_0x1a3813,null))[_0xf103('0x41')](handleError(_0x1a3813,null));};exports['describe']=function(_0x10c823,_0x59ee94){return db['OpenchannelTransferReport'][_0xf103('0x49')]()[_0xf103('0x23')](respondWithResult(_0x59ee94,null))[_0xf103('0x41')](handleError(_0x59ee94,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index c94a467..fb4a0d5 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 _0xd089=['OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util','moment','bluebird','path','rimraf','../../config/environment','exports'];(function(_0x6a0266,_0x1552d6){var _0x309e00=function(_0x17c1d1){while(--_0x17c1d1){_0x6a0266['push'](_0x6a0266['shift']());}};_0x309e00(++_0x1552d6);}(_0xd089,0x107));var _0x9d08=function(_0x37b197,_0xe1a0e5){_0x37b197=_0x37b197-0x0;var _0x3f9108=_0xd089[_0x37b197];return _0x3f9108;};'use strict';var _=require('lodash');var util=require(_0x9d08('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x9d08('0x1'));var BPromise=require(_0x9d08('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9d08('0x3'));var rimraf=require(_0x9d08('0x4'));var config=require(_0x9d08('0x5'));var attributes=require('./openchannelTransferReport.attributes');module[_0x9d08('0x6')]=function(_0x48cdb9,_0x2c0591){return _0x48cdb9['define'](_0x9d08('0x7'),attributes,{'tableName':_0x9d08('0x8'),'paranoid':![],'indexes':[{'name':_0x9d08('0x9'),'fields':[_0x9d08('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb8b0=['define','OpenchannelTransferReport','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','exports'];(function(_0xb9f1bf,_0x2b62a3){var _0x521fe7=function(_0x2bc7a4){while(--_0x2bc7a4){_0xb9f1bf['push'](_0xb9f1bf['shift']());}};_0x521fe7(++_0x2b62a3);}(_0xb8b0,0x115));var _0x0b8b=function(_0x509a63,_0x42dba8){_0x509a63=_0x509a63-0x0;var _0x25c908=_0xb8b0[_0x509a63];return _0x25c908;};'use strict';var _=require(_0x0b8b('0x0'));var util=require(_0x0b8b('0x1'));var logger=require(_0x0b8b('0x2'))(_0x0b8b('0x3'));var moment=require('moment');var BPromise=require(_0x0b8b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b8b('0x5'));var rimraf=require(_0x0b8b('0x6'));var config=require(_0x0b8b('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0x0b8b('0x8')]=function(_0x3ab3b1,_0x29cb20){return _0x3ab3b1[_0x0b8b('0x9')](_0x0b8b('0xa'),attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 7d6c982..9569aa0 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 _0xa1f6=['client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','jayson/promise'];(function(_0x32bfd6,_0x5b289d){var _0x17cb8b=function(_0x4d9d35){while(--_0x4d9d35){_0x32bfd6['push'](_0x32bfd6['shift']());}};_0x17cb8b(++_0x5b289d);}(_0xa1f6,0x19d));var _0x6a1f=function(_0x541a67,_0x50728d){_0x541a67=_0x541a67-0x0;var _0x45da2a=_0xa1f6[_0x541a67];return _0x45da2a;};'use strict';var _=require(_0x6a1f('0x0'));var util=require(_0x6a1f('0x1'));var moment=require(_0x6a1f('0x2'));var BPromise=require(_0x6a1f('0x3'));var rs=require(_0x6a1f('0x4'));var fs=require('fs');var Redis=require(_0x6a1f('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6a1f('0x6'));var client=jayson[_0x6a1f('0x7')][_0x6a1f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3a772b,_0x328033,_0x3ecd63){return new BPromise(function(_0x36c00b,_0x56bf63){return client[_0x6a1f('0x9')](_0x3a772b,_0x3ecd63)[_0x6a1f('0xa')](function(_0x2300b1){logger[_0x6a1f('0xb')](_0x6a1f('0xc'),_0x328033,'request\x20sent');logger[_0x6a1f('0xd')](_0x6a1f('0xe'),_0x328033,_0x6a1f('0xf'),JSON[_0x6a1f('0x10')](_0x2300b1));if(_0x2300b1['error']){if(_0x2300b1[_0x6a1f('0x11')]['code']===0x1f4){logger[_0x6a1f('0x11')](_0x6a1f('0xc'),_0x328033,_0x2300b1[_0x6a1f('0x11')][_0x6a1f('0x12')]);return _0x56bf63(_0x2300b1[_0x6a1f('0x11')][_0x6a1f('0x12')]);}logger[_0x6a1f('0x11')](_0x6a1f('0xc'),_0x328033,_0x2300b1[_0x6a1f('0x11')][_0x6a1f('0x12')]);return _0x36c00b(_0x2300b1[_0x6a1f('0x11')][_0x6a1f('0x12')]);}else{logger[_0x6a1f('0xb')](_0x6a1f('0xc'),_0x328033,_0x6a1f('0xf'));_0x36c00b(_0x2300b1[_0x6a1f('0x13')][_0x6a1f('0x12')]);}})[_0x6a1f('0x14')](function(_0x2c44a0){logger['error'](_0x6a1f('0xc'),_0x328033,_0x2c44a0);_0x56bf63(_0x2c44a0);});});} \ No newline at end of file +var _0xc21e=['result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info'];(function(_0x365a31,_0x542d3f){var _0xe860a5=function(_0x59a0c5){while(--_0x59a0c5){_0x365a31['push'](_0x365a31['shift']());}};_0xe860a5(++_0x542d3f);}(_0xc21e,0x1ca));var _0xec21=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc21e[_0x4565bf];return _0x5610ba;};'use strict';var _=require('lodash');var util=require(_0xec21('0x0'));var moment=require(_0xec21('0x1'));var BPromise=require(_0xec21('0x2'));var rs=require(_0xec21('0x3'));var fs=require('fs');var Redis=require(_0xec21('0x4'));var db=require(_0xec21('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec21('0x6'))(_0xec21('0x7'));var config=require(_0xec21('0x8'));var jayson=require(_0xec21('0x9'));var client=jayson[_0xec21('0xa')][_0xec21('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x406b66,_0x2f15e7,_0x51f6dc){return new BPromise(function(_0x2b1396,_0x3d74a2){return client[_0xec21('0xc')](_0x406b66,_0x51f6dc)[_0xec21('0xd')](function(_0x4d478){logger['info'](_0xec21('0xe'),_0x2f15e7,_0xec21('0xf'));logger[_0xec21('0x10')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2f15e7,'request\x20sent',JSON[_0xec21('0x11')](_0x4d478));if(_0x4d478[_0xec21('0x12')]){if(_0x4d478['error'][_0xec21('0x13')]===0x1f4){logger[_0xec21('0x12')](_0xec21('0xe'),_0x2f15e7,_0x4d478[_0xec21('0x12')][_0xec21('0x14')]);return _0x3d74a2(_0x4d478['error'][_0xec21('0x14')]);}logger['error'](_0xec21('0xe'),_0x2f15e7,_0x4d478[_0xec21('0x12')][_0xec21('0x14')]);return _0x2b1396(_0x4d478['error'][_0xec21('0x14')]);}else{logger[_0xec21('0x15')](_0xec21('0xe'),_0x2f15e7,_0xec21('0xf'));_0x2b1396(_0x4d478[_0xec21('0x16')][_0xec21('0x14')]);}})[_0xec21('0x17')](function(_0x350a53){logger['error'](_0xec21('0xe'),_0x2f15e7,_0x350a53);_0x3d74a2(_0x350a53);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 1166073..f516844 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 _0x9162=['post','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x9162,0x14a));var _0x2916=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x9162[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x2916('0x0'));var util=require(_0x2916('0x1'));var path=require(_0x2916('0x2'));var timeout=require('connect-timeout');var express=require(_0x2916('0x3'));var router=express[_0x2916('0x4')]();var fs_extra=require(_0x2916('0x5'));var auth=require(_0x2916('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2916('0x7'));var controller=require('./pause.controller');router[_0x2916('0x8')]('/',auth[_0x2916('0x9')](),controller[_0x2916('0xa')]);router['get'](_0x2916('0xb'),auth[_0x2916('0x9')](),controller['show']);router[_0x2916('0xc')]('/',auth[_0x2916('0x9')](),controller['create']);router[_0x2916('0xd')](_0x2916('0xb'),auth[_0x2916('0x9')](),controller[_0x2916('0xe')]);router[_0x2916('0xf')]('/:id',auth[_0x2916('0x9')](),controller[_0x2916('0x10')]);module[_0x2916('0x11')]=router; \ No newline at end of file +var _0x1194=['get','isAuthenticated','/:id','show','post','create','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','./pause.controller'];(function(_0x5d246e,_0x30caa1){var _0x3a118f=function(_0x32cee9){while(--_0x32cee9){_0x5d246e['push'](_0x5d246e['shift']());}};_0x3a118f(++_0x30caa1);}(_0x1194,0x1c4));var _0x4119=function(_0x24243b,_0x55c567){_0x24243b=_0x24243b-0x0;var _0x1a85ce=_0x1194[_0x24243b];return _0x1a85ce;};'use strict';var multer=require('multer');var util=require(_0x4119('0x0'));var path=require(_0x4119('0x1'));var timeout=require(_0x4119('0x2'));var express=require(_0x4119('0x3'));var router=express['Router']();var fs_extra=require(_0x4119('0x4'));var auth=require(_0x4119('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4119('0x6'));router[_0x4119('0x7')]('/',auth[_0x4119('0x8')](),controller['index']);router[_0x4119('0x7')](_0x4119('0x9'),auth[_0x4119('0x8')](),controller[_0x4119('0xa')]);router[_0x4119('0xb')]('/',auth['isAuthenticated'](),controller[_0x4119('0xc')]);router['put'](_0x4119('0x9'),auth[_0x4119('0x8')](),controller[_0x4119('0xd')]);router[_0x4119('0xe')]('/:id',auth[_0x4119('0x8')](),controller[_0x4119('0xf')]);module[_0x4119('0x10')]=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 5a90b61..459a947 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 _0x647f=['name','STRING'];(function(_0x4f72b1,_0x248817){var _0x41e5e5=function(_0x25a042){while(--_0x25a042){_0x4f72b1['push'](_0x4f72b1['shift']());}};_0x41e5e5(++_0x248817);}(_0x647f,0x75));var _0xf647=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x647f[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xf647('0x0')],'unique':_0xf647('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xf647('0x0')]}}; \ No newline at end of file +var _0x159d=['STRING','sequelize','exports'];(function(_0x24388b,_0x2bfa63){var _0x1a10d0=function(_0x5e539c){while(--_0x5e539c){_0x24388b['push'](_0x24388b['shift']());}};_0x1a10d0(++_0x2bfa63);}(_0x159d,0xd3));var _0xd159=function(_0x16e583,_0x31eceb){_0x16e583=_0x16e583-0x0;var _0x352683=_0x159d[_0x16e583];return _0x352683;};'use strict';var Sequelize=require(_0xd159('0x0'));module[_0xd159('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0xd159('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index f1ccd71..e28f54e 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 _0xed98=['params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','count','offset','limit','apply','save','update','then','destroy','Pauses','end','error','stack','name','index','Pause','rawAttributes','fieldName','key','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x4938ae,_0xa6036a){var _0xc070e8=function(_0x1fe630){while(--_0x1fe630){_0x4938ae['push'](_0x4938ae['shift']());}};_0xc070e8(++_0xa6036a);}(_0xed98,0xfd));var _0x8ed9=function(_0x4978dd,_0x12923b){_0x4978dd=_0x4978dd-0x0;var _0x1e9e7c=_0xed98[_0x4978dd];return _0x1e9e7c;};'use strict';var emlformat=require(_0x8ed9('0x0'));var rimraf=require(_0x8ed9('0x1'));var zipdir=require(_0x8ed9('0x2'));var jsonpatch=require(_0x8ed9('0x3'));var rp=require(_0x8ed9('0x4'));var moment=require(_0x8ed9('0x5'));var BPromise=require(_0x8ed9('0x6'));var Mustache=require(_0x8ed9('0x7'));var util=require('util');var path=require(_0x8ed9('0x8'));var sox=require(_0x8ed9('0x9'));var csv=require('to-csv');var ejs=require(_0x8ed9('0xa'));var fs=require('fs');var fs_extra=require(_0x8ed9('0xb'));var _=require(_0x8ed9('0xc'));var squel=require(_0x8ed9('0xd'));var crypto=require(_0x8ed9('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8ed9('0xf'));var querystring=require(_0x8ed9('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8ed9('0x11'));var qs=require(_0x8ed9('0x12'));var as=require(_0x8ed9('0x13'));var hardwareService=require(_0x8ed9('0x14'));var logger=require(_0x8ed9('0x15'))(_0x8ed9('0x16'));var utils=require(_0x8ed9('0x17'));var config=require(_0x8ed9('0x18'));var licenseUtil=require(_0x8ed9('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x521798,_0x14d36e){_0x14d36e=_0x14d36e||0xcc;return function(_0x10e532){if(_0x10e532){return _0x521798[_0x8ed9('0x1a')](_0x14d36e);}return _0x521798[_0x8ed9('0x1b')](_0x14d36e)['end']();};}function respondWithResult(_0x19c892,_0x47504c){_0x47504c=_0x47504c||0xc8;return function(_0x4de14c){if(_0x4de14c){return _0x19c892[_0x8ed9('0x1b')](_0x47504c)[_0x8ed9('0x1c')](_0x4de14c);}};}function respondWithFilteredResult(_0x1a28b7,_0x30da85){return function(_0x4b181e){if(_0x4b181e){var _0x335bc5=typeof _0x30da85['offset']==='undefined'&&typeof _0x30da85['limit']==='undefined';var _0x407ed3=_0x4b181e[_0x8ed9('0x1d')];var _0x137a36=_0x335bc5?0x0:_0x30da85[_0x8ed9('0x1e')];var _0x2b3f32=_0x335bc5?_0x4b181e['count']:_0x30da85[_0x8ed9('0x1e')]+_0x30da85[_0x8ed9('0x1f')];var _0x3c9c12;if(_0x2b3f32>=_0x407ed3){_0x2b3f32=_0x407ed3;_0x3c9c12=0xc8;}else{_0x3c9c12=0xce;}_0x1a28b7[_0x8ed9('0x1b')](_0x3c9c12);return _0x1a28b7['set']('Content-Range',_0x137a36+'-'+_0x2b3f32+'/'+_0x407ed3)[_0x8ed9('0x1c')](_0x4b181e);}return null;};}function patchUpdates(_0x2ad782){return function(_0x37590e){try{jsonpatch[_0x8ed9('0x20')](_0x37590e,_0x2ad782,!![]);}catch(_0x15c669){return BPromise['reject'](_0x15c669);}return _0x37590e[_0x8ed9('0x21')]();};}function saveUpdates(_0x470c7d,_0x47df46){return function(_0x19349b){if(_0x19349b){return _0x19349b[_0x8ed9('0x22')](_0x470c7d)[_0x8ed9('0x23')](function(_0x3b33fe){return _0x3b33fe;});}return null;};}function removeEntity(_0x58f468,_0x26b3b3){return function(_0x1c20d4){if(_0x1c20d4){return _0x1c20d4[_0x8ed9('0x24')]()[_0x8ed9('0x23')](function(){var _0x46e610=_0x1c20d4['get']({'plain':!![]});var _0x50b474=_0x8ed9('0x25');return db['UserProfileResource']['destroy']({'where':{'type':_0x50b474,'resourceId':_0x46e610['id']}})[_0x8ed9('0x23')](function(){return _0x1c20d4;});})['then'](function(){_0x58f468[_0x8ed9('0x1b')](0xcc)[_0x8ed9('0x26')]();});}};}function handleEntityNotFound(_0x2be3e1,_0x48606d){return function(_0x9962da){if(!_0x9962da){_0x2be3e1[_0x8ed9('0x1a')](0x194);}return _0x9962da;};}function handleError(_0x23827e,_0x553841){_0x553841=_0x553841||0x1f4;return function(_0x569640){logger[_0x8ed9('0x27')](_0x569640[_0x8ed9('0x28')]);if(_0x569640[_0x8ed9('0x29')]){delete _0x569640['name'];}_0x23827e['status'](_0x553841)['send'](_0x569640);};}exports[_0x8ed9('0x2a')]=function(_0x3188f5,_0xd02391){var _0x4b964b={},_0x1c6500={},_0x208b58={'count':0x0,'rows':[]};var _0x2d3f87=_['map'](db[_0x8ed9('0x2b')][_0x8ed9('0x2c')],function(_0x5a30df){return{'name':_0x5a30df[_0x8ed9('0x2d')],'type':_0x5a30df['type'][_0x8ed9('0x2e')]};});_0x1c6500[_0x8ed9('0x2f')]=_[_0x8ed9('0x30')](_0x2d3f87,_0x8ed9('0x29'));_0x1c6500['query']=_[_0x8ed9('0x31')](_0x3188f5[_0x8ed9('0x32')]);_0x1c6500[_0x8ed9('0x33')]=_['intersection'](_0x1c6500[_0x8ed9('0x2f')],_0x1c6500['query']);_0x4b964b['attributes']=_[_0x8ed9('0x34')](_0x1c6500[_0x8ed9('0x2f')],qs[_0x8ed9('0x35')](_0x3188f5['query']['fields']));_0x4b964b['attributes']=_0x4b964b[_0x8ed9('0x36')][_0x8ed9('0x37')]?_0x4b964b[_0x8ed9('0x36')]:_0x1c6500[_0x8ed9('0x2f')];if(!_0x3188f5[_0x8ed9('0x32')][_0x8ed9('0x38')]('nolimit')){_0x4b964b[_0x8ed9('0x1f')]=qs['limit'](_0x3188f5[_0x8ed9('0x32')][_0x8ed9('0x1f')]);_0x4b964b[_0x8ed9('0x1e')]=qs[_0x8ed9('0x1e')](_0x3188f5['query'][_0x8ed9('0x1e')]);}_0x4b964b[_0x8ed9('0x39')]=qs[_0x8ed9('0x3a')](_0x3188f5[_0x8ed9('0x32')]['sort']);_0x4b964b['where']=qs[_0x8ed9('0x33')](_[_0x8ed9('0x3b')](_0x3188f5[_0x8ed9('0x32')],_0x1c6500[_0x8ed9('0x33')]),_0x2d3f87);if(_0x3188f5[_0x8ed9('0x32')][_0x8ed9('0x3c')]){_0x4b964b[_0x8ed9('0x3d')]=_[_0x8ed9('0x3e')](_0x4b964b['where'],{'$or':_[_0x8ed9('0x30')](_0x2d3f87,function(_0x1707c3){if(_0x1707c3[_0x8ed9('0x3f')]!==_0x8ed9('0x40')){var _0xc13d8f={};_0xc13d8f[_0x1707c3['name']]={'$like':'%'+_0x3188f5['query'][_0x8ed9('0x3c')]+'%'};return _0xc13d8f;}})});}_0x4b964b=_[_0x8ed9('0x3e')]({},_0x4b964b,_0x3188f5[_0x8ed9('0x41')]);var _0x35cda8={'where':_0x4b964b[_0x8ed9('0x3d')]};return db[_0x8ed9('0x2b')]['count'](_0x35cda8)[_0x8ed9('0x23')](function(_0x635c39){_0x208b58['count']=_0x635c39;if(_0x3188f5[_0x8ed9('0x32')][_0x8ed9('0x42')]){_0x4b964b[_0x8ed9('0x43')]=[{'all':!![]}];}return db[_0x8ed9('0x2b')][_0x8ed9('0x44')](_0x4b964b);})[_0x8ed9('0x23')](function(_0x25a02e){_0x208b58['rows']=_0x25a02e;return _0x208b58;})[_0x8ed9('0x23')](respondWithFilteredResult(_0xd02391,_0x4b964b))['catch'](handleError(_0xd02391,null));};exports[_0x8ed9('0x45')]=function(_0x22c4ba,_0x226bca){var _0x2de5ee={'raw':!![],'where':{'id':_0x22c4ba['params']['id']}},_0x3a4eed={};_0x3a4eed[_0x8ed9('0x2f')]=_[_0x8ed9('0x31')](db[_0x8ed9('0x2b')][_0x8ed9('0x2c')]);_0x3a4eed['query']=_[_0x8ed9('0x31')](_0x22c4ba['query']);_0x3a4eed['filters']=_[_0x8ed9('0x34')](_0x3a4eed[_0x8ed9('0x2f')],_0x3a4eed[_0x8ed9('0x32')]);_0x2de5ee[_0x8ed9('0x36')]=_['intersection'](_0x3a4eed[_0x8ed9('0x2f')],qs['fields'](_0x22c4ba['query'][_0x8ed9('0x35')]));_0x2de5ee['attributes']=_0x2de5ee[_0x8ed9('0x36')][_0x8ed9('0x37')]?_0x2de5ee[_0x8ed9('0x36')]:_0x3a4eed[_0x8ed9('0x2f')];if(_0x22c4ba['query'][_0x8ed9('0x42')]){_0x2de5ee[_0x8ed9('0x43')]=[{'all':!![]}];}_0x2de5ee=_[_0x8ed9('0x3e')]({},_0x2de5ee,_0x22c4ba[_0x8ed9('0x41')]);return db[_0x8ed9('0x2b')][_0x8ed9('0x46')](_0x2de5ee)[_0x8ed9('0x23')](handleEntityNotFound(_0x226bca,null))['then'](respondWithResult(_0x226bca,null))['catch'](handleError(_0x226bca,null));};exports[_0x8ed9('0x47')]=function(_0xed2b5c,_0x371656){return db[_0x8ed9('0x2b')][_0x8ed9('0x47')](_0xed2b5c[_0x8ed9('0x48')],{})[_0x8ed9('0x23')](function(_0x182fdd){var _0x4c401e=_0xed2b5c[_0x8ed9('0x49')][_0x8ed9('0x4a')]({'plain':!![]});if(!_0x4c401e)throw new Error(_0x8ed9('0x4b'));if(_0x4c401e[_0x8ed9('0x4c')]===_0x8ed9('0x49')){var _0x4ffad3=_0x182fdd[_0x8ed9('0x4a')]({'plain':!![]});var _0x43c9d8=_0x8ed9('0x25');return db[_0x8ed9('0x4d')][_0x8ed9('0x46')]({'where':{'name':_0x43c9d8,'userProfileId':_0x4c401e[_0x8ed9('0x4e')]},'raw':!![]})['then'](function(_0x108c46){if(_0x108c46&&_0x108c46[_0x8ed9('0x4f')]===0x0){return db[_0x8ed9('0x50')][_0x8ed9('0x47')]({'name':_0x4ffad3[_0x8ed9('0x29')],'resourceId':_0x4ffad3['id'],'type':_0x108c46[_0x8ed9('0x29')],'sectionId':_0x108c46['id']},{})[_0x8ed9('0x23')](function(){return _0x182fdd;});}else{return _0x182fdd;}})[_0x8ed9('0x51')](function(_0x300b2a){logger['error'](_0x8ed9('0x52'),_0x300b2a);throw _0x300b2a;});}return _0x182fdd;})[_0x8ed9('0x23')](respondWithResult(_0x371656,0xc9))['catch'](handleError(_0x371656,null));};exports[_0x8ed9('0x22')]=function(_0x527e13,_0x13e6a0){if(_0x527e13[_0x8ed9('0x48')]['id']){delete _0x527e13[_0x8ed9('0x48')]['id'];}return db[_0x8ed9('0x2b')][_0x8ed9('0x46')]({'where':{'id':_0x527e13[_0x8ed9('0x53')]['id']}})[_0x8ed9('0x23')](handleEntityNotFound(_0x13e6a0,null))[_0x8ed9('0x23')](saveUpdates(_0x527e13[_0x8ed9('0x48')],null))[_0x8ed9('0x23')](respondWithResult(_0x13e6a0,null))[_0x8ed9('0x51')](handleError(_0x13e6a0,null));};exports['destroy']=function(_0x463f86,_0x124fb9){return db['Pause'][_0x8ed9('0x46')]({'where':{'id':_0x463f86[_0x8ed9('0x53')]['id']}})['then'](handleEntityNotFound(_0x124fb9,null))['then'](removeEntity(_0x124fb9,null))[_0x8ed9('0x51')](handleError(_0x124fb9,null));}; \ No newline at end of file +var _0x8fd4=['offset','set','Content-Range','reject','update','then','destroy','get','Pauses','UserProfileResource','error','stack','send','index','Pause','fieldName','type','key','model','map','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','rawAttributes','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','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','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','sendStatus','status','end','json','limit','undefined','count'];(function(_0x183fae,_0x5cd92a){var _0x10a422=function(_0x5ac94b){while(--_0x5ac94b){_0x183fae['push'](_0x183fae['shift']());}};_0x10a422(++_0x5cd92a);}(_0x8fd4,0x1e7));var _0x48fd=function(_0x2dadb9,_0x42cfe6){_0x2dadb9=_0x2dadb9-0x0;var _0x2f0097=_0x8fd4[_0x2dadb9];return _0x2f0097;};'use strict';var emlformat=require(_0x48fd('0x0'));var rimraf=require(_0x48fd('0x1'));var zipdir=require(_0x48fd('0x2'));var jsonpatch=require(_0x48fd('0x3'));var rp=require(_0x48fd('0x4'));var moment=require(_0x48fd('0x5'));var BPromise=require(_0x48fd('0x6'));var Mustache=require(_0x48fd('0x7'));var util=require(_0x48fd('0x8'));var path=require(_0x48fd('0x9'));var sox=require(_0x48fd('0xa'));var csv=require(_0x48fd('0xb'));var ejs=require(_0x48fd('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x48fd('0xd'));var squel=require(_0x48fd('0xe'));var crypto=require(_0x48fd('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x48fd('0x10'));var toCsv=require(_0x48fd('0xb'));var querystring=require(_0x48fd('0x11'));var Papa=require(_0x48fd('0x12'));var Redis=require(_0x48fd('0x13'));var authService=require(_0x48fd('0x14'));var qs=require(_0x48fd('0x15'));var as=require(_0x48fd('0x16'));var hardwareService=require(_0x48fd('0x17'));var logger=require('../../config/logger')(_0x48fd('0x18'));var utils=require(_0x48fd('0x19'));var config=require(_0x48fd('0x1a'));var licenseUtil=require(_0x48fd('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3263f2,_0x19c2ed){_0x19c2ed=_0x19c2ed||0xcc;return function(_0x288a6f){if(_0x288a6f){return _0x3263f2[_0x48fd('0x1c')](_0x19c2ed);}return _0x3263f2[_0x48fd('0x1d')](_0x19c2ed)[_0x48fd('0x1e')]();};}function respondWithResult(_0x129cd6,_0x251008){_0x251008=_0x251008||0xc8;return function(_0x7ea043){if(_0x7ea043){return _0x129cd6[_0x48fd('0x1d')](_0x251008)[_0x48fd('0x1f')](_0x7ea043);}};}function respondWithFilteredResult(_0x28251d,_0xb58008){return function(_0x2e3632){if(_0x2e3632){var _0x13cf30=typeof _0xb58008['offset']==='undefined'&&typeof _0xb58008[_0x48fd('0x20')]===_0x48fd('0x21');var _0xafe172=_0x2e3632[_0x48fd('0x22')];var _0x44e18b=_0x13cf30?0x0:_0xb58008['offset'];var _0x32494a=_0x13cf30?_0x2e3632['count']:_0xb58008[_0x48fd('0x23')]+_0xb58008[_0x48fd('0x20')];var _0x59ef38;if(_0x32494a>=_0xafe172){_0x32494a=_0xafe172;_0x59ef38=0xc8;}else{_0x59ef38=0xce;}_0x28251d[_0x48fd('0x1d')](_0x59ef38);return _0x28251d[_0x48fd('0x24')](_0x48fd('0x25'),_0x44e18b+'-'+_0x32494a+'/'+_0xafe172)[_0x48fd('0x1f')](_0x2e3632);}return null;};}function patchUpdates(_0x41724a){return function(_0x521380){try{jsonpatch['apply'](_0x521380,_0x41724a,!![]);}catch(_0x1c1efc){return BPromise[_0x48fd('0x26')](_0x1c1efc);}return _0x521380['save']();};}function saveUpdates(_0x52fa37,_0x201c58){return function(_0x426017){if(_0x426017){return _0x426017[_0x48fd('0x27')](_0x52fa37)[_0x48fd('0x28')](function(_0x1c2789){return _0x1c2789;});}return null;};}function removeEntity(_0x261b1d,_0x446d0e){return function(_0x396a70){if(_0x396a70){return _0x396a70[_0x48fd('0x29')]()[_0x48fd('0x28')](function(){var _0x1f6977=_0x396a70[_0x48fd('0x2a')]({'plain':!![]});var _0x59c87e=_0x48fd('0x2b');return db[_0x48fd('0x2c')][_0x48fd('0x29')]({'where':{'type':_0x59c87e,'resourceId':_0x1f6977['id']}})[_0x48fd('0x28')](function(){return _0x396a70;});})['then'](function(){_0x261b1d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1bd049,_0x4f3a5e){return function(_0x4a9e7b){if(!_0x4a9e7b){_0x1bd049['sendStatus'](0x194);}return _0x4a9e7b;};}function handleError(_0x3c348b,_0x5cdbd7){_0x5cdbd7=_0x5cdbd7||0x1f4;return function(_0x43e9db){logger[_0x48fd('0x2d')](_0x43e9db[_0x48fd('0x2e')]);if(_0x43e9db['name']){delete _0x43e9db['name'];}_0x3c348b[_0x48fd('0x1d')](_0x5cdbd7)[_0x48fd('0x2f')](_0x43e9db);};}exports[_0x48fd('0x30')]=function(_0xf1c2f7,_0x13be37){var _0x14d889={},_0x22c90d={},_0x2cffa1={'count':0x0,'rows':[]};var _0x54b147=_['map'](db[_0x48fd('0x31')]['rawAttributes'],function(_0x6a77f2){return{'name':_0x6a77f2[_0x48fd('0x32')],'type':_0x6a77f2[_0x48fd('0x33')][_0x48fd('0x34')]};});_0x22c90d[_0x48fd('0x35')]=_[_0x48fd('0x36')](_0x54b147,_0x48fd('0x37'));_0x22c90d[_0x48fd('0x38')]=_[_0x48fd('0x39')](_0xf1c2f7[_0x48fd('0x38')]);_0x22c90d[_0x48fd('0x3a')]=_['intersection'](_0x22c90d[_0x48fd('0x35')],_0x22c90d[_0x48fd('0x38')]);_0x14d889[_0x48fd('0x3b')]=_[_0x48fd('0x3c')](_0x22c90d[_0x48fd('0x35')],qs[_0x48fd('0x3d')](_0xf1c2f7[_0x48fd('0x38')][_0x48fd('0x3d')]));_0x14d889[_0x48fd('0x3b')]=_0x14d889[_0x48fd('0x3b')][_0x48fd('0x3e')]?_0x14d889[_0x48fd('0x3b')]:_0x22c90d[_0x48fd('0x35')];if(!_0xf1c2f7[_0x48fd('0x38')][_0x48fd('0x3f')](_0x48fd('0x40'))){_0x14d889['limit']=qs['limit'](_0xf1c2f7[_0x48fd('0x38')][_0x48fd('0x20')]);_0x14d889[_0x48fd('0x23')]=qs[_0x48fd('0x23')](_0xf1c2f7[_0x48fd('0x38')][_0x48fd('0x23')]);}_0x14d889['order']=qs['sort'](_0xf1c2f7[_0x48fd('0x38')][_0x48fd('0x41')]);_0x14d889[_0x48fd('0x42')]=qs[_0x48fd('0x3a')](_[_0x48fd('0x43')](_0xf1c2f7['query'],_0x22c90d[_0x48fd('0x3a')]),_0x54b147);if(_0xf1c2f7[_0x48fd('0x38')][_0x48fd('0x44')]){_0x14d889[_0x48fd('0x42')]=_[_0x48fd('0x45')](_0x14d889[_0x48fd('0x42')],{'$or':_[_0x48fd('0x36')](_0x54b147,function(_0x2d0d76){if(_0x2d0d76[_0x48fd('0x33')]!=='VIRTUAL'){var _0x1b6555={};_0x1b6555[_0x2d0d76['name']]={'$like':'%'+_0xf1c2f7['query'][_0x48fd('0x44')]+'%'};return _0x1b6555;}})});}_0x14d889=_[_0x48fd('0x45')]({},_0x14d889,_0xf1c2f7[_0x48fd('0x46')]);var _0x3730ca={'where':_0x14d889[_0x48fd('0x42')]};return db[_0x48fd('0x31')][_0x48fd('0x22')](_0x3730ca)['then'](function(_0x1e9c59){_0x2cffa1[_0x48fd('0x22')]=_0x1e9c59;if(_0xf1c2f7[_0x48fd('0x38')][_0x48fd('0x47')]){_0x14d889[_0x48fd('0x48')]=[{'all':!![]}];}return db[_0x48fd('0x31')][_0x48fd('0x49')](_0x14d889);})[_0x48fd('0x28')](function(_0x1dc0fc){_0x2cffa1[_0x48fd('0x4a')]=_0x1dc0fc;return _0x2cffa1;})['then'](respondWithFilteredResult(_0x13be37,_0x14d889))['catch'](handleError(_0x13be37,null));};exports['show']=function(_0xd325c8,_0x1e00c4){var _0x4b6774={'raw':!![],'where':{'id':_0xd325c8['params']['id']}},_0x481c11={};_0x481c11[_0x48fd('0x35')]=_[_0x48fd('0x39')](db['Pause'][_0x48fd('0x4b')]);_0x481c11[_0x48fd('0x38')]=_[_0x48fd('0x39')](_0xd325c8[_0x48fd('0x38')]);_0x481c11[_0x48fd('0x3a')]=_[_0x48fd('0x3c')](_0x481c11[_0x48fd('0x35')],_0x481c11[_0x48fd('0x38')]);_0x4b6774[_0x48fd('0x3b')]=_[_0x48fd('0x3c')](_0x481c11[_0x48fd('0x35')],qs[_0x48fd('0x3d')](_0xd325c8[_0x48fd('0x38')][_0x48fd('0x3d')]));_0x4b6774[_0x48fd('0x3b')]=_0x4b6774[_0x48fd('0x3b')][_0x48fd('0x3e')]?_0x4b6774[_0x48fd('0x3b')]:_0x481c11[_0x48fd('0x35')];if(_0xd325c8[_0x48fd('0x38')][_0x48fd('0x47')]){_0x4b6774[_0x48fd('0x48')]=[{'all':!![]}];}_0x4b6774=_['merge']({},_0x4b6774,_0xd325c8[_0x48fd('0x46')]);return db[_0x48fd('0x31')][_0x48fd('0x4c')](_0x4b6774)[_0x48fd('0x28')](handleEntityNotFound(_0x1e00c4,null))[_0x48fd('0x28')](respondWithResult(_0x1e00c4,null))[_0x48fd('0x4d')](handleError(_0x1e00c4,null));};exports['create']=function(_0x2eac84,_0x58146d){return db[_0x48fd('0x31')][_0x48fd('0x4e')](_0x2eac84[_0x48fd('0x4f')],{})[_0x48fd('0x28')](function(_0x1bdc4b){var _0x26768b=_0x2eac84[_0x48fd('0x50')][_0x48fd('0x2a')]({'plain':!![]});if(!_0x26768b)throw new Error(_0x48fd('0x51'));if(_0x26768b[_0x48fd('0x52')]===_0x48fd('0x50')){var _0x1fdc49=_0x1bdc4b[_0x48fd('0x2a')]({'plain':!![]});var _0x288b8c=_0x48fd('0x2b');return db['UserProfileSection'][_0x48fd('0x4c')]({'where':{'name':_0x288b8c,'userProfileId':_0x26768b[_0x48fd('0x53')]},'raw':!![]})[_0x48fd('0x28')](function(_0x11b1e2){if(_0x11b1e2&&_0x11b1e2[_0x48fd('0x54')]===0x0){return db['UserProfileResource'][_0x48fd('0x4e')]({'name':_0x1fdc49['name'],'resourceId':_0x1fdc49['id'],'type':_0x11b1e2[_0x48fd('0x37')],'sectionId':_0x11b1e2['id']},{})[_0x48fd('0x28')](function(){return _0x1bdc4b;});}else{return _0x1bdc4b;}})[_0x48fd('0x4d')](function(_0x586ed3){logger['error'](_0x48fd('0x55'),_0x586ed3);throw _0x586ed3;});}return _0x1bdc4b;})[_0x48fd('0x28')](respondWithResult(_0x58146d,0xc9))[_0x48fd('0x4d')](handleError(_0x58146d,null));};exports[_0x48fd('0x27')]=function(_0x2aedee,_0x490240){if(_0x2aedee[_0x48fd('0x4f')]['id']){delete _0x2aedee['body']['id'];}return db['Pause'][_0x48fd('0x4c')]({'where':{'id':_0x2aedee['params']['id']}})['then'](handleEntityNotFound(_0x490240,null))['then'](saveUpdates(_0x2aedee[_0x48fd('0x4f')],null))[_0x48fd('0x28')](respondWithResult(_0x490240,null))[_0x48fd('0x4d')](handleError(_0x490240,null));};exports[_0x48fd('0x29')]=function(_0x11c316,_0x543502){return db[_0x48fd('0x31')]['find']({'where':{'id':_0x11c316[_0x48fd('0x56')]['id']}})[_0x48fd('0x28')](handleEntityNotFound(_0x543502,null))[_0x48fd('0x28')](removeEntity(_0x543502,null))[_0x48fd('0x4d')](handleError(_0x543502,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 3b272e7..68669bd 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 _0x8ef6=['exports','define','Pause','tools_pauses','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./pause.attributes'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x8ef6,0xf2));var _0x68ef=function(_0x40fd75,_0xbdabe8){_0x40fd75=_0x40fd75-0x0;var _0xbcb3c=_0x8ef6[_0x40fd75];return _0xbcb3c;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var logger=require(_0x68ef('0x2'))(_0x68ef('0x3'));var moment=require(_0x68ef('0x4'));var BPromise=require(_0x68ef('0x5'));var rp=require(_0x68ef('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x68ef('0x7'));var config=require(_0x68ef('0x8'));var attributes=require(_0x68ef('0x9'));module[_0x68ef('0xa')]=function(_0x4d26e3,_0x4f77f3){return _0x4d26e3[_0x68ef('0xb')](_0x68ef('0xc'),attributes,{'tableName':_0x68ef('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./pause.attributes','exports','define','Pause'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x2f6e47,_0x40ba6b){_0x2f6e47=_0x2f6e47-0x0;var _0x29c331=_0x7fbe[_0x2f6e47];return _0x29c331;};'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':'tools_pauses','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 fd2ff0a..17942ca 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(_0x54d726,_0x4b21ca){var _0x2e6619=function(_0x32e27a){while(--_0x32e27a){_0x54d726['push'](_0x54d726['shift']());}};_0x2e6619(++_0x4b21ca);}(_0xb10b,0x12a));var _0xbb10=function(_0x3c6310,_0x13601d){_0x3c6310=_0x3c6310-0x0;var _0x320122=_0xb10b[_0x3c6310];return _0x320122;};'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(_0x5ed40b,_0x2b743d){var _0x505c2e=function(_0x4dfa89){while(--_0x4dfa89){_0x5ed40b['push'](_0x5ed40b['shift']());}};_0x505c2e(++_0x2b743d);}(_0xb10b,0x12a));var _0xbb10=function(_0x488616,_0x516a25){_0x488616=_0x488616-0x0;var _0x217fb3=_0xb10b[_0x488616];return _0x217fb3;};'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 1284562..8fd0d60 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 _0x2123=['join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','single','file','upload','post','webhookPost','put','update','/:id','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','isAuthenticated','show','/:id/download','diskStorage'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2123,0x190));var _0x3212=function(_0x1fc7f5,_0x545b65){_0x1fc7f5=_0x1fc7f5-0x0;var _0x5ad8a9=_0x2123[_0x1fc7f5];return _0x5ad8a9;};'use strict';var multer=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var path=require(_0x3212('0x2'));var timeout=require(_0x3212('0x3'));var express=require(_0x3212('0x4'));var router=express[_0x3212('0x5')]();var fs_extra=require(_0x3212('0x6'));var auth=require(_0x3212('0x7'));var interaction=require(_0x3212('0x8'));var config=require(_0x3212('0x9'));var controller=require(_0x3212('0xa'));router[_0x3212('0xb')]('/',auth['isAuthenticated'](),controller[_0x3212('0xc')]);router[_0x3212('0xb')](_0x3212('0xd'),controller['webhookGet']);router[_0x3212('0xb')]('/:id',auth[_0x3212('0xe')](),controller[_0x3212('0xf')]);router[_0x3212('0xb')](_0x3212('0x10'),auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x3212('0x11')]({'destination':function(_0xf166c2,_0x1a3b2f,_0x23f7e3){_0x23f7e3(null,path[_0x3212('0x12')](config[_0x3212('0x13')],_0x3212('0x14')));},'filename':function(_0x359cef,_0x26c1c8,_0x2d5fce){_0x26c1c8[_0x3212('0x15')]=_0x26c1c8[_0x3212('0x15')][_0x3212('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2d5fce(null,util[_0x3212('0x17')](_0x3212('0x18'),path[_0x3212('0x19')](_0x26c1c8[_0x3212('0x15')],path[_0x3212('0x1a')](_0x26c1c8[_0x3212('0x15')])),Date[_0x3212('0x1b')](),path[_0x3212('0x1a')](_0x26c1c8[_0x3212('0x15')])));}})});router['post']('/',upload[_0x3212('0x1c')](_0x3212('0x1d')),controller[_0x3212('0x1e')]);router[_0x3212('0x1f')](_0x3212('0xd'),controller[_0x3212('0x20')]);router[_0x3212('0x21')]('/:id',auth['isAuthenticated'](),controller[_0x3212('0x22')]);router['delete'](_0x3212('0x23'),auth[_0x3212('0xe')](),controller[_0x3212('0x24')]);module[_0x3212('0x25')]=router; \ No newline at end of file +var _0x3667=['download','diskStorage','join','root','server/files/plugins','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','upload','webhookPost','put','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','/:id','show','/:id/download'];(function(_0x5ec548,_0xf21387){var _0x4093fb=function(_0xa22522){while(--_0xa22522){_0x5ec548['push'](_0x5ec548['shift']());}};_0x4093fb(++_0xf21387);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var path=require(_0x7366('0x2'));var timeout=require(_0x7366('0x3'));var express=require(_0x7366('0x4'));var router=express['Router']();var fs_extra=require(_0x7366('0x5'));var auth=require(_0x7366('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7366('0x7'));var controller=require(_0x7366('0x8'));router[_0x7366('0x9')]('/',auth[_0x7366('0xa')](),controller[_0x7366('0xb')]);router['get'](_0x7366('0xc'),controller[_0x7366('0xd')]);router[_0x7366('0x9')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller[_0x7366('0xf')]);router[_0x7366('0x9')](_0x7366('0x10'),auth[_0x7366('0xa')](),controller[_0x7366('0x11')]);var upload=multer({'storage':multer[_0x7366('0x12')]({'destination':function(_0x2d7e38,_0x57ea7f,_0x425ee4){_0x425ee4(null,path[_0x7366('0x13')](config[_0x7366('0x14')],_0x7366('0x15')));},'filename':function(_0x25a565,_0xd5bac8,_0x3e3a73){_0xd5bac8[_0x7366('0x16')]=_0xd5bac8[_0x7366('0x16')][_0x7366('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3e3a73(null,util[_0x7366('0x18')](_0x7366('0x19'),path[_0x7366('0x1a')](_0xd5bac8[_0x7366('0x16')],path[_0x7366('0x1b')](_0xd5bac8['originalname'])),Date[_0x7366('0x1c')](),path[_0x7366('0x1b')](_0xd5bac8[_0x7366('0x16')])));}})});router[_0x7366('0x1d')]('/',upload[_0x7366('0x1e')](_0x7366('0x1f')),controller[_0x7366('0x20')]);router[_0x7366('0x1d')](_0x7366('0xc'),controller[_0x7366('0x21')]);router[_0x7366('0x22')]('/:id',auth[_0x7366('0xa')](),controller['update']);router[_0x7366('0x23')](_0x7366('0xe'),auth[_0x7366('0xa')](),controller['delete']);module[_0x7366('0x24')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index a7d468d..fbd5f9d 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 _0x6aa4=['STRING','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','ENUM','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6aa4,0x8e));var _0x46aa=function(_0x3746ed,_0x584fd7){_0x3746ed=_0x3746ed-0x0;var _0x2eddbd=_0x6aa4[_0x3746ed];return _0x2eddbd;};'use strict';var Sequelize=require(_0x46aa('0x0'));module[_0x46aa('0x1')]={'name':{'type':Sequelize[_0x46aa('0x2')]},'type':{'type':Sequelize['ENUM'](_0x46aa('0x3'),'script')},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x46aa('0x4')]},'path':{'type':Sequelize[_0x46aa('0x2')],'comment':_0x46aa('0x5')},'active':{'type':Sequelize[_0x46aa('0x6')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x46aa('0x7')](_0x46aa('0x8'),_0x46aa('0x9'),'always','never'),'defaultValue':_0x46aa('0xa'),'comment':_0x46aa('0xb')},'icon':{'type':Sequelize[_0x46aa('0x2')]},'adminUrl':{'type':Sequelize[_0x46aa('0x2')]},'agentUrl':{'type':Sequelize[_0x46aa('0x2')]},'scriptName':{'type':Sequelize[_0x46aa('0x2')]},'scriptPath':{'type':Sequelize[_0x46aa('0x2')]}}; \ No newline at end of file +var _0x6a33=['Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN'];(function(_0x4eb18d,_0x2288b7){var _0x5277cb=function(_0x154ee6){while(--_0x154ee6){_0x4eb18d['push'](_0x4eb18d['shift']());}};_0x5277cb(++_0x2288b7);}(_0x6a33,0x171));var _0x36a3=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x6a33[_0xaa0309];return _0x5de7ce;};'use strict';var Sequelize=require(_0x36a3('0x0'));module[_0x36a3('0x1')]={'name':{'type':Sequelize[_0x36a3('0x2')]},'type':{'type':Sequelize[_0x36a3('0x3')](_0x36a3('0x4'),'script')},'description':{'type':Sequelize[_0x36a3('0x5')]},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x36a3('0x2')],'comment':_0x36a3('0x6')},'active':{'type':Sequelize[_0x36a3('0x7')],'defaultValue':0x0,'comment':_0x36a3('0x8')},'sidebar':{'type':Sequelize[_0x36a3('0x3')](_0x36a3('0x9'),_0x36a3('0xa'),'always','never'),'defaultValue':_0x36a3('0xb'),'comment':_0x36a3('0xc')},'icon':{'type':Sequelize[_0x36a3('0x2')]},'adminUrl':{'type':Sequelize[_0x36a3('0x2')]},'agentUrl':{'type':Sequelize[_0x36a3('0x2')]},'scriptName':{'type':Sequelize[_0x36a3('0x2')]},'scriptPath':{'type':Sequelize[_0x36a3('0x2')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index a275da7..45ecf20 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 _0x934c=['lstatSync','isDirectory','readdirSync','Plugin\x20manifest\x20missing','readFileSync','manifest.json','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon-apps','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','Plugins','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','update','delete','dirname','\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','resolve','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','extract-zip','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','socket.io-emitter','redis','./plugin.socket','register','status','json','limit','undefined','offset','count','set','Content-Range','save','then','get','sendStatus','error','stack','name','send','index','Plugin','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','fields','find','download','params','join','root','server/files/plugins','format','%s.zip','basename','createWriteStream','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','attachments/**/*','finalize','close','existsSync','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','file','extname','filename','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure'];(function(_0x214bd7,_0x9d5a1a){var _0x1f3be5=function(_0xf53540){while(--_0xf53540){_0x214bd7['push'](_0x214bd7['shift']());}};_0x1f3be5(++_0x9d5a1a);}(_0x934c,0xd3));var _0xc934=function(_0x385b4e,_0x206ce9){_0x385b4e=_0x385b4e-0x0;var _0x593af1=_0x934c[_0x385b4e];return _0x593af1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc934('0x0'));var zipdir=require(_0xc934('0x1'));var jsonpatch=require(_0xc934('0x2'));var rp=require('request-promise');var moment=require(_0xc934('0x3'));var BPromise=require(_0xc934('0x4'));var Mustache=require(_0xc934('0x5'));var util=require('util');var path=require(_0xc934('0x6'));var sox=require(_0xc934('0x7'));var csv=require(_0xc934('0x8'));var ejs=require(_0xc934('0x9'));var fs=require('fs');var fs_extra=require(_0xc934('0xa'));var _=require(_0xc934('0xb'));var squel=require('squel');var crypto=require(_0xc934('0xc'));var jsforce=require(_0xc934('0xd'));var deskjs=require(_0xc934('0xe'));var toCsv=require(_0xc934('0x8'));var querystring=require('querystring');var Papa=require(_0xc934('0xf'));var extract=require(_0xc934('0x10'));var rimraf=require(_0xc934('0x0'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require(_0xc934('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc934('0x12'));var hardwareService=require(_0xc934('0x13'));var logger=require(_0xc934('0x14'))('api');var utils=require(_0xc934('0x15'));var config=require(_0xc934('0x16'));var licenseUtil=require(_0xc934('0x17'));var db=require(_0xc934('0x18'))['db'];config['redis']=_[_0xc934('0x19')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc934('0x1a'))(new Redis(config[_0xc934('0x1b')]));require(_0xc934('0x1c'))[_0xc934('0x1d')](socket);function respondWithStatusCode(_0x241d66,_0x4aadec){_0x4aadec=_0x4aadec||0xcc;return function(_0xab32ce){if(_0xab32ce){return _0x241d66['sendStatus'](_0x4aadec);}return _0x241d66[_0xc934('0x1e')](_0x4aadec)['end']();};}function respondWithResult(_0x4549a3,_0x3194e6){_0x3194e6=_0x3194e6||0xc8;return function(_0x184123){if(_0x184123){return _0x4549a3[_0xc934('0x1e')](_0x3194e6)[_0xc934('0x1f')](_0x184123);}};}function respondWithFilteredResult(_0x3cfaf2,_0x3a3ce8){return function(_0xbe012a){if(_0xbe012a){var _0x3c6442=typeof _0x3a3ce8['offset']==='undefined'&&typeof _0x3a3ce8[_0xc934('0x20')]===_0xc934('0x21');var _0x4c5f35=_0xbe012a['count'];var _0x18d4a9=_0x3c6442?0x0:_0x3a3ce8[_0xc934('0x22')];var _0x206790=_0x3c6442?_0xbe012a[_0xc934('0x23')]:_0x3a3ce8[_0xc934('0x22')]+_0x3a3ce8[_0xc934('0x20')];var _0x434226;if(_0x206790>=_0x4c5f35){_0x206790=_0x4c5f35;_0x434226=0xc8;}else{_0x434226=0xce;}_0x3cfaf2[_0xc934('0x1e')](_0x434226);return _0x3cfaf2[_0xc934('0x24')](_0xc934('0x25'),_0x18d4a9+'-'+_0x206790+'/'+_0x4c5f35)['json'](_0xbe012a);}return null;};}function patchUpdates(_0x34dd90){return function(_0x4d210b){try{jsonpatch['apply'](_0x4d210b,_0x34dd90,!![]);}catch(_0x7ce53f){return BPromise['reject'](_0x7ce53f);}return _0x4d210b[_0xc934('0x26')]();};}function saveUpdates(_0x77b675,_0x11f081){return function(_0x92904a){if(_0x92904a){return _0x92904a['update'](_0x77b675)[_0xc934('0x27')](function(_0x53a72c){return _0x53a72c;});}return null;};}function removeEntity(_0x35fffe,_0x2525cf){return function(_0x51858f){if(_0x51858f){return _0x51858f['destroy']()[_0xc934('0x27')](function(){var _0x553025=_0x51858f[_0xc934('0x28')]({'plain':!![]});var _0x3fb339='Plugins';return db['UserProfileResource']['destroy']({'where':{'type':_0x3fb339,'resourceId':_0x553025['id']}})[_0xc934('0x27')](function(){return _0x51858f;});})[_0xc934('0x27')](function(){_0x35fffe['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a8d51,_0x553de8){return function(_0x5057cd){if(!_0x5057cd){_0x5a8d51[_0xc934('0x29')](0x194);}return _0x5057cd;};}function handleError(_0x341692,_0x443947){_0x443947=_0x443947||0x1f4;return function(_0x578a03){logger[_0xc934('0x2a')](_0x578a03[_0xc934('0x2b')]);if(_0x578a03['name']){delete _0x578a03[_0xc934('0x2c')];}_0x341692['status'](_0x443947)[_0xc934('0x2d')](_0x578a03);};}exports[_0xc934('0x2e')]=function(_0x3876ff,_0x51a41f){var _0x12ad58={},_0x3fbe1b={},_0x264970={'count':0x0,'rows':[]};var _0x2a05a5=_['map'](db[_0xc934('0x2f')][_0xc934('0x30')],function(_0x5d7669){return{'name':_0x5d7669[_0xc934('0x31')],'type':_0x5d7669[_0xc934('0x32')][_0xc934('0x33')]};});_0x3fbe1b[_0xc934('0x34')]=_[_0xc934('0x35')](_0x2a05a5,_0xc934('0x2c'));_0x3fbe1b[_0xc934('0x36')]=_[_0xc934('0x37')](_0x3876ff[_0xc934('0x36')]);_0x3fbe1b[_0xc934('0x38')]=_[_0xc934('0x39')](_0x3fbe1b[_0xc934('0x34')],_0x3fbe1b[_0xc934('0x36')]);_0x12ad58[_0xc934('0x3a')]=_['intersection'](_0x3fbe1b[_0xc934('0x34')],qs['fields'](_0x3876ff[_0xc934('0x36')]['fields']));_0x12ad58[_0xc934('0x3a')]=_0x12ad58['attributes'][_0xc934('0x3b')]?_0x12ad58[_0xc934('0x3a')]:_0x3fbe1b[_0xc934('0x34')];if(!_0x3876ff[_0xc934('0x36')]['hasOwnProperty'](_0xc934('0x3c'))){_0x12ad58['limit']=qs[_0xc934('0x20')](_0x3876ff['query'][_0xc934('0x20')]);_0x12ad58[_0xc934('0x22')]=qs[_0xc934('0x22')](_0x3876ff[_0xc934('0x36')][_0xc934('0x22')]);}_0x12ad58['order']=qs[_0xc934('0x3d')](_0x3876ff[_0xc934('0x36')][_0xc934('0x3d')]);_0x12ad58[_0xc934('0x3e')]=qs[_0xc934('0x38')](_[_0xc934('0x3f')](_0x3876ff['query'],_0x3fbe1b[_0xc934('0x38')]),_0x2a05a5);if(_0x3876ff['query'][_0xc934('0x40')]){_0x12ad58[_0xc934('0x3e')]=_[_0xc934('0x41')](_0x12ad58[_0xc934('0x3e')],{'$or':_['map'](_0x2a05a5,function(_0x5c07c5){if(_0x5c07c5['type']!==_0xc934('0x42')){var _0x26727e={};_0x26727e[_0x5c07c5['name']]={'$like':'%'+_0x3876ff['query'][_0xc934('0x40')]+'%'};return _0x26727e;}})});}_0x12ad58=_['merge']({},_0x12ad58,_0x3876ff[_0xc934('0x43')]);var _0x241d1c={'where':_0x12ad58[_0xc934('0x3e')]};return db['Plugin'][_0xc934('0x23')](_0x241d1c)['then'](function(_0x133589){_0x264970[_0xc934('0x23')]=_0x133589;if(_0x3876ff[_0xc934('0x36')][_0xc934('0x44')]){_0x12ad58[_0xc934('0x45')]=[{'all':!![]}];}return db[_0xc934('0x2f')][_0xc934('0x46')](_0x12ad58);})[_0xc934('0x27')](function(_0x30e383){_0x264970[_0xc934('0x47')]=_0x30e383;return _0x264970;})[_0xc934('0x27')](respondWithFilteredResult(_0x51a41f,_0x12ad58))[_0xc934('0x48')](handleError(_0x51a41f,null));};exports['show']=function(_0x2bf832,_0x2c89ff){var _0x30491a={'raw':!![],'where':{'id':_0x2bf832['params']['id']}},_0x2634f8={};_0x2634f8['model']=_['keys'](db[_0xc934('0x2f')]['rawAttributes']);_0x2634f8[_0xc934('0x36')]=_[_0xc934('0x37')](_0x2bf832[_0xc934('0x36')]);_0x2634f8[_0xc934('0x38')]=_['intersection'](_0x2634f8[_0xc934('0x34')],_0x2634f8[_0xc934('0x36')]);_0x30491a[_0xc934('0x3a')]=_[_0xc934('0x39')](_0x2634f8[_0xc934('0x34')],qs[_0xc934('0x49')](_0x2bf832[_0xc934('0x36')][_0xc934('0x49')]));_0x30491a[_0xc934('0x3a')]=_0x30491a['attributes'][_0xc934('0x3b')]?_0x30491a[_0xc934('0x3a')]:_0x2634f8['model'];if(_0x2bf832[_0xc934('0x36')][_0xc934('0x44')]){_0x30491a['include']=[{'all':!![]}];}_0x30491a=_[_0xc934('0x41')]({},_0x30491a,_0x2bf832[_0xc934('0x43')]);return db['Plugin'][_0xc934('0x4a')](_0x30491a)['then'](handleEntityNotFound(_0x2c89ff,null))[_0xc934('0x27')](respondWithResult(_0x2c89ff,null))[_0xc934('0x48')](handleError(_0x2c89ff,null));};exports[_0xc934('0x4b')]=function(_0x3fcc1f,_0x5397c8,_0x4ad659){return db[_0xc934('0x2f')]['find']({'where':{'id':_0x3fcc1f[_0xc934('0x4c')]['id']},'attributes':[_0xc934('0x2c'),_0xc934('0x6')],'raw':!![]})[_0xc934('0x27')](handleEntityNotFound(_0x5397c8,null))[_0xc934('0x27')](function(_0xd31cae){if(_0xd31cae){var _0x17e324=path[_0xc934('0x4d')](config[_0xc934('0x4e')],_0xc934('0x4f'),util[_0xc934('0x50')](_0xc934('0x51'),path[_0xc934('0x52')](_0xd31cae['path'])));var _0x56b115=fs[_0xc934('0x53')](_0x17e324);var _0x180c81=archiver('zip',{'zlib':{'level':0x9}});_0x180c81['on']('warning',function(_0x358752){if(_0x358752[_0xc934('0x54')]===_0xc934('0x55')){logger[_0xc934('0x2a')](_0x358752);}else{throw new db[(_0xc934('0x56'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x180c81['on'](_0xc934('0x2a'),function(_0x438dc8){throw new db[(_0xc934('0x56'))][(_0xc934('0x57'))](_0xc934('0x58'));});_0x180c81[_0xc934('0x59')](_0x56b115);_0x180c81['glob'](_0xc934('0x5a'),{'cwd':path[_0xc934('0x4d')](config[_0xc934('0x4e')],_0xc934('0x4f'),path['dirname'](_0xd31cae[_0xc934('0x6')])),'ignore':[path['join'](path[_0xc934('0x52')](_0xd31cae[_0xc934('0x6')]),'node_modules/**/*'),path[_0xc934('0x4d')](path['basename'](_0xd31cae['path']),_0xc934('0x5b'))],'nodir':!![]})[_0xc934('0x5c')]();_0x56b115['on'](_0xc934('0x5d'),function(){if(!fs[_0xc934('0x5e')](_0x17e324)){throw new db[(_0xc934('0x56'))][(_0xc934('0x57'))]('Plugin\x20not\x20found');}return _0x5397c8[_0xc934('0x4b')](_0x17e324,util['format']('%s.zip',path[_0xc934('0x52')](_0xd31cae[_0xc934('0x6')])),function(_0x5b023f){if(_0x5b023f){throw new db[(_0xc934('0x56'))][(_0xc934('0x57'))](_0xc934('0x5f'));}fs[_0xc934('0x60')](_0x17e324);logger[_0xc934('0x61')](_0xc934('0x62'));logger[_0xc934('0x61')]('Temporary\x20file\x20removed');});});}return null;})[_0xc934('0x48')](handleError(_0x5397c8,null));};exports['upload']=function(_0x4f62fd,_0x2f774e,_0x61c282){var _0x3fd31e=path[_0xc934('0x52')](_0x4f62fd[_0xc934('0x63')]['filename'],path[_0xc934('0x64')](_0x4f62fd['file'][_0xc934('0x65')]));var _0x1b4547=path[_0xc934('0x4d')](config[_0xc934('0x4e')],'server/files/plugins',_0x4f62fd[_0xc934('0x63')][_0xc934('0x65')]);var _0x465bf9=path['join'](config['root'],_0xc934('0x4f'),_0x3fd31e);logger[_0xc934('0x61')]('Plugin\x20upload\x20filepath:\x20%s',_0x1b4547);logger['info'](_0xc934('0x66'),_0x465bf9);try{fs[_0xc934('0x67')](_0x1b4547,parseInt('0777',0x8));extract(_0x1b4547,{'dir':_0x465bf9},function(_0x1a2f6c){if(_0x1a2f6c){logger[_0xc934('0x2a')](_0x1a2f6c);handleError(_0x1a2f6c,!![]);};var _0x558b4f=fs['readdirSync'](_0x465bf9);if(_0x558b4f[_0xc934('0x3b')]>0x1){removeReferences(_0x1b4547,_0x465bf9);logger[_0xc934('0x2a')]('Invalid\x20plugin\x20structure');return _0x61c282(new Error(_0xc934('0x68')));}var _0x14a222=fs[_0xc934('0x69')](path[_0xc934('0x4d')](_0x465bf9,_0x558b4f[0x0]));if(_0x14a222['isFile']()){removeReferences(_0x1b4547,_0x465bf9);logger[_0xc934('0x2a')](_0xc934('0x68'));return _0x61c282(new Error('Invalid\x20plugin\x20structure'));}if(_0x14a222[_0xc934('0x6a')]()){var _0x2b72ab=fs[_0xc934('0x6b')](path['join'](_0x465bf9,_0x558b4f[0x0]));if(_0x2b72ab[_0xc934('0x3b')]===0x0){removeReferences(_0x1b4547,_0x465bf9);logger[_0xc934('0x2a')]('Invalid\x20plugin\x20structure');return _0x61c282(new Error('Invalid\x20plugin\x20structure'));}var _0x2fe2f2=_0x2b72ab['some'](function(_0x4c6b4a){return _0x4c6b4a==='manifest.json';});if(!_0x2fe2f2){return _0x61c282(new Error(_0xc934('0x6c')));}var _0xe03750=fs[_0xc934('0x6d')](path[_0xc934('0x4d')](_0x465bf9,_0x558b4f[0x0],_0xc934('0x6e')));var _0x318981=JSON['parse'](_0xe03750);if(_0xc934('0x21')==typeof _0x318981[_0xc934('0x2c')]){return _0x61c282(new Error(_0xc934('0x6f')));}if('undefined'==typeof _0x318981[_0xc934('0x32')]){return _0x61c282(new Error(_0xc934('0x70')));}if(_0xc934('0x21')==typeof _0x318981[_0xc934('0x71')]){return _0x61c282(new Error(_0xc934('0x72')));}if(_0xc934('0x21')==typeof _0x318981[_0xc934('0x73')]){return _0x61c282(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x318981['type']===_0xc934('0x74')){if(_0xc934('0x21')==typeof _0x318981[_0xc934('0x73')][_0xc934('0x75')]){return _0x61c282(new Error(_0xc934('0x76')));}if(_0xc934('0x21')==typeof _0x318981[_0xc934('0x73')][_0xc934('0x75')][_0xc934('0x77')]&&'undefined'==typeof _0x318981[_0xc934('0x73')][_0xc934('0x75')]['agent']){return _0x61c282(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x318981[_0xc934('0x32')]===_0xc934('0x78')){if(_0xc934('0x21')==typeof _0x318981[_0xc934('0x73')][_0xc934('0x79')]){return _0x61c282(new Error(_0xc934('0x7a')));}if(_0xc934('0x21')==typeof _0x318981[_0xc934('0x73')][_0xc934('0x7b')]){return _0x61c282(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x61c282(new Error(_0xc934('0x7c')));}var _0x153b57=_0x318981['name'];var _0x10e5ad=_0x318981['description'];var _0x4fa1d5=_0x318981[_0xc934('0x32')];var _0x4f140d=_0x318981[_0xc934('0x7d')]?_0x318981[_0xc934('0x7d')]:_0xc934('0x7e');var _0x3806f2=_0x318981['icon']?_0x318981['icon']:_0xc934('0x7f');var _0x18277e='';var _0x52a7ac='';var _0x365041='';var _0x14b707='';var _0xf135c5=_0x318981['version'];if(_0x4fa1d5===_0xc934('0x74')){if(_0xc934('0x21')!=typeof _0x318981[_0xc934('0x73')][_0xc934('0x75')][_0xc934('0x77')]){var _0x4649dc=_0x318981[_0xc934('0x73')][_0xc934('0x75')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4649dc)){_0x18277e=path[_0xc934('0x4d')](_0xc934('0x80'),_0x3fd31e,_0x558b4f[0x0],_0x4649dc);}else{_0x18277e=_0x4649dc;}}else{logger[_0xc934('0x61')](_0xc934('0x81'));}if(_0xc934('0x21')!=typeof _0x318981['parameters']['views'][_0xc934('0x82')]){var _0x181661=_0x318981[_0xc934('0x73')][_0xc934('0x75')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x181661)){_0x52a7ac=path[_0xc934('0x4d')](_0xc934('0x80'),_0x3fd31e,_0x558b4f[0x0],_0x181661);}else{_0x52a7ac=_0x181661;}}else{logger[_0xc934('0x61')](_0xc934('0x83'));}}else if(_0x4fa1d5===_0xc934('0x78')){_0x365041=_0x318981[_0xc934('0x73')][_0xc934('0x79')];_0x14b707=_0x318981['parameters']['scriptPath'];if(_0xc934('0x21')!=typeof _0x318981['parameters'][_0xc934('0x75')]){if(_0xc934('0x21')!=typeof _0x318981[_0xc934('0x73')][_0xc934('0x75')][_0xc934('0x77')]){var _0x4649dc=_0x318981[_0xc934('0x73')][_0xc934('0x75')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x4649dc)){_0x18277e=path[_0xc934('0x4d')]('plugins',_0x3fd31e,_0x558b4f[0x0],_0x4649dc);}else{_0x18277e=_0x4649dc;}}if('undefined'!=typeof _0x318981[_0xc934('0x73')][_0xc934('0x75')][_0xc934('0x82')]){var _0x181661=_0x318981['parameters'][_0xc934('0x75')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x181661)){_0x52a7ac=path[_0xc934('0x4d')]('plugins',_0x3fd31e,_0x558b4f[0x0],_0x181661);}else{_0x52a7ac=_0x181661;}}}}var _0x31357f={'name':_0x153b57,'description':_0x10e5ad,'path':path[_0xc934('0x4d')](_0x3fd31e,_0x558b4f[0x0]),'type':_0x4fa1d5,'sidebar':_0x4f140d,'icon':_0x3806f2,'adminUrl':_0x18277e,'agentUrl':_0x52a7ac,'scriptName':_0x365041,'scriptPath':_0x14b707,'version':_0xf135c5};removeReferences(_0x1b4547,null);return db[_0xc934('0x2f')]['create'](_0x31357f)[_0xc934('0x27')](function(_0x20fd70){var _0x56f926={'role':_0x4f62fd[_0xc934('0x84')][_0xc934('0x85')],'userProfileId':_0x4f62fd['body']['userProfileId']};if(!_0x56f926)throw new Error(_0xc934('0x86'));if(_0x56f926[_0xc934('0x85')]===_0xc934('0x87')){var _0x496774=_0x20fd70['get']({'plain':!![]});return db['UserProfileSection'][_0xc934('0x4a')]({'where':{'name':_0xc934('0x88'),'userProfileId':_0x56f926['userProfileId']},'raw':!![]})[_0xc934('0x27')](function(_0x59f7f3){if(_0x59f7f3&&_0x59f7f3['autoAssociation']===0x0){return db[_0xc934('0x89')]['create']({'name':_0x496774[_0xc934('0x2c')],'resourceId':_0x496774['id'],'type':_0x59f7f3['name'],'sectionId':_0x59f7f3['id']},{})[_0xc934('0x27')](function(){return _0x20fd70;});}else{return _0x20fd70;}})[_0xc934('0x48')](function(_0x4e595c){logger[_0xc934('0x2a')](_0xc934('0x8a'),_0x4e595c);throw _0x4e595c;});}return _0x20fd70;})[_0xc934('0x27')](respondWithResult(_0x2f774e,null))[_0xc934('0x48')](handleError(_0x2f774e,null));}});}catch(_0x184043){_0x2f774e['status'](0x1f4)[_0xc934('0x2d')](_0x184043);}};function removeReferences(_0x40345a,_0xb33187){try{if(_0x40345a){fs[_0xc934('0x60')](_0x40345a);logger[_0xc934('0x61')](_0xc934('0x8b'));}if(_0xb33187){rimraf(_0xb33187,function(){});logger['info'](_0xc934('0x8c'));}}catch(_0x444596){logger[_0xc934('0x2a')](_0x444596);}}exports[_0xc934('0x8d')]=function(_0x242914,_0x361cfb,_0x3ea320){return db[_0xc934('0x2f')]['find']({'where':{'id':_0x242914[_0xc934('0x4c')]['id']}})['then'](handleEntityNotFound(_0x361cfb,null))[_0xc934('0x27')](saveUpdates(_0x242914[_0xc934('0x84')],null))['then'](respondWithResult(_0x361cfb,null))['catch'](handleError(_0x361cfb,null));};exports[_0xc934('0x8e')]=function(_0x356922,_0x340254,_0xceac4){return db[_0xc934('0x2f')][_0xc934('0x4a')]({'where':{'id':_0x356922['params']['id']}})[_0xc934('0x27')](function(_0x4159d1){if(_0x4159d1){return _0x4159d1['destroy']();}})[_0xc934('0x27')](function(_0x4fae62){rimraf(path[_0xc934('0x4d')](config[_0xc934('0x4e')],_0xc934('0x4f'),path[_0xc934('0x8f')](_0x4fae62[_0xc934('0x6')])),function(){});return _0x4fae62;})[_0xc934('0x27')](handleEntityNotFound(_0x340254,null))[_0xc934('0x27')](respondWithStatusCode(_0x340254,null))[_0xc934('0x48')](handleError(_0x340254,null));};exports['webhookGet']=function(_0x55acff,_0x1b0337,_0x8f40e9){return BPromise['resolve']()[_0xc934('0x27')](function(){if(!_0x55acff[_0xc934('0x36')][_0xc934('0x6')]){throw new Error(_0xc934('0x90'));}if(!_0x55acff[_0xc934('0x36')][_0xc934('0x91')]){throw new Error(_0xc934('0x92'));}var _0x4fd2e1=_0x55acff[_0xc934('0x36')][_0xc934('0x93')]?_0x55acff[_0xc934('0x36')]['hostname']+':'+_0x55acff[_0xc934('0x36')][_0xc934('0x91')]:_0xc934('0x94')+_0x55acff[_0xc934('0x36')][_0xc934('0x91')];var _0x5ef64d=_0x55acff[_0xc934('0x36')][_0xc934('0x1f')]?_0x55acff[_0xc934('0x36')][_0xc934('0x1f')]:!![];var _0x379205=_0x55acff[_0xc934('0x36')][_0xc934('0x95')]?_0x55acff[_0xc934('0x36')][_0xc934('0x95')]:null;var _0x3c3bfc={'method':_0x55acff[_0xc934('0x96')],'uri':util[_0xc934('0x50')](_0xc934('0x97'),_0x4fd2e1,_0x55acff['query'][_0xc934('0x6')]),'json':_0x5ef64d,'resolveWithFullResponse':!![],'encoding':_0x379205,'qs':_0x55acff['query']};if(_0x55acff[_0xc934('0x98')]){_0x3c3bfc[_0xc934('0x98')]=_0x55acff[_0xc934('0x98')];if(_0x3c3bfc[_0xc934('0x98')][_0xc934('0x99')]){delete _0x3c3bfc[_0xc934('0x98')][_0xc934('0x99')];}}if(_0x3c3bfc[_0xc934('0x98')][_0xc934('0x9a')]){delete _0x3c3bfc['headers'][_0xc934('0x9a')];}return rp(_0x3c3bfc);})[_0xc934('0x27')](function(_0x54d9bd){if(_0x54d9bd){_0x1b0337['set'](_0x54d9bd[_0xc934('0x98')]);logger[_0xc934('0x61')](_0x54d9bd[_0xc934('0x84')]);if(_[_0xc934('0x9b')](_0x55acff[_0xc934('0x36')][_0xc934('0x6')],_0xc934('0x4b'))&&_0x54d9bd[_0xc934('0x9c')]==0x1f4){return _0x1b0337[_0xc934('0x29')](_0x54d9bd[_0xc934('0x9c')]);}else{return _0x1b0337['status'](_0x54d9bd[_0xc934('0x9c')])[_0xc934('0x2d')](_0x54d9bd[_0xc934('0x84')]);}}else{return _0x1b0337[_0xc934('0x29')](0xc8);}})[_0xc934('0x48')](handleError(_0x1b0337,null));};exports['webhookPost']=function(_0x18471e,_0x29be35,_0x3aa57b){return BPromise[_0xc934('0x9d')]()['then'](function(){if(!_0x18471e['query']['path']){throw new Error(_0xc934('0x90'));}if(!_0x18471e[_0xc934('0x36')][_0xc934('0x91')]){throw new Error(_0xc934('0x92'));}var _0x18ef46=_0x18471e[_0xc934('0x36')]['hostname']?_0x18471e[_0xc934('0x36')][_0xc934('0x93')]+':'+_0x18471e['query'][_0xc934('0x91')]:'http://localhost:'+_0x18471e[_0xc934('0x36')][_0xc934('0x91')];var _0x351682=_0x18471e[_0xc934('0x36')]['json']?_0x18471e[_0xc934('0x36')][_0xc934('0x1f')]:!![];var _0x26c565=_0x18471e['query'][_0xc934('0x95')]?_0x18471e[_0xc934('0x36')][_0xc934('0x95')]:null;var _0xffa283={'method':_0x18471e['method'],'uri':util[_0xc934('0x50')](_0xc934('0x97'),_0x18ef46,_0x18471e[_0xc934('0x36')][_0xc934('0x6')]),'json':_0x351682,'resolveWithFullResponse':!![],'encoding':_0x26c565,'body':_0x18471e[_0xc934('0x84')]};if(_0x18471e[_0xc934('0x98')]){_0xffa283[_0xc934('0x98')]=_0x18471e['headers'];if(_0xffa283[_0xc934('0x98')]['content-length']){delete _0xffa283[_0xc934('0x98')][_0xc934('0x99')];}}if(_0xffa283['headers']['content-type']){delete _0xffa283[_0xc934('0x98')]['content-type'];}return rp(_0xffa283);})[_0xc934('0x27')](function(_0x202088){if(_0x202088){_0x29be35[_0xc934('0x24')](_0x202088[_0xc934('0x98')]);logger['info'](_0x202088[_0xc934('0x84')]);return _0x29be35[_0xc934('0x1e')](_0x202088[_0xc934('0x9c')])['send'](_0x202088[_0xc934('0x84')]);}else{return _0x29be35[_0xc934('0x29')](0xc8);}})['catch'](handleError(_0x29be35,null));}; \ No newline at end of file +var _0x2d42=['include','findAll','rows','show','params','keys','length','includeAll','options','find','catch','join','root','server/files/plugins','format','basename','createWriteStream','zip','warning','ENOENT','Sequelize','Error','error','pipe','**/*','dirname','node_modules/**/*','attachments/**/*','finalize','close','Error\x20while\x20downloading\x20the\x20plugin','Download\x20completed','info','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','parameters','views','agent','Invalid\x20manifest:\x20no\x20view\x20specified','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','icon','icon-apps','admin','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','encoding','method','%s%s','headers','content-length','content-type','endsWith','download','statusCode','webhookPost','http://localhost:','rimraf','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','extract-zip','archiver','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','UserProfileResource','stack','name','send','map','Plugin','rawAttributes','type','key','model','query','filters','attributes','intersection','fields','hasOwnProperty','filter','merge','where','VIRTUAL'];(function(_0x2d7747,_0x431871){var _0xe4f41a=function(_0x3cd214){while(--_0x3cd214){_0x2d7747['push'](_0x2d7747['shift']());}};_0xe4f41a(++_0x431871);}(_0x2d42,0xff));var _0x22d4=function(_0x2804f0,_0x38d0a9){_0x2804f0=_0x2804f0-0x0;var _0x4437d3=_0x2d42[_0x2804f0];return _0x4437d3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x22d4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x22d4('0x1'));var util=require(_0x22d4('0x2'));var path=require(_0x22d4('0x3'));var sox=require(_0x22d4('0x4'));var csv=require(_0x22d4('0x5'));var ejs=require(_0x22d4('0x6'));var fs=require('fs');var fs_extra=require(_0x22d4('0x7'));var _=require(_0x22d4('0x8'));var squel=require(_0x22d4('0x9'));var crypto=require(_0x22d4('0xa'));var jsforce=require(_0x22d4('0xb'));var deskjs=require(_0x22d4('0xc'));var toCsv=require(_0x22d4('0x5'));var querystring=require(_0x22d4('0xd'));var Papa=require('papaparse');var extract=require(_0x22d4('0xe'));var rimraf=require(_0x22d4('0x0'));var archiver=require(_0x22d4('0xf'));var Redis=require(_0x22d4('0x10'));var authService=require(_0x22d4('0x11'));var qs=require(_0x22d4('0x12'));var as=require(_0x22d4('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x22d4('0x14'));var config=require(_0x22d4('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x22d4('0x16'))['db'];config['redis']=_['defaults'](config[_0x22d4('0x17')],{'host':_0x22d4('0x18'),'port':0x18eb});var socket=require(_0x22d4('0x19'))(new Redis(config['redis']));require(_0x22d4('0x1a'))[_0x22d4('0x1b')](socket);function respondWithStatusCode(_0xc274c0,_0x5bc16d){_0x5bc16d=_0x5bc16d||0xcc;return function(_0xcb9f20){if(_0xcb9f20){return _0xc274c0[_0x22d4('0x1c')](_0x5bc16d);}return _0xc274c0[_0x22d4('0x1d')](_0x5bc16d)[_0x22d4('0x1e')]();};}function respondWithResult(_0x586a70,_0x76e3c7){_0x76e3c7=_0x76e3c7||0xc8;return function(_0x390c27){if(_0x390c27){return _0x586a70['status'](_0x76e3c7)[_0x22d4('0x1f')](_0x390c27);}};}function respondWithFilteredResult(_0x217c0e,_0x1a74d2){return function(_0x4f1e35){if(_0x4f1e35){var _0xaf13b6=typeof _0x1a74d2[_0x22d4('0x20')]===_0x22d4('0x21')&&typeof _0x1a74d2[_0x22d4('0x22')]===_0x22d4('0x21');var _0x4aabd5=_0x4f1e35[_0x22d4('0x23')];var _0x2db801=_0xaf13b6?0x0:_0x1a74d2['offset'];var _0x4cd64c=_0xaf13b6?_0x4f1e35[_0x22d4('0x23')]:_0x1a74d2[_0x22d4('0x20')]+_0x1a74d2[_0x22d4('0x22')];var _0x1d8e8e;if(_0x4cd64c>=_0x4aabd5){_0x4cd64c=_0x4aabd5;_0x1d8e8e=0xc8;}else{_0x1d8e8e=0xce;}_0x217c0e['status'](_0x1d8e8e);return _0x217c0e[_0x22d4('0x24')]('Content-Range',_0x2db801+'-'+_0x4cd64c+'/'+_0x4aabd5)[_0x22d4('0x1f')](_0x4f1e35);}return null;};}function patchUpdates(_0x4441cb){return function(_0x2f7381){try{jsonpatch[_0x22d4('0x25')](_0x2f7381,_0x4441cb,!![]);}catch(_0x431dfb){return BPromise[_0x22d4('0x26')](_0x431dfb);}return _0x2f7381[_0x22d4('0x27')]();};}function saveUpdates(_0x201bed,_0x3339ca){return function(_0x229db3){if(_0x229db3){return _0x229db3[_0x22d4('0x28')](_0x201bed)['then'](function(_0x5723c3){return _0x5723c3;});}return null;};}function removeEntity(_0x2f6869,_0x67f304){return function(_0xbc7b91){if(_0xbc7b91){return _0xbc7b91[_0x22d4('0x29')]()[_0x22d4('0x2a')](function(){var _0x4a07c8=_0xbc7b91['get']({'plain':!![]});var _0x42407c='Plugins';return db[_0x22d4('0x2b')]['destroy']({'where':{'type':_0x42407c,'resourceId':_0x4a07c8['id']}})[_0x22d4('0x2a')](function(){return _0xbc7b91;});})['then'](function(){_0x2f6869[_0x22d4('0x1d')](0xcc)[_0x22d4('0x1e')]();});}};}function handleEntityNotFound(_0x13e3d7,_0x616fed){return function(_0x3f2498){if(!_0x3f2498){_0x13e3d7[_0x22d4('0x1c')](0x194);}return _0x3f2498;};}function handleError(_0x5ab1bf,_0x2305b2){_0x2305b2=_0x2305b2||0x1f4;return function(_0x3e80d0){logger['error'](_0x3e80d0[_0x22d4('0x2c')]);if(_0x3e80d0[_0x22d4('0x2d')]){delete _0x3e80d0[_0x22d4('0x2d')];}_0x5ab1bf[_0x22d4('0x1d')](_0x2305b2)[_0x22d4('0x2e')](_0x3e80d0);};}exports['index']=function(_0x1352dc,_0x3a249e){var _0x3e1119={},_0x2a208f={},_0x3390e5={'count':0x0,'rows':[]};var _0x3b2ce9=_[_0x22d4('0x2f')](db[_0x22d4('0x30')][_0x22d4('0x31')],function(_0x3b75e9){return{'name':_0x3b75e9['fieldName'],'type':_0x3b75e9[_0x22d4('0x32')][_0x22d4('0x33')]};});_0x2a208f[_0x22d4('0x34')]=_['map'](_0x3b2ce9,'name');_0x2a208f[_0x22d4('0x35')]=_['keys'](_0x1352dc[_0x22d4('0x35')]);_0x2a208f[_0x22d4('0x36')]=_['intersection'](_0x2a208f['model'],_0x2a208f[_0x22d4('0x35')]);_0x3e1119[_0x22d4('0x37')]=_[_0x22d4('0x38')](_0x2a208f[_0x22d4('0x34')],qs[_0x22d4('0x39')](_0x1352dc[_0x22d4('0x35')]['fields']));_0x3e1119['attributes']=_0x3e1119[_0x22d4('0x37')]['length']?_0x3e1119['attributes']:_0x2a208f[_0x22d4('0x34')];if(!_0x1352dc[_0x22d4('0x35')][_0x22d4('0x3a')]('nolimit')){_0x3e1119['limit']=qs[_0x22d4('0x22')](_0x1352dc['query'][_0x22d4('0x22')]);_0x3e1119[_0x22d4('0x20')]=qs[_0x22d4('0x20')](_0x1352dc[_0x22d4('0x35')][_0x22d4('0x20')]);}_0x3e1119['order']=qs['sort'](_0x1352dc['query']['sort']);_0x3e1119['where']=qs[_0x22d4('0x36')](_['pick'](_0x1352dc['query'],_0x2a208f['filters']),_0x3b2ce9);if(_0x1352dc[_0x22d4('0x35')][_0x22d4('0x3b')]){_0x3e1119['where']=_[_0x22d4('0x3c')](_0x3e1119[_0x22d4('0x3d')],{'$or':_[_0x22d4('0x2f')](_0x3b2ce9,function(_0xf40687){if(_0xf40687[_0x22d4('0x32')]!==_0x22d4('0x3e')){var _0x4f4139={};_0x4f4139[_0xf40687[_0x22d4('0x2d')]]={'$like':'%'+_0x1352dc[_0x22d4('0x35')][_0x22d4('0x3b')]+'%'};return _0x4f4139;}})});}_0x3e1119=_[_0x22d4('0x3c')]({},_0x3e1119,_0x1352dc['options']);var _0x3e2d8d={'where':_0x3e1119['where']};return db[_0x22d4('0x30')]['count'](_0x3e2d8d)[_0x22d4('0x2a')](function(_0x3b3ba5){_0x3390e5['count']=_0x3b3ba5;if(_0x1352dc[_0x22d4('0x35')]['includeAll']){_0x3e1119[_0x22d4('0x3f')]=[{'all':!![]}];}return db[_0x22d4('0x30')][_0x22d4('0x40')](_0x3e1119);})[_0x22d4('0x2a')](function(_0x37dac6){_0x3390e5[_0x22d4('0x41')]=_0x37dac6;return _0x3390e5;})[_0x22d4('0x2a')](respondWithFilteredResult(_0x3a249e,_0x3e1119))['catch'](handleError(_0x3a249e,null));};exports[_0x22d4('0x42')]=function(_0xe36808,_0x5e3e14){var _0x25e0ca={'raw':!![],'where':{'id':_0xe36808[_0x22d4('0x43')]['id']}},_0x1d3a6b={};_0x1d3a6b[_0x22d4('0x34')]=_[_0x22d4('0x44')](db['Plugin'][_0x22d4('0x31')]);_0x1d3a6b[_0x22d4('0x35')]=_[_0x22d4('0x44')](_0xe36808[_0x22d4('0x35')]);_0x1d3a6b[_0x22d4('0x36')]=_[_0x22d4('0x38')](_0x1d3a6b[_0x22d4('0x34')],_0x1d3a6b[_0x22d4('0x35')]);_0x25e0ca[_0x22d4('0x37')]=_[_0x22d4('0x38')](_0x1d3a6b[_0x22d4('0x34')],qs['fields'](_0xe36808['query'][_0x22d4('0x39')]));_0x25e0ca[_0x22d4('0x37')]=_0x25e0ca['attributes'][_0x22d4('0x45')]?_0x25e0ca[_0x22d4('0x37')]:_0x1d3a6b['model'];if(_0xe36808[_0x22d4('0x35')][_0x22d4('0x46')]){_0x25e0ca['include']=[{'all':!![]}];}_0x25e0ca=_[_0x22d4('0x3c')]({},_0x25e0ca,_0xe36808[_0x22d4('0x47')]);return db[_0x22d4('0x30')][_0x22d4('0x48')](_0x25e0ca)['then'](handleEntityNotFound(_0x5e3e14,null))[_0x22d4('0x2a')](respondWithResult(_0x5e3e14,null))[_0x22d4('0x49')](handleError(_0x5e3e14,null));};exports['download']=function(_0x27b7d8,_0x1a0475,_0x30bce3){return db[_0x22d4('0x30')][_0x22d4('0x48')]({'where':{'id':_0x27b7d8[_0x22d4('0x43')]['id']},'attributes':[_0x22d4('0x2d'),_0x22d4('0x3')],'raw':!![]})[_0x22d4('0x2a')](handleEntityNotFound(_0x1a0475,null))[_0x22d4('0x2a')](function(_0x142c70){if(_0x142c70){var _0x4bfc1f=path[_0x22d4('0x4a')](config[_0x22d4('0x4b')],_0x22d4('0x4c'),util[_0x22d4('0x4d')]('%s.zip',path[_0x22d4('0x4e')](_0x142c70[_0x22d4('0x3')])));var _0x4e6a81=fs[_0x22d4('0x4f')](_0x4bfc1f);var _0x547121=archiver(_0x22d4('0x50'),{'zlib':{'level':0x9}});_0x547121['on'](_0x22d4('0x51'),function(_0x5b83ee){if(_0x5b83ee['code']===_0x22d4('0x52')){logger['error'](_0x5b83ee);}else{throw new db[(_0x22d4('0x53'))][(_0x22d4('0x54'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x547121['on'](_0x22d4('0x55'),function(_0x256382){throw new db[(_0x22d4('0x53'))]['Error']('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x547121[_0x22d4('0x56')](_0x4e6a81);_0x547121['glob'](_0x22d4('0x57'),{'cwd':path[_0x22d4('0x4a')](config[_0x22d4('0x4b')],_0x22d4('0x4c'),path[_0x22d4('0x58')](_0x142c70[_0x22d4('0x3')])),'ignore':[path['join'](path[_0x22d4('0x4e')](_0x142c70[_0x22d4('0x3')]),_0x22d4('0x59')),path[_0x22d4('0x4a')](path['basename'](_0x142c70[_0x22d4('0x3')]),_0x22d4('0x5a'))],'nodir':!![]})[_0x22d4('0x5b')]();_0x4e6a81['on'](_0x22d4('0x5c'),function(){if(!fs['existsSync'](_0x4bfc1f)){throw new db[(_0x22d4('0x53'))][(_0x22d4('0x54'))]('Plugin\x20not\x20found');}return _0x1a0475['download'](_0x4bfc1f,util['format']('%s.zip',path[_0x22d4('0x4e')](_0x142c70[_0x22d4('0x3')])),function(_0x2cc409){if(_0x2cc409){throw new db[(_0x22d4('0x53'))][(_0x22d4('0x54'))](_0x22d4('0x5d'));}fs['unlinkSync'](_0x4bfc1f);logger['info'](_0x22d4('0x5e'));logger[_0x22d4('0x5f')]('Temporary\x20file\x20removed');});});}return null;})[_0x22d4('0x49')](handleError(_0x1a0475,null));};exports['upload']=function(_0x17fe1f,_0x53ae35,_0x2cbe31){var _0x39d85d=path[_0x22d4('0x4e')](_0x17fe1f[_0x22d4('0x60')][_0x22d4('0x61')],path[_0x22d4('0x62')](_0x17fe1f[_0x22d4('0x60')]['filename']));var _0x402a92=path['join'](config[_0x22d4('0x4b')],'server/files/plugins',_0x17fe1f[_0x22d4('0x60')]['filename']);var _0x1c611c=path[_0x22d4('0x4a')](config[_0x22d4('0x4b')],_0x22d4('0x4c'),_0x39d85d);logger[_0x22d4('0x5f')](_0x22d4('0x63'),_0x402a92);logger[_0x22d4('0x5f')](_0x22d4('0x64'),_0x1c611c);try{fs[_0x22d4('0x65')](_0x402a92,parseInt('0777',0x8));extract(_0x402a92,{'dir':_0x1c611c},function(_0x4748b8){if(_0x4748b8){logger['error'](_0x4748b8);handleError(_0x4748b8,!![]);};var _0x1252b9=fs[_0x22d4('0x66')](_0x1c611c);if(_0x1252b9[_0x22d4('0x45')]>0x1){removeReferences(_0x402a92,_0x1c611c);logger[_0x22d4('0x55')]('Invalid\x20plugin\x20structure');return _0x2cbe31(new Error(_0x22d4('0x67')));}var _0x56dc56=fs[_0x22d4('0x68')](path[_0x22d4('0x4a')](_0x1c611c,_0x1252b9[0x0]));if(_0x56dc56[_0x22d4('0x69')]()){removeReferences(_0x402a92,_0x1c611c);logger[_0x22d4('0x55')]('Invalid\x20plugin\x20structure');return _0x2cbe31(new Error(_0x22d4('0x67')));}if(_0x56dc56[_0x22d4('0x6a')]()){var _0x315f83=fs[_0x22d4('0x66')](path[_0x22d4('0x4a')](_0x1c611c,_0x1252b9[0x0]));if(_0x315f83[_0x22d4('0x45')]===0x0){removeReferences(_0x402a92,_0x1c611c);logger['error'](_0x22d4('0x67'));return _0x2cbe31(new Error(_0x22d4('0x67')));}var _0x366a7c=_0x315f83['some'](function(_0x596204){return _0x596204===_0x22d4('0x6b');});if(!_0x366a7c){return _0x2cbe31(new Error(_0x22d4('0x6c')));}var _0x5392c6=fs[_0x22d4('0x6d')](path[_0x22d4('0x4a')](_0x1c611c,_0x1252b9[0x0],_0x22d4('0x6b')));var _0x195af8=JSON['parse'](_0x5392c6);if('undefined'==typeof _0x195af8[_0x22d4('0x2d')]){return _0x2cbe31(new Error(_0x22d4('0x6e')));}if(_0x22d4('0x21')==typeof _0x195af8[_0x22d4('0x32')]){return _0x2cbe31(new Error(_0x22d4('0x6f')));}if('undefined'==typeof _0x195af8[_0x22d4('0x70')]){return _0x2cbe31(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0x22d4('0x21')==typeof _0x195af8['parameters']){return _0x2cbe31(new Error('Invalid\x20manifest:\x20parameters\x20missing'));}if(_0x195af8[_0x22d4('0x32')]==='html'){if('undefined'==typeof _0x195af8['parameters']['views']){return _0x2cbe31(new Error('Invalid\x20manifest:\x20views\x20missing'));}if('undefined'==typeof _0x195af8[_0x22d4('0x71')][_0x22d4('0x72')]['admin']&&_0x22d4('0x21')==typeof _0x195af8['parameters'][_0x22d4('0x72')][_0x22d4('0x73')]){return _0x2cbe31(new Error(_0x22d4('0x74')));}}else if(_0x195af8[_0x22d4('0x32')]==='script'){if('undefined'==typeof _0x195af8[_0x22d4('0x71')]['scriptName']){return _0x2cbe31(new Error(_0x22d4('0x75')));}if(_0x22d4('0x21')==typeof _0x195af8['parameters'][_0x22d4('0x76')]){return _0x2cbe31(new Error(_0x22d4('0x77')));}}else{return _0x2cbe31(new Error(_0x22d4('0x78')));}var _0x2c4bb9=_0x195af8[_0x22d4('0x2d')];var _0x584db0=_0x195af8[_0x22d4('0x79')];var _0x30f7de=_0x195af8[_0x22d4('0x32')];var _0xd72c38=_0x195af8[_0x22d4('0x7a')]?_0x195af8[_0x22d4('0x7a')]:'always';var _0x48a08=_0x195af8['icon']?_0x195af8[_0x22d4('0x7b')]:_0x22d4('0x7c');var _0x20a337='';var _0x50e2ef='';var _0x4f97cb='';var _0x1f62bb='';var _0x292dfa=_0x195af8[_0x22d4('0x70')];if(_0x30f7de==='html'){if('undefined'!=typeof _0x195af8[_0x22d4('0x71')]['views'][_0x22d4('0x7d')]){var _0x46b65d=_0x195af8[_0x22d4('0x71')][_0x22d4('0x72')][_0x22d4('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x22d4('0x7e')](_0x46b65d)){_0x20a337=path['join']('plugins',_0x39d85d,_0x1252b9[0x0],_0x46b65d);}else{_0x20a337=_0x46b65d;}}else{logger[_0x22d4('0x5f')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x22d4('0x21')!=typeof _0x195af8[_0x22d4('0x71')]['views'][_0x22d4('0x73')]){var _0x2a4a73=_0x195af8[_0x22d4('0x71')]['views'][_0x22d4('0x73')];if(!/^(f|ht)tps?:\/\//i[_0x22d4('0x7e')](_0x2a4a73)){_0x50e2ef=path[_0x22d4('0x4a')](_0x22d4('0x7f'),_0x39d85d,_0x1252b9[0x0],_0x2a4a73);}else{_0x50e2ef=_0x2a4a73;}}else{logger[_0x22d4('0x5f')](_0x22d4('0x80'));}}else if(_0x30f7de==='script'){_0x4f97cb=_0x195af8['parameters'][_0x22d4('0x81')];_0x1f62bb=_0x195af8[_0x22d4('0x71')]['scriptPath'];if(_0x22d4('0x21')!=typeof _0x195af8[_0x22d4('0x71')][_0x22d4('0x72')]){if('undefined'!=typeof _0x195af8[_0x22d4('0x71')][_0x22d4('0x72')][_0x22d4('0x7d')]){var _0x46b65d=_0x195af8['parameters']['views'][_0x22d4('0x7d')];if(!/^(f|ht)tps?:\/\//i[_0x22d4('0x7e')](_0x46b65d)){_0x20a337=path[_0x22d4('0x4a')](_0x22d4('0x7f'),_0x39d85d,_0x1252b9[0x0],_0x46b65d);}else{_0x20a337=_0x46b65d;}}if('undefined'!=typeof _0x195af8[_0x22d4('0x71')][_0x22d4('0x72')][_0x22d4('0x73')]){var _0x2a4a73=_0x195af8[_0x22d4('0x71')][_0x22d4('0x72')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x2a4a73)){_0x50e2ef=path[_0x22d4('0x4a')](_0x22d4('0x7f'),_0x39d85d,_0x1252b9[0x0],_0x2a4a73);}else{_0x50e2ef=_0x2a4a73;}}}}var _0x31c3e4={'name':_0x2c4bb9,'description':_0x584db0,'path':path[_0x22d4('0x4a')](_0x39d85d,_0x1252b9[0x0]),'type':_0x30f7de,'sidebar':_0xd72c38,'icon':_0x48a08,'adminUrl':_0x20a337,'agentUrl':_0x50e2ef,'scriptName':_0x4f97cb,'scriptPath':_0x1f62bb,'version':_0x292dfa};removeReferences(_0x402a92,null);return db[_0x22d4('0x30')][_0x22d4('0x82')](_0x31c3e4)[_0x22d4('0x2a')](function(_0x4885d5){var _0x27475b={'role':_0x17fe1f[_0x22d4('0x83')][_0x22d4('0x84')],'userProfileId':_0x17fe1f[_0x22d4('0x83')][_0x22d4('0x85')]};if(!_0x27475b)throw new Error(_0x22d4('0x86'));if(_0x27475b['role']===_0x22d4('0x87')){var _0x4c8459=_0x4885d5['get']({'plain':!![]});return db[_0x22d4('0x88')][_0x22d4('0x48')]({'where':{'name':'Plugins','userProfileId':_0x27475b['userProfileId']},'raw':!![]})['then'](function(_0x5bf899){if(_0x5bf899&&_0x5bf899[_0x22d4('0x89')]===0x0){return db[_0x22d4('0x2b')]['create']({'name':_0x4c8459['name'],'resourceId':_0x4c8459['id'],'type':_0x5bf899['name'],'sectionId':_0x5bf899['id']},{})['then'](function(){return _0x4885d5;});}else{return _0x4885d5;}})[_0x22d4('0x49')](function(_0x5794ad){logger['error'](_0x22d4('0x8a'),_0x5794ad);throw _0x5794ad;});}return _0x4885d5;})[_0x22d4('0x2a')](respondWithResult(_0x53ae35,null))[_0x22d4('0x49')](handleError(_0x53ae35,null));}});}catch(_0xa24d19){_0x53ae35[_0x22d4('0x1d')](0x1f4)[_0x22d4('0x2e')](_0xa24d19);}};function removeReferences(_0x9dd273,_0x407ed9){try{if(_0x9dd273){fs['unlinkSync'](_0x9dd273);logger[_0x22d4('0x5f')](_0x22d4('0x8b'));}if(_0x407ed9){rimraf(_0x407ed9,function(){});logger[_0x22d4('0x5f')](_0x22d4('0x8c'));}}catch(_0x45f13f){logger['error'](_0x45f13f);}}exports[_0x22d4('0x28')]=function(_0x331ebb,_0x551a1a,_0x2ffb62){return db[_0x22d4('0x30')]['find']({'where':{'id':_0x331ebb[_0x22d4('0x43')]['id']}})[_0x22d4('0x2a')](handleEntityNotFound(_0x551a1a,null))[_0x22d4('0x2a')](saveUpdates(_0x331ebb[_0x22d4('0x83')],null))['then'](respondWithResult(_0x551a1a,null))[_0x22d4('0x49')](handleError(_0x551a1a,null));};exports[_0x22d4('0x8d')]=function(_0x45590c,_0x16e33c,_0x435d89){return db['Plugin'][_0x22d4('0x48')]({'where':{'id':_0x45590c[_0x22d4('0x43')]['id']}})[_0x22d4('0x2a')](function(_0x34d818){if(_0x34d818){return _0x34d818['destroy']();}})[_0x22d4('0x2a')](function(_0x25baf5){rimraf(path[_0x22d4('0x4a')](config[_0x22d4('0x4b')],_0x22d4('0x4c'),path[_0x22d4('0x58')](_0x25baf5[_0x22d4('0x3')])),function(){});return _0x25baf5;})[_0x22d4('0x2a')](handleEntityNotFound(_0x16e33c,null))[_0x22d4('0x2a')](respondWithStatusCode(_0x16e33c,null))[_0x22d4('0x49')](handleError(_0x16e33c,null));};exports[_0x22d4('0x8e')]=function(_0x31808f,_0x54c3ee,_0x426c58){return BPromise[_0x22d4('0x8f')]()['then'](function(){if(!_0x31808f[_0x22d4('0x35')][_0x22d4('0x3')]){throw new Error(_0x22d4('0x90'));}if(!_0x31808f[_0x22d4('0x35')][_0x22d4('0x91')]){throw new Error(_0x22d4('0x92'));}var _0x3c2603=_0x31808f[_0x22d4('0x35')]['hostname']?_0x31808f[_0x22d4('0x35')][_0x22d4('0x93')]+':'+_0x31808f['query'][_0x22d4('0x91')]:'http://localhost:'+_0x31808f[_0x22d4('0x35')][_0x22d4('0x91')];var _0x9e0ad2=_0x31808f[_0x22d4('0x35')][_0x22d4('0x1f')]?_0x31808f[_0x22d4('0x35')]['json']:!![];var _0x57cc62=_0x31808f[_0x22d4('0x35')][_0x22d4('0x94')]?_0x31808f[_0x22d4('0x35')][_0x22d4('0x94')]:null;var _0x1faafc={'method':_0x31808f[_0x22d4('0x95')],'uri':util[_0x22d4('0x4d')](_0x22d4('0x96'),_0x3c2603,_0x31808f[_0x22d4('0x35')][_0x22d4('0x3')]),'json':_0x9e0ad2,'resolveWithFullResponse':!![],'encoding':_0x57cc62,'qs':_0x31808f[_0x22d4('0x35')]};if(_0x31808f['headers']){_0x1faafc[_0x22d4('0x97')]=_0x31808f[_0x22d4('0x97')];if(_0x1faafc['headers'][_0x22d4('0x98')]){delete _0x1faafc['headers'][_0x22d4('0x98')];}}if(_0x1faafc[_0x22d4('0x97')][_0x22d4('0x99')]){delete _0x1faafc[_0x22d4('0x97')]['content-type'];}return rp(_0x1faafc);})['then'](function(_0x2f8bff){if(_0x2f8bff){_0x54c3ee[_0x22d4('0x24')](_0x2f8bff[_0x22d4('0x97')]);logger['info'](_0x2f8bff[_0x22d4('0x83')]);if(_[_0x22d4('0x9a')](_0x31808f[_0x22d4('0x35')][_0x22d4('0x3')],_0x22d4('0x9b'))&&_0x2f8bff[_0x22d4('0x9c')]==0x1f4){return _0x54c3ee[_0x22d4('0x1c')](_0x2f8bff[_0x22d4('0x9c')]);}else{return _0x54c3ee[_0x22d4('0x1d')](_0x2f8bff[_0x22d4('0x9c')])['send'](_0x2f8bff[_0x22d4('0x83')]);}}else{return _0x54c3ee[_0x22d4('0x1c')](0xc8);}})['catch'](handleError(_0x54c3ee,null));};exports[_0x22d4('0x9d')]=function(_0x506012,_0x564d01,_0x3f48b1){return BPromise[_0x22d4('0x8f')]()[_0x22d4('0x2a')](function(){if(!_0x506012[_0x22d4('0x35')]['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x506012[_0x22d4('0x35')]['port']){throw new Error(_0x22d4('0x92'));}var _0xb26d97=_0x506012[_0x22d4('0x35')][_0x22d4('0x93')]?_0x506012[_0x22d4('0x35')]['hostname']+':'+_0x506012[_0x22d4('0x35')][_0x22d4('0x91')]:_0x22d4('0x9e')+_0x506012['query']['port'];var _0x57bb55=_0x506012[_0x22d4('0x35')][_0x22d4('0x1f')]?_0x506012[_0x22d4('0x35')][_0x22d4('0x1f')]:!![];var _0x3e5d06=_0x506012[_0x22d4('0x35')][_0x22d4('0x94')]?_0x506012['query'][_0x22d4('0x94')]:null;var _0x4e207e={'method':_0x506012[_0x22d4('0x95')],'uri':util[_0x22d4('0x4d')]('%s%s',_0xb26d97,_0x506012[_0x22d4('0x35')]['path']),'json':_0x57bb55,'resolveWithFullResponse':!![],'encoding':_0x3e5d06,'body':_0x506012[_0x22d4('0x83')]};if(_0x506012[_0x22d4('0x97')]){_0x4e207e[_0x22d4('0x97')]=_0x506012[_0x22d4('0x97')];if(_0x4e207e[_0x22d4('0x97')][_0x22d4('0x98')]){delete _0x4e207e['headers'][_0x22d4('0x98')];}}if(_0x4e207e[_0x22d4('0x97')]['content-type']){delete _0x4e207e[_0x22d4('0x97')][_0x22d4('0x99')];}return rp(_0x4e207e);})[_0x22d4('0x2a')](function(_0xba5617){if(_0xba5617){_0x564d01[_0x22d4('0x24')](_0xba5617[_0x22d4('0x97')]);logger[_0x22d4('0x5f')](_0xba5617['body']);return _0x564d01[_0x22d4('0x1d')](_0xba5617[_0x22d4('0x9c')])[_0x22d4('0x2e')](_0xba5617[_0x22d4('0x83')]);}else{return _0x564d01[_0x22d4('0x1c')](0xc8);}})[_0x22d4('0x49')](handleError(_0x564d01,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 1967d1b..ab824e8 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 _0x9bb8=['exports','events','../../mysqldb','Plugin','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x86d32e,_0x3a0bf1){var _0x50a35e=function(_0x414a12){while(--_0x414a12){_0x86d32e['push'](_0x86d32e['shift']());}};_0x50a35e(++_0x3a0bf1);}(_0x9bb8,0x1ae));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x89bb('0x0'));var Plugin=require(_0x89bb('0x1'))['db'][_0x89bb('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x89bb('0x3')](0x0);var events={'afterCreate':_0x89bb('0x4'),'afterUpdate':_0x89bb('0x5'),'afterDestroy':_0x89bb('0x6')};function emitEvent(_0x1af2d3){return function(_0xaa37b7,_0x26ecc2,_0x436902){PluginEvents[_0x89bb('0x7')](_0x1af2d3+':'+_0xaa37b7['id'],_0xaa37b7);PluginEvents['emit'](_0x1af2d3,_0xaa37b7);_0x436902(null);};}for(var e in events){if(events[_0x89bb('0x8')](e)){var event=events[e];Plugin[_0x89bb('0x9')](e,emitEvent(event));}}module[_0x89bb('0xa')]=PluginEvents; \ No newline at end of file +var _0xfc91=['update','remove','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners','save'];(function(_0x1f0d06,_0x31ff98){var _0x58a7c4=function(_0x34ad9e){while(--_0x34ad9e){_0x1f0d06['push'](_0x1f0d06['shift']());}};_0x58a7c4(++_0x31ff98);}(_0xfc91,0xb5));var _0x1fc9=function(_0x21f880,_0x25a045){_0x21f880=_0x21f880-0x0;var _0x427b6e=_0xfc91[_0x21f880];return _0x427b6e;};'use strict';var EventEmitter=require('events');var Plugin=require(_0x1fc9('0x0'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x1fc9('0x1')](0x0);var events={'afterCreate':_0x1fc9('0x2'),'afterUpdate':_0x1fc9('0x3'),'afterDestroy':_0x1fc9('0x4')};function emitEvent(_0x2199cd){return function(_0xa16e01,_0x471692,_0x6d3bcc){PluginEvents[_0x1fc9('0x5')](_0x2199cd+':'+_0xa16e01['id'],_0xa16e01);PluginEvents[_0x1fc9('0x5')](_0x2199cd,_0xa16e01);_0x6d3bcc(null);};}for(var e in events){if(events[_0x1fc9('0x6')](e)){var event=events[e];Plugin[_0x1fc9('0x7')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 72b9c1b..25b97e8 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 _0x4b19=['api','moment','request-promise','path','rimraf','./plugin.attributes','exports','define','plugins','lodash','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b19,0x195));var _0x94b1=function(_0x447305,_0x59ae0b){_0x447305=_0x447305-0x0;var _0x198b2b=_0x4b19[_0x447305];return _0x198b2b;};'use strict';var _=require(_0x94b1('0x0'));var util=require('util');var logger=require(_0x94b1('0x1'))(_0x94b1('0x2'));var moment=require(_0x94b1('0x3'));var BPromise=require('bluebird');var rp=require(_0x94b1('0x4'));var fs=require('fs');var path=require(_0x94b1('0x5'));var rimraf=require(_0x94b1('0x6'));var config=require('../../config/environment');var attributes=require(_0x94b1('0x7'));module[_0x94b1('0x8')]=function(_0x52d6c1,_0x24df76){return _0x52d6c1[_0x94b1('0x9')]('Plugin',attributes,{'tableName':_0x94b1('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a05=['exports','define','Plugin','plugins','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment','./plugin.attributes'];(function(_0x16780f,_0x355eff){var _0x1e8480=function(_0x213328){while(--_0x213328){_0x16780f['push'](_0x16780f['shift']());}};_0x1e8480(++_0x355eff);}(_0x0a05,0x1e4));var _0x50a0=function(_0x48c615,_0x4cc757){_0x48c615=_0x48c615-0x0;var _0x3d9e22=_0x0a05[_0x48c615];return _0x3d9e22;};'use strict';var _=require(_0x50a0('0x0'));var util=require(_0x50a0('0x1'));var logger=require(_0x50a0('0x2'))('api');var moment=require(_0x50a0('0x3'));var BPromise=require(_0x50a0('0x4'));var rp=require(_0x50a0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x50a0('0x6'));var attributes=require(_0x50a0('0x7'));module[_0x50a0('0x8')]=function(_0x120258,_0x5255aa){return _0x120258[_0x50a0('0x9')](_0x50a0('0xa'),attributes,{'tableName':_0x50a0('0xb'),'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 67a1e00..e5f9c06 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 _0x1b5b=['http','redis','defaults','localhost','./plugin.socket','register','request','then','info','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','Plugin','create','options','raw','catch','CreatePlugin','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x3fc97b,_0x20ca29){var _0x3a0c82=function(_0x1c15ec){while(--_0x1c15ec){_0x3fc97b['push'](_0x3fc97b['shift']());}};_0x3a0c82(++_0x20ca29);}(_0x1b5b,0x74));var _0xb1b5=function(_0x3e0763,_0x3d12be){_0x3e0763=_0x3e0763-0x0;var _0x351ca2=_0x1b5b[_0x3e0763];return _0x351ca2;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb1b5('0x0'));var rs=require(_0xb1b5('0x1'));var fs=require('fs');var Redis=require(_0xb1b5('0x2'));var db=require(_0xb1b5('0x3'))['db'];var utils=require(_0xb1b5('0x4'));var logger=require(_0xb1b5('0x5'))(_0xb1b5('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb1b5('0x7')][_0xb1b5('0x8')]({'port':0x232a});config[_0xb1b5('0x9')]=_[_0xb1b5('0xa')](config[_0xb1b5('0x9')],{'host':_0xb1b5('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb1b5('0xc'))[_0xb1b5('0xd')](socket);function respondWithRpcPromise(_0x153a36,_0x5c7ef0,_0x3f56fb){return new BPromise(function(_0x2f5288,_0x1d21c1){return client[_0xb1b5('0xe')](_0x153a36,_0x3f56fb)[_0xb1b5('0xf')](function(_0x15e6b9){logger[_0xb1b5('0x10')](_0xb1b5('0x11'),_0x5c7ef0,'request\x20sent');logger[_0xb1b5('0x12')](_0xb1b5('0x13'),_0x5c7ef0,_0xb1b5('0x14'),JSON['stringify'](_0x15e6b9));if(_0x15e6b9[_0xb1b5('0x15')]){if(_0x15e6b9['error'][_0xb1b5('0x16')]===0x1f4){logger[_0xb1b5('0x15')](_0xb1b5('0x11'),_0x5c7ef0,_0x15e6b9[_0xb1b5('0x15')][_0xb1b5('0x17')]);return _0x1d21c1(_0x15e6b9[_0xb1b5('0x15')]['message']);}logger['error'](_0xb1b5('0x11'),_0x5c7ef0,_0x15e6b9[_0xb1b5('0x15')][_0xb1b5('0x17')]);return _0x2f5288(_0x15e6b9['error'][_0xb1b5('0x17')]);}else{logger[_0xb1b5('0x10')]('Plugin,\x20%s,\x20%s',_0x5c7ef0,_0xb1b5('0x14'));_0x2f5288(_0x15e6b9[_0xb1b5('0x18')][_0xb1b5('0x17')]);}})['catch'](function(_0x225ad5){logger[_0xb1b5('0x15')](_0xb1b5('0x11'),_0x5c7ef0,_0x225ad5);_0x1d21c1(_0x225ad5);});});}exports['CreatePlugin']=function(_0x288c55){var _0x38c382=this;return new Promise(function(_0x2637a0,_0x35c2cc){return db[_0xb1b5('0x19')][_0xb1b5('0x1a')](_0x288c55['body'],{'raw':_0x288c55['options']?_0x288c55[_0xb1b5('0x1b')][_0xb1b5('0x1c')]===undefined?!![]:![]:!![]})[_0xb1b5('0xf')](function(_0x35a796){logger[_0xb1b5('0x10')]('CreatePlugin',_0x288c55);logger[_0xb1b5('0x12')]('CreatePlugin',_0x288c55,JSON['stringify'](_0x35a796));_0x2637a0(_0x35a796);})[_0xb1b5('0x1d')](function(_0x42d3e4){logger[_0xb1b5('0x15')](_0xb1b5('0x1e'),_0x42d3e4[_0xb1b5('0x17')],_0x288c55);_0x35c2cc(_0x38c382[_0xb1b5('0x15')](0x1f4,_0x42d3e4[_0xb1b5('0x17')]));});});}; \ No newline at end of file +var _0x294b=['../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreatePlugin','Plugin','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x294b,0x120));var _0xb294=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x294b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb294('0x0'));var util=require(_0xb294('0x1'));var moment=require(_0xb294('0x2'));var BPromise=require(_0xb294('0x3'));var rs=require(_0xb294('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb294('0x5'));var logger=require(_0xb294('0x6'))(_0xb294('0x7'));var config=require(_0xb294('0x8'));var jayson=require(_0xb294('0x9'));var client=jayson[_0xb294('0xa')][_0xb294('0xb')]({'port':0x232a});config[_0xb294('0xc')]=_[_0xb294('0xd')](config[_0xb294('0xc')],{'host':_0xb294('0xe'),'port':0x18eb});var socket=require(_0xb294('0xf'))(new Redis(config['redis']));require(_0xb294('0x10'))[_0xb294('0x11')](socket);function respondWithRpcPromise(_0x42abac,_0x1dce5c,_0x3bbec0){return new BPromise(function(_0x2da53e,_0x20f6af){return client[_0xb294('0x12')](_0x42abac,_0x3bbec0)[_0xb294('0x13')](function(_0x7c3ce){logger['info'](_0xb294('0x14'),_0x1dce5c,_0xb294('0x15'));logger[_0xb294('0x16')](_0xb294('0x17'),_0x1dce5c,'request\x20sent',JSON[_0xb294('0x18')](_0x7c3ce));if(_0x7c3ce[_0xb294('0x19')]){if(_0x7c3ce[_0xb294('0x19')][_0xb294('0x1a')]===0x1f4){logger[_0xb294('0x19')](_0xb294('0x14'),_0x1dce5c,_0x7c3ce[_0xb294('0x19')]['message']);return _0x20f6af(_0x7c3ce['error'][_0xb294('0x1b')]);}logger['error'](_0xb294('0x14'),_0x1dce5c,_0x7c3ce[_0xb294('0x19')][_0xb294('0x1b')]);return _0x2da53e(_0x7c3ce['error'][_0xb294('0x1b')]);}else{logger[_0xb294('0x1c')](_0xb294('0x14'),_0x1dce5c,_0xb294('0x15'));_0x2da53e(_0x7c3ce[_0xb294('0x1d')][_0xb294('0x1b')]);}})[_0xb294('0x1e')](function(_0x463b3f){logger[_0xb294('0x19')](_0xb294('0x14'),_0x1dce5c,_0x463b3f);_0x20f6af(_0x463b3f);});});}exports[_0xb294('0x1f')]=function(_0x407f59){var _0x594387=this;return new Promise(function(_0x1eaf18,_0x2b15a){return db[_0xb294('0x20')][_0xb294('0x21')](_0x407f59[_0xb294('0x22')],{'raw':_0x407f59[_0xb294('0x23')]?_0x407f59[_0xb294('0x23')][_0xb294('0x24')]===undefined?!![]:![]:!![]})[_0xb294('0x13')](function(_0x20354d){logger[_0xb294('0x1c')]('CreatePlugin',_0x407f59);logger[_0xb294('0x16')](_0xb294('0x1f'),_0x407f59,JSON['stringify'](_0x20354d));_0x1eaf18(_0x20354d);})[_0xb294('0x1e')](function(_0x2f4110){logger['error']('CreatePlugin',_0x2f4110['message'],_0x407f59);_0x2b15a(_0x594387['error'](0x1f4,_0x2f4110[_0xb294('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index fd57215..4bed10d 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 _0xc204=['length','./plugin.events','save','remove','update','emit','removeListener'];(function(_0x2d7f8c,_0x2a1c7f){var _0x294d42=function(_0x1f4cd0){while(--_0x1f4cd0){_0x2d7f8c['push'](_0x2d7f8c['shift']());}};_0x294d42(++_0x2a1c7f);}(_0xc204,0x8d));var _0x4c20=function(_0x5baf5e,_0x131b8c){_0x5baf5e=_0x5baf5e-0x0;var _0x3650ed=_0xc204[_0x5baf5e];return _0x3650ed;};'use strict';var PluginEvents=require(_0x4c20('0x0'));var events=[_0x4c20('0x1'),_0x4c20('0x2'),_0x4c20('0x3')];function createListener(_0xcf875a,_0x5ca139){return function(_0xd81a49){_0x5ca139[_0x4c20('0x4')](_0xcf875a,_0xd81a49);};}function removeListener(_0x141d90,_0x3165db){return function(){PluginEvents[_0x4c20('0x5')](_0x141d90,_0x3165db);};}exports['register']=function(_0x36c555){for(var _0x11ee37=0x0,_0x1188bd=events[_0x4c20('0x6')];_0x11ee37<_0x1188bd;_0x11ee37++){var _0x54fa74=events[_0x11ee37];var _0x17ea3e=createListener('plugin:'+_0x54fa74,_0x36c555);PluginEvents['on'](_0x54fa74,_0x17ea3e);}}; \ No newline at end of file +var _0xeeae=['plugin:','./plugin.events','save','update','length'];(function(_0x26017a,_0x9389b7){var _0x2dc7f3=function(_0xf05634){while(--_0xf05634){_0x26017a['push'](_0x26017a['shift']());}};_0x2dc7f3(++_0x9389b7);}(_0xeeae,0x79));var _0xeeea=function(_0x41a9b4,_0x4aad69){_0x41a9b4=_0x41a9b4-0x0;var _0x32f712=_0xeeae[_0x41a9b4];return _0x32f712;};'use strict';var PluginEvents=require(_0xeeea('0x0'));var events=[_0xeeea('0x1'),'remove',_0xeeea('0x2')];function createListener(_0x3ee4cd,_0xfb1b2){return function(_0x4af46e){_0xfb1b2['emit'](_0x3ee4cd,_0x4af46e);};}function removeListener(_0x331bfa,_0x36a8b0){return function(){PluginEvents['removeListener'](_0x331bfa,_0x36a8b0);};}exports['register']=function(_0x3527e0){for(var _0x275b00=0x0,_0xd4cd5e=events[_0xeeea('0x3')];_0x275b00<_0xd4cd5e;_0x275b00++){var _0x3ffe6b=events[_0x275b00];var _0x2c6643=createListener(_0xeeea('0x4')+_0x3ffe6b,_0x3527e0);PluginEvents['on'](_0x3ffe6b,_0x2c6643);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index e508bd3..4bbabd6 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(_0x415493,_0x487a92){var _0x5624be=function(_0x7884ea){while(--_0x7884ea){_0x415493['push'](_0x415493['shift']());}};_0x5624be(++_0x487a92);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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(_0x20fe65,_0x238ea1){var _0x4be5a4=function(_0x3979ac){while(--_0x3979ac){_0x20fe65['push'](_0x20fe65['shift']());}};_0x4be5a4(++_0x238ea1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0xa9e0[_0x46aff0];return _0x9d78cf;};'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 4ac3ab2..bdeca73 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 _0x1339=['body','params','delete','../../config/logger','api','path','child_process','exec','bluebird','sendStatus','status','json','error','stack','name','npm\x20install','info','then','reject','motion2','catch','show','describe','create','../../files/plugins','cwd','chdir','start','dump','send','Missing\x20name\x20and/or\x20path','update','restart','stop','hasOwnProperty'];(function(_0x96ad7d,_0x1017ba){var _0x32d63a=function(_0xb47ad9){while(--_0xb47ad9){_0x96ad7d['push'](_0x96ad7d['shift']());}};_0x32d63a(++_0x1017ba);}(_0x1339,0x1ed));var _0x9133=function(_0x2f8c7e,_0x1e75da){_0x2f8c7e=_0x2f8c7e-0x0;var _0x3ce584=_0x1339[_0x2f8c7e];return _0x3ce584;};'use strict';var _=require('lodash');var pm2=require('../../config/pm2');var logger=require(_0x9133('0x0'))(_0x9133('0x1'));var path=require(_0x9133('0x2'));var exec=require(_0x9133('0x3'))[_0x9133('0x4')];var BPromise=require(_0x9133('0x5'));function handleEntityNotFound(_0x176e80,_0x110c51){return function(_0x558345){if(!_0x558345){_0x176e80[_0x9133('0x6')](0x194);;}return _0x558345;};}function respondWithResult(_0x855473,_0x379915){_0x379915=_0x379915||0xc8;return function(_0x539af6){if(_0x539af6){return _0x855473[_0x9133('0x7')](_0x379915)[_0x9133('0x8')](_0x539af6);}return null;};}function handleError(_0x3059c4,_0x431a55){_0x431a55=_0x431a55||0x1f4;return function(_0x261698){logger[_0x9133('0x9')](_0x261698[_0x9133('0xa')]);if(_0x261698[_0x9133('0xb')]){delete _0x261698[_0x9133('0xb')];}_0x3059c4[_0x9133('0x7')](_0x431a55)['send'](_0x261698);};}function execChildProcess(){return new BPromise(function(_0x3f9650,_0x3533fa){exec(_0x9133('0xc'),function(_0x452481,_0x3b8f89,_0x244ced){logger['info'](_0x3b8f89);logger[_0x9133('0xd')](_0x244ced);if(_0x452481){logger[_0x9133('0x9')](_0x452481);return _0x3533fa(_0x452481);}return _0x3f9650(_0x3b8f89);});});}exports['index']=function(_0x5283a3,_0x10475c){return pm2['list']()[_0x9133('0xe')](function(_0x439e1a){if(_0x439e1a){var _0x17dfd1=_[_0x9133('0xf')](_0x439e1a,function(_0x31847a){return _0x31847a[_0x9133('0xb')]==='express'||_0x31847a[_0x9133('0xb')]===_0x9133('0x10');});return{'rows':_0x17dfd1,'count':_0x17dfd1['length']};}return null;})[_0x9133('0xe')](respondWithResult(_0x10475c,null))[_0x9133('0x11')](handleError(_0x10475c,null));};exports[_0x9133('0x12')]=function(_0x427663,_0x4a2c4f){return pm2[_0x9133('0x13')](_0x427663['params']['id'])[_0x9133('0xe')](respondWithResult(_0x4a2c4f,null))['then'](handleEntityNotFound(_0x4a2c4f,null))[_0x9133('0x11')](handleError(_0x4a2c4f,null));};exports[_0x9133('0x14')]=function(_0x5e8620,_0x38dd60){if(_0x5e8620['body'][_0x9133('0xb')]&&_0x5e8620['body']['script']){var _0x2f7354=path['join'](__dirname,_0x9133('0x15'),_0x5e8620['body']['script']);var _0x4c846e=process[_0x9133('0x16')]();process[_0x9133('0x17')](path['dirname'](_0x2f7354));return execChildProcess()[_0x9133('0xe')](function(_0x3f5d0e){process[_0x9133('0x17')](_0x4c846e);return pm2[_0x9133('0x18')]({'name':_0x5e8620['body'][_0x9133('0xb')],'script':_0x2f7354});})['then'](function(_0x187e32){pm2[_0x9133('0x19')]();return _0x187e32[0x0];})[_0x9133('0xe')](respondWithResult(_0x38dd60,0xc9))[_0x9133('0x11')](handleError(_0x38dd60,null));}else{return _0x38dd60[_0x9133('0x7')](0x1f4)[_0x9133('0x1a')]({'message':_0x9133('0x1b')});}};exports[_0x9133('0x1c')]=function(_0x1b6b3e,_0x46050b){if(_0x1b6b3e['body']['id']){delete _0x1b6b3e['body']['id'];}var _0x477bf1={'online':_0x9133('0x1d'),'stopped':_0x9133('0x1e')};if(_0x477bf1[_0x9133('0x1f')](_0x1b6b3e['body']['status'])){return pm2[_0x477bf1[_0x1b6b3e[_0x9133('0x20')][_0x9133('0x7')]]](_0x1b6b3e[_0x9133('0x21')]['id'])[_0x9133('0xe')](respondWithResult(_0x46050b,0xc8))[_0x9133('0x11')](handleError(_0x46050b,null));}else{return _0x46050b[_0x9133('0x7')](0x1f4)['send']({'message':'Unknown\x20status'});}};exports['destroy']=function(_0x1ad222,_0x4a4a8e){if(_0x1ad222[_0x9133('0x20')]['id']){delete _0x1ad222[_0x9133('0x20')]['id'];}if(_0x1ad222['params']['id']){return pm2[_0x9133('0x22')](_0x1ad222['params']['id'])[_0x9133('0xe')](function(_0x26ca56){pm2[_0x9133('0x19')]();return _0x26ca56[0x0];})['then'](respondWithResult(_0x4a4a8e,null))[_0x9133('0x11')](handleError(_0x4a4a8e,null));}else{return _0x4a4a8e[_0x9133('0x7')](0x1f4)[_0x9133('0x1a')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x41bb=['restart','stop','hasOwnProperty','Unknown\x20status','delete','dump','Unknown\x20id','lodash','../../config/pm2','api','child_process','exec','bluebird','sendStatus','json','error','stack','name','status','send','info','index','list','then','express','motion2','catch','show','describe','params','create','body','join','../../files/plugins','script','dirname','start','update'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x41bb,0xc5));var _0xb41b=function(_0x14e58e,_0x2d3499){_0x14e58e=_0x14e58e-0x0;var _0x346d74=_0x41bb[_0x14e58e];return _0x346d74;};'use strict';var _=require(_0xb41b('0x0'));var pm2=require(_0xb41b('0x1'));var logger=require('../../config/logger')(_0xb41b('0x2'));var path=require('path');var exec=require(_0xb41b('0x3'))[_0xb41b('0x4')];var BPromise=require(_0xb41b('0x5'));function handleEntityNotFound(_0x448c8e,_0x4ee21b){return function(_0x12cea3){if(!_0x12cea3){_0x448c8e[_0xb41b('0x6')](0x194);;}return _0x12cea3;};}function respondWithResult(_0x2dbaa3,_0x50bc62){_0x50bc62=_0x50bc62||0xc8;return function(_0x5455ce){if(_0x5455ce){return _0x2dbaa3['status'](_0x50bc62)[_0xb41b('0x7')](_0x5455ce);}return null;};}function handleError(_0x29c30d,_0x53722a){_0x53722a=_0x53722a||0x1f4;return function(_0x13d44e){logger[_0xb41b('0x8')](_0x13d44e[_0xb41b('0x9')]);if(_0x13d44e[_0xb41b('0xa')]){delete _0x13d44e[_0xb41b('0xa')];}_0x29c30d[_0xb41b('0xb')](_0x53722a)[_0xb41b('0xc')](_0x13d44e);};}function execChildProcess(){return new BPromise(function(_0x4baa03,_0x1a9e2c){exec('npm\x20install',function(_0x2e906c,_0xb02d60,_0x1e1c82){logger[_0xb41b('0xd')](_0xb02d60);logger[_0xb41b('0xd')](_0x1e1c82);if(_0x2e906c){logger['error'](_0x2e906c);return _0x1a9e2c(_0x2e906c);}return _0x4baa03(_0xb02d60);});});}exports[_0xb41b('0xe')]=function(_0x2d947a,_0x33d1b5){return pm2[_0xb41b('0xf')]()[_0xb41b('0x10')](function(_0x4e8603){if(_0x4e8603){var _0x4e7f11=_['reject'](_0x4e8603,function(_0x1a09ec){return _0x1a09ec[_0xb41b('0xa')]===_0xb41b('0x11')||_0x1a09ec[_0xb41b('0xa')]===_0xb41b('0x12');});return{'rows':_0x4e7f11,'count':_0x4e7f11['length']};}return null;})[_0xb41b('0x10')](respondWithResult(_0x33d1b5,null))[_0xb41b('0x13')](handleError(_0x33d1b5,null));};exports[_0xb41b('0x14')]=function(_0xcf0728,_0x43f4ea){return pm2[_0xb41b('0x15')](_0xcf0728[_0xb41b('0x16')]['id'])['then'](respondWithResult(_0x43f4ea,null))['then'](handleEntityNotFound(_0x43f4ea,null))['catch'](handleError(_0x43f4ea,null));};exports[_0xb41b('0x17')]=function(_0x503e86,_0x307633){if(_0x503e86[_0xb41b('0x18')][_0xb41b('0xa')]&&_0x503e86['body']['script']){var _0x1a1386=path[_0xb41b('0x19')](__dirname,_0xb41b('0x1a'),_0x503e86[_0xb41b('0x18')][_0xb41b('0x1b')]);var _0x42dccb=process['cwd']();process['chdir'](path[_0xb41b('0x1c')](_0x1a1386));return execChildProcess()[_0xb41b('0x10')](function(_0x871b35){process['chdir'](_0x42dccb);return pm2[_0xb41b('0x1d')]({'name':_0x503e86[_0xb41b('0x18')]['name'],'script':_0x1a1386});})[_0xb41b('0x10')](function(_0x34f908){pm2['dump']();return _0x34f908[0x0];})[_0xb41b('0x10')](respondWithResult(_0x307633,0xc9))['catch'](handleError(_0x307633,null));}else{return _0x307633[_0xb41b('0xb')](0x1f4)[_0xb41b('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xb41b('0x1e')]=function(_0x4265b8,_0x583099){if(_0x4265b8['body']['id']){delete _0x4265b8[_0xb41b('0x18')]['id'];}var _0x46aecf={'online':_0xb41b('0x1f'),'stopped':_0xb41b('0x20')};if(_0x46aecf[_0xb41b('0x21')](_0x4265b8[_0xb41b('0x18')][_0xb41b('0xb')])){return pm2[_0x46aecf[_0x4265b8['body'][_0xb41b('0xb')]]](_0x4265b8[_0xb41b('0x16')]['id'])['then'](respondWithResult(_0x583099,0xc8))[_0xb41b('0x13')](handleError(_0x583099,null));}else{return _0x583099['status'](0x1f4)[_0xb41b('0xc')]({'message':_0xb41b('0x22')});}};exports['destroy']=function(_0x23a6ed,_0x4a95e7){if(_0x23a6ed[_0xb41b('0x18')]['id']){delete _0x23a6ed[_0xb41b('0x18')]['id'];}if(_0x23a6ed['params']['id']){return pm2[_0xb41b('0x23')](_0x23a6ed[_0xb41b('0x16')]['id'])[_0xb41b('0x10')](function(_0x4503cf){pm2[_0xb41b('0x24')]();return _0x4503cf[0x0];})[_0xb41b('0x10')](respondWithResult(_0x4a95e7,null))[_0xb41b('0x13')](handleError(_0x4a95e7,null));}else{return _0x4a95e7[_0xb41b('0xb')](0x1f4)[_0xb41b('0xc')]({'message':_0xb41b('0x25')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 8b036dc..aec4bb6 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 _0x1681=['../../components/auth/service','./realtime.controller','get','/agents','/queues','exports','Router'];(function(_0x1726a4,_0x3c0da5){var _0x116ce4=function(_0x5d71a1){while(--_0x5d71a1){_0x1726a4['push'](_0x1726a4['shift']());}};_0x116ce4(++_0x3c0da5);}(_0x1681,0xdf));var _0x1168=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1681[_0x3dd15e];return _0x231fd0;};'use strict';var express=require('express');var router=express[_0x1168('0x0')]();var auth=require(_0x1168('0x1'));var controller=require(_0x1168('0x2'));router[_0x1168('0x3')](_0x1168('0x4'),auth['isAuthenticated'](),controller['getAgents']);router[_0x1168('0x3')](_0x1168('0x5'),auth['isAuthenticated'](),controller['getQueues']);module[_0x1168('0x6')]=router; \ No newline at end of file +var _0x3295=['isAuthenticated','getAgents','get','/queues','Router','../../components/auth/service','./realtime.controller','/agents'];(function(_0x3d1f69,_0x4e4245){var _0x165d75=function(_0x4bc968){while(--_0x4bc968){_0x3d1f69['push'](_0x3d1f69['shift']());}};_0x165d75(++_0x4e4245);}(_0x3295,0xd4));var _0x5329=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x3295[_0x122096];return _0x3d1966;};'use strict';var express=require('express');var router=express[_0x5329('0x0')]();var auth=require(_0x5329('0x1'));var controller=require(_0x5329('0x2'));router['get'](_0x5329('0x3'),auth[_0x5329('0x4')](),controller[_0x5329('0x5')]);router[_0x5329('0x6')](_0x5329('0x7'),auth[_0x5329('0x4')](),controller['getQueues']);module['exports']=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 37fc328..5cd59c1 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 _0x8478=['set','Content-Range','json','getAgents','getChannels','globalQueueFilter','query','globalStatusFilter','pauseTypeFilter','pause','*pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','length','push','literal','FIELD(id,','Pause','forEach','user','userProfileId','Agents','online','extraQueryConditions','omit','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','merge','voiceStatus','talking','Status','getRealtimeAgentsQueryFields','getQueues','Queue','fields','outbound','dialMethod','voice','Queues','name','assign','catch','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../components/parsers/qs','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','offset','undefined','limit','count'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x8478,0x197));var _0x8847=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8478[_0x4565bf];return _0x5610ba;};'use strict';var _=require(_0x8847('0x0'));var util=require(_0x8847('0x1'));var rta=require(_0x8847('0x2'));var rtq=require(_0x8847('0x3'));var qs=require(_0x8847('0x4'));var utils=require(_0x8847('0x5'));var db=require(_0x8847('0x6'))['db'];var APIBadRequestError=require(_0x8847('0x7'))[_0x8847('0x8')];var APIHandleError=require(_0x8847('0x7'))['handleError'];function respondWithFilteredResult(_0x26b6b6,_0x3022b9){return function(_0x3c0db2){if(_0x3c0db2){var _0xe7e4aa=typeof _0x3022b9[_0x8847('0x9')]===_0x8847('0xa')&&typeof _0x3022b9[_0x8847('0xb')]===_0x8847('0xa');var _0x5978ec=_0x3c0db2[_0x8847('0xc')];var _0x44acab=_0xe7e4aa?0x0:_0x3022b9['offset'];var _0x590b85=_0xe7e4aa?_0x3c0db2[_0x8847('0xc')]:_0x3022b9[_0x8847('0x9')]+_0x3022b9[_0x8847('0xb')];var _0x2368ea;if(_0x590b85>=_0x5978ec){_0x590b85=_0x5978ec;_0x2368ea=0xc8;}else{_0x2368ea=0xce;}_0x26b6b6['status'](_0x2368ea);return _0x26b6b6[_0x8847('0xd')](_0x8847('0xe'),_0x44acab+'-'+_0x590b85+'/'+_0x5978ec)[_0x8847('0xf')](_0x3c0db2);}return null;};}exports[_0x8847('0x10')]=function(_0x54fa74,_0x232617){var _0x3d5c49={'count':0x0,'rows':[]};var _0x41356d={};var _0x8bd5d8;var _0xb8f419=utils[_0x8847('0x11')]();var _0x3406d0;var _0x20c763;var _0x4ad202=_0x54fa74['query'][_0x8847('0x12')];var _0x40b16e=_0x54fa74[_0x8847('0x13')][_0x8847('0x14')];var _0x597c44=_0x54fa74[_0x8847('0x13')][_0x8847('0x15')];var _0x51c5ca=_0x40b16e===_0x8847('0x16')||_0x40b16e===_0x8847('0x17')?!![]:![];var _0x6e8f6d=[];var _0x41d073;var _0x16e3e7;Promise[_0x8847('0x18')]()[_0x8847('0x19')](function(){if(_0x54fa74[_0x8847('0x13')][_0x8847('0x1a')]){if(!utils[_0x8847('0x1b')](_0x54fa74[_0x8847('0x13')]['channel'])){throw new APIBadRequestError(util[_0x8847('0x1c')](_0x8847('0x1d'),_0x54fa74[_0x8847('0x13')][_0x8847('0x1a')]));}_0x8bd5d8=_0x54fa74[_0x8847('0x13')][_0x8847('0x1a')][_0x8847('0x1e')]();}if(!_0x54fa74[_0x8847('0x13')][_0x8847('0x1f')]||!_0x54fa74[_0x8847('0x13')][_0x8847('0x1f')][_0x8847('0x20')](_0x8847('0x21'))){_0x54fa74[_0x8847('0x13')][_0x8847('0x1f')]=rta[_0x8847('0x22')](_0x54fa74['query'][_0x8847('0x1f')]);return;}var _0x44caa0=rta[_0x8847('0x23')](_0x54fa74[_0x8847('0x13')]['sort']);_0x54fa74[_0x8847('0x13')]['sort']=_0x44caa0['fields'][_0x8847('0x24')](',');_0x41d073=_0x44caa0[_0x8847('0x25')];})[_0x8847('0x19')](function(){if(!_0x4ad202){return[];}return rta[_0x8847('0x26')](_0x4ad202,_0x8bd5d8);})[_0x8847('0x19')](function(_0x9151e9){_0x6e8f6d=_0x9151e9;return rta[_0x8847('0x27')]();})[_0x8847('0x19')](function(_0x520e70){_0x20c763=_0x520e70[_0x8847('0x28')];if((!_0x40b16e||_0x51c5ca)&&!_0x41d073){return _0x6e8f6d;}if(_0x41d073&&!_0x40b16e){return rta['getSortedAgentsIdsByStatus'](_0x20c763,_0x6e8f6d,_0x41d073);}else{return rta[_0x8847('0x29')](_0x20c763,_0x6e8f6d,_0x40b16e);}})[_0x8847('0x19')](function(_0xfd7d4c){_0x6e8f6d=_0xfd7d4c;var _0x343cfc=![];if(_0x6e8f6d['length']===0x0){if(_0x4ad202||_0x40b16e){_0x343cfc=!![];}if(_0x51c5ca){_0x343cfc=![];}}if(_0x343cfc){return _0x3d5c49;}var _0x382333=_[_0x8847('0x2a')](db[_0x8847('0x2b')][_0x8847('0x2c')],function(_0x21bc10){return{'name':_0x21bc10[_0x8847('0x2d')],'type':_0x21bc10[_0x8847('0x2e')][_0x8847('0x2f')]};});_0x54fa74[_0x8847('0x13')][_0x8847('0x30')]=_0x8847('0x31');_0x41356d=qs[_0x8847('0x32')](_0x382333,_0x54fa74);_0x41356d[_0x8847('0x33')]=!![];var _0x1eed84=[];if(_0x6e8f6d[_0x8847('0x34')]>0x0){_0x1eed84[_0x8847('0x35')]({'id':{'$in':_0x6e8f6d}});if(_0x41d073&&!_0x40b16e){_0x16e3e7=[db['sequelize'][_0x8847('0x36')](_0x8847('0x37')+_0x6e8f6d+')')];_0x41356d[_0x8847('0x25')]=_0x16e3e7;}}if(_0x51c5ca){_0xb8f419['forEach'](function(_0x1a9764){var _0x28a618=!![];if(_0x40b16e==='*pause'&&_0x8bd5d8!==_0x1a9764){_0x28a618=![];}_0x1eed84[_0x8847('0x35')]({[_0x1a9764+_0x8847('0x38')]:_0x28a618});});if(_0x597c44){_0x1eed84[_0x8847('0x35')]({'pauseType':_0x597c44});}}else if(_0x40b16e){_0xb8f419[_0x8847('0x39')](function(_0x4f336e){_0x1eed84[_0x8847('0x35')]({[_0x4f336e+_0x8847('0x38')]:![]});});}_0x41356d['where']=_['merge'](_0x41356d['where'],{'$and':_0x1eed84});if(_0x54fa74['user'][_0x8847('0x30')]===_0x8847('0x3a')){var _0x4a4316={'params':{'id':_0x54fa74[_0x8847('0x3a')][_0x8847('0x3b')]},'query':{'section':_0x8847('0x3c'),'role':_0x8847('0x31'),'raw':!![],'ids':_0x6e8f6d,'customSorting':_0x16e3e7}};if(_0x54fa74['query']['online']){_0x4a4316[_0x8847('0x13')][_0x8847('0x3d')]=!![];}if(_0x51c5ca){_0x4a4316[_0x8847('0x13')][_0x8847('0x3e')]=_0x1eed84;}_0x4a4316[_0x8847('0x13')]=Object['assign'](_0x4a4316['query'],_[_0x8847('0x3f')](_0x54fa74['query'],'id'));return db[_0x8847('0x40')][_0x8847('0x41')](_0x4a4316);}return db[_0x8847('0x2b')][_0x8847('0x42')](_0x41356d);})[_0x8847('0x19')](function(_0x13f0ea){_0x3d5c49['count']=_0x13f0ea[_0x8847('0xc')];_0x3406d0=_0x13f0ea[_0x8847('0x28')];return _0x3406d0[_0x8847('0x2a')](function(_0x20fa1b){var _0x28ed43=_[_0x8847('0x43')](_0x20c763,['id',_0x20fa1b['id']]);if(_0x28ed43){var _0x58fd2c=rta[_0x8847('0x44')](_0x28ed43);_[_0x8847('0x45')](_0x20fa1b,_0x58fd2c);}_0x20fa1b[_0x8847('0x21')]=rta['getAgentStatus'](_0x20fa1b);if(_0x20fa1b['globalStatus'][_0x8847('0x20')](_0x8847('0x16'))){_0xb8f419['forEach'](function(_0x3279f7){if(_0x20fa1b[_0x3279f7+_0x8847('0x38')]){if(_0x3279f7==='voice'){if(_0x20fa1b[_0x8847('0x46')]!==_0x8847('0x47')){_0x20fa1b[_0x8847('0x46')]=_0x8847('0x16');}}else{_0x20fa1b[_0x3279f7+_0x8847('0x48')]=_0x8847('0x16');}}});}return _0x20fa1b;});})['then'](function(_0x2f66b7){if(!_0x41d073||_0x16e3e7){return _0x2f66b7;}return rta['sortAgentsByStatus'](_0x2f66b7,_0x41d073);})[_0x8847('0x19')](function(_0x1bc310){var _0x49add1=rta[_0x8847('0x49')]();_0x3d5c49[_0x8847('0x28')]=_0x1bc310[_0x8847('0x2a')](function(_0x111b4b){return _['pick'](_0x111b4b,_0x49add1);});return _0x3d5c49;})[_0x8847('0x19')](respondWithFilteredResult(_0x232617,_0x41356d))['catch'](APIHandleError(_0x232617));};exports[_0x8847('0x4a')]=function(_0x234d6b,_0x160ed2){var _0x2c1019={'count':0x0,'rows':[]};var _0x21c216={};var _0x217b87;var _0x74d806;var _0x4549a4;Promise[_0x8847('0x18')]()['then'](function(){if(_0x234d6b[_0x8847('0x13')][_0x8847('0x1a')]){if(!utils['isValidChannel'](_0x234d6b[_0x8847('0x13')]['channel'])){throw new APIBadRequestError(util['format'](_0x8847('0x1d'),_0x234d6b[_0x8847('0x13')][_0x8847('0x1a')]));}_0x217b87=_0x234d6b['query'][_0x8847('0x1a')][_0x8847('0x1e')]();}var _0x1d8c72=_['startCase'](_0x217b87)+_0x8847('0x4b');var _0x4c9f74=_[_0x8847('0x2a')](db[_0x1d8c72][_0x8847('0x2c')],function(_0x2159ba){return{'name':_0x2159ba[_0x8847('0x2d')],'type':_0x2159ba[_0x8847('0x2e')]['key']};});if(!_0x234d6b['query'][_0x8847('0x4c')]){var _0x305e8b=['id','name'];if(_0x217b87==='voice'){_0x305e8b[_0x8847('0x35')](_0x8847('0x2e'));if(_0x234d6b[_0x8847('0x13')][_0x8847('0x2e')]===_0x8847('0x4d')){_0x305e8b[_0x8847('0x35')](['dialActive',_0x8847('0x4e')]);}}_0x234d6b[_0x8847('0x13')]['fields']=_0x305e8b[_0x8847('0x24')](',');}_0x21c216=qs['getOptions'](_0x4c9f74,_0x234d6b);if(_0x234d6b[_0x8847('0x3a')][_0x8847('0x30')]===_0x8847('0x3a')){var _0x26d67a={'params':{'id':_0x234d6b['user']['userProfileId']},'query':{'section':_0x217b87===_0x8847('0x4f')&&_0x234d6b[_0x8847('0x13')][_0x8847('0x2e')]===_0x8847('0x4d')?'QueueCampaigns':_['startCase'](_0x217b87)+_0x8847('0x50'),'type':_0x234d6b[_0x8847('0x13')]['type'],'nolimit':!![],'sort':_0x8847('0x51'),'filter':_0x234d6b[_0x8847('0x13')]['filter']}};_0x26d67a[_0x8847('0x13')]=Object[_0x8847('0x52')](_0x26d67a[_0x8847('0x13')],_0x234d6b['query']);delete _0x26d67a[_0x8847('0x13')]['id'];return db[_0x8847('0x40')][_0x8847('0x41')](_0x26d67a);}return db[_0x1d8c72][_0x8847('0x42')](_0x21c216);})['then'](function(_0x455762){_0x2c1019[_0x8847('0xc')]=_0x455762[_0x8847('0xc')];_0x74d806=_0x455762['rows'];return rtq['getRealtimeQueues'](_0x234d6b,_0x217b87);})[_0x8847('0x19')](function(_0x41dbaf){_0x4549a4=_0x41dbaf[_0x8847('0x28')];return rtq['initializeQueues'](_0x74d806,_0x4549a4,_0x217b87,_0x234d6b['query'][_0x8847('0x2e')]);})[_0x8847('0x19')](function(_0x68c4c9){_0x2c1019['rows']=_0x68c4c9;return _0x2c1019;})[_0x8847('0x19')](respondWithFilteredResult(_0x160ed2,_0x21c216))[_0x8847('0x53')](APIHandleError(_0x160ed2));}; \ No newline at end of file +var _0xcd1f=['filterAgentAttributes','getAgentStatus','voice','voiceStatus','talking','Status','sortAgentsByStatus','getRealtimeAgentsQueryFields','pick','catch','startCase','name','outbound','dialMethod','join','QueueCampaigns','filter','getResources','initializeQueues','lodash','util','../../config/utils','../../mysqldb','../../errors/api','APIBadRequestError','handleError','offset','undefined','limit','count','status','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','pauseTypeFilter','pause','resolve','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','includes','globalStatus','sort','validateSortParameter','getUpdatedSortOptions','fields','order','getAgentIdsByQueues','getRealtimeAgents','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','rawAttributes','fieldName','type','key','role','agent','getOptions','raw','length','literal','FIELD(id,','forEach','*pause','Pause','push','where','merge','user','userProfileId','Agents','online','extraQueryConditions','assign','UserProfile','findAndCountAll'];(function(_0x3c4737,_0x2329ec){var _0x2bb926=function(_0x3b9605){while(--_0x3b9605){_0x3c4737['push'](_0x3c4737['shift']());}};_0x2bb926(++_0x2329ec);}(_0xcd1f,0xbf));var _0xfcd1=function(_0x5ddc2e,_0xe3abfb){_0x5ddc2e=_0x5ddc2e-0x0;var _0x26d8ec=_0xcd1f[_0x5ddc2e];return _0x26d8ec;};'use strict';var _=require(_0xfcd1('0x0'));var util=require(_0xfcd1('0x1'));var rta=require('../../components/realtime/agents');var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0xfcd1('0x2'));var db=require(_0xfcd1('0x3'))['db'];var APIBadRequestError=require(_0xfcd1('0x4'))[_0xfcd1('0x5')];var APIHandleError=require(_0xfcd1('0x4'))[_0xfcd1('0x6')];function respondWithFilteredResult(_0x2be3e6,_0x5cbcae){return function(_0x2b2f95){if(_0x2b2f95){var _0x110120=typeof _0x5cbcae[_0xfcd1('0x7')]===_0xfcd1('0x8')&&typeof _0x5cbcae[_0xfcd1('0x9')]===_0xfcd1('0x8');var _0xb8e566=_0x2b2f95[_0xfcd1('0xa')];var _0x3eedf1=_0x110120?0x0:_0x5cbcae[_0xfcd1('0x7')];var _0x3a9600=_0x110120?_0x2b2f95['count']:_0x5cbcae[_0xfcd1('0x7')]+_0x5cbcae[_0xfcd1('0x9')];var _0x5850b2;if(_0x3a9600>=_0xb8e566){_0x3a9600=_0xb8e566;_0x5850b2=0xc8;}else{_0x5850b2=0xce;}_0x2be3e6[_0xfcd1('0xb')](_0x5850b2);return _0x2be3e6[_0xfcd1('0xc')](_0xfcd1('0xd'),_0x3eedf1+'-'+_0x3a9600+'/'+_0xb8e566)[_0xfcd1('0xe')](_0x2b2f95);}return null;};}exports[_0xfcd1('0xf')]=function(_0x345b22,_0x20c29f){var _0x630c7b={'count':0x0,'rows':[]};var _0x10a332={};var _0x400714;var _0x9dd4ab=utils[_0xfcd1('0x10')]();var _0x3b277d;var _0x143d60;var _0x57951b=_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x12')];var _0x11b2dd=_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x13')];var _0x304755=_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x14')];var _0x5f5c8a=_0x11b2dd===_0xfcd1('0x15')||_0x11b2dd==='*pause'?!![]:![];var _0x2b7ad5=[];var _0x35c87f;var _0x10e6f9;Promise[_0xfcd1('0x16')]()[_0xfcd1('0x17')](function(){if(_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x18')]){if(!utils[_0xfcd1('0x19')](_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x18')])){throw new APIBadRequestError(util[_0xfcd1('0x1a')](_0xfcd1('0x1b'),_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x18')]));}_0x400714=_0x345b22['query'][_0xfcd1('0x18')][_0xfcd1('0x1c')]();}if(!_0x345b22[_0xfcd1('0x11')]['sort']||!_0x345b22[_0xfcd1('0x11')]['sort'][_0xfcd1('0x1d')](_0xfcd1('0x1e'))){_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x1f')]=rta[_0xfcd1('0x20')](_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x1f')]);return;}var _0x2952b4=rta[_0xfcd1('0x21')](_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x1f')]);_0x345b22['query']['sort']=_0x2952b4[_0xfcd1('0x22')]['join'](',');_0x35c87f=_0x2952b4[_0xfcd1('0x23')];})['then'](function(){if(!_0x57951b){return[];}return rta[_0xfcd1('0x24')](_0x57951b,_0x400714);})[_0xfcd1('0x17')](function(_0x2a7853){_0x2b7ad5=_0x2a7853;return rta[_0xfcd1('0x25')]();})['then'](function(_0x2c0533){_0x143d60=_0x2c0533[_0xfcd1('0x26')];if((!_0x11b2dd||_0x5f5c8a)&&!_0x35c87f){return _0x2b7ad5;}if(_0x35c87f&&!_0x11b2dd){return rta[_0xfcd1('0x27')](_0x143d60,_0x2b7ad5,_0x35c87f);}else{return rta[_0xfcd1('0x28')](_0x143d60,_0x2b7ad5,_0x11b2dd);}})[_0xfcd1('0x17')](function(_0x5d785c){_0x2b7ad5=_0x5d785c;var _0x22fb88=![];if(_0x2b7ad5['length']===0x0){if(_0x57951b||_0x11b2dd){_0x22fb88=!![];}if(_0x5f5c8a){_0x22fb88=![];}}if(_0x22fb88){return _0x630c7b;}var _0xfd0f39=_[_0xfcd1('0x29')](db['User'][_0xfcd1('0x2a')],function(_0x1a4e68){return{'name':_0x1a4e68[_0xfcd1('0x2b')],'type':_0x1a4e68[_0xfcd1('0x2c')][_0xfcd1('0x2d')]};});_0x345b22[_0xfcd1('0x11')][_0xfcd1('0x2e')]=_0xfcd1('0x2f');_0x10a332=qs[_0xfcd1('0x30')](_0xfd0f39,_0x345b22);_0x10a332[_0xfcd1('0x31')]=!![];var _0x3d7a44=[];if(_0x2b7ad5[_0xfcd1('0x32')]>0x0){_0x3d7a44['push']({'id':{'$in':_0x2b7ad5}});if(_0x35c87f&&!_0x11b2dd){_0x10e6f9=[db['sequelize'][_0xfcd1('0x33')](_0xfcd1('0x34')+_0x2b7ad5+')')];_0x10a332[_0xfcd1('0x23')]=_0x10e6f9;}}if(_0x5f5c8a){_0x9dd4ab[_0xfcd1('0x35')](function(_0x332a46){var _0x37bcb0=!![];if(_0x11b2dd===_0xfcd1('0x36')&&_0x400714!==_0x332a46){_0x37bcb0=![];}_0x3d7a44['push']({[_0x332a46+_0xfcd1('0x37')]:_0x37bcb0});});if(_0x304755){_0x3d7a44[_0xfcd1('0x38')]({'pauseType':_0x304755});}}else if(_0x11b2dd){_0x9dd4ab[_0xfcd1('0x35')](function(_0x64003){_0x3d7a44[_0xfcd1('0x38')]({[_0x64003+_0xfcd1('0x37')]:![]});});}_0x10a332[_0xfcd1('0x39')]=_[_0xfcd1('0x3a')](_0x10a332[_0xfcd1('0x39')],{'$and':_0x3d7a44});if(_0x345b22[_0xfcd1('0x3b')]['role']===_0xfcd1('0x3b')){var _0x418045={'params':{'id':_0x345b22['user'][_0xfcd1('0x3c')]},'query':{'section':_0xfcd1('0x3d'),'role':_0xfcd1('0x2f'),'raw':!![],'ids':_0x2b7ad5,'customSorting':_0x10e6f9}};if(_0x345b22['query'][_0xfcd1('0x3e')]){_0x418045[_0xfcd1('0x11')][_0xfcd1('0x3e')]=!![];}if(_0x5f5c8a){_0x418045['query'][_0xfcd1('0x3f')]=_0x3d7a44;}_0x418045[_0xfcd1('0x11')]=Object[_0xfcd1('0x40')](_0x418045[_0xfcd1('0x11')],_['omit'](_0x345b22['query'],'id'));return db[_0xfcd1('0x41')]['getResources'](_0x418045);}return db['User'][_0xfcd1('0x42')](_0x10a332);})[_0xfcd1('0x17')](function(_0x3fd63e){_0x630c7b['count']=_0x3fd63e[_0xfcd1('0xa')];_0x3b277d=_0x3fd63e['rows'];return _0x3b277d['map'](function(_0x52cf98){var _0x167989=_['find'](_0x143d60,['id',_0x52cf98['id']]);if(_0x167989){var _0x45674e=rta[_0xfcd1('0x43')](_0x167989);_['merge'](_0x52cf98,_0x45674e);}_0x52cf98['globalStatus']=rta[_0xfcd1('0x44')](_0x52cf98);if(_0x52cf98['globalStatus'][_0xfcd1('0x1d')]('pause')){_0x9dd4ab[_0xfcd1('0x35')](function(_0x2b8922){if(_0x52cf98[_0x2b8922+'Pause']){if(_0x2b8922===_0xfcd1('0x45')){if(_0x52cf98[_0xfcd1('0x46')]!==_0xfcd1('0x47')){_0x52cf98[_0xfcd1('0x46')]=_0xfcd1('0x15');}}else{_0x52cf98[_0x2b8922+_0xfcd1('0x48')]=_0xfcd1('0x15');}}});}return _0x52cf98;});})['then'](function(_0x3c1f96){if(!_0x35c87f||_0x10e6f9){return _0x3c1f96;}return rta[_0xfcd1('0x49')](_0x3c1f96,_0x35c87f);})[_0xfcd1('0x17')](function(_0x2844a1){var _0x4be823=rta[_0xfcd1('0x4a')]();_0x630c7b[_0xfcd1('0x26')]=_0x2844a1[_0xfcd1('0x29')](function(_0x4f288b){return _[_0xfcd1('0x4b')](_0x4f288b,_0x4be823);});return _0x630c7b;})[_0xfcd1('0x17')](respondWithFilteredResult(_0x20c29f,_0x10a332))[_0xfcd1('0x4c')](APIHandleError(_0x20c29f));};exports['getQueues']=function(_0x25b5a6,_0x42ca2a){var _0x47a7c7={'count':0x0,'rows':[]};var _0x767022={};var _0x32b742;var _0x6cf15d;var _0x4fdcad;Promise[_0xfcd1('0x16')]()['then'](function(){if(_0x25b5a6[_0xfcd1('0x11')][_0xfcd1('0x18')]){if(!utils['isValidChannel'](_0x25b5a6[_0xfcd1('0x11')][_0xfcd1('0x18')])){throw new APIBadRequestError(util[_0xfcd1('0x1a')](_0xfcd1('0x1b'),_0x25b5a6[_0xfcd1('0x11')]['channel']));}_0x32b742=_0x25b5a6[_0xfcd1('0x11')][_0xfcd1('0x18')]['toLowerCase']();}var _0x38f4ca=_[_0xfcd1('0x4d')](_0x32b742)+'Queue';var _0x38b257=_[_0xfcd1('0x29')](db[_0x38f4ca][_0xfcd1('0x2a')],function(_0x213df6){return{'name':_0x213df6[_0xfcd1('0x2b')],'type':_0x213df6['type'][_0xfcd1('0x2d')]};});if(!_0x25b5a6[_0xfcd1('0x11')][_0xfcd1('0x22')]){var _0x3dd5fb=['id',_0xfcd1('0x4e')];if(_0x32b742==='voice'){_0x3dd5fb[_0xfcd1('0x38')](_0xfcd1('0x2c'));if(_0x25b5a6[_0xfcd1('0x11')][_0xfcd1('0x2c')]===_0xfcd1('0x4f')){_0x3dd5fb[_0xfcd1('0x38')](['dialActive',_0xfcd1('0x50')]);}}_0x25b5a6['query'][_0xfcd1('0x22')]=_0x3dd5fb[_0xfcd1('0x51')](',');}_0x767022=qs[_0xfcd1('0x30')](_0x38b257,_0x25b5a6);if(_0x25b5a6[_0xfcd1('0x3b')][_0xfcd1('0x2e')]===_0xfcd1('0x3b')){var _0x115fc8={'params':{'id':_0x25b5a6[_0xfcd1('0x3b')][_0xfcd1('0x3c')]},'query':{'section':_0x32b742===_0xfcd1('0x45')&&_0x25b5a6['query'][_0xfcd1('0x2c')]===_0xfcd1('0x4f')?_0xfcd1('0x52'):_['startCase'](_0x32b742)+'Queues','type':_0x25b5a6[_0xfcd1('0x11')]['type'],'nolimit':!![],'sort':_0xfcd1('0x4e'),'filter':_0x25b5a6[_0xfcd1('0x11')][_0xfcd1('0x53')]}};_0x115fc8[_0xfcd1('0x11')]=Object[_0xfcd1('0x40')](_0x115fc8[_0xfcd1('0x11')],_0x25b5a6[_0xfcd1('0x11')]);delete _0x115fc8['query']['id'];return db[_0xfcd1('0x41')][_0xfcd1('0x54')](_0x115fc8);}return db[_0x38f4ca]['findAndCountAll'](_0x767022);})[_0xfcd1('0x17')](function(_0x57acf7){_0x47a7c7[_0xfcd1('0xa')]=_0x57acf7['count'];_0x6cf15d=_0x57acf7[_0xfcd1('0x26')];return rtq['getRealtimeQueues'](_0x25b5a6,_0x32b742);})[_0xfcd1('0x17')](function(_0x14eb6e){_0x4fdcad=_0x14eb6e[_0xfcd1('0x26')];return rtq[_0xfcd1('0x55')](_0x6cf15d,_0x4fdcad,_0x32b742,_0x25b5a6[_0xfcd1('0x11')][_0xfcd1('0x2c')]);})['then'](function(_0x55a644){_0x47a7c7[_0xfcd1('0x26')]=_0x55a644;return _0x47a7c7;})[_0xfcd1('0x17')](respondWithFilteredResult(_0x42ca2a,_0x767022))[_0xfcd1('0x4c')](APIHandleError(_0x42ca2a));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 9908bdb..ef14eb5 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x4de767,_0x1e4e15){var _0x561d85=function(_0x7902ec){while(--_0x7902ec){_0x4de767['push'](_0x4de767['shift']());}};_0x561d85(++_0x1e4e15);}(_0x70e0,0x17b));var _0x070e=function(_0x8e28c6,_0x4f0896){_0x8e28c6=_0x8e28c6-0x0;var _0xc3955e=_0x70e0[_0x8e28c6];return _0xc3955e;};'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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x188159,_0x2932c8){var _0x2403f6=function(_0x3e5691){while(--_0x3e5691){_0x188159['push'](_0x188159['shift']());}};_0x2403f6(++_0x2932c8);}(_0xe706,0xa3));var _0x6e70=function(_0x534af9,_0x1fa0a8){_0x534af9=_0x534af9-0x0;var _0x1a79dd=_0xe706[_0x534af9];return _0x1a79dd;};'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/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index c16f4ee..e0c7da7 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 _0xafdd=['sequelize','exports','INTEGER','STRING','DATE'];(function(_0x2b8077,_0x453634){var _0x308091=function(_0x426df7){while(--_0x426df7){_0x2b8077['push'](_0x2b8077['shift']());}};_0x308091(++_0x453634);}(_0xafdd,0x19a));var _0xdafd=function(_0x54efa9,_0x1d3773){_0x54efa9=_0x54efa9-0x0;var _0x4289e4=_0xafdd[_0x54efa9];return _0x4289e4;};'use strict';var Sequelize=require(_0xdafd('0x0'));module[_0xdafd('0x1')]={'state':{'type':Sequelize[_0xdafd('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xdafd('0x3')]},'scheduledat':{'type':Sequelize[_0xdafd('0x4')]},'uniqueid':{'type':Sequelize[_0xdafd('0x3')]},'starttime':{'type':Sequelize[_0xdafd('0x4')]},'responsetime':{'type':Sequelize[_0xdafd('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xdafd('0x3')]},'campaigntype':{'type':Sequelize[_0xdafd('0x3')]},'membername':{'type':Sequelize[_0xdafd('0x3')]}}; \ No newline at end of file +var _0x5e11=['INTEGER','STRING','DATE','sequelize'];(function(_0x5eddeb,_0x7577ad){var _0x58d4b5=function(_0x3fea64){while(--_0x3fea64){_0x5eddeb['push'](_0x5eddeb['shift']());}};_0x58d4b5(++_0x7577ad);}(_0x5e11,0x1c3));var _0x15e1=function(_0x545bed,_0x221e96){_0x545bed=_0x545bed-0x0;var _0x16c79c=_0x5e11[_0x545bed];return _0x16c79c;};'use strict';var Sequelize=require(_0x15e1('0x0'));module['exports']={'state':{'type':Sequelize[_0x15e1('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x15e1('0x2')]},'scheduledat':{'type':Sequelize[_0x15e1('0x3')]},'uniqueid':{'type':Sequelize[_0x15e1('0x2')]},'starttime':{'type':Sequelize[_0x15e1('0x3')]},'responsetime':{'type':Sequelize[_0x15e1('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x15e1('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x15e1('0x2')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 297b812..777181f 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 _0x6e3b=['lodash','util','../../config/logger','moment','request-promise','../../config/environment','./reportAgentPreview.attributes','ReportAgentPreview'];(function(_0x3616bb,_0x86fe00){var _0x1c0994=function(_0x46a1d4){while(--_0x46a1d4){_0x3616bb['push'](_0x3616bb['shift']());}};_0x1c0994(++_0x86fe00);}(_0x6e3b,0x108));var _0xb6e3=function(_0x5cbcee,_0x94c367){_0x5cbcee=_0x5cbcee-0x0;var _0x51a39a=_0x6e3b[_0x5cbcee];return _0x51a39a;};'use strict';var _=require(_0xb6e3('0x0'));var util=require(_0xb6e3('0x1'));var logger=require(_0xb6e3('0x2'))('api');var moment=require(_0xb6e3('0x3'));var BPromise=require('bluebird');var rp=require(_0xb6e3('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb6e3('0x5'));var attributes=require(_0xb6e3('0x6'));module['exports']=function(_0x2cc859,_0x1e0e7a){return _0x2cc859['define'](_0xb6e3('0x7'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf964=['report_agent_preview','lodash','util','../../config/logger','request-promise','path','rimraf','./reportAgentPreview.attributes','exports','define'];(function(_0x1f6fd5,_0x399cb0){var _0x587d12=function(_0x4d26e8){while(--_0x4d26e8){_0x1f6fd5['push'](_0x1f6fd5['shift']());}};_0x587d12(++_0x399cb0);}(_0xf964,0x1eb));var _0x4f96=function(_0x901c79,_0xe0342e){_0x901c79=_0x901c79-0x0;var _0x39b999=_0xf964[_0x901c79];return _0x39b999;};'use strict';var _=require(_0x4f96('0x0'));var util=require(_0x4f96('0x1'));var logger=require(_0x4f96('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4f96('0x3'));var fs=require('fs');var path=require(_0x4f96('0x4'));var rimraf=require(_0x4f96('0x5'));var config=require('../../config/environment');var attributes=require(_0x4f96('0x6'));module[_0x4f96('0x7')]=function(_0x39cd27,_0x367cfd){return _0x39cd27[_0x4f96('0x8')]('ReportAgentPreview',attributes,{'tableName':_0x4f96('0x9'),'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 690d66d..91030f1 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 _0xbdcd=['error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','lodash','util','moment','bluebird','randomstring','rpc','../../config/environment','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xcc44c6,_0x4471c2){var _0x26c192=function(_0x25e00d){while(--_0x25e00d){_0xcc44c6['push'](_0xcc44c6['shift']());}};_0x26c192(++_0x4471c2);}(_0xbdcd,0xfe));var _0xdbdc=function(_0x337651,_0x2af690){_0x337651=_0x337651-0x0;var _0x20893c=_0xbdcd[_0x337651];return _0x20893c;};'use strict';var _=require(_0xdbdc('0x0'));var util=require(_0xdbdc('0x1'));var moment=require(_0xdbdc('0x2'));var BPromise=require(_0xdbdc('0x3'));var rs=require(_0xdbdc('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdbdc('0x5'));var config=require(_0xdbdc('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xdbdc('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x253ebe,_0x20b24c,_0x588f88){return new BPromise(function(_0x55f7af,_0xd42874){return client[_0xdbdc('0x8')](_0x253ebe,_0x588f88)[_0xdbdc('0x9')](function(_0x25eca3){logger[_0xdbdc('0xa')](_0xdbdc('0xb'),_0x20b24c,_0xdbdc('0xc'));logger[_0xdbdc('0xd')](_0xdbdc('0xe'),_0x20b24c,_0xdbdc('0xc'),JSON[_0xdbdc('0xf')](_0x25eca3));if(_0x25eca3[_0xdbdc('0x10')]){if(_0x25eca3[_0xdbdc('0x10')][_0xdbdc('0x11')]===0x1f4){logger[_0xdbdc('0x10')](_0xdbdc('0xb'),_0x20b24c,_0x25eca3[_0xdbdc('0x10')][_0xdbdc('0x12')]);return _0xd42874(_0x25eca3[_0xdbdc('0x10')][_0xdbdc('0x12')]);}logger[_0xdbdc('0x10')]('ReportAgentPreview,\x20%s,\x20%s',_0x20b24c,_0x25eca3[_0xdbdc('0x10')][_0xdbdc('0x12')]);return _0x55f7af(_0x25eca3[_0xdbdc('0x10')][_0xdbdc('0x12')]);}else{logger[_0xdbdc('0xa')](_0xdbdc('0xb'),_0x20b24c,_0xdbdc('0xc'));_0x55f7af(_0x25eca3[_0xdbdc('0x13')]['message']);}})[_0xdbdc('0x14')](function(_0x38b3be){logger[_0xdbdc('0x10')](_0xdbdc('0xb'),_0x20b24c,_0x38b3be);_0xd42874(_0x38b3be);});});}exports[_0xdbdc('0x15')]=function(_0x37f86a){var _0x185275=this;return new Promise(function(_0x4a8be9,_0x2302d2){return db[_0xdbdc('0x16')][_0xdbdc('0x17')](_0x37f86a[_0xdbdc('0x18')],{'raw':_0x37f86a['options']?_0x37f86a[_0xdbdc('0x19')][_0xdbdc('0x1a')]===undefined?!![]:![]:!![]})[_0xdbdc('0x9')](function(_0x58a91e){logger['info'](_0xdbdc('0x15'),_0x37f86a);logger[_0xdbdc('0xd')](_0xdbdc('0x15'),_0x37f86a,JSON[_0xdbdc('0xf')](_0x58a91e));_0x4a8be9(_0x58a91e);})[_0xdbdc('0x14')](function(_0x270802){logger[_0xdbdc('0x10')]('CreateReportAgentPreview',_0x270802['message'],_0x37f86a);_0x2302d2(_0x185275['error'](0x1f4,_0x270802[_0xdbdc('0x12')]));});});}; \ No newline at end of file +var _0x31a0=['request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','client'];(function(_0x912d27,_0x28e0e3){var _0x31b918=function(_0x1882f7){while(--_0x1882f7){_0x912d27['push'](_0x912d27['shift']());}};_0x31b918(++_0x28e0e3);}(_0x31a0,0x1a9));var _0x031a=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x31a0[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require('lodash');var util=require(_0x031a('0x0'));var moment=require(_0x031a('0x1'));var BPromise=require(_0x031a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x031a('0x3'));var db=require(_0x031a('0x4'))['db'];var utils=require(_0x031a('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x031a('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x286eb5,_0x2685bd,_0x318431){return new BPromise(function(_0x4198d0,_0x1dad34){return client[_0x031a('0x7')](_0x286eb5,_0x318431)[_0x031a('0x8')](function(_0x1c2655){logger['info'](_0x031a('0x9'),_0x2685bd,_0x031a('0xa'));logger[_0x031a('0xb')](_0x031a('0xc'),_0x2685bd,_0x031a('0xa'),JSON[_0x031a('0xd')](_0x1c2655));if(_0x1c2655[_0x031a('0xe')]){if(_0x1c2655[_0x031a('0xe')][_0x031a('0xf')]===0x1f4){logger[_0x031a('0xe')](_0x031a('0x9'),_0x2685bd,_0x1c2655[_0x031a('0xe')]['message']);return _0x1dad34(_0x1c2655[_0x031a('0xe')]['message']);}logger[_0x031a('0xe')](_0x031a('0x9'),_0x2685bd,_0x1c2655[_0x031a('0xe')]['message']);return _0x4198d0(_0x1c2655[_0x031a('0xe')][_0x031a('0x10')]);}else{logger[_0x031a('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x2685bd,_0x031a('0xa'));_0x4198d0(_0x1c2655['result']['message']);}})[_0x031a('0x12')](function(_0xa7ac89){logger[_0x031a('0xe')](_0x031a('0x9'),_0x2685bd,_0xa7ac89);_0x1dad34(_0xa7ac89);});});}exports[_0x031a('0x13')]=function(_0x2e5bb8){var _0x234d90=this;return new Promise(function(_0x53157c,_0x5bcbea){return db[_0x031a('0x14')]['create'](_0x2e5bb8[_0x031a('0x15')],{'raw':_0x2e5bb8[_0x031a('0x16')]?_0x2e5bb8[_0x031a('0x16')][_0x031a('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0xd07d51){logger['info']('CreateReportAgentPreview',_0x2e5bb8);logger['debug'](_0x031a('0x13'),_0x2e5bb8,JSON[_0x031a('0xd')](_0xd07d51));_0x53157c(_0xd07d51);})['catch'](function(_0x249db8){logger[_0x031a('0xe')]('CreateReportAgentPreview',_0x249db8['message'],_0x2e5bb8);_0x5bcbea(_0x234d90[_0x031a('0xe')](0x1f4,_0x249db8[_0x031a('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 57bb77e..7c4b059 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 _0xceab=['mailQueues','/mail/accounts','mailAccounts','openchannelQueues','smsQueues','/whatsapp/queues','whatsappQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','outbound','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','/mail/queues/:id/notify','mail','/mail/queues/:id','showMailQueues','post','/chat/queues/:id/notify','queueNotify','chat','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/openchannel/queues/:id/notify','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','showWhatsappQueues','/agents/:id/notify','agentNotify','exports','multer','util','path','express','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues'];(function(_0x5e158b,_0x1811d5){var _0x2e0db5=function(_0x381185){while(--_0x381185){_0x5e158b['push'](_0x5e158b['shift']());}};_0x2e0db5(++_0x1811d5);}(_0xceab,0x93));var _0xbcea=function(_0x309ca2,_0x49e93c){_0x309ca2=_0x309ca2-0x0;var _0x12ad59=_0xceab[_0x309ca2];return _0x12ad59;};'use strict';var multer=require(_0xbcea('0x0'));var util=require(_0xbcea('0x1'));var path=require(_0xbcea('0x2'));var express=require(_0xbcea('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xbcea('0x4'));router[_0xbcea('0x5')](_0xbcea('0x6'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x8')]);router[_0xbcea('0x5')](_0xbcea('0x9'),auth[_0xbcea('0x7')](),controller['voiceChannelMixMonitor']);router[_0xbcea('0x5')](_0xbcea('0xa'),auth[_0xbcea('0x7')](),controller[_0xbcea('0xb')]);router['get'](_0xbcea('0xc'),auth[_0xbcea('0x7')](),controller[_0xbcea('0xd')]);router[_0xbcea('0x5')](_0xbcea('0xe'),auth[_0xbcea('0x7')](),controller[_0xbcea('0xf')]);router[_0xbcea('0x5')](_0xbcea('0x10'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x11')]);router['get'](_0xbcea('0x12'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x13')]);router[_0xbcea('0x5')]('/openchannel/queues',auth[_0xbcea('0x7')](),controller[_0xbcea('0x14')]);router[_0xbcea('0x5')]('/sms/queues',auth[_0xbcea('0x7')](),controller[_0xbcea('0x15')]);router['get'](_0xbcea('0x16'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x17')]);router['get']('/fax/queues',auth[_0xbcea('0x7')](),controller[_0xbcea('0x18')]);router[_0xbcea('0x5')](_0xbcea('0x19'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x1a')]);router[_0xbcea('0x5')](_0xbcea('0x1b'),auth['isAuthenticated'](),controller['voiceQueuesChannels']);router[_0xbcea('0x5')](_0xbcea('0x1c'),auth['isAuthenticated'](),controller['voiceQueuesChannel']);router[_0xbcea('0x5')](_0xbcea('0x1d'),auth['isAuthenticated'](),controller[_0xbcea('0x1e')]);router['get'](_0xbcea('0x1f'),auth[_0xbcea('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0xbcea('0x5')](_0xbcea('0x20'),auth['isAuthenticated'](),controller[_0xbcea('0x21')]);router[_0xbcea('0x22')]('/voice/queues/:id',auth[_0xbcea('0x7')](),controller[_0xbcea('0x23')]);router[_0xbcea('0x5')]('/outbound',auth[_0xbcea('0x7')](),controller[_0xbcea('0x24')]);router[_0xbcea('0x5')]('/outbound/channels',auth[_0xbcea('0x7')](),controller[_0xbcea('0x25')]);router[_0xbcea('0x5')](_0xbcea('0x26'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x27')]);router[_0xbcea('0x22')](_0xbcea('0x28'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x29')]);router[_0xbcea('0x5')](_0xbcea('0x2a'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x2b')]);router[_0xbcea('0x5')](_0xbcea('0x2c'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x2d')]);router['get'](_0xbcea('0x2e'),auth['isAuthenticated'](),controller['campaigns']);router[_0xbcea('0x5')]('/fax/accounts',auth[_0xbcea('0x7')](),controller[_0xbcea('0x2f')]);router[_0xbcea('0x5')](_0xbcea('0x30'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x31')]);router[_0xbcea('0x5')](_0xbcea('0x32'),auth[_0xbcea('0x7')](),controller['mailQueuesWaitingInteractions']);router['get'](_0xbcea('0x33'),auth[_0xbcea('0x7')](),controller['openchannelQueuesWaitingInteractions']);router[_0xbcea('0x5')]('/openchannel/queues/:id/waitinginteractions',auth[_0xbcea('0x7')](),controller[_0xbcea('0x34')]);router[_0xbcea('0x5')](_0xbcea('0x35'),auth['isAuthenticated'](),controller[_0xbcea('0x36')]);router['get'](_0xbcea('0x37'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x38')]);router['get'](_0xbcea('0x39'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x3a')]);router['post'](_0xbcea('0x3b'),auth[_0xbcea('0x7')](),controller['queueNotify'](_0xbcea('0x3c')));router['get'](_0xbcea('0x3d'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x3e')]);router[_0xbcea('0x3f')](_0xbcea('0x40'),auth['isAuthenticated'](),controller[_0xbcea('0x41')](_0xbcea('0x42')));router['get'](_0xbcea('0x43'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x44')]);router[_0xbcea('0x3f')](_0xbcea('0x45'),auth[_0xbcea('0x7')](),controller['queueNotify'](_0xbcea('0x46')));router[_0xbcea('0x5')]('/fax/queues/:id',auth[_0xbcea('0x7')](),controller['showFaxQueues']);router['post'](_0xbcea('0x47'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x41')](_0xbcea('0x48')));router[_0xbcea('0x5')]('/openchannel/queues/:id',auth[_0xbcea('0x7')](),controller[_0xbcea('0x49')]);router[_0xbcea('0x3f')](_0xbcea('0x4a'),auth['isAuthenticated'](),controller[_0xbcea('0x41')](_0xbcea('0x4b')));router[_0xbcea('0x3f')](_0xbcea('0x4c'),auth[_0xbcea('0x7')](),controller[_0xbcea('0x41')]('whatsapp'));router['get']('/sms/queues/:id',auth['isAuthenticated'](),controller[_0xbcea('0x4d')]);router[_0xbcea('0x5')]('/whatsapp/queues/:id',auth[_0xbcea('0x7')](),controller[_0xbcea('0x4e')]);router[_0xbcea('0x3f')](_0xbcea('0x4f'),auth['isAuthenticated'](),controller[_0xbcea('0x50')]);module[_0xbcea('0x51')]=router; \ No newline at end of file +var _0x5543=['/mail/accounts','mailAccounts','openchannelQueues','/sms/queues','whatsappQueues','/fax/queues','/voice/queues/channels','voiceQueuesChannels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/agents','agents','agentCapacity','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','mail','/mail/queues/:id','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','mailQueues'];(function(_0xc209c2,_0x32a214){var _0x148dc1=function(_0x2db2d1){while(--_0x2db2d1){_0xc209c2['push'](_0xc209c2['shift']());}};_0x148dc1(++_0x32a214);}(_0x5543,0x1bb));var _0x3554=function(_0x2ff238,_0x1811d2){_0x2ff238=_0x2ff238-0x0;var _0x204a56=_0x5543[_0x2ff238];return _0x204a56;};'use strict';var multer=require(_0x3554('0x0'));var util=require(_0x3554('0x1'));var path=require(_0x3554('0x2'));var express=require(_0x3554('0x3'));var router=express[_0x3554('0x4')]();var auth=require(_0x3554('0x5'));var controller=require(_0x3554('0x6'));router[_0x3554('0x7')]('/voice/channels',auth[_0x3554('0x8')](),controller[_0x3554('0x9')]);router[_0x3554('0x7')](_0x3554('0xa'),auth[_0x3554('0x8')](),controller[_0x3554('0xb')]);router[_0x3554('0x7')](_0x3554('0xc'),auth[_0x3554('0x8')](),controller[_0x3554('0xd')]);router[_0x3554('0x7')](_0x3554('0xe'),auth[_0x3554('0x8')](),controller[_0x3554('0xf')]);router[_0x3554('0x7')](_0x3554('0x10'),auth['isAuthenticated'](),controller[_0x3554('0x11')]);router[_0x3554('0x7')]('/mail/queues',auth[_0x3554('0x8')](),controller[_0x3554('0x12')]);router[_0x3554('0x7')](_0x3554('0x13'),auth[_0x3554('0x8')](),controller[_0x3554('0x14')]);router[_0x3554('0x7')]('/openchannel/queues',auth[_0x3554('0x8')](),controller[_0x3554('0x15')]);router[_0x3554('0x7')](_0x3554('0x16'),auth[_0x3554('0x8')](),controller['smsQueues']);router[_0x3554('0x7')]('/whatsapp/queues',auth[_0x3554('0x8')](),controller[_0x3554('0x17')]);router['get'](_0x3554('0x18'),auth[_0x3554('0x8')](),controller['faxQueues']);router[_0x3554('0x7')]('/voice/queues/preview/:id',auth['isAuthenticated'](),controller['voiceQueuesPreview']);router['get'](_0x3554('0x19'),auth[_0x3554('0x8')](),controller[_0x3554('0x1a')]);router[_0x3554('0x7')]('/voice/queues/channels/:uniqueid',auth[_0x3554('0x8')](),controller[_0x3554('0x1b')]);router[_0x3554('0x7')](_0x3554('0x1c'),auth[_0x3554('0x8')](),controller['voiceQueuesChannelHangup']);router[_0x3554('0x7')](_0x3554('0x1d'),auth[_0x3554('0x8')](),controller[_0x3554('0x1e')]);router['get'](_0x3554('0x1f'),auth[_0x3554('0x8')](),controller['showVoiceQueues']);router[_0x3554('0x20')](_0x3554('0x1f'),auth[_0x3554('0x8')](),controller[_0x3554('0x21')]);router[_0x3554('0x7')](_0x3554('0x22'),auth[_0x3554('0x8')](),controller[_0x3554('0x23')]);router[_0x3554('0x7')]('/outbound/channels',auth[_0x3554('0x8')](),controller['outboundChannels']);router['get'](_0x3554('0x24'),auth[_0x3554('0x8')](),controller[_0x3554('0x25')]);router[_0x3554('0x20')]('/agents/:id/capacity',auth[_0x3554('0x8')](),controller[_0x3554('0x26')]);router[_0x3554('0x7')]('/telephones',auth[_0x3554('0x8')](),controller['telephones']);router[_0x3554('0x7')](_0x3554('0x27'),auth['isAuthenticated'](),controller[_0x3554('0x28')]);router['get'](_0x3554('0x29'),auth[_0x3554('0x8')](),controller[_0x3554('0x2a')]);router[_0x3554('0x7')]('/fax/accounts',auth[_0x3554('0x8')](),controller[_0x3554('0x2b')]);router[_0x3554('0x7')](_0x3554('0x2c'),auth[_0x3554('0x8')](),controller['chatQueuesWaitingInteractions']);router[_0x3554('0x7')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x3554('0x2d')]);router['get']('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x3554('0x2e')]);router[_0x3554('0x7')](_0x3554('0x2f'),auth[_0x3554('0x8')](),controller['openchannelQueuesIdWaitingInteractions']);router['get'](_0x3554('0x30'),auth[_0x3554('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0x3554('0x7')](_0x3554('0x31'),auth[_0x3554('0x8')](),controller[_0x3554('0x32')]);router[_0x3554('0x7')](_0x3554('0x33'),auth[_0x3554('0x8')](),controller[_0x3554('0x34')]);router[_0x3554('0x35')]('/mail/queues/:id/notify',auth[_0x3554('0x8')](),controller[_0x3554('0x36')](_0x3554('0x37')));router[_0x3554('0x7')](_0x3554('0x38'),auth[_0x3554('0x8')](),controller['showMailQueues']);router[_0x3554('0x35')](_0x3554('0x39'),auth[_0x3554('0x8')](),controller[_0x3554('0x36')]('chat'));router[_0x3554('0x7')](_0x3554('0x3a'),auth[_0x3554('0x8')](),controller[_0x3554('0x3b')]);router[_0x3554('0x35')](_0x3554('0x3c'),auth[_0x3554('0x8')](),controller[_0x3554('0x36')](_0x3554('0x3d')));router['get'](_0x3554('0x3e'),auth[_0x3554('0x8')](),controller[_0x3554('0x3f')]);router[_0x3554('0x35')](_0x3554('0x40'),auth[_0x3554('0x8')](),controller[_0x3554('0x36')](_0x3554('0x41')));router[_0x3554('0x7')](_0x3554('0x42'),auth[_0x3554('0x8')](),controller[_0x3554('0x43')]);router[_0x3554('0x35')](_0x3554('0x44'),auth[_0x3554('0x8')](),controller[_0x3554('0x36')](_0x3554('0x45')));router[_0x3554('0x35')](_0x3554('0x46'),auth['isAuthenticated'](),controller[_0x3554('0x36')]('whatsapp'));router['get'](_0x3554('0x47'),auth[_0x3554('0x8')](),controller[_0x3554('0x48')]);router['get'](_0x3554('0x49'),auth[_0x3554('0x8')](),controller['showWhatsappQueues']);router[_0x3554('0x35')](_0x3554('0x4a'),auth[_0x3554('0x8')](),controller[_0x3554('0x4b')]);module[_0x3554('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 e5b247e..b4df54a 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 _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x79c0de,_0x4cd77d){var _0x3d3f03=function(_0x325bba){while(--_0x325bba){_0x79c0de['push'](_0x79c0de['shift']());}};_0x3d3f03(++_0x4cd77d);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file +var _0xd8b0=['showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','FaxAccounts','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','type','map','queue_id','uniq','value','filter','indexOf','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','\x20Message\x20not\x20found','update','MessageId','InteractionId','From','QueueId','TransferReport','queueTransferTimeout','*,*,*,*','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','chat','agent','Message','create','Start','agentTransferTimeout','bluebird','moment','../../config/logger','api','jayson/promise','client','http','request','then','error','code','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','showVoiceQueues','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','findAll','user','length','format','updateAttributes','MemberReport','findOrCreate','INTERACTION','interface','SIP/%s','internal','capacity','campaigns','showChatQueues','ChatQueues','MailQueues','showMailQueues','mailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues'];(function(_0x20a9a3,_0x5436b5){var _0x278441=function(_0x3d1eac){while(--_0x3d1eac){_0x20a9a3['push'](_0x20a9a3['shift']());}};_0x278441(++_0x5436b5);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var BPromise=require(_0x0d8b('0x0'));var moment=require(_0x0d8b('0x1'));var _=require('lodash');var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x0d8b('0x2'))(_0x0d8b('0x3'));var jayson=require(_0x0d8b('0x4'));var amiClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0x0d8b('0x5')][_0x0d8b('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){var _0x129310=_0x413284?_0x413284:amiClient;return _0x129310[_0x0d8b('0x7')](_0x39f43a,_0x4a4470)[_0x0d8b('0x8')](function(_0x1f4800){if(_0x1f4800[_0x0d8b('0x9')]){if(_0x1f4800[_0x0d8b('0x9')][_0x0d8b('0xa')]===0x1f4){return _0x58e4e2(_0x1f4800[_0x0d8b('0x9')]['message']);}return _0x284169(_0x1f4800[_0x0d8b('0x9')]['message']);}else{_0x284169(_0x1f4800[_0x0d8b('0xb')]);}})[_0x0d8b('0xc')](function(_0x340cc4){_0x58e4e2(_0x340cc4);});});}function respondWithResult(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xc8;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0xe')](_0x32bb1a);}return _0x92cdd8[_0x0d8b('0xf')](0x194);};}function handleError(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0x1f4;return function(_0xe65334){logger[_0x0d8b('0x9')](_0xe65334[_0x0d8b('0x10')]);if(_0xe65334['name']){delete _0xe65334[_0x0d8b('0x11')];}_0x2ce75e[_0x0d8b('0xd')](_0x5ad086)[_0x0d8b('0x12')](_0xe65334);};}function findById(_0xe2e167){return function(_0x2cb03c){if(!_['isNil'](_0xe2e167)&&!_[_0x0d8b('0x13')](_0x2cb03c)&&!_[_0x0d8b('0x13')](_0x2cb03c[_0x0d8b('0x14')])){return _[_0x0d8b('0x15')](_0x2cb03c[_0x0d8b('0x14')],function(_0x18dd2d){return _0x18dd2d['id']==_0xe2e167;});}return null;};}exports[_0x0d8b('0x16')]=function(_0xa3612a,_0x4a15bf){return respondWithRpcPromise(_0x0d8b('0x17'),_0xa3612a[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4a15bf,null))[_0x0d8b('0xc')](handleError(_0x4a15bf,null));};exports[_0x0d8b('0x19')]=function(_0x5b709c,_0x393beb){return respondWithRpcPromise(_0x0d8b('0x1a'),_['merge'](_0x5b709c['query'],_0x5b709c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x393beb,null))['catch'](handleError(_0x393beb,null));};exports['voiceChannelStopMixMonitor']=function(_0x238728,_0x2b924f){return respondWithRpcPromise(_0x0d8b('0x1c'),_[_0x0d8b('0x1d')](_0x238728[_0x0d8b('0x18')],_0x238728[_0x0d8b('0x1b')]))[_0x0d8b('0x8')](respondWithResult(_0x2b924f,null))[_0x0d8b('0xc')](handleError(_0x2b924f,null));};exports[_0x0d8b('0x1e')]=function(_0x5e5bc3,_0xe8bbee){return respondWithRpcPromise(_0x0d8b('0x1f'),_0x5e5bc3['query'])[_0x0d8b('0x8')](respondWithResult(_0xe8bbee,null))['catch'](handleError(_0xe8bbee,null));};exports[_0x0d8b('0x20')]=function(_0x234bdd,_0xa2af02){return respondWithRpcPromise('VoiceQueues',_0x234bdd['query'])[_0x0d8b('0x8')](findById(_0x234bdd[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0xa2af02,null))[_0x0d8b('0xc')](handleError(_0xa2af02,null));};exports['updateVoiceQueue']=function(_0x1b2b59,_0x4b59e5){return respondWithRpcPromise(_0x0d8b('0x21'),_['merge'](_0x1b2b59[_0x0d8b('0x22')],_0x1b2b59['params']))[_0x0d8b('0x8')](respondWithResult(_0x4b59e5,null))['catch'](handleError(_0x4b59e5,null));};exports[_0x0d8b('0x23')]=function(_0x106e4c,_0x2c058d){return respondWithRpcPromise('VoiceQueuesPreview',_['merge'](_0x106e4c['query'],_0x106e4c[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x2c058d,null))[_0x0d8b('0xc')](handleError(_0x2c058d,null));};exports['voiceQueuesChannels']=function(_0x5d05fc,_0x36017a){return respondWithRpcPromise(_0x0d8b('0x24'),_0x5d05fc[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x36017a,null))[_0x0d8b('0xc')](handleError(_0x36017a,null));};exports[_0x0d8b('0x25')]=function(_0x4a99d3,_0x6f93c7){return respondWithRpcPromise('VoiceQueuesChannel',_[_0x0d8b('0x1d')](_0x4a99d3[_0x0d8b('0x18')],_0x4a99d3['params']))[_0x0d8b('0x8')](respondWithResult(_0x6f93c7,null))[_0x0d8b('0xc')](handleError(_0x6f93c7,null));};exports[_0x0d8b('0x26')]=function(_0x4f2ed2,_0x113318){return respondWithRpcPromise(_0x0d8b('0x27'),_[_0x0d8b('0x1d')](_0x4f2ed2[_0x0d8b('0x18')],_0x4f2ed2[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x113318,null))[_0x0d8b('0xc')](handleError(_0x113318,null));};exports[_0x0d8b('0x28')]=function(_0x5ad0fe,_0x1180ac){return respondWithRpcPromise(_0x0d8b('0x29'),_[_0x0d8b('0x1d')](_0x5ad0fe[_0x0d8b('0x18')],_0x5ad0fe[_0x0d8b('0x1b')]))['then'](respondWithResult(_0x1180ac,null))['catch'](handleError(_0x1180ac,null));};exports[_0x0d8b('0x2a')]=function(_0x5c2c04,_0x531c55){return respondWithRpcPromise(_0x0d8b('0x2b'),_0x5c2c04[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x531c55,null))[_0x0d8b('0xc')](handleError(_0x531c55,null));};exports[_0x0d8b('0x2c')]=function(_0x24c789,_0x579324){return respondWithRpcPromise(_0x0d8b('0x2d'),_0x24c789[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x579324,null))[_0x0d8b('0xc')](handleError(_0x579324,null));};exports[_0x0d8b('0x2e')]=function(_0x1a39ad,_0xf1680e){var _0x5c980b;return respondWithRpcPromise(_0x0d8b('0x2f'),_0x1a39ad[_0x0d8b('0x18')])[_0x0d8b('0x8')](function(_0x1f196d){_0x5c980b=_0x1f196d;return respondWithRpcPromise('Agents',_0x1a39ad[_0x0d8b('0x18')],routingClient);})['then'](function(_0x37b26c){return _[_0x0d8b('0x1d')]({},_0x37b26c,_0x5c980b);})[_0x0d8b('0x8')](respondWithResult(_0xf1680e,null))[_0x0d8b('0xc')](handleError(_0xf1680e,null));};exports[_0x0d8b('0x30')]=function(_0x3e632e,_0x1ff17d){if(_0x3e632e[_0x0d8b('0x22')]&&_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]&&_0x3e632e['user']&&_0x3e632e['user']['name']){for(var _0x4d0811 in _0x3e632e['body'][_0x0d8b('0x31')]){if(_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')]['hasOwnProperty'](_0x4d0811)){db['MemberReport'][_0x0d8b('0x32')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811]&&_0x3e632e['body']['interaction'][_0x4d0811][_0x0d8b('0x34')]?{'$notIn':_0x3e632e['body'][_0x0d8b('0x31')][_0x4d0811]}:{'$ne':null}}})['then'](function(_0x53f643){var _0x30ccee=moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0x5ebe8a=0x0,_0x59b8e9=_0x53f643['length'];_0x5ebe8a<_0x59b8e9;_0x5ebe8a+=0x1){_0x53f643[_0x5ebe8a][_0x0d8b('0x36')]({'exitAt':_0x30ccee});}});for(var _0x1e0498=0x0;_0x1e0498<_0x3e632e[_0x0d8b('0x22')]['interaction'][_0x4d0811][_0x0d8b('0x34')];_0x1e0498+=0x1){db[_0x0d8b('0x37')][_0x0d8b('0x38')]({'where':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'type':_0x0d8b('0x39'),'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498],'exitAt':null},'defaults':{'channel':_0x4d0811,'membername':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')],'interface':_[_0x0d8b('0x13')](_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')])?util[_0x0d8b('0x35')](_0x0d8b('0x3b'),_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x11')]):_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3a')],'type':'INTERACTION','enterAt':moment()[_0x0d8b('0x35')]('YYYY-MM-DD\x20HH:mm:ss'),'role':'agent','internal':_0x3e632e[_0x0d8b('0x33')][_0x0d8b('0x3c')],'uniqueid':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x31')][_0x4d0811][_0x1e0498]}});}}}}return respondWithRpcPromise('AgentCapacity',{'id':_0x3e632e[_0x0d8b('0x1b')]['id'],'capacity':_0x3e632e[_0x0d8b('0x22')][_0x0d8b('0x3d')]},routingClient)[_0x0d8b('0x8')](respondWithResult(_0x1ff17d,null))[_0x0d8b('0xc')](handleError(_0x1ff17d,null));};exports['telephones']=function(_0x5c0824,_0x4e4d5f){return respondWithRpcPromise('Telephones',_0x5c0824[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x4e4d5f,null))['catch'](handleError(_0x4e4d5f,null));};exports['trunks']=function(_0x44c5c1,_0x3d3cb6){return respondWithRpcPromise('Trunks',_0x44c5c1['query'])[_0x0d8b('0x8')](respondWithResult(_0x3d3cb6,null))[_0x0d8b('0xc')](handleError(_0x3d3cb6,null));};exports[_0x0d8b('0x3e')]=function(_0x346c0d,_0x2d5519){return respondWithRpcPromise('Campaigns',_0x346c0d[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x2d5519,null))['catch'](handleError(_0x2d5519,null));};exports['chatQueues']=function(_0xf6a773,_0x3f2d95){return respondWithRpcPromise('ChatQueues',_0xf6a773['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f2d95,null))[_0x0d8b('0xc')](handleError(_0x3f2d95,null));};exports[_0x0d8b('0x3f')]=function(_0xb58818,_0x4a2989){return respondWithRpcPromise(_0x0d8b('0x40'),_0xb58818['query'],routingClient)['then'](findById(_0xb58818[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x4a2989,null))['catch'](handleError(_0x4a2989,null));};exports['mailQueues']=function(_0x44ed23,_0x3d7161){return respondWithRpcPromise(_0x0d8b('0x41'),_0x44ed23[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3d7161,null))[_0x0d8b('0xc')](handleError(_0x3d7161,null));};exports[_0x0d8b('0x42')]=function(_0x3bead7,_0x5418d8){return respondWithRpcPromise(_0x0d8b('0x41'),_0x3bead7[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x3bead7[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x5418d8,null))[_0x0d8b('0xc')](handleError(_0x5418d8,null));};exports[_0x0d8b('0x43')]=function(_0x1c78b6,_0x375684){return respondWithRpcPromise('MailAccounts',_0x1c78b6[_0x0d8b('0x18')],mailClient)[_0x0d8b('0x8')](respondWithResult(_0x375684,null))[_0x0d8b('0xc')](handleError(_0x375684,null));};exports[_0x0d8b('0x44')]=function(_0x43ad22,_0x577951){return respondWithRpcPromise(_0x0d8b('0x45'),_0x43ad22[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x577951,null))[_0x0d8b('0xc')](handleError(_0x577951,null));};exports[_0x0d8b('0x46')]=function(_0x59ada2,_0x4d0e7c){return respondWithRpcPromise(_0x0d8b('0x45'),_0x59ada2[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x59ada2[_0x0d8b('0x1b')]['id']))['then'](respondWithResult(_0x4d0e7c,null))[_0x0d8b('0xc')](handleError(_0x4d0e7c,null));};exports[_0x0d8b('0x47')]=function(_0x8c0bbe,_0x5952dd){return respondWithRpcPromise(_0x0d8b('0x48'),_0x8c0bbe['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5952dd,null))[_0x0d8b('0xc')](handleError(_0x5952dd,null));};exports[_0x0d8b('0x49')]=function(_0x26ccf0,_0x2b6eb6){return respondWithRpcPromise(_0x0d8b('0x48'),_0x26ccf0['query'],routingClient)[_0x0d8b('0x8')](findById(_0x26ccf0['params']['id']))[_0x0d8b('0x8')](respondWithResult(_0x2b6eb6,null))[_0x0d8b('0xc')](handleError(_0x2b6eb6,null));};exports[_0x0d8b('0x4a')]=function(_0x33a614,_0x48025e){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x33a614[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x48025e,null))[_0x0d8b('0xc')](handleError(_0x48025e,null));};exports[_0x0d8b('0x4c')]=function(_0x273aef,_0x223fd8){return respondWithRpcPromise(_0x0d8b('0x4b'),_0x273aef[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x273aef['params']['id']))['then'](respondWithResult(_0x223fd8,null))[_0x0d8b('0xc')](handleError(_0x223fd8,null));};exports[_0x0d8b('0x4d')]=function(_0x53e399,_0xb1aa96){return respondWithRpcPromise('FaxQueues',_0x53e399['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0xb1aa96,null))[_0x0d8b('0xc')](handleError(_0xb1aa96,null));};exports['showFaxQueues']=function(_0x587128,_0x1900e3){return respondWithRpcPromise(_0x0d8b('0x4e'),_0x587128[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](findById(_0x587128[_0x0d8b('0x1b')]['id']))[_0x0d8b('0x8')](respondWithResult(_0x1900e3,null))[_0x0d8b('0xc')](handleError(_0x1900e3,null));};exports['faxAccounts']=function(_0x1ca60c,_0x5878c2){return respondWithRpcPromise(_0x0d8b('0x4f'),_0x1ca60c[_0x0d8b('0x18')])[_0x0d8b('0x8')](respondWithResult(_0x5878c2,null))[_0x0d8b('0xc')](handleError(_0x5878c2,null));};exports['chatQueuesWaitingInteractions']=function(_0x3fe47d,_0x4a1c4a){return respondWithRpcPromise(_0x0d8b('0x50'),_0x3fe47d[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x4a1c4a,null))[_0x0d8b('0xc')](handleError(_0x4a1c4a,null));};exports[_0x0d8b('0x51')]=function(_0x2b44e5,_0x3e927c){return respondWithRpcPromise(_0x0d8b('0x52'),_0x2b44e5[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e927c,null))['catch'](handleError(_0x3e927c,null));};exports[_0x0d8b('0x53')]=function(_0x54c28b,_0x3e4121){return respondWithRpcPromise(_0x0d8b('0x54'),_0x54c28b['query'],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3e4121,null))['catch'](handleError(_0x3e4121,null));};exports[_0x0d8b('0x55')]=function(_0x445a00,_0x24f75){return respondWithRpcPromise(_0x0d8b('0x54'),_0x445a00[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](function(_0x3a073b){if(_0x445a00[_0x0d8b('0x18')]['type']!==undefined){var _0x10eca6=_(_0x3a073b[_0x0d8b('0x14')])['filter']([_0x445a00[_0x0d8b('0x18')][_0x0d8b('0x56')],_0x445a00[_0x0d8b('0x1b')]['id']])[_0x0d8b('0x57')](_0x0d8b('0x58'))[_0x0d8b('0x59')]()[_0x0d8b('0x5a')]();return _0x3a073b[_0x0d8b('0x14')][_0x0d8b('0x5b')](function(_0x5007c0){return _0x10eca6[_0x0d8b('0x5c')](_0x5007c0[_0x0d8b('0x58')])>-0x1;});}else{return _0x3a073b['rows'][_0x0d8b('0x5b')](function(_0x93fc55){return _0x93fc55[_0x0d8b('0x58')]===parseInt(_0x445a00['params']['id']);});}})['then'](respondWithResult(_0x24f75,null))[_0x0d8b('0xc')](handleError(_0x24f75,null));};exports[_0x0d8b('0x5d')]=function(_0x2c55bc,_0x5b76af){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x2c55bc[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x5b76af,null))[_0x0d8b('0xc')](handleError(_0x5b76af,null));};exports[_0x0d8b('0x5e')]=function(_0x2a2b58,_0x3f7895){return respondWithRpcPromise(_0x0d8b('0x5f'),_0x2a2b58[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3f7895,null))[_0x0d8b('0xc')](handleError(_0x3f7895,null));};exports[_0x0d8b('0x60')]=function(_0x291336,_0x3b060e){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x291336[_0x0d8b('0x18')],routingClient)[_0x0d8b('0x8')](respondWithResult(_0x3b060e,null))['catch'](handleError(_0x3b060e,null));};exports['queueNotify']=function(_0x1a1029){return function(_0x1dad9f,_0x3573b4){var _0x14b1b8,_0x23e2e0;var _0x354208=_['capitalize'](_0x1a1029);var _0x502715=_0x1a1029==='chat'?_0x0d8b('0x61'):_0x0d8b('0x62');return db[_0x354208+_0x0d8b('0x63')][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x1dad9f[_0x0d8b('0x1b')]['id']}})[_0x0d8b('0x8')](function(_0x5ef461){if(_[_0x0d8b('0x13')](_0x5ef461)){throw new Error(_0x354208+_0x0d8b('0x65'));}_0x14b1b8=_0x5ef461;return db[_0x354208+'Message'][_0x0d8b('0x64')]({'where':{'id':_0x1dad9f['body'][_0x0d8b('0x66')]},'include':[{'model':db[_0x354208+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x354208+_0x502715],'as':_0x0d8b('0x62')}]});})[_0x0d8b('0x8')](function(_0x8fae7f){if(_[_0x0d8b('0x13')](_0x8fae7f)){throw new Error(_0x354208+_0x0d8b('0x68'));}_0x23e2e0=_0x8fae7f;return _0x8fae7f[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x276558={'uniqueid':_0x1a1029+'.'+_0x23e2e0['id']+'.'+_0x23e2e0[_0x0d8b('0x67')]['id'],'FromUserId':_0x1dad9f['user']['id'],'type':'queue'};_0x276558[_0x354208+_0x0d8b('0x6a')]=_0x23e2e0['id'];_0x276558[_0x354208+_0x0d8b('0x6b')]=_0x23e2e0[_0x0d8b('0x67')]['id'];_0x276558[_0x0d8b('0x6c')+_0x354208+_0x502715+'Id']=_0x23e2e0[_0x0d8b('0x62')]['id'];_0x276558['To'+_0x354208+_0x0d8b('0x6d')]=_0x14b1b8['id'];return db[_0x354208+_0x0d8b('0x6e')]['create'](_0x276558);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x1a1029,'interaction':_0x23e2e0[_0x0d8b('0x67')],'message':_0x23e2e0,'account':_0x23e2e0['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x14b1b8[_0x0d8b('0x11')]+','+(_0x23e2e0[_0x0d8b('0x62')][_0x0d8b('0x6f')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})[_0x0d8b('0x8')](respondWithResult(_0x3573b4,null))[_0x0d8b('0xc')](handleError(_0x3573b4,null));};};exports[_0x0d8b('0x71')]=function(_0x180eda,_0x35267a){var _0x20a8b6,_0x3a6014;if(_[_0x0d8b('0x13')](_0x180eda['body'][_0x0d8b('0x72')])){throw new Error(_0x0d8b('0x73'));}var _0x8be77c=_0x180eda['body']['channel'];var _0x2db144=_[_0x0d8b('0x74')](_0x8be77c);var _0x36d6ca=_0x8be77c===_0x0d8b('0x75')?_0x0d8b('0x61'):_0x0d8b('0x62');return db['User'][_0x0d8b('0x64')]({'raw':!![],'where':{'id':_0x180eda[_0x0d8b('0x1b')]['id'],'role':_0x0d8b('0x76')}})[_0x0d8b('0x8')](function(_0x4350ee){if(_['isNil'](_0x4350ee)){throw new Error('Agent\x20not\x20found');}_0x20a8b6=_0x4350ee;return db[_0x2db144+_0x0d8b('0x77')][_0x0d8b('0x64')]({'where':{'id':_0x180eda[_0x0d8b('0x22')]['messageId']},'include':[{'model':db[_0x2db144+_0x0d8b('0x67')],'as':_0x0d8b('0x67')},{'model':db[_0x2db144+_0x36d6ca],'as':_0x0d8b('0x62')}]});})['then'](function(_0xb61d4b){if(_[_0x0d8b('0x13')](_0xb61d4b)){throw new Error(_0x2db144+_0x0d8b('0x68'));}_0x3a6014=_0xb61d4b;return _0xb61d4b[_0x0d8b('0x69')]({'read':0x0,'readAt':null,'UserId':null});})[_0x0d8b('0x8')](function(){var _0x150e9f={'uniqueid':_0x8be77c+'.'+_0x3a6014['id']+'.'+_0x3a6014[_0x0d8b('0x67')]['id'],'FromUserId':_0x180eda[_0x0d8b('0x33')]['id'],'type':_0x0d8b('0x76'),'ToUserId':_0x20a8b6['id']};_0x150e9f[_0x2db144+'MessageId']=_0x3a6014['id'];_0x150e9f[_0x2db144+_0x0d8b('0x6b')]=_0x3a6014[_0x0d8b('0x67')]['id'];_0x150e9f[_0x0d8b('0x6c')+_0x2db144+_0x36d6ca+'Id']=_0x3a6014[_0x0d8b('0x62')]['id'];return db[_0x2db144+_0x0d8b('0x6e')][_0x0d8b('0x78')](_0x150e9f);})[_0x0d8b('0x8')](function(){return respondWithRpcPromise(_0x0d8b('0x79'),{'channel':_0x8be77c,'interaction':_0x3a6014[_0x0d8b('0x67')],'message':_0x3a6014,'account':_0x3a6014['Account'],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x20a8b6[_0x0d8b('0x11')]+','+(_0x3a6014[_0x0d8b('0x62')][_0x0d8b('0x7a')]||0x12c),'interval':_0x0d8b('0x70')}],'transfer':!![]},routingClient);})['then'](respondWithResult(_0x35267a,null))[_0x0d8b('0xc')](handleError(_0x35267a,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 0aa44e5..92bc806 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 _0xfb63=['./schedule.controller','isAuthenticated','index','show','get','/:id/run','run','create','update','/:id','exports','multer','util','connect-timeout','express','Router','fs-extra','../../config/environment'];(function(_0x2b9370,_0x4d10e9){var _0x540472=function(_0x422e8f){while(--_0x422e8f){_0x2b9370['push'](_0x2b9370['shift']());}};_0x540472(++_0x4d10e9);}(_0xfb63,0x14f));var _0x3fb6=function(_0x511cc6,_0x115846){_0x511cc6=_0x511cc6-0x0;var _0x48f888=_0xfb63[_0x511cc6];return _0x48f888;};'use strict';var multer=require(_0x3fb6('0x0'));var util=require(_0x3fb6('0x1'));var path=require('path');var timeout=require(_0x3fb6('0x2'));var express=require(_0x3fb6('0x3'));var router=express[_0x3fb6('0x4')]();var fs_extra=require(_0x3fb6('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3fb6('0x6'));var controller=require(_0x3fb6('0x7'));router['get']('/',auth[_0x3fb6('0x8')](),controller[_0x3fb6('0x9')]);router['get']('/:id',auth[_0x3fb6('0x8')](),controller[_0x3fb6('0xa')]);router[_0x3fb6('0xb')](_0x3fb6('0xc'),auth[_0x3fb6('0x8')](),controller[_0x3fb6('0xd')]);router['post']('/',auth[_0x3fb6('0x8')](),controller[_0x3fb6('0xe')]);router['put']('/:id',auth[_0x3fb6('0x8')](),controller[_0x3fb6('0xf')]);router['delete'](_0x3fb6('0x10'),auth[_0x3fb6('0x8')](),controller['destroy']);module[_0x3fb6('0x11')]=router; \ No newline at end of file +var _0x5eea=['destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','/:id','/:id/run','run','post','put','update','delete'];(function(_0x4bf61a,_0x3a649b){var _0x27f463=function(_0x62b90){while(--_0x62b90){_0x4bf61a['push'](_0x4bf61a['shift']());}};_0x27f463(++_0x3a649b);}(_0x5eea,0xd3));var _0xa5ee=function(_0x5ba1b9,_0x543aaa){_0x5ba1b9=_0x5ba1b9-0x0;var _0x38334f=_0x5eea[_0x5ba1b9];return _0x38334f;};'use strict';var multer=require(_0xa5ee('0x0'));var util=require(_0xa5ee('0x1'));var path=require(_0xa5ee('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xa5ee('0x3'));var auth=require(_0xa5ee('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa5ee('0x5'));var controller=require(_0xa5ee('0x6'));router[_0xa5ee('0x7')]('/',auth[_0xa5ee('0x8')](),controller[_0xa5ee('0x9')]);router[_0xa5ee('0x7')](_0xa5ee('0xa'),auth[_0xa5ee('0x8')](),controller['show']);router[_0xa5ee('0x7')](_0xa5ee('0xb'),auth[_0xa5ee('0x8')](),controller[_0xa5ee('0xc')]);router[_0xa5ee('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa5ee('0xe')](_0xa5ee('0xa'),auth[_0xa5ee('0x8')](),controller[_0xa5ee('0xf')]);router[_0xa5ee('0x10')](_0xa5ee('0xa'),auth[_0xa5ee('0x8')](),controller[_0xa5ee('0x11')]);module[_0xa5ee('0x12')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 26d9fa5..fadfcb9 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 _0x878a=['quarters','months','days','hours','csv','pdf','xlsx','custom','default','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x2122be,_0x290730){var _0x441bf6=function(_0x56d6f8){while(--_0x56d6f8){_0x2122be['push'](_0x2122be['shift']());}};_0x441bf6(++_0x290730);}(_0x878a,0x1de));var _0xa878=function(_0x2fd169,_0x29b5f0){_0x2fd169=_0x2fd169-0x0;var _0x390237=_0x878a[_0x2fd169];return _0x390237;};'use strict';var Sequelize=require(_0xa878('0x0'));module[_0xa878('0x1')]={'name':{'type':Sequelize[_0xa878('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xa878('0x2')]},'active':{'type':Sequelize[_0xa878('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xa878('0x2')],'allowNull':![],'defaultValue':_0xa878('0x4')},'startAt':{'type':Sequelize[_0xa878('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xa878('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xa878('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xa878('0x7')]('years',_0xa878('0x8'),_0xa878('0x9'),'weeks',_0xa878('0xa'),_0xa878('0xb'),'minutes'),'allowNull':![],'defaultValue':_0xa878('0xa')},'output':{'type':Sequelize['ENUM'](_0xa878('0xc'),_0xa878('0xd'),_0xa878('0xe')),'allowNull':![],'defaultValue':_0xa878('0xc')},'type':{'type':Sequelize[_0xa878('0x7')](_0xa878('0xf'),_0xa878('0x10')),'allowNull':![],'defaultValue':_0xa878('0xf')},'sendMail':{'type':Sequelize[_0xa878('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xa878('0x2')]},'cc':{'type':Sequelize[_0xa878('0x11')]},'bcc':{'type':Sequelize[_0xa878('0x11')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x36f0=['exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','minutes','csv','pdf','xlsx','custom','TEXT','sequelize'];(function(_0x32411c,_0x3518e4){var _0x13cb80=function(_0x50bb1f){while(--_0x50bb1f){_0x32411c['push'](_0x32411c['shift']());}};_0x13cb80(++_0x3518e4);}(_0x36f0,0xaa));var _0x036f=function(_0x5e6ea3,_0x9addd2){_0x5e6ea3=_0x5e6ea3-0x0;var _0x4048b5=_0x36f0[_0x5e6ea3];return _0x4048b5;};'use strict';var Sequelize=require(_0x036f('0x0'));module[_0x036f('0x1')]={'name':{'type':Sequelize[_0x036f('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0x036f('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x036f('0x2')],'allowNull':![],'defaultValue':_0x036f('0x4')},'startAt':{'type':Sequelize[_0x036f('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0x036f('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x036f('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x036f('0x7')](_0x036f('0x8'),_0x036f('0x9'),_0x036f('0xa'),_0x036f('0xb'),_0x036f('0xc'),'hours',_0x036f('0xd')),'allowNull':![],'defaultValue':_0x036f('0xc')},'output':{'type':Sequelize[_0x036f('0x7')](_0x036f('0xe'),_0x036f('0xf'),_0x036f('0x10')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x036f('0x7')]('custom','default'),'allowNull':![],'defaultValue':_0x036f('0x11')},'sendMail':{'type':Sequelize[_0x036f('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x036f('0x12')]},'bcc':{'type':Sequelize[_0x036f('0x12')]},'sendIfEmpty':{'type':Sequelize[_0x036f('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 036cd3c..861b632 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 _0x5c5a=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','reject','save','then','destroy','get','stack','name','send','map','Schedule','type','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','params','rawAttributes','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5c5a,0x99));var _0xa5c5=function(_0x19dded,_0x19945f){_0x19dded=_0x19dded-0x0;var _0x406d58=_0x5c5a[_0x19dded];return _0x406d58;};'use strict';var emlformat=require(_0xa5c5('0x0'));var rimraf=require(_0xa5c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa5c5('0x2'));var rp=require(_0xa5c5('0x3'));var moment=require(_0xa5c5('0x4'));var BPromise=require(_0xa5c5('0x5'));var Mustache=require(_0xa5c5('0x6'));var util=require(_0xa5c5('0x7'));var path=require(_0xa5c5('0x8'));var sox=require('sox');var csv=require(_0xa5c5('0x9'));var ejs=require(_0xa5c5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5c5('0xb'));var squel=require(_0xa5c5('0xc'));var crypto=require(_0xa5c5('0xd'));var jsforce=require(_0xa5c5('0xe'));var deskjs=require(_0xa5c5('0xf'));var toCsv=require(_0xa5c5('0x9'));var querystring=require(_0xa5c5('0x10'));var Papa=require(_0xa5c5('0x11'));var Redis=require(_0xa5c5('0x12'));var authService=require(_0xa5c5('0x13'));var qs=require(_0xa5c5('0x14'));var as=require(_0xa5c5('0x15'));var hardwareService=require(_0xa5c5('0x16'));var logger=require(_0xa5c5('0x17'))(_0xa5c5('0x18'));var utils=require(_0xa5c5('0x19'));var config=require(_0xa5c5('0x1a'));var licenseUtil=require(_0xa5c5('0x1b'));var db=require(_0xa5c5('0x1c'))['db'];function respondWithStatusCode(_0x31899c,_0x5b87a9){_0x5b87a9=_0x5b87a9||0xcc;return function(_0x1d4937){if(_0x1d4937){return _0x31899c[_0xa5c5('0x1d')](_0x5b87a9);}return _0x31899c[_0xa5c5('0x1e')](_0x5b87a9)[_0xa5c5('0x1f')]();};}function respondWithResult(_0x28f08f,_0xcfd90c){_0xcfd90c=_0xcfd90c||0xc8;return function(_0x426557){if(_0x426557){return _0x28f08f[_0xa5c5('0x1e')](_0xcfd90c)[_0xa5c5('0x20')](_0x426557);}};}function respondWithFilteredResult(_0x505794,_0x3e7bf5){return function(_0x43800a){if(_0x43800a){var _0x2addaa=typeof _0x3e7bf5['offset']===_0xa5c5('0x21')&&typeof _0x3e7bf5[_0xa5c5('0x22')]===_0xa5c5('0x21');var _0x3803ec=_0x43800a['count'];var _0x4a822c=_0x2addaa?0x0:_0x3e7bf5[_0xa5c5('0x23')];var _0x144eee=_0x2addaa?_0x43800a[_0xa5c5('0x24')]:_0x3e7bf5['offset']+_0x3e7bf5[_0xa5c5('0x22')];var _0x2516dc;if(_0x144eee>=_0x3803ec){_0x144eee=_0x3803ec;_0x2516dc=0xc8;}else{_0x2516dc=0xce;}_0x505794[_0xa5c5('0x1e')](_0x2516dc);return _0x505794[_0xa5c5('0x25')](_0xa5c5('0x26'),_0x4a822c+'-'+_0x144eee+'/'+_0x3803ec)['json'](_0x43800a);}return null;};}function patchUpdates(_0x3decac){return function(_0x3497ae){try{jsonpatch['apply'](_0x3497ae,_0x3decac,!![]);}catch(_0x2af2f8){return BPromise[_0xa5c5('0x27')](_0x2af2f8);}return _0x3497ae[_0xa5c5('0x28')]();};}function saveUpdates(_0x20971a,_0x4e8613){return function(_0x31512b){if(_0x31512b){return _0x31512b['update'](_0x20971a)[_0xa5c5('0x29')](function(_0x594474){return _0x594474;});}return null;};}function removeEntity(_0x4dea7d,_0x44763a){return function(_0x10207b){if(_0x10207b){return _0x10207b[_0xa5c5('0x2a')]()['then'](function(){var _0xfd3339=_0x10207b[_0xa5c5('0x2b')]({'plain':!![]});var _0x4cd2f3='Scheduler';return db['UserProfileResource'][_0xa5c5('0x2a')]({'where':{'type':_0x4cd2f3,'resourceId':_0xfd3339['id']}})[_0xa5c5('0x29')](function(){return _0x10207b;});})['then'](function(){_0x4dea7d[_0xa5c5('0x1e')](0xcc)[_0xa5c5('0x1f')]();});}};}function handleEntityNotFound(_0x592fac,_0x442075){return function(_0x887955){if(!_0x887955){_0x592fac[_0xa5c5('0x1d')](0x194);}return _0x887955;};}function handleError(_0x5191de,_0x27ffd6){_0x27ffd6=_0x27ffd6||0x1f4;return function(_0x3fd248){logger['error'](_0x3fd248[_0xa5c5('0x2c')]);if(_0x3fd248[_0xa5c5('0x2d')]){delete _0x3fd248['name'];}_0x5191de[_0xa5c5('0x1e')](_0x27ffd6)[_0xa5c5('0x2e')](_0x3fd248);};}exports['index']=function(_0x28cd2b,_0x19c0b9){var _0x15308d={},_0x1abc03={},_0x564985={'count':0x0,'rows':[]};var _0x2cd015=_[_0xa5c5('0x2f')](db[_0xa5c5('0x30')]['rawAttributes'],function(_0x18875d){return{'name':_0x18875d['fieldName'],'type':_0x18875d[_0xa5c5('0x31')][_0xa5c5('0x32')]};});_0x1abc03[_0xa5c5('0x33')]=_[_0xa5c5('0x2f')](_0x2cd015,_0xa5c5('0x2d'));_0x1abc03[_0xa5c5('0x34')]=_[_0xa5c5('0x35')](_0x28cd2b[_0xa5c5('0x34')]);_0x1abc03[_0xa5c5('0x36')]=_['intersection'](_0x1abc03[_0xa5c5('0x33')],_0x1abc03['query']);_0x15308d[_0xa5c5('0x37')]=_[_0xa5c5('0x38')](_0x1abc03['model'],qs[_0xa5c5('0x39')](_0x28cd2b[_0xa5c5('0x34')]['fields']));_0x15308d[_0xa5c5('0x37')]=_0x15308d[_0xa5c5('0x37')][_0xa5c5('0x3a')]?_0x15308d[_0xa5c5('0x37')]:_0x1abc03[_0xa5c5('0x33')];if(!_0x28cd2b['query']['hasOwnProperty'](_0xa5c5('0x3b'))){_0x15308d['limit']=qs[_0xa5c5('0x22')](_0x28cd2b[_0xa5c5('0x34')][_0xa5c5('0x22')]);_0x15308d[_0xa5c5('0x23')]=qs['offset'](_0x28cd2b[_0xa5c5('0x34')]['offset']);}_0x15308d[_0xa5c5('0x3c')]=qs[_0xa5c5('0x3d')](_0x28cd2b[_0xa5c5('0x34')][_0xa5c5('0x3d')]);_0x15308d[_0xa5c5('0x3e')]=qs[_0xa5c5('0x36')](_[_0xa5c5('0x3f')](_0x28cd2b['query'],_0x1abc03[_0xa5c5('0x36')]),_0x2cd015);if(_0x28cd2b[_0xa5c5('0x34')][_0xa5c5('0x40')]){_0x15308d['where']=_[_0xa5c5('0x41')](_0x15308d['where'],{'$or':_['map'](_0x2cd015,function(_0x4da9f2){if(_0x4da9f2['type']!==_0xa5c5('0x42')){var _0x4d0c28={};_0x4d0c28[_0x4da9f2[_0xa5c5('0x2d')]]={'$like':'%'+_0x28cd2b[_0xa5c5('0x34')][_0xa5c5('0x40')]+'%'};return _0x4d0c28;}})});}_0x15308d=_[_0xa5c5('0x41')]({},_0x15308d,_0x28cd2b[_0xa5c5('0x43')]);var _0x11c052={'where':_0x15308d['where']};return db['Schedule'][_0xa5c5('0x24')](_0x11c052)[_0xa5c5('0x29')](function(_0x299b04){_0x564985['count']=_0x299b04;if(_0x28cd2b[_0xa5c5('0x34')]['includeAll']){_0x15308d[_0xa5c5('0x44')]=[{'all':!![]}];}return db[_0xa5c5('0x30')][_0xa5c5('0x45')](_0x15308d);})[_0xa5c5('0x29')](function(_0x1f0e5c){_0x564985[_0xa5c5('0x46')]=_0x1f0e5c;return _0x564985;})[_0xa5c5('0x29')](respondWithFilteredResult(_0x19c0b9,_0x15308d))[_0xa5c5('0x47')](handleError(_0x19c0b9,null));};exports['show']=function(_0x5948ce,_0x404426){var _0x364963={'raw':![],'where':{'id':_0x5948ce[_0xa5c5('0x48')]['id']}},_0x284c2c={};_0x284c2c['model']=_[_0xa5c5('0x35')](db[_0xa5c5('0x30')][_0xa5c5('0x49')]);_0x284c2c[_0xa5c5('0x34')]=_['keys'](_0x5948ce[_0xa5c5('0x34')]);_0x284c2c[_0xa5c5('0x36')]=_[_0xa5c5('0x38')](_0x284c2c['model'],_0x284c2c['query']);_0x364963['attributes']=_[_0xa5c5('0x38')](_0x284c2c['model'],qs[_0xa5c5('0x39')](_0x5948ce['query'][_0xa5c5('0x39')]));_0x364963['attributes']=_0x364963[_0xa5c5('0x37')][_0xa5c5('0x3a')]?_0x364963[_0xa5c5('0x37')]:_0x284c2c[_0xa5c5('0x33')];if(_0x5948ce[_0xa5c5('0x34')][_0xa5c5('0x4a')]){_0x364963['include']=[{'all':!![]}];}_0x364963=_[_0xa5c5('0x41')]({},_0x364963,_0x5948ce[_0xa5c5('0x43')]);return db[_0xa5c5('0x30')][_0xa5c5('0x4b')](_0x364963)['then'](handleEntityNotFound(_0x404426,null))[_0xa5c5('0x29')](respondWithResult(_0x404426,null))[_0xa5c5('0x47')](handleError(_0x404426,null));};exports[_0xa5c5('0x4c')]=function(_0x543506,_0x5727c4){return db[_0xa5c5('0x30')][_0xa5c5('0x4c')](_0x543506[_0xa5c5('0x4d')],{})['then'](function(_0x20f76a){var _0x289575=_0x543506[_0xa5c5('0x4e')][_0xa5c5('0x2b')]({'plain':!![]});if(!_0x289575)throw new Error(_0xa5c5('0x4f'));if(_0x289575[_0xa5c5('0x50')]===_0xa5c5('0x4e')){var _0x44e8ac=_0x20f76a[_0xa5c5('0x2b')]({'plain':!![]});var _0xf6f9dd='Scheduler';return db[_0xa5c5('0x51')][_0xa5c5('0x4b')]({'where':{'name':_0xf6f9dd,'userProfileId':_0x289575[_0xa5c5('0x52')]},'raw':!![]})['then'](function(_0x3faad5){if(_0x3faad5&&_0x3faad5[_0xa5c5('0x53')]===0x0){return db[_0xa5c5('0x54')][_0xa5c5('0x4c')]({'name':_0x44e8ac[_0xa5c5('0x2d')],'resourceId':_0x44e8ac['id'],'type':_0x3faad5[_0xa5c5('0x2d')],'sectionId':_0x3faad5['id']},{})[_0xa5c5('0x29')](function(){return _0x20f76a;});}else{return _0x20f76a;}})['catch'](function(_0x34246a){logger[_0xa5c5('0x55')](_0xa5c5('0x56'),_0x34246a);throw _0x34246a;});}return _0x20f76a;})[_0xa5c5('0x29')](respondWithResult(_0x5727c4,0xc9))['catch'](handleError(_0x5727c4,null));};exports[_0xa5c5('0x57')]=function(_0x4f07c0,_0x3d5711){if(_0x4f07c0['body']['id']){delete _0x4f07c0[_0xa5c5('0x4d')]['id'];}return db[_0xa5c5('0x30')][_0xa5c5('0x4b')]({'where':{'id':_0x4f07c0[_0xa5c5('0x48')]['id']}})[_0xa5c5('0x29')](handleEntityNotFound(_0x3d5711,null))[_0xa5c5('0x29')](saveUpdates(_0x4f07c0[_0xa5c5('0x4d')],null))['then'](respondWithResult(_0x3d5711,null))['catch'](handleError(_0x3d5711,null));};exports[_0xa5c5('0x2a')]=function(_0x10f4c5,_0x29cb9){return db['Schedule']['find']({'where':{'id':_0x10f4c5[_0xa5c5('0x48')]['id']}})[_0xa5c5('0x29')](handleEntityNotFound(_0x29cb9,null))[_0xa5c5('0x29')](removeEntity(_0x29cb9,null))['catch'](handleError(_0x29cb9,null));};exports[_0xa5c5('0x58')]=function(_0x216bfc,_0xd71269,_0x3ef350){var _0x5dc506=require(_0xa5c5('0x59'));return db[_0xa5c5('0x30')][_0xa5c5('0x4b')]({'where':{'id':_0x216bfc[_0xa5c5('0x48')]['id']},'raw':!![]})[_0xa5c5('0x29')](handleEntityNotFound(_0xd71269,null))[_0xa5c5('0x29')](function(){_0x5dc506[_0xa5c5('0x58')](_0x216bfc[_0xa5c5('0x48')]['id']);})[_0xa5c5('0x29')](respondWithStatusCode(_0xd71269,null))['catch'](handleError(_0xd71269,null));}; \ No newline at end of file +var _0x6535=['Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','run','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','fs-extra','squel','crypto','jsforce','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','../../mysqldb','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Scheduler','UserProfileResource','destroy','sendStatus','error','stack','send','index','Schedule','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','pick','where','merge','map','VIRTUAL','filter','options','includeAll','findAll','catch','show','params','keys','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId'];(function(_0x100e0c,_0x5523b8){var _0x4db1aa=function(_0x29f480){while(--_0x29f480){_0x100e0c['push'](_0x100e0c['shift']());}};_0x4db1aa(++_0x5523b8);}(_0x6535,0xb2));var _0x5653=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0x6535[_0x5a776b];return _0xbbef59;};'use strict';var emlformat=require(_0x5653('0x0'));var rimraf=require(_0x5653('0x1'));var zipdir=require(_0x5653('0x2'));var jsonpatch=require(_0x5653('0x3'));var rp=require(_0x5653('0x4'));var moment=require(_0x5653('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x5653('0x6'));var path=require(_0x5653('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5653('0x8'));var fs=require('fs');var fs_extra=require(_0x5653('0x9'));var _=require('lodash');var squel=require(_0x5653('0xa'));var crypto=require(_0x5653('0xb'));var jsforce=require(_0x5653('0xc'));var deskjs=require(_0x5653('0xd'));var toCsv=require(_0x5653('0xe'));var querystring=require(_0x5653('0xf'));var Papa=require(_0x5653('0x10'));var Redis=require(_0x5653('0x11'));var authService=require(_0x5653('0x12'));var qs=require(_0x5653('0x13'));var as=require(_0x5653('0x14'));var hardwareService=require(_0x5653('0x15'));var logger=require(_0x5653('0x16'))(_0x5653('0x17'));var utils=require(_0x5653('0x18'));var config=require(_0x5653('0x19'));var licenseUtil=require(_0x5653('0x1a'));var db=require(_0x5653('0x1b'))['db'];function respondWithStatusCode(_0x53bc64,_0x2f3701){_0x2f3701=_0x2f3701||0xcc;return function(_0x3fc17d){if(_0x3fc17d){return _0x53bc64['sendStatus'](_0x2f3701);}return _0x53bc64['status'](_0x2f3701)[_0x5653('0x1c')]();};}function respondWithResult(_0x5b80c7,_0x2c38df){_0x2c38df=_0x2c38df||0xc8;return function(_0x41d85e){if(_0x41d85e){return _0x5b80c7[_0x5653('0x1d')](_0x2c38df)[_0x5653('0x1e')](_0x41d85e);}};}function respondWithFilteredResult(_0x1bd5cb,_0x50a5dd){return function(_0x473d43){if(_0x473d43){var _0x5ab60a=typeof _0x50a5dd[_0x5653('0x1f')]==='undefined'&&typeof _0x50a5dd[_0x5653('0x20')]===_0x5653('0x21');var _0x35b1ef=_0x473d43[_0x5653('0x22')];var _0x1502a3=_0x5ab60a?0x0:_0x50a5dd['offset'];var _0x1ce23d=_0x5ab60a?_0x473d43[_0x5653('0x22')]:_0x50a5dd['offset']+_0x50a5dd[_0x5653('0x20')];var _0x4884a2;if(_0x1ce23d>=_0x35b1ef){_0x1ce23d=_0x35b1ef;_0x4884a2=0xc8;}else{_0x4884a2=0xce;}_0x1bd5cb[_0x5653('0x1d')](_0x4884a2);return _0x1bd5cb[_0x5653('0x23')](_0x5653('0x24'),_0x1502a3+'-'+_0x1ce23d+'/'+_0x35b1ef)[_0x5653('0x1e')](_0x473d43);}return null;};}function patchUpdates(_0x2595ff){return function(_0x152621){try{jsonpatch[_0x5653('0x25')](_0x152621,_0x2595ff,!![]);}catch(_0x4e2fa6){return BPromise[_0x5653('0x26')](_0x4e2fa6);}return _0x152621[_0x5653('0x27')]();};}function saveUpdates(_0x5515c9,_0x5283f0){return function(_0x3cbe21){if(_0x3cbe21){return _0x3cbe21[_0x5653('0x28')](_0x5515c9)['then'](function(_0xd0df15){return _0xd0df15;});}return null;};}function removeEntity(_0xbd1aa3,_0x5f4f8d){return function(_0x2fb761){if(_0x2fb761){return _0x2fb761['destroy']()[_0x5653('0x29')](function(){var _0x4e7e24=_0x2fb761[_0x5653('0x2a')]({'plain':!![]});var _0x39f680=_0x5653('0x2b');return db[_0x5653('0x2c')][_0x5653('0x2d')]({'where':{'type':_0x39f680,'resourceId':_0x4e7e24['id']}})[_0x5653('0x29')](function(){return _0x2fb761;});})[_0x5653('0x29')](function(){_0xbd1aa3[_0x5653('0x1d')](0xcc)[_0x5653('0x1c')]();});}};}function handleEntityNotFound(_0x3022eb,_0x320155){return function(_0xc71130){if(!_0xc71130){_0x3022eb[_0x5653('0x2e')](0x194);}return _0xc71130;};}function handleError(_0x2cd7a4,_0xeb5fbb){_0xeb5fbb=_0xeb5fbb||0x1f4;return function(_0x4169d7){logger[_0x5653('0x2f')](_0x4169d7[_0x5653('0x30')]);if(_0x4169d7['name']){delete _0x4169d7['name'];}_0x2cd7a4[_0x5653('0x1d')](_0xeb5fbb)[_0x5653('0x31')](_0x4169d7);};}exports[_0x5653('0x32')]=function(_0x4d5bcf,_0x520e30){var _0x389641={},_0x27e6c8={},_0x41c9ec={'count':0x0,'rows':[]};var _0x55f645=_['map'](db[_0x5653('0x33')][_0x5653('0x34')],function(_0x258815){return{'name':_0x258815[_0x5653('0x35')],'type':_0x258815[_0x5653('0x36')][_0x5653('0x37')]};});_0x27e6c8[_0x5653('0x38')]=_['map'](_0x55f645,_0x5653('0x39'));_0x27e6c8[_0x5653('0x3a')]=_['keys'](_0x4d5bcf[_0x5653('0x3a')]);_0x27e6c8[_0x5653('0x3b')]=_[_0x5653('0x3c')](_0x27e6c8[_0x5653('0x38')],_0x27e6c8[_0x5653('0x3a')]);_0x389641[_0x5653('0x3d')]=_[_0x5653('0x3c')](_0x27e6c8['model'],qs[_0x5653('0x3e')](_0x4d5bcf[_0x5653('0x3a')][_0x5653('0x3e')]));_0x389641[_0x5653('0x3d')]=_0x389641[_0x5653('0x3d')][_0x5653('0x3f')]?_0x389641[_0x5653('0x3d')]:_0x27e6c8[_0x5653('0x38')];if(!_0x4d5bcf[_0x5653('0x3a')][_0x5653('0x40')](_0x5653('0x41'))){_0x389641[_0x5653('0x20')]=qs[_0x5653('0x20')](_0x4d5bcf[_0x5653('0x3a')][_0x5653('0x20')]);_0x389641[_0x5653('0x1f')]=qs[_0x5653('0x1f')](_0x4d5bcf[_0x5653('0x3a')][_0x5653('0x1f')]);}_0x389641[_0x5653('0x42')]=qs['sort'](_0x4d5bcf[_0x5653('0x3a')]['sort']);_0x389641['where']=qs[_0x5653('0x3b')](_[_0x5653('0x43')](_0x4d5bcf[_0x5653('0x3a')],_0x27e6c8['filters']),_0x55f645);if(_0x4d5bcf[_0x5653('0x3a')]['filter']){_0x389641[_0x5653('0x44')]=_[_0x5653('0x45')](_0x389641[_0x5653('0x44')],{'$or':_[_0x5653('0x46')](_0x55f645,function(_0x35fb31){if(_0x35fb31[_0x5653('0x36')]!==_0x5653('0x47')){var _0x502223={};_0x502223[_0x35fb31[_0x5653('0x39')]]={'$like':'%'+_0x4d5bcf[_0x5653('0x3a')][_0x5653('0x48')]+'%'};return _0x502223;}})});}_0x389641=_[_0x5653('0x45')]({},_0x389641,_0x4d5bcf[_0x5653('0x49')]);var _0x411729={'where':_0x389641[_0x5653('0x44')]};return db[_0x5653('0x33')][_0x5653('0x22')](_0x411729)['then'](function(_0x2bdcad){_0x41c9ec[_0x5653('0x22')]=_0x2bdcad;if(_0x4d5bcf[_0x5653('0x3a')][_0x5653('0x4a')]){_0x389641['include']=[{'all':!![]}];}return db[_0x5653('0x33')][_0x5653('0x4b')](_0x389641);})[_0x5653('0x29')](function(_0x3682e5){_0x41c9ec['rows']=_0x3682e5;return _0x41c9ec;})[_0x5653('0x29')](respondWithFilteredResult(_0x520e30,_0x389641))[_0x5653('0x4c')](handleError(_0x520e30,null));};exports[_0x5653('0x4d')]=function(_0x105af8,_0x2bd209){var _0x48a7ea={'raw':![],'where':{'id':_0x105af8[_0x5653('0x4e')]['id']}},_0x2d8d42={};_0x2d8d42[_0x5653('0x38')]=_[_0x5653('0x4f')](db[_0x5653('0x33')][_0x5653('0x34')]);_0x2d8d42[_0x5653('0x3a')]=_[_0x5653('0x4f')](_0x105af8['query']);_0x2d8d42['filters']=_[_0x5653('0x3c')](_0x2d8d42[_0x5653('0x38')],_0x2d8d42[_0x5653('0x3a')]);_0x48a7ea['attributes']=_[_0x5653('0x3c')](_0x2d8d42[_0x5653('0x38')],qs['fields'](_0x105af8['query'][_0x5653('0x3e')]));_0x48a7ea[_0x5653('0x3d')]=_0x48a7ea[_0x5653('0x3d')][_0x5653('0x3f')]?_0x48a7ea[_0x5653('0x3d')]:_0x2d8d42[_0x5653('0x38')];if(_0x105af8['query'][_0x5653('0x4a')]){_0x48a7ea['include']=[{'all':!![]}];}_0x48a7ea=_[_0x5653('0x45')]({},_0x48a7ea,_0x105af8[_0x5653('0x49')]);return db[_0x5653('0x33')][_0x5653('0x50')](_0x48a7ea)['then'](handleEntityNotFound(_0x2bd209,null))[_0x5653('0x29')](respondWithResult(_0x2bd209,null))[_0x5653('0x4c')](handleError(_0x2bd209,null));};exports['create']=function(_0xcd3d0d,_0x318200){return db[_0x5653('0x33')]['create'](_0xcd3d0d[_0x5653('0x51')],{})['then'](function(_0x13edf9){var _0x33401f=_0xcd3d0d[_0x5653('0x52')][_0x5653('0x2a')]({'plain':!![]});if(!_0x33401f)throw new Error(_0x5653('0x53'));if(_0x33401f[_0x5653('0x54')]==='user'){var _0x5dcaed=_0x13edf9['get']({'plain':!![]});var _0x5cedb2='Scheduler';return db['UserProfileSection']['find']({'where':{'name':_0x5cedb2,'userProfileId':_0x33401f[_0x5653('0x55')]},'raw':!![]})[_0x5653('0x29')](function(_0x30b59f){if(_0x30b59f&&_0x30b59f['autoAssociation']===0x0){return db[_0x5653('0x2c')]['create']({'name':_0x5dcaed[_0x5653('0x39')],'resourceId':_0x5dcaed['id'],'type':_0x30b59f[_0x5653('0x39')],'sectionId':_0x30b59f['id']},{})[_0x5653('0x29')](function(){return _0x13edf9;});}else{return _0x13edf9;}})[_0x5653('0x4c')](function(_0x3c58d1){logger[_0x5653('0x2f')](_0x5653('0x56'),_0x3c58d1);throw _0x3c58d1;});}return _0x13edf9;})[_0x5653('0x29')](respondWithResult(_0x318200,0xc9))['catch'](handleError(_0x318200,null));};exports[_0x5653('0x28')]=function(_0x32ade4,_0x516c81){if(_0x32ade4[_0x5653('0x51')]['id']){delete _0x32ade4[_0x5653('0x51')]['id'];}return db[_0x5653('0x33')][_0x5653('0x50')]({'where':{'id':_0x32ade4[_0x5653('0x4e')]['id']}})[_0x5653('0x29')](handleEntityNotFound(_0x516c81,null))[_0x5653('0x29')](saveUpdates(_0x32ade4['body'],null))[_0x5653('0x29')](respondWithResult(_0x516c81,null))[_0x5653('0x4c')](handleError(_0x516c81,null));};exports[_0x5653('0x2d')]=function(_0x368a7a,_0x1a88f6){return db['Schedule'][_0x5653('0x50')]({'where':{'id':_0x368a7a[_0x5653('0x4e')]['id']}})[_0x5653('0x29')](handleEntityNotFound(_0x1a88f6,null))[_0x5653('0x29')](removeEntity(_0x1a88f6,null))[_0x5653('0x4c')](handleError(_0x1a88f6,null));};exports['run']=function(_0x2d1e84,_0x311f92,_0x16a614){var _0x10eaad=require('../../config/schedule');return db['Schedule'][_0x5653('0x50')]({'where':{'id':_0x2d1e84[_0x5653('0x4e')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x311f92,null))['then'](function(){_0x10eaad[_0x5653('0x57')](_0x2d1e84[_0x5653('0x4e')]['id']);})[_0x5653('0x29')](respondWithStatusCode(_0x311f92,null))[_0x5653('0x4c')](handleError(_0x311f92,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 8898239..365317b 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 _0x73a4=['../../config/environment','exports','define','Schedule','tools_schedules','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x245c1c,_0x203ee6){var _0x4092f7=function(_0x26511d){while(--_0x26511d){_0x245c1c['push'](_0x245c1c['shift']());}};_0x4092f7(++_0x203ee6);}(_0x73a4,0x139));var _0x473a=function(_0x223a7d,_0x280d77){_0x223a7d=_0x223a7d-0x0;var _0x40787e=_0x73a4[_0x223a7d];return _0x40787e;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x473a('0x0'))(_0x473a('0x1'));var moment=require(_0x473a('0x2'));var BPromise=require(_0x473a('0x3'));var rp=require(_0x473a('0x4'));var fs=require('fs');var path=require(_0x473a('0x5'));var rimraf=require('rimraf');var config=require(_0x473a('0x6'));var attributes=require('./schedule.attributes');module[_0x473a('0x7')]=function(_0x3a8327,_0x15b526){return _0x3a8327[_0x473a('0x8')](_0x473a('0x9'),attributes,{'tableName':_0x473a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fad=['./schedule.attributes','exports','Schedule','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x25a57b,_0x1c468e){var _0x1c25bc=function(_0x355e20){while(--_0x355e20){_0x25a57b['push'](_0x25a57b['shift']());}};_0x1c25bc(++_0x1c468e);}(_0x9fad,0x87));var _0xd9fa=function(_0x35ea58,_0x28e1ea){_0x35ea58=_0x35ea58-0x0;var _0x44cd99=_0x9fad[_0x35ea58];return _0x44cd99;};'use strict';var _=require('lodash');var util=require(_0xd9fa('0x0'));var logger=require(_0xd9fa('0x1'))('api');var moment=require(_0xd9fa('0x2'));var BPromise=require(_0xd9fa('0x3'));var rp=require(_0xd9fa('0x4'));var fs=require('fs');var path=require(_0xd9fa('0x5'));var rimraf=require(_0xd9fa('0x6'));var config=require(_0xd9fa('0x7'));var attributes=require(_0xd9fa('0x8'));module[_0xd9fa('0x9')]=function(_0x19a5b9,_0x19df08){return _0x19a5b9['define'](_0xd9fa('0xa'),attributes,{'tableName':'tools_schedules','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 1c47fa8..c3ea531 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 _0x00f6=['Schedule,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x31b39a,_0xcc93f9){var _0x4a3935=function(_0x4e9dfc){while(--_0x4e9dfc){_0x31b39a['push'](_0x31b39a['shift']());}};_0x4a3935(++_0xcc93f9);}(_0x00f6,0x1b4));var _0x600f=function(_0xb2a425,_0x213fc3){_0xb2a425=_0xb2a425-0x0;var _0x33858d=_0x00f6[_0xb2a425];return _0x33858d;};'use strict';var _=require(_0x600f('0x0'));var util=require(_0x600f('0x1'));var moment=require(_0x600f('0x2'));var BPromise=require(_0x600f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x600f('0x4'));var db=require(_0x600f('0x5'))['db'];var utils=require(_0x600f('0x6'));var logger=require('../../config/logger')(_0x600f('0x7'));var config=require(_0x600f('0x8'));var jayson=require(_0x600f('0x9'));var client=jayson[_0x600f('0xa')][_0x600f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3266dd,_0x398958,_0x5e980e){return new BPromise(function(_0x1542c5,_0x246132){return client[_0x600f('0xc')](_0x3266dd,_0x5e980e)['then'](function(_0x33168a){logger[_0x600f('0xd')]('Schedule,\x20%s,\x20%s',_0x398958,'request\x20sent');logger[_0x600f('0xe')](_0x600f('0xf'),_0x398958,_0x600f('0x10'),JSON[_0x600f('0x11')](_0x33168a));if(_0x33168a[_0x600f('0x12')]){if(_0x33168a[_0x600f('0x12')][_0x600f('0x13')]===0x1f4){logger[_0x600f('0x12')](_0x600f('0x14'),_0x398958,_0x33168a[_0x600f('0x12')][_0x600f('0x15')]);return _0x246132(_0x33168a['error']['message']);}logger[_0x600f('0x12')](_0x600f('0x14'),_0x398958,_0x33168a[_0x600f('0x12')]['message']);return _0x1542c5(_0x33168a[_0x600f('0x12')][_0x600f('0x15')]);}else{logger[_0x600f('0xd')](_0x600f('0x14'),_0x398958,_0x600f('0x10'));_0x1542c5(_0x33168a[_0x600f('0x16')]['message']);}})[_0x600f('0x17')](function(_0x4eaa4c){logger[_0x600f('0x12')](_0x600f('0x14'),_0x398958,_0x4eaa4c);_0x246132(_0x4eaa4c);});});} \ No newline at end of file +var _0xc6a9=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xc6a9,0x1f0));var _0x9c6a=function(_0x30a457,_0x2aa6b5){_0x30a457=_0x30a457-0x0;var _0x2ae5cd=_0xc6a9[_0x30a457];return _0x2ae5cd;};'use strict';var _=require(_0x9c6a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x9c6a('0x1'));var rs=require(_0x9c6a('0x2'));var fs=require('fs');var Redis=require(_0x9c6a('0x3'));var db=require(_0x9c6a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c6a('0x5'))(_0x9c6a('0x6'));var config=require('../../config/environment');var jayson=require(_0x9c6a('0x7'));var client=jayson['client'][_0x9c6a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x14a899,_0x29c5c7,_0x152e7f){return new BPromise(function(_0x14f08a,_0x5a33aa){return client[_0x9c6a('0x9')](_0x14a899,_0x152e7f)['then'](function(_0x4be58a){logger['info'](_0x9c6a('0xa'),_0x29c5c7,_0x9c6a('0xb'));logger['debug'](_0x9c6a('0xc'),_0x29c5c7,_0x9c6a('0xb'),JSON['stringify'](_0x4be58a));if(_0x4be58a['error']){if(_0x4be58a[_0x9c6a('0xd')][_0x9c6a('0xe')]===0x1f4){logger[_0x9c6a('0xd')]('Schedule,\x20%s,\x20%s',_0x29c5c7,_0x4be58a['error']['message']);return _0x5a33aa(_0x4be58a[_0x9c6a('0xd')][_0x9c6a('0xf')]);}logger[_0x9c6a('0xd')](_0x9c6a('0xa'),_0x29c5c7,_0x4be58a[_0x9c6a('0xd')][_0x9c6a('0xf')]);return _0x14f08a(_0x4be58a[_0x9c6a('0xd')][_0x9c6a('0xf')]);}else{logger['info'](_0x9c6a('0xa'),_0x29c5c7,_0x9c6a('0xb'));_0x14f08a(_0x4be58a['result'][_0x9c6a('0xf')]);}})['catch'](function(_0x1c40c1){logger[_0x9c6a('0xd')](_0x9c6a('0xa'),_0x29c5c7,_0x1c40c1);_0x5a33aa(_0x1c40c1);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 5c55f3c..2b9cf9e 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 _0xfd87=['/:id/download','download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x537563,_0x1eab9e){var _0x3d3f2=function(_0x3fdb0a){while(--_0x3fdb0a){_0x537563['push'](_0x537563['shift']());}};_0x3d3f2(++_0x1eab9e);}(_0xfd87,0xd8));var _0x7fd8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd87[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7fd8('0x0'));var util=require(_0x7fd8('0x1'));var path=require(_0x7fd8('0x2'));var timeout=require(_0x7fd8('0x3'));var express=require(_0x7fd8('0x4'));var router=express[_0x7fd8('0x5')]();var fs_extra=require(_0x7fd8('0x6'));var auth=require(_0x7fd8('0x7'));var interaction=require(_0x7fd8('0x8'));var config=require(_0x7fd8('0x9'));var controller=require(_0x7fd8('0xa'));router[_0x7fd8('0xb')]('/',auth[_0x7fd8('0xc')](),controller[_0x7fd8('0xd')]);router[_0x7fd8('0xb')](_0x7fd8('0xe'),auth['isAuthenticated'](),controller[_0x7fd8('0xf')]);router['get'](_0x7fd8('0x10'),auth[_0x7fd8('0xc')](),controller[_0x7fd8('0x11')]);router[_0x7fd8('0xb')](_0x7fd8('0x12'),auth[_0x7fd8('0xc')](),controller[_0x7fd8('0x13')]);router[_0x7fd8('0x14')]('/',auth[_0x7fd8('0xc')](),controller[_0x7fd8('0x15')]);router[_0x7fd8('0x16')](_0x7fd8('0x10'),auth[_0x7fd8('0xc')](),controller[_0x7fd8('0x17')]);router[_0x7fd8('0x18')](_0x7fd8('0x10'),auth[_0x7fd8('0xc')](),controller[_0x7fd8('0x19')]);module['exports']=router; \ No newline at end of file +var _0x27af=['delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','isAuthenticated','index','get','/:id','show','/:id/download','post','put','update'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x27af,0xec));var _0xf27a=function(_0xb04c42,_0x48b583){_0xb04c42=_0xb04c42-0x0;var _0xdb2896=_0x27af[_0xb04c42];return _0xdb2896;};'use strict';var multer=require(_0xf27a('0x0'));var util=require('util');var path=require(_0xf27a('0x1'));var timeout=require(_0xf27a('0x2'));var express=require('express');var router=express[_0xf27a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf27a('0x4'));var interaction=require(_0xf27a('0x5'));var config=require('../../config/environment');var controller=require(_0xf27a('0x6'));router['get']('/',auth[_0xf27a('0x7')](),controller[_0xf27a('0x8')]);router[_0xf27a('0x9')]('/describe',auth[_0xf27a('0x7')](),controller['describe']);router[_0xf27a('0x9')](_0xf27a('0xa'),auth[_0xf27a('0x7')](),controller[_0xf27a('0xb')]);router[_0xf27a('0x9')](_0xf27a('0xc'),auth[_0xf27a('0x7')](),controller['download']);router[_0xf27a('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf27a('0xe')](_0xf27a('0xa'),auth[_0xf27a('0x7')](),controller[_0xf27a('0xf')]);router[_0xf27a('0x10')]('/:id',auth[_0xf27a('0x7')](),controller['destroy']);module[_0xf27a('0x11')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 226662b..f935496 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 _0x7cdc=['createdAt','moment','path','exports','VIRTUAL','getDataValue','extname','STRING','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','DATE','MM-DD-YYYY\x20HH:mm','toString','format'];(function(_0x20c28b,_0x5a393d){var _0x457bc5=function(_0x8058ee){while(--_0x8058ee){_0x20c28b['push'](_0x20c28b['shift']());}};_0x457bc5(++_0x5a393d);}(_0x7cdc,0x190));var _0xc7cd=function(_0x4a169f,_0x19c8ae){_0x4a169f=_0x4a169f-0x0;var _0x28e342=_0x7cdc[_0x4a169f];return _0x28e342;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc7cd('0x0'));var path=require(_0xc7cd('0x1'));var config=require('../../config/environment');module[_0xc7cd('0x2')]={'format':{'type':Sequelize[_0xc7cd('0x3')],'get':function(){return this[_0xc7cd('0x4')]('value')?path[_0xc7cd('0x5')](this[_0xc7cd('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xc7cd('0x6')]},'channel':{'type':Sequelize[_0xc7cd('0x6')]},'value':{'type':Sequelize[_0xc7cd('0x6')],'set':function(_0x2c168c){var _0x13ffeb=_0x2c168c[_0xc7cd('0x7')](/\\/g,'/');this[_0xc7cd('0x8')]('value',_0x13ffeb);}},'rating':{'type':Sequelize[_0xc7cd('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x36d8b9){this[_0xc7cd('0x8')](_0xc7cd('0xa'),moment()[_0xc7cd('0xb')](_0x36d8b9,'ms'));this['setDataValue'](_0xc7cd('0xc'),moment());this[_0xc7cd('0x8')](_0xc7cd('0xd'),_0x36d8b9);}},'startedAt':{'type':Sequelize[_0xc7cd('0xe')],'get':function(){return moment(this['getDataValue'](_0xc7cd('0xa')))['format'](_0xc7cd('0xf'))[_0xc7cd('0x10')]();}},'closedAt':{'type':Sequelize[_0xc7cd('0xe')],'get':function(){return moment(this[_0xc7cd('0x4')]('closedAt'))[_0xc7cd('0x11')](_0xc7cd('0xf'))['toString']();}},'createdAt':{'type':Sequelize[_0xc7cd('0xe')],'get':function(){return moment(this['getDataValue'](_0xc7cd('0x12')))['format'](_0xc7cd('0xf'))[_0xc7cd('0x10')]();}},'updatedAt':{'type':Sequelize[_0xc7cd('0xe')],'get':function(){return moment(this[_0xc7cd('0x4')]('updatedAt'))[_0xc7cd('0x11')](_0xc7cd('0xf'))[_0xc7cd('0x10')]();}}}; \ No newline at end of file +var _0x084b=['format','createdAt','MM-DD-YYYY\x20HH:mm','updatedAt','sequelize','exports','VIRTUAL','value','extname','getDataValue','STRING','INTEGER','setDataValue','startedAt','subtract','closedAt','duration','DATE','toString'];(function(_0x5d716d,_0x5102c2){var _0x223c29=function(_0x1f0974){while(--_0x1f0974){_0x5d716d['push'](_0x5d716d['shift']());}};_0x223c29(++_0x5102c2);}(_0x084b,0xd5));var _0xb084=function(_0x45f646,_0x27d415){_0x45f646=_0x45f646-0x0;var _0x1d0d8a=_0x084b[_0x45f646];return _0x1d0d8a;};'use strict';var Sequelize=require(_0xb084('0x0'));var moment=require('moment');var path=require('path');var config=require('../../config/environment');module[_0xb084('0x1')]={'format':{'type':Sequelize[_0xb084('0x2')],'get':function(){return this['getDataValue'](_0xb084('0x3'))?path[_0xb084('0x4')](this[_0xb084('0x5')]('value')):undefined;}},'interactionid':{'type':Sequelize[_0xb084('0x6')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0xb084('0x6')],'set':function(_0x449c7a){var _0x275c8c=_0x449c7a['replace'](/\\/g,'/');this['setDataValue'](_0xb084('0x3'),_0x275c8c);}},'rating':{'type':Sequelize[_0xb084('0x7')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0xb084('0x7')],'set':function(_0xec1e0d){this[_0xb084('0x8')](_0xb084('0x9'),moment()[_0xb084('0xa')](_0xec1e0d,'ms'));this[_0xb084('0x8')](_0xb084('0xb'),moment());this[_0xb084('0x8')](_0xb084('0xc'),_0xec1e0d);}},'startedAt':{'type':Sequelize[_0xb084('0xd')],'get':function(){return moment(this[_0xb084('0x5')](_0xb084('0x9')))['format']('MM-DD-YYYY\x20HH:mm')[_0xb084('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0xb084('0xb')))[_0xb084('0xf')]('MM-DD-YYYY\x20HH:mm')['toString']();}},'createdAt':{'type':Sequelize[_0xb084('0xd')],'get':function(){return moment(this[_0xb084('0x5')](_0xb084('0x10')))[_0xb084('0xf')](_0xb084('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0xb084('0xd')],'get':function(){return moment(this[_0xb084('0x5')](_0xb084('0x12')))[_0xb084('0xf')](_0xb084('0x11'))[_0xb084('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index f8d6d9a..1c10efe 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 _0x008c=['papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','save','update','then','destroy','sendStatus','send','index','ScreenRecording','rawAttributes','key','model','differenceBy','map','name','format','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','includeAll','find','create','body','duration','createdAt','closedAt','describe','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','decryptFile','secrets','recording','existsSync','ValidationError','filename','download','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','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','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x008c,0x188));var _0xc008=function(_0x553c78,_0x4656c2){_0x553c78=_0x553c78-0x0;var _0x2f68c5=_0x008c[_0x553c78];return _0x2f68c5;};'use strict';var emlformat=require(_0xc008('0x0'));var rimraf=require(_0xc008('0x1'));var zipdir=require(_0xc008('0x2'));var jsonpatch=require(_0xc008('0x3'));var rp=require(_0xc008('0x4'));var moment=require('moment');var BPromise=require(_0xc008('0x5'));var Mustache=require(_0xc008('0x6'));var util=require(_0xc008('0x7'));var path=require(_0xc008('0x8'));var sox=require(_0xc008('0x9'));var csv=require(_0xc008('0xa'));var ejs=require(_0xc008('0xb'));var fs=require('fs');var fs_extra=require(_0xc008('0xc'));var _=require(_0xc008('0xd'));var squel=require('squel');var crypto=require(_0xc008('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc008('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc008('0x10'));var Redis=require(_0xc008('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc008('0x12'));var logger=require(_0xc008('0x13'))('api');var utils=require(_0xc008('0x14'));var config=require(_0xc008('0x15'));var licenseUtil=require(_0xc008('0x16'));var db=require(_0xc008('0x17'))['db'];function respondWithStatusCode(_0x9ffa93,_0x1819c6){_0x1819c6=_0x1819c6||0xcc;return function(_0x69726e){if(_0x69726e){return _0x9ffa93['sendStatus'](_0x1819c6);}return _0x9ffa93['status'](_0x1819c6)[_0xc008('0x18')]();};}function respondWithResult(_0x50c1ab,_0x25e13f){_0x25e13f=_0x25e13f||0xc8;return function(_0x4584e1){if(_0x4584e1){return _0x50c1ab[_0xc008('0x19')](_0x25e13f)[_0xc008('0x1a')](_0x4584e1);}};}function respondWithFilteredResult(_0x3f0ecf,_0x5ee00b){return function(_0x5e894e){if(_0x5e894e){var _0x4bd0f4=typeof _0x5ee00b[_0xc008('0x1b')]===_0xc008('0x1c')&&typeof _0x5ee00b[_0xc008('0x1d')]===_0xc008('0x1c');var _0x4fe771=_0x5e894e['count'];var _0x540e45=_0x4bd0f4?0x0:_0x5ee00b['offset'];var _0x46042b=_0x4bd0f4?_0x5e894e[_0xc008('0x1e')]:_0x5ee00b['offset']+_0x5ee00b[_0xc008('0x1d')];var _0x5906e6;if(_0x46042b>=_0x4fe771){_0x46042b=_0x4fe771;_0x5906e6=0xc8;}else{_0x5906e6=0xce;}_0x3f0ecf['status'](_0x5906e6);return _0x3f0ecf['set']('Content-Range',_0x540e45+'-'+_0x46042b+'/'+_0x4fe771)[_0xc008('0x1a')](_0x5e894e);}return null;};}function patchUpdates(_0x4b9726){return function(_0x5560b1){try{jsonpatch['apply'](_0x5560b1,_0x4b9726,!![]);}catch(_0x4a582d){return BPromise['reject'](_0x4a582d);}return _0x5560b1[_0xc008('0x1f')]();};}function saveUpdates(_0x4777a6,_0x251db2){return function(_0x415af3){if(_0x415af3){return _0x415af3[_0xc008('0x20')](_0x4777a6)[_0xc008('0x21')](function(_0x4f43e2){return _0x4f43e2;});}return null;};}function removeEntity(_0x459fd9,_0x5c85f2){return function(_0x58a6ea){if(_0x58a6ea){return _0x58a6ea[_0xc008('0x22')]()[_0xc008('0x21')](function(){_0x459fd9[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();});}};}function handleEntityNotFound(_0x5410f5,_0x48582b){return function(_0x5de1e9){if(!_0x5de1e9){_0x5410f5[_0xc008('0x23')](0x194);}return _0x5de1e9;};}function handleError(_0x15dade,_0x92c582){_0x92c582=_0x92c582||0x1f4;return function(_0x2e31c2){logger['error'](_0x2e31c2['stack']);if(_0x2e31c2['name']){delete _0x2e31c2['name'];}_0x15dade['status'](_0x92c582)[_0xc008('0x24')](_0x2e31c2);};}exports[_0xc008('0x25')]=function(_0x25eae4,_0x529961){var _0x24c14c={},_0x32390d={},_0x209591={'count':0x0,'rows':[]};var _0x2a7d4f=_['map'](db[_0xc008('0x26')][_0xc008('0x27')],function(_0x53ed35){return{'name':_0x53ed35['fieldName'],'type':_0x53ed35['type'][_0xc008('0x28')]};});_0x32390d[_0xc008('0x29')]=_[_0xc008('0x2a')](_[_0xc008('0x2b')](_0x2a7d4f,_0xc008('0x2c')),[_0xc008('0x2d')]);_0x32390d[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x25eae4[_0xc008('0x2e')]);_0x32390d[_0xc008('0x30')]=_[_0xc008('0x31')](_0x32390d[_0xc008('0x29')],_0x32390d['query']);_0x24c14c[_0xc008('0x32')]=_[_0xc008('0x31')](_0x32390d['model'],qs[_0xc008('0x33')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x33')]));_0x24c14c[_0xc008('0x32')]=_0x24c14c[_0xc008('0x32')][_0xc008('0x34')]?_0x24c14c[_0xc008('0x32')]:_0x32390d[_0xc008('0x29')];if(!_0x25eae4[_0xc008('0x2e')]['hasOwnProperty'](_0xc008('0x35'))){_0x24c14c[_0xc008('0x1d')]=qs[_0xc008('0x1d')](_0x25eae4[_0xc008('0x2e')][_0xc008('0x1d')]);_0x24c14c[_0xc008('0x1b')]=qs[_0xc008('0x1b')](_0x25eae4['query'][_0xc008('0x1b')]);}_0x24c14c[_0xc008('0x36')]=qs['sort'](_0x25eae4[_0xc008('0x2e')][_0xc008('0x37')]);_0x24c14c['where']=qs[_0xc008('0x30')](_[_0xc008('0x38')](_0x25eae4[_0xc008('0x2e')],_0x32390d['filters']),_0x2a7d4f);if(_0x25eae4['query']['filter']){_0x24c14c[_0xc008('0x39')]=_['merge'](_0x24c14c[_0xc008('0x39')],{'$or':_[_0xc008('0x2b')](_0x2a7d4f,function(_0x6a4ccb){if(_0x6a4ccb[_0xc008('0x3a')]!==_0xc008('0x3b')){var _0xa381d1={};_0xa381d1[_0x6a4ccb[_0xc008('0x2c')]]={'$like':'%'+_0x25eae4[_0xc008('0x2e')][_0xc008('0x3c')]+'%'};return _0xa381d1;}})});}_0x24c14c=_[_0xc008('0x3d')]({},_0x24c14c,_0x25eae4[_0xc008('0x3e')]);var _0xdfca2e={'where':_0x24c14c[_0xc008('0x39')]};return db[_0xc008('0x26')]['count'](_0xdfca2e)[_0xc008('0x21')](function(_0x23c4db){_0x209591[_0xc008('0x1e')]=_0x23c4db;if(_0x25eae4[_0xc008('0x2e')]['includeAll']){_0x24c14c[_0xc008('0x3f')]=[{'all':!![]}];}return db[_0xc008('0x26')][_0xc008('0x40')](_0x24c14c);})[_0xc008('0x21')](function(_0x2d142d){_0x209591['rows']=_0x2d142d;return _0x209591;})[_0xc008('0x21')](respondWithFilteredResult(_0x529961,_0x24c14c))[_0xc008('0x41')](handleError(_0x529961,null));};exports[_0xc008('0x42')]=function(_0x3e9a99,_0x7279e8){var _0x4f93a4={'raw':![],'where':{'id':_0x3e9a99[_0xc008('0x43')]['id']}},_0xf4cc4b={};_0xf4cc4b[_0xc008('0x29')]=_[_0xc008('0x2f')](db['ScreenRecording'][_0xc008('0x27')]);_0xf4cc4b[_0xc008('0x2e')]=_[_0xc008('0x2f')](_0x3e9a99['query']);_0xf4cc4b[_0xc008('0x30')]=_['intersection'](_0xf4cc4b[_0xc008('0x29')],_0xf4cc4b['query']);_0x4f93a4[_0xc008('0x32')]=_[_0xc008('0x31')](_0xf4cc4b['model'],qs[_0xc008('0x33')](_0x3e9a99[_0xc008('0x2e')][_0xc008('0x33')]));_0x4f93a4['attributes']=_0x4f93a4[_0xc008('0x32')][_0xc008('0x34')]?_0x4f93a4[_0xc008('0x32')]:_0xf4cc4b[_0xc008('0x29')];if(_0x3e9a99[_0xc008('0x2e')][_0xc008('0x44')]){_0x4f93a4['include']=[{'all':!![]}];}_0x4f93a4=_['merge']({},_0x4f93a4,_0x3e9a99['options']);return db[_0xc008('0x26')][_0xc008('0x45')](_0x4f93a4)[_0xc008('0x21')](handleEntityNotFound(_0x7279e8,null))[_0xc008('0x21')](respondWithResult(_0x7279e8,null))[_0xc008('0x41')](handleError(_0x7279e8,null));};exports[_0xc008('0x46')]=function(_0x2cf641,_0x33be4f){return db['ScreenRecording']['create'](_0x2cf641['body'],{})[_0xc008('0x21')](respondWithResult(_0x33be4f,0xc9))[_0xc008('0x41')](handleError(_0x33be4f,null));};exports[_0xc008('0x20')]=function(_0x511383,_0x28bc33){if(_0x511383[_0xc008('0x47')]['id']){delete _0x511383[_0xc008('0x47')]['id'];}delete _0x511383[_0xc008('0x47')][_0xc008('0x48')];delete _0x511383[_0xc008('0x47')][_0xc008('0x49')];delete _0x511383[_0xc008('0x47')][_0xc008('0x4a')];delete _0x511383[_0xc008('0x47')]['value'];return db['ScreenRecording'][_0xc008('0x45')]({'where':{'id':_0x511383['params']['id']}})[_0xc008('0x21')](handleEntityNotFound(_0x28bc33,null))[_0xc008('0x21')](saveUpdates(_0x511383[_0xc008('0x47')],null))['then'](respondWithResult(_0x28bc33,null))[_0xc008('0x41')](handleError(_0x28bc33,null));};exports[_0xc008('0x4b')]=function(_0xee64,_0x8b9775){return db[_0xc008('0x26')]['describe']()[_0xc008('0x21')](respondWithResult(_0x8b9775,null))[_0xc008('0x41')](handleError(_0x8b9775,null));};exports['download']=function(_0x24f775,_0xfd6d1d,_0x5b5fbf){var _0x51d3dc=require(_0xc008('0x4c'));var _0xd47b74=![];var _0x20947b={};if(_0x24f775[_0xc008('0x2e')][_0xc008('0x3a')]&&_0x24f775['query']['type']===_0xc008('0x4d')){_0x20947b['uniqueid']=_0x24f775[_0xc008('0x43')]['id'];}else{_0x20947b['id']=_0x24f775[_0xc008('0x43')]['id'];}return db[_0xc008('0x26')][_0xc008('0x45')]({'where':_0x20947b,'attributes':['id',_0xc008('0x4e')],'raw':!![]})[_0xc008('0x21')](handleEntityNotFound(_0xfd6d1d,null))['then'](function(_0x2ea742){if(_0x2ea742){var _0xbd7422=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x2ea742['value']);var _0x41fae3=util['format']('%s.cypher',_0xbd7422);if(fs['existsSync'](_0x41fae3)){_0xd47b74=!![];return _0x51d3dc[_0xc008('0x52')](_0x41fae3,_0xbd7422,config[_0xc008('0x53')][_0xc008('0x54')])['then'](function(){return _0x2ea742;});}return _0x2ea742;}})[_0xc008('0x21')](function(_0x2d8361){if(_0x2d8361){var _0x3dda82=path['join'](config[_0xc008('0x50')],_0xc008('0x51'),_0x2d8361[_0xc008('0x4e')]);if(!fs[_0xc008('0x55')](_0x3dda82)){throw new db['Sequelize'][(_0xc008('0x56'))]('ScreenRecording\x20not\x20found');}if(_0x2d8361[_0xc008('0x57')]){return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,_0x2d8361[_0xc008('0x57')]+path[_0xc008('0x59')](_0x3dda82),function(){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}else{return _0xfd6d1d[_0xc008('0x58')](_0x3dda82,function(_0x4818c7){if(_0xd47b74){fs[_0xc008('0x5a')](_0x3dda82);}});}}})['catch'](function(_0x5bf4a9){if(_0x5bf4a9[_0xc008('0x5b')]===_0xc008('0x5c')){_0xfd6d1d['status'](0x194)[_0xc008('0x24')](_0xc008('0x5d'));}else{return handleError(_0xfd6d1d,null);}});};exports[_0xc008('0x22')]=function(_0x4517c0,_0x21ee6d){return db[_0xc008('0x26')][_0xc008('0x45')]({'where':{'id':_0x4517c0['params']['id']}})[_0xc008('0x21')](function(_0x462e1e){if(_[_0xc008('0x5e')](_0x462e1e)){throw new ReferenceError(_0xc008('0x5f'));}return _0x462e1e;})[_0xc008('0x21')](function(_0x167425){var _0x249898=path[_0xc008('0x4f')](config[_0xc008('0x50')],_0xc008('0x51'),_0x167425[_0xc008('0x4e')]);logger[_0xc008('0x60')](_0xc008('0x61'),_0x249898);if(!_[_0xc008('0x5e')](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xc008('0x63')](_0x249898);}_0x249898=_0x249898+_0xc008('0x64');if(!_['isNil'](_0x167425['value'])&&fs[_0xc008('0x55')](_0x249898)){logger[_0xc008('0x60')](_0xc008('0x62')+_0x249898+_0xc008('0x65'));fs[_0xc008('0x63')](_0x249898);}return _0x167425;})[_0xc008('0x21')](function(_0x238852){if(!_0x238852)throw new InternalError();return _0x238852[_0xc008('0x22')]();})[_0xc008('0x21')](function(){_0x21ee6d[_0xc008('0x19')](0xcc)[_0xc008('0x18')]();})['catch'](handleError(_0x21ee6d,null));}; \ No newline at end of file +var _0x3e74=['to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','end','json','undefined','limit','offset','count','status','set','Content-Range','apply','save','update','then','destroy','sendStatus','name','send','index','map','ScreenRecording','rawAttributes','fieldName','type','key','model','differenceBy','format','query','keys','filters','attributes','intersection','fields','length','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','show','params','catch','create','body','duration','createdAt','closedAt','describe','download','../../components/encryptor','uniqueid','find','value','join','root','decryptFile','secrets','server/files/screen_recordings','Sequelize','ValidationError','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','existsSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox'];(function(_0x194499,_0x27658a){var _0x298ffa=function(_0x2ac2a4){while(--_0x2ac2a4){_0x194499['push'](_0x194499['shift']());}};_0x298ffa(++_0x27658a);}(_0x3e74,0x175));var _0x43e7=function(_0x3161b5,_0x50a1f4){_0x3161b5=_0x3161b5-0x0;var _0x223ad5=_0x3e74[_0x3161b5];return _0x223ad5;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];function respondWithStatusCode(_0xc960ea,_0x2718d3){_0x2718d3=_0x2718d3||0xcc;return function(_0x3bb83f){if(_0x3bb83f){return _0xc960ea['sendStatus'](_0x2718d3);}return _0xc960ea['status'](_0x2718d3)[_0x43e7('0x15')]();};}function respondWithResult(_0x21fdd3,_0x44b0bd){_0x44b0bd=_0x44b0bd||0xc8;return function(_0x51b974){if(_0x51b974){return _0x21fdd3['status'](_0x44b0bd)[_0x43e7('0x16')](_0x51b974);}};}function respondWithFilteredResult(_0x14c146,_0x203378){return function(_0x328445){if(_0x328445){var _0x4de324=typeof _0x203378['offset']===_0x43e7('0x17')&&typeof _0x203378[_0x43e7('0x18')]===_0x43e7('0x17');var _0x5d346f=_0x328445['count'];var _0x446986=_0x4de324?0x0:_0x203378[_0x43e7('0x19')];var _0x9037d3=_0x4de324?_0x328445[_0x43e7('0x1a')]:_0x203378[_0x43e7('0x19')]+_0x203378[_0x43e7('0x18')];var _0x619236;if(_0x9037d3>=_0x5d346f){_0x9037d3=_0x5d346f;_0x619236=0xc8;}else{_0x619236=0xce;}_0x14c146[_0x43e7('0x1b')](_0x619236);return _0x14c146[_0x43e7('0x1c')](_0x43e7('0x1d'),_0x446986+'-'+_0x9037d3+'/'+_0x5d346f)[_0x43e7('0x16')](_0x328445);}return null;};}function patchUpdates(_0x177ee1){return function(_0x4b5d64){try{jsonpatch[_0x43e7('0x1e')](_0x4b5d64,_0x177ee1,!![]);}catch(_0x3c6625){return BPromise['reject'](_0x3c6625);}return _0x4b5d64[_0x43e7('0x1f')]();};}function saveUpdates(_0x3e281e,_0x3945bb){return function(_0x28aacc){if(_0x28aacc){return _0x28aacc[_0x43e7('0x20')](_0x3e281e)[_0x43e7('0x21')](function(_0x54a9e7){return _0x54a9e7;});}return null;};}function removeEntity(_0x454359,_0x4eea52){return function(_0x4c9df3){if(_0x4c9df3){return _0x4c9df3[_0x43e7('0x22')]()[_0x43e7('0x21')](function(){_0x454359['status'](0xcc)[_0x43e7('0x15')]();});}};}function handleEntityNotFound(_0x4ca5cf,_0x326dab){return function(_0x5c5e67){if(!_0x5c5e67){_0x4ca5cf[_0x43e7('0x23')](0x194);}return _0x5c5e67;};}function handleError(_0x1b5f50,_0x20888b){_0x20888b=_0x20888b||0x1f4;return function(_0x405f85){logger['error'](_0x405f85['stack']);if(_0x405f85[_0x43e7('0x24')]){delete _0x405f85['name'];}_0x1b5f50[_0x43e7('0x1b')](_0x20888b)[_0x43e7('0x25')](_0x405f85);};}exports[_0x43e7('0x26')]=function(_0xb1fc63,_0x5087d7){var _0x33a1a5={},_0x4690a6={},_0x45b675={'count':0x0,'rows':[]};var _0x50f9f5=_[_0x43e7('0x27')](db[_0x43e7('0x28')][_0x43e7('0x29')],function(_0x31b2a6){return{'name':_0x31b2a6[_0x43e7('0x2a')],'type':_0x31b2a6[_0x43e7('0x2b')][_0x43e7('0x2c')]};});_0x4690a6[_0x43e7('0x2d')]=_[_0x43e7('0x2e')](_[_0x43e7('0x27')](_0x50f9f5,'name'),[_0x43e7('0x2f')]);_0x4690a6[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0xb1fc63[_0x43e7('0x30')]);_0x4690a6[_0x43e7('0x32')]=_['intersection'](_0x4690a6[_0x43e7('0x2d')],_0x4690a6[_0x43e7('0x30')]);_0x33a1a5[_0x43e7('0x33')]=_[_0x43e7('0x34')](_0x4690a6['model'],qs['fields'](_0xb1fc63['query'][_0x43e7('0x35')]));_0x33a1a5[_0x43e7('0x33')]=_0x33a1a5[_0x43e7('0x33')][_0x43e7('0x36')]?_0x33a1a5[_0x43e7('0x33')]:_0x4690a6[_0x43e7('0x2d')];if(!_0xb1fc63['query']['hasOwnProperty']('nolimit')){_0x33a1a5['limit']=qs['limit'](_0xb1fc63['query']['limit']);_0x33a1a5[_0x43e7('0x19')]=qs['offset'](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x19')]);}_0x33a1a5[_0x43e7('0x37')]=qs[_0x43e7('0x38')](_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x38')]);_0x33a1a5[_0x43e7('0x39')]=qs['filters'](_['pick'](_0xb1fc63['query'],_0x4690a6[_0x43e7('0x32')]),_0x50f9f5);if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3a')]){_0x33a1a5[_0x43e7('0x39')]=_[_0x43e7('0x3b')](_0x33a1a5[_0x43e7('0x39')],{'$or':_[_0x43e7('0x27')](_0x50f9f5,function(_0x2ffd43){if(_0x2ffd43['type']!==_0x43e7('0x3c')){var _0x2b0ffe={};_0x2b0ffe[_0x2ffd43['name']]={'$like':'%'+_0xb1fc63[_0x43e7('0x30')]['filter']+'%'};return _0x2b0ffe;}})});}_0x33a1a5=_[_0x43e7('0x3b')]({},_0x33a1a5,_0xb1fc63[_0x43e7('0x3d')]);var _0x1c6f45={'where':_0x33a1a5[_0x43e7('0x39')]};return db[_0x43e7('0x28')][_0x43e7('0x1a')](_0x1c6f45)['then'](function(_0x574a93){_0x45b675[_0x43e7('0x1a')]=_0x574a93;if(_0xb1fc63[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x33a1a5[_0x43e7('0x3f')]=[{'all':!![]}];}return db[_0x43e7('0x28')]['findAll'](_0x33a1a5);})[_0x43e7('0x21')](function(_0x4227c4){_0x45b675['rows']=_0x4227c4;return _0x45b675;})[_0x43e7('0x21')](respondWithFilteredResult(_0x5087d7,_0x33a1a5))['catch'](handleError(_0x5087d7,null));};exports[_0x43e7('0x40')]=function(_0x504101,_0x3d81ae){var _0x3b4235={'raw':![],'where':{'id':_0x504101[_0x43e7('0x41')]['id']}},_0x3a5807={};_0x3a5807['model']=_['keys'](db[_0x43e7('0x28')][_0x43e7('0x29')]);_0x3a5807[_0x43e7('0x30')]=_[_0x43e7('0x31')](_0x504101['query']);_0x3a5807['filters']=_['intersection'](_0x3a5807[_0x43e7('0x2d')],_0x3a5807['query']);_0x3b4235[_0x43e7('0x33')]=_['intersection'](_0x3a5807['model'],qs[_0x43e7('0x35')](_0x504101['query'][_0x43e7('0x35')]));_0x3b4235[_0x43e7('0x33')]=_0x3b4235[_0x43e7('0x33')][_0x43e7('0x36')]?_0x3b4235['attributes']:_0x3a5807[_0x43e7('0x2d')];if(_0x504101[_0x43e7('0x30')][_0x43e7('0x3e')]){_0x3b4235[_0x43e7('0x3f')]=[{'all':!![]}];}_0x3b4235=_[_0x43e7('0x3b')]({},_0x3b4235,_0x504101[_0x43e7('0x3d')]);return db['ScreenRecording']['find'](_0x3b4235)[_0x43e7('0x21')](handleEntityNotFound(_0x3d81ae,null))[_0x43e7('0x21')](respondWithResult(_0x3d81ae,null))[_0x43e7('0x42')](handleError(_0x3d81ae,null));};exports['create']=function(_0x5c1c18,_0x56489b){return db[_0x43e7('0x28')][_0x43e7('0x43')](_0x5c1c18['body'],{})[_0x43e7('0x21')](respondWithResult(_0x56489b,0xc9))[_0x43e7('0x42')](handleError(_0x56489b,null));};exports[_0x43e7('0x20')]=function(_0x560329,_0x593155){if(_0x560329['body']['id']){delete _0x560329['body']['id'];}delete _0x560329[_0x43e7('0x44')][_0x43e7('0x45')];delete _0x560329['body'][_0x43e7('0x46')];delete _0x560329[_0x43e7('0x44')][_0x43e7('0x47')];delete _0x560329[_0x43e7('0x44')]['value'];return db[_0x43e7('0x28')]['find']({'where':{'id':_0x560329['params']['id']}})[_0x43e7('0x21')](handleEntityNotFound(_0x593155,null))[_0x43e7('0x21')](saveUpdates(_0x560329[_0x43e7('0x44')],null))[_0x43e7('0x21')](respondWithResult(_0x593155,null))[_0x43e7('0x42')](handleError(_0x593155,null));};exports[_0x43e7('0x48')]=function(_0x1cd87c,_0x256ddd){return db[_0x43e7('0x28')][_0x43e7('0x48')]()['then'](respondWithResult(_0x256ddd,null))[_0x43e7('0x42')](handleError(_0x256ddd,null));};exports[_0x43e7('0x49')]=function(_0x499c03,_0x39e3ca,_0x4e6f6d){var _0x35b799=require(_0x43e7('0x4a'));var _0x34e2ec=![];var _0x1f561f={};if(_0x499c03[_0x43e7('0x30')]['type']&&_0x499c03['query'][_0x43e7('0x2b')]===_0x43e7('0x4b')){_0x1f561f[_0x43e7('0x4b')]=_0x499c03[_0x43e7('0x41')]['id'];}else{_0x1f561f['id']=_0x499c03[_0x43e7('0x41')]['id'];}return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':_0x1f561f,'attributes':['id',_0x43e7('0x4d')],'raw':!![]})[_0x43e7('0x21')](handleEntityNotFound(_0x39e3ca,null))[_0x43e7('0x21')](function(_0x312306){if(_0x312306){var _0x4ace49=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],'server/files/screen_recordings',_0x312306[_0x43e7('0x4d')]);var _0x220bf2=util[_0x43e7('0x2f')]('%s.cypher',_0x4ace49);if(fs['existsSync'](_0x220bf2)){_0x34e2ec=!![];return _0x35b799[_0x43e7('0x50')](_0x220bf2,_0x4ace49,config[_0x43e7('0x51')]['recording'])[_0x43e7('0x21')](function(){return _0x312306;});}return _0x312306;}})['then'](function(_0x49a6ce){if(_0x49a6ce){var _0x1fa3f6=path[_0x43e7('0x4e')](config[_0x43e7('0x4f')],_0x43e7('0x52'),_0x49a6ce[_0x43e7('0x4d')]);if(!fs['existsSync'](_0x1fa3f6)){throw new db[(_0x43e7('0x53'))][(_0x43e7('0x54'))]('ScreenRecording\x20not\x20found');}if(_0x49a6ce[_0x43e7('0x55')]){return _0x39e3ca[_0x43e7('0x49')](_0x1fa3f6,_0x49a6ce[_0x43e7('0x55')]+path['extname'](_0x1fa3f6),function(){if(_0x34e2ec){fs['unlink'](_0x1fa3f6);}});}else{return _0x39e3ca['download'](_0x1fa3f6,function(_0x2ada55){if(_0x34e2ec){fs[_0x43e7('0x56')](_0x1fa3f6);}});}}})[_0x43e7('0x42')](function(_0x3a6404){if(_0x3a6404['message']==='ScreenRecording\x20not\x20found'){_0x39e3ca[_0x43e7('0x1b')](0x194)[_0x43e7('0x25')](_0x43e7('0x57'));}else{return handleError(_0x39e3ca,null);}});};exports[_0x43e7('0x22')]=function(_0x5ea0db,_0x4438c0){return db[_0x43e7('0x28')][_0x43e7('0x4c')]({'where':{'id':_0x5ea0db[_0x43e7('0x41')]['id']}})[_0x43e7('0x21')](function(_0xd41e79){if(_[_0x43e7('0x58')](_0xd41e79)){throw new ReferenceError(_0x43e7('0x59'));}return _0xd41e79;})[_0x43e7('0x21')](function(_0x381208){var _0x252f00=path['join'](config['root'],_0x43e7('0x52'),_0x381208['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x252f00);if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs['existsSync'](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}_0x252f00=_0x252f00+_0x43e7('0x5d');if(!_[_0x43e7('0x58')](_0x381208[_0x43e7('0x4d')])&&fs[_0x43e7('0x5e')](_0x252f00)){logger[_0x43e7('0x5a')](_0x43e7('0x5b')+_0x252f00+_0x43e7('0x5c'));fs['unlinkSync'](_0x252f00);}return _0x381208;})[_0x43e7('0x21')](function(_0x40d0c0){if(!_0x40d0c0)throw new InternalError();return _0x40d0c0[_0x43e7('0x22')]();})['then'](function(){_0x4438c0['status'](0xcc)[_0x43e7('0x15')]();})['catch'](handleError(_0x4438c0,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index 38fd092..278d847 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 _0x8cde=['path','rimraf','../../config/environment','./screenRecording.attributes','ScreenRecording','screen_recordings','interactionid','lodash','util','api','moment','bluebird'];(function(_0x85d478,_0x333b11){var _0x4d5a85=function(_0x324277){while(--_0x324277){_0x85d478['push'](_0x85d478['shift']());}};_0x4d5a85(++_0x333b11);}(_0x8cde,0x1f3));var _0xe8cd=function(_0x2dd22e,_0xec41fe){_0x2dd22e=_0x2dd22e-0x0;var _0x257b01=_0x8cde[_0x2dd22e];return _0x257b01;};'use strict';var _=require(_0xe8cd('0x0'));var util=require(_0xe8cd('0x1'));var logger=require('../../config/logger')(_0xe8cd('0x2'));var moment=require(_0xe8cd('0x3'));var BPromise=require(_0xe8cd('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe8cd('0x5'));var rimraf=require(_0xe8cd('0x6'));var config=require(_0xe8cd('0x7'));var attributes=require(_0xe8cd('0x8'));module['exports']=function(_0x23330b,_0x39ec21){return _0x23330b['define'](_0xe8cd('0x9'),attributes,{'tableName':_0xe8cd('0xa'),'paranoid':![],'indexes':[{'name':_0xe8cd('0xb'),'fields':[_0xe8cd('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8b4a=['bluebird','request-promise','path','rimraf','exports','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment'];(function(_0xffe100,_0x19a361){var _0x1ce383=function(_0x4c9513){while(--_0x4c9513){_0xffe100['push'](_0xffe100['shift']());}};_0x1ce383(++_0x19a361);}(_0x8b4a,0x1e7));var _0xa8b4=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x8b4a[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0xa8b4('0x0'));var util=require(_0xa8b4('0x1'));var logger=require(_0xa8b4('0x2'))(_0xa8b4('0x3'));var moment=require(_0xa8b4('0x4'));var BPromise=require(_0xa8b4('0x5'));var rp=require(_0xa8b4('0x6'));var fs=require('fs');var path=require(_0xa8b4('0x7'));var rimraf=require(_0xa8b4('0x8'));var config=require('../../config/environment');var attributes=require('./screenRecording.attributes');module[_0xa8b4('0x9')]=function(_0x2358c2,_0x419d70){return _0x2358c2['define'](_0xa8b4('0xa'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0xa8b4('0xb'),'fields':[_0xa8b4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index f8e3cfd..9d4b1f0 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 _0x4dbe=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','debug','error','code','ScreenRecording,\x20%s,\x20%s','message','info','request\x20sent','catch','lodash','moment','bluebird','randomstring'];(function(_0x48b222,_0x356d90){var _0x3606d1=function(_0xda823e){while(--_0xda823e){_0x48b222['push'](_0x48b222['shift']());}};_0x3606d1(++_0x356d90);}(_0x4dbe,0xb0));var _0xe4db=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4dbe[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0xe4db('0x0'));var util=require('util');var moment=require(_0xe4db('0x1'));var BPromise=require(_0xe4db('0x2'));var rs=require(_0xe4db('0x3'));var fs=require('fs');var Redis=require(_0xe4db('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe4db('0x5'));var logger=require(_0xe4db('0x6'))(_0xe4db('0x7'));var config=require(_0xe4db('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe4db('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x278424,_0x1ff200,_0x7fa79){return new BPromise(function(_0x133e7b,_0x2e9e6a){return client[_0xe4db('0xa')](_0x278424,_0x7fa79)[_0xe4db('0xb')](function(_0x4ec80c){logger['info']('ScreenRecording,\x20%s,\x20%s',_0x1ff200,'request\x20sent');logger[_0xe4db('0xc')]('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x1ff200,'request\x20sent',JSON['stringify'](_0x4ec80c));if(_0x4ec80c[_0xe4db('0xd')]){if(_0x4ec80c[_0xe4db('0xd')][_0xe4db('0xe')]===0x1f4){logger['error'](_0xe4db('0xf'),_0x1ff200,_0x4ec80c[_0xe4db('0xd')][_0xe4db('0x10')]);return _0x2e9e6a(_0x4ec80c['error'][_0xe4db('0x10')]);}logger['error'](_0xe4db('0xf'),_0x1ff200,_0x4ec80c['error'][_0xe4db('0x10')]);return _0x133e7b(_0x4ec80c[_0xe4db('0xd')][_0xe4db('0x10')]);}else{logger[_0xe4db('0x11')](_0xe4db('0xf'),_0x1ff200,_0xe4db('0x12'));_0x133e7b(_0x4ec80c['result']['message']);}})[_0xe4db('0x13')](function(_0x56fedb){logger[_0xe4db('0xd')](_0xe4db('0xf'),_0x1ff200,_0x56fedb);_0x2e9e6a(_0x56fedb);});});} \ No newline at end of file +var _0x4758=['lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','stringify','error','message'];(function(_0x1aa055,_0x296de2){var _0x181893=function(_0xd6d2c1){while(--_0xd6d2c1){_0x1aa055['push'](_0x1aa055['shift']());}};_0x181893(++_0x296de2);}(_0x4758,0x1ba));var _0x8475=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4758[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8475('0x0'));var util=require(_0x8475('0x1'));var moment=require(_0x8475('0x2'));var BPromise=require('bluebird');var rs=require(_0x8475('0x3'));var fs=require('fs');var Redis=require(_0x8475('0x4'));var db=require(_0x8475('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8475('0x6'))(_0x8475('0x7'));var config=require(_0x8475('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8475('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x579b5e,_0x3235b7,_0x2aedcb){return new BPromise(function(_0x5125ab,_0x1d6629){return client[_0x8475('0xa')](_0x579b5e,_0x2aedcb)['then'](function(_0x52ba01){logger[_0x8475('0xb')](_0x8475('0xc'),_0x3235b7,_0x8475('0xd'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x3235b7,'request\x20sent',JSON[_0x8475('0xe')](_0x52ba01));if(_0x52ba01[_0x8475('0xf')]){if(_0x52ba01[_0x8475('0xf')]['code']===0x1f4){logger[_0x8475('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x3235b7,_0x52ba01[_0x8475('0xf')]['message']);return _0x1d6629(_0x52ba01['error'][_0x8475('0x10')]);}logger['error'](_0x8475('0xc'),_0x3235b7,_0x52ba01[_0x8475('0xf')][_0x8475('0x10')]);return _0x5125ab(_0x52ba01[_0x8475('0xf')]['message']);}else{logger['info'](_0x8475('0xc'),_0x3235b7,_0x8475('0xd'));_0x5125ab(_0x52ba01['result'][_0x8475('0x10')]);}})['catch'](function(_0x44bb24){logger[_0x8475('0xf')](_0x8475('0xc'),_0x3235b7,_0x44bb24);_0x1d6629(_0x44bb24);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index f89629a..55d6186 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 _0x5fc4=['/now','/:id','show','/:id/logo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','join','server/files/images/logos/','format','%s%s','extname','originalname','post','single','diskStorage','root','logologin','file','addLogoLogin','addPreferred','favicon','addFavicon','update','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x18effb,_0x4d86bf){var _0x20da6d=function(_0x42ba7c){while(--_0x42ba7c){_0x18effb['push'](_0x18effb['shift']());}};_0x20da6d(++_0x4d86bf);}(_0x5fc4,0x8b));var _0x45fc=function(_0x64679c,_0xb68c0a){_0x64679c=_0x64679c-0x0;var _0x4b306a=_0x5fc4[_0x64679c];return _0x4b306a;};'use strict';var multer=require(_0x45fc('0x0'));var util=require(_0x45fc('0x1'));var path=require(_0x45fc('0x2'));var timeout=require('connect-timeout');var express=require(_0x45fc('0x3'));var router=express['Router']();var fs_extra=require(_0x45fc('0x4'));var auth=require(_0x45fc('0x5'));var interaction=require(_0x45fc('0x6'));var config=require('../../config/environment');var controller=require('./setting.controller');router[_0x45fc('0x7')]('/',auth['isAuthenticated'](),controller[_0x45fc('0x8')]);router[_0x45fc('0x7')](_0x45fc('0x9'),controller['getDate']);router[_0x45fc('0x7')](_0x45fc('0xa'),controller[_0x45fc('0xb')]);router[_0x45fc('0x7')](_0x45fc('0xc'),controller['getLogo']);router['get'](_0x45fc('0xd'),controller['getLogoLogin']);router['get'](_0x45fc('0xe'),controller[_0x45fc('0xf')]);router['get'](_0x45fc('0x10'),controller[_0x45fc('0x11')]);router[_0x45fc('0x7')](_0x45fc('0x12'),controller[_0x45fc('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5630a6,_0x578bac,_0x5295e5){_0x5295e5(null,path[_0x45fc('0x14')](config['root'],_0x45fc('0x15')));},'filename':function(_0x4f367f,_0x1d5b51,_0x16299d){_0x16299d(null,util[_0x45fc('0x16')](_0x45fc('0x17'),'logo',path[_0x45fc('0x18')](_0x1d5b51[_0x45fc('0x19')])));}})});router[_0x45fc('0x1a')](_0x45fc('0xc'),upload[_0x45fc('0x1b')]('file'),controller['addLogo']);var upload=multer({'storage':multer[_0x45fc('0x1c')]({'destination':function(_0x4e8cdf,_0x2569e1,_0xcd9587){_0xcd9587(null,path['join'](config[_0x45fc('0x1d')],_0x45fc('0x15')));},'filename':function(_0x5272ad,_0x4e3ec2,_0x47f14e){_0x47f14e(null,util[_0x45fc('0x16')]('%s%s',_0x45fc('0x1e'),path[_0x45fc('0x18')](_0x4e3ec2[_0x45fc('0x19')])));}})});router['post'](_0x45fc('0xd'),upload[_0x45fc('0x1b')](_0x45fc('0x1f')),controller[_0x45fc('0x20')]);var upload=multer({'storage':multer[_0x45fc('0x1c')]({'destination':function(_0x1e8e31,_0x43a856,_0x1e65c6){_0x1e65c6(null,path[_0x45fc('0x14')](config['root'],_0x45fc('0x15')));},'filename':function(_0x1726e7,_0x39210c,_0x3a533e){_0x3a533e(null,util['format'](_0x45fc('0x17'),'preferred',path['extname'](_0x39210c[_0x45fc('0x19')])));}})});router[_0x45fc('0x1a')]('/:id/preferred',upload[_0x45fc('0x1b')](_0x45fc('0x1f')),controller[_0x45fc('0x21')]);var upload=multer({'storage':multer[_0x45fc('0x1c')]({'destination':function(_0x2da2c8,_0x4719b8,_0x531ff3){_0x531ff3(null,path[_0x45fc('0x14')](config['root'],_0x45fc('0x15')));},'filename':function(_0x2c6c12,_0x292101,_0x97171){_0x97171(null,util[_0x45fc('0x16')](_0x45fc('0x17'),_0x45fc('0x22'),path[_0x45fc('0x18')](_0x292101[_0x45fc('0x19')])));}})});router[_0x45fc('0x1a')](_0x45fc('0x12'),upload[_0x45fc('0x1b')](_0x45fc('0x1f')),controller[_0x45fc('0x23')]);router['put'](_0x45fc('0xa'),auth['isAuthenticated'](),controller[_0x45fc('0x24')]);module['exports']=router; \ No newline at end of file +var _0xfe46=['%s%s','logo','extname','originalname','post','/:id/logo','single','addLogo','format','logologin','file','addLogoLogin','addPreferred','favicon','addFavicon','put','update','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./setting.controller','get','isAuthenticated','index','/now','getDate','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe46,0x1b0));var _0x6fe4=function(_0x208613,_0x4d1b11){_0x208613=_0x208613-0x0;var _0xa01ab=_0xfe46[_0x208613];return _0xa01ab;};'use strict';var multer=require(_0x6fe4('0x0'));var util=require(_0x6fe4('0x1'));var path=require(_0x6fe4('0x2'));var timeout=require(_0x6fe4('0x3'));var express=require('express');var router=express[_0x6fe4('0x4')]();var fs_extra=require(_0x6fe4('0x5'));var auth=require(_0x6fe4('0x6'));var interaction=require(_0x6fe4('0x7'));var config=require(_0x6fe4('0x8'));var controller=require(_0x6fe4('0x9'));router[_0x6fe4('0xa')]('/',auth[_0x6fe4('0xb')](),controller[_0x6fe4('0xc')]);router[_0x6fe4('0xa')](_0x6fe4('0xd'),controller[_0x6fe4('0xe')]);router['get']('/:id',controller[_0x6fe4('0xf')]);router[_0x6fe4('0xa')]('/:id/logo',controller[_0x6fe4('0x10')]);router[_0x6fe4('0xa')](_0x6fe4('0x11'),controller[_0x6fe4('0x12')]);router[_0x6fe4('0xa')](_0x6fe4('0x13'),controller[_0x6fe4('0x14')]);router[_0x6fe4('0xa')](_0x6fe4('0x15'),controller['getPreferred']);router[_0x6fe4('0xa')](_0x6fe4('0x16'),controller[_0x6fe4('0x17')]);var upload=multer({'storage':multer[_0x6fe4('0x18')]({'destination':function(_0x59c0cf,_0x21c910,_0x1eb4ff){_0x1eb4ff(null,path[_0x6fe4('0x19')](config[_0x6fe4('0x1a')],_0x6fe4('0x1b')));},'filename':function(_0x51e230,_0x24a261,_0x3d8d30){_0x3d8d30(null,util['format'](_0x6fe4('0x1c'),_0x6fe4('0x1d'),path[_0x6fe4('0x1e')](_0x24a261[_0x6fe4('0x1f')])));}})});router[_0x6fe4('0x20')](_0x6fe4('0x21'),upload[_0x6fe4('0x22')]('file'),controller[_0x6fe4('0x23')]);var upload=multer({'storage':multer[_0x6fe4('0x18')]({'destination':function(_0x3d911c,_0x52fe06,_0x398248){_0x398248(null,path[_0x6fe4('0x19')](config[_0x6fe4('0x1a')],_0x6fe4('0x1b')));},'filename':function(_0x2d48de,_0x2c7b6c,_0x4ebc0d){_0x4ebc0d(null,util[_0x6fe4('0x24')](_0x6fe4('0x1c'),_0x6fe4('0x25'),path[_0x6fe4('0x1e')](_0x2c7b6c[_0x6fe4('0x1f')])));}})});router[_0x6fe4('0x20')](_0x6fe4('0x11'),upload[_0x6fe4('0x22')](_0x6fe4('0x26')),controller[_0x6fe4('0x27')]);var upload=multer({'storage':multer[_0x6fe4('0x18')]({'destination':function(_0x95c5f,_0x3b27f6,_0x23174a){_0x23174a(null,path[_0x6fe4('0x19')](config[_0x6fe4('0x1a')],_0x6fe4('0x1b')));},'filename':function(_0x28e3ce,_0x56e501,_0x8eea94){_0x8eea94(null,util[_0x6fe4('0x24')](_0x6fe4('0x1c'),'preferred',path[_0x6fe4('0x1e')](_0x56e501['originalname'])));}})});router[_0x6fe4('0x20')](_0x6fe4('0x15'),upload['single']('file'),controller[_0x6fe4('0x28')]);var upload=multer({'storage':multer[_0x6fe4('0x18')]({'destination':function(_0x13ed18,_0x586f93,_0x286e0b){_0x286e0b(null,path['join'](config[_0x6fe4('0x1a')],'server/files/images/logos/'));},'filename':function(_0x164c02,_0x118fb9,_0x218879){_0x218879(null,util[_0x6fe4('0x24')](_0x6fe4('0x1c'),_0x6fe4('0x29'),path[_0x6fe4('0x1e')](_0x118fb9[_0x6fe4('0x1f')])));}})});router[_0x6fe4('0x20')](_0x6fe4('0x16'),upload[_0x6fe4('0x22')](_0x6fe4('0x26')),controller[_0x6fe4('0x2a')]);router[_0x6fe4('0x2b')]('/:id',auth[_0x6fe4('0xb')](),controller[_0x6fe4('0x2c')]);module[_0x6fe4('0x2d')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 91f8f9e..75405c4 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 _0x059b=['UNSIGNED','exports','INTEGER','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x059b,0x1c8));var _0xb059=function(_0x20d141,_0x59837b){_0x20d141=_0x20d141-0x0;var _0x621c89=_0x059b[_0x20d141];return _0x621c89;};'use strict';var Sequelize=require('sequelize');module[_0xb059('0x0')]={'min_internal':{'type':Sequelize[_0xb059('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xb059('0x1')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xb059('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xb059('0x2')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'loginLogo':{'type':Sequelize['STRING']},'defaultLoginLogo':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xb059('0x2')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xb059('0x2')]},'turnaddr':{'type':Sequelize['STRING']},'turnusername':{'type':Sequelize[_0xb059('0x2')]},'turnpassword':{'type':Sequelize[_0xb059('0x2')]},'pageTitle':{'type':Sequelize[_0xb059('0x2')]},'defaultPageTitle':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0xb059('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0xb059('0x4')},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xb059('0x2')],'defaultValue':_0xb059('0x5')},'chatTimeout':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'preferred':{'type':Sequelize[_0xb059('0x2')]},'defaultPreferred':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize['STRING']},'allowedLoginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0xb059('0x2')]},'defaultFavicon':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0xb059('0x1')]},'transcribeRegion':{'type':Sequelize[_0xb059('0x2')]},'sentiment':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize[_0xb059('0x2')]},'language':{'type':Sequelize[_0xb059('0x2')]},'bucket':{'type':Sequelize['STRING']},'googleSsoEnabled':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0xb059('0x1')](0x2)[_0xb059('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0xb059('0x1')](0x2)[_0xb059('0x6')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0xb059('0x6')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0xb059('0x3')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0xb059('0x1')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0xb059('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xd7a6=['STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','UNSIGNED','sequelize','exports','INTEGER','min_internal','min_mailbox'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xd7a6,0x1ea));var _0x6d7a=function(_0x14b6b2,_0x421715){_0x14b6b2=_0x14b6b2-0x0;var _0x324c9b=_0xd7a6[_0x14b6b2];return _0x324c9b;};'use strict';var Sequelize=require(_0x6d7a('0x0'));module[_0x6d7a('0x1')]={'min_internal':{'type':Sequelize[_0x6d7a('0x2')](0xb),'unique':_0x6d7a('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x6d7a('0x2')](0xb),'unique':_0x6d7a('0x4'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x6d7a('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x6d7a('0x5')],'defaultValue':_0x6d7a('0x6')},'logo':{'type':Sequelize[_0x6d7a('0x5')]},'defaultLogo':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x6d7a('0x5')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x6d7a('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x6d7a('0x5')]},'turnaddr':{'type':Sequelize[_0x6d7a('0x5')]},'turnusername':{'type':Sequelize[_0x6d7a('0x5')]},'turnpassword':{'type':Sequelize[_0x6d7a('0x5')]},'pageTitle':{'type':Sequelize[_0x6d7a('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x6d7a('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x6d7a('0x5')],'defaultValue':_0x6d7a('0x8')},'enableEmailPreview':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x6d7a('0x5')],'defaultValue':_0x6d7a('0x9')},'chatTimeout':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x6d7a('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x6d7a('0x5')]},'defaultFavicon':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x6d7a('0x2')]},'transcribeRegion':{'type':Sequelize[_0x6d7a('0x5')]},'sentiment':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize['INTEGER']},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x6d7a('0x5')]},'bucket':{'type':Sequelize[_0x6d7a('0x5')]},'googleSsoEnabled':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x6d7a('0x2')](0x2)[_0x6d7a('0xa')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x6d7a('0x2')](0x2)[_0x6d7a('0xa')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x6d7a('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x6d7a('0x2')],'defaultValue':0x14},'filterFullName':{'type':Sequelize[_0x6d7a('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 854c8e2..a669ed6 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 _0x98fc=['../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','request','then','info','Setting,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','destroy','name','send','index','map','Setting','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','rawAttributes','fields','body','find','addLogo','file','logo','filename','addLogoLogin','getLogo','server/files/images/logos','getLicense','loginLogo','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','join','root','toLower','default_logo.svg','default','custom','existsSync','upperFirst','download','getLogoLogin','favicon','default_loginLogo.svg','Sequelize','ValidationError','\x20not\x20found','gdpr','addPreferred','preferred','getPreferred','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','YYYY-MM-DD\x20HH:mm:ss:SSS','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service'];(function(_0x136bce,_0x18216b){var _0xe0a011=function(_0x5cf72f){while(--_0x5cf72f){_0x136bce['push'](_0x136bce['shift']());}};_0xe0a011(++_0x18216b);}(_0x98fc,0x156));var _0xc98f=function(_0x492e32,_0x2e0a93){_0x492e32=_0x492e32-0x0;var _0x4a335e=_0x98fc[_0x492e32];return _0x4a335e;};'use strict';var emlformat=require(_0xc98f('0x0'));var rimraf=require(_0xc98f('0x1'));var zipdir=require(_0xc98f('0x2'));var jsonpatch=require(_0xc98f('0x3'));var rp=require(_0xc98f('0x4'));var moment=require('moment');var BPromise=require(_0xc98f('0x5'));var Mustache=require('mustache');var util=require(_0xc98f('0x6'));var path=require('path');var sox=require(_0xc98f('0x7'));var csv=require(_0xc98f('0x8'));var ejs=require(_0xc98f('0x9'));var fs=require('fs');var fs_extra=require(_0xc98f('0xa'));var _=require(_0xc98f('0xb'));var squel=require(_0xc98f('0xc'));var crypto=require(_0xc98f('0xd'));var jsforce=require(_0xc98f('0xe'));var deskjs=require(_0xc98f('0xf'));var toCsv=require(_0xc98f('0x8'));var querystring=require('querystring');var Papa=require(_0xc98f('0x10'));var Redis=require('ioredis');var authService=require(_0xc98f('0x11'));var qs=require(_0xc98f('0x12'));var as=require(_0xc98f('0x13'));var hardwareService=require(_0xc98f('0x14'));var logger=require(_0xc98f('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xc98f('0x16'));var licenseUtil=require(_0xc98f('0x17'));var db=require(_0xc98f('0x18'))['db'];var jayson=require(_0xc98f('0x19'));var client=jayson[_0xc98f('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f2734,_0x2ec996,_0x5b64c2,_0x3c0b29){return new BPromise(function(_0x131932,_0x1ff20a){var _0xca4553=_0x3c0b29||client;return _0xca4553[_0xc98f('0x1b')](_0x1f2734,_0x5b64c2)[_0xc98f('0x1c')](function(_0x4f4e28){logger[_0xc98f('0x1d')](_0xc98f('0x1e'),_0x2ec996,'request\x20sent');logger[_0xc98f('0x1f')]('Setting,\x20%s,\x20%s,\x20%s',_0x2ec996,_0xc98f('0x20'),JSON[_0xc98f('0x21')](_0x4f4e28));if(_0x4f4e28['error']){if(_0x4f4e28[_0xc98f('0x22')][_0xc98f('0x23')]===0x1f4){logger[_0xc98f('0x22')]('Setting,\x20%s,\x20%s',_0x2ec996,_0x4f4e28['error'][_0xc98f('0x24')]);return _0x1ff20a(_0x4f4e28[_0xc98f('0x22')][_0xc98f('0x24')]);}logger[_0xc98f('0x22')](_0xc98f('0x1e'),_0x2ec996,_0x4f4e28[_0xc98f('0x22')]['message']);return _0x131932(_0x4f4e28[_0xc98f('0x22')][_0xc98f('0x24')]);}else{logger['info'](_0xc98f('0x1e'),_0x2ec996,_0xc98f('0x20'));_0x131932(_0x4f4e28[_0xc98f('0x25')][_0xc98f('0x24')]);}})[_0xc98f('0x26')](function(_0x4f8014){logger[_0xc98f('0x22')](_0xc98f('0x1e'),_0x2ec996,_0x4f8014);_0x1ff20a(_0x4f8014);});});}function respondWithStatusCode(_0x2f78fe,_0x433576){_0x433576=_0x433576||0xcc;return function(_0x21d514){if(_0x21d514){return _0x2f78fe[_0xc98f('0x27')](_0x433576);}return _0x2f78fe[_0xc98f('0x28')](_0x433576)[_0xc98f('0x29')]();};}function respondWithResult(_0x21d124,_0x13c9c9){_0x13c9c9=_0x13c9c9||0xc8;return function(_0xe18d29){if(_0xe18d29){return _0x21d124['status'](_0x13c9c9)[_0xc98f('0x2a')](_0xe18d29);}};}function respondWithFilteredResult(_0x2cf0ec,_0x151c56){return function(_0x13f9e0){if(_0x13f9e0){var _0x3a8150=typeof _0x151c56[_0xc98f('0x2b')]===_0xc98f('0x2c')&&typeof _0x151c56[_0xc98f('0x2d')]==='undefined';var _0x3179c2=_0x13f9e0[_0xc98f('0x2e')];var _0x2ffd33=_0x3a8150?0x0:_0x151c56['offset'];var _0x1b8659=_0x3a8150?_0x13f9e0[_0xc98f('0x2e')]:_0x151c56[_0xc98f('0x2b')]+_0x151c56[_0xc98f('0x2d')];var _0x598b7c;if(_0x1b8659>=_0x3179c2){_0x1b8659=_0x3179c2;_0x598b7c=0xc8;}else{_0x598b7c=0xce;}_0x2cf0ec[_0xc98f('0x28')](_0x598b7c);return _0x2cf0ec['set'](_0xc98f('0x2f'),_0x2ffd33+'-'+_0x1b8659+'/'+_0x3179c2)[_0xc98f('0x2a')](_0x13f9e0);}return null;};}function patchUpdates(_0x4958f3){return function(_0x1de1e5){try{jsonpatch['apply'](_0x1de1e5,_0x4958f3,!![]);}catch(_0x3fc501){return BPromise[_0xc98f('0x30')](_0x3fc501);}return _0x1de1e5['save']();};}function saveUpdates(_0x358e3d,_0x11275e){return function(_0x50cc33){if(_0x50cc33){return _0x50cc33['update'](_0x358e3d)[_0xc98f('0x1c')](function(_0x53532c){return _0x53532c;});}return null;};}function removeEntity(_0x482acc,_0x35375c){return function(_0x1613c0){if(_0x1613c0){return _0x1613c0[_0xc98f('0x31')]()['then'](function(){_0x482acc[_0xc98f('0x28')](0xcc)[_0xc98f('0x29')]();});}};}function handleEntityNotFound(_0xfa8482,_0x22ce33){return function(_0xff354b){if(!_0xff354b){_0xfa8482[_0xc98f('0x27')](0x194);}return _0xff354b;};}function handleError(_0x17ae0f,_0x5c09f){_0x5c09f=_0x5c09f||0x1f4;return function(_0x5af938){logger['error'](_0x5af938['stack']);if(_0x5af938[_0xc98f('0x32')]){delete _0x5af938['name'];}_0x17ae0f['status'](_0x5c09f)[_0xc98f('0x33')](_0x5af938);};}exports[_0xc98f('0x34')]=function(_0x2fe253,_0x3a4634){var _0x28ed7c={},_0x5d9a85={},_0x4e0a16={'count':0x0,'rows':[]};var _0x506384=_[_0xc98f('0x35')](db[_0xc98f('0x36')]['rawAttributes'],function(_0x4b6de1){return{'name':_0x4b6de1['fieldName'],'type':_0x4b6de1[_0xc98f('0x37')][_0xc98f('0x38')]};});_0x5d9a85[_0xc98f('0x39')]=_[_0xc98f('0x35')](_0x506384,_0xc98f('0x32'));_0x5d9a85[_0xc98f('0x3a')]=_[_0xc98f('0x3b')](_0x2fe253[_0xc98f('0x3a')]);_0x5d9a85['filters']=_[_0xc98f('0x3c')](_0x5d9a85[_0xc98f('0x39')],_0x5d9a85['query']);_0x28ed7c['attributes']=_[_0xc98f('0x3c')](_0x5d9a85['model'],qs['fields'](_0x2fe253['query']['fields']));_0x28ed7c[_0xc98f('0x3d')]=_0x28ed7c[_0xc98f('0x3d')][_0xc98f('0x3e')]?_0x28ed7c[_0xc98f('0x3d')]:_0x5d9a85[_0xc98f('0x39')];if(!_0x2fe253[_0xc98f('0x3a')][_0xc98f('0x3f')]('nolimit')){_0x28ed7c['limit']=qs[_0xc98f('0x2d')](_0x2fe253[_0xc98f('0x3a')][_0xc98f('0x2d')]);_0x28ed7c[_0xc98f('0x2b')]=qs['offset'](_0x2fe253['query'][_0xc98f('0x2b')]);}_0x28ed7c[_0xc98f('0x40')]=qs[_0xc98f('0x41')](_0x2fe253[_0xc98f('0x3a')][_0xc98f('0x41')]);_0x28ed7c[_0xc98f('0x42')]=qs[_0xc98f('0x43')](_[_0xc98f('0x44')](_0x2fe253[_0xc98f('0x3a')],_0x5d9a85[_0xc98f('0x43')]),_0x506384);if(_0x2fe253[_0xc98f('0x3a')][_0xc98f('0x45')]){_0x28ed7c[_0xc98f('0x42')]=_[_0xc98f('0x46')](_0x28ed7c[_0xc98f('0x42')],{'$or':_[_0xc98f('0x35')](_0x506384,function(_0x17698f){if(_0x17698f['type']!==_0xc98f('0x47')){var _0x3bd720={};_0x3bd720[_0x17698f[_0xc98f('0x32')]]={'$like':'%'+_0x2fe253[_0xc98f('0x3a')][_0xc98f('0x45')]+'%'};return _0x3bd720;}})});}_0x28ed7c=_[_0xc98f('0x46')]({},_0x28ed7c,_0x2fe253[_0xc98f('0x48')]);var _0x38c2eb={'where':_0x28ed7c['where']};return db[_0xc98f('0x36')][_0xc98f('0x2e')](_0x38c2eb)['then'](function(_0x4962e2){_0x4e0a16[_0xc98f('0x2e')]=_0x4962e2;if(_0x2fe253[_0xc98f('0x3a')][_0xc98f('0x49')]){_0x28ed7c[_0xc98f('0x4a')]=[{'all':!![]}];}return db[_0xc98f('0x36')]['findAll'](_0x28ed7c);})['then'](function(_0x31f450){_0x4e0a16[_0xc98f('0x4b')]=_0x31f450;return _0x4e0a16;})[_0xc98f('0x1c')](respondWithFilteredResult(_0x3a4634,_0x28ed7c))[_0xc98f('0x26')](handleError(_0x3a4634,null));};exports['show']=function(_0x27eaa8,_0x12c187){var _0x224091={'raw':![],'where':{'id':_0x27eaa8[_0xc98f('0x4c')]['id']}},_0x47541e={};_0x47541e[_0xc98f('0x39')]=_[_0xc98f('0x3b')](db[_0xc98f('0x36')][_0xc98f('0x4d')]);_0x47541e['query']=_['keys'](_0x27eaa8[_0xc98f('0x3a')]);_0x47541e[_0xc98f('0x43')]=_[_0xc98f('0x3c')](_0x47541e['model'],_0x47541e[_0xc98f('0x3a')]);_0x224091[_0xc98f('0x3d')]=_[_0xc98f('0x3c')](_0x47541e['model'],qs[_0xc98f('0x4e')](_0x27eaa8[_0xc98f('0x3a')]['fields']));_0x224091[_0xc98f('0x3d')]=_0x224091[_0xc98f('0x3d')]['length']?_0x224091[_0xc98f('0x3d')]:_0x47541e['model'];if(_0x27eaa8[_0xc98f('0x3a')][_0xc98f('0x49')]){_0x224091[_0xc98f('0x4a')]=[{'all':!![]}];}_0x224091=_[_0xc98f('0x46')]({},_0x224091,_0x27eaa8[_0xc98f('0x48')]);return db['Setting']['find'](_0x224091)[_0xc98f('0x1c')](handleEntityNotFound(_0x12c187,null))['then'](respondWithResult(_0x12c187,null))[_0xc98f('0x26')](handleError(_0x12c187,null));};exports['update']=function(_0x4a34ad,_0x2d3bcc){if(_0x4a34ad[_0xc98f('0x4f')]['id']){delete _0x4a34ad[_0xc98f('0x4f')]['id'];}return db['Setting'][_0xc98f('0x50')]({'where':{'id':_0x4a34ad[_0xc98f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2d3bcc,null))[_0xc98f('0x1c')](saveUpdates(_0x4a34ad[_0xc98f('0x4f')],null))[_0xc98f('0x1c')](respondWithResult(_0x2d3bcc,null))['catch'](handleError(_0x2d3bcc,null));};exports[_0xc98f('0x51')]=function(_0x402ccb,_0x49eea9,_0x1277ca){if(_0x402ccb[_0xc98f('0x52')]&&_0x402ccb[_0xc98f('0x52')]['filename']){_0x402ccb[_0xc98f('0x4f')][_0xc98f('0x53')]=_0x402ccb['file'][_0xc98f('0x54')];}return db[_0xc98f('0x36')]['find']({'where':{'id':_0x402ccb['params']['id']}})[_0xc98f('0x1c')](handleEntityNotFound(_0x49eea9,null))[_0xc98f('0x1c')](saveUpdates(_0x402ccb[_0xc98f('0x4f')],null))['then'](respondWithResult(_0x49eea9,null))[_0xc98f('0x26')](handleError(_0x49eea9,null));};exports[_0xc98f('0x55')]=function(_0x38a78d,_0x271af0,_0x7a7172){if(_0x38a78d[_0xc98f('0x52')]&&_0x38a78d[_0xc98f('0x52')][_0xc98f('0x54')]){_0x38a78d[_0xc98f('0x4f')]['loginLogo']=_0x38a78d[_0xc98f('0x52')][_0xc98f('0x54')];}return db['Setting'][_0xc98f('0x50')]({'where':{'id':_0x38a78d[_0xc98f('0x4c')]['id']}})['then'](handleEntityNotFound(_0x271af0,null))[_0xc98f('0x1c')](saveUpdates(_0x38a78d[_0xc98f('0x4f')],null))[_0xc98f('0x1c')](respondWithResult(_0x271af0,null))['catch'](handleError(_0x271af0,null));};var utilLicense=require('../../config/license/util');exports[_0xc98f('0x56')]=function(_0x58f7b0,_0x452180,_0x300f80){var _0x4672c2=_0xc98f('0x57');var _0x200546={'custom':![]};return utilLicense[_0xc98f('0x58')]()[_0xc98f('0x1c')](function(_0x441e51){if(_0x441e51){_0x200546=_0x441e51;}return db['Setting'][_0xc98f('0x50')]({'where':{'id':_0x58f7b0['params']['id']},'attributes':[_0xc98f('0x53'),_0xc98f('0x59'),'preferred','favicon',_0xc98f('0x5a'),_0xc98f('0x5b'),_0xc98f('0x5c'),_0xc98f('0x5d')],'raw':!![]});})[_0xc98f('0x1c')](handleEntityNotFound(_0x452180,null))['then'](function(_0x8aca4){if(_0x8aca4){var _0x45f4a8=_0x8aca4[_0xc98f('0x53')]&&fs['existsSync'](path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x4672c2,_[_0xc98f('0x60')](_0x8aca4[_0xc98f('0x53')])))?path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x4672c2,_['toLower'](_0x8aca4[_0xc98f('0x53')])):path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x4672c2,_['toLower'](_0xc98f('0x61')));var _0x190341=_0xc98f('0x62')+_['upperFirst'](_0xc98f('0x53'));if(_0x8aca4[_0x190341]||!_0x200546[_0xc98f('0x63')]){_0x45f4a8=path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x4672c2,_[_0xc98f('0x60')]('default_logo.svg'));}if(!fs[_0xc98f('0x64')](_0x45f4a8)){throw new db['Sequelize']['ValidationError'](_[_0xc98f('0x65')](_0xc98f('0x53'))+'\x20not\x20found');}return _0x452180[_0xc98f('0x66')](_0x45f4a8);}})[_0xc98f('0x26')](handleError(_0x452180,null));};var utilLicense=require(_0xc98f('0x17'));exports[_0xc98f('0x67')]=function(_0x1292a4,_0x592411,_0x621f8f){var _0x3bcac7=_0xc98f('0x57');var _0x487c9b={'custom':![]};return utilLicense[_0xc98f('0x58')]()[_0xc98f('0x1c')](function(_0xb556c){if(_0xb556c){_0x487c9b=_0xb556c;}return db[_0xc98f('0x36')][_0xc98f('0x50')]({'where':{'id':_0x1292a4[_0xc98f('0x4c')]['id']},'attributes':['logo',_0xc98f('0x59'),'preferred',_0xc98f('0x68'),_0xc98f('0x5a'),'defaultLoginLogo',_0xc98f('0x5c'),_0xc98f('0x5d')],'raw':!![]});})[_0xc98f('0x1c')](handleEntityNotFound(_0x592411,null))[_0xc98f('0x1c')](function(_0x2c1536){if(_0x2c1536){var _0x1a09b8=_0x2c1536[_0xc98f('0x59')]&&fs[_0xc98f('0x64')](path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x3bcac7,_[_0xc98f('0x60')](_0x2c1536[_0xc98f('0x59')])))?path[_0xc98f('0x5e')](config['root'],_0x3bcac7,_[_0xc98f('0x60')](_0x2c1536[_0xc98f('0x59')])):path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x3bcac7,_[_0xc98f('0x60')](_0xc98f('0x69')));var _0x501a39='default'+_[_0xc98f('0x65')](_0xc98f('0x59'));if(_0x2c1536[_0x501a39]||!_0x487c9b[_0xc98f('0x63')]){_0x1a09b8=path[_0xc98f('0x5e')](config['root'],_0x3bcac7,_[_0xc98f('0x60')](_0xc98f('0x69')));}if(!fs[_0xc98f('0x64')](_0x1a09b8)){throw new db[(_0xc98f('0x6a'))][(_0xc98f('0x6b'))](_[_0xc98f('0x65')](_0xc98f('0x59'))+_0xc98f('0x6c'));}return _0x592411[_0xc98f('0x66')](_0x1a09b8);}})[_0xc98f('0x26')](handleError(_0x592411,null));};exports[_0xc98f('0x6d')]=function(_0x5c093b,_0x487058){return db[_0xc98f('0x36')][_0xc98f('0x50')]({'where':{'id':_0x5c093b['params']['id']},'attributes':['securePassword']})[_0xc98f('0x1c')](respondWithResult(_0x487058,null))[_0xc98f('0x26')](handleError(_0x487058,null));};exports[_0xc98f('0x6e')]=function(_0x55ab47,_0xf34c14,_0x3ccb0a){if(_0x55ab47[_0xc98f('0x52')]&&_0x55ab47[_0xc98f('0x52')]['filename']){_0x55ab47[_0xc98f('0x4f')][_0xc98f('0x6f')]=_0x55ab47['file'][_0xc98f('0x54')];}return db[_0xc98f('0x36')]['find']({'where':{'id':_0x55ab47[_0xc98f('0x4c')]['id']}})[_0xc98f('0x1c')](handleEntityNotFound(_0xf34c14,null))[_0xc98f('0x1c')](saveUpdates(_0x55ab47['body'],null))[_0xc98f('0x1c')](respondWithResult(_0xf34c14,null))[_0xc98f('0x26')](handleError(_0xf34c14,null));};var utilLicense=require(_0xc98f('0x17'));exports[_0xc98f('0x70')]=function(_0x41bf7c,_0x30bd43,_0x3a1c99){var _0x32e480=_0xc98f('0x57');var _0xb43a79={'custom':![]};return utilLicense['getLicense']()[_0xc98f('0x1c')](function(_0x476d1d){if(_0x476d1d){_0xb43a79=_0x476d1d;}return db[_0xc98f('0x36')][_0xc98f('0x50')]({'where':{'id':_0x41bf7c[_0xc98f('0x4c')]['id']},'attributes':[_0xc98f('0x53'),'loginLogo',_0xc98f('0x6f'),_0xc98f('0x68'),_0xc98f('0x5a'),'defaultLoginLogo','defaultPreferred',_0xc98f('0x5d')],'raw':!![]});})[_0xc98f('0x1c')](handleEntityNotFound(_0x30bd43,null))[_0xc98f('0x1c')](function(_0x11599a){if(_0x11599a){var _0x6ac0fb=_0x11599a[_0xc98f('0x6f')]&&fs[_0xc98f('0x64')](path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x32e480,_[_0xc98f('0x60')](_0x11599a[_0xc98f('0x6f')])))?path['join'](config[_0xc98f('0x5f')],_0x32e480,_[_0xc98f('0x60')](_0x11599a[_0xc98f('0x6f')])):path['join'](config[_0xc98f('0x5f')],_0x32e480,_[_0xc98f('0x60')]('default_preferred.png'));var _0xf5d515='default'+_[_0xc98f('0x65')](_0xc98f('0x6f'));if(_0x11599a[_0xf5d515]||!_0xb43a79[_0xc98f('0x63')]||!_0xb43a79['preferred']){_0x6ac0fb=path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x32e480,_[_0xc98f('0x60')](_0xc98f('0x71')));}if(!fs[_0xc98f('0x64')](_0x6ac0fb)){throw new db[(_0xc98f('0x6a'))][(_0xc98f('0x6b'))](_[_0xc98f('0x65')](_0xc98f('0x6f'))+_0xc98f('0x6c'));}return _0x30bd43[_0xc98f('0x66')](_0x6ac0fb);}})[_0xc98f('0x26')](handleError(_0x30bd43,null));};exports['addFavicon']=function(_0x4b3687,_0x2b78e8,_0x1432d3){if(_0x4b3687['file']&&_0x4b3687[_0xc98f('0x52')][_0xc98f('0x54')]){_0x4b3687[_0xc98f('0x4f')]['favicon']=_0x4b3687['file'][_0xc98f('0x54')];}return db['Setting'][_0xc98f('0x50')]({'where':{'id':_0x4b3687['params']['id']}})[_0xc98f('0x1c')](handleEntityNotFound(_0x2b78e8,null))[_0xc98f('0x1c')](saveUpdates(_0x4b3687[_0xc98f('0x4f')],null))[_0xc98f('0x1c')](respondWithResult(_0x2b78e8,null))[_0xc98f('0x26')](handleError(_0x2b78e8,null));};var utilLicense=require('../../config/license/util');exports[_0xc98f('0x72')]=function(_0x489041,_0x113d7e,_0x39245c){var _0x304e9d=_0xc98f('0x57');var _0x5db438={'custom':![]};return utilLicense['getLicense']()[_0xc98f('0x1c')](function(_0x4fdcd2){if(_0x4fdcd2){_0x5db438=_0x4fdcd2;}return db[_0xc98f('0x36')][_0xc98f('0x50')]({'where':{'id':_0x489041[_0xc98f('0x4c')]['id']},'attributes':['logo',_0xc98f('0x59'),_0xc98f('0x6f'),'favicon',_0xc98f('0x5a'),'defaultLoginLogo',_0xc98f('0x5c'),_0xc98f('0x5d')],'raw':!![]});})[_0xc98f('0x1c')](handleEntityNotFound(_0x113d7e,null))['then'](function(_0x1bc997){if(_0x1bc997){var _0x4e8953=_0x1bc997[_0xc98f('0x68')]&&fs[_0xc98f('0x64')](path[_0xc98f('0x5e')](config[_0xc98f('0x5f')],_0x304e9d,_[_0xc98f('0x60')](_0x1bc997[_0xc98f('0x68')])))?path[_0xc98f('0x5e')](config['root'],_0x304e9d,_['toLower'](_0x1bc997[_0xc98f('0x68')])):path['join'](config['root'],_0x304e9d,_[_0xc98f('0x60')](_0xc98f('0x73')));var _0x54a3a3='default'+_[_0xc98f('0x65')]('favicon');if(_0x1bc997[_0x54a3a3]||!_0x5db438[_0xc98f('0x63')]){_0x4e8953=path['join'](config['root'],_0x304e9d,_['toLower']('default_favicon.ico'));}if(!fs[_0xc98f('0x64')](_0x4e8953)){throw new db[(_0xc98f('0x6a'))][(_0xc98f('0x6b'))](_[_0xc98f('0x65')](_0xc98f('0x68'))+_0xc98f('0x6c'));}return _0x113d7e['download'](_0x4e8953);}})['catch'](handleError(_0x113d7e,null));};exports[_0xc98f('0x74')]=function(_0x3a0f20,_0x426a58){var _0x1a975b={'offset':moment()[_0xc98f('0x75')]()};_0x1a975b[_0xc98f('0x76')]=moment()[_0xc98f('0x75')](_0x1a975b[_0xc98f('0x2b')])['format'](_0xc98f('0x77'));return _0x426a58[_0xc98f('0x28')](0xc8)['send'](_0x1a975b);}; \ No newline at end of file +var _0x5c5f=['show','params','length','find','body','file','filename','logo','loginLogo','../../config/license/util','preferred','favicon','defaultLogo','defaultPreferred','defaultFavicon','join','toLower','root','default_logo.svg','custom','existsSync','ValidationError','\x20not\x20found','getLogoLogin','server/files/images/logos','getLicense','defaultLoginLogo','default','Sequelize','upperFirst','download','gdpr','securePassword','addPreferred','getPreferred','default_preferred.png','addFavicon','default_favicon.ico','getDate','utcOffset','format','send','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','jayson/promise','client','http','request','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','stack','name','index','map','Setting','rawAttributes','fieldName','type','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','rows'];(function(_0x5d8e3b,_0x59e6aa){var _0x42e192=function(_0x41d110){while(--_0x41d110){_0x5d8e3b['push'](_0x5d8e3b['shift']());}};_0x42e192(++_0x59e6aa);}(_0x5c5f,0x120));var _0xf5c5=function(_0x462bff,_0x151a16){_0x462bff=_0x462bff-0x0;var _0x27229a=_0x5c5f[_0x462bff];return _0x27229a;};'use strict';var emlformat=require(_0xf5c5('0x0'));var rimraf=require(_0xf5c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf5c5('0x2'));var rp=require(_0xf5c5('0x3'));var moment=require(_0xf5c5('0x4'));var BPromise=require(_0xf5c5('0x5'));var Mustache=require(_0xf5c5('0x6'));var util=require(_0xf5c5('0x7'));var path=require('path');var sox=require(_0xf5c5('0x8'));var csv=require(_0xf5c5('0x9'));var ejs=require(_0xf5c5('0xa'));var fs=require('fs');var fs_extra=require(_0xf5c5('0xb'));var _=require(_0xf5c5('0xc'));var squel=require(_0xf5c5('0xd'));var crypto=require(_0xf5c5('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xf5c5('0xf'));var toCsv=require(_0xf5c5('0x9'));var querystring=require(_0xf5c5('0x10'));var Papa=require(_0xf5c5('0x11'));var Redis=require(_0xf5c5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf5c5('0x13'));var as=require(_0xf5c5('0x14'));var hardwareService=require(_0xf5c5('0x15'));var logger=require(_0xf5c5('0x16'))(_0xf5c5('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf5c5('0x18'))['db'];var jayson=require(_0xf5c5('0x19'));var client=jayson[_0xf5c5('0x1a')][_0xf5c5('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x55bdc3,_0x5bd23d,_0x14846c,_0x391e1b){return new BPromise(function(_0x3f48ba,_0x23d922){var _0x1f6bc0=_0x391e1b||client;return _0x1f6bc0[_0xf5c5('0x1c')](_0x55bdc3,_0x14846c)['then'](function(_0x5cd00f){logger[_0xf5c5('0x1d')](_0xf5c5('0x1e'),_0x5bd23d,_0xf5c5('0x1f'));logger['debug'](_0xf5c5('0x20'),_0x5bd23d,_0xf5c5('0x1f'),JSON[_0xf5c5('0x21')](_0x5cd00f));if(_0x5cd00f['error']){if(_0x5cd00f[_0xf5c5('0x22')][_0xf5c5('0x23')]===0x1f4){logger[_0xf5c5('0x22')](_0xf5c5('0x1e'),_0x5bd23d,_0x5cd00f[_0xf5c5('0x22')][_0xf5c5('0x24')]);return _0x23d922(_0x5cd00f[_0xf5c5('0x22')][_0xf5c5('0x24')]);}logger[_0xf5c5('0x22')](_0xf5c5('0x1e'),_0x5bd23d,_0x5cd00f[_0xf5c5('0x22')]['message']);return _0x3f48ba(_0x5cd00f[_0xf5c5('0x22')]['message']);}else{logger[_0xf5c5('0x1d')](_0xf5c5('0x1e'),_0x5bd23d,_0xf5c5('0x1f'));_0x3f48ba(_0x5cd00f[_0xf5c5('0x25')][_0xf5c5('0x24')]);}})[_0xf5c5('0x26')](function(_0x4ee668){logger['error'](_0xf5c5('0x1e'),_0x5bd23d,_0x4ee668);_0x23d922(_0x4ee668);});});}function respondWithStatusCode(_0x31288f,_0x1fe148){_0x1fe148=_0x1fe148||0xcc;return function(_0x533ee0){if(_0x533ee0){return _0x31288f[_0xf5c5('0x27')](_0x1fe148);}return _0x31288f['status'](_0x1fe148)[_0xf5c5('0x28')]();};}function respondWithResult(_0x127acd,_0x2380cc){_0x2380cc=_0x2380cc||0xc8;return function(_0x4d13ad){if(_0x4d13ad){return _0x127acd[_0xf5c5('0x29')](_0x2380cc)[_0xf5c5('0x2a')](_0x4d13ad);}};}function respondWithFilteredResult(_0x2860af,_0x13ac01){return function(_0x4de7e6){if(_0x4de7e6){var _0x12b4de=typeof _0x13ac01['offset']==='undefined'&&typeof _0x13ac01[_0xf5c5('0x2b')]===_0xf5c5('0x2c');var _0x3abe0e=_0x4de7e6[_0xf5c5('0x2d')];var _0x9ac286=_0x12b4de?0x0:_0x13ac01['offset'];var _0x4e992c=_0x12b4de?_0x4de7e6[_0xf5c5('0x2d')]:_0x13ac01[_0xf5c5('0x2e')]+_0x13ac01[_0xf5c5('0x2b')];var _0x2b12c8;if(_0x4e992c>=_0x3abe0e){_0x4e992c=_0x3abe0e;_0x2b12c8=0xc8;}else{_0x2b12c8=0xce;}_0x2860af['status'](_0x2b12c8);return _0x2860af['set'](_0xf5c5('0x2f'),_0x9ac286+'-'+_0x4e992c+'/'+_0x3abe0e)['json'](_0x4de7e6);}return null;};}function patchUpdates(_0x2cb83f){return function(_0x1990f7){try{jsonpatch[_0xf5c5('0x30')](_0x1990f7,_0x2cb83f,!![]);}catch(_0x46a619){return BPromise[_0xf5c5('0x31')](_0x46a619);}return _0x1990f7[_0xf5c5('0x32')]();};}function saveUpdates(_0x4c2cae,_0x59accd){return function(_0x238fad){if(_0x238fad){return _0x238fad[_0xf5c5('0x33')](_0x4c2cae)[_0xf5c5('0x34')](function(_0x4480d2){return _0x4480d2;});}return null;};}function removeEntity(_0x511e3f,_0x45bb58){return function(_0x4de71b){if(_0x4de71b){return _0x4de71b[_0xf5c5('0x35')]()[_0xf5c5('0x34')](function(){_0x511e3f[_0xf5c5('0x29')](0xcc)[_0xf5c5('0x28')]();});}};}function handleEntityNotFound(_0x2973cc,_0x55b4fd){return function(_0x55d6ba){if(!_0x55d6ba){_0x2973cc[_0xf5c5('0x27')](0x194);}return _0x55d6ba;};}function handleError(_0x23ed3e,_0x459d66){_0x459d66=_0x459d66||0x1f4;return function(_0x3233d4){logger[_0xf5c5('0x22')](_0x3233d4[_0xf5c5('0x36')]);if(_0x3233d4[_0xf5c5('0x37')]){delete _0x3233d4[_0xf5c5('0x37')];}_0x23ed3e['status'](_0x459d66)['send'](_0x3233d4);};}exports[_0xf5c5('0x38')]=function(_0xd517f8,_0x4715a3){var _0x27068e={},_0x56c28b={},_0x5624a9={'count':0x0,'rows':[]};var _0x3feb5d=_[_0xf5c5('0x39')](db[_0xf5c5('0x3a')][_0xf5c5('0x3b')],function(_0x38206e){return{'name':_0x38206e[_0xf5c5('0x3c')],'type':_0x38206e[_0xf5c5('0x3d')]['key']};});_0x56c28b['model']=_[_0xf5c5('0x39')](_0x3feb5d,'name');_0x56c28b[_0xf5c5('0x3e')]=_[_0xf5c5('0x3f')](_0xd517f8[_0xf5c5('0x3e')]);_0x56c28b[_0xf5c5('0x40')]=_['intersection'](_0x56c28b[_0xf5c5('0x41')],_0x56c28b[_0xf5c5('0x3e')]);_0x27068e[_0xf5c5('0x42')]=_[_0xf5c5('0x43')](_0x56c28b[_0xf5c5('0x41')],qs[_0xf5c5('0x44')](_0xd517f8[_0xf5c5('0x3e')]['fields']));_0x27068e['attributes']=_0x27068e[_0xf5c5('0x42')]['length']?_0x27068e[_0xf5c5('0x42')]:_0x56c28b['model'];if(!_0xd517f8[_0xf5c5('0x3e')][_0xf5c5('0x45')](_0xf5c5('0x46'))){_0x27068e[_0xf5c5('0x2b')]=qs[_0xf5c5('0x2b')](_0xd517f8['query'][_0xf5c5('0x2b')]);_0x27068e[_0xf5c5('0x2e')]=qs['offset'](_0xd517f8[_0xf5c5('0x3e')]['offset']);}_0x27068e['order']=qs[_0xf5c5('0x47')](_0xd517f8[_0xf5c5('0x3e')]['sort']);_0x27068e['where']=qs[_0xf5c5('0x40')](_[_0xf5c5('0x48')](_0xd517f8[_0xf5c5('0x3e')],_0x56c28b[_0xf5c5('0x40')]),_0x3feb5d);if(_0xd517f8[_0xf5c5('0x3e')][_0xf5c5('0x49')]){_0x27068e[_0xf5c5('0x4a')]=_[_0xf5c5('0x4b')](_0x27068e[_0xf5c5('0x4a')],{'$or':_[_0xf5c5('0x39')](_0x3feb5d,function(_0x196df5){if(_0x196df5[_0xf5c5('0x3d')]!==_0xf5c5('0x4c')){var _0x32cf7c={};_0x32cf7c[_0x196df5[_0xf5c5('0x37')]]={'$like':'%'+_0xd517f8[_0xf5c5('0x3e')][_0xf5c5('0x49')]+'%'};return _0x32cf7c;}})});}_0x27068e=_[_0xf5c5('0x4b')]({},_0x27068e,_0xd517f8[_0xf5c5('0x4d')]);var _0x3db98b={'where':_0x27068e[_0xf5c5('0x4a')]};return db['Setting'][_0xf5c5('0x2d')](_0x3db98b)[_0xf5c5('0x34')](function(_0x6da529){_0x5624a9[_0xf5c5('0x2d')]=_0x6da529;if(_0xd517f8['query'][_0xf5c5('0x4e')]){_0x27068e[_0xf5c5('0x4f')]=[{'all':!![]}];}return db[_0xf5c5('0x3a')]['findAll'](_0x27068e);})['then'](function(_0x1d53de){_0x5624a9[_0xf5c5('0x50')]=_0x1d53de;return _0x5624a9;})[_0xf5c5('0x34')](respondWithFilteredResult(_0x4715a3,_0x27068e))[_0xf5c5('0x26')](handleError(_0x4715a3,null));};exports[_0xf5c5('0x51')]=function(_0xf9473a,_0x32a48b){var _0x31741f={'raw':![],'where':{'id':_0xf9473a[_0xf5c5('0x52')]['id']}},_0x27f644={};_0x27f644[_0xf5c5('0x41')]=_['keys'](db[_0xf5c5('0x3a')][_0xf5c5('0x3b')]);_0x27f644[_0xf5c5('0x3e')]=_[_0xf5c5('0x3f')](_0xf9473a['query']);_0x27f644[_0xf5c5('0x40')]=_[_0xf5c5('0x43')](_0x27f644[_0xf5c5('0x41')],_0x27f644[_0xf5c5('0x3e')]);_0x31741f[_0xf5c5('0x42')]=_[_0xf5c5('0x43')](_0x27f644['model'],qs['fields'](_0xf9473a[_0xf5c5('0x3e')]['fields']));_0x31741f[_0xf5c5('0x42')]=_0x31741f['attributes'][_0xf5c5('0x53')]?_0x31741f[_0xf5c5('0x42')]:_0x27f644[_0xf5c5('0x41')];if(_0xf9473a['query']['includeAll']){_0x31741f[_0xf5c5('0x4f')]=[{'all':!![]}];}_0x31741f=_[_0xf5c5('0x4b')]({},_0x31741f,_0xf9473a['options']);return db['Setting'][_0xf5c5('0x54')](_0x31741f)[_0xf5c5('0x34')](handleEntityNotFound(_0x32a48b,null))['then'](respondWithResult(_0x32a48b,null))[_0xf5c5('0x26')](handleError(_0x32a48b,null));};exports[_0xf5c5('0x33')]=function(_0xe67623,_0x4700d9){if(_0xe67623[_0xf5c5('0x55')]['id']){delete _0xe67623[_0xf5c5('0x55')]['id'];}return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0xe67623[_0xf5c5('0x52')]['id']}})[_0xf5c5('0x34')](handleEntityNotFound(_0x4700d9,null))['then'](saveUpdates(_0xe67623[_0xf5c5('0x55')],null))[_0xf5c5('0x34')](respondWithResult(_0x4700d9,null))[_0xf5c5('0x26')](handleError(_0x4700d9,null));};exports['addLogo']=function(_0x117a63,_0x427617,_0x51df1d){if(_0x117a63[_0xf5c5('0x56')]&&_0x117a63[_0xf5c5('0x56')][_0xf5c5('0x57')]){_0x117a63[_0xf5c5('0x55')][_0xf5c5('0x58')]=_0x117a63[_0xf5c5('0x56')]['filename'];}return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0x117a63[_0xf5c5('0x52')]['id']}})['then'](handleEntityNotFound(_0x427617,null))['then'](saveUpdates(_0x117a63[_0xf5c5('0x55')],null))[_0xf5c5('0x34')](respondWithResult(_0x427617,null))[_0xf5c5('0x26')](handleError(_0x427617,null));};exports['addLogoLogin']=function(_0x1e9061,_0x5b92c6,_0x117ac4){if(_0x1e9061['file']&&_0x1e9061[_0xf5c5('0x56')][_0xf5c5('0x57')]){_0x1e9061['body'][_0xf5c5('0x59')]=_0x1e9061[_0xf5c5('0x56')][_0xf5c5('0x57')];}return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0x1e9061['params']['id']}})[_0xf5c5('0x34')](handleEntityNotFound(_0x5b92c6,null))[_0xf5c5('0x34')](saveUpdates(_0x1e9061[_0xf5c5('0x55')],null))[_0xf5c5('0x34')](respondWithResult(_0x5b92c6,null))[_0xf5c5('0x26')](handleError(_0x5b92c6,null));};var utilLicense=require(_0xf5c5('0x5a'));exports['getLogo']=function(_0x2b6dd0,_0x25ea88,_0xac3935){var _0x224499='server/files/images/logos';var _0x113fc8={'custom':![]};return utilLicense['getLicense']()[_0xf5c5('0x34')](function(_0x4fd4bf){if(_0x4fd4bf){_0x113fc8=_0x4fd4bf;}return db['Setting'][_0xf5c5('0x54')]({'where':{'id':_0x2b6dd0['params']['id']},'attributes':[_0xf5c5('0x58'),_0xf5c5('0x59'),_0xf5c5('0x5b'),_0xf5c5('0x5c'),_0xf5c5('0x5d'),'defaultLoginLogo',_0xf5c5('0x5e'),_0xf5c5('0x5f')],'raw':!![]});})['then'](handleEntityNotFound(_0x25ea88,null))[_0xf5c5('0x34')](function(_0x186ba1){if(_0x186ba1){var _0x361724=_0x186ba1[_0xf5c5('0x58')]&&fs['existsSync'](path[_0xf5c5('0x60')](config['root'],_0x224499,_[_0xf5c5('0x61')](_0x186ba1[_0xf5c5('0x58')])))?path['join'](config[_0xf5c5('0x62')],_0x224499,_['toLower'](_0x186ba1[_0xf5c5('0x58')])):path[_0xf5c5('0x60')](config['root'],_0x224499,_[_0xf5c5('0x61')](_0xf5c5('0x63')));var _0x2b7ffc='default'+_['upperFirst'](_0xf5c5('0x58'));if(_0x186ba1[_0x2b7ffc]||!_0x113fc8[_0xf5c5('0x64')]){_0x361724=path[_0xf5c5('0x60')](config[_0xf5c5('0x62')],_0x224499,_[_0xf5c5('0x61')](_0xf5c5('0x63')));}if(!fs[_0xf5c5('0x65')](_0x361724)){throw new db['Sequelize'][(_0xf5c5('0x66'))](_['upperFirst']('logo')+_0xf5c5('0x67'));}return _0x25ea88['download'](_0x361724);}})['catch'](handleError(_0x25ea88,null));};var utilLicense=require('../../config/license/util');exports[_0xf5c5('0x68')]=function(_0x322847,_0x48b2cc,_0x447d78){var _0x4581da=_0xf5c5('0x69');var _0x2eb8e3={'custom':![]};return utilLicense[_0xf5c5('0x6a')]()[_0xf5c5('0x34')](function(_0x16a273){if(_0x16a273){_0x2eb8e3=_0x16a273;}return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0x322847['params']['id']},'attributes':[_0xf5c5('0x58'),_0xf5c5('0x59'),'preferred','favicon',_0xf5c5('0x5d'),_0xf5c5('0x6b'),_0xf5c5('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xf5c5('0x34')](handleEntityNotFound(_0x48b2cc,null))[_0xf5c5('0x34')](function(_0x2cb249){if(_0x2cb249){var _0x5d6a8b=_0x2cb249['loginLogo']&&fs['existsSync'](path[_0xf5c5('0x60')](config[_0xf5c5('0x62')],_0x4581da,_[_0xf5c5('0x61')](_0x2cb249[_0xf5c5('0x59')])))?path[_0xf5c5('0x60')](config[_0xf5c5('0x62')],_0x4581da,_[_0xf5c5('0x61')](_0x2cb249[_0xf5c5('0x59')])):path[_0xf5c5('0x60')](config[_0xf5c5('0x62')],_0x4581da,_[_0xf5c5('0x61')]('default_loginLogo.svg'));var _0x30be56=_0xf5c5('0x6c')+_['upperFirst'](_0xf5c5('0x59'));if(_0x2cb249[_0x30be56]||!_0x2eb8e3['custom']){_0x5d6a8b=path['join'](config[_0xf5c5('0x62')],_0x4581da,_[_0xf5c5('0x61')]('default_loginLogo.svg'));}if(!fs['existsSync'](_0x5d6a8b)){throw new db[(_0xf5c5('0x6d'))][(_0xf5c5('0x66'))](_[_0xf5c5('0x6e')]('loginLogo')+_0xf5c5('0x67'));}return _0x48b2cc[_0xf5c5('0x6f')](_0x5d6a8b);}})['catch'](handleError(_0x48b2cc,null));};exports[_0xf5c5('0x70')]=function(_0x201c55,_0x447a33){return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0x201c55['params']['id']},'attributes':[_0xf5c5('0x71')]})[_0xf5c5('0x34')](respondWithResult(_0x447a33,null))[_0xf5c5('0x26')](handleError(_0x447a33,null));};exports[_0xf5c5('0x72')]=function(_0x6b0596,_0x3c2859,_0x45f0be){if(_0x6b0596[_0xf5c5('0x56')]&&_0x6b0596[_0xf5c5('0x56')][_0xf5c5('0x57')]){_0x6b0596['body'][_0xf5c5('0x5b')]=_0x6b0596[_0xf5c5('0x56')]['filename'];}return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0x6b0596[_0xf5c5('0x52')]['id']}})[_0xf5c5('0x34')](handleEntityNotFound(_0x3c2859,null))[_0xf5c5('0x34')](saveUpdates(_0x6b0596[_0xf5c5('0x55')],null))[_0xf5c5('0x34')](respondWithResult(_0x3c2859,null))[_0xf5c5('0x26')](handleError(_0x3c2859,null));};var utilLicense=require(_0xf5c5('0x5a'));exports[_0xf5c5('0x73')]=function(_0x5158d4,_0x14308b,_0x2b8c7a){var _0x548455='server/files/images/logos';var _0x75f7ef={'custom':![]};return utilLicense[_0xf5c5('0x6a')]()['then'](function(_0x2b955d){if(_0x2b955d){_0x75f7ef=_0x2b955d;}return db['Setting'][_0xf5c5('0x54')]({'where':{'id':_0x5158d4['params']['id']},'attributes':['logo','loginLogo',_0xf5c5('0x5b'),'favicon',_0xf5c5('0x5d'),'defaultLoginLogo','defaultPreferred',_0xf5c5('0x5f')],'raw':!![]});})[_0xf5c5('0x34')](handleEntityNotFound(_0x14308b,null))[_0xf5c5('0x34')](function(_0x4fc3d3){if(_0x4fc3d3){var _0x26c2f2=_0x4fc3d3['preferred']&&fs['existsSync'](path['join'](config[_0xf5c5('0x62')],_0x548455,_[_0xf5c5('0x61')](_0x4fc3d3['preferred'])))?path[_0xf5c5('0x60')](config[_0xf5c5('0x62')],_0x548455,_['toLower'](_0x4fc3d3['preferred'])):path[_0xf5c5('0x60')](config['root'],_0x548455,_[_0xf5c5('0x61')](_0xf5c5('0x74')));var _0x1b9fec='default'+_[_0xf5c5('0x6e')](_0xf5c5('0x5b'));if(_0x4fc3d3[_0x1b9fec]||!_0x75f7ef[_0xf5c5('0x64')]||!_0x75f7ef['preferred']){_0x26c2f2=path['join'](config[_0xf5c5('0x62')],_0x548455,_[_0xf5c5('0x61')](_0xf5c5('0x74')));}if(!fs['existsSync'](_0x26c2f2)){throw new db[(_0xf5c5('0x6d'))][(_0xf5c5('0x66'))](_[_0xf5c5('0x6e')](_0xf5c5('0x5b'))+_0xf5c5('0x67'));}return _0x14308b['download'](_0x26c2f2);}})[_0xf5c5('0x26')](handleError(_0x14308b,null));};exports[_0xf5c5('0x75')]=function(_0x4762c1,_0x450b3e,_0x36ae66){if(_0x4762c1[_0xf5c5('0x56')]&&_0x4762c1[_0xf5c5('0x56')]['filename']){_0x4762c1[_0xf5c5('0x55')]['favicon']=_0x4762c1[_0xf5c5('0x56')]['filename'];}return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0x4762c1[_0xf5c5('0x52')]['id']}})[_0xf5c5('0x34')](handleEntityNotFound(_0x450b3e,null))[_0xf5c5('0x34')](saveUpdates(_0x4762c1[_0xf5c5('0x55')],null))[_0xf5c5('0x34')](respondWithResult(_0x450b3e,null))['catch'](handleError(_0x450b3e,null));};var utilLicense=require(_0xf5c5('0x5a'));exports['getFavicon']=function(_0x4723e3,_0x1b8b70,_0x316867){var _0x3274bd=_0xf5c5('0x69');var _0x1755bf={'custom':![]};return utilLicense['getLicense']()[_0xf5c5('0x34')](function(_0x346171){if(_0x346171){_0x1755bf=_0x346171;}return db[_0xf5c5('0x3a')][_0xf5c5('0x54')]({'where':{'id':_0x4723e3[_0xf5c5('0x52')]['id']},'attributes':['logo',_0xf5c5('0x59'),_0xf5c5('0x5b'),_0xf5c5('0x5c'),_0xf5c5('0x5d'),'defaultLoginLogo',_0xf5c5('0x5e'),'defaultFavicon'],'raw':!![]});})[_0xf5c5('0x34')](handleEntityNotFound(_0x1b8b70,null))['then'](function(_0x10ded8){if(_0x10ded8){var _0xc1c6e8=_0x10ded8[_0xf5c5('0x5c')]&&fs[_0xf5c5('0x65')](path[_0xf5c5('0x60')](config['root'],_0x3274bd,_[_0xf5c5('0x61')](_0x10ded8[_0xf5c5('0x5c')])))?path[_0xf5c5('0x60')](config[_0xf5c5('0x62')],_0x3274bd,_[_0xf5c5('0x61')](_0x10ded8[_0xf5c5('0x5c')])):path['join'](config[_0xf5c5('0x62')],_0x3274bd,_[_0xf5c5('0x61')](_0xf5c5('0x76')));var _0x189ba9='default'+_[_0xf5c5('0x6e')](_0xf5c5('0x5c'));if(_0x10ded8[_0x189ba9]||!_0x1755bf['custom']){_0xc1c6e8=path[_0xf5c5('0x60')](config[_0xf5c5('0x62')],_0x3274bd,_[_0xf5c5('0x61')](_0xf5c5('0x76')));}if(!fs['existsSync'](_0xc1c6e8)){throw new db[(_0xf5c5('0x6d'))][(_0xf5c5('0x66'))](_['upperFirst'](_0xf5c5('0x5c'))+_0xf5c5('0x67'));}return _0x1b8b70[_0xf5c5('0x6f')](_0xc1c6e8);}})[_0xf5c5('0x26')](handleError(_0x1b8b70,null));};exports[_0xf5c5('0x77')]=function(_0x4f3742,_0x52cf6f){var _0x3601f2={'offset':moment()[_0xf5c5('0x78')]()};_0x3601f2['now']=moment()[_0xf5c5('0x78')](_0x3601f2[_0xf5c5('0x2e')])[_0xf5c5('0x79')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x52cf6f[_0xf5c5('0x29')](0xc8)[_0xf5c5('0x7a')](_0x3601f2);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index 6947865..e279342 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 _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x30c226,_0xa58794){var _0x45de18=function(_0x2d8f76){while(--_0x2d8f76){_0x30c226['push'](_0x30c226['shift']());}};_0x45de18(++_0xa58794);}(_0xedd9,0xfc));var _0x9edd=function(_0x1d24ad,_0x57b05d){_0x1d24ad=_0x1d24ad-0x0;var _0xea3065=_0xedd9[_0x1d24ad];return _0xea3065;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe14b=['bluebird','path','./setting.attributes','exports','define','Setting','settings','lodash','util','moment'];(function(_0xb9d7be,_0x277001){var _0x21e31d=function(_0x15f53e){while(--_0x15f53e){_0xb9d7be['push'](_0xb9d7be['shift']());}};_0x21e31d(++_0x277001);}(_0xe14b,0x93));var _0xbe14=function(_0x488304,_0x5b5b0e){_0x488304=_0x488304-0x0;var _0x51f958=_0xe14b[_0x488304];return _0x51f958;};'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':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 1d902ac..08bfa09 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 _0x21f3=['http','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','code','error','message','result','Setting','find','options','raw','where','attributes','include','model','map','ShowSetting','debug','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x310ca4,_0x195e91){var _0x303c6f=function(_0x53dbf2){while(--_0x53dbf2){_0x310ca4['push'](_0x310ca4['shift']());}};_0x303c6f(++_0x195e91);}(_0x21f3,0x16a));var _0x321f=function(_0x1568a9,_0x52760c){_0x1568a9=_0x1568a9-0x0;var _0x4a120e=_0x21f3[_0x1568a9];return _0x4a120e;};'use strict';var _=require(_0x321f('0x0'));var util=require(_0x321f('0x1'));var moment=require(_0x321f('0x2'));var BPromise=require('bluebird');var rs=require(_0x321f('0x3'));var fs=require('fs');var Redis=require(_0x321f('0x4'));var db=require(_0x321f('0x5'))['db'];var utils=require(_0x321f('0x6'));var logger=require(_0x321f('0x7'))(_0x321f('0x8'));var config=require(_0x321f('0x9'));var jayson=require(_0x321f('0xa'));var client=jayson[_0x321f('0xb')][_0x321f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x7ee3cd,_0x3e8da6,_0x6ca187){return new BPromise(function(_0x39efbd,_0x35e0ce){return client['request'](_0x7ee3cd,_0x6ca187)['then'](function(_0x173eb7){logger[_0x321f('0xd')](_0x321f('0xe'),_0x3e8da6,_0x321f('0xf'));logger['debug'](_0x321f('0x10'),_0x3e8da6,_0x321f('0xf'),JSON['stringify'](_0x173eb7));if(_0x173eb7['error']){if(_0x173eb7['error'][_0x321f('0x11')]===0x1f4){logger[_0x321f('0x12')](_0x321f('0xe'),_0x3e8da6,_0x173eb7[_0x321f('0x12')]['message']);return _0x35e0ce(_0x173eb7[_0x321f('0x12')][_0x321f('0x13')]);}logger['error']('Setting,\x20%s,\x20%s',_0x3e8da6,_0x173eb7['error'][_0x321f('0x13')]);return _0x39efbd(_0x173eb7[_0x321f('0x12')][_0x321f('0x13')]);}else{logger[_0x321f('0xd')](_0x321f('0xe'),_0x3e8da6,_0x321f('0xf'));_0x39efbd(_0x173eb7[_0x321f('0x14')][_0x321f('0x13')]);}})['catch'](function(_0x7bdc94){logger[_0x321f('0x12')](_0x321f('0xe'),_0x3e8da6,_0x7bdc94);_0x35e0ce(_0x7bdc94);});});}exports['ShowSetting']=function(_0x5b6d60){var _0x34d0c3=this;return new Promise(function(_0x47295f,_0x186a6a){return db[_0x321f('0x15')][_0x321f('0x16')]({'raw':_0x5b6d60[_0x321f('0x17')]?_0x5b6d60['options'][_0x321f('0x18')]===undefined?!![]:![]:!![],'where':_0x5b6d60['options']?_0x5b6d60[_0x321f('0x17')][_0x321f('0x19')]||null:null,'attributes':_0x5b6d60['options']?_0x5b6d60[_0x321f('0x17')][_0x321f('0x1a')]||null:null,'include':_0x5b6d60['options']?_0x5b6d60[_0x321f('0x17')][_0x321f('0x1b')]?_['map'](_0x5b6d60[_0x321f('0x17')][_0x321f('0x1b')],function(_0x3c53b2){return{'model':db[_0x3c53b2[_0x321f('0x1c')]],'as':_0x3c53b2['as'],'attributes':_0x3c53b2[_0x321f('0x1a')],'include':_0x3c53b2[_0x321f('0x1b')]?_[_0x321f('0x1d')](_0x3c53b2[_0x321f('0x1b')],function(_0x53f413){return{'model':db[_0x53f413[_0x321f('0x1c')]],'as':_0x53f413['as'],'attributes':_0x53f413[_0x321f('0x1a')],'include':_0x53f413[_0x321f('0x1b')]?_[_0x321f('0x1d')](_0x53f413[_0x321f('0x1b')],function(_0xe7aaa2){return{'model':db[_0xe7aaa2['model']],'as':_0xe7aaa2['as'],'attributes':_0xe7aaa2[_0x321f('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe48880){logger['info'](_0x321f('0x1e'),_0x5b6d60);logger[_0x321f('0x1f')](_0x321f('0x1e'),_0x5b6d60,JSON[_0x321f('0x20')](_0xe48880));_0x47295f(_0xe48880);})[_0x321f('0x21')](function(_0x2170e0){logger[_0x321f('0x12')]('ShowSetting',_0x2170e0[_0x321f('0x13')],_0x5b6d60);_0x186a6a(_0x34d0c3[_0x321f('0x12')](0x1f4,_0x2170e0[_0x321f('0x13')]));});});}; \ No newline at end of file +var _0x49d5=['ioredis','../../config/utils','../../config/logger','request','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','ShowSetting','Setting','find','options','where','attributes','include','model','then','util','bluebird'];(function(_0x1156ad,_0x45f26d){var _0x49b797=function(_0x20a91a){while(--_0x20a91a){_0x1156ad['push'](_0x1156ad['shift']());}};_0x49b797(++_0x45f26d);}(_0x49d5,0x1f2));var _0x549d=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x49d5[_0xf50820];return _0x2a9b10;};'use strict';var _=require('lodash');var util=require(_0x549d('0x0'));var moment=require('moment');var BPromise=require(_0x549d('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x549d('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x549d('0x3'));var logger=require(_0x549d('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24d7a6,_0x97cb8c,_0x5f3234){return new BPromise(function(_0x565626,_0x530499){return client[_0x549d('0x5')](_0x24d7a6,_0x5f3234)['then'](function(_0x5e7841){logger[_0x549d('0x6')](_0x549d('0x7'),_0x97cb8c,_0x549d('0x8'));logger[_0x549d('0x9')](_0x549d('0xa'),_0x97cb8c,_0x549d('0x8'),JSON[_0x549d('0xb')](_0x5e7841));if(_0x5e7841[_0x549d('0xc')]){if(_0x5e7841[_0x549d('0xc')]['code']===0x1f4){logger[_0x549d('0xc')](_0x549d('0x7'),_0x97cb8c,_0x5e7841[_0x549d('0xc')][_0x549d('0xd')]);return _0x530499(_0x5e7841[_0x549d('0xc')][_0x549d('0xd')]);}logger[_0x549d('0xc')](_0x549d('0x7'),_0x97cb8c,_0x5e7841[_0x549d('0xc')][_0x549d('0xd')]);return _0x565626(_0x5e7841['error']['message']);}else{logger[_0x549d('0x6')](_0x549d('0x7'),_0x97cb8c,'request\x20sent');_0x565626(_0x5e7841[_0x549d('0xe')][_0x549d('0xd')]);}})[_0x549d('0xf')](function(_0x21b880){logger[_0x549d('0xc')](_0x549d('0x7'),_0x97cb8c,_0x21b880);_0x530499(_0x21b880);});});}exports[_0x549d('0x10')]=function(_0x232596){var _0x5ca0eb=this;return new Promise(function(_0x5c93bf,_0x1261d1){return db[_0x549d('0x11')][_0x549d('0x12')]({'raw':_0x232596[_0x549d('0x13')]?_0x232596['options']['raw']===undefined?!![]:![]:!![],'where':_0x232596[_0x549d('0x13')]?_0x232596[_0x549d('0x13')][_0x549d('0x14')]||null:null,'attributes':_0x232596['options']?_0x232596[_0x549d('0x13')][_0x549d('0x15')]||null:null,'include':_0x232596[_0x549d('0x13')]?_0x232596[_0x549d('0x13')][_0x549d('0x16')]?_['map'](_0x232596[_0x549d('0x13')][_0x549d('0x16')],function(_0x5985c4){return{'model':db[_0x5985c4[_0x549d('0x17')]],'as':_0x5985c4['as'],'attributes':_0x5985c4['attributes'],'include':_0x5985c4[_0x549d('0x16')]?_['map'](_0x5985c4[_0x549d('0x16')],function(_0x2a3495){return{'model':db[_0x2a3495[_0x549d('0x17')]],'as':_0x2a3495['as'],'attributes':_0x2a3495[_0x549d('0x15')],'include':_0x2a3495[_0x549d('0x16')]?_['map'](_0x2a3495[_0x549d('0x16')],function(_0x45ec57){return{'model':db[_0x45ec57[_0x549d('0x17')]],'as':_0x45ec57['as'],'attributes':_0x45ec57[_0x549d('0x15')]};}):[]};}):[]};}):[]:[]})[_0x549d('0x18')](function(_0x319936){logger[_0x549d('0x6')]('ShowSetting',_0x232596);logger['debug'](_0x549d('0x10'),_0x232596,JSON[_0x549d('0xb')](_0x319936));_0x5c93bf(_0x319936);})[_0x549d('0xf')](function(_0x39107a){logger[_0x549d('0xc')]('ShowSetting',_0x39107a['message'],_0x232596);_0x1261d1(_0x5ca0eb['error'](0x1f4,_0x39107a[_0x549d('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 8e76404..da05b30 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 _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0x191f56,_0x5678e0){var _0x49010c=function(_0x17ed88){while(--_0x17ed88){_0x191f56['push'](_0x191f56['shift']());}};_0x49010c(++_0x5678e0);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'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',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file +var _0x9957=['getInteractions','statusGet','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','addApplications','/:id/status','status','addAgents','/:id','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions'];(function(_0xa7c05d,_0x312374){var _0x47b002=function(_0x44aa2f){while(--_0x44aa2f){_0xa7c05d['push'](_0xa7c05d['shift']());}};_0x47b002(++_0x312374);}(_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',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/canned_answers',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x9')](_0x7995('0x14'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router['get']('/:id/status',controller[_0x7995('0x16')]);router[_0x7995('0x9')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x18')]);router[_0x7995('0x19')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x1a')]);router['post'](_0x7995('0xf'),auth['isAuthenticated'](),controller[_0x7995('0x1b')]);router[_0x7995('0x19')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router[_0x7995('0x19')]('/:id/notify',controller['notify']);router[_0x7995('0x19')]('/:id/applications',auth['isAuthenticated'](),controller[_0x7995('0x1e')]);router[_0x7995('0x19')]('/:id/send',auth[_0x7995('0xa')](),controller['send']);router['post'](_0x7995('0x1f'),controller[_0x7995('0x20')]);router[_0x7995('0x19')](_0x7995('0x17'),auth[_0x7995('0xa')](),controller[_0x7995('0x21')]);router['put'](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x23')]);router[_0x7995('0x24')](_0x7995('0x22'),auth[_0x7995('0xa')](),controller[_0x7995('0x25')]);router[_0x7995('0x24')]('/:id/dispositions',auth[_0x7995('0xa')](),controller[_0x7995('0x26')]);router[_0x7995('0x24')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x27')]);router['delete'](_0x7995('0x17'),auth['isAuthenticated'](),controller[_0x7995('0x28')]);module[_0x7995('0x29')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index ef68719..2db1441 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 _0x88c8=['randomstring','exports','STRING','name','twilio','skebby','connectel','clicksend','clickatell','bandwidth','ENUM','BOOLEAN','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition'];(function(_0x49f750,_0x3e8052){var _0x5d0fea=function(_0xd7a2ee){while(--_0xd7a2ee){_0x49f750['push'](_0x49f750['shift']());}};_0x5d0fea(++_0x3e8052);}(_0x88c8,0xee));var _0x888c=function(_0x16261b,_0x87ab5){_0x16261b=_0x16261b-0x0;var _0x1a6706=_0x88c8[_0x16261b];return _0x1a6706;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x888c('0x0'));module[_0x888c('0x1')]={'name':{'type':Sequelize[_0x888c('0x2')],'unique':_0x888c('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x888c('0x2')],'allowNull':![]},'remote':{'type':Sequelize[_0x888c('0x2')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize[_0x888c('0x2')]},'type':{'type':Sequelize['ENUM'](_0x888c('0x4'),_0x888c('0x5'),_0x888c('0x6'),_0x888c('0x7'),'plivo',_0x888c('0x8'),_0x888c('0x9'),'csc','infobip','intelepeer')},'accountSid':{'type':Sequelize[_0x888c('0x2')]},'authId':{'type':Sequelize[_0x888c('0x2')]},'authToken':{'type':Sequelize[_0x888c('0x2')]},'smsMethod':{'type':Sequelize[_0x888c('0xa')]('SI','TI','GP')},'username':{'type':Sequelize[_0x888c('0x2')]},'password':{'type':Sequelize[_0x888c('0x2')]},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize[_0x888c('0x2')]},'accountId':{'type':Sequelize[_0x888c('0x2')]},'senderString':{'type':Sequelize[_0x888c('0x2')]},'deliveryReport':{'type':Sequelize[_0x888c('0xb')],'defaultValue':![]},'description':{'type':Sequelize[_0x888c('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x888c('0xc');}},'notificationSound':{'type':Sequelize[_0x888c('0xb')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x888c('0xb')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x888c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x888c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x888c('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x888c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x888c('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x888c('0x2')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x888c('0xd')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x888c('0xb')],'defaultValue':![],'comment':_0x888c('0xe'),'set':function(_0x37b150){if(!_0x37b150)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x888c('0xf')](_0x888c('0x10'),_0x37b150);}}}; \ No newline at end of file +var _0xb628=['ENUM','skebby','clickatell','csc','infobip','intelepeer','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','name','generate'];(function(_0x53b3b6,_0x80af30){var _0x1950dd=function(_0x4d1c07){while(--_0x4d1c07){_0x53b3b6['push'](_0x53b3b6['shift']());}};_0x1950dd(++_0x80af30);}(_0xb628,0x12e));var _0x8b62=function(_0x5b8fe0,_0x55e2bc){_0x5b8fe0=_0x5b8fe0-0x0;var _0x5f80a2=_0xb628[_0x5b8fe0];return _0x5f80a2;};'use strict';var Sequelize=require(_0x8b62('0x0'));var rs=require('randomstring');module['exports']={'name':{'type':Sequelize[_0x8b62('0x1')],'unique':_0x8b62('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x8b62('0x1')],'allowNull':![]},'remote':{'type':Sequelize[_0x8b62('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x8b62('0x1')],'defaultValue':function(){return rs[_0x8b62('0x3')]();}},'phone':{'type':Sequelize[_0x8b62('0x1')]},'type':{'type':Sequelize[_0x8b62('0x4')]('twilio',_0x8b62('0x5'),'connectel','clicksend','plivo',_0x8b62('0x6'),'bandwidth',_0x8b62('0x7'),_0x8b62('0x8'),_0x8b62('0x9'))},'accountSid':{'type':Sequelize[_0x8b62('0x1')]},'authId':{'type':Sequelize[_0x8b62('0x1')]},'authToken':{'type':Sequelize[_0x8b62('0x1')]},'smsMethod':{'type':Sequelize[_0x8b62('0x4')]('SI','TI','GP')},'username':{'type':Sequelize[_0x8b62('0x1')]},'password':{'type':Sequelize['STRING']},'apiKey':{'type':Sequelize['STRING']},'applicationId':{'type':Sequelize['STRING']},'accountId':{'type':Sequelize[_0x8b62('0x1')]},'senderString':{'type':Sequelize[_0x8b62('0x1')]},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x8b62('0xa')],'defaultValue':function(){return _0x8b62('0xb');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x8b62('0xc')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x8b62('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x8b62('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x8b62('0xc')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x8b62('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x8b62('0xc')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x8b62('0xd')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x8b62('0xc')],'defaultValue':![],'comment':_0x8b62('0xe'),'set':function(_0x5b901b){if(!_0x5b901b)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x8b62('0xf')](_0x8b62('0x10'),_0x5b901b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index c67866e..c6e68da 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 _0xf494=['hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','findAll','rows','show','Pause','include','merge','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','addDisposition','getDispositions','findOne','SmsAccountId','Disposition','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','notify','sms','account','applications','Applications','priority','asc','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','mobile','twilio','from','Body','messageId','MessageSid','skebby','sender','text','connectel','clicksend','plivo','From','infobip','results','segmentedMessage','clickatell','bandwidth','intelepeer','refid','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','DESC','omit','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','unmanaged','SmsMessage','ContactId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','queueId','SmsQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','addApplications','sequelize','ISOLATION_LEVELS','READ_COMMITTED','SmsApplication','bulkCreate','findAndCountAll','finally','getApplications','getInteractions','Contact','Owner','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','Messages','dataValues','skebby_dispatch_id','requestid','statusInt','message_id','status_code','groupName','DELIVERED','redif','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','received\x20delivery\x20report\x20from','csc','message-id','state','addAgents','userSmsAccount:save','removeAgents','emit','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','http','info','SmsAccount,\x20%s,\x20%s','debug','stringify','error','code','message','result','catch','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','SmsAccounts','destroy','sendStatus','stack','name','send','mandatoryDispositionPause','map','SmsAccount','rawAttributes','type','model','query','keys','intersection','fields','attributes','length'];(function(_0x3e6045,_0x48bbeb){var _0x161d0f=function(_0x48ed3d){while(--_0x48ed3d){_0x3e6045['push'](_0x3e6045['shift']());}};_0x161d0f(++_0x48bbeb);}(_0xf494,0x9d));var _0x4f49=function(_0x3a8d86,_0xbc8e50){_0x3a8d86=_0x3a8d86-0x0;var _0x576f5=_0xf494[_0x3a8d86];return _0x576f5;};'use strict';var emlformat=require(_0x4f49('0x0'));var rimraf=require(_0x4f49('0x1'));var zipdir=require(_0x4f49('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4f49('0x3'));var moment=require(_0x4f49('0x4'));var BPromise=require(_0x4f49('0x5'));var Mustache=require(_0x4f49('0x6'));var util=require(_0x4f49('0x7'));var path=require(_0x4f49('0x8'));var sox=require(_0x4f49('0x9'));var csv=require(_0x4f49('0xa'));var ejs=require(_0x4f49('0xb'));var fs=require('fs');var fs_extra=require(_0x4f49('0xc'));var _=require(_0x4f49('0xd'));var squel=require(_0x4f49('0xe'));var crypto=require('crypto');var jsforce=require(_0x4f49('0xf'));var deskjs=require(_0x4f49('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4f49('0x11'));var Papa=require(_0x4f49('0x12'));var Redis=require('ioredis');var authService=require(_0x4f49('0x13'));var qs=require(_0x4f49('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4f49('0x15'));var logger=require(_0x4f49('0x16'))(_0x4f49('0x17'));var utils=require(_0x4f49('0x18'));var config=require(_0x4f49('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x4f49('0x1a'))['db'];config[_0x4f49('0x1b')]=_[_0x4f49('0x1c')](config[_0x4f49('0x1b')],{'host':'localhost','port':0x18eb});var socket=require(_0x4f49('0x1d'))(new Redis(config[_0x4f49('0x1b')]));require('./smsAccount.socket')['register'](socket);var jayson=require(_0x4f49('0x1e'));var client=jayson['client'][_0x4f49('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x86b58,_0x1ad560,_0xca5c2,_0x4e6c04){return new BPromise(function(_0x1defd4,_0x133349){var _0x11eadd=_0x4e6c04||client;return _0x11eadd['request'](_0x86b58,_0xca5c2)['then'](function(_0x4e8b8b){logger[_0x4f49('0x20')](_0x4f49('0x21'),_0x1ad560,'request\x20sent');logger[_0x4f49('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1ad560,'request\x20sent',JSON[_0x4f49('0x23')](_0x4e8b8b));if(_0x4e8b8b[_0x4f49('0x24')]){if(_0x4e8b8b['error'][_0x4f49('0x25')]===0x1f4){logger[_0x4f49('0x24')](_0x4f49('0x21'),_0x1ad560,_0x4e8b8b[_0x4f49('0x24')][_0x4f49('0x26')]);return _0x133349(_0x4e8b8b[_0x4f49('0x24')][_0x4f49('0x26')]);}logger[_0x4f49('0x24')](_0x4f49('0x21'),_0x1ad560,_0x4e8b8b[_0x4f49('0x24')][_0x4f49('0x26')]);return _0x1defd4(_0x4e8b8b[_0x4f49('0x24')][_0x4f49('0x26')]);}else{logger[_0x4f49('0x20')](_0x4f49('0x21'),_0x1ad560,'request\x20sent');_0x1defd4(_0x4e8b8b[_0x4f49('0x27')][_0x4f49('0x26')]);}})[_0x4f49('0x28')](function(_0x15b7cb){logger['error'](_0x4f49('0x21'),_0x1ad560,_0x15b7cb);_0x133349(_0x15b7cb);});});}function respondWithStatusCode(_0x4cfa5e,_0xd1cd2f){_0xd1cd2f=_0xd1cd2f||0xcc;return function(_0x5b961a){if(_0x5b961a){return _0x4cfa5e['sendStatus'](_0xd1cd2f);}return _0x4cfa5e[_0x4f49('0x29')](_0xd1cd2f)[_0x4f49('0x2a')]();};}function respondWithResult(_0x2c0ab8,_0x52765a){_0x52765a=_0x52765a||0xc8;return function(_0x19829d){if(_0x19829d){return _0x2c0ab8[_0x4f49('0x29')](_0x52765a)[_0x4f49('0x2b')](_0x19829d);}};}function respondWithFilteredResult(_0x17b98f,_0x5ed5b7){return function(_0x36959a){if(_0x36959a){var _0x1e2802=typeof _0x5ed5b7[_0x4f49('0x2c')]==='undefined'&&typeof _0x5ed5b7[_0x4f49('0x2d')]===_0x4f49('0x2e');var _0x32763c=_0x36959a[_0x4f49('0x2f')];var _0x44af6c=_0x1e2802?0x0:_0x5ed5b7[_0x4f49('0x2c')];var _0x5b8c97=_0x1e2802?_0x36959a[_0x4f49('0x2f')]:_0x5ed5b7[_0x4f49('0x2c')]+_0x5ed5b7[_0x4f49('0x2d')];var _0x41e213;if(_0x5b8c97>=_0x32763c){_0x5b8c97=_0x32763c;_0x41e213=0xc8;}else{_0x41e213=0xce;}_0x17b98f[_0x4f49('0x29')](_0x41e213);return _0x17b98f[_0x4f49('0x30')](_0x4f49('0x31'),_0x44af6c+'-'+_0x5b8c97+'/'+_0x32763c)[_0x4f49('0x2b')](_0x36959a);}return null;};}function patchUpdates(_0x25db05){return function(_0x15780a){try{jsonpatch[_0x4f49('0x32')](_0x15780a,_0x25db05,!![]);}catch(_0x1e8667){return BPromise[_0x4f49('0x33')](_0x1e8667);}return _0x15780a[_0x4f49('0x34')]();};}function saveUpdates(_0x4ac813,_0x40d287){return function(_0x8d79da){if(_0x8d79da){return _0x8d79da['update'](_0x4ac813)[_0x4f49('0x35')](function(_0x1ddb40){return _0x1ddb40;});}return null;};}function removeEntity(_0x18dfda,_0x2a2e3a){return function(_0x5c1030){if(_0x5c1030){return _0x5c1030['destroy']()[_0x4f49('0x35')](function(){var _0xb3dec6=_0x5c1030['get']({'plain':!![]});var _0x2efd59=_0x4f49('0x36');return db['UserProfileResource'][_0x4f49('0x37')]({'where':{'type':_0x2efd59,'resourceId':_0xb3dec6['id']}})[_0x4f49('0x35')](function(){return _0x5c1030;});})[_0x4f49('0x35')](function(){_0x18dfda[_0x4f49('0x29')](0xcc)[_0x4f49('0x2a')]();});}};}function handleEntityNotFound(_0x47e52d,_0x16fdb0){return function(_0x3eebe3){if(!_0x3eebe3){_0x47e52d[_0x4f49('0x38')](0x194);}return _0x3eebe3;};}function handleError(_0x3fd704,_0x46310d){_0x46310d=_0x46310d||0x1f4;return function(_0x5c0fe8){logger[_0x4f49('0x24')](_0x5c0fe8[_0x4f49('0x39')]);if(_0x5c0fe8['name']){delete _0x5c0fe8[_0x4f49('0x3a')];}_0x3fd704['status'](_0x46310d)[_0x4f49('0x3b')](_0x5c0fe8);};}exports['index']=function(_0x360c5b,_0x22e62c){var _0x3e2742={'include':[{'model':db['Pause'],'as':_0x4f49('0x3c')}]},_0x5512dd={},_0x5bede5={'count':0x0,'rows':[]};var _0x380878=_[_0x4f49('0x3d')](db[_0x4f49('0x3e')][_0x4f49('0x3f')],function(_0x37de8e){return{'name':_0x37de8e['fieldName'],'type':_0x37de8e[_0x4f49('0x40')]['key']};});_0x5512dd[_0x4f49('0x41')]=_[_0x4f49('0x3d')](_0x380878,_0x4f49('0x3a'));_0x5512dd[_0x4f49('0x42')]=_[_0x4f49('0x43')](_0x360c5b[_0x4f49('0x42')]);_0x5512dd['filters']=_[_0x4f49('0x44')](_0x5512dd[_0x4f49('0x41')],_0x5512dd[_0x4f49('0x42')]);_0x3e2742['attributes']=_[_0x4f49('0x44')](_0x5512dd[_0x4f49('0x41')],qs[_0x4f49('0x45')](_0x360c5b[_0x4f49('0x42')][_0x4f49('0x45')]));_0x3e2742[_0x4f49('0x46')]=_0x3e2742[_0x4f49('0x46')][_0x4f49('0x47')]?_0x3e2742[_0x4f49('0x46')]:_0x5512dd[_0x4f49('0x41')];if(!_0x360c5b[_0x4f49('0x42')][_0x4f49('0x48')](_0x4f49('0x49'))){_0x3e2742[_0x4f49('0x2d')]=qs[_0x4f49('0x2d')](_0x360c5b[_0x4f49('0x42')][_0x4f49('0x2d')]);_0x3e2742['offset']=qs[_0x4f49('0x2c')](_0x360c5b[_0x4f49('0x42')][_0x4f49('0x2c')]);}_0x3e2742[_0x4f49('0x4a')]=qs['sort'](_0x360c5b[_0x4f49('0x42')][_0x4f49('0x4b')]);_0x3e2742[_0x4f49('0x4c')]=qs[_0x4f49('0x4d')](_[_0x4f49('0x4e')](_0x360c5b[_0x4f49('0x42')],_0x5512dd['filters']),_0x380878);if(_0x360c5b[_0x4f49('0x42')]['filter']){_0x3e2742[_0x4f49('0x4c')]=_['merge'](_0x3e2742['where'],{'$or':_[_0x4f49('0x3d')](_0x380878,function(_0x507472){if(_0x507472['type']!==_0x4f49('0x4f')){var _0x389516={};_0x389516[_0x507472[_0x4f49('0x3a')]]={'$like':'%'+_0x360c5b[_0x4f49('0x42')][_0x4f49('0x50')]+'%'};return _0x389516;}})});}_0x3e2742=_['merge']({},_0x3e2742,_0x360c5b[_0x4f49('0x51')]);var _0x345eb8={'where':_0x3e2742[_0x4f49('0x4c')]};return db['SmsAccount']['count'](_0x345eb8)[_0x4f49('0x35')](function(_0xb05c5c){_0x5bede5[_0x4f49('0x2f')]=_0xb05c5c;if(_0x360c5b[_0x4f49('0x42')][_0x4f49('0x52')]){_0x3e2742['include']=[{'all':!![]}];}return db[_0x4f49('0x3e')][_0x4f49('0x53')](_0x3e2742);})[_0x4f49('0x35')](function(_0x6238a0){_0x5bede5[_0x4f49('0x54')]=_0x6238a0;return _0x5bede5;})[_0x4f49('0x35')](respondWithFilteredResult(_0x22e62c,_0x3e2742))[_0x4f49('0x28')](handleError(_0x22e62c,null));};exports[_0x4f49('0x55')]=function(_0x1759e9,_0x5c0477){var _0x2799e1={'raw':![],'where':{'id':_0x1759e9['params']['id']},'include':[{'model':db[_0x4f49('0x56')],'as':'mandatoryDispositionPause'}]},_0x561596={};_0x561596[_0x4f49('0x41')]=_[_0x4f49('0x43')](db[_0x4f49('0x3e')][_0x4f49('0x3f')]);_0x561596[_0x4f49('0x42')]=_[_0x4f49('0x43')](_0x1759e9[_0x4f49('0x42')]);_0x561596[_0x4f49('0x4d')]=_['intersection'](_0x561596[_0x4f49('0x41')],_0x561596[_0x4f49('0x42')]);_0x2799e1[_0x4f49('0x46')]=_[_0x4f49('0x44')](_0x561596[_0x4f49('0x41')],qs['fields'](_0x1759e9[_0x4f49('0x42')][_0x4f49('0x45')]));_0x2799e1[_0x4f49('0x46')]=_0x2799e1[_0x4f49('0x46')][_0x4f49('0x47')]?_0x2799e1[_0x4f49('0x46')]:_0x561596[_0x4f49('0x41')];if(_0x1759e9[_0x4f49('0x42')][_0x4f49('0x52')]){_0x2799e1[_0x4f49('0x57')]=[{'all':!![]}];}_0x2799e1=_[_0x4f49('0x58')]({},_0x2799e1,_0x1759e9['options']);return db[_0x4f49('0x3e')][_0x4f49('0x59')](_0x2799e1)['then'](handleEntityNotFound(_0x5c0477,null))[_0x4f49('0x35')](respondWithResult(_0x5c0477,null))[_0x4f49('0x28')](handleError(_0x5c0477,null));};exports[_0x4f49('0x5a')]=function(_0x2d7e70,_0x1ff61a){return db[_0x4f49('0x3e')][_0x4f49('0x5a')](_0x2d7e70[_0x4f49('0x5b')],{})[_0x4f49('0x35')](function(_0x5301ab){var _0x3746e8=_0x2d7e70[_0x4f49('0x5c')][_0x4f49('0x5d')]({'plain':!![]});if(!_0x3746e8)throw new Error(_0x4f49('0x5e'));if(_0x3746e8['role']===_0x4f49('0x5c')){var _0x5f0724=_0x5301ab[_0x4f49('0x5d')]({'plain':!![]});var _0x639bcb=_0x4f49('0x36');return db['UserProfileSection'][_0x4f49('0x59')]({'where':{'name':_0x639bcb,'userProfileId':_0x3746e8[_0x4f49('0x5f')]},'raw':!![]})['then'](function(_0x53bbfa){if(_0x53bbfa&&_0x53bbfa[_0x4f49('0x60')]===0x0){return db[_0x4f49('0x61')][_0x4f49('0x5a')]({'name':_0x5f0724[_0x4f49('0x3a')],'resourceId':_0x5f0724['id'],'type':_0x53bbfa['name'],'sectionId':_0x53bbfa['id']},{})[_0x4f49('0x35')](function(){return _0x5301ab;});}else{return _0x5301ab;}})[_0x4f49('0x28')](function(_0x1bd37f){logger['error'](_0x4f49('0x62'),_0x1bd37f);throw _0x1bd37f;});}return _0x5301ab;})[_0x4f49('0x35')](respondWithResult(_0x1ff61a,0xc9))[_0x4f49('0x28')](handleError(_0x1ff61a,null));};exports[_0x4f49('0x63')]=function(_0x46c7ec,_0x425b09){if(_0x46c7ec[_0x4f49('0x5b')]['id']){delete _0x46c7ec[_0x4f49('0x5b')]['id'];}return db[_0x4f49('0x3e')][_0x4f49('0x59')]({'where':{'id':_0x46c7ec[_0x4f49('0x64')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x4f49('0x35')](handleEntityNotFound(_0x425b09,null))[_0x4f49('0x35')](saveUpdates(_0x46c7ec[_0x4f49('0x5b')],null))[_0x4f49('0x35')](respondWithResult(_0x425b09,null))[_0x4f49('0x28')](handleError(_0x425b09,null));};exports['destroy']=function(_0x8d497,_0x1815fe){return db[_0x4f49('0x3e')][_0x4f49('0x59')]({'where':{'id':_0x8d497[_0x4f49('0x64')]['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x1815fe,null))['then'](removeEntity(_0x1815fe,null))[_0x4f49('0x28')](handleError(_0x1815fe,null));};exports['describe']=function(_0x2577e5,_0x559380){return db[_0x4f49('0x3e')]['describe']()[_0x4f49('0x35')](respondWithResult(_0x559380,null))['catch'](handleError(_0x559380,null));};exports[_0x4f49('0x65')]=function(_0x2a9f9a,_0x224f6c,_0x30d16d){if(_0x2a9f9a[_0x4f49('0x5b')]['id']){delete _0x2a9f9a[_0x4f49('0x5b')]['id'];}return db[_0x4f49('0x3e')]['find']({'where':{'id':_0x2a9f9a['params']['id']}})['then'](handleEntityNotFound(_0x224f6c,null))[_0x4f49('0x35')](function(_0x997ab6){if(_0x997ab6){_0x2a9f9a[_0x4f49('0x5b')]['SmsAccountId']=_0x997ab6['id'];return db['Disposition'][_0x4f49('0x5a')](_0x2a9f9a[_0x4f49('0x5b')]);}})[_0x4f49('0x35')](respondWithResult(_0x224f6c,null))[_0x4f49('0x28')](handleError(_0x224f6c,null));};exports[_0x4f49('0x66')]=function(_0x143b7e,_0x3992f7,_0x425216){var _0x4286cd={'raw':![],'where':{}};var _0x2e636a={};var _0xa3b76={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4f49('0x67')]({'where':{'id':_0x143b7e['params']['id']}})['then'](handleEntityNotFound(_0x3992f7,null))[_0x4f49('0x35')](function(_0x5f143e){if(_0x5f143e){_0x2e636a[_0x4f49('0x41')]=_[_0x4f49('0x43')](db['Disposition'][_0x4f49('0x3f')]);_0x2e636a[_0x4f49('0x42')]=_['keys'](_0x143b7e['query']);_0x2e636a['filters']=_[_0x4f49('0x44')](_0x2e636a[_0x4f49('0x41')],_0x2e636a[_0x4f49('0x42')]);_0x4286cd[_0x4f49('0x46')]=_[_0x4f49('0x44')](_0x2e636a[_0x4f49('0x41')],qs[_0x4f49('0x45')](_0x143b7e['query'][_0x4f49('0x45')]));_0x4286cd['attributes']=_0x4286cd['attributes'][_0x4f49('0x47')]?_0x4286cd['attributes']:_0x2e636a['model'];if(!_0x143b7e[_0x4f49('0x42')]['hasOwnProperty']('nolimit')){_0x4286cd[_0x4f49('0x2d')]=qs[_0x4f49('0x2d')](_0x143b7e['query'][_0x4f49('0x2d')]);_0x4286cd[_0x4f49('0x2c')]=qs[_0x4f49('0x2c')](_0x143b7e['query']['offset']);}_0x4286cd[_0x4f49('0x4a')]=qs['sort'](_0x143b7e[_0x4f49('0x42')]['sort']);_0x4286cd[_0x4f49('0x4c')]=qs[_0x4f49('0x4d')](_[_0x4f49('0x4e')](_0x143b7e['query'],_0x2e636a[_0x4f49('0x4d')]));_0x4286cd[_0x4f49('0x4c')][_0x4f49('0x68')]=_0x5f143e['id'];if(_0x143b7e[_0x4f49('0x42')][_0x4f49('0x50')]){_0x4286cd['where']=_['merge'](_0x4286cd[_0x4f49('0x4c')],{'$or':_[_0x4f49('0x3d')](_0x4286cd[_0x4f49('0x46')],function(_0x275e36){var _0x3143b0={};_0x3143b0[_0x275e36]={'$like':'%'+_0x143b7e['query'][_0x4f49('0x50')]+'%'};return _0x3143b0;})});}_0x4286cd=_[_0x4f49('0x58')]({},_0x4286cd,_0x143b7e[_0x4f49('0x51')]);return db['Disposition'][_0x4f49('0x2f')]({'where':_0x4286cd[_0x4f49('0x4c')]})[_0x4f49('0x35')](function(_0x13ccc5){_0xa3b76[_0x4f49('0x2f')]=_0x13ccc5;if(_0x143b7e[_0x4f49('0x42')][_0x4f49('0x52')]){_0x4286cd[_0x4f49('0x57')]=[{'all':!![]}];}return db[_0x4f49('0x69')]['findAll'](_0x4286cd);})[_0x4f49('0x35')](function(_0x41c612){_0xa3b76[_0x4f49('0x54')]=_0x41c612;return _0xa3b76;});}})[_0x4f49('0x35')](respondWithFilteredResult(_0x3992f7,_0x4286cd))[_0x4f49('0x28')](handleError(_0x3992f7,null));};exports['removeDispositions']=function(_0x5794a4,_0x114ac8,_0x25b73d){return db[_0x4f49('0x3e')][_0x4f49('0x59')]({'where':{'id':_0x5794a4[_0x4f49('0x64')]['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x114ac8,null))[_0x4f49('0x35')](function(_0x3f8e29){if(_0x3f8e29){return _0x3f8e29['removeDispositions'](_0x5794a4['query'][_0x4f49('0x6a')]);}})['then'](respondWithStatusCode(_0x114ac8,null))[_0x4f49('0x28')](handleError(_0x114ac8,null));};exports[_0x4f49('0x6b')]=function(_0x127f08,_0x556268,_0x44b3ea){if(_0x127f08[_0x4f49('0x5b')]['id']){delete _0x127f08[_0x4f49('0x5b')]['id'];}return db['SmsAccount'][_0x4f49('0x59')]({'where':{'id':_0x127f08[_0x4f49('0x64')]['id']}})['then'](handleEntityNotFound(_0x556268,null))[_0x4f49('0x35')](function(_0x8c9f12){if(_0x8c9f12){_0x127f08[_0x4f49('0x5b')][_0x4f49('0x68')]=_0x8c9f12['id'];return db[_0x4f49('0x6c')][_0x4f49('0x5a')](_0x127f08['body']);}})[_0x4f49('0x35')](respondWithResult(_0x556268,null))[_0x4f49('0x28')](handleError(_0x556268,null));};exports[_0x4f49('0x6d')]=function(_0x1998eb,_0x375f15,_0x80e547){var _0x1cd2eb={'raw':![],'where':{}};var _0x3fb371={};var _0x454127={'count':0x0,'rows':[]};return db[_0x4f49('0x3e')][_0x4f49('0x67')]({'where':{'id':_0x1998eb[_0x4f49('0x64')]['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x375f15,null))[_0x4f49('0x35')](function(_0x3397d2){if(_0x3397d2){_0x3fb371[_0x4f49('0x41')]=_[_0x4f49('0x43')](db['CannedAnswer']['rawAttributes']);_0x3fb371['query']=_[_0x4f49('0x43')](_0x1998eb[_0x4f49('0x42')]);_0x3fb371['filters']=_['intersection'](_0x3fb371[_0x4f49('0x41')],_0x3fb371[_0x4f49('0x42')]);_0x1cd2eb[_0x4f49('0x46')]=_['intersection'](_0x3fb371['model'],qs[_0x4f49('0x45')](_0x1998eb['query'][_0x4f49('0x45')]));_0x1cd2eb[_0x4f49('0x46')]=_0x1cd2eb[_0x4f49('0x46')][_0x4f49('0x47')]?_0x1cd2eb['attributes']:_0x3fb371['model'];if(!_0x1998eb[_0x4f49('0x42')]['hasOwnProperty'](_0x4f49('0x49'))){_0x1cd2eb[_0x4f49('0x2d')]=qs[_0x4f49('0x2d')](_0x1998eb['query'][_0x4f49('0x2d')]);_0x1cd2eb[_0x4f49('0x2c')]=qs['offset'](_0x1998eb[_0x4f49('0x42')][_0x4f49('0x2c')]);}_0x1cd2eb[_0x4f49('0x4a')]=qs['sort'](_0x1998eb['query'][_0x4f49('0x4b')]);_0x1cd2eb['where']=qs[_0x4f49('0x4d')](_[_0x4f49('0x4e')](_0x1998eb[_0x4f49('0x42')],_0x3fb371[_0x4f49('0x4d')]));_0x1cd2eb[_0x4f49('0x4c')]['SmsAccountId']=_0x3397d2['id'];if(_0x1998eb[_0x4f49('0x42')][_0x4f49('0x50')]){_0x1cd2eb['where']=_['merge'](_0x1cd2eb[_0x4f49('0x4c')],{'$or':_['map'](_0x1cd2eb[_0x4f49('0x46')],function(_0x46632f){var _0x24dac4={};_0x24dac4[_0x46632f]={'$like':'%'+_0x1998eb['query'][_0x4f49('0x50')]+'%'};return _0x24dac4;})});}_0x1cd2eb=_[_0x4f49('0x58')]({},_0x1cd2eb,_0x1998eb[_0x4f49('0x51')]);return db[_0x4f49('0x6c')]['count']({'where':_0x1cd2eb['where']})['then'](function(_0x1bb11b){_0x454127['count']=_0x1bb11b;if(_0x1998eb[_0x4f49('0x42')]['includeAll']){_0x1cd2eb[_0x4f49('0x57')]=[{'all':!![]}];}return db[_0x4f49('0x6c')]['findAll'](_0x1cd2eb);})[_0x4f49('0x35')](function(_0x1ddc70){_0x454127['rows']=_0x1ddc70;return _0x454127;});}})[_0x4f49('0x35')](respondWithFilteredResult(_0x375f15,_0x1cd2eb))[_0x4f49('0x28')](handleError(_0x375f15,null));};exports[_0x4f49('0x6e')]=function(_0x4b0c8d,_0x10ec2b,_0x2820ca){return db[_0x4f49('0x3e')][_0x4f49('0x59')]({'where':{'id':_0x4b0c8d[_0x4f49('0x64')]['id']}})['then'](handleEntityNotFound(_0x10ec2b,null))[_0x4f49('0x35')](function(_0x7e5733){if(_0x7e5733){return _0x7e5733[_0x4f49('0x6e')](_0x4b0c8d[_0x4f49('0x42')][_0x4f49('0x6a')]);}})[_0x4f49('0x35')](respondWithStatusCode(_0x10ec2b,null))[_0x4f49('0x28')](handleError(_0x10ec2b,null));};exports[_0x4f49('0x6f')]=function(_0x38f392,_0x377959,_0x5969a2){var _0x3abcfb={'channel':_0x4f49('0x70')};var _0x19d565=[];var _0xeb6774=[];var _0xc06aea={};return db[_0x4f49('0x3e')][_0x4f49('0x59')]({'where':{'id':_0x38f392[_0x4f49('0x64')]['id']},'include':[{'model':db['SmsApplication'],'as':'Applications'}]})[_0x4f49('0x35')](handleEntityNotFound(_0x377959,null))[_0x4f49('0x35')](function(_0x3de170){_0x3abcfb[_0x4f49('0x71')]=_0x3de170;_0x3abcfb[_0x4f49('0x72')]=_['orderBy'](_0x3de170[_0x4f49('0x73')],[_0x4f49('0x74')],[_0x4f49('0x75')]);if(_0x3abcfb['account']['Applications']){delete _0x3abcfb[_0x4f49('0x71')][_0x4f49('0x73')];}return db[_0x4f49('0x76')][_0x4f49('0x77')]();})[_0x4f49('0x35')](function(_0x34d22e){if(!_0x34d22e){throw new db[(_0x4f49('0x78'))][(_0x4f49('0x79'))](_0x4f49('0x7a'));}_0x19d565=_[_0x4f49('0x7b')](_[_0x4f49('0x43')](_0x34d22e),[_0x4f49('0x7c'),_0x4f49('0x7d')]);_0xeb6774=_[_0x4f49('0x7b')](_[_0x4f49('0x43')](_0x34d22e),['createdAt','updatedAt','CompanyId','ListId']);_0x3abcfb[_0x4f49('0x5b')]={'mapKey':_0x4f49('0x7e')};if(_0x3abcfb[_0x4f49('0x71')][_0x4f49('0x40')]){switch(_0x3abcfb['account']['type']){case _0x4f49('0x7f'):_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]=_0x38f392[_0x4f49('0x5b')]['From'];_0x3abcfb['body']['body']=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x81')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x82')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x83')];break;case _0x4f49('0x84'):_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]='+'+_0x38f392[_0x4f49('0x5b')][_0x4f49('0x85')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x86')];break;case _0x4f49('0x87'):_0x3abcfb['body'][_0x4f49('0x80')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x80')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')]['message'];break;case _0x4f49('0x88'):_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x80')];_0x3abcfb['body']['body']=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x5b')];_0x3abcfb['body']['messageId']=_0x38f392[_0x4f49('0x5b')]['message_id'];break;case _0x4f49('0x89'):_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x8a')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')]['Text'];_0x3abcfb[_0x4f49('0x5b')]['messageId']=_0x38f392[_0x4f49('0x5b')]['MessageUUID'];break;case _0x4f49('0x8b'):_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]='+'+_0x38f392[_0x4f49('0x5b')][_0x4f49('0x8c')][0x0][_0x4f49('0x80')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x8c')][0x0]['text'];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x82')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x8c')][0x0][_0x4f49('0x82')];break;case'csc':_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]=_0x38f392['body']['originatingAddress'];_0x3abcfb['body'][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x8d')][_0x4f49('0x26')];break;case _0x4f49('0x8e'):_0x3abcfb['body'][_0x4f49('0x80')]=_0x38f392[_0x4f49('0x5b')]['fromNumber'];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x86')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x82')]=_0x38f392[_0x4f49('0x5b')]['replyMessageId'];break;case _0x4f49('0x8f'):_0x3abcfb['body'][_0x4f49('0x82')]=_0x38f392[_0x4f49('0x5b')][0x0][_0x4f49('0x26')]['id'];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]=_0x38f392[_0x4f49('0x5b')][0x0][_0x4f49('0x26')][_0x4f49('0x80')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')][0x0][_0x4f49('0x26')][_0x4f49('0x86')];break;case _0x4f49('0x90'):_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x80')];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x5b')]=_0x38f392[_0x4f49('0x5b')]['message'];_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x82')]=_0x38f392[_0x4f49('0x5b')][_0x4f49('0x91')];break;}}if(_0x3abcfb['body']['id']){delete _0x3abcfb[_0x4f49('0x5b')]['id'];}if(_['isNil'](_0x3abcfb[_0x4f49('0x5b')]['from'])){throw new db[(_0x4f49('0x78'))]['ValidationError'](_0x4f49('0x92'));}if(_[_0x4f49('0x93')](_0x3abcfb[_0x4f49('0x5b')]['body'])||_0x3abcfb[_0x4f49('0x5b')]['body']===''){throw new db[(_0x4f49('0x78'))]['ValidationError'](_0x4f49('0x94'));}if(_[_0x4f49('0x93')](_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x95')])){throw new db[(_0x4f49('0x78'))][(_0x4f49('0x79'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0xeb6774);}if(!_[_0x4f49('0x96')](_0xeb6774,_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x95')])){throw new db[(_0x4f49('0x78'))][(_0x4f49('0x79'))](_0x4f49('0x97')+_0xeb6774);}_0xc06aea[_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x95')]]=_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')];return db[_0x4f49('0x98')]['find']({'where':{'id':_0x3abcfb[_0x4f49('0x71')][_0x4f49('0x99')]},'include':[{'model':db['CmContact'],'as':_0x4f49('0x9a'),'where':_0xc06aea,'limit':0x1,'order':[[_0x4f49('0x7d'),_0x4f49('0x9b')]]}]});})['then'](handleEntityNotFound(_0x377959,null))['then'](function(_0x513b13){if(_0x513b13){_0x3abcfb['list']=_[_0x4f49('0x9c')](_0x513b13,[_0x4f49('0x9a')]);if(_0x513b13[_0x4f49('0x9a')][_0x4f49('0x47')]){return _0x513b13[_0x4f49('0x9a')][0x0];}var _0xd78e9f=_[_0x4f49('0x1c')](_0x3abcfb[_0x4f49('0x5b')],{'firstName':_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')],'ListId':_0x513b13['id']});_0xd78e9f[_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x95')]]=_0x3abcfb[_0x4f49('0x5b')][_0x4f49('0x80')];return db[_0x4f49('0x76')]['create'](_0xd78e9f,{'fields':_0x19d565,'raw':!![]});}})[_0x4f49('0x35')](handleEntityNotFound(_0x377959,null))[_0x4f49('0x35')](function(_0x1d062b){if(_0x1d062b){_0x3abcfb[_0x4f49('0x9d')]=_0x1d062b;var _0x222b82={'ContactId':_0x1d062b['id'],'phone':_0x3abcfb[_0x4f49('0x5b')]['from'],'SmsAccountId':_0x38f392[_0x4f49('0x64')]['id']};var _0x3b84f9={'ContactId':_0x1d062b['id'],'SmsAccountId':_0x38f392[_0x4f49('0x64')]['id'],'closed':![]};return db[_0x4f49('0x9e')]['find']({'where':_0x3b84f9})[_0x4f49('0x35')](function(_0xcbe3c7){if(_0xcbe3c7){return[_0xcbe3c7,![]];}return db[_0x4f49('0x9e')][_0x4f49('0x5a')](_0x222b82)[_0x4f49('0x35')](function(_0x425efa){return[_0x425efa,!![]];});});}})[_0x4f49('0x9f')](function(_0x880068,_0x4ac6da){_0x3abcfb[_0x4f49('0xa0')]=_0x880068['get']({'plain':!![]});_0x3abcfb['interaction'][_0x4f49('0xa1')]=![];if(_0x4ac6da){if(_0x3abcfb[_0x4f49('0x71')][_0x4f49('0xa2')]){_0x3abcfb['applications'][_0x4f49('0xa3')]({'id':0x0,'priority':_0x3abcfb['applications'][_0x4f49('0x47')]+0x1,'app':_0x4f49('0xa4'),'appdata':_0x4f49('0xa5'),'interval':'*,*,*,*'});}_0x3abcfb['interaction'][_0x4f49('0xa1')]=!![];}return db[_0x4f49('0xa6')][_0x4f49('0x5a')]({'phone':_0x3abcfb['body'][_0x4f49('0x80')],'messageId':_0x3abcfb[_0x4f49('0x5b')]['messageId'],'body':_0x3abcfb['body'][_0x4f49('0x5b')],'SmsAccountId':_0x38f392[_0x4f49('0x64')]['id'],'SmsInteractionId':_0x880068['id'],'direction':'in','ContactId':_0x880068[_0x4f49('0xa7')],'AttachmentId':_0x3abcfb['body']['AttachmentId']});})[_0x4f49('0x35')](function(_0x40e5ae){_0x3abcfb[_0x4f49('0x26')]=_0x40e5ae;if(!_0x3abcfb[_0x4f49('0xa0')][_0x4f49('0xa8')])return;return db[_0x4f49('0xa9')][_0x4f49('0x59')]({'attributes':['id',_0x4f49('0x3a')],'where':{'id':_0x3abcfb[_0x4f49('0xa0')][_0x4f49('0xa8')]}});})[_0x4f49('0x35')](function(_0x40ec12){if(_0x40ec12){_0x3abcfb['applications'][_0x4f49('0xaa')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x40ec12[_0x4f49('0x3a')]+','+(_0x3abcfb[_0x4f49('0x71')][_0x4f49('0xab')]||0xa),'interval':_0x4f49('0xac')});}if(!_0x3abcfb[_0x4f49('0xa0')][_0x4f49('0xad')])return;return db[_0x4f49('0xae')][_0x4f49('0x59')]({'attributes':['id',_0x4f49('0x3a')],'where':{'id':_0x3abcfb[_0x4f49('0xa0')]['queueId']}});})[_0x4f49('0x35')](function(_0x290adc){if(_0x290adc){_0x3abcfb[_0x4f49('0x72')][_0x4f49('0xaa')]({'id':0x0,'priority':0x1,'app':_0x4f49('0xaf'),'appdata':_0x290adc[_0x4f49('0x3a')]+','+(_0x3abcfb['account'][_0x4f49('0xb0')]||0x12c),'interval':_0x4f49('0xac')});}return respondWithRpcPromise(_0x4f49('0xb1'),_0x4f49('0xb2'),_0x3abcfb);})[_0x4f49('0x35')](function(_0x347d69){if(_0x347d69){var _0x3c3c24=0xc8;var _0x4f8603=_0x4f49('0xb3');logger[_0x4f49('0x20')](_0x4f49('0xb4'),_0x4f8603,_0x3c3c24,'entity\x20found');logger[_0x4f49('0x22')](_0x4f49('0xb5'),_0x4f8603,_0x3c3c24,'entity\x20found',JSON['stringify'](_0x347d69));if(_0x3abcfb[_0x4f49('0x71')][_0x4f49('0x40')]===_0x4f49('0x7f')){return _0x377959[_0x4f49('0x29')](_0x3c3c24)[_0x4f49('0x30')](_0x4f49('0xb6'),_0x4f49('0xb7'))[_0x4f49('0x3b')](_0x4f49('0xb8'));}else{return _0x377959[_0x4f49('0x29')](_0x3c3c24)[_0x4f49('0x2b')](_0x347d69);}}})['catch'](handleError(_0x377959,null));};exports[_0x4f49('0xb9')]=function(_0x475f0e,_0x15f926){var _0x308108=_0x475f0e[_0x4f49('0x64')]['id'];var _0x43afc3=_0x475f0e[_0x4f49('0x5b')];var _0x25e3d5=0xc8;var _0x297d48=null;return db[_0x4f49('0xba')]['transaction']({'isolationLevel':db[_0x4f49('0xba')]['Transaction'][_0x4f49('0xbb')][_0x4f49('0xbc')]},function(_0x800d2e){return db[_0x4f49('0x3e')][_0x4f49('0x67')]({'where':{'id':_0x308108},'transaction':_0x800d2e})['then'](function(_0x100fde){if(_0x100fde){return db[_0x4f49('0xbd')][_0x4f49('0x37')]({'where':{'SmsAccountId':_0x308108},'transaction':_0x800d2e})[_0x4f49('0x35')](function(){var _0x566dd1=_[_0x4f49('0x3d')](_0x43afc3,function(_0x2240fc){_0x2240fc[_0x4f49('0x68')]=_0x308108;return _0x2240fc;});return db[_0x4f49('0xbd')][_0x4f49('0xbe')](_0x566dd1,{'transaction':_0x800d2e});});}else{_0x25e3d5=0x194;_0x297d48=[];}});})[_0x4f49('0x35')](function(){if(_0x25e3d5!==0x194){return db['SmsApplication'][_0x4f49('0xbf')]({'where':{'SmsAccountId':_0x308108},'order':_0x4f49('0x74')})[_0x4f49('0x35')](function(_0x4d39bc){_0x297d48=_0x4d39bc;});}})[_0x4f49('0x28')](function(_0x1dee3e){_0x25e3d5=0x1f4;logger[_0x4f49('0x24')](_0x1dee3e[_0x4f49('0x39')]);if(_0x1dee3e['name']){delete _0x1dee3e[_0x4f49('0x3a')];}_0x297d48=_0x1dee3e;})[_0x4f49('0xc0')](function(){if(_0x297d48===null){_0x15f926[_0x4f49('0x38')](_0x25e3d5);}else{if(_0x25e3d5===0x1f4){_0x15f926[_0x4f49('0x29')](_0x25e3d5)['send'](_0x297d48);}else{_0x15f926[_0x4f49('0x29')](_0x25e3d5)[_0x4f49('0x2b')](_0x297d48);}}});};exports[_0x4f49('0xc1')]=function(_0x17f9d6,_0x198d6c,_0x5a4986){var _0x4fc3c0={};var _0x4f0b72={};var _0x424f43;var _0x110a09;return db[_0x4f49('0x3e')][_0x4f49('0x67')]({'where':{'id':_0x17f9d6[_0x4f49('0x64')]['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x198d6c,null))['then'](function(_0x16c14a){if(_0x16c14a){_0x424f43=_0x16c14a;_0x4f0b72['model']=_[_0x4f49('0x43')](db[_0x4f49('0xbd')][_0x4f49('0x3f')]);_0x4f0b72[_0x4f49('0x42')]=_[_0x4f49('0x43')](_0x17f9d6[_0x4f49('0x42')]);_0x4f0b72['filters']=_[_0x4f49('0x44')](_0x4f0b72[_0x4f49('0x41')],_0x4f0b72[_0x4f49('0x42')]);_0x4fc3c0[_0x4f49('0x46')]=_['intersection'](_0x4f0b72['model'],qs[_0x4f49('0x45')](_0x17f9d6[_0x4f49('0x42')][_0x4f49('0x45')]));_0x4fc3c0[_0x4f49('0x46')]=_0x4fc3c0[_0x4f49('0x46')][_0x4f49('0x47')]?_0x4fc3c0[_0x4f49('0x46')]:_0x4f0b72[_0x4f49('0x41')];_0x4fc3c0[_0x4f49('0x4a')]=qs[_0x4f49('0x4b')](_0x17f9d6[_0x4f49('0x42')][_0x4f49('0x4b')]);_0x4fc3c0[_0x4f49('0x4c')]=qs[_0x4f49('0x4d')](_[_0x4f49('0x4e')](_0x17f9d6[_0x4f49('0x42')],_0x4f0b72[_0x4f49('0x4d')]));if(_0x17f9d6[_0x4f49('0x42')][_0x4f49('0x50')]){_0x4fc3c0[_0x4f49('0x4c')]=_['merge'](_0x4fc3c0['where'],{'$or':_['map'](_0x4fc3c0[_0x4f49('0x46')],function(_0x5091fb){var _0x12545d={};_0x12545d[_0x5091fb]={'$like':'%'+_0x17f9d6[_0x4f49('0x42')]['filter']+'%'};return _0x12545d;})});}_0x4fc3c0=_[_0x4f49('0x58')]({},_0x4fc3c0,_0x17f9d6[_0x4f49('0x51')]);return _0x424f43[_0x4f49('0xc1')](_0x4fc3c0);}})[_0x4f49('0x35')](function(_0x4203cb){if(_0x4203cb){_0x110a09=_0x4203cb[_0x4f49('0x47')];if(!_0x17f9d6[_0x4f49('0x42')][_0x4f49('0x48')](_0x4f49('0x49'))){_0x4fc3c0[_0x4f49('0x2d')]=qs[_0x4f49('0x2d')](_0x17f9d6[_0x4f49('0x42')]['limit']);_0x4fc3c0[_0x4f49('0x2c')]=qs[_0x4f49('0x2c')](_0x17f9d6['query'][_0x4f49('0x2c')]);}return _0x424f43[_0x4f49('0xc1')](_0x4fc3c0);}})[_0x4f49('0x35')](function(_0xf24c76){if(_0xf24c76){return _0xf24c76?{'count':_0x110a09,'rows':_0xf24c76}:null;}})[_0x4f49('0x35')](respondWithResult(_0x198d6c,null))[_0x4f49('0x28')](handleError(_0x198d6c,null));};exports[_0x4f49('0xc2')]=function(_0x284d51,_0x289a70,_0x9395dd){var _0x57730a={'raw':![],'where':{}};var _0x274b8b={};var _0x4cac08={'count':0x0,'rows':[]};return db[_0x4f49('0x3e')][_0x4f49('0x67')]({'where':{'id':_0x284d51[_0x4f49('0x64')]['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x289a70,null))[_0x4f49('0x35')](function(_0x589e2a){if(_0x589e2a){_0x274b8b['model']=_[_0x4f49('0x43')](db[_0x4f49('0x9e')][_0x4f49('0x3f')]);_0x274b8b[_0x4f49('0x42')]=_[_0x4f49('0x43')](_0x284d51['query']);_0x274b8b[_0x4f49('0x4d')]=_[_0x4f49('0x44')](_0x274b8b[_0x4f49('0x41')],_0x274b8b['query']);_0x57730a[_0x4f49('0x46')]=_['intersection'](_0x274b8b[_0x4f49('0x41')],qs[_0x4f49('0x45')](_0x284d51[_0x4f49('0x42')]['fields']));_0x57730a[_0x4f49('0x46')]=_0x57730a[_0x4f49('0x46')][_0x4f49('0x47')]?_0x57730a[_0x4f49('0x46')]:_0x274b8b['model'];if(!_0x284d51[_0x4f49('0x42')][_0x4f49('0x48')](_0x4f49('0x49'))){_0x57730a[_0x4f49('0x2d')]=qs[_0x4f49('0x2d')](_0x284d51['query'][_0x4f49('0x2d')]);_0x57730a[_0x4f49('0x2c')]=qs['offset'](_0x284d51['query'][_0x4f49('0x2c')]);}_0x57730a['order']=qs[_0x4f49('0x4b')](_0x284d51[_0x4f49('0x42')]['sort']);_0x57730a[_0x4f49('0x4c')]=qs['filters'](_[_0x4f49('0x4e')](_0x284d51['query'],_0x274b8b['filters']));_0x57730a[_0x4f49('0x4c')]['SmsAccountId']=_0x589e2a['id'];if(_0x284d51['query'][_0x4f49('0x50')]){_0x57730a['where']=_[_0x4f49('0x58')](_0x57730a['where'],{'$or':_[_0x4f49('0x3d')](_0x57730a[_0x4f49('0x46')],function(_0x1e4ff2){var _0xd7efa9={};_0xd7efa9[_0x1e4ff2]={'$like':'%'+_0x284d51[_0x4f49('0x42')][_0x4f49('0x50')]+'%'};return _0xd7efa9;})});}_0x57730a=_['merge']({},_0x57730a,_0x284d51['options']);return db[_0x4f49('0x9e')][_0x4f49('0x2f')]({'where':_0x57730a['where']})[_0x4f49('0x35')](function(_0x3a32eb){_0x4cac08[_0x4f49('0x2f')]=_0x3a32eb;if(_0x284d51['query'][_0x4f49('0x52')]){_0x57730a[_0x4f49('0x57')]=[{'model':db[_0x4f49('0x76')],'as':_0x4f49('0xc3'),'required':![]},{'model':db[_0x4f49('0xa9')],'as':_0x4f49('0xc4'),'attributes':[_0x4f49('0x3a'),'fullname',_0x4f49('0xc5')],'required':![]},{'model':db[_0x4f49('0xc6')],'as':_0x4f49('0xc7'),'attributes':['id','name',_0x4f49('0xc8')],'where':_0x284d51[_0x4f49('0x42')][_0x4f49('0xc9')]?{'id':_0x284d51[_0x4f49('0x42')][_0x4f49('0xc9')]}:undefined,'required':_0x284d51[_0x4f49('0x42')]['tag']?!![]:![]}];}return db[_0x4f49('0x9e')]['findAll'](_0x57730a);})[_0x4f49('0x35')](function(_0x2cd588){_0x4cac08[_0x4f49('0x54')]=_0x2cd588;return _0x4cac08;});}})[_0x4f49('0x35')](respondWithFilteredResult(_0x289a70,_0x57730a))[_0x4f49('0x28')](handleError(_0x289a70,null));};exports['send']=function(_0x3da596,_0x11ec64,_0x29a749){var _0x352571,_0x1a3857,_0xe9186f;if(_[_0x4f49('0x93')](_0x3da596[_0x4f49('0x5b')][_0x4f49('0x5b')])||_0x3da596[_0x4f49('0x5b')][_0x4f49('0x5b')]===''){throw new db[(_0x4f49('0x78'))][(_0x4f49('0x79'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4f49('0x93')](_0x3da596['body']['to'])){throw new db[(_0x4f49('0x78'))][(_0x4f49('0x79'))](_0x4f49('0xca'));}_0x352571=_0x3da596[_0x4f49('0x5b')]['to'];return db['SmsAccount'][_0x4f49('0x59')]({'where':{'id':_0x3da596[_0x4f49('0x64')]['id']},'include':[{'model':db['CmList'],'as':_0x4f49('0xcb'),'include':[{'model':db[_0x4f49('0x76')],'as':'Contacts','where':{'mobile':_0x352571},'limit':0x1,'order':[[_0x4f49('0x7d'),_0x4f49('0x9b')]]}]}]})[_0x4f49('0x35')](handleEntityNotFound(_0x11ec64,null))[_0x4f49('0x35')](function(_0x3a732e){if(_0x3a732e&&_0x3a732e['List']){_0x1a3857=_0x3a732e[_0x4f49('0x5d')]({'plain':!![]});if(_0x1a3857[_0x4f49('0xcb')]&&_0x1a3857[_0x4f49('0xcb')][_0x4f49('0x9a')][_0x4f49('0x47')]){return _0x1a3857['List'][_0x4f49('0x9a')][0x0];}return db[_0x4f49('0x76')][_0x4f49('0x5a')](_['defaults'](_0x3da596['body'],{'firstName':_0x352571,'mobile':_0x352571,'phone':_0x352571,'ListId':_0x1a3857[_0x4f49('0x99')]}));}})['then'](handleEntityNotFound(_0x11ec64,null))[_0x4f49('0x35')](function(_0x4850d9){if(_0x4850d9){_0xe9186f=_0x4850d9;return db['SmsInteraction']['find']({'where':{'ContactId':_0xe9186f['id'],'closed':![],'SmsAccountId':_0x1a3857['id']}})[_0x4f49('0x35')](function(_0x116565){if(_0x116565){return[_0x116565,![]];}return db['SmsInteraction']['create']({'UserId':_0x3da596[_0x4f49('0x5c')]['id'],'ContactId':_0xe9186f['id'],'SmsAccountId':_0x1a3857['id'],'phone':_0x352571,'firstMsgDirection':'out','Messages':[_[_0x4f49('0x58')](_0x3da596[_0x4f49('0x5b')],{'read':![],'body':_0x3da596[_0x4f49('0x5b')][_0x4f49('0x5b')],'phone':_0x352571,'SmsAccountId':_0x1a3857['id'],'UserId':_0x3da596['user']['id'],'ContactId':_0xe9186f['id']})]},{'include':[{'model':db[_0x4f49('0xa6')],'as':_0x4f49('0xcc')}]})[_0x4f49('0x35')](function(_0x2c0f06){return[_0x2c0f06,!![]];});});}})[_0x4f49('0x9f')](function(_0x4ac28d,_0x29f477){if(_0x29f477){return _0x4ac28d;}return db[_0x4f49('0xa6')][_0x4f49('0x5a')](_[_0x4f49('0x58')](_0x3da596[_0x4f49('0x5b')],{'read':![],'body':_0x3da596[_0x4f49('0x5b')][_0x4f49('0x5b')],'phone':_0x352571,'SmsAccountId':_0x1a3857['id'],'SmsInteractionId':_0x4ac28d['id'],'UserId':_0x3da596['user']['id'],'ContactId':_0xe9186f['id']}))[_0x4f49('0x35')](function(_0x244ea7){_0x4ac28d['dataValues'][_0x4f49('0xcc')]=[];_0x4ac28d[_0x4f49('0xcd')][_0x4f49('0xcc')][_0x4f49('0xa3')](_0x244ea7[_0x4f49('0xcd')]);return _0x4ac28d;});})[_0x4f49('0x35')](respondWithResult(_0x11ec64,null))[_0x4f49('0x28')](handleError(_0x11ec64,null));};exports[_0x4f49('0x29')]=function(_0xcf35e3,_0x4c0ff9,_0x3a1d5f){if(_0xcf35e3['body']['id']){delete _0xcf35e3[_0x4f49('0x5b')]['id'];}var _0x2a218f,_0x34b261,_0x276624;return db[_0x4f49('0x3e')][_0x4f49('0x59')]({'where':{'id':_0xcf35e3[_0x4f49('0x64')]['id']}})['then'](handleEntityNotFound(_0x4c0ff9,null))[_0x4f49('0x35')](function(_0x576acf){if(_0x576acf){_0x276624=_0x576acf;logger[_0x4f49('0x22')](_0x4f49('0xb4'),_0x4f49('0x29'),'received\x20delivery\x20report\x20from',_0x576acf['type'],util['inspect'](_0xcf35e3[_0x4f49('0x5b')],{'showHidden':![],'depth':null}));switch(_0x576acf['type']){case _0x4f49('0x84'):if(_0xcf35e3['body'][_0x4f49('0xce')]&&_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0x29')]){_0x34b261=_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0x29')];return db[_0x4f49('0xa6')][_0x4f49('0x59')]({'where':{'messageId':_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xce')]}});}break;case _0x4f49('0x87'):if(_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xcf')]&&_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xd0')]){_0x34b261=_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xd0')];return db['SmsMessage'][_0x4f49('0x59')]({'where':{'messageId':_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xcf')]}});}break;case'clicksend':if(_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xd1')]&&_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xd2')]){_0x34b261=_0xcf35e3['body'][_0x4f49('0xd2')];return db['SmsMessage'][_0x4f49('0x59')]({'where':{'messageId':_0xcf35e3[_0x4f49('0x5b')]['message_id']}});}break;case _0x4f49('0x8b'):var _0x2a524d=_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0x8c')][0x0];if(_0x2a524d[_0x4f49('0x82')]&&_0x2a524d['status'][_0x4f49('0xd3')]===_0x4f49('0xd4')){_0x34b261=_0x2a524d[_0x4f49('0x29')]['groupName'];return db[_0x4f49('0xa6')][_0x4f49('0x59')]({'where':{'messageId':_0x2a524d[_0x4f49('0x82')]}});}break;case _0x4f49('0x8e'):if(_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0x82')]&&_0xcf35e3['body'][_0x4f49('0x29')]){_0x34b261=_0xcf35e3[_0x4f49('0x5b')]['status'];return db[_0x4f49('0xa6')][_0x4f49('0x59')]({'where':{'messageId':_0xcf35e3[_0x4f49('0x5b')]['messageId']}});}break;case _0x4f49('0x8f'):if(_0xcf35e3[_0x4f49('0x5b')][0x0][_0x4f49('0x26')]['id']){_0x34b261=_0xcf35e3[_0x4f49('0x5b')][0x0][_0x4f49('0x40')];return db[_0x4f49('0xa6')][_0x4f49('0x59')]({'where':{'messageId':_0xcf35e3[_0x4f49('0x5b')][0x0]['message']['id']}});}break;case _0x4f49('0x90'):if(_0xcf35e3['body'][_0x4f49('0xd5')]&&_0xcf35e3['body'][_0x4f49('0x29')]){_0x34b261=_0xcf35e3[_0x4f49('0x5b')]['status'];return db['SmsMessage'][_0x4f49('0x59')]({'where':{'messageId':_0xcf35e3[_0x4f49('0x5b')][_0x4f49('0xd5')]}});}break;}}})['then'](handleEntityNotFound(_0x4c0ff9,null))[_0x4f49('0x35')](function(_0x3af41d){if(_0x3af41d){_0x2a218f=_0x3af41d;switch(_0x276624['type']){case _0x4f49('0x84'):if(_0x34b261===_0x4f49('0xd4')){return _0x2a218f[_0x4f49('0x63')]({'read':!![]});}else{logger['error'](_0x4f49('0xb4'),_0x4f49('0x29'),_0x4f49('0x84'),util[_0x4f49('0xd6')](_0xcf35e3['body'],{'showHidden':![],'depth':null}));}break;case _0x4f49('0x87'):if(_0x34b261==='1'){return _0x2a218f[_0x4f49('0x63')]({'read':!![]});}else{logger[_0x4f49('0x24')](_0x4f49('0xb4'),'status',_0x4f49('0x84'),util[_0x4f49('0xd6')](_0xcf35e3[_0x4f49('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4f49('0x88'):if(!_0xcf35e3['body']['error_code']&&_0x34b261>=0xc8&&_0x34b261<=0xce){return _0x2a218f[_0x4f49('0x63')]({'read':!![]});}else{logger[_0x4f49('0x24')](_0x4f49('0xb4'),_0x4f49('0x29'),_0x4f49('0x88'),util[_0x4f49('0xd6')](_0xcf35e3[_0x4f49('0x5b')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x55c002=_0xcf35e3['body'][_0x4f49('0x8c')][0x0];if(_0x55c002['status']['groupName']===_0x4f49('0xd4')){return _0x2a218f[_0x4f49('0x63')]({'read':!![]});}else{logger[_0x4f49('0x24')](_0x4f49('0xb4'),'status',_0x4f49('0x8b'),util['inspect'](_0xcf35e3['body'],{'showHidden':![],'depth':null}));}break;case _0x4f49('0x8e'):if(_0x34b261==_0x4f49('0xd7')||_0x34b261==_0x4f49('0xd8')){return _0x2a218f['update']({'read':!![]});}else{logger[_0x4f49('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4f49('0x29'),_0x4f49('0x8e'),util['inspect'](_0xcf35e3[_0x4f49('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4f49('0x8f'):if(_0x34b261==_0x4f49('0xd9')){return _0x2a218f[_0x4f49('0x63')]({'read':!![]});}else{logger[_0x4f49('0x24')](_0x4f49('0xb4'),_0x4f49('0x29'),_0x4f49('0x8f'),util[_0x4f49('0xd6')](_0xcf35e3[_0x4f49('0x5b')],{'showHidden':![],'depth':null}));}break;case _0x4f49('0x90'):if(_0x34b261===_0x4f49('0xda')||_0x34b261==='ACCEPTD'){return _0x2a218f[_0x4f49('0x63')]({'read':!![]});}else{logger['error'](_0x4f49('0xb4'),_0x4f49('0x29'),_0x4f49('0x90'),util[_0x4f49('0xd6')](_0xcf35e3['body'],{'showHidden':![],'depth':null}));}break;}return _0x2a218f;}})[_0x4f49('0x35')](respondWithResult(_0x4c0ff9,null))[_0x4f49('0x28')](handleError(_0x4c0ff9,null));};exports[_0x4f49('0xdb')]=function(_0x595524,_0x551ba8,_0x4d15be){var _0x4851ec,_0x22c16a,_0x432378;return db['SmsAccount'][_0x4f49('0x59')]({'where':{'id':_0x595524[_0x4f49('0x64')]['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x551ba8,null))[_0x4f49('0x35')](function(_0x580764){if(_0x580764){_0x432378=_0x580764;logger[_0x4f49('0x22')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4f49('0xdc'),_0x580764[_0x4f49('0x40')],util[_0x4f49('0xd6')](_0x595524[_0x4f49('0x42')],{'showHidden':![],'depth':null}));switch(_0x580764[_0x4f49('0x40')]){case _0x4f49('0xdd'):if(_0x595524[_0x4f49('0x42')][_0x4f49('0xde')]&&_0x595524[_0x4f49('0x42')][_0x4f49('0xdf')]){_0x22c16a=_0x595524['query']['state'];return db[_0x4f49('0xa6')]['find']({'where':{'messageId':_0x595524[_0x4f49('0x42')][_0x4f49('0xde')]}});}break;}}})[_0x4f49('0x35')](handleEntityNotFound(_0x551ba8,null))[_0x4f49('0x35')](function(_0x4c590f){if(_0x4c590f){_0x4851ec=_0x4c590f;switch(_0x432378['type']){case'csc':if(_0x22c16a==='2'||_0x22c16a==='6'){return _0x4851ec[_0x4f49('0x63')]({'read':!![]});}else{logger[_0x4f49('0x24')](_0x4f49('0xb4'),_0x4f49('0x29'),'csc',util[_0x4f49('0xd6')](_0x595524[_0x4f49('0x42')],{'showHidden':![],'depth':null}));};break;}return _0x4851ec;}})['then'](respondWithResult(_0x551ba8,null))[_0x4f49('0x28')](handleError(_0x551ba8,null));};exports[_0x4f49('0xe0')]=function(_0x155211,_0x4c9d01,_0x432349){return db[_0x4f49('0x3e')][_0x4f49('0x59')]({'where':{'id':_0x155211[_0x4f49('0x64')]['id']}})['then'](handleEntityNotFound(_0x4c9d01,null))[_0x4f49('0x35')](function(_0x2390db){if(_0x2390db){return _0x2390db[_0x4f49('0xe0')](_0x155211[_0x4f49('0x5b')]['ids'],_['omit'](_0x155211['body'],[_0x4f49('0x6a'),'id'])||{})[_0x4f49('0x9f')](function(_0x4cf0b8){for(var _0xa21e81=0x0;_0xa21e81<_0x155211[_0x4f49('0x5b')][_0x4f49('0x6a')][_0x4f49('0x47')];_0xa21e81+=0x1){socket['emit'](_0x4f49('0xe1'),{'UserId':Number(_0x155211[_0x4f49('0x5b')]['ids'][_0xa21e81]),'SmsAccountId':Number(_0x155211['params']['id'])});}return _0x4cf0b8;});}})[_0x4f49('0x35')](respondWithResult(_0x4c9d01,null))[_0x4f49('0x28')](handleError(_0x4c9d01,null));};exports[_0x4f49('0xe2')]=function(_0x573f32,_0x182108,_0x366523){return db['SmsAccount']['find']({'where':{'id':_0x573f32[_0x4f49('0x64')]['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x182108,null))[_0x4f49('0x35')](function(_0x2b4b39){if(_0x2b4b39){return _0x2b4b39[_0x4f49('0xe2')](_0x573f32[_0x4f49('0x42')][_0x4f49('0x6a')])['then'](function(){if(_['isArray'](_0x573f32[_0x4f49('0x42')][_0x4f49('0x6a')])){for(var _0xa6b4c0=0x0;_0xa6b4c0<_0x573f32[_0x4f49('0x42')][_0x4f49('0x6a')][_0x4f49('0x47')];_0xa6b4c0+=0x1){socket[_0x4f49('0xe3')]('userSmsAccount:remove',{'UserId':Number(_0x573f32['query'][_0x4f49('0x6a')][_0xa6b4c0]),'SmsAccountId':Number(_0x573f32[_0x4f49('0x64')]['id'])});}}else{socket[_0x4f49('0xe3')]('userSmsAccount:remove',{'UserId':Number(_0x573f32[_0x4f49('0x42')][_0x4f49('0x6a')]),'SmsAccountId':Number(_0x573f32[_0x4f49('0x64')]['id'])});}});}})[_0x4f49('0x35')](respondWithStatusCode(_0x182108,null))[_0x4f49('0x28')](handleError(_0x182108,null));};exports[_0x4f49('0xe4')]=function(_0x463cf7,_0x3f3304,_0x54f609){var _0x47f3c6={};var _0xae49c2={};var _0x3ea9ba;var _0xa14468;return db['SmsAccount']['findOne']({'where':{'id':_0x463cf7['params']['id']}})[_0x4f49('0x35')](handleEntityNotFound(_0x3f3304,null))[_0x4f49('0x35')](function(_0x6a48cb){if(_0x6a48cb){_0x3ea9ba=_0x6a48cb;_0xae49c2['model']=_[_0x4f49('0x43')](db['User'][_0x4f49('0x3f')]);_0xae49c2[_0x4f49('0x42')]=_[_0x4f49('0x43')](_0x463cf7['query']);_0xae49c2[_0x4f49('0x4d')]=_[_0x4f49('0x44')](_0xae49c2[_0x4f49('0x41')],_0xae49c2[_0x4f49('0x42')]);_0x47f3c6[_0x4f49('0x46')]=_['intersection'](_0xae49c2[_0x4f49('0x41')],qs[_0x4f49('0x45')](_0x463cf7[_0x4f49('0x42')][_0x4f49('0x45')]));_0x47f3c6[_0x4f49('0x46')]=_0x47f3c6[_0x4f49('0x46')][_0x4f49('0x47')]?_0x47f3c6['attributes']:_0xae49c2[_0x4f49('0x41')];_0x47f3c6[_0x4f49('0x4a')]=qs[_0x4f49('0x4b')](_0x463cf7[_0x4f49('0x42')][_0x4f49('0x4b')]);_0x47f3c6[_0x4f49('0x4c')]=qs[_0x4f49('0x4d')](_['pick'](_0x463cf7[_0x4f49('0x42')],_0xae49c2[_0x4f49('0x4d')]));if(_0x463cf7[_0x4f49('0x42')]['filter']){_0x47f3c6['where']=_[_0x4f49('0x58')](_0x47f3c6[_0x4f49('0x4c')],{'$or':_[_0x4f49('0x3d')](_0x47f3c6['attributes'],function(_0x296aee){var _0x4f5543={};_0x4f5543[_0x296aee]={'$like':'%'+_0x463cf7[_0x4f49('0x42')][_0x4f49('0x50')]+'%'};return _0x4f5543;})});}_0x47f3c6=_[_0x4f49('0x58')]({},_0x47f3c6,_0x463cf7[_0x4f49('0x51')]);return _0x3ea9ba[_0x4f49('0xe4')](_0x47f3c6);}})[_0x4f49('0x35')](function(_0x1be056){if(_0x1be056){_0xa14468=_0x1be056[_0x4f49('0x47')];if(!_0x463cf7[_0x4f49('0x42')][_0x4f49('0x48')](_0x4f49('0x49'))){_0x47f3c6[_0x4f49('0x2d')]=qs[_0x4f49('0x2d')](_0x463cf7[_0x4f49('0x42')][_0x4f49('0x2d')]);_0x47f3c6[_0x4f49('0x2c')]=qs[_0x4f49('0x2c')](_0x463cf7[_0x4f49('0x42')][_0x4f49('0x2c')]);}return _0x3ea9ba[_0x4f49('0xe4')](_0x47f3c6);}})['then'](function(_0x1c1c08){if(_0x1c1c08){return _0x1c1c08?{'count':_0xa14468,'rows':_0x1c1c08}:null;}})['then'](respondWithResult(_0x3f3304,null))[_0x4f49('0x28')](handleError(_0x3f3304,null));}; \ No newline at end of file +var _0xa8d7=['result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','get','SmsAccounts','UserProfileResource','destroy','stack','name','send','index','Pause','mandatoryDispositionPause','SmsAccount','fieldName','type','map','keys','filters','intersection','model','attributes','fields','query','length','hasOwnProperty','nolimit','where','pick','merge','VIRTUAL','filter','include','findAll','rows','show','params','rawAttributes','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','sort','removeDispositions','ids','addAnswer','getAnswers','findOne','CannedAnswer','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','priority','asc','ValidationError','difference','updatedAt','createdAt','CompanyId','mobile','twilio','from','From','Body','MessageSid','connectel','clicksend','message_id','messageId','MessageUUID','infobip','results','text','originatingAddress','segmentedMessage','fromNumber','bandwidth','intelepeer','isNil','Sequelize','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','CmContact','DESC','list','omit','Contacts','defaults','SmsInteraction','spread','interaction','push','unmanaged','*,*,*,*','created','ContactId','AttachmentId','UserId','User','waitForTheAssignedAgent','queueId','unshift','queue','waitForTheAssignedQueue','Start','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','text/xml','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','finally','getApplications','order','getInteractions','Contact','Owner','fullname','Tag','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','skebby','statusInt','requestid','status_code','groupName','clickatell','redif','DELIVERED','error_code','inspect','DELIVERED_TO_GATEWAY','message-delivered','DELIVRD','statusGet','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0xa8d7,0xbc));var _0x7a8d=function(_0x308374,_0x550e85){_0x308374=_0x308374-0x0;var _0x1f71e0=_0xa8d7[_0x308374];return _0x1f71e0;};'use strict';var emlformat=require(_0x7a8d('0x0'));var rimraf=require(_0x7a8d('0x1'));var zipdir=require(_0x7a8d('0x2'));var jsonpatch=require(_0x7a8d('0x3'));var rp=require(_0x7a8d('0x4'));var moment=require(_0x7a8d('0x5'));var BPromise=require(_0x7a8d('0x6'));var Mustache=require(_0x7a8d('0x7'));var util=require(_0x7a8d('0x8'));var path=require('path');var sox=require(_0x7a8d('0x9'));var csv=require(_0x7a8d('0xa'));var ejs=require(_0x7a8d('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7a8d('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7a8d('0xd'));var deskjs=require(_0x7a8d('0xe'));var toCsv=require(_0x7a8d('0xa'));var querystring=require(_0x7a8d('0xf'));var Papa=require(_0x7a8d('0x10'));var Redis=require('ioredis');var authService=require(_0x7a8d('0x11'));var qs=require(_0x7a8d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7a8d('0x13'));var logger=require(_0x7a8d('0x14'))(_0x7a8d('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7a8d('0x16'));var db=require('../../mysqldb')['db'];config[_0x7a8d('0x17')]=_['defaults'](config[_0x7a8d('0x17')],{'host':_0x7a8d('0x18'),'port':0x18eb});var socket=require(_0x7a8d('0x19'))(new Redis(config['redis']));require(_0x7a8d('0x1a'))[_0x7a8d('0x1b')](socket);var jayson=require(_0x7a8d('0x1c'));var client=jayson[_0x7a8d('0x1d')][_0x7a8d('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x373372,_0x3eb597,_0x560be1,_0x1a1f40){return new BPromise(function(_0x1d1239,_0xb67a33){var _0x701479=_0x1a1f40||client;return _0x701479['request'](_0x373372,_0x560be1)[_0x7a8d('0x1f')](function(_0x5b73a1){logger['info'](_0x7a8d('0x20'),_0x3eb597,_0x7a8d('0x21'));logger['debug'](_0x7a8d('0x22'),_0x3eb597,_0x7a8d('0x21'),JSON[_0x7a8d('0x23')](_0x5b73a1));if(_0x5b73a1[_0x7a8d('0x24')]){if(_0x5b73a1['error'][_0x7a8d('0x25')]===0x1f4){logger['error'](_0x7a8d('0x20'),_0x3eb597,_0x5b73a1['error'][_0x7a8d('0x26')]);return _0xb67a33(_0x5b73a1[_0x7a8d('0x24')]['message']);}logger[_0x7a8d('0x24')](_0x7a8d('0x20'),_0x3eb597,_0x5b73a1[_0x7a8d('0x24')]['message']);return _0x1d1239(_0x5b73a1[_0x7a8d('0x24')][_0x7a8d('0x26')]);}else{logger[_0x7a8d('0x27')](_0x7a8d('0x20'),_0x3eb597,_0x7a8d('0x21'));_0x1d1239(_0x5b73a1[_0x7a8d('0x28')][_0x7a8d('0x26')]);}})[_0x7a8d('0x29')](function(_0x18f062){logger[_0x7a8d('0x24')](_0x7a8d('0x20'),_0x3eb597,_0x18f062);_0xb67a33(_0x18f062);});});}function respondWithStatusCode(_0x5b1d16,_0x29bcbd){_0x29bcbd=_0x29bcbd||0xcc;return function(_0x11702c){if(_0x11702c){return _0x5b1d16[_0x7a8d('0x2a')](_0x29bcbd);}return _0x5b1d16[_0x7a8d('0x2b')](_0x29bcbd)[_0x7a8d('0x2c')]();};}function respondWithResult(_0x2c7829,_0x4f01d9){_0x4f01d9=_0x4f01d9||0xc8;return function(_0x485ef8){if(_0x485ef8){return _0x2c7829[_0x7a8d('0x2b')](_0x4f01d9)[_0x7a8d('0x2d')](_0x485ef8);}};}function respondWithFilteredResult(_0x3cf8d7,_0x103a01){return function(_0x5d83ce){if(_0x5d83ce){var _0x366ef2=typeof _0x103a01[_0x7a8d('0x2e')]===_0x7a8d('0x2f')&&typeof _0x103a01[_0x7a8d('0x30')]===_0x7a8d('0x2f');var _0x2ce00e=_0x5d83ce['count'];var _0x5549aa=_0x366ef2?0x0:_0x103a01[_0x7a8d('0x2e')];var _0x537983=_0x366ef2?_0x5d83ce[_0x7a8d('0x31')]:_0x103a01[_0x7a8d('0x2e')]+_0x103a01[_0x7a8d('0x30')];var _0xa46479;if(_0x537983>=_0x2ce00e){_0x537983=_0x2ce00e;_0xa46479=0xc8;}else{_0xa46479=0xce;}_0x3cf8d7[_0x7a8d('0x2b')](_0xa46479);return _0x3cf8d7[_0x7a8d('0x32')](_0x7a8d('0x33'),_0x5549aa+'-'+_0x537983+'/'+_0x2ce00e)[_0x7a8d('0x2d')](_0x5d83ce);}return null;};}function patchUpdates(_0x1cebc2){return function(_0x5bd0aa){try{jsonpatch[_0x7a8d('0x34')](_0x5bd0aa,_0x1cebc2,!![]);}catch(_0x1f9b3a){return BPromise[_0x7a8d('0x35')](_0x1f9b3a);}return _0x5bd0aa[_0x7a8d('0x36')]();};}function saveUpdates(_0x415685,_0x2ddcf6){return function(_0x500eff){if(_0x500eff){return _0x500eff[_0x7a8d('0x37')](_0x415685)['then'](function(_0x43e680){return _0x43e680;});}return null;};}function removeEntity(_0x4b7acf,_0xa9a1db){return function(_0x3da257){if(_0x3da257){return _0x3da257['destroy']()[_0x7a8d('0x1f')](function(){var _0x2a0392=_0x3da257[_0x7a8d('0x38')]({'plain':!![]});var _0x4b458f=_0x7a8d('0x39');return db[_0x7a8d('0x3a')][_0x7a8d('0x3b')]({'where':{'type':_0x4b458f,'resourceId':_0x2a0392['id']}})[_0x7a8d('0x1f')](function(){return _0x3da257;});})[_0x7a8d('0x1f')](function(){_0x4b7acf[_0x7a8d('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5f1261,_0x41107d){return function(_0x2a20ea){if(!_0x2a20ea){_0x5f1261[_0x7a8d('0x2a')](0x194);}return _0x2a20ea;};}function handleError(_0x2ea4b9,_0x59458d){_0x59458d=_0x59458d||0x1f4;return function(_0x3e6933){logger[_0x7a8d('0x24')](_0x3e6933[_0x7a8d('0x3c')]);if(_0x3e6933[_0x7a8d('0x3d')]){delete _0x3e6933[_0x7a8d('0x3d')];}_0x2ea4b9[_0x7a8d('0x2b')](_0x59458d)[_0x7a8d('0x3e')](_0x3e6933);};}exports[_0x7a8d('0x3f')]=function(_0x15919b,_0x48d426){var _0x28929b={'include':[{'model':db[_0x7a8d('0x40')],'as':_0x7a8d('0x41')}]},_0xe57f98={},_0x22f4ec={'count':0x0,'rows':[]};var _0x364f1b=_['map'](db[_0x7a8d('0x42')]['rawAttributes'],function(_0x1357d6){return{'name':_0x1357d6[_0x7a8d('0x43')],'type':_0x1357d6[_0x7a8d('0x44')]['key']};});_0xe57f98['model']=_[_0x7a8d('0x45')](_0x364f1b,_0x7a8d('0x3d'));_0xe57f98['query']=_[_0x7a8d('0x46')](_0x15919b['query']);_0xe57f98[_0x7a8d('0x47')]=_[_0x7a8d('0x48')](_0xe57f98[_0x7a8d('0x49')],_0xe57f98['query']);_0x28929b[_0x7a8d('0x4a')]=_[_0x7a8d('0x48')](_0xe57f98[_0x7a8d('0x49')],qs[_0x7a8d('0x4b')](_0x15919b[_0x7a8d('0x4c')][_0x7a8d('0x4b')]));_0x28929b[_0x7a8d('0x4a')]=_0x28929b[_0x7a8d('0x4a')][_0x7a8d('0x4d')]?_0x28929b[_0x7a8d('0x4a')]:_0xe57f98[_0x7a8d('0x49')];if(!_0x15919b[_0x7a8d('0x4c')][_0x7a8d('0x4e')](_0x7a8d('0x4f'))){_0x28929b[_0x7a8d('0x30')]=qs['limit'](_0x15919b[_0x7a8d('0x4c')][_0x7a8d('0x30')]);_0x28929b[_0x7a8d('0x2e')]=qs[_0x7a8d('0x2e')](_0x15919b['query'][_0x7a8d('0x2e')]);}_0x28929b['order']=qs['sort'](_0x15919b['query']['sort']);_0x28929b[_0x7a8d('0x50')]=qs['filters'](_[_0x7a8d('0x51')](_0x15919b[_0x7a8d('0x4c')],_0xe57f98['filters']),_0x364f1b);if(_0x15919b['query']['filter']){_0x28929b[_0x7a8d('0x50')]=_[_0x7a8d('0x52')](_0x28929b[_0x7a8d('0x50')],{'$or':_['map'](_0x364f1b,function(_0xc89139){if(_0xc89139[_0x7a8d('0x44')]!==_0x7a8d('0x53')){var _0xd7902e={};_0xd7902e[_0xc89139[_0x7a8d('0x3d')]]={'$like':'%'+_0x15919b['query'][_0x7a8d('0x54')]+'%'};return _0xd7902e;}})});}_0x28929b=_[_0x7a8d('0x52')]({},_0x28929b,_0x15919b['options']);var _0x364bca={'where':_0x28929b[_0x7a8d('0x50')]};return db[_0x7a8d('0x42')][_0x7a8d('0x31')](_0x364bca)['then'](function(_0x1de8ca){_0x22f4ec[_0x7a8d('0x31')]=_0x1de8ca;if(_0x15919b[_0x7a8d('0x4c')]['includeAll']){_0x28929b[_0x7a8d('0x55')]=[{'all':!![]}];}return db['SmsAccount'][_0x7a8d('0x56')](_0x28929b);})['then'](function(_0x169ba4){_0x22f4ec[_0x7a8d('0x57')]=_0x169ba4;return _0x22f4ec;})['then'](respondWithFilteredResult(_0x48d426,_0x28929b))[_0x7a8d('0x29')](handleError(_0x48d426,null));};exports[_0x7a8d('0x58')]=function(_0x54f134,_0x11654e){var _0x1a8448={'raw':![],'where':{'id':_0x54f134[_0x7a8d('0x59')]['id']},'include':[{'model':db[_0x7a8d('0x40')],'as':_0x7a8d('0x41')}]},_0x3b707f={};_0x3b707f[_0x7a8d('0x49')]=_[_0x7a8d('0x46')](db[_0x7a8d('0x42')][_0x7a8d('0x5a')]);_0x3b707f[_0x7a8d('0x4c')]=_[_0x7a8d('0x46')](_0x54f134[_0x7a8d('0x4c')]);_0x3b707f[_0x7a8d('0x47')]=_['intersection'](_0x3b707f[_0x7a8d('0x49')],_0x3b707f[_0x7a8d('0x4c')]);_0x1a8448['attributes']=_['intersection'](_0x3b707f[_0x7a8d('0x49')],qs[_0x7a8d('0x4b')](_0x54f134[_0x7a8d('0x4c')][_0x7a8d('0x4b')]));_0x1a8448[_0x7a8d('0x4a')]=_0x1a8448['attributes'][_0x7a8d('0x4d')]?_0x1a8448[_0x7a8d('0x4a')]:_0x3b707f[_0x7a8d('0x49')];if(_0x54f134[_0x7a8d('0x4c')][_0x7a8d('0x5b')]){_0x1a8448[_0x7a8d('0x55')]=[{'all':!![]}];}_0x1a8448=_[_0x7a8d('0x52')]({},_0x1a8448,_0x54f134[_0x7a8d('0x5c')]);return db['SmsAccount'][_0x7a8d('0x5d')](_0x1a8448)[_0x7a8d('0x1f')](handleEntityNotFound(_0x11654e,null))[_0x7a8d('0x1f')](respondWithResult(_0x11654e,null))[_0x7a8d('0x29')](handleError(_0x11654e,null));};exports[_0x7a8d('0x5e')]=function(_0x17a47f,_0x3f4f07){return db[_0x7a8d('0x42')][_0x7a8d('0x5e')](_0x17a47f[_0x7a8d('0x5f')],{})[_0x7a8d('0x1f')](function(_0x3f861b){var _0x161b04=_0x17a47f[_0x7a8d('0x60')][_0x7a8d('0x38')]({'plain':!![]});if(!_0x161b04)throw new Error(_0x7a8d('0x61'));if(_0x161b04[_0x7a8d('0x62')]==='user'){var _0x55ceba=_0x3f861b[_0x7a8d('0x38')]({'plain':!![]});var _0x2782b5=_0x7a8d('0x39');return db['UserProfileSection']['find']({'where':{'name':_0x2782b5,'userProfileId':_0x161b04['userProfileId']},'raw':!![]})[_0x7a8d('0x1f')](function(_0x124f39){if(_0x124f39&&_0x124f39[_0x7a8d('0x63')]===0x0){return db[_0x7a8d('0x3a')][_0x7a8d('0x5e')]({'name':_0x55ceba['name'],'resourceId':_0x55ceba['id'],'type':_0x124f39['name'],'sectionId':_0x124f39['id']},{})[_0x7a8d('0x1f')](function(){return _0x3f861b;});}else{return _0x3f861b;}})[_0x7a8d('0x29')](function(_0x418a0c){logger['error'](_0x7a8d('0x64'),_0x418a0c);throw _0x418a0c;});}return _0x3f861b;})[_0x7a8d('0x1f')](respondWithResult(_0x3f4f07,0xc9))[_0x7a8d('0x29')](handleError(_0x3f4f07,null));};exports['update']=function(_0x563fd0,_0x33e4e7){if(_0x563fd0['body']['id']){delete _0x563fd0[_0x7a8d('0x5f')]['id'];}return db[_0x7a8d('0x42')][_0x7a8d('0x5d')]({'where':{'id':_0x563fd0[_0x7a8d('0x59')]['id']},'include':[{'model':db[_0x7a8d('0x40')],'as':_0x7a8d('0x41')}]})['then'](handleEntityNotFound(_0x33e4e7,null))[_0x7a8d('0x1f')](saveUpdates(_0x563fd0['body'],null))[_0x7a8d('0x1f')](respondWithResult(_0x33e4e7,null))['catch'](handleError(_0x33e4e7,null));};exports[_0x7a8d('0x3b')]=function(_0x22d05a,_0x29ea79){return db[_0x7a8d('0x42')]['find']({'where':{'id':_0x22d05a[_0x7a8d('0x59')]['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x29ea79,null))[_0x7a8d('0x1f')](removeEntity(_0x29ea79,null))[_0x7a8d('0x29')](handleError(_0x29ea79,null));};exports[_0x7a8d('0x65')]=function(_0x2eb0c0,_0x1583c8){return db['SmsAccount']['describe']()[_0x7a8d('0x1f')](respondWithResult(_0x1583c8,null))[_0x7a8d('0x29')](handleError(_0x1583c8,null));};exports[_0x7a8d('0x66')]=function(_0xdd31de,_0x2a6e66,_0x193121){if(_0xdd31de['body']['id']){delete _0xdd31de['body']['id'];}return db[_0x7a8d('0x42')][_0x7a8d('0x5d')]({'where':{'id':_0xdd31de[_0x7a8d('0x59')]['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x2a6e66,null))[_0x7a8d('0x1f')](function(_0x416e22){if(_0x416e22){_0xdd31de[_0x7a8d('0x5f')][_0x7a8d('0x67')]=_0x416e22['id'];return db[_0x7a8d('0x68')][_0x7a8d('0x5e')](_0xdd31de[_0x7a8d('0x5f')]);}})[_0x7a8d('0x1f')](respondWithResult(_0x2a6e66,null))[_0x7a8d('0x29')](handleError(_0x2a6e66,null));};exports[_0x7a8d('0x69')]=function(_0x2f4987,_0x4d9680,_0x5b04cc){var _0x58b765={'raw':![],'where':{}};var _0x434e11={};var _0x1f3c13={'count':0x0,'rows':[]};return db[_0x7a8d('0x42')]['findOne']({'where':{'id':_0x2f4987['params']['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x4d9680,null))[_0x7a8d('0x1f')](function(_0x511b1f){if(_0x511b1f){_0x434e11['model']=_[_0x7a8d('0x46')](db[_0x7a8d('0x68')][_0x7a8d('0x5a')]);_0x434e11[_0x7a8d('0x4c')]=_[_0x7a8d('0x46')](_0x2f4987[_0x7a8d('0x4c')]);_0x434e11[_0x7a8d('0x47')]=_['intersection'](_0x434e11[_0x7a8d('0x49')],_0x434e11[_0x7a8d('0x4c')]);_0x58b765[_0x7a8d('0x4a')]=_[_0x7a8d('0x48')](_0x434e11[_0x7a8d('0x49')],qs['fields'](_0x2f4987[_0x7a8d('0x4c')][_0x7a8d('0x4b')]));_0x58b765[_0x7a8d('0x4a')]=_0x58b765[_0x7a8d('0x4a')][_0x7a8d('0x4d')]?_0x58b765[_0x7a8d('0x4a')]:_0x434e11[_0x7a8d('0x49')];if(!_0x2f4987['query']['hasOwnProperty'](_0x7a8d('0x4f'))){_0x58b765[_0x7a8d('0x30')]=qs[_0x7a8d('0x30')](_0x2f4987[_0x7a8d('0x4c')][_0x7a8d('0x30')]);_0x58b765[_0x7a8d('0x2e')]=qs[_0x7a8d('0x2e')](_0x2f4987[_0x7a8d('0x4c')][_0x7a8d('0x2e')]);}_0x58b765['order']=qs[_0x7a8d('0x6a')](_0x2f4987[_0x7a8d('0x4c')][_0x7a8d('0x6a')]);_0x58b765[_0x7a8d('0x50')]=qs[_0x7a8d('0x47')](_['pick'](_0x2f4987[_0x7a8d('0x4c')],_0x434e11[_0x7a8d('0x47')]));_0x58b765[_0x7a8d('0x50')][_0x7a8d('0x67')]=_0x511b1f['id'];if(_0x2f4987['query']['filter']){_0x58b765[_0x7a8d('0x50')]=_[_0x7a8d('0x52')](_0x58b765[_0x7a8d('0x50')],{'$or':_[_0x7a8d('0x45')](_0x58b765['attributes'],function(_0x54099d){var _0x1bdabe={};_0x1bdabe[_0x54099d]={'$like':'%'+_0x2f4987['query'][_0x7a8d('0x54')]+'%'};return _0x1bdabe;})});}_0x58b765=_['merge']({},_0x58b765,_0x2f4987[_0x7a8d('0x5c')]);return db[_0x7a8d('0x68')][_0x7a8d('0x31')]({'where':_0x58b765[_0x7a8d('0x50')]})[_0x7a8d('0x1f')](function(_0x13bb96){_0x1f3c13['count']=_0x13bb96;if(_0x2f4987[_0x7a8d('0x4c')][_0x7a8d('0x5b')]){_0x58b765[_0x7a8d('0x55')]=[{'all':!![]}];}return db[_0x7a8d('0x68')]['findAll'](_0x58b765);})['then'](function(_0xe37ba4){_0x1f3c13[_0x7a8d('0x57')]=_0xe37ba4;return _0x1f3c13;});}})[_0x7a8d('0x1f')](respondWithFilteredResult(_0x4d9680,_0x58b765))[_0x7a8d('0x29')](handleError(_0x4d9680,null));};exports[_0x7a8d('0x6b')]=function(_0x245b71,_0x553155,_0xe1fbe5){return db['SmsAccount'][_0x7a8d('0x5d')]({'where':{'id':_0x245b71[_0x7a8d('0x59')]['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x553155,null))[_0x7a8d('0x1f')](function(_0x4795ee){if(_0x4795ee){return _0x4795ee['removeDispositions'](_0x245b71[_0x7a8d('0x4c')][_0x7a8d('0x6c')]);}})['then'](respondWithStatusCode(_0x553155,null))[_0x7a8d('0x29')](handleError(_0x553155,null));};exports[_0x7a8d('0x6d')]=function(_0x318bbc,_0x5b5387,_0x39c169){if(_0x318bbc[_0x7a8d('0x5f')]['id']){delete _0x318bbc['body']['id'];}return db[_0x7a8d('0x42')][_0x7a8d('0x5d')]({'where':{'id':_0x318bbc[_0x7a8d('0x59')]['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x5b5387,null))['then'](function(_0x3199c6){if(_0x3199c6){_0x318bbc[_0x7a8d('0x5f')][_0x7a8d('0x67')]=_0x3199c6['id'];return db['CannedAnswer']['create'](_0x318bbc[_0x7a8d('0x5f')]);}})[_0x7a8d('0x1f')](respondWithResult(_0x5b5387,null))[_0x7a8d('0x29')](handleError(_0x5b5387,null));};exports[_0x7a8d('0x6e')]=function(_0x2528e5,_0x175bdd,_0x599048){var _0x2780c9={'raw':![],'where':{}};var _0x45234b={};var _0x1b60d6={'count':0x0,'rows':[]};return db[_0x7a8d('0x42')][_0x7a8d('0x6f')]({'where':{'id':_0x2528e5['params']['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x175bdd,null))[_0x7a8d('0x1f')](function(_0x1fa17e){if(_0x1fa17e){_0x45234b[_0x7a8d('0x49')]=_[_0x7a8d('0x46')](db[_0x7a8d('0x70')][_0x7a8d('0x5a')]);_0x45234b[_0x7a8d('0x4c')]=_[_0x7a8d('0x46')](_0x2528e5[_0x7a8d('0x4c')]);_0x45234b['filters']=_[_0x7a8d('0x48')](_0x45234b[_0x7a8d('0x49')],_0x45234b['query']);_0x2780c9['attributes']=_[_0x7a8d('0x48')](_0x45234b[_0x7a8d('0x49')],qs[_0x7a8d('0x4b')](_0x2528e5[_0x7a8d('0x4c')][_0x7a8d('0x4b')]));_0x2780c9[_0x7a8d('0x4a')]=_0x2780c9[_0x7a8d('0x4a')][_0x7a8d('0x4d')]?_0x2780c9['attributes']:_0x45234b[_0x7a8d('0x49')];if(!_0x2528e5[_0x7a8d('0x4c')]['hasOwnProperty'](_0x7a8d('0x4f'))){_0x2780c9['limit']=qs[_0x7a8d('0x30')](_0x2528e5[_0x7a8d('0x4c')]['limit']);_0x2780c9[_0x7a8d('0x2e')]=qs[_0x7a8d('0x2e')](_0x2528e5[_0x7a8d('0x4c')][_0x7a8d('0x2e')]);}_0x2780c9['order']=qs[_0x7a8d('0x6a')](_0x2528e5[_0x7a8d('0x4c')]['sort']);_0x2780c9[_0x7a8d('0x50')]=qs[_0x7a8d('0x47')](_[_0x7a8d('0x51')](_0x2528e5[_0x7a8d('0x4c')],_0x45234b['filters']));_0x2780c9[_0x7a8d('0x50')][_0x7a8d('0x67')]=_0x1fa17e['id'];if(_0x2528e5[_0x7a8d('0x4c')][_0x7a8d('0x54')]){_0x2780c9[_0x7a8d('0x50')]=_['merge'](_0x2780c9[_0x7a8d('0x50')],{'$or':_[_0x7a8d('0x45')](_0x2780c9[_0x7a8d('0x4a')],function(_0x3c9a44){var _0x2e0991={};_0x2e0991[_0x3c9a44]={'$like':'%'+_0x2528e5[_0x7a8d('0x4c')][_0x7a8d('0x54')]+'%'};return _0x2e0991;})});}_0x2780c9=_[_0x7a8d('0x52')]({},_0x2780c9,_0x2528e5[_0x7a8d('0x5c')]);return db['CannedAnswer'][_0x7a8d('0x31')]({'where':_0x2780c9[_0x7a8d('0x50')]})[_0x7a8d('0x1f')](function(_0x28d10d){_0x1b60d6[_0x7a8d('0x31')]=_0x28d10d;if(_0x2528e5[_0x7a8d('0x4c')][_0x7a8d('0x5b')]){_0x2780c9[_0x7a8d('0x55')]=[{'all':!![]}];}return db[_0x7a8d('0x70')][_0x7a8d('0x56')](_0x2780c9);})[_0x7a8d('0x1f')](function(_0x3bba95){_0x1b60d6[_0x7a8d('0x57')]=_0x3bba95;return _0x1b60d6;});}})[_0x7a8d('0x1f')](respondWithFilteredResult(_0x175bdd,_0x2780c9))['catch'](handleError(_0x175bdd,null));};exports[_0x7a8d('0x71')]=function(_0x48ab2e,_0x33c0d3,_0x2bdbf8){return db[_0x7a8d('0x42')][_0x7a8d('0x5d')]({'where':{'id':_0x48ab2e['params']['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x33c0d3,null))[_0x7a8d('0x1f')](function(_0xf20b61){if(_0xf20b61){return _0xf20b61[_0x7a8d('0x71')](_0x48ab2e[_0x7a8d('0x4c')][_0x7a8d('0x6c')]);}})['then'](respondWithStatusCode(_0x33c0d3,null))[_0x7a8d('0x29')](handleError(_0x33c0d3,null));};exports[_0x7a8d('0x72')]=function(_0x4e0a53,_0x10b9cd,_0x414825){var _0x154f75={'channel':_0x7a8d('0x73')};var _0x28a751=[];var _0x44ae4a=[];var _0x4c75c7={};return db[_0x7a8d('0x42')]['find']({'where':{'id':_0x4e0a53['params']['id']},'include':[{'model':db[_0x7a8d('0x74')],'as':_0x7a8d('0x75')}]})[_0x7a8d('0x1f')](handleEntityNotFound(_0x10b9cd,null))[_0x7a8d('0x1f')](function(_0x4f5379){_0x154f75[_0x7a8d('0x76')]=_0x4f5379;_0x154f75[_0x7a8d('0x77')]=_['orderBy'](_0x4f5379[_0x7a8d('0x75')],[_0x7a8d('0x78')],[_0x7a8d('0x79')]);if(_0x154f75[_0x7a8d('0x76')][_0x7a8d('0x75')]){delete _0x154f75[_0x7a8d('0x76')][_0x7a8d('0x75')];}return db['CmContact'][_0x7a8d('0x65')]();})[_0x7a8d('0x1f')](function(_0x1dc595){if(!_0x1dc595){throw new db['Sequelize'][(_0x7a8d('0x7a'))]('no\x20available\x20attributes');}_0x28a751=_[_0x7a8d('0x7b')](_[_0x7a8d('0x46')](_0x1dc595),['createdAt',_0x7a8d('0x7c')]);_0x44ae4a=_[_0x7a8d('0x7b')](_['keys'](_0x1dc595),[_0x7a8d('0x7d'),'updatedAt',_0x7a8d('0x7e'),'ListId']);_0x154f75[_0x7a8d('0x5f')]={'mapKey':_0x7a8d('0x7f')};if(_0x154f75[_0x7a8d('0x76')][_0x7a8d('0x44')]){switch(_0x154f75[_0x7a8d('0x76')]['type']){case _0x7a8d('0x80'):_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x81')]=_0x4e0a53['body'][_0x7a8d('0x82')];_0x154f75['body'][_0x7a8d('0x5f')]=_0x4e0a53['body'][_0x7a8d('0x83')];_0x154f75[_0x7a8d('0x5f')]['messageId']=_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x84')];break;case'skebby':_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x81')]='+'+_0x4e0a53[_0x7a8d('0x5f')]['sender'];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x5f')]=_0x4e0a53['body']['text'];break;case _0x7a8d('0x85'):_0x154f75['body']['from']=_0x4e0a53[_0x7a8d('0x5f')]['from'];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x5f')]=_0x4e0a53[_0x7a8d('0x5f')]['message'];break;case _0x7a8d('0x86'):_0x154f75[_0x7a8d('0x5f')]['from']=_0x4e0a53['body'][_0x7a8d('0x81')];_0x154f75[_0x7a8d('0x5f')]['body']=_0x4e0a53['body'][_0x7a8d('0x5f')];_0x154f75[_0x7a8d('0x5f')]['messageId']=_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x87')];break;case'plivo':_0x154f75[_0x7a8d('0x5f')]['from']=_0x4e0a53[_0x7a8d('0x5f')]['From'];_0x154f75[_0x7a8d('0x5f')]['body']=_0x4e0a53[_0x7a8d('0x5f')]['Text'];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x88')]=_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x89')];break;case _0x7a8d('0x8a'):_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x81')]='+'+_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x8b')][0x0]['from'];_0x154f75['body'][_0x7a8d('0x5f')]=_0x4e0a53['body'][_0x7a8d('0x8b')][0x0][_0x7a8d('0x8c')];_0x154f75[_0x7a8d('0x5f')]['messageId']=_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x8b')][0x0][_0x7a8d('0x88')];break;case'csc':_0x154f75[_0x7a8d('0x5f')]['from']=_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x8d')];_0x154f75[_0x7a8d('0x5f')]['body']=_0x4e0a53['body'][_0x7a8d('0x8e')][_0x7a8d('0x26')];break;case'clickatell':_0x154f75['body'][_0x7a8d('0x81')]=_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x8f')];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x5f')]=_0x4e0a53['body']['text'];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x88')]=_0x4e0a53[_0x7a8d('0x5f')]['replyMessageId'];break;case _0x7a8d('0x90'):_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x88')]=_0x4e0a53['body'][0x0][_0x7a8d('0x26')]['id'];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x81')]=_0x4e0a53[_0x7a8d('0x5f')][0x0][_0x7a8d('0x26')]['from'];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x5f')]=_0x4e0a53[_0x7a8d('0x5f')][0x0][_0x7a8d('0x26')][_0x7a8d('0x8c')];break;case _0x7a8d('0x91'):_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x81')]=_0x4e0a53['body'][_0x7a8d('0x81')];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x5f')]=_0x4e0a53[_0x7a8d('0x5f')][_0x7a8d('0x26')];_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x88')]=_0x4e0a53[_0x7a8d('0x5f')]['refid'];break;}}if(_0x154f75[_0x7a8d('0x5f')]['id']){delete _0x154f75[_0x7a8d('0x5f')]['id'];}if(_[_0x7a8d('0x92')](_0x154f75[_0x7a8d('0x5f')]['from'])){throw new db[(_0x7a8d('0x93'))][(_0x7a8d('0x7a'))](_0x7a8d('0x94'));}if(_[_0x7a8d('0x92')](_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x5f')])||_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x5f')]===''){throw new db[(_0x7a8d('0x93'))][(_0x7a8d('0x7a'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7a8d('0x92')](_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x95')])){throw new db['Sequelize'][(_0x7a8d('0x7a'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x44ae4a);}if(!_[_0x7a8d('0x96')](_0x44ae4a,_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x95')])){throw new db['Sequelize']['ValidationError'](_0x7a8d('0x97')+_0x44ae4a);}_0x4c75c7[_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x95')]]=_0x154f75[_0x7a8d('0x5f')]['from'];return db[_0x7a8d('0x98')][_0x7a8d('0x5d')]({'where':{'id':_0x154f75[_0x7a8d('0x76')][_0x7a8d('0x99')]},'include':[{'model':db[_0x7a8d('0x9a')],'as':'Contacts','where':_0x4c75c7,'limit':0x1,'order':[[_0x7a8d('0x7c'),_0x7a8d('0x9b')]]}]});})['then'](handleEntityNotFound(_0x10b9cd,null))[_0x7a8d('0x1f')](function(_0x4d7ef7){if(_0x4d7ef7){_0x154f75[_0x7a8d('0x9c')]=_[_0x7a8d('0x9d')](_0x4d7ef7,[_0x7a8d('0x9e')]);if(_0x4d7ef7[_0x7a8d('0x9e')][_0x7a8d('0x4d')]){return _0x4d7ef7[_0x7a8d('0x9e')][0x0];}var _0x43a200=_[_0x7a8d('0x9f')](_0x154f75['body'],{'firstName':_0x154f75[_0x7a8d('0x5f')]['from'],'ListId':_0x4d7ef7['id']});_0x43a200[_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x95')]]=_0x154f75['body']['from'];return db[_0x7a8d('0x9a')][_0x7a8d('0x5e')](_0x43a200,{'fields':_0x28a751,'raw':!![]});}})['then'](handleEntityNotFound(_0x10b9cd,null))[_0x7a8d('0x1f')](function(_0x78a409){if(_0x78a409){_0x154f75['contact']=_0x78a409;var _0x5e3f9d={'ContactId':_0x78a409['id'],'phone':_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x81')],'SmsAccountId':_0x4e0a53['params']['id']};var _0x40374b={'ContactId':_0x78a409['id'],'SmsAccountId':_0x4e0a53[_0x7a8d('0x59')]['id'],'closed':![]};return db[_0x7a8d('0xa0')][_0x7a8d('0x5d')]({'where':_0x40374b})[_0x7a8d('0x1f')](function(_0x59711c){if(_0x59711c){return[_0x59711c,![]];}return db[_0x7a8d('0xa0')]['create'](_0x5e3f9d)[_0x7a8d('0x1f')](function(_0x4f8d74){return[_0x4f8d74,!![]];});});}})[_0x7a8d('0xa1')](function(_0x4a0111,_0x5aefcc){_0x154f75[_0x7a8d('0xa2')]=_0x4a0111['get']({'plain':!![]});_0x154f75[_0x7a8d('0xa2')]['created']=![];if(_0x5aefcc){if(_0x154f75[_0x7a8d('0x76')]['autoclose']){_0x154f75[_0x7a8d('0x77')][_0x7a8d('0xa3')]({'id':0x0,'priority':_0x154f75['applications'][_0x7a8d('0x4d')]+0x1,'app':'close','appdata':_0x7a8d('0xa4'),'interval':_0x7a8d('0xa5')});}_0x154f75[_0x7a8d('0xa2')][_0x7a8d('0xa6')]=!![];}return db['SmsMessage'][_0x7a8d('0x5e')]({'phone':_0x154f75['body'][_0x7a8d('0x81')],'messageId':_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0x88')],'body':_0x154f75['body'][_0x7a8d('0x5f')],'SmsAccountId':_0x4e0a53['params']['id'],'SmsInteractionId':_0x4a0111['id'],'direction':'in','ContactId':_0x4a0111[_0x7a8d('0xa7')],'AttachmentId':_0x154f75[_0x7a8d('0x5f')][_0x7a8d('0xa8')]});})[_0x7a8d('0x1f')](function(_0x451d5e){_0x154f75[_0x7a8d('0x26')]=_0x451d5e;if(!_0x154f75[_0x7a8d('0xa2')][_0x7a8d('0xa9')])return;return db[_0x7a8d('0xaa')][_0x7a8d('0x5d')]({'attributes':['id',_0x7a8d('0x3d')],'where':{'id':_0x154f75[_0x7a8d('0xa2')][_0x7a8d('0xa9')]}});})[_0x7a8d('0x1f')](function(_0x597de5){if(_0x597de5){_0x154f75[_0x7a8d('0x77')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x597de5[_0x7a8d('0x3d')]+','+(_0x154f75[_0x7a8d('0x76')][_0x7a8d('0xab')]||0xa),'interval':'*,*,*,*'});}if(!_0x154f75[_0x7a8d('0xa2')][_0x7a8d('0xac')])return;return db['SmsQueue'][_0x7a8d('0x5d')]({'attributes':['id',_0x7a8d('0x3d')],'where':{'id':_0x154f75['interaction'][_0x7a8d('0xac')]}});})[_0x7a8d('0x1f')](function(_0x176302){if(_0x176302){_0x154f75[_0x7a8d('0x77')][_0x7a8d('0xad')]({'id':0x0,'priority':0x1,'app':_0x7a8d('0xae'),'appdata':_0x176302['name']+','+(_0x154f75['account'][_0x7a8d('0xaf')]||0x12c),'interval':_0x7a8d('0xa5')});}return respondWithRpcPromise(_0x7a8d('0xb0'),'startRouting',_0x154f75);})[_0x7a8d('0x1f')](function(_0x496e1f){if(_0x496e1f){var _0x3afcd7=0xc8;var _0x1c883f=_0x7a8d('0xb1');logger[_0x7a8d('0x27')](_0x7a8d('0x22'),_0x1c883f,_0x3afcd7,_0x7a8d('0xb2'));logger[_0x7a8d('0xb3')](_0x7a8d('0xb4'),_0x1c883f,_0x3afcd7,'entity\x20found',JSON['stringify'](_0x496e1f));if(_0x154f75[_0x7a8d('0x76')][_0x7a8d('0x44')]===_0x7a8d('0x80')){return _0x10b9cd[_0x7a8d('0x2b')](_0x3afcd7)['set']('Content-Type',_0x7a8d('0xb5'))['send']('\x0a');}else{return _0x10b9cd['status'](_0x3afcd7)[_0x7a8d('0x2d')](_0x496e1f);}}})[_0x7a8d('0x29')](handleError(_0x10b9cd,null));};exports['addApplications']=function(_0x3a3157,_0x547155){var _0x9346f4=_0x3a3157[_0x7a8d('0x59')]['id'];var _0x5183a2=_0x3a3157['body'];var _0x4dca49=0xc8;var _0x41f386=null;return db[_0x7a8d('0xb6')]['transaction']({'isolationLevel':db[_0x7a8d('0xb6')][_0x7a8d('0xb7')][_0x7a8d('0xb8')][_0x7a8d('0xb9')]},function(_0x9dcff0){return db[_0x7a8d('0x42')][_0x7a8d('0x6f')]({'where':{'id':_0x9346f4},'transaction':_0x9dcff0})['then'](function(_0x2ae49b){if(_0x2ae49b){return db[_0x7a8d('0x74')][_0x7a8d('0x3b')]({'where':{'SmsAccountId':_0x9346f4},'transaction':_0x9dcff0})[_0x7a8d('0x1f')](function(){var _0x15cad1=_[_0x7a8d('0x45')](_0x5183a2,function(_0x56a62e){_0x56a62e['SmsAccountId']=_0x9346f4;return _0x56a62e;});return db[_0x7a8d('0x74')]['bulkCreate'](_0x15cad1,{'transaction':_0x9dcff0});});}else{_0x4dca49=0x194;_0x41f386=[];}});})[_0x7a8d('0x1f')](function(){if(_0x4dca49!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x9346f4},'order':_0x7a8d('0x78')})[_0x7a8d('0x1f')](function(_0x31e752){_0x41f386=_0x31e752;});}})['catch'](function(_0x12fc73){_0x4dca49=0x1f4;logger['error'](_0x12fc73[_0x7a8d('0x3c')]);if(_0x12fc73[_0x7a8d('0x3d')]){delete _0x12fc73[_0x7a8d('0x3d')];}_0x41f386=_0x12fc73;})[_0x7a8d('0xba')](function(){if(_0x41f386===null){_0x547155[_0x7a8d('0x2a')](_0x4dca49);}else{if(_0x4dca49===0x1f4){_0x547155[_0x7a8d('0x2b')](_0x4dca49)[_0x7a8d('0x3e')](_0x41f386);}else{_0x547155[_0x7a8d('0x2b')](_0x4dca49)[_0x7a8d('0x2d')](_0x41f386);}}});};exports[_0x7a8d('0xbb')]=function(_0x4299ac,_0x2ff85f,_0x26ca1c){var _0x1960a2={};var _0x2493d8={};var _0x494a96;var _0x42570c;return db['SmsAccount'][_0x7a8d('0x6f')]({'where':{'id':_0x4299ac['params']['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x2ff85f,null))[_0x7a8d('0x1f')](function(_0x5b01de){if(_0x5b01de){_0x494a96=_0x5b01de;_0x2493d8['model']=_['keys'](db[_0x7a8d('0x74')][_0x7a8d('0x5a')]);_0x2493d8[_0x7a8d('0x4c')]=_[_0x7a8d('0x46')](_0x4299ac['query']);_0x2493d8[_0x7a8d('0x47')]=_[_0x7a8d('0x48')](_0x2493d8[_0x7a8d('0x49')],_0x2493d8[_0x7a8d('0x4c')]);_0x1960a2[_0x7a8d('0x4a')]=_[_0x7a8d('0x48')](_0x2493d8[_0x7a8d('0x49')],qs[_0x7a8d('0x4b')](_0x4299ac[_0x7a8d('0x4c')][_0x7a8d('0x4b')]));_0x1960a2[_0x7a8d('0x4a')]=_0x1960a2[_0x7a8d('0x4a')][_0x7a8d('0x4d')]?_0x1960a2[_0x7a8d('0x4a')]:_0x2493d8['model'];_0x1960a2[_0x7a8d('0xbc')]=qs['sort'](_0x4299ac['query'][_0x7a8d('0x6a')]);_0x1960a2[_0x7a8d('0x50')]=qs[_0x7a8d('0x47')](_['pick'](_0x4299ac[_0x7a8d('0x4c')],_0x2493d8[_0x7a8d('0x47')]));if(_0x4299ac[_0x7a8d('0x4c')][_0x7a8d('0x54')]){_0x1960a2[_0x7a8d('0x50')]=_['merge'](_0x1960a2[_0x7a8d('0x50')],{'$or':_[_0x7a8d('0x45')](_0x1960a2[_0x7a8d('0x4a')],function(_0x31a90b){var _0x4f140e={};_0x4f140e[_0x31a90b]={'$like':'%'+_0x4299ac[_0x7a8d('0x4c')][_0x7a8d('0x54')]+'%'};return _0x4f140e;})});}_0x1960a2=_[_0x7a8d('0x52')]({},_0x1960a2,_0x4299ac[_0x7a8d('0x5c')]);return _0x494a96[_0x7a8d('0xbb')](_0x1960a2);}})[_0x7a8d('0x1f')](function(_0x4fbc3a){if(_0x4fbc3a){_0x42570c=_0x4fbc3a[_0x7a8d('0x4d')];if(!_0x4299ac['query']['hasOwnProperty'](_0x7a8d('0x4f'))){_0x1960a2[_0x7a8d('0x30')]=qs[_0x7a8d('0x30')](_0x4299ac[_0x7a8d('0x4c')][_0x7a8d('0x30')]);_0x1960a2[_0x7a8d('0x2e')]=qs[_0x7a8d('0x2e')](_0x4299ac['query']['offset']);}return _0x494a96[_0x7a8d('0xbb')](_0x1960a2);}})['then'](function(_0x2a21a0){if(_0x2a21a0){return _0x2a21a0?{'count':_0x42570c,'rows':_0x2a21a0}:null;}})[_0x7a8d('0x1f')](respondWithResult(_0x2ff85f,null))[_0x7a8d('0x29')](handleError(_0x2ff85f,null));};exports[_0x7a8d('0xbd')]=function(_0x579917,_0x1570a7,_0x12ff0b){var _0x42f3f1={'raw':![],'where':{}};var _0x126153={};var _0x5c120d={'count':0x0,'rows':[]};return db[_0x7a8d('0x42')][_0x7a8d('0x6f')]({'where':{'id':_0x579917['params']['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x1570a7,null))[_0x7a8d('0x1f')](function(_0x4ddffa){if(_0x4ddffa){_0x126153[_0x7a8d('0x49')]=_['keys'](db['SmsInteraction']['rawAttributes']);_0x126153[_0x7a8d('0x4c')]=_[_0x7a8d('0x46')](_0x579917['query']);_0x126153[_0x7a8d('0x47')]=_['intersection'](_0x126153['model'],_0x126153['query']);_0x42f3f1[_0x7a8d('0x4a')]=_[_0x7a8d('0x48')](_0x126153[_0x7a8d('0x49')],qs[_0x7a8d('0x4b')](_0x579917[_0x7a8d('0x4c')][_0x7a8d('0x4b')]));_0x42f3f1[_0x7a8d('0x4a')]=_0x42f3f1[_0x7a8d('0x4a')][_0x7a8d('0x4d')]?_0x42f3f1[_0x7a8d('0x4a')]:_0x126153['model'];if(!_0x579917[_0x7a8d('0x4c')][_0x7a8d('0x4e')]('nolimit')){_0x42f3f1[_0x7a8d('0x30')]=qs['limit'](_0x579917['query']['limit']);_0x42f3f1[_0x7a8d('0x2e')]=qs['offset'](_0x579917[_0x7a8d('0x4c')][_0x7a8d('0x2e')]);}_0x42f3f1[_0x7a8d('0xbc')]=qs['sort'](_0x579917[_0x7a8d('0x4c')]['sort']);_0x42f3f1[_0x7a8d('0x50')]=qs[_0x7a8d('0x47')](_['pick'](_0x579917['query'],_0x126153[_0x7a8d('0x47')]));_0x42f3f1[_0x7a8d('0x50')]['SmsAccountId']=_0x4ddffa['id'];if(_0x579917[_0x7a8d('0x4c')][_0x7a8d('0x54')]){_0x42f3f1[_0x7a8d('0x50')]=_[_0x7a8d('0x52')](_0x42f3f1[_0x7a8d('0x50')],{'$or':_[_0x7a8d('0x45')](_0x42f3f1[_0x7a8d('0x4a')],function(_0x30a2bc){var _0x105df5={};_0x105df5[_0x30a2bc]={'$like':'%'+_0x579917['query']['filter']+'%'};return _0x105df5;})});}_0x42f3f1=_['merge']({},_0x42f3f1,_0x579917[_0x7a8d('0x5c')]);return db[_0x7a8d('0xa0')][_0x7a8d('0x31')]({'where':_0x42f3f1[_0x7a8d('0x50')]})[_0x7a8d('0x1f')](function(_0x104c29){_0x5c120d[_0x7a8d('0x31')]=_0x104c29;if(_0x579917[_0x7a8d('0x4c')][_0x7a8d('0x5b')]){_0x42f3f1['include']=[{'model':db[_0x7a8d('0x9a')],'as':_0x7a8d('0xbe'),'required':![]},{'model':db[_0x7a8d('0xaa')],'as':_0x7a8d('0xbf'),'attributes':[_0x7a8d('0x3d'),_0x7a8d('0xc0'),'internal'],'required':![]},{'model':db[_0x7a8d('0xc1')],'as':'Tags','attributes':['id',_0x7a8d('0x3d'),_0x7a8d('0xc2')],'where':_0x579917[_0x7a8d('0x4c')][_0x7a8d('0xc3')]?{'id':_0x579917['query']['tag']}:undefined,'required':_0x579917['query'][_0x7a8d('0xc3')]?!![]:![]}];}return db[_0x7a8d('0xa0')][_0x7a8d('0x56')](_0x42f3f1);})[_0x7a8d('0x1f')](function(_0x30221f){_0x5c120d['rows']=_0x30221f;return _0x5c120d;});}})[_0x7a8d('0x1f')](respondWithFilteredResult(_0x1570a7,_0x42f3f1))[_0x7a8d('0x29')](handleError(_0x1570a7,null));};exports[_0x7a8d('0x3e')]=function(_0x3ed641,_0x346667,_0x40d493){var _0x51741b,_0x4b07bd,_0x57bd79;if(_[_0x7a8d('0x92')](_0x3ed641['body'][_0x7a8d('0x5f')])||_0x3ed641['body'][_0x7a8d('0x5f')]===''){throw new db['Sequelize'][(_0x7a8d('0x7a'))](_0x7a8d('0xc4'));}if(_['isNil'](_0x3ed641[_0x7a8d('0x5f')]['to'])){throw new db[(_0x7a8d('0x93'))][(_0x7a8d('0x7a'))](_0x7a8d('0xc5'));}_0x51741b=_0x3ed641['body']['to'];return db['SmsAccount']['find']({'where':{'id':_0x3ed641['params']['id']},'include':[{'model':db[_0x7a8d('0x98')],'as':_0x7a8d('0xc6'),'include':[{'model':db[_0x7a8d('0x9a')],'as':_0x7a8d('0x9e'),'where':{'mobile':_0x51741b},'limit':0x1,'order':[[_0x7a8d('0x7c'),_0x7a8d('0x9b')]]}]}]})[_0x7a8d('0x1f')](handleEntityNotFound(_0x346667,null))['then'](function(_0x3a7480){if(_0x3a7480&&_0x3a7480[_0x7a8d('0xc6')]){_0x4b07bd=_0x3a7480['get']({'plain':!![]});if(_0x4b07bd[_0x7a8d('0xc6')]&&_0x4b07bd[_0x7a8d('0xc6')]['Contacts'][_0x7a8d('0x4d')]){return _0x4b07bd[_0x7a8d('0xc6')][_0x7a8d('0x9e')][0x0];}return db[_0x7a8d('0x9a')][_0x7a8d('0x5e')](_[_0x7a8d('0x9f')](_0x3ed641['body'],{'firstName':_0x51741b,'mobile':_0x51741b,'phone':_0x51741b,'ListId':_0x4b07bd[_0x7a8d('0x99')]}));}})['then'](handleEntityNotFound(_0x346667,null))[_0x7a8d('0x1f')](function(_0x340d13){if(_0x340d13){_0x57bd79=_0x340d13;return db['SmsInteraction'][_0x7a8d('0x5d')]({'where':{'ContactId':_0x57bd79['id'],'closed':![],'SmsAccountId':_0x4b07bd['id']}})['then'](function(_0x403561){if(_0x403561){return[_0x403561,![]];}return db[_0x7a8d('0xa0')][_0x7a8d('0x5e')]({'UserId':_0x3ed641['user']['id'],'ContactId':_0x57bd79['id'],'SmsAccountId':_0x4b07bd['id'],'phone':_0x51741b,'firstMsgDirection':_0x7a8d('0xc7'),'Messages':[_['merge'](_0x3ed641[_0x7a8d('0x5f')],{'read':![],'body':_0x3ed641['body'][_0x7a8d('0x5f')],'phone':_0x51741b,'SmsAccountId':_0x4b07bd['id'],'UserId':_0x3ed641[_0x7a8d('0x60')]['id'],'ContactId':_0x57bd79['id']})]},{'include':[{'model':db[_0x7a8d('0xc8')],'as':_0x7a8d('0xc9')}]})[_0x7a8d('0x1f')](function(_0x36a327){return[_0x36a327,!![]];});});}})[_0x7a8d('0xa1')](function(_0x51a2b9,_0x517b56){if(_0x517b56){return _0x51a2b9;}return db[_0x7a8d('0xc8')][_0x7a8d('0x5e')](_[_0x7a8d('0x52')](_0x3ed641[_0x7a8d('0x5f')],{'read':![],'body':_0x3ed641[_0x7a8d('0x5f')][_0x7a8d('0x5f')],'phone':_0x51741b,'SmsAccountId':_0x4b07bd['id'],'SmsInteractionId':_0x51a2b9['id'],'UserId':_0x3ed641[_0x7a8d('0x60')]['id'],'ContactId':_0x57bd79['id']}))[_0x7a8d('0x1f')](function(_0x2d1aef){_0x51a2b9[_0x7a8d('0xca')][_0x7a8d('0xc9')]=[];_0x51a2b9[_0x7a8d('0xca')]['Messages'][_0x7a8d('0xa3')](_0x2d1aef[_0x7a8d('0xca')]);return _0x51a2b9;});})['then'](respondWithResult(_0x346667,null))['catch'](handleError(_0x346667,null));};exports[_0x7a8d('0x2b')]=function(_0x2c27e9,_0x29f1d9,_0x20b221){if(_0x2c27e9[_0x7a8d('0x5f')]['id']){delete _0x2c27e9[_0x7a8d('0x5f')]['id'];}var _0x1f7c50,_0x12e53a,_0x4ba36d;return db['SmsAccount'][_0x7a8d('0x5d')]({'where':{'id':_0x2c27e9['params']['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x29f1d9,null))['then'](function(_0x4451ca){if(_0x4451ca){_0x4ba36d=_0x4451ca;logger[_0x7a8d('0xb3')](_0x7a8d('0x22'),'status',_0x7a8d('0xcb'),_0x4451ca['type'],util['inspect'](_0x2c27e9[_0x7a8d('0x5f')],{'showHidden':![],'depth':null}));switch(_0x4451ca[_0x7a8d('0x44')]){case _0x7a8d('0xcc'):if(_0x2c27e9[_0x7a8d('0x5f')]['skebby_dispatch_id']&&_0x2c27e9['body'][_0x7a8d('0x2b')]){_0x12e53a=_0x2c27e9['body'][_0x7a8d('0x2b')];return db[_0x7a8d('0xc8')][_0x7a8d('0x5d')]({'where':{'messageId':_0x2c27e9[_0x7a8d('0x5f')]['skebby_dispatch_id']}});}break;case _0x7a8d('0x85'):if(_0x2c27e9[_0x7a8d('0x5f')]['requestid']&&_0x2c27e9['body'][_0x7a8d('0xcd')]){_0x12e53a=_0x2c27e9[_0x7a8d('0x5f')]['statusInt'];return db[_0x7a8d('0xc8')]['find']({'where':{'messageId':_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0xce')]}});}break;case _0x7a8d('0x86'):if(_0x2c27e9[_0x7a8d('0x5f')]['message_id']&&_0x2c27e9[_0x7a8d('0x5f')]['status_code']){_0x12e53a=_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0xcf')];return db[_0x7a8d('0xc8')]['find']({'where':{'messageId':_0x2c27e9[_0x7a8d('0x5f')]['message_id']}});}break;case'infobip':var _0x16bdc1=_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0x8b')][0x0];if(_0x16bdc1['messageId']&&_0x16bdc1[_0x7a8d('0x2b')]['groupName']==='DELIVERED'){_0x12e53a=_0x16bdc1['status'][_0x7a8d('0xd0')];return db[_0x7a8d('0xc8')][_0x7a8d('0x5d')]({'where':{'messageId':_0x16bdc1['messageId']}});}break;case _0x7a8d('0xd1'):if(_0x2c27e9['body'][_0x7a8d('0x88')]&&_0x2c27e9[_0x7a8d('0x5f')]['status']){_0x12e53a=_0x2c27e9['body'][_0x7a8d('0x2b')];return db['SmsMessage'][_0x7a8d('0x5d')]({'where':{'messageId':_0x2c27e9['body'][_0x7a8d('0x88')]}});}break;case _0x7a8d('0x90'):if(_0x2c27e9[_0x7a8d('0x5f')][0x0]['message']['id']){_0x12e53a=_0x2c27e9[_0x7a8d('0x5f')][0x0][_0x7a8d('0x44')];return db[_0x7a8d('0xc8')][_0x7a8d('0x5d')]({'where':{'messageId':_0x2c27e9['body'][0x0][_0x7a8d('0x26')]['id']}});}break;case _0x7a8d('0x91'):if(_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0xd2')]&&_0x2c27e9[_0x7a8d('0x5f')]['status']){_0x12e53a=_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0x2b')];return db['SmsMessage'][_0x7a8d('0x5d')]({'where':{'messageId':_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0xd2')]}});}break;}}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x29f1d9,null))['then'](function(_0x30502e){if(_0x30502e){_0x1f7c50=_0x30502e;switch(_0x4ba36d[_0x7a8d('0x44')]){case _0x7a8d('0xcc'):if(_0x12e53a===_0x7a8d('0xd3')){return _0x1f7c50[_0x7a8d('0x37')]({'read':!![]});}else{logger[_0x7a8d('0x24')](_0x7a8d('0x22'),_0x7a8d('0x2b'),'skebby',util['inspect'](_0x2c27e9[_0x7a8d('0x5f')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x12e53a==='1'){return _0x1f7c50['update']({'read':!![]});}else{logger['error'](_0x7a8d('0x22'),'status',_0x7a8d('0xcc'),util['inspect'](_0x2c27e9[_0x7a8d('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x7a8d('0x86'):if(!_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0xd4')]&&_0x12e53a>=0xc8&&_0x12e53a<=0xce){return _0x1f7c50[_0x7a8d('0x37')]({'read':!![]});}else{logger['error'](_0x7a8d('0x22'),'status','clicksend',util[_0x7a8d('0xd5')](_0x2c27e9[_0x7a8d('0x5f')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x41cab9=_0x2c27e9[_0x7a8d('0x5f')][_0x7a8d('0x8b')][0x0];if(_0x41cab9[_0x7a8d('0x2b')][_0x7a8d('0xd0')]===_0x7a8d('0xd3')){return _0x1f7c50['update']({'read':!![]});}else{logger[_0x7a8d('0x24')](_0x7a8d('0x22'),_0x7a8d('0x2b'),_0x7a8d('0x8a'),util[_0x7a8d('0xd5')](_0x2c27e9[_0x7a8d('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x7a8d('0xd1'):if(_0x12e53a==_0x7a8d('0xd6')||_0x12e53a=='RECEIVED_BY_RECIPIENT'){return _0x1f7c50[_0x7a8d('0x37')]({'read':!![]});}else{logger[_0x7a8d('0x24')](_0x7a8d('0x22'),_0x7a8d('0x2b'),_0x7a8d('0xd1'),util[_0x7a8d('0xd5')](_0x2c27e9[_0x7a8d('0x5f')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x12e53a==_0x7a8d('0xd7')){return _0x1f7c50[_0x7a8d('0x37')]({'read':!![]});}else{logger['error'](_0x7a8d('0x22'),_0x7a8d('0x2b'),_0x7a8d('0x90'),util[_0x7a8d('0xd5')](_0x2c27e9[_0x7a8d('0x5f')],{'showHidden':![],'depth':null}));}break;case _0x7a8d('0x91'):if(_0x12e53a===_0x7a8d('0xd8')||_0x12e53a==='ACCEPTD'){return _0x1f7c50[_0x7a8d('0x37')]({'read':!![]});}else{logger[_0x7a8d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x7a8d('0x91'),util['inspect'](_0x2c27e9['body'],{'showHidden':![],'depth':null}));}break;}return _0x1f7c50;}})[_0x7a8d('0x1f')](respondWithResult(_0x29f1d9,null))['catch'](handleError(_0x29f1d9,null));};exports[_0x7a8d('0xd9')]=function(_0x41c51c,_0x4cdd25,_0x39b7ff){var _0x204ec8,_0x2937c3,_0x2bdbe1;return db[_0x7a8d('0x42')]['find']({'where':{'id':_0x41c51c[_0x7a8d('0x59')]['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x4cdd25,null))[_0x7a8d('0x1f')](function(_0x492f16){if(_0x492f16){_0x2bdbe1=_0x492f16;logger['debug'](_0x7a8d('0x22'),_0x7a8d('0x2b'),_0x7a8d('0xcb'),_0x492f16[_0x7a8d('0x44')],util['inspect'](_0x41c51c[_0x7a8d('0x4c')],{'showHidden':![],'depth':null}));switch(_0x492f16[_0x7a8d('0x44')]){case _0x7a8d('0xda'):if(_0x41c51c[_0x7a8d('0x4c')][_0x7a8d('0xdb')]&&_0x41c51c['query'][_0x7a8d('0xdc')]){_0x2937c3=_0x41c51c[_0x7a8d('0x4c')][_0x7a8d('0xdc')];return db['SmsMessage']['find']({'where':{'messageId':_0x41c51c['query'][_0x7a8d('0xdb')]}});}break;}}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x4cdd25,null))[_0x7a8d('0x1f')](function(_0x599083){if(_0x599083){_0x204ec8=_0x599083;switch(_0x2bdbe1[_0x7a8d('0x44')]){case _0x7a8d('0xda'):if(_0x2937c3==='2'||_0x2937c3==='6'){return _0x204ec8[_0x7a8d('0x37')]({'read':!![]});}else{logger[_0x7a8d('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x7a8d('0x2b'),_0x7a8d('0xda'),util['inspect'](_0x41c51c[_0x7a8d('0x4c')],{'showHidden':![],'depth':null}));};break;}return _0x204ec8;}})['then'](respondWithResult(_0x4cdd25,null))[_0x7a8d('0x29')](handleError(_0x4cdd25,null));};exports['addAgents']=function(_0x37649b,_0x223e90,_0x36fb68){return db[_0x7a8d('0x42')][_0x7a8d('0x5d')]({'where':{'id':_0x37649b['params']['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x223e90,null))[_0x7a8d('0x1f')](function(_0x3f5c99){if(_0x3f5c99){return _0x3f5c99[_0x7a8d('0xdd')](_0x37649b[_0x7a8d('0x5f')][_0x7a8d('0x6c')],_[_0x7a8d('0x9d')](_0x37649b[_0x7a8d('0x5f')],[_0x7a8d('0x6c'),'id'])||{})[_0x7a8d('0xa1')](function(_0x484c29){for(var _0x160839=0x0;_0x160839<_0x37649b[_0x7a8d('0x5f')][_0x7a8d('0x6c')]['length'];_0x160839+=0x1){socket[_0x7a8d('0xde')](_0x7a8d('0xdf'),{'UserId':Number(_0x37649b[_0x7a8d('0x5f')]['ids'][_0x160839]),'SmsAccountId':Number(_0x37649b[_0x7a8d('0x59')]['id'])});}return _0x484c29;});}})[_0x7a8d('0x1f')](respondWithResult(_0x223e90,null))[_0x7a8d('0x29')](handleError(_0x223e90,null));};exports['removeAgents']=function(_0x580664,_0x3e758c,_0x233b5b){return db[_0x7a8d('0x42')][_0x7a8d('0x5d')]({'where':{'id':_0x580664[_0x7a8d('0x59')]['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x3e758c,null))[_0x7a8d('0x1f')](function(_0x1b97ed){if(_0x1b97ed){return _0x1b97ed[_0x7a8d('0xe0')](_0x580664[_0x7a8d('0x4c')][_0x7a8d('0x6c')])[_0x7a8d('0x1f')](function(){if(_[_0x7a8d('0xe1')](_0x580664['query']['ids'])){for(var _0x11ac88=0x0;_0x11ac88<_0x580664[_0x7a8d('0x4c')][_0x7a8d('0x6c')][_0x7a8d('0x4d')];_0x11ac88+=0x1){socket['emit'](_0x7a8d('0xe2'),{'UserId':Number(_0x580664[_0x7a8d('0x4c')][_0x7a8d('0x6c')][_0x11ac88]),'SmsAccountId':Number(_0x580664['params']['id'])});}}else{socket[_0x7a8d('0xde')](_0x7a8d('0xe2'),{'UserId':Number(_0x580664[_0x7a8d('0x4c')][_0x7a8d('0x6c')]),'SmsAccountId':Number(_0x580664[_0x7a8d('0x59')]['id'])});}});}})[_0x7a8d('0x1f')](respondWithStatusCode(_0x3e758c,null))[_0x7a8d('0x29')](handleError(_0x3e758c,null));};exports[_0x7a8d('0xe3')]=function(_0x44e696,_0x2eac6c,_0x36329a){var _0x10cf1f={};var _0x3e3e29={};var _0x1e7b07;var _0x2ee88b;return db[_0x7a8d('0x42')][_0x7a8d('0x6f')]({'where':{'id':_0x44e696[_0x7a8d('0x59')]['id']}})[_0x7a8d('0x1f')](handleEntityNotFound(_0x2eac6c,null))[_0x7a8d('0x1f')](function(_0x1a8262){if(_0x1a8262){_0x1e7b07=_0x1a8262;_0x3e3e29[_0x7a8d('0x49')]=_[_0x7a8d('0x46')](db[_0x7a8d('0xaa')][_0x7a8d('0x5a')]);_0x3e3e29[_0x7a8d('0x4c')]=_[_0x7a8d('0x46')](_0x44e696[_0x7a8d('0x4c')]);_0x3e3e29[_0x7a8d('0x47')]=_[_0x7a8d('0x48')](_0x3e3e29[_0x7a8d('0x49')],_0x3e3e29['query']);_0x10cf1f[_0x7a8d('0x4a')]=_[_0x7a8d('0x48')](_0x3e3e29[_0x7a8d('0x49')],qs['fields'](_0x44e696[_0x7a8d('0x4c')][_0x7a8d('0x4b')]));_0x10cf1f[_0x7a8d('0x4a')]=_0x10cf1f['attributes'][_0x7a8d('0x4d')]?_0x10cf1f[_0x7a8d('0x4a')]:_0x3e3e29[_0x7a8d('0x49')];_0x10cf1f['order']=qs['sort'](_0x44e696[_0x7a8d('0x4c')][_0x7a8d('0x6a')]);_0x10cf1f[_0x7a8d('0x50')]=qs[_0x7a8d('0x47')](_[_0x7a8d('0x51')](_0x44e696[_0x7a8d('0x4c')],_0x3e3e29[_0x7a8d('0x47')]));if(_0x44e696[_0x7a8d('0x4c')][_0x7a8d('0x54')]){_0x10cf1f['where']=_[_0x7a8d('0x52')](_0x10cf1f['where'],{'$or':_[_0x7a8d('0x45')](_0x10cf1f[_0x7a8d('0x4a')],function(_0x81016d){var _0xd5aa1={};_0xd5aa1[_0x81016d]={'$like':'%'+_0x44e696['query'][_0x7a8d('0x54')]+'%'};return _0xd5aa1;})});}_0x10cf1f=_[_0x7a8d('0x52')]({},_0x10cf1f,_0x44e696[_0x7a8d('0x5c')]);return _0x1e7b07[_0x7a8d('0xe3')](_0x10cf1f);}})[_0x7a8d('0x1f')](function(_0x451c9c){if(_0x451c9c){_0x2ee88b=_0x451c9c[_0x7a8d('0x4d')];if(!_0x44e696['query'][_0x7a8d('0x4e')]('nolimit')){_0x10cf1f[_0x7a8d('0x30')]=qs[_0x7a8d('0x30')](_0x44e696[_0x7a8d('0x4c')]['limit']);_0x10cf1f[_0x7a8d('0x2e')]=qs['offset'](_0x44e696[_0x7a8d('0x4c')][_0x7a8d('0x2e')]);}return _0x1e7b07[_0x7a8d('0xe3')](_0x10cf1f);}})['then'](function(_0x1ae813){if(_0x1ae813){return _0x1ae813?{'count':_0x2ee88b,'rows':_0x1ae813}:null;}})[_0x7a8d('0x1f')](respondWithResult(_0x2eac6c,null))[_0x7a8d('0x29')](handleError(_0x2eac6c,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index cddb576..2b0abed 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 _0x7843=['../../mysqldb','SmsAccount','setMaxListeners','save','update','remove','hook','exports','events'];(function(_0x31b31b,_0x5f044e){var _0x2c8fc2=function(_0x5438aa){while(--_0x5438aa){_0x31b31b['push'](_0x31b31b['shift']());}};_0x2c8fc2(++_0x5f044e);}(_0x7843,0xe0));var _0x3784=function(_0x31a7ac,_0xe27f3b){_0x31a7ac=_0x31a7ac-0x0;var _0x32014a=_0x7843[_0x31a7ac];return _0x32014a;};'use strict';var EventEmitter=require(_0x3784('0x0'));var SmsAccount=require(_0x3784('0x1'))['db'][_0x3784('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x3784('0x3')](0x0);var events={'afterCreate':_0x3784('0x4'),'afterUpdate':_0x3784('0x5'),'afterDestroy':_0x3784('0x6')};function emitEvent(_0x4fe6b7){return function(_0x986458,_0x375c53,_0x4cc6e0){SmsAccountEvents['emit'](_0x4fe6b7+':'+_0x986458['id'],_0x986458);SmsAccountEvents['emit'](_0x4fe6b7,_0x986458);_0x4cc6e0(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0x3784('0x7')](e,emitEvent(event));}}module[_0x3784('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0xb3f2=['exports','events','../../mysqldb','SmsAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x22944d,_0x208b4f){var _0x459bac=function(_0x1cdc28){while(--_0x1cdc28){_0x22944d['push'](_0x22944d['shift']());}};_0x459bac(++_0x208b4f);}(_0xb3f2,0x105));var _0x2b3f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb3f2[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0x2b3f('0x0'));var SmsAccount=require(_0x2b3f('0x1'))['db'][_0x2b3f('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x2b3f('0x3')](0x0);var events={'afterCreate':_0x2b3f('0x4'),'afterUpdate':_0x2b3f('0x5'),'afterDestroy':'remove'};function emitEvent(_0x1f73aa){return function(_0x434c9a,_0x564110,_0xc01300){SmsAccountEvents['emit'](_0x1f73aa+':'+_0x434c9a['id'],_0x434c9a);SmsAccountEvents[_0x2b3f('0x6')](_0x1f73aa,_0x434c9a);_0xc01300(null);};}for(var e in events){if(events[_0x2b3f('0x7')](e)){var event=events[e];SmsAccount[_0x2b3f('0x8')](e,emitEvent(event));}}module[_0x2b3f('0x9')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index e015888..6d65ef2 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 _0x0cd8=['request-promise','path','rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','api','moment'];(function(_0x51a5c3,_0x424d62){var _0x5f43b8=function(_0x4ecaad){while(--_0x4ecaad){_0x51a5c3['push'](_0x51a5c3['shift']());}};_0x5f43b8(++_0x424d62);}(_0x0cd8,0x1f4));var _0x80cd=function(_0x1392a7,_0xac8ca0){_0x1392a7=_0x1392a7-0x0;var _0x9d762d=_0x0cd8[_0x1392a7];return _0x9d762d;};'use strict';var _=require(_0x80cd('0x0'));var util=require(_0x80cd('0x1'));var logger=require('../../config/logger')(_0x80cd('0x2'));var moment=require(_0x80cd('0x3'));var BPromise=require('bluebird');var rp=require(_0x80cd('0x4'));var fs=require('fs');var path=require(_0x80cd('0x5'));var rimraf=require(_0x80cd('0x6'));var config=require('../../config/environment');var attributes=require(_0x80cd('0x7'));module[_0x80cd('0x8')]=function(_0x3bbc14,_0x4b7a3a){return _0x3bbc14[_0x80cd('0x9')](_0x80cd('0xa'),attributes,{'tableName':_0x80cd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xada7=['lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsAccount.attributes','exports','SmsAccount','sms_accounts'];(function(_0x49f4e7,_0x1dcbd4){var _0xcabbf4=function(_0x426f19){while(--_0x426f19){_0x49f4e7['push'](_0x49f4e7['shift']());}};_0xcabbf4(++_0x1dcbd4);}(_0xada7,0x120));var _0x7ada=function(_0x38023b,_0x961a2f){_0x38023b=_0x38023b-0x0;var _0x4ac13a=_0xada7[_0x38023b];return _0x4ac13a;};'use strict';var _=require(_0x7ada('0x0'));var util=require('util');var logger=require(_0x7ada('0x1'))('api');var moment=require(_0x7ada('0x2'));var BPromise=require(_0x7ada('0x3'));var rp=require(_0x7ada('0x4'));var fs=require('fs');var path=require(_0x7ada('0x5'));var rimraf=require(_0x7ada('0x6'));var config=require(_0x7ada('0x7'));var attributes=require(_0x7ada('0x8'));module[_0x7ada('0x9')]=function(_0x36065a,_0xf42292){return _0x36065a['define'](_0x7ada('0xa'),attributes,{'tableName':_0x7ada('0xb'),'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 e67d96c..a56f465 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 _0xba89=['SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','attributes','include','map','model','debug','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','socket.io-emitter','./smsAccount.socket','register','then','SmsAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x1f7b96,_0x3b68c3){var _0x6363e7=function(_0x209835){while(--_0x209835){_0x1f7b96['push'](_0x1f7b96['shift']());}};_0x6363e7(++_0x3b68c3);}(_0xba89,0x7c));var _0x9ba8=function(_0x3f6ed8,_0x1ac76b){_0x3f6ed8=_0x3f6ed8-0x0;var _0x5b6a94=_0xba89[_0x3f6ed8];return _0x5b6a94;};'use strict';var _=require(_0x9ba8('0x0'));var util=require(_0x9ba8('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ba8('0x2'));var db=require(_0x9ba8('0x3'))['db'];var utils=require(_0x9ba8('0x4'));var logger=require(_0x9ba8('0x5'))(_0x9ba8('0x6'));var config=require('../../config/environment');var jayson=require(_0x9ba8('0x7'));var client=jayson[_0x9ba8('0x8')]['http']({'port':0x232a});config['redis']=_[_0x9ba8('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9ba8('0xa'))(new Redis(config['redis']));require(_0x9ba8('0xb'))[_0x9ba8('0xc')](socket);function respondWithRpcPromise(_0x5077c9,_0x162eb2,_0x3f4b47){return new BPromise(function(_0x68afa5,_0x13b4a5){return client['request'](_0x5077c9,_0x3f4b47)[_0x9ba8('0xd')](function(_0x1652a1){logger['info'](_0x9ba8('0xe'),_0x162eb2,_0x9ba8('0xf'));logger['debug'](_0x9ba8('0x10'),_0x162eb2,_0x9ba8('0xf'),JSON[_0x9ba8('0x11')](_0x1652a1));if(_0x1652a1[_0x9ba8('0x12')]){if(_0x1652a1['error'][_0x9ba8('0x13')]===0x1f4){logger[_0x9ba8('0x12')]('SmsAccount,\x20%s,\x20%s',_0x162eb2,_0x1652a1[_0x9ba8('0x12')][_0x9ba8('0x14')]);return _0x13b4a5(_0x1652a1['error'][_0x9ba8('0x14')]);}logger['error'](_0x9ba8('0xe'),_0x162eb2,_0x1652a1[_0x9ba8('0x12')]['message']);return _0x68afa5(_0x1652a1['error'][_0x9ba8('0x14')]);}else{logger[_0x9ba8('0x15')](_0x9ba8('0xe'),_0x162eb2,_0x9ba8('0xf'));_0x68afa5(_0x1652a1[_0x9ba8('0x16')][_0x9ba8('0x14')]);}})[_0x9ba8('0x17')](function(_0x393ce8){logger[_0x9ba8('0x12')](_0x9ba8('0xe'),_0x162eb2,_0x393ce8);_0x13b4a5(_0x393ce8);});});}exports[_0x9ba8('0x18')]=function(_0x18d63f){var _0x29b4e3=this;return new Promise(function(_0x270376,_0x5d2201){return db[_0x9ba8('0x19')][_0x9ba8('0x1a')]({'raw':_0x18d63f['options']?_0x18d63f[_0x9ba8('0x1b')][_0x9ba8('0x1c')]===undefined?!![]:![]:!![],'where':_0x18d63f[_0x9ba8('0x1b')]?_0x18d63f[_0x9ba8('0x1b')][_0x9ba8('0x1d')]||null:null,'attributes':_0x18d63f[_0x9ba8('0x1b')]?_0x18d63f[_0x9ba8('0x1b')][_0x9ba8('0x1e')]||null:null,'include':_0x18d63f[_0x9ba8('0x1b')]?_0x18d63f[_0x9ba8('0x1b')][_0x9ba8('0x1f')]?_[_0x9ba8('0x20')](_0x18d63f[_0x9ba8('0x1b')][_0x9ba8('0x1f')],function(_0x5ad07a){return{'model':db[_0x5ad07a[_0x9ba8('0x21')]],'as':_0x5ad07a['as'],'attributes':_0x5ad07a[_0x9ba8('0x1e')],'include':_0x5ad07a[_0x9ba8('0x1f')]?_[_0x9ba8('0x20')](_0x5ad07a[_0x9ba8('0x1f')],function(_0x144e9e){return{'model':db[_0x144e9e[_0x9ba8('0x21')]],'as':_0x144e9e['as'],'attributes':_0x144e9e[_0x9ba8('0x1e')],'include':_0x144e9e[_0x9ba8('0x1f')]?_[_0x9ba8('0x20')](_0x144e9e[_0x9ba8('0x1f')],function(_0x3bbfcd){return{'model':db[_0x3bbfcd[_0x9ba8('0x21')]],'as':_0x3bbfcd['as'],'attributes':_0x3bbfcd[_0x9ba8('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x9ba8('0xd')](function(_0x509d36){logger[_0x9ba8('0x15')]('ShowSmsAccount',_0x18d63f);logger[_0x9ba8('0x22')](_0x9ba8('0x18'),_0x18d63f,JSON[_0x9ba8('0x11')](_0x509d36));_0x270376(_0x509d36);})[_0x9ba8('0x17')](function(_0x32d6b3){logger[_0x9ba8('0x12')](_0x9ba8('0x18'),_0x32d6b3[_0x9ba8('0x14')],_0x18d63f);_0x5d2201(_0x29b4e3[_0x9ba8('0x12')](0x1f4,_0x32d6b3[_0x9ba8('0x14')]));});});}; \ No newline at end of file +var _0xf957=['../../config/logger','../../config/environment','jayson/promise','client','http','defaults','localhost','redis','./smsAccount.socket','register','request','then','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ShowSmsAccount','SmsAccount','find','options','where','attributes','include','map','model','debug','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1fc122,_0x5e2c17){var _0xa2cb13=function(_0x263b13){while(--_0x263b13){_0x1fc122['push'](_0x1fc122['shift']());}};_0xa2cb13(++_0x5e2c17);}(_0xf957,0x69));var _0x7f95=function(_0x5f4e09,_0x5158de){_0x5f4e09=_0x5f4e09-0x0;var _0x25817a=_0xf957[_0x5f4e09];return _0x25817a;};'use strict';var _=require(_0x7f95('0x0'));var util=require('util');var moment=require(_0x7f95('0x1'));var BPromise=require('bluebird');var rs=require(_0x7f95('0x2'));var fs=require('fs');var Redis=require(_0x7f95('0x3'));var db=require(_0x7f95('0x4'))['db'];var utils=require(_0x7f95('0x5'));var logger=require(_0x7f95('0x6'))('rpc');var config=require(_0x7f95('0x7'));var jayson=require(_0x7f95('0x8'));var client=jayson[_0x7f95('0x9')][_0x7f95('0xa')]({'port':0x232a});config['redis']=_[_0x7f95('0xb')](config['redis'],{'host':_0x7f95('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7f95('0xd')]));require(_0x7f95('0xe'))[_0x7f95('0xf')](socket);function respondWithRpcPromise(_0x1d4476,_0x3813d3,_0x5af294){return new BPromise(function(_0x5562db,_0x56c385){return client[_0x7f95('0x10')](_0x1d4476,_0x5af294)[_0x7f95('0x11')](function(_0x234590){logger['info'](_0x7f95('0x12'),_0x3813d3,_0x7f95('0x13'));logger['debug'](_0x7f95('0x14'),_0x3813d3,_0x7f95('0x13'),JSON[_0x7f95('0x15')](_0x234590));if(_0x234590[_0x7f95('0x16')]){if(_0x234590[_0x7f95('0x16')]['code']===0x1f4){logger[_0x7f95('0x16')]('SmsAccount,\x20%s,\x20%s',_0x3813d3,_0x234590[_0x7f95('0x16')][_0x7f95('0x17')]);return _0x56c385(_0x234590['error']['message']);}logger[_0x7f95('0x16')](_0x7f95('0x12'),_0x3813d3,_0x234590['error'][_0x7f95('0x17')]);return _0x5562db(_0x234590[_0x7f95('0x16')][_0x7f95('0x17')]);}else{logger[_0x7f95('0x18')](_0x7f95('0x12'),_0x3813d3,_0x7f95('0x13'));_0x5562db(_0x234590[_0x7f95('0x19')][_0x7f95('0x17')]);}})[_0x7f95('0x1a')](function(_0x5db109){logger['error'](_0x7f95('0x12'),_0x3813d3,_0x5db109);_0x56c385(_0x5db109);});});}exports[_0x7f95('0x1b')]=function(_0x411720){var _0x25611e=this;return new Promise(function(_0x151680,_0x23f5a1){return db[_0x7f95('0x1c')][_0x7f95('0x1d')]({'raw':_0x411720[_0x7f95('0x1e')]?_0x411720[_0x7f95('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x411720[_0x7f95('0x1e')]?_0x411720[_0x7f95('0x1e')][_0x7f95('0x1f')]||null:null,'attributes':_0x411720[_0x7f95('0x1e')]?_0x411720['options'][_0x7f95('0x20')]||null:null,'include':_0x411720['options']?_0x411720[_0x7f95('0x1e')][_0x7f95('0x21')]?_[_0x7f95('0x22')](_0x411720['options'][_0x7f95('0x21')],function(_0x253545){return{'model':db[_0x253545[_0x7f95('0x23')]],'as':_0x253545['as'],'attributes':_0x253545[_0x7f95('0x20')],'include':_0x253545[_0x7f95('0x21')]?_[_0x7f95('0x22')](_0x253545[_0x7f95('0x21')],function(_0x263c2f){return{'model':db[_0x263c2f[_0x7f95('0x23')]],'as':_0x263c2f['as'],'attributes':_0x263c2f[_0x7f95('0x20')],'include':_0x263c2f[_0x7f95('0x21')]?_['map'](_0x263c2f['include'],function(_0x5ebdd4){return{'model':db[_0x5ebdd4[_0x7f95('0x23')]],'as':_0x5ebdd4['as'],'attributes':_0x5ebdd4['attributes']};}):[]};}):[]};}):[]:[]})[_0x7f95('0x11')](function(_0x55af71){logger[_0x7f95('0x18')]('ShowSmsAccount',_0x411720);logger[_0x7f95('0x24')](_0x7f95('0x1b'),_0x411720,JSON[_0x7f95('0x15')](_0x55af71));_0x151680(_0x55af71);})[_0x7f95('0x1a')](function(_0x47e6e8){logger[_0x7f95('0x16')](_0x7f95('0x1b'),_0x47e6e8[_0x7f95('0x17')],_0x411720);_0x23f5a1(_0x25611e[_0x7f95('0x16')](0x1f4,_0x47e6e8['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index b6c0b3e..b4e06ba 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(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xa9e0[_0x2f5ac5];return _0x37c9a8;};'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 5343e30..fed0ac3 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 _0x34e8=['../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x16bfae,_0x36ed25){var _0x3870f5=function(_0x5ae24a){while(--_0x5ae24a){_0x16bfae['push'](_0x16bfae['shift']());}};_0x3870f5(++_0x36ed25);}(_0x34e8,0x12c));var _0x834e=function(_0x317d63,_0x2a36bd){_0x317d63=_0x317d63-0x0;var _0x43b1ef=_0x34e8[_0x317d63];return _0x43b1ef;};'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('0xf')]('/',auth[_0x834e('0xd')](),controller[_0x834e('0x10')]);router[_0x834e('0x11')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x12')]);router[_0x834e('0x13')](_0x834e('0xc'),auth[_0x834e('0xd')](),controller[_0x834e('0x14')]);module[_0x834e('0x15')]=router; \ No newline at end of file +var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x3e5cd5,_0x58272b){var _0x1b8d19=function(_0x3e216b){while(--_0x3e216b){_0x3e5cd5['push'](_0x3e5cd5['shift']());}};_0x1b8d19(++_0x58272b);}(_0x3e74,0x175));var _0x43e7=function(_0x1eda19,_0x4678ef){_0x1eda19=_0x1eda19-0x0;var _0x2cb79d=_0x3e74[_0x1eda19];return _0x2cb79d;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('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 a857a47..d7b2d84 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 _0x78d8=['noop','STRING','exports'];(function(_0x3d4603,_0x3c7f76){var _0x24561f=function(_0x23e4a7){while(--_0x23e4a7){_0x3d4603['push'](_0x3d4603['shift']());}};_0x24561f(++_0x3c7f76);}(_0x78d8,0xad));var _0x878d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x78d8[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x878d('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x878d('0x1')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x878d('0x2')]},'interval':{'type':Sequelize[_0x878d('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd662=['TEXT','*,*,*,*','sequelize','STRING','noop'];(function(_0x39cb83,_0x42c4a2){var _0x568b71=function(_0xb84dc1){while(--_0xb84dc1){_0x39cb83['push'](_0x39cb83['shift']());}};_0x568b71(++_0x42c4a2);}(_0xd662,0x75));var _0x2d66=function(_0x46685f,_0x5795b3){_0x46685f=_0x46685f-0x0;var _0x7da24c=_0xd662[_0x46685f];return _0x7da24c;};'use strict';var Sequelize=require(_0x2d66('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x2d66('0x1')],'allowNull':![],'defaultValue':_0x2d66('0x2')},'appdata':{'type':Sequelize[_0x2d66('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x2d66('0x1')],'defaultValue':_0x2d66('0x4')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 0cecb3d..d9e5ee1 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 _0xfadc=['zip-dir','moment','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','then','destroy','sendStatus','error','stack','name','send','index','SmsApplication','rawAttributes','type','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','eml-format','rimraf'];(function(_0xc96b0d,_0x37cfa3){var _0xe97c39=function(_0xbfbc4){while(--_0xbfbc4){_0xc96b0d['push'](_0xc96b0d['shift']());}};_0xe97c39(++_0x37cfa3);}(_0xfadc,0xd6));var _0xcfad=function(_0x12938c,_0xedc99c){_0x12938c=_0x12938c-0x0;var _0x4d1254=_0xfadc[_0x12938c];return _0x4d1254;};'use strict';var emlformat=require(_0xcfad('0x0'));var rimraf=require(_0xcfad('0x1'));var zipdir=require(_0xcfad('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcfad('0x3'));var BPromise=require(_0xcfad('0x4'));var Mustache=require(_0xcfad('0x5'));var util=require(_0xcfad('0x6'));var path=require(_0xcfad('0x7'));var sox=require('sox');var csv=require(_0xcfad('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcfad('0x9'));var squel=require(_0xcfad('0xa'));var crypto=require('crypto');var jsforce=require(_0xcfad('0xb'));var deskjs=require(_0xcfad('0xc'));var toCsv=require('to-csv');var querystring=require(_0xcfad('0xd'));var Papa=require(_0xcfad('0xe'));var Redis=require(_0xcfad('0xf'));var authService=require(_0xcfad('0x10'));var qs=require(_0xcfad('0x11'));var as=require(_0xcfad('0x12'));var hardwareService=require(_0xcfad('0x13'));var logger=require('../../config/logger')(_0xcfad('0x14'));var utils=require('../../config/utils');var config=require(_0xcfad('0x15'));var licenseUtil=require(_0xcfad('0x16'));var db=require(_0xcfad('0x17'))['db'];function respondWithStatusCode(_0x2297ad,_0x3923d6){_0x3923d6=_0x3923d6||0xcc;return function(_0x1e5275){if(_0x1e5275){return _0x2297ad['sendStatus'](_0x3923d6);}return _0x2297ad[_0xcfad('0x18')](_0x3923d6)[_0xcfad('0x19')]();};}function respondWithResult(_0x10a9fe,_0x3ab4e4){_0x3ab4e4=_0x3ab4e4||0xc8;return function(_0x5c3459){if(_0x5c3459){return _0x10a9fe[_0xcfad('0x18')](_0x3ab4e4)[_0xcfad('0x1a')](_0x5c3459);}};}function respondWithFilteredResult(_0x129e9e,_0x16be39){return function(_0x1deb22){if(_0x1deb22){var _0x261742=typeof _0x16be39[_0xcfad('0x1b')]==='undefined'&&typeof _0x16be39['limit']===_0xcfad('0x1c');var _0xb4d1d6=_0x1deb22[_0xcfad('0x1d')];var _0x4a72fb=_0x261742?0x0:_0x16be39['offset'];var _0x46bb2a=_0x261742?_0x1deb22['count']:_0x16be39[_0xcfad('0x1b')]+_0x16be39[_0xcfad('0x1e')];var _0x3b02bb;if(_0x46bb2a>=_0xb4d1d6){_0x46bb2a=_0xb4d1d6;_0x3b02bb=0xc8;}else{_0x3b02bb=0xce;}_0x129e9e[_0xcfad('0x18')](_0x3b02bb);return _0x129e9e[_0xcfad('0x1f')]('Content-Range',_0x4a72fb+'-'+_0x46bb2a+'/'+_0xb4d1d6)[_0xcfad('0x1a')](_0x1deb22);}return null;};}function patchUpdates(_0x4de792){return function(_0x7cd95e){try{jsonpatch['apply'](_0x7cd95e,_0x4de792,!![]);}catch(_0xc7f8d8){return BPromise['reject'](_0xc7f8d8);}return _0x7cd95e['save']();};}function saveUpdates(_0x2e2669,_0x435dd2){return function(_0x1d5618){if(_0x1d5618){return _0x1d5618['update'](_0x2e2669)[_0xcfad('0x20')](function(_0x3cdf2b){return _0x3cdf2b;});}return null;};}function removeEntity(_0x242c5a,_0x419fef){return function(_0x231fbc){if(_0x231fbc){return _0x231fbc[_0xcfad('0x21')]()[_0xcfad('0x20')](function(){_0x242c5a[_0xcfad('0x18')](0xcc)[_0xcfad('0x19')]();});}};}function handleEntityNotFound(_0x2e6a4e,_0x511e83){return function(_0x2ed0cf){if(!_0x2ed0cf){_0x2e6a4e[_0xcfad('0x22')](0x194);}return _0x2ed0cf;};}function handleError(_0x5a432a,_0x5d9b09){_0x5d9b09=_0x5d9b09||0x1f4;return function(_0x56133b){logger[_0xcfad('0x23')](_0x56133b[_0xcfad('0x24')]);if(_0x56133b[_0xcfad('0x25')]){delete _0x56133b[_0xcfad('0x25')];}_0x5a432a[_0xcfad('0x18')](_0x5d9b09)[_0xcfad('0x26')](_0x56133b);};}exports[_0xcfad('0x27')]=function(_0x2d6fe1,_0x5a2316){var _0x2ae3ab={},_0x26896f={},_0x197f62={'count':0x0,'rows':[]};var _0x29a330=_['map'](db[_0xcfad('0x28')][_0xcfad('0x29')],function(_0x33ad76){return{'name':_0x33ad76['fieldName'],'type':_0x33ad76[_0xcfad('0x2a')]['key']};});_0x26896f['model']=_[_0xcfad('0x2b')](_0x29a330,_0xcfad('0x25'));_0x26896f['query']=_[_0xcfad('0x2c')](_0x2d6fe1[_0xcfad('0x2d')]);_0x26896f[_0xcfad('0x2e')]=_[_0xcfad('0x2f')](_0x26896f[_0xcfad('0x30')],_0x26896f[_0xcfad('0x2d')]);_0x2ae3ab[_0xcfad('0x31')]=_[_0xcfad('0x2f')](_0x26896f[_0xcfad('0x30')],qs[_0xcfad('0x32')](_0x2d6fe1['query']['fields']));_0x2ae3ab[_0xcfad('0x31')]=_0x2ae3ab[_0xcfad('0x31')][_0xcfad('0x33')]?_0x2ae3ab[_0xcfad('0x31')]:_0x26896f['model'];if(!_0x2d6fe1['query'][_0xcfad('0x34')](_0xcfad('0x35'))){_0x2ae3ab[_0xcfad('0x1e')]=qs[_0xcfad('0x1e')](_0x2d6fe1[_0xcfad('0x2d')][_0xcfad('0x1e')]);_0x2ae3ab['offset']=qs[_0xcfad('0x1b')](_0x2d6fe1[_0xcfad('0x2d')][_0xcfad('0x1b')]);}_0x2ae3ab[_0xcfad('0x36')]=qs['sort'](_0x2d6fe1[_0xcfad('0x2d')][_0xcfad('0x37')]);_0x2ae3ab[_0xcfad('0x38')]=qs['filters'](_[_0xcfad('0x39')](_0x2d6fe1['query'],_0x26896f[_0xcfad('0x2e')]),_0x29a330);if(_0x2d6fe1['query'][_0xcfad('0x3a')]){_0x2ae3ab[_0xcfad('0x38')]=_[_0xcfad('0x3b')](_0x2ae3ab['where'],{'$or':_[_0xcfad('0x2b')](_0x29a330,function(_0x533a4b){if(_0x533a4b[_0xcfad('0x2a')]!==_0xcfad('0x3c')){var _0x48e5af={};_0x48e5af[_0x533a4b['name']]={'$like':'%'+_0x2d6fe1[_0xcfad('0x2d')]['filter']+'%'};return _0x48e5af;}})});}_0x2ae3ab=_[_0xcfad('0x3b')]({},_0x2ae3ab,_0x2d6fe1['options']);var _0x1158c6={'where':_0x2ae3ab[_0xcfad('0x38')]};return db['SmsApplication'][_0xcfad('0x1d')](_0x1158c6)[_0xcfad('0x20')](function(_0x5a15a2){_0x197f62[_0xcfad('0x1d')]=_0x5a15a2;if(_0x2d6fe1[_0xcfad('0x2d')][_0xcfad('0x3d')]){_0x2ae3ab[_0xcfad('0x3e')]=[{'all':!![]}];}return db[_0xcfad('0x28')][_0xcfad('0x3f')](_0x2ae3ab);})[_0xcfad('0x20')](function(_0x90de9d){_0x197f62[_0xcfad('0x40')]=_0x90de9d;return _0x197f62;})[_0xcfad('0x20')](respondWithFilteredResult(_0x5a2316,_0x2ae3ab))[_0xcfad('0x41')](handleError(_0x5a2316,null));};exports[_0xcfad('0x42')]=function(_0x22d73a,_0x31d1c){var _0x27ceae={'raw':!![],'where':{'id':_0x22d73a[_0xcfad('0x43')]['id']}},_0x57e87c={};_0x57e87c['model']=_[_0xcfad('0x2c')](db[_0xcfad('0x28')][_0xcfad('0x29')]);_0x57e87c[_0xcfad('0x2d')]=_[_0xcfad('0x2c')](_0x22d73a[_0xcfad('0x2d')]);_0x57e87c[_0xcfad('0x2e')]=_[_0xcfad('0x2f')](_0x57e87c[_0xcfad('0x30')],_0x57e87c[_0xcfad('0x2d')]);_0x27ceae[_0xcfad('0x31')]=_[_0xcfad('0x2f')](_0x57e87c[_0xcfad('0x30')],qs['fields'](_0x22d73a[_0xcfad('0x2d')][_0xcfad('0x32')]));_0x27ceae['attributes']=_0x27ceae[_0xcfad('0x31')][_0xcfad('0x33')]?_0x27ceae['attributes']:_0x57e87c[_0xcfad('0x30')];if(_0x22d73a[_0xcfad('0x2d')][_0xcfad('0x3d')]){_0x27ceae['include']=[{'all':!![]}];}_0x27ceae=_['merge']({},_0x27ceae,_0x22d73a[_0xcfad('0x44')]);return db[_0xcfad('0x28')][_0xcfad('0x45')](_0x27ceae)['then'](handleEntityNotFound(_0x31d1c,null))[_0xcfad('0x20')](respondWithResult(_0x31d1c,null))[_0xcfad('0x41')](handleError(_0x31d1c,null));};exports[_0xcfad('0x46')]=function(_0x2aab82,_0x5d4a69){return db[_0xcfad('0x28')][_0xcfad('0x46')](_0x2aab82[_0xcfad('0x47')],{})[_0xcfad('0x20')](respondWithResult(_0x5d4a69,0xc9))[_0xcfad('0x41')](handleError(_0x5d4a69,null));};exports['update']=function(_0x3275cd,_0x9504e1){if(_0x3275cd[_0xcfad('0x47')]['id']){delete _0x3275cd[_0xcfad('0x47')]['id'];}return db['SmsApplication'][_0xcfad('0x45')]({'where':{'id':_0x3275cd[_0xcfad('0x43')]['id']}})['then'](handleEntityNotFound(_0x9504e1,null))['then'](saveUpdates(_0x3275cd[_0xcfad('0x47')],null))[_0xcfad('0x20')](respondWithResult(_0x9504e1,null))[_0xcfad('0x41')](handleError(_0x9504e1,null));};exports[_0xcfad('0x21')]=function(_0xab5466,_0x586433){return db[_0xcfad('0x28')][_0xcfad('0x45')]({'where':{'id':_0xab5466[_0xcfad('0x43')]['id']}})['then'](handleEntityNotFound(_0x586433,null))[_0xcfad('0x20')](removeEntity(_0x586433,null))[_0xcfad('0x41')](handleError(_0x586433,null));}; \ No newline at end of file +var _0x4cfc=['util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../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','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','map','SmsApplication','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','keys','find','catch','create','body','eml-format','zip-dir','request-promise','mustache'];(function(_0x343fcd,_0x3584ed){var _0xfeb398=function(_0x500f3c){while(--_0x500f3c){_0x343fcd['push'](_0x343fcd['shift']());}};_0xfeb398(++_0x3584ed);}(_0x4cfc,0x1b8));var _0xc4cf=function(_0x85daa4,_0x1bc8e9){_0x85daa4=_0x85daa4-0x0;var _0x1f912b=_0x4cfc[_0x85daa4];return _0x1f912b;};'use strict';var emlformat=require(_0xc4cf('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4cf('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc4cf('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc4cf('0x3'));var util=require(_0xc4cf('0x4'));var path=require(_0xc4cf('0x5'));var sox=require(_0xc4cf('0x6'));var csv=require(_0xc4cf('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc4cf('0x8'));var _=require(_0xc4cf('0x9'));var squel=require(_0xc4cf('0xa'));var crypto=require('crypto');var jsforce=require(_0xc4cf('0xb'));var deskjs=require(_0xc4cf('0xc'));var toCsv=require(_0xc4cf('0x7'));var querystring=require(_0xc4cf('0xd'));var Papa=require('papaparse');var Redis=require(_0xc4cf('0xe'));var authService=require(_0xc4cf('0xf'));var qs=require(_0xc4cf('0x10'));var as=require(_0xc4cf('0x11'));var hardwareService=require(_0xc4cf('0x12'));var logger=require(_0xc4cf('0x13'))(_0xc4cf('0x14'));var utils=require(_0xc4cf('0x15'));var config=require(_0xc4cf('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc4cf('0x17'))['db'];function respondWithStatusCode(_0x54b113,_0x4f28f0){_0x4f28f0=_0x4f28f0||0xcc;return function(_0x188d89){if(_0x188d89){return _0x54b113[_0xc4cf('0x18')](_0x4f28f0);}return _0x54b113[_0xc4cf('0x19')](_0x4f28f0)[_0xc4cf('0x1a')]();};}function respondWithResult(_0x5e851e,_0x39a4e7){_0x39a4e7=_0x39a4e7||0xc8;return function(_0x26a0e3){if(_0x26a0e3){return _0x5e851e['status'](_0x39a4e7)[_0xc4cf('0x1b')](_0x26a0e3);}};}function respondWithFilteredResult(_0x53266c,_0x22d679){return function(_0x2c8817){if(_0x2c8817){var _0x3d9b01=typeof _0x22d679[_0xc4cf('0x1c')]===_0xc4cf('0x1d')&&typeof _0x22d679['limit']===_0xc4cf('0x1d');var _0x47d1e0=_0x2c8817[_0xc4cf('0x1e')];var _0x43959d=_0x3d9b01?0x0:_0x22d679['offset'];var _0xcbf452=_0x3d9b01?_0x2c8817['count']:_0x22d679[_0xc4cf('0x1c')]+_0x22d679[_0xc4cf('0x1f')];var _0x12575e;if(_0xcbf452>=_0x47d1e0){_0xcbf452=_0x47d1e0;_0x12575e=0xc8;}else{_0x12575e=0xce;}_0x53266c[_0xc4cf('0x19')](_0x12575e);return _0x53266c[_0xc4cf('0x20')](_0xc4cf('0x21'),_0x43959d+'-'+_0xcbf452+'/'+_0x47d1e0)[_0xc4cf('0x1b')](_0x2c8817);}return null;};}function patchUpdates(_0x4e98b4){return function(_0x1583b5){try{jsonpatch['apply'](_0x1583b5,_0x4e98b4,!![]);}catch(_0x2ee047){return BPromise[_0xc4cf('0x22')](_0x2ee047);}return _0x1583b5[_0xc4cf('0x23')]();};}function saveUpdates(_0x4b43b1,_0x106fbf){return function(_0x2cdf6c){if(_0x2cdf6c){return _0x2cdf6c[_0xc4cf('0x24')](_0x4b43b1)[_0xc4cf('0x25')](function(_0x5ebb49){return _0x5ebb49;});}return null;};}function removeEntity(_0x20c486,_0x183c40){return function(_0x1a36d8){if(_0x1a36d8){return _0x1a36d8[_0xc4cf('0x26')]()['then'](function(){_0x20c486[_0xc4cf('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb1f1f0,_0x1f9a2a){return function(_0x43f3c0){if(!_0x43f3c0){_0xb1f1f0[_0xc4cf('0x18')](0x194);}return _0x43f3c0;};}function handleError(_0x58f733,_0x102899){_0x102899=_0x102899||0x1f4;return function(_0x322c9d){logger[_0xc4cf('0x27')](_0x322c9d[_0xc4cf('0x28')]);if(_0x322c9d['name']){delete _0x322c9d[_0xc4cf('0x29')];}_0x58f733[_0xc4cf('0x19')](_0x102899)[_0xc4cf('0x2a')](_0x322c9d);};}exports['index']=function(_0x12595a,_0x5ed6cd){var _0x3f0d33={},_0x50c91b={},_0xb6ee98={'count':0x0,'rows':[]};var _0x512a59=_[_0xc4cf('0x2b')](db[_0xc4cf('0x2c')]['rawAttributes'],function(_0x5cb0cc){return{'name':_0x5cb0cc[_0xc4cf('0x2d')],'type':_0x5cb0cc['type'][_0xc4cf('0x2e')]};});_0x50c91b[_0xc4cf('0x2f')]=_['map'](_0x512a59,_0xc4cf('0x29'));_0x50c91b[_0xc4cf('0x30')]=_['keys'](_0x12595a['query']);_0x50c91b[_0xc4cf('0x31')]=_[_0xc4cf('0x32')](_0x50c91b[_0xc4cf('0x2f')],_0x50c91b['query']);_0x3f0d33[_0xc4cf('0x33')]=_[_0xc4cf('0x32')](_0x50c91b[_0xc4cf('0x2f')],qs[_0xc4cf('0x34')](_0x12595a[_0xc4cf('0x30')][_0xc4cf('0x34')]));_0x3f0d33[_0xc4cf('0x33')]=_0x3f0d33[_0xc4cf('0x33')][_0xc4cf('0x35')]?_0x3f0d33[_0xc4cf('0x33')]:_0x50c91b[_0xc4cf('0x2f')];if(!_0x12595a[_0xc4cf('0x30')][_0xc4cf('0x36')](_0xc4cf('0x37'))){_0x3f0d33['limit']=qs['limit'](_0x12595a[_0xc4cf('0x30')][_0xc4cf('0x1f')]);_0x3f0d33[_0xc4cf('0x1c')]=qs[_0xc4cf('0x1c')](_0x12595a['query']['offset']);}_0x3f0d33['order']=qs[_0xc4cf('0x38')](_0x12595a[_0xc4cf('0x30')][_0xc4cf('0x38')]);_0x3f0d33[_0xc4cf('0x39')]=qs[_0xc4cf('0x31')](_[_0xc4cf('0x3a')](_0x12595a[_0xc4cf('0x30')],_0x50c91b[_0xc4cf('0x31')]),_0x512a59);if(_0x12595a[_0xc4cf('0x30')][_0xc4cf('0x3b')]){_0x3f0d33['where']=_[_0xc4cf('0x3c')](_0x3f0d33['where'],{'$or':_[_0xc4cf('0x2b')](_0x512a59,function(_0x1ded1a){if(_0x1ded1a[_0xc4cf('0x3d')]!==_0xc4cf('0x3e')){var _0x51978e={};_0x51978e[_0x1ded1a[_0xc4cf('0x29')]]={'$like':'%'+_0x12595a[_0xc4cf('0x30')][_0xc4cf('0x3b')]+'%'};return _0x51978e;}})});}_0x3f0d33=_['merge']({},_0x3f0d33,_0x12595a[_0xc4cf('0x3f')]);var _0x4f508={'where':_0x3f0d33[_0xc4cf('0x39')]};return db[_0xc4cf('0x2c')]['count'](_0x4f508)[_0xc4cf('0x25')](function(_0x5612bb){_0xb6ee98[_0xc4cf('0x1e')]=_0x5612bb;if(_0x12595a[_0xc4cf('0x30')]['includeAll']){_0x3f0d33[_0xc4cf('0x40')]=[{'all':!![]}];}return db[_0xc4cf('0x2c')][_0xc4cf('0x41')](_0x3f0d33);})[_0xc4cf('0x25')](function(_0x3cf58e){_0xb6ee98[_0xc4cf('0x42')]=_0x3cf58e;return _0xb6ee98;})[_0xc4cf('0x25')](respondWithFilteredResult(_0x5ed6cd,_0x3f0d33))['catch'](handleError(_0x5ed6cd,null));};exports[_0xc4cf('0x43')]=function(_0x89727d,_0x16d44c){var _0x593753={'raw':!![],'where':{'id':_0x89727d[_0xc4cf('0x44')]['id']}},_0x3da880={};_0x3da880[_0xc4cf('0x2f')]=_[_0xc4cf('0x45')](db[_0xc4cf('0x2c')]['rawAttributes']);_0x3da880['query']=_['keys'](_0x89727d[_0xc4cf('0x30')]);_0x3da880[_0xc4cf('0x31')]=_[_0xc4cf('0x32')](_0x3da880[_0xc4cf('0x2f')],_0x3da880[_0xc4cf('0x30')]);_0x593753[_0xc4cf('0x33')]=_[_0xc4cf('0x32')](_0x3da880[_0xc4cf('0x2f')],qs[_0xc4cf('0x34')](_0x89727d[_0xc4cf('0x30')][_0xc4cf('0x34')]));_0x593753[_0xc4cf('0x33')]=_0x593753[_0xc4cf('0x33')][_0xc4cf('0x35')]?_0x593753['attributes']:_0x3da880[_0xc4cf('0x2f')];if(_0x89727d[_0xc4cf('0x30')]['includeAll']){_0x593753[_0xc4cf('0x40')]=[{'all':!![]}];}_0x593753=_['merge']({},_0x593753,_0x89727d[_0xc4cf('0x3f')]);return db[_0xc4cf('0x2c')][_0xc4cf('0x46')](_0x593753)[_0xc4cf('0x25')](handleEntityNotFound(_0x16d44c,null))[_0xc4cf('0x25')](respondWithResult(_0x16d44c,null))[_0xc4cf('0x47')](handleError(_0x16d44c,null));};exports['create']=function(_0x14545a,_0x506df5){return db[_0xc4cf('0x2c')][_0xc4cf('0x48')](_0x14545a[_0xc4cf('0x49')],{})['then'](respondWithResult(_0x506df5,0xc9))[_0xc4cf('0x47')](handleError(_0x506df5,null));};exports[_0xc4cf('0x24')]=function(_0xf05a9d,_0x301136){if(_0xf05a9d['body']['id']){delete _0xf05a9d['body']['id'];}return db[_0xc4cf('0x2c')][_0xc4cf('0x46')]({'where':{'id':_0xf05a9d['params']['id']}})[_0xc4cf('0x25')](handleEntityNotFound(_0x301136,null))['then'](saveUpdates(_0xf05a9d[_0xc4cf('0x49')],null))[_0xc4cf('0x25')](respondWithResult(_0x301136,null))[_0xc4cf('0x47')](handleError(_0x301136,null));};exports[_0xc4cf('0x26')]=function(_0x59f01e,_0x13a6a3){return db[_0xc4cf('0x2c')]['find']({'where':{'id':_0x59f01e[_0xc4cf('0x44')]['id']}})[_0xc4cf('0x25')](handleEntityNotFound(_0x13a6a3,null))[_0xc4cf('0x25')](removeEntity(_0x13a6a3,null))[_0xc4cf('0x47')](handleError(_0x13a6a3,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index f9a3fd4..fe2fd63 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 _0x8bc2=['moment','bluebird','request-promise','path','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x1d0e07,_0x1f484c){var _0x3514bd=function(_0x5b9bd0){while(--_0x5b9bd0){_0x1d0e07['push'](_0x1d0e07['shift']());}};_0x3514bd(++_0x1f484c);}(_0x8bc2,0x7a));var _0x28bc=function(_0x32bac4,_0x1c2a1a){_0x32bac4=_0x32bac4-0x0;var _0x3de461=_0x8bc2[_0x32bac4];return _0x3de461;};'use strict';var _=require(_0x28bc('0x0'));var util=require(_0x28bc('0x1'));var logger=require(_0x28bc('0x2'))(_0x28bc('0x3'));var moment=require(_0x28bc('0x4'));var BPromise=require(_0x28bc('0x5'));var rp=require(_0x28bc('0x6'));var fs=require('fs');var path=require(_0x28bc('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x28bc('0x8'));module[_0x28bc('0x9')]=function(_0xe216b7,_0x3bbcf1){return _0xe216b7[_0x28bc('0xa')](_0x28bc('0xb'),attributes,{'tableName':_0x28bc('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x28bc('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x8d84=['bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','sms_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment'];(function(_0x1d0582,_0x41c23f){var _0x2fb015=function(_0x32d966){while(--_0x32d966){_0x1d0582['push'](_0x1d0582['shift']());}};_0x2fb015(++_0x41c23f);}(_0x8d84,0x64));var _0x48d8=function(_0x3f8119,_0x3eb3b3){_0x3f8119=_0x3f8119-0x0;var _0x4e4e35=_0x8d84[_0x3f8119];return _0x4e4e35;};'use strict';var _=require(_0x48d8('0x0'));var util=require(_0x48d8('0x1'));var logger=require(_0x48d8('0x2'))(_0x48d8('0x3'));var moment=require(_0x48d8('0x4'));var BPromise=require(_0x48d8('0x5'));var rp=require(_0x48d8('0x6'));var fs=require('fs');var path=require(_0x48d8('0x7'));var rimraf=require(_0x48d8('0x8'));var config=require(_0x48d8('0x9'));var attributes=require(_0x48d8('0xa'));module[_0x48d8('0xb')]=function(_0x46cd76,_0x248654){return _0x46cd76['define']('SmsApplication',attributes,{'tableName':_0x48d8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x48d8('0xd'),'collate':_0x48d8('0xe')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index ad63cfd..b7e2e45 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 _0x5713=['../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','SmsApplication,\x20%s,\x20%s','message','result','lodash','util','bluebird','ioredis','../../mysqldb'];(function(_0x9abce3,_0x462518){var _0x15c3a8=function(_0x4ed5d1){while(--_0x4ed5d1){_0x9abce3['push'](_0x9abce3['shift']());}};_0x15c3a8(++_0x462518);}(_0x5713,0x1c7));var _0x3571=function(_0x493cd8,_0x2ce060){_0x493cd8=_0x493cd8-0x0;var _0xef3a37=_0x5713[_0x493cd8];return _0xef3a37;};'use strict';var _=require(_0x3571('0x0'));var util=require(_0x3571('0x1'));var moment=require('moment');var BPromise=require(_0x3571('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3571('0x3'));var db=require(_0x3571('0x4'))['db'];var utils=require(_0x3571('0x5'));var logger=require(_0x3571('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x3571('0x7'));var client=jayson[_0x3571('0x8')][_0x3571('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x432a48,_0x3a6f29,_0x1f8f0f){return new BPromise(function(_0x48b06d,_0x358ba1){return client[_0x3571('0xa')](_0x432a48,_0x1f8f0f)[_0x3571('0xb')](function(_0x288fc8){logger[_0x3571('0xc')]('SmsApplication,\x20%s,\x20%s',_0x3a6f29,'request\x20sent');logger[_0x3571('0xd')](_0x3571('0xe'),_0x3a6f29,_0x3571('0xf'),JSON['stringify'](_0x288fc8));if(_0x288fc8['error']){if(_0x288fc8['error']['code']===0x1f4){logger[_0x3571('0x10')](_0x3571('0x11'),_0x3a6f29,_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);return _0x358ba1(_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);}logger[_0x3571('0x10')](_0x3571('0x11'),_0x3a6f29,_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);return _0x48b06d(_0x288fc8[_0x3571('0x10')][_0x3571('0x12')]);}else{logger[_0x3571('0xc')](_0x3571('0x11'),_0x3a6f29,_0x3571('0xf'));_0x48b06d(_0x288fc8[_0x3571('0x13')]['message']);}})['catch'](function(_0x48c77e){logger[_0x3571('0x10')]('SmsApplication,\x20%s,\x20%s',_0x3a6f29,_0x48c77e);_0x358ba1(_0x48c77e);});});} \ No newline at end of file +var _0x9264=['bluebird','../../mysqldb','rpc','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x9264,0xb1));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4926('0x0'));var util=require(_0x4926('0x1'));var moment=require(_0x4926('0x2'));var BPromise=require(_0x4926('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4926('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4926('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4926('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1dbcbe,_0x57c13c,_0x1299c8){return new BPromise(function(_0x2f5445,_0x4da9b6){return client[_0x4926('0x7')](_0x1dbcbe,_0x1299c8)[_0x4926('0x8')](function(_0x2a5ce3){logger['info'](_0x4926('0x9'),_0x57c13c,_0x4926('0xa'));logger[_0x4926('0xb')]('SmsApplication,\x20%s,\x20%s,\x20%s',_0x57c13c,_0x4926('0xa'),JSON['stringify'](_0x2a5ce3));if(_0x2a5ce3['error']){if(_0x2a5ce3[_0x4926('0xc')][_0x4926('0xd')]===0x1f4){logger[_0x4926('0xc')]('SmsApplication,\x20%s,\x20%s',_0x57c13c,_0x2a5ce3[_0x4926('0xc')][_0x4926('0xe')]);return _0x4da9b6(_0x2a5ce3[_0x4926('0xc')][_0x4926('0xe')]);}logger[_0x4926('0xc')](_0x4926('0x9'),_0x57c13c,_0x2a5ce3[_0x4926('0xc')][_0x4926('0xe')]);return _0x2f5445(_0x2a5ce3[_0x4926('0xc')][_0x4926('0xe')]);}else{logger[_0x4926('0xf')](_0x4926('0x9'),_0x57c13c,_0x4926('0xa'));_0x2f5445(_0x2a5ce3[_0x4926('0x10')]['message']);}})[_0x4926('0x11')](function(_0x258914){logger[_0x4926('0xc')]('SmsApplication,\x20%s,\x20%s',_0x57c13c,_0x258914);_0x4da9b6(_0x258914);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 93e28a2..ed82ee3 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(_0x18177d,_0x181fb2){_0x18177d=_0x18177d-0x0;var _0x2d37fb=_0x757a[_0x18177d];return _0x2d37fb;};'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 _0xe511=['addTags','put','update','smsinteraction:destroy','destroy','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','describe','show','/:id/messages','isAuthenticated','getMessages','download','post','create','addMessage','/:id/tags','tracked','sms','smsinteraction:addtags'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0xe511,0x16f));var _0x1e51=function(_0x28c766,_0x3d710c){_0x28c766=_0x28c766-0x0;var _0x164c34=_0xe511[_0x28c766];return _0x164c34;};'use strict';var multer=require(_0x1e51('0x0'));var util=require(_0x1e51('0x1'));var path=require('path');var timeout=require(_0x1e51('0x2'));var express=require('express');var router=express[_0x1e51('0x3')]();var fs_extra=require(_0x1e51('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x1e51('0x5'));var config=require(_0x1e51('0x6'));var controller=require(_0x1e51('0x7'));router[_0x1e51('0x8')]('/',auth['isAuthenticated'](),controller[_0x1e51('0x9')]);router[_0x1e51('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x1e51('0xa')]);router[_0x1e51('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x1e51('0xb')]);router[_0x1e51('0x8')](_0x1e51('0xc'),auth[_0x1e51('0xd')](),controller[_0x1e51('0xe')]);router[_0x1e51('0x8')]('/:id/download',auth[_0x1e51('0xd')](),controller[_0x1e51('0xf')]);router[_0x1e51('0x10')]('/',auth[_0x1e51('0xd')](),controller[_0x1e51('0x11')]);router[_0x1e51('0x10')]('/:id/messages',auth[_0x1e51('0xd')](),controller[_0x1e51('0x12')]);router[_0x1e51('0x10')](_0x1e51('0x13'),auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x16')),controller[_0x1e51('0x17')]);router[_0x1e51('0x18')]('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),'smsinteraction:update'),controller[_0x1e51('0x19')]);router['delete']('/:id',auth[_0x1e51('0xd')](),interaction[_0x1e51('0x14')](_0x1e51('0x15'),_0x1e51('0x1a')),controller[_0x1e51('0x1b')]);router[_0x1e51('0x1c')]('/:id/tags',auth[_0x1e51('0xd')](),controller['removeTags']);module[_0x1e51('0x1d')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index b57dcf5..fb9dd37 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 _0x4808=['sequelize','moment','exports','DATE','STRING','ENUM','out','INTEGER'];(function(_0x53bf1d,_0xe9dfe5){var _0xd69967=function(_0x336ca9){while(--_0x336ca9){_0x53bf1d['push'](_0x53bf1d['shift']());}};_0xd69967(++_0xe9dfe5);}(_0x4808,0x160));var _0x8480=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x4808[_0x24061a];return _0x82054e;};'use strict';var Sequelize=require(_0x8480('0x0'));var moment=require(_0x8480('0x1'));module[_0x8480('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x8480('0x3')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x8480('0x4')]},'thirdDisposition':{'type':Sequelize[_0x8480('0x4')]},'note':{'type':Sequelize[_0x8480('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x8480('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x8480('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x8480('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x8480('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0x8480('0x7')]}}; \ No newline at end of file +var _0x1c52=['STRING','DATE','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x3a818a,_0x5d39ed){var _0xa1b136=function(_0x506dd5){while(--_0x506dd5){_0x3a818a['push'](_0x3a818a['shift']());}};_0xa1b136(++_0x5d39ed);}(_0x1c52,0x7c));var _0x21c5=function(_0x13bb8e,_0x332fd8){_0x13bb8e=_0x13bb8e-0x0;var _0x44f0f6=_0x1c52[_0x13bb8e];return _0x44f0f6;};'use strict';var Sequelize=require(_0x21c5('0x0'));var moment=require(_0x21c5('0x1'));module[_0x21c5('0x2')]={'closed':{'type':Sequelize[_0x21c5('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x21c5('0x4')]},'note':{'type':Sequelize[_0x21c5('0x4')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0x21c5('0x5')]},'firstMsgDirection':{'type':Sequelize[_0x21c5('0x6')]('in',_0x21c5('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x21c5('0x5')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x21c5('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x21c5('0x3')],'defaultValue':![]},'queueId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index e48bdf9..3529709 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 _0x718e=['read','SmsAccount','Account','get','Sms','Owner','N.A.','format','closed','disposition','out','System','value','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','unlinkSync','sendStatus','rimraf','zip-dir','moment','bluebird','util','lodash','../../components/export/pdf','../../config/logger','../../config/environment','../../mysqldb','defaults','socket.io-emitter','./smsInteraction.socket','status','json','offset','limit','undefined','count','set','Content-Range','update','destroy','then','end','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','findAll','sms','query','user','catch','params','model','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','create','body','describe','addMessage','SmsMessage','ids','omit','getMessages','findOne','nolimit','order','sort','where','pick','SmsInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','addTags','setTags','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','toString','root','server','files','tmp','transcript-%d-%s.zip','join','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','direction','secret'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x718e,0x1eb));var _0xe718=function(_0x56f3d4,_0xfc65dd){_0x56f3d4=_0x56f3d4-0x0;var _0x2c7ef0=_0x718e[_0x56f3d4];return _0x2c7ef0;};'use strict';var rimraf=require(_0xe718('0x0'));var zipdir=require(_0xe718('0x1'));var moment=require(_0xe718('0x2'));var BPromise=require(_0xe718('0x3'));var util=require(_0xe718('0x4'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var _=require(_0xe718('0x5'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require('../../components/parsers/qs');var pdf=require(_0xe718('0x6'));var logger=require(_0xe718('0x7'))('api');var config=require(_0xe718('0x8'));var db=require(_0xe718('0x9'))['db'];config['redis']=_[_0xe718('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe718('0xb'))(new Redis(config['redis']));require(_0xe718('0xc'))['register'](socket);function respondWithStatusCode(_0x444ec8,_0x27e045){_0x27e045=_0x27e045||0xcc;return function(_0x403070){if(_0x403070){return _0x444ec8['sendStatus'](_0x27e045);}return _0x444ec8['status'](_0x27e045)['end']();};}function respondWithResult(_0x1ee88d,_0x1f4b0d){_0x1f4b0d=_0x1f4b0d||0xc8;return function(_0x523e7f){if(_0x523e7f){return _0x1ee88d[_0xe718('0xd')](_0x1f4b0d)[_0xe718('0xe')](_0x523e7f);}};}function respondWithFilteredResult(_0x250f4b,_0x2c05f8){return function(_0x1c0a51){if(_0x1c0a51){var _0x2199c9=typeof _0x2c05f8[_0xe718('0xf')]==='undefined'&&typeof _0x2c05f8[_0xe718('0x10')]===_0xe718('0x11');var _0x39c173=_0x1c0a51[_0xe718('0x12')];var _0x23a32c=_0x2199c9?0x0:_0x2c05f8[_0xe718('0xf')];var _0x968c83=_0x2199c9?_0x1c0a51[_0xe718('0x12')]:_0x2c05f8[_0xe718('0xf')]+_0x2c05f8[_0xe718('0x10')];var _0x52c07b;if(_0x968c83>=_0x39c173){_0x968c83=_0x39c173;_0x52c07b=0xc8;}else{_0x52c07b=0xce;}_0x250f4b['status'](_0x52c07b);return _0x250f4b[_0xe718('0x13')](_0xe718('0x14'),_0x23a32c+'-'+_0x968c83+'/'+_0x39c173)[_0xe718('0xe')](_0x1c0a51);}return null;};}function saveUpdates(_0x1dd3e7){return function(_0x29ccc1){if(_0x29ccc1){return _0x29ccc1[_0xe718('0x15')](_0x1dd3e7)['then'](function(_0x324aa5){return _0x324aa5;});}return null;};}function removeEntity(_0x4d4b85){return function(_0x4ad937){if(_0x4ad937){return _0x4ad937[_0xe718('0x16')]()[_0xe718('0x17')](function(){_0x4d4b85[_0xe718('0xd')](0xcc)[_0xe718('0x18')]();});}};}function handleEntityNotFound(_0x4b593e){return function(_0x57c0f0){if(!_0x57c0f0){_0x4b593e['sendStatus'](0x194);}return _0x57c0f0;};}function handleError(_0xe83ea5,_0x2c108b){_0x2c108b=_0x2c108b||0x1f4;return function(_0x3e78f6){logger[_0xe718('0x19')](_0x3e78f6[_0xe718('0x1a')]);if(_0x3e78f6[_0xe718('0x1b')]){delete _0x3e78f6[_0xe718('0x1b')];}_0xe83ea5['status'](_0x2c108b)[_0xe718('0x1c')](_0x3e78f6);};}exports[_0xe718('0x1d')]=function(_0x49f421,_0x4ea06d){var _0x12de17={};var _0x2e7ca6=_[_0xe718('0x1e')](db[_0xe718('0x1f')][_0xe718('0x20')],function(_0x5ace4f){return{'name':_0x5ace4f[_0xe718('0x21')],'type':_0x5ace4f[_0xe718('0x22')]['key']};});_0x12de17=qs['getOptions'](_0x2e7ca6,_0x49f421);return interaction[_0xe718('0x23')](_0xe718('0x24'),_0x49f421[_0xe718('0x25')],_0x49f421[_0xe718('0x26')],_0x12de17,_0x2e7ca6)[_0xe718('0x17')](respondWithFilteredResult(_0x4ea06d,_0x12de17))[_0xe718('0x27')](handleError(_0x4ea06d,null));};exports['show']=function(_0x5c6d42,_0xa56023){var _0x4713bc={'raw':![],'where':{'id':_0x5c6d42[_0xe718('0x28')]['id']}},_0x2e4fc9={};_0x2e4fc9[_0xe718('0x29')]=_[_0xe718('0x2a')](db['SmsInteraction']['rawAttributes']);_0x2e4fc9[_0xe718('0x25')]=_['keys'](_0x5c6d42[_0xe718('0x25')]);_0x2e4fc9[_0xe718('0x2b')]=_[_0xe718('0x2c')](_0x2e4fc9['model'],_0x2e4fc9[_0xe718('0x25')]);_0x4713bc[_0xe718('0x2d')]=_[_0xe718('0x2c')](_0x2e4fc9[_0xe718('0x29')],qs['fields'](_0x5c6d42[_0xe718('0x25')][_0xe718('0x2e')]));_0x4713bc['attributes']=_0x4713bc['attributes']['length']?_0x4713bc['attributes']:_0x2e4fc9[_0xe718('0x29')];if(_0x5c6d42['query'][_0xe718('0x2f')]){_0x4713bc[_0xe718('0x30')]=[{'all':!![]}];}_0x4713bc=_[_0xe718('0x31')]({},_0x4713bc,_0x5c6d42[_0xe718('0x32')]);return db[_0xe718('0x1f')][_0xe718('0x33')](_0x4713bc)[_0xe718('0x17')](handleEntityNotFound(_0xa56023,null))[_0xe718('0x17')](respondWithResult(_0xa56023,null))[_0xe718('0x27')](handleError(_0xa56023,null));};exports[_0xe718('0x34')]=function(_0x3b3c9e,_0x3191d0){return db[_0xe718('0x1f')][_0xe718('0x34')](_0x3b3c9e['body'],{})['then'](respondWithResult(_0x3191d0,0xc9))[_0xe718('0x27')](handleError(_0x3191d0,null));};exports[_0xe718('0x15')]=function(_0x40207f,_0x6329af){if(_0x40207f[_0xe718('0x35')]['id']){delete _0x40207f[_0xe718('0x35')]['id'];}return db['SmsInteraction']['find']({'where':{'id':_0x40207f[_0xe718('0x28')]['id']}})[_0xe718('0x17')](handleEntityNotFound(_0x6329af,null))[_0xe718('0x17')](saveUpdates(_0x40207f[_0xe718('0x35')],null))[_0xe718('0x17')](respondWithResult(_0x6329af,null))[_0xe718('0x27')](handleError(_0x6329af,null));};exports[_0xe718('0x16')]=function(_0x1ea855,_0x3a179b){return db[_0xe718('0x1f')][_0xe718('0x33')]({'where':{'id':_0x1ea855[_0xe718('0x28')]['id']}})[_0xe718('0x17')](handleEntityNotFound(_0x3a179b,null))['then'](removeEntity(_0x3a179b,null))[_0xe718('0x27')](handleError(_0x3a179b,null));};exports[_0xe718('0x36')]=function(_0x135df4,_0x58c359){return db[_0xe718('0x1f')]['describe']()[_0xe718('0x17')](respondWithResult(_0x58c359,null))[_0xe718('0x27')](handleError(_0x58c359,null));};exports[_0xe718('0x37')]=function(_0x1d6bf9,_0x47ebf0){return db[_0xe718('0x38')][_0xe718('0x33')]({'where':{'id':_0x1d6bf9['params']['id']}})['then'](handleEntityNotFound(_0x47ebf0,null))[_0xe718('0x17')](function(_0x2edd21){if(_0x2edd21){return _0x2edd21[_0xe718('0x37')](_0x1d6bf9[_0xe718('0x35')][_0xe718('0x39')],_[_0xe718('0x3a')](_0x1d6bf9[_0xe718('0x35')],[_0xe718('0x39'),'id'])||{});}})[_0xe718('0x17')](respondWithResult(_0x47ebf0,null))[_0xe718('0x27')](handleError(_0x47ebf0,null));};exports[_0xe718('0x3b')]=function(_0x403672,_0x120b19){var _0x1ff00d={'raw':![],'where':{}};var _0x40b731={};var _0x57ed2c={'count':0x0,'rows':[]};return db[_0xe718('0x1f')][_0xe718('0x3c')]({'where':{'id':_0x403672['params']['id']}})[_0xe718('0x17')](handleEntityNotFound(_0x120b19,null))[_0xe718('0x17')](function(_0x40cb09){if(_0x40cb09){_0x40b731[_0xe718('0x29')]=_[_0xe718('0x2a')](db['SmsMessage'][_0xe718('0x20')]);_0x40b731[_0xe718('0x25')]=_[_0xe718('0x2a')](_0x403672[_0xe718('0x25')]);_0x40b731[_0xe718('0x2b')]=_['intersection'](_0x40b731[_0xe718('0x29')],_0x40b731['query']);_0x1ff00d[_0xe718('0x2d')]=_[_0xe718('0x2c')](_0x40b731[_0xe718('0x29')],qs[_0xe718('0x2e')](_0x403672[_0xe718('0x25')][_0xe718('0x2e')]));_0x1ff00d[_0xe718('0x2d')]=_0x1ff00d['attributes']['length']?_0x1ff00d[_0xe718('0x2d')]:_0x40b731[_0xe718('0x29')];if(!_0x403672['query']['hasOwnProperty'](_0xe718('0x3d'))){_0x1ff00d[_0xe718('0x10')]=qs[_0xe718('0x10')](_0x403672['query'][_0xe718('0x10')]);_0x1ff00d[_0xe718('0xf')]=qs[_0xe718('0xf')](_0x403672[_0xe718('0x25')][_0xe718('0xf')]);}_0x1ff00d[_0xe718('0x3e')]=qs[_0xe718('0x3f')](_0x403672[_0xe718('0x25')][_0xe718('0x3f')]);_0x1ff00d[_0xe718('0x40')]=qs[_0xe718('0x2b')](_[_0xe718('0x41')](_0x403672[_0xe718('0x25')],_0x40b731[_0xe718('0x2b')]));_0x1ff00d[_0xe718('0x40')][_0xe718('0x42')]=_0x40cb09['id'];if(_0x403672[_0xe718('0x25')][_0xe718('0x43')]){_0x1ff00d[_0xe718('0x40')]=_[_0xe718('0x31')](_0x1ff00d['where'],{'$or':_[_0xe718('0x1e')](_0x1ff00d[_0xe718('0x2d')],function(_0x3e3ab5){var _0x129ae0={};_0x129ae0[_0x3e3ab5]={'$like':'%'+_0x403672['query'][_0xe718('0x43')]+'%'};return _0x129ae0;})});}if(_0x403672[_0xe718('0x25')][_0xe718('0x44')]){var _0x4338d8=_0x403672[_0xe718('0x25')][_0xe718('0x44')][_0xe718('0x45')](',');var _0x32fb0e={};_0x32fb0e[_0x4338d8[0x0]]={'$gte':moment(_0x4338d8[0x1])['format'](_0xe718('0x46'))};_0x1ff00d[_0xe718('0x40')]=_[_0xe718('0x31')](_0x1ff00d[_0xe718('0x40')],_0x32fb0e);}_0x1ff00d=_[_0xe718('0x31')]({},_0x1ff00d,_0x403672['options']);return db[_0xe718('0x38')][_0xe718('0x12')]({'where':_0x1ff00d[_0xe718('0x40')]})[_0xe718('0x17')](function(_0x210aa4){_0x57ed2c['count']=_0x210aa4;if(_0x403672[_0xe718('0x25')][_0xe718('0x2f')]){_0x1ff00d['include']=[{'all':!![]}];}return db[_0xe718('0x38')][_0xe718('0x23')](_0x1ff00d);})[_0xe718('0x17')](function(_0x3d4d7e){_0x57ed2c[_0xe718('0x47')]=_0x3d4d7e;return _0x57ed2c;});}})[_0xe718('0x17')](respondWithFilteredResult(_0x120b19,_0x1ff00d))[_0xe718('0x27')](handleError(_0x120b19,null));};exports[_0xe718('0x48')]=function(_0x1e89fa,_0x2b56d1){return db['SmsInteraction'][_0xe718('0x33')]({'where':{'id':_0x1e89fa[_0xe718('0x28')]['id']}})[_0xe718('0x17')](handleEntityNotFound(_0x2b56d1,null))['then'](function(_0x8b1f77){if(_0x8b1f77){return _0x8b1f77[_0xe718('0x49')](_0x1e89fa[_0xe718('0x35')][_0xe718('0x39')],_[_0xe718('0x3a')](_0x1e89fa[_0xe718('0x35')],['ids','id'])||{})['spread'](function(){return db[_0xe718('0x4a')]['findAll']({'attributes':['id',_0xe718('0x1b'),_0xe718('0x4b')],'where':{'id':_0x1e89fa[_0xe718('0x35')][_0xe718('0x39')]}});})['then'](function(_0x19d6a6){socket[_0xe718('0x4c')](_0xe718('0x4d'),{'id':Number(_0x1e89fa['params']['id']),'tags':_0x19d6a6||[]});return{'id':Number(_0x1e89fa[_0xe718('0x28')]['id']),'tags':_0x19d6a6||[]};});}})['then'](respondWithResult(_0x2b56d1,null))['catch'](handleError(_0x2b56d1,null));};exports[_0xe718('0x4e')]=function(_0x956ef5,_0x5bfad7){return db['SmsInteraction'][_0xe718('0x33')]({'where':{'id':_0x956ef5[_0xe718('0x28')]['id']}})[_0xe718('0x17')](handleEntityNotFound(_0x5bfad7,null))[_0xe718('0x17')](function(_0x704db5){if(_0x704db5){return _0x704db5[_0xe718('0x4e')](_0x956ef5[_0xe718('0x25')][_0xe718('0x39')]);}})[_0xe718('0x17')](respondWithStatusCode(_0x5bfad7,null))[_0xe718('0x27')](handleError(_0x5bfad7,null));};exports[_0xe718('0x4f')]=function(_0x106ade,_0x1c56e8){var _0x496310=moment()[_0xe718('0x50')]()[_0xe718('0x51')]();var _0x34bb2c=path['join'](config[_0xe718('0x52')],_0xe718('0x53'),_0xe718('0x54'),_0xe718('0x55'));var _0x103d95=path['join'](_0x34bb2c,_0x496310);var _0xf3ad9f=util['format'](_0xe718('0x56'),_0x106ade[_0xe718('0x28')]['id'],_0x496310);var _0x457890=path[_0xe718('0x57')](_0x34bb2c,_0xf3ad9f);var _0x49c9e9=[];_0x49c9e9[_0xe718('0x58')]({'model':db[_0xe718('0x59')],'as':_0xe718('0x59'),'attributes':['id',_0xe718('0x5a')],'raw':!![]});_0x49c9e9[_0xe718('0x58')]({'model':db[_0xe718('0x5b')],'as':_0xe718('0x5c'),'attributes':['id',_0xe718('0x5d'),_0xe718('0x5e')],'raw':!![]});var _0x4d0894=[{'model':db[_0xe718('0x38')],'as':_0xe718('0x5f'),'attributes':['id','body',_0xe718('0x60'),_0xe718('0x61'),_0xe718('0x62'),_0xe718('0x63')],'include':_0x49c9e9}];_0x4d0894[_0xe718('0x58')]({'model':db[_0xe718('0x64')],'as':_0xe718('0x65'),'attributes':['id',_0xe718('0x1b')]});_0x4d0894['push']({'model':db[_0xe718('0x59')],'as':'Owner','attributes':['id',_0xe718('0x5a')]});return db[_0xe718('0x1f')][_0xe718('0x33')]({'where':{'id':_0x106ade['params']['id']},'include':_0x4d0894})[_0xe718('0x17')](handleEntityNotFound(_0x1c56e8,null))[_0xe718('0x17')](function(_0x421571){if(_0x421571){var _0x38582d=_0x421571[_0xe718('0x66')]({'plain':!![]});fs['mkdirSync'](_0x103d95);var _0x5dbd0a={'channel':_0xe718('0x67'),'account':_0x38582d[_0xe718('0x65')][_0xe718('0x1b')],'agent':_0x38582d[_0xe718('0x68')]?_0x38582d[_0xe718('0x68')][_0xe718('0x5a')]:_0xe718('0x69'),'createdAt':moment(_0x38582d[_0xe718('0x60')])[_0xe718('0x6a')](_0xe718('0x46'))[_0xe718('0x51')](),'closedAt':_0x38582d[_0xe718('0x6b')]?moment(_0x38582d['closedAt'])[_0xe718('0x6a')](_0xe718('0x46'))[_0xe718('0x51')]():'','disposition':_0x38582d[_0xe718('0x6c')],'messages':_(_0x38582d[_0xe718('0x5f')])[_0xe718('0x43')]({'secret':![]})[_0xe718('0x1e')](function(_0x5384ce){return{'date':moment(_0x5384ce['createdAt'])[_0xe718('0x6a')](_0xe718('0x46'))[_0xe718('0x51')](),'sender':_0x5384ce[_0xe718('0x61')]===_0xe718('0x6d')?_0x5384ce[_0xe718('0x59')]?_0x5384ce[_0xe718('0x59')][_0xe718('0x5a')]:_0xe718('0x6e'):_0x5384ce['Contact']['firstName']+(_0x5384ce[_0xe718('0x5c')][_0xe718('0x5e')]?'\x20'+_0x5384ce[_0xe718('0x5c')][_0xe718('0x5e')]:''),'body':_0x5384ce[_0xe718('0x35')],'direction':_0x5384ce[_0xe718('0x61')]===_0xe718('0x6d')?'A':'C','secret':_0x5384ce[_0xe718('0x62')],'read':_0x5384ce[_0xe718('0x63')]};})[_0xe718('0x6f')]()};return ejs['renderFile'](path[_0xe718('0x57')](config[_0xe718('0x52')],_0xe718('0x53'),_0xe718('0x70'),_0xe718('0x71')),{'interaction':_0x5dbd0a})[_0xe718('0x17')](function(_0x2a2629){var _0x4d5dfa=path[_0xe718('0x57')](_0x103d95,'transcript-'+_0x38582d['id']+'-'+_0x496310+_0xe718('0x72'));var _0x1f8e08={'path':_0x4d5dfa,'channel':'Sms','interactionId':_0x38582d['id']};return pdf[_0xe718('0x73')](_0x2a2629,_0x1f8e08);})[_0xe718('0x17')](function(){return new BPromise(function(_0x46412d,_0x2e78eb){zipdir(_0x103d95,{'saveTo':_0x457890},function(_0x344836,_0x2b9d3d){if(_0x344836)return _0x2e78eb(_0x344836);return _0x46412d(_0x2b9d3d);});})[_0xe718('0x17')](function(){return new BPromise(function(_0x582d64,_0xddf87e){rimraf(_0x103d95,function(_0x281feb){if(_0x281feb)_0xddf87e(_0x281feb);return _0x582d64();});});})[_0xe718('0x17')](function(){return _0x1c56e8[_0xe718('0x4f')](_0x457890,_0xf3ad9f,function(_0x3b6794){if(_0x3b6794){console['log']('err',_0x3b6794);}else{fs[_0xe718('0x74')](_0x457890);}});});});}else{return _0x1c56e8[_0xe718('0x75')](0xc8);}})[_0xe718('0x27')](handleError(_0x1c56e8,null));}; \ No newline at end of file +var _0xabf1=['format','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Messages','createdAt','secret','read','SmsAccount','Account','Owner','get','mkdirSync','Sms','N.A.','toString','closedAt','disposition','direction','out','System','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','moment','bluebird','path','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','limit','count','set','Content-Range','update','then','stack','name','index','map','SmsInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','sms','query','catch','show','params','model','keys','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','find','destroy','describe','addMessage','SmsMessage','omit','ids','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','SmsInteractionId','filter','$gte','YYYY-MM-DD\x20HH:mm:ss','include','rows','addTags','setTags','spread','Tag','color','emit','smsInteractionTags:save','removeTags','download','unix','join','server','files','tmp'];(function(_0x395af7,_0x32901c){var _0x3d15cb=function(_0x2e373a){while(--_0x2e373a){_0x395af7['push'](_0x395af7['shift']());}};_0x3d15cb(++_0x32901c);}(_0xabf1,0xa0));var _0x1abf=function(_0x52cbf8,_0x15934f){_0x52cbf8=_0x52cbf8-0x0;var _0x5a38af=_0xabf1[_0x52cbf8];return _0x5a38af;};'use strict';var rimraf=require(_0x1abf('0x0'));var zipdir=require(_0x1abf('0x1'));var moment=require(_0x1abf('0x2'));var BPromise=require(_0x1abf('0x3'));var util=require('util');var path=require(_0x1abf('0x4'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x1abf('0x5'));var interaction=require(_0x1abf('0x6'));var qs=require(_0x1abf('0x7'));var pdf=require(_0x1abf('0x8'));var logger=require('../../config/logger')(_0x1abf('0x9'));var config=require(_0x1abf('0xa'));var db=require(_0x1abf('0xb'))['db'];config['redis']=_[_0x1abf('0xc')](config[_0x1abf('0xd')],{'host':_0x1abf('0xe'),'port':0x18eb});var socket=require(_0x1abf('0xf'))(new Redis(config[_0x1abf('0xd')]));require('./smsInteraction.socket')[_0x1abf('0x10')](socket);function respondWithStatusCode(_0x2d4226,_0x4dbe02){_0x4dbe02=_0x4dbe02||0xcc;return function(_0x96a2c8){if(_0x96a2c8){return _0x2d4226[_0x1abf('0x11')](_0x4dbe02);}return _0x2d4226[_0x1abf('0x12')](_0x4dbe02)[_0x1abf('0x13')]();};}function respondWithResult(_0x361f6d,_0x10aa26){_0x10aa26=_0x10aa26||0xc8;return function(_0x393f05){if(_0x393f05){return _0x361f6d[_0x1abf('0x12')](_0x10aa26)[_0x1abf('0x14')](_0x393f05);}};}function respondWithFilteredResult(_0x28ea33,_0x43e561){return function(_0x2cc1b6){if(_0x2cc1b6){var _0x7978a9=typeof _0x43e561[_0x1abf('0x15')]==='undefined'&&typeof _0x43e561[_0x1abf('0x16')]==='undefined';var _0x1efef5=_0x2cc1b6[_0x1abf('0x17')];var _0x11fb2d=_0x7978a9?0x0:_0x43e561[_0x1abf('0x15')];var _0xb1c766=_0x7978a9?_0x2cc1b6[_0x1abf('0x17')]:_0x43e561[_0x1abf('0x15')]+_0x43e561[_0x1abf('0x16')];var _0x3b093c;if(_0xb1c766>=_0x1efef5){_0xb1c766=_0x1efef5;_0x3b093c=0xc8;}else{_0x3b093c=0xce;}_0x28ea33[_0x1abf('0x12')](_0x3b093c);return _0x28ea33[_0x1abf('0x18')](_0x1abf('0x19'),_0x11fb2d+'-'+_0xb1c766+'/'+_0x1efef5)[_0x1abf('0x14')](_0x2cc1b6);}return null;};}function saveUpdates(_0x29b3c6){return function(_0x484a0e){if(_0x484a0e){return _0x484a0e[_0x1abf('0x1a')](_0x29b3c6)[_0x1abf('0x1b')](function(_0x33dc96){return _0x33dc96;});}return null;};}function removeEntity(_0x4b1eb1){return function(_0x5b26be){if(_0x5b26be){return _0x5b26be['destroy']()[_0x1abf('0x1b')](function(){_0x4b1eb1[_0x1abf('0x12')](0xcc)[_0x1abf('0x13')]();});}};}function handleEntityNotFound(_0x489b94){return function(_0x55fe5d){if(!_0x55fe5d){_0x489b94[_0x1abf('0x11')](0x194);}return _0x55fe5d;};}function handleError(_0x3dc17a,_0x8b621f){_0x8b621f=_0x8b621f||0x1f4;return function(_0x3344c9){logger['error'](_0x3344c9[_0x1abf('0x1c')]);if(_0x3344c9[_0x1abf('0x1d')]){delete _0x3344c9[_0x1abf('0x1d')];}_0x3dc17a[_0x1abf('0x12')](_0x8b621f)['send'](_0x3344c9);};}exports[_0x1abf('0x1e')]=function(_0x7e6939,_0x31a752){var _0x1cacc6={};var _0x15202a=_[_0x1abf('0x1f')](db[_0x1abf('0x20')][_0x1abf('0x21')],function(_0x5bbc04){return{'name':_0x5bbc04[_0x1abf('0x22')],'type':_0x5bbc04[_0x1abf('0x23')][_0x1abf('0x24')]};});_0x1cacc6=qs[_0x1abf('0x25')](_0x15202a,_0x7e6939);return interaction[_0x1abf('0x26')](_0x1abf('0x27'),_0x7e6939[_0x1abf('0x28')],_0x7e6939['user'],_0x1cacc6,_0x15202a)[_0x1abf('0x1b')](respondWithFilteredResult(_0x31a752,_0x1cacc6))[_0x1abf('0x29')](handleError(_0x31a752,null));};exports[_0x1abf('0x2a')]=function(_0x9031b0,_0x26f7b3){var _0x1f4fc7={'raw':![],'where':{'id':_0x9031b0[_0x1abf('0x2b')]['id']}},_0x8cdb50={};_0x8cdb50[_0x1abf('0x2c')]=_['keys'](db[_0x1abf('0x20')][_0x1abf('0x21')]);_0x8cdb50[_0x1abf('0x28')]=_[_0x1abf('0x2d')](_0x9031b0[_0x1abf('0x28')]);_0x8cdb50[_0x1abf('0x2e')]=_[_0x1abf('0x2f')](_0x8cdb50[_0x1abf('0x2c')],_0x8cdb50[_0x1abf('0x28')]);_0x1f4fc7[_0x1abf('0x30')]=_[_0x1abf('0x2f')](_0x8cdb50[_0x1abf('0x2c')],qs[_0x1abf('0x31')](_0x9031b0[_0x1abf('0x28')][_0x1abf('0x31')]));_0x1f4fc7['attributes']=_0x1f4fc7[_0x1abf('0x30')][_0x1abf('0x32')]?_0x1f4fc7[_0x1abf('0x30')]:_0x8cdb50[_0x1abf('0x2c')];if(_0x9031b0[_0x1abf('0x28')][_0x1abf('0x33')]){_0x1f4fc7['include']=[{'all':!![]}];}_0x1f4fc7=_[_0x1abf('0x34')]({},_0x1f4fc7,_0x9031b0[_0x1abf('0x35')]);return db[_0x1abf('0x20')]['find'](_0x1f4fc7)[_0x1abf('0x1b')](handleEntityNotFound(_0x26f7b3,null))[_0x1abf('0x1b')](respondWithResult(_0x26f7b3,null))['catch'](handleError(_0x26f7b3,null));};exports['create']=function(_0x3d871e,_0x1d7b25){return db[_0x1abf('0x20')][_0x1abf('0x36')](_0x3d871e[_0x1abf('0x37')],{})['then'](respondWithResult(_0x1d7b25,0xc9))[_0x1abf('0x29')](handleError(_0x1d7b25,null));};exports[_0x1abf('0x1a')]=function(_0x461fe4,_0x55a97a){if(_0x461fe4[_0x1abf('0x37')]['id']){delete _0x461fe4[_0x1abf('0x37')]['id'];}return db[_0x1abf('0x20')][_0x1abf('0x38')]({'where':{'id':_0x461fe4[_0x1abf('0x2b')]['id']}})[_0x1abf('0x1b')](handleEntityNotFound(_0x55a97a,null))['then'](saveUpdates(_0x461fe4[_0x1abf('0x37')],null))['then'](respondWithResult(_0x55a97a,null))[_0x1abf('0x29')](handleError(_0x55a97a,null));};exports[_0x1abf('0x39')]=function(_0x1bc04a,_0x48f8dc){return db[_0x1abf('0x20')][_0x1abf('0x38')]({'where':{'id':_0x1bc04a[_0x1abf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x48f8dc,null))['then'](removeEntity(_0x48f8dc,null))[_0x1abf('0x29')](handleError(_0x48f8dc,null));};exports[_0x1abf('0x3a')]=function(_0x119955,_0x29a8f3){return db['SmsInteraction'][_0x1abf('0x3a')]()[_0x1abf('0x1b')](respondWithResult(_0x29a8f3,null))[_0x1abf('0x29')](handleError(_0x29a8f3,null));};exports[_0x1abf('0x3b')]=function(_0x23c459,_0x3d4e89){return db[_0x1abf('0x3c')][_0x1abf('0x38')]({'where':{'id':_0x23c459[_0x1abf('0x2b')]['id']}})[_0x1abf('0x1b')](handleEntityNotFound(_0x3d4e89,null))[_0x1abf('0x1b')](function(_0x35d86f){if(_0x35d86f){return _0x35d86f['addMessage'](_0x23c459[_0x1abf('0x37')]['ids'],_[_0x1abf('0x3d')](_0x23c459[_0x1abf('0x37')],[_0x1abf('0x3e'),'id'])||{});}})[_0x1abf('0x1b')](respondWithResult(_0x3d4e89,null))['catch'](handleError(_0x3d4e89,null));};exports[_0x1abf('0x3f')]=function(_0x45c8c2,_0x3ca230){var _0xf914c7={'raw':![],'where':{}};var _0x1b0ac4={};var _0x29b4c1={'count':0x0,'rows':[]};return db[_0x1abf('0x20')][_0x1abf('0x40')]({'where':{'id':_0x45c8c2['params']['id']}})[_0x1abf('0x1b')](handleEntityNotFound(_0x3ca230,null))[_0x1abf('0x1b')](function(_0x36b593){if(_0x36b593){_0x1b0ac4[_0x1abf('0x2c')]=_[_0x1abf('0x2d')](db['SmsMessage'][_0x1abf('0x21')]);_0x1b0ac4[_0x1abf('0x28')]=_[_0x1abf('0x2d')](_0x45c8c2[_0x1abf('0x28')]);_0x1b0ac4[_0x1abf('0x2e')]=_[_0x1abf('0x2f')](_0x1b0ac4[_0x1abf('0x2c')],_0x1b0ac4[_0x1abf('0x28')]);_0xf914c7[_0x1abf('0x30')]=_[_0x1abf('0x2f')](_0x1b0ac4[_0x1abf('0x2c')],qs[_0x1abf('0x31')](_0x45c8c2[_0x1abf('0x28')][_0x1abf('0x31')]));_0xf914c7[_0x1abf('0x30')]=_0xf914c7['attributes']['length']?_0xf914c7[_0x1abf('0x30')]:_0x1b0ac4[_0x1abf('0x2c')];if(!_0x45c8c2[_0x1abf('0x28')][_0x1abf('0x41')](_0x1abf('0x42'))){_0xf914c7['limit']=qs[_0x1abf('0x16')](_0x45c8c2[_0x1abf('0x28')][_0x1abf('0x16')]);_0xf914c7['offset']=qs['offset'](_0x45c8c2[_0x1abf('0x28')]['offset']);}_0xf914c7[_0x1abf('0x43')]=qs[_0x1abf('0x44')](_0x45c8c2['query']['sort']);_0xf914c7[_0x1abf('0x45')]=qs[_0x1abf('0x2e')](_['pick'](_0x45c8c2[_0x1abf('0x28')],_0x1b0ac4[_0x1abf('0x2e')]));_0xf914c7['where'][_0x1abf('0x46')]=_0x36b593['id'];if(_0x45c8c2[_0x1abf('0x28')][_0x1abf('0x47')]){_0xf914c7[_0x1abf('0x45')]=_[_0x1abf('0x34')](_0xf914c7['where'],{'$or':_['map'](_0xf914c7['attributes'],function(_0x76205c){var _0x353733={};_0x353733[_0x76205c]={'$like':'%'+_0x45c8c2['query'][_0x1abf('0x47')]+'%'};return _0x353733;})});}if(_0x45c8c2['query']['$gte']){var _0x554e19=_0x45c8c2[_0x1abf('0x28')][_0x1abf('0x48')]['split'](',');var _0x13e01f={};_0x13e01f[_0x554e19[0x0]]={'$gte':moment(_0x554e19[0x1])['format'](_0x1abf('0x49'))};_0xf914c7[_0x1abf('0x45')]=_[_0x1abf('0x34')](_0xf914c7[_0x1abf('0x45')],_0x13e01f);}_0xf914c7=_[_0x1abf('0x34')]({},_0xf914c7,_0x45c8c2[_0x1abf('0x35')]);return db[_0x1abf('0x3c')][_0x1abf('0x17')]({'where':_0xf914c7[_0x1abf('0x45')]})[_0x1abf('0x1b')](function(_0x309aa9){_0x29b4c1[_0x1abf('0x17')]=_0x309aa9;if(_0x45c8c2[_0x1abf('0x28')][_0x1abf('0x33')]){_0xf914c7[_0x1abf('0x4a')]=[{'all':!![]}];}return db[_0x1abf('0x3c')][_0x1abf('0x26')](_0xf914c7);})['then'](function(_0x5da65a){_0x29b4c1[_0x1abf('0x4b')]=_0x5da65a;return _0x29b4c1;});}})[_0x1abf('0x1b')](respondWithFilteredResult(_0x3ca230,_0xf914c7))[_0x1abf('0x29')](handleError(_0x3ca230,null));};exports[_0x1abf('0x4c')]=function(_0x5e1c4,_0x2eea51){return db['SmsInteraction'][_0x1abf('0x38')]({'where':{'id':_0x5e1c4[_0x1abf('0x2b')]['id']}})[_0x1abf('0x1b')](handleEntityNotFound(_0x2eea51,null))[_0x1abf('0x1b')](function(_0x131de6){if(_0x131de6){return _0x131de6[_0x1abf('0x4d')](_0x5e1c4[_0x1abf('0x37')][_0x1abf('0x3e')],_[_0x1abf('0x3d')](_0x5e1c4[_0x1abf('0x37')],['ids','id'])||{})[_0x1abf('0x4e')](function(){return db[_0x1abf('0x4f')][_0x1abf('0x26')]({'attributes':['id',_0x1abf('0x1d'),_0x1abf('0x50')],'where':{'id':_0x5e1c4[_0x1abf('0x37')]['ids']}});})[_0x1abf('0x1b')](function(_0x269056){socket[_0x1abf('0x51')](_0x1abf('0x52'),{'id':Number(_0x5e1c4['params']['id']),'tags':_0x269056||[]});return{'id':Number(_0x5e1c4['params']['id']),'tags':_0x269056||[]};});}})[_0x1abf('0x1b')](respondWithResult(_0x2eea51,null))['catch'](handleError(_0x2eea51,null));};exports[_0x1abf('0x53')]=function(_0x2f9124,_0x3cae1f){return db[_0x1abf('0x20')][_0x1abf('0x38')]({'where':{'id':_0x2f9124[_0x1abf('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3cae1f,null))[_0x1abf('0x1b')](function(_0xca1d23){if(_0xca1d23){return _0xca1d23[_0x1abf('0x53')](_0x2f9124[_0x1abf('0x28')][_0x1abf('0x3e')]);}})[_0x1abf('0x1b')](respondWithStatusCode(_0x3cae1f,null))[_0x1abf('0x29')](handleError(_0x3cae1f,null));};exports[_0x1abf('0x54')]=function(_0x2669ad,_0x41b25b){var _0x5bd917=moment()[_0x1abf('0x55')]()['toString']();var _0x181b3d=path[_0x1abf('0x56')](config['root'],_0x1abf('0x57'),_0x1abf('0x58'),_0x1abf('0x59'));var _0xfae143=path[_0x1abf('0x56')](_0x181b3d,_0x5bd917);var _0x226fc6=util[_0x1abf('0x5a')](_0x1abf('0x5b'),_0x2669ad[_0x1abf('0x2b')]['id'],_0x5bd917);var _0x3fc7ee=path[_0x1abf('0x56')](_0x181b3d,_0x226fc6);var _0x259955=[];_0x259955[_0x1abf('0x5c')]({'model':db['User'],'as':_0x1abf('0x5d'),'attributes':['id',_0x1abf('0x5e')],'raw':!![]});_0x259955[_0x1abf('0x5c')]({'model':db[_0x1abf('0x5f')],'as':_0x1abf('0x60'),'attributes':['id',_0x1abf('0x61'),_0x1abf('0x62')],'raw':!![]});var _0x4b7681=[{'model':db[_0x1abf('0x3c')],'as':_0x1abf('0x63'),'attributes':['id','body',_0x1abf('0x64'),'direction',_0x1abf('0x65'),_0x1abf('0x66')],'include':_0x259955}];_0x4b7681[_0x1abf('0x5c')]({'model':db[_0x1abf('0x67')],'as':_0x1abf('0x68'),'attributes':['id',_0x1abf('0x1d')]});_0x4b7681[_0x1abf('0x5c')]({'model':db[_0x1abf('0x5d')],'as':_0x1abf('0x69'),'attributes':['id','fullname']});return db[_0x1abf('0x20')][_0x1abf('0x38')]({'where':{'id':_0x2669ad['params']['id']},'include':_0x4b7681})[_0x1abf('0x1b')](handleEntityNotFound(_0x41b25b,null))['then'](function(_0x14180f){if(_0x14180f){var _0x20cc60=_0x14180f[_0x1abf('0x6a')]({'plain':!![]});fs[_0x1abf('0x6b')](_0xfae143);var _0x2b2c64={'channel':_0x1abf('0x6c'),'account':_0x20cc60['Account'][_0x1abf('0x1d')],'agent':_0x20cc60[_0x1abf('0x69')]?_0x20cc60[_0x1abf('0x69')][_0x1abf('0x5e')]:_0x1abf('0x6d'),'createdAt':moment(_0x20cc60[_0x1abf('0x64')])['format'](_0x1abf('0x49'))[_0x1abf('0x6e')](),'closedAt':_0x20cc60['closed']?moment(_0x20cc60[_0x1abf('0x6f')])[_0x1abf('0x5a')](_0x1abf('0x49'))[_0x1abf('0x6e')]():'','disposition':_0x20cc60[_0x1abf('0x70')],'messages':_(_0x20cc60[_0x1abf('0x63')])[_0x1abf('0x47')]({'secret':![]})[_0x1abf('0x1f')](function(_0x16c4c6){return{'date':moment(_0x16c4c6[_0x1abf('0x64')])[_0x1abf('0x5a')](_0x1abf('0x49'))[_0x1abf('0x6e')](),'sender':_0x16c4c6[_0x1abf('0x71')]===_0x1abf('0x72')?_0x16c4c6[_0x1abf('0x5d')]?_0x16c4c6[_0x1abf('0x5d')][_0x1abf('0x5e')]:_0x1abf('0x73'):_0x16c4c6[_0x1abf('0x60')][_0x1abf('0x61')]+(_0x16c4c6[_0x1abf('0x60')][_0x1abf('0x62')]?'\x20'+_0x16c4c6[_0x1abf('0x60')][_0x1abf('0x62')]:''),'body':_0x16c4c6[_0x1abf('0x37')],'direction':_0x16c4c6[_0x1abf('0x71')]===_0x1abf('0x72')?'A':'C','secret':_0x16c4c6[_0x1abf('0x65')],'read':_0x16c4c6[_0x1abf('0x66')]};})[_0x1abf('0x74')]()};return ejs[_0x1abf('0x75')](path['join'](config['root'],_0x1abf('0x57'),'views',_0x1abf('0x76')),{'interaction':_0x2b2c64})['then'](function(_0x27853a){var _0x392d6d=path[_0x1abf('0x56')](_0xfae143,_0x1abf('0x77')+_0x20cc60['id']+'-'+_0x5bd917+_0x1abf('0x78'));var _0x26ae1b={'path':_0x392d6d,'channel':'Sms','interactionId':_0x20cc60['id']};return pdf[_0x1abf('0x79')](_0x27853a,_0x26ae1b);})[_0x1abf('0x1b')](function(){return new BPromise(function(_0x4ff4f4,_0x579e57){zipdir(_0xfae143,{'saveTo':_0x3fc7ee},function(_0x5ec52c,_0x3d563d){if(_0x5ec52c)return _0x579e57(_0x5ec52c);return _0x4ff4f4(_0x3d563d);});})['then'](function(){return new BPromise(function(_0x3f1c6c,_0x41cab5){rimraf(_0xfae143,function(_0x1586b3){if(_0x1586b3)_0x41cab5(_0x1586b3);return _0x3f1c6c();});});})[_0x1abf('0x1b')](function(){return _0x41b25b[_0x1abf('0x54')](_0x3fc7ee,_0x226fc6,function(_0xbc81c4){if(_0xbc81c4){console[_0x1abf('0x7a')](_0x1abf('0x7b'),_0xbc81c4);}else{fs[_0x1abf('0x7c')](_0x3fc7ee);}});});});}else{return _0x41b25b[_0x1abf('0x11')](0xc8);}})['catch'](handleError(_0x41b25b,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 3d9076f..867bad2 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 _0xefda=['length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages'];(function(_0x57a943,_0x33f711){var _0x512917=function(_0x57b1e1){while(--_0x57b1e1){_0x57a943['push'](_0x57a943['shift']());}};_0x512917(++_0x33f711);}(_0xefda,0x96));var _0xaefd=function(_0x1e8e7f,_0x10d55a){_0x1e8e7f=_0x1e8e7f-0x0;var _0x563328=_0xefda[_0x1e8e7f];return _0x563328;};'use strict';var EventEmitter=require(_0xaefd('0x0'));var SmsInteraction=require('../../mysqldb')['db']['SmsInteraction'];var SmsMessage=require(_0xaefd('0x1'))['db'][_0xaefd('0x2')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xaefd('0x3'),'afterUpdate':_0xaefd('0x4'),'afterDestroy':_0xaefd('0x5')};function emitEvent(_0x22df24){return function(_0x1ef6b4,_0x3288f9,_0x497258){_0x1ef6b4[_0xaefd('0x6')]({'attributes':['id'],'raw':!![]})[_0xaefd('0x7')](function(_0x24d10c){_0x1ef6b4[_0xaefd('0x8')]('Users',_0x24d10c[_0xaefd('0x9')](function(_0xbb04fb){return{'id':_0xbb04fb['id']};}));return SmsMessage[_0xaefd('0xa')]({'where':{'SmsInteractionId':_0x1ef6b4['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x48a255){_0x1ef6b4['setDataValue'](_0xaefd('0xb'),_0x48a255[_0xaefd('0xc')]);SmsInteractionEvents[_0xaefd('0xd')](_0x22df24+':'+_0x1ef6b4['id'],_0x1ef6b4);SmsInteractionEvents[_0xaefd('0xd')](_0x22df24,_0x1ef6b4);_0x497258(null);})[_0xaefd('0xe')](_0x497258(null));};}for(var e in events){if(events[_0xaefd('0xf')](e)){var event=events[e];SmsInteraction[_0xaefd('0x10')](e,emitEvent(event));}}module[_0xaefd('0x11')]=SmsInteractionEvents; \ No newline at end of file +var _0x5f2f=['catch','hasOwnProperty','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','getUsers','then','Users','map','setDataValue','length'];(function(_0x5b58ab,_0x7d4fd){var _0x258035=function(_0x56a985){while(--_0x56a985){_0x5b58ab['push'](_0x5b58ab['shift']());}};_0x258035(++_0x7d4fd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2c9e19,_0x185c17){_0x2c9e19=_0x2c9e19-0x0;var _0x5af8d5=_0x5f2f[_0x2c9e19];return _0x5af8d5;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var SmsInteraction=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var SmsMessage=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xf5f2('0x4')](0x0);var events={'afterCreate':_0xf5f2('0x5'),'afterUpdate':_0xf5f2('0x6'),'afterDestroy':'remove'};function emitEvent(_0x4854b6){return function(_0x1665c7,_0x192215,_0xad7f65){_0x1665c7[_0xf5f2('0x7')]({'attributes':['id'],'raw':!![]})[_0xf5f2('0x8')](function(_0x473100){_0x1665c7['setDataValue'](_0xf5f2('0x9'),_0x473100[_0xf5f2('0xa')](function(_0x2ec345){return{'id':_0x2ec345['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x1665c7['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf5f2('0x8')](function(_0x15dd7c){_0x1665c7[_0xf5f2('0xb')]('unreadMessages',_0x15dd7c[_0xf5f2('0xc')]);SmsInteractionEvents['emit'](_0x4854b6+':'+_0x1665c7['id'],_0x1665c7);SmsInteractionEvents['emit'](_0x4854b6,_0x1665c7);_0xad7f65(null);})[_0xf5f2('0xd')](_0xad7f65(null));};}for(var e in events){if(events[_0xf5f2('0xe')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xf5f2('0xf')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 3317968..c3e89ee 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 _0x58da=['format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt'];(function(_0x2ffda4,_0x3bef65){var _0x53d46e=function(_0x1bea82){while(--_0x1bea82){_0x2ffda4['push'](_0x2ffda4['shift']());}};_0x53d46e(++_0x3bef65);}(_0x58da,0x132));var _0xa58d=function(_0xc2d26f,_0x180ccf){_0xc2d26f=_0xc2d26f-0x0;var _0x50e707=_0x58da[_0xc2d26f];return _0x50e707;};'use strict';var _=require(_0xa58d('0x0'));var util=require(_0xa58d('0x1'));var logger=require(_0xa58d('0x2'))(_0xa58d('0x3'));var moment=require(_0xa58d('0x4'));var BPromise=require(_0xa58d('0x5'));var rp=require(_0xa58d('0x6'));var fs=require('fs');var path=require(_0xa58d('0x7'));var rimraf=require(_0xa58d('0x8'));var config=require('../../config/environment');var attributes=require(_0xa58d('0x9'));module[_0xa58d('0xa')]=function(_0x9430ff,_0x4df545){return _0x9430ff[_0xa58d('0xb')](_0xa58d('0xc'),attributes,{'tableName':_0xa58d('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x235e7d,_0x409462,_0x553400){if(_0x235e7d[_0xa58d('0xe')](_0xa58d('0xf'))){_0x235e7d[_0xa58d('0x10')]=moment()[_0xa58d('0x11')](_0xa58d('0x12'));}_0x553400(null,_0x235e7d);}}});}; \ No newline at end of file +var _0x007d=['api','request-promise','rimraf','../../config/environment','./smsInteraction.attributes','exports','define','sms_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0xb2c34a,_0xee6321){var _0x489e06=function(_0x1f2525){while(--_0x1f2525){_0xb2c34a['push'](_0xb2c34a['shift']());}};_0x489e06(++_0xee6321);}(_0x007d,0x1be));var _0xd007=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x007d[_0x42cae2];return _0x5f256f;};'use strict';var _=require(_0xd007('0x0'));var util=require(_0xd007('0x1'));var logger=require('../../config/logger')(_0xd007('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd007('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd007('0x4'));var config=require(_0xd007('0x5'));var attributes=require(_0xd007('0x6'));module[_0xd007('0x7')]=function(_0x2992a1,_0x5009d7){return _0x2992a1[_0xd007('0x8')]('SmsInteraction',attributes,{'tableName':_0xd007('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46a11e,_0x4d55a9,_0x28d95f){if(_0x46a11e[_0xd007('0xa')](_0xd007('0xb'))){_0x46a11e[_0xd007('0xc')]=moment()['format'](_0xd007('0xd'));}_0x28d95f(null,_0x46a11e);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 5483768..ba16a41 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 _0x9686=['defaults','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','request','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','catch','SmsInteraction','update','body','options','raw','where','attributes','limit','then','UpdateSmsInteraction','AddTagsToSmsInteraction','addTags','ids','AddTags','lodash','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0x9686,0x69));var _0x6968=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9686[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x6968('0x0'));var util=require('util');var moment=require(_0x6968('0x1'));var BPromise=require(_0x6968('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6968('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x6968('0x4'))('rpc');var config=require(_0x6968('0x5'));var jayson=require(_0x6968('0x6'));var client=jayson[_0x6968('0x7')][_0x6968('0x8')]({'port':0x232a});config['redis']=_[_0x6968('0x9')](config[_0x6968('0xa')],{'host':_0x6968('0xb'),'port':0x18eb});var socket=require(_0x6968('0xc'))(new Redis(config[_0x6968('0xa')]));require(_0x6968('0xd'))[_0x6968('0xe')](socket);function respondWithRpcPromise(_0x110e32,_0x1d4a69,_0x4e9e1d){return new BPromise(function(_0x3ad4c4,_0x26d99f){return client[_0x6968('0xf')](_0x110e32,_0x4e9e1d)['then'](function(_0x3f07b7){logger['info'](_0x6968('0x10'),_0x1d4a69,_0x6968('0x11'));logger[_0x6968('0x12')]('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x1d4a69,_0x6968('0x11'),JSON[_0x6968('0x13')](_0x3f07b7));if(_0x3f07b7[_0x6968('0x14')]){if(_0x3f07b7[_0x6968('0x14')]['code']===0x1f4){logger[_0x6968('0x14')](_0x6968('0x10'),_0x1d4a69,_0x3f07b7['error'][_0x6968('0x15')]);return _0x26d99f(_0x3f07b7[_0x6968('0x14')][_0x6968('0x15')]);}logger['error'](_0x6968('0x10'),_0x1d4a69,_0x3f07b7[_0x6968('0x14')][_0x6968('0x15')]);return _0x3ad4c4(_0x3f07b7[_0x6968('0x14')][_0x6968('0x15')]);}else{logger[_0x6968('0x16')](_0x6968('0x10'),_0x1d4a69,'request\x20sent');_0x3ad4c4(_0x3f07b7['result']['message']);}})[_0x6968('0x17')](function(_0x3a5efb){logger['error'](_0x6968('0x10'),_0x1d4a69,_0x3a5efb);_0x26d99f(_0x3a5efb);});});}exports['UpdateSmsInteraction']=function(_0x331a45){var _0x102844=this;return new Promise(function(_0x67183c,_0x287891){return db[_0x6968('0x18')][_0x6968('0x19')](_0x331a45[_0x6968('0x1a')],{'raw':_0x331a45['options']?_0x331a45[_0x6968('0x1b')][_0x6968('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x331a45[_0x6968('0x1b')]?_0x331a45[_0x6968('0x1b')][_0x6968('0x1d')]||null:null,'attributes':_0x331a45[_0x6968('0x1b')]?_0x331a45[_0x6968('0x1b')][_0x6968('0x1e')]||null:null,'limit':_0x331a45[_0x6968('0x1b')]?_0x331a45[_0x6968('0x1b')][_0x6968('0x1f')]||null:null})[_0x6968('0x20')](function(_0xc643be){logger['info'](_0x6968('0x21'),_0x331a45);logger['debug'](_0x6968('0x21'),_0x331a45,JSON[_0x6968('0x13')](_0xc643be));_0x67183c(_0xc643be);})['catch'](function(_0x1b1e31){logger['error']('UpdateSmsInteraction',_0x1b1e31[_0x6968('0x15')],_0x331a45);_0x287891(_0x102844[_0x6968('0x14')](0x1f4,_0x1b1e31[_0x6968('0x15')]));});});};exports[_0x6968('0x22')]=function(_0x2a8045){return new Promise(function(_0xf83c51,_0x111b50){return db['SmsInteraction']['find']({'where':_0x2a8045[_0x6968('0x1b')]?_0x2a8045['options']['where']||null:null})['then'](function(_0x22c02c){if(_0x22c02c){return _0x22c02c[_0x6968('0x23')](_0x2a8045[_0x6968('0x1a')]['ids'],_['omit'](_0x2a8045['body'],[_0x6968('0x24'),'id'])||{});}})['spread'](function(_0x4bacd0){logger[_0x6968('0x16')]('AddTags',_0x2a8045);logger[_0x6968('0x12')]('AddTags',_0x2a8045,JSON[_0x6968('0x13')](_0x4bacd0));_0xf83c51(_0x4bacd0);})[_0x6968('0x17')](function(_0x669c1b){logger[_0x6968('0x14')](_0x6968('0x25'),_0x669c1b[_0x6968('0x15')],_0x2a8045);_0x111b50(_this[_0x6968('0x14')](0x1f4,_0x669c1b['message']));});});}; \ No newline at end of file +var _0xca0c=['lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsInteraction.socket','register','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','limit','find','addTags','omit','ids','AddTags'];(function(_0x25a4f8,_0x3505f8){var _0x4936ff=function(_0x45cb58){while(--_0x45cb58){_0x25a4f8['push'](_0x25a4f8['shift']());}};_0x4936ff(++_0x3505f8);}(_0xca0c,0x1ad));var _0xcca0=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xca0c[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0xcca0('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcca0('0x1'));var fs=require('fs');var Redis=require(_0xcca0('0x2'));var db=require(_0xcca0('0x3'))['db'];var utils=require(_0xcca0('0x4'));var logger=require(_0xcca0('0x5'))(_0xcca0('0x6'));var config=require(_0xcca0('0x7'));var jayson=require(_0xcca0('0x8'));var client=jayson[_0xcca0('0x9')][_0xcca0('0xa')]({'port':0x232a});config[_0xcca0('0xb')]=_[_0xcca0('0xc')](config[_0xcca0('0xb')],{'host':_0xcca0('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xcca0('0xb')]));require(_0xcca0('0xe'))[_0xcca0('0xf')](socket);function respondWithRpcPromise(_0x2dfb3e,_0x11c988,_0xb5271d){return new BPromise(function(_0x2aa3c6,_0x34d39f){return client['request'](_0x2dfb3e,_0xb5271d)[_0xcca0('0x10')](function(_0xc2105a){logger[_0xcca0('0x11')](_0xcca0('0x12'),_0x11c988,_0xcca0('0x13'));logger[_0xcca0('0x14')](_0xcca0('0x15'),_0x11c988,_0xcca0('0x13'),JSON[_0xcca0('0x16')](_0xc2105a));if(_0xc2105a[_0xcca0('0x17')]){if(_0xc2105a[_0xcca0('0x17')][_0xcca0('0x18')]===0x1f4){logger[_0xcca0('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x11c988,_0xc2105a[_0xcca0('0x17')][_0xcca0('0x19')]);return _0x34d39f(_0xc2105a[_0xcca0('0x17')]['message']);}logger[_0xcca0('0x17')](_0xcca0('0x12'),_0x11c988,_0xc2105a[_0xcca0('0x17')][_0xcca0('0x19')]);return _0x2aa3c6(_0xc2105a[_0xcca0('0x17')][_0xcca0('0x19')]);}else{logger['info'](_0xcca0('0x12'),_0x11c988,_0xcca0('0x13'));_0x2aa3c6(_0xc2105a['result']['message']);}})[_0xcca0('0x1a')](function(_0x21292c){logger['error'](_0xcca0('0x12'),_0x11c988,_0x21292c);_0x34d39f(_0x21292c);});});}exports[_0xcca0('0x1b')]=function(_0x547f5f){var _0x3189fd=this;return new Promise(function(_0x6eedba,_0x139b5b){return db[_0xcca0('0x1c')][_0xcca0('0x1d')](_0x547f5f[_0xcca0('0x1e')],{'raw':_0x547f5f[_0xcca0('0x1f')]?_0x547f5f['options'][_0xcca0('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x547f5f[_0xcca0('0x1f')]?_0x547f5f[_0xcca0('0x1f')]['where']||null:null,'attributes':_0x547f5f[_0xcca0('0x1f')]?_0x547f5f[_0xcca0('0x1f')]['attributes']||null:null,'limit':_0x547f5f[_0xcca0('0x1f')]?_0x547f5f['options'][_0xcca0('0x21')]||null:null})[_0xcca0('0x10')](function(_0x37dfd3){logger['info']('UpdateSmsInteraction',_0x547f5f);logger[_0xcca0('0x14')](_0xcca0('0x1b'),_0x547f5f,JSON[_0xcca0('0x16')](_0x37dfd3));_0x6eedba(_0x37dfd3);})[_0xcca0('0x1a')](function(_0x344902){logger['error']('UpdateSmsInteraction',_0x344902[_0xcca0('0x19')],_0x547f5f);_0x139b5b(_0x3189fd[_0xcca0('0x17')](0x1f4,_0x344902[_0xcca0('0x19')]));});});};exports['AddTagsToSmsInteraction']=function(_0x4e75f5){return new Promise(function(_0xa49b52,_0x46e1ed){return db['SmsInteraction'][_0xcca0('0x22')]({'where':_0x4e75f5[_0xcca0('0x1f')]?_0x4e75f5[_0xcca0('0x1f')]['where']||null:null})['then'](function(_0x1b5ccb){if(_0x1b5ccb){return _0x1b5ccb[_0xcca0('0x23')](_0x4e75f5[_0xcca0('0x1e')]['ids'],_[_0xcca0('0x24')](_0x4e75f5[_0xcca0('0x1e')],[_0xcca0('0x25'),'id'])||{});}})['spread'](function(_0x2540a2){logger[_0xcca0('0x11')](_0xcca0('0x26'),_0x4e75f5);logger[_0xcca0('0x14')](_0xcca0('0x26'),_0x4e75f5,JSON[_0xcca0('0x16')](_0x2540a2));_0xa49b52(_0x2540a2);})['catch'](function(_0x324ffb){logger['error'](_0xcca0('0x26'),_0x324ffb[_0xcca0('0x19')],_0x4e75f5);_0x46e1ed(_this[_0xcca0('0x17')](0x1f4,_0x324ffb['message']));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 941cdc0..d4741b9 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 _0x6fa0=['smsInteraction:','./smsInteraction.events','update','emit','register','length'];(function(_0x3635ce,_0x33a6f9){var _0x97ecd0=function(_0x123d98){while(--_0x123d98){_0x3635ce['push'](_0x3635ce['shift']());}};_0x97ecd0(++_0x33a6f9);}(_0x6fa0,0xf1));var _0x06fa=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x6fa0[_0x122ef9];return _0x42fba0;};'use strict';var SmsInteractionEvents=require(_0x06fa('0x0'));var events=['save','remove',_0x06fa('0x1')];function createListener(_0x28c98d,_0x27a49d){return function(_0x3498d4){_0x27a49d[_0x06fa('0x2')](_0x28c98d,_0x3498d4);};}function removeListener(_0x51dbff,_0x70ada7){return function(){SmsInteractionEvents['removeListener'](_0x51dbff,_0x70ada7);};}exports[_0x06fa('0x3')]=function(_0x59a7a0){for(var _0x3db2ca=0x0,_0x141b5b=events[_0x06fa('0x4')];_0x3db2ca<_0x141b5b;_0x3db2ca++){var _0x15ca2b=events[_0x3db2ca];var _0x448356=createListener(_0x06fa('0x5')+_0x15ca2b,_0x59a7a0);SmsInteractionEvents['on'](_0x15ca2b,_0x448356);}}; \ No newline at end of file +var _0x98db=['register','length','smsInteraction:','./smsInteraction.events','save','remove','emit','removeListener'];(function(_0x2bf888,_0x374f0b){var _0x3038d6=function(_0xe1b6d9){while(--_0xe1b6d9){_0x2bf888['push'](_0x2bf888['shift']());}};_0x3038d6(++_0x374f0b);}(_0x98db,0x143));var _0xb98d=function(_0x6f1a87,_0x5d5bcf){_0x6f1a87=_0x6f1a87-0x0;var _0x2495c7=_0x98db[_0x6f1a87];return _0x2495c7;};'use strict';var SmsInteractionEvents=require(_0xb98d('0x0'));var events=[_0xb98d('0x1'),_0xb98d('0x2'),'update'];function createListener(_0x46e56f,_0x28a80f){return function(_0x38a647){_0x28a80f[_0xb98d('0x3')](_0x46e56f,_0x38a647);};}function removeListener(_0x2eb810,_0x4d9dab){return function(){SmsInteractionEvents[_0xb98d('0x4')](_0x2eb810,_0x4d9dab);};}exports[_0xb98d('0x5')]=function(_0x50a8a5){for(var _0x2eff79=0x0,_0x844e55=events[_0xb98d('0x6')];_0x2eff79<_0x844e55;_0x2eff79++){var _0x3a93d7=events[_0x2eff79];var _0x240e61=createListener(_0xb98d('0x7')+_0x3a93d7,_0x50a8a5);SmsInteractionEvents['on'](_0x3a93d7,_0x240e61);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 69645da..b6b2888 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 _0x52fe=['/:id','show','post','tracked','sms','smsmessage:create','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x1fbf82,_0x5a47f3){var _0x2374a5=function(_0x2131cb){while(--_0x2131cb){_0x1fbf82['push'](_0x1fbf82['shift']());}};_0x2374a5(++_0x5a47f3);}(_0x52fe,0xc5));var _0xe52f=function(_0x5ab3e6,_0x40a4e2){_0x5ab3e6=_0x5ab3e6-0x0;var _0x4c2e8a=_0x52fe[_0x5ab3e6];return _0x4c2e8a;};'use strict';var multer=require(_0xe52f('0x0'));var util=require(_0xe52f('0x1'));var path=require(_0xe52f('0x2'));var timeout=require(_0xe52f('0x3'));var express=require(_0xe52f('0x4'));var router=express[_0xe52f('0x5')]();var fs_extra=require(_0xe52f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xe52f('0x7'));var config=require('../../config/environment');var controller=require(_0xe52f('0x8'));router[_0xe52f('0x9')]('/',auth[_0xe52f('0xa')](),controller[_0xe52f('0xb')]);router[_0xe52f('0x9')](_0xe52f('0xc'),auth[_0xe52f('0xa')](),controller['describe']);router[_0xe52f('0x9')](_0xe52f('0xd'),auth[_0xe52f('0xa')](),controller[_0xe52f('0xe')]);router[_0xe52f('0xf')]('/',auth[_0xe52f('0xa')](),interaction[_0xe52f('0x10')](_0xe52f('0x11'),_0xe52f('0x12')),controller['create']);router[_0xe52f('0xf')](_0xe52f('0x13'),controller[_0xe52f('0x14')]);router[_0xe52f('0x15')](_0xe52f('0xd'),auth[_0xe52f('0xa')](),controller[_0xe52f('0x16')]);router['put'](_0xe52f('0x17'),auth[_0xe52f('0xa')](),controller[_0xe52f('0x18')]);router[_0xe52f('0x15')](_0xe52f('0x19'),auth['isAuthenticated'](),controller[_0xe52f('0x1a')]);router[_0xe52f('0x1b')](_0xe52f('0xd'),auth[_0xe52f('0xa')](),controller[_0xe52f('0x1c')]);module[_0xe52f('0x1d')]=router; \ No newline at end of file +var _0x059a=['get','index','/describe','/:id','isAuthenticated','post','tracked','create','/:id/status','status','update','put','/:id/reject','reject','destroy','util','Router','fs-extra','../../config/environment'];(function(_0x1f3c1a,_0x386e2b){var _0x27fb1a=function(_0x52991f){while(--_0x52991f){_0x1f3c1a['push'](_0x1f3c1a['shift']());}};_0x27fb1a(++_0x386e2b);}(_0x059a,0x18b));var _0xa059=function(_0x126977,_0x25df7f){_0x126977=_0x126977-0x0;var _0x15e83e=_0x059a[_0x126977];return _0x15e83e;};'use strict';var multer=require('multer');var util=require(_0xa059('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa059('0x1')]();var fs_extra=require(_0xa059('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xa059('0x3'));var controller=require('./smsMessage.controller');router[_0xa059('0x4')]('/',auth['isAuthenticated'](),controller[_0xa059('0x5')]);router[_0xa059('0x4')](_0xa059('0x6'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xa059('0x7'),auth[_0xa059('0x8')](),controller['show']);router[_0xa059('0x9')]('/',auth['isAuthenticated'](),interaction[_0xa059('0xa')]('sms','smsmessage:create'),controller[_0xa059('0xb')]);router[_0xa059('0x9')](_0xa059('0xc'),controller[_0xa059('0xd')]);router['put'](_0xa059('0x7'),auth[_0xa059('0x8')](),controller[_0xa059('0xe')]);router[_0xa059('0xf')]('/:id/accept',auth[_0xa059('0x8')](),controller['accept']);router[_0xa059('0xf')](_0xa059('0x10'),auth[_0xa059('0x8')](),controller[_0xa059('0x11')]);router['delete'](_0xa059('0x7'),auth[_0xa059('0x8')](),controller[_0xa059('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 3206479..6f9dd47 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 _0x3a5e=['exports','TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x572149,_0x1e8aab){var _0x256761=function(_0x4dff2d){while(--_0x4dff2d){_0x572149['push'](_0x572149['shift']());}};_0x256761(++_0x1e8aab);}(_0x3a5e,0x14c));var _0xe3a5=function(_0x11bdf4,_0x36efdc){_0x11bdf4=_0x11bdf4-0x0;var _0x20b5fe=_0x3a5e[_0x11bdf4];return _0x20b5fe;};'use strict';var Sequelize=require(_0xe3a5('0x0'));module[_0xe3a5('0x1')]={'body':{'type':Sequelize[_0xe3a5('0x2')](_0xe3a5('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xe3a5('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe3a5('0x5')]('in','out'),'defaultValue':_0xe3a5('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xe3a5('0x7')](0xbe)},'phone':{'type':Sequelize[_0xe3a5('0x7')]},'readAt':{'type':Sequelize[_0xe3a5('0x8')]},'secret':{'type':Sequelize[_0xe3a5('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xe521=['out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN','ENUM'];(function(_0x186c19,_0x2e1fdf){var _0x20c566=function(_0x18268d){while(--_0x18268d){_0x186c19['push'](_0x186c19['shift']());}};_0x20c566(++_0x2e1fdf);}(_0xe521,0x1a1));var _0x1e52=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe521[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1e52('0x0'));module[_0x1e52('0x1')]={'body':{'type':Sequelize[_0x1e52('0x2')](_0x1e52('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x1e52('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1e52('0x5')]('in',_0x1e52('0x6')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x1e52('0x7')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x1e52('0x8')]},'secret':{'type':Sequelize[_0x1e52('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1e52('0x7')]},'providerResponse':{'type':Sequelize[_0x1e52('0x2')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 3d1c112..2d77e64 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 _0x8861=['debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','message','result','sendStatus','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','stack','name','send','index','map','SmsMessage','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','options','includeAll','include','catch','show','params','keys','find','body','describe','accept','read','format','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','reject','sms','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','stringify','null','RejectMessage','rejectMessage','QueryTypes','contact','event','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','delivered','Status','plivio','infobip','results','groupName','DELIVERED','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','./smsMessage.socket','register','jayson/promise','http','client','info','SmsMessage,\x20%s,\x20%s','request\x20sent'];(function(_0xc97dd1,_0x5eb65d){var _0x345adf=function(_0x13347c){while(--_0x13347c){_0xc97dd1['push'](_0xc97dd1['shift']());}};_0x345adf(++_0x5eb65d);}(_0x8861,0x6d));var _0x1886=function(_0x49873b,_0x26c041){_0x49873b=_0x49873b-0x0;var _0x4df91d=_0x8861[_0x49873b];return _0x4df91d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x1886('0x0'));var jsonpatch=require(_0x1886('0x1'));var rp=require(_0x1886('0x2'));var moment=require(_0x1886('0x3'));var BPromise=require(_0x1886('0x4'));var Mustache=require(_0x1886('0x5'));var util=require(_0x1886('0x6'));var path=require(_0x1886('0x7'));var sox=require(_0x1886('0x8'));var csv=require(_0x1886('0x9'));var ejs=require(_0x1886('0xa'));var fs=require('fs');var fs_extra=require(_0x1886('0xb'));var _=require(_0x1886('0xc'));var squel=require(_0x1886('0xd'));var crypto=require(_0x1886('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1886('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1886('0x10'));var Papa=require('papaparse');var Redis=require(_0x1886('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x1886('0x12'));var as=require(_0x1886('0x13'));var hardwareService=require(_0x1886('0x14'));var logger=require(_0x1886('0x15'))(_0x1886('0x16'));var utils=require(_0x1886('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x1886('0x18'));var db=require(_0x1886('0x19'))['db'];config[_0x1886('0x1a')]=_[_0x1886('0x1b')](config[_0x1886('0x1a')],{'host':_0x1886('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x1886('0x1d'))[_0x1886('0x1e')](socket);var jayson=require(_0x1886('0x1f'));var client=jayson['client'][_0x1886('0x20')]({'port':0x232c});var client9002=jayson[_0x1886('0x21')][_0x1886('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x4993fe,_0x54d2ee,_0x4083d5,_0x5afc6b){return new BPromise(function(_0x18f7a6,_0x49a12c){var _0xe3ba5e=_0x5afc6b||client;return _0xe3ba5e['request'](_0x4993fe,_0x4083d5)['then'](function(_0x2faf4e){logger[_0x1886('0x22')](_0x1886('0x23'),_0x54d2ee,_0x1886('0x24'));logger[_0x1886('0x25')](_0x1886('0x26'),_0x54d2ee,_0x1886('0x24'),JSON['stringify'](_0x2faf4e));if(_0x2faf4e[_0x1886('0x27')]){if(_0x2faf4e[_0x1886('0x27')]['code']===0x1f4){logger[_0x1886('0x27')](_0x1886('0x23'),_0x54d2ee,_0x2faf4e[_0x1886('0x27')]['message']);return _0x49a12c(_0x2faf4e[_0x1886('0x27')][_0x1886('0x28')]);}logger[_0x1886('0x27')](_0x1886('0x23'),_0x54d2ee,_0x2faf4e[_0x1886('0x27')]['message']);return _0x18f7a6(_0x2faf4e['error'][_0x1886('0x28')]);}else{logger[_0x1886('0x22')](_0x1886('0x23'),_0x54d2ee,_0x1886('0x24'));_0x18f7a6(_0x2faf4e[_0x1886('0x29')]['message']);}})['catch'](function(_0x1c8841){logger[_0x1886('0x27')](_0x1886('0x23'),_0x54d2ee,_0x1c8841);_0x49a12c(_0x1c8841);});});}function respondWithStatusCode(_0x4b7265,_0x2d2dff){_0x2d2dff=_0x2d2dff||0xcc;return function(_0x188ab5){if(_0x188ab5){return _0x4b7265[_0x1886('0x2a')](_0x2d2dff);}return _0x4b7265[_0x1886('0x2b')](_0x2d2dff)[_0x1886('0x2c')]();};}function respondWithResult(_0x1a9ce3,_0xcd0ac5){_0xcd0ac5=_0xcd0ac5||0xc8;return function(_0x148cf5){if(_0x148cf5){return _0x1a9ce3[_0x1886('0x2b')](_0xcd0ac5)[_0x1886('0x2d')](_0x148cf5);}};}function respondWithFilteredResult(_0x13fe64,_0x177307){return function(_0x4edca2){if(_0x4edca2){var _0x2e7a79=typeof _0x177307[_0x1886('0x2e')]===_0x1886('0x2f')&&typeof _0x177307['limit']===_0x1886('0x2f');var _0x2539c6=_0x4edca2[_0x1886('0x30')];var _0x4b9985=_0x2e7a79?0x0:_0x177307['offset'];var _0x48127e=_0x2e7a79?_0x4edca2[_0x1886('0x30')]:_0x177307[_0x1886('0x2e')]+_0x177307[_0x1886('0x31')];var _0x33db06;if(_0x48127e>=_0x2539c6){_0x48127e=_0x2539c6;_0x33db06=0xc8;}else{_0x33db06=0xce;}_0x13fe64[_0x1886('0x2b')](_0x33db06);return _0x13fe64[_0x1886('0x32')]('Content-Range',_0x4b9985+'-'+_0x48127e+'/'+_0x2539c6)[_0x1886('0x2d')](_0x4edca2);}return null;};}function patchUpdates(_0x2729d0){return function(_0x4b0589){try{jsonpatch[_0x1886('0x33')](_0x4b0589,_0x2729d0,!![]);}catch(_0x4e73ba){return BPromise['reject'](_0x4e73ba);}return _0x4b0589[_0x1886('0x34')]();};}function saveUpdates(_0xa653f5,_0x3e07ca){return function(_0x465299){if(_0x465299){return _0x465299[_0x1886('0x35')](_0xa653f5)[_0x1886('0x36')](function(_0x326bab){return _0x326bab;});}return null;};}function removeEntity(_0x242e88,_0x17d3b9){return function(_0x279e85){if(_0x279e85){return _0x279e85['destroy']()['then'](function(){_0x242e88[_0x1886('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35f682,_0x117505){return function(_0x442789){if(!_0x442789){_0x35f682[_0x1886('0x2a')](0x194);}return _0x442789;};}function handleError(_0x55637d,_0x8d84cc){_0x8d84cc=_0x8d84cc||0x1f4;return function(_0x1e754d){logger['error'](_0x1e754d[_0x1886('0x37')]);if(_0x1e754d[_0x1886('0x38')]){delete _0x1e754d[_0x1886('0x38')];}_0x55637d[_0x1886('0x2b')](_0x8d84cc)[_0x1886('0x39')](_0x1e754d);};}exports[_0x1886('0x3a')]=function(_0x1e8d6a,_0x40f98d){var _0x592bc9={},_0x3a8bf0={},_0x1983fa={'count':0x0,'rows':[]};var _0x20c3ca=_[_0x1886('0x3b')](db[_0x1886('0x3c')]['rawAttributes'],function(_0x39694d){return{'name':_0x39694d['fieldName'],'type':_0x39694d['type']['key']};});_0x3a8bf0[_0x1886('0x3d')]=_[_0x1886('0x3b')](_0x20c3ca,'name');_0x3a8bf0[_0x1886('0x3e')]=_['keys'](_0x1e8d6a['query']);_0x3a8bf0[_0x1886('0x3f')]=_[_0x1886('0x40')](_0x3a8bf0[_0x1886('0x3d')],_0x3a8bf0[_0x1886('0x3e')]);_0x592bc9[_0x1886('0x41')]=_[_0x1886('0x40')](_0x3a8bf0[_0x1886('0x3d')],qs[_0x1886('0x42')](_0x1e8d6a[_0x1886('0x3e')][_0x1886('0x42')]));_0x592bc9[_0x1886('0x41')]=_0x592bc9[_0x1886('0x41')][_0x1886('0x43')]?_0x592bc9[_0x1886('0x41')]:_0x3a8bf0[_0x1886('0x3d')];if(!_0x1e8d6a[_0x1886('0x3e')][_0x1886('0x44')](_0x1886('0x45'))){_0x592bc9[_0x1886('0x31')]=qs[_0x1886('0x31')](_0x1e8d6a[_0x1886('0x3e')][_0x1886('0x31')]);_0x592bc9[_0x1886('0x2e')]=qs[_0x1886('0x2e')](_0x1e8d6a[_0x1886('0x3e')]['offset']);}_0x592bc9[_0x1886('0x46')]=qs['sort'](_0x1e8d6a[_0x1886('0x3e')]['sort']);_0x592bc9[_0x1886('0x47')]=qs['filters'](_[_0x1886('0x48')](_0x1e8d6a['query'],_0x3a8bf0[_0x1886('0x3f')]),_0x20c3ca);if(_0x1e8d6a['query'][_0x1886('0x49')]){_0x592bc9['where']=_[_0x1886('0x4a')](_0x592bc9['where'],{'$or':_[_0x1886('0x3b')](_0x20c3ca,function(_0x5d83e7){if(_0x5d83e7[_0x1886('0x4b')]!=='VIRTUAL'){var _0x3766bb={};_0x3766bb[_0x5d83e7[_0x1886('0x38')]]={'$like':'%'+_0x1e8d6a['query'][_0x1886('0x49')]+'%'};return _0x3766bb;}})});}_0x592bc9=_[_0x1886('0x4a')]({},_0x592bc9,_0x1e8d6a[_0x1886('0x4c')]);var _0x561afa={'where':_0x592bc9[_0x1886('0x47')]};return db[_0x1886('0x3c')]['count'](_0x561afa)[_0x1886('0x36')](function(_0xbd4ca0){_0x1983fa[_0x1886('0x30')]=_0xbd4ca0;if(_0x1e8d6a[_0x1886('0x3e')][_0x1886('0x4d')]){_0x592bc9[_0x1886('0x4e')]=[{'all':!![]}];}return db[_0x1886('0x3c')]['findAll'](_0x592bc9);})[_0x1886('0x36')](function(_0x5a13c7){_0x1983fa['rows']=_0x5a13c7;return _0x1983fa;})['then'](respondWithFilteredResult(_0x40f98d,_0x592bc9))[_0x1886('0x4f')](handleError(_0x40f98d,null));};exports[_0x1886('0x50')]=function(_0x50431f,_0x222531){var _0x3355ac={'raw':!![],'where':{'id':_0x50431f[_0x1886('0x51')]['id']}},_0x36234c={};_0x36234c[_0x1886('0x3d')]=_['keys'](db[_0x1886('0x3c')]['rawAttributes']);_0x36234c[_0x1886('0x3e')]=_[_0x1886('0x52')](_0x50431f[_0x1886('0x3e')]);_0x36234c[_0x1886('0x3f')]=_['intersection'](_0x36234c[_0x1886('0x3d')],_0x36234c[_0x1886('0x3e')]);_0x3355ac['attributes']=_['intersection'](_0x36234c['model'],qs['fields'](_0x50431f['query'][_0x1886('0x42')]));_0x3355ac['attributes']=_0x3355ac[_0x1886('0x41')]['length']?_0x3355ac['attributes']:_0x36234c[_0x1886('0x3d')];if(_0x50431f[_0x1886('0x3e')]['includeAll']){_0x3355ac[_0x1886('0x4e')]=[{'all':!![]}];}_0x3355ac=_[_0x1886('0x4a')]({},_0x3355ac,_0x50431f[_0x1886('0x4c')]);return db[_0x1886('0x3c')][_0x1886('0x53')](_0x3355ac)[_0x1886('0x36')](handleEntityNotFound(_0x222531,null))[_0x1886('0x36')](respondWithResult(_0x222531,null))[_0x1886('0x4f')](handleError(_0x222531,null));};exports['create']=function(_0x1a7e93,_0x577421){return db['SmsMessage']['create'](_0x1a7e93[_0x1886('0x54')],{})['then'](respondWithResult(_0x577421,0xc9))[_0x1886('0x4f')](handleError(_0x577421,null));};exports['update']=function(_0x4c0575,_0x3755af){if(_0x4c0575['body']['id']){delete _0x4c0575[_0x1886('0x54')]['id'];}return db['SmsMessage'][_0x1886('0x53')]({'where':{'id':_0x4c0575['params']['id']}})[_0x1886('0x36')](handleEntityNotFound(_0x3755af,null))[_0x1886('0x36')](saveUpdates(_0x4c0575[_0x1886('0x54')],null))[_0x1886('0x36')](respondWithResult(_0x3755af,null))[_0x1886('0x4f')](handleError(_0x3755af,null));};exports['destroy']=function(_0x322271,_0x5928fd){return db[_0x1886('0x3c')]['find']({'where':{'id':_0x322271['params']['id']}})['then'](handleEntityNotFound(_0x5928fd,null))['then'](removeEntity(_0x5928fd,null))[_0x1886('0x4f')](handleError(_0x5928fd,null));};exports[_0x1886('0x55')]=function(_0x5e2dde,_0x1b063e){return db['SmsMessage']['describe']()[_0x1886('0x36')](respondWithResult(_0x1b063e,null))[_0x1886('0x4f')](handleError(_0x1b063e,null));};var interaction_log=require(_0x1886('0x15'))('sms-interactions');exports[_0x1886('0x56')]=function(_0x3cb097,_0x52e351,_0x59325b){var _0x2c758e={'agent':{},'channel':'sms'};if(_0x3cb097[_0x1886('0x54')]['id']){delete _0x3cb097[_0x1886('0x54')]['id'];}_0x3cb097[_0x1886('0x54')][_0x1886('0x57')]=!![];_0x3cb097[_0x1886('0x54')]['readAt']=moment()[_0x1886('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x3cb097[_0x1886('0x54')][_0x1886('0x59')]=_0x3cb097[_0x1886('0x54')]['UserId']||_0x3cb097[_0x1886('0x5a')]['id'];_0x2c758e[_0x1886('0x5b')]['id']=_0x3cb097[_0x1886('0x54')][_0x1886('0x59')];return db['SmsMessage'][_0x1886('0x53')]({'where':{'id':_0x3cb097['params']['id'],'UserId':null}})[_0x1886('0x36')](handleEntityNotFound(_0x52e351,null))[_0x1886('0x36')](saveUpdates(_0x3cb097['body'],null))['then'](function(_0x3a9844){if(_0x3a9844){_0x2c758e[_0x1886('0x28')]=_0x3a9844[_0x1886('0x5c')]({'plain':!![]});return db[_0x1886('0x5d')][_0x1886('0x53')]({'where':{'id':_0x3a9844[_0x1886('0x5e')]}});}return null;})[_0x1886('0x36')](handleEntityNotFound(_0x52e351,null))['then'](function(_0x47e5c9){if(_0x47e5c9){return _0x47e5c9[_0x1886('0x35')]({'UserId':_0x3cb097[_0x1886('0x54')][_0x1886('0x59')],'read1stAt':_[_0x1886('0x5f')](_0x47e5c9['read1stAt'])?moment()[_0x1886('0x58')](_0x1886('0x60')):undefined});}return null;})['then'](function(_0x57fd4e){if(_0x57fd4e){_0x2c758e[_0x1886('0x61')]=_0x57fd4e[_0x1886('0x5c')]({'plain':!![]});interaction_log[_0x1886('0x22')](_0x1886('0x62'),_0x3cb097[_0x1886('0x5a')]['id'],_0x3cb097[_0x1886('0x5a')]['name'],_0x3cb097[_0x1886('0x5a')]['role'],_0x2c758e[_0x1886('0x61')]['id'],_0x3cb097[_0x1886('0x54')]?JSON['stringify'](_0x3cb097[_0x1886('0x54')]):'null');return respondWithRpcPromise(_0x1886('0x63'),_0x1886('0x64'),_0x2c758e);}return null;})[_0x1886('0x36')](function(_0x354212){var _0x28998e=_0x1886('0x65')+_0x354212['message'][_0x1886('0x66')];return db[_0x1886('0x67')][_0x1886('0x3e')](_0x28998e,{'type':db[_0x1886('0x68')]['QueryTypes'][_0x1886('0x69')],'raw':!![]})['then'](function(_0x4f0190){return _0x4f0190;});})['then'](function(_0x46a886){if(_0x46a886){_0x2c758e['message']['contact']=_0x46a886[0x0];if(!_0x3cb097[_0x1886('0x54')][_0x1886('0x59')])return;return db[_0x1886('0x6a')][_0x1886('0x53')]({'where':{'id':_0x3cb097['body'][_0x1886('0x59')],'role':_0x1886('0x5b')},'attributes':['id','name',_0x1886('0x6b'),_0x1886('0x6c'),_0x1886('0x6d')],'raw':!![]});}return null;})['then'](function(_0x26b090){if(!_0x26b090)return null;_0x2c758e[_0x1886('0x28')]['agent']=_0x26b090;return _0x2c758e;})[_0x1886('0x36')](function(_0x1b9f74){if(_0x1b9f74){if(_0x3cb097[_0x1886('0x54')][_0x1886('0x6e')]){_0x2c758e[_0x1886('0x28')][_0x1886('0x6f')]=util[_0x1886('0x58')](_0x1886('0x70'),_0x3cb097[_0x1886('0x5a')][_0x1886('0x38')]);_0x2c758e[_0x1886('0x28')][_0x1886('0x71')]=_0x2c758e['channel'];_0x2c758e[_0x1886('0x28')][_0x1886('0x72')]=_0x2c758e[_0x1886('0x71')];_0x2c758e[_0x1886('0x28')]['event']='accept';return respondWithRpcPromise(_0x1886('0x73'),'EventManager',{'event':_0x1886('0x74'),'message':_0x2c758e[_0x1886('0x28')]},client9002)['then'](function(){return _0x2c758e;});}return _0x2c758e;}return null;})['then'](respondWithResult(_0x52e351,null))['catch'](handleError(_0x52e351,null));};var interaction_log=require(_0x1886('0x15'))('sms-interactions');exports[_0x1886('0x75')]=function(_0x493b1e,_0xbf96f6,_0x2f1e31){var _0x58c6e9={'agent':{},'channel':_0x1886('0x76')};if(_0x493b1e[_0x1886('0x54')]['id']){delete _0x493b1e[_0x1886('0x54')]['id'];}_0x493b1e[_0x1886('0x54')][_0x1886('0x59')]=_0x493b1e[_0x1886('0x54')]['UserId']||_0x493b1e[_0x1886('0x5a')]['id'];_0x58c6e9['agent']['id']=_0x493b1e[_0x1886('0x54')]['UserId'];return db['SmsMessage'][_0x1886('0x53')]({'where':{'id':_0x493b1e[_0x1886('0x51')]['id'],'UserId':null}})[_0x1886('0x36')](handleEntityNotFound(_0xbf96f6,null))[_0x1886('0x36')](function(_0x473059){if(_0x473059){_0x58c6e9[_0x1886('0x28')]=_0x473059[_0x1886('0x5c')]({'plain':!![]});return db[_0x1886('0x5d')]['find']({'where':{'id':_0x473059[_0x1886('0x5e')]}});}return null;})[_0x1886('0x36')](handleEntityNotFound(_0xbf96f6,null))[_0x1886('0x36')](function(_0x46ddcc){if(_0x46ddcc){_0x58c6e9[_0x1886('0x61')]=_0x46ddcc[_0x1886('0x5c')]({'plain':!![]});interaction_log['info'](_0x1886('0x77'),_0x493b1e['user']['id'],_0x493b1e[_0x1886('0x5a')][_0x1886('0x38')],_0x493b1e['user'][_0x1886('0x78')],_0x58c6e9[_0x1886('0x61')]['id'],_0x493b1e[_0x1886('0x54')]?JSON[_0x1886('0x79')](_0x493b1e[_0x1886('0x54')]):_0x1886('0x7a'));return respondWithRpcPromise(_0x1886('0x7b'),_0x1886('0x7c'),_0x58c6e9);}return null;})[_0x1886('0x36')](function(_0x4926e5){var _0x491c7b=_0x1886('0x65')+_0x4926e5[_0x1886('0x28')][_0x1886('0x66')];return db[_0x1886('0x67')][_0x1886('0x3e')](_0x491c7b,{'type':db[_0x1886('0x68')][_0x1886('0x7d')][_0x1886('0x69')],'raw':!![]})['then'](function(_0x37e86b){return _0x37e86b;});})['then'](function(_0x768881){if(_0x768881){_0x58c6e9[_0x1886('0x28')][_0x1886('0x7e')]=_0x768881[0x0];if(!_0x493b1e['body'][_0x1886('0x59')])return;return db[_0x1886('0x6a')]['find']({'where':{'id':_0x493b1e[_0x1886('0x54')][_0x1886('0x59')],'role':_0x1886('0x5b')},'attributes':['id','name',_0x1886('0x6b'),_0x1886('0x6c'),_0x1886('0x6d')],'raw':!![]});}return null;})[_0x1886('0x36')](function(_0x56a01c){if(!_0x56a01c)return null;_0x58c6e9[_0x1886('0x28')][_0x1886('0x5b')]=_0x56a01c;return _0x58c6e9;})[_0x1886('0x36')](function(_0x3c4e7d){if(_0x3c4e7d){_0x3c4e7d['message'][_0x1886('0x6f')]=util[_0x1886('0x58')]('SIP/%s',_0x493b1e[_0x1886('0x5a')][_0x1886('0x38')]);_0x3c4e7d[_0x1886('0x28')][_0x1886('0x71')]=_0x58c6e9[_0x1886('0x71')];_0x3c4e7d[_0x1886('0x28')][_0x1886('0x72')]=_0x58c6e9[_0x1886('0x71')];_0x3c4e7d[_0x1886('0x28')][_0x1886('0x7f')]=_0x1886('0x75');respondWithRpcPromise(_0x1886('0x73'),_0x1886('0x73'),{'event':_0x1886('0x80'),'message':_0x3c4e7d[_0x1886('0x28')]},client9002);return _0x58c6e9;}return null;})['then'](respondWithResult(_0xbf96f6,null))[_0x1886('0x4f')](handleError(_0xbf96f6,null));};exports[_0x1886('0x2b')]=function(_0x192e35,_0x487a77,_0x23d75c){if(_0x192e35[_0x1886('0x54')]['id']){delete _0x192e35['body']['id'];}var _0x2686c4;return db[_0x1886('0x3c')][_0x1886('0x53')]({'where':{'id':_0x192e35[_0x1886('0x51')]['id']}})['then'](handleEntityNotFound(_0x487a77,null))[_0x1886('0x36')](function(_0x865550){if(_0x865550){_0x2686c4=_0x865550;return db[_0x1886('0x81')][_0x1886('0x53')]({'where':{'id':_0x865550[_0x1886('0x82')]}});}})['then'](handleEntityNotFound(_0x487a77,null))[_0x1886('0x36')](function(_0x1a0290){if(_0x1a0290){logger[_0x1886('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0x1886('0x83'),_0x1a0290[_0x1886('0x4b')],util[_0x1886('0x84')](_0x192e35[_0x1886('0x54')],{'showHidden':![],'depth':null}));switch(_0x1a0290[_0x1886('0x4b')]){case _0x1886('0x85'):if(_0x192e35[_0x1886('0x54')][_0x1886('0x86')]&&_0x192e35['body'][_0x1886('0x86')]===_0x2686c4[_0x1886('0x87')]){return _0x2686c4[_0x1886('0x35')]({'read':!![]});}else{logger[_0x1886('0x27')](_0x1886('0x88'),'status','twilio',util[_0x1886('0x84')](_0x192e35[_0x1886('0x54')],{'showHidden':![],'depth':null}));}break;case _0x1886('0x89'):if(_0x192e35[_0x1886('0x54')][_0x1886('0x8a')]&&_0x192e35[_0x1886('0x54')][_0x1886('0x8a')]===_0x2686c4[_0x1886('0x87')]&&_['indexOf'](['sent',_0x1886('0x8b')],_0x192e35[_0x1886('0x54')][_0x1886('0x8c')])>=0x0){return _0x2686c4[_0x1886('0x35')]({'read':!![]});}else{logger[_0x1886('0x27')](_0x1886('0x88'),_0x1886('0x2b'),_0x1886('0x8d'),util[_0x1886('0x84')](_0x192e35[_0x1886('0x54')],{'showHidden':![],'depth':null}));}break;case _0x1886('0x8e'):var _0xb9dc02=_0x192e35[_0x1886('0x54')][_0x1886('0x8f')][0x0];if(_0xb9dc02[_0x1886('0x2b')][_0x1886('0x90')]===_0x1886('0x91')){return _0x2686c4[_0x1886('0x35')]({'read':!![]});}else{logger['error'](_0x1886('0x88'),_0x1886('0x2b'),_0x1886('0x8e'),util['inspect'](_0x192e35[_0x1886('0x54')],{'showHidden':![],'depth':null}));}break;}return _0x2686c4;}})[_0x1886('0x36')](respondWithResult(_0x487a77,null))[_0x1886('0x4f')](handleError(_0x487a77,null));}; \ No newline at end of file +var _0xaebd=['sms','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','channel','event','accept','EventManager','../../config/logger','reject','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','motionChannel','rejectmessage','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./smsMessage.socket','register','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','end','status','json','offset','limit','count','set','Content-Range','apply','save','update','sendStatus','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','SmsMessage','includeAll','rows','show','keys','rawAttributes','find','create','body','params','destroy','describe','sms-interactions'];(function(_0x2e4e19,_0x493b50){var _0x9ba20b=function(_0x2f6456){while(--_0x2f6456){_0x2e4e19['push'](_0x2e4e19['shift']());}};_0x9ba20b(++_0x493b50);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x3562a8,_0x5cfc6c){_0x3562a8=_0x3562a8-0x0;var _0x1748c9=_0xaebd[_0x3562a8];return _0x1748c9;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];config['redis']=_[_0xdaeb('0x15')](config[_0xdaeb('0x16')],{'host':_0xdaeb('0x17'),'port':0x18eb});var socket=require(_0xdaeb('0x18'))(new Redis(config[_0xdaeb('0x16')]));require(_0xdaeb('0x19'))[_0xdaeb('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0xdaeb('0x1b')]({'port':0x232c});var client9002=jayson[_0xdaeb('0x1c')][_0xdaeb('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x18ec4e,_0x538a25,_0x4c3bf3,_0x24b898){return new BPromise(function(_0x4dd803,_0x47984b){var _0x42e509=_0x24b898||client;return _0x42e509[_0xdaeb('0x1d')](_0x18ec4e,_0x4c3bf3)[_0xdaeb('0x1e')](function(_0x1fe84e){logger[_0xdaeb('0x1f')](_0xdaeb('0x20'),_0x538a25,'request\x20sent');logger[_0xdaeb('0x21')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x538a25,_0xdaeb('0x22'),JSON[_0xdaeb('0x23')](_0x1fe84e));if(_0x1fe84e[_0xdaeb('0x24')]){if(_0x1fe84e['error']['code']===0x1f4){logger[_0xdaeb('0x24')](_0xdaeb('0x20'),_0x538a25,_0x1fe84e[_0xdaeb('0x24')][_0xdaeb('0x25')]);return _0x47984b(_0x1fe84e[_0xdaeb('0x24')]['message']);}logger['error'](_0xdaeb('0x20'),_0x538a25,_0x1fe84e[_0xdaeb('0x24')][_0xdaeb('0x25')]);return _0x4dd803(_0x1fe84e[_0xdaeb('0x24')][_0xdaeb('0x25')]);}else{logger['info'](_0xdaeb('0x20'),_0x538a25,'request\x20sent');_0x4dd803(_0x1fe84e[_0xdaeb('0x26')][_0xdaeb('0x25')]);}})[_0xdaeb('0x27')](function(_0x3b0770){logger[_0xdaeb('0x24')]('SmsMessage,\x20%s,\x20%s',_0x538a25,_0x3b0770);_0x47984b(_0x3b0770);});});}function respondWithStatusCode(_0x3a0b9c,_0x34fa21){_0x34fa21=_0x34fa21||0xcc;return function(_0x338687){if(_0x338687){return _0x3a0b9c['sendStatus'](_0x34fa21);}return _0x3a0b9c['status'](_0x34fa21)[_0xdaeb('0x28')]();};}function respondWithResult(_0x4e7f44,_0x5045f8){_0x5045f8=_0x5045f8||0xc8;return function(_0x16cee7){if(_0x16cee7){return _0x4e7f44[_0xdaeb('0x29')](_0x5045f8)[_0xdaeb('0x2a')](_0x16cee7);}};}function respondWithFilteredResult(_0x5eb7b5,_0x5e6f97){return function(_0x32966f){if(_0x32966f){var _0x440022=typeof _0x5e6f97[_0xdaeb('0x2b')]==='undefined'&&typeof _0x5e6f97[_0xdaeb('0x2c')]==='undefined';var _0x4da82d=_0x32966f[_0xdaeb('0x2d')];var _0x21f6cf=_0x440022?0x0:_0x5e6f97[_0xdaeb('0x2b')];var _0x28c15c=_0x440022?_0x32966f[_0xdaeb('0x2d')]:_0x5e6f97[_0xdaeb('0x2b')]+_0x5e6f97[_0xdaeb('0x2c')];var _0x5f1c84;if(_0x28c15c>=_0x4da82d){_0x28c15c=_0x4da82d;_0x5f1c84=0xc8;}else{_0x5f1c84=0xce;}_0x5eb7b5[_0xdaeb('0x29')](_0x5f1c84);return _0x5eb7b5[_0xdaeb('0x2e')](_0xdaeb('0x2f'),_0x21f6cf+'-'+_0x28c15c+'/'+_0x4da82d)[_0xdaeb('0x2a')](_0x32966f);}return null;};}function patchUpdates(_0x2c89ae){return function(_0x557ba9){try{jsonpatch[_0xdaeb('0x30')](_0x557ba9,_0x2c89ae,!![]);}catch(_0x3de2bd){return BPromise['reject'](_0x3de2bd);}return _0x557ba9[_0xdaeb('0x31')]();};}function saveUpdates(_0x1464ac,_0x304abe){return function(_0x2247d1){if(_0x2247d1){return _0x2247d1[_0xdaeb('0x32')](_0x1464ac)[_0xdaeb('0x1e')](function(_0x2e83a6){return _0x2e83a6;});}return null;};}function removeEntity(_0x2eb63d,_0x2aed8e){return function(_0x1cf04b){if(_0x1cf04b){return _0x1cf04b['destroy']()['then'](function(){_0x2eb63d[_0xdaeb('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1a45aa,_0x3dc058){return function(_0x164307){if(!_0x164307){_0x1a45aa[_0xdaeb('0x33')](0x194);}return _0x164307;};}function handleError(_0x1917e9,_0xfa78c1){_0xfa78c1=_0xfa78c1||0x1f4;return function(_0x5b2a73){logger[_0xdaeb('0x24')](_0x5b2a73[_0xdaeb('0x34')]);if(_0x5b2a73[_0xdaeb('0x35')]){delete _0x5b2a73['name'];}_0x1917e9[_0xdaeb('0x29')](_0xfa78c1)[_0xdaeb('0x36')](_0x5b2a73);};}exports[_0xdaeb('0x37')]=function(_0x104c90,_0x62fd11){var _0x168bd5={},_0x3c983d={},_0x5a0252={'count':0x0,'rows':[]};var _0x3afd0c=_[_0xdaeb('0x38')](db['SmsMessage']['rawAttributes'],function(_0x2ef310){return{'name':_0x2ef310[_0xdaeb('0x39')],'type':_0x2ef310['type'][_0xdaeb('0x3a')]};});_0x3c983d[_0xdaeb('0x3b')]=_['map'](_0x3afd0c,_0xdaeb('0x35'));_0x3c983d[_0xdaeb('0x3c')]=_['keys'](_0x104c90['query']);_0x3c983d[_0xdaeb('0x3d')]=_[_0xdaeb('0x3e')](_0x3c983d[_0xdaeb('0x3b')],_0x3c983d[_0xdaeb('0x3c')]);_0x168bd5[_0xdaeb('0x3f')]=_[_0xdaeb('0x3e')](_0x3c983d['model'],qs[_0xdaeb('0x40')](_0x104c90['query'][_0xdaeb('0x40')]));_0x168bd5['attributes']=_0x168bd5['attributes'][_0xdaeb('0x41')]?_0x168bd5['attributes']:_0x3c983d[_0xdaeb('0x3b')];if(!_0x104c90['query'][_0xdaeb('0x42')](_0xdaeb('0x43'))){_0x168bd5[_0xdaeb('0x2c')]=qs[_0xdaeb('0x2c')](_0x104c90['query'][_0xdaeb('0x2c')]);_0x168bd5['offset']=qs[_0xdaeb('0x2b')](_0x104c90[_0xdaeb('0x3c')][_0xdaeb('0x2b')]);}_0x168bd5['order']=qs[_0xdaeb('0x44')](_0x104c90[_0xdaeb('0x3c')][_0xdaeb('0x44')]);_0x168bd5[_0xdaeb('0x45')]=qs[_0xdaeb('0x3d')](_[_0xdaeb('0x46')](_0x104c90[_0xdaeb('0x3c')],_0x3c983d[_0xdaeb('0x3d')]),_0x3afd0c);if(_0x104c90[_0xdaeb('0x3c')][_0xdaeb('0x47')]){_0x168bd5[_0xdaeb('0x45')]=_[_0xdaeb('0x48')](_0x168bd5['where'],{'$or':_[_0xdaeb('0x38')](_0x3afd0c,function(_0x17fb13){if(_0x17fb13['type']!=='VIRTUAL'){var _0x3bfe4f={};_0x3bfe4f[_0x17fb13[_0xdaeb('0x35')]]={'$like':'%'+_0x104c90[_0xdaeb('0x3c')]['filter']+'%'};return _0x3bfe4f;}})});}_0x168bd5=_[_0xdaeb('0x48')]({},_0x168bd5,_0x104c90[_0xdaeb('0x49')]);var _0xc3671e={'where':_0x168bd5[_0xdaeb('0x45')]};return db[_0xdaeb('0x4a')][_0xdaeb('0x2d')](_0xc3671e)[_0xdaeb('0x1e')](function(_0x2e4327){_0x5a0252['count']=_0x2e4327;if(_0x104c90[_0xdaeb('0x3c')][_0xdaeb('0x4b')]){_0x168bd5['include']=[{'all':!![]}];}return db[_0xdaeb('0x4a')]['findAll'](_0x168bd5);})[_0xdaeb('0x1e')](function(_0x138d53){_0x5a0252[_0xdaeb('0x4c')]=_0x138d53;return _0x5a0252;})[_0xdaeb('0x1e')](respondWithFilteredResult(_0x62fd11,_0x168bd5))[_0xdaeb('0x27')](handleError(_0x62fd11,null));};exports[_0xdaeb('0x4d')]=function(_0x33a4d7,_0xfe595){var _0x2bd2fd={'raw':!![],'where':{'id':_0x33a4d7['params']['id']}},_0x4b8720={};_0x4b8720[_0xdaeb('0x3b')]=_[_0xdaeb('0x4e')](db[_0xdaeb('0x4a')][_0xdaeb('0x4f')]);_0x4b8720[_0xdaeb('0x3c')]=_[_0xdaeb('0x4e')](_0x33a4d7['query']);_0x4b8720[_0xdaeb('0x3d')]=_[_0xdaeb('0x3e')](_0x4b8720[_0xdaeb('0x3b')],_0x4b8720['query']);_0x2bd2fd[_0xdaeb('0x3f')]=_['intersection'](_0x4b8720[_0xdaeb('0x3b')],qs[_0xdaeb('0x40')](_0x33a4d7[_0xdaeb('0x3c')][_0xdaeb('0x40')]));_0x2bd2fd[_0xdaeb('0x3f')]=_0x2bd2fd[_0xdaeb('0x3f')]['length']?_0x2bd2fd['attributes']:_0x4b8720['model'];if(_0x33a4d7[_0xdaeb('0x3c')][_0xdaeb('0x4b')]){_0x2bd2fd['include']=[{'all':!![]}];}_0x2bd2fd=_['merge']({},_0x2bd2fd,_0x33a4d7['options']);return db[_0xdaeb('0x4a')][_0xdaeb('0x50')](_0x2bd2fd)[_0xdaeb('0x1e')](handleEntityNotFound(_0xfe595,null))[_0xdaeb('0x1e')](respondWithResult(_0xfe595,null))[_0xdaeb('0x27')](handleError(_0xfe595,null));};exports['create']=function(_0x619c7b,_0x4a8804){return db[_0xdaeb('0x4a')][_0xdaeb('0x51')](_0x619c7b[_0xdaeb('0x52')],{})[_0xdaeb('0x1e')](respondWithResult(_0x4a8804,0xc9))[_0xdaeb('0x27')](handleError(_0x4a8804,null));};exports[_0xdaeb('0x32')]=function(_0x51b98f,_0x583c1c){if(_0x51b98f[_0xdaeb('0x52')]['id']){delete _0x51b98f['body']['id'];}return db[_0xdaeb('0x4a')][_0xdaeb('0x50')]({'where':{'id':_0x51b98f[_0xdaeb('0x53')]['id']}})['then'](handleEntityNotFound(_0x583c1c,null))[_0xdaeb('0x1e')](saveUpdates(_0x51b98f[_0xdaeb('0x52')],null))[_0xdaeb('0x1e')](respondWithResult(_0x583c1c,null))[_0xdaeb('0x27')](handleError(_0x583c1c,null));};exports[_0xdaeb('0x54')]=function(_0x23a3f7,_0x1241c5){return db[_0xdaeb('0x4a')][_0xdaeb('0x50')]({'where':{'id':_0x23a3f7['params']['id']}})[_0xdaeb('0x1e')](handleEntityNotFound(_0x1241c5,null))[_0xdaeb('0x1e')](removeEntity(_0x1241c5,null))[_0xdaeb('0x27')](handleError(_0x1241c5,null));};exports[_0xdaeb('0x55')]=function(_0x4de959,_0x4879a1){return db[_0xdaeb('0x4a')][_0xdaeb('0x55')]()[_0xdaeb('0x1e')](respondWithResult(_0x4879a1,null))[_0xdaeb('0x27')](handleError(_0x4879a1,null));};var interaction_log=require('../../config/logger')(_0xdaeb('0x56'));exports['accept']=function(_0x1ff5b3,_0x4a0af5,_0x1e5406){var _0x58e6c7={'agent':{},'channel':_0xdaeb('0x57')};if(_0x1ff5b3[_0xdaeb('0x52')]['id']){delete _0x1ff5b3[_0xdaeb('0x52')]['id'];}_0x1ff5b3[_0xdaeb('0x52')][_0xdaeb('0x58')]=!![];_0x1ff5b3[_0xdaeb('0x52')][_0xdaeb('0x59')]=moment()[_0xdaeb('0x5a')](_0xdaeb('0x5b'));_0x1ff5b3[_0xdaeb('0x52')][_0xdaeb('0x5c')]=_0x1ff5b3[_0xdaeb('0x52')]['UserId']||_0x1ff5b3[_0xdaeb('0x5d')]['id'];_0x58e6c7[_0xdaeb('0x5e')]['id']=_0x1ff5b3['body'][_0xdaeb('0x5c')];return db['SmsMessage'][_0xdaeb('0x50')]({'where':{'id':_0x1ff5b3[_0xdaeb('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x4a0af5,null))[_0xdaeb('0x1e')](saveUpdates(_0x1ff5b3[_0xdaeb('0x52')],null))[_0xdaeb('0x1e')](function(_0x285815){if(_0x285815){_0x58e6c7[_0xdaeb('0x25')]=_0x285815[_0xdaeb('0x5f')]({'plain':!![]});return db['SmsInteraction'][_0xdaeb('0x50')]({'where':{'id':_0x285815[_0xdaeb('0x60')]}});}return null;})[_0xdaeb('0x1e')](handleEntityNotFound(_0x4a0af5,null))[_0xdaeb('0x1e')](function(_0x41cf4c){if(_0x41cf4c){return _0x41cf4c[_0xdaeb('0x32')]({'UserId':_0x1ff5b3[_0xdaeb('0x52')]['UserId'],'read1stAt':_[_0xdaeb('0x61')](_0x41cf4c[_0xdaeb('0x62')])?moment()[_0xdaeb('0x5a')](_0xdaeb('0x5b')):undefined});}return null;})[_0xdaeb('0x1e')](function(_0x4bb961){if(_0x4bb961){_0x58e6c7[_0xdaeb('0x63')]=_0x4bb961[_0xdaeb('0x5f')]({'plain':!![]});interaction_log[_0xdaeb('0x1f')](_0xdaeb('0x64'),_0x1ff5b3['user']['id'],_0x1ff5b3[_0xdaeb('0x5d')][_0xdaeb('0x35')],_0x1ff5b3[_0xdaeb('0x5d')]['role'],_0x58e6c7[_0xdaeb('0x63')]['id'],_0x1ff5b3[_0xdaeb('0x52')]?JSON['stringify'](_0x1ff5b3[_0xdaeb('0x52')]):_0xdaeb('0x65'));return respondWithRpcPromise(_0xdaeb('0x66'),_0xdaeb('0x67'),_0x58e6c7);}return null;})['then'](function(_0x1ad405){var _0x549e4c=_0xdaeb('0x68')+_0x1ad405[_0xdaeb('0x25')][_0xdaeb('0x69')];return db[_0xdaeb('0x6a')][_0xdaeb('0x3c')](_0x549e4c,{'type':db[_0xdaeb('0x6b')][_0xdaeb('0x6c')][_0xdaeb('0x6d')],'raw':!![]})['then'](function(_0x16e76a){return _0x16e76a;});})[_0xdaeb('0x1e')](function(_0x257e5b){if(_0x257e5b){_0x58e6c7[_0xdaeb('0x25')][_0xdaeb('0x6e')]=_0x257e5b[0x0];if(!_0x1ff5b3[_0xdaeb('0x52')][_0xdaeb('0x5c')])return;return db[_0xdaeb('0x6f')]['find']({'where':{'id':_0x1ff5b3['body'][_0xdaeb('0x5c')],'role':_0xdaeb('0x5e')},'attributes':['id',_0xdaeb('0x35'),_0xdaeb('0x70'),_0xdaeb('0x71'),_0xdaeb('0x72')],'raw':!![]});}return null;})['then'](function(_0xce453d){if(!_0xce453d)return null;_0x58e6c7[_0xdaeb('0x25')][_0xdaeb('0x5e')]=_0xce453d;return _0x58e6c7;})[_0xdaeb('0x1e')](function(_0x352772){if(_0x352772){if(_0x1ff5b3['body']['manual']){_0x58e6c7[_0xdaeb('0x25')][_0xdaeb('0x73')]=util[_0xdaeb('0x5a')]('SIP/%s',_0x1ff5b3[_0xdaeb('0x5d')][_0xdaeb('0x35')]);_0x58e6c7[_0xdaeb('0x25')][_0xdaeb('0x74')]=_0x58e6c7[_0xdaeb('0x74')];_0x58e6c7[_0xdaeb('0x25')]['motionChannel']=_0x58e6c7[_0xdaeb('0x74')];_0x58e6c7['message'][_0xdaeb('0x75')]=_0xdaeb('0x76');return respondWithRpcPromise(_0xdaeb('0x77'),_0xdaeb('0x77'),{'event':'acceptmessage','message':_0x58e6c7[_0xdaeb('0x25')]},client9002)[_0xdaeb('0x1e')](function(){return _0x58e6c7;});}return _0x58e6c7;}return null;})[_0xdaeb('0x1e')](respondWithResult(_0x4a0af5,null))['catch'](handleError(_0x4a0af5,null));};var interaction_log=require(_0xdaeb('0x78'))(_0xdaeb('0x56'));exports[_0xdaeb('0x79')]=function(_0x128408,_0x10c7d7,_0x59b7f6){var _0x4efc54={'agent':{},'channel':'sms'};if(_0x128408[_0xdaeb('0x52')]['id']){delete _0x128408['body']['id'];}_0x128408[_0xdaeb('0x52')][_0xdaeb('0x5c')]=_0x128408['body'][_0xdaeb('0x5c')]||_0x128408['user']['id'];_0x4efc54[_0xdaeb('0x5e')]['id']=_0x128408[_0xdaeb('0x52')][_0xdaeb('0x5c')];return db[_0xdaeb('0x4a')][_0xdaeb('0x50')]({'where':{'id':_0x128408[_0xdaeb('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x10c7d7,null))[_0xdaeb('0x1e')](function(_0x411828){if(_0x411828){_0x4efc54[_0xdaeb('0x25')]=_0x411828['get']({'plain':!![]});return db[_0xdaeb('0x7a')][_0xdaeb('0x50')]({'where':{'id':_0x411828[_0xdaeb('0x60')]}});}return null;})['then'](handleEntityNotFound(_0x10c7d7,null))[_0xdaeb('0x1e')](function(_0x4eda32){if(_0x4eda32){_0x4efc54[_0xdaeb('0x63')]=_0x4eda32[_0xdaeb('0x5f')]({'plain':!![]});interaction_log[_0xdaeb('0x1f')](_0xdaeb('0x7b'),_0x128408['user']['id'],_0x128408['user'][_0xdaeb('0x35')],_0x128408[_0xdaeb('0x5d')]['role'],_0x4efc54[_0xdaeb('0x63')]['id'],_0x128408[_0xdaeb('0x52')]?JSON[_0xdaeb('0x23')](_0x128408[_0xdaeb('0x52')]):_0xdaeb('0x65'));return respondWithRpcPromise(_0xdaeb('0x7c'),_0xdaeb('0x7d'),_0x4efc54);}return null;})[_0xdaeb('0x1e')](function(_0x4ccb03){var _0x26132a=_0xdaeb('0x68')+_0x4ccb03[_0xdaeb('0x25')][_0xdaeb('0x69')];return db[_0xdaeb('0x6a')][_0xdaeb('0x3c')](_0x26132a,{'type':db[_0xdaeb('0x6b')]['QueryTypes'][_0xdaeb('0x6d')],'raw':!![]})[_0xdaeb('0x1e')](function(_0xca2b76){return _0xca2b76;});})[_0xdaeb('0x1e')](function(_0x250608){if(_0x250608){_0x4efc54[_0xdaeb('0x25')]['contact']=_0x250608[0x0];if(!_0x128408[_0xdaeb('0x52')][_0xdaeb('0x5c')])return;return db['User']['find']({'where':{'id':_0x128408[_0xdaeb('0x52')][_0xdaeb('0x5c')],'role':_0xdaeb('0x5e')},'attributes':['id','name',_0xdaeb('0x70'),_0xdaeb('0x71'),_0xdaeb('0x72')],'raw':!![]});}return null;})[_0xdaeb('0x1e')](function(_0x38171d){if(!_0x38171d)return null;_0x4efc54['message'][_0xdaeb('0x5e')]=_0x38171d;return _0x4efc54;})[_0xdaeb('0x1e')](function(_0x4ed05c){if(_0x4ed05c){_0x4ed05c[_0xdaeb('0x25')][_0xdaeb('0x73')]=util['format']('SIP/%s',_0x128408[_0xdaeb('0x5d')][_0xdaeb('0x35')]);_0x4ed05c[_0xdaeb('0x25')][_0xdaeb('0x74')]=_0x4efc54[_0xdaeb('0x74')];_0x4ed05c[_0xdaeb('0x25')][_0xdaeb('0x7e')]=_0x4efc54[_0xdaeb('0x74')];_0x4ed05c[_0xdaeb('0x25')][_0xdaeb('0x75')]=_0xdaeb('0x79');respondWithRpcPromise(_0xdaeb('0x77'),'EventManager',{'event':_0xdaeb('0x7f'),'message':_0x4ed05c[_0xdaeb('0x25')]},client9002);return _0x4efc54;}return null;})['then'](respondWithResult(_0x10c7d7,null))['catch'](handleError(_0x10c7d7,null));};exports[_0xdaeb('0x29')]=function(_0x3c096d,_0x2a7af6,_0x1c69b8){if(_0x3c096d['body']['id']){delete _0x3c096d[_0xdaeb('0x52')]['id'];}var _0x124102;return db[_0xdaeb('0x4a')][_0xdaeb('0x50')]({'where':{'id':_0x3c096d[_0xdaeb('0x53')]['id']}})['then'](handleEntityNotFound(_0x2a7af6,null))['then'](function(_0x20cc70){if(_0x20cc70){_0x124102=_0x20cc70;return db[_0xdaeb('0x80')][_0xdaeb('0x50')]({'where':{'id':_0x20cc70[_0xdaeb('0x81')]}});}})[_0xdaeb('0x1e')](handleEntityNotFound(_0x2a7af6,null))[_0xdaeb('0x1e')](function(_0x440798){if(_0x440798){logger['debug']('SmsMessage,\x20%s,\x20%s,\x20%s','status',_0xdaeb('0x82'),_0x440798['type'],util[_0xdaeb('0x83')](_0x3c096d['body'],{'showHidden':![],'depth':null}));switch(_0x440798['type']){case _0xdaeb('0x84'):if(_0x3c096d['body'][_0xdaeb('0x85')]&&_0x3c096d[_0xdaeb('0x52')][_0xdaeb('0x85')]===_0x124102[_0xdaeb('0x86')]){return _0x124102[_0xdaeb('0x32')]({'read':!![]});}else{logger[_0xdaeb('0x24')](_0xdaeb('0x87'),_0xdaeb('0x29'),_0xdaeb('0x84'),util[_0xdaeb('0x83')](_0x3c096d[_0xdaeb('0x52')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x3c096d[_0xdaeb('0x52')]['MessageUUID']&&_0x3c096d[_0xdaeb('0x52')]['MessageUUID']===_0x124102['messageId']&&_[_0xdaeb('0x88')]([_0xdaeb('0x89'),_0xdaeb('0x8a')],_0x3c096d[_0xdaeb('0x52')][_0xdaeb('0x8b')])>=0x0){return _0x124102[_0xdaeb('0x32')]({'read':!![]});}else{logger[_0xdaeb('0x24')](_0xdaeb('0x87'),_0xdaeb('0x29'),_0xdaeb('0x8c'),util[_0xdaeb('0x83')](_0x3c096d[_0xdaeb('0x52')],{'showHidden':![],'depth':null}));}break;case _0xdaeb('0x8d'):var _0x671eea=_0x3c096d[_0xdaeb('0x52')][_0xdaeb('0x8e')][0x0];if(_0x671eea[_0xdaeb('0x29')][_0xdaeb('0x8f')]==='DELIVERED'){return _0x124102[_0xdaeb('0x32')]({'read':!![]});}else{logger[_0xdaeb('0x24')](_0xdaeb('0x87'),'status',_0xdaeb('0x8d'),util['inspect'](_0x3c096d[_0xdaeb('0x52')],{'showHidden':![],'depth':null}));}break;}return _0x124102;}})['then'](respondWithResult(_0x2a7af6,null))[_0xdaeb('0x27')](handleError(_0x2a7af6,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index ad4838e..8ac0fd9 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 _0x006f=['SmsMessage','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0xe8712b,_0x42aa8c){var _0xf5bcdc=function(_0x1f45fe){while(--_0x1f45fe){_0xe8712b['push'](_0xe8712b['shift']());}};_0xf5bcdc(++_0x42aa8c);}(_0x006f,0x75));var _0xf006=function(_0x44dc6f,_0x1f128b){_0x44dc6f=_0x44dc6f-0x0;var _0x5c8d69=_0x006f[_0x44dc6f];return _0x5c8d69;};'use strict';var EventEmitter=require(_0xf006('0x0'));var SmsMessage=require(_0xf006('0x1'))['db'][_0xf006('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xf006('0x3')};function emitEvent(_0x2ac2d2){return function(_0x1928d6,_0x113e32,_0x2bb237){SmsMessageEvents['emit'](_0x2ac2d2+':'+_0x1928d6['id'],_0x1928d6);SmsMessageEvents[_0xf006('0x4')](_0x2ac2d2,_0x1928d6);_0x2bb237(null);};}for(var e in events){if(events[_0xf006('0x5')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xf006('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0x7a2a=['SmsMessage','setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x1bbd8a,_0xdf8df7){var _0x1465e1=function(_0x112190){while(--_0x112190){_0x1bbd8a['push'](_0x1bbd8a['shift']());}};_0x1465e1(++_0xdf8df7);}(_0x7a2a,0x8e));var _0xa7a2=function(_0x28e984,_0x9ddfb6){_0x28e984=_0x28e984-0x0;var _0x3938bb=_0x7a2a[_0x28e984];return _0x3938bb;};'use strict';var EventEmitter=require(_0xa7a2('0x0'));var SmsMessage=require(_0xa7a2('0x1'))['db'][_0xa7a2('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0xa7a2('0x3')](0x0);var events={'afterCreate':_0xa7a2('0x4'),'afterUpdate':_0xa7a2('0x5'),'afterDestroy':'remove'};function emitEvent(_0x53a9d6){return function(_0x38b063,_0x1f31bd,_0x35ff16){SmsMessageEvents[_0xa7a2('0x6')](_0x53a9d6+':'+_0x38b063['id'],_0x38b063);SmsMessageEvents['emit'](_0x53a9d6,_0x38b063);_0x35ff16(null);};}for(var e in events){if(events[_0xa7a2('0x7')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0xa7a2('0x8')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 91d0bf2..63da4ab 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 _0xcc37=['token','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','/status?token=','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','csc','crypto','apiKey','login','text','timestamp','sort','md5','digest','hex','/external/get/send.php?','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','/messages','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','https://api.intelepeer.com/_rest/v4/app/sms/mdr','message','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','findOne','then','catch','error','secret','find','SmsAccountId','type','twilio','phone','accountSid','messages','create','remote','sid','update','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','password','smsMethod','login?username=','&password=','GET','split','POST','user_key','total_sent','internal_order_id','read','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','connectel','authToken','https://smsapi.connectel.se/api/v2/send/','requestid','deliveryReport','Missing\x20parameters:\x20authToken','clicksend','senderString','format','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','/api/sms/messages/'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0xcc37,0xa7));var _0x7cc3=function(_0x372e0c,_0x31b172){_0x372e0c=_0x372e0c-0x0;var _0x3ad8ed=_0xcc37[_0x372e0c];return _0x3ad8ed;};'use strict';var _=require('lodash');var util=require(_0x7cc3('0x0'));var logger=require(_0x7cc3('0x1'))('api');var moment=require(_0x7cc3('0x2'));var BPromise=require(_0x7cc3('0x3'));var rp=require(_0x7cc3('0x4'));var fs=require('fs');var path=require(_0x7cc3('0x5'));var rimraf=require(_0x7cc3('0x6'));var config=require(_0x7cc3('0x7'));var attributes=require('./smsMessage.attributes');module[_0x7cc3('0x8')]=function(_0xecfb40,_0x56d567){return _0xecfb40[_0x7cc3('0x9')](_0x7cc3('0xa'),attributes,{'tableName':_0x7cc3('0xb'),'paranoid':![],'indexes':[{'name':_0x7cc3('0xc'),'fields':[_0x7cc3('0xc')]},{'name':_0x7cc3('0xd'),'fields':[_0x7cc3('0xe')],'type':_0x7cc3('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xf2ab9,_0x631d0,_0x52537f){var _0x517ed8=_0xecfb40[_0x7cc3('0x10')];var _0x438b59=_0xf2ab9[_0x7cc3('0x11')]({'plain':!![]});if(_0x438b59['direction']['toLowerCase']()==='in'||_0x438b59[_0x7cc3('0x12')][_0x7cc3('0x13')]()===_0x7cc3('0x14')&&!_0x438b59['secret']&&!_[_0x7cc3('0x15')](_0x438b59[_0x7cc3('0x16')])&&!_[_0x7cc3('0x15')](_0x438b59[_0x7cc3('0x17')])){_0x517ed8['SmsInteraction'][_0x7cc3('0x18')]({'where':{'id':_0x438b59[_0x7cc3('0x17')]}})[_0x7cc3('0x19')](function(_0x3e4aa1){if(_0x3e4aa1){_0x3e4aa1['update']({'lastMsgAt':_0x438b59['createdAt'],'lastMsgDirection':_0x438b59[_0x7cc3('0x12')][_0x7cc3('0x13')]()});}})[_0x7cc3('0x1a')](function(_0x3b046e){console[_0x7cc3('0x1b')](_0x3b046e);});}if(_0x438b59[_0x7cc3('0x12')]==='out'&&!_0x438b59[_0x7cc3('0x1c')]){var _0xf0bc1f;_0x517ed8['SmsAccount'][_0x7cc3('0x1d')]({'where':{'id':_0x438b59[_0x7cc3('0x1e')]},'raw':!![]})[_0x7cc3('0x19')](function(_0x513826){_0xf0bc1f=_0x513826;if(_0xf0bc1f&&_0xf0bc1f[_0x7cc3('0x1f')]){switch(_0xf0bc1f[_0x7cc3('0x1f')]){case _0x7cc3('0x20'):var _0x3e341b=require(_0x7cc3('0x20'));if(_0xf0bc1f['accountSid']&&_0xf0bc1f['authToken']&&_0xf0bc1f[_0x7cc3('0x21')]){var _0x30869e=new _0x3e341b(_0xf0bc1f[_0x7cc3('0x22')],_0xf0bc1f['authToken']);_0x30869e[_0x7cc3('0x23')][_0x7cc3('0x24')]({'body':_0x438b59[_0x7cc3('0xe')],'to':_0x438b59[_0x7cc3('0x21')],'from':_0xf0bc1f[_0x7cc3('0x21')],'statusCallback':_0xf0bc1f[_0x7cc3('0x25')]+'/api/sms/messages/'+_0x438b59['id']+'/status?token='+_0xf0bc1f['token']})[_0x7cc3('0x19')](function(_0x35edb3){if(_0x35edb3[_0x7cc3('0x26')]){return _0xf2ab9[_0x7cc3('0x27')]({'messageId':_0x35edb3[_0x7cc3('0x26')]});}})[_0x7cc3('0x1a')](function(_0x2da7f4){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7cc3('0x20'),util[_0x7cc3('0x28')](_0x2da7f4,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc3('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','twilio',_0x7cc3('0x29'));}break;case _0x7cc3('0x2a'):var _0x5193e2=_0x7cc3('0x2b');if(_0xf0bc1f[_0x7cc3('0x2c')]&&_0xf0bc1f[_0x7cc3('0x2d')]){var _0x58e3e6={'recipient':[_0x438b59[_0x7cc3('0x21')]],'message':_0x438b59[_0x7cc3('0xe')],'message_type':_0xf0bc1f['smsMethod']};if(_0xf0bc1f[_0x7cc3('0x2e')]&&_0xf0bc1f[_0x7cc3('0x2e')]!=='SI'){_0x58e3e6['sender']=_0xf0bc1f[_0x7cc3('0x21')];}var _0x318e28={'url':_0x5193e2+_0x7cc3('0x2f')+_0xf0bc1f[_0x7cc3('0x2c')]+_0x7cc3('0x30')+_0xf0bc1f[_0x7cc3('0x2d')],'method':_0x7cc3('0x31')};rp(_0x318e28)[_0x7cc3('0x19')](function(_0x15caad){var _0x54c5ee=_0x15caad[_0x7cc3('0x32')](';');var _0x1511dc={'user_key':_0x54c5ee[0x0],'session_key':_0x54c5ee[0x1]};_0x318e28={'url':_0x5193e2+'sms','method':_0x7cc3('0x33'),'headers':{'user_key':_0x1511dc[_0x7cc3('0x34')],'Session_key':_0x1511dc['session_key']},'json':!![],'body':_0x58e3e6};return rp(_0x318e28);})['then'](function(_0x31023e){if(_0x31023e[_0x7cc3('0x35')]>=0x1){var _0x16c22b={'messageId':_0x31023e[_0x7cc3('0x36')]};if(_0xf0bc1f[_0x7cc3('0x2e')]!=='GP'||!_0xf0bc1f['deliveryReport']){_0x16c22b[_0x7cc3('0x37')]=!![];}return _0xf2ab9[_0x7cc3('0x27')](_0x16c22b);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7cc3('0x2a'),util[_0x7cc3('0x28')](_0x31023e,{'showHidden':![],'depth':null}));}})[_0x7cc3('0x1a')](function(_0xd7627d){return logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),_0x7cc3('0x39'),_0x7cc3('0x2a'),util['inspect'](_0xd7627d,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),'afterCreate',_0x7cc3('0x2a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x7cc3('0x3a'):if(_0xf0bc1f[_0x7cc3('0x3b')]){var _0x1d4328={'recipient':_0x438b59[_0x7cc3('0x21')],'message':_0x438b59[_0x7cc3('0xe')],'sender':_0xf0bc1f['senderString']||_0xf0bc1f[_0x7cc3('0x21')],'authorization':_0xf0bc1f['authToken']};var _0x631d0={'method':_0x7cc3('0x33'),'uri':_0x7cc3('0x3c'),'body':_0x1d4328,'json':!![]};rp(_0x631d0)['then'](function(_0x36c0d2){var _0x47b44d={'messageId':_0x36c0d2[_0x7cc3('0x3d')]};if(!_0xf0bc1f[_0x7cc3('0x3e')]){_0x47b44d[_0x7cc3('0x37')]=!![];}return _0xf2ab9['update'](_0x47b44d);})['catch'](function(_0x139d69){logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),_0x7cc3('0x39'),'connectel',util[_0x7cc3('0x28')](_0x139d69,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),'afterCreate',_0x7cc3('0x3a'),_0x7cc3('0x3f'));}break;case _0x7cc3('0x40'):if(_0xf0bc1f[_0x7cc3('0x2c')]&&_0xf0bc1f['password']){var _0x1d4328={'messages':[{'source':'xCALLY\x20Motion','to':_0x438b59[_0x7cc3('0x21')],'body':_0x438b59[_0x7cc3('0xe')],'from':_0xf0bc1f[_0x7cc3('0x41')]||_0xf0bc1f[_0x7cc3('0x21')]}]};var _0x16751d=util[_0x7cc3('0x42')]('%s:%s',_0xf0bc1f[_0x7cc3('0x2c')],_0xf0bc1f[_0x7cc3('0x2d')]);var _0x631d0={'method':_0x7cc3('0x33'),'uri':_0x7cc3('0x43'),'body':_0x1d4328,'headers':{'Authorization':util[_0x7cc3('0x42')](_0x7cc3('0x44'),new Buffer(_0x16751d)[_0x7cc3('0x45')](_0x7cc3('0x46')))},'json':!![]};rp(_0x631d0)[_0x7cc3('0x19')](function(_0x152198){if(_0x152198['http_code']>=0xc8&&_0x152198[_0x7cc3('0x47')]<=0xce){if(_0x152198[_0x7cc3('0x48')]&&_0x152198[_0x7cc3('0x48')][_0x7cc3('0x49')]>0x0){var _0x19ed1c=_[_0x7cc3('0x4a')](_0x152198[_0x7cc3('0x48')][_0x7cc3('0x23')]);var _0x659bff={'messageId':_0x19ed1c[_0x7cc3('0x4b')]};if(!_0xf0bc1f[_0x7cc3('0x3e')]){_0x659bff[_0x7cc3('0x37')]=!![];}return _0xf2ab9[_0x7cc3('0x27')](_0x659bff);}else{logger['error'](_0x7cc3('0x38'),_0x7cc3('0x39'),_0x7cc3('0x4c'),util[_0x7cc3('0x28')](_0x152198,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x7cc3('0x38'),'afterCreate','clickSend',util[_0x7cc3('0x28')](_0x152198,{'showHidden':![],'depth':null}));}})[_0x7cc3('0x1a')](function(_0x142c84){logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),_0x7cc3('0x39'),_0x7cc3('0x4c'),util[_0x7cc3('0x28')](_0x142c84,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),_0x7cc3('0x39'),_0x7cc3('0x4c'),_0x7cc3('0x4d'));}break;case _0x7cc3('0x4e'):if(_0xf0bc1f[_0x7cc3('0x4f')]&&_0xf0bc1f[_0x7cc3('0x3b')]){var _0x1d4328={'dst':_0x438b59[_0x7cc3('0x21')],'text':_0x438b59[_0x7cc3('0xe')],'src':_0xf0bc1f[_0x7cc3('0x41')]||_0xf0bc1f[_0x7cc3('0x21')],'url':_0xf0bc1f[_0x7cc3('0x25')]+_0x7cc3('0x50')+_0x438b59['id']+'/status?token='+_0xf0bc1f[_0x7cc3('0x51')]};var _0x16751d=util['format'](_0x7cc3('0x52'),_0xf0bc1f[_0x7cc3('0x4f')],_0xf0bc1f[_0x7cc3('0x3b')]);var _0x631d0={'method':'POST','uri':util[_0x7cc3('0x42')](_0x7cc3('0x53'),_0xf0bc1f[_0x7cc3('0x4f')]),'body':_0x1d4328,'headers':{'Authorization':util[_0x7cc3('0x42')]('Basic\x20%s',new Buffer(_0x16751d)['toString'](_0x7cc3('0x46')))},'json':!![]};rp(_0x631d0)[_0x7cc3('0x19')](function(_0xa7c1a3){var _0x5f7d2c={'messageId':_0xa7c1a3['message_uuid'][0x0]};return _0xf2ab9['update'](_0x5f7d2c);})[_0x7cc3('0x1a')](function(_0x5a72f1){logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),'afterCreate','plivo',util['inspect'](_0x5a72f1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7cc3('0x38'),_0x7cc3('0x39'),_0x7cc3('0x4e'),_0x7cc3('0x54'));}break;case _0x7cc3('0x55'):if(_0xf0bc1f[_0x7cc3('0x2c')]&&_0xf0bc1f[_0x7cc3('0x2d')]){if(_0xf0bc1f[_0x7cc3('0x56')]){var _0x16d4c4={'method':_0x7cc3('0x33'),'uri':_0xf0bc1f[_0x7cc3('0x56')]+_0x7cc3('0x57'),'body':{'username':_0xf0bc1f[_0x7cc3('0x2c')],'password':_0xf0bc1f['password']},'json':!![]};return rp(_0x16d4c4)[_0x7cc3('0x19')](function(_0xdc6afa){var _0x433c40={'method':'POST','uri':_0xf0bc1f['baseUrl']+_0x7cc3('0x58'),'body':{'messages':[{'from':_0xf0bc1f[_0x7cc3('0x21')],'destinations':[{'to':_0x438b59[_0x7cc3('0x21')]}],'text':_0x438b59[_0x7cc3('0xe')],'notifyUrl':_0xf0bc1f[_0x7cc3('0x25')]+_0x7cc3('0x50')+_0x438b59['id']+_0x7cc3('0x59')+_0xf0bc1f[_0x7cc3('0x51')],'notifyContentType':_0x7cc3('0x5a'),'callbackData':_0xf0bc1f['phone']+';'+_0x438b59['body']}]},'headers':{'Authorization':_0x7cc3('0x5b')+_0xdc6afa['token']},'json':!![]};return rp(_0x433c40)[_0x7cc3('0x19')](function(_0x4541b6){if(_0x4541b6['messages']){var _0x4dfadf={'messageId':_0x4541b6[_0x7cc3('0x23')][0x0][_0x7cc3('0xc')]};if(!_0xf0bc1f[_0x7cc3('0x3e')]){_0x4dfadf[_0x7cc3('0x37')]=!![];}return _0xf2ab9['update'](_0x4dfadf);}else{return logger[_0x7cc3('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc3('0x39'),_0x7cc3('0x55'),util[_0x7cc3('0x28')](_0x4541b6,{'showHidden':![],'depth':null}));}});})[_0x7cc3('0x1a')](function(_0x36ba35){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc3('0x39'),_0x7cc3('0x55'),util[_0x7cc3('0x28')](_0x36ba35,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc3('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc3('0x39'),'infobip',_0x7cc3('0x5c'));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc3('0x39'),_0x7cc3('0x55'),_0x7cc3('0x4d'));}break;case _0x7cc3('0x5d'):var _0x26d9d8=require(_0x7cc3('0x5e'));if(_0xf0bc1f[_0x7cc3('0x5f')]){var _0x544a08={};_0x544a08[_0x7cc3('0x60')]=_0xf0bc1f[_0x7cc3('0x2c')];_0x544a08[_0x7cc3('0x21')]=_0x438b59[_0x7cc3('0x21')];_0x544a08['sender']=_0xf0bc1f['phone'];_0x544a08[_0x7cc3('0x61')]=_0x438b59[_0x7cc3('0xe')];_0x544a08[_0x7cc3('0x62')]=+new Date();var _0x5dedbd='';var _0x4f08af='';var _0x69ed06=Object['keys'](_0x544a08);_0x69ed06[_0x7cc3('0x63')]();for(var _0x83b07a=0x0;_0x83b07a<_0x69ed06['length'];_0x83b07a++){if(_0x5dedbd!=''){_0x5dedbd+='&';}_0x5dedbd+=_0x69ed06[_0x83b07a]+'='+encodeURIComponent(_0x544a08[_0x69ed06[_0x83b07a]]);_0x4f08af+=_0x544a08[_0x69ed06[_0x83b07a]];}_0x4f08af+=_0xf0bc1f['apiKey'];_0x4f08af=_0x26d9d8['createHash'](_0x7cc3('0x64'))[_0x7cc3('0x27')](_0x4f08af)[_0x7cc3('0x65')](_0x7cc3('0x66'));if(_0x5dedbd!==''){_0x5dedbd+='&';}_0x5dedbd+='signature='+_0x4f08af;var _0x318e28={'method':'GET','uri':_0xf0bc1f[_0x7cc3('0x56')]+_0x7cc3('0x67')+_0x5dedbd,'json':!![]};return rp(_0x318e28)[_0x7cc3('0x19')](function(_0x3cbf02){var _0x136251=Object['keys'](_0x3cbf02);if(_0x3cbf02[_0x136251[0x0]][_0x7cc3('0x1b')]&&parseInt(_0x3cbf02[_0x136251[0x0]]['error'])===0x0){var _0x4b1bdd={'messageId':_0x3cbf02[_0x136251[0x0]]['id_sms']};if(!_0xf0bc1f[_0x7cc3('0x3e')]){_0x4b1bdd[_0x7cc3('0x37')]=!![];}return _0xf2ab9[_0x7cc3('0x27')](_0x4b1bdd);}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7cc3('0x5d'),util[_0x7cc3('0x28')](_0x3cbf02[_0x7cc3('0x1b')],{'showHidden':![],'depth':null}));}})[_0x7cc3('0x1a')](function(_0x8e5ebc){return logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),'afterCreate','csc',util[_0x7cc3('0x28')](_0x8e5ebc,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc3('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc3('0x39'),_0x7cc3('0x5d'),_0x7cc3('0x68'));}break;case _0x7cc3('0x69'):if(_0xf0bc1f['apiKey']){var _0x49f797={'method':_0x7cc3('0x33'),'uri':_0x7cc3('0x6a'),'headers':{'Authorization':_0xf0bc1f[_0x7cc3('0x5f')]},'body':{'content':_0x438b59[_0x7cc3('0xe')],'to':[_0x438b59[_0x7cc3('0x21')]],'from':_0xf0bc1f[_0x7cc3('0x21')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x49f797)[_0x7cc3('0x19')](function(_0x2890a7){if(!_0x2890a7[_0x7cc3('0x1b')]){var _0x2971c7={'messageId':_0x2890a7['messages'][0x0][_0x7cc3('0x6b')]};if(!_0xf0bc1f['deliveryReport']){_0x2971c7[_0x7cc3('0x37')]=!![];}return _0xf2ab9['update'](_0x2971c7);}else{return logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),_0x7cc3('0x39'),'clickatell',util[_0x7cc3('0x28')](_0x2890a7[_0x7cc3('0x1b')],{'showHidden':![],'depth':null}));}})[_0x7cc3('0x1a')](function(_0xe1c82){return logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),_0x7cc3('0x39'),_0x7cc3('0x69'),util[_0x7cc3('0x28')](_0xe1c82,{'showHidden':![],'depth':null}));});}else{logger[_0x7cc3('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7cc3('0x69'),_0x7cc3('0x68'));}break;case _0x7cc3('0x6c'):if(_0xf0bc1f['username']&&_0xf0bc1f[_0x7cc3('0x2d')]){var _0x16751d=util[_0x7cc3('0x42')](_0x7cc3('0x52'),_0xf0bc1f[_0x7cc3('0x2c')],_0xf0bc1f['password']);var _0x631d0={'method':_0x7cc3('0x33'),'uri':_0x7cc3('0x6d')+_0xf0bc1f[_0x7cc3('0x6e')]+_0x7cc3('0x6f'),'body':{'to':[_0x438b59[_0x7cc3('0x21')]],'text':_0x438b59[_0x7cc3('0xe')],'from':_0xf0bc1f[_0x7cc3('0x21')],'applicationId':_0xf0bc1f[_0x7cc3('0x70')]},'headers':{'Authorization':util[_0x7cc3('0x42')](_0x7cc3('0x44'),new Buffer(_0x16751d)[_0x7cc3('0x45')](_0x7cc3('0x46')))},'json':!![]};rp(_0x631d0)[_0x7cc3('0x19')](function(_0x17c40d){if(_0x17c40d['id']){var _0x237708={'messageId':_0x17c40d['id']};return _0xf2ab9[_0x7cc3('0x27')](_0x237708);}else{logger[_0x7cc3('0x1b')](_0x7cc3('0x38'),_0x7cc3('0x39'),_0x7cc3('0x6c'),util['inspect'](_0x17c40d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x16a435){logger[_0x7cc3('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x7cc3('0x6c'),util[_0x7cc3('0x28')](_0x16a435,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x7cc3('0x38'),_0x7cc3('0x39'),'bandwidth',_0x7cc3('0x4d'));}break;case _0x7cc3('0x71'):if(_0xf0bc1f[_0x7cc3('0x5f')]){var _0xabe4ac={};var _0x318e28={'method':_0x7cc3('0x33'),'uri':_0x7cc3('0x72'),'headers':{'Authorization':_0x7cc3('0x73')+_0xf0bc1f[_0x7cc3('0x5f')],'Content-Type':_0x7cc3('0x5a')},'body':{'from':_0xf0bc1f[_0x7cc3('0x21')],'to':_0x438b59['phone'],'text':_0x438b59[_0x7cc3('0xe')]},'json':!![]};return rp(_0x318e28)[_0x7cc3('0x19')](function(_0xe64331){if(_0xe64331[_0x7cc3('0x74')]==0xca){_0xabe4ac['message']=_0xe64331;var _0x5687e1={'method':_0x7cc3('0x33'),'uri':_0x7cc3('0x75'),'headers':{'Authorization':_0x7cc3('0x73')+_0xf0bc1f[_0x7cc3('0x5f')],'Content-Type':_0x7cc3('0x5a')},'body':{'refid':_0xabe4ac[_0x7cc3('0x76')]['refid']},'json':!![]};return rp(_0x5687e1)[_0x7cc3('0x19')](function(_0x3b7edc){_0xabe4ac['status']=_0x3b7edc;var _0x4e1c0c={'messageId':_0xabe4ac[_0x7cc3('0x76')][_0x7cc3('0x77')],'read':!![]};return _0xf2ab9[_0x7cc3('0x27')](_0x4e1c0c);});}else{return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc3('0x39'),'intelepeer',util[_0x7cc3('0x28')](_0xe64331,{'showHidden':![],'depth':null}));}})['catch'](function(_0x5270ed){return logger[_0x7cc3('0x1b')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x7cc3('0x39'),_0x7cc3('0x71'),util[_0x7cc3('0x28')](_0x5270ed,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0x7cc3('0x38'),_0x7cc3('0x39'),'intelepeer',_0x7cc3('0x78'));}break;}}})[_0x7cc3('0x79')](function(){_0x52537f();});}else{_0x52537f();}}},'charset':_0x7cc3('0x7a'),'collate':_0x7cc3('0x7b')});}; \ No newline at end of file +var _0x9fee=['digest','GET','id_sms','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','apiMessageId','bandwidth','https://messaging.bandwidth.com/api/v2/users/','/messages','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','code','message','Bearer\x20','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','models','get','direction','toLowerCase','out','isNil','UserId','SmsInteractionId','SmsInteraction','findOne','catch','error','secret','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','create','remote','/api/sms/messages/','/status?token=','token','sid','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','username','smsMethod','sender','&password=','password','split','sms','session_key','total_sent','internal_order_id','deliveryReport','read','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','requestid','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','data','queued_count','message_id','clickSend','plivo','https://api.plivo.com/v1/Account/%s/Message/','authId','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','messages','csc','crypto','apiKey','login','keys','sort','length','createHash'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x9fee,0x101));var _0xe9fe=function(_0x58d8a1,_0x53b67f){_0x58d8a1=_0x58d8a1-0x0;var _0x7a615e=_0x9fee[_0x58d8a1];return _0x7a615e;};'use strict';var _=require(_0xe9fe('0x0'));var util=require('util');var logger=require(_0xe9fe('0x1'))('api');var moment=require(_0xe9fe('0x2'));var BPromise=require(_0xe9fe('0x3'));var rp=require(_0xe9fe('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe9fe('0x5'));var config=require(_0xe9fe('0x6'));var attributes=require('./smsMessage.attributes');module[_0xe9fe('0x7')]=function(_0x2c28df,_0x134412){return _0x2c28df[_0xe9fe('0x8')](_0xe9fe('0x9'),attributes,{'tableName':_0xe9fe('0xa'),'paranoid':![],'indexes':[{'name':_0xe9fe('0xb'),'fields':[_0xe9fe('0xb')]},{'name':_0xe9fe('0xc'),'fields':[_0xe9fe('0xd')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x5404ed,_0x3691b4,_0x3c0a51){var _0x1455d0=_0x2c28df[_0xe9fe('0xe')];var _0x2dd661=_0x5404ed[_0xe9fe('0xf')]({'plain':!![]});if(_0x2dd661[_0xe9fe('0x10')][_0xe9fe('0x11')]()==='in'||_0x2dd661[_0xe9fe('0x10')][_0xe9fe('0x11')]()===_0xe9fe('0x12')&&!_0x2dd661['secret']&&!_[_0xe9fe('0x13')](_0x2dd661[_0xe9fe('0x14')])&&!_['isNil'](_0x2dd661[_0xe9fe('0x15')])){_0x1455d0[_0xe9fe('0x16')][_0xe9fe('0x17')]({'where':{'id':_0x2dd661[_0xe9fe('0x15')]}})['then'](function(_0x48537f){if(_0x48537f){_0x48537f['update']({'lastMsgAt':_0x2dd661['createdAt'],'lastMsgDirection':_0x2dd661[_0xe9fe('0x10')][_0xe9fe('0x11')]()});}})[_0xe9fe('0x18')](function(_0xda0256){console[_0xe9fe('0x19')](_0xda0256);});}if(_0x2dd661[_0xe9fe('0x10')]===_0xe9fe('0x12')&&!_0x2dd661[_0xe9fe('0x1a')]){var _0x3c7155;_0x1455d0['SmsAccount'][_0xe9fe('0x1b')]({'where':{'id':_0x2dd661[_0xe9fe('0x1c')]},'raw':!![]})[_0xe9fe('0x1d')](function(_0x3eb3db){_0x3c7155=_0x3eb3db;if(_0x3c7155&&_0x3c7155[_0xe9fe('0x1e')]){switch(_0x3c7155[_0xe9fe('0x1e')]){case'twilio':var _0x297ccd=require(_0xe9fe('0x1f'));if(_0x3c7155[_0xe9fe('0x20')]&&_0x3c7155[_0xe9fe('0x21')]&&_0x3c7155[_0xe9fe('0x22')]){var _0x3a2884=new _0x297ccd(_0x3c7155[_0xe9fe('0x20')],_0x3c7155[_0xe9fe('0x21')]);_0x3a2884['messages'][_0xe9fe('0x23')]({'body':_0x2dd661['body'],'to':_0x2dd661[_0xe9fe('0x22')],'from':_0x3c7155[_0xe9fe('0x22')],'statusCallback':_0x3c7155[_0xe9fe('0x24')]+_0xe9fe('0x25')+_0x2dd661['id']+_0xe9fe('0x26')+_0x3c7155[_0xe9fe('0x27')]})[_0xe9fe('0x1d')](function(_0x5a822f){if(_0x5a822f[_0xe9fe('0x28')]){return _0x5404ed[_0xe9fe('0x29')]({'messageId':_0x5a822f['sid']});}})[_0xe9fe('0x18')](function(_0x47828e){logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),'afterCreate',_0xe9fe('0x1f'),util['inspect'](_0x47828e,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x1f'),_0xe9fe('0x2c'));}break;case _0xe9fe('0x2d'):var _0x1524d0=_0xe9fe('0x2e');if(_0x3c7155[_0xe9fe('0x2f')]&&_0x3c7155['password']){var _0xf64c9a={'recipient':[_0x2dd661[_0xe9fe('0x22')]],'message':_0x2dd661[_0xe9fe('0xd')],'message_type':_0x3c7155[_0xe9fe('0x30')]};if(_0x3c7155[_0xe9fe('0x30')]&&_0x3c7155[_0xe9fe('0x30')]!=='SI'){_0xf64c9a[_0xe9fe('0x31')]=_0x3c7155['phone'];}var _0xf27871={'url':_0x1524d0+'login?username='+_0x3c7155[_0xe9fe('0x2f')]+_0xe9fe('0x32')+_0x3c7155[_0xe9fe('0x33')],'method':'GET'};rp(_0xf27871)[_0xe9fe('0x1d')](function(_0x169a12){var _0x111c0e=_0x169a12[_0xe9fe('0x34')](';');var _0x14d436={'user_key':_0x111c0e[0x0],'session_key':_0x111c0e[0x1]};_0xf27871={'url':_0x1524d0+_0xe9fe('0x35'),'method':'POST','headers':{'user_key':_0x14d436['user_key'],'Session_key':_0x14d436[_0xe9fe('0x36')]},'json':!![],'body':_0xf64c9a};return rp(_0xf27871);})[_0xe9fe('0x1d')](function(_0x26bc6f){if(_0x26bc6f[_0xe9fe('0x37')]>=0x1){var _0x4a65af={'messageId':_0x26bc6f[_0xe9fe('0x38')]};if(_0x3c7155[_0xe9fe('0x30')]!=='GP'||!_0x3c7155[_0xe9fe('0x39')]){_0x4a65af[_0xe9fe('0x3a')]=!![];}return _0x5404ed[_0xe9fe('0x29')](_0x4a65af);}else{return logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x2d'),util['inspect'](_0x26bc6f,{'showHidden':![],'depth':null}));}})[_0xe9fe('0x18')](function(_0x424a89){return logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x2d'),util[_0xe9fe('0x3b')](_0x424a89,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x2d'),_0xe9fe('0x3c'));}break;case _0xe9fe('0x3d'):if(_0x3c7155['authToken']){var _0x244976={'recipient':_0x2dd661['phone'],'message':_0x2dd661[_0xe9fe('0xd')],'sender':_0x3c7155[_0xe9fe('0x3e')]||_0x3c7155[_0xe9fe('0x22')],'authorization':_0x3c7155[_0xe9fe('0x21')]};var _0x3691b4={'method':_0xe9fe('0x3f'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x244976,'json':!![]};rp(_0x3691b4)[_0xe9fe('0x1d')](function(_0x58daa1){var _0x4f6a5f={'messageId':_0x58daa1[_0xe9fe('0x40')]};if(!_0x3c7155['deliveryReport']){_0x4f6a5f[_0xe9fe('0x3a')]=!![];}return _0x5404ed['update'](_0x4f6a5f);})[_0xe9fe('0x18')](function(_0x553a50){logger[_0xe9fe('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9fe('0x2b'),_0xe9fe('0x3d'),util[_0xe9fe('0x3b')](_0x553a50,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),'afterCreate',_0xe9fe('0x3d'),'Missing\x20parameters:\x20authToken');}break;case _0xe9fe('0x41'):if(_0x3c7155[_0xe9fe('0x2f')]&&_0x3c7155[_0xe9fe('0x33')]){var _0x244976={'messages':[{'source':_0xe9fe('0x42'),'to':_0x2dd661['phone'],'body':_0x2dd661[_0xe9fe('0xd')],'from':_0x3c7155[_0xe9fe('0x3e')]||_0x3c7155['phone']}]};var _0x483af9=util[_0xe9fe('0x43')](_0xe9fe('0x44'),_0x3c7155[_0xe9fe('0x2f')],_0x3c7155[_0xe9fe('0x33')]);var _0x3691b4={'method':_0xe9fe('0x3f'),'uri':_0xe9fe('0x45'),'body':_0x244976,'headers':{'Authorization':util['format'](_0xe9fe('0x46'),new Buffer(_0x483af9)[_0xe9fe('0x47')](_0xe9fe('0x48')))},'json':!![]};rp(_0x3691b4)[_0xe9fe('0x1d')](function(_0x342981){if(_0x342981[_0xe9fe('0x49')]>=0xc8&&_0x342981['http_code']<=0xce){if(_0x342981[_0xe9fe('0x4a')]&&_0x342981[_0xe9fe('0x4a')][_0xe9fe('0x4b')]>0x0){var _0x2d972f=_['head'](_0x342981[_0xe9fe('0x4a')]['messages']);var _0x19e82c={'messageId':_0x2d972f[_0xe9fe('0x4c')]};if(!_0x3c7155['deliveryReport']){_0x19e82c[_0xe9fe('0x3a')]=!![];}return _0x5404ed[_0xe9fe('0x29')](_0x19e82c);}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x4d'),util[_0xe9fe('0x3b')](_0x342981,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x4d'),util[_0xe9fe('0x3b')](_0x342981,{'showHidden':![],'depth':null}));}})[_0xe9fe('0x18')](function(_0x511a55){logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),'clickSend',util['inspect'](_0x511a55,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x4d'),_0xe9fe('0x3c'));}break;case _0xe9fe('0x4e'):if(_0x3c7155['authId']&&_0x3c7155['authToken']){var _0x244976={'dst':_0x2dd661[_0xe9fe('0x22')],'text':_0x2dd661[_0xe9fe('0xd')],'src':_0x3c7155[_0xe9fe('0x3e')]||_0x3c7155[_0xe9fe('0x22')],'url':_0x3c7155['remote']+_0xe9fe('0x25')+_0x2dd661['id']+_0xe9fe('0x26')+_0x3c7155[_0xe9fe('0x27')]};var _0x483af9=util['format']('%s:%s',_0x3c7155['authId'],_0x3c7155[_0xe9fe('0x21')]);var _0x3691b4={'method':_0xe9fe('0x3f'),'uri':util[_0xe9fe('0x43')](_0xe9fe('0x4f'),_0x3c7155[_0xe9fe('0x50')]),'body':_0x244976,'headers':{'Authorization':util[_0xe9fe('0x43')](_0xe9fe('0x46'),new Buffer(_0x483af9)[_0xe9fe('0x47')]('base64'))},'json':!![]};rp(_0x3691b4)[_0xe9fe('0x1d')](function(_0x2c4eec){var _0x57f44f={'messageId':_0x2c4eec['message_uuid'][0x0]};return _0x5404ed[_0xe9fe('0x29')](_0x57f44f);})[_0xe9fe('0x18')](function(_0x1c8808){logger[_0xe9fe('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9fe('0x2b'),_0xe9fe('0x4e'),util[_0xe9fe('0x3b')](_0x1c8808,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x4e'),_0xe9fe('0x51'));}break;case _0xe9fe('0x52'):if(_0x3c7155['username']&&_0x3c7155[_0xe9fe('0x33')]){if(_0x3c7155[_0xe9fe('0x53')]){var _0x1b6879={'method':_0xe9fe('0x3f'),'uri':_0x3c7155[_0xe9fe('0x53')]+_0xe9fe('0x54'),'body':{'username':_0x3c7155[_0xe9fe('0x2f')],'password':_0x3c7155[_0xe9fe('0x33')]},'json':!![]};return rp(_0x1b6879)[_0xe9fe('0x1d')](function(_0x5d18d3){var _0x322a60={'method':'POST','uri':_0x3c7155['baseUrl']+_0xe9fe('0x55'),'body':{'messages':[{'from':_0x3c7155[_0xe9fe('0x22')],'destinations':[{'to':_0x2dd661[_0xe9fe('0x22')]}],'text':_0x2dd661[_0xe9fe('0xd')],'notifyUrl':_0x3c7155[_0xe9fe('0x24')]+_0xe9fe('0x25')+_0x2dd661['id']+_0xe9fe('0x26')+_0x3c7155['token'],'notifyContentType':_0xe9fe('0x56'),'callbackData':_0x3c7155['phone']+';'+_0x2dd661[_0xe9fe('0xd')]}]},'headers':{'Authorization':_0xe9fe('0x57')+_0x5d18d3[_0xe9fe('0x27')]},'json':!![]};return rp(_0x322a60)['then'](function(_0xae329f){if(_0xae329f[_0xe9fe('0x58')]){var _0x18def5={'messageId':_0xae329f[_0xe9fe('0x58')][0x0][_0xe9fe('0xb')]};if(!_0x3c7155[_0xe9fe('0x39')]){_0x18def5['read']=!![];}return _0x5404ed[_0xe9fe('0x29')](_0x18def5);}else{return logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x52'),util[_0xe9fe('0x3b')](_0xae329f,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x27e36e){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe9fe('0x52'),util[_0xe9fe('0x3b')](_0x27e36e,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9fe('0x2b'),_0xe9fe('0x52'),'Missing\x20parameters:\x20base_url');}}else{logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x52'),_0xe9fe('0x3c'));}break;case _0xe9fe('0x59'):var _0x5751e3=require(_0xe9fe('0x5a'));if(_0x3c7155[_0xe9fe('0x5b')]){var _0x17cefd={};_0x17cefd[_0xe9fe('0x5c')]=_0x3c7155[_0xe9fe('0x2f')];_0x17cefd[_0xe9fe('0x22')]=_0x2dd661['phone'];_0x17cefd[_0xe9fe('0x31')]=_0x3c7155['phone'];_0x17cefd['text']=_0x2dd661[_0xe9fe('0xd')];_0x17cefd['timestamp']=+new Date();var _0x287b7c='';var _0x14b4e8='';var _0x57cc3b=Object[_0xe9fe('0x5d')](_0x17cefd);_0x57cc3b[_0xe9fe('0x5e')]();for(var _0xa8de66=0x0;_0xa8de66<_0x57cc3b[_0xe9fe('0x5f')];_0xa8de66++){if(_0x287b7c!=''){_0x287b7c+='&';}_0x287b7c+=_0x57cc3b[_0xa8de66]+'='+encodeURIComponent(_0x17cefd[_0x57cc3b[_0xa8de66]]);_0x14b4e8+=_0x17cefd[_0x57cc3b[_0xa8de66]];}_0x14b4e8+=_0x3c7155[_0xe9fe('0x5b')];_0x14b4e8=_0x5751e3[_0xe9fe('0x60')]('md5')[_0xe9fe('0x29')](_0x14b4e8)[_0xe9fe('0x61')]('hex');if(_0x287b7c!==''){_0x287b7c+='&';}_0x287b7c+='signature='+_0x14b4e8;var _0xf27871={'method':_0xe9fe('0x62'),'uri':_0x3c7155[_0xe9fe('0x53')]+'/external/get/send.php?'+_0x287b7c,'json':!![]};return rp(_0xf27871)['then'](function(_0x4c5eee){var _0xec3f1c=Object[_0xe9fe('0x5d')](_0x4c5eee);if(_0x4c5eee[_0xec3f1c[0x0]][_0xe9fe('0x19')]&&parseInt(_0x4c5eee[_0xec3f1c[0x0]][_0xe9fe('0x19')])===0x0){var _0x3b5859={'messageId':_0x4c5eee[_0xec3f1c[0x0]][_0xe9fe('0x63')]};if(!_0x3c7155[_0xe9fe('0x39')]){_0x3b5859[_0xe9fe('0x3a')]=!![];}return _0x5404ed[_0xe9fe('0x29')](_0x3b5859);}else{return logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x59'),util[_0xe9fe('0x3b')](_0x4c5eee[_0xe9fe('0x19')],{'showHidden':![],'depth':null}));}})[_0xe9fe('0x18')](function(_0x4a609d){return logger[_0xe9fe('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9fe('0x2b'),_0xe9fe('0x59'),util[_0xe9fe('0x3b')](_0x4a609d,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xe9fe('0x2b'),_0xe9fe('0x59'),_0xe9fe('0x64'));}break;case _0xe9fe('0x65'):if(_0x3c7155['apiKey']){var _0x570e0c={'method':_0xe9fe('0x3f'),'uri':_0xe9fe('0x66'),'headers':{'Authorization':_0x3c7155[_0xe9fe('0x5b')]},'body':{'content':_0x2dd661['body'],'to':[_0x2dd661[_0xe9fe('0x22')]],'from':_0x3c7155['phone'],'binary':![],'clientMessageId':_0xe9fe('0x67'),'charset':'UTF-8'},'json':!![]};rp(_0x570e0c)[_0xe9fe('0x1d')](function(_0x2c67dd){if(!_0x2c67dd[_0xe9fe('0x19')]){var _0x3c7f9a={'messageId':_0x2c67dd['messages'][0x0][_0xe9fe('0x68')]};if(!_0x3c7155[_0xe9fe('0x39')]){_0x3c7f9a[_0xe9fe('0x3a')]=!![];}return _0x5404ed[_0xe9fe('0x29')](_0x3c7f9a);}else{return logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),'afterCreate',_0xe9fe('0x65'),util[_0xe9fe('0x3b')](_0x2c67dd[_0xe9fe('0x19')],{'showHidden':![],'depth':null}));}})[_0xe9fe('0x18')](function(_0x1338b1){return logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x65'),util[_0xe9fe('0x3b')](_0x1338b1,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x65'),_0xe9fe('0x64'));}break;case _0xe9fe('0x69'):if(_0x3c7155['username']&&_0x3c7155[_0xe9fe('0x33')]){var _0x483af9=util[_0xe9fe('0x43')](_0xe9fe('0x44'),_0x3c7155[_0xe9fe('0x2f')],_0x3c7155[_0xe9fe('0x33')]);var _0x3691b4={'method':_0xe9fe('0x3f'),'uri':_0xe9fe('0x6a')+_0x3c7155['accountId']+_0xe9fe('0x6b'),'body':{'to':[_0x2dd661[_0xe9fe('0x22')]],'text':_0x2dd661[_0xe9fe('0xd')],'from':_0x3c7155[_0xe9fe('0x22')],'applicationId':_0x3c7155['applicationId']},'headers':{'Authorization':util[_0xe9fe('0x43')](_0xe9fe('0x46'),new Buffer(_0x483af9)[_0xe9fe('0x47')](_0xe9fe('0x48')))},'json':!![]};rp(_0x3691b4)[_0xe9fe('0x1d')](function(_0x286c07){if(_0x286c07['id']){var _0x5a7836={'messageId':_0x286c07['id']};return _0x5404ed[_0xe9fe('0x29')](_0x5a7836);}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x69'),util['inspect'](_0x286c07,{'showHidden':![],'depth':null}));}})[_0xe9fe('0x18')](function(_0x5d7dd2){logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x69'),util[_0xe9fe('0x3b')](_0x5d7dd2,{'showHidden':![],'depth':null}));});}else{logger[_0xe9fe('0x19')](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x69'),_0xe9fe('0x3c'));}break;case _0xe9fe('0x6c'):if(_0x3c7155[_0xe9fe('0x5b')]){var _0x287d6f={};var _0xf27871={'method':'POST','uri':_0xe9fe('0x6d'),'headers':{'Authorization':'Bearer\x20'+_0x3c7155[_0xe9fe('0x5b')],'Content-Type':_0xe9fe('0x56')},'body':{'from':_0x3c7155[_0xe9fe('0x22')],'to':_0x2dd661[_0xe9fe('0x22')],'text':_0x2dd661[_0xe9fe('0xd')]},'json':!![]};return rp(_0xf27871)[_0xe9fe('0x1d')](function(_0x48d3a4){if(_0x48d3a4[_0xe9fe('0x6e')]==0xca){_0x287d6f[_0xe9fe('0x6f')]=_0x48d3a4;var _0x368529={'method':_0xe9fe('0x3f'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xe9fe('0x70')+_0x3c7155[_0xe9fe('0x5b')],'Content-Type':_0xe9fe('0x56')},'body':{'refid':_0x287d6f[_0xe9fe('0x6f')][_0xe9fe('0x71')]},'json':!![]};return rp(_0x368529)[_0xe9fe('0x1d')](function(_0x20dca7){_0x287d6f['status']=_0x20dca7;var _0x35bcd9={'messageId':_0x287d6f[_0xe9fe('0x6f')]['refid'],'read':!![]};return _0x5404ed['update'](_0x35bcd9);});}else{return logger[_0xe9fe('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xe9fe('0x6c'),util[_0xe9fe('0x3b')](_0x48d3a4,{'showHidden':![],'depth':null}));}})[_0xe9fe('0x18')](function(_0xb78112){return logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x6c'),util[_0xe9fe('0x3b')](_0xb78112,{'showHidden':![],'depth':null}));});}else{return logger['error'](_0xe9fe('0x2a'),_0xe9fe('0x2b'),_0xe9fe('0x6c'),_0xe9fe('0x72'));}break;}}})[_0xe9fe('0x73')](function(){_0x3c0a51();});}else{_0x3c0a51();}}},'charset':_0xe9fe('0x74'),'collate':_0xe9fe('0x75')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index 4dac286..6fdd674 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 _0x6023=['request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','create','options','raw','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./smsMessage.socket','register','then','info'];(function(_0x293a6b,_0x1c3110){var _0x4b3d19=function(_0x3b823a){while(--_0x3b823a){_0x293a6b['push'](_0x293a6b['shift']());}};_0x4b3d19(++_0x1c3110);}(_0x6023,0x71));var _0x3602=function(_0x313882,_0xcec514){_0x313882=_0x313882-0x0;var _0x21fb4f=_0x6023[_0x313882];return _0x21fb4f;};'use strict';var _=require(_0x3602('0x0'));var util=require('util');var moment=require(_0x3602('0x1'));var BPromise=require('bluebird');var rs=require(_0x3602('0x2'));var fs=require('fs');var Redis=require(_0x3602('0x3'));var db=require(_0x3602('0x4'))['db'];var utils=require(_0x3602('0x5'));var logger=require(_0x3602('0x6'))(_0x3602('0x7'));var config=require(_0x3602('0x8'));var jayson=require(_0x3602('0x9'));var client=jayson[_0x3602('0xa')][_0x3602('0xb')]({'port':0x232a});config[_0x3602('0xc')]=_[_0x3602('0xd')](config[_0x3602('0xc')],{'host':_0x3602('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3602('0xc')]));require(_0x3602('0xf'))[_0x3602('0x10')](socket);function respondWithRpcPromise(_0x56c7e2,_0x329b5e,_0x3f041a){return new BPromise(function(_0x186edd,_0xdbdb18){return client['request'](_0x56c7e2,_0x3f041a)[_0x3602('0x11')](function(_0x26c347){logger[_0x3602('0x12')]('SmsMessage,\x20%s,\x20%s',_0x329b5e,_0x3602('0x13'));logger[_0x3602('0x14')](_0x3602('0x15'),_0x329b5e,_0x3602('0x13'),JSON['stringify'](_0x26c347));if(_0x26c347[_0x3602('0x16')]){if(_0x26c347[_0x3602('0x16')][_0x3602('0x17')]===0x1f4){logger[_0x3602('0x16')](_0x3602('0x18'),_0x329b5e,_0x26c347[_0x3602('0x16')][_0x3602('0x19')]);return _0xdbdb18(_0x26c347['error'][_0x3602('0x19')]);}logger[_0x3602('0x16')](_0x3602('0x18'),_0x329b5e,_0x26c347['error']['message']);return _0x186edd(_0x26c347[_0x3602('0x16')]['message']);}else{logger['info'](_0x3602('0x18'),_0x329b5e,_0x3602('0x13'));_0x186edd(_0x26c347[_0x3602('0x1a')]['message']);}})[_0x3602('0x1b')](function(_0x9ebea7){logger[_0x3602('0x16')](_0x3602('0x18'),_0x329b5e,_0x9ebea7);_0xdbdb18(_0x9ebea7);});});}exports[_0x3602('0x1c')]=function(_0x5aded4){var _0x36c866=this;return new Promise(function(_0x4a9f81,_0x294758){return db['SmsMessage'][_0x3602('0x1d')](_0x5aded4['body'],{'raw':_0x5aded4[_0x3602('0x1e')]?_0x5aded4[_0x3602('0x1e')][_0x3602('0x1f')]===undefined?!![]:![]:!![]})[_0x3602('0x11')](function(_0x1307ab){logger[_0x3602('0x12')](_0x3602('0x1c'),_0x5aded4);logger['debug'](_0x3602('0x1c'),_0x5aded4,JSON[_0x3602('0x20')](_0x1307ab));_0x4a9f81(_0x1307ab);})[_0x3602('0x1b')](function(_0x54e452){logger[_0x3602('0x16')](_0x3602('0x1c'),_0x54e452['message'],_0x5aded4);_0x294758(_0x36c866['error'](0x1f4,_0x54e452['message']));});});}; \ No newline at end of file +var _0x18dd=['jayson/promise','client','redis','localhost','socket.io-emitter','./smsMessage.socket','register','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','SmsMessage','create','options','raw','CreateSmsMessage','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2d566b,_0x47c52d){var _0xd90686=function(_0x184772){while(--_0x184772){_0x2d566b['push'](_0x2d566b['shift']());}};_0xd90686(++_0x47c52d);}(_0x18dd,0x1a4));var _0xd18d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x18dd[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xd18d('0x0'));var util=require(_0xd18d('0x1'));var moment=require(_0xd18d('0x2'));var BPromise=require(_0xd18d('0x3'));var rs=require(_0xd18d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd18d('0x5'))['db'];var utils=require(_0xd18d('0x6'));var logger=require('../../config/logger')(_0xd18d('0x7'));var config=require(_0xd18d('0x8'));var jayson=require(_0xd18d('0x9'));var client=jayson[_0xd18d('0xa')]['http']({'port':0x232a});config[_0xd18d('0xb')]=_['defaults'](config[_0xd18d('0xb')],{'host':_0xd18d('0xc'),'port':0x18eb});var socket=require(_0xd18d('0xd'))(new Redis(config[_0xd18d('0xb')]));require(_0xd18d('0xe'))[_0xd18d('0xf')](socket);function respondWithRpcPromise(_0x2c2778,_0x37d07d,_0x12193b){return new BPromise(function(_0x5e6780,_0x21039c){return client[_0xd18d('0x10')](_0x2c2778,_0x12193b)[_0xd18d('0x11')](function(_0x1457e3){logger[_0xd18d('0x12')](_0xd18d('0x13'),_0x37d07d,_0xd18d('0x14'));logger[_0xd18d('0x15')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x37d07d,_0xd18d('0x14'),JSON[_0xd18d('0x16')](_0x1457e3));if(_0x1457e3[_0xd18d('0x17')]){if(_0x1457e3[_0xd18d('0x17')][_0xd18d('0x18')]===0x1f4){logger[_0xd18d('0x17')](_0xd18d('0x13'),_0x37d07d,_0x1457e3[_0xd18d('0x17')][_0xd18d('0x19')]);return _0x21039c(_0x1457e3[_0xd18d('0x17')][_0xd18d('0x19')]);}logger[_0xd18d('0x17')](_0xd18d('0x13'),_0x37d07d,_0x1457e3['error'][_0xd18d('0x19')]);return _0x5e6780(_0x1457e3['error'][_0xd18d('0x19')]);}else{logger[_0xd18d('0x12')]('SmsMessage,\x20%s,\x20%s',_0x37d07d,_0xd18d('0x14'));_0x5e6780(_0x1457e3[_0xd18d('0x1a')][_0xd18d('0x19')]);}})[_0xd18d('0x1b')](function(_0x26bf8f){logger[_0xd18d('0x17')](_0xd18d('0x13'),_0x37d07d,_0x26bf8f);_0x21039c(_0x26bf8f);});});}exports['CreateSmsMessage']=function(_0x31ef32){var _0x3f65cb=this;return new Promise(function(_0x56be77,_0x566d83){return db[_0xd18d('0x1c')][_0xd18d('0x1d')](_0x31ef32['body'],{'raw':_0x31ef32[_0xd18d('0x1e')]?_0x31ef32['options'][_0xd18d('0x1f')]===undefined?!![]:![]:!![]})[_0xd18d('0x11')](function(_0xa74019){logger[_0xd18d('0x12')](_0xd18d('0x20'),_0x31ef32);logger[_0xd18d('0x15')](_0xd18d('0x20'),_0x31ef32,JSON[_0xd18d('0x16')](_0xa74019));_0x56be77(_0xa74019);})['catch'](function(_0x26b09d){logger[_0xd18d('0x17')]('CreateSmsMessage',_0x26b09d[_0xd18d('0x19')],_0x31ef32);_0x566d83(_0x3f65cb[_0xd18d('0x17')](0x1f4,_0x26b09d[_0xd18d('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index 04df102..a58ac38 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 _0xd934=['register','length','smsMessage:','./smsMessage.events','save','remove','update','emit'];(function(_0x185133,_0x29a472){var _0x862f7f=function(_0x25ea87){while(--_0x25ea87){_0x185133['push'](_0x185133['shift']());}};_0x862f7f(++_0x29a472);}(_0xd934,0xb3));var _0x4d93=function(_0x369085,_0x2b07b4){_0x369085=_0x369085-0x0;var _0x20ccc9=_0xd934[_0x369085];return _0x20ccc9;};'use strict';var SmsMessageEvents=require(_0x4d93('0x0'));var events=[_0x4d93('0x1'),_0x4d93('0x2'),_0x4d93('0x3')];function createListener(_0x15e9cc,_0x50128b){return function(_0xd534ed){_0x50128b[_0x4d93('0x4')](_0x15e9cc,_0xd534ed);};}function removeListener(_0x3b48fb,_0x56814a){return function(){SmsMessageEvents['removeListener'](_0x3b48fb,_0x56814a);};}exports[_0x4d93('0x5')]=function(_0x2b5c6b){for(var _0x1c4036=0x0,_0x15519b=events[_0x4d93('0x6')];_0x1c4036<_0x15519b;_0x1c4036++){var _0x8e1e38=events[_0x1c4036];var _0x301969=createListener(_0x4d93('0x7')+_0x8e1e38,_0x2b5c6b);SmsMessageEvents['on'](_0x8e1e38,_0x301969);}}; \ No newline at end of file +var _0x7e71=['removeListener','length','smsMessage:','./smsMessage.events','save'];(function(_0x11ab2c,_0x4ebf1c){var _0x41af3d=function(_0x406746){while(--_0x406746){_0x11ab2c['push'](_0x11ab2c['shift']());}};_0x41af3d(++_0x4ebf1c);}(_0x7e71,0x152));var _0x17e7=function(_0x4629ed,_0x59ef85){_0x4629ed=_0x4629ed-0x0;var _0x52ca04=_0x7e71[_0x4629ed];return _0x52ca04;};'use strict';var SmsMessageEvents=require(_0x17e7('0x0'));var events=[_0x17e7('0x1'),'remove','update'];function createListener(_0x2fa22a,_0x13e66f){return function(_0x515c13){_0x13e66f['emit'](_0x2fa22a,_0x515c13);};}function removeListener(_0x3ef622,_0x10b861){return function(){SmsMessageEvents[_0x17e7('0x2')](_0x3ef622,_0x10b861);};}exports['register']=function(_0x461316){for(var _0x103b70=0x0,_0x591991=events[_0x17e7('0x3')];_0x103b70<_0x591991;_0x103b70++){var _0x1475ed=events[_0x103b70];var _0x68d08c=createListener(_0x17e7('0x4')+_0x1475ed,_0x461316);SmsMessageEvents['on'](_0x1475ed,_0x68d08c);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index f127a8f..f7fbb62 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 _0x2b26=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','delete','destroy','removeTeams','removeAgents','exports','connect-timeout'];(function(_0x440fd0,_0x252743){var _0x15ab79=function(_0x32f2d3){while(--_0x32f2d3){_0x440fd0['push'](_0x440fd0['shift']());}};_0x15ab79(++_0x252743);}(_0x2b26,0xbc));var _0x62b2=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x2b26[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x62b2('0x0'));var express=require('express');var router=express[_0x62b2('0x1')]();var fs_extra=require(_0x62b2('0x2'));var auth=require(_0x62b2('0x3'));var interaction=require(_0x62b2('0x4'));var config=require(_0x62b2('0x5'));var controller=require(_0x62b2('0x6'));router[_0x62b2('0x7')]('/',auth[_0x62b2('0x8')](),controller['index']);router[_0x62b2('0x7')](_0x62b2('0x9'),auth[_0x62b2('0x8')](),controller['describe']);router[_0x62b2('0x7')](_0x62b2('0xa'),auth['isAuthenticated'](),controller[_0x62b2('0xb')]);router[_0x62b2('0x7')](_0x62b2('0xc'),auth[_0x62b2('0x8')](),controller[_0x62b2('0xd')]);router['get'](_0x62b2('0xe'),auth['isAuthenticated'](),controller[_0x62b2('0xf')]);router['get'](_0x62b2('0x10'),auth['isAuthenticated'](),controller[_0x62b2('0x11')]);router['post']('/',auth['isAuthenticated'](),controller[_0x62b2('0x12')]);router[_0x62b2('0x13')]('/:id/teams',auth[_0x62b2('0x8')](),controller[_0x62b2('0x14')]);router[_0x62b2('0x13')]('/:id/users',auth[_0x62b2('0x8')](),controller['addAgents']);router[_0x62b2('0x15')](_0x62b2('0xa'),auth[_0x62b2('0x8')](),controller['update']);router[_0x62b2('0x16')](_0x62b2('0xa'),auth[_0x62b2('0x8')](),controller[_0x62b2('0x17')]);router[_0x62b2('0x16')](_0x62b2('0xe'),auth[_0x62b2('0x8')](),controller[_0x62b2('0x18')]);router['delete'](_0x62b2('0x10'),auth[_0x62b2('0x8')](),controller[_0x62b2('0x19')]);module[_0x62b2('0x1a')]=router; \ No newline at end of file +var _0xd442=['addAgents','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','getAgents','addTeams','post'];(function(_0x4da605,_0x3c2895){var _0x596deb=function(_0x26c52e){while(--_0x26c52e){_0x4da605['push'](_0x4da605['shift']());}};_0x596deb(++_0x3c2895);}(_0xd442,0xef));var _0x2d44=function(_0x147994,_0x4b9eb2){_0x147994=_0x147994-0x0;var _0x5e78ed=_0xd442[_0x147994];return _0x5e78ed;};'use strict';var multer=require(_0x2d44('0x0'));var util=require(_0x2d44('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x2d44('0x2'));var router=express[_0x2d44('0x3')]();var fs_extra=require(_0x2d44('0x4'));var auth=require(_0x2d44('0x5'));var interaction=require(_0x2d44('0x6'));var config=require(_0x2d44('0x7'));var controller=require(_0x2d44('0x8'));router[_0x2d44('0x9')]('/',auth[_0x2d44('0xa')](),controller[_0x2d44('0xb')]);router[_0x2d44('0x9')]('/describe',auth[_0x2d44('0xa')](),controller[_0x2d44('0xc')]);router['get'](_0x2d44('0xd'),auth[_0x2d44('0xa')](),controller[_0x2d44('0xe')]);router[_0x2d44('0x9')](_0x2d44('0xf'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x10')]);router['get'](_0x2d44('0x11'),auth[_0x2d44('0xa')](),controller['getTeams']);router['get'](_0x2d44('0x12'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x13')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x2d44('0x11'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x14')]);router[_0x2d44('0x15')](_0x2d44('0x12'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x16')]);router['put'](_0x2d44('0xd'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x17')]);router[_0x2d44('0x18')](_0x2d44('0xd'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x19')]);router[_0x2d44('0x18')]('/:id/teams',auth[_0x2d44('0xa')](),controller[_0x2d44('0x1a')]);router[_0x2d44('0x18')](_0x2d44('0x12'),auth[_0x2d44('0xa')](),controller[_0x2d44('0x1b')]);module[_0x2d44('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index ca2448f..8e07501 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 _0x138e=['exports','STRING','INTEGER','ENUM','beepall','roundrobin','sequelize'];(function(_0x2e65ee,_0x29dad9){var _0x4c712a=function(_0xca593f){while(--_0xca593f){_0x2e65ee['push'](_0x2e65ee['shift']());}};_0x4c712a(++_0x29dad9);}(_0x138e,0x11e));var _0xe138=function(_0x54c731,_0x153595){_0x54c731=_0x54c731-0x0;var _0x285dfb=_0x138e[_0x54c731];return _0x285dfb;};'use strict';var Sequelize=require(_0xe138('0x0'));module[_0xe138('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe138('0x2')]},'timeout':{'type':Sequelize[_0xe138('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe138('0x4')]('rrmemory',_0xe138('0x5'),_0xe138('0x6'))}}; \ No newline at end of file +var _0x8b5e=['exports','name','ENUM','rrmemory','roundrobin','sequelize'];(function(_0x2f40b0,_0x40122e){var _0x5bc71b=function(_0xcb1864){while(--_0xcb1864){_0x2f40b0['push'](_0x2f40b0['shift']());}};_0x5bc71b(++_0x40122e);}(_0x8b5e,0x1bb));var _0xe8b5=function(_0x2c5df6,_0x40f469){_0x2c5df6=_0x2c5df6-0x0;var _0x33298a=_0x8b5e[_0x2c5df6];return _0x33298a;};'use strict';var Sequelize=require(_0xe8b5('0x0'));module[_0xe8b5('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe8b5('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe8b5('0x3')](_0xe8b5('0x4'),'beepall',_0xe8b5('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index ad28911..3495cd4 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 _0x2ef3=['intersection','attributes','model','fields','length','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','describe','getMembers','findOne','UserSmsQueue','filters','hasOwnProperty','order','sort','pick','SmsQueueId','filter','User','findAndCountAll','agent','updatedAt','createdAt','SIP','getTeams','Team','nolimit','addTeams','ids','online','voicePause','flatMap','each','findOrCreate','removeTeams','Agents','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','sequelize','toString','QueryTypes','TeamId','union','compact','value','transaction','isEmpty','emit','addAgents','spread','userSmsQueue:save','removeAgents','isArray','userSmsQueue:remove','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./smsQueue.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','then','destroy','get','SmsQueues','UserProfileResource','name','map','SmsQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','rows','catch','show','params','keys'];(function(_0x18ceaa,_0x22735e){var _0x3960e0=function(_0x58f05e){while(--_0x58f05e){_0x18ceaa['push'](_0x18ceaa['shift']());}};_0x3960e0(++_0x22735e);}(_0x2ef3,0xba));var _0x32ef=function(_0x9a1172,_0x589a75){_0x9a1172=_0x9a1172-0x0;var _0x13cad1=_0x2ef3[_0x9a1172];return _0x13cad1;};'use strict';var BPromise=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var _=require(_0x32ef('0x2'));var squel=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var qs=require(_0x32ef('0x5'));var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var db=require('../../mysqldb')['db'];config[_0x32ef('0x8')]=_[_0x32ef('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ef('0xa'))(new Redis(config[_0x32ef('0x8')]));require(_0x32ef('0xb'))[_0x32ef('0xc')](socket);function respondWithStatusCode(_0x234863,_0x298066){_0x298066=_0x298066||0xcc;return function(_0x2484a0){if(_0x2484a0){return _0x234863[_0x32ef('0xd')](_0x298066);}return _0x234863[_0x32ef('0xe')](_0x298066)[_0x32ef('0xf')]();};}function respondWithResult(_0x56eb42,_0x5780e9){_0x5780e9=_0x5780e9||0xc8;return function(_0x401d0b){if(_0x401d0b){return _0x56eb42[_0x32ef('0xe')](_0x5780e9)[_0x32ef('0x10')](_0x401d0b);}};}function respondWithFilteredResult(_0x1499c2,_0x5af651){return function(_0x193714){if(_0x193714){var _0x5afcc2=typeof _0x5af651[_0x32ef('0x11')]==='undefined'&&typeof _0x5af651[_0x32ef('0x12')]===_0x32ef('0x13');var _0x5c3eb9=_0x193714['count'];var _0x19ce1=_0x5afcc2?0x0:_0x5af651['offset'];var _0x326fce=_0x5afcc2?_0x193714[_0x32ef('0x14')]:_0x5af651[_0x32ef('0x11')]+_0x5af651[_0x32ef('0x12')];var _0x57aff1;if(_0x326fce>=_0x5c3eb9){_0x326fce=_0x5c3eb9;_0x57aff1=0xc8;}else{_0x57aff1=0xce;}_0x1499c2['status'](_0x57aff1);return _0x1499c2['set'](_0x32ef('0x15'),_0x19ce1+'-'+_0x326fce+'/'+_0x5c3eb9)[_0x32ef('0x10')](_0x193714);}return null;};}function saveUpdates(_0xb5aed2){return function(_0x53a5ca){if(_0x53a5ca){return _0x53a5ca['update'](_0xb5aed2)[_0x32ef('0x16')](function(_0x1a9476){return _0x1a9476;});}return null;};}function removeEntity(_0x286bfb){return function(_0x57863c){if(_0x57863c){return _0x57863c[_0x32ef('0x17')]()[_0x32ef('0x16')](function(){var _0x4f4c98=_0x57863c[_0x32ef('0x18')]({'plain':!![]});var _0x314ef1=_0x32ef('0x19');return db[_0x32ef('0x1a')][_0x32ef('0x17')]({'where':{'type':_0x314ef1,'resourceId':_0x4f4c98['id']}})[_0x32ef('0x16')](function(){return _0x57863c;});})['then'](function(){_0x286bfb[_0x32ef('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x309866){return function(_0x3a20ca){if(!_0x3a20ca){_0x309866['sendStatus'](0x194);}return _0x3a20ca;};}function handleError(_0x1af371,_0x97780){_0x97780=_0x97780||0x1f4;return function(_0x5e8898){logger['error'](_0x5e8898['stack']);if(_0x5e8898[_0x32ef('0x1b')]){delete _0x5e8898[_0x32ef('0x1b')];}_0x1af371[_0x32ef('0xe')](_0x97780)['send'](_0x5e8898);};}exports['index']=function(_0x19ea6,_0x4d584b){var _0x51a412={};var _0x278495={'count':0x0,'rows':[]};var _0x14d4b3=_[_0x32ef('0x1c')](db[_0x32ef('0x1d')][_0x32ef('0x1e')],function(_0x234175){return{'name':_0x234175[_0x32ef('0x1f')],'type':_0x234175[_0x32ef('0x20')][_0x32ef('0x21')]};});_0x51a412=qs[_0x32ef('0x22')](_0x14d4b3,_0x19ea6);var _0x1335e2={'where':_0x51a412[_0x32ef('0x23')]};return db['SmsQueue'][_0x32ef('0x14')](_0x1335e2)[_0x32ef('0x16')](function(_0x5a04cd){_0x278495[_0x32ef('0x14')]=_0x5a04cd;_0x51a412[_0x32ef('0x24')]=qs[_0x32ef('0x24')](_0x19ea6[_0x32ef('0x25')]);return db['SmsQueue'][_0x32ef('0x26')](_0x51a412);})[_0x32ef('0x16')](function(_0x31dbc3){_0x278495[_0x32ef('0x27')]=_0x31dbc3;return _0x278495;})[_0x32ef('0x16')](respondWithFilteredResult(_0x4d584b,_0x51a412))[_0x32ef('0x28')](handleError(_0x4d584b,null));};exports[_0x32ef('0x29')]=function(_0x575f3e,_0x36ac37){var _0x537214={'raw':!![],'where':{'id':_0x575f3e[_0x32ef('0x2a')]['id']}},_0x38bf73={};_0x38bf73['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x1d')][_0x32ef('0x1e')]);_0x38bf73[_0x32ef('0x25')]=_[_0x32ef('0x2b')](_0x575f3e['query']);_0x38bf73['filters']=_[_0x32ef('0x2c')](_0x38bf73['model'],_0x38bf73[_0x32ef('0x25')]);_0x537214[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x38bf73[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x575f3e[_0x32ef('0x25')]['fields']));_0x537214['attributes']=_0x537214['attributes'][_0x32ef('0x30')]?_0x537214[_0x32ef('0x2d')]:_0x38bf73[_0x32ef('0x2e')];if(_0x575f3e['query']['includeAll']){_0x537214[_0x32ef('0x24')]=[{'all':!![]}];}_0x537214=_[_0x32ef('0x31')]({},_0x537214,_0x575f3e[_0x32ef('0x32')]);return db['SmsQueue']['find'](_0x537214)[_0x32ef('0x16')](handleEntityNotFound(_0x36ac37,null))[_0x32ef('0x16')](respondWithResult(_0x36ac37,null))[_0x32ef('0x28')](handleError(_0x36ac37,null));};exports[_0x32ef('0x33')]=function(_0x3a7c49,_0x211c79){return db[_0x32ef('0x1d')][_0x32ef('0x33')](_0x3a7c49[_0x32ef('0x34')],{})['then'](function(_0x3a4a99){var _0x36e374=_0x3a7c49[_0x32ef('0x35')]['get']({'plain':!![]});if(!_0x36e374)throw new Error(_0x32ef('0x36'));if(_0x36e374[_0x32ef('0x37')]===_0x32ef('0x35')){var _0x393a89=_0x3a4a99[_0x32ef('0x18')]({'plain':!![]});var _0x33a0fb=_0x32ef('0x19');return db[_0x32ef('0x38')][_0x32ef('0x39')]({'where':{'name':_0x33a0fb,'userProfileId':_0x36e374[_0x32ef('0x3a')]},'raw':!![]})[_0x32ef('0x16')](function(_0x4615b4){if(_0x4615b4&&_0x4615b4['autoAssociation']===0x0){return db[_0x32ef('0x1a')][_0x32ef('0x33')]({'name':_0x393a89[_0x32ef('0x1b')],'resourceId':_0x393a89['id'],'type':_0x4615b4[_0x32ef('0x1b')],'sectionId':_0x4615b4['id']},{})[_0x32ef('0x16')](function(){return _0x3a4a99;});}else{return _0x3a4a99;}})[_0x32ef('0x28')](function(_0x3c0e44){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3c0e44);throw _0x3c0e44;});}return _0x3a4a99;})[_0x32ef('0x16')](respondWithResult(_0x211c79,0xc9))[_0x32ef('0x28')](handleError(_0x211c79,null));};exports[_0x32ef('0x3b')]=function(_0x765c63,_0x5dca14){if(_0x765c63[_0x32ef('0x34')]['id']){delete _0x765c63[_0x32ef('0x34')]['id'];}return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0x765c63['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x5dca14,null))[_0x32ef('0x16')](saveUpdates(_0x765c63[_0x32ef('0x34')],null))[_0x32ef('0x16')](respondWithResult(_0x5dca14,null))[_0x32ef('0x28')](handleError(_0x5dca14,null));};exports[_0x32ef('0x17')]=function(_0x321ef7,_0x3d35a1){return db[_0x32ef('0x1d')][_0x32ef('0x39')]({'where':{'id':_0x321ef7['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x3d35a1,null))['then'](removeEntity(_0x3d35a1,null))[_0x32ef('0x28')](handleError(_0x3d35a1,null));};exports[_0x32ef('0x3c')]=function(_0x2dd94f,_0x4d8393){return db[_0x32ef('0x1d')][_0x32ef('0x3c')]()[_0x32ef('0x16')](respondWithResult(_0x4d8393,null))[_0x32ef('0x28')](handleError(_0x4d8393,null));};exports[_0x32ef('0x3d')]=function(_0x40bf12,_0x12c9e6){var _0x47dbe1={'raw':!![],'where':{}},_0x5cb6fc={},_0x36252c;return db[_0x32ef('0x1d')][_0x32ef('0x3e')]({'where':{'id':_0x40bf12[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x12c9e6,null))[_0x32ef('0x16')](function(_0x44ad11){if(_0x44ad11){_0x36252c=_0x44ad11[_0x32ef('0x18')]({'plain':!![]});_0x5cb6fc[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x3f')][_0x32ef('0x1e')]);_0x5cb6fc[_0x32ef('0x25')]=_['keys'](_0x40bf12[_0x32ef('0x25')]);_0x5cb6fc[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],_0x5cb6fc[_0x32ef('0x25')]);_0x47dbe1[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5cb6fc[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x47dbe1[_0x32ef('0x2d')]=_0x47dbe1[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x47dbe1[_0x32ef('0x2d')]:_0x5cb6fc[_0x32ef('0x2e')];if(!_0x40bf12[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x47dbe1['limit']=qs[_0x32ef('0x12')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x12')]);_0x47dbe1[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x11')]);}_0x47dbe1[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x40bf12[_0x32ef('0x25')][_0x32ef('0x43')]);_0x47dbe1['where']=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x40bf12[_0x32ef('0x25')],_0x5cb6fc[_0x32ef('0x40')]));_0x47dbe1[_0x32ef('0x23')][_0x32ef('0x45')]=_0x44ad11['id'];if(_0x40bf12['query'][_0x32ef('0x46')]){_0x47dbe1[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x47dbe1['where'],{'$or':_[_0x32ef('0x1c')](_0x47dbe1['attributes'],function(_0x2ee3dd){var _0xbe35b={};_0xbe35b[_0x2ee3dd]={'$like':'%'+_0x40bf12['query'][_0x32ef('0x46')]+'%'};return _0xbe35b;})});}_0x47dbe1=_['merge']({},_0x47dbe1,_0x40bf12[_0x32ef('0x32')]);return db[_0x32ef('0x3f')][_0x32ef('0x26')](_0x47dbe1);}})[_0x32ef('0x16')](function(_0x2c7bee){if(_0x2c7bee){return db[_0x32ef('0x47')][_0x32ef('0x48')]({'where':{'id':_['map'](_0x2c7bee,'UserId'),'role':_0x32ef('0x49')},'attributes':['id','name','smsPause',_0x32ef('0x4a'),_0x32ef('0x4b')]});}})[_0x32ef('0x16')](function(_0x6aae59){if(_0x6aae59){return{'count':_0x6aae59[_0x32ef('0x14')],'rows':_[_0x32ef('0x1c')](_0x6aae59[_0x32ef('0x27')],function(_0x4249c3){return{'membername':_0x4249c3[_0x32ef('0x1b')],'UserId':_0x4249c3['id'],'queue_name':_0x36252c[_0x32ef('0x1b')],'SmsQueueId':_0x36252c['id'],'interface':util['format']('%s/%s',_0x32ef('0x4c'),_0x4249c3[_0x32ef('0x1b')]),'penalty':0x0,'paused':_0x4249c3['smsPause'],'createdAt':_0x4249c3[_0x32ef('0x4b')],'updatedAt':_0x4249c3[_0x32ef('0x4a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x32ef('0x16')](respondWithFilteredResult(_0x12c9e6,_0x47dbe1))['catch'](handleError(_0x12c9e6,null));};exports[_0x32ef('0x4d')]=function(_0x3c31d0,_0x20dcc5){var _0x52dfe0={};var _0x5e6030={};var _0x13ea1a;var _0x47d8bf;return db[_0x32ef('0x1d')]['findOne']({'where':{'id':_0x3c31d0['params']['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x20dcc5,null))[_0x32ef('0x16')](function(_0x10cb37){if(_0x10cb37){_0x13ea1a=_0x10cb37;_0x5e6030['model']=_[_0x32ef('0x2b')](db[_0x32ef('0x4e')][_0x32ef('0x1e')]);_0x5e6030['query']=_[_0x32ef('0x2b')](_0x3c31d0[_0x32ef('0x25')]);_0x5e6030['filters']=_['intersection'](_0x5e6030[_0x32ef('0x2e')],_0x5e6030[_0x32ef('0x25')]);_0x52dfe0[_0x32ef('0x2d')]=_[_0x32ef('0x2c')](_0x5e6030[_0x32ef('0x2e')],qs[_0x32ef('0x2f')](_0x3c31d0['query'][_0x32ef('0x2f')]));_0x52dfe0[_0x32ef('0x2d')]=_0x52dfe0[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x52dfe0[_0x32ef('0x2d')]:_0x5e6030[_0x32ef('0x2e')];_0x52dfe0[_0x32ef('0x42')]=qs[_0x32ef('0x43')](_0x3c31d0[_0x32ef('0x25')]['sort']);_0x52dfe0[_0x32ef('0x23')]=qs[_0x32ef('0x40')](_[_0x32ef('0x44')](_0x3c31d0[_0x32ef('0x25')],_0x5e6030[_0x32ef('0x40')]));if(_0x3c31d0['query']['filter']){_0x52dfe0[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x52dfe0[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x52dfe0[_0x32ef('0x2d')],function(_0x526fb1){var _0x3372d9={};_0x3372d9[_0x526fb1]={'$like':'%'+_0x3c31d0['query'][_0x32ef('0x46')]+'%'};return _0x3372d9;})});}_0x52dfe0=_[_0x32ef('0x31')]({},_0x52dfe0,_0x3c31d0['options']);return _0x13ea1a['getTeams'](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x1538d0){if(_0x1538d0){_0x47d8bf=_0x1538d0[_0x32ef('0x30')];if(!_0x3c31d0['query']['hasOwnProperty'](_0x32ef('0x4f'))){_0x52dfe0[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x3c31d0[_0x32ef('0x25')]['limit']);_0x52dfe0[_0x32ef('0x11')]=qs[_0x32ef('0x11')](_0x3c31d0[_0x32ef('0x25')][_0x32ef('0x11')]);}return _0x13ea1a[_0x32ef('0x4d')](_0x52dfe0);}})[_0x32ef('0x16')](function(_0x43b176){if(_0x43b176){return _0x43b176?{'count':_0x47d8bf,'rows':_0x43b176}:null;}})[_0x32ef('0x16')](respondWithResult(_0x20dcc5,null))[_0x32ef('0x28')](handleError(_0x20dcc5,null));};exports[_0x32ef('0x50')]=function(_0x132d9f,_0x3978cb){var _0x52b32f=_0x132d9f['body'][_0x32ef('0x51')];return db[_0x32ef('0x4e')]['findAll']({'where':{'id':_0x52b32f},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':'Agents','attributes':['id',_0x32ef('0x1b'),_0x32ef('0x52'),_0x32ef('0x53'),'interface'],'raw':!![]}]})[_0x32ef('0x16')](function(_0x4978a6){if(_0x4978a6){var _0x141fec=_[_0x32ef('0x54')](_0x4978a6,function(_0x47e3cc){var _0x4c70e0=_0x47e3cc[_0x32ef('0x18')]({'plain':!![]});return _0x4c70e0['Agents'];});return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x132d9f[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](function(_0x1adcb8){return db['sequelize']['transaction'](function(_0x4f1b94){return _0x1adcb8[_0x32ef('0x50')](_0x52b32f,{'transaction':_0x4f1b94})['then'](function(){return BPromise[_0x32ef('0x55')](_0x141fec,function(_0x13a374){return db[_0x32ef('0x3f')][_0x32ef('0x56')]({'where':{'UserId':_0x13a374['id'],'SmsQueueId':_0x132d9f[_0x32ef('0x2a')]['id']},'transaction':_0x4f1b94});});})[_0x32ef('0x16')](function(){_0x141fec['forEach'](function(_0x3d9245){socket['emit']('userSmsQueue:save',{'UserId':_0x3d9245['id'],'SmsQueueId':_0x1adcb8['id']});});});});});}})[_0x32ef('0x16')](respondWithStatusCode(_0x3978cb,null))['catch'](handleError(_0x3978cb,null));};exports[_0x32ef('0x57')]=function(_0x313798,_0x4d64ec){return db[_0x32ef('0x4e')][_0x32ef('0x26')]({'where':{'id':_0x313798[_0x32ef('0x25')][_0x32ef('0x51')]},'attributes':['id'],'include':[{'model':db[_0x32ef('0x47')],'as':_0x32ef('0x58'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4d64ec,null))['then'](function(_0x35b10d){var _0x5e0b55=_[_0x32ef('0x1c')](_0x35b10d,'id');var _0x266688=[];var _0x114d8e=[];var _0x1782a5=squel[_0x32ef('0x59')]();_0x1782a5[_0x32ef('0x5a')]('tq.TeamId')[_0x32ef('0x5b')](_0x32ef('0x5c'),'tq')[_0x32ef('0x5d')](_0x32ef('0x5e'),'ut',_0x32ef('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x313798[_0x32ef('0x2a')]['id']);for(var _0x904a4f=0x0;_0x904a4f<_0x35b10d['length'];_0x904a4f+=0x1){let _0x211fb1=_0x35b10d[_0x904a4f];for(var _0x2e333d=0x0;_0x2e333d<_0x211fb1[_0x32ef('0x58')][_0x32ef('0x30')];_0x2e333d+=0x1){let _0xc3664d=_0x211fb1[_0x32ef('0x58')][_0x2e333d];var _0xfb4845=_0x1782a5[_0x32ef('0x60')]();_0xfb4845[_0x32ef('0x23')]('ut.UserId\x20=\x20?',_0xc3664d['id']);_0x114d8e[_0x32ef('0x61')](db[_0x32ef('0x62')]['query'](_0xfb4845[_0x32ef('0x63')](),{'type':db['sequelize'][_0x32ef('0x64')]['SELECT']})[_0x32ef('0x16')](function(_0x39300f){if(_0x39300f[_0x32ef('0x30')]===0x1){return _0xc3664d['id'];}else{var _0x3e000c=_['every'](_[_0x32ef('0x1c')](_0x39300f,_0x32ef('0x65')),function(_0x31f99f){return _['includes'](_0x5e0b55,_0x31f99f);});if(_0x3e000c){return _0xc3664d['id'];}}}));}}return BPromise['all'](_0x114d8e)['then'](function(_0x1aff33){_0x266688=_(_0x266688)[_0x32ef('0x66')](_0x1aff33)[_0x32ef('0x67')]()[_0x32ef('0x68')]();return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x313798[_0x32ef('0x2a')]['id']}})['then'](function(_0x471de6){return db[_0x32ef('0x62')][_0x32ef('0x69')](function(_0x4baa7a){return _0x471de6[_0x32ef('0x57')](_0x313798[_0x32ef('0x25')][_0x32ef('0x51')],{'transaction':_0x4baa7a})[_0x32ef('0x16')](function(){if(!_[_0x32ef('0x6a')](_0x266688)){return _0x471de6['removeAgents'](_0x266688,{'transaction':_0x4baa7a});}})[_0x32ef('0x16')](function(){_0x266688['forEach'](function(_0x4f0433){socket[_0x32ef('0x6b')]('userSmsQueue:remove',{'UserId':_0x4f0433,'SmsQueueId':_0x471de6['id']});});});});});});})['then'](respondWithStatusCode(_0x4d64ec,null))[_0x32ef('0x28')](handleError(_0x4d64ec,null));};exports[_0x32ef('0x6c')]=function(_0xf6bc02,_0x3b9896){return db['SmsQueue'][_0x32ef('0x39')]({'where':{'id':_0xf6bc02['params']['id']}})['then'](handleEntityNotFound(_0x3b9896,null))[_0x32ef('0x16')](function(_0x56aede){if(_0x56aede){return _0x56aede[_0x32ef('0x6c')](_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')],_['omit'](_0xf6bc02['body'],[_0x32ef('0x51'),'id'])||{})[_0x32ef('0x6d')](function(_0x2c4a3c){for(var _0x3741f8=0x0;_0x3741f8<_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x32ef('0x30')];_0x3741f8+=0x1){socket['emit'](_0x32ef('0x6e'),{'UserId':Number(_0xf6bc02[_0x32ef('0x34')][_0x32ef('0x51')][_0x3741f8]),'SmsQueueId':Number(_0xf6bc02[_0x32ef('0x2a')]['id'])});}return _0x2c4a3c;});}})['then'](respondWithResult(_0x3b9896,null))['catch'](handleError(_0x3b9896,null));};exports[_0x32ef('0x6f')]=function(_0x5eb320,_0x116951){return db[_0x32ef('0x1d')]['find']({'where':{'id':_0x5eb320['params']['id']}})['then'](handleEntityNotFound(_0x116951,null))[_0x32ef('0x16')](function(_0x33f6c3){if(_0x33f6c3){return _0x33f6c3[_0x32ef('0x6f')](_0x5eb320[_0x32ef('0x25')]['ids'])[_0x32ef('0x16')](function(){if(_[_0x32ef('0x70')](_0x5eb320[_0x32ef('0x25')]['ids'])){for(var _0x2895ad=0x0;_0x2895ad<_0x5eb320['query'][_0x32ef('0x51')][_0x32ef('0x30')];_0x2895ad+=0x1){socket['emit']('userSmsQueue:remove',{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')][_0x2895ad]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}}else{socket[_0x32ef('0x6b')](_0x32ef('0x71'),{'UserId':Number(_0x5eb320[_0x32ef('0x25')][_0x32ef('0x51')]),'SmsQueueId':Number(_0x5eb320[_0x32ef('0x2a')]['id'])});}});}})[_0x32ef('0x16')](respondWithStatusCode(_0x116951,null))['catch'](handleError(_0x116951,null));};exports[_0x32ef('0x72')]=function(_0x583290,_0x22d657){var _0x7e47b9={};var _0x1d9d57={};var _0x18cf5d;var _0x102f2f;return db['SmsQueue'][_0x32ef('0x3e')]({'where':{'id':_0x583290[_0x32ef('0x2a')]['id']}})[_0x32ef('0x16')](handleEntityNotFound(_0x22d657,null))[_0x32ef('0x16')](function(_0x1db74d){if(_0x1db74d){_0x18cf5d=_0x1db74d;_0x1d9d57[_0x32ef('0x2e')]=_[_0x32ef('0x2b')](db[_0x32ef('0x47')][_0x32ef('0x1e')]);_0x1d9d57['query']=_['keys'](_0x583290['query']);_0x1d9d57[_0x32ef('0x40')]=_[_0x32ef('0x2c')](_0x1d9d57['model'],_0x1d9d57[_0x32ef('0x25')]);_0x7e47b9['attributes']=_[_0x32ef('0x2c')](_0x1d9d57['model'],qs['fields'](_0x583290[_0x32ef('0x25')][_0x32ef('0x2f')]));_0x7e47b9[_0x32ef('0x2d')]=_0x7e47b9[_0x32ef('0x2d')][_0x32ef('0x30')]?_0x7e47b9['attributes']:_0x1d9d57[_0x32ef('0x2e')];_0x7e47b9['order']=qs[_0x32ef('0x43')](_0x583290['query']['sort']);_0x7e47b9['where']=qs['filters'](_['pick'](_0x583290[_0x32ef('0x25')],_0x1d9d57[_0x32ef('0x40')]));if(_0x583290['query'][_0x32ef('0x46')]){_0x7e47b9[_0x32ef('0x23')]=_[_0x32ef('0x31')](_0x7e47b9[_0x32ef('0x23')],{'$or':_[_0x32ef('0x1c')](_0x7e47b9[_0x32ef('0x2d')],function(_0x59f0aa){var _0x2ac861={};_0x2ac861[_0x59f0aa]={'$like':'%'+_0x583290['query'][_0x32ef('0x46')]+'%'};return _0x2ac861;})});}_0x7e47b9=_[_0x32ef('0x31')]({},_0x7e47b9,_0x583290['options']);return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})['then'](function(_0x4557b0){if(_0x4557b0){_0x102f2f=_0x4557b0[_0x32ef('0x30')];if(!_0x583290[_0x32ef('0x25')][_0x32ef('0x41')]('nolimit')){_0x7e47b9[_0x32ef('0x12')]=qs[_0x32ef('0x12')](_0x583290[_0x32ef('0x25')][_0x32ef('0x12')]);_0x7e47b9['offset']=qs[_0x32ef('0x11')](_0x583290['query'][_0x32ef('0x11')]);}return _0x18cf5d[_0x32ef('0x72')](_0x7e47b9);}})[_0x32ef('0x16')](function(_0x28ef17){if(_0x28ef17){return _0x28ef17?{'count':_0x102f2f,'rows':_0x28ef17}:null;}})[_0x32ef('0x16')](respondWithResult(_0x22d657,null))[_0x32ef('0x28')](handleError(_0x22d657,null));}; \ No newline at end of file +var _0x5f66=['show','params','model','keys','intersection','attributes','fields','includeAll','merge','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','find','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','rawAttributes','filters','hasOwnProperty','order','sort','pick','map','UserSmsQueue','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','%s/%s','SIP','getTeams','length','filter','nolimit','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','findOne','getAgents','util','squel','ioredis','../../components/parsers/qs','../../config/logger','api','../../mysqldb','defaults','redis','./smsQueue.socket','register','end','json','offset','limit','undefined','count','status','update','then','UserProfileResource','destroy','sendStatus','stack','name','send','index','fieldName','key','getOptions','where','SmsQueue','include','query','findAll','catch'];(function(_0x4d572e,_0x59ceb7){var _0x43a969=function(_0x2184d1){while(--_0x2184d1){_0x4d572e['push'](_0x4d572e['shift']());}};_0x43a969(++_0x59ceb7);}(_0x5f66,0x1a0));var _0x65f6=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x5f66[_0x31e29a];return _0x32d892;};'use strict';var BPromise=require('bluebird');var util=require(_0x65f6('0x0'));var _=require('lodash');var squel=require(_0x65f6('0x1'));var Redis=require(_0x65f6('0x2'));var qs=require(_0x65f6('0x3'));var logger=require(_0x65f6('0x4'))(_0x65f6('0x5'));var config=require('../../config/environment');var db=require(_0x65f6('0x6'))['db'];config['redis']=_[_0x65f6('0x7')](config[_0x65f6('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x65f6('0x8')]));require(_0x65f6('0x9'))[_0x65f6('0xa')](socket);function respondWithStatusCode(_0x8f6451,_0xc44c70){_0xc44c70=_0xc44c70||0xcc;return function(_0x14f4c7){if(_0x14f4c7){return _0x8f6451['sendStatus'](_0xc44c70);}return _0x8f6451['status'](_0xc44c70)[_0x65f6('0xb')]();};}function respondWithResult(_0x2f6d5b,_0x264647){_0x264647=_0x264647||0xc8;return function(_0x25c416){if(_0x25c416){return _0x2f6d5b['status'](_0x264647)[_0x65f6('0xc')](_0x25c416);}};}function respondWithFilteredResult(_0x571436,_0x497cf3){return function(_0x2d2dfa){if(_0x2d2dfa){var _0x576875=typeof _0x497cf3[_0x65f6('0xd')]==='undefined'&&typeof _0x497cf3[_0x65f6('0xe')]===_0x65f6('0xf');var _0x2c4ee5=_0x2d2dfa[_0x65f6('0x10')];var _0x369f96=_0x576875?0x0:_0x497cf3[_0x65f6('0xd')];var _0x44144b=_0x576875?_0x2d2dfa[_0x65f6('0x10')]:_0x497cf3[_0x65f6('0xd')]+_0x497cf3[_0x65f6('0xe')];var _0x59154e;if(_0x44144b>=_0x2c4ee5){_0x44144b=_0x2c4ee5;_0x59154e=0xc8;}else{_0x59154e=0xce;}_0x571436[_0x65f6('0x11')](_0x59154e);return _0x571436['set']('Content-Range',_0x369f96+'-'+_0x44144b+'/'+_0x2c4ee5)[_0x65f6('0xc')](_0x2d2dfa);}return null;};}function saveUpdates(_0x5c69f8){return function(_0x37330d){if(_0x37330d){return _0x37330d[_0x65f6('0x12')](_0x5c69f8)[_0x65f6('0x13')](function(_0x1f974c){return _0x1f974c;});}return null;};}function removeEntity(_0xc8660c){return function(_0x18380e){if(_0x18380e){return _0x18380e['destroy']()['then'](function(){var _0x2d538c=_0x18380e['get']({'plain':!![]});var _0x4c81f3='SmsQueues';return db[_0x65f6('0x14')][_0x65f6('0x15')]({'where':{'type':_0x4c81f3,'resourceId':_0x2d538c['id']}})['then'](function(){return _0x18380e;});})[_0x65f6('0x13')](function(){_0xc8660c[_0x65f6('0x11')](0xcc)[_0x65f6('0xb')]();});}};}function handleEntityNotFound(_0x3876ed){return function(_0x219ab2){if(!_0x219ab2){_0x3876ed[_0x65f6('0x16')](0x194);}return _0x219ab2;};}function handleError(_0x581374,_0x197a49){_0x197a49=_0x197a49||0x1f4;return function(_0x4bb39e){logger['error'](_0x4bb39e[_0x65f6('0x17')]);if(_0x4bb39e[_0x65f6('0x18')]){delete _0x4bb39e['name'];}_0x581374[_0x65f6('0x11')](_0x197a49)[_0x65f6('0x19')](_0x4bb39e);};}exports[_0x65f6('0x1a')]=function(_0x2774a1,_0x4f5a69){var _0x9d7bb0={};var _0x59ea32={'count':0x0,'rows':[]};var _0x20a161=_['map'](db['SmsQueue']['rawAttributes'],function(_0x29abdb){return{'name':_0x29abdb[_0x65f6('0x1b')],'type':_0x29abdb['type'][_0x65f6('0x1c')]};});_0x9d7bb0=qs[_0x65f6('0x1d')](_0x20a161,_0x2774a1);var _0x52277c={'where':_0x9d7bb0[_0x65f6('0x1e')]};return db[_0x65f6('0x1f')][_0x65f6('0x10')](_0x52277c)['then'](function(_0x4ac04b){_0x59ea32['count']=_0x4ac04b;_0x9d7bb0[_0x65f6('0x20')]=qs[_0x65f6('0x20')](_0x2774a1[_0x65f6('0x21')]);return db[_0x65f6('0x1f')][_0x65f6('0x22')](_0x9d7bb0);})[_0x65f6('0x13')](function(_0x144e55){_0x59ea32['rows']=_0x144e55;return _0x59ea32;})['then'](respondWithFilteredResult(_0x4f5a69,_0x9d7bb0))[_0x65f6('0x23')](handleError(_0x4f5a69,null));};exports[_0x65f6('0x24')]=function(_0x5878bc,_0x4e50c0){var _0x10b368={'raw':!![],'where':{'id':_0x5878bc[_0x65f6('0x25')]['id']}},_0x1ce43c={};_0x1ce43c[_0x65f6('0x26')]=_[_0x65f6('0x27')](db[_0x65f6('0x1f')]['rawAttributes']);_0x1ce43c[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x5878bc[_0x65f6('0x21')]);_0x1ce43c['filters']=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],_0x1ce43c[_0x65f6('0x21')]);_0x10b368[_0x65f6('0x29')]=_[_0x65f6('0x28')](_0x1ce43c[_0x65f6('0x26')],qs['fields'](_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x10b368['attributes']=_0x10b368[_0x65f6('0x29')]['length']?_0x10b368[_0x65f6('0x29')]:_0x1ce43c['model'];if(_0x5878bc[_0x65f6('0x21')][_0x65f6('0x2b')]){_0x10b368['include']=[{'all':!![]}];}_0x10b368=_[_0x65f6('0x2c')]({},_0x10b368,_0x5878bc[_0x65f6('0x2d')]);return db[_0x65f6('0x1f')]['find'](_0x10b368)['then'](handleEntityNotFound(_0x4e50c0,null))[_0x65f6('0x13')](respondWithResult(_0x4e50c0,null))['catch'](handleError(_0x4e50c0,null));};exports[_0x65f6('0x2e')]=function(_0x4e6653,_0x22d760){return db[_0x65f6('0x1f')]['create'](_0x4e6653[_0x65f6('0x2f')],{})['then'](function(_0x5edd04){var _0x71b16b=_0x4e6653[_0x65f6('0x30')][_0x65f6('0x31')]({'plain':!![]});if(!_0x71b16b)throw new Error(_0x65f6('0x32'));if(_0x71b16b[_0x65f6('0x33')]===_0x65f6('0x30')){var _0x1a55da=_0x5edd04[_0x65f6('0x31')]({'plain':!![]});var _0x4f933b=_0x65f6('0x34');return db['UserProfileSection'][_0x65f6('0x35')]({'where':{'name':_0x4f933b,'userProfileId':_0x71b16b[_0x65f6('0x36')]},'raw':!![]})[_0x65f6('0x13')](function(_0x2ea7f7){if(_0x2ea7f7&&_0x2ea7f7['autoAssociation']===0x0){return db[_0x65f6('0x14')][_0x65f6('0x2e')]({'name':_0x1a55da[_0x65f6('0x18')],'resourceId':_0x1a55da['id'],'type':_0x2ea7f7[_0x65f6('0x18')],'sectionId':_0x2ea7f7['id']},{})[_0x65f6('0x13')](function(){return _0x5edd04;});}else{return _0x5edd04;}})[_0x65f6('0x23')](function(_0xed4c96){logger[_0x65f6('0x37')](_0x65f6('0x38'),_0xed4c96);throw _0xed4c96;});}return _0x5edd04;})['then'](respondWithResult(_0x22d760,0xc9))[_0x65f6('0x23')](handleError(_0x22d760,null));};exports[_0x65f6('0x12')]=function(_0x377ae5,_0x181798){if(_0x377ae5[_0x65f6('0x2f')]['id']){delete _0x377ae5[_0x65f6('0x2f')]['id'];}return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x377ae5[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x181798,null))[_0x65f6('0x13')](saveUpdates(_0x377ae5[_0x65f6('0x2f')],null))[_0x65f6('0x13')](respondWithResult(_0x181798,null))[_0x65f6('0x23')](handleError(_0x181798,null));};exports[_0x65f6('0x15')]=function(_0x2cb38d,_0x5119ee){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x2cb38d[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x5119ee,null))['then'](removeEntity(_0x5119ee,null))[_0x65f6('0x23')](handleError(_0x5119ee,null));};exports[_0x65f6('0x39')]=function(_0x2b01eb,_0x5e69b4){return db[_0x65f6('0x1f')][_0x65f6('0x39')]()[_0x65f6('0x13')](respondWithResult(_0x5e69b4,null))[_0x65f6('0x23')](handleError(_0x5e69b4,null));};exports['getMembers']=function(_0x2ec114,_0x512527){var _0x3f1baa={'raw':!![],'where':{}},_0x6968b={},_0x577c93;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x2ec114[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x512527,null))[_0x65f6('0x13')](function(_0xc0db01){if(_0xc0db01){_0x577c93=_0xc0db01[_0x65f6('0x31')]({'plain':!![]});_0x6968b[_0x65f6('0x26')]=_['keys'](db['UserSmsQueue'][_0x65f6('0x3a')]);_0x6968b[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x2ec114[_0x65f6('0x21')]);_0x6968b[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x6968b[_0x65f6('0x26')],_0x6968b[_0x65f6('0x21')]);_0x3f1baa[_0x65f6('0x29')]=_['intersection'](_0x6968b[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x2ec114[_0x65f6('0x21')]['fields']));_0x3f1baa[_0x65f6('0x29')]=_0x3f1baa[_0x65f6('0x29')]['length']?_0x3f1baa[_0x65f6('0x29')]:_0x6968b[_0x65f6('0x26')];if(!_0x2ec114['query'][_0x65f6('0x3c')]('nolimit')){_0x3f1baa[_0x65f6('0xe')]=qs[_0x65f6('0xe')](_0x2ec114[_0x65f6('0x21')]['limit']);_0x3f1baa[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x2ec114['query'][_0x65f6('0xd')]);}_0x3f1baa[_0x65f6('0x3d')]=qs['sort'](_0x2ec114[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x3f1baa[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x2ec114[_0x65f6('0x21')],_0x6968b[_0x65f6('0x3b')]));_0x3f1baa[_0x65f6('0x1e')]['SmsQueueId']=_0xc0db01['id'];if(_0x2ec114['query']['filter']){_0x3f1baa[_0x65f6('0x1e')]=_[_0x65f6('0x2c')](_0x3f1baa[_0x65f6('0x1e')],{'$or':_[_0x65f6('0x40')](_0x3f1baa['attributes'],function(_0x183c08){var _0x2032b9={};_0x2032b9[_0x183c08]={'$like':'%'+_0x2ec114[_0x65f6('0x21')]['filter']+'%'};return _0x2032b9;})});}_0x3f1baa=_[_0x65f6('0x2c')]({},_0x3f1baa,_0x2ec114[_0x65f6('0x2d')]);return db[_0x65f6('0x41')]['findAll'](_0x3f1baa);}})['then'](function(_0x1d337d){if(_0x1d337d){return db[_0x65f6('0x42')][_0x65f6('0x43')]({'where':{'id':_[_0x65f6('0x40')](_0x1d337d,_0x65f6('0x44')),'role':_0x65f6('0x45')},'attributes':['id',_0x65f6('0x18'),_0x65f6('0x46'),_0x65f6('0x47'),_0x65f6('0x48')]});}})[_0x65f6('0x13')](function(_0x141fcc){if(_0x141fcc){return{'count':_0x141fcc[_0x65f6('0x10')],'rows':_[_0x65f6('0x40')](_0x141fcc['rows'],function(_0x47610a){return{'membername':_0x47610a[_0x65f6('0x18')],'UserId':_0x47610a['id'],'queue_name':_0x577c93[_0x65f6('0x18')],'SmsQueueId':_0x577c93['id'],'interface':util['format'](_0x65f6('0x49'),_0x65f6('0x4a'),_0x47610a[_0x65f6('0x18')]),'penalty':0x0,'paused':_0x47610a[_0x65f6('0x46')],'createdAt':_0x47610a['createdAt'],'updatedAt':_0x47610a[_0x65f6('0x47')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x65f6('0x13')](respondWithFilteredResult(_0x512527,_0x3f1baa))[_0x65f6('0x23')](handleError(_0x512527,null));};exports[_0x65f6('0x4b')]=function(_0x553ff0,_0x2923ff){var _0x2fc20f={};var _0x5c55e4={};var _0x28682b;var _0x26481e;return db[_0x65f6('0x1f')]['findOne']({'where':{'id':_0x553ff0[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x2923ff,null))[_0x65f6('0x13')](function(_0x3c23e3){if(_0x3c23e3){_0x28682b=_0x3c23e3;_0x5c55e4[_0x65f6('0x26')]=_[_0x65f6('0x27')](db['Team']['rawAttributes']);_0x5c55e4['query']=_[_0x65f6('0x27')](_0x553ff0[_0x65f6('0x21')]);_0x5c55e4[_0x65f6('0x3b')]=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],_0x5c55e4[_0x65f6('0x21')]);_0x2fc20f['attributes']=_[_0x65f6('0x28')](_0x5c55e4[_0x65f6('0x26')],qs['fields'](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x2fc20f[_0x65f6('0x29')]=_0x2fc20f['attributes'][_0x65f6('0x4c')]?_0x2fc20f[_0x65f6('0x29')]:_0x5c55e4['model'];_0x2fc20f[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0x3e')]);_0x2fc20f[_0x65f6('0x1e')]=qs[_0x65f6('0x3b')](_[_0x65f6('0x3f')](_0x553ff0['query'],_0x5c55e4['filters']));if(_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x2fc20f['where']=_[_0x65f6('0x2c')](_0x2fc20f['where'],{'$or':_[_0x65f6('0x40')](_0x2fc20f['attributes'],function(_0x440df1){var _0xdc8989={};_0xdc8989[_0x440df1]={'$like':'%'+_0x553ff0[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0xdc8989;})});}_0x2fc20f=_[_0x65f6('0x2c')]({},_0x2fc20f,_0x553ff0[_0x65f6('0x2d')]);return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})[_0x65f6('0x13')](function(_0x2405a7){if(_0x2405a7){_0x26481e=_0x2405a7['length'];if(!_0x553ff0['query'][_0x65f6('0x3c')](_0x65f6('0x4e'))){_0x2fc20f[_0x65f6('0xe')]=qs['limit'](_0x553ff0['query'][_0x65f6('0xe')]);_0x2fc20f[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x553ff0[_0x65f6('0x21')][_0x65f6('0xd')]);}return _0x28682b[_0x65f6('0x4b')](_0x2fc20f);}})['then'](function(_0x4f42ae){if(_0x4f42ae){return _0x4f42ae?{'count':_0x26481e,'rows':_0x4f42ae}:null;}})[_0x65f6('0x13')](respondWithResult(_0x2923ff,null))[_0x65f6('0x23')](handleError(_0x2923ff,null));};exports['addTeams']=function(_0x219bf8,_0x4a8b60){var _0x254e9f=_0x219bf8[_0x65f6('0x2f')][_0x65f6('0x4f')];return db[_0x65f6('0x50')]['findAll']({'where':{'id':_0x254e9f},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id',_0x65f6('0x18'),'online','voicePause',_0x65f6('0x52')],'raw':!![]}]})['then'](function(_0x305967){if(_0x305967){var _0xf6de=_[_0x65f6('0x53')](_0x305967,function(_0x354b90){var _0x512776=_0x354b90['get']({'plain':!![]});return _0x512776['Agents'];});return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x219bf8[_0x65f6('0x25')]['id']}})['then'](function(_0x46cbde){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x49cee2){return _0x46cbde[_0x65f6('0x56')](_0x254e9f,{'transaction':_0x49cee2})[_0x65f6('0x13')](function(){return BPromise['each'](_0xf6de,function(_0x758e80){return db[_0x65f6('0x41')]['findOrCreate']({'where':{'UserId':_0x758e80['id'],'SmsQueueId':_0x219bf8[_0x65f6('0x25')]['id']},'transaction':_0x49cee2});});})['then'](function(){_0xf6de[_0x65f6('0x57')](function(_0x55ea91){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':_0x55ea91['id'],'SmsQueueId':_0x46cbde['id']});});});});});}})['then'](respondWithStatusCode(_0x4a8b60,null))[_0x65f6('0x23')](handleError(_0x4a8b60,null));};exports[_0x65f6('0x5a')]=function(_0x2a700b,_0x299b85){return db[_0x65f6('0x50')][_0x65f6('0x22')]({'where':{'id':_0x2a700b[_0x65f6('0x21')][_0x65f6('0x4f')]},'attributes':['id'],'include':[{'model':db[_0x65f6('0x42')],'as':_0x65f6('0x51'),'attributes':['id'],'raw':!![]}]})[_0x65f6('0x13')](handleEntityNotFound(_0x299b85,null))['then'](function(_0x10a661){var _0x1cf1bd=_[_0x65f6('0x40')](_0x10a661,'id');var _0x219e42=[];var _0x5694f9=[];var _0x453080=squel[_0x65f6('0x5b')]();_0x453080['field'](_0x65f6('0x5c'))['from'](_0x65f6('0x5d'),'tq')['join'](_0x65f6('0x5e'),'ut',_0x65f6('0x5f'))['where']('SmsQueueId\x20=\x20?',_0x2a700b[_0x65f6('0x25')]['id']);for(var _0x413c21=0x0;_0x413c21<_0x10a661['length'];_0x413c21+=0x1){let _0x2d86c8=_0x10a661[_0x413c21];for(var _0x3b3bd5=0x0;_0x3b3bd5<_0x2d86c8[_0x65f6('0x51')]['length'];_0x3b3bd5+=0x1){let _0x1348ec=_0x2d86c8[_0x65f6('0x51')][_0x3b3bd5];var _0x5889dc=_0x453080[_0x65f6('0x60')]();_0x5889dc['where'](_0x65f6('0x61'),_0x1348ec['id']);_0x5694f9['push'](db['sequelize'][_0x65f6('0x21')](_0x5889dc[_0x65f6('0x62')](),{'type':db[_0x65f6('0x54')][_0x65f6('0x63')][_0x65f6('0x64')]})[_0x65f6('0x13')](function(_0x1ac46f){if(_0x1ac46f[_0x65f6('0x4c')]===0x1){return _0x1348ec['id'];}else{var _0x4d66fe=_['every'](_[_0x65f6('0x40')](_0x1ac46f,'TeamId'),function(_0x1ee28a){return _[_0x65f6('0x65')](_0x1cf1bd,_0x1ee28a);});if(_0x4d66fe){return _0x1348ec['id'];}}}));}}return BPromise[_0x65f6('0x66')](_0x5694f9)[_0x65f6('0x13')](function(_0x43127b){_0x219e42=_(_0x219e42)['union'](_0x43127b)[_0x65f6('0x67')]()[_0x65f6('0x68')]();return db[_0x65f6('0x1f')]['find']({'where':{'id':_0x2a700b[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](function(_0x4254c2){return db[_0x65f6('0x54')][_0x65f6('0x55')](function(_0x16bf93){return _0x4254c2['removeTeams'](_0x2a700b['query'][_0x65f6('0x4f')],{'transaction':_0x16bf93})[_0x65f6('0x13')](function(){if(!_[_0x65f6('0x69')](_0x219e42)){return _0x4254c2[_0x65f6('0x6a')](_0x219e42,{'transaction':_0x16bf93});}})['then'](function(){_0x219e42['forEach'](function(_0x336076){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':_0x336076,'SmsQueueId':_0x4254c2['id']});});});});});});})[_0x65f6('0x13')](respondWithStatusCode(_0x299b85,null))[_0x65f6('0x23')](handleError(_0x299b85,null));};exports[_0x65f6('0x6c')]=function(_0x5daaf4,_0x4d607a){return db['SmsQueue'][_0x65f6('0x35')]({'where':{'id':_0x5daaf4[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x4d607a,null))[_0x65f6('0x13')](function(_0x53b11c){if(_0x53b11c){return _0x53b11c['addAgents'](_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')],_['omit'](_0x5daaf4[_0x65f6('0x2f')],['ids','id'])||{})[_0x65f6('0x6d')](function(_0x4f3ef8){for(var _0x3a30ed=0x0;_0x3a30ed<_0x5daaf4[_0x65f6('0x2f')]['ids'][_0x65f6('0x4c')];_0x3a30ed+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x59'),{'UserId':Number(_0x5daaf4[_0x65f6('0x2f')][_0x65f6('0x4f')][_0x3a30ed]),'SmsQueueId':Number(_0x5daaf4[_0x65f6('0x25')]['id'])});}return _0x4f3ef8;});}})['then'](respondWithResult(_0x4d607a,null))[_0x65f6('0x23')](handleError(_0x4d607a,null));};exports['removeAgents']=function(_0x24495c,_0x56336a){return db[_0x65f6('0x1f')][_0x65f6('0x35')]({'where':{'id':_0x24495c[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x56336a,null))['then'](function(_0x2b6f98){if(_0x2b6f98){return _0x2b6f98[_0x65f6('0x6a')](_0x24495c[_0x65f6('0x21')]['ids'])['then'](function(){if(_[_0x65f6('0x6e')](_0x24495c[_0x65f6('0x21')]['ids'])){for(var _0x180cde=0x0;_0x180cde<_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]['length'];_0x180cde+=0x1){socket[_0x65f6('0x58')](_0x65f6('0x6b'),{'UserId':Number(_0x24495c['query'][_0x65f6('0x4f')][_0x180cde]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}}else{socket[_0x65f6('0x58')]('userSmsQueue:remove',{'UserId':Number(_0x24495c[_0x65f6('0x21')][_0x65f6('0x4f')]),'SmsQueueId':Number(_0x24495c[_0x65f6('0x25')]['id'])});}});}})['then'](respondWithStatusCode(_0x56336a,null))[_0x65f6('0x23')](handleError(_0x56336a,null));};exports['getAgents']=function(_0x1beaa7,_0x87a9e4){var _0x31ec61={};var _0x22be6e={};var _0x29b2de;var _0x430fb8;return db['SmsQueue'][_0x65f6('0x6f')]({'where':{'id':_0x1beaa7[_0x65f6('0x25')]['id']}})[_0x65f6('0x13')](handleEntityNotFound(_0x87a9e4,null))[_0x65f6('0x13')](function(_0x207d15){if(_0x207d15){_0x29b2de=_0x207d15;_0x22be6e['model']=_['keys'](db['User'][_0x65f6('0x3a')]);_0x22be6e[_0x65f6('0x21')]=_[_0x65f6('0x27')](_0x1beaa7['query']);_0x22be6e[_0x65f6('0x3b')]=_['intersection'](_0x22be6e['model'],_0x22be6e[_0x65f6('0x21')]);_0x31ec61[_0x65f6('0x29')]=_['intersection'](_0x22be6e[_0x65f6('0x26')],qs[_0x65f6('0x2a')](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x2a')]));_0x31ec61[_0x65f6('0x29')]=_0x31ec61[_0x65f6('0x29')][_0x65f6('0x4c')]?_0x31ec61[_0x65f6('0x29')]:_0x22be6e[_0x65f6('0x26')];_0x31ec61[_0x65f6('0x3d')]=qs[_0x65f6('0x3e')](_0x1beaa7[_0x65f6('0x21')]['sort']);_0x31ec61[_0x65f6('0x1e')]=qs['filters'](_['pick'](_0x1beaa7[_0x65f6('0x21')],_0x22be6e[_0x65f6('0x3b')]));if(_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]){_0x31ec61['where']=_[_0x65f6('0x2c')](_0x31ec61['where'],{'$or':_['map'](_0x31ec61[_0x65f6('0x29')],function(_0x99fe6e){var _0x1a7e52={};_0x1a7e52[_0x99fe6e]={'$like':'%'+_0x1beaa7[_0x65f6('0x21')][_0x65f6('0x4d')]+'%'};return _0x1a7e52;})});}_0x31ec61=_[_0x65f6('0x2c')]({},_0x31ec61,_0x1beaa7['options']);return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})['then'](function(_0x1ef2a0){if(_0x1ef2a0){_0x430fb8=_0x1ef2a0[_0x65f6('0x4c')];if(!_0x1beaa7[_0x65f6('0x21')]['hasOwnProperty'](_0x65f6('0x4e'))){_0x31ec61['limit']=qs['limit'](_0x1beaa7[_0x65f6('0x21')][_0x65f6('0xe')]);_0x31ec61[_0x65f6('0xd')]=qs[_0x65f6('0xd')](_0x1beaa7[_0x65f6('0x21')]['offset']);}return _0x29b2de[_0x65f6('0x70')](_0x31ec61);}})[_0x65f6('0x13')](function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3?{'count':_0x430fb8,'rows':_0x3bebe3}:null;}})[_0x65f6('0x13')](respondWithResult(_0x87a9e4,null))['catch'](handleError(_0x87a9e4,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 10851ab..ffa7b5d 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 _0xcf91=['../../mysqldb','SmsQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x482734,_0x418162){var _0x36651d=function(_0x91cb4f){while(--_0x91cb4f){_0x482734['push'](_0x482734['shift']());}};_0x36651d(++_0x418162);}(_0xcf91,0x1d5));var _0x1cf9=function(_0x2b9b50,_0x520124){_0x2b9b50=_0x2b9b50-0x0;var _0x733b91=_0xcf91[_0x2b9b50];return _0x733b91;};'use strict';var EventEmitter=require(_0x1cf9('0x0'));var SmsQueue=require(_0x1cf9('0x1'))['db'][_0x1cf9('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1cf9('0x3'),'afterUpdate':_0x1cf9('0x4'),'afterDestroy':_0x1cf9('0x5')};function emitEvent(_0x56b263){return function(_0xbf0a04,_0x54cdb5,_0x3333f){SmsQueueEvents[_0x1cf9('0x6')](_0x56b263+':'+_0xbf0a04['id'],_0xbf0a04);SmsQueueEvents[_0x1cf9('0x6')](_0x56b263,_0xbf0a04);_0x3333f(null);};}for(var e in events){if(events[_0x1cf9('0x7')](e)){var event=events[e];SmsQueue[_0x1cf9('0x8')](e,emitEvent(event));}}module[_0x1cf9('0x9')]=SmsQueueEvents; \ No newline at end of file +var _0x84de=['exports','events','../../mysqldb','SmsQueue','update','remove','emit'];(function(_0x3fba97,_0x48a0d3){var _0x32e110=function(_0x177f01){while(--_0x177f01){_0x3fba97['push'](_0x3fba97['shift']());}};_0x32e110(++_0x48a0d3);}(_0x84de,0x94));var _0xe84d=function(_0x36da2a,_0x139b77){_0x36da2a=_0x36da2a-0x0;var _0x457b21=_0x84de[_0x36da2a];return _0x457b21;};'use strict';var EventEmitter=require(_0xe84d('0x0'));var SmsQueue=require(_0xe84d('0x1'))['db'][_0xe84d('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xe84d('0x3'),'afterDestroy':_0xe84d('0x4')};function emitEvent(_0x45e2c4){return function(_0x2bf62f,_0x42cbda,_0x3e919a){SmsQueueEvents['emit'](_0x45e2c4+':'+_0x2bf62f['id'],_0x2bf62f);SmsQueueEvents[_0xe84d('0x5')](_0x45e2c4,_0x2bf62f);_0x3e919a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xe84d('0x6')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 6732eee..c035d31 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 _0x77c9=['bluebird','request-promise','path','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues','lodash','../../config/logger','api'];(function(_0x450a68,_0x41444d){var _0x4f4b1a=function(_0xd7cb05){while(--_0xd7cb05){_0x450a68['push'](_0x450a68['shift']());}};_0x4f4b1a(++_0x41444d);}(_0x77c9,0x10e));var _0x977c=function(_0x4e6243,_0x37ec06){_0x4e6243=_0x4e6243-0x0;var _0x211fbc=_0x77c9[_0x4e6243];return _0x211fbc;};'use strict';var _=require(_0x977c('0x0'));var util=require('util');var logger=require(_0x977c('0x1'))(_0x977c('0x2'));var moment=require('moment');var BPromise=require(_0x977c('0x3'));var rp=require(_0x977c('0x4'));var fs=require('fs');var path=require(_0x977c('0x5'));var rimraf=require(_0x977c('0x6'));var config=require(_0x977c('0x7'));var attributes=require(_0x977c('0x8'));module[_0x977c('0x9')]=function(_0xa40c10,_0x4c191d){return _0xa40c10[_0x977c('0xa')](_0x977c('0xb'),attributes,{'tableName':_0x977c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8d74=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./smsQueue.attributes','exports','define','SmsQueue','sms_queues'];(function(_0x40cbd7,_0x35ee47){var _0x3caf4f=function(_0x50b87a){while(--_0x50b87a){_0x40cbd7['push'](_0x40cbd7['shift']());}};_0x3caf4f(++_0x35ee47);}(_0x8d74,0x1e0));var _0x48d7=function(_0x435b2f,_0x49be4e){_0x435b2f=_0x435b2f-0x0;var _0x1a78a9=_0x8d74[_0x435b2f];return _0x1a78a9;};'use strict';var _=require('lodash');var util=require(_0x48d7('0x0'));var logger=require(_0x48d7('0x1'))('api');var moment=require(_0x48d7('0x2'));var BPromise=require(_0x48d7('0x3'));var rp=require(_0x48d7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x48d7('0x5'));var config=require(_0x48d7('0x6'));var attributes=require(_0x48d7('0x7'));module[_0x48d7('0x8')]=function(_0x297aa8,_0x3f24f4){return _0x297aa8[_0x48d7('0x9')](_0x48d7('0xa'),attributes,{'tableName':_0x48d7('0xb'),'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 a39dd4c..34dda4e 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 _0xdd62=['rpc','jayson/promise','redis','defaults','socket.io-emitter','./smsQueue.socket','register','then','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsQueue,\x20%s,\x20%s','message','result','catch','GetSmsQueue','findAll','options','raw','attributes','limit','include','map','model','info','ShowSmsQueue','SmsQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdd62,0x1e7));var _0x2dd6=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0xdd62[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0x2dd6('0x0'));var util=require('util');var moment=require(_0x2dd6('0x1'));var BPromise=require(_0x2dd6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2dd6('0x3'));var db=require(_0x2dd6('0x4'))['db'];var utils=require(_0x2dd6('0x5'));var logger=require(_0x2dd6('0x6'))(_0x2dd6('0x7'));var config=require('../../config/environment');var jayson=require(_0x2dd6('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x2dd6('0x9')]=_[_0x2dd6('0xa')](config[_0x2dd6('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x2dd6('0xb'))(new Redis(config[_0x2dd6('0x9')]));require(_0x2dd6('0xc'))[_0x2dd6('0xd')](socket);function respondWithRpcPromise(_0x2ea2cb,_0x165d2c,_0x16cb0e){return new BPromise(function(_0x4ff47c,_0x4531cc){return client['request'](_0x2ea2cb,_0x16cb0e)[_0x2dd6('0xe')](function(_0x20cda7){logger['info']('SmsQueue,\x20%s,\x20%s',_0x165d2c,_0x2dd6('0xf'));logger[_0x2dd6('0x10')](_0x2dd6('0x11'),_0x165d2c,'request\x20sent',JSON[_0x2dd6('0x12')](_0x20cda7));if(_0x20cda7[_0x2dd6('0x13')]){if(_0x20cda7[_0x2dd6('0x13')][_0x2dd6('0x14')]===0x1f4){logger[_0x2dd6('0x13')](_0x2dd6('0x15'),_0x165d2c,_0x20cda7[_0x2dd6('0x13')]['message']);return _0x4531cc(_0x20cda7[_0x2dd6('0x13')][_0x2dd6('0x16')]);}logger[_0x2dd6('0x13')]('SmsQueue,\x20%s,\x20%s',_0x165d2c,_0x20cda7[_0x2dd6('0x13')][_0x2dd6('0x16')]);return _0x4ff47c(_0x20cda7[_0x2dd6('0x13')][_0x2dd6('0x16')]);}else{logger['info'](_0x2dd6('0x15'),_0x165d2c,_0x2dd6('0xf'));_0x4ff47c(_0x20cda7[_0x2dd6('0x17')][_0x2dd6('0x16')]);}})[_0x2dd6('0x18')](function(_0x2ca3c9){logger[_0x2dd6('0x13')](_0x2dd6('0x15'),_0x165d2c,_0x2ca3c9);_0x4531cc(_0x2ca3c9);});});}exports[_0x2dd6('0x19')]=function(_0x5a8d04){var _0x471d59=this;return new Promise(function(_0x12a643,_0x4fce2){return db['SmsQueue'][_0x2dd6('0x1a')]({'raw':_0x5a8d04['options']?_0x5a8d04[_0x2dd6('0x1b')][_0x2dd6('0x1c')]===undefined?!![]:![]:!![],'where':_0x5a8d04['options']?_0x5a8d04[_0x2dd6('0x1b')]['where']||null:null,'attributes':_0x5a8d04['options']?_0x5a8d04['options'][_0x2dd6('0x1d')]||null:null,'limit':_0x5a8d04[_0x2dd6('0x1b')]?_0x5a8d04['options'][_0x2dd6('0x1e')]||null:null,'include':_0x5a8d04[_0x2dd6('0x1b')]?_0x5a8d04[_0x2dd6('0x1b')][_0x2dd6('0x1f')]?_[_0x2dd6('0x20')](_0x5a8d04[_0x2dd6('0x1b')]['include'],function(_0x355ba1){return{'model':db[_0x355ba1['model']],'as':_0x355ba1['as'],'attributes':_0x355ba1[_0x2dd6('0x1d')],'include':_0x355ba1[_0x2dd6('0x1f')]?_[_0x2dd6('0x20')](_0x355ba1[_0x2dd6('0x1f')],function(_0x302b18){return{'model':db[_0x302b18[_0x2dd6('0x21')]],'as':_0x302b18['as'],'attributes':_0x302b18[_0x2dd6('0x1d')],'include':_0x302b18[_0x2dd6('0x1f')]?_['map'](_0x302b18[_0x2dd6('0x1f')],function(_0x138a6b){return{'model':db[_0x138a6b[_0x2dd6('0x21')]],'as':_0x138a6b['as'],'attributes':_0x138a6b[_0x2dd6('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2dd6('0xe')](function(_0x45f0a4){logger[_0x2dd6('0x22')](_0x2dd6('0x19'),_0x5a8d04);logger['debug'](_0x2dd6('0x19'),_0x5a8d04,JSON[_0x2dd6('0x12')](_0x45f0a4));_0x12a643(_0x45f0a4);})[_0x2dd6('0x18')](function(_0x5b4331){logger[_0x2dd6('0x13')]('GetSmsQueue',_0x5b4331[_0x2dd6('0x16')],_0x5a8d04);_0x4fce2(_0x471d59[_0x2dd6('0x13')](0x1f4,_0x5b4331[_0x2dd6('0x16')]));});});};exports[_0x2dd6('0x23')]=function(_0x303181){var _0x4c5433=this;return new Promise(function(_0x298dab,_0x1f1267){return db[_0x2dd6('0x24')][_0x2dd6('0x25')]({'raw':_0x303181[_0x2dd6('0x1b')]?_0x303181['options'][_0x2dd6('0x1c')]===undefined?!![]:![]:!![],'where':_0x303181[_0x2dd6('0x1b')]?_0x303181[_0x2dd6('0x1b')]['where']||null:null,'attributes':_0x303181[_0x2dd6('0x1b')]?_0x303181[_0x2dd6('0x1b')]['attributes']||null:null,'include':_0x303181[_0x2dd6('0x1b')]?_0x303181[_0x2dd6('0x1b')]['include']?_[_0x2dd6('0x20')](_0x303181['options']['include'],function(_0x39761f){return{'model':db[_0x39761f[_0x2dd6('0x21')]],'as':_0x39761f['as'],'attributes':_0x39761f[_0x2dd6('0x1d')],'include':_0x39761f[_0x2dd6('0x1f')]?_[_0x2dd6('0x20')](_0x39761f[_0x2dd6('0x1f')],function(_0x3a0a60){return{'model':db[_0x3a0a60['model']],'as':_0x3a0a60['as'],'attributes':_0x3a0a60[_0x2dd6('0x1d')],'include':_0x3a0a60[_0x2dd6('0x1f')]?_[_0x2dd6('0x20')](_0x3a0a60['include'],function(_0xaed528){return{'model':db[_0xaed528[_0x2dd6('0x21')]],'as':_0xaed528['as'],'attributes':_0xaed528[_0x2dd6('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x55c53e){logger['info']('ShowSmsQueue',_0x303181);logger[_0x2dd6('0x10')](_0x2dd6('0x23'),_0x303181,JSON[_0x2dd6('0x12')](_0x55c53e));_0x298dab(_0x55c53e);})[_0x2dd6('0x18')](function(_0x402413){logger[_0x2dd6('0x13')]('ShowSmsQueue',_0x402413[_0x2dd6('0x16')],_0x303181);_0x1f1267(_0x4c5433[_0x2dd6('0x13')](0x1f4,_0x402413['message']));});});}; \ No newline at end of file +var _0x79cc=['find','ShowSmsQueue','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','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','stringify','error','code','message','result','SmsQueue','options','where','attributes','limit','include','model','map','GetSmsQueue'];(function(_0x4f1c19,_0x26d41b){var _0x220fb8=function(_0xc1240a){while(--_0xc1240a){_0x4f1c19['push'](_0x4f1c19['shift']());}};_0x220fb8(++_0x26d41b);}(_0x79cc,0x15b));var _0xc79c=function(_0x4fde87,_0x2f8f7c){_0x4fde87=_0x4fde87-0x0;var _0x5ae112=_0x79cc[_0x4fde87];return _0x5ae112;};'use strict';var _=require(_0xc79c('0x0'));var util=require(_0xc79c('0x1'));var moment=require(_0xc79c('0x2'));var BPromise=require(_0xc79c('0x3'));var rs=require(_0xc79c('0x4'));var fs=require('fs');var Redis=require(_0xc79c('0x5'));var db=require(_0xc79c('0x6'))['db'];var utils=require(_0xc79c('0x7'));var logger=require(_0xc79c('0x8'))('rpc');var config=require(_0xc79c('0x9'));var jayson=require(_0xc79c('0xa'));var client=jayson[_0xc79c('0xb')][_0xc79c('0xc')]({'port':0x232a});config['redis']=_[_0xc79c('0xd')](config[_0xc79c('0xe')],{'host':_0xc79c('0xf'),'port':0x18eb});var socket=require(_0xc79c('0x10'))(new Redis(config[_0xc79c('0xe')]));require(_0xc79c('0x11'))[_0xc79c('0x12')](socket);function respondWithRpcPromise(_0x21a73a,_0x495747,_0x486600){return new BPromise(function(_0x19ab6e,_0x4be2c9){return client[_0xc79c('0x13')](_0x21a73a,_0x486600)[_0xc79c('0x14')](function(_0x556793){logger[_0xc79c('0x15')](_0xc79c('0x16'),_0x495747,_0xc79c('0x17'));logger[_0xc79c('0x18')](_0xc79c('0x19'),_0x495747,_0xc79c('0x17'),JSON[_0xc79c('0x1a')](_0x556793));if(_0x556793[_0xc79c('0x1b')]){if(_0x556793['error'][_0xc79c('0x1c')]===0x1f4){logger['error'](_0xc79c('0x16'),_0x495747,_0x556793[_0xc79c('0x1b')][_0xc79c('0x1d')]);return _0x4be2c9(_0x556793[_0xc79c('0x1b')][_0xc79c('0x1d')]);}logger['error'](_0xc79c('0x16'),_0x495747,_0x556793[_0xc79c('0x1b')][_0xc79c('0x1d')]);return _0x19ab6e(_0x556793[_0xc79c('0x1b')][_0xc79c('0x1d')]);}else{logger['info'](_0xc79c('0x16'),_0x495747,_0xc79c('0x17'));_0x19ab6e(_0x556793[_0xc79c('0x1e')]['message']);}})['catch'](function(_0x546c87){logger[_0xc79c('0x1b')](_0xc79c('0x16'),_0x495747,_0x546c87);_0x4be2c9(_0x546c87);});});}exports['GetSmsQueue']=function(_0x3e4b93){var _0x3870ab=this;return new Promise(function(_0x2b3822,_0x3ec40a){return db[_0xc79c('0x1f')]['findAll']({'raw':_0x3e4b93[_0xc79c('0x20')]?_0x3e4b93[_0xc79c('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x3e4b93[_0xc79c('0x20')]?_0x3e4b93[_0xc79c('0x20')][_0xc79c('0x21')]||null:null,'attributes':_0x3e4b93['options']?_0x3e4b93['options'][_0xc79c('0x22')]||null:null,'limit':_0x3e4b93[_0xc79c('0x20')]?_0x3e4b93['options'][_0xc79c('0x23')]||null:null,'include':_0x3e4b93['options']?_0x3e4b93[_0xc79c('0x20')][_0xc79c('0x24')]?_['map'](_0x3e4b93['options'][_0xc79c('0x24')],function(_0x22d1d8){return{'model':db[_0x22d1d8[_0xc79c('0x25')]],'as':_0x22d1d8['as'],'attributes':_0x22d1d8[_0xc79c('0x22')],'include':_0x22d1d8['include']?_[_0xc79c('0x26')](_0x22d1d8[_0xc79c('0x24')],function(_0x5d3c21){return{'model':db[_0x5d3c21[_0xc79c('0x25')]],'as':_0x5d3c21['as'],'attributes':_0x5d3c21[_0xc79c('0x22')],'include':_0x5d3c21['include']?_['map'](_0x5d3c21[_0xc79c('0x24')],function(_0xbd2689){return{'model':db[_0xbd2689['model']],'as':_0xbd2689['as'],'attributes':_0xbd2689[_0xc79c('0x22')]};}):[]};}):[]};}):[]:[]})[_0xc79c('0x14')](function(_0x2d16cd){logger[_0xc79c('0x15')](_0xc79c('0x27'),_0x3e4b93);logger[_0xc79c('0x18')](_0xc79c('0x27'),_0x3e4b93,JSON[_0xc79c('0x1a')](_0x2d16cd));_0x2b3822(_0x2d16cd);})['catch'](function(_0x55564a){logger[_0xc79c('0x1b')]('GetSmsQueue',_0x55564a['message'],_0x3e4b93);_0x3ec40a(_0x3870ab[_0xc79c('0x1b')](0x1f4,_0x55564a[_0xc79c('0x1d')]));});});};exports['ShowSmsQueue']=function(_0x5b4e89){var _0x4d44fd=this;return new Promise(function(_0x1c709c,_0x591d0f){return db[_0xc79c('0x1f')][_0xc79c('0x28')]({'raw':_0x5b4e89[_0xc79c('0x20')]?_0x5b4e89[_0xc79c('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x5b4e89[_0xc79c('0x20')]?_0x5b4e89[_0xc79c('0x20')]['where']||null:null,'attributes':_0x5b4e89[_0xc79c('0x20')]?_0x5b4e89['options'][_0xc79c('0x22')]||null:null,'include':_0x5b4e89['options']?_0x5b4e89[_0xc79c('0x20')][_0xc79c('0x24')]?_[_0xc79c('0x26')](_0x5b4e89[_0xc79c('0x20')]['include'],function(_0x46312d){return{'model':db[_0x46312d[_0xc79c('0x25')]],'as':_0x46312d['as'],'attributes':_0x46312d[_0xc79c('0x22')],'include':_0x46312d[_0xc79c('0x24')]?_[_0xc79c('0x26')](_0x46312d['include'],function(_0x4aeb81){return{'model':db[_0x4aeb81['model']],'as':_0x4aeb81['as'],'attributes':_0x4aeb81[_0xc79c('0x22')],'include':_0x4aeb81[_0xc79c('0x24')]?_[_0xc79c('0x26')](_0x4aeb81['include'],function(_0x1edbe4){return{'model':db[_0x1edbe4[_0xc79c('0x25')]],'as':_0x1edbe4['as'],'attributes':_0x1edbe4[_0xc79c('0x22')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3f4ac6){logger[_0xc79c('0x15')](_0xc79c('0x29'),_0x5b4e89);logger['debug'](_0xc79c('0x29'),_0x5b4e89,JSON[_0xc79c('0x1a')](_0x3f4ac6));_0x1c709c(_0x3f4ac6);})[_0xc79c('0x2a')](function(_0x422d57){logger[_0xc79c('0x1b')](_0xc79c('0x29'),_0x422d57[_0xc79c('0x1d')],_0x5b4e89);_0x591d0f(_0x4d44fd[_0xc79c('0x1b')](0x1f4,_0x422d57[_0xc79c('0x1d')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 3fc39c4..f1e7e68 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 _0x976b=['register','length','smsQueue:','./smsQueue.events','save','remove','update','emit','removeListener'];(function(_0x211632,_0x378e2e){var _0x5a1da1=function(_0x44aff2){while(--_0x44aff2){_0x211632['push'](_0x211632['shift']());}};_0x5a1da1(++_0x378e2e);}(_0x976b,0x1ce));var _0xb976=function(_0x554eff,_0x515dd9){_0x554eff=_0x554eff-0x0;var _0x416215=_0x976b[_0x554eff];return _0x416215;};'use strict';var SmsQueueEvents=require(_0xb976('0x0'));var events=[_0xb976('0x1'),_0xb976('0x2'),_0xb976('0x3')];function createListener(_0x3f9a8d,_0x8fc92b){return function(_0x4d0b88){_0x8fc92b[_0xb976('0x4')](_0x3f9a8d,_0x4d0b88);};}function removeListener(_0xa89185,_0x539ca4){return function(){SmsQueueEvents[_0xb976('0x5')](_0xa89185,_0x539ca4);};}exports[_0xb976('0x6')]=function(_0x3dc484){for(var _0x3b8e33=0x0,_0x4f72b7=events[_0xb976('0x7')];_0x3b8e33<_0x4f72b7;_0x3b8e33++){var _0x42e3cb=events[_0x3b8e33];var _0x27505e=createListener(_0xb976('0x8')+_0x42e3cb,_0x3dc484);SmsQueueEvents['on'](_0x42e3cb,_0x27505e);}}; \ No newline at end of file +var _0xa324=['length','smsQueue:','update','emit','removeListener'];(function(_0x5678c2,_0xd8cb89){var _0x263105=function(_0x4bb4e9){while(--_0x4bb4e9){_0x5678c2['push'](_0x5678c2['shift']());}};_0x263105(++_0xd8cb89);}(_0xa324,0x129));var _0x4a32=function(_0x2aecb2,_0x343312){_0x2aecb2=_0x2aecb2-0x0;var _0x3ebb80=_0xa324[_0x2aecb2];return _0x3ebb80;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save','remove',_0x4a32('0x0')];function createListener(_0x4179e2,_0x1b9f89){return function(_0x5573fc){_0x1b9f89[_0x4a32('0x1')](_0x4179e2,_0x5573fc);};}function removeListener(_0x3d6034,_0x242e54){return function(){SmsQueueEvents[_0x4a32('0x2')](_0x3d6034,_0x242e54);};}exports['register']=function(_0x281488){for(var _0x9f5e35=0x0,_0xa3b6ef=events[_0x4a32('0x3')];_0x9f5e35<_0xa3b6ef;_0x9f5e35++){var _0x402957=events[_0x9f5e35];var _0x2c4a3f=createListener(_0x4a32('0x4')+_0x402957,_0x281488);SmsQueueEvents['on'](_0x402957,_0x2c4a3f);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 6d140f8..d58c0d1 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 _0x4020=['./smsQueueReport.controller','get','index','/describe','isAuthenticated','describe','/:id','show','update','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4020,0x1f0));var _0x0402=function(_0x1b9d1d,_0x159136){_0x1b9d1d=_0x1b9d1d-0x0;var _0x3d8740=_0x4020[_0x1b9d1d];return _0x3d8740;};'use strict';var multer=require('multer');var util=require(_0x0402('0x0'));var path=require(_0x0402('0x1'));var timeout=require(_0x0402('0x2'));var express=require(_0x0402('0x3'));var router=express[_0x0402('0x4')]();var fs_extra=require(_0x0402('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0402('0x6'));var config=require(_0x0402('0x7'));var controller=require(_0x0402('0x8'));router[_0x0402('0x9')]('/',auth['isAuthenticated'](),controller[_0x0402('0xa')]);router['get'](_0x0402('0xb'),auth[_0x0402('0xc')](),controller[_0x0402('0xd')]);router[_0x0402('0x9')](_0x0402('0xe'),auth[_0x0402('0xc')](),controller[_0x0402('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x0402('0xe'),auth[_0x0402('0xc')](),controller[_0x0402('0x10')]);router['delete'](_0x0402('0xe'),auth[_0x0402('0xc')](),controller['destroy']);module[_0x0402('0x11')]=router; \ No newline at end of file +var _0x5d99=['destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','show','post','create','put','update','delete','/:id'];(function(_0x18af13,_0x1a0693){var _0x37a567=function(_0x2e42e3){while(--_0x2e42e3){_0x18af13['push'](_0x18af13['shift']());}};_0x37a567(++_0x1a0693);}(_0x5d99,0x1b7));var _0x95d9=function(_0x59e821,_0x86c723){_0x59e821=_0x59e821-0x0;var _0x5333f6=_0x5d99[_0x59e821];return _0x5333f6;};'use strict';var multer=require(_0x95d9('0x0'));var util=require(_0x95d9('0x1'));var path=require(_0x95d9('0x2'));var timeout=require(_0x95d9('0x3'));var express=require(_0x95d9('0x4'));var router=express[_0x95d9('0x5')]();var fs_extra=require(_0x95d9('0x6'));var auth=require(_0x95d9('0x7'));var interaction=require(_0x95d9('0x8'));var config=require(_0x95d9('0x9'));var controller=require('./smsQueueReport.controller');router['get']('/',auth[_0x95d9('0xa')](),controller[_0x95d9('0xb')]);router[_0x95d9('0xc')]('/describe',auth['isAuthenticated'](),controller[_0x95d9('0xd')]);router[_0x95d9('0xc')]('/:id',auth[_0x95d9('0xa')](),controller[_0x95d9('0xe')]);router[_0x95d9('0xf')]('/',auth['isAuthenticated'](),controller[_0x95d9('0x10')]);router[_0x95d9('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x95d9('0x12')]);router[_0x95d9('0x13')](_0x95d9('0x14'),auth[_0x95d9('0xa')](),controller[_0x95d9('0x15')]);module[_0x95d9('0x16')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 3f3c7d5..462e45a 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 _0x0940=['moment','exports','STRING','DATE'];(function(_0x1ecc80,_0x2d845d){var _0x4d33f6=function(_0x5e0b0b){while(--_0x5e0b0b){_0x1ecc80['push'](_0x1ecc80['shift']());}};_0x4d33f6(++_0x2d845d);}(_0x0940,0x84));var _0x0094=function(_0x2cee01,_0x3c3642){_0x2cee01=_0x2cee01-0x0;var _0x467c0d=_0x0940[_0x2cee01];return _0x467c0d;};'use strict';var moment=require(_0x0094('0x0'));var Sequelize=require('sequelize');module[_0x0094('0x1')]={'uniqueid':{'type':Sequelize[_0x0094('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x0094('0x2')]},'joinAt':{'type':Sequelize[_0x0094('0x3')]},'leaveAt':{'type':Sequelize[_0x0094('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x0094('0x3')]},'reason':{'type':Sequelize[_0x0094('0x2')]}}; \ No newline at end of file +var _0x9eb7=['exports','STRING','DATE'];(function(_0x553956,_0x57a991){var _0x2e4172=function(_0x2b5dda){while(--_0x2b5dda){_0x553956['push'](_0x553956['shift']());}};_0x2e4172(++_0x57a991);}(_0x9eb7,0x117));var _0x79eb=function(_0x367941,_0x1c847d){_0x367941=_0x367941-0x0;var _0x17bd3f=_0x9eb7[_0x367941];return _0x17bd3f;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x79eb('0x0')]={'uniqueid':{'type':Sequelize[_0x79eb('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x79eb('0x1')]},'joinAt':{'type':Sequelize[_0x79eb('0x2')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x79eb('0x2')]},'exitAt':{'type':Sequelize['DATE']},'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 ae2276a..3eabc47 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 _0xbcaa=['../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','destroy','error','stack','name','send','index','SmsQueueReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbcaa,0xbf));var _0xabca=function(_0x26dd21,_0x155b92){_0x26dd21=_0x26dd21-0x0;var _0x467436=_0xbcaa[_0x26dd21];return _0x467436;};'use strict';var emlformat=require(_0xabca('0x0'));var rimraf=require(_0xabca('0x1'));var zipdir=require(_0xabca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xabca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xabca('0x4'));var util=require(_0xabca('0x5'));var path=require(_0xabca('0x6'));var sox=require('sox');var csv=require(_0xabca('0x7'));var ejs=require(_0xabca('0x8'));var fs=require('fs');var fs_extra=require(_0xabca('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xabca('0xa'));var deskjs=require(_0xabca('0xb'));var toCsv=require(_0xabca('0x7'));var querystring=require(_0xabca('0xc'));var Papa=require(_0xabca('0xd'));var Redis=require(_0xabca('0xe'));var authService=require(_0xabca('0xf'));var qs=require(_0xabca('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xabca('0x11'));var logger=require(_0xabca('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xabca('0x13'));var licenseUtil=require(_0xabca('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4f7202,_0x4b3d69){_0x4b3d69=_0x4b3d69||0xcc;return function(_0x44a03f){if(_0x44a03f){return _0x4f7202[_0xabca('0x15')](_0x4b3d69);}return _0x4f7202[_0xabca('0x16')](_0x4b3d69)[_0xabca('0x17')]();};}function respondWithResult(_0x2d1e2b,_0xc3e7d3){_0xc3e7d3=_0xc3e7d3||0xc8;return function(_0x48bc58){if(_0x48bc58){return _0x2d1e2b[_0xabca('0x16')](_0xc3e7d3)[_0xabca('0x18')](_0x48bc58);}};}function respondWithFilteredResult(_0x552d71,_0x18b5f8){return function(_0x3deeee){if(_0x3deeee){var _0x2ba07b=typeof _0x18b5f8[_0xabca('0x19')]===_0xabca('0x1a')&&typeof _0x18b5f8[_0xabca('0x1b')]===_0xabca('0x1a');var _0x9d7181=_0x3deeee[_0xabca('0x1c')];var _0x1b657c=_0x2ba07b?0x0:_0x18b5f8[_0xabca('0x19')];var _0x275c45=_0x2ba07b?_0x3deeee['count']:_0x18b5f8['offset']+_0x18b5f8[_0xabca('0x1b')];var _0x5b81e1;if(_0x275c45>=_0x9d7181){_0x275c45=_0x9d7181;_0x5b81e1=0xc8;}else{_0x5b81e1=0xce;}_0x552d71[_0xabca('0x16')](_0x5b81e1);return _0x552d71[_0xabca('0x1d')](_0xabca('0x1e'),_0x1b657c+'-'+_0x275c45+'/'+_0x9d7181)[_0xabca('0x18')](_0x3deeee);}return null;};}function patchUpdates(_0x1634e5){return function(_0x2fc546){try{jsonpatch['apply'](_0x2fc546,_0x1634e5,!![]);}catch(_0x21644f){return BPromise[_0xabca('0x1f')](_0x21644f);}return _0x2fc546['save']();};}function saveUpdates(_0xd78d41,_0xa7da90){return function(_0x56dd18){if(_0x56dd18){return _0x56dd18[_0xabca('0x20')](_0xd78d41)[_0xabca('0x21')](function(_0x54ff70){return _0x54ff70;});}return null;};}function removeEntity(_0x10fe4f,_0x4caedb){return function(_0x3f2c81){if(_0x3f2c81){return _0x3f2c81[_0xabca('0x22')]()[_0xabca('0x21')](function(){_0x10fe4f[_0xabca('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39fe44,_0x13d252){return function(_0xbeae18){if(!_0xbeae18){_0x39fe44[_0xabca('0x15')](0x194);}return _0xbeae18;};}function handleError(_0x39d084,_0x2ee876){_0x2ee876=_0x2ee876||0x1f4;return function(_0x36c8ba){logger[_0xabca('0x23')](_0x36c8ba[_0xabca('0x24')]);if(_0x36c8ba[_0xabca('0x25')]){delete _0x36c8ba[_0xabca('0x25')];}_0x39d084[_0xabca('0x16')](_0x2ee876)[_0xabca('0x26')](_0x36c8ba);};}exports[_0xabca('0x27')]=function(_0x4719cb,_0x458b53){var _0x242d9a={},_0x1f1cf6={},_0x20a1fc={'count':0x0,'rows':[]};var _0x113bea=_['map'](db[_0xabca('0x28')][_0xabca('0x29')],function(_0x44b985){return{'name':_0x44b985[_0xabca('0x2a')],'type':_0x44b985[_0xabca('0x2b')][_0xabca('0x2c')]};});_0x1f1cf6[_0xabca('0x2d')]=_[_0xabca('0x2e')](_0x113bea,_0xabca('0x25'));_0x1f1cf6[_0xabca('0x2f')]=_[_0xabca('0x30')](_0x4719cb[_0xabca('0x2f')]);_0x1f1cf6[_0xabca('0x31')]=_[_0xabca('0x32')](_0x1f1cf6[_0xabca('0x2d')],_0x1f1cf6[_0xabca('0x2f')]);_0x242d9a['attributes']=_[_0xabca('0x32')](_0x1f1cf6['model'],qs[_0xabca('0x33')](_0x4719cb[_0xabca('0x2f')][_0xabca('0x33')]));_0x242d9a[_0xabca('0x34')]=_0x242d9a[_0xabca('0x34')][_0xabca('0x35')]?_0x242d9a[_0xabca('0x34')]:_0x1f1cf6['model'];if(!_0x4719cb[_0xabca('0x2f')]['hasOwnProperty'](_0xabca('0x36'))){_0x242d9a[_0xabca('0x1b')]=qs[_0xabca('0x1b')](_0x4719cb['query']['limit']);_0x242d9a[_0xabca('0x19')]=qs['offset'](_0x4719cb[_0xabca('0x2f')][_0xabca('0x19')]);}_0x242d9a[_0xabca('0x37')]=qs[_0xabca('0x38')](_0x4719cb['query'][_0xabca('0x38')]);_0x242d9a[_0xabca('0x39')]=qs[_0xabca('0x31')](_['pick'](_0x4719cb['query'],_0x1f1cf6['filters']),_0x113bea);if(_0x4719cb['query'][_0xabca('0x3a')]){_0x242d9a[_0xabca('0x39')]=_['merge'](_0x242d9a['where'],{'$or':_[_0xabca('0x2e')](_0x113bea,function(_0x49808f){if(_0x49808f[_0xabca('0x2b')]!==_0xabca('0x3b')){var _0x4371da={};_0x4371da[_0x49808f['name']]={'$like':'%'+_0x4719cb[_0xabca('0x2f')][_0xabca('0x3a')]+'%'};return _0x4371da;}})});}_0x242d9a=_[_0xabca('0x3c')]({},_0x242d9a,_0x4719cb[_0xabca('0x3d')]);var _0x5517ed={'where':_0x242d9a[_0xabca('0x39')]};return db[_0xabca('0x28')][_0xabca('0x1c')](_0x5517ed)[_0xabca('0x21')](function(_0x2d7579){_0x20a1fc[_0xabca('0x1c')]=_0x2d7579;if(_0x4719cb[_0xabca('0x2f')][_0xabca('0x3e')]){_0x242d9a[_0xabca('0x3f')]=[{'all':!![]}];}return db[_0xabca('0x28')]['findAll'](_0x242d9a);})[_0xabca('0x21')](function(_0x1f55e2){_0x20a1fc['rows']=_0x1f55e2;return _0x20a1fc;})[_0xabca('0x21')](respondWithFilteredResult(_0x458b53,_0x242d9a))[_0xabca('0x40')](handleError(_0x458b53,null));};exports[_0xabca('0x41')]=function(_0x43a8b3,_0x2c1785){var _0xe9aa10={'raw':!![],'where':{'id':_0x43a8b3[_0xabca('0x42')]['id']}},_0x214b71={};_0x214b71['model']=_['keys'](db[_0xabca('0x28')][_0xabca('0x29')]);_0x214b71[_0xabca('0x2f')]=_[_0xabca('0x30')](_0x43a8b3['query']);_0x214b71[_0xabca('0x31')]=_['intersection'](_0x214b71[_0xabca('0x2d')],_0x214b71[_0xabca('0x2f')]);_0xe9aa10[_0xabca('0x34')]=_[_0xabca('0x32')](_0x214b71[_0xabca('0x2d')],qs[_0xabca('0x33')](_0x43a8b3[_0xabca('0x2f')][_0xabca('0x33')]));_0xe9aa10[_0xabca('0x34')]=_0xe9aa10[_0xabca('0x34')][_0xabca('0x35')]?_0xe9aa10[_0xabca('0x34')]:_0x214b71['model'];if(_0x43a8b3[_0xabca('0x2f')][_0xabca('0x3e')]){_0xe9aa10[_0xabca('0x3f')]=[{'all':!![]}];}_0xe9aa10=_[_0xabca('0x3c')]({},_0xe9aa10,_0x43a8b3[_0xabca('0x3d')]);return db[_0xabca('0x28')][_0xabca('0x43')](_0xe9aa10)[_0xabca('0x21')](handleEntityNotFound(_0x2c1785,null))[_0xabca('0x21')](respondWithResult(_0x2c1785,null))['catch'](handleError(_0x2c1785,null));};exports[_0xabca('0x44')]=function(_0x41c60e,_0x3cc68b){return db[_0xabca('0x28')]['create'](_0x41c60e['body'],{})[_0xabca('0x21')](respondWithResult(_0x3cc68b,0xc9))[_0xabca('0x40')](handleError(_0x3cc68b,null));};exports[_0xabca('0x20')]=function(_0x3d92f5,_0x4e5350){if(_0x3d92f5['body']['id']){delete _0x3d92f5['body']['id'];}return db[_0xabca('0x28')][_0xabca('0x43')]({'where':{'id':_0x3d92f5['params']['id']}})['then'](handleEntityNotFound(_0x4e5350,null))[_0xabca('0x21')](saveUpdates(_0x3d92f5[_0xabca('0x45')],null))[_0xabca('0x21')](respondWithResult(_0x4e5350,null))[_0xabca('0x40')](handleError(_0x4e5350,null));};exports[_0xabca('0x22')]=function(_0x24f935,_0xb39ffd){return db[_0xabca('0x28')][_0xabca('0x43')]({'where':{'id':_0x24f935[_0xabca('0x42')]['id']}})[_0xabca('0x21')](handleEntityNotFound(_0xb39ffd,null))[_0xabca('0x21')](removeEntity(_0xb39ffd,null))[_0xabca('0x40')](handleError(_0xb39ffd,null));};exports['describe']=function(_0x2982fd,_0x4eae8f){return db['SmsQueueReport']['describe']()[_0xabca('0x21')](respondWithResult(_0x4eae8f,null))[_0xabca('0x40')](handleError(_0x4eae8f,null));}; \ No newline at end of file +var _0x1a50=['update','then','destroy','end','error','stack','name','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','map','VIRTUAL','options','SmsQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','describe','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','apply','reject'];(function(_0x2c94a5,_0x128193){var _0x472eac=function(_0x4ab9af){while(--_0x4ab9af){_0x2c94a5['push'](_0x2c94a5['shift']());}};_0x472eac(++_0x128193);}(_0x1a50,0x14d));var _0x01a5=function(_0x212a37,_0xf35b2e){_0x212a37=_0x212a37-0x0;var _0x5d0bf9=_0x1a50[_0x212a37];return _0x5d0bf9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x01a5('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x01a5('0x1'));var moment=require(_0x01a5('0x2'));var BPromise=require(_0x01a5('0x3'));var Mustache=require('mustache');var util=require(_0x01a5('0x4'));var path=require(_0x01a5('0x5'));var sox=require(_0x01a5('0x6'));var csv=require(_0x01a5('0x7'));var ejs=require(_0x01a5('0x8'));var fs=require('fs');var fs_extra=require(_0x01a5('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x01a5('0xa'));var jsforce=require(_0x01a5('0xb'));var deskjs=require(_0x01a5('0xc'));var toCsv=require(_0x01a5('0x7'));var querystring=require('querystring');var Papa=require(_0x01a5('0xd'));var Redis=require('ioredis');var authService=require(_0x01a5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x01a5('0xf'));var hardwareService=require(_0x01a5('0x10'));var logger=require('../../config/logger')(_0x01a5('0x11'));var utils=require(_0x01a5('0x12'));var config=require(_0x01a5('0x13'));var licenseUtil=require(_0x01a5('0x14'));var db=require(_0x01a5('0x15'))['db'];function respondWithStatusCode(_0xbb5598,_0x6f210f){_0x6f210f=_0x6f210f||0xcc;return function(_0x2e6e73){if(_0x2e6e73){return _0xbb5598[_0x01a5('0x16')](_0x6f210f);}return _0xbb5598[_0x01a5('0x17')](_0x6f210f)['end']();};}function respondWithResult(_0x210e3c,_0x347a59){_0x347a59=_0x347a59||0xc8;return function(_0xa62ad6){if(_0xa62ad6){return _0x210e3c[_0x01a5('0x17')](_0x347a59)[_0x01a5('0x18')](_0xa62ad6);}};}function respondWithFilteredResult(_0x296d5d,_0x59a957){return function(_0x52d554){if(_0x52d554){var _0x2a3a72=typeof _0x59a957['offset']===_0x01a5('0x19')&&typeof _0x59a957['limit']==='undefined';var _0x40b358=_0x52d554[_0x01a5('0x1a')];var _0x56456f=_0x2a3a72?0x0:_0x59a957[_0x01a5('0x1b')];var _0x5350cc=_0x2a3a72?_0x52d554[_0x01a5('0x1a')]:_0x59a957[_0x01a5('0x1b')]+_0x59a957[_0x01a5('0x1c')];var _0xbc3efc;if(_0x5350cc>=_0x40b358){_0x5350cc=_0x40b358;_0xbc3efc=0xc8;}else{_0xbc3efc=0xce;}_0x296d5d[_0x01a5('0x17')](_0xbc3efc);return _0x296d5d[_0x01a5('0x1d')]('Content-Range',_0x56456f+'-'+_0x5350cc+'/'+_0x40b358)[_0x01a5('0x18')](_0x52d554);}return null;};}function patchUpdates(_0xd19286){return function(_0x352fcb){try{jsonpatch[_0x01a5('0x1e')](_0x352fcb,_0xd19286,!![]);}catch(_0x3c199b){return BPromise[_0x01a5('0x1f')](_0x3c199b);}return _0x352fcb['save']();};}function saveUpdates(_0x58cdb0,_0x535166){return function(_0x4aa5cf){if(_0x4aa5cf){return _0x4aa5cf[_0x01a5('0x20')](_0x58cdb0)[_0x01a5('0x21')](function(_0x4cdec7){return _0x4cdec7;});}return null;};}function removeEntity(_0x2bc8e2,_0x58147d){return function(_0xd6987f){if(_0xd6987f){return _0xd6987f[_0x01a5('0x22')]()[_0x01a5('0x21')](function(){_0x2bc8e2['status'](0xcc)[_0x01a5('0x23')]();});}};}function handleEntityNotFound(_0x562865,_0x8d0f43){return function(_0x459feb){if(!_0x459feb){_0x562865[_0x01a5('0x16')](0x194);}return _0x459feb;};}function handleError(_0x55e86c,_0x47ec3d){_0x47ec3d=_0x47ec3d||0x1f4;return function(_0x34aec1){logger[_0x01a5('0x24')](_0x34aec1[_0x01a5('0x25')]);if(_0x34aec1['name']){delete _0x34aec1[_0x01a5('0x26')];}_0x55e86c['status'](_0x47ec3d)['send'](_0x34aec1);};}exports['index']=function(_0x37eed3,_0x287150){var _0x5ebc1c={},_0x4c2058={},_0x4b3c65={'count':0x0,'rows':[]};var _0x38cbed=_['map'](db['SmsQueueReport'][_0x01a5('0x27')],function(_0x847e3e){return{'name':_0x847e3e[_0x01a5('0x28')],'type':_0x847e3e[_0x01a5('0x29')][_0x01a5('0x2a')]};});_0x4c2058[_0x01a5('0x2b')]=_['map'](_0x38cbed,_0x01a5('0x26'));_0x4c2058[_0x01a5('0x2c')]=_['keys'](_0x37eed3[_0x01a5('0x2c')]);_0x4c2058[_0x01a5('0x2d')]=_[_0x01a5('0x2e')](_0x4c2058[_0x01a5('0x2b')],_0x4c2058['query']);_0x5ebc1c[_0x01a5('0x2f')]=_['intersection'](_0x4c2058[_0x01a5('0x2b')],qs[_0x01a5('0x30')](_0x37eed3[_0x01a5('0x2c')][_0x01a5('0x30')]));_0x5ebc1c['attributes']=_0x5ebc1c[_0x01a5('0x2f')][_0x01a5('0x31')]?_0x5ebc1c[_0x01a5('0x2f')]:_0x4c2058[_0x01a5('0x2b')];if(!_0x37eed3['query'][_0x01a5('0x32')]('nolimit')){_0x5ebc1c[_0x01a5('0x1c')]=qs[_0x01a5('0x1c')](_0x37eed3[_0x01a5('0x2c')][_0x01a5('0x1c')]);_0x5ebc1c[_0x01a5('0x1b')]=qs['offset'](_0x37eed3[_0x01a5('0x2c')][_0x01a5('0x1b')]);}_0x5ebc1c[_0x01a5('0x33')]=qs[_0x01a5('0x34')](_0x37eed3[_0x01a5('0x2c')][_0x01a5('0x34')]);_0x5ebc1c[_0x01a5('0x35')]=qs[_0x01a5('0x2d')](_[_0x01a5('0x36')](_0x37eed3[_0x01a5('0x2c')],_0x4c2058[_0x01a5('0x2d')]),_0x38cbed);if(_0x37eed3['query'][_0x01a5('0x37')]){_0x5ebc1c[_0x01a5('0x35')]=_[_0x01a5('0x38')](_0x5ebc1c[_0x01a5('0x35')],{'$or':_[_0x01a5('0x39')](_0x38cbed,function(_0x3a9921){if(_0x3a9921[_0x01a5('0x29')]!==_0x01a5('0x3a')){var _0x5764df={};_0x5764df[_0x3a9921['name']]={'$like':'%'+_0x37eed3[_0x01a5('0x2c')][_0x01a5('0x37')]+'%'};return _0x5764df;}})});}_0x5ebc1c=_[_0x01a5('0x38')]({},_0x5ebc1c,_0x37eed3[_0x01a5('0x3b')]);var _0x246888={'where':_0x5ebc1c[_0x01a5('0x35')]};return db[_0x01a5('0x3c')][_0x01a5('0x1a')](_0x246888)[_0x01a5('0x21')](function(_0x367e9b){_0x4b3c65[_0x01a5('0x1a')]=_0x367e9b;if(_0x37eed3['query'][_0x01a5('0x3d')]){_0x5ebc1c[_0x01a5('0x3e')]=[{'all':!![]}];}return db[_0x01a5('0x3c')][_0x01a5('0x3f')](_0x5ebc1c);})[_0x01a5('0x21')](function(_0x438f4e){_0x4b3c65[_0x01a5('0x40')]=_0x438f4e;return _0x4b3c65;})[_0x01a5('0x21')](respondWithFilteredResult(_0x287150,_0x5ebc1c))[_0x01a5('0x41')](handleError(_0x287150,null));};exports[_0x01a5('0x42')]=function(_0x2a6cec,_0x21f678){var _0x27f033={'raw':!![],'where':{'id':_0x2a6cec[_0x01a5('0x43')]['id']}},_0x4f9806={};_0x4f9806[_0x01a5('0x2b')]=_[_0x01a5('0x44')](db[_0x01a5('0x3c')]['rawAttributes']);_0x4f9806[_0x01a5('0x2c')]=_[_0x01a5('0x44')](_0x2a6cec[_0x01a5('0x2c')]);_0x4f9806[_0x01a5('0x2d')]=_[_0x01a5('0x2e')](_0x4f9806['model'],_0x4f9806[_0x01a5('0x2c')]);_0x27f033[_0x01a5('0x2f')]=_[_0x01a5('0x2e')](_0x4f9806[_0x01a5('0x2b')],qs[_0x01a5('0x30')](_0x2a6cec[_0x01a5('0x2c')][_0x01a5('0x30')]));_0x27f033['attributes']=_0x27f033[_0x01a5('0x2f')][_0x01a5('0x31')]?_0x27f033['attributes']:_0x4f9806[_0x01a5('0x2b')];if(_0x2a6cec['query'][_0x01a5('0x3d')]){_0x27f033[_0x01a5('0x3e')]=[{'all':!![]}];}_0x27f033=_[_0x01a5('0x38')]({},_0x27f033,_0x2a6cec[_0x01a5('0x3b')]);return db['SmsQueueReport']['find'](_0x27f033)[_0x01a5('0x21')](handleEntityNotFound(_0x21f678,null))[_0x01a5('0x21')](respondWithResult(_0x21f678,null))[_0x01a5('0x41')](handleError(_0x21f678,null));};exports[_0x01a5('0x45')]=function(_0x4bb363,_0x27a3dd){return db[_0x01a5('0x3c')]['create'](_0x4bb363['body'],{})[_0x01a5('0x21')](respondWithResult(_0x27a3dd,0xc9))[_0x01a5('0x41')](handleError(_0x27a3dd,null));};exports[_0x01a5('0x20')]=function(_0x22cb76,_0x443d6b){if(_0x22cb76['body']['id']){delete _0x22cb76[_0x01a5('0x46')]['id'];}return db[_0x01a5('0x3c')][_0x01a5('0x47')]({'where':{'id':_0x22cb76[_0x01a5('0x43')]['id']}})[_0x01a5('0x21')](handleEntityNotFound(_0x443d6b,null))[_0x01a5('0x21')](saveUpdates(_0x22cb76['body'],null))['then'](respondWithResult(_0x443d6b,null))['catch'](handleError(_0x443d6b,null));};exports[_0x01a5('0x22')]=function(_0x5ec38a,_0x346889){return db[_0x01a5('0x3c')][_0x01a5('0x47')]({'where':{'id':_0x5ec38a[_0x01a5('0x43')]['id']}})[_0x01a5('0x21')](handleEntityNotFound(_0x346889,null))[_0x01a5('0x21')](removeEntity(_0x346889,null))['catch'](handleError(_0x346889,null));};exports[_0x01a5('0x48')]=function(_0x16f0eb,_0x1a247f){return db[_0x01a5('0x3c')]['describe']()[_0x01a5('0x21')](respondWithResult(_0x1a247f,null))[_0x01a5('0x41')](handleError(_0x1a247f,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5ac617e..2afed89 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 _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x23b3ac,_0x3963ce){var _0xdcebe2=function(_0x364672){while(--_0x364672){_0x23b3ac['push'](_0x23b3ac['shift']());}};_0xdcebe2(++_0x3963ce);}(_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 +var _0xcb91=['path','rimraf','./smsQueueReport.attributes','exports','define','report_sms_queue','uniqueid','../../config/logger','api','moment','bluebird'];(function(_0x1f958e,_0x1941cc){var _0x31311a=function(_0x1a8ea6){while(--_0x1a8ea6){_0x1f958e['push'](_0x1f958e['shift']());}};_0x31311a(++_0x1941cc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x4b12ae,_0xf2b3b){_0x4b12ae=_0x4b12ae-0x0;var _0x16957b=_0xcb91[_0x4b12ae];return _0x16957b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));module[_0x1cb9('0x7')]=function(_0x53ffbd,_0x226b69){return _0x53ffbd[_0x1cb9('0x8')]('SmsQueueReport',attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[{'name':_0x1cb9('0xa'),'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 fae1be1..b72e438 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 _0xd42c=['jayson/promise','client','http','then','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','SmsQueueReport,\x20%s,\x20%s','message','result','catch','CreateSmsQueueReport','body','options','raw','info','UpdateSmsQueueReport','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment'];(function(_0x4e1584,_0x3e0d82){var _0x1f4d68=function(_0x58f59b){while(--_0x58f59b){_0x4e1584['push'](_0x4e1584['shift']());}};_0x1f4d68(++_0x3e0d82);}(_0xd42c,0x16c));var _0xcd42=function(_0x30868,_0x39793f){_0x30868=_0x30868-0x0;var _0x3ee1d4=_0xd42c[_0x30868];return _0x3ee1d4;};'use strict';var _=require('lodash');var util=require(_0xcd42('0x0'));var moment=require(_0xcd42('0x1'));var BPromise=require(_0xcd42('0x2'));var rs=require(_0xcd42('0x3'));var fs=require('fs');var Redis=require(_0xcd42('0x4'));var db=require(_0xcd42('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xcd42('0x6'));var config=require(_0xcd42('0x7'));var jayson=require(_0xcd42('0x8'));var client=jayson[_0xcd42('0x9')][_0xcd42('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fe739,_0xb7d38e,_0x1cc5ef){return new BPromise(function(_0x444988,_0x36fdb0){return client['request'](_0x4fe739,_0x1cc5ef)[_0xcd42('0xb')](function(_0xe78fc7){logger['info']('SmsQueueReport,\x20%s,\x20%s',_0xb7d38e,_0xcd42('0xc'));logger[_0xcd42('0xd')](_0xcd42('0xe'),_0xb7d38e,_0xcd42('0xc'),JSON[_0xcd42('0xf')](_0xe78fc7));if(_0xe78fc7['error']){if(_0xe78fc7['error'][_0xcd42('0x10')]===0x1f4){logger[_0xcd42('0x11')]('SmsQueueReport,\x20%s,\x20%s',_0xb7d38e,_0xe78fc7[_0xcd42('0x11')]['message']);return _0x36fdb0(_0xe78fc7[_0xcd42('0x11')]['message']);}logger[_0xcd42('0x11')](_0xcd42('0x12'),_0xb7d38e,_0xe78fc7[_0xcd42('0x11')]['message']);return _0x444988(_0xe78fc7['error'][_0xcd42('0x13')]);}else{logger['info'](_0xcd42('0x12'),_0xb7d38e,_0xcd42('0xc'));_0x444988(_0xe78fc7[_0xcd42('0x14')][_0xcd42('0x13')]);}})[_0xcd42('0x15')](function(_0x1c8e91){logger[_0xcd42('0x11')](_0xcd42('0x12'),_0xb7d38e,_0x1c8e91);_0x36fdb0(_0x1c8e91);});});}exports[_0xcd42('0x16')]=function(_0x590817){var _0xbd50f3=this;return new Promise(function(_0x423be1,_0x2055a8){return db['SmsQueueReport']['create'](_0x590817[_0xcd42('0x17')],{'raw':_0x590817[_0xcd42('0x18')]?_0x590817['options'][_0xcd42('0x19')]===undefined?!![]:![]:!![]})[_0xcd42('0xb')](function(_0x3f7fc4){logger[_0xcd42('0x1a')](_0xcd42('0x16'),_0x590817);logger[_0xcd42('0xd')](_0xcd42('0x16'),_0x590817,JSON[_0xcd42('0xf')](_0x3f7fc4));_0x423be1(_0x3f7fc4);})[_0xcd42('0x15')](function(_0x27a750){logger[_0xcd42('0x11')](_0xcd42('0x16'),_0x27a750[_0xcd42('0x13')],_0x590817);_0x2055a8(_0xbd50f3[_0xcd42('0x11')](0x1f4,_0x27a750[_0xcd42('0x13')]));});});};exports[_0xcd42('0x1b')]=function(_0xbc1a28){var _0x1667ef=this;return new Promise(function(_0x5ca3d4,_0x46ac36){return db['SmsQueueReport']['update'](_0xbc1a28[_0xcd42('0x17')],{'raw':_0xbc1a28[_0xcd42('0x18')]?_0xbc1a28[_0xcd42('0x18')][_0xcd42('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xbc1a28['options']?_0xbc1a28[_0xcd42('0x18')][_0xcd42('0x1c')]||null:null,'attributes':_0xbc1a28['options']?_0xbc1a28['options'][_0xcd42('0x1d')]||null:null,'limit':_0xbc1a28['options']?_0xbc1a28[_0xcd42('0x18')][_0xcd42('0x1e')]||null:null})['then'](function(_0x456885){logger[_0xcd42('0x1a')](_0xcd42('0x1b'),_0xbc1a28);logger[_0xcd42('0xd')]('UpdateSmsQueueReport',_0xbc1a28,JSON[_0xcd42('0xf')](_0x456885));_0x5ca3d4(_0x456885);})[_0xcd42('0x15')](function(_0x135bf7){logger[_0xcd42('0x11')](_0xcd42('0x1b'),_0x135bf7['message'],_0xbc1a28);_0x46ac36(_0x1667ef[_0xcd42('0x11')](0x1f4,_0x135bf7[_0xcd42('0x13')]));});});}; \ No newline at end of file +var _0xf0e1=['result','catch','CreateSmsQueueReport','create','body','options','raw','then','UpdateSmsQueueReport','SmsQueueReport','update','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xf0e1,0x1a5));var _0x1f0e=function(_0xdb357c,_0x3786b6){_0xdb357c=_0xdb357c-0x0;var _0x5c8735=_0xf0e1[_0xdb357c];return _0x5c8735;};'use strict';var _=require(_0x1f0e('0x0'));var util=require(_0x1f0e('0x1'));var moment=require(_0x1f0e('0x2'));var BPromise=require('bluebird');var rs=require(_0x1f0e('0x3'));var fs=require('fs');var Redis=require(_0x1f0e('0x4'));var db=require(_0x1f0e('0x5'))['db'];var utils=require(_0x1f0e('0x6'));var logger=require(_0x1f0e('0x7'))(_0x1f0e('0x8'));var config=require(_0x1f0e('0x9'));var jayson=require(_0x1f0e('0xa'));var client=jayson[_0x1f0e('0xb')][_0x1f0e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x157b98,_0x676abb,_0x4e8620){return new BPromise(function(_0x4ef1a3,_0x3cbdc0){return client[_0x1f0e('0xd')](_0x157b98,_0x4e8620)['then'](function(_0x24aaf6){logger[_0x1f0e('0xe')](_0x1f0e('0xf'),_0x676abb,_0x1f0e('0x10'));logger[_0x1f0e('0x11')](_0x1f0e('0x12'),_0x676abb,_0x1f0e('0x10'),JSON[_0x1f0e('0x13')](_0x24aaf6));if(_0x24aaf6[_0x1f0e('0x14')]){if(_0x24aaf6[_0x1f0e('0x14')][_0x1f0e('0x15')]===0x1f4){logger[_0x1f0e('0x14')](_0x1f0e('0xf'),_0x676abb,_0x24aaf6['error'][_0x1f0e('0x16')]);return _0x3cbdc0(_0x24aaf6[_0x1f0e('0x14')][_0x1f0e('0x16')]);}logger[_0x1f0e('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x676abb,_0x24aaf6[_0x1f0e('0x14')]['message']);return _0x4ef1a3(_0x24aaf6[_0x1f0e('0x14')][_0x1f0e('0x16')]);}else{logger[_0x1f0e('0xe')](_0x1f0e('0xf'),_0x676abb,_0x1f0e('0x10'));_0x4ef1a3(_0x24aaf6[_0x1f0e('0x17')]['message']);}})[_0x1f0e('0x18')](function(_0x2c1b37){logger[_0x1f0e('0x14')]('SmsQueueReport,\x20%s,\x20%s',_0x676abb,_0x2c1b37);_0x3cbdc0(_0x2c1b37);});});}exports[_0x1f0e('0x19')]=function(_0x31d8fc){var _0x473e9d=this;return new Promise(function(_0xc6d71e,_0x4dfc4b){return db['SmsQueueReport'][_0x1f0e('0x1a')](_0x31d8fc[_0x1f0e('0x1b')],{'raw':_0x31d8fc[_0x1f0e('0x1c')]?_0x31d8fc[_0x1f0e('0x1c')][_0x1f0e('0x1d')]===undefined?!![]:![]:!![]})[_0x1f0e('0x1e')](function(_0x484096){logger[_0x1f0e('0xe')](_0x1f0e('0x19'),_0x31d8fc);logger[_0x1f0e('0x11')](_0x1f0e('0x19'),_0x31d8fc,JSON[_0x1f0e('0x13')](_0x484096));_0xc6d71e(_0x484096);})[_0x1f0e('0x18')](function(_0x4a1962){logger['error']('CreateSmsQueueReport',_0x4a1962[_0x1f0e('0x16')],_0x31d8fc);_0x4dfc4b(_0x473e9d[_0x1f0e('0x14')](0x1f4,_0x4a1962[_0x1f0e('0x16')]));});});};exports[_0x1f0e('0x1f')]=function(_0x2858a4){var _0x397e4d=this;return new Promise(function(_0x14b4a2,_0x154b48){return db[_0x1f0e('0x20')][_0x1f0e('0x21')](_0x2858a4[_0x1f0e('0x1b')],{'raw':_0x2858a4[_0x1f0e('0x1c')]?_0x2858a4['options'][_0x1f0e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2858a4[_0x1f0e('0x1c')]?_0x2858a4['options'][_0x1f0e('0x22')]||null:null,'attributes':_0x2858a4[_0x1f0e('0x1c')]?_0x2858a4[_0x1f0e('0x1c')][_0x1f0e('0x23')]||null:null,'limit':_0x2858a4[_0x1f0e('0x1c')]?_0x2858a4[_0x1f0e('0x1c')][_0x1f0e('0x24')]||null:null})[_0x1f0e('0x1e')](function(_0x14f6a3){logger[_0x1f0e('0xe')](_0x1f0e('0x1f'),_0x2858a4);logger[_0x1f0e('0x11')]('UpdateSmsQueueReport',_0x2858a4,JSON[_0x1f0e('0x13')](_0x14f6a3));_0x14b4a2(_0x14f6a3);})[_0x1f0e('0x18')](function(_0x28cc2b){logger[_0x1f0e('0x14')](_0x1f0e('0x1f'),_0x28cc2b[_0x1f0e('0x16')],_0x2858a4);_0x154b48(_0x397e4d['error'](0x1f4,_0x28cc2b[_0x1f0e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 7879628..ab3fb81 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 _0x5292=['../../components/auth/service','../../components/interaction/service','./smsTransferReport.controller','get','/describe','/:id','show','post','isAuthenticated','create','put','update','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x5c1924,_0x30eadf){var _0x53f845=function(_0x1be275){while(--_0x1be275){_0x5c1924['push'](_0x5c1924['shift']());}};_0x53f845(++_0x30eadf);}(_0x5292,0xf7));var _0x2529=function(_0x1d6dea,_0x1f8978){_0x1d6dea=_0x1d6dea-0x0;var _0x1b5967=_0x5292[_0x1d6dea];return _0x1b5967;};'use strict';var multer=require(_0x2529('0x0'));var util=require(_0x2529('0x1'));var path=require('path');var timeout=require(_0x2529('0x2'));var express=require('express');var router=express[_0x2529('0x3')]();var fs_extra=require(_0x2529('0x4'));var auth=require(_0x2529('0x5'));var interaction=require(_0x2529('0x6'));var config=require('../../config/environment');var controller=require(_0x2529('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x2529('0x8')](_0x2529('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x2529('0x8')](_0x2529('0xa'),auth['isAuthenticated'](),controller[_0x2529('0xb')]);router[_0x2529('0xc')]('/',auth[_0x2529('0xd')](),controller[_0x2529('0xe')]);router[_0x2529('0xf')](_0x2529('0xa'),auth[_0x2529('0xd')](),controller[_0x2529('0x10')]);router['delete'](_0x2529('0xa'),auth[_0x2529('0xd')](),controller['destroy']);module[_0x2529('0x11')]=router; \ No newline at end of file +var _0x7f42=['delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update'];(function(_0x900a62,_0x52889d){var _0x1f537a=function(_0x26b331){while(--_0x26b331){_0x900a62['push'](_0x900a62['shift']());}};_0x1f537a(++_0x52889d);}(_0x7f42,0x1dd));var _0x27f4=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x7f42[_0x4e676e];return _0x336a3c;};'use strict';var multer=require(_0x27f4('0x0'));var util=require('util');var path=require(_0x27f4('0x1'));var timeout=require(_0x27f4('0x2'));var express=require('express');var router=express[_0x27f4('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x27f4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x27f4('0x5'));var controller=require('./smsTransferReport.controller');router[_0x27f4('0x6')]('/',auth['isAuthenticated'](),controller[_0x27f4('0x7')]);router[_0x27f4('0x6')](_0x27f4('0x8'),auth[_0x27f4('0x9')](),controller[_0x27f4('0xa')]);router[_0x27f4('0x6')](_0x27f4('0xb'),auth[_0x27f4('0x9')](),controller[_0x27f4('0xc')]);router[_0x27f4('0xd')]('/',auth[_0x27f4('0x9')](),controller[_0x27f4('0xe')]);router[_0x27f4('0xf')](_0x27f4('0xb'),auth[_0x27f4('0x9')](),controller[_0x27f4('0x10')]);router[_0x27f4('0x11')](_0x27f4('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x27f4('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index bb813e9..eca5309 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 _0x34e8=['queue','DATE','NOW','moment','sequelize','exports','STRING','account','agent'];(function(_0xe1d065,_0x39ab64){var _0x481700=function(_0x34947a){while(--_0x34947a){_0xe1d065['push'](_0xe1d065['shift']());}};_0x481700(++_0x39ab64);}(_0x34e8,0x12c));var _0x834e=function(_0x55e728,_0x2ec3bb){_0x55e728=_0x55e728-0x0;var _0x41c95f=_0x34e8[_0x55e728];return _0x41c95f;};'use strict';var moment=require(_0x834e('0x0'));var Sequelize=require(_0x834e('0x1'));module[_0x834e('0x2')]={'uniqueid':{'type':Sequelize[_0x834e('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x834e('0x4'),_0x834e('0x5'),_0x834e('0x6')),'allowNull':![],'defaultValue':_0x834e('0x6')},'transferredAt':{'type':Sequelize[_0x834e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x834e('0x8')]}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3a9690,_0x5e06e8){var _0x146bef=function(_0x28f514){while(--_0x28f514){_0x3a9690['push'](_0x3a9690['shift']());}};_0x146bef(++_0x5e06e8);}(_0x008c,0x188));var _0xc008=function(_0x39ef0e,_0x1dd6b9){_0x39ef0e=_0x39ef0e-0x0;var _0x1b96e6=_0x008c[_0x39ef0e];return _0x1b96e6;};'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/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 3ed3567..e6398da 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 _0x6f00=['undefined','limit','offset','count','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','order','sort','pick','where','type','filter','merge','options','SmsTransferReport','includeAll','include','rows','show','find','create','catch','update','params','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../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'];(function(_0x46d52f,_0x5a4398){var _0x1e96c0=function(_0x3fb443){while(--_0x3fb443){_0x46d52f['push'](_0x46d52f['shift']());}};_0x1e96c0(++_0x5a4398);}(_0x6f00,0x1b6));var _0x06f0=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x6f00[_0x54d4fe];return _0x1ab5bb;};'use strict';var emlformat=require(_0x06f0('0x0'));var rimraf=require(_0x06f0('0x1'));var zipdir=require(_0x06f0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06f0('0x3'));var moment=require(_0x06f0('0x4'));var BPromise=require(_0x06f0('0x5'));var Mustache=require(_0x06f0('0x6'));var util=require(_0x06f0('0x7'));var path=require('path');var sox=require(_0x06f0('0x8'));var csv=require(_0x06f0('0x9'));var ejs=require(_0x06f0('0xa'));var fs=require('fs');var fs_extra=require(_0x06f0('0xb'));var _=require(_0x06f0('0xc'));var squel=require(_0x06f0('0xd'));var crypto=require('crypto');var jsforce=require(_0x06f0('0xe'));var deskjs=require(_0x06f0('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x06f0('0x10'));var Redis=require('ioredis');var authService=require(_0x06f0('0x11'));var qs=require(_0x06f0('0x12'));var as=require(_0x06f0('0x13'));var hardwareService=require(_0x06f0('0x14'));var logger=require('../../config/logger')(_0x06f0('0x15'));var utils=require(_0x06f0('0x16'));var config=require(_0x06f0('0x17'));var licenseUtil=require(_0x06f0('0x18'));var db=require(_0x06f0('0x19'))['db'];function respondWithStatusCode(_0x1a2fa1,_0x44fc17){_0x44fc17=_0x44fc17||0xcc;return function(_0xd408c8){if(_0xd408c8){return _0x1a2fa1[_0x06f0('0x1a')](_0x44fc17);}return _0x1a2fa1[_0x06f0('0x1b')](_0x44fc17)[_0x06f0('0x1c')]();};}function respondWithResult(_0x538503,_0x2c13e5){_0x2c13e5=_0x2c13e5||0xc8;return function(_0x39fe04){if(_0x39fe04){return _0x538503[_0x06f0('0x1b')](_0x2c13e5)[_0x06f0('0x1d')](_0x39fe04);}};}function respondWithFilteredResult(_0x39342e,_0x3c127b){return function(_0x46186f){if(_0x46186f){var _0x159a7b=typeof _0x3c127b['offset']===_0x06f0('0x1e')&&typeof _0x3c127b[_0x06f0('0x1f')]===_0x06f0('0x1e');var _0x1f98f8=_0x46186f['count'];var _0xaab89c=_0x159a7b?0x0:_0x3c127b[_0x06f0('0x20')];var _0x2c79af=_0x159a7b?_0x46186f[_0x06f0('0x21')]:_0x3c127b[_0x06f0('0x20')]+_0x3c127b[_0x06f0('0x1f')];var _0x122a0f;if(_0x2c79af>=_0x1f98f8){_0x2c79af=_0x1f98f8;_0x122a0f=0xc8;}else{_0x122a0f=0xce;}_0x39342e[_0x06f0('0x1b')](_0x122a0f);return _0x39342e[_0x06f0('0x22')](_0x06f0('0x23'),_0xaab89c+'-'+_0x2c79af+'/'+_0x1f98f8)[_0x06f0('0x1d')](_0x46186f);}return null;};}function patchUpdates(_0x16caa4){return function(_0x51844b){try{jsonpatch[_0x06f0('0x24')](_0x51844b,_0x16caa4,!![]);}catch(_0x1c01d8){return BPromise[_0x06f0('0x25')](_0x1c01d8);}return _0x51844b[_0x06f0('0x26')]();};}function saveUpdates(_0x549f8e,_0x557ae0){return function(_0x20c718){if(_0x20c718){return _0x20c718['update'](_0x549f8e)[_0x06f0('0x27')](function(_0x5e7bc7){return _0x5e7bc7;});}return null;};}function removeEntity(_0x2e7b23,_0x70f318){return function(_0x162157){if(_0x162157){return _0x162157[_0x06f0('0x28')]()[_0x06f0('0x27')](function(){_0x2e7b23[_0x06f0('0x1b')](0xcc)[_0x06f0('0x1c')]();});}};}function handleEntityNotFound(_0x123aa2,_0x4b751f){return function(_0x205cab){if(!_0x205cab){_0x123aa2[_0x06f0('0x1a')](0x194);}return _0x205cab;};}function handleError(_0x157ac5,_0x97c325){_0x97c325=_0x97c325||0x1f4;return function(_0x42b172){logger[_0x06f0('0x29')](_0x42b172[_0x06f0('0x2a')]);if(_0x42b172[_0x06f0('0x2b')]){delete _0x42b172[_0x06f0('0x2b')];}_0x157ac5[_0x06f0('0x1b')](_0x97c325)[_0x06f0('0x2c')](_0x42b172);};}exports[_0x06f0('0x2d')]=function(_0x138da4,_0x53ae2f){var _0x4619e9={},_0x18f3a2={},_0x6a5466={'count':0x0,'rows':[]};var _0x422185=_[_0x06f0('0x2e')](db['SmsTransferReport'][_0x06f0('0x2f')],function(_0x14d8a6){return{'name':_0x14d8a6['fieldName'],'type':_0x14d8a6['type'][_0x06f0('0x30')]};});_0x18f3a2['model']=_[_0x06f0('0x2e')](_0x422185,_0x06f0('0x2b'));_0x18f3a2[_0x06f0('0x31')]=_[_0x06f0('0x32')](_0x138da4[_0x06f0('0x31')]);_0x18f3a2[_0x06f0('0x33')]=_[_0x06f0('0x34')](_0x18f3a2['model'],_0x18f3a2[_0x06f0('0x31')]);_0x4619e9[_0x06f0('0x35')]=_[_0x06f0('0x34')](_0x18f3a2[_0x06f0('0x36')],qs['fields'](_0x138da4[_0x06f0('0x31')][_0x06f0('0x37')]));_0x4619e9[_0x06f0('0x35')]=_0x4619e9['attributes'][_0x06f0('0x38')]?_0x4619e9[_0x06f0('0x35')]:_0x18f3a2[_0x06f0('0x36')];if(!_0x138da4[_0x06f0('0x31')][_0x06f0('0x39')]('nolimit')){_0x4619e9[_0x06f0('0x1f')]=qs[_0x06f0('0x1f')](_0x138da4['query']['limit']);_0x4619e9[_0x06f0('0x20')]=qs[_0x06f0('0x20')](_0x138da4['query']['offset']);}_0x4619e9[_0x06f0('0x3a')]=qs[_0x06f0('0x3b')](_0x138da4['query'][_0x06f0('0x3b')]);_0x4619e9['where']=qs['filters'](_[_0x06f0('0x3c')](_0x138da4[_0x06f0('0x31')],_0x18f3a2[_0x06f0('0x33')]),_0x422185);if(_0x138da4[_0x06f0('0x31')]['filter']){_0x4619e9[_0x06f0('0x3d')]=_['merge'](_0x4619e9[_0x06f0('0x3d')],{'$or':_['map'](_0x422185,function(_0x3a2fbc){if(_0x3a2fbc[_0x06f0('0x3e')]!=='VIRTUAL'){var _0x4e7a05={};_0x4e7a05[_0x3a2fbc[_0x06f0('0x2b')]]={'$like':'%'+_0x138da4[_0x06f0('0x31')][_0x06f0('0x3f')]+'%'};return _0x4e7a05;}})});}_0x4619e9=_[_0x06f0('0x40')]({},_0x4619e9,_0x138da4[_0x06f0('0x41')]);var _0x18fd8d={'where':_0x4619e9[_0x06f0('0x3d')]};return db[_0x06f0('0x42')]['count'](_0x18fd8d)[_0x06f0('0x27')](function(_0x1c7236){_0x6a5466[_0x06f0('0x21')]=_0x1c7236;if(_0x138da4['query'][_0x06f0('0x43')]){_0x4619e9[_0x06f0('0x44')]=[{'all':!![]}];}return db[_0x06f0('0x42')]['findAll'](_0x4619e9);})[_0x06f0('0x27')](function(_0x36ebcd){_0x6a5466[_0x06f0('0x45')]=_0x36ebcd;return _0x6a5466;})[_0x06f0('0x27')](respondWithFilteredResult(_0x53ae2f,_0x4619e9))['catch'](handleError(_0x53ae2f,null));};exports[_0x06f0('0x46')]=function(_0x4157c4,_0x3efb8f){var _0x139067={'raw':!![],'where':{'id':_0x4157c4['params']['id']}},_0x4ff20b={};_0x4ff20b['model']=_['keys'](db[_0x06f0('0x42')][_0x06f0('0x2f')]);_0x4ff20b[_0x06f0('0x31')]=_[_0x06f0('0x32')](_0x4157c4['query']);_0x4ff20b['filters']=_[_0x06f0('0x34')](_0x4ff20b['model'],_0x4ff20b['query']);_0x139067[_0x06f0('0x35')]=_[_0x06f0('0x34')](_0x4ff20b['model'],qs[_0x06f0('0x37')](_0x4157c4[_0x06f0('0x31')][_0x06f0('0x37')]));_0x139067[_0x06f0('0x35')]=_0x139067[_0x06f0('0x35')][_0x06f0('0x38')]?_0x139067[_0x06f0('0x35')]:_0x4ff20b[_0x06f0('0x36')];if(_0x4157c4[_0x06f0('0x31')][_0x06f0('0x43')]){_0x139067[_0x06f0('0x44')]=[{'all':!![]}];}_0x139067=_[_0x06f0('0x40')]({},_0x139067,_0x4157c4['options']);return db[_0x06f0('0x42')][_0x06f0('0x47')](_0x139067)[_0x06f0('0x27')](handleEntityNotFound(_0x3efb8f,null))[_0x06f0('0x27')](respondWithResult(_0x3efb8f,null))['catch'](handleError(_0x3efb8f,null));};exports['create']=function(_0x205cea,_0x4e8d2e){return db[_0x06f0('0x42')][_0x06f0('0x48')](_0x205cea['body'],{})[_0x06f0('0x27')](respondWithResult(_0x4e8d2e,0xc9))[_0x06f0('0x49')](handleError(_0x4e8d2e,null));};exports[_0x06f0('0x4a')]=function(_0x5b639b,_0x9ad8da){if(_0x5b639b['body']['id']){delete _0x5b639b['body']['id'];}return db[_0x06f0('0x42')][_0x06f0('0x47')]({'where':{'id':_0x5b639b[_0x06f0('0x4b')]['id']}})[_0x06f0('0x27')](handleEntityNotFound(_0x9ad8da,null))['then'](saveUpdates(_0x5b639b[_0x06f0('0x4c')],null))[_0x06f0('0x27')](respondWithResult(_0x9ad8da,null))['catch'](handleError(_0x9ad8da,null));};exports[_0x06f0('0x28')]=function(_0x196f1e,_0x58cbd5){return db['SmsTransferReport']['find']({'where':{'id':_0x196f1e[_0x06f0('0x4b')]['id']}})[_0x06f0('0x27')](handleEntityNotFound(_0x58cbd5,null))[_0x06f0('0x27')](removeEntity(_0x58cbd5,null))[_0x06f0('0x49')](handleError(_0x58cbd5,null));};exports['describe']=function(_0x186864,_0x5dc518){return db[_0x06f0('0x42')][_0x06f0('0x4d')]()['then'](respondWithResult(_0x5dc518,null))[_0x06f0('0x49')](handleError(_0x5dc518,null));}; \ No newline at end of file +var _0x1546=['key','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','rows','catch','params','keys','rawAttributes','includeAll','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','name','send','index','map','SmsTransferReport','fieldName','type'];(function(_0x5cc8b9,_0x20e3c3){var _0x58892e=function(_0x87457a){while(--_0x87457a){_0x5cc8b9['push'](_0x5cc8b9['shift']());}};_0x58892e(++_0x20e3c3);}(_0x1546,0x6a));var _0x6154=function(_0x350b59,_0x28bc2f){_0x350b59=_0x350b59-0x0;var _0x29fbb8=_0x1546[_0x350b59];return _0x29fbb8;};'use strict';var emlformat=require(_0x6154('0x0'));var rimraf=require(_0x6154('0x1'));var zipdir=require(_0x6154('0x2'));var jsonpatch=require(_0x6154('0x3'));var rp=require('request-promise');var moment=require(_0x6154('0x4'));var BPromise=require(_0x6154('0x5'));var Mustache=require(_0x6154('0x6'));var util=require('util');var path=require(_0x6154('0x7'));var sox=require(_0x6154('0x8'));var csv=require(_0x6154('0x9'));var ejs=require(_0x6154('0xa'));var fs=require('fs');var fs_extra=require(_0x6154('0xb'));var _=require(_0x6154('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6154('0xd'));var deskjs=require(_0x6154('0xe'));var toCsv=require(_0x6154('0x9'));var querystring=require(_0x6154('0xf'));var Papa=require(_0x6154('0x10'));var Redis=require('ioredis');var authService=require(_0x6154('0x11'));var qs=require(_0x6154('0x12'));var as=require(_0x6154('0x13'));var hardwareService=require(_0x6154('0x14'));var logger=require(_0x6154('0x15'))(_0x6154('0x16'));var utils=require(_0x6154('0x17'));var config=require(_0x6154('0x18'));var licenseUtil=require(_0x6154('0x19'));var db=require(_0x6154('0x1a'))['db'];function respondWithStatusCode(_0x5586d1,_0x5faab8){_0x5faab8=_0x5faab8||0xcc;return function(_0x1eecd3){if(_0x1eecd3){return _0x5586d1[_0x6154('0x1b')](_0x5faab8);}return _0x5586d1[_0x6154('0x1c')](_0x5faab8)[_0x6154('0x1d')]();};}function respondWithResult(_0x22edd3,_0x151bb5){_0x151bb5=_0x151bb5||0xc8;return function(_0x5ee958){if(_0x5ee958){return _0x22edd3[_0x6154('0x1c')](_0x151bb5)[_0x6154('0x1e')](_0x5ee958);}};}function respondWithFilteredResult(_0x2cc444,_0x1e3b54){return function(_0x2b5a27){if(_0x2b5a27){var _0x2ea6cd=typeof _0x1e3b54['offset']===_0x6154('0x1f')&&typeof _0x1e3b54[_0x6154('0x20')]===_0x6154('0x1f');var _0x25a2a2=_0x2b5a27[_0x6154('0x21')];var _0x3cccb1=_0x2ea6cd?0x0:_0x1e3b54[_0x6154('0x22')];var _0x28130e=_0x2ea6cd?_0x2b5a27['count']:_0x1e3b54[_0x6154('0x22')]+_0x1e3b54[_0x6154('0x20')];var _0x4e8acb;if(_0x28130e>=_0x25a2a2){_0x28130e=_0x25a2a2;_0x4e8acb=0xc8;}else{_0x4e8acb=0xce;}_0x2cc444['status'](_0x4e8acb);return _0x2cc444[_0x6154('0x23')](_0x6154('0x24'),_0x3cccb1+'-'+_0x28130e+'/'+_0x25a2a2)[_0x6154('0x1e')](_0x2b5a27);}return null;};}function patchUpdates(_0x4c2687){return function(_0x24cd6c){try{jsonpatch[_0x6154('0x25')](_0x24cd6c,_0x4c2687,!![]);}catch(_0x4f753c){return BPromise[_0x6154('0x26')](_0x4f753c);}return _0x24cd6c[_0x6154('0x27')]();};}function saveUpdates(_0x4e98c1,_0x543710){return function(_0x2193d6){if(_0x2193d6){return _0x2193d6[_0x6154('0x28')](_0x4e98c1)[_0x6154('0x29')](function(_0x337ecd){return _0x337ecd;});}return null;};}function removeEntity(_0x58e5d6,_0x25265d){return function(_0x207aeb){if(_0x207aeb){return _0x207aeb[_0x6154('0x2a')]()[_0x6154('0x29')](function(){_0x58e5d6['status'](0xcc)[_0x6154('0x1d')]();});}};}function handleEntityNotFound(_0x1231a4,_0x3c9f26){return function(_0x329268){if(!_0x329268){_0x1231a4[_0x6154('0x1b')](0x194);}return _0x329268;};}function handleError(_0x26bdde,_0x5c8ca2){_0x5c8ca2=_0x5c8ca2||0x1f4;return function(_0x56ca41){logger['error'](_0x56ca41['stack']);if(_0x56ca41[_0x6154('0x2b')]){delete _0x56ca41[_0x6154('0x2b')];}_0x26bdde[_0x6154('0x1c')](_0x5c8ca2)[_0x6154('0x2c')](_0x56ca41);};}exports[_0x6154('0x2d')]=function(_0x42bc96,_0x1d8e5a){var _0x5d9bb7={},_0x51ad55={},_0x583ec5={'count':0x0,'rows':[]};var _0x1ffdaa=_[_0x6154('0x2e')](db[_0x6154('0x2f')]['rawAttributes'],function(_0x3dde90){return{'name':_0x3dde90[_0x6154('0x30')],'type':_0x3dde90[_0x6154('0x31')][_0x6154('0x32')]};});_0x51ad55['model']=_[_0x6154('0x2e')](_0x1ffdaa,_0x6154('0x2b'));_0x51ad55[_0x6154('0x33')]=_['keys'](_0x42bc96['query']);_0x51ad55[_0x6154('0x34')]=_[_0x6154('0x35')](_0x51ad55[_0x6154('0x36')],_0x51ad55[_0x6154('0x33')]);_0x5d9bb7[_0x6154('0x37')]=_[_0x6154('0x35')](_0x51ad55['model'],qs['fields'](_0x42bc96[_0x6154('0x33')][_0x6154('0x38')]));_0x5d9bb7[_0x6154('0x37')]=_0x5d9bb7[_0x6154('0x37')][_0x6154('0x39')]?_0x5d9bb7[_0x6154('0x37')]:_0x51ad55[_0x6154('0x36')];if(!_0x42bc96['query']['hasOwnProperty']('nolimit')){_0x5d9bb7['limit']=qs['limit'](_0x42bc96['query'][_0x6154('0x20')]);_0x5d9bb7[_0x6154('0x22')]=qs[_0x6154('0x22')](_0x42bc96[_0x6154('0x33')][_0x6154('0x22')]);}_0x5d9bb7[_0x6154('0x3a')]=qs[_0x6154('0x3b')](_0x42bc96[_0x6154('0x33')][_0x6154('0x3b')]);_0x5d9bb7[_0x6154('0x3c')]=qs['filters'](_[_0x6154('0x3d')](_0x42bc96[_0x6154('0x33')],_0x51ad55[_0x6154('0x34')]),_0x1ffdaa);if(_0x42bc96[_0x6154('0x33')][_0x6154('0x3e')]){_0x5d9bb7['where']=_['merge'](_0x5d9bb7[_0x6154('0x3c')],{'$or':_[_0x6154('0x2e')](_0x1ffdaa,function(_0x9c11f3){if(_0x9c11f3[_0x6154('0x31')]!==_0x6154('0x3f')){var _0x1ba443={};_0x1ba443[_0x9c11f3[_0x6154('0x2b')]]={'$like':'%'+_0x42bc96[_0x6154('0x33')]['filter']+'%'};return _0x1ba443;}})});}_0x5d9bb7=_[_0x6154('0x40')]({},_0x5d9bb7,_0x42bc96[_0x6154('0x41')]);var _0x4fd6c1={'where':_0x5d9bb7[_0x6154('0x3c')]};return db[_0x6154('0x2f')][_0x6154('0x21')](_0x4fd6c1)[_0x6154('0x29')](function(_0x51a44d){_0x583ec5['count']=_0x51a44d;if(_0x42bc96[_0x6154('0x33')]['includeAll']){_0x5d9bb7[_0x6154('0x42')]=[{'all':!![]}];}return db[_0x6154('0x2f')][_0x6154('0x43')](_0x5d9bb7);})[_0x6154('0x29')](function(_0x22f689){_0x583ec5[_0x6154('0x44')]=_0x22f689;return _0x583ec5;})['then'](respondWithFilteredResult(_0x1d8e5a,_0x5d9bb7))[_0x6154('0x45')](handleError(_0x1d8e5a,null));};exports['show']=function(_0x3919c2,_0x167eb9){var _0x2aae8a={'raw':!![],'where':{'id':_0x3919c2[_0x6154('0x46')]['id']}},_0x2993a3={};_0x2993a3[_0x6154('0x36')]=_[_0x6154('0x47')](db[_0x6154('0x2f')][_0x6154('0x48')]);_0x2993a3['query']=_['keys'](_0x3919c2['query']);_0x2993a3[_0x6154('0x34')]=_[_0x6154('0x35')](_0x2993a3['model'],_0x2993a3[_0x6154('0x33')]);_0x2aae8a[_0x6154('0x37')]=_[_0x6154('0x35')](_0x2993a3[_0x6154('0x36')],qs['fields'](_0x3919c2[_0x6154('0x33')][_0x6154('0x38')]));_0x2aae8a[_0x6154('0x37')]=_0x2aae8a[_0x6154('0x37')][_0x6154('0x39')]?_0x2aae8a[_0x6154('0x37')]:_0x2993a3[_0x6154('0x36')];if(_0x3919c2['query'][_0x6154('0x49')]){_0x2aae8a['include']=[{'all':!![]}];}_0x2aae8a=_[_0x6154('0x40')]({},_0x2aae8a,_0x3919c2[_0x6154('0x41')]);return db[_0x6154('0x2f')][_0x6154('0x4a')](_0x2aae8a)[_0x6154('0x29')](handleEntityNotFound(_0x167eb9,null))[_0x6154('0x29')](respondWithResult(_0x167eb9,null))[_0x6154('0x45')](handleError(_0x167eb9,null));};exports[_0x6154('0x4b')]=function(_0xa065be,_0xb4ba8b){return db[_0x6154('0x2f')][_0x6154('0x4b')](_0xa065be['body'],{})[_0x6154('0x29')](respondWithResult(_0xb4ba8b,0xc9))[_0x6154('0x45')](handleError(_0xb4ba8b,null));};exports['update']=function(_0x5e71cf,_0x507e43){if(_0x5e71cf[_0x6154('0x4c')]['id']){delete _0x5e71cf['body']['id'];}return db[_0x6154('0x2f')][_0x6154('0x4a')]({'where':{'id':_0x5e71cf[_0x6154('0x46')]['id']}})[_0x6154('0x29')](handleEntityNotFound(_0x507e43,null))['then'](saveUpdates(_0x5e71cf[_0x6154('0x4c')],null))[_0x6154('0x29')](respondWithResult(_0x507e43,null))['catch'](handleError(_0x507e43,null));};exports[_0x6154('0x2a')]=function(_0x1281e0,_0x103313){return db['SmsTransferReport'][_0x6154('0x4a')]({'where':{'id':_0x1281e0[_0x6154('0x46')]['id']}})[_0x6154('0x29')](handleEntityNotFound(_0x103313,null))[_0x6154('0x29')](removeEntity(_0x103313,null))['catch'](handleError(_0x103313,null));};exports[_0x6154('0x4d')]=function(_0x1862c1,_0x3090cb){return db['SmsTransferReport']['describe']()[_0x6154('0x29')](respondWithResult(_0x3090cb,null))[_0x6154('0x45')](handleError(_0x3090cb,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 1a87292..d59f112 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 _0xe4b8=['./smsTransferReport.attributes','exports','SmsTransferReport','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x367589,_0x2ab170){var _0x539c06=function(_0x49149f){while(--_0x49149f){_0x367589['push'](_0x367589['shift']());}};_0x539c06(++_0x2ab170);}(_0xe4b8,0x179));var _0x8e4b=function(_0x36ed48,_0x1ee0d4){_0x36ed48=_0x36ed48-0x0;var _0x51c63a=_0xe4b8[_0x36ed48];return _0x51c63a;};'use strict';var _=require(_0x8e4b('0x0'));var util=require(_0x8e4b('0x1'));var logger=require(_0x8e4b('0x2'))(_0x8e4b('0x3'));var moment=require(_0x8e4b('0x4'));var BPromise=require(_0x8e4b('0x5'));var rp=require(_0x8e4b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8e4b('0x7'));var attributes=require(_0x8e4b('0x8'));module[_0x8e4b('0x9')]=function(_0x47e630,_0x2796f8){return _0x47e630['define'](_0x8e4b('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x18b8=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsTransferReport','report_sms_transfer','uniqueid'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x18b8,0xff));var _0x818b=function(_0x2124d5,_0x2bbc57){_0x2124d5=_0x2124d5-0x0;var _0x4af97d=_0x18b8[_0x2124d5];return _0x4af97d;};'use strict';var _=require(_0x818b('0x0'));var util=require(_0x818b('0x1'));var logger=require(_0x818b('0x2'))(_0x818b('0x3'));var moment=require(_0x818b('0x4'));var BPromise=require(_0x818b('0x5'));var rp=require(_0x818b('0x6'));var fs=require('fs');var path=require(_0x818b('0x7'));var rimraf=require(_0x818b('0x8'));var config=require(_0x818b('0x9'));var attributes=require('./smsTransferReport.attributes');module[_0x818b('0xa')]=function(_0x152a07,_0x653fd7){return _0x152a07[_0x818b('0xb')](_0x818b('0xc'),attributes,{'tableName':_0x818b('0xd'),'paranoid':![],'indexes':[{'name':_0x818b('0xe'),'fields':[_0x818b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 50a52a8..d8a2bc2 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 _0x33c5=['then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x33c5,0xe6));var _0x533c=function(_0x45adb4,_0x2abb06){_0x45adb4=_0x45adb4-0x0;var _0x137296=_0x33c5[_0x45adb4];return _0x137296;};'use strict';var _=require('lodash');var util=require(_0x533c('0x0'));var moment=require(_0x533c('0x1'));var BPromise=require('bluebird');var rs=require(_0x533c('0x2'));var fs=require('fs');var Redis=require(_0x533c('0x3'));var db=require(_0x533c('0x4'))['db'];var utils=require(_0x533c('0x5'));var logger=require(_0x533c('0x6'))('rpc');var config=require(_0x533c('0x7'));var jayson=require(_0x533c('0x8'));var client=jayson[_0x533c('0x9')][_0x533c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x34ca89,_0x1699d5,_0x3a009b){return new BPromise(function(_0x36d74e,_0x2c297c){return client[_0x533c('0xb')](_0x34ca89,_0x3a009b)[_0x533c('0xc')](function(_0x46536d){logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));logger[_0x533c('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x1699d5,_0x533c('0xf'),JSON[_0x533c('0x11')](_0x46536d));if(_0x46536d[_0x533c('0x12')]){if(_0x46536d[_0x533c('0x12')][_0x533c('0x13')]===0x1f4){logger[_0x533c('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x2c297c(_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);}logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x46536d[_0x533c('0x12')][_0x533c('0x14')]);return _0x36d74e(_0x46536d['error'][_0x533c('0x14')]);}else{logger[_0x533c('0xd')](_0x533c('0xe'),_0x1699d5,_0x533c('0xf'));_0x36d74e(_0x46536d['result'][_0x533c('0x14')]);}})[_0x533c('0x15')](function(_0x41e22c){logger[_0x533c('0x12')](_0x533c('0xe'),_0x1699d5,_0x41e22c);_0x2c297c(_0x41e22c);});});} \ No newline at end of file +var _0x102b=['error','code','SmsTransferReport,\x20%s,\x20%s','message','info','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request\x20sent','debug','stringify'];(function(_0x3779c1,_0x1ba85d){var _0x35ca38=function(_0x336c73){while(--_0x336c73){_0x3779c1['push'](_0x3779c1['shift']());}};_0x35ca38(++_0x1ba85d);}(_0x102b,0x1be));var _0xb102=function(_0x4428a1,_0x22b67d){_0x4428a1=_0x4428a1-0x0;var _0x1631ac=_0x102b[_0x4428a1];return _0x1631ac;};'use strict';var _=require('lodash');var util=require(_0xb102('0x0'));var moment=require('moment');var BPromise=require(_0xb102('0x1'));var rs=require(_0xb102('0x2'));var fs=require('fs');var Redis=require(_0xb102('0x3'));var db=require(_0xb102('0x4'))['db'];var utils=require(_0xb102('0x5'));var logger=require(_0xb102('0x6'))(_0xb102('0x7'));var config=require(_0xb102('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb102('0x9')][_0xb102('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd131eb,_0x256052,_0x1ee0c0){return new BPromise(function(_0x5879bb,_0x338e0f){return client['request'](_0xd131eb,_0x1ee0c0)['then'](function(_0xee2164){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x256052,_0xb102('0xb'));logger[_0xb102('0xc')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x256052,_0xb102('0xb'),JSON[_0xb102('0xd')](_0xee2164));if(_0xee2164[_0xb102('0xe')]){if(_0xee2164[_0xb102('0xe')][_0xb102('0xf')]===0x1f4){logger[_0xb102('0xe')](_0xb102('0x10'),_0x256052,_0xee2164['error'][_0xb102('0x11')]);return _0x338e0f(_0xee2164['error'][_0xb102('0x11')]);}logger[_0xb102('0xe')]('SmsTransferReport,\x20%s,\x20%s',_0x256052,_0xee2164[_0xb102('0xe')][_0xb102('0x11')]);return _0x5879bb(_0xee2164['error'][_0xb102('0x11')]);}else{logger[_0xb102('0x12')](_0xb102('0x10'),_0x256052,'request\x20sent');_0x5879bb(_0xee2164['result']['message']);}})[_0xb102('0x13')](function(_0x7f3487){logger[_0xb102('0xe')](_0xb102('0x10'),_0x256052,_0x7f3487);_0x338e0f(_0x7f3487);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index 1f56e6a..9a68fb9 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 _0xdc2c=['post','single','file','create','put','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','diskStorage','join','root','originalname','replace','basename','extname','now'];(function(_0x2f7f74,_0x622553){var _0x38cf34=function(_0x53361f){while(--_0x53361f){_0x2f7f74['push'](_0x2f7f74['shift']());}};_0x38cf34(++_0x622553);}(_0xdc2c,0x11d));var _0xcdc2=function(_0x4b5a95,_0x10eb5e){_0x4b5a95=_0x4b5a95-0x0;var _0x9540dc=_0xdc2c[_0x4b5a95];return _0x9540dc;};'use strict';var multer=require(_0xcdc2('0x0'));var util=require(_0xcdc2('0x1'));var path=require(_0xcdc2('0x2'));var timeout=require(_0xcdc2('0x3'));var express=require(_0xcdc2('0x4'));var router=express[_0xcdc2('0x5')]();var fs_extra=require(_0xcdc2('0x6'));var auth=require(_0xcdc2('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xcdc2('0x8'));var controller=require(_0xcdc2('0x9'));router[_0xcdc2('0xa')]('/',auth[_0xcdc2('0xb')](),controller[_0xcdc2('0xc')]);router[_0xcdc2('0xa')](_0xcdc2('0xd'),auth['isAuthenticated'](),controller[_0xcdc2('0xe')]);router[_0xcdc2('0xa')](_0xcdc2('0xf'),auth[_0xcdc2('0xb')](),controller[_0xcdc2('0x10')]);var upload=multer({'storage':multer[_0xcdc2('0x11')]({'destination':function(_0x37f951,_0xd405b6,_0x331428){_0x331428(null,path[_0xcdc2('0x12')](config[_0xcdc2('0x13')],'server/files/sounds/original/'));},'filename':function(_0x265661,_0x10eb77,_0x66fda9){_0x10eb77[_0xcdc2('0x14')]=_0x10eb77[_0xcdc2('0x14')][_0xcdc2('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x66fda9(null,util['format']('%s-%s%s',path[_0xcdc2('0x16')](_0x10eb77[_0xcdc2('0x14')],path[_0xcdc2('0x17')](_0x10eb77['originalname'])),Date[_0xcdc2('0x18')](),path[_0xcdc2('0x17')](_0x10eb77[_0xcdc2('0x14')])));}})});router[_0xcdc2('0x19')]('/',upload[_0xcdc2('0x1a')](_0xcdc2('0x1b')),controller[_0xcdc2('0x1c')]);router[_0xcdc2('0x1d')](_0xcdc2('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xcdc2('0xd'),auth[_0xcdc2('0xb')](),controller['delete']);module[_0xcdc2('0x1e')]=router; \ No newline at end of file +var _0x0ee6=['originalname','replace','format','extname','now','single','file','create','put','/:id','delete','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','show','download','diskStorage','join'];(function(_0x311307,_0x26126c){var _0x46358c=function(_0x12f5a0){while(--_0x12f5a0){_0x311307['push'](_0x311307['shift']());}};_0x46358c(++_0x26126c);}(_0x0ee6,0xc9));var _0x60ee=function(_0x59c890,_0x47fcae){_0x59c890=_0x59c890-0x0;var _0x4c20c4=_0x0ee6[_0x59c890];return _0x4c20c4;};'use strict';var multer=require(_0x60ee('0x0'));var util=require(_0x60ee('0x1'));var path=require('path');var timeout=require(_0x60ee('0x2'));var express=require(_0x60ee('0x3'));var router=express['Router']();var fs_extra=require(_0x60ee('0x4'));var auth=require(_0x60ee('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x60ee('0x6'));var controller=require(_0x60ee('0x7'));router[_0x60ee('0x8')]('/',auth[_0x60ee('0x9')](),controller[_0x60ee('0xa')]);router[_0x60ee('0x8')]('/:id',auth[_0x60ee('0x9')](),controller[_0x60ee('0xb')]);router['get']('/:id/download',auth[_0x60ee('0x9')](),controller[_0x60ee('0xc')]);var upload=multer({'storage':multer[_0x60ee('0xd')]({'destination':function(_0x2400bd,_0x106713,_0x57757d){_0x57757d(null,path[_0x60ee('0xe')](config['root'],'server/files/sounds/original/'));},'filename':function(_0xf5d4c0,_0x212592,_0x469340){_0x212592[_0x60ee('0xf')]=_0x212592[_0x60ee('0xf')][_0x60ee('0x10')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x469340(null,util[_0x60ee('0x11')]('%s-%s%s',path['basename'](_0x212592[_0x60ee('0xf')],path[_0x60ee('0x12')](_0x212592[_0x60ee('0xf')])),Date[_0x60ee('0x13')](),path['extname'](_0x212592[_0x60ee('0xf')])));}})});router['post']('/',upload[_0x60ee('0x14')](_0x60ee('0x15')),controller[_0x60ee('0x16')]);router[_0x60ee('0x17')](_0x60ee('0x18'),auth['isAuthenticated'](),controller['update']);router[_0x60ee('0x19')]('/:id',auth[_0x60ee('0x9')](),controller[_0x60ee('0x19')]);module[_0x60ee('0x1a')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 03ddddf..9c268d4 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 _0xda63=['exports','STRING','name','INTEGER','BIGINT','FLOAT','sequelize'];(function(_0x28f228,_0x4d3853){var _0x3af165=function(_0x4b8dee){while(--_0x4b8dee){_0x28f228['push'](_0x28f228['shift']());}};_0x3af165(++_0x4d3853);}(_0xda63,0x92));var _0x3da6=function(_0x7902d0,_0x378152){_0x7902d0=_0x7902d0-0x0;var _0x2ab4ac=_0xda63[_0x7902d0];return _0x2ab4ac;};'use strict';var Sequelize=require(_0x3da6('0x0'));module[_0x3da6('0x1')]={'name':{'type':Sequelize[_0x3da6('0x2')],'unique':_0x3da6('0x3'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x3da6('0x2')]},'original_format':{'type':Sequelize[_0x3da6('0x2')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x3da6('0x4')]},'original_bitRate':{'type':Sequelize[_0x3da6('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x3da6('0x2')]},'converted_duration':{'type':Sequelize[_0x3da6('0x6')]},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x3da6('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x3da6('0x4')]}}; \ No newline at end of file +var _0xc347=['STRING','name','FLOAT','BIGINT','INTEGER','sequelize','exports'];(function(_0x2f5544,_0x134b17){var _0x186801=function(_0xa85bf0){while(--_0xa85bf0){_0x2f5544['push'](_0x2f5544['shift']());}};_0x186801(++_0x134b17);}(_0xc347,0x132));var _0x7c34=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xc347[_0x3ab9ee];return _0x82ee88;};'use strict';var Sequelize=require(_0x7c34('0x0'));module[_0x7c34('0x1')]={'name':{'type':Sequelize[_0x7c34('0x2')],'unique':_0x7c34('0x3'),'allowNull':![]},'save_name':{'type':Sequelize[_0x7c34('0x2')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize[_0x7c34('0x2')]},'original_format':{'type':Sequelize[_0x7c34('0x2')]},'original_duration':{'type':Sequelize[_0x7c34('0x4')]},'original_sampleCount':{'type':Sequelize[_0x7c34('0x5')]},'original_channelCount':{'type':Sequelize[_0x7c34('0x6')]},'original_bitRate':{'type':Sequelize[_0x7c34('0x5')]},'original_sampleRate':{'type':Sequelize[_0x7c34('0x6')]},'converted_format':{'type':Sequelize[_0x7c34('0x2')]},'converted_duration':{'type':Sequelize[_0x7c34('0x4')]},'converted_sampleCount':{'type':Sequelize[_0x7c34('0x5')]},'converted_channelCount':{'type':Sequelize[_0x7c34('0x6')]},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x7c34('0x6')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 0957d47..cc24029 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 _0xab97=['server/files/sounds/converted','converted_format','Sequelize','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','extname','originalname','filename','substring','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','wav','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Sounds','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','Sound','includeAll','include','findAll','rows','catch','params','find','download','save_name','existsSync','join','root'];(function(_0x2abeee,_0x1d7879){var _0x17929b=function(_0x3e54c9){while(--_0x3e54c9){_0x2abeee['push'](_0x2abeee['shift']());}};_0x17929b(++_0x1d7879);}(_0xab97,0xaf));var _0x7ab9=function(_0x1c645b,_0x254cd7){_0x1c645b=_0x1c645b-0x0;var _0x14a19c=_0xab97[_0x1c645b];return _0x14a19c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7ab9('0x0'));var zipdir=require(_0x7ab9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7ab9('0x2'));var BPromise=require(_0x7ab9('0x3'));var Mustache=require(_0x7ab9('0x4'));var util=require(_0x7ab9('0x5'));var path=require(_0x7ab9('0x6'));var sox=require(_0x7ab9('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7ab9('0x8'));var _=require(_0x7ab9('0x9'));var squel=require(_0x7ab9('0xa'));var crypto=require(_0x7ab9('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x7ab9('0xc'));var toCsv=require(_0x7ab9('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x7ab9('0xe'));var qs=require(_0x7ab9('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ab9('0x10'));var logger=require(_0x7ab9('0x11'))('api');var utils=require(_0x7ab9('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x7ab9('0x13'));var db=require(_0x7ab9('0x14'))['db'];function respondWithStatusCode(_0x896d85,_0x166655){_0x166655=_0x166655||0xcc;return function(_0x3a79de){if(_0x3a79de){return _0x896d85[_0x7ab9('0x15')](_0x166655);}return _0x896d85[_0x7ab9('0x16')](_0x166655)[_0x7ab9('0x17')]();};}function respondWithResult(_0x496c68,_0x41a0a1){_0x41a0a1=_0x41a0a1||0xc8;return function(_0x290f96){if(_0x290f96){return _0x496c68[_0x7ab9('0x16')](_0x41a0a1)[_0x7ab9('0x18')](_0x290f96);}};}function respondWithFilteredResult(_0x27d348,_0x415e1b){return function(_0x137f1f){if(_0x137f1f){var _0x5fe0d9=typeof _0x415e1b[_0x7ab9('0x19')]===_0x7ab9('0x1a')&&typeof _0x415e1b[_0x7ab9('0x1b')]==='undefined';var _0x247304=_0x137f1f[_0x7ab9('0x1c')];var _0x269068=_0x5fe0d9?0x0:_0x415e1b['offset'];var _0x2137a3=_0x5fe0d9?_0x137f1f[_0x7ab9('0x1c')]:_0x415e1b[_0x7ab9('0x19')]+_0x415e1b[_0x7ab9('0x1b')];var _0xd63980;if(_0x2137a3>=_0x247304){_0x2137a3=_0x247304;_0xd63980=0xc8;}else{_0xd63980=0xce;}_0x27d348[_0x7ab9('0x16')](_0xd63980);return _0x27d348[_0x7ab9('0x1d')](_0x7ab9('0x1e'),_0x269068+'-'+_0x2137a3+'/'+_0x247304)[_0x7ab9('0x18')](_0x137f1f);}return null;};}function patchUpdates(_0x4ed85e){return function(_0x2a3cd8){try{jsonpatch[_0x7ab9('0x1f')](_0x2a3cd8,_0x4ed85e,!![]);}catch(_0x462e86){return BPromise[_0x7ab9('0x20')](_0x462e86);}return _0x2a3cd8[_0x7ab9('0x21')]();};}function saveUpdates(_0x1c6dda,_0x558c87){return function(_0x2e028c){if(_0x2e028c){return _0x2e028c[_0x7ab9('0x22')](_0x1c6dda)['then'](function(_0x23b3d1){return _0x23b3d1;});}return null;};}function removeEntity(_0x2cc78d,_0x5b1569){return function(_0x4c9a0e){if(_0x4c9a0e){return _0x4c9a0e['destroy']()[_0x7ab9('0x23')](function(){var _0x3929af=_0x4c9a0e[_0x7ab9('0x24')]({'plain':!![]});var _0xbff1ef=_0x7ab9('0x25');return db[_0x7ab9('0x26')][_0x7ab9('0x27')]({'where':{'type':_0xbff1ef,'resourceId':_0x3929af['id']}})[_0x7ab9('0x23')](function(){return _0x4c9a0e;});})[_0x7ab9('0x23')](function(){_0x2cc78d[_0x7ab9('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f5955,_0x2c3f28){return function(_0x295a8b){if(!_0x295a8b){_0x3f5955['sendStatus'](0x194);}return _0x295a8b;};}function handleError(_0x21a251,_0x4b942f){_0x4b942f=_0x4b942f||0x1f4;return function(_0x56ee8c){logger['error'](_0x56ee8c[_0x7ab9('0x28')]);if(_0x56ee8c[_0x7ab9('0x29')]){delete _0x56ee8c[_0x7ab9('0x29')];}_0x21a251[_0x7ab9('0x16')](_0x4b942f)[_0x7ab9('0x2a')](_0x56ee8c);};}exports[_0x7ab9('0x2b')]=function(_0x1fcb26,_0x361b0c){var _0x1c15cf={},_0x44b764={},_0x2dc263={'count':0x0,'rows':[]};var _0x5f1f27=_['map'](db['Sound'][_0x7ab9('0x2c')],function(_0x14736e){return{'name':_0x14736e[_0x7ab9('0x2d')],'type':_0x14736e[_0x7ab9('0x2e')][_0x7ab9('0x2f')]};});_0x44b764[_0x7ab9('0x30')]=_[_0x7ab9('0x31')](_0x5f1f27,'name');_0x44b764[_0x7ab9('0x32')]=_[_0x7ab9('0x33')](_0x1fcb26[_0x7ab9('0x32')]);_0x44b764[_0x7ab9('0x34')]=_[_0x7ab9('0x35')](_0x44b764[_0x7ab9('0x30')],_0x44b764[_0x7ab9('0x32')]);_0x1c15cf[_0x7ab9('0x36')]=_[_0x7ab9('0x35')](_0x44b764['model'],qs[_0x7ab9('0x37')](_0x1fcb26[_0x7ab9('0x32')]['fields']));_0x1c15cf[_0x7ab9('0x36')]=_0x1c15cf[_0x7ab9('0x36')][_0x7ab9('0x38')]?_0x1c15cf['attributes']:_0x44b764[_0x7ab9('0x30')];if(!_0x1fcb26[_0x7ab9('0x32')][_0x7ab9('0x39')]('nolimit')){_0x1c15cf['limit']=qs[_0x7ab9('0x1b')](_0x1fcb26[_0x7ab9('0x32')][_0x7ab9('0x1b')]);_0x1c15cf[_0x7ab9('0x19')]=qs[_0x7ab9('0x19')](_0x1fcb26[_0x7ab9('0x32')][_0x7ab9('0x19')]);}_0x1c15cf[_0x7ab9('0x3a')]=qs['sort'](_0x1fcb26[_0x7ab9('0x32')][_0x7ab9('0x3b')]);_0x1c15cf[_0x7ab9('0x3c')]=qs[_0x7ab9('0x34')](_[_0x7ab9('0x3d')](_0x1fcb26[_0x7ab9('0x32')],_0x44b764[_0x7ab9('0x34')]),_0x5f1f27);if(_0x1fcb26[_0x7ab9('0x32')][_0x7ab9('0x3e')]){_0x1c15cf[_0x7ab9('0x3c')]=_[_0x7ab9('0x3f')](_0x1c15cf[_0x7ab9('0x3c')],{'$or':_[_0x7ab9('0x31')](_0x5f1f27,function(_0x4fc00a){if(_0x4fc00a[_0x7ab9('0x2e')]!==_0x7ab9('0x40')){var _0x5297f8={};_0x5297f8[_0x4fc00a[_0x7ab9('0x29')]]={'$like':'%'+_0x1fcb26[_0x7ab9('0x32')][_0x7ab9('0x3e')]+'%'};return _0x5297f8;}})});}_0x1c15cf=_['merge']({},_0x1c15cf,_0x1fcb26[_0x7ab9('0x41')]);var _0x24b0ec={'where':_0x1c15cf[_0x7ab9('0x3c')]};return db[_0x7ab9('0x42')][_0x7ab9('0x1c')](_0x24b0ec)[_0x7ab9('0x23')](function(_0xffe6c3){_0x2dc263['count']=_0xffe6c3;if(_0x1fcb26['query'][_0x7ab9('0x43')]){_0x1c15cf[_0x7ab9('0x44')]=[{'all':!![]}];}return db[_0x7ab9('0x42')][_0x7ab9('0x45')](_0x1c15cf);})['then'](function(_0x2ed2fe){_0x2dc263[_0x7ab9('0x46')]=_0x2ed2fe;return _0x2dc263;})[_0x7ab9('0x23')](respondWithFilteredResult(_0x361b0c,_0x1c15cf))[_0x7ab9('0x47')](handleError(_0x361b0c,null));};exports['show']=function(_0x2b9119,_0xcfbba6){var _0x145ce9={'raw':!![],'where':{'id':_0x2b9119[_0x7ab9('0x48')]['id']}},_0x16cb61={};_0x16cb61['model']=_[_0x7ab9('0x33')](db['Sound'][_0x7ab9('0x2c')]);_0x16cb61[_0x7ab9('0x32')]=_[_0x7ab9('0x33')](_0x2b9119[_0x7ab9('0x32')]);_0x16cb61[_0x7ab9('0x34')]=_['intersection'](_0x16cb61['model'],_0x16cb61[_0x7ab9('0x32')]);_0x145ce9[_0x7ab9('0x36')]=_['intersection'](_0x16cb61['model'],qs[_0x7ab9('0x37')](_0x2b9119[_0x7ab9('0x32')]['fields']));_0x145ce9['attributes']=_0x145ce9['attributes'][_0x7ab9('0x38')]?_0x145ce9['attributes']:_0x16cb61['model'];if(_0x2b9119['query'][_0x7ab9('0x43')]){_0x145ce9['include']=[{'all':!![]}];}_0x145ce9=_['merge']({},_0x145ce9,_0x2b9119[_0x7ab9('0x41')]);return db[_0x7ab9('0x42')][_0x7ab9('0x49')](_0x145ce9)[_0x7ab9('0x23')](handleEntityNotFound(_0xcfbba6,null))[_0x7ab9('0x23')](respondWithResult(_0xcfbba6,null))[_0x7ab9('0x47')](handleError(_0xcfbba6,null));};exports[_0x7ab9('0x4a')]=function(_0x324dd2,_0x54cce0,_0x180d80){return db[_0x7ab9('0x42')][_0x7ab9('0x49')]({'where':{'id':_0x324dd2['params']['id']},'attributes':['name',_0x7ab9('0x4b'),'converted_format'],'raw':!![]})[_0x7ab9('0x23')](handleEntityNotFound(_0x54cce0,null))['then'](function(_0x2ba3a4){if(_0x2ba3a4){if(!fs[_0x7ab9('0x4c')](path[_0x7ab9('0x4d')](config[_0x7ab9('0x4e')],_0x7ab9('0x4f'),_0x2ba3a4['save_name']+'.'+_0x2ba3a4[_0x7ab9('0x50')]))){throw new db[(_0x7ab9('0x51'))][(_0x7ab9('0x52'))](_0x7ab9('0x53'));}return _0x54cce0[_0x7ab9('0x4a')](path[_0x7ab9('0x4d')](config[_0x7ab9('0x4e')],_0x7ab9('0x4f'),util[_0x7ab9('0x54')](_0x7ab9('0x55'),_0x2ba3a4[_0x7ab9('0x4b')],_0x2ba3a4[_0x7ab9('0x50')])),util['format']('%s.%s',_0x2ba3a4[_0x7ab9('0x29')],_0x2ba3a4['converted_format']));}return null;})['catch'](handleError(_0x54cce0,null));};exports[_0x7ab9('0x56')]=function(_0x170154,_0x598487,_0x293197){var _0x5ac31c={'name':path[_0x7ab9('0x57')](_0x170154[_0x7ab9('0x58')]['originalname'],path[_0x7ab9('0x59')](_0x170154[_0x7ab9('0x58')][_0x7ab9('0x5a')])),'save_name':path['basename'](_0x170154['file'][_0x7ab9('0x5b')],path['extname'](_0x170154['file'][_0x7ab9('0x5b')])),'original_format':path[_0x7ab9('0x59')](_0x170154[_0x7ab9('0x58')]['originalname'])[_0x7ab9('0x5c')](0x1),'converted_format':'wav'};var _0x4b5f92=path['join'](config[_0x7ab9('0x4e')],_0x7ab9('0x5d'),_0x170154['file']['filename']);var _0x2d91c4=path['join'](config['root'],_0x7ab9('0x4f'),util['format']('%s.%s',path['basename'](_0x170154[_0x7ab9('0x58')][_0x7ab9('0x5b')],path[_0x7ab9('0x59')](_0x170154[_0x7ab9('0x58')]['filename'])),_0x5ac31c[_0x7ab9('0x50')]));logger[_0x7ab9('0x5e')]('Sound\x20upload\x20filepath:\x20%s',_0x4b5f92);logger[_0x7ab9('0x5e')](_0x7ab9('0x5f'),_0x2d91c4);try{fs[_0x7ab9('0x60')](_0x4b5f92,parseInt('0777',0x8));var _0x2a7a31=sox[_0x7ab9('0x61')](_0x4b5f92,_0x2d91c4,{'sampleRate':0x1f40,'format':_0x7ab9('0x62'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2a7a31['on']('error',function(_0x24ba74){fs[_0x7ab9('0x63')](_0x4b5f92);_0x598487[_0x7ab9('0x16')](0x1f4)[_0x7ab9('0x2a')](_0x24ba74);});_0x2a7a31['on'](_0x7ab9('0x64'),function(_0x5a6b83){_0x5ac31c[_0x7ab9('0x65')]=isNaN(_0x5a6b83['duration'])?null:_0x5a6b83[_0x7ab9('0x66')]*0x3e8;_0x5ac31c[_0x7ab9('0x67')]=isNaN(_0x5a6b83[_0x7ab9('0x68')])?null:_0x5a6b83[_0x7ab9('0x68')];_0x5ac31c['original_channelCount']=isNaN(_0x5a6b83['channelCount'])?null:_0x5a6b83[_0x7ab9('0x69')];_0x5ac31c[_0x7ab9('0x6a')]=isNaN(_0x5a6b83['bitRate'])?null:_0x5a6b83[_0x7ab9('0x6b')];_0x5ac31c[_0x7ab9('0x6c')]=isNaN(_0x5a6b83[_0x7ab9('0x6d')])?null:_0x5a6b83['sampleRate'];});_0x2a7a31['on'](_0x7ab9('0x6e'),function(_0x5697ea){_0x5ac31c[_0x7ab9('0x6f')]=isNaN(_0x5697ea[_0x7ab9('0x66')])?null:_0x5697ea['duration']*0x3e8;_0x5ac31c[_0x7ab9('0x70')]=isNaN(_0x5697ea[_0x7ab9('0x68')])?null:_0x5697ea[_0x7ab9('0x68')];_0x5ac31c[_0x7ab9('0x71')]=isNaN(_0x5697ea['channelCount'])?null:_0x5697ea['channelCount'];_0x5ac31c[_0x7ab9('0x72')]=isNaN(_0x5697ea[_0x7ab9('0x6b')])?null:_0x5697ea[_0x7ab9('0x6b')];_0x5ac31c[_0x7ab9('0x73')]=isNaN(_0x5697ea[_0x7ab9('0x6d')])?null:_0x5697ea[_0x7ab9('0x6d')];});_0x2a7a31['on'](_0x7ab9('0x17'),function(){fs['chmodSync'](_0x2d91c4,parseInt('0777',0x8));return db[_0x7ab9('0x42')][_0x7ab9('0x56')](_0x5ac31c)[_0x7ab9('0x23')](function(_0x106e6d){var _0x431b1a={'role':_0x170154[_0x7ab9('0x74')][_0x7ab9('0x75')],'userProfileId':_0x170154[_0x7ab9('0x74')][_0x7ab9('0x76')]};if(!_0x431b1a)throw new Error(_0x7ab9('0x77'));if(_0x431b1a[_0x7ab9('0x75')]===_0x7ab9('0x78')){var _0x2deead=_0x106e6d[_0x7ab9('0x24')]({'plain':!![]});return db[_0x7ab9('0x79')]['find']({'where':{'name':'Sounds','userProfileId':_0x431b1a['userProfileId']},'raw':!![]})['then'](function(_0x101229){if(_0x101229&&_0x101229['autoAssociation']===0x0){return db[_0x7ab9('0x26')]['create']({'name':_0x2deead[_0x7ab9('0x29')],'resourceId':_0x2deead['id'],'type':_0x101229[_0x7ab9('0x29')],'sectionId':_0x101229['id']},{})['then'](function(){return _0x106e6d;});}else{return _0x106e6d;}})[_0x7ab9('0x47')](function(_0x1c5e82){logger[_0x7ab9('0x7a')](_0x7ab9('0x7b'),_0x1c5e82);throw _0x1c5e82;});}return _0x106e6d;})[_0x7ab9('0x23')](respondWithResult(_0x598487,null))[_0x7ab9('0x47')](handleError(_0x598487,null));});_0x2a7a31[_0x7ab9('0x7c')]();}catch(_0x13c52b){_0x598487[_0x7ab9('0x16')](0x1f4)['send'](_0x13c52b);}};exports['update']=function(_0x4bee46,_0x3c41b8,_0x1c85fb){return db[_0x7ab9('0x42')][_0x7ab9('0x49')]({'where':{'id':_0x4bee46[_0x7ab9('0x48')]['id']}})[_0x7ab9('0x23')](handleEntityNotFound(_0x3c41b8,null))[_0x7ab9('0x23')](saveUpdates(_[_0x7ab9('0x3d')](_0x4bee46[_0x7ab9('0x74')],[_0x7ab9('0x29'),'description']),null))[_0x7ab9('0x23')](respondWithResult(_0x3c41b8,null))[_0x7ab9('0x47')](handleError(_0x3c41b8,null));};exports[_0x7ab9('0x7d')]=function(_0xb47afc,_0x4e35d6,_0x51b9e3){return db[_0x7ab9('0x42')][_0x7ab9('0x49')]({'where':{'id':_0xb47afc[_0x7ab9('0x48')]['id']}})[_0x7ab9('0x23')](function(_0x6b885e){if(_0x6b885e){return _0x6b885e[_0x7ab9('0x27')]();}})[_0x7ab9('0x23')](function(_0x38608f){var _0x523a1d=path[_0x7ab9('0x4d')](config['root'],'server/files/sounds/original',util['format']('%s.%s',_0x38608f[_0x7ab9('0x4b')],_0x38608f[_0x7ab9('0x7e')]));var _0x417215=path[_0x7ab9('0x4d')](config[_0x7ab9('0x4e')],'server/files/sounds/converted',util[_0x7ab9('0x54')]('%s.%s',_0x38608f['save_name'],_0x38608f[_0x7ab9('0x50')]));fs[_0x7ab9('0x63')](_0x523a1d);fs[_0x7ab9('0x63')](_0x417215);return _0x38608f;})[_0x7ab9('0x23')](function(_0x3069cc){if(_0x3069cc){return _0x4e35d6[_0x7ab9('0x16')](0xcc)[_0x7ab9('0x17')]();}})[_0x7ab9('0x23')](handleEntityNotFound(_0x4e35d6,null))[_0x7ab9('0x47')](handleError(_0x4e35d6,null));}; \ No newline at end of file +var _0xe300=['keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','filters','filter','type','merge','Sound','findAll','rows','catch','length','includeAll','include','find','download','params','save_name','converted_format','existsSync','join','root','ValidationError','Sound\x20not\x20found','format','%s.%s','originalname','file','basename','extname','filename','substring','server/files/sounds/original','Sound\x20upload\x20filepath:\x20%s','transcode','wav','error','src','original_duration','duration','sampleCount','original_channelCount','channelCount','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','converted_sampleRate','chmodSync','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Sounds','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','destroy','then','get','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0xe300,0x1b5));var _0x0e30=function(_0xdf7a0d,_0x213f65){_0xdf7a0d=_0xdf7a0d-0x0;var _0x3a5d96=_0xe300[_0xdf7a0d];return _0x3a5d96;};'use strict';var emlformat=require(_0x0e30('0x0'));var rimraf=require(_0x0e30('0x1'));var zipdir=require(_0x0e30('0x2'));var jsonpatch=require(_0x0e30('0x3'));var rp=require(_0x0e30('0x4'));var moment=require(_0x0e30('0x5'));var BPromise=require(_0x0e30('0x6'));var Mustache=require(_0x0e30('0x7'));var util=require(_0x0e30('0x8'));var path=require(_0x0e30('0x9'));var sox=require(_0x0e30('0xa'));var csv=require(_0x0e30('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0e30('0xc'));var _=require(_0x0e30('0xd'));var squel=require('squel');var crypto=require(_0x0e30('0xe'));var jsforce=require(_0x0e30('0xf'));var deskjs=require(_0x0e30('0x10'));var toCsv=require(_0x0e30('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0e30('0x11'));var authService=require(_0x0e30('0x12'));var qs=require(_0x0e30('0x13'));var as=require(_0x0e30('0x14'));var hardwareService=require(_0x0e30('0x15'));var logger=require(_0x0e30('0x16'))(_0x0e30('0x17'));var utils=require(_0x0e30('0x18'));var config=require(_0x0e30('0x19'));var licenseUtil=require(_0x0e30('0x1a'));var db=require(_0x0e30('0x1b'))['db'];function respondWithStatusCode(_0x531132,_0xa42f48){_0xa42f48=_0xa42f48||0xcc;return function(_0x2c11b4){if(_0x2c11b4){return _0x531132['sendStatus'](_0xa42f48);}return _0x531132['status'](_0xa42f48)[_0x0e30('0x1c')]();};}function respondWithResult(_0x4f649e,_0x3c34c9){_0x3c34c9=_0x3c34c9||0xc8;return function(_0x4f01e8){if(_0x4f01e8){return _0x4f649e[_0x0e30('0x1d')](_0x3c34c9)[_0x0e30('0x1e')](_0x4f01e8);}};}function respondWithFilteredResult(_0x5ffce1,_0x570f6e){return function(_0x220f2e){if(_0x220f2e){var _0x478e53=typeof _0x570f6e['offset']===_0x0e30('0x1f')&&typeof _0x570f6e[_0x0e30('0x20')]===_0x0e30('0x1f');var _0x439a68=_0x220f2e[_0x0e30('0x21')];var _0x52c7be=_0x478e53?0x0:_0x570f6e[_0x0e30('0x22')];var _0x16e732=_0x478e53?_0x220f2e[_0x0e30('0x21')]:_0x570f6e[_0x0e30('0x22')]+_0x570f6e[_0x0e30('0x20')];var _0x5d3306;if(_0x16e732>=_0x439a68){_0x16e732=_0x439a68;_0x5d3306=0xc8;}else{_0x5d3306=0xce;}_0x5ffce1['status'](_0x5d3306);return _0x5ffce1[_0x0e30('0x23')](_0x0e30('0x24'),_0x52c7be+'-'+_0x16e732+'/'+_0x439a68)[_0x0e30('0x1e')](_0x220f2e);}return null;};}function patchUpdates(_0x301a44){return function(_0x1af50f){try{jsonpatch[_0x0e30('0x25')](_0x1af50f,_0x301a44,!![]);}catch(_0x2b161c){return BPromise[_0x0e30('0x26')](_0x2b161c);}return _0x1af50f['save']();};}function saveUpdates(_0x287ab1,_0x4a4a09){return function(_0xb08e02){if(_0xb08e02){return _0xb08e02[_0x0e30('0x27')](_0x287ab1)['then'](function(_0x686a97){return _0x686a97;});}return null;};}function removeEntity(_0x2e308d,_0x2f2b7a){return function(_0x5f52ea){if(_0x5f52ea){return _0x5f52ea[_0x0e30('0x28')]()[_0x0e30('0x29')](function(){var _0x28a815=_0x5f52ea[_0x0e30('0x2a')]({'plain':!![]});var _0x43cf73='Sounds';return db[_0x0e30('0x2b')]['destroy']({'where':{'type':_0x43cf73,'resourceId':_0x28a815['id']}})[_0x0e30('0x29')](function(){return _0x5f52ea;});})[_0x0e30('0x29')](function(){_0x2e308d[_0x0e30('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0xab3b66,_0x1156f5){return function(_0xcbeec6){if(!_0xcbeec6){_0xab3b66[_0x0e30('0x2c')](0x194);}return _0xcbeec6;};}function handleError(_0x50bb4d,_0x55dcab){_0x55dcab=_0x55dcab||0x1f4;return function(_0x5a7c86){logger['error'](_0x5a7c86[_0x0e30('0x2d')]);if(_0x5a7c86[_0x0e30('0x2e')]){delete _0x5a7c86[_0x0e30('0x2e')];}_0x50bb4d['status'](_0x55dcab)[_0x0e30('0x2f')](_0x5a7c86);};}exports[_0x0e30('0x30')]=function(_0x57d29e,_0x2bc454){var _0x471482={},_0x334f60={},_0x3958d9={'count':0x0,'rows':[]};var _0xffe73f=_[_0x0e30('0x31')](db['Sound'][_0x0e30('0x32')],function(_0x353be6){return{'name':_0x353be6[_0x0e30('0x33')],'type':_0x353be6['type'][_0x0e30('0x34')]};});_0x334f60[_0x0e30('0x35')]=_[_0x0e30('0x31')](_0xffe73f,_0x0e30('0x2e'));_0x334f60[_0x0e30('0x36')]=_[_0x0e30('0x37')](_0x57d29e['query']);_0x334f60['filters']=_['intersection'](_0x334f60['model'],_0x334f60[_0x0e30('0x36')]);_0x471482[_0x0e30('0x38')]=_[_0x0e30('0x39')](_0x334f60[_0x0e30('0x35')],qs[_0x0e30('0x3a')](_0x57d29e[_0x0e30('0x36')]['fields']));_0x471482['attributes']=_0x471482[_0x0e30('0x38')]['length']?_0x471482['attributes']:_0x334f60[_0x0e30('0x35')];if(!_0x57d29e['query'][_0x0e30('0x3b')](_0x0e30('0x3c'))){_0x471482[_0x0e30('0x20')]=qs[_0x0e30('0x20')](_0x57d29e[_0x0e30('0x36')]['limit']);_0x471482[_0x0e30('0x22')]=qs[_0x0e30('0x22')](_0x57d29e['query'][_0x0e30('0x22')]);}_0x471482['order']=qs[_0x0e30('0x3d')](_0x57d29e[_0x0e30('0x36')][_0x0e30('0x3d')]);_0x471482[_0x0e30('0x3e')]=qs['filters'](_['pick'](_0x57d29e['query'],_0x334f60[_0x0e30('0x3f')]),_0xffe73f);if(_0x57d29e['query'][_0x0e30('0x40')]){_0x471482['where']=_['merge'](_0x471482[_0x0e30('0x3e')],{'$or':_[_0x0e30('0x31')](_0xffe73f,function(_0x2fa3df){if(_0x2fa3df[_0x0e30('0x41')]!=='VIRTUAL'){var _0x2db074={};_0x2db074[_0x2fa3df[_0x0e30('0x2e')]]={'$like':'%'+_0x57d29e[_0x0e30('0x36')][_0x0e30('0x40')]+'%'};return _0x2db074;}})});}_0x471482=_[_0x0e30('0x42')]({},_0x471482,_0x57d29e['options']);var _0x5f3678={'where':_0x471482[_0x0e30('0x3e')]};return db[_0x0e30('0x43')][_0x0e30('0x21')](_0x5f3678)[_0x0e30('0x29')](function(_0x2eca97){_0x3958d9['count']=_0x2eca97;if(_0x57d29e[_0x0e30('0x36')]['includeAll']){_0x471482['include']=[{'all':!![]}];}return db[_0x0e30('0x43')][_0x0e30('0x44')](_0x471482);})['then'](function(_0x1380e7){_0x3958d9[_0x0e30('0x45')]=_0x1380e7;return _0x3958d9;})['then'](respondWithFilteredResult(_0x2bc454,_0x471482))[_0x0e30('0x46')](handleError(_0x2bc454,null));};exports['show']=function(_0x3dfeeb,_0x409194){var _0x4d4cd0={'raw':!![],'where':{'id':_0x3dfeeb['params']['id']}},_0x346a46={};_0x346a46[_0x0e30('0x35')]=_[_0x0e30('0x37')](db[_0x0e30('0x43')][_0x0e30('0x32')]);_0x346a46[_0x0e30('0x36')]=_[_0x0e30('0x37')](_0x3dfeeb['query']);_0x346a46[_0x0e30('0x3f')]=_[_0x0e30('0x39')](_0x346a46[_0x0e30('0x35')],_0x346a46[_0x0e30('0x36')]);_0x4d4cd0[_0x0e30('0x38')]=_[_0x0e30('0x39')](_0x346a46['model'],qs[_0x0e30('0x3a')](_0x3dfeeb[_0x0e30('0x36')][_0x0e30('0x3a')]));_0x4d4cd0[_0x0e30('0x38')]=_0x4d4cd0['attributes'][_0x0e30('0x47')]?_0x4d4cd0[_0x0e30('0x38')]:_0x346a46[_0x0e30('0x35')];if(_0x3dfeeb['query'][_0x0e30('0x48')]){_0x4d4cd0[_0x0e30('0x49')]=[{'all':!![]}];}_0x4d4cd0=_[_0x0e30('0x42')]({},_0x4d4cd0,_0x3dfeeb['options']);return db[_0x0e30('0x43')][_0x0e30('0x4a')](_0x4d4cd0)[_0x0e30('0x29')](handleEntityNotFound(_0x409194,null))[_0x0e30('0x29')](respondWithResult(_0x409194,null))[_0x0e30('0x46')](handleError(_0x409194,null));};exports[_0x0e30('0x4b')]=function(_0x417aca,_0x2b3b45,_0x73b407){return db['Sound']['find']({'where':{'id':_0x417aca[_0x0e30('0x4c')]['id']},'attributes':[_0x0e30('0x2e'),_0x0e30('0x4d'),_0x0e30('0x4e')],'raw':!![]})[_0x0e30('0x29')](handleEntityNotFound(_0x2b3b45,null))[_0x0e30('0x29')](function(_0x4f9277){if(_0x4f9277){if(!fs[_0x0e30('0x4f')](path[_0x0e30('0x50')](config[_0x0e30('0x51')],'server/files/sounds/converted',_0x4f9277[_0x0e30('0x4d')]+'.'+_0x4f9277['converted_format']))){throw new db['Sequelize'][(_0x0e30('0x52'))](_0x0e30('0x53'));}return _0x2b3b45[_0x0e30('0x4b')](path['join'](config[_0x0e30('0x51')],'server/files/sounds/converted',util[_0x0e30('0x54')](_0x0e30('0x55'),_0x4f9277[_0x0e30('0x4d')],_0x4f9277[_0x0e30('0x4e')])),util[_0x0e30('0x54')](_0x0e30('0x55'),_0x4f9277[_0x0e30('0x2e')],_0x4f9277['converted_format']));}return null;})[_0x0e30('0x46')](handleError(_0x2b3b45,null));};exports['create']=function(_0x1636ec,_0x39596c,_0x5e57e1){var _0x53de4c={'name':path['basename'](_0x1636ec['file'][_0x0e30('0x56')],path['extname'](_0x1636ec[_0x0e30('0x57')][_0x0e30('0x56')])),'save_name':path[_0x0e30('0x58')](_0x1636ec['file']['filename'],path[_0x0e30('0x59')](_0x1636ec['file'][_0x0e30('0x5a')])),'original_format':path[_0x0e30('0x59')](_0x1636ec[_0x0e30('0x57')][_0x0e30('0x56')])[_0x0e30('0x5b')](0x1),'converted_format':'wav'};var _0x2a5bc1=path[_0x0e30('0x50')](config[_0x0e30('0x51')],_0x0e30('0x5c'),_0x1636ec['file'][_0x0e30('0x5a')]);var _0x5caa42=path[_0x0e30('0x50')](config[_0x0e30('0x51')],'server/files/sounds/converted',util[_0x0e30('0x54')]('%s.%s',path[_0x0e30('0x58')](_0x1636ec[_0x0e30('0x57')]['filename'],path['extname'](_0x1636ec[_0x0e30('0x57')][_0x0e30('0x5a')])),_0x53de4c[_0x0e30('0x4e')]));logger['info'](_0x0e30('0x5d'),_0x2a5bc1);logger['info']('Sound\x20upload\x20destination:\x20%s',_0x5caa42);try{fs['chmodSync'](_0x2a5bc1,parseInt('0777',0x8));var _0x413cfe=sox[_0x0e30('0x5e')](_0x2a5bc1,_0x5caa42,{'sampleRate':0x1f40,'format':_0x0e30('0x5f'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x413cfe['on'](_0x0e30('0x60'),function(_0x447ae0){fs['unlinkSync'](_0x2a5bc1);_0x39596c[_0x0e30('0x1d')](0x1f4)[_0x0e30('0x2f')](_0x447ae0);});_0x413cfe['on'](_0x0e30('0x61'),function(_0x421b6b){_0x53de4c[_0x0e30('0x62')]=isNaN(_0x421b6b['duration'])?null:_0x421b6b[_0x0e30('0x63')]*0x3e8;_0x53de4c['original_sampleCount']=isNaN(_0x421b6b[_0x0e30('0x64')])?null:_0x421b6b['sampleCount'];_0x53de4c[_0x0e30('0x65')]=isNaN(_0x421b6b[_0x0e30('0x66')])?null:_0x421b6b[_0x0e30('0x66')];_0x53de4c['original_bitRate']=isNaN(_0x421b6b[_0x0e30('0x67')])?null:_0x421b6b[_0x0e30('0x67')];_0x53de4c[_0x0e30('0x68')]=isNaN(_0x421b6b[_0x0e30('0x69')])?null:_0x421b6b[_0x0e30('0x69')];});_0x413cfe['on'](_0x0e30('0x6a'),function(_0x53c95c){_0x53de4c[_0x0e30('0x6b')]=isNaN(_0x53c95c['duration'])?null:_0x53c95c[_0x0e30('0x63')]*0x3e8;_0x53de4c['converted_sampleCount']=isNaN(_0x53c95c['sampleCount'])?null:_0x53c95c[_0x0e30('0x64')];_0x53de4c[_0x0e30('0x6c')]=isNaN(_0x53c95c[_0x0e30('0x66')])?null:_0x53c95c['channelCount'];_0x53de4c[_0x0e30('0x6d')]=isNaN(_0x53c95c[_0x0e30('0x67')])?null:_0x53c95c[_0x0e30('0x67')];_0x53de4c[_0x0e30('0x6e')]=isNaN(_0x53c95c[_0x0e30('0x69')])?null:_0x53c95c[_0x0e30('0x69')];});_0x413cfe['on'](_0x0e30('0x1c'),function(){fs[_0x0e30('0x6f')](_0x5caa42,parseInt('0777',0x8));return db[_0x0e30('0x43')][_0x0e30('0x70')](_0x53de4c)[_0x0e30('0x29')](function(_0xe8aca5){var _0x45ead6={'role':_0x1636ec[_0x0e30('0x71')][_0x0e30('0x72')],'userProfileId':_0x1636ec[_0x0e30('0x71')][_0x0e30('0x73')]};if(!_0x45ead6)throw new Error(_0x0e30('0x74'));if(_0x45ead6[_0x0e30('0x72')]===_0x0e30('0x75')){var _0x1158a7=_0xe8aca5[_0x0e30('0x2a')]({'plain':!![]});return db[_0x0e30('0x76')][_0x0e30('0x4a')]({'where':{'name':_0x0e30('0x77'),'userProfileId':_0x45ead6[_0x0e30('0x73')]},'raw':!![]})[_0x0e30('0x29')](function(_0x2733e5){if(_0x2733e5&&_0x2733e5['autoAssociation']===0x0){return db[_0x0e30('0x2b')]['create']({'name':_0x1158a7[_0x0e30('0x2e')],'resourceId':_0x1158a7['id'],'type':_0x2733e5[_0x0e30('0x2e')],'sectionId':_0x2733e5['id']},{})['then'](function(){return _0xe8aca5;});}else{return _0xe8aca5;}})['catch'](function(_0x28adcd){logger[_0x0e30('0x60')](_0x0e30('0x78'),_0x28adcd);throw _0x28adcd;});}return _0xe8aca5;})[_0x0e30('0x29')](respondWithResult(_0x39596c,null))[_0x0e30('0x46')](handleError(_0x39596c,null));});_0x413cfe['start']();}catch(_0x3af178){_0x39596c[_0x0e30('0x1d')](0x1f4)[_0x0e30('0x2f')](_0x3af178);}};exports['update']=function(_0x4f8124,_0x5b531f,_0x1f3b26){return db[_0x0e30('0x43')]['find']({'where':{'id':_0x4f8124[_0x0e30('0x4c')]['id']}})[_0x0e30('0x29')](handleEntityNotFound(_0x5b531f,null))['then'](saveUpdates(_['pick'](_0x4f8124[_0x0e30('0x71')],[_0x0e30('0x2e'),_0x0e30('0x79')]),null))[_0x0e30('0x29')](respondWithResult(_0x5b531f,null))[_0x0e30('0x46')](handleError(_0x5b531f,null));};exports[_0x0e30('0x7a')]=function(_0x49f285,_0x20a274,_0x1db2f5){return db[_0x0e30('0x43')]['find']({'where':{'id':_0x49f285[_0x0e30('0x4c')]['id']}})[_0x0e30('0x29')](function(_0x591db3){if(_0x591db3){return _0x591db3['destroy']();}})[_0x0e30('0x29')](function(_0x3eae61){var _0x15e4c6=path[_0x0e30('0x50')](config['root'],_0x0e30('0x5c'),util[_0x0e30('0x54')](_0x0e30('0x55'),_0x3eae61['save_name'],_0x3eae61['original_format']));var _0x238daa=path[_0x0e30('0x50')](config[_0x0e30('0x51')],'server/files/sounds/converted',util[_0x0e30('0x54')]('%s.%s',_0x3eae61[_0x0e30('0x4d')],_0x3eae61[_0x0e30('0x4e')]));fs['unlinkSync'](_0x15e4c6);fs['unlinkSync'](_0x238daa);return _0x3eae61;})[_0x0e30('0x29')](function(_0x2ff9c3){if(_0x2ff9c3){return _0x20a274[_0x0e30('0x1d')](0xcc)[_0x0e30('0x1c')]();}})[_0x0e30('0x29')](handleEntityNotFound(_0x20a274,null))['catch'](handleError(_0x20a274,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index e986393..6c7c314 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 _0xc7b2=['tools_sounds','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./sound.attributes','exports','Sound'];(function(_0x4264ee,_0x520320){var _0x46d043=function(_0x4636e8){while(--_0x4636e8){_0x4264ee['push'](_0x4264ee['shift']());}};_0x46d043(++_0x520320);}(_0xc7b2,0x79));var _0x2c7b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc7b2[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x2c7b('0x0'));var logger=require(_0x2c7b('0x1'))(_0x2c7b('0x2'));var moment=require(_0x2c7b('0x3'));var BPromise=require(_0x2c7b('0x4'));var rp=require(_0x2c7b('0x5'));var fs=require('fs');var path=require(_0x2c7b('0x6'));var rimraf=require(_0x2c7b('0x7'));var config=require('../../config/environment');var attributes=require(_0x2c7b('0x8'));module[_0x2c7b('0x9')]=function(_0x9a855c,_0x4e690b){return _0x9a855c['define'](_0x2c7b('0xa'),attributes,{'tableName':_0x2c7b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd319=['bluebird','request-promise','rimraf','../../config/environment','exports','Sound','tools_sounds','lodash','util','api','moment'];(function(_0x296167,_0x11ac12){var _0x1aa559=function(_0x1d51c4){while(--_0x1d51c4){_0x296167['push'](_0x296167['shift']());}};_0x1aa559(++_0x11ac12);}(_0xd319,0x130));var _0x9d31=function(_0x4b5922,_0x218cbc){_0x4b5922=_0x4b5922-0x0;var _0x952eeb=_0xd319[_0x4b5922];return _0x952eeb;};'use strict';var _=require(_0x9d31('0x0'));var util=require(_0x9d31('0x1'));var logger=require('../../config/logger')(_0x9d31('0x2'));var moment=require(_0x9d31('0x3'));var BPromise=require(_0x9d31('0x4'));var rp=require(_0x9d31('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9d31('0x6'));var config=require(_0x9d31('0x7'));var attributes=require('./sound.attributes');module[_0x9d31('0x8')]=function(_0x306a2c,_0x2bb402){return _0x306a2c['define'](_0x9d31('0x9'),attributes,{'tableName':_0x9d31('0xa'),'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 d4a9b7a..a845836 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 _0xfb49=['attributes','include','model','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','ShowSound','Sound','options','where','map'];(function(_0x1e3a11,_0x56e4f2){var _0x4b72f2=function(_0x2c0590){while(--_0x2c0590){_0x1e3a11['push'](_0x1e3a11['shift']());}};_0x4b72f2(++_0x56e4f2);}(_0xfb49,0x11a));var _0x9fb4=function(_0x57ee1d,_0x54111b){_0x57ee1d=_0x57ee1d-0x0;var _0x12a933=_0xfb49[_0x57ee1d];return _0x12a933;};'use strict';var _=require(_0x9fb4('0x0'));var util=require(_0x9fb4('0x1'));var moment=require(_0x9fb4('0x2'));var BPromise=require(_0x9fb4('0x3'));var rs=require(_0x9fb4('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9fb4('0x5'))['db'];var utils=require(_0x9fb4('0x6'));var logger=require(_0x9fb4('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9fb4('0x8'));var client=jayson[_0x9fb4('0x9')][_0x9fb4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2bfdc4,_0x40def2,_0x160eb0){return new BPromise(function(_0x230111,_0x4e5de4){return client[_0x9fb4('0xb')](_0x2bfdc4,_0x160eb0)[_0x9fb4('0xc')](function(_0x4fa454){logger[_0x9fb4('0xd')](_0x9fb4('0xe'),_0x40def2,_0x9fb4('0xf'));logger[_0x9fb4('0x10')]('Sound,\x20%s,\x20%s,\x20%s',_0x40def2,_0x9fb4('0xf'),JSON[_0x9fb4('0x11')](_0x4fa454));if(_0x4fa454[_0x9fb4('0x12')]){if(_0x4fa454[_0x9fb4('0x12')][_0x9fb4('0x13')]===0x1f4){logger[_0x9fb4('0x12')](_0x9fb4('0xe'),_0x40def2,_0x4fa454[_0x9fb4('0x12')][_0x9fb4('0x14')]);return _0x4e5de4(_0x4fa454[_0x9fb4('0x12')][_0x9fb4('0x14')]);}logger[_0x9fb4('0x12')](_0x9fb4('0xe'),_0x40def2,_0x4fa454[_0x9fb4('0x12')][_0x9fb4('0x14')]);return _0x230111(_0x4fa454[_0x9fb4('0x12')][_0x9fb4('0x14')]);}else{logger['info'](_0x9fb4('0xe'),_0x40def2,'request\x20sent');_0x230111(_0x4fa454[_0x9fb4('0x15')]['message']);}})[_0x9fb4('0x16')](function(_0x1f7680){logger[_0x9fb4('0x12')](_0x9fb4('0xe'),_0x40def2,_0x1f7680);_0x4e5de4(_0x1f7680);});});}exports[_0x9fb4('0x17')]=function(_0x33279f){var _0x1fba8e=this;return new Promise(function(_0x2c5637,_0x12851f){return db[_0x9fb4('0x18')]['find']({'raw':_0x33279f[_0x9fb4('0x19')]?_0x33279f[_0x9fb4('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x33279f[_0x9fb4('0x19')]?_0x33279f[_0x9fb4('0x19')][_0x9fb4('0x1a')]||null:null,'attributes':_0x33279f[_0x9fb4('0x19')]?_0x33279f[_0x9fb4('0x19')]['attributes']||null:null,'include':_0x33279f['options']?_0x33279f[_0x9fb4('0x19')]['include']?_[_0x9fb4('0x1b')](_0x33279f[_0x9fb4('0x19')]['include'],function(_0xbc36a4){return{'model':db[_0xbc36a4['model']],'as':_0xbc36a4['as'],'attributes':_0xbc36a4[_0x9fb4('0x1c')],'include':_0xbc36a4[_0x9fb4('0x1d')]?_[_0x9fb4('0x1b')](_0xbc36a4['include'],function(_0x25d6a2){return{'model':db[_0x25d6a2[_0x9fb4('0x1e')]],'as':_0x25d6a2['as'],'attributes':_0x25d6a2[_0x9fb4('0x1c')],'include':_0x25d6a2[_0x9fb4('0x1d')]?_[_0x9fb4('0x1b')](_0x25d6a2[_0x9fb4('0x1d')],function(_0x2a6367){return{'model':db[_0x2a6367['model']],'as':_0x2a6367['as'],'attributes':_0x2a6367[_0x9fb4('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x9fb4('0xc')](function(_0x145786){logger[_0x9fb4('0xd')](_0x9fb4('0x17'),_0x33279f);logger[_0x9fb4('0x10')](_0x9fb4('0x17'),_0x33279f,JSON['stringify'](_0x145786));_0x2c5637(_0x145786);})[_0x9fb4('0x16')](function(_0x2f10ad){logger[_0x9fb4('0x12')]('ShowSound',_0x2f10ad[_0x9fb4('0x14')],_0x33279f);_0x12851f(_0x1fba8e['error'](0x1f4,_0x2f10ad['message']));});});}; \ No newline at end of file +var _0x5eec=['attributes','then','ShowSound','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','Sound','find','options','raw','where','include','map','model'];(function(_0x4659eb,_0x4fc95e){var _0x3beab2=function(_0x27d1ae){while(--_0x27d1ae){_0x4659eb['push'](_0x4659eb['shift']());}};_0x3beab2(++_0x4fc95e);}(_0x5eec,0x6c));var _0xc5ee=function(_0x4b5c3e,_0x37d42d){_0x4b5c3e=_0x4b5c3e-0x0;var _0x58a5e2=_0x5eec[_0x4b5c3e];return _0x58a5e2;};'use strict';var _=require('lodash');var util=require(_0xc5ee('0x0'));var moment=require(_0xc5ee('0x1'));var BPromise=require('bluebird');var rs=require(_0xc5ee('0x2'));var fs=require('fs');var Redis=require(_0xc5ee('0x3'));var db=require(_0xc5ee('0x4'))['db'];var utils=require(_0xc5ee('0x5'));var logger=require(_0xc5ee('0x6'))(_0xc5ee('0x7'));var config=require(_0xc5ee('0x8'));var jayson=require(_0xc5ee('0x9'));var client=jayson[_0xc5ee('0xa')][_0xc5ee('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f3d80,_0x538d16,_0x2fe885){return new BPromise(function(_0x367006,_0x453942){return client[_0xc5ee('0xc')](_0x2f3d80,_0x2fe885)['then'](function(_0x4626ef){logger[_0xc5ee('0xd')]('Sound,\x20%s,\x20%s',_0x538d16,_0xc5ee('0xe'));logger[_0xc5ee('0xf')](_0xc5ee('0x10'),_0x538d16,_0xc5ee('0xe'),JSON[_0xc5ee('0x11')](_0x4626ef));if(_0x4626ef[_0xc5ee('0x12')]){if(_0x4626ef[_0xc5ee('0x12')][_0xc5ee('0x13')]===0x1f4){logger[_0xc5ee('0x12')](_0xc5ee('0x14'),_0x538d16,_0x4626ef[_0xc5ee('0x12')][_0xc5ee('0x15')]);return _0x453942(_0x4626ef['error'][_0xc5ee('0x15')]);}logger[_0xc5ee('0x12')](_0xc5ee('0x14'),_0x538d16,_0x4626ef['error']['message']);return _0x367006(_0x4626ef['error']['message']);}else{logger[_0xc5ee('0xd')](_0xc5ee('0x14'),_0x538d16,_0xc5ee('0xe'));_0x367006(_0x4626ef[_0xc5ee('0x16')][_0xc5ee('0x15')]);}})[_0xc5ee('0x17')](function(_0x40beaa){logger[_0xc5ee('0x12')](_0xc5ee('0x14'),_0x538d16,_0x40beaa);_0x453942(_0x40beaa);});});}exports['ShowSound']=function(_0xfd536e){var _0x529647=this;return new Promise(function(_0x1aed56,_0x80b740){return db[_0xc5ee('0x18')][_0xc5ee('0x19')]({'raw':_0xfd536e[_0xc5ee('0x1a')]?_0xfd536e[_0xc5ee('0x1a')][_0xc5ee('0x1b')]===undefined?!![]:![]:!![],'where':_0xfd536e[_0xc5ee('0x1a')]?_0xfd536e[_0xc5ee('0x1a')][_0xc5ee('0x1c')]||null:null,'attributes':_0xfd536e[_0xc5ee('0x1a')]?_0xfd536e[_0xc5ee('0x1a')]['attributes']||null:null,'include':_0xfd536e[_0xc5ee('0x1a')]?_0xfd536e[_0xc5ee('0x1a')][_0xc5ee('0x1d')]?_[_0xc5ee('0x1e')](_0xfd536e[_0xc5ee('0x1a')][_0xc5ee('0x1d')],function(_0x3fa3ef){return{'model':db[_0x3fa3ef[_0xc5ee('0x1f')]],'as':_0x3fa3ef['as'],'attributes':_0x3fa3ef[_0xc5ee('0x20')],'include':_0x3fa3ef[_0xc5ee('0x1d')]?_[_0xc5ee('0x1e')](_0x3fa3ef['include'],function(_0x4e8a27){return{'model':db[_0x4e8a27[_0xc5ee('0x1f')]],'as':_0x4e8a27['as'],'attributes':_0x4e8a27[_0xc5ee('0x20')],'include':_0x4e8a27[_0xc5ee('0x1d')]?_['map'](_0x4e8a27[_0xc5ee('0x1d')],function(_0x3b1c82){return{'model':db[_0x3b1c82[_0xc5ee('0x1f')]],'as':_0x3b1c82['as'],'attributes':_0x3b1c82[_0xc5ee('0x20')]};}):[]};}):[]};}):[]:[]})[_0xc5ee('0x21')](function(_0x6050f2){logger['info'](_0xc5ee('0x22'),_0xfd536e);logger[_0xc5ee('0xf')]('ShowSound',_0xfd536e,JSON['stringify'](_0x6050f2));_0x1aed56(_0x6050f2);})[_0xc5ee('0x17')](function(_0x16518f){logger['error'](_0xc5ee('0x22'),_0x16518f[_0xc5ee('0x15')],_0xfd536e);_0x80b740(_0x529647[_0xc5ee('0x12')](0x1f4,_0x16518f['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index c1d0a8b..964530e 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x272a88,_0x57e586){var _0x5c71c4=function(_0x8151b3){while(--_0x8151b3){_0x272a88['push'](_0x272a88['shift']());}};_0x5c71c4(++_0x57e586);}(_0x2032,0xd9));var _0x2203=function(_0x386e74,_0x1b2005){_0x386e74=_0x386e74-0x0;var _0x73350=_0x2032[_0x386e74];return _0x73350;};'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('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x1ac94a,_0x4faa73){_0x1ac94a=_0x1ac94a-0x0;var _0x32c65a=_0x9ffd[_0x1ac94a];return _0x32c65a;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 0543f02..6f8c495 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 _0x456f=['TEXT','ENUM','out','STRING','exports'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x456f,0x112));var _0xf456=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x456f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf456('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0xf456('0x1')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0xf456('0x2')]('in',_0xf456('0x3')),'defaultValue':_0xf456('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xf456('0x4')]},'providerResponse':{'type':Sequelize[_0xf456('0x1')]}}; \ No newline at end of file +var _0xfee7=['sequelize','exports','STRING','medium','ENUM','out','TEXT'];(function(_0x30543f,_0x5760a3){var _0x323d1d=function(_0xd8fe23){while(--_0xd8fe23){_0x30543f['push'](_0x30543f['shift']());}};_0x323d1d(++_0x5760a3);}(_0xfee7,0x11f));var _0x7fee=function(_0x4e5d19,_0x1c8866){_0x4e5d19=_0x4e5d19-0x0;var _0x38de5e=_0xfee7[_0x4e5d19];return _0x38de5e;};'use strict';var Sequelize=require(_0x7fee('0x0'));module[_0x7fee('0x1')]={'uniqueid':{'type':Sequelize[_0x7fee('0x2')]},'body':{'type':Sequelize['TEXT'](_0x7fee('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0x7fee('0x4')]('in',_0x7fee('0x5')),'defaultValue':_0x7fee('0x5'),'allowNull':![]},'providerName':{'type':Sequelize[_0x7fee('0x2')]},'providerResponse':{'type':Sequelize[_0x7fee('0x6')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 6a008a9..cd8c7fe 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 _0x0733=['ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','Content-Range','reject','update','then','destroy','error','stack','name','send','index','SquareMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','rows','catch','include','find','create','body','params','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv'];(function(_0x28b4e8,_0x4dc742){var _0x420a1d=function(_0x23ecf9){while(--_0x23ecf9){_0x28b4e8['push'](_0x28b4e8['shift']());}};_0x420a1d(++_0x4dc742);}(_0x0733,0xc4));var _0x3073=function(_0x4408e,_0x3b98f9){_0x4408e=_0x4408e-0x0;var _0x3802b7=_0x0733[_0x4408e];return _0x3802b7;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3073('0x0'));var jsonpatch=require(_0x3073('0x1'));var rp=require(_0x3073('0x2'));var moment=require('moment');var BPromise=require(_0x3073('0x3'));var Mustache=require(_0x3073('0x4'));var util=require('util');var path=require(_0x3073('0x5'));var sox=require(_0x3073('0x6'));var csv=require(_0x3073('0x7'));var ejs=require(_0x3073('0x8'));var fs=require('fs');var fs_extra=require(_0x3073('0x9'));var _=require(_0x3073('0xa'));var squel=require(_0x3073('0xb'));var crypto=require(_0x3073('0xc'));var jsforce=require(_0x3073('0xd'));var deskjs=require(_0x3073('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3073('0xf'));var Redis=require(_0x3073('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3073('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x3073('0x12'))(_0x3073('0x13'));var utils=require(_0x3073('0x14'));var config=require(_0x3073('0x15'));var licenseUtil=require(_0x3073('0x16'));var db=require(_0x3073('0x17'))['db'];function respondWithStatusCode(_0x494252,_0x11e780){_0x11e780=_0x11e780||0xcc;return function(_0x473d73){if(_0x473d73){return _0x494252[_0x3073('0x18')](_0x11e780);}return _0x494252[_0x3073('0x19')](_0x11e780)[_0x3073('0x1a')]();};}function respondWithResult(_0x1ef805,_0x5025ee){_0x5025ee=_0x5025ee||0xc8;return function(_0x2828cf){if(_0x2828cf){return _0x1ef805[_0x3073('0x19')](_0x5025ee)['json'](_0x2828cf);}};}function respondWithFilteredResult(_0x415571,_0x2b8c8b){return function(_0x5efc8d){if(_0x5efc8d){var _0x169772=typeof _0x2b8c8b[_0x3073('0x1b')]===_0x3073('0x1c')&&typeof _0x2b8c8b['limit']===_0x3073('0x1c');var _0x3b2714=_0x5efc8d[_0x3073('0x1d')];var _0x33cf39=_0x169772?0x0:_0x2b8c8b['offset'];var _0xaa8b3c=_0x169772?_0x5efc8d[_0x3073('0x1d')]:_0x2b8c8b['offset']+_0x2b8c8b[_0x3073('0x1e')];var _0x39978a;if(_0xaa8b3c>=_0x3b2714){_0xaa8b3c=_0x3b2714;_0x39978a=0xc8;}else{_0x39978a=0xce;}_0x415571[_0x3073('0x19')](_0x39978a);return _0x415571['set'](_0x3073('0x1f'),_0x33cf39+'-'+_0xaa8b3c+'/'+_0x3b2714)['json'](_0x5efc8d);}return null;};}function patchUpdates(_0x5749de){return function(_0x4c3934){try{jsonpatch['apply'](_0x4c3934,_0x5749de,!![]);}catch(_0x3c3712){return BPromise[_0x3073('0x20')](_0x3c3712);}return _0x4c3934['save']();};}function saveUpdates(_0x154028,_0x352b0d){return function(_0x1b3afd){if(_0x1b3afd){return _0x1b3afd[_0x3073('0x21')](_0x154028)[_0x3073('0x22')](function(_0x455736){return _0x455736;});}return null;};}function removeEntity(_0x2091b2,_0x3812ba){return function(_0x19a98f){if(_0x19a98f){return _0x19a98f[_0x3073('0x23')]()['then'](function(){_0x2091b2[_0x3073('0x19')](0xcc)[_0x3073('0x1a')]();});}};}function handleEntityNotFound(_0x5cb529,_0x45edcd){return function(_0x1b3aef){if(!_0x1b3aef){_0x5cb529[_0x3073('0x18')](0x194);}return _0x1b3aef;};}function handleError(_0x1e3b1d,_0x2cebe3){_0x2cebe3=_0x2cebe3||0x1f4;return function(_0xd9c41b){logger[_0x3073('0x24')](_0xd9c41b[_0x3073('0x25')]);if(_0xd9c41b['name']){delete _0xd9c41b[_0x3073('0x26')];}_0x1e3b1d[_0x3073('0x19')](_0x2cebe3)[_0x3073('0x27')](_0xd9c41b);};}exports[_0x3073('0x28')]=function(_0x1fdbcd,_0x484c47){var _0x22cc0f={},_0x1bc498={},_0x5d5dd8={'count':0x0,'rows':[]};var _0x3f9d64=_['map'](db[_0x3073('0x29')][_0x3073('0x2a')],function(_0x384941){return{'name':_0x384941['fieldName'],'type':_0x384941[_0x3073('0x2b')][_0x3073('0x2c')]};});_0x1bc498[_0x3073('0x2d')]=_[_0x3073('0x2e')](_0x3f9d64,_0x3073('0x26'));_0x1bc498[_0x3073('0x2f')]=_[_0x3073('0x30')](_0x1fdbcd['query']);_0x1bc498[_0x3073('0x31')]=_[_0x3073('0x32')](_0x1bc498[_0x3073('0x2d')],_0x1bc498[_0x3073('0x2f')]);_0x22cc0f['attributes']=_[_0x3073('0x32')](_0x1bc498['model'],qs['fields'](_0x1fdbcd[_0x3073('0x2f')]['fields']));_0x22cc0f[_0x3073('0x33')]=_0x22cc0f[_0x3073('0x33')][_0x3073('0x34')]?_0x22cc0f[_0x3073('0x33')]:_0x1bc498['model'];if(!_0x1fdbcd[_0x3073('0x2f')][_0x3073('0x35')]('nolimit')){_0x22cc0f['limit']=qs[_0x3073('0x1e')](_0x1fdbcd['query'][_0x3073('0x1e')]);_0x22cc0f[_0x3073('0x1b')]=qs[_0x3073('0x1b')](_0x1fdbcd[_0x3073('0x2f')][_0x3073('0x1b')]);}_0x22cc0f['order']=qs[_0x3073('0x36')](_0x1fdbcd[_0x3073('0x2f')][_0x3073('0x36')]);_0x22cc0f[_0x3073('0x37')]=qs[_0x3073('0x31')](_[_0x3073('0x38')](_0x1fdbcd[_0x3073('0x2f')],_0x1bc498['filters']),_0x3f9d64);if(_0x1fdbcd[_0x3073('0x2f')][_0x3073('0x39')]){_0x22cc0f[_0x3073('0x37')]=_[_0x3073('0x3a')](_0x22cc0f['where'],{'$or':_['map'](_0x3f9d64,function(_0x53df25){if(_0x53df25[_0x3073('0x2b')]!=='VIRTUAL'){var _0x569153={};_0x569153[_0x53df25[_0x3073('0x26')]]={'$like':'%'+_0x1fdbcd[_0x3073('0x2f')][_0x3073('0x39')]+'%'};return _0x569153;}})});}_0x22cc0f=_['merge']({},_0x22cc0f,_0x1fdbcd[_0x3073('0x3b')]);var _0x4635d8={'where':_0x22cc0f[_0x3073('0x37')]};return db[_0x3073('0x29')]['count'](_0x4635d8)['then'](function(_0x45e63f){_0x5d5dd8[_0x3073('0x1d')]=_0x45e63f;if(_0x1fdbcd[_0x3073('0x2f')][_0x3073('0x3c')]){_0x22cc0f['include']=[{'all':!![]}];}return db[_0x3073('0x29')]['findAll'](_0x22cc0f);})[_0x3073('0x22')](function(_0xa69318){_0x5d5dd8[_0x3073('0x3d')]=_0xa69318;return _0x5d5dd8;})[_0x3073('0x22')](respondWithFilteredResult(_0x484c47,_0x22cc0f))[_0x3073('0x3e')](handleError(_0x484c47,null));};exports['show']=function(_0x5295b4,_0x151f86){var _0x5f2e57={'raw':!![],'where':{'id':_0x5295b4['params']['id']}},_0x54bc1f={};_0x54bc1f[_0x3073('0x2d')]=_[_0x3073('0x30')](db['SquareMessage'][_0x3073('0x2a')]);_0x54bc1f[_0x3073('0x2f')]=_[_0x3073('0x30')](_0x5295b4[_0x3073('0x2f')]);_0x54bc1f[_0x3073('0x31')]=_['intersection'](_0x54bc1f[_0x3073('0x2d')],_0x54bc1f['query']);_0x5f2e57['attributes']=_[_0x3073('0x32')](_0x54bc1f['model'],qs['fields'](_0x5295b4[_0x3073('0x2f')]['fields']));_0x5f2e57[_0x3073('0x33')]=_0x5f2e57['attributes'][_0x3073('0x34')]?_0x5f2e57[_0x3073('0x33')]:_0x54bc1f[_0x3073('0x2d')];if(_0x5295b4[_0x3073('0x2f')][_0x3073('0x3c')]){_0x5f2e57[_0x3073('0x3f')]=[{'all':!![]}];}_0x5f2e57=_[_0x3073('0x3a')]({},_0x5f2e57,_0x5295b4[_0x3073('0x3b')]);return db[_0x3073('0x29')][_0x3073('0x40')](_0x5f2e57)[_0x3073('0x22')](handleEntityNotFound(_0x151f86,null))[_0x3073('0x22')](respondWithResult(_0x151f86,null))[_0x3073('0x3e')](handleError(_0x151f86,null));};exports[_0x3073('0x41')]=function(_0x1885ee,_0x756ff6){return db[_0x3073('0x29')][_0x3073('0x41')](_0x1885ee[_0x3073('0x42')],{})[_0x3073('0x22')](respondWithResult(_0x756ff6,0xc9))['catch'](handleError(_0x756ff6,null));};exports[_0x3073('0x21')]=function(_0xcdd434,_0x329e4a){if(_0xcdd434[_0x3073('0x42')]['id']){delete _0xcdd434[_0x3073('0x42')]['id'];}return db[_0x3073('0x29')]['find']({'where':{'id':_0xcdd434['params']['id']}})['then'](handleEntityNotFound(_0x329e4a,null))['then'](saveUpdates(_0xcdd434['body'],null))['then'](respondWithResult(_0x329e4a,null))[_0x3073('0x3e')](handleError(_0x329e4a,null));};exports[_0x3073('0x23')]=function(_0x4f60a4,_0x2f2830){return db[_0x3073('0x29')][_0x3073('0x40')]({'where':{'id':_0x4f60a4[_0x3073('0x43')]['id']}})[_0x3073('0x22')](handleEntityNotFound(_0x2f2830,null))[_0x3073('0x22')](removeEntity(_0x2f2830,null))[_0x3073('0x3e')](handleError(_0x2f2830,null));}; \ No newline at end of file +var _0xffdd=['jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','destroy','stack','name','send','index','rawAttributes','type','key','query','keys','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filters','filter','merge','map','VIRTUAL','options','SquareMessage','include','findAll','catch','show','params','includeAll','create','body','find','eml-format','rimraf','zip-dir','moment','bluebird','util','path','sox','to-csv','squel','crypto'];(function(_0x2fff83,_0x29d5fe){var _0xa2a722=function(_0x18b6b0){while(--_0x18b6b0){_0x2fff83['push'](_0x2fff83['shift']());}};_0xa2a722(++_0x29d5fe);}(_0xffdd,0x193));var _0xdffd=function(_0x1021ad,_0x322fdf){_0x1021ad=_0x1021ad-0x0;var _0x38dc6c=_0xffdd[_0x1021ad];return _0x38dc6c;};'use strict';var emlformat=require(_0xdffd('0x0'));var rimraf=require(_0xdffd('0x1'));var zipdir=require(_0xdffd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xdffd('0x3'));var BPromise=require(_0xdffd('0x4'));var Mustache=require('mustache');var util=require(_0xdffd('0x5'));var path=require(_0xdffd('0x6'));var sox=require(_0xdffd('0x7'));var csv=require(_0xdffd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xdffd('0x9'));var crypto=require(_0xdffd('0xa'));var jsforce=require(_0xdffd('0xb'));var deskjs=require(_0xdffd('0xc'));var toCsv=require(_0xdffd('0x8'));var querystring=require(_0xdffd('0xd'));var Papa=require(_0xdffd('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xdffd('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdffd('0x10'));var utils=require(_0xdffd('0x11'));var config=require(_0xdffd('0x12'));var licenseUtil=require(_0xdffd('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5a77c0,_0x38f7c0){_0x38f7c0=_0x38f7c0||0xcc;return function(_0x5df90b){if(_0x5df90b){return _0x5a77c0[_0xdffd('0x14')](_0x38f7c0);}return _0x5a77c0[_0xdffd('0x15')](_0x38f7c0)[_0xdffd('0x16')]();};}function respondWithResult(_0x5f4b1f,_0xd83407){_0xd83407=_0xd83407||0xc8;return function(_0x2cf7eb){if(_0x2cf7eb){return _0x5f4b1f[_0xdffd('0x15')](_0xd83407)[_0xdffd('0x17')](_0x2cf7eb);}};}function respondWithFilteredResult(_0x155e89,_0x1436e3){return function(_0xa38188){if(_0xa38188){var _0x5cb5f7=typeof _0x1436e3[_0xdffd('0x18')]==='undefined'&&typeof _0x1436e3[_0xdffd('0x19')]===_0xdffd('0x1a');var _0x2eb70b=_0xa38188['count'];var _0xdcc09f=_0x5cb5f7?0x0:_0x1436e3['offset'];var _0x16a733=_0x5cb5f7?_0xa38188[_0xdffd('0x1b')]:_0x1436e3[_0xdffd('0x18')]+_0x1436e3[_0xdffd('0x19')];var _0x7ee422;if(_0x16a733>=_0x2eb70b){_0x16a733=_0x2eb70b;_0x7ee422=0xc8;}else{_0x7ee422=0xce;}_0x155e89[_0xdffd('0x15')](_0x7ee422);return _0x155e89[_0xdffd('0x1c')]('Content-Range',_0xdcc09f+'-'+_0x16a733+'/'+_0x2eb70b)[_0xdffd('0x17')](_0xa38188);}return null;};}function patchUpdates(_0x4f7eef){return function(_0x3c33b9){try{jsonpatch[_0xdffd('0x1d')](_0x3c33b9,_0x4f7eef,!![]);}catch(_0x4a03fd){return BPromise[_0xdffd('0x1e')](_0x4a03fd);}return _0x3c33b9['save']();};}function saveUpdates(_0x1e2cff,_0xdb4b1){return function(_0x1a8d64){if(_0x1a8d64){return _0x1a8d64[_0xdffd('0x1f')](_0x1e2cff)[_0xdffd('0x20')](function(_0x5a35dd){return _0x5a35dd;});}return null;};}function removeEntity(_0x38ebb2,_0x1a5926){return function(_0x507eca){if(_0x507eca){return _0x507eca[_0xdffd('0x21')]()[_0xdffd('0x20')](function(){_0x38ebb2[_0xdffd('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x324b3e,_0x55140d){return function(_0x13273a){if(!_0x13273a){_0x324b3e[_0xdffd('0x14')](0x194);}return _0x13273a;};}function handleError(_0x33d9a7,_0x30d802){_0x30d802=_0x30d802||0x1f4;return function(_0x2f0c69){logger['error'](_0x2f0c69[_0xdffd('0x22')]);if(_0x2f0c69[_0xdffd('0x23')]){delete _0x2f0c69['name'];}_0x33d9a7[_0xdffd('0x15')](_0x30d802)[_0xdffd('0x24')](_0x2f0c69);};}exports[_0xdffd('0x25')]=function(_0x29d3e5,_0x709ad1){var _0x2b43fb={},_0x1c3289={},_0xd758d5={'count':0x0,'rows':[]};var _0x5bd0e7=_['map'](db['SquareMessage'][_0xdffd('0x26')],function(_0x4d12fd){return{'name':_0x4d12fd['fieldName'],'type':_0x4d12fd[_0xdffd('0x27')][_0xdffd('0x28')]};});_0x1c3289['model']=_['map'](_0x5bd0e7,_0xdffd('0x23'));_0x1c3289[_0xdffd('0x29')]=_[_0xdffd('0x2a')](_0x29d3e5[_0xdffd('0x29')]);_0x1c3289['filters']=_['intersection'](_0x1c3289[_0xdffd('0x2b')],_0x1c3289[_0xdffd('0x29')]);_0x2b43fb['attributes']=_[_0xdffd('0x2c')](_0x1c3289['model'],qs[_0xdffd('0x2d')](_0x29d3e5[_0xdffd('0x29')][_0xdffd('0x2d')]));_0x2b43fb[_0xdffd('0x2e')]=_0x2b43fb['attributes'][_0xdffd('0x2f')]?_0x2b43fb['attributes']:_0x1c3289[_0xdffd('0x2b')];if(!_0x29d3e5['query'][_0xdffd('0x30')](_0xdffd('0x31'))){_0x2b43fb[_0xdffd('0x19')]=qs[_0xdffd('0x19')](_0x29d3e5[_0xdffd('0x29')][_0xdffd('0x19')]);_0x2b43fb[_0xdffd('0x18')]=qs[_0xdffd('0x18')](_0x29d3e5['query']['offset']);}_0x2b43fb['order']=qs[_0xdffd('0x32')](_0x29d3e5[_0xdffd('0x29')][_0xdffd('0x32')]);_0x2b43fb[_0xdffd('0x33')]=qs['filters'](_[_0xdffd('0x34')](_0x29d3e5[_0xdffd('0x29')],_0x1c3289[_0xdffd('0x35')]),_0x5bd0e7);if(_0x29d3e5[_0xdffd('0x29')][_0xdffd('0x36')]){_0x2b43fb[_0xdffd('0x33')]=_[_0xdffd('0x37')](_0x2b43fb[_0xdffd('0x33')],{'$or':_[_0xdffd('0x38')](_0x5bd0e7,function(_0x383e57){if(_0x383e57[_0xdffd('0x27')]!==_0xdffd('0x39')){var _0x409b17={};_0x409b17[_0x383e57[_0xdffd('0x23')]]={'$like':'%'+_0x29d3e5[_0xdffd('0x29')]['filter']+'%'};return _0x409b17;}})});}_0x2b43fb=_[_0xdffd('0x37')]({},_0x2b43fb,_0x29d3e5[_0xdffd('0x3a')]);var _0x34e680={'where':_0x2b43fb[_0xdffd('0x33')]};return db[_0xdffd('0x3b')][_0xdffd('0x1b')](_0x34e680)[_0xdffd('0x20')](function(_0x5c82eb){_0xd758d5['count']=_0x5c82eb;if(_0x29d3e5['query']['includeAll']){_0x2b43fb[_0xdffd('0x3c')]=[{'all':!![]}];}return db[_0xdffd('0x3b')][_0xdffd('0x3d')](_0x2b43fb);})['then'](function(_0x3b29a2){_0xd758d5['rows']=_0x3b29a2;return _0xd758d5;})[_0xdffd('0x20')](respondWithFilteredResult(_0x709ad1,_0x2b43fb))[_0xdffd('0x3e')](handleError(_0x709ad1,null));};exports[_0xdffd('0x3f')]=function(_0x4e8021,_0x11c258){var _0xf48c69={'raw':!![],'where':{'id':_0x4e8021[_0xdffd('0x40')]['id']}},_0x50d676={};_0x50d676[_0xdffd('0x2b')]=_[_0xdffd('0x2a')](db['SquareMessage']['rawAttributes']);_0x50d676[_0xdffd('0x29')]=_[_0xdffd('0x2a')](_0x4e8021[_0xdffd('0x29')]);_0x50d676['filters']=_[_0xdffd('0x2c')](_0x50d676[_0xdffd('0x2b')],_0x50d676[_0xdffd('0x29')]);_0xf48c69['attributes']=_['intersection'](_0x50d676[_0xdffd('0x2b')],qs[_0xdffd('0x2d')](_0x4e8021[_0xdffd('0x29')][_0xdffd('0x2d')]));_0xf48c69[_0xdffd('0x2e')]=_0xf48c69[_0xdffd('0x2e')][_0xdffd('0x2f')]?_0xf48c69['attributes']:_0x50d676[_0xdffd('0x2b')];if(_0x4e8021[_0xdffd('0x29')][_0xdffd('0x41')]){_0xf48c69[_0xdffd('0x3c')]=[{'all':!![]}];}_0xf48c69=_[_0xdffd('0x37')]({},_0xf48c69,_0x4e8021[_0xdffd('0x3a')]);return db[_0xdffd('0x3b')]['find'](_0xf48c69)[_0xdffd('0x20')](handleEntityNotFound(_0x11c258,null))[_0xdffd('0x20')](respondWithResult(_0x11c258,null))['catch'](handleError(_0x11c258,null));};exports[_0xdffd('0x42')]=function(_0x3a9f1f,_0x5b07bb){return db[_0xdffd('0x3b')][_0xdffd('0x42')](_0x3a9f1f[_0xdffd('0x43')],{})['then'](respondWithResult(_0x5b07bb,0xc9))[_0xdffd('0x3e')](handleError(_0x5b07bb,null));};exports['update']=function(_0x3a8de7,_0x4520c3){if(_0x3a8de7[_0xdffd('0x43')]['id']){delete _0x3a8de7[_0xdffd('0x43')]['id'];}return db[_0xdffd('0x3b')]['find']({'where':{'id':_0x3a8de7[_0xdffd('0x40')]['id']}})['then'](handleEntityNotFound(_0x4520c3,null))[_0xdffd('0x20')](saveUpdates(_0x3a8de7['body'],null))[_0xdffd('0x20')](respondWithResult(_0x4520c3,null))[_0xdffd('0x3e')](handleError(_0x4520c3,null));};exports[_0xdffd('0x21')]=function(_0x3c2fb3,_0x4651c5){return db[_0xdffd('0x3b')][_0xdffd('0x44')]({'where':{'id':_0x3c2fb3[_0xdffd('0x40')]['id']}})[_0xdffd('0x20')](handleEntityNotFound(_0x4651c5,null))[_0xdffd('0x20')](removeEntity(_0x4651c5,null))[_0xdffd('0x3e')](handleError(_0x4651c5,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 6ae4f45..6cad390 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 _0x0120=['rimraf','../../config/environment','./squareMessage.attributes','exports','SquareMessage','square_messages','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1fb1c1,_0x4ebe69){var _0x1622df=function(_0x52b793){while(--_0x52b793){_0x1fb1c1['push'](_0x1fb1c1['shift']());}};_0x1622df(++_0x4ebe69);}(_0x0120,0x172));var _0x0012=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x0120[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x0012('0x0'));var util=require('util');var logger=require(_0x0012('0x1'))(_0x0012('0x2'));var moment=require(_0x0012('0x3'));var BPromise=require(_0x0012('0x4'));var rp=require(_0x0012('0x5'));var fs=require('fs');var path=require(_0x0012('0x6'));var rimraf=require(_0x0012('0x7'));var config=require(_0x0012('0x8'));var attributes=require(_0x0012('0x9'));module[_0x0012('0xa')]=function(_0x29448b,_0x1ccb25){return _0x29448b['define'](_0x0012('0xb'),attributes,{'tableName':_0x0012('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0384=['moment','bluebird','rimraf','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','lodash','api'];(function(_0x4a300c,_0xd6e060){var _0x5dcf92=function(_0x2a0e93){while(--_0x2a0e93){_0x4a300c['push'](_0x4a300c['shift']());}};_0x5dcf92(++_0xd6e060);}(_0x0384,0xb2));var _0x4038=function(_0x4a5a2e,_0x521a84){_0x4a5a2e=_0x4a5a2e-0x0;var _0x8040fa=_0x0384[_0x4a5a2e];return _0x8040fa;};'use strict';var _=require(_0x4038('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x4038('0x1'));var moment=require(_0x4038('0x2'));var BPromise=require(_0x4038('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4038('0x4'));var config=require(_0x4038('0x5'));var attributes=require(_0x4038('0x6'));module[_0x4038('0x7')]=function(_0xf481ed,_0x50592a){return _0xf481ed[_0x4038('0x8')](_0x4038('0x9'),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 be34c52..0f3e346 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 _0x2d16=['body','options','raw','then','debug','stringify','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','error','SquareMessage,\x20%s,\x20%s','message','info','CreateSquareMessage','SquareMessage','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2d16,0x166));var _0x62d1=function(_0x244a43,_0x4f7222){_0x244a43=_0x244a43-0x0;var _0x4d1769=_0x2d16[_0x244a43];return _0x4d1769;};'use strict';var _=require('lodash');var util=require(_0x62d1('0x0'));var moment=require(_0x62d1('0x1'));var BPromise=require('bluebird');var rs=require(_0x62d1('0x2'));var fs=require('fs');var Redis=require(_0x62d1('0x3'));var db=require(_0x62d1('0x4'))['db'];var utils=require(_0x62d1('0x5'));var logger=require('../../config/logger')(_0x62d1('0x6'));var config=require(_0x62d1('0x7'));var jayson=require(_0x62d1('0x8'));var client=jayson[_0x62d1('0x9')][_0x62d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4979f9,_0x14ec1d,_0x220905){return new BPromise(function(_0x5c897c,_0x44f152){return client[_0x62d1('0xb')](_0x4979f9,_0x220905)['then'](function(_0x4aaeea){logger['info']('SquareMessage,\x20%s,\x20%s',_0x14ec1d,_0x62d1('0xc'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x14ec1d,_0x62d1('0xc'),JSON['stringify'](_0x4aaeea));if(_0x4aaeea[_0x62d1('0xd')]){if(_0x4aaeea['error']['code']===0x1f4){logger[_0x62d1('0xd')]('SquareMessage,\x20%s,\x20%s',_0x14ec1d,_0x4aaeea[_0x62d1('0xd')]['message']);return _0x44f152(_0x4aaeea['error']['message']);}logger[_0x62d1('0xd')](_0x62d1('0xe'),_0x14ec1d,_0x4aaeea['error'][_0x62d1('0xf')]);return _0x5c897c(_0x4aaeea['error'][_0x62d1('0xf')]);}else{logger[_0x62d1('0x10')](_0x62d1('0xe'),_0x14ec1d,_0x62d1('0xc'));_0x5c897c(_0x4aaeea['result'][_0x62d1('0xf')]);}})['catch'](function(_0x12b0ee){logger[_0x62d1('0xd')](_0x62d1('0xe'),_0x14ec1d,_0x12b0ee);_0x44f152(_0x12b0ee);});});}exports[_0x62d1('0x11')]=function(_0x186451){var _0x2d88fa=this;return new Promise(function(_0x1a3c9a,_0x3bcf56){return db[_0x62d1('0x12')][_0x62d1('0x13')](_0x186451[_0x62d1('0x14')],{'raw':_0x186451[_0x62d1('0x15')]?_0x186451[_0x62d1('0x15')][_0x62d1('0x16')]===undefined?!![]:![]:!![]})[_0x62d1('0x17')](function(_0x5a8490){logger[_0x62d1('0x10')](_0x62d1('0x11'),_0x186451);logger[_0x62d1('0x18')]('CreateSquareMessage',_0x186451,JSON[_0x62d1('0x19')](_0x5a8490));_0x1a3c9a(_0x5a8490);})[_0x62d1('0x1a')](function(_0x314d74){logger[_0x62d1('0xd')](_0x62d1('0x11'),_0x314d74[_0x62d1('0xf')],_0x186451);_0x3bcf56(_0x2d88fa[_0x62d1('0xd')](0x1f4,_0x314d74[_0x62d1('0xf')]));});});}; \ No newline at end of file +var _0x8731=['../../config/environment','jayson/promise','client','request','info','SquareMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','SquareMessage','create','body','options','raw','then','CreateSquareMessage','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x412221,_0x236100){var _0x28c7af=function(_0x5635ee){while(--_0x5635ee){_0x412221['push'](_0x412221['shift']());}};_0x28c7af(++_0x236100);}(_0x8731,0x18e));var _0x1873=function(_0x461fd5,_0x51747e){_0x461fd5=_0x461fd5-0x0;var _0x4e025b=_0x8731[_0x461fd5];return _0x4e025b;};'use strict';var _=require(_0x1873('0x0'));var util=require('util');var moment=require(_0x1873('0x1'));var BPromise=require(_0x1873('0x2'));var rs=require(_0x1873('0x3'));var fs=require('fs');var Redis=require(_0x1873('0x4'));var db=require(_0x1873('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1873('0x6'));var config=require(_0x1873('0x7'));var jayson=require(_0x1873('0x8'));var client=jayson[_0x1873('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b8197,_0x3dfd45,_0x324344){return new BPromise(function(_0x22edeb,_0x20bfd0){return client[_0x1873('0xa')](_0x5b8197,_0x324344)['then'](function(_0x2d6497){logger[_0x1873('0xb')](_0x1873('0xc'),_0x3dfd45,_0x1873('0xd'));logger['debug']('SquareMessage,\x20%s,\x20%s,\x20%s',_0x3dfd45,'request\x20sent',JSON[_0x1873('0xe')](_0x2d6497));if(_0x2d6497[_0x1873('0xf')]){if(_0x2d6497[_0x1873('0xf')][_0x1873('0x10')]===0x1f4){logger[_0x1873('0xf')](_0x1873('0xc'),_0x3dfd45,_0x2d6497[_0x1873('0xf')]['message']);return _0x20bfd0(_0x2d6497[_0x1873('0xf')]['message']);}logger[_0x1873('0xf')](_0x1873('0xc'),_0x3dfd45,_0x2d6497[_0x1873('0xf')]['message']);return _0x22edeb(_0x2d6497[_0x1873('0xf')][_0x1873('0x11')]);}else{logger[_0x1873('0xb')](_0x1873('0xc'),_0x3dfd45,_0x1873('0xd'));_0x22edeb(_0x2d6497[_0x1873('0x12')][_0x1873('0x11')]);}})[_0x1873('0x13')](function(_0x4f24fb){logger[_0x1873('0xf')]('SquareMessage,\x20%s,\x20%s',_0x3dfd45,_0x4f24fb);_0x20bfd0(_0x4f24fb);});});}exports['CreateSquareMessage']=function(_0x1cfe27){var _0x24c5a1=this;return new Promise(function(_0x1cda0a,_0x2deb1e){return db[_0x1873('0x14')][_0x1873('0x15')](_0x1cfe27[_0x1873('0x16')],{'raw':_0x1cfe27['options']?_0x1cfe27[_0x1873('0x17')][_0x1873('0x18')]===undefined?!![]:![]:!![]})[_0x1873('0x19')](function(_0x23c0d1){logger['info'](_0x1873('0x1a'),_0x1cfe27);logger['debug']('CreateSquareMessage',_0x1cfe27,JSON['stringify'](_0x23c0d1));_0x1cda0a(_0x23c0d1);})['catch'](function(_0x3d2bb0){logger[_0x1873('0xf')](_0x1873('0x1a'),_0x3d2bb0[_0x1873('0x11')],_0x1cfe27);_0x2deb1e(_0x24c5a1[_0x1873('0xf')](0x1f4,_0x3d2bb0['message']));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index bbb3601..d8a2ae0 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 _0xcd3c=['put','update','delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','15s','create'];(function(_0xb3bbc8,_0x2a3635){var _0x3254b7=function(_0x823e23){while(--_0x823e23){_0xb3bbc8['push'](_0xb3bbc8['shift']());}};_0x3254b7(++_0x2a3635);}(_0xcd3c,0x12b));var _0xccd3=function(_0x7e6d18,_0x18ef42){_0x7e6d18=_0x7e6d18-0x0;var _0xe547e7=_0xcd3c[_0x7e6d18];return _0xe547e7;};'use strict';var multer=require('multer');var util=require(_0xccd3('0x0'));var path=require(_0xccd3('0x1'));var timeout=require(_0xccd3('0x2'));var express=require('express');var router=express[_0xccd3('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xccd3('0x4'));var interaction=require(_0xccd3('0x5'));var config=require(_0xccd3('0x6'));var controller=require(_0xccd3('0x7'));router[_0xccd3('0x8')]('/',auth[_0xccd3('0x9')](),controller[_0xccd3('0xa')]);router[_0xccd3('0x8')](_0xccd3('0xb'),auth[_0xccd3('0x9')](),controller[_0xccd3('0xc')]);router['get'](_0xccd3('0xd'),auth[_0xccd3('0x9')](),timeout(_0xccd3('0xe')),controller['test']);router['post']('/',auth['isAuthenticated'](),controller[_0xccd3('0xf')]);router[_0xccd3('0x10')](_0xccd3('0xb'),auth[_0xccd3('0x9')](),controller[_0xccd3('0x11')]);router[_0xccd3('0x12')](_0xccd3('0xb'),auth['isAuthenticated'](),controller[_0xccd3('0x13')]);module[_0xccd3('0x14')]=router; \ No newline at end of file +var _0x0d23=['util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','/:id/test','test','post','create','put','update','delete','destroy','multer'];(function(_0x4d211c,_0x51ff78){var _0x58fd52=function(_0x24e62a){while(--_0x24e62a){_0x4d211c['push'](_0x4d211c['shift']());}};_0x58fd52(++_0x51ff78);}(_0x0d23,0xc7));var _0x30d2=function(_0x4e46e7,_0x4bdf26){_0x4e46e7=_0x4e46e7-0x0;var _0x2ecebb=_0x0d23[_0x4e46e7];return _0x2ecebb;};'use strict';var multer=require(_0x30d2('0x0'));var util=require(_0x30d2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x30d2('0x2'));var router=express[_0x30d2('0x3')]();var fs_extra=require(_0x30d2('0x4'));var auth=require(_0x30d2('0x5'));var interaction=require(_0x30d2('0x6'));var config=require(_0x30d2('0x7'));var controller=require('./squareOdbc.controller');router[_0x30d2('0x8')]('/',auth['isAuthenticated'](),controller[_0x30d2('0x9')]);router[_0x30d2('0x8')](_0x30d2('0xa'),auth[_0x30d2('0xb')](),controller['show']);router['get'](_0x30d2('0xc'),auth[_0x30d2('0xb')](),timeout('15s'),controller[_0x30d2('0xd')]);router[_0x30d2('0xe')]('/',auth[_0x30d2('0xb')](),controller[_0x30d2('0xf')]);router[_0x30d2('0x10')]('/:id',auth[_0x30d2('0xb')](),controller[_0x30d2('0x11')]);router[_0x30d2('0x12')](_0x30d2('0xa'),auth['isAuthenticated'](),controller[_0x30d2('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 81ef50e..3c7c1fa 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 _0x6216=['sequelize','exports','STRING','name'];(function(_0x2e34b1,_0x5dba45){var _0x17ef03=function(_0x234a4d){while(--_0x234a4d){_0x2e34b1['push'](_0x2e34b1['shift']());}};_0x17ef03(++_0x5dba45);}(_0x6216,0x124));var _0x6621=function(_0x4bf70d,_0x1cc11c){_0x4bf70d=_0x4bf70d-0x0;var _0x2c2ecf=_0x6216[_0x4bf70d];return _0x2c2ecf;};'use strict';var Sequelize=require(_0x6621('0x0'));module[_0x6621('0x1')]={'name':{'type':Sequelize[_0x6621('0x2')],'unique':_0x6621('0x3'),'allowNull':![]},'dsn':{'type':Sequelize[_0x6621('0x2')]},'description':{'type':Sequelize[_0x6621('0x2')]}}; \ No newline at end of file +var _0xd9e5=['STRING','sequelize','exports'];(function(_0x47f694,_0x2d9fa3){var _0x2f417e=function(_0x531a3b){while(--_0x531a3b){_0x47f694['push'](_0x47f694['shift']());}};_0x2f417e(++_0x2d9fa3);}(_0xd9e5,0x15d));var _0x5d9e=function(_0x946941,_0x28be10){_0x946941=_0x946941-0x0;var _0x1a08fd=_0xd9e5[_0x946941];return _0x1a08fd;};'use strict';var Sequelize=require(_0x5d9e('0x0'));module[_0x5d9e('0x1')]={'name':{'type':Sequelize[_0x5d9e('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x5d9e('0x2')]},'description':{'type':Sequelize[_0x5d9e('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 5c019e1..1156be8 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 _0x1e31=['moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','destroy','then','get','ODBC','end','stack','index','map','SquareOdbc','rawAttributes','fieldName','name','query','keys','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','include','show','params','includeAll','catch','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','update','find','test','dsn','odbc','openSync','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x39f438,_0x8d21a0){var _0x5eec5a=function(_0x183734){while(--_0x183734){_0x39f438['push'](_0x39f438['shift']());}};_0x5eec5a(++_0x8d21a0);}(_0x1e31,0xf8));var _0x11e3=function(_0xd6d705,_0x28b624){_0xd6d705=_0xd6d705-0x0;var _0x4481bd=_0x1e31[_0xd6d705];return _0x4481bd;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x11e3('0x0'));var zipdir=require(_0x11e3('0x1'));var jsonpatch=require(_0x11e3('0x2'));var rp=require(_0x11e3('0x3'));var moment=require(_0x11e3('0x4'));var BPromise=require(_0x11e3('0x5'));var Mustache=require(_0x11e3('0x6'));var util=require(_0x11e3('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x11e3('0x8'));var ejs=require(_0x11e3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11e3('0xa'));var squel=require(_0x11e3('0xb'));var crypto=require(_0x11e3('0xc'));var jsforce=require(_0x11e3('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x11e3('0xe'));var Papa=require(_0x11e3('0xf'));var Redis=require('ioredis');var authService=require(_0x11e3('0x10'));var qs=require(_0x11e3('0x11'));var as=require(_0x11e3('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x11e3('0x13'))('api');var utils=require(_0x11e3('0x14'));var config=require(_0x11e3('0x15'));var licenseUtil=require(_0x11e3('0x16'));var db=require(_0x11e3('0x17'))['db'];function respondWithStatusCode(_0x4bbaa1,_0x54db8f){_0x54db8f=_0x54db8f||0xcc;return function(_0x37f30f){if(_0x37f30f){return _0x4bbaa1[_0x11e3('0x18')](_0x54db8f);}return _0x4bbaa1[_0x11e3('0x19')](_0x54db8f)['end']();};}function respondWithResult(_0x5752f2,_0x423e68){_0x423e68=_0x423e68||0xc8;return function(_0x127ae0){if(_0x127ae0){return _0x5752f2['status'](_0x423e68)[_0x11e3('0x1a')](_0x127ae0);}};}function respondWithFilteredResult(_0x327c43,_0x3c9b28){return function(_0x3b42dc){if(_0x3b42dc){var _0x581442=typeof _0x3c9b28[_0x11e3('0x1b')]===_0x11e3('0x1c')&&typeof _0x3c9b28[_0x11e3('0x1d')]==='undefined';var _0xf7f553=_0x3b42dc[_0x11e3('0x1e')];var _0x5dc48f=_0x581442?0x0:_0x3c9b28[_0x11e3('0x1b')];var _0x1d293e=_0x581442?_0x3b42dc[_0x11e3('0x1e')]:_0x3c9b28['offset']+_0x3c9b28[_0x11e3('0x1d')];var _0x3a5f62;if(_0x1d293e>=_0xf7f553){_0x1d293e=_0xf7f553;_0x3a5f62=0xc8;}else{_0x3a5f62=0xce;}_0x327c43[_0x11e3('0x19')](_0x3a5f62);return _0x327c43[_0x11e3('0x1f')](_0x11e3('0x20'),_0x5dc48f+'-'+_0x1d293e+'/'+_0xf7f553)[_0x11e3('0x1a')](_0x3b42dc);}return null;};}function patchUpdates(_0x3dced1){return function(_0x274ad0){try{jsonpatch['apply'](_0x274ad0,_0x3dced1,!![]);}catch(_0x4b119b){return BPromise[_0x11e3('0x21')](_0x4b119b);}return _0x274ad0['save']();};}function saveUpdates(_0x92a4e3,_0x44a34f){return function(_0x334741){if(_0x334741){return _0x334741['update'](_0x92a4e3)['then'](function(_0x42d8e5){return _0x42d8e5;});}return null;};}function removeEntity(_0x1f89f8,_0x3253d6){return function(_0x3a8fc0){if(_0x3a8fc0){return _0x3a8fc0[_0x11e3('0x22')]()[_0x11e3('0x23')](function(){var _0x41164b=_0x3a8fc0[_0x11e3('0x24')]({'plain':!![]});var _0x3a48f2=_0x11e3('0x25');return db['UserProfileResource'][_0x11e3('0x22')]({'where':{'type':_0x3a48f2,'resourceId':_0x41164b['id']}})['then'](function(){return _0x3a8fc0;});})[_0x11e3('0x23')](function(){_0x1f89f8[_0x11e3('0x19')](0xcc)[_0x11e3('0x26')]();});}};}function handleEntityNotFound(_0x5957e9,_0x3c84eb){return function(_0x5945e5){if(!_0x5945e5){_0x5957e9[_0x11e3('0x18')](0x194);}return _0x5945e5;};}function handleError(_0x5ecf71,_0x1ce19f){_0x1ce19f=_0x1ce19f||0x1f4;return function(_0x89e7bb){logger['error'](_0x89e7bb[_0x11e3('0x27')]);if(_0x89e7bb['name']){delete _0x89e7bb['name'];}_0x5ecf71['status'](_0x1ce19f)['send'](_0x89e7bb);};}exports[_0x11e3('0x28')]=function(_0x5686f6,_0x48781d){var _0x571b30={},_0x85d0a3={},_0x765cc={'count':0x0,'rows':[]};var _0x14ffa8=_[_0x11e3('0x29')](db[_0x11e3('0x2a')][_0x11e3('0x2b')],function(_0x26f212){return{'name':_0x26f212[_0x11e3('0x2c')],'type':_0x26f212['type']['key']};});_0x85d0a3['model']=_['map'](_0x14ffa8,_0x11e3('0x2d'));_0x85d0a3[_0x11e3('0x2e')]=_[_0x11e3('0x2f')](_0x5686f6[_0x11e3('0x2e')]);_0x85d0a3['filters']=_[_0x11e3('0x30')](_0x85d0a3['model'],_0x85d0a3[_0x11e3('0x2e')]);_0x571b30[_0x11e3('0x31')]=_['intersection'](_0x85d0a3[_0x11e3('0x32')],qs[_0x11e3('0x33')](_0x5686f6[_0x11e3('0x2e')][_0x11e3('0x33')]));_0x571b30[_0x11e3('0x31')]=_0x571b30[_0x11e3('0x31')][_0x11e3('0x34')]?_0x571b30['attributes']:_0x85d0a3[_0x11e3('0x32')];if(!_0x5686f6[_0x11e3('0x2e')][_0x11e3('0x35')](_0x11e3('0x36'))){_0x571b30[_0x11e3('0x1d')]=qs['limit'](_0x5686f6[_0x11e3('0x2e')][_0x11e3('0x1d')]);_0x571b30['offset']=qs['offset'](_0x5686f6[_0x11e3('0x2e')][_0x11e3('0x1b')]);}_0x571b30[_0x11e3('0x37')]=qs[_0x11e3('0x38')](_0x5686f6[_0x11e3('0x2e')][_0x11e3('0x38')]);_0x571b30[_0x11e3('0x39')]=qs[_0x11e3('0x3a')](_['pick'](_0x5686f6['query'],_0x85d0a3['filters']),_0x14ffa8);if(_0x5686f6['query'][_0x11e3('0x3b')]){_0x571b30[_0x11e3('0x39')]=_[_0x11e3('0x3c')](_0x571b30[_0x11e3('0x39')],{'$or':_['map'](_0x14ffa8,function(_0x51d481){if(_0x51d481[_0x11e3('0x3d')]!==_0x11e3('0x3e')){var _0x1add9e={};_0x1add9e[_0x51d481[_0x11e3('0x2d')]]={'$like':'%'+_0x5686f6['query'][_0x11e3('0x3b')]+'%'};return _0x1add9e;}})});}_0x571b30=_[_0x11e3('0x3c')]({},_0x571b30,_0x5686f6[_0x11e3('0x3f')]);var _0x129692={'where':_0x571b30['where']};return db[_0x11e3('0x2a')][_0x11e3('0x1e')](_0x129692)['then'](function(_0x3c1f8){_0x765cc[_0x11e3('0x1e')]=_0x3c1f8;if(_0x5686f6[_0x11e3('0x2e')]['includeAll']){_0x571b30[_0x11e3('0x40')]=[{'all':!![]}];}return db['SquareOdbc']['findAll'](_0x571b30);})[_0x11e3('0x23')](function(_0xe9944a){_0x765cc['rows']=_0xe9944a;return _0x765cc;})[_0x11e3('0x23')](respondWithFilteredResult(_0x48781d,_0x571b30))['catch'](handleError(_0x48781d,null));};exports[_0x11e3('0x41')]=function(_0x7ad6c1,_0x4f674f){var _0x5339d7={'raw':!![],'where':{'id':_0x7ad6c1[_0x11e3('0x42')]['id']}},_0x372ff4={};_0x372ff4[_0x11e3('0x32')]=_[_0x11e3('0x2f')](db[_0x11e3('0x2a')][_0x11e3('0x2b')]);_0x372ff4[_0x11e3('0x2e')]=_[_0x11e3('0x2f')](_0x7ad6c1[_0x11e3('0x2e')]);_0x372ff4[_0x11e3('0x3a')]=_[_0x11e3('0x30')](_0x372ff4[_0x11e3('0x32')],_0x372ff4[_0x11e3('0x2e')]);_0x5339d7[_0x11e3('0x31')]=_['intersection'](_0x372ff4[_0x11e3('0x32')],qs[_0x11e3('0x33')](_0x7ad6c1[_0x11e3('0x2e')]['fields']));_0x5339d7[_0x11e3('0x31')]=_0x5339d7[_0x11e3('0x31')][_0x11e3('0x34')]?_0x5339d7[_0x11e3('0x31')]:_0x372ff4[_0x11e3('0x32')];if(_0x7ad6c1['query'][_0x11e3('0x43')]){_0x5339d7[_0x11e3('0x40')]=[{'all':!![]}];}_0x5339d7=_[_0x11e3('0x3c')]({},_0x5339d7,_0x7ad6c1['options']);return db['SquareOdbc']['find'](_0x5339d7)[_0x11e3('0x23')](handleEntityNotFound(_0x4f674f,null))[_0x11e3('0x23')](respondWithResult(_0x4f674f,null))[_0x11e3('0x44')](handleError(_0x4f674f,null));};exports[_0x11e3('0x45')]=function(_0x33910e,_0x54a261){return db[_0x11e3('0x2a')][_0x11e3('0x45')](_0x33910e[_0x11e3('0x46')],{})[_0x11e3('0x23')](function(_0x4c41d1){var _0x153695=_0x33910e[_0x11e3('0x47')][_0x11e3('0x24')]({'plain':!![]});if(!_0x153695)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x153695[_0x11e3('0x48')]===_0x11e3('0x47')){var _0x4ca23b=_0x4c41d1[_0x11e3('0x24')]({'plain':!![]});var _0x574fe7=_0x11e3('0x25');return db[_0x11e3('0x49')]['find']({'where':{'name':_0x574fe7,'userProfileId':_0x153695[_0x11e3('0x4a')]},'raw':!![]})[_0x11e3('0x23')](function(_0x38c3ac){if(_0x38c3ac&&_0x38c3ac[_0x11e3('0x4b')]===0x0){return db[_0x11e3('0x4c')][_0x11e3('0x45')]({'name':_0x4ca23b[_0x11e3('0x2d')],'resourceId':_0x4ca23b['id'],'type':_0x38c3ac[_0x11e3('0x2d')],'sectionId':_0x38c3ac['id']},{})[_0x11e3('0x23')](function(){return _0x4c41d1;});}else{return _0x4c41d1;}})[_0x11e3('0x44')](function(_0xcf201a){logger[_0x11e3('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcf201a);throw _0xcf201a;});}return _0x4c41d1;})['then'](respondWithResult(_0x54a261,0xc9))[_0x11e3('0x44')](handleError(_0x54a261,null));};exports[_0x11e3('0x4e')]=function(_0x2900df,_0x44352f){if(_0x2900df[_0x11e3('0x46')]['id']){delete _0x2900df[_0x11e3('0x46')]['id'];}return db[_0x11e3('0x2a')][_0x11e3('0x4f')]({'where':{'id':_0x2900df[_0x11e3('0x42')]['id']}})[_0x11e3('0x23')](handleEntityNotFound(_0x44352f,null))[_0x11e3('0x23')](saveUpdates(_0x2900df[_0x11e3('0x46')],null))['then'](respondWithResult(_0x44352f,null))[_0x11e3('0x44')](handleError(_0x44352f,null));};exports['destroy']=function(_0x33f402,_0x4e1bd8){return db[_0x11e3('0x2a')][_0x11e3('0x4f')]({'where':{'id':_0x33f402['params']['id']}})[_0x11e3('0x23')](handleEntityNotFound(_0x4e1bd8,null))['then'](removeEntity(_0x4e1bd8,null))[_0x11e3('0x44')](handleError(_0x4e1bd8,null));};exports[_0x11e3('0x50')]=function(_0x1cc243,_0x80a46d,_0x1d9dd7){var _0x4dbf96;return db['SquareOdbc'][_0x11e3('0x4f')]({'where':{'id':_0x1cc243[_0x11e3('0x42')]['id']},'attributes':['id',_0x11e3('0x51')]})['then'](handleEntityNotFound(_0x80a46d,null))[_0x11e3('0x23')](function(_0x394d53){if(_0x394d53){var _0x5a173c=require(_0x11e3('0x52'))();_0x5a173c[_0x11e3('0x53')](_0x394d53[_0x11e3('0x51')]);_0x5a173c['closeSync']();return _0x394d53;}})['then'](respondWithResult(_0x80a46d,null))[_0x11e3('0x44')](handleError(_0x80a46d,null));}; \ No newline at end of file +var _0xeeaa=['where','pick','merge','filter','include','findAll','rows','catch','params','keys','length','includeAll','create','body','user','role','ODBC','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','dsn','odbc','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','save','update','then','get','UserProfileResource','destroy','sendStatus','error','name','send','index','map','SquareOdbc','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','nolimit','order','sort'];(function(_0x11ce46,_0x177a85){var _0x368a1e=function(_0x425454){while(--_0x425454){_0x11ce46['push'](_0x11ce46['shift']());}};_0x368a1e(++_0x177a85);}(_0xeeaa,0x172));var _0xaeea=function(_0x42f9ec,_0x48e1b2){_0x42f9ec=_0x42f9ec-0x0;var _0x2cbbff=_0xeeaa[_0x42f9ec];return _0x2cbbff;};'use strict';var emlformat=require(_0xaeea('0x0'));var rimraf=require(_0xaeea('0x1'));var zipdir=require(_0xaeea('0x2'));var jsonpatch=require(_0xaeea('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaeea('0x4'));var util=require(_0xaeea('0x5'));var path=require(_0xaeea('0x6'));var sox=require(_0xaeea('0x7'));var csv=require('to-csv');var ejs=require(_0xaeea('0x8'));var fs=require('fs');var fs_extra=require(_0xaeea('0x9'));var _=require(_0xaeea('0xa'));var squel=require(_0xaeea('0xb'));var crypto=require(_0xaeea('0xc'));var jsforce=require(_0xaeea('0xd'));var deskjs=require(_0xaeea('0xe'));var toCsv=require(_0xaeea('0xf'));var querystring=require(_0xaeea('0x10'));var Papa=require(_0xaeea('0x11'));var Redis=require(_0xaeea('0x12'));var authService=require(_0xaeea('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xaeea('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xaeea('0x15'))(_0xaeea('0x16'));var utils=require('../../config/utils');var config=require(_0xaeea('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xaeea('0x18'))['db'];function respondWithStatusCode(_0x5128c0,_0x4ebcd0){_0x4ebcd0=_0x4ebcd0||0xcc;return function(_0x187251){if(_0x187251){return _0x5128c0['sendStatus'](_0x4ebcd0);}return _0x5128c0[_0xaeea('0x19')](_0x4ebcd0)[_0xaeea('0x1a')]();};}function respondWithResult(_0x374a97,_0x8af131){_0x8af131=_0x8af131||0xc8;return function(_0x514991){if(_0x514991){return _0x374a97[_0xaeea('0x19')](_0x8af131)['json'](_0x514991);}};}function respondWithFilteredResult(_0x8f03d9,_0x12e6e0){return function(_0x3ba413){if(_0x3ba413){var _0x222bb5=typeof _0x12e6e0[_0xaeea('0x1b')]===_0xaeea('0x1c')&&typeof _0x12e6e0['limit']===_0xaeea('0x1c');var _0x12ebdf=_0x3ba413['count'];var _0x20f304=_0x222bb5?0x0:_0x12e6e0[_0xaeea('0x1b')];var _0x38ba08=_0x222bb5?_0x3ba413[_0xaeea('0x1d')]:_0x12e6e0['offset']+_0x12e6e0[_0xaeea('0x1e')];var _0x6717cf;if(_0x38ba08>=_0x12ebdf){_0x38ba08=_0x12ebdf;_0x6717cf=0xc8;}else{_0x6717cf=0xce;}_0x8f03d9[_0xaeea('0x19')](_0x6717cf);return _0x8f03d9[_0xaeea('0x1f')](_0xaeea('0x20'),_0x20f304+'-'+_0x38ba08+'/'+_0x12ebdf)[_0xaeea('0x21')](_0x3ba413);}return null;};}function patchUpdates(_0x478f97){return function(_0x4ab443){try{jsonpatch[_0xaeea('0x22')](_0x4ab443,_0x478f97,!![]);}catch(_0x1d9658){return BPromise['reject'](_0x1d9658);}return _0x4ab443[_0xaeea('0x23')]();};}function saveUpdates(_0x4b6e0f,_0x252d06){return function(_0x4e7439){if(_0x4e7439){return _0x4e7439[_0xaeea('0x24')](_0x4b6e0f)['then'](function(_0x44f660){return _0x44f660;});}return null;};}function removeEntity(_0x192f5f,_0x58ab66){return function(_0x329dc9){if(_0x329dc9){return _0x329dc9['destroy']()[_0xaeea('0x25')](function(){var _0x4e2b99=_0x329dc9[_0xaeea('0x26')]({'plain':!![]});var _0x21f976='ODBC';return db[_0xaeea('0x27')][_0xaeea('0x28')]({'where':{'type':_0x21f976,'resourceId':_0x4e2b99['id']}})[_0xaeea('0x25')](function(){return _0x329dc9;});})[_0xaeea('0x25')](function(){_0x192f5f['status'](0xcc)[_0xaeea('0x1a')]();});}};}function handleEntityNotFound(_0x535412,_0xb0ce03){return function(_0x4531c8){if(!_0x4531c8){_0x535412[_0xaeea('0x29')](0x194);}return _0x4531c8;};}function handleError(_0x62d924,_0x4aac41){_0x4aac41=_0x4aac41||0x1f4;return function(_0x40b72d){logger[_0xaeea('0x2a')](_0x40b72d['stack']);if(_0x40b72d[_0xaeea('0x2b')]){delete _0x40b72d['name'];}_0x62d924[_0xaeea('0x19')](_0x4aac41)[_0xaeea('0x2c')](_0x40b72d);};}exports[_0xaeea('0x2d')]=function(_0x265f42,_0x554df4){var _0xb45e6b={},_0x145453={},_0x35483e={'count':0x0,'rows':[]};var _0x522942=_[_0xaeea('0x2e')](db[_0xaeea('0x2f')][_0xaeea('0x30')],function(_0x6d0852){return{'name':_0x6d0852['fieldName'],'type':_0x6d0852[_0xaeea('0x31')][_0xaeea('0x32')]};});_0x145453[_0xaeea('0x33')]=_['map'](_0x522942,_0xaeea('0x2b'));_0x145453[_0xaeea('0x34')]=_['keys'](_0x265f42[_0xaeea('0x34')]);_0x145453[_0xaeea('0x35')]=_[_0xaeea('0x36')](_0x145453[_0xaeea('0x33')],_0x145453['query']);_0xb45e6b[_0xaeea('0x37')]=_[_0xaeea('0x36')](_0x145453[_0xaeea('0x33')],qs[_0xaeea('0x38')](_0x265f42[_0xaeea('0x34')][_0xaeea('0x38')]));_0xb45e6b[_0xaeea('0x37')]=_0xb45e6b[_0xaeea('0x37')]['length']?_0xb45e6b['attributes']:_0x145453[_0xaeea('0x33')];if(!_0x265f42[_0xaeea('0x34')]['hasOwnProperty'](_0xaeea('0x39'))){_0xb45e6b[_0xaeea('0x1e')]=qs[_0xaeea('0x1e')](_0x265f42[_0xaeea('0x34')][_0xaeea('0x1e')]);_0xb45e6b[_0xaeea('0x1b')]=qs[_0xaeea('0x1b')](_0x265f42[_0xaeea('0x34')][_0xaeea('0x1b')]);}_0xb45e6b[_0xaeea('0x3a')]=qs[_0xaeea('0x3b')](_0x265f42[_0xaeea('0x34')][_0xaeea('0x3b')]);_0xb45e6b[_0xaeea('0x3c')]=qs['filters'](_[_0xaeea('0x3d')](_0x265f42['query'],_0x145453['filters']),_0x522942);if(_0x265f42[_0xaeea('0x34')]['filter']){_0xb45e6b[_0xaeea('0x3c')]=_[_0xaeea('0x3e')](_0xb45e6b['where'],{'$or':_[_0xaeea('0x2e')](_0x522942,function(_0x1c4e73){if(_0x1c4e73[_0xaeea('0x31')]!=='VIRTUAL'){var _0x2eb838={};_0x2eb838[_0x1c4e73[_0xaeea('0x2b')]]={'$like':'%'+_0x265f42[_0xaeea('0x34')][_0xaeea('0x3f')]+'%'};return _0x2eb838;}})});}_0xb45e6b=_[_0xaeea('0x3e')]({},_0xb45e6b,_0x265f42['options']);var _0x23bbb1={'where':_0xb45e6b['where']};return db[_0xaeea('0x2f')][_0xaeea('0x1d')](_0x23bbb1)[_0xaeea('0x25')](function(_0x3c42cc){_0x35483e[_0xaeea('0x1d')]=_0x3c42cc;if(_0x265f42[_0xaeea('0x34')]['includeAll']){_0xb45e6b[_0xaeea('0x40')]=[{'all':!![]}];}return db[_0xaeea('0x2f')][_0xaeea('0x41')](_0xb45e6b);})[_0xaeea('0x25')](function(_0x4c04ff){_0x35483e[_0xaeea('0x42')]=_0x4c04ff;return _0x35483e;})['then'](respondWithFilteredResult(_0x554df4,_0xb45e6b))[_0xaeea('0x43')](handleError(_0x554df4,null));};exports['show']=function(_0x59204a,_0x1ecf7a){var _0x29a676={'raw':!![],'where':{'id':_0x59204a[_0xaeea('0x44')]['id']}},_0x1b379b={};_0x1b379b['model']=_[_0xaeea('0x45')](db[_0xaeea('0x2f')]['rawAttributes']);_0x1b379b[_0xaeea('0x34')]=_[_0xaeea('0x45')](_0x59204a[_0xaeea('0x34')]);_0x1b379b[_0xaeea('0x35')]=_[_0xaeea('0x36')](_0x1b379b['model'],_0x1b379b[_0xaeea('0x34')]);_0x29a676[_0xaeea('0x37')]=_['intersection'](_0x1b379b['model'],qs[_0xaeea('0x38')](_0x59204a[_0xaeea('0x34')]['fields']));_0x29a676[_0xaeea('0x37')]=_0x29a676[_0xaeea('0x37')][_0xaeea('0x46')]?_0x29a676[_0xaeea('0x37')]:_0x1b379b[_0xaeea('0x33')];if(_0x59204a[_0xaeea('0x34')][_0xaeea('0x47')]){_0x29a676['include']=[{'all':!![]}];}_0x29a676=_['merge']({},_0x29a676,_0x59204a['options']);return db[_0xaeea('0x2f')]['find'](_0x29a676)[_0xaeea('0x25')](handleEntityNotFound(_0x1ecf7a,null))[_0xaeea('0x25')](respondWithResult(_0x1ecf7a,null))[_0xaeea('0x43')](handleError(_0x1ecf7a,null));};exports[_0xaeea('0x48')]=function(_0x471129,_0xebe788){return db[_0xaeea('0x2f')][_0xaeea('0x48')](_0x471129[_0xaeea('0x49')],{})[_0xaeea('0x25')](function(_0x47f1e1){var _0x254708=_0x471129[_0xaeea('0x4a')][_0xaeea('0x26')]({'plain':!![]});if(!_0x254708)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x254708[_0xaeea('0x4b')]===_0xaeea('0x4a')){var _0x3485e3=_0x47f1e1['get']({'plain':!![]});var _0x487189=_0xaeea('0x4c');return db[_0xaeea('0x4d')][_0xaeea('0x4e')]({'where':{'name':_0x487189,'userProfileId':_0x254708[_0xaeea('0x4f')]},'raw':!![]})[_0xaeea('0x25')](function(_0x1da797){if(_0x1da797&&_0x1da797[_0xaeea('0x50')]===0x0){return db[_0xaeea('0x27')][_0xaeea('0x48')]({'name':_0x3485e3[_0xaeea('0x2b')],'resourceId':_0x3485e3['id'],'type':_0x1da797[_0xaeea('0x2b')],'sectionId':_0x1da797['id']},{})[_0xaeea('0x25')](function(){return _0x47f1e1;});}else{return _0x47f1e1;}})['catch'](function(_0x866512){logger['error'](_0xaeea('0x51'),_0x866512);throw _0x866512;});}return _0x47f1e1;})[_0xaeea('0x25')](respondWithResult(_0xebe788,0xc9))[_0xaeea('0x43')](handleError(_0xebe788,null));};exports['update']=function(_0xaba19c,_0x54e70d){if(_0xaba19c[_0xaeea('0x49')]['id']){delete _0xaba19c[_0xaeea('0x49')]['id'];}return db[_0xaeea('0x2f')]['find']({'where':{'id':_0xaba19c[_0xaeea('0x44')]['id']}})[_0xaeea('0x25')](handleEntityNotFound(_0x54e70d,null))[_0xaeea('0x25')](saveUpdates(_0xaba19c[_0xaeea('0x49')],null))['then'](respondWithResult(_0x54e70d,null))[_0xaeea('0x43')](handleError(_0x54e70d,null));};exports[_0xaeea('0x28')]=function(_0x43b0a1,_0x4c577b){return db[_0xaeea('0x2f')]['find']({'where':{'id':_0x43b0a1['params']['id']}})[_0xaeea('0x25')](handleEntityNotFound(_0x4c577b,null))[_0xaeea('0x25')](removeEntity(_0x4c577b,null))[_0xaeea('0x43')](handleError(_0x4c577b,null));};exports[_0xaeea('0x52')]=function(_0x1d9e2a,_0x51201b,_0x4e29ac){var _0x2777e6;return db[_0xaeea('0x2f')]['find']({'where':{'id':_0x1d9e2a[_0xaeea('0x44')]['id']},'attributes':['id',_0xaeea('0x53')]})[_0xaeea('0x25')](handleEntityNotFound(_0x51201b,null))[_0xaeea('0x25')](function(_0xf8ec0f){if(_0xf8ec0f){var _0x3e2818=require(_0xaeea('0x54'))();_0x3e2818['openSync'](_0xf8ec0f[_0xaeea('0x53')]);_0x3e2818[_0xaeea('0x55')]();return _0xf8ec0f;}})[_0xaeea('0x25')](respondWithResult(_0x51201b,null))[_0xaeea('0x43')](handleError(_0x51201b,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 478d5da..a8c92db 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 _0xb8e4=['SquareOdbc','square_odbc','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./squareOdbc.attributes','exports','define'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb8e4,0x1e2));var _0x4b8e=function(_0x214a83,_0x198004){_0x214a83=_0x214a83-0x0;var _0x549ab1=_0xb8e4[_0x214a83];return _0x549ab1;};'use strict';var _=require('lodash');var util=require(_0x4b8e('0x0'));var logger=require(_0x4b8e('0x1'))(_0x4b8e('0x2'));var moment=require(_0x4b8e('0x3'));var BPromise=require(_0x4b8e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4b8e('0x5'));var config=require(_0x4b8e('0x6'));var attributes=require(_0x4b8e('0x7'));module[_0x4b8e('0x8')]=function(_0x24c0be,_0x2e228e){return _0x24c0be[_0x4b8e('0x9')](_0x4b8e('0xa'),attributes,{'tableName':_0x4b8e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc75d=['request-promise','path','./squareOdbc.attributes','exports','define','SquareOdbc','util','../../config/logger','api','moment','bluebird'];(function(_0x173452,_0x3aa870){var _0xee3fd0=function(_0x10eb01){while(--_0x10eb01){_0x173452['push'](_0x173452['shift']());}};_0xee3fd0(++_0x3aa870);}(_0xc75d,0x1a8));var _0xdc75=function(_0x2d6eff,_0x2f9934){_0x2d6eff=_0x2d6eff-0x0;var _0x4d1250=_0xc75d[_0x2d6eff];return _0x4d1250;};'use strict';var _=require('lodash');var util=require(_0xdc75('0x0'));var logger=require(_0xdc75('0x1'))(_0xdc75('0x2'));var moment=require(_0xdc75('0x3'));var BPromise=require(_0xdc75('0x4'));var rp=require(_0xdc75('0x5'));var fs=require('fs');var path=require(_0xdc75('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xdc75('0x7'));module[_0xdc75('0x8')]=function(_0x192680,_0x548e9f){return _0x192680[_0xdc75('0x9')](_0xdc75('0xa'),attributes,{'tableName':'square_odbc','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 3bfadb2..d05f3e6 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 _0x8565=['client','http','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','ShowSquareOdbc','SquareOdbc','find','options','where','attributes','include','map','model','then','lodash','bluebird','randomstring','ioredis','../../mysqldb','jayson/promise'];(function(_0x2b2094,_0x59e69d){var _0x3d56ff=function(_0x138bdf){while(--_0x138bdf){_0x2b2094['push'](_0x2b2094['shift']());}};_0x3d56ff(++_0x59e69d);}(_0x8565,0xc5));var _0x5856=function(_0x34259d,_0x31f72b){_0x34259d=_0x34259d-0x0;var _0x48a15c=_0x8565[_0x34259d];return _0x48a15c;};'use strict';var _=require(_0x5856('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5856('0x1'));var rs=require(_0x5856('0x2'));var fs=require('fs');var Redis=require(_0x5856('0x3'));var db=require(_0x5856('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x5856('0x5'));var client=jayson[_0x5856('0x6')][_0x5856('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x47c114,_0x37410d,_0x401abd){return new BPromise(function(_0x2318f3,_0x2f5e4a){return client['request'](_0x47c114,_0x401abd)['then'](function(_0x5bf948){logger[_0x5856('0x8')](_0x5856('0x9'),_0x37410d,_0x5856('0xa'));logger[_0x5856('0xb')](_0x5856('0xc'),_0x37410d,_0x5856('0xa'),JSON[_0x5856('0xd')](_0x5bf948));if(_0x5bf948['error']){if(_0x5bf948['error'][_0x5856('0xe')]===0x1f4){logger[_0x5856('0xf')](_0x5856('0x9'),_0x37410d,_0x5bf948['error']['message']);return _0x2f5e4a(_0x5bf948['error']['message']);}logger[_0x5856('0xf')](_0x5856('0x9'),_0x37410d,_0x5bf948[_0x5856('0xf')][_0x5856('0x10')]);return _0x2318f3(_0x5bf948[_0x5856('0xf')][_0x5856('0x10')]);}else{logger['info'](_0x5856('0x9'),_0x37410d,_0x5856('0xa'));_0x2318f3(_0x5bf948[_0x5856('0x11')][_0x5856('0x10')]);}})[_0x5856('0x12')](function(_0x52825c){logger[_0x5856('0xf')]('SquareOdbc,\x20%s,\x20%s',_0x37410d,_0x52825c);_0x2f5e4a(_0x52825c);});});}exports[_0x5856('0x13')]=function(_0x4c1029){var _0x886f78=this;return new Promise(function(_0x3b4065,_0x4afccd){return db[_0x5856('0x14')][_0x5856('0x15')]({'raw':_0x4c1029[_0x5856('0x16')]?_0x4c1029[_0x5856('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x4c1029[_0x5856('0x16')]?_0x4c1029[_0x5856('0x16')][_0x5856('0x17')]||null:null,'attributes':_0x4c1029[_0x5856('0x16')]?_0x4c1029[_0x5856('0x16')][_0x5856('0x18')]||null:null,'include':_0x4c1029[_0x5856('0x16')]?_0x4c1029['options'][_0x5856('0x19')]?_[_0x5856('0x1a')](_0x4c1029['options']['include'],function(_0x26f082){return{'model':db[_0x26f082['model']],'as':_0x26f082['as'],'attributes':_0x26f082[_0x5856('0x18')],'include':_0x26f082[_0x5856('0x19')]?_['map'](_0x26f082[_0x5856('0x19')],function(_0x1163c4){return{'model':db[_0x1163c4[_0x5856('0x1b')]],'as':_0x1163c4['as'],'attributes':_0x1163c4[_0x5856('0x18')],'include':_0x1163c4[_0x5856('0x19')]?_[_0x5856('0x1a')](_0x1163c4['include'],function(_0x428562){return{'model':db[_0x428562[_0x5856('0x1b')]],'as':_0x428562['as'],'attributes':_0x428562[_0x5856('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5856('0x1c')](function(_0x24d2fd){logger[_0x5856('0x8')](_0x5856('0x13'),_0x4c1029);logger[_0x5856('0xb')]('ShowSquareOdbc',_0x4c1029,JSON['stringify'](_0x24d2fd));_0x3b4065(_0x24d2fd);})[_0x5856('0x12')](function(_0xa5a0c8){logger[_0x5856('0xf')](_0x5856('0x13'),_0xa5a0c8[_0x5856('0x10')],_0x4c1029);_0x4afccd(_0x886f78[_0x5856('0xf')](0x1f4,_0xa5a0c8['message']));});});}; \ No newline at end of file +var _0xdaae=['lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','error','code','message','info','result','ShowSquareOdbc','SquareOdbc','find','options','raw','attributes','include','map','model','catch'];(function(_0x5d02ab,_0x28f2c7){var _0x2979c0=function(_0x146ba5){while(--_0x146ba5){_0x5d02ab['push'](_0x5d02ab['shift']());}};_0x2979c0(++_0x28f2c7);}(_0xdaae,0xf8));var _0xedaa=function(_0x2b3e7e,_0x37c887){_0x2b3e7e=_0x2b3e7e-0x0;var _0x1e24b2=_0xdaae[_0x2b3e7e];return _0x1e24b2;};'use strict';var _=require(_0xedaa('0x0'));var util=require(_0xedaa('0x1'));var moment=require(_0xedaa('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xedaa('0x3'));var db=require(_0xedaa('0x4'))['db'];var utils=require(_0xedaa('0x5'));var logger=require(_0xedaa('0x6'))(_0xedaa('0x7'));var config=require(_0xedaa('0x8'));var jayson=require(_0xedaa('0x9'));var client=jayson[_0xedaa('0xa')][_0xedaa('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44d79a,_0x165689,_0x24180f){return new BPromise(function(_0x145238,_0x386416){return client['request'](_0x44d79a,_0x24180f)['then'](function(_0x39dbeb){logger['info'](_0xedaa('0xc'),_0x165689,_0xedaa('0xd'));logger[_0xedaa('0xe')](_0xedaa('0xf'),_0x165689,_0xedaa('0xd'),JSON['stringify'](_0x39dbeb));if(_0x39dbeb['error']){if(_0x39dbeb[_0xedaa('0x10')][_0xedaa('0x11')]===0x1f4){logger['error'](_0xedaa('0xc'),_0x165689,_0x39dbeb['error'][_0xedaa('0x12')]);return _0x386416(_0x39dbeb['error'][_0xedaa('0x12')]);}logger[_0xedaa('0x10')](_0xedaa('0xc'),_0x165689,_0x39dbeb[_0xedaa('0x10')][_0xedaa('0x12')]);return _0x145238(_0x39dbeb[_0xedaa('0x10')][_0xedaa('0x12')]);}else{logger[_0xedaa('0x13')](_0xedaa('0xc'),_0x165689,_0xedaa('0xd'));_0x145238(_0x39dbeb[_0xedaa('0x14')][_0xedaa('0x12')]);}})['catch'](function(_0xb19095){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x165689,_0xb19095);_0x386416(_0xb19095);});});}exports[_0xedaa('0x15')]=function(_0x41d15f){var _0x453629=this;return new Promise(function(_0x1a610a,_0x31b805){return db[_0xedaa('0x16')][_0xedaa('0x17')]({'raw':_0x41d15f[_0xedaa('0x18')]?_0x41d15f[_0xedaa('0x18')][_0xedaa('0x19')]===undefined?!![]:![]:!![],'where':_0x41d15f[_0xedaa('0x18')]?_0x41d15f[_0xedaa('0x18')]['where']||null:null,'attributes':_0x41d15f['options']?_0x41d15f[_0xedaa('0x18')][_0xedaa('0x1a')]||null:null,'include':_0x41d15f[_0xedaa('0x18')]?_0x41d15f['options'][_0xedaa('0x1b')]?_[_0xedaa('0x1c')](_0x41d15f[_0xedaa('0x18')][_0xedaa('0x1b')],function(_0x1dbaa6){return{'model':db[_0x1dbaa6['model']],'as':_0x1dbaa6['as'],'attributes':_0x1dbaa6[_0xedaa('0x1a')],'include':_0x1dbaa6[_0xedaa('0x1b')]?_[_0xedaa('0x1c')](_0x1dbaa6['include'],function(_0x3a0f75){return{'model':db[_0x3a0f75[_0xedaa('0x1d')]],'as':_0x3a0f75['as'],'attributes':_0x3a0f75[_0xedaa('0x1a')],'include':_0x3a0f75[_0xedaa('0x1b')]?_[_0xedaa('0x1c')](_0x3a0f75[_0xedaa('0x1b')],function(_0x464286){return{'model':db[_0x464286[_0xedaa('0x1d')]],'as':_0x464286['as'],'attributes':_0x464286[_0xedaa('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x33c35d){logger[_0xedaa('0x13')]('ShowSquareOdbc',_0x41d15f);logger['debug'](_0xedaa('0x15'),_0x41d15f,JSON['stringify'](_0x33c35d));_0x1a610a(_0x33c35d);})[_0xedaa('0x1e')](function(_0x50244d){logger[_0xedaa('0x10')]('ShowSquareOdbc',_0x50244d[_0xedaa('0x12')],_0x41d15f);_0x31b805(_0x453629[_0xedaa('0x10')](0x1f4,_0x50244d[_0xedaa('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 957a29c..aeb7996 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 _0x085c=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path'];(function(_0x21090b,_0x39dd3b){var _0x3c68d7=function(_0x28ecd4){while(--_0x28ecd4){_0x21090b['push'](_0x21090b['shift']());}};_0x3c68d7(++_0x39dd3b);}(_0x085c,0x9d));var _0xc085=function(_0x1142da,_0x4ee9cb){_0x1142da=_0x1142da-0x0;var _0x234ff9=_0x085c[_0x1142da];return _0x234ff9;};'use strict';var multer=require(_0xc085('0x0'));var util=require(_0xc085('0x1'));var path=require(_0xc085('0x2'));var timeout=require(_0xc085('0x3'));var express=require(_0xc085('0x4'));var router=express[_0xc085('0x5')]();var fs_extra=require(_0xc085('0x6'));var auth=require(_0xc085('0x7'));var interaction=require(_0xc085('0x8'));var config=require('../../config/environment');var controller=require('./squareProject.controller');router[_0xc085('0x9')]('/',auth['isAuthenticated'](),controller[_0xc085('0xa')]);router[_0xc085('0x9')](_0xc085('0xb'),auth[_0xc085('0xc')](),controller[_0xc085('0xd')]);router[_0xc085('0xe')]('/',auth['isAuthenticated'](),controller[_0xc085('0xf')]);router[_0xc085('0x10')](_0xc085('0xb'),auth[_0xc085('0xc')](),controller[_0xc085('0x11')]);router['delete']('/:id',auth[_0xc085('0xc')](),controller[_0xc085('0x12')]);module[_0xc085('0x13')]=router; \ No newline at end of file +var _0xb257=['get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller'];(function(_0x54597a,_0x4ea42f){var _0x5a764f=function(_0x5c000b){while(--_0x5c000b){_0x54597a['push'](_0x54597a['shift']());}};_0x5a764f(++_0x4ea42f);}(_0xb257,0x13c));var _0x7b25=function(_0x59dffb,_0x5d27ee){_0x59dffb=_0x59dffb-0x0;var _0x15c9ac=_0xb257[_0x59dffb];return _0x15c9ac;};'use strict';var multer=require(_0x7b25('0x0'));var util=require(_0x7b25('0x1'));var path=require(_0x7b25('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x7b25('0x3'));var auth=require(_0x7b25('0x4'));var interaction=require(_0x7b25('0x5'));var config=require(_0x7b25('0x6'));var controller=require(_0x7b25('0x7'));router[_0x7b25('0x8')]('/',auth[_0x7b25('0x9')](),controller[_0x7b25('0xa')]);router[_0x7b25('0x8')](_0x7b25('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x7b25('0xc')]('/',auth[_0x7b25('0x9')](),controller[_0x7b25('0xd')]);router[_0x7b25('0xe')](_0x7b25('0xb'),auth[_0x7b25('0x9')](),controller[_0x7b25('0xf')]);router[_0x7b25('0x10')](_0x7b25('0xb'),auth[_0x7b25('0x9')](),controller['destroy']);module[_0x7b25('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 3030fd6..fe92557 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 _0xa4a9=['DATE','exports','STRING','name','BLOB','getDataValue','preproduction','utf8','long','production','toString'];(function(_0x49e006,_0x4b8386){var _0x7980c1=function(_0x22d9a5){while(--_0x22d9a5){_0x49e006['push'](_0x49e006['shift']());}};_0x7980c1(++_0x4b8386);}(_0xa4a9,0x7a));var _0x9a4a=function(_0x1af482,_0x1af5b7){_0x1af482=_0x1af482-0x0;var _0x7e7580=_0xa4a9[_0x1af482];return _0x7e7580;};'use strict';var Sequelize=require('sequelize');module[_0x9a4a('0x0')]={'name':{'type':Sequelize[_0x9a4a('0x1')],'unique':_0x9a4a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x9a4a('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x9a4a('0x3')]('long'),'get':function(){if(this[_0x9a4a('0x4')](_0x9a4a('0x5'))){return this[_0x9a4a('0x4')](_0x9a4a('0x5'))['toString'](_0x9a4a('0x6'));}}},'production':{'type':Sequelize['BLOB'](_0x9a4a('0x7')),'get':function(){if(this[_0x9a4a('0x4')](_0x9a4a('0x8'))){return this[_0x9a4a('0x4')](_0x9a4a('0x8'))[_0x9a4a('0x9')](_0x9a4a('0x6'));}}},'savedAt':{'type':Sequelize[_0x9a4a('0xa')]},'publishedAt':{'type':Sequelize[_0x9a4a('0xa')]}}; \ No newline at end of file +var _0x80e6=['BLOB','production','DATE','exports','STRING','TEXT','long','preproduction','getDataValue','toString','utf8'];(function(_0x349d1e,_0x38ebc1){var _0x14cfa3=function(_0x5b71ca){while(--_0x5b71ca){_0x349d1e['push'](_0x349d1e['shift']());}};_0x14cfa3(++_0x38ebc1);}(_0x80e6,0x1e7));var _0x680e=function(_0x4aabcd,_0x20d4e3){_0x4aabcd=_0x4aabcd-0x0;var _0xe5a42b=_0x80e6[_0x4aabcd];return _0xe5a42b;};'use strict';var Sequelize=require('sequelize');module[_0x680e('0x0')]={'name':{'type':Sequelize[_0x680e('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x680e('0x1')]},'notes':{'type':Sequelize[_0x680e('0x2')]},'preproduction':{'type':Sequelize['BLOB'](_0x680e('0x3')),'get':function(){if(this['getDataValue'](_0x680e('0x4'))){return this[_0x680e('0x5')](_0x680e('0x4'))[_0x680e('0x6')](_0x680e('0x7'));}}},'production':{'type':Sequelize[_0x680e('0x8')](_0x680e('0x3')),'get':function(){if(this[_0x680e('0x5')](_0x680e('0x9'))){return this[_0x680e('0x5')](_0x680e('0x9'))[_0x680e('0x6')](_0x680e('0x7'));}}},'savedAt':{'type':Sequelize[_0x680e('0xa')]},'publishedAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index d6549de..0303aea 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 _0x312c=['length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','merge','type','options','SquareProject','includeAll','include','findAll','rows','show','params','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','stringify','production','lodash','../../components/parsers/qs','api','../../config/environment','redis','defaults','socket.io-emitter','./squareProject.socket','status','json','offset','undefined','count','set','Content-Range','update','then','destroy','get','UserProfileResource','publish','agi','end','error','stack','name','send','index','rawAttributes','fieldName','key','model','map','keys','intersection','query','attributes','fields'];(function(_0xd377bb,_0x1a5855){var _0x46dfcc=function(_0x2bac33){while(--_0x2bac33){_0xd377bb['push'](_0xd377bb['shift']());}};_0x46dfcc(++_0x1a5855);}(_0x312c,0x1cb));var _0xc312=function(_0x46f96c,_0x52c349){_0x46f96c=_0x46f96c-0x0;var _0x40e5c3=_0x312c[_0x46f96c];return _0x40e5c3;};'use strict';var _=require(_0xc312('0x0'));var Redis=require('ioredis');var qs=require(_0xc312('0x1'));var logger=require('../../config/logger')(_0xc312('0x2'));var config=require(_0xc312('0x3'));var db=require('../../mysqldb')['db'];config[_0xc312('0x4')]=_[_0xc312('0x5')](config[_0xc312('0x4')],{'host':'localhost','port':0x18eb});var socket=require(_0xc312('0x6'))(new Redis(config[_0xc312('0x4')]));require(_0xc312('0x7'))['register'](socket);function respondWithResult(_0x169418,_0x483f8d){_0x483f8d=_0x483f8d||0xc8;return function(_0xca95a8){if(_0xca95a8){return _0x169418[_0xc312('0x8')](_0x483f8d)[_0xc312('0x9')](_0xca95a8);}};}function respondWithFilteredResult(_0x20493f,_0x551c53){return function(_0x47b93f){if(_0x47b93f){var _0x1177e1=typeof _0x551c53[_0xc312('0xa')]===_0xc312('0xb')&&typeof _0x551c53['limit']===_0xc312('0xb');var _0x47be31=_0x47b93f['count'];var _0x1f0e20=_0x1177e1?0x0:_0x551c53[_0xc312('0xa')];var _0x487811=_0x1177e1?_0x47b93f[_0xc312('0xc')]:_0x551c53[_0xc312('0xa')]+_0x551c53['limit'];var _0x1c5d31;if(_0x487811>=_0x47be31){_0x487811=_0x47be31;_0x1c5d31=0xc8;}else{_0x1c5d31=0xce;}_0x20493f[_0xc312('0x8')](_0x1c5d31);return _0x20493f[_0xc312('0xd')](_0xc312('0xe'),_0x1f0e20+'-'+_0x487811+'/'+_0x47be31)[_0xc312('0x9')](_0x47b93f);}return null;};}function saveUpdates(_0x7d9686){return function(_0x246356){if(_0x246356){return _0x246356[_0xc312('0xf')](_0x7d9686)[_0xc312('0x10')](function(_0x4e5c77){return _0x4e5c77;});}return null;};}function removeEntity(_0x5c2d47){return function(_0x14ce34){if(_0x14ce34){return _0x14ce34[_0xc312('0x11')]()[_0xc312('0x10')](function(){var _0x1f5445=_0x14ce34[_0xc312('0x12')]({'plain':!![]});var _0xcfea22='SquareProjects';return db[_0xc312('0x13')][_0xc312('0x11')]({'where':{'type':_0xcfea22,'resourceId':_0x1f5445['id']}})[_0xc312('0x10')](function(){return _0x14ce34;});})[_0xc312('0x10')](function(){var _0x34b12c=new Redis(config[_0xc312('0x4')]);_0x34b12c[_0xc312('0x14')](_0xc312('0x15'),JSON['stringify']({'id':_0x14ce34['id'],'deleted':!![]}));})[_0xc312('0x10')](function(){_0x5c2d47[_0xc312('0x8')](0xcc)[_0xc312('0x16')]();});}};}function handleEntityNotFound(_0x22855c){return function(_0x15192a){if(!_0x15192a){_0x22855c['sendStatus'](0x194);}return _0x15192a;};}function handleError(_0x41fa18,_0x3d565b){_0x3d565b=_0x3d565b||0x1f4;return function(_0x329189){logger[_0xc312('0x17')](_0x329189[_0xc312('0x18')]);if(_0x329189[_0xc312('0x19')]){delete _0x329189[_0xc312('0x19')];}_0x41fa18[_0xc312('0x8')](_0x3d565b)[_0xc312('0x1a')](_0x329189);};}exports[_0xc312('0x1b')]=function(_0x3e8225,_0x55e9bb){var _0x3324a8={},_0x7f6dd={},_0x3cbbc0={'count':0x0,'rows':[]};var _0x11a06b=_['map'](db['SquareProject'][_0xc312('0x1c')],function(_0x54e6af){return{'name':_0x54e6af[_0xc312('0x1d')],'type':_0x54e6af['type'][_0xc312('0x1e')]};});_0x7f6dd[_0xc312('0x1f')]=_[_0xc312('0x20')](_0x11a06b,_0xc312('0x19'));_0x7f6dd['query']=_[_0xc312('0x21')](_0x3e8225['query']);_0x7f6dd['filters']=_[_0xc312('0x22')](_0x7f6dd['model'],_0x7f6dd[_0xc312('0x23')]);_0x3324a8[_0xc312('0x24')]=_[_0xc312('0x22')](_0x7f6dd[_0xc312('0x1f')],qs[_0xc312('0x25')](_0x3e8225[_0xc312('0x23')][_0xc312('0x25')]));_0x3324a8['attributes']=_0x3324a8[_0xc312('0x24')][_0xc312('0x26')]?_0x3324a8[_0xc312('0x24')]:_0x7f6dd[_0xc312('0x1f')];if(!_0x3e8225['query'][_0xc312('0x27')](_0xc312('0x28'))){_0x3324a8[_0xc312('0x29')]=qs[_0xc312('0x29')](_0x3e8225[_0xc312('0x23')][_0xc312('0x29')]);_0x3324a8['offset']=qs[_0xc312('0xa')](_0x3e8225[_0xc312('0x23')][_0xc312('0xa')]);}_0x3324a8[_0xc312('0x2a')]=qs[_0xc312('0x2b')](_0x3e8225['query'][_0xc312('0x2b')]);_0x3324a8[_0xc312('0x2c')]=qs[_0xc312('0x2d')](_[_0xc312('0x2e')](_0x3e8225[_0xc312('0x23')],_0x7f6dd[_0xc312('0x2d')]),_0x11a06b);if(_0x3e8225[_0xc312('0x23')][_0xc312('0x2f')]){_0x3324a8[_0xc312('0x2c')]=_[_0xc312('0x30')](_0x3324a8[_0xc312('0x2c')],{'$or':_['map'](_0x11a06b,function(_0x305476){if(_0x305476[_0xc312('0x31')]!=='VIRTUAL'){var _0x56034c={};_0x56034c[_0x305476[_0xc312('0x19')]]={'$like':'%'+_0x3e8225[_0xc312('0x23')][_0xc312('0x2f')]+'%'};return _0x56034c;}})});}_0x3324a8=_[_0xc312('0x30')]({},_0x3324a8,_0x3e8225[_0xc312('0x32')]);var _0x373c8b={'where':_0x3324a8[_0xc312('0x2c')]};return db[_0xc312('0x33')][_0xc312('0xc')](_0x373c8b)[_0xc312('0x10')](function(_0x33bfb1){_0x3cbbc0[_0xc312('0xc')]=_0x33bfb1;if(_0x3e8225[_0xc312('0x23')][_0xc312('0x34')]){_0x3324a8[_0xc312('0x35')]=[{'all':!![]}];}return db[_0xc312('0x33')][_0xc312('0x36')](_0x3324a8);})['then'](function(_0x4fde25){_0x3cbbc0[_0xc312('0x37')]=_0x4fde25;return _0x3cbbc0;})[_0xc312('0x10')](respondWithFilteredResult(_0x55e9bb,_0x3324a8))['catch'](handleError(_0x55e9bb,null));};exports[_0xc312('0x38')]=function(_0x40bde4,_0x526b9e){var _0x28746e={'raw':![],'where':{'id':_0x40bde4[_0xc312('0x39')]['id']}},_0xd2e016={};_0xd2e016[_0xc312('0x1f')]=_['keys'](db[_0xc312('0x33')][_0xc312('0x1c')]);_0xd2e016[_0xc312('0x23')]=_[_0xc312('0x21')](_0x40bde4['query']);_0xd2e016[_0xc312('0x2d')]=_[_0xc312('0x22')](_0xd2e016['model'],_0xd2e016['query']);_0x28746e[_0xc312('0x24')]=_['intersection'](_0xd2e016['model'],qs[_0xc312('0x25')](_0x40bde4[_0xc312('0x23')][_0xc312('0x25')]));_0x28746e[_0xc312('0x24')]=_0x28746e['attributes'][_0xc312('0x26')]?_0x28746e[_0xc312('0x24')]:_0xd2e016[_0xc312('0x1f')];if(_0x40bde4[_0xc312('0x23')]['includeAll']){_0x28746e[_0xc312('0x35')]=[{'all':!![]}];}_0x28746e=_['merge']({},_0x28746e,_0x40bde4['options']);return db['SquareProject'][_0xc312('0x3a')](_0x28746e)[_0xc312('0x10')](handleEntityNotFound(_0x526b9e,null))[_0xc312('0x10')](respondWithResult(_0x526b9e,null))[_0xc312('0x3b')](handleError(_0x526b9e,null));};exports[_0xc312('0x3c')]=function(_0x511b46,_0x38037d){return db[_0xc312('0x33')]['create'](_0x511b46[_0xc312('0x3d')],{})['then'](function(_0x1d9ae7){var _0x583d0c=_0x511b46['user'][_0xc312('0x12')]({'plain':!![]});if(!_0x583d0c)throw new Error(_0xc312('0x3e'));if(_0x583d0c[_0xc312('0x3f')]==='user'){var _0x2648ec=_0x1d9ae7[_0xc312('0x12')]({'plain':!![]});var _0x192dd7=_0xc312('0x40');return db[_0xc312('0x41')][_0xc312('0x3a')]({'where':{'name':_0x192dd7,'userProfileId':_0x583d0c[_0xc312('0x42')]},'raw':!![]})['then'](function(_0x3db388){if(_0x3db388&&_0x3db388[_0xc312('0x43')]===0x0){return db['UserProfileResource'][_0xc312('0x3c')]({'name':_0x2648ec[_0xc312('0x19')],'resourceId':_0x2648ec['id'],'type':_0x3db388[_0xc312('0x19')],'sectionId':_0x3db388['id']},{})['then'](function(){return _0x1d9ae7;});}else{return _0x1d9ae7;}})[_0xc312('0x3b')](function(_0x439f65){logger[_0xc312('0x17')](_0xc312('0x44'),_0x439f65);throw _0x439f65;});}return _0x1d9ae7;})[_0xc312('0x10')](respondWithResult(_0x38037d,0xc9))[_0xc312('0x3b')](handleError(_0x38037d,null));};exports[_0xc312('0xf')]=function(_0x3368ca,_0x47cc98){if(_0x3368ca[_0xc312('0x3d')]['id']){delete _0x3368ca['body']['id'];}return db[_0xc312('0x33')]['find']({'where':{'id':_0x3368ca['params']['id']}})[_0xc312('0x10')](handleEntityNotFound(_0x47cc98,null))['then'](saveUpdates(_0x3368ca['body'],null))['then'](function(_0x573e53){if(!_0x573e53)return;var _0x43baea=_0x573e53[_0xc312('0x12')]({'plain':!![]});return _0x43baea;})[_0xc312('0x10')](function(_0x38f794){var _0x1322a0=new Redis(config['redis']);_0x1322a0[_0xc312('0x14')](_0xc312('0x15'),JSON[_0xc312('0x45')](_[_0xc312('0x2e')](_0x38f794,['id',_0xc312('0x19'),_0xc312('0x46')])));return _0x38f794;})[_0xc312('0x10')](respondWithResult(_0x47cc98,null))[_0xc312('0x3b')](handleError(_0x47cc98,null));};exports[_0xc312('0x11')]=function(_0x5c6b90,_0x2e59ea){return db['SquareProject'][_0xc312('0x3a')]({'where':{'id':_0x5c6b90['params']['id']}})[_0xc312('0x10')](handleEntityNotFound(_0x2e59ea,null))[_0xc312('0x10')](removeEntity(_0x2e59ea,null))[_0xc312('0x3b')](handleError(_0x2e59ea,null));}; \ No newline at end of file +var _0x24a3=['agi','stringify','error','stack','name','send','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','SquareProject','includeAll','rows','catch','show','params','rawAttributes','include','create','user','role','SquareProjects','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','production','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./squareProject.socket','register','status','json','undefined','limit','count','offset','set','Content-Range','update','then','get','UserProfileResource','destroy','publish'];(function(_0x532a08,_0x49ce0d){var _0x1706ef=function(_0x47d776){while(--_0x47d776){_0x532a08['push'](_0x532a08['shift']());}};_0x1706ef(++_0x49ce0d);}(_0x24a3,0x17f));var _0x324a=function(_0x288dcc,_0x22eba8){_0x288dcc=_0x288dcc-0x0;var _0x8c3b3d=_0x24a3[_0x288dcc];return _0x8c3b3d;};'use strict';var _=require('lodash');var Redis=require(_0x324a('0x0'));var qs=require(_0x324a('0x1'));var logger=require(_0x324a('0x2'))(_0x324a('0x3'));var config=require(_0x324a('0x4'));var db=require(_0x324a('0x5'))['db'];config[_0x324a('0x6')]=_[_0x324a('0x7')](config[_0x324a('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x324a('0x8'))(new Redis(config['redis']));require(_0x324a('0x9'))[_0x324a('0xa')](socket);function respondWithResult(_0x13b32f,_0x3a7d8c){_0x3a7d8c=_0x3a7d8c||0xc8;return function(_0x53f9c9){if(_0x53f9c9){return _0x13b32f[_0x324a('0xb')](_0x3a7d8c)[_0x324a('0xc')](_0x53f9c9);}};}function respondWithFilteredResult(_0x5e9626,_0x3611ad){return function(_0x23da5c){if(_0x23da5c){var _0x49be01=typeof _0x3611ad['offset']===_0x324a('0xd')&&typeof _0x3611ad[_0x324a('0xe')]===_0x324a('0xd');var _0xf0072d=_0x23da5c['count'];var _0x391a19=_0x49be01?0x0:_0x3611ad['offset'];var _0x505075=_0x49be01?_0x23da5c[_0x324a('0xf')]:_0x3611ad[_0x324a('0x10')]+_0x3611ad['limit'];var _0x4ca720;if(_0x505075>=_0xf0072d){_0x505075=_0xf0072d;_0x4ca720=0xc8;}else{_0x4ca720=0xce;}_0x5e9626[_0x324a('0xb')](_0x4ca720);return _0x5e9626[_0x324a('0x11')](_0x324a('0x12'),_0x391a19+'-'+_0x505075+'/'+_0xf0072d)['json'](_0x23da5c);}return null;};}function saveUpdates(_0x134201){return function(_0x4c26b1){if(_0x4c26b1){return _0x4c26b1[_0x324a('0x13')](_0x134201)[_0x324a('0x14')](function(_0x3bf119){return _0x3bf119;});}return null;};}function removeEntity(_0x67350c){return function(_0x4620b1){if(_0x4620b1){return _0x4620b1['destroy']()[_0x324a('0x14')](function(){var _0x2afd56=_0x4620b1[_0x324a('0x15')]({'plain':!![]});var _0x4efd28='SquareProjects';return db[_0x324a('0x16')][_0x324a('0x17')]({'where':{'type':_0x4efd28,'resourceId':_0x2afd56['id']}})[_0x324a('0x14')](function(){return _0x4620b1;});})[_0x324a('0x14')](function(){var _0x13281d=new Redis(config[_0x324a('0x6')]);_0x13281d[_0x324a('0x18')](_0x324a('0x19'),JSON[_0x324a('0x1a')]({'id':_0x4620b1['id'],'deleted':!![]}));})[_0x324a('0x14')](function(){_0x67350c[_0x324a('0xb')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a9c7a){return function(_0x44658f){if(!_0x44658f){_0x4a9c7a['sendStatus'](0x194);}return _0x44658f;};}function handleError(_0x687585,_0x54bf22){_0x54bf22=_0x54bf22||0x1f4;return function(_0x1f5b66){logger[_0x324a('0x1b')](_0x1f5b66[_0x324a('0x1c')]);if(_0x1f5b66[_0x324a('0x1d')]){delete _0x1f5b66['name'];}_0x687585[_0x324a('0xb')](_0x54bf22)[_0x324a('0x1e')](_0x1f5b66);};}exports['index']=function(_0x17bab5,_0x4a8191){var _0x10abd4={},_0x50038b={},_0x4a0e84={'count':0x0,'rows':[]};var _0x9b41a6=_['map'](db['SquareProject']['rawAttributes'],function(_0x178b33){return{'name':_0x178b33['fieldName'],'type':_0x178b33[_0x324a('0x1f')][_0x324a('0x20')]};});_0x50038b[_0x324a('0x21')]=_[_0x324a('0x22')](_0x9b41a6,_0x324a('0x1d'));_0x50038b[_0x324a('0x23')]=_[_0x324a('0x24')](_0x17bab5[_0x324a('0x23')]);_0x50038b[_0x324a('0x25')]=_[_0x324a('0x26')](_0x50038b[_0x324a('0x21')],_0x50038b[_0x324a('0x23')]);_0x10abd4[_0x324a('0x27')]=_[_0x324a('0x26')](_0x50038b[_0x324a('0x21')],qs[_0x324a('0x28')](_0x17bab5['query']['fields']));_0x10abd4['attributes']=_0x10abd4[_0x324a('0x27')][_0x324a('0x29')]?_0x10abd4[_0x324a('0x27')]:_0x50038b[_0x324a('0x21')];if(!_0x17bab5[_0x324a('0x23')][_0x324a('0x2a')]('nolimit')){_0x10abd4[_0x324a('0xe')]=qs['limit'](_0x17bab5['query'][_0x324a('0xe')]);_0x10abd4['offset']=qs[_0x324a('0x10')](_0x17bab5[_0x324a('0x23')]['offset']);}_0x10abd4[_0x324a('0x2b')]=qs[_0x324a('0x2c')](_0x17bab5['query']['sort']);_0x10abd4[_0x324a('0x2d')]=qs[_0x324a('0x25')](_[_0x324a('0x2e')](_0x17bab5[_0x324a('0x23')],_0x50038b[_0x324a('0x25')]),_0x9b41a6);if(_0x17bab5[_0x324a('0x23')][_0x324a('0x2f')]){_0x10abd4[_0x324a('0x2d')]=_[_0x324a('0x30')](_0x10abd4[_0x324a('0x2d')],{'$or':_[_0x324a('0x22')](_0x9b41a6,function(_0x379291){if(_0x379291[_0x324a('0x1f')]!=='VIRTUAL'){var _0x4805bc={};_0x4805bc[_0x379291['name']]={'$like':'%'+_0x17bab5[_0x324a('0x23')][_0x324a('0x2f')]+'%'};return _0x4805bc;}})});}_0x10abd4=_[_0x324a('0x30')]({},_0x10abd4,_0x17bab5[_0x324a('0x31')]);var _0x1b1f60={'where':_0x10abd4['where']};return db[_0x324a('0x32')][_0x324a('0xf')](_0x1b1f60)[_0x324a('0x14')](function(_0x48817b){_0x4a0e84[_0x324a('0xf')]=_0x48817b;if(_0x17bab5[_0x324a('0x23')][_0x324a('0x33')]){_0x10abd4['include']=[{'all':!![]}];}return db[_0x324a('0x32')]['findAll'](_0x10abd4);})[_0x324a('0x14')](function(_0x4a5661){_0x4a0e84[_0x324a('0x34')]=_0x4a5661;return _0x4a0e84;})[_0x324a('0x14')](respondWithFilteredResult(_0x4a8191,_0x10abd4))[_0x324a('0x35')](handleError(_0x4a8191,null));};exports[_0x324a('0x36')]=function(_0x556ea2,_0x3371ff){var _0x213090={'raw':![],'where':{'id':_0x556ea2[_0x324a('0x37')]['id']}},_0x178ac2={};_0x178ac2[_0x324a('0x21')]=_['keys'](db[_0x324a('0x32')][_0x324a('0x38')]);_0x178ac2['query']=_[_0x324a('0x24')](_0x556ea2['query']);_0x178ac2[_0x324a('0x25')]=_[_0x324a('0x26')](_0x178ac2[_0x324a('0x21')],_0x178ac2[_0x324a('0x23')]);_0x213090['attributes']=_[_0x324a('0x26')](_0x178ac2[_0x324a('0x21')],qs[_0x324a('0x28')](_0x556ea2[_0x324a('0x23')][_0x324a('0x28')]));_0x213090['attributes']=_0x213090[_0x324a('0x27')][_0x324a('0x29')]?_0x213090['attributes']:_0x178ac2[_0x324a('0x21')];if(_0x556ea2[_0x324a('0x23')][_0x324a('0x33')]){_0x213090[_0x324a('0x39')]=[{'all':!![]}];}_0x213090=_[_0x324a('0x30')]({},_0x213090,_0x556ea2['options']);return db[_0x324a('0x32')]['find'](_0x213090)['then'](handleEntityNotFound(_0x3371ff,null))['then'](respondWithResult(_0x3371ff,null))[_0x324a('0x35')](handleError(_0x3371ff,null));};exports[_0x324a('0x3a')]=function(_0x136850,_0x3b8130){return db[_0x324a('0x32')][_0x324a('0x3a')](_0x136850['body'],{})[_0x324a('0x14')](function(_0x2ba844){var _0x2b8832=_0x136850[_0x324a('0x3b')][_0x324a('0x15')]({'plain':!![]});if(!_0x2b8832)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b8832[_0x324a('0x3c')]===_0x324a('0x3b')){var _0x569873=_0x2ba844['get']({'plain':!![]});var _0x213f20=_0x324a('0x3d');return db['UserProfileSection'][_0x324a('0x3e')]({'where':{'name':_0x213f20,'userProfileId':_0x2b8832[_0x324a('0x3f')]},'raw':!![]})[_0x324a('0x14')](function(_0x2aec88){if(_0x2aec88&&_0x2aec88[_0x324a('0x40')]===0x0){return db[_0x324a('0x16')]['create']({'name':_0x569873[_0x324a('0x1d')],'resourceId':_0x569873['id'],'type':_0x2aec88[_0x324a('0x1d')],'sectionId':_0x2aec88['id']},{})[_0x324a('0x14')](function(){return _0x2ba844;});}else{return _0x2ba844;}})[_0x324a('0x35')](function(_0x1363ee){logger[_0x324a('0x1b')](_0x324a('0x41'),_0x1363ee);throw _0x1363ee;});}return _0x2ba844;})['then'](respondWithResult(_0x3b8130,0xc9))[_0x324a('0x35')](handleError(_0x3b8130,null));};exports[_0x324a('0x13')]=function(_0x6c0df8,_0x2031ef){if(_0x6c0df8[_0x324a('0x42')]['id']){delete _0x6c0df8[_0x324a('0x42')]['id'];}return db['SquareProject'][_0x324a('0x3e')]({'where':{'id':_0x6c0df8[_0x324a('0x37')]['id']}})[_0x324a('0x14')](handleEntityNotFound(_0x2031ef,null))[_0x324a('0x14')](saveUpdates(_0x6c0df8['body'],null))[_0x324a('0x14')](function(_0x3143d2){if(!_0x3143d2)return;var _0x116dc0=_0x3143d2[_0x324a('0x15')]({'plain':!![]});return _0x116dc0;})[_0x324a('0x14')](function(_0x29f5bf){var _0x3ddd79=new Redis(config[_0x324a('0x6')]);_0x3ddd79[_0x324a('0x18')](_0x324a('0x19'),JSON[_0x324a('0x1a')](_['pick'](_0x29f5bf,['id',_0x324a('0x1d'),_0x324a('0x43')])));return _0x29f5bf;})[_0x324a('0x14')](respondWithResult(_0x2031ef,null))[_0x324a('0x35')](handleError(_0x2031ef,null));};exports['destroy']=function(_0x4ff7e3,_0x88738b){return db[_0x324a('0x32')]['find']({'where':{'id':_0x4ff7e3[_0x324a('0x37')]['id']}})[_0x324a('0x14')](handleEntityNotFound(_0x88738b,null))['then'](removeEntity(_0x88738b,null))[_0x324a('0x35')](handleError(_0x88738b,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index ac42cf0..0404e70 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 _0x0979=['update','remove','emit','hasOwnProperty','events','../../mysqldb','SquareProject','setMaxListeners','save'];(function(_0x21404a,_0x4fffed){var _0x13ac55=function(_0x1448a5){while(--_0x1448a5){_0x21404a['push'](_0x21404a['shift']());}};_0x13ac55(++_0x4fffed);}(_0x0979,0x11b));var _0x9097=function(_0x77d286,_0x1ddc6d){_0x77d286=_0x77d286-0x0;var _0x5446a5=_0x0979[_0x77d286];return _0x5446a5;};'use strict';var EventEmitter=require(_0x9097('0x0'));var SquareProject=require(_0x9097('0x1'))['db'][_0x9097('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x9097('0x3')](0x0);var events={'afterCreate':_0x9097('0x4'),'afterUpdate':_0x9097('0x5'),'afterDestroy':_0x9097('0x6')};function emitEvent(_0x3fb850){return function(_0x634674,_0x23fe0f,_0x360128){SquareProjectEvents[_0x9097('0x7')](_0x3fb850+':'+_0x634674['id'],_0x634674);SquareProjectEvents[_0x9097('0x7')](_0x3fb850,_0x634674);_0x360128(null);};}for(var e in events){if(events[_0x9097('0x8')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x3394=['hook','events','../../mysqldb','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0xf6fc32,_0x175c5e){var _0x32a988=function(_0x42f16f){while(--_0x42f16f){_0xf6fc32['push'](_0xf6fc32['shift']());}};_0x32a988(++_0x175c5e);}(_0x3394,0x181));var _0x4339=function(_0x5b1c65,_0x3f70ed){_0x5b1c65=_0x5b1c65-0x0;var _0x3e178d=_0x3394[_0x5b1c65];return _0x3e178d;};'use strict';var EventEmitter=require(_0x4339('0x0'));var SquareProject=require(_0x4339('0x1'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x4339('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4339('0x3'),'afterDestroy':_0x4339('0x4')};function emitEvent(_0x14cb30){return function(_0x7ba519,_0x2e41ec,_0x244eb9){SquareProjectEvents['emit'](_0x14cb30+':'+_0x7ba519['id'],_0x7ba519);SquareProjectEvents[_0x4339('0x5')](_0x14cb30,_0x7ba519);_0x244eb9(null);};}for(var e in events){if(events[_0x4339('0x6')](e)){var event=events[e];SquareProject[_0x4339('0x7')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 84f4397..608e677 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 _0x4d2a=['format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./squareProject.attributes','exports','square_projects','changed','preproduction','savedAt'];(function(_0x5248eb,_0x53288a){var _0x326a3a=function(_0x54b6f3){while(--_0x54b6f3){_0x5248eb['push'](_0x5248eb['shift']());}};_0x326a3a(++_0x53288a);}(_0x4d2a,0x17e));var _0xa4d2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4d2a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa4d2('0x0'));var util=require(_0xa4d2('0x1'));var logger=require(_0xa4d2('0x2'))(_0xa4d2('0x3'));var moment=require(_0xa4d2('0x4'));var BPromise=require('bluebird');var rp=require(_0xa4d2('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa4d2('0x6'));var config=require(_0xa4d2('0x7'));var attributes=require(_0xa4d2('0x8'));module[_0xa4d2('0x9')]=function(_0x189b37,_0x1d72dd){return _0x189b37['define']('SquareProject',attributes,{'tableName':_0xa4d2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4e66a8,_0xc0a521,_0x3535fd){if(_0x4e66a8[_0xa4d2('0xb')](_0xa4d2('0xc'))){_0x4e66a8[_0xa4d2('0xd')]=moment()[_0xa4d2('0xe')](_0xa4d2('0xf'));}if(_0x4e66a8[_0xa4d2('0xb')](_0xa4d2('0x10'))){_0x4e66a8[_0xa4d2('0x11')]=moment()[_0xa4d2('0xe')](_0xa4d2('0xf'));}_0x3535fd(null,_0x4e66a8);}}});}; \ No newline at end of file +var _0x70e4=['util','api','moment','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','square_projects','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','production','lodash'];(function(_0x6955fa,_0xfc21ed){var _0x5c0670=function(_0x12317f){while(--_0x12317f){_0x6955fa['push'](_0x6955fa['shift']());}};_0x5c0670(++_0xfc21ed);}(_0x70e4,0xdf));var _0x470e=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x70e4[_0x4b055c];return _0x4b62bb;};'use strict';var _=require(_0x470e('0x0'));var util=require(_0x470e('0x1'));var logger=require('../../config/logger')(_0x470e('0x2'));var moment=require(_0x470e('0x3'));var BPromise=require(_0x470e('0x4'));var rp=require(_0x470e('0x5'));var fs=require('fs');var path=require(_0x470e('0x6'));var rimraf=require('rimraf');var config=require(_0x470e('0x7'));var attributes=require(_0x470e('0x8'));module['exports']=function(_0x25ed8b,_0x24afa1){return _0x25ed8b['define']('SquareProject',attributes,{'tableName':_0x470e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2934a9,_0x4a22fc,_0x183b2c){if(_0x2934a9['changed'](_0x470e('0xa'))){_0x2934a9[_0x470e('0xb')]=moment()[_0x470e('0xc')](_0x470e('0xd'));}if(_0x2934a9[_0x470e('0xe')](_0x470e('0xf'))){_0x2934a9['publishedAt']=moment()[_0x470e('0xc')]('YYYY-MM-DD\x20HH:mm:ss');}_0x183b2c(null,_0x2934a9);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 1803107..8827da4 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 _0xfbda=['attributes','then','info','debug','stringify','error','find','ShowSquareProject','message','lodash','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','./squareProject.socket','register','GetSquareProjects','SquareProject','findAll','options','raw','where','limit','include','map','model'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0xfbda,0xdb));var _0xafbd=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xfbda[_0x1da04e];return _0xdd8c41;};'use strict';var _=require(_0xafbd('0x0'));var Redis=require(_0xafbd('0x1'));var db=require(_0xafbd('0x2'))['db'];var logger=require(_0xafbd('0x3'))(_0xafbd('0x4'));var config=require(_0xafbd('0x5'));config[_0xafbd('0x6')]=_[_0xafbd('0x7')](config[_0xafbd('0x6')],{'host':_0xafbd('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xafbd('0x6')]));require(_0xafbd('0x9'))[_0xafbd('0xa')](socket);exports[_0xafbd('0xb')]=function(_0x295bae){var _0x409a0c=this;return new Promise(function(_0x1e169c,_0x1798e1){return db[_0xafbd('0xc')][_0xafbd('0xd')]({'raw':_0x295bae['options']?_0x295bae[_0xafbd('0xe')][_0xafbd('0xf')]===undefined?!![]:![]:!![],'where':_0x295bae['options']?_0x295bae[_0xafbd('0xe')][_0xafbd('0x10')]||null:null,'attributes':_0x295bae[_0xafbd('0xe')]?_0x295bae[_0xafbd('0xe')]['attributes']||null:null,'limit':_0x295bae[_0xafbd('0xe')]?_0x295bae[_0xafbd('0xe')][_0xafbd('0x11')]||null:null,'include':_0x295bae[_0xafbd('0xe')]?_0x295bae['options'][_0xafbd('0x12')]?_[_0xafbd('0x13')](_0x295bae[_0xafbd('0xe')][_0xafbd('0x12')],function(_0x35c0bf){return{'model':db[_0x35c0bf[_0xafbd('0x14')]],'as':_0x35c0bf['as'],'attributes':_0x35c0bf[_0xafbd('0x15')],'include':_0x35c0bf[_0xafbd('0x12')]?_['map'](_0x35c0bf['include'],function(_0x141ff7){return{'model':db[_0x141ff7[_0xafbd('0x14')]],'as':_0x141ff7['as'],'attributes':_0x141ff7[_0xafbd('0x15')],'include':_0x141ff7['include']?_[_0xafbd('0x13')](_0x141ff7['include'],function(_0x3a1903){return{'model':db[_0x3a1903['model']],'as':_0x3a1903['as'],'attributes':_0x3a1903['attributes']};}):[]};}):[]};}):[]:[]})[_0xafbd('0x16')](function(_0x1eaab4){logger[_0xafbd('0x17')]('GetSquareProjects',_0x295bae);logger[_0xafbd('0x18')](_0xafbd('0xb'),_0x295bae,JSON[_0xafbd('0x19')](_0x1eaab4));_0x1e169c(_0x1eaab4);})['catch'](function(_0x179265){logger[_0xafbd('0x1a')](_0xafbd('0xb'),_0x179265['message'],_0x295bae);_0x1798e1(_0x409a0c['error'](0x1f4,_0x179265['message']));});});};exports['ShowSquareProject']=function(_0x35c2e5){var _0x1eeb35=this;return new Promise(function(_0x1ac78f,_0x2bee5d){return db[_0xafbd('0xc')][_0xafbd('0x1b')]({'raw':_0x35c2e5['options']?_0x35c2e5[_0xafbd('0xe')]['raw']===undefined?!![]:![]:!![],'where':_0x35c2e5[_0xafbd('0xe')]?_0x35c2e5[_0xafbd('0xe')][_0xafbd('0x10')]||null:null,'attributes':_0x35c2e5[_0xafbd('0xe')]?_0x35c2e5['options']['attributes']||null:null,'include':_0x35c2e5[_0xafbd('0xe')]?_0x35c2e5['options'][_0xafbd('0x12')]?_[_0xafbd('0x13')](_0x35c2e5[_0xafbd('0xe')][_0xafbd('0x12')],function(_0x138aff){return{'model':db[_0x138aff[_0xafbd('0x14')]],'as':_0x138aff['as'],'attributes':_0x138aff['attributes'],'include':_0x138aff[_0xafbd('0x12')]?_['map'](_0x138aff[_0xafbd('0x12')],function(_0x5034a5){return{'model':db[_0x5034a5[_0xafbd('0x14')]],'as':_0x5034a5['as'],'attributes':_0x5034a5[_0xafbd('0x15')],'include':_0x5034a5[_0xafbd('0x12')]?_['map'](_0x5034a5[_0xafbd('0x12')],function(_0x560d8f){return{'model':db[_0x560d8f['model']],'as':_0x560d8f['as'],'attributes':_0x560d8f['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xa010ff){logger[_0xafbd('0x17')]('ShowSquareProject',_0x35c2e5);logger[_0xafbd('0x18')](_0xafbd('0x1c'),_0x35c2e5,JSON['stringify'](_0xa010ff));_0x1ac78f(_0xa010ff);})['catch'](function(_0x4cb64e){logger[_0xafbd('0x1a')]('ShowSquareProject',_0x4cb64e[_0xafbd('0x1d')],_0x35c2e5);_0x2bee5d(_0x1eeb35[_0xafbd('0x1a')](0x1f4,_0x4cb64e[_0xafbd('0x1d')]));});});}; \ No newline at end of file +var _0x8ee4=['findAll','options','raw','where','limit','include','map','model','attributes','then','info','debug','catch','error','message','ShowSquareProject','stringify','ioredis','../../mysqldb','../../config/logger','../../config/environment','redis','defaults','localhost','./squareProject.socket','GetSquareProjects','SquareProject'];(function(_0x14b46c,_0x573d42){var _0x437b62=function(_0x7b716a){while(--_0x7b716a){_0x14b46c['push'](_0x14b46c['shift']());}};_0x437b62(++_0x573d42);}(_0x8ee4,0x7d));var _0x48ee=function(_0x2c68e1,_0x4dc473){_0x2c68e1=_0x2c68e1-0x0;var _0x1f1550=_0x8ee4[_0x2c68e1];return _0x1f1550;};'use strict';var _=require('lodash');var Redis=require(_0x48ee('0x0'));var db=require(_0x48ee('0x1'))['db'];var logger=require(_0x48ee('0x2'))('rpc');var config=require(_0x48ee('0x3'));config[_0x48ee('0x4')]=_[_0x48ee('0x5')](config[_0x48ee('0x4')],{'host':_0x48ee('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x48ee('0x4')]));require(_0x48ee('0x7'))['register'](socket);exports[_0x48ee('0x8')]=function(_0x2c8046){var _0x1c8ddc=this;return new Promise(function(_0x4c2da1,_0x4ae808){return db[_0x48ee('0x9')][_0x48ee('0xa')]({'raw':_0x2c8046[_0x48ee('0xb')]?_0x2c8046[_0x48ee('0xb')][_0x48ee('0xc')]===undefined?!![]:![]:!![],'where':_0x2c8046[_0x48ee('0xb')]?_0x2c8046[_0x48ee('0xb')][_0x48ee('0xd')]||null:null,'attributes':_0x2c8046[_0x48ee('0xb')]?_0x2c8046[_0x48ee('0xb')]['attributes']||null:null,'limit':_0x2c8046[_0x48ee('0xb')]?_0x2c8046[_0x48ee('0xb')][_0x48ee('0xe')]||null:null,'include':_0x2c8046[_0x48ee('0xb')]?_0x2c8046[_0x48ee('0xb')][_0x48ee('0xf')]?_[_0x48ee('0x10')](_0x2c8046['options'][_0x48ee('0xf')],function(_0x5d8c02){return{'model':db[_0x5d8c02['model']],'as':_0x5d8c02['as'],'attributes':_0x5d8c02['attributes'],'include':_0x5d8c02[_0x48ee('0xf')]?_[_0x48ee('0x10')](_0x5d8c02['include'],function(_0x115f76){return{'model':db[_0x115f76[_0x48ee('0x11')]],'as':_0x115f76['as'],'attributes':_0x115f76[_0x48ee('0x12')],'include':_0x115f76[_0x48ee('0xf')]?_[_0x48ee('0x10')](_0x115f76['include'],function(_0x3ab862){return{'model':db[_0x3ab862[_0x48ee('0x11')]],'as':_0x3ab862['as'],'attributes':_0x3ab862[_0x48ee('0x12')]};}):[]};}):[]};}):[]:[]})[_0x48ee('0x13')](function(_0xba4335){logger[_0x48ee('0x14')](_0x48ee('0x8'),_0x2c8046);logger[_0x48ee('0x15')](_0x48ee('0x8'),_0x2c8046,JSON['stringify'](_0xba4335));_0x4c2da1(_0xba4335);})[_0x48ee('0x16')](function(_0x1e8a12){logger[_0x48ee('0x17')](_0x48ee('0x8'),_0x1e8a12[_0x48ee('0x18')],_0x2c8046);_0x4ae808(_0x1c8ddc[_0x48ee('0x17')](0x1f4,_0x1e8a12[_0x48ee('0x18')]));});});};exports[_0x48ee('0x19')]=function(_0x4b3cf1){var _0x173f9d=this;return new Promise(function(_0x1ce48e,_0x3a46ae){return db[_0x48ee('0x9')]['find']({'raw':_0x4b3cf1[_0x48ee('0xb')]?_0x4b3cf1['options'][_0x48ee('0xc')]===undefined?!![]:![]:!![],'where':_0x4b3cf1[_0x48ee('0xb')]?_0x4b3cf1[_0x48ee('0xb')][_0x48ee('0xd')]||null:null,'attributes':_0x4b3cf1[_0x48ee('0xb')]?_0x4b3cf1[_0x48ee('0xb')][_0x48ee('0x12')]||null:null,'include':_0x4b3cf1[_0x48ee('0xb')]?_0x4b3cf1['options']['include']?_[_0x48ee('0x10')](_0x4b3cf1[_0x48ee('0xb')]['include'],function(_0x5af453){return{'model':db[_0x5af453[_0x48ee('0x11')]],'as':_0x5af453['as'],'attributes':_0x5af453[_0x48ee('0x12')],'include':_0x5af453['include']?_[_0x48ee('0x10')](_0x5af453[_0x48ee('0xf')],function(_0x1b9570){return{'model':db[_0x1b9570['model']],'as':_0x1b9570['as'],'attributes':_0x1b9570[_0x48ee('0x12')],'include':_0x1b9570['include']?_[_0x48ee('0x10')](_0x1b9570['include'],function(_0x45d1f2){return{'model':db[_0x45d1f2[_0x48ee('0x11')]],'as':_0x45d1f2['as'],'attributes':_0x45d1f2[_0x48ee('0x12')]};}):[]};}):[]};}):[]:[]})[_0x48ee('0x13')](function(_0x176caa){logger[_0x48ee('0x14')](_0x48ee('0x19'),_0x4b3cf1);logger[_0x48ee('0x15')](_0x48ee('0x19'),_0x4b3cf1,JSON[_0x48ee('0x1a')](_0x176caa));_0x1ce48e(_0x176caa);})['catch'](function(_0x4b8940){logger[_0x48ee('0x17')](_0x48ee('0x19'),_0x4b8940[_0x48ee('0x18')],_0x4b3cf1);_0x3a46ae(_0x173f9d[_0x48ee('0x17')](0x1f4,_0x4b8940[_0x48ee('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 98d1514..8398ac9 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 _0xc135=['removeListener','length','squareProject:','save','remove','emit'];(function(_0x20bd7b,_0x29a620){var _0x55a0eb=function(_0x5d948){while(--_0x5d948){_0x20bd7b['push'](_0x20bd7b['shift']());}};_0x55a0eb(++_0x29a620);}(_0xc135,0x189));var _0x5c13=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc135[_0x14add3];return _0x4a174f;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x5c13('0x0'),_0x5c13('0x1'),'update'];function createListener(_0x28268a,_0x16cb34){return function(_0x22ed72){_0x16cb34[_0x5c13('0x2')](_0x28268a,_0x22ed72);};}function removeListener(_0x2e4402,_0x4395d0){return function(){SquareProjectEvents[_0x5c13('0x3')](_0x2e4402,_0x4395d0);};}exports['register']=function(_0x19ec5a){for(var _0x1cf640=0x0,_0x4be116=events[_0x5c13('0x4')];_0x1cf640<_0x4be116;_0x1cf640++){var _0x26bf8d=events[_0x1cf640];var _0x286d09=createListener(_0x5c13('0x5')+_0x26bf8d,_0x19ec5a);SquareProjectEvents['on'](_0x26bf8d,_0x286d09);}}; \ No newline at end of file +var _0xf219=['squareProject:','save','remove','update','removeListener','register','length'];(function(_0x18a79d,_0x57bd2c){var _0x4f8848=function(_0x28af80){while(--_0x28af80){_0x18a79d['push'](_0x18a79d['shift']());}};_0x4f8848(++_0x57bd2c);}(_0xf219,0x12e));var _0x9f21=function(_0x21d3d5,_0x38163c){_0x21d3d5=_0x21d3d5-0x0;var _0xf0057b=_0xf219[_0x21d3d5];return _0xf0057b;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x9f21('0x0'),_0x9f21('0x1'),_0x9f21('0x2')];function createListener(_0x13bfa2,_0x1b083d){return function(_0x1c152a){_0x1b083d['emit'](_0x13bfa2,_0x1c152a);};}function removeListener(_0xea7b62,_0x520493){return function(){SquareProjectEvents[_0x9f21('0x3')](_0xea7b62,_0x520493);};}exports[_0x9f21('0x4')]=function(_0x56a894){for(var _0x38d5e9=0x0,_0x56661a=events[_0x9f21('0x5')];_0x38d5e9<_0x56661a;_0x38d5e9++){var _0x2b9ddf=events[_0x38d5e9];var _0xd15f11=createListener(_0x9f21('0x6')+_0x2b9ddf,_0x56a894);SquareProjectEvents['on'](_0x2b9ddf,_0xd15f11);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index fb5e145..e762b0f 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 _0x5fc3=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','show','/:id/download','download','post','create','put','update','/:id','multer','util','connect-timeout'];(function(_0x1f0977,_0x2d9db6){var _0x3fcee6=function(_0x1bb9cd){while(--_0x1bb9cd){_0x1f0977['push'](_0x1f0977['shift']());}};_0x3fcee6(++_0x2d9db6);}(_0x5fc3,0xa8));var _0x35fc=function(_0x5f1617,_0x46277b){_0x5f1617=_0x5f1617-0x0;var _0x3af5da=_0x5fc3[_0x5f1617];return _0x3af5da;};'use strict';var multer=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var path=require('path');var timeout=require(_0x35fc('0x2'));var express=require(_0x35fc('0x3'));var router=express[_0x35fc('0x4')]();var fs_extra=require(_0x35fc('0x5'));var auth=require(_0x35fc('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x35fc('0x7'));var controller=require(_0x35fc('0x8'));router[_0x35fc('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x35fc('0x9')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0xb')]);router[_0x35fc('0x9')](_0x35fc('0xc'),auth[_0x35fc('0xa')](),controller[_0x35fc('0xd')]);router[_0x35fc('0xe')]('/',auth['isAuthenticated'](),controller[_0x35fc('0xf')]);router[_0x35fc('0x10')]('/:id',auth[_0x35fc('0xa')](),controller[_0x35fc('0x11')]);router['delete'](_0x35fc('0x12'),auth[_0x35fc('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc4aa=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','/:id/download','download','create','put','delete'];(function(_0x52d6d3,_0x58246d){var _0x41ada6=function(_0x1dfcd3){while(--_0x1dfcd3){_0x52d6d3['push'](_0x52d6d3['shift']());}};_0x41ada6(++_0x58246d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0xc4aa[_0x36c5b0];return _0xf19333;};'use strict';var multer=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var path=require(_0xac4a('0x2'));var timeout=require(_0xac4a('0x3'));var express=require(_0xac4a('0x4'));var router=express[_0xac4a('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xac4a('0x6'));var controller=require(_0xac4a('0x7'));router[_0xac4a('0x8')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['show']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xe')]);router[_0xac4a('0xf')]('/:id',auth[_0xac4a('0x9')](),controller['update']);router[_0xac4a('0x10')]('/:id',auth[_0xac4a('0x9')](),controller[_0xac4a('0x11')]);module[_0xac4a('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 0ed1678..f90c363 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 _0xed1f=['lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','substring'];(function(_0x4c6cf0,_0x826f70){var _0x108145=function(_0x299f69){while(--_0x299f69){_0x4c6cf0['push'](_0x4c6cf0['shift']());}};_0x108145(++_0x826f70);}(_0xed1f,0x6a));var _0xfed1=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xed1f[_0x27af45];return _0x18df21;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'uniqueid':{'type':Sequelize[_0xfed1('0x2')]},'callerid':{'type':Sequelize[_0xfed1('0x2')]},'calleridname':{'type':Sequelize[_0xfed1('0x2')]},'context':{'type':Sequelize[_0xfed1('0x2')]},'extension':{'type':Sequelize[_0xfed1('0x2')]},'priority':{'type':Sequelize[_0xfed1('0x2')]},'accountcode':{'type':Sequelize[_0xfed1('0x2')]},'dnid':{'type':Sequelize[_0xfed1('0x2')]},'projectName':{'type':Sequelize[_0xfed1('0x2')]},'saveName':{'type':Sequelize[_0xfed1('0x2')]},'filename':{'type':Sequelize[_0xfed1('0x2')]},'savePath':{'type':Sequelize[_0xfed1('0x2')]},'format':{'type':Sequelize[_0xfed1('0x3')],'get':function(){var _0x612b38='';var _0x2a6082=this[_0xfed1('0x4')]('savePath');if(_0x2a6082){_0x612b38=_0x2a6082[_0xfed1('0x5')](_0x2a6082[_0xfed1('0x6')]('.'));}return _0x612b38;}}}; \ No newline at end of file +var _0x7217=['lastIndexOf','sequelize','STRING','VIRTUAL','getDataValue','savePath','substring'];(function(_0x7fd5df,_0x3d7fd0){var _0x58c1b7=function(_0x2a8766){while(--_0x2a8766){_0x7fd5df['push'](_0x7fd5df['shift']());}};_0x58c1b7(++_0x3d7fd0);}(_0x7217,0x19e));var _0x7721=function(_0x110c3d,_0x12ee06){_0x110c3d=_0x110c3d-0x0;var _0x226d67=_0x7217[_0x110c3d];return _0x226d67;};'use strict';var Sequelize=require(_0x7721('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7721('0x1')]},'callerid':{'type':Sequelize[_0x7721('0x1')]},'calleridname':{'type':Sequelize[_0x7721('0x1')]},'context':{'type':Sequelize[_0x7721('0x1')]},'extension':{'type':Sequelize[_0x7721('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7721('0x1')]},'projectName':{'type':Sequelize[_0x7721('0x1')]},'saveName':{'type':Sequelize[_0x7721('0x1')]},'filename':{'type':Sequelize[_0x7721('0x1')]},'savePath':{'type':Sequelize[_0x7721('0x1')]},'format':{'type':Sequelize[_0x7721('0x2')],'get':function(){var _0x18ab6b='';var _0x21f680=this[_0x7721('0x3')](_0x7721('0x4'));if(_0x21f680){_0x18ab6b=_0x21f680[_0x7721('0x5')](_0x21f680[_0x7721('0x6')]('.'));}return _0x18ab6b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 9db48b7..be9ccaa 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 _0xee2b=['sort','filters','pick','where','type','filter','options','includeAll','include','findAll','rows','catch','params','keys','SquareRecording','rawAttributes','length','find','create','body','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','SquareRecording\x20not\x20found','download','extname','unlink','Not\x20found','isNil','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','destroy','eml-format','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','then','error','stack','name','map','fieldName','key','query','intersection','model','attributes','fields','nolimit','order'];(function(_0x2abaae,_0x1ab6d7){var _0x2c6177=function(_0x2a6f80){while(--_0x2a6f80){_0x2abaae['push'](_0x2abaae['shift']());}};_0x2c6177(++_0x1ab6d7);}(_0xee2b,0x14c));var _0xbee2=function(_0x4d5abb,_0x3b0dbe){_0x4d5abb=_0x4d5abb-0x0;var _0x583b24=_0xee2b[_0x4d5abb];return _0x583b24;};'use strict';var emlformat=require(_0xbee2('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbee2('0x1'));var jsonpatch=require(_0xbee2('0x2'));var rp=require('request-promise');var moment=require(_0xbee2('0x3'));var BPromise=require(_0xbee2('0x4'));var Mustache=require('mustache');var util=require(_0xbee2('0x5'));var path=require(_0xbee2('0x6'));var sox=require('sox');var csv=require(_0xbee2('0x7'));var ejs=require(_0xbee2('0x8'));var fs=require('fs');var fs_extra=require(_0xbee2('0x9'));var _=require(_0xbee2('0xa'));var squel=require(_0xbee2('0xb'));var crypto=require(_0xbee2('0xc'));var jsforce=require(_0xbee2('0xd'));var deskjs=require(_0xbee2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xbee2('0xf'));var Papa=require('papaparse');var Redis=require(_0xbee2('0x10'));var authService=require(_0xbee2('0x11'));var qs=require(_0xbee2('0x12'));var as=require(_0xbee2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbee2('0x14'))('api');var utils=require(_0xbee2('0x15'));var config=require(_0xbee2('0x16'));var licenseUtil=require(_0xbee2('0x17'));var db=require(_0xbee2('0x18'))['db'];function respondWithStatusCode(_0xe991a5,_0x1d8b96){_0x1d8b96=_0x1d8b96||0xcc;return function(_0x4df0bf){if(_0x4df0bf){return _0xe991a5[_0xbee2('0x19')](_0x1d8b96);}return _0xe991a5[_0xbee2('0x1a')](_0x1d8b96)[_0xbee2('0x1b')]();};}function respondWithResult(_0x33b69a,_0x282023){_0x282023=_0x282023||0xc8;return function(_0x577616){if(_0x577616){return _0x33b69a['status'](_0x282023)['json'](_0x577616);}};}function respondWithFilteredResult(_0x3be665,_0xad0286){return function(_0x2f2289){if(_0x2f2289){var _0x36aba0=typeof _0xad0286[_0xbee2('0x1c')]===_0xbee2('0x1d')&&typeof _0xad0286[_0xbee2('0x1e')]===_0xbee2('0x1d');var _0x322b56=_0x2f2289[_0xbee2('0x1f')];var _0x3ae45c=_0x36aba0?0x0:_0xad0286[_0xbee2('0x1c')];var _0x339136=_0x36aba0?_0x2f2289[_0xbee2('0x1f')]:_0xad0286[_0xbee2('0x1c')]+_0xad0286[_0xbee2('0x1e')];var _0x45fee5;if(_0x339136>=_0x322b56){_0x339136=_0x322b56;_0x45fee5=0xc8;}else{_0x45fee5=0xce;}_0x3be665[_0xbee2('0x1a')](_0x45fee5);return _0x3be665[_0xbee2('0x20')](_0xbee2('0x21'),_0x3ae45c+'-'+_0x339136+'/'+_0x322b56)[_0xbee2('0x22')](_0x2f2289);}return null;};}function patchUpdates(_0x4f3dd7){return function(_0x296cba){try{jsonpatch[_0xbee2('0x23')](_0x296cba,_0x4f3dd7,!![]);}catch(_0x7896ea){return BPromise['reject'](_0x7896ea);}return _0x296cba[_0xbee2('0x24')]();};}function saveUpdates(_0x4741cb,_0x121ad0){return function(_0x1fbf74){if(_0x1fbf74){return _0x1fbf74[_0xbee2('0x25')](_0x4741cb)[_0xbee2('0x26')](function(_0x99d104){return _0x99d104;});}return null;};}function removeEntity(_0x4647ec,_0x4a8e37){return function(_0x151e30){if(_0x151e30){return _0x151e30['destroy']()[_0xbee2('0x26')](function(){_0x4647ec[_0xbee2('0x1a')](0xcc)[_0xbee2('0x1b')]();});}};}function handleEntityNotFound(_0x284e0f,_0x4499db){return function(_0x152489){if(!_0x152489){_0x284e0f[_0xbee2('0x19')](0x194);}return _0x152489;};}function handleError(_0x1b3839,_0x173263){_0x173263=_0x173263||0x1f4;return function(_0x228718){logger[_0xbee2('0x27')](_0x228718[_0xbee2('0x28')]);if(_0x228718[_0xbee2('0x29')]){delete _0x228718[_0xbee2('0x29')];}_0x1b3839[_0xbee2('0x1a')](_0x173263)['send'](_0x228718);};}exports['index']=function(_0x44975c,_0x13bb42){var _0x4fc6d7={},_0x12fab2={},_0x1b3f7c={'count':0x0,'rows':[]};var _0x9892f0=_[_0xbee2('0x2a')](db['SquareRecording']['rawAttributes'],function(_0x30bd4e){return{'name':_0x30bd4e[_0xbee2('0x2b')],'type':_0x30bd4e['type'][_0xbee2('0x2c')]};});_0x12fab2['model']=_[_0xbee2('0x2a')](_0x9892f0,_0xbee2('0x29'));_0x12fab2['query']=_['keys'](_0x44975c[_0xbee2('0x2d')]);_0x12fab2['filters']=_[_0xbee2('0x2e')](_0x12fab2[_0xbee2('0x2f')],_0x12fab2[_0xbee2('0x2d')]);_0x4fc6d7[_0xbee2('0x30')]=_[_0xbee2('0x2e')](_0x12fab2[_0xbee2('0x2f')],qs[_0xbee2('0x31')](_0x44975c[_0xbee2('0x2d')][_0xbee2('0x31')]));_0x4fc6d7[_0xbee2('0x30')]=_0x4fc6d7[_0xbee2('0x30')]['length']?_0x4fc6d7['attributes']:_0x12fab2[_0xbee2('0x2f')];if(!_0x44975c['query']['hasOwnProperty'](_0xbee2('0x32'))){_0x4fc6d7[_0xbee2('0x1e')]=qs[_0xbee2('0x1e')](_0x44975c['query']['limit']);_0x4fc6d7[_0xbee2('0x1c')]=qs[_0xbee2('0x1c')](_0x44975c[_0xbee2('0x2d')]['offset']);}_0x4fc6d7[_0xbee2('0x33')]=qs[_0xbee2('0x34')](_0x44975c['query'][_0xbee2('0x34')]);_0x4fc6d7['where']=qs[_0xbee2('0x35')](_[_0xbee2('0x36')](_0x44975c[_0xbee2('0x2d')],_0x12fab2[_0xbee2('0x35')]),_0x9892f0);if(_0x44975c['query']['filter']){_0x4fc6d7[_0xbee2('0x37')]=_['merge'](_0x4fc6d7[_0xbee2('0x37')],{'$or':_[_0xbee2('0x2a')](_0x9892f0,function(_0x163a37){if(_0x163a37[_0xbee2('0x38')]!=='VIRTUAL'){var _0x215d65={};_0x215d65[_0x163a37[_0xbee2('0x29')]]={'$like':'%'+_0x44975c[_0xbee2('0x2d')][_0xbee2('0x39')]+'%'};return _0x215d65;}})});}_0x4fc6d7=_['merge']({},_0x4fc6d7,_0x44975c[_0xbee2('0x3a')]);var _0xbf35e6={'where':_0x4fc6d7[_0xbee2('0x37')]};return db['SquareRecording'][_0xbee2('0x1f')](_0xbf35e6)['then'](function(_0x513ccb){_0x1b3f7c[_0xbee2('0x1f')]=_0x513ccb;if(_0x44975c[_0xbee2('0x2d')][_0xbee2('0x3b')]){_0x4fc6d7[_0xbee2('0x3c')]=[{'all':!![]}];}return db['SquareRecording'][_0xbee2('0x3d')](_0x4fc6d7);})['then'](function(_0x315d6d){_0x1b3f7c[_0xbee2('0x3e')]=_0x315d6d;return _0x1b3f7c;})['then'](respondWithFilteredResult(_0x13bb42,_0x4fc6d7))[_0xbee2('0x3f')](handleError(_0x13bb42,null));};exports['show']=function(_0x9df1e,_0x52b6e0){var _0x573cb2={'raw':!![],'where':{'id':_0x9df1e[_0xbee2('0x40')]['id']}},_0x182af9={};_0x182af9['model']=_[_0xbee2('0x41')](db[_0xbee2('0x42')][_0xbee2('0x43')]);_0x182af9[_0xbee2('0x2d')]=_['keys'](_0x9df1e[_0xbee2('0x2d')]);_0x182af9[_0xbee2('0x35')]=_[_0xbee2('0x2e')](_0x182af9[_0xbee2('0x2f')],_0x182af9['query']);_0x573cb2[_0xbee2('0x30')]=_[_0xbee2('0x2e')](_0x182af9[_0xbee2('0x2f')],qs[_0xbee2('0x31')](_0x9df1e[_0xbee2('0x2d')]['fields']));_0x573cb2[_0xbee2('0x30')]=_0x573cb2[_0xbee2('0x30')][_0xbee2('0x44')]?_0x573cb2['attributes']:_0x182af9[_0xbee2('0x2f')];if(_0x9df1e[_0xbee2('0x2d')][_0xbee2('0x3b')]){_0x573cb2[_0xbee2('0x3c')]=[{'all':!![]}];}_0x573cb2=_['merge']({},_0x573cb2,_0x9df1e[_0xbee2('0x3a')]);return db[_0xbee2('0x42')][_0xbee2('0x45')](_0x573cb2)[_0xbee2('0x26')](handleEntityNotFound(_0x52b6e0,null))['then'](respondWithResult(_0x52b6e0,null))[_0xbee2('0x3f')](handleError(_0x52b6e0,null));};exports[_0xbee2('0x46')]=function(_0x59e5f8,_0x42753b){return db[_0xbee2('0x42')][_0xbee2('0x46')](_0x59e5f8[_0xbee2('0x47')],{})['then'](respondWithResult(_0x42753b,0xc9))[_0xbee2('0x3f')](handleError(_0x42753b,null));};exports[_0xbee2('0x25')]=function(_0x4a3d04,_0x4b2f58){if(_0x4a3d04[_0xbee2('0x47')]['id']){delete _0x4a3d04[_0xbee2('0x47')]['id'];}return db[_0xbee2('0x42')]['find']({'where':{'id':_0x4a3d04[_0xbee2('0x40')]['id']}})[_0xbee2('0x26')](handleEntityNotFound(_0x4b2f58,null))[_0xbee2('0x26')](saveUpdates(_0x4a3d04[_0xbee2('0x47')],null))[_0xbee2('0x26')](respondWithResult(_0x4b2f58,null))['catch'](handleError(_0x4b2f58,null));};exports['download']=function(_0x54a77c,_0x403689,_0x43b2f8){var _0x15da11=require(_0xbee2('0x48'));var _0x1ed377=![];var _0x2a09f4={};if(_0x54a77c[_0xbee2('0x2d')][_0xbee2('0x38')]&&_0x54a77c[_0xbee2('0x2d')][_0xbee2('0x38')]===_0xbee2('0x49')){_0x2a09f4[_0xbee2('0x49')]=_0x54a77c[_0xbee2('0x40')]['id'];}else{_0x2a09f4['id']=_0x54a77c['params']['id'];}return db[_0xbee2('0x42')][_0xbee2('0x45')]({'where':_0x2a09f4,'attributes':['id',_0xbee2('0x4a'),_0xbee2('0x4b')],'raw':!![]})[_0xbee2('0x26')](handleEntityNotFound(_0x403689,null))[_0xbee2('0x26')](function(_0x4be840){if(_0x4be840){var _0x583929=_0x4be840[_0xbee2('0x4a')];var _0x4db124=util[_0xbee2('0x4c')](_0xbee2('0x4d'),_0x583929);if(fs['existsSync'](_0x4db124)){_0x1ed377=!![];return _0x15da11[_0xbee2('0x4e')](_0x4db124,_0x583929,config[_0xbee2('0x4f')][_0xbee2('0x50')])[_0xbee2('0x26')](function(){return _0x4be840;});}return _0x4be840;}})['then'](function(_0x5ddf92){if(_0x5ddf92){var _0x545b05=_0x5ddf92[_0xbee2('0x4a')];if(!fs[_0xbee2('0x51')](_0x545b05)){throw new db[(_0xbee2('0x52'))]['ValidationError'](_0xbee2('0x53'));}if(_0x5ddf92[_0xbee2('0x4b')]){return _0x403689[_0xbee2('0x54')](_0x545b05,_0x5ddf92[_0xbee2('0x4b')]+path[_0xbee2('0x55')](_0x545b05),function(){if(_0x1ed377){fs[_0xbee2('0x56')](_0x545b05);}});}else{return _0x403689[_0xbee2('0x54')](_0x545b05,function(_0x387cd4){if(_0x1ed377){fs['unlink'](_0x545b05);}});}}})[_0xbee2('0x3f')](function(_0x3cee8d){if(_0x3cee8d['message']===_0xbee2('0x53')){_0x403689['status'](0x194)['send'](_0xbee2('0x57'));}else{return handleError(_0x403689,null);}});};exports['destroy']=function(_0x1be912,_0xd18bd3){return db['SquareRecording']['find']({'where':{'id':_0x1be912['params']['id']}})[_0xbee2('0x26')](function(_0xff6444){if(_[_0xbee2('0x58')](_0xff6444)){throw new ReferenceError('Entity\x20not\x20found');}return _0xff6444;})[_0xbee2('0x26')](function(_0x1f8006){var _0x2ef053=_0x1f8006[_0xbee2('0x4a')];logger[_0xbee2('0x59')](_0xbee2('0x5a'),_0x2ef053);if(!_['isNil'](_0x1f8006[_0xbee2('0x4a')])&&fs[_0xbee2('0x51')](_0x2ef053)){logger[_0xbee2('0x59')](_0xbee2('0x5b')+_0x2ef053+_0xbee2('0x5c'));fs['unlinkSync'](_0x2ef053);}_0x2ef053=_0x2ef053+_0xbee2('0x5d');if(!_['isNil'](_0x1f8006[_0xbee2('0x4a')])&&fs[_0xbee2('0x51')](_0x2ef053)){logger[_0xbee2('0x59')]('File:\x20\x22'+_0x2ef053+_0xbee2('0x5c'));fs[_0xbee2('0x5e')](_0x2ef053);}return _0x1f8006;})[_0xbee2('0x26')](function(_0x225552){if(!_0x225552)throw new InternalError();return _0x225552[_0xbee2('0x5f')]();})[_0xbee2('0x26')](function(){_0xd18bd3[_0xbee2('0x1a')](0xcc)[_0xbee2('0x1b')]();})[_0xbee2('0x3f')](handleError(_0xd18bd3,null));}; \ No newline at end of file +var _0x902d=['recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','download','extname','unlink','message','Not\x20found','Entity\x20not\x20found','isNil','info','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','stack','name','send','map','SquareRecording','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','rows','catch','params','create','body','find','../../components/encryptor','type','uniqueid','savePath','filename','format','%s.cypher','existsSync','decryptFile','secrets'];(function(_0x5bb568,_0x1d3159){var _0x2f6e0d=function(_0x2033a0){while(--_0x2033a0){_0x5bb568['push'](_0x5bb568['shift']());}};_0x2f6e0d(++_0x1d3159);}(_0x902d,0x1a0));var _0xd902=function(_0x479904,_0x70604c){_0x479904=_0x479904-0x0;var _0x160af4=_0x902d[_0x479904];return _0x160af4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd902('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd902('0x1'));var rp=require(_0xd902('0x2'));var moment=require(_0xd902('0x3'));var BPromise=require(_0xd902('0x4'));var Mustache=require('mustache');var util=require(_0xd902('0x5'));var path=require(_0xd902('0x6'));var sox=require(_0xd902('0x7'));var csv=require('to-csv');var ejs=require(_0xd902('0x8'));var fs=require('fs');var fs_extra=require(_0xd902('0x9'));var _=require(_0xd902('0xa'));var squel=require(_0xd902('0xb'));var crypto=require('crypto');var jsforce=require(_0xd902('0xc'));var deskjs=require(_0xd902('0xd'));var toCsv=require(_0xd902('0xe'));var querystring=require(_0xd902('0xf'));var Papa=require(_0xd902('0x10'));var Redis=require(_0xd902('0x11'));var authService=require(_0xd902('0x12'));var qs=require(_0xd902('0x13'));var as=require(_0xd902('0x14'));var hardwareService=require(_0xd902('0x15'));var logger=require(_0xd902('0x16'))('api');var utils=require(_0xd902('0x17'));var config=require(_0xd902('0x18'));var licenseUtil=require(_0xd902('0x19'));var db=require(_0xd902('0x1a'))['db'];function respondWithStatusCode(_0x33be3d,_0x4cae0a){_0x4cae0a=_0x4cae0a||0xcc;return function(_0x55ea53){if(_0x55ea53){return _0x33be3d[_0xd902('0x1b')](_0x4cae0a);}return _0x33be3d[_0xd902('0x1c')](_0x4cae0a)[_0xd902('0x1d')]();};}function respondWithResult(_0x4ea5ab,_0x591c37){_0x591c37=_0x591c37||0xc8;return function(_0x40adb5){if(_0x40adb5){return _0x4ea5ab[_0xd902('0x1c')](_0x591c37)[_0xd902('0x1e')](_0x40adb5);}};}function respondWithFilteredResult(_0x53a15c,_0x829063){return function(_0x40d3f8){if(_0x40d3f8){var _0x54fe38=typeof _0x829063[_0xd902('0x1f')]===_0xd902('0x20')&&typeof _0x829063['limit']===_0xd902('0x20');var _0x3e1aa3=_0x40d3f8[_0xd902('0x21')];var _0x4d738b=_0x54fe38?0x0:_0x829063[_0xd902('0x1f')];var _0x1656aa=_0x54fe38?_0x40d3f8['count']:_0x829063['offset']+_0x829063['limit'];var _0x27bf26;if(_0x1656aa>=_0x3e1aa3){_0x1656aa=_0x3e1aa3;_0x27bf26=0xc8;}else{_0x27bf26=0xce;}_0x53a15c[_0xd902('0x1c')](_0x27bf26);return _0x53a15c[_0xd902('0x22')]('Content-Range',_0x4d738b+'-'+_0x1656aa+'/'+_0x3e1aa3)[_0xd902('0x1e')](_0x40d3f8);}return null;};}function patchUpdates(_0x98b96b){return function(_0x5071c9){try{jsonpatch[_0xd902('0x23')](_0x5071c9,_0x98b96b,!![]);}catch(_0x3f5baa){return BPromise[_0xd902('0x24')](_0x3f5baa);}return _0x5071c9[_0xd902('0x25')]();};}function saveUpdates(_0x57df23,_0x28c3d0){return function(_0x326cb0){if(_0x326cb0){return _0x326cb0[_0xd902('0x26')](_0x57df23)[_0xd902('0x27')](function(_0x38a63d){return _0x38a63d;});}return null;};}function removeEntity(_0x3a6c6e,_0x48326a){return function(_0xc2cfb5){if(_0xc2cfb5){return _0xc2cfb5[_0xd902('0x28')]()[_0xd902('0x27')](function(){_0x3a6c6e[_0xd902('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f485,_0x22e2ba){return function(_0x41c717){if(!_0x41c717){_0x11f485[_0xd902('0x1b')](0x194);}return _0x41c717;};}function handleError(_0xa91877,_0x318de0){_0x318de0=_0x318de0||0x1f4;return function(_0x171620){logger['error'](_0x171620[_0xd902('0x29')]);if(_0x171620[_0xd902('0x2a')]){delete _0x171620[_0xd902('0x2a')];}_0xa91877[_0xd902('0x1c')](_0x318de0)[_0xd902('0x2b')](_0x171620);};}exports['index']=function(_0xcaad36,_0x3312c8){var _0x624d84={},_0x446af9={},_0x14b414={'count':0x0,'rows':[]};var _0x152d39=_[_0xd902('0x2c')](db[_0xd902('0x2d')][_0xd902('0x2e')],function(_0x30e2f5){return{'name':_0x30e2f5[_0xd902('0x2f')],'type':_0x30e2f5['type'][_0xd902('0x30')]};});_0x446af9[_0xd902('0x31')]=_['map'](_0x152d39,_0xd902('0x2a'));_0x446af9['query']=_[_0xd902('0x32')](_0xcaad36[_0xd902('0x33')]);_0x446af9[_0xd902('0x34')]=_[_0xd902('0x35')](_0x446af9[_0xd902('0x31')],_0x446af9[_0xd902('0x33')]);_0x624d84['attributes']=_[_0xd902('0x35')](_0x446af9['model'],qs[_0xd902('0x36')](_0xcaad36[_0xd902('0x33')]['fields']));_0x624d84[_0xd902('0x37')]=_0x624d84[_0xd902('0x37')][_0xd902('0x38')]?_0x624d84[_0xd902('0x37')]:_0x446af9[_0xd902('0x31')];if(!_0xcaad36['query'][_0xd902('0x39')]('nolimit')){_0x624d84[_0xd902('0x3a')]=qs[_0xd902('0x3a')](_0xcaad36[_0xd902('0x33')][_0xd902('0x3a')]);_0x624d84['offset']=qs[_0xd902('0x1f')](_0xcaad36[_0xd902('0x33')][_0xd902('0x1f')]);}_0x624d84[_0xd902('0x3b')]=qs['sort'](_0xcaad36['query'][_0xd902('0x3c')]);_0x624d84[_0xd902('0x3d')]=qs[_0xd902('0x34')](_[_0xd902('0x3e')](_0xcaad36['query'],_0x446af9[_0xd902('0x34')]),_0x152d39);if(_0xcaad36[_0xd902('0x33')][_0xd902('0x3f')]){_0x624d84[_0xd902('0x3d')]=_['merge'](_0x624d84[_0xd902('0x3d')],{'$or':_['map'](_0x152d39,function(_0x54963b){if(_0x54963b['type']!==_0xd902('0x40')){var _0x2e81fe={};_0x2e81fe[_0x54963b[_0xd902('0x2a')]]={'$like':'%'+_0xcaad36[_0xd902('0x33')][_0xd902('0x3f')]+'%'};return _0x2e81fe;}})});}_0x624d84=_[_0xd902('0x41')]({},_0x624d84,_0xcaad36['options']);var _0x177fe6={'where':_0x624d84[_0xd902('0x3d')]};return db[_0xd902('0x2d')][_0xd902('0x21')](_0x177fe6)['then'](function(_0x5cab8){_0x14b414['count']=_0x5cab8;if(_0xcaad36[_0xd902('0x33')][_0xd902('0x42')]){_0x624d84[_0xd902('0x43')]=[{'all':!![]}];}return db['SquareRecording']['findAll'](_0x624d84);})[_0xd902('0x27')](function(_0x4e4c3e){_0x14b414[_0xd902('0x44')]=_0x4e4c3e;return _0x14b414;})[_0xd902('0x27')](respondWithFilteredResult(_0x3312c8,_0x624d84))[_0xd902('0x45')](handleError(_0x3312c8,null));};exports['show']=function(_0x28a87e,_0x56c346){var _0x219774={'raw':!![],'where':{'id':_0x28a87e[_0xd902('0x46')]['id']}},_0x142e13={};_0x142e13[_0xd902('0x31')]=_['keys'](db['SquareRecording']['rawAttributes']);_0x142e13[_0xd902('0x33')]=_[_0xd902('0x32')](_0x28a87e[_0xd902('0x33')]);_0x142e13['filters']=_[_0xd902('0x35')](_0x142e13[_0xd902('0x31')],_0x142e13['query']);_0x219774[_0xd902('0x37')]=_[_0xd902('0x35')](_0x142e13['model'],qs['fields'](_0x28a87e[_0xd902('0x33')]['fields']));_0x219774['attributes']=_0x219774[_0xd902('0x37')][_0xd902('0x38')]?_0x219774[_0xd902('0x37')]:_0x142e13[_0xd902('0x31')];if(_0x28a87e[_0xd902('0x33')][_0xd902('0x42')]){_0x219774[_0xd902('0x43')]=[{'all':!![]}];}_0x219774=_[_0xd902('0x41')]({},_0x219774,_0x28a87e['options']);return db[_0xd902('0x2d')]['find'](_0x219774)['then'](handleEntityNotFound(_0x56c346,null))[_0xd902('0x27')](respondWithResult(_0x56c346,null))[_0xd902('0x45')](handleError(_0x56c346,null));};exports[_0xd902('0x47')]=function(_0x446743,_0x3ec0e0){return db[_0xd902('0x2d')][_0xd902('0x47')](_0x446743[_0xd902('0x48')],{})[_0xd902('0x27')](respondWithResult(_0x3ec0e0,0xc9))[_0xd902('0x45')](handleError(_0x3ec0e0,null));};exports[_0xd902('0x26')]=function(_0x4a6664,_0x36df40){if(_0x4a6664[_0xd902('0x48')]['id']){delete _0x4a6664[_0xd902('0x48')]['id'];}return db[_0xd902('0x2d')][_0xd902('0x49')]({'where':{'id':_0x4a6664['params']['id']}})[_0xd902('0x27')](handleEntityNotFound(_0x36df40,null))[_0xd902('0x27')](saveUpdates(_0x4a6664['body'],null))[_0xd902('0x27')](respondWithResult(_0x36df40,null))[_0xd902('0x45')](handleError(_0x36df40,null));};exports['download']=function(_0x4c9b0d,_0x31cd85,_0x6eba89){var _0x183a51=require(_0xd902('0x4a'));var _0x5b37da=![];var _0x194f64={};if(_0x4c9b0d['query'][_0xd902('0x4b')]&&_0x4c9b0d[_0xd902('0x33')][_0xd902('0x4b')]===_0xd902('0x4c')){_0x194f64[_0xd902('0x4c')]=_0x4c9b0d['params']['id'];}else{_0x194f64['id']=_0x4c9b0d['params']['id'];}return db[_0xd902('0x2d')][_0xd902('0x49')]({'where':_0x194f64,'attributes':['id',_0xd902('0x4d'),_0xd902('0x4e')],'raw':!![]})['then'](handleEntityNotFound(_0x31cd85,null))[_0xd902('0x27')](function(_0x37b98d){if(_0x37b98d){var _0x34af31=_0x37b98d['savePath'];var _0x127544=util[_0xd902('0x4f')](_0xd902('0x50'),_0x34af31);if(fs[_0xd902('0x51')](_0x127544)){_0x5b37da=!![];return _0x183a51[_0xd902('0x52')](_0x127544,_0x34af31,config[_0xd902('0x53')][_0xd902('0x54')])[_0xd902('0x27')](function(){return _0x37b98d;});}return _0x37b98d;}})[_0xd902('0x27')](function(_0x3d5c9a){if(_0x3d5c9a){var _0x75ce61=_0x3d5c9a[_0xd902('0x4d')];if(!fs[_0xd902('0x51')](_0x75ce61)){throw new db[(_0xd902('0x55'))][(_0xd902('0x56'))](_0xd902('0x57'));}if(_0x3d5c9a[_0xd902('0x4e')]){return _0x31cd85[_0xd902('0x58')](_0x75ce61,_0x3d5c9a[_0xd902('0x4e')]+path[_0xd902('0x59')](_0x75ce61),function(){if(_0x5b37da){fs['unlink'](_0x75ce61);}});}else{return _0x31cd85[_0xd902('0x58')](_0x75ce61,function(_0xb17f4){if(_0x5b37da){fs[_0xd902('0x5a')](_0x75ce61);}});}}})[_0xd902('0x45')](function(_0x4f057e){if(_0x4f057e[_0xd902('0x5b')]===_0xd902('0x57')){_0x31cd85[_0xd902('0x1c')](0x194)[_0xd902('0x2b')](_0xd902('0x5c'));}else{return handleError(_0x31cd85,null);}});};exports[_0xd902('0x28')]=function(_0x541913,_0x16e9da){return db['SquareRecording']['find']({'where':{'id':_0x541913[_0xd902('0x46')]['id']}})['then'](function(_0x15e85e){if(_['isNil'](_0x15e85e)){throw new ReferenceError(_0xd902('0x5d'));}return _0x15e85e;})[_0xd902('0x27')](function(_0x3a3e12){var _0x3d566d=_0x3a3e12[_0xd902('0x4d')];logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x3d566d);if(!_[_0xd902('0x5e')](_0x3a3e12[_0xd902('0x4d')])&&fs[_0xd902('0x51')](_0x3d566d)){logger[_0xd902('0x5f')](_0xd902('0x60')+_0x3d566d+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3d566d);}_0x3d566d=_0x3d566d+_0xd902('0x61');if(!_['isNil'](_0x3a3e12[_0xd902('0x4d')])&&fs[_0xd902('0x51')](_0x3d566d)){logger[_0xd902('0x5f')]('File:\x20\x22'+_0x3d566d+_0xd902('0x62'));fs[_0xd902('0x63')](_0x3d566d);}return _0x3a3e12;})[_0xd902('0x27')](function(_0x3a73a2){if(!_0x3a73a2)throw new InternalError();return _0x3a73a2[_0xd902('0x28')]();})[_0xd902('0x27')](function(){_0x16e9da[_0xd902('0x1c')](0xcc)[_0xd902('0x1d')]();})[_0xd902('0x45')](handleError(_0x16e9da,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index de247e4..b185b9e 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 _0x7eff=['SquareRecording','square_recordings','util','../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x17e82c,_0x3cfbee){var _0x11ae9f=function(_0x25f343){while(--_0x25f343){_0x17e82c['push'](_0x17e82c['shift']());}};_0x11ae9f(++_0x3cfbee);}(_0x7eff,0x162));var _0xf7ef=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7eff[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xf7ef('0x0'));var logger=require(_0xf7ef('0x1'))(_0xf7ef('0x2'));var moment=require('moment');var BPromise=require(_0xf7ef('0x3'));var rp=require(_0xf7ef('0x4'));var fs=require('fs');var path=require(_0xf7ef('0x5'));var rimraf=require(_0xf7ef('0x6'));var config=require('../../config/environment');var attributes=require('./squareRecording.attributes');module[_0xf7ef('0x7')]=function(_0x130e65,_0x41864d){return _0x130e65[_0xf7ef('0x8')](_0xf7ef('0x9'),attributes,{'tableName':_0xf7ef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b2c=['request-promise','rimraf','../../config/environment','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util','../../config/logger','moment'];(function(_0x9b4c52,_0x2f7c28){var _0x4e13dd=function(_0xf7e85c){while(--_0xf7e85c){_0x9b4c52['push'](_0x9b4c52['shift']());}};_0x4e13dd(++_0x2f7c28);}(_0x9b2c,0x189));var _0xc9b2=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x9b2c[_0xa990b7];return _0x52c99c;};'use strict';var _=require('lodash');var util=require(_0xc9b2('0x0'));var logger=require(_0xc9b2('0x1'))('api');var moment=require(_0xc9b2('0x2'));var BPromise=require('bluebird');var rp=require(_0xc9b2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc9b2('0x4'));var config=require(_0xc9b2('0x5'));var attributes=require(_0xc9b2('0x6'));module[_0xc9b2('0x7')]=function(_0x15be55,_0x3e6343){return _0x15be55[_0xc9b2('0x8')](_0xc9b2('0x9'),attributes,{'tableName':_0xc9b2('0xa'),'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 3234046..3926ee5 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 _0x14a6=['jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','create','body','options','raw','CreateSquareRecording','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x112db5,_0x38a06d){var _0x1d7d06=function(_0x44571e){while(--_0x44571e){_0x112db5['push'](_0x112db5['shift']());}};_0x1d7d06(++_0x38a06d);}(_0x14a6,0x107));var _0x614a=function(_0x2b0633,_0x5450af){_0x2b0633=_0x2b0633-0x0;var _0x424611=_0x14a6[_0x2b0633];return _0x424611;};'use strict';var _=require(_0x614a('0x0'));var util=require(_0x614a('0x1'));var moment=require(_0x614a('0x2'));var BPromise=require(_0x614a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x614a('0x4'))['db'];var utils=require(_0x614a('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x614a('0x6'));var jayson=require(_0x614a('0x7'));var client=jayson[_0x614a('0x8')][_0x614a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ce5e6,_0x484e53,_0x17d4f9){return new BPromise(function(_0x117b58,_0x3cfbb3){return client[_0x614a('0xa')](_0x1ce5e6,_0x17d4f9)['then'](function(_0x23a0c0){logger[_0x614a('0xb')](_0x614a('0xc'),_0x484e53,_0x614a('0xd'));logger[_0x614a('0xe')](_0x614a('0xf'),_0x484e53,_0x614a('0xd'),JSON[_0x614a('0x10')](_0x23a0c0));if(_0x23a0c0[_0x614a('0x11')]){if(_0x23a0c0[_0x614a('0x11')][_0x614a('0x12')]===0x1f4){logger[_0x614a('0x11')]('SquareRecording,\x20%s,\x20%s',_0x484e53,_0x23a0c0['error'][_0x614a('0x13')]);return _0x3cfbb3(_0x23a0c0[_0x614a('0x11')][_0x614a('0x13')]);}logger['error']('SquareRecording,\x20%s,\x20%s',_0x484e53,_0x23a0c0['error'][_0x614a('0x13')]);return _0x117b58(_0x23a0c0[_0x614a('0x11')][_0x614a('0x13')]);}else{logger[_0x614a('0xb')](_0x614a('0xc'),_0x484e53,_0x614a('0xd'));_0x117b58(_0x23a0c0[_0x614a('0x14')][_0x614a('0x13')]);}})['catch'](function(_0x2195b2){logger[_0x614a('0x11')](_0x614a('0xc'),_0x484e53,_0x2195b2);_0x3cfbb3(_0x2195b2);});});}exports['CreateSquareRecording']=function(_0x215755){var _0x492b04=this;return new Promise(function(_0x5a06a7,_0x59c53d){return db['SquareRecording'][_0x614a('0x15')](_0x215755[_0x614a('0x16')],{'raw':_0x215755['options']?_0x215755[_0x614a('0x17')][_0x614a('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x453f5f){logger[_0x614a('0xb')](_0x614a('0x19'),_0x215755);logger[_0x614a('0xe')]('CreateSquareRecording',_0x215755,JSON[_0x614a('0x10')](_0x453f5f));_0x5a06a7(_0x453f5f);})[_0x614a('0x1a')](function(_0x4bd46a){logger[_0x614a('0x11')](_0x614a('0x19'),_0x4bd46a[_0x614a('0x13')],_0x215755);_0x59c53d(_0x492b04[_0x614a('0x11')](0x1f4,_0x4bd46a[_0x614a('0x13')]));});});}; \ No newline at end of file +var _0xee8c=['result','catch','CreateSquareRecording','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareRecording,\x20%s,\x20%s','message'];(function(_0x44c768,_0x552a5e){var _0x55daf5=function(_0x4958e8){while(--_0x4958e8){_0x44c768['push'](_0x44c768['shift']());}};_0x55daf5(++_0x552a5e);}(_0xee8c,0x12f));var _0xcee8=function(_0x4769ff,_0x127733){_0x4769ff=_0x4769ff-0x0;var _0x2362ba=_0xee8c[_0x4769ff];return _0x2362ba;};'use strict';var _=require(_0xcee8('0x0'));var util=require('util');var moment=require(_0xcee8('0x1'));var BPromise=require(_0xcee8('0x2'));var rs=require(_0xcee8('0x3'));var fs=require('fs');var Redis=require(_0xcee8('0x4'));var db=require(_0xcee8('0x5'))['db'];var utils=require(_0xcee8('0x6'));var logger=require(_0xcee8('0x7'))('rpc');var config=require(_0xcee8('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcee8('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dab19,_0x3ed480,_0x50a692){return new BPromise(function(_0x43cea3,_0x24d131){return client[_0xcee8('0xa')](_0x5dab19,_0x50a692)[_0xcee8('0xb')](function(_0x433de8){logger[_0xcee8('0xc')]('SquareRecording,\x20%s,\x20%s',_0x3ed480,_0xcee8('0xd'));logger[_0xcee8('0xe')](_0xcee8('0xf'),_0x3ed480,_0xcee8('0xd'),JSON[_0xcee8('0x10')](_0x433de8));if(_0x433de8[_0xcee8('0x11')]){if(_0x433de8[_0xcee8('0x11')][_0xcee8('0x12')]===0x1f4){logger[_0xcee8('0x11')](_0xcee8('0x13'),_0x3ed480,_0x433de8['error'][_0xcee8('0x14')]);return _0x24d131(_0x433de8['error'][_0xcee8('0x14')]);}logger['error'](_0xcee8('0x13'),_0x3ed480,_0x433de8[_0xcee8('0x11')]['message']);return _0x43cea3(_0x433de8[_0xcee8('0x11')][_0xcee8('0x14')]);}else{logger[_0xcee8('0xc')](_0xcee8('0x13'),_0x3ed480,_0xcee8('0xd'));_0x43cea3(_0x433de8[_0xcee8('0x15')][_0xcee8('0x14')]);}})[_0xcee8('0x16')](function(_0x52d8e9){logger[_0xcee8('0x11')]('SquareRecording,\x20%s,\x20%s',_0x3ed480,_0x52d8e9);_0x24d131(_0x52d8e9);});});}exports[_0xcee8('0x17')]=function(_0x59a194){var _0x9cc867=this;return new Promise(function(_0x520123,_0x5bb932){return db['SquareRecording']['create'](_0x59a194[_0xcee8('0x18')],{'raw':_0x59a194[_0xcee8('0x19')]?_0x59a194['options'][_0xcee8('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x3ccbca){logger[_0xcee8('0xc')](_0xcee8('0x17'),_0x59a194);logger[_0xcee8('0xe')](_0xcee8('0x17'),_0x59a194,JSON[_0xcee8('0x10')](_0x3ccbca));_0x520123(_0x3ccbca);})['catch'](function(_0x1031c){logger[_0xcee8('0x11')](_0xcee8('0x17'),_0x1031c[_0xcee8('0x14')],_0x59a194);_0x5bb932(_0x9cc867[_0xcee8('0x11')](0x1f4,_0x1031c[_0xcee8('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 7cd03c9..3cefe96 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(_0x2971b7,_0x2cf661){var _0x5d9c5f=function(_0x13b493){while(--_0x13b493){_0x2971b7['push'](_0x2971b7['shift']());}};_0x5d9c5f(++_0x2cf661);}(_0xbaf0,0x12a));var _0x0baf=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xbaf0[_0x2b4411];return _0x8e41ef;};'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(_0x1a285a,_0xa0539a){var _0x2b180b=function(_0x1480d1){while(--_0x1480d1){_0x1a285a['push'](_0x1a285a['shift']());}};_0x2b180b(++_0xa0539a);}(_0xe706,0xa3));var _0x6e70=function(_0x36de53,_0x4a0679){_0x36de53=_0x36de53-0x0;var _0x2b04cb=_0xe706[_0x36de53];return _0x2b04cb;};'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 5775e03..6e6d277 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 _0xd2d0=['BOOLEAN','sequelize','STRING','DATE'];(function(_0x57502b,_0x448454){var _0x4f44f1=function(_0x7f98d5){while(--_0x7f98d5){_0x57502b['push'](_0x57502b['shift']());}};_0x4f44f1(++_0x448454);}(_0xd2d0,0x18d));var _0x0d2d=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xd2d0[_0x1035c1];return _0x308d67;};'use strict';var Sequelize=require(_0x0d2d('0x0'));module['exports']={'network':{'type':Sequelize[_0x0d2d('0x1')]},'network_script':{'type':Sequelize[_0x0d2d('0x1')]},'request':{'type':Sequelize[_0x0d2d('0x1')]},'channel':{'type':Sequelize[_0x0d2d('0x1')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0d2d('0x1')]},'version':{'type':Sequelize[_0x0d2d('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0d2d('0x1')]},'callingpres':{'type':Sequelize[_0x0d2d('0x1')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x0d2d('0x1')]},'dnid':{'type':Sequelize[_0x0d2d('0x1')]},'rdnis':{'type':Sequelize[_0x0d2d('0x1')]},'context':{'type':Sequelize[_0x0d2d('0x1')]},'extension':{'type':Sequelize[_0x0d2d('0x1')]},'priority':{'type':Sequelize[_0x0d2d('0x1')]},'enhanced':{'type':Sequelize[_0x0d2d('0x1')]},'accountcode':{'type':Sequelize[_0x0d2d('0x1')]},'threadid':{'type':Sequelize[_0x0d2d('0x1')]},'project_name':{'type':Sequelize[_0x0d2d('0x1')]},'joinAt':{'type':Sequelize[_0x0d2d('0x2')]},'leaveAt':{'type':Sequelize[_0x0d2d('0x2')]},'bot':{'type':Sequelize[_0x0d2d('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xf672=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0x3d613e,_0x511d0c){var _0x411507=function(_0xf286d9){while(--_0xf286d9){_0x3d613e['push'](_0x3d613e['shift']());}};_0x411507(++_0x511d0c);}(_0xf672,0xc5));var _0x2f67=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf672[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x2f67('0x0'));module[_0x2f67('0x1')]={'network':{'type':Sequelize[_0x2f67('0x2')]},'network_script':{'type':Sequelize[_0x2f67('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x2f67('0x2')]},'language':{'type':Sequelize[_0x2f67('0x2')]},'type':{'type':Sequelize[_0x2f67('0x2')]},'uniqueid':{'type':Sequelize[_0x2f67('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x2f67('0x2')]},'calleridname':{'type':Sequelize[_0x2f67('0x2')]},'callingpres':{'type':Sequelize[_0x2f67('0x2')]},'callingani2':{'type':Sequelize[_0x2f67('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x2f67('0x2')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2f67('0x2')]},'extension':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x2f67('0x2')]},'enhanced':{'type':Sequelize[_0x2f67('0x2')]},'accountcode':{'type':Sequelize[_0x2f67('0x2')]},'threadid':{'type':Sequelize[_0x2f67('0x2')]},'project_name':{'type':Sequelize[_0x2f67('0x2')]},'joinAt':{'type':Sequelize[_0x2f67('0x3')]},'leaveAt':{'type':Sequelize[_0x2f67('0x3')]},'bot':{'type':Sequelize[_0x2f67('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 4f66cde..3f35710 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 _0x8934=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','destroy','describe','eml-format','rimraf','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','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','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','save','then','end','error','stack','name','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters'];(function(_0x4b49cc,_0x24c7f5){var _0x3e60aa=function(_0x7c2fd8){while(--_0x7c2fd8){_0x4b49cc['push'](_0x4b49cc['shift']());}};_0x3e60aa(++_0x24c7f5);}(_0x8934,0x1db));var _0x4893=function(_0x52c8d8,_0x36a1f4){_0x52c8d8=_0x52c8d8-0x0;var _0x55a958=_0x8934[_0x52c8d8];return _0x55a958;};'use strict';var emlformat=require(_0x4893('0x0'));var rimraf=require(_0x4893('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4893('0x2'));var moment=require('moment');var BPromise=require(_0x4893('0x3'));var Mustache=require(_0x4893('0x4'));var util=require(_0x4893('0x5'));var path=require('path');var sox=require(_0x4893('0x6'));var csv=require(_0x4893('0x7'));var ejs=require(_0x4893('0x8'));var fs=require('fs');var fs_extra=require(_0x4893('0x9'));var _=require('lodash');var squel=require(_0x4893('0xa'));var crypto=require('crypto');var jsforce=require(_0x4893('0xb'));var deskjs=require(_0x4893('0xc'));var toCsv=require(_0x4893('0x7'));var querystring=require(_0x4893('0xd'));var Papa=require(_0x4893('0xe'));var Redis=require(_0x4893('0xf'));var authService=require(_0x4893('0x10'));var qs=require(_0x4893('0x11'));var as=require(_0x4893('0x12'));var hardwareService=require(_0x4893('0x13'));var logger=require(_0x4893('0x14'))(_0x4893('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4893('0x16'));var db=require(_0x4893('0x17'))['db'];function respondWithStatusCode(_0x3b36b8,_0x1e82b8){_0x1e82b8=_0x1e82b8||0xcc;return function(_0x3184dd){if(_0x3184dd){return _0x3b36b8[_0x4893('0x18')](_0x1e82b8);}return _0x3b36b8['status'](_0x1e82b8)['end']();};}function respondWithResult(_0x4f338e,_0x5ee7ba){_0x5ee7ba=_0x5ee7ba||0xc8;return function(_0x41e9d1){if(_0x41e9d1){return _0x4f338e[_0x4893('0x19')](_0x5ee7ba)[_0x4893('0x1a')](_0x41e9d1);}};}function respondWithFilteredResult(_0x4af71c,_0x5e4b9f){return function(_0x2c3151){if(_0x2c3151){var _0x388d95=typeof _0x5e4b9f['offset']===_0x4893('0x1b')&&typeof _0x5e4b9f[_0x4893('0x1c')]==='undefined';var _0x509f05=_0x2c3151['count'];var _0x13ea56=_0x388d95?0x0:_0x5e4b9f['offset'];var _0x3358f3=_0x388d95?_0x2c3151[_0x4893('0x1d')]:_0x5e4b9f[_0x4893('0x1e')]+_0x5e4b9f[_0x4893('0x1c')];var _0x375886;if(_0x3358f3>=_0x509f05){_0x3358f3=_0x509f05;_0x375886=0xc8;}else{_0x375886=0xce;}_0x4af71c[_0x4893('0x19')](_0x375886);return _0x4af71c['set'](_0x4893('0x1f'),_0x13ea56+'-'+_0x3358f3+'/'+_0x509f05)[_0x4893('0x1a')](_0x2c3151);}return null;};}function patchUpdates(_0x52d779){return function(_0x13a2ac){try{jsonpatch[_0x4893('0x20')](_0x13a2ac,_0x52d779,!![]);}catch(_0x22eb38){return BPromise['reject'](_0x22eb38);}return _0x13a2ac[_0x4893('0x21')]();};}function saveUpdates(_0x442ea6,_0x58fde3){return function(_0x5f5d47){if(_0x5f5d47){return _0x5f5d47['update'](_0x442ea6)[_0x4893('0x22')](function(_0xa54b0e){return _0xa54b0e;});}return null;};}function removeEntity(_0x2f4d36,_0x38cfd5){return function(_0x273b3b){if(_0x273b3b){return _0x273b3b['destroy']()[_0x4893('0x22')](function(){_0x2f4d36['status'](0xcc)[_0x4893('0x23')]();});}};}function handleEntityNotFound(_0x464b43,_0x4a8aed){return function(_0x4ab8d8){if(!_0x4ab8d8){_0x464b43['sendStatus'](0x194);}return _0x4ab8d8;};}function handleError(_0x3c0ce1,_0x1a0bfe){_0x1a0bfe=_0x1a0bfe||0x1f4;return function(_0x297e1a){logger[_0x4893('0x24')](_0x297e1a[_0x4893('0x25')]);if(_0x297e1a[_0x4893('0x26')]){delete _0x297e1a[_0x4893('0x26')];}_0x3c0ce1[_0x4893('0x19')](_0x1a0bfe)['send'](_0x297e1a);};}exports[_0x4893('0x27')]=function(_0x293032,_0xb0e31d){var _0x5e7178={},_0x1b9d51={},_0x34bf09={'count':0x0,'rows':[]};var _0x4ab367=_[_0x4893('0x28')](db[_0x4893('0x29')][_0x4893('0x2a')],function(_0x56f547){return{'name':_0x56f547[_0x4893('0x2b')],'type':_0x56f547[_0x4893('0x2c')][_0x4893('0x2d')]};});_0x1b9d51[_0x4893('0x2e')]=_[_0x4893('0x28')](_0x4ab367,'name');_0x1b9d51[_0x4893('0x2f')]=_[_0x4893('0x30')](_0x293032[_0x4893('0x2f')]);_0x1b9d51[_0x4893('0x31')]=_[_0x4893('0x32')](_0x1b9d51[_0x4893('0x2e')],_0x1b9d51[_0x4893('0x2f')]);_0x5e7178[_0x4893('0x33')]=_[_0x4893('0x32')](_0x1b9d51[_0x4893('0x2e')],qs['fields'](_0x293032[_0x4893('0x2f')][_0x4893('0x34')]));_0x5e7178[_0x4893('0x33')]=_0x5e7178[_0x4893('0x33')][_0x4893('0x35')]?_0x5e7178[_0x4893('0x33')]:_0x1b9d51[_0x4893('0x2e')];if(!_0x293032['query'][_0x4893('0x36')](_0x4893('0x37'))){_0x5e7178['limit']=qs[_0x4893('0x1c')](_0x293032[_0x4893('0x2f')][_0x4893('0x1c')]);_0x5e7178[_0x4893('0x1e')]=qs[_0x4893('0x1e')](_0x293032[_0x4893('0x2f')]['offset']);}_0x5e7178[_0x4893('0x38')]=qs[_0x4893('0x39')](_0x293032[_0x4893('0x2f')][_0x4893('0x39')]);_0x5e7178[_0x4893('0x3a')]=qs[_0x4893('0x31')](_[_0x4893('0x3b')](_0x293032['query'],_0x1b9d51['filters']),_0x4ab367);if(_0x293032['query'][_0x4893('0x3c')]){_0x5e7178['where']=_[_0x4893('0x3d')](_0x5e7178[_0x4893('0x3a')],{'$or':_['map'](_0x4ab367,function(_0x3b36fa){if(_0x3b36fa[_0x4893('0x2c')]!==_0x4893('0x3e')){var _0x961819={};_0x961819[_0x3b36fa[_0x4893('0x26')]]={'$like':'%'+_0x293032['query'][_0x4893('0x3c')]+'%'};return _0x961819;}})});}_0x5e7178=_[_0x4893('0x3d')]({},_0x5e7178,_0x293032['options']);var _0x4b8f85={'where':_0x5e7178[_0x4893('0x3a')]};return db[_0x4893('0x29')][_0x4893('0x1d')](_0x4b8f85)[_0x4893('0x22')](function(_0x3e2ed1){_0x34bf09['count']=_0x3e2ed1;if(_0x293032[_0x4893('0x2f')][_0x4893('0x3f')]){_0x5e7178[_0x4893('0x40')]=[{'all':!![]}];}return db[_0x4893('0x29')]['findAll'](_0x5e7178);})[_0x4893('0x22')](function(_0x1aaa55){_0x34bf09[_0x4893('0x41')]=_0x1aaa55;return _0x34bf09;})[_0x4893('0x22')](respondWithFilteredResult(_0xb0e31d,_0x5e7178))[_0x4893('0x42')](handleError(_0xb0e31d,null));};exports[_0x4893('0x43')]=function(_0xa2ad65,_0x48dc09){var _0x304c87={'raw':!![],'where':{'id':_0xa2ad65[_0x4893('0x44')]['id']}},_0x4982c8={};_0x4982c8[_0x4893('0x2e')]=_[_0x4893('0x30')](db[_0x4893('0x29')]['rawAttributes']);_0x4982c8[_0x4893('0x2f')]=_[_0x4893('0x30')](_0xa2ad65[_0x4893('0x2f')]);_0x4982c8[_0x4893('0x31')]=_['intersection'](_0x4982c8[_0x4893('0x2e')],_0x4982c8[_0x4893('0x2f')]);_0x304c87[_0x4893('0x33')]=_[_0x4893('0x32')](_0x4982c8['model'],qs[_0x4893('0x34')](_0xa2ad65[_0x4893('0x2f')][_0x4893('0x34')]));_0x304c87[_0x4893('0x33')]=_0x304c87['attributes'][_0x4893('0x35')]?_0x304c87[_0x4893('0x33')]:_0x4982c8['model'];if(_0xa2ad65['query'][_0x4893('0x3f')]){_0x304c87[_0x4893('0x40')]=[{'all':!![]}];}_0x304c87=_['merge']({},_0x304c87,_0xa2ad65[_0x4893('0x45')]);return db[_0x4893('0x29')][_0x4893('0x46')](_0x304c87)[_0x4893('0x22')](handleEntityNotFound(_0x48dc09,null))[_0x4893('0x22')](respondWithResult(_0x48dc09,null))[_0x4893('0x42')](handleError(_0x48dc09,null));};exports[_0x4893('0x47')]=function(_0x316cd5,_0x427977){return db[_0x4893('0x29')]['create'](_0x316cd5[_0x4893('0x48')],{})[_0x4893('0x22')](respondWithResult(_0x427977,0xc9))[_0x4893('0x42')](handleError(_0x427977,null));};exports['update']=function(_0x2879be,_0x59ae39){if(_0x2879be['body']['id']){delete _0x2879be['body']['id'];}return db[_0x4893('0x29')]['find']({'where':{'id':_0x2879be[_0x4893('0x44')]['id']}})[_0x4893('0x22')](handleEntityNotFound(_0x59ae39,null))['then'](saveUpdates(_0x2879be[_0x4893('0x48')],null))[_0x4893('0x22')](respondWithResult(_0x59ae39,null))[_0x4893('0x42')](handleError(_0x59ae39,null));};exports[_0x4893('0x49')]=function(_0x430dc7,_0x3edb27){return db[_0x4893('0x29')]['find']({'where':{'id':_0x430dc7[_0x4893('0x44')]['id']}})[_0x4893('0x22')](handleEntityNotFound(_0x3edb27,null))[_0x4893('0x22')](removeEntity(_0x3edb27,null))[_0x4893('0x42')](handleError(_0x3edb27,null));};exports[_0x4893('0x4a')]=function(_0x203cb1,_0xc7d2ec){return db[_0x4893('0x29')]['describe']()['then'](respondWithResult(_0xc7d2ec,null))[_0x4893('0x42')](handleError(_0xc7d2ec,null));}; \ No newline at end of file +var _0xfab2=['sendStatus','error','stack','index','SquareReport','rawAttributes','type','key','model','name','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','count','include','findAll','rows','catch','params','keys','includeAll','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','update','then','destroy'];(function(_0x12cdfa,_0x28318f){var _0x2da9d8=function(_0x3b42ef){while(--_0x3b42ef){_0x12cdfa['push'](_0x12cdfa['shift']());}};_0x2da9d8(++_0x28318f);}(_0xfab2,0x14a));var _0x2fab=function(_0x1ab4f4,_0x576f7b){_0x1ab4f4=_0x1ab4f4-0x0;var _0x11f5a9=_0xfab2[_0x1ab4f4];return _0x11f5a9;};'use strict';var emlformat=require(_0x2fab('0x0'));var rimraf=require(_0x2fab('0x1'));var zipdir=require(_0x2fab('0x2'));var jsonpatch=require(_0x2fab('0x3'));var rp=require('request-promise');var moment=require(_0x2fab('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2fab('0x5'));var util=require(_0x2fab('0x6'));var path=require(_0x2fab('0x7'));var sox=require(_0x2fab('0x8'));var csv=require(_0x2fab('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2fab('0xa'));var _=require(_0x2fab('0xb'));var squel=require('squel');var crypto=require(_0x2fab('0xc'));var jsforce=require(_0x2fab('0xd'));var deskjs=require(_0x2fab('0xe'));var toCsv=require(_0x2fab('0x9'));var querystring=require(_0x2fab('0xf'));var Papa=require('papaparse');var Redis=require(_0x2fab('0x10'));var authService=require(_0x2fab('0x11'));var qs=require(_0x2fab('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2fab('0x13'));var logger=require('../../config/logger')(_0x2fab('0x14'));var utils=require(_0x2fab('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2fab('0x16'));var db=require(_0x2fab('0x17'))['db'];function respondWithStatusCode(_0x44f976,_0x40ca59){_0x40ca59=_0x40ca59||0xcc;return function(_0x78205){if(_0x78205){return _0x44f976['sendStatus'](_0x40ca59);}return _0x44f976[_0x2fab('0x18')](_0x40ca59)[_0x2fab('0x19')]();};}function respondWithResult(_0x3f648f,_0x3e20de){_0x3e20de=_0x3e20de||0xc8;return function(_0x2916f2){if(_0x2916f2){return _0x3f648f['status'](_0x3e20de)[_0x2fab('0x1a')](_0x2916f2);}};}function respondWithFilteredResult(_0x2d7fc7,_0x1d1201){return function(_0x566f4c){if(_0x566f4c){var _0x46c967=typeof _0x1d1201[_0x2fab('0x1b')]===_0x2fab('0x1c')&&typeof _0x1d1201[_0x2fab('0x1d')]===_0x2fab('0x1c');var _0x2148cf=_0x566f4c['count'];var _0x13e911=_0x46c967?0x0:_0x1d1201[_0x2fab('0x1b')];var _0xc3f978=_0x46c967?_0x566f4c['count']:_0x1d1201[_0x2fab('0x1b')]+_0x1d1201['limit'];var _0x43befa;if(_0xc3f978>=_0x2148cf){_0xc3f978=_0x2148cf;_0x43befa=0xc8;}else{_0x43befa=0xce;}_0x2d7fc7[_0x2fab('0x18')](_0x43befa);return _0x2d7fc7[_0x2fab('0x1e')](_0x2fab('0x1f'),_0x13e911+'-'+_0xc3f978+'/'+_0x2148cf)[_0x2fab('0x1a')](_0x566f4c);}return null;};}function patchUpdates(_0x4d7eca){return function(_0x5833a3){try{jsonpatch['apply'](_0x5833a3,_0x4d7eca,!![]);}catch(_0x4729c8){return BPromise['reject'](_0x4729c8);}return _0x5833a3['save']();};}function saveUpdates(_0x1a930b,_0x2be264){return function(_0x1c6bf9){if(_0x1c6bf9){return _0x1c6bf9[_0x2fab('0x20')](_0x1a930b)[_0x2fab('0x21')](function(_0x2599b5){return _0x2599b5;});}return null;};}function removeEntity(_0x2af215,_0x3f966f){return function(_0x408d38){if(_0x408d38){return _0x408d38[_0x2fab('0x22')]()[_0x2fab('0x21')](function(){_0x2af215['status'](0xcc)[_0x2fab('0x19')]();});}};}function handleEntityNotFound(_0x583383,_0x5edcd){return function(_0x3ee017){if(!_0x3ee017){_0x583383[_0x2fab('0x23')](0x194);}return _0x3ee017;};}function handleError(_0xb2712,_0x2c863f){_0x2c863f=_0x2c863f||0x1f4;return function(_0x50eb1f){logger[_0x2fab('0x24')](_0x50eb1f[_0x2fab('0x25')]);if(_0x50eb1f['name']){delete _0x50eb1f['name'];}_0xb2712[_0x2fab('0x18')](_0x2c863f)['send'](_0x50eb1f);};}exports[_0x2fab('0x26')]=function(_0x34e109,_0x344749){var _0x3be5bf={},_0x102149={},_0x434a46={'count':0x0,'rows':[]};var _0x1736d9=_['map'](db[_0x2fab('0x27')][_0x2fab('0x28')],function(_0x54bc2a){return{'name':_0x54bc2a['fieldName'],'type':_0x54bc2a[_0x2fab('0x29')][_0x2fab('0x2a')]};});_0x102149[_0x2fab('0x2b')]=_['map'](_0x1736d9,_0x2fab('0x2c'));_0x102149[_0x2fab('0x2d')]=_['keys'](_0x34e109[_0x2fab('0x2d')]);_0x102149[_0x2fab('0x2e')]=_[_0x2fab('0x2f')](_0x102149[_0x2fab('0x2b')],_0x102149[_0x2fab('0x2d')]);_0x3be5bf[_0x2fab('0x30')]=_['intersection'](_0x102149[_0x2fab('0x2b')],qs[_0x2fab('0x31')](_0x34e109[_0x2fab('0x2d')][_0x2fab('0x31')]));_0x3be5bf[_0x2fab('0x30')]=_0x3be5bf['attributes'][_0x2fab('0x32')]?_0x3be5bf[_0x2fab('0x30')]:_0x102149['model'];if(!_0x34e109['query']['hasOwnProperty'](_0x2fab('0x33'))){_0x3be5bf['limit']=qs['limit'](_0x34e109['query'][_0x2fab('0x1d')]);_0x3be5bf[_0x2fab('0x1b')]=qs['offset'](_0x34e109[_0x2fab('0x2d')]['offset']);}_0x3be5bf[_0x2fab('0x34')]=qs[_0x2fab('0x35')](_0x34e109['query'][_0x2fab('0x35')]);_0x3be5bf[_0x2fab('0x36')]=qs[_0x2fab('0x2e')](_[_0x2fab('0x37')](_0x34e109[_0x2fab('0x2d')],_0x102149[_0x2fab('0x2e')]),_0x1736d9);if(_0x34e109['query'][_0x2fab('0x38')]){_0x3be5bf[_0x2fab('0x36')]=_[_0x2fab('0x39')](_0x3be5bf[_0x2fab('0x36')],{'$or':_[_0x2fab('0x3a')](_0x1736d9,function(_0x20fb80){if(_0x20fb80[_0x2fab('0x29')]!==_0x2fab('0x3b')){var _0x16305f={};_0x16305f[_0x20fb80[_0x2fab('0x2c')]]={'$like':'%'+_0x34e109['query'][_0x2fab('0x38')]+'%'};return _0x16305f;}})});}_0x3be5bf=_[_0x2fab('0x39')]({},_0x3be5bf,_0x34e109['options']);var _0x5aa69c={'where':_0x3be5bf[_0x2fab('0x36')]};return db['SquareReport'][_0x2fab('0x3c')](_0x5aa69c)[_0x2fab('0x21')](function(_0x5bef5d){_0x434a46['count']=_0x5bef5d;if(_0x34e109[_0x2fab('0x2d')]['includeAll']){_0x3be5bf[_0x2fab('0x3d')]=[{'all':!![]}];}return db[_0x2fab('0x27')][_0x2fab('0x3e')](_0x3be5bf);})[_0x2fab('0x21')](function(_0x33458d){_0x434a46[_0x2fab('0x3f')]=_0x33458d;return _0x434a46;})[_0x2fab('0x21')](respondWithFilteredResult(_0x344749,_0x3be5bf))[_0x2fab('0x40')](handleError(_0x344749,null));};exports['show']=function(_0x124f20,_0x12c06e){var _0x270e71={'raw':!![],'where':{'id':_0x124f20[_0x2fab('0x41')]['id']}},_0x4a14be={};_0x4a14be[_0x2fab('0x2b')]=_[_0x2fab('0x42')](db['SquareReport'][_0x2fab('0x28')]);_0x4a14be[_0x2fab('0x2d')]=_[_0x2fab('0x42')](_0x124f20[_0x2fab('0x2d')]);_0x4a14be['filters']=_[_0x2fab('0x2f')](_0x4a14be[_0x2fab('0x2b')],_0x4a14be[_0x2fab('0x2d')]);_0x270e71[_0x2fab('0x30')]=_['intersection'](_0x4a14be[_0x2fab('0x2b')],qs['fields'](_0x124f20[_0x2fab('0x2d')]['fields']));_0x270e71[_0x2fab('0x30')]=_0x270e71[_0x2fab('0x30')]['length']?_0x270e71[_0x2fab('0x30')]:_0x4a14be[_0x2fab('0x2b')];if(_0x124f20['query'][_0x2fab('0x43')]){_0x270e71[_0x2fab('0x3d')]=[{'all':!![]}];}_0x270e71=_[_0x2fab('0x39')]({},_0x270e71,_0x124f20[_0x2fab('0x44')]);return db[_0x2fab('0x27')][_0x2fab('0x45')](_0x270e71)['then'](handleEntityNotFound(_0x12c06e,null))[_0x2fab('0x21')](respondWithResult(_0x12c06e,null))[_0x2fab('0x40')](handleError(_0x12c06e,null));};exports[_0x2fab('0x46')]=function(_0x3e7456,_0x480abd){return db[_0x2fab('0x27')][_0x2fab('0x46')](_0x3e7456[_0x2fab('0x47')],{})[_0x2fab('0x21')](respondWithResult(_0x480abd,0xc9))[_0x2fab('0x40')](handleError(_0x480abd,null));};exports['update']=function(_0x52e05b,_0x20abe6){if(_0x52e05b[_0x2fab('0x47')]['id']){delete _0x52e05b[_0x2fab('0x47')]['id'];}return db[_0x2fab('0x27')]['find']({'where':{'id':_0x52e05b[_0x2fab('0x41')]['id']}})[_0x2fab('0x21')](handleEntityNotFound(_0x20abe6,null))[_0x2fab('0x21')](saveUpdates(_0x52e05b['body'],null))[_0x2fab('0x21')](respondWithResult(_0x20abe6,null))[_0x2fab('0x40')](handleError(_0x20abe6,null));};exports['destroy']=function(_0x52dd1a,_0x5ea710){return db[_0x2fab('0x27')][_0x2fab('0x45')]({'where':{'id':_0x52dd1a[_0x2fab('0x41')]['id']}})[_0x2fab('0x21')](handleEntityNotFound(_0x5ea710,null))[_0x2fab('0x21')](removeEntity(_0x5ea710,null))[_0x2fab('0x40')](handleError(_0x5ea710,null));};exports['describe']=function(_0x39d2db,_0x1ccc63){return db[_0x2fab('0x27')][_0x2fab('0x48')]()['then'](respondWithResult(_0x1ccc63,null))[_0x2fab('0x40')](handleError(_0x1ccc63,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index e66199f..9f8a9b7 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 _0x3ef6=['report_square','uid_pname','project_name','leaveAt','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./squareReport.attributes','define','SquareReport'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x3ef6,0x1cb));var _0x63ef=function(_0x362e6d,_0x4d40b0){_0x362e6d=_0x362e6d-0x0;var _0x416d99=_0x3ef6[_0x362e6d];return _0x416d99;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x63ef('0x0'))('api');var moment=require(_0x63ef('0x1'));var BPromise=require(_0x63ef('0x2'));var rp=require(_0x63ef('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x63ef('0x4'));var config=require(_0x63ef('0x5'));var attributes=require(_0x63ef('0x6'));module['exports']=function(_0x438b5a,_0x26b46e){return _0x438b5a[_0x63ef('0x7')](_0x63ef('0x8'),attributes,{'tableName':_0x63ef('0x9'),'paranoid':![],'indexes':[{'name':_0x63ef('0xa'),'fields':['uniqueid',_0x63ef('0xb')]},{'name':_0x63ef('0xc'),'fields':[_0x63ef('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xffb1=['./squareReport.attributes','define','report_square','uid_pname','uniqueid','leaveAt','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0xf3d167,_0x3ea98e){var _0x3cd413=function(_0x4deb88){while(--_0x4deb88){_0xf3d167['push'](_0xf3d167['shift']());}};_0x3cd413(++_0x3ea98e);}(_0xffb1,0x172));var _0x1ffb=function(_0x3eb630,_0x552586){_0x3eb630=_0x3eb630-0x0;var _0x1b840d=_0xffb1[_0x3eb630];return _0x1b840d;};'use strict';var _=require('lodash');var util=require(_0x1ffb('0x0'));var logger=require(_0x1ffb('0x1'))(_0x1ffb('0x2'));var moment=require(_0x1ffb('0x3'));var BPromise=require(_0x1ffb('0x4'));var rp=require(_0x1ffb('0x5'));var fs=require('fs');var path=require(_0x1ffb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x1ffb('0x7'));module['exports']=function(_0x2f515b,_0x3de5e7){return _0x2f515b[_0x1ffb('0x8')]('SquareReport',attributes,{'tableName':_0x1ffb('0x9'),'paranoid':![],'indexes':[{'name':_0x1ffb('0xa'),'fields':[_0x1ffb('0xb'),'project_name']},{'name':_0x1ffb('0xc'),'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 5c10568..81e0dea 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 _0xd0d3=['code','SquareReport,\x20%s,\x20%s','message','catch','CreateSquareReport','SquareReport','body','options','raw','then','UpdateSquareReport','update','attributes','limit','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','info','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x151334,_0x1e11ac){var _0x3d03da=function(_0x2099cf){while(--_0x2099cf){_0x151334['push'](_0x151334['shift']());}};_0x3d03da(++_0x1e11ac);}(_0xd0d3,0x16a));var _0x3d0d=function(_0x56621e,_0x355ad1){_0x56621e=_0x56621e-0x0;var _0x81f5ce=_0xd0d3[_0x56621e];return _0x81f5ce;};'use strict';var _=require('lodash');var util=require(_0x3d0d('0x0'));var moment=require(_0x3d0d('0x1'));var BPromise=require(_0x3d0d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3d0d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3d0d('0x4'))(_0x3d0d('0x5'));var config=require(_0x3d0d('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3d0d('0x7')][_0x3d0d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x46597e,_0x179afe,_0x545e2a){return new BPromise(function(_0x5751b3,_0x2f9a3e){return client['request'](_0x46597e,_0x545e2a)['then'](function(_0x29fe0b){logger[_0x3d0d('0x9')]('SquareReport,\x20%s,\x20%s',_0x179afe,_0x3d0d('0xa'));logger[_0x3d0d('0xb')](_0x3d0d('0xc'),_0x179afe,'request\x20sent',JSON[_0x3d0d('0xd')](_0x29fe0b));if(_0x29fe0b[_0x3d0d('0xe')]){if(_0x29fe0b[_0x3d0d('0xe')][_0x3d0d('0xf')]===0x1f4){logger[_0x3d0d('0xe')](_0x3d0d('0x10'),_0x179afe,_0x29fe0b[_0x3d0d('0xe')][_0x3d0d('0x11')]);return _0x2f9a3e(_0x29fe0b['error'][_0x3d0d('0x11')]);}logger[_0x3d0d('0xe')](_0x3d0d('0x10'),_0x179afe,_0x29fe0b[_0x3d0d('0xe')][_0x3d0d('0x11')]);return _0x5751b3(_0x29fe0b[_0x3d0d('0xe')][_0x3d0d('0x11')]);}else{logger['info'](_0x3d0d('0x10'),_0x179afe,_0x3d0d('0xa'));_0x5751b3(_0x29fe0b['result'][_0x3d0d('0x11')]);}})[_0x3d0d('0x12')](function(_0xd16936){logger[_0x3d0d('0xe')](_0x3d0d('0x10'),_0x179afe,_0xd16936);_0x2f9a3e(_0xd16936);});});}exports[_0x3d0d('0x13')]=function(_0x38117a){var _0x2a2584=this;return new Promise(function(_0x17c612,_0x3ee267){return db[_0x3d0d('0x14')]['create'](_0x38117a[_0x3d0d('0x15')],{'raw':_0x38117a[_0x3d0d('0x16')]?_0x38117a[_0x3d0d('0x16')][_0x3d0d('0x17')]===undefined?!![]:![]:!![]})[_0x3d0d('0x18')](function(_0x217d12){logger[_0x3d0d('0x9')](_0x3d0d('0x13'),_0x38117a);logger[_0x3d0d('0xb')](_0x3d0d('0x13'),_0x38117a,JSON['stringify'](_0x217d12));_0x17c612(_0x217d12);})[_0x3d0d('0x12')](function(_0x485f9e){logger['error'](_0x3d0d('0x13'),_0x485f9e['message'],_0x38117a);_0x3ee267(_0x2a2584['error'](0x1f4,_0x485f9e[_0x3d0d('0x11')]));});});};exports[_0x3d0d('0x19')]=function(_0x90d40f){var _0x36c4df=this;return new Promise(function(_0xbb80b9,_0x297fa2){return db[_0x3d0d('0x14')][_0x3d0d('0x1a')](_0x90d40f['body'],{'raw':_0x90d40f[_0x3d0d('0x16')]?_0x90d40f[_0x3d0d('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x90d40f[_0x3d0d('0x16')]?_0x90d40f[_0x3d0d('0x16')]['where']||null:null,'attributes':_0x90d40f[_0x3d0d('0x16')]?_0x90d40f['options'][_0x3d0d('0x1b')]||null:null,'limit':_0x90d40f['options']?_0x90d40f['options'][_0x3d0d('0x1c')]||null:null})[_0x3d0d('0x18')](function(_0x5de7af){logger[_0x3d0d('0x9')](_0x3d0d('0x19'),_0x90d40f);logger['debug'](_0x3d0d('0x19'),_0x90d40f,JSON[_0x3d0d('0xd')](_0x5de7af));_0xbb80b9(_0x5de7af);})['catch'](function(_0x304d4c){logger[_0x3d0d('0xe')](_0x3d0d('0x19'),_0x304d4c[_0x3d0d('0x11')],_0x90d40f);_0x297fa2(_0x36c4df[_0x3d0d('0xe')](0x1f4,_0x304d4c[_0x3d0d('0x11')]));});});}; \ No newline at end of file +var _0xe75d=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','client','http','request','then','info','SquareReport,\x20%s,\x20%s','debug','SquareReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','CreateSquareReport','SquareReport','body','options','raw','UpdateSquareReport','where','attributes','limit','stringify'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xe75d,0xf0));var _0xde75=function(_0x4bda94,_0x279d5c){_0x4bda94=_0x4bda94-0x0;var _0x1116ec=_0xe75d[_0x4bda94];return _0x1116ec;};'use strict';var _=require('lodash');var util=require(_0xde75('0x0'));var moment=require(_0xde75('0x1'));var BPromise=require(_0xde75('0x2'));var rs=require(_0xde75('0x3'));var fs=require('fs');var Redis=require(_0xde75('0x4'));var db=require(_0xde75('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xde75('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xde75('0x7')][_0xde75('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d1ae8,_0x214172,_0xc1532c){return new BPromise(function(_0x20cb31,_0x4f5684){return client[_0xde75('0x9')](_0x5d1ae8,_0xc1532c)[_0xde75('0xa')](function(_0x884d29){logger[_0xde75('0xb')](_0xde75('0xc'),_0x214172,'request\x20sent');logger[_0xde75('0xd')](_0xde75('0xe'),_0x214172,_0xde75('0xf'),JSON['stringify'](_0x884d29));if(_0x884d29[_0xde75('0x10')]){if(_0x884d29[_0xde75('0x10')]['code']===0x1f4){logger[_0xde75('0x10')](_0xde75('0xc'),_0x214172,_0x884d29[_0xde75('0x10')][_0xde75('0x11')]);return _0x4f5684(_0x884d29[_0xde75('0x10')]['message']);}logger['error'](_0xde75('0xc'),_0x214172,_0x884d29['error'][_0xde75('0x11')]);return _0x20cb31(_0x884d29[_0xde75('0x10')][_0xde75('0x11')]);}else{logger[_0xde75('0xb')](_0xde75('0xc'),_0x214172,_0xde75('0xf'));_0x20cb31(_0x884d29[_0xde75('0x12')][_0xde75('0x11')]);}})[_0xde75('0x13')](function(_0x10b052){logger[_0xde75('0x10')](_0xde75('0xc'),_0x214172,_0x10b052);_0x4f5684(_0x10b052);});});}exports[_0xde75('0x14')]=function(_0x483e89){var _0x2cde81=this;return new Promise(function(_0x475222,_0x157299){return db[_0xde75('0x15')]['create'](_0x483e89[_0xde75('0x16')],{'raw':_0x483e89[_0xde75('0x17')]?_0x483e89[_0xde75('0x17')][_0xde75('0x18')]===undefined?!![]:![]:!![]})[_0xde75('0xa')](function(_0x324353){logger[_0xde75('0xb')](_0xde75('0x14'),_0x483e89);logger['debug']('CreateSquareReport',_0x483e89,JSON['stringify'](_0x324353));_0x475222(_0x324353);})['catch'](function(_0x47c683){logger[_0xde75('0x10')](_0xde75('0x14'),_0x47c683[_0xde75('0x11')],_0x483e89);_0x157299(_0x2cde81[_0xde75('0x10')](0x1f4,_0x47c683[_0xde75('0x11')]));});});};exports[_0xde75('0x19')]=function(_0x1c90be){var _0x565e44=this;return new Promise(function(_0x14975e,_0x2563dd){return db[_0xde75('0x15')]['update'](_0x1c90be[_0xde75('0x16')],{'raw':_0x1c90be[_0xde75('0x17')]?_0x1c90be[_0xde75('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c90be[_0xde75('0x17')]?_0x1c90be[_0xde75('0x17')][_0xde75('0x1a')]||null:null,'attributes':_0x1c90be['options']?_0x1c90be[_0xde75('0x17')][_0xde75('0x1b')]||null:null,'limit':_0x1c90be['options']?_0x1c90be[_0xde75('0x17')][_0xde75('0x1c')]||null:null})['then'](function(_0x14a69a){logger[_0xde75('0xb')](_0xde75('0x19'),_0x1c90be);logger[_0xde75('0xd')](_0xde75('0x19'),_0x1c90be,JSON[_0xde75('0x1d')](_0x14a69a));_0x14975e(_0x14a69a);})[_0xde75('0x13')](function(_0x5d57f2){logger[_0xde75('0x10')](_0xde75('0x19'),_0x5d57f2[_0xde75('0x11')],_0x1c90be);_0x2563dd(_0x565e44['error'](0x1f4,_0x5d57f2[_0xde75('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index dbe9294..2a96b57 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 _0x2464=['create','put','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./squareReportDetail.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0x2464,0xb5));var _0x4246=function(_0x356478,_0x590be1){_0x356478=_0x356478-0x0;var _0x17bd00=_0x2464[_0x356478];return _0x17bd00;};'use strict';var multer=require(_0x4246('0x0'));var util=require(_0x4246('0x1'));var path=require('path');var timeout=require(_0x4246('0x2'));var express=require(_0x4246('0x3'));var router=express[_0x4246('0x4')]();var fs_extra=require(_0x4246('0x5'));var auth=require(_0x4246('0x6'));var interaction=require(_0x4246('0x7'));var config=require('../../config/environment');var controller=require(_0x4246('0x8'));router[_0x4246('0x9')]('/',auth[_0x4246('0xa')](),controller[_0x4246('0xb')]);router[_0x4246('0x9')](_0x4246('0xc'),auth[_0x4246('0xa')](),controller[_0x4246('0xd')]);router[_0x4246('0x9')](_0x4246('0xe'),auth['isAuthenticated'](),controller[_0x4246('0xf')]);router[_0x4246('0x10')]('/',auth[_0x4246('0xa')](),controller[_0x4246('0x11')]);router[_0x4246('0x12')](_0x4246('0xe'),auth['isAuthenticated'](),controller[_0x4246('0x13')]);router[_0x4246('0x14')](_0x4246('0xe'),auth[_0x4246('0xa')](),controller[_0x4246('0x15')]);module['exports']=router; \ No newline at end of file +var _0xdac8=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get'];(function(_0x3a7a9c,_0x24f7d6){var _0x59156e=function(_0x5bc930){while(--_0x5bc930){_0x3a7a9c['push'](_0x3a7a9c['shift']());}};_0x59156e(++_0x24f7d6);}(_0xdac8,0x7c));var _0x8dac=function(_0x106d25,_0x247cc4){_0x106d25=_0x106d25-0x0;var _0x7e5a07=_0xdac8[_0x106d25];return _0x7e5a07;};'use strict';var multer=require('multer');var util=require(_0x8dac('0x0'));var path=require(_0x8dac('0x1'));var timeout=require(_0x8dac('0x2'));var express=require('express');var router=express[_0x8dac('0x3')]();var fs_extra=require(_0x8dac('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x8dac('0x5'));var config=require(_0x8dac('0x6'));var controller=require(_0x8dac('0x7'));router[_0x8dac('0x8')]('/',auth[_0x8dac('0x9')](),controller[_0x8dac('0xa')]);router['get']('/describe',auth[_0x8dac('0x9')](),controller['describe']);router[_0x8dac('0x8')](_0x8dac('0xb'),auth[_0x8dac('0x9')](),controller[_0x8dac('0xc')]);router[_0x8dac('0xd')]('/',auth[_0x8dac('0x9')](),controller[_0x8dac('0xe')]);router[_0x8dac('0xf')](_0x8dac('0xb'),auth[_0x8dac('0x9')](),controller['update']);router[_0x8dac('0x10')](_0x8dac('0xb'),auth[_0x8dac('0x9')](),controller[_0x8dac('0x11')]);module[_0x8dac('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 5e933be..7e02d81 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 _0x4283=['STRING','TEXT','sequelize','exports'];(function(_0x5aa023,_0x1cf1d2){var _0x31ceb5=function(_0x40f643){while(--_0x40f643){_0x5aa023['push'](_0x5aa023['shift']());}};_0x31ceb5(++_0x1cf1d2);}(_0x4283,0x1c6));var _0x3428=function(_0xb25e3,_0x34dbad){_0xb25e3=_0xb25e3-0x0;var _0x3236fe=_0x4283[_0xb25e3];return _0x3236fe;};'use strict';var Sequelize=require(_0x3428('0x0'));module[_0x3428('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'node':{'type':Sequelize[_0x3428('0x2')]},'application':{'type':Sequelize[_0x3428('0x2')]},'data':{'type':Sequelize[_0x3428('0x3')]},'project_name':{'type':Sequelize[_0x3428('0x2')]},'callerid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xffb5=['TEXT','exports','STRING'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0xffb5,0x70));var _0x5ffb=function(_0x1d9dd1,_0x189813){_0x1d9dd1=_0x1d9dd1-0x0;var _0x33a326=_0xffb5[_0x1d9dd1];return _0x33a326;};'use strict';var Sequelize=require('sequelize');module[_0x5ffb('0x0')]={'uniqueid':{'type':Sequelize[_0x5ffb('0x1')]},'node':{'type':Sequelize['STRING']},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x5ffb('0x2')]},'project_name':{'type':Sequelize[_0x5ffb('0x1')]},'callerid':{'type':Sequelize[_0x5ffb('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index f670de9..9829b93 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 _0xd2ff=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','SquareDetailsReport','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x2a534f,_0x23705b){var _0x23d365=function(_0x2f5849){while(--_0x2f5849){_0x2a534f['push'](_0x2a534f['shift']());}};_0x23d365(++_0x23705b);}(_0xd2ff,0x1e2));var _0xfd2f=function(_0x4d8dc9,_0x544834){_0x4d8dc9=_0x4d8dc9-0x0;var _0x349d02=_0xd2ff[_0x4d8dc9];return _0x349d02;};'use strict';var emlformat=require(_0xfd2f('0x0'));var rimraf=require(_0xfd2f('0x1'));var zipdir=require(_0xfd2f('0x2'));var jsonpatch=require(_0xfd2f('0x3'));var rp=require('request-promise');var moment=require(_0xfd2f('0x4'));var BPromise=require(_0xfd2f('0x5'));var Mustache=require(_0xfd2f('0x6'));var util=require(_0xfd2f('0x7'));var path=require(_0xfd2f('0x8'));var sox=require(_0xfd2f('0x9'));var csv=require(_0xfd2f('0xa'));var ejs=require(_0xfd2f('0xb'));var fs=require('fs');var fs_extra=require(_0xfd2f('0xc'));var _=require(_0xfd2f('0xd'));var squel=require('squel');var crypto=require(_0xfd2f('0xe'));var jsforce=require(_0xfd2f('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xfd2f('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xfd2f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xfd2f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfd2f('0x12'));var config=require(_0xfd2f('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xfd2f('0x14'))['db'];function respondWithStatusCode(_0x152687,_0x4c7aa1){_0x4c7aa1=_0x4c7aa1||0xcc;return function(_0x45dfd7){if(_0x45dfd7){return _0x152687[_0xfd2f('0x15')](_0x4c7aa1);}return _0x152687[_0xfd2f('0x16')](_0x4c7aa1)[_0xfd2f('0x17')]();};}function respondWithResult(_0x3ad5cc,_0x2552ca){_0x2552ca=_0x2552ca||0xc8;return function(_0x5c269b){if(_0x5c269b){return _0x3ad5cc[_0xfd2f('0x16')](_0x2552ca)['json'](_0x5c269b);}};}function respondWithFilteredResult(_0x1435f3,_0x564377){return function(_0x7d038a){if(_0x7d038a){var _0x521690=typeof _0x564377[_0xfd2f('0x18')]===_0xfd2f('0x19')&&typeof _0x564377[_0xfd2f('0x1a')]===_0xfd2f('0x19');var _0x2193a5=_0x7d038a[_0xfd2f('0x1b')];var _0x111dfa=_0x521690?0x0:_0x564377[_0xfd2f('0x18')];var _0x12992a=_0x521690?_0x7d038a[_0xfd2f('0x1b')]:_0x564377['offset']+_0x564377[_0xfd2f('0x1a')];var _0x2c38a3;if(_0x12992a>=_0x2193a5){_0x12992a=_0x2193a5;_0x2c38a3=0xc8;}else{_0x2c38a3=0xce;}_0x1435f3[_0xfd2f('0x16')](_0x2c38a3);return _0x1435f3[_0xfd2f('0x1c')](_0xfd2f('0x1d'),_0x111dfa+'-'+_0x12992a+'/'+_0x2193a5)[_0xfd2f('0x1e')](_0x7d038a);}return null;};}function patchUpdates(_0x252fa4){return function(_0x4d5ec1){try{jsonpatch[_0xfd2f('0x1f')](_0x4d5ec1,_0x252fa4,!![]);}catch(_0x246848){return BPromise[_0xfd2f('0x20')](_0x246848);}return _0x4d5ec1[_0xfd2f('0x21')]();};}function saveUpdates(_0x25ad8c,_0x30a5ce){return function(_0x3a58bd){if(_0x3a58bd){return _0x3a58bd['update'](_0x25ad8c)[_0xfd2f('0x22')](function(_0x47ba69){return _0x47ba69;});}return null;};}function removeEntity(_0xd9380e,_0x159008){return function(_0x3facfd){if(_0x3facfd){return _0x3facfd[_0xfd2f('0x23')]()[_0xfd2f('0x22')](function(){_0xd9380e['status'](0xcc)[_0xfd2f('0x17')]();});}};}function handleEntityNotFound(_0x13f492,_0x3b611d){return function(_0x3df5cb){if(!_0x3df5cb){_0x13f492[_0xfd2f('0x15')](0x194);}return _0x3df5cb;};}function handleError(_0x340cd9,_0x577ac6){_0x577ac6=_0x577ac6||0x1f4;return function(_0x4b0a90){logger[_0xfd2f('0x24')](_0x4b0a90[_0xfd2f('0x25')]);if(_0x4b0a90[_0xfd2f('0x26')]){delete _0x4b0a90[_0xfd2f('0x26')];}_0x340cd9[_0xfd2f('0x16')](_0x577ac6)['send'](_0x4b0a90);};}exports['index']=function(_0x35b378,_0x25c43e){var _0x12004b={},_0x4d1346={},_0x2ae2f1={'count':0x0,'rows':[]};var _0x5e6f41=_['map'](db[_0xfd2f('0x27')][_0xfd2f('0x28')],function(_0x2f1fce){return{'name':_0x2f1fce[_0xfd2f('0x29')],'type':_0x2f1fce[_0xfd2f('0x2a')]['key']};});_0x4d1346['model']=_[_0xfd2f('0x2b')](_0x5e6f41,_0xfd2f('0x26'));_0x4d1346[_0xfd2f('0x2c')]=_['keys'](_0x35b378[_0xfd2f('0x2c')]);_0x4d1346[_0xfd2f('0x2d')]=_[_0xfd2f('0x2e')](_0x4d1346[_0xfd2f('0x2f')],_0x4d1346[_0xfd2f('0x2c')]);_0x12004b[_0xfd2f('0x30')]=_['intersection'](_0x4d1346[_0xfd2f('0x2f')],qs[_0xfd2f('0x31')](_0x35b378[_0xfd2f('0x2c')][_0xfd2f('0x31')]));_0x12004b[_0xfd2f('0x30')]=_0x12004b[_0xfd2f('0x30')][_0xfd2f('0x32')]?_0x12004b[_0xfd2f('0x30')]:_0x4d1346[_0xfd2f('0x2f')];if(!_0x35b378[_0xfd2f('0x2c')]['hasOwnProperty']('nolimit')){_0x12004b['limit']=qs[_0xfd2f('0x1a')](_0x35b378[_0xfd2f('0x2c')][_0xfd2f('0x1a')]);_0x12004b[_0xfd2f('0x18')]=qs['offset'](_0x35b378['query'][_0xfd2f('0x18')]);}_0x12004b[_0xfd2f('0x33')]=qs[_0xfd2f('0x34')](_0x35b378[_0xfd2f('0x2c')][_0xfd2f('0x34')]);_0x12004b[_0xfd2f('0x35')]=qs[_0xfd2f('0x2d')](_[_0xfd2f('0x36')](_0x35b378[_0xfd2f('0x2c')],_0x4d1346[_0xfd2f('0x2d')]),_0x5e6f41);if(_0x35b378[_0xfd2f('0x2c')][_0xfd2f('0x37')]){_0x12004b[_0xfd2f('0x35')]=_[_0xfd2f('0x38')](_0x12004b[_0xfd2f('0x35')],{'$or':_[_0xfd2f('0x2b')](_0x5e6f41,function(_0x2c3fc1){if(_0x2c3fc1[_0xfd2f('0x2a')]!==_0xfd2f('0x39')){var _0x511c5d={};_0x511c5d[_0x2c3fc1[_0xfd2f('0x26')]]={'$like':'%'+_0x35b378[_0xfd2f('0x2c')][_0xfd2f('0x37')]+'%'};return _0x511c5d;}})});}_0x12004b=_[_0xfd2f('0x38')]({},_0x12004b,_0x35b378[_0xfd2f('0x3a')]);var _0x235cbe={'where':_0x12004b[_0xfd2f('0x35')]};return db[_0xfd2f('0x27')][_0xfd2f('0x1b')](_0x235cbe)['then'](function(_0x724bb7){_0x2ae2f1[_0xfd2f('0x1b')]=_0x724bb7;if(_0x35b378[_0xfd2f('0x2c')][_0xfd2f('0x3b')]){_0x12004b[_0xfd2f('0x3c')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0xfd2f('0x3d')](_0x12004b);})[_0xfd2f('0x22')](function(_0x172593){_0x2ae2f1['rows']=_0x172593;return _0x2ae2f1;})[_0xfd2f('0x22')](respondWithFilteredResult(_0x25c43e,_0x12004b))['catch'](handleError(_0x25c43e,null));};exports[_0xfd2f('0x3e')]=function(_0xd94de0,_0x309dd7){var _0x55054b={'raw':!![],'where':{'id':_0xd94de0[_0xfd2f('0x3f')]['id']}},_0x134c0b={};_0x134c0b['model']=_[_0xfd2f('0x40')](db[_0xfd2f('0x27')]['rawAttributes']);_0x134c0b['query']=_['keys'](_0xd94de0[_0xfd2f('0x2c')]);_0x134c0b[_0xfd2f('0x2d')]=_[_0xfd2f('0x2e')](_0x134c0b[_0xfd2f('0x2f')],_0x134c0b[_0xfd2f('0x2c')]);_0x55054b[_0xfd2f('0x30')]=_[_0xfd2f('0x2e')](_0x134c0b[_0xfd2f('0x2f')],qs['fields'](_0xd94de0[_0xfd2f('0x2c')][_0xfd2f('0x31')]));_0x55054b[_0xfd2f('0x30')]=_0x55054b[_0xfd2f('0x30')][_0xfd2f('0x32')]?_0x55054b[_0xfd2f('0x30')]:_0x134c0b[_0xfd2f('0x2f')];if(_0xd94de0[_0xfd2f('0x2c')][_0xfd2f('0x3b')]){_0x55054b[_0xfd2f('0x3c')]=[{'all':!![]}];}_0x55054b=_[_0xfd2f('0x38')]({},_0x55054b,_0xd94de0['options']);return db['SquareDetailsReport'][_0xfd2f('0x41')](_0x55054b)[_0xfd2f('0x22')](handleEntityNotFound(_0x309dd7,null))[_0xfd2f('0x22')](respondWithResult(_0x309dd7,null))['catch'](handleError(_0x309dd7,null));};exports[_0xfd2f('0x42')]=function(_0x5357d3,_0x3e6477){return db[_0xfd2f('0x27')][_0xfd2f('0x42')](_0x5357d3[_0xfd2f('0x43')],{})[_0xfd2f('0x22')](respondWithResult(_0x3e6477,0xc9))['catch'](handleError(_0x3e6477,null));};exports['update']=function(_0x4e656f,_0x1a82a3){if(_0x4e656f[_0xfd2f('0x43')]['id']){delete _0x4e656f[_0xfd2f('0x43')]['id'];}return db[_0xfd2f('0x27')][_0xfd2f('0x41')]({'where':{'id':_0x4e656f['params']['id']}})['then'](handleEntityNotFound(_0x1a82a3,null))[_0xfd2f('0x22')](saveUpdates(_0x4e656f[_0xfd2f('0x43')],null))[_0xfd2f('0x22')](respondWithResult(_0x1a82a3,null))[_0xfd2f('0x44')](handleError(_0x1a82a3,null));};exports[_0xfd2f('0x23')]=function(_0x272c29,_0x10d211){return db[_0xfd2f('0x27')][_0xfd2f('0x41')]({'where':{'id':_0x272c29[_0xfd2f('0x3f')]['id']}})[_0xfd2f('0x22')](handleEntityNotFound(_0x10d211,null))[_0xfd2f('0x22')](removeEntity(_0x10d211,null))[_0xfd2f('0x44')](handleError(_0x10d211,null));};exports[_0xfd2f('0x45')]=function(_0x26345c,_0x16afe1){return db[_0xfd2f('0x27')][_0xfd2f('0x45')]()[_0xfd2f('0x22')](respondWithResult(_0x16afe1,null))[_0xfd2f('0x44')](handleError(_0x16afe1,null));}; \ No newline at end of file +var _0xe40f=['key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','stack','name','send','index','map','SquareDetailsReport','rawAttributes'];(function(_0x4a8127,_0x983d77){var _0x4f0d36=function(_0x36b07c){while(--_0x36b07c){_0x4a8127['push'](_0x4a8127['shift']());}};_0x4f0d36(++_0x983d77);}(_0xe40f,0x1d3));var _0xfe40=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xe40f[_0x432682];return _0x463d05;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xfe40('0x0'));var jsonpatch=require(_0xfe40('0x1'));var rp=require(_0xfe40('0x2'));var moment=require(_0xfe40('0x3'));var BPromise=require(_0xfe40('0x4'));var Mustache=require(_0xfe40('0x5'));var util=require('util');var path=require(_0xfe40('0x6'));var sox=require(_0xfe40('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfe40('0x8'));var _=require(_0xfe40('0x9'));var squel=require(_0xfe40('0xa'));var crypto=require(_0xfe40('0xb'));var jsforce=require(_0xfe40('0xc'));var deskjs=require(_0xfe40('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfe40('0xe'));var Papa=require(_0xfe40('0xf'));var Redis=require(_0xfe40('0x10'));var authService=require(_0xfe40('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xfe40('0x12'));var config=require(_0xfe40('0x13'));var licenseUtil=require(_0xfe40('0x14'));var db=require(_0xfe40('0x15'))['db'];function respondWithStatusCode(_0x51384d,_0x1ed140){_0x1ed140=_0x1ed140||0xcc;return function(_0x2d46f8){if(_0x2d46f8){return _0x51384d[_0xfe40('0x16')](_0x1ed140);}return _0x51384d[_0xfe40('0x17')](_0x1ed140)[_0xfe40('0x18')]();};}function respondWithResult(_0x4eaaba,_0x20f921){_0x20f921=_0x20f921||0xc8;return function(_0xd49ee2){if(_0xd49ee2){return _0x4eaaba['status'](_0x20f921)[_0xfe40('0x19')](_0xd49ee2);}};}function respondWithFilteredResult(_0x7f0243,_0x2b0393){return function(_0x33c7ea){if(_0x33c7ea){var _0x95a6c9=typeof _0x2b0393[_0xfe40('0x1a')]===_0xfe40('0x1b')&&typeof _0x2b0393[_0xfe40('0x1c')]==='undefined';var _0x8e9239=_0x33c7ea[_0xfe40('0x1d')];var _0x1e5c07=_0x95a6c9?0x0:_0x2b0393[_0xfe40('0x1a')];var _0x1cd5c3=_0x95a6c9?_0x33c7ea[_0xfe40('0x1d')]:_0x2b0393['offset']+_0x2b0393[_0xfe40('0x1c')];var _0x50fa69;if(_0x1cd5c3>=_0x8e9239){_0x1cd5c3=_0x8e9239;_0x50fa69=0xc8;}else{_0x50fa69=0xce;}_0x7f0243[_0xfe40('0x17')](_0x50fa69);return _0x7f0243[_0xfe40('0x1e')]('Content-Range',_0x1e5c07+'-'+_0x1cd5c3+'/'+_0x8e9239)['json'](_0x33c7ea);}return null;};}function patchUpdates(_0x509364){return function(_0x4b4d87){try{jsonpatch[_0xfe40('0x1f')](_0x4b4d87,_0x509364,!![]);}catch(_0x5cfdbd){return BPromise[_0xfe40('0x20')](_0x5cfdbd);}return _0x4b4d87[_0xfe40('0x21')]();};}function saveUpdates(_0x480dd0,_0x23bd42){return function(_0x5e28c2){if(_0x5e28c2){return _0x5e28c2[_0xfe40('0x22')](_0x480dd0)[_0xfe40('0x23')](function(_0x4d8ca6){return _0x4d8ca6;});}return null;};}function removeEntity(_0x8db831,_0x179b0e){return function(_0x566662){if(_0x566662){return _0x566662[_0xfe40('0x24')]()[_0xfe40('0x23')](function(){_0x8db831[_0xfe40('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x172d04,_0x5ad8c0){return function(_0x1788be){if(!_0x1788be){_0x172d04[_0xfe40('0x16')](0x194);}return _0x1788be;};}function handleError(_0x1e0d93,_0x5cb385){_0x5cb385=_0x5cb385||0x1f4;return function(_0x543d2a){logger['error'](_0x543d2a[_0xfe40('0x25')]);if(_0x543d2a['name']){delete _0x543d2a[_0xfe40('0x26')];}_0x1e0d93[_0xfe40('0x17')](_0x5cb385)[_0xfe40('0x27')](_0x543d2a);};}exports[_0xfe40('0x28')]=function(_0x3989fd,_0x41d30d){var _0x28aa07={},_0x559a3f={},_0x4edfd7={'count':0x0,'rows':[]};var _0xedc67c=_[_0xfe40('0x29')](db[_0xfe40('0x2a')][_0xfe40('0x2b')],function(_0x3693a4){return{'name':_0x3693a4['fieldName'],'type':_0x3693a4['type'][_0xfe40('0x2c')]};});_0x559a3f[_0xfe40('0x2d')]=_[_0xfe40('0x29')](_0xedc67c,_0xfe40('0x26'));_0x559a3f[_0xfe40('0x2e')]=_['keys'](_0x3989fd[_0xfe40('0x2e')]);_0x559a3f[_0xfe40('0x2f')]=_[_0xfe40('0x30')](_0x559a3f[_0xfe40('0x2d')],_0x559a3f['query']);_0x28aa07[_0xfe40('0x31')]=_[_0xfe40('0x30')](_0x559a3f[_0xfe40('0x2d')],qs[_0xfe40('0x32')](_0x3989fd['query'][_0xfe40('0x32')]));_0x28aa07[_0xfe40('0x31')]=_0x28aa07['attributes']['length']?_0x28aa07['attributes']:_0x559a3f[_0xfe40('0x2d')];if(!_0x3989fd[_0xfe40('0x2e')][_0xfe40('0x33')](_0xfe40('0x34'))){_0x28aa07[_0xfe40('0x1c')]=qs[_0xfe40('0x1c')](_0x3989fd[_0xfe40('0x2e')]['limit']);_0x28aa07[_0xfe40('0x1a')]=qs[_0xfe40('0x1a')](_0x3989fd[_0xfe40('0x2e')][_0xfe40('0x1a')]);}_0x28aa07[_0xfe40('0x35')]=qs[_0xfe40('0x36')](_0x3989fd[_0xfe40('0x2e')]['sort']);_0x28aa07[_0xfe40('0x37')]=qs[_0xfe40('0x2f')](_[_0xfe40('0x38')](_0x3989fd['query'],_0x559a3f[_0xfe40('0x2f')]),_0xedc67c);if(_0x3989fd['query']['filter']){_0x28aa07['where']=_['merge'](_0x28aa07[_0xfe40('0x37')],{'$or':_[_0xfe40('0x29')](_0xedc67c,function(_0x456870){if(_0x456870['type']!==_0xfe40('0x39')){var _0x2ed9b0={};_0x2ed9b0[_0x456870[_0xfe40('0x26')]]={'$like':'%'+_0x3989fd['query']['filter']+'%'};return _0x2ed9b0;}})});}_0x28aa07=_[_0xfe40('0x3a')]({},_0x28aa07,_0x3989fd[_0xfe40('0x3b')]);var _0xa2954f={'where':_0x28aa07[_0xfe40('0x37')]};return db[_0xfe40('0x2a')][_0xfe40('0x1d')](_0xa2954f)[_0xfe40('0x23')](function(_0x4e62f8){_0x4edfd7[_0xfe40('0x1d')]=_0x4e62f8;if(_0x3989fd[_0xfe40('0x2e')][_0xfe40('0x3c')]){_0x28aa07[_0xfe40('0x3d')]=[{'all':!![]}];}return db[_0xfe40('0x2a')][_0xfe40('0x3e')](_0x28aa07);})['then'](function(_0x3b2213){_0x4edfd7[_0xfe40('0x3f')]=_0x3b2213;return _0x4edfd7;})[_0xfe40('0x23')](respondWithFilteredResult(_0x41d30d,_0x28aa07))[_0xfe40('0x40')](handleError(_0x41d30d,null));};exports[_0xfe40('0x41')]=function(_0x282f20,_0x3e291b){var _0x32ed0d={'raw':!![],'where':{'id':_0x282f20['params']['id']}},_0xbb763b={};_0xbb763b[_0xfe40('0x2d')]=_['keys'](db[_0xfe40('0x2a')][_0xfe40('0x2b')]);_0xbb763b[_0xfe40('0x2e')]=_[_0xfe40('0x42')](_0x282f20[_0xfe40('0x2e')]);_0xbb763b[_0xfe40('0x2f')]=_[_0xfe40('0x30')](_0xbb763b[_0xfe40('0x2d')],_0xbb763b[_0xfe40('0x2e')]);_0x32ed0d[_0xfe40('0x31')]=_[_0xfe40('0x30')](_0xbb763b[_0xfe40('0x2d')],qs['fields'](_0x282f20[_0xfe40('0x2e')][_0xfe40('0x32')]));_0x32ed0d[_0xfe40('0x31')]=_0x32ed0d[_0xfe40('0x31')][_0xfe40('0x43')]?_0x32ed0d[_0xfe40('0x31')]:_0xbb763b[_0xfe40('0x2d')];if(_0x282f20['query'][_0xfe40('0x3c')]){_0x32ed0d[_0xfe40('0x3d')]=[{'all':!![]}];}_0x32ed0d=_[_0xfe40('0x3a')]({},_0x32ed0d,_0x282f20[_0xfe40('0x3b')]);return db[_0xfe40('0x2a')][_0xfe40('0x44')](_0x32ed0d)[_0xfe40('0x23')](handleEntityNotFound(_0x3e291b,null))[_0xfe40('0x23')](respondWithResult(_0x3e291b,null))[_0xfe40('0x40')](handleError(_0x3e291b,null));};exports['create']=function(_0x3b07df,_0x2b5d31){return db[_0xfe40('0x2a')][_0xfe40('0x45')](_0x3b07df['body'],{})[_0xfe40('0x23')](respondWithResult(_0x2b5d31,0xc9))[_0xfe40('0x40')](handleError(_0x2b5d31,null));};exports[_0xfe40('0x22')]=function(_0x43f4f6,_0x4dbc2d){if(_0x43f4f6[_0xfe40('0x46')]['id']){delete _0x43f4f6[_0xfe40('0x46')]['id'];}return db['SquareDetailsReport'][_0xfe40('0x44')]({'where':{'id':_0x43f4f6['params']['id']}})[_0xfe40('0x23')](handleEntityNotFound(_0x4dbc2d,null))[_0xfe40('0x23')](saveUpdates(_0x43f4f6['body'],null))[_0xfe40('0x23')](respondWithResult(_0x4dbc2d,null))[_0xfe40('0x40')](handleError(_0x4dbc2d,null));};exports[_0xfe40('0x24')]=function(_0x49fa9d,_0x5bf4db){return db[_0xfe40('0x2a')]['find']({'where':{'id':_0x49fa9d[_0xfe40('0x47')]['id']}})['then'](handleEntityNotFound(_0x5bf4db,null))[_0xfe40('0x23')](removeEntity(_0x5bf4db,null))[_0xfe40('0x40')](handleError(_0x5bf4db,null));};exports['describe']=function(_0x18acd1,_0x58c6d0){return db[_0xfe40('0x2a')][_0xfe40('0x48')]()[_0xfe40('0x23')](respondWithResult(_0x58c6d0,null))[_0xfe40('0x40')](handleError(_0x58c6d0,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 82db079..ea731e7 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 _0x6b7e=['rimraf','../../config/environment','exports','SquareDetailsReport','report_square_details','lodash','util','api','bluebird'];(function(_0x4ebdba,_0x54cf50){var _0x1d8bb6=function(_0x1afc7c){while(--_0x1afc7c){_0x4ebdba['push'](_0x4ebdba['shift']());}};_0x1d8bb6(++_0x54cf50);}(_0x6b7e,0xd4));var _0xe6b7=function(_0x17e8e5,_0x1a6720){_0x17e8e5=_0x17e8e5-0x0;var _0x44de95=_0x6b7e[_0x17e8e5];return _0x44de95;};'use strict';var _=require(_0xe6b7('0x0'));var util=require(_0xe6b7('0x1'));var logger=require('../../config/logger')(_0xe6b7('0x2'));var moment=require('moment');var BPromise=require(_0xe6b7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xe6b7('0x4'));var config=require(_0xe6b7('0x5'));var attributes=require('./squareReportDetail.attributes');module[_0xe6b7('0x6')]=function(_0x1600b3,_0xfcea8b){return _0x1600b3['define'](_0xe6b7('0x7'),attributes,{'tableName':_0xe6b7('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x96cf=['define','report_square_details','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x1161eb,_0x1d33ea){var _0x5b6184=function(_0x495bb1){while(--_0x495bb1){_0x1161eb['push'](_0x1161eb['shift']());}};_0x5b6184(++_0x1d33ea);}(_0x96cf,0x6a));var _0xf96c=function(_0x1d99b0,_0x218fc8){_0x1d99b0=_0x1d99b0-0x0;var _0xff07fa=_0x96cf[_0x1d99b0];return _0xff07fa;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf96c('0x0'));var BPromise=require(_0xf96c('0x1'));var rp=require(_0xf96c('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf96c('0x3'));var config=require(_0xf96c('0x4'));var attributes=require('./squareReportDetail.attributes');module[_0xf96c('0x5')]=function(_0x17a0b8,_0x4906b7){return _0x17a0b8[_0xf96c('0x6')]('SquareDetailsReport',attributes,{'tableName':_0xf96c('0x7'),'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 f09e846..6e8b0c3 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 _0x160f=['../../config/environment','client','http','then','info','SquareDetailsReport,\x20%s,\x20%s','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1897e0,_0x5eb979){var _0x112e74=function(_0x31d030){while(--_0x31d030){_0x1897e0['push'](_0x1897e0['shift']());}};_0x112e74(++_0x5eb979);}(_0x160f,0x1ef));var _0xf160=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x160f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf160('0x0'));var util=require(_0xf160('0x1'));var moment=require(_0xf160('0x2'));var BPromise=require(_0xf160('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf160('0x4'));var db=require(_0xf160('0x5'))['db'];var utils=require(_0xf160('0x6'));var logger=require(_0xf160('0x7'))(_0xf160('0x8'));var config=require(_0xf160('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf160('0xa')][_0xf160('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49fe49,_0x59440e,_0x41e909){return new BPromise(function(_0x5b76c8,_0x4bf890){return client['request'](_0x49fe49,_0x41e909)[_0xf160('0xc')](function(_0x90608){logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,'request\x20sent');logger['debug'](_0xf160('0xf'),_0x59440e,_0xf160('0x10'),JSON[_0xf160('0x11')](_0x90608));if(_0x90608['error']){if(_0x90608[_0xf160('0x12')][_0xf160('0x13')]===0x1f4){logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')]['message']);return _0x4bf890(_0x90608[_0xf160('0x12')]['message']);}logger[_0xf160('0x12')](_0xf160('0xe'),_0x59440e,_0x90608[_0xf160('0x12')][_0xf160('0x14')]);return _0x5b76c8(_0x90608[_0xf160('0x12')][_0xf160('0x14')]);}else{logger[_0xf160('0xd')](_0xf160('0xe'),_0x59440e,_0xf160('0x10'));_0x5b76c8(_0x90608['result'][_0xf160('0x14')]);}})[_0xf160('0x15')](function(_0x8699a0){logger[_0xf160('0x12')]('SquareDetailsReport,\x20%s,\x20%s',_0x59440e,_0x8699a0);_0x4bf890(_0x8699a0);});});}exports[_0xf160('0x16')]=function(_0x4b8185){var _0x5388c7=this;return new Promise(function(_0x1cf6ba,_0x1e0c78){return db[_0xf160('0x17')][_0xf160('0x18')](_0x4b8185[_0xf160('0x19')],{'raw':_0x4b8185[_0xf160('0x1a')]?_0x4b8185[_0xf160('0x1a')][_0xf160('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x40ccf0){logger[_0xf160('0xd')](_0xf160('0x16'),_0x4b8185);logger['debug'](_0xf160('0x16'),_0x4b8185,JSON[_0xf160('0x11')](_0x40ccf0));_0x1cf6ba(_0x40ccf0);})[_0xf160('0x15')](function(_0x36d0cb){logger[_0xf160('0x12')](_0xf160('0x16'),_0x36d0cb[_0xf160('0x14')],_0x4b8185);_0x1e0c78(_0x5388c7['error'](0x1f4,_0x36d0cb[_0xf160('0x14')]));});});}; \ No newline at end of file +var _0x594d=['then','info','SquareDetailsReport,\x20%s,\x20%s','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','create','options','raw','CreateSquareDetailsReport','stringify','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','request'];(function(_0x7bab0,_0x1d95eb){var _0x2508d4=function(_0x3137c9){while(--_0x3137c9){_0x7bab0['push'](_0x7bab0['shift']());}};_0x2508d4(++_0x1d95eb);}(_0x594d,0x92));var _0xd594=function(_0x1d2c32,_0x39976a){_0x1d2c32=_0x1d2c32-0x0;var _0x2d0f4f=_0x594d[_0x1d2c32];return _0x2d0f4f;};'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});function respondWithRpcPromise(_0x3b1c64,_0x446711,_0xeedad0){return new BPromise(function(_0x20325a,_0x20718a){return client[_0xd594('0x9')](_0x3b1c64,_0xeedad0)[_0xd594('0xa')](function(_0xf3043e){logger[_0xd594('0xb')](_0xd594('0xc'),_0x446711,'request\x20sent');logger[_0xd594('0xd')](_0xd594('0xe'),_0x446711,_0xd594('0xf'),JSON['stringify'](_0xf3043e));if(_0xf3043e[_0xd594('0x10')]){if(_0xf3043e[_0xd594('0x10')][_0xd594('0x11')]===0x1f4){logger[_0xd594('0x10')](_0xd594('0xc'),_0x446711,_0xf3043e[_0xd594('0x10')][_0xd594('0x12')]);return _0x20718a(_0xf3043e['error']['message']);}logger[_0xd594('0x10')](_0xd594('0xc'),_0x446711,_0xf3043e['error'][_0xd594('0x12')]);return _0x20325a(_0xf3043e['error'][_0xd594('0x12')]);}else{logger[_0xd594('0xb')](_0xd594('0xc'),_0x446711,'request\x20sent');_0x20325a(_0xf3043e[_0xd594('0x13')]['message']);}})['catch'](function(_0x2a5f17){logger[_0xd594('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x446711,_0x2a5f17);_0x20718a(_0x2a5f17);});});}exports['CreateSquareDetailsReport']=function(_0x232776){var _0x4ea0d5=this;return new Promise(function(_0x54f640,_0x3ae9be){return db['SquareDetailsReport'][_0xd594('0x14')](_0x232776['body'],{'raw':_0x232776[_0xd594('0x15')]?_0x232776['options'][_0xd594('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x3b0fda){logger[_0xd594('0xb')](_0xd594('0x17'),_0x232776);logger[_0xd594('0xd')](_0xd594('0x17'),_0x232776,JSON[_0xd594('0x18')](_0x3b0fda));_0x54f640(_0x3b0fda);})[_0xd594('0x19')](function(_0x2b8495){logger[_0xd594('0x10')](_0xd594('0x17'),_0x2b8495[_0xd594('0x12')],_0x232776);_0x3ae9be(_0x4ea0d5[_0xd594('0x10')](0x1f4,_0x2b8495[_0xd594('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index e3b9901..17446b1 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 _0xa447=['../../components/auth/service','./system.controller','get','isAuthenticated','/process/:pid/kill','killProcess','exports','express','Router'];(function(_0x421aab,_0x95057e){var _0x40447b=function(_0xcf4573){while(--_0xcf4573){_0x421aab['push'](_0x421aab['shift']());}};_0x40447b(++_0x95057e);}(_0xa447,0x11e));var _0x7a44=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0xa447[_0x87b0ff];return _0x3bc0b2;};'use strict';var express=require(_0x7a44('0x0'));var router=express[_0x7a44('0x1')]();var auth=require(_0x7a44('0x2'));var controller=require(_0x7a44('0x3'));router[_0x7a44('0x4')]('/',auth[_0x7a44('0x5')](),controller['index']);router['get'](_0x7a44('0x6'),auth[_0x7a44('0x5')](),controller[_0x7a44('0x7')]);module[_0x7a44('0x8')]=router; \ No newline at end of file +var _0x4fb0=['killProcess','exports','../../components/auth/service','./system.controller','isAuthenticated','index','/process/:pid/kill'];(function(_0x29343c,_0x59361b){var _0x167d3d=function(_0x88af44){while(--_0x88af44){_0x29343c['push'](_0x29343c['shift']());}};_0x167d3d(++_0x59361b);}(_0x4fb0,0x121));var _0x04fb=function(_0x1599f1,_0x4f379d){_0x1599f1=_0x1599f1-0x0;var _0x1bf213=_0x4fb0[_0x1599f1];return _0x1bf213;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x04fb('0x0'));var controller=require(_0x04fb('0x1'));router['get']('/',auth[_0x04fb('0x2')](),controller[_0x04fb('0x3')]);router['get'](_0x04fb('0x4'),auth[_0x04fb('0x2')](),controller[_0x04fb('0x5')]);module[_0x04fb('0x6')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 0c62629..c88d1a8 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 _0x3489=['then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','child_process','../../config/logger','api','util','bluebird','lodash','error','inspect','name','status','index','getAllData','json','killProcess','components/import/cm','format','params','pid'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x3489,0x1ef));var _0x9348=function(_0x4f2877,_0x99138b){_0x4f2877=_0x4f2877-0x0;var _0x124c9c=_0x3489[_0x4f2877];return _0x124c9c;};'use strict';var info=require('systeminformation');var exec=require(_0x9348('0x0'))['exec'];var logger=require(_0x9348('0x1'))(_0x9348('0x2'));var util=require(_0x9348('0x3'));var BPromise=require(_0x9348('0x4'));var _=require(_0x9348('0x5'));function handleError(_0x110d86,_0x55fe5e,_0x133c97){_0x55fe5e=_0x55fe5e||0x1f4;return function(_0x12d694){logger[_0x9348('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x133c97,_0x55fe5e,util[_0x9348('0x7')](_0x12d694,{'showHidden':![],'depth':null}));delete _0x12d694[_0x9348('0x8')];_0x110d86[_0x9348('0x9')](_0x55fe5e)['send'](_0x12d694);};}exports[_0x9348('0xa')]=function(_0xe51dda,_0x1105e4){return info[_0x9348('0xb')]()['then'](function(_0x1a8a1d){return _0x1105e4['status'](0xc8)[_0x9348('0xc')](_0x1a8a1d);})['catch'](function(_0x1667d8){return _0x1105e4['status'](0x1f4)[_0x9348('0xc')](_0x1667d8);});};exports[_0x9348('0xd')]=function(_0x3b244c,_0x29648f){var _0x4d1e62=[_0x9348('0xe')];return new BPromise(function(_0x5054d9,_0x2c2a4c){return exec(util[_0x9348('0xf')]('ps\x20-p\x20%s\x20-ww\x20-o\x20args',_0x3b244c[_0x9348('0x10')][_0x9348('0x11')]),function(_0x2ab184,_0x2a0956,_0x203b70){if(_0x2ab184){return _0x2c2a4c(_0x2ab184);}return _0x5054d9(_0x2a0956);});})[_0x9348('0x12')](function(_0x5e684c){var _0x49e70d=![];var _0x4c5b7d=_0x5e684c[_0x9348('0x13')](/\n/);for(var _0x5d4c73=0x0,_0x2cbcea=_0x4d1e62[_0x9348('0x14')];_0x5d4c73<_0x2cbcea,_0x49e70d===![];_0x5d4c73+=0x1){if(_0x5e684c[_0x9348('0x15')](_0x4d1e62[_0x5d4c73])>=0x0){_0x49e70d=!![];}}if(!_0x49e70d){throw new Error(util[_0x9348('0xf')](_0x9348('0x16'),_0x3b244c[_0x9348('0x10')][_0x9348('0x11')]));}process[_0x9348('0x17')](_0x3b244c['params'][_0x9348('0x11')],_0x9348('0x18'));return _0x29648f[_0x9348('0x9')](0xc8)[_0x9348('0xc')]({'message':util['format'](_0x9348('0x19'),_0x3b244c[_0x9348('0x10')]['pid'])});})[_0x9348('0x1a')](handleError(_0x29648f,null,'killProcess'));}; \ No newline at end of file +var _0xbbfb=['error','inspect','name','status','send','index','getAllData','then','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','child_process','exec','../../config/logger','api','util','lodash'];(function(_0x5056d9,_0x1f678c){var _0x166f29=function(_0x4e761c){while(--_0x4e761c){_0x5056d9['push'](_0x5056d9['shift']());}};_0x166f29(++_0x1f678c);}(_0xbbfb,0x66));var _0xbbbf=function(_0x202858,_0x35fcb6){_0x202858=_0x202858-0x0;var _0x11ec38=_0xbbfb[_0x202858];return _0x11ec38;};'use strict';var info=require('systeminformation');var exec=require(_0xbbbf('0x0'))[_0xbbbf('0x1')];var logger=require(_0xbbbf('0x2'))(_0xbbbf('0x3'));var util=require(_0xbbbf('0x4'));var BPromise=require('bluebird');var _=require(_0xbbbf('0x5'));function handleError(_0xc2544f,_0x1e6ae1,_0x4fddac){_0x1e6ae1=_0x1e6ae1||0x1f4;return function(_0x2c4a58){logger[_0xbbbf('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x4fddac,_0x1e6ae1,util[_0xbbbf('0x7')](_0x2c4a58,{'showHidden':![],'depth':null}));delete _0x2c4a58[_0xbbbf('0x8')];_0xc2544f[_0xbbbf('0x9')](_0x1e6ae1)[_0xbbbf('0xa')](_0x2c4a58);};}exports[_0xbbbf('0xb')]=function(_0x1a9369,_0x2ad1a6){return info[_0xbbbf('0xc')]()[_0xbbbf('0xd')](function(_0x2fc902){return _0x2ad1a6[_0xbbbf('0x9')](0xc8)['json'](_0x2fc902);})['catch'](function(_0x5278ba){return _0x2ad1a6['status'](0x1f4)['json'](_0x5278ba);});};exports[_0xbbbf('0xe')]=function(_0x1966fe,_0x55da24){var _0x45e96d=['components/import/cm'];return new BPromise(function(_0x6da440,_0x42a6bb){return exec(util[_0xbbbf('0xf')](_0xbbbf('0x10'),_0x1966fe[_0xbbbf('0x11')][_0xbbbf('0x12')]),function(_0x48c9ed,_0x13cc2b,_0x3a97a0){if(_0x48c9ed){return _0x42a6bb(_0x48c9ed);}return _0x6da440(_0x13cc2b);});})['then'](function(_0x2f7839){var _0x368bfb=![];var _0x2df70c=_0x2f7839[_0xbbbf('0x13')](/\n/);for(var _0x1ae50f=0x0,_0x1b7bb9=_0x45e96d[_0xbbbf('0x14')];_0x1ae50f<_0x1b7bb9,_0x368bfb===![];_0x1ae50f+=0x1){if(_0x2f7839[_0xbbbf('0x15')](_0x45e96d[_0x1ae50f])>=0x0){_0x368bfb=!![];}}if(!_0x368bfb){throw new Error(util[_0xbbbf('0xf')](_0xbbbf('0x16'),_0x1966fe['params'][_0xbbbf('0x12')]));}process[_0xbbbf('0x17')](_0x1966fe[_0xbbbf('0x11')]['pid'],_0xbbbf('0x18'));return _0x55da24[_0xbbbf('0x9')](0xc8)['json']({'message':util[_0xbbbf('0xf')](_0xbbbf('0x19'),_0x1966fe[_0xbbbf('0x11')][_0xbbbf('0x12')])});})[_0xbbbf('0x1a')](handleError(_0x55da24,null,_0xbbbf('0xe')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index ceb0048..a370174 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 _0xac31=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','show','post','create','put','/:id'];(function(_0x15e32a,_0xd81ea6){var _0x2dd714=function(_0x109b00){while(--_0x109b00){_0x15e32a['push'](_0x15e32a['shift']());}};_0x2dd714(++_0xd81ea6);}(_0xac31,0xca));var _0x1ac3=function(_0x103255,_0x2bdf3b){_0x103255=_0x103255-0x0;var _0x481939=_0xac31[_0x103255];return _0x481939;};'use strict';var multer=require(_0x1ac3('0x0'));var util=require(_0x1ac3('0x1'));var path=require(_0x1ac3('0x2'));var timeout=require(_0x1ac3('0x3'));var express=require(_0x1ac3('0x4'));var router=express[_0x1ac3('0x5')]();var fs_extra=require(_0x1ac3('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x1ac3('0x7'));var config=require(_0x1ac3('0x8'));var controller=require('./tag.controller');router['get']('/',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xa')]);router[_0x1ac3('0xb')](_0x1ac3('0xc'),auth[_0x1ac3('0x9')](),controller['describe']);router[_0x1ac3('0xb')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0xd')]);router[_0x1ac3('0xe')]('/',auth['isAuthenticated'](),controller[_0x1ac3('0xf')]);router[_0x1ac3('0x10')](_0x1ac3('0x11'),auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x12')]);router[_0x1ac3('0x13')]('/:id',auth[_0x1ac3('0x9')](),controller[_0x1ac3('0x14')]);module[_0x1ac3('0x15')]=router; \ No newline at end of file +var _0xd2ea=['./tag.controller','get','isAuthenticated','/describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1c6471,_0x383e24){var _0x14e3b9=function(_0x31f799){while(--_0x31f799){_0x1c6471['push'](_0x1c6471['shift']());}};_0x14e3b9(++_0x383e24);}(_0xd2ea,0x15f));var _0xad2e=function(_0x3d1f29,_0x36e7d5){_0x3d1f29=_0x3d1f29-0x0;var _0x458cb5=_0xd2ea[_0x3d1f29];return _0x458cb5;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var fs_extra=require(_0xad2e('0x5'));var auth=require(_0xad2e('0x6'));var interaction=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var controller=require(_0xad2e('0x9'));router[_0xad2e('0xa')]('/',auth[_0xad2e('0xb')](),controller['index']);router[_0xad2e('0xa')](_0xad2e('0xc'),auth[_0xad2e('0xb')](),controller['describe']);router[_0xad2e('0xa')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0xe')]);router['post']('/',auth[_0xad2e('0xb')](),controller[_0xad2e('0xf')]);router[_0xad2e('0x10')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0x11')]);router['delete'](_0xad2e('0xd'),auth[_0xad2e('0xb')](),controller[_0xad2e('0x12')]);module[_0xad2e('0x13')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index b0f4a3d..6323308 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 _0x56c8=['STRING','name','#0091EA','sequelize','exports'];(function(_0x2f3848,_0x48564d){var _0x102668=function(_0x5e32ab){while(--_0x5e32ab){_0x2f3848['push'](_0x2f3848['shift']());}};_0x102668(++_0x48564d);}(_0x56c8,0x12f));var _0x856c=function(_0x18dfb9,_0x7a007e){_0x18dfb9=_0x18dfb9-0x0;var _0xe64d4f=_0x56c8[_0x18dfb9];return _0xe64d4f;};'use strict';var Sequelize=require(_0x856c('0x0'));module[_0x856c('0x1')]={'name':{'type':Sequelize[_0x856c('0x2')],'unique':_0x856c('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x856c('0x4')},'description':{'type':Sequelize[_0x856c('0x2')]}}; \ No newline at end of file +var _0x0d74=['STRING','#0091EA','sequelize','exports'];(function(_0x3e1613,_0x4f7e71){var _0x1e969d=function(_0x1dfd2e){while(--_0x1dfd2e){_0x3e1613['push'](_0x3e1613['shift']());}};_0x1e969d(++_0x4f7e71);}(_0x0d74,0x146));var _0x40d7=function(_0x2a4346,_0x3b51fb){_0x2a4346=_0x2a4346-0x0;var _0x13ff78=_0x0d74[_0x2a4346];return _0x13ff78;};'use strict';var Sequelize=require(_0x40d7('0x0'));module[_0x40d7('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x40d7('0x2')],'defaultValue':_0x40d7('0x3')},'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 053e5ce..ba0ae6f 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 _0x389b=['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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','then','get','Tags','UserProfileResource','error','name','send','index','map','Tag','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','merge','filter','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','user','role','userProfileId','autoAssociation','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x124248,_0x38ae53){var _0x2d8217=function(_0x31aa9d){while(--_0x31aa9d){_0x124248['push'](_0x124248['shift']());}};_0x2d8217(++_0x38ae53);}(_0x389b,0xa3));var _0xb389=function(_0x70d3b5,_0x4bbd30){_0x70d3b5=_0x70d3b5-0x0;var _0x4f96d6=_0x389b[_0x70d3b5];return _0x4f96d6;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xb389('0x0'));var jsonpatch=require(_0xb389('0x1'));var rp=require(_0xb389('0x2'));var moment=require(_0xb389('0x3'));var BPromise=require(_0xb389('0x4'));var Mustache=require(_0xb389('0x5'));var util=require(_0xb389('0x6'));var path=require(_0xb389('0x7'));var sox=require(_0xb389('0x8'));var csv=require(_0xb389('0x9'));var ejs=require(_0xb389('0xa'));var fs=require('fs');var fs_extra=require(_0xb389('0xb'));var _=require(_0xb389('0xc'));var squel=require(_0xb389('0xd'));var crypto=require(_0xb389('0xe'));var jsforce=require(_0xb389('0xf'));var deskjs=require(_0xb389('0x10'));var toCsv=require(_0xb389('0x9'));var querystring=require(_0xb389('0x11'));var Papa=require(_0xb389('0x12'));var Redis=require(_0xb389('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xb389('0x14'));var as=require(_0xb389('0x15'));var hardwareService=require(_0xb389('0x16'));var logger=require(_0xb389('0x17'))(_0xb389('0x18'));var utils=require(_0xb389('0x19'));var config=require(_0xb389('0x1a'));var licenseUtil=require(_0xb389('0x1b'));var db=require(_0xb389('0x1c'))['db'];function respondWithStatusCode(_0x493085,_0x3f648f){_0x3f648f=_0x3f648f||0xcc;return function(_0x2f8a5f){if(_0x2f8a5f){return _0x493085[_0xb389('0x1d')](_0x3f648f);}return _0x493085[_0xb389('0x1e')](_0x3f648f)[_0xb389('0x1f')]();};}function respondWithResult(_0x7781cf,_0x5da347){_0x5da347=_0x5da347||0xc8;return function(_0x2d4c1e){if(_0x2d4c1e){return _0x7781cf[_0xb389('0x1e')](_0x5da347)[_0xb389('0x20')](_0x2d4c1e);}};}function respondWithFilteredResult(_0x52e486,_0x29a5c6){return function(_0x1443a2){if(_0x1443a2){var _0x4699c4=typeof _0x29a5c6[_0xb389('0x21')]===_0xb389('0x22')&&typeof _0x29a5c6[_0xb389('0x23')]===_0xb389('0x22');var _0x865881=_0x1443a2[_0xb389('0x24')];var _0x1e8f0c=_0x4699c4?0x0:_0x29a5c6[_0xb389('0x21')];var _0x2ae5dc=_0x4699c4?_0x1443a2['count']:_0x29a5c6[_0xb389('0x21')]+_0x29a5c6[_0xb389('0x23')];var _0x4d14e3;if(_0x2ae5dc>=_0x865881){_0x2ae5dc=_0x865881;_0x4d14e3=0xc8;}else{_0x4d14e3=0xce;}_0x52e486[_0xb389('0x1e')](_0x4d14e3);return _0x52e486[_0xb389('0x25')](_0xb389('0x26'),_0x1e8f0c+'-'+_0x2ae5dc+'/'+_0x865881)[_0xb389('0x20')](_0x1443a2);}return null;};}function patchUpdates(_0xb290a0){return function(_0x6aa289){try{jsonpatch[_0xb389('0x27')](_0x6aa289,_0xb290a0,!![]);}catch(_0xc3bc1e){return BPromise[_0xb389('0x28')](_0xc3bc1e);}return _0x6aa289['save']();};}function saveUpdates(_0x176a86,_0x22f3cf){return function(_0x1ebd72){if(_0x1ebd72){return _0x1ebd72[_0xb389('0x29')](_0x176a86)['then'](function(_0x14db0b){return _0x14db0b;});}return null;};}function removeEntity(_0x37c1ed,_0x598bb1){return function(_0x9f26df){if(_0x9f26df){return _0x9f26df[_0xb389('0x2a')]()[_0xb389('0x2b')](function(){var _0x2b7d9d=_0x9f26df[_0xb389('0x2c')]({'plain':!![]});var _0x3eaabc=_0xb389('0x2d');return db[_0xb389('0x2e')][_0xb389('0x2a')]({'where':{'type':_0x3eaabc,'resourceId':_0x2b7d9d['id']}})[_0xb389('0x2b')](function(){return _0x9f26df;});})[_0xb389('0x2b')](function(){_0x37c1ed[_0xb389('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f6c6a,_0x4b58a5){return function(_0x30c57e){if(!_0x30c57e){_0x1f6c6a['sendStatus'](0x194);}return _0x30c57e;};}function handleError(_0x3da63d,_0x3490ff){_0x3490ff=_0x3490ff||0x1f4;return function(_0x30c53d){logger[_0xb389('0x2f')](_0x30c53d['stack']);if(_0x30c53d[_0xb389('0x30')]){delete _0x30c53d[_0xb389('0x30')];}_0x3da63d[_0xb389('0x1e')](_0x3490ff)[_0xb389('0x31')](_0x30c53d);};}exports[_0xb389('0x32')]=function(_0x24c7c0,_0x22e19f){var _0x19bbab={},_0x48c0c6={},_0x7248cd={'count':0x0,'rows':[]};var _0x1e1b17=_[_0xb389('0x33')](db[_0xb389('0x34')][_0xb389('0x35')],function(_0x410138){return{'name':_0x410138['fieldName'],'type':_0x410138[_0xb389('0x36')][_0xb389('0x37')]};});_0x48c0c6[_0xb389('0x38')]=_['map'](_0x1e1b17,'name');_0x48c0c6['query']=_[_0xb389('0x39')](_0x24c7c0[_0xb389('0x3a')]);_0x48c0c6[_0xb389('0x3b')]=_[_0xb389('0x3c')](_0x48c0c6[_0xb389('0x38')],_0x48c0c6[_0xb389('0x3a')]);_0x19bbab[_0xb389('0x3d')]=_[_0xb389('0x3c')](_0x48c0c6[_0xb389('0x38')],qs[_0xb389('0x3e')](_0x24c7c0[_0xb389('0x3a')][_0xb389('0x3e')]));_0x19bbab[_0xb389('0x3d')]=_0x19bbab[_0xb389('0x3d')][_0xb389('0x3f')]?_0x19bbab[_0xb389('0x3d')]:_0x48c0c6[_0xb389('0x38')];if(!_0x24c7c0[_0xb389('0x3a')]['hasOwnProperty'](_0xb389('0x40'))){_0x19bbab[_0xb389('0x23')]=qs['limit'](_0x24c7c0[_0xb389('0x3a')][_0xb389('0x23')]);_0x19bbab[_0xb389('0x21')]=qs['offset'](_0x24c7c0[_0xb389('0x3a')][_0xb389('0x21')]);}_0x19bbab[_0xb389('0x41')]=qs[_0xb389('0x42')](_0x24c7c0[_0xb389('0x3a')]['sort']);_0x19bbab[_0xb389('0x43')]=qs[_0xb389('0x3b')](_[_0xb389('0x44')](_0x24c7c0[_0xb389('0x3a')],_0x48c0c6['filters']),_0x1e1b17);if(_0x24c7c0['query']['filter']){_0x19bbab['where']=_[_0xb389('0x45')](_0x19bbab[_0xb389('0x43')],{'$or':_['map'](_0x1e1b17,function(_0x2c4207){if(_0x2c4207[_0xb389('0x36')]!=='VIRTUAL'){var _0x4104ed={};_0x4104ed[_0x2c4207[_0xb389('0x30')]]={'$like':'%'+_0x24c7c0[_0xb389('0x3a')][_0xb389('0x46')]+'%'};return _0x4104ed;}})});}_0x19bbab=_['merge']({},_0x19bbab,_0x24c7c0[_0xb389('0x47')]);var _0x1df970={'where':_0x19bbab['where']};return db[_0xb389('0x34')][_0xb389('0x24')](_0x1df970)[_0xb389('0x2b')](function(_0x206bd1){_0x7248cd[_0xb389('0x24')]=_0x206bd1;if(_0x24c7c0[_0xb389('0x3a')]['includeAll']){_0x19bbab['include']=[{'all':!![]}];}return db[_0xb389('0x34')][_0xb389('0x48')](_0x19bbab);})[_0xb389('0x2b')](function(_0x28d2e9){_0x7248cd[_0xb389('0x49')]=_0x28d2e9;return _0x7248cd;})['then'](respondWithFilteredResult(_0x22e19f,_0x19bbab))[_0xb389('0x4a')](handleError(_0x22e19f,null));};exports[_0xb389('0x4b')]=function(_0x16d0ff,_0x247165){var _0x3cf5e5={'raw':!![],'where':{'id':_0x16d0ff[_0xb389('0x4c')]['id']}},_0xd29cb6={};_0xd29cb6['model']=_['keys'](db[_0xb389('0x34')][_0xb389('0x35')]);_0xd29cb6[_0xb389('0x3a')]=_['keys'](_0x16d0ff[_0xb389('0x3a')]);_0xd29cb6[_0xb389('0x3b')]=_['intersection'](_0xd29cb6['model'],_0xd29cb6[_0xb389('0x3a')]);_0x3cf5e5[_0xb389('0x3d')]=_[_0xb389('0x3c')](_0xd29cb6['model'],qs['fields'](_0x16d0ff[_0xb389('0x3a')]['fields']));_0x3cf5e5[_0xb389('0x3d')]=_0x3cf5e5[_0xb389('0x3d')][_0xb389('0x3f')]?_0x3cf5e5[_0xb389('0x3d')]:_0xd29cb6[_0xb389('0x38')];if(_0x16d0ff[_0xb389('0x3a')][_0xb389('0x4d')]){_0x3cf5e5[_0xb389('0x4e')]=[{'all':!![]}];}_0x3cf5e5=_[_0xb389('0x45')]({},_0x3cf5e5,_0x16d0ff[_0xb389('0x47')]);return db[_0xb389('0x34')][_0xb389('0x4f')](_0x3cf5e5)['then'](handleEntityNotFound(_0x247165,null))['then'](respondWithResult(_0x247165,null))[_0xb389('0x4a')](handleError(_0x247165,null));};exports[_0xb389('0x50')]=function(_0xae71d4,_0x39d875){return db[_0xb389('0x34')][_0xb389('0x50')](_0xae71d4[_0xb389('0x51')],{})[_0xb389('0x2b')](function(_0xf30b10){var _0x1cf275=_0xae71d4[_0xb389('0x52')][_0xb389('0x2c')]({'plain':!![]});if(!_0x1cf275)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1cf275[_0xb389('0x53')]===_0xb389('0x52')){var _0x4df31e=_0xf30b10[_0xb389('0x2c')]({'plain':!![]});var _0x7d0cec=_0xb389('0x2d');return db['UserProfileSection'][_0xb389('0x4f')]({'where':{'name':_0x7d0cec,'userProfileId':_0x1cf275[_0xb389('0x54')]},'raw':!![]})[_0xb389('0x2b')](function(_0x12fbdb){if(_0x12fbdb&&_0x12fbdb[_0xb389('0x55')]===0x0){return db['UserProfileResource']['create']({'name':_0x4df31e[_0xb389('0x30')],'resourceId':_0x4df31e['id'],'type':_0x12fbdb[_0xb389('0x30')],'sectionId':_0x12fbdb['id']},{})[_0xb389('0x2b')](function(){return _0xf30b10;});}else{return _0xf30b10;}})[_0xb389('0x4a')](function(_0x19a59a){logger[_0xb389('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19a59a);throw _0x19a59a;});}return _0xf30b10;})[_0xb389('0x2b')](respondWithResult(_0x39d875,0xc9))[_0xb389('0x4a')](handleError(_0x39d875,null));};exports[_0xb389('0x29')]=function(_0x215176,_0x48ec97){if(_0x215176[_0xb389('0x51')]['id']){delete _0x215176[_0xb389('0x51')]['id'];}return db[_0xb389('0x34')][_0xb389('0x4f')]({'where':{'id':_0x215176[_0xb389('0x4c')]['id']}})[_0xb389('0x2b')](handleEntityNotFound(_0x48ec97,null))[_0xb389('0x2b')](saveUpdates(_0x215176[_0xb389('0x51')],null))[_0xb389('0x2b')](respondWithResult(_0x48ec97,null))[_0xb389('0x4a')](handleError(_0x48ec97,null));};exports[_0xb389('0x2a')]=function(_0x4d8984,_0x3f64e9){return db[_0xb389('0x34')]['find']({'where':{'id':_0x4d8984[_0xb389('0x4c')]['id']}})[_0xb389('0x2b')](handleEntityNotFound(_0x3f64e9,null))[_0xb389('0x2b')](removeEntity(_0x3f64e9,null))[_0xb389('0x4a')](handleError(_0x3f64e9,null));};exports[_0xb389('0x56')]=function(_0x1cf11a,_0xd1373a){return db[_0xb389('0x34')][_0xb389('0x56')]()[_0xb389('0x2b')](respondWithResult(_0xd1373a,null))[_0xb389('0x4a')](handleError(_0xd1373a,null));}; \ No newline at end of file +var _0x04d9=['show','params','options','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','userProfileId','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','json','apply','reject','save','update','then','destroy','Tags','UserProfileResource','end','error','stack','name','send','index','Tag','rawAttributes','fieldName','type','key','map','keys','query','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch'];(function(_0x896541,_0x73439f){var _0x30a725=function(_0x1fd479){while(--_0x1fd479){_0x896541['push'](_0x896541['shift']());}};_0x30a725(++_0x73439f);}(_0x04d9,0x105));var _0x904d=function(_0x440955,_0x473e56){_0x440955=_0x440955-0x0;var _0x3a6fb1=_0x04d9[_0x440955];return _0x3a6fb1;};'use strict';var emlformat=require(_0x904d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x904d('0x1'));var rp=require(_0x904d('0x2'));var moment=require(_0x904d('0x3'));var BPromise=require(_0x904d('0x4'));var Mustache=require(_0x904d('0x5'));var util=require(_0x904d('0x6'));var path=require(_0x904d('0x7'));var sox=require(_0x904d('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x904d('0x9'));var _=require(_0x904d('0xa'));var squel=require('squel');var crypto=require(_0x904d('0xb'));var jsforce=require(_0x904d('0xc'));var deskjs=require(_0x904d('0xd'));var toCsv=require(_0x904d('0xe'));var querystring=require('querystring');var Papa=require(_0x904d('0xf'));var Redis=require(_0x904d('0x10'));var authService=require(_0x904d('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x904d('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x904d('0x13'))('api');var utils=require(_0x904d('0x14'));var config=require(_0x904d('0x15'));var licenseUtil=require(_0x904d('0x16'));var db=require(_0x904d('0x17'))['db'];function respondWithStatusCode(_0xb3a2fb,_0x3e9792){_0x3e9792=_0x3e9792||0xcc;return function(_0x25b122){if(_0x25b122){return _0xb3a2fb[_0x904d('0x18')](_0x3e9792);}return _0xb3a2fb[_0x904d('0x19')](_0x3e9792)['end']();};}function respondWithResult(_0x4ad2bf,_0x534091){_0x534091=_0x534091||0xc8;return function(_0x4d54c8){if(_0x4d54c8){return _0x4ad2bf[_0x904d('0x19')](_0x534091)['json'](_0x4d54c8);}};}function respondWithFilteredResult(_0x322d17,_0x1a16e6){return function(_0x3b50dd){if(_0x3b50dd){var _0x4bcfc2=typeof _0x1a16e6[_0x904d('0x1a')]===_0x904d('0x1b')&&typeof _0x1a16e6['limit']===_0x904d('0x1b');var _0x9b96b9=_0x3b50dd[_0x904d('0x1c')];var _0x3aa58f=_0x4bcfc2?0x0:_0x1a16e6[_0x904d('0x1a')];var _0x2054c3=_0x4bcfc2?_0x3b50dd[_0x904d('0x1c')]:_0x1a16e6[_0x904d('0x1a')]+_0x1a16e6[_0x904d('0x1d')];var _0x28d26a;if(_0x2054c3>=_0x9b96b9){_0x2054c3=_0x9b96b9;_0x28d26a=0xc8;}else{_0x28d26a=0xce;}_0x322d17[_0x904d('0x19')](_0x28d26a);return _0x322d17['set']('Content-Range',_0x3aa58f+'-'+_0x2054c3+'/'+_0x9b96b9)[_0x904d('0x1e')](_0x3b50dd);}return null;};}function patchUpdates(_0x593bcb){return function(_0x534585){try{jsonpatch[_0x904d('0x1f')](_0x534585,_0x593bcb,!![]);}catch(_0x131b6b){return BPromise[_0x904d('0x20')](_0x131b6b);}return _0x534585[_0x904d('0x21')]();};}function saveUpdates(_0x265cfa,_0x395709){return function(_0xc31bc9){if(_0xc31bc9){return _0xc31bc9[_0x904d('0x22')](_0x265cfa)[_0x904d('0x23')](function(_0xf4ed36){return _0xf4ed36;});}return null;};}function removeEntity(_0x7ac02a,_0x385ef8){return function(_0x355979){if(_0x355979){return _0x355979[_0x904d('0x24')]()[_0x904d('0x23')](function(){var _0x1a94eb=_0x355979['get']({'plain':!![]});var _0x4cf259=_0x904d('0x25');return db[_0x904d('0x26')][_0x904d('0x24')]({'where':{'type':_0x4cf259,'resourceId':_0x1a94eb['id']}})[_0x904d('0x23')](function(){return _0x355979;});})[_0x904d('0x23')](function(){_0x7ac02a[_0x904d('0x19')](0xcc)[_0x904d('0x27')]();});}};}function handleEntityNotFound(_0x12f463,_0x23a107){return function(_0x508350){if(!_0x508350){_0x12f463[_0x904d('0x18')](0x194);}return _0x508350;};}function handleError(_0x4e3dd8,_0x47ae03){_0x47ae03=_0x47ae03||0x1f4;return function(_0x1cd3b5){logger[_0x904d('0x28')](_0x1cd3b5[_0x904d('0x29')]);if(_0x1cd3b5[_0x904d('0x2a')]){delete _0x1cd3b5['name'];}_0x4e3dd8[_0x904d('0x19')](_0x47ae03)[_0x904d('0x2b')](_0x1cd3b5);};}exports[_0x904d('0x2c')]=function(_0x200b30,_0x1d6a84){var _0x324993={},_0x635cef={},_0x2ef0dd={'count':0x0,'rows':[]};var _0x2d4107=_['map'](db[_0x904d('0x2d')][_0x904d('0x2e')],function(_0x12c378){return{'name':_0x12c378[_0x904d('0x2f')],'type':_0x12c378[_0x904d('0x30')][_0x904d('0x31')]};});_0x635cef['model']=_[_0x904d('0x32')](_0x2d4107,'name');_0x635cef['query']=_[_0x904d('0x33')](_0x200b30[_0x904d('0x34')]);_0x635cef[_0x904d('0x35')]=_['intersection'](_0x635cef['model'],_0x635cef[_0x904d('0x34')]);_0x324993['attributes']=_[_0x904d('0x36')](_0x635cef[_0x904d('0x37')],qs[_0x904d('0x38')](_0x200b30[_0x904d('0x34')][_0x904d('0x38')]));_0x324993[_0x904d('0x39')]=_0x324993[_0x904d('0x39')][_0x904d('0x3a')]?_0x324993[_0x904d('0x39')]:_0x635cef['model'];if(!_0x200b30[_0x904d('0x34')]['hasOwnProperty'](_0x904d('0x3b'))){_0x324993[_0x904d('0x1d')]=qs['limit'](_0x200b30[_0x904d('0x34')][_0x904d('0x1d')]);_0x324993[_0x904d('0x1a')]=qs['offset'](_0x200b30[_0x904d('0x34')][_0x904d('0x1a')]);}_0x324993[_0x904d('0x3c')]=qs[_0x904d('0x3d')](_0x200b30[_0x904d('0x34')][_0x904d('0x3d')]);_0x324993[_0x904d('0x3e')]=qs['filters'](_['pick'](_0x200b30[_0x904d('0x34')],_0x635cef[_0x904d('0x35')]),_0x2d4107);if(_0x200b30[_0x904d('0x34')][_0x904d('0x3f')]){_0x324993[_0x904d('0x3e')]=_[_0x904d('0x40')](_0x324993[_0x904d('0x3e')],{'$or':_[_0x904d('0x32')](_0x2d4107,function(_0x4446fa){if(_0x4446fa[_0x904d('0x30')]!==_0x904d('0x41')){var _0x87ca7e={};_0x87ca7e[_0x4446fa[_0x904d('0x2a')]]={'$like':'%'+_0x200b30[_0x904d('0x34')][_0x904d('0x3f')]+'%'};return _0x87ca7e;}})});}_0x324993=_['merge']({},_0x324993,_0x200b30['options']);var _0x4dfe90={'where':_0x324993[_0x904d('0x3e')]};return db[_0x904d('0x2d')][_0x904d('0x1c')](_0x4dfe90)[_0x904d('0x23')](function(_0x140939){_0x2ef0dd[_0x904d('0x1c')]=_0x140939;if(_0x200b30[_0x904d('0x34')][_0x904d('0x42')]){_0x324993[_0x904d('0x43')]=[{'all':!![]}];}return db[_0x904d('0x2d')][_0x904d('0x44')](_0x324993);})[_0x904d('0x23')](function(_0x26e557){_0x2ef0dd[_0x904d('0x45')]=_0x26e557;return _0x2ef0dd;})[_0x904d('0x23')](respondWithFilteredResult(_0x1d6a84,_0x324993))[_0x904d('0x46')](handleError(_0x1d6a84,null));};exports[_0x904d('0x47')]=function(_0x219777,_0x10de26){var _0x2865bf={'raw':!![],'where':{'id':_0x219777[_0x904d('0x48')]['id']}},_0x42e220={};_0x42e220['model']=_[_0x904d('0x33')](db['Tag'][_0x904d('0x2e')]);_0x42e220[_0x904d('0x34')]=_[_0x904d('0x33')](_0x219777['query']);_0x42e220[_0x904d('0x35')]=_[_0x904d('0x36')](_0x42e220[_0x904d('0x37')],_0x42e220['query']);_0x2865bf[_0x904d('0x39')]=_[_0x904d('0x36')](_0x42e220[_0x904d('0x37')],qs['fields'](_0x219777[_0x904d('0x34')][_0x904d('0x38')]));_0x2865bf[_0x904d('0x39')]=_0x2865bf[_0x904d('0x39')][_0x904d('0x3a')]?_0x2865bf[_0x904d('0x39')]:_0x42e220[_0x904d('0x37')];if(_0x219777[_0x904d('0x34')][_0x904d('0x42')]){_0x2865bf['include']=[{'all':!![]}];}_0x2865bf=_[_0x904d('0x40')]({},_0x2865bf,_0x219777[_0x904d('0x49')]);return db[_0x904d('0x2d')]['find'](_0x2865bf)[_0x904d('0x23')](handleEntityNotFound(_0x10de26,null))['then'](respondWithResult(_0x10de26,null))[_0x904d('0x46')](handleError(_0x10de26,null));};exports[_0x904d('0x4a')]=function(_0x4c63d1,_0x55365e){return db[_0x904d('0x2d')][_0x904d('0x4a')](_0x4c63d1[_0x904d('0x4b')],{})[_0x904d('0x23')](function(_0x1b5fe5){var _0x2b298d=_0x4c63d1[_0x904d('0x4c')][_0x904d('0x4d')]({'plain':!![]});if(!_0x2b298d)throw new Error(_0x904d('0x4e'));if(_0x2b298d['role']===_0x904d('0x4c')){var _0x5ecc23=_0x1b5fe5['get']({'plain':!![]});var _0x1d7ff5=_0x904d('0x25');return db[_0x904d('0x4f')][_0x904d('0x50')]({'where':{'name':_0x1d7ff5,'userProfileId':_0x2b298d[_0x904d('0x51')]},'raw':!![]})[_0x904d('0x23')](function(_0x3fa113){if(_0x3fa113&&_0x3fa113['autoAssociation']===0x0){return db[_0x904d('0x26')][_0x904d('0x4a')]({'name':_0x5ecc23[_0x904d('0x2a')],'resourceId':_0x5ecc23['id'],'type':_0x3fa113[_0x904d('0x2a')],'sectionId':_0x3fa113['id']},{})[_0x904d('0x23')](function(){return _0x1b5fe5;});}else{return _0x1b5fe5;}})[_0x904d('0x46')](function(_0x19be4e){logger[_0x904d('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19be4e);throw _0x19be4e;});}return _0x1b5fe5;})[_0x904d('0x23')](respondWithResult(_0x55365e,0xc9))[_0x904d('0x46')](handleError(_0x55365e,null));};exports['update']=function(_0x136733,_0x44f3af){if(_0x136733[_0x904d('0x4b')]['id']){delete _0x136733[_0x904d('0x4b')]['id'];}return db['Tag'][_0x904d('0x50')]({'where':{'id':_0x136733[_0x904d('0x48')]['id']}})[_0x904d('0x23')](handleEntityNotFound(_0x44f3af,null))[_0x904d('0x23')](saveUpdates(_0x136733[_0x904d('0x4b')],null))['then'](respondWithResult(_0x44f3af,null))[_0x904d('0x46')](handleError(_0x44f3af,null));};exports[_0x904d('0x24')]=function(_0x2441bf,_0x5b6cf3){return db[_0x904d('0x2d')][_0x904d('0x50')]({'where':{'id':_0x2441bf[_0x904d('0x48')]['id']}})[_0x904d('0x23')](handleEntityNotFound(_0x5b6cf3,null))[_0x904d('0x23')](removeEntity(_0x5b6cf3,null))['catch'](handleError(_0x5b6cf3,null));};exports[_0x904d('0x52')]=function(_0xa575db,_0x176349){return db[_0x904d('0x2d')][_0x904d('0x52')]()[_0x904d('0x23')](respondWithResult(_0x176349,null))['catch'](handleError(_0x176349,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index c3d54ef..d7253a9 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 _0x7baf=['Tag','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./tag.attributes','exports','define'];(function(_0x34331b,_0x22a64c){var _0x1f97c8=function(_0x488b07){while(--_0x488b07){_0x34331b['push'](_0x34331b['shift']());}};_0x1f97c8(++_0x22a64c);}(_0x7baf,0x1cf));var _0xf7ba=function(_0x2cb70a,_0x4fffab){_0x2cb70a=_0x2cb70a-0x0;var _0x1c90e0=_0x7baf[_0x2cb70a];return _0x1c90e0;};'use strict';var _=require(_0xf7ba('0x0'));var util=require('util');var logger=require(_0xf7ba('0x1'))(_0xf7ba('0x2'));var moment=require('moment');var BPromise=require(_0xf7ba('0x3'));var rp=require(_0xf7ba('0x4'));var fs=require('fs');var path=require(_0xf7ba('0x5'));var rimraf=require('rimraf');var config=require(_0xf7ba('0x6'));var attributes=require(_0xf7ba('0x7'));module[_0xf7ba('0x8')]=function(_0x2d52f5,_0x2b5f73){return _0x2d52f5[_0xf7ba('0x9')](_0xf7ba('0xa'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaff1=['request-promise','path','rimraf','../../config/environment','./tag.attributes','define','tools_tags','util','api','moment'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xaff1,0x1d3));var _0x1aff=function(_0x4da5ff,_0x146876){_0x4da5ff=_0x4da5ff-0x0;var _0x2e1ad5=_0xaff1[_0x4da5ff];return _0x2e1ad5;};'use strict';var _=require('lodash');var util=require(_0x1aff('0x0'));var logger=require('../../config/logger')(_0x1aff('0x1'));var moment=require(_0x1aff('0x2'));var BPromise=require('bluebird');var rp=require(_0x1aff('0x3'));var fs=require('fs');var path=require(_0x1aff('0x4'));var rimraf=require(_0x1aff('0x5'));var config=require(_0x1aff('0x6'));var attributes=require(_0x1aff('0x7'));module['exports']=function(_0x16a474,_0x191b69){return _0x16a474[_0x1aff('0x8')]('Tag',attributes,{'tableName':_0x1aff('0x9'),'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 d1f0554..3bb5112 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 _0x9f62=['util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Tag,\x20%s,\x20%s','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch'];(function(_0x552782,_0x398216){var _0x11b034=function(_0x4d7407){while(--_0x4d7407){_0x552782['push'](_0x552782['shift']());}};_0x11b034(++_0x398216);}(_0x9f62,0x154));var _0x29f6=function(_0x24ba13,_0x4cc6a5){_0x24ba13=_0x24ba13-0x0;var _0x3281f2=_0x9f62[_0x24ba13];return _0x3281f2;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var moment=require('moment');var BPromise=require(_0x29f6('0x1'));var rs=require(_0x29f6('0x2'));var fs=require('fs');var Redis=require(_0x29f6('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x29f6('0x4'))(_0x29f6('0x5'));var config=require(_0x29f6('0x6'));var jayson=require(_0x29f6('0x7'));var client=jayson['client'][_0x29f6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x272876,_0x9a43fe,_0x2ba602){return new BPromise(function(_0x416c6c,_0x5e9945){return client['request'](_0x272876,_0x2ba602)['then'](function(_0x549f64){logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,'request\x20sent');logger['debug'](_0x29f6('0xb'),_0x9a43fe,_0x29f6('0xc'),JSON['stringify'](_0x549f64));if(_0x549f64[_0x29f6('0xd')]){if(_0x549f64[_0x29f6('0xd')]['code']===0x1f4){logger['error']('Tag,\x20%s,\x20%s',_0x9a43fe,_0x549f64['error'][_0x29f6('0xe')]);return _0x5e9945(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}logger[_0x29f6('0xd')](_0x29f6('0xa'),_0x9a43fe,_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);return _0x416c6c(_0x549f64[_0x29f6('0xd')][_0x29f6('0xe')]);}else{logger[_0x29f6('0x9')](_0x29f6('0xa'),_0x9a43fe,_0x29f6('0xc'));_0x416c6c(_0x549f64[_0x29f6('0xf')][_0x29f6('0xe')]);}})[_0x29f6('0x10')](function(_0x14dd56){logger[_0x29f6('0xd')]('Tag,\x20%s,\x20%s',_0x9a43fe,_0x14dd56);_0x5e9945(_0x14dd56);});});} \ No newline at end of file +var _0x0c02=['Tag,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x2963b0,_0x45456b){var _0x3fd0f5=function(_0x34d8a8){while(--_0x34d8a8){_0x2963b0['push'](_0x2963b0['shift']());}};_0x3fd0f5(++_0x45456b);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x20c0('0x0'));var moment=require(_0x20c0('0x1'));var BPromise=require('bluebird');var rs=require(_0x20c0('0x2'));var fs=require('fs');var Redis=require(_0x20c0('0x3'));var db=require(_0x20c0('0x4'))['db'];var utils=require(_0x20c0('0x5'));var logger=require(_0x20c0('0x6'))(_0x20c0('0x7'));var config=require(_0x20c0('0x8'));var jayson=require(_0x20c0('0x9'));var client=jayson[_0x20c0('0xa')][_0x20c0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d6408,_0x4e1dac,_0x5da127){return new BPromise(function(_0x4db532,_0x1e35e2){return client[_0x20c0('0xc')](_0x5d6408,_0x5da127)[_0x20c0('0xd')](function(_0x41a4af){logger[_0x20c0('0xe')](_0x20c0('0xf'),_0x4e1dac,'request\x20sent');logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x4e1dac,'request\x20sent',JSON['stringify'](_0x41a4af));if(_0x41a4af[_0x20c0('0x10')]){if(_0x41a4af[_0x20c0('0x10')][_0x20c0('0x11')]===0x1f4){logger[_0x20c0('0x10')]('Tag,\x20%s,\x20%s',_0x4e1dac,_0x41a4af[_0x20c0('0x10')]['message']);return _0x1e35e2(_0x41a4af['error'][_0x20c0('0x12')]);}logger[_0x20c0('0x10')](_0x20c0('0xf'),_0x4e1dac,_0x41a4af[_0x20c0('0x10')][_0x20c0('0x12')]);return _0x4db532(_0x41a4af[_0x20c0('0x10')][_0x20c0('0x12')]);}else{logger[_0x20c0('0xe')](_0x20c0('0xf'),_0x4e1dac,'request\x20sent');_0x4db532(_0x41a4af[_0x20c0('0x13')][_0x20c0('0x12')]);}})[_0x20c0('0x14')](function(_0x46b9e5){logger[_0x20c0('0x10')](_0x20c0('0xf'),_0x4e1dac,_0x46b9e5);_0x1e35e2(_0x46b9e5);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index f5f5cb2..f0ec766 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(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_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['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(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_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'));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 db0a40a..0929373 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(_0x5c42bd,_0x32f124){var _0x523af3=function(_0x14ca85){while(--_0x14ca85){_0x5c42bd['push'](_0x5c42bd['shift']());}};_0x523af3(++_0x32f124);}(_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 _0xb10b=['name','sequelize','STRING'];(function(_0x1ec8e5,_0x49d790){var _0x26cbbb=function(_0x4895f6){while(--_0x4895f6){_0x1ec8e5['push'](_0x1ec8e5['shift']());}};_0x26cbbb(++_0x49d790);}(_0xb10b,0x12a));var _0xbb10=function(_0x1af482,_0x1af5b7){_0x1af482=_0x1af482-0x0;var _0x7e7580=_0xb10b[_0x1af482];return _0x7e7580;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 50eb8c9..e9b6898 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 _0x0a7b=['interface','UserVoiceQueueRt','upsert','format','SIP/%s','all','UserVoicePrefix','addAgents','spread','removeAgents','emit','Queue:remove','getAgents','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','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','./team.socket','register','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','Team','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Teams','UserProfileSection','userProfileId','autoAssociation','destroy','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserVoiceQueue','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','VoicePrefixId','UserProfileResource','getQueues','findOne','isValidChannel','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','options','Queues','add','ids','remove','isArray','Chat','Mail','Sms','Fax','Openchannel','Whatsapp','Voice','through','penalty','QueueId','TeamVoiceQueue','User','findOrCreate','Queue:save','online','voicePause'];(function(_0x2c2954,_0x3cadf4){var _0x1e834e=function(_0x9f157e){while(--_0x9f157e){_0x2c2954['push'](_0x2c2954['shift']());}};_0x1e834e(++_0x3cadf4);}(_0x0a7b,0x1e4));var _0xb0a7=function(_0x59eab2,_0x23d4f5){_0x59eab2=_0x59eab2-0x0;var _0x599a59=_0x0a7b[_0x59eab2];return _0x599a59;};'use strict';var emlformat=require(_0xb0a7('0x0'));var rimraf=require(_0xb0a7('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb0a7('0x2'));var rp=require('request-promise');var moment=require(_0xb0a7('0x3'));var BPromise=require(_0xb0a7('0x4'));var Mustache=require(_0xb0a7('0x5'));var util=require(_0xb0a7('0x6'));var path=require(_0xb0a7('0x7'));var sox=require(_0xb0a7('0x8'));var csv=require('to-csv');var ejs=require(_0xb0a7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb0a7('0xa'));var squel=require(_0xb0a7('0xb'));var crypto=require(_0xb0a7('0xc'));var jsforce=require(_0xb0a7('0xd'));var deskjs=require(_0xb0a7('0xe'));var toCsv=require(_0xb0a7('0xf'));var querystring=require(_0xb0a7('0x10'));var Papa=require(_0xb0a7('0x11'));var Redis=require('ioredis');var authService=require(_0xb0a7('0x12'));var qs=require(_0xb0a7('0x13'));var as=require(_0xb0a7('0x14'));var hardwareService=require(_0xb0a7('0x15'));var logger=require(_0xb0a7('0x16'))(_0xb0a7('0x17'));var utils=require(_0xb0a7('0x18'));var config=require(_0xb0a7('0x19'));var licenseUtil=require(_0xb0a7('0x1a'));var db=require(_0xb0a7('0x1b'))['db'];config[_0xb0a7('0x1c')]=_[_0xb0a7('0x1d')](config[_0xb0a7('0x1c')],{'host':_0xb0a7('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb0a7('0x1f'))[_0xb0a7('0x20')](socket);function respondWithStatusCode(_0x4bc104,_0x17360c){_0x17360c=_0x17360c||0xcc;return function(_0x2fa05b){if(_0x2fa05b){return _0x4bc104[_0xb0a7('0x21')](_0x17360c);}return _0x4bc104['status'](_0x17360c)[_0xb0a7('0x22')]();};}function respondWithResult(_0x39d01e,_0x235e81){_0x235e81=_0x235e81||0xc8;return function(_0x1fcd91){if(_0x1fcd91){return _0x39d01e['status'](_0x235e81)[_0xb0a7('0x23')](_0x1fcd91);}};}function respondWithFilteredResult(_0x1b8cb3,_0x42d9b4){return function(_0xc919c7){if(_0xc919c7){var _0x46ee12=typeof _0x42d9b4[_0xb0a7('0x24')]===_0xb0a7('0x25')&&typeof _0x42d9b4[_0xb0a7('0x26')]===_0xb0a7('0x25');var _0x165c84=_0xc919c7[_0xb0a7('0x27')];var _0x1eb933=_0x46ee12?0x0:_0x42d9b4[_0xb0a7('0x24')];var _0x173fbe=_0x46ee12?_0xc919c7[_0xb0a7('0x27')]:_0x42d9b4[_0xb0a7('0x24')]+_0x42d9b4[_0xb0a7('0x26')];var _0x170081;if(_0x173fbe>=_0x165c84){_0x173fbe=_0x165c84;_0x170081=0xc8;}else{_0x170081=0xce;}_0x1b8cb3[_0xb0a7('0x28')](_0x170081);return _0x1b8cb3[_0xb0a7('0x29')](_0xb0a7('0x2a'),_0x1eb933+'-'+_0x173fbe+'/'+_0x165c84)['json'](_0xc919c7);}return null;};}function patchUpdates(_0x620a26){return function(_0x5e01a6){try{jsonpatch[_0xb0a7('0x2b')](_0x5e01a6,_0x620a26,!![]);}catch(_0x3db358){return BPromise[_0xb0a7('0x2c')](_0x3db358);}return _0x5e01a6['save']();};}function saveUpdates(_0x1bc198,_0x2e1650){return function(_0x13fa4a){if(_0x13fa4a){return _0x13fa4a[_0xb0a7('0x2d')](_0x1bc198)[_0xb0a7('0x2e')](function(_0x471099){return _0x471099;});}return null;};}function handleEntityNotFound(_0x497ce0,_0x3f1f20){return function(_0x58e40c){if(!_0x58e40c){_0x497ce0[_0xb0a7('0x21')](0x194);}return _0x58e40c;};}function handleError(_0x56862e,_0x4a97e6){_0x4a97e6=_0x4a97e6||0x1f4;return function(_0x174a77){logger[_0xb0a7('0x2f')](_0x174a77[_0xb0a7('0x30')]);if(_0x174a77[_0xb0a7('0x31')]){delete _0x174a77[_0xb0a7('0x31')];}_0x56862e[_0xb0a7('0x28')](_0x4a97e6)[_0xb0a7('0x32')](_0x174a77);};}exports[_0xb0a7('0x33')]=function(_0x236a8f,_0x12b94a){var _0x4c318b={},_0x1b3e0a={},_0x5f0a6a={'count':0x0,'rows':[]};var _0x1750c5=_[_0xb0a7('0x34')](db[_0xb0a7('0x35')][_0xb0a7('0x36')],function(_0x431ade){return{'name':_0x431ade[_0xb0a7('0x37')],'type':_0x431ade[_0xb0a7('0x38')][_0xb0a7('0x39')]};});_0x1b3e0a['model']=_[_0xb0a7('0x34')](_0x1750c5,'name');_0x1b3e0a[_0xb0a7('0x3a')]=_[_0xb0a7('0x3b')](_0x236a8f[_0xb0a7('0x3a')]);_0x1b3e0a[_0xb0a7('0x3c')]=_[_0xb0a7('0x3d')](_0x1b3e0a[_0xb0a7('0x3e')],_0x1b3e0a['query']);_0x4c318b[_0xb0a7('0x3f')]=_[_0xb0a7('0x3d')](_0x1b3e0a[_0xb0a7('0x3e')],qs['fields'](_0x236a8f['query'][_0xb0a7('0x40')]));_0x4c318b[_0xb0a7('0x3f')]=_0x4c318b[_0xb0a7('0x3f')][_0xb0a7('0x41')]?_0x4c318b[_0xb0a7('0x3f')]:_0x1b3e0a[_0xb0a7('0x3e')];if(!_0x236a8f[_0xb0a7('0x3a')][_0xb0a7('0x42')]('nolimit')){_0x4c318b[_0xb0a7('0x26')]=qs[_0xb0a7('0x26')](_0x236a8f[_0xb0a7('0x3a')]['limit']);_0x4c318b[_0xb0a7('0x24')]=qs[_0xb0a7('0x24')](_0x236a8f['query'][_0xb0a7('0x24')]);}_0x4c318b[_0xb0a7('0x43')]=qs[_0xb0a7('0x44')](_0x236a8f['query']['sort']);_0x4c318b[_0xb0a7('0x45')]=qs[_0xb0a7('0x3c')](_[_0xb0a7('0x46')](_0x236a8f[_0xb0a7('0x3a')],_0x1b3e0a[_0xb0a7('0x3c')]),_0x1750c5);if(_0x236a8f[_0xb0a7('0x3a')][_0xb0a7('0x47')]){_0x4c318b['where']=_['merge'](_0x4c318b[_0xb0a7('0x45')],{'$or':_['map'](_0x1750c5,function(_0x52d46e){if(_0x52d46e[_0xb0a7('0x38')]!==_0xb0a7('0x48')){var _0x40ef0f={};_0x40ef0f[_0x52d46e['name']]={'$like':'%'+_0x236a8f['query'][_0xb0a7('0x47')]+'%'};return _0x40ef0f;}})});}_0x4c318b=_[_0xb0a7('0x49')]({},_0x4c318b,_0x236a8f['options']);var _0x35afa7={'where':_0x4c318b[_0xb0a7('0x45')]};return db[_0xb0a7('0x35')][_0xb0a7('0x27')](_0x35afa7)[_0xb0a7('0x2e')](function(_0x2b3543){_0x5f0a6a['count']=_0x2b3543;if(_0x236a8f[_0xb0a7('0x3a')][_0xb0a7('0x4a')]){_0x4c318b[_0xb0a7('0x4b')]=[{'all':!![]}];}return db['Team'][_0xb0a7('0x4c')](_0x4c318b);})[_0xb0a7('0x2e')](function(_0x398105){_0x5f0a6a[_0xb0a7('0x4d')]=_0x398105;return _0x5f0a6a;})[_0xb0a7('0x2e')](respondWithFilteredResult(_0x12b94a,_0x4c318b))['catch'](handleError(_0x12b94a,null));};exports[_0xb0a7('0x4e')]=function(_0x122551,_0x29b8a0){var _0x2da5d5={'raw':![],'where':{'id':_0x122551[_0xb0a7('0x4f')]['id']}},_0x4eb2c2={};_0x4eb2c2['model']=_[_0xb0a7('0x3b')](db[_0xb0a7('0x35')][_0xb0a7('0x36')]);_0x4eb2c2[_0xb0a7('0x3a')]=_[_0xb0a7('0x3b')](_0x122551[_0xb0a7('0x3a')]);_0x4eb2c2['filters']=_[_0xb0a7('0x3d')](_0x4eb2c2[_0xb0a7('0x3e')],_0x4eb2c2['query']);_0x2da5d5[_0xb0a7('0x3f')]=_[_0xb0a7('0x3d')](_0x4eb2c2[_0xb0a7('0x3e')],qs[_0xb0a7('0x40')](_0x122551['query'][_0xb0a7('0x40')]));_0x2da5d5['attributes']=_0x2da5d5[_0xb0a7('0x3f')][_0xb0a7('0x41')]?_0x2da5d5[_0xb0a7('0x3f')]:_0x4eb2c2[_0xb0a7('0x3e')];if(_0x122551[_0xb0a7('0x3a')][_0xb0a7('0x4a')]){_0x2da5d5[_0xb0a7('0x4b')]=[{'all':!![]}];}_0x2da5d5=_[_0xb0a7('0x49')]({},_0x2da5d5,_0x122551['options']);return db['Team'][_0xb0a7('0x50')](_0x2da5d5)['then'](handleEntityNotFound(_0x29b8a0,null))['then'](respondWithResult(_0x29b8a0,null))[_0xb0a7('0x51')](handleError(_0x29b8a0,null));};exports[_0xb0a7('0x52')]=function(_0x28f17e,_0x4ea6ed){return db[_0xb0a7('0x35')]['create'](_0x28f17e[_0xb0a7('0x53')],{})[_0xb0a7('0x2e')](function(_0x1e6afd){var _0x1042e0=_0x28f17e[_0xb0a7('0x54')][_0xb0a7('0x55')]({'plain':!![]});if(!_0x1042e0)throw new Error(_0xb0a7('0x56'));if(_0x1042e0[_0xb0a7('0x57')]==='user'){var _0x7c81de=_0x1e6afd[_0xb0a7('0x55')]({'plain':!![]});var _0x4f4723=_0xb0a7('0x58');return db[_0xb0a7('0x59')][_0xb0a7('0x50')]({'where':{'name':_0x4f4723,'userProfileId':_0x1042e0[_0xb0a7('0x5a')]},'raw':!![]})['then'](function(_0x366173){if(_0x366173&&_0x366173[_0xb0a7('0x5b')]===0x0){return db['UserProfileResource'][_0xb0a7('0x52')]({'name':_0x7c81de[_0xb0a7('0x31')],'resourceId':_0x7c81de['id'],'type':_0x366173[_0xb0a7('0x31')],'sectionId':_0x366173['id']},{})[_0xb0a7('0x2e')](function(){return _0x1e6afd;});}else{return _0x1e6afd;}})[_0xb0a7('0x51')](function(_0xa307a4){logger[_0xb0a7('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xa307a4);throw _0xa307a4;});}return _0x1e6afd;})[_0xb0a7('0x2e')](respondWithResult(_0x4ea6ed,0xc9))['catch'](handleError(_0x4ea6ed,null));};exports[_0xb0a7('0x2d')]=function(_0x5ae963,_0x3733af){if(_0x5ae963['body']['id']){delete _0x5ae963[_0xb0a7('0x53')]['id'];}return db[_0xb0a7('0x35')]['find']({'where':{'id':_0x5ae963['params']['id']}})[_0xb0a7('0x2e')](handleEntityNotFound(_0x3733af,null))[_0xb0a7('0x2e')](saveUpdates(_0x5ae963[_0xb0a7('0x53')],null))[_0xb0a7('0x2e')](respondWithResult(_0x3733af,null))['catch'](handleError(_0x3733af,null));};exports[_0xb0a7('0x5c')]=function(_0x964650,_0x5ce591){var _0xd81336=_0x964650['params']['id'];var _0x183455=[];return db[_0xb0a7('0x5d')][_0xb0a7('0x5e')](function(_0x1d2ef4){var _0x1f39c2=_0xb0a7('0x5f')+_0xd81336;return db[_0xb0a7('0x5d')][_0xb0a7('0x3a')](_0x1f39c2,{'type':db[_0xb0a7('0x60')][_0xb0a7('0x61')]['SELECT'],'raw':!![],'transaction':_0x1d2ef4})[_0xb0a7('0x2e')](function(_0x32c7d0){_0x183455=_['map'](_0x32c7d0,function(_0x4e4200){return Number(_0x4e4200['UserId']);});})[_0xb0a7('0x2e')](function(){var _0x7d9751='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd81336;return db[_0xb0a7('0x5d')][_0xb0a7('0x3a')](_0x7d9751,{'type':db[_0xb0a7('0x60')][_0xb0a7('0x61')][_0xb0a7('0x62')],'raw':!![],'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(_0xff8694){var _0x3da64f=_[_0xb0a7('0x34')](_0xff8694,function(_0x161e0c){return Number(_0x161e0c['VoiceQueueId']);});return db[_0xb0a7('0x63')]['destroy']({'where':{'UserId':{'$in':_0x183455},'VoiceQueueId':{'$in':_0x3da64f}},'transaction':_0x1d2ef4});})['then'](function(){var _0x239907='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd81336;return db[_0xb0a7('0x5d')]['query'](_0x239907,{'type':db[_0xb0a7('0x60')]['QueryTypes'][_0xb0a7('0x62')],'raw':!![],'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(_0x26f4ac){var _0x5a8976=_[_0xb0a7('0x34')](_0x26f4ac,function(_0x1b07d8){return Number(_0x1b07d8[_0xb0a7('0x64')]);});return db[_0xb0a7('0x65')][_0xb0a7('0x5c')]({'where':{'UserId':{'$in':_0x183455},'MailQueueId':{'$in':_0x5a8976}},'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(){var _0x5b410d=_0xb0a7('0x66')+_0xd81336;return db[_0xb0a7('0x5d')][_0xb0a7('0x3a')](_0x5b410d,{'type':db[_0xb0a7('0x60')][_0xb0a7('0x61')][_0xb0a7('0x62')],'raw':!![],'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(_0x204d9a){var _0x50a341=_[_0xb0a7('0x34')](_0x204d9a,function(_0x526a24){return Number(_0x526a24['SmsQueueId']);});return db['UserSmsQueue'][_0xb0a7('0x5c')]({'where':{'UserId':{'$in':_0x183455},'SmsQueueId':{'$in':_0x50a341}},'transaction':_0x1d2ef4});})['then'](function(){var _0x56edc6=_0xb0a7('0x67')+_0xd81336;return db['sequelize']['query'](_0x56edc6,{'type':db[_0xb0a7('0x60')][_0xb0a7('0x61')][_0xb0a7('0x62')],'raw':!![],'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(_0x2f2faa){var _0x5e60c7=_[_0xb0a7('0x34')](_0x2f2faa,function(_0x1a2750){return Number(_0x1a2750[_0xb0a7('0x68')]);});return db[_0xb0a7('0x69')][_0xb0a7('0x5c')]({'where':{'UserId':{'$in':_0x183455},'ChatQueueId':{'$in':_0x5e60c7}},'transaction':_0x1d2ef4});})['then'](function(){var _0x26d745='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd81336;return db[_0xb0a7('0x5d')]['query'](_0x26d745,{'type':db[_0xb0a7('0x60')][_0xb0a7('0x61')][_0xb0a7('0x62')],'raw':!![],'transaction':_0x1d2ef4});})['then'](function(_0x8c0a0b){var _0x5cf6a2=_[_0xb0a7('0x34')](_0x8c0a0b,function(_0x11db56){return Number(_0x11db56[_0xb0a7('0x6a')]);});return db[_0xb0a7('0x6b')][_0xb0a7('0x5c')]({'where':{'UserId':{'$in':_0x183455},'FaxQueueId':{'$in':_0x5cf6a2}},'transaction':_0x1d2ef4});})['then'](function(){var _0x45f6f0='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd81336;return db[_0xb0a7('0x5d')][_0xb0a7('0x3a')](_0x45f6f0,{'type':db[_0xb0a7('0x60')][_0xb0a7('0x61')][_0xb0a7('0x62')],'raw':!![],'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(_0x2c7a2e){var _0x1ad856=_[_0xb0a7('0x34')](_0x2c7a2e,function(_0x2f8dd2){return Number(_0x2f8dd2['OpenchannelQueueId']);});return db['UserOpenchannelQueue'][_0xb0a7('0x5c')]({'where':{'UserId':{'$in':_0x183455},'OpenchannelQueueId':{'$in':_0x1ad856}},'transaction':_0x1d2ef4});})['then'](function(){var _0xa049df='SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20'+_0xd81336;return db[_0xb0a7('0x5d')][_0xb0a7('0x3a')](_0xa049df,{'type':db[_0xb0a7('0x60')][_0xb0a7('0x61')][_0xb0a7('0x62')],'raw':!![],'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(_0x5041f5){var _0x24d6a2=_[_0xb0a7('0x34')](_0x5041f5,function(_0x52c83d){return Number(_0x52c83d[_0xb0a7('0x6c')]);});return db[_0xb0a7('0x6d')]['destroy']({'where':{'UserId':{'$in':_0x183455},'WhatsappQueueId':{'$in':_0x24d6a2}},'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(){return db[_0xb0a7('0x6e')][_0xb0a7('0x50')]({'where':{'TeamId':_0xd81336}});})[_0xb0a7('0x2e')](function(_0xb60037){if(_0xb60037===null){return;}return db['UserVoicePrefix'][_0xb0a7('0x5c')]({'where':{'UserId':{'$in':_0x183455},'VoicePrefixId':_0xb60037[_0xb0a7('0x6f')]},'transaction':_0x1d2ef4});})['then'](function(){return db[_0xb0a7('0x35')]['destroy']({'where':{'id':_0xd81336},'cascade':!![],'transaction':_0x1d2ef4});})[_0xb0a7('0x2e')](function(_0x3766dc){if(_0x3766dc===0x0){_0x5ce591[_0xb0a7('0x21')](0x194);}else{return db[_0xb0a7('0x70')]['destroy']({'where':{'type':_0xb0a7('0x58'),'resourceId':_0xd81336},'cascade':!![],'transaction':_0x1d2ef4})[_0xb0a7('0x2e')](function(){_0x5ce591[_0xb0a7('0x28')](0xcc)[_0xb0a7('0x22')]();});}})[_0xb0a7('0x51')](function(_0x17072a){_0x5ce591[_0xb0a7('0x28')](0x1f4)[_0xb0a7('0x32')](_0x17072a);});});};exports[_0xb0a7('0x71')]=function(_0x5eed8f,_0x5aeb52,_0x1a547d){return db[_0xb0a7('0x35')][_0xb0a7('0x72')]({'where':{'id':_0x5eed8f['params']['id']}})[_0xb0a7('0x2e')](handleEntityNotFound(_0x5aeb52,null))[_0xb0a7('0x2e')](function(_0x59c467){if(!_0x5eed8f[_0xb0a7('0x3a')]['channel']||!utils[_0xb0a7('0x73')](_0x5eed8f[_0xb0a7('0x3a')][_0xb0a7('0x74')])){throw new db[(_0xb0a7('0x60'))][(_0xb0a7('0x75'))](_0xb0a7('0x76'));}var _0x1d1393={};var _0x19db63={};_0x19db63[_0xb0a7('0x3e')]=_[_0xb0a7('0x3b')](db[_[_0xb0a7('0x77')](_0x5eed8f[_0xb0a7('0x3a')]['channel'][_0xb0a7('0x78')]())+_0xb0a7('0x79')][_0xb0a7('0x36')]);_0x19db63[_0xb0a7('0x3a')]=_['keys'](_0x5eed8f[_0xb0a7('0x3a')]);_0x19db63[_0xb0a7('0x3c')]=_['intersection'](_0x19db63[_0xb0a7('0x3e')],_0x19db63['query']);_0x1d1393[_0xb0a7('0x3f')]=_[_0xb0a7('0x3d')](_0x19db63[_0xb0a7('0x3e')],qs[_0xb0a7('0x40')](_0x5eed8f[_0xb0a7('0x3a')][_0xb0a7('0x40')]));_0x1d1393[_0xb0a7('0x3f')]=_0x1d1393['attributes'][_0xb0a7('0x41')]?_0x1d1393[_0xb0a7('0x3f')]:_0x19db63[_0xb0a7('0x3e')];_0x1d1393['limit']=qs[_0xb0a7('0x26')](_0x5eed8f[_0xb0a7('0x3a')]['limit']);_0x1d1393[_0xb0a7('0x24')]=qs['offset'](_0x5eed8f[_0xb0a7('0x3a')][_0xb0a7('0x24')]);_0x1d1393[_0xb0a7('0x43')]=qs[_0xb0a7('0x44')](_0x5eed8f[_0xb0a7('0x3a')][_0xb0a7('0x44')]);_0x1d1393[_0xb0a7('0x45')]=qs[_0xb0a7('0x3c')](_['pick'](_0x5eed8f['query'],_0x19db63[_0xb0a7('0x3c')]));_0x1d1393=_[_0xb0a7('0x49')]({},_0x1d1393,_0x5eed8f[_0xb0a7('0x7a')]);return _0x59c467[_0xb0a7('0x55')+_['capitalize'](_0x5eed8f[_0xb0a7('0x3a')][_0xb0a7('0x74')][_0xb0a7('0x78')]())+_0xb0a7('0x7b')](_0x1d1393);})['then'](respondWithResult(_0x5aeb52,null))['catch'](handleError(_0x5aeb52,null));};exports['addQueues']=function(_0x99ab8f,_0x550781,_0x360b13){return db[_0xb0a7('0x35')][_0xb0a7('0x72')]({'where':{'id':_0x99ab8f[_0xb0a7('0x4f')]['id']}})['then'](function(_0x392c0d){if(_0x392c0d){if(!_0x99ab8f[_0xb0a7('0x53')][_0xb0a7('0x74')]||!utils['isValidChannel'](_0x99ab8f[_0xb0a7('0x53')][_0xb0a7('0x74')])){throw new db[(_0xb0a7('0x60'))][(_0xb0a7('0x75'))](_0xb0a7('0x76'));}return _0x392c0d[_0xb0a7('0x7c')+_[_0xb0a7('0x77')](_0x99ab8f[_0xb0a7('0x53')][_0xb0a7('0x74')][_0xb0a7('0x78')]())+_0xb0a7('0x7b')](_0x99ab8f[_0xb0a7('0x53')][_0xb0a7('0x7d')]);}return null;})[_0xb0a7('0x2e')](handleEntityNotFound(_0x550781,null))[_0xb0a7('0x2e')](respondWithStatusCode(_0x550781,null))[_0xb0a7('0x51')](handleError(_0x550781,null));};exports['removeQueues']=function(_0x4adc01,_0x1132af,_0x3c1d30){return db[_0xb0a7('0x35')][_0xb0a7('0x72')]({'where':{'id':_0x4adc01['params']['id']}})[_0xb0a7('0x2e')](function(_0x69b1b2){if(_0x69b1b2){if(!_0x4adc01[_0xb0a7('0x3a')][_0xb0a7('0x74')]||!utils[_0xb0a7('0x73')](_0x4adc01[_0xb0a7('0x3a')]['channel'])){throw new db[(_0xb0a7('0x60'))][(_0xb0a7('0x75'))](_0xb0a7('0x76'));}return _0x69b1b2[_0xb0a7('0x7e')+_[_0xb0a7('0x77')](_0x4adc01['query'][_0xb0a7('0x74')]['toLowerCase']())+_0xb0a7('0x7b')](_0x4adc01['query'][_0xb0a7('0x7d')]);}return null;})[_0xb0a7('0x2e')](handleEntityNotFound(_0x1132af,null))[_0xb0a7('0x2e')](respondWithStatusCode(_0x1132af,null))['catch'](handleError(_0x1132af,null));};exports['addAgents']=function(_0x168c86,_0x34d401){var _0x3e909f=_[_0xb0a7('0x7f')](_0x168c86[_0xb0a7('0x53')][_0xb0a7('0x7d')])?_0x168c86[_0xb0a7('0x53')]['ids']:[_0x168c86['body'][_0xb0a7('0x7d')]];var _0x31f68a=_0x168c86[_0xb0a7('0x4f')]['id'];return db[_0xb0a7('0x35')][_0xb0a7('0x50')]({'where':{'id':_0x31f68a}})['then'](handleEntityNotFound(_0x34d401,null))[_0xb0a7('0x2e')](function(_0x13a537){if(_0x13a537){var _0x257b27=['Voice',_0xb0a7('0x80'),_0xb0a7('0x81'),_0xb0a7('0x82'),_0xb0a7('0x83'),_0xb0a7('0x84'),_0xb0a7('0x85')];return db[_0xb0a7('0x5d')][_0xb0a7('0x5e')](function(_0x1e6d64){var _0x45c855=_['map'](_0x257b27,function(_0x27fcf8){var _0x363789={'attributes':['id',_0xb0a7('0x31')]};if(_0x27fcf8===_0xb0a7('0x86')){_0x363789[_0xb0a7('0x87')]={'attributes':[_0xb0a7('0x88')]};}return _0x13a537[_0xb0a7('0x55')+_0x27fcf8+_0xb0a7('0x7b')](_0x363789)['then'](function(_0x3b2f86){var _0x3cbcc8=_[_0xb0a7('0x34')](_0x3b2f86,function(_0x16329d){var _0x571f19=_[_0xb0a7('0x34')](_0x3e909f,function(_0x1ba197){var _0x14ff66={'where':{'UserId':_0x1ba197,[_0x27fcf8+_0xb0a7('0x89')]:_0x16329d['id']},'transaction':_0x1e6d64};if(_0x27fcf8===_0xb0a7('0x86')){_0x14ff66[_0xb0a7('0x1d')]={'penalty':_0x16329d[_0xb0a7('0x8a')][_0xb0a7('0x88')]};}return db[_0xb0a7('0x8b')+_0x27fcf8+_0xb0a7('0x79')][_0xb0a7('0x8c')](_0x14ff66)[_0xb0a7('0x2e')](function(){socket['emit'](_0xb0a7('0x54')+_0x27fcf8+_0xb0a7('0x8d'),{'UserId':_0x1ba197,[_0x27fcf8+'QueueId']:_0x16329d['id']});if(_0x27fcf8!=='Voice'){return;}return db[_0xb0a7('0x8b')][_0xb0a7('0x4c')]({'where':{'id':_0x3e909f,'online':0x1},'attributes':['id',_0xb0a7('0x31'),_0xb0a7('0x8e'),_0xb0a7('0x8f'),_0xb0a7('0x90')],'raw':!![]})[_0xb0a7('0x2e')](function(_0x2fe09f){var _0x1149da=_[_0xb0a7('0x34')](_0x2fe09f,function(_0x57c87f){return db[_0xb0a7('0x91')][_0xb0a7('0x92')]({'membername':_0x57c87f['name'],'UserId':_0x57c87f['id'],'queue_name':_0x16329d['name'],'VoiceQueueId':_0x16329d['id'],'interface':_['isNil'](_0x57c87f[_0xb0a7('0x90')])?util[_0xb0a7('0x93')](_0xb0a7('0x94'),_0x57c87f[_0xb0a7('0x31')]):_0x57c87f[_0xb0a7('0x90')],'paused':_0x57c87f[_0xb0a7('0x8f')]||![],'penalty':_0x16329d[_0xb0a7('0x8a')][_0xb0a7('0x88')]},{'transaction':_0x1e6d64});});return Promise[_0xb0a7('0x95')](_0x1149da);});});});return Promise[_0xb0a7('0x95')](_0x571f19);});return Promise[_0xb0a7('0x95')](_0x3cbcc8);})['then'](function(){return db[_0xb0a7('0x6e')][_0xb0a7('0x72')]({'where':{'teamId':_0x31f68a}})['then'](function(_0x2f780e){if(_0x2f780e){var _0x1c4603=_['map'](_0x3e909f,function(_0x231054){db[_0xb0a7('0x96')]['upsert']({'UserId':_0x231054,'VoicePrefixId':_0x2f780e[_0xb0a7('0x6f')]});});return Promise[_0xb0a7('0x95')](_0x1c4603);}});});});return Promise[_0xb0a7('0x95')](_0x45c855)['then'](function(){return _0x13a537[_0xb0a7('0x97')](_0x3e909f,{'transaction':_0x1e6d64})[_0xb0a7('0x98')](function(_0x16d7fb){return _0x16d7fb;});});});}})[_0xb0a7('0x2e')](respondWithResult(_0x34d401,null))[_0xb0a7('0x51')](handleError(_0x34d401,null));};exports[_0xb0a7('0x99')]=function(_0x54b99e,_0x2fdbfc){var _0x1564fc=_[_0xb0a7('0x7f')](_0x54b99e[_0xb0a7('0x3a')][_0xb0a7('0x7d')])?_0x54b99e[_0xb0a7('0x3a')][_0xb0a7('0x7d')]:[_0x54b99e[_0xb0a7('0x3a')][_0xb0a7('0x7d')]];var _0x551f97=_0x54b99e[_0xb0a7('0x4f')]['id'];return db[_0xb0a7('0x35')][_0xb0a7('0x50')]({'where':{'id':_0x551f97}})[_0xb0a7('0x2e')](handleEntityNotFound(_0x2fdbfc,null))[_0xb0a7('0x2e')](function(_0x1ee60b){if(_0x1ee60b){var _0x262226=['Voice',_0xb0a7('0x80'),_0xb0a7('0x81'),_0xb0a7('0x82'),_0xb0a7('0x83'),_0xb0a7('0x84'),'Whatsapp'];return db['sequelize'][_0xb0a7('0x5e')](function(_0x31bfc3){var _0x3bae43=_[_0xb0a7('0x34')](_0x262226,function(_0x48654b){var _0x5d9f18={'attributes':['id','name']};return _0x1ee60b[_0xb0a7('0x55')+_0x48654b+_0xb0a7('0x7b')](_0x5d9f18)[_0xb0a7('0x2e')](function(_0x3b9896){var _0x14b68c=_[_0xb0a7('0x34')](_0x3b9896,function(_0x5ff154){return _0x5ff154[_0xb0a7('0x99')](_0x1564fc,{'transaction':_0x31bfc3})[_0xb0a7('0x2e')](function(){var _0x22b43f=_[_0xb0a7('0x34')](_0x1564fc,function(_0x3313d8){socket[_0xb0a7('0x9a')]('user'+_0x48654b+_0xb0a7('0x9b'),{'UserId':Number(_0x3313d8),[_0x48654b+_0xb0a7('0x89')]:_0x5ff154['id']});if(_0x48654b!==_0xb0a7('0x86')){return;}return db['UserVoiceQueueRt'][_0xb0a7('0x5c')]({'where':{'VoiceQueueId':_0x5ff154['id'],'UserId':_0x3313d8},'transaction':_0x31bfc3});});return Promise[_0xb0a7('0x95')](_0x22b43f);});});return Promise[_0xb0a7('0x95')](_0x14b68c);});});return Promise['all'](_0x3bae43)[_0xb0a7('0x2e')](function(){return _0x1ee60b[_0xb0a7('0x99')](_0x1564fc,{'transaction':_0x31bfc3});})[_0xb0a7('0x2e')](function(){return db['TeamVoicePrefix'][_0xb0a7('0x72')]({'where':{'teamId':_0x551f97}})['then'](function(_0x270c67){if(_0x270c67){var _0x46a665=_[_0xb0a7('0x34')](_0x1564fc,function(_0x2b3521){db[_0xb0a7('0x96')][_0xb0a7('0x5c')]({'where':{'UserId':_0x2b3521,'VoicePrefixId':_0x270c67[_0xb0a7('0x6f')]}});});return Promise[_0xb0a7('0x95')](_0x46a665);}});});});}})[_0xb0a7('0x2e')](respondWithStatusCode(_0x2fdbfc,null))[_0xb0a7('0x51')](handleError(_0x2fdbfc,null));};exports[_0xb0a7('0x9c')]=function(_0x111395,_0x16ac68,_0x4004ff){var _0xdc86ed={};var _0x3aa88d={};var _0x12f401;var _0x2646fe;return db[_0xb0a7('0x35')][_0xb0a7('0x72')]({'where':{'id':_0x111395[_0xb0a7('0x4f')]['id']}})[_0xb0a7('0x2e')](handleEntityNotFound(_0x16ac68,null))['then'](function(_0x46b19c){if(_0x46b19c){_0x12f401=_0x46b19c;_0x3aa88d[_0xb0a7('0x3e')]=_[_0xb0a7('0x3b')](db[_0xb0a7('0x8b')][_0xb0a7('0x36')]);_0x3aa88d[_0xb0a7('0x3a')]=_[_0xb0a7('0x3b')](_0x111395['query']);_0x3aa88d[_0xb0a7('0x3c')]=_[_0xb0a7('0x3d')](_0x3aa88d[_0xb0a7('0x3e')],_0x3aa88d[_0xb0a7('0x3a')]);_0xdc86ed[_0xb0a7('0x3f')]=_['intersection'](_0x3aa88d['model'],qs[_0xb0a7('0x40')](_0x111395[_0xb0a7('0x3a')][_0xb0a7('0x40')]));_0xdc86ed[_0xb0a7('0x3f')]=_0xdc86ed[_0xb0a7('0x3f')][_0xb0a7('0x41')]?_0xdc86ed[_0xb0a7('0x3f')]:_0x3aa88d[_0xb0a7('0x3e')];_0xdc86ed['order']=qs[_0xb0a7('0x44')](_0x111395[_0xb0a7('0x3a')]['sort']);_0xdc86ed['where']=qs[_0xb0a7('0x3c')](_[_0xb0a7('0x46')](_0x111395[_0xb0a7('0x3a')],_0x3aa88d['filters']));if(_0x111395[_0xb0a7('0x3a')][_0xb0a7('0x47')]){_0xdc86ed[_0xb0a7('0x45')]=_[_0xb0a7('0x49')](_0xdc86ed[_0xb0a7('0x45')],{'$or':_[_0xb0a7('0x34')](_0xdc86ed[_0xb0a7('0x3f')],function(_0x182157){var _0x504f6c={};_0x504f6c[_0x182157]={'$like':'%'+_0x111395[_0xb0a7('0x3a')]['filter']+'%'};return _0x504f6c;})});}_0xdc86ed=_[_0xb0a7('0x49')]({},_0xdc86ed,_0x111395['options']);return _0x12f401[_0xb0a7('0x9c')](_0xdc86ed);}})['then'](function(_0x26a6c4){if(_0x26a6c4){_0x2646fe=_0x26a6c4[_0xb0a7('0x41')];if(!_0x111395['query'][_0xb0a7('0x42')]('nolimit')){_0xdc86ed[_0xb0a7('0x26')]=qs[_0xb0a7('0x26')](_0x111395['query'][_0xb0a7('0x26')]);_0xdc86ed[_0xb0a7('0x24')]=qs['offset'](_0x111395['query'][_0xb0a7('0x24')]);}return _0x12f401['getAgents'](_0xdc86ed);}})[_0xb0a7('0x2e')](function(_0x3b941b){if(_0x3b941b){return _0x3b941b?{'count':_0x2646fe,'rows':_0x3b941b}:null;}})[_0xb0a7('0x2e')](respondWithResult(_0x16ac68,null))[_0xb0a7('0x51')](handleError(_0x16ac68,null));}; \ No newline at end of file +var _0x8a52=['moment','bluebird','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/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./team.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','reject','save','update','then','error','send','index','Team','rawAttributes','fieldName','model','map','name','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','rows','catch','show','params','includeAll','include','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Teams','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','sequelize','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','UserId','Sequelize','VoiceQueueId','UserVoiceQueue','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserFaxQueue','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','findOne','channel','Unknown\x20channel','capitalize','toLowerCase','pick','isValidChannel','ValidationError','Queues','ids','remove','addAgents','isArray','Voice','Mail','Sms','Whatsapp','through','penalty','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','emit','Queue:save','findAll','voicePause','upsert','interface','format','SIP/%s','all','removeAgents','Chat','Fax','Openchannel','transaction','UserVoiceQueueRt','getAgents','eml-format','rimraf','fast-json-patch','request-promise'];(function(_0x32341b,_0x54e01f){var _0x258ce6=function(_0x2bd19a){while(--_0x2bd19a){_0x32341b['push'](_0x32341b['shift']());}};_0x258ce6(++_0x54e01f);}(_0x8a52,0x126));var _0x28a5=function(_0x28bf79,_0xcde4cb){_0x28bf79=_0x28bf79-0x0;var _0xda2c6f=_0x8a52[_0x28bf79];return _0xda2c6f;};'use strict';var emlformat=require(_0x28a5('0x0'));var rimraf=require(_0x28a5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x28a5('0x2'));var rp=require(_0x28a5('0x3'));var moment=require(_0x28a5('0x4'));var BPromise=require(_0x28a5('0x5'));var Mustache=require(_0x28a5('0x6'));var util=require(_0x28a5('0x7'));var path=require(_0x28a5('0x8'));var sox=require(_0x28a5('0x9'));var csv=require(_0x28a5('0xa'));var ejs=require(_0x28a5('0xb'));var fs=require('fs');var fs_extra=require(_0x28a5('0xc'));var _=require(_0x28a5('0xd'));var squel=require(_0x28a5('0xe'));var crypto=require(_0x28a5('0xf'));var jsforce=require(_0x28a5('0x10'));var deskjs=require(_0x28a5('0x11'));var toCsv=require(_0x28a5('0xa'));var querystring=require(_0x28a5('0x12'));var Papa=require(_0x28a5('0x13'));var Redis=require(_0x28a5('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x28a5('0x15'));var as=require(_0x28a5('0x16'));var hardwareService=require(_0x28a5('0x17'));var logger=require('../../config/logger')(_0x28a5('0x18'));var utils=require(_0x28a5('0x19'));var config=require(_0x28a5('0x1a'));var licenseUtil=require('../../config/license/util');var db=require(_0x28a5('0x1b'))['db'];config[_0x28a5('0x1c')]=_[_0x28a5('0x1d')](config[_0x28a5('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x28a5('0x1e'))(new Redis(config[_0x28a5('0x1c')]));require(_0x28a5('0x1f'))[_0x28a5('0x20')](socket);function respondWithStatusCode(_0x4f8f80,_0x1bac07){_0x1bac07=_0x1bac07||0xcc;return function(_0x508469){if(_0x508469){return _0x4f8f80[_0x28a5('0x21')](_0x1bac07);}return _0x4f8f80['status'](_0x1bac07)[_0x28a5('0x22')]();};}function respondWithResult(_0x4262c4,_0x39f1dd){_0x39f1dd=_0x39f1dd||0xc8;return function(_0x13f2dd){if(_0x13f2dd){return _0x4262c4[_0x28a5('0x23')](_0x39f1dd)[_0x28a5('0x24')](_0x13f2dd);}};}function respondWithFilteredResult(_0x475b68,_0x2c17c8){return function(_0x5227d4){if(_0x5227d4){var _0x4aa22b=typeof _0x2c17c8[_0x28a5('0x25')]===_0x28a5('0x26')&&typeof _0x2c17c8[_0x28a5('0x27')]===_0x28a5('0x26');var _0x2a3504=_0x5227d4[_0x28a5('0x28')];var _0x4d0afd=_0x4aa22b?0x0:_0x2c17c8[_0x28a5('0x25')];var _0x3bdf69=_0x4aa22b?_0x5227d4[_0x28a5('0x28')]:_0x2c17c8[_0x28a5('0x25')]+_0x2c17c8[_0x28a5('0x27')];var _0x22161c;if(_0x3bdf69>=_0x2a3504){_0x3bdf69=_0x2a3504;_0x22161c=0xc8;}else{_0x22161c=0xce;}_0x475b68[_0x28a5('0x23')](_0x22161c);return _0x475b68['set']('Content-Range',_0x4d0afd+'-'+_0x3bdf69+'/'+_0x2a3504)[_0x28a5('0x24')](_0x5227d4);}return null;};}function patchUpdates(_0x31a4dd){return function(_0x11e3f4){try{jsonpatch['apply'](_0x11e3f4,_0x31a4dd,!![]);}catch(_0x1b5a55){return BPromise[_0x28a5('0x29')](_0x1b5a55);}return _0x11e3f4[_0x28a5('0x2a')]();};}function saveUpdates(_0x458bd3,_0x5a76d6){return function(_0x47c9fd){if(_0x47c9fd){return _0x47c9fd[_0x28a5('0x2b')](_0x458bd3)[_0x28a5('0x2c')](function(_0x52dbe2){return _0x52dbe2;});}return null;};}function handleEntityNotFound(_0x50e217,_0x455d0d){return function(_0xe666a2){if(!_0xe666a2){_0x50e217['sendStatus'](0x194);}return _0xe666a2;};}function handleError(_0x39a9a8,_0xf3c0a2){_0xf3c0a2=_0xf3c0a2||0x1f4;return function(_0x4a5232){logger[_0x28a5('0x2d')](_0x4a5232['stack']);if(_0x4a5232['name']){delete _0x4a5232['name'];}_0x39a9a8[_0x28a5('0x23')](_0xf3c0a2)[_0x28a5('0x2e')](_0x4a5232);};}exports[_0x28a5('0x2f')]=function(_0x10da0d,_0x364082){var _0x27a5e4={},_0x26dd10={},_0x2ddd74={'count':0x0,'rows':[]};var _0x51945c=_['map'](db[_0x28a5('0x30')][_0x28a5('0x31')],function(_0x5189a7){return{'name':_0x5189a7[_0x28a5('0x32')],'type':_0x5189a7['type']['key']};});_0x26dd10[_0x28a5('0x33')]=_[_0x28a5('0x34')](_0x51945c,_0x28a5('0x35'));_0x26dd10[_0x28a5('0x36')]=_[_0x28a5('0x37')](_0x10da0d['query']);_0x26dd10[_0x28a5('0x38')]=_[_0x28a5('0x39')](_0x26dd10[_0x28a5('0x33')],_0x26dd10['query']);_0x27a5e4['attributes']=_[_0x28a5('0x39')](_0x26dd10[_0x28a5('0x33')],qs[_0x28a5('0x3a')](_0x10da0d[_0x28a5('0x36')][_0x28a5('0x3a')]));_0x27a5e4['attributes']=_0x27a5e4[_0x28a5('0x3b')][_0x28a5('0x3c')]?_0x27a5e4[_0x28a5('0x3b')]:_0x26dd10[_0x28a5('0x33')];if(!_0x10da0d[_0x28a5('0x36')][_0x28a5('0x3d')](_0x28a5('0x3e'))){_0x27a5e4['limit']=qs[_0x28a5('0x27')](_0x10da0d[_0x28a5('0x36')][_0x28a5('0x27')]);_0x27a5e4[_0x28a5('0x25')]=qs[_0x28a5('0x25')](_0x10da0d[_0x28a5('0x36')][_0x28a5('0x25')]);}_0x27a5e4[_0x28a5('0x3f')]=qs['sort'](_0x10da0d[_0x28a5('0x36')][_0x28a5('0x40')]);_0x27a5e4[_0x28a5('0x41')]=qs[_0x28a5('0x38')](_['pick'](_0x10da0d[_0x28a5('0x36')],_0x26dd10[_0x28a5('0x38')]),_0x51945c);if(_0x10da0d['query'][_0x28a5('0x42')]){_0x27a5e4[_0x28a5('0x41')]=_[_0x28a5('0x43')](_0x27a5e4[_0x28a5('0x41')],{'$or':_[_0x28a5('0x34')](_0x51945c,function(_0x4ee433){if(_0x4ee433[_0x28a5('0x44')]!==_0x28a5('0x45')){var _0x3b2de3={};_0x3b2de3[_0x4ee433['name']]={'$like':'%'+_0x10da0d['query'][_0x28a5('0x42')]+'%'};return _0x3b2de3;}})});}_0x27a5e4=_[_0x28a5('0x43')]({},_0x27a5e4,_0x10da0d['options']);var _0x5b95e4={'where':_0x27a5e4[_0x28a5('0x41')]};return db[_0x28a5('0x30')][_0x28a5('0x28')](_0x5b95e4)['then'](function(_0x347b23){_0x2ddd74[_0x28a5('0x28')]=_0x347b23;if(_0x10da0d[_0x28a5('0x36')]['includeAll']){_0x27a5e4['include']=[{'all':!![]}];}return db[_0x28a5('0x30')]['findAll'](_0x27a5e4);})[_0x28a5('0x2c')](function(_0x31e399){_0x2ddd74[_0x28a5('0x46')]=_0x31e399;return _0x2ddd74;})[_0x28a5('0x2c')](respondWithFilteredResult(_0x364082,_0x27a5e4))[_0x28a5('0x47')](handleError(_0x364082,null));};exports[_0x28a5('0x48')]=function(_0xe3b1d8,_0x5a5a1c){var _0x508995={'raw':![],'where':{'id':_0xe3b1d8[_0x28a5('0x49')]['id']}},_0x306464={};_0x306464[_0x28a5('0x33')]=_['keys'](db[_0x28a5('0x30')][_0x28a5('0x31')]);_0x306464['query']=_[_0x28a5('0x37')](_0xe3b1d8[_0x28a5('0x36')]);_0x306464['filters']=_[_0x28a5('0x39')](_0x306464[_0x28a5('0x33')],_0x306464[_0x28a5('0x36')]);_0x508995[_0x28a5('0x3b')]=_[_0x28a5('0x39')](_0x306464['model'],qs['fields'](_0xe3b1d8['query'][_0x28a5('0x3a')]));_0x508995[_0x28a5('0x3b')]=_0x508995[_0x28a5('0x3b')]['length']?_0x508995[_0x28a5('0x3b')]:_0x306464['model'];if(_0xe3b1d8[_0x28a5('0x36')][_0x28a5('0x4a')]){_0x508995[_0x28a5('0x4b')]=[{'all':!![]}];}_0x508995=_[_0x28a5('0x43')]({},_0x508995,_0xe3b1d8[_0x28a5('0x4c')]);return db[_0x28a5('0x30')][_0x28a5('0x4d')](_0x508995)[_0x28a5('0x2c')](handleEntityNotFound(_0x5a5a1c,null))[_0x28a5('0x2c')](respondWithResult(_0x5a5a1c,null))['catch'](handleError(_0x5a5a1c,null));};exports[_0x28a5('0x4e')]=function(_0x101b3b,_0xbadcc6){return db['Team']['create'](_0x101b3b[_0x28a5('0x4f')],{})[_0x28a5('0x2c')](function(_0xb2a6b3){var _0x39fed1=_0x101b3b[_0x28a5('0x50')][_0x28a5('0x51')]({'plain':!![]});if(!_0x39fed1)throw new Error(_0x28a5('0x52'));if(_0x39fed1['role']===_0x28a5('0x50')){var _0x4207da=_0xb2a6b3['get']({'plain':!![]});var _0x138c7d=_0x28a5('0x53');return db[_0x28a5('0x54')][_0x28a5('0x4d')]({'where':{'name':_0x138c7d,'userProfileId':_0x39fed1[_0x28a5('0x55')]},'raw':!![]})['then'](function(_0x3dc5bc){if(_0x3dc5bc&&_0x3dc5bc['autoAssociation']===0x0){return db['UserProfileResource'][_0x28a5('0x4e')]({'name':_0x4207da[_0x28a5('0x35')],'resourceId':_0x4207da['id'],'type':_0x3dc5bc[_0x28a5('0x35')],'sectionId':_0x3dc5bc['id']},{})[_0x28a5('0x2c')](function(){return _0xb2a6b3;});}else{return _0xb2a6b3;}})['catch'](function(_0x338420){logger[_0x28a5('0x2d')](_0x28a5('0x56'),_0x338420);throw _0x338420;});}return _0xb2a6b3;})[_0x28a5('0x2c')](respondWithResult(_0xbadcc6,0xc9))['catch'](handleError(_0xbadcc6,null));};exports[_0x28a5('0x2b')]=function(_0x1549a8,_0x2bd347){if(_0x1549a8[_0x28a5('0x4f')]['id']){delete _0x1549a8[_0x28a5('0x4f')]['id'];}return db[_0x28a5('0x30')][_0x28a5('0x4d')]({'where':{'id':_0x1549a8[_0x28a5('0x49')]['id']}})[_0x28a5('0x2c')](handleEntityNotFound(_0x2bd347,null))[_0x28a5('0x2c')](saveUpdates(_0x1549a8[_0x28a5('0x4f')],null))[_0x28a5('0x2c')](respondWithResult(_0x2bd347,null))['catch'](handleError(_0x2bd347,null));};exports[_0x28a5('0x57')]=function(_0x59ff0b,_0x228a5c){var _0x460f33=_0x59ff0b[_0x28a5('0x49')]['id'];var _0x44fd03=[];return db[_0x28a5('0x58')]['transaction'](function(_0x2b075f){var _0x56726f=_0x28a5('0x59')+_0x460f33;return db[_0x28a5('0x58')][_0x28a5('0x36')](_0x56726f,{'type':db['Sequelize'][_0x28a5('0x5a')][_0x28a5('0x5b')],'raw':!![],'transaction':_0x2b075f})['then'](function(_0x52db09){_0x44fd03=_['map'](_0x52db09,function(_0x30c7b3){return Number(_0x30c7b3[_0x28a5('0x5c')]);});})[_0x28a5('0x2c')](function(){var _0x346217='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x460f33;return db[_0x28a5('0x58')]['query'](_0x346217,{'type':db[_0x28a5('0x5d')][_0x28a5('0x5a')][_0x28a5('0x5b')],'raw':!![],'transaction':_0x2b075f});})['then'](function(_0x335dba){var _0x2a8353=_['map'](_0x335dba,function(_0x2f29d0){return Number(_0x2f29d0[_0x28a5('0x5e')]);});return db[_0x28a5('0x5f')]['destroy']({'where':{'UserId':{'$in':_0x44fd03},'VoiceQueueId':{'$in':_0x2a8353}},'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(){var _0x1d2ce=_0x28a5('0x60')+_0x460f33;return db[_0x28a5('0x58')][_0x28a5('0x36')](_0x1d2ce,{'type':db[_0x28a5('0x5d')][_0x28a5('0x5a')][_0x28a5('0x5b')],'raw':!![],'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(_0x3bdc46){var _0x5ac0c1=_[_0x28a5('0x34')](_0x3bdc46,function(_0x2bc95b){return Number(_0x2bc95b['MailQueueId']);});return db[_0x28a5('0x61')][_0x28a5('0x57')]({'where':{'UserId':{'$in':_0x44fd03},'MailQueueId':{'$in':_0x5ac0c1}},'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(){var _0x39822d=_0x28a5('0x62')+_0x460f33;return db[_0x28a5('0x58')][_0x28a5('0x36')](_0x39822d,{'type':db[_0x28a5('0x5d')]['QueryTypes'][_0x28a5('0x5b')],'raw':!![],'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(_0x15dcb8){var _0x42cbef=_[_0x28a5('0x34')](_0x15dcb8,function(_0x16b717){return Number(_0x16b717[_0x28a5('0x63')]);});return db['UserSmsQueue']['destroy']({'where':{'UserId':{'$in':_0x44fd03},'SmsQueueId':{'$in':_0x42cbef}},'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(){var _0x379728=_0x28a5('0x64')+_0x460f33;return db[_0x28a5('0x58')][_0x28a5('0x36')](_0x379728,{'type':db[_0x28a5('0x5d')][_0x28a5('0x5a')][_0x28a5('0x5b')],'raw':!![],'transaction':_0x2b075f});})['then'](function(_0x35df63){var _0x2a7dcf=_[_0x28a5('0x34')](_0x35df63,function(_0x39b9f5){return Number(_0x39b9f5[_0x28a5('0x65')]);});return db['UserChatQueue'][_0x28a5('0x57')]({'where':{'UserId':{'$in':_0x44fd03},'ChatQueueId':{'$in':_0x2a7dcf}},'transaction':_0x2b075f});})['then'](function(){var _0x470d00='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x460f33;return db['sequelize'][_0x28a5('0x36')](_0x470d00,{'type':db[_0x28a5('0x5d')][_0x28a5('0x5a')]['SELECT'],'raw':!![],'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(_0x44684d){var _0x204a11=_[_0x28a5('0x34')](_0x44684d,function(_0xe20f03){return Number(_0xe20f03['FaxQueueId']);});return db[_0x28a5('0x66')][_0x28a5('0x57')]({'where':{'UserId':{'$in':_0x44fd03},'FaxQueueId':{'$in':_0x204a11}},'transaction':_0x2b075f});})['then'](function(){var _0x199eee='SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20'+_0x460f33;return db['sequelize'][_0x28a5('0x36')](_0x199eee,{'type':db[_0x28a5('0x5d')][_0x28a5('0x5a')]['SELECT'],'raw':!![],'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(_0x7c6890){var _0x515cc1=_[_0x28a5('0x34')](_0x7c6890,function(_0x2a6e1a){return Number(_0x2a6e1a['OpenchannelQueueId']);});return db[_0x28a5('0x67')][_0x28a5('0x57')]({'where':{'UserId':{'$in':_0x44fd03},'OpenchannelQueueId':{'$in':_0x515cc1}},'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(){var _0xf506d2=_0x28a5('0x68')+_0x460f33;return db['sequelize'][_0x28a5('0x36')](_0xf506d2,{'type':db[_0x28a5('0x5d')][_0x28a5('0x5a')][_0x28a5('0x5b')],'raw':!![],'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(_0x948012){var _0x1e23f0=_[_0x28a5('0x34')](_0x948012,function(_0x47b1db){return Number(_0x47b1db['WhatsappQueueId']);});return db[_0x28a5('0x69')]['destroy']({'where':{'UserId':{'$in':_0x44fd03},'WhatsappQueueId':{'$in':_0x1e23f0}},'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(){return db[_0x28a5('0x6a')][_0x28a5('0x4d')]({'where':{'TeamId':_0x460f33}});})[_0x28a5('0x2c')](function(_0x4bfb8d){if(_0x4bfb8d===null){return;}return db[_0x28a5('0x6b')]['destroy']({'where':{'UserId':{'$in':_0x44fd03},'VoicePrefixId':_0x4bfb8d[_0x28a5('0x6c')]},'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(){return db['Team'][_0x28a5('0x57')]({'where':{'id':_0x460f33},'cascade':!![],'transaction':_0x2b075f});})[_0x28a5('0x2c')](function(_0x4e097f){if(_0x4e097f===0x0){_0x228a5c[_0x28a5('0x21')](0x194);}else{return db['UserProfileResource'][_0x28a5('0x57')]({'where':{'type':_0x28a5('0x53'),'resourceId':_0x460f33},'cascade':!![],'transaction':_0x2b075f})['then'](function(){_0x228a5c[_0x28a5('0x23')](0xcc)[_0x28a5('0x22')]();});}})[_0x28a5('0x47')](function(_0xf29232){_0x228a5c[_0x28a5('0x23')](0x1f4)['send'](_0xf29232);});});};exports['getQueues']=function(_0x586dd5,_0x549543,_0x401588){return db[_0x28a5('0x30')][_0x28a5('0x6d')]({'where':{'id':_0x586dd5['params']['id']}})['then'](handleEntityNotFound(_0x549543,null))[_0x28a5('0x2c')](function(_0x33ebf7){if(!_0x586dd5[_0x28a5('0x36')][_0x28a5('0x6e')]||!utils['isValidChannel'](_0x586dd5[_0x28a5('0x36')][_0x28a5('0x6e')])){throw new db['Sequelize']['ValidationError'](_0x28a5('0x6f'));}var _0x17055d={};var _0x34d0f9={};_0x34d0f9[_0x28a5('0x33')]=_[_0x28a5('0x37')](db[_[_0x28a5('0x70')](_0x586dd5[_0x28a5('0x36')][_0x28a5('0x6e')][_0x28a5('0x71')]())+'Queue'][_0x28a5('0x31')]);_0x34d0f9[_0x28a5('0x36')]=_[_0x28a5('0x37')](_0x586dd5[_0x28a5('0x36')]);_0x34d0f9[_0x28a5('0x38')]=_[_0x28a5('0x39')](_0x34d0f9['model'],_0x34d0f9[_0x28a5('0x36')]);_0x17055d[_0x28a5('0x3b')]=_[_0x28a5('0x39')](_0x34d0f9[_0x28a5('0x33')],qs[_0x28a5('0x3a')](_0x586dd5[_0x28a5('0x36')]['fields']));_0x17055d[_0x28a5('0x3b')]=_0x17055d[_0x28a5('0x3b')]['length']?_0x17055d[_0x28a5('0x3b')]:_0x34d0f9['model'];_0x17055d[_0x28a5('0x27')]=qs[_0x28a5('0x27')](_0x586dd5[_0x28a5('0x36')][_0x28a5('0x27')]);_0x17055d[_0x28a5('0x25')]=qs[_0x28a5('0x25')](_0x586dd5[_0x28a5('0x36')][_0x28a5('0x25')]);_0x17055d[_0x28a5('0x3f')]=qs['sort'](_0x586dd5[_0x28a5('0x36')][_0x28a5('0x40')]);_0x17055d[_0x28a5('0x41')]=qs[_0x28a5('0x38')](_[_0x28a5('0x72')](_0x586dd5[_0x28a5('0x36')],_0x34d0f9[_0x28a5('0x38')]));_0x17055d=_[_0x28a5('0x43')]({},_0x17055d,_0x586dd5[_0x28a5('0x4c')]);return _0x33ebf7[_0x28a5('0x51')+_[_0x28a5('0x70')](_0x586dd5[_0x28a5('0x36')]['channel'][_0x28a5('0x71')]())+'Queues'](_0x17055d);})[_0x28a5('0x2c')](respondWithResult(_0x549543,null))[_0x28a5('0x47')](handleError(_0x549543,null));};exports['addQueues']=function(_0x2c8a61,_0x309aa5,_0x1dbf1e){return db[_0x28a5('0x30')][_0x28a5('0x6d')]({'where':{'id':_0x2c8a61[_0x28a5('0x49')]['id']}})['then'](function(_0xc1a5){if(_0xc1a5){if(!_0x2c8a61[_0x28a5('0x4f')][_0x28a5('0x6e')]||!utils[_0x28a5('0x73')](_0x2c8a61[_0x28a5('0x4f')]['channel'])){throw new db[(_0x28a5('0x5d'))][(_0x28a5('0x74'))]('Unknown\x20channel');}return _0xc1a5['add'+_[_0x28a5('0x70')](_0x2c8a61[_0x28a5('0x4f')]['channel']['toLowerCase']())+_0x28a5('0x75')](_0x2c8a61[_0x28a5('0x4f')][_0x28a5('0x76')]);}return null;})[_0x28a5('0x2c')](handleEntityNotFound(_0x309aa5,null))[_0x28a5('0x2c')](respondWithStatusCode(_0x309aa5,null))[_0x28a5('0x47')](handleError(_0x309aa5,null));};exports['removeQueues']=function(_0x5a009f,_0x3e5c02,_0x1a5ecc){return db[_0x28a5('0x30')][_0x28a5('0x6d')]({'where':{'id':_0x5a009f[_0x28a5('0x49')]['id']}})[_0x28a5('0x2c')](function(_0x2ade90){if(_0x2ade90){if(!_0x5a009f[_0x28a5('0x36')][_0x28a5('0x6e')]||!utils[_0x28a5('0x73')](_0x5a009f[_0x28a5('0x36')][_0x28a5('0x6e')])){throw new db[(_0x28a5('0x5d'))][(_0x28a5('0x74'))](_0x28a5('0x6f'));}return _0x2ade90[_0x28a5('0x77')+_[_0x28a5('0x70')](_0x5a009f[_0x28a5('0x36')][_0x28a5('0x6e')]['toLowerCase']())+_0x28a5('0x75')](_0x5a009f[_0x28a5('0x36')][_0x28a5('0x76')]);}return null;})[_0x28a5('0x2c')](handleEntityNotFound(_0x3e5c02,null))[_0x28a5('0x2c')](respondWithStatusCode(_0x3e5c02,null))[_0x28a5('0x47')](handleError(_0x3e5c02,null));};exports[_0x28a5('0x78')]=function(_0x1a79dd,_0x2ed76c){var _0x2d8b15=_[_0x28a5('0x79')](_0x1a79dd[_0x28a5('0x4f')][_0x28a5('0x76')])?_0x1a79dd[_0x28a5('0x4f')]['ids']:[_0x1a79dd[_0x28a5('0x4f')][_0x28a5('0x76')]];var _0x5b82cd=_0x1a79dd[_0x28a5('0x49')]['id'];return db['Team'][_0x28a5('0x4d')]({'where':{'id':_0x5b82cd}})[_0x28a5('0x2c')](handleEntityNotFound(_0x2ed76c,null))['then'](function(_0xf7f5d4){if(_0xf7f5d4){var _0x406205=[_0x28a5('0x7a'),'Chat',_0x28a5('0x7b'),_0x28a5('0x7c'),'Fax','Openchannel',_0x28a5('0x7d')];return db['sequelize']['transaction'](function(_0x3915e0){var _0x522ba9=_['map'](_0x406205,function(_0x7b797f){var _0x49f4fe={'attributes':['id',_0x28a5('0x35')]};if(_0x7b797f===_0x28a5('0x7a')){_0x49f4fe[_0x28a5('0x7e')]={'attributes':[_0x28a5('0x7f')]};}return _0xf7f5d4[_0x28a5('0x51')+_0x7b797f+_0x28a5('0x75')](_0x49f4fe)[_0x28a5('0x2c')](function(_0x5e2f7e){var _0x19e617=_[_0x28a5('0x34')](_0x5e2f7e,function(_0x2ce5d4){var _0x4b0dc7=_[_0x28a5('0x34')](_0x2d8b15,function(_0x45c1d7){var _0x2c38f6={'where':{'UserId':_0x45c1d7,[_0x7b797f+_0x28a5('0x80')]:_0x2ce5d4['id']},'transaction':_0x3915e0};if(_0x7b797f===_0x28a5('0x7a')){_0x2c38f6['defaults']={'penalty':_0x2ce5d4[_0x28a5('0x81')][_0x28a5('0x7f')]};}return db[_0x28a5('0x82')+_0x7b797f+_0x28a5('0x83')][_0x28a5('0x84')](_0x2c38f6)['then'](function(){socket[_0x28a5('0x85')](_0x28a5('0x50')+_0x7b797f+_0x28a5('0x86'),{'UserId':_0x45c1d7,[_0x7b797f+_0x28a5('0x80')]:_0x2ce5d4['id']});if(_0x7b797f!==_0x28a5('0x7a')){return;}return db[_0x28a5('0x82')][_0x28a5('0x87')]({'where':{'id':_0x2d8b15,'online':0x1},'attributes':['id','name','online',_0x28a5('0x88'),'interface'],'raw':!![]})['then'](function(_0x435b2b){var _0x42860f=_[_0x28a5('0x34')](_0x435b2b,function(_0x512ea8){return db['UserVoiceQueueRt'][_0x28a5('0x89')]({'membername':_0x512ea8[_0x28a5('0x35')],'UserId':_0x512ea8['id'],'queue_name':_0x2ce5d4[_0x28a5('0x35')],'VoiceQueueId':_0x2ce5d4['id'],'interface':_['isNil'](_0x512ea8[_0x28a5('0x8a')])?util[_0x28a5('0x8b')](_0x28a5('0x8c'),_0x512ea8[_0x28a5('0x35')]):_0x512ea8[_0x28a5('0x8a')],'paused':_0x512ea8[_0x28a5('0x88')]||![],'penalty':_0x2ce5d4[_0x28a5('0x81')][_0x28a5('0x7f')]},{'transaction':_0x3915e0});});return Promise[_0x28a5('0x8d')](_0x42860f);});});});return Promise[_0x28a5('0x8d')](_0x4b0dc7);});return Promise['all'](_0x19e617);})[_0x28a5('0x2c')](function(){return db[_0x28a5('0x6a')][_0x28a5('0x6d')]({'where':{'teamId':_0x5b82cd}})[_0x28a5('0x2c')](function(_0x46d389){if(_0x46d389){var _0x2a9912=_[_0x28a5('0x34')](_0x2d8b15,function(_0x5310e0){db['UserVoicePrefix']['upsert']({'UserId':_0x5310e0,'VoicePrefixId':_0x46d389['VoicePrefixId']});});return Promise[_0x28a5('0x8d')](_0x2a9912);}});});});return Promise[_0x28a5('0x8d')](_0x522ba9)[_0x28a5('0x2c')](function(){return _0xf7f5d4[_0x28a5('0x78')](_0x2d8b15,{'transaction':_0x3915e0})['spread'](function(_0x5849ac){return _0x5849ac;});});});}})[_0x28a5('0x2c')](respondWithResult(_0x2ed76c,null))['catch'](handleError(_0x2ed76c,null));};exports[_0x28a5('0x8e')]=function(_0x24abbd,_0x5984d4){var _0x2810ab=_['isArray'](_0x24abbd['query'][_0x28a5('0x76')])?_0x24abbd[_0x28a5('0x36')][_0x28a5('0x76')]:[_0x24abbd[_0x28a5('0x36')][_0x28a5('0x76')]];var _0x36287b=_0x24abbd[_0x28a5('0x49')]['id'];return db[_0x28a5('0x30')][_0x28a5('0x4d')]({'where':{'id':_0x36287b}})[_0x28a5('0x2c')](handleEntityNotFound(_0x5984d4,null))[_0x28a5('0x2c')](function(_0xf33655){if(_0xf33655){var _0x4ef8ef=[_0x28a5('0x7a'),_0x28a5('0x8f'),_0x28a5('0x7b'),'Sms',_0x28a5('0x90'),_0x28a5('0x91'),_0x28a5('0x7d')];return db[_0x28a5('0x58')][_0x28a5('0x92')](function(_0x3559ae){var _0x1ff727=_[_0x28a5('0x34')](_0x4ef8ef,function(_0x192d00){var _0x3aef4f={'attributes':['id',_0x28a5('0x35')]};return _0xf33655[_0x28a5('0x51')+_0x192d00+'Queues'](_0x3aef4f)['then'](function(_0x40c63f){var _0x67206b=_[_0x28a5('0x34')](_0x40c63f,function(_0x32c0a7){return _0x32c0a7[_0x28a5('0x8e')](_0x2810ab,{'transaction':_0x3559ae})[_0x28a5('0x2c')](function(){var _0x2aaf26=_[_0x28a5('0x34')](_0x2810ab,function(_0x62d8ff){socket[_0x28a5('0x85')]('user'+_0x192d00+'Queue:remove',{'UserId':Number(_0x62d8ff),[_0x192d00+_0x28a5('0x80')]:_0x32c0a7['id']});if(_0x192d00!=='Voice'){return;}return db[_0x28a5('0x93')][_0x28a5('0x57')]({'where':{'VoiceQueueId':_0x32c0a7['id'],'UserId':_0x62d8ff},'transaction':_0x3559ae});});return Promise[_0x28a5('0x8d')](_0x2aaf26);});});return Promise[_0x28a5('0x8d')](_0x67206b);});});return Promise[_0x28a5('0x8d')](_0x1ff727)[_0x28a5('0x2c')](function(){return _0xf33655['removeAgents'](_0x2810ab,{'transaction':_0x3559ae});})[_0x28a5('0x2c')](function(){return db[_0x28a5('0x6a')][_0x28a5('0x6d')]({'where':{'teamId':_0x36287b}})[_0x28a5('0x2c')](function(_0x23fcb6){if(_0x23fcb6){var _0x1c3f07=_[_0x28a5('0x34')](_0x2810ab,function(_0x5c4a0d){db[_0x28a5('0x6b')][_0x28a5('0x57')]({'where':{'UserId':_0x5c4a0d,'VoicePrefixId':_0x23fcb6[_0x28a5('0x6c')]}});});return Promise[_0x28a5('0x8d')](_0x1c3f07);}});});});}})[_0x28a5('0x2c')](respondWithStatusCode(_0x5984d4,null))['catch'](handleError(_0x5984d4,null));};exports[_0x28a5('0x94')]=function(_0x3eeada,_0x5b4815,_0x5b8bc1){var _0x32f820={};var _0x4c6fb7={};var _0x68c7dd;var _0x1bf7cf;return db[_0x28a5('0x30')]['findOne']({'where':{'id':_0x3eeada[_0x28a5('0x49')]['id']}})[_0x28a5('0x2c')](handleEntityNotFound(_0x5b4815,null))['then'](function(_0x8e4c8e){if(_0x8e4c8e){_0x68c7dd=_0x8e4c8e;_0x4c6fb7['model']=_[_0x28a5('0x37')](db[_0x28a5('0x82')][_0x28a5('0x31')]);_0x4c6fb7['query']=_[_0x28a5('0x37')](_0x3eeada[_0x28a5('0x36')]);_0x4c6fb7[_0x28a5('0x38')]=_[_0x28a5('0x39')](_0x4c6fb7['model'],_0x4c6fb7[_0x28a5('0x36')]);_0x32f820[_0x28a5('0x3b')]=_['intersection'](_0x4c6fb7['model'],qs[_0x28a5('0x3a')](_0x3eeada['query'][_0x28a5('0x3a')]));_0x32f820[_0x28a5('0x3b')]=_0x32f820[_0x28a5('0x3b')]['length']?_0x32f820[_0x28a5('0x3b')]:_0x4c6fb7[_0x28a5('0x33')];_0x32f820[_0x28a5('0x3f')]=qs[_0x28a5('0x40')](_0x3eeada['query']['sort']);_0x32f820[_0x28a5('0x41')]=qs[_0x28a5('0x38')](_[_0x28a5('0x72')](_0x3eeada['query'],_0x4c6fb7[_0x28a5('0x38')]));if(_0x3eeada[_0x28a5('0x36')]['filter']){_0x32f820[_0x28a5('0x41')]=_[_0x28a5('0x43')](_0x32f820[_0x28a5('0x41')],{'$or':_[_0x28a5('0x34')](_0x32f820[_0x28a5('0x3b')],function(_0xe9f498){var _0x2e5249={};_0x2e5249[_0xe9f498]={'$like':'%'+_0x3eeada[_0x28a5('0x36')]['filter']+'%'};return _0x2e5249;})});}_0x32f820=_[_0x28a5('0x43')]({},_0x32f820,_0x3eeada[_0x28a5('0x4c')]);return _0x68c7dd[_0x28a5('0x94')](_0x32f820);}})[_0x28a5('0x2c')](function(_0x1be5e1){if(_0x1be5e1){_0x1bf7cf=_0x1be5e1['length'];if(!_0x3eeada['query'][_0x28a5('0x3d')](_0x28a5('0x3e'))){_0x32f820[_0x28a5('0x27')]=qs[_0x28a5('0x27')](_0x3eeada[_0x28a5('0x36')][_0x28a5('0x27')]);_0x32f820[_0x28a5('0x25')]=qs[_0x28a5('0x25')](_0x3eeada[_0x28a5('0x36')][_0x28a5('0x25')]);}return _0x68c7dd[_0x28a5('0x94')](_0x32f820);}})[_0x28a5('0x2c')](function(_0x543d80){if(_0x543d80){return _0x543d80?{'count':_0x1bf7cf,'rows':_0x543d80}:null;}})[_0x28a5('0x2c')](respondWithResult(_0x5b4815,null))[_0x28a5('0x47')](handleError(_0x5b4815,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index f8bf706..3c23614 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 _0x13ac=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4f1c05,_0x4cdf88){var _0x530236=function(_0x358e60){while(--_0x358e60){_0x4f1c05['push'](_0x4f1c05['shift']());}};_0x530236(++_0x4cdf88);}(_0x13ac,0x1b7));var _0xc13a=function(_0x297bc0,_0x434196){_0x297bc0=_0x297bc0-0x0;var _0x3f8df9=_0x13ac[_0x297bc0];return _0x3f8df9;};'use strict';var EventEmitter=require(_0xc13a('0x0'));var Team=require(_0xc13a('0x1'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents[_0xc13a('0x2')](0x0);var events={'afterCreate':_0xc13a('0x3'),'afterUpdate':_0xc13a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x599735){return function(_0x5b4cf8,_0x4949d9,_0x58a49d){TeamEvents['emit'](_0x599735+':'+_0x5b4cf8['id'],_0x5b4cf8);TeamEvents[_0xc13a('0x5')](_0x599735,_0x5b4cf8);_0x58a49d(null);};}for(var e in events){if(events[_0xc13a('0x6')](e)){var event=events[e];Team[_0xc13a('0x7')](e,emitEvent(event));}}module[_0xc13a('0x8')]=TeamEvents; \ No newline at end of file +var _0x7605=['hasOwnProperty','hook','events','Team','setMaxListeners','remove','emit'];(function(_0xb725be,_0x45bd01){var _0x2f2424=function(_0x2566ca){while(--_0x2566ca){_0xb725be['push'](_0xb725be['shift']());}};_0x2f2424(++_0x45bd01);}(_0x7605,0x1ec));var _0x5760=function(_0x21e0b1,_0x39b9af){_0x21e0b1=_0x21e0b1-0x0;var _0x1e8f5a=_0x7605[_0x21e0b1];return _0x1e8f5a;};'use strict';var EventEmitter=require(_0x5760('0x0'));var Team=require('../../mysqldb')['db'][_0x5760('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0x5760('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5760('0x3')};function emitEvent(_0x4be3f3){return function(_0x118c2c,_0x3f46c8,_0x2bee37){TeamEvents[_0x5760('0x4')](_0x4be3f3+':'+_0x118c2c['id'],_0x118c2c);TeamEvents[_0x5760('0x4')](_0x4be3f3,_0x118c2c);_0x2bee37(null);};}for(var e in events){if(events[_0x5760('0x5')](e)){var event=events[e];Team[_0x5760('0x6')](e,emitEvent(event));}}module['exports']=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 89e1163..061625d 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 _0xc685=['get','Queues','then','map','setDataValue','channel','define','Team','Chat','Mail','Openchannel','Sms','Voice','Whatsapp','all','./team.attributes'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xc685,0x11f));var _0x5c68=function(_0x5261da,_0xb5fe00){_0x5261da=_0x5261da-0x0;var _0x4392fc=_0xc685[_0x5261da];return _0x4392fc;};'use strict';var _=require('lodash');var attributes=require(_0x5c68('0x0'));function getQueuesByChannel(_0x587446,_0x552861){var _0x562701=_0x5c68('0x1')+_0x552861+_0x5c68('0x2');return _0x587446[_0x562701]()[_0x5c68('0x3')](function(_0x478efd){return _[_0x5c68('0x4')](_0x478efd,function(_0x2ee2dd){_0x2ee2dd[_0x5c68('0x5')](_0x5c68('0x6'),_0x552861);return _0x2ee2dd;});})['catch'](function(_0x3371f6){throw _0x3371f6;});}module['exports']=function(_0x2df52f){return _0x2df52f[_0x5c68('0x7')](_0x5c68('0x8'),attributes,{'tableName':'teams','paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x20924a=this;var _0x35bcfe=[_0x5c68('0x9'),'Fax',_0x5c68('0xa'),_0x5c68('0xb'),_0x5c68('0xc'),_0x5c68('0xd'),_0x5c68('0xe')];return Promise['resolve']()[_0x5c68('0x3')](function(){var _0x1607bd=_['map'](_0x35bcfe,function(_0x5a04f8){return getQueuesByChannel(_0x20924a,_0x5a04f8);});return Promise[_0x5c68('0xf')](_0x1607bd);})['catch'](function(_0x4df5b1){throw _0x4df5b1;});}}});}; \ No newline at end of file +var _0x3f55=['Sms','Whatsapp','resolve','all','lodash','Queues','then','map','setDataValue','channel','catch','exports','define','Team','teams','Chat','Fax','Mail','Openchannel'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0x3f55,0xaf));var _0x53f5=function(_0x3d71a3,_0x3a33b7){_0x3d71a3=_0x3d71a3-0x0;var _0x5bb3ab=_0x3f55[_0x3d71a3];return _0x5bb3ab;};'use strict';var _=require(_0x53f5('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x2fb471,_0x1b9ee8){var _0x1affb7='get'+_0x1b9ee8+_0x53f5('0x1');return _0x2fb471[_0x1affb7]()[_0x53f5('0x2')](function(_0x31082a){return _[_0x53f5('0x3')](_0x31082a,function(_0x103cf6){_0x103cf6[_0x53f5('0x4')](_0x53f5('0x5'),_0x1b9ee8);return _0x103cf6;});})[_0x53f5('0x6')](function(_0x573a17){throw _0x573a17;});}module[_0x53f5('0x7')]=function(_0x5a90d9){return _0x5a90d9[_0x53f5('0x8')](_0x53f5('0x9'),attributes,{'tableName':_0x53f5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x3a94e6=this;var _0x3eba96=[_0x53f5('0xb'),_0x53f5('0xc'),_0x53f5('0xd'),_0x53f5('0xe'),_0x53f5('0xf'),'Voice',_0x53f5('0x10')];return Promise[_0x53f5('0x11')]()[_0x53f5('0x2')](function(){var _0x238bff=_['map'](_0x3eba96,function(_0x5163b6){return getQueuesByChannel(_0x3a94e6,_0x5163b6);});return Promise[_0x53f5('0x12')](_0x238bff);})[_0x53f5('0x6')](function(_0x3119b4){throw _0x3119b4;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 728ee70..b37ffd3 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 _0x99f8=['../../config/environment','jayson/promise','client','http','redis','defaults','./team.socket','register','then','info','Team,\x20%s,\x20%s','request\x20sent','Team,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x5e12e7,_0x58bf03){var _0x27c046=function(_0x579501){while(--_0x579501){_0x5e12e7['push'](_0x5e12e7['shift']());}};_0x27c046(++_0x58bf03);}(_0x99f8,0x146));var _0x899f=function(_0x5a57bf,_0x39f906){_0x5a57bf=_0x5a57bf-0x0;var _0x6a6949=_0x99f8[_0x5a57bf];return _0x6a6949;};'use strict';var _=require(_0x899f('0x0'));var util=require(_0x899f('0x1'));var moment=require(_0x899f('0x2'));var BPromise=require(_0x899f('0x3'));var rs=require(_0x899f('0x4'));var fs=require('fs');var Redis=require(_0x899f('0x5'));var db=require(_0x899f('0x6'))['db'];var utils=require(_0x899f('0x7'));var logger=require(_0x899f('0x8'))(_0x899f('0x9'));var config=require(_0x899f('0xa'));var jayson=require(_0x899f('0xb'));var client=jayson[_0x899f('0xc')][_0x899f('0xd')]({'port':0x232a});config[_0x899f('0xe')]=_[_0x899f('0xf')](config[_0x899f('0xe')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x899f('0xe')]));require(_0x899f('0x10'))[_0x899f('0x11')](socket);function respondWithRpcPromise(_0x56f5ca,_0x46eb75,_0x1474de){return new BPromise(function(_0x253870,_0x589746){return client['request'](_0x56f5ca,_0x1474de)[_0x899f('0x12')](function(_0x5259d6){logger[_0x899f('0x13')](_0x899f('0x14'),_0x46eb75,_0x899f('0x15'));logger['debug'](_0x899f('0x16'),_0x46eb75,_0x899f('0x15'),JSON['stringify'](_0x5259d6));if(_0x5259d6[_0x899f('0x17')]){if(_0x5259d6['error'][_0x899f('0x18')]===0x1f4){logger[_0x899f('0x17')](_0x899f('0x14'),_0x46eb75,_0x5259d6[_0x899f('0x17')]['message']);return _0x589746(_0x5259d6['error']['message']);}logger['error'](_0x899f('0x14'),_0x46eb75,_0x5259d6[_0x899f('0x17')][_0x899f('0x19')]);return _0x253870(_0x5259d6[_0x899f('0x17')][_0x899f('0x19')]);}else{logger['info']('Team,\x20%s,\x20%s',_0x46eb75,'request\x20sent');_0x253870(_0x5259d6[_0x899f('0x1a')][_0x899f('0x19')]);}})[_0x899f('0x1b')](function(_0x51936c){logger['error'](_0x899f('0x14'),_0x46eb75,_0x51936c);_0x589746(_0x51936c);});});} \ No newline at end of file +var _0xacd3=['request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','Team,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','./team.socket','register','then','info'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xacd3,0x70));var _0x3acd=function(_0x3203f7,_0x16e652){_0x3203f7=_0x3203f7-0x0;var _0x58dd36=_0xacd3[_0x3203f7];return _0x58dd36;};'use strict';var _=require(_0x3acd('0x0'));var util=require(_0x3acd('0x1'));var moment=require(_0x3acd('0x2'));var BPromise=require(_0x3acd('0x3'));var rs=require(_0x3acd('0x4'));var fs=require('fs');var Redis=require(_0x3acd('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x3acd('0x6'));var logger=require(_0x3acd('0x7'))('rpc');var config=require(_0x3acd('0x8'));var jayson=require(_0x3acd('0x9'));var client=jayson[_0x3acd('0xa')][_0x3acd('0xb')]({'port':0x232a});config['redis']=_[_0x3acd('0xc')](config[_0x3acd('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3acd('0xd')]));require(_0x3acd('0xe'))[_0x3acd('0xf')](socket);function respondWithRpcPromise(_0xa835e8,_0x3971a4,_0xea2f0b){return new BPromise(function(_0x5c2f64,_0xc1c595){return client['request'](_0xa835e8,_0xea2f0b)[_0x3acd('0x10')](function(_0xd723f9){logger[_0x3acd('0x11')]('Team,\x20%s,\x20%s',_0x3971a4,_0x3acd('0x12'));logger[_0x3acd('0x13')](_0x3acd('0x14'),_0x3971a4,_0x3acd('0x12'),JSON[_0x3acd('0x15')](_0xd723f9));if(_0xd723f9['error']){if(_0xd723f9['error']['code']===0x1f4){logger[_0x3acd('0x16')](_0x3acd('0x17'),_0x3971a4,_0xd723f9['error'][_0x3acd('0x18')]);return _0xc1c595(_0xd723f9[_0x3acd('0x16')][_0x3acd('0x18')]);}logger[_0x3acd('0x16')](_0x3acd('0x17'),_0x3971a4,_0xd723f9[_0x3acd('0x16')][_0x3acd('0x18')]);return _0x5c2f64(_0xd723f9[_0x3acd('0x16')][_0x3acd('0x18')]);}else{logger[_0x3acd('0x11')](_0x3acd('0x17'),_0x3971a4,'request\x20sent');_0x5c2f64(_0xd723f9[_0x3acd('0x19')]['message']);}})['catch'](function(_0x4f5dee){logger[_0x3acd('0x16')](_0x3acd('0x17'),_0x3971a4,_0x4f5dee);_0xc1c595(_0x4f5dee);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 92aa4b8..2962dae 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 _0x205d=['remove','emit','removeListener','register','length','team:','./team.events','save'];(function(_0x6da4ee,_0x5c7e81){var _0x1974ad=function(_0xc37e66){while(--_0xc37e66){_0x6da4ee['push'](_0x6da4ee['shift']());}};_0x1974ad(++_0x5c7e81);}(_0x205d,0xf6));var _0xd205=function(_0x5e7e1a,_0x38a7c6){_0x5e7e1a=_0x5e7e1a-0x0;var _0x46b94f=_0x205d[_0x5e7e1a];return _0x46b94f;};'use strict';var TeamEvents=require(_0xd205('0x0'));var events=[_0xd205('0x1'),_0xd205('0x2'),'update'];function createListener(_0x4a640b,_0x1eaf09){return function(_0xbd11c7){_0x1eaf09[_0xd205('0x3')](_0x4a640b,_0xbd11c7);};}function removeListener(_0x4bc52b,_0xd8bd69){return function(){TeamEvents[_0xd205('0x4')](_0x4bc52b,_0xd8bd69);};}exports[_0xd205('0x5')]=function(_0x45a533){for(var _0x4c078b=0x0,_0x2614e7=events[_0xd205('0x6')];_0x4c078b<_0x2614e7;_0x4c078b++){var _0xdb99a8=events[_0x4c078b];var _0x372211=createListener(_0xd205('0x7')+_0xdb99a8,_0x45a533);TeamEvents['on'](_0xdb99a8,_0x372211);}}; \ No newline at end of file +var _0x19c7=['emit','removeListener','register','length','team:','save','remove','update'];(function(_0x16b992,_0x43d74c){var _0x385c78=function(_0x5c904){while(--_0x5c904){_0x16b992['push'](_0x16b992['shift']());}};_0x385c78(++_0x43d74c);}(_0x19c7,0x16d));var _0x719c=function(_0x5d5ce9,_0x202d6a){_0x5d5ce9=_0x5d5ce9-0x0;var _0x538547=_0x19c7[_0x5d5ce9];return _0x538547;};'use strict';var TeamEvents=require('./team.events');var events=[_0x719c('0x0'),_0x719c('0x1'),_0x719c('0x2')];function createListener(_0x6df9ba,_0x28ff12){return function(_0x761800){_0x28ff12[_0x719c('0x3')](_0x6df9ba,_0x761800);};}function removeListener(_0x144405,_0x3ad380){return function(){TeamEvents[_0x719c('0x4')](_0x144405,_0x3ad380);};}exports[_0x719c('0x5')]=function(_0x21db87){for(var _0x521b57=0x0,_0x2e7d0e=events[_0x719c('0x6')];_0x521b57<_0x2e7d0e;_0x521b57++){var _0x30af86=events[_0x521b57];var _0x178991=createListener(_0x719c('0x7')+_0x30af86,_0x21db87);TeamEvents['on'](_0x30af86,_0x178991);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 65c9d7b..b94feeb 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 _0x3e0f=['sequelize','exports','INTEGER'];(function(_0x448f8,_0x2aa1d7){var _0xa73126=function(_0x1fcafa){while(--_0x1fcafa){_0x448f8['push'](_0x448f8['shift']());}};_0xa73126(++_0x2aa1d7);}(_0x3e0f,0xfc));var _0xf3e0=function(_0x3718b7,_0x2da677){_0x3718b7=_0x3718b7-0x0;var _0xf8c91e=_0x3e0f[_0x3718b7];return _0xf8c91e;};'use strict';var Sequelize=require(_0xf3e0('0x0'));module[_0xf3e0('0x1')]={'TeamId':{'type':Sequelize[_0xf3e0('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xf3e0('0x2')]}}; \ No newline at end of file +var _0x5e14=['exports','INTEGER','sequelize'];(function(_0x551906,_0x569941){var _0x58bfb6=function(_0x1eb6de){while(--_0x1eb6de){_0x551906['push'](_0x551906['shift']());}};_0x58bfb6(++_0x569941);}(_0x5e14,0x164));var _0x45e1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5e14[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x45e1('0x0'));module[_0x45e1('0x1')]={'TeamId':{'type':Sequelize[_0x45e1('0x2')]},'VoicePrefixId':{'type':Sequelize[_0x45e1('0x2')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 2da1681..84258d3 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 _0xd8b0=['define','team_has_voice_prefixes','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x338bd0,_0x434a83){var _0x1d1bed=function(_0x549732){while(--_0x549732){_0x338bd0['push'](_0x338bd0['shift']());}};_0x1d1bed(++_0x434a83);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'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('./teamVoicePrefix.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('TeamVoicePrefix',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc698=['team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','path','../../config/environment','exports','define','TeamVoicePrefix'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc698,0x85));var _0x8c69=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xc698[_0x3c2a69];return _0x596bc8;};'use strict';var _=require(_0x8c69('0x0'));var util=require(_0x8c69('0x1'));var logger=require(_0x8c69('0x2'))(_0x8c69('0x3'));var moment=require(_0x8c69('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8c69('0x5'));var rimraf=require('rimraf');var config=require(_0x8c69('0x6'));var attributes=require('./teamVoicePrefix.attributes');module[_0x8c69('0x7')]=function(_0x5e8069,_0x5c0109){return _0x5e8069[_0x8c69('0x8')](_0x8c69('0x9'),attributes,{'tableName':_0x8c69('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index efcf761..d7e8c66 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4afc2c,_0x336a88){var _0x164084=function(_0x14b783){while(--_0x14b783){_0x4afc2c['push'](_0x4afc2c['shift']());}};_0x164084(++_0x336a88);}(_0x9c44,0x178));var _0x49c4=function(_0x2dea24,_0x2fc021){_0x2dea24=_0x2dea24-0x0;var _0x309d58=_0x9c44[_0x2dea24];return _0x309d58;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1bbb5a,_0x186179){var _0x4e27af=function(_0x3aa53d){while(--_0x3aa53d){_0x1bbb5a['push'](_0x1bbb5a['shift']());}};_0x4e27af(++_0x186179);}(_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/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 3790697..197adf4 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 _0xa027=['INTEGER','sequelize'];(function(_0x61d9b7,_0x5a56ac){var _0x291d82=function(_0x51305b){while(--_0x51305b){_0x61d9b7['push'](_0x61d9b7['shift']());}};_0x291d82(++_0x5a56ac);}(_0xa027,0x1dd));var _0x7a02=function(_0x695ef3,_0x1f2e21){_0x695ef3=_0x695ef3-0x0;var _0x1ee15f=_0xa027[_0x695ef3];return _0x1ee15f;};'use strict';var Sequelize=require(_0x7a02('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x7a02('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x740a=['INTEGER','sequelize','exports'];(function(_0x380df2,_0x281a15){var _0x47f4df=function(_0x132241){while(--_0x132241){_0x380df2['push'](_0x380df2['shift']());}};_0x47f4df(++_0x281a15);}(_0x740a,0x175));var _0xa740=function(_0xfe5566,_0x5e541f){_0xfe5566=_0xfe5566-0x0;var _0x4ec1bd=_0x740a[_0xfe5566];return _0x4ec1bd;};'use strict';var Sequelize=require(_0xa740('0x0'));module[_0xa740('0x1')]={'penalty':{'type':Sequelize[_0xa740('0x2')],'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 6619bc0..639400a 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 _0xf452=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x46559b,_0x26b3d1){var _0x4974c0=function(_0x908696){while(--_0x908696){_0x46559b['push'](_0x46559b['shift']());}};_0x4974c0(++_0x26b3d1);}(_0xf452,0x13b));var _0x2f45=function(_0x48cdba,_0x12d3a3){_0x48cdba=_0x48cdba-0x0;var _0x4ec5d6=_0xf452[_0x48cdba];return _0x4ec5d6;};'use strict';var _=require(_0x2f45('0x0'));var util=require(_0x2f45('0x1'));var logger=require('../../config/logger')(_0x2f45('0x2'));var moment=require(_0x2f45('0x3'));var BPromise=require(_0x2f45('0x4'));var rp=require(_0x2f45('0x5'));var fs=require('fs');var path=require(_0x2f45('0x6'));var rimraf=require(_0x2f45('0x7'));var config=require(_0x2f45('0x8'));var attributes=require(_0x2f45('0x9'));module[_0x2f45('0xa')]=function(_0x416e83,_0x1a53cf){return _0x416e83[_0x2f45('0xb')](_0x2f45('0xc'),attributes,{'tableName':_0x2f45('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5a8c=['rimraf','../../config/environment','exports','define','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x5b2809,_0x48b226){var _0x572dee=function(_0x4b3e82){while(--_0x4b3e82){_0x5b2809['push'](_0x5b2809['shift']());}};_0x572dee(++_0x48b226);}(_0x5a8c,0x1da));var _0xc5a8=function(_0x2d554f,_0x284acd){_0x2d554f=_0x2d554f-0x0;var _0x579473=_0x5a8c[_0x2d554f];return _0x579473;};'use strict';var _=require(_0xc5a8('0x0'));var util=require(_0xc5a8('0x1'));var logger=require('../../config/logger')(_0xc5a8('0x2'));var moment=require(_0xc5a8('0x3'));var BPromise=require(_0xc5a8('0x4'));var rp=require(_0xc5a8('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc5a8('0x6'));var config=require(_0xc5a8('0x7'));var attributes=require('./teamVoiceQueue.attributes');module[_0xc5a8('0x8')]=function(_0x3c8f1e,_0x373d40){return _0x3c8f1e[_0xc5a8('0x9')](_0xc5a8('0xa'),attributes,{'tableName':_0xc5a8('0xb'),'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 06e033b..3bd173e 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 _0xa8ca=['stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s'];(function(_0xf8628a,_0x5afb04){var _0x48b217=function(_0xe23b66){while(--_0xe23b66){_0xf8628a['push'](_0xf8628a['shift']());}};_0x48b217(++_0x5afb04);}(_0xa8ca,0x12b));var _0xaa8c=function(_0x2f7cd8,_0x4ea902){_0x2f7cd8=_0x2f7cd8-0x0;var _0x13d0c2=_0xa8ca[_0x2f7cd8];return _0x13d0c2;};'use strict';var _=require(_0xaa8c('0x0'));var util=require('util');var moment=require(_0xaa8c('0x1'));var BPromise=require('bluebird');var rs=require(_0xaa8c('0x2'));var fs=require('fs');var Redis=require(_0xaa8c('0x3'));var db=require(_0xaa8c('0x4'))['db'];var utils=require(_0xaa8c('0x5'));var logger=require(_0xaa8c('0x6'))(_0xaa8c('0x7'));var config=require('../../config/environment');var jayson=require(_0xaa8c('0x8'));var client=jayson[_0xaa8c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47a6e4,_0x620f3a,_0x736ba3){return new BPromise(function(_0x5e8f2d,_0x4ae00d){return client['request'](_0x47a6e4,_0x736ba3)[_0xaa8c('0xa')](function(_0x2321b1){logger[_0xaa8c('0xb')](_0xaa8c('0xc'),_0x620f3a,_0xaa8c('0xd'));logger[_0xaa8c('0xe')](_0xaa8c('0xf'),_0x620f3a,_0xaa8c('0xd'),JSON[_0xaa8c('0x10')](_0x2321b1));if(_0x2321b1[_0xaa8c('0x11')]){if(_0x2321b1[_0xaa8c('0x11')][_0xaa8c('0x12')]===0x1f4){logger[_0xaa8c('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x620f3a,_0x2321b1[_0xaa8c('0x11')]['message']);return _0x4ae00d(_0x2321b1[_0xaa8c('0x11')][_0xaa8c('0x13')]);}logger[_0xaa8c('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x620f3a,_0x2321b1[_0xaa8c('0x11')][_0xaa8c('0x13')]);return _0x5e8f2d(_0x2321b1['error']['message']);}else{logger[_0xaa8c('0xb')](_0xaa8c('0xc'),_0x620f3a,_0xaa8c('0xd'));_0x5e8f2d(_0x2321b1[_0xaa8c('0x14')][_0xaa8c('0x13')]);}})['catch'](function(_0x3ba363){logger[_0xaa8c('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0x620f3a,_0x3ba363);_0x4ae00d(_0x3ba363);});});} \ No newline at end of file +var _0xbefb=['request','then','TeamVoiceQueue,\x20%s,\x20%s','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','client'];(function(_0x3c25d7,_0x50ebd0){var _0xd8d3a6=function(_0xfa4124){while(--_0xfa4124){_0x3c25d7['push'](_0x3c25d7['shift']());}};_0xd8d3a6(++_0x50ebd0);}(_0xbefb,0x13c));var _0xbbef=function(_0x4d1d85,_0x24b672){_0x4d1d85=_0x4d1d85-0x0;var _0x5dedab=_0xbefb[_0x4d1d85];return _0x5dedab;};'use strict';var _=require(_0xbbef('0x0'));var util=require(_0xbbef('0x1'));var moment=require('moment');var BPromise=require(_0xbbef('0x2'));var rs=require(_0xbbef('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbef('0x4'))['db'];var utils=require(_0xbbef('0x5'));var logger=require(_0xbbef('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbbef('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3bbb5f,_0x1faba8,_0x14254c){return new BPromise(function(_0x4b86ca,_0x471cc1){return client[_0xbbef('0x8')](_0x3bbb5f,_0x14254c)[_0xbbef('0x9')](function(_0x345e5b){logger['info'](_0xbbef('0xa'),_0x1faba8,'request\x20sent');logger[_0xbbef('0xb')](_0xbbef('0xc'),_0x1faba8,_0xbbef('0xd'),JSON['stringify'](_0x345e5b));if(_0x345e5b['error']){if(_0x345e5b[_0xbbef('0xe')][_0xbbef('0xf')]===0x1f4){logger[_0xbbef('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x1faba8,_0x345e5b['error'][_0xbbef('0x10')]);return _0x471cc1(_0x345e5b[_0xbbef('0xe')]['message']);}logger[_0xbbef('0xe')](_0xbbef('0xa'),_0x1faba8,_0x345e5b['error'][_0xbbef('0x10')]);return _0x4b86ca(_0x345e5b[_0xbbef('0xe')][_0xbbef('0x10')]);}else{logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x1faba8,_0xbbef('0xd'));_0x4b86ca(_0x345e5b['result'][_0xbbef('0x10')]);}})[_0xbbef('0x11')](function(_0x104137){logger[_0xbbef('0xe')](_0xbbef('0xa'),_0x1faba8,_0x104137);_0x471cc1(_0x104137);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index de1b1a9..cf6b53e 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 _0x2cc4=['isAuthenticated','index','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','./template.controller','get'];(function(_0x427147,_0x3ff69e){var _0xf4aadb=function(_0x7e1ef3){while(--_0x7e1ef3){_0x427147['push'](_0x427147['shift']());}};_0xf4aadb(++_0x3ff69e);}(_0x2cc4,0x1f0));var _0x42cc=function(_0x585ee5,_0x1c9dba){_0x585ee5=_0x585ee5-0x0;var _0x470808=_0x2cc4[_0x585ee5];return _0x470808;};'use strict';var multer=require(_0x42cc('0x0'));var util=require(_0x42cc('0x1'));var path=require(_0x42cc('0x2'));var timeout=require(_0x42cc('0x3'));var express=require('express');var router=express[_0x42cc('0x4')]();var fs_extra=require(_0x42cc('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x42cc('0x6'));router[_0x42cc('0x7')]('/',auth[_0x42cc('0x8')](),controller[_0x42cc('0x9')]);router[_0x42cc('0x7')]('/:id',auth[_0x42cc('0x8')](),controller[_0x42cc('0xa')]);router[_0x42cc('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x42cc('0xc')](_0x42cc('0xd'),auth[_0x42cc('0x8')](),controller[_0x42cc('0xe')]);router[_0x42cc('0xf')](_0x42cc('0xd'),auth[_0x42cc('0x8')](),controller[_0x42cc('0x10')]);module[_0x42cc('0x11')]=router; \ No newline at end of file +var _0x6fad=['multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./template.controller','isAuthenticated','index','get','/:id','show','post','create','update','delete','exports'];(function(_0x420735,_0x3eda47){var _0x59d1d3=function(_0x540445){while(--_0x540445){_0x420735['push'](_0x420735['shift']());}};_0x59d1d3(++_0x3eda47);}(_0x6fad,0x17a));var _0xd6fa=function(_0x42db23,_0x112b01){_0x42db23=_0x42db23-0x0;var _0x2d1e4e=_0x6fad[_0x42db23];return _0x2d1e4e;};'use strict';var multer=require(_0xd6fa('0x0'));var util=require(_0xd6fa('0x1'));var path=require(_0xd6fa('0x2'));var timeout=require(_0xd6fa('0x3'));var express=require(_0xd6fa('0x4'));var router=express['Router']();var fs_extra=require(_0xd6fa('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xd6fa('0x6'));var config=require('../../config/environment');var controller=require(_0xd6fa('0x7'));router['get']('/',auth[_0xd6fa('0x8')](),controller[_0xd6fa('0x9')]);router[_0xd6fa('0xa')](_0xd6fa('0xb'),auth[_0xd6fa('0x8')](),controller[_0xd6fa('0xc')]);router[_0xd6fa('0xd')]('/',auth['isAuthenticated'](),controller[_0xd6fa('0xe')]);router['put'](_0xd6fa('0xb'),auth[_0xd6fa('0x8')](),controller[_0xd6fa('0xf')]);router[_0xd6fa('0x10')](_0xd6fa('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xd6fa('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 716fb74..76c7dd8 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 _0xc41e=['TEXT','exports','STRING'];(function(_0xa4cf04,_0x409cd6){var _0x546ae0=function(_0x496665){while(--_0x496665){_0xa4cf04['push'](_0xa4cf04['shift']());}};_0x546ae0(++_0x409cd6);}(_0xc41e,0x172));var _0xec41=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc41e[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require('sequelize');module[_0xec41('0x0')]={'name':{'type':Sequelize[_0xec41('0x1')]},'description':{'type':Sequelize[_0xec41('0x1')]},'html':{'type':Sequelize[_0xec41('0x2')]}}; \ No newline at end of file +var _0x9e16=['sequelize','exports','STRING','TEXT'];(function(_0x161a18,_0x16f64b){var _0x5da98f=function(_0x170d62){while(--_0x170d62){_0x161a18['push'](_0x161a18['shift']());}};_0x5da98f(++_0x16f64b);}(_0x9e16,0x1b0));var _0x69e1=function(_0x3252d6,_0x3a3d28){_0x3252d6=_0x3252d6-0x0;var _0x7744d0=_0x9e16[_0x3252d6];return _0x7744d0;};'use strict';var Sequelize=require(_0x69e1('0x0'));module[_0x69e1('0x1')]={'name':{'type':Sequelize[_0x69e1('0x2')]},'description':{'type':Sequelize[_0x69e1('0x2')]},'html':{'type':Sequelize[_0x69e1('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 0b1baa8..e87699f 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 _0x66e6=['papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','reject','then','destroy','error','name','send','index','Template','fieldName','type','key','map','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','order','sort','pick','filters','filter','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','Templates','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring'];(function(_0xdf284e,_0x29c97b){var _0x8f1315=function(_0x3a0fbb){while(--_0x3a0fbb){_0xdf284e['push'](_0xdf284e['shift']());}};_0x8f1315(++_0x29c97b);}(_0x66e6,0x189));var _0x666e=function(_0x146a0c,_0x101149){_0x146a0c=_0x146a0c-0x0;var _0x2a0bd5=_0x66e6[_0x146a0c];return _0x2a0bd5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x666e('0x0'));var zipdir=require(_0x666e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x666e('0x2'));var moment=require(_0x666e('0x3'));var BPromise=require(_0x666e('0x4'));var Mustache=require(_0x666e('0x5'));var util=require(_0x666e('0x6'));var path=require(_0x666e('0x7'));var sox=require(_0x666e('0x8'));var csv=require(_0x666e('0x9'));var ejs=require(_0x666e('0xa'));var fs=require('fs');var fs_extra=require(_0x666e('0xb'));var _=require(_0x666e('0xc'));var squel=require(_0x666e('0xd'));var crypto=require('crypto');var jsforce=require(_0x666e('0xe'));var deskjs=require(_0x666e('0xf'));var toCsv=require(_0x666e('0x9'));var querystring=require(_0x666e('0x10'));var Papa=require(_0x666e('0x11'));var Redis=require('ioredis');var authService=require(_0x666e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x666e('0x13'));var hardwareService=require(_0x666e('0x14'));var logger=require(_0x666e('0x15'))(_0x666e('0x16'));var utils=require(_0x666e('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x666e('0x18'));var db=require(_0x666e('0x19'))['db'];function respondWithStatusCode(_0x18db7b,_0x512fe5){_0x512fe5=_0x512fe5||0xcc;return function(_0x5a1171){if(_0x5a1171){return _0x18db7b[_0x666e('0x1a')](_0x512fe5);}return _0x18db7b['status'](_0x512fe5)[_0x666e('0x1b')]();};}function respondWithResult(_0x5b46f0,_0x1bb619){_0x1bb619=_0x1bb619||0xc8;return function(_0xc8d3ff){if(_0xc8d3ff){return _0x5b46f0['status'](_0x1bb619)[_0x666e('0x1c')](_0xc8d3ff);}};}function respondWithFilteredResult(_0x24987e,_0x47b5d9){return function(_0x223831){if(_0x223831){var _0x2dec65=typeof _0x47b5d9['offset']===_0x666e('0x1d')&&typeof _0x47b5d9[_0x666e('0x1e')]==='undefined';var _0x376b11=_0x223831[_0x666e('0x1f')];var _0x686042=_0x2dec65?0x0:_0x47b5d9[_0x666e('0x20')];var _0x5ce33f=_0x2dec65?_0x223831[_0x666e('0x1f')]:_0x47b5d9[_0x666e('0x20')]+_0x47b5d9['limit'];var _0x157c8f;if(_0x5ce33f>=_0x376b11){_0x5ce33f=_0x376b11;_0x157c8f=0xc8;}else{_0x157c8f=0xce;}_0x24987e[_0x666e('0x21')](_0x157c8f);return _0x24987e['set'](_0x666e('0x22'),_0x686042+'-'+_0x5ce33f+'/'+_0x376b11)[_0x666e('0x1c')](_0x223831);}return null;};}function patchUpdates(_0x1db864){return function(_0x3488cb){try{jsonpatch['apply'](_0x3488cb,_0x1db864,!![]);}catch(_0x12ab23){return BPromise[_0x666e('0x23')](_0x12ab23);}return _0x3488cb['save']();};}function saveUpdates(_0x26bfa2,_0x464182){return function(_0x3f641c){if(_0x3f641c){return _0x3f641c['update'](_0x26bfa2)['then'](function(_0x2a950e){return _0x2a950e;});}return null;};}function removeEntity(_0x5c572c,_0x59c873){return function(_0x56b1f8){if(_0x56b1f8){return _0x56b1f8['destroy']()[_0x666e('0x24')](function(){var _0x22c59a=_0x56b1f8['get']({'plain':!![]});var _0x514112='Templates';return db['UserProfileResource'][_0x666e('0x25')]({'where':{'type':_0x514112,'resourceId':_0x22c59a['id']}})[_0x666e('0x24')](function(){return _0x56b1f8;});})[_0x666e('0x24')](function(){_0x5c572c['status'](0xcc)[_0x666e('0x1b')]();});}};}function handleEntityNotFound(_0x55a58a,_0x3c1550){return function(_0x39dba0){if(!_0x39dba0){_0x55a58a[_0x666e('0x1a')](0x194);}return _0x39dba0;};}function handleError(_0x1c915c,_0x589057){_0x589057=_0x589057||0x1f4;return function(_0x101c6b){logger[_0x666e('0x26')](_0x101c6b['stack']);if(_0x101c6b[_0x666e('0x27')]){delete _0x101c6b[_0x666e('0x27')];}_0x1c915c[_0x666e('0x21')](_0x589057)[_0x666e('0x28')](_0x101c6b);};}exports[_0x666e('0x29')]=function(_0x5ce948,_0xa1f4df){var _0x4237ea={},_0x2c8532={},_0x307138={'count':0x0,'rows':[]};var _0x2c980d=_['map'](db[_0x666e('0x2a')]['rawAttributes'],function(_0x49197e){return{'name':_0x49197e[_0x666e('0x2b')],'type':_0x49197e[_0x666e('0x2c')][_0x666e('0x2d')]};});_0x2c8532['model']=_[_0x666e('0x2e')](_0x2c980d,_0x666e('0x27'));_0x2c8532[_0x666e('0x2f')]=_[_0x666e('0x30')](_0x5ce948[_0x666e('0x2f')]);_0x2c8532['filters']=_['intersection'](_0x2c8532['model'],_0x2c8532[_0x666e('0x2f')]);_0x4237ea[_0x666e('0x31')]=_[_0x666e('0x32')](_0x2c8532[_0x666e('0x33')],qs[_0x666e('0x34')](_0x5ce948[_0x666e('0x2f')][_0x666e('0x34')]));_0x4237ea[_0x666e('0x31')]=_0x4237ea[_0x666e('0x31')][_0x666e('0x35')]?_0x4237ea[_0x666e('0x31')]:_0x2c8532[_0x666e('0x33')];if(!_0x5ce948[_0x666e('0x2f')][_0x666e('0x36')]('nolimit')){_0x4237ea['limit']=qs[_0x666e('0x1e')](_0x5ce948[_0x666e('0x2f')]['limit']);_0x4237ea['offset']=qs[_0x666e('0x20')](_0x5ce948[_0x666e('0x2f')][_0x666e('0x20')]);}_0x4237ea[_0x666e('0x37')]=qs[_0x666e('0x38')](_0x5ce948[_0x666e('0x2f')][_0x666e('0x38')]);_0x4237ea['where']=qs['filters'](_[_0x666e('0x39')](_0x5ce948['query'],_0x2c8532[_0x666e('0x3a')]),_0x2c980d);if(_0x5ce948['query'][_0x666e('0x3b')]){_0x4237ea[_0x666e('0x3c')]=_[_0x666e('0x3d')](_0x4237ea[_0x666e('0x3c')],{'$or':_['map'](_0x2c980d,function(_0x21d272){if(_0x21d272[_0x666e('0x2c')]!==_0x666e('0x3e')){var _0xff246f={};_0xff246f[_0x21d272[_0x666e('0x27')]]={'$like':'%'+_0x5ce948[_0x666e('0x2f')][_0x666e('0x3b')]+'%'};return _0xff246f;}})});}_0x4237ea=_[_0x666e('0x3d')]({},_0x4237ea,_0x5ce948[_0x666e('0x3f')]);var _0x183d1a={'where':_0x4237ea[_0x666e('0x3c')]};return db[_0x666e('0x2a')][_0x666e('0x1f')](_0x183d1a)['then'](function(_0x1ea741){_0x307138['count']=_0x1ea741;if(_0x5ce948[_0x666e('0x2f')][_0x666e('0x40')]){_0x4237ea[_0x666e('0x41')]=[{'all':!![]}];}return db[_0x666e('0x2a')]['findAll'](_0x4237ea);})[_0x666e('0x24')](function(_0x60e838){_0x307138['rows']=_0x60e838;return _0x307138;})['then'](respondWithFilteredResult(_0xa1f4df,_0x4237ea))[_0x666e('0x42')](handleError(_0xa1f4df,null));};exports[_0x666e('0x43')]=function(_0x21b063,_0xa9e68){var _0x4d00c9={'raw':!![],'where':{'id':_0x21b063[_0x666e('0x44')]['id']}},_0x3df3b2={};_0x3df3b2[_0x666e('0x33')]=_[_0x666e('0x30')](db[_0x666e('0x2a')]['rawAttributes']);_0x3df3b2['query']=_[_0x666e('0x30')](_0x21b063['query']);_0x3df3b2[_0x666e('0x3a')]=_[_0x666e('0x32')](_0x3df3b2[_0x666e('0x33')],_0x3df3b2[_0x666e('0x2f')]);_0x4d00c9[_0x666e('0x31')]=_[_0x666e('0x32')](_0x3df3b2['model'],qs[_0x666e('0x34')](_0x21b063[_0x666e('0x2f')][_0x666e('0x34')]));_0x4d00c9[_0x666e('0x31')]=_0x4d00c9[_0x666e('0x31')]['length']?_0x4d00c9[_0x666e('0x31')]:_0x3df3b2['model'];if(_0x21b063['query'][_0x666e('0x40')]){_0x4d00c9['include']=[{'all':!![]}];}_0x4d00c9=_[_0x666e('0x3d')]({},_0x4d00c9,_0x21b063[_0x666e('0x3f')]);return db[_0x666e('0x2a')][_0x666e('0x45')](_0x4d00c9)['then'](handleEntityNotFound(_0xa9e68,null))[_0x666e('0x24')](respondWithResult(_0xa9e68,null))[_0x666e('0x42')](handleError(_0xa9e68,null));};exports[_0x666e('0x46')]=function(_0xb90054,_0xed2ed1){return db[_0x666e('0x2a')][_0x666e('0x46')](_0xb90054[_0x666e('0x47')],{})[_0x666e('0x24')](function(_0x199370){var _0x5a4c6a=_0xb90054[_0x666e('0x48')][_0x666e('0x49')]({'plain':!![]});if(!_0x5a4c6a)throw new Error(_0x666e('0x4a'));if(_0x5a4c6a['role']===_0x666e('0x48')){var _0x1817f9=_0x199370['get']({'plain':!![]});var _0x7eac60=_0x666e('0x4b');return db[_0x666e('0x4c')][_0x666e('0x45')]({'where':{'name':_0x7eac60,'userProfileId':_0x5a4c6a[_0x666e('0x4d')]},'raw':!![]})['then'](function(_0x19aeef){if(_0x19aeef&&_0x19aeef[_0x666e('0x4e')]===0x0){return db[_0x666e('0x4f')][_0x666e('0x46')]({'name':_0x1817f9['name'],'resourceId':_0x1817f9['id'],'type':_0x19aeef[_0x666e('0x27')],'sectionId':_0x19aeef['id']},{})[_0x666e('0x24')](function(){return _0x199370;});}else{return _0x199370;}})['catch'](function(_0x364383){logger[_0x666e('0x26')](_0x666e('0x50'),_0x364383);throw _0x364383;});}return _0x199370;})[_0x666e('0x24')](respondWithResult(_0xed2ed1,0xc9))[_0x666e('0x42')](handleError(_0xed2ed1,null));};exports[_0x666e('0x51')]=function(_0x5281d7,_0x2185b0){if(_0x5281d7['body']['id']){delete _0x5281d7[_0x666e('0x47')]['id'];}return db['Template'][_0x666e('0x45')]({'where':{'id':_0x5281d7[_0x666e('0x44')]['id']}})['then'](handleEntityNotFound(_0x2185b0,null))[_0x666e('0x24')](saveUpdates(_0x5281d7[_0x666e('0x47')],null))[_0x666e('0x24')](respondWithResult(_0x2185b0,null))[_0x666e('0x42')](handleError(_0x2185b0,null));};exports[_0x666e('0x25')]=function(_0x3a18ef,_0x51bf4c){return db['Template'][_0x666e('0x45')]({'where':{'id':_0x3a18ef['params']['id']}})[_0x666e('0x24')](handleEntityNotFound(_0x51bf4c,null))[_0x666e('0x24')](removeEntity(_0x51bf4c,null))[_0x666e('0x42')](handleError(_0x51bf4c,null));}; \ No newline at end of file +var _0xee56=['query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','Template','findAll','rows','catch','show','params','keys','intersection','include','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','json','apply','reject','save','update','then','get','Templates','UserProfileResource','destroy','end','sendStatus','error','stack','name','send','map','rawAttributes','fieldName','model'];(function(_0x497858,_0x321746){var _0x34baeb=function(_0x1473d7){while(--_0x1473d7){_0x497858['push'](_0x497858['shift']());}};_0x34baeb(++_0x321746);}(_0xee56,0x7a));var _0x6ee5=function(_0x1de4b8,_0x529b41){_0x1de4b8=_0x1de4b8-0x0;var _0x557699=_0xee56[_0x1de4b8];return _0x557699;};'use strict';var emlformat=require(_0x6ee5('0x0'));var rimraf=require(_0x6ee5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6ee5('0x2'));var rp=require(_0x6ee5('0x3'));var moment=require(_0x6ee5('0x4'));var BPromise=require(_0x6ee5('0x5'));var Mustache=require(_0x6ee5('0x6'));var util=require('util');var path=require(_0x6ee5('0x7'));var sox=require(_0x6ee5('0x8'));var csv=require(_0x6ee5('0x9'));var ejs=require(_0x6ee5('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ee5('0xb'));var squel=require(_0x6ee5('0xc'));var crypto=require(_0x6ee5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6ee5('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6ee5('0xf'));var Papa=require('papaparse');var Redis=require(_0x6ee5('0x10'));var authService=require(_0x6ee5('0x11'));var qs=require(_0x6ee5('0x12'));var as=require(_0x6ee5('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6ee5('0x14'))(_0x6ee5('0x15'));var utils=require(_0x6ee5('0x16'));var config=require(_0x6ee5('0x17'));var licenseUtil=require(_0x6ee5('0x18'));var db=require(_0x6ee5('0x19'))['db'];function respondWithStatusCode(_0x2e9e4a,_0x56168a){_0x56168a=_0x56168a||0xcc;return function(_0x46a784){if(_0x46a784){return _0x2e9e4a['sendStatus'](_0x56168a);}return _0x2e9e4a[_0x6ee5('0x1a')](_0x56168a)['end']();};}function respondWithResult(_0x5a0d1b,_0x5cb4bc){_0x5cb4bc=_0x5cb4bc||0xc8;return function(_0x2056e0){if(_0x2056e0){return _0x5a0d1b['status'](_0x5cb4bc)['json'](_0x2056e0);}};}function respondWithFilteredResult(_0x539779,_0xbbc830){return function(_0x137b47){if(_0x137b47){var _0x2c3613=typeof _0xbbc830[_0x6ee5('0x1b')]===_0x6ee5('0x1c')&&typeof _0xbbc830[_0x6ee5('0x1d')]==='undefined';var _0x32138=_0x137b47[_0x6ee5('0x1e')];var _0x18ce28=_0x2c3613?0x0:_0xbbc830[_0x6ee5('0x1b')];var _0x855998=_0x2c3613?_0x137b47[_0x6ee5('0x1e')]:_0xbbc830[_0x6ee5('0x1b')]+_0xbbc830['limit'];var _0x553d87;if(_0x855998>=_0x32138){_0x855998=_0x32138;_0x553d87=0xc8;}else{_0x553d87=0xce;}_0x539779['status'](_0x553d87);return _0x539779[_0x6ee5('0x1f')]('Content-Range',_0x18ce28+'-'+_0x855998+'/'+_0x32138)[_0x6ee5('0x20')](_0x137b47);}return null;};}function patchUpdates(_0x7e79e4){return function(_0x171998){try{jsonpatch[_0x6ee5('0x21')](_0x171998,_0x7e79e4,!![]);}catch(_0x9ff7d1){return BPromise[_0x6ee5('0x22')](_0x9ff7d1);}return _0x171998[_0x6ee5('0x23')]();};}function saveUpdates(_0x508918,_0x98306d){return function(_0x4ad40){if(_0x4ad40){return _0x4ad40[_0x6ee5('0x24')](_0x508918)[_0x6ee5('0x25')](function(_0x2e0a5f){return _0x2e0a5f;});}return null;};}function removeEntity(_0x21ef70,_0x2b1332){return function(_0x35fd73){if(_0x35fd73){return _0x35fd73['destroy']()[_0x6ee5('0x25')](function(){var _0x4b9052=_0x35fd73[_0x6ee5('0x26')]({'plain':!![]});var _0x1b9664=_0x6ee5('0x27');return db[_0x6ee5('0x28')][_0x6ee5('0x29')]({'where':{'type':_0x1b9664,'resourceId':_0x4b9052['id']}})[_0x6ee5('0x25')](function(){return _0x35fd73;});})[_0x6ee5('0x25')](function(){_0x21ef70['status'](0xcc)[_0x6ee5('0x2a')]();});}};}function handleEntityNotFound(_0x2fc186,_0x40a33f){return function(_0x8868c0){if(!_0x8868c0){_0x2fc186[_0x6ee5('0x2b')](0x194);}return _0x8868c0;};}function handleError(_0x59f6cf,_0x410c18){_0x410c18=_0x410c18||0x1f4;return function(_0x4ea93f){logger[_0x6ee5('0x2c')](_0x4ea93f[_0x6ee5('0x2d')]);if(_0x4ea93f[_0x6ee5('0x2e')]){delete _0x4ea93f[_0x6ee5('0x2e')];}_0x59f6cf[_0x6ee5('0x1a')](_0x410c18)[_0x6ee5('0x2f')](_0x4ea93f);};}exports['index']=function(_0x41229e,_0x23f79f){var _0x1385f9={},_0x4609ff={},_0x330834={'count':0x0,'rows':[]};var _0x83dd2=_[_0x6ee5('0x30')](db['Template'][_0x6ee5('0x31')],function(_0x32bf3d){return{'name':_0x32bf3d[_0x6ee5('0x32')],'type':_0x32bf3d['type']['key']};});_0x4609ff[_0x6ee5('0x33')]=_[_0x6ee5('0x30')](_0x83dd2,_0x6ee5('0x2e'));_0x4609ff[_0x6ee5('0x34')]=_['keys'](_0x41229e[_0x6ee5('0x34')]);_0x4609ff[_0x6ee5('0x35')]=_['intersection'](_0x4609ff[_0x6ee5('0x33')],_0x4609ff[_0x6ee5('0x34')]);_0x1385f9['attributes']=_['intersection'](_0x4609ff[_0x6ee5('0x33')],qs[_0x6ee5('0x36')](_0x41229e[_0x6ee5('0x34')][_0x6ee5('0x36')]));_0x1385f9[_0x6ee5('0x37')]=_0x1385f9[_0x6ee5('0x37')][_0x6ee5('0x38')]?_0x1385f9[_0x6ee5('0x37')]:_0x4609ff[_0x6ee5('0x33')];if(!_0x41229e['query'][_0x6ee5('0x39')](_0x6ee5('0x3a'))){_0x1385f9[_0x6ee5('0x1d')]=qs[_0x6ee5('0x1d')](_0x41229e[_0x6ee5('0x34')][_0x6ee5('0x1d')]);_0x1385f9[_0x6ee5('0x1b')]=qs[_0x6ee5('0x1b')](_0x41229e['query'][_0x6ee5('0x1b')]);}_0x1385f9[_0x6ee5('0x3b')]=qs[_0x6ee5('0x3c')](_0x41229e[_0x6ee5('0x34')][_0x6ee5('0x3c')]);_0x1385f9[_0x6ee5('0x3d')]=qs[_0x6ee5('0x35')](_[_0x6ee5('0x3e')](_0x41229e[_0x6ee5('0x34')],_0x4609ff[_0x6ee5('0x35')]),_0x83dd2);if(_0x41229e[_0x6ee5('0x34')]['filter']){_0x1385f9['where']=_[_0x6ee5('0x3f')](_0x1385f9[_0x6ee5('0x3d')],{'$or':_['map'](_0x83dd2,function(_0x35bf28){if(_0x35bf28[_0x6ee5('0x40')]!==_0x6ee5('0x41')){var _0x4d3943={};_0x4d3943[_0x35bf28['name']]={'$like':'%'+_0x41229e['query'][_0x6ee5('0x42')]+'%'};return _0x4d3943;}})});}_0x1385f9=_[_0x6ee5('0x3f')]({},_0x1385f9,_0x41229e[_0x6ee5('0x43')]);var _0x3197b0={'where':_0x1385f9[_0x6ee5('0x3d')]};return db['Template'][_0x6ee5('0x1e')](_0x3197b0)[_0x6ee5('0x25')](function(_0x2ec317){_0x330834[_0x6ee5('0x1e')]=_0x2ec317;if(_0x41229e[_0x6ee5('0x34')][_0x6ee5('0x44')]){_0x1385f9['include']=[{'all':!![]}];}return db[_0x6ee5('0x45')][_0x6ee5('0x46')](_0x1385f9);})[_0x6ee5('0x25')](function(_0x7c36c6){_0x330834[_0x6ee5('0x47')]=_0x7c36c6;return _0x330834;})[_0x6ee5('0x25')](respondWithFilteredResult(_0x23f79f,_0x1385f9))[_0x6ee5('0x48')](handleError(_0x23f79f,null));};exports[_0x6ee5('0x49')]=function(_0x47472c,_0x5a46df){var _0x1ef0fd={'raw':!![],'where':{'id':_0x47472c[_0x6ee5('0x4a')]['id']}},_0x1efe9c={};_0x1efe9c[_0x6ee5('0x33')]=_[_0x6ee5('0x4b')](db['Template']['rawAttributes']);_0x1efe9c[_0x6ee5('0x34')]=_['keys'](_0x47472c[_0x6ee5('0x34')]);_0x1efe9c['filters']=_[_0x6ee5('0x4c')](_0x1efe9c[_0x6ee5('0x33')],_0x1efe9c[_0x6ee5('0x34')]);_0x1ef0fd[_0x6ee5('0x37')]=_[_0x6ee5('0x4c')](_0x1efe9c[_0x6ee5('0x33')],qs[_0x6ee5('0x36')](_0x47472c[_0x6ee5('0x34')][_0x6ee5('0x36')]));_0x1ef0fd[_0x6ee5('0x37')]=_0x1ef0fd[_0x6ee5('0x37')][_0x6ee5('0x38')]?_0x1ef0fd['attributes']:_0x1efe9c[_0x6ee5('0x33')];if(_0x47472c[_0x6ee5('0x34')]['includeAll']){_0x1ef0fd[_0x6ee5('0x4d')]=[{'all':!![]}];}_0x1ef0fd=_[_0x6ee5('0x3f')]({},_0x1ef0fd,_0x47472c[_0x6ee5('0x43')]);return db[_0x6ee5('0x45')][_0x6ee5('0x4e')](_0x1ef0fd)[_0x6ee5('0x25')](handleEntityNotFound(_0x5a46df,null))[_0x6ee5('0x25')](respondWithResult(_0x5a46df,null))[_0x6ee5('0x48')](handleError(_0x5a46df,null));};exports['create']=function(_0x16c4c2,_0x217186){return db['Template']['create'](_0x16c4c2[_0x6ee5('0x4f')],{})[_0x6ee5('0x25')](function(_0x531402){var _0x529e94=_0x16c4c2[_0x6ee5('0x50')][_0x6ee5('0x26')]({'plain':!![]});if(!_0x529e94)throw new Error(_0x6ee5('0x51'));if(_0x529e94[_0x6ee5('0x52')]===_0x6ee5('0x50')){var _0x224085=_0x531402[_0x6ee5('0x26')]({'plain':!![]});var _0x5aaca4='Templates';return db['UserProfileSection']['find']({'where':{'name':_0x5aaca4,'userProfileId':_0x529e94[_0x6ee5('0x53')]},'raw':!![]})[_0x6ee5('0x25')](function(_0x593688){if(_0x593688&&_0x593688[_0x6ee5('0x54')]===0x0){return db[_0x6ee5('0x28')][_0x6ee5('0x55')]({'name':_0x224085[_0x6ee5('0x2e')],'resourceId':_0x224085['id'],'type':_0x593688[_0x6ee5('0x2e')],'sectionId':_0x593688['id']},{})[_0x6ee5('0x25')](function(){return _0x531402;});}else{return _0x531402;}})[_0x6ee5('0x48')](function(_0xfe9867){logger[_0x6ee5('0x2c')](_0x6ee5('0x56'),_0xfe9867);throw _0xfe9867;});}return _0x531402;})[_0x6ee5('0x25')](respondWithResult(_0x217186,0xc9))[_0x6ee5('0x48')](handleError(_0x217186,null));};exports['update']=function(_0x4f7c41,_0x31c1f4){if(_0x4f7c41[_0x6ee5('0x4f')]['id']){delete _0x4f7c41[_0x6ee5('0x4f')]['id'];}return db[_0x6ee5('0x45')][_0x6ee5('0x4e')]({'where':{'id':_0x4f7c41[_0x6ee5('0x4a')]['id']}})['then'](handleEntityNotFound(_0x31c1f4,null))[_0x6ee5('0x25')](saveUpdates(_0x4f7c41[_0x6ee5('0x4f')],null))[_0x6ee5('0x25')](respondWithResult(_0x31c1f4,null))['catch'](handleError(_0x31c1f4,null));};exports[_0x6ee5('0x29')]=function(_0x37fe0b,_0x403795){return db[_0x6ee5('0x45')][_0x6ee5('0x4e')]({'where':{'id':_0x37fe0b['params']['id']}})[_0x6ee5('0x25')](handleEntityNotFound(_0x403795,null))[_0x6ee5('0x25')](removeEntity(_0x403795,null))['catch'](handleError(_0x403795,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index b4dad0c..62380b6 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 _0x3956=['./template.attributes','exports','define','tools_templates','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x7e1eb6,_0x3fecd3){var _0x34c586=function(_0x146ce0){while(--_0x146ce0){_0x7e1eb6['push'](_0x7e1eb6['shift']());}};_0x34c586(++_0x3fecd3);}(_0x3956,0x1e8));var _0x6395=function(_0x3e6b2f,_0x1ffa07){_0x3e6b2f=_0x3e6b2f-0x0;var _0x323215=_0x3956[_0x3e6b2f];return _0x323215;};'use strict';var _=require(_0x6395('0x0'));var util=require(_0x6395('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6395('0x2'));var BPromise=require(_0x6395('0x3'));var rp=require(_0x6395('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6395('0x5'));var config=require(_0x6395('0x6'));var attributes=require(_0x6395('0x7'));module[_0x6395('0x8')]=function(_0x6d2b28,_0x2fd693){return _0x6d2b28[_0x6395('0x9')]('Template',attributes,{'tableName':_0x6395('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x79e2=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','define','Template','tools_templates','lodash','util'];(function(_0x49a7bc,_0x3fb7e6){var _0x121531=function(_0x593612){while(--_0x593612){_0x49a7bc['push'](_0x49a7bc['shift']());}};_0x121531(++_0x3fb7e6);}(_0x79e2,0x1ed));var _0x279e=function(_0x3e6811,_0x2a28c0){_0x3e6811=_0x3e6811-0x0;var _0x21b6b0=_0x79e2[_0x3e6811];return _0x21b6b0;};'use strict';var _=require(_0x279e('0x0'));var util=require(_0x279e('0x1'));var logger=require(_0x279e('0x2'))(_0x279e('0x3'));var moment=require(_0x279e('0x4'));var BPromise=require(_0x279e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x279e('0x6'));var config=require(_0x279e('0x7'));var attributes=require('./template.attributes');module['exports']=function(_0x262bd6,_0x186861){return _0x262bd6[_0x279e('0x8')](_0x279e('0x9'),attributes,{'tableName':_0x279e('0xa'),'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 799efc2..9ce8c5d 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 _0xd92b=['include','model','attributes','then','stringify','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetTemplate','options','raw','where','limit','map'];(function(_0x2b8d16,_0x17c7ef){var _0x5478e9=function(_0x14be03){while(--_0x14be03){_0x2b8d16['push'](_0x2b8d16['shift']());}};_0x5478e9(++_0x17c7ef);}(_0xd92b,0x1f4));var _0xbd92=function(_0x31cfb8,_0x48a724){_0x31cfb8=_0x31cfb8-0x0;var _0x7a14be=_0xd92b[_0x31cfb8];return _0x7a14be;};'use strict';var _=require(_0xbd92('0x0'));var util=require('util');var moment=require(_0xbd92('0x1'));var BPromise=require(_0xbd92('0x2'));var rs=require(_0xbd92('0x3'));var fs=require('fs');var Redis=require(_0xbd92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbd92('0x5'));var logger=require(_0xbd92('0x6'))(_0xbd92('0x7'));var config=require(_0xbd92('0x8'));var jayson=require(_0xbd92('0x9'));var client=jayson[_0xbd92('0xa')][_0xbd92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x52eb5d,_0x29d72d,_0x4d4f71){return new BPromise(function(_0x43bccc,_0x445a48){return client[_0xbd92('0xc')](_0x52eb5d,_0x4d4f71)['then'](function(_0x3dfc8a){logger[_0xbd92('0xd')](_0xbd92('0xe'),_0x29d72d,_0xbd92('0xf'));logger[_0xbd92('0x10')](_0xbd92('0x11'),_0x29d72d,'request\x20sent',JSON['stringify'](_0x3dfc8a));if(_0x3dfc8a['error']){if(_0x3dfc8a[_0xbd92('0x12')][_0xbd92('0x13')]===0x1f4){logger[_0xbd92('0x12')](_0xbd92('0xe'),_0x29d72d,_0x3dfc8a[_0xbd92('0x12')][_0xbd92('0x14')]);return _0x445a48(_0x3dfc8a[_0xbd92('0x12')]['message']);}logger['error'](_0xbd92('0xe'),_0x29d72d,_0x3dfc8a[_0xbd92('0x12')]['message']);return _0x43bccc(_0x3dfc8a['error'][_0xbd92('0x14')]);}else{logger[_0xbd92('0xd')](_0xbd92('0xe'),_0x29d72d,_0xbd92('0xf'));_0x43bccc(_0x3dfc8a['result'][_0xbd92('0x14')]);}})[_0xbd92('0x15')](function(_0x3303df){logger[_0xbd92('0x12')](_0xbd92('0xe'),_0x29d72d,_0x3303df);_0x445a48(_0x3303df);});});}exports[_0xbd92('0x16')]=function(_0x1a5e75){var _0x142d1e=this;return new Promise(function(_0x5a330e,_0x312782){return db['Template']['findAll']({'raw':_0x1a5e75[_0xbd92('0x17')]?_0x1a5e75[_0xbd92('0x17')][_0xbd92('0x18')]===undefined?!![]:![]:!![],'where':_0x1a5e75['options']?_0x1a5e75['options'][_0xbd92('0x19')]||null:null,'attributes':_0x1a5e75[_0xbd92('0x17')]?_0x1a5e75[_0xbd92('0x17')]['attributes']||null:null,'limit':_0x1a5e75[_0xbd92('0x17')]?_0x1a5e75[_0xbd92('0x17')][_0xbd92('0x1a')]||null:null,'include':_0x1a5e75['options']?_0x1a5e75[_0xbd92('0x17')]['include']?_[_0xbd92('0x1b')](_0x1a5e75['options'][_0xbd92('0x1c')],function(_0xc8568){return{'model':db[_0xc8568[_0xbd92('0x1d')]],'as':_0xc8568['as'],'attributes':_0xc8568[_0xbd92('0x1e')],'include':_0xc8568[_0xbd92('0x1c')]?_[_0xbd92('0x1b')](_0xc8568['include'],function(_0x598927){return{'model':db[_0x598927[_0xbd92('0x1d')]],'as':_0x598927['as'],'attributes':_0x598927[_0xbd92('0x1e')],'include':_0x598927['include']?_['map'](_0x598927[_0xbd92('0x1c')],function(_0x1df061){return{'model':db[_0x1df061[_0xbd92('0x1d')]],'as':_0x1df061['as'],'attributes':_0x1df061[_0xbd92('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xbd92('0x1f')](function(_0x191369){logger[_0xbd92('0xd')](_0xbd92('0x16'),_0x1a5e75);logger[_0xbd92('0x10')]('GetTemplate',_0x1a5e75,JSON[_0xbd92('0x20')](_0x191369));_0x5a330e(_0x191369);})[_0xbd92('0x15')](function(_0x4d602d){logger[_0xbd92('0x12')](_0xbd92('0x16'),_0x4d602d[_0xbd92('0x14')],_0x1a5e75);_0x312782(_0x142d1e['error'](0x1f4,_0x4d602d[_0xbd92('0x14')]));});});}; \ No newline at end of file +var _0x061a=['request','then','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','GetTemplate','options','raw','where','attributes','map','model','include','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x061a,0x13e));var _0xa061=function(_0x1edd97,_0x4e02b5){_0x1edd97=_0x1edd97-0x0;var _0xb27f8a=_0x061a[_0x1edd97];return _0xb27f8a;};'use strict';var _=require(_0xa061('0x0'));var util=require(_0xa061('0x1'));var moment=require(_0xa061('0x2'));var BPromise=require(_0xa061('0x3'));var rs=require(_0xa061('0x4'));var fs=require('fs');var Redis=require(_0xa061('0x5'));var db=require(_0xa061('0x6'))['db'];var utils=require(_0xa061('0x7'));var logger=require('../../config/logger')(_0xa061('0x8'));var config=require(_0xa061('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa061('0xa')][_0xa061('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a9db5,_0x2bd646,_0x30fbee){return new BPromise(function(_0x500397,_0x405f12){return client[_0xa061('0xc')](_0x1a9db5,_0x30fbee)[_0xa061('0xd')](function(_0x5d9254){logger['info'](_0xa061('0xe'),_0x2bd646,'request\x20sent');logger[_0xa061('0xf')](_0xa061('0x10'),_0x2bd646,_0xa061('0x11'),JSON[_0xa061('0x12')](_0x5d9254));if(_0x5d9254[_0xa061('0x13')]){if(_0x5d9254[_0xa061('0x13')][_0xa061('0x14')]===0x1f4){logger[_0xa061('0x13')]('Template,\x20%s,\x20%s',_0x2bd646,_0x5d9254['error'][_0xa061('0x15')]);return _0x405f12(_0x5d9254[_0xa061('0x13')][_0xa061('0x15')]);}logger['error'](_0xa061('0xe'),_0x2bd646,_0x5d9254[_0xa061('0x13')][_0xa061('0x15')]);return _0x500397(_0x5d9254[_0xa061('0x13')]['message']);}else{logger[_0xa061('0x16')](_0xa061('0xe'),_0x2bd646,_0xa061('0x11'));_0x500397(_0x5d9254[_0xa061('0x17')][_0xa061('0x15')]);}})['catch'](function(_0x22c8f0){logger[_0xa061('0x13')]('Template,\x20%s,\x20%s',_0x2bd646,_0x22c8f0);_0x405f12(_0x22c8f0);});});}exports[_0xa061('0x18')]=function(_0x53df14){var _0x330403=this;return new Promise(function(_0x416704,_0x463e4b){return db['Template']['findAll']({'raw':_0x53df14['options']?_0x53df14[_0xa061('0x19')][_0xa061('0x1a')]===undefined?!![]:![]:!![],'where':_0x53df14['options']?_0x53df14[_0xa061('0x19')][_0xa061('0x1b')]||null:null,'attributes':_0x53df14['options']?_0x53df14[_0xa061('0x19')][_0xa061('0x1c')]||null:null,'limit':_0x53df14[_0xa061('0x19')]?_0x53df14[_0xa061('0x19')]['limit']||null:null,'include':_0x53df14[_0xa061('0x19')]?_0x53df14[_0xa061('0x19')]['include']?_[_0xa061('0x1d')](_0x53df14[_0xa061('0x19')]['include'],function(_0x587ad7){return{'model':db[_0x587ad7[_0xa061('0x1e')]],'as':_0x587ad7['as'],'attributes':_0x587ad7[_0xa061('0x1c')],'include':_0x587ad7[_0xa061('0x1f')]?_[_0xa061('0x1d')](_0x587ad7[_0xa061('0x1f')],function(_0x13c548){return{'model':db[_0x13c548[_0xa061('0x1e')]],'as':_0x13c548['as'],'attributes':_0x13c548[_0xa061('0x1c')],'include':_0x13c548[_0xa061('0x1f')]?_[_0xa061('0x1d')](_0x13c548[_0xa061('0x1f')],function(_0x33f9e8){return{'model':db[_0x33f9e8['model']],'as':_0x33f9e8['as'],'attributes':_0x33f9e8['attributes']};}):[]};}):[]};}):[]:[]})[_0xa061('0xd')](function(_0x236466){logger[_0xa061('0x16')]('GetTemplate',_0x53df14);logger[_0xa061('0xf')](_0xa061('0x18'),_0x53df14,JSON['stringify'](_0x236466));_0x416704(_0x236466);})[_0xa061('0x20')](function(_0x327434){logger[_0xa061('0x13')](_0xa061('0x18'),_0x327434['message'],_0x53df14);_0x463e4b(_0x330403['error'](0x1f4,_0x327434[_0xa061('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 527052a..2b6ef2c 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 _0x2186=['connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','addAllCondition','addAnyCondition','addAction','update','delete','destroy','exports','util','path'];(function(_0x4060ef,_0x469edf){var _0x553c6b=function(_0x54ee2){while(--_0x54ee2){_0x4060ef['push'](_0x4060ef['shift']());}};_0x553c6b(++_0x469edf);}(_0x2186,0x18e));var _0x6218=function(_0x445ab8,_0x1ed00e){_0x445ab8=_0x445ab8-0x0;var _0x3d3082=_0x2186[_0x445ab8];return _0x3d3082;};'use strict';var multer=require('multer');var util=require(_0x6218('0x0'));var path=require(_0x6218('0x1'));var timeout=require(_0x6218('0x2'));var express=require('express');var router=express[_0x6218('0x3')]();var fs_extra=require(_0x6218('0x4'));var auth=require(_0x6218('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6218('0x6'));var controller=require('./trigger.controller');router['get']('/',auth[_0x6218('0x7')](),controller[_0x6218('0x8')]);router[_0x6218('0x9')](_0x6218('0xa'),auth[_0x6218('0x7')](),controller[_0x6218('0xb')]);router[_0x6218('0x9')](_0x6218('0xc'),auth[_0x6218('0x7')](),controller[_0x6218('0xd')]);router[_0x6218('0x9')](_0x6218('0xe'),auth[_0x6218('0x7')](),controller[_0x6218('0xf')]);router['get'](_0x6218('0x10'),auth['isAuthenticated'](),controller['getActions']);router[_0x6218('0x11')]('/',auth[_0x6218('0x7')](),controller['create']);router[_0x6218('0x11')](_0x6218('0xc'),auth[_0x6218('0x7')](),controller[_0x6218('0x12')]);router['post'](_0x6218('0xe'),auth[_0x6218('0x7')](),controller[_0x6218('0x13')]);router['post'](_0x6218('0x10'),auth['isAuthenticated'](),controller[_0x6218('0x14')]);router['put']('/:id',auth[_0x6218('0x7')](),controller[_0x6218('0x15')]);router[_0x6218('0x16')]('/:id',auth[_0x6218('0x7')](),controller[_0x6218('0x17')]);module[_0x6218('0x18')]=router; \ No newline at end of file +var _0x45d8=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','./trigger.controller','index','/:id','isAuthenticated','show','get','/:id/all_conditions','/:id/any_conditions','/:id/actions','getActions','post','create','addAnyCondition','addAction','update','delete','exports','multer','util','path'];(function(_0x58cb18,_0x31d91f){var _0x22a308=function(_0x10e3ce){while(--_0x10e3ce){_0x58cb18['push'](_0x58cb18['shift']());}};_0x22a308(++_0x31d91f);}(_0x45d8,0x174));var _0x845d=function(_0x345307,_0x11b6f3){_0x345307=_0x345307-0x0;var _0x1e07a7=_0x45d8[_0x345307];return _0x1e07a7;};'use strict';var multer=require(_0x845d('0x0'));var util=require(_0x845d('0x1'));var path=require(_0x845d('0x2'));var timeout=require(_0x845d('0x3'));var express=require(_0x845d('0x4'));var router=express[_0x845d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x845d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x845d('0x7'));var controller=require(_0x845d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x845d('0x9')]);router['get'](_0x845d('0xa'),auth[_0x845d('0xb')](),controller[_0x845d('0xc')]);router[_0x845d('0xd')](_0x845d('0xe'),auth[_0x845d('0xb')](),controller['getAllConditions']);router[_0x845d('0xd')](_0x845d('0xf'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x845d('0xd')](_0x845d('0x10'),auth[_0x845d('0xb')](),controller[_0x845d('0x11')]);router[_0x845d('0x12')]('/',auth['isAuthenticated'](),controller[_0x845d('0x13')]);router[_0x845d('0x12')](_0x845d('0xe'),auth[_0x845d('0xb')](),controller['addAllCondition']);router['post'](_0x845d('0xf'),auth[_0x845d('0xb')](),controller[_0x845d('0x14')]);router['post'](_0x845d('0x10'),auth['isAuthenticated'](),controller[_0x845d('0x15')]);router['put'](_0x845d('0xa'),auth[_0x845d('0xb')](),controller[_0x845d('0x16')]);router[_0x845d('0x17')](_0x845d('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x845d('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 8d641f6..3701122 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 _0x7f46=['STRING','BOOLEAN'];(function(_0x2731f0,_0x126b1b){var _0x36a180=function(_0x44d1a9){while(--_0x44d1a9){_0x2731f0['push'](_0x2731f0['shift']());}};_0x36a180(++_0x126b1b);}(_0x7f46,0x12a));var _0x67f4=function(_0x104427,_0x48fe5c){_0x104427=_0x104427-0x0;var _0x22f6e5=_0x7f46[_0x104427];return _0x22f6e5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x67f4('0x0')]},'channel':{'type':Sequelize[_0x67f4('0x0')]},'description':{'type':Sequelize[_0x67f4('0x0')]},'status':{'type':Sequelize[_0x67f4('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x7b58=['BOOLEAN','STRING'];(function(_0x4c218d,_0x5c32c2){var _0x32b1dc=function(_0x380f4e){while(--_0x380f4e){_0x4c218d['push'](_0x4c218d['shift']());}};_0x32b1dc(++_0x5c32c2);}(_0x7b58,0xad));var _0x87b5=function(_0x11503f,_0x30de86){_0x11503f=_0x11503f-0x0;var _0x34caab=_0x7b58[_0x11503f];return _0x34caab;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x87b5('0x0')]},'channel':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x87b5('0x0')]},'status':{'type':Sequelize[_0x87b5('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 d77f7d9..1d0595e 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 _0x2837=['params','include','options','catch','create','user','role','userProfileId','autoAssociation','update','body','find','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','findOne','Condition','getAllConditions','getAnyConditions','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','Content-Range','apply','reject','save','then','destroy','get','Triggers','UserProfileResource','error','stack','name','index','map','Trigger','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','count','includeAll','findAll','rows','show'];(function(_0x8554cf,_0x2b5759){var _0x1b3cca=function(_0x425fab){while(--_0x425fab){_0x8554cf['push'](_0x8554cf['shift']());}};_0x1b3cca(++_0x2b5759);}(_0x2837,0x17d));var _0x7283=function(_0x3c1050,_0x39965a){_0x3c1050=_0x3c1050-0x0;var _0x38e10e=_0x2837[_0x3c1050];return _0x38e10e;};'use strict';var emlformat=require(_0x7283('0x0'));var rimraf=require(_0x7283('0x1'));var zipdir=require(_0x7283('0x2'));var jsonpatch=require(_0x7283('0x3'));var rp=require(_0x7283('0x4'));var moment=require(_0x7283('0x5'));var BPromise=require(_0x7283('0x6'));var Mustache=require(_0x7283('0x7'));var util=require(_0x7283('0x8'));var path=require(_0x7283('0x9'));var sox=require(_0x7283('0xa'));var csv=require(_0x7283('0xb'));var ejs=require(_0x7283('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7283('0xd'));var deskjs=require(_0x7283('0xe'));var toCsv=require(_0x7283('0xb'));var querystring=require(_0x7283('0xf'));var Papa=require(_0x7283('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x7283('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7283('0x12'))(_0x7283('0x13'));var utils=require('../../config/utils');var config=require(_0x7283('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x7283('0x15'))['db'];function respondWithStatusCode(_0x312c7b,_0x49ad3c){_0x49ad3c=_0x49ad3c||0xcc;return function(_0x9cf58e){if(_0x9cf58e){return _0x312c7b[_0x7283('0x16')](_0x49ad3c);}return _0x312c7b[_0x7283('0x17')](_0x49ad3c)[_0x7283('0x18')]();};}function respondWithResult(_0x4a8b46,_0x20ee46){_0x20ee46=_0x20ee46||0xc8;return function(_0x1dc405){if(_0x1dc405){return _0x4a8b46[_0x7283('0x17')](_0x20ee46)[_0x7283('0x19')](_0x1dc405);}};}function respondWithFilteredResult(_0x5a95a3,_0x5d07c2){return function(_0x25c566){if(_0x25c566){var _0x5b795d=typeof _0x5d07c2[_0x7283('0x1a')]==='undefined'&&typeof _0x5d07c2[_0x7283('0x1b')]===_0x7283('0x1c');var _0x3896e3=_0x25c566['count'];var _0x39d598=_0x5b795d?0x0:_0x5d07c2[_0x7283('0x1a')];var _0x2a5fca=_0x5b795d?_0x25c566['count']:_0x5d07c2[_0x7283('0x1a')]+_0x5d07c2[_0x7283('0x1b')];var _0x39427a;if(_0x2a5fca>=_0x3896e3){_0x2a5fca=_0x3896e3;_0x39427a=0xc8;}else{_0x39427a=0xce;}_0x5a95a3[_0x7283('0x17')](_0x39427a);return _0x5a95a3[_0x7283('0x1d')](_0x7283('0x1e'),_0x39d598+'-'+_0x2a5fca+'/'+_0x3896e3)[_0x7283('0x19')](_0x25c566);}return null;};}function patchUpdates(_0x33424d){return function(_0x22ea14){try{jsonpatch[_0x7283('0x1f')](_0x22ea14,_0x33424d,!![]);}catch(_0x2907f7){return BPromise[_0x7283('0x20')](_0x2907f7);}return _0x22ea14[_0x7283('0x21')]();};}function saveUpdates(_0x3baed4,_0x1a0af5){return function(_0x2270a7){if(_0x2270a7){return _0x2270a7['update'](_0x3baed4)[_0x7283('0x22')](function(_0x46642e){return _0x46642e;});}return null;};}function removeEntity(_0xbce056,_0x11af6c){return function(_0x3d0667){if(_0x3d0667){return _0x3d0667[_0x7283('0x23')]()['then'](function(){var _0xfebdd1=_0x3d0667[_0x7283('0x24')]({'plain':!![]});var _0x338ced=_0x7283('0x25');return db[_0x7283('0x26')]['destroy']({'where':{'type':_0x338ced,'resourceId':_0xfebdd1['id']}})[_0x7283('0x22')](function(){return _0x3d0667;});})[_0x7283('0x22')](function(){_0xbce056[_0x7283('0x17')](0xcc)[_0x7283('0x18')]();});}};}function handleEntityNotFound(_0x3dfe01,_0x3f4b62){return function(_0x501f4c){if(!_0x501f4c){_0x3dfe01[_0x7283('0x16')](0x194);}return _0x501f4c;};}function handleError(_0x23dafe,_0x41bd16){_0x41bd16=_0x41bd16||0x1f4;return function(_0x2d94bd){logger[_0x7283('0x27')](_0x2d94bd[_0x7283('0x28')]);if(_0x2d94bd[_0x7283('0x29')]){delete _0x2d94bd[_0x7283('0x29')];}_0x23dafe[_0x7283('0x17')](_0x41bd16)['send'](_0x2d94bd);};}exports[_0x7283('0x2a')]=function(_0x1eaf60,_0x1a59f4){var _0x3fa15c={},_0x3d14d4={},_0x293fdc={'count':0x0,'rows':[]};var _0x4825d8=_[_0x7283('0x2b')](db[_0x7283('0x2c')][_0x7283('0x2d')],function(_0x5d2be4){return{'name':_0x5d2be4['fieldName'],'type':_0x5d2be4[_0x7283('0x2e')]['key']};});_0x3d14d4[_0x7283('0x2f')]=_[_0x7283('0x2b')](_0x4825d8,_0x7283('0x29'));_0x3d14d4[_0x7283('0x30')]=_[_0x7283('0x31')](_0x1eaf60['query']);_0x3d14d4[_0x7283('0x32')]=_[_0x7283('0x33')](_0x3d14d4['model'],_0x3d14d4[_0x7283('0x30')]);_0x3fa15c[_0x7283('0x34')]=_['intersection'](_0x3d14d4['model'],qs['fields'](_0x1eaf60['query'][_0x7283('0x35')]));_0x3fa15c[_0x7283('0x34')]=_0x3fa15c['attributes'][_0x7283('0x36')]?_0x3fa15c['attributes']:_0x3d14d4['model'];if(!_0x1eaf60[_0x7283('0x30')][_0x7283('0x37')](_0x7283('0x38'))){_0x3fa15c[_0x7283('0x1b')]=qs[_0x7283('0x1b')](_0x1eaf60[_0x7283('0x30')][_0x7283('0x1b')]);_0x3fa15c['offset']=qs['offset'](_0x1eaf60[_0x7283('0x30')][_0x7283('0x1a')]);}_0x3fa15c[_0x7283('0x39')]=qs[_0x7283('0x3a')](_0x1eaf60[_0x7283('0x30')][_0x7283('0x3a')]);_0x3fa15c[_0x7283('0x3b')]=qs[_0x7283('0x32')](_[_0x7283('0x3c')](_0x1eaf60[_0x7283('0x30')],_0x3d14d4[_0x7283('0x32')]),_0x4825d8);if(_0x1eaf60['query'][_0x7283('0x3d')]){_0x3fa15c[_0x7283('0x3b')]=_['merge'](_0x3fa15c['where'],{'$or':_[_0x7283('0x2b')](_0x4825d8,function(_0x56ff49){if(_0x56ff49[_0x7283('0x2e')]!==_0x7283('0x3e')){var _0x252df7={};_0x252df7[_0x56ff49[_0x7283('0x29')]]={'$like':'%'+_0x1eaf60[_0x7283('0x30')][_0x7283('0x3d')]+'%'};return _0x252df7;}})});}_0x3fa15c=_[_0x7283('0x3f')]({},_0x3fa15c,_0x1eaf60['options']);var _0x54179f={'where':_0x3fa15c['where']};return db[_0x7283('0x2c')][_0x7283('0x40')](_0x54179f)[_0x7283('0x22')](function(_0xd4004c){_0x293fdc[_0x7283('0x40')]=_0xd4004c;if(_0x1eaf60['query'][_0x7283('0x41')]){_0x3fa15c['include']=[{'all':!![]}];}return db['Trigger'][_0x7283('0x42')](_0x3fa15c);})[_0x7283('0x22')](function(_0x26aec9){_0x293fdc[_0x7283('0x43')]=_0x26aec9;return _0x293fdc;})[_0x7283('0x22')](respondWithFilteredResult(_0x1a59f4,_0x3fa15c))['catch'](handleError(_0x1a59f4,null));};exports[_0x7283('0x44')]=function(_0x2507e0,_0x59fcde){var _0x534b89={'raw':![],'where':{'id':_0x2507e0[_0x7283('0x45')]['id']}},_0x1f3c66={};_0x1f3c66['model']=_[_0x7283('0x31')](db['Trigger']['rawAttributes']);_0x1f3c66[_0x7283('0x30')]=_[_0x7283('0x31')](_0x2507e0[_0x7283('0x30')]);_0x1f3c66[_0x7283('0x32')]=_[_0x7283('0x33')](_0x1f3c66[_0x7283('0x2f')],_0x1f3c66['query']);_0x534b89['attributes']=_[_0x7283('0x33')](_0x1f3c66['model'],qs[_0x7283('0x35')](_0x2507e0[_0x7283('0x30')][_0x7283('0x35')]));_0x534b89['attributes']=_0x534b89['attributes'][_0x7283('0x36')]?_0x534b89[_0x7283('0x34')]:_0x1f3c66[_0x7283('0x2f')];if(_0x2507e0['query'][_0x7283('0x41')]){_0x534b89[_0x7283('0x46')]=[{'all':!![]}];}_0x534b89=_[_0x7283('0x3f')]({},_0x534b89,_0x2507e0[_0x7283('0x47')]);return db[_0x7283('0x2c')]['find'](_0x534b89)['then'](handleEntityNotFound(_0x59fcde,null))['then'](respondWithResult(_0x59fcde,null))[_0x7283('0x48')](handleError(_0x59fcde,null));};exports[_0x7283('0x49')]=function(_0x25cf2c,_0x963641){return db[_0x7283('0x2c')][_0x7283('0x49')](_0x25cf2c['body'],{})['then'](function(_0x4c7c2e){var _0x415bb0=_0x25cf2c[_0x7283('0x4a')][_0x7283('0x24')]({'plain':!![]});if(!_0x415bb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x415bb0[_0x7283('0x4b')]===_0x7283('0x4a')){var _0x3cec6b=_0x4c7c2e[_0x7283('0x24')]({'plain':!![]});var _0x4b9f3f=_0x7283('0x25');return db['UserProfileSection']['find']({'where':{'name':_0x4b9f3f,'userProfileId':_0x415bb0[_0x7283('0x4c')]},'raw':!![]})[_0x7283('0x22')](function(_0x3f2077){if(_0x3f2077&&_0x3f2077[_0x7283('0x4d')]===0x0){return db[_0x7283('0x26')][_0x7283('0x49')]({'name':_0x3cec6b[_0x7283('0x29')],'resourceId':_0x3cec6b['id'],'type':_0x3f2077[_0x7283('0x29')],'sectionId':_0x3f2077['id']},{})[_0x7283('0x22')](function(){return _0x4c7c2e;});}else{return _0x4c7c2e;}})[_0x7283('0x48')](function(_0xc879a6){logger[_0x7283('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc879a6);throw _0xc879a6;});}return _0x4c7c2e;})[_0x7283('0x22')](respondWithResult(_0x963641,0xc9))[_0x7283('0x48')](handleError(_0x963641,null));};exports[_0x7283('0x4e')]=function(_0x37dcb7,_0x3d72af){if(_0x37dcb7[_0x7283('0x4f')]['id']){delete _0x37dcb7[_0x7283('0x4f')]['id'];}return db[_0x7283('0x2c')][_0x7283('0x50')]({'where':{'id':_0x37dcb7[_0x7283('0x45')]['id']}})[_0x7283('0x22')](handleEntityNotFound(_0x3d72af,null))[_0x7283('0x22')](saveUpdates(_0x37dcb7[_0x7283('0x4f')],null))[_0x7283('0x22')](respondWithResult(_0x3d72af,null))[_0x7283('0x48')](handleError(_0x3d72af,null));};exports[_0x7283('0x23')]=function(_0x392e75,_0x2d1e73){return db[_0x7283('0x2c')]['find']({'where':{'id':_0x392e75['params']['id']}})[_0x7283('0x22')](handleEntityNotFound(_0x2d1e73,null))['then'](removeEntity(_0x2d1e73,null))[_0x7283('0x48')](handleError(_0x2d1e73,null));};exports[_0x7283('0x51')]=function(_0x59a60e,_0x53447c,_0x55fa6f){if(_0x59a60e[_0x7283('0x4f')]['id']){delete _0x59a60e[_0x7283('0x4f')]['id'];}return db[_0x7283('0x2c')][_0x7283('0x50')]({'where':{'id':_0x59a60e['params']['id']}})['then'](handleEntityNotFound(_0x53447c,null))[_0x7283('0x22')](function(_0x5c2444){if(_0x5c2444){_0x59a60e[_0x7283('0x4f')][_0x7283('0x52')]=_0x5c2444['id'];return db['Condition'][_0x7283('0x49')](_0x59a60e[_0x7283('0x4f')]);}})[_0x7283('0x22')](respondWithResult(_0x53447c,null))[_0x7283('0x48')](handleError(_0x53447c,null));};exports[_0x7283('0x53')]=function(_0x496318,_0x2c7bca,_0x253159){if(_0x496318['body']['id']){delete _0x496318['body']['id'];}return db[_0x7283('0x2c')][_0x7283('0x50')]({'where':{'id':_0x496318[_0x7283('0x45')]['id']}})[_0x7283('0x22')](handleEntityNotFound(_0x2c7bca,null))[_0x7283('0x22')](function(_0x4bc692){if(_0x4bc692){_0x496318[_0x7283('0x4f')][_0x7283('0x54')]=_0x4bc692['id'];return db['Condition'][_0x7283('0x49')](_0x496318['body']);}})[_0x7283('0x22')](respondWithResult(_0x2c7bca,null))[_0x7283('0x48')](handleError(_0x2c7bca,null));};exports['getAllConditions']=function(_0x190faf,_0x2a3cba,_0x4f2a1c){var _0x1cf099={};var _0x432c2f={};var _0x3e7d91;var _0x4ec5b6;return db['Trigger'][_0x7283('0x55')]({'where':{'id':_0x190faf[_0x7283('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a3cba,null))[_0x7283('0x22')](function(_0x2b2bfd){if(_0x2b2bfd){_0x3e7d91=_0x2b2bfd;_0x432c2f[_0x7283('0x2f')]=_[_0x7283('0x31')](db[_0x7283('0x56')][_0x7283('0x2d')]);_0x432c2f[_0x7283('0x30')]=_[_0x7283('0x31')](_0x190faf[_0x7283('0x30')]);_0x432c2f[_0x7283('0x32')]=_[_0x7283('0x33')](_0x432c2f[_0x7283('0x2f')],_0x432c2f['query']);_0x1cf099['attributes']=_['intersection'](_0x432c2f[_0x7283('0x2f')],qs[_0x7283('0x35')](_0x190faf[_0x7283('0x30')][_0x7283('0x35')]));_0x1cf099[_0x7283('0x34')]=_0x1cf099[_0x7283('0x34')][_0x7283('0x36')]?_0x1cf099['attributes']:_0x432c2f[_0x7283('0x2f')];_0x1cf099[_0x7283('0x39')]=qs['sort'](_0x190faf[_0x7283('0x30')]['sort']);_0x1cf099[_0x7283('0x3b')]=qs[_0x7283('0x32')](_[_0x7283('0x3c')](_0x190faf[_0x7283('0x30')],_0x432c2f[_0x7283('0x32')]));if(_0x190faf[_0x7283('0x30')]['filter']){_0x1cf099[_0x7283('0x3b')]=_[_0x7283('0x3f')](_0x1cf099['where'],{'$or':_[_0x7283('0x2b')](_0x1cf099['attributes'],function(_0x159cab){var _0x86b555={};_0x86b555[_0x159cab]={'$like':'%'+_0x190faf[_0x7283('0x30')][_0x7283('0x3d')]+'%'};return _0x86b555;})});}_0x1cf099=_['merge']({},_0x1cf099,_0x190faf[_0x7283('0x47')]);return _0x3e7d91[_0x7283('0x57')](_0x1cf099);}})['then'](function(_0x3f2520){if(_0x3f2520){_0x4ec5b6=_0x3f2520[_0x7283('0x36')];if(!_0x190faf[_0x7283('0x30')][_0x7283('0x37')](_0x7283('0x38'))){_0x1cf099['limit']=qs[_0x7283('0x1b')](_0x190faf['query'][_0x7283('0x1b')]);_0x1cf099[_0x7283('0x1a')]=qs[_0x7283('0x1a')](_0x190faf[_0x7283('0x30')]['offset']);}return _0x3e7d91[_0x7283('0x57')](_0x1cf099);}})[_0x7283('0x22')](function(_0x53d656){if(_0x53d656){return _0x53d656?{'count':_0x4ec5b6,'rows':_0x53d656}:null;}})[_0x7283('0x22')](respondWithResult(_0x2a3cba,null))['catch'](handleError(_0x2a3cba,null));};exports[_0x7283('0x58')]=function(_0x1fb056,_0x327c7f,_0x1ff404){var _0x306d8b={};var _0x4f78f5={};var _0x4c8eaf;var _0x2b114d;return db[_0x7283('0x2c')]['findOne']({'where':{'id':_0x1fb056[_0x7283('0x45')]['id']}})[_0x7283('0x22')](handleEntityNotFound(_0x327c7f,null))[_0x7283('0x22')](function(_0x3642eb){if(_0x3642eb){_0x4c8eaf=_0x3642eb;_0x4f78f5[_0x7283('0x2f')]=_[_0x7283('0x31')](db[_0x7283('0x56')][_0x7283('0x2d')]);_0x4f78f5[_0x7283('0x30')]=_[_0x7283('0x31')](_0x1fb056[_0x7283('0x30')]);_0x4f78f5[_0x7283('0x32')]=_['intersection'](_0x4f78f5[_0x7283('0x2f')],_0x4f78f5[_0x7283('0x30')]);_0x306d8b[_0x7283('0x34')]=_['intersection'](_0x4f78f5['model'],qs['fields'](_0x1fb056[_0x7283('0x30')]['fields']));_0x306d8b[_0x7283('0x34')]=_0x306d8b['attributes'][_0x7283('0x36')]?_0x306d8b[_0x7283('0x34')]:_0x4f78f5['model'];_0x306d8b['order']=qs[_0x7283('0x3a')](_0x1fb056['query']['sort']);_0x306d8b[_0x7283('0x3b')]=qs[_0x7283('0x32')](_[_0x7283('0x3c')](_0x1fb056['query'],_0x4f78f5[_0x7283('0x32')]));if(_0x1fb056[_0x7283('0x30')]['filter']){_0x306d8b[_0x7283('0x3b')]=_[_0x7283('0x3f')](_0x306d8b[_0x7283('0x3b')],{'$or':_[_0x7283('0x2b')](_0x306d8b[_0x7283('0x34')],function(_0x5b7406){var _0x5d6eaf={};_0x5d6eaf[_0x5b7406]={'$like':'%'+_0x1fb056[_0x7283('0x30')]['filter']+'%'};return _0x5d6eaf;})});}_0x306d8b=_['merge']({},_0x306d8b,_0x1fb056[_0x7283('0x47')]);return _0x4c8eaf['getAnyConditions'](_0x306d8b);}})[_0x7283('0x22')](function(_0x492d0e){if(_0x492d0e){_0x2b114d=_0x492d0e[_0x7283('0x36')];if(!_0x1fb056['query']['hasOwnProperty']('nolimit')){_0x306d8b['limit']=qs['limit'](_0x1fb056['query'][_0x7283('0x1b')]);_0x306d8b[_0x7283('0x1a')]=qs[_0x7283('0x1a')](_0x1fb056[_0x7283('0x30')][_0x7283('0x1a')]);}return _0x4c8eaf[_0x7283('0x58')](_0x306d8b);}})[_0x7283('0x22')](function(_0x24b507){if(_0x24b507){return _0x24b507?{'count':_0x2b114d,'rows':_0x24b507}:null;}})[_0x7283('0x22')](respondWithResult(_0x327c7f,null))[_0x7283('0x48')](handleError(_0x327c7f,null));};exports['addAction']=function(_0x440aaa,_0x232543,_0x36bfac){if(_0x440aaa[_0x7283('0x4f')]['id']){delete _0x440aaa['body']['id'];}return db[_0x7283('0x2c')]['find']({'where':{'id':_0x440aaa[_0x7283('0x45')]['id']}})[_0x7283('0x22')](handleEntityNotFound(_0x232543,null))['then'](function(_0xad61e5){if(_0xad61e5){_0x440aaa[_0x7283('0x4f')]['TriggerId']=_0xad61e5['id'];return db['Action'][_0x7283('0x49')](_0x440aaa[_0x7283('0x4f')]);}})['then'](respondWithResult(_0x232543,null))[_0x7283('0x48')](handleError(_0x232543,null));};exports[_0x7283('0x59')]=function(_0x488bca,_0x268fac,_0x31de1f){var _0x4ec274={};var _0x392bf1={};var _0x5d73bc;var _0x2eb170;return db[_0x7283('0x2c')][_0x7283('0x55')]({'where':{'id':_0x488bca[_0x7283('0x45')]['id']}})[_0x7283('0x22')](handleEntityNotFound(_0x268fac,null))[_0x7283('0x22')](function(_0x5a7c20){if(_0x5a7c20){_0x5d73bc=_0x5a7c20;_0x392bf1[_0x7283('0x2f')]=_[_0x7283('0x31')](db['Action'][_0x7283('0x2d')]);_0x392bf1[_0x7283('0x30')]=_['keys'](_0x488bca[_0x7283('0x30')]);_0x392bf1['filters']=_[_0x7283('0x33')](_0x392bf1[_0x7283('0x2f')],_0x392bf1[_0x7283('0x30')]);_0x4ec274['attributes']=_[_0x7283('0x33')](_0x392bf1['model'],qs[_0x7283('0x35')](_0x488bca['query'][_0x7283('0x35')]));_0x4ec274[_0x7283('0x34')]=_0x4ec274[_0x7283('0x34')][_0x7283('0x36')]?_0x4ec274[_0x7283('0x34')]:_0x392bf1['model'];_0x4ec274[_0x7283('0x39')]=qs[_0x7283('0x3a')](_0x488bca[_0x7283('0x30')][_0x7283('0x3a')]);_0x4ec274[_0x7283('0x3b')]=qs['filters'](_[_0x7283('0x3c')](_0x488bca[_0x7283('0x30')],_0x392bf1[_0x7283('0x32')]));if(_0x488bca[_0x7283('0x30')][_0x7283('0x3d')]){_0x4ec274[_0x7283('0x3b')]=_[_0x7283('0x3f')](_0x4ec274[_0x7283('0x3b')],{'$or':_[_0x7283('0x2b')](_0x4ec274['attributes'],function(_0x1466f6){var _0x438c35={};_0x438c35[_0x1466f6]={'$like':'%'+_0x488bca[_0x7283('0x30')][_0x7283('0x3d')]+'%'};return _0x438c35;})});}_0x4ec274=_[_0x7283('0x3f')]({},_0x4ec274,_0x488bca[_0x7283('0x47')]);return _0x5d73bc['getActions'](_0x4ec274);}})['then'](function(_0x2cc9e4){if(_0x2cc9e4){_0x2eb170=_0x2cc9e4[_0x7283('0x36')];if(!_0x488bca[_0x7283('0x30')][_0x7283('0x37')](_0x7283('0x38'))){_0x4ec274[_0x7283('0x1b')]=qs[_0x7283('0x1b')](_0x488bca[_0x7283('0x30')][_0x7283('0x1b')]);_0x4ec274[_0x7283('0x1a')]=qs[_0x7283('0x1a')](_0x488bca[_0x7283('0x30')][_0x7283('0x1a')]);}return _0x5d73bc[_0x7283('0x59')](_0x4ec274);}})['then'](function(_0x19f7b6){if(_0x19f7b6){return _0x19f7b6?{'count':_0x2eb170,'rows':_0x19f7b6}:null;}})[_0x7283('0x22')](respondWithResult(_0x268fac,null))[_0x7283('0x48')](handleError(_0x268fac,null));}; \ No newline at end of file +var _0x8a97=['then','includeAll','include','findAll','show','params','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','Content-Range','reject','update','destroy','get','Triggers','UserProfileResource','error','stack','name','send','Trigger','rawAttributes','fieldName','map','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options'];(function(_0x54c42d,_0x23975d){var _0x16d161=function(_0x2a9a68){while(--_0x2a9a68){_0x54c42d['push'](_0x54c42d['shift']());}};_0x16d161(++_0x23975d);}(_0x8a97,0x134));var _0x78a9=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x8a97[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x78a9('0x0'));var rimraf=require(_0x78a9('0x1'));var zipdir=require(_0x78a9('0x2'));var jsonpatch=require(_0x78a9('0x3'));var rp=require(_0x78a9('0x4'));var moment=require(_0x78a9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x78a9('0x6'));var util=require('util');var path=require(_0x78a9('0x7'));var sox=require(_0x78a9('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x78a9('0x9'));var _=require('lodash');var squel=require(_0x78a9('0xa'));var crypto=require(_0x78a9('0xb'));var jsforce=require(_0x78a9('0xc'));var deskjs=require(_0x78a9('0xd'));var toCsv=require(_0x78a9('0xe'));var querystring=require(_0x78a9('0xf'));var Papa=require(_0x78a9('0x10'));var Redis=require(_0x78a9('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x78a9('0x12'));var as=require(_0x78a9('0x13'));var hardwareService=require(_0x78a9('0x14'));var logger=require('../../config/logger')(_0x78a9('0x15'));var utils=require(_0x78a9('0x16'));var config=require(_0x78a9('0x17'));var licenseUtil=require(_0x78a9('0x18'));var db=require(_0x78a9('0x19'))['db'];function respondWithStatusCode(_0x10930f,_0x46070c){_0x46070c=_0x46070c||0xcc;return function(_0x55ec63){if(_0x55ec63){return _0x10930f[_0x78a9('0x1a')](_0x46070c);}return _0x10930f['status'](_0x46070c)[_0x78a9('0x1b')]();};}function respondWithResult(_0x13bc26,_0x1178a6){_0x1178a6=_0x1178a6||0xc8;return function(_0x34bae2){if(_0x34bae2){return _0x13bc26['status'](_0x1178a6)[_0x78a9('0x1c')](_0x34bae2);}};}function respondWithFilteredResult(_0x34573a,_0x205c7b){return function(_0x3bcfd3){if(_0x3bcfd3){var _0x325db7=typeof _0x205c7b['offset']===_0x78a9('0x1d')&&typeof _0x205c7b[_0x78a9('0x1e')]===_0x78a9('0x1d');var _0x1d476d=_0x3bcfd3[_0x78a9('0x1f')];var _0x3c2523=_0x325db7?0x0:_0x205c7b[_0x78a9('0x20')];var _0x154fa2=_0x325db7?_0x3bcfd3['count']:_0x205c7b[_0x78a9('0x20')]+_0x205c7b['limit'];var _0x348f2c;if(_0x154fa2>=_0x1d476d){_0x154fa2=_0x1d476d;_0x348f2c=0xc8;}else{_0x348f2c=0xce;}_0x34573a[_0x78a9('0x21')](_0x348f2c);return _0x34573a['set'](_0x78a9('0x22'),_0x3c2523+'-'+_0x154fa2+'/'+_0x1d476d)[_0x78a9('0x1c')](_0x3bcfd3);}return null;};}function patchUpdates(_0x32fee5){return function(_0x32ff27){try{jsonpatch['apply'](_0x32ff27,_0x32fee5,!![]);}catch(_0x30c7c7){return BPromise[_0x78a9('0x23')](_0x30c7c7);}return _0x32ff27['save']();};}function saveUpdates(_0x510c5c,_0x4e3e12){return function(_0x397d08){if(_0x397d08){return _0x397d08[_0x78a9('0x24')](_0x510c5c)['then'](function(_0x29b48e){return _0x29b48e;});}return null;};}function removeEntity(_0x5362d0,_0x240364){return function(_0x458321){if(_0x458321){return _0x458321[_0x78a9('0x25')]()['then'](function(){var _0x3ec99d=_0x458321[_0x78a9('0x26')]({'plain':!![]});var _0x4ffda2=_0x78a9('0x27');return db[_0x78a9('0x28')][_0x78a9('0x25')]({'where':{'type':_0x4ffda2,'resourceId':_0x3ec99d['id']}})['then'](function(){return _0x458321;});})['then'](function(){_0x5362d0[_0x78a9('0x21')](0xcc)[_0x78a9('0x1b')]();});}};}function handleEntityNotFound(_0x2a6ea6,_0x480e23){return function(_0x28abc1){if(!_0x28abc1){_0x2a6ea6[_0x78a9('0x1a')](0x194);}return _0x28abc1;};}function handleError(_0x1cc2c1,_0x764a49){_0x764a49=_0x764a49||0x1f4;return function(_0x5c1080){logger[_0x78a9('0x29')](_0x5c1080[_0x78a9('0x2a')]);if(_0x5c1080[_0x78a9('0x2b')]){delete _0x5c1080[_0x78a9('0x2b')];}_0x1cc2c1[_0x78a9('0x21')](_0x764a49)[_0x78a9('0x2c')](_0x5c1080);};}exports['index']=function(_0x20b733,_0x34c3a9){var _0x32de88={},_0x1b920a={},_0x1a2bc0={'count':0x0,'rows':[]};var _0x1a86c2=_['map'](db[_0x78a9('0x2d')][_0x78a9('0x2e')],function(_0x49cf5d){return{'name':_0x49cf5d[_0x78a9('0x2f')],'type':_0x49cf5d['type']['key']};});_0x1b920a['model']=_[_0x78a9('0x30')](_0x1a86c2,_0x78a9('0x2b'));_0x1b920a[_0x78a9('0x31')]=_[_0x78a9('0x32')](_0x20b733['query']);_0x1b920a[_0x78a9('0x33')]=_['intersection'](_0x1b920a[_0x78a9('0x34')],_0x1b920a[_0x78a9('0x31')]);_0x32de88['attributes']=_[_0x78a9('0x35')](_0x1b920a['model'],qs[_0x78a9('0x36')](_0x20b733[_0x78a9('0x31')][_0x78a9('0x36')]));_0x32de88[_0x78a9('0x37')]=_0x32de88[_0x78a9('0x37')][_0x78a9('0x38')]?_0x32de88[_0x78a9('0x37')]:_0x1b920a[_0x78a9('0x34')];if(!_0x20b733[_0x78a9('0x31')][_0x78a9('0x39')](_0x78a9('0x3a'))){_0x32de88[_0x78a9('0x1e')]=qs[_0x78a9('0x1e')](_0x20b733[_0x78a9('0x31')]['limit']);_0x32de88[_0x78a9('0x20')]=qs[_0x78a9('0x20')](_0x20b733[_0x78a9('0x31')][_0x78a9('0x20')]);}_0x32de88[_0x78a9('0x3b')]=qs['sort'](_0x20b733['query'][_0x78a9('0x3c')]);_0x32de88[_0x78a9('0x3d')]=qs[_0x78a9('0x33')](_[_0x78a9('0x3e')](_0x20b733[_0x78a9('0x31')],_0x1b920a[_0x78a9('0x33')]),_0x1a86c2);if(_0x20b733[_0x78a9('0x31')][_0x78a9('0x3f')]){_0x32de88[_0x78a9('0x3d')]=_[_0x78a9('0x40')](_0x32de88[_0x78a9('0x3d')],{'$or':_['map'](_0x1a86c2,function(_0xaf116b){if(_0xaf116b[_0x78a9('0x41')]!==_0x78a9('0x42')){var _0x4feef5={};_0x4feef5[_0xaf116b['name']]={'$like':'%'+_0x20b733[_0x78a9('0x31')][_0x78a9('0x3f')]+'%'};return _0x4feef5;}})});}_0x32de88=_['merge']({},_0x32de88,_0x20b733[_0x78a9('0x43')]);var _0x5a6a47={'where':_0x32de88[_0x78a9('0x3d')]};return db[_0x78a9('0x2d')][_0x78a9('0x1f')](_0x5a6a47)[_0x78a9('0x44')](function(_0xdc4e53){_0x1a2bc0[_0x78a9('0x1f')]=_0xdc4e53;if(_0x20b733[_0x78a9('0x31')][_0x78a9('0x45')]){_0x32de88[_0x78a9('0x46')]=[{'all':!![]}];}return db[_0x78a9('0x2d')][_0x78a9('0x47')](_0x32de88);})[_0x78a9('0x44')](function(_0x47fca3){_0x1a2bc0['rows']=_0x47fca3;return _0x1a2bc0;})['then'](respondWithFilteredResult(_0x34c3a9,_0x32de88))['catch'](handleError(_0x34c3a9,null));};exports[_0x78a9('0x48')]=function(_0x486dce,_0x19ab98){var _0x251f69={'raw':![],'where':{'id':_0x486dce[_0x78a9('0x49')]['id']}},_0x4a2634={};_0x4a2634[_0x78a9('0x34')]=_[_0x78a9('0x32')](db['Trigger'][_0x78a9('0x2e')]);_0x4a2634['query']=_[_0x78a9('0x32')](_0x486dce[_0x78a9('0x31')]);_0x4a2634[_0x78a9('0x33')]=_[_0x78a9('0x35')](_0x4a2634['model'],_0x4a2634[_0x78a9('0x31')]);_0x251f69['attributes']=_[_0x78a9('0x35')](_0x4a2634['model'],qs[_0x78a9('0x36')](_0x486dce[_0x78a9('0x31')]['fields']));_0x251f69[_0x78a9('0x37')]=_0x251f69[_0x78a9('0x37')][_0x78a9('0x38')]?_0x251f69[_0x78a9('0x37')]:_0x4a2634[_0x78a9('0x34')];if(_0x486dce[_0x78a9('0x31')][_0x78a9('0x45')]){_0x251f69[_0x78a9('0x46')]=[{'all':!![]}];}_0x251f69=_[_0x78a9('0x40')]({},_0x251f69,_0x486dce['options']);return db[_0x78a9('0x2d')]['find'](_0x251f69)[_0x78a9('0x44')](handleEntityNotFound(_0x19ab98,null))['then'](respondWithResult(_0x19ab98,null))[_0x78a9('0x4a')](handleError(_0x19ab98,null));};exports[_0x78a9('0x4b')]=function(_0x29600f,_0x211211){return db['Trigger'][_0x78a9('0x4b')](_0x29600f[_0x78a9('0x4c')],{})[_0x78a9('0x44')](function(_0x4a712c){var _0x32b70a=_0x29600f[_0x78a9('0x4d')][_0x78a9('0x26')]({'plain':!![]});if(!_0x32b70a)throw new Error(_0x78a9('0x4e'));if(_0x32b70a[_0x78a9('0x4f')]==='user'){var _0x429b78=_0x4a712c[_0x78a9('0x26')]({'plain':!![]});var _0x4b9bae=_0x78a9('0x27');return db['UserProfileSection'][_0x78a9('0x50')]({'where':{'name':_0x4b9bae,'userProfileId':_0x32b70a['userProfileId']},'raw':!![]})[_0x78a9('0x44')](function(_0x3dc228){if(_0x3dc228&&_0x3dc228[_0x78a9('0x51')]===0x0){return db[_0x78a9('0x28')][_0x78a9('0x4b')]({'name':_0x429b78['name'],'resourceId':_0x429b78['id'],'type':_0x3dc228[_0x78a9('0x2b')],'sectionId':_0x3dc228['id']},{})[_0x78a9('0x44')](function(){return _0x4a712c;});}else{return _0x4a712c;}})[_0x78a9('0x4a')](function(_0x22916b){logger[_0x78a9('0x29')](_0x78a9('0x52'),_0x22916b);throw _0x22916b;});}return _0x4a712c;})['then'](respondWithResult(_0x211211,0xc9))['catch'](handleError(_0x211211,null));};exports[_0x78a9('0x24')]=function(_0x1343df,_0x1562b8){if(_0x1343df['body']['id']){delete _0x1343df[_0x78a9('0x4c')]['id'];}return db[_0x78a9('0x2d')][_0x78a9('0x50')]({'where':{'id':_0x1343df['params']['id']}})['then'](handleEntityNotFound(_0x1562b8,null))[_0x78a9('0x44')](saveUpdates(_0x1343df[_0x78a9('0x4c')],null))[_0x78a9('0x44')](respondWithResult(_0x1562b8,null))[_0x78a9('0x4a')](handleError(_0x1562b8,null));};exports[_0x78a9('0x25')]=function(_0x3f72ad,_0x324e22){return db[_0x78a9('0x2d')][_0x78a9('0x50')]({'where':{'id':_0x3f72ad[_0x78a9('0x49')]['id']}})[_0x78a9('0x44')](handleEntityNotFound(_0x324e22,null))[_0x78a9('0x44')](removeEntity(_0x324e22,null))[_0x78a9('0x4a')](handleError(_0x324e22,null));};exports[_0x78a9('0x53')]=function(_0x4a6007,_0x4b9db8,_0x57cbd6){if(_0x4a6007['body']['id']){delete _0x4a6007[_0x78a9('0x4c')]['id'];}return db[_0x78a9('0x2d')]['find']({'where':{'id':_0x4a6007[_0x78a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x4b9db8,null))[_0x78a9('0x44')](function(_0x21bdcd){if(_0x21bdcd){_0x4a6007['body'][_0x78a9('0x54')]=_0x21bdcd['id'];return db[_0x78a9('0x55')][_0x78a9('0x4b')](_0x4a6007[_0x78a9('0x4c')]);}})[_0x78a9('0x44')](respondWithResult(_0x4b9db8,null))['catch'](handleError(_0x4b9db8,null));};exports[_0x78a9('0x56')]=function(_0x1aed08,_0x520a47,_0x4c17e7){if(_0x1aed08[_0x78a9('0x4c')]['id']){delete _0x1aed08['body']['id'];}return db[_0x78a9('0x2d')]['find']({'where':{'id':_0x1aed08[_0x78a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x520a47,null))[_0x78a9('0x44')](function(_0x1fdd98){if(_0x1fdd98){_0x1aed08[_0x78a9('0x4c')]['TriggerAnyId']=_0x1fdd98['id'];return db[_0x78a9('0x55')][_0x78a9('0x4b')](_0x1aed08[_0x78a9('0x4c')]);}})[_0x78a9('0x44')](respondWithResult(_0x520a47,null))['catch'](handleError(_0x520a47,null));};exports[_0x78a9('0x57')]=function(_0x9a65a0,_0x39221b,_0x7b61f9){var _0x5be95c={};var _0x17c5b5={};var _0x3937f5;var _0x4127f3;return db[_0x78a9('0x2d')][_0x78a9('0x58')]({'where':{'id':_0x9a65a0[_0x78a9('0x49')]['id']}})[_0x78a9('0x44')](handleEntityNotFound(_0x39221b,null))[_0x78a9('0x44')](function(_0x22f3c8){if(_0x22f3c8){_0x3937f5=_0x22f3c8;_0x17c5b5[_0x78a9('0x34')]=_[_0x78a9('0x32')](db[_0x78a9('0x55')][_0x78a9('0x2e')]);_0x17c5b5[_0x78a9('0x31')]=_['keys'](_0x9a65a0[_0x78a9('0x31')]);_0x17c5b5[_0x78a9('0x33')]=_[_0x78a9('0x35')](_0x17c5b5['model'],_0x17c5b5[_0x78a9('0x31')]);_0x5be95c[_0x78a9('0x37')]=_[_0x78a9('0x35')](_0x17c5b5[_0x78a9('0x34')],qs[_0x78a9('0x36')](_0x9a65a0['query']['fields']));_0x5be95c[_0x78a9('0x37')]=_0x5be95c[_0x78a9('0x37')]['length']?_0x5be95c[_0x78a9('0x37')]:_0x17c5b5[_0x78a9('0x34')];_0x5be95c['order']=qs[_0x78a9('0x3c')](_0x9a65a0[_0x78a9('0x31')][_0x78a9('0x3c')]);_0x5be95c['where']=qs[_0x78a9('0x33')](_['pick'](_0x9a65a0['query'],_0x17c5b5[_0x78a9('0x33')]));if(_0x9a65a0[_0x78a9('0x31')][_0x78a9('0x3f')]){_0x5be95c[_0x78a9('0x3d')]=_[_0x78a9('0x40')](_0x5be95c[_0x78a9('0x3d')],{'$or':_[_0x78a9('0x30')](_0x5be95c[_0x78a9('0x37')],function(_0x486fcc){var _0xde4387={};_0xde4387[_0x486fcc]={'$like':'%'+_0x9a65a0[_0x78a9('0x31')][_0x78a9('0x3f')]+'%'};return _0xde4387;})});}_0x5be95c=_['merge']({},_0x5be95c,_0x9a65a0[_0x78a9('0x43')]);return _0x3937f5['getAllConditions'](_0x5be95c);}})['then'](function(_0x209966){if(_0x209966){_0x4127f3=_0x209966[_0x78a9('0x38')];if(!_0x9a65a0['query'][_0x78a9('0x39')]('nolimit')){_0x5be95c[_0x78a9('0x1e')]=qs[_0x78a9('0x1e')](_0x9a65a0['query'][_0x78a9('0x1e')]);_0x5be95c['offset']=qs[_0x78a9('0x20')](_0x9a65a0['query'][_0x78a9('0x20')]);}return _0x3937f5[_0x78a9('0x57')](_0x5be95c);}})[_0x78a9('0x44')](function(_0x563bd0){if(_0x563bd0){return _0x563bd0?{'count':_0x4127f3,'rows':_0x563bd0}:null;}})[_0x78a9('0x44')](respondWithResult(_0x39221b,null))[_0x78a9('0x4a')](handleError(_0x39221b,null));};exports[_0x78a9('0x59')]=function(_0x2ca7eb,_0x38b6a9,_0x4ef8e0){var _0x576d2d={};var _0x409537={};var _0x388183;var _0x243893;return db[_0x78a9('0x2d')][_0x78a9('0x58')]({'where':{'id':_0x2ca7eb[_0x78a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x38b6a9,null))[_0x78a9('0x44')](function(_0x1d058f){if(_0x1d058f){_0x388183=_0x1d058f;_0x409537[_0x78a9('0x34')]=_[_0x78a9('0x32')](db['Condition']['rawAttributes']);_0x409537[_0x78a9('0x31')]=_['keys'](_0x2ca7eb[_0x78a9('0x31')]);_0x409537[_0x78a9('0x33')]=_[_0x78a9('0x35')](_0x409537[_0x78a9('0x34')],_0x409537[_0x78a9('0x31')]);_0x576d2d['attributes']=_['intersection'](_0x409537[_0x78a9('0x34')],qs[_0x78a9('0x36')](_0x2ca7eb['query'][_0x78a9('0x36')]));_0x576d2d['attributes']=_0x576d2d[_0x78a9('0x37')][_0x78a9('0x38')]?_0x576d2d[_0x78a9('0x37')]:_0x409537[_0x78a9('0x34')];_0x576d2d[_0x78a9('0x3b')]=qs[_0x78a9('0x3c')](_0x2ca7eb[_0x78a9('0x31')]['sort']);_0x576d2d[_0x78a9('0x3d')]=qs['filters'](_[_0x78a9('0x3e')](_0x2ca7eb[_0x78a9('0x31')],_0x409537[_0x78a9('0x33')]));if(_0x2ca7eb['query']['filter']){_0x576d2d[_0x78a9('0x3d')]=_[_0x78a9('0x40')](_0x576d2d[_0x78a9('0x3d')],{'$or':_[_0x78a9('0x30')](_0x576d2d[_0x78a9('0x37')],function(_0x53fbe3){var _0x35b459={};_0x35b459[_0x53fbe3]={'$like':'%'+_0x2ca7eb[_0x78a9('0x31')][_0x78a9('0x3f')]+'%'};return _0x35b459;})});}_0x576d2d=_['merge']({},_0x576d2d,_0x2ca7eb[_0x78a9('0x43')]);return _0x388183['getAnyConditions'](_0x576d2d);}})[_0x78a9('0x44')](function(_0x566ff6){if(_0x566ff6){_0x243893=_0x566ff6[_0x78a9('0x38')];if(!_0x2ca7eb[_0x78a9('0x31')][_0x78a9('0x39')](_0x78a9('0x3a'))){_0x576d2d[_0x78a9('0x1e')]=qs[_0x78a9('0x1e')](_0x2ca7eb[_0x78a9('0x31')][_0x78a9('0x1e')]);_0x576d2d['offset']=qs['offset'](_0x2ca7eb['query']['offset']);}return _0x388183['getAnyConditions'](_0x576d2d);}})['then'](function(_0x1b745a){if(_0x1b745a){return _0x1b745a?{'count':_0x243893,'rows':_0x1b745a}:null;}})[_0x78a9('0x44')](respondWithResult(_0x38b6a9,null))[_0x78a9('0x4a')](handleError(_0x38b6a9,null));};exports[_0x78a9('0x5a')]=function(_0x9b72b8,_0x45ecff,_0x4d7068){if(_0x9b72b8[_0x78a9('0x4c')]['id']){delete _0x9b72b8['body']['id'];}return db[_0x78a9('0x2d')]['find']({'where':{'id':_0x9b72b8[_0x78a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x45ecff,null))[_0x78a9('0x44')](function(_0x24abb0){if(_0x24abb0){_0x9b72b8[_0x78a9('0x4c')][_0x78a9('0x5b')]=_0x24abb0['id'];return db[_0x78a9('0x5c')][_0x78a9('0x4b')](_0x9b72b8[_0x78a9('0x4c')]);}})['then'](respondWithResult(_0x45ecff,null))[_0x78a9('0x4a')](handleError(_0x45ecff,null));};exports['getActions']=function(_0x1a4966,_0xf7d881,_0x4e3453){var _0x5102ab={};var _0x1faa12={};var _0x16769f;var _0x52dad6;return db[_0x78a9('0x2d')][_0x78a9('0x58')]({'where':{'id':_0x1a4966[_0x78a9('0x49')]['id']}})['then'](handleEntityNotFound(_0xf7d881,null))['then'](function(_0x10ef82){if(_0x10ef82){_0x16769f=_0x10ef82;_0x1faa12['model']=_[_0x78a9('0x32')](db[_0x78a9('0x5c')]['rawAttributes']);_0x1faa12[_0x78a9('0x31')]=_[_0x78a9('0x32')](_0x1a4966['query']);_0x1faa12[_0x78a9('0x33')]=_[_0x78a9('0x35')](_0x1faa12['model'],_0x1faa12[_0x78a9('0x31')]);_0x5102ab[_0x78a9('0x37')]=_[_0x78a9('0x35')](_0x1faa12[_0x78a9('0x34')],qs[_0x78a9('0x36')](_0x1a4966['query']['fields']));_0x5102ab[_0x78a9('0x37')]=_0x5102ab[_0x78a9('0x37')][_0x78a9('0x38')]?_0x5102ab[_0x78a9('0x37')]:_0x1faa12[_0x78a9('0x34')];_0x5102ab[_0x78a9('0x3b')]=qs[_0x78a9('0x3c')](_0x1a4966[_0x78a9('0x31')]['sort']);_0x5102ab[_0x78a9('0x3d')]=qs[_0x78a9('0x33')](_['pick'](_0x1a4966[_0x78a9('0x31')],_0x1faa12[_0x78a9('0x33')]));if(_0x1a4966[_0x78a9('0x31')]['filter']){_0x5102ab[_0x78a9('0x3d')]=_['merge'](_0x5102ab[_0x78a9('0x3d')],{'$or':_['map'](_0x5102ab[_0x78a9('0x37')],function(_0x2cf0c8){var _0xfe3637={};_0xfe3637[_0x2cf0c8]={'$like':'%'+_0x1a4966[_0x78a9('0x31')][_0x78a9('0x3f')]+'%'};return _0xfe3637;})});}_0x5102ab=_[_0x78a9('0x40')]({},_0x5102ab,_0x1a4966[_0x78a9('0x43')]);return _0x16769f['getActions'](_0x5102ab);}})[_0x78a9('0x44')](function(_0x3d85f2){if(_0x3d85f2){_0x52dad6=_0x3d85f2[_0x78a9('0x38')];if(!_0x1a4966[_0x78a9('0x31')][_0x78a9('0x39')](_0x78a9('0x3a'))){_0x5102ab[_0x78a9('0x1e')]=qs[_0x78a9('0x1e')](_0x1a4966[_0x78a9('0x31')][_0x78a9('0x1e')]);_0x5102ab[_0x78a9('0x20')]=qs['offset'](_0x1a4966[_0x78a9('0x31')][_0x78a9('0x20')]);}return _0x16769f[_0x78a9('0x5d')](_0x5102ab);}})['then'](function(_0x4cdc3a){if(_0x4cdc3a){return _0x4cdc3a?{'count':_0x52dad6,'rows':_0x4cdc3a}:null;}})[_0x78a9('0x44')](respondWithResult(_0xf7d881,null))[_0x78a9('0x4a')](handleError(_0xf7d881,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index ade82a4..ab16f66 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 _0x6658=['../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x417baa,_0x3923d0){var _0x42724f=function(_0x276146){while(--_0x276146){_0x417baa['push'](_0x417baa['shift']());}};_0x42724f(++_0x3923d0);}(_0x6658,0x198));var _0x8665=function(_0x5cf2ab,_0x4fcdcc){_0x5cf2ab=_0x5cf2ab-0x0;var _0x2270dc=_0x6658[_0x5cf2ab];return _0x2270dc;};'use strict';var _=require(_0x8665('0x0'));var util=require(_0x8665('0x1'));var logger=require(_0x8665('0x2'))(_0x8665('0x3'));var moment=require(_0x8665('0x4'));var BPromise=require(_0x8665('0x5'));var rp=require(_0x8665('0x6'));var fs=require('fs');var path=require(_0x8665('0x7'));var rimraf=require('rimraf');var config=require(_0x8665('0x8'));var attributes=require(_0x8665('0x9'));module['exports']=function(_0x562829,_0x203780){return _0x562829[_0x8665('0xa')](_0x8665('0xb'),attributes,{'tableName':_0x8665('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc0d=['path','rimraf','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','util','api','bluebird','request-promise'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0xdc0d,0x1db));var _0xddc0=function(_0x38bdf7,_0x5de981){_0x38bdf7=_0x38bdf7-0x0;var _0x1400e4=_0xdc0d[_0x38bdf7];return _0x1400e4;};'use strict';var _=require(_0xddc0('0x0'));var util=require(_0xddc0('0x1'));var logger=require('../../config/logger')(_0xddc0('0x2'));var moment=require('moment');var BPromise=require(_0xddc0('0x3'));var rp=require(_0xddc0('0x4'));var fs=require('fs');var path=require(_0xddc0('0x5'));var rimraf=require(_0xddc0('0x6'));var config=require(_0xddc0('0x7'));var attributes=require(_0xddc0('0x8'));module[_0xddc0('0x9')]=function(_0x39a8da,_0x20f5a9){return _0x39a8da['define'](_0xddc0('0xa'),attributes,{'tableName':_0xddc0('0xb'),'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 11dc300..13672e3 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 _0x9571=['Trigger','options','raw','where','attributes','limit','map','include','model','ShowTrigger','find','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','Trigger,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Trigger,\x20%s,\x20%s','message','catch','GetTrigger'];(function(_0x3eb2bb,_0x84b81d){var _0x4e38d6=function(_0x7a21b1){while(--_0x7a21b1){_0x3eb2bb['push'](_0x3eb2bb['shift']());}};_0x4e38d6(++_0x84b81d);}(_0x9571,0x11b));var _0x1957=function(_0x34a6e9,_0x25cabe){_0x34a6e9=_0x34a6e9-0x0;var _0x11015c=_0x9571[_0x34a6e9];return _0x11015c;};'use strict';var _=require('lodash');var util=require(_0x1957('0x0'));var moment=require(_0x1957('0x1'));var BPromise=require(_0x1957('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1957('0x3'));var db=require(_0x1957('0x4'))['db'];var utils=require(_0x1957('0x5'));var logger=require(_0x1957('0x6'))(_0x1957('0x7'));var config=require(_0x1957('0x8'));var jayson=require(_0x1957('0x9'));var client=jayson['client'][_0x1957('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1b7f83,_0x38ae1d,_0x53305b){return new BPromise(function(_0x1e9b78,_0x5c5297){return client['request'](_0x1b7f83,_0x53305b)[_0x1957('0xb')](function(_0x245a65){logger[_0x1957('0xc')]('Trigger,\x20%s,\x20%s',_0x38ae1d,'request\x20sent');logger[_0x1957('0xd')](_0x1957('0xe'),_0x38ae1d,_0x1957('0xf'),JSON[_0x1957('0x10')](_0x245a65));if(_0x245a65[_0x1957('0x11')]){if(_0x245a65[_0x1957('0x11')][_0x1957('0x12')]===0x1f4){logger['error'](_0x1957('0x13'),_0x38ae1d,_0x245a65[_0x1957('0x11')]['message']);return _0x5c5297(_0x245a65[_0x1957('0x11')][_0x1957('0x14')]);}logger[_0x1957('0x11')](_0x1957('0x13'),_0x38ae1d,_0x245a65[_0x1957('0x11')][_0x1957('0x14')]);return _0x1e9b78(_0x245a65[_0x1957('0x11')]['message']);}else{logger[_0x1957('0xc')]('Trigger,\x20%s,\x20%s',_0x38ae1d,_0x1957('0xf'));_0x1e9b78(_0x245a65['result'][_0x1957('0x14')]);}})[_0x1957('0x15')](function(_0x1d04fa){logger['error'](_0x1957('0x13'),_0x38ae1d,_0x1d04fa);_0x5c5297(_0x1d04fa);});});}exports[_0x1957('0x16')]=function(_0x2929ba){var _0x242474=this;return new Promise(function(_0xcfb9cc,_0x22cf26){return db[_0x1957('0x17')]['findAll']({'raw':_0x2929ba[_0x1957('0x18')]?_0x2929ba['options'][_0x1957('0x19')]===undefined?!![]:![]:!![],'where':_0x2929ba[_0x1957('0x18')]?_0x2929ba[_0x1957('0x18')][_0x1957('0x1a')]||null:null,'attributes':_0x2929ba[_0x1957('0x18')]?_0x2929ba[_0x1957('0x18')][_0x1957('0x1b')]||null:null,'limit':_0x2929ba[_0x1957('0x18')]?_0x2929ba['options'][_0x1957('0x1c')]||null:null,'include':_0x2929ba[_0x1957('0x18')]?_0x2929ba[_0x1957('0x18')]['include']?_[_0x1957('0x1d')](_0x2929ba[_0x1957('0x18')][_0x1957('0x1e')],function(_0x102887){return{'model':db[_0x102887[_0x1957('0x1f')]],'as':_0x102887['as'],'attributes':_0x102887[_0x1957('0x1b')],'include':_0x102887[_0x1957('0x1e')]?_[_0x1957('0x1d')](_0x102887[_0x1957('0x1e')],function(_0x1a1c13){return{'model':db[_0x1a1c13[_0x1957('0x1f')]],'as':_0x1a1c13['as'],'attributes':_0x1a1c13['attributes'],'include':_0x1a1c13[_0x1957('0x1e')]?_[_0x1957('0x1d')](_0x1a1c13[_0x1957('0x1e')],function(_0x26f67b){return{'model':db[_0x26f67b['model']],'as':_0x26f67b['as'],'attributes':_0x26f67b[_0x1957('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xb93eba){logger[_0x1957('0xc')](_0x1957('0x16'),_0x2929ba);logger[_0x1957('0xd')](_0x1957('0x16'),_0x2929ba,JSON['stringify'](_0xb93eba));_0xcfb9cc(_0xb93eba);})['catch'](function(_0x3e0d97){logger[_0x1957('0x11')]('GetTrigger',_0x3e0d97[_0x1957('0x14')],_0x2929ba);_0x22cf26(_0x242474[_0x1957('0x11')](0x1f4,_0x3e0d97[_0x1957('0x14')]));});});};exports[_0x1957('0x20')]=function(_0xdd5325){var _0x3ea679=this;return new Promise(function(_0x54ef64,_0x1bade5){return db['Trigger'][_0x1957('0x21')]({'raw':_0xdd5325[_0x1957('0x18')]?_0xdd5325[_0x1957('0x18')][_0x1957('0x19')]===undefined?!![]:![]:!![],'where':_0xdd5325[_0x1957('0x18')]?_0xdd5325[_0x1957('0x18')][_0x1957('0x1a')]||null:null,'attributes':_0xdd5325[_0x1957('0x18')]?_0xdd5325[_0x1957('0x18')][_0x1957('0x1b')]||null:null,'include':_0xdd5325[_0x1957('0x18')]?_0xdd5325[_0x1957('0x18')][_0x1957('0x1e')]?_[_0x1957('0x1d')](_0xdd5325[_0x1957('0x18')]['include'],function(_0x85e7dd){return{'model':db[_0x85e7dd[_0x1957('0x1f')]],'as':_0x85e7dd['as'],'attributes':_0x85e7dd['attributes'],'include':_0x85e7dd['include']?_[_0x1957('0x1d')](_0x85e7dd[_0x1957('0x1e')],function(_0x35d4ad){return{'model':db[_0x35d4ad[_0x1957('0x1f')]],'as':_0x35d4ad['as'],'attributes':_0x35d4ad[_0x1957('0x1b')],'include':_0x35d4ad[_0x1957('0x1e')]?_['map'](_0x35d4ad['include'],function(_0x44c23b){return{'model':db[_0x44c23b[_0x1957('0x1f')]],'as':_0x44c23b['as'],'attributes':_0x44c23b[_0x1957('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x1957('0xb')](function(_0x3e690c){logger['info'](_0x1957('0x20'),_0xdd5325);logger[_0x1957('0xd')]('ShowTrigger',_0xdd5325,JSON['stringify'](_0x3e690c));_0x54ef64(_0x3e690c);})[_0x1957('0x15')](function(_0x595933){logger[_0x1957('0x11')](_0x1957('0x20'),_0x595933[_0x1957('0x14')],_0xdd5325);_0x1bade5(_0x3ea679[_0x1957('0x11')](0x1f4,_0x595933[_0x1957('0x14')]));});});}; \ No newline at end of file +var _0x23d8=['code','message','result','catch','GetTrigger','Trigger','options','where','attributes','include','map','model','find','raw','debug','ShowTrigger','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x96c9a2,_0x1e99f4){var _0x472e6e=function(_0x8f3a28){while(--_0x8f3a28){_0x96c9a2['push'](_0x96c9a2['shift']());}};_0x472e6e(++_0x1e99f4);}(_0x23d8,0x1b4));var _0x823d=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x23d8[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x823d('0x0'));var moment=require(_0x823d('0x1'));var BPromise=require(_0x823d('0x2'));var rs=require(_0x823d('0x3'));var fs=require('fs');var Redis=require(_0x823d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x823d('0x5'));var logger=require(_0x823d('0x6'))(_0x823d('0x7'));var config=require(_0x823d('0x8'));var jayson=require(_0x823d('0x9'));var client=jayson[_0x823d('0xa')][_0x823d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2ca2b8,_0x549764,_0x3d498f){return new BPromise(function(_0x1b0ed9,_0x36d481){return client[_0x823d('0xc')](_0x2ca2b8,_0x3d498f)[_0x823d('0xd')](function(_0x871fb5){logger[_0x823d('0xe')](_0x823d('0xf'),_0x549764,_0x823d('0x10'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x549764,_0x823d('0x10'),JSON[_0x823d('0x11')](_0x871fb5));if(_0x871fb5[_0x823d('0x12')]){if(_0x871fb5[_0x823d('0x12')][_0x823d('0x13')]===0x1f4){logger['error'](_0x823d('0xf'),_0x549764,_0x871fb5[_0x823d('0x12')][_0x823d('0x14')]);return _0x36d481(_0x871fb5[_0x823d('0x12')][_0x823d('0x14')]);}logger['error'](_0x823d('0xf'),_0x549764,_0x871fb5[_0x823d('0x12')]['message']);return _0x1b0ed9(_0x871fb5[_0x823d('0x12')][_0x823d('0x14')]);}else{logger[_0x823d('0xe')](_0x823d('0xf'),_0x549764,_0x823d('0x10'));_0x1b0ed9(_0x871fb5[_0x823d('0x15')][_0x823d('0x14')]);}})[_0x823d('0x16')](function(_0x49107b){logger[_0x823d('0x12')]('Trigger,\x20%s,\x20%s',_0x549764,_0x49107b);_0x36d481(_0x49107b);});});}exports[_0x823d('0x17')]=function(_0x34d915){var _0x15bbfd=this;return new Promise(function(_0x2fa12c,_0x5a8920){return db[_0x823d('0x18')]['findAll']({'raw':_0x34d915[_0x823d('0x19')]?_0x34d915[_0x823d('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x34d915[_0x823d('0x19')]?_0x34d915['options'][_0x823d('0x1a')]||null:null,'attributes':_0x34d915['options']?_0x34d915[_0x823d('0x19')][_0x823d('0x1b')]||null:null,'limit':_0x34d915[_0x823d('0x19')]?_0x34d915[_0x823d('0x19')]['limit']||null:null,'include':_0x34d915[_0x823d('0x19')]?_0x34d915[_0x823d('0x19')][_0x823d('0x1c')]?_[_0x823d('0x1d')](_0x34d915['options'][_0x823d('0x1c')],function(_0xc24c94){return{'model':db[_0xc24c94[_0x823d('0x1e')]],'as':_0xc24c94['as'],'attributes':_0xc24c94[_0x823d('0x1b')],'include':_0xc24c94[_0x823d('0x1c')]?_[_0x823d('0x1d')](_0xc24c94[_0x823d('0x1c')],function(_0x454ace){return{'model':db[_0x454ace['model']],'as':_0x454ace['as'],'attributes':_0x454ace[_0x823d('0x1b')],'include':_0x454ace[_0x823d('0x1c')]?_[_0x823d('0x1d')](_0x454ace[_0x823d('0x1c')],function(_0x5994e0){return{'model':db[_0x5994e0['model']],'as':_0x5994e0['as'],'attributes':_0x5994e0[_0x823d('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x93aba0){logger[_0x823d('0xe')](_0x823d('0x17'),_0x34d915);logger['debug']('GetTrigger',_0x34d915,JSON[_0x823d('0x11')](_0x93aba0));_0x2fa12c(_0x93aba0);})[_0x823d('0x16')](function(_0x4b98f0){logger[_0x823d('0x12')](_0x823d('0x17'),_0x4b98f0[_0x823d('0x14')],_0x34d915);_0x5a8920(_0x15bbfd['error'](0x1f4,_0x4b98f0['message']));});});};exports['ShowTrigger']=function(_0xab9fae){var _0x511340=this;return new Promise(function(_0x777b2a,_0x56808e){return db[_0x823d('0x18')][_0x823d('0x1f')]({'raw':_0xab9fae[_0x823d('0x19')]?_0xab9fae[_0x823d('0x19')][_0x823d('0x20')]===undefined?!![]:![]:!![],'where':_0xab9fae[_0x823d('0x19')]?_0xab9fae[_0x823d('0x19')]['where']||null:null,'attributes':_0xab9fae['options']?_0xab9fae[_0x823d('0x19')][_0x823d('0x1b')]||null:null,'include':_0xab9fae[_0x823d('0x19')]?_0xab9fae['options'][_0x823d('0x1c')]?_[_0x823d('0x1d')](_0xab9fae[_0x823d('0x19')][_0x823d('0x1c')],function(_0x545ad9){return{'model':db[_0x545ad9[_0x823d('0x1e')]],'as':_0x545ad9['as'],'attributes':_0x545ad9[_0x823d('0x1b')],'include':_0x545ad9['include']?_[_0x823d('0x1d')](_0x545ad9[_0x823d('0x1c')],function(_0xfb7fe0){return{'model':db[_0xfb7fe0[_0x823d('0x1e')]],'as':_0xfb7fe0['as'],'attributes':_0xfb7fe0[_0x823d('0x1b')],'include':_0xfb7fe0[_0x823d('0x1c')]?_[_0x823d('0x1d')](_0xfb7fe0[_0x823d('0x1c')],function(_0x134c64){return{'model':db[_0x134c64[_0x823d('0x1e')]],'as':_0x134c64['as'],'attributes':_0x134c64[_0x823d('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x823d('0xd')](function(_0x506626){logger[_0x823d('0xe')]('ShowTrigger',_0xab9fae);logger[_0x823d('0x21')](_0x823d('0x22'),_0xab9fae,JSON[_0x823d('0x11')](_0x506626));_0x777b2a(_0x506626);})['catch'](function(_0x368728){logger['error'](_0x823d('0x22'),_0x368728[_0x823d('0x14')],_0xab9fae);_0x56808e(_0x511340[_0x823d('0x12')](0x1f4,_0x368728[_0x823d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 22b0c7a..20cd908 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 _0x586c=['fs-extra','../../components/interaction/service','./trunk.controller','get','isAuthenticated','index','/:id','show','post','/:id/clone','clone','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x8fca8e,_0x3bb629){var _0xab1e60=function(_0x27d939){while(--_0x27d939){_0x8fca8e['push'](_0x8fca8e['shift']());}};_0xab1e60(++_0x3bb629);}(_0x586c,0x125));var _0xc586=function(_0x2e6c19,_0x131233){_0x2e6c19=_0x2e6c19-0x0;var _0x52885d=_0x586c[_0x2e6c19];return _0x52885d;};'use strict';var multer=require(_0xc586('0x0'));var util=require(_0xc586('0x1'));var path=require(_0xc586('0x2'));var timeout=require(_0xc586('0x3'));var express=require(_0xc586('0x4'));var router=express[_0xc586('0x5')]();var fs_extra=require(_0xc586('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc586('0x7'));var config=require('../../config/environment');var controller=require(_0xc586('0x8'));router[_0xc586('0x9')]('/',auth[_0xc586('0xa')](),controller[_0xc586('0xb')]);router[_0xc586('0x9')](_0xc586('0xc'),auth[_0xc586('0xa')](),controller[_0xc586('0xd')]);router[_0xc586('0xe')](_0xc586('0xf'),auth['isAuthenticated'](),controller[_0xc586('0x10')]);router['post']('/',auth[_0xc586('0xa')](),controller[_0xc586('0x11')]);router[_0xc586('0x12')]('/:id',auth[_0xc586('0xa')](),controller[_0xc586('0x13')]);router[_0xc586('0x14')](_0xc586('0xc'),auth[_0xc586('0xa')](),controller[_0xc586('0x15')]);module[_0xc586('0x16')]=router; \ No newline at end of file +var _0x1f38=['express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','/:id/clone','clone','create','put','update','delete','destroy','exports','util','path'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x1f38,0x1a2));var _0x81f3=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0x1f38[_0xd511d];return _0x3f148e;};'use strict';var multer=require('multer');var util=require(_0x81f3('0x0'));var path=require(_0x81f3('0x1'));var timeout=require('connect-timeout');var express=require(_0x81f3('0x2'));var router=express[_0x81f3('0x3')]();var fs_extra=require(_0x81f3('0x4'));var auth=require(_0x81f3('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x81f3('0x6'));var controller=require(_0x81f3('0x7'));router[_0x81f3('0x8')]('/',auth[_0x81f3('0x9')](),controller[_0x81f3('0xa')]);router[_0x81f3('0x8')](_0x81f3('0xb'),auth['isAuthenticated'](),controller[_0x81f3('0xc')]);router['post'](_0x81f3('0xd'),auth[_0x81f3('0x9')](),controller[_0x81f3('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x81f3('0xf')]);router[_0x81f3('0x10')](_0x81f3('0xb'),auth[_0x81f3('0x9')](),controller[_0x81f3('0x11')]);router[_0x81f3('0x12')]('/:id',auth['isAuthenticated'](),controller[_0x81f3('0x13')]);module[_0x81f3('0x14')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index da22369..da4e71e 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 _0xcb97=['BOOLEAN','sequelize','exports','name','ENUM','user','peer','STRING','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_PASSED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','always','accept','refuse','originate','uac','pai','certificate','active','passive','actpass','dynamic','nonat'];(function(_0x87a800,_0x4027a8){var _0x275e7e=function(_0x19ff6e){while(--_0x19ff6e){_0x87a800['push'](_0x87a800['shift']());}};_0x275e7e(++_0x4027a8);}(_0xcb97,0x100));var _0x7cb9=function(_0x5c4f18,_0x3f8b0e){_0x5c4f18=_0x5c4f18-0x0;var _0x2e4032=_0xcb97[_0x5c4f18];return _0x2e4032;};'use strict';var Sequelize=require(_0x7cb9('0x0'));module[_0x7cb9('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x7cb9('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x7cb9('0x3')]('friend',_0x7cb9('0x4'),_0x7cb9('0x5')),'allowNull':![],'defaultValue':'friend'},'context':{'type':Sequelize[_0x7cb9('0x6')],'allowNull':![],'defaultValue':_0x7cb9('0x7')},'callingpres':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x8'),_0x7cb9('0x9'),_0x7cb9('0xa'),_0x7cb9('0xb'),'PROHIB_NOT_SCREENED',_0x7cb9('0xc'),'PROHIB_FAILED_SCREEN',_0x7cb9('0xd'))},'deny':{'type':Sequelize[_0x7cb9('0x6')]},'permit':{'type':Sequelize[_0x7cb9('0x6')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x7cb9('0x6')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize[_0x7cb9('0x6')],'defaultValue':_0x7cb9('0xe'),'set':function(_0x51e7e0){this[_0x7cb9('0xf')](_0x7cb9('0x10'),_0x51e7e0?_0x51e7e0[_0x7cb9('0x11')](','):null);},'get':function(){return this[_0x7cb9('0x12')](_0x7cb9('0x10'))?this[_0x7cb9('0x12')](_0x7cb9('0x10'))[_0x7cb9('0x13')](','):null;},'comment':_0x7cb9('0x14')},'dtmfmode':{'type':Sequelize['ENUM'](_0x7cb9('0x15'),_0x7cb9('0x16'),_0x7cb9('0x17'),'inband',_0x7cb9('0x18')),'defaultValue':_0x7cb9('0x15')},'directmedia':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no','nonat',_0x7cb9('0x1a'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x7cb9('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x7cb9('0x6')]},'directmediadeny':{'type':Sequelize[_0x7cb9('0x6')]},'nat':{'type':Sequelize[_0x7cb9('0x6')],'defaultValue':_0x7cb9('0x1b'),'set':function(_0x4bf24e){this[_0x7cb9('0xf')](_0x7cb9('0x1c'),_0x4bf24e?_0x4bf24e[_0x7cb9('0x11')](','):null);},'get':function(){return this[_0x7cb9('0x12')]('nat')?this[_0x7cb9('0x12')](_0x7cb9('0x1c'))[_0x7cb9('0x13')](','):null;},'comment':_0x7cb9('0x1d')},'callgroup':{'type':Sequelize[_0x7cb9('0x6')]},'namedcallgroup':{'type':Sequelize[_0x7cb9('0x6')]},'pickupgroup':{'type':Sequelize[_0x7cb9('0x6')]},'namedpickupgroup':{'type':Sequelize[_0x7cb9('0x6')]},'language':{'type':Sequelize[_0x7cb9('0x6')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x7cb9('0x6')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x7cb9('0x6')],'defaultValue':_0x7cb9('0x1e')},'allow':{'type':Sequelize[_0x7cb9('0x6')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5253e1){this[_0x7cb9('0xf')]('allow',_0x5253e1?_0x5253e1[_0x7cb9('0x11')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x7cb9('0x12')](_0x7cb9('0x1f'))?this[_0x7cb9('0x12')]('allow')[_0x7cb9('0x13')](';'):null;},'comment':_0x7cb9('0x20')},'autoframing':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'insecure':{'type':Sequelize['STRING'],'defaultValue':_0x7cb9('0x21'),'set':function(_0x359db5){this['setDataValue'](_0x7cb9('0x22'),_0x359db5?_0x359db5[_0x7cb9('0x11')](','):null);},'get':function(){return this['getDataValue']('insecure')?this['getDataValue'](_0x7cb9('0x22'))[_0x7cb9('0x13')](','):null;},'comment':_0x7cb9('0x23')},'trustrpid':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no',_0x7cb9('0x24'))},'promiscredir':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x7cb9('0x3')]('yes','no')},'accountcode':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x7cb9('0x6')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x7cb9('0x6')]},'callcounter':{'type':Sequelize[_0x7cb9('0x3')]('yes','no'),'defaultValue':_0x7cb9('0x19')},'busylevel':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x7cb9('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0x7cb9('0x19'),'no')},'subscribecontext':{'type':Sequelize[_0x7cb9('0x6')]},'template':{'type':Sequelize[_0x7cb9('0x6')]},'videosupport':{'type':Sequelize['ENUM'](_0x7cb9('0x19'),'no',_0x7cb9('0x26')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x7cb9('0x19'),'no')},'mailbox':{'type':Sequelize[_0x7cb9('0x6')]},'session_timers':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x27'),_0x7cb9('0x28'),_0x7cb9('0x29'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'session_refresher':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x2a'),'uas'),'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x7cb9('0x6')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0x7cb9('0x6')]},'fromuser':{'type':Sequelize[_0x7cb9('0x6')]},'port':{'type':Sequelize[_0x7cb9('0x25')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x7cb9('0x19'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'defaultip':{'type':Sequelize[_0x7cb9('0x6')]},'defaultuser':{'type':Sequelize[_0x7cb9('0x6')]},'rtptimeout':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'sendrpid':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no',_0x7cb9('0x2b')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize[_0x7cb9('0x6')]},'timert1':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'contactpermit':{'type':Sequelize[_0x7cb9('0x6')]},'contactdeny':{'type':Sequelize[_0x7cb9('0x6')]},'contactacl':{'type':Sequelize[_0x7cb9('0x6')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'encryption':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'force_avp':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x7cb9('0x19'),'no')},'dtlsenable':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x7cb9('0x3')]('yes','no','fingerprint',_0x7cb9('0x2c'))},'dtlsrekey':{'type':Sequelize[_0x7cb9('0x25')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x7cb9('0x6')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x7cb9('0x6')]},'dtlscapath':{'type':Sequelize[_0x7cb9('0x6')]},'dtlssetup':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x2d'),_0x7cb9('0x2e'),_0x7cb9('0x2f')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x7cb9('0x6')]},'usereqphone':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x7cb9('0x6')]},'recordofffeature':{'type':Sequelize[_0x7cb9('0x6')]},'call_limit':{'type':Sequelize[_0x7cb9('0x25')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no')},'vmexten':{'type':Sequelize[_0x7cb9('0x6')]},'mohinterpret':{'type':Sequelize[_0x7cb9('0x6')]},'mohsuggest':{'type':Sequelize[_0x7cb9('0x6')]},'parkinglot':{'type':Sequelize[_0x7cb9('0x6')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0x7cb9('0x30')},'canreinvite':{'type':Sequelize[_0x7cb9('0x3')](_0x7cb9('0x19'),'no',_0x7cb9('0x31'),_0x7cb9('0x1a'),'update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x7cb9('0x6')]},'otherFields':{'type':Sequelize[_0x7cb9('0x6')]},'active':{'type':Sequelize[_0x7cb9('0x32')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x7cb9('0x6')],'defaultValue':'no'}}; \ No newline at end of file +var _0x397a=['passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','name','ENUM','friend','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','STRING','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','inband','yes','update','outgoing','setDataValue','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','certificate','active'];(function(_0x14ddd4,_0x5b527d){var _0x421616=function(_0x4f0a42){while(--_0x4f0a42){_0x14ddd4['push'](_0x14ddd4['shift']());}};_0x421616(++_0x5b527d);}(_0x397a,0x11f));var _0xa397=function(_0x2b0d7e,_0x48ae97){_0x2b0d7e=_0x2b0d7e-0x0;var _0x4332b4=_0x397a[_0x2b0d7e];return _0x4332b4;};'use strict';var Sequelize=require(_0xa397('0x0'));module[_0xa397('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa397('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x4'),'user',_0xa397('0x5')),'allowNull':![],'defaultValue':_0xa397('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa397('0x6')},'callingpres':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x7'),_0xa397('0x8'),_0xa397('0x9'),'ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xa397('0xa'),_0xa397('0xb'))},'deny':{'type':Sequelize[_0xa397('0xc')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0xa397('0xc')]},'md5secret':{'type':Sequelize[_0xa397('0xc')]},'remotesecret':{'type':Sequelize[_0xa397('0xc')]},'transport':{'type':Sequelize[_0xa397('0xc')],'defaultValue':'udp','set':function(_0x3bbafc){this['setDataValue'](_0xa397('0xd'),_0x3bbafc?_0x3bbafc[_0xa397('0xe')](','):null);},'get':function(){return this[_0xa397('0xf')]('transport')?this[_0xa397('0xf')](_0xa397('0xd'))[_0xa397('0x10')](','):null;},'comment':_0xa397('0x11')},'dtmfmode':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x12'),'info',_0xa397('0x13'),_0xa397('0x14'),'auto'),'defaultValue':_0xa397('0x12')},'directmedia':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no','nonat',_0xa397('0x16'),_0xa397('0x17')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa397('0xc')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xa397('0xc')],'defaultValue':'force_rport,comedia','set':function(_0x3f17da){this[_0xa397('0x18')](_0xa397('0x19'),_0x3f17da?_0x3f17da[_0xa397('0xe')](','):null);},'get':function(){return this[_0xa397('0xf')]('nat')?this['getDataValue'](_0xa397('0x19'))['split'](','):null;},'comment':_0xa397('0x1a')},'callgroup':{'type':Sequelize[_0xa397('0xc')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xa397('0xc')]},'language':{'type':Sequelize[_0xa397('0xc')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xa397('0xc')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xa397('0xc')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xa397('0xc')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x147381){this['setDataValue'](_0xa397('0x1b'),_0x147381?_0x147381[_0xa397('0xe')](';'):_0xa397('0x1c'));},'get':function(){return this[_0xa397('0xf')]('allow')?this[_0xa397('0xf')]('allow')['split'](';'):null;},'comment':_0xa397('0x1d')},'autoframing':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no')},'insecure':{'type':Sequelize[_0xa397('0xc')],'defaultValue':'port,invite','set':function(_0x713289){this['setDataValue'](_0xa397('0x1e'),_0x713289?_0x713289[_0xa397('0xe')](','):null);},'get':function(){return this['getDataValue'](_0xa397('0x1e'))?this['getDataValue'](_0xa397('0x1e'))[_0xa397('0x10')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0xa397('0x15'),'no',_0xa397('0x1f'))},'promiscredir':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no')},'useclientcode':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no')},'accountcode':{'type':Sequelize[_0xa397('0x20')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xa397('0xc')],'defaultValue':_0xa397('0x21')},'amaflags':{'type':Sequelize[_0xa397('0xc')]},'callcounter':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no')},'allowsubscribe':{'type':Sequelize['ENUM'](_0xa397('0x15'),'no')},'allowtransfer':{'type':Sequelize['ENUM']('yes','no')},'ignoresdpversion':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0xa397('0xc')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no',_0xa397('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa397('0x20')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xa397('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0xa397('0xc')]},'session_timers':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x23'),_0xa397('0x24'),_0xa397('0x25'))},'session_expires':{'type':Sequelize[_0xa397('0x20')](0xb)},'session_minse':{'type':Sequelize['INTEGER'](0xb)},'session_refresher':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x26'),_0xa397('0x27')),'defaultValue':_0xa397('0x27')},'t38pt_usertpsource':{'type':Sequelize[_0xa397('0xc')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0xa397('0x20')](0x5)},'qualify':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no'),'defaultValue':_0xa397('0x15')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0xa397('0xc')]},'defaultuser':{'type':Sequelize[_0xa397('0xc')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xa397('0x20')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xa397('0x20')](0xb)},'sendrpid':{'type':Sequelize['ENUM'](_0xa397('0x15'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa397('0xc')]},'callbackextension':{'type':Sequelize[_0xa397('0xc')]},'timert1':{'type':Sequelize[_0xa397('0x20')](0xb)},'timerb':{'type':Sequelize[_0xa397('0x20')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize[_0xa397('0xc')]},'contactdeny':{'type':Sequelize['STRING']},'contactacl':{'type':Sequelize[_0xa397('0xc')]},'unsolicited_mailbox':{'type':Sequelize[_0xa397('0xc')]},'use_q850_reason':{'type':Sequelize[_0xa397('0xc')]},'maxforwards':{'type':Sequelize[_0xa397('0x20')](0xb)},'encryption':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa397('0x3')]('yes','no')},'force_avp':{'type':Sequelize['ENUM'](_0xa397('0x15'),'no')},'icesupport':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no')},'dtlsenable':{'type':Sequelize['ENUM']('yes','no')},'dtlsverify':{'type':Sequelize['ENUM']('yes','no','fingerprint',_0xa397('0x28'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0xa397('0xc')]},'dtlscipher':{'type':Sequelize[_0xa397('0xc')]},'dtlscafile':{'type':Sequelize[_0xa397('0xc')]},'dtlscapath':{'type':Sequelize[_0xa397('0xc')]},'dtlssetup':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x29'),_0xa397('0x2a'),_0xa397('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize[_0xa397('0x3')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa397('0xc')]},'recordofffeature':{'type':Sequelize[_0xa397('0xc')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xa397('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xa397('0xc')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa397('0xc')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0xa397('0x2c')},'canreinvite':{'type':Sequelize[_0xa397('0x3')](_0xa397('0x15'),'no','nonat',_0xa397('0x16'),_0xa397('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xa397('0xc')]},'otherFields':{'type':Sequelize[_0xa397('0xc')]},'active':{'type':Sequelize[_0xa397('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xa397('0xc')],'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 d5c1216..0199cfd 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 _0x24ca=['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','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','get','Trunks','UserProfileResource','destroy','then','end','name','send','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','params','rawAttributes','keys','find','clone','length','omit','createdAt','updatedAt','create','user','role','userProfileId','autoAssociation','body','join','root','server/files/templates/trunk.ejs','readFileSync','server/files/templates/registry.ejs','utf8','writeFileSync','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_trunks.conf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra'];(function(_0x40646e,_0x2b7664){var _0x5911a0=function(_0xea0d93){while(--_0xea0d93){_0x40646e['push'](_0x40646e['shift']());}};_0x5911a0(++_0x2b7664);}(_0x24ca,0x1bc));var _0xa24c=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0x24ca[_0x3ce2c4];return _0x4047c1;};'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'];var jayson=require(_0xa24c('0x1b'));var client=jayson[_0xa24c('0x1c')][_0xa24c('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5a9486,_0x3ad0bf,_0x3c23fc,_0x26ff28){return new BPromise(function(_0x2fcd8b,_0x1cb08e){var _0x2d185c=_0x26ff28||client;return _0x2d185c[_0xa24c('0x1e')](_0x5a9486,_0x3c23fc)['then'](function(_0x47a063){logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,'request\x20sent');logger['debug'](_0xa24c('0x21'),_0x3ad0bf,_0xa24c('0x22'),JSON['stringify'](_0x47a063));if(_0x47a063[_0xa24c('0x23')]){if(_0x47a063['error'][_0xa24c('0x24')]===0x1f4){logger[_0xa24c('0x23')](_0xa24c('0x20'),_0x3ad0bf,_0x47a063[_0xa24c('0x23')]['message']);return _0x1cb08e(_0x47a063[_0xa24c('0x23')][_0xa24c('0x25')]);}logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x47a063['error']['message']);return _0x2fcd8b(_0x47a063['error'][_0xa24c('0x25')]);}else{logger[_0xa24c('0x1f')](_0xa24c('0x20'),_0x3ad0bf,_0xa24c('0x22'));_0x2fcd8b(_0x47a063['result'][_0xa24c('0x25')]);}})['catch'](function(_0x224bca){logger[_0xa24c('0x23')]('Trunk,\x20%s,\x20%s',_0x3ad0bf,_0x224bca);_0x1cb08e(_0x224bca);});});}function respondWithStatusCode(_0x346ee8,_0x363d52){_0x363d52=_0x363d52||0xcc;return function(_0x43a0c0){if(_0x43a0c0){return _0x346ee8[_0xa24c('0x26')](_0x363d52);}return _0x346ee8[_0xa24c('0x27')](_0x363d52)['end']();};}function respondWithResult(_0xec9167,_0x5cc9cb){_0x5cc9cb=_0x5cc9cb||0xc8;return function(_0x2365f9){if(_0x2365f9){return _0xec9167[_0xa24c('0x27')](_0x5cc9cb)[_0xa24c('0x28')](_0x2365f9);}};}function respondWithFilteredResult(_0x51dc3f,_0x1beb55){return function(_0x31c4d9){if(_0x31c4d9){var _0x14fd5a=typeof _0x1beb55[_0xa24c('0x29')]===_0xa24c('0x2a')&&typeof _0x1beb55[_0xa24c('0x2b')]===_0xa24c('0x2a');var _0x5b23f4=_0x31c4d9[_0xa24c('0x2c')];var _0x28675f=_0x14fd5a?0x0:_0x1beb55[_0xa24c('0x29')];var _0x12dbdc=_0x14fd5a?_0x31c4d9['count']:_0x1beb55[_0xa24c('0x29')]+_0x1beb55[_0xa24c('0x2b')];var _0x97c08;if(_0x12dbdc>=_0x5b23f4){_0x12dbdc=_0x5b23f4;_0x97c08=0xc8;}else{_0x97c08=0xce;}_0x51dc3f['status'](_0x97c08);return _0x51dc3f[_0xa24c('0x2d')](_0xa24c('0x2e'),_0x28675f+'-'+_0x12dbdc+'/'+_0x5b23f4)[_0xa24c('0x28')](_0x31c4d9);}return null;};}function patchUpdates(_0x4ae35c){return function(_0x245fb2){try{jsonpatch['apply'](_0x245fb2,_0x4ae35c,!![]);}catch(_0x1102ab){return BPromise[_0xa24c('0x2f')](_0x1102ab);}return _0x245fb2[_0xa24c('0x30')]();};}function saveUpdates(_0x5d025a,_0x1f52f8){return function(_0x53f90){if(_0x53f90){return _0x53f90[_0xa24c('0x31')](_0x5d025a)['then'](function(_0x1c1ed3){return _0x1c1ed3;});}return null;};}function removeEntity(_0x57c340,_0xa20091){return function(_0x42ba21){if(_0x42ba21){return _0x42ba21['destroy']()['then'](function(){var _0x20a276=_0x42ba21[_0xa24c('0x32')]({'plain':!![]});var _0x182e86=_0xa24c('0x33');return db[_0xa24c('0x34')][_0xa24c('0x35')]({'where':{'type':_0x182e86,'resourceId':_0x20a276['id']}})[_0xa24c('0x36')](function(){return _0x42ba21;});})['then'](function(){_0x57c340[_0xa24c('0x27')](0xcc)[_0xa24c('0x37')]();});}};}function handleEntityNotFound(_0x12825d,_0xbd24c0){return function(_0xc6337b){if(!_0xc6337b){_0x12825d[_0xa24c('0x26')](0x194);}return _0xc6337b;};}function handleError(_0x86902f,_0x81d471){_0x81d471=_0x81d471||0x1f4;return function(_0x1ea166){logger[_0xa24c('0x23')](_0x1ea166['stack']);if(_0x1ea166[_0xa24c('0x38')]){delete _0x1ea166[_0xa24c('0x38')];}_0x86902f[_0xa24c('0x27')](_0x81d471)[_0xa24c('0x39')](_0x1ea166);};}exports['index']=function(_0x56a485,_0x19a65f){var _0x56ef4d={},_0xb690b5={},_0x13f272={'count':0x0,'rows':[]};var _0x22a316=_[_0xa24c('0x3a')](db[_0xa24c('0x3b')]['rawAttributes'],function(_0x532875){return{'name':_0x532875[_0xa24c('0x3c')],'type':_0x532875[_0xa24c('0x3d')][_0xa24c('0x3e')]};});_0xb690b5[_0xa24c('0x3f')]=_[_0xa24c('0x3a')](_0x22a316,_0xa24c('0x38'));_0xb690b5['query']=_['keys'](_0x56a485[_0xa24c('0x40')]);_0xb690b5[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],_0xb690b5[_0xa24c('0x40')]);_0x56ef4d['attributes']=_[_0xa24c('0x42')](_0xb690b5[_0xa24c('0x3f')],qs['fields'](_0x56a485['query'][_0xa24c('0x43')]));_0x56ef4d[_0xa24c('0x44')]=_0x56ef4d[_0xa24c('0x44')]['length']?_0x56ef4d['attributes']:_0xb690b5[_0xa24c('0x3f')];if(!_0x56a485[_0xa24c('0x40')][_0xa24c('0x45')](_0xa24c('0x46'))){_0x56ef4d[_0xa24c('0x2b')]=qs[_0xa24c('0x2b')](_0x56a485[_0xa24c('0x40')][_0xa24c('0x2b')]);_0x56ef4d['offset']=qs['offset'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x29')]);}_0x56ef4d[_0xa24c('0x47')]=qs['sort'](_0x56a485[_0xa24c('0x40')][_0xa24c('0x48')]);_0x56ef4d[_0xa24c('0x49')]=qs[_0xa24c('0x41')](_[_0xa24c('0x4a')](_0x56a485[_0xa24c('0x40')],_0xb690b5[_0xa24c('0x41')]),_0x22a316);if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]){_0x56ef4d[_0xa24c('0x49')]=_['merge'](_0x56ef4d[_0xa24c('0x49')],{'$or':_[_0xa24c('0x3a')](_0x22a316,function(_0x39a6cd){if(_0x39a6cd['type']!==_0xa24c('0x4c')){var _0x247d2c={};_0x247d2c[_0x39a6cd[_0xa24c('0x38')]]={'$like':'%'+_0x56a485[_0xa24c('0x40')][_0xa24c('0x4b')]+'%'};return _0x247d2c;}})});}_0x56ef4d=_[_0xa24c('0x4d')]({},_0x56ef4d,_0x56a485[_0xa24c('0x4e')]);var _0x46f725={'where':_0x56ef4d[_0xa24c('0x49')]};return db[_0xa24c('0x3b')][_0xa24c('0x2c')](_0x46f725)['then'](function(_0x29a84d){_0x13f272[_0xa24c('0x2c')]=_0x29a84d;if(_0x56a485[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x56ef4d[_0xa24c('0x50')]=[{'all':!![]}];}return db[_0xa24c('0x3b')][_0xa24c('0x51')](_0x56ef4d);})[_0xa24c('0x36')](function(_0x184179){_0x13f272['rows']=_0x184179;return _0x13f272;})['then'](respondWithFilteredResult(_0x19a65f,_0x56ef4d))[_0xa24c('0x52')](handleError(_0x19a65f,null));};exports['show']=function(_0xc078ef,_0x1f436c){var _0x4ec677={'raw':![],'where':{'id':_0xc078ef[_0xa24c('0x53')]['id']}},_0x24b3df={};_0x24b3df[_0xa24c('0x3f')]=_['keys'](db['Trunk'][_0xa24c('0x54')]);_0x24b3df['query']=_[_0xa24c('0x55')](_0xc078ef[_0xa24c('0x40')]);_0x24b3df[_0xa24c('0x41')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],_0x24b3df[_0xa24c('0x40')]);_0x4ec677[_0xa24c('0x44')]=_[_0xa24c('0x42')](_0x24b3df[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0xc078ef['query'][_0xa24c('0x43')]));_0x4ec677[_0xa24c('0x44')]=_0x4ec677[_0xa24c('0x44')]['length']?_0x4ec677['attributes']:_0x24b3df['model'];if(_0xc078ef[_0xa24c('0x40')]['includeAll']){_0x4ec677[_0xa24c('0x50')]=[{'all':!![]}];}_0x4ec677=_[_0xa24c('0x4d')]({},_0x4ec677,_0xc078ef['options']);return db[_0xa24c('0x3b')][_0xa24c('0x56')](_0x4ec677)[_0xa24c('0x36')](handleEntityNotFound(_0x1f436c,null))[_0xa24c('0x36')](respondWithResult(_0x1f436c,null))[_0xa24c('0x52')](handleError(_0x1f436c,null));};exports[_0xa24c('0x57')]=function(_0x3816f7,_0xbeab78){var _0x518c2a={'where':{'id':_0x3816f7['params']['id']}},_0x172645={};_0x172645['model']=_['keys'](db['Trunk']['rawAttributes']);_0x518c2a[_0xa24c('0x44')]=_['intersection'](_0x172645[_0xa24c('0x3f')],qs[_0xa24c('0x43')](_0x3816f7[_0xa24c('0x40')][_0xa24c('0x43')]));_0x518c2a[_0xa24c('0x44')]=_0x518c2a[_0xa24c('0x44')][_0xa24c('0x58')]?_0x518c2a[_0xa24c('0x44')]:_0x172645[_0xa24c('0x3f')];if(_0x3816f7[_0xa24c('0x40')][_0xa24c('0x4f')]){_0x518c2a[_0xa24c('0x50')]=[{'all':!![]}];}_0x518c2a=_[_0xa24c('0x4d')]({},_0x518c2a,_0x3816f7[_0xa24c('0x4e')]);return db[_0xa24c('0x3b')]['find'](_0x518c2a)[_0xa24c('0x36')](handleEntityNotFound(_0xbeab78,null))[_0xa24c('0x36')](function(_0x5264a7){if(_0x5264a7){var _0x1e08bb=_0x5264a7[_0xa24c('0x32')]({'plain':!![]});_0x1e08bb=qs[_0xa24c('0x59')](_0x1e08bb,['id',_0xa24c('0x5a'),'updatedAt']);_0x3816f7['body']=_[_0xa24c('0x59')](_0x3816f7['body'],['id','createdAt',_0xa24c('0x5b')]);return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_[_0xa24c('0x4d')](_0x1e08bb,_0x3816f7['body']),{'include':_0x3816f7['query'][_0xa24c('0x4f')]?[{'all':!![]}]:undefined})['then'](function(_0x52a895){var _0xfcc193=_0x3816f7[_0xa24c('0x5d')][_0xa24c('0x32')]({'plain':!![]});if(!_0xfcc193)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfcc193[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5c3285=_0x52a895[_0xa24c('0x32')]({'plain':!![]});var _0x3f306d=_0xa24c('0x33');return db['UserProfileSection'][_0xa24c('0x56')]({'where':{'name':_0x3f306d,'userProfileId':_0xfcc193[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x7aab6e){if(_0x7aab6e&&_0x7aab6e[_0xa24c('0x60')]===0x0){return db['UserProfileResource'][_0xa24c('0x5c')]({'name':_0x5c3285[_0xa24c('0x38')],'resourceId':_0x5c3285['id'],'type':_0x7aab6e[_0xa24c('0x38')],'sectionId':_0x7aab6e['id']},{})[_0xa24c('0x36')](function(){return _0x52a895;});}else{return _0x52a895;}})[_0xa24c('0x52')](function(_0x2ca3fa){logger[_0xa24c('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ca3fa);throw _0x2ca3fa;});}return _0x52a895;});}})[_0xa24c('0x36')](respondWithResult(_0xbeab78,0xc9))[_0xa24c('0x52')](handleError(_0xbeab78,null));};exports['create']=function(_0xb1048a,_0x3e455b,_0x14da5e){var _0xb460b4;return db[_0xa24c('0x3b')][_0xa24c('0x5c')](_0xb1048a[_0xa24c('0x61')],{'raw':!![]})[_0xa24c('0x36')](function(_0x38cc30){_0xb460b4=_0x38cc30;return db[_0xa24c('0x3b')]['findAll']({'raw':!![]});})[_0xa24c('0x36')](function(_0x3a4abd){var _0x3b894f=fs['readFileSync'](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x64')),'utf8');var _0x3ac3a0=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4f9b56=ejs['render'](_0x3b894f,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x4f9b56);if(_0xb460b4[_0xa24c('0x69')]){var _0x1879ae=ejs[_0xa24c('0x6a')](_0x3ac3a0,{'trunks':_0x3a4abd||[]});fs[_0xa24c('0x68')](_0xa24c('0x6b'),_0x1879ae);}})['then'](function(){return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x5c'),{'module':_0xa24c('0x6d')});})[_0xa24c('0x36')](function(){var _0x987aca=_0xb1048a[_0xa24c('0x5d')]['get']({'plain':!![]});if(!_0x987aca)throw new Error(_0xa24c('0x6e'));if(_0x987aca[_0xa24c('0x5e')]===_0xa24c('0x5d')){var _0x5b9ad7=_0xb460b4['get']({'plain':!![]});return db[_0xa24c('0x6f')]['find']({'where':{'name':_0xa24c('0x33'),'userProfileId':_0x987aca[_0xa24c('0x5f')]},'raw':!![]})[_0xa24c('0x36')](function(_0x180da2){if(_0x180da2&&_0x180da2['autoAssociation']===0x0){return db[_0xa24c('0x34')][_0xa24c('0x5c')]({'name':_0x5b9ad7['name'],'resourceId':_0x5b9ad7['id'],'type':_0x180da2[_0xa24c('0x38')],'sectionId':_0x180da2['id']},{})[_0xa24c('0x36')](function(){return _0xb460b4;});}else{return _0xb460b4;}})[_0xa24c('0x52')](function(_0x3e0c08){logger[_0xa24c('0x23')](_0xa24c('0x70'),_0x3e0c08);throw _0x3e0c08;});}return _0xb460b4;})[_0xa24c('0x36')](respondWithResult(_0x3e455b,0xc9))[_0xa24c('0x52')](handleError(_0x3e455b,null));};exports['update']=function(_0x12508e,_0x3c2726,_0x2cae90){var _0x28c3ff;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x12508e[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3c2726,null))[_0xa24c('0x36')](saveUpdates(_0x12508e[_0xa24c('0x61')],null))[_0xa24c('0x36')](function(_0x5b0127){if(_0x5b0127){_0x28c3ff=_0x5b0127;return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});}})['then'](function(_0x141ccf){if(_0x141ccf){var _0x3f212f=fs[_0xa24c('0x65')](path['join'](config['root'],_0xa24c('0x64')),_0xa24c('0x67'));var _0x53928f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config[_0xa24c('0x63')],_0xa24c('0x66')),_0xa24c('0x67'));var _0x336898=ejs['render'](_0x3f212f,{'trunks':_0x141ccf||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x336898);var _0x263dab=ejs['render'](_0x53928f,{'trunks':_0x141ccf||[]});fs['writeFileSync'](_0xa24c('0x6b'),_0x263dab);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x31'),{'module':_0xa24c('0x6d')});}return null;})[_0xa24c('0x36')](function(_0x45b2fe){if(_0x45b2fe){return _0x28c3ff;}})[_0xa24c('0x36')](respondWithResult(_0x3c2726,null))[_0xa24c('0x52')](handleError(_0x3c2726,null));};exports[_0xa24c('0x35')]=function(_0x4ee10d,_0x3897ca,_0xa077c8){var _0x16e1db;return db[_0xa24c('0x3b')][_0xa24c('0x56')]({'where':{'id':_0x4ee10d[_0xa24c('0x53')]['id']}})[_0xa24c('0x36')](handleEntityNotFound(_0x3897ca,null))[_0xa24c('0x36')](removeEntity(_0x3897ca,null))[_0xa24c('0x36')](function(){return db[_0xa24c('0x3b')][_0xa24c('0x51')]({'raw':!![]});})[_0xa24c('0x36')](function(_0x4ecbe9){var _0x1fe0f3=fs[_0xa24c('0x65')](path['join'](config[_0xa24c('0x63')],_0xa24c('0x64')),_0xa24c('0x67'));var _0x4af78f=fs[_0xa24c('0x65')](path[_0xa24c('0x62')](config['root'],_0xa24c('0x66')),_0xa24c('0x67'));var _0x4c108f=ejs['render'](_0x1fe0f3,{'trunks':_0x4ecbe9});var _0x124d52=ejs[_0xa24c('0x6a')](_0x4af78f,{'trunks':_0x4ecbe9});fs[_0xa24c('0x68')](_0xa24c('0x71'),_0x4c108f);fs['writeFileSync'](_0xa24c('0x6b'),_0x124d52);return respondWithRpcPromise(_0xa24c('0x6c'),_0xa24c('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x3897ca,null));}; \ No newline at end of file +var _0xedd9=['body','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','create','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','server/files/templates/trunk.ejs','server/files/templates/registry.ejs','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','jayson/promise','client','http','request','then','info','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','Trunk,\x20%s,\x20%s','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','destroy','get','Trunks','UserProfileResource','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','Trunk','findAll','rows','show','params','length','find','omit'];(function(_0x6da7e2,_0xfd5c26){var _0x4275cc=function(_0x558a66){while(--_0x558a66){_0x6da7e2['push'](_0x6da7e2['shift']());}};_0x4275cc(++_0xfd5c26);}(_0xedd9,0xfc));var _0x9edd=function(_0x36bf50,_0x2dfbe9){_0x36bf50=_0x36bf50-0x0;var _0x17b804=_0xedd9[_0x36bf50];return _0x17b804;};'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'];var jayson=require(_0x9edd('0x18'));var client=jayson[_0x9edd('0x19')][_0x9edd('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0xfca576,_0xef5498,_0x47eb64,_0x176bfa){return new BPromise(function(_0x44fc7c,_0x891832){var _0x4d9a7=_0x176bfa||client;return _0x4d9a7[_0x9edd('0x1b')](_0xfca576,_0x47eb64)[_0x9edd('0x1c')](function(_0x1042aa){logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x9edd('0x1e'));logger[_0x9edd('0x1f')](_0x9edd('0x20'),_0xef5498,'request\x20sent',JSON[_0x9edd('0x21')](_0x1042aa));if(_0x1042aa[_0x9edd('0x22')]){if(_0x1042aa[_0x9edd('0x22')]['code']===0x1f4){logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')][_0x9edd('0x23')]);return _0x891832(_0x1042aa['error']['message']);}logger[_0x9edd('0x22')]('Trunk,\x20%s,\x20%s',_0xef5498,_0x1042aa[_0x9edd('0x22')]['message']);return _0x44fc7c(_0x1042aa['error'][_0x9edd('0x23')]);}else{logger[_0x9edd('0x1d')]('Trunk,\x20%s,\x20%s',_0xef5498,'request\x20sent');_0x44fc7c(_0x1042aa[_0x9edd('0x24')][_0x9edd('0x23')]);}})[_0x9edd('0x25')](function(_0x542172){logger[_0x9edd('0x22')](_0x9edd('0x26'),_0xef5498,_0x542172);_0x891832(_0x542172);});});}function respondWithStatusCode(_0x44a6c1,_0x2ca65f){_0x2ca65f=_0x2ca65f||0xcc;return function(_0x339a0d){if(_0x339a0d){return _0x44a6c1['sendStatus'](_0x2ca65f);}return _0x44a6c1[_0x9edd('0x27')](_0x2ca65f)[_0x9edd('0x28')]();};}function respondWithResult(_0x3a1ea5,_0x2f9f86){_0x2f9f86=_0x2f9f86||0xc8;return function(_0x310a4d){if(_0x310a4d){return _0x3a1ea5['status'](_0x2f9f86)['json'](_0x310a4d);}};}function respondWithFilteredResult(_0x3276ee,_0xfeca7b){return function(_0x8d67aa){if(_0x8d67aa){var _0x25e135=typeof _0xfeca7b[_0x9edd('0x29')]==='undefined'&&typeof _0xfeca7b['limit']===_0x9edd('0x2a');var _0x257a26=_0x8d67aa[_0x9edd('0x2b')];var _0x52746a=_0x25e135?0x0:_0xfeca7b[_0x9edd('0x29')];var _0x28cfae=_0x25e135?_0x8d67aa[_0x9edd('0x2b')]:_0xfeca7b[_0x9edd('0x29')]+_0xfeca7b['limit'];var _0x2155a1;if(_0x28cfae>=_0x257a26){_0x28cfae=_0x257a26;_0x2155a1=0xc8;}else{_0x2155a1=0xce;}_0x3276ee[_0x9edd('0x27')](_0x2155a1);return _0x3276ee[_0x9edd('0x2c')](_0x9edd('0x2d'),_0x52746a+'-'+_0x28cfae+'/'+_0x257a26)[_0x9edd('0x2e')](_0x8d67aa);}return null;};}function patchUpdates(_0x42e664){return function(_0x209aba){try{jsonpatch[_0x9edd('0x2f')](_0x209aba,_0x42e664,!![]);}catch(_0x19b6c1){return BPromise[_0x9edd('0x30')](_0x19b6c1);}return _0x209aba[_0x9edd('0x31')]();};}function saveUpdates(_0x138002,_0x6907a5){return function(_0xa55906){if(_0xa55906){return _0xa55906[_0x9edd('0x32')](_0x138002)['then'](function(_0x1453d2){return _0x1453d2;});}return null;};}function removeEntity(_0x259259,_0x267c74){return function(_0x5d1707){if(_0x5d1707){return _0x5d1707[_0x9edd('0x33')]()[_0x9edd('0x1c')](function(){var _0xde9b13=_0x5d1707[_0x9edd('0x34')]({'plain':!![]});var _0x21bc30=_0x9edd('0x35');return db[_0x9edd('0x36')][_0x9edd('0x33')]({'where':{'type':_0x21bc30,'resourceId':_0xde9b13['id']}})[_0x9edd('0x1c')](function(){return _0x5d1707;});})[_0x9edd('0x1c')](function(){_0x259259[_0x9edd('0x27')](0xcc)[_0x9edd('0x28')]();});}};}function handleEntityNotFound(_0x27eb7e,_0x14f780){return function(_0x5757fc){if(!_0x5757fc){_0x27eb7e[_0x9edd('0x37')](0x194);}return _0x5757fc;};}function handleError(_0x5ed62d,_0x968303){_0x968303=_0x968303||0x1f4;return function(_0x148630){logger[_0x9edd('0x22')](_0x148630[_0x9edd('0x38')]);if(_0x148630[_0x9edd('0x39')]){delete _0x148630['name'];}_0x5ed62d[_0x9edd('0x27')](_0x968303)[_0x9edd('0x3a')](_0x148630);};}exports[_0x9edd('0x3b')]=function(_0x38e9be,_0x1be77f){var _0x337e6c={},_0x5c0627={},_0x1cbbac={'count':0x0,'rows':[]};var _0x1ccee8=_[_0x9edd('0x3c')](db['Trunk'][_0x9edd('0x3d')],function(_0x56a228){return{'name':_0x56a228[_0x9edd('0x3e')],'type':_0x56a228['type'][_0x9edd('0x3f')]};});_0x5c0627[_0x9edd('0x40')]=_[_0x9edd('0x3c')](_0x1ccee8,'name');_0x5c0627[_0x9edd('0x41')]=_[_0x9edd('0x42')](_0x38e9be[_0x9edd('0x41')]);_0x5c0627['filters']=_[_0x9edd('0x43')](_0x5c0627['model'],_0x5c0627[_0x9edd('0x41')]);_0x337e6c[_0x9edd('0x44')]=_['intersection'](_0x5c0627[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x45')]));_0x337e6c['attributes']=_0x337e6c[_0x9edd('0x44')]['length']?_0x337e6c[_0x9edd('0x44')]:_0x5c0627[_0x9edd('0x40')];if(!_0x38e9be['query'][_0x9edd('0x46')]('nolimit')){_0x337e6c['limit']=qs[_0x9edd('0x47')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x47')]);_0x337e6c[_0x9edd('0x29')]=qs[_0x9edd('0x29')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x29')]);}_0x337e6c[_0x9edd('0x48')]=qs[_0x9edd('0x49')](_0x38e9be[_0x9edd('0x41')][_0x9edd('0x49')]);_0x337e6c[_0x9edd('0x4a')]=qs[_0x9edd('0x4b')](_[_0x9edd('0x4c')](_0x38e9be[_0x9edd('0x41')],_0x5c0627['filters']),_0x1ccee8);if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x4d')]){_0x337e6c[_0x9edd('0x4a')]=_[_0x9edd('0x4e')](_0x337e6c[_0x9edd('0x4a')],{'$or':_[_0x9edd('0x3c')](_0x1ccee8,function(_0x10d41e){if(_0x10d41e['type']!=='VIRTUAL'){var _0x4bc7a1={};_0x4bc7a1[_0x10d41e[_0x9edd('0x39')]]={'$like':'%'+_0x38e9be['query'][_0x9edd('0x4d')]+'%'};return _0x4bc7a1;}})});}_0x337e6c=_[_0x9edd('0x4e')]({},_0x337e6c,_0x38e9be[_0x9edd('0x4f')]);var _0x8db801={'where':_0x337e6c[_0x9edd('0x4a')]};return db['Trunk'][_0x9edd('0x2b')](_0x8db801)[_0x9edd('0x1c')](function(_0x40e33d){_0x1cbbac['count']=_0x40e33d;if(_0x38e9be[_0x9edd('0x41')][_0x9edd('0x50')]){_0x337e6c[_0x9edd('0x51')]=[{'all':!![]}];}return db[_0x9edd('0x52')][_0x9edd('0x53')](_0x337e6c);})[_0x9edd('0x1c')](function(_0x4d4f33){_0x1cbbac[_0x9edd('0x54')]=_0x4d4f33;return _0x1cbbac;})[_0x9edd('0x1c')](respondWithFilteredResult(_0x1be77f,_0x337e6c))['catch'](handleError(_0x1be77f,null));};exports[_0x9edd('0x55')]=function(_0x8d8701,_0x4bb324){var _0x2bd089={'raw':![],'where':{'id':_0x8d8701[_0x9edd('0x56')]['id']}},_0x8134cd={};_0x8134cd['model']=_[_0x9edd('0x42')](db[_0x9edd('0x52')][_0x9edd('0x3d')]);_0x8134cd[_0x9edd('0x41')]=_['keys'](_0x8d8701[_0x9edd('0x41')]);_0x8134cd[_0x9edd('0x4b')]=_[_0x9edd('0x43')](_0x8134cd['model'],_0x8134cd[_0x9edd('0x41')]);_0x2bd089[_0x9edd('0x44')]=_['intersection'](_0x8134cd[_0x9edd('0x40')],qs['fields'](_0x8d8701[_0x9edd('0x41')][_0x9edd('0x45')]));_0x2bd089[_0x9edd('0x44')]=_0x2bd089[_0x9edd('0x44')][_0x9edd('0x57')]?_0x2bd089[_0x9edd('0x44')]:_0x8134cd[_0x9edd('0x40')];if(_0x8d8701[_0x9edd('0x41')][_0x9edd('0x50')]){_0x2bd089[_0x9edd('0x51')]=[{'all':!![]}];}_0x2bd089=_[_0x9edd('0x4e')]({},_0x2bd089,_0x8d8701['options']);return db[_0x9edd('0x52')][_0x9edd('0x58')](_0x2bd089)[_0x9edd('0x1c')](handleEntityNotFound(_0x4bb324,null))['then'](respondWithResult(_0x4bb324,null))[_0x9edd('0x25')](handleError(_0x4bb324,null));};exports['clone']=function(_0x54d83d,_0x54ecfa){var _0x1348a7={'where':{'id':_0x54d83d[_0x9edd('0x56')]['id']}},_0x45f47c={};_0x45f47c[_0x9edd('0x40')]=_['keys'](db['Trunk']['rawAttributes']);_0x1348a7[_0x9edd('0x44')]=_[_0x9edd('0x43')](_0x45f47c[_0x9edd('0x40')],qs[_0x9edd('0x45')](_0x54d83d[_0x9edd('0x41')][_0x9edd('0x45')]));_0x1348a7[_0x9edd('0x44')]=_0x1348a7[_0x9edd('0x44')]['length']?_0x1348a7[_0x9edd('0x44')]:_0x45f47c['model'];if(_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]){_0x1348a7['include']=[{'all':!![]}];}_0x1348a7=_[_0x9edd('0x4e')]({},_0x1348a7,_0x54d83d[_0x9edd('0x4f')]);return db[_0x9edd('0x52')]['find'](_0x1348a7)[_0x9edd('0x1c')](handleEntityNotFound(_0x54ecfa,null))[_0x9edd('0x1c')](function(_0x430eb4){if(_0x430eb4){var _0x15ebfa=_0x430eb4[_0x9edd('0x34')]({'plain':!![]});_0x15ebfa=qs[_0x9edd('0x59')](_0x15ebfa,['id','createdAt','updatedAt']);_0x54d83d[_0x9edd('0x5a')]=_['omit'](_0x54d83d[_0x9edd('0x5a')],['id',_0x9edd('0x5b'),_0x9edd('0x5c')]);return db[_0x9edd('0x52')]['create'](_[_0x9edd('0x4e')](_0x15ebfa,_0x54d83d['body']),{'include':_0x54d83d[_0x9edd('0x41')][_0x9edd('0x50')]?[{'all':!![]}]:undefined})[_0x9edd('0x1c')](function(_0x5ca123){var _0x2651a2=_0x54d83d['user'][_0x9edd('0x34')]({'plain':!![]});if(!_0x2651a2)throw new Error(_0x9edd('0x5d'));if(_0x2651a2['role']===_0x9edd('0x5e')){var _0x4a72d0=_0x5ca123[_0x9edd('0x34')]({'plain':!![]});var _0x134c9c=_0x9edd('0x35');return db['UserProfileSection'][_0x9edd('0x58')]({'where':{'name':_0x134c9c,'userProfileId':_0x2651a2[_0x9edd('0x5f')]},'raw':!![]})[_0x9edd('0x1c')](function(_0x2015fc){if(_0x2015fc&&_0x2015fc[_0x9edd('0x60')]===0x0){return db['UserProfileResource']['create']({'name':_0x4a72d0[_0x9edd('0x39')],'resourceId':_0x4a72d0['id'],'type':_0x2015fc[_0x9edd('0x39')],'sectionId':_0x2015fc['id']},{})['then'](function(){return _0x5ca123;});}else{return _0x5ca123;}})['catch'](function(_0x52afd7){logger[_0x9edd('0x22')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x52afd7);throw _0x52afd7;});}return _0x5ca123;});}})['then'](respondWithResult(_0x54ecfa,0xc9))[_0x9edd('0x25')](handleError(_0x54ecfa,null));};exports[_0x9edd('0x61')]=function(_0x589348,_0xb9ebeb,_0x11e082){var _0x34dff5;return db['Trunk'][_0x9edd('0x61')](_0x589348['body'],{'raw':!![]})[_0x9edd('0x1c')](function(_0x18d1a0){_0x34dff5=_0x18d1a0;return db['Trunk'][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x5c1746){var _0x2bd6d1=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/trunk.ejs'),_0x9edd('0x65'));var _0x58330c=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],'server/files/templates/registry.ejs'),_0x9edd('0x65'));var _0x286593=ejs[_0x9edd('0x66')](_0x2bd6d1,{'trunks':_0x5c1746||[]});fs[_0x9edd('0x67')](_0x9edd('0x68'),_0x286593);if(_0x34dff5[_0x9edd('0x69')]){var _0x3fa4a9=ejs['render'](_0x58330c,{'trunks':_0x5c1746||[]});fs['writeFileSync'](_0x9edd('0x6a'),_0x3fa4a9);}})[_0x9edd('0x1c')](function(){return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x61'),{'module':_0x9edd('0x6c')});})['then'](function(){var _0x2e40c8=_0x589348[_0x9edd('0x5e')][_0x9edd('0x34')]({'plain':!![]});if(!_0x2e40c8)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e40c8[_0x9edd('0x6d')]===_0x9edd('0x5e')){var _0x4b1c12=_0x34dff5[_0x9edd('0x34')]({'plain':!![]});return db[_0x9edd('0x6e')]['find']({'where':{'name':_0x9edd('0x35'),'userProfileId':_0x2e40c8[_0x9edd('0x5f')]},'raw':!![]})['then'](function(_0x3f08ac){if(_0x3f08ac&&_0x3f08ac['autoAssociation']===0x0){return db['UserProfileResource'][_0x9edd('0x61')]({'name':_0x4b1c12[_0x9edd('0x39')],'resourceId':_0x4b1c12['id'],'type':_0x3f08ac[_0x9edd('0x39')],'sectionId':_0x3f08ac['id']},{})['then'](function(){return _0x34dff5;});}else{return _0x34dff5;}})[_0x9edd('0x25')](function(_0x286e47){logger['error'](_0x9edd('0x6f'),_0x286e47);throw _0x286e47;});}return _0x34dff5;})[_0x9edd('0x1c')](respondWithResult(_0xb9ebeb,0xc9))[_0x9edd('0x25')](handleError(_0xb9ebeb,null));};exports[_0x9edd('0x32')]=function(_0x54ac71,_0x5e68db,_0x1129b7){var _0x5bb28c;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x54ac71[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x5e68db,null))[_0x9edd('0x1c')](saveUpdates(_0x54ac71[_0x9edd('0x5a')],null))[_0x9edd('0x1c')](function(_0x5a4d4b){if(_0x5a4d4b){_0x5bb28c=_0x5a4d4b;return db[_0x9edd('0x52')]['findAll']({'raw':!![]});}})[_0x9edd('0x1c')](function(_0x3c4db7){if(_0x3c4db7){var _0x2c7562=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),'utf8');var _0x25e3e7=fs[_0x9edd('0x62')](path['join'](config[_0x9edd('0x64')],_0x9edd('0x71')),'utf8');var _0x304e56=ejs[_0x9edd('0x66')](_0x2c7562,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_trunks.conf',_0x304e56);var _0x41cd76=ejs[_0x9edd('0x66')](_0x25e3e7,{'trunks':_0x3c4db7||[]});fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x41cd76);return respondWithRpcPromise('Reload','update',{'module':'chan_sip.so'});}return null;})[_0x9edd('0x1c')](function(_0x1a6d3d){if(_0x1a6d3d){return _0x5bb28c;}})[_0x9edd('0x1c')](respondWithResult(_0x5e68db,null))['catch'](handleError(_0x5e68db,null));};exports['destroy']=function(_0x49dc1d,_0x56d794,_0x388252){var _0x20762d;return db[_0x9edd('0x52')][_0x9edd('0x58')]({'where':{'id':_0x49dc1d[_0x9edd('0x56')]['id']}})[_0x9edd('0x1c')](handleEntityNotFound(_0x56d794,null))[_0x9edd('0x1c')](removeEntity(_0x56d794,null))[_0x9edd('0x1c')](function(){return db[_0x9edd('0x52')][_0x9edd('0x53')]({'raw':!![]});})[_0x9edd('0x1c')](function(_0x4cfa99){var _0x367fc6=fs[_0x9edd('0x62')](path[_0x9edd('0x63')](config[_0x9edd('0x64')],_0x9edd('0x70')),_0x9edd('0x65'));var _0x3d4890=fs[_0x9edd('0x62')](path['join'](config['root'],_0x9edd('0x71')),'utf8');var _0x35950b=ejs['render'](_0x367fc6,{'trunks':_0x4cfa99});var _0x21c35f=ejs[_0x9edd('0x66')](_0x3d4890,{'trunks':_0x4cfa99});fs['writeFileSync'](_0x9edd('0x68'),_0x35950b);fs[_0x9edd('0x67')]('/etc/asterisk/sip_xcally_registers.conf',_0x21c35f);return respondWithRpcPromise(_0x9edd('0x6b'),_0x9edd('0x33'),{'module':_0x9edd('0x6c')});})[_0x9edd('0x25')](handleError(_0x56d794,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index da93dea..5931297 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 _0xe0f9=['path','rimraf','../../config/environment','./trunk.attributes','exports','define','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xe0f9,0x8a));var _0x9e0f=function(_0x38dac5,_0x4f7e50){_0x38dac5=_0x38dac5-0x0;var _0xbdbf59=_0xe0f9[_0x38dac5];return _0xbdbf59;};'use strict';var _=require('lodash');var util=require(_0x9e0f('0x0'));var logger=require(_0x9e0f('0x1'))(_0x9e0f('0x2'));var moment=require(_0x9e0f('0x3'));var BPromise=require(_0x9e0f('0x4'));var rp=require(_0x9e0f('0x5'));var fs=require('fs');var path=require(_0x9e0f('0x6'));var rimraf=require(_0x9e0f('0x7'));var config=require(_0x9e0f('0x8'));var attributes=require(_0x9e0f('0x9'));module[_0x9e0f('0xa')]=function(_0x4d324a,_0x10ed29){return _0x4d324a[_0x9e0f('0xb')]('Trunk',attributes,{'tableName':'tools_trunks','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f27=['path','rimraf','../../config/environment','./trunk.attributes','exports','Trunk','tools_trunks','lodash','util','moment','bluebird','request-promise'];(function(_0x3aab30,_0x4dc40d){var _0x57d644=function(_0x4d1514){while(--_0x4d1514){_0x3aab30['push'](_0x3aab30['shift']());}};_0x57d644(++_0x4dc40d);}(_0x5f27,0x16f));var _0x75f2=function(_0x5a9816,_0x27f244){_0x5a9816=_0x5a9816-0x0;var _0x3c6adb=_0x5f27[_0x5a9816];return _0x3c6adb;};'use strict';var _=require(_0x75f2('0x0'));var util=require(_0x75f2('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75f2('0x2'));var BPromise=require(_0x75f2('0x3'));var rp=require(_0x75f2('0x4'));var fs=require('fs');var path=require(_0x75f2('0x5'));var rimraf=require(_0x75f2('0x6'));var config=require(_0x75f2('0x7'));var attributes=require(_0x75f2('0x8'));module[_0x75f2('0x9')]=function(_0xcd8a5,_0x562eed){return _0xcd8a5['define'](_0x75f2('0xa'),attributes,{'tableName':_0x75f2('0xb'),'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 31c5e72..d2a2f24 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 _0x544a=['../../config/environment','jayson/promise','http','request','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','error','message','Trunk,\x20%s,\x20%s','request\x20sent','catch','GetTrunk','Trunk','findAll','options','raw','where','limit','include','model','attributes','map','then','find','ShowTrunk','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc'];(function(_0x39c9bc,_0x398f06){var _0x5c94a0=function(_0x57060a){while(--_0x57060a){_0x39c9bc['push'](_0x39c9bc['shift']());}};_0x5c94a0(++_0x398f06);}(_0x544a,0x184));var _0xa544=function(_0x1b2264,_0x39d6bd){_0x1b2264=_0x1b2264-0x0;var _0x4b3c14=_0x544a[_0x1b2264];return _0x4b3c14;};'use strict';var _=require(_0xa544('0x0'));var util=require(_0xa544('0x1'));var moment=require(_0xa544('0x2'));var BPromise=require(_0xa544('0x3'));var rs=require(_0xa544('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa544('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa544('0x6'))(_0xa544('0x7'));var config=require(_0xa544('0x8'));var jayson=require(_0xa544('0x9'));var client=jayson['client'][_0xa544('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x171bbd,_0xf73042,_0x5bb8bd){return new BPromise(function(_0xa8b571,_0x1dd888){return client[_0xa544('0xb')](_0x171bbd,_0x5bb8bd)['then'](function(_0x26970d){logger[_0xa544('0xc')]('Trunk,\x20%s,\x20%s',_0xf73042,'request\x20sent');logger[_0xa544('0xd')](_0xa544('0xe'),_0xf73042,'request\x20sent',JSON[_0xa544('0xf')](_0x26970d));if(_0x26970d['error']){if(_0x26970d['error'][_0xa544('0x10')]===0x1f4){logger[_0xa544('0x11')]('Trunk,\x20%s,\x20%s',_0xf73042,_0x26970d['error'][_0xa544('0x12')]);return _0x1dd888(_0x26970d[_0xa544('0x11')][_0xa544('0x12')]);}logger[_0xa544('0x11')]('Trunk,\x20%s,\x20%s',_0xf73042,_0x26970d[_0xa544('0x11')]['message']);return _0xa8b571(_0x26970d[_0xa544('0x11')][_0xa544('0x12')]);}else{logger[_0xa544('0xc')](_0xa544('0x13'),_0xf73042,_0xa544('0x14'));_0xa8b571(_0x26970d['result'][_0xa544('0x12')]);}})[_0xa544('0x15')](function(_0x3c7e8f){logger[_0xa544('0x11')](_0xa544('0x13'),_0xf73042,_0x3c7e8f);_0x1dd888(_0x3c7e8f);});});}exports[_0xa544('0x16')]=function(_0x32b6bc){var _0x1a4281=this;return new Promise(function(_0x131ae4,_0x4abcf4){return db[_0xa544('0x17')][_0xa544('0x18')]({'raw':_0x32b6bc[_0xa544('0x19')]?_0x32b6bc[_0xa544('0x19')][_0xa544('0x1a')]===undefined?!![]:![]:!![],'where':_0x32b6bc[_0xa544('0x19')]?_0x32b6bc['options'][_0xa544('0x1b')]||null:null,'attributes':_0x32b6bc[_0xa544('0x19')]?_0x32b6bc[_0xa544('0x19')]['attributes']||null:null,'limit':_0x32b6bc[_0xa544('0x19')]?_0x32b6bc[_0xa544('0x19')][_0xa544('0x1c')]||null:null,'include':_0x32b6bc[_0xa544('0x19')]?_0x32b6bc['options'][_0xa544('0x1d')]?_['map'](_0x32b6bc['options'][_0xa544('0x1d')],function(_0x3a2b0b){return{'model':db[_0x3a2b0b[_0xa544('0x1e')]],'as':_0x3a2b0b['as'],'attributes':_0x3a2b0b[_0xa544('0x1f')],'include':_0x3a2b0b[_0xa544('0x1d')]?_[_0xa544('0x20')](_0x3a2b0b['include'],function(_0x448c24){return{'model':db[_0x448c24[_0xa544('0x1e')]],'as':_0x448c24['as'],'attributes':_0x448c24[_0xa544('0x1f')],'include':_0x448c24['include']?_[_0xa544('0x20')](_0x448c24[_0xa544('0x1d')],function(_0x593f18){return{'model':db[_0x593f18[_0xa544('0x1e')]],'as':_0x593f18['as'],'attributes':_0x593f18[_0xa544('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa544('0x21')](function(_0x3e56d0){logger[_0xa544('0xc')]('GetTrunk',_0x32b6bc);logger[_0xa544('0xd')]('GetTrunk',_0x32b6bc,JSON['stringify'](_0x3e56d0));_0x131ae4(_0x3e56d0);})[_0xa544('0x15')](function(_0x36879f){logger[_0xa544('0x11')](_0xa544('0x16'),_0x36879f['message'],_0x32b6bc);_0x4abcf4(_0x1a4281['error'](0x1f4,_0x36879f[_0xa544('0x12')]));});});};exports['ShowTrunk']=function(_0x2d5982){var _0x6361de=this;return new Promise(function(_0x1a710b,_0x4dfacb){return db[_0xa544('0x17')][_0xa544('0x22')]({'raw':_0x2d5982[_0xa544('0x19')]?_0x2d5982[_0xa544('0x19')][_0xa544('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d5982[_0xa544('0x19')]?_0x2d5982[_0xa544('0x19')][_0xa544('0x1b')]||null:null,'attributes':_0x2d5982[_0xa544('0x19')]?_0x2d5982[_0xa544('0x19')]['attributes']||null:null,'include':_0x2d5982[_0xa544('0x19')]?_0x2d5982[_0xa544('0x19')]['include']?_[_0xa544('0x20')](_0x2d5982[_0xa544('0x19')]['include'],function(_0x146bff){return{'model':db[_0x146bff[_0xa544('0x1e')]],'as':_0x146bff['as'],'attributes':_0x146bff[_0xa544('0x1f')],'include':_0x146bff[_0xa544('0x1d')]?_[_0xa544('0x20')](_0x146bff[_0xa544('0x1d')],function(_0x25c327){return{'model':db[_0x25c327['model']],'as':_0x25c327['as'],'attributes':_0x25c327[_0xa544('0x1f')],'include':_0x25c327[_0xa544('0x1d')]?_[_0xa544('0x20')](_0x25c327[_0xa544('0x1d')],function(_0x312e4e){return{'model':db[_0x312e4e[_0xa544('0x1e')]],'as':_0x312e4e['as'],'attributes':_0x312e4e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1c4694){logger[_0xa544('0xc')]('ShowTrunk',_0x2d5982);logger[_0xa544('0xd')](_0xa544('0x23'),_0x2d5982,JSON['stringify'](_0x1c4694));_0x1a710b(_0x1c4694);})['catch'](function(_0x5a5b30){logger[_0xa544('0x11')]('ShowTrunk',_0x5a5b30[_0xa544('0x12')],_0x2d5982);_0x4dfacb(_0x6361de[_0xa544('0x11')](0x1f4,_0x5a5b30[_0xa544('0x12')]));});});}; \ No newline at end of file +var _0xfc7a=['attributes','limit','include','map','model','GetTrunk','debug','ShowTrunk','Trunk','lodash','util','bluebird','randomstring','../../config/logger','rpc','jayson/promise','http','then','info','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','Trunk,\x20%s,\x20%s','message','catch','findAll','options','raw','where'];(function(_0x32fda6,_0x576776){var _0x58c818=function(_0x4bf68f){while(--_0x4bf68f){_0x32fda6['push'](_0x32fda6['shift']());}};_0x58c818(++_0x576776);}(_0xfc7a,0xbd));var _0xafc7=function(_0x1b25c1,_0x2c6ce6){_0x1b25c1=_0x1b25c1-0x0;var _0x1e4447=_0xfc7a[_0x1b25c1];return _0x1e4447;};'use strict';var _=require(_0xafc7('0x0'));var util=require(_0xafc7('0x1'));var moment=require('moment');var BPromise=require(_0xafc7('0x2'));var rs=require(_0xafc7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xafc7('0x4'))(_0xafc7('0x5'));var config=require('../../config/environment');var jayson=require(_0xafc7('0x6'));var client=jayson['client'][_0xafc7('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1499f1,_0x320ac4,_0x5bfa47){return new BPromise(function(_0x564acc,_0x112a6f){return client['request'](_0x1499f1,_0x5bfa47)[_0xafc7('0x8')](function(_0x2aff3f){logger[_0xafc7('0x9')]('Trunk,\x20%s,\x20%s',_0x320ac4,'request\x20sent');logger['debug'](_0xafc7('0xa'),_0x320ac4,'request\x20sent',JSON[_0xafc7('0xb')](_0x2aff3f));if(_0x2aff3f[_0xafc7('0xc')]){if(_0x2aff3f[_0xafc7('0xc')][_0xafc7('0xd')]===0x1f4){logger[_0xafc7('0xc')](_0xafc7('0xe'),_0x320ac4,_0x2aff3f['error'][_0xafc7('0xf')]);return _0x112a6f(_0x2aff3f[_0xafc7('0xc')]['message']);}logger['error'](_0xafc7('0xe'),_0x320ac4,_0x2aff3f[_0xafc7('0xc')][_0xafc7('0xf')]);return _0x564acc(_0x2aff3f[_0xafc7('0xc')][_0xafc7('0xf')]);}else{logger[_0xafc7('0x9')](_0xafc7('0xe'),_0x320ac4,'request\x20sent');_0x564acc(_0x2aff3f['result'][_0xafc7('0xf')]);}})[_0xafc7('0x10')](function(_0x583b3b){logger[_0xafc7('0xc')]('Trunk,\x20%s,\x20%s',_0x320ac4,_0x583b3b);_0x112a6f(_0x583b3b);});});}exports['GetTrunk']=function(_0x19a65b){var _0x5bf94c=this;return new Promise(function(_0x10a0e0,_0x14b967){return db['Trunk'][_0xafc7('0x11')]({'raw':_0x19a65b[_0xafc7('0x12')]?_0x19a65b[_0xafc7('0x12')][_0xafc7('0x13')]===undefined?!![]:![]:!![],'where':_0x19a65b[_0xafc7('0x12')]?_0x19a65b[_0xafc7('0x12')][_0xafc7('0x14')]||null:null,'attributes':_0x19a65b[_0xafc7('0x12')]?_0x19a65b[_0xafc7('0x12')][_0xafc7('0x15')]||null:null,'limit':_0x19a65b[_0xafc7('0x12')]?_0x19a65b[_0xafc7('0x12')][_0xafc7('0x16')]||null:null,'include':_0x19a65b['options']?_0x19a65b[_0xafc7('0x12')][_0xafc7('0x17')]?_[_0xafc7('0x18')](_0x19a65b[_0xafc7('0x12')][_0xafc7('0x17')],function(_0x19a696){return{'model':db[_0x19a696['model']],'as':_0x19a696['as'],'attributes':_0x19a696[_0xafc7('0x15')],'include':_0x19a696['include']?_[_0xafc7('0x18')](_0x19a696[_0xafc7('0x17')],function(_0xfabda7){return{'model':db[_0xfabda7['model']],'as':_0xfabda7['as'],'attributes':_0xfabda7[_0xafc7('0x15')],'include':_0xfabda7['include']?_[_0xafc7('0x18')](_0xfabda7['include'],function(_0x5f13bf){return{'model':db[_0x5f13bf[_0xafc7('0x19')]],'as':_0x5f13bf['as'],'attributes':_0x5f13bf[_0xafc7('0x15')]};}):[]};}):[]};}):[]:[]})[_0xafc7('0x8')](function(_0x1e2383){logger['info'](_0xafc7('0x1a'),_0x19a65b);logger[_0xafc7('0x1b')](_0xafc7('0x1a'),_0x19a65b,JSON[_0xafc7('0xb')](_0x1e2383));_0x10a0e0(_0x1e2383);})[_0xafc7('0x10')](function(_0x23a28a){logger['error'](_0xafc7('0x1a'),_0x23a28a['message'],_0x19a65b);_0x14b967(_0x5bf94c[_0xafc7('0xc')](0x1f4,_0x23a28a['message']));});});};exports[_0xafc7('0x1c')]=function(_0x2f7f64){var _0x4049c0=this;return new Promise(function(_0x2d65a4,_0x5824e8){return db[_0xafc7('0x1d')]['find']({'raw':_0x2f7f64[_0xafc7('0x12')]?_0x2f7f64[_0xafc7('0x12')][_0xafc7('0x13')]===undefined?!![]:![]:!![],'where':_0x2f7f64['options']?_0x2f7f64[_0xafc7('0x12')][_0xafc7('0x14')]||null:null,'attributes':_0x2f7f64[_0xafc7('0x12')]?_0x2f7f64[_0xafc7('0x12')][_0xafc7('0x15')]||null:null,'include':_0x2f7f64[_0xafc7('0x12')]?_0x2f7f64[_0xafc7('0x12')]['include']?_['map'](_0x2f7f64[_0xafc7('0x12')][_0xafc7('0x17')],function(_0x244616){return{'model':db[_0x244616[_0xafc7('0x19')]],'as':_0x244616['as'],'attributes':_0x244616[_0xafc7('0x15')],'include':_0x244616[_0xafc7('0x17')]?_[_0xafc7('0x18')](_0x244616[_0xafc7('0x17')],function(_0xb39f8f){return{'model':db[_0xb39f8f['model']],'as':_0xb39f8f['as'],'attributes':_0xb39f8f[_0xafc7('0x15')],'include':_0xb39f8f[_0xafc7('0x17')]?_[_0xafc7('0x18')](_0xb39f8f[_0xafc7('0x17')],function(_0x515553){return{'model':db[_0x515553['model']],'as':_0x515553['as'],'attributes':_0x515553[_0xafc7('0x15')]};}):[]};}):[]};}):[]:[]})[_0xafc7('0x8')](function(_0x39361a){logger[_0xafc7('0x9')](_0xafc7('0x1c'),_0x2f7f64);logger['debug']('ShowTrunk',_0x2f7f64,JSON[_0xafc7('0xb')](_0x39361a));_0x2d65a4(_0x39361a);})[_0xafc7('0x10')](function(_0x1119c0){logger['error']('ShowTrunk',_0x1119c0[_0xafc7('0xf')],_0x2f7f64);_0x5824e8(_0x4049c0[_0xafc7('0xc')](0x1f4,_0x1119c0[_0xafc7('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index e2d7233..8438c67 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 _0xb8c2=['put','/:id','isAuthenticated','update','exports','express','Router'];(function(_0x3fa577,_0x5033e9){var _0x395529=function(_0x3ab670){while(--_0x3ab670){_0x3fa577['push'](_0x3fa577['shift']());}};_0x395529(++_0x5033e9);}(_0xb8c2,0xd7));var _0x2b8c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb8c2[_0x321bb2];return _0x9c12ed;};'use strict';var express=require(_0x2b8c('0x0'));var router=express[_0x2b8c('0x1')]();var auth=require('../../components/auth/service');var controller=require('./user-setting.controller');router[_0x2b8c('0x2')](_0x2b8c('0x3'),auth[_0x2b8c('0x4')](),controller[_0x2b8c('0x5')]);module[_0x2b8c('0x6')]=router; \ No newline at end of file +var _0xb696=['isAuthenticated','update','express','../../components/auth/service','./user-setting.controller','put','/:id'];(function(_0x12a110,_0x2f5f52){var _0x1110c5=function(_0x18680c){while(--_0x18680c){_0x12a110['push'](_0x12a110['shift']());}};_0x1110c5(++_0x2f5f52);}(_0xb696,0x1bb));var _0x6b69=function(_0x309de0,_0x19506e){_0x309de0=_0x309de0-0x0;var _0x413379=_0xb696[_0x309de0];return _0x413379;};'use strict';var express=require(_0x6b69('0x0'));var router=express['Router']();var auth=require(_0x6b69('0x1'));var controller=require(_0x6b69('0x2'));router[_0x6b69('0x3')](_0x6b69('0x4'),auth[_0x6b69('0x5')](),controller[_0x6b69('0x6')]);module['exports']=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 f94c5fc..75a9d6e 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 _0x5eab=['error','BOOLEAN','TEXT','UserId','sequelize','warning','debug','ENUM'];(function(_0x14aacd,_0x5d57a3){var _0x47b98f=function(_0x3123df){while(--_0x3123df){_0x14aacd['push'](_0x14aacd['shift']());}};_0x47b98f(++_0x5d57a3);}(_0x5eab,0x1c4));var _0xb5ea=function(_0x5e05fd,_0x498153){_0x5e05fd=_0x5e05fd-0x0;var _0x24a1bc=_0x5eab[_0x5e05fd];return _0x24a1bc;};'use strict';var Sequelize=require(_0xb5ea('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xb5ea('0x1'),'info',_0xb5ea('0x2')];module['exports']={'clientSideLoggingLevel':{'type':Sequelize[_0xb5ea('0x3')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xb5ea('0x4'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xb5ea('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb5ea('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize['INTEGER'],'unique':_0xb5ea('0x7')}}; \ No newline at end of file +var _0x5bcd=['BOOLEAN','INTEGER','sequelize','error','debug','exports','ENUM'];(function(_0x15d784,_0x58ed6d){var _0x38a36=function(_0x3ffd9b){while(--_0x3ffd9b){_0x15d784['push'](_0x15d784['shift']());}};_0x38a36(++_0x58ed6d);}(_0x5bcd,0x198));var _0xd5bc=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x5bcd[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0xd5bc('0x0'));const CLIENT_SIDE_LOG_LEVELS=[_0xd5bc('0x1'),'warning','info',_0xd5bc('0x2')];module[_0xd5bc('0x3')]={'clientSideLoggingLevel':{'type':Sequelize[_0xd5bc('0x4')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xd5bc('0x1'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xd5bc('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize['TEXT'],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xd5bc('0x6')],'unique':'UserId'}}; \ 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 cfad052..6a570eb 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 _0xf0cc=['redis','defaults','update','sendStatus','stack','name','status','send','user','Unauthorized','Invalid\x20user\x20setting\x20id','UserSetting','then','catch','lodash','api','socket.io-emitter'];(function(_0x357b6e,_0x541b0f){var _0x205aac=function(_0x329ace){while(--_0x329ace){_0x357b6e['push'](_0x357b6e['shift']());}};_0x205aac(++_0x541b0f);}(_0xf0cc,0xa7));var _0xcf0c=function(_0x34c2bb,_0x31d716){_0x34c2bb=_0x34c2bb-0x0;var _0x1aa494=_0xf0cc[_0x34c2bb];return _0x1aa494;};'use strict';var _=require(_0xcf0c('0x0'));var Redis=require('ioredis');var logger=require('../../config/logger')(_0xcf0c('0x1'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var socket=require(_0xcf0c('0x2'))(new Redis(config[_0xcf0c('0x3')]));require('./user-setting.socket')['register'](socket);config[_0xcf0c('0x3')]=_[_0xcf0c('0x4')](config[_0xcf0c('0x3')],{'host':'localhost','port':0x18eb});function respondWithResult(_0x346cb0,_0x1503f6){_0x1503f6=_0x1503f6||0xc8;return function(_0x2cb15a){if(_0x2cb15a){return _0x346cb0['status'](_0x1503f6)['json'](_0x2cb15a);}};}function saveUpdates(_0x3cf3cb){return function(_0x53a853){if(_0x53a853){return _0x53a853[_0xcf0c('0x5')](_0x3cf3cb)['then'](function(_0x291141){return _0x291141;});}return null;};}function handleEntityNotFound(_0x1a8e08){return function(_0x16190b){if(!_0x16190b){_0x1a8e08[_0xcf0c('0x6')](0x194);}return _0x16190b;};}function handleError(_0x3ba6ab,_0x817634){_0x817634=_0x817634||0x1f4;return function(_0x39375d){logger['error'](_0x39375d[_0xcf0c('0x7')]);if(_0x39375d[_0xcf0c('0x8')]){delete _0x39375d[_0xcf0c('0x8')];}_0x3ba6ab[_0xcf0c('0x9')](_0x817634)[_0xcf0c('0xa')](_0x39375d);};}exports['update']=function(_0x540eae,_0x395d90){if(_0x540eae[_0xcf0c('0xb')]['role']!=='admin')throw new Error(_0xcf0c('0xc'));if(isNaN(Number(_0x540eae['params']['id'])))throw new Error(_0xcf0c('0xd'));return db[_0xcf0c('0xe')]['find']({'where':{'id':_0x540eae['params']['id']}})['then'](handleEntityNotFound(_0x395d90,null))[_0xcf0c('0xf')](saveUpdates(_0x540eae['body'],null))[_0xcf0c('0xf')](respondWithResult(_0x395d90,null))[_0xcf0c('0x10')](handleError(_0x395d90,null));}; \ No newline at end of file +var _0x2821=['error','stack','name','send','update','user','role','admin','params','UserSetting','find','body','catch','lodash','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','./user-setting.socket','defaults','localhost','json','then','sendStatus'];(function(_0x458ed6,_0x504646){var _0xa5dfd9=function(_0x504e7b){while(--_0x504e7b){_0x458ed6['push'](_0x458ed6['shift']());}};_0xa5dfd9(++_0x504646);}(_0x2821,0xc3));var _0x1282=function(_0x320873,_0x17e7d5){_0x320873=_0x320873-0x0;var _0x5cf0f4=_0x2821[_0x320873];return _0x5cf0f4;};'use strict';var _=require(_0x1282('0x0'));var Redis=require(_0x1282('0x1'));var logger=require(_0x1282('0x2'))(_0x1282('0x3'));var config=require(_0x1282('0x4'));var db=require(_0x1282('0x5'))['db'];var socket=require('socket.io-emitter')(new Redis(config[_0x1282('0x6')]));require(_0x1282('0x7'))['register'](socket);config[_0x1282('0x6')]=_[_0x1282('0x8')](config[_0x1282('0x6')],{'host':_0x1282('0x9'),'port':0x18eb});function respondWithResult(_0xb5be26,_0x17a244){_0x17a244=_0x17a244||0xc8;return function(_0x296ffc){if(_0x296ffc){return _0xb5be26['status'](_0x17a244)[_0x1282('0xa')](_0x296ffc);}};}function saveUpdates(_0x48349c){return function(_0x5cb6b6){if(_0x5cb6b6){return _0x5cb6b6['update'](_0x48349c)[_0x1282('0xb')](function(_0xb4f761){return _0xb4f761;});}return null;};}function handleEntityNotFound(_0x3aba30){return function(_0x5c34ec){if(!_0x5c34ec){_0x3aba30[_0x1282('0xc')](0x194);}return _0x5c34ec;};}function handleError(_0x1cbfdd,_0x4c8105){_0x4c8105=_0x4c8105||0x1f4;return function(_0x484dca){logger[_0x1282('0xd')](_0x484dca[_0x1282('0xe')]);if(_0x484dca[_0x1282('0xf')]){delete _0x484dca['name'];}_0x1cbfdd['status'](_0x4c8105)[_0x1282('0x10')](_0x484dca);};}exports[_0x1282('0x11')]=function(_0x548899,_0x1ce472){if(_0x548899[_0x1282('0x12')][_0x1282('0x13')]!==_0x1282('0x14'))throw new Error('Unauthorized');if(isNaN(Number(_0x548899[_0x1282('0x15')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x1282('0x16')][_0x1282('0x17')]({'where':{'id':_0x548899['params']['id']}})[_0x1282('0xb')](handleEntityNotFound(_0x1ce472,null))[_0x1282('0xb')](saveUpdates(_0x548899[_0x1282('0x18')],null))['then'](respondWithResult(_0x1ce472,null))[_0x1282('0x19')](handleError(_0x1ce472,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 2950220..9d42a88 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 _0x5dab=['setMaxListeners','save','update','remove','emit','../../mysqldb'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x5dab,0xad));var _0xb5da=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x5dab[_0x40ac5e];return _0x2839d6;};'use strict';var EventEmitter=require('events');var UserSetting=require(_0xb5da('0x0'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xb5da('0x1')](0x0);var events={'afterCreate':_0xb5da('0x2'),'afterUpdate':_0xb5da('0x3'),'afterDestroy':_0xb5da('0x4')};function emitEvent(_0xcb185f){return function(_0x388f01,_0x780a45,_0x181312){UserSettingEvents[_0xb5da('0x5')](_0xcb185f+':'+_0x388f01['id'],_0x388f01);UserSettingEvents[_0xb5da('0x5')](_0xcb185f,_0x388f01);_0x181312(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting['hook'](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file +var _0x6cfa=['UserSetting','setMaxListeners','save','update','hasOwnProperty','hook','exports'];(function(_0x430459,_0x58519c){var _0x3a2439=function(_0x27a0b3){while(--_0x27a0b3){_0x430459['push'](_0x430459['shift']());}};_0x3a2439(++_0x58519c);}(_0x6cfa,0xd9));var _0xa6cf=function(_0x3e7728,_0x57e609){_0x3e7728=_0x3e7728-0x0;var _0x5992ae=_0x6cfa[_0x3e7728];return _0x5992ae;};'use strict';var EventEmitter=require('events');var UserSetting=require('../../mysqldb')['db'][_0xa6cf('0x0')];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0xa6cf('0x1')](0x0);var events={'afterCreate':_0xa6cf('0x2'),'afterUpdate':_0xa6cf('0x3'),'afterDestroy':'remove'};function emitEvent(_0x24a3d1){return function(_0x5ae180,_0x6155e9,_0x2a6e5b){UserSettingEvents['emit'](_0x24a3d1+':'+_0x5ae180['id'],_0x5ae180);UserSettingEvents['emit'](_0x24a3d1,_0x5ae180);_0x2a6e5b(null);};}for(var e in events){if(events[_0xa6cf('0x4')](e)){var event=events[e];UserSetting[_0xa6cf('0x5')](e,emitEvent(event));}}module[_0xa6cf('0x6')]=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 2a0f934..f2f4a0b 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 _0x9147=['define','user_settings','clientSideLoggingEnabledSince','./user-setting.attributes','exports'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9147,0x7b));var _0x7914=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x9147[_0x2a6809];return _0x11c371;};'use strict';var attributes=require(_0x7914('0x0'));module[_0x7914('0x1')]=function(_0x4c49ca){return _0x4c49ca[_0x7914('0x2')]('UserSetting',attributes,{'tableName':_0x7914('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b3ab2){if(!_0x2b3ab2['clientSideLoggingEnabled'])_0x2b3ab2[_0x7914('0x4')]=null;else if(_0x2b3ab2[_0x7914('0x4')]===null)_0x2b3ab2[_0x7914('0x4')]=new Date();}}});}; \ No newline at end of file +var _0xa249=['UserSetting','clientSideLoggingEnabledSince','./user-setting.attributes','exports','define'];(function(_0x15332e,_0x35090d){var _0x1e018d=function(_0x47238a){while(--_0x47238a){_0x15332e['push'](_0x15332e['shift']());}};_0x1e018d(++_0x35090d);}(_0xa249,0x183));var _0x9a24=function(_0x314039,_0x3641bb){_0x314039=_0x314039-0x0;var _0x3bcbbe=_0xa249[_0x314039];return _0x3bcbbe;};'use strict';var attributes=require(_0x9a24('0x0'));module[_0x9a24('0x1')]=function(_0x4811ed){return _0x4811ed[_0x9a24('0x2')](_0x9a24('0x3'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x12ef32){if(!_0x12ef32['clientSideLoggingEnabled'])_0x12ef32[_0x9a24('0x4')]=null;else if(_0x12ef32['clientSideLoggingEnabledSince']===null)_0x12ef32['clientSideLoggingEnabledSince']=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 d459cdb..69dfdcc 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 _0x65d9=['save','emit','user-setting:update','user-setting:update:user-','register','length','user-setting:','./user-setting.events'];(function(_0x3f71e6,_0x156722){var _0x50409b=function(_0x8144ae){while(--_0x8144ae){_0x3f71e6['push'](_0x3f71e6['shift']());}};_0x50409b(++_0x156722);}(_0x65d9,0xaf));var _0x965d=function(_0x2b8ff9,_0x25cdbf){_0x2b8ff9=_0x2b8ff9-0x0;var _0x1692a5=_0x65d9[_0x2b8ff9];return _0x1692a5;};'use strict';var UserSettingEvents=require(_0x965d('0x0'));var events=[_0x965d('0x1'),'remove','update'];function createListener(_0x2d2ebe,_0x256421){return function(_0x5ebf14){_0x256421[_0x965d('0x2')](_0x2d2ebe,_0x5ebf14);if(_0x2d2ebe===_0x965d('0x3')){_0x256421['emit'](_0x965d('0x4')+_0x5ebf14['UserId'],_0x5ebf14);}};}exports[_0x965d('0x5')]=function(_0x3967b8){for(var _0x126a28=0x0,_0x35e101=events[_0x965d('0x6')];_0x126a28<_0x35e101;_0x126a28++){var _0x361fb7=events[_0x126a28];var _0x160edf=createListener(_0x965d('0x7')+_0x361fb7,_0x3967b8);UserSettingEvents['on'](_0x361fb7,_0x160edf);}}; \ No newline at end of file +var _0x1bb4=['save','remove','update','user-setting:update','user-setting:update:user-','UserId','register','user-setting:','./user-setting.events'];(function(_0x3d2521,_0x510ca8){var _0x4afc98=function(_0x4c3d8c){while(--_0x4c3d8c){_0x3d2521['push'](_0x3d2521['shift']());}};_0x4afc98(++_0x510ca8);}(_0x1bb4,0x131));var _0x41bb=function(_0x43b8de,_0x4b3880){_0x43b8de=_0x43b8de-0x0;var _0x447485=_0x1bb4[_0x43b8de];return _0x447485;};'use strict';var UserSettingEvents=require(_0x41bb('0x0'));var events=[_0x41bb('0x1'),_0x41bb('0x2'),_0x41bb('0x3')];function createListener(_0x3fcf5b,_0x361ca4){return function(_0x3377b2){_0x361ca4['emit'](_0x3fcf5b,_0x3377b2);if(_0x3fcf5b===_0x41bb('0x4')){_0x361ca4['emit'](_0x41bb('0x5')+_0x3377b2[_0x41bb('0x6')],_0x3377b2);}};}exports[_0x41bb('0x7')]=function(_0x5688e4){for(var _0x11ce5b=0x0,_0x92b791=events['length'];_0x11ce5b<_0x92b791;_0x11ce5b++){var _0x35ada5=events[_0x11ce5b];var _0x1da9a2=createListener(_0x41bb('0x8')+_0x35ada5,_0x5688e4);UserSettingEvents['on'](_0x35ada5,_0x1da9a2);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 880ec08..9cbe541 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 _0x9330=['/describe','isAuthenticated','describe','get','/whoami','getPresence','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/recordings','getRecordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','getChatWebsites','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','post','/:id/contacts','addContacts','create','bulkCreate','addQueues','diskStorage','root','server/files/images/','format','now','file','addAvatar','/:id/login','login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','addTeams','addChatInteractions','/:id/mail_interactions','/:id/fax_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','/:id/chat_websites','addChatWebsites','/:id/whatsapp_accounts','createApiKey','put','/:id/password','removeQueues','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','/:id/sms_interactions','removeOpenchannelInteractions','removeWhatsappInteractions','/:id/fax_accounts','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','/:id/api_key','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller'];(function(_0x369637,_0x3e6096){var _0x133c0f=function(_0x152014){while(--_0x152014){_0x369637['push'](_0x369637['shift']());}};_0x133c0f(++_0x3e6096);}(_0x9330,0xd3));var _0x0933=function(_0x35352d,_0x4dd1a5){_0x35352d=_0x35352d-0x0;var _0x20dae=_0x9330[_0x35352d];return _0x20dae;};'use strict';var multer=require(_0x0933('0x0'));var util=require(_0x0933('0x1'));var path=require('path');var timeout=require(_0x0933('0x2'));var express=require('express');var router=express[_0x0933('0x3')]();var fs_extra=require(_0x0933('0x4'));var auth=require(_0x0933('0x5'));var interaction=require(_0x0933('0x6'));var config=require(_0x0933('0x7'));var controller=require(_0x0933('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0933('0x9'),auth[_0x0933('0xa')](),controller[_0x0933('0xb')]);router[_0x0933('0xc')](_0x0933('0xd'),auth[_0x0933('0xa')](),controller['whoami']);router['get']('/presence',auth[_0x0933('0xa')](),controller[_0x0933('0xe')]);router[_0x0933('0xc')](_0x0933('0xf'),auth['isAuthenticated'](),controller[_0x0933('0x10')]);router['get'](_0x0933('0x11'),controller[_0x0933('0x12')]);router[_0x0933('0xc')](_0x0933('0x13'),auth[_0x0933('0xa')](),controller[_0x0933('0x14')]);router[_0x0933('0xc')]('/:id/contacts',auth[_0x0933('0xa')](),controller[_0x0933('0x15')]);router[_0x0933('0xc')](_0x0933('0x16'),auth[_0x0933('0xa')](),controller[_0x0933('0x17')]);router['get']('/:id/queues_rt',auth[_0x0933('0xa')](),controller[_0x0933('0x18')]);router['get']('/:id/groups',auth['isAuthenticated'](),controller['getGroups']);router['get'](_0x0933('0x19'),auth[_0x0933('0xa')](),controller[_0x0933('0x1a')]);router[_0x0933('0xc')]('/:id/screen_recordings',auth[_0x0933('0xa')](),controller[_0x0933('0x1b')]);router[_0x0933('0xc')](_0x0933('0x1c'),auth[_0x0933('0xa')](),controller['getChatInteractions']);router[_0x0933('0xc')](_0x0933('0x1d'),auth[_0x0933('0xa')](),controller['getOpenchannelInteractions']);router[_0x0933('0xc')](_0x0933('0x1e'),auth[_0x0933('0xa')](),controller[_0x0933('0x1f')]);router['get'](_0x0933('0x20'),auth[_0x0933('0xa')](),controller[_0x0933('0x21')]);router[_0x0933('0xc')]('/:id/fax/interactions',auth[_0x0933('0xa')](),controller['getFaxInteractions']);router[_0x0933('0xc')](_0x0933('0x22'),auth[_0x0933('0xa')](),controller[_0x0933('0x23')]);router[_0x0933('0xc')](_0x0933('0x24'),auth[_0x0933('0xa')](),controller[_0x0933('0x25')]);router[_0x0933('0xc')](_0x0933('0x26'),auth['isAuthenticated'](),controller[_0x0933('0x27')]);router[_0x0933('0xc')](_0x0933('0x28'),auth['isAuthenticated'](),controller[_0x0933('0x29')]);router[_0x0933('0xc')](_0x0933('0x2a'),auth[_0x0933('0xa')](),controller[_0x0933('0x2b')]);router['get']('/:id/fax_accounts',auth[_0x0933('0xa')](),controller[_0x0933('0x2c')]);router[_0x0933('0xc')](_0x0933('0x2d'),auth[_0x0933('0xa')](),controller['getMailAccounts']);router[_0x0933('0xc')](_0x0933('0x2e'),auth[_0x0933('0xa')](),controller['getOpenchannelAccounts']);router[_0x0933('0xc')](_0x0933('0x2f'),auth[_0x0933('0xa')](),controller[_0x0933('0x30')]);router[_0x0933('0xc')]('/:id/chat_websites',auth[_0x0933('0xa')](),controller[_0x0933('0x31')]);router['get']('/:id/whatsapp_accounts',auth[_0x0933('0xa')](),controller[_0x0933('0x32')]);router[_0x0933('0xc')](_0x0933('0x33'),auth['isAuthenticated'](),controller[_0x0933('0x34')]);router['get']('/:id/api_key',auth['isAuthenticated'](),controller['getApiKey']);router[_0x0933('0x35')](_0x0933('0x36'),auth[_0x0933('0xa')](),controller[_0x0933('0x37')]);router[_0x0933('0x35')]('/',auth['isAuthenticated'](),controller[_0x0933('0x38')]);router[_0x0933('0x35')]('/create_many',auth['isAuthenticated'](),controller[_0x0933('0x39')]);router[_0x0933('0x35')](_0x0933('0x16'),auth[_0x0933('0xa')](),controller[_0x0933('0x3a')]);var upload=multer({'storage':multer[_0x0933('0x3b')]({'destination':function(_0x2c0fb8,_0x5f5b9b,_0x124980){_0x124980(null,path['join'](config[_0x0933('0x3c')],_0x0933('0x3d')));},'filename':function(_0x2e9752,_0x375e3c,_0x367d1d){_0x367d1d(null,util[_0x0933('0x3e')]('%s-%s',Date[_0x0933('0x3f')](),_0x375e3c['originalname']));}})});router[_0x0933('0x35')](_0x0933('0x11'),upload['single'](_0x0933('0x40')),controller[_0x0933('0x41')]);router['post'](_0x0933('0x42'),auth['isAuthenticated'](),controller[_0x0933('0x43')]);router[_0x0933('0x35')](_0x0933('0x44'),auth[_0x0933('0xa')](),controller[_0x0933('0x45')]);router[_0x0933('0x35')](_0x0933('0x46'),auth['isAuthenticated'](),controller[_0x0933('0x47')]);router[_0x0933('0x35')](_0x0933('0x48'),auth[_0x0933('0xa')](),controller['unpause']);router[_0x0933('0x35')](_0x0933('0x24'),auth['isAuthenticated'](),controller[_0x0933('0x49')]);router[_0x0933('0x35')]('/:id/chat_interactions',auth['isAuthenticated'](),controller[_0x0933('0x4a')]);router[_0x0933('0x35')](_0x0933('0x4b'),auth['isAuthenticated'](),controller['addMailInteractions']);router['post'](_0x0933('0x4c'),auth[_0x0933('0xa')](),controller['addFaxInteractions']);router[_0x0933('0x35')]('/:id/sms_interactions',auth[_0x0933('0xa')](),controller[_0x0933('0x4d')]);router[_0x0933('0x35')](_0x0933('0x4e'),auth['isAuthenticated'](),controller[_0x0933('0x4f')]);router[_0x0933('0x35')](_0x0933('0x50'),auth[_0x0933('0xa')](),controller[_0x0933('0x51')]);router['post']('/:id/fax_accounts',auth[_0x0933('0xa')](),controller['addFaxAccounts']);router['post'](_0x0933('0x2d'),auth['isAuthenticated'](),controller[_0x0933('0x52')]);router[_0x0933('0x35')](_0x0933('0x2e'),auth['isAuthenticated'](),controller[_0x0933('0x53')]);router[_0x0933('0x35')]('/:id/sms_accounts',auth[_0x0933('0xa')](),controller['addSmsAccounts']);router[_0x0933('0x35')](_0x0933('0x54'),auth[_0x0933('0xa')](),controller[_0x0933('0x55')]);router[_0x0933('0x35')](_0x0933('0x56'),auth[_0x0933('0xa')](),controller['addWhatsappAccounts']);router[_0x0933('0x35')]('/:id/api_key',auth[_0x0933('0xa')](),controller[_0x0933('0x57')]);router[_0x0933('0x58')]('/:id',auth[_0x0933('0xa')](),controller['update']);router[_0x0933('0x58')](_0x0933('0x59'),auth[_0x0933('0xa')](),controller['changePassword']);router['delete'](_0x0933('0x16'),auth['isAuthenticated'](),controller[_0x0933('0x5a')]);router[_0x0933('0x5b')](_0x0933('0x24'),auth['isAuthenticated'](),controller[_0x0933('0x5c')]);router[_0x0933('0x5b')](_0x0933('0xf'),auth[_0x0933('0xa')](),controller[_0x0933('0x5d')]);router['delete']('/:id/chat_interactions',auth[_0x0933('0xa')](),controller[_0x0933('0x5e')]);router[_0x0933('0x5b')]('/:id/mail_interactions',auth['isAuthenticated'](),controller[_0x0933('0x5f')]);router[_0x0933('0x5b')]('/:id/fax_interactions',auth[_0x0933('0xa')](),controller['removeFaxInteractions']);router['delete'](_0x0933('0x60'),auth['isAuthenticated'](),controller['removeSmsInteractions']);router[_0x0933('0x5b')](_0x0933('0x4e'),auth['isAuthenticated'](),controller[_0x0933('0x61')]);router[_0x0933('0x5b')](_0x0933('0x50'),auth[_0x0933('0xa')](),controller[_0x0933('0x62')]);router[_0x0933('0x5b')](_0x0933('0x63'),auth[_0x0933('0xa')](),controller[_0x0933('0x64')]);router[_0x0933('0x5b')](_0x0933('0x2d'),auth['isAuthenticated'](),controller[_0x0933('0x65')]);router[_0x0933('0x5b')](_0x0933('0x2e'),auth[_0x0933('0xa')](),controller[_0x0933('0x66')]);router[_0x0933('0x5b')](_0x0933('0x2f'),auth['isAuthenticated'](),controller[_0x0933('0x67')]);router['delete'](_0x0933('0x54'),auth[_0x0933('0xa')](),controller[_0x0933('0x68')]);router['delete']('/:id/whatsapp_accounts',auth[_0x0933('0xa')](),controller[_0x0933('0x69')]);router[_0x0933('0x5b')](_0x0933('0x6a'),auth[_0x0933('0xa')](),controller[_0x0933('0x6b')]);router[_0x0933('0x35')](_0x0933('0x6c'),auth[_0x0933('0xa')](),controller[_0x0933('0x6d')]);module['exports']=router; \ No newline at end of file +var _0x814d=['addChatWebsites','addWhatsappAccounts','createApiKey','put','/:id/password','changePassword','delete','removeQueues','removeTeams','destroy','removeChatInteractions','/:id/fax_interactions','removeFaxInteractions','removeSmsInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','/:id/messengerSoundNotification','messengerSoundNotification','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','describe','/whoami','whoami','/presence','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','/:id/sms/interactions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getAgents','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','getMailAccounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','/create_many','addQueues','diskStorage','root','server/files/images/','now','originalname','file','addAvatar','/:id/login','/:id/logout','/:id/pause','pause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addFaxAccounts','addOpenchannelAccounts','addSmsAccounts'];(function(_0x3b1e3f,_0xf8826b){var _0x3b1cd3=function(_0x26ad44){while(--_0x26ad44){_0x3b1e3f['push'](_0x3b1e3f['shift']());}};_0x3b1cd3(++_0xf8826b);}(_0x814d,0xf7));var _0xd814=function(_0x2515c0,_0x558cae){_0x2515c0=_0x2515c0-0x0;var _0x43c395=_0x814d[_0x2515c0];return _0x43c395;};'use strict';var multer=require(_0xd814('0x0'));var util=require(_0xd814('0x1'));var path=require(_0xd814('0x2'));var timeout=require(_0xd814('0x3'));var express=require('express');var router=express[_0xd814('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd814('0x5'));var interaction=require(_0xd814('0x6'));var config=require(_0xd814('0x7'));var controller=require(_0xd814('0x8'));router[_0xd814('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xd814('0x9')]('/describe',auth[_0xd814('0xa')](),controller[_0xd814('0xb')]);router[_0xd814('0x9')](_0xd814('0xc'),auth[_0xd814('0xa')](),controller[_0xd814('0xd')]);router[_0xd814('0x9')](_0xd814('0xe'),auth[_0xd814('0xa')](),controller['getPresence']);router[_0xd814('0x9')]('/:id',auth[_0xd814('0xa')](),controller[_0xd814('0xf')]);router['get'](_0xd814('0x10'),controller[_0xd814('0x11')]);router[_0xd814('0x9')](_0xd814('0x12'),auth[_0xd814('0xa')](),controller['getOpenTabs']);router[_0xd814('0x9')](_0xd814('0x13'),auth[_0xd814('0xa')](),controller[_0xd814('0x14')]);router[_0xd814('0x9')](_0xd814('0x15'),auth[_0xd814('0xa')](),controller[_0xd814('0x16')]);router[_0xd814('0x9')]('/:id/queues_rt',auth[_0xd814('0xa')](),controller[_0xd814('0x17')]);router['get'](_0xd814('0x18'),auth[_0xd814('0xa')](),controller[_0xd814('0x19')]);router[_0xd814('0x9')](_0xd814('0x1a'),auth[_0xd814('0xa')](),controller[_0xd814('0x1b')]);router[_0xd814('0x9')](_0xd814('0x1c'),auth[_0xd814('0xa')](),controller[_0xd814('0x1d')]);router[_0xd814('0x9')](_0xd814('0x1e'),auth[_0xd814('0xa')](),controller['getChatInteractions']);router['get'](_0xd814('0x1f'),auth[_0xd814('0xa')](),controller[_0xd814('0x20')]);router['get'](_0xd814('0x21'),auth['isAuthenticated'](),controller[_0xd814('0x22')]);router[_0xd814('0x9')](_0xd814('0x23'),auth[_0xd814('0xa')](),controller[_0xd814('0x24')]);router[_0xd814('0x9')]('/:id/fax/interactions',auth[_0xd814('0xa')](),controller['getFaxInteractions']);router[_0xd814('0x9')](_0xd814('0x25'),auth[_0xd814('0xa')](),controller[_0xd814('0x26')]);router[_0xd814('0x9')](_0xd814('0x27'),auth['isAuthenticated'](),controller['getTeams']);router[_0xd814('0x9')]('/:id/lists',auth[_0xd814('0xa')](),controller['getLists']);router[_0xd814('0x9')]('/:id/agents',auth[_0xd814('0xa')](),controller[_0xd814('0x28')]);router['get']('/:id/prefixes',auth['isAuthenticated'](),controller[_0xd814('0x29')]);router[_0xd814('0x9')](_0xd814('0x2a'),auth[_0xd814('0xa')](),controller[_0xd814('0x2b')]);router['get'](_0xd814('0x2c'),auth['isAuthenticated'](),controller[_0xd814('0x2d')]);router[_0xd814('0x9')]('/:id/openchannel_accounts',auth[_0xd814('0xa')](),controller[_0xd814('0x2e')]);router[_0xd814('0x9')](_0xd814('0x2f'),auth[_0xd814('0xa')](),controller[_0xd814('0x30')]);router[_0xd814('0x9')](_0xd814('0x31'),auth['isAuthenticated'](),controller['getChatWebsites']);router['get'](_0xd814('0x32'),auth[_0xd814('0xa')](),controller[_0xd814('0x33')]);router['get'](_0xd814('0x34'),auth[_0xd814('0xa')](),controller[_0xd814('0x35')]);router[_0xd814('0x9')](_0xd814('0x36'),auth[_0xd814('0xa')](),controller[_0xd814('0x37')]);router[_0xd814('0x38')]('/:id/contacts',auth[_0xd814('0xa')](),controller[_0xd814('0x39')]);router[_0xd814('0x38')]('/',auth[_0xd814('0xa')](),controller[_0xd814('0x3a')]);router[_0xd814('0x38')](_0xd814('0x3b'),auth[_0xd814('0xa')](),controller['bulkCreate']);router['post']('/:id/queues',auth[_0xd814('0xa')](),controller[_0xd814('0x3c')]);var upload=multer({'storage':multer[_0xd814('0x3d')]({'destination':function(_0x590b5c,_0x24cf23,_0x11b0ca){_0x11b0ca(null,path['join'](config[_0xd814('0x3e')],_0xd814('0x3f')));},'filename':function(_0x1ce741,_0xbeb941,_0x4faa25){_0x4faa25(null,util['format']('%s-%s',Date[_0xd814('0x40')](),_0xbeb941[_0xd814('0x41')]));}})});router['post'](_0xd814('0x10'),upload['single'](_0xd814('0x42')),controller[_0xd814('0x43')]);router[_0xd814('0x38')](_0xd814('0x44'),auth['isAuthenticated'](),controller['login']);router[_0xd814('0x38')](_0xd814('0x45'),auth['isAuthenticated'](),controller['logout']);router[_0xd814('0x38')](_0xd814('0x46'),auth['isAuthenticated'](),controller[_0xd814('0x47')]);router[_0xd814('0x38')]('/:id/unpause',auth[_0xd814('0xa')](),controller[_0xd814('0x48')]);router[_0xd814('0x38')](_0xd814('0x27'),auth[_0xd814('0xa')](),controller[_0xd814('0x49')]);router[_0xd814('0x38')](_0xd814('0x4a'),auth['isAuthenticated'](),controller[_0xd814('0x4b')]);router[_0xd814('0x38')](_0xd814('0x4c'),auth[_0xd814('0xa')](),controller['addMailInteractions']);router[_0xd814('0x38')]('/:id/fax_interactions',auth['isAuthenticated'](),controller[_0xd814('0x4d')]);router[_0xd814('0x38')](_0xd814('0x4e'),auth[_0xd814('0xa')](),controller[_0xd814('0x4f')]);router['post'](_0xd814('0x50'),auth[_0xd814('0xa')](),controller[_0xd814('0x51')]);router[_0xd814('0x38')](_0xd814('0x52'),auth[_0xd814('0xa')](),controller['addWhatsappInteractions']);router[_0xd814('0x38')]('/:id/fax_accounts',auth[_0xd814('0xa')](),controller[_0xd814('0x53')]);router[_0xd814('0x38')](_0xd814('0x2c'),auth['isAuthenticated'](),controller['addMailAccounts']);router['post']('/:id/openchannel_accounts',auth[_0xd814('0xa')](),controller[_0xd814('0x54')]);router[_0xd814('0x38')](_0xd814('0x2f'),auth[_0xd814('0xa')](),controller[_0xd814('0x55')]);router[_0xd814('0x38')](_0xd814('0x31'),auth[_0xd814('0xa')](),controller[_0xd814('0x56')]);router[_0xd814('0x38')](_0xd814('0x32'),auth[_0xd814('0xa')](),controller[_0xd814('0x57')]);router[_0xd814('0x38')](_0xd814('0x36'),auth[_0xd814('0xa')](),controller[_0xd814('0x58')]);router[_0xd814('0x59')]('/:id',auth[_0xd814('0xa')](),controller['update']);router[_0xd814('0x59')](_0xd814('0x5a'),auth[_0xd814('0xa')](),controller[_0xd814('0x5b')]);router[_0xd814('0x5c')](_0xd814('0x15'),auth[_0xd814('0xa')](),controller[_0xd814('0x5d')]);router[_0xd814('0x5c')](_0xd814('0x27'),auth[_0xd814('0xa')](),controller[_0xd814('0x5e')]);router[_0xd814('0x5c')]('/:id',auth['isAuthenticated'](),controller[_0xd814('0x5f')]);router[_0xd814('0x5c')](_0xd814('0x4a'),auth[_0xd814('0xa')](),controller[_0xd814('0x60')]);router[_0xd814('0x5c')]('/:id/mail_interactions',auth[_0xd814('0xa')](),controller['removeMailInteractions']);router[_0xd814('0x5c')](_0xd814('0x61'),auth['isAuthenticated'](),controller[_0xd814('0x62')]);router[_0xd814('0x5c')](_0xd814('0x4e'),auth[_0xd814('0xa')](),controller[_0xd814('0x63')]);router[_0xd814('0x5c')](_0xd814('0x50'),auth['isAuthenticated'](),controller[_0xd814('0x64')]);router['delete'](_0xd814('0x52'),auth[_0xd814('0xa')](),controller[_0xd814('0x65')]);router[_0xd814('0x5c')](_0xd814('0x2a'),auth['isAuthenticated'](),controller[_0xd814('0x66')]);router[_0xd814('0x5c')]('/:id/mail_accounts',auth[_0xd814('0xa')](),controller[_0xd814('0x67')]);router[_0xd814('0x5c')]('/:id/openchannel_accounts',auth[_0xd814('0xa')](),controller[_0xd814('0x68')]);router[_0xd814('0x5c')](_0xd814('0x2f'),auth[_0xd814('0xa')](),controller[_0xd814('0x69')]);router[_0xd814('0x5c')](_0xd814('0x31'),auth[_0xd814('0xa')](),controller[_0xd814('0x6a')]);router[_0xd814('0x5c')](_0xd814('0x32'),auth[_0xd814('0xa')](),controller['removeWhatsappAccounts']);router[_0xd814('0x5c')](_0xd814('0x36'),auth['isAuthenticated'](),controller[_0xd814('0x6b')]);router['post'](_0xd814('0x6c'),auth[_0xd814('0xa')](),controller[_0xd814('0x6d')]);module[_0xd814('0x6e')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index 24cc2f1..60c8b2b 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 _0x3f9c=['allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','\x22\x22\x20<>','always','refuse','originate','uac','uas','fingerprint','certificate','active','passive','update,nonat','DATE','TEXT','showWebBar','get','isArray','wss','encryption','force_avp','icesupport','dtlsverify','dtlscertfile','dtlsprivatekey','rtcp_mux','avpf','dtlssetup','/etc/pki/tls/certs/motion.crt','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','screenrecording','blocked','loginAttempts','blockedAt','UNSIGNED','sequelize','moment','util','lodash','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','STRING','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','admin','agent','telephone','local','INTEGER','internal','accountcode','BOOLEAN','DEFAULT\x20PAUSE','dynamic','ENUM','friend','user','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm'];(function(_0x4b27c6,_0x5bf653){var _0x54ae89=function(_0x5cd51f){while(--_0x5cd51f){_0x4b27c6['push'](_0x4b27c6['shift']());}};_0x54ae89(++_0x5bf653);}(_0x3f9c,0xea));var _0xc3f9=function(_0x4601c3,_0x5e6210){_0x4601c3=_0x4601c3-0x0;var _0xe1d1e2=_0x3f9c[_0x4601c3];return _0xe1d1e2;};'use strict';var Sequelize=require(_0xc3f9('0x0'));var moment=require(_0xc3f9('0x1'));var util=require(_0xc3f9('0x2'));var _=require(_0xc3f9('0x3'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xc3f9('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x46d5f3){this[_0xc3f9('0x5')](_0xc3f9('0x4'),_0x46d5f3);this[_0xc3f9('0x5')](_0xc3f9('0x6'),_0x46d5f3);},'comment':_0xc3f9('0x7')},'fullname':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':![],'set':function(_0x430cd9){this['setDataValue'](_0xc3f9('0x9'),_0x430cd9);this[_0xc3f9('0x5')](_0xc3f9('0xa'),util[_0xc3f9('0xb')](_0xc3f9('0xc'),_0x430cd9,this[_0xc3f9('0xd')]('internal')));}},'alias':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':'email','validate':{'isEmail':!![]},'set':function(_0xd6892a){if(_0xd6892a){this['setDataValue'](_0xc3f9('0xe'),_0xd6892a[_0xc3f9('0xf')]());}}},'role':{'type':Sequelize['ENUM'](_0xc3f9('0x10'),'user',_0xc3f9('0x11'),_0xc3f9('0x12')),'allowNull':![]},'password':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xc3f9('0x8')],'defaultValue':_0xc3f9('0x13')},'internal':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':![],'unique':_0xc3f9('0x15'),'set':function(_0x428f2d){this[_0xc3f9('0x5')](_0xc3f9('0x15'),_0x428f2d);this['setDataValue'](_0xc3f9('0x16'),_0x428f2d);this['setDataValue']('callerid',util[_0xc3f9('0xb')](_0xc3f9('0xc'),this['getDataValue'](_0xc3f9('0x9')),_0x428f2d));}},'salt':{'type':Sequelize[_0xc3f9('0x8')]},'phone':{'type':Sequelize[_0xc3f9('0x8')]},'mobile':{'type':Sequelize[_0xc3f9('0x8')]},'address':{'type':Sequelize[_0xc3f9('0x8')]},'zipcode':{'type':Sequelize[_0xc3f9('0x8')]},'userpic':{'type':Sequelize[_0xc3f9('0x8')]},'city':{'type':Sequelize[_0xc3f9('0x8')]},'country':{'type':Sequelize[_0xc3f9('0x8')]},'online':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xc3f9('0x8')],'defaultValue':_0xc3f9('0x18')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xc3f9('0x14')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xc3f9('0x14')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize['INTEGER'],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'host':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![],'defaultValue':_0xc3f9('0x19')},'ipaddr':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'port':{'type':Sequelize[_0xc3f9('0x14')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x1b'),_0xc3f9('0x1c'),_0xc3f9('0x1d')),'allowNull':!![],'defaultValue':_0xc3f9('0x1b')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xc3f9('0x1e')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xc3f9('0x1f'),_0xc3f9('0x20'),_0xc3f9('0x21'),_0xc3f9('0x22'),'PROHIB_PASSED_SCREEN',_0xc3f9('0x23'),_0xc3f9('0x24')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'secret':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'transport':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![],'defaultValue':_0xc3f9('0x25'),'set':function(_0x134a2d){this[_0xc3f9('0x5')](_0xc3f9('0x26'),_0x134a2d?_0x134a2d[_0xc3f9('0x27')](','):null);},'get':function(){return this['getDataValue'](_0xc3f9('0x26'))?this[_0xc3f9('0xd')]('transport')[_0xc3f9('0x28')](','):null;},'comment':_0xc3f9('0x29')},'dtmfmode':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2a'),_0xc3f9('0x2b'),'shortinfo','inband',_0xc3f9('0x2c')),'allowNull':!![],'defaultValue':_0xc3f9('0x2a')},'directmedia':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no',_0xc3f9('0x2e'),_0xc3f9('0x2f'),_0xc3f9('0x30')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'nat':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![],'defaultValue':_0xc3f9('0x31'),'set':function(_0x448ed9){this['setDataValue']('nat',_0x448ed9?_0x448ed9['join'](','):null);},'get':function(){return this[_0xc3f9('0xd')]('nat')?this[_0xc3f9('0xd')](_0xc3f9('0x32'))['split'](','):null;},'comment':_0xc3f9('0x33')},'callgroup':{'type':Sequelize[_0xc3f9('0x8')]},'namedcallgroup':{'type':Sequelize[_0xc3f9('0x8')]},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xc3f9('0x8')]},'language':{'type':Sequelize[_0xc3f9('0x8')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xc3f9('0x8')]},'disallow':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':![],'defaultValue':_0xc3f9('0x34')},'allow':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':![],'defaultValue':_0xc3f9('0x35'),'set':function(_0xdfb1dd){this[_0xc3f9('0x5')]('allow',_0xdfb1dd?_0xdfb1dd[_0xc3f9('0x27')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0xc3f9('0xd')](_0xc3f9('0x36'))?this[_0xc3f9('0xd')](_0xc3f9('0x36'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x5d3654){this[_0xc3f9('0x5')]('insecure',_0x5d3654?_0x5d3654[_0xc3f9('0x27')](','):null);},'get':function(){return this[_0xc3f9('0xd')](_0xc3f9('0x37'))?this[_0xc3f9('0xd')](_0xc3f9('0x37'))[_0xc3f9('0x28')](','):null;},'comment':_0xc3f9('0x38')},'trustrpid':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no',_0xc3f9('0x39')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize['STRING'],'allowNull':!![]},'callerid':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![],'defaultValue':_0xc3f9('0x3a')},'amaflags':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xc3f9('0x1a')]('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'template':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no',_0xc3f9('0x3b')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xc3f9('0x1a')]('accept',_0xc3f9('0x3c'),_0xc3f9('0x3d')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x3e'),'uas'),'allowNull':!![],'defaultValue':_0xc3f9('0x3f')},'t38pt_usertpsource':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'regexten':{'type':Sequelize['STRING'],'allowNull':!![]},'fromdomain':{'type':Sequelize['STRING'],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'timert1':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xc3f9('0x2d'),'no',_0xc3f9('0x40'),_0xc3f9('0x41')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x42'),_0xc3f9('0x43'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xc3f9('0x14')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xc3f9('0x1a')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no','nonat','update',_0xc3f9('0x44')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xc3f9('0x8')]},'resetPasswordExpires':{'type':Sequelize[_0xc3f9('0x45')]},'passwordResetAt':{'type':Sequelize[_0xc3f9('0x45')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xc3f9('0x46')]},'showWebBar':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0,'set':function(_0x349302){this[_0xc3f9('0x5')](_0xc3f9('0x47'),_0x349302);var _0x5db8e5=this[_0xc3f9('0x48')]({'plain':!![]});switch(_0x349302){case 0x0:case 0x1:var _0x82acbe=_0x5db8e5[_0xc3f9('0x26')]?_[_0xc3f9('0x49')](_0x5db8e5[_0xc3f9('0x26')])?_0x5db8e5['transport'][_0xc3f9('0x27')]():_0x5db8e5[_0xc3f9('0x26')]:'udp';if(_0x82acbe===_0xc3f9('0x4a')){_0x82acbe='udp';}this[_0xc3f9('0x5')](_0xc3f9('0x26'),_0x82acbe);this[_0xc3f9('0x5')](_0xc3f9('0x4b'),'no');this['setDataValue']('avpf',null);this[_0xc3f9('0x5')](_0xc3f9('0x4c'),null);this[_0xc3f9('0x5')](_0xc3f9('0x4d'),null);this[_0xc3f9('0x5')]('dtlsenable',null);this[_0xc3f9('0x5')](_0xc3f9('0x4e'),null);this[_0xc3f9('0x5')]('dtlssetup',null);this[_0xc3f9('0x5')](_0xc3f9('0x4f'),null);this[_0xc3f9('0x5')](_0xc3f9('0x50'),null);this[_0xc3f9('0x5')](_0xc3f9('0x51'),'no');break;case 0x2:this['setDataValue'](_0xc3f9('0x26'),_0xc3f9('0x4a'));this['setDataValue'](_0xc3f9('0x4b'),'yes');this[_0xc3f9('0x5')](_0xc3f9('0x52'),'yes');this[_0xc3f9('0x5')]('force_avp',_0xc3f9('0x2d'));this[_0xc3f9('0x5')](_0xc3f9('0x4d'),'yes');this['setDataValue']('dtlsenable',_0xc3f9('0x2d'));this[_0xc3f9('0x5')](_0xc3f9('0x4e'),'no');this[_0xc3f9('0x5')](_0xc3f9('0x53'),'actpass');this[_0xc3f9('0x5')](_0xc3f9('0x4f'),_0x5db8e5[_0xc3f9('0x4f')]||_0xc3f9('0x54'));this[_0xc3f9('0x5')](_0xc3f9('0x50'),_0x5db8e5[_0xc3f9('0x50')]||'/etc/pki/tls/private/motion.key');this[_0xc3f9('0x5')](_0xc3f9('0x51'),'yes');break;default:}}},'permissions':{'type':Sequelize[_0xc3f9('0x46')],'set':function(_0x17bffc){this[_0xc3f9('0x5')](_0xc3f9('0x55'),_0x17bffc?_0x17bffc[_0xc3f9('0x27')](','):[]);},'get':function(){return this[_0xc3f9('0xd')](_0xc3f9('0x55'))?_[_0xc3f9('0x56')](this['getDataValue'](_0xc3f9('0x55'))[_0xc3f9('0x28')](','),function(_0x46093f){return parseInt(_0x46093f,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xc3f9('0x8')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xc3f9('0x8')]},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xc3f9('0x8')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xc3f9('0x1a')](_0xc3f9('0x2d'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xc3f9('0x8')]},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xc3f9('0x57')],'get':function(){return this[_0xc3f9('0xd')]('phoneBarEnableScreenRecordingByAgent')?this[_0xc3f9('0xd')](_0xc3f9('0x58')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xc3f9('0x8')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xc3f9('0x8')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![],'set':function(_0x1a600f){if(typeof _0x1a600f===_0xc3f9('0x59')){var _0x56010e=_0x1a600f==='1'?!![]:_0x1a600f==='0'?![]:_0x1a600f===_0xc3f9('0x5a')?!![]:_0x1a600f==='false'?![]:![];this[_0xc3f9('0x5')](_0xc3f9('0x5b'),_0x56010e);}else{this[_0xc3f9('0x5')](_0xc3f9('0x5b'),_0x1a600f);}}},'blocked':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![],'set':function(_0x26017d){this['setDataValue'](_0xc3f9('0x5c'),_0x26017d);if(_0x26017d===!![]){this[_0xc3f9('0x5')]('blockedAt',moment());this['setDataValue'](_0xc3f9('0x5d'),0x0);}else{this[_0xc3f9('0x5')](_0xc3f9('0x5e'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xc3f9('0x14')](0x5)[_0xc3f9('0x5f')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0xc3f9('0x17')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xc3f9('0x14')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x2f6a=['string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','STRING','name','setDataValue','defaultuser','The\x20name\x20of\x20the\x20user','fullname','callerid','format','\x22%s\x22\x20<%s>','internal','email','toLowerCase','admin','agent','telephone','local','accountcode','getDataValue','BOOLEAN','DEFAULT\x20PAUSE','DATE','INTEGER','dynamic','friend','user','peer','from-sip','ENUM','ALLOWED_NOT_SCREENED','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','nonat','force_rport,comedia','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','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','certificate','active','actpass','update,nonat','showWebBar','get','isArray','avpf','force_avp','dtlsverify','dtlssetup','dtlscertfile','dtlsprivatekey','wss','encryption','icesupport','dtlsenable','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','TEXT','permissions','map','phoneBarEnableScreenRecordingByAgent'];(function(_0x24a9df,_0x4380a2){var _0x408046=function(_0x9d3100){while(--_0x9d3100){_0x24a9df['push'](_0x24a9df['shift']());}};_0x408046(++_0x4380a2);}(_0x2f6a,0x118));var _0xa2f6=function(_0x4082f5,_0x352938){_0x4082f5=_0x4082f5-0x0;var _0x219cf1=_0x2f6a[_0x4082f5];return _0x219cf1;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0xa2f6('0x0'));var _=require(_0xa2f6('0x1'));module['exports']={'name':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':![],'unique':_0xa2f6('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x29636c){this[_0xa2f6('0x4')](_0xa2f6('0x3'),_0x29636c);this['setDataValue'](_0xa2f6('0x5'),_0x29636c);},'comment':_0xa2f6('0x6')},'fullname':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':![],'set':function(_0x42c022){this['setDataValue'](_0xa2f6('0x7'),_0x42c022);this[_0xa2f6('0x4')](_0xa2f6('0x8'),util[_0xa2f6('0x9')](_0xa2f6('0xa'),_0x42c022,this['getDataValue'](_0xa2f6('0xb'))));}},'alias':{'type':Sequelize[_0xa2f6('0x2')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa2f6('0xc'),'validate':{'isEmail':!![]},'set':function(_0x23c0ae){if(_0x23c0ae){this[_0xa2f6('0x4')]('email',_0x23c0ae[_0xa2f6('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0xa2f6('0xe'),'user',_0xa2f6('0xf'),_0xa2f6('0x10')),'allowNull':![]},'password':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xa2f6('0x2')],'defaultValue':_0xa2f6('0x11')},'internal':{'type':Sequelize['INTEGER'](0xb),'allowNull':![],'unique':_0xa2f6('0xb'),'set':function(_0x552b4e){this['setDataValue'](_0xa2f6('0xb'),_0x552b4e);this[_0xa2f6('0x4')](_0xa2f6('0x12'),_0x552b4e);this[_0xa2f6('0x4')]('callerid',util[_0xa2f6('0x9')](_0xa2f6('0xa'),this[_0xa2f6('0x13')](_0xa2f6('0x7')),_0x552b4e));}},'salt':{'type':Sequelize[_0xa2f6('0x2')]},'phone':{'type':Sequelize[_0xa2f6('0x2')]},'mobile':{'type':Sequelize[_0xa2f6('0x2')]},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xa2f6('0x2')]},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xa2f6('0x2')]},'country':{'type':Sequelize['STRING']},'online':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize['DATE']},'voicePause':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xa2f6('0x2')],'defaultValue':_0xa2f6('0x15')},'lastPauseAt':{'type':Sequelize[_0xa2f6('0x16')]},'chatCapacity':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xa2f6('0x17')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0xa2f6('0x17')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'host':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![],'defaultValue':_0xa2f6('0x18')},'ipaddr':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM'](_0xa2f6('0x19'),_0xa2f6('0x1a'),_0xa2f6('0x1b')),'allowNull':!![],'defaultValue':'friend'},'context':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![],'defaultValue':_0xa2f6('0x1c')},'callingpres':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x1e'),'ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN',_0xa2f6('0x1f'),_0xa2f6('0x20'),_0xa2f6('0x21'),'PROHIB_FAILED_SCREEN',_0xa2f6('0x22')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'secret':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'transport':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![],'defaultValue':_0xa2f6('0x23'),'set':function(_0x3cffd3){this[_0xa2f6('0x4')](_0xa2f6('0x24'),_0x3cffd3?_0x3cffd3[_0xa2f6('0x25')](','):null);},'get':function(){return this[_0xa2f6('0x13')](_0xa2f6('0x24'))?this['getDataValue'](_0xa2f6('0x24'))[_0xa2f6('0x26')](','):null;},'comment':_0xa2f6('0x27')},'dtmfmode':{'type':Sequelize['ENUM'](_0xa2f6('0x28'),'info',_0xa2f6('0x29'),'inband',_0xa2f6('0x2a')),'allowNull':!![],'defaultValue':_0xa2f6('0x28')},'directmedia':{'type':Sequelize['ENUM'](_0xa2f6('0x2b'),'no',_0xa2f6('0x2c'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'nat':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![],'defaultValue':_0xa2f6('0x2d'),'set':function(_0x370fa4){this[_0xa2f6('0x4')](_0xa2f6('0x2e'),_0x370fa4?_0x370fa4[_0xa2f6('0x25')](','):null);},'get':function(){return this[_0xa2f6('0x13')](_0xa2f6('0x2e'))?this[_0xa2f6('0x13')](_0xa2f6('0x2e'))[_0xa2f6('0x26')](','):null;},'comment':_0xa2f6('0x2f')},'callgroup':{'type':Sequelize[_0xa2f6('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xa2f6('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xa2f6('0x2')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':![],'defaultValue':_0xa2f6('0x30')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xa2f6('0x31'),'set':function(_0x35024d){this[_0xa2f6('0x4')](_0xa2f6('0x32'),_0x35024d?_0x35024d[_0xa2f6('0x25')](';'):_0xa2f6('0x31'));},'get':function(){return this['getDataValue'](_0xa2f6('0x32'))?this[_0xa2f6('0x13')](_0xa2f6('0x32'))['split'](';'):null;},'comment':_0xa2f6('0x33')},'autoframing':{'type':Sequelize['ENUM'](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![],'set':function(_0x179807){this[_0xa2f6('0x4')](_0xa2f6('0x34'),_0x179807?_0x179807[_0xa2f6('0x25')](','):null);},'get':function(){return this[_0xa2f6('0x13')](_0xa2f6('0x34'))?this['getDataValue'](_0xa2f6('0x34'))[_0xa2f6('0x26')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xa2f6('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![],'defaultValue':_0xa2f6('0x35')},'amaflags':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![],'defaultValue':_0xa2f6('0x2b')},'busylevel':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'template':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0xa2f6('0x1d')]('yes','no',_0xa2f6('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0xa2f6('0x37'),_0xa2f6('0x38'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x39'),'uas'),'allowNull':!![],'defaultValue':_0xa2f6('0x3a')},'t38pt_usertpsource':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xa2f6('0x1d')]('yes','no'),'allowNull':!![],'defaultValue':_0xa2f6('0x2b')},'keepalive':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa2f6('0x17')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa2f6('0x1d')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0xa2f6('0x2b'),'no',_0xa2f6('0x3b'),_0xa2f6('0x3c')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x3d'),'passive',_0xa2f6('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xa2f6('0x1d')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize['ENUM'](_0xa2f6('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xa2f6('0x1d')]('yes','no',_0xa2f6('0x2c'),'update',_0xa2f6('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xa2f6('0x2')]},'resetPasswordExpires':{'type':Sequelize[_0xa2f6('0x16')]},'passwordResetAt':{'type':Sequelize['DATE'],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0,'set':function(_0x5a60c3){this[_0xa2f6('0x4')](_0xa2f6('0x40'),_0x5a60c3);var _0x5f4b7f=this[_0xa2f6('0x41')]({'plain':!![]});switch(_0x5a60c3){case 0x0:case 0x1:var _0x9880c5=_0x5f4b7f['transport']?_[_0xa2f6('0x42')](_0x5f4b7f[_0xa2f6('0x24')])?_0x5f4b7f[_0xa2f6('0x24')][_0xa2f6('0x25')]():_0x5f4b7f['transport']:'udp';if(_0x9880c5==='wss'){_0x9880c5=_0xa2f6('0x23');}this[_0xa2f6('0x4')](_0xa2f6('0x24'),_0x9880c5);this[_0xa2f6('0x4')]('encryption','no');this['setDataValue'](_0xa2f6('0x43'),null);this[_0xa2f6('0x4')](_0xa2f6('0x44'),null);this[_0xa2f6('0x4')]('icesupport',null);this[_0xa2f6('0x4')]('dtlsenable',null);this[_0xa2f6('0x4')](_0xa2f6('0x45'),null);this[_0xa2f6('0x4')](_0xa2f6('0x46'),null);this[_0xa2f6('0x4')](_0xa2f6('0x47'),null);this[_0xa2f6('0x4')](_0xa2f6('0x48'),null);this[_0xa2f6('0x4')]('rtcp_mux','no');break;case 0x2:this[_0xa2f6('0x4')](_0xa2f6('0x24'),_0xa2f6('0x49'));this[_0xa2f6('0x4')](_0xa2f6('0x4a'),_0xa2f6('0x2b'));this[_0xa2f6('0x4')](_0xa2f6('0x43'),_0xa2f6('0x2b'));this[_0xa2f6('0x4')]('force_avp','yes');this[_0xa2f6('0x4')](_0xa2f6('0x4b'),'yes');this[_0xa2f6('0x4')](_0xa2f6('0x4c'),_0xa2f6('0x2b'));this['setDataValue'](_0xa2f6('0x45'),'no');this[_0xa2f6('0x4')]('dtlssetup','actpass');this['setDataValue'](_0xa2f6('0x47'),_0x5f4b7f[_0xa2f6('0x47')]||_0xa2f6('0x4d'));this[_0xa2f6('0x4')](_0xa2f6('0x48'),_0x5f4b7f[_0xa2f6('0x48')]||_0xa2f6('0x4e'));this[_0xa2f6('0x4')](_0xa2f6('0x4f'),_0xa2f6('0x2b'));break;default:}}},'permissions':{'type':Sequelize[_0xa2f6('0x50')],'set':function(_0x35d025){this['setDataValue'](_0xa2f6('0x51'),_0x35d025?_0x35d025['join'](','):[]);},'get':function(){return this['getDataValue'](_0xa2f6('0x51'))?_[_0xa2f6('0x52')](this[_0xa2f6('0x13')]('permissions')[_0xa2f6('0x26')](','),function(_0x21c2dd){return parseInt(_0x21c2dd,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa2f6('0x2')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0xa2f6('0x2')]},'phoneBarBusyNumber':{'type':Sequelize[_0xa2f6('0x2')]},'phoneBarUnconditional':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0xa2f6('0x1d')](_0xa2f6('0x2b'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this['getDataValue'](_0xa2f6('0x53'))?this[_0xa2f6('0x13')](_0xa2f6('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa2f6('0x2')],'defaultValue':null},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa2f6('0x2')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize['STRING'],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![],'set':function(_0x256202){if(typeof _0x256202===_0xa2f6('0x54')){var _0x3b574d=_0x256202==='1'?!![]:_0x256202==='0'?![]:_0x256202===_0xa2f6('0x55')?!![]:_0x256202===_0xa2f6('0x56')?![]:![];this[_0xa2f6('0x4')](_0xa2f6('0x57'),_0x3b574d);}else{this[_0xa2f6('0x4')]('screenrecording',_0x256202);}}},'blocked':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![],'set':function(_0x19a843){this[_0xa2f6('0x4')]('blocked',_0x19a843);if(_0x19a843===!![]){this[_0xa2f6('0x4')](_0xa2f6('0x58'),moment());this[_0xa2f6('0x4')](_0xa2f6('0x59'),0x0);}else{this[_0xa2f6('0x4')](_0xa2f6('0x58'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xa2f6('0x17')](0x5)[_0xa2f6('0x5a')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0xa2f6('0x17')],'defaultValue':0x0},'messengerSoundNotification':{'type':Sequelize[_0xa2f6('0x14')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index c94e059..08e17e8 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 _0xa322=['resolve','logout','QueuePause','updateAttributes','DEFAULT\x20PAUSE','unpause','faxPause','smsPause','pauseType','lastPauseAt','getTeams','addTeams','Body\x20parameter\x20\x27ids\x27\x20is\x20required','transaction','Team','getAssociatedQueues','flattenDeep','addAgent','getDataValue','Voice','TeamVoicePrefix','VoicePrefixId','removeTeams','isArray','Query\x20parameter\x20\x27ids\x27\x20is\x20required','removeAgent','getLists','getAgents','CmHopper','addChatInteractions','spread','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','getVoicePrefixes','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','addSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','$and','$or','$gte','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','firstName','lastName','CmContact','Contact','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getUserSetting','getPresence','idle','unknown','ringing','teams','queues','inbound','flatten','lower','col','asc','desc','substring','uniqBy','orderBy','getRealtimeAgents','offline','pause','voiceStatus','unavailable','busy','slice','SELECT','select','field','InteractionId','ui.createdAt','user_has_','_interactions','ui.UserId\x20=\x20?','toString','messengerSoundNotification','enabled','moment','util','path','lodash','squel','jayson/promise','../../components/auth/service','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','APIBadRequestError','../../errors/api','APINotFoundError','APIForbiddenrror','handleError','../../mysqldb','./user.socket','register','redis','defaults','localhost','client','http','sendStatus','status','end','undefined','limit','count','offset','set','json','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','update','agent','emit','userNotification:recalc:','get','admin','Users','user','Agents','filter','ignore','map','value','includes','find','role','name','UserProfileResource','stack','send','User','rawAttributes','fieldName','type','password','salt','resetPasswordToken','resetPasswordExpires','md5secret','index','getOptions','where','query','includeAll','userSetting','true','include','UserSetting','attributes','push','findAll','rows','openTabs','length','chat','sms','dataValues','mail','openchannel','all','show','params','merge','options','whatsapp','fax','body','describe','addContacts','ids','omit','internal','findById','securePassword','validatePasswordPattern','max','min_internal','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)','sequelize','QueryTypes','from','isNil','voicemail','mailbox','VoiceMail','permissions','101','102','113','110','105','106','107','109','100','114','115','create','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','Telephones','autoAssociation','bulkCreate','Unauthorized','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','UserProfileSection','isEmpty','compact','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','previousPasswords','updatePasswordsHistory','addQueues','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','QueueId','Queue:save','VoiceQueue','voice','online','SIP/%s','voicePause','upsert','removeQueues','channel','Queue:remove','destroy','addAvatar','userpic','file','filename','getAvatar','join','server/files/images/logos/default_profile.png','existsSync','root','server/files/images/','download','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FaxOpenTabs','FAX','OpenchannelOpenTabs','OPENCHANNEL','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','concat','getContacts','User\x20with\x20id\x20%s\x20not\x20found','hasOwnProperty','CmList','Tag','Tags','color','tag','model','Queue','filters','intersection','fields','order','sort','pick','Unknown\x20role','nolimit','keys','UserVoiceQueueRt','getVoiceQueuesRt','getGroups','UserId','VoiceRecording','getScreenRecordings','ScreenRecording','getChatInteractions','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','phone','format','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','connection','remoteAddress','socket','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','device','PAUSE','LOGININPAUSE','MemberReport','isMiddleware'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xa322,0x8e));var _0x2a32=function(_0x585138,_0xc11c14){_0x585138=_0x585138-0x0;var _0x14d0b5=_0xa322[_0x585138];return _0x14d0b5;};'use strict';var moment=require(_0x2a32('0x0'));var util=require(_0x2a32('0x1'));var path=require(_0x2a32('0x2'));var fs=require('fs');var _=require(_0x2a32('0x3'));var squel=require(_0x2a32('0x4'));var Redis=require('ioredis');var jayson=require(_0x2a32('0x5'));var authService=require(_0x2a32('0x6'));var contacts=require(_0x2a32('0x7'));var qs=require(_0x2a32('0x8'));var rta=require('../../components/realtime/agents');var logger=require(_0x2a32('0x9'))(_0x2a32('0xa'));var utils=require(_0x2a32('0xb'));var config=require('../../config/environment');var licenseUtil=require(_0x2a32('0xc'));var APIBadRequestError=require('../../errors/api')[_0x2a32('0xd')];var APINotFoundError=require(_0x2a32('0xe'))[_0x2a32('0xf')];var APIForbiddenError=require(_0x2a32('0xe'))[_0x2a32('0x10')];var APIHandleError=require(_0x2a32('0xe'))[_0x2a32('0x11')];var db=require(_0x2a32('0x12'))['db'];var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2a32('0x13'))[_0x2a32('0x14')](socket);config[_0x2a32('0x15')]=_[_0x2a32('0x16')](config[_0x2a32('0x15')],{'host':_0x2a32('0x17'),'port':0x18eb});var amiClient=jayson[_0x2a32('0x18')][_0x2a32('0x19')]({'port':0x232a});var values;function respondWithStatusCode(_0x12e2ee,_0x3c6208){_0x3c6208=_0x3c6208||0xcc;return function(_0x2c38e2){if(_0x2c38e2){return _0x12e2ee[_0x2a32('0x1a')](_0x3c6208);}return _0x12e2ee[_0x2a32('0x1b')](_0x3c6208)[_0x2a32('0x1c')]();};}function respondWithResult(_0x14c332,_0x29cdec){_0x29cdec=_0x29cdec||0xc8;return function(_0x55c380){if(_0x55c380){return _0x14c332[_0x2a32('0x1b')](_0x29cdec)['json'](_0x55c380);}};}function respondWithFilteredResult(_0x27571d,_0x1aed1e){return function(_0x2368c3){if(_0x2368c3){var _0x42e5cf=typeof _0x1aed1e['offset']===_0x2a32('0x1d')&&typeof _0x1aed1e[_0x2a32('0x1e')]===_0x2a32('0x1d');var _0x2e6a70=_0x2368c3[_0x2a32('0x1f')];var _0x1c852f=_0x42e5cf?0x0:_0x1aed1e[_0x2a32('0x20')];var _0x4c9318=_0x42e5cf?_0x2368c3[_0x2a32('0x1f')]:_0x1aed1e[_0x2a32('0x20')]+_0x1aed1e[_0x2a32('0x1e')];var _0x48d3de;if(_0x4c9318>=_0x2e6a70){_0x4c9318=_0x2e6a70;_0x48d3de=0xc8;}else{_0x48d3de=0xce;}_0x27571d['status'](_0x48d3de);return _0x27571d[_0x2a32('0x21')]('Content-Range',_0x1c852f+'-'+_0x4c9318+'/'+_0x2e6a70)[_0x2a32('0x22')](_0x2368c3);}return null;};}function respondWithRpcPromise(_0x2d3623,_0x4fe765,_0x460f67,_0x4602dd){return new Promise(function(_0x427961,_0x597d58){var _0x1b10cf=_0x4602dd||amiClient;return _0x1b10cf['request'](_0x2d3623,_0x460f67)[_0x2a32('0x23')](function(_0x555592){logger[_0x2a32('0x24')](_0x2a32('0x25'),_0x4fe765,_0x2a32('0x26'));logger['debug'](_0x2a32('0x27'),_0x4fe765,'request\x20sent',JSON[_0x2a32('0x28')](_0x555592));if(_0x555592[_0x2a32('0x29')]){if(_0x555592[_0x2a32('0x29')][_0x2a32('0x2a')]===0x1f4){logger['error'](_0x2a32('0x25'),_0x4fe765,_0x555592[_0x2a32('0x29')][_0x2a32('0x2b')]);return _0x597d58(_0x555592[_0x2a32('0x29')][_0x2a32('0x2b')]);}logger[_0x2a32('0x29')](_0x2a32('0x25'),_0x4fe765,_0x555592[_0x2a32('0x29')][_0x2a32('0x2b')]);return _0x427961(_0x555592[_0x2a32('0x29')]['message']);}else{logger['info'](_0x2a32('0x25'),_0x4fe765,_0x2a32('0x26'));_0x427961(_0x555592[_0x2a32('0x2c')][_0x2a32('0x2b')]);}})[_0x2a32('0x2d')](function(_0x53e72e){logger[_0x2a32('0x29')](_0x2a32('0x25'),_0x4fe765,_0x53e72e);_0x597d58(_0x53e72e);});});}function saveUpdates(_0x2bba6e){return function(_0x20edb4){if(_0x20edb4){return _0x20edb4[_0x2a32('0x2e')](_0x2bba6e)[_0x2a32('0x23')](function(_0x1e6847){if(_0x1e6847['role']===_0x2a32('0x2f')){socket[_0x2a32('0x30')](_0x2a32('0x31')+_0x1e6847['id'],_0x1e6847);}return _0x1e6847;});}return null;};}function removeEntity(_0x21eb79,_0x14d3b0){return function(_0x12db4d){if(_0x12db4d){return _0x12db4d['destroy']({'transaction':_0x14d3b0})[_0x2a32('0x23')](function(){var _0x1a2f5c=_0x12db4d[_0x2a32('0x32')]({'plain':!![]});if(_0x1a2f5c['role']===_0x2a32('0x33'))return;var _0x58f6a6=[{'name':_0x2a32('0x34'),'value':_0x2a32('0x35'),'ignore':!![]},{'name':_0x2a32('0x36'),'value':_0x2a32('0x2f'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x544633=_(_0x58f6a6)[_0x2a32('0x37')](_0x2a32('0x38'))[_0x2a32('0x39')]('value')[_0x2a32('0x3a')]();if(_[_0x2a32('0x3b')](_0x544633,_0x1a2f5c['role'])){return;}var _0x4eeb31=_[_0x2a32('0x3c')](_0x58f6a6,[_0x2a32('0x3a'),_0x1a2f5c[_0x2a32('0x3d')]])[_0x2a32('0x3e')];return db[_0x2a32('0x3f')]['destroy']({'where':{'type':_0x4eeb31,'resourceId':_0x1a2f5c['id']},'transaction':_0x14d3b0})[_0x2a32('0x23')](function(){return _0x12db4d;});})[_0x2a32('0x23')](function(){_0x21eb79[_0x2a32('0x1b')](0xcc)[_0x2a32('0x1c')]();});}};}function handleEntityNotFound(_0x4d3be2){return function(_0x1a7296){if(!_0x1a7296){_0x4d3be2[_0x2a32('0x1a')](0x194);}return _0x1a7296;};}function handleError(_0x1cf2cf,_0x158526){_0x158526=_0x158526||0x1f4;return function(_0xfc560f){logger[_0x2a32('0x29')](_0xfc560f[_0x2a32('0x40')]);if(_0xfc560f['name']){delete _0xfc560f['name'];}_0x1cf2cf[_0x2a32('0x1b')](_0x158526)[_0x2a32('0x41')](_0xfc560f);};}function getUserAttributes(){return _(db[_0x2a32('0x42')][_0x2a32('0x43')])['map'](function(_0x537d05){return{'name':_0x537d05[_0x2a32('0x44')],'type':_0x537d05[_0x2a32('0x45')]['key']};})[_0x2a32('0x37')](function(_0x57c15e){return![_0x2a32('0x46'),_0x2a32('0x47'),'previousPasswords',_0x2a32('0x48'),_0x2a32('0x49'),_0x2a32('0x4a')]['includes'](_0x57c15e[_0x2a32('0x3e')]);})[_0x2a32('0x3a')]();}exports[_0x2a32('0x4b')]=function(_0x2786e7,_0xc85cfc){var _0x1ce113={},_0x2bed71={'count':0x0,'rows':[]};var _0x160fdb=getUserAttributes();_0x1ce113=qs[_0x2a32('0x4c')](_0x160fdb,_0x2786e7);var _0x510de5={'where':_0x1ce113[_0x2a32('0x4d')]};return db[_0x2a32('0x42')]['count'](_0x510de5)[_0x2a32('0x23')](function(_0x2892e6){_0x2bed71['count']=_0x2892e6;if(_0x2786e7[_0x2a32('0x4e')][_0x2a32('0x4f')]){_0x1ce113['include']=[{'all':!![]}];}if(_0x2786e7['query'][_0x2a32('0x50')]===_0x2a32('0x51')){_0x1ce113[_0x2a32('0x52')]=[{'model':db[_0x2a32('0x53')],'as':'userSetting'}];}if(!_[_0x2a32('0x3b')](_0x1ce113[_0x2a32('0x54')],'id')){_0x1ce113[_0x2a32('0x54')][_0x2a32('0x55')]('id');}return db[_0x2a32('0x42')][_0x2a32('0x56')](_0x1ce113);})[_0x2a32('0x23')](function(_0x595a24){_0x2bed71[_0x2a32('0x57')]=_0x595a24;if(_0x2786e7[_0x2a32('0x4e')][_0x2a32('0x58')]===_0x2a32('0x51')){var _0x1a0296=[];for(var _0x1c6c60=0x0;_0x1c6c60<_0x2bed71[_0x2a32('0x57')][_0x2a32('0x59')];_0x1c6c60++){_0x1a0296[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x5a'),_0x2bed71[_0x2a32('0x57')][_0x1c6c60]['dataValues']));_0x1a0296[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x5b'),_0x2bed71[_0x2a32('0x57')][_0x1c6c60][_0x2a32('0x5c')]));_0x1a0296[_0x2a32('0x55')](get_open_tabs('fax',_0x2bed71['rows'][_0x1c6c60][_0x2a32('0x5c')]));_0x1a0296['push'](get_open_tabs(_0x2a32('0x5d'),_0x2bed71[_0x2a32('0x57')][_0x1c6c60][_0x2a32('0x5c')]));_0x1a0296[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x5e'),_0x2bed71[_0x2a32('0x57')][_0x1c6c60]['dataValues']));_0x1a0296[_0x2a32('0x55')](get_open_tabs('whatsapp',_0x2bed71['rows'][_0x1c6c60][_0x2a32('0x5c')]));}return Promise[_0x2a32('0x5f')](_0x1a0296)['then'](function(){return _0x2bed71;});}else{return _0x2bed71;}})['then'](respondWithFilteredResult(_0xc85cfc,_0x1ce113))[_0x2a32('0x2d')](handleError(_0xc85cfc,null));};exports[_0x2a32('0x60')]=function(_0x3bd5fa,_0x5dd6bb){var _0x10c4e8=getUserAttributes();_0x3bd5fa['query']['id']=_0x3bd5fa[_0x2a32('0x61')]['id'];var _0x5b4e81=qs[_0x2a32('0x4c')](_0x10c4e8,_0x3bd5fa);if(_0x3bd5fa[_0x2a32('0x4e')][_0x2a32('0x4f')]){_0x5b4e81[_0x2a32('0x52')]=[{'all':!![]}];}if(_0x3bd5fa[_0x2a32('0x4e')]['userSetting']==='true'){_0x5b4e81[_0x2a32('0x52')]=[{'model':db[_0x2a32('0x53')],'as':'userSetting'}];}_0x5b4e81=_[_0x2a32('0x62')]({},_0x5b4e81,_0x3bd5fa[_0x2a32('0x63')]);if(!_[_0x2a32('0x3b')](_0x5b4e81[_0x2a32('0x54')],'id')){_0x5b4e81['attributes']['push']('id');}return db[_0x2a32('0x42')]['find'](_0x5b4e81)[_0x2a32('0x23')](handleEntityNotFound(_0x5dd6bb,null))[_0x2a32('0x23')](function(_0x88363e){var _0x4c4bcc=[];values=_0x88363e;if(_0x3bd5fa[_0x2a32('0x4e')][_0x2a32('0x58')]===_0x2a32('0x51')){_0x4c4bcc[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x5a'),_0x88363e[_0x2a32('0x5c')]));_0x4c4bcc[_0x2a32('0x55')](get_open_tabs('sms',_0x88363e[_0x2a32('0x5c')]));_0x4c4bcc['push'](get_open_tabs(_0x2a32('0x5e'),_0x88363e[_0x2a32('0x5c')]));_0x4c4bcc['push'](get_open_tabs(_0x2a32('0x64'),_0x88363e[_0x2a32('0x5c')]));_0x4c4bcc[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x65'),_0x88363e[_0x2a32('0x5c')]));_0x4c4bcc[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x5d'),_0x88363e[_0x2a32('0x5c')]));return Promise['all'](_0x4c4bcc);}else{return values;}})[_0x2a32('0x23')](function(){return values;})['then'](respondWithResult(_0x5dd6bb,null))['catch'](handleError(_0x5dd6bb,null));};exports[_0x2a32('0x2e')]=function(_0x1fa4e6,_0x3e13c8){if(_0x1fa4e6[_0x2a32('0x66')]['id']){delete _0x1fa4e6[_0x2a32('0x66')]['id'];}delete _0x1fa4e6['body'][_0x2a32('0x3d')];return db['User'][_0x2a32('0x3c')]({'where':{'id':_0x1fa4e6[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x3e13c8,null))[_0x2a32('0x23')](saveUpdates(_0x1fa4e6[_0x2a32('0x66')],null))[_0x2a32('0x23')](respondWithResult(_0x3e13c8,null))[_0x2a32('0x2d')](handleError(_0x3e13c8,null));};exports['describe']=function(_0x2a044f,_0x1606b9){return db[_0x2a32('0x42')][_0x2a32('0x67')]()[_0x2a32('0x23')](respondWithResult(_0x1606b9,null))[_0x2a32('0x2d')](handleError(_0x1606b9,null));};exports[_0x2a32('0x68')]=function(_0x313b8a,_0x4b45cb){return db['User'][_0x2a32('0x3c')]({'where':{'id':_0x313b8a[_0x2a32('0x61')]['id']}})['then'](handleEntityNotFound(_0x4b45cb,null))[_0x2a32('0x23')](function(_0x441810){if(_0x441810){return _0x441810[_0x2a32('0x68')](_0x313b8a[_0x2a32('0x66')][_0x2a32('0x69')],_[_0x2a32('0x6a')](_0x313b8a[_0x2a32('0x66')],[_0x2a32('0x69'),'id'])||{});}})[_0x2a32('0x23')](respondWithResult(_0x4b45cb,null))[_0x2a32('0x2d')](handleError(_0x4b45cb,null));};function validateUser(_0x481725){return new Promise(function(_0x234751,_0x1d39b9){if(_0x481725[_0x2a32('0x6b')])return _0x234751(_0x481725);return db['Setting'][_0x2a32('0x6c')](0x1)[_0x2a32('0x23')](function(_0x65f8a3){if(_0x65f8a3[_0x2a32('0x6d')])authService[_0x2a32('0x6e')](_0x481725[_0x2a32('0x46')]);db[_0x2a32('0x42')][_0x2a32('0x6f')](_0x2a32('0x6b'))[_0x2a32('0x23')](function(_0x33d5f2){if(_['isNil'](_0x33d5f2)){_0x481725[_0x2a32('0x6b')]=_0x65f8a3[_0x2a32('0x70')]||0x1;return;}if(_['isNil'](_0x65f8a3[_0x2a32('0x70')])||_0x65f8a3['min_internal']===_0x33d5f2){_0x481725['internal']=_0x33d5f2+0x1;return;}if(_0x65f8a3['min_internal']>_0x33d5f2){_0x481725['internal']=_0x65f8a3[_0x2a32('0x70')];return;}return db['sequelize'][_0x2a32('0x4e')](_0x2a32('0x71'),{'type':db[_0x2a32('0x72')][_0x2a32('0x73')]['SELECT']})[_0x2a32('0x23')](function(_0x398613){if(_0x398613&&_0x398613[_0x2a32('0x59')]){for(var _0x548bde=0x0,_0x4a68c9=_0x398613[_0x2a32('0x59')];_0x548bde<_0x4a68c9&&_['isNil'](_0x481725[_0x2a32('0x6b')]);_0x548bde++){if(_0x65f8a3[_0x2a32('0x70')]<=_0x398613[_0x548bde]['from']){_0x481725[_0x2a32('0x6b')]=_0x398613[_0x548bde]['from'];}else if(_0x65f8a3[_0x2a32('0x70')]>_0x398613[_0x548bde][_0x2a32('0x74')]&&_0x65f8a3['min_internal']<=_0x398613[_0x548bde]['to']){_0x481725[_0x2a32('0x6b')]=_0x65f8a3['min_internal'];}}}if(_[_0x2a32('0x75')](_0x481725['internal'])){_0x481725[_0x2a32('0x6b')]=_0x33d5f2+0x1;}return _0x234751(_0x481725);});});})[_0x2a32('0x2d')](function(_0x48bf03){_0x1d39b9(_0x48bf03);});});}function updateUser(_0x2887a4){return new Promise(function(_0xc9fe9c,_0x102755){try{if(_0x2887a4[_0x2a32('0x76')]){_0x2887a4[_0x2a32('0x77')]=_0x2887a4['internal'];_0x2887a4[_0x2a32('0x78')]={'mailbox':_0x2887a4[_0x2a32('0x6b')],'password':_0x2887a4['password'],'fullname':_0x2887a4['fullname'],'email':_0x2887a4['email']};}if(_0x2887a4[_0x2a32('0x3d')]===_0x2a32('0x2f')){if(!_0x2887a4[_0x2a32('0x79')])_0x2887a4[_0x2a32('0x79')]=[_0x2a32('0x7a'),_0x2a32('0x7b'),'103',_0x2a32('0x7c'),_0x2a32('0x7d'),'104',_0x2a32('0x7e'),_0x2a32('0x7f'),_0x2a32('0x80'),'108',_0x2a32('0x81'),_0x2a32('0x82'),'111',_0x2a32('0x83'),_0x2a32('0x84')];}_0xc9fe9c(_0x2887a4);}catch(_0x194150){_0x102755(_0x194150);}});}exports[_0x2a32('0x85')]=function(_0x2686c2,_0x36fe54){if(_0x2686c2[_0x2a32('0x35')][_0x2a32('0x3d')]===_0x2a32('0x2f'))throw new Error('Unauthorized');if(_0x2686c2[_0x2a32('0x66')][_0x2a32('0x3d')]===_0x2a32('0x35')&&_0x2686c2[_0x2a32('0x35')][_0x2a32('0x3d')]!==_0x2a32('0x33')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x2686c2[_0x2a32('0x66')][_0x2a32('0x3d')]===_0x2a32('0x33')&&_0x2686c2[_0x2a32('0x35')][_0x2a32('0x3d')]!==_0x2a32('0x33')){throw new Error(_0x2a32('0x86'));}return licenseUtil[_0x2a32('0x87')]([_0x2686c2[_0x2a32('0x66')]])['then'](function(){return validateUser(_0x2686c2['body']);})[_0x2a32('0x23')](function(_0x4da0b0){return updateUser(_0x4da0b0)[_0x2a32('0x23')](function(_0x3d5db9){if(_0x3d5db9[_0x2a32('0x3d')]==='admin'){_0x3d5db9['settingsEnabled']=_0x2686c2[_0x2a32('0x35')][_0x2a32('0x88')];delete _0x3d5db9[_0x2a32('0x89')];}return _0x3d5db9;});})['then'](function(_0x5623c0){return db[_0x2a32('0x42')]['create'](_0x5623c0,{'include':[{'model':db[_0x2a32('0x78')],'as':_0x2a32('0x78')}]});})[_0x2a32('0x23')](function(_0x545c50){if(_0x2686c2[_0x2a32('0x66')][_0x2a32('0x3d')]===_0x2a32('0x35'))return _0x545c50;if(_0x2686c2['user'][_0x2a32('0x3d')]!==_0x2a32('0x35'))return _0x545c50;return db['UserProfileSection'][_0x2a32('0x3c')]({'where':{'name':_0x545c50[_0x2a32('0x3d')]===_0x2a32('0x2f')?'Agents':_0x2a32('0x8a'),'userProfileId':_0x2686c2[_0x2a32('0x35')][_0x2a32('0x89')]},'raw':!![]})[_0x2a32('0x23')](function(_0x397d7f){if(!_0x397d7f||_0x397d7f[_0x2a32('0x8b')]!=0x0)return _0x545c50;return db['UserProfileResource'][_0x2a32('0x85')]({'name':_0x545c50[_0x2a32('0x3e')],'resourceId':_0x545c50['id'],'type':_0x397d7f[_0x2a32('0x3e')],'sectionId':_0x397d7f['id']},{})[_0x2a32('0x23')](function(){return _0x545c50;});})[_0x2a32('0x2d')](function(_0x25b246){logger[_0x2a32('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x25b246);throw _0x25b246;});})[_0x2a32('0x23')](respondWithResult(_0x36fe54,0xc9))[_0x2a32('0x2d')](handleError(_0x36fe54,null));};exports[_0x2a32('0x8c')]=function(_0x482f2d,_0x4e0eb7){var _0x4e46bf=_0x482f2d[_0x2a32('0x66')];var _0xbe4421=[];if(_0x482f2d[_0x2a32('0x35')]['role']===_0x2a32('0x2f'))throw new Error(_0x2a32('0x8d'));if(_[_0x2a32('0x8e')](_0x4e46bf,['role',_0x2a32('0x35')])&&_0x482f2d[_0x2a32('0x35')][_0x2a32('0x3d')]!==_0x2a32('0x33')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x2a32('0x8e')](_0x4e46bf,[_0x2a32('0x3d'),_0x2a32('0x33')])&&_0x482f2d[_0x2a32('0x35')][_0x2a32('0x3d')]!==_0x2a32('0x33')){throw new Error(_0x2a32('0x8f'));}return licenseUtil['checkUserLimits'](_0x4e46bf)[_0x2a32('0x23')](function(){return validateUser(_0x4e46bf[0x0]);})['then'](function(){for(var _0x54802c=0x1;_0x54802c<_0x4e46bf[_0x2a32('0x59')];_0x54802c++){var _0x3ba732=_0x4e46bf[_0x54802c-0x1][_0x2a32('0x6b')];if(!_0x4e46bf[_0x54802c][_0x2a32('0x6b')])_0x4e46bf[_0x54802c][_0x2a32('0x6b')]=_0x3ba732+0x1;_0xbe4421[_0x2a32('0x55')](validateUser(_0x4e46bf[_0x54802c]));}return Promise[_0x2a32('0x5f')](_0xbe4421);})['then'](function(){_0xbe4421=[];for(var _0x5259e9=0x0;_0x5259e9<_0x4e46bf[_0x2a32('0x59')];_0x5259e9++){_0xbe4421[_0x2a32('0x55')](updateUser(_0x4e46bf[_0x5259e9]));}return Promise['all'](_0xbe4421);})[_0x2a32('0x23')](function(){_0xbe4421=_0x4e46bf[_0x2a32('0x39')](function(_0x163475){return db[_0x2a32('0x42')][_0x2a32('0x85')](_0x163475,{'include':[{'model':db[_0x2a32('0x78')],'as':_0x2a32('0x78')}]})[_0x2a32('0x23')](function(_0x175d1c){_0x163475['id']=_0x175d1c['id'];return _0x163475;});});return Promise[_0x2a32('0x5f')](_0xbe4421);})[_0x2a32('0x23')](function(_0x2b349d){if(_0x482f2d[_0x2a32('0x66')]['role']===_0x2a32('0x35'))return _0x2b349d;if(_0x482f2d[_0x2a32('0x35')][_0x2a32('0x3d')]!==_0x2a32('0x35'))return _0x2b349d;var _0x216af2=_[_0x2a32('0x8e')](_0x2b349d,function(_0x1254f8){return _0x1254f8[_0x2a32('0x3d')]===_0x2a32('0x2f')||_0x1254f8[_0x2a32('0x3d')]===_0x2a32('0x90');});if(!_0x216af2)return _0x2b349d;return db[_0x2a32('0x91')][_0x2a32('0x56')]({'where':{'name':{'$or':['Agents','Telephones']},'userProfileId':_0x482f2d[_0x2a32('0x35')][_0x2a32('0x89')]},'raw':!![]})[_0x2a32('0x23')](function(_0x2e96bd){if(_[_0x2a32('0x92')](_0x2e96bd)||!_[_0x2a32('0x8e')](_0x2e96bd,[_0x2a32('0x8b'),0x0]))return _0x2b349d;_0xbe4421=[];var _0x26b82b=_(_0x2e96bd)['map'](function(_0x405813){if(_0x405813['autoAssociation']===0x1)return;return _0x405813[_0x2a32('0x3e')]===_0x2a32('0x36')?'agent':'telephone';})[_0x2a32('0x93')]()[_0x2a32('0x3a')]();for(var _0x46d921=0x0;_0x46d921<_0x2b349d[_0x2a32('0x59')];_0x46d921++){if(!_[_0x2a32('0x3b')](_0x26b82b,_0x2b349d[_0x46d921][_0x2a32('0x3d')]))return;var _0x59cef5=_0x2b349d[_0x46d921][_0x2a32('0x3d')]==='agent'?_0x2a32('0x36'):_0x2a32('0x8a');_0xbe4421[_0x2a32('0x55')](db[_0x2a32('0x3f')][_0x2a32('0x85')]({'name':_0x2b349d[_0x46d921][_0x2a32('0x3e')],'resourceId':_0x2b349d[_0x46d921]['id'],'type':_0x59cef5,'sectionId':_['find'](_0x2e96bd,[_0x2a32('0x3e'),_0x59cef5])['id']},{}));}return Promise[_0x2a32('0x5f')](_0xbe4421);});})[_0x2a32('0x23')](respondWithResult(_0x4e0eb7,0xc9))['catch'](handleError(_0x4e0eb7,null));};exports[_0x2a32('0x94')]=function(_0x21ea72,_0xaaafc2){if(_0x21ea72['body']['id']){delete _0x21ea72[_0x2a32('0x66')]['id'];}return db['User'][_0x2a32('0x3c')]({'where':{'id':_0x21ea72[_0x2a32('0x61')]['id']}})['then'](function(_0x4ad7e3){if(!_0x4ad7e3)return null;if(_0x4ad7e3['id']===_0x21ea72[_0x2a32('0x35')]['id']){if(!_0x21ea72[_0x2a32('0x66')][_0x2a32('0x95')]||!_0x21ea72[_0x2a32('0x66')][_0x2a32('0x96')]){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))](_0x2a32('0x99'));}if(!_0x4ad7e3['authenticate'](_0x21ea72[_0x2a32('0x66')][_0x2a32('0x95')])){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))](_0x2a32('0x9a'));}if(_0x21ea72['body'][_0x2a32('0x95')]===_0x21ea72[_0x2a32('0x66')][_0x2a32('0x96')]){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))](_0x2a32('0x9b'));}}else if(_0x21ea72[_0x2a32('0x35')][_0x2a32('0x3d')]===_0x2a32('0x33')){if(!_0x21ea72[_0x2a32('0x66')][_0x2a32('0x96')]){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))]('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x21ea72[_0x2a32('0x35')][_0x2a32('0x3d')]===_0x2a32('0x35')){if(!_0x21ea72[_0x2a32('0x66')][_0x2a32('0x96')]){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))](_0x2a32('0x9c'));}if(_0x4ad7e3[_0x2a32('0x3d')]!=='agent'){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))]('Unauthorized');}}else{throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))](_0x2a32('0x8d'));}return _0x4ad7e3;})[_0x2a32('0x23')](handleEntityNotFound(_0xaaafc2,null))[_0x2a32('0x23')](function(_0x44d439){return db[_0x2a32('0x9d')][_0x2a32('0x9e')]({'attributes':['id',_0x2a32('0x6d'),_0x2a32('0x9f'),_0x2a32('0xa0')]})[_0x2a32('0x23')](function(_0x1157cd){if(_0x1157cd[_0x2a32('0x6d')])authService[_0x2a32('0x6e')](_0x21ea72[_0x2a32('0x66')][_0x2a32('0x96')]);if(!_0x1157cd[_0x2a32('0x9f')]||!_0x44d439[_0x2a32('0xa1')])return _0x44d439;authService['validatePasswordHistory'](_0x21ea72[_0x2a32('0x66')]['newPassword'],_0x44d439['previousPasswords'],_0x1157cd[_0x2a32('0xa0')]);return _0x44d439;})['then'](saveUpdates({'password':_0x21ea72['body'][_0x2a32('0x96')],'passwordResetAt':_0x21ea72[_0x2a32('0x35')]['id']==_0x21ea72['params']['id']?moment():null,'previousPasswords':authService[_0x2a32('0xa2')](_0x21ea72['body']['newPassword'],_0x44d439[_0x2a32('0xa1')])},null));})[_0x2a32('0x23')](respondWithResult(_0xaaafc2,null))[_0x2a32('0x2d')](handleError(_0xaaafc2,null));};exports[_0x2a32('0xa3')]=function(_0x44bb48,_0x4f40b6){var _0x4c1b79=_0x44bb48[_0x2a32('0x66')]['channel'];return db['User']['find']({'where':{'id':_0x44bb48[_0x2a32('0x61')]['id']},'attributes':['id',_0x2a32('0x3e'),_0x2a32('0x3d'),'online',_0x2a32('0xa4'),'voicePause',_0x2a32('0xa5')]})[_0x2a32('0x23')](handleEntityNotFound(_0x4f40b6,null))['then'](function(_0x1f1a09){if(_0x1f1a09){if(!utils[_0x2a32('0xa6')](_0x4c1b79)){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))](_0x2a32('0xa7'));}return _0x1f1a09[_0x2a32('0xa8')+_[_0x2a32('0xa9')](_0x4c1b79[_0x2a32('0xaa')]())+_0x2a32('0xab')](_0x44bb48['body'][_0x2a32('0x69')],{'penalty':_0x44bb48[_0x2a32('0x66')][_0x2a32('0xac')]||0x0})['spread'](function(_0x5e9c0f){for(var _0x34b7eb=0x0;_0x34b7eb<_0x44bb48[_0x2a32('0x66')][_0x2a32('0x69')][_0x2a32('0x59')];_0x34b7eb+=0x1){var _0x3e8fc9={'UserId':Number(_0x44bb48[_0x2a32('0x61')]['id'])};_0x3e8fc9[_[_0x2a32('0xa9')](_0x4c1b79[_0x2a32('0xaa')]())+_0x2a32('0xad')]=Number(_0x44bb48['body']['ids'][_0x34b7eb]);socket[_0x2a32('0x30')](_0x2a32('0x35')+_[_0x2a32('0xa9')](_0x4c1b79[_0x2a32('0xaa')]())+_0x2a32('0xae'),_0x3e8fc9);}return _0x5e9c0f;})[_0x2a32('0x23')](function(){if(_0x4c1b79==='voice'){return db[_0x2a32('0xaf')][_0x2a32('0x56')]({'where':{'id':_0x44bb48[_0x2a32('0x66')]['ids']||[]},'raw':!![],'attributes':['id','name']});}})[_0x2a32('0x23')](function(_0x19756b){var _0x1737b6=_0x1f1a09['get']({'plain':!![]});var _0x239b03=[];if(_0x4c1b79===_0x2a32('0xb0')&&_0x1737b6[_0x2a32('0x3d')]===_0x2a32('0x2f')&&_0x1737b6[_0x2a32('0xb1')]){for(let _0x2adfed=0x0;_0x2adfed<_0x19756b['length'];_0x2adfed+=0x1){_0x239b03[_0x2a32('0x55')]({'membername':_0x1737b6[_0x2a32('0x3e')],'UserId':_0x1737b6['id'],'queue_name':_0x19756b[_0x2adfed][_0x2a32('0x3e')],'VoiceQueueId':_0x19756b[_0x2adfed]['id'],'interface':_[_0x2a32('0x75')](_0x1737b6['interface'])?util['format'](_0x2a32('0xb2'),_0x1737b6[_0x2a32('0x3e')]):_0x1737b6[_0x2a32('0xa5')],'paused':_0x1737b6[_0x2a32('0xb3')]||![],'penalty':_0x44bb48[_0x2a32('0x66')][_0x2a32('0xac')]||0x0});}return Promise[_0x2a32('0x5f')](_0x239b03[_0x2a32('0x39')](function(_0x4d7988){return db['UserVoiceQueueRt'][_0x2a32('0xb4')](_0x4d7988);}));}return _0x1f1a09;});}})['then'](respondWithStatusCode(_0x4f40b6,null))[_0x2a32('0x2d')](handleError(_0x4f40b6,null));};exports[_0x2a32('0xb5')]=function(_0x1ae789,_0x5785cd){var _0x367a84,_0x56ee84;return db[_0x2a32('0x42')][_0x2a32('0x3c')]({'where':{'id':_0x1ae789[_0x2a32('0x61')]['id']},'attributes':['id',_0x2a32('0x3e'),_0x2a32('0x3d')]})[_0x2a32('0x23')](handleEntityNotFound(_0x5785cd,null))[_0x2a32('0x23')](function(_0xe0b61d){if(_0xe0b61d){_0x367a84=_0xe0b61d;if(!_0x1ae789[_0x2a32('0x4e')][_0x2a32('0xb6')]||!utils['isValidChannel'](_0x1ae789[_0x2a32('0x4e')][_0x2a32('0xb6')])){throw new db['Sequelize'][(_0x2a32('0x98'))](_0x2a32('0xa7'));}return _0xe0b61d['remove'+_['capitalize'](_0x1ae789[_0x2a32('0x4e')][_0x2a32('0xb6')][_0x2a32('0xaa')]())+_0x2a32('0xab')](_0x1ae789[_0x2a32('0x4e')]['ids']);}})['then'](function(_0x5aa916){if(_['isArray'](_0x1ae789[_0x2a32('0x4e')][_0x2a32('0x69')])){for(var _0x246eda=0x0;_0x246eda<_0x1ae789[_0x2a32('0x4e')][_0x2a32('0x69')]['length'];_0x246eda+=0x1){_0x56ee84={'UserId':Number(_0x1ae789[_0x2a32('0x61')]['id'])};_0x56ee84[_['capitalize'](_0x1ae789[_0x2a32('0x4e')]['channel']['toLowerCase']())+_0x2a32('0xad')]=Number(_0x1ae789[_0x2a32('0x4e')]['ids'][_0x246eda]);socket[_0x2a32('0x30')](_0x2a32('0x35')+_[_0x2a32('0xa9')](_0x1ae789[_0x2a32('0x4e')][_0x2a32('0xb6')]['toLowerCase']())+'Queue:remove',_0x56ee84);}}else{_0x56ee84={'UserId':Number(_0x1ae789[_0x2a32('0x61')]['id'])};_0x56ee84[_[_0x2a32('0xa9')](_0x1ae789[_0x2a32('0x4e')][_0x2a32('0xb6')][_0x2a32('0xaa')]())+_0x2a32('0xad')]=Number(_0x1ae789[_0x2a32('0x4e')]['ids']);socket[_0x2a32('0x30')](_0x2a32('0x35')+_[_0x2a32('0xa9')](_0x1ae789['query'][_0x2a32('0xb6')][_0x2a32('0xaa')]())+_0x2a32('0xb7'),_0x56ee84);}return _0x5aa916;})[_0x2a32('0x23')](function(){if(_0x1ae789['query'][_0x2a32('0xb6')]===_0x2a32('0xb0')){return db['UserVoiceQueueRt'][_0x2a32('0xb8')]({'where':{'UserId':_0x1ae789[_0x2a32('0x61')]['id'],'VoiceQueueId':_0x1ae789[_0x2a32('0x4e')][_0x2a32('0x69')]},'individualHooks':!![]})['then'](function(){return _0x367a84;});}return _0x367a84;})['then'](respondWithStatusCode(_0x5785cd,null))[_0x2a32('0x2d')](handleError(_0x5785cd,null));};exports[_0x2a32('0xb9')]=function(_0xced8c2,_0x4bc3ef){_0xced8c2['body'][_0x2a32('0xba')]=_0xced8c2[_0x2a32('0xbb')][_0x2a32('0xbc')];return db[_0x2a32('0x42')][_0x2a32('0x3c')]({'where':{'id':_0xced8c2[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x4bc3ef,null))[_0x2a32('0x23')](saveUpdates(_0xced8c2[_0x2a32('0x66')],null))['then'](respondWithResult(_0x4bc3ef,null))[_0x2a32('0x2d')](handleError(_0x4bc3ef,null));};exports[_0x2a32('0xbd')]=function(_0x219790,_0x23341c){var _0x2b698f=path[_0x2a32('0xbe')](config['root'],_0x2a32('0xbf'));return db[_0x2a32('0x42')][_0x2a32('0x3c')]({'where':{'id':_0x219790['params']['id']},'attributes':['id',_0x2a32('0xba')],'raw':!![]})[_0x2a32('0x23')](handleEntityNotFound(_0x23341c,null))[_0x2a32('0x23')](function(_0x34b778){if(_0x34b778){if(_[_0x2a32('0x75')](_0x34b778[_0x2a32('0xba')])){return _0x23341c['download'](_0x2b698f);}else{if(!fs[_0x2a32('0xc0')](path[_0x2a32('0xbe')](config[_0x2a32('0xc1')],_0x2a32('0xc2'),_0x34b778['userpic']))){return _0x23341c['download'](_0x2b698f);}return _0x23341c[_0x2a32('0xc3')](path[_0x2a32('0xbe')](config['root'],_0x2a32('0xc2'),_0x34b778['userpic']));}}})[_0x2a32('0x2d')](handleError(_0x23341c,null));};exports[_0x2a32('0xc4')]=function(_0xbf882f,_0x1e7650){return db[_0x2a32('0x42')][_0x2a32('0x3c')]({'where':{'id':_0xbf882f['params']['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x1e7650,null))[_0x2a32('0x23')](function(_0x3c6251){var _0x41c555=[];values=_0x3c6251[_0x2a32('0x5c')];_0x41c555[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x5a'),_0x3c6251[_0x2a32('0x5c')]));_0x41c555['push'](get_open_tabs('sms',_0x3c6251[_0x2a32('0x5c')]));_0x41c555[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x5e'),_0x3c6251[_0x2a32('0x5c')]));_0x41c555['push'](get_open_tabs(_0x2a32('0x64'),_0x3c6251['dataValues']));_0x41c555[_0x2a32('0x55')](get_open_tabs(_0x2a32('0x65'),_0x3c6251[_0x2a32('0x5c')]));_0x41c555['push'](get_open_tabs(_0x2a32('0x5d'),_0x3c6251['dataValues']));return Promise['all'](_0x41c555);})['then'](function(_0x1f24c0){if(_0x1f24c0){var _0xeb2928=_[_0x2a32('0x39')](values[_0x2a32('0xc5')],function(_0x4b0f6e){return{'channel':_0x2a32('0xc6'),'id':_0x4b0f6e['id'],'createdAt':_0x4b0f6e[_0x2a32('0xc7')]};});var _0x5b026c=_[_0x2a32('0x39')](values[_0x2a32('0xc8')],function(_0x289420){return{'channel':_0x2a32('0xc9'),'id':_0x289420['id'],'createdAt':_0x289420['createdAt']};});var _0x318c24=_['map'](values[_0x2a32('0xca')],function(_0x39f32b){return{'channel':_0x2a32('0xcb'),'id':_0x39f32b['id'],'createdAt':_0x39f32b[_0x2a32('0xc7')]};});var _0x34c014=_[_0x2a32('0x39')](values['MailOpenTabs'],function(_0x32db43){return{'channel':_0x2a32('0xcc'),'id':_0x32db43['id'],'createdAt':_0x32db43[_0x2a32('0xc7')]};});var _0x1da0ec=_[_0x2a32('0x39')](values[_0x2a32('0xcd')],function(_0x1e8816){return{'channel':_0x2a32('0xce'),'id':_0x1e8816['id'],'createdAt':_0x1e8816['createdAt']};});var _0x52a3b3=_[_0x2a32('0x39')](values[_0x2a32('0xcf')],function(_0x573b65){return{'channel':'WHATSAPP','id':_0x573b65['id'],'createdAt':_0x573b65[_0x2a32('0xc7')]};});var _0x4fef2f=_[_0x2a32('0xd0')](_0xeb2928,_0x5b026c,_0x318c24,_0x34c014,_0x1da0ec,_0x52a3b3);var _0x1caadd={'count':_0x4fef2f[_0x2a32('0x59')],'rows':_0x4fef2f};return _0x1caadd;}else return null;})['then'](respondWithResult(_0x1e7650,null))[_0x2a32('0x2d')](handleError(_0x1e7650,null));};exports[_0x2a32('0xd1')]=function(_0x12b309,_0x3ba39d){var _0xcc6be5={};return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x12b309[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](function(_0x31e9ec){if(!_0x31e9ec){throw new APINotFoundError(util['format'](_0x2a32('0xd2'),_0x12b309[_0x2a32('0x61')]['id']));}return contacts['describe']();})[_0x2a32('0x23')](function(_0x2ec78f){_0x12b309[_0x2a32('0x4e')][_0x2a32('0x42')]=_0x12b309[_0x2a32('0x61')]['id'];_0xcc6be5=qs[_0x2a32('0x4c')](_0x2ec78f,_0x12b309);if(_0x12b309[_0x2a32('0x4e')][_0x2a32('0xd3')]('includeAll')){_0xcc6be5['include']=[{'model':db[_0x2a32('0xd4')],'as':'List','required':![]},{'model':db[_0x2a32('0xd5')],'as':_0x2a32('0xd6'),'attributes':['id','name',_0x2a32('0xd7')],'where':_0x12b309[_0x2a32('0x4e')][_0x2a32('0xd8')]?{'id':_0x12b309[_0x2a32('0x4e')][_0x2a32('0xd8')]}:undefined,'required':_0x12b309[_0x2a32('0x4e')][_0x2a32('0xd8')]?!![]:![]}];}return contacts[_0x2a32('0x56')](_0x12b309['query'],_0x12b309[_0x2a32('0x35')],_0xcc6be5,_0x2ec78f);})['then'](respondWithFilteredResult(_0x3ba39d,_0xcc6be5))[_0x2a32('0x2d')](APIHandleError(_0x3ba39d));};exports['getQueues']=function(_0x1d5359,_0x562d2b){var _0x3c917a;var _0x3ed01e={};var _0x550a29;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x1d5359['params']['id']},'attributes':['id',_0x2a32('0x3e'),_0x2a32('0x3d')]})['then'](handleEntityNotFound(_0x562d2b,null))[_0x2a32('0x23')](function(_0x23b3a5){if(!utils[_0x2a32('0xa6')](_0x1d5359[_0x2a32('0x4e')][_0x2a32('0xb6')])){throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))]('Unknown\x20channel');}_0x3c917a=_0x23b3a5;var _0x35b8b5={};_0x35b8b5[_0x2a32('0xd9')]=_['keys'](db[_[_0x2a32('0xa9')](_0x1d5359[_0x2a32('0x4e')][_0x2a32('0xb6')])+_0x2a32('0xda')][_0x2a32('0x43')]);_0x35b8b5[_0x2a32('0x4e')]=_['keys'](_0x1d5359[_0x2a32('0x4e')]);_0x35b8b5[_0x2a32('0xdb')]=_['intersection'](_0x35b8b5[_0x2a32('0xd9')],_0x35b8b5[_0x2a32('0x4e')]);_0x3ed01e[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x35b8b5[_0x2a32('0xd9')],qs['fields'](_0x1d5359[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x3ed01e[_0x2a32('0x54')]=_0x3ed01e[_0x2a32('0x54')][_0x2a32('0x59')]?_0x3ed01e[_0x2a32('0x54')]:_0x35b8b5[_0x2a32('0xd9')];_0x3ed01e[_0x2a32('0xde')]=qs[_0x2a32('0xdf')](_0x1d5359[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x3ed01e['where']=qs['filters'](_[_0x2a32('0xe0')](_0x1d5359[_0x2a32('0x4e')],_0x35b8b5[_0x2a32('0xdb')]));if(_0x1d5359[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x3ed01e[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x3ed01e[_0x2a32('0x4d')],{'$or':_['map'](_0x3ed01e['attributes'],function(_0x1e2e58){var _0x59cda0={};_0x59cda0[_0x1e2e58]={'$like':'%'+_0x1d5359[_0x2a32('0x4e')][_0x2a32('0x37')]+'%'};return _0x59cda0;})});}_0x3ed01e=_[_0x2a32('0x62')]({},_0x3ed01e,_0x1d5359[_0x2a32('0x63')]);switch(_0x3c917a[_0x2a32('0x3d')]){case _0x2a32('0x33'):return db[_[_0x2a32('0xa9')](_0x1d5359[_0x2a32('0x4e')][_0x2a32('0xb6')])+_0x2a32('0xda')][_0x2a32('0x56')](_0x3ed01e);case'user':case _0x2a32('0x2f'):return _0x3c917a[_0x2a32('0x32')+_[_0x2a32('0xa9')](_0x1d5359[_0x2a32('0x4e')]['channel'])+_0x2a32('0xab')](_0x3ed01e);default:throw new db['Sequelize'][(_0x2a32('0x98'))](_0x2a32('0xe1'));}})[_0x2a32('0x23')](function(_0x15115c){_0x550a29=_0x15115c[_0x2a32('0x59')];if(!_0x1d5359[_0x2a32('0x4e')][_0x2a32('0xd3')](_0x2a32('0xe2'))){_0x3ed01e[_0x2a32('0x1e')]=qs['limit'](_0x1d5359[_0x2a32('0x4e')]['limit']);_0x3ed01e[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x1d5359[_0x2a32('0x4e')][_0x2a32('0x20')]);}switch(_0x3c917a[_0x2a32('0x3d')]){case _0x2a32('0x33'):return db[_['capitalize'](_0x1d5359[_0x2a32('0x4e')][_0x2a32('0xb6')])+_0x2a32('0xda')][_0x2a32('0x56')](_0x3ed01e);case _0x2a32('0x35'):case _0x2a32('0x2f'):return _0x3c917a['get'+_[_0x2a32('0xa9')](_0x1d5359[_0x2a32('0x4e')]['channel'])+_0x2a32('0xab')](_0x3ed01e);}})['then'](function(_0x45c206){return{'count':_0x550a29,'rows':_0x45c206};})[_0x2a32('0x23')](respondWithResult(_0x562d2b,null))[_0x2a32('0x2d')](handleError(_0x562d2b,null));};exports['getVoiceQueuesRt']=function(_0x5515af,_0xb3007f){var _0x1640c0={};var _0x17dc71={};var _0x4fd0d6;var _0x1a62d8;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x5515af[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0xb3007f,null))[_0x2a32('0x23')](function(_0xf6702){if(_0xf6702){_0x4fd0d6=_0xf6702;_0x17dc71[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0xe4')][_0x2a32('0x43')]);_0x17dc71['query']=_['keys'](_0x5515af['query']);_0x17dc71[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x17dc71[_0x2a32('0xd9')],_0x17dc71[_0x2a32('0x4e')]);_0x1640c0[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x17dc71[_0x2a32('0xd9')],qs['fields'](_0x5515af[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x1640c0[_0x2a32('0x54')]=_0x1640c0[_0x2a32('0x54')]['length']?_0x1640c0[_0x2a32('0x54')]:_0x17dc71[_0x2a32('0xd9')];_0x1640c0[_0x2a32('0xde')]=qs['sort'](_0x5515af['query'][_0x2a32('0xdf')]);_0x1640c0[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x5515af[_0x2a32('0x4e')],_0x17dc71[_0x2a32('0xdb')]));if(_0x5515af[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x1640c0[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x1640c0['where'],{'$or':_[_0x2a32('0x39')](_0x1640c0[_0x2a32('0x54')],function(_0x3aa7ce){var _0x2139bb={};_0x2139bb[_0x3aa7ce]={'$like':'%'+_0x5515af[_0x2a32('0x4e')][_0x2a32('0x37')]+'%'};return _0x2139bb;})});}_0x1640c0=_['merge']({},_0x1640c0,_0x5515af[_0x2a32('0x63')]);return _0x4fd0d6['getVoiceQueuesRt'](_0x1640c0);}})[_0x2a32('0x23')](function(_0x38608){if(_0x38608){_0x1a62d8=_0x38608[_0x2a32('0x59')];if(!_0x5515af['query'][_0x2a32('0xd3')](_0x2a32('0xe2'))){_0x1640c0[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0x5515af[_0x2a32('0x4e')]['limit']);_0x1640c0[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x5515af['query']['offset']);}return _0x4fd0d6[_0x2a32('0xe5')](_0x1640c0);}})[_0x2a32('0x23')](function(_0x4bf8b0){if(_0x4bf8b0){return _0x4bf8b0?{'count':_0x1a62d8,'rows':_0x4bf8b0}:null;}})[_0x2a32('0x23')](respondWithResult(_0xb3007f,null))[_0x2a32('0x2d')](handleError(_0xb3007f,null));};exports[_0x2a32('0xe6')]=function(_0x280b24,_0x1689d7){var _0x23a17c={};var _0x1d6562={};var _0x2147a2;var _0x58f1b0;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x280b24['params']['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x1689d7,null))['then'](function(_0x48ab91){if(_0x48ab91){_0x2147a2=_0x48ab91;_0x1d6562[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db['ChatGroup']['rawAttributes']);_0x1d6562[_0x2a32('0x4e')]=_[_0x2a32('0xe3')](_0x280b24['query']);_0x1d6562[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x1d6562[_0x2a32('0xd9')],_0x1d6562['query']);_0x23a17c[_0x2a32('0x54')]=_['intersection'](_0x1d6562[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x280b24['query'][_0x2a32('0xdd')]));_0x23a17c[_0x2a32('0x54')]=_0x23a17c['attributes']['length']?_0x23a17c[_0x2a32('0x54')]:_0x1d6562['model'];_0x23a17c['order']=qs[_0x2a32('0xdf')](_0x280b24[_0x2a32('0x4e')]['sort']);_0x23a17c[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_['pick'](_0x280b24[_0x2a32('0x4e')],_0x1d6562[_0x2a32('0xdb')]));if(_0x280b24[_0x2a32('0x4e')]['filter']){_0x23a17c['where']=_[_0x2a32('0x62')](_0x23a17c[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x23a17c[_0x2a32('0x54')],function(_0x188c44){var _0x253577={};_0x253577[_0x188c44]={'$like':'%'+_0x280b24[_0x2a32('0x4e')]['filter']+'%'};return _0x253577;})});}_0x23a17c=_[_0x2a32('0x62')]({},_0x23a17c,_0x280b24[_0x2a32('0x63')]);return _0x2147a2['getGroups'](_0x23a17c);}})[_0x2a32('0x23')](function(_0x3495ca){if(_0x3495ca){_0x58f1b0=_0x3495ca[_0x2a32('0x59')];if(!_0x280b24[_0x2a32('0x4e')][_0x2a32('0xd3')](_0x2a32('0xe2'))){_0x23a17c[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0x280b24[_0x2a32('0x4e')][_0x2a32('0x1e')]);_0x23a17c[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x280b24[_0x2a32('0x4e')]['offset']);}return _0x2147a2[_0x2a32('0xe6')](_0x23a17c);}})[_0x2a32('0x23')](function(_0x1a1cd3){if(_0x1a1cd3){return _0x1a1cd3?{'count':_0x58f1b0,'rows':_0x1a1cd3}:null;}})[_0x2a32('0x23')](respondWithResult(_0x1689d7,null))[_0x2a32('0x2d')](handleError(_0x1689d7,null));};exports['getRecordings']=function(_0xe45bde,_0x15279e){var _0x10e9da={'raw':!![],'where':{}};var _0x50fa85={};var _0x3280ea={'count':0x0,'rows':[]};return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0xe45bde[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x15279e,null))[_0x2a32('0x23')](function(_0x1bb5d0){if(_0x1bb5d0){_0x50fa85['model']=_[_0x2a32('0xe3')](db['VoiceRecording'][_0x2a32('0x43')]);_0x50fa85[_0x2a32('0x4e')]=_['keys'](_0xe45bde[_0x2a32('0x4e')]);_0x50fa85['filters']=_[_0x2a32('0xdc')](_0x50fa85['model'],_0x50fa85[_0x2a32('0x4e')]);_0x10e9da[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x50fa85[_0x2a32('0xd9')],qs['fields'](_0xe45bde['query'][_0x2a32('0xdd')]));_0x10e9da['attributes']=_0x10e9da[_0x2a32('0x54')][_0x2a32('0x59')]?_0x10e9da['attributes']:_0x50fa85[_0x2a32('0xd9')];if(!_0xe45bde[_0x2a32('0x4e')][_0x2a32('0xd3')]('nolimit')){_0x10e9da[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0xe45bde[_0x2a32('0x4e')]['limit']);_0x10e9da[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0xe45bde[_0x2a32('0x4e')][_0x2a32('0x20')]);}_0x10e9da[_0x2a32('0xde')]=qs[_0x2a32('0xdf')](_0xe45bde[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x10e9da[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0xe45bde[_0x2a32('0x4e')],_0x50fa85[_0x2a32('0xdb')]));_0x10e9da['where'][_0x2a32('0xe7')]=_0x1bb5d0['id'];if(_0xe45bde[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x10e9da[_0x2a32('0x4d')]=_['merge'](_0x10e9da[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x10e9da[_0x2a32('0x54')],function(_0x2573b1){var _0x2add8c={};_0x2add8c[_0x2573b1]={'$like':'%'+_0xe45bde['query'][_0x2a32('0x37')]+'%'};return _0x2add8c;})});}_0x10e9da=_[_0x2a32('0x62')]({},_0x10e9da,_0xe45bde[_0x2a32('0x63')]);return db['VoiceRecording']['count']({'where':_0x10e9da[_0x2a32('0x4d')]})[_0x2a32('0x23')](function(_0x18f741){_0x3280ea['count']=_0x18f741;if(_0xe45bde[_0x2a32('0x4e')]['includeAll']){_0x10e9da[_0x2a32('0x52')]=[{'all':!![]}];}return db[_0x2a32('0xe8')][_0x2a32('0x56')](_0x10e9da);})[_0x2a32('0x23')](function(_0x2e779c){_0x3280ea['rows']=_0x2e779c;return _0x3280ea;});}})[_0x2a32('0x23')](respondWithFilteredResult(_0x15279e,_0x10e9da))[_0x2a32('0x2d')](handleError(_0x15279e,null));};exports[_0x2a32('0xe9')]=function(_0x1e3c85,_0x239bcd){var _0x500303={'raw':!![],'where':{}};var _0x306a1b={};var _0x1cfed4={'count':0x0,'rows':[]};return db[_0x2a32('0x42')]['findOne']({'where':{'id':_0x1e3c85[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x239bcd,null))[_0x2a32('0x23')](function(_0x350cc2){if(_0x350cc2){_0x306a1b[_0x2a32('0xd9')]=_['keys'](db[_0x2a32('0xea')][_0x2a32('0x43')]);_0x306a1b[_0x2a32('0x4e')]=_[_0x2a32('0xe3')](_0x1e3c85[_0x2a32('0x4e')]);_0x306a1b['filters']=_[_0x2a32('0xdc')](_0x306a1b[_0x2a32('0xd9')],_0x306a1b['query']);_0x500303[_0x2a32('0x54')]=_['intersection'](_0x306a1b['model'],qs[_0x2a32('0xdd')](_0x1e3c85[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x500303[_0x2a32('0x54')]=_0x500303[_0x2a32('0x54')]['length']?_0x500303['attributes']:_0x306a1b['model'];if(!_0x1e3c85[_0x2a32('0x4e')][_0x2a32('0xd3')](_0x2a32('0xe2'))){_0x500303['limit']=qs[_0x2a32('0x1e')](_0x1e3c85['query'][_0x2a32('0x1e')]);_0x500303[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x1e3c85[_0x2a32('0x4e')][_0x2a32('0x20')]);}_0x500303[_0x2a32('0xde')]=qs[_0x2a32('0xdf')](_0x1e3c85[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x500303[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x1e3c85['query'],_0x306a1b['filters']));_0x500303[_0x2a32('0x4d')][_0x2a32('0xe7')]=_0x350cc2['id'];if(_0x1e3c85['query'][_0x2a32('0x37')]){_0x500303['where']=_[_0x2a32('0x62')](_0x500303[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x500303['attributes'],function(_0x3c31f0){var _0x46724e={};_0x46724e[_0x3c31f0]={'$like':'%'+_0x1e3c85[_0x2a32('0x4e')]['filter']+'%'};return _0x46724e;})});}_0x500303=_['merge']({},_0x500303,_0x1e3c85[_0x2a32('0x63')]);return db[_0x2a32('0xea')][_0x2a32('0x1f')]({'where':_0x500303[_0x2a32('0x4d')]})[_0x2a32('0x23')](function(_0x1e4dcb){_0x1cfed4[_0x2a32('0x1f')]=_0x1e4dcb;if(_0x1e3c85['query']['includeAll']){_0x500303['include']=[{'all':!![]}];}return db[_0x2a32('0xea')]['findAll'](_0x500303);})[_0x2a32('0x23')](function(_0x3d1d99){_0x1cfed4['rows']=_0x3d1d99;return _0x1cfed4;});}})['then'](respondWithFilteredResult(_0x239bcd,_0x500303))[_0x2a32('0x2d')](handleError(_0x239bcd,null));};exports[_0x2a32('0xeb')]=function(_0x2bfe1e,_0x1cdca9){var _0x2fa187={};var _0x40d0b4={};var _0x224750;var _0x1ec611;return db['User']['findOne']({'where':{'id':_0x2bfe1e[_0x2a32('0x61')]['id']}})['then'](handleEntityNotFound(_0x1cdca9,null))[_0x2a32('0x23')](function(_0x5c8d8c){if(_0x5c8d8c){_0x224750=_0x5c8d8c;_0x40d0b4[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db['ChatInteraction'][_0x2a32('0x43')]);_0x40d0b4[_0x2a32('0x4e')]=_['keys'](_0x2bfe1e[_0x2a32('0x4e')]);_0x40d0b4[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x40d0b4['model'],_0x40d0b4[_0x2a32('0x4e')]);_0x2fa187[_0x2a32('0x54')]=_['intersection'](_0x40d0b4[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x2bfe1e['query']['fields']));_0x2fa187['attributes']=_0x2fa187['attributes'][_0x2a32('0x59')]?_0x2fa187['attributes']:_0x40d0b4[_0x2a32('0xd9')];_0x2fa187['order']=qs[_0x2a32('0xdf')](_0x2bfe1e['query'][_0x2a32('0xdf')]);_0x2fa187['where']=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x2bfe1e[_0x2a32('0x4e')],_0x40d0b4[_0x2a32('0xdb')]));if(_0x2bfe1e[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x2fa187[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x2fa187['where'],{'$or':_[_0x2a32('0x39')](_0x2fa187['attributes'],function(_0x598811){var _0x1b1fe9={};_0x1b1fe9[_0x598811]={'$like':'%'+_0x2bfe1e[_0x2a32('0x4e')][_0x2a32('0x37')]+'%'};return _0x1b1fe9;})});}_0x2fa187=_[_0x2a32('0x62')]({},_0x2fa187,_0x2bfe1e[_0x2a32('0x63')]);return _0x224750['getChatInteractions'](_0x2fa187);}})[_0x2a32('0x23')](function(_0x184dc8){if(_0x184dc8){_0x1ec611=_0x184dc8[_0x2a32('0x59')];if(!_0x2bfe1e[_0x2a32('0x4e')]['hasOwnProperty'](_0x2a32('0xe2'))){_0x2fa187[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0x2bfe1e[_0x2a32('0x4e')][_0x2a32('0x1e')]);_0x2fa187['offset']=qs[_0x2a32('0x20')](_0x2bfe1e[_0x2a32('0x4e')]['offset']);}return _0x224750[_0x2a32('0xeb')](_0x2fa187);}})[_0x2a32('0x23')](function(_0x4d2511){if(_0x4d2511){return _0x4d2511?{'count':_0x1ec611,'rows':_0x4d2511}:null;}})[_0x2a32('0x23')](respondWithResult(_0x1cdca9,null))[_0x2a32('0x2d')](handleError(_0x1cdca9,null));};exports[_0x2a32('0xec')]=function(_0x2102b3,_0x29d5c0){var _0x288213={};var _0x24eb89={};var _0x4fc7a8;var _0x83f07b;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x2102b3['params']['id']}})['then'](handleEntityNotFound(_0x29d5c0,null))[_0x2a32('0x23')](function(_0xd9da80){if(_0xd9da80){_0x4fc7a8=_0xd9da80;_0x24eb89[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0xed')]['rawAttributes']);_0x24eb89['query']=_['keys'](_0x2102b3[_0x2a32('0x4e')]);_0x24eb89[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x24eb89['model'],_0x24eb89[_0x2a32('0x4e')]);_0x288213[_0x2a32('0x54')]=_['intersection'](_0x24eb89[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x2102b3[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x288213[_0x2a32('0x54')]=_0x288213[_0x2a32('0x54')][_0x2a32('0x59')]?_0x288213['attributes']:_0x24eb89[_0x2a32('0xd9')];_0x288213[_0x2a32('0xde')]=qs['sort'](_0x2102b3['query'][_0x2a32('0xdf')]);_0x288213['where']=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x2102b3[_0x2a32('0x4e')],_0x24eb89[_0x2a32('0xdb')]));if(_0x2102b3[_0x2a32('0x4e')]['filter']){_0x288213[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x288213[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x288213[_0x2a32('0x54')],function(_0xce69b2){var _0x28921b={};_0x28921b[_0xce69b2]={'$like':'%'+_0x2102b3[_0x2a32('0x4e')]['filter']+'%'};return _0x28921b;})});}_0x288213=_['merge']({},_0x288213,_0x2102b3[_0x2a32('0x63')]);return _0x4fc7a8['getOpenchannelInteractions'](_0x288213);}})['then'](function(_0x5c6e66){if(_0x5c6e66){_0x83f07b=_0x5c6e66[_0x2a32('0x59')];if(!_0x2102b3['query']['hasOwnProperty'](_0x2a32('0xe2'))){_0x288213['limit']=qs[_0x2a32('0x1e')](_0x2102b3[_0x2a32('0x4e')]['limit']);_0x288213[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x2102b3[_0x2a32('0x4e')][_0x2a32('0x20')]);}return _0x4fc7a8[_0x2a32('0xec')](_0x288213);}})[_0x2a32('0x23')](function(_0x1695c0){if(_0x1695c0){return _0x1695c0?{'count':_0x83f07b,'rows':_0x1695c0}:null;}})[_0x2a32('0x23')](respondWithResult(_0x29d5c0,null))[_0x2a32('0x2d')](handleError(_0x29d5c0,null));};exports[_0x2a32('0xee')]=function(_0x3d626e,_0x34ce32){var _0x9df5a9={'raw':!![],'where':{}};var _0x396647={};var _0x53f8a6={'count':0x0,'rows':[]};return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x3d626e[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x34ce32,null))[_0x2a32('0x23')](function(_0x5d9323){if(_0x5d9323){_0x396647[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0xef')][_0x2a32('0x43')]);_0x396647[_0x2a32('0x4e')]=_['keys'](_0x3d626e[_0x2a32('0x4e')]);_0x396647[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x396647[_0x2a32('0xd9')],_0x396647[_0x2a32('0x4e')]);_0x9df5a9[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x396647[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x3d626e[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x9df5a9[_0x2a32('0x54')]=_0x9df5a9['attributes'][_0x2a32('0x59')]?_0x9df5a9['attributes']:_0x396647[_0x2a32('0xd9')];if(!_0x3d626e[_0x2a32('0x4e')]['hasOwnProperty'](_0x2a32('0xe2'))){_0x9df5a9[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0x3d626e[_0x2a32('0x4e')][_0x2a32('0x1e')]);_0x9df5a9[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x3d626e[_0x2a32('0x4e')][_0x2a32('0x20')]);}_0x9df5a9[_0x2a32('0xde')]=qs[_0x2a32('0xdf')](_0x3d626e[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x9df5a9[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x3d626e[_0x2a32('0x4e')],_0x396647[_0x2a32('0xdb')]));_0x9df5a9[_0x2a32('0x4d')][_0x2a32('0xe7')]=_0x5d9323['id'];if(_0x3d626e[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x9df5a9['where']=_['merge'](_0x9df5a9[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x9df5a9[_0x2a32('0x54')],function(_0x522bf1){var _0x2bec62={};_0x2bec62[_0x522bf1]={'$like':'%'+_0x3d626e[_0x2a32('0x4e')][_0x2a32('0x37')]+'%'};return _0x2bec62;})});}_0x9df5a9=_[_0x2a32('0x62')]({},_0x9df5a9,_0x3d626e[_0x2a32('0x63')]);return db['MailInteraction'][_0x2a32('0x1f')]({'where':_0x9df5a9[_0x2a32('0x4d')]})[_0x2a32('0x23')](function(_0x5484ca){_0x53f8a6[_0x2a32('0x1f')]=_0x5484ca;if(_0x3d626e['query'][_0x2a32('0x4f')]){_0x9df5a9['include']=[{'all':!![]}];}return db['MailInteraction'][_0x2a32('0x56')](_0x9df5a9);})[_0x2a32('0x23')](function(_0x2637fe){_0x53f8a6[_0x2a32('0x57')]=_0x2637fe;return _0x53f8a6;});}})[_0x2a32('0x23')](respondWithFilteredResult(_0x34ce32,_0x9df5a9))[_0x2a32('0x2d')](handleError(_0x34ce32,null));};exports[_0x2a32('0xf0')]=function(_0xe1c265,_0x27962a){var _0x5a0f6b={};var _0x2a72a1={};var _0x3cfbcf;var _0x2f24be;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0xe1c265[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x27962a,null))[_0x2a32('0x23')](function(_0x47d501){if(_0x47d501){_0x3cfbcf=_0x47d501;_0x2a72a1[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0xf1')]['rawAttributes']);_0x2a72a1[_0x2a32('0x4e')]=_[_0x2a32('0xe3')](_0xe1c265[_0x2a32('0x4e')]);_0x2a72a1[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x2a72a1['model'],_0x2a72a1[_0x2a32('0x4e')]);_0x5a0f6b[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x2a72a1[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0xe1c265[_0x2a32('0x4e')]['fields']));_0x5a0f6b[_0x2a32('0x54')]=_0x5a0f6b[_0x2a32('0x54')][_0x2a32('0x59')]?_0x5a0f6b['attributes']:_0x2a72a1[_0x2a32('0xd9')];_0x5a0f6b[_0x2a32('0xde')]=qs['sort'](_0xe1c265[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x5a0f6b[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0xe1c265[_0x2a32('0x4e')],_0x2a72a1[_0x2a32('0xdb')]));if(_0xe1c265[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x5a0f6b[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x5a0f6b[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x5a0f6b['attributes'],function(_0x2dacdf){var _0x7add81={};_0x7add81[_0x2dacdf]={'$like':'%'+_0xe1c265[_0x2a32('0x4e')][_0x2a32('0x37')]+'%'};return _0x7add81;})});}_0x5a0f6b=_[_0x2a32('0x62')]({},_0x5a0f6b,_0xe1c265[_0x2a32('0x63')]);return _0x3cfbcf[_0x2a32('0xf0')](_0x5a0f6b);}})[_0x2a32('0x23')](function(_0x28f0a8){if(_0x28f0a8){_0x2f24be=_0x28f0a8['length'];if(!_0xe1c265['query']['hasOwnProperty'](_0x2a32('0xe2'))){_0x5a0f6b[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0xe1c265['query'][_0x2a32('0x1e')]);_0x5a0f6b[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0xe1c265['query'][_0x2a32('0x20')]);}return _0x3cfbcf[_0x2a32('0xf0')](_0x5a0f6b);}})[_0x2a32('0x23')](function(_0x5d892f){if(_0x5d892f){return _0x5d892f?{'count':_0x2f24be,'rows':_0x5d892f}:null;}})[_0x2a32('0x23')](respondWithResult(_0x27962a,null))[_0x2a32('0x2d')](handleError(_0x27962a,null));};exports[_0x2a32('0xf2')]=function(_0x3d7791,_0x121f91){var _0x13c810={};var _0x496db0={};var _0x46eafe;var _0x5a0ea5;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x3d7791[_0x2a32('0x61')]['id']}})['then'](handleEntityNotFound(_0x121f91,null))[_0x2a32('0x23')](function(_0x1621e3){if(_0x1621e3){_0x46eafe=_0x1621e3;_0x496db0[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0xf3')][_0x2a32('0x43')]);_0x496db0[_0x2a32('0x4e')]=_[_0x2a32('0xe3')](_0x3d7791['query']);_0x496db0[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x496db0[_0x2a32('0xd9')],_0x496db0['query']);_0x13c810[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x496db0[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x3d7791['query'][_0x2a32('0xdd')]));_0x13c810[_0x2a32('0x54')]=_0x13c810['attributes'][_0x2a32('0x59')]?_0x13c810[_0x2a32('0x54')]:_0x496db0[_0x2a32('0xd9')];_0x13c810[_0x2a32('0xde')]=qs[_0x2a32('0xdf')](_0x3d7791[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x13c810[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x3d7791[_0x2a32('0x4e')],_0x496db0['filters']));if(_0x3d7791[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x13c810[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x13c810[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x13c810[_0x2a32('0x54')],function(_0x340d3b){var _0x255cc4={};_0x255cc4[_0x340d3b]={'$like':'%'+_0x3d7791['query']['filter']+'%'};return _0x255cc4;})});}_0x13c810=_[_0x2a32('0x62')]({},_0x13c810,_0x3d7791[_0x2a32('0x63')]);return _0x46eafe[_0x2a32('0xf2')](_0x13c810);}})[_0x2a32('0x23')](function(_0x387bcc){if(_0x387bcc){_0x5a0ea5=_0x387bcc[_0x2a32('0x59')];if(!_0x3d7791[_0x2a32('0x4e')][_0x2a32('0xd3')]('nolimit')){_0x13c810[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0x3d7791[_0x2a32('0x4e')][_0x2a32('0x1e')]);_0x13c810[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x3d7791[_0x2a32('0x4e')][_0x2a32('0x20')]);}return _0x46eafe[_0x2a32('0xf2')](_0x13c810);}})[_0x2a32('0x23')](function(_0x3f9a9e){if(_0x3f9a9e){return _0x3f9a9e?{'count':_0x5a0ea5,'rows':_0x3f9a9e}:null;}})[_0x2a32('0x23')](respondWithResult(_0x121f91,null))[_0x2a32('0x2d')](handleError(_0x121f91,null));};exports[_0x2a32('0xf4')]=function(_0x123e9c,_0x19846b){var _0x4a79cf={};var _0x28ae84={};var _0x5b7757;var _0x47df2c;return db['User']['findOne']({'where':{'id':_0x123e9c[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x19846b,null))[_0x2a32('0x23')](function(_0x4b4a1c){if(_0x4b4a1c){_0x5b7757=_0x4b4a1c;_0x28ae84[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0xf5')][_0x2a32('0x43')]);_0x28ae84[_0x2a32('0x4e')]=_[_0x2a32('0xe3')](_0x123e9c[_0x2a32('0x4e')]);_0x28ae84[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x28ae84[_0x2a32('0xd9')],_0x28ae84[_0x2a32('0x4e')]);_0x4a79cf[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x28ae84[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x123e9c[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x4a79cf['attributes']=_0x4a79cf[_0x2a32('0x54')][_0x2a32('0x59')]?_0x4a79cf[_0x2a32('0x54')]:_0x28ae84[_0x2a32('0xd9')];_0x4a79cf[_0x2a32('0xde')]=qs[_0x2a32('0xdf')](_0x123e9c[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x4a79cf[_0x2a32('0x4d')]=qs['filters'](_[_0x2a32('0xe0')](_0x123e9c[_0x2a32('0x4e')],_0x28ae84[_0x2a32('0xdb')]));if(_0x123e9c[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x4a79cf[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x4a79cf['where'],{'$or':_[_0x2a32('0x39')](_0x4a79cf[_0x2a32('0x54')],function(_0x2c2285){var _0x527a9e={};_0x527a9e[_0x2c2285]={'$like':'%'+_0x123e9c[_0x2a32('0x4e')][_0x2a32('0x37')]+'%'};return _0x527a9e;})});}_0x4a79cf=_[_0x2a32('0x62')]({},_0x4a79cf,_0x123e9c['options']);return _0x5b7757[_0x2a32('0xf4')](_0x4a79cf);}})[_0x2a32('0x23')](function(_0x4dc868){if(_0x4dc868){_0x47df2c=_0x4dc868['length'];if(!_0x123e9c[_0x2a32('0x4e')][_0x2a32('0xd3')](_0x2a32('0xe2'))){_0x4a79cf[_0x2a32('0x1e')]=qs['limit'](_0x123e9c['query'][_0x2a32('0x1e')]);_0x4a79cf['offset']=qs['offset'](_0x123e9c[_0x2a32('0x4e')][_0x2a32('0x20')]);}return _0x5b7757[_0x2a32('0xf4')](_0x4a79cf);}})['then'](function(_0x41093c){if(_0x41093c){return _0x41093c?{'count':_0x47df2c,'rows':_0x41093c}:null;}})[_0x2a32('0x23')](respondWithResult(_0x19846b,null))[_0x2a32('0x2d')](handleError(_0x19846b,null));};exports['login']=function(_0x51eeb4,_0xef940,_0x2ef8ef){var _0x5979a5;var _0x5abc19;var _0x3d1ed1;var _0x10d528=!_[_0x2a32('0x75')](_0x51eeb4[_0x2a32('0x61')]['id'])?_0x51eeb4[_0x2a32('0x61')]['id']:!_['isNil'](_0x51eeb4[_0x2a32('0x35')]['id'])?_0x51eeb4[_0x2a32('0x35')]['id']:null;return db[_0x2a32('0x42')][_0x2a32('0x3c')]({'where':{'id':_0x10d528,'role':{'$or':[_0x2a32('0x33'),_0x2a32('0x35'),_0x2a32('0x2f')]}},'attributes':['id','name',_0x2a32('0xf6'),'mobile',_0x2a32('0x3d'),_0x2a32('0x6b'),_0x2a32('0xa4')]})['then'](function(_0xaf3fbd){if(_0xaf3fbd){if(_0xaf3fbd[_0x2a32('0x3d')]===_0x2a32('0x2f')){_0x5979a5=_0xaf3fbd;if(_0x51eeb4[_0x2a32('0x66')]['interface']){_0x3d1ed1=util[_0x2a32('0xf7')](_0x2a32('0xf8'),_0x5979a5[_0x51eeb4[_0x2a32('0x66')][_0x2a32('0xa5')]]);}else if(_0x51eeb4['body'][_0x2a32('0xf9')]){_0x3d1ed1=util['format'](_0x2a32('0xb2'),_0x51eeb4[_0x2a32('0x66')][_0x2a32('0xf9')]);}else{_0x3d1ed1=util[_0x2a32('0xf7')]('SIP/%s',_0x5979a5['name']);}socket['to'](util[_0x2a32('0xf7')](_0x2a32('0xfa'),_0x5979a5[_0x2a32('0x3e')]))['emit'](_0x2a32('0xfb'),{'user':{'id':_0x5979a5['id'],'name':_0x5979a5[_0x2a32('0x3e')]},'ip':_0x51eeb4[_0x2a32('0xfc')]['x-forwarded-for']||_0x51eeb4[_0x2a32('0xfd')][_0x2a32('0xfe')]||_0x51eeb4['socket']['remoteAddress']||_0x51eeb4[_0x2a32('0xfd')][_0x2a32('0xff')][_0x2a32('0xfe')]});return db['UserVoiceQueueRt'][_0x2a32('0xb8')]({'where':{'membername':_0x5979a5[_0x2a32('0x3e')]},'individualHooks':!![]});}}else{throw new db[(_0x2a32('0x97'))][(_0x2a32('0x98'))]('User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method');}})[_0x2a32('0x23')](function(){if(_0x5979a5){return _0x5979a5[_0x2a32('0x100')]({'raw':!![]});}})[_0x2a32('0x23')](function(_0x766ce){if(_0x5979a5){if(_0x766ce){_0x5abc19=_0x766ce;if(_0x5abc19[_0x2a32('0x59')]){var _0x4359eb=_0x5abc19['map'](function(_0x5740f8){var _0x1a9743={'membername':_0x5979a5[_0x2a32('0x3e')],'UserId':_0x5979a5['id'],'queue_name':_0x5740f8['name'],'VoiceQueueId':_0x5740f8['id'],'interface':_0x3d1ed1,'paused':_0x5979a5[_0x2a32('0xa4')]||![],'penalty':_0x5740f8[_0x2a32('0x101')]||0x0};return db[_0x2a32('0xe4')][_0x2a32('0xb4')](_0x1a9743);});return Promise[_0x2a32('0x5f')](_0x4359eb);}}}})[_0x2a32('0x23')](function(){if(_0x5979a5){return db['MemberReport'][_0x2a32('0x56')]({'where':{'membername':_0x5979a5[_0x2a32('0x3e')],'exitAt':null}});}})[_0x2a32('0x23')](function(_0x2d07c7){if(_0x5979a5){var _0x1d4927=[];_0x2d07c7[_0x2a32('0x102')](function(_0x5bd98e){_0x1d4927[_0x2a32('0x55')](_0x5bd98e[_0x2a32('0x2e')]({'exitAt':moment()[_0x2a32('0xf7')](_0x2a32('0x103'))}));});return Promise['all'](_0x1d4927);}})[_0x2a32('0x23')](function(){if(_0x5979a5){var _0x1c5476=[];var _0x730b43=[];var _0xc0d5a2=utils[_0x2a32('0x104')]();var _0x58a6ce={'membername':_0x5979a5[_0x2a32('0x3e')],'interface':_0x3d1ed1,'enterAt':moment()[_0x2a32('0xf7')](_0x2a32('0x103')),'role':_0x5979a5[_0x2a32('0x3d')],'internal':_0x5979a5[_0x2a32('0x6b')]};_0xc0d5a2['forEach'](function(_0x331f57){_0x1c5476['push'](_[_0x2a32('0x62')]({'channel':_0x331f57,'type':_0x2a32('0x105'),'data1':_0x51eeb4[_0x2a32('0x66')][_0x2a32('0x106')],'data2':_0x3d1ed1},_0x58a6ce));if(_0x5979a5['loginInPause']){_0x730b43[_0x2a32('0x55')](_[_0x2a32('0x62')]({'channel':_0x331f57,'type':_0x2a32('0x107'),'data1':_0x2a32('0x108')},_0x58a6ce));}});return db[_0x2a32('0x109')][_0x2a32('0x8c')](_0x1c5476['concat'](_0x730b43),{'individualHooks':!![]});}})[_0x2a32('0x23')](function(){if(_0x5979a5){return _0x5979a5[_0x2a32('0x2e')]({'online':!![],'lastLoginAt':moment()[_0x2a32('0xf7')](_0x2a32('0x103')),'voicePause':_0x5979a5['loginInPause']||![],'mailPause':_0x5979a5[_0x2a32('0xa4')]||![],'chatPause':_0x5979a5[_0x2a32('0xa4')]||![],'faxPause':_0x5979a5[_0x2a32('0xa4')]||![],'smsPause':_0x5979a5[_0x2a32('0xa4')]||![],'openchannelPause':_0x5979a5['loginInPause']||![],'whatsappPause':_0x5979a5[_0x2a32('0xa4')]||![],'pauseType':_0x5979a5[_0x2a32('0xa4')]?_0x2a32('0x108'):null,'interface':_0x3d1ed1,'lastPauseAt':moment()['format'](_0x2a32('0x103'))});}})[_0x2a32('0x23')](function(_0x55fde8){if(_0x51eeb4[_0x2a32('0x10a')]){return _0x2ef8ef();}else{return Promise[_0x2a32('0x10b')](_0x55fde8)[_0x2a32('0x23')](respondWithResult(_0xef940,null));}})[_0x2a32('0x2d')](handleError(_0xef940,null));};exports[_0x2a32('0x10c')]=function(_0x311ecd,_0x27c3a0){var _0x43b86b;return db[_0x2a32('0x42')][_0x2a32('0x3c')]({'where':{'id':_0x311ecd[_0x2a32('0x61')]['id'],'role':_0x2a32('0x2f')},'attributes':['id',_0x2a32('0x3e'),_0x2a32('0x3d')]})['then'](handleEntityNotFound(_0x27c3a0,null))[_0x2a32('0x23')](function(_0xb8325a){if(_0xb8325a){_0x43b86b=_0xb8325a;return db[_0x2a32('0xe4')][_0x2a32('0xb8')]({'where':{'membername':_0x43b86b['name']},'individualHooks':!![]});}})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x43b86b[_0x2a32('0x3e')],'exitAt':null}});})[_0x2a32('0x23')](function(_0x543f41){var _0x32a5f6=[];_0x543f41['forEach'](function(_0x295ce8){_0x32a5f6['push'](_0x295ce8['update']({'exitAt':moment()[_0x2a32('0xf7')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x2a32('0x5f')](_0x32a5f6);})[_0x2a32('0x23')](function(){return _0x43b86b[_0x2a32('0x2e')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})['then'](respondWithResult(_0x27c3a0,null))[_0x2a32('0x2d')](handleError(_0x27c3a0,null));};exports['pause']=function(_0x39b360,_0x915035){var _0x3e3db8;return db[_0x2a32('0xe4')][_0x2a32('0x2e')]({'paused':0x1},{'where':{'UserId':_0x39b360[_0x2a32('0x61')]['id']},'individualHooks':!![]})[_0x2a32('0x23')](function(){return db['User'][_0x2a32('0x3c')]({'where':{'id':_0x39b360[_0x2a32('0x61')]['id'],'role':'agent'},'attributes':['id','name',_0x2a32('0x3d'),_0x2a32('0x6b'),_0x2a32('0xa5'),_0x2a32('0xb1')]});})[_0x2a32('0x23')](handleEntityNotFound(_0x915035,null))[_0x2a32('0x23')](function(_0x35e5ec){if(_0x35e5ec){_0x3e3db8=_0x35e5ec;return respondWithRpcPromise(_0x2a32('0x10d'),'pause',{'id':_0x3e3db8['id'],'name':_0x3e3db8[_0x2a32('0x3e')],'pause':!![]});}})['then'](function(){if(_0x3e3db8){return db[_0x2a32('0x109')][_0x2a32('0x56')]({'where':{'membername':_0x3e3db8['name'],'type':_0x2a32('0x107'),'exitAt':null}});}})['then'](function(_0x1d7b10){if(_0x1d7b10[_0x2a32('0x59')]){var _0x142595=moment()['format'](_0x2a32('0x103'));for(var _0x19af68=0x0,_0x37447f=_0x1d7b10[_0x2a32('0x59')];_0x19af68<_0x37447f;_0x19af68++){_0x1d7b10[_0x19af68][_0x2a32('0x10e')]({'exitAt':_0x142595});}}})['then'](function(){var _0x1a4f13=[];var _0x53fc77=utils[_0x2a32('0x104')]();_0x53fc77['forEach'](function(_0x4f1cc9){_0x1a4f13[_0x2a32('0x55')]({'channel':_0x4f1cc9,'membername':_0x3e3db8[_0x2a32('0x3e')],'interface':_['isNil'](_0x3e3db8[_0x2a32('0xa5')])?util[_0x2a32('0xf7')](_0x2a32('0xb2'),_0x3e3db8[_0x2a32('0x3e')]):_0x3e3db8[_0x2a32('0xa5')],'type':_0x2a32('0x107'),'enterAt':moment()[_0x2a32('0xf7')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x39b360['body'][_0x2a32('0x45')]||_0x2a32('0x10f'),'role':_0x3e3db8[_0x2a32('0x3d')],'internal':_0x3e3db8['internal']});});return db['MemberReport'][_0x2a32('0x8c')](_0x1a4f13,{'individualHooks':!![]});})[_0x2a32('0x23')](function(){return _0x3e3db8[_0x2a32('0x2e')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x39b360[_0x2a32('0x66')][_0x2a32('0x45')]||_0x2a32('0x10f'),'lastPauseAt':moment()[_0x2a32('0xf7')]('YYYY-MM-DD\x20HH:mm:ss')});})[_0x2a32('0x23')](respondWithResult(_0x915035,null))[_0x2a32('0x2d')](handleError(_0x915035,null));};exports[_0x2a32('0x110')]=function(_0x2a9c9f,_0x461a62){if(_0x2a9c9f[_0x2a32('0x66')][_0x2a32('0xb6')]&&!utils[_0x2a32('0xa6')](_0x2a9c9f[_0x2a32('0x66')][_0x2a32('0xb6')])){throw new APIBadRequestError(util[_0x2a32('0xf7')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x2a9c9f[_0x2a32('0x66')][_0x2a32('0xb6')]));}return db[_0x2a32('0x42')][_0x2a32('0x3c')]({'where':{'id':_0x2a9c9f[_0x2a32('0x61')]['id']},'attributes':['id',_0x2a32('0x3e'),_0x2a32('0x3d'),_0x2a32('0x6b'),_0x2a32('0xa5'),'online',_0x2a32('0xb3'),'mailPause','chatPause',_0x2a32('0x111'),'openchannelPause',_0x2a32('0x112'),'whatsappPause',_0x2a32('0x113'),_0x2a32('0x114')]})['then'](function(_0x9c59e7){if(!_0x9c59e7){throw new APINotFoundError(util[_0x2a32('0xf7')]('User\x20with\x20id\x20%s\x20not\x20found',_0x2a9c9f['params']['id']));}return _0x9c59e7[_0x2a32('0x110')](_0x2a9c9f[_0x2a32('0x66')][_0x2a32('0xb6')]);})[_0x2a32('0x23')](respondWithResult(_0x461a62,null))[_0x2a32('0x2d')](APIHandleError(_0x461a62));};exports[_0x2a32('0x115')]=function(_0x144f81,_0x3678c5){var _0x1dea02={};var _0x2c85cc={};var _0x2425d2;var _0x50e2fa;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x144f81[_0x2a32('0x61')]['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x3678c5,null))['then'](function(_0x2ae83d){if(_0x2ae83d){_0x2425d2=_0x2ae83d;_0x2c85cc[_0x2a32('0xd9')]=_['keys'](db['Team']['rawAttributes']);_0x2c85cc['query']=_[_0x2a32('0xe3')](_0x144f81[_0x2a32('0x4e')]);_0x2c85cc[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x2c85cc[_0x2a32('0xd9')],_0x2c85cc[_0x2a32('0x4e')]);_0x1dea02[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x2c85cc[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x144f81[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x1dea02[_0x2a32('0x54')]=_0x1dea02[_0x2a32('0x54')][_0x2a32('0x59')]?_0x1dea02[_0x2a32('0x54')]:_0x2c85cc[_0x2a32('0xd9')];_0x1dea02[_0x2a32('0xde')]=qs[_0x2a32('0xdf')](_0x144f81['query'][_0x2a32('0xdf')]);_0x1dea02[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x144f81[_0x2a32('0x4e')],_0x2c85cc[_0x2a32('0xdb')]));if(_0x144f81['query'][_0x2a32('0x37')]){_0x1dea02[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x1dea02[_0x2a32('0x4d')],{'$or':_[_0x2a32('0x39')](_0x1dea02[_0x2a32('0x54')],function(_0x2707fb){var _0x1abcf3={};_0x1abcf3[_0x2707fb]={'$like':'%'+_0x144f81['query'][_0x2a32('0x37')]+'%'};return _0x1abcf3;})});}_0x1dea02=_[_0x2a32('0x62')]({},_0x1dea02,_0x144f81['options']);return _0x2425d2['getTeams'](_0x1dea02);}})[_0x2a32('0x23')](function(_0x1f94d5){if(_0x1f94d5){_0x50e2fa=_0x1f94d5[_0x2a32('0x59')];if(!_0x144f81[_0x2a32('0x4e')][_0x2a32('0xd3')](_0x2a32('0xe2'))){_0x1dea02[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0x144f81['query'][_0x2a32('0x1e')]);_0x1dea02[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x144f81[_0x2a32('0x4e')]['offset']);}return _0x2425d2[_0x2a32('0x115')](_0x1dea02);}})[_0x2a32('0x23')](function(_0x23f5af){if(_0x23f5af){return _0x23f5af?{'count':_0x50e2fa,'rows':_0x23f5af}:null;}})[_0x2a32('0x23')](respondWithResult(_0x3678c5,null))[_0x2a32('0x2d')](handleError(_0x3678c5,null));};exports[_0x2a32('0x116')]=function(_0x45724c,_0x2861cc){var _0xf7204d=_0x45724c[_0x2a32('0x61')]['id'];var _0x15252f=_0x45724c[_0x2a32('0x66')]?_0x45724c[_0x2a32('0x66')]['ids']:null;var _0xca2f48=[];return Promise[_0x2a32('0x10b')]()['then'](function(){if(!_0x15252f)throw new APIBadRequestError(_0x2a32('0x117'));})['then'](function(){return db['User'][_0x2a32('0x9e')]({'where':{'id':_0xf7204d}});})[_0x2a32('0x23')](function(_0x3f380d){if(!_0x3f380d)throw new APINotFoundError(util[_0x2a32('0xf7')](_0x2a32('0xd2'),_0x45724c[_0x2a32('0x61')]['id']));return db['sequelize'][_0x2a32('0x118')](function(_0x3df841){return _0x3f380d[_0x2a32('0x116')](_0x15252f,{'transaction':_0x3df841})['then'](function(){return db[_0x2a32('0x119')][_0x2a32('0x56')]({'where':{'id':{'$in':_0x15252f}}});})[_0x2a32('0x23')](function(_0x44b40e){var _0x57e21f=_[_0x2a32('0x39')](_0x44b40e,function(_0x587f62){return _0x587f62[_0x2a32('0x11a')]();});return Promise[_0x2a32('0x5f')](_0x57e21f);})[_0x2a32('0x23')](function(_0x57f303){_0xca2f48=_[_0x2a32('0x11b')](_0x57f303);var _0x14977d=_[_0x2a32('0x39')](_0xca2f48,function(_0x472abe){return _0x472abe[_0x2a32('0x11c')](_0x3f380d['id'],{'transaction':_0x3df841});});return Promise[_0x2a32('0x5f')](_0x14977d);})['then'](function(){if(!_0x3f380d[_0x2a32('0xb1')])return;var _0x4d87b6=_[_0x2a32('0x37')](_0xca2f48,function(_0x5d0f1e){return _0x5d0f1e[_0x2a32('0x11d')](_0x2a32('0xb6'))===_0x2a32('0x11e');});var _0x54d583=_['map'](_0x4d87b6,function(_0x4f9baf){return db[_0x2a32('0xe4')][_0x2a32('0xb4')]({'membername':_0x3f380d[_0x2a32('0x3e')],'UserId':_0x3f380d['id'],'queue_name':_0x4f9baf[_0x2a32('0x3e')],'VoiceQueueId':_0x4f9baf['id'],'interface':_[_0x2a32('0x75')](_0x3f380d[_0x2a32('0xa5')])?util[_0x2a32('0xf7')](_0x2a32('0xb2'),_0x3f380d[_0x2a32('0x3e')]):_0x3f380d[_0x2a32('0xa5')],'paused':_0x3f380d[_0x2a32('0xb3')]||![],'penalty':_0x3f380d[_0x2a32('0xac')]},{'transaction':_0x3df841});});return Promise[_0x2a32('0x5f')](_0x54d583);})['then'](function(){return db[_0x2a32('0x11f')][_0x2a32('0x56')]({'where':{'teamId':{'$in':_0x15252f}}});})[_0x2a32('0x23')](function(_0x2957f9){var _0x518e3b=_[_0x2a32('0x39')](_0x2957f9,function(_0x393f38){return db['UserVoicePrefix'][_0x2a32('0x85')]({'UserId':_0x3f380d['id'],'VoicePrefixId':_0x393f38[_0x2a32('0x120')]},{'transaction':_0x3df841});});return Promise[_0x2a32('0x5f')](_0x518e3b);});});})[_0x2a32('0x23')](function(){for(var _0x7afd96=0x0;_0x7afd96<_0xca2f48[_0x2a32('0x59')];_0x7afd96++){var _0x92b9ad=_0xca2f48[_0x7afd96][_0x2a32('0x11d')]('channel');var _0x233275=_0x92b9ad+_0x2a32('0xad');socket[_0x2a32('0x30')](_0x2a32('0x35')+_0x92b9ad+_0x2a32('0xae'),{'UserId':_0xf7204d,['queueField']:_0xca2f48[_0x7afd96]['id']});}})[_0x2a32('0x23')](respondWithStatusCode(_0x2861cc,null))[_0x2a32('0x2d')](APIHandleError(_0x2861cc));};exports[_0x2a32('0x121')]=function(_0x49b4d9,_0x3a62be){var _0x33af4f=_0x49b4d9[_0x2a32('0x61')]['id'];var _0x51edb9=null;if(_0x49b4d9[_0x2a32('0x4e')][_0x2a32('0x69')]){_0x51edb9=_[_0x2a32('0x122')](_0x49b4d9[_0x2a32('0x4e')][_0x2a32('0x69')])?_0x49b4d9[_0x2a32('0x4e')][_0x2a32('0x69')]:[_0x49b4d9[_0x2a32('0x4e')][_0x2a32('0x69')]];}var _0x23e574=[];return Promise[_0x2a32('0x10b')]()[_0x2a32('0x23')](function(){if(!_0x51edb9)throw new APIBadRequestError(_0x2a32('0x123'));})[_0x2a32('0x23')](function(){return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x33af4f}});})['then'](function(_0x3c9218){if(!_0x3c9218)throw new APINotFoundError(util['format'](_0x2a32('0xd2'),_0x49b4d9[_0x2a32('0x61')]['id']));return db['sequelize'][_0x2a32('0x118')](function(_0x29d6fe){return _0x3c9218[_0x2a32('0x121')](_0x51edb9,{'transaction':_0x29d6fe})[_0x2a32('0x23')](function(){return db['Team']['findAll']({'where':{'id':{'$in':_0x51edb9}}});})[_0x2a32('0x23')](function(_0x42137f){var _0x3eac16=_[_0x2a32('0x39')](_0x42137f,function(_0x5bba36){return _0x5bba36[_0x2a32('0x11a')]();});return Promise['all'](_0x3eac16);})[_0x2a32('0x23')](function(_0x33403e){_0x23e574=_[_0x2a32('0x11b')](_0x33403e);var _0x15d5c7=_['map'](_0x23e574,function(_0x120c6c){return _0x120c6c[_0x2a32('0x124')](_0x3c9218['id'],{'transaction':_0x29d6fe});});return Promise[_0x2a32('0x5f')](_0x15d5c7);})[_0x2a32('0x23')](function(){if(!_0x3c9218[_0x2a32('0xb1')])return;var _0x25d03b=_[_0x2a32('0x37')](_0x23e574,function(_0x64acd0){return _0x64acd0[_0x2a32('0x11d')](_0x2a32('0xb6'))===_0x2a32('0x11e');});var _0x29c7ce=_['map'](_0x25d03b,function(_0x1561dc){return db['UserVoiceQueueRt'][_0x2a32('0xb8')]({'where':{'VoiceQueueId':_0x1561dc['id'],'UserId':_0x3c9218['id']},'transaction':_0x29d6fe});});return Promise[_0x2a32('0x5f')](_0x29c7ce);})[_0x2a32('0x23')](function(){return db['TeamVoicePrefix']['findAll']({'where':{'teamId':{'$in':_0x51edb9}}});})[_0x2a32('0x23')](function(_0x33667c){var _0x54009b=_['map'](_0x33667c,function(_0x3f844d){return db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x3c9218['id'],'VoicePrefixId':_0x3f844d[_0x2a32('0x120')]}},{'transaction':_0x29d6fe});});return Promise[_0x2a32('0x5f')](_0x54009b);});});})[_0x2a32('0x23')](function(){for(var _0x1105fd=0x0;_0x1105fd<_0x23e574[_0x2a32('0x59')];_0x1105fd++){var _0x112ac7=_0x23e574[_0x1105fd][_0x2a32('0x11d')](_0x2a32('0xb6'));var _0x35a645=_0x112ac7+_0x2a32('0xad');socket[_0x2a32('0x30')](_0x2a32('0x35')+_0x112ac7+_0x2a32('0xb7'),{'UserId':_0x33af4f,['queueField']:_0x23e574[_0x1105fd]['id']});}})[_0x2a32('0x23')](respondWithStatusCode(_0x3a62be,null))[_0x2a32('0x2d')](APIHandleError(_0x3a62be));};exports['getLists']=function(_0x3eb5e,_0x10e4b6){var _0x4f2acf={};var _0x206609={};var _0x290d08;var _0x1ae04a;return db['User'][_0x2a32('0x9e')]({'where':{'id':_0x3eb5e['params']['id']}})[_0x2a32('0x23')](handleEntityNotFound(_0x10e4b6,null))[_0x2a32('0x23')](function(_0x2fc7de){if(_0x2fc7de){_0x290d08=_0x2fc7de;_0x206609[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0xd4')][_0x2a32('0x43')]);_0x206609[_0x2a32('0x4e')]=_['keys'](_0x3eb5e['query']);_0x206609['filters']=_[_0x2a32('0xdc')](_0x206609[_0x2a32('0xd9')],_0x206609['query']);_0x4f2acf[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x206609[_0x2a32('0xd9')],qs[_0x2a32('0xdd')](_0x3eb5e[_0x2a32('0x4e')][_0x2a32('0xdd')]));_0x4f2acf[_0x2a32('0x54')]=_0x4f2acf[_0x2a32('0x54')][_0x2a32('0x59')]?_0x4f2acf[_0x2a32('0x54')]:_0x206609['model'];_0x4f2acf[_0x2a32('0xde')]=qs['sort'](_0x3eb5e[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x4f2acf[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_[_0x2a32('0xe0')](_0x3eb5e[_0x2a32('0x4e')],_0x206609[_0x2a32('0xdb')]));if(_0x3eb5e[_0x2a32('0x4e')][_0x2a32('0x37')]){_0x4f2acf[_0x2a32('0x4d')]=_['merge'](_0x4f2acf[_0x2a32('0x4d')],{'$or':_['map'](_0x4f2acf[_0x2a32('0x54')],function(_0x5dd68c){var _0x11277b={};_0x11277b[_0x5dd68c]={'$like':'%'+_0x3eb5e[_0x2a32('0x4e')][_0x2a32('0x37')]+'%'};return _0x11277b;})});}_0x4f2acf=_[_0x2a32('0x62')]({},_0x4f2acf,_0x3eb5e[_0x2a32('0x63')]);return _0x290d08[_0x2a32('0x125')](_0x4f2acf);}})[_0x2a32('0x23')](function(_0x150035){if(_0x150035){_0x1ae04a=_0x150035[_0x2a32('0x59')];if(!_0x3eb5e[_0x2a32('0x4e')][_0x2a32('0xd3')](_0x2a32('0xe2'))){_0x4f2acf[_0x2a32('0x1e')]=qs[_0x2a32('0x1e')](_0x3eb5e[_0x2a32('0x4e')]['limit']);_0x4f2acf[_0x2a32('0x20')]=qs[_0x2a32('0x20')](_0x3eb5e[_0x2a32('0x4e')][_0x2a32('0x20')]);}return _0x290d08[_0x2a32('0x125')](_0x4f2acf);}})[_0x2a32('0x23')](function(_0x5ce1e2){if(_0x5ce1e2){return _0x5ce1e2?{'count':_0x1ae04a,'rows':_0x5ce1e2}:null;}})[_0x2a32('0x23')](respondWithResult(_0x10e4b6,null))['catch'](handleError(_0x10e4b6,null));};exports[_0x2a32('0x126')]=function(_0x152801,_0x1872b9){var _0x20af6d={};var _0x16590e={};var _0xe2fd1;return db[_0x2a32('0x42')][_0x2a32('0x9e')]({'where':{'id':_0x152801['params']['id']}})['then'](handleEntityNotFound(_0x1872b9,null))['then'](function(_0x24f0ce){if(_0x24f0ce){_0xe2fd1=_0x24f0ce;_0x16590e[_0x2a32('0xd9')]=_[_0x2a32('0xe3')](db[_0x2a32('0x42')]['rawAttributes']);_0x16590e[_0x2a32('0x4e')]=_[_0x2a32('0xe3')](_0x152801[_0x2a32('0x4e')]);_0x16590e[_0x2a32('0xdb')]=_[_0x2a32('0xdc')](_0x16590e[_0x2a32('0xd9')],_0x16590e['query']);_0x20af6d[_0x2a32('0x54')]=_[_0x2a32('0xdc')](_0x16590e[_0x2a32('0xd9')],qs['fields'](_0x152801['query'][_0x2a32('0xdd')]));_0x20af6d[_0x2a32('0x54')]=_0x20af6d[_0x2a32('0x54')][_0x2a32('0x59')]?_0x20af6d[_0x2a32('0x54')]:_0x16590e['model'];_0x20af6d['order']=qs[_0x2a32('0xdf')](_0x152801[_0x2a32('0x4e')][_0x2a32('0xdf')]);_0x20af6d[_0x2a32('0x4d')]=qs[_0x2a32('0xdb')](_['pick'](_0x152801[_0x2a32('0x4e')],_0x16590e[_0x2a32('0xdb')]));if(_0x152801[_0x2a32('0x4e')]['filter']){_0x20af6d[_0x2a32('0x4d')]=_[_0x2a32('0x62')](_0x20af6d[_0x2a32('0x4d')],{'$or':_['map'](_0x20af6d[_0x2a32('0x54')],function(_0x51bfaa){var _0x5d17e4={};_0x5d17e4[_0x51bfaa]={'$like':'%'+_0x152801['query'][_0x2a32('0x37')]+'%'};return _0x5d17e4;})});}_0x20af6d[_0x2a32('0xd9')]=db[_0x2a32('0x42')];_0x20af6d['as']=_0x2a32('0x36');_0x20af6d=_['merge']({},_0x20af6d,_0x152801['options']);return _0xe2fd1[_0x2a32('0x100')]({'include':[_0x20af6d]});}})[_0x2a32('0x23')](function(_0x175e16){if(_0x175e16){var _0x2a637c={},_0x24c2d5=[];for(var _0x72ac38=0x0;_0x72ac38<_0x175e16[_0x2a32('0x59')];_0x72ac38+=0x1){for(var _0x21b1b2=0x0,_0xf88b46;_0x21b1b2<_0x175e16[_0x72ac38][_0x2a32('0x36')][_0x2a32('0x59')];_0x21b1b2+=0x1){_0xf88b46=_0x175e16[_0x72ac38][_0x2a32('0x36')][_0x21b1b2][_0x2a32('0x32')]({'plain':!![]});_0x2a637c[_0xf88b46['id']]=_0xf88b46;}}_0x2a637c=_['values'](_0x2a637c);for(var _0x3e0449=qs[_0x2a32('0x20')](_0x152801[_0x2a32('0x4e')]['offset']);_0x3e0449<_0x2a637c[_0x2a32('0x59')]&&_0x24c2d5[_0x2a32('0x59')]=_0x112b01){_0xd844df=_0x112b01;_0x7c404f=0xc8;}else{_0x7c404f=0xce;}_0x1c9067[_0xa41a('0x17')](_0x7c404f);return _0x1c9067['set'](_0xa41a('0x1d'),_0x577cd6+'-'+_0xd844df+'/'+_0x112b01)[_0xa41a('0x18')](_0x287d62);}return null;};}function respondWithRpcPromise(_0xa0ab8c,_0xb9eebf,_0x5025c3,_0x4db65e){return new Promise(function(_0x3a26f9,_0x36c5ed){var _0x255b6e=_0x4db65e||amiClient;return _0x255b6e['request'](_0xa0ab8c,_0x5025c3)['then'](function(_0x43766b){logger[_0xa41a('0x1e')](_0xa41a('0x1f'),_0xb9eebf,_0xa41a('0x20'));logger[_0xa41a('0x21')]('User,\x20%s,\x20%s,\x20%s',_0xb9eebf,_0xa41a('0x20'),JSON[_0xa41a('0x22')](_0x43766b));if(_0x43766b[_0xa41a('0x23')]){if(_0x43766b['error']['code']===0x1f4){logger[_0xa41a('0x23')](_0xa41a('0x1f'),_0xb9eebf,_0x43766b[_0xa41a('0x23')]['message']);return _0x36c5ed(_0x43766b[_0xa41a('0x23')][_0xa41a('0x24')]);}logger[_0xa41a('0x23')]('User,\x20%s,\x20%s',_0xb9eebf,_0x43766b[_0xa41a('0x23')][_0xa41a('0x24')]);return _0x3a26f9(_0x43766b[_0xa41a('0x23')][_0xa41a('0x24')]);}else{logger[_0xa41a('0x1e')]('User,\x20%s,\x20%s',_0xb9eebf,_0xa41a('0x20'));_0x3a26f9(_0x43766b[_0xa41a('0x25')][_0xa41a('0x24')]);}})['catch'](function(_0x3e69ce){logger[_0xa41a('0x23')](_0xa41a('0x1f'),_0xb9eebf,_0x3e69ce);_0x36c5ed(_0x3e69ce);});});}function saveUpdates(_0x3e5bce){return function(_0x3f99b0){if(_0x3f99b0){return _0x3f99b0[_0xa41a('0x26')](_0x3e5bce)[_0xa41a('0x27')](function(_0x3d9563){if(_0x3d9563[_0xa41a('0x28')]===_0xa41a('0x29')){socket[_0xa41a('0x2a')]('userNotification:recalc:'+_0x3d9563['id'],_0x3d9563);}return _0x3d9563;});}return null;};}function removeEntity(_0x3e4578,_0x2a8226){return function(_0x2bf9f1){if(_0x2bf9f1){return _0x2bf9f1[_0xa41a('0x2b')]({'transaction':_0x2a8226})[_0xa41a('0x27')](function(){var _0x461f53=_0x2bf9f1[_0xa41a('0x2c')]({'plain':!![]});if(_0x461f53[_0xa41a('0x28')]===_0xa41a('0x2d'))return;var _0x474b04=[{'name':_0xa41a('0x2e'),'value':_0xa41a('0x2f'),'ignore':!![]},{'name':'Agents','value':_0xa41a('0x29'),'ignore':![]},{'name':_0xa41a('0x30'),'value':_0xa41a('0x31'),'ignore':![]}];var _0x4f1cb5=_(_0x474b04)[_0xa41a('0x32')](_0xa41a('0x33'))[_0xa41a('0x34')](_0xa41a('0x35'))['value']();if(_[_0xa41a('0x36')](_0x4f1cb5,_0x461f53['role'])){return;}var _0x37c734=_[_0xa41a('0x37')](_0x474b04,['value',_0x461f53[_0xa41a('0x28')]])[_0xa41a('0x38')];return db[_0xa41a('0x39')][_0xa41a('0x2b')]({'where':{'type':_0x37c734,'resourceId':_0x461f53['id']},'transaction':_0x2a8226})[_0xa41a('0x27')](function(){return _0x2bf9f1;});})['then'](function(){_0x3e4578['status'](0xcc)[_0xa41a('0x3a')]();});}};}function handleEntityNotFound(_0x48f8f1){return function(_0x52aa1d){if(!_0x52aa1d){_0x48f8f1[_0xa41a('0x16')](0x194);}return _0x52aa1d;};}function handleError(_0x37386e,_0x5d0b85){_0x5d0b85=_0x5d0b85||0x1f4;return function(_0x5ad663){logger['error'](_0x5ad663[_0xa41a('0x3b')]);if(_0x5ad663['name']){delete _0x5ad663['name'];}_0x37386e[_0xa41a('0x17')](_0x5d0b85)[_0xa41a('0x3c')](_0x5ad663);};}function getUserAttributes(){return _(db[_0xa41a('0x3d')]['rawAttributes'])[_0xa41a('0x34')](function(_0x25e1ba){return{'name':_0x25e1ba[_0xa41a('0x3e')],'type':_0x25e1ba['type'][_0xa41a('0x3f')]};})['filter'](function(_0x18659b){return![_0xa41a('0x40'),_0xa41a('0x41'),_0xa41a('0x42'),_0xa41a('0x43'),_0xa41a('0x44'),_0xa41a('0x45')][_0xa41a('0x36')](_0x18659b[_0xa41a('0x38')]);})['value']();}exports['index']=function(_0x100c56,_0x4760b2){var _0x47617c={},_0x34da9b={'count':0x0,'rows':[]};var _0x5d2cef=getUserAttributes();_0x47617c=qs[_0xa41a('0x46')](_0x5d2cef,_0x100c56);var _0x578c6a={'where':_0x47617c[_0xa41a('0x47')]};return db[_0xa41a('0x3d')][_0xa41a('0x1a')](_0x578c6a)[_0xa41a('0x27')](function(_0x169246){_0x34da9b['count']=_0x169246;if(_0x100c56[_0xa41a('0x48')]['includeAll']){_0x47617c[_0xa41a('0x49')]=[{'all':!![]}];}if(_0x100c56[_0xa41a('0x48')]['userSetting']==='true'){_0x47617c[_0xa41a('0x49')]=[{'model':db[_0xa41a('0x4a')],'as':_0xa41a('0x4b')}];}if(!_[_0xa41a('0x36')](_0x47617c['attributes'],'id')){_0x47617c[_0xa41a('0x4c')][_0xa41a('0x4d')]('id');}return db[_0xa41a('0x3d')][_0xa41a('0x4e')](_0x47617c);})[_0xa41a('0x27')](function(_0x243677){_0x34da9b[_0xa41a('0x4f')]=_0x243677;if(_0x100c56['query'][_0xa41a('0x50')]===_0xa41a('0x51')){var _0x96feb5=[];for(var _0x5d13e7=0x0;_0x5d13e7<_0x34da9b[_0xa41a('0x4f')][_0xa41a('0x52')];_0x5d13e7++){_0x96feb5['push'](get_open_tabs(_0xa41a('0x53'),_0x34da9b['rows'][_0x5d13e7][_0xa41a('0x54')]));_0x96feb5[_0xa41a('0x4d')](get_open_tabs(_0xa41a('0x55'),_0x34da9b[_0xa41a('0x4f')][_0x5d13e7]['dataValues']));_0x96feb5[_0xa41a('0x4d')](get_open_tabs('fax',_0x34da9b[_0xa41a('0x4f')][_0x5d13e7][_0xa41a('0x54')]));_0x96feb5[_0xa41a('0x4d')](get_open_tabs(_0xa41a('0x56'),_0x34da9b[_0xa41a('0x4f')][_0x5d13e7]['dataValues']));_0x96feb5[_0xa41a('0x4d')](get_open_tabs('openchannel',_0x34da9b[_0xa41a('0x4f')][_0x5d13e7][_0xa41a('0x54')]));_0x96feb5[_0xa41a('0x4d')](get_open_tabs(_0xa41a('0x57'),_0x34da9b['rows'][_0x5d13e7][_0xa41a('0x54')]));}return Promise[_0xa41a('0x58')](_0x96feb5)[_0xa41a('0x27')](function(){return _0x34da9b;});}else{return _0x34da9b;}})['then'](respondWithFilteredResult(_0x4760b2,_0x47617c))['catch'](handleError(_0x4760b2,null));};exports['show']=function(_0x1b89b5,_0x3d7b83){var _0x5a4c85=getUserAttributes();_0x1b89b5[_0xa41a('0x48')]['id']=_0x1b89b5[_0xa41a('0x59')]['id'];var _0x27197f=qs[_0xa41a('0x46')](_0x5a4c85,_0x1b89b5);if(_0x1b89b5['query']['includeAll']){_0x27197f[_0xa41a('0x49')]=[{'all':!![]}];}if(_0x1b89b5[_0xa41a('0x48')][_0xa41a('0x4b')]===_0xa41a('0x51')){_0x27197f[_0xa41a('0x49')]=[{'model':db[_0xa41a('0x4a')],'as':_0xa41a('0x4b')}];}_0x27197f=_[_0xa41a('0x5a')]({},_0x27197f,_0x1b89b5['options']);if(!_[_0xa41a('0x36')](_0x27197f[_0xa41a('0x4c')],'id')){_0x27197f[_0xa41a('0x4c')][_0xa41a('0x4d')]('id');}return db[_0xa41a('0x3d')][_0xa41a('0x37')](_0x27197f)[_0xa41a('0x27')](handleEntityNotFound(_0x3d7b83,null))['then'](function(_0x57d4ff){var _0xc2f2cd=[];values=_0x57d4ff;if(_0x1b89b5[_0xa41a('0x48')][_0xa41a('0x50')]===_0xa41a('0x51')){_0xc2f2cd[_0xa41a('0x4d')](get_open_tabs('chat',_0x57d4ff[_0xa41a('0x54')]));_0xc2f2cd[_0xa41a('0x4d')](get_open_tabs('sms',_0x57d4ff[_0xa41a('0x54')]));_0xc2f2cd[_0xa41a('0x4d')](get_open_tabs(_0xa41a('0x5b'),_0x57d4ff[_0xa41a('0x54')]));_0xc2f2cd['push'](get_open_tabs(_0xa41a('0x57'),_0x57d4ff[_0xa41a('0x54')]));_0xc2f2cd['push'](get_open_tabs(_0xa41a('0x5c'),_0x57d4ff[_0xa41a('0x54')]));_0xc2f2cd['push'](get_open_tabs(_0xa41a('0x56'),_0x57d4ff[_0xa41a('0x54')]));return Promise[_0xa41a('0x58')](_0xc2f2cd);}else{return values;}})[_0xa41a('0x27')](function(){return values;})['then'](respondWithResult(_0x3d7b83,null))[_0xa41a('0x5d')](handleError(_0x3d7b83,null));};exports[_0xa41a('0x26')]=function(_0x209f15,_0x3b0a28){if(_0x209f15[_0xa41a('0x5e')]['id']){delete _0x209f15[_0xa41a('0x5e')]['id'];}delete _0x209f15[_0xa41a('0x5e')][_0xa41a('0x28')];return db['User'][_0xa41a('0x37')]({'where':{'id':_0x209f15[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x3b0a28,null))['then'](saveUpdates(_0x209f15['body'],null))[_0xa41a('0x27')](respondWithResult(_0x3b0a28,null))['catch'](handleError(_0x3b0a28,null));};exports[_0xa41a('0x5f')]=function(_0x473d54,_0xc68bb9){return db[_0xa41a('0x3d')]['describe']()[_0xa41a('0x27')](respondWithResult(_0xc68bb9,null))[_0xa41a('0x5d')](handleError(_0xc68bb9,null));};exports[_0xa41a('0x60')]=function(_0x500f5a,_0x4fd695){return db[_0xa41a('0x3d')]['find']({'where':{'id':_0x500f5a['params']['id']}})['then'](handleEntityNotFound(_0x4fd695,null))['then'](function(_0x2bdd5d){if(_0x2bdd5d){return _0x2bdd5d['addContacts'](_0x500f5a[_0xa41a('0x5e')][_0xa41a('0x61')],_[_0xa41a('0x62')](_0x500f5a[_0xa41a('0x5e')],[_0xa41a('0x61'),'id'])||{});}})[_0xa41a('0x27')](respondWithResult(_0x4fd695,null))['catch'](handleError(_0x4fd695,null));};function validateUser(_0x489e8b){return new Promise(function(_0x2e530c,_0x244e65){if(_0x489e8b[_0xa41a('0x63')])return _0x2e530c(_0x489e8b);return db['Setting']['findById'](0x1)[_0xa41a('0x27')](function(_0xb97530){if(_0xb97530['securePassword'])authService[_0xa41a('0x64')](_0x489e8b[_0xa41a('0x40')]);db[_0xa41a('0x3d')][_0xa41a('0x65')](_0xa41a('0x63'))[_0xa41a('0x27')](function(_0x36e6ae){if(_[_0xa41a('0x66')](_0x36e6ae)){_0x489e8b[_0xa41a('0x63')]=_0xb97530[_0xa41a('0x67')]||0x1;return;}if(_[_0xa41a('0x66')](_0xb97530[_0xa41a('0x67')])||_0xb97530[_0xa41a('0x67')]===_0x36e6ae){_0x489e8b[_0xa41a('0x63')]=_0x36e6ae+0x1;return;}if(_0xb97530[_0xa41a('0x67')]>_0x36e6ae){_0x489e8b['internal']=_0xb97530[_0xa41a('0x67')];return;}return db[_0xa41a('0x68')][_0xa41a('0x48')](_0xa41a('0x69'),{'type':db[_0xa41a('0x68')][_0xa41a('0x6a')][_0xa41a('0x6b')]})['then'](function(_0x5bfcf0){if(_0x5bfcf0&&_0x5bfcf0[_0xa41a('0x52')]){for(var _0x5afc40=0x0,_0x4cf0d7=_0x5bfcf0[_0xa41a('0x52')];_0x5afc40<_0x4cf0d7&&_[_0xa41a('0x66')](_0x489e8b[_0xa41a('0x63')]);_0x5afc40++){if(_0xb97530['min_internal']<=_0x5bfcf0[_0x5afc40]['from']){_0x489e8b[_0xa41a('0x63')]=_0x5bfcf0[_0x5afc40][_0xa41a('0x6c')];}else if(_0xb97530[_0xa41a('0x67')]>_0x5bfcf0[_0x5afc40][_0xa41a('0x6c')]&&_0xb97530[_0xa41a('0x67')]<=_0x5bfcf0[_0x5afc40]['to']){_0x489e8b[_0xa41a('0x63')]=_0xb97530[_0xa41a('0x67')];}}}if(_['isNil'](_0x489e8b[_0xa41a('0x63')])){_0x489e8b[_0xa41a('0x63')]=_0x36e6ae+0x1;}return _0x2e530c(_0x489e8b);});});})[_0xa41a('0x5d')](function(_0x379f6e){_0x244e65(_0x379f6e);});});}function updateUser(_0x28def2){return new Promise(function(_0x14ea14,_0x17a0c6){try{if(_0x28def2[_0xa41a('0x6d')]){_0x28def2[_0xa41a('0x6e')]=_0x28def2[_0xa41a('0x63')];_0x28def2[_0xa41a('0x6f')]={'mailbox':_0x28def2[_0xa41a('0x63')],'password':_0x28def2[_0xa41a('0x40')],'fullname':_0x28def2['fullname'],'email':_0x28def2[_0xa41a('0x70')]};}if(_0x28def2['role']===_0xa41a('0x29')){if(!_0x28def2[_0xa41a('0x71')])_0x28def2[_0xa41a('0x71')]=[_0xa41a('0x72'),_0xa41a('0x73'),_0xa41a('0x74'),'113',_0xa41a('0x75'),_0xa41a('0x76'),_0xa41a('0x77'),_0xa41a('0x78'),_0xa41a('0x79'),_0xa41a('0x7a'),_0xa41a('0x7b'),_0xa41a('0x7c'),'111',_0xa41a('0x7d'),_0xa41a('0x7e')];}_0x14ea14(_0x28def2);}catch(_0x47d71e){_0x17a0c6(_0x47d71e);}});}exports[_0xa41a('0x7f')]=function(_0x29d06a,_0x1deeb9){if(_0x29d06a[_0xa41a('0x2f')][_0xa41a('0x28')]==='agent')throw new Error(_0xa41a('0x80'));if(_0x29d06a['body'][_0xa41a('0x28')]===_0xa41a('0x2f')&&_0x29d06a['user']['role']!==_0xa41a('0x2d')){throw new Error(_0xa41a('0x81'));}if(_0x29d06a[_0xa41a('0x5e')][_0xa41a('0x28')]===_0xa41a('0x2d')&&_0x29d06a[_0xa41a('0x2f')][_0xa41a('0x28')]!=='admin'){throw new Error(_0xa41a('0x82'));}return licenseUtil[_0xa41a('0x83')]([_0x29d06a[_0xa41a('0x5e')]])[_0xa41a('0x27')](function(){return validateUser(_0x29d06a['body']);})[_0xa41a('0x27')](function(_0x3f0ce2){return updateUser(_0x3f0ce2)[_0xa41a('0x27')](function(_0x274a6b){if(_0x274a6b['role']===_0xa41a('0x2d')){_0x274a6b[_0xa41a('0x84')]=_0x29d06a['user'][_0xa41a('0x84')];delete _0x274a6b['userProfileId'];}return _0x274a6b;});})[_0xa41a('0x27')](function(_0xba1bb8){return db['User'][_0xa41a('0x7f')](_0xba1bb8,{'include':[{'model':db[_0xa41a('0x6f')],'as':_0xa41a('0x6f')}]});})[_0xa41a('0x27')](function(_0x34c353){if(_0x29d06a[_0xa41a('0x5e')]['role']===_0xa41a('0x2f'))return _0x34c353;if(_0x29d06a[_0xa41a('0x2f')][_0xa41a('0x28')]!=='user')return _0x34c353;return db[_0xa41a('0x85')][_0xa41a('0x37')]({'where':{'name':_0x34c353['role']===_0xa41a('0x29')?_0xa41a('0x86'):_0xa41a('0x30'),'userProfileId':_0x29d06a[_0xa41a('0x2f')][_0xa41a('0x87')]},'raw':!![]})[_0xa41a('0x27')](function(_0x4be9d7){if(!_0x4be9d7||_0x4be9d7[_0xa41a('0x88')]!=0x0)return _0x34c353;return db[_0xa41a('0x39')][_0xa41a('0x7f')]({'name':_0x34c353[_0xa41a('0x38')],'resourceId':_0x34c353['id'],'type':_0x4be9d7['name'],'sectionId':_0x4be9d7['id']},{})['then'](function(){return _0x34c353;});})['catch'](function(_0x1203f2){logger[_0xa41a('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1203f2);throw _0x1203f2;});})[_0xa41a('0x27')](respondWithResult(_0x1deeb9,0xc9))[_0xa41a('0x5d')](handleError(_0x1deeb9,null));};exports[_0xa41a('0x89')]=function(_0xad804a,_0x4c4f01){var _0x582d4a=_0xad804a[_0xa41a('0x5e')];var _0x3786a7=[];if(_0xad804a[_0xa41a('0x2f')][_0xa41a('0x28')]===_0xa41a('0x29'))throw new Error(_0xa41a('0x80'));if(_[_0xa41a('0x8a')](_0x582d4a,['role',_0xa41a('0x2f')])&&_0xad804a['user'][_0xa41a('0x28')]!=='admin'){throw new Error(_0xa41a('0x81'));}if(_[_0xa41a('0x8a')](_0x582d4a,['role','admin'])&&_0xad804a[_0xa41a('0x2f')][_0xa41a('0x28')]!==_0xa41a('0x2d')){throw new Error(_0xa41a('0x8b'));}return licenseUtil[_0xa41a('0x83')](_0x582d4a)[_0xa41a('0x27')](function(){return validateUser(_0x582d4a[0x0]);})[_0xa41a('0x27')](function(){for(var _0xa0a1af=0x1;_0xa0a1af<_0x582d4a['length'];_0xa0a1af++){var _0x36a62e=_0x582d4a[_0xa0a1af-0x1][_0xa41a('0x63')];if(!_0x582d4a[_0xa0a1af][_0xa41a('0x63')])_0x582d4a[_0xa0a1af][_0xa41a('0x63')]=_0x36a62e+0x1;_0x3786a7['push'](validateUser(_0x582d4a[_0xa0a1af]));}return Promise[_0xa41a('0x58')](_0x3786a7);})[_0xa41a('0x27')](function(){_0x3786a7=[];for(var _0x20f0ed=0x0;_0x20f0ed<_0x582d4a[_0xa41a('0x52')];_0x20f0ed++){_0x3786a7[_0xa41a('0x4d')](updateUser(_0x582d4a[_0x20f0ed]));}return Promise[_0xa41a('0x58')](_0x3786a7);})['then'](function(){_0x3786a7=_0x582d4a[_0xa41a('0x34')](function(_0x17f57b){return db[_0xa41a('0x3d')]['create'](_0x17f57b,{'include':[{'model':db[_0xa41a('0x6f')],'as':'VoiceMail'}]})[_0xa41a('0x27')](function(_0x1ce25c){_0x17f57b['id']=_0x1ce25c['id'];return _0x17f57b;});});return Promise[_0xa41a('0x58')](_0x3786a7);})[_0xa41a('0x27')](function(_0x501542){if(_0xad804a[_0xa41a('0x5e')][_0xa41a('0x28')]===_0xa41a('0x2f'))return _0x501542;if(_0xad804a['user']['role']!==_0xa41a('0x2f'))return _0x501542;var _0x42d487=_[_0xa41a('0x8a')](_0x501542,function(_0x1f1ef8){return _0x1f1ef8[_0xa41a('0x28')]===_0xa41a('0x29')||_0x1f1ef8['role']===_0xa41a('0x31');});if(!_0x42d487)return _0x501542;return db[_0xa41a('0x85')][_0xa41a('0x4e')]({'where':{'name':{'$or':[_0xa41a('0x86'),_0xa41a('0x30')]},'userProfileId':_0xad804a['user'][_0xa41a('0x87')]},'raw':!![]})[_0xa41a('0x27')](function(_0x55d7da){if(_[_0xa41a('0x8c')](_0x55d7da)||!_['some'](_0x55d7da,[_0xa41a('0x88'),0x0]))return _0x501542;_0x3786a7=[];var _0x30d898=_(_0x55d7da)['map'](function(_0x4051a5){if(_0x4051a5[_0xa41a('0x88')]===0x1)return;return _0x4051a5['name']===_0xa41a('0x86')?'agent':_0xa41a('0x31');})[_0xa41a('0x8d')]()[_0xa41a('0x35')]();for(var _0x5c6427=0x0;_0x5c6427<_0x501542['length'];_0x5c6427++){if(!_['includes'](_0x30d898,_0x501542[_0x5c6427]['role']))return;var _0x899bbf=_0x501542[_0x5c6427][_0xa41a('0x28')]===_0xa41a('0x29')?_0xa41a('0x86'):_0xa41a('0x30');_0x3786a7[_0xa41a('0x4d')](db['UserProfileResource'][_0xa41a('0x7f')]({'name':_0x501542[_0x5c6427][_0xa41a('0x38')],'resourceId':_0x501542[_0x5c6427]['id'],'type':_0x899bbf,'sectionId':_[_0xa41a('0x37')](_0x55d7da,[_0xa41a('0x38'),_0x899bbf])['id']},{}));}return Promise[_0xa41a('0x58')](_0x3786a7);});})['then'](respondWithResult(_0x4c4f01,0xc9))[_0xa41a('0x5d')](handleError(_0x4c4f01,null));};exports[_0xa41a('0x8e')]=function(_0x6213be,_0xf190f9){if(_0x6213be[_0xa41a('0x5e')]['id']){delete _0x6213be[_0xa41a('0x5e')]['id'];}return db[_0xa41a('0x3d')][_0xa41a('0x37')]({'where':{'id':_0x6213be[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](function(_0x3fe51a){if(!_0x3fe51a)return null;if(_0x3fe51a['id']===_0x6213be[_0xa41a('0x2f')]['id']){if(!_0x6213be[_0xa41a('0x5e')][_0xa41a('0x8f')]||!_0x6213be['body']['newPassword']){throw new db['Sequelize'][(_0xa41a('0x90'))]('Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword');}if(!_0x3fe51a[_0xa41a('0x91')](_0x6213be[_0xa41a('0x5e')]['oldPassword'])){throw new db['Sequelize'][(_0xa41a('0x90'))](_0xa41a('0x92'));}if(_0x6213be[_0xa41a('0x5e')][_0xa41a('0x8f')]===_0x6213be[_0xa41a('0x5e')][_0xa41a('0x93')]){throw new db['Sequelize'][(_0xa41a('0x90'))](_0xa41a('0x94'));}}else if(_0x6213be[_0xa41a('0x2f')][_0xa41a('0x28')]==='admin'){if(!_0x6213be[_0xa41a('0x5e')][_0xa41a('0x93')]){throw new db[(_0xa41a('0x95'))]['ValidationError']('Invalid\x20body\x20format.\x20Use\x20newPassword');}}else if(_0x6213be[_0xa41a('0x2f')][_0xa41a('0x28')]===_0xa41a('0x2f')){if(!_0x6213be[_0xa41a('0x5e')][_0xa41a('0x93')]){throw new db[(_0xa41a('0x95'))][(_0xa41a('0x90'))](_0xa41a('0x96'));}if(_0x3fe51a['role']!==_0xa41a('0x29')){throw new db[(_0xa41a('0x95'))]['ValidationError'](_0xa41a('0x80'));}}else{throw new db[(_0xa41a('0x95'))]['ValidationError'](_0xa41a('0x80'));}return _0x3fe51a;})[_0xa41a('0x27')](handleEntityNotFound(_0xf190f9,null))[_0xa41a('0x27')](function(_0x30a4ec){return db[_0xa41a('0x97')][_0xa41a('0x98')]({'attributes':['id',_0xa41a('0x99'),_0xa41a('0x9a'),_0xa41a('0x9b')]})[_0xa41a('0x27')](function(_0x6247f6){if(_0x6247f6[_0xa41a('0x99')])authService[_0xa41a('0x64')](_0x6213be['body']['newPassword']);if(!_0x6247f6[_0xa41a('0x9a')]||!_0x30a4ec[_0xa41a('0x42')])return _0x30a4ec;authService[_0xa41a('0x9c')](_0x6213be[_0xa41a('0x5e')][_0xa41a('0x93')],_0x30a4ec[_0xa41a('0x42')],_0x6247f6[_0xa41a('0x9b')]);return _0x30a4ec;})[_0xa41a('0x27')](saveUpdates({'password':_0x6213be[_0xa41a('0x5e')][_0xa41a('0x93')],'passwordResetAt':_0x6213be[_0xa41a('0x2f')]['id']==_0x6213be[_0xa41a('0x59')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x6213be['body']['newPassword'],_0x30a4ec['previousPasswords'])},null));})[_0xa41a('0x27')](respondWithResult(_0xf190f9,null))[_0xa41a('0x5d')](handleError(_0xf190f9,null));};exports['addQueues']=function(_0x8b310e,_0x30b76d){var _0x4138b9=_0x8b310e[_0xa41a('0x5e')]['channel'];return db[_0xa41a('0x3d')]['find']({'where':{'id':_0x8b310e[_0xa41a('0x59')]['id']},'attributes':['id',_0xa41a('0x38'),'role','online','loginInPause',_0xa41a('0x9d'),_0xa41a('0x9e')]})['then'](handleEntityNotFound(_0x30b76d,null))[_0xa41a('0x27')](function(_0x443c9b){if(_0x443c9b){if(!utils[_0xa41a('0x9f')](_0x4138b9)){throw new db['Sequelize'][(_0xa41a('0x90'))]('Unknown\x20channel');}return _0x443c9b['add'+_[_0xa41a('0xa0')](_0x4138b9[_0xa41a('0xa1')]())+_0xa41a('0xa2')](_0x8b310e[_0xa41a('0x5e')][_0xa41a('0x61')],{'penalty':_0x8b310e['body'][_0xa41a('0xa3')]||0x0})[_0xa41a('0xa4')](function(_0x5143cf){for(var _0xa83133=0x0;_0xa83133<_0x8b310e[_0xa41a('0x5e')]['ids'][_0xa41a('0x52')];_0xa83133+=0x1){var _0x42ca47={'UserId':Number(_0x8b310e[_0xa41a('0x59')]['id'])};_0x42ca47[_[_0xa41a('0xa0')](_0x4138b9['toLowerCase']())+'QueueId']=Number(_0x8b310e[_0xa41a('0x5e')][_0xa41a('0x61')][_0xa83133]);socket['emit'](_0xa41a('0x2f')+_[_0xa41a('0xa0')](_0x4138b9['toLowerCase']())+'Queue:save',_0x42ca47);}return _0x5143cf;})[_0xa41a('0x27')](function(){if(_0x4138b9===_0xa41a('0xa5')){return db[_0xa41a('0xa6')]['findAll']({'where':{'id':_0x8b310e[_0xa41a('0x5e')]['ids']||[]},'raw':!![],'attributes':['id',_0xa41a('0x38')]});}})[_0xa41a('0x27')](function(_0x1515ab){var _0x172d9d=_0x443c9b[_0xa41a('0x2c')]({'plain':!![]});var _0x488769=[];if(_0x4138b9===_0xa41a('0xa5')&&_0x172d9d[_0xa41a('0x28')]===_0xa41a('0x29')&&_0x172d9d[_0xa41a('0xa7')]){for(let _0x1b36ab=0x0;_0x1b36ab<_0x1515ab['length'];_0x1b36ab+=0x1){_0x488769[_0xa41a('0x4d')]({'membername':_0x172d9d[_0xa41a('0x38')],'UserId':_0x172d9d['id'],'queue_name':_0x1515ab[_0x1b36ab][_0xa41a('0x38')],'VoiceQueueId':_0x1515ab[_0x1b36ab]['id'],'interface':_[_0xa41a('0x66')](_0x172d9d[_0xa41a('0x9e')])?util[_0xa41a('0xa8')](_0xa41a('0xa9'),_0x172d9d['name']):_0x172d9d[_0xa41a('0x9e')],'paused':_0x172d9d[_0xa41a('0x9d')]||![],'penalty':_0x8b310e[_0xa41a('0x5e')][_0xa41a('0xa3')]||0x0});}return Promise[_0xa41a('0x58')](_0x488769[_0xa41a('0x34')](function(_0x1a5922){return db[_0xa41a('0xaa')][_0xa41a('0xab')](_0x1a5922);}));}return _0x443c9b;});}})[_0xa41a('0x27')](respondWithStatusCode(_0x30b76d,null))[_0xa41a('0x5d')](handleError(_0x30b76d,null));};exports[_0xa41a('0xac')]=function(_0x2a68ae,_0x460f69){var _0x2a52aa,_0x36cc05;return db[_0xa41a('0x3d')]['find']({'where':{'id':_0x2a68ae[_0xa41a('0x59')]['id']},'attributes':['id',_0xa41a('0x38'),'role']})['then'](handleEntityNotFound(_0x460f69,null))['then'](function(_0x21e3ec){if(_0x21e3ec){_0x2a52aa=_0x21e3ec;if(!_0x2a68ae[_0xa41a('0x48')][_0xa41a('0xad')]||!utils[_0xa41a('0x9f')](_0x2a68ae[_0xa41a('0x48')][_0xa41a('0xad')])){throw new db[(_0xa41a('0x95'))][(_0xa41a('0x90'))](_0xa41a('0xae'));}return _0x21e3ec[_0xa41a('0xaf')+_[_0xa41a('0xa0')](_0x2a68ae['query'][_0xa41a('0xad')][_0xa41a('0xa1')]())+_0xa41a('0xa2')](_0x2a68ae[_0xa41a('0x48')][_0xa41a('0x61')]);}})[_0xa41a('0x27')](function(_0x2690b){if(_[_0xa41a('0xb0')](_0x2a68ae['query'][_0xa41a('0x61')])){for(var _0x3fa68d=0x0;_0x3fa68d<_0x2a68ae[_0xa41a('0x48')]['ids']['length'];_0x3fa68d+=0x1){_0x36cc05={'UserId':Number(_0x2a68ae['params']['id'])};_0x36cc05[_[_0xa41a('0xa0')](_0x2a68ae[_0xa41a('0x48')]['channel']['toLowerCase']())+_0xa41a('0xb1')]=Number(_0x2a68ae['query'][_0xa41a('0x61')][_0x3fa68d]);socket[_0xa41a('0x2a')](_0xa41a('0x2f')+_[_0xa41a('0xa0')](_0x2a68ae[_0xa41a('0x48')][_0xa41a('0xad')][_0xa41a('0xa1')]())+_0xa41a('0xb2'),_0x36cc05);}}else{_0x36cc05={'UserId':Number(_0x2a68ae['params']['id'])};_0x36cc05[_[_0xa41a('0xa0')](_0x2a68ae[_0xa41a('0x48')][_0xa41a('0xad')][_0xa41a('0xa1')]())+_0xa41a('0xb1')]=Number(_0x2a68ae[_0xa41a('0x48')][_0xa41a('0x61')]);socket['emit'](_0xa41a('0x2f')+_['capitalize'](_0x2a68ae[_0xa41a('0x48')][_0xa41a('0xad')][_0xa41a('0xa1')]())+_0xa41a('0xb2'),_0x36cc05);}return _0x2690b;})[_0xa41a('0x27')](function(){if(_0x2a68ae[_0xa41a('0x48')][_0xa41a('0xad')]===_0xa41a('0xa5')){return db['UserVoiceQueueRt'][_0xa41a('0x2b')]({'where':{'UserId':_0x2a68ae[_0xa41a('0x59')]['id'],'VoiceQueueId':_0x2a68ae[_0xa41a('0x48')]['ids']},'individualHooks':!![]})['then'](function(){return _0x2a52aa;});}return _0x2a52aa;})[_0xa41a('0x27')](respondWithStatusCode(_0x460f69,null))['catch'](handleError(_0x460f69,null));};exports[_0xa41a('0xb3')]=function(_0x3a472b,_0x3100d6){_0x3a472b[_0xa41a('0x5e')][_0xa41a('0xb4')]=_0x3a472b[_0xa41a('0xb5')][_0xa41a('0xb6')];return db['User']['find']({'where':{'id':_0x3a472b[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x3100d6,null))[_0xa41a('0x27')](saveUpdates(_0x3a472b[_0xa41a('0x5e')],null))[_0xa41a('0x27')](respondWithResult(_0x3100d6,null))[_0xa41a('0x5d')](handleError(_0x3100d6,null));};exports[_0xa41a('0xb7')]=function(_0x29b7b1,_0x5a3ff8){var _0x1f2564=path['join'](config[_0xa41a('0xb8')],'server/files/images/logos/default_profile.png');return db['User'][_0xa41a('0x37')]({'where':{'id':_0x29b7b1[_0xa41a('0x59')]['id']},'attributes':['id',_0xa41a('0xb4')],'raw':!![]})[_0xa41a('0x27')](handleEntityNotFound(_0x5a3ff8,null))['then'](function(_0x374bba){if(_0x374bba){if(_['isNil'](_0x374bba['userpic'])){return _0x5a3ff8[_0xa41a('0xb9')](_0x1f2564);}else{if(!fs[_0xa41a('0xba')](path['join'](config['root'],_0xa41a('0xbb'),_0x374bba[_0xa41a('0xb4')]))){return _0x5a3ff8[_0xa41a('0xb9')](_0x1f2564);}return _0x5a3ff8[_0xa41a('0xb9')](path[_0xa41a('0xbc')](config[_0xa41a('0xb8')],_0xa41a('0xbb'),_0x374bba[_0xa41a('0xb4')]));}}})[_0xa41a('0x5d')](handleError(_0x5a3ff8,null));};exports[_0xa41a('0xbd')]=function(_0x333623,_0x360737){return db[_0xa41a('0x3d')]['find']({'where':{'id':_0x333623[_0xa41a('0x59')]['id']},'attributes':['id']})[_0xa41a('0x27')](handleEntityNotFound(_0x360737,null))['then'](function(_0x314d60){var _0x65bc0=[];values=_0x314d60[_0xa41a('0x54')];_0x65bc0[_0xa41a('0x4d')](get_open_tabs('chat',_0x314d60[_0xa41a('0x54')]));_0x65bc0[_0xa41a('0x4d')](get_open_tabs(_0xa41a('0x55'),_0x314d60['dataValues']));_0x65bc0[_0xa41a('0x4d')](get_open_tabs('openchannel',_0x314d60[_0xa41a('0x54')]));_0x65bc0[_0xa41a('0x4d')](get_open_tabs(_0xa41a('0x57'),_0x314d60[_0xa41a('0x54')]));_0x65bc0[_0xa41a('0x4d')](get_open_tabs('fax',_0x314d60[_0xa41a('0x54')]));_0x65bc0['push'](get_open_tabs('mail',_0x314d60[_0xa41a('0x54')]));return Promise[_0xa41a('0x58')](_0x65bc0);})[_0xa41a('0x27')](function(_0x7353a7){if(_0x7353a7){var _0x26cd73=_['map'](values['ChatOpenTabs'],function(_0x117621){return{'channel':'CHAT','id':_0x117621['id'],'createdAt':_0x117621['createdAt']};});var _0x4c3bbf=_['map'](values[_0xa41a('0xbe')],function(_0x4bb87c){return{'channel':_0xa41a('0xbf'),'id':_0x4bb87c['id'],'createdAt':_0x4bb87c[_0xa41a('0xc0')]};});var _0x4c9e01=_[_0xa41a('0x34')](values[_0xa41a('0xc1')],function(_0x3aa2b8){return{'channel':_0xa41a('0xc2'),'id':_0x3aa2b8['id'],'createdAt':_0x3aa2b8['createdAt']};});var _0x4e8366=_[_0xa41a('0x34')](values[_0xa41a('0xc3')],function(_0x53dc98){return{'channel':_0xa41a('0xc4'),'id':_0x53dc98['id'],'createdAt':_0x53dc98[_0xa41a('0xc0')]};});var _0x733b03=_['map'](values[_0xa41a('0xc5')],function(_0x551168){return{'channel':_0xa41a('0xc6'),'id':_0x551168['id'],'createdAt':_0x551168[_0xa41a('0xc0')]};});var _0x3fefd5=_['map'](values['WhatsappOpenTabs'],function(_0x2e9163){return{'channel':_0xa41a('0xc7'),'id':_0x2e9163['id'],'createdAt':_0x2e9163[_0xa41a('0xc0')]};});var _0x5eac18=_['concat'](_0x26cd73,_0x4c3bbf,_0x4c9e01,_0x4e8366,_0x733b03,_0x3fefd5);var _0x1be431={'count':_0x5eac18[_0xa41a('0x52')],'rows':_0x5eac18};return _0x1be431;}else return null;})[_0xa41a('0x27')](respondWithResult(_0x360737,null))[_0xa41a('0x5d')](handleError(_0x360737,null));};exports['getContacts']=function(_0x2b84e4,_0x3a66dd){var _0x2b69bd={};return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x2b84e4[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](function(_0x47f720){if(!_0x47f720){throw new APINotFoundError(util[_0xa41a('0xa8')](_0xa41a('0xc8'),_0x2b84e4[_0xa41a('0x59')]['id']));}return contacts[_0xa41a('0x5f')]();})[_0xa41a('0x27')](function(_0x358961){_0x2b84e4[_0xa41a('0x48')]['User']=_0x2b84e4[_0xa41a('0x59')]['id'];_0x2b69bd=qs[_0xa41a('0x46')](_0x358961,_0x2b84e4);if(_0x2b84e4[_0xa41a('0x48')]['hasOwnProperty'](_0xa41a('0xc9'))){_0x2b69bd[_0xa41a('0x49')]=[{'model':db[_0xa41a('0xca')],'as':_0xa41a('0xcb'),'required':![]},{'model':db[_0xa41a('0xcc')],'as':_0xa41a('0xcd'),'attributes':['id',_0xa41a('0x38'),_0xa41a('0xce')],'where':_0x2b84e4['query']['tag']?{'id':_0x2b84e4[_0xa41a('0x48')]['tag']}:undefined,'required':_0x2b84e4[_0xa41a('0x48')][_0xa41a('0xcf')]?!![]:![]}];}return contacts['findAll'](_0x2b84e4[_0xa41a('0x48')],_0x2b84e4['user'],_0x2b69bd,_0x358961);})[_0xa41a('0x27')](respondWithFilteredResult(_0x3a66dd,_0x2b69bd))['catch'](APIHandleError(_0x3a66dd));};exports[_0xa41a('0xd0')]=function(_0x22b40e,_0x513229){var _0x2395f7;var _0x413bd8={};var _0x21dcd7;return db['User'][_0xa41a('0x98')]({'where':{'id':_0x22b40e[_0xa41a('0x59')]['id']},'attributes':['id',_0xa41a('0x38'),_0xa41a('0x28')]})[_0xa41a('0x27')](handleEntityNotFound(_0x513229,null))[_0xa41a('0x27')](function(_0x43e343){if(!utils[_0xa41a('0x9f')](_0x22b40e[_0xa41a('0x48')]['channel'])){throw new db[(_0xa41a('0x95'))][(_0xa41a('0x90'))](_0xa41a('0xae'));}_0x2395f7=_0x43e343;var _0x17cdf4={};_0x17cdf4[_0xa41a('0xd1')]=_[_0xa41a('0xd2')](db[_[_0xa41a('0xa0')](_0x22b40e['query'][_0xa41a('0xad')])+'Queue'][_0xa41a('0xd3')]);_0x17cdf4['query']=_[_0xa41a('0xd2')](_0x22b40e[_0xa41a('0x48')]);_0x17cdf4[_0xa41a('0xd4')]=_[_0xa41a('0xd5')](_0x17cdf4[_0xa41a('0xd1')],_0x17cdf4[_0xa41a('0x48')]);_0x413bd8[_0xa41a('0x4c')]=_[_0xa41a('0xd5')](_0x17cdf4['model'],qs['fields'](_0x22b40e[_0xa41a('0x48')]['fields']));_0x413bd8[_0xa41a('0x4c')]=_0x413bd8[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x413bd8[_0xa41a('0x4c')]:_0x17cdf4[_0xa41a('0xd1')];_0x413bd8['order']=qs['sort'](_0x22b40e[_0xa41a('0x48')][_0xa41a('0xd6')]);_0x413bd8[_0xa41a('0x47')]=qs[_0xa41a('0xd4')](_['pick'](_0x22b40e[_0xa41a('0x48')],_0x17cdf4['filters']));if(_0x22b40e[_0xa41a('0x48')][_0xa41a('0x32')]){_0x413bd8['where']=_[_0xa41a('0x5a')](_0x413bd8[_0xa41a('0x47')],{'$or':_['map'](_0x413bd8[_0xa41a('0x4c')],function(_0x1752f1){var _0x4b3a0a={};_0x4b3a0a[_0x1752f1]={'$like':'%'+_0x22b40e['query']['filter']+'%'};return _0x4b3a0a;})});}_0x413bd8=_[_0xa41a('0x5a')]({},_0x413bd8,_0x22b40e[_0xa41a('0xd7')]);switch(_0x2395f7[_0xa41a('0x28')]){case _0xa41a('0x2d'):return db[_[_0xa41a('0xa0')](_0x22b40e['query'][_0xa41a('0xad')])+_0xa41a('0xd8')][_0xa41a('0x4e')](_0x413bd8);case _0xa41a('0x2f'):case _0xa41a('0x29'):return _0x2395f7[_0xa41a('0x2c')+_[_0xa41a('0xa0')](_0x22b40e['query'][_0xa41a('0xad')])+_0xa41a('0xa2')](_0x413bd8);default:throw new db[(_0xa41a('0x95'))][(_0xa41a('0x90'))](_0xa41a('0xd9'));}})[_0xa41a('0x27')](function(_0x4babab){_0x21dcd7=_0x4babab['length'];if(!_0x22b40e[_0xa41a('0x48')]['hasOwnProperty'](_0xa41a('0xda'))){_0x413bd8[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x22b40e[_0xa41a('0x48')][_0xa41a('0x1c')]);_0x413bd8['offset']=qs[_0xa41a('0x1b')](_0x22b40e[_0xa41a('0x48')][_0xa41a('0x1b')]);}switch(_0x2395f7[_0xa41a('0x28')]){case _0xa41a('0x2d'):return db[_['capitalize'](_0x22b40e[_0xa41a('0x48')][_0xa41a('0xad')])+_0xa41a('0xd8')][_0xa41a('0x4e')](_0x413bd8);case _0xa41a('0x2f'):case _0xa41a('0x29'):return _0x2395f7[_0xa41a('0x2c')+_['capitalize'](_0x22b40e['query'][_0xa41a('0xad')])+'Queues'](_0x413bd8);}})[_0xa41a('0x27')](function(_0x4406e2){return{'count':_0x21dcd7,'rows':_0x4406e2};})[_0xa41a('0x27')](respondWithResult(_0x513229,null))[_0xa41a('0x5d')](handleError(_0x513229,null));};exports[_0xa41a('0xdb')]=function(_0x46a7b4,_0x3aac90){var _0x3f5410={};var _0xdb3713={};var _0x40d83a;var _0xfde287;return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x46a7b4[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x3aac90,null))['then'](function(_0x10216a){if(_0x10216a){_0x40d83a=_0x10216a;_0xdb3713['model']=_['keys'](db[_0xa41a('0xaa')][_0xa41a('0xd3')]);_0xdb3713[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x46a7b4['query']);_0xdb3713[_0xa41a('0xd4')]=_['intersection'](_0xdb3713[_0xa41a('0xd1')],_0xdb3713['query']);_0x3f5410[_0xa41a('0x4c')]=_[_0xa41a('0xd5')](_0xdb3713[_0xa41a('0xd1')],qs[_0xa41a('0xdc')](_0x46a7b4[_0xa41a('0x48')][_0xa41a('0xdc')]));_0x3f5410[_0xa41a('0x4c')]=_0x3f5410[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x3f5410[_0xa41a('0x4c')]:_0xdb3713[_0xa41a('0xd1')];_0x3f5410[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x46a7b4['query']['sort']);_0x3f5410[_0xa41a('0x47')]=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x46a7b4[_0xa41a('0x48')],_0xdb3713[_0xa41a('0xd4')]));if(_0x46a7b4[_0xa41a('0x48')]['filter']){_0x3f5410[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x3f5410[_0xa41a('0x47')],{'$or':_['map'](_0x3f5410['attributes'],function(_0x4a87d){var _0x53b8ef={};_0x53b8ef[_0x4a87d]={'$like':'%'+_0x46a7b4[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x53b8ef;})});}_0x3f5410=_[_0xa41a('0x5a')]({},_0x3f5410,_0x46a7b4[_0xa41a('0xd7')]);return _0x40d83a[_0xa41a('0xdb')](_0x3f5410);}})[_0xa41a('0x27')](function(_0xf4fd28){if(_0xf4fd28){_0xfde287=_0xf4fd28[_0xa41a('0x52')];if(!_0x46a7b4['query'][_0xa41a('0xdf')](_0xa41a('0xda'))){_0x3f5410[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x46a7b4[_0xa41a('0x48')][_0xa41a('0x1c')]);_0x3f5410[_0xa41a('0x1b')]=qs[_0xa41a('0x1b')](_0x46a7b4['query'][_0xa41a('0x1b')]);}return _0x40d83a[_0xa41a('0xdb')](_0x3f5410);}})[_0xa41a('0x27')](function(_0x5bb044){if(_0x5bb044){return _0x5bb044?{'count':_0xfde287,'rows':_0x5bb044}:null;}})[_0xa41a('0x27')](respondWithResult(_0x3aac90,null))[_0xa41a('0x5d')](handleError(_0x3aac90,null));};exports[_0xa41a('0xe0')]=function(_0x3583e6,_0x2eb9c4){var _0x5c0c48={};var _0x51d16f={};var _0x22fa98;var _0x217a3a;return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x3583e6[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x2eb9c4,null))[_0xa41a('0x27')](function(_0x5725d7){if(_0x5725d7){_0x22fa98=_0x5725d7;_0x51d16f[_0xa41a('0xd1')]=_['keys'](db[_0xa41a('0xe1')][_0xa41a('0xd3')]);_0x51d16f['query']=_['keys'](_0x3583e6[_0xa41a('0x48')]);_0x51d16f[_0xa41a('0xd4')]=_['intersection'](_0x51d16f['model'],_0x51d16f[_0xa41a('0x48')]);_0x5c0c48[_0xa41a('0x4c')]=_[_0xa41a('0xd5')](_0x51d16f['model'],qs[_0xa41a('0xdc')](_0x3583e6[_0xa41a('0x48')]['fields']));_0x5c0c48[_0xa41a('0x4c')]=_0x5c0c48[_0xa41a('0x4c')]['length']?_0x5c0c48[_0xa41a('0x4c')]:_0x51d16f[_0xa41a('0xd1')];_0x5c0c48[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x3583e6[_0xa41a('0x48')][_0xa41a('0xd6')]);_0x5c0c48[_0xa41a('0x47')]=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x3583e6[_0xa41a('0x48')],_0x51d16f['filters']));if(_0x3583e6[_0xa41a('0x48')]['filter']){_0x5c0c48[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x5c0c48[_0xa41a('0x47')],{'$or':_[_0xa41a('0x34')](_0x5c0c48[_0xa41a('0x4c')],function(_0x52ea42){var _0x451571={};_0x451571[_0x52ea42]={'$like':'%'+_0x3583e6[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x451571;})});}_0x5c0c48=_[_0xa41a('0x5a')]({},_0x5c0c48,_0x3583e6[_0xa41a('0xd7')]);return _0x22fa98['getGroups'](_0x5c0c48);}})[_0xa41a('0x27')](function(_0x59d129){if(_0x59d129){_0x217a3a=_0x59d129[_0xa41a('0x52')];if(!_0x3583e6['query'][_0xa41a('0xdf')]('nolimit')){_0x5c0c48['limit']=qs[_0xa41a('0x1c')](_0x3583e6[_0xa41a('0x48')]['limit']);_0x5c0c48[_0xa41a('0x1b')]=qs['offset'](_0x3583e6[_0xa41a('0x48')]['offset']);}return _0x22fa98['getGroups'](_0x5c0c48);}})['then'](function(_0x446c74){if(_0x446c74){return _0x446c74?{'count':_0x217a3a,'rows':_0x446c74}:null;}})[_0xa41a('0x27')](respondWithResult(_0x2eb9c4,null))[_0xa41a('0x5d')](handleError(_0x2eb9c4,null));};exports['getRecordings']=function(_0x4b8cca,_0x31175d){var _0x4c293b={'raw':!![],'where':{}};var _0x1bf937={};var _0x3a93e5={'count':0x0,'rows':[]};return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x4b8cca[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x31175d,null))[_0xa41a('0x27')](function(_0xeb6e7e){if(_0xeb6e7e){_0x1bf937['model']=_[_0xa41a('0xd2')](db[_0xa41a('0xe2')]['rawAttributes']);_0x1bf937[_0xa41a('0x48')]=_['keys'](_0x4b8cca[_0xa41a('0x48')]);_0x1bf937[_0xa41a('0xd4')]=_[_0xa41a('0xd5')](_0x1bf937['model'],_0x1bf937[_0xa41a('0x48')]);_0x4c293b['attributes']=_[_0xa41a('0xd5')](_0x1bf937['model'],qs[_0xa41a('0xdc')](_0x4b8cca[_0xa41a('0x48')][_0xa41a('0xdc')]));_0x4c293b[_0xa41a('0x4c')]=_0x4c293b[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x4c293b[_0xa41a('0x4c')]:_0x1bf937[_0xa41a('0xd1')];if(!_0x4b8cca[_0xa41a('0x48')][_0xa41a('0xdf')](_0xa41a('0xda'))){_0x4c293b[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x4b8cca[_0xa41a('0x48')][_0xa41a('0x1c')]);_0x4c293b[_0xa41a('0x1b')]=qs[_0xa41a('0x1b')](_0x4b8cca[_0xa41a('0x48')][_0xa41a('0x1b')]);}_0x4c293b['order']=qs[_0xa41a('0xd6')](_0x4b8cca['query'][_0xa41a('0xd6')]);_0x4c293b['where']=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x4b8cca[_0xa41a('0x48')],_0x1bf937[_0xa41a('0xd4')]));_0x4c293b[_0xa41a('0x47')][_0xa41a('0xe3')]=_0xeb6e7e['id'];if(_0x4b8cca[_0xa41a('0x48')]['filter']){_0x4c293b['where']=_[_0xa41a('0x5a')](_0x4c293b[_0xa41a('0x47')],{'$or':_[_0xa41a('0x34')](_0x4c293b['attributes'],function(_0x337151){var _0x43e8e6={};_0x43e8e6[_0x337151]={'$like':'%'+_0x4b8cca[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x43e8e6;})});}_0x4c293b=_[_0xa41a('0x5a')]({},_0x4c293b,_0x4b8cca[_0xa41a('0xd7')]);return db[_0xa41a('0xe2')][_0xa41a('0x1a')]({'where':_0x4c293b[_0xa41a('0x47')]})['then'](function(_0x16ba5b){_0x3a93e5[_0xa41a('0x1a')]=_0x16ba5b;if(_0x4b8cca[_0xa41a('0x48')][_0xa41a('0xc9')]){_0x4c293b['include']=[{'all':!![]}];}return db[_0xa41a('0xe2')][_0xa41a('0x4e')](_0x4c293b);})[_0xa41a('0x27')](function(_0x5c0389){_0x3a93e5[_0xa41a('0x4f')]=_0x5c0389;return _0x3a93e5;});}})[_0xa41a('0x27')](respondWithFilteredResult(_0x31175d,_0x4c293b))['catch'](handleError(_0x31175d,null));};exports['getScreenRecordings']=function(_0x3cb8f1,_0x5b41b1){var _0x2497a6={'raw':!![],'where':{}};var _0x81da6e={};var _0x574644={'count':0x0,'rows':[]};return db['User'][_0xa41a('0x98')]({'where':{'id':_0x3cb8f1[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x5b41b1,null))[_0xa41a('0x27')](function(_0x5dd47e){if(_0x5dd47e){_0x81da6e[_0xa41a('0xd1')]=_[_0xa41a('0xd2')](db[_0xa41a('0xe4')][_0xa41a('0xd3')]);_0x81da6e[_0xa41a('0x48')]=_['keys'](_0x3cb8f1[_0xa41a('0x48')]);_0x81da6e[_0xa41a('0xd4')]=_[_0xa41a('0xd5')](_0x81da6e[_0xa41a('0xd1')],_0x81da6e[_0xa41a('0x48')]);_0x2497a6['attributes']=_[_0xa41a('0xd5')](_0x81da6e[_0xa41a('0xd1')],qs[_0xa41a('0xdc')](_0x3cb8f1['query'][_0xa41a('0xdc')]));_0x2497a6[_0xa41a('0x4c')]=_0x2497a6[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x2497a6[_0xa41a('0x4c')]:_0x81da6e[_0xa41a('0xd1')];if(!_0x3cb8f1[_0xa41a('0x48')][_0xa41a('0xdf')](_0xa41a('0xda'))){_0x2497a6[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x3cb8f1[_0xa41a('0x48')]['limit']);_0x2497a6[_0xa41a('0x1b')]=qs[_0xa41a('0x1b')](_0x3cb8f1[_0xa41a('0x48')][_0xa41a('0x1b')]);}_0x2497a6[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x3cb8f1[_0xa41a('0x48')]['sort']);_0x2497a6['where']=qs[_0xa41a('0xd4')](_['pick'](_0x3cb8f1[_0xa41a('0x48')],_0x81da6e[_0xa41a('0xd4')]));_0x2497a6[_0xa41a('0x47')][_0xa41a('0xe3')]=_0x5dd47e['id'];if(_0x3cb8f1[_0xa41a('0x48')][_0xa41a('0x32')]){_0x2497a6[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x2497a6['where'],{'$or':_[_0xa41a('0x34')](_0x2497a6[_0xa41a('0x4c')],function(_0x4c2cd1){var _0x13a3c7={};_0x13a3c7[_0x4c2cd1]={'$like':'%'+_0x3cb8f1[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x13a3c7;})});}_0x2497a6=_['merge']({},_0x2497a6,_0x3cb8f1[_0xa41a('0xd7')]);return db[_0xa41a('0xe4')][_0xa41a('0x1a')]({'where':_0x2497a6[_0xa41a('0x47')]})[_0xa41a('0x27')](function(_0x424b78){_0x574644[_0xa41a('0x1a')]=_0x424b78;if(_0x3cb8f1['query'][_0xa41a('0xc9')]){_0x2497a6[_0xa41a('0x49')]=[{'all':!![]}];}return db[_0xa41a('0xe4')][_0xa41a('0x4e')](_0x2497a6);})[_0xa41a('0x27')](function(_0x31e8b2){_0x574644[_0xa41a('0x4f')]=_0x31e8b2;return _0x574644;});}})['then'](respondWithFilteredResult(_0x5b41b1,_0x2497a6))[_0xa41a('0x5d')](handleError(_0x5b41b1,null));};exports[_0xa41a('0xe5')]=function(_0x58ceec,_0x302b6e){var _0x37de64={};var _0x88b303={};var _0x2c1a62;var _0x131c74;return db[_0xa41a('0x3d')]['findOne']({'where':{'id':_0x58ceec[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x302b6e,null))[_0xa41a('0x27')](function(_0x127e63){if(_0x127e63){_0x2c1a62=_0x127e63;_0x88b303[_0xa41a('0xd1')]=_[_0xa41a('0xd2')](db[_0xa41a('0xe6')]['rawAttributes']);_0x88b303[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x58ceec[_0xa41a('0x48')]);_0x88b303['filters']=_['intersection'](_0x88b303[_0xa41a('0xd1')],_0x88b303[_0xa41a('0x48')]);_0x37de64[_0xa41a('0x4c')]=_[_0xa41a('0xd5')](_0x88b303['model'],qs[_0xa41a('0xdc')](_0x58ceec[_0xa41a('0x48')][_0xa41a('0xdc')]));_0x37de64[_0xa41a('0x4c')]=_0x37de64[_0xa41a('0x4c')]['length']?_0x37de64[_0xa41a('0x4c')]:_0x88b303[_0xa41a('0xd1')];_0x37de64[_0xa41a('0xdd')]=qs['sort'](_0x58ceec[_0xa41a('0x48')][_0xa41a('0xd6')]);_0x37de64['where']=qs['filters'](_['pick'](_0x58ceec[_0xa41a('0x48')],_0x88b303[_0xa41a('0xd4')]));if(_0x58ceec[_0xa41a('0x48')][_0xa41a('0x32')]){_0x37de64[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x37de64[_0xa41a('0x47')],{'$or':_['map'](_0x37de64[_0xa41a('0x4c')],function(_0x306c7f){var _0x1a97fa={};_0x1a97fa[_0x306c7f]={'$like':'%'+_0x58ceec['query'][_0xa41a('0x32')]+'%'};return _0x1a97fa;})});}_0x37de64=_[_0xa41a('0x5a')]({},_0x37de64,_0x58ceec[_0xa41a('0xd7')]);return _0x2c1a62[_0xa41a('0xe5')](_0x37de64);}})['then'](function(_0x19b57c){if(_0x19b57c){_0x131c74=_0x19b57c[_0xa41a('0x52')];if(!_0x58ceec[_0xa41a('0x48')][_0xa41a('0xdf')](_0xa41a('0xda'))){_0x37de64[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x58ceec['query']['limit']);_0x37de64[_0xa41a('0x1b')]=qs[_0xa41a('0x1b')](_0x58ceec['query'][_0xa41a('0x1b')]);}return _0x2c1a62[_0xa41a('0xe5')](_0x37de64);}})[_0xa41a('0x27')](function(_0xe7cfee){if(_0xe7cfee){return _0xe7cfee?{'count':_0x131c74,'rows':_0xe7cfee}:null;}})['then'](respondWithResult(_0x302b6e,null))[_0xa41a('0x5d')](handleError(_0x302b6e,null));};exports[_0xa41a('0xe7')]=function(_0x4ae4c9,_0x6953c4){var _0x35a33c={};var _0x577fc2={};var _0x10db82;var _0x3a93fa;return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x4ae4c9['params']['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x6953c4,null))[_0xa41a('0x27')](function(_0x4cabb0){if(_0x4cabb0){_0x10db82=_0x4cabb0;_0x577fc2[_0xa41a('0xd1')]=_[_0xa41a('0xd2')](db['OpenchannelInteraction']['rawAttributes']);_0x577fc2[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x4ae4c9[_0xa41a('0x48')]);_0x577fc2['filters']=_['intersection'](_0x577fc2[_0xa41a('0xd1')],_0x577fc2[_0xa41a('0x48')]);_0x35a33c[_0xa41a('0x4c')]=_['intersection'](_0x577fc2['model'],qs[_0xa41a('0xdc')](_0x4ae4c9[_0xa41a('0x48')][_0xa41a('0xdc')]));_0x35a33c[_0xa41a('0x4c')]=_0x35a33c[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x35a33c[_0xa41a('0x4c')]:_0x577fc2['model'];_0x35a33c[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x4ae4c9['query'][_0xa41a('0xd6')]);_0x35a33c[_0xa41a('0x47')]=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x4ae4c9['query'],_0x577fc2['filters']));if(_0x4ae4c9[_0xa41a('0x48')]['filter']){_0x35a33c[_0xa41a('0x47')]=_['merge'](_0x35a33c[_0xa41a('0x47')],{'$or':_[_0xa41a('0x34')](_0x35a33c['attributes'],function(_0x1cdd99){var _0x5f02d0={};_0x5f02d0[_0x1cdd99]={'$like':'%'+_0x4ae4c9[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x5f02d0;})});}_0x35a33c=_['merge']({},_0x35a33c,_0x4ae4c9[_0xa41a('0xd7')]);return _0x10db82[_0xa41a('0xe7')](_0x35a33c);}})[_0xa41a('0x27')](function(_0x25f3cd){if(_0x25f3cd){_0x3a93fa=_0x25f3cd[_0xa41a('0x52')];if(!_0x4ae4c9[_0xa41a('0x48')][_0xa41a('0xdf')](_0xa41a('0xda'))){_0x35a33c['limit']=qs[_0xa41a('0x1c')](_0x4ae4c9[_0xa41a('0x48')]['limit']);_0x35a33c[_0xa41a('0x1b')]=qs['offset'](_0x4ae4c9['query'][_0xa41a('0x1b')]);}return _0x10db82[_0xa41a('0xe7')](_0x35a33c);}})[_0xa41a('0x27')](function(_0x283a28){if(_0x283a28){return _0x283a28?{'count':_0x3a93fa,'rows':_0x283a28}:null;}})['then'](respondWithResult(_0x6953c4,null))['catch'](handleError(_0x6953c4,null));};exports[_0xa41a('0xe8')]=function(_0x110d56,_0x7cb628){var _0x295c54={'raw':!![],'where':{}};var _0x509809={};var _0x1adfca={'count':0x0,'rows':[]};return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x110d56[_0xa41a('0x59')]['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x7cb628,null))[_0xa41a('0x27')](function(_0x33e2d0){if(_0x33e2d0){_0x509809[_0xa41a('0xd1')]=_['keys'](db[_0xa41a('0xe9')]['rawAttributes']);_0x509809[_0xa41a('0x48')]=_['keys'](_0x110d56[_0xa41a('0x48')]);_0x509809['filters']=_['intersection'](_0x509809[_0xa41a('0xd1')],_0x509809[_0xa41a('0x48')]);_0x295c54[_0xa41a('0x4c')]=_[_0xa41a('0xd5')](_0x509809[_0xa41a('0xd1')],qs[_0xa41a('0xdc')](_0x110d56['query'][_0xa41a('0xdc')]));_0x295c54[_0xa41a('0x4c')]=_0x295c54['attributes'][_0xa41a('0x52')]?_0x295c54[_0xa41a('0x4c')]:_0x509809[_0xa41a('0xd1')];if(!_0x110d56['query'][_0xa41a('0xdf')](_0xa41a('0xda'))){_0x295c54[_0xa41a('0x1c')]=qs['limit'](_0x110d56['query'][_0xa41a('0x1c')]);_0x295c54[_0xa41a('0x1b')]=qs[_0xa41a('0x1b')](_0x110d56[_0xa41a('0x48')][_0xa41a('0x1b')]);}_0x295c54[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x110d56[_0xa41a('0x48')][_0xa41a('0xd6')]);_0x295c54[_0xa41a('0x47')]=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x110d56[_0xa41a('0x48')],_0x509809[_0xa41a('0xd4')]));_0x295c54[_0xa41a('0x47')]['UserId']=_0x33e2d0['id'];if(_0x110d56[_0xa41a('0x48')][_0xa41a('0x32')]){_0x295c54[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x295c54[_0xa41a('0x47')],{'$or':_[_0xa41a('0x34')](_0x295c54[_0xa41a('0x4c')],function(_0x1d6d39){var _0x44d02d={};_0x44d02d[_0x1d6d39]={'$like':'%'+_0x110d56[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x44d02d;})});}_0x295c54=_[_0xa41a('0x5a')]({},_0x295c54,_0x110d56[_0xa41a('0xd7')]);return db[_0xa41a('0xe9')][_0xa41a('0x1a')]({'where':_0x295c54[_0xa41a('0x47')]})['then'](function(_0x67245){_0x1adfca[_0xa41a('0x1a')]=_0x67245;if(_0x110d56[_0xa41a('0x48')][_0xa41a('0xc9')]){_0x295c54[_0xa41a('0x49')]=[{'all':!![]}];}return db[_0xa41a('0xe9')]['findAll'](_0x295c54);})[_0xa41a('0x27')](function(_0x352b28){_0x1adfca[_0xa41a('0x4f')]=_0x352b28;return _0x1adfca;});}})['then'](respondWithFilteredResult(_0x7cb628,_0x295c54))[_0xa41a('0x5d')](handleError(_0x7cb628,null));};exports[_0xa41a('0xea')]=function(_0x539c4e,_0x27dee8){var _0x3649ce={};var _0x3f91c7={};var _0x2718dc;var _0x295b3b;return db[_0xa41a('0x3d')]['findOne']({'where':{'id':_0x539c4e[_0xa41a('0x59')]['id']}})['then'](handleEntityNotFound(_0x27dee8,null))['then'](function(_0x1348ca){if(_0x1348ca){_0x2718dc=_0x1348ca;_0x3f91c7['model']=_['keys'](db[_0xa41a('0xeb')][_0xa41a('0xd3')]);_0x3f91c7[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x539c4e[_0xa41a('0x48')]);_0x3f91c7[_0xa41a('0xd4')]=_[_0xa41a('0xd5')](_0x3f91c7['model'],_0x3f91c7[_0xa41a('0x48')]);_0x3649ce['attributes']=_[_0xa41a('0xd5')](_0x3f91c7['model'],qs[_0xa41a('0xdc')](_0x539c4e[_0xa41a('0x48')]['fields']));_0x3649ce[_0xa41a('0x4c')]=_0x3649ce[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x3649ce['attributes']:_0x3f91c7['model'];_0x3649ce[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x539c4e[_0xa41a('0x48')][_0xa41a('0xd6')]);_0x3649ce[_0xa41a('0x47')]=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x539c4e[_0xa41a('0x48')],_0x3f91c7[_0xa41a('0xd4')]));if(_0x539c4e[_0xa41a('0x48')][_0xa41a('0x32')]){_0x3649ce[_0xa41a('0x47')]=_['merge'](_0x3649ce['where'],{'$or':_[_0xa41a('0x34')](_0x3649ce[_0xa41a('0x4c')],function(_0x4538a3){var _0x3431a2={};_0x3431a2[_0x4538a3]={'$like':'%'+_0x539c4e[_0xa41a('0x48')]['filter']+'%'};return _0x3431a2;})});}_0x3649ce=_[_0xa41a('0x5a')]({},_0x3649ce,_0x539c4e[_0xa41a('0xd7')]);return _0x2718dc[_0xa41a('0xea')](_0x3649ce);}})[_0xa41a('0x27')](function(_0x412d83){if(_0x412d83){_0x295b3b=_0x412d83[_0xa41a('0x52')];if(!_0x539c4e[_0xa41a('0x48')][_0xa41a('0xdf')]('nolimit')){_0x3649ce[_0xa41a('0x1c')]=qs['limit'](_0x539c4e[_0xa41a('0x48')]['limit']);_0x3649ce['offset']=qs[_0xa41a('0x1b')](_0x539c4e[_0xa41a('0x48')][_0xa41a('0x1b')]);}return _0x2718dc['getSmsInteractions'](_0x3649ce);}})[_0xa41a('0x27')](function(_0x214e80){if(_0x214e80){return _0x214e80?{'count':_0x295b3b,'rows':_0x214e80}:null;}})[_0xa41a('0x27')](respondWithResult(_0x27dee8,null))['catch'](handleError(_0x27dee8,null));};exports[_0xa41a('0xec')]=function(_0x5ac35f,_0x372eaa){var _0xb35e04={};var _0x36ccc0={};var _0x5f34bc;var _0x4599b8;return db[_0xa41a('0x3d')]['findOne']({'where':{'id':_0x5ac35f[_0xa41a('0x59')]['id']}})['then'](handleEntityNotFound(_0x372eaa,null))['then'](function(_0x42a210){if(_0x42a210){_0x5f34bc=_0x42a210;_0x36ccc0[_0xa41a('0xd1')]=_[_0xa41a('0xd2')](db['FaxInteraction']['rawAttributes']);_0x36ccc0[_0xa41a('0x48')]=_['keys'](_0x5ac35f[_0xa41a('0x48')]);_0x36ccc0['filters']=_[_0xa41a('0xd5')](_0x36ccc0[_0xa41a('0xd1')],_0x36ccc0[_0xa41a('0x48')]);_0xb35e04[_0xa41a('0x4c')]=_['intersection'](_0x36ccc0[_0xa41a('0xd1')],qs['fields'](_0x5ac35f['query']['fields']));_0xb35e04[_0xa41a('0x4c')]=_0xb35e04[_0xa41a('0x4c')]['length']?_0xb35e04[_0xa41a('0x4c')]:_0x36ccc0[_0xa41a('0xd1')];_0xb35e04[_0xa41a('0xdd')]=qs['sort'](_0x5ac35f[_0xa41a('0x48')][_0xa41a('0xd6')]);_0xb35e04[_0xa41a('0x47')]=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x5ac35f[_0xa41a('0x48')],_0x36ccc0[_0xa41a('0xd4')]));if(_0x5ac35f[_0xa41a('0x48')][_0xa41a('0x32')]){_0xb35e04[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0xb35e04[_0xa41a('0x47')],{'$or':_[_0xa41a('0x34')](_0xb35e04[_0xa41a('0x4c')],function(_0x2c3052){var _0x544abc={};_0x544abc[_0x2c3052]={'$like':'%'+_0x5ac35f[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x544abc;})});}_0xb35e04=_[_0xa41a('0x5a')]({},_0xb35e04,_0x5ac35f[_0xa41a('0xd7')]);return _0x5f34bc[_0xa41a('0xec')](_0xb35e04);}})[_0xa41a('0x27')](function(_0x4873bc){if(_0x4873bc){_0x4599b8=_0x4873bc[_0xa41a('0x52')];if(!_0x5ac35f[_0xa41a('0x48')]['hasOwnProperty'](_0xa41a('0xda'))){_0xb35e04[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x5ac35f[_0xa41a('0x48')][_0xa41a('0x1c')]);_0xb35e04['offset']=qs[_0xa41a('0x1b')](_0x5ac35f['query'][_0xa41a('0x1b')]);}return _0x5f34bc[_0xa41a('0xec')](_0xb35e04);}})[_0xa41a('0x27')](function(_0x91532a){if(_0x91532a){return _0x91532a?{'count':_0x4599b8,'rows':_0x91532a}:null;}})[_0xa41a('0x27')](respondWithResult(_0x372eaa,null))[_0xa41a('0x5d')](handleError(_0x372eaa,null));};exports['getWhatsappInteractions']=function(_0x423ae7,_0x4d7407){var _0x82ab53={};var _0x5e5cdc={};var _0x5d8ea3;var _0x14c461;return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x423ae7['params']['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0x4d7407,null))['then'](function(_0x36bce8){if(_0x36bce8){_0x5d8ea3=_0x36bce8;_0x5e5cdc['model']=_['keys'](db[_0xa41a('0xed')]['rawAttributes']);_0x5e5cdc[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x423ae7['query']);_0x5e5cdc[_0xa41a('0xd4')]=_[_0xa41a('0xd5')](_0x5e5cdc[_0xa41a('0xd1')],_0x5e5cdc[_0xa41a('0x48')]);_0x82ab53['attributes']=_[_0xa41a('0xd5')](_0x5e5cdc['model'],qs[_0xa41a('0xdc')](_0x423ae7[_0xa41a('0x48')]['fields']));_0x82ab53[_0xa41a('0x4c')]=_0x82ab53[_0xa41a('0x4c')]['length']?_0x82ab53[_0xa41a('0x4c')]:_0x5e5cdc[_0xa41a('0xd1')];_0x82ab53[_0xa41a('0xdd')]=qs['sort'](_0x423ae7['query'][_0xa41a('0xd6')]);_0x82ab53['where']=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x423ae7[_0xa41a('0x48')],_0x5e5cdc[_0xa41a('0xd4')]));if(_0x423ae7[_0xa41a('0x48')][_0xa41a('0x32')]){_0x82ab53[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x82ab53['where'],{'$or':_[_0xa41a('0x34')](_0x82ab53[_0xa41a('0x4c')],function(_0x12738e){var _0x200ec1={};_0x200ec1[_0x12738e]={'$like':'%'+_0x423ae7['query'][_0xa41a('0x32')]+'%'};return _0x200ec1;})});}_0x82ab53=_['merge']({},_0x82ab53,_0x423ae7[_0xa41a('0xd7')]);return _0x5d8ea3['getWhatsappInteractions'](_0x82ab53);}})[_0xa41a('0x27')](function(_0x469255){if(_0x469255){_0x14c461=_0x469255[_0xa41a('0x52')];if(!_0x423ae7['query'][_0xa41a('0xdf')](_0xa41a('0xda'))){_0x82ab53[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x423ae7[_0xa41a('0x48')][_0xa41a('0x1c')]);_0x82ab53[_0xa41a('0x1b')]=qs[_0xa41a('0x1b')](_0x423ae7['query'][_0xa41a('0x1b')]);}return _0x5d8ea3['getWhatsappInteractions'](_0x82ab53);}})[_0xa41a('0x27')](function(_0x47866d){if(_0x47866d){return _0x47866d?{'count':_0x14c461,'rows':_0x47866d}:null;}})[_0xa41a('0x27')](respondWithResult(_0x4d7407,null))['catch'](handleError(_0x4d7407,null));};exports[_0xa41a('0xee')]=function(_0x51685e,_0x264c33,_0x2a3fe6){var _0x2d3c89;var _0x35a3a4;var _0x534edc;var _0x39d77d=!_[_0xa41a('0x66')](_0x51685e[_0xa41a('0x59')]['id'])?_0x51685e['params']['id']:!_['isNil'](_0x51685e[_0xa41a('0x2f')]['id'])?_0x51685e['user']['id']:null;return db[_0xa41a('0x3d')][_0xa41a('0x37')]({'where':{'id':_0x39d77d,'role':{'$or':[_0xa41a('0x2d'),'user','agent']}},'attributes':['id',_0xa41a('0x38'),_0xa41a('0xef'),_0xa41a('0xf0'),_0xa41a('0x28'),_0xa41a('0x63'),_0xa41a('0xf1')]})[_0xa41a('0x27')](function(_0x504d8f){if(_0x504d8f){if(_0x504d8f['role']===_0xa41a('0x29')){_0x2d3c89=_0x504d8f;if(_0x51685e['body']['interface']){_0x534edc=util[_0xa41a('0xa8')]('LOCAL/%s@from-sip/n',_0x2d3c89[_0x51685e[_0xa41a('0x5e')][_0xa41a('0x9e')]]);}else if(_0x51685e[_0xa41a('0x5e')][_0xa41a('0xf2')]){_0x534edc=util[_0xa41a('0xa8')](_0xa41a('0xa9'),_0x51685e[_0xa41a('0x5e')][_0xa41a('0xf2')]);}else{_0x534edc=util[_0xa41a('0xa8')]('SIP/%s',_0x2d3c89['name']);}socket['to'](util[_0xa41a('0xa8')](_0xa41a('0xf3'),_0x2d3c89[_0xa41a('0x38')]))['emit']('user:forcelogout',{'user':{'id':_0x2d3c89['id'],'name':_0x2d3c89[_0xa41a('0x38')]},'ip':_0x51685e[_0xa41a('0xf4')][_0xa41a('0xf5')]||_0x51685e[_0xa41a('0xf6')]['remoteAddress']||_0x51685e[_0xa41a('0xf7')][_0xa41a('0xf8')]||_0x51685e['connection']['socket'][_0xa41a('0xf8')]});return db[_0xa41a('0xaa')][_0xa41a('0x2b')]({'where':{'membername':_0x2d3c89[_0xa41a('0x38')]},'individualHooks':!![]});}}else{throw new db[(_0xa41a('0x95'))][(_0xa41a('0x90'))](_0xa41a('0xf9'));}})[_0xa41a('0x27')](function(){if(_0x2d3c89){return _0x2d3c89['getVoiceQueues']({'raw':!![]});}})[_0xa41a('0x27')](function(_0x4d4ca7){if(_0x2d3c89){if(_0x4d4ca7){_0x35a3a4=_0x4d4ca7;if(_0x35a3a4[_0xa41a('0x52')]){var _0x9eab16=_0x35a3a4[_0xa41a('0x34')](function(_0x4dd407){var _0x3e24b9={'membername':_0x2d3c89[_0xa41a('0x38')],'UserId':_0x2d3c89['id'],'queue_name':_0x4dd407['name'],'VoiceQueueId':_0x4dd407['id'],'interface':_0x534edc,'paused':_0x2d3c89[_0xa41a('0xf1')]||![],'penalty':_0x4dd407['UserVoiceQueue.penalty']||0x0};return db[_0xa41a('0xaa')][_0xa41a('0xab')](_0x3e24b9);});return Promise['all'](_0x9eab16);}}}})['then'](function(){if(_0x2d3c89){return db[_0xa41a('0xfa')][_0xa41a('0x4e')]({'where':{'membername':_0x2d3c89[_0xa41a('0x38')],'exitAt':null}});}})[_0xa41a('0x27')](function(_0x7157){if(_0x2d3c89){var _0x1c7535=[];_0x7157[_0xa41a('0xfb')](function(_0x2143b9){_0x1c7535[_0xa41a('0x4d')](_0x2143b9['update']({'exitAt':moment()[_0xa41a('0xa8')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise['all'](_0x1c7535);}})[_0xa41a('0x27')](function(){if(_0x2d3c89){var _0x59aa97=[];var _0x736d24=[];var _0x4d07fa=utils[_0xa41a('0xfc')]();var _0x4790ba={'membername':_0x2d3c89[_0xa41a('0x38')],'interface':_0x534edc,'enterAt':moment()['format'](_0xa41a('0xfd')),'role':_0x2d3c89[_0xa41a('0x28')],'internal':_0x2d3c89[_0xa41a('0x63')]};_0x4d07fa[_0xa41a('0xfb')](function(_0x400ec1){_0x59aa97[_0xa41a('0x4d')](_['merge']({'channel':_0x400ec1,'type':_0xa41a('0xfe'),'data1':_0x51685e[_0xa41a('0x5e')][_0xa41a('0xff')],'data2':_0x534edc},_0x4790ba));if(_0x2d3c89[_0xa41a('0xf1')]){_0x736d24[_0xa41a('0x4d')](_[_0xa41a('0x5a')]({'channel':_0x400ec1,'type':_0xa41a('0x100'),'data1':_0xa41a('0x101')},_0x4790ba));}});return db[_0xa41a('0xfa')][_0xa41a('0x89')](_0x59aa97[_0xa41a('0x102')](_0x736d24),{'individualHooks':!![]});}})['then'](function(){if(_0x2d3c89){return _0x2d3c89[_0xa41a('0x26')]({'online':!![],'lastLoginAt':moment()['format'](_0xa41a('0xfd')),'voicePause':_0x2d3c89[_0xa41a('0xf1')]||![],'mailPause':_0x2d3c89['loginInPause']||![],'chatPause':_0x2d3c89[_0xa41a('0xf1')]||![],'faxPause':_0x2d3c89[_0xa41a('0xf1')]||![],'smsPause':_0x2d3c89[_0xa41a('0xf1')]||![],'openchannelPause':_0x2d3c89[_0xa41a('0xf1')]||![],'whatsappPause':_0x2d3c89[_0xa41a('0xf1')]||![],'pauseType':_0x2d3c89[_0xa41a('0xf1')]?'LOGININPAUSE':null,'interface':_0x534edc,'lastPauseAt':moment()[_0xa41a('0xa8')](_0xa41a('0xfd'))});}})[_0xa41a('0x27')](function(_0x97a0cc){if(_0x51685e['isMiddleware']){return _0x2a3fe6();}else{return Promise[_0xa41a('0x103')](_0x97a0cc)['then'](respondWithResult(_0x264c33,null));}})[_0xa41a('0x5d')](handleError(_0x264c33,null));};exports[_0xa41a('0x104')]=function(_0x27acb6,_0x33c297){var _0x538509;return db[_0xa41a('0x3d')][_0xa41a('0x37')]({'where':{'id':_0x27acb6[_0xa41a('0x59')]['id'],'role':'agent'},'attributes':['id',_0xa41a('0x38'),_0xa41a('0x28')]})[_0xa41a('0x27')](handleEntityNotFound(_0x33c297,null))[_0xa41a('0x27')](function(_0x2e0082){if(_0x2e0082){_0x538509=_0x2e0082;return db['UserVoiceQueueRt'][_0xa41a('0x2b')]({'where':{'membername':_0x538509[_0xa41a('0x38')]},'individualHooks':!![]});}})[_0xa41a('0x27')](function(){return db[_0xa41a('0xfa')][_0xa41a('0x4e')]({'where':{'membername':_0x538509[_0xa41a('0x38')],'exitAt':null}});})[_0xa41a('0x27')](function(_0x143bdf){var _0x1079e3=[];_0x143bdf[_0xa41a('0xfb')](function(_0x1e3c17){_0x1079e3[_0xa41a('0x4d')](_0x1e3c17[_0xa41a('0x26')]({'exitAt':moment()['format'](_0xa41a('0xfd'))}));});return Promise[_0xa41a('0x58')](_0x1079e3);})[_0xa41a('0x27')](function(){return _0x538509[_0xa41a('0x26')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0xa41a('0x27')](respondWithResult(_0x33c297,null))['catch'](handleError(_0x33c297,null));};exports[_0xa41a('0x105')]=function(_0x3dbd5b,_0x589fb2){var _0x23bae8;return db[_0xa41a('0xaa')][_0xa41a('0x26')]({'paused':0x1},{'where':{'UserId':_0x3dbd5b[_0xa41a('0x59')]['id']},'individualHooks':!![]})['then'](function(){return db[_0xa41a('0x3d')]['find']({'where':{'id':_0x3dbd5b[_0xa41a('0x59')]['id'],'role':_0xa41a('0x29')},'attributes':['id','name',_0xa41a('0x28'),_0xa41a('0x63'),_0xa41a('0x9e'),_0xa41a('0xa7')]});})[_0xa41a('0x27')](handleEntityNotFound(_0x589fb2,null))[_0xa41a('0x27')](function(_0x5668ba){if(_0x5668ba){_0x23bae8=_0x5668ba;return respondWithRpcPromise('QueuePause',_0xa41a('0x105'),{'id':_0x23bae8['id'],'name':_0x23bae8['name'],'pause':!![]});}})[_0xa41a('0x27')](function(){if(_0x23bae8){return db[_0xa41a('0xfa')]['findAll']({'where':{'membername':_0x23bae8['name'],'type':_0xa41a('0x100'),'exitAt':null}});}})[_0xa41a('0x27')](function(_0x201d29){if(_0x201d29['length']){var _0x28afe3=moment()['format'](_0xa41a('0xfd'));for(var _0x3cb5c0=0x0,_0x5bd40f=_0x201d29['length'];_0x3cb5c0<_0x5bd40f;_0x3cb5c0++){_0x201d29[_0x3cb5c0]['updateAttributes']({'exitAt':_0x28afe3});}}})[_0xa41a('0x27')](function(){var _0x125921=[];var _0x4c0748=utils[_0xa41a('0xfc')]();_0x4c0748['forEach'](function(_0x2a6e08){_0x125921['push']({'channel':_0x2a6e08,'membername':_0x23bae8[_0xa41a('0x38')],'interface':_[_0xa41a('0x66')](_0x23bae8['interface'])?util[_0xa41a('0xa8')](_0xa41a('0xa9'),_0x23bae8['name']):_0x23bae8[_0xa41a('0x9e')],'type':_0xa41a('0x100'),'enterAt':moment()[_0xa41a('0xa8')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x3dbd5b[_0xa41a('0x5e')][_0xa41a('0x106')]||'DEFAULT\x20PAUSE','role':_0x23bae8[_0xa41a('0x28')],'internal':_0x23bae8['internal']});});return db[_0xa41a('0xfa')][_0xa41a('0x89')](_0x125921,{'individualHooks':!![]});})[_0xa41a('0x27')](function(){return _0x23bae8[_0xa41a('0x26')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x3dbd5b[_0xa41a('0x5e')][_0xa41a('0x106')]||_0xa41a('0x107'),'lastPauseAt':moment()[_0xa41a('0xa8')](_0xa41a('0xfd'))});})[_0xa41a('0x27')](respondWithResult(_0x589fb2,null))[_0xa41a('0x5d')](handleError(_0x589fb2,null));};exports['unpause']=function(_0x174048,_0x3ec1c3){if(_0x174048[_0xa41a('0x5e')][_0xa41a('0xad')]&&!utils[_0xa41a('0x9f')](_0x174048[_0xa41a('0x5e')][_0xa41a('0xad')])){throw new APIBadRequestError(util[_0xa41a('0xa8')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x174048[_0xa41a('0x5e')]['channel']));}return db[_0xa41a('0x3d')]['find']({'where':{'id':_0x174048['params']['id']},'attributes':['id','name',_0xa41a('0x28'),_0xa41a('0x63'),'interface',_0xa41a('0xa7'),_0xa41a('0x9d'),_0xa41a('0x108'),'chatPause',_0xa41a('0x109'),'openchannelPause',_0xa41a('0x10a'),_0xa41a('0x10b'),_0xa41a('0x10c'),'lastPauseAt']})['then'](function(_0x476918){if(!_0x476918){throw new APINotFoundError(util[_0xa41a('0xa8')](_0xa41a('0xc8'),_0x174048[_0xa41a('0x59')]['id']));}return _0x476918[_0xa41a('0x10d')](_0x174048[_0xa41a('0x5e')][_0xa41a('0xad')]);})[_0xa41a('0x27')](respondWithResult(_0x3ec1c3,null))['catch'](APIHandleError(_0x3ec1c3));};exports[_0xa41a('0x10e')]=function(_0x336ab9,_0xbda710){var _0x427532={};var _0xadbf64={};var _0x59d16f;var _0x5b37f8;return db[_0xa41a('0x3d')]['findOne']({'where':{'id':_0x336ab9['params']['id']}})[_0xa41a('0x27')](handleEntityNotFound(_0xbda710,null))[_0xa41a('0x27')](function(_0x373d57){if(_0x373d57){_0x59d16f=_0x373d57;_0xadbf64['model']=_[_0xa41a('0xd2')](db[_0xa41a('0x10f')][_0xa41a('0xd3')]);_0xadbf64[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x336ab9[_0xa41a('0x48')]);_0xadbf64[_0xa41a('0xd4')]=_['intersection'](_0xadbf64[_0xa41a('0xd1')],_0xadbf64[_0xa41a('0x48')]);_0x427532['attributes']=_[_0xa41a('0xd5')](_0xadbf64[_0xa41a('0xd1')],qs[_0xa41a('0xdc')](_0x336ab9[_0xa41a('0x48')][_0xa41a('0xdc')]));_0x427532[_0xa41a('0x4c')]=_0x427532[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x427532['attributes']:_0xadbf64[_0xa41a('0xd1')];_0x427532[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x336ab9[_0xa41a('0x48')][_0xa41a('0xd6')]);_0x427532['where']=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x336ab9['query'],_0xadbf64[_0xa41a('0xd4')]));if(_0x336ab9[_0xa41a('0x48')][_0xa41a('0x32')]){_0x427532[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x427532[_0xa41a('0x47')],{'$or':_[_0xa41a('0x34')](_0x427532[_0xa41a('0x4c')],function(_0x254dd2){var _0x9560a6={};_0x9560a6[_0x254dd2]={'$like':'%'+_0x336ab9[_0xa41a('0x48')][_0xa41a('0x32')]+'%'};return _0x9560a6;})});}_0x427532=_[_0xa41a('0x5a')]({},_0x427532,_0x336ab9['options']);return _0x59d16f['getTeams'](_0x427532);}})['then'](function(_0x463335){if(_0x463335){_0x5b37f8=_0x463335['length'];if(!_0x336ab9[_0xa41a('0x48')][_0xa41a('0xdf')]('nolimit')){_0x427532[_0xa41a('0x1c')]=qs['limit'](_0x336ab9[_0xa41a('0x48')][_0xa41a('0x1c')]);_0x427532['offset']=qs[_0xa41a('0x1b')](_0x336ab9[_0xa41a('0x48')][_0xa41a('0x1b')]);}return _0x59d16f[_0xa41a('0x10e')](_0x427532);}})[_0xa41a('0x27')](function(_0x1e98b3){if(_0x1e98b3){return _0x1e98b3?{'count':_0x5b37f8,'rows':_0x1e98b3}:null;}})['then'](respondWithResult(_0xbda710,null))[_0xa41a('0x5d')](handleError(_0xbda710,null));};exports['addTeams']=function(_0x310ca9,_0x2ab1cc){var _0xc4c3d8=_0x310ca9[_0xa41a('0x59')]['id'];var _0x27c87f=_0x310ca9[_0xa41a('0x5e')]?_0x310ca9[_0xa41a('0x5e')][_0xa41a('0x61')]:null;var _0x2aa45d=[];return Promise[_0xa41a('0x103')]()[_0xa41a('0x27')](function(){if(!_0x27c87f)throw new APIBadRequestError(_0xa41a('0x110'));})[_0xa41a('0x27')](function(){return db[_0xa41a('0x3d')]['findOne']({'where':{'id':_0xc4c3d8}});})[_0xa41a('0x27')](function(_0x341292){if(!_0x341292)throw new APINotFoundError(util[_0xa41a('0xa8')](_0xa41a('0xc8'),_0x310ca9[_0xa41a('0x59')]['id']));return db[_0xa41a('0x68')][_0xa41a('0x111')](function(_0x572fd2){return _0x341292['addTeams'](_0x27c87f,{'transaction':_0x572fd2})[_0xa41a('0x27')](function(){return db[_0xa41a('0x10f')][_0xa41a('0x4e')]({'where':{'id':{'$in':_0x27c87f}}});})['then'](function(_0x26b381){var _0x54379e=_['map'](_0x26b381,function(_0x501770){return _0x501770['getAssociatedQueues']();});return Promise[_0xa41a('0x58')](_0x54379e);})[_0xa41a('0x27')](function(_0x5694a5){_0x2aa45d=_[_0xa41a('0x112')](_0x5694a5);var _0x3b25ef=_[_0xa41a('0x34')](_0x2aa45d,function(_0x341fe1){return _0x341fe1[_0xa41a('0x113')](_0x341292['id'],{'transaction':_0x572fd2});});return Promise[_0xa41a('0x58')](_0x3b25ef);})['then'](function(){if(!_0x341292[_0xa41a('0xa7')])return;var _0x296ab4=_['filter'](_0x2aa45d,function(_0x8746df){return _0x8746df['getDataValue'](_0xa41a('0xad'))===_0xa41a('0x114');});var _0xde0ac0=_['map'](_0x296ab4,function(_0x42b202){return db[_0xa41a('0xaa')]['upsert']({'membername':_0x341292[_0xa41a('0x38')],'UserId':_0x341292['id'],'queue_name':_0x42b202[_0xa41a('0x38')],'VoiceQueueId':_0x42b202['id'],'interface':_['isNil'](_0x341292['interface'])?util[_0xa41a('0xa8')](_0xa41a('0xa9'),_0x341292['name']):_0x341292['interface'],'paused':_0x341292[_0xa41a('0x9d')]||![],'penalty':_0x341292['penalty']},{'transaction':_0x572fd2});});return Promise[_0xa41a('0x58')](_0xde0ac0);})[_0xa41a('0x27')](function(){return db[_0xa41a('0x115')]['findAll']({'where':{'teamId':{'$in':_0x27c87f}}});})[_0xa41a('0x27')](function(_0x1a19b6){var _0x550a6b=_[_0xa41a('0x34')](_0x1a19b6,function(_0x13f0e1){return db[_0xa41a('0x116')][_0xa41a('0x7f')]({'UserId':_0x341292['id'],'VoicePrefixId':_0x13f0e1[_0xa41a('0x117')]},{'transaction':_0x572fd2});});return Promise[_0xa41a('0x58')](_0x550a6b);});});})[_0xa41a('0x27')](function(){for(var _0x41a00c=0x0;_0x41a00c<_0x2aa45d[_0xa41a('0x52')];_0x41a00c++){var _0x20357a=_0x2aa45d[_0x41a00c][_0xa41a('0x118')](_0xa41a('0xad'));var _0x5c2309=_0x20357a+_0xa41a('0xb1');socket[_0xa41a('0x2a')]('user'+_0x20357a+_0xa41a('0x119'),{'UserId':_0xc4c3d8,['queueField']:_0x2aa45d[_0x41a00c]['id']});}})[_0xa41a('0x27')](respondWithStatusCode(_0x2ab1cc,null))['catch'](APIHandleError(_0x2ab1cc));};exports[_0xa41a('0x11a')]=function(_0x3e4ca2,_0x40789b){var _0x3f300e=_0x3e4ca2['params']['id'];var _0x513c5f=null;if(_0x3e4ca2[_0xa41a('0x48')][_0xa41a('0x61')]){_0x513c5f=_[_0xa41a('0xb0')](_0x3e4ca2[_0xa41a('0x48')][_0xa41a('0x61')])?_0x3e4ca2[_0xa41a('0x48')][_0xa41a('0x61')]:[_0x3e4ca2[_0xa41a('0x48')][_0xa41a('0x61')]];}var _0x5998ba=[];return Promise['resolve']()[_0xa41a('0x27')](function(){if(!_0x513c5f)throw new APIBadRequestError(_0xa41a('0x11b'));})[_0xa41a('0x27')](function(){return db['User'][_0xa41a('0x98')]({'where':{'id':_0x3f300e}});})[_0xa41a('0x27')](function(_0x265705){if(!_0x265705)throw new APINotFoundError(util[_0xa41a('0xa8')](_0xa41a('0xc8'),_0x3e4ca2['params']['id']));return db[_0xa41a('0x68')][_0xa41a('0x111')](function(_0x19a3fa){return _0x265705[_0xa41a('0x11a')](_0x513c5f,{'transaction':_0x19a3fa})[_0xa41a('0x27')](function(){return db[_0xa41a('0x10f')][_0xa41a('0x4e')]({'where':{'id':{'$in':_0x513c5f}}});})[_0xa41a('0x27')](function(_0x2fd2d2){var _0x1f8a7b=_['map'](_0x2fd2d2,function(_0x45057d){return _0x45057d['getAssociatedQueues']();});return Promise[_0xa41a('0x58')](_0x1f8a7b);})[_0xa41a('0x27')](function(_0x51c5c0){_0x5998ba=_[_0xa41a('0x112')](_0x51c5c0);var _0x30c028=_[_0xa41a('0x34')](_0x5998ba,function(_0x51db2f){return _0x51db2f[_0xa41a('0x11c')](_0x265705['id'],{'transaction':_0x19a3fa});});return Promise[_0xa41a('0x58')](_0x30c028);})[_0xa41a('0x27')](function(){if(!_0x265705[_0xa41a('0xa7')])return;var _0x32b429=_[_0xa41a('0x32')](_0x5998ba,function(_0x2ceeec){return _0x2ceeec[_0xa41a('0x118')](_0xa41a('0xad'))==='Voice';});var _0x49c1a2=_[_0xa41a('0x34')](_0x32b429,function(_0x37b127){return db['UserVoiceQueueRt'][_0xa41a('0x2b')]({'where':{'VoiceQueueId':_0x37b127['id'],'UserId':_0x265705['id']},'transaction':_0x19a3fa});});return Promise[_0xa41a('0x58')](_0x49c1a2);})[_0xa41a('0x27')](function(){return db[_0xa41a('0x115')][_0xa41a('0x4e')]({'where':{'teamId':{'$in':_0x513c5f}}});})[_0xa41a('0x27')](function(_0x50a9f7){var _0x3ea269=_['map'](_0x50a9f7,function(_0x94706a){return db[_0xa41a('0x116')]['destroy']({'where':{'UserId':_0x265705['id'],'VoicePrefixId':_0x94706a['VoicePrefixId']}},{'transaction':_0x19a3fa});});return Promise[_0xa41a('0x58')](_0x3ea269);});});})['then'](function(){for(var _0xa386e8=0x0;_0xa386e8<_0x5998ba['length'];_0xa386e8++){var _0x4fe2c6=_0x5998ba[_0xa386e8]['getDataValue'](_0xa41a('0xad'));var _0x2b8d7f=_0x4fe2c6+_0xa41a('0xb1');socket['emit']('user'+_0x4fe2c6+_0xa41a('0xb2'),{'UserId':_0x3f300e,['queueField']:_0x5998ba[_0xa386e8]['id']});}})[_0xa41a('0x27')](respondWithStatusCode(_0x40789b,null))[_0xa41a('0x5d')](APIHandleError(_0x40789b));};exports['getLists']=function(_0x435b52,_0x144750){var _0x4adf15={};var _0x56c8a5={};var _0x3d0eae;var _0x2b94d1;return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x435b52[_0xa41a('0x59')]['id']}})['then'](handleEntityNotFound(_0x144750,null))[_0xa41a('0x27')](function(_0x3d738d){if(_0x3d738d){_0x3d0eae=_0x3d738d;_0x56c8a5[_0xa41a('0xd1')]=_[_0xa41a('0xd2')](db[_0xa41a('0xca')][_0xa41a('0xd3')]);_0x56c8a5[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x435b52[_0xa41a('0x48')]);_0x56c8a5[_0xa41a('0xd4')]=_[_0xa41a('0xd5')](_0x56c8a5[_0xa41a('0xd1')],_0x56c8a5['query']);_0x4adf15[_0xa41a('0x4c')]=_[_0xa41a('0xd5')](_0x56c8a5[_0xa41a('0xd1')],qs[_0xa41a('0xdc')](_0x435b52[_0xa41a('0x48')][_0xa41a('0xdc')]));_0x4adf15[_0xa41a('0x4c')]=_0x4adf15[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x4adf15[_0xa41a('0x4c')]:_0x56c8a5[_0xa41a('0xd1')];_0x4adf15[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x435b52[_0xa41a('0x48')][_0xa41a('0xd6')]);_0x4adf15['where']=qs[_0xa41a('0xd4')](_[_0xa41a('0xde')](_0x435b52[_0xa41a('0x48')],_0x56c8a5[_0xa41a('0xd4')]));if(_0x435b52[_0xa41a('0x48')][_0xa41a('0x32')]){_0x4adf15['where']=_[_0xa41a('0x5a')](_0x4adf15['where'],{'$or':_[_0xa41a('0x34')](_0x4adf15[_0xa41a('0x4c')],function(_0x228567){var _0x1d22e3={};_0x1d22e3[_0x228567]={'$like':'%'+_0x435b52[_0xa41a('0x48')]['filter']+'%'};return _0x1d22e3;})});}_0x4adf15=_[_0xa41a('0x5a')]({},_0x4adf15,_0x435b52['options']);return _0x3d0eae[_0xa41a('0x11d')](_0x4adf15);}})[_0xa41a('0x27')](function(_0x2072e3){if(_0x2072e3){_0x2b94d1=_0x2072e3[_0xa41a('0x52')];if(!_0x435b52['query']['hasOwnProperty']('nolimit')){_0x4adf15[_0xa41a('0x1c')]=qs[_0xa41a('0x1c')](_0x435b52[_0xa41a('0x48')][_0xa41a('0x1c')]);_0x4adf15[_0xa41a('0x1b')]=qs[_0xa41a('0x1b')](_0x435b52[_0xa41a('0x48')][_0xa41a('0x1b')]);}return _0x3d0eae[_0xa41a('0x11d')](_0x4adf15);}})[_0xa41a('0x27')](function(_0x26a34f){if(_0x26a34f){return _0x26a34f?{'count':_0x2b94d1,'rows':_0x26a34f}:null;}})[_0xa41a('0x27')](respondWithResult(_0x144750,null))[_0xa41a('0x5d')](handleError(_0x144750,null));};exports['getAgents']=function(_0x141fb1,_0x3578a1){var _0x1fe8d7={};var _0x563dc0={};var _0x7c890;return db[_0xa41a('0x3d')][_0xa41a('0x98')]({'where':{'id':_0x141fb1['params']['id']}})['then'](handleEntityNotFound(_0x3578a1,null))[_0xa41a('0x27')](function(_0x14e140){if(_0x14e140){_0x7c890=_0x14e140;_0x563dc0[_0xa41a('0xd1')]=_[_0xa41a('0xd2')](db[_0xa41a('0x3d')]['rawAttributes']);_0x563dc0[_0xa41a('0x48')]=_[_0xa41a('0xd2')](_0x141fb1[_0xa41a('0x48')]);_0x563dc0[_0xa41a('0xd4')]=_['intersection'](_0x563dc0[_0xa41a('0xd1')],_0x563dc0[_0xa41a('0x48')]);_0x1fe8d7[_0xa41a('0x4c')]=_['intersection'](_0x563dc0[_0xa41a('0xd1')],qs['fields'](_0x141fb1[_0xa41a('0x48')][_0xa41a('0xdc')]));_0x1fe8d7[_0xa41a('0x4c')]=_0x1fe8d7[_0xa41a('0x4c')][_0xa41a('0x52')]?_0x1fe8d7[_0xa41a('0x4c')]:_0x563dc0[_0xa41a('0xd1')];_0x1fe8d7[_0xa41a('0xdd')]=qs[_0xa41a('0xd6')](_0x141fb1[_0xa41a('0x48')]['sort']);_0x1fe8d7[_0xa41a('0x47')]=qs['filters'](_[_0xa41a('0xde')](_0x141fb1[_0xa41a('0x48')],_0x563dc0['filters']));if(_0x141fb1[_0xa41a('0x48')][_0xa41a('0x32')]){_0x1fe8d7[_0xa41a('0x47')]=_[_0xa41a('0x5a')](_0x1fe8d7[_0xa41a('0x47')],{'$or':_[_0xa41a('0x34')](_0x1fe8d7[_0xa41a('0x4c')],function(_0x58287c){var _0x32a547={};_0x32a547[_0x58287c]={'$like':'%'+_0x141fb1['query'][_0xa41a('0x32')]+'%'};return _0x32a547;})});}_0x1fe8d7[_0xa41a('0xd1')]=db[_0xa41a('0x3d')];_0x1fe8d7['as']=_0xa41a('0x86');_0x1fe8d7=_[_0xa41a('0x5a')]({},_0x1fe8d7,_0x141fb1[_0xa41a('0xd7')]);return _0x7c890[_0xa41a('0x11e')]({'include':[_0x1fe8d7]});}})[_0xa41a('0x27')](function(_0x288f0d){if(_0x288f0d){var _0x2fbb66={},_0x3eab12=[];for(var _0x4affa2=0x0;_0x4affa2<_0x288f0d[_0xa41a('0x52')];_0x4affa2+=0x1){for(var _0x4dc3ba=0x0,_0x24cb56;_0x4dc3ba<_0x288f0d[_0x4affa2][_0xa41a('0x86')]['length'];_0x4dc3ba+=0x1){_0x24cb56=_0x288f0d[_0x4affa2][_0xa41a('0x86')][_0x4dc3ba][_0xa41a('0x2c')]({'plain':!![]});_0x2fbb66[_0x24cb56['id']]=_0x24cb56;}}_0x2fbb66=_[_0xa41a('0x11f')](_0x2fbb66);for(var _0x59af8b=qs[_0xa41a('0x1b')](_0x141fb1[_0xa41a('0x48')]['offset']);_0x59af8b<_0x2fbb66[_0xa41a('0x52')]&&_0x3eab12[_0xa41a('0x52')]=_0x2b09ae[_0xbb59('0x49')]){throw new Error(_0xbb59('0x4a'));}})['then'](function(){if(_0xdabcf2){return db[_0xbb59('0x21')]['destroy']({'where':{'membername':_0xdabcf2[_0xbb59('0x1c')]},'individualHooks':!![]});}})[_0xbb59('0x12')](function(){if(_0xdabcf2){return _0xdabcf2[_0xbb59('0x4b')]({'raw':!![]});}})[_0xbb59('0x12')](function(_0x4a5624){if(_0xdabcf2){if(_0x4a5624){var _0x428cc7=[];_0x58ed16=_0x4a5624;if(_0x58ed16['length']){for(var _0x482ea0=0x0;_0x482ea0<_0x58ed16['length'];_0x482ea0++){_0x428cc7['push'](db[_0xbb59('0x21')][_0xbb59('0x4c')]({'membername':_0xdabcf2['name'],'UserId':_0xdabcf2['id'],'queue_name':_0x58ed16[_0x482ea0][_0xbb59('0x1c')],'VoiceQueueId':_0x58ed16[_0x482ea0]['id'],'interface':_0x3cc8de,'paused':_0xdabcf2[_0xbb59('0x4d')]||![],'penalty':_0x58ed16[_0x482ea0][_0xbb59('0x4e')]||0x0}));}return BPromise[_0xbb59('0x41')](_0x428cc7);}}}})[_0xbb59('0x12')](function(){if(_0xdabcf2){return db[_0xbb59('0x40')][_0xbb59('0x22')]({'where':{'membername':_0xdabcf2[_0xbb59('0x1c')],'exitAt':null}});}})[_0xbb59('0x12')](function(_0xedbe83){if(_0xdabcf2){if(_0xedbe83&&_0xedbe83[_0xbb59('0x24')]){var _0x3dbdb5=[];_0xedbe83[_0xbb59('0x28')](function(_0x5522dd){_0x3dbdb5[_0xbb59('0x29')](_0x5522dd[_0xbb59('0x2d')]({'exitAt':moment()[_0xbb59('0x25')](_0xbb59('0x26'))}));});return BPromise[_0xbb59('0x41')](_0x3dbdb5);}}})[_0xbb59('0x12')](function(){if(_0xdabcf2){var _0x193f23=[];var _0x9d48bc=[];var _0x276e3e=utils[_0xbb59('0x4f')]();var _0x4852ce={'membername':_0xdabcf2[_0xbb59('0x1c')],'interface':_0x3cc8de,'enterAt':moment()['format'](_0xbb59('0x26')),'role':_0xdabcf2[_0xbb59('0x1d')],'internal':_0xdabcf2[_0xbb59('0x1e')]};_0x276e3e[_0xbb59('0x28')](function(_0x2f67af){_0x193f23[_0xbb59('0x29')](_[_0xbb59('0x50')]({'channel':_0x2f67af,'type':_0xbb59('0x51'),'data1':'callysquare','data2':_0x3cc8de},_0x4852ce));if(_0xdabcf2['loginInPause']){_0x9d48bc[_0xbb59('0x29')](_['merge']({'channel':_0x2f67af,'type':'PAUSE','data1':_0xbb59('0x52')},_0x4852ce));}});return db[_0xbb59('0x40')][_0xbb59('0x53')](_0x193f23[_0xbb59('0x54')](_0x9d48bc),{'individualHooks':!![]});}})[_0xbb59('0x12')](function(){if(_0xdabcf2){return _0xdabcf2[_0xbb59('0x2d')]({'online':!![],'lastLoginAt':moment()[_0xbb59('0x25')](_0xbb59('0x26')),'voicePause':_0xdabcf2[_0xbb59('0x4d')]||![],'mailPause':_0xdabcf2['loginInPause']||![],'chatPause':_0xdabcf2['loginInPause']||![],'faxPause':_0xdabcf2[_0xbb59('0x4d')]||![],'smsPause':_0xdabcf2[_0xbb59('0x4d')]||![],'openchannelPause':_0xdabcf2[_0xbb59('0x4d')]||![],'pauseType':_0xdabcf2[_0xbb59('0x4d')]?_0xbb59('0x52'):null,'lastPauseAt':moment()[_0xbb59('0x25')](_0xbb59('0x26')),'interface':_0x3cc8de});}})[_0xbb59('0x12')](function(_0x4b4dd1){_0x2001f2(_0x4b4dd1);})[_0xbb59('0x16')](function(_0x1764eb){_0x193a7e(_0x2805b9[_0xbb59('0x1a')](0x1f4,_0x1764eb[_0xbb59('0x17')]));});});}; \ No newline at end of file +var _0xebf9=['whatsappPause','pauseType','lastPauseAt','User\x20with\x20id\x20%s\x20not\x20found','params','unpause','system','findOne','destroy','all','LoginUser','mobile','phone','count','agent','../../config/license/util','getLicense','agents','getVoiceQueues','upsert','loginInPause','UserVoiceQueue.penalty','LOGIN','callysquare','concat','LOGININPAUSE','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','GetUser','User','options','raw','where','limit','include','map','model','attributes','then','info','debug','catch','message','ShowUser','stringify','error','PauseUser','find','role','internal','interface','UserVoiceQueueRt','update','MemberReport','findAll','name','PAUSE','length','updateAttributes','getChannels','forEach','push','format','SIP/%s','body','type','DEFAULT\x20PAUSE','uniqueid','bulkCreate','YYYY-MM-DD\x20HH:mm:ss','UnpauseUser','channel','Channel\x20parameter\x20%s\x20is\x20invalid','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause'];(function(_0x109dbd,_0x290d2b){var _0x395644=function(_0x5a8c2d){while(--_0x5a8c2d){_0x109dbd['push'](_0x109dbd['shift']());}};_0x395644(++_0x290d2b);}(_0xebf9,0xce));var _0x9ebf=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xebf9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9ebf('0x0'));var util=require(_0x9ebf('0x1'));var moment=require(_0x9ebf('0x2'));var BPromise=require(_0x9ebf('0x3'));var Redis=require(_0x9ebf('0x4'));var db=require(_0x9ebf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9ebf('0x6'))(_0x9ebf('0x7'));var config=require(_0x9ebf('0x8'));config[_0x9ebf('0x9')]=_[_0x9ebf('0xa')](config[_0x9ebf('0x9')],{'host':_0x9ebf('0xb'),'port':0x18eb});var socket=require(_0x9ebf('0xc'))(new Redis(config[_0x9ebf('0x9')]));require('./user.socket')['register'](socket);exports[_0x9ebf('0xd')]=function(_0x34bb2c){var _0x4a0104=this;return new Promise(function(_0x1a1d3e,_0x489c60){return db[_0x9ebf('0xe')]['findAll']({'raw':_0x34bb2c['options']?_0x34bb2c[_0x9ebf('0xf')][_0x9ebf('0x10')]===undefined?!![]:![]:!![],'where':_0x34bb2c['options']?_0x34bb2c[_0x9ebf('0xf')][_0x9ebf('0x11')]||null:null,'attributes':_0x34bb2c['options']?_0x34bb2c[_0x9ebf('0xf')]['attributes']||null:null,'limit':_0x34bb2c[_0x9ebf('0xf')]?_0x34bb2c['options'][_0x9ebf('0x12')]||null:null,'include':_0x34bb2c[_0x9ebf('0xf')]?_0x34bb2c[_0x9ebf('0xf')][_0x9ebf('0x13')]?_[_0x9ebf('0x14')](_0x34bb2c[_0x9ebf('0xf')][_0x9ebf('0x13')],function(_0x38221b){return{'model':db[_0x38221b[_0x9ebf('0x15')]],'as':_0x38221b['as'],'attributes':_0x38221b[_0x9ebf('0x16')],'include':_0x38221b[_0x9ebf('0x13')]?_[_0x9ebf('0x14')](_0x38221b[_0x9ebf('0x13')],function(_0x516c11){return{'model':db[_0x516c11['model']],'as':_0x516c11['as'],'attributes':_0x516c11[_0x9ebf('0x16')],'include':_0x516c11[_0x9ebf('0x13')]?_[_0x9ebf('0x14')](_0x516c11['include'],function(_0x12c7cb){return{'model':db[_0x12c7cb[_0x9ebf('0x15')]],'as':_0x12c7cb['as'],'attributes':_0x12c7cb[_0x9ebf('0x16')]};}):[]};}):[]};}):[]:[]})[_0x9ebf('0x17')](function(_0x552977){logger[_0x9ebf('0x18')]('GetUser',_0x34bb2c);logger[_0x9ebf('0x19')]('GetUser',_0x34bb2c,JSON['stringify'](_0x552977));_0x1a1d3e(_0x552977);})[_0x9ebf('0x1a')](function(_0x56a334){logger['error'](_0x9ebf('0xd'),_0x56a334[_0x9ebf('0x1b')],_0x34bb2c);_0x489c60(_0x4a0104['error'](0x1f4,_0x56a334['message']));});});};exports[_0x9ebf('0x1c')]=function(_0x585878){var _0x35805a=this;return new Promise(function(_0x40a28c,_0x3a1993){return db[_0x9ebf('0xe')]['find']({'raw':_0x585878[_0x9ebf('0xf')]?_0x585878['options'][_0x9ebf('0x10')]===undefined?!![]:![]:!![],'where':_0x585878['options']?_0x585878['options'][_0x9ebf('0x11')]||null:null,'attributes':_0x585878[_0x9ebf('0xf')]?_0x585878[_0x9ebf('0xf')][_0x9ebf('0x16')]||null:null,'include':_0x585878[_0x9ebf('0xf')]?_0x585878[_0x9ebf('0xf')][_0x9ebf('0x13')]?_[_0x9ebf('0x14')](_0x585878[_0x9ebf('0xf')][_0x9ebf('0x13')],function(_0x125389){return{'model':db[_0x125389[_0x9ebf('0x15')]],'as':_0x125389['as'],'attributes':_0x125389[_0x9ebf('0x16')],'include':_0x125389[_0x9ebf('0x13')]?_[_0x9ebf('0x14')](_0x125389[_0x9ebf('0x13')],function(_0x4b4afd){return{'model':db[_0x4b4afd[_0x9ebf('0x15')]],'as':_0x4b4afd['as'],'attributes':_0x4b4afd[_0x9ebf('0x16')],'include':_0x4b4afd[_0x9ebf('0x13')]?_['map'](_0x4b4afd[_0x9ebf('0x13')],function(_0x1df371){return{'model':db[_0x1df371[_0x9ebf('0x15')]],'as':_0x1df371['as'],'attributes':_0x1df371[_0x9ebf('0x16')]};}):[]};}):[]};}):[]:[]})[_0x9ebf('0x17')](function(_0x43b843){logger[_0x9ebf('0x18')](_0x9ebf('0x1c'),_0x585878);logger[_0x9ebf('0x19')](_0x9ebf('0x1c'),_0x585878,JSON[_0x9ebf('0x1d')](_0x43b843));_0x40a28c(_0x43b843);})['catch'](function(_0x3a5b89){logger[_0x9ebf('0x1e')](_0x9ebf('0x1c'),_0x3a5b89[_0x9ebf('0x1b')],_0x585878);_0x3a1993(_0x35805a['error'](0x1f4,_0x3a5b89['message']));});});};exports[_0x9ebf('0x1f')]=function(_0x23328e){var _0x46a048;return db['User'][_0x9ebf('0x20')]({'where':_0x23328e[_0x9ebf('0xf')]['where']||{},'attributes':['id','name',_0x9ebf('0x21'),_0x9ebf('0x22'),_0x9ebf('0x23')]})[_0x9ebf('0x17')](function(_0x4c3da6){if(!_0x4c3da6){throw new Error(util['format']('User\x20with\x20id\x20%s\x20not\x20found',_0x23328e['params']['id']));}_0x46a048=_0x4c3da6;return db[_0x9ebf('0x24')][_0x9ebf('0x25')]({'paused':0x1},{'where':{'UserId':_0x46a048['id']},'individualHooks':!![]});})[_0x9ebf('0x17')](function(){return db[_0x9ebf('0x26')][_0x9ebf('0x27')]({'where':{'membername':_0x46a048[_0x9ebf('0x28')],'type':_0x9ebf('0x29'),'exitAt':null}});})[_0x9ebf('0x17')](function(_0x252d92){if(_0x252d92&&_0x252d92['length']){var _0x4f0fa2=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x4a1c8d=0x0,_0x102ef4=_0x252d92[_0x9ebf('0x2a')];_0x4a1c8d<_0x102ef4;_0x4a1c8d++){_0x252d92[_0x4a1c8d][_0x9ebf('0x2b')]({'exitAt':_0x4f0fa2});}}})['then'](function(){var _0x415145=[];var _0x1dd80f=utils[_0x9ebf('0x2c')]();_0x1dd80f[_0x9ebf('0x2d')](function(_0x3cbce2){_0x415145[_0x9ebf('0x2e')]({'channel':_0x3cbce2,'membername':_0x46a048[_0x9ebf('0x28')],'interface':_['isNil'](_0x46a048[_0x9ebf('0x23')])?util[_0x9ebf('0x2f')](_0x9ebf('0x30'),_0x46a048[_0x9ebf('0x28')]):_0x46a048[_0x9ebf('0x23')],'type':_0x9ebf('0x29'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x23328e[_0x9ebf('0x31')][_0x9ebf('0x32')]||_0x9ebf('0x33'),'role':_0x46a048[_0x9ebf('0x21')],'internal':_0x46a048[_0x9ebf('0x22')],'uniqueid':_0x23328e['body'][_0x9ebf('0x34')]||null});});return db[_0x9ebf('0x26')][_0x9ebf('0x35')](_0x415145,{'individualHooks':!![]});})['then'](function(){return _0x46a048['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x23328e[_0x9ebf('0x31')][_0x9ebf('0x32')]||_0x9ebf('0x33'),'lastPauseAt':moment()[_0x9ebf('0x2f')](_0x9ebf('0x36'))});})[_0x9ebf('0x1a')](function(_0x3a75dc){throw _0x3a75dc;});};exports[_0x9ebf('0x37')]=function(_0x3af814){return Promise['resolve']()[_0x9ebf('0x17')](function(){if(_0x3af814[_0x9ebf('0x31')][_0x9ebf('0x38')]&&!utils['isValidChannel'](_0x3af814[_0x9ebf('0x31')][_0x9ebf('0x38')])){throw new Error(util[_0x9ebf('0x2f')](_0x9ebf('0x39'),_0x3af814['body']['channel']));}return db['User']['findOne']({'where':_0x3af814[_0x9ebf('0xf')][_0x9ebf('0x11')]||{},'attributes':['id',_0x9ebf('0x28'),_0x9ebf('0x21'),_0x9ebf('0x22'),_0x9ebf('0x23'),'online',_0x9ebf('0x3a'),_0x9ebf('0x3b'),_0x9ebf('0x3c'),_0x9ebf('0x3d'),_0x9ebf('0x3e'),_0x9ebf('0x3f'),_0x9ebf('0x40'),_0x9ebf('0x41'),_0x9ebf('0x42')]});})[_0x9ebf('0x17')](function(_0x2da115){if(!_0x2da115){throw new Error(util[_0x9ebf('0x2f')](_0x9ebf('0x43'),_0x3af814[_0x9ebf('0x44')]['id']));}return _0x2da115[_0x9ebf('0x45')](_0x3af814['body'][_0x9ebf('0x38')],_0x9ebf('0x46'));})[_0x9ebf('0x1a')](function(_0x258caf){throw _0x258caf;});};exports['LogoutUser']=function(_0x22f3a6){var _0x27a46d=this;return new Promise(function(_0x4e2497,_0x3234fe){var _0x1a582f;return db[_0x9ebf('0xe')][_0x9ebf('0x47')]({'where':_0x22f3a6['options']['where']||{},'attributes':['id','name']})['then'](function(_0x1ca892){if(_0x1ca892){_0x1a582f=_0x1ca892;return db[_0x9ebf('0x24')][_0x9ebf('0x48')]({'where':{'membername':_0x1a582f[_0x9ebf('0x28')]},'individualHooks':!![]});}})[_0x9ebf('0x17')](function(){if(_0x1a582f){return db[_0x9ebf('0x26')][_0x9ebf('0x27')]({'where':{'membername':_0x1a582f[_0x9ebf('0x28')],'exitAt':null}});}})[_0x9ebf('0x17')](function(_0x1cb813){if(_0x1a582f){if(_0x1cb813&&_0x1cb813['length']){var _0x2edd17=[];_0x1cb813[_0x9ebf('0x2d')](function(_0x2ad6fc){_0x2edd17[_0x9ebf('0x2e')](_0x2ad6fc['update']({'exitAt':moment()[_0x9ebf('0x2f')](_0x9ebf('0x36'))}));});return BPromise[_0x9ebf('0x49')](_0x2edd17);}}})[_0x9ebf('0x17')](function(){if(_0x1a582f){return _0x1a582f[_0x9ebf('0x25')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x9ebf('0x17')](function(_0xd7cac1){_0x4e2497(_0xd7cac1);})['catch'](function(_0x411c35){_0x3234fe(_0x27a46d[_0x9ebf('0x1e')](0x1f4,_0x411c35[_0x9ebf('0x1b')]));});});};exports[_0x9ebf('0x4a')]=function(_0x4dfe1b){var _0x94517c=this;return new Promise(function(_0x21c153,_0x282248){var _0x5d4fa8;var _0x1d1647;var _0x3738bc;var _0x26ca18;return db[_0x9ebf('0xe')][_0x9ebf('0x47')]({'where':_0x4dfe1b[_0x9ebf('0xf')][_0x9ebf('0x11')]||{},'attributes':['id',_0x9ebf('0x28'),'role',_0x9ebf('0x4b'),_0x9ebf('0x4c'),_0x9ebf('0x22'),'loginInPause',_0x9ebf('0x23')]})['then'](function(_0x6f69cb){if(_0x6f69cb){_0x5d4fa8=_0x6f69cb;_0x26ca18=_0x4dfe1b['body'][_0x9ebf('0x23')]?_0x4dfe1b[_0x9ebf('0x31')]['interface']:util[_0x9ebf('0x2f')]('SIP/%s',_0x5d4fa8[_0x9ebf('0x28')]);return db[_0x9ebf('0xe')][_0x9ebf('0x4d')]({'where':{'role':_0x9ebf('0x4e'),'online':!![],'id':{'$ne':_0x5d4fa8['id']}}});}})[_0x9ebf('0x17')](function(_0x5db9fd){if(_0x5db9fd){_0x3738bc=_0x5db9fd;return require(_0x9ebf('0x4f'))[_0x9ebf('0x50')]();}})[_0x9ebf('0x17')](function(_0x2239f5){if(_0x2239f5&&_0x2239f5[_0x9ebf('0x51')]&&_0x3738bc>=_0x2239f5[_0x9ebf('0x51')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0x9ebf('0x17')](function(){if(_0x5d4fa8){return db[_0x9ebf('0x24')]['destroy']({'where':{'membername':_0x5d4fa8[_0x9ebf('0x28')]},'individualHooks':!![]});}})[_0x9ebf('0x17')](function(){if(_0x5d4fa8){return _0x5d4fa8[_0x9ebf('0x52')]({'raw':!![]});}})[_0x9ebf('0x17')](function(_0x372361){if(_0x5d4fa8){if(_0x372361){var _0xee7e4f=[];_0x1d1647=_0x372361;if(_0x1d1647[_0x9ebf('0x2a')]){for(var _0x5d1fed=0x0;_0x5d1fed<_0x1d1647['length'];_0x5d1fed++){_0xee7e4f[_0x9ebf('0x2e')](db[_0x9ebf('0x24')][_0x9ebf('0x53')]({'membername':_0x5d4fa8[_0x9ebf('0x28')],'UserId':_0x5d4fa8['id'],'queue_name':_0x1d1647[_0x5d1fed]['name'],'VoiceQueueId':_0x1d1647[_0x5d1fed]['id'],'interface':_0x26ca18,'paused':_0x5d4fa8[_0x9ebf('0x54')]||![],'penalty':_0x1d1647[_0x5d1fed][_0x9ebf('0x55')]||0x0}));}return BPromise['all'](_0xee7e4f);}}}})['then'](function(){if(_0x5d4fa8){return db[_0x9ebf('0x26')]['findAll']({'where':{'membername':_0x5d4fa8[_0x9ebf('0x28')],'exitAt':null}});}})[_0x9ebf('0x17')](function(_0x45891d){if(_0x5d4fa8){if(_0x45891d&&_0x45891d['length']){var _0x4ecac8=[];_0x45891d[_0x9ebf('0x2d')](function(_0x10f6fb){_0x4ecac8[_0x9ebf('0x2e')](_0x10f6fb['update']({'exitAt':moment()[_0x9ebf('0x2f')]('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x9ebf('0x49')](_0x4ecac8);}}})[_0x9ebf('0x17')](function(){if(_0x5d4fa8){var _0x13700e=[];var _0x58eff0=[];var _0xa10a8f=utils[_0x9ebf('0x2c')]();var _0x1cc270={'membername':_0x5d4fa8[_0x9ebf('0x28')],'interface':_0x26ca18,'enterAt':moment()[_0x9ebf('0x2f')](_0x9ebf('0x36')),'role':_0x5d4fa8['role'],'internal':_0x5d4fa8['internal']};_0xa10a8f[_0x9ebf('0x2d')](function(_0x47b66e){_0x13700e[_0x9ebf('0x2e')](_['merge']({'channel':_0x47b66e,'type':_0x9ebf('0x56'),'data1':_0x9ebf('0x57'),'data2':_0x26ca18},_0x1cc270));if(_0x5d4fa8[_0x9ebf('0x54')]){_0x58eff0[_0x9ebf('0x2e')](_['merge']({'channel':_0x47b66e,'type':_0x9ebf('0x29'),'data1':'LOGININPAUSE'},_0x1cc270));}});return db[_0x9ebf('0x26')][_0x9ebf('0x35')](_0x13700e[_0x9ebf('0x58')](_0x58eff0),{'individualHooks':!![]});}})[_0x9ebf('0x17')](function(){if(_0x5d4fa8){return _0x5d4fa8[_0x9ebf('0x25')]({'online':!![],'lastLoginAt':moment()['format'](_0x9ebf('0x36')),'voicePause':_0x5d4fa8['loginInPause']||![],'mailPause':_0x5d4fa8[_0x9ebf('0x54')]||![],'chatPause':_0x5d4fa8[_0x9ebf('0x54')]||![],'faxPause':_0x5d4fa8[_0x9ebf('0x54')]||![],'smsPause':_0x5d4fa8[_0x9ebf('0x54')]||![],'openchannelPause':_0x5d4fa8[_0x9ebf('0x54')]||![],'pauseType':_0x5d4fa8[_0x9ebf('0x54')]?_0x9ebf('0x59'):null,'lastPauseAt':moment()[_0x9ebf('0x2f')](_0x9ebf('0x36')),'interface':_0x26ca18});}})[_0x9ebf('0x17')](function(_0xa92e9b){_0x21c153(_0xa92e9b);})[_0x9ebf('0x1a')](function(_0x28cf03){_0x282248(_0x94517c[_0x9ebf('0x1e')](0x1f4,_0x28cf03[_0x9ebf('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index fa8d9ed..bf204dd 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 _0xd2f4=['emit','removeListener','register','user:','./user.events','save','remove','update'];(function(_0x44dd97,_0x5c129f){var _0x49c6bd=function(_0xea590f){while(--_0xea590f){_0x44dd97['push'](_0x44dd97['shift']());}};_0x49c6bd(++_0x5c129f);}(_0xd2f4,0xb4));var _0x4d2f=function(_0x1a0091,_0x584590){_0x1a0091=_0x1a0091-0x0;var _0x119710=_0xd2f4[_0x1a0091];return _0x119710;};'use strict';var UserEvents=require(_0x4d2f('0x0'));var events=[_0x4d2f('0x1'),_0x4d2f('0x2'),_0x4d2f('0x3')];function createListener(_0x9c286a,_0x371339){return function(_0x3845b0){_0x371339[_0x4d2f('0x4')](_0x9c286a,_0x3845b0);};}function removeListener(_0x166744,_0x23f485){return function(){UserEvents[_0x4d2f('0x5')](_0x166744,_0x23f485);};}exports[_0x4d2f('0x6')]=function(_0x5e9684){for(var _0x3ffce8=0x0,_0x2e56fe=events['length'];_0x3ffce8<_0x2e56fe;_0x3ffce8++){var _0x5ab2f2=events[_0x3ffce8];var _0x1691b6=createListener(_0x4d2f('0x7')+_0x5ab2f2,_0x5e9684);UserEvents['on'](_0x5ab2f2,_0x1691b6);}}; \ No newline at end of file +var _0x6a87=['removeListener','register','length','./user.events','save','update','emit'];(function(_0x527957,_0x5ddfb4){var _0x48b5c0=function(_0x4f8d5c){while(--_0x4f8d5c){_0x527957['push'](_0x527957['shift']());}};_0x48b5c0(++_0x5ddfb4);}(_0x6a87,0x1df));var _0x76a8=function(_0x444bfd,_0x1bde48){_0x444bfd=_0x444bfd-0x0;var _0x391184=_0x6a87[_0x444bfd];return _0x391184;};'use strict';var UserEvents=require(_0x76a8('0x0'));var events=[_0x76a8('0x1'),'remove',_0x76a8('0x2')];function createListener(_0x460d3c,_0x32a769){return function(_0xa69566){_0x32a769[_0x76a8('0x3')](_0x460d3c,_0xa69566);};}function removeListener(_0x2b55c4,_0x2c3d43){return function(){UserEvents[_0x76a8('0x4')](_0x2b55c4,_0x2c3d43);};}exports[_0x76a8('0x5')]=function(_0xd2cb88){for(var _0x4c27d0=0x0,_0x446d9a=events[_0x76a8('0x6')];_0x4c27d0<_0x446d9a;_0x4c27d0++){var _0x513663=events[_0x4c27d0];var _0x16548c=createListener('user:'+_0x513663,_0xd2cb88);UserEvents['on'](_0x513663,_0x16548c);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index dd0caa4..dfc4f70 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1e3dfe,_0x199c5d){var _0x914065=function(_0x39efc6){while(--_0x39efc6){_0x1e3dfe['push'](_0x1e3dfe['shift']());}};_0x914065(++_0x199c5d);}(_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(_0x4a93e9,_0x5b569f){var _0x4b3ba7=function(_0x483c02){while(--_0x483c02){_0x4a93e9['push'](_0x4a93e9['shift']());}};_0x4b3ba7(++_0x5b569f);}(_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 diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index ec422bd..ff745f2 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. * // * * // ************************************************************************* -var _0x0b09=['sequelize','exports'];(function(_0xddd806,_0x574abf){var _0x522acf=function(_0x1b2372){while(--_0x1b2372){_0xddd806['push'](_0xddd806['shift']());}};_0x522acf(++_0x574abf);}(_0x0b09,0x13c));var _0x90b0=function(_0x1da1b1,_0xebd18){_0x1da1b1=_0x1da1b1-0x0;var _0x2ffdeb=_0x0b09[_0x1da1b1];return _0x2ffdeb;};'use strict';var Sequelize=require(_0x90b0('0x0'));module[_0x90b0('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xac47=['exports','INTEGER','sequelize'];(function(_0x57e794,_0x57221c){var _0x5cf6b4=function(_0x171981){while(--_0x171981){_0x57e794['push'](_0x57e794['shift']());}};_0x5cf6b4(++_0x57221c);}(_0xac47,0x1af));var _0x7ac4=function(_0x4b8980,_0x2559d8){_0x4b8980=_0x4b8980-0x0;var _0x2e93b4=_0xac47[_0x4b8980];return _0x2e93b4;};'use strict';var Sequelize=require(_0x7ac4('0x0'));module[_0x7ac4('0x1')]={'penalty':{'type':Sequelize[_0x7ac4('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 1c58c57..afa508e 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 _0xc739=['UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','rimraf','../../config/environment','exports','define'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xc739,0x160));var _0x9c73=function(_0x436fa8,_0x1d9926){_0x436fa8=_0x436fa8-0x0;var _0x2b640e=_0xc739[_0x436fa8];return _0x2b640e;};'use strict';var _=require(_0x9c73('0x0'));var util=require(_0x9c73('0x1'));var logger=require(_0x9c73('0x2'))('api');var moment=require(_0x9c73('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9c73('0x4'));var config=require(_0x9c73('0x5'));var attributes=require('./userChatQueue.attributes');module[_0x9c73('0x6')]=function(_0x51b03b,_0x16478b){return _0x51b03b[_0x9c73('0x7')](_0x9c73('0x8'),attributes,{'tableName':_0x9c73('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4be6=['user_has_chat_queues','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes','UserChatQueue'];(function(_0x2b1532,_0x18237d){var _0x2c2e98=function(_0x50401c){while(--_0x50401c){_0x2b1532['push'](_0x2b1532['shift']());}};_0x2c2e98(++_0x18237d);}(_0x4be6,0x1a3));var _0x64be=function(_0x31ec29,_0x58915c){_0x31ec29=_0x31ec29-0x0;var _0x3275fc=_0x4be6[_0x31ec29];return _0x3275fc;};'use strict';var _=require(_0x64be('0x0'));var util=require('util');var logger=require(_0x64be('0x1'))(_0x64be('0x2'));var moment=require(_0x64be('0x3'));var BPromise=require('bluebird');var rp=require(_0x64be('0x4'));var fs=require('fs');var path=require(_0x64be('0x5'));var rimraf=require(_0x64be('0x6'));var config=require(_0x64be('0x7'));var attributes=require(_0x64be('0x8'));module['exports']=function(_0x268e2d,_0x5d1f79){return _0x268e2d['define'](_0x64be('0x9'),attributes,{'tableName':_0x64be('0xa'),'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 46b1695..59c5fca 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 _0x9c95=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis'];(function(_0x111717,_0x156957){var _0x212339=function(_0x223b27){while(--_0x223b27){_0x111717['push'](_0x111717['shift']());}};_0x212339(++_0x156957);}(_0x9c95,0x1b0));var _0x59c9=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x9c95[_0x29d915];return _0x160f86;};'use strict';var _=require(_0x59c9('0x0'));var util=require(_0x59c9('0x1'));var moment=require(_0x59c9('0x2'));var BPromise=require(_0x59c9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x59c9('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x59c9('0x5'))(_0x59c9('0x6'));var config=require(_0x59c9('0x7'));var jayson=require(_0x59c9('0x8'));var client=jayson[_0x59c9('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2cb2d3,_0x2e834f,_0xd911f3){return new BPromise(function(_0x18d404,_0x262111){return client[_0x59c9('0xa')](_0x2cb2d3,_0xd911f3)[_0x59c9('0xb')](function(_0xd99bb5){logger['info'](_0x59c9('0xc'),_0x2e834f,_0x59c9('0xd'));logger[_0x59c9('0xe')](_0x59c9('0xf'),_0x2e834f,'request\x20sent',JSON[_0x59c9('0x10')](_0xd99bb5));if(_0xd99bb5[_0x59c9('0x11')]){if(_0xd99bb5['error'][_0x59c9('0x12')]===0x1f4){logger[_0x59c9('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x2e834f,_0xd99bb5[_0x59c9('0x11')][_0x59c9('0x13')]);return _0x262111(_0xd99bb5[_0x59c9('0x11')][_0x59c9('0x13')]);}logger['error'](_0x59c9('0xc'),_0x2e834f,_0xd99bb5['error'][_0x59c9('0x13')]);return _0x18d404(_0xd99bb5[_0x59c9('0x11')]['message']);}else{logger[_0x59c9('0x14')](_0x59c9('0xc'),_0x2e834f,_0x59c9('0xd'));_0x18d404(_0xd99bb5[_0x59c9('0x15')][_0x59c9('0x13')]);}})[_0x59c9('0x16')](function(_0x212cf3){logger[_0x59c9('0x11')](_0x59c9('0xc'),_0x2e834f,_0x212cf3);_0x262111(_0x212cf3);});});} \ No newline at end of file +var _0x92e2=['info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x92e2,0x13e));var _0x292e=function(_0x2ca2d0,_0x3ea8e4){_0x2ca2d0=_0x2ca2d0-0x0;var _0x521c23=_0x92e2[_0x2ca2d0];return _0x521c23;};'use strict';var _=require(_0x292e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x292e('0x1'));var rs=require(_0x292e('0x2'));var fs=require('fs');var Redis=require(_0x292e('0x3'));var db=require(_0x292e('0x4'))['db'];var utils=require(_0x292e('0x5'));var logger=require(_0x292e('0x6'))(_0x292e('0x7'));var config=require('../../config/environment');var jayson=require(_0x292e('0x8'));var client=jayson[_0x292e('0x9')][_0x292e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x14e0b2,_0x5704f7,_0x4e280e){return new BPromise(function(_0x42009a,_0x584a89){return client[_0x292e('0xb')](_0x14e0b2,_0x4e280e)['then'](function(_0x50f376){logger[_0x292e('0xc')](_0x292e('0xd'),_0x5704f7,_0x292e('0xe'));logger[_0x292e('0xf')](_0x292e('0x10'),_0x5704f7,_0x292e('0xe'),JSON[_0x292e('0x11')](_0x50f376));if(_0x50f376[_0x292e('0x12')]){if(_0x50f376[_0x292e('0x12')][_0x292e('0x13')]===0x1f4){logger[_0x292e('0x12')](_0x292e('0xd'),_0x5704f7,_0x50f376[_0x292e('0x12')][_0x292e('0x14')]);return _0x584a89(_0x50f376[_0x292e('0x12')][_0x292e('0x14')]);}logger['error'](_0x292e('0xd'),_0x5704f7,_0x50f376[_0x292e('0x12')]['message']);return _0x42009a(_0x50f376['error'][_0x292e('0x14')]);}else{logger['info'](_0x292e('0xd'),_0x5704f7,'request\x20sent');_0x42009a(_0x50f376[_0x292e('0x15')][_0x292e('0x14')]);}})['catch'](function(_0x1eb2bc){logger[_0x292e('0x12')](_0x292e('0xd'),_0x5704f7,_0x1eb2bc);_0x584a89(_0x1eb2bc);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 7ac7407..be6bcca 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x2e30f9,_0x1274b0){var _0x53bf16=function(_0x19a921){while(--_0x19a921){_0x2e30f9['push'](_0x2e30f9['shift']());}};_0x53bf16(++_0x1274b0);}(_0xe706,0xa3));var _0x6e70=function(_0x5f20f0,_0x4cfb6d){_0x5f20f0=_0x5f20f0-0x0;var _0x16b5a2=_0xe706[_0x5f20f0];return _0x16b5a2;};'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 +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x51c440,_0x3b6802){var _0x67a2d6=function(_0x3d15ab){while(--_0x3d15ab){_0x51c440['push'](_0x51c440['shift']());}};_0x67a2d6(++_0x3b6802);}(_0x9c44,0x178));var _0x49c4=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x9c44[_0x4fde08];return _0x12e725;};'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/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index a00015b..c074a03 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 _0x2a34=['exports','INTEGER','STRING','sequelize'];(function(_0x541f55,_0x34c13f){var _0x415874=function(_0x10c9e9){while(--_0x10c9e9){_0x541f55['push'](_0x541f55['shift']());}};_0x415874(++_0x34c13f);}(_0x2a34,0x19b));var _0x42a3=function(_0x3e12ca,_0x5247b6){_0x3e12ca=_0x3e12ca-0x0;var _0x42a242=_0x2a34[_0x3e12ca];return _0x42a242;};'use strict';var Sequelize=require(_0x42a3('0x0'));module[_0x42a3('0x1')]={'penalty':{'type':Sequelize[_0x42a3('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x42a3('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x42a3('0x3')]}}; \ No newline at end of file +var _0x5733=['sequelize','INTEGER'];(function(_0x333798,_0x9f6561){var _0x389f4e=function(_0x193b28){while(--_0x193b28){_0x333798['push'](_0x333798['shift']());}};_0x389f4e(++_0x9f6561);}(_0x5733,0x180));var _0x3573=function(_0x25c9e9,_0x15c704){_0x25c9e9=_0x25c9e9-0x0;var _0x2e6cfc=_0x5733[_0x25c9e9];return _0x2e6cfc;};'use strict';var Sequelize=require(_0x3573('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x3573('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x3573('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 1b90e29..c6153bf 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 _0x5276=['../../config/logger','api','bluebird','request-promise','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','util'];(function(_0x333243,_0x2c4c13){var _0x4ecf85=function(_0x22aa50){while(--_0x22aa50){_0x333243['push'](_0x333243['shift']());}};_0x4ecf85(++_0x2c4c13);}(_0x5276,0x16a));var _0x6527=function(_0x233fc5,_0x37596a){_0x233fc5=_0x233fc5-0x0;var _0x59bacb=_0x5276[_0x233fc5];return _0x59bacb;};'use strict';var _=require('lodash');var util=require(_0x6527('0x0'));var logger=require(_0x6527('0x1'))(_0x6527('0x2'));var moment=require('moment');var BPromise=require(_0x6527('0x3'));var rp=require(_0x6527('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6527('0x5'));var config=require('../../config/environment');var attributes=require(_0x6527('0x6'));module[_0x6527('0x7')]=function(_0x4a1ae5,_0xc3e97d){return _0x4a1ae5[_0x6527('0x8')](_0x6527('0x9'),attributes,{'tableName':_0x6527('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5eef=['util','bluebird','request-promise','exports','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x419c0c,_0x2598ad){var _0x391694=function(_0x530772){while(--_0x530772){_0x419c0c['push'](_0x419c0c['shift']());}};_0x391694(++_0x2598ad);}(_0x5eef,0x172));var _0xf5ee=function(_0x58a2cd,_0x7cf5b7){_0x58a2cd=_0x58a2cd-0x0;var _0x4ea4ca=_0x5eef[_0x58a2cd];return _0x4ea4ca;};'use strict';var _=require(_0xf5ee('0x0'));var util=require(_0xf5ee('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xf5ee('0x2'));var rp=require(_0xf5ee('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userFaxQueue.attributes');module[_0xf5ee('0x4')]=function(_0x99c5b2,_0x5e98e9){return _0x99c5b2['define'](_0xf5ee('0x5'),attributes,{'tableName':_0xf5ee('0x6'),'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 dfdf482..231a635 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 _0x909d=['client','http','request','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x909d,0x1f1));var _0xd909=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x909d[_0x456fb1];return _0x4083d6;};'use strict';var _=require(_0xd909('0x0'));var util=require(_0xd909('0x1'));var moment=require(_0xd909('0x2'));var BPromise=require(_0xd909('0x3'));var rs=require(_0xd909('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xd909('0x5'));var logger=require('../../config/logger')(_0xd909('0x6'));var config=require(_0xd909('0x7'));var jayson=require(_0xd909('0x8'));var client=jayson[_0xd909('0x9')][_0xd909('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3850e5,_0x1097b1,_0x2c1394){return new BPromise(function(_0x39fe53,_0x1b15e1){return client[_0xd909('0xb')](_0x3850e5,_0x2c1394)[_0xd909('0xc')](function(_0x12a9b9){logger[_0xd909('0xd')](_0xd909('0xe'),_0x1097b1,'request\x20sent');logger[_0xd909('0xf')](_0xd909('0x10'),_0x1097b1,_0xd909('0x11'),JSON[_0xd909('0x12')](_0x12a9b9));if(_0x12a9b9[_0xd909('0x13')]){if(_0x12a9b9[_0xd909('0x13')]['code']===0x1f4){logger[_0xd909('0x13')](_0xd909('0xe'),_0x1097b1,_0x12a9b9['error']['message']);return _0x1b15e1(_0x12a9b9['error'][_0xd909('0x14')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x1097b1,_0x12a9b9['error'][_0xd909('0x14')]);return _0x39fe53(_0x12a9b9['error'][_0xd909('0x14')]);}else{logger['info']('UserFaxQueue,\x20%s,\x20%s',_0x1097b1,'request\x20sent');_0x39fe53(_0x12a9b9[_0xd909('0x15')]['message']);}})[_0xd909('0x16')](function(_0xd267ea){logger[_0xd909('0x13')](_0xd909('0xe'),_0x1097b1,_0xd267ea);_0x1b15e1(_0xd267ea);});});} \ No newline at end of file +var _0xd9b0=['result','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','UserFaxQueue,\x20%s,\x20%s','request\x20sent','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info'];(function(_0x2e4c9f,_0x31a166){var _0x25a620=function(_0x5e9fdf){while(--_0x5e9fdf){_0x2e4c9f['push'](_0x2e4c9f['shift']());}};_0x25a620(++_0x31a166);}(_0xd9b0,0x188));var _0x0d9b=function(_0x24869e,_0x5d9a14){_0x24869e=_0x24869e-0x0;var _0x183df6=_0xd9b0[_0x24869e];return _0x183df6;};'use strict';var _=require('lodash');var util=require(_0x0d9b('0x0'));var moment=require(_0x0d9b('0x1'));var BPromise=require(_0x0d9b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d9b('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x0d9b('0x4'))(_0x0d9b('0x5'));var config=require(_0x0d9b('0x6'));var jayson=require(_0x0d9b('0x7'));var client=jayson['client'][_0x0d9b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22c07e,_0x35499c,_0x410d03){return new BPromise(function(_0x5ccaff,_0x5a6e12){return client['request'](_0x22c07e,_0x410d03)['then'](function(_0xc11579){logger['info'](_0x0d9b('0x9'),_0x35499c,_0x0d9b('0xa'));logger['debug'](_0x0d9b('0xb'),_0x35499c,_0x0d9b('0xa'),JSON[_0x0d9b('0xc')](_0xc11579));if(_0xc11579['error']){if(_0xc11579[_0x0d9b('0xd')]['code']===0x1f4){logger[_0x0d9b('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x35499c,_0xc11579[_0x0d9b('0xd')][_0x0d9b('0xe')]);return _0x5a6e12(_0xc11579[_0x0d9b('0xd')][_0x0d9b('0xe')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x35499c,_0xc11579[_0x0d9b('0xd')][_0x0d9b('0xe')]);return _0x5ccaff(_0xc11579['error'][_0x0d9b('0xe')]);}else{logger[_0x0d9b('0xf')](_0x0d9b('0x9'),_0x35499c,_0x0d9b('0xa'));_0x5ccaff(_0xc11579[_0x0d9b('0x10')][_0x0d9b('0xe')]);}})['catch'](function(_0x5d10d8){logger[_0x0d9b('0xd')](_0x0d9b('0x9'),_0x35499c,_0x5d10d8);_0x5a6e12(_0x5d10d8);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index ec18e86..22b64ec 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x370dca,_0x5aaf09){var _0x471b05=function(_0x36494e){while(--_0x36494e){_0x370dca['push'](_0x370dca['shift']());}};_0x471b05(++_0x5aaf09);}(_0x70e0,0x17b));var _0x070e=function(_0x5dba6e,_0x59f1bd){_0x5dba6e=_0x5dba6e-0x0;var _0x151b80=_0x70e0[_0x5dba6e];return _0x151b80;};'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(_0x1de357,_0x10512b){var _0x56cd22=function(_0x51dee6){while(--_0x51dee6){_0x1de357['push'](_0x1de357['shift']());}};_0x56cd22(++_0x10512b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 1ac2cc8..6682d95 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 _0xdbf7=['sequelize','exports','INTEGER'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xdbf7,0x8d));var _0x7dbf=function(_0x30720e,_0x55753f){_0x30720e=_0x30720e-0x0;var _0x5674ac=_0xdbf7[_0x30720e];return _0x5674ac;};'use strict';var Sequelize=require(_0x7dbf('0x0'));module[_0x7dbf('0x1')]={'penalty':{'type':Sequelize[_0x7dbf('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xed96=['sequelize','exports'];(function(_0x4acb0e,_0x323101){var _0x44a0ad=function(_0x20cf28){while(--_0x20cf28){_0x4acb0e['push'](_0x4acb0e['shift']());}};_0x44a0ad(++_0x323101);}(_0xed96,0x10e));var _0x6ed9=function(_0x4a6cf8,_0x5534ef){_0x4a6cf8=_0x4a6cf8-0x0;var _0x22205e=_0xed96[_0x4a6cf8];return _0x22205e;};'use strict';var Sequelize=require(_0x6ed9('0x0'));module[_0x6ed9('0x1')]={'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 6edefe4..c1d267b 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 _0xec3a=['./userMailQueue.attributes','user_has_mail_queues','lodash','util','api','moment','request-promise','path'];(function(_0x2f1a76,_0x3b3469){var _0x3c46a9=function(_0x2336e6){while(--_0x2336e6){_0x2f1a76['push'](_0x2f1a76['shift']());}};_0x3c46a9(++_0x3b3469);}(_0xec3a,0x82));var _0xaec3=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0xec3a[_0x455c6c];return _0x488242;};'use strict';var _=require(_0xaec3('0x0'));var util=require(_0xaec3('0x1'));var logger=require('../../config/logger')(_0xaec3('0x2'));var moment=require(_0xaec3('0x3'));var BPromise=require('bluebird');var rp=require(_0xaec3('0x4'));var fs=require('fs');var path=require(_0xaec3('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xaec3('0x6'));module['exports']=function(_0x169638,_0x501b93){return _0x169638['define']('UserMailQueue',attributes,{'tableName':_0xaec3('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf7c3=['bluebird','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','lodash','util','moment'];(function(_0xfb4fd8,_0x516759){var _0x242073=function(_0x3704bd){while(--_0x3704bd){_0xfb4fd8['push'](_0xfb4fd8['shift']());}};_0x242073(++_0x516759);}(_0xf7c3,0xba));var _0x3f7c=function(_0x400406,_0x529b9f){_0x400406=_0x400406-0x0;var _0x1374e3=_0xf7c3[_0x400406];return _0x1374e3;};'use strict';var _=require(_0x3f7c('0x0'));var util=require(_0x3f7c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x3f7c('0x2'));var BPromise=require(_0x3f7c('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x3f7c('0x4'));var config=require(_0x3f7c('0x5'));var attributes=require(_0x3f7c('0x6'));module[_0x3f7c('0x7')]=function(_0xeaa964,_0xf51afe){return _0xeaa964[_0x3f7c('0x8')]('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','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 9228d68..1cfe3ea 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 _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x121fb6,_0x352cb5){var _0x5de21b=function(_0x380164){while(--_0x380164){_0x121fb6['push'](_0x121fb6['shift']());}};_0x5de21b(++_0x352cb5);}(_0x6aa7,0x178));var _0x76aa=function(_0x10ffa3,_0x536569){_0x10ffa3=_0x10ffa3-0x0;var _0x309948=_0x6aa7[_0x10ffa3];return _0x309948;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file +var _0x55ca=['rpc','../../config/environment','jayson/promise','client','http','request','then','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x4323b7,_0x18d4d5){var _0x3d92e4=function(_0x1a9482){while(--_0x1a9482){_0x4323b7['push'](_0x4323b7['shift']());}};_0x3d92e4(++_0x18d4d5);}(_0x55ca,0x126));var _0xa55c=function(_0x269094,_0x4701b3){_0x269094=_0x269094-0x0;var _0x10344f=_0x55ca[_0x269094];return _0x10344f;};'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')]('UserMailQueue,\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')]('UserMailQueue,\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);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 5146bc0..217048d 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 _0x76cb=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./userNotification.controller','post','isAuthenticated'];(function(_0x4fe5a7,_0x147749){var _0x4800ef=function(_0x97c8e8){while(--_0x97c8e8){_0x4fe5a7['push'](_0x4fe5a7['shift']());}};_0x4800ef(++_0x147749);}(_0x76cb,0x9a));var _0xb76c=function(_0x1304c6,_0x6bb485){_0x1304c6=_0x1304c6-0x0;var _0x2e6654=_0x76cb[_0x1304c6];return _0x2e6654;};'use strict';var multer=require(_0xb76c('0x0'));var util=require('util');var path=require(_0xb76c('0x1'));var timeout=require(_0xb76c('0x2'));var express=require(_0xb76c('0x3'));var router=express[_0xb76c('0x4')]();var fs_extra=require(_0xb76c('0x5'));var auth=require(_0xb76c('0x6'));var interaction=require(_0xb76c('0x7'));var config=require('../../config/environment');var controller=require(_0xb76c('0x8'));router[_0xb76c('0x9')]('/',auth[_0xb76c('0xa')](),controller['sendUserNotification']);module['exports']=router; \ No newline at end of file +var _0x4359=['exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./userNotification.controller','post','isAuthenticated','sendUserNotification'];(function(_0x4236a2,_0x5a7dbb){var _0x24f8eb=function(_0x44c65b){while(--_0x44c65b){_0x4236a2['push'](_0x4236a2['shift']());}};_0x24f8eb(++_0x5a7dbb);}(_0x4359,0xb5));var _0x9435=function(_0x29a2c2,_0xcafe3a){_0x29a2c2=_0x29a2c2-0x0;var _0x5d9e9b=_0x4359[_0x29a2c2];return _0x5d9e9b;};'use strict';var multer=require(_0x9435('0x0'));var util=require(_0x9435('0x1'));var path=require(_0x9435('0x2'));var timeout=require(_0x9435('0x3'));var express=require(_0x9435('0x4'));var router=express[_0x9435('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9435('0x6'));var controller=require(_0x9435('0x7'));router[_0x9435('0x8')]('/',auth[_0x9435('0x9')](),controller[_0x9435('0xa')]);module[_0x9435('0xb')]=router; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.attributes.js b/server/api/userNotification/userNotification.attributes.js index e8a07f3..12802f7 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 _0x562b=['TEXT','STRING','exports'];(function(_0x3e7817,_0x287be1){var _0x14e9f2=function(_0x388d51){while(--_0x388d51){_0x3e7817['push'](_0x3e7817['shift']());}};_0x14e9f2(++_0x287be1);}(_0x562b,0x19d));var _0xb562=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0x562b[_0x3d42d8];return _0x27fc41;};'use strict';var Sequelize=require('sequelize');module[_0xb562('0x0')]={'body':{'type':Sequelize[_0xb562('0x1')]},'senderName':{'type':Sequelize[_0xb562('0x2')]},'recipientsId':{'type':Sequelize[_0xb562('0x1')]},'recipientsDescription':{'type':Sequelize[_0xb562('0x2')]},'beep':{'type':Sequelize['BOOLEAN']}}; \ No newline at end of file +var _0xe42e=['BOOLEAN','exports','STRING'];(function(_0x4bb4b1,_0x1959c2){var _0x10a8af=function(_0x3a7534){while(--_0x3a7534){_0x4bb4b1['push'](_0x4bb4b1['shift']());}};_0x10a8af(++_0x1959c2);}(_0xe42e,0xe2));var _0xee42=function(_0x3d7c7b,_0x161a3d){_0x3d7c7b=_0x3d7c7b-0x0;var _0x106c63=_0xe42e[_0x3d7c7b];return _0x106c63;};'use strict';var Sequelize=require('sequelize');module[_0xee42('0x0')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize[_0xee42('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xee42('0x1')]},'beep':{'type':Sequelize[_0xee42('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index 9d1e447..6e4e91a 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 _0x303c=['rimraf','zip-dir','request-promise','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','limit','undefined','count','offset','apply','reject','update','then','destroy','error','name','send','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','isEmpty','recipientsDescription','beep','recipientsId','join','sequelize','transaction','create','forEach','recipient','userNotification:send','findOne','html','Invalid\x20\x27TemplateId\x27\x20parameter','render','catch','startCase','User','union','ids','queue','replace','Queue','all','map','eml-format'];(function(_0xae35cc,_0x36272a){var _0x4244c5=function(_0x8e8344){while(--_0x8e8344){_0xae35cc['push'](_0xae35cc['shift']());}};_0x4244c5(++_0x36272a);}(_0x303c,0x1e4));var _0xc303=function(_0x3b16e1,_0x3bda3e){_0x3b16e1=_0x3b16e1-0x0;var _0x311d1b=_0x303c[_0x3b16e1];return _0x311d1b;};'use strict';var emlformat=require(_0xc303('0x0'));var rimraf=require(_0xc303('0x1'));var zipdir=require(_0xc303('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc303('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xc303('0x4'));var util=require('util');var path=require(_0xc303('0x5'));var sox=require(_0xc303('0x6'));var csv=require('to-csv');var ejs=require(_0xc303('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc303('0x8'));var squel=require(_0xc303('0x9'));var crypto=require(_0xc303('0xa'));var jsforce=require(_0xc303('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xc303('0xc'));var querystring=require(_0xc303('0xd'));var Papa=require(_0xc303('0xe'));var Redis=require(_0xc303('0xf'));var authService=require(_0xc303('0x10'));var qs=require(_0xc303('0x11'));var as=require(_0xc303('0x12'));var hardwareService=require(_0xc303('0x13'));var logger=require('../../config/logger')(_0xc303('0x14'));var utils=require(_0xc303('0x15'));var config=require(_0xc303('0x16'));var licenseUtil=require(_0xc303('0x17'));var db=require(_0xc303('0x18'))['db'];config[_0xc303('0x19')]=_['defaults'](config['redis'],{'host':_0xc303('0x1a'),'port':0x18eb});var socket=require(_0xc303('0x1b'))(new Redis(config[_0xc303('0x19')]));require(_0xc303('0x1c'))[_0xc303('0x1d')](socket);function respondWithStatusCode(_0x152ca9,_0x57ebfa){_0x57ebfa=_0x57ebfa||0xcc;return function(_0x43d2f9){if(_0x43d2f9){return _0x152ca9[_0xc303('0x1e')](_0x57ebfa);}return _0x152ca9[_0xc303('0x1f')](_0x57ebfa)[_0xc303('0x20')]();};}function respondWithResult(_0x141001,_0x56e62f){_0x56e62f=_0x56e62f||0xc8;return function(_0xab1105){if(_0xab1105){return _0x141001['status'](_0x56e62f)[_0xc303('0x21')](_0xab1105);}};}function respondWithFilteredResult(_0x5e9249,_0x5024b9){return function(_0x4fa116){if(_0x4fa116){var _0x454a7d=typeof _0x5024b9['offset']==='undefined'&&typeof _0x5024b9[_0xc303('0x22')]===_0xc303('0x23');var _0x1eb5c6=_0x4fa116['count'];var _0x4a1500=_0x454a7d?0x0:_0x5024b9['offset'];var _0x342b99=_0x454a7d?_0x4fa116[_0xc303('0x24')]:_0x5024b9[_0xc303('0x25')]+_0x5024b9[_0xc303('0x22')];var _0x5ba14b;if(_0x342b99>=_0x1eb5c6){_0x342b99=_0x1eb5c6;_0x5ba14b=0xc8;}else{_0x5ba14b=0xce;}_0x5e9249[_0xc303('0x1f')](_0x5ba14b);return _0x5e9249['set']('Content-Range',_0x4a1500+'-'+_0x342b99+'/'+_0x1eb5c6)[_0xc303('0x21')](_0x4fa116);}return null;};}function patchUpdates(_0x2215eb){return function(_0x4d9bde){try{jsonpatch[_0xc303('0x26')](_0x4d9bde,_0x2215eb,!![]);}catch(_0x4a75ab){return BPromise[_0xc303('0x27')](_0x4a75ab);}return _0x4d9bde['save']();};}function saveUpdates(_0x586703,_0x52e4a5){return function(_0x6b48e3){if(_0x6b48e3){return _0x6b48e3[_0xc303('0x28')](_0x586703)[_0xc303('0x29')](function(_0x23bc61){return _0x23bc61;});}return null;};}function removeEntity(_0x2b4b13,_0x259f53){return function(_0x4db4ad){if(_0x4db4ad){return _0x4db4ad[_0xc303('0x2a')]()[_0xc303('0x29')](function(){_0x2b4b13[_0xc303('0x1f')](0xcc)[_0xc303('0x20')]();});}};}function handleEntityNotFound(_0x3fe24c,_0x11a059){return function(_0x53125a){if(!_0x53125a){_0x3fe24c[_0xc303('0x1e')](0x194);}return _0x53125a;};}function handleError(_0x394c1f,_0x5aaef7){_0x5aaef7=_0x5aaef7||0x1f4;return function(_0x3047b2){logger[_0xc303('0x2b')](_0x3047b2['stack']);if(_0x3047b2[_0xc303('0x2c')]){delete _0x3047b2[_0xc303('0x2c')];}_0x394c1f[_0xc303('0x1f')](_0x5aaef7)[_0xc303('0x2d')](_0x3047b2);};}exports['sendUserNotification']=function(_0x23f40e,_0x1807e0,_0x3d72f3){if(!_0x23f40e[_0xc303('0x2e')][_0xc303('0x2f')](_0xc303('0x30'))&&!_0x23f40e[_0xc303('0x2e')][_0xc303('0x2f')](_0xc303('0x31'))){throw new db[(_0xc303('0x32'))][(_0xc303('0x33'))](_0xc303('0x34'));}else{if(_0x23f40e['body'][_0xc303('0x2f')]('TemplateId')&&!_0x23f40e[_0xc303('0x2e')][_0xc303('0x2f')](_0xc303('0x35'))){throw new db[(_0xc303('0x32'))][(_0xc303('0x33'))](_0xc303('0x36'));}if(!_0x23f40e[_0xc303('0x2e')][_0xc303('0x2f')](_0xc303('0x37'))){throw new db[(_0xc303('0x32'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x5c80b2=JSON[_0xc303('0x38')](_0x23f40e['body'][_0xc303('0x37')]);}catch(_0x59c5a9){logger['error'](_0x59c5a9);throw new db[(_0xc303('0x32'))]['ValidationError'](_0xc303('0x39'));}var _0x18e4e1=[_0xc303('0x3a'),_0xc303('0x3b'),_0xc303('0x3c'),_0xc303('0x3d'),_0xc303('0x3e'),_0xc303('0x3f'),_0xc303('0x40'),_0xc303('0x41'),_0xc303('0x42')];if(_[_0xc303('0x43')](_0x5c80b2,function(_0x15a9c8){return!_['includes'](_0x18e4e1,_0x15a9c8[_0xc303('0x44')][_0xc303('0x45')]());})){throw new db[(_0xc303('0x32'))][(_0xc303('0x33'))](_0xc303('0x46'));}}}var _0x40ff5c={};_0x40ff5c[_0xc303('0x47')]=_0x23f40e[_0xc303('0x2e')][_0xc303('0x2f')](_0xc303('0x47'))?_0x23f40e['body'][_0xc303('0x47')]:_0x23f40e[_0xc303('0x42')]['fullname'];_0x40ff5c['recipientsDescription']=_[_0xc303('0x48')](_0x23f40e[_0xc303('0x2e')]['recipientsDescription'])?null:_0x23f40e[_0xc303('0x2e')][_0xc303('0x49')];_0x40ff5c[_0xc303('0x4a')]=_0x23f40e['body'][_0xc303('0x4a')]||![];_0x40ff5c['SenderId']=_0x23f40e[_0xc303('0x42')]['id'];return getContent(_0x23f40e['body'])[_0xc303('0x29')](function(_0x28b4a4){_0x40ff5c[_0xc303('0x2e')]=_0x28b4a4;return getRecipients(_0x5c80b2);})[_0xc303('0x29')](function(_0x101630){_0x40ff5c[_0xc303('0x4b')]=_['sortBy'](_0x101630)[_0xc303('0x4c')](',');return db[_0xc303('0x4d')][_0xc303('0x4e')](function(_0x4a080e){return db['UserNotification'][_0xc303('0x4f')](_0x40ff5c,{'raw':!![],'transaction':_0x4a080e})[_0xc303('0x29')](function(_0x566bac){var _0xd46146={'sender':_0x40ff5c[_0xc303('0x47')],'description':_0x40ff5c['recipientsDescription'],'content':_0x40ff5c['body'],'beep':_0x40ff5c[_0xc303('0x4a')]};_0x101630[_0xc303('0x50')](function(_0x484cb5){_0xd46146[_0xc303('0x51')]=_0x484cb5;socket['emit'](_0xc303('0x52'),_0xd46146);});return _0x566bac;});});})[_0xc303('0x29')](respondWithResult(_0x1807e0,0xc9))['catch'](handleError(_0x1807e0,null));};function getContent(_0x1b2fb4){return new BPromise(function(_0x117f71,_0x372f8b){if(_0x1b2fb4[_0xc303('0x30')]){_0x117f71(_0x1b2fb4[_0xc303('0x30')]);return;}return db['Template'][_0xc303('0x53')]({'attributes':[_0xc303('0x54')],'where':{'id':_0x1b2fb4[_0xc303('0x31')]},'raw':!![]})['then'](function(_0x1d58e4){if(!_0x1d58e4)throw new db['Sequelize'][(_0xc303('0x33'))](_0xc303('0x55'));var _0x2f6421=Mustache[_0xc303('0x56')](_0x1d58e4['html'],_0x1b2fb4[_0xc303('0x35')]);_0x117f71(_0x2f6421);})[_0xc303('0x57')](function(_0x40c037){_0x372f8b(_0x40c037);});});}function getRecipients(_0x129b48){return new BPromise(function(_0x3e3d1c,_0x39268d){var _0x2fac34=[];var _0x1ddc97=[];_0x129b48[_0xc303('0x50')](function(_0x33e3d6){var _0x512f0d=_[_0xc303('0x58')](_0x33e3d6['model']['toLowerCase']());if(_0x512f0d===_0xc303('0x59')){_0x2fac34=_[_0xc303('0x5a')](_0x2fac34,_0x33e3d6[_0xc303('0x5b')]);}else{if(_['includes'](_0x512f0d,_0xc303('0x5c')))_0x512f0d=_0x512f0d[_0xc303('0x5d')](_0xc303('0x5c'),_0xc303('0x5e'));_0x33e3d6[_0xc303('0x5b')][_0xc303('0x50')](function(_0x549d2b){_0x1ddc97['push'](getAgents(_0x512f0d,_0x549d2b));});}});return BPromise[_0xc303('0x5f')](_0x1ddc97)[_0xc303('0x29')](function(_0x1b67dc){_0x2fac34=_['union'](_0x2fac34,_['flatten'](_0x1b67dc));_0x3e3d1c(_0x2fac34);})[_0xc303('0x57')](function(_0x34582c){_0x39268d(_0x34582c);});});}function getAgents(_0x36b004,_0x4fd236){return new BPromise(function(_0x493ea9,_0x382938){return db[_0x36b004][_0xc303('0x53')]({'where':{'id':_0x4fd236}})['then'](function(_0x1c5098){return _0x1c5098['getAgents']({'attributes':['id'],'raw':!![]})[_0xc303('0x29')](function(_0x455d4d){var _0x2f7990=_[_0xc303('0x60')](_0x455d4d,'id');_0x493ea9(_0x2f7990);});})[_0xc303('0x57')](function(_0x5d5c8c){_0x382938(_0x5d5c8c);});});} \ No newline at end of file +var _0x48ee=['html','Invalid\x20\x27TemplateId\x27\x20parameter','startCase','union','ids','queue','replace','Queue','push','all','flatten','getAgents','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','./userNotification.socket','register','status','end','json','undefined','limit','count','offset','set','save','update','then','destroy','sendStatus','error','name','body','hasOwnProperty','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','TemplateId','view','Missing\x20\x27view\x27\x20parameter','recipients','Sequelize','Missing\x20\x27recipients\x27\x20parameter','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','whatsappqueue','team','user','some','includes','model','toLowerCase','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','sequelize','transaction','UserNotification','create','forEach','recipient','emit','catch','text','Template','findOne'];(function(_0xe575ed,_0x577854){var _0x4850a0=function(_0x4ddd26){while(--_0x4ddd26){_0xe575ed['push'](_0xe575ed['shift']());}};_0x4850a0(++_0x577854);}(_0x48ee,0x191));var _0xe48e=function(_0x33e34d,_0x4ae89d){_0x33e34d=_0x33e34d-0x0;var _0x244967=_0x48ee[_0x33e34d];return _0x244967;};'use strict';var emlformat=require(_0xe48e('0x0'));var rimraf=require(_0xe48e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe48e('0x2'));var rp=require(_0xe48e('0x3'));var moment=require(_0xe48e('0x4'));var BPromise=require(_0xe48e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe48e('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe48e('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe48e('0x8'));var squel=require(_0xe48e('0x9'));var crypto=require(_0xe48e('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xe48e('0xb'));var querystring=require(_0xe48e('0xc'));var Papa=require(_0xe48e('0xd'));var Redis=require(_0xe48e('0xe'));var authService=require(_0xe48e('0xf'));var qs=require(_0xe48e('0x10'));var as=require(_0xe48e('0x11'));var hardwareService=require(_0xe48e('0x12'));var logger=require(_0xe48e('0x13'))(_0xe48e('0x14'));var utils=require(_0xe48e('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xe48e('0x16')]=_[_0xe48e('0x17')](config[_0xe48e('0x16')],{'host':_0xe48e('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe48e('0x19'))[_0xe48e('0x1a')](socket);function respondWithStatusCode(_0x51aed7,_0x141461){_0x141461=_0x141461||0xcc;return function(_0x2b43ee){if(_0x2b43ee){return _0x51aed7['sendStatus'](_0x141461);}return _0x51aed7[_0xe48e('0x1b')](_0x141461)[_0xe48e('0x1c')]();};}function respondWithResult(_0x4f966c,_0x4b664b){_0x4b664b=_0x4b664b||0xc8;return function(_0xd69950){if(_0xd69950){return _0x4f966c[_0xe48e('0x1b')](_0x4b664b)[_0xe48e('0x1d')](_0xd69950);}};}function respondWithFilteredResult(_0x4c37d9,_0x2a331b){return function(_0x483f45){if(_0x483f45){var _0x39caa1=typeof _0x2a331b['offset']===_0xe48e('0x1e')&&typeof _0x2a331b[_0xe48e('0x1f')]===_0xe48e('0x1e');var _0x5c9f7f=_0x483f45[_0xe48e('0x20')];var _0x19ba4b=_0x39caa1?0x0:_0x2a331b[_0xe48e('0x21')];var _0x348757=_0x39caa1?_0x483f45['count']:_0x2a331b[_0xe48e('0x21')]+_0x2a331b[_0xe48e('0x1f')];var _0x3a3ac4;if(_0x348757>=_0x5c9f7f){_0x348757=_0x5c9f7f;_0x3a3ac4=0xc8;}else{_0x3a3ac4=0xce;}_0x4c37d9['status'](_0x3a3ac4);return _0x4c37d9[_0xe48e('0x22')]('Content-Range',_0x19ba4b+'-'+_0x348757+'/'+_0x5c9f7f)[_0xe48e('0x1d')](_0x483f45);}return null;};}function patchUpdates(_0x384166){return function(_0x1ccae9){try{jsonpatch['apply'](_0x1ccae9,_0x384166,!![]);}catch(_0x2d0b5c){return BPromise['reject'](_0x2d0b5c);}return _0x1ccae9[_0xe48e('0x23')]();};}function saveUpdates(_0xca8e07,_0x554c12){return function(_0x278746){if(_0x278746){return _0x278746[_0xe48e('0x24')](_0xca8e07)[_0xe48e('0x25')](function(_0x295d2d){return _0x295d2d;});}return null;};}function removeEntity(_0x206bc4,_0x423666){return function(_0x1cce60){if(_0x1cce60){return _0x1cce60[_0xe48e('0x26')]()['then'](function(){_0x206bc4['status'](0xcc)[_0xe48e('0x1c')]();});}};}function handleEntityNotFound(_0x806603,_0x452927){return function(_0x5289e9){if(!_0x5289e9){_0x806603[_0xe48e('0x27')](0x194);}return _0x5289e9;};}function handleError(_0x3029d1,_0x3598ac){_0x3598ac=_0x3598ac||0x1f4;return function(_0x2e1b40){logger[_0xe48e('0x28')](_0x2e1b40['stack']);if(_0x2e1b40[_0xe48e('0x29')]){delete _0x2e1b40['name'];}_0x3029d1['status'](_0x3598ac)['send'](_0x2e1b40);};}exports['sendUserNotification']=function(_0x5c16da,_0x3bd03c,_0x4560c5){if(!_0x5c16da[_0xe48e('0x2a')]['hasOwnProperty']('text')&&!_0x5c16da['body'][_0xe48e('0x2b')]('TemplateId')){throw new db['Sequelize'][(_0xe48e('0x2c'))](_0xe48e('0x2d'));}else{if(_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x2b')](_0xe48e('0x2e'))&&!_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x2b')](_0xe48e('0x2f'))){throw new db['Sequelize'][(_0xe48e('0x2c'))](_0xe48e('0x30'));}if(!_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x2b')](_0xe48e('0x31'))){throw new db[(_0xe48e('0x32'))]['ValidationError'](_0xe48e('0x33'));}else{try{var _0x1a9918=JSON['parse'](_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x31')]);}catch(_0x1042ff){logger['error'](_0x1042ff);throw new db[(_0xe48e('0x32'))][(_0xe48e('0x2c'))](_0xe48e('0x34'));}var _0x87db71=[_0xe48e('0x35'),_0xe48e('0x36'),_0xe48e('0x37'),'openchannelqueue',_0xe48e('0x38'),_0xe48e('0x39'),_0xe48e('0x3a'),_0xe48e('0x3b'),_0xe48e('0x3c')];if(_[_0xe48e('0x3d')](_0x1a9918,function(_0x478123){return!_[_0xe48e('0x3e')](_0x87db71,_0x478123[_0xe48e('0x3f')][_0xe48e('0x40')]());})){throw new db[(_0xe48e('0x32'))][(_0xe48e('0x2c'))]('Invalid\x20model\x20in\x20\x27recipients\x27\x20object');}}}var _0x493910={};_0x493910[_0xe48e('0x41')]=_0x5c16da['body']['hasOwnProperty']('senderName')?_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x41')]:_0x5c16da[_0xe48e('0x3c')]['fullname'];_0x493910[_0xe48e('0x42')]=_[_0xe48e('0x43')](_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x42')])?null:_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x42')];_0x493910[_0xe48e('0x44')]=_0x5c16da[_0xe48e('0x2a')][_0xe48e('0x44')]||![];_0x493910[_0xe48e('0x45')]=_0x5c16da[_0xe48e('0x3c')]['id'];return getContent(_0x5c16da['body'])[_0xe48e('0x25')](function(_0x4cf72f){_0x493910[_0xe48e('0x2a')]=_0x4cf72f;return getRecipients(_0x1a9918);})[_0xe48e('0x25')](function(_0x2bb762){_0x493910[_0xe48e('0x46')]=_[_0xe48e('0x47')](_0x2bb762)[_0xe48e('0x48')](',');return db[_0xe48e('0x49')][_0xe48e('0x4a')](function(_0x11d79){return db[_0xe48e('0x4b')][_0xe48e('0x4c')](_0x493910,{'raw':!![],'transaction':_0x11d79})[_0xe48e('0x25')](function(_0x466f47){var _0x15767c={'sender':_0x493910[_0xe48e('0x41')],'description':_0x493910[_0xe48e('0x42')],'content':_0x493910[_0xe48e('0x2a')],'beep':_0x493910[_0xe48e('0x44')]};_0x2bb762[_0xe48e('0x4d')](function(_0x30c028){_0x15767c[_0xe48e('0x4e')]=_0x30c028;socket[_0xe48e('0x4f')]('userNotification:send',_0x15767c);});return _0x466f47;});});})['then'](respondWithResult(_0x3bd03c,0xc9))[_0xe48e('0x50')](handleError(_0x3bd03c,null));};function getContent(_0x73a1bc){return new BPromise(function(_0x411394,_0x7cc71e){if(_0x73a1bc['text']){_0x411394(_0x73a1bc[_0xe48e('0x51')]);return;}return db[_0xe48e('0x52')][_0xe48e('0x53')]({'attributes':[_0xe48e('0x54')],'where':{'id':_0x73a1bc[_0xe48e('0x2e')]},'raw':!![]})[_0xe48e('0x25')](function(_0x58ed0f){if(!_0x58ed0f)throw new db[(_0xe48e('0x32'))][(_0xe48e('0x2c'))](_0xe48e('0x55'));var _0x56c3f8=Mustache['render'](_0x58ed0f['html'],_0x73a1bc['view']);_0x411394(_0x56c3f8);})[_0xe48e('0x50')](function(_0x302071){_0x7cc71e(_0x302071);});});}function getRecipients(_0x3b0a75){return new BPromise(function(_0x3dad77,_0x5350ae){var _0x226d9=[];var _0x3a2ee1=[];_0x3b0a75[_0xe48e('0x4d')](function(_0x17afdf){var _0x7e67dc=_[_0xe48e('0x56')](_0x17afdf[_0xe48e('0x3f')][_0xe48e('0x40')]());if(_0x7e67dc==='User'){_0x226d9=_[_0xe48e('0x57')](_0x226d9,_0x17afdf[_0xe48e('0x58')]);}else{if(_[_0xe48e('0x3e')](_0x7e67dc,_0xe48e('0x59')))_0x7e67dc=_0x7e67dc[_0xe48e('0x5a')](_0xe48e('0x59'),_0xe48e('0x5b'));_0x17afdf[_0xe48e('0x58')][_0xe48e('0x4d')](function(_0x10836c){_0x3a2ee1[_0xe48e('0x5c')](getAgents(_0x7e67dc,_0x10836c));});}});return BPromise[_0xe48e('0x5d')](_0x3a2ee1)['then'](function(_0x2bb1b0){_0x226d9=_[_0xe48e('0x57')](_0x226d9,_[_0xe48e('0x5e')](_0x2bb1b0));_0x3dad77(_0x226d9);})[_0xe48e('0x50')](function(_0x66c36e){_0x5350ae(_0x66c36e);});});}function getAgents(_0x3932c5,_0x1f9aa3){return new BPromise(function(_0x391a9b,_0x3d6c08){return db[_0x3932c5][_0xe48e('0x53')]({'where':{'id':_0x1f9aa3}})[_0xe48e('0x25')](function(_0x48235c){return _0x48235c[_0xe48e('0x5f')]({'attributes':['id'],'raw':!![]})[_0xe48e('0x25')](function(_0x40f4ae){var _0x1d1a9c=_[_0xe48e('0x60')](_0x40f4ae,'id');_0x391a9b(_0x1d1a9c);});})['catch'](function(_0x321f11){_0x3d6c08(_0x321f11);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 2e5e72a..00c096f 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 _0xcf23=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb','UserNotification'];(function(_0x2483e2,_0x348234){var _0x40d853=function(_0x541597){while(--_0x541597){_0x2483e2['push'](_0x2483e2['shift']());}};_0x40d853(++_0x348234);}(_0xcf23,0xf9));var _0x3cf2=function(_0x4e2e7a,_0x4631a2){_0x4e2e7a=_0x4e2e7a-0x0;var _0x289ba9=_0xcf23[_0x4e2e7a];return _0x289ba9;};'use strict';var EventEmitter=require(_0x3cf2('0x0'));var UserNotification=require(_0x3cf2('0x1'))['db'][_0x3cf2('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x3cf2('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x3cf2('0x4'),'afterDestroy':_0x3cf2('0x5')};function emitEvent(_0x5eec70){return function(_0x1bc186,_0x4f7255,_0x25cee1){UserNotificationEvents['emit'](_0x5eec70+':'+_0x1bc186['id'],_0x1bc186);UserNotificationEvents[_0x3cf2('0x6')](_0x5eec70,_0x1bc186);_0x25cee1(null);};}for(var e in events){if(events[_0x3cf2('0x7')](e)){var event=events[e];UserNotification[_0x3cf2('0x8')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file +var _0x5ca4=['../../mysqldb','UserNotification','setMaxListeners','remove','hook'];(function(_0x458dd7,_0xe5602b){var _0x2a12f3=function(_0x547dee){while(--_0x547dee){_0x458dd7['push'](_0x458dd7['shift']());}};_0x2a12f3(++_0xe5602b);}(_0x5ca4,0x1a9));var _0x45ca=function(_0xc6c9ce,_0x47b96b){_0xc6c9ce=_0xc6c9ce-0x0;var _0x152be9=_0x5ca4[_0xc6c9ce];return _0x152be9;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x45ca('0x0'))['db'][_0x45ca('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x45ca('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x45ca('0x3')};function emitEvent(_0x372ce7){return function(_0x51e8ee,_0x49759a,_0xbc2d6f){UserNotificationEvents['emit'](_0x372ce7+':'+_0x51e8ee['id'],_0x51e8ee);UserNotificationEvents['emit'](_0x372ce7,_0x51e8ee);_0xbc2d6f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x45ca('0x4')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index e350cb8..fbd815b 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 _0xbb6a=['utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','userNotifications'];(function(_0x4a1c3d,_0xa4655c){var _0x1a403c=function(_0xc74904){while(--_0xc74904){_0x4a1c3d['push'](_0x4a1c3d['shift']());}};_0x1a403c(++_0xa4655c);}(_0xbb6a,0x76));var _0xabb6=function(_0x24e8db,_0x89fc47){_0x24e8db=_0x24e8db-0x0;var _0x576cc1=_0xbb6a[_0x24e8db];return _0x576cc1;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xabb6('0x0'))(_0xabb6('0x1'));var moment=require(_0xabb6('0x2'));var BPromise=require(_0xabb6('0x3'));var rp=require(_0xabb6('0x4'));var fs=require('fs');var path=require(_0xabb6('0x5'));var rimraf=require(_0xabb6('0x6'));var config=require(_0xabb6('0x7'));var attributes=require(_0xabb6('0x8'));module[_0xabb6('0x9')]=function(_0x193ff5,_0x6f129d){return _0x193ff5[_0xabb6('0xa')]('UserNotification',attributes,{'tableName':_0xabb6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xabb6('0xc')});}; \ No newline at end of file +var _0x6a40=['../../config/environment','./userNotification.attributes','exports','userNotifications','utf8mb4','lodash','../../config/logger','api','moment','request-promise','rimraf'];(function(_0x131bf8,_0x182d28){var _0x743556=function(_0x3ccf59){while(--_0x3ccf59){_0x131bf8['push'](_0x131bf8['shift']());}};_0x743556(++_0x182d28);}(_0x6a40,0x1a7));var _0x06a4=function(_0xdb72a0,_0x3e7b6c){_0xdb72a0=_0xdb72a0-0x0;var _0x4119e5=_0x6a40[_0xdb72a0];return _0x4119e5;};'use strict';var _=require(_0x06a4('0x0'));var util=require('util');var logger=require(_0x06a4('0x1'))(_0x06a4('0x2'));var moment=require(_0x06a4('0x3'));var BPromise=require('bluebird');var rp=require(_0x06a4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x06a4('0x5'));var config=require(_0x06a4('0x6'));var attributes=require(_0x06a4('0x7'));module[_0x06a4('0x8')]=function(_0x368276,_0x1c4f85){return _0x368276['define']('UserNotification',attributes,{'tableName':_0x06a4('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x06a4('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 2132631..7b50f7c 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 _0x3473=['bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./userNotification.socket','request','then','info','request\x20sent','stringify','error','code','UserNotification,\x20%s,\x20%s','message','catch','lodash','util','moment'];(function(_0x3fbfe4,_0x249f5a){var _0xb79447=function(_0x4ce489){while(--_0x4ce489){_0x3fbfe4['push'](_0x3fbfe4['shift']());}};_0xb79447(++_0x249f5a);}(_0x3473,0x9f));var _0x3347=function(_0x17788a,_0x150887){_0x17788a=_0x17788a-0x0;var _0x33f47c=_0x3473[_0x17788a];return _0x33f47c;};'use strict';var _=require(_0x3347('0x0'));var util=require(_0x3347('0x1'));var moment=require(_0x3347('0x2'));var BPromise=require(_0x3347('0x3'));var rs=require(_0x3347('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3347('0x5'))['db'];var utils=require(_0x3347('0x6'));var logger=require(_0x3347('0x7'))(_0x3347('0x8'));var config=require('../../config/environment');var jayson=require(_0x3347('0x9'));var client=jayson[_0x3347('0xa')][_0x3347('0xb')]({'port':0x232a});config['redis']=_[_0x3347('0xc')](config[_0x3347('0xd')],{'host':_0x3347('0xe'),'port':0x18eb});var socket=require(_0x3347('0xf'))(new Redis(config['redis']));require(_0x3347('0x10'))['register'](socket);function respondWithRpcPromise(_0x29ef71,_0x572958,_0x57073c){return new BPromise(function(_0x56a02a,_0x51d630){return client[_0x3347('0x11')](_0x29ef71,_0x57073c)[_0x3347('0x12')](function(_0x554f3f){logger[_0x3347('0x13')]('UserNotification,\x20%s,\x20%s',_0x572958,'request\x20sent');logger['debug']('UserNotification,\x20%s,\x20%s,\x20%s',_0x572958,_0x3347('0x14'),JSON[_0x3347('0x15')](_0x554f3f));if(_0x554f3f[_0x3347('0x16')]){if(_0x554f3f[_0x3347('0x16')][_0x3347('0x17')]===0x1f4){logger[_0x3347('0x16')](_0x3347('0x18'),_0x572958,_0x554f3f['error'][_0x3347('0x19')]);return _0x51d630(_0x554f3f[_0x3347('0x16')][_0x3347('0x19')]);}logger[_0x3347('0x16')](_0x3347('0x18'),_0x572958,_0x554f3f['error'][_0x3347('0x19')]);return _0x56a02a(_0x554f3f[_0x3347('0x16')][_0x3347('0x19')]);}else{logger[_0x3347('0x13')](_0x3347('0x18'),_0x572958,'request\x20sent');_0x56a02a(_0x554f3f['result'][_0x3347('0x19')]);}})[_0x3347('0x1a')](function(_0x3bf705){logger['error']('UserNotification,\x20%s,\x20%s',_0x572958,_0x3bf705);_0x51d630(_0x3bf705);});});} \ No newline at end of file +var _0x20cb=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./userNotification.socket','register','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3b918b,_0x2edc55){var _0x57d988=function(_0x1a4463){while(--_0x1a4463){_0x3b918b['push'](_0x3b918b['shift']());}};_0x57d988(++_0x2edc55);}(_0x20cb,0xd5));var _0xb20c=function(_0x1aa082,_0x386639){_0x1aa082=_0x1aa082-0x0;var _0x5c3cc2=_0x20cb[_0x1aa082];return _0x5c3cc2;};'use strict';var _=require(_0xb20c('0x0'));var util=require(_0xb20c('0x1'));var moment=require(_0xb20c('0x2'));var BPromise=require(_0xb20c('0x3'));var rs=require(_0xb20c('0x4'));var fs=require('fs');var Redis=require(_0xb20c('0x5'));var db=require(_0xb20c('0x6'))['db'];var utils=require(_0xb20c('0x7'));var logger=require(_0xb20c('0x8'))(_0xb20c('0x9'));var config=require(_0xb20c('0xa'));var jayson=require(_0xb20c('0xb'));var client=jayson[_0xb20c('0xc')][_0xb20c('0xd')]({'port':0x232a});config[_0xb20c('0xe')]=_[_0xb20c('0xf')](config['redis'],{'host':_0xb20c('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb20c('0xe')]));require(_0xb20c('0x11'))[_0xb20c('0x12')](socket);function respondWithRpcPromise(_0x43db60,_0x479f43,_0x3dc0b5){return new BPromise(function(_0x2a43db,_0x266936){return client['request'](_0x43db60,_0x3dc0b5)[_0xb20c('0x13')](function(_0x48aa0f){logger['info'](_0xb20c('0x14'),_0x479f43,_0xb20c('0x15'));logger[_0xb20c('0x16')](_0xb20c('0x17'),_0x479f43,'request\x20sent',JSON[_0xb20c('0x18')](_0x48aa0f));if(_0x48aa0f[_0xb20c('0x19')]){if(_0x48aa0f[_0xb20c('0x19')][_0xb20c('0x1a')]===0x1f4){logger[_0xb20c('0x19')]('UserNotification,\x20%s,\x20%s',_0x479f43,_0x48aa0f['error'][_0xb20c('0x1b')]);return _0x266936(_0x48aa0f[_0xb20c('0x19')][_0xb20c('0x1b')]);}logger[_0xb20c('0x19')](_0xb20c('0x14'),_0x479f43,_0x48aa0f['error'][_0xb20c('0x1b')]);return _0x2a43db(_0x48aa0f[_0xb20c('0x19')][_0xb20c('0x1b')]);}else{logger['info'](_0xb20c('0x14'),_0x479f43,_0xb20c('0x15'));_0x2a43db(_0x48aa0f[_0xb20c('0x1c')][_0xb20c('0x1b')]);}})[_0xb20c('0x1d')](function(_0x3543d9){logger['error']('UserNotification,\x20%s,\x20%s',_0x479f43,_0x3543d9);_0x266936(_0x3543d9);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index d516139..b1287be 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 _0xcd09=['length','userNotification:','./userNotification.events','save','remove','update','emit','removeListener','register'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xcd09,0xa4));var _0x9cd0=function(_0xdb810a,_0x3007f8){_0xdb810a=_0xdb810a-0x0;var _0x3954ba=_0xcd09[_0xdb810a];return _0x3954ba;};'use strict';var UserNotificationEvents=require(_0x9cd0('0x0'));var events=[_0x9cd0('0x1'),_0x9cd0('0x2'),_0x9cd0('0x3')];function createListener(_0xeb350a,_0x4608b7){return function(_0x1137f3){_0x4608b7[_0x9cd0('0x4')](_0xeb350a,_0x1137f3);};}function removeListener(_0x201b7d,_0x218e32){return function(){UserNotificationEvents[_0x9cd0('0x5')](_0x201b7d,_0x218e32);};}exports[_0x9cd0('0x6')]=function(_0x243715){for(var _0x3f97fb=0x0,_0x139eae=events[_0x9cd0('0x7')];_0x3f97fb<_0x139eae;_0x3f97fb++){var _0x41203e=events[_0x3f97fb];var _0x2a01ac=createListener(_0x9cd0('0x8')+_0x41203e,_0x243715);UserNotificationEvents['on'](_0x41203e,_0x2a01ac);}}; \ No newline at end of file +var _0x3755=['removeListener','length','./userNotification.events','save','remove','update','emit'];(function(_0x2a45a2,_0x1f36fb){var _0x2c2639=function(_0x1f8623){while(--_0x1f8623){_0x2a45a2['push'](_0x2a45a2['shift']());}};_0x2c2639(++_0x1f36fb);}(_0x3755,0x1bb));var _0x5375=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x3755[_0x2f5ac5];return _0x37c9a8;};'use strict';var UserNotificationEvents=require(_0x5375('0x0'));var events=[_0x5375('0x1'),_0x5375('0x2'),_0x5375('0x3')];function createListener(_0x55ce82,_0x3330f5){return function(_0x5789db){_0x3330f5[_0x5375('0x4')](_0x55ce82,_0x5789db);};}function removeListener(_0x34aaec,_0x26c911){return function(){UserNotificationEvents[_0x5375('0x5')](_0x34aaec,_0x26c911);};}exports['register']=function(_0xf7d823){for(var _0x97e569=0x0,_0x343094=events[_0x5375('0x6')];_0x97e569<_0x343094;_0x97e569++){var _0x3374f4=events[_0x97e569];var _0x28330a=createListener('userNotification:'+_0x3374f4,_0xf7d823);UserNotificationEvents['on'](_0x3374f4,_0x28330a);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 2e280f2..2a4300c 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5c50de,_0x248df5){var _0x39861f=function(_0x3dcc0b){while(--_0x3dcc0b){_0x5c50de['push'](_0x5c50de['shift']());}};_0x39861f(++_0x248df5);}(_0x70e0,0x17b));var _0x070e=function(_0x354c3c,_0x21a05f){_0x354c3c=_0x354c3c-0x0;var _0x4070ed=_0x70e0[_0x354c3c];return _0x4070ed;};'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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x36e963,_0x61d1f9){var _0x5e4971=function(_0x1d1eeb){while(--_0x1d1eeb){_0x36e963['push'](_0x36e963['shift']());}};_0x5e4971(++_0x61d1f9);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index fba1479..55ab5b4 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 _0xa88d=['INTEGER','sequelize'];(function(_0x1c2478,_0x466bf3){var _0x36c4af=function(_0x3b3541){while(--_0x3b3541){_0x1c2478['push'](_0x1c2478['shift']());}};_0x36c4af(++_0x466bf3);}(_0xa88d,0x179));var _0xda88=function(_0x1b173a,_0x34265f){_0x1b173a=_0x1b173a-0x0;var _0x42346f=_0xa88d[_0x1b173a];return _0x42346f;};'use strict';var Sequelize=require(_0xda88('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xda88('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9ce8=['INTEGER','sequelize'];(function(_0x35eb5b,_0x271615){var _0xaf0396=function(_0x4c7259){while(--_0x4c7259){_0x35eb5b['push'](_0x35eb5b['shift']());}};_0xaf0396(++_0x271615);}(_0x9ce8,0x163));var _0x89ce=function(_0x43b584,_0x20a6bd){_0x43b584=_0x43b584-0x0;var _0x48f27b=_0x9ce8[_0x43b584];return _0x48f27b;};'use strict';var Sequelize=require(_0x89ce('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x89ce('0x1')],'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 8004f4e..a34e785 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 _0x957f=['path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x56a161,_0x29b2ab){var _0x93fe3a=function(_0x4b97c5){while(--_0x4b97c5){_0x56a161['push'](_0x56a161['shift']());}};_0x93fe3a(++_0x29b2ab);}(_0x957f,0x159));var _0xf957=function(_0x33a694,_0x9b6640){_0x33a694=_0x33a694-0x0;var _0x41ff01=_0x957f[_0x33a694];return _0x41ff01;};'use strict';var _=require(_0xf957('0x0'));var util=require(_0xf957('0x1'));var logger=require(_0xf957('0x2'))(_0xf957('0x3'));var moment=require(_0xf957('0x4'));var BPromise=require(_0xf957('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf957('0x6'));var rimraf=require(_0xf957('0x7'));var config=require(_0xf957('0x8'));var attributes=require(_0xf957('0x9'));module[_0xf957('0xa')]=function(_0x809515,_0x465c17){return _0x809515[_0xf957('0xb')]('UserOpenchannelQueue',attributes,{'tableName':_0xf957('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c5c=['bluebird','request-promise','path','rimraf','../../config/environment','./userOpenchannelQueue.attributes','exports','define','UserOpenchannelQueue','lodash','moment'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0x6c5c,0x132));var _0xc6c5=function(_0x2178b6,_0x328d33){_0x2178b6=_0x2178b6-0x0;var _0x380237=_0x6c5c[_0x2178b6];return _0x380237;};'use strict';var _=require(_0xc6c5('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xc6c5('0x1'));var BPromise=require(_0xc6c5('0x2'));var rp=require(_0xc6c5('0x3'));var fs=require('fs');var path=require(_0xc6c5('0x4'));var rimraf=require(_0xc6c5('0x5'));var config=require(_0xc6c5('0x6'));var attributes=require(_0xc6c5('0x7'));module[_0xc6c5('0x8')]=function(_0x488b6b,_0x5ab235){return _0x488b6b[_0xc6c5('0x9')](_0xc6c5('0xa'),attributes,{'tableName':'user_has_openchannel_queues','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 6bf6e42..3b7de0e 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 _0x746d=['stringify','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s'];(function(_0x244ee3,_0x31ba8b){var _0x52ba39=function(_0x24450d){while(--_0x24450d){_0x244ee3['push'](_0x244ee3['shift']());}};_0x52ba39(++_0x31ba8b);}(_0x746d,0xd7));var _0xd746=function(_0x42df3f,_0x4fdea7){_0x42df3f=_0x42df3f-0x0;var _0x334f56=_0x746d[_0x42df3f];return _0x334f56;};'use strict';var _=require(_0xd746('0x0'));var util=require(_0xd746('0x1'));var moment=require('moment');var BPromise=require(_0xd746('0x2'));var rs=require(_0xd746('0x3'));var fs=require('fs');var Redis=require(_0xd746('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd746('0x5'));var config=require(_0xd746('0x6'));var jayson=require(_0xd746('0x7'));var client=jayson[_0xd746('0x8')][_0xd746('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x90d616,_0x4af5a6,_0xda4776){return new BPromise(function(_0x343494,_0x40713c){return client[_0xd746('0xa')](_0x90d616,_0xda4776)[_0xd746('0xb')](function(_0x1f6c7a){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x4af5a6,_0xd746('0xc'));logger[_0xd746('0xd')](_0xd746('0xe'),_0x4af5a6,_0xd746('0xc'),JSON[_0xd746('0xf')](_0x1f6c7a));if(_0x1f6c7a['error']){if(_0x1f6c7a[_0xd746('0x10')][_0xd746('0x11')]===0x1f4){logger[_0xd746('0x10')](_0xd746('0x12'),_0x4af5a6,_0x1f6c7a[_0xd746('0x10')][_0xd746('0x13')]);return _0x40713c(_0x1f6c7a[_0xd746('0x10')]['message']);}logger[_0xd746('0x10')](_0xd746('0x12'),_0x4af5a6,_0x1f6c7a[_0xd746('0x10')][_0xd746('0x13')]);return _0x343494(_0x1f6c7a[_0xd746('0x10')]['message']);}else{logger[_0xd746('0x14')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x4af5a6,_0xd746('0xc'));_0x343494(_0x1f6c7a[_0xd746('0x15')][_0xd746('0x13')]);}})[_0xd746('0x16')](function(_0x40f5d7){logger[_0xd746('0x10')](_0xd746('0x12'),_0x4af5a6,_0x40f5d7);_0x40713c(_0x40f5d7);});});} \ No newline at end of file +var _0x832d=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','UserOpenchannelQueue,\x20%s,\x20%s','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x4ae829,_0x2c842c){var _0x256b31=function(_0x34f104){while(--_0x34f104){_0x4ae829['push'](_0x4ae829['shift']());}};_0x256b31(++_0x2c842c);}(_0x832d,0x10e));var _0xd832=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x832d[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0xd832('0x0'));var moment=require(_0xd832('0x1'));var BPromise=require('bluebird');var rs=require(_0xd832('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd832('0x3'))['db'];var utils=require(_0xd832('0x4'));var logger=require(_0xd832('0x5'))(_0xd832('0x6'));var config=require(_0xd832('0x7'));var jayson=require(_0xd832('0x8'));var client=jayson[_0xd832('0x9')][_0xd832('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x6c20a3,_0x423df1,_0x2c937a){return new BPromise(function(_0x405872,_0x29df10){return client[_0xd832('0xb')](_0x6c20a3,_0x2c937a)[_0xd832('0xc')](function(_0x29bf58){logger[_0xd832('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x423df1,'request\x20sent');logger[_0xd832('0xe')](_0xd832('0xf'),_0x423df1,_0xd832('0x10'),JSON[_0xd832('0x11')](_0x29bf58));if(_0x29bf58[_0xd832('0x12')]){if(_0x29bf58[_0xd832('0x12')][_0xd832('0x13')]===0x1f4){logger[_0xd832('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x423df1,_0x29bf58[_0xd832('0x12')]['message']);return _0x29df10(_0x29bf58[_0xd832('0x12')][_0xd832('0x14')]);}logger['error'](_0xd832('0x15'),_0x423df1,_0x29bf58[_0xd832('0x12')][_0xd832('0x14')]);return _0x405872(_0x29bf58[_0xd832('0x12')][_0xd832('0x14')]);}else{logger[_0xd832('0xd')](_0xd832('0x15'),_0x423df1,_0xd832('0x10'));_0x405872(_0x29bf58[_0xd832('0x16')][_0xd832('0x14')]);}})['catch'](function(_0x1b5926){logger[_0xd832('0x12')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x423df1,_0x1b5926);_0x29df10(_0x1b5926);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 90115a7..abf64d3 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 _0xc818=['index','get','/describe','isAuthenticated','show','/:id/sections','/:id/resources','getResources','post','create','/:id/clone','clone','addResources','put','update','/:id','delete','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller'];(function(_0x4195eb,_0x516050){var _0x3ec2c5=function(_0x2b2c47){while(--_0x2b2c47){_0x4195eb['push'](_0x4195eb['shift']());}};_0x3ec2c5(++_0x516050);}(_0xc818,0xe6));var _0x8c81=function(_0xd9b991,_0x2f990f){_0xd9b991=_0xd9b991-0x0;var _0x313cfa=_0xc818[_0xd9b991];return _0x313cfa;};'use strict';var multer=require(_0x8c81('0x0'));var util=require(_0x8c81('0x1'));var path=require(_0x8c81('0x2'));var timeout=require(_0x8c81('0x3'));var express=require(_0x8c81('0x4'));var router=express['Router']();var fs_extra=require(_0x8c81('0x5'));var auth=require(_0x8c81('0x6'));var interaction=require(_0x8c81('0x7'));var config=require(_0x8c81('0x8'));var controller=require(_0x8c81('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x8c81('0xa')]);router[_0x8c81('0xb')](_0x8c81('0xc'),auth[_0x8c81('0xd')](),controller['describe']);router[_0x8c81('0xb')]('/:id',auth[_0x8c81('0xd')](),controller[_0x8c81('0xe')]);router[_0x8c81('0xb')](_0x8c81('0xf'),auth[_0x8c81('0xd')](),controller['getSections']);router[_0x8c81('0xb')](_0x8c81('0x10'),auth[_0x8c81('0xd')](),controller[_0x8c81('0x11')]);router[_0x8c81('0x12')]('/',auth[_0x8c81('0xd')](),controller[_0x8c81('0x13')]);router['post'](_0x8c81('0x14'),auth[_0x8c81('0xd')](),controller[_0x8c81('0x15')]);router[_0x8c81('0x12')](_0x8c81('0xf'),auth[_0x8c81('0xd')](),controller['addSections']);router[_0x8c81('0x12')](_0x8c81('0x10'),auth[_0x8c81('0xd')](),controller[_0x8c81('0x16')]);router[_0x8c81('0x17')]('/:id',auth[_0x8c81('0xd')](),controller[_0x8c81('0x18')]);router['delete'](_0x8c81('0x19'),auth[_0x8c81('0xd')](),controller['destroy']);router[_0x8c81('0x1a')](_0x8c81('0xf'),auth[_0x8c81('0xd')](),controller[_0x8c81('0x1b')]);router[_0x8c81('0x1a')](_0x8c81('0x10'),auth['isAuthenticated'](),controller[_0x8c81('0x1c')]);module[_0x8c81('0x1d')]=router; \ No newline at end of file +var _0x085f=['exports','multer','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/resources','post','create','clone','addSections','addResources','put','delete','removeResources'];(function(_0x376db5,_0x2b8874){var _0x304c17=function(_0x2dd9ba){while(--_0x2dd9ba){_0x376db5['push'](_0x376db5['shift']());}};_0x304c17(++_0x2b8874);}(_0x085f,0x74));var _0xf085=function(_0x142b4e,_0x596ce8){_0x142b4e=_0x142b4e-0x0;var _0x3683f4=_0x085f[_0x142b4e];return _0x3683f4;};'use strict';var multer=require(_0xf085('0x0'));var util=require('util');var path=require(_0xf085('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xf085('0x2'));var auth=require(_0xf085('0x3'));var interaction=require(_0xf085('0x4'));var config=require(_0xf085('0x5'));var controller=require(_0xf085('0x6'));router[_0xf085('0x7')]('/',auth[_0xf085('0x8')](),controller[_0xf085('0x9')]);router[_0xf085('0x7')](_0xf085('0xa'),auth[_0xf085('0x8')](),controller[_0xf085('0xb')]);router[_0xf085('0x7')](_0xf085('0xc'),auth[_0xf085('0x8')](),controller['show']);router[_0xf085('0x7')]('/:id/sections',auth[_0xf085('0x8')](),controller['getSections']);router[_0xf085('0x7')](_0xf085('0xd'),auth[_0xf085('0x8')](),controller['getResources']);router[_0xf085('0xe')]('/',auth[_0xf085('0x8')](),controller[_0xf085('0xf')]);router[_0xf085('0xe')]('/:id/clone',auth[_0xf085('0x8')](),controller[_0xf085('0x10')]);router[_0xf085('0xe')]('/:id/sections',auth[_0xf085('0x8')](),controller[_0xf085('0x11')]);router[_0xf085('0xe')](_0xf085('0xd'),auth[_0xf085('0x8')](),controller[_0xf085('0x12')]);router[_0xf085('0x13')](_0xf085('0xc'),auth[_0xf085('0x8')](),controller['update']);router[_0xf085('0x14')](_0xf085('0xc'),auth[_0xf085('0x8')](),controller['destroy']);router[_0xf085('0x14')]('/:id/sections',auth[_0xf085('0x8')](),controller['removeSections']);router['delete'](_0xf085('0xd'),auth['isAuthenticated'](),controller[_0xf085('0x15')]);module[_0xf085('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index c8c0beb..4c3a09b 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 _0x8525=['exports','STRING','join','crudPermissions','getDataValue','split','BOOLEAN'];(function(_0x417b4b,_0x3ba2d7){var _0x1e1f6d=function(_0x35931b){while(--_0x35931b){_0x417b4b['push'](_0x417b4b['shift']());}};_0x1e1f6d(++_0x3ba2d7);}(_0x8525,0x18f));var _0x5852=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8525[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x5852('0x0')]={'name':{'type':Sequelize[_0x5852('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x4b09cc){this['setDataValue']('crudPermissions',_0x4b09cc?_0x4b09cc[_0x5852('0x2')](''):[]);},'get':function(){return this['getDataValue'](_0x5852('0x3'))?this[_0x5852('0x4')](_0x5852('0x3'))[_0x5852('0x5')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x5852('0x1')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x5852('0x6')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x5852('0x6')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x5852('0x6')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x5852('0x6')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x5852('0x6')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0xc384=['name','setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x310c00,_0x6bb7cb){var _0x21c516=function(_0x3a6e88){while(--_0x3a6e88){_0x310c00['push'](_0x310c00['shift']());}};_0x21c516(++_0x6bb7cb);}(_0xc384,0x165));var _0x4c38=function(_0x222213,_0x2ea4de){_0x222213=_0x222213-0x0;var _0x5abf2f=_0xc384[_0x222213];return _0x5abf2f;};'use strict';var Sequelize=require(_0x4c38('0x0'));module[_0x4c38('0x1')]={'name':{'type':Sequelize[_0x4c38('0x2')],'allowNull':![],'unique':_0x4c38('0x3')},'crudPermissions':{'type':Sequelize[_0x4c38('0x2')],'set':function(_0x4e6fb6){this[_0x4c38('0x4')](_0x4c38('0x5'),_0x4e6fb6?_0x4e6fb6[_0x4c38('0x6')](''):[]);},'get':function(){return this[_0x4c38('0x7')](_0x4c38('0x5'))?this[_0x4c38('0x7')](_0x4c38('0x5'))[_0x4c38('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x4c38('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x4c38('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x4c38('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x4c38('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x4c38('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x4c38('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x4c38('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 6536258..7b8f3d9 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 _0x8da8=['api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','sendStatus','name','send','index','map','UserProfile','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','then','includeAll','include','findAll','rows','catch','params','length','body','clone','options','find','get','createdAt','crudPermissions','updatedAt','each','autoAssociation','UserProfileResource','sectionId','omit','userProfileId','UserProfileSection','create','Resources','update','describe','addSections','transaction','push','removeSections','ids','getSections','includes','isEmpty','subsections','enabled','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','bulkCreate','getResources','No\x20User\x20Profile\x20found\x20for\x20id\x20','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x14e9fc,_0x396121){var _0x1c3893=function(_0x3bbe89){while(--_0x3bbe89){_0x14e9fc['push'](_0x14e9fc['shift']());}};_0x1c3893(++_0x396121);}(_0x8da8,0x149));var _0x88da=function(_0x3ef5d1,_0x5e7c02){_0x3ef5d1=_0x3ef5d1-0x0;var _0x4fdeef=_0x8da8[_0x3ef5d1];return _0x4fdeef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88da('0x0'));var zipdir=require(_0x88da('0x1'));var jsonpatch=require(_0x88da('0x2'));var rp=require(_0x88da('0x3'));var moment=require('moment');var BPromise=require(_0x88da('0x4'));var Mustache=require(_0x88da('0x5'));var util=require(_0x88da('0x6'));var path=require('path');var sox=require(_0x88da('0x7'));var csv=require('to-csv');var ejs=require(_0x88da('0x8'));var fs=require('fs');var fs_extra=require(_0x88da('0x9'));var _=require(_0x88da('0xa'));var squel=require(_0x88da('0xb'));var crypto=require('crypto');var jsforce=require(_0x88da('0xc'));var deskjs=require(_0x88da('0xd'));var toCsv=require(_0x88da('0xe'));var querystring=require('querystring');var Papa=require(_0x88da('0xf'));var Redis=require(_0x88da('0x10'));var authService=require(_0x88da('0x11'));var qs=require(_0x88da('0x12'));var as=require(_0x88da('0x13'));var hardwareService=require(_0x88da('0x14'));var logger=require(_0x88da('0x15'))(_0x88da('0x16'));var utils=require(_0x88da('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x88da('0x18'));var db=require(_0x88da('0x19'))['db'];config[_0x88da('0x1a')]=_[_0x88da('0x1b')](config[_0x88da('0x1a')],{'host':_0x88da('0x1c'),'port':0x18eb});var socket=require(_0x88da('0x1d'))(new Redis(config['redis']));require(_0x88da('0x1e'))[_0x88da('0x1f')](socket);function respondWithStatusCode(_0x50a41a,_0x4fc08a){_0x4fc08a=_0x4fc08a||0xcc;return function(_0x332702){if(_0x332702){return _0x50a41a['sendStatus'](_0x4fc08a);}return _0x50a41a[_0x88da('0x20')](_0x4fc08a)[_0x88da('0x21')]();};}function respondWithResult(_0x50f012,_0x4b374f){_0x4b374f=_0x4b374f||0xc8;return function(_0x4fb25b){if(_0x4fb25b){return _0x50f012[_0x88da('0x20')](_0x4b374f)[_0x88da('0x22')](_0x4fb25b);}};}function respondWithFilteredResult(_0x59767a,_0x91eb26){return function(_0x55e4d3){if(_0x55e4d3){var _0x3da18e=typeof _0x91eb26[_0x88da('0x23')]===_0x88da('0x24')&&typeof _0x91eb26['limit']==='undefined';var _0x34a6d6=_0x55e4d3['count'];var _0x5b1b0c=_0x3da18e?0x0:_0x91eb26[_0x88da('0x23')];var _0x5b330e=_0x3da18e?_0x55e4d3[_0x88da('0x25')]:_0x91eb26['offset']+_0x91eb26[_0x88da('0x26')];var _0x241c0a;if(_0x5b330e>=_0x34a6d6){_0x5b330e=_0x34a6d6;_0x241c0a=0xc8;}else{_0x241c0a=0xce;}_0x59767a['status'](_0x241c0a);return _0x59767a[_0x88da('0x27')](_0x88da('0x28'),_0x5b1b0c+'-'+_0x5b330e+'/'+_0x34a6d6)[_0x88da('0x22')](_0x55e4d3);}return null;};}function patchUpdates(_0x357b88){return function(_0x14efb4){try{jsonpatch[_0x88da('0x29')](_0x14efb4,_0x357b88,!![]);}catch(_0x260e7d){return BPromise[_0x88da('0x2a')](_0x260e7d);}return _0x14efb4[_0x88da('0x2b')]();};}function saveUpdates(_0x466455,_0x137306){return function(_0x4e6b82){if(_0x4e6b82){return _0x4e6b82['update'](_0x466455)['then'](function(_0x3e05ff){return _0x3e05ff;});}return null;};}function removeEntity(_0x2a1cc7,_0x5ad1cf){return function(_0xeb50d8){if(_0xeb50d8){return _0xeb50d8[_0x88da('0x2c')]()['then'](function(){_0x2a1cc7[_0x88da('0x20')](0xcc)[_0x88da('0x21')]();});}};}function handleEntityNotFound(_0x5d9457,_0x5af072){return function(_0x2941f8){if(!_0x2941f8){_0x5d9457[_0x88da('0x2d')](0x194);}return _0x2941f8;};}function handleError(_0x5ba9fa,_0x1a7e4b){_0x1a7e4b=_0x1a7e4b||0x1f4;return function(_0x2cba4d){logger['error'](_0x2cba4d['stack']);if(_0x2cba4d[_0x88da('0x2e')]){delete _0x2cba4d[_0x88da('0x2e')];}_0x5ba9fa[_0x88da('0x20')](_0x1a7e4b)[_0x88da('0x2f')](_0x2cba4d);};}exports[_0x88da('0x30')]=function(_0x5aa955,_0x3dd7b3){var _0x33c5af={},_0xf28a0={},_0x16086d={'count':0x0,'rows':[]};var _0x3cfecc=_[_0x88da('0x31')](db[_0x88da('0x32')][_0x88da('0x33')],function(_0x232b13){return{'name':_0x232b13[_0x88da('0x34')],'type':_0x232b13[_0x88da('0x35')][_0x88da('0x36')]};});_0xf28a0['model']=_[_0x88da('0x31')](_0x3cfecc,'name');_0xf28a0['query']=_[_0x88da('0x37')](_0x5aa955[_0x88da('0x38')]);_0xf28a0[_0x88da('0x39')]=_[_0x88da('0x3a')](_0xf28a0[_0x88da('0x3b')],_0xf28a0['query']);_0x33c5af[_0x88da('0x3c')]=_[_0x88da('0x3a')](_0xf28a0['model'],qs[_0x88da('0x3d')](_0x5aa955['query'][_0x88da('0x3d')]));_0x33c5af[_0x88da('0x3c')]=_0x33c5af[_0x88da('0x3c')]['length']?_0x33c5af[_0x88da('0x3c')]:_0xf28a0[_0x88da('0x3b')];if(!_0x5aa955[_0x88da('0x38')][_0x88da('0x3e')](_0x88da('0x3f'))){_0x33c5af['limit']=qs[_0x88da('0x26')](_0x5aa955[_0x88da('0x38')]['limit']);_0x33c5af[_0x88da('0x23')]=qs[_0x88da('0x23')](_0x5aa955['query'][_0x88da('0x23')]);}_0x33c5af[_0x88da('0x40')]=qs[_0x88da('0x41')](_0x5aa955['query'][_0x88da('0x41')]);_0x33c5af[_0x88da('0x42')]=qs[_0x88da('0x39')](_['pick'](_0x5aa955[_0x88da('0x38')],_0xf28a0[_0x88da('0x39')]),_0x3cfecc);if(_0x5aa955['query']['filter']){_0x33c5af[_0x88da('0x42')]=_[_0x88da('0x43')](_0x33c5af[_0x88da('0x42')],{'$or':_['map'](_0x3cfecc,function(_0x5629b9){if(_0x5629b9[_0x88da('0x35')]!==_0x88da('0x44')){var _0x488753={};_0x488753[_0x5629b9['name']]={'$like':'%'+_0x5aa955[_0x88da('0x38')][_0x88da('0x45')]+'%'};return _0x488753;}})});}_0x33c5af=_[_0x88da('0x43')]({},_0x33c5af,_0x5aa955['options']);var _0x389cc0={'where':_0x33c5af[_0x88da('0x42')]};return db[_0x88da('0x32')][_0x88da('0x25')](_0x389cc0)[_0x88da('0x46')](function(_0x41fb53){_0x16086d[_0x88da('0x25')]=_0x41fb53;if(_0x5aa955['query'][_0x88da('0x47')]){_0x33c5af[_0x88da('0x48')]=[{'all':!![]}];}return db[_0x88da('0x32')][_0x88da('0x49')](_0x33c5af);})[_0x88da('0x46')](function(_0x38a9d2){_0x16086d[_0x88da('0x4a')]=_0x38a9d2;return _0x16086d;})[_0x88da('0x46')](respondWithFilteredResult(_0x3dd7b3,_0x33c5af))[_0x88da('0x4b')](handleError(_0x3dd7b3,null));};exports['show']=function(_0x1121be,_0x5bc884){var _0x3ddd5e={'raw':![],'where':{'id':_0x1121be[_0x88da('0x4c')]['id']}},_0x2e42bf={};_0x2e42bf[_0x88da('0x3b')]=_['keys'](db[_0x88da('0x32')][_0x88da('0x33')]);_0x2e42bf[_0x88da('0x38')]=_[_0x88da('0x37')](_0x1121be[_0x88da('0x38')]);_0x2e42bf['filters']=_[_0x88da('0x3a')](_0x2e42bf['model'],_0x2e42bf['query']);_0x3ddd5e[_0x88da('0x3c')]=_[_0x88da('0x3a')](_0x2e42bf['model'],qs[_0x88da('0x3d')](_0x1121be[_0x88da('0x38')]['fields']));_0x3ddd5e[_0x88da('0x3c')]=_0x3ddd5e[_0x88da('0x3c')][_0x88da('0x4d')]?_0x3ddd5e[_0x88da('0x3c')]:_0x2e42bf['model'];if(_0x1121be[_0x88da('0x38')][_0x88da('0x47')]){_0x3ddd5e[_0x88da('0x48')]=[{'all':!![]}];}_0x3ddd5e=_[_0x88da('0x43')]({},_0x3ddd5e,_0x1121be['options']);return db['UserProfile']['find'](_0x3ddd5e)[_0x88da('0x46')](handleEntityNotFound(_0x5bc884,null))[_0x88da('0x46')](respondWithResult(_0x5bc884,null))[_0x88da('0x4b')](handleError(_0x5bc884,null));};exports['create']=function(_0x545d18,_0x2dfed3){return db['UserProfile']['create'](_0x545d18[_0x88da('0x4e')],{})[_0x88da('0x46')](respondWithResult(_0x2dfed3,0xc9))[_0x88da('0x4b')](handleError(_0x2dfed3,null));};exports[_0x88da('0x4f')]=function(_0x444de4,_0x428c04){var _0x4e9c17={'where':{'id':_0x444de4[_0x88da('0x4c')]['id']}},_0x1bc76b={};_0x1bc76b[_0x88da('0x3b')]=_[_0x88da('0x37')](db[_0x88da('0x32')][_0x88da('0x33')]);_0x4e9c17[_0x88da('0x3c')]=_[_0x88da('0x3a')](_0x1bc76b['model'],qs[_0x88da('0x3d')](_0x444de4[_0x88da('0x38')]['fields']));_0x4e9c17[_0x88da('0x3c')]=_0x4e9c17['attributes'][_0x88da('0x4d')]?_0x4e9c17['attributes']:_0x1bc76b[_0x88da('0x3b')];if(_0x444de4[_0x88da('0x38')][_0x88da('0x47')]){_0x4e9c17['include']=[{'all':!![]}];}_0x4e9c17=_[_0x88da('0x43')]({},_0x4e9c17,_0x444de4[_0x88da('0x50')]);return db[_0x88da('0x32')][_0x88da('0x51')](_0x4e9c17)[_0x88da('0x46')](handleEntityNotFound(_0x428c04,null))[_0x88da('0x46')](function(_0x266fe6){if(_0x266fe6){var _0x235aca=_0x266fe6[_0x88da('0x52')]({'plain':!![]});_0x235aca=qs['omit'](_0x235aca,['id',_0x88da('0x53'),'updatedAt',_0x88da('0x54')]);_0x444de4[_0x88da('0x4e')]=_['omit'](_0x444de4[_0x88da('0x4e')],['id','createdAt',_0x88da('0x55')]);return db['sequelize']['transaction'](function(_0x51b9cb){return db[_0x88da('0x32')]['create'](_['merge'](_0x235aca,_0x444de4[_0x88da('0x4e')]),{'include':_0x444de4[_0x88da('0x38')][_0x88da('0x47')]?[{'all':!![]}]:undefined,'transaction':_0x51b9cb})['then'](function(_0x1bfd78){var _0xf221d2=_0x1bfd78['get']({'plain':!![]});return db['UserProfileSection'][_0x88da('0x49')]({'where':{'userProfileId':_0x444de4[_0x88da('0x4c')]['id']},'raw':!![]})[_0x88da('0x46')](function(_0x6938ab){if(_0x6938ab){return BPromise[_0x88da('0x56')](_0x6938ab,function(_0x72dbec){return new BPromise(function(_0x58cb5c,_0x20244e){if(_0x72dbec['autoAssociation']===null||_0x72dbec[_0x88da('0x57')]===0x1)_0x58cb5c(null);return db[_0x88da('0x58')][_0x88da('0x49')]({'where':{'sectionId':_0x72dbec['id']},'raw':!![]})[_0x88da('0x46')](function(_0x376f0e){var _0x2b2aaa=_[_0x88da('0x31')](_0x376f0e,function(_0x4d2256){return qs['omit'](_0x4d2256,['id',_0x88da('0x53'),'updatedAt',_0x88da('0x59')]);});_0x58cb5c(_0x2b2aaa);})['catch'](function(_0x32966f){_0x20244e(_0x32966f);});})[_0x88da('0x46')](function(_0x1c4061){var _0x1da480=qs[_0x88da('0x5a')](_0x72dbec,['id',_0x88da('0x53'),_0x88da('0x55')]);_0x1da480[_0x88da('0x5b')]=_0xf221d2['id'];if(_0x1c4061)_0x1da480['Resources']=_0x1c4061;return _0x1da480;})[_0x88da('0x46')](function(_0x2d84f5){return db[_0x88da('0x5c')][_0x88da('0x5d')](_0x2d84f5,{'include':[{'model':db['UserProfileResource'],'as':_0x88da('0x5e')}],'raw':!![],'transaction':_0x51b9cb});});})[_0x88da('0x46')](function(){return _0xf221d2;});}});});});}})[_0x88da('0x46')](respondWithResult(_0x428c04,0xc9))[_0x88da('0x4b')](handleError(_0x428c04,null));};exports[_0x88da('0x5f')]=function(_0x342087,_0x3132b8){if(_0x342087[_0x88da('0x4e')]['id']){delete _0x342087[_0x88da('0x4e')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x342087[_0x88da('0x4c')]['id']}})[_0x88da('0x46')](handleEntityNotFound(_0x3132b8,null))[_0x88da('0x46')](saveUpdates(_0x342087[_0x88da('0x4e')],null))['then'](respondWithResult(_0x3132b8,null))[_0x88da('0x4b')](handleError(_0x3132b8,null));};exports[_0x88da('0x2c')]=function(_0x20a006,_0x57e15a){return db['UserProfile']['find']({'where':{'id':_0x20a006['params']['id']}})[_0x88da('0x46')](handleEntityNotFound(_0x57e15a,null))[_0x88da('0x46')](removeEntity(_0x57e15a,null))[_0x88da('0x4b')](handleError(_0x57e15a,null));};exports['describe']=function(_0x468d5b,_0x57e6e6){return db[_0x88da('0x32')][_0x88da('0x60')]()[_0x88da('0x46')](respondWithResult(_0x57e6e6,null))[_0x88da('0x4b')](handleError(_0x57e6e6,null));};exports[_0x88da('0x61')]=function(_0x1d887f,_0x53fa19){var _0x596b8c=_0x1d887f[_0x88da('0x4e')];return db[_0x88da('0x32')][_0x88da('0x51')]({'where':{'id':_0x1d887f[_0x88da('0x4c')]['id']}})[_0x88da('0x46')](handleEntityNotFound(_0x53fa19,null))['then'](function(_0x42eaee){if(_0x42eaee){return db['sequelize'][_0x88da('0x62')](function(_0xd06ddf){return db[_0x88da('0x5c')][_0x88da('0x2c')]({'where':{'userProfileId':_0x1d887f[_0x88da('0x4c')]['id'],'sectionId':_['map'](_0x596b8c,function(_0x3bc029){return _0x3bc029[_0x88da('0x59')];})},'transaction':_0xd06ddf})['then'](function(){var _0x740f36=_[_0x88da('0x31')](_0x596b8c,function(_0x4ea445){_0x4ea445['userProfileId']=_0x1d887f[_0x88da('0x4c')]['id'];return _0x4ea445;});var _0x1e8f6c=[];return BPromise[_0x88da('0x56')](_0x740f36,function(_0x1d7575){return db[_0x88da('0x5c')][_0x88da('0x5d')](_0x1d7575,{'include':[{'model':db[_0x88da('0x58')],'as':_0x88da('0x5e')}],'raw':!![],'transaction':_0xd06ddf})[_0x88da('0x46')](function(_0x49e9ee){_0x1e8f6c[_0x88da('0x63')](_0x49e9ee[_0x88da('0x52')]({'plain':!![]}));});})[_0x88da('0x46')](function(){return _0x1e8f6c;});});});}})['then'](function(_0x39729c){return _0x39729c;})[_0x88da('0x46')](respondWithResult(_0x53fa19,null))[_0x88da('0x4b')](handleError(_0x53fa19,null));};exports[_0x88da('0x64')]=function(_0x4599dc,_0xcce555){var _0x28a0db;return db[_0x88da('0x32')][_0x88da('0x51')]({'where':{'id':_0x4599dc[_0x88da('0x4c')]['id']},'attributes':['id',_0x88da('0x2e')]})[_0x88da('0x46')](handleEntityNotFound(_0xcce555,null))[_0x88da('0x46')](function(_0x93f1af){if(_0x93f1af){_0x28a0db=_0x93f1af;return db[_0x88da('0x5c')][_0x88da('0x2c')]({'where':{'userProfileId':_0x4599dc[_0x88da('0x4c')]['id'],'sectionId':_0x4599dc['query'][_0x88da('0x65')]}});}})[_0x88da('0x46')](function(){return _0x28a0db;})[_0x88da('0x46')](respondWithStatusCode(_0xcce555,null))['catch'](handleError(_0xcce555,null));};exports[_0x88da('0x66')]=function(_0x21afa7,_0x23dcfd){var _0xaef774=[];var _0x49ef20=[];return db[_0x88da('0x5c')][_0x88da('0x49')]({'where':{'userProfileId':_0x21afa7[_0x88da('0x4c')]['id']},'raw':!![]})['then'](function(_0x3c1c0a){_0xaef774=_[_0x88da('0x45')](_0x3c1c0a,function(_0x4a66a2){return _0x4a66a2['enabled']===0x1||_[_0x88da('0x67')]([0x3eb,0x709],_0x4a66a2['sectionId']);});if(!_[_0x88da('0x68')](_0xaef774)){return _[_0x88da('0x31')](_0xaef774,function(_0x5d064f){return _0x5d064f[_0x88da('0x59')];});}else{return;}})[_0x88da('0x46')](function(_0x1e021b){if(_0x1e021b)_0x49ef20=_0x1e021b;if(_['includes'](_0x49ef20,0x64)){var _0x537ccd=_[_0x88da('0x51')](_0xaef774,{'sectionId':0x64});return hasDefaultDashboard(_0x537ccd)[_0x88da('0x46')](function(_0xac069a){return _['map'](_0xaef774,function(_0x4ee519){if(_0x4ee519[_0x88da('0x59')]===0x64){_0x4ee519[_0x88da('0x69')]=_0xac069a;}return _0x4ee519;});});}else{return;}})[_0x88da('0x46')](function(_0x5543b5){if(_0x5543b5)_0xaef774=_0x5543b5;if(_['includes'](_0x49ef20,0x3eb)){var _0x3f8e3f=_['find'](_0xaef774,{'sectionId':0x3eb});return getCustomDashboards(_0x3f8e3f)[_0x88da('0x46')](function(_0x86769c){return _[_0x88da('0x31')](_0xaef774,function(_0x2aa376){if(_0x3f8e3f[_0x88da('0x6a')]){if(_0x2aa376[_0x88da('0x59')]===0x3eb){_0x2aa376[_0x88da('0x69')]=_0x86769c;}}else{if(_0x2aa376[_0x88da('0x59')]===0x64){if(!_0x2aa376[_0x88da('0x69')]){_0x2aa376[_0x88da('0x69')]=[];}_0x2aa376[_0x88da('0x69')]=_0x2aa376[_0x88da('0x69')][_0x88da('0x6b')](_0x86769c);}}return _0x2aa376;});});}else{return;}})[_0x88da('0x46')](function(_0x3abbad){if(_0x3abbad)_0xaef774=_0x3abbad;if(_[_0x88da('0x67')](_0x49ef20,0x709)){var _0x45f962=_['find'](_0xaef774,{'sectionId':0x709});return getPlugins(_0x45f962)[_0x88da('0x46')](function(_0x1df041){if(_0x45f962['enabled']){return _[_0x88da('0x31')](_0xaef774,function(_0x542d0b){if(_0x542d0b[_0x88da('0x59')]===0x709){_0x542d0b['subsections']=_0x1df041;}return _0x542d0b;});}else{var _0xf2de38={'sectionId':0x76c,'enabled':0x1,'subsections':_0x1df041};var _0x25feef=_[_0x88da('0x31')](_0xaef774);_0x25feef[_0x88da('0x63')](_0xf2de38);return _0x25feef;}});}else{return;}})[_0x88da('0x46')](function(_0x458a5e){if(_0x458a5e)_0xaef774=_0x458a5e;return _[_0x88da('0x45')](_0xaef774,[_0x88da('0x6a'),0x1]);})['then'](respondWithResult(_0x23dcfd,null))[_0x88da('0x4b')](handleError(_0x23dcfd,null));};function hasDefaultDashboard(_0x30ba10){var _0x281af5=[0x65];return new BPromise(function(_0x36fe2e,_0xf6291a){try{if(_0x30ba10['autoAssociation']){_0x36fe2e(_0x281af5);}else{return db['UserProfileResource'][_0x88da('0x6c')]({'where':{'sectionId':_0x30ba10['id']},'raw':!![]})[_0x88da('0x46')](function(_0x1ffa4b){_0x1ffa4b?_0x36fe2e(_0x281af5):_0x36fe2e();});}}catch(_0x359170){_0xf6291a(_0x359170);}});}function getCustomDashboards(_0x266c9c){var _0x3c5fc0=[];return new BPromise(function(_0x5373e6,_0x32dafc){try{if(_0x266c9c['autoAssociation']){return db[_0x88da('0x6d')][_0x88da('0x49')]({'raw':!![]})[_0x88da('0x46')](function(_0x4eb431){_0x4eb431[_0x88da('0x6e')](function(_0x41b439){_0x3c5fc0[_0x88da('0x63')](_0x41b439['id']+0x1869f);});_0x5373e6(_0x3c5fc0);});}else{return db[_0x88da('0x58')][_0x88da('0x49')]({'where':{'sectionId':_0x266c9c['id']},'raw':!![]})[_0x88da('0x46')](function(_0x4242a4){_0x4242a4[_0x88da('0x6e')](function(_0x51b077){_0x3c5fc0[_0x88da('0x63')](_0x51b077[_0x88da('0x6f')]+0x1869f);});_0x5373e6(_0x3c5fc0);});}}catch(_0x1d026a){_0x32dafc(_0x1d026a);}});}function getPlugins(_0xbf0731){var _0x3a1df8=[];return new BPromise(function(_0xa9bdcd,_0x2241f8){try{if(_0xbf0731[_0x88da('0x57')]){return db[_0x88da('0x70')]['findAll']({'raw':!![]})['then'](function(_0xed5dac){_0xed5dac[_0x88da('0x6e')](function(_0x4254a1){_0x3a1df8['push'](_0x4254a1['id']+0x15b38);});_0xa9bdcd(_0x3a1df8);});}else{return db['UserProfileResource'][_0x88da('0x49')]({'where':{'sectionId':_0xbf0731['id']},'raw':!![]})[_0x88da('0x46')](function(_0xb17d01){_0xb17d01[_0x88da('0x6e')](function(_0x307fd0){_0x3a1df8['push'](_0x307fd0[_0x88da('0x6f')]+0x15b38);});_0xa9bdcd(_0x3a1df8);});}}catch(_0x2cba53){_0x2241f8(_0x2cba53);}});}exports[_0x88da('0x71')]=function(_0x266b96,_0x3d1bcc){return db[_0x88da('0x32')][_0x88da('0x51')]({'where':{'id':_0x266b96['params']['id']}})[_0x88da('0x46')](handleEntityNotFound(_0x3d1bcc,null))[_0x88da('0x46')](function(_0x57737c){if(_0x57737c){return db['sequelize'][_0x88da('0x62')](function(_0xa99b58){return db['UserProfileSection'][_0x88da('0x49')]({'where':{'userProfileId':_0x266b96[_0x88da('0x4c')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0xf63584){if(_0xf63584){return db[_0x88da('0x5c')][_0x88da('0x2c')]({'where':{'userProfileId':_0x266b96['params']['id'],'id':_['map'](_0xf63584,function(_0x2092c8){return _0x2092c8['id'];})},'transaction':_0xa99b58});}})['then'](function(_0x2d241c){var _0x3a8707=_[_0x88da('0x31')](_0x266b96[_0x88da('0x4e')],function(_0x1111d2){_0x1111d2[_0x88da('0x5b')]=_0x266b96['params']['id'];return _0x1111d2;});return db[_0x88da('0x5c')][_0x88da('0x72')](_0x3a8707,{'raw':!![],'transaction':_0xa99b58});})[_0x88da('0x46')](function(_0x310cdc){var _0x2e6d46=_[_0x88da('0x45')](_[_0x88da('0x31')](_0x310cdc,function(_0x53ec47){return _0x53ec47['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2e6d46){return db[_0x88da('0x5c')][_0x88da('0x49')]({'where':{'userProfileId':_0x266b96[_0x88da('0x4c')]['id'],'sectionId':_[_0x88da('0x31')](_0x2e6d46,function(_0x1b4be6){return _0x1b4be6[_0x88da('0x59')];})},'attributes':['id','sectionId'],'raw':!![]})[_0x88da('0x46')](function(_0x2b9546){var _0x32a539=_[_0x88da('0x31')](_0x266b96[_0x88da('0x4e')],function(_0x5675a9){_0x5675a9[_0x88da('0x5b')]=_0x266b96[_0x88da('0x4c')]['id'];return _0x5675a9;});return db['UserProfileResource']['bulkCreate'](_0x32a539,{'raw':!![],'transaction':_0xa99b58});});}})['catch'](handleError(_0x3d1bcc,null));});}})[_0x88da('0x46')](function(_0x543752){var _0x49fbf9=_[_0x88da('0x31')](_0x543752,function(_0xa55bb3){return _0xa55bb3[_0x88da('0x52')]({'plain':!![]});});})['then'](respondWithResult(_0x3d1bcc,null))[_0x88da('0x4b')](handleError(_0x3d1bcc,null));};exports['removeResources']=function(_0x264cdd,_0x4ceaec,_0x4fda8a){return db[_0x88da('0x32')][_0x88da('0x51')]({'where':{'id':_0x264cdd[_0x88da('0x4c')]['id']}})[_0x88da('0x46')](handleEntityNotFound(_0x4ceaec,null))[_0x88da('0x46')](function(_0x1b9237){if(_0x1b9237){return _0x1b9237['removeResources'](_0x264cdd[_0x88da('0x38')][_0x88da('0x65')]);}})[_0x88da('0x46')](respondWithStatusCode(_0x4ceaec,null))[_0x88da('0x4b')](handleError(_0x4ceaec,null));};exports[_0x88da('0x73')]=function(_0x1463c8,_0x4c0c69){var _0x347261={};if(!_0x1463c8['query']['section'])throw new Error('Missing\x20section\x20parameter');if(!_0x1463c8[_0x88da('0x38')][_0x88da('0x3e')](_0x88da('0x3f'))){_0x347261[_0x88da('0x26')]=qs[_0x88da('0x26')](_0x1463c8['query'][_0x88da('0x26')]);_0x347261['offset']=qs['offset'](_0x1463c8[_0x88da('0x38')]['offset']);}return db['UserProfile'][_0x88da('0x51')]({'where':{'id':_0x1463c8['params']['id']}})[_0x88da('0x46')](function(_0x31320a){if(!_0x31320a)throw new Error(_0x88da('0x74')+_0x1463c8[_0x88da('0x4c')]['id']);return db['UserProfile']['getResources'](_0x1463c8);})[_0x88da('0x46')](respondWithFilteredResult(_0x4c0c69,_0x347261))[_0x88da('0x4b')](handleError(_0x4c0c69,null));}; \ No newline at end of file +var _0x6803=['section','Missing\x20section\x20parameter','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','../../config/license/util','../../mysqldb','redis','localhost','status','end','json','offset','undefined','limit','count','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map','UserProfile','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','length','create','body','params','find','get','omit','crudPermissions','createdAt','sequelize','UserProfileSection','findAll','each','autoAssociation','UserProfileResource','updatedAt','Resources','describe','sectionId','userProfileId','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','concat','findOne','Dashboard','forEach','resourceId','Plugin','addResources','transaction','bulkCreate','removeResources','getResources'];(function(_0x8720df,_0x3f41ea){var _0x44b435=function(_0x4a5625){while(--_0x4a5625){_0x8720df['push'](_0x8720df['shift']());}};_0x44b435(++_0x3f41ea);}(_0x6803,0x1c2));var _0x3680=function(_0x24ce3e,_0x5aaae6){_0x24ce3e=_0x24ce3e-0x0;var _0x1f9240=_0x6803[_0x24ce3e];return _0x1f9240;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3680('0x0'));var jsonpatch=require(_0x3680('0x1'));var rp=require(_0x3680('0x2'));var moment=require(_0x3680('0x3'));var BPromise=require(_0x3680('0x4'));var Mustache=require(_0x3680('0x5'));var util=require('util');var path=require(_0x3680('0x6'));var sox=require(_0x3680('0x7'));var csv=require(_0x3680('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3680('0x9'));var squel=require(_0x3680('0xa'));var crypto=require(_0x3680('0xb'));var jsforce=require(_0x3680('0xc'));var deskjs=require(_0x3680('0xd'));var toCsv=require(_0x3680('0x8'));var querystring=require(_0x3680('0xe'));var Papa=require(_0x3680('0xf'));var Redis=require(_0x3680('0x10'));var authService=require(_0x3680('0x11'));var qs=require(_0x3680('0x12'));var as=require(_0x3680('0x13'));var hardwareService=require(_0x3680('0x14'));var logger=require(_0x3680('0x15'))(_0x3680('0x16'));var utils=require('../../config/utils');var config=require(_0x3680('0x17'));var licenseUtil=require(_0x3680('0x18'));var db=require(_0x3680('0x19'))['db'];config[_0x3680('0x1a')]=_['defaults'](config[_0x3680('0x1a')],{'host':_0x3680('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3680('0x1a')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x393736,_0x17cd09){_0x17cd09=_0x17cd09||0xcc;return function(_0x24912d){if(_0x24912d){return _0x393736['sendStatus'](_0x17cd09);}return _0x393736[_0x3680('0x1c')](_0x17cd09)[_0x3680('0x1d')]();};}function respondWithResult(_0x19c618,_0x3a475c){_0x3a475c=_0x3a475c||0xc8;return function(_0x4aefc0){if(_0x4aefc0){return _0x19c618['status'](_0x3a475c)[_0x3680('0x1e')](_0x4aefc0);}};}function respondWithFilteredResult(_0x3fed9e,_0x2c24e5){return function(_0x383072){if(_0x383072){var _0x1049c0=typeof _0x2c24e5[_0x3680('0x1f')]===_0x3680('0x20')&&typeof _0x2c24e5[_0x3680('0x21')]===_0x3680('0x20');var _0x1374a7=_0x383072[_0x3680('0x22')];var _0x107723=_0x1049c0?0x0:_0x2c24e5['offset'];var _0x4c79f2=_0x1049c0?_0x383072[_0x3680('0x22')]:_0x2c24e5[_0x3680('0x1f')]+_0x2c24e5[_0x3680('0x21')];var _0x2e599c;if(_0x4c79f2>=_0x1374a7){_0x4c79f2=_0x1374a7;_0x2e599c=0xc8;}else{_0x2e599c=0xce;}_0x3fed9e[_0x3680('0x1c')](_0x2e599c);return _0x3fed9e['set']('Content-Range',_0x107723+'-'+_0x4c79f2+'/'+_0x1374a7)['json'](_0x383072);}return null;};}function patchUpdates(_0x54b300){return function(_0x2897a3){try{jsonpatch[_0x3680('0x23')](_0x2897a3,_0x54b300,!![]);}catch(_0x104462){return BPromise['reject'](_0x104462);}return _0x2897a3[_0x3680('0x24')]();};}function saveUpdates(_0x4ed681,_0x5b622c){return function(_0x136d0c){if(_0x136d0c){return _0x136d0c[_0x3680('0x25')](_0x4ed681)[_0x3680('0x26')](function(_0x4b4085){return _0x4b4085;});}return null;};}function removeEntity(_0x258e54,_0x203f6c){return function(_0x4f8ce4){if(_0x4f8ce4){return _0x4f8ce4[_0x3680('0x27')]()[_0x3680('0x26')](function(){_0x258e54[_0x3680('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f8345,_0x531755){return function(_0x142ef7){if(!_0x142ef7){_0x1f8345[_0x3680('0x28')](0x194);}return _0x142ef7;};}function handleError(_0x2b3da0,_0x1219a4){_0x1219a4=_0x1219a4||0x1f4;return function(_0x41f71a){logger[_0x3680('0x29')](_0x41f71a[_0x3680('0x2a')]);if(_0x41f71a[_0x3680('0x2b')]){delete _0x41f71a['name'];}_0x2b3da0[_0x3680('0x1c')](_0x1219a4)['send'](_0x41f71a);};}exports[_0x3680('0x2c')]=function(_0x1628f7,_0xffff3a){var _0x5dc974={},_0x5bcb34={},_0x4f265c={'count':0x0,'rows':[]};var _0x2b5067=_[_0x3680('0x2d')](db[_0x3680('0x2e')][_0x3680('0x2f')],function(_0xcda317){return{'name':_0xcda317['fieldName'],'type':_0xcda317[_0x3680('0x30')][_0x3680('0x31')]};});_0x5bcb34[_0x3680('0x32')]=_[_0x3680('0x2d')](_0x2b5067,'name');_0x5bcb34[_0x3680('0x33')]=_[_0x3680('0x34')](_0x1628f7[_0x3680('0x33')]);_0x5bcb34[_0x3680('0x35')]=_[_0x3680('0x36')](_0x5bcb34[_0x3680('0x32')],_0x5bcb34[_0x3680('0x33')]);_0x5dc974[_0x3680('0x37')]=_[_0x3680('0x36')](_0x5bcb34['model'],qs[_0x3680('0x38')](_0x1628f7[_0x3680('0x33')]['fields']));_0x5dc974['attributes']=_0x5dc974[_0x3680('0x37')]['length']?_0x5dc974['attributes']:_0x5bcb34[_0x3680('0x32')];if(!_0x1628f7[_0x3680('0x33')][_0x3680('0x39')](_0x3680('0x3a'))){_0x5dc974['limit']=qs[_0x3680('0x21')](_0x1628f7['query'][_0x3680('0x21')]);_0x5dc974[_0x3680('0x1f')]=qs[_0x3680('0x1f')](_0x1628f7[_0x3680('0x33')][_0x3680('0x1f')]);}_0x5dc974['order']=qs[_0x3680('0x3b')](_0x1628f7[_0x3680('0x33')][_0x3680('0x3b')]);_0x5dc974[_0x3680('0x3c')]=qs[_0x3680('0x35')](_[_0x3680('0x3d')](_0x1628f7[_0x3680('0x33')],_0x5bcb34[_0x3680('0x35')]),_0x2b5067);if(_0x1628f7[_0x3680('0x33')]['filter']){_0x5dc974[_0x3680('0x3c')]=_[_0x3680('0x3e')](_0x5dc974[_0x3680('0x3c')],{'$or':_['map'](_0x2b5067,function(_0x154977){if(_0x154977[_0x3680('0x30')]!==_0x3680('0x3f')){var _0x45989c={};_0x45989c[_0x154977[_0x3680('0x2b')]]={'$like':'%'+_0x1628f7[_0x3680('0x33')][_0x3680('0x40')]+'%'};return _0x45989c;}})});}_0x5dc974=_[_0x3680('0x3e')]({},_0x5dc974,_0x1628f7[_0x3680('0x41')]);var _0x5d8fef={'where':_0x5dc974['where']};return db[_0x3680('0x2e')][_0x3680('0x22')](_0x5d8fef)[_0x3680('0x26')](function(_0x1cdcc9){_0x4f265c[_0x3680('0x22')]=_0x1cdcc9;if(_0x1628f7[_0x3680('0x33')][_0x3680('0x42')]){_0x5dc974[_0x3680('0x43')]=[{'all':!![]}];}return db['UserProfile']['findAll'](_0x5dc974);})[_0x3680('0x26')](function(_0x39aa6e){_0x4f265c[_0x3680('0x44')]=_0x39aa6e;return _0x4f265c;})[_0x3680('0x26')](respondWithFilteredResult(_0xffff3a,_0x5dc974))[_0x3680('0x45')](handleError(_0xffff3a,null));};exports[_0x3680('0x46')]=function(_0x276713,_0x1278d1){var _0x5845bf={'raw':![],'where':{'id':_0x276713['params']['id']}},_0x3cf7c7={};_0x3cf7c7[_0x3680('0x32')]=_[_0x3680('0x34')](db[_0x3680('0x2e')][_0x3680('0x2f')]);_0x3cf7c7[_0x3680('0x33')]=_[_0x3680('0x34')](_0x276713[_0x3680('0x33')]);_0x3cf7c7[_0x3680('0x35')]=_[_0x3680('0x36')](_0x3cf7c7[_0x3680('0x32')],_0x3cf7c7[_0x3680('0x33')]);_0x5845bf['attributes']=_[_0x3680('0x36')](_0x3cf7c7[_0x3680('0x32')],qs[_0x3680('0x38')](_0x276713[_0x3680('0x33')]['fields']));_0x5845bf[_0x3680('0x37')]=_0x5845bf[_0x3680('0x37')][_0x3680('0x47')]?_0x5845bf[_0x3680('0x37')]:_0x3cf7c7[_0x3680('0x32')];if(_0x276713[_0x3680('0x33')]['includeAll']){_0x5845bf[_0x3680('0x43')]=[{'all':!![]}];}_0x5845bf=_[_0x3680('0x3e')]({},_0x5845bf,_0x276713[_0x3680('0x41')]);return db[_0x3680('0x2e')]['find'](_0x5845bf)[_0x3680('0x26')](handleEntityNotFound(_0x1278d1,null))[_0x3680('0x26')](respondWithResult(_0x1278d1,null))[_0x3680('0x45')](handleError(_0x1278d1,null));};exports[_0x3680('0x48')]=function(_0x2880b7,_0x199ffb){return db['UserProfile'][_0x3680('0x48')](_0x2880b7[_0x3680('0x49')],{})[_0x3680('0x26')](respondWithResult(_0x199ffb,0xc9))[_0x3680('0x45')](handleError(_0x199ffb,null));};exports['clone']=function(_0x2534cd,_0x5e8324){var _0x3ba23b={'where':{'id':_0x2534cd[_0x3680('0x4a')]['id']}},_0x587805={};_0x587805['model']=_[_0x3680('0x34')](db['UserProfile'][_0x3680('0x2f')]);_0x3ba23b[_0x3680('0x37')]=_[_0x3680('0x36')](_0x587805[_0x3680('0x32')],qs[_0x3680('0x38')](_0x2534cd[_0x3680('0x33')][_0x3680('0x38')]));_0x3ba23b[_0x3680('0x37')]=_0x3ba23b[_0x3680('0x37')][_0x3680('0x47')]?_0x3ba23b[_0x3680('0x37')]:_0x587805['model'];if(_0x2534cd[_0x3680('0x33')][_0x3680('0x42')]){_0x3ba23b[_0x3680('0x43')]=[{'all':!![]}];}_0x3ba23b=_[_0x3680('0x3e')]({},_0x3ba23b,_0x2534cd['options']);return db[_0x3680('0x2e')][_0x3680('0x4b')](_0x3ba23b)[_0x3680('0x26')](handleEntityNotFound(_0x5e8324,null))[_0x3680('0x26')](function(_0x56cb93){if(_0x56cb93){var _0x352bec=_0x56cb93[_0x3680('0x4c')]({'plain':!![]});_0x352bec=qs[_0x3680('0x4d')](_0x352bec,['id','createdAt','updatedAt',_0x3680('0x4e')]);_0x2534cd[_0x3680('0x49')]=_[_0x3680('0x4d')](_0x2534cd[_0x3680('0x49')],['id',_0x3680('0x4f'),'updatedAt']);return db[_0x3680('0x50')]['transaction'](function(_0x15f492){return db[_0x3680('0x2e')][_0x3680('0x48')](_['merge'](_0x352bec,_0x2534cd[_0x3680('0x49')]),{'include':_0x2534cd['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x15f492})[_0x3680('0x26')](function(_0x20b267){var _0x537e03=_0x20b267[_0x3680('0x4c')]({'plain':!![]});return db[_0x3680('0x51')][_0x3680('0x52')]({'where':{'userProfileId':_0x2534cd[_0x3680('0x4a')]['id']},'raw':!![]})[_0x3680('0x26')](function(_0x1f64b7){if(_0x1f64b7){return BPromise[_0x3680('0x53')](_0x1f64b7,function(_0x1255c9){return new BPromise(function(_0x3183ab,_0x5859e4){if(_0x1255c9[_0x3680('0x54')]===null||_0x1255c9['autoAssociation']===0x1)_0x3183ab(null);return db[_0x3680('0x55')][_0x3680('0x52')]({'where':{'sectionId':_0x1255c9['id']},'raw':!![]})[_0x3680('0x26')](function(_0x155bc7){var _0x2b4d90=_['map'](_0x155bc7,function(_0x339643){return qs['omit'](_0x339643,['id',_0x3680('0x4f'),_0x3680('0x56'),'sectionId']);});_0x3183ab(_0x2b4d90);})[_0x3680('0x45')](function(_0x57bdf5){_0x5859e4(_0x57bdf5);});})[_0x3680('0x26')](function(_0x52c61b){var _0x4cfd1c=qs['omit'](_0x1255c9,['id',_0x3680('0x4f'),_0x3680('0x56')]);_0x4cfd1c['userProfileId']=_0x537e03['id'];if(_0x52c61b)_0x4cfd1c['Resources']=_0x52c61b;return _0x4cfd1c;})['then'](function(_0x57fb50){return db[_0x3680('0x51')][_0x3680('0x48')](_0x57fb50,{'include':[{'model':db[_0x3680('0x55')],'as':_0x3680('0x57')}],'raw':!![],'transaction':_0x15f492});});})[_0x3680('0x26')](function(){return _0x537e03;});}});});});}})[_0x3680('0x26')](respondWithResult(_0x5e8324,0xc9))[_0x3680('0x45')](handleError(_0x5e8324,null));};exports[_0x3680('0x25')]=function(_0x32654e,_0x4814e4){if(_0x32654e['body']['id']){delete _0x32654e[_0x3680('0x49')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x32654e[_0x3680('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4814e4,null))[_0x3680('0x26')](saveUpdates(_0x32654e[_0x3680('0x49')],null))['then'](respondWithResult(_0x4814e4,null))[_0x3680('0x45')](handleError(_0x4814e4,null));};exports[_0x3680('0x27')]=function(_0x1b16fb,_0x261798){return db[_0x3680('0x2e')][_0x3680('0x4b')]({'where':{'id':_0x1b16fb[_0x3680('0x4a')]['id']}})[_0x3680('0x26')](handleEntityNotFound(_0x261798,null))['then'](removeEntity(_0x261798,null))[_0x3680('0x45')](handleError(_0x261798,null));};exports[_0x3680('0x58')]=function(_0x55abf3,_0x2be451){return db[_0x3680('0x2e')][_0x3680('0x58')]()[_0x3680('0x26')](respondWithResult(_0x2be451,null))[_0x3680('0x45')](handleError(_0x2be451,null));};exports['addSections']=function(_0x12858e,_0x24a647){var _0x4322ef=_0x12858e[_0x3680('0x49')];return db['UserProfile'][_0x3680('0x4b')]({'where':{'id':_0x12858e[_0x3680('0x4a')]['id']}})[_0x3680('0x26')](handleEntityNotFound(_0x24a647,null))[_0x3680('0x26')](function(_0x46d4a3){if(_0x46d4a3){return db[_0x3680('0x50')]['transaction'](function(_0x59a7fb){return db['UserProfileSection'][_0x3680('0x27')]({'where':{'userProfileId':_0x12858e['params']['id'],'sectionId':_[_0x3680('0x2d')](_0x4322ef,function(_0x51d6c4){return _0x51d6c4[_0x3680('0x59')];})},'transaction':_0x59a7fb})[_0x3680('0x26')](function(){var _0x3fd951=_[_0x3680('0x2d')](_0x4322ef,function(_0x30067a){_0x30067a[_0x3680('0x5a')]=_0x12858e['params']['id'];return _0x30067a;});var _0x106040=[];return BPromise[_0x3680('0x53')](_0x3fd951,function(_0xc1c03b){return db[_0x3680('0x51')][_0x3680('0x48')](_0xc1c03b,{'include':[{'model':db[_0x3680('0x55')],'as':'Resources'}],'raw':!![],'transaction':_0x59a7fb})[_0x3680('0x26')](function(_0x28306b){_0x106040[_0x3680('0x5b')](_0x28306b[_0x3680('0x4c')]({'plain':!![]}));});})[_0x3680('0x26')](function(){return _0x106040;});});});}})['then'](function(_0xeee9bb){return _0xeee9bb;})[_0x3680('0x26')](respondWithResult(_0x24a647,null))[_0x3680('0x45')](handleError(_0x24a647,null));};exports[_0x3680('0x5c')]=function(_0x488b84,_0x126e8){var _0x2ccf36;return db[_0x3680('0x2e')][_0x3680('0x4b')]({'where':{'id':_0x488b84[_0x3680('0x4a')]['id']},'attributes':['id',_0x3680('0x2b')]})[_0x3680('0x26')](handleEntityNotFound(_0x126e8,null))[_0x3680('0x26')](function(_0x435871){if(_0x435871){_0x2ccf36=_0x435871;return db[_0x3680('0x51')][_0x3680('0x27')]({'where':{'userProfileId':_0x488b84[_0x3680('0x4a')]['id'],'sectionId':_0x488b84[_0x3680('0x33')][_0x3680('0x5d')]}});}})[_0x3680('0x26')](function(){return _0x2ccf36;})[_0x3680('0x26')](respondWithStatusCode(_0x126e8,null))['catch'](handleError(_0x126e8,null));};exports[_0x3680('0x5e')]=function(_0x2741e5,_0x160167){var _0x2b4fc4=[];var _0x9eaaf5=[];return db[_0x3680('0x51')]['findAll']({'where':{'userProfileId':_0x2741e5['params']['id']},'raw':!![]})[_0x3680('0x26')](function(_0x3b75fe){_0x2b4fc4=_[_0x3680('0x40')](_0x3b75fe,function(_0x3c0dd4){return _0x3c0dd4[_0x3680('0x5f')]===0x1||_[_0x3680('0x60')]([0x3eb,0x709],_0x3c0dd4[_0x3680('0x59')]);});if(!_[_0x3680('0x61')](_0x2b4fc4)){return _[_0x3680('0x2d')](_0x2b4fc4,function(_0x53d637){return _0x53d637[_0x3680('0x59')];});}else{return;}})[_0x3680('0x26')](function(_0x299c11){if(_0x299c11)_0x9eaaf5=_0x299c11;if(_['includes'](_0x9eaaf5,0x64)){var _0x473652=_[_0x3680('0x4b')](_0x2b4fc4,{'sectionId':0x64});return hasDefaultDashboard(_0x473652)[_0x3680('0x26')](function(_0x96d95c){return _['map'](_0x2b4fc4,function(_0x164087){if(_0x164087[_0x3680('0x59')]===0x64){_0x164087['subsections']=_0x96d95c;}return _0x164087;});});}else{return;}})[_0x3680('0x26')](function(_0x320e32){if(_0x320e32)_0x2b4fc4=_0x320e32;if(_[_0x3680('0x60')](_0x9eaaf5,0x3eb)){var _0x1f1d65=_[_0x3680('0x4b')](_0x2b4fc4,{'sectionId':0x3eb});return getCustomDashboards(_0x1f1d65)[_0x3680('0x26')](function(_0x552a2d){return _[_0x3680('0x2d')](_0x2b4fc4,function(_0x390ddf){if(_0x1f1d65[_0x3680('0x5f')]){if(_0x390ddf[_0x3680('0x59')]===0x3eb){_0x390ddf[_0x3680('0x62')]=_0x552a2d;}}else{if(_0x390ddf[_0x3680('0x59')]===0x64){if(!_0x390ddf[_0x3680('0x62')]){_0x390ddf[_0x3680('0x62')]=[];}_0x390ddf['subsections']=_0x390ddf[_0x3680('0x62')][_0x3680('0x63')](_0x552a2d);}}return _0x390ddf;});});}else{return;}})['then'](function(_0x5994ef){if(_0x5994ef)_0x2b4fc4=_0x5994ef;if(_[_0x3680('0x60')](_0x9eaaf5,0x709)){var _0x4f143b=_[_0x3680('0x4b')](_0x2b4fc4,{'sectionId':0x709});return getPlugins(_0x4f143b)['then'](function(_0x3a43dc){if(_0x4f143b[_0x3680('0x5f')]){return _[_0x3680('0x2d')](_0x2b4fc4,function(_0x524d99){if(_0x524d99[_0x3680('0x59')]===0x709){_0x524d99['subsections']=_0x3a43dc;}return _0x524d99;});}else{var _0x5bb6c8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x3a43dc};var _0x495b60=_[_0x3680('0x2d')](_0x2b4fc4);_0x495b60[_0x3680('0x5b')](_0x5bb6c8);return _0x495b60;}});}else{return;}})[_0x3680('0x26')](function(_0x4059d8){if(_0x4059d8)_0x2b4fc4=_0x4059d8;return _[_0x3680('0x40')](_0x2b4fc4,[_0x3680('0x5f'),0x1]);})[_0x3680('0x26')](respondWithResult(_0x160167,null))['catch'](handleError(_0x160167,null));};function hasDefaultDashboard(_0x4a8004){var _0x3d1b30=[0x65];return new BPromise(function(_0x241bf3,_0xf724f8){try{if(_0x4a8004['autoAssociation']){_0x241bf3(_0x3d1b30);}else{return db[_0x3680('0x55')][_0x3680('0x64')]({'where':{'sectionId':_0x4a8004['id']},'raw':!![]})[_0x3680('0x26')](function(_0x2ff411){_0x2ff411?_0x241bf3(_0x3d1b30):_0x241bf3();});}}catch(_0x172195){_0xf724f8(_0x172195);}});}function getCustomDashboards(_0x5498ab){var _0x2eb07a=[];return new BPromise(function(_0xea05d9,_0x3aec67){try{if(_0x5498ab['autoAssociation']){return db[_0x3680('0x65')][_0x3680('0x52')]({'raw':!![]})[_0x3680('0x26')](function(_0x128d21){_0x128d21[_0x3680('0x66')](function(_0x55b8d6){_0x2eb07a['push'](_0x55b8d6['id']+0x1869f);});_0xea05d9(_0x2eb07a);});}else{return db[_0x3680('0x55')][_0x3680('0x52')]({'where':{'sectionId':_0x5498ab['id']},'raw':!![]})['then'](function(_0x6c75aa){_0x6c75aa['forEach'](function(_0x1558d0){_0x2eb07a[_0x3680('0x5b')](_0x1558d0[_0x3680('0x67')]+0x1869f);});_0xea05d9(_0x2eb07a);});}}catch(_0x1f829d){_0x3aec67(_0x1f829d);}});}function getPlugins(_0x3eca3a){var _0x12d0c6=[];return new BPromise(function(_0x1974a0,_0x5c6c88){try{if(_0x3eca3a[_0x3680('0x54')]){return db[_0x3680('0x68')][_0x3680('0x52')]({'raw':!![]})[_0x3680('0x26')](function(_0x5809d9){_0x5809d9[_0x3680('0x66')](function(_0x227565){_0x12d0c6['push'](_0x227565['id']+0x15b38);});_0x1974a0(_0x12d0c6);});}else{return db[_0x3680('0x55')][_0x3680('0x52')]({'where':{'sectionId':_0x3eca3a['id']},'raw':!![]})[_0x3680('0x26')](function(_0x4b5319){_0x4b5319[_0x3680('0x66')](function(_0x10ad5d){_0x12d0c6['push'](_0x10ad5d[_0x3680('0x67')]+0x15b38);});_0x1974a0(_0x12d0c6);});}}catch(_0x49294a){_0x5c6c88(_0x49294a);}});}exports[_0x3680('0x69')]=function(_0x3f766e,_0x1d0b36){return db['UserProfile'][_0x3680('0x4b')]({'where':{'id':_0x3f766e[_0x3680('0x4a')]['id']}})[_0x3680('0x26')](handleEntityNotFound(_0x1d0b36,null))[_0x3680('0x26')](function(_0x9cadfe){if(_0x9cadfe){return db[_0x3680('0x50')][_0x3680('0x6a')](function(_0x702c77){return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x3f766e[_0x3680('0x4a')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x4c0c62){if(_0x4c0c62){return db[_0x3680('0x51')]['destroy']({'where':{'userProfileId':_0x3f766e[_0x3680('0x4a')]['id'],'id':_[_0x3680('0x2d')](_0x4c0c62,function(_0x49c5b3){return _0x49c5b3['id'];})},'transaction':_0x702c77});}})['then'](function(_0x253234){var _0x3ed623=_[_0x3680('0x2d')](_0x3f766e['body'],function(_0x5e7853){_0x5e7853['userProfileId']=_0x3f766e[_0x3680('0x4a')]['id'];return _0x5e7853;});return db[_0x3680('0x51')][_0x3680('0x6b')](_0x3ed623,{'raw':!![],'transaction':_0x702c77});})[_0x3680('0x26')](function(_0x1a8b67){var _0x63fdd5=_[_0x3680('0x40')](_[_0x3680('0x2d')](_0x1a8b67,function(_0x4eb2eb){return _0x4eb2eb[_0x3680('0x4c')]({'plain':!![]});}),{'includeAll':![]});if(_0x63fdd5){return db[_0x3680('0x51')][_0x3680('0x52')]({'where':{'userProfileId':_0x3f766e[_0x3680('0x4a')]['id'],'sectionId':_[_0x3680('0x2d')](_0x63fdd5,function(_0x2f31e6){return _0x2f31e6['sectionId'];})},'attributes':['id',_0x3680('0x59')],'raw':!![]})[_0x3680('0x26')](function(_0x2dd610){var _0x58a814=_[_0x3680('0x2d')](_0x3f766e[_0x3680('0x49')],function(_0xec5eb){_0xec5eb['userProfileId']=_0x3f766e[_0x3680('0x4a')]['id'];return _0xec5eb;});return db['UserProfileResource'][_0x3680('0x6b')](_0x58a814,{'raw':!![],'transaction':_0x702c77});});}})[_0x3680('0x45')](handleError(_0x1d0b36,null));});}})[_0x3680('0x26')](function(_0x3d95fc){var _0x94d0be=_[_0x3680('0x2d')](_0x3d95fc,function(_0x1140ba){return _0x1140ba[_0x3680('0x4c')]({'plain':!![]});});})[_0x3680('0x26')](respondWithResult(_0x1d0b36,null))[_0x3680('0x45')](handleError(_0x1d0b36,null));};exports[_0x3680('0x6c')]=function(_0x1602ad,_0x5a0b62,_0x613193){return db[_0x3680('0x2e')][_0x3680('0x4b')]({'where':{'id':_0x1602ad['params']['id']}})[_0x3680('0x26')](handleEntityNotFound(_0x5a0b62,null))[_0x3680('0x26')](function(_0x28b5b7){if(_0x28b5b7){return _0x28b5b7['removeResources'](_0x1602ad['query'][_0x3680('0x5d')]);}})['then'](respondWithStatusCode(_0x5a0b62,null))[_0x3680('0x45')](handleError(_0x5a0b62,null));};exports[_0x3680('0x6d')]=function(_0x16cbde,_0x3262fe){var _0x412d28={};if(!_0x16cbde['query'][_0x3680('0x6e')])throw new Error(_0x3680('0x6f'));if(!_0x16cbde[_0x3680('0x33')][_0x3680('0x39')](_0x3680('0x3a'))){_0x412d28[_0x3680('0x21')]=qs[_0x3680('0x21')](_0x16cbde[_0x3680('0x33')]['limit']);_0x412d28[_0x3680('0x1f')]=qs[_0x3680('0x1f')](_0x16cbde[_0x3680('0x33')][_0x3680('0x1f')]);}return db['UserProfile'][_0x3680('0x4b')]({'where':{'id':_0x16cbde[_0x3680('0x4a')]['id']}})[_0x3680('0x26')](function(_0x4d6dfe){if(!_0x4d6dfe)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x16cbde[_0x3680('0x4a')]['id']);return db[_0x3680('0x2e')]['getResources'](_0x16cbde);})[_0x3680('0x26')](respondWithFilteredResult(_0x3262fe,_0x412d28))[_0x3680('0x45')](handleError(_0x3262fe,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index bcb649a..d3cc1f4 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 _0x81c6=['exports','../../mysqldb','update','remove','emit','hook'];(function(_0x27d023,_0x1592ac){var _0x15350b=function(_0x27edee){while(--_0x27edee){_0x27d023['push'](_0x27d023['shift']());}};_0x15350b(++_0x1592ac);}(_0x81c6,0x1d5));var _0x681c=function(_0x355ce8,_0x5f1d0a){_0x355ce8=_0x355ce8-0x0;var _0x1db8b8=_0x81c6[_0x355ce8];return _0x1db8b8;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0x681c('0x0'))['db']['UserProfile'];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x681c('0x1'),'afterDestroy':_0x681c('0x2')};function emitEvent(_0x7a556b){return function(_0x5566e5,_0x44c18e,_0x2aff9d){UserProfileEvents[_0x681c('0x3')](_0x7a556b+':'+_0x5566e5['id'],_0x5566e5);UserProfileEvents[_0x681c('0x3')](_0x7a556b,_0x5566e5);_0x2aff9d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x681c('0x4')](e,emitEvent(event));}}module[_0x681c('0x5')]=UserProfileEvents; \ No newline at end of file +var _0x3d3d=['emit','hasOwnProperty','exports','../../mysqldb','UserProfile','save','update','remove'];(function(_0x15afa2,_0x474af8){var _0x53242e=function(_0x31a2b4){while(--_0x31a2b4){_0x15afa2['push'](_0x15afa2['shift']());}};_0x53242e(++_0x474af8);}(_0x3d3d,0xab));var _0xd3d3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3d3d[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var UserProfile=require(_0xd3d3('0x0'))['db'][_0xd3d3('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xd3d3('0x2'),'afterUpdate':_0xd3d3('0x3'),'afterDestroy':_0xd3d3('0x4')};function emitEvent(_0x427bd5){return function(_0x1f03e9,_0x46aa0c,_0x3b43f2){UserProfileEvents[_0xd3d3('0x5')](_0x427bd5+':'+_0x1f03e9['id'],_0x1f03e9);UserProfileEvents[_0xd3d3('0x5')](_0x427bd5,_0x1f03e9);_0x3b43f2(null);};}for(var e in events){if(events[_0xd3d3('0x6')](e)){var event=events[e];UserProfile['hook'](e,emitEvent(event));}}module[_0xd3d3('0x7')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 8f357bb..bb48da9 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 _0xe7ee=['Users','admin','user','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','customdashboards','intervals','Interval','pauses','Pause','scheduler','Schedule','Sound','tags','Tag','triggers','Trigger','trunks','Trunk','Variable','plugins','Reports','AnalyticMetric','charAt','toUpperCase','slice','Sequelize','SELECT','select','ui.','from','user_has_','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','../../components/parsers/qs','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','find','params','all','ignore','union','length','push','autoAssociation','rawAttributes','keys','filters','intersection','fields','attributes','nolimit','limit','offset','sort','where','merge','key','VIRTUAL','foreignKey','options','include','forEach','default','reportId','DefaultReports','custom','CustomReports','rows','ids','customSorting','order','extraQueryConditions','count','includeAll','Tags','color','ThroughTags','tag','openTabs','chat','dataValues','sms','fax','mail','whatsapp','lodash','./userProfile.attributes','models','filter','field','findAll','associatedResources','map','value','model','then','name','catch','resolve','UserProfileResource','AnalyticExtractedReport','type','resourceId','squareprojects','childModel','SquareProject','odbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','contacts','CmContact','ListId','CmList','companies','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','outboundroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','telephone','VoiceQueues','VoiceQueue','inbound','QueueCampaigns','queue','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappAccount','teams','voicequeues','users','agents','telephones'];(function(_0x4fcfbe,_0x107dc6){var _0x50b203=function(_0x3a9083){while(--_0x3a9083){_0x4fcfbe['push'](_0x4fcfbe['shift']());}};_0x50b203(++_0x107dc6);}(_0xe7ee,0x12b));var _0xee7e=function(_0x3ae835,_0x3c9b77){_0x3ae835=_0x3ae835-0x0;var _0x256850=_0xe7ee[_0x3ae835];return _0x256850;};'use strict';var _=require(_0xee7e('0x0'));var attributes=require(_0xee7e('0x1'));var squel=require('squel');module['exports']=function(_0x178a0f){var _0x155219=_0x178a0f[_0xee7e('0x2')];function _0x2c2622(_0xcf532b,_0x1d111e){return new Promise(function(_0x44ce4b,_0xdd1554){if(!_0x1d111e)return _0x44ce4b(null);var _0x544afc=_0x1d111e[_0xee7e('0x3')]?{[_0x1d111e[_0xee7e('0x3')][_0xee7e('0x4')]]:_0x1d111e[_0xee7e('0x3')]['value']}:undefined;return _0x155219[_0xcf532b][_0xee7e('0x5')]({'where':_0x544afc,'raw':!![]})['then'](function(_0x582ee7){_0x1d111e[_0xee7e('0x6')]=_[_0xee7e('0x7')](_0x582ee7,'id');_0x44ce4b(_0x1d111e);})['catch'](function(_0x2608c4){_0xdd1554(_0x2608c4);});});}function _0x243b57(_0x169987,_0x51c0db){return new Promise(function(_0x337d69,_0x896bf6){var _0x3afeaa=_0x169987[_0xee7e('0x3')]?{[_0x169987[_0xee7e('0x3')]['field']]:_0x169987[_0xee7e('0x3')][_0xee7e('0x8')]}:undefined;return _0x155219[_0x169987[_0xee7e('0x9')]][_0xee7e('0x5')]({'where':_0x3afeaa,'raw':!![]})[_0xee7e('0xa')](function(_0x24a8f4){_0x51c0db[_0xee7e('0x6')]=_[_0xee7e('0x7')](_0x24a8f4,function(_0x39823c){return _0x39823c[_0xee7e('0xb')];});_0x337d69(_0x51c0db);})[_0xee7e('0xc')](function(_0x191511){_0x896bf6(_0x191511);});});}function _0x23928(_0x406192,_0x49eacb,_0x468142){if(!_0x49eacb)return Promise[_0xee7e('0xd')](null);return new Promise(function(_0xa11e12,_0x384db1){return _0x155219[_0xee7e('0xe')]['findAll']({'where':{'sectionId':_0x49eacb['id']},'raw':!![]})[_0xee7e('0xa')](function(_0x109fa5){if(_0x406192[_0xee7e('0x4')]&&_0x406192[_0xee7e('0x4')]!=='id'){_0x49eacb[_0xee7e('0x6')]=_[_0xee7e('0x7')](_0x109fa5,function(_0x106fcf){return _0x106fcf[_0x406192[_0xee7e('0x4')]];});}else{if(_0x468142===_0xee7e('0xf')){_0x49eacb[_0xee7e('0x6')]=_[_0xee7e('0x7')](_0x109fa5,function(_0x1d1ce3){return{'id':_0x1d1ce3['resourceId'],'type':_0x1d1ce3[_0xee7e('0x10')]};});}else{_0x49eacb['associatedResources']=_['map'](_0x109fa5,function(_0x237d9a){return _0x237d9a[_0xee7e('0x11')];});}}_0xa11e12(_0x49eacb);})[_0xee7e('0xc')](function(_0x13eb33){_0x384db1(_0x13eb33);});});}function _0xb522c7(_0x429010,_0x53b263){var _0xac5776={'parentSections':[]};switch(_0x429010['toLowerCase']()){case _0xee7e('0x12'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x14');break;case _0xee7e('0x15'):_0xac5776[_0xee7e('0x13')]='SquareOdbc';break;case _0xee7e('0x16'):_0xac5776['childModel']=_0xee7e('0x17');_0xac5776[_0xee7e('0x18')]=[{'name':_0xee7e('0x19'),'field':_0xee7e('0xb'),'foreignKey':_0xee7e('0x1a')}];break;case'projects':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x1b');break;case _0xee7e('0x1c'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x1d');_0xac5776[_0xee7e('0x18')]=[{'name':'Lists','field':'id','foreignKey':_0xee7e('0x1e')}];break;case'lists':_0xac5776['childModel']=_0xee7e('0x1f');break;case _0xee7e('0x20'):_0xac5776[_0xee7e('0x13')]='CmCompany';break;case'globalcustomfields':_0xac5776['childModel']='CmCustomField';break;case _0xee7e('0x21'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x22');break;case'chatwebsites':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x23');break;case'faxqueues':_0xac5776['childModel']=_0xee7e('0x24');break;case _0xee7e('0x25'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x26');break;case'inboundroutes':case'internalroutes':case _0xee7e('0x27'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x28');break;case _0xee7e('0x29'):_0xac5776['childModel']=_0xee7e('0x2a');break;case _0xee7e('0x2b'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x2c');break;case _0xee7e('0x2d'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x2e');_0xac5776['parentSections']=[{'name':_0xee7e('0x2f'),'field':_0xee7e('0xb'),'foreignKey':'membername','model':_0xee7e('0x30'),'filter':{'field':_0xee7e('0x31'),'value':[_0xee7e('0x32')]}},{'name':_0xee7e('0x33'),'field':'name','foreignKey':'membername','model':_0xee7e('0x30'),'filter':{'field':_0xee7e('0x31'),'value':[_0xee7e('0x34')]}},{'name':_0xee7e('0x35'),'field':_0xee7e('0xb'),'foreignKey':'queue','model':_0xee7e('0x36'),'filter':{'field':_0xee7e('0x10'),'value':[_0xee7e('0x37')]}},{'name':_0xee7e('0x38'),'field':_0xee7e('0xb'),'foreignKey':_0xee7e('0x39'),'model':_0xee7e('0x36'),'filter':{'field':'type','value':[_0xee7e('0x3a')]}}];break;case'musiconholds':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x3b');break;case _0xee7e('0x3c'):_0xac5776['childModel']=_0xee7e('0x3d');break;case _0xee7e('0x3e'):_0xac5776['childModel']=_0xee7e('0x3f');break;case'ivrcampaigns':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x40');break;case _0xee7e('0x41'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x42');break;case _0xee7e('0x43'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x44');break;case'mailsubstatuses':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x45');break;case _0xee7e('0x46'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x47');break;case _0xee7e('0x48'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x49');break;case _0xee7e('0x4a'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x4b');break;case _0xee7e('0x4c'):_0xac5776['childModel']=_0xee7e('0x4d');break;case _0xee7e('0x4e'):_0xac5776[_0xee7e('0x13')]='WhatsappQueue';break;case'whatsappaccounts':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x4f');break;case _0xee7e('0x50'):_0xac5776['childModel']='Team';break;case _0xee7e('0x51'):case'queuecampaigns':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x36');if(_0x53b263){_0xac5776['parentSections']=[{'name':_0xee7e('0x35')},{'name':_0xee7e('0x38')}];}break;case _0xee7e('0x52'):case _0xee7e('0x53'):case _0xee7e('0x54'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x30');if(_0x53b263){_0xac5776['parentSections']=[{'name':_0xee7e('0x55'),'filter':{'field':_0xee7e('0x31'),'value':[_0xee7e('0x56'),_0xee7e('0x57')]},'ignore':!![]},{'name':_0xee7e('0x2f')},{'name':_0xee7e('0x33')}];}break;case _0xee7e('0x58'):_0xac5776['childModel']=_0xee7e('0x59');break;case _0xee7e('0x5a'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x5b');break;case _0xee7e('0x5c'):_0xac5776['childModel']=_0xee7e('0x5d');break;case _0xee7e('0x5e'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x5f');break;case'deskaccounts':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x60');break;case _0xee7e('0x61'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x62');break;case _0xee7e('0x63'):_0xac5776['childModel']=_0xee7e('0x30');break;case _0xee7e('0x64'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x65');break;case _0xee7e('0x66'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x67');break;case _0xee7e('0x68'):_0xac5776[_0xee7e('0x13')]='Dashboard';break;case _0xee7e('0x69'):_0xac5776['childModel']=_0xee7e('0x6a');break;case _0xee7e('0x6b'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x6c');break;case _0xee7e('0x6d'):_0xac5776['childModel']=_0xee7e('0x6e');break;case'sounds':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x6f');break;case _0xee7e('0x70'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x71');break;case'templates':_0xac5776[_0xee7e('0x13')]='Template';break;case _0xee7e('0x72'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x73');break;case _0xee7e('0x74'):_0xac5776[_0xee7e('0x13')]=_0xee7e('0x75');break;case'variables':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x76');break;case _0xee7e('0x77'):_0xac5776['childModel']='Plugin';break;case'extractedreports':_0xac5776['childModel']=_0xee7e('0xf');_0xac5776['parentSections']=[{'name':_0xee7e('0x78'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0xac5776[_0xee7e('0x13')]=_0xee7e('0x79');break;}return _0xac5776;}function _0x23a83f(_0x2e67c5,_0x42c045){var _0x4fd259=_0x2e67c5[_0xee7e('0x7a')](0x0)[_0xee7e('0x7b')]()+_0x2e67c5[_0xee7e('0x7c')](0x1);var _0x288ab2={'type':_0x155219[_0xee7e('0x7d')]['QueryTypes'][_0xee7e('0x7e')],'raw':!![]};return new Promise(function(_0x16e9ea,_0x5e023d){var _0x59a1b8=squel[_0xee7e('0x7f')]()[_0xee7e('0x4')](_0xee7e('0x80')+_0x4fd259+'InteractionId','id')[_0xee7e('0x4')]('ui.createdAt')[_0xee7e('0x81')](_0xee7e('0x82')+_0x2e67c5+'_interactions','ui')['where']('ui.UserId\x20=\x20?',_0x42c045['id']);return _0x155219[_0xee7e('0x83')]['query'](_0x59a1b8[_0xee7e('0x84')](),_0x288ab2)[_0xee7e('0xa')](function(_0x39e032){_0x42c045[_0x4fd259+_0xee7e('0x85')]=_0x39e032;_0x16e9ea(_0x39e032);})[_0xee7e('0xc')](function(_0x11fed9){_0x5e023d(_0x11fed9);});});}return _0x178a0f[_0xee7e('0x86')](_0xee7e('0x87'),attributes,{'tableName':_0xee7e('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x1c3e01){var _0x592910=require(_0xee7e('0x89'));var _0x5dba06={'raw':_0x1c3e01['query']['raw'],'where':{}};var _0x1e6b98={};var _0x39b59f={'count':0x0,'rows':[]};var _0x5f3edf=_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0x8b')];var _0x2dc719=_0x1c3e01['query'][_0xee7e('0x8c')]||![];var _0x3470f4=_0xb522c7(_0x5f3edf,_0x2dc719);if(!_0x3470f4['childModel'])throw new Error(_0xee7e('0x8d')+_0x5f3edf+'\x27');var _0x4bc8e1=[{'name':_0x5f3edf}];if(!_[_0xee7e('0x8e')](_0x3470f4[_0xee7e('0x18')]))_0x4bc8e1=_0x3470f4['parentSections'];var _0x2998b4=[];for(var _0x3ee20b=0x0;_0x3ee20b<_0x4bc8e1['length'];_0x3ee20b++){_0x2998b4['push'](_0x155219['UserProfileSection'][_0xee7e('0x8f')]({'where':{'userProfileId':_0x1c3e01[_0xee7e('0x90')]['id'],'name':_0x4bc8e1[_0x3ee20b][_0xee7e('0xb')]},'raw':!![]}));}return Promise[_0xee7e('0x91')](_0x2998b4)[_0xee7e('0xa')](function(_0x10205e){var _0x88788e=_[_0xee7e('0x3')](_0x10205e,function(_0x475adb){return _0x475adb?_0x475adb:undefined;});var _0x53d62d=_[_0xee7e('0x3')](_0x4bc8e1,[_0xee7e('0x92'),!![]]);var _0x353bec=_[_0xee7e('0x8e')](_0x88788e)&&_['isEmpty'](_0x53d62d)?null:_[_0xee7e('0x93')](_0x53d62d,_0x88788e);if(!_0x353bec)return null;var _0x34d33a=[];for(var _0x5a1881=0x0;_0x5a1881<_0x353bec[_0xee7e('0x94')];_0x5a1881++){var _0x1e4cfc=_['find'](_0x4bc8e1,function(_0x4bc0cd){return _0x353bec[_0x5a1881]?_0x4bc0cd[_0xee7e('0xb')]===_0x353bec[_0x5a1881]['name']:null;});if(_0x1e4cfc){if(_0x353bec[_0x5a1881]['ignore']){_0x34d33a[_0xee7e('0x95')](_0x2c2622(_0x3470f4['childModel'],_0x353bec[_0x5a1881]));}else{if(!_0x353bec[_0x5a1881][_0xee7e('0x96')]){_0x34d33a[_0xee7e('0x95')](_0x23928(_0x1e4cfc,_0x353bec[_0x5a1881],_0x3470f4['childModel']));}else{if(_0x1e4cfc['model']){_0x34d33a[_0xee7e('0x95')](_0x243b57(_0x1e4cfc,_0x353bec[_0x5a1881]));}}}}}return Promise[_0xee7e('0x91')](_0x34d33a);})[_0xee7e('0xa')](function(_0x4cd64b){var _0x24f592=_0x4cd64b;var _0x31207e=null;if(_0x24f592){_0x31207e=_0x24f592[_0xee7e('0x94')]===0x1?_0x24f592[0x0]:null;}if(!_0x31207e&&!_0x24f592)return _0x39b59f;var _0x550306=_0x155219[_0x3470f4[_0xee7e('0x13')]][_0xee7e('0x97')];_0x1e6b98[_0xee7e('0x9')]=_[_0xee7e('0x98')](_0x550306);_0x1e6b98[_0xee7e('0x8a')]=_['keys'](_0x1c3e01['query']);_0x1e6b98[_0xee7e('0x99')]=_['intersection'](_0x1e6b98['model'],_0x1e6b98[_0xee7e('0x8a')]);_0x5dba06['attributes']=_[_0xee7e('0x9a')](_0x1e6b98[_0xee7e('0x9')],_0x592910[_0xee7e('0x9b')](_0x1c3e01[_0xee7e('0x8a')]['fields']));_0x5dba06['attributes']=_0x5dba06[_0xee7e('0x9c')]['length']?_0x5dba06[_0xee7e('0x9c')]:_0x1e6b98['model'];if(!_0x1c3e01[_0xee7e('0x8a')]['hasOwnProperty'](_0xee7e('0x9d'))){_0x5dba06[_0xee7e('0x9e')]=_0x592910[_0xee7e('0x9e')](_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0x9e')]);_0x5dba06[_0xee7e('0x9f')]=_0x592910[_0xee7e('0x9f')](_0x1c3e01['query'][_0xee7e('0x9f')]);}_0x5dba06['order']=_0x592910[_0xee7e('0xa0')](_0x1c3e01['query']['sort']);_0x5dba06[_0xee7e('0xa1')]=_0x592910[_0xee7e('0x99')](_['pick'](_0x1c3e01[_0xee7e('0x8a')],_0x1e6b98[_0xee7e('0x99')]));if(_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0x3')]){_0x5dba06[_0xee7e('0xa1')]=_[_0xee7e('0xa2')](_0x5dba06[_0xee7e('0xa1')],{'$or':_[_0xee7e('0x7')](_0x550306,function(_0x469507){if(_0x469507[_0xee7e('0x10')][_0xee7e('0xa3')]!==_0xee7e('0xa4')){var _0xbc89c7={};_0xbc89c7[_0x469507[_0xee7e('0x4')]]={'$like':'%'+_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0x3')]+'%'};return _0xbc89c7;}})});}var _0x28e221=[];var _0x42d4d5=null;var _0x212f45={};if(_0x31207e){_0x42d4d5=_['find'](_0x4bc8e1,['name',_0x31207e[_0xee7e('0xb')]]);if(_0x42d4d5[_0xee7e('0x4')]){_0x212f45={};if(_0x3470f4[_0xee7e('0x13')]==='AnalyticExtractedReport'){_0x212f45[_0x42d4d5[_0xee7e('0xa5')]]=_[_0xee7e('0x7')](_0x31207e[_0xee7e('0x6')],'id');}else{_0x212f45[_0x42d4d5['foreignKey']]=_0x31207e[_0xee7e('0x6')];}_0x28e221[_0xee7e('0x95')](_0x212f45);}else{_0x5dba06[_0xee7e('0xa1')]['id']=_0x31207e[_0xee7e('0x6')];}}else{for(var _0x134e74=0x0;_0x134e74<_0x24f592[_0xee7e('0x94')];_0x134e74++){_0x42d4d5=_[_0xee7e('0x8f')](_0x4bc8e1,[_0xee7e('0xb'),_0x24f592[_0x134e74]['name']]);if(_0x42d4d5[_0xee7e('0x4')]){_0x212f45={};_0x212f45[_0x42d4d5[_0xee7e('0xa5')]]=_0x24f592[_0x134e74][_0xee7e('0x6')];_0x28e221[_0xee7e('0x95')](_0x212f45);}else{if(!_0x5dba06[_0xee7e('0xa1')]['id'])_0x5dba06[_0xee7e('0xa1')]['id']=[];_0x24f592[_0x134e74][_0xee7e('0x6')]['forEach'](function(_0x41ed2f){_0x5dba06[_0xee7e('0xa1')]['id'][_0xee7e('0x95')](_0x41ed2f);});}}}if(!_['isEmpty'](_0x28e221)){_0x5dba06[_0xee7e('0xa1')]=_[_0xee7e('0xa2')](_0x5dba06[_0xee7e('0xa1')],{'$and':{'$or':_0x28e221}});}_0x5dba06=_[_0xee7e('0xa2')]({},_0x5dba06,_0x1c3e01[_0xee7e('0xa6')]);if(_0x31207e&&!_0x31207e[_0xee7e('0x96')]&&_0x3470f4[_0xee7e('0x13')]===_0xee7e('0xf')){if(_0x1c3e01[_0xee7e('0x8a')]['includeAll']){_0x5dba06[_0xee7e('0xa7')]=[{'all':!![]}];}return _0x155219[_0x3470f4[_0xee7e('0x13')]]['findAll'](_0x5dba06)[_0xee7e('0xa')](function(_0x2b46f1){var _0x477753=[];_0x2b46f1[_0xee7e('0xa8')](function(_0x24a85f){var _0x41ce76;switch(_0x24a85f['reportType']){case _0xee7e('0xa9'):_0x41ce76=_['find'](_0x31207e['associatedResources'],function(_0x47db62){return _0x47db62['id']===_0x24a85f[_0xee7e('0xaa')]&&_0x47db62[_0xee7e('0x10')]===_0xee7e('0xab');});break;case _0xee7e('0xac'):_0x41ce76=_[_0xee7e('0x8f')](_0x31207e[_0xee7e('0x6')],function(_0x3c1b24){return _0x3c1b24['id']===_0x24a85f[_0xee7e('0xaa')]&&_0x3c1b24[_0xee7e('0x10')]===_0xee7e('0xad');});break;}if(_0x41ce76)_0x477753['push'](_0x24a85f);});_0x39b59f['count']=_0x477753['length'];_0x39b59f[_0xee7e('0xae')]=_0x477753;return _0x39b59f;});}else{if(!_[_0xee7e('0x8e')](_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xaf')])){_0x5dba06[_0xee7e('0xa1')]['id']=_0x5dba06[_0xee7e('0xa1')]['id']?_['intersection'](_0x5dba06[_0xee7e('0xa1')]['id'],_0x1c3e01['query'][_0xee7e('0xaf')]):_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xaf')];if(_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xb0')]){_0x5dba06[_0xee7e('0xb1')]=_0x1c3e01['query']['customSorting'];}}if(_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xb2')]){_0x5dba06['where']=_[_0xee7e('0xa2')](_0x5dba06[_0xee7e('0xa1')],{'$and':_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xb2')]});}return _0x155219[_0x3470f4[_0xee7e('0x13')]][_0xee7e('0xb3')]({'where':_0x5dba06[_0xee7e('0xa1')]})[_0xee7e('0xa')](function(_0x3f4b38){_0x39b59f['count']=_0x3f4b38;if(_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xb4')]){if(_0x3470f4[_0xee7e('0x13')]===_0xee7e('0x1d')){_0x5dba06[_0xee7e('0xa7')]=[{'model':_0x155219[_0xee7e('0x71')],'as':_0xee7e('0xb5'),'attributes':['id',_0xee7e('0xb'),_0xee7e('0xb6')],'required':_0x1c3e01['query']['tag']?!![]:![]},{'model':_0x155219[_0xee7e('0x71')],'as':_0xee7e('0xb7'),'attributes':['id',_0xee7e('0xb'),'color'],'through':_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xb8')]?{'attributes':[],'where':{'TagId':_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xb8')]||undefined}}:{},'required':_0x1c3e01[_0xee7e('0x8a')]['tag']?!![]:![]}];}else{_0x5dba06[_0xee7e('0xa7')]=[{'all':!![]}];}}return _0x155219[_0x3470f4[_0xee7e('0x13')]]['findAll'](_0x5dba06);})['then'](function(_0x22d349){_0x39b59f['rows']=_0x22d349;if(_0x5f3edf===_0xee7e('0x2f')&&_0x1c3e01[_0xee7e('0x8a')][_0xee7e('0xb9')]==='true'){var _0x3e58bd=[];for(var _0x1bda08=0x0;_0x1bda08<_0x39b59f[_0xee7e('0xae')][_0xee7e('0x94')];_0x1bda08++){_0x3e58bd[_0xee7e('0x95')](_0x23a83f(_0xee7e('0xba'),_0x39b59f[_0xee7e('0xae')][_0x1bda08][_0xee7e('0xbb')]));_0x3e58bd[_0xee7e('0x95')](_0x23a83f(_0xee7e('0xbc'),_0x39b59f[_0xee7e('0xae')][_0x1bda08]['dataValues']));_0x3e58bd[_0xee7e('0x95')](_0x23a83f(_0xee7e('0xbd'),_0x39b59f['rows'][_0x1bda08][_0xee7e('0xbb')]));_0x3e58bd[_0xee7e('0x95')](_0x23a83f(_0xee7e('0xbe'),_0x39b59f[_0xee7e('0xae')][_0x1bda08][_0xee7e('0xbb')]));_0x3e58bd[_0xee7e('0x95')](_0x23a83f('openchannel',_0x39b59f[_0xee7e('0xae')][_0x1bda08][_0xee7e('0xbb')]));_0x3e58bd['push'](_0x23a83f(_0xee7e('0xbf'),_0x39b59f[_0xee7e('0xae')][_0x1bda08][_0xee7e('0xbb')]));}return Promise[_0xee7e('0x91')](_0x3e58bd)[_0xee7e('0xa')](function(){return _0x39b59f;});}return _0x39b59f;});}});}}});}; \ No newline at end of file +var _0xf417=['tags','Tag','templates','Template','trunks','variables','Variable','plugins','Plugin','extractedreports','Reports','reportId','AnalyticMetric','toUpperCase','slice','Sequelize','QueryTypes','SELECT','select','ui.','InteractionId','ui.createdAt','from','user_has_','where','ui.UserId\x20=\x20?','sequelize','query','OpenTabs','UserProfile','../../components/parsers/qs','raw','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','UserProfileSection','find','params','all','ignore','length','autoAssociation','push','rawAttributes','keys','filters','attributes','intersection','fields','nolimit','limit','offset','sort','pick','merge','key','VIRTUAL','AnalyticExtractedReport','foreignKey','forEach','includeAll','include','default','DefaultReports','custom','CustomReports','count','rows','ids','customSorting','order','Tags','color','tag','ThroughTags','openTabs','true','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','./userProfile.attributes','squel','models','filter','findAll','then','associatedResources','map','catch','value','model','name','resolve','UserProfileResource','field','resourceId','type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projectName','JscriptyProject','contacts','CmContact','Lists','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','inboundroutes','internalroutes','outboundroutes','VoiceContext','VoiceMail','VoiceRecording','Agents','membername','User','role','agent','Telephones','telephone','queue','inbound','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','Team','voicequeues','queuecampaigns','QueueCampaigns','users','agents','Users','admin','user','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Interval','pauses','Pause','scheduler','Schedule','sounds','Sound'];(function(_0x4dae23,_0x1d2011){var _0x44bd79=function(_0x450c29){while(--_0x450c29){_0x4dae23['push'](_0x4dae23['shift']());}};_0x44bd79(++_0x1d2011);}(_0xf417,0x1d9));var _0x7f41=function(_0x2ea857,_0x466b31){_0x2ea857=_0x2ea857-0x0;var _0x20429a=_0xf417[_0x2ea857];return _0x20429a;};'use strict';var _=require(_0x7f41('0x0'));var attributes=require(_0x7f41('0x1'));var squel=require(_0x7f41('0x2'));module['exports']=function(_0x164855){var _0x329a6a=_0x164855[_0x7f41('0x3')];function _0xda29dd(_0x49a6ee,_0x549570){return new Promise(function(_0x467f61,_0x4a7a33){if(!_0x549570)return _0x467f61(null);var _0x3065a9=_0x549570['filter']?{[_0x549570[_0x7f41('0x4')]['field']]:_0x549570[_0x7f41('0x4')]['value']}:undefined;return _0x329a6a[_0x49a6ee][_0x7f41('0x5')]({'where':_0x3065a9,'raw':!![]})[_0x7f41('0x6')](function(_0x2eae9c){_0x549570[_0x7f41('0x7')]=_[_0x7f41('0x8')](_0x2eae9c,'id');_0x467f61(_0x549570);})[_0x7f41('0x9')](function(_0x5a39c4){_0x4a7a33(_0x5a39c4);});});}function _0x46fff9(_0x20486a,_0x998dc8){return new Promise(function(_0x1173ff,_0x183f8d){var _0x35d5b7=_0x20486a[_0x7f41('0x4')]?{[_0x20486a[_0x7f41('0x4')]['field']]:_0x20486a[_0x7f41('0x4')][_0x7f41('0xa')]}:undefined;return _0x329a6a[_0x20486a[_0x7f41('0xb')]][_0x7f41('0x5')]({'where':_0x35d5b7,'raw':!![]})[_0x7f41('0x6')](function(_0x22fb9c){_0x998dc8[_0x7f41('0x7')]=_['map'](_0x22fb9c,function(_0x21b4fc){return _0x21b4fc[_0x7f41('0xc')];});_0x1173ff(_0x998dc8);})[_0x7f41('0x9')](function(_0x20d9e3){_0x183f8d(_0x20d9e3);});});}function _0x4cd962(_0x3b0638,_0xbd8f1f,_0x1d68d){if(!_0xbd8f1f)return Promise[_0x7f41('0xd')](null);return new Promise(function(_0x42cee5,_0x43ee42){return _0x329a6a[_0x7f41('0xe')]['findAll']({'where':{'sectionId':_0xbd8f1f['id']},'raw':!![]})['then'](function(_0x26dec4){if(_0x3b0638[_0x7f41('0xf')]&&_0x3b0638['field']!=='id'){_0xbd8f1f[_0x7f41('0x7')]=_[_0x7f41('0x8')](_0x26dec4,function(_0x23f225){return _0x23f225[_0x3b0638[_0x7f41('0xf')]];});}else{if(_0x1d68d==='AnalyticExtractedReport'){_0xbd8f1f[_0x7f41('0x7')]=_[_0x7f41('0x8')](_0x26dec4,function(_0x12f200){return{'id':_0x12f200[_0x7f41('0x10')],'type':_0x12f200[_0x7f41('0x11')]};});}else{_0xbd8f1f[_0x7f41('0x7')]=_[_0x7f41('0x8')](_0x26dec4,function(_0x448525){return _0x448525[_0x7f41('0x10')];});}}_0x42cee5(_0xbd8f1f);})['catch'](function(_0x2db40d){_0x43ee42(_0x2db40d);});});}function _0x482878(_0x386ae6,_0x4e2c96){var _0x340f1a={'parentSections':[]};switch(_0x386ae6[_0x7f41('0x12')]()){case _0x7f41('0x13'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x15');break;case _0x7f41('0x16'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x17');break;case _0x7f41('0x18'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x19');_0x340f1a[_0x7f41('0x1a')]=[{'name':_0x7f41('0x1b'),'field':_0x7f41('0xc'),'foreignKey':_0x7f41('0x1c')}];break;case'projects':_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x1d');break;case _0x7f41('0x1e'):_0x340f1a['childModel']=_0x7f41('0x1f');_0x340f1a[_0x7f41('0x1a')]=[{'name':_0x7f41('0x20'),'field':'id','foreignKey':'ListId'}];break;case _0x7f41('0x21'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x22');break;case _0x7f41('0x23'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x24');break;case _0x7f41('0x25'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x26');break;case _0x7f41('0x27'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x28');break;case _0x7f41('0x29'):_0x340f1a[_0x7f41('0x14')]='ChatWebsite';break;case _0x7f41('0x2a'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x2b');break;case _0x7f41('0x2c'):_0x340f1a[_0x7f41('0x14')]='FaxAccount';break;case _0x7f41('0x2d'):case _0x7f41('0x2e'):case _0x7f41('0x2f'):_0x340f1a[_0x7f41('0x14')]='VoiceExtension';break;case'contexts':_0x340f1a['childModel']=_0x7f41('0x30');break;case'voicemails':_0x340f1a['childModel']=_0x7f41('0x31');break;case'voicerecordings':_0x340f1a['childModel']=_0x7f41('0x32');_0x340f1a[_0x7f41('0x1a')]=[{'name':_0x7f41('0x33'),'field':_0x7f41('0xc'),'foreignKey':_0x7f41('0x34'),'model':_0x7f41('0x35'),'filter':{'field':_0x7f41('0x36'),'value':[_0x7f41('0x37')]}},{'name':_0x7f41('0x38'),'field':_0x7f41('0xc'),'foreignKey':_0x7f41('0x34'),'model':'User','filter':{'field':_0x7f41('0x36'),'value':[_0x7f41('0x39')]}},{'name':'VoiceQueues','field':_0x7f41('0xc'),'foreignKey':_0x7f41('0x3a'),'model':'VoiceQueue','filter':{'field':_0x7f41('0x11'),'value':[_0x7f41('0x3b')]}},{'name':'QueueCampaigns','field':'name','foreignKey':'queue','model':'VoiceQueue','filter':{'field':_0x7f41('0x11'),'value':[_0x7f41('0x3c')]}}];break;case _0x7f41('0x3d'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x3e');break;case _0x7f41('0x3f'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x40');break;case'voiceprefixes':_0x340f1a[_0x7f41('0x14')]='VoicePrefix';break;case'ivrcampaigns':_0x340f1a['childModel']=_0x7f41('0x41');break;case _0x7f41('0x42'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x43');break;case _0x7f41('0x44'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x45');break;case _0x7f41('0x46'):_0x340f1a[_0x7f41('0x14')]='MailSubstatus';break;case'openchannelqueues':_0x340f1a[_0x7f41('0x14')]='OpenchannelQueue';break;case'openchannelaccounts':_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x47');break;case _0x7f41('0x48'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x49');break;case _0x7f41('0x4a'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x4b');break;case _0x7f41('0x4c'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x4d');break;case _0x7f41('0x4e'):_0x340f1a[_0x7f41('0x14')]='WhatsappAccount';break;case'teams':_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x4f');break;case _0x7f41('0x50'):case _0x7f41('0x51'):_0x340f1a[_0x7f41('0x14')]='VoiceQueue';if(_0x4e2c96){_0x340f1a[_0x7f41('0x1a')]=[{'name':'VoiceQueues'},{'name':_0x7f41('0x52')}];}break;case _0x7f41('0x53'):case _0x7f41('0x54'):case'telephones':_0x340f1a['childModel']=_0x7f41('0x35');if(_0x4e2c96){_0x340f1a[_0x7f41('0x1a')]=[{'name':_0x7f41('0x55'),'filter':{'field':_0x7f41('0x36'),'value':[_0x7f41('0x56'),_0x7f41('0x57')]},'ignore':!![]},{'name':_0x7f41('0x33')},{'name':_0x7f41('0x38')}];}break;case'zendeskaccounts':_0x340f1a[_0x7f41('0x14')]='ZendeskAccount';break;case'salesforceaccounts':_0x340f1a['childModel']=_0x7f41('0x58');break;case _0x7f41('0x59'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x5a');break;case _0x7f41('0x5b'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x5c');break;case _0x7f41('0x5d'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x5e');break;case _0x7f41('0x5f'):_0x340f1a['childModel']=_0x7f41('0x60');break;case _0x7f41('0x61'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x35');break;case _0x7f41('0x62'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x63');break;case _0x7f41('0x64'):_0x340f1a['childModel']=_0x7f41('0x65');break;case'customdashboards':_0x340f1a[_0x7f41('0x14')]='Dashboard';break;case'intervals':_0x340f1a['childModel']=_0x7f41('0x66');break;case _0x7f41('0x67'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x68');break;case _0x7f41('0x69'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x6a');break;case _0x7f41('0x6b'):_0x340f1a['childModel']=_0x7f41('0x6c');break;case _0x7f41('0x6d'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x6e');break;case _0x7f41('0x6f'):_0x340f1a['childModel']=_0x7f41('0x70');break;case'triggers':_0x340f1a[_0x7f41('0x14')]='Trigger';break;case _0x7f41('0x71'):_0x340f1a[_0x7f41('0x14')]='Trunk';break;case _0x7f41('0x72'):_0x340f1a['childModel']=_0x7f41('0x73');break;case _0x7f41('0x74'):_0x340f1a[_0x7f41('0x14')]=_0x7f41('0x75');break;case _0x7f41('0x76'):_0x340f1a['childModel']='AnalyticExtractedReport';_0x340f1a[_0x7f41('0x1a')]=[{'name':_0x7f41('0x77'),'field':'id','foreignKey':_0x7f41('0x78')}];break;case'metrics':_0x340f1a['childModel']=_0x7f41('0x79');break;}return _0x340f1a;}function _0xa27d59(_0x3e844a,_0xa51b1c){var _0x4d3fa8=_0x3e844a['charAt'](0x0)[_0x7f41('0x7a')]()+_0x3e844a[_0x7f41('0x7b')](0x1);var _0x17622b={'type':_0x329a6a[_0x7f41('0x7c')][_0x7f41('0x7d')][_0x7f41('0x7e')],'raw':!![]};return new Promise(function(_0x561ffa,_0x326815){var _0xf8f09a=squel[_0x7f41('0x7f')]()[_0x7f41('0xf')](_0x7f41('0x80')+_0x4d3fa8+_0x7f41('0x81'),'id')['field'](_0x7f41('0x82'))[_0x7f41('0x83')](_0x7f41('0x84')+_0x3e844a+'_interactions','ui')[_0x7f41('0x85')](_0x7f41('0x86'),_0xa51b1c['id']);return _0x329a6a[_0x7f41('0x87')][_0x7f41('0x88')](_0xf8f09a['toString'](),_0x17622b)[_0x7f41('0x6')](function(_0x4f64b1){_0xa51b1c[_0x4d3fa8+_0x7f41('0x89')]=_0x4f64b1;_0x561ffa(_0x4f64b1);})[_0x7f41('0x9')](function(_0x5cf308){_0x326815(_0x5cf308);});});}return _0x164855['define'](_0x7f41('0x8a'),attributes,{'tableName':'user_profiles','paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x3d7a77){var _0x1957bb=require(_0x7f41('0x8b'));var _0x41fae6={'raw':_0x3d7a77[_0x7f41('0x88')][_0x7f41('0x8c')],'where':{}};var _0x3eb2af={};var _0x15f4e5={'count':0x0,'rows':[]};var _0x5a8c9e=_0x3d7a77[_0x7f41('0x88')][_0x7f41('0x8d')];var _0x269b07=_0x3d7a77[_0x7f41('0x88')][_0x7f41('0x8e')]||![];var _0x35edf7=_0x482878(_0x5a8c9e,_0x269b07);if(!_0x35edf7[_0x7f41('0x14')])throw new Error(_0x7f41('0x8f')+_0x5a8c9e+'\x27');var _0x36cd10=[{'name':_0x5a8c9e}];if(!_[_0x7f41('0x90')](_0x35edf7['parentSections']))_0x36cd10=_0x35edf7['parentSections'];var _0x39bf40=[];for(var _0x16cc0d=0x0;_0x16cc0d<_0x36cd10['length'];_0x16cc0d++){_0x39bf40['push'](_0x329a6a[_0x7f41('0x91')][_0x7f41('0x92')]({'where':{'userProfileId':_0x3d7a77[_0x7f41('0x93')]['id'],'name':_0x36cd10[_0x16cc0d]['name']},'raw':!![]}));}return Promise[_0x7f41('0x94')](_0x39bf40)[_0x7f41('0x6')](function(_0x435289){var _0x3c7169=_[_0x7f41('0x4')](_0x435289,function(_0x582350){return _0x582350?_0x582350:undefined;});var _0x48b8e8=_[_0x7f41('0x4')](_0x36cd10,[_0x7f41('0x95'),!![]]);var _0x29d6d5=_[_0x7f41('0x90')](_0x3c7169)&&_[_0x7f41('0x90')](_0x48b8e8)?null:_['union'](_0x48b8e8,_0x3c7169);if(!_0x29d6d5)return null;var _0x70d4e9=[];for(var _0x89d198=0x0;_0x89d198<_0x29d6d5[_0x7f41('0x96')];_0x89d198++){var _0x681e0=_[_0x7f41('0x92')](_0x36cd10,function(_0x1b0375){return _0x29d6d5[_0x89d198]?_0x1b0375[_0x7f41('0xc')]===_0x29d6d5[_0x89d198][_0x7f41('0xc')]:null;});if(_0x681e0){if(_0x29d6d5[_0x89d198][_0x7f41('0x95')]){_0x70d4e9['push'](_0xda29dd(_0x35edf7['childModel'],_0x29d6d5[_0x89d198]));}else{if(!_0x29d6d5[_0x89d198][_0x7f41('0x97')]){_0x70d4e9[_0x7f41('0x98')](_0x4cd962(_0x681e0,_0x29d6d5[_0x89d198],_0x35edf7[_0x7f41('0x14')]));}else{if(_0x681e0[_0x7f41('0xb')]){_0x70d4e9[_0x7f41('0x98')](_0x46fff9(_0x681e0,_0x29d6d5[_0x89d198]));}}}}}return Promise['all'](_0x70d4e9);})[_0x7f41('0x6')](function(_0x3b4be9){var _0x784d7f=_0x3b4be9;var _0x105d0a=null;if(_0x784d7f){_0x105d0a=_0x784d7f['length']===0x1?_0x784d7f[0x0]:null;}if(!_0x105d0a&&!_0x784d7f)return _0x15f4e5;var _0x89b75b=_0x329a6a[_0x35edf7[_0x7f41('0x14')]][_0x7f41('0x99')];_0x3eb2af[_0x7f41('0xb')]=_[_0x7f41('0x9a')](_0x89b75b);_0x3eb2af[_0x7f41('0x88')]=_[_0x7f41('0x9a')](_0x3d7a77[_0x7f41('0x88')]);_0x3eb2af[_0x7f41('0x9b')]=_['intersection'](_0x3eb2af[_0x7f41('0xb')],_0x3eb2af['query']);_0x41fae6[_0x7f41('0x9c')]=_[_0x7f41('0x9d')](_0x3eb2af['model'],_0x1957bb['fields'](_0x3d7a77[_0x7f41('0x88')][_0x7f41('0x9e')]));_0x41fae6[_0x7f41('0x9c')]=_0x41fae6['attributes'][_0x7f41('0x96')]?_0x41fae6['attributes']:_0x3eb2af[_0x7f41('0xb')];if(!_0x3d7a77[_0x7f41('0x88')]['hasOwnProperty'](_0x7f41('0x9f'))){_0x41fae6[_0x7f41('0xa0')]=_0x1957bb['limit'](_0x3d7a77[_0x7f41('0x88')]['limit']);_0x41fae6[_0x7f41('0xa1')]=_0x1957bb['offset'](_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xa1')]);}_0x41fae6['order']=_0x1957bb[_0x7f41('0xa2')](_0x3d7a77[_0x7f41('0x88')]['sort']);_0x41fae6['where']=_0x1957bb[_0x7f41('0x9b')](_[_0x7f41('0xa3')](_0x3d7a77[_0x7f41('0x88')],_0x3eb2af['filters']));if(_0x3d7a77[_0x7f41('0x88')][_0x7f41('0x4')]){_0x41fae6[_0x7f41('0x85')]=_[_0x7f41('0xa4')](_0x41fae6[_0x7f41('0x85')],{'$or':_[_0x7f41('0x8')](_0x89b75b,function(_0x157730){if(_0x157730[_0x7f41('0x11')][_0x7f41('0xa5')]!==_0x7f41('0xa6')){var _0x410f84={};_0x410f84[_0x157730[_0x7f41('0xf')]]={'$like':'%'+_0x3d7a77['query'][_0x7f41('0x4')]+'%'};return _0x410f84;}})});}var _0x840a0b=[];var _0x1e8c7c=null;var _0x32f4cb={};if(_0x105d0a){_0x1e8c7c=_[_0x7f41('0x92')](_0x36cd10,['name',_0x105d0a[_0x7f41('0xc')]]);if(_0x1e8c7c['field']){_0x32f4cb={};if(_0x35edf7['childModel']===_0x7f41('0xa7')){_0x32f4cb[_0x1e8c7c['foreignKey']]=_[_0x7f41('0x8')](_0x105d0a['associatedResources'],'id');}else{_0x32f4cb[_0x1e8c7c[_0x7f41('0xa8')]]=_0x105d0a[_0x7f41('0x7')];}_0x840a0b['push'](_0x32f4cb);}else{_0x41fae6['where']['id']=_0x105d0a[_0x7f41('0x7')];}}else{for(var _0x3ec4cb=0x0;_0x3ec4cb<_0x784d7f['length'];_0x3ec4cb++){_0x1e8c7c=_['find'](_0x36cd10,['name',_0x784d7f[_0x3ec4cb][_0x7f41('0xc')]]);if(_0x1e8c7c[_0x7f41('0xf')]){_0x32f4cb={};_0x32f4cb[_0x1e8c7c[_0x7f41('0xa8')]]=_0x784d7f[_0x3ec4cb][_0x7f41('0x7')];_0x840a0b[_0x7f41('0x98')](_0x32f4cb);}else{if(!_0x41fae6[_0x7f41('0x85')]['id'])_0x41fae6[_0x7f41('0x85')]['id']=[];_0x784d7f[_0x3ec4cb][_0x7f41('0x7')][_0x7f41('0xa9')](function(_0x58854d){_0x41fae6[_0x7f41('0x85')]['id'][_0x7f41('0x98')](_0x58854d);});}}}if(!_[_0x7f41('0x90')](_0x840a0b)){_0x41fae6[_0x7f41('0x85')]=_[_0x7f41('0xa4')](_0x41fae6[_0x7f41('0x85')],{'$and':{'$or':_0x840a0b}});}_0x41fae6=_['merge']({},_0x41fae6,_0x3d7a77['options']);if(_0x105d0a&&!_0x105d0a[_0x7f41('0x97')]&&_0x35edf7[_0x7f41('0x14')]===_0x7f41('0xa7')){if(_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xaa')]){_0x41fae6[_0x7f41('0xab')]=[{'all':!![]}];}return _0x329a6a[_0x35edf7['childModel']]['findAll'](_0x41fae6)[_0x7f41('0x6')](function(_0x2ad62c){var _0x3f80d7=[];_0x2ad62c[_0x7f41('0xa9')](function(_0x3e850a){var _0x1a24cc;switch(_0x3e850a['reportType']){case _0x7f41('0xac'):_0x1a24cc=_[_0x7f41('0x92')](_0x105d0a['associatedResources'],function(_0x20fa73){return _0x20fa73['id']===_0x3e850a[_0x7f41('0x78')]&&_0x20fa73[_0x7f41('0x11')]===_0x7f41('0xad');});break;case _0x7f41('0xae'):_0x1a24cc=_[_0x7f41('0x92')](_0x105d0a[_0x7f41('0x7')],function(_0x938aad){return _0x938aad['id']===_0x3e850a[_0x7f41('0x78')]&&_0x938aad[_0x7f41('0x11')]===_0x7f41('0xaf');});break;}if(_0x1a24cc)_0x3f80d7[_0x7f41('0x98')](_0x3e850a);});_0x15f4e5[_0x7f41('0xb0')]=_0x3f80d7[_0x7f41('0x96')];_0x15f4e5[_0x7f41('0xb1')]=_0x3f80d7;return _0x15f4e5;});}else{if(!_[_0x7f41('0x90')](_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb2')])){_0x41fae6[_0x7f41('0x85')]['id']=_0x41fae6[_0x7f41('0x85')]['id']?_[_0x7f41('0x9d')](_0x41fae6[_0x7f41('0x85')]['id'],_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb2')]):_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb2')];if(_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb3')]){_0x41fae6[_0x7f41('0xb4')]=_0x3d7a77[_0x7f41('0x88')]['customSorting'];}}if(_0x3d7a77['query']['extraQueryConditions']){_0x41fae6[_0x7f41('0x85')]=_['merge'](_0x41fae6[_0x7f41('0x85')],{'$and':_0x3d7a77[_0x7f41('0x88')]['extraQueryConditions']});}return _0x329a6a[_0x35edf7[_0x7f41('0x14')]][_0x7f41('0xb0')]({'where':_0x41fae6['where']})[_0x7f41('0x6')](function(_0x4750a8){_0x15f4e5[_0x7f41('0xb0')]=_0x4750a8;if(_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xaa')]){if(_0x35edf7[_0x7f41('0x14')]===_0x7f41('0x1f')){_0x41fae6[_0x7f41('0xab')]=[{'model':_0x329a6a[_0x7f41('0x6e')],'as':_0x7f41('0xb5'),'attributes':['id',_0x7f41('0xc'),_0x7f41('0xb6')],'required':_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb7')]?!![]:![]},{'model':_0x329a6a[_0x7f41('0x6e')],'as':_0x7f41('0xb8'),'attributes':['id',_0x7f41('0xc'),_0x7f41('0xb6')],'through':_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb7')]?{'attributes':[],'where':{'TagId':_0x3d7a77['query'][_0x7f41('0xb7')]||undefined}}:{},'required':_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb7')]?!![]:![]}];}else{_0x41fae6[_0x7f41('0xab')]=[{'all':!![]}];}}return _0x329a6a[_0x35edf7[_0x7f41('0x14')]][_0x7f41('0x5')](_0x41fae6);})['then'](function(_0x512c67){_0x15f4e5[_0x7f41('0xb1')]=_0x512c67;if(_0x5a8c9e===_0x7f41('0x33')&&_0x3d7a77[_0x7f41('0x88')][_0x7f41('0xb9')]===_0x7f41('0xba')){var _0x4e3b3b=[];for(var _0x4033e5=0x0;_0x4033e5<_0x15f4e5[_0x7f41('0xb1')][_0x7f41('0x96')];_0x4033e5++){_0x4e3b3b[_0x7f41('0x98')](_0xa27d59(_0x7f41('0xbb'),_0x15f4e5[_0x7f41('0xb1')][_0x4033e5][_0x7f41('0xbc')]));_0x4e3b3b[_0x7f41('0x98')](_0xa27d59(_0x7f41('0xbd'),_0x15f4e5[_0x7f41('0xb1')][_0x4033e5]['dataValues']));_0x4e3b3b[_0x7f41('0x98')](_0xa27d59(_0x7f41('0xbe'),_0x15f4e5['rows'][_0x4033e5][_0x7f41('0xbc')]));_0x4e3b3b[_0x7f41('0x98')](_0xa27d59(_0x7f41('0xbf'),_0x15f4e5[_0x7f41('0xb1')][_0x4033e5][_0x7f41('0xbc')]));_0x4e3b3b[_0x7f41('0x98')](_0xa27d59(_0x7f41('0xc0'),_0x15f4e5[_0x7f41('0xb1')][_0x4033e5][_0x7f41('0xbc')]));_0x4e3b3b['push'](_0xa27d59(_0x7f41('0xc1'),_0x15f4e5[_0x7f41('0xb1')][_0x4033e5][_0x7f41('0xbc')]));}return Promise[_0x7f41('0x94')](_0x4e3b3b)[_0x7f41('0x6')](function(){return _0x15f4e5;});}return _0x15f4e5;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index d5823c8..5d9987f 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 _0xf0f4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','randomstring','ioredis','../../config/utils'];(function(_0x46cc04,_0x5a6bef){var _0x400c05=function(_0x885527){while(--_0x885527){_0x46cc04['push'](_0x46cc04['shift']());}};_0x400c05(++_0x5a6bef);}(_0xf0f4,0x182));var _0x4f0f=function(_0x197ddb,_0x5e757d){_0x197ddb=_0x197ddb-0x0;var _0x1c3171=_0xf0f4[_0x197ddb];return _0x1c3171;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f0f('0x1'));var fs=require('fs');var Redis=require(_0x4f0f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f0f('0x3'));var logger=require(_0x4f0f('0x4'))(_0x4f0f('0x5'));var config=require(_0x4f0f('0x6'));var jayson=require(_0x4f0f('0x7'));var client=jayson[_0x4f0f('0x8')][_0x4f0f('0x9')]({'port':0x232a});config['redis']=_[_0x4f0f('0xa')](config[_0x4f0f('0xb')],{'host':_0x4f0f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f0f('0xb')]));require(_0x4f0f('0xd'))[_0x4f0f('0xe')](socket);function respondWithRpcPromise(_0x3754fc,_0x343c30,_0xb41508){return new BPromise(function(_0x9533a3,_0x2b2e49){return client['request'](_0x3754fc,_0xb41508)[_0x4f0f('0xf')](function(_0x315d01){logger[_0x4f0f('0x10')](_0x4f0f('0x11'),_0x343c30,_0x4f0f('0x12'));logger[_0x4f0f('0x13')](_0x4f0f('0x14'),_0x343c30,_0x4f0f('0x12'),JSON[_0x4f0f('0x15')](_0x315d01));if(_0x315d01[_0x4f0f('0x16')]){if(_0x315d01[_0x4f0f('0x16')]['code']===0x1f4){logger[_0x4f0f('0x16')](_0x4f0f('0x11'),_0x343c30,_0x315d01[_0x4f0f('0x16')][_0x4f0f('0x17')]);return _0x2b2e49(_0x315d01['error'][_0x4f0f('0x17')]);}logger[_0x4f0f('0x16')](_0x4f0f('0x11'),_0x343c30,_0x315d01[_0x4f0f('0x16')][_0x4f0f('0x17')]);return _0x9533a3(_0x315d01['error'][_0x4f0f('0x17')]);}else{logger[_0x4f0f('0x10')](_0x4f0f('0x11'),_0x343c30,'request\x20sent');_0x9533a3(_0x315d01[_0x4f0f('0x18')][_0x4f0f('0x17')]);}})[_0x4f0f('0x19')](function(_0x5f5363){logger[_0x4f0f('0x16')](_0x4f0f('0x11'),_0x343c30,_0x5f5363);_0x2b2e49(_0x5f5363);});});} \ No newline at end of file +var _0xf0f4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./userProfile.socket','register','then','info','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','randomstring','ioredis','../../config/utils'];(function(_0x908d2e,_0x1e52b7){var _0x2be763=function(_0x59d4a3){while(--_0x59d4a3){_0x908d2e['push'](_0x908d2e['shift']());}};_0x2be763(++_0x1e52b7);}(_0xf0f4,0x182));var _0x4f0f=function(_0x4acbed,_0x2c0822){_0x4acbed=_0x4acbed-0x0;var _0x398861=_0xf0f4[_0x4acbed];return _0x398861;};'use strict';var _=require('lodash');var util=require(_0x4f0f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4f0f('0x1'));var fs=require('fs');var Redis=require(_0x4f0f('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x4f0f('0x3'));var logger=require(_0x4f0f('0x4'))(_0x4f0f('0x5'));var config=require(_0x4f0f('0x6'));var jayson=require(_0x4f0f('0x7'));var client=jayson[_0x4f0f('0x8')][_0x4f0f('0x9')]({'port':0x232a});config['redis']=_[_0x4f0f('0xa')](config[_0x4f0f('0xb')],{'host':_0x4f0f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4f0f('0xb')]));require(_0x4f0f('0xd'))[_0x4f0f('0xe')](socket);function respondWithRpcPromise(_0x3754fc,_0x343c30,_0xb41508){return new BPromise(function(_0x9533a3,_0x2b2e49){return client['request'](_0x3754fc,_0xb41508)[_0x4f0f('0xf')](function(_0x315d01){logger[_0x4f0f('0x10')](_0x4f0f('0x11'),_0x343c30,_0x4f0f('0x12'));logger[_0x4f0f('0x13')](_0x4f0f('0x14'),_0x343c30,_0x4f0f('0x12'),JSON[_0x4f0f('0x15')](_0x315d01));if(_0x315d01[_0x4f0f('0x16')]){if(_0x315d01[_0x4f0f('0x16')]['code']===0x1f4){logger[_0x4f0f('0x16')](_0x4f0f('0x11'),_0x343c30,_0x315d01[_0x4f0f('0x16')][_0x4f0f('0x17')]);return _0x2b2e49(_0x315d01['error'][_0x4f0f('0x17')]);}logger[_0x4f0f('0x16')](_0x4f0f('0x11'),_0x343c30,_0x315d01[_0x4f0f('0x16')][_0x4f0f('0x17')]);return _0x9533a3(_0x315d01['error'][_0x4f0f('0x17')]);}else{logger[_0x4f0f('0x10')](_0x4f0f('0x11'),_0x343c30,'request\x20sent');_0x9533a3(_0x315d01[_0x4f0f('0x18')][_0x4f0f('0x17')]);}})[_0x4f0f('0x19')](function(_0x5f5363){logger[_0x4f0f('0x16')](_0x4f0f('0x11'),_0x343c30,_0x5f5363);_0x2b2e49(_0x5f5363);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index b936ef8..cbc16dd 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 _0x747e=['save','remove','emit','removeListener','length','./userProfile.events'];(function(_0x3fc51b,_0x5b2bbf){var _0x3a5937=function(_0x4fbc7c){while(--_0x4fbc7c){_0x3fc51b['push'](_0x3fc51b['shift']());}};_0x3a5937(++_0x5b2bbf);}(_0x747e,0x1a3));var _0xe747=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x747e[_0x2112d4];return _0x434972;};'use strict';var UserProfileEvents=require(_0xe747('0x0'));var events=[_0xe747('0x1'),_0xe747('0x2'),'update'];function createListener(_0x4df7ee,_0x25e02c){return function(_0x39308f){_0x25e02c[_0xe747('0x3')](_0x4df7ee,_0x39308f);};}function removeListener(_0x28052d,_0x5aec72){return function(){UserProfileEvents[_0xe747('0x4')](_0x28052d,_0x5aec72);};}exports['register']=function(_0x5f4f4f){for(var _0x381e8d=0x0,_0x3a2be9=events[_0xe747('0x5')];_0x381e8d<_0x3a2be9;_0x381e8d++){var _0xc7267f=events[_0x381e8d];var _0xa07809=createListener('userProfile:'+_0xc7267f,_0x5f4f4f);UserProfileEvents['on'](_0xc7267f,_0xa07809);}}; \ No newline at end of file +var _0xf15f=['register','length','./userProfile.events','save','remove','update','emit'];(function(_0x571c1d,_0x3b0586){var _0x33c609=function(_0x226499){while(--_0x226499){_0x571c1d['push'](_0x571c1d['shift']());}};_0x33c609(++_0x3b0586);}(_0xf15f,0x18a));var _0xff15=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xf15f[_0x45d3f0];return _0x314b79;};'use strict';var UserProfileEvents=require(_0xff15('0x0'));var events=[_0xff15('0x1'),_0xff15('0x2'),_0xff15('0x3')];function createListener(_0x595eac,_0x19e62b){return function(_0x537278){_0x19e62b[_0xff15('0x4')](_0x595eac,_0x537278);};}function removeListener(_0x594063,_0xe2678f){return function(){UserProfileEvents['removeListener'](_0x594063,_0xe2678f);};}exports[_0xff15('0x5')]=function(_0x3ecaa6){for(var _0x5e6b91=0x0,_0x2ec6b1=events[_0xff15('0x6')];_0x5e6b91<_0x2ec6b1;_0x5e6b91++){var _0x533d2a=events[_0x5e6b91];var _0x321348=createListener('userProfile:'+_0x533d2a,_0x3ecaa6);UserProfileEvents['on'](_0x533d2a,_0x321348);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 1967aa8..fd826fb 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 _0x791a=['Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','create','put','delete','multer','util','connect-timeout'];(function(_0x355f95,_0x369c0b){var _0x5e5db5=function(_0x59ef48){while(--_0x59ef48){_0x355f95['push'](_0x355f95['shift']());}};_0x5e5db5(++_0x369c0b);}(_0x791a,0x75));var _0xa791=function(_0x28486d,_0x191eb1){_0x28486d=_0x28486d-0x0;var _0x4a0a94=_0x791a[_0x28486d];return _0x4a0a94;};'use strict';var multer=require(_0xa791('0x0'));var util=require(_0xa791('0x1'));var path=require('path');var timeout=require(_0xa791('0x2'));var express=require('express');var router=express[_0xa791('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa791('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xa791('0x5'));var controller=require('./userProfileResource.controller');router[_0xa791('0x6')]('/',auth[_0xa791('0x7')](),controller[_0xa791('0x8')]);router[_0xa791('0x6')](_0xa791('0x9'),auth[_0xa791('0x7')](),controller['describe']);router[_0xa791('0x6')](_0xa791('0xa'),auth[_0xa791('0x7')](),controller[_0xa791('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa791('0xc')]);router[_0xa791('0xd')](_0xa791('0xa'),auth[_0xa791('0x7')](),controller['update']);router[_0xa791('0xe')]('/:id',auth[_0xa791('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xbe27=['../../components/auth/service','../../components/interaction/service','get','index','/describe','describe','isAuthenticated','show','post','create','put','/:id','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x127155,_0x25c0be){var _0x1aac6a=function(_0x352c31){while(--_0x352c31){_0x127155['push'](_0x127155['shift']());}};_0x1aac6a(++_0x25c0be);}(_0xbe27,0xa2));var _0x7be2=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbe27[_0x6c993a];return _0x27f547;};'use strict';var multer=require(_0x7be2('0x0'));var util=require(_0x7be2('0x1'));var path=require('path');var timeout=require(_0x7be2('0x2'));var express=require(_0x7be2('0x3'));var router=express[_0x7be2('0x4')]();var fs_extra=require(_0x7be2('0x5'));var auth=require(_0x7be2('0x6'));var interaction=require(_0x7be2('0x7'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0x7be2('0x8')]('/',auth['isAuthenticated'](),controller[_0x7be2('0x9')]);router[_0x7be2('0x8')](_0x7be2('0xa'),auth['isAuthenticated'](),controller[_0x7be2('0xb')]);router[_0x7be2('0x8')]('/:id',auth[_0x7be2('0xc')](),controller[_0x7be2('0xd')]);router[_0x7be2('0xe')]('/',auth['isAuthenticated'](),controller[_0x7be2('0xf')]);router[_0x7be2('0x10')](_0x7be2('0x11'),auth['isAuthenticated'](),controller[_0x7be2('0x12')]);router[_0x7be2('0x13')](_0x7be2('0x11'),auth[_0x7be2('0xc')](),controller['destroy']);module[_0x7be2('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index 0e9aeb9..ff7f8ab 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 _0x4cfb=['STRING','INTEGER','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4cfb,0x68));var _0xb4cf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x4cfb[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0xb4cf('0x0'));module['exports']={'name':{'type':Sequelize[_0xb4cf('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0xb4cf('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb4cf('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x7d32=['INTEGER','STRING'];(function(_0x331e10,_0x67934){var _0x5b770d=function(_0x1baad1){while(--_0x1baad1){_0x331e10['push'](_0x331e10['shift']());}};_0x5b770d(++_0x67934);}(_0x7d32,0x155));var _0x27d3=function(_0x39fb92,_0x239c1d){_0x39fb92=_0x39fb92-0x0;var _0x5157c7=_0x7d32[_0x39fb92];return _0x5157c7;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x27d3('0x0')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x27d3('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x27d3('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index c6dd1f3..694963d 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 _0x57ca=['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','UserProfileResource','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','options','includeAll','include','findAll','params','find','catch','create','body','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox'];(function(_0x5d9c31,_0x46a08d){var _0x579098=function(_0x5811a3){while(--_0x5811a3){_0x5d9c31['push'](_0x5d9c31['shift']());}};_0x579098(++_0x46a08d);}(_0x57ca,0x108));var _0xa57c=function(_0x12fe1c,_0x270bbf){_0x12fe1c=_0x12fe1c-0x0;var _0x42b22a=_0x57ca[_0x12fe1c];return _0x42b22a;};'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['UserProfileResource']['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')](_0x247906['body'],{})['then'](respondWithResult(_0x44ea0a,0xc9))['catch'](handleError(_0x44ea0a,null));};exports['update']=function(_0x232675,_0x49492f){if(_0x232675[_0xa57c('0x42')]['id']){delete _0x232675[_0xa57c('0x42')]['id'];}return db['UserProfileResource'][_0xa57c('0x3f')]({'where':{'id':_0x232675[_0xa57c('0x3e')]['id']}})[_0xa57c('0x21')](handleEntityNotFound(_0x49492f,null))[_0xa57c('0x21')](saveUpdates(_0x232675[_0xa57c('0x42')],null))['then'](respondWithResult(_0x49492f,null))[_0xa57c('0x40')](handleError(_0x49492f,null));};exports[_0xa57c('0x22')]=function(_0x4584e8,_0xd57bac){return db[_0xa57c('0x2a')]['find']({'where':{'id':_0x4584e8[_0xa57c('0x3e')]['id']}})['then'](handleEntityNotFound(_0xd57bac,null))['then'](removeEntity(_0xd57bac,null))[_0xa57c('0x40')](handleError(_0xd57bac,null));};exports[_0xa57c('0x43')]=function(_0x5ded49,_0x5bf336){return db['UserProfileResource'][_0xa57c('0x43')]()[_0xa57c('0x21')](respondWithResult(_0x5bf336,null))[_0xa57c('0x40')](handleError(_0x5bf336,null));}; \ No newline at end of file +var _0xc1c6=['filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','UserProfileResource','rawAttributes','type','key','model','query'];(function(_0x41da6d,_0x341211){var _0x4e81c7=function(_0x422549){while(--_0x422549){_0x41da6d['push'](_0x41da6d['shift']());}};_0x4e81c7(++_0x341211);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x2adaf2,_0x511aad){_0x2adaf2=_0x2adaf2-0x0;var _0x4f5ff9=_0xc1c6[_0x2adaf2];return _0x4f5ff9;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['UserProfileResource']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['UserProfileResource'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['UserProfileResource'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['UserProfileResource']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));};exports[_0x6c1c('0x49')]=function(_0x2450ab,_0x5489ac){return db['UserProfileResource'][_0x6c1c('0x49')]()[_0x6c1c('0x25')](respondWithResult(_0x5489ac,null))['catch'](handleError(_0x5489ac,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 7f592b1..afc73d2 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 _0x640b=['./userProfileResource.attributes','exports','define','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','lodash','util','../../config/logger','api','moment','../../config/environment'];(function(_0x3712e2,_0x32d752){var _0x1faff4=function(_0x550dc0){while(--_0x550dc0){_0x3712e2['push'](_0x3712e2['shift']());}};_0x1faff4(++_0x32d752);}(_0x640b,0x1ce));var _0xb640=function(_0x268202,_0x4ff2ff){_0x268202=_0x268202-0x0;var _0x1847aa=_0x640b[_0x268202];return _0x1847aa;};'use strict';var _=require(_0xb640('0x0'));var util=require(_0xb640('0x1'));var logger=require(_0xb640('0x2'))(_0xb640('0x3'));var moment=require(_0xb640('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb640('0x5'));var attributes=require(_0xb640('0x6'));module[_0xb640('0x7')]=function(_0x6c1e83,_0x2f2969){return _0x6c1e83[_0xb640('0x8')](_0xb640('0x9'),attributes,{'tableName':_0xb640('0xa'),'paranoid':![],'indexes':[{'name':_0xb640('0xb'),'fields':[_0xb640('0xc'),'sectionId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xa7e3=['exports','define','sectionId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileResource.attributes'];(function(_0x47e455,_0x4fe7ce){var _0x1996a5=function(_0x56c5be){while(--_0x56c5be){_0x47e455['push'](_0x47e455['shift']());}};_0x1996a5(++_0x4fe7ce);}(_0xa7e3,0x129));var _0x3a7e=function(_0x2d47d7,_0x5ab8db){_0x2d47d7=_0x2d47d7-0x0;var _0x32ac35=_0xa7e3[_0x2d47d7];return _0x32ac35;};'use strict';var _=require(_0x3a7e('0x0'));var util=require(_0x3a7e('0x1'));var logger=require(_0x3a7e('0x2'))(_0x3a7e('0x3'));var moment=require(_0x3a7e('0x4'));var BPromise=require(_0x3a7e('0x5'));var rp=require(_0x3a7e('0x6'));var fs=require('fs');var path=require(_0x3a7e('0x7'));var rimraf=require(_0x3a7e('0x8'));var config=require(_0x3a7e('0x9'));var attributes=require(_0x3a7e('0xa'));module[_0x3a7e('0xb')]=function(_0x3bed89,_0x1441f3){return _0x3bed89[_0x3a7e('0xc')]('UserProfileResource',attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':'compositeIndex','fields':['resourceId',_0x3a7e('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 3d7e4ea..43073df 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 _0xa646=['jayson/promise','client','http','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','util','bluebird','randomstring','ioredis','../../config/environment'];(function(_0x46b1bd,_0x1940d9){var _0x1b2f0e=function(_0x2b242d){while(--_0x2b242d){_0x46b1bd['push'](_0x46b1bd['shift']());}};_0x1b2f0e(++_0x1940d9);}(_0xa646,0xaf));var _0x6a64=function(_0x18770c,_0xdf9da8){_0x18770c=_0x18770c-0x0;var _0x37c722=_0xa646[_0x18770c];return _0x37c722;};'use strict';var _=require('lodash');var util=require(_0x6a64('0x0'));var moment=require('moment');var BPromise=require(_0x6a64('0x1'));var rs=require(_0x6a64('0x2'));var fs=require('fs');var Redis=require(_0x6a64('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6a64('0x4'));var jayson=require(_0x6a64('0x5'));var client=jayson[_0x6a64('0x6')][_0x6a64('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4e944a,_0x215d29,_0x43191e){return new BPromise(function(_0x2d883f,_0x18c586){return client[_0x6a64('0x8')](_0x4e944a,_0x43191e)[_0x6a64('0x9')](function(_0x44784e){logger[_0x6a64('0xa')](_0x6a64('0xb'),_0x215d29,_0x6a64('0xc'));logger['debug'](_0x6a64('0xd'),_0x215d29,_0x6a64('0xc'),JSON[_0x6a64('0xe')](_0x44784e));if(_0x44784e[_0x6a64('0xf')]){if(_0x44784e[_0x6a64('0xf')][_0x6a64('0x10')]===0x1f4){logger['error'](_0x6a64('0xb'),_0x215d29,_0x44784e[_0x6a64('0xf')][_0x6a64('0x11')]);return _0x18c586(_0x44784e[_0x6a64('0xf')][_0x6a64('0x11')]);}logger[_0x6a64('0xf')](_0x6a64('0xb'),_0x215d29,_0x44784e['error']['message']);return _0x2d883f(_0x44784e[_0x6a64('0xf')][_0x6a64('0x11')]);}else{logger[_0x6a64('0xa')](_0x6a64('0xb'),_0x215d29,_0x6a64('0xc'));_0x2d883f(_0x44784e['result'][_0x6a64('0x11')]);}})['catch'](function(_0x5de8f7){logger[_0x6a64('0xf')]('UserProfileResource,\x20%s,\x20%s',_0x215d29,_0x5de8f7);_0x18c586(_0x5de8f7);});});} \ No newline at end of file +var _0xc33f=['moment','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserProfileResource,\x20%s,\x20%s','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util'];(function(_0x28947d,_0x4cc9c6){var _0x12d2ee=function(_0x3f38fc){while(--_0x3f38fc){_0x28947d['push'](_0x28947d['shift']());}};_0x12d2ee(++_0x4cc9c6);}(_0xc33f,0x143));var _0xfc33=function(_0x1fd6b0,_0x5a40a0){_0x1fd6b0=_0x1fd6b0-0x0;var _0x202a08=_0xc33f[_0x1fd6b0];return _0x202a08;};'use strict';var _=require('lodash');var util=require(_0xfc33('0x0'));var moment=require(_0xfc33('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc33('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfc33('0x3'))(_0xfc33('0x4'));var config=require(_0xfc33('0x5'));var jayson=require(_0xfc33('0x6'));var client=jayson['client'][_0xfc33('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x59aa17,_0x6fd69b,_0x4e2c33){return new BPromise(function(_0x50dccc,_0x361dcf){return client[_0xfc33('0x8')](_0x59aa17,_0x4e2c33)['then'](function(_0x3baf53){logger[_0xfc33('0x9')](_0xfc33('0xa'),_0x6fd69b,'request\x20sent');logger['debug'](_0xfc33('0xb'),_0x6fd69b,_0xfc33('0xc'),JSON[_0xfc33('0xd')](_0x3baf53));if(_0x3baf53[_0xfc33('0xe')]){if(_0x3baf53['error'][_0xfc33('0xf')]===0x1f4){logger[_0xfc33('0xe')](_0xfc33('0xa'),_0x6fd69b,_0x3baf53[_0xfc33('0xe')][_0xfc33('0x10')]);return _0x361dcf(_0x3baf53['error'][_0xfc33('0x10')]);}logger[_0xfc33('0xe')](_0xfc33('0xa'),_0x6fd69b,_0x3baf53[_0xfc33('0xe')][_0xfc33('0x10')]);return _0x50dccc(_0x3baf53[_0xfc33('0xe')]['message']);}else{logger[_0xfc33('0x9')](_0xfc33('0xa'),_0x6fd69b,_0xfc33('0xc'));_0x50dccc(_0x3baf53['result'][_0xfc33('0x10')]);}})[_0xfc33('0x11')](function(_0x23d61e){logger[_0xfc33('0xe')]('UserProfileResource,\x20%s,\x20%s',_0x6fd69b,_0x23d61e);_0x361dcf(_0x23d61e);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index c02e63e..9a41df6 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 _0x94ea=['delete','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','/:id','post','update'];(function(_0x2031aa,_0x2e4f04){var _0xd5db15=function(_0x21fd75){while(--_0x21fd75){_0x2031aa['push'](_0x2031aa['shift']());}};_0xd5db15(++_0x2e4f04);}(_0x94ea,0xce));var _0xa94e=function(_0x335f5c,_0xce622c){_0x335f5c=_0x335f5c-0x0;var _0x27458c=_0x94ea[_0x335f5c];return _0x27458c;};'use strict';var multer=require('multer');var util=require(_0xa94e('0x0'));var path=require(_0xa94e('0x1'));var timeout=require(_0xa94e('0x2'));var express=require('express');var router=express[_0xa94e('0x3')]();var fs_extra=require(_0xa94e('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xa94e('0x5'));var config=require(_0xa94e('0x6'));var controller=require(_0xa94e('0x7'));router[_0xa94e('0x8')]('/',auth[_0xa94e('0x9')](),controller[_0xa94e('0xa')]);router['get'](_0xa94e('0xb'),auth[_0xa94e('0x9')](),controller['describe']);router['get'](_0xa94e('0xc'),auth[_0xa94e('0x9')](),controller['show']);router[_0xa94e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa94e('0xc'),auth['isAuthenticated'](),controller[_0xa94e('0xe')]);router[_0xa94e('0xf')]('/:id',auth[_0xa94e('0x9')](),controller['destroy']);module[_0xa94e('0x10')]=router; \ No newline at end of file +var _0xdc95=['util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','/describe','describe','/:id','show','post','update','delete','destroy','exports','multer'];(function(_0x21b244,_0x45285c){var _0x28267e=function(_0x17a6e6){while(--_0x17a6e6){_0x21b244['push'](_0x21b244['shift']());}};_0x28267e(++_0x45285c);}(_0xdc95,0x18f));var _0x5dc9=function(_0xea3b9d,_0x5114d7){_0xea3b9d=_0xea3b9d-0x0;var _0x4ef41a=_0xdc95[_0xea3b9d];return _0x4ef41a;};'use strict';var multer=require(_0x5dc9('0x0'));var util=require(_0x5dc9('0x1'));var path=require(_0x5dc9('0x2'));var timeout=require(_0x5dc9('0x3'));var express=require(_0x5dc9('0x4'));var router=express[_0x5dc9('0x5')]();var fs_extra=require(_0x5dc9('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x5dc9('0x7'));var config=require('../../config/environment');var controller=require(_0x5dc9('0x8'));router[_0x5dc9('0x9')]('/',auth[_0x5dc9('0xa')](),controller['index']);router['get'](_0x5dc9('0xb'),auth[_0x5dc9('0xa')](),controller[_0x5dc9('0xc')]);router['get'](_0x5dc9('0xd'),auth['isAuthenticated'](),controller[_0x5dc9('0xe')]);router[_0x5dc9('0xf')]('/',auth[_0x5dc9('0xa')](),controller['create']);router['put']('/:id',auth['isAuthenticated'](),controller[_0x5dc9('0x10')]);router[_0x5dc9('0x11')](_0x5dc9('0xd'),auth[_0x5dc9('0xa')](),controller[_0x5dc9('0x12')]);module[_0x5dc9('0x13')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index a6f8237..3d88c20 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 _0x63a5=['STRING','INTEGER','BOOLEAN','setDataValue','getDataValue','crudPermissions','sequelize','exports'];(function(_0x30f68d,_0x12cb44){var _0x4ac6bf=function(_0x15da9c){while(--_0x15da9c){_0x30f68d['push'](_0x30f68d['shift']());}};_0x4ac6bf(++_0x12cb44);}(_0x63a5,0x18e));var _0x563a=function(_0x4b73a2,_0x40b5fe){_0x4b73a2=_0x4b73a2-0x0;var _0x383c66=_0x63a5[_0x4b73a2];return _0x383c66;};'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 +var _0x57f8=['join','getDataValue','split','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0x57f8,0x198));var _0x857f=function(_0x25e214,_0x42a13e){_0x25e214=_0x25e214-0x0;var _0x48ca06=_0x57f8[_0x25e214];return _0x48ca06;};'use strict';var Sequelize=require('sequelize');module[_0x857f('0x0')]={'name':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'category':{'type':Sequelize[_0x857f('0x1')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x857f('0x2')],'allowNull':![]},'enabled':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x857f('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x857f('0x1')],'set':function(_0x6f054b){this[_0x857f('0x4')](_0x857f('0x5'),_0x6f054b?_0x6f054b[_0x857f('0x6')](''):[]);},'get':function(){return this[_0x857f('0x7')]('crudPermissions')?this[_0x857f('0x7')](_0x857f('0x5'))[_0x857f('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index cb0fd36..27c971a 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 _0x673d=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','destroy','error','name','send','index','map','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','UserProfileSection','then','include','findAll','rows','catch','show','params','keys','rawAttributes','includeAll','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils'];(function(_0x284d99,_0x44ecfe){var _0x224cd5=function(_0x64a594){while(--_0x64a594){_0x284d99['push'](_0x284d99['shift']());}};_0x224cd5(++_0x44ecfe);}(_0x673d,0x1c3));var _0xd673=function(_0x41ef02,_0x101e1a){_0x41ef02=_0x41ef02-0x0;var _0x5e6995=_0x673d[_0x41ef02];return _0x5e6995;};'use strict';var emlformat=require(_0xd673('0x0'));var rimraf=require(_0xd673('0x1'));var zipdir=require(_0xd673('0x2'));var jsonpatch=require(_0xd673('0x3'));var rp=require(_0xd673('0x4'));var moment=require(_0xd673('0x5'));var BPromise=require(_0xd673('0x6'));var Mustache=require(_0xd673('0x7'));var util=require(_0xd673('0x8'));var path=require(_0xd673('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd673('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd673('0xb'));var squel=require(_0xd673('0xc'));var crypto=require('crypto');var jsforce=require(_0xd673('0xd'));var deskjs=require(_0xd673('0xe'));var toCsv=require(_0xd673('0xf'));var querystring=require(_0xd673('0x10'));var Papa=require('papaparse');var Redis=require(_0xd673('0x11'));var authService=require(_0xd673('0x12'));var qs=require(_0xd673('0x13'));var as=require(_0xd673('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd673('0x15'))('api');var utils=require(_0xd673('0x16'));var config=require(_0xd673('0x17'));var licenseUtil=require(_0xd673('0x18'));var db=require(_0xd673('0x19'))['db'];function respondWithStatusCode(_0x44a7bf,_0xe8e83){_0xe8e83=_0xe8e83||0xcc;return function(_0x385c4){if(_0x385c4){return _0x44a7bf[_0xd673('0x1a')](_0xe8e83);}return _0x44a7bf[_0xd673('0x1b')](_0xe8e83)[_0xd673('0x1c')]();};}function respondWithResult(_0x413458,_0x3ad67c){_0x3ad67c=_0x3ad67c||0xc8;return function(_0x3d1374){if(_0x3d1374){return _0x413458['status'](_0x3ad67c)[_0xd673('0x1d')](_0x3d1374);}};}function respondWithFilteredResult(_0x3d937e,_0x443fb7){return function(_0x13fd88){if(_0x13fd88){var _0x44359a=typeof _0x443fb7[_0xd673('0x1e')]===_0xd673('0x1f')&&typeof _0x443fb7[_0xd673('0x20')]===_0xd673('0x1f');var _0x323d77=_0x13fd88[_0xd673('0x21')];var _0x557175=_0x44359a?0x0:_0x443fb7['offset'];var _0x403a9f=_0x44359a?_0x13fd88[_0xd673('0x21')]:_0x443fb7[_0xd673('0x1e')]+_0x443fb7[_0xd673('0x20')];var _0x175d06;if(_0x403a9f>=_0x323d77){_0x403a9f=_0x323d77;_0x175d06=0xc8;}else{_0x175d06=0xce;}_0x3d937e[_0xd673('0x1b')](_0x175d06);return _0x3d937e[_0xd673('0x22')](_0xd673('0x23'),_0x557175+'-'+_0x403a9f+'/'+_0x323d77)[_0xd673('0x1d')](_0x13fd88);}return null;};}function patchUpdates(_0x1431ed){return function(_0x47d00e){try{jsonpatch[_0xd673('0x24')](_0x47d00e,_0x1431ed,!![]);}catch(_0x2b0399){return BPromise['reject'](_0x2b0399);}return _0x47d00e['save']();};}function saveUpdates(_0x210d44,_0xb9f699){return function(_0x4507d4){if(_0x4507d4){return _0x4507d4['update'](_0x210d44)['then'](function(_0x152aad){return _0x152aad;});}return null;};}function removeEntity(_0x21742b,_0x3cbe9c){return function(_0x21747b){if(_0x21747b){return _0x21747b[_0xd673('0x25')]()['then'](function(){_0x21742b[_0xd673('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x495028,_0x4101c6){return function(_0x3218ef){if(!_0x3218ef){_0x495028[_0xd673('0x1a')](0x194);}return _0x3218ef;};}function handleError(_0x3b0861,_0x1db6f1){_0x1db6f1=_0x1db6f1||0x1f4;return function(_0x9f408e){logger[_0xd673('0x26')](_0x9f408e['stack']);if(_0x9f408e[_0xd673('0x27')]){delete _0x9f408e[_0xd673('0x27')];}_0x3b0861[_0xd673('0x1b')](_0x1db6f1)[_0xd673('0x28')](_0x9f408e);};}exports[_0xd673('0x29')]=function(_0x55d273,_0x56fc08){var _0x1b862b={},_0x3c7a96={},_0x2a0b2e={'count':0x0,'rows':[]};var _0x1ae486=_[_0xd673('0x2a')](db['UserProfileSection']['rawAttributes'],function(_0x1463d5){return{'name':_0x1463d5[_0xd673('0x2b')],'type':_0x1463d5[_0xd673('0x2c')][_0xd673('0x2d')]};});_0x3c7a96[_0xd673('0x2e')]=_[_0xd673('0x2a')](_0x1ae486,'name');_0x3c7a96[_0xd673('0x2f')]=_['keys'](_0x55d273[_0xd673('0x2f')]);_0x3c7a96[_0xd673('0x30')]=_['intersection'](_0x3c7a96[_0xd673('0x2e')],_0x3c7a96[_0xd673('0x2f')]);_0x1b862b[_0xd673('0x31')]=_[_0xd673('0x32')](_0x3c7a96['model'],qs[_0xd673('0x33')](_0x55d273[_0xd673('0x2f')][_0xd673('0x33')]));_0x1b862b[_0xd673('0x31')]=_0x1b862b[_0xd673('0x31')][_0xd673('0x34')]?_0x1b862b[_0xd673('0x31')]:_0x3c7a96[_0xd673('0x2e')];if(!_0x55d273[_0xd673('0x2f')][_0xd673('0x35')](_0xd673('0x36'))){_0x1b862b['limit']=qs[_0xd673('0x20')](_0x55d273['query']['limit']);_0x1b862b[_0xd673('0x1e')]=qs[_0xd673('0x1e')](_0x55d273[_0xd673('0x2f')][_0xd673('0x1e')]);}_0x1b862b[_0xd673('0x37')]=qs[_0xd673('0x38')](_0x55d273[_0xd673('0x2f')][_0xd673('0x38')]);_0x1b862b[_0xd673('0x39')]=qs[_0xd673('0x30')](_[_0xd673('0x3a')](_0x55d273['query'],_0x3c7a96[_0xd673('0x30')]),_0x1ae486);if(_0x55d273[_0xd673('0x2f')][_0xd673('0x3b')]){_0x1b862b[_0xd673('0x39')]=_[_0xd673('0x3c')](_0x1b862b['where'],{'$or':_['map'](_0x1ae486,function(_0x1eff3d){if(_0x1eff3d[_0xd673('0x2c')]!==_0xd673('0x3d')){var _0xe100d3={};_0xe100d3[_0x1eff3d[_0xd673('0x27')]]={'$like':'%'+_0x55d273[_0xd673('0x2f')][_0xd673('0x3b')]+'%'};return _0xe100d3;}})});}_0x1b862b=_[_0xd673('0x3c')]({},_0x1b862b,_0x55d273[_0xd673('0x3e')]);var _0x37e413={'where':_0x1b862b[_0xd673('0x39')]};return db[_0xd673('0x3f')]['count'](_0x37e413)[_0xd673('0x40')](function(_0x40d5f6){_0x2a0b2e['count']=_0x40d5f6;if(_0x55d273[_0xd673('0x2f')]['includeAll']){_0x1b862b[_0xd673('0x41')]=[{'all':!![]}];}return db['UserProfileSection'][_0xd673('0x42')](_0x1b862b);})[_0xd673('0x40')](function(_0x1ce674){_0x2a0b2e[_0xd673('0x43')]=_0x1ce674;return _0x2a0b2e;})['then'](respondWithFilteredResult(_0x56fc08,_0x1b862b))[_0xd673('0x44')](handleError(_0x56fc08,null));};exports[_0xd673('0x45')]=function(_0x37699f,_0x5d81a0){var _0x1c7230={'raw':![],'where':{'id':_0x37699f[_0xd673('0x46')]['id']}},_0x29decf={};_0x29decf[_0xd673('0x2e')]=_[_0xd673('0x47')](db['UserProfileSection'][_0xd673('0x48')]);_0x29decf['query']=_[_0xd673('0x47')](_0x37699f[_0xd673('0x2f')]);_0x29decf[_0xd673('0x30')]=_['intersection'](_0x29decf[_0xd673('0x2e')],_0x29decf[_0xd673('0x2f')]);_0x1c7230[_0xd673('0x31')]=_[_0xd673('0x32')](_0x29decf[_0xd673('0x2e')],qs[_0xd673('0x33')](_0x37699f[_0xd673('0x2f')][_0xd673('0x33')]));_0x1c7230[_0xd673('0x31')]=_0x1c7230['attributes'][_0xd673('0x34')]?_0x1c7230[_0xd673('0x31')]:_0x29decf['model'];if(_0x37699f[_0xd673('0x2f')][_0xd673('0x49')]){_0x1c7230['include']=[{'all':!![]}];}_0x1c7230=_[_0xd673('0x3c')]({},_0x1c7230,_0x37699f[_0xd673('0x3e')]);return db[_0xd673('0x3f')][_0xd673('0x4a')](_0x1c7230)[_0xd673('0x40')](handleEntityNotFound(_0x5d81a0,null))['then'](respondWithResult(_0x5d81a0,null))['catch'](handleError(_0x5d81a0,null));};exports['create']=function(_0x1fcad0,_0x5cb17c){return db[_0xd673('0x3f')][_0xd673('0x4b')](_0x1fcad0[_0xd673('0x4c')],{})['then'](respondWithResult(_0x5cb17c,0xc9))[_0xd673('0x44')](handleError(_0x5cb17c,null));};exports[_0xd673('0x4d')]=function(_0x5c1c0e,_0x28bb9e){if(_0x5c1c0e[_0xd673('0x4c')]['id']){delete _0x5c1c0e['body']['id'];}return db[_0xd673('0x3f')][_0xd673('0x4a')]({'where':{'id':_0x5c1c0e['params']['id']}})[_0xd673('0x40')](handleEntityNotFound(_0x28bb9e,null))[_0xd673('0x40')](saveUpdates(_0x5c1c0e[_0xd673('0x4c')],null))[_0xd673('0x40')](respondWithResult(_0x28bb9e,null))['catch'](handleError(_0x28bb9e,null));};exports[_0xd673('0x25')]=function(_0x4d3936,_0x344909){return db['UserProfileSection'][_0xd673('0x4a')]({'where':{'id':_0x4d3936[_0xd673('0x46')]['id']}})[_0xd673('0x40')](handleEntityNotFound(_0x344909,null))[_0xd673('0x40')](removeEntity(_0x344909,null))[_0xd673('0x44')](handleError(_0x344909,null));};exports[_0xd673('0x4e')]=function(_0x142197,_0x17b745){return db[_0xd673('0x3f')][_0xd673('0x4e')]()['then'](respondWithResult(_0x17b745,null))[_0xd673('0x44')](handleError(_0x17b745,null));}; \ No newline at end of file +var _0x52cd=['UserProfileSection','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','offset','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','end','status','undefined','limit','count','set','apply','reject','then','destroy','error','stack','name','send','index','map'];(function(_0x64d7cf,_0xfb45dc){var _0x173631=function(_0x38cb07){while(--_0x38cb07){_0x64d7cf['push'](_0x64d7cf['shift']());}};_0x173631(++_0xfb45dc);}(_0x52cd,0xb3));var _0xd52c=function(_0x262d7a,_0xf35286){_0x262d7a=_0x262d7a-0x0;var _0x27beb5=_0x52cd[_0x262d7a];return _0x27beb5;};'use strict';var emlformat=require(_0xd52c('0x0'));var rimraf=require(_0xd52c('0x1'));var zipdir=require(_0xd52c('0x2'));var jsonpatch=require(_0xd52c('0x3'));var rp=require(_0xd52c('0x4'));var moment=require(_0xd52c('0x5'));var BPromise=require(_0xd52c('0x6'));var Mustache=require(_0xd52c('0x7'));var util=require(_0xd52c('0x8'));var path=require('path');var sox=require(_0xd52c('0x9'));var csv=require(_0xd52c('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd52c('0xb'));var _=require(_0xd52c('0xc'));var squel=require(_0xd52c('0xd'));var crypto=require(_0xd52c('0xe'));var jsforce=require(_0xd52c('0xf'));var deskjs=require(_0xd52c('0x10'));var toCsv=require(_0xd52c('0xa'));var querystring=require(_0xd52c('0x11'));var Papa=require(_0xd52c('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xd52c('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd52c('0x14'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd52c('0x15'));var db=require(_0xd52c('0x16'))['db'];function respondWithStatusCode(_0x3560ed,_0x235649){_0x235649=_0x235649||0xcc;return function(_0x5509de){if(_0x5509de){return _0x3560ed[_0xd52c('0x17')](_0x235649);}return _0x3560ed['status'](_0x235649)[_0xd52c('0x18')]();};}function respondWithResult(_0x3ef6fb,_0xfa9de0){_0xfa9de0=_0xfa9de0||0xc8;return function(_0x29c3e8){if(_0x29c3e8){return _0x3ef6fb[_0xd52c('0x19')](_0xfa9de0)['json'](_0x29c3e8);}};}function respondWithFilteredResult(_0x286f5e,_0x221d0d){return function(_0xbc0455){if(_0xbc0455){var _0x3bac0f=typeof _0x221d0d['offset']===_0xd52c('0x1a')&&typeof _0x221d0d[_0xd52c('0x1b')]===_0xd52c('0x1a');var _0x53404b=_0xbc0455[_0xd52c('0x1c')];var _0x489b31=_0x3bac0f?0x0:_0x221d0d['offset'];var _0x348073=_0x3bac0f?_0xbc0455['count']:_0x221d0d['offset']+_0x221d0d[_0xd52c('0x1b')];var _0x51d43f;if(_0x348073>=_0x53404b){_0x348073=_0x53404b;_0x51d43f=0xc8;}else{_0x51d43f=0xce;}_0x286f5e['status'](_0x51d43f);return _0x286f5e[_0xd52c('0x1d')]('Content-Range',_0x489b31+'-'+_0x348073+'/'+_0x53404b)['json'](_0xbc0455);}return null;};}function patchUpdates(_0x3d370d){return function(_0x8c621a){try{jsonpatch[_0xd52c('0x1e')](_0x8c621a,_0x3d370d,!![]);}catch(_0x1e8233){return BPromise[_0xd52c('0x1f')](_0x1e8233);}return _0x8c621a['save']();};}function saveUpdates(_0xaedef7,_0x3658fb){return function(_0x195608){if(_0x195608){return _0x195608['update'](_0xaedef7)[_0xd52c('0x20')](function(_0x2aab66){return _0x2aab66;});}return null;};}function removeEntity(_0x35fa9d,_0x48a73f){return function(_0x3b3a00){if(_0x3b3a00){return _0x3b3a00[_0xd52c('0x21')]()[_0xd52c('0x20')](function(){_0x35fa9d['status'](0xcc)[_0xd52c('0x18')]();});}};}function handleEntityNotFound(_0x518bc6,_0x18f1e7){return function(_0x51af1e){if(!_0x51af1e){_0x518bc6[_0xd52c('0x17')](0x194);}return _0x51af1e;};}function handleError(_0xf98fde,_0x4813eb){_0x4813eb=_0x4813eb||0x1f4;return function(_0x1999c9){logger[_0xd52c('0x22')](_0x1999c9[_0xd52c('0x23')]);if(_0x1999c9[_0xd52c('0x24')]){delete _0x1999c9[_0xd52c('0x24')];}_0xf98fde['status'](_0x4813eb)[_0xd52c('0x25')](_0x1999c9);};}exports[_0xd52c('0x26')]=function(_0x128ef9,_0x98e742){var _0x3fac65={},_0x35eab9={},_0x21222c={'count':0x0,'rows':[]};var _0x5c4635=_[_0xd52c('0x27')](db[_0xd52c('0x28')][_0xd52c('0x29')],function(_0x31b51a){return{'name':_0x31b51a[_0xd52c('0x2a')],'type':_0x31b51a['type'][_0xd52c('0x2b')]};});_0x35eab9[_0xd52c('0x2c')]=_[_0xd52c('0x27')](_0x5c4635,_0xd52c('0x24'));_0x35eab9['query']=_[_0xd52c('0x2d')](_0x128ef9['query']);_0x35eab9[_0xd52c('0x2e')]=_[_0xd52c('0x2f')](_0x35eab9['model'],_0x35eab9['query']);_0x3fac65[_0xd52c('0x30')]=_[_0xd52c('0x2f')](_0x35eab9[_0xd52c('0x2c')],qs[_0xd52c('0x31')](_0x128ef9[_0xd52c('0x32')][_0xd52c('0x31')]));_0x3fac65[_0xd52c('0x30')]=_0x3fac65[_0xd52c('0x30')][_0xd52c('0x33')]?_0x3fac65[_0xd52c('0x30')]:_0x35eab9[_0xd52c('0x2c')];if(!_0x128ef9[_0xd52c('0x32')][_0xd52c('0x34')](_0xd52c('0x35'))){_0x3fac65[_0xd52c('0x1b')]=qs[_0xd52c('0x1b')](_0x128ef9[_0xd52c('0x32')][_0xd52c('0x1b')]);_0x3fac65[_0xd52c('0x36')]=qs[_0xd52c('0x36')](_0x128ef9[_0xd52c('0x32')]['offset']);}_0x3fac65['order']=qs['sort'](_0x128ef9['query']['sort']);_0x3fac65[_0xd52c('0x37')]=qs[_0xd52c('0x2e')](_[_0xd52c('0x38')](_0x128ef9[_0xd52c('0x32')],_0x35eab9[_0xd52c('0x2e')]),_0x5c4635);if(_0x128ef9[_0xd52c('0x32')][_0xd52c('0x39')]){_0x3fac65[_0xd52c('0x37')]=_['merge'](_0x3fac65[_0xd52c('0x37')],{'$or':_[_0xd52c('0x27')](_0x5c4635,function(_0x4e4ca0){if(_0x4e4ca0['type']!==_0xd52c('0x3a')){var _0x27b916={};_0x27b916[_0x4e4ca0[_0xd52c('0x24')]]={'$like':'%'+_0x128ef9['query'][_0xd52c('0x39')]+'%'};return _0x27b916;}})});}_0x3fac65=_[_0xd52c('0x3b')]({},_0x3fac65,_0x128ef9[_0xd52c('0x3c')]);var _0x55258c={'where':_0x3fac65[_0xd52c('0x37')]};return db[_0xd52c('0x28')][_0xd52c('0x1c')](_0x55258c)[_0xd52c('0x20')](function(_0x354391){_0x21222c[_0xd52c('0x1c')]=_0x354391;if(_0x128ef9['query'][_0xd52c('0x3d')]){_0x3fac65[_0xd52c('0x3e')]=[{'all':!![]}];}return db[_0xd52c('0x28')][_0xd52c('0x3f')](_0x3fac65);})[_0xd52c('0x20')](function(_0x1b6fd5){_0x21222c[_0xd52c('0x40')]=_0x1b6fd5;return _0x21222c;})[_0xd52c('0x20')](respondWithFilteredResult(_0x98e742,_0x3fac65))[_0xd52c('0x41')](handleError(_0x98e742,null));};exports[_0xd52c('0x42')]=function(_0x45bf3a,_0x256b16){var _0x1bec46={'raw':![],'where':{'id':_0x45bf3a[_0xd52c('0x43')]['id']}},_0x507fc1={};_0x507fc1[_0xd52c('0x2c')]=_[_0xd52c('0x2d')](db[_0xd52c('0x28')]['rawAttributes']);_0x507fc1['query']=_[_0xd52c('0x2d')](_0x45bf3a[_0xd52c('0x32')]);_0x507fc1['filters']=_[_0xd52c('0x2f')](_0x507fc1['model'],_0x507fc1[_0xd52c('0x32')]);_0x1bec46[_0xd52c('0x30')]=_[_0xd52c('0x2f')](_0x507fc1[_0xd52c('0x2c')],qs[_0xd52c('0x31')](_0x45bf3a[_0xd52c('0x32')][_0xd52c('0x31')]));_0x1bec46[_0xd52c('0x30')]=_0x1bec46[_0xd52c('0x30')][_0xd52c('0x33')]?_0x1bec46[_0xd52c('0x30')]:_0x507fc1[_0xd52c('0x2c')];if(_0x45bf3a['query'][_0xd52c('0x3d')]){_0x1bec46[_0xd52c('0x3e')]=[{'all':!![]}];}_0x1bec46=_[_0xd52c('0x3b')]({},_0x1bec46,_0x45bf3a[_0xd52c('0x3c')]);return db['UserProfileSection'][_0xd52c('0x44')](_0x1bec46)[_0xd52c('0x20')](handleEntityNotFound(_0x256b16,null))[_0xd52c('0x20')](respondWithResult(_0x256b16,null))['catch'](handleError(_0x256b16,null));};exports[_0xd52c('0x45')]=function(_0x250612,_0x45769d){return db[_0xd52c('0x28')][_0xd52c('0x45')](_0x250612[_0xd52c('0x46')],{})[_0xd52c('0x20')](respondWithResult(_0x45769d,0xc9))[_0xd52c('0x41')](handleError(_0x45769d,null));};exports[_0xd52c('0x47')]=function(_0x1c4dba,_0x27120a){if(_0x1c4dba[_0xd52c('0x46')]['id']){delete _0x1c4dba['body']['id'];}return db[_0xd52c('0x28')][_0xd52c('0x44')]({'where':{'id':_0x1c4dba[_0xd52c('0x43')]['id']}})[_0xd52c('0x20')](handleEntityNotFound(_0x27120a,null))[_0xd52c('0x20')](saveUpdates(_0x1c4dba['body'],null))[_0xd52c('0x20')](respondWithResult(_0x27120a,null))['catch'](handleError(_0x27120a,null));};exports[_0xd52c('0x21')]=function(_0x164be4,_0x4f47a5){return db[_0xd52c('0x28')][_0xd52c('0x44')]({'where':{'id':_0x164be4[_0xd52c('0x43')]['id']}})[_0xd52c('0x20')](handleEntityNotFound(_0x4f47a5,null))['then'](removeEntity(_0x4f47a5,null))['catch'](handleError(_0x4f47a5,null));};exports[_0xd52c('0x48')]=function(_0x544620,_0x1a0681){return db[_0xd52c('0x28')][_0xd52c('0x48')]()[_0xd52c('0x20')](respondWithResult(_0x1a0681,null))[_0xd52c('0x41')](handleError(_0x1a0681,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index d0c2a55..926f670 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 _0x34a4=['moment','bluebird','path','rimraf','./userProfileSection.attributes','exports','define','user_profile_has_sections','compositeIndex','sectionId','../../config/logger','api'];(function(_0x3837b4,_0x1ad8a2){var _0x4069c0=function(_0x20ea4f){while(--_0x20ea4f){_0x3837b4['push'](_0x3837b4['shift']());}};_0x4069c0(++_0x1ad8a2);}(_0x34a4,0x1ba));var _0x434a=function(_0x2d93d4,_0x149172){_0x2d93d4=_0x2d93d4-0x0;var _0x44df30=_0x34a4[_0x2d93d4];return _0x44df30;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x434a('0x0'))(_0x434a('0x1'));var moment=require(_0x434a('0x2'));var BPromise=require(_0x434a('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x434a('0x4'));var rimraf=require(_0x434a('0x5'));var config=require('../../config/environment');var attributes=require(_0x434a('0x6'));module[_0x434a('0x7')]=function(_0x3086c8,_0x4534e){return _0x3086c8[_0x434a('0x8')]('UserProfileSection',attributes,{'tableName':_0x434a('0x9'),'paranoid':![],'indexes':[{'name':_0x434a('0xa'),'fields':[_0x434a('0xb'),'userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4be6=['exports','UserProfileSection','sectionId','userProfileId','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./userProfileSection.attributes'];(function(_0xc3b5ef,_0x300f79){var _0x3d13bc=function(_0xcd7632){while(--_0xcd7632){_0xc3b5ef['push'](_0xc3b5ef['shift']());}};_0x3d13bc(++_0x300f79);}(_0x4be6,0x74));var _0x64be=function(_0xdd31c,_0x484018){_0xdd31c=_0xdd31c-0x0;var _0x11b6ce=_0x4be6[_0xdd31c];return _0x11b6ce;};'use strict';var _=require(_0x64be('0x0'));var util=require(_0x64be('0x1'));var logger=require(_0x64be('0x2'))(_0x64be('0x3'));var moment=require(_0x64be('0x4'));var BPromise=require(_0x64be('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x64be('0x6'));var rimraf=require(_0x64be('0x7'));var config=require(_0x64be('0x8'));var attributes=require(_0x64be('0x9'));module[_0x64be('0xa')]=function(_0x935e8b,_0x4d4acc){return _0x935e8b['define'](_0x64be('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0x64be('0xc'),_0x64be('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 8f68caf..c55a333 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 _0xef39=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x3b3922,_0x4c6b03){var _0x3ecbc9=function(_0xc321f7){while(--_0xc321f7){_0x3b3922['push'](_0x3b3922['shift']());}};_0x3ecbc9(++_0x4c6b03);}(_0xef39,0x92));var _0x9ef3=function(_0x3b006c,_0x8317f2){_0x3b006c=_0x3b006c-0x0;var _0x39fc23=_0xef39[_0x3b006c];return _0x39fc23;};'use strict';var _=require('lodash');var util=require(_0x9ef3('0x0'));var moment=require(_0x9ef3('0x1'));var BPromise=require(_0x9ef3('0x2'));var rs=require(_0x9ef3('0x3'));var fs=require('fs');var Redis=require(_0x9ef3('0x4'));var db=require(_0x9ef3('0x5'))['db'];var utils=require(_0x9ef3('0x6'));var logger=require(_0x9ef3('0x7'))(_0x9ef3('0x8'));var config=require(_0x9ef3('0x9'));var jayson=require(_0x9ef3('0xa'));var client=jayson[_0x9ef3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b8488,_0x1f7ab7,_0x290ffd){return new BPromise(function(_0x27cfaa,_0x370330){return client[_0x9ef3('0xc')](_0x1b8488,_0x290ffd)[_0x9ef3('0xd')](function(_0x15ae4c){logger[_0x9ef3('0xe')](_0x9ef3('0xf'),_0x1f7ab7,_0x9ef3('0x10'));logger[_0x9ef3('0x11')](_0x9ef3('0x12'),_0x1f7ab7,'request\x20sent',JSON[_0x9ef3('0x13')](_0x15ae4c));if(_0x15ae4c[_0x9ef3('0x14')]){if(_0x15ae4c[_0x9ef3('0x14')][_0x9ef3('0x15')]===0x1f4){logger[_0x9ef3('0x14')](_0x9ef3('0xf'),_0x1f7ab7,_0x15ae4c['error'][_0x9ef3('0x16')]);return _0x370330(_0x15ae4c[_0x9ef3('0x14')][_0x9ef3('0x16')]);}logger['error'](_0x9ef3('0xf'),_0x1f7ab7,_0x15ae4c[_0x9ef3('0x14')]['message']);return _0x27cfaa(_0x15ae4c[_0x9ef3('0x14')][_0x9ef3('0x16')]);}else{logger[_0x9ef3('0xe')](_0x9ef3('0xf'),_0x1f7ab7,_0x9ef3('0x10'));_0x27cfaa(_0x15ae4c[_0x9ef3('0x17')]['message']);}})[_0x9ef3('0x18')](function(_0x355dbb){logger[_0x9ef3('0x14')]('UserProfileSection,\x20%s,\x20%s',_0x1f7ab7,_0x355dbb);_0x370330(_0x355dbb);});});} \ No newline at end of file +var _0x7e70=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','bluebird','randomstring','ioredis'];(function(_0xbc346f,_0x3db5c0){var _0x9f9260=function(_0x37e6b9){while(--_0x37e6b9){_0xbc346f['push'](_0xbc346f['shift']());}};_0x9f9260(++_0x3db5c0);}(_0x7e70,0x7b));var _0x07e7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7e70[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x07e7('0x0'));var rs=require(_0x07e7('0x1'));var fs=require('fs');var Redis=require(_0x07e7('0x2'));var db=require(_0x07e7('0x3'))['db'];var utils=require(_0x07e7('0x4'));var logger=require(_0x07e7('0x5'))(_0x07e7('0x6'));var config=require(_0x07e7('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x07e7('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4cf91a,_0x418576,_0x20ab68){return new BPromise(function(_0x525a66,_0x213332){return client[_0x07e7('0x9')](_0x4cf91a,_0x20ab68)['then'](function(_0x248663){logger[_0x07e7('0xa')](_0x07e7('0xb'),_0x418576,'request\x20sent');logger[_0x07e7('0xc')](_0x07e7('0xd'),_0x418576,_0x07e7('0xe'),JSON[_0x07e7('0xf')](_0x248663));if(_0x248663[_0x07e7('0x10')]){if(_0x248663[_0x07e7('0x10')][_0x07e7('0x11')]===0x1f4){logger[_0x07e7('0x10')](_0x07e7('0xb'),_0x418576,_0x248663['error'][_0x07e7('0x12')]);return _0x213332(_0x248663[_0x07e7('0x10')][_0x07e7('0x12')]);}logger[_0x07e7('0x10')](_0x07e7('0xb'),_0x418576,_0x248663[_0x07e7('0x10')][_0x07e7('0x12')]);return _0x525a66(_0x248663[_0x07e7('0x10')][_0x07e7('0x12')]);}else{logger[_0x07e7('0xa')](_0x07e7('0xb'),_0x418576,_0x07e7('0xe'));_0x525a66(_0x248663[_0x07e7('0x13')][_0x07e7('0x12')]);}})[_0x07e7('0x14')](function(_0x46ffdb){logger['error'](_0x07e7('0xb'),_0x418576,_0x46ffdb);_0x213332(_0x46ffdb);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index ba797ae..acf2a2e 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1d9993,_0x4b7875){var _0x44148a=function(_0x26e020){while(--_0x26e020){_0x1d9993['push'](_0x1d9993['shift']());}};_0x44148a(++_0x4b7875);}(_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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x1922d7,_0xba1505){var _0x2c8b86=function(_0x1ea1f9){while(--_0x1ea1f9){_0x1922d7['push'](_0x1922d7['shift']());}};_0x2c8b86(++_0xba1505);}(_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/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index b08e760..d1a2a7b 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 _0x19ff=['exports','INTEGER','sequelize'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x19ff,0xbc));var _0xf19f=function(_0x45a21c,_0x4bcd4d){_0x45a21c=_0x45a21c-0x0;var _0x2bdbf0=_0x19ff[_0x45a21c];return _0x2bdbf0;};'use strict';var Sequelize=require(_0xf19f('0x0'));module[_0xf19f('0x1')]={'penalty':{'type':Sequelize[_0xf19f('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7132=['INTEGER','exports'];(function(_0x199313,_0x3356ca){var _0x5ac914=function(_0x5bf982){while(--_0x5bf982){_0x199313['push'](_0x199313['shift']());}};_0x5ac914(++_0x3356ca);}(_0x7132,0x1cf));var _0x2713=function(_0x531e48,_0x4bb96b){_0x531e48=_0x531e48-0x0;var _0x202971=_0x7132[_0x531e48];return _0x202971;};'use strict';var Sequelize=require('sequelize');module[_0x2713('0x0')]={'penalty':{'type':Sequelize[_0x2713('0x1')],'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 9c5d489..2d48f0e 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 _0x5f6f=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./userSmsQueue.attributes','exports','user_has_sms_queues'];(function(_0x43f5d1,_0x2455c5){var _0x4e744b=function(_0x1ea06e){while(--_0x1ea06e){_0x43f5d1['push'](_0x43f5d1['shift']());}};_0x4e744b(++_0x2455c5);}(_0x5f6f,0x1ef));var _0xf5f6=function(_0x1f4fe3,_0x5b660b){_0x1f4fe3=_0x1f4fe3-0x0;var _0xe8dd52=_0x5f6f[_0x1f4fe3];return _0xe8dd52;};'use strict';var _=require(_0xf5f6('0x0'));var util=require(_0xf5f6('0x1'));var logger=require(_0xf5f6('0x2'))(_0xf5f6('0x3'));var moment=require(_0xf5f6('0x4'));var BPromise=require('bluebird');var rp=require(_0xf5f6('0x5'));var fs=require('fs');var path=require(_0xf5f6('0x6'));var rimraf=require(_0xf5f6('0x7'));var config=require('../../config/environment');var attributes=require(_0xf5f6('0x8'));module[_0xf5f6('0x9')]=function(_0x390b1a,_0xfda1c7){return _0x390b1a['define']('UserSmsQueue',attributes,{'tableName':_0xf5f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x50e5=['user_has_sms_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define'];(function(_0xc93bfa,_0x11a2f4){var _0x31127e=function(_0x3f4c2f){while(--_0x3f4c2f){_0xc93bfa['push'](_0xc93bfa['shift']());}};_0x31127e(++_0x11a2f4);}(_0x50e5,0xb7));var _0x550e=function(_0x54585b,_0x39c943){_0x54585b=_0x54585b-0x0;var _0x247564=_0x50e5[_0x54585b];return _0x247564;};'use strict';var _=require(_0x550e('0x0'));var util=require(_0x550e('0x1'));var logger=require('../../config/logger')(_0x550e('0x2'));var moment=require(_0x550e('0x3'));var BPromise=require(_0x550e('0x4'));var rp=require(_0x550e('0x5'));var fs=require('fs');var path=require(_0x550e('0x6'));var rimraf=require(_0x550e('0x7'));var config=require(_0x550e('0x8'));var attributes=require(_0x550e('0x9'));module[_0x550e('0xa')]=function(_0x3d8c9b,_0x863e3b){return _0x3d8c9b[_0x550e('0xb')]('UserSmsQueue',attributes,{'tableName':_0x550e('0xc'),'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 b322993..cbaf789 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 _0x07fa=['bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment'];(function(_0x18af5,_0x1820ce){var _0xd307bb=function(_0x372566){while(--_0x372566){_0x18af5['push'](_0x18af5['shift']());}};_0xd307bb(++_0x1820ce);}(_0x07fa,0x97));var _0xa07f=function(_0x556bb1,_0x34830d){_0x556bb1=_0x556bb1-0x0;var _0x45455f=_0x07fa[_0x556bb1];return _0x45455f;};'use strict';var _=require(_0xa07f('0x0'));var util=require(_0xa07f('0x1'));var moment=require(_0xa07f('0x2'));var BPromise=require(_0xa07f('0x3'));var rs=require(_0xa07f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa07f('0x5'));var logger=require(_0xa07f('0x6'))('rpc');var config=require(_0xa07f('0x7'));var jayson=require(_0xa07f('0x8'));var client=jayson[_0xa07f('0x9')][_0xa07f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1467b3,_0x36d68e,_0x104cbf){return new BPromise(function(_0x8d3dfc,_0x530c1c){return client[_0xa07f('0xb')](_0x1467b3,_0x104cbf)[_0xa07f('0xc')](function(_0x40a9d0){logger['info'](_0xa07f('0xd'),_0x36d68e,'request\x20sent');logger[_0xa07f('0xe')](_0xa07f('0xf'),_0x36d68e,_0xa07f('0x10'),JSON['stringify'](_0x40a9d0));if(_0x40a9d0['error']){if(_0x40a9d0[_0xa07f('0x11')][_0xa07f('0x12')]===0x1f4){logger[_0xa07f('0x11')](_0xa07f('0xd'),_0x36d68e,_0x40a9d0[_0xa07f('0x11')][_0xa07f('0x13')]);return _0x530c1c(_0x40a9d0[_0xa07f('0x11')]['message']);}logger[_0xa07f('0x11')](_0xa07f('0xd'),_0x36d68e,_0x40a9d0[_0xa07f('0x11')][_0xa07f('0x13')]);return _0x8d3dfc(_0x40a9d0[_0xa07f('0x11')][_0xa07f('0x13')]);}else{logger['info'](_0xa07f('0xd'),_0x36d68e,_0xa07f('0x10'));_0x8d3dfc(_0x40a9d0[_0xa07f('0x14')][_0xa07f('0x13')]);}})[_0xa07f('0x15')](function(_0xa32465){logger['error'](_0xa07f('0xd'),_0x36d68e,_0xa32465);_0x530c1c(_0xa32465);});});} \ No newline at end of file +var _0x5552=['../../config/logger','rpc','jayson/promise','http','request','then','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','../../mysqldb','../../config/utils'];(function(_0x38c9f2,_0x5935d1){var _0x5957fc=function(_0x266100){while(--_0x266100){_0x38c9f2['push'](_0x38c9f2['shift']());}};_0x5957fc(++_0x5935d1);}(_0x5552,0x14b));var _0x2555=function(_0x8b3205,_0x1dfbab){_0x8b3205=_0x8b3205-0x0;var _0x1a6c00=_0x5552[_0x8b3205];return _0x1a6c00;};'use strict';var _=require(_0x2555('0x0'));var util=require('util');var moment=require(_0x2555('0x1'));var BPromise=require(_0x2555('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2555('0x3'))['db'];var utils=require(_0x2555('0x4'));var logger=require(_0x2555('0x5'))(_0x2555('0x6'));var config=require('../../config/environment');var jayson=require(_0x2555('0x7'));var client=jayson['client'][_0x2555('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xed28f,_0x44f636,_0x16c16c){return new BPromise(function(_0x5e0bb1,_0x35e6d6){return client[_0x2555('0x9')](_0xed28f,_0x16c16c)[_0x2555('0xa')](function(_0x10b4d6){logger[_0x2555('0xb')](_0x2555('0xc'),_0x44f636,_0x2555('0xd'));logger['debug'](_0x2555('0xe'),_0x44f636,_0x2555('0xd'),JSON[_0x2555('0xf')](_0x10b4d6));if(_0x10b4d6[_0x2555('0x10')]){if(_0x10b4d6[_0x2555('0x10')][_0x2555('0x11')]===0x1f4){logger['error'](_0x2555('0xc'),_0x44f636,_0x10b4d6[_0x2555('0x10')][_0x2555('0x12')]);return _0x35e6d6(_0x10b4d6[_0x2555('0x10')][_0x2555('0x12')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x44f636,_0x10b4d6[_0x2555('0x10')]['message']);return _0x5e0bb1(_0x10b4d6[_0x2555('0x10')][_0x2555('0x12')]);}else{logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x44f636,_0x2555('0xd'));_0x5e0bb1(_0x10b4d6[_0x2555('0x13')][_0x2555('0x12')]);}})[_0x2555('0x14')](function(_0x32602e){logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x44f636,_0x32602e);_0x35e6d6(_0x32602e);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 301e519..5c7d8df 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 _0x0d28=['INTEGER','sequelize'];(function(_0x275a90,_0xa0f3cc){var _0x17b092=function(_0x45ec5a){while(--_0x45ec5a){_0x275a90['push'](_0x275a90['shift']());}};_0x17b092(++_0xa0f3cc);}(_0x0d28,0x1a5));var _0x80d2=function(_0x2b8810,_0x55efdb){_0x2b8810=_0x2b8810-0x0;var _0x4c0f41=_0x0d28[_0x2b8810];return _0x4c0f41;};'use strict';var Sequelize=require(_0x80d2('0x0'));module['exports']={'UserId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0x80d2('0x1')]}}; \ No newline at end of file +var _0x5c38=['sequelize','INTEGER'];(function(_0x3dee92,_0x55e1eb){var _0x44d36e=function(_0x34de1a){while(--_0x34de1a){_0x3dee92['push'](_0x3dee92['shift']());}};_0x44d36e(++_0x55e1eb);}(_0x5c38,0xd0));var _0x85c3=function(_0x3b2ab9,_0x418523){_0x3b2ab9=_0x3b2ab9-0x0;var _0x1241ff=_0x5c38[_0x3b2ab9];return _0x1241ff;};'use strict';var Sequelize=require(_0x85c3('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x85c3('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x85c3('0x1')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 029c5f8..f3a9997 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(_0x4bed57,_0x4e551b){var _0x6cb955=function(_0x4c7f97){while(--_0x4c7f97){_0x4bed57['push'](_0x4bed57['shift']());}};_0x6cb955(++_0x4e551b);}(_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 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(_0x23e64d,_0x107c2c){var _0x146d02=function(_0x531b6e){while(--_0x531b6e){_0x23e64d['push'](_0x23e64d['shift']());}};_0x146d02(++_0x107c2c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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 f9d1553..d2bdf4f 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1aae6a,_0x56bb19){var _0x297a71=function(_0x471e80){while(--_0x471e80){_0x1aae6a['push'](_0x1aae6a['shift']());}};_0x297a71(++_0x56bb19);}(_0x9c44,0x178));var _0x49c4=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9c44[_0x2641f9];return _0x585741;};'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(_0x12fada,_0x43f44b){var _0xa90599=function(_0x5b4580){while(--_0x5b4580){_0x12fada['push'](_0x12fada['shift']());}};_0xa90599(++_0x43f44b);}(_0x70e0,0x17b));var _0x070e=function(_0xc60a67,_0x44fe9b){_0xc60a67=_0xc60a67-0x0;var _0x3f9ba0=_0x70e0[_0xc60a67];return _0x3f9ba0;};'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/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 559399c..bcf13ea 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 _0x47f4=['exports'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x47f4,0x17f));var _0x447f=function(_0x481113,_0x5b008f){_0x481113=_0x481113-0x0;var _0x4910f2=_0x47f4[_0x481113];return _0x4910f2;};'use strict';var Sequelize=require('sequelize');module[_0x447f('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe351=['sequelize','exports','INTEGER'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0xe351,0x10b));var _0x1e35=function(_0x364716,_0x5ea802){_0x364716=_0x364716-0x0;var _0x177803=_0xe351[_0x364716];return _0x177803;};'use strict';var Sequelize=require(_0x1e35('0x0'));module[_0x1e35('0x1')]={'penalty':{'type':Sequelize[_0x1e35('0x2')],'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 e33cc08..03f1f7c 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 _0xb91d=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues','lodash','../../config/logger'];(function(_0x40951a,_0x2cbe60){var _0xdb2028=function(_0x134fa6){while(--_0x134fa6){_0x40951a['push'](_0x40951a['shift']());}};_0xdb2028(++_0x2cbe60);}(_0xb91d,0x129));var _0xdb91=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xb91d[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0xdb91('0x0'));var util=require('util');var logger=require(_0xdb91('0x1'))(_0xdb91('0x2'));var moment=require(_0xdb91('0x3'));var BPromise=require(_0xdb91('0x4'));var rp=require(_0xdb91('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb91('0x6'));var config=require(_0xdb91('0x7'));var attributes=require(_0xdb91('0x8'));module[_0xdb91('0x9')]=function(_0x35605d,_0x5c890d){return _0x35605d[_0xdb91('0xa')](_0xdb91('0xb'),attributes,{'tableName':_0xdb91('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4cd0=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x42dc9c,_0x223c11){var _0x3054d3=function(_0x250a6a){while(--_0x250a6a){_0x42dc9c['push'](_0x42dc9c['shift']());}};_0x3054d3(++_0x223c11);}(_0x4cd0,0x193));var _0x04cd=function(_0x534a20,_0x56c9d8){_0x534a20=_0x534a20-0x0;var _0x6d5320=_0x4cd0[_0x534a20];return _0x6d5320;};'use strict';var _=require(_0x04cd('0x0'));var util=require('util');var logger=require(_0x04cd('0x1'))(_0x04cd('0x2'));var moment=require(_0x04cd('0x3'));var BPromise=require(_0x04cd('0x4'));var rp=require(_0x04cd('0x5'));var fs=require('fs');var path=require(_0x04cd('0x6'));var rimraf=require('rimraf');var config=require(_0x04cd('0x7'));var attributes=require(_0x04cd('0x8'));module[_0x04cd('0x9')]=function(_0x530649,_0x598b7b){return _0x530649[_0x04cd('0xa')](_0x04cd('0xb'),attributes,{'tableName':_0x04cd('0xc'),'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 4a3a293..e89d181 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 _0x4ff4=['error','code','message','result','catch','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x57caf0,_0x1fe145){var _0x65d871=function(_0x56a92){while(--_0x56a92){_0x57caf0['push'](_0x57caf0['shift']());}};_0x65d871(++_0x1fe145);}(_0x4ff4,0x15b));var _0x44ff=function(_0x402731,_0x43c115){_0x402731=_0x402731-0x0;var _0x111736=_0x4ff4[_0x402731];return _0x111736;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x44ff('0x0'));var rs=require(_0x44ff('0x1'));var fs=require('fs');var Redis=require(_0x44ff('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x44ff('0x3'));var logger=require(_0x44ff('0x4'))(_0x44ff('0x5'));var config=require(_0x44ff('0x6'));var jayson=require(_0x44ff('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x56a94e,_0x51050f,_0x2c6392){return new BPromise(function(_0x1fb239,_0x2ef574){return client[_0x44ff('0x8')](_0x56a94e,_0x2c6392)[_0x44ff('0x9')](function(_0x38e9fc){logger[_0x44ff('0xa')](_0x44ff('0xb'),_0x51050f,_0x44ff('0xc'));logger[_0x44ff('0xd')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x51050f,'request\x20sent',JSON['stringify'](_0x38e9fc));if(_0x38e9fc[_0x44ff('0xe')]){if(_0x38e9fc['error'][_0x44ff('0xf')]===0x1f4){logger['error'](_0x44ff('0xb'),_0x51050f,_0x38e9fc['error']['message']);return _0x2ef574(_0x38e9fc[_0x44ff('0xe')][_0x44ff('0x10')]);}logger[_0x44ff('0xe')](_0x44ff('0xb'),_0x51050f,_0x38e9fc[_0x44ff('0xe')]['message']);return _0x1fb239(_0x38e9fc['error']['message']);}else{logger['info'](_0x44ff('0xb'),_0x51050f,_0x44ff('0xc'));_0x1fb239(_0x38e9fc[_0x44ff('0x11')][_0x44ff('0x10')]);}})[_0x44ff('0x12')](function(_0x38ab38){logger[_0x44ff('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x51050f,_0x38ab38);_0x2ef574(_0x38ab38);});});} \ No newline at end of file +var _0x724f=['code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error'];(function(_0x15533f,_0x330c5c){var _0x2c2d07=function(_0x117c1){while(--_0x117c1){_0x15533f['push'](_0x15533f['shift']());}};_0x2c2d07(++_0x330c5c);}(_0x724f,0xf3));var _0xf724=function(_0x74cb4e,_0x1af2d4){_0x74cb4e=_0x74cb4e-0x0;var _0x315af9=_0x724f[_0x74cb4e];return _0x315af9;};'use strict';var _=require(_0xf724('0x0'));var util=require(_0xf724('0x1'));var moment=require(_0xf724('0x2'));var BPromise=require(_0xf724('0x3'));var rs=require(_0xf724('0x4'));var fs=require('fs');var Redis=require(_0xf724('0x5'));var db=require(_0xf724('0x6'))['db'];var utils=require(_0xf724('0x7'));var logger=require(_0xf724('0x8'))(_0xf724('0x9'));var config=require(_0xf724('0xa'));var jayson=require(_0xf724('0xb'));var client=jayson[_0xf724('0xc')][_0xf724('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x54f065,_0x155bb9,_0x4718ee){return new BPromise(function(_0x2c4c95,_0x2cf6a7){return client[_0xf724('0xe')](_0x54f065,_0x4718ee)[_0xf724('0xf')](function(_0x4a333c){logger[_0xf724('0x10')](_0xf724('0x11'),_0x155bb9,_0xf724('0x12'));logger[_0xf724('0x13')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x155bb9,'request\x20sent',JSON['stringify'](_0x4a333c));if(_0x4a333c[_0xf724('0x14')]){if(_0x4a333c[_0xf724('0x14')][_0xf724('0x15')]===0x1f4){logger['error'](_0xf724('0x11'),_0x155bb9,_0x4a333c[_0xf724('0x14')][_0xf724('0x16')]);return _0x2cf6a7(_0x4a333c['error'][_0xf724('0x16')]);}logger['error'](_0xf724('0x11'),_0x155bb9,_0x4a333c[_0xf724('0x14')]['message']);return _0x2c4c95(_0x4a333c[_0xf724('0x14')][_0xf724('0x16')]);}else{logger['info'](_0xf724('0x11'),_0x155bb9,_0xf724('0x12'));_0x2c4c95(_0x4a333c['result']['message']);}})[_0xf724('0x17')](function(_0x25937b){logger[_0xf724('0x14')](_0xf724('0x11'),_0x155bb9,_0x25937b);_0x2cf6a7(_0x25937b);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index deb1fbf..8a595dc 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x3d8041,_0x2381d3){var _0x263c24=function(_0x2fa0ea){while(--_0x2fa0ea){_0x3d8041['push'](_0x3d8041['shift']());}};_0x263c24(++_0x2381d3);}(_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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x13fb6c,_0x228db4){var _0x3fb4f0=function(_0x6ea79c){while(--_0x6ea79c){_0x13fb6c['push'](_0x13fb6c['shift']());}};_0x3fb4f0(++_0x228db4);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0xcb91[_0x425716];return _0x2d39af;};'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/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 2777aae..ebd98a8 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 _0x14d9=['Required\x20by\x20Asterisk','STRING','INTEGER','queue_interface','exports'];(function(_0x512973,_0x564e8b){var _0x32f2e1=function(_0x5d5d3b){while(--_0x5d5d3b){_0x512973['push'](_0x512973['shift']());}};_0x32f2e1(++_0x564e8b);}(_0x14d9,0x1a3));var _0x914d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x14d9[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0x914d('0x0')]={'uniqueid':{'type':Sequelize['INTEGER'],'primaryKey':!![],'autoIncrement':!![],'comment':_0x914d('0x1')},'membername':{'type':Sequelize[_0x914d('0x2')],'allowNull':![],'comment':_0x914d('0x1')},'UserId':{'type':Sequelize[_0x914d('0x3')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x914d('0x2')],'allowNull':![],'unique':_0x914d('0x4'),'comment':_0x914d('0x1')},'VoiceQueueId':{'type':Sequelize[_0x914d('0x3')],'allowNull':![]},'interface':{'type':Sequelize[_0x914d('0x2')],'allowNull':![],'unique':_0x914d('0x4'),'comment':'Required\x20by\x20Asterisk'},'penalty':{'type':Sequelize[_0x914d('0x3')](0xb),'defaultValue':0x0,'comment':_0x914d('0x1')},'paused':{'type':Sequelize[_0x914d('0x3')](0xb),'defaultValue':0x0,'comment':_0x914d('0x1')}}; \ No newline at end of file +var _0x8a87=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x5bf1df,_0x562032){var _0x33e922=function(_0x3b7869){while(--_0x3b7869){_0x5bf1df['push'](_0x5bf1df['shift']());}};_0x33e922(++_0x562032);}(_0x8a87,0x1b9));var _0x78a8=function(_0x5ae1a2,_0x3601ba){_0x5ae1a2=_0x5ae1a2-0x0;var _0x9ac42f=_0x8a87[_0x5ae1a2];return _0x9ac42f;};'use strict';var Sequelize=require(_0x78a8('0x0'));module[_0x78a8('0x1')]={'uniqueid':{'type':Sequelize[_0x78a8('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x78a8('0x3')},'membername':{'type':Sequelize[_0x78a8('0x4')],'allowNull':![],'comment':_0x78a8('0x3')},'UserId':{'type':Sequelize[_0x78a8('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x78a8('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x78a8('0x3')},'VoiceQueueId':{'type':Sequelize[_0x78a8('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x78a8('0x4')],'allowNull':![],'unique':_0x78a8('0x5'),'comment':_0x78a8('0x3')},'penalty':{'type':Sequelize[_0x78a8('0x2')](0xb),'defaultValue':0x0,'comment':_0x78a8('0x3')},'paused':{'type':Sequelize[_0x78a8('0x2')](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 f09f003..5341b79 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 _0xd996=['UserVoiceQueueRt','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xd996,0x6c));var _0x6d99=function(_0x1213eb,_0x254d44){_0x1213eb=_0x1213eb-0x0;var _0x1cb4bb=_0xd996[_0x1213eb];return _0x1cb4bb;};'use strict';var EventEmitter=require(_0x6d99('0x0'));var UserVoiceQueueRt=require(_0x6d99('0x1'))['db'][_0x6d99('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x6d99('0x3')](0x0);var events={'afterCreate':_0x6d99('0x4'),'afterUpdate':_0x6d99('0x5'),'afterDestroy':_0x6d99('0x6')};function emitEvent(_0x9c1781){return function(_0x48f175,_0x476f72,_0x5e6459){UserVoiceQueueRtEvents['emit'](_0x9c1781+':'+_0x48f175['id'],_0x48f175);UserVoiceQueueRtEvents[_0x6d99('0x7')](_0x9c1781,_0x48f175);_0x5e6459(null);};}for(var e in events){if(events[_0x6d99('0x8')](e)){var event=events[e];UserVoiceQueueRt[_0x6d99('0x9')](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x932d=['update','remove','emit','hasOwnProperty','exports','../../mysqldb','UserVoiceQueueRt'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x932d,0x98));var _0xd932=function(_0x53e379,_0x5a8e85){_0x53e379=_0x53e379-0x0;var _0x41df75=_0x932d[_0x53e379];return _0x41df75;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0xd932('0x0'))['db'][_0xd932('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xd932('0x2'),'afterDestroy':_0xd932('0x3')};function emitEvent(_0x18f21a){return function(_0x3c83a0,_0x370afa,_0x31082d){UserVoiceQueueRtEvents[_0xd932('0x4')](_0x18f21a+':'+_0x3c83a0['id'],_0x3c83a0);UserVoiceQueueRtEvents[_0xd932('0x4')](_0x18f21a,_0x3c83a0);_0x31082d(null);};}for(var e in events){if(events[_0xd932('0x5')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0xd932('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 4b94339..ac5531f 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 _0x0548=['api','request-promise','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','user_has_voice_queues_rt','lodash','../../config/logger'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x0548,0x166));var _0x8054=function(_0x44507f,_0x586a37){_0x44507f=_0x44507f-0x0;var _0x363232=_0x0548[_0x44507f];return _0x363232;};'use strict';var _=require(_0x8054('0x0'));var util=require('util');var logger=require(_0x8054('0x1'))(_0x8054('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8054('0x3'));var fs=require('fs');var path=require(_0x8054('0x4'));var rimraf=require(_0x8054('0x5'));var config=require(_0x8054('0x6'));var attributes=require(_0x8054('0x7'));module[_0x8054('0x8')]=function(_0x237daf,_0x4fab96){return _0x237daf['define']('UserVoiceQueueRt',attributes,{'tableName':_0x8054('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x229a=['api','moment','path','rimraf','../../config/environment','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt'];(function(_0x5d23ab,_0xecae24){var _0x2553ad=function(_0x5c8efe){while(--_0x5c8efe){_0x5d23ab['push'](_0x5d23ab['shift']());}};_0x2553ad(++_0xecae24);}(_0x229a,0xdc));var _0xa229=function(_0x3626ad,_0xae31a9){_0x3626ad=_0x3626ad-0x0;var _0x2d9b1c=_0x229a[_0x3626ad];return _0x2d9b1c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa229('0x0'));var moment=require(_0xa229('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xa229('0x2'));var rimraf=require(_0xa229('0x3'));var config=require(_0xa229('0x4'));var attributes=require(_0xa229('0x5'));module[_0xa229('0x6')]=function(_0x2639e1,_0x17ff2f){return _0x2639e1[_0xa229('0x7')](_0xa229('0x8'),attributes,{'tableName':_0xa229('0x9'),'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 fc3fd31..1214ff5 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 _0xedeb=['COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','GetVoiceQueueRtPauses','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UserVoiceQueueRt','findAll','options','raw','where','sequelize'];(function(_0x5afca6,_0x290b8e){var _0x454589=function(_0x503f78){while(--_0x503f78){_0x5afca6['push'](_0x5afca6['shift']());}};_0x454589(++_0x290b8e);}(_0xedeb,0x77));var _0xbede=function(_0x217cfd,_0x1e3094){_0x217cfd=_0x217cfd-0x0;var _0x1e887f=_0xedeb[_0x217cfd];return _0x1e887f;};'use strict';var _=require('lodash');var util=require(_0xbede('0x0'));var moment=require(_0xbede('0x1'));var BPromise=require(_0xbede('0x2'));var rs=require(_0xbede('0x3'));var fs=require('fs');var Redis=require(_0xbede('0x4'));var db=require(_0xbede('0x5'))['db'];var utils=require(_0xbede('0x6'));var logger=require(_0xbede('0x7'))(_0xbede('0x8'));var config=require(_0xbede('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xbede('0xa')][_0xbede('0xb')]({'port':0x232a});config['redis']=_[_0xbede('0xc')](config[_0xbede('0xd')],{'host':_0xbede('0xe'),'port':0x18eb});var socket=require(_0xbede('0xf'))(new Redis(config[_0xbede('0xd')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x4d3e97,_0x351cce,_0x1ef844){return new BPromise(function(_0x44162a,_0x4aa6bc){return client['request'](_0x4d3e97,_0x1ef844)['then'](function(_0x251534){logger[_0xbede('0x10')](_0xbede('0x11'),_0x351cce,_0xbede('0x12'));logger[_0xbede('0x13')](_0xbede('0x14'),_0x351cce,'request\x20sent',JSON[_0xbede('0x15')](_0x251534));if(_0x251534[_0xbede('0x16')]){if(_0x251534[_0xbede('0x16')][_0xbede('0x17')]===0x1f4){logger['error'](_0xbede('0x11'),_0x351cce,_0x251534['error']['message']);return _0x4aa6bc(_0x251534[_0xbede('0x16')][_0xbede('0x18')]);}logger[_0xbede('0x16')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x351cce,_0x251534['error'][_0xbede('0x18')]);return _0x44162a(_0x251534[_0xbede('0x16')][_0xbede('0x18')]);}else{logger[_0xbede('0x10')](_0xbede('0x11'),_0x351cce,_0xbede('0x12'));_0x44162a(_0x251534[_0xbede('0x19')][_0xbede('0x18')]);}})[_0xbede('0x1a')](function(_0x500629){logger['error'](_0xbede('0x11'),_0x351cce,_0x500629);_0x4aa6bc(_0x500629);});});}exports['GetVoiceQueueRtPauses']=function(_0x214f8d){var _0x1d6d5d=this;return new Promise(function(_0x6ea8b4,_0x1971f6){return db[_0xbede('0x1b')][_0xbede('0x1c')]({'raw':_0x214f8d['options']?_0x214f8d[_0xbede('0x1d')][_0xbede('0x1e')]===undefined?!![]:![]:!![],'where':_0x214f8d[_0xbede('0x1d')]?_0x214f8d[_0xbede('0x1d')][_0xbede('0x1f')]||null:null,'attributes':[[db[_0xbede('0x20')]['fn'](_0xbede('0x21'),db[_0xbede('0x20')]['fn']('IF',db[_0xbede('0x20')][_0xbede('0x22')](_0xbede('0x23')))),_0xbede('0x24')]]})['then'](function(_0x1e8904){logger[_0xbede('0x10')]('GetVoiceQueueRtPauses',_0x214f8d);logger[_0xbede('0x13')](_0xbede('0x25'),_0x214f8d,JSON[_0xbede('0x15')](_0x1e8904));_0x6ea8b4(_0x1e8904);})[_0xbede('0x1a')](function(_0x5e3c05){logger[_0xbede('0x16')](_0xbede('0x25'),_0x5e3c05[_0xbede('0x18')],_0x214f8d);_0x1971f6(_0x1d6d5d[_0xbede('0x16')](0x1f4,_0x5e3c05[_0xbede('0x18')]));});});}; \ No newline at end of file +var _0x7014=['debug','request\x20sent','stringify','error','code','message','info','result','catch','GetVoiceQueueRtPauses','findAll','options','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','redis','defaults','./userVoiceQueueRt.socket','request','then','UserVoiceQueueRt,\x20%s,\x20%s'];(function(_0x230977,_0x297427){var _0x2692f8=function(_0x2a912c){while(--_0x2a912c){_0x230977['push'](_0x230977['shift']());}};_0x2692f8(++_0x297427);}(_0x7014,0xcc));var _0x4701=function(_0x4215f6,_0x292474){_0x4215f6=_0x4215f6-0x0;var _0x2fc4ef=_0x7014[_0x4215f6];return _0x2fc4ef;};'use strict';var _=require('lodash');var util=require(_0x4701('0x0'));var moment=require('moment');var BPromise=require(_0x4701('0x1'));var rs=require(_0x4701('0x2'));var fs=require('fs');var Redis=require(_0x4701('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x4701('0x4'));var logger=require('../../config/logger')(_0x4701('0x5'));var config=require('../../config/environment');var jayson=require(_0x4701('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x4701('0x7')]=_[_0x4701('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4701('0x9'))['register'](socket);function respondWithRpcPromise(_0x545600,_0x35c4bb,_0x1d9c80){return new BPromise(function(_0x372e22,_0xce7cdc){return client[_0x4701('0xa')](_0x545600,_0x1d9c80)[_0x4701('0xb')](function(_0xd7c5fb){logger['info'](_0x4701('0xc'),_0x35c4bb,'request\x20sent');logger[_0x4701('0xd')]('UserVoiceQueueRt,\x20%s,\x20%s,\x20%s',_0x35c4bb,_0x4701('0xe'),JSON[_0x4701('0xf')](_0xd7c5fb));if(_0xd7c5fb[_0x4701('0x10')]){if(_0xd7c5fb[_0x4701('0x10')][_0x4701('0x11')]===0x1f4){logger[_0x4701('0x10')](_0x4701('0xc'),_0x35c4bb,_0xd7c5fb[_0x4701('0x10')][_0x4701('0x12')]);return _0xce7cdc(_0xd7c5fb[_0x4701('0x10')]['message']);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x35c4bb,_0xd7c5fb[_0x4701('0x10')][_0x4701('0x12')]);return _0x372e22(_0xd7c5fb[_0x4701('0x10')]['message']);}else{logger[_0x4701('0x13')](_0x4701('0xc'),_0x35c4bb,_0x4701('0xe'));_0x372e22(_0xd7c5fb[_0x4701('0x14')][_0x4701('0x12')]);}})[_0x4701('0x15')](function(_0x141e4f){logger[_0x4701('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x35c4bb,_0x141e4f);_0xce7cdc(_0x141e4f);});});}exports[_0x4701('0x16')]=function(_0x2ffc08){var _0x4f563c=this;return new Promise(function(_0x37b958,_0xd531f3){return db['UserVoiceQueueRt'][_0x4701('0x17')]({'raw':_0x2ffc08[_0x4701('0x18')]?_0x2ffc08['options']['raw']===undefined?!![]:![]:!![],'where':_0x2ffc08['options']?_0x2ffc08[_0x4701('0x18')][_0x4701('0x19')]||null:null,'attributes':[[db[_0x4701('0x1a')]['fn'](_0x4701('0x1b'),db['sequelize']['fn']('IF',db[_0x4701('0x1a')][_0x4701('0x1c')](_0x4701('0x1d')))),_0x4701('0x1e')]]})[_0x4701('0xb')](function(_0x1cd196){logger[_0x4701('0x13')](_0x4701('0x16'),_0x2ffc08);logger[_0x4701('0xd')](_0x4701('0x16'),_0x2ffc08,JSON[_0x4701('0xf')](_0x1cd196));_0x37b958(_0x1cd196);})[_0x4701('0x15')](function(_0x59093b){logger[_0x4701('0x10')](_0x4701('0x16'),_0x59093b['message'],_0x2ffc08);_0xd531f3(_0x4f563c[_0x4701('0x10')](0x1f4,_0x59093b['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 1ce7320..56aaa97 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 _0xd7ce=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd7ce,0x16b));var _0xed7c=function(_0x374ada,_0x27b3a5){_0x374ada=_0x374ada-0x0;var _0x449ed8=_0xd7ce[_0x374ada];return _0x449ed8;};'use strict';var UserVoiceQueueRtEvents=require(_0xed7c('0x0'));var events=[_0xed7c('0x1'),_0xed7c('0x2'),_0xed7c('0x3')];function createListener(_0x4ce2a9,_0x4fe5c1){return function(_0x1230ec){_0x4fe5c1['emit'](_0x4ce2a9,_0x1230ec);};}function removeListener(_0x4a6138,_0x587c5a){return function(){UserVoiceQueueRtEvents[_0xed7c('0x4')](_0x4a6138,_0x587c5a);};}exports[_0xed7c('0x5')]=function(_0x194d4b){for(var _0x1aa7a0=0x0,_0x34bbd7=events[_0xed7c('0x6')];_0x1aa7a0<_0x34bbd7;_0x1aa7a0++){var _0x41afb9=events[_0x1aa7a0];var _0x270db6=createListener(_0xed7c('0x7')+_0x41afb9,_0x194d4b);UserVoiceQueueRtEvents['on'](_0x41afb9,_0x270db6);}}; \ No newline at end of file +var _0xcd59=['remove','update','emit','removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save'];(function(_0x4e9299,_0x3cd8fd){var _0x36a175=function(_0x5d5c0a){while(--_0x5d5c0a){_0x4e9299['push'](_0x4e9299['shift']());}};_0x36a175(++_0x3cd8fd);}(_0xcd59,0x14b));var _0x9cd5=function(_0x54b5bd,_0x133fe1){_0x54b5bd=_0x54b5bd-0x0;var _0xcba844=_0xcd59[_0x54b5bd];return _0xcba844;};'use strict';var UserVoiceQueueRtEvents=require(_0x9cd5('0x0'));var events=[_0x9cd5('0x1'),_0x9cd5('0x2'),_0x9cd5('0x3')];function createListener(_0x271070,_0x302b21){return function(_0x4b93b9){_0x302b21[_0x9cd5('0x4')](_0x271070,_0x4b93b9);};}function removeListener(_0x191236,_0xf96efa){return function(){UserVoiceQueueRtEvents[_0x9cd5('0x5')](_0x191236,_0xf96efa);};}exports[_0x9cd5('0x6')]=function(_0x2db192){for(var _0x46277c=0x0,_0x2cd19a=events[_0x9cd5('0x7')];_0x46277c<_0x2cd19a;_0x46277c++){var _0x3f888f=events[_0x46277c];var _0x545407=createListener(_0x9cd5('0x8')+_0x3f888f,_0x2db192);UserVoiceQueueRtEvents['on'](_0x3f888f,_0x545407);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index d953397..6d9fd22 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5346fe,_0x2f9e23){var _0x3018b3=function(_0xcfdc2){while(--_0xcfdc2){_0x5346fe['push'](_0x5346fe['shift']());}};_0x3018b3(++_0x2f9e23);}(_0x70e0,0x17b));var _0x070e=function(_0x466668,_0x2bfde1){_0x466668=_0x466668-0x0;var _0x34a44c=_0x70e0[_0x466668];return _0x34a44c;};'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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x199394,_0x3d0297){var _0x61e770=function(_0x4615ba){while(--_0x4615ba){_0x199394['push'](_0x199394['shift']());}};_0x61e770(++_0x3d0297);}(_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/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 9c4386d..db651f5 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 _0xc8e8=['exports','INTEGER','sequelize'];(function(_0x4ed4f3,_0x160bf5){var _0x1af90d=function(_0x3e0c57){while(--_0x3e0c57){_0x4ed4f3['push'](_0x4ed4f3['shift']());}};_0x1af90d(++_0x160bf5);}(_0xc8e8,0x173));var _0x8c8e=function(_0x15876a,_0x15383d){_0x15876a=_0x15876a-0x0;var _0xbd900f=_0xc8e8[_0x15876a];return _0xbd900f;};'use strict';var Sequelize=require(_0x8c8e('0x0'));module[_0x8c8e('0x1')]={'penalty':{'type':Sequelize[_0x8c8e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x612d=['exports','INTEGER','sequelize'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x612d,0x158));var _0xd612=function(_0x1922d2,_0x224ada){_0x1922d2=_0x1922d2-0x0;var _0x268072=_0x612d[_0x1922d2];return _0x268072;};'use strict';var Sequelize=require(_0xd612('0x0'));module[_0xd612('0x1')]={'penalty':{'type':Sequelize[_0xd612('0x2')],'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 ac37695..35126d8 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 _0xa3ab=['request-promise','path','rimraf','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util','api','bluebird'];(function(_0x267f04,_0x18005d){var _0x324621=function(_0x3ef6a9){while(--_0x3ef6a9){_0x267f04['push'](_0x267f04['shift']());}};_0x324621(++_0x18005d);}(_0xa3ab,0xb0));var _0xba3a=function(_0x26c122,_0x407ce7){_0x26c122=_0x26c122-0x0;var _0xd52043=_0xa3ab[_0x26c122];return _0xd52043;};'use strict';var _=require(_0xba3a('0x0'));var util=require(_0xba3a('0x1'));var logger=require('../../config/logger')(_0xba3a('0x2'));var moment=require('moment');var BPromise=require(_0xba3a('0x3'));var rp=require(_0xba3a('0x4'));var fs=require('fs');var path=require(_0xba3a('0x5'));var rimraf=require(_0xba3a('0x6'));var config=require(_0xba3a('0x7'));var attributes=require(_0xba3a('0x8'));module[_0xba3a('0x9')]=function(_0x418ed9,_0x270a72){return _0x418ed9[_0xba3a('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0xba3a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1a5=['util','../../config/logger','api','moment','bluebird','request-promise','path','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash'];(function(_0x39a9ce,_0x3b1e38){var _0x2645e1=function(_0xf6e152){while(--_0xf6e152){_0x39a9ce['push'](_0x39a9ce['shift']());}};_0x2645e1(++_0x3b1e38);}(_0xd1a5,0xef));var _0x5d1a=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xd1a5[_0x178e48];return _0x440d7e;};'use strict';var _=require(_0x5d1a('0x0'));var util=require(_0x5d1a('0x1'));var logger=require(_0x5d1a('0x2'))(_0x5d1a('0x3'));var moment=require(_0x5d1a('0x4'));var BPromise=require(_0x5d1a('0x5'));var rp=require(_0x5d1a('0x6'));var fs=require('fs');var path=require(_0x5d1a('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userWhatsappQueue.attributes');module[_0x5d1a('0x8')]=function(_0x80e7b2,_0x57e949){return _0x80e7b2[_0x5d1a('0x9')](_0x5d1a('0xa'),attributes,{'tableName':_0x5d1a('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 34d5a34..75ad625 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 _0x5018=['bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','moment'];(function(_0x2f0a29,_0x4ab128){var _0x41fce4=function(_0x3386bf){while(--_0x3386bf){_0x2f0a29['push'](_0x2f0a29['shift']());}};_0x41fce4(++_0x4ab128);}(_0x5018,0xb2));var _0x8501=function(_0x158da6,_0x3cb06d){_0x158da6=_0x158da6-0x0;var _0x429c30=_0x5018[_0x158da6];return _0x429c30;};'use strict';var _=require(_0x8501('0x0'));var util=require('util');var moment=require(_0x8501('0x1'));var BPromise=require(_0x8501('0x2'));var rs=require(_0x8501('0x3'));var fs=require('fs');var Redis=require(_0x8501('0x4'));var db=require(_0x8501('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8501('0x6'));var config=require(_0x8501('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x8501('0x8')][_0x8501('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3063aa,_0x4f3cac,_0x3c916d){return new BPromise(function(_0x46ba20,_0x55d300){return client[_0x8501('0xa')](_0x3063aa,_0x3c916d)[_0x8501('0xb')](function(_0x1698f2){logger[_0x8501('0xc')](_0x8501('0xd'),_0x4f3cac,_0x8501('0xe'));logger['debug'](_0x8501('0xf'),_0x4f3cac,'request\x20sent',JSON[_0x8501('0x10')](_0x1698f2));if(_0x1698f2[_0x8501('0x11')]){if(_0x1698f2[_0x8501('0x11')]['code']===0x1f4){logger[_0x8501('0x11')](_0x8501('0xd'),_0x4f3cac,_0x1698f2[_0x8501('0x11')][_0x8501('0x12')]);return _0x55d300(_0x1698f2['error'][_0x8501('0x12')]);}logger[_0x8501('0x11')](_0x8501('0xd'),_0x4f3cac,_0x1698f2[_0x8501('0x11')][_0x8501('0x12')]);return _0x46ba20(_0x1698f2[_0x8501('0x11')][_0x8501('0x12')]);}else{logger['info'](_0x8501('0xd'),_0x4f3cac,_0x8501('0xe'));_0x46ba20(_0x1698f2[_0x8501('0x13')][_0x8501('0x12')]);}})['catch'](function(_0x417369){logger[_0x8501('0x11')](_0x8501('0xd'),_0x4f3cac,_0x417369);_0x55d300(_0x417369);});});} \ No newline at end of file +var _0x0a1a=['UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info'];(function(_0x5575cd,_0x73ab7a){var _0x4979a0=function(_0x1ac744){while(--_0x1ac744){_0x5575cd['push'](_0x5575cd['shift']());}};_0x4979a0(++_0x73ab7a);}(_0x0a1a,0x183));var _0xa0a1=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0a1a[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xa0a1('0x0'));var util=require(_0xa0a1('0x1'));var moment=require(_0xa0a1('0x2'));var BPromise=require('bluebird');var rs=require(_0xa0a1('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa0a1('0x4'));var logger=require(_0xa0a1('0x5'))('rpc');var config=require(_0xa0a1('0x6'));var jayson=require(_0xa0a1('0x7'));var client=jayson[_0xa0a1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20c2c4,_0x33eeab,_0x2346a2){return new BPromise(function(_0x17f3b9,_0x49b6b8){return client[_0xa0a1('0x9')](_0x20c2c4,_0x2346a2)[_0xa0a1('0xa')](function(_0x13ddd2){logger[_0xa0a1('0xb')](_0xa0a1('0xc'),_0x33eeab,_0xa0a1('0xd'));logger[_0xa0a1('0xe')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x33eeab,'request\x20sent',JSON['stringify'](_0x13ddd2));if(_0x13ddd2[_0xa0a1('0xf')]){if(_0x13ddd2[_0xa0a1('0xf')][_0xa0a1('0x10')]===0x1f4){logger['error'](_0xa0a1('0xc'),_0x33eeab,_0x13ddd2[_0xa0a1('0xf')][_0xa0a1('0x11')]);return _0x49b6b8(_0x13ddd2[_0xa0a1('0xf')][_0xa0a1('0x11')]);}logger[_0xa0a1('0xf')](_0xa0a1('0xc'),_0x33eeab,_0x13ddd2[_0xa0a1('0xf')][_0xa0a1('0x11')]);return _0x17f3b9(_0x13ddd2[_0xa0a1('0xf')]['message']);}else{logger[_0xa0a1('0xb')]('UserWhatsappQueue,\x20%s,\x20%s',_0x33eeab,'request\x20sent');_0x17f3b9(_0x13ddd2['result'][_0xa0a1('0x11')]);}})[_0xa0a1('0x12')](function(_0x197141){logger['error'](_0xa0a1('0xc'),_0x33eeab,_0x197141);_0x49b6b8(_0x197141);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 19023a8..9f9afbe 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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x2378bc,_0x122c03){var _0x1980ef=function(_0x5c83cb){while(--_0x5c83cb){_0x2378bc['push'](_0x2378bc['shift']());}};_0x1980ef(++_0x122c03);}(_0x008c,0x188));var _0xc008=function(_0x1d7973,_0x357676){_0x1d7973=_0x1d7973-0x0;var _0x43190c=_0x008c[_0x1d7973];return _0x43190c;};'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 +var _0x1e19=['show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','../../config/environment','./variable.controller','get','isAuthenticated','index','/:id'];(function(_0x5627db,_0x541471){var _0x4af1b1=function(_0x11f6f6){while(--_0x11f6f6){_0x5627db['push'](_0x5627db['shift']());}};_0x4af1b1(++_0x541471);}(_0x1e19,0x1c9));var _0x91e1=function(_0x43b487,_0x21893a){_0x43b487=_0x43b487-0x0;var _0x2f707a=_0x1e19[_0x43b487];return _0x2f707a;};'use strict';var multer=require(_0x91e1('0x0'));var util=require(_0x91e1('0x1'));var path=require(_0x91e1('0x2'));var timeout=require(_0x91e1('0x3'));var express=require(_0x91e1('0x4'));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(_0x91e1('0x5'));var controller=require(_0x91e1('0x6'));router[_0x91e1('0x7')]('/',auth[_0x91e1('0x8')](),controller[_0x91e1('0x9')]);router['get'](_0x91e1('0xa'),auth['isAuthenticated'](),controller[_0x91e1('0xb')]);router[_0x91e1('0xc')]('/',auth[_0x91e1('0x8')](),controller[_0x91e1('0xd')]);router[_0x91e1('0xe')]('/:id',auth[_0x91e1('0x8')](),controller[_0x91e1('0xf')]);router['delete'](_0x91e1('0xa'),auth[_0x91e1('0x8')](),controller[_0x91e1('0x10')]);module[_0x91e1('0x11')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index da66b8e..73ce567 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 _0x3d11=['name','sequelize','exports','STRING'];(function(_0x5bcd3d,_0x2fb1c5){var _0x439f54=function(_0x3451bd){while(--_0x3451bd){_0x5bcd3d['push'](_0x5bcd3d['shift']());}};_0x439f54(++_0x2fb1c5);}(_0x3d11,0x105));var _0x13d1=function(_0x51e943,_0x16e9c4){_0x51e943=_0x51e943-0x0;var _0x3fa027=_0x3d11[_0x51e943];return _0x3fa027;};'use strict';var Sequelize=require(_0x13d1('0x0'));module[_0x13d1('0x1')]={'name':{'type':Sequelize[_0x13d1('0x2')],'unique':_0x13d1('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x13d1('0x2')]}}; \ No newline at end of file +var _0xf774=['sequelize','STRING','name'];(function(_0x2fbbb2,_0x2fc143){var _0x513adc=function(_0x1e340b){while(--_0x1e340b){_0x2fbbb2['push'](_0x2fbbb2['shift']());}};_0x513adc(++_0x2fc143);}(_0xf774,0xae));var _0x4f77=function(_0x4fa163,_0x48e95b){_0x4fa163=_0x4fa163-0x0;var _0x74ab05=_0xf774[_0x4fa163];return _0x74ab05;};'use strict';var Sequelize=require(_0x4f77('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f77('0x1')],'unique':_0x4f77('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4f77('0x1')]}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index d614e8f..2fe3167 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 _0x0a83=['send','index','map','Variable','rawAttributes','fieldName','type','model','keys','intersection','attributes','fields','query','length','hasOwnProperty','nolimit','order','sort','filters','where','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','json','apply','save','update','destroy','then','get','Variables','UserProfileResource','end','stack','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0a83,0x177));var _0x30a8=function(_0x44216d,_0x4938a7){_0x44216d=_0x44216d-0x0;var _0xeca523=_0x0a83[_0x44216d];return _0xeca523;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x30a8('0x0'));var zipdir=require(_0x30a8('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x30a8('0x2'));var moment=require(_0x30a8('0x3'));var BPromise=require(_0x30a8('0x4'));var Mustache=require(_0x30a8('0x5'));var util=require(_0x30a8('0x6'));var path=require(_0x30a8('0x7'));var sox=require(_0x30a8('0x8'));var csv=require(_0x30a8('0x9'));var ejs=require(_0x30a8('0xa'));var fs=require('fs');var fs_extra=require(_0x30a8('0xb'));var _=require(_0x30a8('0xc'));var squel=require(_0x30a8('0xd'));var crypto=require('crypto');var jsforce=require(_0x30a8('0xe'));var deskjs=require(_0x30a8('0xf'));var toCsv=require('to-csv');var querystring=require(_0x30a8('0x10'));var Papa=require(_0x30a8('0x11'));var Redis=require(_0x30a8('0x12'));var authService=require(_0x30a8('0x13'));var qs=require(_0x30a8('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x30a8('0x15'));var logger=require('../../config/logger')(_0x30a8('0x16'));var utils=require(_0x30a8('0x17'));var config=require(_0x30a8('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x30a8('0x19'))['db'];function respondWithStatusCode(_0x59a86b,_0x39b4b9){_0x39b4b9=_0x39b4b9||0xcc;return function(_0x15f25d){if(_0x15f25d){return _0x59a86b[_0x30a8('0x1a')](_0x39b4b9);}return _0x59a86b[_0x30a8('0x1b')](_0x39b4b9)['end']();};}function respondWithResult(_0x704cb9,_0x3e0d12){_0x3e0d12=_0x3e0d12||0xc8;return function(_0x2e5fdb){if(_0x2e5fdb){return _0x704cb9[_0x30a8('0x1b')](_0x3e0d12)['json'](_0x2e5fdb);}};}function respondWithFilteredResult(_0x1c60a3,_0x148f27){return function(_0xecad20){if(_0xecad20){var _0x2250dd=typeof _0x148f27[_0x30a8('0x1c')]===_0x30a8('0x1d')&&typeof _0x148f27[_0x30a8('0x1e')]===_0x30a8('0x1d');var _0x366080=_0xecad20[_0x30a8('0x1f')];var _0x1c98d0=_0x2250dd?0x0:_0x148f27[_0x30a8('0x1c')];var _0x261316=_0x2250dd?_0xecad20[_0x30a8('0x1f')]:_0x148f27[_0x30a8('0x1c')]+_0x148f27[_0x30a8('0x1e')];var _0xea25ed;if(_0x261316>=_0x366080){_0x261316=_0x366080;_0xea25ed=0xc8;}else{_0xea25ed=0xce;}_0x1c60a3[_0x30a8('0x1b')](_0xea25ed);return _0x1c60a3[_0x30a8('0x20')]('Content-Range',_0x1c98d0+'-'+_0x261316+'/'+_0x366080)[_0x30a8('0x21')](_0xecad20);}return null;};}function patchUpdates(_0x369063){return function(_0xa3bcad){try{jsonpatch[_0x30a8('0x22')](_0xa3bcad,_0x369063,!![]);}catch(_0x3a0824){return BPromise['reject'](_0x3a0824);}return _0xa3bcad[_0x30a8('0x23')]();};}function saveUpdates(_0x4ba30e,_0x543da1){return function(_0xf99cb4){if(_0xf99cb4){return _0xf99cb4[_0x30a8('0x24')](_0x4ba30e)['then'](function(_0x2a2301){return _0x2a2301;});}return null;};}function removeEntity(_0x5c0eed,_0x5a1421){return function(_0x5eb652){if(_0x5eb652){return _0x5eb652[_0x30a8('0x25')]()[_0x30a8('0x26')](function(){var _0x1f67f1=_0x5eb652[_0x30a8('0x27')]({'plain':!![]});var _0x37ebb5=_0x30a8('0x28');return db[_0x30a8('0x29')][_0x30a8('0x25')]({'where':{'type':_0x37ebb5,'resourceId':_0x1f67f1['id']}})[_0x30a8('0x26')](function(){return _0x5eb652;});})[_0x30a8('0x26')](function(){_0x5c0eed[_0x30a8('0x1b')](0xcc)[_0x30a8('0x2a')]();});}};}function handleEntityNotFound(_0x4365a7,_0x32ff42){return function(_0xf4c95f){if(!_0xf4c95f){_0x4365a7['sendStatus'](0x194);}return _0xf4c95f;};}function handleError(_0x1b7c00,_0x446830){_0x446830=_0x446830||0x1f4;return function(_0x16dffb){logger['error'](_0x16dffb[_0x30a8('0x2b')]);if(_0x16dffb[_0x30a8('0x2c')]){delete _0x16dffb['name'];}_0x1b7c00[_0x30a8('0x1b')](_0x446830)[_0x30a8('0x2d')](_0x16dffb);};}exports[_0x30a8('0x2e')]=function(_0x24f7a1,_0x48da2a){var _0x41024c={},_0x1e5fe6={},_0x5b10d7={'count':0x0,'rows':[]};var _0x43e254=_[_0x30a8('0x2f')](db[_0x30a8('0x30')][_0x30a8('0x31')],function(_0xae0d04){return{'name':_0xae0d04[_0x30a8('0x32')],'type':_0xae0d04[_0x30a8('0x33')]['key']};});_0x1e5fe6[_0x30a8('0x34')]=_[_0x30a8('0x2f')](_0x43e254,'name');_0x1e5fe6['query']=_[_0x30a8('0x35')](_0x24f7a1['query']);_0x1e5fe6['filters']=_[_0x30a8('0x36')](_0x1e5fe6[_0x30a8('0x34')],_0x1e5fe6['query']);_0x41024c[_0x30a8('0x37')]=_[_0x30a8('0x36')](_0x1e5fe6['model'],qs[_0x30a8('0x38')](_0x24f7a1[_0x30a8('0x39')][_0x30a8('0x38')]));_0x41024c[_0x30a8('0x37')]=_0x41024c['attributes'][_0x30a8('0x3a')]?_0x41024c[_0x30a8('0x37')]:_0x1e5fe6[_0x30a8('0x34')];if(!_0x24f7a1[_0x30a8('0x39')][_0x30a8('0x3b')](_0x30a8('0x3c'))){_0x41024c[_0x30a8('0x1e')]=qs[_0x30a8('0x1e')](_0x24f7a1['query']['limit']);_0x41024c[_0x30a8('0x1c')]=qs[_0x30a8('0x1c')](_0x24f7a1[_0x30a8('0x39')][_0x30a8('0x1c')]);}_0x41024c[_0x30a8('0x3d')]=qs[_0x30a8('0x3e')](_0x24f7a1[_0x30a8('0x39')]['sort']);_0x41024c['where']=qs[_0x30a8('0x3f')](_['pick'](_0x24f7a1[_0x30a8('0x39')],_0x1e5fe6[_0x30a8('0x3f')]),_0x43e254);if(_0x24f7a1[_0x30a8('0x39')]['filter']){_0x41024c[_0x30a8('0x40')]=_['merge'](_0x41024c[_0x30a8('0x40')],{'$or':_[_0x30a8('0x2f')](_0x43e254,function(_0x2ee079){if(_0x2ee079[_0x30a8('0x33')]!==_0x30a8('0x41')){var _0x12baa9={};_0x12baa9[_0x2ee079[_0x30a8('0x2c')]]={'$like':'%'+_0x24f7a1[_0x30a8('0x39')]['filter']+'%'};return _0x12baa9;}})});}_0x41024c=_[_0x30a8('0x42')]({},_0x41024c,_0x24f7a1[_0x30a8('0x43')]);var _0x2fe09c={'where':_0x41024c[_0x30a8('0x40')]};return db[_0x30a8('0x30')][_0x30a8('0x1f')](_0x2fe09c)['then'](function(_0x36da18){_0x5b10d7[_0x30a8('0x1f')]=_0x36da18;if(_0x24f7a1[_0x30a8('0x39')]['includeAll']){_0x41024c[_0x30a8('0x44')]=[{'all':!![]}];}return db[_0x30a8('0x30')][_0x30a8('0x45')](_0x41024c);})[_0x30a8('0x26')](function(_0x346550){_0x5b10d7[_0x30a8('0x46')]=_0x346550;return _0x5b10d7;})[_0x30a8('0x26')](respondWithFilteredResult(_0x48da2a,_0x41024c))[_0x30a8('0x47')](handleError(_0x48da2a,null));};exports['show']=function(_0xa748b4,_0x437930){var _0x210137={'raw':!![],'where':{'id':_0xa748b4[_0x30a8('0x48')]['id']}},_0x5c068={};_0x5c068[_0x30a8('0x34')]=_[_0x30a8('0x35')](db[_0x30a8('0x30')]['rawAttributes']);_0x5c068[_0x30a8('0x39')]=_[_0x30a8('0x35')](_0xa748b4[_0x30a8('0x39')]);_0x5c068[_0x30a8('0x3f')]=_[_0x30a8('0x36')](_0x5c068[_0x30a8('0x34')],_0x5c068[_0x30a8('0x39')]);_0x210137[_0x30a8('0x37')]=_['intersection'](_0x5c068[_0x30a8('0x34')],qs['fields'](_0xa748b4[_0x30a8('0x39')][_0x30a8('0x38')]));_0x210137[_0x30a8('0x37')]=_0x210137[_0x30a8('0x37')][_0x30a8('0x3a')]?_0x210137['attributes']:_0x5c068[_0x30a8('0x34')];if(_0xa748b4['query'][_0x30a8('0x49')]){_0x210137[_0x30a8('0x44')]=[{'all':!![]}];}_0x210137=_[_0x30a8('0x42')]({},_0x210137,_0xa748b4['options']);return db[_0x30a8('0x30')]['find'](_0x210137)[_0x30a8('0x26')](handleEntityNotFound(_0x437930,null))['then'](respondWithResult(_0x437930,null))[_0x30a8('0x47')](handleError(_0x437930,null));};exports[_0x30a8('0x4a')]=function(_0x1ca959,_0x511e66){return db[_0x30a8('0x30')][_0x30a8('0x4a')](_0x1ca959[_0x30a8('0x4b')],{})[_0x30a8('0x26')](function(_0x883455){var _0x251d1a=_0x1ca959[_0x30a8('0x4c')][_0x30a8('0x27')]({'plain':!![]});if(!_0x251d1a)throw new Error(_0x30a8('0x4d'));if(_0x251d1a[_0x30a8('0x4e')]==='user'){var _0x446dae=_0x883455[_0x30a8('0x27')]({'plain':!![]});var _0x20aefb=_0x30a8('0x28');return db['UserProfileSection'][_0x30a8('0x4f')]({'where':{'name':_0x20aefb,'userProfileId':_0x251d1a[_0x30a8('0x50')]},'raw':!![]})[_0x30a8('0x26')](function(_0x3e40ce){if(_0x3e40ce&&_0x3e40ce[_0x30a8('0x51')]===0x0){return db[_0x30a8('0x29')][_0x30a8('0x4a')]({'name':_0x446dae[_0x30a8('0x2c')],'resourceId':_0x446dae['id'],'type':_0x3e40ce['name'],'sectionId':_0x3e40ce['id']},{})[_0x30a8('0x26')](function(){return _0x883455;});}else{return _0x883455;}})[_0x30a8('0x47')](function(_0x55389b){logger[_0x30a8('0x52')](_0x30a8('0x53'),_0x55389b);throw _0x55389b;});}return _0x883455;})[_0x30a8('0x26')](respondWithResult(_0x511e66,0xc9))[_0x30a8('0x47')](handleError(_0x511e66,null));};exports[_0x30a8('0x24')]=function(_0x4aabdf,_0x578b30){if(_0x4aabdf[_0x30a8('0x4b')]['id']){delete _0x4aabdf[_0x30a8('0x4b')]['id'];}return db[_0x30a8('0x30')][_0x30a8('0x4f')]({'where':{'id':_0x4aabdf[_0x30a8('0x48')]['id']}})[_0x30a8('0x26')](handleEntityNotFound(_0x578b30,null))[_0x30a8('0x26')](saveUpdates(_0x4aabdf[_0x30a8('0x4b')],null))[_0x30a8('0x26')](respondWithResult(_0x578b30,null))['catch'](handleError(_0x578b30,null));};exports[_0x30a8('0x25')]=function(_0x27af4f,_0x5cd46c){return db['Variable'][_0x30a8('0x4f')]({'where':{'id':_0x27af4f[_0x30a8('0x48')]['id']}})[_0x30a8('0x26')](handleEntityNotFound(_0x5cd46c,null))['then'](removeEntity(_0x5cd46c,null))[_0x30a8('0x47')](handleError(_0x5cd46c,null));}; \ No newline at end of file +var _0xd2cc=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','get','Variables','UserProfileResource','end','error','stack','name','send','index','fieldName','type','key','model','query','keys','attributes','fields','length','nolimit','order','where','filters','filter','merge','map','VIRTUAL','options','includeAll','include','Variable','findAll','catch','show','intersection','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x8e7b1f,_0x417ff5){var _0x322663=function(_0x1c2933){while(--_0x1c2933){_0x8e7b1f['push'](_0x8e7b1f['shift']());}};_0x322663(++_0x417ff5);}(_0xd2cc,0x1c5));var _0xcd2c=function(_0x526408,_0x585982){_0x526408=_0x526408-0x0;var _0x3f66e3=_0xd2cc[_0x526408];return _0x3f66e3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcd2c('0x0'));var zipdir=require(_0xcd2c('0x1'));var jsonpatch=require(_0xcd2c('0x2'));var rp=require('request-promise');var moment=require(_0xcd2c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcd2c('0x4'));var util=require('util');var path=require('path');var sox=require(_0xcd2c('0x5'));var csv=require(_0xcd2c('0x6'));var ejs=require(_0xcd2c('0x7'));var fs=require('fs');var fs_extra=require(_0xcd2c('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcd2c('0x6'));var querystring=require('querystring');var Papa=require(_0xcd2c('0x9'));var Redis=require(_0xcd2c('0xa'));var authService=require(_0xcd2c('0xb'));var qs=require(_0xcd2c('0xc'));var as=require(_0xcd2c('0xd'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd2c('0xe'))(_0xcd2c('0xf'));var utils=require(_0xcd2c('0x10'));var config=require(_0xcd2c('0x11'));var licenseUtil=require(_0xcd2c('0x12'));var db=require(_0xcd2c('0x13'))['db'];function respondWithStatusCode(_0x33fb16,_0x2f815f){_0x2f815f=_0x2f815f||0xcc;return function(_0x2f749f){if(_0x2f749f){return _0x33fb16[_0xcd2c('0x14')](_0x2f815f);}return _0x33fb16['status'](_0x2f815f)['end']();};}function respondWithResult(_0x214f08,_0x4e413c){_0x4e413c=_0x4e413c||0xc8;return function(_0x524c61){if(_0x524c61){return _0x214f08[_0xcd2c('0x15')](_0x4e413c)[_0xcd2c('0x16')](_0x524c61);}};}function respondWithFilteredResult(_0x5f2f54,_0x18efdd){return function(_0xe664fc){if(_0xe664fc){var _0xa43aaa=typeof _0x18efdd[_0xcd2c('0x17')]===_0xcd2c('0x18')&&typeof _0x18efdd[_0xcd2c('0x19')]==='undefined';var _0x3599b0=_0xe664fc[_0xcd2c('0x1a')];var _0x13a8c4=_0xa43aaa?0x0:_0x18efdd[_0xcd2c('0x17')];var _0x539d9a=_0xa43aaa?_0xe664fc[_0xcd2c('0x1a')]:_0x18efdd[_0xcd2c('0x17')]+_0x18efdd[_0xcd2c('0x19')];var _0x13cbf9;if(_0x539d9a>=_0x3599b0){_0x539d9a=_0x3599b0;_0x13cbf9=0xc8;}else{_0x13cbf9=0xce;}_0x5f2f54[_0xcd2c('0x15')](_0x13cbf9);return _0x5f2f54['set'](_0xcd2c('0x1b'),_0x13a8c4+'-'+_0x539d9a+'/'+_0x3599b0)[_0xcd2c('0x16')](_0xe664fc);}return null;};}function patchUpdates(_0x6b5226){return function(_0x3de6ae){try{jsonpatch[_0xcd2c('0x1c')](_0x3de6ae,_0x6b5226,!![]);}catch(_0x1c546b){return BPromise[_0xcd2c('0x1d')](_0x1c546b);}return _0x3de6ae[_0xcd2c('0x1e')]();};}function saveUpdates(_0x68d417,_0x30e39b){return function(_0x2a4916){if(_0x2a4916){return _0x2a4916[_0xcd2c('0x1f')](_0x68d417)['then'](function(_0x85c4d9){return _0x85c4d9;});}return null;};}function removeEntity(_0xaef2cf,_0xf07775){return function(_0x119446){if(_0x119446){return _0x119446[_0xcd2c('0x20')]()[_0xcd2c('0x21')](function(){var _0x3f3b3d=_0x119446[_0xcd2c('0x22')]({'plain':!![]});var _0x43b64e=_0xcd2c('0x23');return db[_0xcd2c('0x24')][_0xcd2c('0x20')]({'where':{'type':_0x43b64e,'resourceId':_0x3f3b3d['id']}})['then'](function(){return _0x119446;});})[_0xcd2c('0x21')](function(){_0xaef2cf[_0xcd2c('0x15')](0xcc)[_0xcd2c('0x25')]();});}};}function handleEntityNotFound(_0x1db509,_0x3f25e2){return function(_0x558f1e){if(!_0x558f1e){_0x1db509[_0xcd2c('0x14')](0x194);}return _0x558f1e;};}function handleError(_0x171b0a,_0x36453f){_0x36453f=_0x36453f||0x1f4;return function(_0x44a46b){logger[_0xcd2c('0x26')](_0x44a46b[_0xcd2c('0x27')]);if(_0x44a46b['name']){delete _0x44a46b[_0xcd2c('0x28')];}_0x171b0a[_0xcd2c('0x15')](_0x36453f)[_0xcd2c('0x29')](_0x44a46b);};}exports[_0xcd2c('0x2a')]=function(_0x3f903e,_0x26c2c1){var _0x3dff0b={},_0x4c028e={},_0x284711={'count':0x0,'rows':[]};var _0x25edaf=_['map'](db['Variable']['rawAttributes'],function(_0x4994bd){return{'name':_0x4994bd[_0xcd2c('0x2b')],'type':_0x4994bd[_0xcd2c('0x2c')][_0xcd2c('0x2d')]};});_0x4c028e[_0xcd2c('0x2e')]=_['map'](_0x25edaf,_0xcd2c('0x28'));_0x4c028e[_0xcd2c('0x2f')]=_[_0xcd2c('0x30')](_0x3f903e['query']);_0x4c028e['filters']=_['intersection'](_0x4c028e[_0xcd2c('0x2e')],_0x4c028e[_0xcd2c('0x2f')]);_0x3dff0b[_0xcd2c('0x31')]=_['intersection'](_0x4c028e[_0xcd2c('0x2e')],qs[_0xcd2c('0x32')](_0x3f903e[_0xcd2c('0x2f')]['fields']));_0x3dff0b['attributes']=_0x3dff0b[_0xcd2c('0x31')][_0xcd2c('0x33')]?_0x3dff0b[_0xcd2c('0x31')]:_0x4c028e[_0xcd2c('0x2e')];if(!_0x3f903e[_0xcd2c('0x2f')]['hasOwnProperty'](_0xcd2c('0x34'))){_0x3dff0b[_0xcd2c('0x19')]=qs['limit'](_0x3f903e['query']['limit']);_0x3dff0b[_0xcd2c('0x17')]=qs['offset'](_0x3f903e['query'][_0xcd2c('0x17')]);}_0x3dff0b[_0xcd2c('0x35')]=qs['sort'](_0x3f903e[_0xcd2c('0x2f')]['sort']);_0x3dff0b[_0xcd2c('0x36')]=qs['filters'](_['pick'](_0x3f903e[_0xcd2c('0x2f')],_0x4c028e[_0xcd2c('0x37')]),_0x25edaf);if(_0x3f903e[_0xcd2c('0x2f')][_0xcd2c('0x38')]){_0x3dff0b[_0xcd2c('0x36')]=_[_0xcd2c('0x39')](_0x3dff0b[_0xcd2c('0x36')],{'$or':_[_0xcd2c('0x3a')](_0x25edaf,function(_0x4f8329){if(_0x4f8329['type']!==_0xcd2c('0x3b')){var _0x5fde9b={};_0x5fde9b[_0x4f8329['name']]={'$like':'%'+_0x3f903e[_0xcd2c('0x2f')][_0xcd2c('0x38')]+'%'};return _0x5fde9b;}})});}_0x3dff0b=_[_0xcd2c('0x39')]({},_0x3dff0b,_0x3f903e[_0xcd2c('0x3c')]);var _0x314bd9={'where':_0x3dff0b[_0xcd2c('0x36')]};return db['Variable'][_0xcd2c('0x1a')](_0x314bd9)[_0xcd2c('0x21')](function(_0x383d40){_0x284711[_0xcd2c('0x1a')]=_0x383d40;if(_0x3f903e[_0xcd2c('0x2f')][_0xcd2c('0x3d')]){_0x3dff0b[_0xcd2c('0x3e')]=[{'all':!![]}];}return db[_0xcd2c('0x3f')][_0xcd2c('0x40')](_0x3dff0b);})[_0xcd2c('0x21')](function(_0x3222cf){_0x284711['rows']=_0x3222cf;return _0x284711;})[_0xcd2c('0x21')](respondWithFilteredResult(_0x26c2c1,_0x3dff0b))[_0xcd2c('0x41')](handleError(_0x26c2c1,null));};exports[_0xcd2c('0x42')]=function(_0x299e36,_0x4899a9){var _0x44aea9={'raw':!![],'where':{'id':_0x299e36['params']['id']}},_0x3a6bd6={};_0x3a6bd6[_0xcd2c('0x2e')]=_[_0xcd2c('0x30')](db[_0xcd2c('0x3f')]['rawAttributes']);_0x3a6bd6[_0xcd2c('0x2f')]=_['keys'](_0x299e36[_0xcd2c('0x2f')]);_0x3a6bd6[_0xcd2c('0x37')]=_[_0xcd2c('0x43')](_0x3a6bd6[_0xcd2c('0x2e')],_0x3a6bd6['query']);_0x44aea9[_0xcd2c('0x31')]=_['intersection'](_0x3a6bd6[_0xcd2c('0x2e')],qs[_0xcd2c('0x32')](_0x299e36[_0xcd2c('0x2f')]['fields']));_0x44aea9['attributes']=_0x44aea9[_0xcd2c('0x31')][_0xcd2c('0x33')]?_0x44aea9['attributes']:_0x3a6bd6['model'];if(_0x299e36[_0xcd2c('0x2f')]['includeAll']){_0x44aea9['include']=[{'all':!![]}];}_0x44aea9=_[_0xcd2c('0x39')]({},_0x44aea9,_0x299e36[_0xcd2c('0x3c')]);return db['Variable']['find'](_0x44aea9)[_0xcd2c('0x21')](handleEntityNotFound(_0x4899a9,null))[_0xcd2c('0x21')](respondWithResult(_0x4899a9,null))[_0xcd2c('0x41')](handleError(_0x4899a9,null));};exports[_0xcd2c('0x44')]=function(_0x31c1a5,_0x419e09){return db[_0xcd2c('0x3f')][_0xcd2c('0x44')](_0x31c1a5[_0xcd2c('0x45')],{})[_0xcd2c('0x21')](function(_0xf554f8){var _0x533be4=_0x31c1a5[_0xcd2c('0x46')]['get']({'plain':!![]});if(!_0x533be4)throw new Error(_0xcd2c('0x47'));if(_0x533be4[_0xcd2c('0x48')]===_0xcd2c('0x46')){var _0x46d60d=_0xf554f8[_0xcd2c('0x22')]({'plain':!![]});var _0x1dd4d3='Variables';return db['UserProfileSection'][_0xcd2c('0x49')]({'where':{'name':_0x1dd4d3,'userProfileId':_0x533be4[_0xcd2c('0x4a')]},'raw':!![]})[_0xcd2c('0x21')](function(_0x49c771){if(_0x49c771&&_0x49c771[_0xcd2c('0x4b')]===0x0){return db['UserProfileResource'][_0xcd2c('0x44')]({'name':_0x46d60d[_0xcd2c('0x28')],'resourceId':_0x46d60d['id'],'type':_0x49c771['name'],'sectionId':_0x49c771['id']},{})['then'](function(){return _0xf554f8;});}else{return _0xf554f8;}})['catch'](function(_0x1679ac){logger['error'](_0xcd2c('0x4c'),_0x1679ac);throw _0x1679ac;});}return _0xf554f8;})[_0xcd2c('0x21')](respondWithResult(_0x419e09,0xc9))[_0xcd2c('0x41')](handleError(_0x419e09,null));};exports['update']=function(_0x3576e8,_0x3bc37b){if(_0x3576e8['body']['id']){delete _0x3576e8[_0xcd2c('0x45')]['id'];}return db[_0xcd2c('0x3f')][_0xcd2c('0x49')]({'where':{'id':_0x3576e8[_0xcd2c('0x4d')]['id']}})[_0xcd2c('0x21')](handleEntityNotFound(_0x3bc37b,null))[_0xcd2c('0x21')](saveUpdates(_0x3576e8[_0xcd2c('0x45')],null))['then'](respondWithResult(_0x3bc37b,null))['catch'](handleError(_0x3bc37b,null));};exports[_0xcd2c('0x20')]=function(_0x39186b,_0x2fab41){return db[_0xcd2c('0x3f')]['find']({'where':{'id':_0x39186b[_0xcd2c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2fab41,null))[_0xcd2c('0x21')](removeEntity(_0x2fab41,null))[_0xcd2c('0x41')](handleError(_0x2fab41,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index a0c6e60..92b327d 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 _0x1de5=['request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','Variable','tools_variables','util','../../config/logger','api','moment'];(function(_0x45b0f4,_0x2a6f2e){var _0x4e88bd=function(_0x5d9fcf){while(--_0x5d9fcf){_0x45b0f4['push'](_0x45b0f4['shift']());}};_0x4e88bd(++_0x2a6f2e);}(_0x1de5,0x1a0));var _0x51de=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x1de5[_0x279d37];return _0x530173;};'use strict';var _=require('lodash');var util=require(_0x51de('0x0'));var logger=require(_0x51de('0x1'))(_0x51de('0x2'));var moment=require(_0x51de('0x3'));var BPromise=require('bluebird');var rp=require(_0x51de('0x4'));var fs=require('fs');var path=require(_0x51de('0x5'));var rimraf=require(_0x51de('0x6'));var config=require(_0x51de('0x7'));var attributes=require(_0x51de('0x8'));module[_0x51de('0x9')]=function(_0x1964e1,_0x403d65){return _0x1964e1['define'](_0x51de('0xa'),attributes,{'tableName':_0x51de('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x22af=['./variable.attributes','exports','define','Variable','lodash','util','../../config/logger','api','request-promise','../../config/environment'];(function(_0x4f34d8,_0x40f022){var _0xc97536=function(_0xef9dfc){while(--_0xef9dfc){_0x4f34d8['push'](_0x4f34d8['shift']());}};_0xc97536(++_0x40f022);}(_0x22af,0x19e));var _0xf22a=function(_0x585133,_0x2412a1){_0x585133=_0x585133-0x0;var _0x18254a=_0x22af[_0x585133];return _0x18254a;};'use strict';var _=require(_0xf22a('0x0'));var util=require(_0xf22a('0x1'));var logger=require(_0xf22a('0x2'))(_0xf22a('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf22a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xf22a('0x5'));var attributes=require(_0xf22a('0x6'));module[_0xf22a('0x7')]=function(_0x618c97,_0x2261ce){return _0x618c97[_0xf22a('0x8')](_0xf22a('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 a4f584d..7ce5048 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 _0x7fbe=['stringify','error','code','message','result','catch','Variable','find','options','where','attributes','include','map','model','info','ShowVariable','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../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'];(function(_0x1d0f7b,_0x4f4f60){var _0xf48406=function(_0x24ab16){while(--_0x24ab16){_0x1d0f7b['push'](_0x1d0f7b['shift']());}};_0xf48406(++_0x4f4f60);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x4879f7,_0x33749d){_0x4879f7=_0x4879f7-0x0;var _0x41771a=_0x7fbe[_0x4879f7];return _0x41771a;};'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);});});}exports['ShowVariable']=function(_0x293a47){var _0x546463=this;return new Promise(function(_0x1e77fd,_0x4708f7){return db[_0xe7fb('0x18')][_0xe7fb('0x19')]({'raw':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x293a47[_0xe7fb('0x1a')]?_0x293a47['options'][_0xe7fb('0x1b')]||null:null,'attributes':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1c')]||null:null,'include':_0x293a47['options']?_0x293a47[_0xe7fb('0x1a')][_0xe7fb('0x1d')]?_[_0xe7fb('0x1e')](_0x293a47['options'][_0xe7fb('0x1d')],function(_0x469ead){return{'model':db[_0x469ead['model']],'as':_0x469ead['as'],'attributes':_0x469ead['attributes'],'include':_0x469ead['include']?_[_0xe7fb('0x1e')](_0x469ead['include'],function(_0x49b219){return{'model':db[_0x49b219[_0xe7fb('0x1f')]],'as':_0x49b219['as'],'attributes':_0x49b219[_0xe7fb('0x1c')],'include':_0x49b219[_0xe7fb('0x1d')]?_['map'](_0x49b219[_0xe7fb('0x1d')],function(_0x2b69c4){return{'model':db[_0x2b69c4[_0xe7fb('0x1f')]],'as':_0x2b69c4['as'],'attributes':_0x2b69c4[_0xe7fb('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xe7fb('0xd')](function(_0x16237a){logger[_0xe7fb('0x20')]('ShowVariable',_0x293a47);logger['debug'](_0xe7fb('0x21'),_0x293a47,JSON[_0xe7fb('0x12')](_0x16237a));_0x1e77fd(_0x16237a);})[_0xe7fb('0x17')](function(_0x4fd290){logger[_0xe7fb('0x13')](_0xe7fb('0x21'),_0x4fd290[_0xe7fb('0x15')],_0x293a47);_0x4708f7(_0x546463[_0xe7fb('0x13')](0x1f4,_0x4fd290[_0xe7fb('0x15')]));});});}; \ No newline at end of file +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(_0x4f3e5a,_0x1ee150){var _0x452880=function(_0xadcb87){while(--_0xadcb87){_0x4f3e5a['push'](_0x4f3e5a['shift']());}};_0x452880(++_0x1ee150);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1719c2,_0x4b9565){_0x1719c2=_0x1719c2-0x0;var _0xc6f6f6=_0x1cb9[_0x1719c2];return _0xc6f6f6;};'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 diff --git a/server/api/version/index.js b/server/api/version/index.js index 9a88e19..4b8da61 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 _0xf83a=['Router','./version.controller','get','/fetch','isAuthenticated','canUpdate','fetch','/reset','/restart','restart','/migrations','exports'];(function(_0x4c8155,_0x23b067){var _0x4230d9=function(_0x31cad7){while(--_0x31cad7){_0x4c8155['push'](_0x4c8155['shift']());}};_0x4230d9(++_0x23b067);}(_0xf83a,0x1e0));var _0xaf83=function(_0x1e172a,_0x52102b){_0x1e172a=_0x1e172a-0x0;var _0x96338b=_0xf83a[_0x1e172a];return _0x96338b;};'use strict';var express=require('express');var router=express[_0xaf83('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0xaf83('0x1'));router[_0xaf83('0x2')]('/',controller['index']);router[_0xaf83('0x2')](_0xaf83('0x3'),auth[_0xaf83('0x4')](),auth[_0xaf83('0x5')](),controller[_0xaf83('0x6')]);router[_0xaf83('0x2')](_0xaf83('0x7'),auth['isAuthenticated'](),auth[_0xaf83('0x5')](),controller['reset']);router[_0xaf83('0x2')]('/pull',auth['isAuthenticated'](),auth[_0xaf83('0x5')](),controller['pull']);router[_0xaf83('0x2')](_0xaf83('0x8'),auth[_0xaf83('0x4')](),controller[_0xaf83('0x9')]);router[_0xaf83('0x2')](_0xaf83('0xa'),controller['migrations']);module[_0xaf83('0xb')]=router; \ No newline at end of file +var _0x217c=['isAuthenticated','canUpdate','fetch','/reset','reset','/pull','pull','restart','/migrations','migrations','express','Router','../../components/auth/service','./version.controller','get','index','/fetch'];(function(_0x3207f2,_0x27c2ae){var _0x4e0ed1=function(_0x363529){while(--_0x363529){_0x3207f2['push'](_0x3207f2['shift']());}};_0x4e0ed1(++_0x27c2ae);}(_0x217c,0x81));var _0xc217=function(_0x238943,_0x414e40){_0x238943=_0x238943-0x0;var _0x177fff=_0x217c[_0x238943];return _0x177fff;};'use strict';var express=require(_0xc217('0x0'));var router=express[_0xc217('0x1')]();var auth=require(_0xc217('0x2'));var controller=require(_0xc217('0x3'));router[_0xc217('0x4')]('/',controller[_0xc217('0x5')]);router[_0xc217('0x4')](_0xc217('0x6'),auth[_0xc217('0x7')](),auth[_0xc217('0x8')](),controller[_0xc217('0x9')]);router[_0xc217('0x4')](_0xc217('0xa'),auth[_0xc217('0x7')](),auth[_0xc217('0x8')](),controller[_0xc217('0xb')]);router['get'](_0xc217('0xc'),auth[_0xc217('0x7')](),auth['canUpdate'](),controller[_0xc217('0xd')]);router['get']('/restart',auth[_0xc217('0x7')](),controller[_0xc217('0xe')]);router['get'](_0xc217('0xf'),controller[_0xc217('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 52ffd1c..562a55e 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 _0x7368=['origin','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','server','replace','.js','push','length','sort','sequelize','getQueryInterface','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','join','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','lodash','compare-versions','child_process','exec','../../mysqldb','../../config/pm2','update','simple-git','root','index','exports','version','query','latest','fetch','2.0.0','json','status'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7368,0x89));var _0x8736=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x7368[_0x4b369d];return _0x571a98;};'use strict';var Umzug=require(_0x8736('0x0'));var path=require('path');var fs=require('fs');var _=require(_0x8736('0x1'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0x8736('0x2'));var exec=require(_0x8736('0x3'))[_0x8736('0x4')];var db=require(_0x8736('0x5'))['db'];var config=require('../../config/environment');var pm2=require(_0x8736('0x6'));var logger=require('../../config/logger')(_0x8736('0x7'));var git=require(_0x8736('0x8'))(config[_0x8736('0x9')]);exports[_0x8736('0xa')]=function(_0x89c55d,_0x3ad536){var _0x4c35ca={'current':module[_0x8736('0xb')][_0x8736('0xc')],'phonebar':0x2};if(_0x89c55d[_0x8736('0xd')]&&_0x89c55d[_0x8736('0xd')][_0x8736('0xe')]){return git[_0x8736('0xf')]()['tags'](function(_0x48a23a,_0x1ad001){_0x4c35ca[_0x8736('0xe')]=(_0x48a23a?module[_0x8736('0xb')][_0x8736('0xc')]:_0x1ad001[_0x8736('0xe')])||_0x8736('0x10');return _0x3ad536['status'](0xc8)[_0x8736('0x11')](_0x4c35ca);});}else{return _0x3ad536[_0x8736('0x12')](0xc8)[_0x8736('0x11')](_0x4c35ca);}};exports[_0x8736('0xf')]=function(_0x1ef509,_0x3ea4e7){return git[_0x8736('0xf')]([_0x8736('0x13'),_0x8736('0x14')],function(_0x3804ab){if(_0x3804ab){logger[_0x8736('0x15')](_0x3804ab);return _0x3ea4e7['status'](0x1f4)[_0x8736('0x11')](_0x3804ab);}logger[_0x8736('0x16')](_0x8736('0x17'));return _0x3ea4e7[_0x8736('0x12')](0xc8)[_0x8736('0x11')]({'output':_0x8736('0x18')});});};exports[_0x8736('0x19')]=function(_0x18739a,_0x5bf4eb){return git[_0x8736('0x19')]([_0x8736('0x1a'),'FETCH_HEAD'],function(_0x42db2f){if(_0x42db2f){logger['error'](_0x42db2f);return _0x5bf4eb[_0x8736('0x12')](0x1f4)[_0x8736('0x11')](_0x42db2f);}logger[_0x8736('0x16')](_0x8736('0x1b'));return _0x5bf4eb['status'](0xc8)[_0x8736('0x11')]({'output':_0x8736('0x1c')});});};exports['pull']=function(_0x410372,_0x4937d1){exec(_0x8736('0x1d'),function(_0x4a7e98,_0x335642,_0x4ead1c){logger[_0x8736('0x16')](_0x335642);logger[_0x8736('0x16')](_0x4ead1c);if(_0x4a7e98){logger[_0x8736('0x15')](_0x4a7e98);return _0x4937d1[_0x8736('0x12')](0x1f4)[_0x8736('0x11')](_0x4a7e98);}return _0x4937d1[_0x8736('0x12')](0xc8)['json']({'output':_0x335642});});};exports[_0x8736('0x1e')]=function(_0x53d7bb,_0x500500){return pm2['restart'](_0x8736('0x1f'))[_0x8736('0x20')](function(_0x4484ca){logger[_0x8736('0x16')](_0x8736('0x21'),_0x4484ca);return _0x500500[_0x8736('0x12')](0xc8)[_0x8736('0x11')]({'output':_0x8736('0x22')});})[_0x8736('0x23')](function(_0x497f59){logger['error'](_0x497f59);return _0x500500[_0x8736('0x12')](0x1f4)['json'](_0x497f59);});};exports[_0x8736('0x24')]=function(_0x2da100,_0x3e94c0){var _0x1d5989=fs['readdirSync'](path['join'](config[_0x8736('0x9')],_0x8736('0x25'),_0x8736('0x24')));var _0x5ea402=[];for(var _0x221ce8=0x0;_0x221ce8<_0x1d5989['length'];_0x221ce8++){var _0x358832=_0x1d5989[_0x221ce8][_0x8736('0x26')](_0x8736('0x27'),'');if(compareVersions(module[_0x8736('0xb')][_0x8736('0xc')],_0x358832)===-0x1){_0x5ea402[_0x8736('0x28')](_0x358832);}}if(_0x5ea402[_0x8736('0x29')]){var _0x48ff50=_0x5ea402[_0x8736('0x2a')](compareVersions);var _0x8b5fac=new Umzug({'storage':_0x8736('0x2b'),'storageOptions':{'model':db['Migration'],'modelName':'Migration','columnName':_0x8736('0xc')},'migrations':{'params':[db[_0x8736('0x2b')][_0x8736('0x2c')](),db['sequelize']['constructor'],function(){throw new Error(_0x8736('0x2d'));}],'path':path[_0x8736('0x2e')](config[_0x8736('0x9')],'server',_0x8736('0x24')),'pattern':/\.js$/}});_0x8b5fac['up']({'migrations':_['map'](_0x48ff50,function(_0x3fa249){return _0x3fa249+'.js';})})[_0x8736('0x20')](function(){return _0x3e94c0['status'](0xc8)[_0x8736('0x11')]({'output':_0x8736('0x2f')+module[_0x8736('0xb')][_0x8736('0xc')]+_0x8736('0x30')+_[_0x8736('0x31')](_0x48ff50),'migrations':_['join'](_0x48ff50)});})[_0x8736('0x23')](function(_0x3b96f0){if(_0x3b96f0 instanceof db['sequelize'][_0x8736('0x32')]){return _0x3e94c0[_0x8736('0x12')](0xc8)['json']({'output':_0x8736('0x33')});}else{return _0x3e94c0[_0x8736('0x12')](0x1f4)['json'](_0x3b96f0);}});}else{return _0x3e94c0[_0x8736('0x12')](0xc8)[_0x8736('0x11')]({'output':_0x8736('0x33')});}}; \ No newline at end of file +var _0x00bd=['tags','latest','exports','2.0.0','status','json','origin','error','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','info','restart','motion2','then','catch','readdirSync','server','migrations','length','push','sequelize','Migration','getQueryInterface','constructor','map','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','join','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','compare-versions','child_process','exec','../../mysqldb','../../config/environment','../../config/logger','simple-git','root','index','version','query','fetch'];(function(_0x3fc758,_0x21bc3d){var _0x4c692e=function(_0xc3628c){while(--_0xc3628c){_0x3fc758['push'](_0x3fc758['shift']());}};_0x4c692e(++_0x21bc3d);}(_0x00bd,0x155));var _0xd00b=function(_0x13363f,_0x48a989){_0x13363f=_0x13363f-0x0;var _0x277a54=_0x00bd[_0x13363f];return _0x277a54;};'use strict';var Umzug=require(_0xd00b('0x0'));var path=require(_0xd00b('0x1'));var fs=require('fs');var _=require(_0xd00b('0x2'));var pkginfo=require(_0xd00b('0x3'))(module,'version');var compareVersions=require(_0xd00b('0x4'));var exec=require(_0xd00b('0x5'))[_0xd00b('0x6')];var db=require(_0xd00b('0x7'))['db'];var config=require(_0xd00b('0x8'));var pm2=require('../../config/pm2');var logger=require(_0xd00b('0x9'))('update');var git=require(_0xd00b('0xa'))(config[_0xd00b('0xb')]);exports[_0xd00b('0xc')]=function(_0x22b73a,_0x5022dd){var _0xfab13f={'current':module['exports'][_0xd00b('0xd')],'phonebar':0x2};if(_0x22b73a[_0xd00b('0xe')]&&_0x22b73a[_0xd00b('0xe')]['latest']){return git[_0xd00b('0xf')]()[_0xd00b('0x10')](function(_0x38b860,_0xffa97c){_0xfab13f[_0xd00b('0x11')]=(_0x38b860?module[_0xd00b('0x12')][_0xd00b('0xd')]:_0xffa97c[_0xd00b('0x11')])||_0xd00b('0x13');return _0x5022dd[_0xd00b('0x14')](0xc8)[_0xd00b('0x15')](_0xfab13f);});}else{return _0x5022dd[_0xd00b('0x14')](0xc8)[_0xd00b('0x15')](_0xfab13f);}};exports['fetch']=function(_0x35f701,_0x13b111){return git[_0xd00b('0xf')]([_0xd00b('0x16'),'master'],function(_0x48b443){if(_0x48b443){logger[_0xd00b('0x17')](_0x48b443);return _0x13b111[_0xd00b('0x14')](0x1f4)[_0xd00b('0x15')](_0x48b443);}logger['info'](_0xd00b('0x18'));return _0x13b111['status'](0xc8)[_0xd00b('0x15')]({'output':_0xd00b('0x19')});});};exports['reset']=function(_0x3cfc46,_0x2fbb7d){return git[_0xd00b('0x1a')]([_0xd00b('0x1b'),'FETCH_HEAD'],function(_0x35c021){if(_0x35c021){logger[_0xd00b('0x17')](_0x35c021);return _0x2fbb7d['status'](0x1f4)[_0xd00b('0x15')](_0x35c021);}logger['info'](_0xd00b('0x1c'));return _0x2fbb7d[_0xd00b('0x14')](0xc8)['json']({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0x1bf0d1,_0x1d160c){exec(_0xd00b('0x1d'),function(_0x107c3a,_0x5070af,_0x1763b1){logger[_0xd00b('0x1e')](_0x5070af);logger[_0xd00b('0x1e')](_0x1763b1);if(_0x107c3a){logger[_0xd00b('0x17')](_0x107c3a);return _0x1d160c[_0xd00b('0x14')](0x1f4)['json'](_0x107c3a);}return _0x1d160c[_0xd00b('0x14')](0xc8)[_0xd00b('0x15')]({'output':_0x5070af});});};exports[_0xd00b('0x1f')]=function(_0x58bbf4,_0x5e3ecd){return pm2['restart'](_0xd00b('0x20'))[_0xd00b('0x21')](function(_0x3ce4c2){logger[_0xd00b('0x1e')]('pm2\x20restart\x20motion\x20%s',_0x3ce4c2);return _0x5e3ecd[_0xd00b('0x14')](0xc8)['json']({'output':'Your\x20system\x20has\x20been\x20restart\x20successfully'});})[_0xd00b('0x22')](function(_0x23a60f){logger[_0xd00b('0x17')](_0x23a60f);return _0x5e3ecd[_0xd00b('0x14')](0x1f4)[_0xd00b('0x15')](_0x23a60f);});};exports['migrations']=function(_0x18479f,_0x215123){var _0x747cc2=fs[_0xd00b('0x23')](path['join'](config[_0xd00b('0xb')],_0xd00b('0x24'),_0xd00b('0x25')));var _0x28ad43=[];for(var _0x7b865c=0x0;_0x7b865c<_0x747cc2[_0xd00b('0x26')];_0x7b865c++){var _0x2a004e=_0x747cc2[_0x7b865c]['replace']('.js','');if(compareVersions(module[_0xd00b('0x12')][_0xd00b('0xd')],_0x2a004e)===-0x1){_0x28ad43[_0xd00b('0x27')](_0x2a004e);}}if(_0x28ad43[_0xd00b('0x26')]){var _0x444c8e=_0x28ad43['sort'](compareVersions);var _0x97cb54=new Umzug({'storage':_0xd00b('0x28'),'storageOptions':{'model':db['Migration'],'modelName':_0xd00b('0x29'),'columnName':_0xd00b('0xd')},'migrations':{'params':[db['sequelize'][_0xd00b('0x2a')](),db[_0xd00b('0x28')][_0xd00b('0x2b')],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path['join'](config[_0xd00b('0xb')],_0xd00b('0x24'),_0xd00b('0x25')),'pattern':/\.js$/}});_0x97cb54['up']({'migrations':_[_0xd00b('0x2c')](_0x444c8e,function(_0x33dd46){return _0x33dd46+_0xd00b('0x2d');})})[_0xd00b('0x21')](function(){return _0x215123['status'](0xc8)[_0xd00b('0x15')]({'output':_0xd00b('0x2e')+module[_0xd00b('0x12')]['version']+_0xd00b('0x2f')+_[_0xd00b('0x30')](_0x444c8e),'migrations':_[_0xd00b('0x31')](_0x444c8e)});})['catch'](function(_0x4bdfa2){if(_0x4bdfa2 instanceof db[_0xd00b('0x28')]['UniqueConstraintError']){return _0x215123[_0xd00b('0x14')](0xc8)[_0xd00b('0x15')]({'output':_0xd00b('0x32')});}else{return _0x215123[_0xd00b('0x14')](0x1f4)[_0xd00b('0x15')](_0x4bdfa2);}});}else{return _0x215123[_0xd00b('0x14')](0xc8)[_0xd00b('0x15')]({'output':_0xd00b('0x32')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 2f63504..f5f9c00 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 _0xff21=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer'];(function(_0xf58a6f,_0x291585){var _0x23f99d=function(_0x54b6d4){while(--_0x54b6d4){_0xf58a6f['push'](_0xf58a6f['shift']());}};_0x23f99d(++_0x291585);}(_0xff21,0x1a1));var _0x1ff2=function(_0xb65ffb,_0x2cc0af){_0xb65ffb=_0xb65ffb-0x0;var _0x58f55c=_0xff21[_0xb65ffb];return _0x58f55c;};'use strict';var multer=require(_0x1ff2('0x0'));var util=require('util');var path=require(_0x1ff2('0x1'));var timeout=require('connect-timeout');var express=require(_0x1ff2('0x2'));var router=express[_0x1ff2('0x3')]();var fs_extra=require(_0x1ff2('0x4'));var auth=require(_0x1ff2('0x5'));var interaction=require(_0x1ff2('0x6'));var config=require(_0x1ff2('0x7'));var controller=require(_0x1ff2('0x8'));router[_0x1ff2('0x9')]('/',auth[_0x1ff2('0xa')](),controller[_0x1ff2('0xb')]);router[_0x1ff2('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x1ff2('0xc')]);router['get'](_0x1ff2('0xd'),auth[_0x1ff2('0xa')](),controller[_0x1ff2('0xe')]);router[_0x1ff2('0xf')]('/',auth[_0x1ff2('0xa')](),controller[_0x1ff2('0x10')]);router[_0x1ff2('0x11')](_0x1ff2('0xd'),auth[_0x1ff2('0xa')](),controller[_0x1ff2('0x12')]);router[_0x1ff2('0x13')](_0x1ff2('0xd'),auth[_0x1ff2('0xa')](),controller[_0x1ff2('0x14')]);module[_0x1ff2('0x15')]=router; \ No newline at end of file +var _0x8191=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','show','create','put','/:id','update'];(function(_0x3b00c1,_0x3d5759){var _0x1cbfbe=function(_0x479446){while(--_0x479446){_0x3b00c1['push'](_0x3b00c1['shift']());}};_0x1cbfbe(++_0x3d5759);}(_0x8191,0x131));var _0x1819=function(_0x152136,_0x4f14f1){_0x152136=_0x152136-0x0;var _0x20df44=_0x8191[_0x152136];return _0x20df44;};'use strict';var multer=require(_0x1819('0x0'));var util=require(_0x1819('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x1819('0x2'));var router=express[_0x1819('0x3')]();var fs_extra=require(_0x1819('0x4'));var auth=require(_0x1819('0x5'));var interaction=require(_0x1819('0x6'));var config=require(_0x1819('0x7'));var controller=require(_0x1819('0x8'));router[_0x1819('0x9')]('/',auth[_0x1819('0xa')](),controller['index']);router[_0x1819('0x9')](_0x1819('0xb'),auth[_0x1819('0xa')](),controller[_0x1819('0xc')]);router[_0x1819('0x9')]('/:id',auth[_0x1819('0xa')](),controller[_0x1819('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1819('0xe')]);router[_0x1819('0xf')](_0x1819('0x10'),auth[_0x1819('0xa')](),controller[_0x1819('0x11')]);router['delete'](_0x1819('0x10'),auth[_0x1819('0xa')](),controller['destroy']);module[_0x1819('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index dd72175..602735c 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 _0x373d=['BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','INTEGER'];(function(_0x59a3cc,_0x1797c8){var _0x26a295=function(_0x279141){while(--_0x279141){_0x59a3cc['push'](_0x59a3cc['shift']());}};_0x26a295(++_0x1797c8);}(_0x373d,0x1e2));var _0xd373=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x373d[_0x2db12b];return _0x20990b;};'use strict';var Sequelize=require(_0xd373('0x0'));module['exports']={'type':{'type':Sequelize[_0xd373('0x1')]},'uniqueid':{'type':Sequelize[_0xd373('0x1')]},'calleridnum':{'type':Sequelize[_0xd373('0x1')]},'calleridname':{'type':Sequelize[_0xd373('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xd373('0x1')]},'membername':{'type':Sequelize[_0xd373('0x1')]},'agentcalledAt':{'type':Sequelize[_0xd373('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0xd373('0x2')]},'agentdumpAt':{'type':Sequelize[_0xd373('0x2')]},'holdtime':{'type':Sequelize[_0xd373('0x3')]},'agentcomplete':{'type':Sequelize[_0xd373('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xd373('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xd373('0x1')]},'lastevent':{'type':Sequelize[_0xd373('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xd373('0x3')]},'channelstatedesc':{'type':Sequelize[_0xd373('0x1')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xd373('0x1')]},'accountcode':{'type':Sequelize[_0xd373('0x1')]},'context':{'type':Sequelize[_0xd373('0x1')]},'exten':{'type':Sequelize[_0xd373('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xd373('0x1')]},'destcalleridnum':{'type':Sequelize[_0xd373('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xd373('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xd373('0x1')]},'destlanguage':{'type':Sequelize[_0xd373('0x1')]},'destaccountcode':{'type':Sequelize[_0xd373('0x1')]},'destcontext':{'type':Sequelize[_0xd373('0x1')]},'destexten':{'type':Sequelize[_0xd373('0x1')]},'destpriority':{'type':Sequelize[_0xd373('0x1')]},'destuniqueid':{'type':Sequelize[_0xd373('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xd373('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xd373('0x1')]},'transfer':{'type':Sequelize[_0xd373('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xd373('0x1')],'comment':_0xd373('0x5')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0xd373('0x1')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xaa64=['BOOLEAN','sequelize','exports','STRING','DATE','INTEGER'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xaa64,0xf7));var _0x4aa6=function(_0x4d3826,_0x1335b1){_0x4d3826=_0x4d3826-0x0;var _0x33eafd=_0xaa64[_0x4d3826];return _0x33eafd;};'use strict';var Sequelize=require(_0x4aa6('0x0'));module[_0x4aa6('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4aa6('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x4aa6('0x2')]},'queue':{'type':Sequelize[_0x4aa6('0x2')]},'interface':{'type':Sequelize[_0x4aa6('0x2')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentconnectAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x4aa6('0x3')]},'agentdumpAt':{'type':Sequelize[_0x4aa6('0x3')]},'holdtime':{'type':Sequelize[_0x4aa6('0x4')]},'agentcomplete':{'type':Sequelize[_0x4aa6('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x4aa6('0x4')]},'agentacw':{'type':Sequelize[_0x4aa6('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x4aa6('0x2')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4aa6('0x2')]},'channelstate':{'type':Sequelize[_0x4aa6('0x4')]},'channelstatedesc':{'type':Sequelize[_0x4aa6('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4aa6('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4aa6('0x2')]},'accountcode':{'type':Sequelize[_0x4aa6('0x2')]},'context':{'type':Sequelize[_0x4aa6('0x2')]},'exten':{'type':Sequelize[_0x4aa6('0x2')]},'priority':{'type':Sequelize[_0x4aa6('0x2')]},'destchannel':{'type':Sequelize[_0x4aa6('0x2')]},'destchannelstate':{'type':Sequelize[_0x4aa6('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0x4aa6('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4aa6('0x2')]},'destcalleridname':{'type':Sequelize[_0x4aa6('0x2')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x4aa6('0x2')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x4aa6('0x2')]},'destexten':{'type':Sequelize[_0x4aa6('0x2')]},'destpriority':{'type':Sequelize[_0x4aa6('0x2')]},'destuniqueid':{'type':Sequelize[_0x4aa6('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x4aa6('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x4aa6('0x2')]},'transfer':{'type':Sequelize[_0x4aa6('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x4aa6('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x4aa6('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0x4aa6('0x4')],'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 e0353b8..aa073ef 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(_0x1a7846,_0x59723e){var _0x48049=function(_0x203ff6){while(--_0x203ff6){_0x1a7846['push'](_0x1a7846['shift']());}};_0x48049(++_0x59723e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xa9e0[_0x47e7cb];return _0x2a8874;};'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 7d4f218..db6d77d 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 _0x2f74=['moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api'];(function(_0x21205e,_0x7eb8e7){var _0x136ebb=function(_0x54aac2){while(--_0x54aac2){_0x21205e['push'](_0x21205e['shift']());}};_0x136ebb(++_0x7eb8e7);}(_0x2f74,0x7b));var _0x42f7=function(_0x3a2797,_0x1f905c){_0x3a2797=_0x3a2797-0x0;var _0x5c2d96=_0x2f74[_0x3a2797];return _0x5c2d96;};'use strict';var _=require(_0x42f7('0x0'));var util=require('util');var logger=require(_0x42f7('0x1'))(_0x42f7('0x2'));var moment=require(_0x42f7('0x3'));var BPromise=require(_0x42f7('0x4'));var rp=require(_0x42f7('0x5'));var fs=require('fs');var path=require(_0x42f7('0x6'));var rimraf=require(_0x42f7('0x7'));var config=require(_0x42f7('0x8'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x540e53,_0x250aa9){return _0x540e53[_0x42f7('0x9')](_0x42f7('0xa'),attributes,{'tableName':_0x42f7('0xb'),'paranoid':![],'indexes':[{'fields':[_0x42f7('0xc'),_0x42f7('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9491=['uniqueid','destuniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','report_agent'];(function(_0x4220fa,_0x359450){var _0x26e4a0=function(_0x3246d0){while(--_0x3246d0){_0x4220fa['push'](_0x4220fa['shift']());}};_0x26e4a0(++_0x359450);}(_0x9491,0xb6));var _0x1949=function(_0x4ee94b,_0x29d887){_0x4ee94b=_0x4ee94b-0x0;var _0x492c2a=_0x9491[_0x4ee94b];return _0x492c2a;};'use strict';var _=require(_0x1949('0x0'));var util=require(_0x1949('0x1'));var logger=require(_0x1949('0x2'))(_0x1949('0x3'));var moment=require(_0x1949('0x4'));var BPromise=require(_0x1949('0x5'));var rp=require(_0x1949('0x6'));var fs=require('fs');var path=require(_0x1949('0x7'));var rimraf=require(_0x1949('0x8'));var config=require(_0x1949('0x9'));var attributes=require('./voiceAgentReport.attributes');module[_0x1949('0xa')]=function(_0x5b01b9,_0x14c30e){return _0x5b01b9[_0x1949('0xb')]('VoiceAgentReport',attributes,{'tableName':_0x1949('0xc'),'paranoid':![],'indexes':[{'fields':[_0x1949('0xd'),_0x1949('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 45f8a19..ec6505d 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 _0x25cf=['lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','options','raw','then','catch','UpdateVoiceAgentReport','update','where','attributes'];(function(_0x2c3458,_0x1f7efd){var _0x3f7e02=function(_0x261040){while(--_0x261040){_0x2c3458['push'](_0x2c3458['shift']());}};_0x3f7e02(++_0x1f7efd);}(_0x25cf,0x140));var _0xf25c=function(_0x196ce1,_0x46e836){_0x196ce1=_0x196ce1-0x0;var _0x360a64=_0x25cf[_0x196ce1];return _0x360a64;};'use strict';var _=require(_0xf25c('0x0'));var util=require(_0xf25c('0x1'));var moment=require(_0xf25c('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf25c('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf25c('0x4'));var logger=require(_0xf25c('0x5'))(_0xf25c('0x6'));var config=require('../../config/environment');var jayson=require(_0xf25c('0x7'));var client=jayson[_0xf25c('0x8')][_0xf25c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45f300,_0x509d34,_0x42065a){return new BPromise(function(_0x159056,_0x4ad392){return client[_0xf25c('0xa')](_0x45f300,_0x42065a)['then'](function(_0x5e7ba2){logger[_0xf25c('0xb')](_0xf25c('0xc'),_0x509d34,_0xf25c('0xd'));logger[_0xf25c('0xe')](_0xf25c('0xf'),_0x509d34,_0xf25c('0xd'),JSON[_0xf25c('0x10')](_0x5e7ba2));if(_0x5e7ba2[_0xf25c('0x11')]){if(_0x5e7ba2['error'][_0xf25c('0x12')]===0x1f4){logger[_0xf25c('0x11')](_0xf25c('0xc'),_0x509d34,_0x5e7ba2['error'][_0xf25c('0x13')]);return _0x4ad392(_0x5e7ba2[_0xf25c('0x11')]['message']);}logger[_0xf25c('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x509d34,_0x5e7ba2[_0xf25c('0x11')][_0xf25c('0x13')]);return _0x159056(_0x5e7ba2[_0xf25c('0x11')][_0xf25c('0x13')]);}else{logger[_0xf25c('0xb')](_0xf25c('0xc'),_0x509d34,_0xf25c('0xd'));_0x159056(_0x5e7ba2[_0xf25c('0x14')][_0xf25c('0x13')]);}})['catch'](function(_0x537af0){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x509d34,_0x537af0);_0x4ad392(_0x537af0);});});}exports[_0xf25c('0x15')]=function(_0x57040a){var _0x4e1a98=this;return new Promise(function(_0x17bf19,_0x1d0804){return db[_0xf25c('0x16')][_0xf25c('0x17')](_0x57040a['body'],{'raw':_0x57040a[_0xf25c('0x18')]?_0x57040a[_0xf25c('0x18')][_0xf25c('0x19')]===undefined?!![]:![]:!![]})[_0xf25c('0x1a')](function(_0x5a396f){logger[_0xf25c('0xb')](_0xf25c('0x15'),_0x57040a);logger[_0xf25c('0xe')](_0xf25c('0x15'),_0x57040a,JSON[_0xf25c('0x10')](_0x5a396f));_0x17bf19(_0x5a396f);})[_0xf25c('0x1b')](function(_0x1f8f82){logger[_0xf25c('0x11')](_0xf25c('0x15'),_0x1f8f82[_0xf25c('0x13')],_0x57040a);_0x1d0804(_0x4e1a98[_0xf25c('0x11')](0x1f4,_0x1f8f82[_0xf25c('0x13')]));});});};exports[_0xf25c('0x1c')]=function(_0x427b76){var _0x57ac28=this;return new Promise(function(_0xd09dda,_0x34cd74){return db['VoiceAgentReport'][_0xf25c('0x1d')](_0x427b76['body'],{'raw':_0x427b76[_0xf25c('0x18')]?_0x427b76[_0xf25c('0x18')][_0xf25c('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x427b76[_0xf25c('0x18')]?_0x427b76[_0xf25c('0x18')][_0xf25c('0x1e')]||null:null,'attributes':_0x427b76[_0xf25c('0x18')]?_0x427b76[_0xf25c('0x18')][_0xf25c('0x1f')]||null:null,'limit':_0x427b76[_0xf25c('0x18')]?_0x427b76[_0xf25c('0x18')]['limit']||null:null})[_0xf25c('0x1a')](function(_0x3c22a0){logger['info']('UpdateVoiceAgentReport',_0x427b76);logger['debug'](_0xf25c('0x1c'),_0x427b76,JSON['stringify'](_0x3c22a0));_0xd09dda(_0x3c22a0);})[_0xf25c('0x1b')](function(_0x241e9c){logger[_0xf25c('0x11')](_0xf25c('0x1c'),_0x241e9c[_0xf25c('0x13')],_0x427b76);_0x34cd74(_0x57ac28['error'](0x1f4,_0x241e9c['message']));});});}; \ No newline at end of file +var _0xfc00=['raw','then','stringify','update','attributes','limit','UpdateVoiceAgentReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','error','code','VoiceAgentReport,\x20%s,\x20%s','message','info','result','catch','CreateVoiceAgentReport','VoiceAgentReport','create','options'];(function(_0x5f51c4,_0x204c1a){var _0x5c0a8d=function(_0x2c3207){while(--_0x2c3207){_0x5f51c4['push'](_0x5f51c4['shift']());}};_0x5c0a8d(++_0x204c1a);}(_0xfc00,0x167));var _0x0fc0=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0xfc00[_0x3c59fc];return _0x2b78d4;};'use strict';var _=require(_0x0fc0('0x0'));var util=require(_0x0fc0('0x1'));var moment=require(_0x0fc0('0x2'));var BPromise=require('bluebird');var rs=require(_0x0fc0('0x3'));var fs=require('fs');var Redis=require(_0x0fc0('0x4'));var db=require(_0x0fc0('0x5'))['db'];var utils=require(_0x0fc0('0x6'));var logger=require(_0x0fc0('0x7'))(_0x0fc0('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0fc0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2692de,_0x455638,_0x1fd412){return new BPromise(function(_0x3fd068,_0x4a3285){return client[_0x0fc0('0xa')](_0x2692de,_0x1fd412)['then'](function(_0x1e33a7){logger['info']('VoiceAgentReport,\x20%s,\x20%s',_0x455638,_0x0fc0('0xb'));logger[_0x0fc0('0xc')](_0x0fc0('0xd'),_0x455638,_0x0fc0('0xb'),JSON['stringify'](_0x1e33a7));if(_0x1e33a7[_0x0fc0('0xe')]){if(_0x1e33a7[_0x0fc0('0xe')][_0x0fc0('0xf')]===0x1f4){logger[_0x0fc0('0xe')](_0x0fc0('0x10'),_0x455638,_0x1e33a7[_0x0fc0('0xe')]['message']);return _0x4a3285(_0x1e33a7[_0x0fc0('0xe')][_0x0fc0('0x11')]);}logger[_0x0fc0('0xe')](_0x0fc0('0x10'),_0x455638,_0x1e33a7[_0x0fc0('0xe')][_0x0fc0('0x11')]);return _0x3fd068(_0x1e33a7[_0x0fc0('0xe')]['message']);}else{logger[_0x0fc0('0x12')]('VoiceAgentReport,\x20%s,\x20%s',_0x455638,'request\x20sent');_0x3fd068(_0x1e33a7[_0x0fc0('0x13')][_0x0fc0('0x11')]);}})[_0x0fc0('0x14')](function(_0x4cf92f){logger[_0x0fc0('0xe')](_0x0fc0('0x10'),_0x455638,_0x4cf92f);_0x4a3285(_0x4cf92f);});});}exports[_0x0fc0('0x15')]=function(_0x5e29f9){var _0x301ce5=this;return new Promise(function(_0x4f70aa,_0x4e1fcf){return db[_0x0fc0('0x16')][_0x0fc0('0x17')](_0x5e29f9['body'],{'raw':_0x5e29f9[_0x0fc0('0x18')]?_0x5e29f9[_0x0fc0('0x18')][_0x0fc0('0x19')]===undefined?!![]:![]:!![]})[_0x0fc0('0x1a')](function(_0x202ab0){logger[_0x0fc0('0x12')](_0x0fc0('0x15'),_0x5e29f9);logger[_0x0fc0('0xc')](_0x0fc0('0x15'),_0x5e29f9,JSON[_0x0fc0('0x1b')](_0x202ab0));_0x4f70aa(_0x202ab0);})[_0x0fc0('0x14')](function(_0x8e8556){logger['error'](_0x0fc0('0x15'),_0x8e8556[_0x0fc0('0x11')],_0x5e29f9);_0x4e1fcf(_0x301ce5[_0x0fc0('0xe')](0x1f4,_0x8e8556['message']));});});};exports['UpdateVoiceAgentReport']=function(_0x5d0de6){var _0x39f918=this;return new Promise(function(_0x1acace,_0x12e23e){return db['VoiceAgentReport'][_0x0fc0('0x1c')](_0x5d0de6['body'],{'raw':_0x5d0de6[_0x0fc0('0x18')]?_0x5d0de6[_0x0fc0('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d0de6[_0x0fc0('0x18')]?_0x5d0de6[_0x0fc0('0x18')]['where']||null:null,'attributes':_0x5d0de6[_0x0fc0('0x18')]?_0x5d0de6['options'][_0x0fc0('0x1d')]||null:null,'limit':_0x5d0de6[_0x0fc0('0x18')]?_0x5d0de6['options'][_0x0fc0('0x1e')]||null:null})[_0x0fc0('0x1a')](function(_0x435f77){logger[_0x0fc0('0x12')](_0x0fc0('0x1f'),_0x5d0de6);logger[_0x0fc0('0xc')](_0x0fc0('0x1f'),_0x5d0de6,JSON[_0x0fc0('0x1b')](_0x435f77));_0x1acace(_0x435f77);})['catch'](function(_0x55fcfc){logger[_0x0fc0('0xe')](_0x0fc0('0x1f'),_0x55fcfc['message'],_0x5d0de6);_0x12e23e(_0x39f918[_0x0fc0('0xe')](0x1f4,_0x55fcfc[_0x0fc0('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index afe099d..79eedba 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 _0x0d6b=['../../components/auth/service','isAuthenticated','index','get','/describe','/:id','post','create','put','updateWithRetry','delete','destroy','exports','express','Router'];(function(_0x151911,_0x4de5d6){var _0x18e43d=function(_0x5f4afa){while(--_0x5f4afa){_0x151911['push'](_0x151911['shift']());}};_0x18e43d(++_0x4de5d6);}(_0x0d6b,0xd0));var _0xb0d6=function(_0x5bccb9,_0x1eb18f){_0x5bccb9=_0x5bccb9-0x0;var _0x531ac6=_0x0d6b[_0x5bccb9];return _0x531ac6;};'use strict';var express=require(_0xb0d6('0x0'));var router=express[_0xb0d6('0x1')]();var auth=require(_0xb0d6('0x2'));var controller=require('./voiceCallReport.controller');router['get']('/',auth[_0xb0d6('0x3')](),controller[_0xb0d6('0x4')]);router[_0xb0d6('0x5')](_0xb0d6('0x6'),auth[_0xb0d6('0x3')](),controller['describe']);router[_0xb0d6('0x5')](_0xb0d6('0x7'),auth[_0xb0d6('0x3')](),controller['show']);router[_0xb0d6('0x8')]('/',auth['isAuthenticated'](),controller[_0xb0d6('0x9')]);router['put'](_0xb0d6('0x7'),auth[_0xb0d6('0x3')](),controller['update']);router[_0xb0d6('0xa')]('/with-retry/:id',auth[_0xb0d6('0x3')](),controller[_0xb0d6('0xb')]);router[_0xb0d6('0xc')]('/:id',auth['isAuthenticated'](),controller[_0xb0d6('0xd')]);module[_0xb0d6('0xe')]=router; \ No newline at end of file +var _0xc272=['index','describe','/:id','show','post','create','put','update','/with-retry/:id','updateWithRetry','delete','destroy','exports','express','Router','../../components/auth/service','./voiceCallReport.controller','get','isAuthenticated'];(function(_0x47f767,_0x2e92f3){var _0x21c9a0=function(_0x203c34){while(--_0x203c34){_0x47f767['push'](_0x47f767['shift']());}};_0x21c9a0(++_0x2e92f3);}(_0xc272,0x19c));var _0x2c27=function(_0x3f25b2,_0x412bd4){_0x3f25b2=_0x3f25b2-0x0;var _0xd8caeb=_0xc272[_0x3f25b2];return _0xd8caeb;};'use strict';var express=require(_0x2c27('0x0'));var router=express[_0x2c27('0x1')]();var auth=require(_0x2c27('0x2'));var controller=require(_0x2c27('0x3'));router[_0x2c27('0x4')]('/',auth[_0x2c27('0x5')](),controller[_0x2c27('0x6')]);router['get']('/describe',auth[_0x2c27('0x5')](),controller[_0x2c27('0x7')]);router[_0x2c27('0x4')](_0x2c27('0x8'),auth[_0x2c27('0x5')](),controller[_0x2c27('0x9')]);router[_0x2c27('0xa')]('/',auth['isAuthenticated'](),controller[_0x2c27('0xb')]);router[_0x2c27('0xc')](_0x2c27('0x8'),auth[_0x2c27('0x5')](),controller[_0x2c27('0xd')]);router['put'](_0x2c27('0xe'),auth[_0x2c27('0x5')](),controller[_0x2c27('0xf')]);router[_0x2c27('0x10')](_0x2c27('0x8'),auth['isAuthenticated'](),controller[_0x2c27('0x11')]);module[_0x2c27('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index f89d88d..f49b6c5 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 _0x6215=['INTEGER','sequelize','exports','STRING','inbound','internal','outbound','inbound-fax','outbound-fax','dialer','DATE'];(function(_0xdcda3,_0x4252fb){var _0x2bec82=function(_0x589fe2){while(--_0x589fe2){_0xdcda3['push'](_0xdcda3['shift']());}};_0x2bec82(++_0x4252fb);}(_0x6215,0x198));var _0x5621=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6215[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5621('0x0'));module[_0x5621('0x1')]={'uniqueid':{'type':Sequelize[_0x5621('0x2')]},'type':{'type':Sequelize['ENUM'](_0x5621('0x3'),_0x5621('0x4'),_0x5621('0x5'),_0x5621('0x6'),_0x5621('0x7'),_0x5621('0x8'))},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize[_0x5621('0x2')]},'callerid':{'type':Sequelize[_0x5621('0x2')]},'channel':{'type':Sequelize[_0x5621('0x2')]},'destinationchannel':{'type':Sequelize[_0x5621('0x2')]},'lastapplication':{'type':Sequelize[_0x5621('0x2')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x5621('0x9')]},'systemanswertime':{'type':Sequelize[_0x5621('0x9')]},'answertime':{'type':Sequelize[_0x5621('0x9')]},'endtime':{'type':Sequelize[_0x5621('0x9')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0x5621('0xa')]},'mohtime':{'type':Sequelize[_0x5621('0xa')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x5621('0x2')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x5621('0x2')]},'userDisposition':{'type':Sequelize[_0x5621('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x5621('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x5621('0x2')]},'note':{'type':Sequelize[_0x5621('0x2')]},'prefix':{'type':Sequelize[_0x5621('0x2')]},'routeid':{'type':Sequelize[_0x5621('0xa')]},'sipcallid':{'type':Sequelize[_0x5621('0x2')]}}; \ No newline at end of file +var _0x8d75=['exports','STRING','ENUM','inbound','internal','outbound-fax','dialer','DATE','INTEGER','sequelize'];(function(_0x3a6f75,_0x2c532f){var _0x413b52=function(_0x495d25){while(--_0x495d25){_0x3a6f75['push'](_0x3a6f75['shift']());}};_0x413b52(++_0x2c532f);}(_0x8d75,0x6d));var _0x58d7=function(_0xc8fc4d,_0x4ebbbc){_0xc8fc4d=_0xc8fc4d-0x0;var _0x58a7ca=_0x8d75[_0xc8fc4d];return _0x58a7ca;};'use strict';var Sequelize=require(_0x58d7('0x0'));module[_0x58d7('0x1')]={'uniqueid':{'type':Sequelize[_0x58d7('0x2')]},'type':{'type':Sequelize[_0x58d7('0x3')](_0x58d7('0x4'),_0x58d7('0x5'),'outbound','inbound-fax',_0x58d7('0x6'),_0x58d7('0x7'))},'tag':{'type':Sequelize[_0x58d7('0x2')]},'accountcode':{'type':Sequelize[_0x58d7('0x2')]},'source':{'type':Sequelize[_0x58d7('0x2')]},'destination':{'type':Sequelize['STRING']},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x58d7('0x2')]},'channel':{'type':Sequelize[_0x58d7('0x2')]},'destinationchannel':{'type':Sequelize[_0x58d7('0x2')]},'lastapplication':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0x58d7('0x8')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x58d7('0x8')]},'endtime':{'type':Sequelize[_0x58d7('0x8')]},'duration':{'type':Sequelize[_0x58d7('0x9')]},'billableseconds':{'type':Sequelize[_0x58d7('0x9')]},'mohtime':{'type':Sequelize[_0x58d7('0x9')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x58d7('0x2')]},'amaflags':{'type':Sequelize[_0x58d7('0x2')]},'userfield':{'type':Sequelize[_0x58d7('0x2')]},'userDisposition':{'type':Sequelize[_0x58d7('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x58d7('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x58d7('0x2')]},'note':{'type':Sequelize[_0x58d7('0x2')]},'prefix':{'type':Sequelize[_0x58d7('0x2')]},'routeid':{'type':Sequelize['INTEGER']},'sipcallid':{'type':Sequelize[_0x58d7('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 4dddc30..feb5791 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 _0x7217=['find','create','describe','params','user','body','uniqueid','updateWithRetry','lodash','../../config/logger','api','../../mysqldb','promise-retry','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','error','stack','name','send','map','VoiceCallReport','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','keys','options'];(function(_0x27d8bc,_0x19e010){var _0x4b04cb=function(_0x524568){while(--_0x524568){_0x27d8bc['push'](_0x27d8bc['shift']());}};_0x4b04cb(++_0x19e010);}(_0x7217,0x19e));var _0x7721=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0x7217[_0x1c546c];return _0x2cc384;};'use strict';var _=require(_0x7721('0x0'));var qs=require('../../components/parsers/qs');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var db=require(_0x7721('0x3'))['db'];const promiseRetry=require(_0x7721('0x4'));function respondWithResult(_0x115ab3,_0x4d6446){_0x4d6446=_0x4d6446||0xc8;return function(_0x5bf160){if(_0x5bf160){return _0x115ab3[_0x7721('0x5')](_0x4d6446)[_0x7721('0x6')](_0x5bf160);}};}function respondWithFilteredResult(_0x46415c,_0x3fe47c){return function(_0xb239e0){if(_0xb239e0){var _0xf7ff37=typeof _0x3fe47c[_0x7721('0x7')]===_0x7721('0x8')&&typeof _0x3fe47c[_0x7721('0x9')]===_0x7721('0x8');var _0x3e6368=_0xb239e0[_0x7721('0xa')];var _0xfa8835=_0xf7ff37?0x0:_0x3fe47c[_0x7721('0x7')];var _0x2c3986=_0xf7ff37?_0xb239e0['count']:_0x3fe47c[_0x7721('0x7')]+_0x3fe47c[_0x7721('0x9')];var _0x8729a6;if(_0x2c3986>=_0x3e6368){_0x2c3986=_0x3e6368;_0x8729a6=0xc8;}else{_0x8729a6=0xce;}_0x46415c[_0x7721('0x5')](_0x8729a6);return _0x46415c[_0x7721('0xb')](_0x7721('0xc'),_0xfa8835+'-'+_0x2c3986+'/'+_0x3e6368)[_0x7721('0x6')](_0xb239e0);}return null;};}function saveUpdates(_0x27b36b){return function(_0x55b4ca){if(_0x55b4ca){return _0x55b4ca[_0x7721('0xd')](_0x27b36b)[_0x7721('0xe')](function(_0x57ff6d){return _0x57ff6d;});}return null;};}function removeEntity(_0x109900){return function(_0x30da54){if(_0x30da54){return _0x30da54[_0x7721('0xf')]()[_0x7721('0xe')](function(){_0x109900['status'](0xcc)[_0x7721('0x10')]();});}};}function handleEntityNotFound(_0x25b1c0){return function(_0x534f1b){if(!_0x534f1b){_0x25b1c0['sendStatus'](0x194);}return _0x534f1b;};}function handleError(_0x4b183e,_0x5ed54){_0x5ed54=_0x5ed54||0x1f4;return function(_0x25a628){logger[_0x7721('0x11')](_0x25a628[_0x7721('0x12')]);if(_0x25a628['name']){delete _0x25a628[_0x7721('0x13')];}_0x4b183e['status'](_0x5ed54)[_0x7721('0x14')](_0x25a628);};}exports['index']=function(_0xfec626,_0x4e96fb){var _0x3ab5a5={},_0x3e140d={},_0x2286e5={'count':0x0,'rows':[]};var _0x40af90=_[_0x7721('0x15')](db[_0x7721('0x16')][_0x7721('0x17')],function(_0xaeccc4){return{'name':_0xaeccc4['fieldName'],'type':_0xaeccc4[_0x7721('0x18')][_0x7721('0x19')]};});_0x3e140d[_0x7721('0x1a')]=_[_0x7721('0x15')](_0x40af90,'name');_0x3e140d[_0x7721('0x1b')]=_['keys'](_0xfec626[_0x7721('0x1b')]);_0x3e140d[_0x7721('0x1c')]=_[_0x7721('0x1d')](_0x3e140d[_0x7721('0x1a')],_0x3e140d[_0x7721('0x1b')]);_0x3ab5a5[_0x7721('0x1e')]=_[_0x7721('0x1d')](_0x3e140d['model'],qs[_0x7721('0x1f')](_0xfec626[_0x7721('0x1b')][_0x7721('0x1f')]));_0x3ab5a5[_0x7721('0x1e')]=_0x3ab5a5[_0x7721('0x1e')][_0x7721('0x20')]?_0x3ab5a5[_0x7721('0x1e')]:_0x3e140d[_0x7721('0x1a')];if(!_0xfec626[_0x7721('0x1b')]['hasOwnProperty'](_0x7721('0x21'))){_0x3ab5a5['limit']=qs['limit'](_0xfec626[_0x7721('0x1b')][_0x7721('0x9')]);_0x3ab5a5[_0x7721('0x7')]=qs[_0x7721('0x7')](_0xfec626[_0x7721('0x1b')][_0x7721('0x7')]);}_0x3ab5a5[_0x7721('0x22')]=qs[_0x7721('0x23')](_0xfec626['query'][_0x7721('0x23')]);_0x3ab5a5[_0x7721('0x24')]=qs['filters'](_['pick'](_0xfec626[_0x7721('0x1b')],_0x3e140d[_0x7721('0x1c')]),_0x40af90);if(_0xfec626['query'][_0x7721('0x25')]){_0x3ab5a5[_0x7721('0x24')]=_[_0x7721('0x26')](_0x3ab5a5['where'],{'$or':_[_0x7721('0x15')](_0x40af90,function(_0x1ff31b){if(_0x1ff31b[_0x7721('0x18')]!==_0x7721('0x27')){var _0xc0f3c4={};_0xc0f3c4[_0x1ff31b['name']]={'$like':'%'+_0xfec626[_0x7721('0x1b')][_0x7721('0x25')]+'%'};return _0xc0f3c4;}})});}_0x3ab5a5=_[_0x7721('0x26')]({},_0x3ab5a5,_0xfec626['options']);var _0x35de7a={'where':_0x3ab5a5[_0x7721('0x24')]};return db['VoiceCallReport'][_0x7721('0xa')](_0x35de7a)['then'](function(_0x2d6ba0){_0x2286e5[_0x7721('0xa')]=_0x2d6ba0;if(_0xfec626[_0x7721('0x1b')][_0x7721('0x28')]){_0x3ab5a5[_0x7721('0x29')]=[{'attributes':['id',_0x7721('0x13'),_0x7721('0x2a'),_0x7721('0x2b')],'model':db[_0x7721('0x2c')],'as':_0x7721('0x2c')}];}return db[_0x7721('0x16')]['findAll'](_0x3ab5a5);})[_0x7721('0xe')](function(_0x5e6663){_0x2286e5[_0x7721('0x2d')]=_0x5e6663;return _0x2286e5;})[_0x7721('0xe')](respondWithFilteredResult(_0x4e96fb,_0x3ab5a5))[_0x7721('0x2e')](handleError(_0x4e96fb,null));};exports[_0x7721('0x2f')]=function(_0x3968f3,_0x378ba5){var _0x482b70={'raw':!![],'where':{'id':_0x3968f3['params']['id']}},_0x557c34={};_0x557c34['model']=_[_0x7721('0x30')](db[_0x7721('0x16')][_0x7721('0x17')]);_0x557c34[_0x7721('0x1b')]=_['keys'](_0x3968f3[_0x7721('0x1b')]);_0x557c34['filters']=_[_0x7721('0x1d')](_0x557c34[_0x7721('0x1a')],_0x557c34['query']);_0x482b70[_0x7721('0x1e')]=_[_0x7721('0x1d')](_0x557c34['model'],qs['fields'](_0x3968f3[_0x7721('0x1b')][_0x7721('0x1f')]));_0x482b70[_0x7721('0x1e')]=_0x482b70[_0x7721('0x1e')]['length']?_0x482b70[_0x7721('0x1e')]:_0x557c34[_0x7721('0x1a')];if(_0x3968f3[_0x7721('0x1b')][_0x7721('0x28')]){_0x482b70[_0x7721('0x29')]=[{'all':!![]}];}_0x482b70=_['merge']({},_0x482b70,_0x3968f3[_0x7721('0x31')]);return db['VoiceCallReport'][_0x7721('0x32')](_0x482b70)['then'](handleEntityNotFound(_0x378ba5,null))[_0x7721('0xe')](respondWithResult(_0x378ba5,null))[_0x7721('0x2e')](handleError(_0x378ba5,null));};exports[_0x7721('0x33')]=function(_0x49e0c5,_0x1453d4){return db[_0x7721('0x16')][_0x7721('0x33')](_0x49e0c5['body'],{})[_0x7721('0xe')](respondWithResult(_0x1453d4,0xc9))[_0x7721('0x2e')](handleError(_0x1453d4,null));};exports[_0x7721('0xf')]=function(_0x2d5f35,_0x135dbc){return db[_0x7721('0x16')][_0x7721('0x32')]({'where':{'id':_0x2d5f35['params']['id']}})['then'](handleEntityNotFound(_0x135dbc,null))[_0x7721('0xe')](removeEntity(_0x135dbc,null))[_0x7721('0x2e')](handleError(_0x135dbc,null));};exports[_0x7721('0x34')]=function(_0x39a3ad,_0x335145){return db[_0x7721('0x16')][_0x7721('0x34')]()[_0x7721('0xe')](respondWithResult(_0x335145,null))[_0x7721('0x2e')](handleError(_0x335145,null));};function findForUpdate(_0x3af123){return db['VoiceCallReport']['find']({'where':{'uniqueid':_0x3af123[_0x7721('0x35')]['id'],'UserId':{'$or':[null,_0x3af123[_0x7721('0x36')]['id']]}}});}exports[_0x7721('0xd')]=function(_0x219c9f,_0x589e95){if(_0x219c9f[_0x7721('0x37')][_0x7721('0x38')]){delete _0x219c9f['body'][_0x7721('0x38')];}return findForUpdate(_0x219c9f)['then'](handleEntityNotFound(_0x589e95,null))[_0x7721('0xe')](saveUpdates(_0x219c9f['body'],null))[_0x7721('0xe')](respondWithResult(_0x589e95,null))[_0x7721('0x2e')](handleError(_0x589e95,null));};exports[_0x7721('0x39')]=function(_0x4eda58,_0x2d18dd,_0x20fbbb){if(_0x4eda58['body'][_0x7721('0x38')]){delete _0x4eda58[_0x7721('0x37')][_0x7721('0x38')];}promiseRetry(function(){return findForUpdate(_0x4eda58);},{'retries':0x6,'minTimeout':0xfa})['then'](function(_0x20ba21){if(!_0x20ba21){return new Promise(function(_0x5a32b6){_0x5a32b6(handleEntityNotFound(_0x2d18dd)());});}else{return _0x20ba21[_0x7721('0xd')](_0x4eda58[_0x7721('0x37')])[_0x7721('0xe')](function(_0x443503){return respondWithResult(_0x2d18dd)(_0x443503);});}},function(){handleEntityNotFound(_0x2d18dd)();});}; \ No newline at end of file +var _0x229c=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','VoiceCallReport','count','includeAll','include','fullname','alias','User','findAll','rows','show','model','catch','create','body','find','params','describe','user','uniqueid','updateWithRetry','No\x20such\x20report','../../components/parsers/qs','../../mysqldb','status','json','offset','undefined','limit','set','Content-Range','update','then','destroy','end','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','map','query','keys','filters','intersection','attributes','fields','length'];(function(_0x3a52ef,_0xcc66be){var _0x31ab62=function(_0x2e6213){while(--_0x2e6213){_0x3a52ef['push'](_0x3a52ef['shift']());}};_0x31ab62(++_0xcc66be);}(_0x229c,0xcf));var _0xc229=function(_0x36ad00,_0x81e5b7){_0x36ad00=_0x36ad00-0x0;var _0x508505=_0x229c[_0x36ad00];return _0x508505;};'use strict';var _=require('lodash');var qs=require(_0xc229('0x0'));var logger=require('../../config/logger')('api');var db=require(_0xc229('0x1'))['db'];const promiseRetry=require('promise-retry');function respondWithResult(_0x4c3ab9,_0x3b5330){_0x3b5330=_0x3b5330||0xc8;return function(_0x5c1093){if(_0x5c1093){return _0x4c3ab9[_0xc229('0x2')](_0x3b5330)[_0xc229('0x3')](_0x5c1093);}};}function respondWithFilteredResult(_0x1a246a,_0x5a0d2c){return function(_0x44aba3){if(_0x44aba3){var _0x52978a=typeof _0x5a0d2c[_0xc229('0x4')]===_0xc229('0x5')&&typeof _0x5a0d2c['limit']===_0xc229('0x5');var _0x9f6c95=_0x44aba3['count'];var _0x529822=_0x52978a?0x0:_0x5a0d2c[_0xc229('0x4')];var _0x5a5d9b=_0x52978a?_0x44aba3['count']:_0x5a0d2c[_0xc229('0x4')]+_0x5a0d2c[_0xc229('0x6')];var _0x11e925;if(_0x5a5d9b>=_0x9f6c95){_0x5a5d9b=_0x9f6c95;_0x11e925=0xc8;}else{_0x11e925=0xce;}_0x1a246a[_0xc229('0x2')](_0x11e925);return _0x1a246a[_0xc229('0x7')](_0xc229('0x8'),_0x529822+'-'+_0x5a5d9b+'/'+_0x9f6c95)[_0xc229('0x3')](_0x44aba3);}return null;};}function saveUpdates(_0xd10711){return function(_0xf7cd15){if(_0xf7cd15){return _0xf7cd15[_0xc229('0x9')](_0xd10711)[_0xc229('0xa')](function(_0x3f4ebf){return _0x3f4ebf;});}return null;};}function removeEntity(_0x36af45){return function(_0x58aaa4){if(_0x58aaa4){return _0x58aaa4[_0xc229('0xb')]()['then'](function(){_0x36af45[_0xc229('0x2')](0xcc)[_0xc229('0xc')]();});}};}function handleEntityNotFound(_0x231086){return function(_0x1cc8ed){if(!_0x1cc8ed){_0x231086[_0xc229('0xd')](0x194);}return _0x1cc8ed;};}function handleError(_0x7b71c3,_0x292f30){_0x292f30=_0x292f30||0x1f4;return function(_0x2bc9ea){logger[_0xc229('0xe')](_0x2bc9ea[_0xc229('0xf')]);if(_0x2bc9ea[_0xc229('0x10')]){delete _0x2bc9ea[_0xc229('0x10')];}_0x7b71c3[_0xc229('0x2')](_0x292f30)['send'](_0x2bc9ea);};}exports[_0xc229('0x11')]=function(_0x10339a,_0x393e8c){var _0x193c75={},_0x3b5c2b={},_0x14ef5e={'count':0x0,'rows':[]};var _0x119e07=_['map'](db['VoiceCallReport'][_0xc229('0x12')],function(_0x53dbba){return{'name':_0x53dbba[_0xc229('0x13')],'type':_0x53dbba[_0xc229('0x14')]['key']};});_0x3b5c2b['model']=_[_0xc229('0x15')](_0x119e07,_0xc229('0x10'));_0x3b5c2b[_0xc229('0x16')]=_[_0xc229('0x17')](_0x10339a[_0xc229('0x16')]);_0x3b5c2b[_0xc229('0x18')]=_[_0xc229('0x19')](_0x3b5c2b['model'],_0x3b5c2b['query']);_0x193c75[_0xc229('0x1a')]=_[_0xc229('0x19')](_0x3b5c2b['model'],qs['fields'](_0x10339a[_0xc229('0x16')][_0xc229('0x1b')]));_0x193c75[_0xc229('0x1a')]=_0x193c75[_0xc229('0x1a')][_0xc229('0x1c')]?_0x193c75[_0xc229('0x1a')]:_0x3b5c2b['model'];if(!_0x10339a[_0xc229('0x16')][_0xc229('0x1d')](_0xc229('0x1e'))){_0x193c75['limit']=qs['limit'](_0x10339a[_0xc229('0x16')]['limit']);_0x193c75[_0xc229('0x4')]=qs[_0xc229('0x4')](_0x10339a[_0xc229('0x16')][_0xc229('0x4')]);}_0x193c75[_0xc229('0x1f')]=qs[_0xc229('0x20')](_0x10339a[_0xc229('0x16')][_0xc229('0x20')]);_0x193c75[_0xc229('0x21')]=qs[_0xc229('0x18')](_[_0xc229('0x22')](_0x10339a[_0xc229('0x16')],_0x3b5c2b[_0xc229('0x18')]),_0x119e07);if(_0x10339a[_0xc229('0x16')][_0xc229('0x23')]){_0x193c75[_0xc229('0x21')]=_[_0xc229('0x24')](_0x193c75[_0xc229('0x21')],{'$or':_[_0xc229('0x15')](_0x119e07,function(_0x39d335){if(_0x39d335[_0xc229('0x14')]!=='VIRTUAL'){var _0x294709={};_0x294709[_0x39d335['name']]={'$like':'%'+_0x10339a[_0xc229('0x16')][_0xc229('0x23')]+'%'};return _0x294709;}})});}_0x193c75=_['merge']({},_0x193c75,_0x10339a[_0xc229('0x25')]);var _0x46d475={'where':_0x193c75[_0xc229('0x21')]};return db[_0xc229('0x26')][_0xc229('0x27')](_0x46d475)[_0xc229('0xa')](function(_0x4aabf5){_0x14ef5e[_0xc229('0x27')]=_0x4aabf5;if(_0x10339a[_0xc229('0x16')][_0xc229('0x28')]){_0x193c75[_0xc229('0x29')]=[{'attributes':['id',_0xc229('0x10'),_0xc229('0x2a'),_0xc229('0x2b')],'model':db[_0xc229('0x2c')],'as':_0xc229('0x2c')}];}return db[_0xc229('0x26')][_0xc229('0x2d')](_0x193c75);})['then'](function(_0x424ca3){_0x14ef5e[_0xc229('0x2e')]=_0x424ca3;return _0x14ef5e;})[_0xc229('0xa')](respondWithFilteredResult(_0x393e8c,_0x193c75))['catch'](handleError(_0x393e8c,null));};exports[_0xc229('0x2f')]=function(_0x302f61,_0x5270e5){var _0x48c156={'raw':!![],'where':{'id':_0x302f61['params']['id']}},_0x6a8c0c={};_0x6a8c0c['model']=_['keys'](db[_0xc229('0x26')]['rawAttributes']);_0x6a8c0c['query']=_[_0xc229('0x17')](_0x302f61['query']);_0x6a8c0c[_0xc229('0x18')]=_[_0xc229('0x19')](_0x6a8c0c[_0xc229('0x30')],_0x6a8c0c[_0xc229('0x16')]);_0x48c156[_0xc229('0x1a')]=_['intersection'](_0x6a8c0c[_0xc229('0x30')],qs['fields'](_0x302f61[_0xc229('0x16')][_0xc229('0x1b')]));_0x48c156[_0xc229('0x1a')]=_0x48c156[_0xc229('0x1a')][_0xc229('0x1c')]?_0x48c156[_0xc229('0x1a')]:_0x6a8c0c['model'];if(_0x302f61[_0xc229('0x16')][_0xc229('0x28')]){_0x48c156[_0xc229('0x29')]=[{'all':!![]}];}_0x48c156=_[_0xc229('0x24')]({},_0x48c156,_0x302f61[_0xc229('0x25')]);return db['VoiceCallReport']['find'](_0x48c156)[_0xc229('0xa')](handleEntityNotFound(_0x5270e5,null))[_0xc229('0xa')](respondWithResult(_0x5270e5,null))[_0xc229('0x31')](handleError(_0x5270e5,null));};exports[_0xc229('0x32')]=function(_0x553386,_0x109b37){return db[_0xc229('0x26')][_0xc229('0x32')](_0x553386[_0xc229('0x33')],{})[_0xc229('0xa')](respondWithResult(_0x109b37,0xc9))[_0xc229('0x31')](handleError(_0x109b37,null));};exports[_0xc229('0xb')]=function(_0x5a8a7d,_0x55c4d2){return db[_0xc229('0x26')][_0xc229('0x34')]({'where':{'id':_0x5a8a7d[_0xc229('0x35')]['id']}})[_0xc229('0xa')](handleEntityNotFound(_0x55c4d2,null))[_0xc229('0xa')](removeEntity(_0x55c4d2,null))[_0xc229('0x31')](handleError(_0x55c4d2,null));};exports[_0xc229('0x36')]=function(_0x2521db,_0x199ae0){return db[_0xc229('0x26')]['describe']()[_0xc229('0xa')](respondWithResult(_0x199ae0,null))['catch'](handleError(_0x199ae0,null));};function findForUpdate(_0x3817f2){return db[_0xc229('0x26')][_0xc229('0x34')]({'where':{'uniqueid':_0x3817f2['params']['id'],'UserId':{'$or':[null,_0x3817f2[_0xc229('0x37')]['id']]}}});}exports['update']=function(_0x2b5b08,_0x2d3889){if(_0x2b5b08[_0xc229('0x33')]['uniqueid']){delete _0x2b5b08[_0xc229('0x33')][_0xc229('0x38')];}return findForUpdate(_0x2b5b08)[_0xc229('0xa')](handleEntityNotFound(_0x2d3889,null))[_0xc229('0xa')](saveUpdates(_0x2b5b08[_0xc229('0x33')],null))[_0xc229('0xa')](respondWithResult(_0x2d3889,null))[_0xc229('0x31')](handleError(_0x2d3889,null));};exports[_0xc229('0x39')]=function(_0x11c24a,_0xbf8328,_0x37cfe4){if(_0x11c24a[_0xc229('0x33')][_0xc229('0x38')]){delete _0x11c24a[_0xc229('0x33')][_0xc229('0x38')];}promiseRetry(function(_0x1c6527){return findForUpdate(_0x11c24a)[_0xc229('0xa')](function(_0x1098b5){if(_0x1098b5!==null){return _0x1098b5;}else{_0x1c6527(new Error(_0xc229('0x3a')));}});},{'retries':0x4,'minTimeout':0xfa})[_0xc229('0xa')](function(_0x49aeba){if(!_0x49aeba){return new Promise(function(_0x5a8dcc){_0x5a8dcc(handleEntityNotFound(_0xbf8328)());});}else{return _0x49aeba[_0xc229('0x9')](_0x11c24a[_0xc229('0x33')])[_0xc229('0xa')](function(_0x442dbe){return respondWithResult(_0xbf8328)(_0x442dbe);});}},function(){handleEntityNotFound(_0xbf8328)();});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 5ce3cb3..7e3aebc 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 _0x3f0a=['report_call','uniqueid','../../config/logger','rimraf','../../config/environment','exports','define','VoiceCallReport'];(function(_0x3fd49b,_0x22657c){var _0x463bc6=function(_0x3d1882){while(--_0x3d1882){_0x3fd49b['push'](_0x3fd49b['shift']());}};_0x463bc6(++_0x22657c);}(_0x3f0a,0x19a));var _0xa3f0=function(_0xf70b7a,_0x273b99){_0xf70b7a=_0xf70b7a-0x0;var _0x71f26b=_0x3f0a[_0xf70b7a];return _0x71f26b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xa3f0('0x0'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xa3f0('0x1'));var config=require(_0xa3f0('0x2'));var attributes=require('./voiceCallReport.attributes');module[_0xa3f0('0x3')]=function(_0x517775,_0x417bda){return _0x517775[_0xa3f0('0x4')](_0xa3f0('0x5'),attributes,{'tableName':_0xa3f0('0x6'),'paranoid':![],'indexes':[{'fields':[_0xa3f0('0x7')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x59a0=['define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x2ce1f1,_0x572c25){var _0x25edcc=function(_0xbb73d0){while(--_0xbb73d0){_0x2ce1f1['push'](_0x2ce1f1['shift']());}};_0x25edcc(++_0x572c25);}(_0x59a0,0x184));var _0x059a=function(_0x283c2d,_0x4631d7){_0x283c2d=_0x283c2d-0x0;var _0x459ce9=_0x59a0[_0x283c2d];return _0x459ce9;};'use strict';var _=require(_0x059a('0x0'));var util=require(_0x059a('0x1'));var logger=require(_0x059a('0x2'))('api');var moment=require(_0x059a('0x3'));var BPromise=require(_0x059a('0x4'));var rp=require(_0x059a('0x5'));var fs=require('fs');var path=require(_0x059a('0x6'));var rimraf=require('rimraf');var config=require(_0x059a('0x7'));var attributes=require('./voiceCallReport.attributes');module['exports']=function(_0x1a267c,_0x5c5b25){return _0x1a267c[_0x059a('0x8')](_0x059a('0x9'),attributes,{'tableName':_0x059a('0xa'),'paranoid':![],'indexes':[{'fields':[_0x059a('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 bd4f956..56414bd 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 _0x9125=['result','findAll','options','raw','where','attributes','limit','include','map','model','catch','GetVoiceCallReport','CreateVoiceCallReport','VoiceCallReport','create','body','update','UpdateVoiceCallReport','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','info','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceCallReport,\x20%s,\x20%s'];(function(_0x13c1f6,_0x47fbd2){var _0x5800b5=function(_0x19e602){while(--_0x19e602){_0x13c1f6['push'](_0x13c1f6['shift']());}};_0x5800b5(++_0x47fbd2);}(_0x9125,0x152));var _0x5912=function(_0x500a1f,_0x14745f){_0x500a1f=_0x500a1f-0x0;var _0x2f5bd7=_0x9125[_0x500a1f];return _0x2f5bd7;};'use strict';var _=require(_0x5912('0x0'));var util=require(_0x5912('0x1'));var moment=require(_0x5912('0x2'));var BPromise=require(_0x5912('0x3'));var rs=require(_0x5912('0x4'));var fs=require('fs');var Redis=require(_0x5912('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5912('0x6'));var logger=require(_0x5912('0x7'))(_0x5912('0x8'));var config=require('../../config/environment');var jayson=require(_0x5912('0x9'));var client=jayson[_0x5912('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x180be6,_0x1d2ffd,_0x49a572){return new BPromise(function(_0x1556b0,_0x382346){return client[_0x5912('0xb')](_0x180be6,_0x49a572)[_0x5912('0xc')](function(_0x292b06){logger[_0x5912('0xd')]('VoiceCallReport,\x20%s,\x20%s',_0x1d2ffd,_0x5912('0xe'));logger[_0x5912('0xf')](_0x5912('0x10'),_0x1d2ffd,_0x5912('0xe'),JSON[_0x5912('0x11')](_0x292b06));if(_0x292b06['error']){if(_0x292b06[_0x5912('0x12')][_0x5912('0x13')]===0x1f4){logger[_0x5912('0x12')]('VoiceCallReport,\x20%s,\x20%s',_0x1d2ffd,_0x292b06[_0x5912('0x12')][_0x5912('0x14')]);return _0x382346(_0x292b06[_0x5912('0x12')]['message']);}logger['error'](_0x5912('0x15'),_0x1d2ffd,_0x292b06['error'][_0x5912('0x14')]);return _0x1556b0(_0x292b06['error'][_0x5912('0x14')]);}else{logger[_0x5912('0xd')](_0x5912('0x15'),_0x1d2ffd,'request\x20sent');_0x1556b0(_0x292b06[_0x5912('0x16')][_0x5912('0x14')]);}})['catch'](function(_0x13924c){logger[_0x5912('0x12')](_0x5912('0x15'),_0x1d2ffd,_0x13924c);_0x382346(_0x13924c);});});}exports['GetVoiceCallReport']=function(_0x46c4a3){var _0x26c492=this;return new Promise(function(_0x2162a4,_0x21b1f2){return db['VoiceCallReport'][_0x5912('0x17')]({'raw':_0x46c4a3[_0x5912('0x18')]?_0x46c4a3[_0x5912('0x18')][_0x5912('0x19')]===undefined?!![]:![]:!![],'where':_0x46c4a3[_0x5912('0x18')]?_0x46c4a3[_0x5912('0x18')][_0x5912('0x1a')]||null:null,'attributes':_0x46c4a3[_0x5912('0x18')]?_0x46c4a3['options'][_0x5912('0x1b')]||null:null,'limit':_0x46c4a3['options']?_0x46c4a3[_0x5912('0x18')][_0x5912('0x1c')]||null:null,'include':_0x46c4a3[_0x5912('0x18')]?_0x46c4a3[_0x5912('0x18')][_0x5912('0x1d')]?_[_0x5912('0x1e')](_0x46c4a3[_0x5912('0x18')][_0x5912('0x1d')],function(_0xa0c6cf){return{'model':db[_0xa0c6cf[_0x5912('0x1f')]],'as':_0xa0c6cf['as'],'attributes':_0xa0c6cf['attributes'],'include':_0xa0c6cf['include']?_[_0x5912('0x1e')](_0xa0c6cf['include'],function(_0xc44034){return{'model':db[_0xc44034[_0x5912('0x1f')]],'as':_0xc44034['as'],'attributes':_0xc44034[_0x5912('0x1b')],'include':_0xc44034['include']?_[_0x5912('0x1e')](_0xc44034['include'],function(_0x399711){return{'model':db[_0x399711[_0x5912('0x1f')]],'as':_0x399711['as'],'attributes':_0x399711[_0x5912('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2cde61){logger[_0x5912('0xd')]('GetVoiceCallReport',_0x46c4a3);logger[_0x5912('0xf')]('GetVoiceCallReport',_0x46c4a3,JSON[_0x5912('0x11')](_0x2cde61));_0x2162a4(_0x2cde61);})[_0x5912('0x20')](function(_0xee074c){logger['error'](_0x5912('0x21'),_0xee074c[_0x5912('0x14')],_0x46c4a3);_0x21b1f2(_0x26c492['error'](0x1f4,_0xee074c['message']));});});};exports[_0x5912('0x22')]=function(_0x4c3d9d){var _0x511e1b=this;return new Promise(function(_0x272a12,_0x28dc28){return db[_0x5912('0x23')][_0x5912('0x24')](_0x4c3d9d[_0x5912('0x25')],{'raw':_0x4c3d9d[_0x5912('0x18')]?_0x4c3d9d[_0x5912('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x5912('0xc')](function(_0x487ca7){logger[_0x5912('0xd')](_0x5912('0x22'),_0x4c3d9d);logger['debug'](_0x5912('0x22'),_0x4c3d9d,JSON[_0x5912('0x11')](_0x487ca7));_0x272a12(_0x487ca7);})[_0x5912('0x20')](function(_0xd0908){logger['error'](_0x5912('0x22'),_0xd0908['message'],_0x4c3d9d);_0x28dc28(_0x511e1b[_0x5912('0x12')](0x1f4,_0xd0908[_0x5912('0x14')]));});});};exports['UpdateVoiceCallReport']=function(_0x165dc4){var _0xfab05e=this;return new Promise(function(_0xcd63f1,_0x54b81d){return db['VoiceCallReport'][_0x5912('0x26')](_0x165dc4['body'],{'raw':_0x165dc4[_0x5912('0x18')]?_0x165dc4[_0x5912('0x18')][_0x5912('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x165dc4['options']?_0x165dc4[_0x5912('0x18')][_0x5912('0x1a')]||null:null,'attributes':_0x165dc4[_0x5912('0x18')]?_0x165dc4[_0x5912('0x18')][_0x5912('0x1b')]||null:null,'limit':_0x165dc4[_0x5912('0x18')]?_0x165dc4['options'][_0x5912('0x1c')]||null:null})[_0x5912('0xc')](function(_0x1ffb6c){logger[_0x5912('0xd')](_0x5912('0x27'),_0x165dc4);logger[_0x5912('0xf')](_0x5912('0x27'),_0x165dc4,JSON['stringify'](_0x1ffb6c));_0xcd63f1(_0x1ffb6c);})[_0x5912('0x20')](function(_0x39bf43){logger[_0x5912('0x12')](_0x5912('0x27'),_0x39bf43['message'],_0x165dc4);_0x54b81d(_0xfab05e[_0x5912('0x12')](0x1f4,_0x39bf43[_0x5912('0x14')]));});});}; \ No newline at end of file +var _0xc614=['error','code','message','result','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','include','map','model','attributes','then','info','debug','catch','CreateVoiceCallReport','create','body','update','UpdateVoiceCallReport','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','VoiceCallReport,\x20%s,\x20%s','request\x20sent','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x54904e,_0x5647ff){var _0x179c42=function(_0x318885){while(--_0x318885){_0x54904e['push'](_0x54904e['shift']());}};_0x179c42(++_0x5647ff);}(_0xc614,0xcb));var _0x4c61=function(_0x1095dc,_0x575b30){_0x1095dc=_0x1095dc-0x0;var _0x3ea68c=_0xc614[_0x1095dc];return _0x3ea68c;};'use strict';var _=require(_0x4c61('0x0'));var util=require(_0x4c61('0x1'));var moment=require('moment');var BPromise=require(_0x4c61('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c61('0x3'));var db=require(_0x4c61('0x4'))['db'];var utils=require(_0x4c61('0x5'));var logger=require('../../config/logger')(_0x4c61('0x6'));var config=require('../../config/environment');var jayson=require(_0x4c61('0x7'));var client=jayson[_0x4c61('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59c02f,_0x4f7946,_0xdbd022){return new BPromise(function(_0x75993b,_0xc15d4b){return client['request'](_0x59c02f,_0xdbd022)['then'](function(_0xcf6d97){logger['info'](_0x4c61('0x9'),_0x4f7946,_0x4c61('0xa'));logger['debug'](_0x4c61('0xb'),_0x4f7946,_0x4c61('0xa'),JSON[_0x4c61('0xc')](_0xcf6d97));if(_0xcf6d97[_0x4c61('0xd')]){if(_0xcf6d97[_0x4c61('0xd')][_0x4c61('0xe')]===0x1f4){logger[_0x4c61('0xd')](_0x4c61('0x9'),_0x4f7946,_0xcf6d97[_0x4c61('0xd')][_0x4c61('0xf')]);return _0xc15d4b(_0xcf6d97['error'][_0x4c61('0xf')]);}logger[_0x4c61('0xd')](_0x4c61('0x9'),_0x4f7946,_0xcf6d97[_0x4c61('0xd')][_0x4c61('0xf')]);return _0x75993b(_0xcf6d97[_0x4c61('0xd')][_0x4c61('0xf')]);}else{logger['info'](_0x4c61('0x9'),_0x4f7946,'request\x20sent');_0x75993b(_0xcf6d97[_0x4c61('0x10')][_0x4c61('0xf')]);}})['catch'](function(_0x489ef7){logger['error'](_0x4c61('0x9'),_0x4f7946,_0x489ef7);_0xc15d4b(_0x489ef7);});});}exports[_0x4c61('0x11')]=function(_0x49a66f){var _0x17cf13=this;return new Promise(function(_0x3b0a3b,_0x3241ec){return db[_0x4c61('0x12')][_0x4c61('0x13')]({'raw':_0x49a66f[_0x4c61('0x14')]?_0x49a66f[_0x4c61('0x14')][_0x4c61('0x15')]===undefined?!![]:![]:!![],'where':_0x49a66f[_0x4c61('0x14')]?_0x49a66f['options'][_0x4c61('0x16')]||null:null,'attributes':_0x49a66f['options']?_0x49a66f[_0x4c61('0x14')]['attributes']||null:null,'limit':_0x49a66f[_0x4c61('0x14')]?_0x49a66f[_0x4c61('0x14')]['limit']||null:null,'include':_0x49a66f[_0x4c61('0x14')]?_0x49a66f[_0x4c61('0x14')][_0x4c61('0x17')]?_[_0x4c61('0x18')](_0x49a66f['options'][_0x4c61('0x17')],function(_0x245fe1){return{'model':db[_0x245fe1[_0x4c61('0x19')]],'as':_0x245fe1['as'],'attributes':_0x245fe1[_0x4c61('0x1a')],'include':_0x245fe1['include']?_[_0x4c61('0x18')](_0x245fe1[_0x4c61('0x17')],function(_0x58c6bf){return{'model':db[_0x58c6bf[_0x4c61('0x19')]],'as':_0x58c6bf['as'],'attributes':_0x58c6bf['attributes'],'include':_0x58c6bf[_0x4c61('0x17')]?_['map'](_0x58c6bf[_0x4c61('0x17')],function(_0x2881df){return{'model':db[_0x2881df['model']],'as':_0x2881df['as'],'attributes':_0x2881df[_0x4c61('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4c61('0x1b')](function(_0x556341){logger[_0x4c61('0x1c')](_0x4c61('0x11'),_0x49a66f);logger[_0x4c61('0x1d')](_0x4c61('0x11'),_0x49a66f,JSON[_0x4c61('0xc')](_0x556341));_0x3b0a3b(_0x556341);})[_0x4c61('0x1e')](function(_0x257432){logger[_0x4c61('0xd')](_0x4c61('0x11'),_0x257432[_0x4c61('0xf')],_0x49a66f);_0x3241ec(_0x17cf13['error'](0x1f4,_0x257432[_0x4c61('0xf')]));});});};exports[_0x4c61('0x1f')]=function(_0x50d521){var _0x4641fd=this;return new Promise(function(_0x137b50,_0x1d378e){return db[_0x4c61('0x12')][_0x4c61('0x20')](_0x50d521[_0x4c61('0x21')],{'raw':_0x50d521[_0x4c61('0x14')]?_0x50d521[_0x4c61('0x14')][_0x4c61('0x15')]===undefined?!![]:![]:!![]})[_0x4c61('0x1b')](function(_0x4e40a6){logger[_0x4c61('0x1c')](_0x4c61('0x1f'),_0x50d521);logger[_0x4c61('0x1d')](_0x4c61('0x1f'),_0x50d521,JSON[_0x4c61('0xc')](_0x4e40a6));_0x137b50(_0x4e40a6);})[_0x4c61('0x1e')](function(_0x4a77c0){logger[_0x4c61('0xd')]('CreateVoiceCallReport',_0x4a77c0[_0x4c61('0xf')],_0x50d521);_0x1d378e(_0x4641fd['error'](0x1f4,_0x4a77c0[_0x4c61('0xf')]));});});};exports['UpdateVoiceCallReport']=function(_0x1b524b){var _0x3e17a9=this;return new Promise(function(_0x46285a,_0x20372c){return db['VoiceCallReport'][_0x4c61('0x22')](_0x1b524b[_0x4c61('0x21')],{'raw':_0x1b524b[_0x4c61('0x14')]?_0x1b524b[_0x4c61('0x14')][_0x4c61('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b524b[_0x4c61('0x14')]?_0x1b524b['options'][_0x4c61('0x16')]||null:null,'attributes':_0x1b524b[_0x4c61('0x14')]?_0x1b524b[_0x4c61('0x14')]['attributes']||null:null,'limit':_0x1b524b[_0x4c61('0x14')]?_0x1b524b[_0x4c61('0x14')]['limit']||null:null})['then'](function(_0x4bdbc1){logger[_0x4c61('0x1c')](_0x4c61('0x23'),_0x1b524b);logger[_0x4c61('0x1d')](_0x4c61('0x23'),_0x1b524b,JSON[_0x4c61('0xc')](_0x4bdbc1));_0x46285a(_0x4bdbc1);})[_0x4c61('0x1e')](function(_0x2f6ca7){logger[_0x4c61('0xd')](_0x4c61('0x23'),_0x2f6ca7[_0x4c61('0xf')],_0x1b524b);_0x20372c(_0x3e17a9[_0x4c61('0xd')](0x1f4,_0x2f6ca7[_0x4c61('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 5799456..9195687 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 _0x73ba=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','util','connect-timeout'];(function(_0x54c102,_0x5e6888){var _0x54ce79=function(_0x2cf32b){while(--_0x2cf32b){_0x54c102['push'](_0x54c102['shift']());}};_0x54ce79(++_0x5e6888);}(_0x73ba,0x12e));var _0xa73b=function(_0x93c984,_0x4e579c){_0x93c984=_0x93c984-0x0;var _0x47af51=_0x73ba[_0x93c984];return _0x47af51;};'use strict';var multer=require('multer');var util=require(_0xa73b('0x0'));var path=require('path');var timeout=require(_0xa73b('0x1'));var express=require('express');var router=express[_0xa73b('0x2')]();var fs_extra=require(_0xa73b('0x3'));var auth=require(_0xa73b('0x4'));var interaction=require(_0xa73b('0x5'));var config=require(_0xa73b('0x6'));var controller=require(_0xa73b('0x7'));router[_0xa73b('0x8')]('/',auth['isAuthenticated'](),controller[_0xa73b('0x9')]);router[_0xa73b('0x8')](_0xa73b('0xa'),auth[_0xa73b('0xb')](),controller[_0xa73b('0xc')]);router[_0xa73b('0xd')]('/',auth[_0xa73b('0xb')](),controller[_0xa73b('0xe')]);router[_0xa73b('0xf')](_0xa73b('0xa'),auth[_0xa73b('0xb')](),controller[_0xa73b('0x10')]);router['delete']('/:id',auth[_0xa73b('0xb')](),controller[_0xa73b('0x11')]);module[_0xa73b('0x12')]=router; \ No newline at end of file +var _0xa70d=['Router','../../config/environment','./voiceChanSpy.controller','get','isAuthenticated','index','/:id','show','create','put','destroy','exports','multer','util','path','express'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xa70d,0xec));var _0xda70=function(_0x3b65bd,_0x413692){_0x3b65bd=_0x3b65bd-0x0;var _0x8bf991=_0xa70d[_0x3b65bd];return _0x8bf991;};'use strict';var multer=require(_0xda70('0x0'));var util=require(_0xda70('0x1'));var path=require(_0xda70('0x2'));var timeout=require('connect-timeout');var express=require(_0xda70('0x3'));var router=express[_0xda70('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xda70('0x5'));var controller=require(_0xda70('0x6'));router[_0xda70('0x7')]('/',auth[_0xda70('0x8')](),controller[_0xda70('0x9')]);router[_0xda70('0x7')](_0xda70('0xa'),auth['isAuthenticated'](),controller[_0xda70('0xb')]);router['post']('/',auth[_0xda70('0x8')](),controller[_0xda70('0xc')]);router[_0xda70('0xd')](_0xda70('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xda70('0xa'),auth[_0xda70('0x8')](),controller[_0xda70('0xe')]);module[_0xda70('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index e339ea9..329c7e7 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 _0x3811=['setDataValue','options','join','getDataValue','split','STRING','name'];(function(_0x5269ed,_0xeeca79){var _0x522fe7=function(_0x205d9f){while(--_0x205d9f){_0x5269ed['push'](_0x5269ed['shift']());}};_0x522fe7(++_0xeeca79);}(_0x3811,0x1d3));var _0x1381=function(_0x42a82c,_0x324e6a){_0x42a82c=_0x42a82c-0x0;var _0x154ef5=_0x3811[_0x42a82c];return _0x154ef5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1381('0x0')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x1381('0x1'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x36d8dc){this[_0x1381('0x2')](_0x1381('0x3'),_0x36d8dc?_0x36d8dc[_0x1381('0x4')](''):[]);},'get':function(){return this[_0x1381('0x5')](_0x1381('0x3'))?this['getDataValue'](_0x1381('0x3'))[_0x1381('0x6')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x1381('0x0')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x1381('0x0')]},'description':{'type':Sequelize[_0x1381('0x0')]}}; \ No newline at end of file +var _0xd066=['sequelize','exports','STRING','name','options','join','getDataValue','split','BOOLEAN'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xd066,0x1b0));var _0x6d06=function(_0x6d362,_0x1540dc){_0x6d362=_0x6d362-0x0;var _0x983188=_0xd066[_0x6d362];return _0x983188;};'use strict';var Sequelize=require(_0x6d06('0x0'));module[_0x6d06('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x6d06('0x2')],'unique':_0x6d06('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0x6d06('0x2')],'set':function(_0x42fc28){this['setDataValue'](_0x6d06('0x4'),_0x42fc28?_0x42fc28[_0x6d06('0x5')](''):[]);},'get':function(){return this[_0x6d06('0x6')](_0x6d06('0x4'))?this[_0x6d06('0x6')](_0x6d06('0x4'))[_0x6d06('0x7')](''):[];}},'auth':{'type':Sequelize[_0x6d06('0x8')],'defaultValue':![]},'password':{'type':Sequelize[_0x6d06('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x6d06('0x2')]},'description':{'type':Sequelize[_0x6d06('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 42b5759..4f732f9 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 _0x7070=['mustache','util','path','to-csv','ejs','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','limit','undefined','set','json','save','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','send','index','VoiceChanSpy','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','keys','include','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','fast-json-patch','bluebird'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7070,0x1d7));var _0x0707=function(_0x293da0,_0x206a0a){_0x293da0=_0x293da0-0x0;var _0x4d57d0=_0x7070[_0x293da0];return _0x4d57d0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0707('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0707('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0707('0x2'));var Mustache=require(_0x0707('0x3'));var util=require(_0x0707('0x4'));var path=require(_0x0707('0x5'));var sox=require('sox');var csv=require(_0x0707('0x6'));var ejs=require(_0x0707('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x0707('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0707('0x9'));var toCsv=require(_0x0707('0x6'));var querystring=require(_0x0707('0xa'));var Papa=require(_0x0707('0xb'));var Redis=require(_0x0707('0xc'));var authService=require(_0x0707('0xd'));var qs=require(_0x0707('0xe'));var as=require(_0x0707('0xf'));var hardwareService=require(_0x0707('0x10'));var logger=require(_0x0707('0x11'))('api');var utils=require(_0x0707('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x0707('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3b55c6,_0x2bd4d8){_0x2bd4d8=_0x2bd4d8||0xcc;return function(_0x3eeea8){if(_0x3eeea8){return _0x3b55c6[_0x0707('0x14')](_0x2bd4d8);}return _0x3b55c6[_0x0707('0x15')](_0x2bd4d8)[_0x0707('0x16')]();};}function respondWithResult(_0x3b0f64,_0x111fd7){_0x111fd7=_0x111fd7||0xc8;return function(_0x380abc){if(_0x380abc){return _0x3b0f64[_0x0707('0x15')](_0x111fd7)['json'](_0x380abc);}};}function respondWithFilteredResult(_0x5bae3d,_0x3fce78){return function(_0x429da2){if(_0x429da2){var _0x1370b3=typeof _0x3fce78[_0x0707('0x17')]==='undefined'&&typeof _0x3fce78[_0x0707('0x18')]===_0x0707('0x19');var _0xe1cf0e=_0x429da2['count'];var _0x13d5de=_0x1370b3?0x0:_0x3fce78['offset'];var _0x471431=_0x1370b3?_0x429da2['count']:_0x3fce78[_0x0707('0x17')]+_0x3fce78[_0x0707('0x18')];var _0x1debb9;if(_0x471431>=_0xe1cf0e){_0x471431=_0xe1cf0e;_0x1debb9=0xc8;}else{_0x1debb9=0xce;}_0x5bae3d[_0x0707('0x15')](_0x1debb9);return _0x5bae3d[_0x0707('0x1a')]('Content-Range',_0x13d5de+'-'+_0x471431+'/'+_0xe1cf0e)[_0x0707('0x1b')](_0x429da2);}return null;};}function patchUpdates(_0x360caf){return function(_0x37d1fd){try{jsonpatch['apply'](_0x37d1fd,_0x360caf,!![]);}catch(_0x5c8731){return BPromise['reject'](_0x5c8731);}return _0x37d1fd[_0x0707('0x1c')]();};}function saveUpdates(_0x3f31e1,_0x1d133c){return function(_0x51dec4){if(_0x51dec4){return _0x51dec4['update'](_0x3f31e1)[_0x0707('0x1d')](function(_0x225a58){return _0x225a58;});}return null;};}function removeEntity(_0x370554,_0x3e9c41){return function(_0x3ba507){if(_0x3ba507){return _0x3ba507[_0x0707('0x1e')]()[_0x0707('0x1d')](function(){var _0x57c868=_0x3ba507[_0x0707('0x1f')]({'plain':!![]});var _0x3dc5fb=_0x0707('0x20');return db[_0x0707('0x21')]['destroy']({'where':{'type':_0x3dc5fb,'resourceId':_0x57c868['id']}})[_0x0707('0x1d')](function(){return _0x3ba507;});})[_0x0707('0x1d')](function(){_0x370554[_0x0707('0x15')](0xcc)[_0x0707('0x16')]();});}};}function handleEntityNotFound(_0x4d4666,_0x4008b9){return function(_0xb5bb75){if(!_0xb5bb75){_0x4d4666[_0x0707('0x14')](0x194);}return _0xb5bb75;};}function handleError(_0x470381,_0x428bd5){_0x428bd5=_0x428bd5||0x1f4;return function(_0x599090){logger[_0x0707('0x22')](_0x599090[_0x0707('0x23')]);if(_0x599090[_0x0707('0x24')]){delete _0x599090[_0x0707('0x24')];}_0x470381['status'](_0x428bd5)[_0x0707('0x25')](_0x599090);};}exports[_0x0707('0x26')]=function(_0x160485,_0x451c3f){var _0x230dca={},_0x2eeddb={},_0x1ec95d={'count':0x0,'rows':[]};var _0x4e4b3f=_['map'](db[_0x0707('0x27')][_0x0707('0x28')],function(_0x24fda7){return{'name':_0x24fda7[_0x0707('0x29')],'type':_0x24fda7['type'][_0x0707('0x2a')]};});_0x2eeddb[_0x0707('0x2b')]=_['map'](_0x4e4b3f,_0x0707('0x24'));_0x2eeddb[_0x0707('0x2c')]=_['keys'](_0x160485[_0x0707('0x2c')]);_0x2eeddb[_0x0707('0x2d')]=_['intersection'](_0x2eeddb[_0x0707('0x2b')],_0x2eeddb[_0x0707('0x2c')]);_0x230dca['attributes']=_[_0x0707('0x2e')](_0x2eeddb[_0x0707('0x2b')],qs[_0x0707('0x2f')](_0x160485[_0x0707('0x2c')][_0x0707('0x2f')]));_0x230dca[_0x0707('0x30')]=_0x230dca[_0x0707('0x30')]['length']?_0x230dca[_0x0707('0x30')]:_0x2eeddb[_0x0707('0x2b')];if(!_0x160485[_0x0707('0x2c')]['hasOwnProperty'](_0x0707('0x31'))){_0x230dca[_0x0707('0x18')]=qs['limit'](_0x160485[_0x0707('0x2c')][_0x0707('0x18')]);_0x230dca[_0x0707('0x17')]=qs['offset'](_0x160485[_0x0707('0x2c')]['offset']);}_0x230dca[_0x0707('0x32')]=qs[_0x0707('0x33')](_0x160485[_0x0707('0x2c')][_0x0707('0x33')]);_0x230dca[_0x0707('0x34')]=qs[_0x0707('0x2d')](_[_0x0707('0x35')](_0x160485[_0x0707('0x2c')],_0x2eeddb[_0x0707('0x2d')]),_0x4e4b3f);if(_0x160485[_0x0707('0x2c')][_0x0707('0x36')]){_0x230dca[_0x0707('0x34')]=_[_0x0707('0x37')](_0x230dca[_0x0707('0x34')],{'$or':_[_0x0707('0x38')](_0x4e4b3f,function(_0x30765c){if(_0x30765c[_0x0707('0x39')]!==_0x0707('0x3a')){var _0x1e3d16={};_0x1e3d16[_0x30765c['name']]={'$like':'%'+_0x160485[_0x0707('0x2c')][_0x0707('0x36')]+'%'};return _0x1e3d16;}})});}_0x230dca=_[_0x0707('0x37')]({},_0x230dca,_0x160485['options']);var _0x51b0bf={'where':_0x230dca[_0x0707('0x34')]};return db[_0x0707('0x27')]['count'](_0x51b0bf)[_0x0707('0x1d')](function(_0x2d9c47){_0x1ec95d[_0x0707('0x3b')]=_0x2d9c47;if(_0x160485[_0x0707('0x2c')][_0x0707('0x3c')]){_0x230dca['include']=[{'all':!![]}];}return db[_0x0707('0x27')][_0x0707('0x3d')](_0x230dca);})[_0x0707('0x1d')](function(_0x508cc2){_0x1ec95d[_0x0707('0x3e')]=_0x508cc2;return _0x1ec95d;})[_0x0707('0x1d')](respondWithFilteredResult(_0x451c3f,_0x230dca))[_0x0707('0x3f')](handleError(_0x451c3f,null));};exports[_0x0707('0x40')]=function(_0x11eac5,_0x290277){var _0x4e45c6={'raw':![],'where':{'id':_0x11eac5[_0x0707('0x41')]['id']}},_0x2727e2={};_0x2727e2[_0x0707('0x2b')]=_[_0x0707('0x42')](db['VoiceChanSpy']['rawAttributes']);_0x2727e2[_0x0707('0x2c')]=_[_0x0707('0x42')](_0x11eac5[_0x0707('0x2c')]);_0x2727e2[_0x0707('0x2d')]=_[_0x0707('0x2e')](_0x2727e2[_0x0707('0x2b')],_0x2727e2[_0x0707('0x2c')]);_0x4e45c6[_0x0707('0x30')]=_[_0x0707('0x2e')](_0x2727e2[_0x0707('0x2b')],qs[_0x0707('0x2f')](_0x11eac5['query'][_0x0707('0x2f')]));_0x4e45c6[_0x0707('0x30')]=_0x4e45c6[_0x0707('0x30')]['length']?_0x4e45c6[_0x0707('0x30')]:_0x2727e2[_0x0707('0x2b')];if(_0x11eac5[_0x0707('0x2c')][_0x0707('0x3c')]){_0x4e45c6[_0x0707('0x43')]=[{'all':!![]}];}_0x4e45c6=_[_0x0707('0x37')]({},_0x4e45c6,_0x11eac5[_0x0707('0x44')]);return db[_0x0707('0x27')]['find'](_0x4e45c6)[_0x0707('0x1d')](handleEntityNotFound(_0x290277,null))[_0x0707('0x1d')](respondWithResult(_0x290277,null))[_0x0707('0x3f')](handleError(_0x290277,null));};exports[_0x0707('0x45')]=function(_0x19a4df,_0x5e5d53){return db[_0x0707('0x27')][_0x0707('0x45')](_0x19a4df[_0x0707('0x46')],{})[_0x0707('0x1d')](function(_0x4a1ae7){var _0x3afe58=_0x19a4df['user'][_0x0707('0x1f')]({'plain':!![]});if(!_0x3afe58)throw new Error(_0x0707('0x47'));if(_0x3afe58[_0x0707('0x48')]===_0x0707('0x49')){var _0x504255=_0x4a1ae7[_0x0707('0x1f')]({'plain':!![]});var _0x9445e0=_0x0707('0x20');return db[_0x0707('0x4a')][_0x0707('0x4b')]({'where':{'name':_0x9445e0,'userProfileId':_0x3afe58[_0x0707('0x4c')]},'raw':!![]})['then'](function(_0x27c306){if(_0x27c306&&_0x27c306[_0x0707('0x4d')]===0x0){return db[_0x0707('0x21')][_0x0707('0x45')]({'name':_0x504255[_0x0707('0x24')],'resourceId':_0x504255['id'],'type':_0x27c306[_0x0707('0x24')],'sectionId':_0x27c306['id']},{})['then'](function(){return _0x4a1ae7;});}else{return _0x4a1ae7;}})[_0x0707('0x3f')](function(_0x271964){logger[_0x0707('0x22')](_0x0707('0x4e'),_0x271964);throw _0x271964;});}return _0x4a1ae7;})[_0x0707('0x1d')](respondWithResult(_0x5e5d53,0xc9))[_0x0707('0x3f')](handleError(_0x5e5d53,null));};exports['update']=function(_0x439309,_0x768e45){if(_0x439309[_0x0707('0x46')]['id']){delete _0x439309['body']['id'];}return db[_0x0707('0x27')][_0x0707('0x4b')]({'where':{'id':_0x439309['params']['id']}})['then'](handleEntityNotFound(_0x768e45,null))[_0x0707('0x1d')](saveUpdates(_0x439309[_0x0707('0x46')],null))['then'](respondWithResult(_0x768e45,null))[_0x0707('0x3f')](handleError(_0x768e45,null));};exports[_0x0707('0x1e')]=function(_0x389903,_0x1d5edc){return db[_0x0707('0x27')][_0x0707('0x4b')]({'where':{'id':_0x389903['params']['id']}})[_0x0707('0x1d')](handleEntityNotFound(_0x1d5edc,null))[_0x0707('0x1d')](removeEntity(_0x1d5edc,null))[_0x0707('0x3f')](handleError(_0x1d5edc,null));}; \ No newline at end of file +var _0x98b8=['../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','save','update','then','destroy','get','ChanSpies','UserProfileResource','error','stack','name','index','map','VoiceChanSpy','fieldName','key','keys','intersection','model','query','attributes','fields','length','nolimit','sort','filters','pick','filter','where','type','VIRTUAL','merge','count','includeAll','include','findAll','rows','show','params','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','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/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x3d5e4d,_0x420a6e){var _0x487b2e=function(_0x493269){while(--_0x493269){_0x3d5e4d['push'](_0x3d5e4d['shift']());}};_0x487b2e(++_0x420a6e);}(_0x98b8,0x93));var _0x898b=function(_0xb6d75b,_0x212433){_0xb6d75b=_0xb6d75b-0x0;var _0x24ed6f=_0x98b8[_0xb6d75b];return _0x24ed6f;};'use strict';var emlformat=require(_0x898b('0x0'));var rimraf=require(_0x898b('0x1'));var zipdir=require(_0x898b('0x2'));var jsonpatch=require(_0x898b('0x3'));var rp=require(_0x898b('0x4'));var moment=require(_0x898b('0x5'));var BPromise=require(_0x898b('0x6'));var Mustache=require(_0x898b('0x7'));var util=require(_0x898b('0x8'));var path=require(_0x898b('0x9'));var sox=require(_0x898b('0xa'));var csv=require(_0x898b('0xb'));var ejs=require(_0x898b('0xc'));var fs=require('fs');var fs_extra=require(_0x898b('0xd'));var _=require(_0x898b('0xe'));var squel=require('squel');var crypto=require(_0x898b('0xf'));var jsforce=require(_0x898b('0x10'));var deskjs=require(_0x898b('0x11'));var toCsv=require(_0x898b('0xb'));var querystring=require(_0x898b('0x12'));var Papa=require(_0x898b('0x13'));var Redis=require(_0x898b('0x14'));var authService=require(_0x898b('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x898b('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x898b('0x17'));var utils=require(_0x898b('0x18'));var config=require(_0x898b('0x19'));var licenseUtil=require(_0x898b('0x1a'));var db=require(_0x898b('0x1b'))['db'];function respondWithStatusCode(_0xdee6a3,_0x241756){_0x241756=_0x241756||0xcc;return function(_0x219de0){if(_0x219de0){return _0xdee6a3[_0x898b('0x1c')](_0x241756);}return _0xdee6a3[_0x898b('0x1d')](_0x241756)[_0x898b('0x1e')]();};}function respondWithResult(_0x1fb398,_0x51b5a0){_0x51b5a0=_0x51b5a0||0xc8;return function(_0x435cba){if(_0x435cba){return _0x1fb398[_0x898b('0x1d')](_0x51b5a0)[_0x898b('0x1f')](_0x435cba);}};}function respondWithFilteredResult(_0x4c50b0,_0x4baf7b){return function(_0x427cc4){if(_0x427cc4){var _0x239c41=typeof _0x4baf7b[_0x898b('0x20')]===_0x898b('0x21')&&typeof _0x4baf7b['limit']===_0x898b('0x21');var _0x4d95a1=_0x427cc4['count'];var _0x3ad191=_0x239c41?0x0:_0x4baf7b[_0x898b('0x20')];var _0x3f001a=_0x239c41?_0x427cc4['count']:_0x4baf7b[_0x898b('0x20')]+_0x4baf7b[_0x898b('0x22')];var _0x2db8cd;if(_0x3f001a>=_0x4d95a1){_0x3f001a=_0x4d95a1;_0x2db8cd=0xc8;}else{_0x2db8cd=0xce;}_0x4c50b0[_0x898b('0x1d')](_0x2db8cd);return _0x4c50b0[_0x898b('0x23')](_0x898b('0x24'),_0x3ad191+'-'+_0x3f001a+'/'+_0x4d95a1)[_0x898b('0x1f')](_0x427cc4);}return null;};}function patchUpdates(_0x1a976a){return function(_0x2eef40){try{jsonpatch[_0x898b('0x25')](_0x2eef40,_0x1a976a,!![]);}catch(_0x4d5d41){return BPromise['reject'](_0x4d5d41);}return _0x2eef40[_0x898b('0x26')]();};}function saveUpdates(_0x8def29,_0x503390){return function(_0x321ec9){if(_0x321ec9){return _0x321ec9[_0x898b('0x27')](_0x8def29)[_0x898b('0x28')](function(_0x5bcb95){return _0x5bcb95;});}return null;};}function removeEntity(_0x4fa723,_0x66101f){return function(_0x2bd250){if(_0x2bd250){return _0x2bd250[_0x898b('0x29')]()[_0x898b('0x28')](function(){var _0xb39f4c=_0x2bd250[_0x898b('0x2a')]({'plain':!![]});var _0x11c558=_0x898b('0x2b');return db[_0x898b('0x2c')][_0x898b('0x29')]({'where':{'type':_0x11c558,'resourceId':_0xb39f4c['id']}})[_0x898b('0x28')](function(){return _0x2bd250;});})[_0x898b('0x28')](function(){_0x4fa723[_0x898b('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5177c9,_0x12c7e6){return function(_0xb5c11){if(!_0xb5c11){_0x5177c9[_0x898b('0x1c')](0x194);}return _0xb5c11;};}function handleError(_0x72c8d3,_0x3327c){_0x3327c=_0x3327c||0x1f4;return function(_0xad29){logger[_0x898b('0x2d')](_0xad29[_0x898b('0x2e')]);if(_0xad29[_0x898b('0x2f')]){delete _0xad29[_0x898b('0x2f')];}_0x72c8d3['status'](_0x3327c)['send'](_0xad29);};}exports[_0x898b('0x30')]=function(_0x282d78,_0x561125){var _0x63b5df={},_0x6f1887={},_0x3b2114={'count':0x0,'rows':[]};var _0x2ede2d=_[_0x898b('0x31')](db[_0x898b('0x32')]['rawAttributes'],function(_0x19dedc){return{'name':_0x19dedc[_0x898b('0x33')],'type':_0x19dedc['type'][_0x898b('0x34')]};});_0x6f1887['model']=_[_0x898b('0x31')](_0x2ede2d,_0x898b('0x2f'));_0x6f1887['query']=_[_0x898b('0x35')](_0x282d78['query']);_0x6f1887['filters']=_[_0x898b('0x36')](_0x6f1887[_0x898b('0x37')],_0x6f1887[_0x898b('0x38')]);_0x63b5df[_0x898b('0x39')]=_[_0x898b('0x36')](_0x6f1887[_0x898b('0x37')],qs[_0x898b('0x3a')](_0x282d78[_0x898b('0x38')][_0x898b('0x3a')]));_0x63b5df[_0x898b('0x39')]=_0x63b5df[_0x898b('0x39')][_0x898b('0x3b')]?_0x63b5df['attributes']:_0x6f1887['model'];if(!_0x282d78['query']['hasOwnProperty'](_0x898b('0x3c'))){_0x63b5df[_0x898b('0x22')]=qs[_0x898b('0x22')](_0x282d78['query'][_0x898b('0x22')]);_0x63b5df[_0x898b('0x20')]=qs[_0x898b('0x20')](_0x282d78[_0x898b('0x38')][_0x898b('0x20')]);}_0x63b5df['order']=qs[_0x898b('0x3d')](_0x282d78[_0x898b('0x38')][_0x898b('0x3d')]);_0x63b5df['where']=qs[_0x898b('0x3e')](_[_0x898b('0x3f')](_0x282d78['query'],_0x6f1887[_0x898b('0x3e')]),_0x2ede2d);if(_0x282d78[_0x898b('0x38')][_0x898b('0x40')]){_0x63b5df[_0x898b('0x41')]=_['merge'](_0x63b5df[_0x898b('0x41')],{'$or':_[_0x898b('0x31')](_0x2ede2d,function(_0x37e4){if(_0x37e4[_0x898b('0x42')]!==_0x898b('0x43')){var _0x2bddbe={};_0x2bddbe[_0x37e4[_0x898b('0x2f')]]={'$like':'%'+_0x282d78[_0x898b('0x38')][_0x898b('0x40')]+'%'};return _0x2bddbe;}})});}_0x63b5df=_[_0x898b('0x44')]({},_0x63b5df,_0x282d78['options']);var _0x5d86cb={'where':_0x63b5df[_0x898b('0x41')]};return db[_0x898b('0x32')][_0x898b('0x45')](_0x5d86cb)[_0x898b('0x28')](function(_0x5bc878){_0x3b2114[_0x898b('0x45')]=_0x5bc878;if(_0x282d78[_0x898b('0x38')][_0x898b('0x46')]){_0x63b5df[_0x898b('0x47')]=[{'all':!![]}];}return db['VoiceChanSpy'][_0x898b('0x48')](_0x63b5df);})[_0x898b('0x28')](function(_0x4e77be){_0x3b2114[_0x898b('0x49')]=_0x4e77be;return _0x3b2114;})[_0x898b('0x28')](respondWithFilteredResult(_0x561125,_0x63b5df))['catch'](handleError(_0x561125,null));};exports[_0x898b('0x4a')]=function(_0x5b1584,_0x37e3ae){var _0x4a8112={'raw':![],'where':{'id':_0x5b1584[_0x898b('0x4b')]['id']}},_0x144c99={};_0x144c99[_0x898b('0x37')]=_[_0x898b('0x35')](db[_0x898b('0x32')]['rawAttributes']);_0x144c99[_0x898b('0x38')]=_[_0x898b('0x35')](_0x5b1584[_0x898b('0x38')]);_0x144c99['filters']=_[_0x898b('0x36')](_0x144c99[_0x898b('0x37')],_0x144c99['query']);_0x4a8112[_0x898b('0x39')]=_[_0x898b('0x36')](_0x144c99[_0x898b('0x37')],qs[_0x898b('0x3a')](_0x5b1584[_0x898b('0x38')][_0x898b('0x3a')]));_0x4a8112['attributes']=_0x4a8112['attributes'][_0x898b('0x3b')]?_0x4a8112[_0x898b('0x39')]:_0x144c99['model'];if(_0x5b1584[_0x898b('0x38')][_0x898b('0x46')]){_0x4a8112[_0x898b('0x47')]=[{'all':!![]}];}_0x4a8112=_[_0x898b('0x44')]({},_0x4a8112,_0x5b1584[_0x898b('0x4c')]);return db[_0x898b('0x32')]['find'](_0x4a8112)['then'](handleEntityNotFound(_0x37e3ae,null))['then'](respondWithResult(_0x37e3ae,null))[_0x898b('0x4d')](handleError(_0x37e3ae,null));};exports[_0x898b('0x4e')]=function(_0x4d583f,_0x280a53){return db[_0x898b('0x32')][_0x898b('0x4e')](_0x4d583f[_0x898b('0x4f')],{})['then'](function(_0x1beb92){var _0x596eb4=_0x4d583f[_0x898b('0x50')]['get']({'plain':!![]});if(!_0x596eb4)throw new Error(_0x898b('0x51'));if(_0x596eb4[_0x898b('0x52')]===_0x898b('0x50')){var _0x5562ca=_0x1beb92[_0x898b('0x2a')]({'plain':!![]});var _0x7960a8=_0x898b('0x2b');return db[_0x898b('0x53')][_0x898b('0x54')]({'where':{'name':_0x7960a8,'userProfileId':_0x596eb4['userProfileId']},'raw':!![]})['then'](function(_0x18377f){if(_0x18377f&&_0x18377f[_0x898b('0x55')]===0x0){return db[_0x898b('0x2c')]['create']({'name':_0x5562ca[_0x898b('0x2f')],'resourceId':_0x5562ca['id'],'type':_0x18377f['name'],'sectionId':_0x18377f['id']},{})[_0x898b('0x28')](function(){return _0x1beb92;});}else{return _0x1beb92;}})[_0x898b('0x4d')](function(_0x59eeaf){logger['error'](_0x898b('0x56'),_0x59eeaf);throw _0x59eeaf;});}return _0x1beb92;})[_0x898b('0x28')](respondWithResult(_0x280a53,0xc9))[_0x898b('0x4d')](handleError(_0x280a53,null));};exports['update']=function(_0x4ab67b,_0x4ed728){if(_0x4ab67b[_0x898b('0x4f')]['id']){delete _0x4ab67b[_0x898b('0x4f')]['id'];}return db[_0x898b('0x32')][_0x898b('0x54')]({'where':{'id':_0x4ab67b[_0x898b('0x4b')]['id']}})[_0x898b('0x28')](handleEntityNotFound(_0x4ed728,null))['then'](saveUpdates(_0x4ab67b[_0x898b('0x4f')],null))[_0x898b('0x28')](respondWithResult(_0x4ed728,null))[_0x898b('0x4d')](handleError(_0x4ed728,null));};exports[_0x898b('0x29')]=function(_0x2865ac,_0xe5b812){return db['VoiceChanSpy']['find']({'where':{'id':_0x2865ac[_0x898b('0x4b')]['id']}})[_0x898b('0x28')](handleEntityNotFound(_0xe5b812,null))[_0x898b('0x28')](removeEntity(_0xe5b812,null))[_0x898b('0x4d')](handleError(_0xe5b812,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index a58ee01..e6fb291 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 _0x0fc7=['system','push','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','recordingFormat','auth','Authenticate','password','name','join','StopMixMonitor','length','concat','User','internal','then','catch','exports','models','define','VoiceChanSpy','VoiceExtension','destroy','lodash','util','context','from-sip','format','%s%s','prefix'];(function(_0x30a5cf,_0x4e90b2){var _0x5a7245=function(_0x3605b0){while(--_0x3605b0){_0x30a5cf['push'](_0x30a5cf['shift']());}};_0x5a7245(++_0x4e90b2);}(_0x0fc7,0x12b));var _0x70fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0fc7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x70fc('0x0'));var util=require(_0x70fc('0x1'));var BPromise=require('bluebird');var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0xae5939,_0x57aea9,_0x65f20e){var _0x55432c=0x1;var _0x311fc3=[];var _0x5a8e96={'context':_0x57aea9[_0x70fc('0x2')]||_0x70fc('0x3'),'exten':util[_0x70fc('0x4')](_0x70fc('0x5'),_0xae5939[_0x70fc('0x6')],_0x65f20e),'type':_0x70fc('0x7'),'isApp':![],'ChanSpyId':_0xae5939['id'],'UserId':_0x57aea9['id']};_0x311fc3[_0x70fc('0x8')](_['merge']({'app':_0x70fc('0x9'),'appdata':util[_0x70fc('0x4')](_0x70fc('0xa'),_0x70fc('0xb')),'priority':_0x55432c++},_0x5a8e96));if(_0xae5939[_0x70fc('0xc')]){_0x311fc3[_0x70fc('0x8')](_[_0x70fc('0xd')]({'app':_0x70fc('0xe'),'appdata':util[_0x70fc('0x4')]('${UNIQUEID}.%s,a',_0xae5939[_0x70fc('0xf')]),'priority':_0x55432c++},_0x5a8e96));}if(_0xae5939[_0x70fc('0x10')]){_0x311fc3['push'](_[_0x70fc('0xd')]({'app':_0x70fc('0x11'),'appdata':_0xae5939[_0x70fc('0x12')],'priority':_0x55432c++},_0x5a8e96));}_0x311fc3[_0x70fc('0x8')](_['merge']({'app':'ChanSpy','appdata':util[_0x70fc('0x4')]('SIP/%s,%s',_0x57aea9[_0x70fc('0x13')],_0xae5939['options']?_0xae5939['options'][_0x70fc('0x14')](''):''),'priority':_0x55432c++},_0x5a8e96));if(_0xae5939[_0x70fc('0xc')]){_0x311fc3[_0x70fc('0x8')](_[_0x70fc('0xd')]({'app':_0x70fc('0x15'),'priority':_0x55432c++},_0x5a8e96));}return _0x311fc3;};var getChanSpyApplications=function(_0x416544,_0x19eef8){var _0x3e62a5=[];for(var _0x20b999=0x0,_0xf3f9d1=0x1;_0x20b999<_0x19eef8[_0x70fc('0x16')];_0x20b999++,_0xf3f9d1=0x1){_0x3e62a5=_0x3e62a5[_0x70fc('0x17')](getUserApplications(_0x416544,_0x19eef8[_0x20b999],_0x19eef8[_0x20b999]['internal']));if(_0x19eef8[_0x20b999]['internal']!=_0x19eef8[_0x20b999]['name']){_0x3e62a5=_0x3e62a5[_0x70fc('0x17')](getUserApplications(_0x416544,_0x19eef8[_0x20b999],_0x19eef8[_0x20b999][_0x70fc('0x13')]));}}return _0x3e62a5;};var getChanSpyPromise=function(_0x30fd3c,_0x2a8256){return new BPromise(function(_0x5b38a4,_0x19675b){return _0x30fd3c[_0x70fc('0x18')]['findAll']({'attributes':['id',_0x70fc('0x13'),_0x70fc('0x19')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x70fc('0x1a')](function(_0x2e71ca){if(_0x2e71ca){return _0x5b38a4(getChanSpyApplications(_0x2a8256,_0x2e71ca));}return _0x5b38a4([]);})[_0x70fc('0x1b')](function(_0x30ee52){_0x19675b(_0x30ee52);});});};module[_0x70fc('0x1c')]=function(_0x2c06a4,_0x5a186e){var _0x43e26f=_0x2c06a4[_0x70fc('0x1d')];return _0x2c06a4[_0x70fc('0x1e')](_0x70fc('0x1f'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0xdcc414,_0x460743,_0x4361e6){return getChanSpyPromise(_0x43e26f,_0xdcc414)[_0x70fc('0x1a')](function(_0x4a660e){if(_0x4a660e&&_0x4a660e[_0x70fc('0x16')]){return _0x43e26f[_0x70fc('0x20')]['bulkCreate'](_0x4a660e);}})[_0x70fc('0x1a')](function(){_0x4361e6();})[_0x70fc('0x1b')](function(_0x3420d1){_0x4361e6(_0x3420d1);});},'afterUpdate':function(_0x18c94c,_0xf3904a,_0x362b4a){return _0x43e26f['VoiceExtension'][_0x70fc('0x21')]({'where':{'ChanSpyId':_0x18c94c['id']}})[_0x70fc('0x1a')](function(){return getChanSpyPromise(_0x43e26f,_0x18c94c);})[_0x70fc('0x1a')](function(_0x43616f){if(_0x43616f&&_0x43616f[_0x70fc('0x16')]){return _0x43e26f[_0x70fc('0x20')]['bulkCreate'](_0x43616f);}})[_0x70fc('0x1a')](function(){_0x362b4a();})[_0x70fc('0x1b')](function(_0x10881e){_0x362b4a(_0x10881e);});},'afterDestroy':function(_0x4ae848,_0x5df30d,_0x47bb31){return _0x43e26f[_0x70fc('0x20')][_0x70fc('0x21')]({'where':{'ChanSpyId':_0x4ae848['id']}})[_0x70fc('0x1a')](function(){_0x47bb31();})[_0x70fc('0x1b')](function(_0x310886){_0x47bb31(_0x310886);});}}});}; \ No newline at end of file +var _0x1b60=['password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','agent','catch','define','VoiceChanSpy','voice_chanspy','then','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','prefix','system','push','merge','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','Authenticate'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x1b60,0x126));var _0x01b6=function(_0x39275f,_0x2490ac){_0x39275f=_0x39275f-0x0;var _0x53e917=_0x1b60[_0x39275f];return _0x53e917;};'use strict';var _=require(_0x01b6('0x0'));var util=require(_0x01b6('0x1'));var BPromise=require(_0x01b6('0x2'));var attributes=require(_0x01b6('0x3'));var getUserApplications=function(_0x1954ab,_0x321f75,_0x3366db){var _0x305371=0x1;var _0x432703=[];var _0x27092c={'context':_0x321f75['context']||_0x01b6('0x4'),'exten':util['format']('%s%s',_0x1954ab[_0x01b6('0x5')],_0x3366db),'type':_0x01b6('0x6'),'isApp':![],'ChanSpyId':_0x1954ab['id'],'UserId':_0x321f75['id']};_0x432703[_0x01b6('0x7')](_[_0x01b6('0x8')]({'app':_0x01b6('0x9'),'appdata':util[_0x01b6('0xa')](_0x01b6('0xb'),_0x01b6('0xc')),'priority':_0x305371++},_0x27092c));if(_0x1954ab[_0x01b6('0xd')]){_0x432703[_0x01b6('0x7')](_[_0x01b6('0x8')]({'app':_0x01b6('0xe'),'appdata':util[_0x01b6('0xa')](_0x01b6('0xf'),_0x1954ab[_0x01b6('0x10')]),'priority':_0x305371++},_0x27092c));}if(_0x1954ab['auth']){_0x432703['push'](_['merge']({'app':_0x01b6('0x11'),'appdata':_0x1954ab[_0x01b6('0x12')],'priority':_0x305371++},_0x27092c));}_0x432703[_0x01b6('0x7')](_['merge']({'app':_0x01b6('0x13'),'appdata':util[_0x01b6('0xa')](_0x01b6('0x14'),_0x321f75[_0x01b6('0x15')],_0x1954ab[_0x01b6('0x16')]?_0x1954ab[_0x01b6('0x16')][_0x01b6('0x17')](''):''),'priority':_0x305371++},_0x27092c));if(_0x1954ab[_0x01b6('0xd')]){_0x432703[_0x01b6('0x7')](_[_0x01b6('0x8')]({'app':_0x01b6('0x18'),'priority':_0x305371++},_0x27092c));}return _0x432703;};var getChanSpyApplications=function(_0x34ca67,_0x2124ab){var _0x2f4d89=[];for(var _0x2b0983=0x0,_0x3b0d46=0x1;_0x2b0983<_0x2124ab[_0x01b6('0x19')];_0x2b0983++,_0x3b0d46=0x1){_0x2f4d89=_0x2f4d89[_0x01b6('0x1a')](getUserApplications(_0x34ca67,_0x2124ab[_0x2b0983],_0x2124ab[_0x2b0983][_0x01b6('0x1b')]));if(_0x2124ab[_0x2b0983]['internal']!=_0x2124ab[_0x2b0983][_0x01b6('0x15')]){_0x2f4d89=_0x2f4d89[_0x01b6('0x1a')](getUserApplications(_0x34ca67,_0x2124ab[_0x2b0983],_0x2124ab[_0x2b0983]['name']));}}return _0x2f4d89;};var getChanSpyPromise=function(_0x5b027d,_0x5c4955){return new BPromise(function(_0x438d7b,_0x15a7ba){return _0x5b027d[_0x01b6('0x1c')][_0x01b6('0x1d')]({'attributes':['id',_0x01b6('0x15'),_0x01b6('0x1b')],'where':{'role':_0x01b6('0x1e'),'chanspy':!![]},'raw':!![]})['then'](function(_0x31de82){if(_0x31de82){return _0x438d7b(getChanSpyApplications(_0x5c4955,_0x31de82));}return _0x438d7b([]);})[_0x01b6('0x1f')](function(_0xf2ff13){_0x15a7ba(_0xf2ff13);});});};module['exports']=function(_0x3d7f85,_0x57486f){var _0x53c761=_0x3d7f85['models'];return _0x3d7f85[_0x01b6('0x20')](_0x01b6('0x21'),attributes,{'tableName':_0x01b6('0x22'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x16d25a,_0xad8fb8,_0xb321d9){return getChanSpyPromise(_0x53c761,_0x16d25a)[_0x01b6('0x23')](function(_0x26694a){if(_0x26694a&&_0x26694a[_0x01b6('0x19')]){return _0x53c761['VoiceExtension']['bulkCreate'](_0x26694a);}})['then'](function(){_0xb321d9();})['catch'](function(_0x54dce9){_0xb321d9(_0x54dce9);});},'afterUpdate':function(_0xe2b3d2,_0x597b81,_0x5c5a32){return _0x53c761['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0xe2b3d2['id']}})['then'](function(){return getChanSpyPromise(_0x53c761,_0xe2b3d2);})[_0x01b6('0x23')](function(_0x194f73){if(_0x194f73&&_0x194f73[_0x01b6('0x19')]){return _0x53c761[_0x01b6('0x24')][_0x01b6('0x25')](_0x194f73);}})[_0x01b6('0x23')](function(){_0x5c5a32();})[_0x01b6('0x1f')](function(_0x5dfa88){_0x5c5a32(_0x5dfa88);});},'afterDestroy':function(_0x2c239b,_0x5c9865,_0x2f9f22){return _0x53c761[_0x01b6('0x24')][_0x01b6('0x26')]({'where':{'ChanSpyId':_0x2c239b['id']}})[_0x01b6('0x23')](function(){_0x2f9f22();})['catch'](function(_0x273b84){_0x2f9f22(_0x273b84);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index d85211b..9e270d6 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 _0x235a=['http','then','VoiceChanSpy,\x20%s,\x20%s','debug','error','code','message','info','request\x20sent','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1a2197,_0x256dbd){var _0x35c1c0=function(_0x545ba1){while(--_0x545ba1){_0x1a2197['push'](_0x1a2197['shift']());}};_0x35c1c0(++_0x256dbd);}(_0x235a,0x1ef));var _0xa235=function(_0x2edb6a,_0x2902c7){_0x2edb6a=_0x2edb6a-0x0;var _0x10c417=_0x235a[_0x2edb6a];return _0x10c417;};'use strict';var _=require(_0xa235('0x0'));var util=require(_0xa235('0x1'));var moment=require(_0xa235('0x2'));var BPromise=require('bluebird');var rs=require(_0xa235('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa235('0x4'))['db'];var utils=require(_0xa235('0x5'));var logger=require(_0xa235('0x6'))(_0xa235('0x7'));var config=require(_0xa235('0x8'));var jayson=require(_0xa235('0x9'));var client=jayson[_0xa235('0xa')][_0xa235('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b849b,_0x2e535e,_0x2dc1ba){return new BPromise(function(_0x450e27,_0x2f3403){return client['request'](_0x4b849b,_0x2dc1ba)[_0xa235('0xc')](function(_0x561602){logger['info'](_0xa235('0xd'),_0x2e535e,'request\x20sent');logger[_0xa235('0xe')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x2e535e,'request\x20sent',JSON['stringify'](_0x561602));if(_0x561602[_0xa235('0xf')]){if(_0x561602[_0xa235('0xf')][_0xa235('0x10')]===0x1f4){logger[_0xa235('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0x561602['error']['message']);return _0x2f3403(_0x561602[_0xa235('0xf')][_0xa235('0x11')]);}logger[_0xa235('0xf')](_0xa235('0xd'),_0x2e535e,_0x561602[_0xa235('0xf')][_0xa235('0x11')]);return _0x450e27(_0x561602[_0xa235('0xf')][_0xa235('0x11')]);}else{logger[_0xa235('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0xa235('0x13'));_0x450e27(_0x561602[_0xa235('0x14')][_0xa235('0x11')]);}})[_0xa235('0x15')](function(_0x16dbe9){logger[_0xa235('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x2e535e,_0x16dbe9);_0x2f3403(_0x16dbe9);});});} \ No newline at end of file +var _0x9348=['error','code','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2c8802,_0x4ad8e4){var _0x29fefc=function(_0x92772b){while(--_0x92772b){_0x2c8802['push'](_0x2c8802['shift']());}};_0x29fefc(++_0x4ad8e4);}(_0x9348,0x10d));var _0x8934=function(_0x4609a5,_0x4930b7){_0x4609a5=_0x4609a5-0x0;var _0x3eb74f=_0x9348[_0x4609a5];return _0x3eb74f;};'use strict';var _=require(_0x8934('0x0'));var util=require(_0x8934('0x1'));var moment=require(_0x8934('0x2'));var BPromise=require(_0x8934('0x3'));var rs=require(_0x8934('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8934('0x5'))['db'];var utils=require(_0x8934('0x6'));var logger=require('../../config/logger')(_0x8934('0x7'));var config=require(_0x8934('0x8'));var jayson=require(_0x8934('0x9'));var client=jayson[_0x8934('0xa')][_0x8934('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3ee9b9,_0x512f30,_0x284a62){return new BPromise(function(_0x3734c5,_0x1c7f03){return client['request'](_0x3ee9b9,_0x284a62)['then'](function(_0x5ec16d){logger['info'](_0x8934('0xc'),_0x512f30,'request\x20sent');logger[_0x8934('0xd')](_0x8934('0xe'),_0x512f30,_0x8934('0xf'),JSON[_0x8934('0x10')](_0x5ec16d));if(_0x5ec16d[_0x8934('0x11')]){if(_0x5ec16d[_0x8934('0x11')][_0x8934('0x12')]===0x1f4){logger[_0x8934('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x512f30,_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);return _0x1c7f03(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0x5ec16d['error'][_0x8934('0x13')]);return _0x3734c5(_0x5ec16d[_0x8934('0x11')][_0x8934('0x13')]);}else{logger[_0x8934('0x14')](_0x8934('0xc'),_0x512f30,_0x8934('0xf'));_0x3734c5(_0x5ec16d[_0x8934('0x15')][_0x8934('0x13')]);}})['catch'](function(_0xb86bc9){logger[_0x8934('0x11')](_0x8934('0xc'),_0x512f30,_0xb86bc9);_0x1c7f03(_0xb86bc9);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 60d7945..c11c5e8 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 _0xa1c8=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','exports','multer','util','path'];(function(_0xf5cf8b,_0x4698bd){var _0x38216e=function(_0x52b583){while(--_0x52b583){_0xf5cf8b['push'](_0xf5cf8b['shift']());}};_0x38216e(++_0x4698bd);}(_0xa1c8,0xb1));var _0x8a1c=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0xa1c8[_0x3070dc];return _0x431489;};'use strict';var multer=require(_0x8a1c('0x0'));var util=require(_0x8a1c('0x1'));var path=require(_0x8a1c('0x2'));var timeout=require(_0x8a1c('0x3'));var express=require(_0x8a1c('0x4'));var router=express[_0x8a1c('0x5')]();var fs_extra=require(_0x8a1c('0x6'));var auth=require(_0x8a1c('0x7'));var interaction=require(_0x8a1c('0x8'));var config=require(_0x8a1c('0x9'));var controller=require('./voiceContext.controller');router[_0x8a1c('0xa')]('/',auth[_0x8a1c('0xb')](),controller[_0x8a1c('0xc')]);router[_0x8a1c('0xa')](_0x8a1c('0xd'),auth[_0x8a1c('0xb')](),controller[_0x8a1c('0xe')]);router['post']('/',auth[_0x8a1c('0xb')](),controller[_0x8a1c('0xf')]);router['put'](_0x8a1c('0xd'),auth[_0x8a1c('0xb')](),controller[_0x8a1c('0x10')]);router[_0x8a1c('0x11')](_0x8a1c('0xd'),auth[_0x8a1c('0xb')](),controller[_0x8a1c('0x12')]);module[_0x8a1c('0x13')]=router; \ No newline at end of file +var _0x1092=['connect-timeout','Router','./voiceContext.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','path'];(function(_0x1ff575,_0xdba21f){var _0x48fc9e=function(_0x51cf97){while(--_0x51cf97){_0x1ff575['push'](_0x1ff575['shift']());}};_0x48fc9e(++_0xdba21f);}(_0x1092,0x11e));var _0x2109=function(_0x2a7701,_0x11daa6){_0x2a7701=_0x2a7701-0x0;var _0x8d9d99=_0x1092[_0x2a7701];return _0x8d9d99;};'use strict';var multer=require(_0x2109('0x0'));var util=require('util');var path=require(_0x2109('0x1'));var timeout=require(_0x2109('0x2'));var express=require('express');var router=express[_0x2109('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x2109('0x4'));router[_0x2109('0x5')]('/',auth[_0x2109('0x6')](),controller['index']);router['get'](_0x2109('0x7'),auth['isAuthenticated'](),controller[_0x2109('0x8')]);router[_0x2109('0x9')]('/',auth[_0x2109('0x6')](),controller[_0x2109('0xa')]);router[_0x2109('0xb')]('/:id',auth[_0x2109('0x6')](),controller[_0x2109('0xc')]);router[_0x2109('0xd')](_0x2109('0x7'),auth[_0x2109('0x6')](),controller[_0x2109('0xe')]);module[_0x2109('0xf')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index c09d44d..4404e5c 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 _0x3a42=['name','BOOLEAN','sequelize','exports','STRING'];(function(_0xdb5271,_0x20fbb7){var _0x38bb9f=function(_0x538617){while(--_0x538617){_0xdb5271['push'](_0xdb5271['shift']());}};_0x38bb9f(++_0x20fbb7);}(_0x3a42,0x19c));var _0x23a4=function(_0x5a9a65,_0x48363a){_0x5a9a65=_0x5a9a65-0x0;var _0x467823=_0x3a42[_0x5a9a65];return _0x467823;};'use strict';var Sequelize=require(_0x23a4('0x0'));module[_0x23a4('0x1')]={'name':{'type':Sequelize[_0x23a4('0x2')],'unique':_0x23a4('0x3')},'description':{'type':Sequelize[_0x23a4('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x23a4('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9737=['name','STRING','BOOLEAN','sequelize','exports'];(function(_0x3dd430,_0x49c2fd){var _0x3dea3e=function(_0x20084d){while(--_0x20084d){_0x3dd430['push'](_0x3dd430['shift']());}};_0x3dea3e(++_0x49c2fd);}(_0x9737,0x67));var _0x7973=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9737[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x7973('0x0'));module[_0x7973('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x7973('0x2')},'description':{'type':Sequelize[_0x7973('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x7973('0x4')],'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 5d04167..b6b5796 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 _0x0d3a=['key','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','rows','catch','params','keys','find','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','render','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','then','info','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','VoiceContext,\x20%s,\x20%s','message','result','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','update','destroy','get','Contexts','UserProfileResource','name','send','index','map','VoiceContext','rawAttributes','fieldName','type'];(function(_0x1c987e,_0x596ef1){var _0x3620a1=function(_0x454157){while(--_0x454157){_0x1c987e['push'](_0x1c987e['shift']());}};_0x3620a1(++_0x596ef1);}(_0x0d3a,0x163));var _0xa0d3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0d3a[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0xa0d3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa0d3('0x1'));var jsonpatch=require(_0xa0d3('0x2'));var rp=require(_0xa0d3('0x3'));var moment=require(_0xa0d3('0x4'));var BPromise=require(_0xa0d3('0x5'));var Mustache=require(_0xa0d3('0x6'));var util=require(_0xa0d3('0x7'));var path=require(_0xa0d3('0x8'));var sox=require(_0xa0d3('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa0d3('0xa'));var _=require(_0xa0d3('0xb'));var squel=require(_0xa0d3('0xc'));var crypto=require(_0xa0d3('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa0d3('0xe'));var toCsv=require(_0xa0d3('0xf'));var querystring=require('querystring');var Papa=require(_0xa0d3('0x10'));var Redis=require(_0xa0d3('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa0d3('0x12'));var hardwareService=require(_0xa0d3('0x13'));var logger=require(_0xa0d3('0x14'))(_0xa0d3('0x15'));var utils=require('../../config/utils');var config=require(_0xa0d3('0x16'));var licenseUtil=require(_0xa0d3('0x17'));var db=require(_0xa0d3('0x18'))['db'];var jayson=require(_0xa0d3('0x19'));var client=jayson[_0xa0d3('0x1a')][_0xa0d3('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x59552b,_0x3043cc,_0x42f1fe,_0x418bd3){return new BPromise(function(_0xadbed5,_0xfdbc77){var _0x30e778=_0x418bd3||client;return _0x30e778['request'](_0x59552b,_0x42f1fe)[_0xa0d3('0x1c')](function(_0x5ecfd7){logger[_0xa0d3('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x3043cc,_0xa0d3('0x1e'));logger[_0xa0d3('0x1f')](_0xa0d3('0x20'),_0x3043cc,_0xa0d3('0x1e'),JSON[_0xa0d3('0x21')](_0x5ecfd7));if(_0x5ecfd7[_0xa0d3('0x22')]){if(_0x5ecfd7['error']['code']===0x1f4){logger[_0xa0d3('0x22')](_0xa0d3('0x23'),_0x3043cc,_0x5ecfd7[_0xa0d3('0x22')][_0xa0d3('0x24')]);return _0xfdbc77(_0x5ecfd7[_0xa0d3('0x22')][_0xa0d3('0x24')]);}logger[_0xa0d3('0x22')](_0xa0d3('0x23'),_0x3043cc,_0x5ecfd7[_0xa0d3('0x22')][_0xa0d3('0x24')]);return _0xadbed5(_0x5ecfd7[_0xa0d3('0x22')][_0xa0d3('0x24')]);}else{logger[_0xa0d3('0x1d')](_0xa0d3('0x23'),_0x3043cc,_0xa0d3('0x1e'));_0xadbed5(_0x5ecfd7[_0xa0d3('0x25')][_0xa0d3('0x24')]);}})['catch'](function(_0x360fce){logger[_0xa0d3('0x22')](_0xa0d3('0x23'),_0x3043cc,_0x360fce);_0xfdbc77(_0x360fce);});});}function respondWithStatusCode(_0x260d80,_0x25c885){_0x25c885=_0x25c885||0xcc;return function(_0x3a2ee6){if(_0x3a2ee6){return _0x260d80[_0xa0d3('0x26')](_0x25c885);}return _0x260d80[_0xa0d3('0x27')](_0x25c885)[_0xa0d3('0x28')]();};}function respondWithResult(_0x99be14,_0x5ee4cf){_0x5ee4cf=_0x5ee4cf||0xc8;return function(_0x54cd98){if(_0x54cd98){return _0x99be14[_0xa0d3('0x27')](_0x5ee4cf)[_0xa0d3('0x29')](_0x54cd98);}};}function respondWithFilteredResult(_0x522846,_0x4a2346){return function(_0xce932e){if(_0xce932e){var _0x3f9025=typeof _0x4a2346['offset']===_0xa0d3('0x2a')&&typeof _0x4a2346[_0xa0d3('0x2b')]===_0xa0d3('0x2a');var _0x489d9b=_0xce932e[_0xa0d3('0x2c')];var _0x2e6570=_0x3f9025?0x0:_0x4a2346[_0xa0d3('0x2d')];var _0x279e49=_0x3f9025?_0xce932e['count']:_0x4a2346['offset']+_0x4a2346[_0xa0d3('0x2b')];var _0x2fb0fa;if(_0x279e49>=_0x489d9b){_0x279e49=_0x489d9b;_0x2fb0fa=0xc8;}else{_0x2fb0fa=0xce;}_0x522846[_0xa0d3('0x27')](_0x2fb0fa);return _0x522846['set'](_0xa0d3('0x2e'),_0x2e6570+'-'+_0x279e49+'/'+_0x489d9b)[_0xa0d3('0x29')](_0xce932e);}return null;};}function patchUpdates(_0x15ca96){return function(_0x55c132){try{jsonpatch['apply'](_0x55c132,_0x15ca96,!![]);}catch(_0x567264){return BPromise[_0xa0d3('0x2f')](_0x567264);}return _0x55c132['save']();};}function saveUpdates(_0x3f450d,_0x46addb){return function(_0x313003){if(_0x313003){return _0x313003[_0xa0d3('0x30')](_0x3f450d)[_0xa0d3('0x1c')](function(_0x540aa9){return _0x540aa9;});}return null;};}function removeEntity(_0x36020e,_0x163bab){return function(_0x48f4fc){if(_0x48f4fc){return _0x48f4fc[_0xa0d3('0x31')]()[_0xa0d3('0x1c')](function(){var _0x2ec735=_0x48f4fc[_0xa0d3('0x32')]({'plain':!![]});var _0x4bdf0a=_0xa0d3('0x33');return db[_0xa0d3('0x34')]['destroy']({'where':{'type':_0x4bdf0a,'resourceId':_0x2ec735['id']}})[_0xa0d3('0x1c')](function(){return _0x48f4fc;});})[_0xa0d3('0x1c')](function(){_0x36020e[_0xa0d3('0x27')](0xcc)[_0xa0d3('0x28')]();});}};}function handleEntityNotFound(_0x463603,_0x51bd36){return function(_0x53e0d4){if(!_0x53e0d4){_0x463603[_0xa0d3('0x26')](0x194);}return _0x53e0d4;};}function handleError(_0x34c519,_0x2a7e00){_0x2a7e00=_0x2a7e00||0x1f4;return function(_0x4e98d0){logger[_0xa0d3('0x22')](_0x4e98d0['stack']);if(_0x4e98d0['name']){delete _0x4e98d0[_0xa0d3('0x35')];}_0x34c519['status'](_0x2a7e00)[_0xa0d3('0x36')](_0x4e98d0);};}exports[_0xa0d3('0x37')]=function(_0x46a5f5,_0x4ce97f){var _0x7444e5={},_0x3b8c59={},_0x526b7c={'count':0x0,'rows':[]};var _0x52a6d7=_[_0xa0d3('0x38')](db[_0xa0d3('0x39')][_0xa0d3('0x3a')],function(_0x10f8e2){return{'name':_0x10f8e2[_0xa0d3('0x3b')],'type':_0x10f8e2[_0xa0d3('0x3c')][_0xa0d3('0x3d')]};});_0x3b8c59['model']=_[_0xa0d3('0x38')](_0x52a6d7,'name');_0x3b8c59[_0xa0d3('0x3e')]=_['keys'](_0x46a5f5[_0xa0d3('0x3e')]);_0x3b8c59['filters']=_[_0xa0d3('0x3f')](_0x3b8c59[_0xa0d3('0x40')],_0x3b8c59[_0xa0d3('0x3e')]);_0x7444e5[_0xa0d3('0x41')]=_[_0xa0d3('0x3f')](_0x3b8c59[_0xa0d3('0x40')],qs[_0xa0d3('0x42')](_0x46a5f5[_0xa0d3('0x3e')][_0xa0d3('0x42')]));_0x7444e5[_0xa0d3('0x41')]=_0x7444e5[_0xa0d3('0x41')][_0xa0d3('0x43')]?_0x7444e5[_0xa0d3('0x41')]:_0x3b8c59['model'];if(!_0x46a5f5[_0xa0d3('0x3e')][_0xa0d3('0x44')](_0xa0d3('0x45'))){_0x7444e5[_0xa0d3('0x2b')]=qs[_0xa0d3('0x2b')](_0x46a5f5[_0xa0d3('0x3e')][_0xa0d3('0x2b')]);_0x7444e5[_0xa0d3('0x2d')]=qs['offset'](_0x46a5f5[_0xa0d3('0x3e')][_0xa0d3('0x2d')]);}_0x7444e5[_0xa0d3('0x46')]=qs[_0xa0d3('0x47')](_0x46a5f5[_0xa0d3('0x3e')][_0xa0d3('0x47')]);_0x7444e5[_0xa0d3('0x48')]=qs[_0xa0d3('0x49')](_[_0xa0d3('0x4a')](_0x46a5f5['query'],_0x3b8c59['filters']),_0x52a6d7);if(_0x46a5f5['query'][_0xa0d3('0x4b')]){_0x7444e5[_0xa0d3('0x48')]=_['merge'](_0x7444e5[_0xa0d3('0x48')],{'$or':_[_0xa0d3('0x38')](_0x52a6d7,function(_0x57eabf){if(_0x57eabf[_0xa0d3('0x3c')]!=='VIRTUAL'){var _0x3c3129={};_0x3c3129[_0x57eabf[_0xa0d3('0x35')]]={'$like':'%'+_0x46a5f5[_0xa0d3('0x3e')][_0xa0d3('0x4b')]+'%'};return _0x3c3129;}})});}_0x7444e5=_[_0xa0d3('0x4c')]({},_0x7444e5,_0x46a5f5[_0xa0d3('0x4d')]);var _0x2841a7={'where':_0x7444e5[_0xa0d3('0x48')]};return db['VoiceContext']['count'](_0x2841a7)[_0xa0d3('0x1c')](function(_0x32464f){_0x526b7c['count']=_0x32464f;if(_0x46a5f5[_0xa0d3('0x3e')][_0xa0d3('0x4e')]){_0x7444e5[_0xa0d3('0x4f')]=[{'all':!![]}];}return db[_0xa0d3('0x39')][_0xa0d3('0x50')](_0x7444e5);})['then'](function(_0x3a487c){_0x526b7c[_0xa0d3('0x51')]=_0x3a487c;return _0x526b7c;})[_0xa0d3('0x1c')](respondWithFilteredResult(_0x4ce97f,_0x7444e5))[_0xa0d3('0x52')](handleError(_0x4ce97f,null));};exports['show']=function(_0xf2068,_0x56af57){var _0x4416ce={'raw':![],'where':{'id':_0xf2068[_0xa0d3('0x53')]['id']}},_0x116cfc={};_0x116cfc[_0xa0d3('0x40')]=_[_0xa0d3('0x54')](db[_0xa0d3('0x39')]['rawAttributes']);_0x116cfc['query']=_['keys'](_0xf2068[_0xa0d3('0x3e')]);_0x116cfc[_0xa0d3('0x49')]=_[_0xa0d3('0x3f')](_0x116cfc[_0xa0d3('0x40')],_0x116cfc[_0xa0d3('0x3e')]);_0x4416ce[_0xa0d3('0x41')]=_['intersection'](_0x116cfc['model'],qs[_0xa0d3('0x42')](_0xf2068['query'][_0xa0d3('0x42')]));_0x4416ce['attributes']=_0x4416ce[_0xa0d3('0x41')]['length']?_0x4416ce[_0xa0d3('0x41')]:_0x116cfc['model'];if(_0xf2068[_0xa0d3('0x3e')][_0xa0d3('0x4e')]){_0x4416ce[_0xa0d3('0x4f')]=[{'all':!![]}];}_0x4416ce=_[_0xa0d3('0x4c')]({},_0x4416ce,_0xf2068[_0xa0d3('0x4d')]);return db['VoiceContext'][_0xa0d3('0x55')](_0x4416ce)[_0xa0d3('0x1c')](handleEntityNotFound(_0x56af57,null))['then'](respondWithResult(_0x56af57,null))['catch'](handleError(_0x56af57,null));};exports['create']=function(_0x46a8b7,_0x4a8087,_0x70e6d6){var _0x1fbdbc;return db[_0xa0d3('0x39')][_0xa0d3('0x56')](_0x46a8b7[_0xa0d3('0x57')],{'raw':!![]})['then'](function(_0x2210e1){_0x1fbdbc=_0x2210e1;return db[_0xa0d3('0x39')][_0xa0d3('0x50')]({'raw':!![]});})['then'](function(_0x3eefde){var _0x154a23=fs[_0xa0d3('0x58')](path[_0xa0d3('0x59')](config[_0xa0d3('0x5a')],_0xa0d3('0x5b')),_0xa0d3('0x5c'));var _0x258e03=ejs['render'](_0x154a23,{'contexts':_0x3eefde||[]});fs[_0xa0d3('0x5d')](_0xa0d3('0x5e'),_0x258e03);})['then'](function(){return respondWithRpcPromise(_0xa0d3('0x5f'),'create',{'module':_0xa0d3('0x60')});})[_0xa0d3('0x1c')](function(){var _0x19b6df=_0x46a8b7[_0xa0d3('0x61')][_0xa0d3('0x32')]({'plain':!![]});if(!_0x19b6df)throw new Error(_0xa0d3('0x62'));if(_0x19b6df[_0xa0d3('0x63')]===_0xa0d3('0x61')){var _0x5f416e=_0x1fbdbc[_0xa0d3('0x32')]({'plain':!![]});return db['UserProfileSection'][_0xa0d3('0x55')]({'where':{'name':_0xa0d3('0x33'),'userProfileId':_0x19b6df[_0xa0d3('0x64')]},'raw':!![]})[_0xa0d3('0x1c')](function(_0x24d3ec){if(_0x24d3ec&&_0x24d3ec[_0xa0d3('0x65')]===0x0){return db[_0xa0d3('0x34')][_0xa0d3('0x56')]({'name':_0x5f416e[_0xa0d3('0x35')],'resourceId':_0x5f416e['id'],'type':_0x24d3ec[_0xa0d3('0x35')],'sectionId':_0x24d3ec['id']},{})[_0xa0d3('0x1c')](function(){return _0x1fbdbc;});}else{return _0x1fbdbc;}})[_0xa0d3('0x52')](function(_0x278617){logger[_0xa0d3('0x22')](_0xa0d3('0x66'),_0x278617);throw _0x278617;});}return _0x1fbdbc;})[_0xa0d3('0x1c')](respondWithResult(_0x4a8087,0xc9))[_0xa0d3('0x52')](handleError(_0x4a8087,null));};exports[_0xa0d3('0x30')]=function(_0x1e7f3e,_0x5dd3a3,_0x38c640){var _0x1df2f0;return db[_0xa0d3('0x39')][_0xa0d3('0x55')]({'where':{'id':_0x1e7f3e['params']['id']}})[_0xa0d3('0x1c')](handleEntityNotFound(_0x5dd3a3,null))[_0xa0d3('0x1c')](saveUpdates(_0x1e7f3e['body'],null))[_0xa0d3('0x1c')](function(_0x378b28){if(_0x378b28){_0x1df2f0=_0x378b28;return db[_0xa0d3('0x39')][_0xa0d3('0x50')]({'raw':!![]});}})[_0xa0d3('0x1c')](function(_0x50250b){var _0x47393b=fs['readFileSync'](path[_0xa0d3('0x59')](config[_0xa0d3('0x5a')],_0xa0d3('0x5b')),_0xa0d3('0x5c'));var _0x35b5b8=ejs[_0xa0d3('0x67')](_0x47393b,{'contexts':_0x50250b||[]});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x35b5b8);})[_0xa0d3('0x1c')](function(){return respondWithRpcPromise(_0xa0d3('0x5f'),_0xa0d3('0x30'),{'module':_0xa0d3('0x60')});})[_0xa0d3('0x1c')](function(){return _0x1df2f0;})['then'](respondWithResult(_0x5dd3a3,null))[_0xa0d3('0x52')](handleError(_0x5dd3a3,null));};exports[_0xa0d3('0x31')]=function(_0x44abfa,_0x1a1a2c,_0x41f0dc){var _0x1d94db;return db['VoiceContext']['find']({'where':{'id':_0x44abfa[_0xa0d3('0x53')]['id']}})[_0xa0d3('0x1c')](handleEntityNotFound(_0x1a1a2c,null))[_0xa0d3('0x1c')](removeEntity(_0x1a1a2c,null))[_0xa0d3('0x1c')](function(){return db[_0xa0d3('0x39')]['findAll']({'raw':!![]});})[_0xa0d3('0x1c')](function(_0x97329a){var _0x1d0a94=fs[_0xa0d3('0x58')](path[_0xa0d3('0x59')](config['root'],_0xa0d3('0x5b')),_0xa0d3('0x5c'));var _0x4414fd=ejs[_0xa0d3('0x67')](_0x1d0a94,{'contexts':_0x97329a});fs['writeFileSync']('/etc/asterisk/extensions_xcally_contexts.conf',_0x4414fd);return respondWithRpcPromise(_0xa0d3('0x5f'),_0xa0d3('0x31'),{'module':_0xa0d3('0x60')});})[_0xa0d3('0x52')](handleError(_0x1a1a2c,null));}; \ No newline at end of file +var _0x403a=['error','code','message','info','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','update','get','destroy','name','map','VoiceContext','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','create','readFileSync','join','root','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','UserProfileSection','find','Contexts','userProfileId','autoAssociation','UserProfileResource','body','rimraf','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/license/util','../../mysqldb','client','http','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','VoiceContext,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x403a,0xa1));var _0xa403=function(_0x25efdf,_0x521462){_0x25efdf=_0x25efdf-0x0;var _0x22c495=_0x403a[_0x25efdf];return _0x22c495;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa403('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa403('0x1'));var util=require(_0xa403('0x2'));var path=require(_0xa403('0x3'));var sox=require(_0xa403('0x4'));var csv=require(_0xa403('0x5'));var ejs=require(_0xa403('0x6'));var fs=require('fs');var fs_extra=require(_0xa403('0x7'));var _=require(_0xa403('0x8'));var squel=require(_0xa403('0x9'));var crypto=require(_0xa403('0xa'));var jsforce=require(_0xa403('0xb'));var deskjs=require(_0xa403('0xc'));var toCsv=require(_0xa403('0x5'));var querystring=require(_0xa403('0xd'));var Papa=require(_0xa403('0xe'));var Redis=require('ioredis');var authService=require(_0xa403('0xf'));var qs=require(_0xa403('0x10'));var as=require(_0xa403('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa403('0x12'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xa403('0x13'));var db=require(_0xa403('0x14'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xa403('0x15')][_0xa403('0x16')]({'port':0x232a});function respondWithRpcPromise(_0x42ea65,_0x2af5e9,_0x4f5b77,_0xb61e63){return new BPromise(function(_0x5cc6c8,_0x3790b4){var _0x2d6470=_0xb61e63||client;return _0x2d6470[_0xa403('0x17')](_0x42ea65,_0x4f5b77)[_0xa403('0x18')](function(_0x1475a6){logger['info'](_0xa403('0x19'),_0x2af5e9,_0xa403('0x1a'));logger['debug'](_0xa403('0x1b'),_0x2af5e9,'request\x20sent',JSON[_0xa403('0x1c')](_0x1475a6));if(_0x1475a6[_0xa403('0x1d')]){if(_0x1475a6[_0xa403('0x1d')][_0xa403('0x1e')]===0x1f4){logger['error'](_0xa403('0x19'),_0x2af5e9,_0x1475a6[_0xa403('0x1d')][_0xa403('0x1f')]);return _0x3790b4(_0x1475a6[_0xa403('0x1d')][_0xa403('0x1f')]);}logger[_0xa403('0x1d')](_0xa403('0x19'),_0x2af5e9,_0x1475a6[_0xa403('0x1d')]['message']);return _0x5cc6c8(_0x1475a6[_0xa403('0x1d')][_0xa403('0x1f')]);}else{logger[_0xa403('0x20')](_0xa403('0x19'),_0x2af5e9,'request\x20sent');_0x5cc6c8(_0x1475a6['result'][_0xa403('0x1f')]);}})['catch'](function(_0x4ceacc){logger[_0xa403('0x1d')](_0xa403('0x19'),_0x2af5e9,_0x4ceacc);_0x3790b4(_0x4ceacc);});});}function respondWithStatusCode(_0x38ecb1,_0xf8ad41){_0xf8ad41=_0xf8ad41||0xcc;return function(_0x296831){if(_0x296831){return _0x38ecb1[_0xa403('0x21')](_0xf8ad41);}return _0x38ecb1['status'](_0xf8ad41)[_0xa403('0x22')]();};}function respondWithResult(_0x4c4828,_0x1a438b){_0x1a438b=_0x1a438b||0xc8;return function(_0x21c5ca){if(_0x21c5ca){return _0x4c4828['status'](_0x1a438b)[_0xa403('0x23')](_0x21c5ca);}};}function respondWithFilteredResult(_0x403b28,_0x42fe3d){return function(_0x57bf86){if(_0x57bf86){var _0x12b3d1=typeof _0x42fe3d[_0xa403('0x24')]===_0xa403('0x25')&&typeof _0x42fe3d[_0xa403('0x26')]===_0xa403('0x25');var _0xb837b0=_0x57bf86[_0xa403('0x27')];var _0x282aed=_0x12b3d1?0x0:_0x42fe3d[_0xa403('0x24')];var _0x132e11=_0x12b3d1?_0x57bf86['count']:_0x42fe3d['offset']+_0x42fe3d[_0xa403('0x26')];var _0x1ddf55;if(_0x132e11>=_0xb837b0){_0x132e11=_0xb837b0;_0x1ddf55=0xc8;}else{_0x1ddf55=0xce;}_0x403b28[_0xa403('0x28')](_0x1ddf55);return _0x403b28[_0xa403('0x29')](_0xa403('0x2a'),_0x282aed+'-'+_0x132e11+'/'+_0xb837b0)[_0xa403('0x23')](_0x57bf86);}return null;};}function patchUpdates(_0x235a92){return function(_0xaa2b39){try{jsonpatch[_0xa403('0x2b')](_0xaa2b39,_0x235a92,!![]);}catch(_0x4dbf5b){return BPromise['reject'](_0x4dbf5b);}return _0xaa2b39[_0xa403('0x2c')]();};}function saveUpdates(_0x2304e4,_0x5dad7e){return function(_0x1dcbfe){if(_0x1dcbfe){return _0x1dcbfe[_0xa403('0x2d')](_0x2304e4)[_0xa403('0x18')](function(_0x420ab7){return _0x420ab7;});}return null;};}function removeEntity(_0x20de4c,_0x2e52d1){return function(_0x4c121b){if(_0x4c121b){return _0x4c121b['destroy']()[_0xa403('0x18')](function(){var _0x35563a=_0x4c121b[_0xa403('0x2e')]({'plain':!![]});var _0x3bc51c='Contexts';return db['UserProfileResource'][_0xa403('0x2f')]({'where':{'type':_0x3bc51c,'resourceId':_0x35563a['id']}})[_0xa403('0x18')](function(){return _0x4c121b;});})[_0xa403('0x18')](function(){_0x20de4c['status'](0xcc)[_0xa403('0x22')]();});}};}function handleEntityNotFound(_0x31ff97,_0x274b79){return function(_0x58f85c){if(!_0x58f85c){_0x31ff97[_0xa403('0x21')](0x194);}return _0x58f85c;};}function handleError(_0x16be1a,_0x393074){_0x393074=_0x393074||0x1f4;return function(_0x5ccf4a){logger[_0xa403('0x1d')](_0x5ccf4a['stack']);if(_0x5ccf4a[_0xa403('0x30')]){delete _0x5ccf4a[_0xa403('0x30')];}_0x16be1a[_0xa403('0x28')](_0x393074)['send'](_0x5ccf4a);};}exports['index']=function(_0xeaff68,_0x2aeaa1){var _0x23be6b={},_0x5e5f8f={},_0x24156e={'count':0x0,'rows':[]};var _0x4c5a74=_[_0xa403('0x31')](db[_0xa403('0x32')][_0xa403('0x33')],function(_0x43b676){return{'name':_0x43b676[_0xa403('0x34')],'type':_0x43b676['type']['key']};});_0x5e5f8f[_0xa403('0x35')]=_['map'](_0x4c5a74,_0xa403('0x30'));_0x5e5f8f[_0xa403('0x36')]=_[_0xa403('0x37')](_0xeaff68['query']);_0x5e5f8f[_0xa403('0x38')]=_[_0xa403('0x39')](_0x5e5f8f[_0xa403('0x35')],_0x5e5f8f['query']);_0x23be6b[_0xa403('0x3a')]=_[_0xa403('0x39')](_0x5e5f8f[_0xa403('0x35')],qs[_0xa403('0x3b')](_0xeaff68['query'][_0xa403('0x3b')]));_0x23be6b['attributes']=_0x23be6b[_0xa403('0x3a')]['length']?_0x23be6b[_0xa403('0x3a')]:_0x5e5f8f['model'];if(!_0xeaff68[_0xa403('0x36')]['hasOwnProperty']('nolimit')){_0x23be6b[_0xa403('0x26')]=qs[_0xa403('0x26')](_0xeaff68['query']['limit']);_0x23be6b['offset']=qs['offset'](_0xeaff68[_0xa403('0x36')]['offset']);}_0x23be6b[_0xa403('0x3c')]=qs[_0xa403('0x3d')](_0xeaff68[_0xa403('0x36')]['sort']);_0x23be6b[_0xa403('0x3e')]=qs['filters'](_[_0xa403('0x3f')](_0xeaff68[_0xa403('0x36')],_0x5e5f8f['filters']),_0x4c5a74);if(_0xeaff68[_0xa403('0x36')][_0xa403('0x40')]){_0x23be6b['where']=_[_0xa403('0x41')](_0x23be6b[_0xa403('0x3e')],{'$or':_['map'](_0x4c5a74,function(_0x3cb5f2){if(_0x3cb5f2[_0xa403('0x42')]!==_0xa403('0x43')){var _0x5818c8={};_0x5818c8[_0x3cb5f2[_0xa403('0x30')]]={'$like':'%'+_0xeaff68[_0xa403('0x36')][_0xa403('0x40')]+'%'};return _0x5818c8;}})});}_0x23be6b=_[_0xa403('0x41')]({},_0x23be6b,_0xeaff68['options']);var _0x53dc66={'where':_0x23be6b['where']};return db[_0xa403('0x32')][_0xa403('0x27')](_0x53dc66)[_0xa403('0x18')](function(_0xa1443c){_0x24156e[_0xa403('0x27')]=_0xa1443c;if(_0xeaff68[_0xa403('0x36')][_0xa403('0x44')]){_0x23be6b[_0xa403('0x45')]=[{'all':!![]}];}return db[_0xa403('0x32')][_0xa403('0x46')](_0x23be6b);})[_0xa403('0x18')](function(_0x5a71ff){_0x24156e[_0xa403('0x47')]=_0x5a71ff;return _0x24156e;})[_0xa403('0x18')](respondWithFilteredResult(_0x2aeaa1,_0x23be6b))[_0xa403('0x48')](handleError(_0x2aeaa1,null));};exports[_0xa403('0x49')]=function(_0x54b18c,_0x34201c){var _0x57ac15={'raw':![],'where':{'id':_0x54b18c[_0xa403('0x4a')]['id']}},_0x3c95b2={};_0x3c95b2[_0xa403('0x35')]=_[_0xa403('0x37')](db['VoiceContext']['rawAttributes']);_0x3c95b2['query']=_['keys'](_0x54b18c[_0xa403('0x36')]);_0x3c95b2[_0xa403('0x38')]=_[_0xa403('0x39')](_0x3c95b2[_0xa403('0x35')],_0x3c95b2[_0xa403('0x36')]);_0x57ac15[_0xa403('0x3a')]=_[_0xa403('0x39')](_0x3c95b2[_0xa403('0x35')],qs[_0xa403('0x3b')](_0x54b18c['query']['fields']));_0x57ac15[_0xa403('0x3a')]=_0x57ac15[_0xa403('0x3a')]['length']?_0x57ac15[_0xa403('0x3a')]:_0x3c95b2[_0xa403('0x35')];if(_0x54b18c['query'][_0xa403('0x44')]){_0x57ac15[_0xa403('0x45')]=[{'all':!![]}];}_0x57ac15=_[_0xa403('0x41')]({},_0x57ac15,_0x54b18c['options']);return db[_0xa403('0x32')]['find'](_0x57ac15)['then'](handleEntityNotFound(_0x34201c,null))['then'](respondWithResult(_0x34201c,null))[_0xa403('0x48')](handleError(_0x34201c,null));};exports[_0xa403('0x4b')]=function(_0xb5048c,_0x4f6783,_0x5b53e3){var _0x39e591;return db[_0xa403('0x32')]['create'](_0xb5048c['body'],{'raw':!![]})['then'](function(_0x21b0c3){_0x39e591=_0x21b0c3;return db[_0xa403('0x32')]['findAll']({'raw':!![]});})[_0xa403('0x18')](function(_0x1f9536){var _0x500968=fs[_0xa403('0x4c')](path[_0xa403('0x4d')](config[_0xa403('0x4e')],_0xa403('0x4f')),_0xa403('0x50'));var _0x13e2dd=ejs[_0xa403('0x51')](_0x500968,{'contexts':_0x1f9536||[]});fs[_0xa403('0x52')](_0xa403('0x53'),_0x13e2dd);})[_0xa403('0x18')](function(){return respondWithRpcPromise(_0xa403('0x54'),_0xa403('0x4b'),{'module':_0xa403('0x55')});})['then'](function(){var _0xe74320=_0xb5048c[_0xa403('0x56')]['get']({'plain':!![]});if(!_0xe74320)throw new Error(_0xa403('0x57'));if(_0xe74320['role']===_0xa403('0x56')){var _0x6d4c07=_0x39e591[_0xa403('0x2e')]({'plain':!![]});return db[_0xa403('0x58')][_0xa403('0x59')]({'where':{'name':_0xa403('0x5a'),'userProfileId':_0xe74320[_0xa403('0x5b')]},'raw':!![]})[_0xa403('0x18')](function(_0x24165c){if(_0x24165c&&_0x24165c[_0xa403('0x5c')]===0x0){return db[_0xa403('0x5d')][_0xa403('0x4b')]({'name':_0x6d4c07[_0xa403('0x30')],'resourceId':_0x6d4c07['id'],'type':_0x24165c[_0xa403('0x30')],'sectionId':_0x24165c['id']},{})[_0xa403('0x18')](function(){return _0x39e591;});}else{return _0x39e591;}})['catch'](function(_0x334cc8){logger[_0xa403('0x1d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x334cc8);throw _0x334cc8;});}return _0x39e591;})[_0xa403('0x18')](respondWithResult(_0x4f6783,0xc9))[_0xa403('0x48')](handleError(_0x4f6783,null));};exports[_0xa403('0x2d')]=function(_0x121864,_0x356484,_0x43a132){var _0x3d17ab;return db[_0xa403('0x32')]['find']({'where':{'id':_0x121864[_0xa403('0x4a')]['id']}})[_0xa403('0x18')](handleEntityNotFound(_0x356484,null))[_0xa403('0x18')](saveUpdates(_0x121864[_0xa403('0x5e')],null))['then'](function(_0x471e47){if(_0x471e47){_0x3d17ab=_0x471e47;return db[_0xa403('0x32')][_0xa403('0x46')]({'raw':!![]});}})['then'](function(_0x227715){var _0x1f68cb=fs[_0xa403('0x4c')](path[_0xa403('0x4d')](config[_0xa403('0x4e')],_0xa403('0x4f')),_0xa403('0x50'));var _0x4e4525=ejs[_0xa403('0x51')](_0x1f68cb,{'contexts':_0x227715||[]});fs[_0xa403('0x52')](_0xa403('0x53'),_0x4e4525);})[_0xa403('0x18')](function(){return respondWithRpcPromise('Reload','update',{'module':_0xa403('0x55')});})[_0xa403('0x18')](function(){return _0x3d17ab;})['then'](respondWithResult(_0x356484,null))[_0xa403('0x48')](handleError(_0x356484,null));};exports[_0xa403('0x2f')]=function(_0x42314e,_0x43379e,_0x265802){var _0x2d255a;return db[_0xa403('0x32')][_0xa403('0x59')]({'where':{'id':_0x42314e[_0xa403('0x4a')]['id']}})[_0xa403('0x18')](handleEntityNotFound(_0x43379e,null))[_0xa403('0x18')](removeEntity(_0x43379e,null))['then'](function(){return db[_0xa403('0x32')][_0xa403('0x46')]({'raw':!![]});})[_0xa403('0x18')](function(_0x65443c){var _0x1ad9a6=fs['readFileSync'](path[_0xa403('0x4d')](config['root'],_0xa403('0x4f')),_0xa403('0x50'));var _0x277038=ejs['render'](_0x1ad9a6,{'contexts':_0x65443c});fs[_0xa403('0x52')](_0xa403('0x53'),_0x277038);return respondWithRpcPromise('Reload',_0xa403('0x2f'),{'module':'chan_sip.so'});})[_0xa403('0x48')](handleError(_0x43379e,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index d734352..f290976 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 _0x8f21=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8f21,0x1ee));var _0x18f2=function(_0x1bc1dc,_0x5b6b90){_0x1bc1dc=_0x1bc1dc-0x0;var _0x6c89c8=_0x8f21[_0x1bc1dc];return _0x6c89c8;};'use strict';var _=require('lodash');var util=require(_0x18f2('0x0'));var logger=require(_0x18f2('0x1'))(_0x18f2('0x2'));var moment=require(_0x18f2('0x3'));var BPromise=require(_0x18f2('0x4'));var rp=require(_0x18f2('0x5'));var fs=require('fs');var path=require(_0x18f2('0x6'));var rimraf=require('rimraf');var config=require(_0x18f2('0x7'));var attributes=require(_0x18f2('0x8'));module[_0x18f2('0x9')]=function(_0x29c286,_0x282a0a){return _0x29c286[_0x18f2('0xa')](_0x18f2('0xb'),attributes,{'tableName':_0x18f2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a6b=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','VoiceContext'];(function(_0x36884e,_0x48008f){var _0x1cc367=function(_0x388a78){while(--_0x388a78){_0x36884e['push'](_0x36884e['shift']());}};_0x1cc367(++_0x48008f);}(_0x0a6b,0x120));var _0xb0a6=function(_0x53a6c0,_0x53df9a){_0x53a6c0=_0x53a6c0-0x0;var _0x30c452=_0x0a6b[_0x53a6c0];return _0x30c452;};'use strict';var _=require(_0xb0a6('0x0'));var util=require('util');var logger=require(_0xb0a6('0x1'))(_0xb0a6('0x2'));var moment=require(_0xb0a6('0x3'));var BPromise=require(_0xb0a6('0x4'));var rp=require(_0xb0a6('0x5'));var fs=require('fs');var path=require(_0xb0a6('0x6'));var rimraf=require(_0xb0a6('0x7'));var config=require(_0xb0a6('0x8'));var attributes=require(_0xb0a6('0x9'));module[_0xb0a6('0xa')]=function(_0x4b47bc,_0x30b3b7){return _0x4b47bc['define'](_0xb0a6('0xb'),attributes,{'tableName':'voice_contexts','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 c77f703..7fa8063 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 _0xde1e=['client','request','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x21e4bb,_0x10691d){var _0x2a7639=function(_0x2820de){while(--_0x2820de){_0x21e4bb['push'](_0x21e4bb['shift']());}};_0x2a7639(++_0x10691d);}(_0xde1e,0x9d));var _0xede1=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xde1e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xede1('0x0'));var util=require(_0xede1('0x1'));var moment=require(_0xede1('0x2'));var BPromise=require(_0xede1('0x3'));var rs=require(_0xede1('0x4'));var fs=require('fs');var Redis=require(_0xede1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xede1('0x6'));var logger=require(_0xede1('0x7'))(_0xede1('0x8'));var config=require(_0xede1('0x9'));var jayson=require(_0xede1('0xa'));var client=jayson[_0xede1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a4671,_0xeeec58,_0x1722c9){return new BPromise(function(_0x452e74,_0x29fe67){return client[_0xede1('0xc')](_0x3a4671,_0x1722c9)['then'](function(_0xa1641){logger['info']('VoiceContext,\x20%s,\x20%s',_0xeeec58,_0xede1('0xd'));logger[_0xede1('0xe')](_0xede1('0xf'),_0xeeec58,_0xede1('0xd'),JSON[_0xede1('0x10')](_0xa1641));if(_0xa1641[_0xede1('0x11')]){if(_0xa1641['error'][_0xede1('0x12')]===0x1f4){logger[_0xede1('0x11')](_0xede1('0x13'),_0xeeec58,_0xa1641['error']['message']);return _0x29fe67(_0xa1641[_0xede1('0x11')][_0xede1('0x14')]);}logger[_0xede1('0x11')](_0xede1('0x13'),_0xeeec58,_0xa1641[_0xede1('0x11')]['message']);return _0x452e74(_0xa1641[_0xede1('0x11')][_0xede1('0x14')]);}else{logger[_0xede1('0x15')](_0xede1('0x13'),_0xeeec58,_0xede1('0xd'));_0x452e74(_0xa1641[_0xede1('0x16')][_0xede1('0x14')]);}})[_0xede1('0x17')](function(_0x5648fb){logger[_0xede1('0x11')](_0xede1('0x13'),_0xeeec58,_0x5648fb);_0x29fe67(_0x5648fb);});});} \ No newline at end of file +var _0x28f2=['debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x362f6a,_0x3bd6b4){var _0x366640=function(_0x253c78){while(--_0x253c78){_0x362f6a['push'](_0x362f6a['shift']());}};_0x366640(++_0x3bd6b4);}(_0x28f2,0x193));var _0x228f=function(_0x9e3d59,_0x5b3961){_0x9e3d59=_0x9e3d59-0x0;var _0x684082=_0x28f2[_0x9e3d59];return _0x684082;};'use strict';var _=require(_0x228f('0x0'));var util=require(_0x228f('0x1'));var moment=require(_0x228f('0x2'));var BPromise=require(_0x228f('0x3'));var rs=require(_0x228f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x228f('0x5'))['db'];var utils=require(_0x228f('0x6'));var logger=require(_0x228f('0x7'))(_0x228f('0x8'));var config=require(_0x228f('0x9'));var jayson=require(_0x228f('0xa'));var client=jayson[_0x228f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10da58,_0x4a4a44,_0x3ca074){return new BPromise(function(_0x455eb6,_0xf4b011){return client['request'](_0x10da58,_0x3ca074)[_0x228f('0xc')](function(_0x4d0038){logger[_0x228f('0xd')](_0x228f('0xe'),_0x4a4a44,'request\x20sent');logger[_0x228f('0xf')](_0x228f('0x10'),_0x4a4a44,_0x228f('0x11'),JSON[_0x228f('0x12')](_0x4d0038));if(_0x4d0038[_0x228f('0x13')]){if(_0x4d0038['error'][_0x228f('0x14')]===0x1f4){logger[_0x228f('0x13')](_0x228f('0xe'),_0x4a4a44,_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);return _0xf4b011(_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);}logger[_0x228f('0x13')]('VoiceContext,\x20%s,\x20%s',_0x4a4a44,_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);return _0x455eb6(_0x4d0038[_0x228f('0x13')][_0x228f('0x15')]);}else{logger[_0x228f('0xd')](_0x228f('0xe'),_0x4a4a44,_0x228f('0x11'));_0x455eb6(_0x4d0038['result'][_0x228f('0x15')]);}})['catch'](function(_0x20e687){logger[_0x228f('0x13')](_0x228f('0xe'),_0x4a4a44,_0x20e687);_0xf4b011(_0x20e687);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 87ce23c..8160c76 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 _0x20ce=['../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4e9ad8,_0x3f31e8){var _0x1ca422=function(_0x6572b3){while(--_0x6572b3){_0x4e9ad8['push'](_0x4e9ad8['shift']());}};_0x1ca422(++_0x3f31e8);}(_0x20ce,0x10d));var _0xe20c=function(_0x261fc2,_0x3dc913){_0x261fc2=_0x261fc2-0x0;var _0x36e855=_0x20ce[_0x261fc2];return _0x36e855;};'use strict';var multer=require(_0xe20c('0x0'));var util=require(_0xe20c('0x1'));var path=require(_0xe20c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe20c('0x3'));var router=express[_0xe20c('0x4')]();var fs_extra=require(_0xe20c('0x5'));var auth=require(_0xe20c('0x6'));var interaction=require(_0xe20c('0x7'));var config=require(_0xe20c('0x8'));var controller=require(_0xe20c('0x9'));router[_0xe20c('0xa')]('/',auth[_0xe20c('0xb')](),controller[_0xe20c('0xc')]);router[_0xe20c('0xa')](_0xe20c('0xd'),auth[_0xe20c('0xb')](),controller[_0xe20c('0xe')]);router[_0xe20c('0xa')](_0xe20c('0xf'),auth[_0xe20c('0xb')](),controller[_0xe20c('0x10')]);router[_0xe20c('0x11')]('/',auth[_0xe20c('0xb')](),controller[_0xe20c('0x12')]);router[_0xe20c('0x13')](_0xe20c('0xf'),auth[_0xe20c('0xb')](),controller['update']);router[_0xe20c('0x14')](_0xe20c('0xf'),auth[_0xe20c('0xb')](),controller[_0xe20c('0x15')]);module[_0xe20c('0x16')]=router; \ No newline at end of file +var _0x2b55=['index','/describe','isAuthenticated','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get'];(function(_0x4126c4,_0x229bca){var _0x58a833=function(_0x1aabed){while(--_0x1aabed){_0x4126c4['push'](_0x4126c4['shift']());}};_0x58a833(++_0x229bca);}(_0x2b55,0x1f0));var _0x52b5=function(_0x2ea97c,_0x1455fe){_0x2ea97c=_0x2ea97c-0x0;var _0x35dcd6=_0x2b55[_0x2ea97c];return _0x35dcd6;};'use strict';var multer=require(_0x52b5('0x0'));var util=require(_0x52b5('0x1'));var path=require(_0x52b5('0x2'));var timeout=require('connect-timeout');var express=require(_0x52b5('0x3'));var router=express[_0x52b5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x52b5('0x5'));var interaction=require(_0x52b5('0x6'));var config=require(_0x52b5('0x7'));var controller=require(_0x52b5('0x8'));router[_0x52b5('0x9')]('/',auth['isAuthenticated'](),controller[_0x52b5('0xa')]);router[_0x52b5('0x9')](_0x52b5('0xb'),auth[_0x52b5('0xc')](),controller[_0x52b5('0xd')]);router[_0x52b5('0x9')](_0x52b5('0xe'),auth[_0x52b5('0xc')](),controller[_0x52b5('0xf')]);router[_0x52b5('0x10')]('/',auth[_0x52b5('0xc')](),controller[_0x52b5('0x11')]);router[_0x52b5('0x12')](_0x52b5('0xe'),auth[_0x52b5('0xc')](),controller['update']);router[_0x52b5('0x13')](_0x52b5('0xe'),auth['isAuthenticated'](),controller[_0x52b5('0x14')]);module[_0x52b5('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 0b7520a..e70d281 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 _0x8ef6=['INTEGER','DATE','sequelize','exports','STRING'];(function(_0x96ad7d,_0x1017ba){var _0x32d63a=function(_0xb47ad9){while(--_0xb47ad9){_0x96ad7d['push'](_0x96ad7d['shift']());}};_0x32d63a(++_0x1017ba);}(_0x8ef6,0xf2));var _0x68ef=function(_0x3b9bdd,_0x2da84d){_0x3b9bdd=_0x3b9bdd-0x0;var _0x54bd6e=_0x8ef6[_0x3b9bdd];return _0x54bd6e;};'use strict';var Sequelize=require(_0x68ef('0x0'));module[_0x68ef('0x1')]={'privilege':{'type':Sequelize[_0x68ef('0x2')]},'channel':{'type':Sequelize[_0x68ef('0x2')]},'channelstate':{'type':Sequelize[_0x68ef('0x3')]},'channelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'calleridnum':{'type':Sequelize[_0x68ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'connectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'language':{'type':Sequelize[_0x68ef('0x2')]},'accountcode':{'type':Sequelize[_0x68ef('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x68ef('0x3')]},'uniqueid':{'type':Sequelize[_0x68ef('0x2')]},'linkedid':{'type':Sequelize[_0x68ef('0x2')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x68ef('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridnum':{'type':Sequelize[_0x68ef('0x2')]},'destcalleridname':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x68ef('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x68ef('0x2')]},'destlanguage':{'type':Sequelize[_0x68ef('0x2')]},'destaccountcode':{'type':Sequelize[_0x68ef('0x2')]},'destcontext':{'type':Sequelize[_0x68ef('0x2')]},'destexten':{'type':Sequelize[_0x68ef('0x2')]},'destpriority':{'type':Sequelize[_0x68ef('0x3')]},'destuniqueid':{'type':Sequelize[_0x68ef('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x68ef('0x2')]},'dialstatus':{'type':Sequelize[_0x68ef('0x2')]},'starttime':{'type':Sequelize[_0x68ef('0x4')]},'answertime':{'type':Sequelize[_0x68ef('0x4')]},'endtime':{'type':Sequelize[_0x68ef('0x4')]},'lastevent':{'type':Sequelize[_0x68ef('0x2')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x68ef('0x3')]},'duration':{'type':Sequelize[_0x68ef('0x3')]},'holdtime':{'type':Sequelize[_0x68ef('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x3e74=['DATE','sequelize','STRING','INTEGER'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x3e74,0x175));var _0x43e7=function(_0x1a8854,_0x367f85){_0x1a8854=_0x1a8854-0x0;var _0x341fef=_0x3e74[_0x1a8854];return _0x341fef;};'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 750c074..edcc7a2 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 _0x21cc=['api','../../config/license/util','../../mysqldb','end','json','offset','undefined','limit','status','set','apply','reject','save','then','error','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','rows','catch','show','params','keys','find','create','body','update','destroy','describe','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x13cf7a,_0x479809){var _0x5cb678=function(_0x267d4a){while(--_0x267d4a){_0x13cf7a['push'](_0x13cf7a['shift']());}};_0x5cb678(++_0x479809);}(_0x21cc,0x14f));var _0xc21c=function(_0x1b02c4,_0x1bb19b){_0x1b02c4=_0x1b02c4-0x0;var _0x56713c=_0x21cc[_0x1b02c4];return _0x56713c;};'use strict';var emlformat=require(_0xc21c('0x0'));var rimraf=require(_0xc21c('0x1'));var zipdir=require(_0xc21c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc21c('0x3'));var BPromise=require(_0xc21c('0x4'));var Mustache=require(_0xc21c('0x5'));var util=require('util');var path=require(_0xc21c('0x6'));var sox=require(_0xc21c('0x7'));var csv=require(_0xc21c('0x8'));var ejs=require(_0xc21c('0x9'));var fs=require('fs');var fs_extra=require(_0xc21c('0xa'));var _=require(_0xc21c('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc21c('0xc'));var deskjs=require(_0xc21c('0xd'));var toCsv=require(_0xc21c('0x8'));var querystring=require(_0xc21c('0xe'));var Papa=require(_0xc21c('0xf'));var Redis=require('ioredis');var authService=require(_0xc21c('0x10'));var qs=require(_0xc21c('0x11'));var as=require(_0xc21c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc21c('0x13'))(_0xc21c('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc21c('0x15'));var db=require(_0xc21c('0x16'))['db'];function respondWithStatusCode(_0x492c73,_0x1004a7){_0x1004a7=_0x1004a7||0xcc;return function(_0x572f58){if(_0x572f58){return _0x492c73['sendStatus'](_0x1004a7);}return _0x492c73['status'](_0x1004a7)[_0xc21c('0x17')]();};}function respondWithResult(_0x365c71,_0x328d70){_0x328d70=_0x328d70||0xc8;return function(_0x490c90){if(_0x490c90){return _0x365c71['status'](_0x328d70)[_0xc21c('0x18')](_0x490c90);}};}function respondWithFilteredResult(_0x51a8ad,_0x141381){return function(_0x3cce43){if(_0x3cce43){var _0x1a111f=typeof _0x141381[_0xc21c('0x19')]===_0xc21c('0x1a')&&typeof _0x141381[_0xc21c('0x1b')]===_0xc21c('0x1a');var _0x5708f2=_0x3cce43['count'];var _0x43421b=_0x1a111f?0x0:_0x141381['offset'];var _0x41148d=_0x1a111f?_0x3cce43['count']:_0x141381[_0xc21c('0x19')]+_0x141381[_0xc21c('0x1b')];var _0x3f674f;if(_0x41148d>=_0x5708f2){_0x41148d=_0x5708f2;_0x3f674f=0xc8;}else{_0x3f674f=0xce;}_0x51a8ad[_0xc21c('0x1c')](_0x3f674f);return _0x51a8ad[_0xc21c('0x1d')]('Content-Range',_0x43421b+'-'+_0x41148d+'/'+_0x5708f2)[_0xc21c('0x18')](_0x3cce43);}return null;};}function patchUpdates(_0x59b878){return function(_0x1f1f5f){try{jsonpatch[_0xc21c('0x1e')](_0x1f1f5f,_0x59b878,!![]);}catch(_0xad3e51){return BPromise[_0xc21c('0x1f')](_0xad3e51);}return _0x1f1f5f[_0xc21c('0x20')]();};}function saveUpdates(_0x753a73,_0x32c309){return function(_0x15399f){if(_0x15399f){return _0x15399f['update'](_0x753a73)[_0xc21c('0x21')](function(_0x3061a3){return _0x3061a3;});}return null;};}function removeEntity(_0x46e7d7,_0xa1903c){return function(_0x839c67){if(_0x839c67){return _0x839c67['destroy']()[_0xc21c('0x21')](function(){_0x46e7d7['status'](0xcc)[_0xc21c('0x17')]();});}};}function handleEntityNotFound(_0x11f95b,_0x4180d0){return function(_0x2b19c4){if(!_0x2b19c4){_0x11f95b['sendStatus'](0x194);}return _0x2b19c4;};}function handleError(_0xd3ccd4,_0x1c9828){_0x1c9828=_0x1c9828||0x1f4;return function(_0x787ad8){logger[_0xc21c('0x22')](_0x787ad8['stack']);if(_0x787ad8['name']){delete _0x787ad8[_0xc21c('0x23')];}_0xd3ccd4[_0xc21c('0x1c')](_0x1c9828)[_0xc21c('0x24')](_0x787ad8);};}exports[_0xc21c('0x25')]=function(_0xdfb644,_0x17b3f0){var _0x7b47ae={},_0x36651a={},_0x118c60={'count':0x0,'rows':[]};var _0x2a936f=_[_0xc21c('0x26')](db[_0xc21c('0x27')][_0xc21c('0x28')],function(_0x247396){return{'name':_0x247396[_0xc21c('0x29')],'type':_0x247396[_0xc21c('0x2a')]['key']};});_0x36651a[_0xc21c('0x2b')]=_['map'](_0x2a936f,'name');_0x36651a['query']=_['keys'](_0xdfb644[_0xc21c('0x2c')]);_0x36651a['filters']=_[_0xc21c('0x2d')](_0x36651a[_0xc21c('0x2b')],_0x36651a[_0xc21c('0x2c')]);_0x7b47ae[_0xc21c('0x2e')]=_[_0xc21c('0x2d')](_0x36651a[_0xc21c('0x2b')],qs[_0xc21c('0x2f')](_0xdfb644[_0xc21c('0x2c')][_0xc21c('0x2f')]));_0x7b47ae['attributes']=_0x7b47ae[_0xc21c('0x2e')][_0xc21c('0x30')]?_0x7b47ae[_0xc21c('0x2e')]:_0x36651a[_0xc21c('0x2b')];if(!_0xdfb644['query']['hasOwnProperty']('nolimit')){_0x7b47ae[_0xc21c('0x1b')]=qs[_0xc21c('0x1b')](_0xdfb644[_0xc21c('0x2c')][_0xc21c('0x1b')]);_0x7b47ae['offset']=qs['offset'](_0xdfb644[_0xc21c('0x2c')]['offset']);}_0x7b47ae['order']=qs[_0xc21c('0x31')](_0xdfb644[_0xc21c('0x2c')][_0xc21c('0x31')]);_0x7b47ae[_0xc21c('0x32')]=qs[_0xc21c('0x33')](_[_0xc21c('0x34')](_0xdfb644[_0xc21c('0x2c')],_0x36651a[_0xc21c('0x33')]),_0x2a936f);if(_0xdfb644[_0xc21c('0x2c')]['filter']){_0x7b47ae[_0xc21c('0x32')]=_[_0xc21c('0x35')](_0x7b47ae['where'],{'$or':_[_0xc21c('0x26')](_0x2a936f,function(_0x1f6287){if(_0x1f6287[_0xc21c('0x2a')]!==_0xc21c('0x36')){var _0x1e3343={};_0x1e3343[_0x1f6287[_0xc21c('0x23')]]={'$like':'%'+_0xdfb644[_0xc21c('0x2c')][_0xc21c('0x37')]+'%'};return _0x1e3343;}})});}_0x7b47ae=_[_0xc21c('0x35')]({},_0x7b47ae,_0xdfb644[_0xc21c('0x38')]);var _0x3f89cf={'where':_0x7b47ae[_0xc21c('0x32')]};return db['VoiceDialReport'][_0xc21c('0x39')](_0x3f89cf)[_0xc21c('0x21')](function(_0x5af17d){_0x118c60[_0xc21c('0x39')]=_0x5af17d;if(_0xdfb644[_0xc21c('0x2c')][_0xc21c('0x3a')]){_0x7b47ae[_0xc21c('0x3b')]=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x7b47ae);})[_0xc21c('0x21')](function(_0x572149){_0x118c60[_0xc21c('0x3c')]=_0x572149;return _0x118c60;})['then'](respondWithFilteredResult(_0x17b3f0,_0x7b47ae))[_0xc21c('0x3d')](handleError(_0x17b3f0,null));};exports[_0xc21c('0x3e')]=function(_0x96e291,_0x240950){var _0x20f1b3={'raw':!![],'where':{'id':_0x96e291[_0xc21c('0x3f')]['id']}},_0x7657c9={};_0x7657c9[_0xc21c('0x2b')]=_[_0xc21c('0x40')](db[_0xc21c('0x27')][_0xc21c('0x28')]);_0x7657c9[_0xc21c('0x2c')]=_['keys'](_0x96e291[_0xc21c('0x2c')]);_0x7657c9[_0xc21c('0x33')]=_['intersection'](_0x7657c9[_0xc21c('0x2b')],_0x7657c9['query']);_0x20f1b3[_0xc21c('0x2e')]=_[_0xc21c('0x2d')](_0x7657c9[_0xc21c('0x2b')],qs[_0xc21c('0x2f')](_0x96e291[_0xc21c('0x2c')]['fields']));_0x20f1b3[_0xc21c('0x2e')]=_0x20f1b3[_0xc21c('0x2e')][_0xc21c('0x30')]?_0x20f1b3[_0xc21c('0x2e')]:_0x7657c9[_0xc21c('0x2b')];if(_0x96e291['query']['includeAll']){_0x20f1b3['include']=[{'all':!![]}];}_0x20f1b3=_[_0xc21c('0x35')]({},_0x20f1b3,_0x96e291[_0xc21c('0x38')]);return db['VoiceDialReport'][_0xc21c('0x41')](_0x20f1b3)['then'](handleEntityNotFound(_0x240950,null))[_0xc21c('0x21')](respondWithResult(_0x240950,null))['catch'](handleError(_0x240950,null));};exports[_0xc21c('0x42')]=function(_0x53785d,_0x588216){return db[_0xc21c('0x27')][_0xc21c('0x42')](_0x53785d[_0xc21c('0x43')],{})[_0xc21c('0x21')](respondWithResult(_0x588216,0xc9))[_0xc21c('0x3d')](handleError(_0x588216,null));};exports[_0xc21c('0x44')]=function(_0x3228ef,_0x2f01e2){if(_0x3228ef[_0xc21c('0x43')]['id']){delete _0x3228ef['body']['id'];}return db['VoiceDialReport'][_0xc21c('0x41')]({'where':{'id':_0x3228ef['params']['id']}})[_0xc21c('0x21')](handleEntityNotFound(_0x2f01e2,null))[_0xc21c('0x21')](saveUpdates(_0x3228ef[_0xc21c('0x43')],null))[_0xc21c('0x21')](respondWithResult(_0x2f01e2,null))['catch'](handleError(_0x2f01e2,null));};exports[_0xc21c('0x45')]=function(_0x5c43cd,_0xe1c740){return db[_0xc21c('0x27')]['find']({'where':{'id':_0x5c43cd[_0xc21c('0x3f')]['id']}})[_0xc21c('0x21')](handleEntityNotFound(_0xe1c740,null))[_0xc21c('0x21')](removeEntity(_0xe1c740,null))[_0xc21c('0x3d')](handleError(_0xe1c740,null));};exports[_0xc21c('0x46')]=function(_0x19f646,_0x1abdc4){return db[_0xc21c('0x27')]['describe']()['then'](respondWithResult(_0x1abdc4,null))[_0xc21c('0x3d')](handleError(_0x1abdc4,null));}; \ No newline at end of file +var _0x42c3=['status','json','offset','undefined','limit','Content-Range','reject','save','update','destroy','then','error','stack','name','VoiceDialReport','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','path','sox','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus'];(function(_0x389f40,_0x13c234){var _0x41a331=function(_0x1edece){while(--_0x1edece){_0x389f40['push'](_0x389f40['shift']());}};_0x41a331(++_0x13c234);}(_0x42c3,0x188));var _0x342c=function(_0x205400,_0x2609d1){_0x205400=_0x205400-0x0;var _0x36c821=_0x42c3[_0x205400];return _0x36c821;};'use strict';var emlformat=require(_0x342c('0x0'));var rimraf=require(_0x342c('0x1'));var zipdir=require(_0x342c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x342c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x342c('0x4'));var util=require('util');var path=require(_0x342c('0x5'));var sox=require(_0x342c('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x342c('0x7'));var squel=require(_0x342c('0x8'));var crypto=require(_0x342c('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x342c('0xa'));var querystring=require(_0x342c('0xb'));var Papa=require(_0x342c('0xc'));var Redis=require(_0x342c('0xd'));var authService=require(_0x342c('0xe'));var qs=require(_0x342c('0xf'));var as=require(_0x342c('0x10'));var hardwareService=require(_0x342c('0x11'));var logger=require('../../config/logger')(_0x342c('0x12'));var utils=require(_0x342c('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x342c('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2610d0,_0x48cef0){_0x48cef0=_0x48cef0||0xcc;return function(_0x2df3c6){if(_0x2df3c6){return _0x2610d0[_0x342c('0x15')](_0x48cef0);}return _0x2610d0['status'](_0x48cef0)['end']();};}function respondWithResult(_0x583ae0,_0x268fc9){_0x268fc9=_0x268fc9||0xc8;return function(_0x290cfe){if(_0x290cfe){return _0x583ae0[_0x342c('0x16')](_0x268fc9)[_0x342c('0x17')](_0x290cfe);}};}function respondWithFilteredResult(_0x2a09e7,_0x2e1b4c){return function(_0x5cadaa){if(_0x5cadaa){var _0x1f6c00=typeof _0x2e1b4c[_0x342c('0x18')]===_0x342c('0x19')&&typeof _0x2e1b4c[_0x342c('0x1a')]===_0x342c('0x19');var _0xd4c25a=_0x5cadaa['count'];var _0x3e85a7=_0x1f6c00?0x0:_0x2e1b4c[_0x342c('0x18')];var _0x28c1ec=_0x1f6c00?_0x5cadaa['count']:_0x2e1b4c[_0x342c('0x18')]+_0x2e1b4c[_0x342c('0x1a')];var _0x2924bf;if(_0x28c1ec>=_0xd4c25a){_0x28c1ec=_0xd4c25a;_0x2924bf=0xc8;}else{_0x2924bf=0xce;}_0x2a09e7[_0x342c('0x16')](_0x2924bf);return _0x2a09e7['set'](_0x342c('0x1b'),_0x3e85a7+'-'+_0x28c1ec+'/'+_0xd4c25a)[_0x342c('0x17')](_0x5cadaa);}return null;};}function patchUpdates(_0x5eb02a){return function(_0x48978f){try{jsonpatch['apply'](_0x48978f,_0x5eb02a,!![]);}catch(_0x4931c0){return BPromise[_0x342c('0x1c')](_0x4931c0);}return _0x48978f[_0x342c('0x1d')]();};}function saveUpdates(_0x248a79,_0x277544){return function(_0x53ff1d){if(_0x53ff1d){return _0x53ff1d[_0x342c('0x1e')](_0x248a79)['then'](function(_0x26620c){return _0x26620c;});}return null;};}function removeEntity(_0x23613b,_0x5a02f8){return function(_0x1190ee){if(_0x1190ee){return _0x1190ee[_0x342c('0x1f')]()[_0x342c('0x20')](function(){_0x23613b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3577ec,_0x48bf35){return function(_0x5cac7d){if(!_0x5cac7d){_0x3577ec['sendStatus'](0x194);}return _0x5cac7d;};}function handleError(_0x3f7a5c,_0x172d0e){_0x172d0e=_0x172d0e||0x1f4;return function(_0xb5a41b){logger[_0x342c('0x21')](_0xb5a41b[_0x342c('0x22')]);if(_0xb5a41b[_0x342c('0x23')]){delete _0xb5a41b['name'];}_0x3f7a5c[_0x342c('0x16')](_0x172d0e)['send'](_0xb5a41b);};}exports['index']=function(_0x2dab17,_0x1fdae2){var _0x2ea295={},_0x43198f={},_0x35ec67={'count':0x0,'rows':[]};var _0x4ae82d=_['map'](db[_0x342c('0x24')]['rawAttributes'],function(_0x534449){return{'name':_0x534449['fieldName'],'type':_0x534449[_0x342c('0x25')][_0x342c('0x26')]};});_0x43198f[_0x342c('0x27')]=_[_0x342c('0x28')](_0x4ae82d,_0x342c('0x23'));_0x43198f[_0x342c('0x29')]=_['keys'](_0x2dab17['query']);_0x43198f['filters']=_[_0x342c('0x2a')](_0x43198f[_0x342c('0x27')],_0x43198f[_0x342c('0x29')]);_0x2ea295[_0x342c('0x2b')]=_['intersection'](_0x43198f[_0x342c('0x27')],qs[_0x342c('0x2c')](_0x2dab17['query'][_0x342c('0x2c')]));_0x2ea295[_0x342c('0x2b')]=_0x2ea295[_0x342c('0x2b')][_0x342c('0x2d')]?_0x2ea295[_0x342c('0x2b')]:_0x43198f[_0x342c('0x27')];if(!_0x2dab17['query'][_0x342c('0x2e')]('nolimit')){_0x2ea295[_0x342c('0x1a')]=qs[_0x342c('0x1a')](_0x2dab17[_0x342c('0x29')][_0x342c('0x1a')]);_0x2ea295[_0x342c('0x18')]=qs[_0x342c('0x18')](_0x2dab17[_0x342c('0x29')]['offset']);}_0x2ea295[_0x342c('0x2f')]=qs[_0x342c('0x30')](_0x2dab17[_0x342c('0x29')][_0x342c('0x30')]);_0x2ea295['where']=qs[_0x342c('0x31')](_[_0x342c('0x32')](_0x2dab17[_0x342c('0x29')],_0x43198f[_0x342c('0x31')]),_0x4ae82d);if(_0x2dab17[_0x342c('0x29')][_0x342c('0x33')]){_0x2ea295['where']=_['merge'](_0x2ea295[_0x342c('0x34')],{'$or':_[_0x342c('0x28')](_0x4ae82d,function(_0x367466){if(_0x367466[_0x342c('0x25')]!==_0x342c('0x35')){var _0x365692={};_0x365692[_0x367466[_0x342c('0x23')]]={'$like':'%'+_0x2dab17[_0x342c('0x29')]['filter']+'%'};return _0x365692;}})});}_0x2ea295=_[_0x342c('0x36')]({},_0x2ea295,_0x2dab17[_0x342c('0x37')]);var _0x30898e={'where':_0x2ea295[_0x342c('0x34')]};return db['VoiceDialReport']['count'](_0x30898e)['then'](function(_0x225fa1){_0x35ec67[_0x342c('0x38')]=_0x225fa1;if(_0x2dab17[_0x342c('0x29')][_0x342c('0x39')]){_0x2ea295[_0x342c('0x3a')]=[{'all':!![]}];}return db[_0x342c('0x24')]['findAll'](_0x2ea295);})['then'](function(_0x216661){_0x35ec67[_0x342c('0x3b')]=_0x216661;return _0x35ec67;})['then'](respondWithFilteredResult(_0x1fdae2,_0x2ea295))[_0x342c('0x3c')](handleError(_0x1fdae2,null));};exports[_0x342c('0x3d')]=function(_0x30d49c,_0x2a96ee){var _0x35973c={'raw':!![],'where':{'id':_0x30d49c[_0x342c('0x3e')]['id']}},_0x407f6f={};_0x407f6f[_0x342c('0x27')]=_[_0x342c('0x3f')](db[_0x342c('0x24')][_0x342c('0x40')]);_0x407f6f[_0x342c('0x29')]=_[_0x342c('0x3f')](_0x30d49c[_0x342c('0x29')]);_0x407f6f['filters']=_['intersection'](_0x407f6f[_0x342c('0x27')],_0x407f6f[_0x342c('0x29')]);_0x35973c['attributes']=_[_0x342c('0x2a')](_0x407f6f[_0x342c('0x27')],qs[_0x342c('0x2c')](_0x30d49c['query']['fields']));_0x35973c['attributes']=_0x35973c['attributes'][_0x342c('0x2d')]?_0x35973c[_0x342c('0x2b')]:_0x407f6f['model'];if(_0x30d49c[_0x342c('0x29')][_0x342c('0x39')]){_0x35973c['include']=[{'all':!![]}];}_0x35973c=_['merge']({},_0x35973c,_0x30d49c[_0x342c('0x37')]);return db[_0x342c('0x24')][_0x342c('0x41')](_0x35973c)[_0x342c('0x20')](handleEntityNotFound(_0x2a96ee,null))[_0x342c('0x20')](respondWithResult(_0x2a96ee,null))['catch'](handleError(_0x2a96ee,null));};exports[_0x342c('0x42')]=function(_0x41d1ba,_0x26c445){return db['VoiceDialReport'][_0x342c('0x42')](_0x41d1ba[_0x342c('0x43')],{})[_0x342c('0x20')](respondWithResult(_0x26c445,0xc9))[_0x342c('0x3c')](handleError(_0x26c445,null));};exports['update']=function(_0x41c6d1,_0x18a418){if(_0x41c6d1[_0x342c('0x43')]['id']){delete _0x41c6d1['body']['id'];}return db[_0x342c('0x24')][_0x342c('0x41')]({'where':{'id':_0x41c6d1[_0x342c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x18a418,null))[_0x342c('0x20')](saveUpdates(_0x41c6d1[_0x342c('0x43')],null))[_0x342c('0x20')](respondWithResult(_0x18a418,null))[_0x342c('0x3c')](handleError(_0x18a418,null));};exports[_0x342c('0x1f')]=function(_0x4f4167,_0x47bc1a){return db[_0x342c('0x24')][_0x342c('0x41')]({'where':{'id':_0x4f4167[_0x342c('0x3e')]['id']}})['then'](handleEntityNotFound(_0x47bc1a,null))[_0x342c('0x20')](removeEntity(_0x47bc1a,null))[_0x342c('0x3c')](handleError(_0x47bc1a,null));};exports['describe']=function(_0x37934b,_0x3904ed){return db[_0x342c('0x24')][_0x342c('0x44')]()[_0x342c('0x20')](respondWithResult(_0x3904ed,null))[_0x342c('0x3c')](handleError(_0x3904ed,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index efb7f63..f6ef7e9 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 _0xa7ee=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceDialReport.attributes','exports','define','report_dial','uniqueid','lodash','util','../../config/logger','api'];(function(_0xea1570,_0x2f7856){var _0x579e74=function(_0x236bcc){while(--_0x236bcc){_0xea1570['push'](_0xea1570['shift']());}};_0x579e74(++_0x2f7856);}(_0xa7ee,0x119));var _0xea7e=function(_0x24e0c9,_0x284109){_0x24e0c9=_0x24e0c9-0x0;var _0x4448f0=_0xa7ee[_0x24e0c9];return _0x4448f0;};'use strict';var _=require(_0xea7e('0x0'));var util=require(_0xea7e('0x1'));var logger=require(_0xea7e('0x2'))(_0xea7e('0x3'));var moment=require(_0xea7e('0x4'));var BPromise=require(_0xea7e('0x5'));var rp=require(_0xea7e('0x6'));var fs=require('fs');var path=require(_0xea7e('0x7'));var rimraf=require(_0xea7e('0x8'));var config=require(_0xea7e('0x9'));var attributes=require(_0xea7e('0xa'));module[_0xea7e('0xb')]=function(_0xc6b99d,_0x3d9e5e){return _0xc6b99d[_0xea7e('0xc')]('VoiceDialReport',attributes,{'tableName':_0xea7e('0xd'),'paranoid':![],'indexes':[{'fields':[_0xea7e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x661c=['./voiceDialReport.attributes','exports','define','report_dial','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3825a1,_0x3bd010){var _0x4790d8=function(_0x38c6c7){while(--_0x38c6c7){_0x3825a1['push'](_0x3825a1['shift']());}};_0x4790d8(++_0x3bd010);}(_0x661c,0x122));var _0xc661=function(_0x4e7d25,_0x58285f){_0x4e7d25=_0x4e7d25-0x0;var _0x526fe6=_0x661c[_0x4e7d25];return _0x526fe6;};'use strict';var _=require(_0xc661('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc661('0x1'));var moment=require('moment');var BPromise=require(_0xc661('0x2'));var rp=require(_0xc661('0x3'));var fs=require('fs');var path=require(_0xc661('0x4'));var rimraf=require(_0xc661('0x5'));var config=require(_0xc661('0x6'));var attributes=require(_0xc661('0x7'));module[_0xc661('0x8')]=function(_0x502716,_0x4de875){return _0x502716[_0xc661('0x9')]('VoiceDialReport',attributes,{'tableName':_0xc661('0xa'),'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 27d5af0..3c31784 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 _0xba1b=['util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','then','CreateVoiceDialReport','UpdateVoiceDialReport','VoiceDialReport','update','attributes','lodash'];(function(_0x517525,_0x1252cb){var _0x5f1f0e=function(_0xb27622){while(--_0xb27622){_0x517525['push'](_0x517525['shift']());}};_0x5f1f0e(++_0x1252cb);}(_0xba1b,0x1c1));var _0xbba1=function(_0x52193f,_0x334e81){_0x52193f=_0x52193f-0x0;var _0x92d38f=_0xba1b[_0x52193f];return _0x92d38f;};'use strict';var _=require(_0xbba1('0x0'));var util=require(_0xbba1('0x1'));var moment=require('moment');var BPromise=require(_0xbba1('0x2'));var rs=require(_0xbba1('0x3'));var fs=require('fs');var Redis=require(_0xbba1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbba1('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbba1('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbba1('0x7')][_0xbba1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa0ec7c,_0xb54beb,_0x3b6df6){return new BPromise(function(_0x2ba9ce,_0x35ce33){return client['request'](_0xa0ec7c,_0x3b6df6)['then'](function(_0x1b9b4b){logger[_0xbba1('0x9')](_0xbba1('0xa'),_0xb54beb,_0xbba1('0xb'));logger[_0xbba1('0xc')](_0xbba1('0xd'),_0xb54beb,_0xbba1('0xb'),JSON[_0xbba1('0xe')](_0x1b9b4b));if(_0x1b9b4b[_0xbba1('0xf')]){if(_0x1b9b4b['error'][_0xbba1('0x10')]===0x1f4){logger['error'](_0xbba1('0xa'),_0xb54beb,_0x1b9b4b[_0xbba1('0xf')][_0xbba1('0x11')]);return _0x35ce33(_0x1b9b4b[_0xbba1('0xf')][_0xbba1('0x11')]);}logger[_0xbba1('0xf')](_0xbba1('0xa'),_0xb54beb,_0x1b9b4b[_0xbba1('0xf')][_0xbba1('0x11')]);return _0x2ba9ce(_0x1b9b4b[_0xbba1('0xf')][_0xbba1('0x11')]);}else{logger[_0xbba1('0x9')]('VoiceDialReport,\x20%s,\x20%s',_0xb54beb,'request\x20sent');_0x2ba9ce(_0x1b9b4b[_0xbba1('0x12')][_0xbba1('0x11')]);}})[_0xbba1('0x13')](function(_0x4d22e2){logger[_0xbba1('0xf')](_0xbba1('0xa'),_0xb54beb,_0x4d22e2);_0x35ce33(_0x4d22e2);});});}exports['CreateVoiceDialReport']=function(_0x4ba86a){var _0x8ea2d9=this;return new Promise(function(_0x39e8eb,_0xa60ed5){return db['VoiceDialReport'][_0xbba1('0x14')](_0x4ba86a[_0xbba1('0x15')],{'raw':_0x4ba86a[_0xbba1('0x16')]?_0x4ba86a[_0xbba1('0x16')][_0xbba1('0x17')]===undefined?!![]:![]:!![]})[_0xbba1('0x18')](function(_0x5832da){logger[_0xbba1('0x9')](_0xbba1('0x19'),_0x4ba86a);logger['debug'](_0xbba1('0x19'),_0x4ba86a,JSON[_0xbba1('0xe')](_0x5832da));_0x39e8eb(_0x5832da);})['catch'](function(_0x22c673){logger[_0xbba1('0xf')](_0xbba1('0x19'),_0x22c673[_0xbba1('0x11')],_0x4ba86a);_0xa60ed5(_0x8ea2d9[_0xbba1('0xf')](0x1f4,_0x22c673['message']));});});};exports[_0xbba1('0x1a')]=function(_0x3a3934){var _0x2a1aff=this;return new Promise(function(_0x19d4c2,_0x307276){return db[_0xbba1('0x1b')][_0xbba1('0x1c')](_0x3a3934[_0xbba1('0x15')],{'raw':_0x3a3934['options']?_0x3a3934[_0xbba1('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a3934[_0xbba1('0x16')]?_0x3a3934[_0xbba1('0x16')]['where']||null:null,'attributes':_0x3a3934[_0xbba1('0x16')]?_0x3a3934[_0xbba1('0x16')][_0xbba1('0x1d')]||null:null,'limit':_0x3a3934[_0xbba1('0x16')]?_0x3a3934[_0xbba1('0x16')]['limit']||null:null})[_0xbba1('0x18')](function(_0x34e5d9){logger[_0xbba1('0x9')]('UpdateVoiceDialReport',_0x3a3934);logger[_0xbba1('0xc')](_0xbba1('0x1a'),_0x3a3934,JSON[_0xbba1('0xe')](_0x34e5d9));_0x19d4c2(_0x34e5d9);})[_0xbba1('0x13')](function(_0x103240){logger[_0xbba1('0xf')](_0xbba1('0x1a'),_0x103240[_0xbba1('0x11')],_0x3a3934);_0x307276(_0x2a1aff['error'](0x1f4,_0x103240[_0xbba1('0x11')]));});});}; \ No newline at end of file +var _0xa594=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','catch','CreateVoiceDialReport','VoiceDialReport','create','options','raw','stringify','UpdateVoiceDialReport','update','body','where','attributes','limit','lodash','util','randomstring','ioredis'];(function(_0x20622d,_0x3efc23){var _0x148ca5=function(_0x1d19ac){while(--_0x1d19ac){_0x20622d['push'](_0x20622d['shift']());}};_0x148ca5(++_0x3efc23);}(_0xa594,0x164));var _0x4a59=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0xa594[_0x390a19];return _0x5d8230;};'use strict';var _=require(_0x4a59('0x0'));var util=require(_0x4a59('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4a59('0x2'));var fs=require('fs');var Redis=require(_0x4a59('0x3'));var db=require(_0x4a59('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a59('0x5'))('rpc');var config=require(_0x4a59('0x6'));var jayson=require(_0x4a59('0x7'));var client=jayson['client'][_0x4a59('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x366233,_0x1919c8,_0x30957b){return new BPromise(function(_0xf2afe2,_0x1d9341){return client['request'](_0x366233,_0x30957b)[_0x4a59('0x9')](function(_0x2e1a2f){logger[_0x4a59('0xa')](_0x4a59('0xb'),_0x1919c8,'request\x20sent');logger[_0x4a59('0xc')](_0x4a59('0xd'),_0x1919c8,_0x4a59('0xe'),JSON['stringify'](_0x2e1a2f));if(_0x2e1a2f[_0x4a59('0xf')]){if(_0x2e1a2f[_0x4a59('0xf')]['code']===0x1f4){logger[_0x4a59('0xf')](_0x4a59('0xb'),_0x1919c8,_0x2e1a2f[_0x4a59('0xf')][_0x4a59('0x10')]);return _0x1d9341(_0x2e1a2f['error'][_0x4a59('0x10')]);}logger['error'](_0x4a59('0xb'),_0x1919c8,_0x2e1a2f['error'][_0x4a59('0x10')]);return _0xf2afe2(_0x2e1a2f[_0x4a59('0xf')][_0x4a59('0x10')]);}else{logger[_0x4a59('0xa')](_0x4a59('0xb'),_0x1919c8,_0x4a59('0xe'));_0xf2afe2(_0x2e1a2f['result'][_0x4a59('0x10')]);}})[_0x4a59('0x11')](function(_0x407fc9){logger[_0x4a59('0xf')]('VoiceDialReport,\x20%s,\x20%s',_0x1919c8,_0x407fc9);_0x1d9341(_0x407fc9);});});}exports[_0x4a59('0x12')]=function(_0x4d587c){var _0x523a3f=this;return new Promise(function(_0x11f593,_0x16d85a){return db[_0x4a59('0x13')][_0x4a59('0x14')](_0x4d587c['body'],{'raw':_0x4d587c[_0x4a59('0x15')]?_0x4d587c[_0x4a59('0x15')][_0x4a59('0x16')]===undefined?!![]:![]:!![]})[_0x4a59('0x9')](function(_0x450a5a){logger[_0x4a59('0xa')](_0x4a59('0x12'),_0x4d587c);logger[_0x4a59('0xc')]('CreateVoiceDialReport',_0x4d587c,JSON[_0x4a59('0x17')](_0x450a5a));_0x11f593(_0x450a5a);})[_0x4a59('0x11')](function(_0x24caf8){logger[_0x4a59('0xf')](_0x4a59('0x12'),_0x24caf8[_0x4a59('0x10')],_0x4d587c);_0x16d85a(_0x523a3f[_0x4a59('0xf')](0x1f4,_0x24caf8[_0x4a59('0x10')]));});});};exports[_0x4a59('0x18')]=function(_0xe1d463){var _0x4d1703=this;return new Promise(function(_0x5dfda8,_0x44bf0e){return db[_0x4a59('0x13')][_0x4a59('0x19')](_0xe1d463[_0x4a59('0x1a')],{'raw':_0xe1d463[_0x4a59('0x15')]?_0xe1d463[_0x4a59('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe1d463['options']?_0xe1d463[_0x4a59('0x15')][_0x4a59('0x1b')]||null:null,'attributes':_0xe1d463[_0x4a59('0x15')]?_0xe1d463[_0x4a59('0x15')][_0x4a59('0x1c')]||null:null,'limit':_0xe1d463[_0x4a59('0x15')]?_0xe1d463[_0x4a59('0x15')][_0x4a59('0x1d')]||null:null})[_0x4a59('0x9')](function(_0x2832fa){logger[_0x4a59('0xa')]('UpdateVoiceDialReport',_0xe1d463);logger[_0x4a59('0xc')](_0x4a59('0x18'),_0xe1d463,JSON['stringify'](_0x2832fa));_0x5dfda8(_0x2832fa);})[_0x4a59('0x11')](function(_0x5e4fcf){logger[_0x4a59('0xf')]('UpdateVoiceDialReport',_0x5e4fcf['message'],_0xe1d463);_0x44bf0e(_0x4d1703[_0x4a59('0xf')](0x1f4,_0x5e4fcf['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 9a50a1a..656b4fe 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 _0x7bb7=['../../components/interaction/service','../../config/environment','./voiceExtension.controller','isAuthenticated','/:id','post','create','/:id/applications','addApplications','update','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x2dc576,_0x361665){var _0x24323f=function(_0x5456e7){while(--_0x5456e7){_0x2dc576['push'](_0x2dc576['shift']());}};_0x24323f(++_0x361665);}(_0x7bb7,0x163));var _0x77bb=function(_0x2e6d96,_0x738d03){_0x2e6d96=_0x2e6d96-0x0;var _0x42f503=_0x7bb7[_0x2e6d96];return _0x42f503;};'use strict';var multer=require(_0x77bb('0x0'));var util=require(_0x77bb('0x1'));var path=require('path');var timeout=require(_0x77bb('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x77bb('0x3'));var auth=require(_0x77bb('0x4'));var interaction=require(_0x77bb('0x5'));var config=require(_0x77bb('0x6'));var controller=require(_0x77bb('0x7'));router['get']('/',auth[_0x77bb('0x8')](),controller['index']);router['get'](_0x77bb('0x9'),auth[_0x77bb('0x8')](),controller['show']);router[_0x77bb('0xa')]('/',auth[_0x77bb('0x8')](),controller[_0x77bb('0xb')]);router[_0x77bb('0xa')](_0x77bb('0xc'),auth[_0x77bb('0x8')](),controller[_0x77bb('0xd')]);router['put'](_0x77bb('0x9'),auth[_0x77bb('0x8')](),controller[_0x77bb('0xe')]);router[_0x77bb('0xf')](_0x77bb('0x9'),auth[_0x77bb('0x8')](),controller[_0x77bb('0x10')]);module[_0x77bb('0x11')]=router; \ No newline at end of file +var _0xbba3=['get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceExtension.controller'];(function(_0xa62163,_0x4a26fb){var _0x46b4fb=function(_0x3a1382){while(--_0x3a1382){_0xa62163['push'](_0xa62163['shift']());}};_0x46b4fb(++_0x4a26fb);}(_0xbba3,0x1ad));var _0x3bba=function(_0x2db7ae,_0x45f4d7){_0x2db7ae=_0x2db7ae-0x0;var _0x237b4a=_0xbba3[_0x2db7ae];return _0x237b4a;};'use strict';var multer=require(_0x3bba('0x0'));var util=require(_0x3bba('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bba('0x2'));var router=express[_0x3bba('0x3')]();var fs_extra=require(_0x3bba('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3bba('0x5'));var config=require(_0x3bba('0x6'));var controller=require(_0x3bba('0x7'));router[_0x3bba('0x8')]('/',auth[_0x3bba('0x9')](),controller[_0x3bba('0xa')]);router[_0x3bba('0x8')]('/:id',auth[_0x3bba('0x9')](),controller[_0x3bba('0xb')]);router[_0x3bba('0xc')]('/',auth[_0x3bba('0x9')](),controller[_0x3bba('0xd')]);router[_0x3bba('0xc')]('/:id/applications',auth[_0x3bba('0x9')](),controller['addApplications']);router[_0x3bba('0xe')](_0x3bba('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x3bba('0x10')](_0x3bba('0xf'),auth[_0x3bba('0x9')](),controller[_0x3bba('0x11')]);module[_0x3bba('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 4d8c88f..72c95ab 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 _0xe706=['VIRTUAL','getDataValue','exten','sequelize','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x5286cf,_0x2ae8d7){var _0x204209=function(_0x5cb0de){while(--_0x5cb0de){_0x5286cf['push'](_0x5286cf['shift']());}};_0x204209(++_0x2ae8d7);}(_0xe706,0xa3));var _0x6e70=function(_0xb49cb8,_0x39474b){_0xb49cb8=_0xb49cb8-0x0;var _0x879ead=_0xe706[_0xb49cb8];return _0x879ead;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'context':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':_0x6e70('0x3')},'priority':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x6e70('0x3')},'tag':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0x4')},'appdata':{'type':Sequelize[_0x6e70('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x6e70('0x5')](_0x6e70('0x6'),_0x6e70('0x7'),_0x6e70('0x8'),_0x6e70('0x9'),_0x6e70('0xa'),_0x6e70('0xb'),_0x6e70('0xc')),'allowNull':![]},'description':{'type':Sequelize[_0x6e70('0x2')]},'interval':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'defaultValue':_0x6e70('0xd')},'IntervalId':{'type':Sequelize[_0x6e70('0xe')]},'isApp':{'type':Sequelize[_0x6e70('0xf')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x6e70('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x6e70('0x10')},'answer':{'type':Sequelize[_0x6e70('0xf')],'defaultValue':!![]},'name':{'type':Sequelize[_0x6e70('0x11')],'get':function(){return this[_0x6e70('0x12')](_0x6e70('0x13'));}}}; \ No newline at end of file +var _0xbaf0=['outbound','internal','inbound-fax','system','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound'];(function(_0x1122ad,_0x2cb1db){var _0x4e7e9d=function(_0x1156c0){while(--_0x1156c0){_0x1122ad['push'](_0x1122ad['shift']());}};_0x4e7e9d(++_0x2cb1db);}(_0xbaf0,0x12a));var _0x0baf=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xbaf0[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'context':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'priority':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0x3')},'appdata':{'type':Sequelize[_0x0baf('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0baf('0x4')](_0x0baf('0x5'),_0x0baf('0x6'),_0x0baf('0x7'),_0x0baf('0x8'),'outbound-fax',_0x0baf('0x9'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x0baf('0x1')]},'interval':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'defaultValue':_0x0baf('0xa')},'IntervalId':{'type':Sequelize[_0x0baf('0xb')]},'isApp':{'type':Sequelize[_0x0baf('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0baf('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0x0baf('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0baf('0xb')]},'recordingFormat':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':_0x0baf('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0baf('0xe')](_0x0baf('0xf'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index e7a03f2..65735e1 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 _0x5a9c=['filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','options','includeAll','include','findAll','rows','show','params','VoiceExtension','catch','create','startsWith','body','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','InboundRoutes','outbound','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','context','cutdigits','mandatoryDisposition','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','VoiceExtensionId','isApp','createRouting','cast(priority\x20as\x20unsigned)','finally','send','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','count','limit','destroy','then','get','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','includes','type','find','name','UserProfileResource','stack','index','rawAttributes','key','model','query','keys'];(function(_0x1329e2,_0x281ee7){var _0x4b6904=function(_0x4ea8cb){while(--_0x4ea8cb){_0x1329e2['push'](_0x1329e2['shift']());}};_0x4b6904(++_0x281ee7);}(_0x5a9c,0x8e));var _0xc5a9=function(_0x481a5e,_0x5c9fe4){_0x481a5e=_0x481a5e-0x0;var _0x43de8f=_0x5a9c[_0x481a5e];return _0x43de8f;};'use strict';var _=require('lodash');var Redis=require(_0xc5a9('0x0'));var qs=require(_0xc5a9('0x1'));var logger=require(_0xc5a9('0x2'))('api');var config=require(_0xc5a9('0x3'));var db=require(_0xc5a9('0x4'))['db'];config[_0xc5a9('0x5')]=_[_0xc5a9('0x6')](config[_0xc5a9('0x5')],{'host':_0xc5a9('0x7'),'port':0x18eb});var socket=require(_0xc5a9('0x8'))(new Redis(config[_0xc5a9('0x5')]));require('./voiceExtension.socket')[_0xc5a9('0x9')](socket);function respondWithStatusCode(_0x347d1e,_0x1556bd){_0x1556bd=_0x1556bd||0xcc;return function(_0x21fad6){if(_0x21fad6){return _0x347d1e[_0xc5a9('0xa')](_0x1556bd);}return _0x347d1e[_0xc5a9('0xb')](_0x1556bd)[_0xc5a9('0xc')]();};}function respondWithResult(_0x215abd,_0x41d74b){_0x41d74b=_0x41d74b||0xc8;return function(_0x493bba){if(_0x493bba){return _0x215abd[_0xc5a9('0xb')](_0x41d74b)['json'](_0x493bba);}};}function respondWithFilteredResult(_0x15ad09,_0x56fcb3){return function(_0x767a32){if(_0x767a32){var _0x4932fb=typeof _0x56fcb3[_0xc5a9('0xd')]===_0xc5a9('0xe')&&typeof _0x56fcb3['limit']===_0xc5a9('0xe');var _0x5a1693=_0x767a32['count'];var _0x493975=_0x4932fb?0x0:_0x56fcb3[_0xc5a9('0xd')];var _0x574b05=_0x4932fb?_0x767a32[_0xc5a9('0xf')]:_0x56fcb3[_0xc5a9('0xd')]+_0x56fcb3[_0xc5a9('0x10')];var _0x5d9cf3;if(_0x574b05>=_0x5a1693){_0x574b05=_0x5a1693;_0x5d9cf3=0xc8;}else{_0x5d9cf3=0xce;}_0x15ad09[_0xc5a9('0xb')](_0x5d9cf3);return _0x15ad09['set']('Content-Range',_0x493975+'-'+_0x574b05+'/'+_0x5a1693)['json'](_0x767a32);}return null;};}function removeEntity(_0x49cafa){return function(_0x4efa7a){if(_0x4efa7a){return _0x4efa7a[_0xc5a9('0x11')]()[_0xc5a9('0x12')](function(){var _0x37f160=_0x4efa7a[_0xc5a9('0x13')]({'plain':!![]});var _0x4381ff=[{'name':'InboundRoutes','value':_0xc5a9('0x14'),'ignore':![]},{'name':_0xc5a9('0x15'),'value':'outbound','ignore':![]},{'name':_0xc5a9('0x16'),'value':_0xc5a9('0x17'),'ignore':![]}];var _0x267765=_(_0x4381ff)[_0xc5a9('0x18')](_0xc5a9('0x19'))[_0xc5a9('0x1a')](_0xc5a9('0x1b'))[_0xc5a9('0x1b')]();if(_[_0xc5a9('0x1c')](_0x267765,_0x37f160[_0xc5a9('0x1d')])){return;}var _0x1581cc=_[_0xc5a9('0x1e')](_0x4381ff,['value',_0x37f160[_0xc5a9('0x1d')]])[_0xc5a9('0x1f')];return db[_0xc5a9('0x20')][_0xc5a9('0x11')]({'where':{'type':_0x1581cc,'resourceId':_0x37f160['id']}})['then'](function(){return _0x4efa7a;});})[_0xc5a9('0x12')](function(){_0x49cafa[_0xc5a9('0xb')](0xcc)[_0xc5a9('0xc')]();});}};}function handleEntityNotFound(_0x500b56){return function(_0x460c2f){if(!_0x460c2f){_0x500b56[_0xc5a9('0xa')](0x194);}return _0x460c2f;};}function handleError(_0x39eaf3,_0x5e135c){_0x5e135c=_0x5e135c||0x1f4;return function(_0x52e606){logger['error'](_0x52e606[_0xc5a9('0x21')]);if(_0x52e606[_0xc5a9('0x1f')]){delete _0x52e606[_0xc5a9('0x1f')];}_0x39eaf3[_0xc5a9('0xb')](_0x5e135c)['send'](_0x52e606);};}exports[_0xc5a9('0x22')]=function(_0x1b7686,_0x480d57){var _0x2eb9ab={},_0x39d51b={},_0x3c92b5={'count':0x0,'rows':[]};var _0x3c442b=_[_0xc5a9('0x1a')](db['VoiceExtension'][_0xc5a9('0x23')],function(_0x44da4d){return{'name':_0x44da4d['fieldName'],'type':_0x44da4d[_0xc5a9('0x1d')][_0xc5a9('0x24')]};});_0x39d51b[_0xc5a9('0x25')]=_[_0xc5a9('0x1a')](_0x3c442b,_0xc5a9('0x1f'));_0x39d51b[_0xc5a9('0x26')]=_[_0xc5a9('0x27')](_0x1b7686[_0xc5a9('0x26')]);_0x39d51b[_0xc5a9('0x28')]=_['intersection'](_0x39d51b[_0xc5a9('0x25')],_0x39d51b['query']);_0x2eb9ab['attributes']=_[_0xc5a9('0x29')](_0x39d51b['model'],qs['fields'](_0x1b7686[_0xc5a9('0x26')][_0xc5a9('0x2a')]));_0x2eb9ab[_0xc5a9('0x2b')]=_0x2eb9ab[_0xc5a9('0x2b')][_0xc5a9('0x2c')]?_0x2eb9ab[_0xc5a9('0x2b')]:_0x39d51b[_0xc5a9('0x25')];if(!_0x1b7686[_0xc5a9('0x26')][_0xc5a9('0x2d')](_0xc5a9('0x2e'))){_0x2eb9ab[_0xc5a9('0x10')]=qs[_0xc5a9('0x10')](_0x1b7686[_0xc5a9('0x26')][_0xc5a9('0x10')]);_0x2eb9ab[_0xc5a9('0xd')]=qs['offset'](_0x1b7686['query'][_0xc5a9('0xd')]);}_0x2eb9ab[_0xc5a9('0x2f')]=qs[_0xc5a9('0x30')](_0x1b7686[_0xc5a9('0x26')][_0xc5a9('0x30')]);_0x2eb9ab['where']=qs[_0xc5a9('0x28')](_[_0xc5a9('0x31')](_0x1b7686[_0xc5a9('0x26')],_0x39d51b[_0xc5a9('0x28')]),_0x3c442b);if(_0x1b7686['query'][_0xc5a9('0x18')]){_0x2eb9ab['where']=_[_0xc5a9('0x32')](_0x2eb9ab[_0xc5a9('0x33')],{'$or':_[_0xc5a9('0x1a')](_0x3c442b,function(_0x83992a){if(_0x83992a[_0xc5a9('0x1d')]!=='VIRTUAL'){var _0x2717e4={};_0x2717e4[_0x83992a[_0xc5a9('0x1f')]]={'$like':'%'+_0x1b7686['query'][_0xc5a9('0x18')]+'%'};return _0x2717e4;}})});}_0x2eb9ab=_[_0xc5a9('0x32')]({},_0x2eb9ab,_0x1b7686[_0xc5a9('0x34')]);var _0x4ff3e1={'where':_0x2eb9ab[_0xc5a9('0x33')]};return db['VoiceExtension'][_0xc5a9('0xf')](_0x4ff3e1)[_0xc5a9('0x12')](function(_0x57d5b3){_0x3c92b5[_0xc5a9('0xf')]=_0x57d5b3;if(_0x1b7686[_0xc5a9('0x26')][_0xc5a9('0x35')]){_0x2eb9ab[_0xc5a9('0x36')]=[{'all':!![]}];}return db['VoiceExtension'][_0xc5a9('0x37')](_0x2eb9ab);})[_0xc5a9('0x12')](function(_0x3c30b9){_0x3c92b5[_0xc5a9('0x38')]=_0x3c30b9;return _0x3c92b5;})[_0xc5a9('0x12')](respondWithFilteredResult(_0x480d57,_0x2eb9ab))['catch'](handleError(_0x480d57,null));};exports[_0xc5a9('0x39')]=function(_0x4260ce,_0x5e3771){var _0x38d7a2={'raw':![],'where':{'id':_0x4260ce[_0xc5a9('0x3a')]['id']}},_0x19448c={};_0x19448c[_0xc5a9('0x25')]=_['keys'](db[_0xc5a9('0x3b')][_0xc5a9('0x23')]);_0x19448c['query']=_[_0xc5a9('0x27')](_0x4260ce[_0xc5a9('0x26')]);_0x19448c[_0xc5a9('0x28')]=_[_0xc5a9('0x29')](_0x19448c['model'],_0x19448c[_0xc5a9('0x26')]);_0x38d7a2['attributes']=_[_0xc5a9('0x29')](_0x19448c[_0xc5a9('0x25')],qs['fields'](_0x4260ce['query'][_0xc5a9('0x2a')]));_0x38d7a2[_0xc5a9('0x2b')]=_0x38d7a2['attributes'][_0xc5a9('0x2c')]?_0x38d7a2[_0xc5a9('0x2b')]:_0x19448c[_0xc5a9('0x25')];if(_0x4260ce[_0xc5a9('0x26')]['includeAll']){_0x38d7a2[_0xc5a9('0x36')]=[{'all':!![]}];}_0x38d7a2=_['merge']({},_0x38d7a2,_0x4260ce[_0xc5a9('0x34')]);return db[_0xc5a9('0x3b')][_0xc5a9('0x1e')](_0x38d7a2)[_0xc5a9('0x12')](handleEntityNotFound(_0x5e3771,null))[_0xc5a9('0x12')](respondWithResult(_0x5e3771,null))['catch'](handleError(_0x5e3771,null));};exports[_0xc5a9('0x11')]=function(_0xe4c43,_0x3a1795){return db[_0xc5a9('0x3b')][_0xc5a9('0x1e')]({'where':{'id':_0xe4c43['params']['id']}})[_0xc5a9('0x12')](handleEntityNotFound(_0x3a1795,null))['then'](removeEntity(_0x3a1795,null))[_0xc5a9('0x3c')](handleError(_0x3a1795,null));};exports[_0xc5a9('0x3d')]=function(_0x22113a,_0x5f1289){if(_0x22113a['body'][_0xc5a9('0x1d')]==='outbound'&&!_[_0xc5a9('0x3e')](_0x22113a[_0xc5a9('0x3f')][_0xc5a9('0x40')],'_')){_0x22113a['body'][_0xc5a9('0x40')]='_'[_0xc5a9('0x41')](_0x22113a[_0xc5a9('0x3f')][_0xc5a9('0x40')]);}return db['VoiceExtension'][_0xc5a9('0x3d')](_0x22113a['body'],{'raw':![]})[_0xc5a9('0x12')](function(_0x3a0fd3){var _0x5d8af7=_0x22113a[_0xc5a9('0x42')]['get']({'plain':!![]});if(!_0x5d8af7)throw new Error(_0xc5a9('0x43'));if(_0x5d8af7[_0xc5a9('0x44')]===_0xc5a9('0x42')){var _0x10aff0=_0x3a0fd3[_0xc5a9('0x13')]({'plain':!![]});var _0x17b034=[{'name':_0xc5a9('0x45'),'value':_0xc5a9('0x14')},{'name':'OutboundRoutes','value':_0xc5a9('0x46')},{'name':_0xc5a9('0x16'),'value':'internal'}];var _0x40b2d8=_['find'](_0x17b034,[_0xc5a9('0x1b'),_0x10aff0[_0xc5a9('0x1d')]])[_0xc5a9('0x1f')];return db[_0xc5a9('0x47')][_0xc5a9('0x1e')]({'where':{'name':_0x40b2d8,'userProfileId':_0x5d8af7['userProfileId']},'raw':!![]})[_0xc5a9('0x12')](function(_0x23f2fd){if(_0x23f2fd&&_0x23f2fd[_0xc5a9('0x48')]===0x0){return db['UserProfileResource'][_0xc5a9('0x3d')]({'name':_0x10aff0[_0xc5a9('0x1f')],'resourceId':_0x10aff0['id'],'type':_0x23f2fd[_0xc5a9('0x1f')],'sectionId':_0x23f2fd['id']},{})['then'](function(){return _0x3a0fd3;});}else{return _0x3a0fd3;}})[_0xc5a9('0x3c')](function(_0x525619){logger[_0xc5a9('0x49')](_0xc5a9('0x4a'),_0x525619);throw _0x525619;});}return _0x3a0fd3;})[_0xc5a9('0x12')](respondWithResult(_0x5f1289,0xc9))[_0xc5a9('0x3c')](handleError(_0x5f1289,null));};exports[_0xc5a9('0x4b')]=function(_0x400c95,_0x5775be){if(_0x400c95[_0xc5a9('0x3f')]['id']){delete _0x400c95[_0xc5a9('0x3f')]['id'];}return db['VoiceExtension'][_0xc5a9('0x1e')]({'where':{'id':_0x400c95['params']['id']}})[_0xc5a9('0x12')](handleEntityNotFound(_0x5775be,null))['then'](function(_0x3b888a){if(_0x3b888a){return db[_0xc5a9('0x3b')]['update'](_['pick'](_0x400c95['body'],[_0xc5a9('0x40'),_0xc5a9('0x4c'),'description','recordingFormat',_0xc5a9('0x4d'),_0xc5a9('0x4e'),'alias']),{'where':{'context':_0x3b888a[_0xc5a9('0x4c')],'exten':_0x3b888a[_0xc5a9('0x40')]},'individualHooks':!![]})[_0xc5a9('0x12')](function(_0x5e9da0){return _0x5e9da0;});}return null;})[_0xc5a9('0x12')](respondWithStatusCode(_0x5775be,null))['catch'](handleError(_0x5775be,null));};exports[_0xc5a9('0x4f')]=function(_0x37e2d3,_0x1c066c){var _0xdd474d=_0x37e2d3[_0xc5a9('0x3a')]['id'];var _0x5dab8a=_0x37e2d3[_0xc5a9('0x3f')];var _0x11931a=0xc8;var _0x28daa2=null;return db[_0xc5a9('0x50')][_0xc5a9('0x51')]({'isolationLevel':db['sequelize'][_0xc5a9('0x52')][_0xc5a9('0x53')][_0xc5a9('0x54')]},function(_0x1c210d){return db[_0xc5a9('0x3b')]['findOne']({'where':{'id':_0xdd474d},'transaction':_0x1c210d})[_0xc5a9('0x12')](function(_0x27c30e){if(_0x27c30e){return db['VoiceExtension'][_0xc5a9('0x11')]({'where':{'VoiceExtensionId':_0xdd474d},'transaction':_0x1c210d})[_0xc5a9('0x12')](function(){var _0x97d9bd=_[_0xc5a9('0x1a')](_0x5dab8a,function(_0x5064e0){_0x5064e0[_0xc5a9('0x55')]=_0xdd474d;_0x5064e0[_0xc5a9('0x56')]=!![];return _0x5064e0;});return _0x27c30e[_0xc5a9('0x57')](_0x97d9bd);})[_0xc5a9('0x12')](function(_0x2717c9){return db['VoiceExtension']['bulkCreate'](_0x2717c9,{'transaction':_0x1c210d});});}else{_0x11931a=0x194;_0x28daa2=[];}});})[_0xc5a9('0x12')](function(){if(_0x11931a!==0x194){return db['VoiceExtension']['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0xdd474d},'order':_0xc5a9('0x58')})['then'](function(_0x14f53a){_0x28daa2=_0x14f53a;});}})[_0xc5a9('0x3c')](function(_0x216c90){_0x11931a=0x1f4;logger['error'](_0x216c90[_0xc5a9('0x21')]);if(_0x216c90['name']){delete _0x216c90['name'];}_0x28daa2=_0x216c90;})[_0xc5a9('0x59')](function(){if(_0x28daa2===null){_0x1c066c[_0xc5a9('0xa')](_0x11931a);}else{if(_0x11931a===0x1f4){_0x1c066c['status'](_0x11931a)[_0xc5a9('0x5a')](_0x28daa2);}else{_0x1c066c[_0xc5a9('0xb')](_0x11931a)['json'](_0x28daa2);}}});}; \ No newline at end of file +var _0xdf4d=['body','startsWith','exten','concat','create','user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','pick','context','description','recordingFormat','cutdigits','mandatoryDisposition','alias','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','isApp','createRouting','bulkCreate','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../mysqldb','redis','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes','internal','filter','ignore','map','value','find','type','name','error','stack','send','index','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','options','VoiceExtension','includeAll','findAll','rows','show','params','rawAttributes','include','catch'];(function(_0xb417ec,_0x3f44bf){var _0x4c9f05=function(_0x55191c){while(--_0x55191c){_0xb417ec['push'](_0xb417ec['shift']());}};_0x4c9f05(++_0x3f44bf);}(_0xdf4d,0x196));var _0xddf4=function(_0x2570d5,_0x245234){_0x2570d5=_0x2570d5-0x0;var _0x1f5863=_0xdf4d[_0x2570d5];return _0x1f5863;};'use strict';var _=require(_0xddf4('0x0'));var Redis=require(_0xddf4('0x1'));var qs=require(_0xddf4('0x2'));var logger=require(_0xddf4('0x3'))('api');var config=require('../../config/environment');var db=require(_0xddf4('0x4'))['db'];config[_0xddf4('0x5')]=_['defaults'](config[_0xddf4('0x5')],{'host':_0xddf4('0x6'),'port':0x18eb});var socket=require(_0xddf4('0x7'))(new Redis(config[_0xddf4('0x5')]));require(_0xddf4('0x8'))[_0xddf4('0x9')](socket);function respondWithStatusCode(_0x524f56,_0x324564){_0x324564=_0x324564||0xcc;return function(_0x17d8bd){if(_0x17d8bd){return _0x524f56[_0xddf4('0xa')](_0x324564);}return _0x524f56['status'](_0x324564)[_0xddf4('0xb')]();};}function respondWithResult(_0x5e7417,_0x43c334){_0x43c334=_0x43c334||0xc8;return function(_0x1990fc){if(_0x1990fc){return _0x5e7417[_0xddf4('0xc')](_0x43c334)[_0xddf4('0xd')](_0x1990fc);}};}function respondWithFilteredResult(_0x168483,_0x6e4f64){return function(_0x1e263d){if(_0x1e263d){var _0x423cad=typeof _0x6e4f64['offset']===_0xddf4('0xe')&&typeof _0x6e4f64[_0xddf4('0xf')]===_0xddf4('0xe');var _0x4d63e5=_0x1e263d[_0xddf4('0x10')];var _0x38dd0d=_0x423cad?0x0:_0x6e4f64['offset'];var _0x300063=_0x423cad?_0x1e263d[_0xddf4('0x10')]:_0x6e4f64[_0xddf4('0x11')]+_0x6e4f64['limit'];var _0x5f31b5;if(_0x300063>=_0x4d63e5){_0x300063=_0x4d63e5;_0x5f31b5=0xc8;}else{_0x5f31b5=0xce;}_0x168483[_0xddf4('0xc')](_0x5f31b5);return _0x168483['set']('Content-Range',_0x38dd0d+'-'+_0x300063+'/'+_0x4d63e5)[_0xddf4('0xd')](_0x1e263d);}return null;};}function removeEntity(_0x41fe15){return function(_0x3709d6){if(_0x3709d6){return _0x3709d6[_0xddf4('0x12')]()[_0xddf4('0x13')](function(){var _0x22ec49=_0x3709d6[_0xddf4('0x14')]({'plain':!![]});var _0x1b1ab2=[{'name':_0xddf4('0x15'),'value':_0xddf4('0x16'),'ignore':![]},{'name':_0xddf4('0x17'),'value':_0xddf4('0x18'),'ignore':![]},{'name':_0xddf4('0x19'),'value':_0xddf4('0x1a'),'ignore':![]}];var _0x5b6142=_(_0x1b1ab2)[_0xddf4('0x1b')](_0xddf4('0x1c'))[_0xddf4('0x1d')]('value')[_0xddf4('0x1e')]();if(_['includes'](_0x5b6142,_0x22ec49['type'])){return;}var _0x352bd9=_[_0xddf4('0x1f')](_0x1b1ab2,['value',_0x22ec49[_0xddf4('0x20')]])[_0xddf4('0x21')];return db['UserProfileResource'][_0xddf4('0x12')]({'where':{'type':_0x352bd9,'resourceId':_0x22ec49['id']}})[_0xddf4('0x13')](function(){return _0x3709d6;});})[_0xddf4('0x13')](function(){_0x41fe15[_0xddf4('0xc')](0xcc)[_0xddf4('0xb')]();});}};}function handleEntityNotFound(_0x27bea7){return function(_0x5b879d){if(!_0x5b879d){_0x27bea7[_0xddf4('0xa')](0x194);}return _0x5b879d;};}function handleError(_0x1f2614,_0x244bb5){_0x244bb5=_0x244bb5||0x1f4;return function(_0x2fc631){logger[_0xddf4('0x22')](_0x2fc631[_0xddf4('0x23')]);if(_0x2fc631[_0xddf4('0x21')]){delete _0x2fc631[_0xddf4('0x21')];}_0x1f2614[_0xddf4('0xc')](_0x244bb5)[_0xddf4('0x24')](_0x2fc631);};}exports[_0xddf4('0x25')]=function(_0x14ab0f,_0x2c6f36){var _0x24f1d0={},_0x5405b9={},_0xb63fec={'count':0x0,'rows':[]};var _0x41888f=_[_0xddf4('0x1d')](db['VoiceExtension']['rawAttributes'],function(_0x54e5b8){return{'name':_0x54e5b8[_0xddf4('0x26')],'type':_0x54e5b8[_0xddf4('0x20')][_0xddf4('0x27')]};});_0x5405b9[_0xddf4('0x28')]=_[_0xddf4('0x1d')](_0x41888f,'name');_0x5405b9[_0xddf4('0x29')]=_[_0xddf4('0x2a')](_0x14ab0f[_0xddf4('0x29')]);_0x5405b9[_0xddf4('0x2b')]=_[_0xddf4('0x2c')](_0x5405b9[_0xddf4('0x28')],_0x5405b9[_0xddf4('0x29')]);_0x24f1d0[_0xddf4('0x2d')]=_[_0xddf4('0x2c')](_0x5405b9['model'],qs[_0xddf4('0x2e')](_0x14ab0f[_0xddf4('0x29')][_0xddf4('0x2e')]));_0x24f1d0[_0xddf4('0x2d')]=_0x24f1d0[_0xddf4('0x2d')][_0xddf4('0x2f')]?_0x24f1d0[_0xddf4('0x2d')]:_0x5405b9[_0xddf4('0x28')];if(!_0x14ab0f[_0xddf4('0x29')]['hasOwnProperty'](_0xddf4('0x30'))){_0x24f1d0['limit']=qs[_0xddf4('0xf')](_0x14ab0f[_0xddf4('0x29')][_0xddf4('0xf')]);_0x24f1d0['offset']=qs[_0xddf4('0x11')](_0x14ab0f[_0xddf4('0x29')][_0xddf4('0x11')]);}_0x24f1d0[_0xddf4('0x31')]=qs[_0xddf4('0x32')](_0x14ab0f[_0xddf4('0x29')][_0xddf4('0x32')]);_0x24f1d0[_0xddf4('0x33')]=qs[_0xddf4('0x2b')](_['pick'](_0x14ab0f[_0xddf4('0x29')],_0x5405b9['filters']),_0x41888f);if(_0x14ab0f['query']['filter']){_0x24f1d0[_0xddf4('0x33')]=_[_0xddf4('0x34')](_0x24f1d0[_0xddf4('0x33')],{'$or':_['map'](_0x41888f,function(_0x1e68c9){if(_0x1e68c9[_0xddf4('0x20')]!==_0xddf4('0x35')){var _0x143d04={};_0x143d04[_0x1e68c9['name']]={'$like':'%'+_0x14ab0f[_0xddf4('0x29')][_0xddf4('0x1b')]+'%'};return _0x143d04;}})});}_0x24f1d0=_['merge']({},_0x24f1d0,_0x14ab0f[_0xddf4('0x36')]);var _0x4d05ba={'where':_0x24f1d0[_0xddf4('0x33')]};return db[_0xddf4('0x37')][_0xddf4('0x10')](_0x4d05ba)[_0xddf4('0x13')](function(_0x24bedf){_0xb63fec[_0xddf4('0x10')]=_0x24bedf;if(_0x14ab0f[_0xddf4('0x29')][_0xddf4('0x38')]){_0x24f1d0['include']=[{'all':!![]}];}return db[_0xddf4('0x37')][_0xddf4('0x39')](_0x24f1d0);})['then'](function(_0x683d6d){_0xb63fec[_0xddf4('0x3a')]=_0x683d6d;return _0xb63fec;})[_0xddf4('0x13')](respondWithFilteredResult(_0x2c6f36,_0x24f1d0))['catch'](handleError(_0x2c6f36,null));};exports[_0xddf4('0x3b')]=function(_0x31556b,_0x1fdb9d){var _0x724e0c={'raw':![],'where':{'id':_0x31556b[_0xddf4('0x3c')]['id']}},_0xac7323={};_0xac7323[_0xddf4('0x28')]=_['keys'](db[_0xddf4('0x37')][_0xddf4('0x3d')]);_0xac7323['query']=_[_0xddf4('0x2a')](_0x31556b[_0xddf4('0x29')]);_0xac7323[_0xddf4('0x2b')]=_[_0xddf4('0x2c')](_0xac7323[_0xddf4('0x28')],_0xac7323[_0xddf4('0x29')]);_0x724e0c[_0xddf4('0x2d')]=_[_0xddf4('0x2c')](_0xac7323[_0xddf4('0x28')],qs[_0xddf4('0x2e')](_0x31556b['query'][_0xddf4('0x2e')]));_0x724e0c[_0xddf4('0x2d')]=_0x724e0c[_0xddf4('0x2d')][_0xddf4('0x2f')]?_0x724e0c[_0xddf4('0x2d')]:_0xac7323[_0xddf4('0x28')];if(_0x31556b[_0xddf4('0x29')][_0xddf4('0x38')]){_0x724e0c[_0xddf4('0x3e')]=[{'all':!![]}];}_0x724e0c=_['merge']({},_0x724e0c,_0x31556b[_0xddf4('0x36')]);return db[_0xddf4('0x37')][_0xddf4('0x1f')](_0x724e0c)['then'](handleEntityNotFound(_0x1fdb9d,null))[_0xddf4('0x13')](respondWithResult(_0x1fdb9d,null))[_0xddf4('0x3f')](handleError(_0x1fdb9d,null));};exports[_0xddf4('0x12')]=function(_0x22846c,_0x19b371){return db[_0xddf4('0x37')]['find']({'where':{'id':_0x22846c[_0xddf4('0x3c')]['id']}})[_0xddf4('0x13')](handleEntityNotFound(_0x19b371,null))['then'](removeEntity(_0x19b371,null))['catch'](handleError(_0x19b371,null));};exports['create']=function(_0x39d757,_0x325082){if(_0x39d757[_0xddf4('0x40')][_0xddf4('0x20')]===_0xddf4('0x18')&&!_[_0xddf4('0x41')](_0x39d757[_0xddf4('0x40')][_0xddf4('0x42')],'_')){_0x39d757[_0xddf4('0x40')][_0xddf4('0x42')]='_'[_0xddf4('0x43')](_0x39d757[_0xddf4('0x40')]['exten']);}return db['VoiceExtension'][_0xddf4('0x44')](_0x39d757[_0xddf4('0x40')],{'raw':![]})['then'](function(_0x5121d9){var _0x3e8ad7=_0x39d757[_0xddf4('0x45')][_0xddf4('0x14')]({'plain':!![]});if(!_0x3e8ad7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e8ad7[_0xddf4('0x46')]===_0xddf4('0x45')){var _0x41e1e2=_0x5121d9[_0xddf4('0x14')]({'plain':!![]});var _0x28d855=[{'name':_0xddf4('0x15'),'value':_0xddf4('0x16')},{'name':_0xddf4('0x17'),'value':_0xddf4('0x18')},{'name':_0xddf4('0x19'),'value':_0xddf4('0x1a')}];var _0x586b0c=_[_0xddf4('0x1f')](_0x28d855,[_0xddf4('0x1e'),_0x41e1e2[_0xddf4('0x20')]])[_0xddf4('0x21')];return db[_0xddf4('0x47')]['find']({'where':{'name':_0x586b0c,'userProfileId':_0x3e8ad7[_0xddf4('0x48')]},'raw':!![]})[_0xddf4('0x13')](function(_0x5e6304){if(_0x5e6304&&_0x5e6304[_0xddf4('0x49')]===0x0){return db[_0xddf4('0x4a')][_0xddf4('0x44')]({'name':_0x41e1e2[_0xddf4('0x21')],'resourceId':_0x41e1e2['id'],'type':_0x5e6304[_0xddf4('0x21')],'sectionId':_0x5e6304['id']},{})['then'](function(){return _0x5121d9;});}else{return _0x5121d9;}})[_0xddf4('0x3f')](function(_0xf7c010){logger[_0xddf4('0x22')](_0xddf4('0x4b'),_0xf7c010);throw _0xf7c010;});}return _0x5121d9;})[_0xddf4('0x13')](respondWithResult(_0x325082,0xc9))['catch'](handleError(_0x325082,null));};exports[_0xddf4('0x4c')]=function(_0x18101b,_0x59780d){if(_0x18101b['body']['id']){delete _0x18101b[_0xddf4('0x40')]['id'];}return db['VoiceExtension'][_0xddf4('0x1f')]({'where':{'id':_0x18101b[_0xddf4('0x3c')]['id']}})[_0xddf4('0x13')](handleEntityNotFound(_0x59780d,null))[_0xddf4('0x13')](function(_0x4a6c32){if(_0x4a6c32){return db[_0xddf4('0x37')][_0xddf4('0x4c')](_[_0xddf4('0x4d')](_0x18101b[_0xddf4('0x40')],[_0xddf4('0x42'),_0xddf4('0x4e'),_0xddf4('0x4f'),_0xddf4('0x50'),_0xddf4('0x51'),_0xddf4('0x52'),_0xddf4('0x53')]),{'where':{'context':_0x4a6c32[_0xddf4('0x4e')],'exten':_0x4a6c32[_0xddf4('0x42')]},'individualHooks':!![]})[_0xddf4('0x13')](function(_0x14c721){return _0x14c721;});}return null;})['then'](respondWithStatusCode(_0x59780d,null))[_0xddf4('0x3f')](handleError(_0x59780d,null));};exports['addApplications']=function(_0x34b3f7,_0x31e0a0){var _0x7d3b88=_0x34b3f7['params']['id'];var _0x2d0243=_0x34b3f7[_0xddf4('0x40')];var _0x1a7f4e=0xc8;var _0x10b400=null;return db[_0xddf4('0x54')]['transaction']({'isolationLevel':db['sequelize'][_0xddf4('0x55')][_0xddf4('0x56')][_0xddf4('0x57')]},function(_0x4a80f1){return db['VoiceExtension'][_0xddf4('0x58')]({'where':{'id':_0x7d3b88},'transaction':_0x4a80f1})['then'](function(_0x12ebc0){if(_0x12ebc0){return db['VoiceExtension'][_0xddf4('0x12')]({'where':{'VoiceExtensionId':_0x7d3b88},'transaction':_0x4a80f1})['then'](function(){var _0x2fb3ed=_['map'](_0x2d0243,function(_0x578bd6){_0x578bd6['VoiceExtensionId']=_0x7d3b88;_0x578bd6[_0xddf4('0x59')]=!![];return _0x578bd6;});return _0x12ebc0[_0xddf4('0x5a')](_0x2fb3ed);})[_0xddf4('0x13')](function(_0x2206cb){return db[_0xddf4('0x37')][_0xddf4('0x5b')](_0x2206cb,{'transaction':_0x4a80f1});});}else{_0x1a7f4e=0x194;_0x10b400=[];}});})['then'](function(){if(_0x1a7f4e!==0x194){return db[_0xddf4('0x37')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x7d3b88},'order':_0xddf4('0x5c')})[_0xddf4('0x13')](function(_0x51b33a){_0x10b400=_0x51b33a;});}})[_0xddf4('0x3f')](function(_0xc88dfb){_0x1a7f4e=0x1f4;logger[_0xddf4('0x22')](_0xc88dfb[_0xddf4('0x23')]);if(_0xc88dfb[_0xddf4('0x21')]){delete _0xc88dfb[_0xddf4('0x21')];}_0x10b400=_0xc88dfb;})[_0xddf4('0x5d')](function(){if(_0x10b400===null){_0x31e0a0[_0xddf4('0xa')](_0x1a7f4e);}else{if(_0x1a7f4e===0x1f4){_0x31e0a0[_0xddf4('0xc')](_0x1a7f4e)[_0xddf4('0x24')](_0x10b400);}else{_0x31e0a0[_0xddf4('0xc')](_0x1a7f4e)[_0xddf4('0xd')](_0x10b400);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index cce1faf..ebe15dc 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 _0x6f33=['update','remove','emit','exports','events','../../mysqldb','VoiceExtension','setMaxListeners'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6f33,0x84));var _0x36f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6f33[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x36f3('0x0'));var VoiceExtension=require(_0x36f3('0x1'))['db'][_0x36f3('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x36f3('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x36f3('0x4'),'afterDestroy':_0x36f3('0x5')};function emitEvent(_0x2a1a1c){return function(_0x448a1a,_0x4a143f,_0x566374){VoiceExtensionEvents[_0x36f3('0x6')](_0x2a1a1c+':'+_0x448a1a['id'],_0x448a1a);VoiceExtensionEvents[_0x36f3('0x6')](_0x2a1a1c,_0x448a1a);_0x566374(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module[_0x36f3('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xb688=['exports','events','../../mysqldb','setMaxListeners','remove','emit','hook'];(function(_0x3f66c7,_0x1a6a5a){var _0x21ae58=function(_0x10105d){while(--_0x10105d){_0x3f66c7['push'](_0x3f66c7['shift']());}};_0x21ae58(++_0x1a6a5a);}(_0xb688,0x16d));var _0x8b68=function(_0x3c4a56,_0x31210b){_0x3c4a56=_0x3c4a56-0x0;var _0x718dbb=_0xb688[_0x3c4a56];return _0x718dbb;};'use strict';var EventEmitter=require(_0x8b68('0x0'));var VoiceExtension=require(_0x8b68('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x8b68('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8b68('0x3')};function emitEvent(_0x4746f6){return function(_0x2b16bd,_0x169238,_0x479c71){VoiceExtensionEvents[_0x8b68('0x4')](_0x4746f6+':'+_0x2b16bd['id'],_0x2b16bd);VoiceExtensionEvents[_0x8b68('0x4')](_0x4746f6,_0x2b16bd);_0x479c71(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x8b68('0x5')](e,emitEvent(event));}}module[_0x8b68('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index d80fd32..494053d 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 _0xa849=['prefix','${EXTEN:','SIP','indexOf','U(xcally-mixmonitor-context)','join','isEmpty','findAll','interval','IntervalId','then','intervals','map','filter','tag','CDR(tag)=','toLowerCase','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','appType','appdata','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','priority','last','concat','catch','define','VoiceExtension','voice_extensions','get','./voiceExtension.attributes','models','type','CDR(type)=','context','exten','inbound','CDR(routeid)=','push','Set','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','CDR(destination)=','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','trunk','timeout','options','split','length','name','param','phone'];(function(_0x5e2350,_0x1077cb){var _0x1b88a9=function(_0x1fe510){while(--_0x1fe510){_0x5e2350['push'](_0x5e2350['shift']());}};_0x1b88a9(++_0x1077cb);}(_0xa849,0x73));var _0x9a84=function(_0x21b675,_0x12c1c0){_0x21b675=_0x21b675-0x0;var _0x1c4103=_0xa849[_0x21b675];return _0x1c4103;};'use strict';var _=require('lodash');var attributes=require(_0x9a84('0x0'));module['exports']=function(_0x25fd20){var _0x4097f4=_0x25fd20[_0x9a84('0x1')];function _0x96b0(_0x15e199){var _0x445c09=0x2;var _0x3e1428=[{'type':_0x15e199[_0x9a84('0x2')],'app':'Set','appdata':_0x9a84('0x3')+_0x15e199['type'],'context':_0x15e199[_0x9a84('0x4')],'exten':_0x15e199[_0x9a84('0x5')],'priority':_0x445c09++,'VoiceExtensionId':_0x15e199['id']}];if(_0x15e199[_0x9a84('0x2')]==='inbound'){_0x3e1428['push']({'type':_0x9a84('0x6'),'app':'Set','appdata':_0x9a84('0x7')+_0x15e199['id'],'context':_0x15e199[_0x9a84('0x4')],'exten':_0x15e199[_0x9a84('0x5')],'priority':_0x445c09++,'VoiceExtensionId':_0x15e199['id']});}_0x3e1428[_0x9a84('0x8')]({'type':_0x15e199[_0x9a84('0x2')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x15e199[_0x9a84('0x4')],'exten':_0x15e199[_0x9a84('0x5')],'priority':_0x445c09++,'VoiceExtensionId':_0x15e199['id']},{'type':_0x15e199[_0x9a84('0x2')],'app':_0x9a84('0x9'),'appdata':_0x9a84('0xa'),'context':_0x15e199[_0x9a84('0x4')],'exten':_0x15e199['exten'],'priority':_0x445c09++,'VoiceExtensionId':_0x15e199['id']},{'type':_0x15e199['type'],'app':_0x9a84('0x9'),'appdata':_0x9a84('0xb'),'context':_0x15e199[_0x9a84('0x4')],'exten':_0x15e199[_0x9a84('0x5')],'priority':_0x445c09++,'VoiceExtensionId':_0x15e199['id']});return _0x3e1428;}function _0x53476d(_0xaffd85){var _0x1c4ffd=0x2;var _0x4f5c46=[{'type':_0x9a84('0xc'),'app':_0x9a84('0x9'),'appdata':_0x9a84('0xd'),'context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85[_0x9a84('0x5')],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':_0x9a84('0xc'),'app':'Set','appdata':_0x9a84('0xe')+(_0xaffd85[_0x9a84('0xf')]?'${EXTEN:'+_0xaffd85[_0x9a84('0xf')]+'}':_0x9a84('0x10')),'context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85[_0x9a84('0x5')],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':'outbound','app':_0x9a84('0x9'),'appdata':_0x9a84('0x7')+_0xaffd85['id'],'context':_0xaffd85['context'],'exten':_0xaffd85['exten'],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':'outbound','app':_0x9a84('0x11'),'appdata':_0x9a84('0x12')+(_0x1c4ffd+0x2)+'):Goto('+(_0x1c4ffd+0x1)+')','context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85[_0x9a84('0x5')],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':_0x9a84('0xc'),'app':_0x9a84('0x9'),'appdata':_0xaffd85[_0x9a84('0xf')]?'CDR(prefix)=${EXTEN:0:'+_0xaffd85['cutdigits']+'}':_0x9a84('0x13'),'context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85['exten'],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':'outbound','app':_0x9a84('0x9'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85['exten'],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':_0x9a84('0xc'),'app':'Set','appdata':_0x9a84('0xa'),'context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85['exten'],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':_0x9a84('0xc'),'app':_0x9a84('0x9'),'appdata':'MONITOR_OPTIONS=ab','context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85[_0x9a84('0x5')],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':_0x9a84('0xc'),'app':_0x9a84('0x9'),'appdata':_0x9a84('0x14')+_0xaffd85['id'],'context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85[_0x9a84('0x5')],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']}];if(_0xaffd85[_0x9a84('0x15')]('recordingFormat')&&_0xaffd85[_0x9a84('0x16')]!==_0x9a84('0x17')){_0x4f5c46['push']({'type':_0x9a84('0xc'),'app':_0x9a84('0x9'),'appdata':_0x9a84('0x18'),'context':_0xaffd85['context'],'exten':_0xaffd85[_0x9a84('0x5')],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']},{'type':'outbound','app':_0x9a84('0x9'),'appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0xaffd85['recordingFormat']||'wav','context':_0xaffd85[_0x9a84('0x4')],'exten':_0xaffd85['exten'],'priority':_0x1c4ffd++,'VoiceExtensionId':_0xaffd85['id']});}return _0x4f5c46;}function _0x40b33c(_0x568221,_0x2860d1){var _0x3ba164=[{'name':_0x9a84('0x19'),'param':0x0},{'name':_0x9a84('0x1a'),'param':0x1},{'name':_0x9a84('0x1b'),'param':0x2},{'name':'url','param':0x3}];var _0x217c01={};var _0x25b008=_0x2860d1[_0x9a84('0x1c')](',');var _0x49d35f=[];for(var _0x59f383=0x0;_0x59f383<_0x3ba164[_0x9a84('0x1d')];_0x59f383++){switch(_0x3ba164[_0x59f383][_0x9a84('0x1e')]){case _0x9a84('0x19'):_0x217c01['trunk']=_0x25b008[_0x3ba164[_0x59f383][_0x9a84('0x1f')]][_0x9a84('0x1c')]('/')[0x1];_0x217c01[_0x9a84('0x20')]=_0x25b008[_0x3ba164[_0x59f383][_0x9a84('0x1f')]][_0x9a84('0x1c')]('/')[0x2];_0x217c01[_0x9a84('0x21')]=_0x217c01[_0x9a84('0x20')]?_0x217c01[_0x9a84('0x20')][_0x9a84('0x1c')]('$')[0x0]:undefined;_0x217c01[_0x9a84('0x20')]=_0x568221[_0x9a84('0xf')]?(_0x217c01['prefix']||'')+_0x9a84('0x22')+_0x568221[_0x9a84('0xf')]+'}':(_0x217c01[_0x9a84('0x21')]||'')+_0x9a84('0x10');_0x49d35f[_0x3ba164[_0x59f383][_0x9a84('0x1f')]]=[_0x9a84('0x23'),_0x217c01[_0x9a84('0x19')],_0x217c01[_0x9a84('0x20')]]['join']('/');break;case'options':_0x217c01['options']=_0x25b008[_0x3ba164[_0x59f383][_0x9a84('0x1f')]];if(_0x568221[_0x9a84('0x16')]!=='none'){if(_0x217c01[_0x9a84('0x1b')][_0x9a84('0x24')](_0x9a84('0x25'))<0x0){_0x217c01[_0x9a84('0x1b')]+=_0x9a84('0x25');}}else{_0x217c01[_0x9a84('0x1b')]=_0x217c01['options']['replace'](_0x9a84('0x25'),'');}_0x49d35f[_0x3ba164[_0x59f383][_0x9a84('0x1f')]]=_0x217c01[_0x9a84('0x1b')];break;default:_0x49d35f[_0x3ba164[_0x59f383][_0x9a84('0x1f')]]=_0x25b008[_0x3ba164[_0x59f383][_0x9a84('0x1f')]];}}return _0x49d35f[_0x9a84('0x26')](',');}function _0x15b722(_0x2c5c16,_0x33919d,_0x4491dd){return new Promise(function(_0x1315d2,_0x4f581a){var _0x4e6ebb=[];if(_[_0x9a84('0x27')](_0x33919d))return _0x1315d2(_0x4e6ebb);_0x4097f4['Interval'][_0x9a84('0x28')]({'attributes':['id',_0x9a84('0x29'),_0x9a84('0x2a')],'raw':!![]})[_0x9a84('0x2b')](function(_0x5db733){for(var _0x1b8eb1=0x0,_0x2039d=0x0;_0x1b8eb1<_0x33919d['length'];_0x1b8eb1++,_0x2039d=0x0){var _0x12aad0=_0x33919d[_0x1b8eb1];var _0x19fcb5=[];var _0x48116e=[];delete _0x12aad0['id'];if(_0x12aad0[_0x9a84('0x29')]!=='*,*,*,*'){_0x12aad0[_0x9a84('0x2c')]=[_0x12aad0[_0x9a84('0x29')]];}else{_0x12aad0[_0x9a84('0x2c')]=_0x12aad0[_0x9a84('0x2a')]?_[_0x9a84('0x2d')](_[_0x9a84('0x2e')](_0x5db733,{'IntervalId':_0x12aad0['IntervalId']}),'interval'):[];}_0x12aad0[_0x9a84('0x4')]=_0x2c5c16[_0x9a84('0x4')];_0x12aad0[_0x9a84('0x5')]=_0x2c5c16[_0x9a84('0x5')];if(_0x12aad0['type'])_0x12aad0[_0x9a84('0x2')]=_0x12aad0[_0x9a84('0x2')]['toLowerCase']();if(_0x2c5c16[_0x9a84('0x2')]===_0x9a84('0xc')){if(_0x12aad0[_0x9a84('0x15')](_0x9a84('0x2f'))&&_0x12aad0[_0x9a84('0x2f')]&&_0x12aad0[_0x9a84('0x2f')]!=='--'){_0x19fcb5[_0x9a84('0x8')]({'type':_0x12aad0[_0x9a84('0x2')]['toLowerCase'](),'app':_0x9a84('0x9'),'appdata':_0x9a84('0x30')+_0x12aad0[_0x9a84('0x2f')],'context':_0x2c5c16[_0x9a84('0x4')],'exten':_0x2c5c16[_0x9a84('0x5')],'priority':_0x12aad0['intervals'][_0x9a84('0x1d')]+_0x4491dd+_0x2039d++,'VoiceExtensionId':_0x2c5c16['id']});}_0x19fcb5[_0x9a84('0x8')]({'type':_0x12aad0[_0x9a84('0x2')][_0x9a84('0x31')](),'app':_0x9a84('0x11'),'appdata':_0x9a84('0x32')+(_0x12aad0[_0x9a84('0x33')]?_0x9a84('0x34')+_0x12aad0[_0x9a84('0x33')]+')':_0x9a84('0x35')),'context':_0x2c5c16[_0x9a84('0x4')],'exten':_0x2c5c16[_0x9a84('0x5')],'priority':_0x12aad0[_0x9a84('0x2c')][_0x9a84('0x1d')]+_0x4491dd+_0x2039d++,'VoiceExtensionId':_0x2c5c16['id']});}else{if(_0x12aad0[_0x9a84('0x15')](_0x9a84('0x36'))){if([_0x9a84('0x37'),'playback']['includes'](_0x12aad0['app']['toLowerCase']())&&_0x12aad0['appType']!==_0x9a84('0x38')){if(_0x12aad0['answer']){_0x19fcb5[_0x9a84('0x8')]({'type':_0x12aad0[_0x9a84('0x2')][_0x9a84('0x31')](),'app':'ExecIf','appdata':_0x9a84('0x39'),'context':_0x2c5c16['context'],'exten':_0x2c5c16['exten'],'priority':_0x12aad0['intervals'][_0x9a84('0x1d')]+_0x4491dd+_0x2039d++,'VoiceExtensionId':_0x2c5c16['id']});_0x19fcb5[_0x9a84('0x8')]({'type':_0x12aad0[_0x9a84('0x2')]['toLowerCase'](),'app':_0x9a84('0x9'),'appdata':_0x9a84('0x3a'),'context':_0x2c5c16['context'],'exten':_0x2c5c16[_0x9a84('0x5')],'priority':_0x12aad0['intervals']['length']+_0x4491dd+_0x2039d++,'VoiceExtensionId':_0x2c5c16['id']});}else{_0x19fcb5['push']({'type':_0x12aad0['type'][_0x9a84('0x31')](),'app':_0x9a84('0x11'),'appdata':_0x9a84('0x3b'),'context':_0x2c5c16[_0x9a84('0x4')],'exten':_0x2c5c16[_0x9a84('0x5')],'priority':_0x12aad0[_0x9a84('0x2c')][_0x9a84('0x1d')]+_0x4491dd+_0x2039d++,'VoiceExtensionId':_0x2c5c16['id']});_0x19fcb5[_0x9a84('0x8')]({'type':_0x12aad0['type'][_0x9a84('0x31')](),'app':_0x9a84('0x9'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x2c5c16['context'],'exten':_0x2c5c16[_0x9a84('0x5')],'priority':_0x12aad0['intervals']['length']+_0x4491dd+_0x2039d++,'VoiceExtensionId':_0x2c5c16['id']});}}}}for(var _0x10ebbe=0x0;_0x10ebbe<_0x12aad0[_0x9a84('0x2c')][_0x9a84('0x1d')];_0x10ebbe++){var _0xc98789=_0x4491dd+_0x12aad0['intervals']['length'];var _0x41c01c=_0x10ebbe===_0x12aad0['intervals'][_0x9a84('0x1d')]-0x1?_0x4491dd+_0x19fcb5[_0x9a84('0x1d')]+_0x48116e[_0x9a84('0x1d')]+0x2:_0x4491dd+_0x10ebbe+0x1;_0x19fcb5[_0x9a84('0x3c')](_0x10ebbe,0x0,{'type':_0x2c5c16[_0x9a84('0x2')],'app':_0x9a84('0x3d'),'appdata':_0x12aad0[_0x9a84('0x2c')][_0x10ebbe]+'?'+_0x2c5c16['context']+_0x9a84('0x3e')+_0xc98789+':'+_0x2c5c16[_0x9a84('0x4')]+',${EXTEN},'+_0x41c01c,'exten':_0x2c5c16[_0x9a84('0x5')],'context':_0x2c5c16[_0x9a84('0x4')],'priority':_0x4491dd+_0x10ebbe,'VoiceExtensionId':_0x2c5c16['id']});}if(_0x12aad0[_0x9a84('0x3f')]==='outboundDial'){_0x12aad0[_0x9a84('0x40')]=_0x40b33c(_0x2c5c16,_0x12aad0['appdata']);}if(_0x12aad0[_0x9a84('0x3f')]==='agi'){_0x19fcb5[_0x9a84('0x8')]({'type':_0x12aad0[_0x9a84('0x2')][_0x9a84('0x31')](),'app':'Set','appdata':_0x9a84('0x41'),'context':_0x2c5c16['context'],'exten':_0x2c5c16[_0x9a84('0x5')],'priority':_0x12aad0[_0x9a84('0x2c')][_0x9a84('0x1d')]+_0x4491dd+_0x2039d++,'VoiceExtensionId':_0x2c5c16['id']});}_0x12aad0[_0x9a84('0x42')]=_0x19fcb5[_0x9a84('0x1d')]?_[_0x9a84('0x43')](_0x19fcb5)[_0x9a84('0x42')]+0x1:_0x4491dd;_0x4e6ebb=_[_0x9a84('0x44')](_0x4e6ebb,_0x19fcb5,[_0x12aad0],_0x48116e);_0x4491dd=_['last'](_0x4e6ebb)[_0x9a84('0x42')]+0x1;}return _0x1315d2(_0x4e6ebb);})[_0x9a84('0x45')](function(_0x3d5f1b){_0x4f581a(_0x3d5f1b);});});}return _0x25fd20[_0x9a84('0x46')](_0x9a84('0x47'),attributes,{'tableName':_0x9a84('0x48'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4d85bc){var _0x2eaa62=this[_0x9a84('0x49')]({'plain':!![]});var _0x1fad79=_0x2eaa62['type']===_0x9a84('0xc')?_0x53476d(_0x2eaa62):_0x96b0(_0x2eaa62);return _0x15b722(_0x2eaa62,_0x4d85bc,_[_0x9a84('0x43')](_0x1fad79)['priority']+0x1)[_0x9a84('0x2b')](function(_0x5dae23){var _0x123b53=_['concat'](_0x1fad79,_0x5dae23);_0x123b53[_0x9a84('0x8')]({'type':_0x2eaa62[_0x9a84('0x2')],'app':'Hangup','exten':_0x2eaa62[_0x9a84('0x5')],'context':_0x2eaa62[_0x9a84('0x4')],'priority':_[_0x9a84('0x43')](_0x123b53)[_0x9a84('0x42')]+0x1,'VoiceExtensionId':_0x2eaa62['id']});return _0x123b53;});}}});}; \ No newline at end of file +var _0xd204=[',${EXTEN},','appdata','appType','agi','XMCS-UNIQUEID=${CHANNEL(LINKEDID)}','last','priority','define','voice_extensions','get','concat','Hangup','lodash','./voiceExtension.attributes','exports','models','type','Set','CDR(type)=','context','exten','inbound','push','CDR(routeid)=','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','CDR(type)=outbound','outbound','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-ANSWER=0','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','url','length','name','trunk','phone','param','split','prefix','options','indexOf','U(xcally-mixmonitor-context)','replace','join','isEmpty','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','toLowerCase','hasOwnProperty','tag','CDR(tag)=','callerID','Set(CALLERID(all)=','NoOp(No\x20number\x20available)','answer','queue','playback','includes','app','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime'];(function(_0x47be08,_0x1cc993){var _0x20fff7=function(_0x556d5b){while(--_0x556d5b){_0x47be08['push'](_0x47be08['shift']());}};_0x20fff7(++_0x1cc993);}(_0xd204,0x158));var _0x4d20=function(_0x701251,_0x39637e){_0x701251=_0x701251-0x0;var _0x4000b4=_0xd204[_0x701251];return _0x4000b4;};'use strict';var _=require(_0x4d20('0x0'));var attributes=require(_0x4d20('0x1'));module[_0x4d20('0x2')]=function(_0x4e1496){var _0x4dbac6=_0x4e1496[_0x4d20('0x3')];function _0x55fc79(_0x4728a6){var _0x14f8d2=0x2;var _0x6639b0=[{'type':_0x4728a6[_0x4d20('0x4')],'app':_0x4d20('0x5'),'appdata':_0x4d20('0x6')+_0x4728a6[_0x4d20('0x4')],'context':_0x4728a6[_0x4d20('0x7')],'exten':_0x4728a6[_0x4d20('0x8')],'priority':_0x14f8d2++,'VoiceExtensionId':_0x4728a6['id']}];if(_0x4728a6['type']===_0x4d20('0x9')){_0x6639b0[_0x4d20('0xa')]({'type':_0x4d20('0x9'),'app':_0x4d20('0x5'),'appdata':_0x4d20('0xb')+_0x4728a6['id'],'context':_0x4728a6[_0x4d20('0x7')],'exten':_0x4728a6[_0x4d20('0x8')],'priority':_0x14f8d2++,'VoiceExtensionId':_0x4728a6['id']});}_0x6639b0[_0x4d20('0xa')]({'type':_0x4728a6[_0x4d20('0x4')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=0','context':_0x4728a6[_0x4d20('0x7')],'exten':_0x4728a6[_0x4d20('0x8')],'priority':_0x14f8d2++,'VoiceExtensionId':_0x4728a6['id']},{'type':_0x4728a6['type'],'app':'Set','appdata':_0x4d20('0xc'),'context':_0x4728a6[_0x4d20('0x7')],'exten':_0x4728a6[_0x4d20('0x8')],'priority':_0x14f8d2++,'VoiceExtensionId':_0x4728a6['id']},{'type':_0x4728a6[_0x4d20('0x4')],'app':'Set','appdata':_0x4d20('0xd'),'context':_0x4728a6[_0x4d20('0x7')],'exten':_0x4728a6['exten'],'priority':_0x14f8d2++,'VoiceExtensionId':_0x4728a6['id']});return _0x6639b0;}function _0xcddd36(_0x5f60c5){var _0x2d27be=0x2;var _0x4f54e4=[{'type':'outbound','app':_0x4d20('0x5'),'appdata':_0x4d20('0xe'),'context':_0x5f60c5[_0x4d20('0x7')],'exten':_0x5f60c5['exten'],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':_0x4d20('0x5'),'appdata':_0x4d20('0x10')+(_0x5f60c5['cutdigits']?_0x4d20('0x11')+_0x5f60c5[_0x4d20('0x12')]+'}':_0x4d20('0x13')),'context':_0x5f60c5['context'],'exten':_0x5f60c5['exten'],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':_0x4d20('0x5'),'appdata':'CDR(routeid)='+_0x5f60c5['id'],'context':_0x5f60c5['context'],'exten':_0x5f60c5[_0x4d20('0x8')],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':'outbound','app':_0x4d20('0x14'),'appdata':_0x4d20('0x15')+(_0x2d27be+0x2)+'):Goto('+(_0x2d27be+0x1)+')','context':_0x5f60c5[_0x4d20('0x7')],'exten':_0x5f60c5[_0x4d20('0x8')],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':_0x4d20('0x5'),'appdata':_0x5f60c5[_0x4d20('0x12')]?_0x4d20('0x16')+_0x5f60c5[_0x4d20('0x12')]+'}':_0x4d20('0x17'),'context':_0x5f60c5['context'],'exten':_0x5f60c5['exten'],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':_0x4d20('0x5'),'appdata':_0x4d20('0x18'),'context':_0x5f60c5['context'],'exten':_0x5f60c5['exten'],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':'Set','appdata':_0x4d20('0xc'),'context':_0x5f60c5[_0x4d20('0x7')],'exten':_0x5f60c5[_0x4d20('0x8')],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':'Set','appdata':_0x4d20('0xd'),'context':_0x5f60c5[_0x4d20('0x7')],'exten':_0x5f60c5['exten'],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':'Set','appdata':'outboundrouteid='+_0x5f60c5['id'],'context':_0x5f60c5[_0x4d20('0x7')],'exten':_0x5f60c5[_0x4d20('0x8')],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']}];if(_0x5f60c5['hasOwnProperty'](_0x4d20('0x19'))&&_0x5f60c5[_0x4d20('0x19')]!==_0x4d20('0x1a')){_0x4f54e4[_0x4d20('0xa')]({'type':'outbound','app':_0x4d20('0x5'),'appdata':_0x4d20('0x1b'),'context':_0x5f60c5[_0x4d20('0x7')],'exten':_0x5f60c5[_0x4d20('0x8')],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']},{'type':_0x4d20('0xf'),'app':_0x4d20('0x5'),'appdata':_0x4d20('0x1c')+_0x5f60c5[_0x4d20('0x19')]||_0x4d20('0x1d'),'context':_0x5f60c5['context'],'exten':_0x5f60c5[_0x4d20('0x8')],'priority':_0x2d27be++,'VoiceExtensionId':_0x5f60c5['id']});}return _0x4f54e4;}function _0x3510df(_0x102384,_0x59c452){var _0x113c51=[{'name':'trunk','param':0x0},{'name':'timeout','param':0x1},{'name':'options','param':0x2},{'name':_0x4d20('0x1e'),'param':0x3}];var _0x1f5e51={};var _0x2692dc=_0x59c452['split'](',');var _0x575da2=[];for(var _0x1fb732=0x0;_0x1fb732<_0x113c51[_0x4d20('0x1f')];_0x1fb732++){switch(_0x113c51[_0x1fb732][_0x4d20('0x20')]){case _0x4d20('0x21'):_0x1f5e51['trunk']=_0x2692dc[_0x113c51[_0x1fb732]['param']]['split']('/')[0x1];_0x1f5e51[_0x4d20('0x22')]=_0x2692dc[_0x113c51[_0x1fb732][_0x4d20('0x23')]][_0x4d20('0x24')]('/')[0x2];_0x1f5e51['prefix']=_0x1f5e51[_0x4d20('0x22')]?_0x1f5e51['phone'][_0x4d20('0x24')]('$')[0x0]:undefined;_0x1f5e51[_0x4d20('0x22')]=_0x102384['cutdigits']?(_0x1f5e51[_0x4d20('0x25')]||'')+'${EXTEN:'+_0x102384[_0x4d20('0x12')]+'}':(_0x1f5e51[_0x4d20('0x25')]||'')+_0x4d20('0x13');_0x575da2[_0x113c51[_0x1fb732][_0x4d20('0x23')]]=['SIP',_0x1f5e51['trunk'],_0x1f5e51[_0x4d20('0x22')]]['join']('/');break;case _0x4d20('0x26'):_0x1f5e51[_0x4d20('0x26')]=_0x2692dc[_0x113c51[_0x1fb732][_0x4d20('0x23')]];if(_0x102384[_0x4d20('0x19')]!==_0x4d20('0x1a')){if(_0x1f5e51['options'][_0x4d20('0x27')]('U(xcally-mixmonitor-context)')<0x0){_0x1f5e51[_0x4d20('0x26')]+=_0x4d20('0x28');}}else{_0x1f5e51[_0x4d20('0x26')]=_0x1f5e51[_0x4d20('0x26')][_0x4d20('0x29')](_0x4d20('0x28'),'');}_0x575da2[_0x113c51[_0x1fb732][_0x4d20('0x23')]]=_0x1f5e51[_0x4d20('0x26')];break;default:_0x575da2[_0x113c51[_0x1fb732][_0x4d20('0x23')]]=_0x2692dc[_0x113c51[_0x1fb732][_0x4d20('0x23')]];}}return _0x575da2[_0x4d20('0x2a')](',');}function _0x3e96b8(_0x3d0d4d,_0xdd8f04,_0xca60e4){return new Promise(function(_0x4c261a,_0x4353ba){var _0x1845d7=[];if(_[_0x4d20('0x2b')](_0xdd8f04))return _0x4c261a(_0x1845d7);_0x4dbac6[_0x4d20('0x2c')][_0x4d20('0x2d')]({'attributes':['id',_0x4d20('0x2e'),_0x4d20('0x2f')],'raw':!![]})[_0x4d20('0x30')](function(_0x26da93){for(var _0x425b2b=0x0,_0x403726=0x0;_0x425b2b<_0xdd8f04[_0x4d20('0x1f')];_0x425b2b++,_0x403726=0x0){var _0x28bb96=_0xdd8f04[_0x425b2b];var _0x34c8b1=[];var _0x31336e=[];delete _0x28bb96['id'];if(_0x28bb96[_0x4d20('0x2e')]!==_0x4d20('0x31')){_0x28bb96[_0x4d20('0x32')]=[_0x28bb96[_0x4d20('0x2e')]];}else{_0x28bb96['intervals']=_0x28bb96[_0x4d20('0x2f')]?_[_0x4d20('0x33')](_['filter'](_0x26da93,{'IntervalId':_0x28bb96[_0x4d20('0x2f')]}),_0x4d20('0x2e')):[];}_0x28bb96[_0x4d20('0x7')]=_0x3d0d4d[_0x4d20('0x7')];_0x28bb96[_0x4d20('0x8')]=_0x3d0d4d[_0x4d20('0x8')];if(_0x28bb96[_0x4d20('0x4')])_0x28bb96[_0x4d20('0x4')]=_0x28bb96[_0x4d20('0x4')][_0x4d20('0x34')]();if(_0x3d0d4d[_0x4d20('0x4')]==='outbound'){if(_0x28bb96[_0x4d20('0x35')]('tag')&&_0x28bb96[_0x4d20('0x36')]&&_0x28bb96[_0x4d20('0x36')]!=='--'){_0x34c8b1['push']({'type':_0x28bb96[_0x4d20('0x4')][_0x4d20('0x34')](),'app':_0x4d20('0x5'),'appdata':_0x4d20('0x37')+_0x28bb96[_0x4d20('0x36')],'context':_0x3d0d4d[_0x4d20('0x7')],'exten':_0x3d0d4d[_0x4d20('0x8')],'priority':_0x28bb96['intervals'][_0x4d20('0x1f')]+_0xca60e4+_0x403726++,'VoiceExtensionId':_0x3d0d4d['id']});}_0x34c8b1[_0x4d20('0xa')]({'type':_0x28bb96['type'][_0x4d20('0x34')](),'app':_0x4d20('0x14'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x28bb96[_0x4d20('0x38')]?_0x4d20('0x39')+_0x28bb96[_0x4d20('0x38')]+')':_0x4d20('0x3a')),'context':_0x3d0d4d[_0x4d20('0x7')],'exten':_0x3d0d4d[_0x4d20('0x8')],'priority':_0x28bb96['intervals'][_0x4d20('0x1f')]+_0xca60e4+_0x403726++,'VoiceExtensionId':_0x3d0d4d['id']});}else{if(_0x28bb96[_0x4d20('0x35')](_0x4d20('0x3b'))){if([_0x4d20('0x3c'),_0x4d20('0x3d')][_0x4d20('0x3e')](_0x28bb96[_0x4d20('0x3f')][_0x4d20('0x34')]())&&_0x28bb96['appType']!==_0x4d20('0x40')){if(_0x28bb96['answer']){_0x34c8b1['push']({'type':_0x28bb96[_0x4d20('0x4')][_0x4d20('0x34')](),'app':_0x4d20('0x14'),'appdata':_0x4d20('0x41'),'context':_0x3d0d4d[_0x4d20('0x7')],'exten':_0x3d0d4d[_0x4d20('0x8')],'priority':_0x28bb96[_0x4d20('0x32')]['length']+_0xca60e4+_0x403726++,'VoiceExtensionId':_0x3d0d4d['id']});_0x34c8b1[_0x4d20('0xa')]({'type':_0x28bb96['type']['toLowerCase'](),'app':'Set','appdata':_0x4d20('0x42'),'context':_0x3d0d4d[_0x4d20('0x7')],'exten':_0x3d0d4d['exten'],'priority':_0x28bb96[_0x4d20('0x32')][_0x4d20('0x1f')]+_0xca60e4+_0x403726++,'VoiceExtensionId':_0x3d0d4d['id']});}else{_0x34c8b1['push']({'type':_0x28bb96[_0x4d20('0x4')]['toLowerCase'](),'app':_0x4d20('0x14'),'appdata':_0x4d20('0x43'),'context':_0x3d0d4d[_0x4d20('0x7')],'exten':_0x3d0d4d[_0x4d20('0x8')],'priority':_0x28bb96[_0x4d20('0x32')]['length']+_0xca60e4+_0x403726++,'VoiceExtensionId':_0x3d0d4d['id']});_0x34c8b1[_0x4d20('0xa')]({'type':_0x28bb96[_0x4d20('0x4')]['toLowerCase'](),'app':_0x4d20('0x5'),'appdata':_0x4d20('0x44'),'context':_0x3d0d4d[_0x4d20('0x7')],'exten':_0x3d0d4d['exten'],'priority':_0x28bb96[_0x4d20('0x32')][_0x4d20('0x1f')]+_0xca60e4+_0x403726++,'VoiceExtensionId':_0x3d0d4d['id']});}}}}for(var _0x55dee1=0x0;_0x55dee1<_0x28bb96[_0x4d20('0x32')][_0x4d20('0x1f')];_0x55dee1++){var _0x5c27f8=_0xca60e4+_0x28bb96[_0x4d20('0x32')]['length'];var _0x5b3878=_0x55dee1===_0x28bb96[_0x4d20('0x32')][_0x4d20('0x1f')]-0x1?_0xca60e4+_0x34c8b1[_0x4d20('0x1f')]+_0x31336e[_0x4d20('0x1f')]+0x2:_0xca60e4+_0x55dee1+0x1;_0x34c8b1[_0x4d20('0x45')](_0x55dee1,0x0,{'type':_0x3d0d4d[_0x4d20('0x4')],'app':_0x4d20('0x46'),'appdata':_0x28bb96[_0x4d20('0x32')][_0x55dee1]+'?'+_0x3d0d4d['context']+_0x4d20('0x47')+_0x5c27f8+':'+_0x3d0d4d['context']+_0x4d20('0x47')+_0x5b3878,'exten':_0x3d0d4d[_0x4d20('0x8')],'context':_0x3d0d4d[_0x4d20('0x7')],'priority':_0xca60e4+_0x55dee1,'VoiceExtensionId':_0x3d0d4d['id']});}if(_0x28bb96['appType']==='outboundDial'){_0x28bb96[_0x4d20('0x48')]=_0x3510df(_0x3d0d4d,_0x28bb96['appdata']);}if(_0x28bb96[_0x4d20('0x49')]===_0x4d20('0x4a')){_0x34c8b1[_0x4d20('0xa')]({'type':_0x28bb96[_0x4d20('0x4')][_0x4d20('0x34')](),'app':_0x4d20('0x5'),'appdata':_0x4d20('0x4b'),'context':_0x3d0d4d[_0x4d20('0x7')],'exten':_0x3d0d4d[_0x4d20('0x8')],'priority':_0x28bb96[_0x4d20('0x32')][_0x4d20('0x1f')]+_0xca60e4+_0x403726++,'VoiceExtensionId':_0x3d0d4d['id']});}_0x28bb96['priority']=_0x34c8b1[_0x4d20('0x1f')]?_[_0x4d20('0x4c')](_0x34c8b1)[_0x4d20('0x4d')]+0x1:_0xca60e4;_0x1845d7=_['concat'](_0x1845d7,_0x34c8b1,[_0x28bb96],_0x31336e);_0xca60e4=_[_0x4d20('0x4c')](_0x1845d7)[_0x4d20('0x4d')]+0x1;}return _0x4c261a(_0x1845d7);})['catch'](function(_0x2bd67d){_0x4353ba(_0x2bd67d);});});}return _0x4e1496[_0x4d20('0x4e')]('VoiceExtension',attributes,{'tableName':_0x4d20('0x4f'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xe6b2e){var _0x3f2eeb=this[_0x4d20('0x50')]({'plain':!![]});var _0x3235cd=_0x3f2eeb[_0x4d20('0x4')]===_0x4d20('0xf')?_0xcddd36(_0x3f2eeb):_0x55fc79(_0x3f2eeb);return _0x3e96b8(_0x3f2eeb,_0xe6b2e,_[_0x4d20('0x4c')](_0x3235cd)['priority']+0x1)[_0x4d20('0x30')](function(_0x300b6c){var _0x218e41=_[_0x4d20('0x51')](_0x3235cd,_0x300b6c);_0x218e41[_0x4d20('0xa')]({'type':_0x3f2eeb[_0x4d20('0x4')],'app':_0x4d20('0x52'),'exten':_0x3f2eeb['exten'],'context':_0x3f2eeb[_0x4d20('0x7')],'priority':_[_0x4d20('0x4c')](_0x218e41)[_0x4d20('0x4d')]+0x1,'VoiceExtensionId':_0x3f2eeb['id']});return _0x218e41;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index 7abced9..cdb6a86 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 _0x01db=['bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./voiceExtension.socket','register','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','stringify','catch','lodash'];(function(_0x28557d,_0x572726){var _0xe70a73=function(_0x17f657){while(--_0x17f657){_0x28557d['push'](_0x28557d['shift']());}};_0xe70a73(++_0x572726);}(_0x01db,0x171));var _0xb01d=function(_0x3624b3,_0x19fb6a){_0x3624b3=_0x3624b3-0x0;var _0xd3a448=_0x01db[_0x3624b3];return _0xd3a448;};'use strict';var _=require(_0xb01d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb01d('0x1'));var rs=require(_0xb01d('0x2'));var fs=require('fs');var Redis=require(_0xb01d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb01d('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb01d('0x5'));var jayson=require(_0xb01d('0x6'));var client=jayson[_0xb01d('0x7')][_0xb01d('0x8')]({'port':0x232a});config[_0xb01d('0x9')]=_[_0xb01d('0xa')](config[_0xb01d('0x9')],{'host':_0xb01d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb01d('0xc'))[_0xb01d('0xd')](socket);function respondWithRpcPromise(_0x28e0fc,_0x3b2de4,_0x147b7b){return new BPromise(function(_0x9112c1,_0x4eb866){return client['request'](_0x28e0fc,_0x147b7b)[_0xb01d('0xe')](function(_0x1b59b9){logger[_0xb01d('0xf')](_0xb01d('0x10'),_0x3b2de4,_0xb01d('0x11'));logger[_0xb01d('0x12')](_0xb01d('0x13'),_0x3b2de4,'request\x20sent',JSON['stringify'](_0x1b59b9));if(_0x1b59b9[_0xb01d('0x14')]){if(_0x1b59b9['error'][_0xb01d('0x15')]===0x1f4){logger[_0xb01d('0x14')]('VoiceExtension,\x20%s,\x20%s',_0x3b2de4,_0x1b59b9[_0xb01d('0x14')][_0xb01d('0x16')]);return _0x4eb866(_0x1b59b9[_0xb01d('0x14')][_0xb01d('0x16')]);}logger['error'](_0xb01d('0x10'),_0x3b2de4,_0x1b59b9['error'][_0xb01d('0x16')]);return _0x9112c1(_0x1b59b9[_0xb01d('0x14')][_0xb01d('0x16')]);}else{logger[_0xb01d('0xf')]('VoiceExtension,\x20%s,\x20%s',_0x3b2de4,_0xb01d('0x11'));_0x9112c1(_0x1b59b9[_0xb01d('0x17')][_0xb01d('0x16')]);}})['catch'](function(_0x210023){logger['error'](_0xb01d('0x10'),_0x3b2de4,_0x210023);_0x4eb866(_0x210023);});});}exports[_0xb01d('0x18')]=function(_0x3e96ef){var _0x28a6a7=this;return new Promise(function(_0x3d5c9d,_0x4d517e){return db[_0xb01d('0x19')][_0xb01d('0x1a')]({'raw':_0x3e96ef[_0xb01d('0x1b')]?_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x1c')]===undefined?!![]:![]:!![],'where':_0x3e96ef[_0xb01d('0x1b')]?_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x1d')]||null:null,'attributes':_0x3e96ef[_0xb01d('0x1b')]?_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x1e')]||null:null,'limit':_0x3e96ef[_0xb01d('0x1b')]?_0x3e96ef['options'][_0xb01d('0x1f')]||null:null,'include':_0x3e96ef['options']?_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x20')]?_[_0xb01d('0x21')](_0x3e96ef[_0xb01d('0x1b')][_0xb01d('0x20')],function(_0x1d8f04){return{'model':db[_0x1d8f04[_0xb01d('0x22')]],'as':_0x1d8f04['as'],'attributes':_0x1d8f04[_0xb01d('0x1e')],'include':_0x1d8f04[_0xb01d('0x20')]?_[_0xb01d('0x21')](_0x1d8f04[_0xb01d('0x20')],function(_0x531d37){return{'model':db[_0x531d37[_0xb01d('0x22')]],'as':_0x531d37['as'],'attributes':_0x531d37[_0xb01d('0x1e')],'include':_0x531d37[_0xb01d('0x20')]?_['map'](_0x531d37[_0xb01d('0x20')],function(_0x1bd8d2){return{'model':db[_0x1bd8d2[_0xb01d('0x22')]],'as':_0x1bd8d2['as'],'attributes':_0x1bd8d2['attributes']};}):[]};}):[]};}):[]:[]})[_0xb01d('0xe')](function(_0x5007d1){logger[_0xb01d('0xf')](_0xb01d('0x18'),_0x3e96ef);logger[_0xb01d('0x12')]('GetVoiceExtension',_0x3e96ef,JSON[_0xb01d('0x23')](_0x5007d1));_0x3d5c9d(_0x5007d1);})[_0xb01d('0x24')](function(_0x1666a1){logger[_0xb01d('0x14')](_0xb01d('0x18'),_0x1666a1[_0xb01d('0x16')],_0x3e96ef);_0x4d517e(_0x28a6a7['error'](0x1f4,_0x1666a1[_0xb01d('0x16')]));});});}; \ No newline at end of file +var _0xa63f=['options','raw','where','limit','include','map','model','attributes','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','redis','defaults','./voiceExtension.socket','register','request','then','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','error','code','message','result','GetVoiceExtension','VoiceExtension','findAll'];(function(_0x871074,_0x4bbb29){var _0x16e8ce=function(_0x1a6fe1){while(--_0x1a6fe1){_0x871074['push'](_0x871074['shift']());}};_0x16e8ce(++_0x4bbb29);}(_0xa63f,0x1b6));var _0xfa63=function(_0x3c414c,_0x399dbb){_0x3c414c=_0x3c414c-0x0;var _0x4f3062=_0xa63f[_0x3c414c];return _0x4f3062;};'use strict';var _=require(_0xfa63('0x0'));var util=require(_0xfa63('0x1'));var moment=require(_0xfa63('0x2'));var BPromise=require(_0xfa63('0x3'));var rs=require(_0xfa63('0x4'));var fs=require('fs');var Redis=require(_0xfa63('0x5'));var db=require(_0xfa63('0x6'))['db'];var utils=require(_0xfa63('0x7'));var logger=require(_0xfa63('0x8'))(_0xfa63('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfa63('0xa')][_0xfa63('0xb')]({'port':0x232a});config[_0xfa63('0xc')]=_[_0xfa63('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfa63('0xc')]));require(_0xfa63('0xe'))[_0xfa63('0xf')](socket);function respondWithRpcPromise(_0x47d90d,_0x181fec,_0x57faed){return new BPromise(function(_0xfcb3d1,_0x4b1959){return client[_0xfa63('0x10')](_0x47d90d,_0x57faed)[_0xfa63('0x11')](function(_0x3e5bfc){logger[_0xfa63('0x12')](_0xfa63('0x13'),_0x181fec,_0xfa63('0x14'));logger[_0xfa63('0x15')](_0xfa63('0x16'),_0x181fec,'request\x20sent',JSON['stringify'](_0x3e5bfc));if(_0x3e5bfc[_0xfa63('0x17')]){if(_0x3e5bfc[_0xfa63('0x17')][_0xfa63('0x18')]===0x1f4){logger['error'](_0xfa63('0x13'),_0x181fec,_0x3e5bfc['error'][_0xfa63('0x19')]);return _0x4b1959(_0x3e5bfc[_0xfa63('0x17')]['message']);}logger[_0xfa63('0x17')](_0xfa63('0x13'),_0x181fec,_0x3e5bfc[_0xfa63('0x17')][_0xfa63('0x19')]);return _0xfcb3d1(_0x3e5bfc[_0xfa63('0x17')][_0xfa63('0x19')]);}else{logger['info'](_0xfa63('0x13'),_0x181fec,_0xfa63('0x14'));_0xfcb3d1(_0x3e5bfc[_0xfa63('0x1a')][_0xfa63('0x19')]);}})['catch'](function(_0x58211b){logger[_0xfa63('0x17')](_0xfa63('0x13'),_0x181fec,_0x58211b);_0x4b1959(_0x58211b);});});}exports[_0xfa63('0x1b')]=function(_0x3cc2b5){var _0x54b438=this;return new Promise(function(_0x591c35,_0x17e929){return db[_0xfa63('0x1c')][_0xfa63('0x1d')]({'raw':_0x3cc2b5[_0xfa63('0x1e')]?_0x3cc2b5[_0xfa63('0x1e')][_0xfa63('0x1f')]===undefined?!![]:![]:!![],'where':_0x3cc2b5['options']?_0x3cc2b5[_0xfa63('0x1e')][_0xfa63('0x20')]||null:null,'attributes':_0x3cc2b5[_0xfa63('0x1e')]?_0x3cc2b5[_0xfa63('0x1e')]['attributes']||null:null,'limit':_0x3cc2b5[_0xfa63('0x1e')]?_0x3cc2b5['options'][_0xfa63('0x21')]||null:null,'include':_0x3cc2b5['options']?_0x3cc2b5['options'][_0xfa63('0x22')]?_[_0xfa63('0x23')](_0x3cc2b5[_0xfa63('0x1e')][_0xfa63('0x22')],function(_0x4799fb){return{'model':db[_0x4799fb[_0xfa63('0x24')]],'as':_0x4799fb['as'],'attributes':_0x4799fb[_0xfa63('0x25')],'include':_0x4799fb[_0xfa63('0x22')]?_[_0xfa63('0x23')](_0x4799fb['include'],function(_0x3602cb){return{'model':db[_0x3602cb[_0xfa63('0x24')]],'as':_0x3602cb['as'],'attributes':_0x3602cb[_0xfa63('0x25')],'include':_0x3602cb[_0xfa63('0x22')]?_['map'](_0x3602cb[_0xfa63('0x22')],function(_0x7b0c2e){return{'model':db[_0x7b0c2e[_0xfa63('0x24')]],'as':_0x7b0c2e['as'],'attributes':_0x7b0c2e[_0xfa63('0x25')]};}):[]};}):[]};}):[]:[]})[_0xfa63('0x11')](function(_0x2f499a){logger[_0xfa63('0x12')](_0xfa63('0x1b'),_0x3cc2b5);logger[_0xfa63('0x15')](_0xfa63('0x1b'),_0x3cc2b5,JSON['stringify'](_0x2f499a));_0x591c35(_0x2f499a);})[_0xfa63('0x26')](function(_0x36964e){logger[_0xfa63('0x17')](_0xfa63('0x1b'),_0x36964e['message'],_0x3cc2b5);_0x17e929(_0x54b438[_0xfa63('0x17')](0x1f4,_0x36964e['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index ae3d8cb..9d862b6 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 _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x38dcd6,_0x4e10b8){var _0x108b96=function(_0x3499b5){while(--_0x3499b5){_0x38dcd6['push'](_0x38dcd6['shift']());}};_0x108b96(++_0x4e10b8);}(_0x1261,0x144));var _0x1126=function(_0x1894e7,_0x1253e6){_0x1894e7=_0x1894e7-0x0;var _0x5e857f=_0x1261[_0x1894e7];return _0x5e857f;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file +var _0x1261=['save','remove','update','emit','removeListener','voiceExtension:'];(function(_0x4ce734,_0x13b00d){var _0x17cd46=function(_0x388b29){while(--_0x388b29){_0x4ce734['push'](_0x4ce734['shift']());}};_0x17cd46(++_0x13b00d);}(_0x1261,0x144));var _0x1126=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0x1261[_0x49aa7d];return _0xdd0d26;};'use strict';var VoiceExtensionEvents=require('./voiceExtension.events');var events=[_0x1126('0x0'),_0x1126('0x1'),_0x1126('0x2')];function createListener(_0x331a2c,_0x39b786){return function(_0x350f3a){_0x39b786[_0x1126('0x3')](_0x331a2c,_0x350f3a);};}function removeListener(_0x4245ca,_0x21a480){return function(){VoiceExtensionEvents[_0x1126('0x4')](_0x4245ca,_0x21a480);};}exports['register']=function(_0x5c68c8){for(var _0x40ba58=0x0,_0x907180=events['length'];_0x40ba58<_0x907180;_0x40ba58++){var _0x17e5f0=events[_0x40ba58];var _0x28772d=createListener(_0x1126('0x5')+_0x17e5f0,_0x5c68c8);VoiceExtensionEvents['on'](_0x17e5f0,_0x28772d);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index e911fd4..d1b21d4 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 _0x741c=['get','isAuthenticated','index','/:id','/:id/messages','getMessages','create','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./voiceMail.controller'];(function(_0x19e4ad,_0x4d38e5){var _0xdaa38f=function(_0x46dd08){while(--_0x46dd08){_0x19e4ad['push'](_0x19e4ad['shift']());}};_0xdaa38f(++_0x4d38e5);}(_0x741c,0x196));var _0xc741=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x741c[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['show']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xc741('0xe')]);router[_0xc741('0xf')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);router[_0xc741('0x11')](_0xc741('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf2e3=['/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMail.controller','isAuthenticated','index','get'];(function(_0x21c88b,_0x24017d){var _0x3add90=function(_0x3c27b4){while(--_0x3c27b4){_0x21c88b['push'](_0x21c88b['shift']());}};_0x3add90(++_0x24017d);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xf2e3[_0x17406a];return _0x1501ff;};'use strict';var multer=require(_0x3f2e('0x0'));var util=require('util');var path=require(_0x3f2e('0x1'));var timeout=require(_0x3f2e('0x2'));var express=require(_0x3f2e('0x3'));var router=express[_0x3f2e('0x4')]();var fs_extra=require(_0x3f2e('0x5'));var auth=require(_0x3f2e('0x6'));var interaction=require(_0x3f2e('0x7'));var config=require(_0x3f2e('0x8'));var controller=require(_0x3f2e('0x9'));router['get']('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xb')]);router[_0x3f2e('0xc')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0xe')]);router[_0x3f2e('0xc')](_0x3f2e('0xf'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x10')]);router[_0x3f2e('0x11')]('/',auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x12')]);router[_0x3f2e('0x13')](_0x3f2e('0xd'),auth[_0x3f2e('0xa')](),controller[_0x3f2e('0x14')]);router[_0x3f2e('0x15')](_0x3f2e('0xd'),auth['isAuthenticated'](),controller[_0x3f2e('0x16')]);module[_0x3f2e('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 4c42f67..b9ecf79 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 _0x8420=['ENUM','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','STRING','from-voicemail','contest_mailbox','email','string','trim','yes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8420,0x168));var _0x0842=function(_0x5c6bea,_0x32035c){_0x5c6bea=_0x5c6bea-0x0;var _0x5aefa8=_0x8420[_0x5c6bea];return _0x5aefa8;};'use strict';var Sequelize=require(_0x0842('0x0'));module['exports']={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0842('0x1')],'defaultValue':_0x0842('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'','allowNull':![],'unique':_0x0842('0x3')},'password':{'type':Sequelize[_0x0842('0x1')]},'fullname':{'type':Sequelize[_0x0842('0x1')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x3bdf2c){this['setDataValue'](_0x0842('0x4'),typeof _0x3bdf2c===_0x0842('0x5')&&_0x3bdf2c['trim']()?_0x3bdf2c[_0x0842('0x6')]():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0x0842('0x7'),'no'),'defaultValue':_0x0842('0x7'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x0842('0x7'),'no'),'defaultValue':_0x0842('0x7'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x0842('0x1')]},'review':{'type':Sequelize[_0x0842('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x0842('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0x0842('0x7'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x0842('0x8')](_0x0842('0x7'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x0842('0x8')](_0x0842('0x7'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x0842('0x8')](_0x0842('0x7'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x0842('0x8')](_0x0842('0x7'),'no'),'defaultValue':_0x0842('0x7'),'allowNull':![]},'forcename':{'type':Sequelize[_0x0842('0x8')](_0x0842('0x7'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x0842('0x8')](_0x0842('0x7'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x0842('0x8')](_0x0842('0x7'),'no'),'defaultValue':_0x0842('0x7'),'allowNull':![]},'stamp':{'type':_0x0842('0x9')},'emailsubject':{'type':Sequelize[_0x0842('0x1')]},'emailbody':{'type':Sequelize[_0x0842('0x1')]},'maxsecs':{'type':Sequelize[_0x0842('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x0842('0xa')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x0842('0xb')],'get':function(){return this[_0x0842('0xc')](_0x0842('0xd'))+_0x0842('0xe')+this[_0x0842('0xc')](_0x0842('0xf'));}}}; \ No newline at end of file +var _0x58cc=['contest_mailbox','setDataValue','email','string','trim','central','ENUM','yes','TINYINT(4)','VIRTUAL','\x20-\x20','getDataValue','sequelize','exports','STRING'];(function(_0x5acb94,_0x389dbc){var _0x11800a=function(_0xd36856){while(--_0xd36856){_0x5acb94['push'](_0x5acb94['shift']());}};_0x11800a(++_0x389dbc);}(_0x58cc,0x1bf));var _0xc58c=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x58cc[_0x1e2321];return _0x1d346d;};'use strict';var Sequelize=require(_0xc58c('0x0'));module[_0xc58c('0x1')]={'customer_id':{'type':Sequelize[_0xc58c('0x2')]},'context':{'type':Sequelize[_0xc58c('0x2')],'defaultValue':'from-voicemail','unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xc58c('0x2')],'defaultValue':'','allowNull':![],'unique':_0xc58c('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xc58c('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x16043b){this[_0xc58c('0x4')](_0xc58c('0x5'),typeof _0x16043b===_0xc58c('0x6')&&_0x16043b[_0xc58c('0x7')]()?_0x16043b[_0xc58c('0x7')]():null);}},'pager':{'type':Sequelize[_0xc58c('0x2')]},'tz':{'type':Sequelize[_0xc58c('0x2')],'defaultValue':_0xc58c('0x8')},'attach':{'type':Sequelize[_0xc58c('0x9')](_0xc58c('0xa'),'no'),'defaultValue':_0xc58c('0xa'),'allowNull':![]},'saycid':{'type':Sequelize[_0xc58c('0x9')](_0xc58c('0xa'),'no'),'defaultValue':_0xc58c('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0xc58c('0x2')]},'callback':{'type':Sequelize[_0xc58c('0x2')]},'review':{'type':Sequelize[_0xc58c('0x9')](_0xc58c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xc58c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xc58c('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xc58c('0x9')](_0xc58c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xc58c('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize['ENUM'](_0xc58c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xc58c('0x9')](_0xc58c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xc58c('0x9')]('yes','no'),'defaultValue':_0xc58c('0xa'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xc58c('0x9')](_0xc58c('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xc58c('0x9')](_0xc58c('0xa'),'no'),'defaultValue':_0xc58c('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xc58c('0x2')]},'emailbody':{'type':Sequelize[_0xc58c('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xc58c('0xc')],'get':function(){return this['getDataValue']('fullname')+_0xc58c('0xd')+this[_0xc58c('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index e16fb52..70ff737 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 _0x9c00=['name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','offset','order','sort','pick','filter','merge','where','VIRTUAL','options','VoiceMail','includeAll','include','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getMessages','findOne','VoiceMailMessage','mailbox','findAndCountAll','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','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','json','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','Voicemails','UserProfileResource','then','stack'];(function(_0x4d08d3,_0x5322ac){var _0x50a75e=function(_0x4ff67a){while(--_0x4ff67a){_0x4d08d3['push'](_0x4d08d3['shift']());}};_0x50a75e(++_0x5322ac);}(_0x9c00,0x1a0));var _0x09c0=function(_0x2d284c,_0x59aa64){_0x2d284c=_0x2d284c-0x0;var _0x4f5756=_0x9c00[_0x2d284c];return _0x4f5756;};'use strict';var emlformat=require(_0x09c0('0x0'));var rimraf=require(_0x09c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x09c0('0x2'));var moment=require(_0x09c0('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x09c0('0x4'));var util=require(_0x09c0('0x5'));var path=require(_0x09c0('0x6'));var sox=require(_0x09c0('0x7'));var csv=require(_0x09c0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09c0('0x9'));var squel=require(_0x09c0('0xa'));var crypto=require(_0x09c0('0xb'));var jsforce=require(_0x09c0('0xc'));var deskjs=require(_0x09c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x09c0('0xe'));var Papa=require(_0x09c0('0xf'));var Redis=require(_0x09c0('0x10'));var authService=require(_0x09c0('0x11'));var qs=require(_0x09c0('0x12'));var as=require(_0x09c0('0x13'));var hardwareService=require(_0x09c0('0x14'));var logger=require(_0x09c0('0x15'))(_0x09c0('0x16'));var utils=require(_0x09c0('0x17'));var config=require(_0x09c0('0x18'));var licenseUtil=require(_0x09c0('0x19'));var db=require(_0x09c0('0x1a'))['db'];function respondWithStatusCode(_0x144271,_0x3b95cc){_0x3b95cc=_0x3b95cc||0xcc;return function(_0x331905){if(_0x331905){return _0x144271[_0x09c0('0x1b')](_0x3b95cc);}return _0x144271[_0x09c0('0x1c')](_0x3b95cc)[_0x09c0('0x1d')]();};}function respondWithResult(_0x3649d2,_0x16e490){_0x16e490=_0x16e490||0xc8;return function(_0x254598){if(_0x254598){return _0x3649d2[_0x09c0('0x1c')](_0x16e490)[_0x09c0('0x1e')](_0x254598);}};}function respondWithFilteredResult(_0x33c3d6,_0x2fdf11){return function(_0x4ff6b7){if(_0x4ff6b7){var _0x590129=typeof _0x2fdf11['offset']===_0x09c0('0x1f')&&typeof _0x2fdf11[_0x09c0('0x20')]===_0x09c0('0x1f');var _0x628272=_0x4ff6b7['count'];var _0x2c4440=_0x590129?0x0:_0x2fdf11['offset'];var _0x4c29a7=_0x590129?_0x4ff6b7[_0x09c0('0x21')]:_0x2fdf11['offset']+_0x2fdf11[_0x09c0('0x20')];var _0x319c36;if(_0x4c29a7>=_0x628272){_0x4c29a7=_0x628272;_0x319c36=0xc8;}else{_0x319c36=0xce;}_0x33c3d6[_0x09c0('0x1c')](_0x319c36);return _0x33c3d6['set'](_0x09c0('0x22'),_0x2c4440+'-'+_0x4c29a7+'/'+_0x628272)[_0x09c0('0x1e')](_0x4ff6b7);}return null;};}function patchUpdates(_0x8ad645){return function(_0x3447c5){try{jsonpatch[_0x09c0('0x23')](_0x3447c5,_0x8ad645,!![]);}catch(_0xa5d16f){return BPromise[_0x09c0('0x24')](_0xa5d16f);}return _0x3447c5['save']();};}function saveUpdates(_0x1695e8,_0x46f171){return function(_0x473fbd){if(_0x473fbd){return _0x473fbd[_0x09c0('0x25')](_0x1695e8)['then'](function(_0x4f6824){return _0x4f6824;});}return null;};}function removeEntity(_0x321bcc,_0x25fdb5){return function(_0x1e8a1c){if(_0x1e8a1c){return _0x1e8a1c[_0x09c0('0x26')]()['then'](function(){var _0x42ebfc=_0x1e8a1c[_0x09c0('0x27')]({'plain':!![]});var _0x56d883=_0x09c0('0x28');return db[_0x09c0('0x29')][_0x09c0('0x26')]({'where':{'type':_0x56d883,'resourceId':_0x42ebfc['id']}})[_0x09c0('0x2a')](function(){return _0x1e8a1c;});})[_0x09c0('0x2a')](function(){_0x321bcc[_0x09c0('0x1c')](0xcc)[_0x09c0('0x1d')]();});}};}function handleEntityNotFound(_0x35b61c,_0x1ea951){return function(_0x1aa80e){if(!_0x1aa80e){_0x35b61c[_0x09c0('0x1b')](0x194);}return _0x1aa80e;};}function handleError(_0x5e53ac,_0x15a667){_0x15a667=_0x15a667||0x1f4;return function(_0x1bdde9){logger['error'](_0x1bdde9[_0x09c0('0x2b')]);if(_0x1bdde9['name']){delete _0x1bdde9[_0x09c0('0x2c')];}_0x5e53ac['status'](_0x15a667)[_0x09c0('0x2d')](_0x1bdde9);};}exports[_0x09c0('0x2e')]=function(_0x108409,_0x4159bc){var _0x4e999a={},_0x5478b7={},_0x17c374={'count':0x0,'rows':[]};var _0x38a315=_[_0x09c0('0x2f')](db['VoiceMail'][_0x09c0('0x30')],function(_0x4bdae9){return{'name':_0x4bdae9[_0x09c0('0x31')],'type':_0x4bdae9[_0x09c0('0x32')][_0x09c0('0x33')]};});_0x5478b7['model']=_[_0x09c0('0x2f')](_0x38a315,_0x09c0('0x2c'));_0x5478b7[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x108409[_0x09c0('0x34')]);_0x5478b7[_0x09c0('0x36')]=_[_0x09c0('0x37')](_0x5478b7['model'],_0x5478b7[_0x09c0('0x34')]);_0x4e999a[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x5478b7[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x108409['query'][_0x09c0('0x3a')]));_0x4e999a[_0x09c0('0x38')]=_0x4e999a[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x4e999a[_0x09c0('0x38')]:_0x5478b7['model'];if(!_0x108409[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x4e999a[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x108409[_0x09c0('0x34')][_0x09c0('0x20')]);_0x4e999a['offset']=qs[_0x09c0('0x3e')](_0x108409[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x4e999a[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x108409['query']['sort']);_0x4e999a['where']=qs['filters'](_[_0x09c0('0x41')](_0x108409[_0x09c0('0x34')],_0x5478b7[_0x09c0('0x36')]),_0x38a315);if(_0x108409[_0x09c0('0x34')][_0x09c0('0x42')]){_0x4e999a['where']=_[_0x09c0('0x43')](_0x4e999a[_0x09c0('0x44')],{'$or':_['map'](_0x38a315,function(_0x1067cf){if(_0x1067cf['type']!==_0x09c0('0x45')){var _0x5c80a2={};_0x5c80a2[_0x1067cf[_0x09c0('0x2c')]]={'$like':'%'+_0x108409[_0x09c0('0x34')]['filter']+'%'};return _0x5c80a2;}})});}_0x4e999a=_[_0x09c0('0x43')]({},_0x4e999a,_0x108409[_0x09c0('0x46')]);var _0x5d69fd={'where':_0x4e999a[_0x09c0('0x44')]};return db[_0x09c0('0x47')][_0x09c0('0x21')](_0x5d69fd)[_0x09c0('0x2a')](function(_0xeb8191){_0x17c374[_0x09c0('0x21')]=_0xeb8191;if(_0x108409['query'][_0x09c0('0x48')]){_0x4e999a[_0x09c0('0x49')]=[{'all':!![]}];}return db[_0x09c0('0x47')]['findAll'](_0x4e999a);})[_0x09c0('0x2a')](function(_0x30c0c5){_0x17c374[_0x09c0('0x4a')]=_0x30c0c5;return _0x17c374;})['then'](respondWithFilteredResult(_0x4159bc,_0x4e999a))[_0x09c0('0x4b')](handleError(_0x4159bc,null));};exports[_0x09c0('0x4c')]=function(_0x52cd5c,_0x5bbf4e){var _0x397e73={'raw':!![],'where':{'id':_0x52cd5c['params']['id']}},_0x471078={};_0x471078[_0x09c0('0x39')]=_[_0x09c0('0x35')](db['VoiceMail'][_0x09c0('0x30')]);_0x471078[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x52cd5c[_0x09c0('0x34')]);_0x471078[_0x09c0('0x36')]=_['intersection'](_0x471078[_0x09c0('0x39')],_0x471078['query']);_0x397e73['attributes']=_[_0x09c0('0x37')](_0x471078[_0x09c0('0x39')],qs[_0x09c0('0x3a')](_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x3a')]));_0x397e73[_0x09c0('0x38')]=_0x397e73['attributes']['length']?_0x397e73['attributes']:_0x471078[_0x09c0('0x39')];if(_0x52cd5c[_0x09c0('0x34')][_0x09c0('0x48')]){_0x397e73['include']=[{'all':!![]}];}_0x397e73=_[_0x09c0('0x43')]({},_0x397e73,_0x52cd5c[_0x09c0('0x46')]);return db[_0x09c0('0x47')][_0x09c0('0x4d')](_0x397e73)[_0x09c0('0x2a')](handleEntityNotFound(_0x5bbf4e,null))[_0x09c0('0x2a')](respondWithResult(_0x5bbf4e,null))[_0x09c0('0x4b')](handleError(_0x5bbf4e,null));};exports[_0x09c0('0x4e')]=function(_0x3f6d14,_0x38085c){return db[_0x09c0('0x47')][_0x09c0('0x4e')](_0x3f6d14[_0x09c0('0x4f')],{})[_0x09c0('0x2a')](function(_0x332b69){var _0x32abbe=_0x3f6d14[_0x09c0('0x50')][_0x09c0('0x27')]({'plain':!![]});if(!_0x32abbe)throw new Error(_0x09c0('0x51'));if(_0x32abbe[_0x09c0('0x52')]==='user'){var _0x4acf54=_0x332b69[_0x09c0('0x27')]({'plain':!![]});var _0x15b0a2=_0x09c0('0x28');return db[_0x09c0('0x53')]['find']({'where':{'name':_0x15b0a2,'userProfileId':_0x32abbe[_0x09c0('0x54')]},'raw':!![]})[_0x09c0('0x2a')](function(_0x1823c2){if(_0x1823c2&&_0x1823c2['autoAssociation']===0x0){return db[_0x09c0('0x29')][_0x09c0('0x4e')]({'name':_0x4acf54[_0x09c0('0x2c')],'resourceId':_0x4acf54['id'],'type':_0x1823c2[_0x09c0('0x2c')],'sectionId':_0x1823c2['id']},{})[_0x09c0('0x2a')](function(){return _0x332b69;});}else{return _0x332b69;}})[_0x09c0('0x4b')](function(_0x45ecd0){logger['error'](_0x09c0('0x55'),_0x45ecd0);throw _0x45ecd0;});}return _0x332b69;})[_0x09c0('0x2a')](respondWithResult(_0x38085c,0xc9))[_0x09c0('0x4b')](handleError(_0x38085c,null));};exports[_0x09c0('0x25')]=function(_0x21fe00,_0x316fbd){if(_0x21fe00[_0x09c0('0x4f')]['id']){delete _0x21fe00['body']['id'];}return db['VoiceMail'][_0x09c0('0x4d')]({'where':{'id':_0x21fe00[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x316fbd,null))['then'](saveUpdates(_0x21fe00[_0x09c0('0x4f')],null))['then'](respondWithResult(_0x316fbd,null))[_0x09c0('0x4b')](handleError(_0x316fbd,null));};exports[_0x09c0('0x26')]=function(_0x42d4dd,_0x290618){return db[_0x09c0('0x47')][_0x09c0('0x4d')]({'where':{'id':_0x42d4dd[_0x09c0('0x56')]['id']}})['then'](handleEntityNotFound(_0x290618,null))[_0x09c0('0x2a')](removeEntity(_0x290618,null))[_0x09c0('0x4b')](handleError(_0x290618,null));};exports[_0x09c0('0x57')]=function(_0x270ff2,_0x3a6845,_0x219195){return db[_0x09c0('0x47')][_0x09c0('0x58')]({'where':{'id':_0x270ff2[_0x09c0('0x56')]['id']}})[_0x09c0('0x2a')](handleEntityNotFound(_0x3a6845,null))[_0x09c0('0x2a')](function(_0x4c4339){var _0x34cc0a;var _0x3564e6={},_0x26dc22={};_0x26dc22[_0x09c0('0x39')]=_['keys'](db[_0x09c0('0x59')]['rawAttributes']);_0x26dc22[_0x09c0('0x34')]=_[_0x09c0('0x35')](_0x270ff2[_0x09c0('0x34')]);_0x26dc22['filters']=_['intersection'](_0x26dc22[_0x09c0('0x39')],_0x26dc22[_0x09c0('0x34')]);_0x3564e6[_0x09c0('0x38')]=_[_0x09c0('0x37')](_0x26dc22['model'],qs[_0x09c0('0x3a')](_0x270ff2[_0x09c0('0x34')]['fields']));_0x3564e6[_0x09c0('0x38')]=_0x3564e6[_0x09c0('0x38')][_0x09c0('0x3b')]?_0x3564e6[_0x09c0('0x38')]:_0x26dc22['model'];if(!_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3c')](_0x09c0('0x3d'))){_0x3564e6[_0x09c0('0x20')]=qs[_0x09c0('0x20')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x20')]);_0x3564e6[_0x09c0('0x3e')]=qs[_0x09c0('0x3e')](_0x270ff2[_0x09c0('0x34')][_0x09c0('0x3e')]);}_0x3564e6[_0x09c0('0x3f')]=qs[_0x09c0('0x40')](_0x270ff2['query'][_0x09c0('0x40')]);_0x3564e6[_0x09c0('0x44')]=qs[_0x09c0('0x36')](_[_0x09c0('0x41')](_0x270ff2[_0x09c0('0x34')],_0x26dc22['filters']));if(_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]){_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'$or':_[_0x09c0('0x2f')](_0x3564e6[_0x09c0('0x38')],function(_0x569462){var _0x325013={};_0x325013[_0x569462]={'$like':'%'+_0x270ff2[_0x09c0('0x34')][_0x09c0('0x42')]+'%'};return _0x325013;})});}_0x3564e6[_0x09c0('0x44')]=_[_0x09c0('0x43')](_0x3564e6['where'],{'mailboxuser':_0x4c4339[_0x09c0('0x5a')]});_0x3564e6=_[_0x09c0('0x43')]({},_0x3564e6,_0x270ff2[_0x09c0('0x46')]);return db[_0x09c0('0x59')][_0x09c0('0x5b')](_0x3564e6)['then'](respondWithFilteredResult(_0x3a6845,_0x3564e6));})[_0x09c0('0x4b')](handleError(_0x3a6845,null));}; \ No newline at end of file +var _0xeb74=['VoiceMail','rawAttributes','fieldName','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','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','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Voicemails','UserProfileResource','end','sendStatus','error','stack','name','send','map'];(function(_0x223913,_0x153889){var _0xaa257b=function(_0x3f141d){while(--_0x3f141d){_0x223913['push'](_0x223913['shift']());}};_0xaa257b(++_0x153889);}(_0xeb74,0xe3));var _0x4eb7=function(_0x2d6311,_0x5eee86){_0x2d6311=_0x2d6311-0x0;var _0xb38b61=_0xeb74[_0x2d6311];return _0xb38b61;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];function respondWithStatusCode(_0x35fa89,_0x4194e1){_0x4194e1=_0x4194e1||0xcc;return function(_0x3c9f45){if(_0x3c9f45){return _0x35fa89['sendStatus'](_0x4194e1);}return _0x35fa89['status'](_0x4194e1)['end']();};}function respondWithResult(_0x17fb81,_0x51f09d){_0x51f09d=_0x51f09d||0xc8;return function(_0x84c68b){if(_0x84c68b){return _0x17fb81[_0x4eb7('0x19')](_0x51f09d)[_0x4eb7('0x1a')](_0x84c68b);}};}function respondWithFilteredResult(_0x1c4a97,_0x5d6d5){return function(_0x21433d){if(_0x21433d){var _0x11674f=typeof _0x5d6d5[_0x4eb7('0x1b')]===_0x4eb7('0x1c')&&typeof _0x5d6d5[_0x4eb7('0x1d')]==='undefined';var _0xb86bc9=_0x21433d[_0x4eb7('0x1e')];var _0x3b6d41=_0x11674f?0x0:_0x5d6d5[_0x4eb7('0x1b')];var _0x302e16=_0x11674f?_0x21433d[_0x4eb7('0x1e')]:_0x5d6d5[_0x4eb7('0x1b')]+_0x5d6d5[_0x4eb7('0x1d')];var _0x5f4780;if(_0x302e16>=_0xb86bc9){_0x302e16=_0xb86bc9;_0x5f4780=0xc8;}else{_0x5f4780=0xce;}_0x1c4a97[_0x4eb7('0x19')](_0x5f4780);return _0x1c4a97[_0x4eb7('0x1f')](_0x4eb7('0x20'),_0x3b6d41+'-'+_0x302e16+'/'+_0xb86bc9)[_0x4eb7('0x1a')](_0x21433d);}return null;};}function patchUpdates(_0x32f0f5){return function(_0x2efd67){try{jsonpatch[_0x4eb7('0x21')](_0x2efd67,_0x32f0f5,!![]);}catch(_0x4ddbe4){return BPromise[_0x4eb7('0x22')](_0x4ddbe4);}return _0x2efd67[_0x4eb7('0x23')]();};}function saveUpdates(_0x4783b1,_0x164515){return function(_0x14a7be){if(_0x14a7be){return _0x14a7be[_0x4eb7('0x24')](_0x4783b1)[_0x4eb7('0x25')](function(_0x2df1b1){return _0x2df1b1;});}return null;};}function removeEntity(_0x1a2b8b,_0x13e871){return function(_0x4de2d9){if(_0x4de2d9){return _0x4de2d9[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){var _0x2e8de8=_0x4de2d9[_0x4eb7('0x27')]({'plain':!![]});var _0x3e0da2=_0x4eb7('0x28');return db[_0x4eb7('0x29')][_0x4eb7('0x26')]({'where':{'type':_0x3e0da2,'resourceId':_0x2e8de8['id']}})[_0x4eb7('0x25')](function(){return _0x4de2d9;});})[_0x4eb7('0x25')](function(){_0x1a2b8b[_0x4eb7('0x19')](0xcc)[_0x4eb7('0x2a')]();});}};}function handleEntityNotFound(_0x2d1773,_0x1b56a8){return function(_0x433794){if(!_0x433794){_0x2d1773[_0x4eb7('0x2b')](0x194);}return _0x433794;};}function handleError(_0x2be00c,_0x41e515){_0x41e515=_0x41e515||0x1f4;return function(_0x33a2c1){logger[_0x4eb7('0x2c')](_0x33a2c1[_0x4eb7('0x2d')]);if(_0x33a2c1[_0x4eb7('0x2e')]){delete _0x33a2c1[_0x4eb7('0x2e')];}_0x2be00c['status'](_0x41e515)[_0x4eb7('0x2f')](_0x33a2c1);};}exports['index']=function(_0x446872,_0x13f71a){var _0xc5aa21={},_0x1fe298={},_0x468195={'count':0x0,'rows':[]};var _0x1cec8e=_[_0x4eb7('0x30')](db[_0x4eb7('0x31')][_0x4eb7('0x32')],function(_0x4f8879){return{'name':_0x4f8879[_0x4eb7('0x33')],'type':_0x4f8879['type'][_0x4eb7('0x34')]};});_0x1fe298[_0x4eb7('0x35')]=_['map'](_0x1cec8e,'name');_0x1fe298[_0x4eb7('0x36')]=_[_0x4eb7('0x37')](_0x446872[_0x4eb7('0x36')]);_0x1fe298[_0x4eb7('0x38')]=_['intersection'](_0x1fe298[_0x4eb7('0x35')],_0x1fe298[_0x4eb7('0x36')]);_0xc5aa21[_0x4eb7('0x39')]=_[_0x4eb7('0x3a')](_0x1fe298[_0x4eb7('0x35')],qs['fields'](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0xc5aa21[_0x4eb7('0x39')]=_0xc5aa21['attributes'][_0x4eb7('0x3c')]?_0xc5aa21[_0x4eb7('0x39')]:_0x1fe298[_0x4eb7('0x35')];if(!_0x446872['query'][_0x4eb7('0x3d')]('nolimit')){_0xc5aa21[_0x4eb7('0x1d')]=qs[_0x4eb7('0x1d')](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x1d')]);_0xc5aa21['offset']=qs[_0x4eb7('0x1b')](_0x446872[_0x4eb7('0x36')][_0x4eb7('0x1b')]);}_0xc5aa21[_0x4eb7('0x3e')]=qs['sort'](_0x446872['query']['sort']);_0xc5aa21[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_[_0x4eb7('0x40')](_0x446872[_0x4eb7('0x36')],_0x1fe298[_0x4eb7('0x38')]),_0x1cec8e);if(_0x446872[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0xc5aa21[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0xc5aa21[_0x4eb7('0x3f')],{'$or':_['map'](_0x1cec8e,function(_0x5d0e51){if(_0x5d0e51[_0x4eb7('0x43')]!==_0x4eb7('0x44')){var _0x4597c8={};_0x4597c8[_0x5d0e51[_0x4eb7('0x2e')]]={'$like':'%'+_0x446872[_0x4eb7('0x36')][_0x4eb7('0x41')]+'%'};return _0x4597c8;}})});}_0xc5aa21=_[_0x4eb7('0x42')]({},_0xc5aa21,_0x446872[_0x4eb7('0x45')]);var _0x3a31ce={'where':_0xc5aa21[_0x4eb7('0x3f')]};return db[_0x4eb7('0x31')][_0x4eb7('0x1e')](_0x3a31ce)[_0x4eb7('0x25')](function(_0x38af1f){_0x468195[_0x4eb7('0x1e')]=_0x38af1f;if(_0x446872[_0x4eb7('0x36')][_0x4eb7('0x46')]){_0xc5aa21[_0x4eb7('0x47')]=[{'all':!![]}];}return db[_0x4eb7('0x31')]['findAll'](_0xc5aa21);})[_0x4eb7('0x25')](function(_0x2df542){_0x468195[_0x4eb7('0x48')]=_0x2df542;return _0x468195;})[_0x4eb7('0x25')](respondWithFilteredResult(_0x13f71a,_0xc5aa21))[_0x4eb7('0x49')](handleError(_0x13f71a,null));};exports[_0x4eb7('0x4a')]=function(_0x3cd9e5,_0x10fac2){var _0x3d6b0b={'raw':!![],'where':{'id':_0x3cd9e5[_0x4eb7('0x4b')]['id']}},_0x4969eb={};_0x4969eb['model']=_[_0x4eb7('0x37')](db[_0x4eb7('0x31')][_0x4eb7('0x32')]);_0x4969eb['query']=_[_0x4eb7('0x37')](_0x3cd9e5[_0x4eb7('0x36')]);_0x4969eb[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x4969eb['model'],_0x4969eb[_0x4eb7('0x36')]);_0x3d6b0b['attributes']=_[_0x4eb7('0x3a')](_0x4969eb[_0x4eb7('0x35')],qs[_0x4eb7('0x3b')](_0x3cd9e5[_0x4eb7('0x36')][_0x4eb7('0x3b')]));_0x3d6b0b['attributes']=_0x3d6b0b['attributes'][_0x4eb7('0x3c')]?_0x3d6b0b[_0x4eb7('0x39')]:_0x4969eb[_0x4eb7('0x35')];if(_0x3cd9e5[_0x4eb7('0x36')][_0x4eb7('0x46')]){_0x3d6b0b['include']=[{'all':!![]}];}_0x3d6b0b=_[_0x4eb7('0x42')]({},_0x3d6b0b,_0x3cd9e5[_0x4eb7('0x45')]);return db['VoiceMail'][_0x4eb7('0x4c')](_0x3d6b0b)[_0x4eb7('0x25')](handleEntityNotFound(_0x10fac2,null))['then'](respondWithResult(_0x10fac2,null))[_0x4eb7('0x49')](handleError(_0x10fac2,null));};exports[_0x4eb7('0x4d')]=function(_0x3c8049,_0x5774d5){return db[_0x4eb7('0x31')]['create'](_0x3c8049['body'],{})[_0x4eb7('0x25')](function(_0x312e9b){var _0x32d7d6=_0x3c8049[_0x4eb7('0x4e')][_0x4eb7('0x27')]({'plain':!![]});if(!_0x32d7d6)throw new Error(_0x4eb7('0x4f'));if(_0x32d7d6[_0x4eb7('0x50')]===_0x4eb7('0x4e')){var _0x2913c5=_0x312e9b[_0x4eb7('0x27')]({'plain':!![]});var _0x42a1d9=_0x4eb7('0x28');return db[_0x4eb7('0x51')][_0x4eb7('0x4c')]({'where':{'name':_0x42a1d9,'userProfileId':_0x32d7d6[_0x4eb7('0x52')]},'raw':!![]})[_0x4eb7('0x25')](function(_0x327f1e){if(_0x327f1e&&_0x327f1e[_0x4eb7('0x53')]===0x0){return db[_0x4eb7('0x29')][_0x4eb7('0x4d')]({'name':_0x2913c5['name'],'resourceId':_0x2913c5['id'],'type':_0x327f1e[_0x4eb7('0x2e')],'sectionId':_0x327f1e['id']},{})['then'](function(){return _0x312e9b;});}else{return _0x312e9b;}})['catch'](function(_0x3f3a5f){logger[_0x4eb7('0x2c')](_0x4eb7('0x54'),_0x3f3a5f);throw _0x3f3a5f;});}return _0x312e9b;})[_0x4eb7('0x25')](respondWithResult(_0x5774d5,0xc9))[_0x4eb7('0x49')](handleError(_0x5774d5,null));};exports['update']=function(_0x4e3163,_0x2e5d28){if(_0x4e3163['body']['id']){delete _0x4e3163[_0x4eb7('0x55')]['id'];}return db[_0x4eb7('0x31')][_0x4eb7('0x4c')]({'where':{'id':_0x4e3163[_0x4eb7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2e5d28,null))[_0x4eb7('0x25')](saveUpdates(_0x4e3163[_0x4eb7('0x55')],null))[_0x4eb7('0x25')](respondWithResult(_0x2e5d28,null))[_0x4eb7('0x49')](handleError(_0x2e5d28,null));};exports['destroy']=function(_0x961de5,_0x340ffb){return db['VoiceMail'][_0x4eb7('0x4c')]({'where':{'id':_0x961de5[_0x4eb7('0x4b')]['id']}})['then'](handleEntityNotFound(_0x340ffb,null))[_0x4eb7('0x25')](removeEntity(_0x340ffb,null))['catch'](handleError(_0x340ffb,null));};exports[_0x4eb7('0x56')]=function(_0x5be4ad,_0x13847e,_0x456fe7){return db[_0x4eb7('0x31')][_0x4eb7('0x57')]({'where':{'id':_0x5be4ad[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x13847e,null))['then'](function(_0x4a4fc5){var _0x1b8514;var _0x1b4afe={},_0x24d33d={};_0x24d33d[_0x4eb7('0x35')]=_['keys'](db[_0x4eb7('0x58')][_0x4eb7('0x32')]);_0x24d33d['query']=_[_0x4eb7('0x37')](_0x5be4ad[_0x4eb7('0x36')]);_0x24d33d[_0x4eb7('0x38')]=_[_0x4eb7('0x3a')](_0x24d33d[_0x4eb7('0x35')],_0x24d33d[_0x4eb7('0x36')]);_0x1b4afe[_0x4eb7('0x39')]=_['intersection'](_0x24d33d['model'],qs[_0x4eb7('0x3b')](_0x5be4ad['query'][_0x4eb7('0x3b')]));_0x1b4afe['attributes']=_0x1b4afe[_0x4eb7('0x39')]['length']?_0x1b4afe['attributes']:_0x24d33d[_0x4eb7('0x35')];if(!_0x5be4ad[_0x4eb7('0x36')]['hasOwnProperty'](_0x4eb7('0x59'))){_0x1b4afe['limit']=qs[_0x4eb7('0x1d')](_0x5be4ad[_0x4eb7('0x36')]['limit']);_0x1b4afe[_0x4eb7('0x1b')]=qs[_0x4eb7('0x1b')](_0x5be4ad['query']['offset']);}_0x1b4afe['order']=qs['sort'](_0x5be4ad[_0x4eb7('0x36')]['sort']);_0x1b4afe[_0x4eb7('0x3f')]=qs[_0x4eb7('0x38')](_['pick'](_0x5be4ad[_0x4eb7('0x36')],_0x24d33d[_0x4eb7('0x38')]));if(_0x5be4ad[_0x4eb7('0x36')][_0x4eb7('0x41')]){_0x1b4afe[_0x4eb7('0x3f')]=_[_0x4eb7('0x42')](_0x1b4afe['where'],{'$or':_['map'](_0x1b4afe['attributes'],function(_0x58d2c1){var _0x1775c4={};_0x1775c4[_0x58d2c1]={'$like':'%'+_0x5be4ad[_0x4eb7('0x36')][_0x4eb7('0x41')]+'%'};return _0x1775c4;})});}_0x1b4afe[_0x4eb7('0x3f')]=_['merge'](_0x1b4afe['where'],{'mailboxuser':_0x4a4fc5[_0x4eb7('0x5a')]});_0x1b4afe=_[_0x4eb7('0x42')]({},_0x1b4afe,_0x5be4ad[_0x4eb7('0x45')]);return db[_0x4eb7('0x58')][_0x4eb7('0x5b')](_0x1b4afe)['then'](respondWithFilteredResult(_0x13847e,_0x1b4afe));})[_0x4eb7('0x49')](handleError(_0x13847e,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 736441e..09df371 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 _0x50ab=['../../config/logger','api','moment','path','rimraf','../../config/environment','define','mailbox_context','context','lodash'];(function(_0x2fd011,_0x4c26a6){var _0x1836c8=function(_0x5166c4){while(--_0x5166c4){_0x2fd011['push'](_0x2fd011['shift']());}};_0x1836c8(++_0x4c26a6);}(_0x50ab,0x149));var _0xb50a=function(_0x3713e2,_0x381fd6){_0x3713e2=_0x3713e2-0x0;var _0x4e81d8=_0x50ab[_0x3713e2];return _0x4e81d8;};'use strict';var _=require(_0xb50a('0x0'));var util=require('util');var logger=require(_0xb50a('0x1'))(_0xb50a('0x2'));var moment=require(_0xb50a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb50a('0x4'));var rimraf=require(_0xb50a('0x5'));var config=require(_0xb50a('0x6'));var attributes=require('./voiceMail.attributes');module['exports']=function(_0x529386,_0x1039a7){return _0x529386[_0xb50a('0x7')]('VoiceMail',attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0xb50a('0x8'),'fields':['mailbox',_0xb50a('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2ee1=['./voiceMail.attributes','define','voice_voicemail','mailbox_context','context','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf'];(function(_0x190089,_0x1ec572){var _0x180315=function(_0x374e1f){while(--_0x374e1f){_0x190089['push'](_0x190089['shift']());}};_0x180315(++_0x1ec572);}(_0x2ee1,0xad));var _0x12ee=function(_0x1ac247,_0x2af2b5){_0x1ac247=_0x1ac247-0x0;var _0xb4dee8=_0x2ee1[_0x1ac247];return _0xb4dee8;};'use strict';var _=require(_0x12ee('0x0'));var util=require(_0x12ee('0x1'));var logger=require(_0x12ee('0x2'))('api');var moment=require(_0x12ee('0x3'));var BPromise=require(_0x12ee('0x4'));var rp=require(_0x12ee('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x12ee('0x6'));var config=require('../../config/environment');var attributes=require(_0x12ee('0x7'));module['exports']=function(_0x2f2110,_0x3c3070){return _0x2f2110[_0x12ee('0x8')]('VoiceMail',attributes,{'tableName':_0x12ee('0x9'),'paranoid':![],'indexes':[{'name':_0x12ee('0xa'),'fields':['mailbox',_0x12ee('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 99f338a..8c22fd5 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 _0x2e9b=['request\x20sent','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','VoiceMail,\x20%s,\x20%s','message','result','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','http','request','then','info'];(function(_0x16964e,_0x431a73){var _0x4dbb31=function(_0x566b39){while(--_0x566b39){_0x16964e['push'](_0x16964e['shift']());}};_0x4dbb31(++_0x431a73);}(_0x2e9b,0x1ca));var _0xb2e9=function(_0x26d005,_0x3720a9){_0x26d005=_0x26d005-0x0;var _0x182def=_0x2e9b[_0x26d005];return _0x182def;};'use strict';var _=require('lodash');var util=require(_0xb2e9('0x0'));var moment=require('moment');var BPromise=require(_0xb2e9('0x1'));var rs=require(_0xb2e9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb2e9('0x3'));var logger=require(_0xb2e9('0x4'))('rpc');var config=require(_0xb2e9('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xb2e9('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3ed178,_0x3907fe,_0x4e6ca2){return new BPromise(function(_0x54db1c,_0x14fc96){return client[_0xb2e9('0x7')](_0x3ed178,_0x4e6ca2)[_0xb2e9('0x8')](function(_0x5d873d){logger[_0xb2e9('0x9')]('VoiceMail,\x20%s,\x20%s',_0x3907fe,_0xb2e9('0xa'));logger['debug'](_0xb2e9('0xb'),_0x3907fe,_0xb2e9('0xa'),JSON['stringify'](_0x5d873d));if(_0x5d873d[_0xb2e9('0xc')]){if(_0x5d873d[_0xb2e9('0xc')][_0xb2e9('0xd')]===0x1f4){logger[_0xb2e9('0xc')](_0xb2e9('0xe'),_0x3907fe,_0x5d873d[_0xb2e9('0xc')][_0xb2e9('0xf')]);return _0x14fc96(_0x5d873d[_0xb2e9('0xc')]['message']);}logger[_0xb2e9('0xc')](_0xb2e9('0xe'),_0x3907fe,_0x5d873d[_0xb2e9('0xc')]['message']);return _0x54db1c(_0x5d873d[_0xb2e9('0xc')]['message']);}else{logger[_0xb2e9('0x9')](_0xb2e9('0xe'),_0x3907fe,_0xb2e9('0xa'));_0x54db1c(_0x5d873d[_0xb2e9('0x10')][_0xb2e9('0xf')]);}})[_0xb2e9('0x11')](function(_0x4559f9){logger[_0xb2e9('0xc')](_0xb2e9('0xe'),_0x3907fe,_0x4559f9);_0x14fc96(_0x4559f9);});});} \ No newline at end of file +var _0xa9a2=['then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x3ee5df,_0x583073){var _0x446d24=function(_0x12e54e){while(--_0x12e54e){_0x3ee5df['push'](_0x3ee5df['shift']());}};_0x446d24(++_0x583073);}(_0xa9a2,0xe6));var _0x2a9a=function(_0x4608ac,_0x340cd9){_0x4608ac=_0x4608ac-0x0;var _0x318daa=_0xa9a2[_0x4608ac];return _0x318daa;};'use strict';var _=require(_0x2a9a('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2a9a('0x1'));var rs=require(_0x2a9a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a9a('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a9a('0x4'))(_0x2a9a('0x5'));var config=require(_0x2a9a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2a9a('0x7')][_0x2a9a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x22d6cb,_0x2eedcf,_0x227080){return new BPromise(function(_0x1de09a,_0x23f655){return client[_0x2a9a('0x9')](_0x22d6cb,_0x227080)[_0x2a9a('0xa')](function(_0x4bcf0b){logger[_0x2a9a('0xb')](_0x2a9a('0xc'),_0x2eedcf,_0x2a9a('0xd'));logger[_0x2a9a('0xe')](_0x2a9a('0xf'),_0x2eedcf,_0x2a9a('0xd'),JSON[_0x2a9a('0x10')](_0x4bcf0b));if(_0x4bcf0b['error']){if(_0x4bcf0b[_0x2a9a('0x11')][_0x2a9a('0x12')]===0x1f4){logger['error']('VoiceMail,\x20%s,\x20%s',_0x2eedcf,_0x4bcf0b[_0x2a9a('0x11')][_0x2a9a('0x13')]);return _0x23f655(_0x4bcf0b[_0x2a9a('0x11')][_0x2a9a('0x13')]);}logger[_0x2a9a('0x11')](_0x2a9a('0xc'),_0x2eedcf,_0x4bcf0b[_0x2a9a('0x11')]['message']);return _0x1de09a(_0x4bcf0b['error']['message']);}else{logger['info']('VoiceMail,\x20%s,\x20%s',_0x2eedcf,_0x2a9a('0xd'));_0x1de09a(_0x4bcf0b['result'][_0x2a9a('0x13')]);}})['catch'](function(_0x1cd4cb){logger[_0x2a9a('0x11')](_0x2a9a('0xc'),_0x2eedcf,_0x1cd4cb);_0x23f655(_0x1cd4cb);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 3f5232f..33e23fe 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 _0xbbb6=['post','create','update','delete','exports','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','index','/:id','show','/:id/download','download'];(function(_0x149417,_0x3de87f){var _0x31a353=function(_0x3826d6){while(--_0x3826d6){_0x149417['push'](_0x149417['shift']());}};_0x31a353(++_0x3de87f);}(_0xbbb6,0x148));var _0x6bbb=function(_0x41c19d,_0x3674f6){_0x41c19d=_0x41c19d-0x0;var _0x4f1f15=_0xbbb6[_0x41c19d];return _0x4f1f15;};'use strict';var multer=require('multer');var util=require(_0x6bbb('0x0'));var path=require('path');var timeout=require(_0x6bbb('0x1'));var express=require('express');var router=express[_0x6bbb('0x2')]();var fs_extra=require(_0x6bbb('0x3'));var auth=require(_0x6bbb('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6bbb('0x5'));var controller=require(_0x6bbb('0x6'));router[_0x6bbb('0x7')]('/',auth[_0x6bbb('0x8')](),controller[_0x6bbb('0x9')]);router[_0x6bbb('0x7')](_0x6bbb('0xa'),auth['isAuthenticated'](),controller[_0x6bbb('0xb')]);router['get'](_0x6bbb('0xc'),auth[_0x6bbb('0x8')](),controller[_0x6bbb('0xd')]);router[_0x6bbb('0xe')]('/',auth[_0x6bbb('0x8')](),controller[_0x6bbb('0xf')]);router['put']('/:id',auth[_0x6bbb('0x8')](),controller[_0x6bbb('0x10')]);router[_0x6bbb('0x11')](_0x6bbb('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x6bbb('0x12')]=router; \ No newline at end of file +var _0xc182=['multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceMailMessage.controller','isAuthenticated','index','get','show','/:id/download','download','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x2ce210,_0x23471d){var _0x1f320e=function(_0x16544d){while(--_0x16544d){_0x2ce210['push'](_0x2ce210['shift']());}};_0x1f320e(++_0x23471d);}(_0xc182,0x8a));var _0x2c18=function(_0x520088,_0x2f419c){_0x520088=_0x520088-0x0;var _0xe9314a=_0xc182[_0x520088];return _0xe9314a;};'use strict';var multer=require(_0x2c18('0x0'));var util=require('util');var path=require(_0x2c18('0x1'));var timeout=require(_0x2c18('0x2'));var express=require(_0x2c18('0x3'));var router=express[_0x2c18('0x4')]();var fs_extra=require(_0x2c18('0x5'));var auth=require(_0x2c18('0x6'));var interaction=require(_0x2c18('0x7'));var config=require('../../config/environment');var controller=require(_0x2c18('0x8'));router['get']('/',auth[_0x2c18('0x9')](),controller[_0x2c18('0xa')]);router[_0x2c18('0xb')]('/:id',auth[_0x2c18('0x9')](),controller[_0x2c18('0xc')]);router['get'](_0x2c18('0xd'),auth['isAuthenticated'](),controller[_0x2c18('0xe')]);router[_0x2c18('0xf')]('/',auth[_0x2c18('0x9')](),controller[_0x2c18('0x10')]);router[_0x2c18('0x11')](_0x2c18('0x12'),auth[_0x2c18('0x9')](),controller[_0x2c18('0x13')]);router[_0x2c18('0x14')](_0x2c18('0x12'),auth['isAuthenticated'](),controller[_0x2c18('0x15')]);module[_0x2c18('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index a873e0d..4e41d48 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 _0x497a=['long','literal','sequelize','exports','VIRTUAL','getDataValue','INTEGER','STRING','BLOB'];(function(_0x5f4729,_0x4a803b){var _0x4cdac9=function(_0x3dfabe){while(--_0x3dfabe){_0x5f4729['push'](_0x5f4729['shift']());}};_0x4cdac9(++_0x4a803b);}(_0x497a,0x6e));var _0xa497=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x497a[_0x3e5086];return _0xfeb102;};'use strict';var Sequelize=require(_0xa497('0x0'));module[_0xa497('0x1')]={'name':{'type':Sequelize[_0xa497('0x2')],'get':function(_0x513a59){return this[_0xa497('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xa497('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0xa497('0x6')](_0xa497('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xa497('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','defaultValue':Sequelize[_0xa497('0x8')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xc985=['INTEGER','STRING','BLOB','long','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue'];(function(_0x4f5586,_0x5e5860){var _0x27c5a1=function(_0x2294db){while(--_0x2294db){_0x4f5586['push'](_0x4f5586['shift']());}};_0x27c5a1(++_0x5e5860);}(_0xc985,0x12e));var _0x5c98=function(_0x42b5e2,_0x1f6c9d){_0x42b5e2=_0x42b5e2-0x0;var _0x335026=_0xc985[_0x42b5e2];return _0x335026;};'use strict';var Sequelize=require(_0x5c98('0x0'));module[_0x5c98('0x1')]={'name':{'type':Sequelize[_0x5c98('0x2')],'get':function(_0x4b14e7){return this[_0x5c98('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x5c98('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'context':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'origtime':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'duration':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x5c98('0x6')](_0x5c98('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x5c98('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x5c98('0x8'),'defaultValue':Sequelize['literal']('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index ca6583e..e2e3bf5 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 _0x9618=['download','recording','msg_id','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','offset','undefined','count','limit','status','set','json','apply','reject','update','then','destroy','error','stack','name','send','map','rawAttributes','type','differenceBy','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','VoiceMailMessage','includeAll','include','catch','show','params','create','body','find'];(function(_0x41b0a8,_0x1b05cc){var _0x3a83d4=function(_0x3d1011){while(--_0x3d1011){_0x41b0a8['push'](_0x41b0a8['shift']());}};_0x3a83d4(++_0x1b05cc);}(_0x9618,0x156));var _0x8961=function(_0x50a1df,_0x5a56d5){_0x50a1df=_0x50a1df-0x0;var _0xde1af4=_0x9618[_0x50a1df];return _0xde1af4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8961('0x0'));var zipdir=require(_0x8961('0x1'));var jsonpatch=require(_0x8961('0x2'));var rp=require(_0x8961('0x3'));var moment=require('moment');var BPromise=require(_0x8961('0x4'));var Mustache=require('mustache');var util=require(_0x8961('0x5'));var path=require(_0x8961('0x6'));var sox=require(_0x8961('0x7'));var csv=require(_0x8961('0x8'));var ejs=require(_0x8961('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8961('0xa'));var crypto=require(_0x8961('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8961('0x8'));var querystring=require(_0x8961('0xc'));var Papa=require(_0x8961('0xd'));var Redis=require(_0x8961('0xe'));var authService=require(_0x8961('0xf'));var qs=require(_0x8961('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8961('0x11'));var logger=require(_0x8961('0x12'))(_0x8961('0x13'));var utils=require(_0x8961('0x14'));var config=require(_0x8961('0x15'));var licenseUtil=require(_0x8961('0x16'));var db=require(_0x8961('0x17'))['db'];function respondWithStatusCode(_0x4e5dd2,_0x6a1129){_0x6a1129=_0x6a1129||0xcc;return function(_0x5a77ae){if(_0x5a77ae){return _0x4e5dd2[_0x8961('0x18')](_0x6a1129);}return _0x4e5dd2['status'](_0x6a1129)[_0x8961('0x19')]();};}function respondWithResult(_0x50946c,_0x2f3b5d){_0x2f3b5d=_0x2f3b5d||0xc8;return function(_0x254643){if(_0x254643){return _0x50946c['status'](_0x2f3b5d)['json'](_0x254643);}};}function respondWithFilteredResult(_0x4443f2,_0x1c1cc1){return function(_0x8c43a2){if(_0x8c43a2){var _0x584ccf=typeof _0x1c1cc1[_0x8961('0x1a')]===_0x8961('0x1b')&&typeof _0x1c1cc1['limit']===_0x8961('0x1b');var _0x268245=_0x8c43a2['count'];var _0x7c3860=_0x584ccf?0x0:_0x1c1cc1[_0x8961('0x1a')];var _0x44397b=_0x584ccf?_0x8c43a2[_0x8961('0x1c')]:_0x1c1cc1[_0x8961('0x1a')]+_0x1c1cc1[_0x8961('0x1d')];var _0x5072cc;if(_0x44397b>=_0x268245){_0x44397b=_0x268245;_0x5072cc=0xc8;}else{_0x5072cc=0xce;}_0x4443f2[_0x8961('0x1e')](_0x5072cc);return _0x4443f2[_0x8961('0x1f')]('Content-Range',_0x7c3860+'-'+_0x44397b+'/'+_0x268245)[_0x8961('0x20')](_0x8c43a2);}return null;};}function patchUpdates(_0x9d36de){return function(_0x17c0b3){try{jsonpatch[_0x8961('0x21')](_0x17c0b3,_0x9d36de,!![]);}catch(_0x4daa2f){return BPromise[_0x8961('0x22')](_0x4daa2f);}return _0x17c0b3['save']();};}function saveUpdates(_0x568685,_0x479471){return function(_0xef76ff){if(_0xef76ff){return _0xef76ff[_0x8961('0x23')](_0x568685)[_0x8961('0x24')](function(_0x559387){return _0x559387;});}return null;};}function removeEntity(_0x3db1d2,_0x2304eb){return function(_0x556642){if(_0x556642){return _0x556642[_0x8961('0x25')]()[_0x8961('0x24')](function(){_0x3db1d2[_0x8961('0x1e')](0xcc)[_0x8961('0x19')]();});}};}function handleEntityNotFound(_0x547107,_0x1de3a1){return function(_0x40059d){if(!_0x40059d){_0x547107['sendStatus'](0x194);}return _0x40059d;};}function handleError(_0x2878f3,_0x5978b2){_0x5978b2=_0x5978b2||0x1f4;return function(_0x2e5a4e){logger[_0x8961('0x26')](_0x2e5a4e[_0x8961('0x27')]);if(_0x2e5a4e[_0x8961('0x28')]){delete _0x2e5a4e[_0x8961('0x28')];}_0x2878f3[_0x8961('0x1e')](_0x5978b2)[_0x8961('0x29')](_0x2e5a4e);};}exports['index']=function(_0x4dc0a1,_0x1b0f5e){var _0x362b65={},_0x4d4df5={},_0x3d0992={'count':0x0,'rows':[]};var _0x117e9c=_[_0x8961('0x2a')](db['VoiceMailMessage'][_0x8961('0x2b')],function(_0x59004e){return{'name':_0x59004e['fieldName'],'type':_0x59004e[_0x8961('0x2c')]['key']};});_0x4d4df5['model']=_[_0x8961('0x2d')](_[_0x8961('0x2a')](_0x117e9c,_0x8961('0x28')),[_0x8961('0x28')]);_0x4d4df5['query']=_[_0x8961('0x2e')](_0x4dc0a1[_0x8961('0x2f')]);_0x4d4df5[_0x8961('0x30')]=_[_0x8961('0x31')](_0x4d4df5[_0x8961('0x32')],_0x4d4df5[_0x8961('0x2f')]);_0x362b65[_0x8961('0x33')]=_[_0x8961('0x31')](_0x4d4df5[_0x8961('0x32')],qs['fields'](_0x4dc0a1['query'][_0x8961('0x34')]));_0x362b65[_0x8961('0x33')]=_0x362b65[_0x8961('0x33')][_0x8961('0x35')]?_0x362b65['attributes']:_0x4d4df5['model'];if(!_0x4dc0a1[_0x8961('0x2f')][_0x8961('0x36')](_0x8961('0x37'))){_0x362b65[_0x8961('0x1d')]=qs[_0x8961('0x1d')](_0x4dc0a1[_0x8961('0x2f')][_0x8961('0x1d')]);_0x362b65[_0x8961('0x1a')]=qs[_0x8961('0x1a')](_0x4dc0a1[_0x8961('0x2f')][_0x8961('0x1a')]);}_0x362b65[_0x8961('0x38')]=qs[_0x8961('0x39')](_0x4dc0a1[_0x8961('0x2f')][_0x8961('0x39')]);_0x362b65[_0x8961('0x3a')]=qs[_0x8961('0x30')](_[_0x8961('0x3b')](_0x4dc0a1[_0x8961('0x2f')],_0x4d4df5[_0x8961('0x30')]),_0x117e9c);if(_0x4dc0a1[_0x8961('0x2f')][_0x8961('0x3c')]){_0x362b65[_0x8961('0x3a')]=_['merge'](_0x362b65[_0x8961('0x3a')],{'$or':_['map'](_0x117e9c,function(_0x4e3d91){if(_0x4e3d91[_0x8961('0x2c')]!==_0x8961('0x3d')){var _0x23e373={};_0x23e373[_0x4e3d91[_0x8961('0x28')]]={'$like':'%'+_0x4dc0a1[_0x8961('0x2f')][_0x8961('0x3c')]+'%'};return _0x23e373;}})});}_0x362b65=_[_0x8961('0x3e')]({},_0x362b65,_0x4dc0a1[_0x8961('0x3f')]);var _0x5dcffd={'where':_0x362b65[_0x8961('0x3a')]};return db[_0x8961('0x40')][_0x8961('0x1c')](_0x5dcffd)[_0x8961('0x24')](function(_0x42ee26){_0x3d0992[_0x8961('0x1c')]=_0x42ee26;if(_0x4dc0a1[_0x8961('0x2f')][_0x8961('0x41')]){_0x362b65[_0x8961('0x42')]=[{'all':!![]}];}return db['VoiceMailMessage']['findAll'](_0x362b65);})[_0x8961('0x24')](function(_0x48991f){_0x3d0992['rows']=_0x48991f;return _0x3d0992;})[_0x8961('0x24')](respondWithFilteredResult(_0x1b0f5e,_0x362b65))[_0x8961('0x43')](handleError(_0x1b0f5e,null));};exports[_0x8961('0x44')]=function(_0x279c2c,_0x2e3269){var _0x5ea6c7={'raw':!![],'where':{'id':_0x279c2c[_0x8961('0x45')]['id']}},_0x5cff84={};_0x5cff84[_0x8961('0x32')]=_[_0x8961('0x2e')](db[_0x8961('0x40')][_0x8961('0x2b')]);_0x5cff84[_0x8961('0x2f')]=_[_0x8961('0x2e')](_0x279c2c['query']);_0x5cff84[_0x8961('0x30')]=_['intersection'](_0x5cff84['model'],_0x5cff84['query']);_0x5ea6c7[_0x8961('0x33')]=_[_0x8961('0x31')](_0x5cff84[_0x8961('0x32')],qs[_0x8961('0x34')](_0x279c2c[_0x8961('0x2f')][_0x8961('0x34')]));_0x5ea6c7[_0x8961('0x33')]=_0x5ea6c7['attributes'][_0x8961('0x35')]?_0x5ea6c7[_0x8961('0x33')]:_0x5cff84[_0x8961('0x32')];if(_0x279c2c[_0x8961('0x2f')][_0x8961('0x41')]){_0x5ea6c7[_0x8961('0x42')]=[{'all':!![]}];}_0x5ea6c7=_[_0x8961('0x3e')]({},_0x5ea6c7,_0x279c2c[_0x8961('0x3f')]);return db['VoiceMailMessage']['find'](_0x5ea6c7)['then'](handleEntityNotFound(_0x2e3269,null))['then'](respondWithResult(_0x2e3269,null))[_0x8961('0x43')](handleError(_0x2e3269,null));};exports[_0x8961('0x46')]=function(_0x1d7ce5,_0xc9b97b){return db['VoiceMailMessage']['create'](_0x1d7ce5[_0x8961('0x47')],{})[_0x8961('0x24')](respondWithResult(_0xc9b97b,0xc9))[_0x8961('0x43')](handleError(_0xc9b97b,null));};exports[_0x8961('0x23')]=function(_0x1f5a29,_0x1ccc79){if(_0x1f5a29['body']['id']){delete _0x1f5a29[_0x8961('0x47')]['id'];}return db[_0x8961('0x40')][_0x8961('0x48')]({'where':{'id':_0x1f5a29[_0x8961('0x45')]['id']}})['then'](handleEntityNotFound(_0x1ccc79,null))[_0x8961('0x24')](saveUpdates(_0x1f5a29[_0x8961('0x47')],null))[_0x8961('0x24')](respondWithResult(_0x1ccc79,null))[_0x8961('0x43')](handleError(_0x1ccc79,null));};exports[_0x8961('0x25')]=function(_0x51b52d,_0x46557d){return db['VoiceMailMessage'][_0x8961('0x48')]({'where':{'id':_0x51b52d[_0x8961('0x45')]['id']}})[_0x8961('0x24')](handleEntityNotFound(_0x46557d,null))[_0x8961('0x24')](removeEntity(_0x46557d,null))[_0x8961('0x43')](handleError(_0x46557d,null));};exports[_0x8961('0x49')]=function(_0x123f90,_0x47f4d6,_0x498a66){return db['VoiceMailMessage'][_0x8961('0x48')]({'where':{'id':_0x123f90[_0x8961('0x45')]['id']},'attributes':['id',_0x8961('0x4a'),_0x8961('0x4b')]})[_0x8961('0x24')](handleEntityNotFound(_0x47f4d6,null))[_0x8961('0x24')](function(_0x16ee60){if(_0x16ee60){if(!_0x16ee60[_0x8961('0x4a')]){throw new db[(_0x8961('0x4c'))][(_0x8961('0x4d'))](_0x8961('0x4e'));}var _0x203ceb={'Content-Type':_0x8961('0x4f'),'Content-Disposition':'attachment'};if(_0x16ee60[_0x8961('0x4b')]){_0x203ceb[_0x8961('0x50')]=_0x8961('0x51')+_0x16ee60[_0x8961('0x4b')]+_0x8961('0x52');}_0x47f4d6[_0x8961('0x1f')](_0x203ceb);return _0x47f4d6['send'](new Buffer(_0x16ee60[_0x8961('0x4a')]));}})[_0x8961('0x43')](handleError(_0x47f4d6,null));}; \ No newline at end of file +var _0x0226=['attachment;\x20filename=\x22','.wav\x22','send','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','map','rawAttributes','fieldName','key','model','differenceBy','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','VoiceMailMessage','includeAll','include','findAll','show','options','find','catch','create','body','params','download','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','Content-Disposition'];(function(_0x5e6380,_0x41bd40){var _0x48494=function(_0x5d706b){while(--_0x5d706b){_0x5e6380['push'](_0x5e6380['shift']());}};_0x48494(++_0x41bd40);}(_0x0226,0x1a2));var _0x6022=function(_0x1bc42d,_0x1b8a92){_0x1bc42d=_0x1bc42d-0x0;var _0x2a4351=_0x0226[_0x1bc42d];return _0x2a4351;};'use strict';var emlformat=require(_0x6022('0x0'));var rimraf=require(_0x6022('0x1'));var zipdir=require(_0x6022('0x2'));var jsonpatch=require(_0x6022('0x3'));var rp=require(_0x6022('0x4'));var moment=require('moment');var BPromise=require(_0x6022('0x5'));var Mustache=require(_0x6022('0x6'));var util=require(_0x6022('0x7'));var path=require(_0x6022('0x8'));var sox=require(_0x6022('0x9'));var csv=require('to-csv');var ejs=require(_0x6022('0xa'));var fs=require('fs');var fs_extra=require(_0x6022('0xb'));var _=require('lodash');var squel=require(_0x6022('0xc'));var crypto=require(_0x6022('0xd'));var jsforce=require(_0x6022('0xe'));var deskjs=require(_0x6022('0xf'));var toCsv=require(_0x6022('0x10'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6022('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x6022('0x12'));var as=require(_0x6022('0x13'));var hardwareService=require(_0x6022('0x14'));var logger=require(_0x6022('0x15'))(_0x6022('0x16'));var utils=require(_0x6022('0x17'));var config=require(_0x6022('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3af57f,_0x25fcbe){_0x25fcbe=_0x25fcbe||0xcc;return function(_0x310bcc){if(_0x310bcc){return _0x3af57f[_0x6022('0x19')](_0x25fcbe);}return _0x3af57f[_0x6022('0x1a')](_0x25fcbe)[_0x6022('0x1b')]();};}function respondWithResult(_0x5c4281,_0x1be826){_0x1be826=_0x1be826||0xc8;return function(_0x441faa){if(_0x441faa){return _0x5c4281[_0x6022('0x1a')](_0x1be826)[_0x6022('0x1c')](_0x441faa);}};}function respondWithFilteredResult(_0x2bd0cb,_0x5ed210){return function(_0x37dbfc){if(_0x37dbfc){var _0x38f333=typeof _0x5ed210[_0x6022('0x1d')]==='undefined'&&typeof _0x5ed210['limit']===_0x6022('0x1e');var _0x45bad6=_0x37dbfc['count'];var _0x13e759=_0x38f333?0x0:_0x5ed210[_0x6022('0x1d')];var _0x4c3484=_0x38f333?_0x37dbfc[_0x6022('0x1f')]:_0x5ed210['offset']+_0x5ed210[_0x6022('0x20')];var _0x583737;if(_0x4c3484>=_0x45bad6){_0x4c3484=_0x45bad6;_0x583737=0xc8;}else{_0x583737=0xce;}_0x2bd0cb[_0x6022('0x1a')](_0x583737);return _0x2bd0cb[_0x6022('0x21')](_0x6022('0x22'),_0x13e759+'-'+_0x4c3484+'/'+_0x45bad6)[_0x6022('0x1c')](_0x37dbfc);}return null;};}function patchUpdates(_0x221ae3){return function(_0x33ec22){try{jsonpatch[_0x6022('0x23')](_0x33ec22,_0x221ae3,!![]);}catch(_0x5269c5){return BPromise[_0x6022('0x24')](_0x5269c5);}return _0x33ec22[_0x6022('0x25')]();};}function saveUpdates(_0x5bff47,_0x3798cf){return function(_0x963b0){if(_0x963b0){return _0x963b0[_0x6022('0x26')](_0x5bff47)[_0x6022('0x27')](function(_0x3f6940){return _0x3f6940;});}return null;};}function removeEntity(_0x412fd4,_0x1cb415){return function(_0x31ca95){if(_0x31ca95){return _0x31ca95[_0x6022('0x28')]()['then'](function(){_0x412fd4[_0x6022('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13df03,_0x348da9){return function(_0x1df1db){if(!_0x1df1db){_0x13df03[_0x6022('0x19')](0x194);}return _0x1df1db;};}function handleError(_0x2e3ec4,_0x3fd3da){_0x3fd3da=_0x3fd3da||0x1f4;return function(_0x18ae66){logger[_0x6022('0x29')](_0x18ae66['stack']);if(_0x18ae66[_0x6022('0x2a')]){delete _0x18ae66['name'];}_0x2e3ec4['status'](_0x3fd3da)['send'](_0x18ae66);};}exports['index']=function(_0x1241be,_0x656103){var _0x5f574f={},_0x50a5b1={},_0x3ef208={'count':0x0,'rows':[]};var _0x4a8217=_[_0x6022('0x2b')](db['VoiceMailMessage'][_0x6022('0x2c')],function(_0x1758d2){return{'name':_0x1758d2[_0x6022('0x2d')],'type':_0x1758d2['type'][_0x6022('0x2e')]};});_0x50a5b1[_0x6022('0x2f')]=_[_0x6022('0x30')](_[_0x6022('0x2b')](_0x4a8217,_0x6022('0x2a')),['name']);_0x50a5b1[_0x6022('0x31')]=_[_0x6022('0x32')](_0x1241be['query']);_0x50a5b1[_0x6022('0x33')]=_[_0x6022('0x34')](_0x50a5b1[_0x6022('0x2f')],_0x50a5b1['query']);_0x5f574f[_0x6022('0x35')]=_[_0x6022('0x34')](_0x50a5b1[_0x6022('0x2f')],qs['fields'](_0x1241be[_0x6022('0x31')]['fields']));_0x5f574f['attributes']=_0x5f574f[_0x6022('0x35')][_0x6022('0x36')]?_0x5f574f[_0x6022('0x35')]:_0x50a5b1['model'];if(!_0x1241be['query'][_0x6022('0x37')]('nolimit')){_0x5f574f[_0x6022('0x20')]=qs[_0x6022('0x20')](_0x1241be['query']['limit']);_0x5f574f[_0x6022('0x1d')]=qs[_0x6022('0x1d')](_0x1241be[_0x6022('0x31')][_0x6022('0x1d')]);}_0x5f574f['order']=qs[_0x6022('0x38')](_0x1241be[_0x6022('0x31')][_0x6022('0x38')]);_0x5f574f[_0x6022('0x39')]=qs[_0x6022('0x33')](_[_0x6022('0x3a')](_0x1241be[_0x6022('0x31')],_0x50a5b1[_0x6022('0x33')]),_0x4a8217);if(_0x1241be['query'][_0x6022('0x3b')]){_0x5f574f[_0x6022('0x39')]=_[_0x6022('0x3c')](_0x5f574f[_0x6022('0x39')],{'$or':_[_0x6022('0x2b')](_0x4a8217,function(_0x24bf96){if(_0x24bf96['type']!==_0x6022('0x3d')){var _0x579be4={};_0x579be4[_0x24bf96['name']]={'$like':'%'+_0x1241be['query'][_0x6022('0x3b')]+'%'};return _0x579be4;}})});}_0x5f574f=_['merge']({},_0x5f574f,_0x1241be['options']);var _0x461975={'where':_0x5f574f[_0x6022('0x39')]};return db[_0x6022('0x3e')][_0x6022('0x1f')](_0x461975)[_0x6022('0x27')](function(_0x541201){_0x3ef208[_0x6022('0x1f')]=_0x541201;if(_0x1241be['query'][_0x6022('0x3f')]){_0x5f574f[_0x6022('0x40')]=[{'all':!![]}];}return db[_0x6022('0x3e')][_0x6022('0x41')](_0x5f574f);})[_0x6022('0x27')](function(_0x3f6f19){_0x3ef208['rows']=_0x3f6f19;return _0x3ef208;})[_0x6022('0x27')](respondWithFilteredResult(_0x656103,_0x5f574f))['catch'](handleError(_0x656103,null));};exports[_0x6022('0x42')]=function(_0x583ad2,_0x36fd53){var _0x336135={'raw':!![],'where':{'id':_0x583ad2['params']['id']}},_0x701ba4={};_0x701ba4[_0x6022('0x2f')]=_[_0x6022('0x32')](db[_0x6022('0x3e')]['rawAttributes']);_0x701ba4[_0x6022('0x31')]=_[_0x6022('0x32')](_0x583ad2[_0x6022('0x31')]);_0x701ba4[_0x6022('0x33')]=_[_0x6022('0x34')](_0x701ba4[_0x6022('0x2f')],_0x701ba4[_0x6022('0x31')]);_0x336135['attributes']=_[_0x6022('0x34')](_0x701ba4[_0x6022('0x2f')],qs['fields'](_0x583ad2[_0x6022('0x31')]['fields']));_0x336135[_0x6022('0x35')]=_0x336135[_0x6022('0x35')][_0x6022('0x36')]?_0x336135['attributes']:_0x701ba4[_0x6022('0x2f')];if(_0x583ad2[_0x6022('0x31')][_0x6022('0x3f')]){_0x336135[_0x6022('0x40')]=[{'all':!![]}];}_0x336135=_[_0x6022('0x3c')]({},_0x336135,_0x583ad2[_0x6022('0x43')]);return db[_0x6022('0x3e')][_0x6022('0x44')](_0x336135)[_0x6022('0x27')](handleEntityNotFound(_0x36fd53,null))[_0x6022('0x27')](respondWithResult(_0x36fd53,null))[_0x6022('0x45')](handleError(_0x36fd53,null));};exports['create']=function(_0x38983a,_0x696b8a){return db[_0x6022('0x3e')][_0x6022('0x46')](_0x38983a[_0x6022('0x47')],{})[_0x6022('0x27')](respondWithResult(_0x696b8a,0xc9))[_0x6022('0x45')](handleError(_0x696b8a,null));};exports['update']=function(_0x4fe99d,_0x2b48f8){if(_0x4fe99d['body']['id']){delete _0x4fe99d[_0x6022('0x47')]['id'];}return db[_0x6022('0x3e')][_0x6022('0x44')]({'where':{'id':_0x4fe99d['params']['id']}})[_0x6022('0x27')](handleEntityNotFound(_0x2b48f8,null))[_0x6022('0x27')](saveUpdates(_0x4fe99d[_0x6022('0x47')],null))['then'](respondWithResult(_0x2b48f8,null))[_0x6022('0x45')](handleError(_0x2b48f8,null));};exports[_0x6022('0x28')]=function(_0x5d565c,_0x2ab25d){return db[_0x6022('0x3e')][_0x6022('0x44')]({'where':{'id':_0x5d565c[_0x6022('0x48')]['id']}})[_0x6022('0x27')](handleEntityNotFound(_0x2ab25d,null))[_0x6022('0x27')](removeEntity(_0x2ab25d,null))['catch'](handleError(_0x2ab25d,null));};exports[_0x6022('0x49')]=function(_0x69d9b2,_0x2d4b67,_0x255f72){return db[_0x6022('0x3e')][_0x6022('0x44')]({'where':{'id':_0x69d9b2[_0x6022('0x48')]['id']},'attributes':['id',_0x6022('0x4a'),_0x6022('0x4b')]})['then'](handleEntityNotFound(_0x2d4b67,null))[_0x6022('0x27')](function(_0x402132){if(_0x402132){if(!_0x402132[_0x6022('0x4a')]){throw new db['Sequelize'][(_0x6022('0x4c'))](_0x6022('0x4d'));}var _0x326156={'Content-Type':_0x6022('0x4e'),'Content-Disposition':'attachment'};if(_0x402132['msg_id']){_0x326156[_0x6022('0x4f')]=_0x6022('0x50')+_0x402132['msg_id']+_0x6022('0x51');}_0x2d4b67['set'](_0x326156);return _0x2d4b67[_0x6022('0x52')](new Buffer(_0x402132[_0x6022('0x4a')]));}})['catch'](handleError(_0x2d4b67,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 1242d3d..1177dc3 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 _0x2849=['define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x54453f,_0x1bcb25){var _0x6390c7=function(_0x1b7ae5){while(--_0x1b7ae5){_0x54453f['push'](_0x54453f['shift']());}};_0x6390c7(++_0x1bcb25);}(_0x2849,0x1b6));var _0x9284=function(_0xaef48a,_0xf2ec94){_0xaef48a=_0xaef48a-0x0;var _0x53e0de=_0x2849[_0xaef48a];return _0x53e0de;};'use strict';var _=require(_0x9284('0x0'));var util=require(_0x9284('0x1'));var logger=require(_0x9284('0x2'))(_0x9284('0x3'));var moment=require(_0x9284('0x4'));var BPromise=require(_0x9284('0x5'));var rp=require(_0x9284('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9284('0x7'));var config=require(_0x9284('0x8'));var attributes=require('./voiceMailMessage.attributes');module[_0x9284('0x9')]=function(_0x12ab9e,_0x79a53){return _0x12ab9e[_0x9284('0xa')](_0x9284('0xb'),attributes,{'tableName':_0x9284('0xc'),'paranoid':![],'indexes':[{'name':_0x9284('0xd'),'fields':[_0x9284('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x7ee6=['moment','bluebird','path','rimraf','../../config/environment','./voiceMailMessage.attributes','define','voice_voicemail_messages','dir','util','../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x7ee6,0x17f));var _0x67ee=function(_0x3ed61e,_0x5eb2e6){_0x3ed61e=_0x3ed61e-0x0;var _0x74cfbe=_0x7ee6[_0x3ed61e];return _0x74cfbe;};'use strict';var _=require('lodash');var util=require(_0x67ee('0x0'));var logger=require(_0x67ee('0x1'))('api');var moment=require(_0x67ee('0x2'));var BPromise=require(_0x67ee('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x67ee('0x4'));var rimraf=require(_0x67ee('0x5'));var config=require(_0x67ee('0x6'));var attributes=require(_0x67ee('0x7'));module['exports']=function(_0x4528b6,_0x27cd79){return _0x4528b6[_0x67ee('0x8')]('VoiceMailMessage',attributes,{'tableName':_0x67ee('0x9'),'paranoid':![],'indexes':[{'name':'dir','fields':[_0x67ee('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 61ddded..7ba104f 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 _0xe2bf=['ioredis','../../config/utils','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMailMessage,\x20%s,\x20%s','message','catch','util','moment','randomstring'];(function(_0xf84870,_0x4dc38f){var _0x4541a4=function(_0x3ff5d5){while(--_0x3ff5d5){_0xf84870['push'](_0xf84870['shift']());}};_0x4541a4(++_0x4dc38f);}(_0xe2bf,0x95));var _0xfe2b=function(_0x72a890,_0x398f10){_0x72a890=_0x72a890-0x0;var _0x5c4eef=_0xe2bf[_0x72a890];return _0x5c4eef;};'use strict';var _=require('lodash');var util=require(_0xfe2b('0x0'));var moment=require(_0xfe2b('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe2b('0x2'));var fs=require('fs');var Redis=require(_0xfe2b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe2b('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xfe2b('0x5'));var client=jayson[_0xfe2b('0x6')][_0xfe2b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1f25f8,_0x20df7a,_0x23efe8){return new BPromise(function(_0x1c0be1,_0x267289){return client[_0xfe2b('0x8')](_0x1f25f8,_0x23efe8)[_0xfe2b('0x9')](function(_0x5002b8){logger[_0xfe2b('0xa')]('VoiceMailMessage,\x20%s,\x20%s',_0x20df7a,_0xfe2b('0xb'));logger[_0xfe2b('0xc')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x20df7a,'request\x20sent',JSON[_0xfe2b('0xd')](_0x5002b8));if(_0x5002b8[_0xfe2b('0xe')]){if(_0x5002b8[_0xfe2b('0xe')][_0xfe2b('0xf')]===0x1f4){logger[_0xfe2b('0xe')](_0xfe2b('0x10'),_0x20df7a,_0x5002b8[_0xfe2b('0xe')][_0xfe2b('0x11')]);return _0x267289(_0x5002b8[_0xfe2b('0xe')][_0xfe2b('0x11')]);}logger[_0xfe2b('0xe')](_0xfe2b('0x10'),_0x20df7a,_0x5002b8[_0xfe2b('0xe')][_0xfe2b('0x11')]);return _0x1c0be1(_0x5002b8[_0xfe2b('0xe')]['message']);}else{logger[_0xfe2b('0xa')](_0xfe2b('0x10'),_0x20df7a,_0xfe2b('0xb'));_0x1c0be1(_0x5002b8['result']['message']);}})[_0xfe2b('0x12')](function(_0x5dec79){logger['error'](_0xfe2b('0x10'),_0x20df7a,_0x5dec79);_0x267289(_0x5dec79);});});} \ No newline at end of file +var _0xb544=['ioredis','rpc','../../config/environment','client','http','request','then','info','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','VoiceMailMessage,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring'];(function(_0x242efe,_0x27b709){var _0x464ee6=function(_0xac111a){while(--_0xac111a){_0x242efe['push'](_0x242efe['shift']());}};_0x464ee6(++_0x27b709);}(_0xb544,0x1de));var _0x4b54=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0xb544[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require(_0x4b54('0x0'));var util=require(_0x4b54('0x1'));var moment=require(_0x4b54('0x2'));var BPromise=require(_0x4b54('0x3'));var rs=require(_0x4b54('0x4'));var fs=require('fs');var Redis=require(_0x4b54('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4b54('0x6'));var config=require(_0x4b54('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x4b54('0x8')][_0x4b54('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x80b5c,_0x3b5167,_0xf72241){return new BPromise(function(_0x1e8514,_0x360807){return client[_0x4b54('0xa')](_0x80b5c,_0xf72241)[_0x4b54('0xb')](function(_0x5755e4){logger[_0x4b54('0xc')]('VoiceMailMessage,\x20%s,\x20%s',_0x3b5167,_0x4b54('0xd'));logger[_0x4b54('0xe')](_0x4b54('0xf'),_0x3b5167,'request\x20sent',JSON[_0x4b54('0x10')](_0x5755e4));if(_0x5755e4['error']){if(_0x5755e4[_0x4b54('0x11')]['code']===0x1f4){logger[_0x4b54('0x11')](_0x4b54('0x12'),_0x3b5167,_0x5755e4[_0x4b54('0x11')][_0x4b54('0x13')]);return _0x360807(_0x5755e4[_0x4b54('0x11')][_0x4b54('0x13')]);}logger[_0x4b54('0x11')](_0x4b54('0x12'),_0x3b5167,_0x5755e4[_0x4b54('0x11')][_0x4b54('0x13')]);return _0x1e8514(_0x5755e4[_0x4b54('0x11')][_0x4b54('0x13')]);}else{logger[_0x4b54('0xc')](_0x4b54('0x12'),_0x3b5167,_0x4b54('0xd'));_0x1e8514(_0x5755e4[_0x4b54('0x14')][_0x4b54('0x13')]);}})['catch'](function(_0x4ccd63){logger[_0x4b54('0x11')](_0x4b54('0x12'),_0x3b5167,_0x4ccd63);_0x360807(_0x4ccd63);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 7e369fd..a65e63b 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 _0x7532=['update','destroy','/:id/sounds/:id2','removeSound','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/sounds','getSounds','post','create','addSound','put'];(function(_0x453f93,_0x54e2d5){var _0x4549e7=function(_0x56fb05){while(--_0x56fb05){_0x453f93['push'](_0x453f93['shift']());}};_0x4549e7(++_0x54e2d5);}(_0x7532,0x15e));var _0x2753=function(_0x50aea5,_0x5dd077){_0x50aea5=_0x50aea5-0x0;var _0x4657f1=_0x7532[_0x50aea5];return _0x4657f1;};'use strict';var multer=require(_0x2753('0x0'));var util=require(_0x2753('0x1'));var path=require(_0x2753('0x2'));var timeout=require('connect-timeout');var express=require(_0x2753('0x3'));var router=express['Router']();var fs_extra=require(_0x2753('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2753('0x5'));var config=require(_0x2753('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0x2753('0x7')]('/',auth[_0x2753('0x8')](),controller[_0x2753('0x9')]);router[_0x2753('0x7')](_0x2753('0xa'),auth[_0x2753('0x8')](),controller[_0x2753('0xb')]);router[_0x2753('0x7')](_0x2753('0xc'),auth['isAuthenticated'](),controller[_0x2753('0xd')]);router[_0x2753('0xe')]('/',auth[_0x2753('0x8')](),controller[_0x2753('0xf')]);router[_0x2753('0xe')](_0x2753('0xc'),auth[_0x2753('0x8')](),controller[_0x2753('0x10')]);router[_0x2753('0x11')](_0x2753('0xa'),auth[_0x2753('0x8')](),controller[_0x2753('0x12')]);router['delete'](_0x2753('0xa'),auth['isAuthenticated'](),controller[_0x2753('0x13')]);router['delete'](_0x2753('0x14'),auth[_0x2753('0x8')](),controller[_0x2753('0x15')]);module[_0x2753('0x16')]=router; \ No newline at end of file +var _0x5a41=['util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','isAuthenticated','index','/:id/sounds','getSounds','post','create','addSound','put','/:id','update','delete','destroy','/:id/sounds/:id2','removeSound','exports','multer'];(function(_0x37db5e,_0xd9c83d){var _0x1352dc=function(_0x5d3501){while(--_0x5d3501){_0x37db5e['push'](_0x37db5e['shift']());}};_0x1352dc(++_0xd9c83d);}(_0x5a41,0x1da));var _0x15a4=function(_0xa7efd7,_0x45c885){_0xa7efd7=_0xa7efd7-0x0;var _0x572019=_0x5a41[_0xa7efd7];return _0x572019;};'use strict';var multer=require(_0x15a4('0x0'));var util=require(_0x15a4('0x1'));var path=require(_0x15a4('0x2'));var timeout=require(_0x15a4('0x3'));var express=require(_0x15a4('0x4'));var router=express[_0x15a4('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x15a4('0x6'));var config=require(_0x15a4('0x7'));var controller=require(_0x15a4('0x8'));router[_0x15a4('0x9')]('/',auth[_0x15a4('0xa')](),controller[_0x15a4('0xb')]);router[_0x15a4('0x9')]('/:id',auth[_0x15a4('0xa')](),controller['show']);router[_0x15a4('0x9')](_0x15a4('0xc'),auth[_0x15a4('0xa')](),controller[_0x15a4('0xd')]);router[_0x15a4('0xe')]('/',auth[_0x15a4('0xa')](),controller[_0x15a4('0xf')]);router['post'](_0x15a4('0xc'),auth[_0x15a4('0xa')](),controller[_0x15a4('0x10')]);router[_0x15a4('0x11')](_0x15a4('0x12'),auth[_0x15a4('0xa')](),controller[_0x15a4('0x13')]);router[_0x15a4('0x14')](_0x15a4('0x12'),auth[_0x15a4('0xa')](),controller[_0x15a4('0x15')]);router[_0x15a4('0x14')](_0x15a4('0x16'),auth[_0x15a4('0xa')](),controller[_0x15a4('0x17')]);module[_0x15a4('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 61039bf..8d6b415 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 _0x68c1=['alpha','TIMESTAMP','exports','STRING','name','ENUM','mp3nb','quietmp3','mp3'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x68c1,0x17c));var _0x168c=function(_0x59f691,_0x1b656d){_0x59f691=_0x59f691-0x0;var _0x1f80bb=_0x68c1[_0x59f691];return _0x1f80bb;};'use strict';var Sequelize=require('sequelize');module[_0x168c('0x0')]={'name':{'type':Sequelize[_0x168c('0x1')],'allowNull':![],'unique':_0x168c('0x2')},'mode':{'type':Sequelize[_0x168c('0x3')]('custom','files',_0x168c('0x4'),'quietmp3nb',_0x168c('0x5'),_0x168c('0x6')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0x168c('0x1')],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0x168c('0x1')],'allowNull':!![],'defaultValue':_0x168c('0x7')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':_0x168c('0x8')},'defaultEntry':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0}}; \ No newline at end of file +var _0x71bb=['TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','mp3nb','quietmp3nb','mp3','files','alpha'];(function(_0x48ee3a,_0x3f0d31){var _0x4cbcbf=function(_0x34b5c6){while(--_0x34b5c6){_0x48ee3a['push'](_0x48ee3a['shift']());}};_0x4cbcbf(++_0x3f0d31);}(_0x71bb,0xce));var _0xb71b=function(_0x2e2d1b,_0x37e448){_0x2e2d1b=_0x2e2d1b-0x0;var _0x5ba25e=_0x71bb[_0x2e2d1b];return _0x5ba25e;};'use strict';var Sequelize=require(_0xb71b('0x0'));module[_0xb71b('0x1')]={'name':{'type':Sequelize[_0xb71b('0x2')],'allowNull':![],'unique':_0xb71b('0x3')},'mode':{'type':Sequelize[_0xb71b('0x4')]('custom','files',_0xb71b('0x5'),_0xb71b('0x6'),'quietmp3',_0xb71b('0x7')),'allowNull':!![],'defaultValue':_0xb71b('0x8')},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xb71b('0x9')},'format':{'type':Sequelize[_0xb71b('0x2')],'allowNull':!![]},'stamp':{'type':_0xb71b('0xa')},'defaultEntry':{'type':Sequelize[_0xb71b('0xb')],'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 2a7d12c..99c857d 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 _0xf7c8=['0777','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','findOne','save_name','converted_format','createdAt','root','server/files/sounds/converted','extname','format','symlinkSync','message','removeSound','id2','%s.%s','getSounds','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','Content-Range','json','apply','reject','save','update','then','destroy','MusicOnHolds','UserProfileResource','error','stack','name','send','index','map','VoiceMusicOnHold','rawAttributes','fieldName','type','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','params','include','find','body','sequelize','transaction','mode','files','directory','join','server/files/moh','create','mkdirSync'];(function(_0x4def54,_0x36de1d){var _0x137bee=function(_0x1dd6f4){while(--_0x1dd6f4){_0x4def54['push'](_0x4def54['shift']());}};_0x137bee(++_0x36de1d);}(_0xf7c8,0x89));var _0x8f7c=function(_0x14c940,_0x121b4c){_0x14c940=_0x14c940-0x0;var _0x2ae9f3=_0xf7c8[_0x14c940];return _0x2ae9f3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8f7c('0x0'));var zipdir=require(_0x8f7c('0x1'));var jsonpatch=require(_0x8f7c('0x2'));var rp=require(_0x8f7c('0x3'));var moment=require('moment');var BPromise=require(_0x8f7c('0x4'));var Mustache=require('mustache');var util=require(_0x8f7c('0x5'));var path=require(_0x8f7c('0x6'));var sox=require('sox');var csv=require(_0x8f7c('0x7'));var ejs=require(_0x8f7c('0x8'));var fs=require('fs');var fs_extra=require(_0x8f7c('0x9'));var _=require('lodash');var squel=require(_0x8f7c('0xa'));var crypto=require(_0x8f7c('0xb'));var jsforce=require(_0x8f7c('0xc'));var deskjs=require(_0x8f7c('0xd'));var toCsv=require(_0x8f7c('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8f7c('0xe'));var authService=require(_0x8f7c('0xf'));var qs=require(_0x8f7c('0x10'));var as=require(_0x8f7c('0x11'));var hardwareService=require(_0x8f7c('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x8f7c('0x13'));var config=require(_0x8f7c('0x14'));var licenseUtil=require(_0x8f7c('0x15'));var db=require(_0x8f7c('0x16'))['db'];function respondWithStatusCode(_0x180824,_0xbf2e37){_0xbf2e37=_0xbf2e37||0xcc;return function(_0x4284c3){if(_0x4284c3){return _0x180824[_0x8f7c('0x17')](_0xbf2e37);}return _0x180824[_0x8f7c('0x18')](_0xbf2e37)[_0x8f7c('0x19')]();};}function respondWithResult(_0x48c732,_0x3a52d0){_0x3a52d0=_0x3a52d0||0xc8;return function(_0x5f368a){if(_0x5f368a){return _0x48c732[_0x8f7c('0x18')](_0x3a52d0)['json'](_0x5f368a);}};}function respondWithFilteredResult(_0x4f85db,_0x30b872){return function(_0x92058e){if(_0x92058e){var _0x5ee47f=typeof _0x30b872[_0x8f7c('0x1a')]==='undefined'&&typeof _0x30b872[_0x8f7c('0x1b')]===_0x8f7c('0x1c');var _0x2b10a4=_0x92058e[_0x8f7c('0x1d')];var _0x390cc4=_0x5ee47f?0x0:_0x30b872['offset'];var _0x34af07=_0x5ee47f?_0x92058e['count']:_0x30b872[_0x8f7c('0x1a')]+_0x30b872['limit'];var _0x498f94;if(_0x34af07>=_0x2b10a4){_0x34af07=_0x2b10a4;_0x498f94=0xc8;}else{_0x498f94=0xce;}_0x4f85db[_0x8f7c('0x18')](_0x498f94);return _0x4f85db['set'](_0x8f7c('0x1e'),_0x390cc4+'-'+_0x34af07+'/'+_0x2b10a4)[_0x8f7c('0x1f')](_0x92058e);}return null;};}function patchUpdates(_0x4fa2ea){return function(_0x22df6d){try{jsonpatch[_0x8f7c('0x20')](_0x22df6d,_0x4fa2ea,!![]);}catch(_0x4227cd){return BPromise[_0x8f7c('0x21')](_0x4227cd);}return _0x22df6d[_0x8f7c('0x22')]();};}function saveUpdates(_0xba6ee9,_0x5ea785){return function(_0x7f6a48){if(_0x7f6a48){return _0x7f6a48[_0x8f7c('0x23')](_0xba6ee9)[_0x8f7c('0x24')](function(_0x44d376){return _0x44d376;});}return null;};}function removeEntity(_0x23cf57,_0x5b4ae5){return function(_0x215771){if(_0x215771){return _0x215771[_0x8f7c('0x25')]()[_0x8f7c('0x24')](function(){var _0xd7b1bc=_0x215771['get']({'plain':!![]});var _0x248ec4=_0x8f7c('0x26');return db[_0x8f7c('0x27')][_0x8f7c('0x25')]({'where':{'type':_0x248ec4,'resourceId':_0xd7b1bc['id']}})[_0x8f7c('0x24')](function(){return _0x215771;});})['then'](function(){_0x23cf57[_0x8f7c('0x18')](0xcc)[_0x8f7c('0x19')]();});}};}function handleEntityNotFound(_0x4697cd,_0x4d5117){return function(_0xfc78e3){if(!_0xfc78e3){_0x4697cd['sendStatus'](0x194);}return _0xfc78e3;};}function handleError(_0x24bbef,_0x27bf7d){_0x27bf7d=_0x27bf7d||0x1f4;return function(_0x3c4319){logger[_0x8f7c('0x28')](_0x3c4319[_0x8f7c('0x29')]);if(_0x3c4319['name']){delete _0x3c4319[_0x8f7c('0x2a')];}_0x24bbef['status'](_0x27bf7d)[_0x8f7c('0x2b')](_0x3c4319);};}exports[_0x8f7c('0x2c')]=function(_0x32f249,_0x5b295a){var _0x7f69db={},_0x2c0140={},_0x5404fc={'count':0x0,'rows':[]};var _0x53fc36=_[_0x8f7c('0x2d')](db[_0x8f7c('0x2e')][_0x8f7c('0x2f')],function(_0x40953c){return{'name':_0x40953c[_0x8f7c('0x30')],'type':_0x40953c[_0x8f7c('0x31')]['key']};});_0x2c0140['model']=_['map'](_0x53fc36,_0x8f7c('0x2a'));_0x2c0140['query']=_[_0x8f7c('0x32')](_0x32f249[_0x8f7c('0x33')]);_0x2c0140[_0x8f7c('0x34')]=_[_0x8f7c('0x35')](_0x2c0140[_0x8f7c('0x36')],_0x2c0140['query']);_0x7f69db[_0x8f7c('0x37')]=_[_0x8f7c('0x35')](_0x2c0140['model'],qs[_0x8f7c('0x38')](_0x32f249['query'][_0x8f7c('0x38')]));_0x7f69db['attributes']=_0x7f69db[_0x8f7c('0x37')][_0x8f7c('0x39')]?_0x7f69db[_0x8f7c('0x37')]:_0x2c0140[_0x8f7c('0x36')];if(!_0x32f249[_0x8f7c('0x33')][_0x8f7c('0x3a')](_0x8f7c('0x3b'))){_0x7f69db[_0x8f7c('0x1b')]=qs[_0x8f7c('0x1b')](_0x32f249['query'][_0x8f7c('0x1b')]);_0x7f69db[_0x8f7c('0x1a')]=qs[_0x8f7c('0x1a')](_0x32f249[_0x8f7c('0x33')][_0x8f7c('0x1a')]);}_0x7f69db['order']=qs[_0x8f7c('0x3c')](_0x32f249[_0x8f7c('0x33')][_0x8f7c('0x3c')]);delete _0x32f249[_0x8f7c('0x33')][_0x8f7c('0x3c')];_0x7f69db[_0x8f7c('0x3d')]=qs['filters'](_[_0x8f7c('0x3e')](_0x32f249['query'],_0x2c0140[_0x8f7c('0x34')]),_0x53fc36);if(_0x32f249[_0x8f7c('0x33')][_0x8f7c('0x3f')]){_0x7f69db[_0x8f7c('0x3d')]=_[_0x8f7c('0x40')](_0x7f69db[_0x8f7c('0x3d')],{'$or':_[_0x8f7c('0x2d')](_0x53fc36,function(_0x522846){if(_0x522846['type']!==_0x8f7c('0x41')){var _0x377384={};_0x377384[_0x522846[_0x8f7c('0x2a')]]={'$like':'%'+_0x32f249[_0x8f7c('0x33')][_0x8f7c('0x3f')]+'%'};return _0x377384;}})});}_0x7f69db=_['merge']({},_0x7f69db,_0x32f249[_0x8f7c('0x42')]);var _0x322590={'where':_0x7f69db[_0x8f7c('0x3d')]};return db[_0x8f7c('0x2e')][_0x8f7c('0x1d')](_0x322590)[_0x8f7c('0x24')](function(_0x574b75){_0x5404fc[_0x8f7c('0x1d')]=_0x574b75;if(_0x32f249[_0x8f7c('0x33')][_0x8f7c('0x43')]){_0x7f69db['include']=[{'all':!![]}];}return db['VoiceMusicOnHold']['findAll'](_0x7f69db);})[_0x8f7c('0x24')](function(_0x428ca6){_0x5404fc[_0x8f7c('0x44')]=_0x428ca6;return _0x5404fc;})['then'](respondWithFilteredResult(_0x5b295a,_0x7f69db))[_0x8f7c('0x45')](handleError(_0x5b295a,null));};exports['show']=function(_0x7902c4,_0x1b79f2){var _0x4d761d={'raw':![],'where':{'id':_0x7902c4[_0x8f7c('0x46')]['id']}},_0xab2db7={};_0xab2db7[_0x8f7c('0x36')]=_[_0x8f7c('0x32')](db[_0x8f7c('0x2e')][_0x8f7c('0x2f')]);_0xab2db7['query']=_[_0x8f7c('0x32')](_0x7902c4['query']);_0xab2db7['filters']=_[_0x8f7c('0x35')](_0xab2db7[_0x8f7c('0x36')],_0xab2db7[_0x8f7c('0x33')]);_0x4d761d[_0x8f7c('0x37')]=_[_0x8f7c('0x35')](_0xab2db7[_0x8f7c('0x36')],qs[_0x8f7c('0x38')](_0x7902c4[_0x8f7c('0x33')][_0x8f7c('0x38')]));_0x4d761d[_0x8f7c('0x37')]=_0x4d761d[_0x8f7c('0x37')][_0x8f7c('0x39')]?_0x4d761d[_0x8f7c('0x37')]:_0xab2db7[_0x8f7c('0x36')];if(_0x7902c4[_0x8f7c('0x33')][_0x8f7c('0x43')]){_0x4d761d[_0x8f7c('0x47')]=[{'all':!![]}];}_0x4d761d=_[_0x8f7c('0x40')]({},_0x4d761d,_0x7902c4[_0x8f7c('0x42')]);return db[_0x8f7c('0x2e')][_0x8f7c('0x48')](_0x4d761d)[_0x8f7c('0x24')](handleEntityNotFound(_0x1b79f2,null))[_0x8f7c('0x24')](respondWithResult(_0x1b79f2,null))['catch'](handleError(_0x1b79f2,null));};exports['update']=function(_0x227706,_0x157705){if(_0x227706['body']['id']){delete _0x227706['body']['id'];}return db[_0x8f7c('0x2e')]['find']({'where':{'id':_0x227706[_0x8f7c('0x46')]['id']}})[_0x8f7c('0x24')](handleEntityNotFound(_0x157705,null))[_0x8f7c('0x24')](saveUpdates(_0x227706[_0x8f7c('0x49')],null))[_0x8f7c('0x24')](respondWithResult(_0x157705,null))['catch'](handleError(_0x157705,null));};exports['create']=function(_0x5a1ae3,_0x5d0f69,_0x3c0c44){return db[_0x8f7c('0x4a')][_0x8f7c('0x4b')](function(_0x556e23){if(_0x5a1ae3[_0x8f7c('0x49')][_0x8f7c('0x4c')]===_0x8f7c('0x4d')){_0x5a1ae3['body'][_0x8f7c('0x4e')]=path[_0x8f7c('0x4f')](config['root'],_0x8f7c('0x50'),_0x5a1ae3[_0x8f7c('0x49')][_0x8f7c('0x2a')]);}return db['VoiceMusicOnHold'][_0x8f7c('0x51')](_0x5a1ae3[_0x8f7c('0x49')],{'transaction':_0x556e23})[_0x8f7c('0x24')](function(_0x3f2709){if(_0x5a1ae3[_0x8f7c('0x49')]['mode']===_0x8f7c('0x4d')){fs[_0x8f7c('0x52')](_0x3f2709[_0x8f7c('0x4e')],parseInt(_0x8f7c('0x53'),0x8));}var _0x327c5c=_0x5a1ae3['user'][_0x8f7c('0x54')]({'plain':!![]});if(!_0x327c5c)throw new Error(_0x8f7c('0x55'));if(_0x327c5c[_0x8f7c('0x56')]===_0x8f7c('0x57')){var _0x3bef09=_0x3f2709[_0x8f7c('0x54')]({'plain':!![]});return db['UserProfileSection'][_0x8f7c('0x48')]({'where':{'name':_0x8f7c('0x26'),'userProfileId':_0x327c5c['userProfileId']},'raw':!![]})[_0x8f7c('0x24')](function(_0x1f20d6){if(_0x1f20d6&&_0x1f20d6[_0x8f7c('0x58')]===0x0){return db['UserProfileResource'][_0x8f7c('0x51')]({'name':_0x3bef09['name'],'resourceId':_0x3bef09['id'],'type':_0x1f20d6[_0x8f7c('0x2a')],'sectionId':_0x1f20d6['id']},{})['then'](function(){return _0x3f2709;});}else{return _0x3f2709;}})[_0x8f7c('0x45')](function(_0x19c726){logger[_0x8f7c('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x19c726);});}return _0x3f2709;});})[_0x8f7c('0x24')](respondWithResult(_0x5d0f69,0xc9))[_0x8f7c('0x45')](handleError(_0x5d0f69,null));};exports[_0x8f7c('0x25')]=function(_0x42a50d,_0x110f11,_0x2f37a0){var _0x18805a;return db[_0x8f7c('0x2e')]['find']({'where':{'id':_0x42a50d['params']['id']}})['then'](function(_0x54a7f9){if(_0x54a7f9){return db[_0x8f7c('0x4a')]['transaction'](function(_0x4b7390){return _0x54a7f9[_0x8f7c('0x25')]({'transaction':_0x4b7390,'raw':!![]})[_0x8f7c('0x24')](function(_0x50b498){if(_0x50b498[_0x8f7c('0x4e')]){fs['readdirSync'](_0x50b498[_0x8f7c('0x4e')])[_0x8f7c('0x59')](function(_0x32b8e3){fs[_0x8f7c('0x5a')](path[_0x8f7c('0x4f')](_0x50b498[_0x8f7c('0x4e')],_0x32b8e3));});fs[_0x8f7c('0x5b')](_0x50b498[_0x8f7c('0x4e')]);}return _0x50b498;});})[_0x8f7c('0x45')](function(_0x5c55ce){throw new db[(_0x8f7c('0x5c'))][(_0x8f7c('0x5d'))](_0x5c55ce['message']);});}})[_0x8f7c('0x24')](handleEntityNotFound(_0x110f11,null))[_0x8f7c('0x24')](removeEntity(_0x110f11,null))['catch'](handleError(_0x110f11,null));};exports[_0x8f7c('0x5e')]=function(_0x4ac3d7,_0x2edc25,_0xff0d5d){return db[_0x8f7c('0x4a')][_0x8f7c('0x4b')](function(_0x55a23a){var _0x1f516d;return db['VoiceMusicOnHold'][_0x8f7c('0x48')]({'where':{'id':_0x4ac3d7[_0x8f7c('0x46')]['id']}})[_0x8f7c('0x24')](function(_0x24e3db){if(_0x24e3db){_0x1f516d=_0x24e3db;return _0x24e3db[_0x8f7c('0x5e')](_0x4ac3d7['body']['id'],{'transaction':_0x55a23a});}})['then'](function(_0x8e35be){if(_0x8e35be){return db[_0x8f7c('0x5f')][_0x8f7c('0x60')]({'where':{'id':_0x4ac3d7[_0x8f7c('0x49')]['id']},'attributes':['id',_0x8f7c('0x2a'),_0x8f7c('0x61'),_0x8f7c('0x62'),_0x8f7c('0x63')],'raw':!![]});}})[_0x8f7c('0x24')](function(_0x2cf8fb){if(_0x2cf8fb){var _0x4b8ad0=path['join'](config[_0x8f7c('0x64')],_0x8f7c('0x65'),util['format']('%s.%s',path['basename'](_0x2cf8fb[_0x8f7c('0x61')],path[_0x8f7c('0x66')](_0x2cf8fb[_0x8f7c('0x61')])),_0x2cf8fb['converted_format']));var _0x67120f=path[_0x8f7c('0x4f')](config[_0x8f7c('0x64')],'server/files/moh',_0x1f516d[_0x8f7c('0x2a')],util[_0x8f7c('0x67')]('%s.%s',_0x2cf8fb[_0x8f7c('0x2a')],_0x2cf8fb[_0x8f7c('0x62')]));fs[_0x8f7c('0x68')](_0x4b8ad0,_0x67120f);return _0x2cf8fb;}})['catch'](function(_0x40ef96){throw new db[(_0x8f7c('0x5c'))][(_0x8f7c('0x5d'))](_0x40ef96[_0x8f7c('0x69')]);});})[_0x8f7c('0x24')](handleEntityNotFound(_0x2edc25,null))['then'](respondWithResult(_0x2edc25,0xc9))[_0x8f7c('0x45')](handleError(_0x2edc25,null));};exports[_0x8f7c('0x6a')]=function(_0x406ba3,_0x5b0133,_0x7bd6bc){return db[_0x8f7c('0x4a')]['transaction'](function(_0x28fa86){var _0x2c7714;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x406ba3['params']['id']}})[_0x8f7c('0x24')](handleEntityNotFound(_0x5b0133,null))['then'](function(_0x20f661){if(_0x20f661){_0x2c7714=_0x20f661;return _0x20f661[_0x8f7c('0x6a')](_0x406ba3['params']['id2']);}})[_0x8f7c('0x24')](function(_0x1ddbb8){if(_0x1ddbb8){return db[_0x8f7c('0x5f')][_0x8f7c('0x60')]({'where':{'id':_0x406ba3[_0x8f7c('0x46')][_0x8f7c('0x6b')]},'attributes':['id','name',_0x8f7c('0x61'),_0x8f7c('0x62'),_0x8f7c('0x63')],'raw':!![]});}})[_0x8f7c('0x24')](function(_0x4cbe9d){if(_0x4cbe9d){fs['unlinkSync'](path[_0x8f7c('0x4f')](_0x2c7714[_0x8f7c('0x4e')],util[_0x8f7c('0x67')](_0x8f7c('0x6c'),_0x4cbe9d[_0x8f7c('0x2a')],_0x4cbe9d['converted_format'])));return _0x4cbe9d;}})[_0x8f7c('0x45')](function(_0xb516f0){throw new db[(_0x8f7c('0x5c'))][(_0x8f7c('0x5d'))](_0xb516f0[_0x8f7c('0x69')]);});})[_0x8f7c('0x24')](handleEntityNotFound(_0x5b0133,null))[_0x8f7c('0x24')](respondWithStatusCode(_0x5b0133,0xcc))[_0x8f7c('0x45')](handleError(_0x5b0133,null));};exports[_0x8f7c('0x6d')]=function(_0x522f3f,_0xa4cb34,_0x3c5ceb){var _0x42798d={};var _0xe4801={};var _0x36fbe5;var _0xb8b030;return db[_0x8f7c('0x2e')]['findOne']({'where':{'id':_0x522f3f[_0x8f7c('0x46')]['id']}})[_0x8f7c('0x24')](handleEntityNotFound(_0xa4cb34,null))[_0x8f7c('0x24')](function(_0x201ac7){if(_0x201ac7){_0x36fbe5=_0x201ac7;_0xe4801[_0x8f7c('0x36')]=_[_0x8f7c('0x32')](db[_0x8f7c('0x5f')]['rawAttributes']);_0xe4801[_0x8f7c('0x33')]=_[_0x8f7c('0x32')](_0x522f3f['query']);_0xe4801['filters']=_['intersection'](_0xe4801[_0x8f7c('0x36')],_0xe4801['query']);_0x42798d['attributes']=_['intersection'](_0xe4801['model'],qs[_0x8f7c('0x38')](_0x522f3f['query'][_0x8f7c('0x38')]));_0x42798d[_0x8f7c('0x37')]=_0x42798d[_0x8f7c('0x37')]['length']?_0x42798d['attributes']:_0xe4801['model'];_0x42798d['order']=qs[_0x8f7c('0x3c')](_0x522f3f[_0x8f7c('0x33')][_0x8f7c('0x3c')]);_0x42798d[_0x8f7c('0x3d')]=qs['filters'](_[_0x8f7c('0x3e')](_0x522f3f['query'],_0xe4801['filters']));if(_0x522f3f[_0x8f7c('0x33')][_0x8f7c('0x3f')]){_0x42798d['where']=_[_0x8f7c('0x40')](_0x42798d[_0x8f7c('0x3d')],{'$or':_[_0x8f7c('0x2d')](_0x42798d[_0x8f7c('0x37')],function(_0x28be73){var _0x1de451={};_0x1de451[_0x28be73]={'$like':'%'+_0x522f3f[_0x8f7c('0x33')]['filter']+'%'};return _0x1de451;})});}_0x42798d=_[_0x8f7c('0x40')]({},_0x42798d,_0x522f3f['options']);return _0x36fbe5['getSounds'](_0x42798d);}})[_0x8f7c('0x24')](function(_0x3814b0){if(_0x3814b0){_0xb8b030=_0x3814b0['length'];if(!_0x522f3f[_0x8f7c('0x33')][_0x8f7c('0x3a')](_0x8f7c('0x3b'))){_0x42798d[_0x8f7c('0x1b')]=qs[_0x8f7c('0x1b')](_0x522f3f[_0x8f7c('0x33')][_0x8f7c('0x1b')]);_0x42798d[_0x8f7c('0x1a')]=qs[_0x8f7c('0x1a')](_0x522f3f['query']['offset']);}return _0x36fbe5[_0x8f7c('0x6d')](_0x42798d);}})[_0x8f7c('0x24')](function(_0x528dd5){if(_0x528dd5){return _0x528dd5?{'count':_0xb8b030,'rows':_0x528dd5}:null;}})[_0x8f7c('0x24')](respondWithResult(_0xa4cb34,null))[_0x8f7c('0x45')](handleError(_0xa4cb34,null));}; \ No newline at end of file +var _0xa2c7=['crypto','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','count','limit','apply','reject','save','then','destroy','get','MusicOnHolds','UserProfileResource','error','name','send','index','map','VoiceMusicOnHold','fieldName','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','include','rows','catch','show','keys','includeAll','find','update','body','params','create','transaction','files','join','mode','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','directory','readdirSync','forEach','rmdirSync','Sequelize','message','sequelize','addSound','Sound','findOne','save_name','converted_format','root','server/files/sounds/converted','format','%s.%s','basename','extname','server/files/moh','symlinkSync','ValidationError','removeSound','id2','unlinkSync','rawAttributes','getSounds','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x156705,_0x46616a){var _0x5a4bee=function(_0x3cd74b){while(--_0x3cd74b){_0x156705['push'](_0x156705['shift']());}};_0x5a4bee(++_0x46616a);}(_0xa2c7,0xd7));var _0x7a2c=function(_0x23884b,_0x50c307){_0x23884b=_0x23884b-0x0;var _0x28113b=_0xa2c7[_0x23884b];return _0x28113b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7a2c('0x0'));var zipdir=require(_0x7a2c('0x1'));var jsonpatch=require(_0x7a2c('0x2'));var rp=require('request-promise');var moment=require(_0x7a2c('0x3'));var BPromise=require(_0x7a2c('0x4'));var Mustache=require('mustache');var util=require(_0x7a2c('0x5'));var path=require(_0x7a2c('0x6'));var sox=require(_0x7a2c('0x7'));var csv=require(_0x7a2c('0x8'));var ejs=require(_0x7a2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7a2c('0xa'));var _=require(_0x7a2c('0xb'));var squel=require(_0x7a2c('0xc'));var crypto=require(_0x7a2c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7a2c('0xe'));var toCsv=require(_0x7a2c('0x8'));var querystring=require(_0x7a2c('0xf'));var Papa=require(_0x7a2c('0x10'));var Redis=require(_0x7a2c('0x11'));var authService=require(_0x7a2c('0x12'));var qs=require(_0x7a2c('0x13'));var as=require(_0x7a2c('0x14'));var hardwareService=require(_0x7a2c('0x15'));var logger=require(_0x7a2c('0x16'))('api');var utils=require(_0x7a2c('0x17'));var config=require(_0x7a2c('0x18'));var licenseUtil=require(_0x7a2c('0x19'));var db=require(_0x7a2c('0x1a'))['db'];function respondWithStatusCode(_0x10ff50,_0x2ab55e){_0x2ab55e=_0x2ab55e||0xcc;return function(_0x4e0f19){if(_0x4e0f19){return _0x10ff50[_0x7a2c('0x1b')](_0x2ab55e);}return _0x10ff50[_0x7a2c('0x1c')](_0x2ab55e)[_0x7a2c('0x1d')]();};}function respondWithResult(_0x1c94cb,_0x45047b){_0x45047b=_0x45047b||0xc8;return function(_0x1ded1e){if(_0x1ded1e){return _0x1c94cb[_0x7a2c('0x1c')](_0x45047b)[_0x7a2c('0x1e')](_0x1ded1e);}};}function respondWithFilteredResult(_0x307b05,_0x4ee682){return function(_0x59a9ba){if(_0x59a9ba){var _0x198727=typeof _0x4ee682[_0x7a2c('0x1f')]===_0x7a2c('0x20')&&typeof _0x4ee682['limit']===_0x7a2c('0x20');var _0x56daa0=_0x59a9ba[_0x7a2c('0x21')];var _0x388254=_0x198727?0x0:_0x4ee682[_0x7a2c('0x1f')];var _0x2fec4c=_0x198727?_0x59a9ba[_0x7a2c('0x21')]:_0x4ee682[_0x7a2c('0x1f')]+_0x4ee682[_0x7a2c('0x22')];var _0x2d0391;if(_0x2fec4c>=_0x56daa0){_0x2fec4c=_0x56daa0;_0x2d0391=0xc8;}else{_0x2d0391=0xce;}_0x307b05[_0x7a2c('0x1c')](_0x2d0391);return _0x307b05['set']('Content-Range',_0x388254+'-'+_0x2fec4c+'/'+_0x56daa0)['json'](_0x59a9ba);}return null;};}function patchUpdates(_0x26af2e){return function(_0x4027d2){try{jsonpatch[_0x7a2c('0x23')](_0x4027d2,_0x26af2e,!![]);}catch(_0x55c3cf){return BPromise[_0x7a2c('0x24')](_0x55c3cf);}return _0x4027d2[_0x7a2c('0x25')]();};}function saveUpdates(_0x3f57e7,_0x5eff7a){return function(_0xa44d02){if(_0xa44d02){return _0xa44d02['update'](_0x3f57e7)[_0x7a2c('0x26')](function(_0x50a8b9){return _0x50a8b9;});}return null;};}function removeEntity(_0x10777c,_0x56eeaa){return function(_0x3e1f8f){if(_0x3e1f8f){return _0x3e1f8f[_0x7a2c('0x27')]()[_0x7a2c('0x26')](function(){var _0x423bf5=_0x3e1f8f[_0x7a2c('0x28')]({'plain':!![]});var _0x3c5875=_0x7a2c('0x29');return db[_0x7a2c('0x2a')]['destroy']({'where':{'type':_0x3c5875,'resourceId':_0x423bf5['id']}})['then'](function(){return _0x3e1f8f;});})[_0x7a2c('0x26')](function(){_0x10777c[_0x7a2c('0x1c')](0xcc)[_0x7a2c('0x1d')]();});}};}function handleEntityNotFound(_0x13716a,_0x5bfa97){return function(_0x215022){if(!_0x215022){_0x13716a[_0x7a2c('0x1b')](0x194);}return _0x215022;};}function handleError(_0x2528f3,_0x3cbc76){_0x3cbc76=_0x3cbc76||0x1f4;return function(_0x94ddcf){logger[_0x7a2c('0x2b')](_0x94ddcf['stack']);if(_0x94ddcf[_0x7a2c('0x2c')]){delete _0x94ddcf[_0x7a2c('0x2c')];}_0x2528f3[_0x7a2c('0x1c')](_0x3cbc76)[_0x7a2c('0x2d')](_0x94ddcf);};}exports[_0x7a2c('0x2e')]=function(_0x43280f,_0x23eb55){var _0x36f92d={},_0x446daf={},_0x4ae42c={'count':0x0,'rows':[]};var _0x3b4e43=_[_0x7a2c('0x2f')](db[_0x7a2c('0x30')]['rawAttributes'],function(_0x2e2bf4){return{'name':_0x2e2bf4[_0x7a2c('0x31')],'type':_0x2e2bf4['type']['key']};});_0x446daf[_0x7a2c('0x32')]=_['map'](_0x3b4e43,_0x7a2c('0x2c'));_0x446daf[_0x7a2c('0x33')]=_['keys'](_0x43280f[_0x7a2c('0x33')]);_0x446daf[_0x7a2c('0x34')]=_[_0x7a2c('0x35')](_0x446daf[_0x7a2c('0x32')],_0x446daf[_0x7a2c('0x33')]);_0x36f92d[_0x7a2c('0x36')]=_[_0x7a2c('0x35')](_0x446daf['model'],qs[_0x7a2c('0x37')](_0x43280f['query'][_0x7a2c('0x37')]));_0x36f92d['attributes']=_0x36f92d[_0x7a2c('0x36')][_0x7a2c('0x38')]?_0x36f92d[_0x7a2c('0x36')]:_0x446daf['model'];if(!_0x43280f[_0x7a2c('0x33')][_0x7a2c('0x39')](_0x7a2c('0x3a'))){_0x36f92d[_0x7a2c('0x22')]=qs[_0x7a2c('0x22')](_0x43280f[_0x7a2c('0x33')][_0x7a2c('0x22')]);_0x36f92d[_0x7a2c('0x1f')]=qs[_0x7a2c('0x1f')](_0x43280f['query'][_0x7a2c('0x1f')]);}_0x36f92d[_0x7a2c('0x3b')]=qs[_0x7a2c('0x3c')](_0x43280f['query']['sort']);delete _0x43280f[_0x7a2c('0x33')][_0x7a2c('0x3c')];_0x36f92d[_0x7a2c('0x3d')]=qs[_0x7a2c('0x34')](_[_0x7a2c('0x3e')](_0x43280f[_0x7a2c('0x33')],_0x446daf['filters']),_0x3b4e43);if(_0x43280f[_0x7a2c('0x33')]['filter']){_0x36f92d[_0x7a2c('0x3d')]=_[_0x7a2c('0x3f')](_0x36f92d[_0x7a2c('0x3d')],{'$or':_[_0x7a2c('0x2f')](_0x3b4e43,function(_0x4297f1){if(_0x4297f1['type']!=='VIRTUAL'){var _0x152035={};_0x152035[_0x4297f1[_0x7a2c('0x2c')]]={'$like':'%'+_0x43280f['query'][_0x7a2c('0x40')]+'%'};return _0x152035;}})});}_0x36f92d=_[_0x7a2c('0x3f')]({},_0x36f92d,_0x43280f['options']);var _0x5b4b4f={'where':_0x36f92d[_0x7a2c('0x3d')]};return db[_0x7a2c('0x30')][_0x7a2c('0x21')](_0x5b4b4f)[_0x7a2c('0x26')](function(_0x212eb3){_0x4ae42c[_0x7a2c('0x21')]=_0x212eb3;if(_0x43280f[_0x7a2c('0x33')]['includeAll']){_0x36f92d[_0x7a2c('0x41')]=[{'all':!![]}];}return db[_0x7a2c('0x30')]['findAll'](_0x36f92d);})['then'](function(_0xf0432){_0x4ae42c[_0x7a2c('0x42')]=_0xf0432;return _0x4ae42c;})[_0x7a2c('0x26')](respondWithFilteredResult(_0x23eb55,_0x36f92d))[_0x7a2c('0x43')](handleError(_0x23eb55,null));};exports[_0x7a2c('0x44')]=function(_0x1bc7e0,_0x1a36e0){var _0x143349={'raw':![],'where':{'id':_0x1bc7e0['params']['id']}},_0x260707={};_0x260707[_0x7a2c('0x32')]=_[_0x7a2c('0x45')](db[_0x7a2c('0x30')]['rawAttributes']);_0x260707[_0x7a2c('0x33')]=_[_0x7a2c('0x45')](_0x1bc7e0[_0x7a2c('0x33')]);_0x260707[_0x7a2c('0x34')]=_[_0x7a2c('0x35')](_0x260707[_0x7a2c('0x32')],_0x260707[_0x7a2c('0x33')]);_0x143349['attributes']=_[_0x7a2c('0x35')](_0x260707[_0x7a2c('0x32')],qs[_0x7a2c('0x37')](_0x1bc7e0[_0x7a2c('0x33')][_0x7a2c('0x37')]));_0x143349[_0x7a2c('0x36')]=_0x143349['attributes']['length']?_0x143349['attributes']:_0x260707[_0x7a2c('0x32')];if(_0x1bc7e0['query'][_0x7a2c('0x46')]){_0x143349[_0x7a2c('0x41')]=[{'all':!![]}];}_0x143349=_[_0x7a2c('0x3f')]({},_0x143349,_0x1bc7e0['options']);return db[_0x7a2c('0x30')][_0x7a2c('0x47')](_0x143349)[_0x7a2c('0x26')](handleEntityNotFound(_0x1a36e0,null))['then'](respondWithResult(_0x1a36e0,null))['catch'](handleError(_0x1a36e0,null));};exports[_0x7a2c('0x48')]=function(_0x48fc73,_0x5124fe){if(_0x48fc73[_0x7a2c('0x49')]['id']){delete _0x48fc73['body']['id'];}return db[_0x7a2c('0x30')]['find']({'where':{'id':_0x48fc73[_0x7a2c('0x4a')]['id']}})[_0x7a2c('0x26')](handleEntityNotFound(_0x5124fe,null))[_0x7a2c('0x26')](saveUpdates(_0x48fc73['body'],null))[_0x7a2c('0x26')](respondWithResult(_0x5124fe,null))[_0x7a2c('0x43')](handleError(_0x5124fe,null));};exports[_0x7a2c('0x4b')]=function(_0x11e43c,_0x2bf1bf,_0x7454b6){return db['sequelize'][_0x7a2c('0x4c')](function(_0x1ca2fb){if(_0x11e43c[_0x7a2c('0x49')]['mode']===_0x7a2c('0x4d')){_0x11e43c[_0x7a2c('0x49')]['directory']=path[_0x7a2c('0x4e')](config['root'],'server/files/moh',_0x11e43c[_0x7a2c('0x49')]['name']);}return db[_0x7a2c('0x30')][_0x7a2c('0x4b')](_0x11e43c[_0x7a2c('0x49')],{'transaction':_0x1ca2fb})[_0x7a2c('0x26')](function(_0x24a86d){if(_0x11e43c[_0x7a2c('0x49')][_0x7a2c('0x4f')]==='files'){fs[_0x7a2c('0x50')](_0x24a86d['directory'],parseInt(_0x7a2c('0x51'),0x8));}var _0x420ba4=_0x11e43c[_0x7a2c('0x52')][_0x7a2c('0x28')]({'plain':!![]});if(!_0x420ba4)throw new Error(_0x7a2c('0x53'));if(_0x420ba4[_0x7a2c('0x54')]===_0x7a2c('0x52')){var _0x4e6dce=_0x24a86d[_0x7a2c('0x28')]({'plain':!![]});return db['UserProfileSection'][_0x7a2c('0x47')]({'where':{'name':_0x7a2c('0x29'),'userProfileId':_0x420ba4[_0x7a2c('0x55')]},'raw':!![]})['then'](function(_0x45908e){if(_0x45908e&&_0x45908e[_0x7a2c('0x56')]===0x0){return db[_0x7a2c('0x2a')][_0x7a2c('0x4b')]({'name':_0x4e6dce[_0x7a2c('0x2c')],'resourceId':_0x4e6dce['id'],'type':_0x45908e[_0x7a2c('0x2c')],'sectionId':_0x45908e['id']},{})[_0x7a2c('0x26')](function(){return _0x24a86d;});}else{return _0x24a86d;}})[_0x7a2c('0x43')](function(_0x5dcf81){logger[_0x7a2c('0x2b')](_0x7a2c('0x57'),_0x5dcf81);});}return _0x24a86d;});})[_0x7a2c('0x26')](respondWithResult(_0x2bf1bf,0xc9))[_0x7a2c('0x43')](handleError(_0x2bf1bf,null));};exports[_0x7a2c('0x27')]=function(_0x46c828,_0x47a24d,_0x19c500){var _0x296313;return db['VoiceMusicOnHold'][_0x7a2c('0x47')]({'where':{'id':_0x46c828[_0x7a2c('0x4a')]['id']}})[_0x7a2c('0x26')](function(_0x34133f){if(_0x34133f){return db['sequelize']['transaction'](function(_0x574478){return _0x34133f[_0x7a2c('0x27')]({'transaction':_0x574478,'raw':!![]})[_0x7a2c('0x26')](function(_0x27afc7){if(_0x27afc7[_0x7a2c('0x58')]){fs[_0x7a2c('0x59')](_0x27afc7[_0x7a2c('0x58')])[_0x7a2c('0x5a')](function(_0x2a94fb){fs['unlinkSync'](path['join'](_0x27afc7[_0x7a2c('0x58')],_0x2a94fb));});fs[_0x7a2c('0x5b')](_0x27afc7['directory']);}return _0x27afc7;});})[_0x7a2c('0x43')](function(_0x321e95){throw new db[(_0x7a2c('0x5c'))]['ValidationError'](_0x321e95[_0x7a2c('0x5d')]);});}})[_0x7a2c('0x26')](handleEntityNotFound(_0x47a24d,null))[_0x7a2c('0x26')](removeEntity(_0x47a24d,null))[_0x7a2c('0x43')](handleError(_0x47a24d,null));};exports['addSound']=function(_0x1da908,_0x2505cf,_0xb125d1){return db[_0x7a2c('0x5e')]['transaction'](function(_0x5a07c3){var _0x2ebab2;return db[_0x7a2c('0x30')][_0x7a2c('0x47')]({'where':{'id':_0x1da908['params']['id']}})[_0x7a2c('0x26')](function(_0x20a790){if(_0x20a790){_0x2ebab2=_0x20a790;return _0x20a790[_0x7a2c('0x5f')](_0x1da908[_0x7a2c('0x49')]['id'],{'transaction':_0x5a07c3});}})[_0x7a2c('0x26')](function(_0x4b9b2f){if(_0x4b9b2f){return db[_0x7a2c('0x60')][_0x7a2c('0x61')]({'where':{'id':_0x1da908[_0x7a2c('0x49')]['id']},'attributes':['id',_0x7a2c('0x2c'),_0x7a2c('0x62'),_0x7a2c('0x63'),'createdAt'],'raw':!![]});}})[_0x7a2c('0x26')](function(_0x315601){if(_0x315601){var _0x19c443=path[_0x7a2c('0x4e')](config[_0x7a2c('0x64')],_0x7a2c('0x65'),util[_0x7a2c('0x66')](_0x7a2c('0x67'),path[_0x7a2c('0x68')](_0x315601[_0x7a2c('0x62')],path[_0x7a2c('0x69')](_0x315601[_0x7a2c('0x62')])),_0x315601[_0x7a2c('0x63')]));var _0x30db7f=path['join'](config[_0x7a2c('0x64')],_0x7a2c('0x6a'),_0x2ebab2[_0x7a2c('0x2c')],util[_0x7a2c('0x66')](_0x7a2c('0x67'),_0x315601[_0x7a2c('0x2c')],_0x315601[_0x7a2c('0x63')]));fs[_0x7a2c('0x6b')](_0x19c443,_0x30db7f);return _0x315601;}})[_0x7a2c('0x43')](function(_0x376647){throw new db['Sequelize'][(_0x7a2c('0x6c'))](_0x376647[_0x7a2c('0x5d')]);});})[_0x7a2c('0x26')](handleEntityNotFound(_0x2505cf,null))['then'](respondWithResult(_0x2505cf,0xc9))[_0x7a2c('0x43')](handleError(_0x2505cf,null));};exports[_0x7a2c('0x6d')]=function(_0x220ab7,_0x5cb04a,_0x4cf609){return db[_0x7a2c('0x5e')]['transaction'](function(_0x9c5f6e){var _0x23ae3f;return db[_0x7a2c('0x30')][_0x7a2c('0x61')]({'where':{'id':_0x220ab7[_0x7a2c('0x4a')]['id']}})[_0x7a2c('0x26')](handleEntityNotFound(_0x5cb04a,null))['then'](function(_0x11bd4d){if(_0x11bd4d){_0x23ae3f=_0x11bd4d;return _0x11bd4d[_0x7a2c('0x6d')](_0x220ab7[_0x7a2c('0x4a')][_0x7a2c('0x6e')]);}})[_0x7a2c('0x26')](function(_0x144461){if(_0x144461){return db[_0x7a2c('0x60')][_0x7a2c('0x61')]({'where':{'id':_0x220ab7[_0x7a2c('0x4a')]['id2']},'attributes':['id',_0x7a2c('0x2c'),_0x7a2c('0x62'),_0x7a2c('0x63'),'createdAt'],'raw':!![]});}})[_0x7a2c('0x26')](function(_0x4bc488){if(_0x4bc488){fs[_0x7a2c('0x6f')](path[_0x7a2c('0x4e')](_0x23ae3f['directory'],util[_0x7a2c('0x66')](_0x7a2c('0x67'),_0x4bc488[_0x7a2c('0x2c')],_0x4bc488[_0x7a2c('0x63')])));return _0x4bc488;}})[_0x7a2c('0x43')](function(_0xc907f9){throw new db[(_0x7a2c('0x5c'))][(_0x7a2c('0x6c'))](_0xc907f9[_0x7a2c('0x5d')]);});})[_0x7a2c('0x26')](handleEntityNotFound(_0x5cb04a,null))[_0x7a2c('0x26')](respondWithStatusCode(_0x5cb04a,0xcc))[_0x7a2c('0x43')](handleError(_0x5cb04a,null));};exports['getSounds']=function(_0x3c4c31,_0xe0eb5b,_0x2c4549){var _0x3313d1={};var _0x3b1787={};var _0x248510;var _0x535c9b;return db[_0x7a2c('0x30')]['findOne']({'where':{'id':_0x3c4c31[_0x7a2c('0x4a')]['id']}})['then'](handleEntityNotFound(_0xe0eb5b,null))[_0x7a2c('0x26')](function(_0x201d81){if(_0x201d81){_0x248510=_0x201d81;_0x3b1787[_0x7a2c('0x32')]=_[_0x7a2c('0x45')](db[_0x7a2c('0x60')][_0x7a2c('0x70')]);_0x3b1787[_0x7a2c('0x33')]=_[_0x7a2c('0x45')](_0x3c4c31[_0x7a2c('0x33')]);_0x3b1787[_0x7a2c('0x34')]=_[_0x7a2c('0x35')](_0x3b1787[_0x7a2c('0x32')],_0x3b1787['query']);_0x3313d1[_0x7a2c('0x36')]=_['intersection'](_0x3b1787[_0x7a2c('0x32')],qs[_0x7a2c('0x37')](_0x3c4c31[_0x7a2c('0x33')][_0x7a2c('0x37')]));_0x3313d1[_0x7a2c('0x36')]=_0x3313d1['attributes']['length']?_0x3313d1[_0x7a2c('0x36')]:_0x3b1787[_0x7a2c('0x32')];_0x3313d1[_0x7a2c('0x3b')]=qs['sort'](_0x3c4c31[_0x7a2c('0x33')]['sort']);_0x3313d1[_0x7a2c('0x3d')]=qs[_0x7a2c('0x34')](_[_0x7a2c('0x3e')](_0x3c4c31[_0x7a2c('0x33')],_0x3b1787[_0x7a2c('0x34')]));if(_0x3c4c31[_0x7a2c('0x33')][_0x7a2c('0x40')]){_0x3313d1[_0x7a2c('0x3d')]=_[_0x7a2c('0x3f')](_0x3313d1[_0x7a2c('0x3d')],{'$or':_['map'](_0x3313d1[_0x7a2c('0x36')],function(_0x55ab6c){var _0x22eae1={};_0x22eae1[_0x55ab6c]={'$like':'%'+_0x3c4c31[_0x7a2c('0x33')]['filter']+'%'};return _0x22eae1;})});}_0x3313d1=_[_0x7a2c('0x3f')]({},_0x3313d1,_0x3c4c31['options']);return _0x248510[_0x7a2c('0x71')](_0x3313d1);}})[_0x7a2c('0x26')](function(_0x2beae3){if(_0x2beae3){_0x535c9b=_0x2beae3[_0x7a2c('0x38')];if(!_0x3c4c31[_0x7a2c('0x33')][_0x7a2c('0x39')](_0x7a2c('0x3a'))){_0x3313d1[_0x7a2c('0x22')]=qs[_0x7a2c('0x22')](_0x3c4c31[_0x7a2c('0x33')][_0x7a2c('0x22')]);_0x3313d1[_0x7a2c('0x1f')]=qs[_0x7a2c('0x1f')](_0x3c4c31[_0x7a2c('0x33')][_0x7a2c('0x1f')]);}return _0x248510['getSounds'](_0x3313d1);}})[_0x7a2c('0x26')](function(_0x59bd12){if(_0x59bd12){return _0x59bd12?{'count':_0x535c9b,'rows':_0x59bd12}:null;}})[_0x7a2c('0x26')](respondWithResult(_0xe0eb5b,null))[_0x7a2c('0x43')](handleError(_0xe0eb5b,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 49e45a7..1d80cf8 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 _0x6baa=['./voiceMusicOnHold.attributes','define','voice_musiconhold','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x373f3c,_0x44e12b){var _0x555326=function(_0x5dd8d9){while(--_0x5dd8d9){_0x373f3c['push'](_0x373f3c['shift']());}};_0x555326(++_0x44e12b);}(_0x6baa,0xe0));var _0xa6ba=function(_0x203a3e,_0x3295c4){_0x203a3e=_0x203a3e-0x0;var _0x1e555d=_0x6baa[_0x203a3e];return _0x1e555d;};'use strict';var _=require(_0xa6ba('0x0'));var util=require(_0xa6ba('0x1'));var logger=require(_0xa6ba('0x2'))(_0xa6ba('0x3'));var moment=require(_0xa6ba('0x4'));var BPromise=require(_0xa6ba('0x5'));var rp=require(_0xa6ba('0x6'));var fs=require('fs');var path=require(_0xa6ba('0x7'));var rimraf=require(_0xa6ba('0x8'));var config=require(_0xa6ba('0x9'));var attributes=require(_0xa6ba('0xa'));module['exports']=function(_0x56d418,_0x2ac56a){return _0x56d418[_0xa6ba('0xb')]('VoiceMusicOnHold',attributes,{'tableName':_0xa6ba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c03=['request-promise','path','../../config/environment','./voiceMusicOnHold.attributes','voice_musiconhold','util','../../config/logger','api','moment','bluebird'];(function(_0x687ddc,_0x2092fa){var _0x441991=function(_0x49c6a6){while(--_0x49c6a6){_0x687ddc['push'](_0x687ddc['shift']());}};_0x441991(++_0x2092fa);}(_0x1c03,0x1bd));var _0x31c0=function(_0x149319,_0x4182b5){_0x149319=_0x149319-0x0;var _0x4637c9=_0x1c03[_0x149319];return _0x4637c9;};'use strict';var _=require('lodash');var util=require(_0x31c0('0x0'));var logger=require(_0x31c0('0x1'))(_0x31c0('0x2'));var moment=require(_0x31c0('0x3'));var BPromise=require(_0x31c0('0x4'));var rp=require(_0x31c0('0x5'));var fs=require('fs');var path=require(_0x31c0('0x6'));var rimraf=require('rimraf');var config=require(_0x31c0('0x7'));var attributes=require(_0x31c0('0x8'));module['exports']=function(_0x15716a,_0x9200be){return _0x15716a['define']('VoiceMusicOnHold',attributes,{'tableName':_0x31c0('0x9'),'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 77a07f4..88d7640 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 _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\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(_0x48132e,_0x25eded){var _0x2547d7=function(_0x1644c8){while(--_0x1644c8){_0x48132e['push'](_0x48132e['shift']());}};_0x2547d7(++_0x25eded);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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 _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(_0x52e0db,_0x5c09fe){var _0x29b667=function(_0x2fd94f){while(--_0x2fd94f){_0x52e0db['push'](_0x52e0db['shift']());}};_0x29b667(++_0x5c09fe);}(_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 diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 4446ac1..0a0d709 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 _0x6c84=['/:id/teams','getTeams','post','create','addAgents','addTeams','put','/:id','update','delete','destroy','removeAgents','removeTeams','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/describe','describe'];(function(_0x57a1aa,_0x3b6df4){var _0x200e42=function(_0x521aba){while(--_0x521aba){_0x57a1aa['push'](_0x57a1aa['shift']());}};_0x200e42(++_0x3b6df4);}(_0x6c84,0x112));var _0x46c8=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x6c84[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x46c8('0x0'));var util=require(_0x46c8('0x1'));var path=require(_0x46c8('0x2'));var timeout=require(_0x46c8('0x3'));var express=require(_0x46c8('0x4'));var router=express['Router']();var fs_extra=require(_0x46c8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x46c8('0x6'));var config=require('../../config/environment');var controller=require('./voicePrefix.controller');router[_0x46c8('0x7')]('/',auth[_0x46c8('0x8')](),controller[_0x46c8('0x9')]);router[_0x46c8('0x7')](_0x46c8('0xa'),auth[_0x46c8('0x8')](),controller[_0x46c8('0xb')]);router[_0x46c8('0x7')]('/:id',auth[_0x46c8('0x8')](),controller['show']);router['get']('/:id/users',auth[_0x46c8('0x8')](),controller['getAgents']);router[_0x46c8('0x7')](_0x46c8('0xc'),auth[_0x46c8('0x8')](),controller[_0x46c8('0xd')]);router[_0x46c8('0xe')]('/',auth[_0x46c8('0x8')](),controller[_0x46c8('0xf')]);router['post']('/:id/users',auth['isAuthenticated'](),controller[_0x46c8('0x10')]);router['post'](_0x46c8('0xc'),auth[_0x46c8('0x8')](),controller[_0x46c8('0x11')]);router[_0x46c8('0x12')](_0x46c8('0x13'),auth['isAuthenticated'](),controller[_0x46c8('0x14')]);router[_0x46c8('0x15')]('/:id',auth[_0x46c8('0x8')](),controller[_0x46c8('0x16')]);router['delete']('/:id/users',auth[_0x46c8('0x8')](),controller[_0x46c8('0x17')]);router[_0x46c8('0x15')](_0x46c8('0xc'),auth[_0x46c8('0x8')](),controller[_0x46c8('0x18')]);module[_0x46c8('0x19')]=router; \ No newline at end of file +var _0x2a8d=['update','destroy','removeAgents','delete','removeTeams','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id/users','/:id/teams','getTeams','post','create','addAgents','addTeams','/:id'];(function(_0x5949c3,_0x177331){var _0x348e58=function(_0x1d87d4){while(--_0x1d87d4){_0x5949c3['push'](_0x5949c3['shift']());}};_0x348e58(++_0x177331);}(_0x2a8d,0x11e));var _0xd2a8=function(_0x31b57a,_0x3dddf3){_0x31b57a=_0x31b57a-0x0;var _0x2df3dd=_0x2a8d[_0x31b57a];return _0x2df3dd;};'use strict';var multer=require(_0xd2a8('0x0'));var util=require(_0xd2a8('0x1'));var path=require(_0xd2a8('0x2'));var timeout=require(_0xd2a8('0x3'));var express=require(_0xd2a8('0x4'));var router=express[_0xd2a8('0x5')]();var fs_extra=require(_0xd2a8('0x6'));var auth=require(_0xd2a8('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xd2a8('0x8'));router[_0xd2a8('0x9')]('/',auth[_0xd2a8('0xa')](),controller[_0xd2a8('0xb')]);router[_0xd2a8('0x9')](_0xd2a8('0xc'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xd2a8('0x9')](_0xd2a8('0xe'),auth['isAuthenticated'](),controller['getAgents']);router[_0xd2a8('0x9')](_0xd2a8('0xf'),auth['isAuthenticated'](),controller[_0xd2a8('0x10')]);router[_0xd2a8('0x11')]('/',auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x12')]);router[_0xd2a8('0x11')](_0xd2a8('0xe'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x13')]);router[_0xd2a8('0x11')]('/:id/teams',auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x14')]);router['put'](_0xd2a8('0x15'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x16')]);router['delete'](_0xd2a8('0x15'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x17')]);router['delete'](_0xd2a8('0xe'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x18')]);router[_0xd2a8('0x19')](_0xd2a8('0xf'),auth[_0xd2a8('0xa')](),controller[_0xd2a8('0x1a')]);module[_0xd2a8('0x1b')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 3caa61f..a9e0fa3 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 _0xc25b=['VIRTUAL','system-','getDataValue','sequelize','exports','STRING','name'];(function(_0x146cb2,_0x9db2e3){var _0x59aca6=function(_0x1f2127){while(--_0x1f2127){_0x146cb2['push'](_0x146cb2['shift']());}};_0x59aca6(++_0x9db2e3);}(_0xc25b,0x1a7));var _0xbc25=function(_0x3a2ab9,_0x7d8842){_0x3a2ab9=_0x3a2ab9-0x0;var _0x6bf614=_0xc25b[_0x3a2ab9];return _0x6bf614;};'use strict';var Sequelize=require(_0xbc25('0x0'));module[_0xbc25('0x1')]={'name':{'type':Sequelize[_0xbc25('0x2')],'allowNull':![],'unique':_0xbc25('0x3')},'prefix':{'type':Sequelize[_0xbc25('0x4')],'get':function(_0x5a9457){return _0xbc25('0x5')+this[_0xbc25('0x6')](_0xbc25('0x3'))+'-';}},'description':{'type':Sequelize[_0xbc25('0x2')]},'callerIdAll':{'type':Sequelize[_0xbc25('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6da2=['VIRTUAL','getDataValue','name','INTEGER','sequelize','exports','STRING'];(function(_0x43cdcc,_0x56c3cc){var _0x116fef=function(_0xb6f5c1){while(--_0xb6f5c1){_0x43cdcc['push'](_0x43cdcc['shift']());}};_0x116fef(++_0x56c3cc);}(_0x6da2,0xc8));var _0x26da=function(_0x5b6cf1,_0x32fdcd){_0x5b6cf1=_0x5b6cf1-0x0;var _0x46278c=_0x6da2[_0x5b6cf1];return _0x46278c;};'use strict';var Sequelize=require(_0x26da('0x0'));module[_0x26da('0x1')]={'name':{'type':Sequelize[_0x26da('0x2')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x26da('0x3')],'get':function(_0xc0ac01){return'system-'+this[_0x26da('0x4')](_0x26da('0x5'))+'-';}},'description':{'type':Sequelize[_0x26da('0x2')]},'callerIdAll':{'type':Sequelize[_0x26da('0x2')]},'VoiceExtensionId':{'type':Sequelize[_0x26da('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 4f6b2bd..30b08a7 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(_0x4e63f1,_0x34a2db){var _0xdbd910=function(_0x40261f){while(--_0x40261f){_0x4e63f1['push'](_0x4e63f1['shift']());}};_0xdbd910(++_0x34a2db);}(_0x4991,0xf7));var _0x1499=function(_0x1e364e,_0x293295){_0x1e364e=_0x1e364e-0x0;var _0x4cd19d=_0x4991[_0x1e364e];return _0x4cd19d;};'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 _0xa30a=['priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','Set','push','PREFIX-CALLERIDALL=','charAt','body','VoiceExtensionId','findById','addAgents','ids','omit','spread','emit','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','getTeams','Team','order','addTeams','Agents','online','voicePause','interface','flatMap','sequelize','TeamVoicePrefix','upsert','findOrCreate','userVoicePrefix:save','removeTeams','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','forEach','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','VoicePrefix','rawAttributes','fieldName','type','map','keys','filters','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','find','params','describe','create','transaction','VoiceExtension','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','exten','app','description','Voice\x20Prefix\x20Extension'];(function(_0x567317,_0x4163e5){var _0x3c9417=function(_0x997585){while(--_0x997585){_0x567317['push'](_0x567317['shift']());}};_0x3c9417(++_0x4163e5);}(_0xa30a,0xd7));var _0xaa30=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa30a[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xaa30('0x0'));var rimraf=require(_0xaa30('0x1'));var zipdir=require(_0xaa30('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaa30('0x3'));var moment=require(_0xaa30('0x4'));var BPromise=require(_0xaa30('0x5'));var Mustache=require(_0xaa30('0x6'));var util=require(_0xaa30('0x7'));var path=require(_0xaa30('0x8'));var sox=require(_0xaa30('0x9'));var csv=require('to-csv');var ejs=require(_0xaa30('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa30('0xb'));var squel=require(_0xaa30('0xc'));var crypto=require(_0xaa30('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xaa30('0xe'));var toCsv=require(_0xaa30('0xf'));var querystring=require(_0xaa30('0x10'));var Papa=require(_0xaa30('0x11'));var Redis=require(_0xaa30('0x12'));var authService=require(_0xaa30('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xaa30('0x14'));var logger=require('../../config/logger')(_0xaa30('0x15'));var utils=require(_0xaa30('0x16'));var config=require(_0xaa30('0x17'));var licenseUtil=require(_0xaa30('0x18'));var db=require('../../mysqldb')['db'];config[_0xaa30('0x19')]=_[_0xaa30('0x1a')](config[_0xaa30('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xaa30('0x1b'))(new Redis(config[_0xaa30('0x19')]));require(_0xaa30('0x1c'))[_0xaa30('0x1d')](socket);function respondWithStatusCode(_0x41f1d9,_0x31aa0b){_0x31aa0b=_0x31aa0b||0xcc;return function(_0x3240e9){if(_0x3240e9){return _0x41f1d9[_0xaa30('0x1e')](_0x31aa0b);}return _0x41f1d9[_0xaa30('0x1f')](_0x31aa0b)[_0xaa30('0x20')]();};}function respondWithResult(_0x519518,_0x91839d){_0x91839d=_0x91839d||0xc8;return function(_0x591478){if(_0x591478){return _0x519518['status'](_0x91839d)[_0xaa30('0x21')](_0x591478);}};}function respondWithFilteredResult(_0x153939,_0x130606){return function(_0x540e36){if(_0x540e36){var _0x54fa49=typeof _0x130606['offset']===_0xaa30('0x22')&&typeof _0x130606['limit']===_0xaa30('0x22');var _0x332a0a=_0x540e36['count'];var _0x4e29f9=_0x54fa49?0x0:_0x130606['offset'];var _0x3cbf92=_0x54fa49?_0x540e36[_0xaa30('0x23')]:_0x130606[_0xaa30('0x24')]+_0x130606[_0xaa30('0x25')];var _0x43a526;if(_0x3cbf92>=_0x332a0a){_0x3cbf92=_0x332a0a;_0x43a526=0xc8;}else{_0x43a526=0xce;}_0x153939['status'](_0x43a526);return _0x153939[_0xaa30('0x26')](_0xaa30('0x27'),_0x4e29f9+'-'+_0x3cbf92+'/'+_0x332a0a)[_0xaa30('0x21')](_0x540e36);}return null;};}function patchUpdates(_0x2d9e35){return function(_0x1ff442){try{jsonpatch['apply'](_0x1ff442,_0x2d9e35,!![]);}catch(_0x325b42){return BPromise[_0xaa30('0x28')](_0x325b42);}return _0x1ff442[_0xaa30('0x29')]();};}function saveUpdates(_0x326f84,_0x57d1ca){return function(_0x14d7fa){if(_0x14d7fa){return _0x14d7fa[_0xaa30('0x2a')](_0x326f84)[_0xaa30('0x2b')](function(_0x12da2f){return _0x12da2f;});}return null;};}function removeEntity(_0x97b038,_0x2a59ce){return function(_0x55cccb){if(_0x55cccb){return _0x55cccb[_0xaa30('0x2c')]()[_0xaa30('0x2b')](function(){var _0x5d4da8=_0x55cccb[_0xaa30('0x2d')]({'plain':!![]});var _0x5b3efb=_0xaa30('0x2e');return db[_0xaa30('0x2f')][_0xaa30('0x2c')]({'where':{'type':_0x5b3efb,'resourceId':_0x5d4da8['id']}})[_0xaa30('0x2b')](function(){return _0x55cccb;});})[_0xaa30('0x2b')](function(){_0x97b038[_0xaa30('0x1f')](0xcc)[_0xaa30('0x20')]();});}};}function handleEntityNotFound(_0x39f708,_0x1f288c){return function(_0x43fb30){if(!_0x43fb30){_0x39f708[_0xaa30('0x1e')](0x194);}return _0x43fb30;};}function handleError(_0x43003f,_0x2038a6){_0x2038a6=_0x2038a6||0x1f4;return function(_0x46abb9){logger[_0xaa30('0x30')](_0x46abb9[_0xaa30('0x31')]);if(_0x46abb9[_0xaa30('0x32')]){delete _0x46abb9[_0xaa30('0x32')];}_0x43003f['status'](_0x2038a6)[_0xaa30('0x33')](_0x46abb9);};}exports[_0xaa30('0x34')]=function(_0x3bc22f,_0x20916f){var _0x2276e0={},_0x1dce4a={},_0x4dae71={'count':0x0,'rows':[]};var _0x5addbf=_['map'](db[_0xaa30('0x35')][_0xaa30('0x36')],function(_0xb48ef3){return{'name':_0xb48ef3[_0xaa30('0x37')],'type':_0xb48ef3[_0xaa30('0x38')]['key']};});_0x1dce4a['model']=_[_0xaa30('0x39')](_0x5addbf,_0xaa30('0x32'));_0x1dce4a['query']=_[_0xaa30('0x3a')](_0x3bc22f['query']);_0x1dce4a[_0xaa30('0x3b')]=_['intersection'](_0x1dce4a[_0xaa30('0x3c')],_0x1dce4a[_0xaa30('0x3d')]);_0x2276e0['attributes']=_[_0xaa30('0x3e')](_0x1dce4a[_0xaa30('0x3c')],qs[_0xaa30('0x3f')](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x3f')]));_0x2276e0[_0xaa30('0x40')]=_0x2276e0['attributes'][_0xaa30('0x41')]?_0x2276e0[_0xaa30('0x40')]:_0x1dce4a['model'];if(!_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x42')](_0xaa30('0x43'))){_0x2276e0['limit']=qs['limit'](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x25')]);_0x2276e0[_0xaa30('0x24')]=qs[_0xaa30('0x24')](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x24')]);}_0x2276e0['order']=qs['sort'](_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x44')]);_0x2276e0[_0xaa30('0x45')]=qs['filters'](_[_0xaa30('0x46')](_0x3bc22f[_0xaa30('0x3d')],_0x1dce4a[_0xaa30('0x3b')]),_0x5addbf);if(_0x3bc22f[_0xaa30('0x3d')]['filter']){_0x2276e0[_0xaa30('0x45')]=_[_0xaa30('0x47')](_0x2276e0[_0xaa30('0x45')],{'$or':_[_0xaa30('0x39')](_0x5addbf,function(_0x1f6f53){if(_0x1f6f53['type']!==_0xaa30('0x48')){var _0x29cf85={};_0x29cf85[_0x1f6f53[_0xaa30('0x32')]]={'$like':'%'+_0x3bc22f[_0xaa30('0x3d')][_0xaa30('0x49')]+'%'};return _0x29cf85;}})});}_0x2276e0=_[_0xaa30('0x47')]({},_0x2276e0,_0x3bc22f[_0xaa30('0x4a')]);var _0x17510b={'where':_0x2276e0['where']};return db['VoicePrefix'][_0xaa30('0x23')](_0x17510b)['then'](function(_0x5208f8){_0x4dae71['count']=_0x5208f8;if(_0x3bc22f[_0xaa30('0x3d')]['includeAll']){_0x2276e0[_0xaa30('0x4b')]=[{'all':!![]}];}return db['VoicePrefix'][_0xaa30('0x4c')](_0x2276e0);})[_0xaa30('0x2b')](function(_0x3f530e){_0x4dae71[_0xaa30('0x4d')]=_0x3f530e;return _0x4dae71;})[_0xaa30('0x2b')](respondWithFilteredResult(_0x20916f,_0x2276e0))[_0xaa30('0x4e')](handleError(_0x20916f,null));};exports[_0xaa30('0x4f')]=function(_0xc1ae21,_0x3302ff){var _0x521462={'raw':![],'where':{'id':_0xc1ae21['params']['id']}},_0x334639={};_0x334639[_0xaa30('0x3c')]=_[_0xaa30('0x3a')](db[_0xaa30('0x35')][_0xaa30('0x36')]);_0x334639[_0xaa30('0x3d')]=_['keys'](_0xc1ae21['query']);_0x334639[_0xaa30('0x3b')]=_['intersection'](_0x334639[_0xaa30('0x3c')],_0x334639[_0xaa30('0x3d')]);_0x521462[_0xaa30('0x40')]=_[_0xaa30('0x3e')](_0x334639[_0xaa30('0x3c')],qs[_0xaa30('0x3f')](_0xc1ae21[_0xaa30('0x3d')]['fields']));_0x521462[_0xaa30('0x40')]=_0x521462[_0xaa30('0x40')][_0xaa30('0x41')]?_0x521462['attributes']:_0x334639[_0xaa30('0x3c')];if(_0xc1ae21[_0xaa30('0x3d')]['includeAll']){_0x521462[_0xaa30('0x4b')]=[{'all':!![]}];}_0x521462=_['merge']({},_0x521462,_0xc1ae21[_0xaa30('0x4a')]);return db['VoicePrefix']['find'](_0x521462)[_0xaa30('0x2b')](handleEntityNotFound(_0x3302ff,null))['then'](respondWithResult(_0x3302ff,null))['catch'](handleError(_0x3302ff,null));};exports[_0xaa30('0x2c')]=function(_0x1083e2,_0x2574f5){return db[_0xaa30('0x35')][_0xaa30('0x50')]({'where':{'id':_0x1083e2[_0xaa30('0x51')]['id']}})['then'](handleEntityNotFound(_0x2574f5,null))[_0xaa30('0x2b')](removeEntity(_0x2574f5,null))[_0xaa30('0x4e')](handleError(_0x2574f5,null));};exports[_0xaa30('0x52')]=function(_0x57a5fa,_0x53bcaa){return db['VoicePrefix']['describe']()[_0xaa30('0x2b')](respondWithResult(_0x53bcaa,null))[_0xaa30('0x4e')](handleError(_0x53bcaa,null));};exports[_0xaa30('0x53')]=function(_0x1d5c15,_0x1cb3f9){var _0x1ed257;return db['sequelize'][_0xaa30('0x54')](function(_0x2db9d5){return db[_0xaa30('0x35')][_0xaa30('0x53')](_0x1d5c15['body'],{'transaction':_0x2db9d5})[_0xaa30('0x2b')](function(_0x2d23f8){_0x1ed257=_0x2d23f8[_0xaa30('0x2d')]({'plain':!![]});return db[_0xaa30('0x55')][_0xaa30('0x50')]({'where':{'id':_0x1ed257['VoiceExtensionId']},'raw':!![]})['then'](function(_0x34ca1c){return createVoicePrefixExtensions(_0x1ed257,_0x34ca1c,_0x2db9d5);});});})[_0xaa30('0x2b')](function(){var _0x3c4f07=_0x1d5c15['user'][_0xaa30('0x2d')]({'plain':!![]});if(!_0x3c4f07)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3c4f07[_0xaa30('0x56')]===_0xaa30('0x57')){var _0x483a01=_0x1ed257;return db[_0xaa30('0x58')][_0xaa30('0x50')]({'where':{'name':'VoicePrefixes','userProfileId':_0x3c4f07[_0xaa30('0x59')]},'raw':!![]})['then'](function(_0x5b227d){if(_0x5b227d&&_0x5b227d[_0xaa30('0x5a')]===0x0){return db[_0xaa30('0x2f')][_0xaa30('0x53')]({'name':_0x483a01['name'],'resourceId':_0x483a01['id'],'type':_0x5b227d[_0xaa30('0x32')],'sectionId':_0x5b227d['id']},{})[_0xaa30('0x2b')](function(){return _0x1ed257;});}else{return _0x1ed257;}})[_0xaa30('0x4e')](function(_0x949d84){logger[_0xaa30('0x30')](_0xaa30('0x5b'),_0x949d84);throw _0x949d84;});}return _0x1ed257;})[_0xaa30('0x2b')](respondWithResult(_0x1cb3f9,null))[_0xaa30('0x4e')](handleError(_0x1cb3f9,null));};function Extension(_0x242b5a,_0x426b90,_0xb1afa8,_0x2f84fa){this[_0xaa30('0x5c')]='from-sip';this[_0xaa30('0x5d')]=_0x242b5a;this[_0xaa30('0x5e')]=_0xb1afa8;this[_0xaa30('0x38')]='system';this[_0xaa30('0x5f')]=_0xaa30('0x60');this[_0xaa30('0x61')]=_0x426b90;this[_0xaa30('0x62')]=_0x2f84fa;}function createVoicePrefixExtensions(_0x9ee658,_0x2c5959,_0x4f1d54){return new BPromise(function(_0x366205,_0x4f5222){var _0x36242e=new Extension(formatPrefixName(_0x9ee658[_0xaa30('0x63')]),0x1,_0xaa30('0x64'),_0xaa30('0x65'));_0x36242e['VoicePrefixId']=_0x9ee658['id'];return db[_0xaa30('0x55')][_0xaa30('0x53')](_0x36242e,{'transaction':_0x4f1d54})['then'](function(_0x26f6f9){var _0x62b307=_0x26f6f9[_0xaa30('0x2d')]({'plain':!![]});var _0x16097e=_[_0xaa30('0x39')](addVoicePrefixExtensions(_0x9ee658,_0x2c5959),function(_0x13ee8f){_0x13ee8f['VoiceExtensionId']=_0x62b307['id'];_0x13ee8f[_0xaa30('0x66')]=_0x9ee658['id'];return _0x13ee8f;});return db[_0xaa30('0x55')][_0xaa30('0x67')](_0x16097e,{'transaction':_0x4f1d54})[_0xaa30('0x2b')](function(_0x334ef1){if(!_0x334ef1){return _0x4f5222(_0xaa30('0x68'));}else{return _0x366205(_0x334ef1);}})[_0xaa30('0x4e')](function(_0x42da00){return _0x4f5222(_0x42da00);});});;});};function addVoicePrefixExtensions(_0x4318a2,_0x6c968e){var _0x46bdc4=[];var _0x2f4d77=formatPrefixName(_0x4318a2[_0xaa30('0x63')]);_0x46bdc4['push'](new Extension(_0x2f4d77,0x2,_0xaa30('0x69'),'CDR(prefix)='+_0x4318a2[_0xaa30('0x32')]));if(_0x4318a2['callerIdAll']){_0x46bdc4[_0xaa30('0x6a')](new Extension(_0x2f4d77,0x3,_0xaa30('0x69'),_0xaa30('0x6b')+_0x4318a2['callerIdAll']));}else{_0x46bdc4[_0xaa30('0x6a')](new Extension(_0x2f4d77,0x3,_0xaa30('0x64'),'No\x20callerid\x20available'));}_0x46bdc4[_0xaa30('0x6a')](new Extension(_0x2f4d77,0x4,'goto',_0x6c968e[_0xaa30('0x5c')]+','+'${EXTEN:'+(0x8+_0x4318a2['name'][_0xaa30('0x41')])+'}'+','+0x1));return _0x46bdc4;}function formatPrefixName(_0x99d382){var _0xd3e52e='_';for(var _0x313bfa=0x0;_0x313bfa<_0x99d382[_0xaa30('0x41')];_0x313bfa++){if(_0x99d382[_0xaa30('0x6c')](_0x313bfa)=='-'){_0xd3e52e+=_0x99d382[_0xaa30('0x6c')](_0x313bfa);}else{_0xd3e52e+='['+_0x99d382['charAt'](_0x313bfa)+']';}}_0xd3e52e+='.';return _0xd3e52e;}exports[_0xaa30('0x2a')]=function(_0x3f2683,_0x1386a9,_0x4aeb5d){var _0x1f8a61=_0x3f2683[_0xaa30('0x6d')];_0x1f8a61[_0xaa30('0x63')]='system-'+_0x1f8a61[_0xaa30('0x32')]+'-';return db['sequelize'][_0xaa30('0x54')](function(_0x4d2787){return db['VoicePrefix'][_0xaa30('0x2a')](_0x1f8a61,{'where':{'id':_0x1f8a61['id']},'transaction':_0x4d2787})[_0xaa30('0x2b')](function(){return db['VoiceExtension'][_0xaa30('0x2c')]({'where':{'VoicePrefixId':_0x1f8a61['id']},'transaction':_0x4d2787})[_0xaa30('0x2b')](function(){return db[_0xaa30('0x55')]['find']({'where':{'id':_0x1f8a61[_0xaa30('0x6e')]},'raw':!![]})[_0xaa30('0x2b')](function(_0x23daeb){return createVoicePrefixExtensions(_0x1f8a61,_0x23daeb,_0x4d2787);});});});})[_0xaa30('0x2b')](function(){return db[_0xaa30('0x35')][_0xaa30('0x6f')](_0x1f8a61['id']);})[_0xaa30('0x2b')](respondWithResult(_0x1386a9,null))['catch'](handleError(_0x1386a9,null));};exports[_0xaa30('0x70')]=function(_0x37c3ee,_0x112dc3,_0x25977d){return db['VoicePrefix'][_0xaa30('0x50')]({'where':{'id':_0x37c3ee[_0xaa30('0x51')]['id']}})['then'](handleEntityNotFound(_0x112dc3,null))[_0xaa30('0x2b')](function(_0x2d9dd8){if(_0x2d9dd8){return _0x2d9dd8[_0xaa30('0x70')](_0x37c3ee[_0xaa30('0x6d')][_0xaa30('0x71')],_[_0xaa30('0x72')](_0x37c3ee['body'],[_0xaa30('0x71'),'id'])||{})[_0xaa30('0x73')](function(_0x5948b4){for(var _0x2aa0ce=0x0;_0x2aa0ce<_0x37c3ee[_0xaa30('0x6d')][_0xaa30('0x71')][_0xaa30('0x41')];_0x2aa0ce+=0x1){socket[_0xaa30('0x74')]('userVoicePrefix:save',{'UserId':Number(_0x37c3ee[_0xaa30('0x6d')][_0xaa30('0x71')][_0x2aa0ce]),'VoicePrefixId':Number(_0x37c3ee[_0xaa30('0x51')]['id'])});}return _0x5948b4;});}})[_0xaa30('0x2b')](respondWithResult(_0x112dc3,null))[_0xaa30('0x4e')](handleError(_0x112dc3,null));};exports[_0xaa30('0x75')]=function(_0x5d3d83,_0x1e3a19,_0x467134){return db['VoicePrefix']['find']({'where':{'id':_0x5d3d83[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](handleEntityNotFound(_0x1e3a19,null))[_0xaa30('0x2b')](function(_0x100f18){if(_0x100f18){return _0x100f18[_0xaa30('0x75')](_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')])['then'](function(){if(_['isArray'](_0x5d3d83['query'][_0xaa30('0x71')])){for(var _0x25ebba=0x0;_0x25ebba<_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')][_0xaa30('0x41')];_0x25ebba+=0x1){socket['emit'](_0xaa30('0x76'),{'UserId':Number(_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')][_0x25ebba]),'VoicePrefixId':Number(_0x5d3d83[_0xaa30('0x51')]['id'])});}}else{socket[_0xaa30('0x74')](_0xaa30('0x76'),{'UserId':Number(_0x5d3d83[_0xaa30('0x3d')][_0xaa30('0x71')]),'VoicePrefixId':Number(_0x5d3d83['params']['id'])});}});}})['then'](respondWithStatusCode(_0x1e3a19,null))['catch'](handleError(_0x1e3a19,null));};exports[_0xaa30('0x77')]=function(_0x408362,_0x541d3b,_0x775047){var _0xe9e4={};var _0x15e3ae={};var _0x33551c;var _0x404f82;return db['VoicePrefix'][_0xaa30('0x78')]({'where':{'id':_0x408362[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](handleEntityNotFound(_0x541d3b,null))['then'](function(_0x21b87b){if(_0x21b87b){_0x33551c=_0x21b87b;_0x15e3ae[_0xaa30('0x3c')]=_[_0xaa30('0x3a')](db[_0xaa30('0x79')][_0xaa30('0x36')]);_0x15e3ae[_0xaa30('0x3d')]=_[_0xaa30('0x3a')](_0x408362['query']);_0x15e3ae[_0xaa30('0x3b')]=_[_0xaa30('0x3e')](_0x15e3ae[_0xaa30('0x3c')],_0x15e3ae[_0xaa30('0x3d')]);_0xe9e4[_0xaa30('0x40')]=_[_0xaa30('0x3e')](_0x15e3ae[_0xaa30('0x3c')],qs[_0xaa30('0x3f')](_0x408362[_0xaa30('0x3d')][_0xaa30('0x3f')]));_0xe9e4[_0xaa30('0x40')]=_0xe9e4[_0xaa30('0x40')][_0xaa30('0x41')]?_0xe9e4['attributes']:_0x15e3ae[_0xaa30('0x3c')];_0xe9e4['order']=qs[_0xaa30('0x44')](_0x408362[_0xaa30('0x3d')][_0xaa30('0x44')]);_0xe9e4[_0xaa30('0x45')]=qs[_0xaa30('0x3b')](_[_0xaa30('0x46')](_0x408362[_0xaa30('0x3d')],_0x15e3ae[_0xaa30('0x3b')]));if(_0x408362[_0xaa30('0x3d')][_0xaa30('0x49')]){_0xe9e4[_0xaa30('0x45')]=_[_0xaa30('0x47')](_0xe9e4[_0xaa30('0x45')],{'$or':_[_0xaa30('0x39')](_0xe9e4[_0xaa30('0x40')],function(_0x3744b3){var _0x35a47f={};_0x35a47f[_0x3744b3]={'$like':'%'+_0x408362[_0xaa30('0x3d')][_0xaa30('0x49')]+'%'};return _0x35a47f;})});}_0xe9e4=_['merge']({},_0xe9e4,_0x408362[_0xaa30('0x4a')]);return _0x33551c[_0xaa30('0x77')](_0xe9e4);}})[_0xaa30('0x2b')](function(_0x3a67b3){if(_0x3a67b3){_0x404f82=_0x3a67b3[_0xaa30('0x41')];if(!_0x408362[_0xaa30('0x3d')][_0xaa30('0x42')]('nolimit')){_0xe9e4[_0xaa30('0x25')]=qs[_0xaa30('0x25')](_0x408362['query'][_0xaa30('0x25')]);_0xe9e4[_0xaa30('0x24')]=qs['offset'](_0x408362[_0xaa30('0x3d')][_0xaa30('0x24')]);}return _0x33551c[_0xaa30('0x77')](_0xe9e4);}})[_0xaa30('0x2b')](function(_0x5eb209){if(_0x5eb209){return _0x5eb209?{'count':_0x404f82,'rows':_0x5eb209}:null;}})[_0xaa30('0x2b')](respondWithResult(_0x541d3b,null))['catch'](handleError(_0x541d3b,null));};exports[_0xaa30('0x7a')]=function(_0x41480f,_0x24f60f,_0x3fb561){var _0x24a3af={};var _0x4412d4={};var _0x45ffba;var _0x2e73e1;return db[_0xaa30('0x35')]['findOne']({'where':{'id':_0x41480f[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](handleEntityNotFound(_0x24f60f,null))['then'](function(_0x1f48c1){if(_0x1f48c1){_0x45ffba=_0x1f48c1;_0x4412d4[_0xaa30('0x3c')]=_['keys'](db[_0xaa30('0x7b')][_0xaa30('0x36')]);_0x4412d4['query']=_[_0xaa30('0x3a')](_0x41480f['query']);_0x4412d4['filters']=_[_0xaa30('0x3e')](_0x4412d4[_0xaa30('0x3c')],_0x4412d4['query']);_0x24a3af['attributes']=_[_0xaa30('0x3e')](_0x4412d4[_0xaa30('0x3c')],qs['fields'](_0x41480f[_0xaa30('0x3d')]['fields']));_0x24a3af['attributes']=_0x24a3af[_0xaa30('0x40')]['length']?_0x24a3af[_0xaa30('0x40')]:_0x4412d4['model'];_0x24a3af[_0xaa30('0x7c')]=qs[_0xaa30('0x44')](_0x41480f[_0xaa30('0x3d')][_0xaa30('0x44')]);_0x24a3af[_0xaa30('0x45')]=qs[_0xaa30('0x3b')](_[_0xaa30('0x46')](_0x41480f[_0xaa30('0x3d')],_0x4412d4[_0xaa30('0x3b')]));if(_0x41480f['query']['filter']){_0x24a3af[_0xaa30('0x45')]=_[_0xaa30('0x47')](_0x24a3af[_0xaa30('0x45')],{'$or':_['map'](_0x24a3af['attributes'],function(_0x46df1d){var _0x554b6b={};_0x554b6b[_0x46df1d]={'$like':'%'+_0x41480f[_0xaa30('0x3d')][_0xaa30('0x49')]+'%'};return _0x554b6b;})});}_0x24a3af=_[_0xaa30('0x47')]({},_0x24a3af,_0x41480f[_0xaa30('0x4a')]);return _0x45ffba['getTeams'](_0x24a3af);}})[_0xaa30('0x2b')](function(_0x5d061b){if(_0x5d061b){_0x2e73e1=_0x5d061b[_0xaa30('0x41')];if(!_0x41480f[_0xaa30('0x3d')][_0xaa30('0x42')](_0xaa30('0x43'))){_0x24a3af['limit']=qs[_0xaa30('0x25')](_0x41480f[_0xaa30('0x3d')]['limit']);_0x24a3af[_0xaa30('0x24')]=qs['offset'](_0x41480f[_0xaa30('0x3d')]['offset']);}return _0x45ffba[_0xaa30('0x7a')](_0x24a3af);}})[_0xaa30('0x2b')](function(_0x11dd5e){if(_0x11dd5e){return _0x11dd5e?{'count':_0x2e73e1,'rows':_0x11dd5e}:null;}})[_0xaa30('0x2b')](respondWithResult(_0x24f60f,null))[_0xaa30('0x4e')](handleError(_0x24f60f,null));};exports[_0xaa30('0x7d')]=function(_0x2f90db,_0x3f382a,_0x36f739){var _0x5687ef=_0x2f90db[_0xaa30('0x6d')][_0xaa30('0x71')];var _0x21e8c7;return db['Team'][_0xaa30('0x4c')]({'where':{'id':_0x5687ef},'attributes':['id'],'include':[{'model':db[_0xaa30('0x79')],'as':_0xaa30('0x7e'),'attributes':['id',_0xaa30('0x32'),_0xaa30('0x7f'),_0xaa30('0x80'),_0xaa30('0x81')],'raw':!![]}]})[_0xaa30('0x2b')](function(_0x16e95c){if(_0x16e95c){_0x21e8c7=_0x16e95c;var _0x4dc93c=_[_0xaa30('0x82')](_0x16e95c,function(_0x25dca3){var _0x13521a=_0x25dca3['get']({'plain':!![]});return _0x13521a[_0xaa30('0x7e')];});return db[_0xaa30('0x35')]['find']({'where':{'id':_0x2f90db[_0xaa30('0x51')]['id']}})['then'](function(_0x51a37a){return db[_0xaa30('0x83')][_0xaa30('0x54')](function(_0xcf7c59){return _0x51a37a[_0xaa30('0x7d')](_0x5687ef,{'transaction':_0xcf7c59})['then'](function(){return BPromise['each'](_0x21e8c7,function(_0x4240d0){return db[_0xaa30('0x84')][_0xaa30('0x85')]({'TeamId':_0x4240d0['id'],'VoicePrefixId':_0x2f90db[_0xaa30('0x51')]['id']},{'transaction':_0xcf7c59});});})[_0xaa30('0x2b')](function(){return BPromise['each'](_0x4dc93c,function(_0x7db5d7){return db['UserVoicePrefix'][_0xaa30('0x86')]({'where':{'UserId':_0x7db5d7['id'],'VoicePrefixId':_0x2f90db[_0xaa30('0x51')]['id']},'transaction':_0xcf7c59});});})[_0xaa30('0x2b')](function(){_0x4dc93c['forEach'](function(_0x1c25b1){socket[_0xaa30('0x74')](_0xaa30('0x87'),{'UserId':_0x1c25b1['id'],'VoicePrefixId':_0x51a37a['id']});});});});});}})[_0xaa30('0x2b')](respondWithStatusCode(_0x3f382a,null))[_0xaa30('0x4e')](handleError(_0x3f382a,null));};exports[_0xaa30('0x88')]=function(_0x51fb85,_0x133a0f,_0x1bd3c2){return db['Team']['findAll']({'where':{'id':_0x51fb85[_0xaa30('0x3d')][_0xaa30('0x71')]},'attributes':['id'],'include':[{'model':db[_0xaa30('0x79')],'as':_0xaa30('0x7e'),'attributes':['id'],'raw':!![]}]})[_0xaa30('0x2b')](handleEntityNotFound(_0x133a0f,null))[_0xaa30('0x2b')](function(_0x3dd250){var _0x2ec205=_[_0xaa30('0x39')](_0x3dd250,'id');var _0x211916=[];var _0x4bba25=[];var _0x73c665=squel['select']();_0x73c665['field'](_0xaa30('0x89'))[_0xaa30('0x8a')](_0xaa30('0x8b'),'tq')['join'](_0xaa30('0x8c'),'ut',_0xaa30('0x8d'))['where'](_0xaa30('0x8e'),_0x51fb85[_0xaa30('0x51')]['id']);for(var _0x2ebaa0=0x0;_0x2ebaa0<_0x3dd250[_0xaa30('0x41')];_0x2ebaa0+=0x1){let _0x420276=_0x3dd250[_0x2ebaa0];for(var _0x2c48a2=0x0;_0x2c48a2<_0x420276['Agents'][_0xaa30('0x41')];_0x2c48a2+=0x1){let _0x206fc4=_0x420276[_0xaa30('0x7e')][_0x2c48a2];var _0x24fccc=_0x73c665[_0xaa30('0x8f')]();_0x24fccc[_0xaa30('0x45')](_0xaa30('0x90'),_0x206fc4['id']);_0x4bba25['push'](db['sequelize'][_0xaa30('0x3d')](_0x24fccc[_0xaa30('0x91')](),{'type':db[_0xaa30('0x83')][_0xaa30('0x92')][_0xaa30('0x93')]})[_0xaa30('0x2b')](function(_0x162810){if(_0x162810[_0xaa30('0x41')]===0x1){return _0x206fc4['id'];}else{var _0x2ed461=_[_0xaa30('0x94')](_[_0xaa30('0x39')](_0x162810,'TeamId'),function(_0x5c21e){return _[_0xaa30('0x95')](_0x2ec205,_0x5c21e);});if(_0x2ed461){return _0x206fc4['id'];}}}));}}return BPromise[_0xaa30('0x96')](_0x4bba25)[_0xaa30('0x2b')](function(_0x46c9a5){_0x211916=_(_0x211916)[_0xaa30('0x97')](_0x46c9a5)[_0xaa30('0x98')]()[_0xaa30('0x99')]();return db[_0xaa30('0x35')][_0xaa30('0x50')]({'where':{'id':_0x51fb85[_0xaa30('0x51')]['id']}})[_0xaa30('0x2b')](function(_0x4cc3f0){return db[_0xaa30('0x83')][_0xaa30('0x54')](function(_0x31bdf6){return _0x4cc3f0['removeTeams'](_0x51fb85['query'][_0xaa30('0x71')],{'transaction':_0x31bdf6})['then'](function(){if(!_[_0xaa30('0x9a')](_0x211916)){return _0x4cc3f0['removeAgents'](_0x211916,{'transaction':_0x31bdf6});}})[_0xaa30('0x2b')](function(){_0x211916[_0xaa30('0x9b')](function(_0xb148d9){socket[_0xaa30('0x74')]('userVoicePrefix:remove',{'UserId':_0xb148d9,'VoicePrefixId':_0x4cc3f0['id']});});});});});});})[_0xaa30('0x2b')](respondWithStatusCode(_0x133a0f,null))[_0xaa30('0x4e')](handleError(_0x133a0f,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index a24dd5d..3f8639c 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 _0x0335=['exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update','hasOwnProperty','hook'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x0335,0xd9));var _0x5033=function(_0x2dc069,_0x9fe901){_0x2dc069=_0x2dc069-0x0;var _0x24a59d=_0x0335[_0x2dc069];return _0x24a59d;};'use strict';var EventEmitter=require(_0x5033('0x0'));var VoicePrefix=require(_0x5033('0x1'))['db'][_0x5033('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x5033('0x3')](0x0);var events={'afterCreate':_0x5033('0x4'),'afterUpdate':_0x5033('0x5'),'afterDestroy':'remove'};function emitEvent(_0x69abb2){return function(_0x46db70,_0x4ccd59,_0x27276b){VoicePrefixEvents['emit'](_0x69abb2+':'+_0x46db70['id'],_0x46db70);VoicePrefixEvents['emit'](_0x69abb2,_0x46db70);_0x27276b(null);};}for(var e in events){if(events[_0x5033('0x6')](e)){var event=events[e];VoicePrefix[_0x5033('0x7')](e,emitEvent(event));}}module[_0x5033('0x8')]=VoicePrefixEvents; \ No newline at end of file +var _0x2479=['emit','events','../../mysqldb','VoicePrefix','setMaxListeners','save','update'];(function(_0x105e01,_0x199717){var _0x421f22=function(_0x5b1103){while(--_0x5b1103){_0x105e01['push'](_0x105e01['shift']());}};_0x421f22(++_0x199717);}(_0x2479,0xda));var _0x9247=function(_0x38f884,_0x2afd2c){_0x38f884=_0x38f884-0x0;var _0x38057f=_0x2479[_0x38f884];return _0x38057f;};'use strict';var EventEmitter=require(_0x9247('0x0'));var VoicePrefix=require(_0x9247('0x1'))['db'][_0x9247('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9247('0x3')](0x0);var events={'afterCreate':_0x9247('0x4'),'afterUpdate':_0x9247('0x5'),'afterDestroy':'remove'};function emitEvent(_0x321481){return function(_0x563148,_0x187608,_0xfa3251){VoicePrefixEvents[_0x9247('0x6')](_0x321481+':'+_0x563148['id'],_0x563148);VoicePrefixEvents['emit'](_0x321481,_0x563148);_0xfa3251(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoicePrefix['hook'](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 3d78f3c..dc40fa8 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 _0x4e9c=['request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','api','moment','bluebird'];(function(_0x55ac26,_0x3ce839){var _0x47adc1=function(_0x2f95de){while(--_0x2f95de){_0x55ac26['push'](_0x55ac26['shift']());}};_0x47adc1(++_0x3ce839);}(_0x4e9c,0x159));var _0xc4e9=function(_0x2a8879,_0x4afe54){_0x2a8879=_0x2a8879-0x0;var _0x30c04c=_0x4e9c[_0x2a8879];return _0x30c04c;};'use strict';var _=require(_0xc4e9('0x0'));var util=require('util');var logger=require(_0xc4e9('0x1'))(_0xc4e9('0x2'));var moment=require(_0xc4e9('0x3'));var BPromise=require(_0xc4e9('0x4'));var rp=require(_0xc4e9('0x5'));var fs=require('fs');var path=require(_0xc4e9('0x6'));var rimraf=require(_0xc4e9('0x7'));var config=require(_0xc4e9('0x8'));var attributes=require(_0xc4e9('0x9'));module[_0xc4e9('0xa')]=function(_0x14d79b,_0x472cae){return _0x14d79b[_0xc4e9('0xb')](_0xc4e9('0xc'),attributes,{'tableName':_0xc4e9('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f7f=['path','rimraf','../../config/environment','VoicePrefix','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x320b8e,_0x1da3fe){var _0x55a10a=function(_0x148a56){while(--_0x148a56){_0x320b8e['push'](_0x320b8e['shift']());}};_0x55a10a(++_0x1da3fe);}(_0x2f7f,0x1a6));var _0xf2f7=function(_0x35d3a8,_0x44406a){_0x35d3a8=_0x35d3a8-0x0;var _0x182378=_0x2f7f[_0x35d3a8];return _0x182378;};'use strict';var _=require(_0xf2f7('0x0'));var util=require(_0xf2f7('0x1'));var logger=require(_0xf2f7('0x2'))(_0xf2f7('0x3'));var moment=require(_0xf2f7('0x4'));var BPromise=require(_0xf2f7('0x5'));var rp=require(_0xf2f7('0x6'));var fs=require('fs');var path=require(_0xf2f7('0x7'));var rimraf=require(_0xf2f7('0x8'));var config=require(_0xf2f7('0x9'));var attributes=require('./voicePrefix.attributes');module['exports']=function(_0x3b69e6,_0x45fd21){return _0x3b69e6['define'](_0xf2f7('0xa'),attributes,{'tableName':'voice_prefixes','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 fc01ba7..bb3dc86 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 _0x6bab=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x457d42,_0x122187){var _0x51b2ab=function(_0x89a26b){while(--_0x89a26b){_0x457d42['push'](_0x457d42['shift']());}};_0x51b2ab(++_0x122187);}(_0x6bab,0x1c7));var _0xb6ba=function(_0x4f5108,_0x46a54b){_0x4f5108=_0x4f5108-0x0;var _0x2d56ca=_0x6bab[_0x4f5108];return _0x2d56ca;};'use strict';var _=require(_0xb6ba('0x0'));var util=require(_0xb6ba('0x1'));var moment=require(_0xb6ba('0x2'));var BPromise=require(_0xb6ba('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb6ba('0x4'));var db=require(_0xb6ba('0x5'))['db'];var utils=require(_0xb6ba('0x6'));var logger=require(_0xb6ba('0x7'))(_0xb6ba('0x8'));var config=require('../../config/environment');var jayson=require(_0xb6ba('0x9'));var client=jayson['client'][_0xb6ba('0xa')]({'port':0x232a});config[_0xb6ba('0xb')]=_[_0xb6ba('0xc')](config[_0xb6ba('0xb')],{'host':_0xb6ba('0xd'),'port':0x18eb});var socket=require(_0xb6ba('0xe'))(new Redis(config[_0xb6ba('0xb')]));require(_0xb6ba('0xf'))[_0xb6ba('0x10')](socket);function respondWithRpcPromise(_0x5ae28b,_0x16cb3a,_0x55a4b0){return new BPromise(function(_0x5c4eac,_0x5c556d){return client[_0xb6ba('0x11')](_0x5ae28b,_0x55a4b0)[_0xb6ba('0x12')](function(_0x1cb42c){logger['info'](_0xb6ba('0x13'),_0x16cb3a,_0xb6ba('0x14'));logger[_0xb6ba('0x15')](_0xb6ba('0x16'),_0x16cb3a,_0xb6ba('0x14'),JSON[_0xb6ba('0x17')](_0x1cb42c));if(_0x1cb42c[_0xb6ba('0x18')]){if(_0x1cb42c[_0xb6ba('0x18')][_0xb6ba('0x19')]===0x1f4){logger[_0xb6ba('0x18')](_0xb6ba('0x13'),_0x16cb3a,_0x1cb42c[_0xb6ba('0x18')][_0xb6ba('0x1a')]);return _0x5c556d(_0x1cb42c[_0xb6ba('0x18')][_0xb6ba('0x1a')]);}logger[_0xb6ba('0x18')](_0xb6ba('0x13'),_0x16cb3a,_0x1cb42c[_0xb6ba('0x18')][_0xb6ba('0x1a')]);return _0x5c4eac(_0x1cb42c['error'][_0xb6ba('0x1a')]);}else{logger['info']('VoicePrefix,\x20%s,\x20%s',_0x16cb3a,_0xb6ba('0x14'));_0x5c4eac(_0x1cb42c[_0xb6ba('0x1b')]['message']);}})[_0xb6ba('0x1c')](function(_0xf1e2f8){logger['error'](_0xb6ba('0x13'),_0x16cb3a,_0xf1e2f8);_0x5c556d(_0xf1e2f8);});});} \ No newline at end of file +var _0x565e=['randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','register','then','info','VoicePrefix,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','lodash','moment','bluebird'];(function(_0x10efc4,_0x51ffc9){var _0x10db7d=function(_0x2b1799){while(--_0x2b1799){_0x10efc4['push'](_0x10efc4['shift']());}};_0x10db7d(++_0x51ffc9);}(_0x565e,0x7f));var _0xe565=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x565e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe565('0x0'));var util=require('util');var moment=require(_0xe565('0x1'));var BPromise=require(_0xe565('0x2'));var rs=require(_0xe565('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe565('0x4'));var logger=require(_0xe565('0x5'))(_0xe565('0x6'));var config=require(_0xe565('0x7'));var jayson=require(_0xe565('0x8'));var client=jayson[_0xe565('0x9')][_0xe565('0xa')]({'port':0x232a});config[_0xe565('0xb')]=_[_0xe565('0xc')](config[_0xe565('0xb')],{'host':_0xe565('0xd'),'port':0x18eb});var socket=require(_0xe565('0xe'))(new Redis(config[_0xe565('0xb')]));require(_0xe565('0xf'))[_0xe565('0x10')](socket);function respondWithRpcPromise(_0x41640f,_0x5b82c1,_0x3dd4dc){return new BPromise(function(_0x36c827,_0x9fd021){return client['request'](_0x41640f,_0x3dd4dc)[_0xe565('0x11')](function(_0x9f674){logger[_0xe565('0x12')](_0xe565('0x13'),_0x5b82c1,'request\x20sent');logger[_0xe565('0x14')]('VoicePrefix,\x20%s,\x20%s,\x20%s',_0x5b82c1,_0xe565('0x15'),JSON['stringify'](_0x9f674));if(_0x9f674[_0xe565('0x16')]){if(_0x9f674[_0xe565('0x16')][_0xe565('0x17')]===0x1f4){logger['error'](_0xe565('0x13'),_0x5b82c1,_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);return _0x9fd021(_0x9f674[_0xe565('0x16')]['message']);}logger[_0xe565('0x16')](_0xe565('0x13'),_0x5b82c1,_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);return _0x36c827(_0x9f674[_0xe565('0x16')][_0xe565('0x18')]);}else{logger['info'](_0xe565('0x13'),_0x5b82c1,_0xe565('0x15'));_0x36c827(_0x9f674[_0xe565('0x19')][_0xe565('0x18')]);}})['catch'](function(_0x403f94){logger[_0xe565('0x16')]('VoicePrefix,\x20%s,\x20%s',_0x5b82c1,_0x403f94);_0x9fd021(_0x403f94);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 91ef560..d850bf8 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 _0xbb95=['voicePrefix:','./voicePrefix.events','save','emit','register','length'];(function(_0x3f164b,_0x530893){var _0x3f5c03=function(_0x1730dc){while(--_0x1730dc){_0x3f164b['push'](_0x3f164b['shift']());}};_0x3f5c03(++_0x530893);}(_0xbb95,0x7f));var _0x5bb9=function(_0x4ce237,_0x29373d){_0x4ce237=_0x4ce237-0x0;var _0x3ea6ca=_0xbb95[_0x4ce237];return _0x3ea6ca;};'use strict';var VoicePrefixEvents=require(_0x5bb9('0x0'));var events=[_0x5bb9('0x1'),'remove','update'];function createListener(_0x15492a,_0x2a9386){return function(_0x535716){_0x2a9386[_0x5bb9('0x2')](_0x15492a,_0x535716);};}function removeListener(_0x572ef3,_0x4ef42d){return function(){VoicePrefixEvents['removeListener'](_0x572ef3,_0x4ef42d);};}exports[_0x5bb9('0x3')]=function(_0x2b72aa){for(var _0x49b590=0x0,_0x180e69=events[_0x5bb9('0x4')];_0x49b590<_0x180e69;_0x49b590++){var _0x39f347=events[_0x49b590];var _0x5e8b1c=createListener(_0x5bb9('0x5')+_0x39f347,_0x2b72aa);VoicePrefixEvents['on'](_0x39f347,_0x5e8b1c);}}; \ No newline at end of file +var _0x6e77=['emit','voicePrefix:','save'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x6e77,0xef));var _0x76e7=function(_0x7671bc,_0x171145){_0x7671bc=_0x7671bc-0x0;var _0x55229f=_0x6e77[_0x7671bc];return _0x55229f;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0x76e7('0x0'),'remove','update'];function createListener(_0x389715,_0x2aea10){return function(_0x57a8b3){_0x2aea10[_0x76e7('0x1')](_0x389715,_0x57a8b3);};}function removeListener(_0x305900,_0xcc6627){return function(){VoicePrefixEvents['removeListener'](_0x305900,_0xcc6627);};}exports['register']=function(_0x423b7a){for(var _0xf4d008=0x0,_0xac49d0=events['length'];_0xf4d008<_0xac49d0;_0xf4d008++){var _0x433ae3=events[_0xf4d008];var _0x464a99=createListener(_0x76e7('0x2')+_0x433ae3,_0x423b7a);VoicePrefixEvents['on'](_0x433ae3,_0x464a99);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index b486707..3233a86 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 _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(_0x2fdaff,_0x27a994){var _0x3cf2e2=function(_0x2c514c){while(--_0x2c514c){_0x2fdaff['push'](_0x2fdaff['shift']());}};_0x3cf2e2(++_0x27a994);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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 +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(_0x20f764,_0x185982){var _0x52ab9d=function(_0x537856){while(--_0x537856){_0x20f764['push'](_0x20f764['shift']());}};_0x52ab9d(++_0x185982);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'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 fb1e76e..8ff525f 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 _0x86c9=['join','periodic_announce','split','joinempty','leavewhenempty','wrapuptime','BOOLEAN','Active/Disactive\x20Campaign','progressive','predictive','booked','Dial\x20Method.','Max\x209999\x20channels,\x200\x20means\x20unlimited.','FLOAT','UNSIGNED','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','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\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','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','ENUM','inbound','outbound','STRING','default','ringall','leastrecent','fewestcalls','random','rrmemory','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','preview','roundrobin','includes','INTEGER','yes','once','TEXT'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x86c9,0x178));var _0x986c=function(_0x316dd9,_0x3b9921){_0x316dd9=_0x316dd9-0x0;var _0x345c07=_0x86c9[_0x316dd9];return _0x345c07;};'use strict';var Sequelize=require(_0x986c('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x2'),_0x986c('0x3')),'allowNull':![],'defaultValue':_0x986c('0x2')},'musiconhold':{'type':Sequelize[_0x986c('0x4')],'defaultValue':_0x986c('0x5')},'announce':{'type':Sequelize[_0x986c('0x4')],'defaultValue':''},'strategy':{'type':Sequelize[_0x986c('0x1')]('rr',_0x986c('0x6'),_0x986c('0x7'),_0x986c('0x8'),_0x986c('0x9'),_0x986c('0xa'),'linear',_0x986c('0xb'),_0x986c('0xc')),'allowNull':![],'defaultValue':'ringall','set':function(_0x236fca){this[_0x986c('0xd')](_0x986c('0xe'),_0x236fca?_0x236fca:_0x986c('0xa'));},'get':function(){var _0x16c817=this[_0x986c('0xf')]('type');var _0x23abf4=this[_0x986c('0xf')](_0x986c('0x10'));var _0x125d16=this[_0x986c('0xf')](_0x986c('0xe'));if(_0x16c817===_0x986c('0x3')){if(_0x23abf4===_0x986c('0x11')){return null;}if(_0x23abf4==='booked'&&!['rrmemory',_0x986c('0x12')][_0x986c('0x13')](_0x125d16)){this[_0x986c('0xd')]('strategy','rrmemory');}}return _0x125d16;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x986c('0x14')](0xb)},'timeout':{'type':Sequelize[_0x986c('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x986c('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x986c('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x986c('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x986c('0x1')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x986c('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x986c('0x4')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x986c('0x4')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x986c('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x986c('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x986c('0x1')]('yes','no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0x986c('0x16')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x986c('0x4')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x986c('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x986c('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x986c('0x1')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x986c('0x4')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x986c('0x4')]},'queue_youarenext':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x986c('0x4')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize[_0x986c('0x4')]},'queue_quantity2':{'type':Sequelize['STRING']},'queue_periodic_announce':{'type':Sequelize[_0x986c('0x4')]},'queue_less_than':{'type':Sequelize[_0x986c('0x4')]},'periodic_announce':{'type':Sequelize[_0x986c('0x17')],'set':function(_0x319d1b){this[_0x986c('0xd')]('periodic_announce',_0x319d1b?_0x319d1b[_0x986c('0x18')](','):[]);},'get':function(){return this[_0x986c('0xf')](_0x986c('0x19'))?this[_0x986c('0xf')](_0x986c('0x19'))[_0x986c('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x986c('0x4')],'defaultValue':_0x986c('0x15'),'set':function(_0xa57a45){this['setDataValue'](_0x986c('0x1b'),_0xa57a45?_0xa57a45[_0x986c('0x18')](','):undefined);},'get':function(){return this[_0x986c('0xf')](_0x986c('0x1b'))?this[_0x986c('0xf')](_0x986c('0x1b'))[_0x986c('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x986c('0x4')],'defaultValue':'no','set':function(_0xbda38){this[_0x986c('0xd')](_0x986c('0x1c'),_0xbda38?_0xbda38['join'](','):undefined);},'get':function(){return this[_0x986c('0xf')](_0x986c('0x1c'))?this[_0x986c('0xf')](_0x986c('0x1c'))[_0x986c('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x986c('0x4')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x4c70dd){this[_0x986c('0xd')]('acw',_0x4c70dd);if(_0x4c70dd){if(this[_0x986c('0xf')]('wrapuptime')<0x2){this['setDataValue'](_0x986c('0x1d'),0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x986c('0x1e')],'defaultValue':0x0,'comment':_0x986c('0x1f')},'dialMethod':{'type':Sequelize['ENUM'](_0x986c('0x11'),_0x986c('0x20'),'power',_0x986c('0x21'),_0x986c('0x22')),'defaultValue':_0x986c('0x20'),'comment':_0x986c('0x23')},'dialLimitChannel':{'type':Sequelize[_0x986c('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x986c('0x24')},'dialLimitQueue':{'type':Sequelize[_0x986c('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x986c('0x25')](0x2)[_0x986c('0x26')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x986c('0x27')},'dialPredictiveOptimization':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x28'),_0x986c('0x29')),'defaultValue':_0x986c('0x29'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x986c('0x2a')},'dialPredictiveInterval':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x986c('0x2b')},'dialOriginateCallerIdName':{'type':Sequelize[_0x986c('0x4')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0x986c('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986c('0x2c')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0x986c('0x2d'),'comment':_0x986c('0x2e')},'dialQueueTimeout':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986c('0x2f')},'dialQueueProject':{'type':Sequelize['STRING'],'comment':_0x986c('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986c('0x31')},'dialBusyMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986c('0x32')},'dialBusyRetryFrequency':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'comment':_0x986c('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986c('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x986c('0x35')},'dialTimezone':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x986c('0x4')],'defaultValue':_0x986c('0x36')},'dialPrefix':{'type':Sequelize[_0x986c('0x4')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x986c('0x1')](_0x986c('0x37'),'never',_0x986c('0x38')),'defaultValue':_0x986c('0x37')},'dialAMDActive':{'type':Sequelize[_0x986c('0x1e')],'defaultValue':0x0,'comment':_0x986c('0x39')},'dialAMDInitialSilence':{'type':Sequelize[_0x986c('0x14')](0x9)[_0x986c('0x26')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x986c('0x3a')},'dialAMDGreeting':{'type':Sequelize[_0x986c('0x14')](0x9)[_0x986c('0x26')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x986c('0x3b')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x986c('0x14')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x986c('0x3c')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x986c('0x14')](0x9)[_0x986c('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0x986c('0x14')](0x9)[_0x986c('0x26')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x986c('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0x986c('0x26')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x986c('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x986c('0x14')](0x9)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x986c('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x986c('0x26')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x986c('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x986c('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x986c('0x1e')],'defaultValue':0x0,'comment':_0x986c('0x42')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0x986c('0x43'),_0x986c('0x44')),'defaultValue':_0x986c('0x43')},'dialQueueProject2':{'type':Sequelize[_0x986c('0x4')],'comment':_0x986c('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x986c('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x986c('0x45')},'dialCutDigit':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986c('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986c('0x47')},'dialDropMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986c('0x48')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986c('0x49')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x986c('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x986c('0x14')](0x5)[_0x986c('0x26')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x986c('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x986c('0x14')],'allowNull':!![],'comment':_0x986c('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0x986c('0x1e')],'defaultValue':![],'comment':_0x986c('0x4d'),'set':function(_0x4140b4){if(!_0x4140b4)this[_0x986c('0xd')](_0x986c('0x4e'),null);this[_0x986c('0xd')](_0x986c('0x4f'),_0x4140b4);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x986c('0x14')](0x3)[_0x986c('0x26')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x986c('0x1e')],'defaultValue':![]}}; \ No newline at end of file +var _0x422a=['mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','ringall','fewestcalls','random','linear','rrordered','setDataValue','strategy','rrmemory','type','dialMethod','getDataValue','preview','booked','roundrobin','INTEGER','yes','all','once','TEXT','periodic_announce','join','joinempty','split','leavewhenempty','wrapuptime','BOOLEAN','progressive','power','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)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\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','onlyIfOpen','#AMD\x20Initial\x20Silence','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','#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)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2f1541,_0x2e6160){var _0x28002a=function(_0x3faff2){while(--_0x3faff2){_0x2f1541['push'](_0x2f1541['shift']());}};_0x28002a(++_0x2e6160);}(_0x422a,0x1e2));var _0xa422=function(_0x3ccdf3,_0x1254a2){_0x3ccdf3=_0x3ccdf3-0x0;var _0x1fbb9a=_0x422a[_0x3ccdf3];return _0x1fbb9a;};'use strict';var Sequelize=require(_0xa422('0x0'));module[_0xa422('0x1')]={'name':{'type':Sequelize[_0xa422('0x2')],'allowNull':![],'unique':_0xa422('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x5'),_0xa422('0x6')),'allowNull':![],'defaultValue':_0xa422('0x5')},'musiconhold':{'type':Sequelize[_0xa422('0x2')],'defaultValue':_0xa422('0x7')},'announce':{'type':Sequelize[_0xa422('0x2')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0xa422('0x8'),'leastrecent',_0xa422('0x9'),_0xa422('0xa'),'rrmemory',_0xa422('0xb'),'wrandom',_0xa422('0xc')),'allowNull':![],'defaultValue':_0xa422('0x8'),'set':function(_0x23050b){this[_0xa422('0xd')](_0xa422('0xe'),_0x23050b?_0x23050b:_0xa422('0xf'));},'get':function(){var _0x2fbfb6=this['getDataValue'](_0xa422('0x10'));var _0x178d55=this['getDataValue'](_0xa422('0x11'));var _0x1cb43f=this[_0xa422('0x12')](_0xa422('0xe'));if(_0x2fbfb6===_0xa422('0x6')){if(_0x178d55===_0xa422('0x13')){return null;}if(_0x178d55===_0xa422('0x14')&&![_0xa422('0xf'),_0xa422('0x15')]['includes'](_0x1cb43f)){this[_0xa422('0xd')](_0xa422('0xe'),_0xa422('0xf'));}}return _0x1cb43f;}},'servicelevel':{'type':Sequelize[_0xa422('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xa422('0x16')](0xb)},'timeout':{'type':Sequelize[_0xa422('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xa422('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0xa422('0x2')]},'weight':{'type':Sequelize[_0xa422('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xa422('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no'),'defaultValue':_0xa422('0x17')},'autopause':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no',_0xa422('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize['INTEGER'](0xb)},'autopausebusy':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xa422('0x4')]('yes','no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xa422('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0xa422('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0xa422('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xa422('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0xa422('0x16')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xa422('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0xa422('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0xa422('0x4')]('yes','no'),'defaultValue':_0xa422('0x17')},'announce_holdtime':{'type':Sequelize['ENUM'](_0xa422('0x17'),'no',_0xa422('0x19')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xa422('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no')},'announce_position_limit':{'type':Sequelize[_0xa422('0x16')](0xb)},'announce_round_seconds':{'type':Sequelize['ENUM']('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xa422('0x2')]},'queue_youarenext':{'type':Sequelize[_0xa422('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0xa422('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xa422('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0xa422('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xa422('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xa422('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xa422('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xa422('0x2')]},'queue_quantity1':{'type':Sequelize[_0xa422('0x2')]},'queue_quantity2':{'type':Sequelize[_0xa422('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xa422('0x2')]},'queue_less_than':{'type':Sequelize[_0xa422('0x2')]},'periodic_announce':{'type':Sequelize[_0xa422('0x1a')],'set':function(_0x138ebe){this[_0xa422('0xd')](_0xa422('0x1b'),_0x138ebe?_0x138ebe['join'](','):[]);},'get':function(){return this[_0xa422('0x12')](_0xa422('0x1b'))?this[_0xa422('0x12')](_0xa422('0x1b'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':_0xa422('0x17'),'set':function(_0x241360){this[_0xa422('0xd')]('joinempty',_0x241360?_0x241360[_0xa422('0x1c')](','):undefined);},'get':function(){return this[_0xa422('0x12')](_0xa422('0x1d'))?this[_0xa422('0x12')](_0xa422('0x1d'))[_0xa422('0x1e')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xa422('0x2')],'defaultValue':'no','set':function(_0x27ebb1){this[_0xa422('0xd')](_0xa422('0x1f'),_0x27ebb1?_0x27ebb1[_0xa422('0x1c')](','):undefined);},'get':function(){return this['getDataValue'](_0xa422('0x1f'))?this[_0xa422('0x12')](_0xa422('0x1f'))['split'](','):undefined;}},'reportholdtime':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0xa422('0x4')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x17'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0xa422('0x2')]},'description':{'type':Sequelize[_0xa422('0x2')]},'acw':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'set':function(_0x21e16a){this['setDataValue']('acw',_0x21e16a);if(_0x21e16a){if(this[_0xa422('0x12')]('wrapuptime')<0x2){this[_0xa422('0xd')](_0xa422('0x20'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0xa422('0x16')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xa422('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize['ENUM']('preview',_0xa422('0x22'),_0xa422('0x23'),'predictive',_0xa422('0x14')),'defaultValue':_0xa422('0x22'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize['INTEGER'](0x4)[_0xa422('0x24')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa422('0x25')},'dialLimitQueue':{'type':Sequelize[_0xa422('0x16')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xa422('0x26')},'dialPowerLevel':{'type':Sequelize[_0xa422('0x27')](0x2)[_0xa422('0x24')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xa422('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x29'),_0xa422('0x2a')),'defaultValue':_0xa422('0x2a'),'comment':_0xa422('0x2b')},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0xa422('0x27')](0x2)[_0xa422('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xa422('0x2c')},'dialPredictiveInterval':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0xa422('0x2d')},'dialOriginateCallerIdName':{'type':Sequelize[_0xa422('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize['STRING']},'dialOriginateTimeout':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa422('0x2e')},'dialQueueOptions':{'type':Sequelize[_0xa422('0x2')],'defaultValue':_0xa422('0x2f'),'comment':_0xa422('0x30')},'dialQueueTimeout':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa422('0x31')},'dialQueueProject':{'type':Sequelize[_0xa422('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xa422('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa422('0x32')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xa422('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0x3,'comment':_0xa422('0x33')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xa422('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa422('0x34')},'dialGlobalMaxRetry':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xa422('0x35')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xa422('0x2')],'defaultValue':_0xa422('0x36')},'dialPrefix':{'type':Sequelize[_0xa422('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x37'),_0xa422('0x38'),_0xa422('0x39')),'defaultValue':_0xa422('0x37')},'dialAMDActive':{'type':Sequelize[_0xa422('0x21')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xa422('0x16')](0x9)[_0xa422('0x24')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xa422('0x3a')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0xa422('0x24')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':'#AMD\x20Greeting'},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xa422('0x16')](0x9)[_0xa422('0x24')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize['INTEGER'](0x9)[_0xa422('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Total\x20Analysis\x20Time'},'dialAMDMinWordLength':{'type':Sequelize[_0xa422('0x16')](0x9)[_0xa422('0x24')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xa422('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize['INTEGER'](0x9)[_0xa422('0x24')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xa422('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xa422('0x16')](0x9)[_0xa422('0x24')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xa422('0x16')](0x5)[_0xa422('0x24')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xa422('0x3d')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xa422('0x16')](0x9)[_0xa422('0x24')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xa422('0x3e')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xa422('0x3f')},'dialRecallInQueue':{'type':Sequelize[_0xa422('0x21')],'defaultValue':0x0,'comment':_0xa422('0x40')},'dialOrderByScheduledAt':{'type':Sequelize[_0xa422('0x4')](_0xa422('0x41'),_0xa422('0x42')),'defaultValue':_0xa422('0x41')},'dialQueueProject2':{'type':Sequelize[_0xa422('0x2')],'comment':_0xa422('0x43')},'dialAgiAfterHangupClient':{'type':Sequelize[_0xa422('0x21')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0xa422('0x21')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa422('0x44')},'dialCutDigit':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xa422('0x45')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa422('0x46')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xa422('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0xa422('0x16')](0x5)[_0xa422('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa422('0x47')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xa422('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa422('0x48')},'dialMachineMaxRetry':{'type':Sequelize[_0xa422('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa422('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0xa422('0x16')](0x5)[_0xa422('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xa422('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xa422('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xa422('0x16')](0x5)[_0xa422('0x24')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa422('0x16')],'allowNull':!![],'comment':_0xa422('0x4c')},'mandatoryDisposition':{'type':Sequelize[_0xa422('0x21')],'defaultValue':![],'comment':_0xa422('0x4d'),'set':function(_0x494098){if(!_0x494098)this[_0xa422('0xd')](_0xa422('0x4e'),null);this[_0xa422('0xd')](_0xa422('0x4f'),_0x494098);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xa422('0x24')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0xa422('0x21')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0xa422('0x16')](0x3)[_0xa422('0x24')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0xa422('0x21')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index c62105f..f7eb8c7 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 _0xe14b=['QueueCampaigns','outbound','filter','map','value','type','find','name','end','error','stack','index','VoiceQueue','rawAttributes','fieldName','key','getOptions','where','include','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','options','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','VoiceQueues','UserProfileSection','autoAssociation','UserProfileResource','clone','merge','omit','createdAt','updatedAt','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','CmHopper','filters','hasOwnProperty','nolimit','order','sort','pick','VoiceQueueId','findAll','rows','getHopperHistories','findOne','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','Agents','online','interface','flatMap','penalty','sequelize','UserVoiceQueue','UserVoiceQueueRt','upsert','isNil','format','voicePause','forEach','emit','userVoiceQueue:save','ids','User','select','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','all','compact','transaction','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','CmListId','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','cm_contacts','deletedAt\x20IS\x20NULL','cm_hopper_additional_phones','CmHopperId','OrderBy','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','cm_hopper_black','NOW()','removeBlackLists','moment','bluebird','squel','ioredis','../../config/logger','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','get','inbound'];(function(_0x9bfecb,_0x4b1b63){var _0x44beff=function(_0xe265fd){while(--_0xe265fd){_0x9bfecb['push'](_0x9bfecb['shift']());}};_0x44beff(++_0x4b1b63);}(_0xe14b,0x93));var _0xbe14=function(_0x5aef7d,_0x4b7468){_0x5aef7d=_0x5aef7d-0x0;var _0x320893=_0xe14b[_0x5aef7d];return _0x320893;};'use strict';var moment=require(_0xbe14('0x0'));var BPromise=require(_0xbe14('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0xbe14('0x2'));var Redis=require(_0xbe14('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0xbe14('0x4'))('api');var config=require('../../config/environment');var db=require(_0xbe14('0x5'))['db'];config[_0xbe14('0x6')]=_[_0xbe14('0x7')](config[_0xbe14('0x6')],{'host':_0xbe14('0x8'),'port':0x18eb});var socket=require(_0xbe14('0x9'))(new Redis(config[_0xbe14('0x6')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x496063,_0x30c355){_0x30c355=_0x30c355||0xcc;return function(_0x6fceff){if(_0x6fceff){return _0x496063[_0xbe14('0xa')](_0x30c355);}return _0x496063[_0xbe14('0xb')](_0x30c355)['end']();};}function respondWithResult(_0x5b9fc6,_0x113243){_0x113243=_0x113243||0xc8;return function(_0x3f70cb){if(_0x3f70cb){return _0x5b9fc6['status'](_0x113243)[_0xbe14('0xc')](_0x3f70cb);}};}function respondWithFilteredResult(_0x35aa19,_0x886a5e){return function(_0x3d38c2){if(_0x3d38c2){var _0x27792f=typeof _0x886a5e[_0xbe14('0xd')]===_0xbe14('0xe')&&typeof _0x886a5e[_0xbe14('0xf')]===_0xbe14('0xe');var _0xa2cf72=_0x3d38c2[_0xbe14('0x10')];var _0x33fd54=_0x27792f?0x0:_0x886a5e[_0xbe14('0xd')];var _0x530538=_0x27792f?_0x3d38c2['count']:_0x886a5e[_0xbe14('0xd')]+_0x886a5e[_0xbe14('0xf')];var _0xf4ac9;if(_0x530538>=_0xa2cf72){_0x530538=_0xa2cf72;_0xf4ac9=0xc8;}else{_0xf4ac9=0xce;}_0x35aa19[_0xbe14('0xb')](_0xf4ac9);return _0x35aa19['set'](_0xbe14('0x11'),_0x33fd54+'-'+_0x530538+'/'+_0xa2cf72)[_0xbe14('0xc')](_0x3d38c2);}return null;};}function saveUpdates(_0xfd7b8f){return function(_0x123ede){if(_0x123ede){return _0x123ede[_0xbe14('0x12')](_0xfd7b8f)[_0xbe14('0x13')](function(_0x17ae86){return _0x17ae86;});}return null;};}function removeEntity(_0x5ea1f8){return function(_0x137ee5){if(_0x137ee5){return _0x137ee5[_0xbe14('0x14')]()[_0xbe14('0x13')](function(){var _0x433459=_0x137ee5[_0xbe14('0x15')]({'plain':!![]});var _0x37e4c1=[{'name':'VoiceQueues','value':_0xbe14('0x16'),'ignore':![]},{'name':_0xbe14('0x17'),'value':_0xbe14('0x18'),'ignore':![]}];var _0xc12977=_(_0x37e4c1)[_0xbe14('0x19')]('ignore')[_0xbe14('0x1a')]('value')[_0xbe14('0x1b')]();if(_['includes'](_0xc12977,_0x433459[_0xbe14('0x1c')])){return;}var _0x4a25fa=_[_0xbe14('0x1d')](_0x37e4c1,[_0xbe14('0x1b'),_0x433459['type']])[_0xbe14('0x1e')];return db['UserProfileResource'][_0xbe14('0x14')]({'where':{'type':_0x4a25fa,'resourceId':_0x433459['id']}})['then'](function(){return _0x137ee5;});})[_0xbe14('0x13')](function(){_0x5ea1f8[_0xbe14('0xb')](0xcc)[_0xbe14('0x1f')]();});}};}function handleEntityNotFound(_0x39cc81){return function(_0x15ef02){if(!_0x15ef02){_0x39cc81[_0xbe14('0xa')](0x194);}return _0x15ef02;};}function handleError(_0x55d001,_0x1822e0){_0x1822e0=_0x1822e0||0x1f4;return function(_0x1ba46a){logger[_0xbe14('0x20')](_0x1ba46a[_0xbe14('0x21')]);if(_0x1ba46a['name']){delete _0x1ba46a[_0xbe14('0x1e')];}_0x55d001[_0xbe14('0xb')](_0x1822e0)['send'](_0x1ba46a);};}exports[_0xbe14('0x22')]=function(_0x3b3e84,_0x1c7cc7){var _0x19252f={};var _0x34d648={'count':0x0,'rows':[]};var _0x36d4b2=_[_0xbe14('0x1a')](db[_0xbe14('0x23')][_0xbe14('0x24')],function(_0x16a159){return{'name':_0x16a159[_0xbe14('0x25')],'type':_0x16a159[_0xbe14('0x1c')][_0xbe14('0x26')]};});_0x19252f=qs[_0xbe14('0x27')](_0x36d4b2,_0x3b3e84);var _0x223f7a={'where':_0x19252f[_0xbe14('0x28')]};return db[_0xbe14('0x23')][_0xbe14('0x10')](_0x223f7a)[_0xbe14('0x13')](function(_0x14e7c4){_0x34d648['count']=_0x14e7c4;_0x19252f[_0xbe14('0x29')]=qs['include'](_0x3b3e84['query']);return db[_0xbe14('0x23')]['findAll'](_0x19252f);})[_0xbe14('0x13')](function(_0x345b0){_0x34d648['rows']=_0x345b0;return _0x34d648;})['then'](respondWithFilteredResult(_0x1c7cc7,_0x19252f))['catch'](handleError(_0x1c7cc7,null));};exports[_0xbe14('0x2a')]=function(_0xa3d24,_0x5f27b6){var _0x46c570={'raw':![],'where':{'id':_0xa3d24[_0xbe14('0x2b')]['id']}},_0x1faf3e={};_0x1faf3e[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['VoiceQueue']['rawAttributes']);_0x1faf3e[_0xbe14('0x2e')]=_['keys'](_0xa3d24['query']);_0x1faf3e['filters']=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],_0x1faf3e[_0xbe14('0x2e')]);_0x46c570[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x1faf3e[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x46c570[_0xbe14('0x30')]=_0x46c570[_0xbe14('0x30')][_0xbe14('0x32')]?_0x46c570['attributes']:_0x1faf3e['model'];if(_0xa3d24[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x46c570[_0xbe14('0x29')]=[{'all':!![]}];}_0x46c570=_['merge']({},_0x46c570,_0xa3d24[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x46c570)[_0xbe14('0x13')](handleEntityNotFound(_0x5f27b6,null))[_0xbe14('0x13')](respondWithResult(_0x5f27b6,null))[_0xbe14('0x35')](handleError(_0x5f27b6,null));};exports[_0xbe14('0x36')]=function(_0x128843,_0x1b2608){return db['VoiceQueue'][_0xbe14('0x36')](_0x128843[_0xbe14('0x37')],{})[_0xbe14('0x13')](function(_0x1b3118){var _0x3287b9=_0x128843[_0xbe14('0x38')]['get']({'plain':!![]});if(!_0x3287b9)throw new Error(_0xbe14('0x39'));if(_0x3287b9[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x36263c=_0x1b3118['get']({'plain':!![]});var _0x4bfa96=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x5d5318=_[_0xbe14('0x1d')](_0x4bfa96,['value',_0x36263c['type']])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x5d5318,'userProfileId':_0x3287b9['userProfileId']},'raw':!![]})['then'](function(_0x5aaa4f){if(_0x5aaa4f&&_0x5aaa4f[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x36263c['name'],'resourceId':_0x36263c['id'],'type':_0x5aaa4f[_0xbe14('0x1e')],'sectionId':_0x5aaa4f['id']},{})[_0xbe14('0x13')](function(){return _0x1b3118;});}else{return _0x1b3118;}})[_0xbe14('0x35')](function(_0x3ab0f6){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3ab0f6);throw _0x3ab0f6;});}return _0x1b3118;})[_0xbe14('0x13')](respondWithResult(_0x1b2608,0xc9))[_0xbe14('0x35')](handleError(_0x1b2608,null));};exports[_0xbe14('0x3f')]=function(_0xb2b285,_0x2550dc){var _0x4f2d95={'where':{'id':_0xb2b285[_0xbe14('0x2b')]['id']}},_0x51023a={};_0x51023a[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x23')]['rawAttributes']);_0x4f2d95[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x51023a['model'],qs[_0xbe14('0x31')](_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x4f2d95[_0xbe14('0x30')]=_0x4f2d95['attributes']['length']?_0x4f2d95[_0xbe14('0x30')]:_0x51023a[_0xbe14('0x2c')];if(_0xb2b285['query']['includeAll']){_0x4f2d95[_0xbe14('0x29')]=[{'all':!![]}];}_0x4f2d95=_[_0xbe14('0x40')]({},_0x4f2d95,_0xb2b285[_0xbe14('0x34')]);return db[_0xbe14('0x23')][_0xbe14('0x1d')](_0x4f2d95)[_0xbe14('0x13')](handleEntityNotFound(_0x2550dc,null))[_0xbe14('0x13')](function(_0x5a4068){if(_0x5a4068){var _0xf32e93=_0x5a4068[_0xbe14('0x15')]({'plain':!![]});_0xf32e93=qs[_0xbe14('0x41')](_0xf32e93,['id',_0xbe14('0x42'),_0xbe14('0x43')]);_0xb2b285['body']=_[_0xbe14('0x41')](_0xb2b285[_0xbe14('0x37')],['id',_0xbe14('0x42'),_0xbe14('0x43')]);return db[_0xbe14('0x23')][_0xbe14('0x36')](_['merge'](_0xf32e93,_0xb2b285['body']),{'include':_0xb2b285[_0xbe14('0x2e')][_0xbe14('0x33')]?[{'all':!![]}]:undefined})[_0xbe14('0x13')](function(_0x48554a){var _0x497b00=_0xb2b285[_0xbe14('0x38')][_0xbe14('0x15')]({'plain':!![]});if(!_0x497b00)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x497b00[_0xbe14('0x3a')]===_0xbe14('0x38')){var _0x50c2a0=_0x48554a[_0xbe14('0x15')]({'plain':!![]});var _0x4a40d2=[{'name':_0xbe14('0x3b'),'value':_0xbe14('0x16')},{'name':_0xbe14('0x17'),'value':'outbound'}];var _0x435c8d=_[_0xbe14('0x1d')](_0x4a40d2,['value',_0x50c2a0[_0xbe14('0x1c')]])[_0xbe14('0x1e')];return db[_0xbe14('0x3c')][_0xbe14('0x1d')]({'where':{'name':_0x435c8d,'userProfileId':_0x497b00[_0xbe14('0x44')]},'raw':!![]})['then'](function(_0x42a346){if(_0x42a346&&_0x42a346[_0xbe14('0x3d')]===0x0){return db[_0xbe14('0x3e')][_0xbe14('0x36')]({'name':_0x50c2a0[_0xbe14('0x1e')],'resourceId':_0x50c2a0['id'],'type':_0x42a346[_0xbe14('0x1e')],'sectionId':_0x42a346['id']},{})[_0xbe14('0x13')](function(){return _0x48554a;});}else{return _0x48554a;}})['catch'](function(_0x72c875){logger[_0xbe14('0x20')](_0xbe14('0x45'),_0x72c875);throw _0x72c875;});}return _0x48554a;});}})[_0xbe14('0x13')](respondWithResult(_0x2550dc,0xc9))[_0xbe14('0x35')](handleError(_0x2550dc,null));};exports[_0xbe14('0x12')]=function(_0xd8f78f,_0x32df3c){if(_0xd8f78f[_0xbe14('0x37')]['id']){delete _0xd8f78f[_0xbe14('0x37')]['id'];}return db[_0xbe14('0x23')]['find']({'where':{'id':_0xd8f78f['params']['id']}})['then'](handleEntityNotFound(_0x32df3c,null))[_0xbe14('0x13')](saveUpdates(_0xd8f78f[_0xbe14('0x37')],null))[_0xbe14('0x13')](respondWithResult(_0x32df3c,null))[_0xbe14('0x35')](handleError(_0x32df3c,null));};exports[_0xbe14('0x14')]=function(_0x66ddf,_0x16ee48){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x66ddf[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x16ee48,null))[_0xbe14('0x13')](removeEntity(_0x16ee48,null))[_0xbe14('0x35')](handleError(_0x16ee48,null));};exports[_0xbe14('0x46')]=function(_0x1c831a,_0xcef8e3){var _0x179077={'raw':![],'where':{}};var _0x2225d9={};var _0x29761b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x1c831a[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xcef8e3,null))[_0xbe14('0x13')](function(_0x46b49c){if(_0x46b49c){_0x2225d9[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x47')][_0xbe14('0x24')]);_0x2225d9[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x1c831a['query']);_0x2225d9[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x2225d9[_0xbe14('0x2c')],_0x2225d9[_0xbe14('0x2e')]);_0x179077[_0xbe14('0x30')]=_['intersection'](_0x2225d9[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x179077[_0xbe14('0x30')]=_0x179077['attributes'][_0xbe14('0x32')]?_0x179077[_0xbe14('0x30')]:_0x2225d9[_0xbe14('0x2c')];if(!_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x179077[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x1c831a['query'][_0xbe14('0xf')]);_0x179077[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x1c831a[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x179077[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x1c831a['query']['sort']);_0x179077[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x1c831a[_0xbe14('0x2e')],_0x2225d9[_0xbe14('0x48')]));_0x179077[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x46b49c['id'];if(_0x1c831a[_0xbe14('0x2e')]['filter']){_0x179077['where']=_[_0xbe14('0x40')](_0x179077[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x179077['attributes'],function(_0x76e91e){var _0x16bca1={};_0x16bca1[_0x76e91e]={'$like':'%'+_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x16bca1;})});}_0x179077=_[_0xbe14('0x40')]({},_0x179077,_0x1c831a[_0xbe14('0x34')]);return db[_0xbe14('0x47')]['count']({'where':_0x179077[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x3baa26){_0x29761b[_0xbe14('0x10')]=_0x3baa26;if(_0x1c831a[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x179077[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopper'][_0xbe14('0x4f')](_0x179077);})[_0xbe14('0x13')](function(_0x3cd17e){_0x29761b[_0xbe14('0x50')]=_0x3cd17e;return _0x29761b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0xcef8e3,_0x179077))[_0xbe14('0x35')](handleError(_0xcef8e3,null));};exports[_0xbe14('0x51')]=function(_0xd756b2,_0x5d064e){var _0x1e5ce1={'raw':!![],'where':{}};var _0x401968={};var _0x362999={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0xd756b2[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5d064e,null))[_0xbe14('0x13')](function(_0x175213){if(_0x175213){_0x401968[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperHistory'][_0xbe14('0x24')]);_0x401968[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0xd756b2[_0xbe14('0x2e')]);_0x401968[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x401968[_0xbe14('0x2c')],_0x401968['query']);_0x1e5ce1[_0xbe14('0x30')]=_['intersection'](_0x401968[_0xbe14('0x2c')],qs['fields'](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e5ce1[_0xbe14('0x30')]=_0x1e5ce1['attributes'][_0xbe14('0x32')]?_0x1e5ce1[_0xbe14('0x30')]:_0x401968[_0xbe14('0x2c')];if(!_0xd756b2['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e5ce1[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0xd756b2['query'][_0xbe14('0xf')]);_0x1e5ce1[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0xd756b2[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x1e5ce1[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0xd756b2['query'][_0xbe14('0x4c')]);_0x1e5ce1[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0xd756b2[_0xbe14('0x2e')],_0x401968[_0xbe14('0x48')]));_0x1e5ce1[_0xbe14('0x28')]['VoiceQueueId']=_0x175213['id'];if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e5ce1['where']=_[_0xbe14('0x40')](_0x1e5ce1['where'],{'$or':_[_0xbe14('0x1a')](_0x1e5ce1[_0xbe14('0x30')],function(_0x4dfa19){var _0x55d729={};_0x55d729[_0x4dfa19]={'$like':'%'+_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x55d729;})});}_0x1e5ce1=_[_0xbe14('0x40')]({},_0x1e5ce1,_0xd756b2['options']);return db[_0xbe14('0x53')][_0xbe14('0x10')]({'where':_0x1e5ce1[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x5ee624){_0x362999['count']=_0x5ee624;if(_0xd756b2[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x1e5ce1[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x53')][_0xbe14('0x4f')](_0x1e5ce1);})[_0xbe14('0x13')](function(_0x139aab){_0x362999['rows']=_0x139aab;return _0x362999;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x5d064e,_0x1e5ce1))['catch'](handleError(_0x5d064e,null));};exports[_0xbe14('0x54')]=function(_0x3a01bb,_0x8d47f2){var _0x2382c4={'raw':!![],'where':{}};var _0x55a3ae={};var _0x1e160b={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3a01bb['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x8d47f2,null))[_0xbe14('0x13')](function(_0x4090bc){if(_0x4090bc){_0x55a3ae[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x55')][_0xbe14('0x24')]);_0x55a3ae[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x3a01bb[_0xbe14('0x2e')]);_0x55a3ae[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],_0x55a3ae[_0xbe14('0x2e')]);_0x2382c4[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x55a3ae[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x2382c4['attributes']=_0x2382c4[_0xbe14('0x30')]['length']?_0x2382c4[_0xbe14('0x30')]:_0x55a3ae[_0xbe14('0x2c')];if(!_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x2382c4['limit']=qs['limit'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x2382c4[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x3a01bb['query'][_0xbe14('0xd')]);}_0x2382c4[_0xbe14('0x4b')]=qs['sort'](_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x2382c4[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x3a01bb[_0xbe14('0x2e')],_0x55a3ae['filters']));_0x2382c4['where'][_0xbe14('0x4e')]=_0x4090bc['id'];if(_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x2382c4[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x2382c4['where'],{'$or':_[_0xbe14('0x1a')](_0x2382c4[_0xbe14('0x30')],function(_0x5dc793){var _0x4e35ed={};_0x4e35ed[_0x5dc793]={'$like':'%'+_0x3a01bb[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x4e35ed;})});}_0x2382c4=_['merge']({},_0x2382c4,_0x3a01bb[_0xbe14('0x34')]);return db['CmHopperFinal'][_0xbe14('0x10')]({'where':_0x2382c4['where']})[_0xbe14('0x13')](function(_0x5d4431){_0x1e160b[_0xbe14('0x10')]=_0x5d4431;if(_0x3a01bb['query'][_0xbe14('0x33')]){_0x2382c4[_0xbe14('0x29')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2382c4);})[_0xbe14('0x13')](function(_0x4db7e8){_0x1e160b['rows']=_0x4db7e8;return _0x1e160b;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x8d47f2,_0x2382c4))[_0xbe14('0x35')](handleError(_0x8d47f2,null));};exports[_0xbe14('0x56')]=function(_0x11c341,_0x1a780a){var _0x313a87={'raw':!![],'where':{}};var _0x30d2b0={};var _0x57ad22={'count':0x0,'rows':[]};return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x11c341[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1a780a,null))['then'](function(_0x26372a){if(_0x26372a){_0x30d2b0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db['CmHopperBlack'][_0xbe14('0x24')]);_0x30d2b0[_0xbe14('0x2e')]=_['keys'](_0x11c341[_0xbe14('0x2e')]);_0x30d2b0['filters']=_[_0xbe14('0x2f')](_0x30d2b0[_0xbe14('0x2c')],_0x30d2b0[_0xbe14('0x2e')]);_0x313a87['attributes']=_[_0xbe14('0x2f')](_0x30d2b0['model'],qs[_0xbe14('0x31')](_0x11c341['query']['fields']));_0x313a87[_0xbe14('0x30')]=_0x313a87['attributes'][_0xbe14('0x32')]?_0x313a87['attributes']:_0x30d2b0[_0xbe14('0x2c')];if(!_0x11c341[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x313a87[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x313a87[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x11c341[_0xbe14('0x2e')][_0xbe14('0xd')]);}_0x313a87[_0xbe14('0x4b')]=qs['sort'](_0x11c341[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x313a87[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x11c341['query'],_0x30d2b0['filters']));_0x313a87[_0xbe14('0x28')][_0xbe14('0x4e')]=_0x26372a['id'];if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x313a87[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x313a87[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x313a87[_0xbe14('0x30')],function(_0x26e7a7){var _0x761b3d={};_0x761b3d[_0x26e7a7]={'$like':'%'+_0x11c341[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x761b3d;})});}_0x313a87=_[_0xbe14('0x40')]({},_0x313a87,_0x11c341[_0xbe14('0x34')]);return db[_0xbe14('0x57')][_0xbe14('0x10')]({'where':_0x313a87[_0xbe14('0x28')]})[_0xbe14('0x13')](function(_0x28a1e9){_0x57ad22[_0xbe14('0x10')]=_0x28a1e9;if(_0x11c341[_0xbe14('0x2e')][_0xbe14('0x33')]){_0x313a87[_0xbe14('0x29')]=[{'all':!![]}];}return db[_0xbe14('0x57')]['findAll'](_0x313a87);})[_0xbe14('0x13')](function(_0x3303a4){_0x57ad22[_0xbe14('0x50')]=_0x3303a4;return _0x57ad22;});}})[_0xbe14('0x13')](respondWithFilteredResult(_0x1a780a,_0x313a87))[_0xbe14('0x35')](handleError(_0x1a780a,null));};exports[_0xbe14('0x58')]=function(_0x52b75d,_0x5b161c){var _0x165b7a={};var _0x4a44e0={};var _0x3730d1;var _0x4babba;return db[_0xbe14('0x23')]['findOne']({'where':{'id':_0x52b75d[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x5b161c,null))[_0xbe14('0x13')](function(_0x12498f){if(_0x12498f){_0x3730d1=_0x12498f;_0x4a44e0[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x59')][_0xbe14('0x24')]);_0x4a44e0[_0xbe14('0x2e')]=_['keys'](_0x52b75d[_0xbe14('0x2e')]);_0x4a44e0[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x4a44e0[_0xbe14('0x2c')],_0x4a44e0['query']);_0x165b7a[_0xbe14('0x30')]=_['intersection'](_0x4a44e0[_0xbe14('0x2c')],qs['fields'](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x165b7a[_0xbe14('0x30')]=_0x165b7a['attributes'][_0xbe14('0x32')]?_0x165b7a['attributes']:_0x4a44e0[_0xbe14('0x2c')];_0x165b7a[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x165b7a[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_[_0xbe14('0x4d')](_0x52b75d[_0xbe14('0x2e')],_0x4a44e0['filters']));if(_0x52b75d[_0xbe14('0x2e')]['filter']){_0x165b7a[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x165b7a[_0xbe14('0x28')],{'$or':_['map'](_0x165b7a[_0xbe14('0x30')],function(_0x1c5fbc){var _0x219403={};_0x219403[_0x1c5fbc]={'$like':'%'+_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x219403;})});}_0x165b7a=_['merge']({},_0x165b7a,_0x52b75d['options']);return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})['then'](function(_0x16b1c8){if(_0x16b1c8){_0x4babba=_0x16b1c8[_0xbe14('0x32')];if(!_0x52b75d[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x165b7a[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x52b75d['query'][_0xbe14('0xf')]);_0x165b7a[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x52b75d[_0xbe14('0x2e')]['offset']);}return _0x3730d1[_0xbe14('0x58')](_0x165b7a);}})[_0xbe14('0x13')](function(_0x37aff6){if(_0x37aff6){return _0x37aff6?{'count':_0x4babba,'rows':_0x37aff6}:null;}})[_0xbe14('0x13')](respondWithResult(_0x5b161c,null))[_0xbe14('0x35')](handleError(_0x5b161c,null));};exports[_0xbe14('0x5a')]=function(_0x208fae,_0x310d42){var _0x9c229f=_0x208fae[_0xbe14('0x37')]['teams'];var _0xdb5515=_[_0xbe14('0x1a')](_0x9c229f,'id');return db[_0xbe14('0x59')][_0xbe14('0x4f')]({'where':{'id':_0xdb5515},'attributes':['id'],'include':[{'model':db['User'],'as':_0xbe14('0x5b'),'attributes':['id',_0xbe14('0x1e'),_0xbe14('0x5c'),'voicePause',_0xbe14('0x5d')],'raw':!![]}]})[_0xbe14('0x13')](function(_0x1ec868){if(_0x1ec868){var _0x1a7321=_[_0xbe14('0x5e')](_0x1ec868,function(_0x2306f6){var _0x426189=_0x2306f6['get']({'plain':!![]});_0x426189[_0xbe14('0x5b')]['forEach'](function(_0x24d528){_0x24d528[_0xbe14('0x5f')]=_[_0xbe14('0x1d')](_0x9c229f,{'id':_0x426189['id']})[_0xbe14('0x5f')];});return _0x426189[_0xbe14('0x5b')];});return db['VoiceQueue']['find']({'where':{'id':_0x208fae[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(_0x29a892){return db[_0xbe14('0x60')]['transaction'](function(_0x46a251){return _0x29a892[_0xbe14('0x5a')](_0xdb5515,{'transaction':_0x46a251})[_0xbe14('0x13')](function(){return BPromise['each'](_0x9c229f,function(_0xe69b0e){return db['TeamVoiceQueue']['upsert']({'TeamId':_0xe69b0e['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id'],'penalty':_0xe69b0e[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_0x1a7321,function(_0x3ea9c2){return db[_0xbe14('0x61')]['findOrCreate']({'where':{'UserId':_0x3ea9c2['id'],'VoiceQueueId':_0x208fae[_0xbe14('0x2b')]['id']},'defaults':{'penalty':_0x3ea9c2[_0xbe14('0x5f')]},'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){return BPromise['each'](_[_0xbe14('0x19')](_0x1a7321,{'online':!![]}),function(_0x1e2559){return db[_0xbe14('0x62')][_0xbe14('0x63')]({'membername':_0x1e2559[_0xbe14('0x1e')],'UserId':_0x1e2559['id'],'queue_name':_0x29a892['name'],'VoiceQueueId':_0x29a892['id'],'interface':_[_0xbe14('0x64')](_0x1e2559[_0xbe14('0x5d')])?util[_0xbe14('0x65')]('SIP/%s',_0x1e2559[_0xbe14('0x1e')]):_0x1e2559[_0xbe14('0x5d')],'paused':_0x1e2559[_0xbe14('0x66')]||![],'penalty':_0x1e2559[_0xbe14('0x5f')]},{'transaction':_0x46a251});});})[_0xbe14('0x13')](function(){_0x1a7321[_0xbe14('0x67')](function(_0x1b22a0){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':_0x1b22a0['id'],'VoiceQueueId':_0x29a892['id']});});});});});}})[_0xbe14('0x13')](respondWithStatusCode(_0x310d42,null))[_0xbe14('0x35')](handleError(_0x310d42,null));};exports['removeTeams']=function(_0xf549ec,_0x2c3647){return db[_0xbe14('0x59')]['findAll']({'where':{'id':_0xf549ec[_0xbe14('0x2e')][_0xbe14('0x6a')]},'attributes':['id'],'include':[{'model':db[_0xbe14('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xbe14('0x13')](handleEntityNotFound(_0x2c3647,null))['then'](function(_0x2d4b18){var _0xcd8cf6=_['map'](_0x2d4b18,'id');var _0x269e5a=[];var _0x4c7e2b=[];var _0x587f58=squel[_0xbe14('0x6c')]();_0x587f58[_0xbe14('0x6d')](_0xbe14('0x6e'))[_0xbe14('0x6f')](_0xbe14('0x70'),'tq')[_0xbe14('0x71')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xbe14('0x28')](_0xbe14('0x72'),_0xf549ec[_0xbe14('0x2b')]['id']);for(var _0x3c23fc=0x0;_0x3c23fc<_0x2d4b18['length'];_0x3c23fc+=0x1){let _0x1d5333=_0x2d4b18[_0x3c23fc];for(var _0x4cb29c=0x0;_0x4cb29c<_0x1d5333[_0xbe14('0x5b')][_0xbe14('0x32')];_0x4cb29c+=0x1){let _0x5270b2=_0x1d5333[_0xbe14('0x5b')][_0x4cb29c];var _0x273df5=_0x587f58[_0xbe14('0x3f')]();_0x273df5[_0xbe14('0x28')](_0xbe14('0x73'),_0x5270b2['id']);_0x4c7e2b[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x273df5[_0xbe14('0x75')](),{'type':db[_0xbe14('0x60')][_0xbe14('0x76')][_0xbe14('0x77')]})['then'](function(_0x20f196){if(_0x20f196[_0xbe14('0x32')]===0x1){return _0x5270b2['id'];}else{var _0x1eb33b=_[_0xbe14('0x78')](_['map'](_0x20f196,_0xbe14('0x79')),function(_0xede1c1){return _['includes'](_0xcd8cf6,_0xede1c1);});if(_0x1eb33b){return _0x5270b2['id'];}}}));}}return BPromise[_0xbe14('0x7a')](_0x4c7e2b)[_0xbe14('0x13')](function(_0x11085c){_0x269e5a=_(_0x269e5a)['union'](_0x11085c)[_0xbe14('0x7b')]()[_0xbe14('0x1b')]();return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0xf549ec[_0xbe14('0x2b')]['id']}})['then'](function(_0x23208d){return db[_0xbe14('0x60')][_0xbe14('0x7c')](function(_0x3f7732){return _0x23208d[_0xbe14('0x7d')](_0xf549ec['query'][_0xbe14('0x6a')],{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){if(!_[_0xbe14('0x7e')](_0x269e5a)){return _0x23208d[_0xbe14('0x7f')](_0x269e5a,{'transaction':_0x3f7732})[_0xbe14('0x13')](function(){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0xf549ec[_0xbe14('0x2b')]['id'],'UserId':_0x269e5a},'transaction':_0x3f7732});});}})['then'](function(){_0x269e5a['forEach'](function(_0x129ef6){socket[_0xbe14('0x68')](_0xbe14('0x80'),{'UserId':_0x129ef6,'VoiceQueueId':_0x23208d['id']});});});});});});})[_0xbe14('0x13')](respondWithStatusCode(_0x2c3647,null))[_0xbe14('0x35')](handleError(_0x2c3647,null));};exports['addAgents']=function(_0x15c93c,_0xf6ff8){var _0x3eaabe,_0x1ea11a;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x15c93c[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0xf6ff8,null))['then'](function(_0xf6da38){if(_0xf6da38){_0x1ea11a=_0xf6da38;return _0xf6da38[_0xbe14('0x81')](_0x15c93c['body']['ids'],_[_0xbe14('0x41')](_0x15c93c['body'],[_0xbe14('0x6a'),'id'])||{})[_0xbe14('0x82')](function(_0x776e93){for(var _0x3f5ca3=0x0;_0x3f5ca3<_0x15c93c[_0xbe14('0x37')]['ids'][_0xbe14('0x32')];_0x3f5ca3+=0x1){socket[_0xbe14('0x68')](_0xbe14('0x69'),{'UserId':Number(_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')][_0x3f5ca3]),'VoiceQueueId':Number(_0x15c93c[_0xbe14('0x2b')]['id'])});}return _0x776e93;});}})['then'](function(_0x4eea48){_0x3eaabe=_0x4eea48||[];if(_0x1ea11a){return db[_0xbe14('0x6b')]['findAll']({'where':{'id':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x6a')]},'attributes':['id',_0xbe14('0x1e'),'online',_0xbe14('0x66'),_0xbe14('0x5d')],'raw':!![]});}})[_0xbe14('0x13')](function(_0x1ad15d){if(!_[_0xbe14('0x7e')](_0x1ad15d)){var _0x2e5106=[];for(var _0x156fb3=0x0;_0x156fb3<_0x1ad15d['length'];_0x156fb3++){if(_0x1ad15d[_0x156fb3][_0xbe14('0x5c')]){_0x2e5106['push'](db['UserVoiceQueueRt']['upsert']({'membername':_0x1ad15d[_0x156fb3]['name'],'UserId':_0x1ad15d[_0x156fb3]['id'],'queue_name':_0x1ea11a[_0xbe14('0x1e')],'VoiceQueueId':_0x1ea11a['id'],'interface':_[_0xbe14('0x64')](_0x1ad15d[_0x156fb3]['interface'])?util[_0xbe14('0x65')]('SIP/%s',_0x1ad15d[_0x156fb3][_0xbe14('0x1e')]):_0x1ad15d[_0x156fb3]['interface'],'paused':_0x1ad15d[_0x156fb3][_0xbe14('0x66')]||![],'penalty':_0x15c93c[_0xbe14('0x37')][_0xbe14('0x5f')]||0x0}));}}return BPromise[_0xbe14('0x7a')](_0x2e5106);}})[_0xbe14('0x13')](function(){return _0x3eaabe;})['then'](respondWithResult(_0xf6ff8,null))[_0xbe14('0x35')](handleError(_0xf6ff8,null));};exports[_0xbe14('0x7f')]=function(_0x3aaa54,_0x413893){return db['VoiceQueue']['find']({'where':{'id':_0x3aaa54['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x413893,null))[_0xbe14('0x13')](function(_0x3826cf){if(_0x3826cf){return _0x3826cf[_0xbe14('0x7f')](_0x3aaa54[_0xbe14('0x2e')]['ids'])['then'](function(){if(_[_0xbe14('0x83')](_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')])){for(var _0x26092b=0x0;_0x26092b<_0x3aaa54[_0xbe14('0x2e')]['ids'][_0xbe14('0x32')];_0x26092b+=0x1){socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')][_0x26092b]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}}else{socket['emit'](_0xbe14('0x80'),{'UserId':Number(_0x3aaa54[_0xbe14('0x2e')][_0xbe14('0x6a')]),'VoiceQueueId':Number(_0x3aaa54[_0xbe14('0x2b')]['id'])});}});}})['then'](function(_0x44c341){return db[_0xbe14('0x62')][_0xbe14('0x14')]({'where':{'VoiceQueueId':_0x3aaa54['params']['id'],'UserId':_0x3aaa54['query'][_0xbe14('0x6a')]}})[_0xbe14('0x13')](function(){return _0x44c341;});})[_0xbe14('0x13')](respondWithStatusCode(_0x413893,null))['catch'](handleError(_0x413893,null));};exports[_0xbe14('0x84')]=function(_0x2f0d14,_0x180e61){var _0x952322={};var _0x3ae00b={};var _0x41962a;var _0x4ebf01;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x2f0d14[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x180e61,null))[_0xbe14('0x13')](function(_0x5f28dd){if(_0x5f28dd){_0x41962a=_0x5f28dd;_0x3ae00b['model']=_[_0xbe14('0x2d')](db['User'][_0xbe14('0x24')]);_0x3ae00b['query']=_[_0xbe14('0x2d')](_0x2f0d14[_0xbe14('0x2e')]);_0x3ae00b[_0xbe14('0x48')]=_['intersection'](_0x3ae00b[_0xbe14('0x2c')],_0x3ae00b[_0xbe14('0x2e')]);_0x952322[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x3ae00b[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x952322[_0xbe14('0x30')]=_0x952322[_0xbe14('0x30')]['length']?_0x952322[_0xbe14('0x30')]:_0x3ae00b[_0xbe14('0x2c')];_0x952322[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x952322[_0xbe14('0x28')]=qs[_0xbe14('0x48')](_['pick'](_0x2f0d14[_0xbe14('0x2e')],_0x3ae00b[_0xbe14('0x48')]));if(_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x952322[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x952322['where'],{'$or':_['map'](_0x952322['attributes'],function(_0x598ccc){var _0x446b3f={};_0x446b3f[_0x598ccc]={'$like':'%'+_0x2f0d14[_0xbe14('0x2e')]['filter']+'%'};return _0x446b3f;})});}_0x952322=_[_0xbe14('0x40')]({},_0x952322,_0x2f0d14['options']);return _0x41962a[_0xbe14('0x84')](_0x952322);}})[_0xbe14('0x13')](function(_0x111ff0){if(_0x111ff0){_0x4ebf01=_0x111ff0[_0xbe14('0x32')];if(!_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0x49')]('nolimit')){_0x952322[_0xbe14('0xf')]=qs[_0xbe14('0xf')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x952322[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x2f0d14[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x41962a[_0xbe14('0x84')](_0x952322);}})['then'](function(_0x2eb5e6){if(_0x2eb5e6){return _0x2eb5e6?{'count':_0x4ebf01,'rows':_0x2eb5e6}:null;}})['then'](respondWithResult(_0x180e61,null))[_0xbe14('0x35')](handleError(_0x180e61,null));};exports['getMembers']=function(_0x49cddc,_0x3bdbf7){var _0x19a1ae={};var _0x167dee={};var _0x4f6252;var _0x4536b9;return db['VoiceQueue'][_0xbe14('0x52')]({'where':{'id':_0x49cddc['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3bdbf7,null))[_0xbe14('0x13')](function(_0x21f14e){if(_0x21f14e){_0x4f6252=_0x21f14e;_0x167dee[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x62')]['rawAttributes']);_0x167dee[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x49cddc['query']);_0x167dee['filters']=_['intersection'](_0x167dee[_0xbe14('0x2c')],_0x167dee[_0xbe14('0x2e')]);_0x19a1ae[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x167dee[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x49cddc[_0xbe14('0x2e')]['fields']));_0x19a1ae[_0xbe14('0x30')]=_0x19a1ae[_0xbe14('0x30')][_0xbe14('0x32')]?_0x19a1ae['attributes']:_0x167dee[_0xbe14('0x2c')];_0x19a1ae[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x49cddc['query']['sort']);_0x19a1ae[_0xbe14('0x28')]=qs['filters'](_[_0xbe14('0x4d')](_0x49cddc[_0xbe14('0x2e')],_0x167dee[_0xbe14('0x48')]));if(_0x49cddc[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x19a1ae[_0xbe14('0x28')]=_['merge'](_0x19a1ae[_0xbe14('0x28')],{'$or':_['map'](_0x19a1ae[_0xbe14('0x30')],function(_0x2d0568){var _0x26bb56={};_0x26bb56[_0x2d0568]={'$like':'%'+_0x49cddc['query'][_0xbe14('0x19')]+'%'};return _0x26bb56;})});}_0x19a1ae=_[_0xbe14('0x40')]({},_0x19a1ae,_0x49cddc['options']);return _0x4f6252['getMembers'](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x3d9061){if(_0x3d9061){_0x4536b9=_0x3d9061[_0xbe14('0x32')];if(!_0x49cddc['query'][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x19a1ae['limit']=qs['limit'](_0x49cddc['query']['limit']);_0x19a1ae[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x49cddc['query']['offset']);}return _0x4f6252[_0xbe14('0x85')](_0x19a1ae);}})[_0xbe14('0x13')](function(_0x1046a0){return _0x1046a0?{'count':_0x4536b9,'rows':_0x1046a0}:null;})['then'](respondWithResult(_0x3bdbf7,null))[_0xbe14('0x35')](handleError(_0x3bdbf7,null));};exports[_0xbe14('0x86')]=function(_0x3933c7,_0x416c65){var _0x56f870={};var _0x28b3c4={};var _0x6fe862;var _0x5f4675;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x3933c7[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x416c65,null))[_0xbe14('0x13')](function(_0x4c4ab9){if(_0x4c4ab9){_0x6fe862=_0x4c4ab9;_0x28b3c4['model']=_[_0xbe14('0x2d')](db[_0xbe14('0x87')][_0xbe14('0x24')]);_0x28b3c4[_0xbe14('0x2e')]=_['keys'](_0x3933c7[_0xbe14('0x2e')]);_0x28b3c4[_0xbe14('0x48')]=_['intersection'](_0x28b3c4[_0xbe14('0x2c')],_0x28b3c4['query']);_0x56f870[_0xbe14('0x30')]=_[_0xbe14('0x2f')](_0x28b3c4['model'],qs[_0xbe14('0x31')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x56f870[_0xbe14('0x30')]=_0x56f870[_0xbe14('0x30')][_0xbe14('0x32')]?_0x56f870[_0xbe14('0x30')]:_0x28b3c4[_0xbe14('0x2c')];_0x56f870['order']=qs[_0xbe14('0x4c')](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x4c')]);_0x56f870['where']=qs['filters'](_['pick'](_0x3933c7[_0xbe14('0x2e')],_0x28b3c4[_0xbe14('0x48')]));if(_0x3933c7[_0xbe14('0x2e')]['filter']){_0x56f870['where']=_[_0xbe14('0x40')](_0x56f870[_0xbe14('0x28')],{'$or':_[_0xbe14('0x1a')](_0x56f870[_0xbe14('0x30')],function(_0x2ac6c0){var _0x3d381e={};_0x3d381e[_0x2ac6c0]={'$like':'%'+_0x3933c7[_0xbe14('0x2e')][_0xbe14('0x19')]+'%'};return _0x3d381e;})});}_0x56f870=_[_0xbe14('0x40')]({},_0x56f870,_0x3933c7['options']);return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2ca4de){if(_0x2ca4de){_0x5f4675=_0x2ca4de[_0xbe14('0x32')];if(!_0x3933c7[_0xbe14('0x2e')]['hasOwnProperty'](_0xbe14('0x4a'))){_0x56f870['limit']=qs['limit'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x56f870['offset']=qs['offset'](_0x3933c7[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x6fe862[_0xbe14('0x86')](_0x56f870);}})[_0xbe14('0x13')](function(_0x2e7c31){if(_0x2e7c31){return _0x2e7c31?{'count':_0x5f4675,'rows':_0x2e7c31}:null;}})['then'](respondWithResult(_0x416c65,null))['catch'](handleError(_0x416c65,null));};exports[_0xbe14('0x88')]=function(_0x4b07fc,_0x76e84){var _0x3f687f=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x4f4b69,_0x43d760;return db['VoiceQueue'][_0xbe14('0x1d')]({'where':{'id':_0x4b07fc[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x76e84,null))[_0xbe14('0x13')](function(_0x30657c){if(_0x30657c){_0x43d760=_0x30657c;return _0x30657c[_0xbe14('0x88')](_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x6a')],_['omit'](_0x4b07fc[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0xd97d02){var _0x15082b;_0x4f4b69=_0xd97d02||[];var _0x5d15c7=[];if(_0xd97d02){for(var _0x66b6a7=0x0;_0x66b6a7<_0xd97d02[_0xbe14('0x32')];_0x66b6a7+=0x1){var _0x4dfe2c=_0xd97d02[_0x66b6a7][_0xbe14('0x15')]({'plain':!![]});_0x43d760['dialCheckDuplicateType']=_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]?_0x4b07fc[_0xbe14('0x37')][_0xbe14('0x89')]:_0x43d760[_0xbe14('0x89')];switch(_0x43d760[_0xbe14('0x89')]){case'always':_0x15082b=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x96'))[_0xbe14('0x6f')](_0xbe14('0x97'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id']['toString']()))[_0xbe14('0x28')](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x98'))[_0xbe14('0x6f')]('cm_hopper')[_0xbe14('0x28')](_0xbe14('0x72'),_0x4b07fc[_0xbe14('0x2b')]['id']['toString']())))[_0xbe14('0x75')]();break;case _0xbe14('0x99'):_0x15082b=squel['insert']()[_0xbe14('0x8b')]('cm_hopper')[_0xbe14('0x8d')]([_0xbe14('0x8e'),_0xbe14('0x8f'),_0xbe14('0x90'),'ListId','VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x4b07fc[_0xbe14('0x2b')]['id']['toString'](),'VoiceQueueId')['field']('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x4dfe2c['CmListId'][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94'))['where'](_0xbe14('0x95'),squel[_0xbe14('0x6c')]()[_0xbe14('0x6d')](_0xbe14('0x98'))[_0xbe14('0x6f')](_0xbe14('0x8c'))[_0xbe14('0x28')]('VoiceQueueId\x20=\x20?',_0x4b07fc[_0xbe14('0x2b')]['id'][_0xbe14('0x75')]())))['toString']();break;default:_0x15082b=squel['insert']()[_0xbe14('0x8b')](_0xbe14('0x8c'))[_0xbe14('0x8d')](['phone',_0xbe14('0x8f'),_0xbe14('0x90'),_0xbe14('0x91'),_0xbe14('0x4e'),_0xbe14('0x42'),_0xbe14('0x43')],squel['select']()[_0xbe14('0x6d')]('phone',_0xbe14('0x8e'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x8f'))['field']('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x4dfe2c['CmListId'][_0xbe14('0x75')](),'ListId')[_0xbe14('0x6d')](_0x4b07fc['params']['id'][_0xbe14('0x75')](),'VoiceQueueId')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x42'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')]('cm_contacts')[_0xbe14('0x28')](_0xbe14('0x9b'))['where'](_0xbe14('0x93'),_0x4dfe2c[_0xbe14('0x92')]['toString']())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();}_0x5d15c7['push'](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x15082b));}return BPromise[_0xbe14('0x7a')](_0x5d15c7);}})[_0xbe14('0x13')](function(){var _0x4bc564=[];var _0x19e7ce=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0x9c'))[_0xbe14('0x8d')]([_0xbe14('0x9d'),_0xbe14('0x8e'),_0xbe14('0x9e'),_0xbe14('0x42'),'updatedAt'],squel[_0xbe14('0x6c')]()['field']('h.id')[_0xbe14('0x6d')](_0xbe14('0x9f'))['field'](_0xbe14('0xa0'))[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27','createdAt')[_0xbe14('0x6d')]('\x27'+_0x3f687f+'\x27',_0xbe14('0x43'))[_0xbe14('0x6f')](_0xbe14('0xa1'),'ci')[_0xbe14('0x71')](_0xbe14('0x8c'),'h','h.ContactId=ci.CmContactId')['where'](_0xbe14('0xa2'),_0x3f687f)['where'](_0xbe14('0xa3'),_0xbe14('0xa4')))['toString']();_0x4bc564[_0xbe14('0x74')](db[_0xbe14('0x60')][_0xbe14('0x2e')](_0x19e7ce));return BPromise[_0xbe14('0x7a')](_0x4bc564);})[_0xbe14('0x13')](function(){return _0x4f4b69;})[_0xbe14('0x13')](respondWithResult(_0x76e84,null))[_0xbe14('0x35')](handleError(_0x76e84,null));};exports['removeLists']=function(_0x4ceca6,_0x23f4a3){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x23f4a3,null))[_0xbe14('0x13')](function(_0x2fe8b0){if(_0x2fe8b0){return _0x2fe8b0[_0xbe14('0xa5')](_0x4ceca6['query'][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x186284){if(_0x186284){return db['CmHopper'][_0xbe14('0x14')]({'where':{'ListId':_0x4ceca6[_0xbe14('0x2e')][_0xbe14('0x6a')],'VoiceQueueId':_0x4ceca6[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](function(){return _0x186284;});}})['then'](respondWithStatusCode(_0x23f4a3,null))[_0xbe14('0x35')](handleError(_0x23f4a3,null));};exports[_0xbe14('0xa6')]=function(_0x4c9319,_0x1173f0){var _0x1e0c81={};var _0x5349a7={};var _0x5e3819;var _0x28c5fe;return db[_0xbe14('0x23')][_0xbe14('0x52')]({'where':{'id':_0x4c9319['params']['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x1173f0,null))[_0xbe14('0x13')](function(_0x59434a){if(_0x59434a){_0x5e3819=_0x59434a;_0x5349a7[_0xbe14('0x2c')]=_[_0xbe14('0x2d')](db[_0xbe14('0x87')]['rawAttributes']);_0x5349a7[_0xbe14('0x2e')]=_[_0xbe14('0x2d')](_0x4c9319[_0xbe14('0x2e')]);_0x5349a7[_0xbe14('0x48')]=_[_0xbe14('0x2f')](_0x5349a7[_0xbe14('0x2c')],_0x5349a7[_0xbe14('0x2e')]);_0x1e0c81[_0xbe14('0x30')]=_['intersection'](_0x5349a7[_0xbe14('0x2c')],qs[_0xbe14('0x31')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x31')]));_0x1e0c81[_0xbe14('0x30')]=_0x1e0c81['attributes'][_0xbe14('0x32')]?_0x1e0c81[_0xbe14('0x30')]:_0x5349a7[_0xbe14('0x2c')];_0x1e0c81[_0xbe14('0x4b')]=qs[_0xbe14('0x4c')](_0x4c9319[_0xbe14('0x2e')]['sort']);_0x1e0c81['where']=qs['filters'](_[_0xbe14('0x4d')](_0x4c9319[_0xbe14('0x2e')],_0x5349a7['filters']));if(_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x19')]){_0x1e0c81[_0xbe14('0x28')]=_[_0xbe14('0x40')](_0x1e0c81['where'],{'$or':_[_0xbe14('0x1a')](_0x1e0c81[_0xbe14('0x30')],function(_0x52bbc1){var _0x2797ef={};_0x2797ef[_0x52bbc1]={'$like':'%'+_0x4c9319['query']['filter']+'%'};return _0x2797ef;})});}_0x1e0c81=_[_0xbe14('0x40')]({},_0x1e0c81,_0x4c9319[_0xbe14('0x34')]);return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})[_0xbe14('0x13')](function(_0x47bba1){if(_0x47bba1){_0x28c5fe=_0x47bba1[_0xbe14('0x32')];if(!_0x4c9319[_0xbe14('0x2e')][_0xbe14('0x49')](_0xbe14('0x4a'))){_0x1e0c81['limit']=qs[_0xbe14('0xf')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xf')]);_0x1e0c81[_0xbe14('0xd')]=qs[_0xbe14('0xd')](_0x4c9319[_0xbe14('0x2e')][_0xbe14('0xd')]);}return _0x5e3819[_0xbe14('0xa6')](_0x1e0c81);}})['then'](function(_0x2592ab){if(_0x2592ab){return _0x2592ab?{'count':_0x28c5fe,'rows':_0x2592ab}:null;}})[_0xbe14('0x13')](respondWithResult(_0x1173f0,null))['catch'](handleError(_0x1173f0,null));};exports['addBlackLists']=function(_0x6a0f29,_0x3d04b9){var _0x21f793;return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x6a0f29[_0xbe14('0x2b')]['id']}})['then'](handleEntityNotFound(_0x3d04b9,null))[_0xbe14('0x13')](function(_0x37e5e8){if(_0x37e5e8){return _0x37e5e8['addBlackLists'](_0x6a0f29[_0xbe14('0x37')][_0xbe14('0x6a')],_[_0xbe14('0x41')](_0x6a0f29[_0xbe14('0x37')],[_0xbe14('0x6a'),'id'])||{});}return null;})[_0xbe14('0x82')](function(_0x14cec7){var _0x524603;_0x21f793=_0x14cec7||[];var _0x38d720=[];if(_0x14cec7){for(var _0x379446=0x0;_0x379446<_0x14cec7[_0xbe14('0x32')];_0x379446+=0x1){var _0x1489c9=_0x14cec7[_0x379446][_0xbe14('0x15')]({'plain':!![]});_0x524603=squel[_0xbe14('0x8a')]()[_0xbe14('0x8b')](_0xbe14('0xa7'))['fromQuery']([_0xbe14('0x8e'),_0xbe14('0x90'),_0xbe14('0x91'),'VoiceQueueId',_0xbe14('0x42'),_0xbe14('0x43')],squel[_0xbe14('0x6c')]()['field'](_0xbe14('0x8e'),'phone')[_0xbe14('0x6d')]('id',_0xbe14('0x90'))[_0xbe14('0x6d')](_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')](),_0xbe14('0x91'))[_0xbe14('0x6d')](_0x6a0f29['params']['id'][_0xbe14('0x75')](),_0xbe14('0x4e'))[_0xbe14('0x6d')](_0xbe14('0xa8'),_0xbe14('0x42'))[_0xbe14('0x6d')](_0xbe14('0xa8'),'updatedAt')[_0xbe14('0x6f')](_0xbe14('0x9a'))[_0xbe14('0x28')](_0xbe14('0x9b'))[_0xbe14('0x28')](_0xbe14('0x93'),_0x1489c9[_0xbe14('0x92')][_0xbe14('0x75')]())[_0xbe14('0x28')](_0xbe14('0x94')))[_0xbe14('0x75')]();_0x38d720[_0xbe14('0x74')](db['sequelize'][_0xbe14('0x2e')](_0x524603));}return BPromise[_0xbe14('0x7a')](_0x38d720);}})['then'](function(){return _0x21f793;})['then'](respondWithResult(_0x3d04b9,null))[_0xbe14('0x35')](handleError(_0x3d04b9,null));};exports[_0xbe14('0xa9')]=function(_0x7533c3,_0x3ec670){return db[_0xbe14('0x23')][_0xbe14('0x1d')]({'where':{'id':_0x7533c3[_0xbe14('0x2b')]['id']}})[_0xbe14('0x13')](handleEntityNotFound(_0x3ec670,null))['then'](function(_0x3ee9e2){if(_0x3ee9e2){return _0x3ee9e2['removeBlackLists'](_0x7533c3[_0xbe14('0x2e')][_0xbe14('0x6a')]);}})[_0xbe14('0x13')](function(_0x1d343a){if(_0x1d343a){return db[_0xbe14('0x57')][_0xbe14('0x14')]({'where':{'ListId':_0x7533c3['query']['ids'],'VoiceQueueId':_0x7533c3['params']['id']}})['then'](function(){return _0x1d343a;});}})['then'](respondWithStatusCode(_0x3ec670,null))[_0xbe14('0x35')](handleError(_0x3ec670,null));}; \ No newline at end of file +var _0x4b84=['type','find','UserProfileResource','stack','name','send','index','rawAttributes','fieldName','key','getOptions','where','VoiceQueue','include','findAll','rows','catch','show','params','model','keys','query','filters','intersection','attributes','fields','length','includeAll','merge','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','userProfileId','findOne','hasOwnProperty','nolimit','order','sort','VoiceQueueId','CmHopper','getHopperHistories','pick','CmHopperHistory','CmHopperFinal','CmHopperBlack','getTeams','Team','addTeams','User','Agents','voicePause','interface','forEach','penalty','transaction','TeamVoiceQueue','each','UserVoiceQueue','UserVoiceQueueRt','upsert','format','SIP/%s','emit','ids','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','sequelize','SELECT','TeamId','all','removeTeams','isEmpty','removeAgents','addAgents','spread','userVoiceQueue:save','online','isNil','isArray','userVoiceQueue:remove','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','fromQuery','phone','scheduledAt','ContactId','ListId','select','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','onlyIfOpen','insert','into','CmHopperId','OrderBy','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','h.scheduledat=?','ci.ItemClass=?','removeLists','getBlackLists','NOW()','removeBlackLists','moment','bluebird','squel','../../config/logger','api','../../config/environment','redis','socket.io-emitter','./voiceQueue.socket','sendStatus','end','status','json','undefined','count','offset','limit','update','destroy','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','map','value'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4b84,0x1cc));var _0x44b8=function(_0x35bd6c,_0x585087){_0x35bd6c=_0x35bd6c-0x0;var _0x2f421d=_0x4b84[_0x35bd6c];return _0x2f421d;};'use strict';var moment=require(_0x44b8('0x0'));var BPromise=require(_0x44b8('0x1'));var util=require('util');var _=require('lodash');var squel=require(_0x44b8('0x2'));var Redis=require('ioredis');var qs=require('../../components/parsers/qs');var logger=require(_0x44b8('0x3'))(_0x44b8('0x4'));var config=require(_0x44b8('0x5'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0x44b8('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x44b8('0x7'))(new Redis(config['redis']));require(_0x44b8('0x8'))['register'](socket);function respondWithStatusCode(_0x5034b6,_0x41d515){_0x41d515=_0x41d515||0xcc;return function(_0x42319d){if(_0x42319d){return _0x5034b6[_0x44b8('0x9')](_0x41d515);}return _0x5034b6['status'](_0x41d515)[_0x44b8('0xa')]();};}function respondWithResult(_0x2cc74b,_0x4315f6){_0x4315f6=_0x4315f6||0xc8;return function(_0x9b6048){if(_0x9b6048){return _0x2cc74b[_0x44b8('0xb')](_0x4315f6)[_0x44b8('0xc')](_0x9b6048);}};}function respondWithFilteredResult(_0xe9a025,_0x4ae8a1){return function(_0x147529){if(_0x147529){var _0x4301a6=typeof _0x4ae8a1['offset']===_0x44b8('0xd')&&typeof _0x4ae8a1['limit']===_0x44b8('0xd');var _0x18d642=_0x147529['count'];var _0x63e8f6=_0x4301a6?0x0:_0x4ae8a1['offset'];var _0x54fa95=_0x4301a6?_0x147529[_0x44b8('0xe')]:_0x4ae8a1[_0x44b8('0xf')]+_0x4ae8a1[_0x44b8('0x10')];var _0x41ab46;if(_0x54fa95>=_0x18d642){_0x54fa95=_0x18d642;_0x41ab46=0xc8;}else{_0x41ab46=0xce;}_0xe9a025['status'](_0x41ab46);return _0xe9a025['set']('Content-Range',_0x63e8f6+'-'+_0x54fa95+'/'+_0x18d642)[_0x44b8('0xc')](_0x147529);}return null;};}function saveUpdates(_0x5b7803){return function(_0x28ef36){if(_0x28ef36){return _0x28ef36[_0x44b8('0x11')](_0x5b7803)['then'](function(_0x36743e){return _0x36743e;});}return null;};}function removeEntity(_0xe3de8f){return function(_0x5103f5){if(_0x5103f5){return _0x5103f5[_0x44b8('0x12')]()[_0x44b8('0x13')](function(){var _0x4b600f=_0x5103f5[_0x44b8('0x14')]({'plain':!![]});var _0x8b4301=[{'name':_0x44b8('0x15'),'value':_0x44b8('0x16'),'ignore':![]},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18'),'ignore':![]}];var _0x452f2f=_(_0x8b4301)[_0x44b8('0x19')](_0x44b8('0x1a'))[_0x44b8('0x1b')](_0x44b8('0x1c'))[_0x44b8('0x1c')]();if(_['includes'](_0x452f2f,_0x4b600f[_0x44b8('0x1d')])){return;}var _0x3a8aa4=_[_0x44b8('0x1e')](_0x8b4301,[_0x44b8('0x1c'),_0x4b600f[_0x44b8('0x1d')]])['name'];return db[_0x44b8('0x1f')]['destroy']({'where':{'type':_0x3a8aa4,'resourceId':_0x4b600f['id']}})[_0x44b8('0x13')](function(){return _0x5103f5;});})[_0x44b8('0x13')](function(){_0xe3de8f[_0x44b8('0xb')](0xcc)[_0x44b8('0xa')]();});}};}function handleEntityNotFound(_0x230a3d){return function(_0x59acbc){if(!_0x59acbc){_0x230a3d[_0x44b8('0x9')](0x194);}return _0x59acbc;};}function handleError(_0x502acf,_0x41d673){_0x41d673=_0x41d673||0x1f4;return function(_0x350482){logger['error'](_0x350482[_0x44b8('0x20')]);if(_0x350482[_0x44b8('0x21')]){delete _0x350482[_0x44b8('0x21')];}_0x502acf['status'](_0x41d673)[_0x44b8('0x22')](_0x350482);};}exports[_0x44b8('0x23')]=function(_0x53d9c7,_0x2e0174){var _0x4a182d={};var _0xfb0028={'count':0x0,'rows':[]};var _0x5a544c=_['map'](db['VoiceQueue'][_0x44b8('0x24')],function(_0x29b18d){return{'name':_0x29b18d[_0x44b8('0x25')],'type':_0x29b18d[_0x44b8('0x1d')][_0x44b8('0x26')]};});_0x4a182d=qs[_0x44b8('0x27')](_0x5a544c,_0x53d9c7);var _0x2cf205={'where':_0x4a182d[_0x44b8('0x28')]};return db[_0x44b8('0x29')][_0x44b8('0xe')](_0x2cf205)[_0x44b8('0x13')](function(_0x417d81){_0xfb0028[_0x44b8('0xe')]=_0x417d81;_0x4a182d['include']=qs[_0x44b8('0x2a')](_0x53d9c7['query']);return db[_0x44b8('0x29')][_0x44b8('0x2b')](_0x4a182d);})[_0x44b8('0x13')](function(_0xb64609){_0xfb0028[_0x44b8('0x2c')]=_0xb64609;return _0xfb0028;})['then'](respondWithFilteredResult(_0x2e0174,_0x4a182d))[_0x44b8('0x2d')](handleError(_0x2e0174,null));};exports[_0x44b8('0x2e')]=function(_0x26265f,_0x339f0f){var _0x46b008={'raw':![],'where':{'id':_0x26265f[_0x44b8('0x2f')]['id']}},_0x5f541d={};_0x5f541d[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0x5f541d[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x26265f[_0x44b8('0x32')]);_0x5f541d[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],_0x5f541d[_0x44b8('0x32')]);_0x46b008[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x5f541d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x26265f[_0x44b8('0x32')][_0x44b8('0x36')]));_0x46b008[_0x44b8('0x35')]=_0x46b008[_0x44b8('0x35')][_0x44b8('0x37')]?_0x46b008[_0x44b8('0x35')]:_0x5f541d['model'];if(_0x26265f[_0x44b8('0x32')][_0x44b8('0x38')]){_0x46b008['include']=[{'all':!![]}];}_0x46b008=_[_0x44b8('0x39')]({},_0x46b008,_0x26265f[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0x46b008)['then'](handleEntityNotFound(_0x339f0f,null))[_0x44b8('0x13')](respondWithResult(_0x339f0f,null))[_0x44b8('0x2d')](handleError(_0x339f0f,null));};exports[_0x44b8('0x3b')]=function(_0x1ee3cc,_0x9cb2a){return db[_0x44b8('0x29')][_0x44b8('0x3b')](_0x1ee3cc[_0x44b8('0x3c')],{})[_0x44b8('0x13')](function(_0x3d1be1){var _0x1c9983=_0x1ee3cc[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x1c9983)throw new Error(_0x44b8('0x3e'));if(_0x1c9983[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x57d8c4=_0x3d1be1[_0x44b8('0x14')]({'plain':!![]});var _0x43e43a=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x229cc9=_['find'](_0x43e43a,[_0x44b8('0x1c'),_0x57d8c4[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db[_0x44b8('0x40')][_0x44b8('0x1e')]({'where':{'name':_0x229cc9,'userProfileId':_0x1c9983['userProfileId']},'raw':!![]})['then'](function(_0x215f7b){if(_0x215f7b&&_0x215f7b[_0x44b8('0x41')]===0x0){return db[_0x44b8('0x1f')][_0x44b8('0x3b')]({'name':_0x57d8c4[_0x44b8('0x21')],'resourceId':_0x57d8c4['id'],'type':_0x215f7b[_0x44b8('0x21')],'sectionId':_0x215f7b['id']},{})[_0x44b8('0x13')](function(){return _0x3d1be1;});}else{return _0x3d1be1;}})[_0x44b8('0x2d')](function(_0x455fd6){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x455fd6);throw _0x455fd6;});}return _0x3d1be1;})[_0x44b8('0x13')](respondWithResult(_0x9cb2a,0xc9))[_0x44b8('0x2d')](handleError(_0x9cb2a,null));};exports[_0x44b8('0x44')]=function(_0x149731,_0x60eeb2){var _0xce06dc={'where':{'id':_0x149731[_0x44b8('0x2f')]['id']}},_0x3b3d5d={};_0x3b3d5d['model']=_['keys'](db[_0x44b8('0x29')][_0x44b8('0x24')]);_0xce06dc[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x3b3d5d[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x149731[_0x44b8('0x32')]['fields']));_0xce06dc[_0x44b8('0x35')]=_0xce06dc['attributes'][_0x44b8('0x37')]?_0xce06dc[_0x44b8('0x35')]:_0x3b3d5d[_0x44b8('0x30')];if(_0x149731[_0x44b8('0x32')][_0x44b8('0x38')]){_0xce06dc[_0x44b8('0x2a')]=[{'all':!![]}];}_0xce06dc=_['merge']({},_0xce06dc,_0x149731[_0x44b8('0x3a')]);return db[_0x44b8('0x29')][_0x44b8('0x1e')](_0xce06dc)[_0x44b8('0x13')](handleEntityNotFound(_0x60eeb2,null))['then'](function(_0x4e4ed1){if(_0x4e4ed1){var _0x2f549d=_0x4e4ed1[_0x44b8('0x14')]({'plain':!![]});_0x2f549d=qs[_0x44b8('0x45')](_0x2f549d,['id',_0x44b8('0x46'),_0x44b8('0x47')]);_0x149731['body']=_[_0x44b8('0x45')](_0x149731[_0x44b8('0x3c')],['id',_0x44b8('0x46'),_0x44b8('0x47')]);return db[_0x44b8('0x29')]['create'](_['merge'](_0x2f549d,_0x149731[_0x44b8('0x3c')]),{'include':_0x149731['query'][_0x44b8('0x38')]?[{'all':!![]}]:undefined})['then'](function(_0x40164d){var _0x434d6a=_0x149731[_0x44b8('0x3d')][_0x44b8('0x14')]({'plain':!![]});if(!_0x434d6a)throw new Error(_0x44b8('0x3e'));if(_0x434d6a[_0x44b8('0x3f')]===_0x44b8('0x3d')){var _0x533967=_0x40164d[_0x44b8('0x14')]({'plain':!![]});var _0x37b2c2=[{'name':_0x44b8('0x15'),'value':'inbound'},{'name':_0x44b8('0x17'),'value':_0x44b8('0x18')}];var _0x45f9a0=_[_0x44b8('0x1e')](_0x37b2c2,['value',_0x533967[_0x44b8('0x1d')]])[_0x44b8('0x21')];return db['UserProfileSection'][_0x44b8('0x1e')]({'where':{'name':_0x45f9a0,'userProfileId':_0x434d6a[_0x44b8('0x48')]},'raw':!![]})[_0x44b8('0x13')](function(_0x3df6aa){if(_0x3df6aa&&_0x3df6aa[_0x44b8('0x41')]===0x0){return db['UserProfileResource']['create']({'name':_0x533967[_0x44b8('0x21')],'resourceId':_0x533967['id'],'type':_0x3df6aa[_0x44b8('0x21')],'sectionId':_0x3df6aa['id']},{})[_0x44b8('0x13')](function(){return _0x40164d;});}else{return _0x40164d;}})[_0x44b8('0x2d')](function(_0x765e45){logger[_0x44b8('0x42')](_0x44b8('0x43'),_0x765e45);throw _0x765e45;});}return _0x40164d;});}})[_0x44b8('0x13')](respondWithResult(_0x60eeb2,0xc9))[_0x44b8('0x2d')](handleError(_0x60eeb2,null));};exports[_0x44b8('0x11')]=function(_0x16c628,_0x3f7576){if(_0x16c628['body']['id']){delete _0x16c628[_0x44b8('0x3c')]['id'];}return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x16c628[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3f7576,null))[_0x44b8('0x13')](saveUpdates(_0x16c628[_0x44b8('0x3c')],null))[_0x44b8('0x13')](respondWithResult(_0x3f7576,null))[_0x44b8('0x2d')](handleError(_0x3f7576,null));};exports[_0x44b8('0x12')]=function(_0x2ecff9,_0x15bcba){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2ecff9[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x15bcba,null))[_0x44b8('0x13')](removeEntity(_0x15bcba,null))[_0x44b8('0x2d')](handleError(_0x15bcba,null));};exports['getHoppers']=function(_0x1ec516,_0x3aac51){var _0x10e519={'raw':![],'where':{}};var _0x2b37e={};var _0x51f763={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x1ec516['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3aac51,null))[_0x44b8('0x13')](function(_0x5df821){if(_0x5df821){_0x2b37e[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopper'][_0x44b8('0x24')]);_0x2b37e[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x1ec516['query']);_0x2b37e[_0x44b8('0x33')]=_['intersection'](_0x2b37e[_0x44b8('0x30')],_0x2b37e['query']);_0x10e519[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2b37e[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x36')]));_0x10e519['attributes']=_0x10e519[_0x44b8('0x35')]['length']?_0x10e519[_0x44b8('0x35')]:_0x2b37e[_0x44b8('0x30')];if(!_0x1ec516['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x10e519[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0x10')]);_0x10e519[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x1ec516[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x10e519[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x1ec516['query'][_0x44b8('0x4d')]);_0x10e519[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_['pick'](_0x1ec516[_0x44b8('0x32')],_0x2b37e[_0x44b8('0x33')]));_0x10e519['where'][_0x44b8('0x4e')]=_0x5df821['id'];if(_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]){_0x10e519[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x10e519['where'],{'$or':_[_0x44b8('0x1b')](_0x10e519[_0x44b8('0x35')],function(_0x279753){var _0x270224={};_0x270224[_0x279753]={'$like':'%'+_0x1ec516[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x270224;})});}_0x10e519=_[_0x44b8('0x39')]({},_0x10e519,_0x1ec516[_0x44b8('0x3a')]);return db['CmHopper'][_0x44b8('0xe')]({'where':_0x10e519[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x3ce76e){_0x51f763['count']=_0x3ce76e;if(_0x1ec516['query']['includeAll']){_0x10e519[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x4f')][_0x44b8('0x2b')](_0x10e519);})[_0x44b8('0x13')](function(_0x32e630){_0x51f763['rows']=_0x32e630;return _0x51f763;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x3aac51,_0x10e519))['catch'](handleError(_0x3aac51,null));};exports[_0x44b8('0x50')]=function(_0x155bcf,_0xea2c3e){var _0x5da034={'raw':!![],'where':{}};var _0x4cac12={};var _0xb4c6dc={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x155bcf['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xea2c3e,null))[_0x44b8('0x13')](function(_0x1258c2){if(_0x1258c2){_0x4cac12[_0x44b8('0x30')]=_[_0x44b8('0x31')](db['CmHopperHistory'][_0x44b8('0x24')]);_0x4cac12[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x155bcf[_0x44b8('0x32')]);_0x4cac12[_0x44b8('0x33')]=_['intersection'](_0x4cac12[_0x44b8('0x30')],_0x4cac12[_0x44b8('0x32')]);_0x5da034[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x4cac12[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x155bcf[_0x44b8('0x32')]['fields']));_0x5da034[_0x44b8('0x35')]=_0x5da034[_0x44b8('0x35')]['length']?_0x5da034[_0x44b8('0x35')]:_0x4cac12[_0x44b8('0x30')];if(!_0x155bcf['query'][_0x44b8('0x4a')]('nolimit')){_0x5da034['limit']=qs[_0x44b8('0x10')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x10')]);_0x5da034['offset']=qs['offset'](_0x155bcf['query'][_0x44b8('0xf')]);}_0x5da034[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x155bcf[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x5da034[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x155bcf['query'],_0x4cac12[_0x44b8('0x33')]));_0x5da034['where']['VoiceQueueId']=_0x1258c2['id'];if(_0x155bcf['query'][_0x44b8('0x19')]){_0x5da034['where']=_[_0x44b8('0x39')](_0x5da034[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x5da034[_0x44b8('0x35')],function(_0x3a9780){var _0x245ba3={};_0x245ba3[_0x3a9780]={'$like':'%'+_0x155bcf[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x245ba3;})});}_0x5da034=_['merge']({},_0x5da034,_0x155bcf[_0x44b8('0x3a')]);return db[_0x44b8('0x52')][_0x44b8('0xe')]({'where':_0x5da034[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0xee44b3){_0xb4c6dc[_0x44b8('0xe')]=_0xee44b3;if(_0x155bcf[_0x44b8('0x32')][_0x44b8('0x38')]){_0x5da034['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x44b8('0x2b')](_0x5da034);})['then'](function(_0x531d65){_0xb4c6dc[_0x44b8('0x2c')]=_0x531d65;return _0xb4c6dc;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0xea2c3e,_0x5da034))['catch'](handleError(_0xea2c3e,null));};exports['getHopperFinals']=function(_0x4b22e7,_0x2e0289){var _0x4860af={'raw':!![],'where':{}};var _0x353ff1={};var _0x2812da={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x4b22e7[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2e0289,null))[_0x44b8('0x13')](function(_0x3a7229){if(_0x3a7229){_0x353ff1[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x53')][_0x44b8('0x24')]);_0x353ff1[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x4b22e7['query']);_0x353ff1[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],_0x353ff1[_0x44b8('0x32')]);_0x4860af[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x353ff1[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x36')]));_0x4860af[_0x44b8('0x35')]=_0x4860af[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4860af['attributes']:_0x353ff1[_0x44b8('0x30')];if(!_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4860af['limit']=qs[_0x44b8('0x10')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4860af['offset']=qs[_0x44b8('0xf')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x4860af[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4860af[_0x44b8('0x28')]=qs['filters'](_[_0x44b8('0x51')](_0x4b22e7[_0x44b8('0x32')],_0x353ff1[_0x44b8('0x33')]));_0x4860af[_0x44b8('0x28')][_0x44b8('0x4e')]=_0x3a7229['id'];if(_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4860af['where']=_['merge'](_0x4860af['where'],{'$or':_[_0x44b8('0x1b')](_0x4860af[_0x44b8('0x35')],function(_0x2d74ee){var _0x312f4c={};_0x312f4c[_0x2d74ee]={'$like':'%'+_0x4b22e7[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x312f4c;})});}_0x4860af=_[_0x44b8('0x39')]({},_0x4860af,_0x4b22e7[_0x44b8('0x3a')]);return db[_0x44b8('0x53')]['count']({'where':_0x4860af[_0x44b8('0x28')]})[_0x44b8('0x13')](function(_0x4b8036){_0x2812da['count']=_0x4b8036;if(_0x4b22e7[_0x44b8('0x32')]['includeAll']){_0x4860af[_0x44b8('0x2a')]=[{'all':!![]}];}return db[_0x44b8('0x53')][_0x44b8('0x2b')](_0x4860af);})['then'](function(_0x3f4a2a){_0x2812da[_0x44b8('0x2c')]=_0x3f4a2a;return _0x2812da;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x2e0289,_0x4860af))[_0x44b8('0x2d')](handleError(_0x2e0289,null));};exports['getHopperBlacks']=function(_0x216030,_0x584ae3){var _0x38c0c5={'raw':!![],'where':{}};var _0x2f2923={};var _0x2d9d62={'count':0x0,'rows':[]};return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x216030[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x584ae3,null))['then'](function(_0x4d3b82){if(_0x4d3b82){_0x2f2923['model']=_[_0x44b8('0x31')](db[_0x44b8('0x54')][_0x44b8('0x24')]);_0x2f2923[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x216030[_0x44b8('0x32')]);_0x2f2923[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],_0x2f2923[_0x44b8('0x32')]);_0x38c0c5[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x2f2923[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x216030[_0x44b8('0x32')][_0x44b8('0x36')]));_0x38c0c5[_0x44b8('0x35')]=_0x38c0c5[_0x44b8('0x35')]['length']?_0x38c0c5[_0x44b8('0x35')]:_0x2f2923['model'];if(!_0x216030[_0x44b8('0x32')]['hasOwnProperty']('nolimit')){_0x38c0c5[_0x44b8('0x10')]=qs['limit'](_0x216030['query']['limit']);_0x38c0c5['offset']=qs['offset'](_0x216030[_0x44b8('0x32')][_0x44b8('0xf')]);}_0x38c0c5[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x216030['query'][_0x44b8('0x4d')]);_0x38c0c5[_0x44b8('0x28')]=qs['filters'](_['pick'](_0x216030[_0x44b8('0x32')],_0x2f2923[_0x44b8('0x33')]));_0x38c0c5[_0x44b8('0x28')]['VoiceQueueId']=_0x4d3b82['id'];if(_0x216030[_0x44b8('0x32')][_0x44b8('0x19')]){_0x38c0c5[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x38c0c5[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x38c0c5[_0x44b8('0x35')],function(_0x16344b){var _0x21057f={};_0x21057f[_0x16344b]={'$like':'%'+_0x216030['query'][_0x44b8('0x19')]+'%'};return _0x21057f;})});}_0x38c0c5=_[_0x44b8('0x39')]({},_0x38c0c5,_0x216030['options']);return db[_0x44b8('0x54')][_0x44b8('0xe')]({'where':_0x38c0c5[_0x44b8('0x28')]})['then'](function(_0x3a09e4){_0x2d9d62['count']=_0x3a09e4;if(_0x216030[_0x44b8('0x32')][_0x44b8('0x38')]){_0x38c0c5['include']=[{'all':!![]}];}return db[_0x44b8('0x54')][_0x44b8('0x2b')](_0x38c0c5);})[_0x44b8('0x13')](function(_0x37871e){_0x2d9d62['rows']=_0x37871e;return _0x2d9d62;});}})[_0x44b8('0x13')](respondWithFilteredResult(_0x584ae3,_0x38c0c5))[_0x44b8('0x2d')](handleError(_0x584ae3,null));};exports[_0x44b8('0x55')]=function(_0x35d46c,_0x2d4a8a){var _0x1d666e={};var _0x10a66a={};var _0x1e608f;var _0x470f90;return db['VoiceQueue']['findOne']({'where':{'id':_0x35d46c[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2d4a8a,null))[_0x44b8('0x13')](function(_0x3539f9){if(_0x3539f9){_0x1e608f=_0x3539f9;_0x10a66a[_0x44b8('0x30')]=_['keys'](db[_0x44b8('0x56')]['rawAttributes']);_0x10a66a[_0x44b8('0x32')]=_['keys'](_0x35d46c[_0x44b8('0x32')]);_0x10a66a[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],_0x10a66a[_0x44b8('0x32')]);_0x1d666e[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x10a66a[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x35d46c['query'][_0x44b8('0x36')]));_0x1d666e[_0x44b8('0x35')]=_0x1d666e[_0x44b8('0x35')][_0x44b8('0x37')]?_0x1d666e['attributes']:_0x10a66a['model'];_0x1d666e['order']=qs[_0x44b8('0x4d')](_0x35d46c['query']['sort']);_0x1d666e[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x35d46c[_0x44b8('0x32')],_0x10a66a[_0x44b8('0x33')]));if(_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]){_0x1d666e[_0x44b8('0x28')]=_['merge'](_0x1d666e[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x1d666e[_0x44b8('0x35')],function(_0x2594bf){var _0x5f0c0c={};_0x5f0c0c[_0x2594bf]={'$like':'%'+_0x35d46c[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x5f0c0c;})});}_0x1d666e=_[_0x44b8('0x39')]({},_0x1d666e,_0x35d46c['options']);return _0x1e608f['getTeams'](_0x1d666e);}})[_0x44b8('0x13')](function(_0xae9b10){if(_0xae9b10){_0x470f90=_0xae9b10[_0x44b8('0x37')];if(!_0x35d46c[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x1d666e[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x35d46c['query'][_0x44b8('0x10')]);_0x1d666e[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x35d46c[_0x44b8('0x32')]['offset']);}return _0x1e608f[_0x44b8('0x55')](_0x1d666e);}})['then'](function(_0x4464d3){if(_0x4464d3){return _0x4464d3?{'count':_0x470f90,'rows':_0x4464d3}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2d4a8a,null))[_0x44b8('0x2d')](handleError(_0x2d4a8a,null));};exports[_0x44b8('0x57')]=function(_0x45ff62,_0x343c5c){var _0x3cb290=_0x45ff62[_0x44b8('0x3c')]['teams'];var _0x2d27bf=_[_0x44b8('0x1b')](_0x3cb290,'id');return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x2d27bf},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id','name','online',_0x44b8('0x5a'),_0x44b8('0x5b')],'raw':!![]}]})['then'](function(_0x41f732){if(_0x41f732){var _0x16074e=_['flatMap'](_0x41f732,function(_0x1ec23e){var _0x3208b4=_0x1ec23e[_0x44b8('0x14')]({'plain':!![]});_0x3208b4[_0x44b8('0x59')][_0x44b8('0x5c')](function(_0x43f416){_0x43f416[_0x44b8('0x5d')]=_[_0x44b8('0x1e')](_0x3cb290,{'id':_0x3208b4['id']})[_0x44b8('0x5d')];});return _0x3208b4[_0x44b8('0x59')];});return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x45ff62[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x15365d){return db['sequelize'][_0x44b8('0x5e')](function(_0x3d92a9){return _0x15365d[_0x44b8('0x57')](_0x2d27bf,{'transaction':_0x3d92a9})[_0x44b8('0x13')](function(){return BPromise['each'](_0x3cb290,function(_0x611876){return db[_0x44b8('0x5f')]['upsert']({'TeamId':_0x611876['id'],'VoiceQueueId':_0x45ff62[_0x44b8('0x2f')]['id'],'penalty':_0x611876['penalty']},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise[_0x44b8('0x60')](_0x16074e,function(_0x5a508f){return db[_0x44b8('0x61')]['findOrCreate']({'where':{'UserId':_0x5a508f['id'],'VoiceQueueId':_0x45ff62['params']['id']},'defaults':{'penalty':_0x5a508f[_0x44b8('0x5d')]},'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){return BPromise['each'](_['filter'](_0x16074e,{'online':!![]}),function(_0x52af57){return db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x52af57[_0x44b8('0x21')],'UserId':_0x52af57['id'],'queue_name':_0x15365d['name'],'VoiceQueueId':_0x15365d['id'],'interface':_['isNil'](_0x52af57[_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x52af57[_0x44b8('0x21')]):_0x52af57[_0x44b8('0x5b')],'paused':_0x52af57[_0x44b8('0x5a')]||![],'penalty':_0x52af57[_0x44b8('0x5d')]},{'transaction':_0x3d92a9});});})[_0x44b8('0x13')](function(){_0x16074e[_0x44b8('0x5c')](function(_0x4ed62f){socket[_0x44b8('0x66')]('userVoiceQueue:save',{'UserId':_0x4ed62f['id'],'VoiceQueueId':_0x15365d['id']});});});});});}})[_0x44b8('0x13')](respondWithStatusCode(_0x343c5c,null))['catch'](handleError(_0x343c5c,null));};exports['removeTeams']=function(_0x1fb070,_0x224071){return db[_0x44b8('0x56')][_0x44b8('0x2b')]({'where':{'id':_0x1fb070[_0x44b8('0x32')][_0x44b8('0x67')]},'attributes':['id'],'include':[{'model':db[_0x44b8('0x58')],'as':_0x44b8('0x59'),'attributes':['id'],'raw':!![]}]})[_0x44b8('0x13')](handleEntityNotFound(_0x224071,null))['then'](function(_0x1eb0a8){var _0x1e3b5f=_[_0x44b8('0x1b')](_0x1eb0a8,'id');var _0x536d1d=[];var _0x5bc747=[];var _0x3e44ea=squel['select']();_0x3e44ea[_0x44b8('0x68')]('tq.TeamId')[_0x44b8('0x69')]('team_has_voice_queues','tq')['join'](_0x44b8('0x6a'),'ut',_0x44b8('0x6b'))['where'](_0x44b8('0x6c'),_0x1fb070[_0x44b8('0x2f')]['id']);for(var _0x276dfc=0x0;_0x276dfc<_0x1eb0a8[_0x44b8('0x37')];_0x276dfc+=0x1){let _0x291617=_0x1eb0a8[_0x276dfc];for(var _0x57b73f=0x0;_0x57b73f<_0x291617[_0x44b8('0x59')]['length'];_0x57b73f+=0x1){let _0x595af5=_0x291617['Agents'][_0x57b73f];var _0x3015f9=_0x3e44ea[_0x44b8('0x44')]();_0x3015f9['where'](_0x44b8('0x6d'),_0x595af5['id']);_0x5bc747[_0x44b8('0x6e')](db['sequelize']['query'](_0x3015f9[_0x44b8('0x6f')](),{'type':db[_0x44b8('0x70')]['QueryTypes'][_0x44b8('0x71')]})[_0x44b8('0x13')](function(_0x5e2d3b){if(_0x5e2d3b[_0x44b8('0x37')]===0x1){return _0x595af5['id'];}else{var _0x97f4=_['every'](_[_0x44b8('0x1b')](_0x5e2d3b,_0x44b8('0x72')),function(_0xdb42f2){return _['includes'](_0x1e3b5f,_0xdb42f2);});if(_0x97f4){return _0x595af5['id'];}}}));}}return BPromise[_0x44b8('0x73')](_0x5bc747)['then'](function(_0x2ea49d){_0x536d1d=_(_0x536d1d)['union'](_0x2ea49d)['compact']()[_0x44b8('0x1c')]();return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x1fb070[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(_0x1db2cf){return db[_0x44b8('0x70')][_0x44b8('0x5e')](function(_0x1b7826){return _0x1db2cf[_0x44b8('0x74')](_0x1fb070[_0x44b8('0x32')]['ids'],{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){if(!_[_0x44b8('0x75')](_0x536d1d)){return _0x1db2cf[_0x44b8('0x76')](_0x536d1d,{'transaction':_0x1b7826})[_0x44b8('0x13')](function(){return db[_0x44b8('0x62')][_0x44b8('0x12')]({'where':{'VoiceQueueId':_0x1fb070[_0x44b8('0x2f')]['id'],'UserId':_0x536d1d},'transaction':_0x1b7826});});}})[_0x44b8('0x13')](function(){_0x536d1d['forEach'](function(_0x4234bc){socket[_0x44b8('0x66')]('userVoiceQueue:remove',{'UserId':_0x4234bc,'VoiceQueueId':_0x1db2cf['id']});});});});});});})[_0x44b8('0x13')](respondWithStatusCode(_0x224071,null))[_0x44b8('0x2d')](handleError(_0x224071,null));};exports[_0x44b8('0x77')]=function(_0x5596c0,_0x4b2b8f){var _0x18cd30,_0x133da8;return db['VoiceQueue']['find']({'where':{'id':_0x5596c0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x4b2b8f,null))[_0x44b8('0x13')](function(_0x2bccf9){if(_0x2bccf9){_0x133da8=_0x2bccf9;return _0x2bccf9[_0x44b8('0x77')](_0x5596c0['body'][_0x44b8('0x67')],_['omit'](_0x5596c0[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{})[_0x44b8('0x78')](function(_0x156a60){for(var _0x3cbec9=0x0;_0x3cbec9<_0x5596c0[_0x44b8('0x3c')]['ids'][_0x44b8('0x37')];_0x3cbec9+=0x1){socket['emit'](_0x44b8('0x79'),{'UserId':Number(_0x5596c0[_0x44b8('0x3c')]['ids'][_0x3cbec9]),'VoiceQueueId':Number(_0x5596c0[_0x44b8('0x2f')]['id'])});}return _0x156a60;});}})['then'](function(_0x42b0c9){_0x18cd30=_0x42b0c9||[];if(_0x133da8){return db[_0x44b8('0x58')][_0x44b8('0x2b')]({'where':{'id':_0x5596c0['body'][_0x44b8('0x67')]},'attributes':['id',_0x44b8('0x21'),'online',_0x44b8('0x5a'),'interface'],'raw':!![]});}})['then'](function(_0x4220b5){if(!_['isEmpty'](_0x4220b5)){var _0x336436=[];for(var _0x51add5=0x0;_0x51add5<_0x4220b5[_0x44b8('0x37')];_0x51add5++){if(_0x4220b5[_0x51add5][_0x44b8('0x7a')]){_0x336436['push'](db[_0x44b8('0x62')][_0x44b8('0x63')]({'membername':_0x4220b5[_0x51add5]['name'],'UserId':_0x4220b5[_0x51add5]['id'],'queue_name':_0x133da8['name'],'VoiceQueueId':_0x133da8['id'],'interface':_[_0x44b8('0x7b')](_0x4220b5[_0x51add5][_0x44b8('0x5b')])?util[_0x44b8('0x64')](_0x44b8('0x65'),_0x4220b5[_0x51add5]['name']):_0x4220b5[_0x51add5][_0x44b8('0x5b')],'paused':_0x4220b5[_0x51add5][_0x44b8('0x5a')]||![],'penalty':_0x5596c0[_0x44b8('0x3c')][_0x44b8('0x5d')]||0x0}));}}return BPromise['all'](_0x336436);}})['then'](function(){return _0x18cd30;})[_0x44b8('0x13')](respondWithResult(_0x4b2b8f,null))[_0x44b8('0x2d')](handleError(_0x4b2b8f,null));};exports[_0x44b8('0x76')]=function(_0x4cf4a0,_0x1443bd){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4cf4a0[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x1443bd,null))[_0x44b8('0x13')](function(_0x2cb698){if(_0x2cb698){return _0x2cb698[_0x44b8('0x76')](_0x4cf4a0[_0x44b8('0x32')]['ids'])['then'](function(){if(_[_0x44b8('0x7c')](_0x4cf4a0['query'][_0x44b8('0x67')])){for(var _0x4dc333=0x0;_0x4dc333<_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x44b8('0x37')];_0x4dc333+=0x1){socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')][_0x4dc333]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}}else{socket[_0x44b8('0x66')](_0x44b8('0x7d'),{'UserId':Number(_0x4cf4a0[_0x44b8('0x32')][_0x44b8('0x67')]),'VoiceQueueId':Number(_0x4cf4a0[_0x44b8('0x2f')]['id'])});}});}})[_0x44b8('0x13')](function(_0x4026d7){return db[_0x44b8('0x62')]['destroy']({'where':{'VoiceQueueId':_0x4cf4a0[_0x44b8('0x2f')]['id'],'UserId':_0x4cf4a0['query'][_0x44b8('0x67')]}})[_0x44b8('0x13')](function(){return _0x4026d7;});})[_0x44b8('0x13')](respondWithStatusCode(_0x1443bd,null))[_0x44b8('0x2d')](handleError(_0x1443bd,null));};exports[_0x44b8('0x7e')]=function(_0x22e5ae,_0x2f3340){var _0x4d98de={};var _0x597139={};var _0x2fffd5;var _0x3c90c2;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x22e5ae[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x2f3340,null))[_0x44b8('0x13')](function(_0x208c53){if(_0x208c53){_0x2fffd5=_0x208c53;_0x597139[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x58')][_0x44b8('0x24')]);_0x597139['query']=_[_0x44b8('0x31')](_0x22e5ae[_0x44b8('0x32')]);_0x597139[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],_0x597139['query']);_0x4d98de['attributes']=_[_0x44b8('0x34')](_0x597139[_0x44b8('0x30')],qs['fields'](_0x22e5ae['query'][_0x44b8('0x36')]));_0x4d98de['attributes']=_0x4d98de[_0x44b8('0x35')][_0x44b8('0x37')]?_0x4d98de[_0x44b8('0x35')]:_0x597139[_0x44b8('0x30')];_0x4d98de[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x4d98de['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x22e5ae[_0x44b8('0x32')],_0x597139['filters']));if(_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]){_0x4d98de['where']=_['merge'](_0x4d98de['where'],{'$or':_['map'](_0x4d98de[_0x44b8('0x35')],function(_0x5e423c){var _0x48065d={};_0x48065d[_0x5e423c]={'$like':'%'+_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x48065d;})});}_0x4d98de=_[_0x44b8('0x39')]({},_0x4d98de,_0x22e5ae['options']);return _0x2fffd5[_0x44b8('0x7e')](_0x4d98de);}})['then'](function(_0x230407){if(_0x230407){_0x3c90c2=_0x230407[_0x44b8('0x37')];if(!_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x4a')]('nolimit')){_0x4d98de[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0x10')]);_0x4d98de['offset']=qs['offset'](_0x22e5ae[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0x2fffd5['getAgents'](_0x4d98de);}})[_0x44b8('0x13')](function(_0x188744){if(_0x188744){return _0x188744?{'count':_0x3c90c2,'rows':_0x188744}:null;}})[_0x44b8('0x13')](respondWithResult(_0x2f3340,null))[_0x44b8('0x2d')](handleError(_0x2f3340,null));};exports[_0x44b8('0x7f')]=function(_0x2da727,_0x319520){var _0x2f7550={};var _0x57d24f={};var _0x223e54;var _0x3e5fa8;return db[_0x44b8('0x29')]['findOne']({'where':{'id':_0x2da727[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x319520,null))[_0x44b8('0x13')](function(_0x5370a5){if(_0x5370a5){_0x223e54=_0x5370a5;_0x57d24f[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x62')][_0x44b8('0x24')]);_0x57d24f[_0x44b8('0x32')]=_[_0x44b8('0x31')](_0x2da727[_0x44b8('0x32')]);_0x57d24f[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x57d24f[_0x44b8('0x30')],_0x57d24f[_0x44b8('0x32')]);_0x2f7550[_0x44b8('0x35')]=_['intersection'](_0x57d24f[_0x44b8('0x30')],qs['fields'](_0x2da727[_0x44b8('0x32')]['fields']));_0x2f7550[_0x44b8('0x35')]=_0x2f7550[_0x44b8('0x35')][_0x44b8('0x37')]?_0x2f7550[_0x44b8('0x35')]:_0x57d24f[_0x44b8('0x30')];_0x2f7550[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x2da727['query'][_0x44b8('0x4d')]);_0x2f7550[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x2da727[_0x44b8('0x32')],_0x57d24f[_0x44b8('0x33')]));if(_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]){_0x2f7550[_0x44b8('0x28')]=_[_0x44b8('0x39')](_0x2f7550[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x2f7550[_0x44b8('0x35')],function(_0x4281a6){var _0x4bb399={};_0x4bb399[_0x4281a6]={'$like':'%'+_0x2da727[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x4bb399;})});}_0x2f7550=_['merge']({},_0x2f7550,_0x2da727[_0x44b8('0x3a')]);return _0x223e54[_0x44b8('0x7f')](_0x2f7550);}})[_0x44b8('0x13')](function(_0x1f389e){if(_0x1f389e){_0x3e5fa8=_0x1f389e[_0x44b8('0x37')];if(!_0x2da727['query'][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x2f7550[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x2da727['query'][_0x44b8('0x10')]);_0x2f7550[_0x44b8('0xf')]=qs['offset'](_0x2da727['query']['offset']);}return _0x223e54['getMembers'](_0x2f7550);}})[_0x44b8('0x13')](function(_0x5824a8){return _0x5824a8?{'count':_0x3e5fa8,'rows':_0x5824a8}:null;})['then'](respondWithResult(_0x319520,null))[_0x44b8('0x2d')](handleError(_0x319520,null));};exports[_0x44b8('0x80')]=function(_0x87a38,_0x54adf9){var _0x44dc3d={};var _0x32dafb={};var _0x3c8e0c;var _0x21ea61;return db['VoiceQueue'][_0x44b8('0x49')]({'where':{'id':_0x87a38['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x54adf9,null))[_0x44b8('0x13')](function(_0x56cfa5){if(_0x56cfa5){_0x3c8e0c=_0x56cfa5;_0x32dafb[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x32dafb[_0x44b8('0x32')]=_['keys'](_0x87a38['query']);_0x32dafb[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],_0x32dafb[_0x44b8('0x32')]);_0x44dc3d[_0x44b8('0x35')]=_[_0x44b8('0x34')](_0x32dafb[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x36')]));_0x44dc3d[_0x44b8('0x35')]=_0x44dc3d[_0x44b8('0x35')]['length']?_0x44dc3d['attributes']:_0x32dafb[_0x44b8('0x30')];_0x44dc3d['order']=qs[_0x44b8('0x4d')](_0x87a38[_0x44b8('0x32')][_0x44b8('0x4d')]);_0x44dc3d['where']=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x87a38[_0x44b8('0x32')],_0x32dafb[_0x44b8('0x33')]));if(_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]){_0x44dc3d['where']=_[_0x44b8('0x39')](_0x44dc3d[_0x44b8('0x28')],{'$or':_['map'](_0x44dc3d[_0x44b8('0x35')],function(_0x1ffa05){var _0x22edd7={};_0x22edd7[_0x1ffa05]={'$like':'%'+_0x87a38[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x22edd7;})});}_0x44dc3d=_['merge']({},_0x44dc3d,_0x87a38[_0x44b8('0x3a')]);return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})[_0x44b8('0x13')](function(_0x2fca1a){if(_0x2fca1a){_0x21ea61=_0x2fca1a[_0x44b8('0x37')];if(!_0x87a38[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x44dc3d[_0x44b8('0x10')]=qs[_0x44b8('0x10')](_0x87a38['query'][_0x44b8('0x10')]);_0x44dc3d[_0x44b8('0xf')]=qs[_0x44b8('0xf')](_0x87a38['query']['offset']);}return _0x3c8e0c[_0x44b8('0x80')](_0x44dc3d);}})['then'](function(_0x9458fb){if(_0x9458fb){return _0x9458fb?{'count':_0x21ea61,'rows':_0x9458fb}:null;}})[_0x44b8('0x13')](respondWithResult(_0x54adf9,null))[_0x44b8('0x2d')](handleError(_0x54adf9,null));};exports[_0x44b8('0x82')]=function(_0x2eb6ce,_0x105ca0){var _0x25f364=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x77c009,_0x161362;return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x2eb6ce[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x105ca0,null))['then'](function(_0x4d88a6){if(_0x4d88a6){_0x161362=_0x4d88a6;return _0x4d88a6[_0x44b8('0x82')](_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x67')],_[_0x44b8('0x45')](_0x2eb6ce[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x4b49df){var _0xbf96c1;_0x77c009=_0x4b49df||[];var _0x1f6244=[];if(_0x4b49df){for(var _0x96a3cd=0x0;_0x96a3cd<_0x4b49df['length'];_0x96a3cd+=0x1){var _0x16721d=_0x4b49df[_0x96a3cd][_0x44b8('0x14')]({'plain':!![]});_0x161362[_0x44b8('0x83')]=_0x2eb6ce[_0x44b8('0x3c')]['dialCheckDuplicateType']?_0x2eb6ce[_0x44b8('0x3c')][_0x44b8('0x83')]:_0x161362[_0x44b8('0x83')];switch(_0x161362['dialCheckDuplicateType']){case'always':_0xbf96c1=squel['insert']()['into']('cm_hopper')[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x85'),'phone')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))[_0x44b8('0x68')](_0x16721d['CmListId'][_0x44b8('0x6f')](),'ListId')[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),'VoiceQueueId')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))['where'](_0x44b8('0x8b'))['where'](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e'))['where'](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x90'))[_0x44b8('0x69')](_0x44b8('0x91'))['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]()))[_0x44b8('0x28')]('phone\x20NOT\x20IN\x20(?)',squel[_0x44b8('0x89')]()[_0x44b8('0x68')](_0x44b8('0x92'))[_0x44b8('0x69')](_0x44b8('0x93'))[_0x44b8('0x28')](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;case _0x44b8('0x94'):_0xbf96c1=squel[_0x44b8('0x95')]()['into'](_0x44b8('0x93'))[_0x44b8('0x84')]([_0x44b8('0x85'),_0x44b8('0x86'),'ContactId',_0x44b8('0x88'),'VoiceQueueId',_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field'](_0x44b8('0x85'),_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id','ContactId')[_0x44b8('0x68')](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')]('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')]['toString']())['where'](_0x44b8('0x8e'))[_0x44b8('0x28')](_0x44b8('0x8f'),squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x44b8('0x6c'),_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')]())))[_0x44b8('0x6f')]();break;default:_0xbf96c1=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper')[_0x44b8('0x84')](['phone',_0x44b8('0x86'),_0x44b8('0x87'),_0x44b8('0x88'),'VoiceQueueId','createdAt',_0x44b8('0x47')],squel[_0x44b8('0x89')]()['field']('phone',_0x44b8('0x85'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x86'))[_0x44b8('0x68')]('id',_0x44b8('0x87'))['field'](_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0x2eb6ce[_0x44b8('0x2f')]['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))['field']('\x27'+_0x25f364+'\x27',_0x44b8('0x46'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x16721d[_0x44b8('0x8d')][_0x44b8('0x6f')]())['where'](_0x44b8('0x8e')))[_0x44b8('0x6f')]();}_0x1f6244[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0xbf96c1));}return BPromise['all'](_0x1f6244);}})[_0x44b8('0x13')](function(){var _0x2ad4ab=[];var _0x196b4b=squel[_0x44b8('0x95')]()[_0x44b8('0x96')]('cm_hopper_additional_phones')[_0x44b8('0x84')]([_0x44b8('0x97'),_0x44b8('0x85'),_0x44b8('0x98'),_0x44b8('0x46'),_0x44b8('0x47')],squel['select']()[_0x44b8('0x68')](_0x44b8('0x99'))[_0x44b8('0x68')](_0x44b8('0x9a'))[_0x44b8('0x68')](_0x44b8('0x9b'))[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27','createdAt')[_0x44b8('0x68')]('\x27'+_0x25f364+'\x27',_0x44b8('0x47'))[_0x44b8('0x69')](_0x44b8('0x9c'),'ci')['join'](_0x44b8('0x93'),'h','h.ContactId=ci.CmContactId')[_0x44b8('0x28')](_0x44b8('0x9d'),_0x25f364)[_0x44b8('0x28')](_0x44b8('0x9e'),'PHONE'))[_0x44b8('0x6f')]();_0x2ad4ab[_0x44b8('0x6e')](db[_0x44b8('0x70')]['query'](_0x196b4b));return BPromise[_0x44b8('0x73')](_0x2ad4ab);})[_0x44b8('0x13')](function(){return _0x77c009;})[_0x44b8('0x13')](respondWithResult(_0x105ca0,null))[_0x44b8('0x2d')](handleError(_0x105ca0,null));};exports[_0x44b8('0x9f')]=function(_0x257702,_0x17560c){return db[_0x44b8('0x29')][_0x44b8('0x1e')]({'where':{'id':_0x257702[_0x44b8('0x2f')]['id']}})['then'](handleEntityNotFound(_0x17560c,null))[_0x44b8('0x13')](function(_0x4d11d5){if(_0x4d11d5){return _0x4d11d5[_0x44b8('0x9f')](_0x257702[_0x44b8('0x32')][_0x44b8('0x67')]);}})[_0x44b8('0x13')](function(_0xafca17){if(_0xafca17){return db['CmHopper']['destroy']({'where':{'ListId':_0x257702['query'][_0x44b8('0x67')],'VoiceQueueId':_0x257702[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](function(){return _0xafca17;});}})[_0x44b8('0x13')](respondWithStatusCode(_0x17560c,null))[_0x44b8('0x2d')](handleError(_0x17560c,null));};exports[_0x44b8('0xa0')]=function(_0x513302,_0xfdb408){var _0x119dda={};var _0x5834fe={};var _0xe5cc1e;var _0x4c55e6;return db[_0x44b8('0x29')][_0x44b8('0x49')]({'where':{'id':_0x513302['params']['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0xfdb408,null))[_0x44b8('0x13')](function(_0x537eab){if(_0x537eab){_0xe5cc1e=_0x537eab;_0x5834fe[_0x44b8('0x30')]=_[_0x44b8('0x31')](db[_0x44b8('0x81')][_0x44b8('0x24')]);_0x5834fe['query']=_[_0x44b8('0x31')](_0x513302[_0x44b8('0x32')]);_0x5834fe[_0x44b8('0x33')]=_[_0x44b8('0x34')](_0x5834fe[_0x44b8('0x30')],_0x5834fe[_0x44b8('0x32')]);_0x119dda[_0x44b8('0x35')]=_['intersection'](_0x5834fe[_0x44b8('0x30')],qs[_0x44b8('0x36')](_0x513302[_0x44b8('0x32')]['fields']));_0x119dda[_0x44b8('0x35')]=_0x119dda[_0x44b8('0x35')]['length']?_0x119dda[_0x44b8('0x35')]:_0x5834fe[_0x44b8('0x30')];_0x119dda[_0x44b8('0x4c')]=qs[_0x44b8('0x4d')](_0x513302['query'][_0x44b8('0x4d')]);_0x119dda[_0x44b8('0x28')]=qs[_0x44b8('0x33')](_[_0x44b8('0x51')](_0x513302[_0x44b8('0x32')],_0x5834fe['filters']));if(_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]){_0x119dda['where']=_[_0x44b8('0x39')](_0x119dda[_0x44b8('0x28')],{'$or':_[_0x44b8('0x1b')](_0x119dda[_0x44b8('0x35')],function(_0x4e9376){var _0x25f31c={};_0x25f31c[_0x4e9376]={'$like':'%'+_0x513302[_0x44b8('0x32')][_0x44b8('0x19')]+'%'};return _0x25f31c;})});}_0x119dda=_[_0x44b8('0x39')]({},_0x119dda,_0x513302[_0x44b8('0x3a')]);return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x57e3c9){if(_0x57e3c9){_0x4c55e6=_0x57e3c9[_0x44b8('0x37')];if(!_0x513302[_0x44b8('0x32')][_0x44b8('0x4a')](_0x44b8('0x4b'))){_0x119dda['limit']=qs[_0x44b8('0x10')](_0x513302[_0x44b8('0x32')][_0x44b8('0x10')]);_0x119dda['offset']=qs['offset'](_0x513302[_0x44b8('0x32')][_0x44b8('0xf')]);}return _0xe5cc1e[_0x44b8('0xa0')](_0x119dda);}})[_0x44b8('0x13')](function(_0x4a5916){if(_0x4a5916){return _0x4a5916?{'count':_0x4c55e6,'rows':_0x4a5916}:null;}})[_0x44b8('0x13')](respondWithResult(_0xfdb408,null))[_0x44b8('0x2d')](handleError(_0xfdb408,null));};exports['addBlackLists']=function(_0xd19a35,_0x2439f2){var _0x22a624;return db['VoiceQueue'][_0x44b8('0x1e')]({'where':{'id':_0xd19a35[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x2439f2,null))[_0x44b8('0x13')](function(_0x14c021){if(_0x14c021){return _0x14c021['addBlackLists'](_0xd19a35[_0x44b8('0x3c')][_0x44b8('0x67')],_['omit'](_0xd19a35[_0x44b8('0x3c')],[_0x44b8('0x67'),'id'])||{});}return null;})[_0x44b8('0x78')](function(_0x3b9cd2){var _0xb6cadf;_0x22a624=_0x3b9cd2||[];var _0x2024eb=[];if(_0x3b9cd2){for(var _0x29af58=0x0;_0x29af58<_0x3b9cd2[_0x44b8('0x37')];_0x29af58+=0x1){var _0x3870a9=_0x3b9cd2[_0x29af58]['get']({'plain':!![]});_0xb6cadf=squel['insert']()['into']('cm_hopper_black')[_0x44b8('0x84')]([_0x44b8('0x85'),'ContactId',_0x44b8('0x88'),_0x44b8('0x4e'),_0x44b8('0x46'),_0x44b8('0x47')],squel[_0x44b8('0x89')]()[_0x44b8('0x68')]('phone',_0x44b8('0x85'))['field']('id','ContactId')[_0x44b8('0x68')](_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')](),_0x44b8('0x88'))[_0x44b8('0x68')](_0xd19a35['params']['id'][_0x44b8('0x6f')](),_0x44b8('0x4e'))[_0x44b8('0x68')](_0x44b8('0xa1'),_0x44b8('0x46'))[_0x44b8('0x68')](_0x44b8('0xa1'),'updatedAt')[_0x44b8('0x69')](_0x44b8('0x8a'))[_0x44b8('0x28')]('deletedAt\x20IS\x20NULL')[_0x44b8('0x28')](_0x44b8('0x8c'),_0x3870a9[_0x44b8('0x8d')][_0x44b8('0x6f')]())[_0x44b8('0x28')](_0x44b8('0x8e')))[_0x44b8('0x6f')]();_0x2024eb[_0x44b8('0x6e')](db['sequelize'][_0x44b8('0x32')](_0xb6cadf));}return BPromise[_0x44b8('0x73')](_0x2024eb);}})[_0x44b8('0x13')](function(){return _0x22a624;})[_0x44b8('0x13')](respondWithResult(_0x2439f2,null))[_0x44b8('0x2d')](handleError(_0x2439f2,null));};exports[_0x44b8('0xa2')]=function(_0x4ec799,_0x3fa943){return db[_0x44b8('0x29')]['find']({'where':{'id':_0x4ec799[_0x44b8('0x2f')]['id']}})[_0x44b8('0x13')](handleEntityNotFound(_0x3fa943,null))[_0x44b8('0x13')](function(_0x3b1643){if(_0x3b1643){return _0x3b1643['removeBlackLists'](_0x4ec799[_0x44b8('0x32')]['ids']);}})['then'](function(_0x9a5734){if(_0x9a5734){return db[_0x44b8('0x54')][_0x44b8('0x12')]({'where':{'ListId':_0x4ec799[_0x44b8('0x32')][_0x44b8('0x67')],'VoiceQueueId':_0x4ec799['params']['id']}})['then'](function(){return _0x9a5734;});}})['then'](respondWithStatusCode(_0x3fa943,null))[_0x44b8('0x2d')](handleError(_0x3fa943,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 749744a..67cac8c 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 _0x3a73=['emit','hook','exports','events','../../mysqldb','save','update','remove'];(function(_0x4d35f3,_0x19ba66){var _0x382fea=function(_0x2c2390){while(--_0x2c2390){_0x4d35f3['push'](_0x4d35f3['shift']());}};_0x382fea(++_0x19ba66);}(_0x3a73,0x14b));var _0x33a7=function(_0x1a2db5,_0x785212){_0x1a2db5=_0x1a2db5-0x0;var _0xf6401b=_0x3a73[_0x1a2db5];return _0xf6401b;};'use strict';var EventEmitter=require(_0x33a7('0x0'));var VoiceQueue=require(_0x33a7('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x33a7('0x2'),'afterUpdate':_0x33a7('0x3'),'afterDestroy':_0x33a7('0x4')};function emitEvent(_0x14b377){return function(_0x297382,_0x1a5779,_0x2b3667){VoiceQueueEvents[_0x33a7('0x5')](_0x14b377+':'+_0x297382['id'],_0x297382);VoiceQueueEvents['emit'](_0x14b377,_0x297382);_0x2b3667(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x33a7('0x6')](e,emitEvent(event));}}module[_0x33a7('0x7')]=VoiceQueueEvents; \ No newline at end of file +var _0xd2ef=['remove','exports','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x494d1f,_0x3f72ff){var _0x457b6e=function(_0x38cb16){while(--_0x38cb16){_0x494d1f['push'](_0x494d1f['shift']());}};_0x457b6e(++_0x3f72ff);}(_0xd2ef,0x1dc));var _0xfd2e=function(_0x16259b,_0x2e0bd8){_0x16259b=_0x16259b-0x0;var _0xfd3bd7=_0xd2ef[_0x16259b];return _0xfd3bd7;};'use strict';var EventEmitter=require(_0xfd2e('0x0'));var VoiceQueue=require(_0xfd2e('0x1'))['db'][_0xfd2e('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xfd2e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xfd2e('0x4')};function emitEvent(_0xc5a30e){return function(_0x4f9ef7,_0x5bae59,_0x373efa){VoiceQueueEvents['emit'](_0xc5a30e+':'+_0x4f9ef7['id'],_0x4f9ef7);VoiceQueueEvents['emit'](_0xc5a30e,_0x4f9ef7);_0x373efa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue['hook'](e,emitEvent(event));}}module[_0xfd2e('0x5')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 376f880..0de22cb 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(_0x4cd2aa,_0x19a600){var _0x2c2c7e=function(_0x4ebfc5){while(--_0x4ebfc5){_0x4cd2aa['push'](_0x4cd2aa['shift']());}};_0x2c2c7e(++_0x19a600);}(_0x70e0,0x17b));var _0x070e=function(_0x1fd376,_0x235dc9){_0x1fd376=_0x1fd376-0x0;var _0x42d812=_0x70e0[_0x1fd376];return _0x42d812;};'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 _0x34e8=['voice_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports','VoiceQueue'];(function(_0x5bd6b0,_0x52b637){var _0x13612b=function(_0x168040){while(--_0x168040){_0x5bd6b0['push'](_0x5bd6b0['shift']());}};_0x13612b(++_0x52b637);}(_0x34e8,0x12c));var _0x834e=function(_0x2b94d4,_0x13cc06){_0x2b94d4=_0x2b94d4-0x0;var _0x11ffbd=_0x34e8[_0x2b94d4];return _0x11ffbd;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('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 aa1d54e..52396f3 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 _0x0147=['message','result','VoiceQueue,\x20%s,\x20%s','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','include','model','map','debug','ShowVoiceQueue','find','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','then','info','request\x20sent','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5589c0,_0x260e57){var _0x1c9c03=function(_0x50e5a8){while(--_0x50e5a8){_0x5589c0['push'](_0x5589c0['shift']());}};_0x1c9c03(++_0x260e57);}(_0x0147,0x122));var _0x7014=function(_0x464292,_0x55ea64){_0x464292=_0x464292-0x0;var _0x4ff804=_0x0147[_0x464292];return _0x4ff804;};'use strict';var _=require(_0x7014('0x0'));var util=require('util');var moment=require(_0x7014('0x1'));var BPromise=require(_0x7014('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7014('0x3'))['db'];var utils=require(_0x7014('0x4'));var logger=require(_0x7014('0x5'))(_0x7014('0x6'));var config=require(_0x7014('0x7'));var jayson=require(_0x7014('0x8'));var client=jayson[_0x7014('0x9')][_0x7014('0xa')]({'port':0x232a});config[_0x7014('0xb')]=_[_0x7014('0xc')](config['redis'],{'host':_0x7014('0xd'),'port':0x18eb});var socket=require(_0x7014('0xe'))(new Redis(config[_0x7014('0xb')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x709ab,_0x334fac,_0x95ec82){return new BPromise(function(_0x2ae7cd,_0x3d08bc){return client['request'](_0x709ab,_0x95ec82)[_0x7014('0xf')](function(_0xfd39ae){logger[_0x7014('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x334fac,_0x7014('0x11'));logger['debug'](_0x7014('0x12'),_0x334fac,_0x7014('0x11'),JSON[_0x7014('0x13')](_0xfd39ae));if(_0xfd39ae['error']){if(_0xfd39ae[_0x7014('0x14')][_0x7014('0x15')]===0x1f4){logger[_0x7014('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x334fac,_0xfd39ae[_0x7014('0x14')]['message']);return _0x3d08bc(_0xfd39ae[_0x7014('0x14')][_0x7014('0x16')]);}logger[_0x7014('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x334fac,_0xfd39ae[_0x7014('0x14')][_0x7014('0x16')]);return _0x2ae7cd(_0xfd39ae[_0x7014('0x14')][_0x7014('0x16')]);}else{logger[_0x7014('0x10')]('VoiceQueue,\x20%s,\x20%s',_0x334fac,_0x7014('0x11'));_0x2ae7cd(_0xfd39ae[_0x7014('0x17')][_0x7014('0x16')]);}})['catch'](function(_0x459143){logger[_0x7014('0x14')](_0x7014('0x18'),_0x334fac,_0x459143);_0x3d08bc(_0x459143);});});}exports[_0x7014('0x19')]=function(_0x108565){var _0x2525a8=this;return new Promise(function(_0x5bf2fa,_0xef09b6){return db[_0x7014('0x1a')][_0x7014('0x1b')]({'raw':_0x108565['options']?_0x108565[_0x7014('0x1c')][_0x7014('0x1d')]===undefined?!![]:![]:!![],'where':_0x108565[_0x7014('0x1c')]?_0x108565[_0x7014('0x1c')][_0x7014('0x1e')]||null:null,'attributes':_0x108565[_0x7014('0x1c')]?_0x108565[_0x7014('0x1c')][_0x7014('0x1f')]||null:null,'limit':_0x108565[_0x7014('0x1c')]?_0x108565[_0x7014('0x1c')][_0x7014('0x20')]||null:null,'include':_0x108565[_0x7014('0x1c')]?_0x108565[_0x7014('0x1c')][_0x7014('0x21')]?_['map'](_0x108565[_0x7014('0x1c')]['include'],function(_0x4c8ac9){return{'model':db[_0x4c8ac9[_0x7014('0x22')]],'as':_0x4c8ac9['as'],'attributes':_0x4c8ac9[_0x7014('0x1f')],'include':_0x4c8ac9[_0x7014('0x21')]?_[_0x7014('0x23')](_0x4c8ac9[_0x7014('0x21')],function(_0x408532){return{'model':db[_0x408532[_0x7014('0x22')]],'as':_0x408532['as'],'attributes':_0x408532[_0x7014('0x1f')],'include':_0x408532[_0x7014('0x21')]?_[_0x7014('0x23')](_0x408532[_0x7014('0x21')],function(_0x3a027e){return{'model':db[_0x3a027e['model']],'as':_0x3a027e['as'],'attributes':_0x3a027e['attributes']};}):[]};}):[]};}):[]:[]})[_0x7014('0xf')](function(_0x352ad3){logger[_0x7014('0x10')](_0x7014('0x19'),_0x108565);logger[_0x7014('0x24')](_0x7014('0x19'),_0x108565,JSON[_0x7014('0x13')](_0x352ad3));_0x5bf2fa(_0x352ad3);})['catch'](function(_0x5daf8a){logger[_0x7014('0x14')]('GetVoiceQueue',_0x5daf8a[_0x7014('0x16')],_0x108565);_0xef09b6(_0x2525a8[_0x7014('0x14')](0x1f4,_0x5daf8a[_0x7014('0x16')]));});});};exports[_0x7014('0x25')]=function(_0x14df02){var _0x3957ff=this;return new Promise(function(_0x409376,_0x51356f){return db[_0x7014('0x1a')][_0x7014('0x26')]({'raw':_0x14df02[_0x7014('0x1c')]?_0x14df02[_0x7014('0x1c')][_0x7014('0x1d')]===undefined?!![]:![]:!![],'where':_0x14df02[_0x7014('0x1c')]?_0x14df02[_0x7014('0x1c')][_0x7014('0x1e')]||null:null,'attributes':_0x14df02[_0x7014('0x1c')]?_0x14df02[_0x7014('0x1c')][_0x7014('0x1f')]||null:null,'include':_0x14df02[_0x7014('0x1c')]?_0x14df02[_0x7014('0x1c')][_0x7014('0x21')]?_['map'](_0x14df02[_0x7014('0x1c')][_0x7014('0x21')],function(_0x107152){return{'model':db[_0x107152[_0x7014('0x22')]],'as':_0x107152['as'],'attributes':_0x107152['attributes'],'include':_0x107152[_0x7014('0x21')]?_[_0x7014('0x23')](_0x107152[_0x7014('0x21')],function(_0xc25fd0){return{'model':db[_0xc25fd0[_0x7014('0x22')]],'as':_0xc25fd0['as'],'attributes':_0xc25fd0['attributes'],'include':_0xc25fd0['include']?_[_0x7014('0x23')](_0xc25fd0[_0x7014('0x21')],function(_0x14c16e){return{'model':db[_0x14c16e[_0x7014('0x22')]],'as':_0x14c16e['as'],'attributes':_0x14c16e['attributes']};}):[]};}):[]};}):[]:[]})[_0x7014('0xf')](function(_0x592995){logger[_0x7014('0x10')](_0x7014('0x25'),_0x14df02);logger[_0x7014('0x24')](_0x7014('0x25'),_0x14df02,JSON['stringify'](_0x592995));_0x409376(_0x592995);})['catch'](function(_0x512f0f){logger[_0x7014('0x14')](_0x7014('0x25'),_0x512f0f[_0x7014('0x16')],_0x14df02);_0x51356f(_0x3957ff['error'](0x1f4,_0x512f0f[_0x7014('0x16')]));});});}; \ No newline at end of file +var _0x0c4d=['lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','request','then','info','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','limit','include','map','model','attributes','debug','find','where','ShowVoiceQueue'];(function(_0x3137e9,_0x4a3265){var _0x16c571=function(_0x39bfec){while(--_0x39bfec){_0x3137e9['push'](_0x3137e9['shift']());}};_0x16c571(++_0x4a3265);}(_0x0c4d,0x1c8));var _0xd0c4=function(_0x174ad9,_0x57134b){_0x174ad9=_0x174ad9-0x0;var _0x3243e7=_0x0c4d[_0x174ad9];return _0x3243e7;};'use strict';var _=require(_0xd0c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd0c4('0x1'));var rs=require(_0xd0c4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0c4('0x3'))['db'];var utils=require(_0xd0c4('0x4'));var logger=require('../../config/logger')(_0xd0c4('0x5'));var config=require(_0xd0c4('0x6'));var jayson=require(_0xd0c4('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xd0c4('0x8')]=_[_0xd0c4('0x9')](config['redis'],{'host':_0xd0c4('0xa'),'port':0x18eb});var socket=require(_0xd0c4('0xb'))(new Redis(config[_0xd0c4('0x8')]));require(_0xd0c4('0xc'))['register'](socket);function respondWithRpcPromise(_0x4fdde4,_0x16910b,_0x1fbf49){return new BPromise(function(_0x4b6527,_0x2d591a){return client[_0xd0c4('0xd')](_0x4fdde4,_0x1fbf49)[_0xd0c4('0xe')](function(_0x369c25){logger[_0xd0c4('0xf')](_0xd0c4('0x10'),_0x16910b,'request\x20sent');logger['debug'](_0xd0c4('0x11'),_0x16910b,_0xd0c4('0x12'),JSON[_0xd0c4('0x13')](_0x369c25));if(_0x369c25['error']){if(_0x369c25[_0xd0c4('0x14')]['code']===0x1f4){logger['error']('VoiceQueue,\x20%s,\x20%s',_0x16910b,_0x369c25['error'][_0xd0c4('0x15')]);return _0x2d591a(_0x369c25[_0xd0c4('0x14')][_0xd0c4('0x15')]);}logger['error'](_0xd0c4('0x10'),_0x16910b,_0x369c25[_0xd0c4('0x14')][_0xd0c4('0x15')]);return _0x4b6527(_0x369c25['error'][_0xd0c4('0x15')]);}else{logger['info'](_0xd0c4('0x10'),_0x16910b,_0xd0c4('0x12'));_0x4b6527(_0x369c25[_0xd0c4('0x16')][_0xd0c4('0x15')]);}})[_0xd0c4('0x17')](function(_0x5d111c){logger[_0xd0c4('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x16910b,_0x5d111c);_0x2d591a(_0x5d111c);});});}exports[_0xd0c4('0x18')]=function(_0x372d4c){var _0x4e2517=this;return new Promise(function(_0x2c5a0d,_0x4d4896){return db[_0xd0c4('0x19')][_0xd0c4('0x1a')]({'raw':_0x372d4c[_0xd0c4('0x1b')]?_0x372d4c['options'][_0xd0c4('0x1c')]===undefined?!![]:![]:!![],'where':_0x372d4c['options']?_0x372d4c['options']['where']||null:null,'attributes':_0x372d4c[_0xd0c4('0x1b')]?_0x372d4c[_0xd0c4('0x1b')]['attributes']||null:null,'limit':_0x372d4c[_0xd0c4('0x1b')]?_0x372d4c[_0xd0c4('0x1b')][_0xd0c4('0x1d')]||null:null,'include':_0x372d4c[_0xd0c4('0x1b')]?_0x372d4c[_0xd0c4('0x1b')][_0xd0c4('0x1e')]?_[_0xd0c4('0x1f')](_0x372d4c['options'][_0xd0c4('0x1e')],function(_0x5a9914){return{'model':db[_0x5a9914[_0xd0c4('0x20')]],'as':_0x5a9914['as'],'attributes':_0x5a9914[_0xd0c4('0x21')],'include':_0x5a9914['include']?_[_0xd0c4('0x1f')](_0x5a9914[_0xd0c4('0x1e')],function(_0x27fbfa){return{'model':db[_0x27fbfa['model']],'as':_0x27fbfa['as'],'attributes':_0x27fbfa[_0xd0c4('0x21')],'include':_0x27fbfa[_0xd0c4('0x1e')]?_[_0xd0c4('0x1f')](_0x27fbfa[_0xd0c4('0x1e')],function(_0x1828b3){return{'model':db[_0x1828b3[_0xd0c4('0x20')]],'as':_0x1828b3['as'],'attributes':_0x1828b3[_0xd0c4('0x21')]};}):[]};}):[]};}):[]:[]})[_0xd0c4('0xe')](function(_0x20ac3b){logger[_0xd0c4('0xf')](_0xd0c4('0x18'),_0x372d4c);logger[_0xd0c4('0x22')](_0xd0c4('0x18'),_0x372d4c,JSON[_0xd0c4('0x13')](_0x20ac3b));_0x2c5a0d(_0x20ac3b);})[_0xd0c4('0x17')](function(_0x577fd8){logger[_0xd0c4('0x14')](_0xd0c4('0x18'),_0x577fd8['message'],_0x372d4c);_0x4d4896(_0x4e2517[_0xd0c4('0x14')](0x1f4,_0x577fd8[_0xd0c4('0x15')]));});});};exports['ShowVoiceQueue']=function(_0x5203ef){var _0x383057=this;return new Promise(function(_0x301f16,_0x18fd47){return db[_0xd0c4('0x19')][_0xd0c4('0x23')]({'raw':_0x5203ef['options']?_0x5203ef[_0xd0c4('0x1b')][_0xd0c4('0x1c')]===undefined?!![]:![]:!![],'where':_0x5203ef[_0xd0c4('0x1b')]?_0x5203ef[_0xd0c4('0x1b')][_0xd0c4('0x24')]||null:null,'attributes':_0x5203ef[_0xd0c4('0x1b')]?_0x5203ef[_0xd0c4('0x1b')][_0xd0c4('0x21')]||null:null,'include':_0x5203ef['options']?_0x5203ef[_0xd0c4('0x1b')][_0xd0c4('0x1e')]?_['map'](_0x5203ef[_0xd0c4('0x1b')][_0xd0c4('0x1e')],function(_0x2a7651){return{'model':db[_0x2a7651[_0xd0c4('0x20')]],'as':_0x2a7651['as'],'attributes':_0x2a7651[_0xd0c4('0x21')],'include':_0x2a7651[_0xd0c4('0x1e')]?_[_0xd0c4('0x1f')](_0x2a7651[_0xd0c4('0x1e')],function(_0x55f7b4){return{'model':db[_0x55f7b4[_0xd0c4('0x20')]],'as':_0x55f7b4['as'],'attributes':_0x55f7b4[_0xd0c4('0x21')],'include':_0x55f7b4[_0xd0c4('0x1e')]?_[_0xd0c4('0x1f')](_0x55f7b4[_0xd0c4('0x1e')],function(_0x92671a){return{'model':db[_0x92671a[_0xd0c4('0x20')]],'as':_0x92671a['as'],'attributes':_0x92671a[_0xd0c4('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3dfde3){logger[_0xd0c4('0xf')](_0xd0c4('0x25'),_0x5203ef);logger['debug']('ShowVoiceQueue',_0x5203ef,JSON[_0xd0c4('0x13')](_0x3dfde3));_0x301f16(_0x3dfde3);})['catch'](function(_0x516c6a){logger['error'](_0xd0c4('0x25'),_0x516c6a[_0xd0c4('0x15')],_0x5203ef);_0x18fd47(_0x383057[_0xd0c4('0x14')](0x1f4,_0x516c6a[_0xd0c4('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index cb1c7a4..8e59533 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 _0x9a6f=['removeListener','register','voiceQueue:','./voiceQueue.events','save','update'];(function(_0x8ba19a,_0x1d2b2b){var _0x2bd8b4=function(_0xee823f){while(--_0xee823f){_0x8ba19a['push'](_0x8ba19a['shift']());}};_0x2bd8b4(++_0x1d2b2b);}(_0x9a6f,0x1e3));var _0xf9a6=function(_0x1d1fdf,_0x33ba5a){_0x1d1fdf=_0x1d1fdf-0x0;var _0x3521d6=_0x9a6f[_0x1d1fdf];return _0x3521d6;};'use strict';var VoiceQueueEvents=require(_0xf9a6('0x0'));var events=[_0xf9a6('0x1'),'remove',_0xf9a6('0x2')];function createListener(_0x412fe4,_0x51d3d9){return function(_0x42463b){_0x51d3d9['emit'](_0x412fe4,_0x42463b);};}function removeListener(_0x5d9947,_0x46a5a5){return function(){VoiceQueueEvents[_0xf9a6('0x3')](_0x5d9947,_0x46a5a5);};}exports[_0xf9a6('0x4')]=function(_0x32e6d5){for(var _0x57b06d=0x0,_0x1003e3=events['length'];_0x57b06d<_0x1003e3;_0x57b06d++){var _0x25168e=events[_0x57b06d];var _0x5785e1=createListener(_0xf9a6('0x5')+_0x25168e,_0x32e6d5);VoiceQueueEvents['on'](_0x25168e,_0x5785e1);}}; \ No newline at end of file +var _0xde84=['length','voiceQueue:','./voiceQueue.events','save','update','emit','register'];(function(_0x1c33dc,_0x177c7e){var _0x405580=function(_0x556105){while(--_0x556105){_0x1c33dc['push'](_0x1c33dc['shift']());}};_0x405580(++_0x177c7e);}(_0xde84,0x121));var _0x4de8=function(_0x54fa04,_0x497107){_0x54fa04=_0x54fa04-0x0;var _0x1b2949=_0xde84[_0x54fa04];return _0x1b2949;};'use strict';var VoiceQueueEvents=require(_0x4de8('0x0'));var events=[_0x4de8('0x1'),'remove',_0x4de8('0x2')];function createListener(_0xafa6a4,_0x4781b1){return function(_0x49f2fd){_0x4781b1[_0x4de8('0x3')](_0xafa6a4,_0x49f2fd);};}function removeListener(_0x3fad63,_0x18f0e6){return function(){VoiceQueueEvents['removeListener'](_0x3fad63,_0x18f0e6);};}exports[_0x4de8('0x4')]=function(_0x382fbe){for(var _0x381ca1=0x0,_0x2fada1=events[_0x4de8('0x5')];_0x381ca1<_0x2fada1;_0x381ca1++){var _0x590389=events[_0x381ca1];var _0x5b7a09=createListener(_0x4de8('0x6')+_0x590389,_0x382fbe);VoiceQueueEvents['on'](_0x590389,_0x5b7a09);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 314efcd..603a284 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 _0xd27b=['/index','getVoiceQueuesReport','/:id','show','post','put','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2020ea,_0x26fc4f){var _0x3657fe=function(_0x4cc17f){while(--_0x4cc17f){_0x2020ea['push'](_0x2020ea['shift']());}};_0x3657fe(++_0x26fc4f);}(_0xd27b,0x134));var _0xbd27=function(_0x190e94,_0x117fc1){_0x190e94=_0x190e94-0x0;var _0x3012a0=_0xd27b[_0x190e94];return _0x3012a0;};'use strict';var multer=require(_0xbd27('0x0'));var util=require('util');var path=require(_0xbd27('0x1'));var timeout=require(_0xbd27('0x2'));var express=require('express');var router=express[_0xbd27('0x3')]();var fs_extra=require(_0xbd27('0x4'));var auth=require(_0xbd27('0x5'));var interaction=require(_0xbd27('0x6'));var config=require(_0xbd27('0x7'));var controller=require(_0xbd27('0x8'));router[_0xbd27('0x9')]('/',auth[_0xbd27('0xa')](),controller[_0xbd27('0xb')]);router[_0xbd27('0x9')](_0xbd27('0xc'),auth['isAuthenticated'](),controller[_0xbd27('0xd')]);router[_0xbd27('0x9')](_0xbd27('0xe'),auth['isAuthenticated'](),controller[_0xbd27('0xf')]);router[_0xbd27('0x9')](_0xbd27('0x10'),auth[_0xbd27('0xa')](),controller[_0xbd27('0x11')]);router[_0xbd27('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbd27('0x13')](_0xbd27('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xbd27('0x14')](_0xbd27('0x10'),auth[_0xbd27('0xa')](),controller[_0xbd27('0x15')]);module[_0xbd27('0x16')]=router; \ No newline at end of file +var _0x1947=['./voiceQueueReport.controller','get','isAuthenticated','/describe','describe','/index','getVoiceQueuesReport','/:id','show','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x429b97,_0x19e26d){var _0x2f93fc=function(_0x5bfaa7){while(--_0x5bfaa7){_0x429b97['push'](_0x429b97['shift']());}};_0x2f93fc(++_0x19e26d);}(_0x1947,0x71));var _0x7194=function(_0x569b47,_0x43bf7a){_0x569b47=_0x569b47-0x0;var _0xa1bb99=_0x1947[_0x569b47];return _0xa1bb99;};'use strict';var multer=require('multer');var util=require(_0x7194('0x0'));var path=require(_0x7194('0x1'));var timeout=require('connect-timeout');var express=require(_0x7194('0x2'));var router=express[_0x7194('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7194('0x4'));var interaction=require(_0x7194('0x5'));var config=require(_0x7194('0x6'));var controller=require(_0x7194('0x7'));router[_0x7194('0x8')]('/',auth[_0x7194('0x9')](),controller['index']);router['get'](_0x7194('0xa'),auth[_0x7194('0x9')](),controller[_0x7194('0xb')]);router[_0x7194('0x8')](_0x7194('0xc'),auth[_0x7194('0x9')](),controller[_0x7194('0xd')]);router[_0x7194('0x8')](_0x7194('0xe'),auth['isAuthenticated'](),controller[_0x7194('0xf')]);router['post']('/',auth[_0x7194('0x9')](),controller['create']);router['put']('/:id',auth[_0x7194('0x9')](),controller[_0x7194('0x10')]);router[_0x7194('0x11')](_0x7194('0xe'),auth[_0x7194('0x9')](),controller[_0x7194('0x12')]);module[_0x7194('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index a37f671..0dc20f2 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 _0x4672=['queuecallerjoinAt','diff','queuecallerleaveAt','setDataValue','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','getDataValue'];(function(_0x3504ee,_0x5bd0a5){var _0x31236f=function(_0x5a5905){while(--_0x5a5905){_0x3504ee['push'](_0x3504ee['shift']());}};_0x31236f(++_0x5bd0a5);}(_0x4672,0xac));var _0x2467=function(_0x2fbe5f,_0x4c5c13){_0x2fbe5f=_0x2fbe5f-0x0;var _0x21db60=_0x4672[_0x2fbe5f];return _0x21db60;};'use strict';var Sequelize=require(_0x2467('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x2467('0x1')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x2467('0x1')]},'queue':{'type':Sequelize[_0x2467('0x1')]},'queuecallerjoinAt':{'type':Sequelize[_0x2467('0x2')]},'queuecallerleaveAt':{'type':Sequelize[_0x2467('0x2')],'set':function(_0x56dbb8){var _0xed3fee=moment(_0x56dbb8);var _0x1634c=moment(this[_0x2467('0x3')](_0x2467('0x4')))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x492ee0=_0xed3fee[_0x2467('0x5')](_0x1634c,'seconds');this['setDataValue'](_0x2467('0x6'),_0x56dbb8);this[_0x2467('0x7')]('holdtime',_0x492ee0||null);}},'position':{'type':Sequelize[_0x2467('0x8')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x2467('0x9')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2467('0x2')]},'queuecallercomplete':{'type':Sequelize[_0x2467('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x2467('0x2')]},'queuecallerexit':{'type':Sequelize[_0x2467('0x9')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2467('0x2')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x2467('0x8')]},'channel':{'type':Sequelize[_0x2467('0x1')]},'connectedlinenum':{'type':Sequelize[_0x2467('0x1')]},'connectedlinename':{'type':Sequelize[_0x2467('0x1')]},'accountcode':{'type':Sequelize[_0x2467('0x1')]},'context':{'type':Sequelize[_0x2467('0x1')]},'exten':{'type':Sequelize[_0x2467('0x1')]},'priority':{'type':Sequelize[_0x2467('0x1')]},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0x2467('0x8')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2467('0x1')]},'transfer':{'type':Sequelize[_0x2467('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2467('0x1')],'comment':_0x2467('0xa')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x2467('0x1')]},'disposition':{'type':Sequelize[_0x2467('0x1')]},'secondDisposition':{'type':Sequelize[_0x2467('0x1')]},'thirdDisposition':{'type':Sequelize['STRING']},'queuecallerenterreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'note':{'type':Sequelize[_0x2467('0x1')]}}; \ No newline at end of file +var _0x0120=['exports','STRING','DATE','getDataValue','format','diff','seconds','setDataValue','holdtime','INTEGER','BOOLEAN','moment'];(function(_0x4443dd,_0x3bc1ff){var _0x3e9a3e=function(_0x2d1a03){while(--_0x2d1a03){_0x4443dd['push'](_0x4443dd['shift']());}};_0x3e9a3e(++_0x3bc1ff);}(_0x0120,0x107));var _0x0012=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x0120[_0x311c35];return _0x5cc50c;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x0012('0x0'));module[_0x0012('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x0012('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x0012('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x0012('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0x0012('0x3')],'set':function(_0x1cfab1){var _0x369481=moment(_0x1cfab1);var _0x434723=moment(this[_0x0012('0x4')]('queuecallerjoinAt'))[_0x0012('0x5')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2203c6=_0x369481[_0x0012('0x6')](_0x434723,_0x0012('0x7'));this[_0x0012('0x8')]('queuecallerleaveAt',_0x1cfab1);this[_0x0012('0x8')](_0x0012('0x9'),_0x2203c6||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0x0012('0xa')]},'queuecallerabandon':{'type':Sequelize[_0x0012('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x0012('0x3')]},'queuecallercomplete':{'type':Sequelize[_0x0012('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x0012('0x3')]},'queuecallerexit':{'type':Sequelize[_0x0012('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x0012('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x0012('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize[_0x0012('0xa')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0012('0x2')]},'exten':{'type':Sequelize[_0x0012('0x2')]},'priority':{'type':Sequelize[_0x0012('0x2')]},'holdtime':{'type':Sequelize[_0x0012('0xa')]},'mohtime':{'type':Sequelize[_0x0012('0xa')],'defaultValue':0x0},'assigned':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x0012('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x0012('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x0012('0x2')]},'transferuniqueid':{'type':Sequelize[_0x0012('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x0012('0x2')]},'thirdDisposition':{'type':Sequelize[_0x0012('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x0012('0xa')],'defaultValue':0x0},'note':{'type':Sequelize[_0x0012('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 248bec2..53739bc 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 _0xd0c9=['send','index','map','VoiceQueueReport','rawAttributes','fieldName','type','query','keys','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','create','body','destroy','find','describe','getVoiceQueuesReport','length','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','end','sendStatus','error','stack','name'];(function(_0x5f162d,_0x4b0768){var _0x6a7375=function(_0x440ee1){while(--_0x440ee1){_0x5f162d['push'](_0x5f162d['shift']());}};_0x6a7375(++_0x4b0768);}(_0xd0c9,0xcc));var _0x9d0c=function(_0x344a3f,_0x579a22){_0x344a3f=_0x344a3f-0x0;var _0x264712=_0xd0c9[_0x344a3f];return _0x264712;};'use strict';var emlformat=require(_0x9d0c('0x0'));var rimraf=require(_0x9d0c('0x1'));var zipdir=require(_0x9d0c('0x2'));var jsonpatch=require(_0x9d0c('0x3'));var rp=require('request-promise');var moment=require(_0x9d0c('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9d0c('0x5'));var util=require(_0x9d0c('0x6'));var path=require('path');var sox=require(_0x9d0c('0x7'));var csv=require(_0x9d0c('0x8'));var ejs=require(_0x9d0c('0x9'));var fs=require('fs');var fs_extra=require(_0x9d0c('0xa'));var _=require(_0x9d0c('0xb'));var squel=require(_0x9d0c('0xc'));var crypto=require('crypto');var jsforce=require(_0x9d0c('0xd'));var deskjs=require(_0x9d0c('0xe'));var toCsv=require(_0x9d0c('0x8'));var querystring=require(_0x9d0c('0xf'));var Papa=require(_0x9d0c('0x10'));var Redis=require('ioredis');var authService=require(_0x9d0c('0x11'));var qs=require(_0x9d0c('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9d0c('0x13'));var logger=require('../../config/logger')(_0x9d0c('0x14'));var utils=require(_0x9d0c('0x15'));var config=require(_0x9d0c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x9d0c('0x17'))['db'];config[_0x9d0c('0x18')]=_['defaults'](config[_0x9d0c('0x18')],{'host':_0x9d0c('0x19'),'port':0x18eb});var socket=require(_0x9d0c('0x1a'))(new Redis(config[_0x9d0c('0x18')]));require(_0x9d0c('0x1b'))['register'](socket);function respondWithStatusCode(_0x4b255e,_0x13edc4){_0x13edc4=_0x13edc4||0xcc;return function(_0x325e9f){if(_0x325e9f){return _0x4b255e['sendStatus'](_0x13edc4);}return _0x4b255e['status'](_0x13edc4)['end']();};}function respondWithResult(_0x5729f9,_0x335e3c){_0x335e3c=_0x335e3c||0xc8;return function(_0x11eff9){if(_0x11eff9){return _0x5729f9[_0x9d0c('0x1c')](_0x335e3c)[_0x9d0c('0x1d')](_0x11eff9);}};}function respondWithFilteredResult(_0x1aaeaa,_0x5a4ba6){return function(_0x65b227){if(_0x65b227){var _0x58cd80=typeof _0x5a4ba6[_0x9d0c('0x1e')]===_0x9d0c('0x1f')&&typeof _0x5a4ba6['limit']===_0x9d0c('0x1f');var _0x4d3a18=_0x65b227[_0x9d0c('0x20')];var _0x22e119=_0x58cd80?0x0:_0x5a4ba6[_0x9d0c('0x1e')];var _0x2f307b=_0x58cd80?_0x65b227[_0x9d0c('0x20')]:_0x5a4ba6[_0x9d0c('0x1e')]+_0x5a4ba6[_0x9d0c('0x21')];var _0x4350ba;if(_0x2f307b>=_0x4d3a18){_0x2f307b=_0x4d3a18;_0x4350ba=0xc8;}else{_0x4350ba=0xce;}_0x1aaeaa[_0x9d0c('0x1c')](_0x4350ba);return _0x1aaeaa[_0x9d0c('0x22')]('Content-Range',_0x22e119+'-'+_0x2f307b+'/'+_0x4d3a18)['json'](_0x65b227);}return null;};}function patchUpdates(_0x1a717e){return function(_0x171d09){try{jsonpatch[_0x9d0c('0x23')](_0x171d09,_0x1a717e,!![]);}catch(_0x194f2f){return BPromise[_0x9d0c('0x24')](_0x194f2f);}return _0x171d09[_0x9d0c('0x25')]();};}function saveUpdates(_0x599293,_0x38818e){return function(_0x5640c2){if(_0x5640c2){return _0x5640c2[_0x9d0c('0x26')](_0x599293)[_0x9d0c('0x27')](function(_0x592e7b){return _0x592e7b;});}return null;};}function removeEntity(_0x451ed0,_0x13bfaf){return function(_0x509215){if(_0x509215){return _0x509215['destroy']()[_0x9d0c('0x27')](function(){_0x451ed0[_0x9d0c('0x1c')](0xcc)[_0x9d0c('0x28')]();});}};}function handleEntityNotFound(_0x1b39f3,_0x213fc3){return function(_0x4a403c){if(!_0x4a403c){_0x1b39f3[_0x9d0c('0x29')](0x194);}return _0x4a403c;};}function handleError(_0x514664,_0x1948a8){_0x1948a8=_0x1948a8||0x1f4;return function(_0x290f93){logger[_0x9d0c('0x2a')](_0x290f93[_0x9d0c('0x2b')]);if(_0x290f93[_0x9d0c('0x2c')]){delete _0x290f93['name'];}_0x514664['status'](_0x1948a8)[_0x9d0c('0x2d')](_0x290f93);};}exports[_0x9d0c('0x2e')]=function(_0x5aad2e,_0x3bb336){var _0xb0dc23={},_0x2eac85={},_0x396790={'count':0x0,'rows':[]};var _0x585480=_[_0x9d0c('0x2f')](db[_0x9d0c('0x30')][_0x9d0c('0x31')],function(_0x24bb2d){return{'name':_0x24bb2d[_0x9d0c('0x32')],'type':_0x24bb2d[_0x9d0c('0x33')]['key']};});_0x2eac85['model']=_['map'](_0x585480,'name');_0x2eac85[_0x9d0c('0x34')]=_[_0x9d0c('0x35')](_0x5aad2e[_0x9d0c('0x34')]);_0x2eac85['filters']=_[_0x9d0c('0x36')](_0x2eac85[_0x9d0c('0x37')],_0x2eac85[_0x9d0c('0x34')]);_0xb0dc23[_0x9d0c('0x38')]=_[_0x9d0c('0x36')](_0x2eac85[_0x9d0c('0x37')],qs['fields'](_0x5aad2e[_0x9d0c('0x34')][_0x9d0c('0x39')]));_0xb0dc23['attributes']=_0xb0dc23['attributes']['length']?_0xb0dc23['attributes']:_0x2eac85[_0x9d0c('0x37')];if(!_0x5aad2e[_0x9d0c('0x34')][_0x9d0c('0x3a')](_0x9d0c('0x3b'))){_0xb0dc23['limit']=qs[_0x9d0c('0x21')](_0x5aad2e[_0x9d0c('0x34')]['limit']);_0xb0dc23[_0x9d0c('0x1e')]=qs[_0x9d0c('0x1e')](_0x5aad2e[_0x9d0c('0x34')][_0x9d0c('0x1e')]);}_0xb0dc23[_0x9d0c('0x3c')]=qs[_0x9d0c('0x3d')](_0x5aad2e[_0x9d0c('0x34')][_0x9d0c('0x3d')]);_0xb0dc23['where']=qs[_0x9d0c('0x3e')](_[_0x9d0c('0x3f')](_0x5aad2e[_0x9d0c('0x34')],_0x2eac85[_0x9d0c('0x3e')]),_0x585480);if(_0x5aad2e[_0x9d0c('0x34')][_0x9d0c('0x40')]){_0xb0dc23['where']=_[_0x9d0c('0x41')](_0xb0dc23[_0x9d0c('0x42')],{'$or':_[_0x9d0c('0x2f')](_0x585480,function(_0x22ed9f){if(_0x22ed9f[_0x9d0c('0x33')]!==_0x9d0c('0x43')){var _0x4aa0bb={};_0x4aa0bb[_0x22ed9f['name']]={'$like':'%'+_0x5aad2e['query'][_0x9d0c('0x40')]+'%'};return _0x4aa0bb;}})});}_0xb0dc23=_[_0x9d0c('0x41')]({},_0xb0dc23,_0x5aad2e[_0x9d0c('0x44')]);var _0x1c2d08={'where':_0xb0dc23[_0x9d0c('0x42')]};return db[_0x9d0c('0x30')][_0x9d0c('0x20')](_0x1c2d08)[_0x9d0c('0x27')](function(_0x2ee621){_0x396790[_0x9d0c('0x20')]=_0x2ee621;if(_0x5aad2e['query']['includeAll']){_0xb0dc23['include']=[{'all':!![]}];}return db['VoiceQueueReport'][_0x9d0c('0x45')](_0xb0dc23);})[_0x9d0c('0x27')](function(_0x2f2e91){_0x396790[_0x9d0c('0x46')]=_0x2f2e91;return _0x396790;})[_0x9d0c('0x27')](respondWithFilteredResult(_0x3bb336,_0xb0dc23))[_0x9d0c('0x47')](handleError(_0x3bb336,null));};exports[_0x9d0c('0x48')]=function(_0x382258,_0x96739d){var _0x4da2eb={'raw':![],'where':{'id':_0x382258[_0x9d0c('0x49')]['id']}},_0x2015a1={};_0x2015a1[_0x9d0c('0x37')]=_[_0x9d0c('0x35')](db[_0x9d0c('0x30')]['rawAttributes']);_0x2015a1[_0x9d0c('0x34')]=_[_0x9d0c('0x35')](_0x382258[_0x9d0c('0x34')]);_0x2015a1['filters']=_[_0x9d0c('0x36')](_0x2015a1['model'],_0x2015a1[_0x9d0c('0x34')]);_0x4da2eb[_0x9d0c('0x38')]=_[_0x9d0c('0x36')](_0x2015a1[_0x9d0c('0x37')],qs['fields'](_0x382258[_0x9d0c('0x34')]['fields']));_0x4da2eb[_0x9d0c('0x38')]=_0x4da2eb[_0x9d0c('0x38')]['length']?_0x4da2eb[_0x9d0c('0x38')]:_0x2015a1[_0x9d0c('0x37')];if(_0x382258[_0x9d0c('0x34')][_0x9d0c('0x4a')]){_0x4da2eb[_0x9d0c('0x4b')]=[{'all':!![]}];}_0x4da2eb=_[_0x9d0c('0x41')]({},_0x4da2eb,_0x382258[_0x9d0c('0x44')]);return db[_0x9d0c('0x30')]['find'](_0x4da2eb)[_0x9d0c('0x27')](handleEntityNotFound(_0x96739d,null))[_0x9d0c('0x27')](respondWithResult(_0x96739d,null))['catch'](handleError(_0x96739d,null));};exports[_0x9d0c('0x4c')]=function(_0x3393f0,_0x201b00){return db[_0x9d0c('0x30')]['create'](_0x3393f0[_0x9d0c('0x4d')],{})[_0x9d0c('0x27')](respondWithResult(_0x201b00,0xc9))['catch'](handleError(_0x201b00,null));};exports[_0x9d0c('0x26')]=function(_0x8de36b,_0x1a1cf4){if(_0x8de36b[_0x9d0c('0x4d')]['id']){delete _0x8de36b['body']['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x8de36b[_0x9d0c('0x49')]['id']}})[_0x9d0c('0x27')](handleEntityNotFound(_0x1a1cf4,null))[_0x9d0c('0x27')](saveUpdates(_0x8de36b[_0x9d0c('0x4d')],null))[_0x9d0c('0x27')](respondWithResult(_0x1a1cf4,null))[_0x9d0c('0x47')](handleError(_0x1a1cf4,null));};exports[_0x9d0c('0x4e')]=function(_0x52922f,_0x2b68aa){return db['VoiceQueueReport'][_0x9d0c('0x4f')]({'where':{'id':_0x52922f[_0x9d0c('0x49')]['id']}})[_0x9d0c('0x27')](handleEntityNotFound(_0x2b68aa,null))[_0x9d0c('0x27')](removeEntity(_0x2b68aa,null))[_0x9d0c('0x47')](handleError(_0x2b68aa,null));};exports[_0x9d0c('0x50')]=function(_0x404108,_0x316987){return db[_0x9d0c('0x30')][_0x9d0c('0x50')]()['then'](respondWithResult(_0x316987,null))['catch'](handleError(_0x316987,null));};exports[_0x9d0c('0x51')]=function(_0x1dac3c,_0x1c2a5e){var _0x50049a={},_0x330658={},_0x55c20c={'count':0x0,'rows':[]};_0x330658[_0x9d0c('0x37')]=_[_0x9d0c('0x35')](db[_0x9d0c('0x30')]['rawAttributes']);_0x330658['query']=_[_0x9d0c('0x35')](_0x1dac3c['query']);_0x330658[_0x9d0c('0x3e')]=_[_0x9d0c('0x36')](_0x330658[_0x9d0c('0x37')],_0x330658[_0x9d0c('0x34')]);_0x50049a['attributes']=_[_0x9d0c('0x36')](_0x330658['model'],qs['fields'](_0x1dac3c[_0x9d0c('0x34')][_0x9d0c('0x39')]));_0x50049a['attributes']=_0x50049a[_0x9d0c('0x38')][_0x9d0c('0x52')]?_0x50049a[_0x9d0c('0x38')]:_0x330658[_0x9d0c('0x37')];if(!_0x1dac3c[_0x9d0c('0x34')][_0x9d0c('0x3a')](_0x9d0c('0x3b'))){_0x50049a[_0x9d0c('0x21')]=qs[_0x9d0c('0x21')](_0x1dac3c['query'][_0x9d0c('0x21')]);_0x50049a[_0x9d0c('0x1e')]=qs[_0x9d0c('0x1e')](_0x1dac3c[_0x9d0c('0x34')][_0x9d0c('0x1e')]);}_0x50049a[_0x9d0c('0x3c')]=qs[_0x9d0c('0x3d')](_0x1dac3c[_0x9d0c('0x34')]['sort']);_0x50049a[_0x9d0c('0x42')]=qs[_0x9d0c('0x3e')](_['pick'](_0x1dac3c['query'],_0x330658[_0x9d0c('0x3e')]));if(_0x1dac3c[_0x9d0c('0x34')][_0x9d0c('0x40')]){_0x50049a[_0x9d0c('0x42')]=_['merge'](_0x50049a['where'],{'$or':_[_0x9d0c('0x2f')](_0x50049a['attributes'],function(_0xfa9959){var _0x35da9d={};_0x35da9d[_0xfa9959]={'$like':'%'+_0x1dac3c[_0x9d0c('0x34')]['filter']+'%'};return _0x35da9d;})});}_0x50049a=_[_0x9d0c('0x41')]({},_0x50049a,_0x1dac3c['options']);var _0x5547dd={'where':_0x50049a[_0x9d0c('0x42')]};return db[_0x9d0c('0x30')][_0x9d0c('0x20')](_0x5547dd)[_0x9d0c('0x27')](function(_0x515794){_0x55c20c['count']=_0x515794;if(_0x1dac3c[_0x9d0c('0x34')][_0x9d0c('0x4a')]){_0x50049a[_0x9d0c('0x4b')]=[{'all':!![]}];}return db[_0x9d0c('0x30')][_0x9d0c('0x45')](_0x50049a);})[_0x9d0c('0x27')](function(_0x326768){_0x55c20c['rows']=_0x326768;return _0x55c20c;})[_0x9d0c('0x27')](respondWithFilteredResult(_0x1c2a5e,_0x50049a,_0x9d0c('0x51')))[_0x9d0c('0x47')](handleError(_0x1c2a5e,null,_0x9d0c('0x51')));}; \ No newline at end of file +var _0x90d6=['squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','update','then','destroy','sendStatus','stack','name','send','index','map','VoiceQueueReport','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','includeAll','find','create','body','describe','getVoiceQueuesReport','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash'];(function(_0x1f28bb,_0x2754bf){var _0xda63c3=function(_0x484cf3){while(--_0x484cf3){_0x1f28bb['push'](_0x1f28bb['shift']());}};_0xda63c3(++_0x2754bf);}(_0x90d6,0x1e4));var _0x690d=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x90d6[_0x22f8ab];return _0x2a70e5;};'use strict';var emlformat=require(_0x690d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x690d('0x1'));var jsonpatch=require(_0x690d('0x2'));var rp=require(_0x690d('0x3'));var moment=require(_0x690d('0x4'));var BPromise=require(_0x690d('0x5'));var Mustache=require(_0x690d('0x6'));var util=require(_0x690d('0x7'));var path=require(_0x690d('0x8'));var sox=require(_0x690d('0x9'));var csv=require(_0x690d('0xa'));var ejs=require(_0x690d('0xb'));var fs=require('fs');var fs_extra=require(_0x690d('0xc'));var _=require(_0x690d('0xd'));var squel=require(_0x690d('0xe'));var crypto=require(_0x690d('0xf'));var jsforce=require('jsforce');var deskjs=require(_0x690d('0x10'));var toCsv=require(_0x690d('0xa'));var querystring=require(_0x690d('0x11'));var Papa=require(_0x690d('0x12'));var Redis=require('ioredis');var authService=require(_0x690d('0x13'));var qs=require(_0x690d('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x690d('0x15'));var logger=require('../../config/logger')(_0x690d('0x16'));var utils=require(_0x690d('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x690d('0x18')]=_['defaults'](config['redis'],{'host':_0x690d('0x19'),'port':0x18eb});var socket=require(_0x690d('0x1a'))(new Redis(config['redis']));require(_0x690d('0x1b'))[_0x690d('0x1c')](socket);function respondWithStatusCode(_0x55c894,_0x1ffa97){_0x1ffa97=_0x1ffa97||0xcc;return function(_0x1cf967){if(_0x1cf967){return _0x55c894['sendStatus'](_0x1ffa97);}return _0x55c894[_0x690d('0x1d')](_0x1ffa97)[_0x690d('0x1e')]();};}function respondWithResult(_0x4c1e89,_0x4c6491){_0x4c6491=_0x4c6491||0xc8;return function(_0xe729a8){if(_0xe729a8){return _0x4c1e89[_0x690d('0x1d')](_0x4c6491)[_0x690d('0x1f')](_0xe729a8);}};}function respondWithFilteredResult(_0x3a9d2b,_0x51e57e){return function(_0x373e9f){if(_0x373e9f){var _0xe248f8=typeof _0x51e57e['offset']===_0x690d('0x20')&&typeof _0x51e57e['limit']===_0x690d('0x20');var _0xfa6e6d=_0x373e9f[_0x690d('0x21')];var _0x192ee8=_0xe248f8?0x0:_0x51e57e[_0x690d('0x22')];var _0x3a75e8=_0xe248f8?_0x373e9f[_0x690d('0x21')]:_0x51e57e[_0x690d('0x22')]+_0x51e57e[_0x690d('0x23')];var _0x206cd4;if(_0x3a75e8>=_0xfa6e6d){_0x3a75e8=_0xfa6e6d;_0x206cd4=0xc8;}else{_0x206cd4=0xce;}_0x3a9d2b[_0x690d('0x1d')](_0x206cd4);return _0x3a9d2b[_0x690d('0x24')](_0x690d('0x25'),_0x192ee8+'-'+_0x3a75e8+'/'+_0xfa6e6d)[_0x690d('0x1f')](_0x373e9f);}return null;};}function patchUpdates(_0x5d3a27){return function(_0x44a339){try{jsonpatch[_0x690d('0x26')](_0x44a339,_0x5d3a27,!![]);}catch(_0x446cd1){return BPromise['reject'](_0x446cd1);}return _0x44a339['save']();};}function saveUpdates(_0x1c2d14,_0x88c97d){return function(_0x8a244b){if(_0x8a244b){return _0x8a244b[_0x690d('0x27')](_0x1c2d14)[_0x690d('0x28')](function(_0x2d42c3){return _0x2d42c3;});}return null;};}function removeEntity(_0x1f2b11,_0x54a7c5){return function(_0x394a9a){if(_0x394a9a){return _0x394a9a[_0x690d('0x29')]()[_0x690d('0x28')](function(){_0x1f2b11[_0x690d('0x1d')](0xcc)[_0x690d('0x1e')]();});}};}function handleEntityNotFound(_0x146f75,_0x417c8c){return function(_0x465737){if(!_0x465737){_0x146f75[_0x690d('0x2a')](0x194);}return _0x465737;};}function handleError(_0x58e500,_0x918c44){_0x918c44=_0x918c44||0x1f4;return function(_0x5a0cbf){logger['error'](_0x5a0cbf[_0x690d('0x2b')]);if(_0x5a0cbf[_0x690d('0x2c')]){delete _0x5a0cbf[_0x690d('0x2c')];}_0x58e500[_0x690d('0x1d')](_0x918c44)[_0x690d('0x2d')](_0x5a0cbf);};}exports[_0x690d('0x2e')]=function(_0x2278d0,_0x299688){var _0x3dd7d9={},_0x4ca982={},_0x295ab7={'count':0x0,'rows':[]};var _0x48987d=_[_0x690d('0x2f')](db[_0x690d('0x30')][_0x690d('0x31')],function(_0xd636b0){return{'name':_0xd636b0[_0x690d('0x32')],'type':_0xd636b0['type'][_0x690d('0x33')]};});_0x4ca982['model']=_[_0x690d('0x2f')](_0x48987d,_0x690d('0x2c'));_0x4ca982[_0x690d('0x34')]=_[_0x690d('0x35')](_0x2278d0[_0x690d('0x34')]);_0x4ca982[_0x690d('0x36')]=_[_0x690d('0x37')](_0x4ca982[_0x690d('0x38')],_0x4ca982['query']);_0x3dd7d9[_0x690d('0x39')]=_[_0x690d('0x37')](_0x4ca982['model'],qs[_0x690d('0x3a')](_0x2278d0[_0x690d('0x34')][_0x690d('0x3a')]));_0x3dd7d9[_0x690d('0x39')]=_0x3dd7d9[_0x690d('0x39')][_0x690d('0x3b')]?_0x3dd7d9[_0x690d('0x39')]:_0x4ca982['model'];if(!_0x2278d0[_0x690d('0x34')][_0x690d('0x3c')](_0x690d('0x3d'))){_0x3dd7d9['limit']=qs[_0x690d('0x23')](_0x2278d0['query'][_0x690d('0x23')]);_0x3dd7d9[_0x690d('0x22')]=qs[_0x690d('0x22')](_0x2278d0[_0x690d('0x34')][_0x690d('0x22')]);}_0x3dd7d9[_0x690d('0x3e')]=qs['sort'](_0x2278d0[_0x690d('0x34')][_0x690d('0x3f')]);_0x3dd7d9[_0x690d('0x40')]=qs[_0x690d('0x36')](_[_0x690d('0x41')](_0x2278d0['query'],_0x4ca982['filters']),_0x48987d);if(_0x2278d0['query'][_0x690d('0x42')]){_0x3dd7d9[_0x690d('0x40')]=_['merge'](_0x3dd7d9[_0x690d('0x40')],{'$or':_[_0x690d('0x2f')](_0x48987d,function(_0x146091){if(_0x146091[_0x690d('0x43')]!==_0x690d('0x44')){var _0xe9de8e={};_0xe9de8e[_0x146091[_0x690d('0x2c')]]={'$like':'%'+_0x2278d0[_0x690d('0x34')][_0x690d('0x42')]+'%'};return _0xe9de8e;}})});}_0x3dd7d9=_[_0x690d('0x45')]({},_0x3dd7d9,_0x2278d0[_0x690d('0x46')]);var _0x4a1e67={'where':_0x3dd7d9[_0x690d('0x40')]};return db[_0x690d('0x30')][_0x690d('0x21')](_0x4a1e67)[_0x690d('0x28')](function(_0xd290ac){_0x295ab7[_0x690d('0x21')]=_0xd290ac;if(_0x2278d0[_0x690d('0x34')]['includeAll']){_0x3dd7d9[_0x690d('0x47')]=[{'all':!![]}];}return db[_0x690d('0x30')][_0x690d('0x48')](_0x3dd7d9);})['then'](function(_0x110e2b){_0x295ab7[_0x690d('0x49')]=_0x110e2b;return _0x295ab7;})['then'](respondWithFilteredResult(_0x299688,_0x3dd7d9))[_0x690d('0x4a')](handleError(_0x299688,null));};exports[_0x690d('0x4b')]=function(_0x2d1858,_0x4f5421){var _0x2f23ec={'raw':![],'where':{'id':_0x2d1858[_0x690d('0x4c')]['id']}},_0x4bccfc={};_0x4bccfc[_0x690d('0x38')]=_['keys'](db['VoiceQueueReport'][_0x690d('0x31')]);_0x4bccfc[_0x690d('0x34')]=_[_0x690d('0x35')](_0x2d1858[_0x690d('0x34')]);_0x4bccfc[_0x690d('0x36')]=_['intersection'](_0x4bccfc[_0x690d('0x38')],_0x4bccfc[_0x690d('0x34')]);_0x2f23ec[_0x690d('0x39')]=_[_0x690d('0x37')](_0x4bccfc[_0x690d('0x38')],qs[_0x690d('0x3a')](_0x2d1858[_0x690d('0x34')][_0x690d('0x3a')]));_0x2f23ec['attributes']=_0x2f23ec[_0x690d('0x39')][_0x690d('0x3b')]?_0x2f23ec[_0x690d('0x39')]:_0x4bccfc[_0x690d('0x38')];if(_0x2d1858[_0x690d('0x34')][_0x690d('0x4d')]){_0x2f23ec[_0x690d('0x47')]=[{'all':!![]}];}_0x2f23ec=_[_0x690d('0x45')]({},_0x2f23ec,_0x2d1858[_0x690d('0x46')]);return db['VoiceQueueReport'][_0x690d('0x4e')](_0x2f23ec)['then'](handleEntityNotFound(_0x4f5421,null))[_0x690d('0x28')](respondWithResult(_0x4f5421,null))['catch'](handleError(_0x4f5421,null));};exports['create']=function(_0x35633c,_0xb61d7b){return db[_0x690d('0x30')][_0x690d('0x4f')](_0x35633c[_0x690d('0x50')],{})[_0x690d('0x28')](respondWithResult(_0xb61d7b,0xc9))[_0x690d('0x4a')](handleError(_0xb61d7b,null));};exports[_0x690d('0x27')]=function(_0x4ea41e,_0x39c54f){if(_0x4ea41e[_0x690d('0x50')]['id']){delete _0x4ea41e[_0x690d('0x50')]['id'];}return db[_0x690d('0x30')]['find']({'where':{'id':_0x4ea41e[_0x690d('0x4c')]['id']}})[_0x690d('0x28')](handleEntityNotFound(_0x39c54f,null))[_0x690d('0x28')](saveUpdates(_0x4ea41e[_0x690d('0x50')],null))['then'](respondWithResult(_0x39c54f,null))[_0x690d('0x4a')](handleError(_0x39c54f,null));};exports[_0x690d('0x29')]=function(_0x5c0b07,_0x393682){return db['VoiceQueueReport']['find']({'where':{'id':_0x5c0b07[_0x690d('0x4c')]['id']}})[_0x690d('0x28')](handleEntityNotFound(_0x393682,null))[_0x690d('0x28')](removeEntity(_0x393682,null))[_0x690d('0x4a')](handleError(_0x393682,null));};exports[_0x690d('0x51')]=function(_0x4c702b,_0x25b29c){return db[_0x690d('0x30')][_0x690d('0x51')]()[_0x690d('0x28')](respondWithResult(_0x25b29c,null))['catch'](handleError(_0x25b29c,null));};exports[_0x690d('0x52')]=function(_0x4616d1,_0x30d680){var _0xa67dc2={},_0x214b8c={},_0x38288d={'count':0x0,'rows':[]};_0x214b8c[_0x690d('0x38')]=_[_0x690d('0x35')](db[_0x690d('0x30')][_0x690d('0x31')]);_0x214b8c['query']=_[_0x690d('0x35')](_0x4616d1[_0x690d('0x34')]);_0x214b8c[_0x690d('0x36')]=_[_0x690d('0x37')](_0x214b8c[_0x690d('0x38')],_0x214b8c[_0x690d('0x34')]);_0xa67dc2[_0x690d('0x39')]=_[_0x690d('0x37')](_0x214b8c[_0x690d('0x38')],qs[_0x690d('0x3a')](_0x4616d1[_0x690d('0x34')][_0x690d('0x3a')]));_0xa67dc2[_0x690d('0x39')]=_0xa67dc2[_0x690d('0x39')]['length']?_0xa67dc2[_0x690d('0x39')]:_0x214b8c[_0x690d('0x38')];if(!_0x4616d1[_0x690d('0x34')][_0x690d('0x3c')](_0x690d('0x3d'))){_0xa67dc2[_0x690d('0x23')]=qs['limit'](_0x4616d1[_0x690d('0x34')][_0x690d('0x23')]);_0xa67dc2[_0x690d('0x22')]=qs[_0x690d('0x22')](_0x4616d1[_0x690d('0x34')]['offset']);}_0xa67dc2[_0x690d('0x3e')]=qs['sort'](_0x4616d1[_0x690d('0x34')][_0x690d('0x3f')]);_0xa67dc2['where']=qs[_0x690d('0x36')](_[_0x690d('0x41')](_0x4616d1[_0x690d('0x34')],_0x214b8c[_0x690d('0x36')]));if(_0x4616d1['query'][_0x690d('0x42')]){_0xa67dc2[_0x690d('0x40')]=_[_0x690d('0x45')](_0xa67dc2[_0x690d('0x40')],{'$or':_[_0x690d('0x2f')](_0xa67dc2[_0x690d('0x39')],function(_0x20a99f){var _0x4d3bfe={};_0x4d3bfe[_0x20a99f]={'$like':'%'+_0x4616d1[_0x690d('0x34')]['filter']+'%'};return _0x4d3bfe;})});}_0xa67dc2=_[_0x690d('0x45')]({},_0xa67dc2,_0x4616d1['options']);var _0xf94d96={'where':_0xa67dc2[_0x690d('0x40')]};return db[_0x690d('0x30')][_0x690d('0x21')](_0xf94d96)[_0x690d('0x28')](function(_0x4a7f91){_0x38288d[_0x690d('0x21')]=_0x4a7f91;if(_0x4616d1[_0x690d('0x34')][_0x690d('0x4d')]){_0xa67dc2[_0x690d('0x47')]=[{'all':!![]}];}return db[_0x690d('0x30')][_0x690d('0x48')](_0xa67dc2);})[_0x690d('0x28')](function(_0x129426){_0x38288d['rows']=_0x129426;return _0x38288d;})['then'](respondWithFilteredResult(_0x30d680,_0xa67dc2,_0x690d('0x52')))[_0x690d('0x4a')](handleError(_0x30d680,null,_0x690d('0x52')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 0ae352b..5296af3 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 _0xc9a8=['emit','hasOwnProperty','hook','events','setMaxListeners','update','remove'];(function(_0x2f4aad,_0x1487fb){var _0x1ddcda=function(_0x29b9eb){while(--_0x29b9eb){_0x2f4aad['push'](_0x2f4aad['shift']());}};_0x1ddcda(++_0x1487fb);}(_0xc9a8,0x65));var _0x8c9a=function(_0x8a969d,_0x339d9f){_0x8a969d=_0x8a969d-0x0;var _0x1d8dc7=_0xc9a8[_0x8a969d];return _0x1d8dc7;};'use strict';var EventEmitter=require(_0x8c9a('0x0'));var VoiceQueueReport=require('../../mysqldb')['db']['VoiceQueueReport'];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x8c9a('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x8c9a('0x2'),'afterDestroy':_0x8c9a('0x3')};function emitEvent(_0x15f0d1){return function(_0x516397,_0x309422,_0xa44d7e){VoiceQueueReportEvents[_0x8c9a('0x4')](_0x15f0d1+':'+_0x516397['id'],_0x516397);VoiceQueueReportEvents[_0x8c9a('0x4')](_0x15f0d1,_0x516397);_0xa44d7e(null);};}for(var e in events){if(events[_0x8c9a('0x5')](e)){var event=events[e];VoiceQueueReport[_0x8c9a('0x6')](e,emitEvent(event));}}module['exports']=VoiceQueueReportEvents; \ No newline at end of file +var _0x1963=['save','update','emit','hook','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners'];(function(_0x1aba9c,_0x465976){var _0x414891=function(_0x179f91){while(--_0x179f91){_0x1aba9c['push'](_0x1aba9c['shift']());}};_0x414891(++_0x465976);}(_0x1963,0xa7));var _0x3196=function(_0x53e296,_0x220489){_0x53e296=_0x53e296-0x0;var _0x347dfe=_0x1963[_0x53e296];return _0x347dfe;};'use strict';var EventEmitter=require(_0x3196('0x0'));var VoiceQueueReport=require(_0x3196('0x1'))['db'][_0x3196('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x3196('0x3')](0x0);var events={'afterCreate':_0x3196('0x4'),'afterUpdate':_0x3196('0x5'),'afterDestroy':'remove'};function emitEvent(_0x32b7cd){return function(_0x246945,_0x53b814,_0x5c9270){VoiceQueueReportEvents[_0x3196('0x6')](_0x32b7cd+':'+_0x246945['id'],_0x246945);VoiceQueueReportEvents['emit'](_0x32b7cd,_0x246945);_0x5c9270(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0x3196('0x7')](e,emitEvent(event));}}module[_0x3196('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 aa023ab..bff7320 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 _0x3f8a=['report_queue','calleridnum','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x3f6bcf,_0x531e79){var _0x1c5350=function(_0x282fc5){while(--_0x282fc5){_0x3f6bcf['push'](_0x3f6bcf['shift']());}};_0x1c5350(++_0x531e79);}(_0x3f8a,0x1a6));var _0xa3f8=function(_0x118f9f,_0x36dddb){_0x118f9f=_0x118f9f-0x0;var _0x118c89=_0x3f8a[_0x118f9f];return _0x118c89;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require(_0xa3f8('0x4'));var BPromise=require(_0xa3f8('0x5'));var rp=require(_0xa3f8('0x6'));var fs=require('fs');var path=require(_0xa3f8('0x7'));var rimraf=require(_0xa3f8('0x8'));var config=require(_0xa3f8('0x9'));var attributes=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x344f67,_0xf2008a){return _0x344f67['define']('VoiceQueueReport',attributes,{'tableName':_0xa3f8('0xc'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xa3f8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc8ed=['./voiceQueueReport.attributes','exports','define','VoiceQueueReport','report_queue','calleridnum','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37be00,_0x45514d){var _0x12b45f=function(_0x400632){while(--_0x400632){_0x37be00['push'](_0x37be00['shift']());}};_0x12b45f(++_0x45514d);}(_0xc8ed,0xab));var _0xdc8e=function(_0x320900,_0x426f3c){_0x320900=_0x320900-0x0;var _0x5631ac=_0xc8ed[_0x320900];return _0x5631ac;};'use strict';var _=require('lodash');var util=require(_0xdc8e('0x0'));var logger=require(_0xdc8e('0x1'))(_0xdc8e('0x2'));var moment=require(_0xdc8e('0x3'));var BPromise=require(_0xdc8e('0x4'));var rp=require(_0xdc8e('0x5'));var fs=require('fs');var path=require(_0xdc8e('0x6'));var rimraf=require(_0xdc8e('0x7'));var config=require(_0xdc8e('0x8'));var attributes=require(_0xdc8e('0x9'));module[_0xdc8e('0xa')]=function(_0x3e2251,_0x1dd148){return _0x3e2251[_0xdc8e('0xb')](_0xdc8e('0xc'),attributes,{'tableName':_0xdc8e('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0xdc8e('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index 0e95ca6..6a73f4a 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 _0x20c3=['map','model','then','GetVoiceQueueReport','catch','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','update','raw','where','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','code','error','message','VoiceQueueReport','findAll','options','attributes','limit','include'];(function(_0x1c291d,_0x1e9835){var _0x3b6d0c=function(_0x286f92){while(--_0x286f92){_0x1c291d['push'](_0x1c291d['shift']());}};_0x3b6d0c(++_0x1e9835);}(_0x20c3,0xe8));var _0x320c=function(_0x2009d9,_0x58fb32){_0x2009d9=_0x2009d9-0x0;var _0x184540=_0x20c3[_0x2009d9];return _0x184540;};'use strict';var _=require('lodash');var util=require(_0x320c('0x0'));var moment=require(_0x320c('0x1'));var BPromise=require(_0x320c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x320c('0x3'));var db=require(_0x320c('0x4'))['db'];var utils=require(_0x320c('0x5'));var logger=require(_0x320c('0x6'))(_0x320c('0x7'));var config=require('../../config/environment');var jayson=require(_0x320c('0x8'));var client=jayson[_0x320c('0x9')][_0x320c('0xa')]({'port':0x232a});config[_0x320c('0xb')]=_[_0x320c('0xc')](config[_0x320c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x320c('0xd'))(new Redis(config[_0x320c('0xb')]));require(_0x320c('0xe'))[_0x320c('0xf')](socket);function respondWithRpcPromise(_0x541f9e,_0x3493cd,_0x429357){return new BPromise(function(_0x90e00,_0x573763){return client[_0x320c('0x10')](_0x541f9e,_0x429357)['then'](function(_0x49dbaf){logger[_0x320c('0x11')](_0x320c('0x12'),_0x3493cd,_0x320c('0x13'));logger[_0x320c('0x14')](_0x320c('0x15'),_0x3493cd,'request\x20sent',JSON[_0x320c('0x16')](_0x49dbaf));if(_0x49dbaf['error']){if(_0x49dbaf['error'][_0x320c('0x17')]===0x1f4){logger[_0x320c('0x18')](_0x320c('0x12'),_0x3493cd,_0x49dbaf[_0x320c('0x18')][_0x320c('0x19')]);return _0x573763(_0x49dbaf[_0x320c('0x18')][_0x320c('0x19')]);}logger['error'](_0x320c('0x12'),_0x3493cd,_0x49dbaf[_0x320c('0x18')][_0x320c('0x19')]);return _0x90e00(_0x49dbaf[_0x320c('0x18')][_0x320c('0x19')]);}else{logger[_0x320c('0x11')](_0x320c('0x12'),_0x3493cd,_0x320c('0x13'));_0x90e00(_0x49dbaf['result'][_0x320c('0x19')]);}})['catch'](function(_0xc3919){logger[_0x320c('0x18')](_0x320c('0x12'),_0x3493cd,_0xc3919);_0x573763(_0xc3919);});});}exports['GetVoiceQueueReport']=function(_0x3b5926){var _0x1d0f7f=this;return new Promise(function(_0x473981,_0x3e0013){return db[_0x320c('0x1a')][_0x320c('0x1b')]({'raw':_0x3b5926[_0x320c('0x1c')]?_0x3b5926['options']['raw']===undefined?!![]:![]:!![],'where':_0x3b5926['options']?_0x3b5926['options']['where']||null:null,'attributes':_0x3b5926[_0x320c('0x1c')]?_0x3b5926['options'][_0x320c('0x1d')]||null:null,'limit':_0x3b5926[_0x320c('0x1c')]?_0x3b5926[_0x320c('0x1c')][_0x320c('0x1e')]||null:null,'include':_0x3b5926[_0x320c('0x1c')]?_0x3b5926[_0x320c('0x1c')][_0x320c('0x1f')]?_[_0x320c('0x20')](_0x3b5926['options'][_0x320c('0x1f')],function(_0x84c37f){return{'model':db[_0x84c37f['model']],'as':_0x84c37f['as'],'attributes':_0x84c37f[_0x320c('0x1d')],'include':_0x84c37f[_0x320c('0x1f')]?_[_0x320c('0x20')](_0x84c37f[_0x320c('0x1f')],function(_0x25c313){return{'model':db[_0x25c313[_0x320c('0x21')]],'as':_0x25c313['as'],'attributes':_0x25c313['attributes'],'include':_0x25c313[_0x320c('0x1f')]?_[_0x320c('0x20')](_0x25c313[_0x320c('0x1f')],function(_0x36b25b){return{'model':db[_0x36b25b[_0x320c('0x21')]],'as':_0x36b25b['as'],'attributes':_0x36b25b[_0x320c('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x320c('0x22')](function(_0x21c27d){logger['info'](_0x320c('0x23'),_0x3b5926);logger[_0x320c('0x14')](_0x320c('0x23'),_0x3b5926,JSON[_0x320c('0x16')](_0x21c27d));_0x473981(_0x21c27d);})[_0x320c('0x24')](function(_0x196a50){logger['error'](_0x320c('0x23'),_0x196a50[_0x320c('0x19')],_0x3b5926);_0x3e0013(_0x1d0f7f[_0x320c('0x18')](0x1f4,_0x196a50[_0x320c('0x19')]));});});};exports[_0x320c('0x25')]=function(_0xa7517a){var _0x1cfcc1=this;return new Promise(function(_0x27bd87,_0x310b4d){return db[_0x320c('0x1a')][_0x320c('0x26')](_0xa7517a[_0x320c('0x27')],{'raw':_0xa7517a[_0x320c('0x1c')]?_0xa7517a[_0x320c('0x1c')]['raw']===undefined?!![]:![]:!![]})[_0x320c('0x22')](function(_0x1d2b93){logger[_0x320c('0x11')](_0x320c('0x25'),_0xa7517a);logger[_0x320c('0x14')]('CreateVoiceQueueReport',_0xa7517a,JSON['stringify'](_0x1d2b93));_0x27bd87(_0x1d2b93);})[_0x320c('0x24')](function(_0x3250e1){logger['error'](_0x320c('0x25'),_0x3250e1['message'],_0xa7517a);_0x310b4d(_0x1cfcc1['error'](0x1f4,_0x3250e1[_0x320c('0x19')]));});});};exports[_0x320c('0x28')]=function(_0x4e328c){var _0x359802=this;return new Promise(function(_0x70a23,_0x5bf637){return db[_0x320c('0x1a')][_0x320c('0x29')](_0x4e328c[_0x320c('0x27')],{'raw':_0x4e328c['options']?_0x4e328c[_0x320c('0x1c')][_0x320c('0x2a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e328c['options']?_0x4e328c[_0x320c('0x1c')][_0x320c('0x2b')]||null:null,'attributes':_0x4e328c[_0x320c('0x1c')]?_0x4e328c['options'][_0x320c('0x1d')]||null:null,'limit':_0x4e328c[_0x320c('0x1c')]?_0x4e328c[_0x320c('0x1c')][_0x320c('0x1e')]||null:null})[_0x320c('0x22')](function(_0x176989){logger[_0x320c('0x11')](_0x320c('0x28'),_0x4e328c);logger[_0x320c('0x14')]('UpdateVoiceQueueReport',_0x4e328c,JSON[_0x320c('0x16')](_0x176989));_0x70a23(_0x176989);})['catch'](function(_0x2f2be4){logger[_0x320c('0x18')](_0x320c('0x28'),_0x2f2be4[_0x320c('0x19')],_0x4e328c);_0x5bf637(_0x359802[_0x320c('0x18')](0x1f4,_0x2f2be4[_0x320c('0x19')]));});});}; \ No newline at end of file +var _0xb577=['request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','VoiceQueueReport,\x20%s,\x20%s','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','GetVoiceQueueReport','create','body','then','CreateVoiceQueueReport','UpdateVoiceQueueReport','update','where','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','info'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xb577,0x9b));var _0x7b57=function(_0x55d946,_0x644bc4){_0x55d946=_0x55d946-0x0;var _0xc53385=_0xb577[_0x55d946];return _0xc53385;};'use strict';var _=require(_0x7b57('0x0'));var util=require('util');var moment=require(_0x7b57('0x1'));var BPromise=require(_0x7b57('0x2'));var rs=require(_0x7b57('0x3'));var fs=require('fs');var Redis=require(_0x7b57('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7b57('0x5'));var logger=require(_0x7b57('0x6'))(_0x7b57('0x7'));var config=require(_0x7b57('0x8'));var jayson=require(_0x7b57('0x9'));var client=jayson[_0x7b57('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0x7b57('0xb')],{'host':_0x7b57('0xc'),'port':0x18eb});var socket=require(_0x7b57('0xd'))(new Redis(config[_0x7b57('0xb')]));require('./voiceQueueReport.socket')[_0x7b57('0xe')](socket);function respondWithRpcPromise(_0x68fd5c,_0x168bbc,_0x441f77){return new BPromise(function(_0x53fee2,_0x3dfcb0){return client[_0x7b57('0xf')](_0x68fd5c,_0x441f77)['then'](function(_0x443c21){logger[_0x7b57('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x168bbc,_0x7b57('0x11'));logger[_0x7b57('0x12')](_0x7b57('0x13'),_0x168bbc,_0x7b57('0x11'),JSON[_0x7b57('0x14')](_0x443c21));if(_0x443c21[_0x7b57('0x15')]){if(_0x443c21[_0x7b57('0x15')]['code']===0x1f4){logger[_0x7b57('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x168bbc,_0x443c21[_0x7b57('0x15')]['message']);return _0x3dfcb0(_0x443c21['error']['message']);}logger[_0x7b57('0x15')]('VoiceQueueReport,\x20%s,\x20%s',_0x168bbc,_0x443c21['error'][_0x7b57('0x16')]);return _0x53fee2(_0x443c21[_0x7b57('0x15')]['message']);}else{logger[_0x7b57('0x10')]('VoiceQueueReport,\x20%s,\x20%s',_0x168bbc,'request\x20sent');_0x53fee2(_0x443c21[_0x7b57('0x17')][_0x7b57('0x16')]);}})[_0x7b57('0x18')](function(_0x18c294){logger['error'](_0x7b57('0x19'),_0x168bbc,_0x18c294);_0x3dfcb0(_0x18c294);});});}exports['GetVoiceQueueReport']=function(_0x183393){var _0x4f855f=this;return new Promise(function(_0x393395,_0x1b58cf){return db[_0x7b57('0x1a')][_0x7b57('0x1b')]({'raw':_0x183393[_0x7b57('0x1c')]?_0x183393[_0x7b57('0x1c')][_0x7b57('0x1d')]===undefined?!![]:![]:!![],'where':_0x183393[_0x7b57('0x1c')]?_0x183393['options']['where']||null:null,'attributes':_0x183393['options']?_0x183393[_0x7b57('0x1c')][_0x7b57('0x1e')]||null:null,'limit':_0x183393[_0x7b57('0x1c')]?_0x183393[_0x7b57('0x1c')][_0x7b57('0x1f')]||null:null,'include':_0x183393[_0x7b57('0x1c')]?_0x183393[_0x7b57('0x1c')][_0x7b57('0x20')]?_[_0x7b57('0x21')](_0x183393[_0x7b57('0x1c')]['include'],function(_0x4d0456){return{'model':db[_0x4d0456[_0x7b57('0x22')]],'as':_0x4d0456['as'],'attributes':_0x4d0456[_0x7b57('0x1e')],'include':_0x4d0456[_0x7b57('0x20')]?_[_0x7b57('0x21')](_0x4d0456[_0x7b57('0x20')],function(_0x414f5f){return{'model':db[_0x414f5f['model']],'as':_0x414f5f['as'],'attributes':_0x414f5f['attributes'],'include':_0x414f5f['include']?_[_0x7b57('0x21')](_0x414f5f[_0x7b57('0x20')],function(_0x40164d){return{'model':db[_0x40164d[_0x7b57('0x22')]],'as':_0x40164d['as'],'attributes':_0x40164d[_0x7b57('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1f1602){logger[_0x7b57('0x10')](_0x7b57('0x23'),_0x183393);logger[_0x7b57('0x12')](_0x7b57('0x23'),_0x183393,JSON[_0x7b57('0x14')](_0x1f1602));_0x393395(_0x1f1602);})[_0x7b57('0x18')](function(_0x3f8179){logger['error'](_0x7b57('0x23'),_0x3f8179[_0x7b57('0x16')],_0x183393);_0x1b58cf(_0x4f855f['error'](0x1f4,_0x3f8179[_0x7b57('0x16')]));});});};exports['CreateVoiceQueueReport']=function(_0x525ca4){var _0x34b800=this;return new Promise(function(_0x150db8,_0x44d8c4){return db[_0x7b57('0x1a')][_0x7b57('0x24')](_0x525ca4[_0x7b57('0x25')],{'raw':_0x525ca4['options']?_0x525ca4['options'][_0x7b57('0x1d')]===undefined?!![]:![]:!![]})[_0x7b57('0x26')](function(_0x5879d7){logger[_0x7b57('0x10')]('CreateVoiceQueueReport',_0x525ca4);logger['debug'](_0x7b57('0x27'),_0x525ca4,JSON['stringify'](_0x5879d7));_0x150db8(_0x5879d7);})['catch'](function(_0x35de7f){logger[_0x7b57('0x15')](_0x7b57('0x27'),_0x35de7f[_0x7b57('0x16')],_0x525ca4);_0x44d8c4(_0x34b800[_0x7b57('0x15')](0x1f4,_0x35de7f[_0x7b57('0x16')]));});});};exports[_0x7b57('0x28')]=function(_0x29f56c){var _0x441f52=this;return new Promise(function(_0xc6a321,_0x81aad8){return db['VoiceQueueReport'][_0x7b57('0x29')](_0x29f56c[_0x7b57('0x25')],{'raw':_0x29f56c[_0x7b57('0x1c')]?_0x29f56c[_0x7b57('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29f56c['options']?_0x29f56c['options'][_0x7b57('0x2a')]||null:null,'attributes':_0x29f56c[_0x7b57('0x1c')]?_0x29f56c[_0x7b57('0x1c')][_0x7b57('0x1e')]||null:null,'limit':_0x29f56c[_0x7b57('0x1c')]?_0x29f56c[_0x7b57('0x1c')]['limit']||null:null})['then'](function(_0x5ca376){logger['info']('UpdateVoiceQueueReport',_0x29f56c);logger[_0x7b57('0x12')](_0x7b57('0x28'),_0x29f56c,JSON['stringify'](_0x5ca376));_0xc6a321(_0x5ca376);})[_0x7b57('0x18')](function(_0x20035c){logger[_0x7b57('0x15')](_0x7b57('0x28'),_0x20035c[_0x7b57('0x16')],_0x29f56c);_0x81aad8(_0x441f52[_0x7b57('0x15')](0x1f4,_0x20035c['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 7a68ee0..31f62ef 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 _0x85d8=['remove','update','emit','length','voiceQueueReport:','./voiceQueueReport.events','save'];(function(_0x403cff,_0x1cf463){var _0x5a7c56=function(_0x1bab9d){while(--_0x1bab9d){_0x403cff['push'](_0x403cff['shift']());}};_0x5a7c56(++_0x1cf463);}(_0x85d8,0x1b0));var _0x885d=function(_0x3dfa26,_0x3c45fc){_0x3dfa26=_0x3dfa26-0x0;var _0x409b3d=_0x85d8[_0x3dfa26];return _0x409b3d;};'use strict';var VoiceQueueReportEvents=require(_0x885d('0x0'));var events=[_0x885d('0x1'),_0x885d('0x2'),_0x885d('0x3')];function createListener(_0x3e5eab,_0x5bad48){return function(_0x328261){_0x5bad48[_0x885d('0x4')](_0x3e5eab,_0x328261);};}function removeListener(_0x320d7d,_0x3fe8a0){return function(){VoiceQueueReportEvents['removeListener'](_0x320d7d,_0x3fe8a0);};}exports['register']=function(_0x186504){for(var _0x30dcc2=0x0,_0x3715b4=events[_0x885d('0x5')];_0x30dcc2<_0x3715b4;_0x30dcc2++){var _0x18428b=events[_0x30dcc2];var _0x11e6d7=createListener(_0x885d('0x6')+_0x18428b,_0x186504);VoiceQueueReportEvents['on'](_0x18428b,_0x11e6d7);}}; \ No newline at end of file +var _0x5292=['length','voiceQueueReport:','./voiceQueueReport.events','save','update','emit','removeListener'];(function(_0x312183,_0x501542){var _0x5a6efd=function(_0x11f613){while(--_0x11f613){_0x312183['push'](_0x312183['shift']());}};_0x5a6efd(++_0x501542);}(_0x5292,0xf7));var _0x2529=function(_0x598152,_0x4230ac){_0x598152=_0x598152-0x0;var _0x71af95=_0x5292[_0x598152];return _0x71af95;};'use strict';var VoiceQueueReportEvents=require(_0x2529('0x0'));var events=[_0x2529('0x1'),'remove',_0x2529('0x2')];function createListener(_0x522ab4,_0x1540a9){return function(_0x2b088){_0x1540a9[_0x2529('0x3')](_0x522ab4,_0x2b088);};}function removeListener(_0x228165,_0x5d25dc){return function(){VoiceQueueReportEvents[_0x2529('0x4')](_0x228165,_0x5d25dc);};}exports['register']=function(_0x4c9b4c){for(var _0x4e7a9e=0x0,_0x407277=events[_0x2529('0x5')];_0x4e7a9e<_0x407277;_0x4e7a9e++){var _0x5bb8a1=events[_0x4e7a9e];var _0x5c3355=createListener(_0x2529('0x6')+_0x5bb8a1,_0x4c9b4c);VoiceQueueReportEvents['on'](_0x5bb8a1,_0x5c3355);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 27b5be0..ec670ec 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 _0x208d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','index','/:id','show','post','create','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x5cb384,_0x2f14c7){var _0x38884a=function(_0x489527){while(--_0x489527){_0x5cb384['push'](_0x5cb384['shift']());}};_0x38884a(++_0x2f14c7);}(_0x208d,0xa4));var _0xd208=function(_0x1499c4,_0x57c5c3){_0x1499c4=_0x1499c4-0x0;var _0x3cf45a=_0x208d[_0x1499c4];return _0x3cf45a;};'use strict';var multer=require(_0xd208('0x0'));var util=require(_0xd208('0x1'));var path=require(_0xd208('0x2'));var timeout=require(_0xd208('0x3'));var express=require('express');var router=express[_0xd208('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd208('0x5'));var interaction=require(_0xd208('0x6'));var config=require(_0xd208('0x7'));var controller=require(_0xd208('0x8'));router[_0xd208('0x9')]('/',auth['isAuthenticated'](),controller[_0xd208('0xa')]);router[_0xd208('0x9')](_0xd208('0xb'),auth['isAuthenticated'](),controller[_0xd208('0xc')]);router[_0xd208('0xd')]('/',auth['isAuthenticated'](),controller[_0xd208('0xe')]);router[_0xd208('0xf')]('/:id',auth[_0xd208('0x10')](),controller[_0xd208('0x11')]);router[_0xd208('0x12')](_0xd208('0xb'),auth['isAuthenticated'](),controller[_0xd208('0x13')]);module[_0xd208('0x14')]=router; \ No newline at end of file +var _0x9538=['/:id','delete','destroy','multer','util','path','Router','fs-extra','../../config/environment','./voiceQueuesLog.controller','isAuthenticated','index','get'];(function(_0x3080da,_0x276068){var _0x10313e=function(_0x40051d){while(--_0x40051d){_0x3080da['push'](_0x3080da['shift']());}};_0x10313e(++_0x276068);}(_0x9538,0x1bd));var _0x8953=function(_0x22544b,_0x301001){_0x22544b=_0x22544b-0x0;var _0x245051=_0x9538[_0x22544b];return _0x245051;};'use strict';var multer=require(_0x8953('0x0'));var util=require(_0x8953('0x1'));var path=require(_0x8953('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8953('0x3')]();var fs_extra=require(_0x8953('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8953('0x5'));var controller=require(_0x8953('0x6'));router['get']('/',auth[_0x8953('0x7')](),controller[_0x8953('0x8')]);router[_0x8953('0x9')](_0x8953('0xa'),auth[_0x8953('0x7')](),controller['show']);router['post']('/',auth[_0x8953('0x7')](),controller['create']);router['put']('/:id',auth[_0x8953('0x7')](),controller['update']);router[_0x8953('0xb')](_0x8953('0xa'),auth[_0x8953('0x7')](),controller[_0x8953('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 468a759..0c22a0f 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 _0x301c=['sequelize','moment','exports','STRING','DATE','literal'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x301c,0x150));var _0xc301=function(_0x5a852b,_0x1694c2){_0x5a852b=_0x5a852b-0x0;var _0xd74d84=_0x301c[_0x5a852b];return _0xd74d84;};'use strict';var Sequelize=require(_0xc301('0x0'));var moment=require(_0xc301('0x1'));module[_0xc301('0x2')]={'time':{'type':Sequelize[_0xc301('0x3')]},'callid':{'type':Sequelize[_0xc301('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0xc301('0x3')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xc301('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xc301('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xc301('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xc301('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xc301('0x4')],'allowNull':![],'defaultValue':Sequelize[_0xc301('0x5')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0x8d76=['moment','exports','STRING','DATE','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x2a03d1,_0x44535a){var _0x269e00=function(_0x97f112){while(--_0x97f112){_0x2a03d1['push'](_0x2a03d1['shift']());}};_0x269e00(++_0x44535a);}(_0x8d76,0xc5));var _0x68d7=function(_0x11cd75,_0x3dac98){_0x11cd75=_0x11cd75-0x0;var _0x37fdf1=_0x8d76[_0x11cd75];return _0x37fdf1;};'use strict';var Sequelize=require(_0x68d7('0x0'));var moment=require(_0x68d7('0x1'));module[_0x68d7('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x68d7('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x68d7('0x4')],'allowNull':![],'defaultValue':Sequelize['literal'](_0x68d7('0x5'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 31c25c7..8159527 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 _0xbe8a=['filter','VIRTUAL','merge','VoiceQueuesLog','includeAll','catch','show','params','include','options','find','create','body','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','end','status','json','offset','count','limit','set','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick'];(function(_0x2464c7,_0xed8be){var _0x5a52a7=function(_0xeb1a55){while(--_0xeb1a55){_0x2464c7['push'](_0x2464c7['shift']());}};_0x5a52a7(++_0xed8be);}(_0xbe8a,0x97));var _0xabe8=function(_0x1d0aee,_0x2c4454){_0x1d0aee=_0x1d0aee-0x0;var _0x34ee2c=_0xbe8a[_0x1d0aee];return _0x34ee2c;};'use strict';var emlformat=require(_0xabe8('0x0'));var rimraf=require(_0xabe8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xabe8('0x2'));var moment=require(_0xabe8('0x3'));var BPromise=require(_0xabe8('0x4'));var Mustache=require('mustache');var util=require(_0xabe8('0x5'));var path=require(_0xabe8('0x6'));var sox=require(_0xabe8('0x7'));var csv=require('to-csv');var ejs=require(_0xabe8('0x8'));var fs=require('fs');var fs_extra=require(_0xabe8('0x9'));var _=require(_0xabe8('0xa'));var squel=require(_0xabe8('0xb'));var crypto=require(_0xabe8('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xabe8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xabe8('0xe'));var Papa=require(_0xabe8('0xf'));var Redis=require(_0xabe8('0x10'));var authService=require(_0xabe8('0x11'));var qs=require(_0xabe8('0x12'));var as=require(_0xabe8('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xabe8('0x14'))(_0xabe8('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xabe8('0x16'))['db'];function respondWithStatusCode(_0x1aba8a,_0x23993f){_0x23993f=_0x23993f||0xcc;return function(_0x5f32ec){if(_0x5f32ec){return _0x1aba8a['sendStatus'](_0x23993f);}return _0x1aba8a['status'](_0x23993f)[_0xabe8('0x17')]();};}function respondWithResult(_0x5f2fbb,_0x42f3c3){_0x42f3c3=_0x42f3c3||0xc8;return function(_0x39d4ef){if(_0x39d4ef){return _0x5f2fbb[_0xabe8('0x18')](_0x42f3c3)[_0xabe8('0x19')](_0x39d4ef);}};}function respondWithFilteredResult(_0xa00a8c,_0x392706){return function(_0x5d62c8){if(_0x5d62c8){var _0x16f786=typeof _0x392706[_0xabe8('0x1a')]==='undefined'&&typeof _0x392706['limit']==='undefined';var _0x266fe3=_0x5d62c8[_0xabe8('0x1b')];var _0xdb83eb=_0x16f786?0x0:_0x392706['offset'];var _0x514f64=_0x16f786?_0x5d62c8[_0xabe8('0x1b')]:_0x392706[_0xabe8('0x1a')]+_0x392706[_0xabe8('0x1c')];var _0x27e83a;if(_0x514f64>=_0x266fe3){_0x514f64=_0x266fe3;_0x27e83a=0xc8;}else{_0x27e83a=0xce;}_0xa00a8c['status'](_0x27e83a);return _0xa00a8c[_0xabe8('0x1d')]('Content-Range',_0xdb83eb+'-'+_0x514f64+'/'+_0x266fe3)[_0xabe8('0x19')](_0x5d62c8);}return null;};}function patchUpdates(_0x1121dd){return function(_0x3793a6){try{jsonpatch['apply'](_0x3793a6,_0x1121dd,!![]);}catch(_0x41cd13){return BPromise['reject'](_0x41cd13);}return _0x3793a6[_0xabe8('0x1e')]();};}function saveUpdates(_0x5c99b8,_0x5c35ce){return function(_0x408e6b){if(_0x408e6b){return _0x408e6b[_0xabe8('0x1f')](_0x5c99b8)[_0xabe8('0x20')](function(_0x5f3d73){return _0x5f3d73;});}return null;};}function removeEntity(_0x19e675,_0x375f1b){return function(_0x763ce3){if(_0x763ce3){return _0x763ce3['destroy']()[_0xabe8('0x20')](function(){_0x19e675[_0xabe8('0x18')](0xcc)[_0xabe8('0x17')]();});}};}function handleEntityNotFound(_0x5548aa,_0x4c99c6){return function(_0x42d3c2){if(!_0x42d3c2){_0x5548aa[_0xabe8('0x21')](0x194);}return _0x42d3c2;};}function handleError(_0x349417,_0x569d94){_0x569d94=_0x569d94||0x1f4;return function(_0x204f48){logger[_0xabe8('0x22')](_0x204f48['stack']);if(_0x204f48[_0xabe8('0x23')]){delete _0x204f48['name'];}_0x349417['status'](_0x569d94)[_0xabe8('0x24')](_0x204f48);};}exports[_0xabe8('0x25')]=function(_0xe88231,_0x10a9ef){var _0x2d7311={},_0x50aa57={},_0x209b96={'count':0x0,'rows':[]};var _0x50cc15=_[_0xabe8('0x26')](db['VoiceQueuesLog'][_0xabe8('0x27')],function(_0x58f0be){return{'name':_0x58f0be[_0xabe8('0x28')],'type':_0x58f0be[_0xabe8('0x29')][_0xabe8('0x2a')]};});_0x50aa57[_0xabe8('0x2b')]=_[_0xabe8('0x26')](_0x50cc15,'name');_0x50aa57[_0xabe8('0x2c')]=_[_0xabe8('0x2d')](_0xe88231['query']);_0x50aa57[_0xabe8('0x2e')]=_[_0xabe8('0x2f')](_0x50aa57[_0xabe8('0x2b')],_0x50aa57[_0xabe8('0x2c')]);_0x2d7311['attributes']=_[_0xabe8('0x2f')](_0x50aa57['model'],qs[_0xabe8('0x30')](_0xe88231['query'][_0xabe8('0x30')]));_0x2d7311['attributes']=_0x2d7311[_0xabe8('0x31')][_0xabe8('0x32')]?_0x2d7311['attributes']:_0x50aa57['model'];if(!_0xe88231['query'][_0xabe8('0x33')](_0xabe8('0x34'))){_0x2d7311['limit']=qs['limit'](_0xe88231[_0xabe8('0x2c')][_0xabe8('0x1c')]);_0x2d7311[_0xabe8('0x1a')]=qs['offset'](_0xe88231[_0xabe8('0x2c')][_0xabe8('0x1a')]);}_0x2d7311['order']=qs[_0xabe8('0x35')](_0xe88231[_0xabe8('0x2c')][_0xabe8('0x35')]);_0x2d7311[_0xabe8('0x36')]=qs['filters'](_[_0xabe8('0x37')](_0xe88231['query'],_0x50aa57[_0xabe8('0x2e')]),_0x50cc15);if(_0xe88231[_0xabe8('0x2c')][_0xabe8('0x38')]){_0x2d7311['where']=_['merge'](_0x2d7311['where'],{'$or':_[_0xabe8('0x26')](_0x50cc15,function(_0x4fc6fb){if(_0x4fc6fb[_0xabe8('0x29')]!==_0xabe8('0x39')){var _0x5ed9e3={};_0x5ed9e3[_0x4fc6fb[_0xabe8('0x23')]]={'$like':'%'+_0xe88231[_0xabe8('0x2c')][_0xabe8('0x38')]+'%'};return _0x5ed9e3;}})});}_0x2d7311=_[_0xabe8('0x3a')]({},_0x2d7311,_0xe88231['options']);var _0x23b14e={'where':_0x2d7311[_0xabe8('0x36')]};return db[_0xabe8('0x3b')]['count'](_0x23b14e)[_0xabe8('0x20')](function(_0x11184f){_0x209b96[_0xabe8('0x1b')]=_0x11184f;if(_0xe88231[_0xabe8('0x2c')][_0xabe8('0x3c')]){_0x2d7311['include']=[{'all':!![]}];}return db[_0xabe8('0x3b')]['findAll'](_0x2d7311);})[_0xabe8('0x20')](function(_0x1f6fab){_0x209b96['rows']=_0x1f6fab;return _0x209b96;})[_0xabe8('0x20')](respondWithFilteredResult(_0x10a9ef,_0x2d7311))[_0xabe8('0x3d')](handleError(_0x10a9ef,null));};exports[_0xabe8('0x3e')]=function(_0x14e4a4,_0x3da9eb){var _0x3a107e={'raw':!![],'where':{'id':_0x14e4a4[_0xabe8('0x3f')]['id']}},_0x458801={};_0x458801[_0xabe8('0x2b')]=_[_0xabe8('0x2d')](db['VoiceQueuesLog'][_0xabe8('0x27')]);_0x458801[_0xabe8('0x2c')]=_['keys'](_0x14e4a4[_0xabe8('0x2c')]);_0x458801[_0xabe8('0x2e')]=_[_0xabe8('0x2f')](_0x458801[_0xabe8('0x2b')],_0x458801['query']);_0x3a107e['attributes']=_[_0xabe8('0x2f')](_0x458801[_0xabe8('0x2b')],qs[_0xabe8('0x30')](_0x14e4a4['query'][_0xabe8('0x30')]));_0x3a107e[_0xabe8('0x31')]=_0x3a107e['attributes'][_0xabe8('0x32')]?_0x3a107e[_0xabe8('0x31')]:_0x458801['model'];if(_0x14e4a4[_0xabe8('0x2c')][_0xabe8('0x3c')]){_0x3a107e[_0xabe8('0x40')]=[{'all':!![]}];}_0x3a107e=_[_0xabe8('0x3a')]({},_0x3a107e,_0x14e4a4[_0xabe8('0x41')]);return db[_0xabe8('0x3b')][_0xabe8('0x42')](_0x3a107e)['then'](handleEntityNotFound(_0x3da9eb,null))[_0xabe8('0x20')](respondWithResult(_0x3da9eb,null))[_0xabe8('0x3d')](handleError(_0x3da9eb,null));};exports['create']=function(_0x52a4c5,_0x41d294){return db[_0xabe8('0x3b')][_0xabe8('0x43')](_0x52a4c5[_0xabe8('0x44')],{})['then'](respondWithResult(_0x41d294,0xc9))[_0xabe8('0x3d')](handleError(_0x41d294,null));};exports['update']=function(_0x15e8eb,_0x3be412){if(_0x15e8eb['body']['id']){delete _0x15e8eb[_0xabe8('0x44')]['id'];}return db['VoiceQueuesLog'][_0xabe8('0x42')]({'where':{'id':_0x15e8eb[_0xabe8('0x3f')]['id']}})[_0xabe8('0x20')](handleEntityNotFound(_0x3be412,null))[_0xabe8('0x20')](saveUpdates(_0x15e8eb['body'],null))['then'](respondWithResult(_0x3be412,null))[_0xabe8('0x3d')](handleError(_0x3be412,null));};exports['destroy']=function(_0x543c40,_0x1db813){return db[_0xabe8('0x3b')][_0xabe8('0x42')]({'where':{'id':_0x543c40[_0xabe8('0x3f')]['id']}})[_0xabe8('0x20')](handleEntityNotFound(_0x1db813,null))[_0xabe8('0x20')](removeEntity(_0x1db813,null))[_0xabe8('0x3d')](handleError(_0x1db813,null));}; \ No newline at end of file +var _0x1c18=['order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit'];(function(_0x8de54f,_0x271987){var _0x14cba4=function(_0x58ed41){while(--_0x58ed41){_0x8de54f['push'](_0x8de54f['shift']());}};_0x14cba4(++_0x271987);}(_0x1c18,0x135));var _0x81c1=function(_0x3f18d9,_0x3b2f8f){_0x3f18d9=_0x3f18d9-0x0;var _0x243ff4=_0x1c18[_0x3f18d9];return _0x243ff4;};'use strict';var emlformat=require(_0x81c1('0x0'));var rimraf=require(_0x81c1('0x1'));var zipdir=require(_0x81c1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x81c1('0x3'));var moment=require(_0x81c1('0x4'));var BPromise=require(_0x81c1('0x5'));var Mustache=require('mustache');var util=require(_0x81c1('0x6'));var path=require(_0x81c1('0x7'));var sox=require('sox');var csv=require(_0x81c1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x81c1('0x9'));var _=require(_0x81c1('0xa'));var squel=require('squel');var crypto=require(_0x81c1('0xb'));var jsforce=require(_0x81c1('0xc'));var deskjs=require(_0x81c1('0xd'));var toCsv=require(_0x81c1('0x8'));var querystring=require('querystring');var Papa=require(_0x81c1('0xe'));var Redis=require('ioredis');var authService=require(_0x81c1('0xf'));var qs=require(_0x81c1('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x81c1('0x11'));var logger=require(_0x81c1('0x12'))(_0x81c1('0x13'));var utils=require('../../config/utils');var config=require(_0x81c1('0x14'));var licenseUtil=require(_0x81c1('0x15'));var db=require(_0x81c1('0x16'))['db'];function respondWithStatusCode(_0x1be17c,_0x2857c7){_0x2857c7=_0x2857c7||0xcc;return function(_0x504e06){if(_0x504e06){return _0x1be17c[_0x81c1('0x17')](_0x2857c7);}return _0x1be17c[_0x81c1('0x18')](_0x2857c7)[_0x81c1('0x19')]();};}function respondWithResult(_0x3f999f,_0x219da2){_0x219da2=_0x219da2||0xc8;return function(_0x18c60d){if(_0x18c60d){return _0x3f999f[_0x81c1('0x18')](_0x219da2)[_0x81c1('0x1a')](_0x18c60d);}};}function respondWithFilteredResult(_0x30cf9d,_0x1a81ca){return function(_0x5488a9){if(_0x5488a9){var _0x3fa84a=typeof _0x1a81ca[_0x81c1('0x1b')]===_0x81c1('0x1c')&&typeof _0x1a81ca['limit']===_0x81c1('0x1c');var _0x51cd61=_0x5488a9[_0x81c1('0x1d')];var _0x500337=_0x3fa84a?0x0:_0x1a81ca[_0x81c1('0x1b')];var _0x367cc7=_0x3fa84a?_0x5488a9['count']:_0x1a81ca[_0x81c1('0x1b')]+_0x1a81ca['limit'];var _0x97539c;if(_0x367cc7>=_0x51cd61){_0x367cc7=_0x51cd61;_0x97539c=0xc8;}else{_0x97539c=0xce;}_0x30cf9d[_0x81c1('0x18')](_0x97539c);return _0x30cf9d['set'](_0x81c1('0x1e'),_0x500337+'-'+_0x367cc7+'/'+_0x51cd61)[_0x81c1('0x1a')](_0x5488a9);}return null;};}function patchUpdates(_0x38b508){return function(_0x5ab867){try{jsonpatch[_0x81c1('0x1f')](_0x5ab867,_0x38b508,!![]);}catch(_0x346260){return BPromise[_0x81c1('0x20')](_0x346260);}return _0x5ab867[_0x81c1('0x21')]();};}function saveUpdates(_0x2ca6a3,_0x28faa8){return function(_0x1a1130){if(_0x1a1130){return _0x1a1130[_0x81c1('0x22')](_0x2ca6a3)[_0x81c1('0x23')](function(_0x14d8d1){return _0x14d8d1;});}return null;};}function removeEntity(_0x41bd99,_0x3bb04c){return function(_0xb8121e){if(_0xb8121e){return _0xb8121e[_0x81c1('0x24')]()[_0x81c1('0x23')](function(){_0x41bd99['status'](0xcc)[_0x81c1('0x19')]();});}};}function handleEntityNotFound(_0x354836,_0x1437aa){return function(_0x323723){if(!_0x323723){_0x354836[_0x81c1('0x17')](0x194);}return _0x323723;};}function handleError(_0x51b8b6,_0x5e4c6b){_0x5e4c6b=_0x5e4c6b||0x1f4;return function(_0x5f3c10){logger[_0x81c1('0x25')](_0x5f3c10[_0x81c1('0x26')]);if(_0x5f3c10[_0x81c1('0x27')]){delete _0x5f3c10[_0x81c1('0x27')];}_0x51b8b6['status'](_0x5e4c6b)[_0x81c1('0x28')](_0x5f3c10);};}exports[_0x81c1('0x29')]=function(_0x2c29ff,_0x1dccf3){var _0x5d48bd={},_0x154ff1={},_0xb5ad73={'count':0x0,'rows':[]};var _0x5be000=_[_0x81c1('0x2a')](db[_0x81c1('0x2b')]['rawAttributes'],function(_0x3dfc3a){return{'name':_0x3dfc3a[_0x81c1('0x2c')],'type':_0x3dfc3a[_0x81c1('0x2d')]['key']};});_0x154ff1[_0x81c1('0x2e')]=_[_0x81c1('0x2a')](_0x5be000,_0x81c1('0x27'));_0x154ff1[_0x81c1('0x2f')]=_[_0x81c1('0x30')](_0x2c29ff[_0x81c1('0x2f')]);_0x154ff1[_0x81c1('0x31')]=_[_0x81c1('0x32')](_0x154ff1[_0x81c1('0x2e')],_0x154ff1[_0x81c1('0x2f')]);_0x5d48bd[_0x81c1('0x33')]=_[_0x81c1('0x32')](_0x154ff1[_0x81c1('0x2e')],qs[_0x81c1('0x34')](_0x2c29ff[_0x81c1('0x2f')][_0x81c1('0x34')]));_0x5d48bd[_0x81c1('0x33')]=_0x5d48bd[_0x81c1('0x33')][_0x81c1('0x35')]?_0x5d48bd[_0x81c1('0x33')]:_0x154ff1[_0x81c1('0x2e')];if(!_0x2c29ff['query']['hasOwnProperty'](_0x81c1('0x36'))){_0x5d48bd[_0x81c1('0x37')]=qs['limit'](_0x2c29ff['query']['limit']);_0x5d48bd[_0x81c1('0x1b')]=qs[_0x81c1('0x1b')](_0x2c29ff[_0x81c1('0x2f')][_0x81c1('0x1b')]);}_0x5d48bd[_0x81c1('0x38')]=qs[_0x81c1('0x39')](_0x2c29ff[_0x81c1('0x2f')][_0x81c1('0x39')]);_0x5d48bd[_0x81c1('0x3a')]=qs[_0x81c1('0x31')](_[_0x81c1('0x3b')](_0x2c29ff['query'],_0x154ff1[_0x81c1('0x31')]),_0x5be000);if(_0x2c29ff['query']['filter']){_0x5d48bd[_0x81c1('0x3a')]=_[_0x81c1('0x3c')](_0x5d48bd[_0x81c1('0x3a')],{'$or':_[_0x81c1('0x2a')](_0x5be000,function(_0x584dcb){if(_0x584dcb['type']!==_0x81c1('0x3d')){var _0xddc6b0={};_0xddc6b0[_0x584dcb['name']]={'$like':'%'+_0x2c29ff[_0x81c1('0x2f')]['filter']+'%'};return _0xddc6b0;}})});}_0x5d48bd=_[_0x81c1('0x3c')]({},_0x5d48bd,_0x2c29ff[_0x81c1('0x3e')]);var _0x5814ae={'where':_0x5d48bd[_0x81c1('0x3a')]};return db[_0x81c1('0x2b')][_0x81c1('0x1d')](_0x5814ae)['then'](function(_0x562222){_0xb5ad73[_0x81c1('0x1d')]=_0x562222;if(_0x2c29ff[_0x81c1('0x2f')][_0x81c1('0x3f')]){_0x5d48bd[_0x81c1('0x40')]=[{'all':!![]}];}return db[_0x81c1('0x2b')][_0x81c1('0x41')](_0x5d48bd);})['then'](function(_0x500718){_0xb5ad73[_0x81c1('0x42')]=_0x500718;return _0xb5ad73;})[_0x81c1('0x23')](respondWithFilteredResult(_0x1dccf3,_0x5d48bd))['catch'](handleError(_0x1dccf3,null));};exports[_0x81c1('0x43')]=function(_0x43dd7e,_0x482bdd){var _0x38a335={'raw':!![],'where':{'id':_0x43dd7e['params']['id']}},_0x4afb8d={};_0x4afb8d[_0x81c1('0x2e')]=_[_0x81c1('0x30')](db[_0x81c1('0x2b')]['rawAttributes']);_0x4afb8d['query']=_['keys'](_0x43dd7e['query']);_0x4afb8d['filters']=_[_0x81c1('0x32')](_0x4afb8d[_0x81c1('0x2e')],_0x4afb8d[_0x81c1('0x2f')]);_0x38a335[_0x81c1('0x33')]=_[_0x81c1('0x32')](_0x4afb8d[_0x81c1('0x2e')],qs[_0x81c1('0x34')](_0x43dd7e['query'][_0x81c1('0x34')]));_0x38a335[_0x81c1('0x33')]=_0x38a335[_0x81c1('0x33')][_0x81c1('0x35')]?_0x38a335[_0x81c1('0x33')]:_0x4afb8d['model'];if(_0x43dd7e['query'][_0x81c1('0x3f')]){_0x38a335[_0x81c1('0x40')]=[{'all':!![]}];}_0x38a335=_[_0x81c1('0x3c')]({},_0x38a335,_0x43dd7e[_0x81c1('0x3e')]);return db[_0x81c1('0x2b')][_0x81c1('0x44')](_0x38a335)['then'](handleEntityNotFound(_0x482bdd,null))[_0x81c1('0x23')](respondWithResult(_0x482bdd,null))[_0x81c1('0x45')](handleError(_0x482bdd,null));};exports[_0x81c1('0x46')]=function(_0x4d904c,_0x3b48ac){return db[_0x81c1('0x2b')][_0x81c1('0x46')](_0x4d904c[_0x81c1('0x47')],{})[_0x81c1('0x23')](respondWithResult(_0x3b48ac,0xc9))[_0x81c1('0x45')](handleError(_0x3b48ac,null));};exports['update']=function(_0x425a18,_0x16b171){if(_0x425a18[_0x81c1('0x47')]['id']){delete _0x425a18[_0x81c1('0x47')]['id'];}return db[_0x81c1('0x2b')][_0x81c1('0x44')]({'where':{'id':_0x425a18[_0x81c1('0x48')]['id']}})[_0x81c1('0x23')](handleEntityNotFound(_0x16b171,null))[_0x81c1('0x23')](saveUpdates(_0x425a18[_0x81c1('0x47')],null))['then'](respondWithResult(_0x16b171,null))[_0x81c1('0x45')](handleError(_0x16b171,null));};exports['destroy']=function(_0x2c6f0d,_0x2f03ea){return db[_0x81c1('0x2b')]['find']({'where':{'id':_0x2c6f0d[_0x81c1('0x48')]['id']}})[_0x81c1('0x23')](handleEntityNotFound(_0x2f03ea,null))[_0x81c1('0x23')](removeEntity(_0x2f03ea,null))['catch'](handleError(_0x2f03ea,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b800d65..2ce13b6 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 _0xca66=['../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','dtm','lodash','api','moment','bluebird','path'];(function(_0x58474e,_0x2d1513){var _0x401b63=function(_0x475f83){while(--_0x475f83){_0x58474e['push'](_0x58474e['shift']());}};_0x401b63(++_0x2d1513);}(_0xca66,0x8b));var _0x6ca6=function(_0xcc1eb1,_0xe201b1){_0xcc1eb1=_0xcc1eb1-0x0;var _0x4136a6=_0xca66[_0xcc1eb1];return _0x4136a6;};'use strict';var _=require(_0x6ca6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6ca6('0x1'));var moment=require(_0x6ca6('0x2'));var BPromise=require(_0x6ca6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6ca6('0x4'));var rimraf=require('rimraf');var config=require(_0x6ca6('0x5'));var attributes=require('./voiceQueuesLog.attributes');module[_0x6ca6('0x6')]=function(_0x27d8c6,_0x34836f){return _0x27d8c6[_0x6ca6('0x7')](_0x6ca6('0x8'),attributes,{'tableName':_0x6ca6('0x9'),'paranoid':![],'indexes':[{'name':_0x6ca6('0xa'),'fields':['event',_0x6ca6('0xb')]}],'timestamps':![]});}; \ No newline at end of file +var _0x31ee=['./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log','event_dtm','event','dtm','util','../../config/logger','api','request-promise','rimraf'];(function(_0xf66a25,_0x527689){var _0x231422=function(_0x164b05){while(--_0x164b05){_0xf66a25['push'](_0xf66a25['shift']());}};_0x231422(++_0x527689);}(_0x31ee,0x181));var _0xe31e=function(_0x52bcac,_0xb309cb){_0x52bcac=_0x52bcac-0x0;var _0x29e404=_0x31ee[_0x52bcac];return _0x29e404;};'use strict';var _=require('lodash');var util=require(_0xe31e('0x0'));var logger=require(_0xe31e('0x1'))(_0xe31e('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe31e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe31e('0x4'));var config=require('../../config/environment');var attributes=require(_0xe31e('0x5'));module[_0xe31e('0x6')]=function(_0x326bc5,_0x5b2d9a){return _0x326bc5[_0xe31e('0x7')](_0xe31e('0x8'),attributes,{'tableName':_0xe31e('0x9'),'paranoid':![],'indexes':[{'name':_0xe31e('0xa'),'fields':[_0xe31e('0xb'),_0xe31e('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index d1c6bb0..a379a61 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 _0x6ae8=['debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent'];(function(_0x3fc15b,_0x1bfdce){var _0x2a0c57=function(_0x501f2a){while(--_0x501f2a){_0x3fc15b['push'](_0x3fc15b['shift']());}};_0x2a0c57(++_0x1bfdce);}(_0x6ae8,0x190));var _0x86ae=function(_0x582628,_0x45dc5d){_0x582628=_0x582628-0x0;var _0x4dfea5=_0x6ae8[_0x582628];return _0x4dfea5;};'use strict';var _=require(_0x86ae('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x86ae('0x1'));var rs=require(_0x86ae('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x86ae('0x3'))['db'];var utils=require(_0x86ae('0x4'));var logger=require(_0x86ae('0x5'))(_0x86ae('0x6'));var config=require(_0x86ae('0x7'));var jayson=require(_0x86ae('0x8'));var client=jayson[_0x86ae('0x9')][_0x86ae('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c5579,_0x318365,_0x34a4bb){return new BPromise(function(_0x1be0a2,_0x2e1a5a){return client[_0x86ae('0xb')](_0x4c5579,_0x34a4bb)['then'](function(_0xa718b8){logger[_0x86ae('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x318365,_0x86ae('0xd'));logger[_0x86ae('0xe')](_0x86ae('0xf'),_0x318365,'request\x20sent',JSON[_0x86ae('0x10')](_0xa718b8));if(_0xa718b8[_0x86ae('0x11')]){if(_0xa718b8[_0x86ae('0x11')][_0x86ae('0x12')]===0x1f4){logger[_0x86ae('0x11')](_0x86ae('0x13'),_0x318365,_0xa718b8[_0x86ae('0x11')][_0x86ae('0x14')]);return _0x2e1a5a(_0xa718b8[_0x86ae('0x11')][_0x86ae('0x14')]);}logger[_0x86ae('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x318365,_0xa718b8['error']['message']);return _0x1be0a2(_0xa718b8['error'][_0x86ae('0x14')]);}else{logger[_0x86ae('0xc')]('VoiceQueuesLog,\x20%s,\x20%s',_0x318365,_0x86ae('0xd'));_0x1be0a2(_0xa718b8[_0x86ae('0x15')]['message']);}})[_0x86ae('0x16')](function(_0x57ce9e){logger['error'](_0x86ae('0x13'),_0x318365,_0x57ce9e);_0x2e1a5a(_0x57ce9e);});});} \ No newline at end of file +var _0x2516=['client','http','request','then','info','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','VoiceQueuesLog,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2cb50c,_0x300e63){var _0x1d20e1=function(_0x4bcf9f){while(--_0x4bcf9f){_0x2cb50c['push'](_0x2cb50c['shift']());}};_0x1d20e1(++_0x300e63);}(_0x2516,0x9d));var _0x6251=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0x2516[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0x6251('0x0'));var util=require(_0x6251('0x1'));var moment=require(_0x6251('0x2'));var BPromise=require(_0x6251('0x3'));var rs=require(_0x6251('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6251('0x5'))['db'];var utils=require(_0x6251('0x6'));var logger=require(_0x6251('0x7'))(_0x6251('0x8'));var config=require(_0x6251('0x9'));var jayson=require(_0x6251('0xa'));var client=jayson[_0x6251('0xb')][_0x6251('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x279080,_0x3bb767,_0x144f7e){return new BPromise(function(_0x38e845,_0x1a5b28){return client[_0x6251('0xd')](_0x279080,_0x144f7e)[_0x6251('0xe')](function(_0x241324){logger[_0x6251('0xf')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3bb767,_0x6251('0x10'));logger[_0x6251('0x11')](_0x6251('0x12'),_0x3bb767,_0x6251('0x10'),JSON[_0x6251('0x13')](_0x241324));if(_0x241324[_0x6251('0x14')]){if(_0x241324[_0x6251('0x14')]['code']===0x1f4){logger[_0x6251('0x14')](_0x6251('0x15'),_0x3bb767,_0x241324[_0x6251('0x14')][_0x6251('0x16')]);return _0x1a5b28(_0x241324[_0x6251('0x14')][_0x6251('0x16')]);}logger[_0x6251('0x14')](_0x6251('0x15'),_0x3bb767,_0x241324['error'][_0x6251('0x16')]);return _0x38e845(_0x241324[_0x6251('0x14')][_0x6251('0x16')]);}else{logger[_0x6251('0xf')](_0x6251('0x15'),_0x3bb767,'request\x20sent');_0x38e845(_0x241324[_0x6251('0x17')][_0x6251('0x16')]);}})['catch'](function(_0x38f7da){logger[_0x6251('0x14')](_0x6251('0x15'),_0x3bb767,_0x38f7da);_0x1a5b28(_0x38f7da);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index 1a389fd..85b9f67 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 _0x47f4=['util','path','express','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','isAuthenticated','index','describe','/:id','show','/:id/download','download','/:id/downloads','downloads','downloadTranscribe','post','create','runTranscribe','update','delete','destroy','exports','multer'];(function(_0x307b9b,_0x517387){var _0x15b860=function(_0x38b625){while(--_0x38b625){_0x307b9b['push'](_0x307b9b['shift']());}};_0x15b860(++_0x517387);}(_0x47f4,0x18f));var _0x447f=function(_0x555c90,_0x10e8b7){_0x555c90=_0x555c90-0x0;var _0x116545=_0x47f4[_0x555c90];return _0x116545;};'use strict';var multer=require(_0x447f('0x0'));var util=require(_0x447f('0x1'));var path=require(_0x447f('0x2'));var timeout=require('connect-timeout');var express=require(_0x447f('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x447f('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x447f('0x5'));var controller=require(_0x447f('0x6'));router[_0x447f('0x7')]('/',auth[_0x447f('0x8')](),controller[_0x447f('0x9')]);router[_0x447f('0x7')]('/describe',auth[_0x447f('0x8')](),controller[_0x447f('0xa')]);router[_0x447f('0x7')](_0x447f('0xb'),auth[_0x447f('0x8')](),controller[_0x447f('0xc')]);router[_0x447f('0x7')](_0x447f('0xd'),auth[_0x447f('0x8')](),controller[_0x447f('0xe')]);router['get'](_0x447f('0xf'),controller[_0x447f('0x10')]);router[_0x447f('0x7')]('/:id/transcribe',auth[_0x447f('0x8')](),controller[_0x447f('0x11')]);router[_0x447f('0x12')]('/',auth[_0x447f('0x8')](),controller[_0x447f('0x13')]);router[_0x447f('0x12')]('/:id/transcribe',auth['isAuthenticated'](),controller[_0x447f('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x447f('0x15')]);router[_0x447f('0x16')](_0x447f('0xb'),auth[_0x447f('0x8')](),controller[_0x447f('0x17')]);module[_0x447f('0x18')]=router; \ No newline at end of file +var _0xb64b=['/:id/downloads','downloadTranscribe','create','post','runTranscribe','put','update','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','get','/describe','describe','/:id','isAuthenticated','show','/:id/download','download'];(function(_0x2716c6,_0x1a492f){var _0x536cb0=function(_0x5067e3){while(--_0x5067e3){_0x2716c6['push'](_0x2716c6['shift']());}};_0x536cb0(++_0x1a492f);}(_0xb64b,0xe9));var _0xbb64=function(_0x4d82e1,_0x5ac72b){_0x4d82e1=_0x4d82e1-0x0;var _0x5f3bd9=_0xb64b[_0x4d82e1];return _0x5f3bd9;};'use strict';var multer=require(_0xbb64('0x0'));var util=require(_0xbb64('0x1'));var path=require(_0xbb64('0x2'));var timeout=require(_0xbb64('0x3'));var express=require(_0xbb64('0x4'));var router=express[_0xbb64('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xbb64('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xbb64('0x7'));var controller=require(_0xbb64('0x8'));router[_0xbb64('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbb64('0x9')](_0xbb64('0xa'),auth['isAuthenticated'](),controller[_0xbb64('0xb')]);router[_0xbb64('0x9')](_0xbb64('0xc'),auth[_0xbb64('0xd')](),controller[_0xbb64('0xe')]);router[_0xbb64('0x9')](_0xbb64('0xf'),auth[_0xbb64('0xd')](),controller[_0xbb64('0x10')]);router[_0xbb64('0x9')](_0xbb64('0x11'),controller['downloads']);router[_0xbb64('0x9')]('/:id/transcribe',auth[_0xbb64('0xd')](),controller[_0xbb64('0x12')]);router['post']('/',auth['isAuthenticated'](),controller[_0xbb64('0x13')]);router[_0xbb64('0x14')]('/:id/transcribe',auth[_0xbb64('0xd')](),controller[_0xbb64('0x15')]);router[_0xbb64('0x16')](_0xbb64('0xc'),auth['isAuthenticated'](),controller[_0xbb64('0x17')]);router['delete']('/:id',auth[_0xbb64('0xd')](),controller[_0xbb64('0x18')]);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 5d1aa24..48073b5 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(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'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(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'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 406bd23..ed23935 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 _0xda4a=['[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','decryptFile','Voice\x20Recording\x20not\x20found','Setting','findOne','transcribeAccountId','transcribeRegion','language','Transcribe\x20not\x20configured','runSentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','fileText','root','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','aws-sdk','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','count','limit','set','Content-Range','apply','save','update','destroy','then','end','stack','name','send','index','map','VoiceRecording','rawAttributes','fieldName','key','model','differenceBy','format','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','create','body','describe','download','../../components/encryptor','uniqueid','params','find','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','MD5','token','push','$and','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','info','unlinkSync','.cypher','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','startTranscriptionJob'];(function(_0x1fe928,_0x5e908b){var _0x499b7a=function(_0xee1064){while(--_0xee1064){_0x1fe928['push'](_0x1fe928['shift']());}};_0x499b7a(++_0x5e908b);}(_0xda4a,0x169));var _0xada4=function(_0xd49c02,_0x51bbd4){_0xd49c02=_0xd49c02-0x0;var _0x2b346d=_0xda4a[_0xd49c02];return _0x2b346d;};'use strict';var emlformat=require(_0xada4('0x0'));var rimraf=require(_0xada4('0x1'));var zipdir=require(_0xada4('0x2'));var jsonpatch=require(_0xada4('0x3'));var rp=require(_0xada4('0x4'));var moment=require('moment');var BPromise=require(_0xada4('0x5'));var Mustache=require('mustache');var util=require(_0xada4('0x6'));var path=require(_0xada4('0x7'));var sox=require(_0xada4('0x8'));var csv=require(_0xada4('0x9'));var ejs=require(_0xada4('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xada4('0xb'));var squel=require('squel');var crypto=require(_0xada4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xada4('0xd'));var toCsv=require(_0xada4('0x9'));var querystring=require(_0xada4('0xe'));var Papa=require(_0xada4('0xf'));var AWS=require(_0xada4('0x10'));var uuidv4=require('uuid/v4');var Redis=require(_0xada4('0x11'));var authService=require(_0xada4('0x12'));var qs=require(_0xada4('0x13'));var as=require(_0xada4('0x14'));var hardwareService=require(_0xada4('0x15'));var logger=require(_0xada4('0x16'))(_0xada4('0x17'));var utils=require(_0xada4('0x18'));var config=require(_0xada4('0x19'));var licenseUtil=require(_0xada4('0x1a'));var db=require(_0xada4('0x1b'))['db'];function respondWithStatusCode(_0x1ee7ed,_0x2e8835){_0x2e8835=_0x2e8835||0xcc;return function(_0x5cc839){if(_0x5cc839){return _0x1ee7ed[_0xada4('0x1c')](_0x2e8835);}return _0x1ee7ed['status'](_0x2e8835)['end']();};}function respondWithResult(_0x1fff04,_0x9424bd){_0x9424bd=_0x9424bd||0xc8;return function(_0x4d49bb){if(_0x4d49bb){return _0x1fff04[_0xada4('0x1d')](_0x9424bd)[_0xada4('0x1e')](_0x4d49bb);}};}function respondWithFilteredResult(_0x2978fd,_0x407327){return function(_0x2e32bd){if(_0x2e32bd){var _0x386b83=typeof _0x407327[_0xada4('0x1f')]===_0xada4('0x20')&&typeof _0x407327['limit']==='undefined';var _0x1c0613=_0x2e32bd[_0xada4('0x21')];var _0x5e682b=_0x386b83?0x0:_0x407327[_0xada4('0x1f')];var _0x538fc8=_0x386b83?_0x2e32bd[_0xada4('0x21')]:_0x407327[_0xada4('0x1f')]+_0x407327[_0xada4('0x22')];var _0x32d78f;if(_0x538fc8>=_0x1c0613){_0x538fc8=_0x1c0613;_0x32d78f=0xc8;}else{_0x32d78f=0xce;}_0x2978fd['status'](_0x32d78f);return _0x2978fd[_0xada4('0x23')](_0xada4('0x24'),_0x5e682b+'-'+_0x538fc8+'/'+_0x1c0613)[_0xada4('0x1e')](_0x2e32bd);}return null;};}function patchUpdates(_0xd840e0){return function(_0x2501c7){try{jsonpatch[_0xada4('0x25')](_0x2501c7,_0xd840e0,!![]);}catch(_0x318dce){return BPromise['reject'](_0x318dce);}return _0x2501c7[_0xada4('0x26')]();};}function saveUpdates(_0x287b90,_0x21d667){return function(_0x5a020d){if(_0x5a020d){return _0x5a020d[_0xada4('0x27')](_0x287b90)['then'](function(_0x4425e6){return _0x4425e6;});}return null;};}function removeEntity(_0x52c654,_0x3c8514){return function(_0x41a43c){if(_0x41a43c){return _0x41a43c[_0xada4('0x28')]()[_0xada4('0x29')](function(){_0x52c654[_0xada4('0x1d')](0xcc)[_0xada4('0x2a')]();});}};}function handleEntityNotFound(_0x361c6e,_0x364f33){return function(_0x1cf9a0){if(!_0x1cf9a0){_0x361c6e[_0xada4('0x1c')](0x194);}return _0x1cf9a0;};}function handleError(_0xd2436c,_0x17b169){_0x17b169=_0x17b169||0x1f4;return function(_0x2fff1f){logger['error'](_0x2fff1f[_0xada4('0x2b')]);if(_0x2fff1f['name']){delete _0x2fff1f[_0xada4('0x2c')];}_0xd2436c[_0xada4('0x1d')](_0x17b169)[_0xada4('0x2d')](_0x2fff1f);};}exports[_0xada4('0x2e')]=function(_0x246bb7,_0x1b0bb6){var _0xc17c9f={},_0x4a6423={},_0x5829bb={'count':0x0,'rows':[]};var _0xfcf5bf=_[_0xada4('0x2f')](db[_0xada4('0x30')][_0xada4('0x31')],function(_0x33918d){return{'name':_0x33918d[_0xada4('0x32')],'type':_0x33918d['type'][_0xada4('0x33')]};});_0x4a6423[_0xada4('0x34')]=_[_0xada4('0x35')](_[_0xada4('0x2f')](_0xfcf5bf,'name'),[_0xada4('0x36')]);_0x4a6423['query']=_[_0xada4('0x37')](_0x246bb7[_0xada4('0x38')]);_0x4a6423['filters']=_[_0xada4('0x39')](_0x4a6423[_0xada4('0x34')],_0x4a6423[_0xada4('0x38')]);_0xc17c9f[_0xada4('0x3a')]=_[_0xada4('0x39')](_0x4a6423[_0xada4('0x34')],qs[_0xada4('0x3b')](_0x246bb7['query'][_0xada4('0x3b')]));_0xc17c9f[_0xada4('0x3a')]=_0xc17c9f['attributes'][_0xada4('0x3c')]?_0xc17c9f[_0xada4('0x3a')]:_0x4a6423[_0xada4('0x34')];if(!_0x246bb7['query'][_0xada4('0x3d')]('nolimit')){_0xc17c9f[_0xada4('0x22')]=qs[_0xada4('0x22')](_0x246bb7[_0xada4('0x38')][_0xada4('0x22')]);_0xc17c9f[_0xada4('0x1f')]=qs[_0xada4('0x1f')](_0x246bb7[_0xada4('0x38')][_0xada4('0x1f')]);}_0xc17c9f[_0xada4('0x3e')]=qs[_0xada4('0x3f')](_0x246bb7[_0xada4('0x38')][_0xada4('0x3f')]);_0xc17c9f[_0xada4('0x40')]=qs[_0xada4('0x41')](_[_0xada4('0x42')](_0x246bb7['query'],_0x4a6423[_0xada4('0x41')]),_0xfcf5bf);if(_0x246bb7[_0xada4('0x38')][_0xada4('0x43')]){_0xc17c9f[_0xada4('0x40')]=_['merge'](_0xc17c9f[_0xada4('0x40')],{'$or':_[_0xada4('0x2f')](_0xfcf5bf,function(_0x512286){if(_0x512286[_0xada4('0x44')]!==_0xada4('0x45')){var _0x5519a2={};_0x5519a2[_0x512286[_0xada4('0x2c')]]={'$like':'%'+_0x246bb7['query'][_0xada4('0x43')]+'%'};return _0x5519a2;}})});}_0xc17c9f=_[_0xada4('0x46')]({},_0xc17c9f,_0x246bb7[_0xada4('0x47')]);var _0xf389c5={'where':_0xc17c9f['where']};return db['VoiceRecording']['count'](_0xf389c5)[_0xada4('0x29')](function(_0x5e19d9){_0x5829bb[_0xada4('0x21')]=_0x5e19d9;if(_0x246bb7['query'][_0xada4('0x48')]){_0xc17c9f[_0xada4('0x49')]=[{'all':!![]}];}return db[_0xada4('0x30')]['findAll'](_0xc17c9f);})[_0xada4('0x29')](function(_0x1c5448){_0x5829bb[_0xada4('0x4a')]=_0x1c5448;return _0x5829bb;})[_0xada4('0x29')](respondWithFilteredResult(_0x1b0bb6,_0xc17c9f))[_0xada4('0x4b')](handleError(_0x1b0bb6,null));};exports[_0xada4('0x4c')]=function(_0xf2645f,_0x43a87b){var _0x40da3b={'raw':![],'where':{'id':_0xf2645f['params']['id']}},_0x3fca78={};_0x3fca78[_0xada4('0x34')]=_['keys'](db[_0xada4('0x30')][_0xada4('0x31')]);_0x3fca78['query']=_[_0xada4('0x37')](_0xf2645f[_0xada4('0x38')]);_0x3fca78['filters']=_[_0xada4('0x39')](_0x3fca78[_0xada4('0x34')],_0x3fca78['query']);_0x40da3b['attributes']=_[_0xada4('0x39')](_0x3fca78[_0xada4('0x34')],qs[_0xada4('0x3b')](_0xf2645f[_0xada4('0x38')][_0xada4('0x3b')]));_0x40da3b[_0xada4('0x3a')]=_0x40da3b['attributes'][_0xada4('0x3c')]?_0x40da3b[_0xada4('0x3a')]:_0x3fca78[_0xada4('0x34')];if(_0xf2645f[_0xada4('0x38')][_0xada4('0x48')]){_0x40da3b[_0xada4('0x49')]=[{'all':!![]}];}_0x40da3b=_[_0xada4('0x46')]({},_0x40da3b,_0xf2645f[_0xada4('0x47')]);return db[_0xada4('0x30')]['find'](_0x40da3b)[_0xada4('0x29')](handleEntityNotFound(_0x43a87b,null))['then'](respondWithResult(_0x43a87b,null))['catch'](handleError(_0x43a87b,null));};exports[_0xada4('0x4d')]=function(_0x326487,_0x5441c9){return db['VoiceRecording'][_0xada4('0x4d')](_0x326487['body'],{})['then'](respondWithResult(_0x5441c9,0xc9))[_0xada4('0x4b')](handleError(_0x5441c9,null));};exports['update']=function(_0x2ddd8d,_0x4a0a0d){if(_0x2ddd8d[_0xada4('0x4e')]['id']){delete _0x2ddd8d[_0xada4('0x4e')]['id'];}return db[_0xada4('0x30')]['find']({'where':{'id':_0x2ddd8d['params']['id']}})[_0xada4('0x29')](handleEntityNotFound(_0x4a0a0d,null))[_0xada4('0x29')](saveUpdates(_0x2ddd8d[_0xada4('0x4e')],null))['then'](respondWithResult(_0x4a0a0d,null))[_0xada4('0x4b')](handleError(_0x4a0a0d,null));};exports['describe']=function(_0x212026,_0x1f900f){return db[_0xada4('0x30')][_0xada4('0x4f')]()['then'](respondWithResult(_0x1f900f,null))[_0xada4('0x4b')](handleError(_0x1f900f,null));};exports[_0xada4('0x50')]=function(_0x9c9cbb,_0x314301,_0x58359b){var _0x186108=require(_0xada4('0x51'));var _0x10fba9=![];var _0x114745={};if(_0x9c9cbb[_0xada4('0x38')][_0xada4('0x44')]&&_0x9c9cbb[_0xada4('0x38')][_0xada4('0x44')]===_0xada4('0x52')){_0x114745[_0xada4('0x52')]=_0x9c9cbb[_0xada4('0x53')]['id'];}else{_0x114745['id']=_0x9c9cbb['params']['id'];}return db[_0xada4('0x30')][_0xada4('0x54')]({'where':_0x114745,'attributes':['id',_0xada4('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0x314301,null))[_0xada4('0x29')](function(_0x2c2f38){if(_0x2c2f38){var _0x1c14a9=_0x2c2f38['value'];var _0x12ab57=util[_0xada4('0x36')](_0xada4('0x56'),_0x1c14a9);if(fs[_0xada4('0x57')](_0x12ab57)){_0x10fba9=!![];return _0x186108['decryptFile'](_0x12ab57,_0x1c14a9,config[_0xada4('0x58')][_0xada4('0x59')])[_0xada4('0x29')](function(){return _0x2c2f38;});}return _0x2c2f38;}})[_0xada4('0x29')](function(_0x56329f){if(_0x56329f){var _0x3aefbc=_0x56329f[_0xada4('0x55')];if(!fs[_0xada4('0x57')](_0x3aefbc)){throw new db[(_0xada4('0x5a'))][(_0xada4('0x5b'))](_0xada4('0x5c'));}if(_0x56329f[_0xada4('0x5d')]){return _0x314301['download'](_0x3aefbc,_0x56329f[_0xada4('0x5d')]+path[_0xada4('0x5e')](_0x3aefbc),function(){if(_0x10fba9){fs[_0xada4('0x5f')](_0x3aefbc);}});}else{return _0x314301[_0xada4('0x50')](_0x3aefbc,function(_0x512ed5){if(_0x10fba9){fs[_0xada4('0x5f')](_0x3aefbc);}});}}})[_0xada4('0x4b')](function(_0x7ef85d){if(_0x7ef85d[_0xada4('0x60')]===_0xada4('0x5c')){_0x314301[_0xada4('0x1d')](0x194)[_0xada4('0x2d')](_0xada4('0x61'));}else{return handleError(_0x314301,null);}});};exports[_0xada4('0x62')]=function(_0x14671a,_0xa26657,_0x4a809f){var _0x29c79f=require(_0xada4('0x51'));var _0x6fb06d=![];var _0x58d847={'$and':[db[_0xada4('0x63')][_0xada4('0x40')](db[_0xada4('0x63')]['fn'](_0xada4('0x64'),db['sequelize']['col'](_0xada4('0x52'))),_0x14671a[_0xada4('0x38')][_0xada4('0x65')])]};if(_0x14671a[_0xada4('0x38')]['type']&&_0x14671a['query'][_0xada4('0x44')]==='uniqueid'){_0x58d847['$and'][_0xada4('0x66')]({'uniqueid':_0x14671a[_0xada4('0x53')]['id']});}else{_0x58d847[_0xada4('0x67')]['push']({'id':_0x14671a[_0xada4('0x53')]['id']});}return db[_0xada4('0x30')][_0xada4('0x54')]({'where':_0x58d847,'attributes':['id',_0xada4('0x55')],'raw':!![]})['then'](handleEntityNotFound(_0xa26657,null))[_0xada4('0x29')](function(_0x246b73){if(_0x246b73){var _0x3e5d35=util['format'](_0xada4('0x56'),_0x246b73[_0xada4('0x55')]);if(fs[_0xada4('0x57')](_0x3e5d35)){_0x6fb06d=!![];return _0x29c79f['decryptFile'](_0x3e5d35,_0x246b73[_0xada4('0x55')],config[_0xada4('0x58')][_0xada4('0x59')])['then'](function(){return _0x246b73;});}return _0x246b73;}})[_0xada4('0x29')](function(_0x4315c7){if(_0x4315c7){if(!fs[_0xada4('0x57')](_0x4315c7[_0xada4('0x55')])){throw new db[(_0xada4('0x5a'))]['ValidationError'](_0xada4('0x5c'));}if(_0x4315c7['filename']){return _0xa26657['download'](_0x4315c7[_0xada4('0x55')],_0x4315c7[_0xada4('0x5d')]+path[_0xada4('0x5e')](_0x4315c7[_0xada4('0x55')]),function(){if(_0x6fb06d){fs[_0xada4('0x5f')](_0x4315c7[_0xada4('0x55')]);}});}else{return _0xa26657[_0xada4('0x50')](_0x4315c7[_0xada4('0x55')],function(_0x87e262){if(_0x6fb06d){fs[_0xada4('0x5f')](_0x4315c7[_0xada4('0x55')]);}});}}})[_0xada4('0x4b')](handleError(_0xa26657,null));};exports[_0xada4('0x28')]=function(_0x2bc88a,_0x172751){return db['VoiceRecording']['find']({'where':{'id':_0x2bc88a[_0xada4('0x53')]['id']}})[_0xada4('0x29')](function(_0x2aea02){if(_[_0xada4('0x68')](_0x2aea02)){throw new ReferenceError(_0xada4('0x69'));}return _0x2aea02;})[_0xada4('0x29')](function(_0x23143a){var _0x508810=_0x23143a[_0xada4('0x55')];logger['info'](_0xada4('0x6a'),_0x508810);if(!_[_0xada4('0x68')](_0x23143a['value'])&&fs[_0xada4('0x57')](_0x508810)){logger[_0xada4('0x6b')]('File:\x20\x22'+_0x508810+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xada4('0x6c')](_0x508810);}_0x508810=_0x508810+_0xada4('0x6d');if(!_['isNil'](_0x23143a[_0xada4('0x55')])&&fs[_0xada4('0x57')](_0x508810)){logger[_0xada4('0x6b')](_0xada4('0x6e')+_0x508810+_0xada4('0x6f'));fs[_0xada4('0x6c')](_0x508810);}return _0x23143a;})[_0xada4('0x29')](function(_0x1fc46d){if(!_0x1fc46d)throw new InternalError();return _0x1fc46d[_0xada4('0x28')]();})[_0xada4('0x29')](function(){_0x172751[_0xada4('0x1d')](0xcc)[_0xada4('0x2a')]();})[_0xada4('0x4b')](handleError(_0x172751,null));};function getBucketslist(_0x49363b,_0x1098ba,_0x50b67e){return new Promise(function(_0x471957,_0x1511c3){var _0x25c4b3=new AWS['S3']({'accessKeyId':_0x1098ba,'secretAccessKey':_0x49363b,'region':_0x50b67e});_0x25c4b3[_0xada4('0x70')]({},function(_0x5e9c8d,_0xbbdcb1){if(_0x5e9c8d){return _0x1511c3(_0x5e9c8d);}else{return _0x471957(_0xbbdcb1);}});});}function createBucket(_0x1f8e87,_0x39f1bc,_0x4b907b,_0x5ef92c){return new Promise(function(_0x20d7a2,_0x3e412c){var _0x1c033e=new AWS['S3']({'accessKeyId':_0x39f1bc,'secretAccessKey':_0x1f8e87,'region':_0x4b907b});_0x1c033e[_0xada4('0x71')]({'Bucket':_0x5ef92c},function(_0x49dc84,_0x1d9f20){if(_0x49dc84){return _0x3e412c(_0x49dc84);}else{return _0x20d7a2(_0x1d9f20);}});});}function uploadFile(_0x558cd4,_0x1a40cd,_0x2bd059,_0x23a9cd,_0x340f68,_0x15a72a){return new Promise(function(_0x54b7a8,_0xe049cb){var _0x2fea87=new AWS['S3']({'accessKeyId':_0x1a40cd,'secretAccessKey':_0x558cd4,'region':_0x2bd059});_0x2fea87[_0xada4('0x72')]({'Bucket':_0x23a9cd,'Key':_0x340f68,'Body':_0x15a72a},function(_0x26fc02,_0xc79880){if(_0x26fc02){return _0xe049cb(_0x26fc02);}else{return _0x54b7a8(_0xc79880);}});});}function startTranscribe(_0x453328,_0x4d3f9a,_0x2b6039,_0x4809f0,_0x50c2ee,_0x47269e){return new Promise(function(_0x3b1cea,_0x4c2be5){var _0x24b504=new AWS['TranscribeService']({'accessKeyId':_0x4d3f9a,'secretAccessKey':_0x453328,'region':_0x2b6039});_0x24b504[_0xada4('0x73')]({'TranscriptionJobName':_0x4809f0,'LanguageCode':_0x50c2ee,'Media':{'MediaFileUri':_0x47269e}},function(_0x582f8d,_0x3d7731){if(_0x582f8d){return _0x4c2be5(_0x582f8d);}else{return _0x3b1cea(_0x3d7731);}});});}function transcribe(_0x4c4034,_0x24b962,_0x150994,_0x3df0a0,_0x3e5128,_0x4305ac,_0x4682d4){return new Promise(function(_0x5e27ec,_0x10c652){var _0x1dca6f={};logger[_0xada4('0x6b')](util[_0xada4('0x36')](_0xada4('0x74'),_0x4c4034,_0x3e5128));return uploadFile(_0x24b962,_0x150994,_0x3df0a0,_0x3e5128,path[_0xada4('0x75')](_0x4305ac),fs['readFileSync'](_0x4305ac))[_0xada4('0x29')](function(_0x5da4a3){logger['info'](util['format'](_0xada4('0x76'),_0x4c4034,_0x3e5128,_0x5da4a3[_0xada4('0x77')]));_0x1dca6f[_0xada4('0x78')]=_0x5da4a3[_0xada4('0x79')];_0x1dca6f[_0xada4('0x7a')]=_0x5da4a3[_0xada4('0x77')];logger['info'](util['format'](_0xada4('0x7b'),_0x4c4034));return startTranscribe(_0x24b962,_0x150994,_0x3df0a0,uuidv4(),_0x4682d4,_0x5da4a3[_0xada4('0x77')]);})[_0xada4('0x29')](function(_0x40d4be){logger[_0xada4('0x6b')](util['format'](_0xada4('0x7c'),_0x4c4034,_0x40d4be[_0xada4('0x7d')][_0xada4('0x7e')]));_0x1dca6f[_0xada4('0x7f')]=_0x40d4be[_0xada4('0x7d')][_0xada4('0x7e')];_0x1dca6f[_0xada4('0x80')]=_0x40d4be[_0xada4('0x7d')][_0xada4('0x81')];return _0x5e27ec(_0x1dca6f);})[_0xada4('0x4b')](function(_0x3dbf86){return _0x10c652(_0x3dbf86);});});}exports[_0xada4('0x82')]=function(_0x2a0425,_0x41af15,_0xfa1399){var _0x7fac2c;var _0x53bb35;var _0x24c4e4;var _0x283787=require(_0xada4('0x51'));return db[_0xada4('0x30')]['findOne']({'where':{'id':_0x2a0425['params']['id']}})['then'](function(_0x3d1437){if(_0x3d1437){var _0x13e02a=util[_0xada4('0x36')](_0xada4('0x56'),_0x3d1437['value']);if(fs[_0xada4('0x57')](_0x13e02a)){cypher=!![];return _0x283787[_0xada4('0x83')](_0x13e02a,_0x3d1437[_0xada4('0x55')],config[_0xada4('0x58')][_0xada4('0x59')])[_0xada4('0x29')](function(){return _0x3d1437;});}return _0x3d1437;}})[_0xada4('0x29')](function(_0x72c58d){if(!_0x72c58d){throw new db[(_0xada4('0x5a'))][(_0xada4('0x5b'))](_0xada4('0x84'));}_0x53bb35=_0x72c58d;return db[_0xada4('0x85')][_0xada4('0x86')]({'where':{'id':0x1}});})[_0xada4('0x29')](handleEntityNotFound(_0x41af15,null))[_0xada4('0x29')](function(_0x46b5d0){if(_0x46b5d0){_0x7fac2c=_0x46b5d0;if(!_0x7fac2c['transcribe']||!_0x7fac2c[_0xada4('0x87')]||!_0x7fac2c[_0xada4('0x88')]||!_0x7fac2c[_0xada4('0x89')]||!_0x7fac2c[_0xada4('0x78')]){throw new db[(_0xada4('0x5a'))][(_0xada4('0x5b'))](_0xada4('0x8a'));}if(_0x2a0425[_0xada4('0x4e')][_0xada4('0x8b')]&&(!_0x7fac2c['sentiment']||!_0x7fac2c['sentimentAccountId']||!_0x7fac2c[_0xada4('0x8c')]||!_0x7fac2c['language']||!_0x7fac2c[_0xada4('0x78')])){throw new db['Sequelize'][(_0xada4('0x5b'))](_0xada4('0x8d'));}return db[_0xada4('0x8e')][_0xada4('0x86')]({'where':{'id':_0x7fac2c[_0xada4('0x87')]}});}})[_0xada4('0x29')](function(_0x2d6859){if(!_0x2d6859){throw new db['Sequelize'][(_0xada4('0x5b'))](_0xada4('0x8f'));}if(!_0x2d6859[_0xada4('0x90')]||!_0x2d6859[_0xada4('0x91')]){throw new db[(_0xada4('0x5a'))][(_0xada4('0x5b'))](_0xada4('0x92'));}_0x24c4e4=_0x2d6859;return getBucketslist(_0x24c4e4[_0xada4('0x90')],_0x24c4e4['data2'],_0x7fac2c[_0xada4('0x88')]);})['then'](function(_0x3ad1ef){if(_0x3ad1ef&&_0x3ad1ef[_0xada4('0x93')]){var _0x2f144f=_[_0xada4('0x54')](_0x3ad1ef[_0xada4('0x93')],function(_0x416dd7){return _0x416dd7[_0xada4('0x94')]===_0x7fac2c['bucket'];});if(!_0x2f144f){logger[_0xada4('0x6b')](util['format'](_0xada4('0x95'),_0x2a0425[_0xada4('0x53')]['id'],_0x7fac2c[_0xada4('0x78')]));return createBucket(_0x24c4e4[_0xada4('0x90')],_0x24c4e4[_0xada4('0x91')],_0x7fac2c[_0xada4('0x88')],_0x7fac2c[_0xada4('0x78')]);}logger[_0xada4('0x6b')](util[_0xada4('0x36')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x2a0425[_0xada4('0x53')]['id'],_0x7fac2c[_0xada4('0x78')]));return;}})[_0xada4('0x29')](function(_0x30c84f){if(_0x53bb35[_0xada4('0x80')]===_0xada4('0x96')){return transcribe(_0x2a0425[_0xada4('0x53')]['id'],_0x24c4e4['data1'],_0x24c4e4[_0xada4('0x91')],_0x7fac2c[_0xada4('0x88')],_0x7fac2c[_0xada4('0x78')],_0x53bb35[_0xada4('0x55')],_0x7fac2c[_0xada4('0x89')]);}else{logger[_0xada4('0x6b')](util[_0xada4('0x36')](_0xada4('0x97'),_0x2a0425[_0xada4('0x53')]['id']));return{'transcribeStatus':_0xada4('0x98')};}})[_0xada4('0x29')](function(_0x13bba6){if(_0x13bba6){_0x13bba6[_0xada4('0x99')]=_0x2a0425[_0xada4('0x4e')][_0xada4('0x8b')];return _0x53bb35[_0xada4('0x9a')](_0x13bba6);}})[_0xada4('0x29')](respondWithResult(_0x41af15,null))[_0xada4('0x4b')](handleError(_0x41af15,null));};function writeFile(_0x326222,_0x1472eb){return new Promise(function(_0x209d98,_0x48b78f){fs['writeFile'](_0x1472eb,_0x326222,function(_0x32bd7a,_0x1ab061){if(_0x32bd7a){return _0x48b78f(_0x32bd7a);}else{return _0x209d98(_0x1ab061);}});});}exports['downloadTranscribe']=function(_0x25ebbb,_0x40c674,_0x4786ca){return db[_0xada4('0x30')][_0xada4('0x86')]({'where':{'id':_0x25ebbb[_0xada4('0x53')]['id']}})[_0xada4('0x29')](handleEntityNotFound(_0x40c674))[_0xada4('0x29')](function(_0x13b7a3){if(_0x13b7a3&&_0x13b7a3[_0xada4('0x9b')]){var _0x28ba10=_0x13b7a3[_0xada4('0x9b')];var _0x115b30=config[_0xada4('0x9c')]+'/server/files/transcribes/transcribe_'+_0x13b7a3['id']+_0xada4('0x9d');if(fs[_0xada4('0x57')](_0x115b30)){return _0x115b30;}return writeFile(_0x28ba10,_0x115b30)[_0xada4('0x29')](function(){return _0x115b30;});}else{throw new db[(_0xada4('0x5a'))]['ValidationError'](_0xada4('0x9e'));}})[_0xada4('0x29')](function(_0x2034d8){return _0x40c674['download'](_0x2034d8);})[_0xada4('0x4b')](handleError(_0x40c674));}; \ No newline at end of file +var _0xe4cf=['runSentiment','sentiment','sentimentAccountId','language','Sentiment\x20Analysis\x20not\x20configured','CloudProvider','transcribeAccountId','Cloud\x20Provider\x20not\x20available','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','Transcript\x20not\x20available','eml-format','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','papaparse','aws-sdk','uuid/v4','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','name','send','index','map','VoiceRecording','fieldName','key','model','differenceBy','format','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','rawAttributes','length','include','find','catch','create','body','describe','../../components/encryptor','uniqueid','value','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','extname','download','message','Not\x20found','downloads','sequelize','token','push','$and','%s.cypher','secrets','filename','unlink','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','upload','TranscribeService','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribeRegion','Transcribe\x20not\x20configured'];(function(_0x5d8ef7,_0x39109a){var _0x4b4070=function(_0x464a0a){while(--_0x464a0a){_0x5d8ef7['push'](_0x5d8ef7['shift']());}};_0x4b4070(++_0x39109a);}(_0xe4cf,0x141));var _0xfe4c=function(_0x431b45,_0x40b3c8){_0x431b45=_0x431b45-0x0;var _0x21b559=_0xe4cf[_0x431b45];return _0x21b559;};'use strict';var emlformat=require(_0xfe4c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfe4c('0x1'));var rp=require(_0xfe4c('0x2'));var moment=require(_0xfe4c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfe4c('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xfe4c('0x5'));var ejs=require(_0xfe4c('0x6'));var fs=require('fs');var fs_extra=require(_0xfe4c('0x7'));var _=require(_0xfe4c('0x8'));var squel=require('squel');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(_0xfe4c('0x9'));var AWS=require(_0xfe4c('0xa'));var uuidv4=require(_0xfe4c('0xb'));var Redis=require('ioredis');var authService=require(_0xfe4c('0xc'));var qs=require(_0xfe4c('0xd'));var as=require(_0xfe4c('0xe'));var hardwareService=require(_0xfe4c('0xf'));var logger=require(_0xfe4c('0x10'))('api');var utils=require('../../config/utils');var config=require(_0xfe4c('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xfe4c('0x12'))['db'];function respondWithStatusCode(_0xeb317e,_0x4b50de){_0x4b50de=_0x4b50de||0xcc;return function(_0x13610f){if(_0x13610f){return _0xeb317e[_0xfe4c('0x13')](_0x4b50de);}return _0xeb317e[_0xfe4c('0x14')](_0x4b50de)[_0xfe4c('0x15')]();};}function respondWithResult(_0x5575da,_0x5953ff){_0x5953ff=_0x5953ff||0xc8;return function(_0x55868e){if(_0x55868e){return _0x5575da[_0xfe4c('0x14')](_0x5953ff)[_0xfe4c('0x16')](_0x55868e);}};}function respondWithFilteredResult(_0x2b844b,_0x1f1d46){return function(_0xbd280a){if(_0xbd280a){var _0xe58903=typeof _0x1f1d46[_0xfe4c('0x17')]===_0xfe4c('0x18')&&typeof _0x1f1d46['limit']===_0xfe4c('0x18');var _0x36a7fe=_0xbd280a['count'];var _0x270021=_0xe58903?0x0:_0x1f1d46[_0xfe4c('0x17')];var _0x4ecb80=_0xe58903?_0xbd280a[_0xfe4c('0x19')]:_0x1f1d46['offset']+_0x1f1d46[_0xfe4c('0x1a')];var _0x311e97;if(_0x4ecb80>=_0x36a7fe){_0x4ecb80=_0x36a7fe;_0x311e97=0xc8;}else{_0x311e97=0xce;}_0x2b844b[_0xfe4c('0x14')](_0x311e97);return _0x2b844b[_0xfe4c('0x1b')](_0xfe4c('0x1c'),_0x270021+'-'+_0x4ecb80+'/'+_0x36a7fe)[_0xfe4c('0x16')](_0xbd280a);}return null;};}function patchUpdates(_0x556330){return function(_0x3b0aae){try{jsonpatch['apply'](_0x3b0aae,_0x556330,!![]);}catch(_0x4a873b){return BPromise[_0xfe4c('0x1d')](_0x4a873b);}return _0x3b0aae[_0xfe4c('0x1e')]();};}function saveUpdates(_0x24a37e,_0x1a2351){return function(_0x1c60e4){if(_0x1c60e4){return _0x1c60e4[_0xfe4c('0x1f')](_0x24a37e)[_0xfe4c('0x20')](function(_0x32cb62){return _0x32cb62;});}return null;};}function removeEntity(_0x11812b,_0x28b8bc){return function(_0x551d3b){if(_0x551d3b){return _0x551d3b[_0xfe4c('0x21')]()[_0xfe4c('0x20')](function(){_0x11812b[_0xfe4c('0x14')](0xcc)[_0xfe4c('0x15')]();});}};}function handleEntityNotFound(_0x500117,_0x41bbca){return function(_0x83f0c){if(!_0x83f0c){_0x500117['sendStatus'](0x194);}return _0x83f0c;};}function handleError(_0x2c28fe,_0x3a1b56){_0x3a1b56=_0x3a1b56||0x1f4;return function(_0xf8ff4e){logger['error'](_0xf8ff4e['stack']);if(_0xf8ff4e[_0xfe4c('0x22')]){delete _0xf8ff4e[_0xfe4c('0x22')];}_0x2c28fe[_0xfe4c('0x14')](_0x3a1b56)[_0xfe4c('0x23')](_0xf8ff4e);};}exports[_0xfe4c('0x24')]=function(_0x5f1d8f,_0x246c5b){var _0x105709={},_0x348907={},_0x3630ac={'count':0x0,'rows':[]};var _0x4c64f1=_[_0xfe4c('0x25')](db[_0xfe4c('0x26')]['rawAttributes'],function(_0x3af016){return{'name':_0x3af016[_0xfe4c('0x27')],'type':_0x3af016['type'][_0xfe4c('0x28')]};});_0x348907[_0xfe4c('0x29')]=_[_0xfe4c('0x2a')](_['map'](_0x4c64f1,'name'),[_0xfe4c('0x2b')]);_0x348907[_0xfe4c('0x2c')]=_[_0xfe4c('0x2d')](_0x5f1d8f[_0xfe4c('0x2c')]);_0x348907[_0xfe4c('0x2e')]=_[_0xfe4c('0x2f')](_0x348907[_0xfe4c('0x29')],_0x348907[_0xfe4c('0x2c')]);_0x105709['attributes']=_['intersection'](_0x348907[_0xfe4c('0x29')],qs[_0xfe4c('0x30')](_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x30')]));_0x105709[_0xfe4c('0x31')]=_0x105709[_0xfe4c('0x31')]['length']?_0x105709[_0xfe4c('0x31')]:_0x348907[_0xfe4c('0x29')];if(!_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x32')](_0xfe4c('0x33'))){_0x105709[_0xfe4c('0x1a')]=qs[_0xfe4c('0x1a')](_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x1a')]);_0x105709[_0xfe4c('0x17')]=qs['offset'](_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x17')]);}_0x105709[_0xfe4c('0x34')]=qs['sort'](_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x35')]);_0x105709['where']=qs[_0xfe4c('0x2e')](_[_0xfe4c('0x36')](_0x5f1d8f[_0xfe4c('0x2c')],_0x348907[_0xfe4c('0x2e')]),_0x4c64f1);if(_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x37')]){_0x105709[_0xfe4c('0x38')]=_['merge'](_0x105709['where'],{'$or':_[_0xfe4c('0x25')](_0x4c64f1,function(_0x369226){if(_0x369226[_0xfe4c('0x39')]!==_0xfe4c('0x3a')){var _0x4a9e8b={};_0x4a9e8b[_0x369226[_0xfe4c('0x22')]]={'$like':'%'+_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x37')]+'%'};return _0x4a9e8b;}})});}_0x105709=_[_0xfe4c('0x3b')]({},_0x105709,_0x5f1d8f[_0xfe4c('0x3c')]);var _0x362956={'where':_0x105709[_0xfe4c('0x38')]};return db[_0xfe4c('0x26')][_0xfe4c('0x19')](_0x362956)['then'](function(_0x17b52d){_0x3630ac['count']=_0x17b52d;if(_0x5f1d8f[_0xfe4c('0x2c')][_0xfe4c('0x3d')]){_0x105709['include']=[{'all':!![]}];}return db[_0xfe4c('0x26')][_0xfe4c('0x3e')](_0x105709);})[_0xfe4c('0x20')](function(_0x3aa6a8){_0x3630ac[_0xfe4c('0x3f')]=_0x3aa6a8;return _0x3630ac;})['then'](respondWithFilteredResult(_0x246c5b,_0x105709))['catch'](handleError(_0x246c5b,null));};exports[_0xfe4c('0x40')]=function(_0xb382c1,_0x586a2c){var _0x5aeebb={'raw':![],'where':{'id':_0xb382c1[_0xfe4c('0x41')]['id']}},_0x2848e9={};_0x2848e9[_0xfe4c('0x29')]=_[_0xfe4c('0x2d')](db[_0xfe4c('0x26')][_0xfe4c('0x42')]);_0x2848e9[_0xfe4c('0x2c')]=_[_0xfe4c('0x2d')](_0xb382c1[_0xfe4c('0x2c')]);_0x2848e9[_0xfe4c('0x2e')]=_[_0xfe4c('0x2f')](_0x2848e9['model'],_0x2848e9[_0xfe4c('0x2c')]);_0x5aeebb[_0xfe4c('0x31')]=_[_0xfe4c('0x2f')](_0x2848e9[_0xfe4c('0x29')],qs[_0xfe4c('0x30')](_0xb382c1[_0xfe4c('0x2c')][_0xfe4c('0x30')]));_0x5aeebb[_0xfe4c('0x31')]=_0x5aeebb['attributes'][_0xfe4c('0x43')]?_0x5aeebb[_0xfe4c('0x31')]:_0x2848e9[_0xfe4c('0x29')];if(_0xb382c1[_0xfe4c('0x2c')][_0xfe4c('0x3d')]){_0x5aeebb[_0xfe4c('0x44')]=[{'all':!![]}];}_0x5aeebb=_[_0xfe4c('0x3b')]({},_0x5aeebb,_0xb382c1[_0xfe4c('0x3c')]);return db[_0xfe4c('0x26')][_0xfe4c('0x45')](_0x5aeebb)[_0xfe4c('0x20')](handleEntityNotFound(_0x586a2c,null))[_0xfe4c('0x20')](respondWithResult(_0x586a2c,null))[_0xfe4c('0x46')](handleError(_0x586a2c,null));};exports['create']=function(_0x4b77fc,_0xd88a97){return db[_0xfe4c('0x26')][_0xfe4c('0x47')](_0x4b77fc[_0xfe4c('0x48')],{})[_0xfe4c('0x20')](respondWithResult(_0xd88a97,0xc9))['catch'](handleError(_0xd88a97,null));};exports[_0xfe4c('0x1f')]=function(_0x32df7b,_0x1a4b6f){if(_0x32df7b['body']['id']){delete _0x32df7b['body']['id'];}return db[_0xfe4c('0x26')][_0xfe4c('0x45')]({'where':{'id':_0x32df7b[_0xfe4c('0x41')]['id']}})[_0xfe4c('0x20')](handleEntityNotFound(_0x1a4b6f,null))[_0xfe4c('0x20')](saveUpdates(_0x32df7b[_0xfe4c('0x48')],null))[_0xfe4c('0x20')](respondWithResult(_0x1a4b6f,null))[_0xfe4c('0x46')](handleError(_0x1a4b6f,null));};exports['describe']=function(_0x3a1aa3,_0x35a3e7){return db[_0xfe4c('0x26')][_0xfe4c('0x49')]()[_0xfe4c('0x20')](respondWithResult(_0x35a3e7,null))[_0xfe4c('0x46')](handleError(_0x35a3e7,null));};exports['download']=function(_0x7ff6bd,_0x5164ad,_0x2b1774){var _0x45716b=require(_0xfe4c('0x4a'));var _0x50e6fa=![];var _0x4e7615={};if(_0x7ff6bd[_0xfe4c('0x2c')][_0xfe4c('0x39')]&&_0x7ff6bd[_0xfe4c('0x2c')][_0xfe4c('0x39')]===_0xfe4c('0x4b')){_0x4e7615['uniqueid']=_0x7ff6bd[_0xfe4c('0x41')]['id'];}else{_0x4e7615['id']=_0x7ff6bd[_0xfe4c('0x41')]['id'];}return db['VoiceRecording'][_0xfe4c('0x45')]({'where':_0x4e7615,'attributes':['id',_0xfe4c('0x4c')],'raw':!![]})[_0xfe4c('0x20')](handleEntityNotFound(_0x5164ad,null))[_0xfe4c('0x20')](function(_0x341a7f){if(_0x341a7f){var _0x59c0bf=_0x341a7f[_0xfe4c('0x4c')];var _0x2fa11b=util['format']('%s.cypher',_0x59c0bf);if(fs[_0xfe4c('0x4d')](_0x2fa11b)){_0x50e6fa=!![];return _0x45716b[_0xfe4c('0x4e')](_0x2fa11b,_0x59c0bf,config['secrets'][_0xfe4c('0x4f')])[_0xfe4c('0x20')](function(){return _0x341a7f;});}return _0x341a7f;}})[_0xfe4c('0x20')](function(_0x383c82){if(_0x383c82){var _0xdc461b=_0x383c82[_0xfe4c('0x4c')];if(!fs[_0xfe4c('0x4d')](_0xdc461b)){throw new db[(_0xfe4c('0x50'))][(_0xfe4c('0x51'))](_0xfe4c('0x52'));}if(_0x383c82['filename']){return _0x5164ad['download'](_0xdc461b,_0x383c82['filename']+path[_0xfe4c('0x53')](_0xdc461b),function(){if(_0x50e6fa){fs['unlink'](_0xdc461b);}});}else{return _0x5164ad[_0xfe4c('0x54')](_0xdc461b,function(_0x574270){if(_0x50e6fa){fs['unlink'](_0xdc461b);}});}}})[_0xfe4c('0x46')](function(_0x9fd052){if(_0x9fd052[_0xfe4c('0x55')]===_0xfe4c('0x52')){_0x5164ad['status'](0x194)[_0xfe4c('0x23')](_0xfe4c('0x56'));}else{return handleError(_0x5164ad,null);}});};exports[_0xfe4c('0x57')]=function(_0x4903ee,_0x355d06,_0x36e4f8){var _0xd683c3=require('../../components/encryptor');var _0x47dca4=![];var _0x5bed8b={'$and':[db['sequelize']['where'](db[_0xfe4c('0x58')]['fn']('MD5',db['sequelize']['col'](_0xfe4c('0x4b'))),_0x4903ee[_0xfe4c('0x2c')][_0xfe4c('0x59')])]};if(_0x4903ee[_0xfe4c('0x2c')][_0xfe4c('0x39')]&&_0x4903ee[_0xfe4c('0x2c')][_0xfe4c('0x39')]===_0xfe4c('0x4b')){_0x5bed8b['$and'][_0xfe4c('0x5a')]({'uniqueid':_0x4903ee[_0xfe4c('0x41')]['id']});}else{_0x5bed8b[_0xfe4c('0x5b')][_0xfe4c('0x5a')]({'id':_0x4903ee[_0xfe4c('0x41')]['id']});}return db['VoiceRecording']['find']({'where':_0x5bed8b,'attributes':['id',_0xfe4c('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x355d06,null))['then'](function(_0x210cab){if(_0x210cab){var _0xe49a6a=util[_0xfe4c('0x2b')](_0xfe4c('0x5c'),_0x210cab['value']);if(fs[_0xfe4c('0x4d')](_0xe49a6a)){_0x47dca4=!![];return _0xd683c3[_0xfe4c('0x4e')](_0xe49a6a,_0x210cab[_0xfe4c('0x4c')],config[_0xfe4c('0x5d')][_0xfe4c('0x4f')])['then'](function(){return _0x210cab;});}return _0x210cab;}})[_0xfe4c('0x20')](function(_0x2651ae){if(_0x2651ae){if(!fs[_0xfe4c('0x4d')](_0x2651ae[_0xfe4c('0x4c')])){throw new db[(_0xfe4c('0x50'))][(_0xfe4c('0x51'))](_0xfe4c('0x52'));}if(_0x2651ae[_0xfe4c('0x5e')]){return _0x355d06['download'](_0x2651ae[_0xfe4c('0x4c')],_0x2651ae[_0xfe4c('0x5e')]+path[_0xfe4c('0x53')](_0x2651ae['value']),function(){if(_0x47dca4){fs[_0xfe4c('0x5f')](_0x2651ae[_0xfe4c('0x4c')]);}});}else{return _0x355d06[_0xfe4c('0x54')](_0x2651ae[_0xfe4c('0x4c')],function(_0x4d62f2){if(_0x47dca4){fs['unlink'](_0x2651ae[_0xfe4c('0x4c')]);}});}}})[_0xfe4c('0x46')](handleError(_0x355d06,null));};exports[_0xfe4c('0x21')]=function(_0x5df260,_0x412f20){return db[_0xfe4c('0x26')][_0xfe4c('0x45')]({'where':{'id':_0x5df260[_0xfe4c('0x41')]['id']}})[_0xfe4c('0x20')](function(_0x2c9d47){if(_[_0xfe4c('0x60')](_0x2c9d47)){throw new ReferenceError(_0xfe4c('0x61'));}return _0x2c9d47;})[_0xfe4c('0x20')](function(_0x1d73e7){var _0x2043db=_0x1d73e7[_0xfe4c('0x4c')];logger[_0xfe4c('0x62')]('cancellazione\x20fisica\x20documento\x20%s',_0x2043db);if(!_[_0xfe4c('0x60')](_0x1d73e7['value'])&&fs[_0xfe4c('0x4d')](_0x2043db)){logger['info'](_0xfe4c('0x63')+_0x2043db+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xfe4c('0x64')](_0x2043db);}_0x2043db=_0x2043db+_0xfe4c('0x65');if(!_[_0xfe4c('0x60')](_0x1d73e7[_0xfe4c('0x4c')])&&fs[_0xfe4c('0x4d')](_0x2043db)){logger[_0xfe4c('0x62')]('File:\x20\x22'+_0x2043db+_0xfe4c('0x66'));fs[_0xfe4c('0x64')](_0x2043db);}return _0x1d73e7;})[_0xfe4c('0x20')](function(_0x6bed43){if(!_0x6bed43)throw new InternalError();return _0x6bed43['destroy']();})[_0xfe4c('0x20')](function(){_0x412f20[_0xfe4c('0x14')](0xcc)[_0xfe4c('0x15')]();})[_0xfe4c('0x46')](handleError(_0x412f20,null));};function getBucketslist(_0x24e0e7,_0x5de759,_0xee68e4){return new Promise(function(_0x142d53,_0x31ba18){var _0x24ada2=new AWS['S3']({'accessKeyId':_0x5de759,'secretAccessKey':_0x24e0e7,'region':_0xee68e4});_0x24ada2[_0xfe4c('0x67')]({},function(_0x12f62d,_0x4eec1c){if(_0x12f62d){return _0x31ba18(_0x12f62d);}else{return _0x142d53(_0x4eec1c);}});});}function createBucket(_0x1eaad7,_0x10c187,_0x188c1a,_0x2fa0e8){return new Promise(function(_0x2eb111,_0x307add){var _0x5a2fcf=new AWS['S3']({'accessKeyId':_0x10c187,'secretAccessKey':_0x1eaad7,'region':_0x188c1a});_0x5a2fcf['createBucket']({'Bucket':_0x2fa0e8},function(_0x7c80cc,_0xc2b297){if(_0x7c80cc){return _0x307add(_0x7c80cc);}else{return _0x2eb111(_0xc2b297);}});});}function uploadFile(_0x2eefc9,_0x4933da,_0x8eb0e6,_0x5706c9,_0x16cbef,_0xbd0857){return new Promise(function(_0x6b6e57,_0x3d3a18){var _0x325e57=new AWS['S3']({'accessKeyId':_0x4933da,'secretAccessKey':_0x2eefc9,'region':_0x8eb0e6});_0x325e57[_0xfe4c('0x68')]({'Bucket':_0x5706c9,'Key':_0x16cbef,'Body':_0xbd0857},function(_0x32091a,_0x3c5cba){if(_0x32091a){return _0x3d3a18(_0x32091a);}else{return _0x6b6e57(_0x3c5cba);}});});}function startTranscribe(_0x1c04f7,_0x531fc5,_0xa3c37d,_0x4ac76b,_0x2a2076,_0x1071f2){return new Promise(function(_0x3c861b,_0x20455c){var _0x5cb21c=new AWS[(_0xfe4c('0x69'))]({'accessKeyId':_0x531fc5,'secretAccessKey':_0x1c04f7,'region':_0xa3c37d});_0x5cb21c[_0xfe4c('0x6a')]({'TranscriptionJobName':_0x4ac76b,'LanguageCode':_0x2a2076,'Media':{'MediaFileUri':_0x1071f2}},function(_0xb915c7,_0x144b23){if(_0xb915c7){return _0x20455c(_0xb915c7);}else{return _0x3c861b(_0x144b23);}});});}function transcribe(_0x1bdd91,_0x3d0f86,_0x5370cf,_0x22e3e9,_0x973261,_0x2f8c90,_0xb1cf3a){return new Promise(function(_0x3f1516,_0x66bbb2){var _0x65954d={};logger[_0xfe4c('0x62')](util[_0xfe4c('0x2b')](_0xfe4c('0x6b'),_0x1bdd91,_0x973261));return uploadFile(_0x3d0f86,_0x5370cf,_0x22e3e9,_0x973261,path[_0xfe4c('0x6c')](_0x2f8c90),fs[_0xfe4c('0x6d')](_0x2f8c90))[_0xfe4c('0x20')](function(_0x10b49b){logger[_0xfe4c('0x62')](util[_0xfe4c('0x2b')](_0xfe4c('0x6e'),_0x1bdd91,_0x973261,_0x10b49b[_0xfe4c('0x6f')]));_0x65954d[_0xfe4c('0x70')]=_0x10b49b[_0xfe4c('0x71')];_0x65954d[_0xfe4c('0x72')]=_0x10b49b[_0xfe4c('0x6f')];logger[_0xfe4c('0x62')](util[_0xfe4c('0x2b')](_0xfe4c('0x73'),_0x1bdd91));return startTranscribe(_0x3d0f86,_0x5370cf,_0x22e3e9,uuidv4(),_0xb1cf3a,_0x10b49b['Location']);})[_0xfe4c('0x20')](function(_0x209d7f){logger[_0xfe4c('0x62')](util['format']('[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created',_0x1bdd91,_0x209d7f[_0xfe4c('0x74')][_0xfe4c('0x75')]));_0x65954d[_0xfe4c('0x76')]=_0x209d7f[_0xfe4c('0x74')][_0xfe4c('0x75')];_0x65954d[_0xfe4c('0x77')]=_0x209d7f[_0xfe4c('0x74')][_0xfe4c('0x78')];return _0x3f1516(_0x65954d);})['catch'](function(_0x1e3bfd){return _0x66bbb2(_0x1e3bfd);});});}exports['runTranscribe']=function(_0x4064b9,_0x15fbf2,_0x38c425){var _0x3eef4a;var _0x1c11db;var _0x4d0292;var _0x42a87b=require(_0xfe4c('0x4a'));return db[_0xfe4c('0x26')][_0xfe4c('0x79')]({'where':{'id':_0x4064b9[_0xfe4c('0x41')]['id']}})['then'](function(_0x20d260){if(_0x20d260){var _0x52f023=util[_0xfe4c('0x2b')]('%s.cypher',_0x20d260[_0xfe4c('0x4c')]);if(fs[_0xfe4c('0x4d')](_0x52f023)){cypher=!![];return _0x42a87b[_0xfe4c('0x4e')](_0x52f023,_0x20d260['value'],config['secrets'][_0xfe4c('0x4f')])['then'](function(){return _0x20d260;});}return _0x20d260;}})['then'](function(_0x1332c1){if(!_0x1332c1){throw new db['Sequelize'][(_0xfe4c('0x51'))](_0xfe4c('0x7a'));}_0x1c11db=_0x1332c1;return db[_0xfe4c('0x7b')][_0xfe4c('0x79')]({'where':{'id':0x1}});})[_0xfe4c('0x20')](handleEntityNotFound(_0x15fbf2,null))[_0xfe4c('0x20')](function(_0x2d58e1){if(_0x2d58e1){_0x3eef4a=_0x2d58e1;if(!_0x3eef4a['transcribe']||!_0x3eef4a['transcribeAccountId']||!_0x3eef4a[_0xfe4c('0x7c')]||!_0x3eef4a['language']||!_0x3eef4a[_0xfe4c('0x70')]){throw new db[(_0xfe4c('0x50'))][(_0xfe4c('0x51'))](_0xfe4c('0x7d'));}if(_0x4064b9[_0xfe4c('0x48')][_0xfe4c('0x7e')]&&(!_0x3eef4a[_0xfe4c('0x7f')]||!_0x3eef4a[_0xfe4c('0x80')]||!_0x3eef4a['sentimentRegion']||!_0x3eef4a[_0xfe4c('0x81')]||!_0x3eef4a[_0xfe4c('0x70')])){throw new db[(_0xfe4c('0x50'))]['ValidationError'](_0xfe4c('0x82'));}return db[_0xfe4c('0x83')][_0xfe4c('0x79')]({'where':{'id':_0x3eef4a[_0xfe4c('0x84')]}});}})[_0xfe4c('0x20')](function(_0x1dfaa0){if(!_0x1dfaa0){throw new db[(_0xfe4c('0x50'))][(_0xfe4c('0x51'))](_0xfe4c('0x85'));}if(!_0x1dfaa0[_0xfe4c('0x86')]||!_0x1dfaa0[_0xfe4c('0x87')]){throw new db[(_0xfe4c('0x50'))][(_0xfe4c('0x51'))]('Cloud\x20Provider\x20not\x20configured');}_0x4d0292=_0x1dfaa0;return getBucketslist(_0x4d0292[_0xfe4c('0x86')],_0x4d0292[_0xfe4c('0x87')],_0x3eef4a[_0xfe4c('0x7c')]);})[_0xfe4c('0x20')](function(_0x20eed4){if(_0x20eed4&&_0x20eed4[_0xfe4c('0x88')]){var _0xaa38d4=_[_0xfe4c('0x45')](_0x20eed4[_0xfe4c('0x88')],function(_0x5b0bd8){return _0x5b0bd8['Name']===_0x3eef4a['bucket'];});if(!_0xaa38d4){logger[_0xfe4c('0x62')](util[_0xfe4c('0x2b')](_0xfe4c('0x89'),_0x4064b9['params']['id'],_0x3eef4a[_0xfe4c('0x70')]));return createBucket(_0x4d0292[_0xfe4c('0x86')],_0x4d0292[_0xfe4c('0x87')],_0x3eef4a[_0xfe4c('0x7c')],_0x3eef4a[_0xfe4c('0x70')]);}logger[_0xfe4c('0x62')](util[_0xfe4c('0x2b')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4064b9[_0xfe4c('0x41')]['id'],_0x3eef4a['bucket']));return;}})['then'](function(_0x3651a4){if(_0x1c11db[_0xfe4c('0x77')]===_0xfe4c('0x8a')){return transcribe(_0x4064b9[_0xfe4c('0x41')]['id'],_0x4d0292[_0xfe4c('0x86')],_0x4d0292['data2'],_0x3eef4a[_0xfe4c('0x7c')],_0x3eef4a[_0xfe4c('0x70')],_0x1c11db[_0xfe4c('0x4c')],_0x3eef4a[_0xfe4c('0x81')]);}else{logger[_0xfe4c('0x62')](util['format'](_0xfe4c('0x8b'),_0x4064b9[_0xfe4c('0x41')]['id']));return{'transcribeStatus':_0xfe4c('0x8c')};}})['then'](function(_0x451233){if(_0x451233){_0x451233[_0xfe4c('0x8d')]=_0x4064b9[_0xfe4c('0x48')][_0xfe4c('0x7e')];return _0x1c11db[_0xfe4c('0x8e')](_0x451233);}})[_0xfe4c('0x20')](respondWithResult(_0x15fbf2,null))['catch'](handleError(_0x15fbf2,null));};function writeFile(_0x23214c,_0xa5ddc1){return new Promise(function(_0x509765,_0x2062c0){fs[_0xfe4c('0x8f')](_0xa5ddc1,_0x23214c,function(_0x2a0660,_0x4e752a){if(_0x2a0660){return _0x2062c0(_0x2a0660);}else{return _0x509765(_0x4e752a);}});});}exports[_0xfe4c('0x90')]=function(_0x45178e,_0x3c0848,_0x1d25df){return db[_0xfe4c('0x26')][_0xfe4c('0x79')]({'where':{'id':_0x45178e['params']['id']}})[_0xfe4c('0x20')](handleEntityNotFound(_0x3c0848))[_0xfe4c('0x20')](function(_0x4260fe){if(_0x4260fe&&_0x4260fe[_0xfe4c('0x91')]){var _0x3b461b=_0x4260fe[_0xfe4c('0x91')];var _0x202336=config[_0xfe4c('0x92')]+_0xfe4c('0x93')+_0x4260fe['id']+'.txt';if(fs[_0xfe4c('0x4d')](_0x202336)){return _0x202336;}return writeFile(_0x3b461b,_0x202336)[_0xfe4c('0x20')](function(){return _0x202336;});}else{throw new db['Sequelize']['ValidationError'](_0xfe4c('0x94'));}})['then'](function(_0x3c1115){return _0x3c0848['download'](_0x3c1115);})[_0xfe4c('0x46')](handleError(_0x3c0848));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index d0ca249..dabd327 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 _0x0c2b=['uniqueid','transcribeStatus','./voiceRecording.attributes','exports','define','voice_recordings'];(function(_0x44f0b8,_0x40bcdc){var _0x6d5d5e=function(_0x13ea82){while(--_0x13ea82){_0x44f0b8['push'](_0x44f0b8['shift']());}};_0x6d5d5e(++_0x40bcdc);}(_0x0c2b,0x134));var _0xb0c2=function(_0x55cd8c,_0x302b88){_0x55cd8c=_0x55cd8c-0x0;var _0x1ba719=_0x0c2b[_0x55cd8c];return _0x1ba719;};'use strict';var attributes=require(_0xb0c2('0x0'));module[_0xb0c2('0x1')]=function(_0x4fbd93,_0x5e4432){return _0x4fbd93[_0xb0c2('0x2')]('VoiceRecording',attributes,{'tableName':_0xb0c2('0x3'),'paranoid':![],'indexes':[{'name':_0xb0c2('0x4'),'fields':[_0xb0c2('0x4')]},{'name':_0xb0c2('0x5'),'fields':[_0xb0c2('0x5')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x7bae=['VoiceRecording','uniqueid','transcribeStatus'];(function(_0xf17df0,_0x30e6c3){var _0x3c6e42=function(_0x5cf4cc){while(--_0x5cf4cc){_0xf17df0['push'](_0xf17df0['shift']());}};_0x3c6e42(++_0x30e6c3);}(_0x7bae,0x13b));var _0xe7ba=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7bae[_0x134c2e];return _0x2825db;};'use strict';var attributes=require('./voiceRecording.attributes');module['exports']=function(_0x80f588,_0x1e05c4){return _0x80f588['define'](_0xe7ba('0x0'),attributes,{'tableName':'voice_recordings','paranoid':![],'indexes':[{'name':_0xe7ba('0x1'),'fields':[_0xe7ba('0x1')]},{'name':_0xe7ba('0x2'),'fields':[_0xe7ba('0x2')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 75069dd..868f767 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 _0xd943=['info','request\x20sent','VoiceRecording,\x20%s,\x20%s,\x20%s','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','body','options','raw','where','attributes','debug','stringify','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','existsSync','value','format','secrets','recording','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','then'];(function(_0x213ed5,_0x26712a){var _0x191514=function(_0x2d9305){while(--_0x2d9305){_0x213ed5['push'](_0x213ed5['shift']());}};_0x191514(++_0x26712a);}(_0xd943,0x15d));var _0x3d94=function(_0x55cbcf,_0xfd9502){_0x55cbcf=_0x55cbcf-0x0;var _0x5f31d9=_0xd943[_0x55cbcf];return _0x5f31d9;};'use strict';var _=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var moment=require(_0x3d94('0x2'));var BPromise=require(_0x3d94('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d94('0x4'));var db=require(_0x3d94('0x5'))['db'];var utils=require(_0x3d94('0x6'));var logger=require(_0x3d94('0x7'))(_0x3d94('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3d94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x54e81f,_0x4d29e7,_0x20f4d1){return new BPromise(function(_0x35d36a,_0x5244c3){return client['request'](_0x54e81f,_0x20f4d1)[_0x3d94('0xa')](function(_0x27e381){logger[_0x3d94('0xb')]('VoiceRecording,\x20%s,\x20%s',_0x4d29e7,_0x3d94('0xc'));logger['debug'](_0x3d94('0xd'),_0x4d29e7,_0x3d94('0xc'),JSON['stringify'](_0x27e381));if(_0x27e381[_0x3d94('0xe')]){if(_0x27e381[_0x3d94('0xe')][_0x3d94('0xf')]===0x1f4){logger[_0x3d94('0xe')](_0x3d94('0x10'),_0x4d29e7,_0x27e381['error'][_0x3d94('0x11')]);return _0x5244c3(_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);}logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x27e381[_0x3d94('0xe')][_0x3d94('0x11')]);return _0x35d36a(_0x27e381['error'][_0x3d94('0x11')]);}else{logger[_0x3d94('0xb')](_0x3d94('0x10'),_0x4d29e7,_0x3d94('0xc'));_0x35d36a(_0x27e381[_0x3d94('0x12')][_0x3d94('0x11')]);}})[_0x3d94('0x13')](function(_0x9893cb){logger['error'](_0x3d94('0x10'),_0x4d29e7,_0x9893cb);_0x5244c3(_0x9893cb);});});}exports[_0x3d94('0x14')]=function(_0x2acee3){var _0x1c35a8=this;return new Promise(function(_0x4afc92,_0x3ca0e3){return db[_0x3d94('0x15')]['update'](_0x2acee3[_0x3d94('0x16')],{'raw':_0x2acee3['options']?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')][_0x3d94('0x19')]||null:null,'attributes':_0x2acee3['options']?_0x2acee3['options'][_0x3d94('0x1a')]||null:null,'limit':_0x2acee3[_0x3d94('0x17')]?_0x2acee3[_0x3d94('0x17')]['limit']||null:null})[_0x3d94('0xa')](function(_0x2e8c91){logger[_0x3d94('0xb')](_0x3d94('0x14'),_0x2acee3);logger[_0x3d94('0x1b')](_0x3d94('0x14'),_0x2acee3,JSON[_0x3d94('0x1c')](_0x2e8c91));_0x4afc92(_0x2e8c91);})[_0x3d94('0x13')](function(_0xee7b8d){logger[_0x3d94('0xe')](_0x3d94('0x14'),_0xee7b8d[_0x3d94('0x11')],_0x2acee3);_0x3ca0e3(_0x1c35a8[_0x3d94('0xe')](0x1f4,_0xee7b8d[_0x3d94('0x11')]));});});};exports[_0x3d94('0x1d')]=function(_0x5b3b31){var _0x123183=this;return new Promise(function(_0x558fd2,_0x28a698){var _0x1d0a7a=require(_0x3d94('0x1e'));var _0x439173;return db[_0x3d94('0x1f')][_0x3d94('0x20')]({'attributes':['id',_0x3d94('0x21')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x584c4a){_0x439173=_0x584c4a;return db[_0x3d94('0x15')]['create'](_0x5b3b31['body']);})[_0x3d94('0xa')](function(_0x58c0d0){if(_0x439173[_0x3d94('0x21')]&&fs[_0x3d94('0x22')](_0x58c0d0[_0x3d94('0x23')])){var _0x4cef9c=util[_0x3d94('0x24')]('%s.cypher',_0x58c0d0[_0x3d94('0x23')]);return _0x1d0a7a['encryptFile'](_0x58c0d0[_0x3d94('0x23')],_0x4cef9c,config[_0x3d94('0x25')][_0x3d94('0x26')])[_0x3d94('0xa')](function(){fs['unlink'](_0x58c0d0[_0x3d94('0x23')]);logger['info'](_0x3d94('0x27'));return _0x58c0d0;});}return _0x58c0d0;})[_0x3d94('0xa')](function(_0x51d308){logger['info'](_0x3d94('0x1d'),_0x5b3b31);logger[_0x3d94('0x1b')](_0x3d94('0x1d'),_0x5b3b31,JSON['stringify'](_0x51d308));_0x558fd2(_0x51d308);})[_0x3d94('0x13')](function(_0x3d29fd){logger['error'](_0x3d94('0x1d'),_0x3d29fd[_0x3d94('0x11')],_0x5b3b31);_0x28a698(_0x123183[_0x3d94('0xe')](0x1f4,_0x3d29fd[_0x3d94('0x11')]));});});}; \ No newline at end of file +var _0xa30a=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','VoiceRecording,\x20%s,\x20%s','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','UpdateVoiceRecording','update','body','options','where','limit','debug','../../components/encryptor','Setting','findOne','callRecordingEncryption','VoiceRecording','create','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x5333ba,_0x22e1bb){var _0x20f9dc=function(_0x1956af){while(--_0x1956af){_0x5333ba['push'](_0x5333ba['shift']());}};_0x20f9dc(++_0x22e1bb);}(_0xa30a,0xd7));var _0xaa30=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa30a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xaa30('0x0'));var util=require(_0xaa30('0x1'));var moment=require(_0xaa30('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa30('0x3'));var fs=require('fs');var Redis=require(_0xaa30('0x4'));var db=require(_0xaa30('0x5'))['db'];var utils=require(_0xaa30('0x6'));var logger=require(_0xaa30('0x7'))(_0xaa30('0x8'));var config=require(_0xaa30('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xaa30('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x8af448,_0x14fe09,_0x42dc22){return new BPromise(function(_0x5d076a,_0xedbc45){return client[_0xaa30('0xb')](_0x8af448,_0x42dc22)[_0xaa30('0xc')](function(_0x59d028){logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,'request\x20sent');logger['debug'](_0xaa30('0xf'),_0x14fe09,'request\x20sent',JSON[_0xaa30('0x10')](_0x59d028));if(_0x59d028[_0xaa30('0x11')]){if(_0x59d028[_0xaa30('0x11')][_0xaa30('0x12')]===0x1f4){logger['error'](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0xedbc45(_0x59d028['error'][_0xaa30('0x13')]);}logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);return _0x5d076a(_0x59d028[_0xaa30('0x11')][_0xaa30('0x13')]);}else{logger[_0xaa30('0xd')](_0xaa30('0xe'),_0x14fe09,_0xaa30('0x14'));_0x5d076a(_0x59d028['result'][_0xaa30('0x13')]);}})['catch'](function(_0x5eb356){logger[_0xaa30('0x11')](_0xaa30('0xe'),_0x14fe09,_0x5eb356);_0xedbc45(_0x5eb356);});});}exports[_0xaa30('0x15')]=function(_0x540e36){var _0x54fa49=this;return new Promise(function(_0x53f9fd,_0x23ad3b){return db['VoiceRecording'][_0xaa30('0x16')](_0x540e36[_0xaa30('0x17')],{'raw':_0x540e36['options']?_0x540e36['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')][_0xaa30('0x19')]||null:null,'attributes':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')]['attributes']||null:null,'limit':_0x540e36[_0xaa30('0x18')]?_0x540e36[_0xaa30('0x18')][_0xaa30('0x1a')]||null:null})[_0xaa30('0xc')](function(_0x1ff442){logger['info'](_0xaa30('0x15'),_0x540e36);logger[_0xaa30('0x1b')](_0xaa30('0x15'),_0x540e36,JSON[_0xaa30('0x10')](_0x1ff442));_0x53f9fd(_0x1ff442);})['catch'](function(_0x14d7fa){logger[_0xaa30('0x11')](_0xaa30('0x15'),_0x14d7fa[_0xaa30('0x13')],_0x540e36);_0x23ad3b(_0x54fa49[_0xaa30('0x11')](0x1f4,_0x14d7fa[_0xaa30('0x13')]));});});};exports['CreateVoiceRecording']=function(_0x467850){var _0x465701=this;return new Promise(function(_0x5d4da8,_0xb043e4){var _0x5b3efb=require(_0xaa30('0x1c'));var _0x33a0c9;return db[_0xaa30('0x1d')][_0xaa30('0x1e')]({'attributes':['id',_0xaa30('0x1f')],'where':{'id':0x1},'raw':!![]})[_0xaa30('0xc')](function(_0x6ff09a){_0x33a0c9=_0x6ff09a;return db[_0xaa30('0x20')][_0xaa30('0x21')](_0x467850[_0xaa30('0x17')]);})[_0xaa30('0xc')](function(_0x43003f){if(_0x33a0c9[_0xaa30('0x1f')]&&fs[_0xaa30('0x22')](_0x43003f[_0xaa30('0x23')])){var _0x1a3f64=util[_0xaa30('0x24')](_0xaa30('0x25'),_0x43003f['value']);return _0x5b3efb[_0xaa30('0x26')](_0x43003f[_0xaa30('0x23')],_0x1a3f64,config[_0xaa30('0x27')][_0xaa30('0x28')])[_0xaa30('0xc')](function(){fs[_0xaa30('0x29')](_0x43003f['value']);logger['info']('CreateVoiceRecording\x20file\x20encrypted');return _0x43003f;});}return _0x43003f;})[_0xaa30('0xc')](function(_0x407090){logger[_0xaa30('0xd')](_0xaa30('0x2a'),_0x467850);logger[_0xaa30('0x1b')]('CreateVoiceRecording',_0x467850,JSON['stringify'](_0x407090));_0x5d4da8(_0x407090);})[_0xaa30('0x2b')](function(_0x2d26fb){logger['error'](_0xaa30('0x2a'),_0x2d26fb['message'],_0x467850);_0xb043e4(_0x465701[_0xaa30('0x11')](0x1f4,_0x2d26fb['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 99edb71..c91576e 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 _0xad81=['show','post','/:id','update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0xad81,0x183));var _0x1ad8=function(_0x270eac,_0x5d3d11){_0x270eac=_0x270eac-0x0;var _0x54f346=_0xad81[_0x270eac];return _0x54f346;};'use strict';var multer=require(_0x1ad8('0x0'));var util=require('util');var path=require(_0x1ad8('0x1'));var timeout=require(_0x1ad8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x1ad8('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1ad8('0x4'));var config=require(_0x1ad8('0x5'));var controller=require(_0x1ad8('0x6'));router['get']('/',auth[_0x1ad8('0x7')](),controller[_0x1ad8('0x8')]);router[_0x1ad8('0x9')](_0x1ad8('0xa'),auth[_0x1ad8('0x7')](),controller[_0x1ad8('0xb')]);router[_0x1ad8('0x9')]('/:id',auth[_0x1ad8('0x7')](),controller[_0x1ad8('0xc')]);router[_0x1ad8('0xd')]('/',auth[_0x1ad8('0x7')](),controller['create']);router['put'](_0x1ad8('0xe'),auth[_0x1ad8('0x7')](),controller[_0x1ad8('0xf')]);router[_0x1ad8('0x10')](_0x1ad8('0xe'),auth['isAuthenticated'](),controller[_0x1ad8('0x11')]);module[_0x1ad8('0x12')]=router; \ No newline at end of file +var _0xb4d1=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','isAuthenticated','describe','post','create','put','/:id','update','destroy','multer','util','path'];(function(_0x5d1b7e,_0x4daa0e){var _0x4643ff=function(_0xab5917){while(--_0xab5917){_0x5d1b7e['push'](_0x5d1b7e['shift']());}};_0x4643ff(++_0x4daa0e);}(_0xb4d1,0x179));var _0x1b4d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xb4d1[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0x1b4d('0x0'));var util=require(_0x1b4d('0x1'));var path=require(_0x1b4d('0x2'));var timeout=require('connect-timeout');var express=require(_0x1b4d('0x3'));var router=express['Router']();var fs_extra=require(_0x1b4d('0x4'));var auth=require(_0x1b4d('0x5'));var interaction=require(_0x1b4d('0x6'));var config=require(_0x1b4d('0x7'));var controller=require(_0x1b4d('0x8'));router[_0x1b4d('0x9')]('/',auth['isAuthenticated'](),controller[_0x1b4d('0xa')]);router[_0x1b4d('0x9')]('/describe',auth[_0x1b4d('0xb')](),controller[_0x1b4d('0xc')]);router[_0x1b4d('0x9')]('/:id',auth[_0x1b4d('0xb')](),controller['show']);router[_0x1b4d('0xd')]('/',auth[_0x1b4d('0xb')](),controller[_0x1b4d('0xe')]);router[_0x1b4d('0xf')](_0x1b4d('0x10'),auth['isAuthenticated'](),controller[_0x1b4d('0x11')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x1b4d('0x12')]);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 2f88b0c..301638c 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 _0xd76d=['ENUM','blind','attended','STRING','Yes','sequelize','exports'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0xd76d,0x139));var _0xdd76=function(_0x150469,_0x5ec8a2){_0x150469=_0x150469-0x0;var _0x110773=_0xd76d[_0x150469];return _0x110773;};'use strict';var Sequelize=require(_0xdd76('0x0'));var moment=require('moment');module[_0xdd76('0x1')]={'type':{'type':Sequelize[_0xdd76('0x2')](_0xdd76('0x3'),_0xdd76('0x4'))},'result':{'type':Sequelize[_0xdd76('0x5')]},'transfererchannel':{'type':Sequelize[_0xdd76('0x5')]},'transferercalleridnum':{'type':Sequelize[_0xdd76('0x5')]},'transferercalleridname':{'type':Sequelize[_0xdd76('0x5')]},'transfererconnectedlinenum':{'type':Sequelize[_0xdd76('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0xdd76('0x5')]},'transfereraccountcode':{'type':Sequelize[_0xdd76('0x5')]},'transferercontext':{'type':Sequelize[_0xdd76('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize[_0xdd76('0x5')]},'transfereecalleridname':{'type':Sequelize[_0xdd76('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0xdd76('0x5')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0xdd76('0x5')]},'transfereeexten':{'type':Sequelize[_0xdd76('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xdd76('0x2')](_0xdd76('0x6'),'No')},'context':{'type':Sequelize[_0xdd76('0x5')]},'extension':{'type':Sequelize[_0xdd76('0x5')]}}; \ No newline at end of file +var _0x05c2=['sequelize','ENUM','STRING','Yes'];(function(_0x30852e,_0x2dfb0d){var _0x1ccca9=function(_0x1b99aa){while(--_0x1b99aa){_0x30852e['push'](_0x30852e['shift']());}};_0x1ccca9(++_0x2dfb0d);}(_0x05c2,0x6c));var _0x205c=function(_0x538625,_0x4a9f80){_0x538625=_0x538625-0x0;var _0x12dea8=_0x05c2[_0x538625];return _0x12dea8;};'use strict';var Sequelize=require(_0x205c('0x0'));var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x205c('0x1')]('blind','attended')},'result':{'type':Sequelize[_0x205c('0x2')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize[_0x205c('0x2')]},'transferercalleridname':{'type':Sequelize[_0x205c('0x2')]},'transfererconnectedlinenum':{'type':Sequelize[_0x205c('0x2')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x205c('0x2')]},'transferercontext':{'type':Sequelize[_0x205c('0x2')]},'transfererexten':{'type':Sequelize[_0x205c('0x2')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x205c('0x2')]},'transfereecalleridnum':{'type':Sequelize[_0x205c('0x2')]},'transfereecalleridname':{'type':Sequelize[_0x205c('0x2')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x205c('0x2')]},'transfereeaccountcode':{'type':Sequelize[_0x205c('0x2')]},'transfereecontext':{'type':Sequelize[_0x205c('0x2')]},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x205c('0x2')]},'isexternal':{'type':Sequelize[_0x205c('0x1')](_0x205c('0x3'),'No')},'context':{'type':Sequelize[_0x205c('0x2')]},'extension':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index a5bbb81..856afbf 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 _0x4d80=['../../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','Content-Range','apply','reject','save','then','destroy','stack','name','send','index','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','includeAll','find','catch','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x1ef1d6,_0x2c56cc){var _0xdd38f=function(_0x143a19){while(--_0x143a19){_0x1ef1d6['push'](_0x1ef1d6['shift']());}};_0xdd38f(++_0x2c56cc);}(_0x4d80,0xd5));var _0x04d8=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x4d80[_0x3ab51d];return _0x29a04e;};'use strict';var emlformat=require(_0x04d8('0x0'));var rimraf=require(_0x04d8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x04d8('0x2'));var rp=require(_0x04d8('0x3'));var moment=require(_0x04d8('0x4'));var BPromise=require(_0x04d8('0x5'));var Mustache=require(_0x04d8('0x6'));var util=require(_0x04d8('0x7'));var path=require(_0x04d8('0x8'));var sox=require(_0x04d8('0x9'));var csv=require(_0x04d8('0xa'));var ejs=require(_0x04d8('0xb'));var fs=require('fs');var fs_extra=require(_0x04d8('0xc'));var _=require(_0x04d8('0xd'));var squel=require(_0x04d8('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x04d8('0xa'));var querystring=require(_0x04d8('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x04d8('0x10'));var qs=require(_0x04d8('0x11'));var as=require(_0x04d8('0x12'));var hardwareService=require(_0x04d8('0x13'));var logger=require(_0x04d8('0x14'))(_0x04d8('0x15'));var utils=require(_0x04d8('0x16'));var config=require(_0x04d8('0x17'));var licenseUtil=require(_0x04d8('0x18'));var db=require(_0x04d8('0x19'))['db'];function respondWithStatusCode(_0x2b5f71,_0x11622b){_0x11622b=_0x11622b||0xcc;return function(_0x3c9dcd){if(_0x3c9dcd){return _0x2b5f71[_0x04d8('0x1a')](_0x11622b);}return _0x2b5f71[_0x04d8('0x1b')](_0x11622b)[_0x04d8('0x1c')]();};}function respondWithResult(_0x4bd1cc,_0x17aebb){_0x17aebb=_0x17aebb||0xc8;return function(_0x2a5ed6){if(_0x2a5ed6){return _0x4bd1cc[_0x04d8('0x1b')](_0x17aebb)[_0x04d8('0x1d')](_0x2a5ed6);}};}function respondWithFilteredResult(_0x42f615,_0x1f53ac){return function(_0x22f475){if(_0x22f475){var _0x5d3aa3=typeof _0x1f53ac[_0x04d8('0x1e')]===_0x04d8('0x1f')&&typeof _0x1f53ac[_0x04d8('0x20')]===_0x04d8('0x1f');var _0x3bddc6=_0x22f475[_0x04d8('0x21')];var _0x567f87=_0x5d3aa3?0x0:_0x1f53ac['offset'];var _0x54a773=_0x5d3aa3?_0x22f475['count']:_0x1f53ac['offset']+_0x1f53ac['limit'];var _0x5f59f6;if(_0x54a773>=_0x3bddc6){_0x54a773=_0x3bddc6;_0x5f59f6=0xc8;}else{_0x5f59f6=0xce;}_0x42f615[_0x04d8('0x1b')](_0x5f59f6);return _0x42f615['set'](_0x04d8('0x22'),_0x567f87+'-'+_0x54a773+'/'+_0x3bddc6)[_0x04d8('0x1d')](_0x22f475);}return null;};}function patchUpdates(_0x1cb979){return function(_0x42a0fa){try{jsonpatch[_0x04d8('0x23')](_0x42a0fa,_0x1cb979,!![]);}catch(_0x5a0472){return BPromise[_0x04d8('0x24')](_0x5a0472);}return _0x42a0fa[_0x04d8('0x25')]();};}function saveUpdates(_0x18e6f6,_0x12505f){return function(_0x68029e){if(_0x68029e){return _0x68029e['update'](_0x18e6f6)[_0x04d8('0x26')](function(_0x36f85b){return _0x36f85b;});}return null;};}function removeEntity(_0x227440,_0x35dd80){return function(_0x322ae3){if(_0x322ae3){return _0x322ae3[_0x04d8('0x27')]()[_0x04d8('0x26')](function(){_0x227440[_0x04d8('0x1b')](0xcc)[_0x04d8('0x1c')]();});}};}function handleEntityNotFound(_0x5b9f6a,_0x15c061){return function(_0xb74e58){if(!_0xb74e58){_0x5b9f6a[_0x04d8('0x1a')](0x194);}return _0xb74e58;};}function handleError(_0x316128,_0x3484d5){_0x3484d5=_0x3484d5||0x1f4;return function(_0x2bc110){logger['error'](_0x2bc110[_0x04d8('0x28')]);if(_0x2bc110[_0x04d8('0x29')]){delete _0x2bc110[_0x04d8('0x29')];}_0x316128[_0x04d8('0x1b')](_0x3484d5)[_0x04d8('0x2a')](_0x2bc110);};}exports[_0x04d8('0x2b')]=function(_0x465a13,_0x5f4549){var _0x2ca6fd={},_0x48e7b7={},_0x6084ad={'count':0x0,'rows':[]};var _0xdc6024=_[_0x04d8('0x2c')](db[_0x04d8('0x2d')][_0x04d8('0x2e')],function(_0x156702){return{'name':_0x156702[_0x04d8('0x2f')],'type':_0x156702[_0x04d8('0x30')][_0x04d8('0x31')]};});_0x48e7b7[_0x04d8('0x32')]=_[_0x04d8('0x2c')](_0xdc6024,_0x04d8('0x29'));_0x48e7b7[_0x04d8('0x33')]=_[_0x04d8('0x34')](_0x465a13[_0x04d8('0x33')]);_0x48e7b7[_0x04d8('0x35')]=_[_0x04d8('0x36')](_0x48e7b7[_0x04d8('0x32')],_0x48e7b7['query']);_0x2ca6fd[_0x04d8('0x37')]=_['intersection'](_0x48e7b7[_0x04d8('0x32')],qs[_0x04d8('0x38')](_0x465a13[_0x04d8('0x33')][_0x04d8('0x38')]));_0x2ca6fd[_0x04d8('0x37')]=_0x2ca6fd[_0x04d8('0x37')][_0x04d8('0x39')]?_0x2ca6fd['attributes']:_0x48e7b7[_0x04d8('0x32')];if(!_0x465a13[_0x04d8('0x33')]['hasOwnProperty']('nolimit')){_0x2ca6fd['limit']=qs[_0x04d8('0x20')](_0x465a13[_0x04d8('0x33')]['limit']);_0x2ca6fd[_0x04d8('0x1e')]=qs[_0x04d8('0x1e')](_0x465a13[_0x04d8('0x33')]['offset']);}_0x2ca6fd[_0x04d8('0x3a')]=qs['sort'](_0x465a13['query'][_0x04d8('0x3b')]);_0x2ca6fd[_0x04d8('0x3c')]=qs[_0x04d8('0x35')](_[_0x04d8('0x3d')](_0x465a13[_0x04d8('0x33')],_0x48e7b7['filters']),_0xdc6024);if(_0x465a13[_0x04d8('0x33')][_0x04d8('0x3e')]){_0x2ca6fd[_0x04d8('0x3c')]=_[_0x04d8('0x3f')](_0x2ca6fd[_0x04d8('0x3c')],{'$or':_['map'](_0xdc6024,function(_0x33f3b2){if(_0x33f3b2[_0x04d8('0x30')]!==_0x04d8('0x40')){var _0x1eb3a5={};_0x1eb3a5[_0x33f3b2[_0x04d8('0x29')]]={'$like':'%'+_0x465a13[_0x04d8('0x33')][_0x04d8('0x3e')]+'%'};return _0x1eb3a5;}})});}_0x2ca6fd=_['merge']({},_0x2ca6fd,_0x465a13[_0x04d8('0x41')]);var _0x78fa={'where':_0x2ca6fd[_0x04d8('0x3c')]};return db[_0x04d8('0x2d')]['count'](_0x78fa)[_0x04d8('0x26')](function(_0x1862b8){_0x6084ad[_0x04d8('0x21')]=_0x1862b8;if(_0x465a13[_0x04d8('0x33')]['includeAll']){_0x2ca6fd[_0x04d8('0x42')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0x04d8('0x43')](_0x2ca6fd);})['then'](function(_0x3bf4eb){_0x6084ad[_0x04d8('0x44')]=_0x3bf4eb;return _0x6084ad;})[_0x04d8('0x26')](respondWithFilteredResult(_0x5f4549,_0x2ca6fd))['catch'](handleError(_0x5f4549,null));};exports[_0x04d8('0x45')]=function(_0x543f73,_0x27116f){var _0x3c6013={'raw':!![],'where':{'id':_0x543f73[_0x04d8('0x46')]['id']}},_0x3d36b6={};_0x3d36b6[_0x04d8('0x32')]=_['keys'](db[_0x04d8('0x2d')][_0x04d8('0x2e')]);_0x3d36b6[_0x04d8('0x33')]=_[_0x04d8('0x34')](_0x543f73['query']);_0x3d36b6[_0x04d8('0x35')]=_['intersection'](_0x3d36b6['model'],_0x3d36b6[_0x04d8('0x33')]);_0x3c6013['attributes']=_[_0x04d8('0x36')](_0x3d36b6['model'],qs[_0x04d8('0x38')](_0x543f73['query'][_0x04d8('0x38')]));_0x3c6013['attributes']=_0x3c6013['attributes'][_0x04d8('0x39')]?_0x3c6013['attributes']:_0x3d36b6[_0x04d8('0x32')];if(_0x543f73['query'][_0x04d8('0x47')]){_0x3c6013['include']=[{'all':!![]}];}_0x3c6013=_[_0x04d8('0x3f')]({},_0x3c6013,_0x543f73[_0x04d8('0x41')]);return db[_0x04d8('0x2d')][_0x04d8('0x48')](_0x3c6013)[_0x04d8('0x26')](handleEntityNotFound(_0x27116f,null))[_0x04d8('0x26')](respondWithResult(_0x27116f,null))[_0x04d8('0x49')](handleError(_0x27116f,null));};exports[_0x04d8('0x4a')]=function(_0x528566,_0x45c90d){return db[_0x04d8('0x2d')][_0x04d8('0x4a')](_0x528566[_0x04d8('0x4b')],{})[_0x04d8('0x26')](respondWithResult(_0x45c90d,0xc9))[_0x04d8('0x49')](handleError(_0x45c90d,null));};exports['update']=function(_0x1a9b03,_0xfc8923){if(_0x1a9b03[_0x04d8('0x4b')]['id']){delete _0x1a9b03[_0x04d8('0x4b')]['id'];}return db[_0x04d8('0x2d')][_0x04d8('0x48')]({'where':{'id':_0x1a9b03[_0x04d8('0x46')]['id']}})['then'](handleEntityNotFound(_0xfc8923,null))[_0x04d8('0x26')](saveUpdates(_0x1a9b03[_0x04d8('0x4b')],null))['then'](respondWithResult(_0xfc8923,null))[_0x04d8('0x49')](handleError(_0xfc8923,null));};exports[_0x04d8('0x27')]=function(_0x1396b4,_0x3c39a0){return db[_0x04d8('0x2d')][_0x04d8('0x48')]({'where':{'id':_0x1396b4[_0x04d8('0x46')]['id']}})[_0x04d8('0x26')](handleEntityNotFound(_0x3c39a0,null))['then'](removeEntity(_0x3c39a0,null))['catch'](handleError(_0x3c39a0,null));};exports['describe']=function(_0x3834ea,_0x28f647){return db[_0x04d8('0x2d')][_0x04d8('0x4c')]()[_0x04d8('0x26')](respondWithResult(_0x28f647,null))[_0x04d8('0x49')](handleError(_0x28f647,null));}; \ No newline at end of file +var _0x9560=['util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../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','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','type','VIRTUAL','filter','VoiceTransferReport','include','rows','catch','show','merge','options','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache'];(function(_0x3e8857,_0x51774e){var _0x207945=function(_0x1612d6){while(--_0x1612d6){_0x3e8857['push'](_0x3e8857['shift']());}};_0x207945(++_0x51774e);}(_0x9560,0x126));var _0x0956=function(_0x5ca3d6,_0x5c7599){_0x5ca3d6=_0x5ca3d6-0x0;var _0x3a1032=_0x9560[_0x5ca3d6];return _0x3a1032;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0956('0x0'));var zipdir=require(_0x0956('0x1'));var jsonpatch=require(_0x0956('0x2'));var rp=require(_0x0956('0x3'));var moment=require(_0x0956('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x0956('0x5'));var util=require(_0x0956('0x6'));var path=require(_0x0956('0x7'));var sox=require(_0x0956('0x8'));var csv=require(_0x0956('0x9'));var ejs=require(_0x0956('0xa'));var fs=require('fs');var fs_extra=require(_0x0956('0xb'));var _=require('lodash');var squel=require(_0x0956('0xc'));var crypto=require(_0x0956('0xd'));var jsforce=require(_0x0956('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0956('0x9'));var querystring=require(_0x0956('0xf'));var Papa=require('papaparse');var Redis=require(_0x0956('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0956('0x11'));var as=require(_0x0956('0x12'));var hardwareService=require(_0x0956('0x13'));var logger=require(_0x0956('0x14'))(_0x0956('0x15'));var utils=require(_0x0956('0x16'));var config=require(_0x0956('0x17'));var licenseUtil=require(_0x0956('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3c1f80,_0x25e0b8){_0x25e0b8=_0x25e0b8||0xcc;return function(_0x55392f){if(_0x55392f){return _0x3c1f80[_0x0956('0x19')](_0x25e0b8);}return _0x3c1f80[_0x0956('0x1a')](_0x25e0b8)[_0x0956('0x1b')]();};}function respondWithResult(_0xa40d33,_0x3ef5c8){_0x3ef5c8=_0x3ef5c8||0xc8;return function(_0x5c4f84){if(_0x5c4f84){return _0xa40d33[_0x0956('0x1a')](_0x3ef5c8)[_0x0956('0x1c')](_0x5c4f84);}};}function respondWithFilteredResult(_0x5370e0,_0x3e804f){return function(_0x3f2a79){if(_0x3f2a79){var _0x24c4fa=typeof _0x3e804f[_0x0956('0x1d')]===_0x0956('0x1e')&&typeof _0x3e804f[_0x0956('0x1f')]==='undefined';var _0x5bedd6=_0x3f2a79[_0x0956('0x20')];var _0x1c784e=_0x24c4fa?0x0:_0x3e804f[_0x0956('0x1d')];var _0x2a6583=_0x24c4fa?_0x3f2a79['count']:_0x3e804f[_0x0956('0x1d')]+_0x3e804f[_0x0956('0x1f')];var _0x36b1c5;if(_0x2a6583>=_0x5bedd6){_0x2a6583=_0x5bedd6;_0x36b1c5=0xc8;}else{_0x36b1c5=0xce;}_0x5370e0[_0x0956('0x1a')](_0x36b1c5);return _0x5370e0[_0x0956('0x21')](_0x0956('0x22'),_0x1c784e+'-'+_0x2a6583+'/'+_0x5bedd6)['json'](_0x3f2a79);}return null;};}function patchUpdates(_0x54d750){return function(_0x57a5ba){try{jsonpatch['apply'](_0x57a5ba,_0x54d750,!![]);}catch(_0x11503a){return BPromise['reject'](_0x11503a);}return _0x57a5ba['save']();};}function saveUpdates(_0x4de28d,_0x140b9d){return function(_0x56a621){if(_0x56a621){return _0x56a621[_0x0956('0x23')](_0x4de28d)['then'](function(_0x550adf){return _0x550adf;});}return null;};}function removeEntity(_0x37950c,_0x2e0679){return function(_0x328e5a){if(_0x328e5a){return _0x328e5a[_0x0956('0x24')]()[_0x0956('0x25')](function(){_0x37950c[_0x0956('0x1a')](0xcc)[_0x0956('0x1b')]();});}};}function handleEntityNotFound(_0x556be9,_0x11a3ef){return function(_0x140500){if(!_0x140500){_0x556be9[_0x0956('0x19')](0x194);}return _0x140500;};}function handleError(_0x5c8fe6,_0x5083e9){_0x5083e9=_0x5083e9||0x1f4;return function(_0x3f01b1){logger[_0x0956('0x26')](_0x3f01b1[_0x0956('0x27')]);if(_0x3f01b1[_0x0956('0x28')]){delete _0x3f01b1[_0x0956('0x28')];}_0x5c8fe6[_0x0956('0x1a')](_0x5083e9)[_0x0956('0x29')](_0x3f01b1);};}exports[_0x0956('0x2a')]=function(_0x5e16ea,_0x5c3b96){var _0x39d3b5={},_0x2ee5c8={},_0x42748f={'count':0x0,'rows':[]};var _0xce59fa=_[_0x0956('0x2b')](db['VoiceTransferReport'][_0x0956('0x2c')],function(_0x116aa4){return{'name':_0x116aa4[_0x0956('0x2d')],'type':_0x116aa4['type']['key']};});_0x2ee5c8[_0x0956('0x2e')]=_[_0x0956('0x2b')](_0xce59fa,_0x0956('0x28'));_0x2ee5c8[_0x0956('0x2f')]=_[_0x0956('0x30')](_0x5e16ea[_0x0956('0x2f')]);_0x2ee5c8[_0x0956('0x31')]=_['intersection'](_0x2ee5c8[_0x0956('0x2e')],_0x2ee5c8[_0x0956('0x2f')]);_0x39d3b5[_0x0956('0x32')]=_[_0x0956('0x33')](_0x2ee5c8[_0x0956('0x2e')],qs[_0x0956('0x34')](_0x5e16ea['query'][_0x0956('0x34')]));_0x39d3b5[_0x0956('0x32')]=_0x39d3b5[_0x0956('0x32')][_0x0956('0x35')]?_0x39d3b5[_0x0956('0x32')]:_0x2ee5c8['model'];if(!_0x5e16ea[_0x0956('0x2f')][_0x0956('0x36')](_0x0956('0x37'))){_0x39d3b5[_0x0956('0x1f')]=qs[_0x0956('0x1f')](_0x5e16ea[_0x0956('0x2f')][_0x0956('0x1f')]);_0x39d3b5[_0x0956('0x1d')]=qs['offset'](_0x5e16ea[_0x0956('0x2f')][_0x0956('0x1d')]);}_0x39d3b5[_0x0956('0x38')]=qs[_0x0956('0x39')](_0x5e16ea[_0x0956('0x2f')][_0x0956('0x39')]);_0x39d3b5[_0x0956('0x3a')]=qs[_0x0956('0x31')](_[_0x0956('0x3b')](_0x5e16ea[_0x0956('0x2f')],_0x2ee5c8['filters']),_0xce59fa);if(_0x5e16ea[_0x0956('0x2f')]['filter']){_0x39d3b5[_0x0956('0x3a')]=_['merge'](_0x39d3b5[_0x0956('0x3a')],{'$or':_['map'](_0xce59fa,function(_0x2ff795){if(_0x2ff795[_0x0956('0x3c')]!==_0x0956('0x3d')){var _0x31058d={};_0x31058d[_0x2ff795[_0x0956('0x28')]]={'$like':'%'+_0x5e16ea[_0x0956('0x2f')][_0x0956('0x3e')]+'%'};return _0x31058d;}})});}_0x39d3b5=_['merge']({},_0x39d3b5,_0x5e16ea['options']);var _0x10e0c8={'where':_0x39d3b5[_0x0956('0x3a')]};return db[_0x0956('0x3f')]['count'](_0x10e0c8)[_0x0956('0x25')](function(_0x4479fc){_0x42748f[_0x0956('0x20')]=_0x4479fc;if(_0x5e16ea[_0x0956('0x2f')]['includeAll']){_0x39d3b5[_0x0956('0x40')]=[{'all':!![]}];}return db[_0x0956('0x3f')]['findAll'](_0x39d3b5);})[_0x0956('0x25')](function(_0x27b488){_0x42748f[_0x0956('0x41')]=_0x27b488;return _0x42748f;})[_0x0956('0x25')](respondWithFilteredResult(_0x5c3b96,_0x39d3b5))[_0x0956('0x42')](handleError(_0x5c3b96,null));};exports[_0x0956('0x43')]=function(_0x434d5d,_0x47063a){var _0x539eef={'raw':!![],'where':{'id':_0x434d5d['params']['id']}},_0x172c46={};_0x172c46[_0x0956('0x2e')]=_[_0x0956('0x30')](db[_0x0956('0x3f')][_0x0956('0x2c')]);_0x172c46[_0x0956('0x2f')]=_[_0x0956('0x30')](_0x434d5d['query']);_0x172c46['filters']=_[_0x0956('0x33')](_0x172c46[_0x0956('0x2e')],_0x172c46[_0x0956('0x2f')]);_0x539eef[_0x0956('0x32')]=_[_0x0956('0x33')](_0x172c46[_0x0956('0x2e')],qs[_0x0956('0x34')](_0x434d5d[_0x0956('0x2f')]['fields']));_0x539eef[_0x0956('0x32')]=_0x539eef[_0x0956('0x32')][_0x0956('0x35')]?_0x539eef[_0x0956('0x32')]:_0x172c46[_0x0956('0x2e')];if(_0x434d5d[_0x0956('0x2f')]['includeAll']){_0x539eef[_0x0956('0x40')]=[{'all':!![]}];}_0x539eef=_[_0x0956('0x44')]({},_0x539eef,_0x434d5d[_0x0956('0x45')]);return db[_0x0956('0x3f')][_0x0956('0x46')](_0x539eef)[_0x0956('0x25')](handleEntityNotFound(_0x47063a,null))['then'](respondWithResult(_0x47063a,null))[_0x0956('0x42')](handleError(_0x47063a,null));};exports[_0x0956('0x47')]=function(_0x441862,_0x57bd75){return db[_0x0956('0x3f')][_0x0956('0x47')](_0x441862[_0x0956('0x48')],{})[_0x0956('0x25')](respondWithResult(_0x57bd75,0xc9))[_0x0956('0x42')](handleError(_0x57bd75,null));};exports[_0x0956('0x23')]=function(_0x13cf8e,_0x19fd34){if(_0x13cf8e['body']['id']){delete _0x13cf8e[_0x0956('0x48')]['id'];}return db['VoiceTransferReport']['find']({'where':{'id':_0x13cf8e[_0x0956('0x49')]['id']}})[_0x0956('0x25')](handleEntityNotFound(_0x19fd34,null))[_0x0956('0x25')](saveUpdates(_0x13cf8e[_0x0956('0x48')],null))[_0x0956('0x25')](respondWithResult(_0x19fd34,null))['catch'](handleError(_0x19fd34,null));};exports[_0x0956('0x24')]=function(_0x2f645c,_0x54cf4e){return db['VoiceTransferReport'][_0x0956('0x46')]({'where':{'id':_0x2f645c['params']['id']}})[_0x0956('0x25')](handleEntityNotFound(_0x54cf4e,null))['then'](removeEntity(_0x54cf4e,null))[_0x0956('0x42')](handleError(_0x54cf4e,null));};exports[_0x0956('0x4a')]=function(_0x3b2c96,_0x4e0f5d){return db[_0x0956('0x3f')][_0x0956('0x4a')]()[_0x0956('0x25')](respondWithResult(_0x4e0f5d,null))['catch'](handleError(_0x4e0f5d,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index a458021..c0ed5a9 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 _0xef20=['request-promise','path','rimraf','./voiceTransferReport.attributes','exports','VoiceTransferReport','report_call_transfer','util','../../config/logger','api','bluebird'];(function(_0x4e9ff6,_0x28642d){var _0x59c86f=function(_0x255969){while(--_0x255969){_0x4e9ff6['push'](_0x4e9ff6['shift']());}};_0x59c86f(++_0x28642d);}(_0xef20,0x172));var _0x0ef2=function(_0x2da36e,_0x483d0f){_0x2da36e=_0x2da36e-0x0;var _0x3b426a=_0xef20[_0x2da36e];return _0x3b426a;};'use strict';var _=require('lodash');var util=require(_0x0ef2('0x0'));var logger=require(_0x0ef2('0x1'))(_0x0ef2('0x2'));var moment=require('moment');var BPromise=require(_0x0ef2('0x3'));var rp=require(_0x0ef2('0x4'));var fs=require('fs');var path=require(_0x0ef2('0x5'));var rimraf=require(_0x0ef2('0x6'));var config=require('../../config/environment');var attributes=require(_0x0ef2('0x7'));module[_0x0ef2('0x8')]=function(_0x1e78e0,_0x4d116f){return _0x1e78e0['define'](_0x0ef2('0x9'),attributes,{'tableName':_0x0ef2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x581c=['../../config/environment','define','VoiceTransferReport','report_call_transfer','lodash','api','moment','bluebird','request-promise','rimraf'];(function(_0x2f14db,_0x5b73d1){var _0x452eea=function(_0x432dc9){while(--_0x432dc9){_0x2f14db['push'](_0x2f14db['shift']());}};_0x452eea(++_0x5b73d1);}(_0x581c,0x1a8));var _0xc581=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x581c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc581('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc581('0x1'));var moment=require(_0xc581('0x2'));var BPromise=require(_0xc581('0x3'));var rp=require(_0xc581('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc581('0x5'));var config=require(_0xc581('0x6'));var attributes=require('./voiceTransferReport.attributes');module['exports']=function(_0x46eee3,_0x27e785){return _0x46eee3[_0xc581('0x7')](_0xc581('0x8'),attributes,{'tableName':_0xc581('0x9'),'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 fcabcb9..beb62bb 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 _0x9ce5=['options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','CreateVoiceTransferReport','VoiceTransferReport','create'];(function(_0x22034c,_0xe89146){var _0x38a302=function(_0x4dc069){while(--_0x4dc069){_0x22034c['push'](_0x22034c['shift']());}};_0x38a302(++_0xe89146);}(_0x9ce5,0x8a));var _0x59ce=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0x9ce5[_0x2e0443];return _0x52d450;};'use strict';var _=require(_0x59ce('0x0'));var util=require(_0x59ce('0x1'));var moment=require(_0x59ce('0x2'));var BPromise=require(_0x59ce('0x3'));var rs=require(_0x59ce('0x4'));var fs=require('fs');var Redis=require(_0x59ce('0x5'));var db=require(_0x59ce('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x59ce('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x59ce('0x8'));var client=jayson[_0x59ce('0x9')][_0x59ce('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x184f16,_0x51e7ae,_0x3e93ec){return new BPromise(function(_0x9c176c,_0x3815eb){return client[_0x59ce('0xb')](_0x184f16,_0x3e93ec)[_0x59ce('0xc')](function(_0x34e7ca){logger[_0x59ce('0xd')](_0x59ce('0xe'),_0x51e7ae,'request\x20sent');logger[_0x59ce('0xf')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x51e7ae,_0x59ce('0x10'),JSON[_0x59ce('0x11')](_0x34e7ca));if(_0x34e7ca['error']){if(_0x34e7ca[_0x59ce('0x12')]['code']===0x1f4){logger[_0x59ce('0x12')](_0x59ce('0xe'),_0x51e7ae,_0x34e7ca[_0x59ce('0x12')][_0x59ce('0x13')]);return _0x3815eb(_0x34e7ca[_0x59ce('0x12')][_0x59ce('0x13')]);}logger[_0x59ce('0x12')](_0x59ce('0xe'),_0x51e7ae,_0x34e7ca[_0x59ce('0x12')][_0x59ce('0x13')]);return _0x9c176c(_0x34e7ca[_0x59ce('0x12')]['message']);}else{logger[_0x59ce('0xd')](_0x59ce('0xe'),_0x51e7ae,_0x59ce('0x10'));_0x9c176c(_0x34e7ca[_0x59ce('0x14')][_0x59ce('0x13')]);}})['catch'](function(_0xf8a383){logger['error'](_0x59ce('0xe'),_0x51e7ae,_0xf8a383);_0x3815eb(_0xf8a383);});});}exports[_0x59ce('0x15')]=function(_0x502ad3){var _0x4e3388=this;return new Promise(function(_0x2bb3cd,_0x1c8414){return db[_0x59ce('0x16')][_0x59ce('0x17')](_0x502ad3['body'],{'raw':_0x502ad3[_0x59ce('0x18')]?_0x502ad3['options'][_0x59ce('0x19')]===undefined?!![]:![]:!![]})[_0x59ce('0xc')](function(_0x2a220c){logger[_0x59ce('0xd')](_0x59ce('0x15'),_0x502ad3);logger[_0x59ce('0xf')](_0x59ce('0x15'),_0x502ad3,JSON[_0x59ce('0x11')](_0x2a220c));_0x2bb3cd(_0x2a220c);})[_0x59ce('0x1a')](function(_0x3106c6){logger[_0x59ce('0x12')]('CreateVoiceTransferReport',_0x3106c6[_0x59ce('0x13')],_0x502ad3);_0x1c8414(_0x4e3388[_0x59ce('0x12')](0x1f4,_0x3106c6[_0x59ce('0x13')]));});});}; \ No newline at end of file +var _0x780e=['../../config/environment','jayson/promise','client','http','request','info','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','CreateVoiceTransferReport','VoiceTransferReport','create','options','raw','then','stringify','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x780e,0x1b9));var _0xe780=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x780e[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xe780('0x0'));var util=require(_0xe780('0x1'));var moment=require('moment');var BPromise=require(_0xe780('0x2'));var rs=require(_0xe780('0x3'));var fs=require('fs');var Redis=require(_0xe780('0x4'));var db=require(_0xe780('0x5'))['db'];var utils=require(_0xe780('0x6'));var logger=require(_0xe780('0x7'))(_0xe780('0x8'));var config=require(_0xe780('0x9'));var jayson=require(_0xe780('0xa'));var client=jayson[_0xe780('0xb')][_0xe780('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2eb4c1,_0x34c4ac,_0x44a3cc){return new BPromise(function(_0x4ba82b,_0x56daf7){return client[_0xe780('0xd')](_0x2eb4c1,_0x44a3cc)['then'](function(_0x49f82c){logger[_0xe780('0xe')](_0xe780('0xf'),_0x34c4ac,_0xe780('0x10'));logger['debug'](_0xe780('0x11'),_0x34c4ac,'request\x20sent',JSON['stringify'](_0x49f82c));if(_0x49f82c[_0xe780('0x12')]){if(_0x49f82c[_0xe780('0x12')][_0xe780('0x13')]===0x1f4){logger[_0xe780('0x12')](_0xe780('0xf'),_0x34c4ac,_0x49f82c[_0xe780('0x12')]['message']);return _0x56daf7(_0x49f82c['error'][_0xe780('0x14')]);}logger[_0xe780('0x12')](_0xe780('0xf'),_0x34c4ac,_0x49f82c['error'][_0xe780('0x14')]);return _0x4ba82b(_0x49f82c[_0xe780('0x12')][_0xe780('0x14')]);}else{logger[_0xe780('0xe')](_0xe780('0xf'),_0x34c4ac,'request\x20sent');_0x4ba82b(_0x49f82c[_0xe780('0x15')]['message']);}})['catch'](function(_0x3a74fb){logger[_0xe780('0x12')](_0xe780('0xf'),_0x34c4ac,_0x3a74fb);_0x56daf7(_0x3a74fb);});});}exports[_0xe780('0x16')]=function(_0x17fc25){var _0x274b8d=this;return new Promise(function(_0x3d8772,_0xb9da72){return db[_0xe780('0x17')][_0xe780('0x18')](_0x17fc25['body'],{'raw':_0x17fc25[_0xe780('0x19')]?_0x17fc25[_0xe780('0x19')][_0xe780('0x1a')]===undefined?!![]:![]:!![]})[_0xe780('0x1b')](function(_0x5ee0e5){logger[_0xe780('0xe')](_0xe780('0x16'),_0x17fc25);logger['debug'](_0xe780('0x16'),_0x17fc25,JSON[_0xe780('0x1c')](_0x5ee0e5));_0x3d8772(_0x5ee0e5);})[_0xe780('0x1d')](function(_0x3492fa){logger[_0xe780('0x12')]('CreateVoiceTransferReport',_0x3492fa[_0xe780('0x14')],_0x17fc25);_0xb9da72(_0x274b8d[_0xe780('0x12')](0x1f4,_0x3492fa[_0xe780('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index f6041dc..4e727ee 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 _0xbec5=['exports','express','Router','./webbar.controller','post','/originate','isAuthenticated','isWebrtcLicence','/hangup','hangup','/answer','answer','/hold','/unhold','unhold','/calls','calls','/transfer','transfer'];(function(_0x4ac24a,_0x2b0781){var _0x537d5f=function(_0x1e9173){while(--_0x1e9173){_0x4ac24a['push'](_0x4ac24a['shift']());}};_0x537d5f(++_0x2b0781);}(_0xbec5,0xe5));var _0x5bec=function(_0x5e3701,_0x596265){_0x5e3701=_0x5e3701-0x0;var _0x345dcf=_0xbec5[_0x5e3701];return _0x345dcf;};'use strict';var express=require(_0x5bec('0x0'));var router=express[_0x5bec('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x5bec('0x2'));router[_0x5bec('0x3')](_0x5bec('0x4'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller['originate']);router[_0x5bec('0x3')](_0x5bec('0x7'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0x8')]);router[_0x5bec('0x3')](_0x5bec('0x9'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xa')]);router[_0x5bec('0x3')](_0x5bec('0xb'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller['hold']);router[_0x5bec('0x3')](_0x5bec('0xc'),auth[_0x5bec('0x5')](),auth['isWebrtcLicence'](),controller[_0x5bec('0xd')]);router[_0x5bec('0x3')](_0x5bec('0xe'),auth['isAuthenticated'](),auth[_0x5bec('0x6')](),controller[_0x5bec('0xf')]);router['post'](_0x5bec('0x10'),auth[_0x5bec('0x5')](),auth[_0x5bec('0x6')](),controller[_0x5bec('0x11')]);module[_0x5bec('0x12')]=router; \ No newline at end of file +var _0x0bb5=['unhold','/calls','calls','/transfer','exports','express','Router','post','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','/answer','/hold','hold','/unhold'];(function(_0x4f7d68,_0x4c6913){var _0x4d9cb2=function(_0x20a740){while(--_0x20a740){_0x4f7d68['push'](_0x4f7d68['shift']());}};_0x4d9cb2(++_0x4c6913);}(_0x0bb5,0x148));var _0x50bb=function(_0x4104bc,_0x5e9274){_0x4104bc=_0x4104bc-0x0;var _0x39c1cf=_0x0bb5[_0x4104bc];return _0x39c1cf;};'use strict';var express=require(_0x50bb('0x0'));var router=express[_0x50bb('0x1')]();var auth=require('../../components/auth/service');var controller=require('./webbar.controller');router[_0x50bb('0x2')](_0x50bb('0x3'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0x6')]);router[_0x50bb('0x2')](_0x50bb('0x7'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller['hangup']);router[_0x50bb('0x2')](_0x50bb('0x8'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['answer']);router['post'](_0x50bb('0x9'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xa')]);router['post'](_0x50bb('0xb'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller[_0x50bb('0xc')]);router[_0x50bb('0x2')](_0x50bb('0xd'),auth[_0x50bb('0x4')](),auth['isWebrtcLicence'](),controller[_0x50bb('0xe')]);router['post'](_0x50bb('0xf'),auth[_0x50bb('0x4')](),auth[_0x50bb('0x5')](),controller['transfer']);module[_0x50bb('0x10')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 6e836c9..9bee4f2 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 _0xe3af=['webbar:hangup','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','hold\x20executed!','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','http','../../config/logger','ioredis','redis','localhost','socket.io-emitter','validate','number','userId\x20is\x20required','string','stringify','emit','handleError:','error','stack','name','send','status','NotFound','code','message','catch','User','agent','then','VoiceChannels','all','filter','rows','UserId','sessionId\x20','\x20not\x20found!','info','body','length','json','userId','callerId','callbackUrl','entityFound:','format','user:%s','hangup','hangup\x20fired:','sessionId'];(function(_0x38205b,_0x104099){var _0x62ae45=function(_0x1643a0){while(--_0x1643a0){_0x38205b['push'](_0x38205b['shift']());}};_0x62ae45(++_0x104099);}(_0xe3af,0xf4));var _0xfe3a=function(_0x282916,_0x29c453){_0x282916=_0x282916-0x0;var _0x317b39=_0xe3af[_0x282916];return _0x317b39;};'use strict';var path=require(_0xfe3a('0x0'));var fs=require('fs');var _=require(_0xfe3a('0x1'));var db=require(_0xfe3a('0x2'))['db'];var config=require(_0xfe3a('0x3'));var util=require(_0xfe3a('0x4'));var BPromise=require(_0xfe3a('0x5'));var jayson=require(_0xfe3a('0x6'));var amiClient=jayson['client'][_0xfe3a('0x7')]({'port':0x232a});var logger=require(_0xfe3a('0x8'))('webbarapi');var Redis=require(_0xfe3a('0x9'));config[_0xfe3a('0xa')]=_['defaults'](config[_0xfe3a('0xa')],{'host':_0xfe3a('0xb'),'port':0x18eb});var io=require(_0xfe3a('0xc'))(new Redis(config[_0xfe3a('0xa')]));var Schema=require(_0xfe3a('0xd'));var originateValidation=new Schema({'userId':{'type':_0xfe3a('0xe'),'required':[!![],_0xfe3a('0xf')]},'callNumber':{'type':_0xfe3a('0x10'),'required':[!![],'callNumber\x20is\x20required']},'callerId':{'type':'string'},'callbackUrl':{'type':_0xfe3a('0x10')}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfe3a('0xf')]},'sessionId':{'type':_0xfe3a('0x10'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xfe3a('0xe'),'required':[!![],_0xfe3a('0xf')]},'sessionId':{'type':_0xfe3a('0x10'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0xfe3a('0xe'),'required':[!![],_0xfe3a('0xf')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xfe3a('0x10'),'required':[!![],'transferNumber\x20is\x20required']}});var holdValidation=new Schema({'userId':{'type':_0xfe3a('0xe'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xfe3a('0x10'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xfe3a('0xe'),'required':[!![],_0xfe3a('0xf')]},'sessionId':{'type':'string','required':![]}});var callsValidation=new Schema({'userId':{'type':'number','required':[!![],_0xfe3a('0xf')]}});var conferenceValidation=new Schema({'userId':{'type':_0xfe3a('0xe'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x553c0f,_0x40985e,_0x224659){logger['info'](_0x553c0f,_0x40985e,JSON[_0xfe3a('0x11')](_0x224659));io['to'](_0x553c0f)[_0xfe3a('0x12')](_0x40985e,_0x224659);}function handleError(_0xc5199e){return function(_0x1c40ec){console['log'](_0xfe3a('0x13'),_0x1c40ec,_0x1c40ec instanceof RangeError);logger[_0xfe3a('0x14')](_0x1c40ec[_0xfe3a('0x15')]);if(_0x1c40ec instanceof RangeError){if(_0x1c40ec[_0xfe3a('0x16')]){delete _0x1c40ec[_0xfe3a('0x16')];}_0xc5199e['status'](0x194)[_0xfe3a('0x17')](_0x1c40ec);}else{if(_0x1c40ec[_0xfe3a('0x16')]){delete _0x1c40ec[_0xfe3a('0x16')];}_0xc5199e[_0xfe3a('0x18')](0x1f4)[_0xfe3a('0x17')](_0x1c40ec);}};}function checkError(){return function(_0x491e51){if(!_0x491e51){throw new RangeError(_0xfe3a('0x19'));}return _0x491e51;};}function respondWithRpcPromise(_0x5bf55a,_0x59b567){return new BPromise(function(_0x201997,_0x294d76){var _0x4de6c5=amiClient;return _0x4de6c5['request'](_0x5bf55a,_0x59b567)['then'](function(_0x599b9f){if(_0x599b9f[_0xfe3a('0x14')]){if(_0x599b9f[_0xfe3a('0x14')][_0xfe3a('0x1a')]===0x1f4){return _0x294d76(_0x599b9f[_0xfe3a('0x14')][_0xfe3a('0x1b')]);}return _0x201997(_0x599b9f[_0xfe3a('0x14')][_0xfe3a('0x1b')]);}else{_0x201997(_0x599b9f['result']);}})[_0xfe3a('0x1c')](function(_0x59eddf){_0x294d76(_0x59eddf);});});}function getAgent(_0x30147a){return db[_0xfe3a('0x1d')]['findOne']({'where':{'id':_0x30147a,'role':_0xfe3a('0x1e')}})[_0xfe3a('0x1f')](checkError());}function getAgentCheckSession(_0x2d9b5c,_0x144c45){return new BPromise(function(_0x592204,_0x63d623){var _0x48e29b=respondWithRpcPromise(_0xfe3a('0x20'));var _0x4b1a56=getAgent(_0x2d9b5c);Promise[_0xfe3a('0x21')]([_0x48e29b,_0x4b1a56])[_0xfe3a('0x1f')](function(_0x3b1da0){var _0x61b5de=_0x3b1da0[0x0];var _0x253067=_0x3b1da0[0x1];var _0x31f382=_[_0xfe3a('0x22')](_0x61b5de[_0xfe3a('0x23')],function(_0x17cecc){return _0x17cecc[_0xfe3a('0x24')]==_0x253067['id']&&_0x17cecc['sessionId']==_0x144c45;});if(_0x31f382['length']==0x1){_0x592204(_0x253067);}else{_0x63d623(new RangeError(_0xfe3a('0x25')+_0x144c45+_0xfe3a('0x26')));}});});}exports['originate']=function(_0x4a0a01,_0x10ce12){logger[_0xfe3a('0x27')]('originate\x20fired:',_0x4a0a01[_0xfe3a('0x28')]);var _0x32c4f2=originateValidation[_0xfe3a('0xd')](_0x4a0a01[_0xfe3a('0x28')]);if(_0x32c4f2[_0xfe3a('0x29')]>0x0){return _0x10ce12[_0xfe3a('0x18')](0x190)[_0xfe3a('0x2a')](_0x32c4f2);}var _0x3ee1c3=_0x4a0a01[_0xfe3a('0x28')][_0xfe3a('0x2b')];var _0x145645=_0x4a0a01[_0xfe3a('0x28')]['callNumber'];var _0x503a15=_0x4a0a01[_0xfe3a('0x28')][_0xfe3a('0x2c')];var _0x18f858=_0x4a0a01[_0xfe3a('0x28')][_0xfe3a('0x2d')];return getAgent(_0x3ee1c3)['then'](function(_0x3b73ab){logger['info'](_0xfe3a('0x2e'),_0x3b73ab[_0xfe3a('0x16')]);emit(util[_0xfe3a('0x2f')](_0xfe3a('0x30'),_0x3b73ab[_0xfe3a('0x16')]),'webbar:originate',{'callNumber':_0x145645,'callerId':_0x503a15,'callbackUrl':_0x18f858});return _0x10ce12[_0xfe3a('0x18')](0xc8)[_0xfe3a('0x2a')]({'error':![],'message':'originate\x20executed!'});})[_0xfe3a('0x1c')](handleError(_0x10ce12));};exports[_0xfe3a('0x31')]=function(_0x358b5a,_0x24a9ef){logger['info'](_0xfe3a('0x32'),_0x358b5a[_0xfe3a('0x28')]);var _0x3e4961=hangupValidation[_0xfe3a('0xd')](_0x358b5a[_0xfe3a('0x28')]);if(_0x3e4961[_0xfe3a('0x29')]>0x0){return _0x24a9ef[_0xfe3a('0x18')](0x190)[_0xfe3a('0x2a')](_0x3e4961);}var _0x1ecce1=_0x358b5a[_0xfe3a('0x28')][_0xfe3a('0x2b')];var _0x58ab6d=_0x358b5a['body'][_0xfe3a('0x33')];return getAgent(_0x1ecce1)[_0xfe3a('0x1f')](function(_0x150b6b){logger[_0xfe3a('0x27')](_0xfe3a('0x2e'),_0x150b6b['name']);emit(util['format'](_0xfe3a('0x30'),_0x150b6b[_0xfe3a('0x16')]),_0xfe3a('0x34'),{'sessionId':_0x58ab6d});return _0x24a9ef['status'](0xc8)['json']({'error':![],'message':_0xfe3a('0x35')});})[_0xfe3a('0x1c')](handleError(_0x24a9ef));};exports[_0xfe3a('0x36')]=function(_0x5e97a9,_0x30ceea){logger[_0xfe3a('0x27')](_0xfe3a('0x37'),_0x5e97a9[_0xfe3a('0x28')]);var _0xe11294=answerValidation[_0xfe3a('0xd')](_0x5e97a9[_0xfe3a('0x28')]);if(_0xe11294[_0xfe3a('0x29')]>0x0){return _0x30ceea['status'](0x190)[_0xfe3a('0x2a')](_0xe11294);}var _0xe724e6=_0x5e97a9[_0xfe3a('0x28')][_0xfe3a('0x2b')];var _0xfc20cf=_0x5e97a9['body']['sessionId'];return getAgent(_0xe724e6)[_0xfe3a('0x1f')](function(_0xf2eae0){logger[_0xfe3a('0x27')](_0xfe3a('0x2e'),_0xf2eae0[_0xfe3a('0x16')]);emit(util[_0xfe3a('0x2f')](_0xfe3a('0x30'),_0xf2eae0[_0xfe3a('0x16')]),_0xfe3a('0x38'),{'sessionId':_0xfc20cf});return _0x30ceea[_0xfe3a('0x18')](0xc8)[_0xfe3a('0x2a')]({'error':![],'message':_0xfe3a('0x39')});})[_0xfe3a('0x1c')](handleError(_0x30ceea));};exports[_0xfe3a('0x3a')]=function(_0x504b79,_0xb35f89){logger[_0xfe3a('0x27')](_0xfe3a('0x3b'),_0x504b79['body']);var _0x4b5ddf=holdValidation[_0xfe3a('0xd')](_0x504b79['body']);if(_0x4b5ddf[_0xfe3a('0x29')]>0x0){return _0xb35f89['status'](0x190)[_0xfe3a('0x2a')](_0x4b5ddf);}var _0x2b4532=_0x504b79['body'][_0xfe3a('0x2b')];var _0x4d9a53=_0x504b79[_0xfe3a('0x28')][_0xfe3a('0x33')];return getAgent(_0x2b4532)[_0xfe3a('0x1f')](function(_0x400c21){logger[_0xfe3a('0x27')](_0xfe3a('0x2e'),_0x400c21[_0xfe3a('0x16')]);emit(util[_0xfe3a('0x2f')](_0xfe3a('0x30'),_0x400c21[_0xfe3a('0x16')]),'webbar:hold',{'sessionId':_0x4d9a53});return _0xb35f89['status'](0xc8)['json']({'error':![],'message':_0xfe3a('0x3c')});})[_0xfe3a('0x1c')](handleError(_0xb35f89));};exports[_0xfe3a('0x3d')]=function(_0x134571,_0x458e76){logger[_0xfe3a('0x27')](_0xfe3a('0x3e'),_0x134571[_0xfe3a('0x28')]);var _0x2d26b0=unholdValidation[_0xfe3a('0xd')](_0x134571['body']);if(_0x2d26b0[_0xfe3a('0x29')]>0x0){return _0x458e76['status'](0x190)[_0xfe3a('0x2a')](_0x2d26b0);}var _0x5d1bf2=_0x134571[_0xfe3a('0x28')][_0xfe3a('0x2b')];var _0x2ed103=_0x134571['body'][_0xfe3a('0x33')];return getAgent(_0x5d1bf2)[_0xfe3a('0x1f')](function(_0x3cf03d){logger[_0xfe3a('0x27')](_0xfe3a('0x2e'),_0x3cf03d[_0xfe3a('0x16')]);emit(util[_0xfe3a('0x2f')](_0xfe3a('0x30'),_0x3cf03d['name']),_0xfe3a('0x3f'),{'sessionId':_0x2ed103});return _0x458e76[_0xfe3a('0x18')](0xc8)[_0xfe3a('0x2a')]({'error':![],'message':_0xfe3a('0x40')});})[_0xfe3a('0x1c')](handleError(_0x458e76));};exports[_0xfe3a('0x41')]=function(_0x40e05a,_0x28264d){logger[_0xfe3a('0x27')]('calls\x20fired:',_0x28264d[_0xfe3a('0x28')]);var _0x43633b=callsValidation['validate'](_0x40e05a[_0xfe3a('0x28')]);if(_0x43633b[_0xfe3a('0x29')]>0x0){return _0x28264d[_0xfe3a('0x18')](0x190)[_0xfe3a('0x2a')](_0x43633b);}var _0x178759=_0x40e05a['body'][_0xfe3a('0x2b')];var _0x343d7c=respondWithRpcPromise(_0xfe3a('0x20'));var _0x5ce53e=getAgent(_0x178759);return Promise[_0xfe3a('0x21')]([_0x343d7c,_0x5ce53e])[_0xfe3a('0x1f')](function(_0x4d7292){var _0x39cae4=_0x4d7292[0x0];var _0x121a28=_0x4d7292[0x1];var _0x5d7da6=_['filter'](_0x39cae4[_0xfe3a('0x23')],function(_0x2895a8){return _0x2895a8[_0xfe3a('0x24')]==_0x121a28['id'];});return _0x28264d[_0xfe3a('0x18')](0xc8)[_0xfe3a('0x2a')]({'count':_0x5d7da6['length'],'rows':_0x5d7da6});})[_0xfe3a('0x1c')](handleError(_0x28264d));};exports[_0xfe3a('0x42')]=function(_0x4af114,_0x123b9c){logger['info'](_0xfe3a('0x43'),_0x4af114[_0xfe3a('0x28')]);var _0x381982=conferenceValidation[_0xfe3a('0xd')](_0x4af114[_0xfe3a('0x28')]);if(_0x381982[_0xfe3a('0x29')]>0x0){return _0x123b9c[_0xfe3a('0x18')](0x190)[_0xfe3a('0x2a')](_0x381982);}var _0x5867d3=_0x4af114[_0xfe3a('0x28')][_0xfe3a('0x2b')];return getAgent(_0x5867d3)[_0xfe3a('0x1f')](function(_0x35ea54){logger[_0xfe3a('0x27')](_0xfe3a('0x2e'),_0x35ea54[_0xfe3a('0x16')]);emit(util[_0xfe3a('0x2f')](_0xfe3a('0x30'),_0x35ea54[_0xfe3a('0x16')]),_0xfe3a('0x44'));return _0x123b9c[_0xfe3a('0x18')](0xc8)[_0xfe3a('0x2a')]({'error':![],'message':_0xfe3a('0x45')});})[_0xfe3a('0x1c')](handleError(_0x123b9c));};exports[_0xfe3a('0x46')]=function(_0x20ee8f,_0x3e93ac){logger[_0xfe3a('0x27')](_0xfe3a('0x47'),_0x20ee8f[_0xfe3a('0x28')]);var _0xe5073c=transferValidation['validate'](_0x20ee8f[_0xfe3a('0x28')]);if(_0xe5073c[_0xfe3a('0x29')]>0x0){return _0x3e93ac['status'](0x190)[_0xfe3a('0x2a')](_0xe5073c);}var _0x4ba899=_0x20ee8f[_0xfe3a('0x28')][_0xfe3a('0x2b')];var _0x3a52fb=_0x20ee8f[_0xfe3a('0x28')][_0xfe3a('0x33')];var _0x39734a=_0x20ee8f['body']['transferNumber'];return getAgent(_0x4ba899)[_0xfe3a('0x1f')](function(_0xd45362){logger['info'](_0xfe3a('0x2e'),_0xd45362[_0xfe3a('0x16')]);emit(util['format'](_0xfe3a('0x30'),_0xd45362[_0xfe3a('0x16')]),_0xfe3a('0x48'),{'sessionId':_0x3a52fb,'transferNumber':_0x39734a});return _0x3e93ac[_0xfe3a('0x18')](0xc8)[_0xfe3a('0x2a')]({'error':![],'message':_0xfe3a('0x49')});})[_0xfe3a('0x1c')](handleError(_0x3e93ac));}; \ No newline at end of file +var _0x6556=['client','http','../../config/logger','ioredis','redis','localhost','socket.io-emitter','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','handleError:','error','stack','name','status','send','NotFound','request','then','message','catch','findOne','VoiceChannels','all','rows','sessionId','length','originate','originate\x20fired:','body','validate','callNumber','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','userId','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','webbar:hold','unhold','unhold\x20fired:','webbar:unhold','unhold\x20executed!','calls\x20fired:','filter','UserId','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird'];(function(_0x1daa55,_0x5eba07){var _0xae58f4=function(_0x2bc7cf){while(--_0x2bc7cf){_0x1daa55['push'](_0x1daa55['shift']());}};_0xae58f4(++_0x5eba07);}(_0x6556,0x8b));var _0x6655=function(_0x9aa68c,_0x5ce11f){_0x9aa68c=_0x9aa68c-0x0;var _0x583fd5=_0x6556[_0x9aa68c];return _0x583fd5;};'use strict';var path=require(_0x6655('0x0'));var fs=require('fs');var _=require(_0x6655('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x6655('0x2'));var util=require(_0x6655('0x3'));var BPromise=require(_0x6655('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0x6655('0x5')][_0x6655('0x6')]({'port':0x232a});var logger=require(_0x6655('0x7'))('webbarapi');var Redis=require(_0x6655('0x8'));config[_0x6655('0x9')]=_['defaults'](config[_0x6655('0x9')],{'host':_0x6655('0xa'),'port':0x18eb});var io=require(_0x6655('0xb'))(new Redis(config[_0x6655('0x9')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0x6655('0xc'),'required':[!![],_0x6655('0xd')]},'callNumber':{'type':_0x6655('0xe'),'required':[!![],_0x6655('0xf')]},'callerId':{'type':_0x6655('0xe')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':'number','required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6655('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0x6655('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6655('0xd')]},'sessionId':{'type':_0x6655('0xe'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':'string','required':[!![],_0x6655('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x6655('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x6655('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6655('0xd')]},'sessionId':{'type':_0x6655('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x6655('0xc'),'required':[!![],_0x6655('0xd')]}});var conferenceValidation=new Schema({'userId':{'type':'number','required':[!![],_0x6655('0xd')]}});function emit(_0x3d758f,_0xa66733,_0x3a8b84){logger[_0x6655('0x11')](_0x3d758f,_0xa66733,JSON[_0x6655('0x12')](_0x3a8b84));io['to'](_0x3d758f)[_0x6655('0x13')](_0xa66733,_0x3a8b84);}function handleError(_0x299c8b){return function(_0x2c6416){console['log'](_0x6655('0x14'),_0x2c6416,_0x2c6416 instanceof RangeError);logger[_0x6655('0x15')](_0x2c6416[_0x6655('0x16')]);if(_0x2c6416 instanceof RangeError){if(_0x2c6416[_0x6655('0x17')]){delete _0x2c6416[_0x6655('0x17')];}_0x299c8b[_0x6655('0x18')](0x194)[_0x6655('0x19')](_0x2c6416);}else{if(_0x2c6416[_0x6655('0x17')]){delete _0x2c6416[_0x6655('0x17')];}_0x299c8b['status'](0x1f4)['send'](_0x2c6416);}};}function checkError(){return function(_0x3cbe11){if(!_0x3cbe11){throw new RangeError(_0x6655('0x1a'));}return _0x3cbe11;};}function respondWithRpcPromise(_0x2642b5,_0x58bd88){return new BPromise(function(_0xf99c5c,_0x5e02d9){var _0x499b64=amiClient;return _0x499b64[_0x6655('0x1b')](_0x2642b5,_0x58bd88)[_0x6655('0x1c')](function(_0x46e142){if(_0x46e142[_0x6655('0x15')]){if(_0x46e142[_0x6655('0x15')]['code']===0x1f4){return _0x5e02d9(_0x46e142[_0x6655('0x15')][_0x6655('0x1d')]);}return _0xf99c5c(_0x46e142[_0x6655('0x15')][_0x6655('0x1d')]);}else{_0xf99c5c(_0x46e142['result']);}})[_0x6655('0x1e')](function(_0x5511d5){_0x5e02d9(_0x5511d5);});});}function getAgent(_0x186c9b){return db['User'][_0x6655('0x1f')]({'where':{'id':_0x186c9b,'role':'agent'}})[_0x6655('0x1c')](checkError());}function getAgentCheckSession(_0x1c1c27,_0x3df0fd){return new BPromise(function(_0xf7e151,_0x30a521){var _0x1b8595=respondWithRpcPromise(_0x6655('0x20'));var _0x591b20=getAgent(_0x1c1c27);Promise[_0x6655('0x21')]([_0x1b8595,_0x591b20])['then'](function(_0x28f7a8){var _0x8e229d=_0x28f7a8[0x0];var _0x1ad0f0=_0x28f7a8[0x1];var _0xbb3d73=_['filter'](_0x8e229d[_0x6655('0x22')],function(_0x1b0eff){return _0x1b0eff['UserId']==_0x1ad0f0['id']&&_0x1b0eff[_0x6655('0x23')]==_0x3df0fd;});if(_0xbb3d73[_0x6655('0x24')]==0x1){_0xf7e151(_0x1ad0f0);}else{_0x30a521(new RangeError('sessionId\x20'+_0x3df0fd+'\x20not\x20found!'));}});});}exports[_0x6655('0x25')]=function(_0x38a3fa,_0x35667f){logger[_0x6655('0x11')](_0x6655('0x26'),_0x38a3fa[_0x6655('0x27')]);var _0x2e319e=originateValidation[_0x6655('0x28')](_0x38a3fa[_0x6655('0x27')]);if(_0x2e319e[_0x6655('0x24')]>0x0){return _0x35667f[_0x6655('0x18')](0x190)['json'](_0x2e319e);}var _0x31ad26=_0x38a3fa[_0x6655('0x27')]['userId'];var _0x24424a=_0x38a3fa[_0x6655('0x27')][_0x6655('0x29')];var _0x6caead=_0x38a3fa[_0x6655('0x27')]['callerId'];var _0x2fde60=_0x38a3fa['body'][_0x6655('0x2a')];return getAgent(_0x31ad26)[_0x6655('0x1c')](function(_0x164dbb){logger[_0x6655('0x11')](_0x6655('0x2b'),_0x164dbb[_0x6655('0x17')]);emit(util[_0x6655('0x2c')](_0x6655('0x2d'),_0x164dbb[_0x6655('0x17')]),_0x6655('0x2e'),{'callNumber':_0x24424a,'callerId':_0x6caead,'callbackUrl':_0x2fde60});return _0x35667f[_0x6655('0x18')](0xc8)[_0x6655('0x2f')]({'error':![],'message':_0x6655('0x30')});})[_0x6655('0x1e')](handleError(_0x35667f));};exports['hangup']=function(_0x58c075,_0x7c5933){logger['info']('hangup\x20fired:',_0x58c075['body']);var _0x11f9ca=hangupValidation[_0x6655('0x28')](_0x58c075[_0x6655('0x27')]);if(_0x11f9ca['length']>0x0){return _0x7c5933['status'](0x190)[_0x6655('0x2f')](_0x11f9ca);}var _0x2565e5=_0x58c075['body'][_0x6655('0x31')];var _0x41b67e=_0x58c075[_0x6655('0x27')][_0x6655('0x23')];return getAgent(_0x2565e5)['then'](function(_0x3c66f1){logger[_0x6655('0x11')]('entityFound:',_0x3c66f1[_0x6655('0x17')]);emit(util[_0x6655('0x2c')](_0x6655('0x2d'),_0x3c66f1[_0x6655('0x17')]),'webbar:hangup',{'sessionId':_0x41b67e});return _0x7c5933['status'](0xc8)[_0x6655('0x2f')]({'error':![],'message':_0x6655('0x32')});})[_0x6655('0x1e')](handleError(_0x7c5933));};exports[_0x6655('0x33')]=function(_0x3dd9cc,_0x24d79a){logger[_0x6655('0x11')](_0x6655('0x34'),_0x3dd9cc[_0x6655('0x27')]);var _0x2bc1d4=answerValidation[_0x6655('0x28')](_0x3dd9cc['body']);if(_0x2bc1d4[_0x6655('0x24')]>0x0){return _0x24d79a[_0x6655('0x18')](0x190)['json'](_0x2bc1d4);}var _0x453d0d=_0x3dd9cc[_0x6655('0x27')][_0x6655('0x31')];var _0x487e14=_0x3dd9cc[_0x6655('0x27')][_0x6655('0x23')];return getAgent(_0x453d0d)['then'](function(_0x5b57e2){logger[_0x6655('0x11')]('entityFound:',_0x5b57e2['name']);emit(util['format']('user:%s',_0x5b57e2[_0x6655('0x17')]),_0x6655('0x35'),{'sessionId':_0x487e14});return _0x24d79a[_0x6655('0x18')](0xc8)['json']({'error':![],'message':_0x6655('0x36')});})['catch'](handleError(_0x24d79a));};exports[_0x6655('0x37')]=function(_0x5ced4b,_0x336328){logger[_0x6655('0x11')](_0x6655('0x38'),_0x5ced4b['body']);var _0x30c0ee=holdValidation[_0x6655('0x28')](_0x5ced4b[_0x6655('0x27')]);if(_0x30c0ee[_0x6655('0x24')]>0x0){return _0x336328[_0x6655('0x18')](0x190)[_0x6655('0x2f')](_0x30c0ee);}var _0x2928c2=_0x5ced4b[_0x6655('0x27')][_0x6655('0x31')];var _0x5e395b=_0x5ced4b[_0x6655('0x27')]['sessionId'];return getAgent(_0x2928c2)[_0x6655('0x1c')](function(_0x316c75){logger['info']('entityFound:',_0x316c75['name']);emit(util['format'](_0x6655('0x2d'),_0x316c75[_0x6655('0x17')]),_0x6655('0x39'),{'sessionId':_0x5e395b});return _0x336328[_0x6655('0x18')](0xc8)[_0x6655('0x2f')]({'error':![],'message':'hold\x20executed!'});})['catch'](handleError(_0x336328));};exports[_0x6655('0x3a')]=function(_0x34470c,_0x470a2c){logger['info'](_0x6655('0x3b'),_0x34470c['body']);var _0xe0ce15=unholdValidation[_0x6655('0x28')](_0x34470c[_0x6655('0x27')]);if(_0xe0ce15[_0x6655('0x24')]>0x0){return _0x470a2c['status'](0x190)['json'](_0xe0ce15);}var _0x4062ca=_0x34470c['body']['userId'];var _0x2f3e29=_0x34470c['body'][_0x6655('0x23')];return getAgent(_0x4062ca)[_0x6655('0x1c')](function(_0x1d428d){logger['info'](_0x6655('0x2b'),_0x1d428d[_0x6655('0x17')]);emit(util[_0x6655('0x2c')](_0x6655('0x2d'),_0x1d428d[_0x6655('0x17')]),_0x6655('0x3c'),{'sessionId':_0x2f3e29});return _0x470a2c[_0x6655('0x18')](0xc8)['json']({'error':![],'message':_0x6655('0x3d')});})[_0x6655('0x1e')](handleError(_0x470a2c));};exports['calls']=function(_0x4e3d5e,_0x137d57){logger['info'](_0x6655('0x3e'),_0x137d57[_0x6655('0x27')]);var _0x4fca1c=callsValidation[_0x6655('0x28')](_0x4e3d5e['body']);if(_0x4fca1c[_0x6655('0x24')]>0x0){return _0x137d57[_0x6655('0x18')](0x190)[_0x6655('0x2f')](_0x4fca1c);}var _0x1fa7e2=_0x4e3d5e[_0x6655('0x27')][_0x6655('0x31')];var _0x19f732=respondWithRpcPromise(_0x6655('0x20'));var _0x9ba02e=getAgent(_0x1fa7e2);return Promise['all']([_0x19f732,_0x9ba02e])[_0x6655('0x1c')](function(_0x1be99e){var _0x5b7cb2=_0x1be99e[0x0];var _0xf19f76=_0x1be99e[0x1];var _0x3719cd=_[_0x6655('0x3f')](_0x5b7cb2[_0x6655('0x22')],function(_0x443860){return _0x443860[_0x6655('0x40')]==_0xf19f76['id'];});return _0x137d57[_0x6655('0x18')](0xc8)[_0x6655('0x2f')]({'count':_0x3719cd[_0x6655('0x24')],'rows':_0x3719cd});})[_0x6655('0x1e')](handleError(_0x137d57));};exports[_0x6655('0x41')]=function(_0x50d5d0,_0x2aeeff){logger['info'](_0x6655('0x42'),_0x50d5d0[_0x6655('0x27')]);var _0x30ccfa=conferenceValidation['validate'](_0x50d5d0[_0x6655('0x27')]);if(_0x30ccfa[_0x6655('0x24')]>0x0){return _0x2aeeff[_0x6655('0x18')](0x190)[_0x6655('0x2f')](_0x30ccfa);}var _0x4d82a6=_0x50d5d0[_0x6655('0x27')]['userId'];return getAgent(_0x4d82a6)[_0x6655('0x1c')](function(_0x2c7d7c){logger[_0x6655('0x11')](_0x6655('0x2b'),_0x2c7d7c[_0x6655('0x17')]);emit(util[_0x6655('0x2c')](_0x6655('0x2d'),_0x2c7d7c['name']),_0x6655('0x43'));return _0x2aeeff[_0x6655('0x18')](0xc8)[_0x6655('0x2f')]({'error':![],'message':_0x6655('0x44')});})[_0x6655('0x1e')](handleError(_0x2aeeff));};exports['transfer']=function(_0x5631d2,_0x41fe78){logger['info']('transfer\x20fired:',_0x5631d2[_0x6655('0x27')]);var _0x5dc19f=transferValidation[_0x6655('0x28')](_0x5631d2[_0x6655('0x27')]);if(_0x5dc19f[_0x6655('0x24')]>0x0){return _0x41fe78[_0x6655('0x18')](0x190)[_0x6655('0x2f')](_0x5dc19f);}var _0x51c8a4=_0x5631d2[_0x6655('0x27')]['userId'];var _0x44d925=_0x5631d2['body']['sessionId'];var _0x245144=_0x5631d2[_0x6655('0x27')][_0x6655('0x45')];return getAgent(_0x51c8a4)[_0x6655('0x1c')](function(_0xaf6b67){logger[_0x6655('0x11')](_0x6655('0x2b'),_0xaf6b67['name']);emit(util[_0x6655('0x2c')](_0x6655('0x2d'),_0xaf6b67[_0x6655('0x17')]),_0x6655('0x46'),{'sessionId':_0x44d925,'transferNumber':_0x245144});return _0x41fe78[_0x6655('0x18')](0xc8)['json']({'error':![],'message':_0x6655('0x47')});})[_0x6655('0x1e')](handleError(_0x41fe78));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index cca9a32..d7b21c2 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 _0x7fe2=['delete','removeDispositions','removeAnswers','removeAgents','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappAccount.controller','get','isAuthenticated','/describe','describe','/:id','getDispositions','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','post','create','/:id/dispositions','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update'];(function(_0x1dfa53,_0x137031){var _0x3f377b=function(_0x2b2ba7){while(--_0x2b2ba7){_0x1dfa53['push'](_0x1dfa53['shift']());}};_0x3f377b(++_0x137031);}(_0x7fe2,0xa1));var _0x27fe=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x7fe2[_0x3cae69];return _0x3128eb;};'use strict';var multer=require('multer');var util=require(_0x27fe('0x0'));var path=require(_0x27fe('0x1'));var timeout=require(_0x27fe('0x2'));var express=require(_0x27fe('0x3'));var router=express[_0x27fe('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x27fe('0x5'));var interaction=require(_0x27fe('0x6'));var config=require(_0x27fe('0x7'));var controller=require(_0x27fe('0x8'));router[_0x27fe('0x9')]('/',auth[_0x27fe('0xa')](),controller['index']);router['get'](_0x27fe('0xb'),auth[_0x27fe('0xa')](),controller[_0x27fe('0xc')]);router[_0x27fe('0x9')](_0x27fe('0xd'),auth[_0x27fe('0xa')](),controller['show']);router[_0x27fe('0x9')]('/:id/dispositions',auth[_0x27fe('0xa')](),controller[_0x27fe('0xe')]);router['get'](_0x27fe('0xf'),auth[_0x27fe('0xa')](),controller[_0x27fe('0x10')]);router[_0x27fe('0x9')](_0x27fe('0x11'),auth[_0x27fe('0xa')](),controller[_0x27fe('0x12')]);router[_0x27fe('0x9')](_0x27fe('0x13'),auth['isAuthenticated'](),controller[_0x27fe('0x14')]);router[_0x27fe('0x15')]('/',auth[_0x27fe('0xa')](),controller[_0x27fe('0x16')]);router['post'](_0x27fe('0x17'),auth[_0x27fe('0xa')](),controller[_0x27fe('0x18')]);router['post']('/:id/canned_answers',auth[_0x27fe('0xa')](),controller[_0x27fe('0x19')]);router['post'](_0x27fe('0x11'),auth[_0x27fe('0xa')](),controller[_0x27fe('0x1a')]);router['post']('/:id/applications',auth[_0x27fe('0xa')](),controller[_0x27fe('0x1b')]);router[_0x27fe('0x15')](_0x27fe('0x1c'),controller[_0x27fe('0x1d')]);router[_0x27fe('0x15')](_0x27fe('0x1e'),auth[_0x27fe('0xa')](),controller[_0x27fe('0x1f')]);router[_0x27fe('0x20')]('/:id',auth['isAuthenticated'](),controller[_0x27fe('0x21')]);router[_0x27fe('0x22')](_0x27fe('0xd'),auth[_0x27fe('0xa')](),controller['destroy']);router[_0x27fe('0x22')](_0x27fe('0x17'),auth['isAuthenticated'](),controller[_0x27fe('0x23')]);router[_0x27fe('0x22')](_0x27fe('0xf'),auth[_0x27fe('0xa')](),controller[_0x27fe('0x24')]);router[_0x27fe('0x22')](_0x27fe('0x11'),auth['isAuthenticated'](),controller[_0x27fe('0x25')]);module[_0x27fe('0x26')]=router; \ No newline at end of file +var _0x134e=['getAnswers','/:id/users','getAgents','/:id/applications','post','addDisposition','addAnswer','addApplications','/:id/notify','notify','/:id/send','send','put','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','util','express','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','/:id/dispositions','getDispositions','/:id/canned_answers'];(function(_0x406dfa,_0x5b15c6){var _0x39556d=function(_0x2279ce){while(--_0x2279ce){_0x406dfa['push'](_0x406dfa['shift']());}};_0x39556d(++_0x5b15c6);}(_0x134e,0x113));var _0xe134=function(_0x344573,_0x153172){_0x344573=_0x344573-0x0;var _0x4317de=_0x134e[_0x344573];return _0x4317de;};'use strict';var multer=require(_0xe134('0x0'));var util=require(_0xe134('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe134('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe134('0x3'));var interaction=require(_0xe134('0x4'));var config=require(_0xe134('0x5'));var controller=require('./whatsappAccount.controller');router[_0xe134('0x6')]('/',auth[_0xe134('0x7')](),controller[_0xe134('0x8')]);router[_0xe134('0x6')]('/describe',auth[_0xe134('0x7')](),controller['describe']);router[_0xe134('0x6')](_0xe134('0x9'),auth['isAuthenticated'](),controller['show']);router[_0xe134('0x6')](_0xe134('0xa'),auth['isAuthenticated'](),controller[_0xe134('0xb')]);router[_0xe134('0x6')](_0xe134('0xc'),auth['isAuthenticated'](),controller[_0xe134('0xd')]);router[_0xe134('0x6')](_0xe134('0xe'),auth['isAuthenticated'](),controller[_0xe134('0xf')]);router[_0xe134('0x6')](_0xe134('0x10'),auth['isAuthenticated'](),controller['getApplications']);router[_0xe134('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xe134('0x11')](_0xe134('0xa'),auth['isAuthenticated'](),controller[_0xe134('0x12')]);router[_0xe134('0x11')](_0xe134('0xc'),auth[_0xe134('0x7')](),controller[_0xe134('0x13')]);router['post'](_0xe134('0xe'),auth['isAuthenticated'](),controller['addAgents']);router[_0xe134('0x11')](_0xe134('0x10'),auth[_0xe134('0x7')](),controller[_0xe134('0x14')]);router[_0xe134('0x11')](_0xe134('0x15'),controller[_0xe134('0x16')]);router[_0xe134('0x11')](_0xe134('0x17'),auth[_0xe134('0x7')](),controller[_0xe134('0x18')]);router[_0xe134('0x19')](_0xe134('0x9'),auth[_0xe134('0x7')](),controller['update']);router[_0xe134('0x1a')]('/:id',auth[_0xe134('0x7')](),controller[_0xe134('0x1b')]);router[_0xe134('0x1a')](_0xe134('0xa'),auth[_0xe134('0x7')](),controller[_0xe134('0x1c')]);router[_0xe134('0x1a')](_0xe134('0xc'),auth['isAuthenticated'](),controller[_0xe134('0x1d')]);router[_0xe134('0x1a')]('/:id/users',auth[_0xe134('0x7')](),controller[_0xe134('0x1e')]);module[_0xe134('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 35358a0..5123dbd 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 _0x2071=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','STRING','generate','ENUM','sinch','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x2071,0xb1));var _0x1207=function(_0x3a175b,_0x505d13){_0x3a175b=_0x3a175b-0x0;var _0x9b84fa=_0x2071[_0x3a175b];return _0x9b84fa;};'use strict';var Sequelize=require(_0x1207('0x0'));var rs=require(_0x1207('0x1'));module[_0x1207('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x1207('0x3'),'allowNull':![]},'key':{'type':Sequelize[_0x1207('0x4')],'allowNull':![]},'remote':{'type':Sequelize[_0x1207('0x4')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x1207('0x5')]();}},'phone':{'type':Sequelize[_0x1207('0x4')]},'type':{'type':Sequelize[_0x1207('0x6')]('twilio',_0x1207('0x7'))},'accountSid':{'type':Sequelize[_0x1207('0x4')]},'baseUrl':{'type':Sequelize[_0x1207('0x4')]},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x1207('0x8')],'defaultValue':function(){return _0x1207('0x9');}},'notificationSound':{'type':Sequelize[_0x1207('0xa')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1207('0xa')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1207('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize[_0x1207('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1207('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1207('0xa')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1207('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x1207('0xc')},'mandatoryDisposition':{'type':Sequelize[_0x1207('0xa')],'defaultValue':![],'comment':_0x1207('0xd'),'set':function(_0x2c2fb3){if(!_0x2c2fb3){this[_0x1207('0xe')](_0x1207('0xf'),null);}this[_0x1207('0xe')](_0x1207('0x10'),_0x2c2fb3);}},'description':{'type':Sequelize[_0x1207('0x4')]}}; \ No newline at end of file +var _0x0899=['mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x2c415d,_0x55e832){var _0x4a671a=function(_0xed6996){while(--_0xed6996){_0x2c415d['push'](_0x2c415d['shift']());}};_0x4a671a(++_0x55e832);}(_0x0899,0x183));var _0x9089=function(_0x1b5792,_0x16b34b){_0x1b5792=_0x1b5792-0x0;var _0xc25239=_0x0899[_0x1b5792];return _0xc25239;};'use strict';var Sequelize=require(_0x9089('0x0'));var rs=require(_0x9089('0x1'));module[_0x9089('0x2')]={'name':{'type':Sequelize[_0x9089('0x3')],'unique':_0x9089('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x9089('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x9089('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9089('0x5')]();}},'phone':{'type':Sequelize[_0x9089('0x3')]},'type':{'type':Sequelize[_0x9089('0x6')](_0x9089('0x7'),'sinch')},'accountSid':{'type':Sequelize[_0x9089('0x3')]},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x9089('0x8');}},'notificationSound':{'type':Sequelize[_0x9089('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x9089('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9089('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'waitForTheAssignedQueue':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9089('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x9089('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9089('0xa')],'comment':_0x9089('0xb')},'mandatoryDisposition':{'type':Sequelize[_0x9089('0x9')],'defaultValue':![],'comment':_0x9089('0xc'),'set':function(_0x451fc2){if(!_0x451fc2){this['setDataValue'](_0x9089('0xd'),null);}this[_0x9089('0xe')](_0x9089('0xf'),_0x451fc2);}},'description':{'type':Sequelize[_0x9089('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 3e80792..57ac9e0 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 _0x8a64=['account','CmContact','Sequelize','difference','createdAt','CompanyId','mobile','twilio','from','From','replace','whatsapp:','Body','messageId','notifications','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','ListId','Contacts','updatedAt','DESC','list','WhatsappInteraction','spread','interaction','autoclose','push','close','*,*,*,*','created','UserId','unshift','agent','queueId','queue','waitForTheAssignedQueue','Start','startRouting','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','List','out','Messages','dataValues','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','./whatsappAccount.socket','register','jayson/promise','client','http','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','then','WhatsappAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','WhatsappAccount','show','find','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','describe','WhatsappAccountId','Disposition','getDispositions','length','nolimit','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','transaction','Transaction','ISOLATION_LEVELS','WhatsappApplication','bulkCreate','findAndCountAll','priority','finally','getApplications','notify','Applications','sinch','statuses','state','read','WhatsappMessage','message_id','applications','orderBy'];(function(_0x167bb7,_0x2161cf){var _0x211b1f=function(_0x2b1810){while(--_0x2b1810){_0x167bb7['push'](_0x167bb7['shift']());}};_0x211b1f(++_0x2161cf);}(_0x8a64,0xfd));var _0x48a6=function(_0x1c46fb,_0x5ac26d){_0x1c46fb=_0x1c46fb-0x0;var _0x158e9b=_0x8a64[_0x1c46fb];return _0x158e9b;};'use strict';var emlformat=require(_0x48a6('0x0'));var rimraf=require(_0x48a6('0x1'));var zipdir=require(_0x48a6('0x2'));var jsonpatch=require(_0x48a6('0x3'));var rp=require('request-promise');var moment=require(_0x48a6('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x48a6('0x5'));var util=require(_0x48a6('0x6'));var path=require(_0x48a6('0x7'));var sox=require(_0x48a6('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x48a6('0x9'));var _=require(_0x48a6('0xa'));var squel=require(_0x48a6('0xb'));var crypto=require(_0x48a6('0xc'));var jsforce=require(_0x48a6('0xd'));var deskjs=require(_0x48a6('0xe'));var toCsv=require(_0x48a6('0xf'));var querystring=require(_0x48a6('0x10'));var Papa=require(_0x48a6('0x11'));var Redis=require(_0x48a6('0x12'));var authService=require(_0x48a6('0x13'));var qs=require(_0x48a6('0x14'));var as=require(_0x48a6('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x48a6('0x16'))(_0x48a6('0x17'));var utils=require(_0x48a6('0x18'));var config=require(_0x48a6('0x19'));var licenseUtil=require(_0x48a6('0x1a'));var db=require(_0x48a6('0x1b'))['db'];config['redis']=_[_0x48a6('0x1c')](config[_0x48a6('0x1d')],{'host':_0x48a6('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x48a6('0x1f'))[_0x48a6('0x20')](socket);var jayson=require(_0x48a6('0x21'));var client=jayson[_0x48a6('0x22')][_0x48a6('0x23')]({'port':0x232c});function respondWithRpcPromise(_0x417189,_0x91f666,_0xbc3def,_0x1075d1){return new BPromise(function(_0x433bcb,_0x118bc1){var _0x1bea01=_0x1075d1||client;return _0x1bea01['request'](_0x417189,_0xbc3def)['then'](function(_0x515fcf){logger['info'](_0x48a6('0x24'),_0x91f666,'request\x20sent');logger[_0x48a6('0x25')](_0x48a6('0x26'),_0x91f666,'request\x20sent',JSON[_0x48a6('0x27')](_0x515fcf));if(_0x515fcf[_0x48a6('0x28')]){if(_0x515fcf[_0x48a6('0x28')][_0x48a6('0x29')]===0x1f4){logger['error'](_0x48a6('0x24'),_0x91f666,_0x515fcf['error'][_0x48a6('0x2a')]);return _0x118bc1(_0x515fcf['error'][_0x48a6('0x2a')]);}logger['error'](_0x48a6('0x24'),_0x91f666,_0x515fcf[_0x48a6('0x28')]['message']);return _0x433bcb(_0x515fcf[_0x48a6('0x28')]['message']);}else{logger[_0x48a6('0x2b')](_0x48a6('0x24'),_0x91f666,_0x48a6('0x2c'));_0x433bcb(_0x515fcf['result'][_0x48a6('0x2a')]);}})[_0x48a6('0x2d')](function(_0x11e046){logger[_0x48a6('0x28')]('WhatsappAccount,\x20%s,\x20%s',_0x91f666,_0x11e046);_0x118bc1(_0x11e046);});});}function respondWithStatusCode(_0x51ca4f,_0x3fca32){_0x3fca32=_0x3fca32||0xcc;return function(_0x3bf0c9){if(_0x3bf0c9){return _0x51ca4f[_0x48a6('0x2e')](_0x3fca32);}return _0x51ca4f['status'](_0x3fca32)[_0x48a6('0x2f')]();};}function respondWithResult(_0x38b91f,_0x11eb9a){_0x11eb9a=_0x11eb9a||0xc8;return function(_0x3e0e53){if(_0x3e0e53){return _0x38b91f[_0x48a6('0x30')](_0x11eb9a)[_0x48a6('0x31')](_0x3e0e53);}};}function respondWithFilteredResult(_0x12c40a,_0x1bb253){return function(_0x1df82d){if(_0x1df82d){var _0x513c93=typeof _0x1bb253['offset']===_0x48a6('0x32')&&typeof _0x1bb253[_0x48a6('0x33')]==='undefined';var _0x5c296c=_0x1df82d[_0x48a6('0x34')];var _0x43af16=_0x513c93?0x0:_0x1bb253[_0x48a6('0x35')];var _0x338eb3=_0x513c93?_0x1df82d[_0x48a6('0x34')]:_0x1bb253[_0x48a6('0x35')]+_0x1bb253['limit'];var _0x260c13;if(_0x338eb3>=_0x5c296c){_0x338eb3=_0x5c296c;_0x260c13=0xc8;}else{_0x260c13=0xce;}_0x12c40a[_0x48a6('0x30')](_0x260c13);return _0x12c40a[_0x48a6('0x36')](_0x48a6('0x37'),_0x43af16+'-'+_0x338eb3+'/'+_0x5c296c)[_0x48a6('0x31')](_0x1df82d);}return null;};}function patchUpdates(_0x51b27d){return function(_0x4d2323){try{jsonpatch['apply'](_0x4d2323,_0x51b27d,!![]);}catch(_0x1d5bb0){return BPromise[_0x48a6('0x38')](_0x1d5bb0);}return _0x4d2323[_0x48a6('0x39')]();};}function saveUpdates(_0x2a95c0,_0x15411e){return function(_0x3c048b){if(_0x3c048b){return _0x3c048b[_0x48a6('0x3a')](_0x2a95c0)['then'](function(_0x39ba17){return _0x39ba17;});}return null;};}function removeEntity(_0x1cd67d,_0x5494f6){return function(_0x51a9b5){if(_0x51a9b5){return _0x51a9b5[_0x48a6('0x3b')]()[_0x48a6('0x3c')](function(){var _0x36566f=_0x51a9b5['get']({'plain':!![]});var _0x5891b5=_0x48a6('0x3d');return db[_0x48a6('0x3e')]['destroy']({'where':{'type':_0x5891b5,'resourceId':_0x36566f['id']}})[_0x48a6('0x3c')](function(){return _0x51a9b5;});})[_0x48a6('0x3c')](function(){_0x1cd67d[_0x48a6('0x30')](0xcc)[_0x48a6('0x2f')]();});}};}function handleEntityNotFound(_0x3a2779,_0x3959d1){return function(_0x229352){if(!_0x229352){_0x3a2779[_0x48a6('0x2e')](0x194);}return _0x229352;};}function handleError(_0x263a1b,_0x3b6586){_0x3b6586=_0x3b6586||0x1f4;return function(_0x9643e0){logger[_0x48a6('0x28')](_0x9643e0[_0x48a6('0x3f')]);if(_0x9643e0[_0x48a6('0x40')]){delete _0x9643e0['name'];}_0x263a1b[_0x48a6('0x30')](_0x3b6586)[_0x48a6('0x41')](_0x9643e0);};}exports[_0x48a6('0x42')]=function(_0x45e29d,_0x43ea96){var _0xe26d9f={'include':[{'model':db[_0x48a6('0x43')],'as':_0x48a6('0x44')}]},_0x45b7d6={},_0x209a17={'count':0x0,'rows':[]};var _0xaadabf=_[_0x48a6('0x45')](db['WhatsappAccount'][_0x48a6('0x46')],function(_0x53ca1c){return{'name':_0x53ca1c[_0x48a6('0x47')],'type':_0x53ca1c['type'][_0x48a6('0x48')]};});_0x45b7d6['model']=_[_0x48a6('0x45')](_0xaadabf,_0x48a6('0x40'));_0x45b7d6[_0x48a6('0x49')]=_[_0x48a6('0x4a')](_0x45e29d[_0x48a6('0x49')]);_0x45b7d6[_0x48a6('0x4b')]=_[_0x48a6('0x4c')](_0x45b7d6['model'],_0x45b7d6[_0x48a6('0x49')]);_0xe26d9f[_0x48a6('0x4d')]=_[_0x48a6('0x4c')](_0x45b7d6[_0x48a6('0x4e')],qs[_0x48a6('0x4f')](_0x45e29d['query']['fields']));_0xe26d9f[_0x48a6('0x4d')]=_0xe26d9f[_0x48a6('0x4d')]['length']?_0xe26d9f['attributes']:_0x45b7d6[_0x48a6('0x4e')];if(!_0x45e29d[_0x48a6('0x49')][_0x48a6('0x50')]('nolimit')){_0xe26d9f[_0x48a6('0x33')]=qs[_0x48a6('0x33')](_0x45e29d[_0x48a6('0x49')][_0x48a6('0x33')]);_0xe26d9f['offset']=qs['offset'](_0x45e29d[_0x48a6('0x49')][_0x48a6('0x35')]);}_0xe26d9f[_0x48a6('0x51')]=qs[_0x48a6('0x52')](_0x45e29d['query']['sort']);_0xe26d9f[_0x48a6('0x53')]=qs[_0x48a6('0x4b')](_[_0x48a6('0x54')](_0x45e29d[_0x48a6('0x49')],_0x45b7d6[_0x48a6('0x4b')]),_0xaadabf);if(_0x45e29d[_0x48a6('0x49')][_0x48a6('0x55')]){_0xe26d9f[_0x48a6('0x53')]=_[_0x48a6('0x56')](_0xe26d9f['where'],{'$or':_[_0x48a6('0x45')](_0xaadabf,function(_0x2a3b33){if(_0x2a3b33[_0x48a6('0x57')]!==_0x48a6('0x58')){var _0x25fc07={};_0x25fc07[_0x2a3b33['name']]={'$like':'%'+_0x45e29d[_0x48a6('0x49')][_0x48a6('0x55')]+'%'};return _0x25fc07;}})});}_0xe26d9f=_[_0x48a6('0x56')]({},_0xe26d9f,_0x45e29d[_0x48a6('0x59')]);var _0x386ba5={'where':_0xe26d9f[_0x48a6('0x53')]};return db['WhatsappAccount'][_0x48a6('0x34')](_0x386ba5)[_0x48a6('0x3c')](function(_0x2f191f){_0x209a17[_0x48a6('0x34')]=_0x2f191f;if(_0x45e29d[_0x48a6('0x49')][_0x48a6('0x5a')]){_0xe26d9f[_0x48a6('0x5b')]=[{'all':!![]}];}return db[_0x48a6('0x5c')]['findAll'](_0xe26d9f);})[_0x48a6('0x3c')](function(_0x5020a6){_0x209a17['rows']=_0x5020a6;return _0x209a17;})[_0x48a6('0x3c')](respondWithFilteredResult(_0x43ea96,_0xe26d9f))[_0x48a6('0x2d')](handleError(_0x43ea96,null));};exports[_0x48a6('0x5d')]=function(_0x46cd41,_0x22eb56){var _0x405aeb={'raw':![],'where':{'id':_0x46cd41['params']['id']},'include':[{'model':db['Pause'],'as':_0x48a6('0x44')}]},_0x3e8878={};_0x3e8878[_0x48a6('0x4e')]=_[_0x48a6('0x4a')](db[_0x48a6('0x5c')]['rawAttributes']);_0x3e8878[_0x48a6('0x49')]=_[_0x48a6('0x4a')](_0x46cd41['query']);_0x3e8878[_0x48a6('0x4b')]=_[_0x48a6('0x4c')](_0x3e8878['model'],_0x3e8878[_0x48a6('0x49')]);_0x405aeb[_0x48a6('0x4d')]=_['intersection'](_0x3e8878['model'],qs[_0x48a6('0x4f')](_0x46cd41['query']['fields']));_0x405aeb['attributes']=_0x405aeb[_0x48a6('0x4d')]['length']?_0x405aeb[_0x48a6('0x4d')]:_0x3e8878[_0x48a6('0x4e')];if(_0x46cd41['query'][_0x48a6('0x5a')]){_0x405aeb['include']=[{'all':!![]}];}_0x405aeb=_[_0x48a6('0x56')]({},_0x405aeb,_0x46cd41[_0x48a6('0x59')]);return db[_0x48a6('0x5c')][_0x48a6('0x5e')](_0x405aeb)[_0x48a6('0x3c')](handleEntityNotFound(_0x22eb56,null))[_0x48a6('0x3c')](respondWithResult(_0x22eb56,null))[_0x48a6('0x2d')](handleError(_0x22eb56,null));};exports[_0x48a6('0x5f')]=function(_0x38d132,_0x22c9c2){return db[_0x48a6('0x5c')][_0x48a6('0x5f')](_0x38d132[_0x48a6('0x60')],{})['then'](function(_0x6b99a7){var _0x1059a5=_0x38d132[_0x48a6('0x61')][_0x48a6('0x62')]({'plain':!![]});if(!_0x1059a5)throw new Error(_0x48a6('0x63'));if(_0x1059a5[_0x48a6('0x64')]===_0x48a6('0x61')){var _0x394db0=_0x6b99a7[_0x48a6('0x62')]({'plain':!![]});var _0x47ac0e=_0x48a6('0x3d');return db[_0x48a6('0x65')][_0x48a6('0x5e')]({'where':{'name':_0x47ac0e,'userProfileId':_0x1059a5[_0x48a6('0x66')]},'raw':!![]})[_0x48a6('0x3c')](function(_0x1e0b07){if(_0x1e0b07&&_0x1e0b07[_0x48a6('0x67')]===0x0){return db[_0x48a6('0x3e')]['create']({'name':_0x394db0[_0x48a6('0x40')],'resourceId':_0x394db0['id'],'type':_0x1e0b07[_0x48a6('0x40')],'sectionId':_0x1e0b07['id']},{})[_0x48a6('0x3c')](function(){return _0x6b99a7;});}else{return _0x6b99a7;}})[_0x48a6('0x2d')](function(_0xd9e2c2){logger['error'](_0x48a6('0x68'),_0xd9e2c2);throw _0xd9e2c2;});}return _0x6b99a7;})['then'](respondWithResult(_0x22c9c2,0xc9))['catch'](handleError(_0x22c9c2,null));};exports['update']=function(_0x339c23,_0xa5b020){if(_0x339c23[_0x48a6('0x60')]['id']){delete _0x339c23['body']['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x339c23[_0x48a6('0x69')]['id']},'include':[{'model':db[_0x48a6('0x43')],'as':_0x48a6('0x44')}]})[_0x48a6('0x3c')](handleEntityNotFound(_0xa5b020,null))['then'](saveUpdates(_0x339c23[_0x48a6('0x60')],null))[_0x48a6('0x3c')](respondWithResult(_0xa5b020,null))[_0x48a6('0x2d')](handleError(_0xa5b020,null));};exports[_0x48a6('0x3b')]=function(_0x3027e4,_0x31018e){return db[_0x48a6('0x5c')][_0x48a6('0x5e')]({'where':{'id':_0x3027e4[_0x48a6('0x69')]['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0x31018e,null))[_0x48a6('0x3c')](removeEntity(_0x31018e,null))[_0x48a6('0x2d')](handleError(_0x31018e,null));};exports[_0x48a6('0x6a')]=function(_0x19744e,_0x256d4c){return db[_0x48a6('0x5c')]['describe']()[_0x48a6('0x3c')](respondWithResult(_0x256d4c,null))['catch'](handleError(_0x256d4c,null));};exports['addDisposition']=function(_0x2f9a5b,_0x5d8e8b,_0x606a69){if(_0x2f9a5b[_0x48a6('0x60')]['id']){delete _0x2f9a5b[_0x48a6('0x60')]['id'];}return db[_0x48a6('0x5c')][_0x48a6('0x5e')]({'where':{'id':_0x2f9a5b[_0x48a6('0x69')]['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0x5d8e8b,null))[_0x48a6('0x3c')](function(_0x3d5570){if(_0x3d5570){_0x2f9a5b[_0x48a6('0x60')][_0x48a6('0x6b')]=_0x3d5570['id'];return db[_0x48a6('0x6c')][_0x48a6('0x5f')](_0x2f9a5b[_0x48a6('0x60')]);}})[_0x48a6('0x3c')](respondWithResult(_0x5d8e8b,null))['catch'](handleError(_0x5d8e8b,null));};exports[_0x48a6('0x6d')]=function(_0x39dca4,_0x34ccbb,_0x9bcf90){var _0x10d170={'raw':![],'where':{}};var _0x14e5ff={};var _0x3cfb0d={'count':0x0,'rows':[]};return db['WhatsappAccount']['findOne']({'where':{'id':_0x39dca4[_0x48a6('0x69')]['id']}})['then'](handleEntityNotFound(_0x34ccbb,null))[_0x48a6('0x3c')](function(_0x375d44){if(_0x375d44){_0x14e5ff[_0x48a6('0x4e')]=_[_0x48a6('0x4a')](db[_0x48a6('0x6c')]['rawAttributes']);_0x14e5ff[_0x48a6('0x49')]=_[_0x48a6('0x4a')](_0x39dca4['query']);_0x14e5ff[_0x48a6('0x4b')]=_[_0x48a6('0x4c')](_0x14e5ff[_0x48a6('0x4e')],_0x14e5ff['query']);_0x10d170[_0x48a6('0x4d')]=_[_0x48a6('0x4c')](_0x14e5ff[_0x48a6('0x4e')],qs[_0x48a6('0x4f')](_0x39dca4[_0x48a6('0x49')][_0x48a6('0x4f')]));_0x10d170[_0x48a6('0x4d')]=_0x10d170[_0x48a6('0x4d')][_0x48a6('0x6e')]?_0x10d170[_0x48a6('0x4d')]:_0x14e5ff[_0x48a6('0x4e')];if(!_0x39dca4[_0x48a6('0x49')][_0x48a6('0x50')](_0x48a6('0x6f'))){_0x10d170[_0x48a6('0x33')]=qs[_0x48a6('0x33')](_0x39dca4[_0x48a6('0x49')][_0x48a6('0x33')]);_0x10d170['offset']=qs[_0x48a6('0x35')](_0x39dca4['query'][_0x48a6('0x35')]);}_0x10d170[_0x48a6('0x51')]=qs[_0x48a6('0x52')](_0x39dca4[_0x48a6('0x49')]['sort']);_0x10d170[_0x48a6('0x53')]=qs[_0x48a6('0x4b')](_['pick'](_0x39dca4[_0x48a6('0x49')],_0x14e5ff[_0x48a6('0x4b')]));_0x10d170['where'][_0x48a6('0x6b')]=_0x375d44['id'];if(_0x39dca4['query'][_0x48a6('0x55')]){_0x10d170[_0x48a6('0x53')]=_[_0x48a6('0x56')](_0x10d170[_0x48a6('0x53')],{'$or':_['map'](_0x10d170['attributes'],function(_0x3679d9){var _0x3406d8={};_0x3406d8[_0x3679d9]={'$like':'%'+_0x39dca4['query'][_0x48a6('0x55')]+'%'};return _0x3406d8;})});}_0x10d170=_[_0x48a6('0x56')]({},_0x10d170,_0x39dca4['options']);return db[_0x48a6('0x6c')][_0x48a6('0x34')]({'where':_0x10d170[_0x48a6('0x53')]})[_0x48a6('0x3c')](function(_0x12f89e){_0x3cfb0d[_0x48a6('0x34')]=_0x12f89e;if(_0x39dca4[_0x48a6('0x49')][_0x48a6('0x5a')]){_0x10d170[_0x48a6('0x5b')]=[{'all':!![]}];}return db[_0x48a6('0x6c')][_0x48a6('0x70')](_0x10d170);})['then'](function(_0x170581){_0x3cfb0d[_0x48a6('0x71')]=_0x170581;return _0x3cfb0d;});}})[_0x48a6('0x3c')](respondWithFilteredResult(_0x34ccbb,_0x10d170))[_0x48a6('0x2d')](handleError(_0x34ccbb,null));};exports[_0x48a6('0x72')]=function(_0x363ebb,_0x19d94d,_0x448a31){return db[_0x48a6('0x5c')]['find']({'where':{'id':_0x363ebb[_0x48a6('0x69')]['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0x19d94d,null))[_0x48a6('0x3c')](function(_0x4c4ae9){if(_0x4c4ae9){return _0x4c4ae9[_0x48a6('0x72')](_0x363ebb[_0x48a6('0x49')][_0x48a6('0x73')]);}})[_0x48a6('0x3c')](respondWithStatusCode(_0x19d94d,null))['catch'](handleError(_0x19d94d,null));};exports[_0x48a6('0x74')]=function(_0x47febf,_0x231602,_0x583546){if(_0x47febf[_0x48a6('0x60')]['id']){delete _0x47febf['body']['id'];}return db[_0x48a6('0x5c')]['find']({'where':{'id':_0x47febf[_0x48a6('0x69')]['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0x231602,null))[_0x48a6('0x3c')](function(_0x810c42){if(_0x810c42){_0x47febf[_0x48a6('0x60')]['WhatsappAccountId']=_0x810c42['id'];return db[_0x48a6('0x75')][_0x48a6('0x5f')](_0x47febf[_0x48a6('0x60')]);}})[_0x48a6('0x3c')](respondWithResult(_0x231602,null))[_0x48a6('0x2d')](handleError(_0x231602,null));};exports[_0x48a6('0x76')]=function(_0x504633,_0xdc5882,_0x5a2476){var _0x550b6e={'raw':![],'where':{}};var _0x446239={};var _0x934b92={'count':0x0,'rows':[]};return db[_0x48a6('0x5c')][_0x48a6('0x77')]({'where':{'id':_0x504633['params']['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0xdc5882,null))[_0x48a6('0x3c')](function(_0x279631){if(_0x279631){_0x446239['model']=_['keys'](db['CannedAnswer'][_0x48a6('0x46')]);_0x446239[_0x48a6('0x49')]=_[_0x48a6('0x4a')](_0x504633[_0x48a6('0x49')]);_0x446239['filters']=_[_0x48a6('0x4c')](_0x446239[_0x48a6('0x4e')],_0x446239[_0x48a6('0x49')]);_0x550b6e[_0x48a6('0x4d')]=_[_0x48a6('0x4c')](_0x446239['model'],qs[_0x48a6('0x4f')](_0x504633['query'][_0x48a6('0x4f')]));_0x550b6e['attributes']=_0x550b6e['attributes'][_0x48a6('0x6e')]?_0x550b6e[_0x48a6('0x4d')]:_0x446239[_0x48a6('0x4e')];if(!_0x504633[_0x48a6('0x49')]['hasOwnProperty'](_0x48a6('0x6f'))){_0x550b6e[_0x48a6('0x33')]=qs['limit'](_0x504633['query'][_0x48a6('0x33')]);_0x550b6e[_0x48a6('0x35')]=qs[_0x48a6('0x35')](_0x504633['query'][_0x48a6('0x35')]);}_0x550b6e['order']=qs['sort'](_0x504633[_0x48a6('0x49')][_0x48a6('0x52')]);_0x550b6e['where']=qs[_0x48a6('0x4b')](_['pick'](_0x504633['query'],_0x446239[_0x48a6('0x4b')]));_0x550b6e[_0x48a6('0x53')]['WhatsappAccountId']=_0x279631['id'];if(_0x504633[_0x48a6('0x49')][_0x48a6('0x55')]){_0x550b6e[_0x48a6('0x53')]=_[_0x48a6('0x56')](_0x550b6e[_0x48a6('0x53')],{'$or':_[_0x48a6('0x45')](_0x550b6e[_0x48a6('0x4d')],function(_0x334135){var _0xe3e689={};_0xe3e689[_0x334135]={'$like':'%'+_0x504633[_0x48a6('0x49')][_0x48a6('0x55')]+'%'};return _0xe3e689;})});}_0x550b6e=_[_0x48a6('0x56')]({},_0x550b6e,_0x504633[_0x48a6('0x59')]);return db[_0x48a6('0x75')][_0x48a6('0x34')]({'where':_0x550b6e[_0x48a6('0x53')]})[_0x48a6('0x3c')](function(_0x274143){_0x934b92[_0x48a6('0x34')]=_0x274143;if(_0x504633[_0x48a6('0x49')][_0x48a6('0x5a')]){_0x550b6e[_0x48a6('0x5b')]=[{'all':!![]}];}return db[_0x48a6('0x75')][_0x48a6('0x70')](_0x550b6e);})[_0x48a6('0x3c')](function(_0x13931e){_0x934b92['rows']=_0x13931e;return _0x934b92;});}})[_0x48a6('0x3c')](respondWithFilteredResult(_0xdc5882,_0x550b6e))[_0x48a6('0x2d')](handleError(_0xdc5882,null));};exports['removeAnswers']=function(_0x12b029,_0x2cc766,_0x3953e1){return db[_0x48a6('0x5c')][_0x48a6('0x5e')]({'where':{'id':_0x12b029[_0x48a6('0x69')]['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0x2cc766,null))[_0x48a6('0x3c')](function(_0x128b73){if(_0x128b73){return _0x128b73['removeAnswers'](_0x12b029[_0x48a6('0x49')][_0x48a6('0x73')]);}})[_0x48a6('0x3c')](respondWithStatusCode(_0x2cc766,null))[_0x48a6('0x2d')](handleError(_0x2cc766,null));};exports[_0x48a6('0x78')]=function(_0x39fdce,_0x38a699,_0x237143){return db[_0x48a6('0x5c')][_0x48a6('0x5e')]({'where':{'id':_0x39fdce[_0x48a6('0x69')]['id']}})['then'](handleEntityNotFound(_0x38a699,null))['then'](function(_0x5a7464){if(_0x5a7464){return _0x5a7464[_0x48a6('0x78')](_0x39fdce[_0x48a6('0x60')][_0x48a6('0x73')],_[_0x48a6('0x79')](_0x39fdce[_0x48a6('0x60')],[_0x48a6('0x73'),'id'])||{})['spread'](function(_0x4b340b){for(var _0x5e302d=0x0;_0x5e302d<_0x39fdce[_0x48a6('0x60')][_0x48a6('0x73')][_0x48a6('0x6e')];_0x5e302d+=0x1){socket[_0x48a6('0x7a')](_0x48a6('0x7b'),{'UserId':Number(_0x39fdce['body'][_0x48a6('0x73')][_0x5e302d]),'WhatsappAccountId':Number(_0x39fdce[_0x48a6('0x69')]['id'])});}return _0x4b340b;});}})[_0x48a6('0x3c')](respondWithResult(_0x38a699,null))[_0x48a6('0x2d')](handleError(_0x38a699,null));};exports[_0x48a6('0x7c')]=function(_0x52b559,_0x1ab74f,_0x4893a7){return db[_0x48a6('0x5c')]['find']({'where':{'id':_0x52b559[_0x48a6('0x69')]['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0x1ab74f,null))[_0x48a6('0x3c')](function(_0xdb3df5){if(_0xdb3df5){return _0xdb3df5[_0x48a6('0x7c')](_0x52b559[_0x48a6('0x49')]['ids'])[_0x48a6('0x3c')](function(){if(_[_0x48a6('0x7d')](_0x52b559[_0x48a6('0x49')][_0x48a6('0x73')])){for(var _0x288db6=0x0;_0x288db6<_0x52b559[_0x48a6('0x49')][_0x48a6('0x73')][_0x48a6('0x6e')];_0x288db6+=0x1){socket['emit'](_0x48a6('0x7e'),{'UserId':Number(_0x52b559[_0x48a6('0x49')][_0x48a6('0x73')][_0x288db6]),'WhatsappAccountId':Number(_0x52b559[_0x48a6('0x69')]['id'])});}}else{socket[_0x48a6('0x7a')]('userWhatsappAccount:remove',{'UserId':Number(_0x52b559[_0x48a6('0x49')][_0x48a6('0x73')]),'WhatsappAccountId':Number(_0x52b559[_0x48a6('0x69')]['id'])});}});}})[_0x48a6('0x3c')](respondWithStatusCode(_0x1ab74f,null))['catch'](handleError(_0x1ab74f,null));};exports[_0x48a6('0x7f')]=function(_0x3e2a5e,_0x4f3e5c,_0x29b1d2){var _0x655bd0={};var _0x487f86={};var _0x527a8a;var _0x5d60f9;return db[_0x48a6('0x5c')][_0x48a6('0x77')]({'where':{'id':_0x3e2a5e[_0x48a6('0x69')]['id']}})['then'](handleEntityNotFound(_0x4f3e5c,null))[_0x48a6('0x3c')](function(_0xa05197){if(_0xa05197){_0x527a8a=_0xa05197;_0x487f86[_0x48a6('0x4e')]=_[_0x48a6('0x4a')](db[_0x48a6('0x80')][_0x48a6('0x46')]);_0x487f86[_0x48a6('0x49')]=_['keys'](_0x3e2a5e[_0x48a6('0x49')]);_0x487f86[_0x48a6('0x4b')]=_[_0x48a6('0x4c')](_0x487f86[_0x48a6('0x4e')],_0x487f86['query']);_0x655bd0[_0x48a6('0x4d')]=_[_0x48a6('0x4c')](_0x487f86[_0x48a6('0x4e')],qs[_0x48a6('0x4f')](_0x3e2a5e[_0x48a6('0x49')][_0x48a6('0x4f')]));_0x655bd0[_0x48a6('0x4d')]=_0x655bd0[_0x48a6('0x4d')]['length']?_0x655bd0[_0x48a6('0x4d')]:_0x487f86[_0x48a6('0x4e')];_0x655bd0[_0x48a6('0x51')]=qs[_0x48a6('0x52')](_0x3e2a5e[_0x48a6('0x49')][_0x48a6('0x52')]);_0x655bd0[_0x48a6('0x53')]=qs[_0x48a6('0x4b')](_[_0x48a6('0x54')](_0x3e2a5e[_0x48a6('0x49')],_0x487f86[_0x48a6('0x4b')]));if(_0x3e2a5e[_0x48a6('0x49')][_0x48a6('0x55')]){_0x655bd0[_0x48a6('0x53')]=_[_0x48a6('0x56')](_0x655bd0[_0x48a6('0x53')],{'$or':_['map'](_0x655bd0[_0x48a6('0x4d')],function(_0x33b5c0){var _0x2f31ee={};_0x2f31ee[_0x33b5c0]={'$like':'%'+_0x3e2a5e[_0x48a6('0x49')]['filter']+'%'};return _0x2f31ee;})});}_0x655bd0=_[_0x48a6('0x56')]({},_0x655bd0,_0x3e2a5e[_0x48a6('0x59')]);return _0x527a8a[_0x48a6('0x7f')](_0x655bd0);}})[_0x48a6('0x3c')](function(_0x3f5c90){if(_0x3f5c90){_0x5d60f9=_0x3f5c90[_0x48a6('0x6e')];if(!_0x3e2a5e[_0x48a6('0x49')][_0x48a6('0x50')]('nolimit')){_0x655bd0['limit']=qs[_0x48a6('0x33')](_0x3e2a5e[_0x48a6('0x49')][_0x48a6('0x33')]);_0x655bd0[_0x48a6('0x35')]=qs[_0x48a6('0x35')](_0x3e2a5e[_0x48a6('0x49')][_0x48a6('0x35')]);}return _0x527a8a[_0x48a6('0x7f')](_0x655bd0);}})[_0x48a6('0x3c')](function(_0x3f887a){if(_0x3f887a){return _0x3f887a?{'count':_0x5d60f9,'rows':_0x3f887a}:null;}})[_0x48a6('0x3c')](respondWithResult(_0x4f3e5c,null))['catch'](handleError(_0x4f3e5c,null));};exports[_0x48a6('0x81')]=function(_0x1b6f6d,_0x4992af){var _0x57847d=_0x1b6f6d[_0x48a6('0x69')]['id'];var _0x55bbe2=_0x1b6f6d[_0x48a6('0x60')];var _0xfdae20=0xc8;var _0x5970d2=null;return db['sequelize'][_0x48a6('0x82')]({'isolationLevel':db['sequelize'][_0x48a6('0x83')][_0x48a6('0x84')]['READ_COMMITTED']},function(_0x20c793){return db[_0x48a6('0x5c')][_0x48a6('0x77')]({'where':{'id':_0x57847d},'transaction':_0x20c793})['then'](function(_0x1d77eb){if(_0x1d77eb){return db['WhatsappApplication'][_0x48a6('0x3b')]({'where':{'WhatsappAccountId':_0x57847d},'transaction':_0x20c793})[_0x48a6('0x3c')](function(){var _0x4c91e3=_[_0x48a6('0x45')](_0x55bbe2,function(_0x47cea2){_0x47cea2[_0x48a6('0x6b')]=_0x57847d;return _0x47cea2;});return db[_0x48a6('0x85')][_0x48a6('0x86')](_0x4c91e3,{'transaction':_0x20c793});});}else{_0xfdae20=0x194;_0x5970d2=[];}});})[_0x48a6('0x3c')](function(){if(_0xfdae20!==0x194){return db['WhatsappApplication'][_0x48a6('0x87')]({'where':{'WhatsappAccountId':_0x57847d},'order':_0x48a6('0x88')})['then'](function(_0x18d974){_0x5970d2=_0x18d974;});}})[_0x48a6('0x2d')](function(_0x591b93){_0xfdae20=0x1f4;logger[_0x48a6('0x28')](_0x591b93[_0x48a6('0x3f')]);if(_0x591b93[_0x48a6('0x40')]){delete _0x591b93[_0x48a6('0x40')];}_0x5970d2=_0x591b93;})[_0x48a6('0x89')](function(){if(_0x5970d2===null){_0x4992af[_0x48a6('0x2e')](_0xfdae20);}else{if(_0xfdae20===0x1f4){_0x4992af[_0x48a6('0x30')](_0xfdae20)['send'](_0x5970d2);}else{_0x4992af[_0x48a6('0x30')](_0xfdae20)[_0x48a6('0x31')](_0x5970d2);}}});};exports[_0x48a6('0x8a')]=function(_0x44474c,_0x22f001,_0x5eaba3){var _0x3d3e68={};var _0x510fc6={};var _0x397f4c;var _0x5dd11c;return db['WhatsappAccount'][_0x48a6('0x77')]({'where':{'id':_0x44474c[_0x48a6('0x69')]['id']}})[_0x48a6('0x3c')](handleEntityNotFound(_0x22f001,null))[_0x48a6('0x3c')](function(_0x32ff82){if(_0x32ff82){_0x397f4c=_0x32ff82;_0x510fc6[_0x48a6('0x4e')]=_['keys'](db[_0x48a6('0x85')][_0x48a6('0x46')]);_0x510fc6[_0x48a6('0x49')]=_[_0x48a6('0x4a')](_0x44474c[_0x48a6('0x49')]);_0x510fc6[_0x48a6('0x4b')]=_['intersection'](_0x510fc6[_0x48a6('0x4e')],_0x510fc6[_0x48a6('0x49')]);_0x3d3e68[_0x48a6('0x4d')]=_[_0x48a6('0x4c')](_0x510fc6['model'],qs[_0x48a6('0x4f')](_0x44474c[_0x48a6('0x49')]['fields']));_0x3d3e68['attributes']=_0x3d3e68[_0x48a6('0x4d')][_0x48a6('0x6e')]?_0x3d3e68['attributes']:_0x510fc6['model'];_0x3d3e68[_0x48a6('0x51')]=qs[_0x48a6('0x52')](_0x44474c[_0x48a6('0x49')][_0x48a6('0x52')]);_0x3d3e68['where']=qs[_0x48a6('0x4b')](_[_0x48a6('0x54')](_0x44474c[_0x48a6('0x49')],_0x510fc6[_0x48a6('0x4b')]));if(_0x44474c['query'][_0x48a6('0x55')]){_0x3d3e68[_0x48a6('0x53')]=_[_0x48a6('0x56')](_0x3d3e68['where'],{'$or':_['map'](_0x3d3e68[_0x48a6('0x4d')],function(_0x3f68d4){var _0x5d24d2={};_0x5d24d2[_0x3f68d4]={'$like':'%'+_0x44474c[_0x48a6('0x49')]['filter']+'%'};return _0x5d24d2;})});}_0x3d3e68=_['merge']({},_0x3d3e68,_0x44474c[_0x48a6('0x59')]);return _0x397f4c[_0x48a6('0x8a')](_0x3d3e68);}})[_0x48a6('0x3c')](function(_0x315edb){if(_0x315edb){_0x5dd11c=_0x315edb[_0x48a6('0x6e')];if(!_0x44474c[_0x48a6('0x49')]['hasOwnProperty']('nolimit')){_0x3d3e68[_0x48a6('0x33')]=qs['limit'](_0x44474c[_0x48a6('0x49')]['limit']);_0x3d3e68[_0x48a6('0x35')]=qs[_0x48a6('0x35')](_0x44474c[_0x48a6('0x49')][_0x48a6('0x35')]);}return _0x397f4c[_0x48a6('0x8a')](_0x3d3e68);}})[_0x48a6('0x3c')](function(_0x2f09b4){if(_0x2f09b4){return _0x2f09b4?{'count':_0x5dd11c,'rows':_0x2f09b4}:null;}})[_0x48a6('0x3c')](respondWithResult(_0x22f001,null))[_0x48a6('0x2d')](handleError(_0x22f001,null));};exports[_0x48a6('0x8b')]=function(_0x296da2,_0x36aae9,_0x292ea9){var _0xc49947={'channel':'whatsapp'};var _0x3b8b60=[];var _0x2920cd=[];var _0x498bb9={};return db[_0x48a6('0x5c')]['find']({'where':{'id':_0x296da2[_0x48a6('0x69')]['id']},'include':[{'model':db[_0x48a6('0x85')],'as':_0x48a6('0x8c')}]})[_0x48a6('0x3c')](handleEntityNotFound(_0x36aae9,null))[_0x48a6('0x3c')](function(_0x6e84eb){_0xc49947['account']=_0x6e84eb;if(_0xc49947['account']&&_0xc49947['account'][_0x48a6('0x57')]===_0x48a6('0x8d')&&_0x296da2[_0x48a6('0x60')][_0x48a6('0x8e')]){if(_0x296da2[_0x48a6('0x60')][_0x48a6('0x8e')]['length']===0x0)return;if(_0x296da2[_0x48a6('0x60')]['statuses'][0x0][_0x48a6('0x8f')]!==_0x48a6('0x90'))return;return db[_0x48a6('0x91')][_0x48a6('0x3a')]({'read':!![],'readAt':_0x296da2[_0x48a6('0x60')][_0x48a6('0x8e')][0x0]['timestamp']},{'where':{'messageId':_0x296da2['body']['statuses'][0x0][_0x48a6('0x92')]},'individualHooks':!![]})[_0x48a6('0x3c')](function(_0x58fccc){return _0x36aae9['status'](0xc8)[_0x48a6('0x31')](_0x58fccc);});}_0xc49947[_0x48a6('0x93')]=_[_0x48a6('0x94')](_0x6e84eb[_0x48a6('0x8c')],['priority'],['asc']);if(_0xc49947[_0x48a6('0x95')][_0x48a6('0x8c')]){delete _0xc49947[_0x48a6('0x95')]['Applications'];}return db[_0x48a6('0x96')][_0x48a6('0x6a')]()[_0x48a6('0x3c')](function(_0x38e408){if(!_0x38e408){throw new db[(_0x48a6('0x97'))]['ValidationError']('no\x20available\x20attributes');}_0x3b8b60=_[_0x48a6('0x98')](_[_0x48a6('0x4a')](_0x38e408),[_0x48a6('0x99'),'updatedAt']);_0x2920cd=_['difference'](_[_0x48a6('0x4a')](_0x38e408),[_0x48a6('0x99'),'updatedAt',_0x48a6('0x9a'),'ListId']);_0xc49947[_0x48a6('0x60')]={'mapKey':_0x48a6('0x9b')};if(_0xc49947[_0x48a6('0x95')]&&_0xc49947[_0x48a6('0x95')][_0x48a6('0x57')]===_0x48a6('0x9c')){_0xc49947[_0x48a6('0x60')][_0x48a6('0x9d')]=_0x296da2['body'][_0x48a6('0x9e')][_0x48a6('0x9f')](_0x48a6('0xa0'),'');_0xc49947[_0x48a6('0x60')][_0x48a6('0x60')]=_0x296da2['body'][_0x48a6('0xa1')];_0xc49947[_0x48a6('0x60')][_0x48a6('0xa2')]=_0x296da2[_0x48a6('0x60')]['MessageSid'];}if(_0xc49947[_0x48a6('0x95')]&&_0xc49947[_0x48a6('0x95')][_0x48a6('0x57')]===_0x48a6('0x8d')){_0xc49947[_0x48a6('0x60')][_0x48a6('0x9d')]=_0x296da2[_0x48a6('0x60')][_0x48a6('0xa3')][0x0][_0x48a6('0x9d')];_0xc49947[_0x48a6('0x60')][_0x48a6('0x60')]=_0x296da2['body']['notifications'][0x0]['message'][_0x48a6('0x60')];_0xc49947['body'][_0x48a6('0xa2')]=_0x296da2[_0x48a6('0x60')][_0x48a6('0xa3')][0x0]['message_id'];}if(_0xc49947[_0x48a6('0x60')]['id']){delete _0xc49947['body']['id'];}if(_[_0x48a6('0xa4')](_0xc49947['body'][_0x48a6('0x9d')])){throw new db['Sequelize'][(_0x48a6('0xa5'))](_0x48a6('0xa6'));}if(_[_0x48a6('0xa4')](_0xc49947[_0x48a6('0x60')]['body'])||_0xc49947[_0x48a6('0x60')][_0x48a6('0x60')]===''){throw new db[(_0x48a6('0x97'))][(_0x48a6('0xa5'))](_0x48a6('0xa7'));}if(_[_0x48a6('0xa4')](_0xc49947[_0x48a6('0x60')][_0x48a6('0xa8')])){throw new db['Sequelize'][(_0x48a6('0xa5'))](_0x48a6('0xa9')+_0x2920cd);}if(!_['includes'](_0x2920cd,_0xc49947[_0x48a6('0x60')][_0x48a6('0xa8')])){throw new db['Sequelize']['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x2920cd);}_0x498bb9[_0xc49947['body'][_0x48a6('0xa8')]]=_0xc49947[_0x48a6('0x60')][_0x48a6('0x9d')];return db[_0x48a6('0xaa')][_0x48a6('0x5e')]({'where':{'id':_0xc49947[_0x48a6('0x95')][_0x48a6('0xab')]},'include':[{'model':db[_0x48a6('0x96')],'as':_0x48a6('0xac'),'where':_0x498bb9,'limit':0x1,'order':[[_0x48a6('0xad'),_0x48a6('0xae')]]}]});})['then'](handleEntityNotFound(_0x36aae9,null))[_0x48a6('0x3c')](function(_0x5bf445){if(_0x5bf445){_0xc49947[_0x48a6('0xaf')]=_[_0x48a6('0x79')](_0x5bf445,[_0x48a6('0xac')]);if(_0x5bf445[_0x48a6('0xac')][_0x48a6('0x6e')]){return _0x5bf445[_0x48a6('0xac')][0x0];}var _0x4462e2=_[_0x48a6('0x1c')](_0xc49947[_0x48a6('0x60')],{'firstName':_0xc49947[_0x48a6('0x60')]['from'],'ListId':_0x5bf445['id']});_0x4462e2[_0xc49947[_0x48a6('0x60')]['mapKey']]=_0xc49947[_0x48a6('0x60')][_0x48a6('0x9d')];return db[_0x48a6('0x96')][_0x48a6('0x5f')](_0x4462e2,{'fields':_0x3b8b60,'raw':!![]});}})[_0x48a6('0x3c')](handleEntityNotFound(_0x36aae9,null))[_0x48a6('0x3c')](function(_0x4900f7){if(_0x4900f7){_0xc49947['contact']=_0x4900f7;var _0x3b331e={'ContactId':_0x4900f7['id'],'phone':_0xc49947[_0x48a6('0x60')]['from'],'WhatsappAccountId':_0x296da2[_0x48a6('0x69')]['id']};var _0x228f40={'ContactId':_0x4900f7['id'],'WhatsappAccountId':_0x296da2[_0x48a6('0x69')]['id'],'closed':![]};return db[_0x48a6('0xb0')][_0x48a6('0x5e')]({'where':_0x228f40})['then'](function(_0x338373){if(_0x338373){return[_0x338373,![]];}return db[_0x48a6('0xb0')]['create'](_0x3b331e)[_0x48a6('0x3c')](function(_0x1a97bb){return[_0x1a97bb,!![]];});});}})[_0x48a6('0xb1')](function(_0x497554,_0x26adcb){_0xc49947[_0x48a6('0xb2')]=_0x497554['get']({'plain':!![]});_0xc49947[_0x48a6('0xb2')]['created']=![];if(_0x26adcb){if(_0xc49947[_0x48a6('0x95')][_0x48a6('0xb3')]){_0xc49947[_0x48a6('0x93')][_0x48a6('0xb4')]({'id':0x0,'priority':_0xc49947[_0x48a6('0x93')][_0x48a6('0x6e')]+0x1,'app':_0x48a6('0xb5'),'appdata':'unmanaged','interval':_0x48a6('0xb6')});}_0xc49947['interaction'][_0x48a6('0xb7')]=!![];}return db['WhatsappMessage'][_0x48a6('0x5f')]({'phone':_0xc49947[_0x48a6('0x60')][_0x48a6('0x9d')],'messageId':_0xc49947[_0x48a6('0x60')][_0x48a6('0xa2')],'body':_0xc49947[_0x48a6('0x60')][_0x48a6('0x60')],'WhatsappAccountId':_0x296da2[_0x48a6('0x69')]['id'],'WhatsappInteractionId':_0x497554['id'],'direction':'in','ContactId':_0x497554['ContactId'],'AttachmentId':_0xc49947[_0x48a6('0x60')]['AttachmentId']});})[_0x48a6('0x3c')](function(_0x2f74b9){_0xc49947[_0x48a6('0x2a')]=_0x2f74b9;if(!_0xc49947['interaction'][_0x48a6('0xb8')])return;return db['User'][_0x48a6('0x5e')]({'attributes':['id','name'],'where':{'id':_0xc49947[_0x48a6('0xb2')][_0x48a6('0xb8')]}});})['then'](function(_0x5bd807){if(_0x5bd807){_0xc49947[_0x48a6('0x93')][_0x48a6('0xb9')]({'id':0x0,'priority':0x0,'app':_0x48a6('0xba'),'appdata':_0x5bd807[_0x48a6('0x40')]+','+(_0xc49947[_0x48a6('0x95')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});}if(!_0xc49947['interaction'][_0x48a6('0xbb')])return;return db['WhatsappQueue'][_0x48a6('0x5e')]({'attributes':['id','name'],'where':{'id':_0xc49947['interaction'][_0x48a6('0xbb')]}});})[_0x48a6('0x3c')](function(_0x2343df){if(_0x2343df){_0xc49947[_0x48a6('0x93')]['unshift']({'id':0x0,'priority':0x1,'app':_0x48a6('0xbc'),'appdata':_0x2343df[_0x48a6('0x40')]+','+(_0xc49947['account'][_0x48a6('0xbd')]||0x12c),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x48a6('0xbe'),_0x48a6('0xbf'),_0xc49947);})['then'](function(_0x307fe2){if(_0x307fe2){var _0x3f23be=0xc8;var _0x1f6a11='receiveMessage';logger['info'](_0x48a6('0x26'),_0x1f6a11,_0x3f23be,_0x48a6('0xc0'));logger[_0x48a6('0x25')](_0x48a6('0xc1'),_0x1f6a11,_0x3f23be,'entity\x20found',JSON[_0x48a6('0x27')](_0x307fe2));if(_0xc49947[_0x48a6('0x95')][_0x48a6('0x57')]===_0x48a6('0x9c')){return _0x36aae9['status'](_0x3f23be)[_0x48a6('0x36')](_0x48a6('0xc2'),_0x48a6('0xc3'))[_0x48a6('0x41')](_0x48a6('0xc4'));}else{return _0x36aae9[_0x48a6('0x30')](_0x3f23be)[_0x48a6('0x31')](_0x307fe2);}}});})[_0x48a6('0x2d')](handleError(_0x36aae9,null));};exports[_0x48a6('0x41')]=function(_0x3c361c,_0x1dcf14,_0x56abfa){var _0x5a8b1a,_0x4cd7e7,_0x22e93e;if(_[_0x48a6('0xa4')](_0x3c361c[_0x48a6('0x60')][_0x48a6('0x60')])||_0x3c361c[_0x48a6('0x60')][_0x48a6('0x60')]===''){throw new db[(_0x48a6('0x97'))][(_0x48a6('0xa5'))](_0x48a6('0xa7'));}if(_[_0x48a6('0xa4')](_0x3c361c[_0x48a6('0x60')]['to'])){throw new db[(_0x48a6('0x97'))]['ValidationError']('to\x20is\x20mandatory');}_0x5a8b1a=_0x3c361c['body']['to'];return db[_0x48a6('0x5c')]['find']({'where':{'id':_0x3c361c[_0x48a6('0x69')]['id']},'include':[{'model':db[_0x48a6('0xaa')],'as':_0x48a6('0xc5'),'include':[{'model':db[_0x48a6('0x96')],'as':'Contacts','where':{'mobile':_0x5a8b1a},'limit':0x1,'order':[[_0x48a6('0xad'),_0x48a6('0xae')]]}]}]})[_0x48a6('0x3c')](handleEntityNotFound(_0x1dcf14,null))['then'](function(_0x1024e6){if(_0x1024e6&&_0x1024e6[_0x48a6('0xc5')]){_0x4cd7e7=_0x1024e6[_0x48a6('0x62')]({'plain':!![]});if(_0x4cd7e7[_0x48a6('0xc5')]&&_0x4cd7e7['List'][_0x48a6('0xac')][_0x48a6('0x6e')]){return _0x4cd7e7['List']['Contacts'][0x0];}return db[_0x48a6('0x96')][_0x48a6('0x5f')](_[_0x48a6('0x1c')](_0x3c361c[_0x48a6('0x60')],{'firstName':_0x5a8b1a,'mobile':_0x5a8b1a,'phone':_0x5a8b1a,'ListId':_0x4cd7e7[_0x48a6('0xab')]}));}})['then'](handleEntityNotFound(_0x1dcf14,null))[_0x48a6('0x3c')](function(_0x19892f){if(_0x19892f){_0x22e93e=_0x19892f;return db[_0x48a6('0xb0')][_0x48a6('0x5e')]({'where':{'ContactId':_0x22e93e['id'],'closed':![],'WhatsappAccountId':_0x4cd7e7['id']}})[_0x48a6('0x3c')](function(_0xa33be9){if(_0xa33be9){return[_0xa33be9,![]];}return db[_0x48a6('0xb0')]['create']({'UserId':_0x3c361c['user']['id'],'ContactId':_0x22e93e['id'],'WhatsappAccountId':_0x4cd7e7['id'],'phone':_0x5a8b1a,'firstMsgDirection':_0x48a6('0xc6'),'Messages':[_[_0x48a6('0x56')](_0x3c361c[_0x48a6('0x60')],{'read':![],'body':_0x3c361c[_0x48a6('0x60')][_0x48a6('0x60')],'phone':_0x5a8b1a,'WhatsappAccountId':_0x4cd7e7['id'],'UserId':_0x3c361c[_0x48a6('0x61')]['id'],'ContactId':_0x22e93e['id']})]},{'include':[{'model':db[_0x48a6('0x91')],'as':_0x48a6('0xc7')}]})[_0x48a6('0x3c')](function(_0x118620){return[_0x118620,!![]];});});}})[_0x48a6('0xb1')](function(_0x4624c5,_0x454c05){if(_0x454c05){return _0x4624c5;}return db['WhatsappMessage']['create'](_[_0x48a6('0x56')](_0x3c361c[_0x48a6('0x60')],{'read':![],'body':_0x3c361c[_0x48a6('0x60')][_0x48a6('0x60')],'phone':_0x5a8b1a,'WhatsappAccountId':_0x4cd7e7['id'],'WhatsappInteractionId':_0x4624c5['id'],'UserId':_0x3c361c[_0x48a6('0x61')]['id'],'ContactId':_0x22e93e['id']}))[_0x48a6('0x3c')](function(_0x1b93c0){_0x4624c5[_0x48a6('0xc8')]['Messages']=[];_0x4624c5[_0x48a6('0xc8')][_0x48a6('0xc7')][_0x48a6('0xb4')](_0x1b93c0[_0x48a6('0xc8')]);return _0x4624c5;});})[_0x48a6('0x3c')](respondWithResult(_0x1dcf14,null))[_0x48a6('0x2d')](handleError(_0x1dcf14,null));}; \ No newline at end of file +var _0x9616=['userWhatsappAccount:remove','getAgents','User','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','finally','getApplications','whatsapp','Applications','account','sinch','statuses','state','read','message_id','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','From','replace','MessageSid','notifications','from','messageId','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','CmList','Contacts','DESC','list','contact','WhatsappInteraction','spread','interaction','autoclose','push','close','*,*,*,*','created','WhatsappMessage','ContactId','UserId','unshift','agent','waitForTheAssignedAgent','queueId','WhatsappQueue','queue','waitForTheAssignedQueue','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','\x0a','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','include','show','params','WhatsappAccount','keys','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Pause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','rows','removeAnswers','omit','emit','userWhatsappAccount:save','removeAgents','isArray'];(function(_0x583338,_0xa95782){var _0x311f22=function(_0x5ec00c){while(--_0x5ec00c){_0x583338['push'](_0x583338['shift']());}};_0x311f22(++_0xa95782);}(_0x9616,0x112));var _0x6961=function(_0x1a51db,_0x2eecdc){_0x1a51db=_0x1a51db-0x0;var _0xea0473=_0x9616[_0x1a51db];return _0xea0473;};'use strict';var emlformat=require(_0x6961('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6961('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x6961('0x2'));var Mustache=require(_0x6961('0x3'));var util=require(_0x6961('0x4'));var path=require(_0x6961('0x5'));var sox=require(_0x6961('0x6'));var csv=require(_0x6961('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6961('0x8'));var squel=require(_0x6961('0x9'));var crypto=require('crypto');var jsforce=require(_0x6961('0xa'));var deskjs=require(_0x6961('0xb'));var toCsv=require(_0x6961('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6961('0xc'));var qs=require(_0x6961('0xd'));var as=require(_0x6961('0xe'));var hardwareService=require(_0x6961('0xf'));var logger=require(_0x6961('0x10'))(_0x6961('0x11'));var utils=require('../../config/utils');var config=require(_0x6961('0x12'));var licenseUtil=require(_0x6961('0x13'));var db=require(_0x6961('0x14'))['db'];config[_0x6961('0x15')]=_[_0x6961('0x16')](config[_0x6961('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0x6961('0x17'))(new Redis(config[_0x6961('0x15')]));require('./whatsappAccount.socket')['register'](socket);var jayson=require(_0x6961('0x18'));var client=jayson[_0x6961('0x19')][_0x6961('0x1a')]({'port':0x232c});function respondWithRpcPromise(_0x198d07,_0x254937,_0x6d8d6c,_0x362f34){return new BPromise(function(_0x4da5da,_0x3daad0){var _0x2a334f=_0x362f34||client;return _0x2a334f[_0x6961('0x1b')](_0x198d07,_0x6d8d6c)[_0x6961('0x1c')](function(_0x5d414d){logger[_0x6961('0x1d')](_0x6961('0x1e'),_0x254937,_0x6961('0x1f'));logger[_0x6961('0x20')](_0x6961('0x21'),_0x254937,_0x6961('0x1f'),JSON[_0x6961('0x22')](_0x5d414d));if(_0x5d414d[_0x6961('0x23')]){if(_0x5d414d[_0x6961('0x23')][_0x6961('0x24')]===0x1f4){logger[_0x6961('0x23')](_0x6961('0x1e'),_0x254937,_0x5d414d['error'][_0x6961('0x25')]);return _0x3daad0(_0x5d414d[_0x6961('0x23')][_0x6961('0x25')]);}logger[_0x6961('0x23')](_0x6961('0x1e'),_0x254937,_0x5d414d[_0x6961('0x23')][_0x6961('0x25')]);return _0x4da5da(_0x5d414d[_0x6961('0x23')][_0x6961('0x25')]);}else{logger[_0x6961('0x1d')]('WhatsappAccount,\x20%s,\x20%s',_0x254937,'request\x20sent');_0x4da5da(_0x5d414d[_0x6961('0x26')][_0x6961('0x25')]);}})[_0x6961('0x27')](function(_0x53431b){logger[_0x6961('0x23')](_0x6961('0x1e'),_0x254937,_0x53431b);_0x3daad0(_0x53431b);});});}function respondWithStatusCode(_0x501d8e,_0x4826e9){_0x4826e9=_0x4826e9||0xcc;return function(_0x53c090){if(_0x53c090){return _0x501d8e[_0x6961('0x28')](_0x4826e9);}return _0x501d8e[_0x6961('0x29')](_0x4826e9)[_0x6961('0x2a')]();};}function respondWithResult(_0x2cdb42,_0x48368d){_0x48368d=_0x48368d||0xc8;return function(_0x2061a6){if(_0x2061a6){return _0x2cdb42[_0x6961('0x29')](_0x48368d)[_0x6961('0x2b')](_0x2061a6);}};}function respondWithFilteredResult(_0x1bd951,_0x57eff6){return function(_0x2fcc44){if(_0x2fcc44){var _0x3b313b=typeof _0x57eff6[_0x6961('0x2c')]==='undefined'&&typeof _0x57eff6[_0x6961('0x2d')]===_0x6961('0x2e');var _0x4581cb=_0x2fcc44[_0x6961('0x2f')];var _0x13c0ae=_0x3b313b?0x0:_0x57eff6[_0x6961('0x2c')];var _0x2c1803=_0x3b313b?_0x2fcc44[_0x6961('0x2f')]:_0x57eff6['offset']+_0x57eff6['limit'];var _0x360be6;if(_0x2c1803>=_0x4581cb){_0x2c1803=_0x4581cb;_0x360be6=0xc8;}else{_0x360be6=0xce;}_0x1bd951['status'](_0x360be6);return _0x1bd951[_0x6961('0x30')](_0x6961('0x31'),_0x13c0ae+'-'+_0x2c1803+'/'+_0x4581cb)[_0x6961('0x2b')](_0x2fcc44);}return null;};}function patchUpdates(_0x2ad992){return function(_0x38e3e5){try{jsonpatch[_0x6961('0x32')](_0x38e3e5,_0x2ad992,!![]);}catch(_0x225642){return BPromise[_0x6961('0x33')](_0x225642);}return _0x38e3e5[_0x6961('0x34')]();};}function saveUpdates(_0x2bca76,_0x535b8e){return function(_0x58e867){if(_0x58e867){return _0x58e867[_0x6961('0x35')](_0x2bca76)['then'](function(_0x248c8c){return _0x248c8c;});}return null;};}function removeEntity(_0x49c771,_0x5801fc){return function(_0x15bd05){if(_0x15bd05){return _0x15bd05[_0x6961('0x36')]()[_0x6961('0x1c')](function(){var _0x2478ce=_0x15bd05[_0x6961('0x37')]({'plain':!![]});var _0x33ca57=_0x6961('0x38');return db[_0x6961('0x39')][_0x6961('0x36')]({'where':{'type':_0x33ca57,'resourceId':_0x2478ce['id']}})[_0x6961('0x1c')](function(){return _0x15bd05;});})['then'](function(){_0x49c771[_0x6961('0x29')](0xcc)[_0x6961('0x2a')]();});}};}function handleEntityNotFound(_0x24e3fc,_0x34a81e){return function(_0x421929){if(!_0x421929){_0x24e3fc[_0x6961('0x28')](0x194);}return _0x421929;};}function handleError(_0x30b780,_0xda1a73){_0xda1a73=_0xda1a73||0x1f4;return function(_0x509e3c){logger[_0x6961('0x23')](_0x509e3c[_0x6961('0x3a')]);if(_0x509e3c[_0x6961('0x3b')]){delete _0x509e3c['name'];}_0x30b780[_0x6961('0x29')](_0xda1a73)[_0x6961('0x3c')](_0x509e3c);};}exports[_0x6961('0x3d')]=function(_0x3d24e6,_0x3cc5b3){var _0x528213={'include':[{'model':db['Pause'],'as':_0x6961('0x3e')}]},_0x4d1ae0={},_0x4f5d0c={'count':0x0,'rows':[]};var _0x4f0c71=_[_0x6961('0x3f')](db['WhatsappAccount'][_0x6961('0x40')],function(_0x170912){return{'name':_0x170912[_0x6961('0x41')],'type':_0x170912['type'][_0x6961('0x42')]};});_0x4d1ae0[_0x6961('0x43')]=_[_0x6961('0x3f')](_0x4f0c71,'name');_0x4d1ae0[_0x6961('0x44')]=_['keys'](_0x3d24e6[_0x6961('0x44')]);_0x4d1ae0[_0x6961('0x45')]=_[_0x6961('0x46')](_0x4d1ae0[_0x6961('0x43')],_0x4d1ae0[_0x6961('0x44')]);_0x528213[_0x6961('0x47')]=_[_0x6961('0x46')](_0x4d1ae0[_0x6961('0x43')],qs['fields'](_0x3d24e6[_0x6961('0x44')][_0x6961('0x48')]));_0x528213[_0x6961('0x47')]=_0x528213['attributes'][_0x6961('0x49')]?_0x528213[_0x6961('0x47')]:_0x4d1ae0['model'];if(!_0x3d24e6[_0x6961('0x44')][_0x6961('0x4a')](_0x6961('0x4b'))){_0x528213['limit']=qs['limit'](_0x3d24e6[_0x6961('0x44')][_0x6961('0x2d')]);_0x528213[_0x6961('0x2c')]=qs[_0x6961('0x2c')](_0x3d24e6[_0x6961('0x44')]['offset']);}_0x528213[_0x6961('0x4c')]=qs[_0x6961('0x4d')](_0x3d24e6['query'][_0x6961('0x4d')]);_0x528213[_0x6961('0x4e')]=qs[_0x6961('0x45')](_[_0x6961('0x4f')](_0x3d24e6['query'],_0x4d1ae0['filters']),_0x4f0c71);if(_0x3d24e6[_0x6961('0x44')][_0x6961('0x50')]){_0x528213['where']=_['merge'](_0x528213['where'],{'$or':_[_0x6961('0x3f')](_0x4f0c71,function(_0x5d2299){if(_0x5d2299[_0x6961('0x51')]!==_0x6961('0x52')){var _0x1529ff={};_0x1529ff[_0x5d2299['name']]={'$like':'%'+_0x3d24e6[_0x6961('0x44')][_0x6961('0x50')]+'%'};return _0x1529ff;}})});}_0x528213=_[_0x6961('0x53')]({},_0x528213,_0x3d24e6[_0x6961('0x54')]);var _0x61dc62={'where':_0x528213[_0x6961('0x4e')]};return db['WhatsappAccount'][_0x6961('0x2f')](_0x61dc62)[_0x6961('0x1c')](function(_0x2128bb){_0x4f5d0c['count']=_0x2128bb;if(_0x3d24e6[_0x6961('0x44')][_0x6961('0x55')]){_0x528213[_0x6961('0x56')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x528213);})[_0x6961('0x1c')](function(_0x231eda){_0x4f5d0c['rows']=_0x231eda;return _0x4f5d0c;})[_0x6961('0x1c')](respondWithFilteredResult(_0x3cc5b3,_0x528213))[_0x6961('0x27')](handleError(_0x3cc5b3,null));};exports[_0x6961('0x57')]=function(_0x4e548b,_0x297e93){var _0x2e022b={'raw':![],'where':{'id':_0x4e548b[_0x6961('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x1506ee={};_0x1506ee[_0x6961('0x43')]=_['keys'](db[_0x6961('0x59')]['rawAttributes']);_0x1506ee[_0x6961('0x44')]=_[_0x6961('0x5a')](_0x4e548b[_0x6961('0x44')]);_0x1506ee['filters']=_[_0x6961('0x46')](_0x1506ee['model'],_0x1506ee[_0x6961('0x44')]);_0x2e022b[_0x6961('0x47')]=_[_0x6961('0x46')](_0x1506ee[_0x6961('0x43')],qs[_0x6961('0x48')](_0x4e548b[_0x6961('0x44')][_0x6961('0x48')]));_0x2e022b['attributes']=_0x2e022b[_0x6961('0x47')][_0x6961('0x49')]?_0x2e022b[_0x6961('0x47')]:_0x1506ee[_0x6961('0x43')];if(_0x4e548b[_0x6961('0x44')][_0x6961('0x55')]){_0x2e022b[_0x6961('0x56')]=[{'all':!![]}];}_0x2e022b=_[_0x6961('0x53')]({},_0x2e022b,_0x4e548b['options']);return db[_0x6961('0x59')]['find'](_0x2e022b)[_0x6961('0x1c')](handleEntityNotFound(_0x297e93,null))[_0x6961('0x1c')](respondWithResult(_0x297e93,null))['catch'](handleError(_0x297e93,null));};exports['create']=function(_0x30f9a8,_0x1c0b90){return db[_0x6961('0x59')][_0x6961('0x5b')](_0x30f9a8[_0x6961('0x5c')],{})[_0x6961('0x1c')](function(_0x405a95){var _0x40d215=_0x30f9a8[_0x6961('0x5d')][_0x6961('0x37')]({'plain':!![]});if(!_0x40d215)throw new Error(_0x6961('0x5e'));if(_0x40d215[_0x6961('0x5f')]===_0x6961('0x5d')){var _0x4718e4=_0x405a95['get']({'plain':!![]});var _0x121c00=_0x6961('0x38');return db['UserProfileSection'][_0x6961('0x60')]({'where':{'name':_0x121c00,'userProfileId':_0x40d215['userProfileId']},'raw':!![]})[_0x6961('0x1c')](function(_0xb33fc3){if(_0xb33fc3&&_0xb33fc3[_0x6961('0x61')]===0x0){return db['UserProfileResource'][_0x6961('0x5b')]({'name':_0x4718e4[_0x6961('0x3b')],'resourceId':_0x4718e4['id'],'type':_0xb33fc3[_0x6961('0x3b')],'sectionId':_0xb33fc3['id']},{})[_0x6961('0x1c')](function(){return _0x405a95;});}else{return _0x405a95;}})['catch'](function(_0x36c5da){logger[_0x6961('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x36c5da);throw _0x36c5da;});}return _0x405a95;})[_0x6961('0x1c')](respondWithResult(_0x1c0b90,0xc9))[_0x6961('0x27')](handleError(_0x1c0b90,null));};exports[_0x6961('0x35')]=function(_0x1d37d4,_0x4c67d6){if(_0x1d37d4['body']['id']){delete _0x1d37d4[_0x6961('0x5c')]['id'];}return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0x1d37d4[_0x6961('0x58')]['id']},'include':[{'model':db[_0x6961('0x62')],'as':_0x6961('0x3e')}]})['then'](handleEntityNotFound(_0x4c67d6,null))['then'](saveUpdates(_0x1d37d4[_0x6961('0x5c')],null))['then'](respondWithResult(_0x4c67d6,null))[_0x6961('0x27')](handleError(_0x4c67d6,null));};exports[_0x6961('0x36')]=function(_0x38fcaa,_0x3a64dd){return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0x38fcaa['params']['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x3a64dd,null))[_0x6961('0x1c')](removeEntity(_0x3a64dd,null))[_0x6961('0x27')](handleError(_0x3a64dd,null));};exports[_0x6961('0x63')]=function(_0x56adc4,_0x28d160){return db[_0x6961('0x59')][_0x6961('0x63')]()[_0x6961('0x1c')](respondWithResult(_0x28d160,null))[_0x6961('0x27')](handleError(_0x28d160,null));};exports[_0x6961('0x64')]=function(_0x13cf36,_0x47e90a,_0x2bf102){if(_0x13cf36[_0x6961('0x5c')]['id']){delete _0x13cf36[_0x6961('0x5c')]['id'];}return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0x13cf36[_0x6961('0x58')]['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x47e90a,null))[_0x6961('0x1c')](function(_0x3c440d){if(_0x3c440d){_0x13cf36[_0x6961('0x5c')][_0x6961('0x65')]=_0x3c440d['id'];return db[_0x6961('0x66')]['create'](_0x13cf36[_0x6961('0x5c')]);}})[_0x6961('0x1c')](respondWithResult(_0x47e90a,null))[_0x6961('0x27')](handleError(_0x47e90a,null));};exports[_0x6961('0x67')]=function(_0x5aadfa,_0x27006f,_0x2dc217){var _0x467bd0={'raw':![],'where':{}};var _0x330bb3={};var _0x169a52={'count':0x0,'rows':[]};return db[_0x6961('0x59')][_0x6961('0x68')]({'where':{'id':_0x5aadfa[_0x6961('0x58')]['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x27006f,null))[_0x6961('0x1c')](function(_0x53d616){if(_0x53d616){_0x330bb3[_0x6961('0x43')]=_[_0x6961('0x5a')](db[_0x6961('0x66')][_0x6961('0x40')]);_0x330bb3['query']=_[_0x6961('0x5a')](_0x5aadfa[_0x6961('0x44')]);_0x330bb3[_0x6961('0x45')]=_[_0x6961('0x46')](_0x330bb3[_0x6961('0x43')],_0x330bb3['query']);_0x467bd0[_0x6961('0x47')]=_[_0x6961('0x46')](_0x330bb3[_0x6961('0x43')],qs[_0x6961('0x48')](_0x5aadfa[_0x6961('0x44')][_0x6961('0x48')]));_0x467bd0['attributes']=_0x467bd0[_0x6961('0x47')][_0x6961('0x49')]?_0x467bd0[_0x6961('0x47')]:_0x330bb3['model'];if(!_0x5aadfa[_0x6961('0x44')][_0x6961('0x4a')](_0x6961('0x4b'))){_0x467bd0[_0x6961('0x2d')]=qs[_0x6961('0x2d')](_0x5aadfa['query'][_0x6961('0x2d')]);_0x467bd0[_0x6961('0x2c')]=qs['offset'](_0x5aadfa['query'][_0x6961('0x2c')]);}_0x467bd0[_0x6961('0x4c')]=qs[_0x6961('0x4d')](_0x5aadfa[_0x6961('0x44')]['sort']);_0x467bd0[_0x6961('0x4e')]=qs['filters'](_['pick'](_0x5aadfa['query'],_0x330bb3['filters']));_0x467bd0[_0x6961('0x4e')][_0x6961('0x65')]=_0x53d616['id'];if(_0x5aadfa['query']['filter']){_0x467bd0[_0x6961('0x4e')]=_[_0x6961('0x53')](_0x467bd0[_0x6961('0x4e')],{'$or':_[_0x6961('0x3f')](_0x467bd0[_0x6961('0x47')],function(_0x42637f){var _0x475ed3={};_0x475ed3[_0x42637f]={'$like':'%'+_0x5aadfa[_0x6961('0x44')][_0x6961('0x50')]+'%'};return _0x475ed3;})});}_0x467bd0=_[_0x6961('0x53')]({},_0x467bd0,_0x5aadfa[_0x6961('0x54')]);return db['Disposition'][_0x6961('0x2f')]({'where':_0x467bd0['where']})['then'](function(_0x322493){_0x169a52[_0x6961('0x2f')]=_0x322493;if(_0x5aadfa[_0x6961('0x44')][_0x6961('0x55')]){_0x467bd0[_0x6961('0x56')]=[{'all':!![]}];}return db['Disposition'][_0x6961('0x69')](_0x467bd0);})[_0x6961('0x1c')](function(_0x47f508){_0x169a52['rows']=_0x47f508;return _0x169a52;});}})[_0x6961('0x1c')](respondWithFilteredResult(_0x27006f,_0x467bd0))[_0x6961('0x27')](handleError(_0x27006f,null));};exports[_0x6961('0x6a')]=function(_0x11a6a6,_0x2ddecf,_0x24b4ea){return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0x11a6a6[_0x6961('0x58')]['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x2ddecf,null))[_0x6961('0x1c')](function(_0x2f2b02){if(_0x2f2b02){return _0x2f2b02['removeDispositions'](_0x11a6a6[_0x6961('0x44')][_0x6961('0x6b')]);}})['then'](respondWithStatusCode(_0x2ddecf,null))['catch'](handleError(_0x2ddecf,null));};exports[_0x6961('0x6c')]=function(_0x27b5b1,_0x4876c4,_0x501dd1){if(_0x27b5b1[_0x6961('0x5c')]['id']){delete _0x27b5b1[_0x6961('0x5c')]['id'];}return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0x27b5b1[_0x6961('0x58')]['id']}})['then'](handleEntityNotFound(_0x4876c4,null))[_0x6961('0x1c')](function(_0xce2bfa){if(_0xce2bfa){_0x27b5b1[_0x6961('0x5c')][_0x6961('0x65')]=_0xce2bfa['id'];return db[_0x6961('0x6d')]['create'](_0x27b5b1[_0x6961('0x5c')]);}})[_0x6961('0x1c')](respondWithResult(_0x4876c4,null))[_0x6961('0x27')](handleError(_0x4876c4,null));};exports[_0x6961('0x6e')]=function(_0x3d2d94,_0x1cc2cf,_0x5185d0){var _0x32394f={'raw':![],'where':{}};var _0xa1c531={};var _0x38f441={'count':0x0,'rows':[]};return db[_0x6961('0x59')][_0x6961('0x68')]({'where':{'id':_0x3d2d94[_0x6961('0x58')]['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x1cc2cf,null))[_0x6961('0x1c')](function(_0x195ebf){if(_0x195ebf){_0xa1c531[_0x6961('0x43')]=_[_0x6961('0x5a')](db[_0x6961('0x6d')][_0x6961('0x40')]);_0xa1c531[_0x6961('0x44')]=_[_0x6961('0x5a')](_0x3d2d94[_0x6961('0x44')]);_0xa1c531[_0x6961('0x45')]=_['intersection'](_0xa1c531['model'],_0xa1c531['query']);_0x32394f[_0x6961('0x47')]=_[_0x6961('0x46')](_0xa1c531[_0x6961('0x43')],qs['fields'](_0x3d2d94[_0x6961('0x44')][_0x6961('0x48')]));_0x32394f[_0x6961('0x47')]=_0x32394f['attributes'][_0x6961('0x49')]?_0x32394f['attributes']:_0xa1c531[_0x6961('0x43')];if(!_0x3d2d94[_0x6961('0x44')][_0x6961('0x4a')]('nolimit')){_0x32394f[_0x6961('0x2d')]=qs['limit'](_0x3d2d94[_0x6961('0x44')]['limit']);_0x32394f['offset']=qs[_0x6961('0x2c')](_0x3d2d94[_0x6961('0x44')][_0x6961('0x2c')]);}_0x32394f['order']=qs[_0x6961('0x4d')](_0x3d2d94['query'][_0x6961('0x4d')]);_0x32394f[_0x6961('0x4e')]=qs['filters'](_[_0x6961('0x4f')](_0x3d2d94['query'],_0xa1c531[_0x6961('0x45')]));_0x32394f[_0x6961('0x4e')][_0x6961('0x65')]=_0x195ebf['id'];if(_0x3d2d94[_0x6961('0x44')][_0x6961('0x50')]){_0x32394f[_0x6961('0x4e')]=_['merge'](_0x32394f['where'],{'$or':_[_0x6961('0x3f')](_0x32394f[_0x6961('0x47')],function(_0x4d9098){var _0x5c8b85={};_0x5c8b85[_0x4d9098]={'$like':'%'+_0x3d2d94[_0x6961('0x44')][_0x6961('0x50')]+'%'};return _0x5c8b85;})});}_0x32394f=_['merge']({},_0x32394f,_0x3d2d94[_0x6961('0x54')]);return db[_0x6961('0x6d')][_0x6961('0x2f')]({'where':_0x32394f[_0x6961('0x4e')]})['then'](function(_0x4347b4){_0x38f441[_0x6961('0x2f')]=_0x4347b4;if(_0x3d2d94[_0x6961('0x44')][_0x6961('0x55')]){_0x32394f['include']=[{'all':!![]}];}return db[_0x6961('0x6d')]['findAll'](_0x32394f);})[_0x6961('0x1c')](function(_0xac0406){_0x38f441[_0x6961('0x6f')]=_0xac0406;return _0x38f441;});}})['then'](respondWithFilteredResult(_0x1cc2cf,_0x32394f))['catch'](handleError(_0x1cc2cf,null));};exports[_0x6961('0x70')]=function(_0x294041,_0x48e6f0,_0x3f2b07){return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0x294041['params']['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x48e6f0,null))[_0x6961('0x1c')](function(_0x31d3bd){if(_0x31d3bd){return _0x31d3bd['removeAnswers'](_0x294041[_0x6961('0x44')][_0x6961('0x6b')]);}})[_0x6961('0x1c')](respondWithStatusCode(_0x48e6f0,null))[_0x6961('0x27')](handleError(_0x48e6f0,null));};exports['addAgents']=function(_0x7ae740,_0x3c83fa,_0xd983fb){return db[_0x6961('0x59')]['find']({'where':{'id':_0x7ae740[_0x6961('0x58')]['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x3c83fa,null))[_0x6961('0x1c')](function(_0xbb7e9a){if(_0xbb7e9a){return _0xbb7e9a['addAgents'](_0x7ae740[_0x6961('0x5c')][_0x6961('0x6b')],_[_0x6961('0x71')](_0x7ae740['body'],[_0x6961('0x6b'),'id'])||{})['spread'](function(_0x2bbe23){for(var _0x8b1fd9=0x0;_0x8b1fd9<_0x7ae740[_0x6961('0x5c')][_0x6961('0x6b')][_0x6961('0x49')];_0x8b1fd9+=0x1){socket[_0x6961('0x72')](_0x6961('0x73'),{'UserId':Number(_0x7ae740[_0x6961('0x5c')][_0x6961('0x6b')][_0x8b1fd9]),'WhatsappAccountId':Number(_0x7ae740[_0x6961('0x58')]['id'])});}return _0x2bbe23;});}})[_0x6961('0x1c')](respondWithResult(_0x3c83fa,null))[_0x6961('0x27')](handleError(_0x3c83fa,null));};exports[_0x6961('0x74')]=function(_0xa84ad5,_0x4a276e,_0x5ca111){return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0xa84ad5[_0x6961('0x58')]['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x4a276e,null))['then'](function(_0x3eaa62){if(_0x3eaa62){return _0x3eaa62['removeAgents'](_0xa84ad5['query'][_0x6961('0x6b')])[_0x6961('0x1c')](function(){if(_[_0x6961('0x75')](_0xa84ad5['query']['ids'])){for(var _0x24bd60=0x0;_0x24bd60<_0xa84ad5['query'][_0x6961('0x6b')][_0x6961('0x49')];_0x24bd60+=0x1){socket['emit'](_0x6961('0x76'),{'UserId':Number(_0xa84ad5[_0x6961('0x44')][_0x6961('0x6b')][_0x24bd60]),'WhatsappAccountId':Number(_0xa84ad5[_0x6961('0x58')]['id'])});}}else{socket[_0x6961('0x72')]('userWhatsappAccount:remove',{'UserId':Number(_0xa84ad5[_0x6961('0x44')]['ids']),'WhatsappAccountId':Number(_0xa84ad5['params']['id'])});}});}})[_0x6961('0x1c')](respondWithStatusCode(_0x4a276e,null))[_0x6961('0x27')](handleError(_0x4a276e,null));};exports[_0x6961('0x77')]=function(_0x56c335,_0x1cd08f,_0xa2763b){var _0x704083={};var _0x36cca0={};var _0x14d481;var _0x1214f3;return db[_0x6961('0x59')][_0x6961('0x68')]({'where':{'id':_0x56c335[_0x6961('0x58')]['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x1cd08f,null))[_0x6961('0x1c')](function(_0x1cf5d7){if(_0x1cf5d7){_0x14d481=_0x1cf5d7;_0x36cca0[_0x6961('0x43')]=_[_0x6961('0x5a')](db[_0x6961('0x78')][_0x6961('0x40')]);_0x36cca0[_0x6961('0x44')]=_['keys'](_0x56c335[_0x6961('0x44')]);_0x36cca0[_0x6961('0x45')]=_[_0x6961('0x46')](_0x36cca0['model'],_0x36cca0[_0x6961('0x44')]);_0x704083[_0x6961('0x47')]=_[_0x6961('0x46')](_0x36cca0['model'],qs['fields'](_0x56c335[_0x6961('0x44')][_0x6961('0x48')]));_0x704083[_0x6961('0x47')]=_0x704083[_0x6961('0x47')]['length']?_0x704083[_0x6961('0x47')]:_0x36cca0[_0x6961('0x43')];_0x704083[_0x6961('0x4c')]=qs[_0x6961('0x4d')](_0x56c335[_0x6961('0x44')][_0x6961('0x4d')]);_0x704083[_0x6961('0x4e')]=qs[_0x6961('0x45')](_[_0x6961('0x4f')](_0x56c335['query'],_0x36cca0[_0x6961('0x45')]));if(_0x56c335[_0x6961('0x44')][_0x6961('0x50')]){_0x704083[_0x6961('0x4e')]=_[_0x6961('0x53')](_0x704083[_0x6961('0x4e')],{'$or':_[_0x6961('0x3f')](_0x704083[_0x6961('0x47')],function(_0x72b13b){var _0x467b9a={};_0x467b9a[_0x72b13b]={'$like':'%'+_0x56c335[_0x6961('0x44')][_0x6961('0x50')]+'%'};return _0x467b9a;})});}_0x704083=_['merge']({},_0x704083,_0x56c335['options']);return _0x14d481[_0x6961('0x77')](_0x704083);}})[_0x6961('0x1c')](function(_0x4e006e){if(_0x4e006e){_0x1214f3=_0x4e006e['length'];if(!_0x56c335['query'][_0x6961('0x4a')](_0x6961('0x4b'))){_0x704083[_0x6961('0x2d')]=qs[_0x6961('0x2d')](_0x56c335[_0x6961('0x44')][_0x6961('0x2d')]);_0x704083['offset']=qs[_0x6961('0x2c')](_0x56c335[_0x6961('0x44')][_0x6961('0x2c')]);}return _0x14d481[_0x6961('0x77')](_0x704083);}})[_0x6961('0x1c')](function(_0x17df71){if(_0x17df71){return _0x17df71?{'count':_0x1214f3,'rows':_0x17df71}:null;}})[_0x6961('0x1c')](respondWithResult(_0x1cd08f,null))[_0x6961('0x27')](handleError(_0x1cd08f,null));};exports['addApplications']=function(_0x435b4c,_0x7409ea){var _0x35f012=_0x435b4c[_0x6961('0x58')]['id'];var _0x386fec=_0x435b4c['body'];var _0x179af9=0xc8;var _0x42f4da=null;return db[_0x6961('0x79')][_0x6961('0x7a')]({'isolationLevel':db[_0x6961('0x79')][_0x6961('0x7b')][_0x6961('0x7c')][_0x6961('0x7d')]},function(_0x203334){return db[_0x6961('0x59')][_0x6961('0x68')]({'where':{'id':_0x35f012},'transaction':_0x203334})[_0x6961('0x1c')](function(_0xd594b7){if(_0xd594b7){return db[_0x6961('0x7e')][_0x6961('0x36')]({'where':{'WhatsappAccountId':_0x35f012},'transaction':_0x203334})[_0x6961('0x1c')](function(){var _0x323688=_[_0x6961('0x3f')](_0x386fec,function(_0x41d249){_0x41d249[_0x6961('0x65')]=_0x35f012;return _0x41d249;});return db[_0x6961('0x7e')][_0x6961('0x7f')](_0x323688,{'transaction':_0x203334});});}else{_0x179af9=0x194;_0x42f4da=[];}});})['then'](function(){if(_0x179af9!==0x194){return db[_0x6961('0x7e')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x35f012},'order':'priority'})[_0x6961('0x1c')](function(_0x3e1407){_0x42f4da=_0x3e1407;});}})[_0x6961('0x27')](function(_0x1052c4){_0x179af9=0x1f4;logger['error'](_0x1052c4['stack']);if(_0x1052c4[_0x6961('0x3b')]){delete _0x1052c4[_0x6961('0x3b')];}_0x42f4da=_0x1052c4;})[_0x6961('0x80')](function(){if(_0x42f4da===null){_0x7409ea[_0x6961('0x28')](_0x179af9);}else{if(_0x179af9===0x1f4){_0x7409ea['status'](_0x179af9)['send'](_0x42f4da);}else{_0x7409ea[_0x6961('0x29')](_0x179af9)[_0x6961('0x2b')](_0x42f4da);}}});};exports[_0x6961('0x81')]=function(_0x3af45b,_0x2edeed,_0x5c571d){var _0x3cf247={};var _0x4c5eec={};var _0x37536c;var _0x4bb695;return db['WhatsappAccount'][_0x6961('0x68')]({'where':{'id':_0x3af45b['params']['id']}})[_0x6961('0x1c')](handleEntityNotFound(_0x2edeed,null))[_0x6961('0x1c')](function(_0x511087){if(_0x511087){_0x37536c=_0x511087;_0x4c5eec[_0x6961('0x43')]=_['keys'](db[_0x6961('0x7e')]['rawAttributes']);_0x4c5eec[_0x6961('0x44')]=_['keys'](_0x3af45b[_0x6961('0x44')]);_0x4c5eec[_0x6961('0x45')]=_['intersection'](_0x4c5eec[_0x6961('0x43')],_0x4c5eec['query']);_0x3cf247[_0x6961('0x47')]=_[_0x6961('0x46')](_0x4c5eec[_0x6961('0x43')],qs['fields'](_0x3af45b[_0x6961('0x44')][_0x6961('0x48')]));_0x3cf247[_0x6961('0x47')]=_0x3cf247[_0x6961('0x47')]['length']?_0x3cf247['attributes']:_0x4c5eec[_0x6961('0x43')];_0x3cf247[_0x6961('0x4c')]=qs['sort'](_0x3af45b[_0x6961('0x44')][_0x6961('0x4d')]);_0x3cf247[_0x6961('0x4e')]=qs['filters'](_[_0x6961('0x4f')](_0x3af45b['query'],_0x4c5eec[_0x6961('0x45')]));if(_0x3af45b[_0x6961('0x44')][_0x6961('0x50')]){_0x3cf247[_0x6961('0x4e')]=_[_0x6961('0x53')](_0x3cf247[_0x6961('0x4e')],{'$or':_[_0x6961('0x3f')](_0x3cf247[_0x6961('0x47')],function(_0x3dd71b){var _0x43ce50={};_0x43ce50[_0x3dd71b]={'$like':'%'+_0x3af45b['query']['filter']+'%'};return _0x43ce50;})});}_0x3cf247=_[_0x6961('0x53')]({},_0x3cf247,_0x3af45b[_0x6961('0x54')]);return _0x37536c[_0x6961('0x81')](_0x3cf247);}})[_0x6961('0x1c')](function(_0x18ccc7){if(_0x18ccc7){_0x4bb695=_0x18ccc7[_0x6961('0x49')];if(!_0x3af45b[_0x6961('0x44')][_0x6961('0x4a')]('nolimit')){_0x3cf247[_0x6961('0x2d')]=qs[_0x6961('0x2d')](_0x3af45b[_0x6961('0x44')][_0x6961('0x2d')]);_0x3cf247['offset']=qs[_0x6961('0x2c')](_0x3af45b['query'][_0x6961('0x2c')]);}return _0x37536c[_0x6961('0x81')](_0x3cf247);}})[_0x6961('0x1c')](function(_0xb205f6){if(_0xb205f6){return _0xb205f6?{'count':_0x4bb695,'rows':_0xb205f6}:null;}})['then'](respondWithResult(_0x2edeed,null))[_0x6961('0x27')](handleError(_0x2edeed,null));};exports['notify']=function(_0x5a2985,_0x52a3f0,_0x25f85c){var _0x399d90={'channel':_0x6961('0x82')};var _0x373be7=[];var _0x4ab7e7=[];var _0x3f0533={};return db[_0x6961('0x59')][_0x6961('0x60')]({'where':{'id':_0x5a2985[_0x6961('0x58')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x6961('0x83')}]})['then'](handleEntityNotFound(_0x52a3f0,null))[_0x6961('0x1c')](function(_0x42c4dc){_0x399d90[_0x6961('0x84')]=_0x42c4dc;if(_0x399d90['account']&&_0x399d90['account']['type']===_0x6961('0x85')&&_0x5a2985[_0x6961('0x5c')][_0x6961('0x86')]){if(_0x5a2985['body'][_0x6961('0x86')][_0x6961('0x49')]===0x0)return;if(_0x5a2985[_0x6961('0x5c')][_0x6961('0x86')][0x0][_0x6961('0x87')]!==_0x6961('0x88'))return;return db['WhatsappMessage'][_0x6961('0x35')]({'read':!![],'readAt':_0x5a2985['body'][_0x6961('0x86')][0x0]['timestamp']},{'where':{'messageId':_0x5a2985[_0x6961('0x5c')][_0x6961('0x86')][0x0][_0x6961('0x89')]},'individualHooks':!![]})['then'](function(_0x532a42){return _0x52a3f0['status'](0xc8)[_0x6961('0x2b')](_0x532a42);});}_0x399d90[_0x6961('0x8a')]=_[_0x6961('0x8b')](_0x42c4dc['Applications'],[_0x6961('0x8c')],[_0x6961('0x8d')]);if(_0x399d90[_0x6961('0x84')][_0x6961('0x83')]){delete _0x399d90[_0x6961('0x84')][_0x6961('0x83')];}return db[_0x6961('0x8e')][_0x6961('0x63')]()[_0x6961('0x1c')](function(_0x576a9c){if(!_0x576a9c){throw new db[(_0x6961('0x8f'))][(_0x6961('0x90'))]('no\x20available\x20attributes');}_0x373be7=_[_0x6961('0x91')](_[_0x6961('0x5a')](_0x576a9c),[_0x6961('0x92'),_0x6961('0x93')]);_0x4ab7e7=_[_0x6961('0x91')](_['keys'](_0x576a9c),['createdAt',_0x6961('0x93'),_0x6961('0x94'),_0x6961('0x95')]);_0x399d90[_0x6961('0x5c')]={'mapKey':_0x6961('0x96')};if(_0x399d90[_0x6961('0x84')]&&_0x399d90[_0x6961('0x84')][_0x6961('0x51')]===_0x6961('0x97')){_0x399d90['body']['from']=_0x5a2985['body'][_0x6961('0x98')][_0x6961('0x99')]('whatsapp:','');_0x399d90[_0x6961('0x5c')][_0x6961('0x5c')]=_0x5a2985[_0x6961('0x5c')]['Body'];_0x399d90[_0x6961('0x5c')]['messageId']=_0x5a2985[_0x6961('0x5c')][_0x6961('0x9a')];}if(_0x399d90[_0x6961('0x84')]&&_0x399d90[_0x6961('0x84')][_0x6961('0x51')]==='sinch'){_0x399d90['body']['from']=_0x5a2985[_0x6961('0x5c')][_0x6961('0x9b')][0x0][_0x6961('0x9c')];_0x399d90['body'][_0x6961('0x5c')]=_0x5a2985[_0x6961('0x5c')][_0x6961('0x9b')][0x0][_0x6961('0x25')][_0x6961('0x5c')];_0x399d90[_0x6961('0x5c')][_0x6961('0x9d')]=_0x5a2985[_0x6961('0x5c')][_0x6961('0x9b')][0x0][_0x6961('0x89')];}if(_0x399d90[_0x6961('0x5c')]['id']){delete _0x399d90['body']['id'];}if(_[_0x6961('0x9e')](_0x399d90['body'][_0x6961('0x9c')])){throw new db['Sequelize'][(_0x6961('0x90'))]('from\x20is\x20mandatory');}if(_[_0x6961('0x9e')](_0x399d90[_0x6961('0x5c')]['body'])||_0x399d90['body'][_0x6961('0x5c')]===''){throw new db[(_0x6961('0x8f'))][(_0x6961('0x90'))](_0x6961('0x9f'));}if(_['isNil'](_0x399d90[_0x6961('0x5c')][_0x6961('0xa0')])){throw new db['Sequelize'][(_0x6961('0x90'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ab7e7);}if(!_[_0x6961('0xa1')](_0x4ab7e7,_0x399d90[_0x6961('0x5c')]['mapKey'])){throw new db['Sequelize'][(_0x6961('0x90'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ab7e7);}_0x3f0533[_0x399d90[_0x6961('0x5c')][_0x6961('0xa0')]]=_0x399d90['body'][_0x6961('0x9c')];return db[_0x6961('0xa2')][_0x6961('0x60')]({'where':{'id':_0x399d90[_0x6961('0x84')][_0x6961('0x95')]},'include':[{'model':db[_0x6961('0x8e')],'as':_0x6961('0xa3'),'where':_0x3f0533,'limit':0x1,'order':[[_0x6961('0x93'),_0x6961('0xa4')]]}]});})[_0x6961('0x1c')](handleEntityNotFound(_0x52a3f0,null))['then'](function(_0x3c3742){if(_0x3c3742){_0x399d90[_0x6961('0xa5')]=_[_0x6961('0x71')](_0x3c3742,['Contacts']);if(_0x3c3742[_0x6961('0xa3')][_0x6961('0x49')]){return _0x3c3742[_0x6961('0xa3')][0x0];}var _0x10c57c=_[_0x6961('0x16')](_0x399d90['body'],{'firstName':_0x399d90[_0x6961('0x5c')][_0x6961('0x9c')],'ListId':_0x3c3742['id']});_0x10c57c[_0x399d90[_0x6961('0x5c')][_0x6961('0xa0')]]=_0x399d90[_0x6961('0x5c')][_0x6961('0x9c')];return db[_0x6961('0x8e')]['create'](_0x10c57c,{'fields':_0x373be7,'raw':!![]});}})[_0x6961('0x1c')](handleEntityNotFound(_0x52a3f0,null))[_0x6961('0x1c')](function(_0x18eef9){if(_0x18eef9){_0x399d90[_0x6961('0xa6')]=_0x18eef9;var _0x4b546b={'ContactId':_0x18eef9['id'],'phone':_0x399d90[_0x6961('0x5c')][_0x6961('0x9c')],'WhatsappAccountId':_0x5a2985[_0x6961('0x58')]['id']};var _0x5d6069={'ContactId':_0x18eef9['id'],'WhatsappAccountId':_0x5a2985[_0x6961('0x58')]['id'],'closed':![]};return db[_0x6961('0xa7')]['find']({'where':_0x5d6069})[_0x6961('0x1c')](function(_0x1db970){if(_0x1db970){return[_0x1db970,![]];}return db['WhatsappInteraction'][_0x6961('0x5b')](_0x4b546b)[_0x6961('0x1c')](function(_0x222fbf){return[_0x222fbf,!![]];});});}})[_0x6961('0xa8')](function(_0x4121b3,_0x4cc2fd){_0x399d90[_0x6961('0xa9')]=_0x4121b3[_0x6961('0x37')]({'plain':!![]});_0x399d90[_0x6961('0xa9')]['created']=![];if(_0x4cc2fd){if(_0x399d90[_0x6961('0x84')][_0x6961('0xaa')]){_0x399d90['applications'][_0x6961('0xab')]({'id':0x0,'priority':_0x399d90[_0x6961('0x8a')][_0x6961('0x49')]+0x1,'app':_0x6961('0xac'),'appdata':'unmanaged','interval':_0x6961('0xad')});}_0x399d90['interaction'][_0x6961('0xae')]=!![];}return db[_0x6961('0xaf')][_0x6961('0x5b')]({'phone':_0x399d90['body'][_0x6961('0x9c')],'messageId':_0x399d90[_0x6961('0x5c')][_0x6961('0x9d')],'body':_0x399d90[_0x6961('0x5c')]['body'],'WhatsappAccountId':_0x5a2985[_0x6961('0x58')]['id'],'WhatsappInteractionId':_0x4121b3['id'],'direction':'in','ContactId':_0x4121b3[_0x6961('0xb0')],'AttachmentId':_0x399d90[_0x6961('0x5c')]['AttachmentId']});})['then'](function(_0x57f729){_0x399d90[_0x6961('0x25')]=_0x57f729;if(!_0x399d90[_0x6961('0xa9')]['UserId'])return;return db[_0x6961('0x78')]['find']({'attributes':['id',_0x6961('0x3b')],'where':{'id':_0x399d90[_0x6961('0xa9')][_0x6961('0xb1')]}});})[_0x6961('0x1c')](function(_0x2eddd7){if(_0x2eddd7){_0x399d90[_0x6961('0x8a')][_0x6961('0xb2')]({'id':0x0,'priority':0x0,'app':_0x6961('0xb3'),'appdata':_0x2eddd7[_0x6961('0x3b')]+','+(_0x399d90[_0x6961('0x84')][_0x6961('0xb4')]||0xa),'interval':_0x6961('0xad')});}if(!_0x399d90[_0x6961('0xa9')][_0x6961('0xb5')])return;return db[_0x6961('0xb6')][_0x6961('0x60')]({'attributes':['id',_0x6961('0x3b')],'where':{'id':_0x399d90[_0x6961('0xa9')][_0x6961('0xb5')]}});})[_0x6961('0x1c')](function(_0x2bc68d){if(_0x2bc68d){_0x399d90['applications'][_0x6961('0xb2')]({'id':0x0,'priority':0x1,'app':_0x6961('0xb7'),'appdata':_0x2bc68d['name']+','+(_0x399d90[_0x6961('0x84')][_0x6961('0xb8')]||0x12c),'interval':_0x6961('0xad')});}return respondWithRpcPromise(_0x6961('0xb9'),_0x6961('0xba'),_0x399d90);})[_0x6961('0x1c')](function(_0x1c5591){if(_0x1c5591){var _0x4fd2ef=0xc8;var _0x27a633=_0x6961('0xbb');logger[_0x6961('0x1d')](_0x6961('0x21'),_0x27a633,_0x4fd2ef,_0x6961('0xbc'));logger['debug'](_0x6961('0xbd'),_0x27a633,_0x4fd2ef,_0x6961('0xbc'),JSON['stringify'](_0x1c5591));if(_0x399d90['account'][_0x6961('0x51')]===_0x6961('0x97')){return _0x52a3f0[_0x6961('0x29')](_0x4fd2ef)['set']('Content-Type','text/xml')['send'](_0x6961('0xbe'));}else{return _0x52a3f0[_0x6961('0x29')](_0x4fd2ef)['json'](_0x1c5591);}}});})[_0x6961('0x27')](handleError(_0x52a3f0,null));};exports[_0x6961('0x3c')]=function(_0x39d06a,_0x54f6e7,_0x1bcd57){var _0xacdfa6,_0x2681b1,_0x39ef2d;if(_[_0x6961('0x9e')](_0x39d06a[_0x6961('0x5c')][_0x6961('0x5c')])||_0x39d06a['body'][_0x6961('0x5c')]===''){throw new db[(_0x6961('0x8f'))][(_0x6961('0x90'))](_0x6961('0x9f'));}if(_['isNil'](_0x39d06a[_0x6961('0x5c')]['to'])){throw new db['Sequelize'][(_0x6961('0x90'))](_0x6961('0xbf'));}_0xacdfa6=_0x39d06a['body']['to'];return db['WhatsappAccount'][_0x6961('0x60')]({'where':{'id':_0x39d06a[_0x6961('0x58')]['id']},'include':[{'model':db[_0x6961('0xa2')],'as':_0x6961('0xc0'),'include':[{'model':db[_0x6961('0x8e')],'as':_0x6961('0xa3'),'where':{'mobile':_0xacdfa6},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})['then'](handleEntityNotFound(_0x54f6e7,null))[_0x6961('0x1c')](function(_0x5c601f){if(_0x5c601f&&_0x5c601f[_0x6961('0xc0')]){_0x2681b1=_0x5c601f['get']({'plain':!![]});if(_0x2681b1[_0x6961('0xc0')]&&_0x2681b1[_0x6961('0xc0')][_0x6961('0xa3')][_0x6961('0x49')]){return _0x2681b1['List'][_0x6961('0xa3')][0x0];}return db['CmContact']['create'](_[_0x6961('0x16')](_0x39d06a[_0x6961('0x5c')],{'firstName':_0xacdfa6,'mobile':_0xacdfa6,'phone':_0xacdfa6,'ListId':_0x2681b1[_0x6961('0x95')]}));}})['then'](handleEntityNotFound(_0x54f6e7,null))[_0x6961('0x1c')](function(_0x4d5225){if(_0x4d5225){_0x39ef2d=_0x4d5225;return db[_0x6961('0xa7')][_0x6961('0x60')]({'where':{'ContactId':_0x39ef2d['id'],'closed':![],'WhatsappAccountId':_0x2681b1['id']}})[_0x6961('0x1c')](function(_0x3bbaa8){if(_0x3bbaa8){return[_0x3bbaa8,![]];}return db[_0x6961('0xa7')]['create']({'UserId':_0x39d06a['user']['id'],'ContactId':_0x39ef2d['id'],'WhatsappAccountId':_0x2681b1['id'],'phone':_0xacdfa6,'firstMsgDirection':_0x6961('0xc1'),'Messages':[_[_0x6961('0x53')](_0x39d06a[_0x6961('0x5c')],{'read':![],'body':_0x39d06a[_0x6961('0x5c')][_0x6961('0x5c')],'phone':_0xacdfa6,'WhatsappAccountId':_0x2681b1['id'],'UserId':_0x39d06a[_0x6961('0x5d')]['id'],'ContactId':_0x39ef2d['id']})]},{'include':[{'model':db[_0x6961('0xaf')],'as':_0x6961('0xc2')}]})[_0x6961('0x1c')](function(_0x30b91f){return[_0x30b91f,!![]];});});}})[_0x6961('0xa8')](function(_0x48602e,_0x3c5706){if(_0x3c5706){return _0x48602e;}return db[_0x6961('0xaf')]['create'](_['merge'](_0x39d06a[_0x6961('0x5c')],{'read':![],'body':_0x39d06a[_0x6961('0x5c')][_0x6961('0x5c')],'phone':_0xacdfa6,'WhatsappAccountId':_0x2681b1['id'],'WhatsappInteractionId':_0x48602e['id'],'UserId':_0x39d06a[_0x6961('0x5d')]['id'],'ContactId':_0x39ef2d['id']}))[_0x6961('0x1c')](function(_0x156a55){_0x48602e['dataValues'][_0x6961('0xc2')]=[];_0x48602e[_0x6961('0xc3')][_0x6961('0xc2')][_0x6961('0xab')](_0x156a55[_0x6961('0xc3')]);return _0x48602e;});})[_0x6961('0x1c')](respondWithResult(_0x54f6e7,null))[_0x6961('0x27')](handleError(_0x54f6e7,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 0c42d7c..43773ee 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 _0xc308=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappAccount','save','update','remove'];(function(_0xdabd90,_0x53c625){var _0x291831=function(_0x1f2fc1){while(--_0x1f2fc1){_0xdabd90['push'](_0xdabd90['shift']());}};_0x291831(++_0x53c625);}(_0xc308,0xae));var _0x8c30=function(_0x3ce571,_0x52e126){_0x3ce571=_0x3ce571-0x0;var _0xcef624=_0xc308[_0x3ce571];return _0xcef624;};'use strict';var EventEmitter=require(_0x8c30('0x0'));var WhatsappAccount=require(_0x8c30('0x1'))['db'][_0x8c30('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8c30('0x3'),'afterUpdate':_0x8c30('0x4'),'afterDestroy':_0x8c30('0x5')};function emitEvent(_0x1d979a){return function(_0x1a7f82,_0x468559,_0x3ba267){WhatsappAccountEvents[_0x8c30('0x6')](_0x1d979a+':'+_0x1a7f82['id'],_0x1a7f82);WhatsappAccountEvents['emit'](_0x1d979a,_0x1a7f82);_0x3ba267(null);};}for(var e in events){if(events[_0x8c30('0x7')](e)){var event=events[e];WhatsappAccount[_0x8c30('0x8')](e,emitEvent(event));}}module[_0x8c30('0x9')]=WhatsappAccountEvents; \ No newline at end of file +var _0xb342=['exports','WhatsappAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4296b3,_0x58c241){var _0x146ad8=function(_0x2e5079){while(--_0x2e5079){_0x4296b3['push'](_0x4296b3['shift']());}};_0x146ad8(++_0x58c241);}(_0xb342,0x149));var _0x2b34=function(_0x3b6652,_0x32486d){_0x3b6652=_0x3b6652-0x0;var _0x14d39f=_0xb342[_0x3b6652];return _0x14d39f;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require('../../mysqldb')['db'][_0x2b34('0x0')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x2b34('0x1')](0x0);var events={'afterCreate':_0x2b34('0x2'),'afterUpdate':_0x2b34('0x3'),'afterDestroy':_0x2b34('0x4')};function emitEvent(_0x74efcc){return function(_0x43e2be,_0x572ff2,_0x55a537){WhatsappAccountEvents['emit'](_0x74efcc+':'+_0x43e2be['id'],_0x43e2be);WhatsappAccountEvents[_0x2b34('0x5')](_0x74efcc,_0x43e2be);_0x55a537(null);};}for(var e in events){if(events[_0x2b34('0x6')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x2b34('0x7')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index 3363a63..1e9e51f 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 _0xcab3=['../../config/environment','exports','define','WhatsappAccount','whatsapp_accounts','lodash','api','request-promise'];(function(_0x32633e,_0x2a76f7){var _0x4e27c8=function(_0x54bb0d){while(--_0x54bb0d){_0x32633e['push'](_0x32633e['shift']());}};_0x4e27c8(++_0x2a76f7);}(_0xcab3,0x125));var _0x3cab=function(_0x2503fd,_0x193d94){_0x2503fd=_0x2503fd-0x0;var _0x275390=_0xcab3[_0x2503fd];return _0x275390;};'use strict';var _=require(_0x3cab('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3cab('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x3cab('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3cab('0x3'));var attributes=require('./whatsappAccount.attributes');module[_0x3cab('0x4')]=function(_0x26a070,_0x10fcb9){return _0x26a070[_0x3cab('0x5')](_0x3cab('0x6'),attributes,{'tableName':_0x3cab('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xda28=['exports','define','WhatsappAccount','whatsapp_accounts','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappAccount.attributes'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xda28,0xa0));var _0x8da2=function(_0x2d9878,_0x5ae702){_0x2d9878=_0x2d9878-0x0;var _0x28e150=_0xda28[_0x2d9878];return _0x28e150;};'use strict';var _=require(_0x8da2('0x0'));var util=require(_0x8da2('0x1'));var logger=require('../../config/logger')(_0x8da2('0x2'));var moment=require(_0x8da2('0x3'));var BPromise=require('bluebird');var rp=require(_0x8da2('0x4'));var fs=require('fs');var path=require(_0x8da2('0x5'));var rimraf=require(_0x8da2('0x6'));var config=require(_0x8da2('0x7'));var attributes=require(_0x8da2('0x8'));module[_0x8da2('0x9')]=function(_0x559e67,_0x52d368){return _0x559e67[_0x8da2('0xa')](_0x8da2('0xb'),attributes,{'tableName':_0x8da2('0xc'),'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 b2450e8..90305ce 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 _0x98ac=['code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','options','raw','where','attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost','./whatsappAccount.socket','register','request','info','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3df186,_0x12592c){var _0x5440fc=function(_0x2a7a70){while(--_0x2a7a70){_0x3df186['push'](_0x3df186['shift']());}};_0x5440fc(++_0x12592c);}(_0x98ac,0x109));var _0xc98a=function(_0x398f0b,_0x5e7d0b){_0x398f0b=_0x398f0b-0x0;var _0x3e7d69=_0x98ac[_0x398f0b];return _0x3e7d69;};'use strict';var _=require('lodash');var util=require(_0xc98a('0x0'));var moment=require(_0xc98a('0x1'));var BPromise=require(_0xc98a('0x2'));var rs=require(_0xc98a('0x3'));var fs=require('fs');var Redis=require(_0xc98a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc98a('0x5'));var logger=require(_0xc98a('0x6'))(_0xc98a('0x7'));var config=require(_0xc98a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc98a('0x9')][_0xc98a('0xa')]({'port':0x232a});config[_0xc98a('0xb')]=_['defaults'](config[_0xc98a('0xb')],{'host':_0xc98a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc98a('0xb')]));require(_0xc98a('0xd'))[_0xc98a('0xe')](socket);function respondWithRpcPromise(_0x210b45,_0x21d61f,_0x1ca875){return new BPromise(function(_0x5d354e,_0x875544){return client[_0xc98a('0xf')](_0x210b45,_0x1ca875)['then'](function(_0x23ebc1){logger[_0xc98a('0x10')](_0xc98a('0x11'),_0x21d61f,'request\x20sent');logger[_0xc98a('0x12')](_0xc98a('0x13'),_0x21d61f,_0xc98a('0x14'),JSON[_0xc98a('0x15')](_0x23ebc1));if(_0x23ebc1[_0xc98a('0x16')]){if(_0x23ebc1[_0xc98a('0x16')][_0xc98a('0x17')]===0x1f4){logger[_0xc98a('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x21d61f,_0x23ebc1[_0xc98a('0x16')][_0xc98a('0x18')]);return _0x875544(_0x23ebc1[_0xc98a('0x16')][_0xc98a('0x18')]);}logger[_0xc98a('0x16')](_0xc98a('0x11'),_0x21d61f,_0x23ebc1[_0xc98a('0x16')][_0xc98a('0x18')]);return _0x5d354e(_0x23ebc1[_0xc98a('0x16')][_0xc98a('0x18')]);}else{logger['info'](_0xc98a('0x11'),_0x21d61f,_0xc98a('0x14'));_0x5d354e(_0x23ebc1[_0xc98a('0x19')][_0xc98a('0x18')]);}})[_0xc98a('0x1a')](function(_0x3b7380){logger[_0xc98a('0x16')](_0xc98a('0x11'),_0x21d61f,_0x3b7380);_0x875544(_0x3b7380);});});}exports[_0xc98a('0x1b')]=function(_0x4619bc){var _0x17c2c6=this;return new Promise(function(_0x4b5619,_0x33d522){return db[_0xc98a('0x1c')]['find']({'raw':_0x4619bc[_0xc98a('0x1d')]?_0x4619bc[_0xc98a('0x1d')][_0xc98a('0x1e')]===undefined?!![]:![]:!![],'where':_0x4619bc[_0xc98a('0x1d')]?_0x4619bc[_0xc98a('0x1d')][_0xc98a('0x1f')]||null:null,'attributes':_0x4619bc[_0xc98a('0x1d')]?_0x4619bc[_0xc98a('0x1d')][_0xc98a('0x20')]||null:null,'include':_0x4619bc[_0xc98a('0x1d')]?_0x4619bc[_0xc98a('0x1d')][_0xc98a('0x21')]?_[_0xc98a('0x22')](_0x4619bc[_0xc98a('0x1d')]['include'],function(_0x5c9ccf){return{'model':db[_0x5c9ccf['model']],'as':_0x5c9ccf['as'],'attributes':_0x5c9ccf[_0xc98a('0x20')],'include':_0x5c9ccf[_0xc98a('0x21')]?_[_0xc98a('0x22')](_0x5c9ccf[_0xc98a('0x21')],function(_0x17f0c3){return{'model':db[_0x17f0c3[_0xc98a('0x23')]],'as':_0x17f0c3['as'],'attributes':_0x17f0c3[_0xc98a('0x20')],'include':_0x17f0c3[_0xc98a('0x21')]?_[_0xc98a('0x22')](_0x17f0c3[_0xc98a('0x21')],function(_0x2b5c8c){return{'model':db[_0x2b5c8c[_0xc98a('0x23')]],'as':_0x2b5c8c['as'],'attributes':_0x2b5c8c[_0xc98a('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x9a28a8){logger[_0xc98a('0x10')]('ShowWhatsappAccount',_0x4619bc);logger[_0xc98a('0x12')](_0xc98a('0x1b'),_0x4619bc,JSON['stringify'](_0x9a28a8));_0x4b5619(_0x9a28a8);})['catch'](function(_0x45232b){logger[_0xc98a('0x16')]('ShowWhatsappAccount',_0x45232b[_0xc98a('0x18')],_0x4619bc);_0x33d522(_0x17c2c6[_0xc98a('0x16')](0x1f4,_0x45232b[_0xc98a('0x18')]));});});}; \ No newline at end of file +var _0x0f58=['socket.io-emitter','./whatsappAccount.socket','register','then','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','WhatsappAccount,\x20%s,\x20%s','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','attributes','map','include','model','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x533561,_0x23acc8){var _0x5258ed=function(_0x413bcd){while(--_0x413bcd){_0x533561['push'](_0x533561['shift']());}};_0x5258ed(++_0x23acc8);}(_0x0f58,0x164));var _0x80f5=function(_0x331015,_0x22ef37){_0x331015=_0x331015-0x0;var _0x40f12e=_0x0f58[_0x331015];return _0x40f12e;};'use strict';var _=require(_0x80f5('0x0'));var util=require(_0x80f5('0x1'));var moment=require(_0x80f5('0x2'));var BPromise=require(_0x80f5('0x3'));var rs=require(_0x80f5('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x80f5('0x5'))['db'];var utils=require(_0x80f5('0x6'));var logger=require(_0x80f5('0x7'))(_0x80f5('0x8'));var config=require(_0x80f5('0x9'));var jayson=require(_0x80f5('0xa'));var client=jayson[_0x80f5('0xb')][_0x80f5('0xc')]({'port':0x232a});config[_0x80f5('0xd')]=_['defaults'](config[_0x80f5('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x80f5('0xe'))(new Redis(config['redis']));require(_0x80f5('0xf'))[_0x80f5('0x10')](socket);function respondWithRpcPromise(_0x2ce6c4,_0x3da407,_0x1b4521){return new BPromise(function(_0x5e9501,_0x2de5cb){return client['request'](_0x2ce6c4,_0x1b4521)[_0x80f5('0x11')](function(_0x1d5376){logger[_0x80f5('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x3da407,'request\x20sent');logger['debug'](_0x80f5('0x13'),_0x3da407,_0x80f5('0x14'),JSON[_0x80f5('0x15')](_0x1d5376));if(_0x1d5376['error']){if(_0x1d5376[_0x80f5('0x16')]['code']===0x1f4){logger[_0x80f5('0x16')](_0x80f5('0x17'),_0x3da407,_0x1d5376[_0x80f5('0x16')][_0x80f5('0x18')]);return _0x2de5cb(_0x1d5376[_0x80f5('0x16')][_0x80f5('0x18')]);}logger[_0x80f5('0x16')](_0x80f5('0x17'),_0x3da407,_0x1d5376[_0x80f5('0x16')][_0x80f5('0x18')]);return _0x5e9501(_0x1d5376[_0x80f5('0x16')][_0x80f5('0x18')]);}else{logger[_0x80f5('0x12')]('WhatsappAccount,\x20%s,\x20%s',_0x3da407,'request\x20sent');_0x5e9501(_0x1d5376[_0x80f5('0x19')][_0x80f5('0x18')]);}})[_0x80f5('0x1a')](function(_0x4c4822){logger[_0x80f5('0x16')](_0x80f5('0x17'),_0x3da407,_0x4c4822);_0x2de5cb(_0x4c4822);});});}exports[_0x80f5('0x1b')]=function(_0x38ecf0){var _0x176bd0=this;return new Promise(function(_0x1b325b,_0x3df93d){return db[_0x80f5('0x1c')][_0x80f5('0x1d')]({'raw':_0x38ecf0[_0x80f5('0x1e')]?_0x38ecf0[_0x80f5('0x1e')][_0x80f5('0x1f')]===undefined?!![]:![]:!![],'where':_0x38ecf0['options']?_0x38ecf0[_0x80f5('0x1e')]['where']||null:null,'attributes':_0x38ecf0['options']?_0x38ecf0[_0x80f5('0x1e')][_0x80f5('0x20')]||null:null,'include':_0x38ecf0[_0x80f5('0x1e')]?_0x38ecf0[_0x80f5('0x1e')]['include']?_[_0x80f5('0x21')](_0x38ecf0[_0x80f5('0x1e')][_0x80f5('0x22')],function(_0xdfb7ad){return{'model':db[_0xdfb7ad[_0x80f5('0x23')]],'as':_0xdfb7ad['as'],'attributes':_0xdfb7ad[_0x80f5('0x20')],'include':_0xdfb7ad[_0x80f5('0x22')]?_[_0x80f5('0x21')](_0xdfb7ad['include'],function(_0x463184){return{'model':db[_0x463184[_0x80f5('0x23')]],'as':_0x463184['as'],'attributes':_0x463184[_0x80f5('0x20')],'include':_0x463184[_0x80f5('0x22')]?_[_0x80f5('0x21')](_0x463184[_0x80f5('0x22')],function(_0x4207f9){return{'model':db[_0x4207f9[_0x80f5('0x23')]],'as':_0x4207f9['as'],'attributes':_0x4207f9['attributes']};}):[]};}):[]};}):[]:[]})[_0x80f5('0x11')](function(_0x2e9ca6){logger['info']('ShowWhatsappAccount',_0x38ecf0);logger[_0x80f5('0x24')](_0x80f5('0x1b'),_0x38ecf0,JSON[_0x80f5('0x15')](_0x2e9ca6));_0x1b325b(_0x2e9ca6);})[_0x80f5('0x1a')](function(_0x5edac4){logger[_0x80f5('0x16')](_0x80f5('0x1b'),_0x5edac4[_0x80f5('0x18')],_0x38ecf0);_0x3df93d(_0x176bd0[_0x80f5('0x16')](0x1f4,_0x5edac4[_0x80f5('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 8f2e184..98eeddb 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 _0x2c0e=['whatsappAccount:','./whatsappAccount.events','remove','update','emit','register','length'];(function(_0xf965b2,_0x465120){var _0x5ca458=function(_0x4d3085){while(--_0x4d3085){_0xf965b2['push'](_0xf965b2['shift']());}};_0x5ca458(++_0x465120);}(_0x2c0e,0x1eb));var _0xe2c0=function(_0x3513a0,_0x3bdc88){_0x3513a0=_0x3513a0-0x0;var _0x2bdeb9=_0x2c0e[_0x3513a0];return _0x2bdeb9;};'use strict';var WhatsappAccountEvents=require(_0xe2c0('0x0'));var events=['save',_0xe2c0('0x1'),_0xe2c0('0x2')];function createListener(_0x4d3225,_0x2e6a9a){return function(_0x41679a){_0x2e6a9a[_0xe2c0('0x3')](_0x4d3225,_0x41679a);};}function removeListener(_0x558b2a,_0x5a0e80){return function(){WhatsappAccountEvents['removeListener'](_0x558b2a,_0x5a0e80);};}exports[_0xe2c0('0x4')]=function(_0x1aac3b){for(var _0x98b462=0x0,_0x3e4124=events[_0xe2c0('0x5')];_0x98b462<_0x3e4124;_0x98b462++){var _0x15b51d=events[_0x98b462];var _0x100291=createListener(_0xe2c0('0x6')+_0x15b51d,_0x1aac3b);WhatsappAccountEvents['on'](_0x15b51d,_0x100291);}}; \ No newline at end of file +var _0x1ec1=['update','emit','removeListener','length','whatsappAccount:','save','remove'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x1ec1,0x1ef));var _0x11ec=function(_0x2fdf7e,_0x11cf9a){_0x2fdf7e=_0x2fdf7e-0x0;var _0x5d8363=_0x1ec1[_0x2fdf7e];return _0x5d8363;};'use strict';var WhatsappAccountEvents=require('./whatsappAccount.events');var events=[_0x11ec('0x0'),_0x11ec('0x1'),_0x11ec('0x2')];function createListener(_0x540762,_0x10cb5d){return function(_0x584eb3){_0x10cb5d[_0x11ec('0x3')](_0x540762,_0x584eb3);};}function removeListener(_0x50df98,_0xa430e5){return function(){WhatsappAccountEvents[_0x11ec('0x4')](_0x50df98,_0xa430e5);};}exports['register']=function(_0x200091){for(var _0x2473db=0x0,_0x411623=events[_0x11ec('0x5')];_0x2473db<_0x411623;_0x2473db++){var _0x1b4de6=events[_0x2473db];var _0x213fd3=createListener(_0x11ec('0x6')+_0x1b4de6,_0x200091);WhatsappAccountEvents['on'](_0x1b4de6,_0x213fd3);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index 29e9c09..737f688 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 _0x14fc=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get','/:id','show','post','put','update','delete','destroy','multer'];(function(_0x432ac2,_0x238b44){var _0x5a17cf=function(_0x4e9e1a){while(--_0x4e9e1a){_0x432ac2['push'](_0x432ac2['shift']());}};_0x5a17cf(++_0x238b44);}(_0x14fc,0x84));var _0xc14f=function(_0x47fd17,_0x4f7037){_0x47fd17=_0x47fd17-0x0;var _0x353a4b=_0x14fc[_0x47fd17];return _0x353a4b;};'use strict';var multer=require(_0xc14f('0x0'));var util=require(_0xc14f('0x1'));var path=require(_0xc14f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc14f('0x3')]();var fs_extra=require(_0xc14f('0x4'));var auth=require(_0xc14f('0x5'));var interaction=require(_0xc14f('0x6'));var config=require(_0xc14f('0x7'));var controller=require(_0xc14f('0x8'));router['get']('/',auth[_0xc14f('0x9')](),controller[_0xc14f('0xa')]);router[_0xc14f('0xb')](_0xc14f('0xc'),auth[_0xc14f('0x9')](),controller[_0xc14f('0xd')]);router[_0xc14f('0xe')]('/',auth[_0xc14f('0x9')](),controller['create']);router[_0xc14f('0xf')](_0xc14f('0xc'),auth[_0xc14f('0x9')](),controller[_0xc14f('0x10')]);router[_0xc14f('0x11')](_0xc14f('0xc'),auth[_0xc14f('0x9')](),controller[_0xc14f('0x12')]);module['exports']=router; \ No newline at end of file +var _0xf017=['../../components/interaction/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','express','Router','fs-extra','../../components/auth/service'];(function(_0x3dbd00,_0x17cb39){var _0x2b9852=function(_0x2c540a){while(--_0x2c540a){_0x3dbd00['push'](_0x3dbd00['shift']());}};_0x2b9852(++_0x17cb39);}(_0xf017,0x119));var _0x7f01=function(_0x3031dc,_0x3c2dab){_0x3031dc=_0x3031dc-0x0;var _0x5e5b07=_0xf017[_0x3031dc];return _0x5e5b07;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7f01('0x0'));var router=express[_0x7f01('0x1')]();var fs_extra=require(_0x7f01('0x2'));var auth=require(_0x7f01('0x3'));var interaction=require(_0x7f01('0x4'));var config=require(_0x7f01('0x5'));var controller=require(_0x7f01('0x6'));router[_0x7f01('0x7')]('/',auth[_0x7f01('0x8')](),controller[_0x7f01('0x9')]);router[_0x7f01('0x7')](_0x7f01('0xa'),auth[_0x7f01('0x8')](),controller[_0x7f01('0xb')]);router[_0x7f01('0xc')]('/',auth[_0x7f01('0x8')](),controller[_0x7f01('0xd')]);router[_0x7f01('0xe')](_0x7f01('0xa'),auth[_0x7f01('0x8')](),controller[_0x7f01('0xf')]);router[_0x7f01('0x10')](_0x7f01('0xa'),auth[_0x7f01('0x8')](),controller[_0x7f01('0x11')]);module[_0x7f01('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 49c3f84..b0e79c8 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 _0x8bdf=['exports','STRING','noop','*,*,*,*','sequelize'];(function(_0x1c67ba,_0x52e86b){var _0x203f25=function(_0x14867e){while(--_0x14867e){_0x1c67ba['push'](_0x1c67ba['shift']());}};_0x203f25(++_0x52e86b);}(_0x8bdf,0xae));var _0xf8bd=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x8bdf[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0xf8bd('0x0'));module[_0xf8bd('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xf8bd('0x2')],'allowNull':![],'defaultValue':_0xf8bd('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xf8bd('0x2')],'defaultValue':_0xf8bd('0x4')}}; \ No newline at end of file +var _0x4e41=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0xa3c06b,_0x490f99){var _0x33aa1d=function(_0x23a88e){while(--_0x23a88e){_0xa3c06b['push'](_0xa3c06b['shift']());}};_0x33aa1d(++_0x490f99);}(_0x4e41,0xa4));var _0x14e4=function(_0x22d71a,_0x14c948){_0x22d71a=_0x22d71a-0x0;var _0x3ddcea=_0x4e41[_0x22d71a];return _0x3ddcea;};'use strict';var Sequelize=require(_0x14e4('0x0'));module[_0x14e4('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x14e4('0x2')],'allowNull':![],'defaultValue':_0x14e4('0x3')},'appdata':{'type':Sequelize[_0x14e4('0x4')]()},'description':{'type':Sequelize[_0x14e4('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x14e4('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index 9199687..01cf699 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 _0xb8cb=['lodash','crypto','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','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','then','destroy','error','name','index','map','WhatsappApplication','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','fs-extra'];(function(_0xb7373d,_0x1b8704){var _0x474f7e=function(_0x46ddf7){while(--_0x46ddf7){_0xb7373d['push'](_0xb7373d['shift']());}};_0x474f7e(++_0x1b8704);}(_0xb8cb,0xd9));var _0xbb8c=function(_0x575302,_0x8628a2){_0x575302=_0x575302-0x0;var _0x231ec8=_0xb8cb[_0x575302];return _0x231ec8;};'use strict';var emlformat=require(_0xbb8c('0x0'));var rimraf=require(_0xbb8c('0x1'));var zipdir=require(_0xbb8c('0x2'));var jsonpatch=require(_0xbb8c('0x3'));var rp=require(_0xbb8c('0x4'));var moment=require(_0xbb8c('0x5'));var BPromise=require(_0xbb8c('0x6'));var Mustache=require('mustache');var util=require(_0xbb8c('0x7'));var path=require(_0xbb8c('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbb8c('0x9'));var fs=require('fs');var fs_extra=require(_0xbb8c('0xa'));var _=require(_0xbb8c('0xb'));var squel=require('squel');var crypto=require(_0xbb8c('0xc'));var jsforce=require(_0xbb8c('0xd'));var deskjs=require(_0xbb8c('0xe'));var toCsv=require(_0xbb8c('0xf'));var querystring=require(_0xbb8c('0x10'));var Papa=require(_0xbb8c('0x11'));var Redis=require(_0xbb8c('0x12'));var authService=require(_0xbb8c('0x13'));var qs=require(_0xbb8c('0x14'));var as=require(_0xbb8c('0x15'));var hardwareService=require(_0xbb8c('0x16'));var logger=require(_0xbb8c('0x17'))('api');var utils=require(_0xbb8c('0x18'));var config=require(_0xbb8c('0x19'));var licenseUtil=require(_0xbb8c('0x1a'));var db=require(_0xbb8c('0x1b'))['db'];function respondWithStatusCode(_0x3ac367,_0x57e624){_0x57e624=_0x57e624||0xcc;return function(_0x275252){if(_0x275252){return _0x3ac367[_0xbb8c('0x1c')](_0x57e624);}return _0x3ac367[_0xbb8c('0x1d')](_0x57e624)[_0xbb8c('0x1e')]();};}function respondWithResult(_0x3a0fe2,_0x151bf2){_0x151bf2=_0x151bf2||0xc8;return function(_0x1de932){if(_0x1de932){return _0x3a0fe2['status'](_0x151bf2)[_0xbb8c('0x1f')](_0x1de932);}};}function respondWithFilteredResult(_0x1e6dc9,_0x425891){return function(_0x403710){if(_0x403710){var _0x2cc079=typeof _0x425891[_0xbb8c('0x20')]===_0xbb8c('0x21')&&typeof _0x425891[_0xbb8c('0x22')]===_0xbb8c('0x21');var _0x187ee5=_0x403710['count'];var _0x67712e=_0x2cc079?0x0:_0x425891[_0xbb8c('0x20')];var _0x2a02c9=_0x2cc079?_0x403710[_0xbb8c('0x23')]:_0x425891[_0xbb8c('0x20')]+_0x425891[_0xbb8c('0x22')];var _0x520ea9;if(_0x2a02c9>=_0x187ee5){_0x2a02c9=_0x187ee5;_0x520ea9=0xc8;}else{_0x520ea9=0xce;}_0x1e6dc9[_0xbb8c('0x1d')](_0x520ea9);return _0x1e6dc9[_0xbb8c('0x24')]('Content-Range',_0x67712e+'-'+_0x2a02c9+'/'+_0x187ee5)[_0xbb8c('0x1f')](_0x403710);}return null;};}function patchUpdates(_0x5e2803){return function(_0x44a56e){try{jsonpatch['apply'](_0x44a56e,_0x5e2803,!![]);}catch(_0x32b961){return BPromise[_0xbb8c('0x25')](_0x32b961);}return _0x44a56e[_0xbb8c('0x26')]();};}function saveUpdates(_0x546215,_0x4b4100){return function(_0x10f265){if(_0x10f265){return _0x10f265['update'](_0x546215)[_0xbb8c('0x27')](function(_0x1b764d){return _0x1b764d;});}return null;};}function removeEntity(_0x36163c,_0xec7fb5){return function(_0x362a2f){if(_0x362a2f){return _0x362a2f[_0xbb8c('0x28')]()[_0xbb8c('0x27')](function(){_0x36163c['status'](0xcc)[_0xbb8c('0x1e')]();});}};}function handleEntityNotFound(_0x5f4f96,_0x4a5684){return function(_0xe7475d){if(!_0xe7475d){_0x5f4f96['sendStatus'](0x194);}return _0xe7475d;};}function handleError(_0x47fb37,_0x26ea5f){_0x26ea5f=_0x26ea5f||0x1f4;return function(_0x283ec3){logger[_0xbb8c('0x29')](_0x283ec3['stack']);if(_0x283ec3['name']){delete _0x283ec3[_0xbb8c('0x2a')];}_0x47fb37[_0xbb8c('0x1d')](_0x26ea5f)['send'](_0x283ec3);};}exports[_0xbb8c('0x2b')]=function(_0x23bf3d,_0x292f11){var _0x4f0f13={},_0x271ad7={},_0x1e0e3={'count':0x0,'rows':[]};var _0x219976=_[_0xbb8c('0x2c')](db[_0xbb8c('0x2d')][_0xbb8c('0x2e')],function(_0x2f3db6){return{'name':_0x2f3db6[_0xbb8c('0x2f')],'type':_0x2f3db6[_0xbb8c('0x30')][_0xbb8c('0x31')]};});_0x271ad7['model']=_['map'](_0x219976,_0xbb8c('0x2a'));_0x271ad7[_0xbb8c('0x32')]=_[_0xbb8c('0x33')](_0x23bf3d[_0xbb8c('0x32')]);_0x271ad7[_0xbb8c('0x34')]=_['intersection'](_0x271ad7[_0xbb8c('0x35')],_0x271ad7[_0xbb8c('0x32')]);_0x4f0f13[_0xbb8c('0x36')]=_[_0xbb8c('0x37')](_0x271ad7[_0xbb8c('0x35')],qs[_0xbb8c('0x38')](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x38')]));_0x4f0f13[_0xbb8c('0x36')]=_0x4f0f13['attributes'][_0xbb8c('0x39')]?_0x4f0f13[_0xbb8c('0x36')]:_0x271ad7[_0xbb8c('0x35')];if(!_0x23bf3d['query']['hasOwnProperty'](_0xbb8c('0x3a'))){_0x4f0f13[_0xbb8c('0x22')]=qs[_0xbb8c('0x22')](_0x23bf3d[_0xbb8c('0x32')]['limit']);_0x4f0f13[_0xbb8c('0x20')]=qs[_0xbb8c('0x20')](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x20')]);}_0x4f0f13[_0xbb8c('0x3b')]=qs['sort'](_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3c')]);_0x4f0f13[_0xbb8c('0x3d')]=qs[_0xbb8c('0x34')](_['pick'](_0x23bf3d[_0xbb8c('0x32')],_0x271ad7[_0xbb8c('0x34')]),_0x219976);if(_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3e')]){_0x4f0f13[_0xbb8c('0x3d')]=_[_0xbb8c('0x3f')](_0x4f0f13[_0xbb8c('0x3d')],{'$or':_[_0xbb8c('0x2c')](_0x219976,function(_0x423bba){if(_0x423bba[_0xbb8c('0x30')]!==_0xbb8c('0x40')){var _0x1f4d03={};_0x1f4d03[_0x423bba['name']]={'$like':'%'+_0x23bf3d[_0xbb8c('0x32')][_0xbb8c('0x3e')]+'%'};return _0x1f4d03;}})});}_0x4f0f13=_[_0xbb8c('0x3f')]({},_0x4f0f13,_0x23bf3d[_0xbb8c('0x41')]);var _0x55a698={'where':_0x4f0f13[_0xbb8c('0x3d')]};return db['WhatsappApplication']['count'](_0x55a698)[_0xbb8c('0x27')](function(_0x1c5197){_0x1e0e3[_0xbb8c('0x23')]=_0x1c5197;if(_0x23bf3d['query'][_0xbb8c('0x42')]){_0x4f0f13[_0xbb8c('0x43')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xbb8c('0x44')](_0x4f0f13);})[_0xbb8c('0x27')](function(_0x3b8311){_0x1e0e3[_0xbb8c('0x45')]=_0x3b8311;return _0x1e0e3;})['then'](respondWithFilteredResult(_0x292f11,_0x4f0f13))[_0xbb8c('0x46')](handleError(_0x292f11,null));};exports[_0xbb8c('0x47')]=function(_0x17ffa5,_0x5b662e){var _0xa601d5={'raw':!![],'where':{'id':_0x17ffa5['params']['id']}},_0xff11d5={};_0xff11d5['model']=_[_0xbb8c('0x33')](db[_0xbb8c('0x2d')]['rawAttributes']);_0xff11d5['query']=_[_0xbb8c('0x33')](_0x17ffa5['query']);_0xff11d5[_0xbb8c('0x34')]=_['intersection'](_0xff11d5[_0xbb8c('0x35')],_0xff11d5['query']);_0xa601d5[_0xbb8c('0x36')]=_[_0xbb8c('0x37')](_0xff11d5[_0xbb8c('0x35')],qs[_0xbb8c('0x38')](_0x17ffa5[_0xbb8c('0x32')][_0xbb8c('0x38')]));_0xa601d5['attributes']=_0xa601d5[_0xbb8c('0x36')]['length']?_0xa601d5[_0xbb8c('0x36')]:_0xff11d5[_0xbb8c('0x35')];if(_0x17ffa5[_0xbb8c('0x32')][_0xbb8c('0x42')]){_0xa601d5[_0xbb8c('0x43')]=[{'all':!![]}];}_0xa601d5=_[_0xbb8c('0x3f')]({},_0xa601d5,_0x17ffa5['options']);return db['WhatsappApplication'][_0xbb8c('0x48')](_0xa601d5)[_0xbb8c('0x27')](handleEntityNotFound(_0x5b662e,null))['then'](respondWithResult(_0x5b662e,null))[_0xbb8c('0x46')](handleError(_0x5b662e,null));};exports[_0xbb8c('0x49')]=function(_0x3f0a8b,_0x599e51){return db[_0xbb8c('0x2d')]['create'](_0x3f0a8b[_0xbb8c('0x4a')],{})[_0xbb8c('0x27')](respondWithResult(_0x599e51,0xc9))[_0xbb8c('0x46')](handleError(_0x599e51,null));};exports['update']=function(_0x1953f7,_0x295bb0){if(_0x1953f7[_0xbb8c('0x4a')]['id']){delete _0x1953f7[_0xbb8c('0x4a')]['id'];}return db[_0xbb8c('0x2d')][_0xbb8c('0x48')]({'where':{'id':_0x1953f7[_0xbb8c('0x4b')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x295bb0,null))[_0xbb8c('0x27')](saveUpdates(_0x1953f7[_0xbb8c('0x4a')],null))['then'](respondWithResult(_0x295bb0,null))[_0xbb8c('0x46')](handleError(_0x295bb0,null));};exports[_0xbb8c('0x28')]=function(_0x4400c7,_0x5c3373){return db[_0xbb8c('0x2d')][_0xbb8c('0x48')]({'where':{'id':_0x4400c7[_0xbb8c('0x4b')]['id']}})[_0xbb8c('0x27')](handleEntityNotFound(_0x5c3373,null))[_0xbb8c('0x27')](removeEntity(_0x5c3373,null))[_0xbb8c('0x46')](handleError(_0x5c3373,null));}; \ No newline at end of file +var _0x6d11=['lodash','squel','crypto','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','apply','reject','then','destroy','stack','name','send','index','map','WhatsappApplication','rawAttributes','key','model','query','keys','filters','intersection','attributes','length','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','show','params','fields','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra'];(function(_0x110305,_0x9907dc){var _0x27d8b4=function(_0x4bf26a){while(--_0x4bf26a){_0x110305['push'](_0x110305['shift']());}};_0x27d8b4(++_0x9907dc);}(_0x6d11,0xbf));var _0x16d1=function(_0x80e6b6,_0x480dc8){_0x80e6b6=_0x80e6b6-0x0;var _0x402f71=_0x6d11[_0x80e6b6];return _0x402f71;};'use strict';var emlformat=require(_0x16d1('0x0'));var rimraf=require(_0x16d1('0x1'));var zipdir=require(_0x16d1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x16d1('0x3'));var moment=require('moment');var BPromise=require(_0x16d1('0x4'));var Mustache=require(_0x16d1('0x5'));var util=require('util');var path=require('path');var sox=require(_0x16d1('0x6'));var csv=require(_0x16d1('0x7'));var ejs=require(_0x16d1('0x8'));var fs=require('fs');var fs_extra=require(_0x16d1('0x9'));var _=require(_0x16d1('0xa'));var squel=require(_0x16d1('0xb'));var crypto=require(_0x16d1('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x16d1('0xd'));var Papa=require(_0x16d1('0xe'));var Redis=require(_0x16d1('0xf'));var authService=require(_0x16d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x16d1('0x11'));var hardwareService=require(_0x16d1('0x12'));var logger=require(_0x16d1('0x13'))(_0x16d1('0x14'));var utils=require(_0x16d1('0x15'));var config=require(_0x16d1('0x16'));var licenseUtil=require(_0x16d1('0x17'));var db=require(_0x16d1('0x18'))['db'];function respondWithStatusCode(_0x4de260,_0x32fa68){_0x32fa68=_0x32fa68||0xcc;return function(_0x2e71fa){if(_0x2e71fa){return _0x4de260[_0x16d1('0x19')](_0x32fa68);}return _0x4de260[_0x16d1('0x1a')](_0x32fa68)[_0x16d1('0x1b')]();};}function respondWithResult(_0x5a1429,_0xc034b7){_0xc034b7=_0xc034b7||0xc8;return function(_0x1b71d3){if(_0x1b71d3){return _0x5a1429[_0x16d1('0x1a')](_0xc034b7)[_0x16d1('0x1c')](_0x1b71d3);}};}function respondWithFilteredResult(_0x29ebba,_0x173e16){return function(_0x2d7e8a){if(_0x2d7e8a){var _0x4ee46c=typeof _0x173e16[_0x16d1('0x1d')]===_0x16d1('0x1e')&&typeof _0x173e16['limit']==='undefined';var _0x1a9ec8=_0x2d7e8a['count'];var _0x46a25e=_0x4ee46c?0x0:_0x173e16['offset'];var _0x1da1b8=_0x4ee46c?_0x2d7e8a['count']:_0x173e16[_0x16d1('0x1d')]+_0x173e16[_0x16d1('0x1f')];var _0x48cd70;if(_0x1da1b8>=_0x1a9ec8){_0x1da1b8=_0x1a9ec8;_0x48cd70=0xc8;}else{_0x48cd70=0xce;}_0x29ebba['status'](_0x48cd70);return _0x29ebba['set']('Content-Range',_0x46a25e+'-'+_0x1da1b8+'/'+_0x1a9ec8)[_0x16d1('0x1c')](_0x2d7e8a);}return null;};}function patchUpdates(_0x55a0e0){return function(_0x34b88f){try{jsonpatch[_0x16d1('0x20')](_0x34b88f,_0x55a0e0,!![]);}catch(_0x1f6add){return BPromise[_0x16d1('0x21')](_0x1f6add);}return _0x34b88f['save']();};}function saveUpdates(_0x2c7825,_0x58a03b){return function(_0x2a897d){if(_0x2a897d){return _0x2a897d['update'](_0x2c7825)[_0x16d1('0x22')](function(_0x8c7266){return _0x8c7266;});}return null;};}function removeEntity(_0x17e038,_0x47cad4){return function(_0x215c23){if(_0x215c23){return _0x215c23[_0x16d1('0x23')]()[_0x16d1('0x22')](function(){_0x17e038[_0x16d1('0x1a')](0xcc)[_0x16d1('0x1b')]();});}};}function handleEntityNotFound(_0x335c24,_0x4b2b5c){return function(_0x15203b){if(!_0x15203b){_0x335c24[_0x16d1('0x19')](0x194);}return _0x15203b;};}function handleError(_0x262f89,_0x346b69){_0x346b69=_0x346b69||0x1f4;return function(_0x2b8403){logger['error'](_0x2b8403[_0x16d1('0x24')]);if(_0x2b8403[_0x16d1('0x25')]){delete _0x2b8403[_0x16d1('0x25')];}_0x262f89['status'](_0x346b69)[_0x16d1('0x26')](_0x2b8403);};}exports[_0x16d1('0x27')]=function(_0x364bf7,_0x22e5b3){var _0x6396fc={},_0x462e5b={},_0x1dd574={'count':0x0,'rows':[]};var _0x562908=_[_0x16d1('0x28')](db[_0x16d1('0x29')][_0x16d1('0x2a')],function(_0x30cd8f){return{'name':_0x30cd8f['fieldName'],'type':_0x30cd8f['type'][_0x16d1('0x2b')]};});_0x462e5b[_0x16d1('0x2c')]=_[_0x16d1('0x28')](_0x562908,_0x16d1('0x25'));_0x462e5b[_0x16d1('0x2d')]=_[_0x16d1('0x2e')](_0x364bf7[_0x16d1('0x2d')]);_0x462e5b[_0x16d1('0x2f')]=_[_0x16d1('0x30')](_0x462e5b[_0x16d1('0x2c')],_0x462e5b[_0x16d1('0x2d')]);_0x6396fc[_0x16d1('0x31')]=_[_0x16d1('0x30')](_0x462e5b[_0x16d1('0x2c')],qs['fields'](_0x364bf7[_0x16d1('0x2d')]['fields']));_0x6396fc[_0x16d1('0x31')]=_0x6396fc[_0x16d1('0x31')][_0x16d1('0x32')]?_0x6396fc[_0x16d1('0x31')]:_0x462e5b[_0x16d1('0x2c')];if(!_0x364bf7[_0x16d1('0x2d')]['hasOwnProperty']('nolimit')){_0x6396fc['limit']=qs[_0x16d1('0x1f')](_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x1f')]);_0x6396fc[_0x16d1('0x1d')]=qs['offset'](_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x1d')]);}_0x6396fc['order']=qs['sort'](_0x364bf7['query'][_0x16d1('0x33')]);_0x6396fc[_0x16d1('0x34')]=qs[_0x16d1('0x2f')](_['pick'](_0x364bf7[_0x16d1('0x2d')],_0x462e5b[_0x16d1('0x2f')]),_0x562908);if(_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x35')]){_0x6396fc[_0x16d1('0x34')]=_[_0x16d1('0x36')](_0x6396fc[_0x16d1('0x34')],{'$or':_['map'](_0x562908,function(_0x50267b){if(_0x50267b['type']!==_0x16d1('0x37')){var _0x2306d3={};_0x2306d3[_0x50267b[_0x16d1('0x25')]]={'$like':'%'+_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x35')]+'%'};return _0x2306d3;}})});}_0x6396fc=_[_0x16d1('0x36')]({},_0x6396fc,_0x364bf7[_0x16d1('0x38')]);var _0x369b1c={'where':_0x6396fc['where']};return db[_0x16d1('0x29')]['count'](_0x369b1c)['then'](function(_0x352c5b){_0x1dd574[_0x16d1('0x39')]=_0x352c5b;if(_0x364bf7[_0x16d1('0x2d')][_0x16d1('0x3a')]){_0x6396fc[_0x16d1('0x3b')]=[{'all':!![]}];}return db[_0x16d1('0x29')]['findAll'](_0x6396fc);})[_0x16d1('0x22')](function(_0x525212){_0x1dd574['rows']=_0x525212;return _0x1dd574;})['then'](respondWithFilteredResult(_0x22e5b3,_0x6396fc))['catch'](handleError(_0x22e5b3,null));};exports[_0x16d1('0x3c')]=function(_0x168e14,_0x24038b){var _0x1eb761={'raw':!![],'where':{'id':_0x168e14[_0x16d1('0x3d')]['id']}},_0x53de06={};_0x53de06['model']=_[_0x16d1('0x2e')](db[_0x16d1('0x29')][_0x16d1('0x2a')]);_0x53de06[_0x16d1('0x2d')]=_[_0x16d1('0x2e')](_0x168e14[_0x16d1('0x2d')]);_0x53de06[_0x16d1('0x2f')]=_[_0x16d1('0x30')](_0x53de06[_0x16d1('0x2c')],_0x53de06[_0x16d1('0x2d')]);_0x1eb761[_0x16d1('0x31')]=_[_0x16d1('0x30')](_0x53de06[_0x16d1('0x2c')],qs[_0x16d1('0x3e')](_0x168e14[_0x16d1('0x2d')]['fields']));_0x1eb761['attributes']=_0x1eb761[_0x16d1('0x31')][_0x16d1('0x32')]?_0x1eb761[_0x16d1('0x31')]:_0x53de06[_0x16d1('0x2c')];if(_0x168e14[_0x16d1('0x2d')][_0x16d1('0x3a')]){_0x1eb761['include']=[{'all':!![]}];}_0x1eb761=_[_0x16d1('0x36')]({},_0x1eb761,_0x168e14[_0x16d1('0x38')]);return db[_0x16d1('0x29')]['find'](_0x1eb761)['then'](handleEntityNotFound(_0x24038b,null))[_0x16d1('0x22')](respondWithResult(_0x24038b,null))[_0x16d1('0x3f')](handleError(_0x24038b,null));};exports['create']=function(_0x1cc137,_0x583151){return db[_0x16d1('0x29')][_0x16d1('0x40')](_0x1cc137[_0x16d1('0x41')],{})[_0x16d1('0x22')](respondWithResult(_0x583151,0xc9))['catch'](handleError(_0x583151,null));};exports['update']=function(_0x1d92cd,_0x8bb0c1){if(_0x1d92cd['body']['id']){delete _0x1d92cd[_0x16d1('0x41')]['id'];}return db[_0x16d1('0x29')][_0x16d1('0x42')]({'where':{'id':_0x1d92cd[_0x16d1('0x3d')]['id']}})[_0x16d1('0x22')](handleEntityNotFound(_0x8bb0c1,null))['then'](saveUpdates(_0x1d92cd[_0x16d1('0x41')],null))['then'](respondWithResult(_0x8bb0c1,null))[_0x16d1('0x3f')](handleError(_0x8bb0c1,null));};exports[_0x16d1('0x23')]=function(_0x5d384c,_0x413acd){return db[_0x16d1('0x29')][_0x16d1('0x42')]({'where':{'id':_0x5d384c[_0x16d1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x413acd,null))['then'](removeEntity(_0x413acd,null))['catch'](handleError(_0x413acd,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index f3a1a4b..127f3a3 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 _0x423b=['utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','../../config/environment','./whatsappApplication.attributes','define','WhatsappApplication'];(function(_0x43ce1b,_0x155d2f){var _0x2d758e=function(_0x1f1193){while(--_0x1f1193){_0x43ce1b['push'](_0x43ce1b['shift']());}};_0x2d758e(++_0x155d2f);}(_0x423b,0x12b));var _0xb423=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0x423b[_0x11ce46];return _0x368a1e;};'use strict';var _=require('lodash');var util=require(_0xb423('0x0'));var logger=require('../../config/logger')(_0xb423('0x1'));var moment=require('moment');var BPromise=require(_0xb423('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb423('0x3'));var attributes=require(_0xb423('0x4'));module['exports']=function(_0x1be92e,_0x3e6b18){return _0x1be92e[_0xb423('0x5')](_0xb423('0x6'),attributes,{'tableName':'whatsapp_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb423('0x7'),'collate':_0xb423('0x8')});}; \ No newline at end of file +var _0x8b7c=['path','../../config/environment','./whatsappApplication.attributes','exports','define','WhatsappApplication','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x40ac5e,_0x2de228){var _0x2839d6=function(_0x123d47){while(--_0x123d47){_0x40ac5e['push'](_0x40ac5e['shift']());}};_0x2839d6(++_0x2de228);}(_0x8b7c,0x119));var _0xc8b7=function(_0x24b852,_0x2bad67){_0x24b852=_0x24b852-0x0;var _0x180ad2=_0x8b7c[_0x24b852];return _0x180ad2;};'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':!![],'charset':_0xc8b7('0xe'),'collate':_0xc8b7('0xf')});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index df7f697..7a85c64 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 _0x207c=['message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','request','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','error'];(function(_0x312e79,_0x22669a){var _0x2a52b0=function(_0x4b5efa){while(--_0x4b5efa){_0x312e79['push'](_0x312e79['shift']());}};_0x2a52b0(++_0x22669a);}(_0x207c,0x1e8));var _0xc207=function(_0x236e77,_0x388743){_0x236e77=_0x236e77-0x0;var _0x59e31f=_0x207c[_0x236e77];return _0x59e31f;};'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});function respondWithRpcPromise(_0x314561,_0x3395e4,_0x59ff6f){return new BPromise(function(_0x25cb97,_0xad159b){return client[_0xc207('0x9')](_0x314561,_0x59ff6f)['then'](function(_0xffae6c){logger[_0xc207('0xa')](_0xc207('0xb'),_0x3395e4,_0xc207('0xc'));logger[_0xc207('0xd')](_0xc207('0xe'),_0x3395e4,'request\x20sent',JSON['stringify'](_0xffae6c));if(_0xffae6c['error']){if(_0xffae6c[_0xc207('0xf')]['code']===0x1f4){logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0xad159b(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}logger[_0xc207('0xf')](_0xc207('0xb'),_0x3395e4,_0xffae6c['error'][_0xc207('0x10')]);return _0x25cb97(_0xffae6c[_0xc207('0xf')][_0xc207('0x10')]);}else{logger[_0xc207('0xa')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,'request\x20sent');_0x25cb97(_0xffae6c['result'][_0xc207('0x10')]);}})[_0xc207('0x11')](function(_0x3d9c7b){logger[_0xc207('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0x3395e4,_0x3d9c7b);_0xad159b(_0x3d9c7b);});});} \ No newline at end of file +var _0x84ab=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x554707,_0x9623b4){var _0x9960af=function(_0x41b914){while(--_0x41b914){_0x554707['push'](_0x554707['shift']());}};_0x9960af(++_0x9623b4);}(_0x84ab,0x12f));var _0xb84a=function(_0x246148,_0x1358ee){_0x246148=_0x246148-0x0;var _0x453d94=_0x84ab[_0x246148];return _0x453d94;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var moment=require(_0xb84a('0x2'));var BPromise=require(_0xb84a('0x3'));var rs=require(_0xb84a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb84a('0x5'))['db'];var utils=require(_0xb84a('0x6'));var logger=require('../../config/logger')(_0xb84a('0x7'));var config=require(_0xb84a('0x8'));var jayson=require(_0xb84a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4dc496,_0xd445b5,_0x4fac4d){return new BPromise(function(_0x3e9086,_0x8d9dbe){return client['request'](_0x4dc496,_0x4fac4d)[_0xb84a('0xa')](function(_0x525cb7){logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,_0xb84a('0xd'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0xd445b5,'request\x20sent',JSON[_0xb84a('0xe')](_0x525cb7));if(_0x525cb7[_0xb84a('0xf')]){if(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x10')]===0x1f4){logger[_0xb84a('0xf')]('WhatsappApplication,\x20%s,\x20%s',_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x8d9dbe(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);return _0x3e9086(_0x525cb7[_0xb84a('0xf')][_0xb84a('0x11')]);}else{logger[_0xb84a('0xb')](_0xb84a('0xc'),_0xd445b5,'request\x20sent');_0x3e9086(_0x525cb7[_0xb84a('0x12')][_0xb84a('0x11')]);}})[_0xb84a('0x13')](function(_0x3c0b54){logger[_0xb84a('0xf')](_0xb84a('0xc'),_0xd445b5,_0x3c0b54);_0x8d9dbe(_0x3c0b54);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 78ea1a5..784ba36 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 _0x9fe7=['download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','whatsappinteraction:update','update','delete','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappInteraction.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/messages','/:id/download'];(function(_0x2894e4,_0x39f2f7){var _0x341734=function(_0x855ec4){while(--_0x855ec4){_0x2894e4['push'](_0x2894e4['shift']());}};_0x341734(++_0x39f2f7);}(_0x9fe7,0x1df));var _0x79fe=function(_0x1d1bc9,_0x387e9a){_0x1d1bc9=_0x1d1bc9-0x0;var _0x333cd1=_0x9fe7[_0x1d1bc9];return _0x333cd1;};'use strict';var multer=require(_0x79fe('0x0'));var util=require(_0x79fe('0x1'));var path=require('path');var timeout=require(_0x79fe('0x2'));var express=require('express');var router=express[_0x79fe('0x3')]();var fs_extra=require(_0x79fe('0x4'));var auth=require(_0x79fe('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x79fe('0x6'));var controller=require(_0x79fe('0x7'));router[_0x79fe('0x8')]('/',auth['isAuthenticated'](),controller[_0x79fe('0x9')]);router[_0x79fe('0x8')](_0x79fe('0xa'),auth['isAuthenticated'](),controller[_0x79fe('0xb')]);router[_0x79fe('0x8')](_0x79fe('0xc'),auth[_0x79fe('0xd')](),controller[_0x79fe('0xe')]);router['get'](_0x79fe('0xf'),auth[_0x79fe('0xd')](),controller['getMessages']);router[_0x79fe('0x8')](_0x79fe('0x10'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x11')]);router['post']('/',auth[_0x79fe('0xd')](),controller[_0x79fe('0x12')]);router[_0x79fe('0x13')](_0x79fe('0xf'),auth[_0x79fe('0xd')](),controller[_0x79fe('0x14')]);router[_0x79fe('0x13')](_0x79fe('0x15'),auth['isAuthenticated'](),interaction[_0x79fe('0x16')](_0x79fe('0x17'),_0x79fe('0x18')),controller[_0x79fe('0x19')]);router[_0x79fe('0x1a')](_0x79fe('0xc'),auth['isAuthenticated'](),interaction[_0x79fe('0x16')](_0x79fe('0x17'),_0x79fe('0x1b')),controller[_0x79fe('0x1c')]);router['delete'](_0x79fe('0xc'),auth[_0x79fe('0xd')](),interaction[_0x79fe('0x16')](_0x79fe('0x17'),'whatsappinteraction:destroy'),controller['destroy']);router[_0x79fe('0x1d')](_0x79fe('0x15'),auth[_0x79fe('0xd')](),controller['removeTags']);module[_0x79fe('0x1e')]=router; \ No newline at end of file +var _0xc1c6=['/describe','isAuthenticated','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x590b4e,_0x242398){var _0x19d71f=function(_0x3681c6){while(--_0x3681c6){_0x590b4e['push'](_0x590b4e['shift']());}};_0x19d71f(++_0x242398);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x29906b,_0x4451d4){_0x29906b=_0x29906b-0x0;var _0x100f01=_0xc1c6[_0x29906b];return _0x100f01;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c1c('0x4'));var auth=require(_0x6c1c('0x5'));var interaction=require(_0x6c1c('0x6'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6c1c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x8')]);router['get'](_0x6c1c('0x9'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x7')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xc')]);router['get'](_0x6c1c('0xd'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xe')]);router[_0x6c1c('0x7')]('/:id/download',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xf')]);router[_0x6c1c('0x10')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x11')]);router[_0x6c1c('0x10')](_0x6c1c('0xd'),auth['isAuthenticated'](),controller[_0x6c1c('0x12')]);router['post'](_0x6c1c('0x13'),auth[_0x6c1c('0xa')](),interaction[_0x6c1c('0x14')](_0x6c1c('0x15'),_0x6c1c('0x16')),controller[_0x6c1c('0x17')]);router[_0x6c1c('0x18')](_0x6c1c('0x19'),auth[_0x6c1c('0xa')](),interaction['tracked'](_0x6c1c('0x15'),_0x6c1c('0x1a')),controller['update']);router[_0x6c1c('0x1b')](_0x6c1c('0x19'),auth['isAuthenticated'](),interaction[_0x6c1c('0x14')]('whatsapp',_0x6c1c('0x1c')),controller[_0x6c1c('0x1d')]);router['delete'](_0x6c1c('0x13'),auth['isAuthenticated'](),controller[_0x6c1c('0x1e')]);module[_0x6c1c('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index af101c0..41a1aa9 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 _0xb90a=['out','INTEGER','sequelize','moment','BOOLEAN','STRING','DATE','ENUM'];(function(_0x4f92da,_0x542a92){var _0x3253b3=function(_0x26019f){while(--_0x26019f){_0x4f92da['push'](_0x4f92da['shift']());}};_0x3253b3(++_0x542a92);}(_0xb90a,0x12a));var _0xab90=function(_0x68078f,_0x19a7a4){_0x68078f=_0x68078f-0x0;var _0xe392a7=_0xb90a[_0x68078f];return _0xe392a7;};'use strict';var Sequelize=require(_0xab90('0x0'));var moment=require(_0xab90('0x1'));module['exports']={'closed':{'type':Sequelize[_0xab90('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0xab90('0x3')]},'read1stAt':{'type':Sequelize[_0xab90('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xab90('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xab90('0x5')]('in',_0xab90('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueId':{'type':Sequelize[_0xab90('0x7')]}}; \ No newline at end of file +var _0x07a2=['STRING','ENUM','out','INTEGER','sequelize','moment','BOOLEAN','DATE'];(function(_0x349047,_0xbba641){var _0x45e336=function(_0x6e783a){while(--_0x6e783a){_0x349047['push'](_0x349047['shift']());}};_0x45e336(++_0xbba641);}(_0x07a2,0x12c));var _0x207a=function(_0x586c70,_0x4a8cb3){_0x586c70=_0x586c70-0x0;var _0x26db79=_0x07a2[_0x586c70];return _0x26db79;};'use strict';var Sequelize=require(_0x207a('0x0'));var moment=require(_0x207a('0x1'));module['exports']={'closed':{'type':Sequelize[_0x207a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x207a('0x3')]},'disposition':{'type':Sequelize[_0x207a('0x4')]},'secondDisposition':{'type':Sequelize[_0x207a('0x4')]},'thirdDisposition':{'type':Sequelize[_0x207a('0x4')]},'note':{'type':Sequelize[_0x207a('0x4')]},'phone':{'type':Sequelize[_0x207a('0x4')]},'read1stAt':{'type':Sequelize[_0x207a('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x207a('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x207a('0x5')]('in',_0x207a('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x207a('0x2')],'defaultValue':![]},'queueId':{'type':Sequelize[_0x207a('0x7')]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 9be6fe8..44940e2 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 _0x752c=['value','renderFile','downloadInteraction.ejs','.pdf','Whatsapp','createPdfFromHTML','download','err','rimraf','zip-dir','moment','util','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','WhatsappInteraction','fieldName','key','getOptions','whatsapp','query','user','show','params','model','rawAttributes','filters','attributes','length','includeAll','options','find','catch','create','body','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','keys','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','include','addTags','setTags','Tag','findAll','color','emit','whatsappInteractionTags:save','removeTags','unix','toString','join','root','files','tmp','server','attachments','transcript-%d-%s.zip','push','User','fullname','Contact','firstName','Attachment','Messages','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','createdAt','closed','closedAt','disposition','existsSync','createReadStream','pipe','createWriteStream','basename','direction','out','System','lastName'];(function(_0x13a5e2,_0x4e2d46){var _0x42c586=function(_0x935b12){while(--_0x935b12){_0x13a5e2['push'](_0x13a5e2['shift']());}};_0x42c586(++_0x4e2d46);}(_0x752c,0x10e));var _0xc752=function(_0x36e56f,_0x5495cd){_0x36e56f=_0x36e56f-0x0;var _0x15c27f=_0x752c[_0x36e56f];return _0x15c27f;};'use strict';var rimraf=require(_0xc752('0x0'));var zipdir=require(_0xc752('0x1'));var moment=require(_0xc752('0x2'));var BPromise=require('bluebird');var util=require(_0xc752('0x3'));var path=require(_0xc752('0x4'));var ejs=require(_0xc752('0x5'));var fs=require('fs');var _=require(_0xc752('0x6'));var Redis=require(_0xc752('0x7'));var interaction=require(_0xc752('0x8'));var qs=require(_0xc752('0x9'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xc752('0xa'));var config=require(_0xc752('0xb'));var db=require(_0xc752('0xc'))['db'];config[_0xc752('0xd')]=_[_0xc752('0xe')](config[_0xc752('0xd')],{'host':_0xc752('0xf'),'port':0x18eb});var socket=require(_0xc752('0x10'))(new Redis(config['redis']));require(_0xc752('0x11'))[_0xc752('0x12')](socket);function respondWithStatusCode(_0xd6c726,_0xbd0326){_0xbd0326=_0xbd0326||0xcc;return function(_0x260e1c){if(_0x260e1c){return _0xd6c726[_0xc752('0x13')](_0xbd0326);}return _0xd6c726[_0xc752('0x14')](_0xbd0326)[_0xc752('0x15')]();};}function respondWithResult(_0x5d30fb,_0x4a7077){_0x4a7077=_0x4a7077||0xc8;return function(_0x55b9e1){if(_0x55b9e1){return _0x5d30fb['status'](_0x4a7077)[_0xc752('0x16')](_0x55b9e1);}};}function respondWithFilteredResult(_0x287eb6,_0x2448a2){return function(_0x1c21ba){if(_0x1c21ba){var _0x602f42=typeof _0x2448a2[_0xc752('0x17')]===_0xc752('0x18')&&typeof _0x2448a2[_0xc752('0x19')]==='undefined';var _0x26a9ba=_0x1c21ba[_0xc752('0x1a')];var _0x3550fe=_0x602f42?0x0:_0x2448a2[_0xc752('0x17')];var _0x300e41=_0x602f42?_0x1c21ba[_0xc752('0x1a')]:_0x2448a2[_0xc752('0x17')]+_0x2448a2['limit'];var _0x1aa086;if(_0x300e41>=_0x26a9ba){_0x300e41=_0x26a9ba;_0x1aa086=0xc8;}else{_0x1aa086=0xce;}_0x287eb6['status'](_0x1aa086);return _0x287eb6[_0xc752('0x1b')](_0xc752('0x1c'),_0x3550fe+'-'+_0x300e41+'/'+_0x26a9ba)[_0xc752('0x16')](_0x1c21ba);}return null;};}function saveUpdates(_0xcf2d93){return function(_0x33ba53){if(_0x33ba53){return _0x33ba53[_0xc752('0x1d')](_0xcf2d93)[_0xc752('0x1e')](function(_0x46604f){return _0x46604f;});}return null;};}function removeEntity(_0x421adf){return function(_0x34e025){if(_0x34e025){return _0x34e025[_0xc752('0x1f')]()[_0xc752('0x1e')](function(){_0x421adf['status'](0xcc)[_0xc752('0x15')]();});}};}function handleEntityNotFound(_0x4b005a){return function(_0x2d9cd4){if(!_0x2d9cd4){_0x4b005a['sendStatus'](0x194);}return _0x2d9cd4;};}function handleError(_0x1a4f0a,_0x58c346){_0x58c346=_0x58c346||0x1f4;return function(_0x1cd01e){logger[_0xc752('0x20')](_0x1cd01e[_0xc752('0x21')]);if(_0x1cd01e[_0xc752('0x22')]){delete _0x1cd01e['name'];}_0x1a4f0a[_0xc752('0x14')](_0x58c346)[_0xc752('0x23')](_0x1cd01e);};}exports['index']=function(_0x152a8b,_0x50e474){var _0x128507={};var _0x124d3e=_['map'](db[_0xc752('0x24')]['rawAttributes'],function(_0x91ef54){return{'name':_0x91ef54[_0xc752('0x25')],'type':_0x91ef54['type'][_0xc752('0x26')]};});_0x128507=qs[_0xc752('0x27')](_0x124d3e,_0x152a8b);return interaction['findAll'](_0xc752('0x28'),_0x152a8b[_0xc752('0x29')],_0x152a8b[_0xc752('0x2a')],_0x128507,_0x124d3e)[_0xc752('0x1e')](respondWithFilteredResult(_0x50e474,_0x128507))['catch'](handleError(_0x50e474,null));};exports[_0xc752('0x2b')]=function(_0x16e78a,_0x17fa37){var _0x27648e={'raw':![],'where':{'id':_0x16e78a[_0xc752('0x2c')]['id']}},_0x1f8aa8={};_0x1f8aa8[_0xc752('0x2d')]=_['keys'](db[_0xc752('0x24')][_0xc752('0x2e')]);_0x1f8aa8[_0xc752('0x29')]=_['keys'](_0x16e78a['query']);_0x1f8aa8[_0xc752('0x2f')]=_['intersection'](_0x1f8aa8[_0xc752('0x2d')],_0x1f8aa8[_0xc752('0x29')]);_0x27648e[_0xc752('0x30')]=_['intersection'](_0x1f8aa8[_0xc752('0x2d')],qs['fields'](_0x16e78a[_0xc752('0x29')]['fields']));_0x27648e[_0xc752('0x30')]=_0x27648e[_0xc752('0x30')][_0xc752('0x31')]?_0x27648e['attributes']:_0x1f8aa8[_0xc752('0x2d')];if(_0x16e78a['query'][_0xc752('0x32')]){_0x27648e['include']=[{'all':!![]}];}_0x27648e=_['merge']({},_0x27648e,_0x16e78a[_0xc752('0x33')]);return db[_0xc752('0x24')][_0xc752('0x34')](_0x27648e)[_0xc752('0x1e')](handleEntityNotFound(_0x17fa37,null))[_0xc752('0x1e')](respondWithResult(_0x17fa37,null))[_0xc752('0x35')](handleError(_0x17fa37,null));};exports[_0xc752('0x36')]=function(_0xa86366,_0x1e622b){return db['WhatsappInteraction']['create'](_0xa86366[_0xc752('0x37')],{})['then'](respondWithResult(_0x1e622b,0xc9))[_0xc752('0x35')](handleError(_0x1e622b,null));};exports[_0xc752('0x1d')]=function(_0x12c137,_0x31398e){if(_0x12c137['body']['id']){delete _0x12c137[_0xc752('0x37')]['id'];}return db[_0xc752('0x24')]['find']({'where':{'id':_0x12c137[_0xc752('0x2c')]['id']}})[_0xc752('0x1e')](handleEntityNotFound(_0x31398e,null))[_0xc752('0x1e')](saveUpdates(_0x12c137[_0xc752('0x37')],null))[_0xc752('0x1e')](respondWithResult(_0x31398e,null))[_0xc752('0x35')](handleError(_0x31398e,null));};exports[_0xc752('0x1f')]=function(_0x3a7169,_0x1adc2b){return db[_0xc752('0x24')][_0xc752('0x34')]({'where':{'id':_0x3a7169['params']['id']}})['then'](handleEntityNotFound(_0x1adc2b,null))[_0xc752('0x1e')](removeEntity(_0x1adc2b,null))[_0xc752('0x35')](handleError(_0x1adc2b,null));};exports[_0xc752('0x38')]=function(_0x3adac1,_0x57eae5){return db[_0xc752('0x24')][_0xc752('0x38')]()[_0xc752('0x1e')](respondWithResult(_0x57eae5,null))[_0xc752('0x35')](handleError(_0x57eae5,null));};exports[_0xc752('0x39')]=function(_0x119cc1,_0x47e062){return db[_0xc752('0x3a')][_0xc752('0x34')]({'where':{'id':_0x119cc1['params']['id']}})['then'](handleEntityNotFound(_0x47e062,null))[_0xc752('0x1e')](function(_0x151c09){if(_0x151c09){return _0x151c09[_0xc752('0x39')](_0x119cc1[_0xc752('0x37')][_0xc752('0x3b')],_[_0xc752('0x3c')](_0x119cc1[_0xc752('0x37')],[_0xc752('0x3b'),'id'])||{});}})['then'](respondWithResult(_0x47e062,null))[_0xc752('0x35')](handleError(_0x47e062,null));};exports[_0xc752('0x3d')]=function(_0x18d722,_0x1286b2){var _0xd700c3={'raw':![],'where':{}};var _0x15aa21={};var _0x51f797={'count':0x0,'rows':[]};return db[_0xc752('0x24')][_0xc752('0x3e')]({'where':{'id':_0x18d722[_0xc752('0x2c')]['id']}})['then'](handleEntityNotFound(_0x1286b2,null))[_0xc752('0x1e')](function(_0x16970e){if(_0x16970e){_0x15aa21[_0xc752('0x2d')]=_[_0xc752('0x3f')](db['WhatsappMessage']['rawAttributes']);_0x15aa21[_0xc752('0x29')]=_['keys'](_0x18d722[_0xc752('0x29')]);_0x15aa21[_0xc752('0x2f')]=_[_0xc752('0x40')](_0x15aa21[_0xc752('0x2d')],_0x15aa21['query']);_0xd700c3[_0xc752('0x30')]=_[_0xc752('0x40')](_0x15aa21[_0xc752('0x2d')],qs[_0xc752('0x41')](_0x18d722[_0xc752('0x29')][_0xc752('0x41')]));_0xd700c3[_0xc752('0x30')]=_0xd700c3['attributes'][_0xc752('0x31')]?_0xd700c3[_0xc752('0x30')]:_0x15aa21[_0xc752('0x2d')];if(!_0x18d722[_0xc752('0x29')][_0xc752('0x42')](_0xc752('0x43'))){_0xd700c3['limit']=qs[_0xc752('0x19')](_0x18d722[_0xc752('0x29')]['limit']);_0xd700c3[_0xc752('0x17')]=qs['offset'](_0x18d722[_0xc752('0x29')][_0xc752('0x17')]);}_0xd700c3[_0xc752('0x44')]=qs['sort'](_0x18d722[_0xc752('0x29')][_0xc752('0x45')]);_0xd700c3['where']=qs['filters'](_['pick'](_0x18d722[_0xc752('0x29')],_0x15aa21[_0xc752('0x2f')]));_0xd700c3[_0xc752('0x46')]['WhatsappInteractionId']=_0x16970e['id'];if(_0x18d722[_0xc752('0x29')][_0xc752('0x47')]){_0xd700c3['where']=_[_0xc752('0x48')](_0xd700c3[_0xc752('0x46')],{'$or':_[_0xc752('0x49')](_0xd700c3[_0xc752('0x30')],function(_0x5205ad){var _0x26bb85={};_0x26bb85[_0x5205ad]={'$like':'%'+_0x18d722[_0xc752('0x29')][_0xc752('0x47')]+'%'};return _0x26bb85;})});}if(_0x18d722[_0xc752('0x29')][_0xc752('0x4a')]){var _0x284182=_0x18d722[_0xc752('0x29')][_0xc752('0x4a')][_0xc752('0x4b')](',');var _0x491a58={};_0x491a58[_0x284182[0x0]]={'$gte':moment(_0x284182[0x1])[_0xc752('0x4c')](_0xc752('0x4d'))};_0xd700c3[_0xc752('0x46')]=_[_0xc752('0x48')](_0xd700c3[_0xc752('0x46')],_0x491a58);}_0xd700c3=_[_0xc752('0x48')]({},_0xd700c3,_0x18d722[_0xc752('0x33')]);return db[_0xc752('0x3a')][_0xc752('0x1a')]({'where':_0xd700c3['where']})[_0xc752('0x1e')](function(_0x378ead){_0x51f797[_0xc752('0x1a')]=_0x378ead;if(_0x18d722[_0xc752('0x29')][_0xc752('0x32')]){_0xd700c3[_0xc752('0x4e')]=[{'all':!![]}];}return db[_0xc752('0x3a')]['findAll'](_0xd700c3);})[_0xc752('0x1e')](function(_0x2028a6){_0x51f797['rows']=_0x2028a6;return _0x51f797;});}})[_0xc752('0x1e')](respondWithFilteredResult(_0x1286b2,_0xd700c3))[_0xc752('0x35')](handleError(_0x1286b2,null));};exports[_0xc752('0x4f')]=function(_0x5aab12,_0xe93419){return db[_0xc752('0x24')]['find']({'where':{'id':_0x5aab12['params']['id']}})['then'](handleEntityNotFound(_0xe93419,null))[_0xc752('0x1e')](function(_0x3c80a3){if(_0x3c80a3){return _0x3c80a3[_0xc752('0x50')](_0x5aab12[_0xc752('0x37')][_0xc752('0x3b')],_[_0xc752('0x3c')](_0x5aab12['body'],[_0xc752('0x3b'),'id'])||{})['spread'](function(){return db[_0xc752('0x51')][_0xc752('0x52')]({'attributes':['id',_0xc752('0x22'),_0xc752('0x53')],'where':{'id':_0x5aab12[_0xc752('0x37')][_0xc752('0x3b')]}});})[_0xc752('0x1e')](function(_0x3974e9){socket[_0xc752('0x54')](_0xc752('0x55'),{'id':Number(_0x5aab12[_0xc752('0x2c')]['id']),'tags':_0x3974e9||[]});return{'id':Number(_0x5aab12['params']['id']),'tags':_0x3974e9||[]};});}})[_0xc752('0x1e')](respondWithResult(_0xe93419,null))[_0xc752('0x35')](handleError(_0xe93419,null));};exports[_0xc752('0x56')]=function(_0xefbaa8,_0x337765){return db[_0xc752('0x24')][_0xc752('0x34')]({'where':{'id':_0xefbaa8[_0xc752('0x2c')]['id']}})['then'](handleEntityNotFound(_0x337765,null))[_0xc752('0x1e')](function(_0x5805cc){if(_0x5805cc){return _0x5805cc[_0xc752('0x56')](_0xefbaa8[_0xc752('0x29')][_0xc752('0x3b')]);}})[_0xc752('0x1e')](respondWithStatusCode(_0x337765,null))[_0xc752('0x35')](handleError(_0x337765,null));};exports['download']=function(_0x5a23dd,_0x38f898){var _0xc9883d=moment()[_0xc752('0x57')]()[_0xc752('0x58')]();var _0xd07377=path[_0xc752('0x59')](config[_0xc752('0x5a')],'server',_0xc752('0x5b'),_0xc752('0x5c'));var _0x92d953=path['join'](config[_0xc752('0x5a')],_0xc752('0x5d'),_0xc752('0x5b'),_0xc752('0x5e'));var _0x1e86c7=path[_0xc752('0x59')](_0xd07377,_0xc9883d);var _0x408fdb=util[_0xc752('0x4c')](_0xc752('0x5f'),_0x5a23dd[_0xc752('0x2c')]['id'],_0xc9883d);var _0x57379c=path[_0xc752('0x59')](_0xd07377,_0x408fdb);var _0x10a13e=[];_0x10a13e[_0xc752('0x60')]({'model':db['User'],'as':_0xc752('0x61'),'attributes':['id',_0xc752('0x62')],'raw':!![]});_0x10a13e[_0xc752('0x60')]({'model':db['CmContact'],'as':_0xc752('0x63'),'attributes':['id',_0xc752('0x64'),'lastName'],'raw':!![]});if(_0x5a23dd[_0xc752('0x29')][_0xc752('0x5e')]){_0x10a13e['push']({'model':db[_0xc752('0x65')],'as':_0xc752('0x65'),'raw':!![]});}var _0x580509=[{'model':db[_0xc752('0x3a')],'as':_0xc752('0x66'),'attributes':['id',_0xc752('0x37'),'createdAt','direction',_0xc752('0x67'),_0xc752('0x68')],'include':_0x10a13e}];_0x580509[_0xc752('0x60')]({'model':db[_0xc752('0x69')],'as':_0xc752('0x6a'),'attributes':['id',_0xc752('0x22')]});_0x580509[_0xc752('0x60')]({'model':db[_0xc752('0x61')],'as':_0xc752('0x6b'),'attributes':['id',_0xc752('0x62')]});return db[_0xc752('0x24')][_0xc752('0x34')]({'where':{'id':_0x5a23dd[_0xc752('0x2c')]['id']},'include':_0x580509})[_0xc752('0x1e')](handleEntityNotFound(_0x38f898,null))['then'](function(_0x95e76f){if(_0x95e76f){var _0x2084c0=_0x95e76f[_0xc752('0x6c')]({'plain':!![]});fs[_0xc752('0x6d')](_0x1e86c7);var _0x1fbdd5={'channel':'Whatsapp','account':_0x2084c0[_0xc752('0x6a')]['name'],'agent':_0x2084c0['Owner']?_0x2084c0['Owner'][_0xc752('0x62')]:'N.A.','createdAt':moment(_0x2084c0[_0xc752('0x6e')])[_0xc752('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')[_0xc752('0x58')](),'closedAt':_0x2084c0[_0xc752('0x6f')]?moment(_0x2084c0[_0xc752('0x70')])[_0xc752('0x4c')](_0xc752('0x4d'))[_0xc752('0x58')]():'','disposition':_0x2084c0[_0xc752('0x71')],'messages':_(_0x2084c0[_0xc752('0x66')])[_0xc752('0x47')]({'secret':![]})[_0xc752('0x49')](function(_0x44eb04){if(_0x44eb04['Attachment']){var _0x29c0c5=path[_0xc752('0x59')](_0x92d953,_0x44eb04[_0xc752('0x65')]['basename']);if(fs[_0xc752('0x72')](_0x29c0c5)){fs[_0xc752('0x73')](_0x29c0c5)[_0xc752('0x74')](fs[_0xc752('0x75')](path[_0xc752('0x59')](_0x1e86c7,_0x44eb04[_0xc752('0x65')][_0xc752('0x76')])));}}return{'date':moment(_0x44eb04[_0xc752('0x6e')])['format'](_0xc752('0x4d'))[_0xc752('0x58')](),'sender':_0x44eb04[_0xc752('0x77')]===_0xc752('0x78')?_0x44eb04['User']?_0x44eb04[_0xc752('0x61')][_0xc752('0x62')]:_0xc752('0x79'):_0x44eb04['Contact']['firstName']+(_0x44eb04['Contact'][_0xc752('0x7a')]?'\x20'+_0x44eb04[_0xc752('0x63')][_0xc752('0x7a')]:''),'body':_0x44eb04['Attachment']?_0x44eb04[_0xc752('0x65')][_0xc752('0x76')]:_0x44eb04[_0xc752('0x37')],'direction':_0x44eb04[_0xc752('0x77')]===_0xc752('0x78')?'A':'C','secret':_0x44eb04[_0xc752('0x67')],'read':_0x44eb04[_0xc752('0x68')],'attachment':_0x44eb04['Attachment']};})[_0xc752('0x7b')]()};return ejs[_0xc752('0x7c')](path['join'](config['root'],'server','views',_0xc752('0x7d')),{'interaction':_0x1fbdd5})['then'](function(_0x1bbd27){var _0x4f37fe=path[_0xc752('0x59')](_0x1e86c7,'transcript-'+_0x2084c0['id']+'-'+_0xc9883d+_0xc752('0x7e'));var _0x347f75={'path':_0x4f37fe,'channel':_0xc752('0x7f'),'interactionId':_0x2084c0['id']};return pdf[_0xc752('0x80')](_0x1bbd27,_0x347f75);})[_0xc752('0x1e')](function(){return new BPromise(function(_0x231d70,_0x1be823){zipdir(_0x1e86c7,{'saveTo':_0x57379c},function(_0x21ab35,_0x4f1c1c){if(_0x21ab35)return _0x1be823(_0x21ab35);return _0x231d70(_0x4f1c1c);});})['then'](function(){return new BPromise(function(_0xdff09,_0x4f2ca6){rimraf(_0x1e86c7,function(_0x397727){if(_0x397727)_0x4f2ca6(_0x397727);return _0xdff09();});});})[_0xc752('0x1e')](function(){return _0x38f898[_0xc752('0x81')](_0x57379c,_0x408fdb,function(_0x10e7cd){if(_0x10e7cd){console['log'](_0xc752('0x82'),_0x10e7cd);}else{fs['unlinkSync'](_0x57379c);}});});});}else{return _0x38f898[_0xc752('0x13')](0xc8);}})[_0xc752('0x35')](handleError(_0x38f898,null));}; \ No newline at end of file +var _0x68fd=['localhost','socket.io-emitter','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','destroy','then','name','send','index','map','WhatsappInteraction','rawAttributes','fieldName','type','key','findAll','whatsapp','user','show','model','query','keys','intersection','fields','attributes','length','includeAll','include','merge','options','find','catch','create','body','update','params','describe','addMessage','WhatsappMessage','omit','ids','findOne','filters','hasOwnProperty','nolimit','order','sort','pick','where','WhatsappInteractionId','filter','$gte','split','format','rows','addTags','spread','color','removeTags','download','unix','toString','join','root','server','files','tmp','transcript-%d-%s.zip','push','User','CmContact','Contact','firstName','lastName','attachments','Attachment','direction','read','WhatsappAccount','Owner','fullname','get','Whatsapp','Account','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','basename','existsSync','createReadStream','pipe','createWriteStream','out','System','secret','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','moment','bluebird','path','ejs','lodash','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../mysqldb','redis','defaults'];(function(_0x596adf,_0x41bcde){var _0x5b2036=function(_0xbfa23){while(--_0xbfa23){_0x596adf['push'](_0x596adf['shift']());}};_0x5b2036(++_0x41bcde);}(_0x68fd,0x1e9));var _0xd68f=function(_0x3624c3,_0x4f182f){_0x3624c3=_0x3624c3-0x0;var _0x2da881=_0x68fd[_0x3624c3];return _0x2da881;};'use strict';var rimraf=require(_0xd68f('0x0'));var zipdir=require('zip-dir');var moment=require(_0xd68f('0x1'));var BPromise=require(_0xd68f('0x2'));var util=require('util');var path=require(_0xd68f('0x3'));var ejs=require(_0xd68f('0x4'));var fs=require('fs');var _=require(_0xd68f('0x5'));var Redis=require(_0xd68f('0x6'));var interaction=require(_0xd68f('0x7'));var qs=require(_0xd68f('0x8'));var pdf=require(_0xd68f('0x9'));var logger=require(_0xd68f('0xa'))(_0xd68f('0xb'));var config=require('../../config/environment');var db=require(_0xd68f('0xc'))['db'];config[_0xd68f('0xd')]=_[_0xd68f('0xe')](config[_0xd68f('0xd')],{'host':_0xd68f('0xf'),'port':0x18eb});var socket=require(_0xd68f('0x10'))(new Redis(config[_0xd68f('0xd')]));require('./whatsappInteraction.socket')['register'](socket);function respondWithStatusCode(_0x1c397a,_0x59ac71){_0x59ac71=_0x59ac71||0xcc;return function(_0x114bda){if(_0x114bda){return _0x1c397a[_0xd68f('0x11')](_0x59ac71);}return _0x1c397a[_0xd68f('0x12')](_0x59ac71)[_0xd68f('0x13')]();};}function respondWithResult(_0x2e45b8,_0x3099e7){_0x3099e7=_0x3099e7||0xc8;return function(_0x1943e8){if(_0x1943e8){return _0x2e45b8['status'](_0x3099e7)['json'](_0x1943e8);}};}function respondWithFilteredResult(_0x4b0be6,_0x5199bd){return function(_0xe53f3a){if(_0xe53f3a){var _0x305c19=typeof _0x5199bd['offset']===_0xd68f('0x14')&&typeof _0x5199bd[_0xd68f('0x15')]===_0xd68f('0x14');var _0x36441f=_0xe53f3a[_0xd68f('0x16')];var _0x9a7fc6=_0x305c19?0x0:_0x5199bd[_0xd68f('0x17')];var _0x53aed0=_0x305c19?_0xe53f3a[_0xd68f('0x16')]:_0x5199bd['offset']+_0x5199bd['limit'];var _0x8078d4;if(_0x53aed0>=_0x36441f){_0x53aed0=_0x36441f;_0x8078d4=0xc8;}else{_0x8078d4=0xce;}_0x4b0be6[_0xd68f('0x12')](_0x8078d4);return _0x4b0be6[_0xd68f('0x18')](_0xd68f('0x19'),_0x9a7fc6+'-'+_0x53aed0+'/'+_0x36441f)[_0xd68f('0x1a')](_0xe53f3a);}return null;};}function saveUpdates(_0xb01ed){return function(_0xa09f23){if(_0xa09f23){return _0xa09f23['update'](_0xb01ed)['then'](function(_0x14435f){return _0x14435f;});}return null;};}function removeEntity(_0x22be19){return function(_0x3722da){if(_0x3722da){return _0x3722da[_0xd68f('0x1b')]()[_0xd68f('0x1c')](function(){_0x22be19['status'](0xcc)[_0xd68f('0x13')]();});}};}function handleEntityNotFound(_0x32c45d){return function(_0x3fbc0b){if(!_0x3fbc0b){_0x32c45d['sendStatus'](0x194);}return _0x3fbc0b;};}function handleError(_0x464238,_0x1379e2){_0x1379e2=_0x1379e2||0x1f4;return function(_0xeba444){logger['error'](_0xeba444['stack']);if(_0xeba444[_0xd68f('0x1d')]){delete _0xeba444['name'];}_0x464238['status'](_0x1379e2)[_0xd68f('0x1e')](_0xeba444);};}exports[_0xd68f('0x1f')]=function(_0xde6c97,_0x3f11f9){var _0x4595bf={};var _0x434fde=_[_0xd68f('0x20')](db[_0xd68f('0x21')][_0xd68f('0x22')],function(_0x2d2df4){return{'name':_0x2d2df4[_0xd68f('0x23')],'type':_0x2d2df4[_0xd68f('0x24')][_0xd68f('0x25')]};});_0x4595bf=qs['getOptions'](_0x434fde,_0xde6c97);return interaction[_0xd68f('0x26')](_0xd68f('0x27'),_0xde6c97['query'],_0xde6c97[_0xd68f('0x28')],_0x4595bf,_0x434fde)['then'](respondWithFilteredResult(_0x3f11f9,_0x4595bf))['catch'](handleError(_0x3f11f9,null));};exports[_0xd68f('0x29')]=function(_0x42f8d2,_0x1eaebc){var _0x52a2dc={'raw':![],'where':{'id':_0x42f8d2['params']['id']}},_0xfee91c={};_0xfee91c[_0xd68f('0x2a')]=_['keys'](db[_0xd68f('0x21')][_0xd68f('0x22')]);_0xfee91c[_0xd68f('0x2b')]=_[_0xd68f('0x2c')](_0x42f8d2[_0xd68f('0x2b')]);_0xfee91c['filters']=_[_0xd68f('0x2d')](_0xfee91c['model'],_0xfee91c[_0xd68f('0x2b')]);_0x52a2dc['attributes']=_[_0xd68f('0x2d')](_0xfee91c[_0xd68f('0x2a')],qs[_0xd68f('0x2e')](_0x42f8d2[_0xd68f('0x2b')]['fields']));_0x52a2dc[_0xd68f('0x2f')]=_0x52a2dc[_0xd68f('0x2f')][_0xd68f('0x30')]?_0x52a2dc[_0xd68f('0x2f')]:_0xfee91c['model'];if(_0x42f8d2[_0xd68f('0x2b')][_0xd68f('0x31')]){_0x52a2dc[_0xd68f('0x32')]=[{'all':!![]}];}_0x52a2dc=_[_0xd68f('0x33')]({},_0x52a2dc,_0x42f8d2[_0xd68f('0x34')]);return db[_0xd68f('0x21')][_0xd68f('0x35')](_0x52a2dc)[_0xd68f('0x1c')](handleEntityNotFound(_0x1eaebc,null))['then'](respondWithResult(_0x1eaebc,null))[_0xd68f('0x36')](handleError(_0x1eaebc,null));};exports[_0xd68f('0x37')]=function(_0x43e7e4,_0x1cf3ef){return db[_0xd68f('0x21')][_0xd68f('0x37')](_0x43e7e4[_0xd68f('0x38')],{})[_0xd68f('0x1c')](respondWithResult(_0x1cf3ef,0xc9))['catch'](handleError(_0x1cf3ef,null));};exports[_0xd68f('0x39')]=function(_0x1474a0,_0x13f773){if(_0x1474a0[_0xd68f('0x38')]['id']){delete _0x1474a0[_0xd68f('0x38')]['id'];}return db['WhatsappInteraction'][_0xd68f('0x35')]({'where':{'id':_0x1474a0[_0xd68f('0x3a')]['id']}})[_0xd68f('0x1c')](handleEntityNotFound(_0x13f773,null))[_0xd68f('0x1c')](saveUpdates(_0x1474a0[_0xd68f('0x38')],null))[_0xd68f('0x1c')](respondWithResult(_0x13f773,null))[_0xd68f('0x36')](handleError(_0x13f773,null));};exports[_0xd68f('0x1b')]=function(_0x582b38,_0x32ea04){return db[_0xd68f('0x21')][_0xd68f('0x35')]({'where':{'id':_0x582b38[_0xd68f('0x3a')]['id']}})[_0xd68f('0x1c')](handleEntityNotFound(_0x32ea04,null))[_0xd68f('0x1c')](removeEntity(_0x32ea04,null))['catch'](handleError(_0x32ea04,null));};exports[_0xd68f('0x3b')]=function(_0xb89fd3,_0x1e7cac){return db[_0xd68f('0x21')][_0xd68f('0x3b')]()[_0xd68f('0x1c')](respondWithResult(_0x1e7cac,null))['catch'](handleError(_0x1e7cac,null));};exports[_0xd68f('0x3c')]=function(_0x6495c1,_0x5cd711){return db[_0xd68f('0x3d')]['find']({'where':{'id':_0x6495c1['params']['id']}})[_0xd68f('0x1c')](handleEntityNotFound(_0x5cd711,null))[_0xd68f('0x1c')](function(_0x586046){if(_0x586046){return _0x586046[_0xd68f('0x3c')](_0x6495c1[_0xd68f('0x38')]['ids'],_[_0xd68f('0x3e')](_0x6495c1[_0xd68f('0x38')],[_0xd68f('0x3f'),'id'])||{});}})[_0xd68f('0x1c')](respondWithResult(_0x5cd711,null))['catch'](handleError(_0x5cd711,null));};exports['getMessages']=function(_0x5ab3aa,_0x25bfee){var _0x1a975e={'raw':![],'where':{}};var _0x7c2a84={};var _0x61e58d={'count':0x0,'rows':[]};return db[_0xd68f('0x21')][_0xd68f('0x40')]({'where':{'id':_0x5ab3aa[_0xd68f('0x3a')]['id']}})[_0xd68f('0x1c')](handleEntityNotFound(_0x25bfee,null))[_0xd68f('0x1c')](function(_0x39779){if(_0x39779){_0x7c2a84[_0xd68f('0x2a')]=_['keys'](db['WhatsappMessage'][_0xd68f('0x22')]);_0x7c2a84[_0xd68f('0x2b')]=_[_0xd68f('0x2c')](_0x5ab3aa[_0xd68f('0x2b')]);_0x7c2a84[_0xd68f('0x41')]=_[_0xd68f('0x2d')](_0x7c2a84['model'],_0x7c2a84[_0xd68f('0x2b')]);_0x1a975e[_0xd68f('0x2f')]=_[_0xd68f('0x2d')](_0x7c2a84[_0xd68f('0x2a')],qs[_0xd68f('0x2e')](_0x5ab3aa[_0xd68f('0x2b')]['fields']));_0x1a975e[_0xd68f('0x2f')]=_0x1a975e[_0xd68f('0x2f')][_0xd68f('0x30')]?_0x1a975e[_0xd68f('0x2f')]:_0x7c2a84[_0xd68f('0x2a')];if(!_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x42')](_0xd68f('0x43'))){_0x1a975e[_0xd68f('0x15')]=qs['limit'](_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x15')]);_0x1a975e[_0xd68f('0x17')]=qs['offset'](_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x17')]);}_0x1a975e[_0xd68f('0x44')]=qs[_0xd68f('0x45')](_0x5ab3aa[_0xd68f('0x2b')]['sort']);_0x1a975e['where']=qs['filters'](_[_0xd68f('0x46')](_0x5ab3aa[_0xd68f('0x2b')],_0x7c2a84['filters']));_0x1a975e[_0xd68f('0x47')][_0xd68f('0x48')]=_0x39779['id'];if(_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x49')]){_0x1a975e[_0xd68f('0x47')]=_[_0xd68f('0x33')](_0x1a975e[_0xd68f('0x47')],{'$or':_[_0xd68f('0x20')](_0x1a975e[_0xd68f('0x2f')],function(_0x51b954){var _0x28fb40={};_0x28fb40[_0x51b954]={'$like':'%'+_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x49')]+'%'};return _0x28fb40;})});}if(_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x4a')]){var _0x141e97=_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x4a')][_0xd68f('0x4b')](',');var _0x2950b0={};_0x2950b0[_0x141e97[0x0]]={'$gte':moment(_0x141e97[0x1])[_0xd68f('0x4c')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1a975e['where']=_[_0xd68f('0x33')](_0x1a975e[_0xd68f('0x47')],_0x2950b0);}_0x1a975e=_[_0xd68f('0x33')]({},_0x1a975e,_0x5ab3aa['options']);return db[_0xd68f('0x3d')]['count']({'where':_0x1a975e[_0xd68f('0x47')]})[_0xd68f('0x1c')](function(_0x1e1652){_0x61e58d[_0xd68f('0x16')]=_0x1e1652;if(_0x5ab3aa[_0xd68f('0x2b')][_0xd68f('0x31')]){_0x1a975e[_0xd68f('0x32')]=[{'all':!![]}];}return db[_0xd68f('0x3d')]['findAll'](_0x1a975e);})[_0xd68f('0x1c')](function(_0x1d4566){_0x61e58d[_0xd68f('0x4d')]=_0x1d4566;return _0x61e58d;});}})[_0xd68f('0x1c')](respondWithFilteredResult(_0x25bfee,_0x1a975e))[_0xd68f('0x36')](handleError(_0x25bfee,null));};exports[_0xd68f('0x4e')]=function(_0x358522,_0x4426f4){return db[_0xd68f('0x21')][_0xd68f('0x35')]({'where':{'id':_0x358522[_0xd68f('0x3a')]['id']}})[_0xd68f('0x1c')](handleEntityNotFound(_0x4426f4,null))['then'](function(_0x5a113d){if(_0x5a113d){return _0x5a113d['setTags'](_0x358522[_0xd68f('0x38')]['ids'],_[_0xd68f('0x3e')](_0x358522[_0xd68f('0x38')],['ids','id'])||{})[_0xd68f('0x4f')](function(){return db['Tag'][_0xd68f('0x26')]({'attributes':['id',_0xd68f('0x1d'),_0xd68f('0x50')],'where':{'id':_0x358522['body'][_0xd68f('0x3f')]}});})[_0xd68f('0x1c')](function(_0x54e085){socket['emit']('whatsappInteractionTags:save',{'id':Number(_0x358522[_0xd68f('0x3a')]['id']),'tags':_0x54e085||[]});return{'id':Number(_0x358522['params']['id']),'tags':_0x54e085||[]};});}})['then'](respondWithResult(_0x4426f4,null))[_0xd68f('0x36')](handleError(_0x4426f4,null));};exports[_0xd68f('0x51')]=function(_0x10365c,_0xa0c662){return db[_0xd68f('0x21')][_0xd68f('0x35')]({'where':{'id':_0x10365c[_0xd68f('0x3a')]['id']}})[_0xd68f('0x1c')](handleEntityNotFound(_0xa0c662,null))[_0xd68f('0x1c')](function(_0x5cdf4d){if(_0x5cdf4d){return _0x5cdf4d[_0xd68f('0x51')](_0x10365c[_0xd68f('0x2b')][_0xd68f('0x3f')]);}})[_0xd68f('0x1c')](respondWithStatusCode(_0xa0c662,null))[_0xd68f('0x36')](handleError(_0xa0c662,null));};exports[_0xd68f('0x52')]=function(_0x20572d,_0x53c613){var _0x260f46=moment()[_0xd68f('0x53')]()[_0xd68f('0x54')]();var _0x594cff=path[_0xd68f('0x55')](config[_0xd68f('0x56')],_0xd68f('0x57'),_0xd68f('0x58'),_0xd68f('0x59'));var _0x41d2c2=path[_0xd68f('0x55')](config['root'],_0xd68f('0x57'),_0xd68f('0x58'),'attachments');var _0x3e34b8=path[_0xd68f('0x55')](_0x594cff,_0x260f46);var _0xf2b42=util[_0xd68f('0x4c')](_0xd68f('0x5a'),_0x20572d[_0xd68f('0x3a')]['id'],_0x260f46);var _0x4983ef=path[_0xd68f('0x55')](_0x594cff,_0xf2b42);var _0x27718c=[];_0x27718c[_0xd68f('0x5b')]({'model':db[_0xd68f('0x5c')],'as':_0xd68f('0x5c'),'attributes':['id','fullname'],'raw':!![]});_0x27718c['push']({'model':db[_0xd68f('0x5d')],'as':_0xd68f('0x5e'),'attributes':['id',_0xd68f('0x5f'),_0xd68f('0x60')],'raw':!![]});if(_0x20572d[_0xd68f('0x2b')][_0xd68f('0x61')]){_0x27718c[_0xd68f('0x5b')]({'model':db[_0xd68f('0x62')],'as':'Attachment','raw':!![]});}var _0x253203=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0xd68f('0x38'),'createdAt',_0xd68f('0x63'),'secret',_0xd68f('0x64')],'include':_0x27718c}];_0x253203[_0xd68f('0x5b')]({'model':db[_0xd68f('0x65')],'as':'Account','attributes':['id','name']});_0x253203[_0xd68f('0x5b')]({'model':db[_0xd68f('0x5c')],'as':_0xd68f('0x66'),'attributes':['id',_0xd68f('0x67')]});return db['WhatsappInteraction'][_0xd68f('0x35')]({'where':{'id':_0x20572d['params']['id']},'include':_0x253203})['then'](handleEntityNotFound(_0x53c613,null))['then'](function(_0x445b2d){if(_0x445b2d){var _0x352a18=_0x445b2d[_0xd68f('0x68')]({'plain':!![]});fs['mkdirSync'](_0x3e34b8);var _0x25c91e={'channel':_0xd68f('0x69'),'account':_0x352a18[_0xd68f('0x6a')][_0xd68f('0x1d')],'agent':_0x352a18[_0xd68f('0x66')]?_0x352a18['Owner']['fullname']:'N.A.','createdAt':moment(_0x352a18[_0xd68f('0x6b')])[_0xd68f('0x4c')](_0xd68f('0x6c'))[_0xd68f('0x54')](),'closedAt':_0x352a18[_0xd68f('0x6d')]?moment(_0x352a18[_0xd68f('0x6e')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0xd68f('0x54')]():'','disposition':_0x352a18['disposition'],'messages':_(_0x352a18['Messages'])[_0xd68f('0x49')]({'secret':![]})[_0xd68f('0x20')](function(_0x126155){if(_0x126155[_0xd68f('0x62')]){var _0x17b7b9=path['join'](_0x41d2c2,_0x126155[_0xd68f('0x62')][_0xd68f('0x6f')]);if(fs[_0xd68f('0x70')](_0x17b7b9)){fs[_0xd68f('0x71')](_0x17b7b9)[_0xd68f('0x72')](fs[_0xd68f('0x73')](path[_0xd68f('0x55')](_0x3e34b8,_0x126155[_0xd68f('0x62')][_0xd68f('0x6f')])));}}return{'date':moment(_0x126155[_0xd68f('0x6b')])[_0xd68f('0x4c')](_0xd68f('0x6c'))[_0xd68f('0x54')](),'sender':_0x126155[_0xd68f('0x63')]===_0xd68f('0x74')?_0x126155[_0xd68f('0x5c')]?_0x126155[_0xd68f('0x5c')][_0xd68f('0x67')]:_0xd68f('0x75'):_0x126155[_0xd68f('0x5e')]['firstName']+(_0x126155['Contact'][_0xd68f('0x60')]?'\x20'+_0x126155[_0xd68f('0x5e')][_0xd68f('0x60')]:''),'body':_0x126155['Attachment']?_0x126155[_0xd68f('0x62')]['basename']:_0x126155['body'],'direction':_0x126155[_0xd68f('0x63')]===_0xd68f('0x74')?'A':'C','secret':_0x126155[_0xd68f('0x76')],'read':_0x126155[_0xd68f('0x64')],'attachment':_0x126155[_0xd68f('0x62')]};})['value']()};return ejs[_0xd68f('0x77')](path['join'](config[_0xd68f('0x56')],_0xd68f('0x57'),_0xd68f('0x78'),_0xd68f('0x79')),{'interaction':_0x25c91e})['then'](function(_0x5606d9){var _0x45657e=path[_0xd68f('0x55')](_0x3e34b8,_0xd68f('0x7a')+_0x352a18['id']+'-'+_0x260f46+_0xd68f('0x7b'));var _0x395a21={'path':_0x45657e,'channel':_0xd68f('0x69'),'interactionId':_0x352a18['id']};return pdf[_0xd68f('0x7c')](_0x5606d9,_0x395a21);})[_0xd68f('0x1c')](function(){return new BPromise(function(_0x1a4607,_0x352029){zipdir(_0x3e34b8,{'saveTo':_0x4983ef},function(_0x420fa4,_0x4e8f4e){if(_0x420fa4)return _0x352029(_0x420fa4);return _0x1a4607(_0x4e8f4e);});})[_0xd68f('0x1c')](function(){return new BPromise(function(_0x128b66,_0x5c411e){rimraf(_0x3e34b8,function(_0x10950d){if(_0x10950d)_0x5c411e(_0x10950d);return _0x128b66();});});})['then'](function(){return _0x53c613[_0xd68f('0x52')](_0x4983ef,_0xf2b42,function(_0x1d5cf4){if(_0x1d5cf4){console['log']('err',_0x1d5cf4);}else{fs[_0xd68f('0x7d')](_0x4983ef);}});});});}else{return _0x53c613[_0xd68f('0x11')](0xc8);}})['catch'](handleError(_0x53c613,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index d8da13a..847f38d 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 _0x122a=['emit','catch','hasOwnProperty','exports','events','../../mysqldb','WhatsappInteraction','WhatsappMessage','update','setDataValue','Users','findAll','then'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x122a,0xba));var _0xa122=function(_0x1cb265,_0x55048e){_0x1cb265=_0x1cb265-0x0;var _0x42bf86=_0x122a[_0x1cb265];return _0x42bf86;};'use strict';var EventEmitter=require(_0xa122('0x0'));var WhatsappInteraction=require(_0xa122('0x1'))['db'][_0xa122('0x2')];var WhatsappMessage=require(_0xa122('0x1'))['db'][_0xa122('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa122('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1c87aa){return function(_0xbd5f48,_0x3de7af,_0x3c8130){_0xbd5f48['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x5157f6){_0xbd5f48[_0xa122('0x5')](_0xa122('0x6'),_0x5157f6['map'](function(_0x39cea5){return{'id':_0x39cea5['id']};}));return WhatsappMessage[_0xa122('0x7')]({'where':{'WhatsappInteractionId':_0xbd5f48['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa122('0x8')](function(_0x32314d){_0xbd5f48['setDataValue']('unreadMessages',_0x32314d['length']);WhatsappInteractionEvents[_0xa122('0x9')](_0x1c87aa+':'+_0xbd5f48['id'],_0xbd5f48);WhatsappInteractionEvents['emit'](_0x1c87aa,_0xbd5f48);_0x3c8130(null);})[_0xa122('0xa')](_0x3c8130(null));};}for(var e in events){if(events[_0xa122('0xb')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0xa122('0xc')]=WhatsappInteractionEvents; \ No newline at end of file +var _0xe3d4=['then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','exports','../../mysqldb','WhatsappInteraction','setMaxListeners','save','remove','getUsers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3d4,0xc6));var _0x4e3d=function(_0x40cdfa,_0x1cf634){_0x40cdfa=_0x40cdfa-0x0;var _0x2c5e4d=_0xe3d4[_0x40cdfa];return _0x2c5e4d;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x4e3d('0x0'))['db'][_0x4e3d('0x1')];var WhatsappMessage=require(_0x4e3d('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0x4e3d('0x2')](0x0);var events={'afterCreate':_0x4e3d('0x3'),'afterUpdate':'update','afterDestroy':_0x4e3d('0x4')};function emitEvent(_0x4ece82){return function(_0x438b9a,_0x46b757,_0x4fd5ff){_0x438b9a[_0x4e3d('0x5')]({'attributes':['id'],'raw':!![]})[_0x4e3d('0x6')](function(_0x5b544d){_0x438b9a[_0x4e3d('0x7')](_0x4e3d('0x8'),_0x5b544d[_0x4e3d('0x9')](function(_0x352616){return{'id':_0x352616['id']};}));return WhatsappMessage[_0x4e3d('0xa')]({'where':{'WhatsappInteractionId':_0x438b9a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x4e3d('0x6')](function(_0x500f5c){_0x438b9a['setDataValue'](_0x4e3d('0xb'),_0x500f5c[_0x4e3d('0xc')]);WhatsappInteractionEvents[_0x4e3d('0xd')](_0x4ece82+':'+_0x438b9a['id'],_0x438b9a);WhatsappInteractionEvents[_0x4e3d('0xd')](_0x4ece82,_0x438b9a);_0x4fd5ff(null);})[_0x4e3d('0xe')](_0x4fd5ff(null));};}for(var e in events){if(events[_0x4e3d('0xf')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x4e3d('0x10')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 6a98ee4..9964411 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 _0x3419=['util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','WhatsappInteraction','whatsapp_interactions','changed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash'];(function(_0x5b79a9,_0x54de44){var _0x1935a2=function(_0x10f5c5){while(--_0x10f5c5){_0x5b79a9['push'](_0x5b79a9['shift']());}};_0x1935a2(++_0x54de44);}(_0x3419,0xb3));var _0x9341=function(_0x5c4d27,_0x5b0822){_0x5c4d27=_0x5c4d27-0x0;var _0x1dda1a=_0x3419[_0x5c4d27];return _0x1dda1a;};'use strict';var _=require(_0x9341('0x0'));var util=require(_0x9341('0x1'));var logger=require(_0x9341('0x2'))(_0x9341('0x3'));var moment=require(_0x9341('0x4'));var BPromise=require('bluebird');var rp=require(_0x9341('0x5'));var fs=require('fs');var path=require(_0x9341('0x6'));var rimraf=require(_0x9341('0x7'));var config=require(_0x9341('0x8'));var attributes=require(_0x9341('0x9'));module['exports']=function(_0xa36232,_0x204ee){return _0xa36232['define'](_0x9341('0xa'),attributes,{'tableName':_0x9341('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x188d3b,_0x3b736e,_0x46a334){if(_0x188d3b[_0x9341('0xc')]('closed')){_0x188d3b[_0x9341('0xd')]=moment()['format'](_0x9341('0xe'));}_0x46a334(null,_0x188d3b);}}});}; \ No newline at end of file +var _0xdb84=['whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction'];(function(_0x45f868,_0xfd9973){var _0x315150=function(_0x474ec5){while(--_0x474ec5){_0x45f868['push'](_0x45f868['shift']());}};_0x315150(++_0xfd9973);}(_0xdb84,0xa8));var _0x4db8=function(_0x3e54a1,_0xdcff39){_0x3e54a1=_0x3e54a1-0x0;var _0x469760=_0xdb84[_0x3e54a1];return _0x469760;};'use strict';var _=require('lodash');var util=require(_0x4db8('0x0'));var logger=require(_0x4db8('0x1'))('api');var moment=require(_0x4db8('0x2'));var BPromise=require(_0x4db8('0x3'));var rp=require(_0x4db8('0x4'));var fs=require('fs');var path=require(_0x4db8('0x5'));var rimraf=require(_0x4db8('0x6'));var config=require(_0x4db8('0x7'));var attributes=require(_0x4db8('0x8'));module[_0x4db8('0x9')]=function(_0x2eb34e,_0x2962d0){return _0x2eb34e[_0x4db8('0xa')](_0x4db8('0xb'),attributes,{'tableName':_0x4db8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x16c103,_0x31741d,_0x5acec2){if(_0x16c103[_0x4db8('0xd')](_0x4db8('0xe'))){_0x16c103[_0x4db8('0xf')]=moment()[_0x4db8('0x10')](_0x4db8('0x11'));}_0x5acec2(null,_0x16c103);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 0b36529..b8d7965 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 _0xc502=['../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','raw','options','attributes','limit','then','AddTagsToWhatsappInteraction','where','addTags','ids','omit','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x41f4b7,_0x4c867d){var _0xe93221=function(_0x359cb5){while(--_0x359cb5){_0x41f4b7['push'](_0x41f4b7['shift']());}};_0xe93221(++_0x4c867d);}(_0xc502,0x81));var _0x2c50=function(_0x27af8e,_0x44328b){_0x27af8e=_0x27af8e-0x0;var _0x3d00f8=_0xc502[_0x27af8e];return _0x3d00f8;};'use strict';var _=require(_0x2c50('0x0'));var util=require(_0x2c50('0x1'));var moment=require('moment');var BPromise=require(_0x2c50('0x2'));var rs=require(_0x2c50('0x3'));var fs=require('fs');var Redis=require(_0x2c50('0x4'));var db=require(_0x2c50('0x5'))['db'];var utils=require(_0x2c50('0x6'));var logger=require(_0x2c50('0x7'))(_0x2c50('0x8'));var config=require(_0x2c50('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x2c50('0xa')][_0x2c50('0xb')]({'port':0x232a});config['redis']=_[_0x2c50('0xc')](config[_0x2c50('0xd')],{'host':_0x2c50('0xe'),'port':0x18eb});var socket=require(_0x2c50('0xf'))(new Redis(config[_0x2c50('0xd')]));require(_0x2c50('0x10'))[_0x2c50('0x11')](socket);function respondWithRpcPromise(_0x4061d2,_0x1a9cef,_0x344cb2){return new BPromise(function(_0x27777d,_0x1b0d80){return client[_0x2c50('0x12')](_0x4061d2,_0x344cb2)['then'](function(_0x51a3a6){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x1a9cef,'request\x20sent');logger[_0x2c50('0x13')](_0x2c50('0x14'),_0x1a9cef,_0x2c50('0x15'),JSON[_0x2c50('0x16')](_0x51a3a6));if(_0x51a3a6[_0x2c50('0x17')]){if(_0x51a3a6[_0x2c50('0x17')][_0x2c50('0x18')]===0x1f4){logger[_0x2c50('0x17')](_0x2c50('0x19'),_0x1a9cef,_0x51a3a6[_0x2c50('0x17')][_0x2c50('0x1a')]);return _0x1b0d80(_0x51a3a6[_0x2c50('0x17')][_0x2c50('0x1a')]);}logger[_0x2c50('0x17')](_0x2c50('0x19'),_0x1a9cef,_0x51a3a6[_0x2c50('0x17')][_0x2c50('0x1a')]);return _0x27777d(_0x51a3a6[_0x2c50('0x17')][_0x2c50('0x1a')]);}else{logger[_0x2c50('0x1b')]('WhatsappInteraction,\x20%s,\x20%s',_0x1a9cef,'request\x20sent');_0x27777d(_0x51a3a6[_0x2c50('0x1c')]['message']);}})[_0x2c50('0x1d')](function(_0x158968){logger[_0x2c50('0x17')](_0x2c50('0x19'),_0x1a9cef,_0x158968);_0x1b0d80(_0x158968);});});}exports[_0x2c50('0x1e')]=function(_0x3211c5){var _0x40809d=this;return new Promise(function(_0x43bf44,_0xcf9058){return db[_0x2c50('0x1f')][_0x2c50('0x20')](_0x3211c5[_0x2c50('0x21')],{'raw':_0x3211c5['options']?_0x3211c5['options'][_0x2c50('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3211c5[_0x2c50('0x23')]?_0x3211c5[_0x2c50('0x23')]['where']||null:null,'attributes':_0x3211c5[_0x2c50('0x23')]?_0x3211c5['options'][_0x2c50('0x24')]||null:null,'limit':_0x3211c5[_0x2c50('0x23')]?_0x3211c5[_0x2c50('0x23')][_0x2c50('0x25')]||null:null})[_0x2c50('0x26')](function(_0x431491){logger[_0x2c50('0x1b')](_0x2c50('0x1e'),_0x3211c5);logger[_0x2c50('0x13')](_0x2c50('0x1e'),_0x3211c5,JSON[_0x2c50('0x16')](_0x431491));_0x43bf44(_0x431491);})[_0x2c50('0x1d')](function(_0x39d68a){logger[_0x2c50('0x17')](_0x2c50('0x1e'),_0x39d68a[_0x2c50('0x1a')],_0x3211c5);_0xcf9058(_0x40809d[_0x2c50('0x17')](0x1f4,_0x39d68a[_0x2c50('0x1a')]));});});};exports[_0x2c50('0x27')]=function(_0x142179){return new Promise(function(_0x35f69c,_0xbf1877){return db[_0x2c50('0x1f')]['find']({'where':_0x142179[_0x2c50('0x23')]?_0x142179[_0x2c50('0x23')][_0x2c50('0x28')]||null:null})[_0x2c50('0x26')](function(_0x172af5){if(_0x172af5){return _0x172af5[_0x2c50('0x29')](_0x142179[_0x2c50('0x21')][_0x2c50('0x2a')],_[_0x2c50('0x2b')](_0x142179['body'],['ids','id'])||{});}})[_0x2c50('0x2c')](function(_0x32972d){logger[_0x2c50('0x1b')](_0x2c50('0x2d'),_0x142179);logger[_0x2c50('0x13')](_0x2c50('0x2d'),_0x142179,JSON['stringify'](_0x32972d));_0x35f69c(_0x32972d);})[_0x2c50('0x1d')](function(_0x2b3546){logger[_0x2c50('0x17')](_0x2c50('0x2d'),_0x2b3546[_0x2c50('0x1a')],_0x142179);_0xbf1877(_this[_0x2c50('0x17')](0x1f4,_0x2b3546[_0x2c50('0x1a')]));});});}; \ No newline at end of file +var _0x86e0=['body','options','raw','attributes','AddTagsToWhatsappInteraction','WhatsappInteraction','find','where','addTags','ids','spread','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./whatsappInteraction.socket','register','request','then','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateWhatsappInteraction','update'];(function(_0x3f71e3,_0x3991ec){var _0x5eb12c=function(_0x3a04c8){while(--_0x3a04c8){_0x3f71e3['push'](_0x3f71e3['shift']());}};_0x5eb12c(++_0x3991ec);}(_0x86e0,0xe8));var _0x086e=function(_0x3f6633,_0xf1bb7b){_0x3f6633=_0x3f6633-0x0;var _0xbfee29=_0x86e0[_0x3f6633];return _0xbfee29;};'use strict';var _=require(_0x086e('0x0'));var util=require(_0x086e('0x1'));var moment=require(_0x086e('0x2'));var BPromise=require('bluebird');var rs=require(_0x086e('0x3'));var fs=require('fs');var Redis=require(_0x086e('0x4'));var db=require(_0x086e('0x5'))['db'];var utils=require(_0x086e('0x6'));var logger=require(_0x086e('0x7'))(_0x086e('0x8'));var config=require(_0x086e('0x9'));var jayson=require(_0x086e('0xa'));var client=jayson[_0x086e('0xb')][_0x086e('0xc')]({'port':0x232a});config[_0x086e('0xd')]=_['defaults'](config[_0x086e('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x086e('0xe'))(new Redis(config[_0x086e('0xd')]));require(_0x086e('0xf'))[_0x086e('0x10')](socket);function respondWithRpcPromise(_0x5bde76,_0x375d5d,_0x29b905){return new BPromise(function(_0x5698a7,_0xcd607){return client[_0x086e('0x11')](_0x5bde76,_0x29b905)[_0x086e('0x12')](function(_0x27b0af){logger['info']('WhatsappInteraction,\x20%s,\x20%s',_0x375d5d,'request\x20sent');logger[_0x086e('0x13')](_0x086e('0x14'),_0x375d5d,_0x086e('0x15'),JSON[_0x086e('0x16')](_0x27b0af));if(_0x27b0af['error']){if(_0x27b0af[_0x086e('0x17')][_0x086e('0x18')]===0x1f4){logger['error'](_0x086e('0x19'),_0x375d5d,_0x27b0af[_0x086e('0x17')][_0x086e('0x1a')]);return _0xcd607(_0x27b0af[_0x086e('0x17')]['message']);}logger[_0x086e('0x17')]('WhatsappInteraction,\x20%s,\x20%s',_0x375d5d,_0x27b0af[_0x086e('0x17')][_0x086e('0x1a')]);return _0x5698a7(_0x27b0af[_0x086e('0x17')][_0x086e('0x1a')]);}else{logger[_0x086e('0x1b')]('WhatsappInteraction,\x20%s,\x20%s',_0x375d5d,'request\x20sent');_0x5698a7(_0x27b0af[_0x086e('0x1c')][_0x086e('0x1a')]);}})[_0x086e('0x1d')](function(_0x485440){logger[_0x086e('0x17')](_0x086e('0x19'),_0x375d5d,_0x485440);_0xcd607(_0x485440);});});}exports[_0x086e('0x1e')]=function(_0x3478be){var _0x12c176=this;return new Promise(function(_0x2c44d0,_0x1f831c){return db['WhatsappInteraction'][_0x086e('0x1f')](_0x3478be[_0x086e('0x20')],{'raw':_0x3478be['options']?_0x3478be[_0x086e('0x21')][_0x086e('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3478be[_0x086e('0x21')]?_0x3478be['options']['where']||null:null,'attributes':_0x3478be[_0x086e('0x21')]?_0x3478be[_0x086e('0x21')][_0x086e('0x23')]||null:null,'limit':_0x3478be['options']?_0x3478be[_0x086e('0x21')]['limit']||null:null})[_0x086e('0x12')](function(_0x4d2fd9){logger[_0x086e('0x1b')](_0x086e('0x1e'),_0x3478be);logger[_0x086e('0x13')](_0x086e('0x1e'),_0x3478be,JSON['stringify'](_0x4d2fd9));_0x2c44d0(_0x4d2fd9);})[_0x086e('0x1d')](function(_0x3d1711){logger['error'](_0x086e('0x1e'),_0x3d1711['message'],_0x3478be);_0x1f831c(_0x12c176[_0x086e('0x17')](0x1f4,_0x3d1711[_0x086e('0x1a')]));});});};exports[_0x086e('0x24')]=function(_0xdf516){return new Promise(function(_0x3d23dd,_0x5841c8){return db[_0x086e('0x25')][_0x086e('0x26')]({'where':_0xdf516['options']?_0xdf516['options'][_0x086e('0x27')]||null:null})[_0x086e('0x12')](function(_0x96c639){if(_0x96c639){return _0x96c639[_0x086e('0x28')](_0xdf516['body']['ids'],_['omit'](_0xdf516[_0x086e('0x20')],[_0x086e('0x29'),'id'])||{});}})[_0x086e('0x2a')](function(_0x2f3ad5){logger['info']('AddTags',_0xdf516);logger[_0x086e('0x13')]('AddTags',_0xdf516,JSON[_0x086e('0x16')](_0x2f3ad5));_0x3d23dd(_0x2f3ad5);})[_0x086e('0x1d')](function(_0x24a15a){logger['error'](_0x086e('0x2b'),_0x24a15a[_0x086e('0x1a')],_0xdf516);_0x5841c8(_this[_0x086e('0x17')](0x1f4,_0x24a15a['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index 4b74b1d..de2e2d8 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 _0x4f81=['register','length','whatsappInteraction:','./whatsappInteraction.events','emit','removeListener'];(function(_0x11f9a8,_0x577a6c){var _0x1d3ab0=function(_0x55782c){while(--_0x55782c){_0x11f9a8['push'](_0x11f9a8['shift']());}};_0x1d3ab0(++_0x577a6c);}(_0x4f81,0x105));var _0x14f8=function(_0x2db8fc,_0x44e6f7){_0x2db8fc=_0x2db8fc-0x0;var _0x182c1a=_0x4f81[_0x2db8fc];return _0x182c1a;};'use strict';var WhatsappInteractionEvents=require(_0x14f8('0x0'));var events=['save','remove','update'];function createListener(_0x19edfc,_0x12f2bf){return function(_0x758a38){_0x12f2bf[_0x14f8('0x1')](_0x19edfc,_0x758a38);};}function removeListener(_0x13544c,_0x2a81ac){return function(){WhatsappInteractionEvents[_0x14f8('0x2')](_0x13544c,_0x2a81ac);};}exports[_0x14f8('0x3')]=function(_0x5b7604){for(var _0x13a07f=0x0,_0x52396b=events[_0x14f8('0x4')];_0x13a07f<_0x52396b;_0x13a07f++){var _0x55c44d=events[_0x13a07f];var _0x3673c3=createListener(_0x14f8('0x5')+_0x55c44d,_0x5b7604);WhatsappInteractionEvents['on'](_0x55c44d,_0x3673c3);}}; \ No newline at end of file +var _0xff5e=['emit','removeListener','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x4618d7,_0x11f97c){var _0x38561e=function(_0x3a7b9b){while(--_0x3a7b9b){_0x4618d7['push'](_0x4618d7['shift']());}};_0x38561e(++_0x11f97c);}(_0xff5e,0x136));var _0xeff5=function(_0x58766,_0x1f6dfb){_0x58766=_0x58766-0x0;var _0x4b82ec=_0xff5e[_0x58766];return _0x4b82ec;};'use strict';var WhatsappInteractionEvents=require(_0xeff5('0x0'));var events=[_0xeff5('0x1'),'remove','update'];function createListener(_0x463c84,_0xbfe7ad){return function(_0x3afda5){_0xbfe7ad[_0xeff5('0x2')](_0x463c84,_0x3afda5);};}function removeListener(_0x3b39c8,_0x46c02c){return function(){WhatsappInteractionEvents[_0xeff5('0x3')](_0x3b39c8,_0x46c02c);};}exports['register']=function(_0x3a677f){for(var _0x303d70=0x0,_0x7f6ed1=events[_0xeff5('0x4')];_0x303d70<_0x7f6ed1;_0x303d70++){var _0x1318f1=events[_0x303d70];var _0x33143b=createListener(_0xeff5('0x5')+_0x1318f1,_0x3a677f);WhatsappInteractionEvents['on'](_0x1318f1,_0x33143b);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 2984d80..3fc3af9 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 _0x0825=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','/:id','show','tracked','whatsappmessage:create','create','/:id/status','status','update','put','/:id/accept','accept','reject','destroy','exports','multer'];(function(_0x14939b,_0x1c661b){var _0x2e02ad=function(_0x3f32ae){while(--_0x3f32ae){_0x14939b['push'](_0x14939b['shift']());}};_0x2e02ad(++_0x1c661b);}(_0x0825,0x185));var _0x5082=function(_0x2d95b2,_0x591e78){_0x2d95b2=_0x2d95b2-0x0;var _0x4f18e6=_0x0825[_0x2d95b2];return _0x4f18e6;};'use strict';var multer=require(_0x5082('0x0'));var util=require('util');var path=require(_0x5082('0x1'));var timeout=require('connect-timeout');var express=require(_0x5082('0x2'));var router=express[_0x5082('0x3')]();var fs_extra=require(_0x5082('0x4'));var auth=require(_0x5082('0x5'));var interaction=require(_0x5082('0x6'));var config=require(_0x5082('0x7'));var controller=require(_0x5082('0x8'));router[_0x5082('0x9')]('/',auth[_0x5082('0xa')](),controller['index']);router[_0x5082('0x9')](_0x5082('0xb'),auth[_0x5082('0xa')](),controller['describe']);router[_0x5082('0x9')](_0x5082('0xc'),auth[_0x5082('0xa')](),controller[_0x5082('0xd')]);router['post']('/',auth[_0x5082('0xa')](),interaction[_0x5082('0xe')]('whatsapp',_0x5082('0xf')),controller[_0x5082('0x10')]);router['post'](_0x5082('0x11'),controller[_0x5082('0x12')]);router['put'](_0x5082('0xc'),auth['isAuthenticated'](),controller[_0x5082('0x13')]);router[_0x5082('0x14')](_0x5082('0x15'),auth[_0x5082('0xa')](),controller[_0x5082('0x16')]);router['put']('/:id/reject',auth[_0x5082('0xa')](),controller[_0x5082('0x17')]);router['delete'](_0x5082('0xc'),auth[_0x5082('0xa')](),controller[_0x5082('0x18')]);module[_0x5082('0x19')]=router; \ No newline at end of file +var _0x3df1=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','status','put','update','/:id/accept','/:id/reject','reject','delete','destroy','exports'];(function(_0x5c552b,_0x2f2773){var _0x3e4c76=function(_0x541037){while(--_0x541037){_0x5c552b['push'](_0x5c552b['shift']());}};_0x3e4c76(++_0x2f2773);}(_0x3df1,0xa5));var _0x13df=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x3df1[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x13df('0x0'));var util=require(_0x13df('0x1'));var path=require(_0x13df('0x2'));var timeout=require(_0x13df('0x3'));var express=require(_0x13df('0x4'));var router=express[_0x13df('0x5')]();var fs_extra=require(_0x13df('0x6'));var auth=require(_0x13df('0x7'));var interaction=require(_0x13df('0x8'));var config=require(_0x13df('0x9'));var controller=require(_0x13df('0xa'));router[_0x13df('0xb')]('/',auth[_0x13df('0xc')](),controller[_0x13df('0xd')]);router['get'](_0x13df('0xe'),auth[_0x13df('0xc')](),controller[_0x13df('0xf')]);router[_0x13df('0xb')](_0x13df('0x10'),auth[_0x13df('0xc')](),controller[_0x13df('0x11')]);router[_0x13df('0x12')]('/',auth[_0x13df('0xc')](),interaction[_0x13df('0x13')](_0x13df('0x14'),_0x13df('0x15')),controller[_0x13df('0x16')]);router[_0x13df('0x12')](_0x13df('0x17'),controller[_0x13df('0x18')]);router[_0x13df('0x19')](_0x13df('0x10'),auth[_0x13df('0xc')](),controller[_0x13df('0x1a')]);router[_0x13df('0x19')](_0x13df('0x1b'),auth[_0x13df('0xc')](),controller['accept']);router[_0x13df('0x19')](_0x13df('0x1c'),auth[_0x13df('0xc')](),controller[_0x13df('0x1d')]);router[_0x13df('0x1e')](_0x13df('0x10'),auth[_0x13df('0xc')](),controller[_0x13df('0x1f')]);module[_0x13df('0x20')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index b7a4249..f1b9dec 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 _0xdfe9=['ENUM','out','STRING','DATE','sequelize','exports','TEXT','medium','BOOLEAN'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0xdfe9,0x199));var _0x9dfe=function(_0x397d5d,_0x559356){_0x397d5d=_0x397d5d-0x0;var _0x34cf7d=_0xdfe9[_0x397d5d];return _0x34cf7d;};'use strict';var Sequelize=require(_0x9dfe('0x0'));module[_0x9dfe('0x1')]={'body':{'type':Sequelize[_0x9dfe('0x2')](_0x9dfe('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x9dfe('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9dfe('0x5')]('in',_0x9dfe('0x6')),'defaultValue':_0x9dfe('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0x9dfe('0x7')]},'readAt':{'type':Sequelize[_0x9dfe('0x8')]},'secret':{'type':Sequelize[_0x9dfe('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x9dfe('0x2')]}}; \ No newline at end of file +var _0x2401=['TEXT','medium','BOOLEAN','ENUM','out','STRING','DATE','sequelize'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x2401,0x1af));var _0x1240=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2401[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x1240('0x0'));module['exports']={'body':{'type':Sequelize[_0x1240('0x1')](_0x1240('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1240('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1240('0x4')]('in',_0x1240('0x5')),'defaultValue':_0x1240('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0x1240('0x6')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x1240('0x7')]},'secret':{'type':Sequelize[_0x1240('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x1240('0x6')]},'providerResponse':{'type':Sequelize[_0x1240('0x1')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 956b8f4..9e27319 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 _0x5505=['merge','VIRTUAL','includeAll','include','findAll','catch','show','params','keys','rawAttributes','length','find','create','body','describe','accept','whatsapp','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteractionId','isNil','read1stAt','format','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','SELECT','contact','User','fullname','email','manual','interface','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','rejectMessage','QueryTypes','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','update','destroy','stack','name','send','index','map','WhatsappMessage','fieldName','type','model','query','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','filter'];(function(_0x11a500,_0xaa37fd){var _0x2196a8=function(_0x3f31c0){while(--_0x3f31c0){_0x11a500['push'](_0x11a500['shift']());}};_0x2196a8(++_0xaa37fd);}(_0x5505,0x159));var _0x5550=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x5505[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0x5550('0x0'));var rimraf=require(_0x5550('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5550('0x2'));var rp=require(_0x5550('0x3'));var moment=require(_0x5550('0x4'));var BPromise=require(_0x5550('0x5'));var Mustache=require('mustache');var util=require(_0x5550('0x6'));var path=require(_0x5550('0x7'));var sox=require(_0x5550('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5550('0x9'));var _=require(_0x5550('0xa'));var squel=require(_0x5550('0xb'));var crypto=require(_0x5550('0xc'));var jsforce=require(_0x5550('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x5550('0xe'));var querystring=require(_0x5550('0xf'));var Papa=require(_0x5550('0x10'));var Redis=require(_0x5550('0x11'));var authService=require(_0x5550('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5550('0x13'))(_0x5550('0x14'));var utils=require(_0x5550('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x5550('0x16'));var db=require('../../mysqldb')['db'];config[_0x5550('0x17')]=_[_0x5550('0x18')](config['redis'],{'host':_0x5550('0x19'),'port':0x18eb});var socket=require(_0x5550('0x1a'))(new Redis(config[_0x5550('0x17')]));require(_0x5550('0x1b'))[_0x5550('0x1c')](socket);var jayson=require(_0x5550('0x1d'));var client=jayson[_0x5550('0x1e')][_0x5550('0x1f')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4608a7,_0x37c810,_0x2dc22b,_0x32683e){return new BPromise(function(_0x5e8ab5,_0x19c7d5){var _0x39920d=_0x32683e||client;return _0x39920d['request'](_0x4608a7,_0x2dc22b)[_0x5550('0x20')](function(_0x330975){logger[_0x5550('0x21')](_0x5550('0x22'),_0x37c810,_0x5550('0x23'));logger[_0x5550('0x24')](_0x5550('0x25'),_0x37c810,_0x5550('0x23'),JSON[_0x5550('0x26')](_0x330975));if(_0x330975[_0x5550('0x27')]){if(_0x330975[_0x5550('0x27')][_0x5550('0x28')]===0x1f4){logger[_0x5550('0x27')](_0x5550('0x22'),_0x37c810,_0x330975['error'][_0x5550('0x29')]);return _0x19c7d5(_0x330975[_0x5550('0x27')][_0x5550('0x29')]);}logger[_0x5550('0x27')](_0x5550('0x22'),_0x37c810,_0x330975[_0x5550('0x27')]['message']);return _0x5e8ab5(_0x330975[_0x5550('0x27')][_0x5550('0x29')]);}else{logger[_0x5550('0x21')]('WhatsappMessage,\x20%s,\x20%s',_0x37c810,_0x5550('0x23'));_0x5e8ab5(_0x330975[_0x5550('0x2a')][_0x5550('0x29')]);}})['catch'](function(_0x46e4d7){logger['error'](_0x5550('0x22'),_0x37c810,_0x46e4d7);_0x19c7d5(_0x46e4d7);});});}function respondWithStatusCode(_0x297aa1,_0x34d2aa){_0x34d2aa=_0x34d2aa||0xcc;return function(_0x49223b){if(_0x49223b){return _0x297aa1[_0x5550('0x2b')](_0x34d2aa);}return _0x297aa1[_0x5550('0x2c')](_0x34d2aa)[_0x5550('0x2d')]();};}function respondWithResult(_0x1c1676,_0x2ac394){_0x2ac394=_0x2ac394||0xc8;return function(_0x28db90){if(_0x28db90){return _0x1c1676[_0x5550('0x2c')](_0x2ac394)[_0x5550('0x2e')](_0x28db90);}};}function respondWithFilteredResult(_0x34b2f8,_0x4c536f){return function(_0x4707cd){if(_0x4707cd){var _0x103e35=typeof _0x4c536f['offset']===_0x5550('0x2f')&&typeof _0x4c536f['limit']===_0x5550('0x2f');var _0x2a9de1=_0x4707cd[_0x5550('0x30')];var _0x3c1c72=_0x103e35?0x0:_0x4c536f[_0x5550('0x31')];var _0x4696ba=_0x103e35?_0x4707cd[_0x5550('0x30')]:_0x4c536f[_0x5550('0x31')]+_0x4c536f[_0x5550('0x32')];var _0x57da4e;if(_0x4696ba>=_0x2a9de1){_0x4696ba=_0x2a9de1;_0x57da4e=0xc8;}else{_0x57da4e=0xce;}_0x34b2f8[_0x5550('0x2c')](_0x57da4e);return _0x34b2f8[_0x5550('0x33')]('Content-Range',_0x3c1c72+'-'+_0x4696ba+'/'+_0x2a9de1)[_0x5550('0x2e')](_0x4707cd);}return null;};}function patchUpdates(_0x23177c){return function(_0x3c6ff8){try{jsonpatch[_0x5550('0x34')](_0x3c6ff8,_0x23177c,!![]);}catch(_0x45b80d){return BPromise[_0x5550('0x35')](_0x45b80d);}return _0x3c6ff8['save']();};}function saveUpdates(_0x501dd3,_0x31f4b3){return function(_0x597df2){if(_0x597df2){return _0x597df2[_0x5550('0x36')](_0x501dd3)[_0x5550('0x20')](function(_0x24217b){return _0x24217b;});}return null;};}function removeEntity(_0x76809e,_0x169adf){return function(_0x231566){if(_0x231566){return _0x231566[_0x5550('0x37')]()[_0x5550('0x20')](function(){_0x76809e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x23988f,_0x415093){return function(_0xf59093){if(!_0xf59093){_0x23988f[_0x5550('0x2b')](0x194);}return _0xf59093;};}function handleError(_0x5b09f2,_0x5cda39){_0x5cda39=_0x5cda39||0x1f4;return function(_0x17773f){logger['error'](_0x17773f[_0x5550('0x38')]);if(_0x17773f[_0x5550('0x39')]){delete _0x17773f[_0x5550('0x39')];}_0x5b09f2[_0x5550('0x2c')](_0x5cda39)[_0x5550('0x3a')](_0x17773f);};}exports[_0x5550('0x3b')]=function(_0x15ebbf,_0x74e721){var _0x48d2d1={},_0xd972e2={},_0x361ae3={'count':0x0,'rows':[]};var _0x1b4f87=_[_0x5550('0x3c')](db[_0x5550('0x3d')]['rawAttributes'],function(_0x24a79a){return{'name':_0x24a79a[_0x5550('0x3e')],'type':_0x24a79a[_0x5550('0x3f')]['key']};});_0xd972e2[_0x5550('0x40')]=_[_0x5550('0x3c')](_0x1b4f87,_0x5550('0x39'));_0xd972e2['query']=_['keys'](_0x15ebbf[_0x5550('0x41')]);_0xd972e2[_0x5550('0x42')]=_[_0x5550('0x43')](_0xd972e2[_0x5550('0x40')],_0xd972e2[_0x5550('0x41')]);_0x48d2d1['attributes']=_['intersection'](_0xd972e2['model'],qs[_0x5550('0x44')](_0x15ebbf[_0x5550('0x41')]['fields']));_0x48d2d1[_0x5550('0x45')]=_0x48d2d1[_0x5550('0x45')]['length']?_0x48d2d1[_0x5550('0x45')]:_0xd972e2['model'];if(!_0x15ebbf[_0x5550('0x41')][_0x5550('0x46')]('nolimit')){_0x48d2d1[_0x5550('0x32')]=qs[_0x5550('0x32')](_0x15ebbf[_0x5550('0x41')][_0x5550('0x32')]);_0x48d2d1[_0x5550('0x31')]=qs['offset'](_0x15ebbf[_0x5550('0x41')][_0x5550('0x31')]);}_0x48d2d1['order']=qs[_0x5550('0x47')](_0x15ebbf[_0x5550('0x41')][_0x5550('0x47')]);_0x48d2d1[_0x5550('0x48')]=qs['filters'](_[_0x5550('0x49')](_0x15ebbf[_0x5550('0x41')],_0xd972e2[_0x5550('0x42')]),_0x1b4f87);if(_0x15ebbf[_0x5550('0x41')][_0x5550('0x4a')]){_0x48d2d1[_0x5550('0x48')]=_[_0x5550('0x4b')](_0x48d2d1['where'],{'$or':_[_0x5550('0x3c')](_0x1b4f87,function(_0x413c4e){if(_0x413c4e[_0x5550('0x3f')]!==_0x5550('0x4c')){var _0xb8e168={};_0xb8e168[_0x413c4e[_0x5550('0x39')]]={'$like':'%'+_0x15ebbf[_0x5550('0x41')]['filter']+'%'};return _0xb8e168;}})});}_0x48d2d1=_[_0x5550('0x4b')]({},_0x48d2d1,_0x15ebbf['options']);var _0x526978={'where':_0x48d2d1[_0x5550('0x48')]};return db['WhatsappMessage'][_0x5550('0x30')](_0x526978)['then'](function(_0x578091){_0x361ae3[_0x5550('0x30')]=_0x578091;if(_0x15ebbf[_0x5550('0x41')][_0x5550('0x4d')]){_0x48d2d1[_0x5550('0x4e')]=[{'all':!![]}];}return db[_0x5550('0x3d')][_0x5550('0x4f')](_0x48d2d1);})[_0x5550('0x20')](function(_0x1b947a){_0x361ae3['rows']=_0x1b947a;return _0x361ae3;})['then'](respondWithFilteredResult(_0x74e721,_0x48d2d1))[_0x5550('0x50')](handleError(_0x74e721,null));};exports[_0x5550('0x51')]=function(_0x127299,_0x2ba284){var _0x3c08d1={'raw':!![],'where':{'id':_0x127299[_0x5550('0x52')]['id']}},_0x108c6e={};_0x108c6e[_0x5550('0x40')]=_[_0x5550('0x53')](db[_0x5550('0x3d')][_0x5550('0x54')]);_0x108c6e[_0x5550('0x41')]=_[_0x5550('0x53')](_0x127299[_0x5550('0x41')]);_0x108c6e[_0x5550('0x42')]=_[_0x5550('0x43')](_0x108c6e[_0x5550('0x40')],_0x108c6e[_0x5550('0x41')]);_0x3c08d1['attributes']=_[_0x5550('0x43')](_0x108c6e['model'],qs[_0x5550('0x44')](_0x127299['query']['fields']));_0x3c08d1[_0x5550('0x45')]=_0x3c08d1[_0x5550('0x45')][_0x5550('0x55')]?_0x3c08d1[_0x5550('0x45')]:_0x108c6e[_0x5550('0x40')];if(_0x127299[_0x5550('0x41')]['includeAll']){_0x3c08d1[_0x5550('0x4e')]=[{'all':!![]}];}_0x3c08d1=_[_0x5550('0x4b')]({},_0x3c08d1,_0x127299['options']);return db['WhatsappMessage'][_0x5550('0x56')](_0x3c08d1)[_0x5550('0x20')](handleEntityNotFound(_0x2ba284,null))['then'](respondWithResult(_0x2ba284,null))['catch'](handleError(_0x2ba284,null));};exports[_0x5550('0x57')]=function(_0x60529e,_0x42b897){return db[_0x5550('0x3d')][_0x5550('0x57')](_0x60529e[_0x5550('0x58')],{})['then'](respondWithResult(_0x42b897,0xc9))[_0x5550('0x50')](handleError(_0x42b897,null));};exports[_0x5550('0x36')]=function(_0x2ae885,_0x4aeae3){if(_0x2ae885[_0x5550('0x58')]['id']){delete _0x2ae885['body']['id'];}return db[_0x5550('0x3d')][_0x5550('0x56')]({'where':{'id':_0x2ae885[_0x5550('0x52')]['id']}})[_0x5550('0x20')](handleEntityNotFound(_0x4aeae3,null))[_0x5550('0x20')](saveUpdates(_0x2ae885[_0x5550('0x58')],null))[_0x5550('0x20')](respondWithResult(_0x4aeae3,null))['catch'](handleError(_0x4aeae3,null));};exports[_0x5550('0x37')]=function(_0x4f9c81,_0x291252){return db[_0x5550('0x3d')][_0x5550('0x56')]({'where':{'id':_0x4f9c81['params']['id']}})[_0x5550('0x20')](handleEntityNotFound(_0x291252,null))[_0x5550('0x20')](removeEntity(_0x291252,null))[_0x5550('0x50')](handleError(_0x291252,null));};exports[_0x5550('0x59')]=function(_0x3aa400,_0xe7ba28){return db[_0x5550('0x3d')]['describe']()['then'](respondWithResult(_0xe7ba28,null))[_0x5550('0x50')](handleError(_0xe7ba28,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x5550('0x5a')]=function(_0x1aa7ac,_0x311810,_0x598402){var _0x1ee313={'agent':{},'channel':_0x5550('0x5b')};if(_0x1aa7ac[_0x5550('0x58')]['id']){delete _0x1aa7ac[_0x5550('0x58')]['id'];}_0x1aa7ac[_0x5550('0x58')][_0x5550('0x5c')]=!![];_0x1aa7ac[_0x5550('0x58')][_0x5550('0x5d')]=moment()['format'](_0x5550('0x5e'));_0x1aa7ac[_0x5550('0x58')][_0x5550('0x5f')]=_0x1aa7ac[_0x5550('0x58')][_0x5550('0x5f')]||_0x1aa7ac[_0x5550('0x60')]['id'];_0x1ee313[_0x5550('0x61')]['id']=_0x1aa7ac[_0x5550('0x58')][_0x5550('0x5f')];return db[_0x5550('0x3d')][_0x5550('0x56')]({'where':{'id':_0x1aa7ac[_0x5550('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x311810,null))[_0x5550('0x20')](saveUpdates(_0x1aa7ac[_0x5550('0x58')],null))[_0x5550('0x20')](function(_0x1d0140){if(_0x1d0140){_0x1ee313[_0x5550('0x29')]=_0x1d0140['get']({'plain':!![]});return db['WhatsappInteraction'][_0x5550('0x56')]({'where':{'id':_0x1d0140[_0x5550('0x62')]}});}return null;})[_0x5550('0x20')](handleEntityNotFound(_0x311810,null))[_0x5550('0x20')](function(_0x27c4dd){if(_0x27c4dd){return _0x27c4dd[_0x5550('0x36')]({'UserId':_0x1aa7ac[_0x5550('0x58')][_0x5550('0x5f')],'read1stAt':_[_0x5550('0x63')](_0x27c4dd[_0x5550('0x64')])?moment()[_0x5550('0x65')](_0x5550('0x5e')):undefined});}return null;})['then'](function(_0xba4a9c){if(_0xba4a9c){_0x1ee313[_0x5550('0x66')]=_0xba4a9c[_0x5550('0x67')]({'plain':!![]});interaction_log[_0x5550('0x21')](_0x5550('0x68'),_0x1aa7ac[_0x5550('0x60')]['id'],_0x1aa7ac[_0x5550('0x60')][_0x5550('0x39')],_0x1aa7ac[_0x5550('0x60')]['role'],_0x1ee313[_0x5550('0x66')]['id'],_0x1aa7ac[_0x5550('0x58')]?JSON[_0x5550('0x26')](_0x1aa7ac[_0x5550('0x58')]):_0x5550('0x69'));return respondWithRpcPromise('AcceptMessage',_0x5550('0x6a'),_0x1ee313);}return null;})[_0x5550('0x20')](function(_0x45c64b){var _0x3345e9=_0x5550('0x6b')+_0x45c64b['message'][_0x5550('0x6c')];return db[_0x5550('0x6d')][_0x5550('0x41')](_0x3345e9,{'type':db[_0x5550('0x6e')]['QueryTypes'][_0x5550('0x6f')],'raw':!![]})['then'](function(_0x4116c3){return _0x4116c3;});})[_0x5550('0x20')](function(_0x1cc2b3){if(_0x1cc2b3){_0x1ee313[_0x5550('0x29')][_0x5550('0x70')]=_0x1cc2b3[0x0];if(!_0x1aa7ac['body'][_0x5550('0x5f')])return;return db[_0x5550('0x71')][_0x5550('0x56')]({'where':{'id':_0x1aa7ac[_0x5550('0x58')][_0x5550('0x5f')],'role':'agent'},'attributes':['id',_0x5550('0x39'),_0x5550('0x72'),_0x5550('0x73'),'internal'],'raw':!![]});}return null;})[_0x5550('0x20')](function(_0x234f97){if(!_0x234f97)return null;_0x1ee313[_0x5550('0x29')][_0x5550('0x61')]=_0x234f97;return _0x1ee313;})[_0x5550('0x20')](function(_0x440efc){if(_0x440efc){if(_0x1aa7ac[_0x5550('0x58')][_0x5550('0x74')]){_0x1ee313[_0x5550('0x29')][_0x5550('0x75')]=util[_0x5550('0x65')]('SIP/%s',_0x1aa7ac[_0x5550('0x60')]['name']);_0x1ee313[_0x5550('0x29')][_0x5550('0x76')]=_0x1ee313[_0x5550('0x76')];_0x1ee313[_0x5550('0x29')][_0x5550('0x77')]=_0x1ee313['channel'];_0x1ee313[_0x5550('0x29')][_0x5550('0x78')]=_0x5550('0x5a');return respondWithRpcPromise(_0x5550('0x79'),_0x5550('0x79'),{'event':_0x5550('0x7a'),'message':_0x1ee313[_0x5550('0x29')]},client9002)[_0x5550('0x20')](function(){return _0x1ee313;});}return _0x1ee313;}return null;})[_0x5550('0x20')](respondWithResult(_0x311810,null))[_0x5550('0x50')](handleError(_0x311810,null));};var interaction_log=require('../../config/logger')(_0x5550('0x7b'));exports[_0x5550('0x35')]=function(_0x4a1dba,_0x1ba637,_0x450f6e){var _0x3d60e2={'agent':{},'channel':_0x5550('0x5b')};if(_0x4a1dba['body']['id']){delete _0x4a1dba[_0x5550('0x58')]['id'];}_0x4a1dba['body'][_0x5550('0x5f')]=_0x4a1dba[_0x5550('0x58')][_0x5550('0x5f')]||_0x4a1dba[_0x5550('0x60')]['id'];_0x3d60e2[_0x5550('0x61')]['id']=_0x4a1dba[_0x5550('0x58')][_0x5550('0x5f')];return db[_0x5550('0x3d')]['find']({'where':{'id':_0x4a1dba[_0x5550('0x52')]['id'],'UserId':null}})[_0x5550('0x20')](handleEntityNotFound(_0x1ba637,null))[_0x5550('0x20')](function(_0x343dfd){if(_0x343dfd){_0x3d60e2['message']=_0x343dfd['get']({'plain':!![]});return db['WhatsappInteraction'][_0x5550('0x56')]({'where':{'id':_0x343dfd[_0x5550('0x62')]}});}return null;})[_0x5550('0x20')](handleEntityNotFound(_0x1ba637,null))[_0x5550('0x20')](function(_0x29ce0b){if(_0x29ce0b){_0x3d60e2[_0x5550('0x66')]=_0x29ce0b[_0x5550('0x67')]({'plain':!![]});interaction_log[_0x5550('0x21')](_0x5550('0x7c'),_0x4a1dba[_0x5550('0x60')]['id'],_0x4a1dba[_0x5550('0x60')][_0x5550('0x39')],_0x4a1dba[_0x5550('0x60')][_0x5550('0x7d')],_0x3d60e2[_0x5550('0x66')]['id'],_0x4a1dba['body']?JSON['stringify'](_0x4a1dba['body']):_0x5550('0x69'));return respondWithRpcPromise('RejectMessage',_0x5550('0x7e'),_0x3d60e2);}return null;})[_0x5550('0x20')](function(_0x15c6a2){var _0x30def5=_0x5550('0x6b')+_0x15c6a2[_0x5550('0x29')]['ContactId'];return db['sequelize']['query'](_0x30def5,{'type':db[_0x5550('0x6e')][_0x5550('0x7f')]['SELECT'],'raw':!![]})['then'](function(_0x2e7821){return _0x2e7821;});})[_0x5550('0x20')](function(_0x38c155){if(_0x38c155){_0x3d60e2[_0x5550('0x29')][_0x5550('0x70')]=_0x38c155[0x0];if(!_0x4a1dba['body'][_0x5550('0x5f')])return;return db[_0x5550('0x71')][_0x5550('0x56')]({'where':{'id':_0x4a1dba['body']['UserId'],'role':_0x5550('0x61')},'attributes':['id',_0x5550('0x39'),_0x5550('0x72'),_0x5550('0x73'),_0x5550('0x80')],'raw':!![]});}return null;})[_0x5550('0x20')](function(_0xf1f85f){if(!_0xf1f85f)return null;_0x3d60e2[_0x5550('0x29')]['agent']=_0xf1f85f;return _0x3d60e2;})['then'](function(_0x399cb6){if(_0x399cb6){_0x399cb6['message'][_0x5550('0x75')]=util['format']('SIP/%s',_0x4a1dba[_0x5550('0x60')][_0x5550('0x39')]);_0x399cb6['message']['channel']=_0x3d60e2['channel'];_0x399cb6[_0x5550('0x29')][_0x5550('0x77')]=_0x3d60e2[_0x5550('0x76')];_0x399cb6[_0x5550('0x29')][_0x5550('0x78')]='reject';respondWithRpcPromise(_0x5550('0x79'),'EventManager',{'event':_0x5550('0x81'),'message':_0x399cb6[_0x5550('0x29')]},client9002);return _0x3d60e2;}return null;})[_0x5550('0x20')](respondWithResult(_0x1ba637,null))['catch'](handleError(_0x1ba637,null));};exports[_0x5550('0x2c')]=function(_0x16bbe3,_0xfe5e9b,_0x26d7ba){if(_0x16bbe3[_0x5550('0x58')]['id']){delete _0x16bbe3[_0x5550('0x58')]['id'];}var _0x3087eb;return db['WhatsappMessage'][_0x5550('0x56')]({'where':{'id':_0x16bbe3[_0x5550('0x52')]['id']}})['then'](handleEntityNotFound(_0xfe5e9b,null))[_0x5550('0x20')](function(_0x2ad00a){if(_0x2ad00a){_0x3087eb=_0x2ad00a;return db[_0x5550('0x82')]['find']({'where':{'id':_0x2ad00a[_0x5550('0x83')]}});}})[_0x5550('0x20')](handleEntityNotFound(_0xfe5e9b,null))['then'](function(_0x2c4512){if(_0x2c4512){logger[_0x5550('0x24')](_0x5550('0x84'),'status',_0x5550('0x85'),_0x2c4512[_0x5550('0x3f')],util[_0x5550('0x86')](_0x16bbe3[_0x5550('0x58')],{'showHidden':![],'depth':null}));switch(_0x2c4512['type']){case _0x5550('0x87'):if(_0x16bbe3[_0x5550('0x58')]['MessageSid']&&_0x16bbe3[_0x5550('0x58')][_0x5550('0x88')]===_0x3087eb[_0x5550('0x89')]&&_0x16bbe3['body'][_0x5550('0x8a')]&&_0x16bbe3[_0x5550('0x58')][_0x5550('0x8a')]===_0x5550('0x5c')){return _0x3087eb['update']({'read':!![]});}else{logger['error'](_0x5550('0x8b'),'status',_0x5550('0x87'),util[_0x5550('0x86')](_0x16bbe3[_0x5550('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3087eb;}})[_0x5550('0x20')](respondWithResult(_0xfe5e9b,null))[_0x5550('0x50')](handleError(_0xfe5e9b,null));}; \ No newline at end of file +var _0xfa93=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','name','map','WhatsappMessage','fieldName','type','key','model','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','includeAll','findAll','rows','show','params','keys','rawAttributes','length','options','find','create','body','destroy','describe','accept','whatsapp','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','WhatsappInteractionId','isNil','interaction','get','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','whatsapp-interactions','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','rejectMessage','SELECT','contact','rejectmessage','WhatsappAccount','WhatsappAccountId','debug','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x4ab00b,_0x501d64){var _0x41957f=function(_0x463aed){while(--_0x463aed){_0x4ab00b['push'](_0x4ab00b['shift']());}};_0x41957f(++_0x501d64);}(_0xfa93,0x109));var _0x3fa9=function(_0x4953c0,_0x2a9d5f){_0x4953c0=_0x4953c0-0x0;var _0x597032=_0xfa93[_0x4953c0];return _0x597032;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3fa9('0x0'));var zipdir=require(_0x3fa9('0x1'));var jsonpatch=require(_0x3fa9('0x2'));var rp=require(_0x3fa9('0x3'));var moment=require(_0x3fa9('0x4'));var BPromise=require(_0x3fa9('0x5'));var Mustache=require('mustache');var util=require(_0x3fa9('0x6'));var path=require(_0x3fa9('0x7'));var sox=require(_0x3fa9('0x8'));var csv=require(_0x3fa9('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3fa9('0xa'));var _=require(_0x3fa9('0xb'));var squel=require(_0x3fa9('0xc'));var crypto=require(_0x3fa9('0xd'));var jsforce=require(_0x3fa9('0xe'));var deskjs=require(_0x3fa9('0xf'));var toCsv=require(_0x3fa9('0x9'));var querystring=require(_0x3fa9('0x10'));var Papa=require(_0x3fa9('0x11'));var Redis=require(_0x3fa9('0x12'));var authService=require(_0x3fa9('0x13'));var qs=require(_0x3fa9('0x14'));var as=require(_0x3fa9('0x15'));var hardwareService=require(_0x3fa9('0x16'));var logger=require('../../config/logger')(_0x3fa9('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3fa9('0x18'))['db'];config[_0x3fa9('0x19')]=_['defaults'](config['redis'],{'host':_0x3fa9('0x1a'),'port':0x18eb});var socket=require(_0x3fa9('0x1b'))(new Redis(config[_0x3fa9('0x19')]));require(_0x3fa9('0x1c'))[_0x3fa9('0x1d')](socket);var jayson=require(_0x3fa9('0x1e'));var client=jayson[_0x3fa9('0x1f')][_0x3fa9('0x20')]({'port':0x232c});var client9002=jayson[_0x3fa9('0x1f')][_0x3fa9('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x21cec6,_0x1a25ca,_0xb62d54,_0x175f6d){return new BPromise(function(_0x8a8a43,_0x1cb8fc){var _0x3d58f4=_0x175f6d||client;return _0x3d58f4[_0x3fa9('0x21')](_0x21cec6,_0xb62d54)[_0x3fa9('0x22')](function(_0x4d2b64){logger[_0x3fa9('0x23')](_0x3fa9('0x24'),_0x1a25ca,_0x3fa9('0x25'));logger['debug'](_0x3fa9('0x26'),_0x1a25ca,'request\x20sent',JSON['stringify'](_0x4d2b64));if(_0x4d2b64[_0x3fa9('0x27')]){if(_0x4d2b64[_0x3fa9('0x27')][_0x3fa9('0x28')]===0x1f4){logger[_0x3fa9('0x27')]('WhatsappMessage,\x20%s,\x20%s',_0x1a25ca,_0x4d2b64[_0x3fa9('0x27')]['message']);return _0x1cb8fc(_0x4d2b64[_0x3fa9('0x27')][_0x3fa9('0x29')]);}logger[_0x3fa9('0x27')](_0x3fa9('0x24'),_0x1a25ca,_0x4d2b64[_0x3fa9('0x27')]['message']);return _0x8a8a43(_0x4d2b64[_0x3fa9('0x27')][_0x3fa9('0x29')]);}else{logger[_0x3fa9('0x23')](_0x3fa9('0x24'),_0x1a25ca,_0x3fa9('0x25'));_0x8a8a43(_0x4d2b64[_0x3fa9('0x2a')][_0x3fa9('0x29')]);}})[_0x3fa9('0x2b')](function(_0x2fffe3){logger['error'](_0x3fa9('0x24'),_0x1a25ca,_0x2fffe3);_0x1cb8fc(_0x2fffe3);});});}function respondWithStatusCode(_0x3c950a,_0x1738c5){_0x1738c5=_0x1738c5||0xcc;return function(_0x351bab){if(_0x351bab){return _0x3c950a[_0x3fa9('0x2c')](_0x1738c5);}return _0x3c950a[_0x3fa9('0x2d')](_0x1738c5)[_0x3fa9('0x2e')]();};}function respondWithResult(_0x412195,_0x31d628){_0x31d628=_0x31d628||0xc8;return function(_0x4cc57e){if(_0x4cc57e){return _0x412195[_0x3fa9('0x2d')](_0x31d628)[_0x3fa9('0x2f')](_0x4cc57e);}};}function respondWithFilteredResult(_0x4f0ac3,_0x351360){return function(_0x5baae3){if(_0x5baae3){var _0x588965=typeof _0x351360['offset']===_0x3fa9('0x30')&&typeof _0x351360[_0x3fa9('0x31')]===_0x3fa9('0x30');var _0x275525=_0x5baae3[_0x3fa9('0x32')];var _0x288ab3=_0x588965?0x0:_0x351360[_0x3fa9('0x33')];var _0x573d64=_0x588965?_0x5baae3[_0x3fa9('0x32')]:_0x351360['offset']+_0x351360[_0x3fa9('0x31')];var _0x4d54a1;if(_0x573d64>=_0x275525){_0x573d64=_0x275525;_0x4d54a1=0xc8;}else{_0x4d54a1=0xce;}_0x4f0ac3[_0x3fa9('0x2d')](_0x4d54a1);return _0x4f0ac3[_0x3fa9('0x34')](_0x3fa9('0x35'),_0x288ab3+'-'+_0x573d64+'/'+_0x275525)[_0x3fa9('0x2f')](_0x5baae3);}return null;};}function patchUpdates(_0xe90b7f){return function(_0x265887){try{jsonpatch[_0x3fa9('0x36')](_0x265887,_0xe90b7f,!![]);}catch(_0x4fc1d1){return BPromise[_0x3fa9('0x37')](_0x4fc1d1);}return _0x265887[_0x3fa9('0x38')]();};}function saveUpdates(_0x3f0d2b,_0x2f4d06){return function(_0x4a9cf6){if(_0x4a9cf6){return _0x4a9cf6[_0x3fa9('0x39')](_0x3f0d2b)[_0x3fa9('0x22')](function(_0x3e36a5){return _0x3e36a5;});}return null;};}function removeEntity(_0x3f58cb,_0x7911d8){return function(_0x43626d){if(_0x43626d){return _0x43626d['destroy']()[_0x3fa9('0x22')](function(){_0x3f58cb[_0x3fa9('0x2d')](0xcc)[_0x3fa9('0x2e')]();});}};}function handleEntityNotFound(_0x3b1cd5,_0x66194c){return function(_0xed6bcb){if(!_0xed6bcb){_0x3b1cd5[_0x3fa9('0x2c')](0x194);}return _0xed6bcb;};}function handleError(_0x2c0145,_0x12ecfa){_0x12ecfa=_0x12ecfa||0x1f4;return function(_0x23035a){logger[_0x3fa9('0x27')](_0x23035a['stack']);if(_0x23035a[_0x3fa9('0x3a')]){delete _0x23035a[_0x3fa9('0x3a')];}_0x2c0145[_0x3fa9('0x2d')](_0x12ecfa)['send'](_0x23035a);};}exports['index']=function(_0x42d6de,_0x3abe64){var _0x40cd9c={},_0x88f17b={},_0x1b6a37={'count':0x0,'rows':[]};var _0x342b81=_[_0x3fa9('0x3b')](db[_0x3fa9('0x3c')]['rawAttributes'],function(_0x1aa2e9){return{'name':_0x1aa2e9[_0x3fa9('0x3d')],'type':_0x1aa2e9[_0x3fa9('0x3e')][_0x3fa9('0x3f')]};});_0x88f17b[_0x3fa9('0x40')]=_[_0x3fa9('0x3b')](_0x342b81,_0x3fa9('0x3a'));_0x88f17b[_0x3fa9('0x41')]=_['keys'](_0x42d6de[_0x3fa9('0x41')]);_0x88f17b['filters']=_['intersection'](_0x88f17b[_0x3fa9('0x40')],_0x88f17b[_0x3fa9('0x41')]);_0x40cd9c[_0x3fa9('0x42')]=_[_0x3fa9('0x43')](_0x88f17b[_0x3fa9('0x40')],qs['fields'](_0x42d6de['query'][_0x3fa9('0x44')]));_0x40cd9c[_0x3fa9('0x42')]=_0x40cd9c[_0x3fa9('0x42')]['length']?_0x40cd9c[_0x3fa9('0x42')]:_0x88f17b[_0x3fa9('0x40')];if(!_0x42d6de[_0x3fa9('0x41')][_0x3fa9('0x45')](_0x3fa9('0x46'))){_0x40cd9c['limit']=qs['limit'](_0x42d6de[_0x3fa9('0x41')]['limit']);_0x40cd9c[_0x3fa9('0x33')]=qs[_0x3fa9('0x33')](_0x42d6de['query']['offset']);}_0x40cd9c[_0x3fa9('0x47')]=qs[_0x3fa9('0x48')](_0x42d6de['query'][_0x3fa9('0x48')]);_0x40cd9c[_0x3fa9('0x49')]=qs[_0x3fa9('0x4a')](_[_0x3fa9('0x4b')](_0x42d6de['query'],_0x88f17b['filters']),_0x342b81);if(_0x42d6de[_0x3fa9('0x41')]['filter']){_0x40cd9c['where']=_[_0x3fa9('0x4c')](_0x40cd9c[_0x3fa9('0x49')],{'$or':_[_0x3fa9('0x3b')](_0x342b81,function(_0x5612bf){if(_0x5612bf[_0x3fa9('0x3e')]!=='VIRTUAL'){var _0xfa6185={};_0xfa6185[_0x5612bf[_0x3fa9('0x3a')]]={'$like':'%'+_0x42d6de[_0x3fa9('0x41')]['filter']+'%'};return _0xfa6185;}})});}_0x40cd9c=_[_0x3fa9('0x4c')]({},_0x40cd9c,_0x42d6de['options']);var _0x371cdc={'where':_0x40cd9c[_0x3fa9('0x49')]};return db[_0x3fa9('0x3c')][_0x3fa9('0x32')](_0x371cdc)[_0x3fa9('0x22')](function(_0x586b89){_0x1b6a37[_0x3fa9('0x32')]=_0x586b89;if(_0x42d6de[_0x3fa9('0x41')][_0x3fa9('0x4d')]){_0x40cd9c['include']=[{'all':!![]}];}return db[_0x3fa9('0x3c')][_0x3fa9('0x4e')](_0x40cd9c);})[_0x3fa9('0x22')](function(_0x52f71a){_0x1b6a37[_0x3fa9('0x4f')]=_0x52f71a;return _0x1b6a37;})[_0x3fa9('0x22')](respondWithFilteredResult(_0x3abe64,_0x40cd9c))[_0x3fa9('0x2b')](handleError(_0x3abe64,null));};exports[_0x3fa9('0x50')]=function(_0x432bc6,_0x48759d){var _0x92178d={'raw':!![],'where':{'id':_0x432bc6[_0x3fa9('0x51')]['id']}},_0x43baa0={};_0x43baa0['model']=_[_0x3fa9('0x52')](db[_0x3fa9('0x3c')][_0x3fa9('0x53')]);_0x43baa0[_0x3fa9('0x41')]=_[_0x3fa9('0x52')](_0x432bc6[_0x3fa9('0x41')]);_0x43baa0[_0x3fa9('0x4a')]=_[_0x3fa9('0x43')](_0x43baa0['model'],_0x43baa0['query']);_0x92178d[_0x3fa9('0x42')]=_[_0x3fa9('0x43')](_0x43baa0[_0x3fa9('0x40')],qs['fields'](_0x432bc6[_0x3fa9('0x41')][_0x3fa9('0x44')]));_0x92178d[_0x3fa9('0x42')]=_0x92178d['attributes'][_0x3fa9('0x54')]?_0x92178d[_0x3fa9('0x42')]:_0x43baa0[_0x3fa9('0x40')];if(_0x432bc6['query'][_0x3fa9('0x4d')]){_0x92178d['include']=[{'all':!![]}];}_0x92178d=_['merge']({},_0x92178d,_0x432bc6[_0x3fa9('0x55')]);return db[_0x3fa9('0x3c')][_0x3fa9('0x56')](_0x92178d)['then'](handleEntityNotFound(_0x48759d,null))[_0x3fa9('0x22')](respondWithResult(_0x48759d,null))[_0x3fa9('0x2b')](handleError(_0x48759d,null));};exports['create']=function(_0x3994f7,_0xb95c87){return db[_0x3fa9('0x3c')][_0x3fa9('0x57')](_0x3994f7[_0x3fa9('0x58')],{})['then'](respondWithResult(_0xb95c87,0xc9))[_0x3fa9('0x2b')](handleError(_0xb95c87,null));};exports['update']=function(_0x107a76,_0x2637f1){if(_0x107a76[_0x3fa9('0x58')]['id']){delete _0x107a76[_0x3fa9('0x58')]['id'];}return db['WhatsappMessage'][_0x3fa9('0x56')]({'where':{'id':_0x107a76['params']['id']}})[_0x3fa9('0x22')](handleEntityNotFound(_0x2637f1,null))[_0x3fa9('0x22')](saveUpdates(_0x107a76[_0x3fa9('0x58')],null))[_0x3fa9('0x22')](respondWithResult(_0x2637f1,null))[_0x3fa9('0x2b')](handleError(_0x2637f1,null));};exports[_0x3fa9('0x59')]=function(_0xb21cac,_0x95fb89){return db[_0x3fa9('0x3c')][_0x3fa9('0x56')]({'where':{'id':_0xb21cac[_0x3fa9('0x51')]['id']}})['then'](handleEntityNotFound(_0x95fb89,null))[_0x3fa9('0x22')](removeEntity(_0x95fb89,null))['catch'](handleError(_0x95fb89,null));};exports[_0x3fa9('0x5a')]=function(_0x2064c2,_0x18c145){return db['WhatsappMessage']['describe']()['then'](respondWithResult(_0x18c145,null))[_0x3fa9('0x2b')](handleError(_0x18c145,null));};var interaction_log=require('../../config/logger')('whatsapp-interactions');exports[_0x3fa9('0x5b')]=function(_0x523a93,_0x3660c8,_0x475805){var _0x3c3b8e={'agent':{},'channel':_0x3fa9('0x5c')};if(_0x523a93[_0x3fa9('0x58')]['id']){delete _0x523a93[_0x3fa9('0x58')]['id'];}_0x523a93[_0x3fa9('0x58')][_0x3fa9('0x5d')]=!![];_0x523a93[_0x3fa9('0x58')][_0x3fa9('0x5e')]=moment()[_0x3fa9('0x5f')](_0x3fa9('0x60'));_0x523a93['body'][_0x3fa9('0x61')]=_0x523a93[_0x3fa9('0x58')][_0x3fa9('0x61')]||_0x523a93[_0x3fa9('0x62')]['id'];_0x3c3b8e[_0x3fa9('0x63')]['id']=_0x523a93['body'][_0x3fa9('0x61')];return db[_0x3fa9('0x3c')][_0x3fa9('0x56')]({'where':{'id':_0x523a93[_0x3fa9('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3660c8,null))[_0x3fa9('0x22')](saveUpdates(_0x523a93[_0x3fa9('0x58')],null))['then'](function(_0x270aa7){if(_0x270aa7){_0x3c3b8e[_0x3fa9('0x29')]=_0x270aa7['get']({'plain':!![]});return db['WhatsappInteraction'][_0x3fa9('0x56')]({'where':{'id':_0x270aa7[_0x3fa9('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x3660c8,null))[_0x3fa9('0x22')](function(_0x51819c){if(_0x51819c){return _0x51819c[_0x3fa9('0x39')]({'UserId':_0x523a93[_0x3fa9('0x58')]['UserId'],'read1stAt':_[_0x3fa9('0x65')](_0x51819c['read1stAt'])?moment()['format'](_0x3fa9('0x60')):undefined});}return null;})[_0x3fa9('0x22')](function(_0x1a4a74){if(_0x1a4a74){_0x3c3b8e[_0x3fa9('0x66')]=_0x1a4a74[_0x3fa9('0x67')]({'plain':!![]});interaction_log[_0x3fa9('0x23')](_0x3fa9('0x68'),_0x523a93[_0x3fa9('0x62')]['id'],_0x523a93[_0x3fa9('0x62')]['name'],_0x523a93['user']['role'],_0x3c3b8e[_0x3fa9('0x66')]['id'],_0x523a93['body']?JSON[_0x3fa9('0x69')](_0x523a93[_0x3fa9('0x58')]):'null');return respondWithRpcPromise('AcceptMessage',_0x3fa9('0x6a'),_0x3c3b8e);}return null;})[_0x3fa9('0x22')](function(_0x2b03b1){var _0x1ba9ae=_0x3fa9('0x6b')+_0x2b03b1[_0x3fa9('0x29')][_0x3fa9('0x6c')];return db[_0x3fa9('0x6d')]['query'](_0x1ba9ae,{'type':db[_0x3fa9('0x6e')][_0x3fa9('0x6f')]['SELECT'],'raw':!![]})[_0x3fa9('0x22')](function(_0x38b0ac){return _0x38b0ac;});})[_0x3fa9('0x22')](function(_0x15fa25){if(_0x15fa25){_0x3c3b8e['message']['contact']=_0x15fa25[0x0];if(!_0x523a93[_0x3fa9('0x58')][_0x3fa9('0x61')])return;return db[_0x3fa9('0x70')][_0x3fa9('0x56')]({'where':{'id':_0x523a93['body'][_0x3fa9('0x61')],'role':_0x3fa9('0x63')},'attributes':['id',_0x3fa9('0x3a'),_0x3fa9('0x71'),_0x3fa9('0x72'),_0x3fa9('0x73')],'raw':!![]});}return null;})[_0x3fa9('0x22')](function(_0x496cbd){if(!_0x496cbd)return null;_0x3c3b8e[_0x3fa9('0x29')][_0x3fa9('0x63')]=_0x496cbd;return _0x3c3b8e;})[_0x3fa9('0x22')](function(_0x44be35){if(_0x44be35){if(_0x523a93[_0x3fa9('0x58')][_0x3fa9('0x74')]){_0x3c3b8e['message'][_0x3fa9('0x75')]=util[_0x3fa9('0x5f')](_0x3fa9('0x76'),_0x523a93[_0x3fa9('0x62')][_0x3fa9('0x3a')]);_0x3c3b8e['message'][_0x3fa9('0x77')]=_0x3c3b8e['channel'];_0x3c3b8e['message'][_0x3fa9('0x78')]=_0x3c3b8e['channel'];_0x3c3b8e[_0x3fa9('0x29')][_0x3fa9('0x79')]=_0x3fa9('0x5b');return respondWithRpcPromise(_0x3fa9('0x7a'),_0x3fa9('0x7a'),{'event':_0x3fa9('0x7b'),'message':_0x3c3b8e[_0x3fa9('0x29')]},client9002)['then'](function(){return _0x3c3b8e;});}return _0x3c3b8e;}return null;})[_0x3fa9('0x22')](respondWithResult(_0x3660c8,null))[_0x3fa9('0x2b')](handleError(_0x3660c8,null));};var interaction_log=require('../../config/logger')(_0x3fa9('0x7c'));exports[_0x3fa9('0x37')]=function(_0x1efbd1,_0x510990,_0x138515){var _0x259cab={'agent':{},'channel':_0x3fa9('0x5c')};if(_0x1efbd1[_0x3fa9('0x58')]['id']){delete _0x1efbd1['body']['id'];}_0x1efbd1['body'][_0x3fa9('0x61')]=_0x1efbd1[_0x3fa9('0x58')]['UserId']||_0x1efbd1[_0x3fa9('0x62')]['id'];_0x259cab['agent']['id']=_0x1efbd1[_0x3fa9('0x58')][_0x3fa9('0x61')];return db[_0x3fa9('0x3c')]['find']({'where':{'id':_0x1efbd1[_0x3fa9('0x51')]['id'],'UserId':null}})[_0x3fa9('0x22')](handleEntityNotFound(_0x510990,null))[_0x3fa9('0x22')](function(_0x7808c5){if(_0x7808c5){_0x259cab[_0x3fa9('0x29')]=_0x7808c5[_0x3fa9('0x67')]({'plain':!![]});return db['WhatsappInteraction']['find']({'where':{'id':_0x7808c5[_0x3fa9('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x510990,null))[_0x3fa9('0x22')](function(_0x532cec){if(_0x532cec){_0x259cab[_0x3fa9('0x66')]=_0x532cec[_0x3fa9('0x67')]({'plain':!![]});interaction_log[_0x3fa9('0x23')](_0x3fa9('0x7d'),_0x1efbd1[_0x3fa9('0x62')]['id'],_0x1efbd1['user'][_0x3fa9('0x3a')],_0x1efbd1[_0x3fa9('0x62')][_0x3fa9('0x7e')],_0x259cab[_0x3fa9('0x66')]['id'],_0x1efbd1[_0x3fa9('0x58')]?JSON[_0x3fa9('0x69')](_0x1efbd1['body']):_0x3fa9('0x7f'));return respondWithRpcPromise('RejectMessage',_0x3fa9('0x80'),_0x259cab);}return null;})[_0x3fa9('0x22')](function(_0x9eda4a){var _0x3d5228=_0x3fa9('0x6b')+_0x9eda4a[_0x3fa9('0x29')][_0x3fa9('0x6c')];return db[_0x3fa9('0x6d')][_0x3fa9('0x41')](_0x3d5228,{'type':db['Sequelize'][_0x3fa9('0x6f')][_0x3fa9('0x81')],'raw':!![]})[_0x3fa9('0x22')](function(_0x11f34d){return _0x11f34d;});})[_0x3fa9('0x22')](function(_0x3ce512){if(_0x3ce512){_0x259cab[_0x3fa9('0x29')][_0x3fa9('0x82')]=_0x3ce512[0x0];if(!_0x1efbd1[_0x3fa9('0x58')]['UserId'])return;return db[_0x3fa9('0x70')][_0x3fa9('0x56')]({'where':{'id':_0x1efbd1[_0x3fa9('0x58')]['UserId'],'role':_0x3fa9('0x63')},'attributes':['id',_0x3fa9('0x3a'),_0x3fa9('0x71'),_0x3fa9('0x72'),_0x3fa9('0x73')],'raw':!![]});}return null;})[_0x3fa9('0x22')](function(_0x5298bb){if(!_0x5298bb)return null;_0x259cab[_0x3fa9('0x29')][_0x3fa9('0x63')]=_0x5298bb;return _0x259cab;})[_0x3fa9('0x22')](function(_0x1946d9){if(_0x1946d9){_0x1946d9[_0x3fa9('0x29')][_0x3fa9('0x75')]=util[_0x3fa9('0x5f')](_0x3fa9('0x76'),_0x1efbd1[_0x3fa9('0x62')][_0x3fa9('0x3a')]);_0x1946d9[_0x3fa9('0x29')][_0x3fa9('0x77')]=_0x259cab[_0x3fa9('0x77')];_0x1946d9[_0x3fa9('0x29')][_0x3fa9('0x78')]=_0x259cab['channel'];_0x1946d9[_0x3fa9('0x29')][_0x3fa9('0x79')]=_0x3fa9('0x37');respondWithRpcPromise(_0x3fa9('0x7a'),'EventManager',{'event':_0x3fa9('0x83'),'message':_0x1946d9[_0x3fa9('0x29')]},client9002);return _0x259cab;}return null;})[_0x3fa9('0x22')](respondWithResult(_0x510990,null))[_0x3fa9('0x2b')](handleError(_0x510990,null));};exports[_0x3fa9('0x2d')]=function(_0x574d80,_0x2689ec,_0x50f424){if(_0x574d80[_0x3fa9('0x58')]['id']){delete _0x574d80[_0x3fa9('0x58')]['id'];}var _0x390fa8;return db['WhatsappMessage'][_0x3fa9('0x56')]({'where':{'id':_0x574d80[_0x3fa9('0x51')]['id']}})[_0x3fa9('0x22')](handleEntityNotFound(_0x2689ec,null))[_0x3fa9('0x22')](function(_0x6c0d29){if(_0x6c0d29){_0x390fa8=_0x6c0d29;return db[_0x3fa9('0x84')][_0x3fa9('0x56')]({'where':{'id':_0x6c0d29[_0x3fa9('0x85')]}});}})['then'](handleEntityNotFound(_0x2689ec,null))[_0x3fa9('0x22')](function(_0xb7489f){if(_0xb7489f){logger[_0x3fa9('0x86')](_0x3fa9('0x87'),'status',_0x3fa9('0x88'),_0xb7489f[_0x3fa9('0x3e')],util['inspect'](_0x574d80[_0x3fa9('0x58')],{'showHidden':![],'depth':null}));switch(_0xb7489f[_0x3fa9('0x3e')]){case _0x3fa9('0x89'):if(_0x574d80[_0x3fa9('0x58')][_0x3fa9('0x8a')]&&_0x574d80['body'][_0x3fa9('0x8a')]===_0x390fa8[_0x3fa9('0x8b')]&&_0x574d80[_0x3fa9('0x58')][_0x3fa9('0x8c')]&&_0x574d80[_0x3fa9('0x58')][_0x3fa9('0x8c')]==='read'){return _0x390fa8[_0x3fa9('0x39')]({'read':!![]});}else{logger[_0x3fa9('0x27')](_0x3fa9('0x8d'),_0x3fa9('0x2d'),_0x3fa9('0x89'),util[_0x3fa9('0x8e')](_0x574d80['body'],{'showHidden':![],'depth':null}));}break;}return _0x390fa8;}})['then'](respondWithResult(_0x2689ec,null))['catch'](handleError(_0x2689ec,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 08b01c2..df78f2e 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 _0xbee3=['emit','hook','exports','../../mysqldb','save','update'];(function(_0x9e6c5c,_0x37e32c){var _0x5eee91=function(_0x3f5390){while(--_0x3f5390){_0x9e6c5c['push'](_0x9e6c5c['shift']());}};_0x5eee91(++_0x37e32c);}(_0xbee3,0xd5));var _0x3bee=function(_0x272dc8,_0x1f7592){_0x272dc8=_0x272dc8-0x0;var _0x42602a=_0xbee3[_0x272dc8];return _0x42602a;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x3bee('0x0'))['db']['WhatsappMessage'];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3bee('0x1'),'afterUpdate':_0x3bee('0x2'),'afterDestroy':'remove'};function emitEvent(_0x4b354b){return function(_0x1956c1,_0x1cf379,_0x507c6a){WhatsappMessageEvents[_0x3bee('0x3')](_0x4b354b+':'+_0x1956c1['id'],_0x1956c1);WhatsappMessageEvents[_0x3bee('0x3')](_0x4b354b,_0x1956c1);_0x507c6a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x3bee('0x4')](e,emitEvent(event));}}module[_0x3bee('0x5')]=WhatsappMessageEvents; \ No newline at end of file +var _0xa699=['setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x4ad364,_0x34d600){var _0x1ace8f=function(_0x4f4503){while(--_0x4f4503){_0x4ad364['push'](_0x4ad364['shift']());}};_0x1ace8f(++_0x34d600);}(_0xa699,0x6b));var _0x9a69=function(_0x10bcc4,_0x4400e2){_0x10bcc4=_0x10bcc4-0x0;var _0x2da988=_0xa699[_0x10bcc4];return _0x2da988;};'use strict';var EventEmitter=require(_0x9a69('0x0'));var WhatsappMessage=require(_0x9a69('0x1'))['db'][_0x9a69('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x9a69('0x3')](0x0);var events={'afterCreate':_0x9a69('0x4'),'afterUpdate':_0x9a69('0x5'),'afterDestroy':_0x9a69('0x6')};function emitEvent(_0x2d3e1f){return function(_0xadacc9,_0x3edccc,_0x143c4f){WhatsappMessageEvents[_0x9a69('0x7')](_0x2d3e1f+':'+_0xadacc9['id'],_0xadacc9);WhatsappMessageEvents[_0x9a69('0x7')](_0x2d3e1f,_0xadacc9);_0x143c4f(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x9a69('0x8')](e,emitEvent(event));}}module[_0x9a69('0x9')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 1a64245..22bc772 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 _0x5127=['WhatsappInteractionId','then','createdAt','toLowerCase','catch','secret','WhatsappAccount','WhatsappAccountId','type','authToken','phone','accountSid','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','update','error','WhatsappMessage,\x20%s,\x20%s,\x20%s','twilio','inspect','afterCreate','sinch','baseUrl','/whatsapp/v1/','text','POST','Bearer\x20','application/json','message_id','statuses','err','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','node-fetch','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','get','direction','out','isNil','UserId','WhatsappInteraction','findOne'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5127,0x64));var _0x7512=function(_0x3a5248,_0x34e201){_0x3a5248=_0x3a5248-0x0;var _0x4175a1=_0x5127[_0x3a5248];return _0x4175a1;};'use strict';var _=require(_0x7512('0x0'));var util=require(_0x7512('0x1'));var logger=require(_0x7512('0x2'))(_0x7512('0x3'));var moment=require('moment');var BPromise=require(_0x7512('0x4'));var rp=require(_0x7512('0x5'));var fetch=require(_0x7512('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7512('0x7'));var config=require(_0x7512('0x8'));var attributes=require(_0x7512('0x9'));module[_0x7512('0xa')]=function(_0x3140b3,_0x5d08ae){return _0x3140b3[_0x7512('0xb')](_0x7512('0xc'),attributes,{'tableName':_0x7512('0xd'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0x7512('0xe')]},{'name':_0x7512('0xf'),'fields':[_0x7512('0x10')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0xdcde3d,_0x37f90c,_0x6303ed){var _0x508ee7=_0x3140b3['models'];var _0x15141d=_0xdcde3d[_0x7512('0x11')]({'plain':!![]});if(_0x15141d[_0x7512('0x12')]['toLowerCase']()==='in'||_0x15141d[_0x7512('0x12')]['toLowerCase']()===_0x7512('0x13')&&!_0x15141d['secret']&&!_[_0x7512('0x14')](_0x15141d[_0x7512('0x15')])){_0x508ee7[_0x7512('0x16')][_0x7512('0x17')]({'where':{'id':_0x15141d[_0x7512('0x18')]}})[_0x7512('0x19')](function(_0x25a711){if(_0x25a711){_0x25a711['update']({'lastMsgAt':_0x15141d[_0x7512('0x1a')],'lastMsgDirection':_0x15141d[_0x7512('0x12')][_0x7512('0x1b')]()});}})[_0x7512('0x1c')](function(_0x289d21){console['error'](_0x289d21);});}if(_0x15141d['direction']==='out'&&!_0x15141d[_0x7512('0x1d')]){var _0x81c072;_0x508ee7[_0x7512('0x1e')]['find']({'where':{'id':_0x15141d[_0x7512('0x1f')]},'raw':!![]})[_0x7512('0x19')](function(_0x5ce79f){_0x81c072=_0x5ce79f;if(_0x81c072&&_0x81c072[_0x7512('0x20')]){switch(_0x81c072[_0x7512('0x20')]){case'twilio':var _0xf319a7=require('twilio');if(_0x81c072['accountSid']&&_0x81c072[_0x7512('0x21')]&&_0x81c072[_0x7512('0x22')]){var _0x41f14d=new _0xf319a7(_0x81c072[_0x7512('0x23')],_0x81c072[_0x7512('0x21')]);_0x41f14d['messages'][_0x7512('0x24')]({'body':_0x15141d[_0x7512('0x10')],'to':_0x7512('0x25')+_0x15141d[_0x7512('0x22')],'from':_0x7512('0x25')+_0x81c072[_0x7512('0x22')],'statusCallback':_0x81c072[_0x7512('0x26')]+_0x7512('0x27')+_0x15141d['id']+_0x7512('0x28')+_0x81c072[_0x7512('0x29')]})[_0x7512('0x19')](function(_0x837a5){if(_0x837a5[_0x7512('0x2a')]){return _0xdcde3d[_0x7512('0x2b')]({'messageId':_0x837a5[_0x7512('0x2a')]});}})[_0x7512('0x1c')](function(_0x282758){logger[_0x7512('0x2c')](_0x7512('0x2d'),'afterCreate',_0x7512('0x2e'),util[_0x7512('0x2f')](_0x282758,{'showHidden':![],'depth':null}));});}else{logger[_0x7512('0x2c')](_0x7512('0x2d'),_0x7512('0x30'),_0x7512('0x2e'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x7512('0x31'):var _0x51651d=_0x81c072[_0x7512('0x23')];var _0x2e13ab=_0x81c072[_0x7512('0x21')];var _0x1d3436=_0x81c072[_0x7512('0x32')]+_0x7512('0x33')+_0x51651d+'/messages/';var _0x46762d={'to':[_0x15141d[_0x7512('0x22')]],'message':{'type':_0x7512('0x34'),'text':_0x15141d[_0x7512('0x10')]}};var _0x5b8aea={'method':_0x7512('0x35'),'uri':_0x1d3436,'headers':{'Authorization':_0x7512('0x36')+_0x2e13ab,'Content-Type':_0x7512('0x37')},'body':_0x46762d,'json':!![]};rp(_0x5b8aea)[_0x7512('0x19')](function(_0x2d14cc){if(_0x2d14cc['statuses'][0x0][_0x7512('0x38')]){return _0xdcde3d[_0x7512('0x2b')]({'messageId':_0x2d14cc[_0x7512('0x39')][0x0][_0x7512('0x38')]});}})['catch'](function(_0xd81bd){logger[_0x7512('0x3a')]('WhatsappMessage,\x20%s',_0xd81bd);});break;}}})[_0x7512('0x3b')](function(){_0x6303ed();});}else{_0x6303ed();}}},'charset':_0x7512('0x3c'),'collate':_0x7512('0x3d')});}; \ No newline at end of file +var _0x4a3c=['FULLTEXT','models','get','direction','toLowerCase','out','isNil','WhatsappInteraction','findOne','WhatsappInteractionId','then','update','createdAt','error','secret','WhatsappAccount','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','sinch','baseUrl','/whatsapp/v1/','/messages/','text','POST','Bearer\x20','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','finally','utf8mb4_unicode_ci','../../config/logger','bluebird','request-promise','node-fetch','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','fti_whatsapp_messages','body'];(function(_0x1574ec,_0x2201fc){var _0x47f1ba=function(_0x31eeac){while(--_0x31eeac){_0x1574ec['push'](_0x1574ec['shift']());}};_0x47f1ba(++_0x2201fc);}(_0x4a3c,0x198));var _0xc4a3=function(_0x5a483d,_0x19a25e){_0x5a483d=_0x5a483d-0x0;var _0x26a1df=_0x4a3c[_0x5a483d];return _0x26a1df;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc4a3('0x0'))('api');var moment=require('moment');var BPromise=require(_0xc4a3('0x1'));var rp=require(_0xc4a3('0x2'));var fetch=require(_0xc4a3('0x3'));var fs=require('fs');var path=require(_0xc4a3('0x4'));var rimraf=require(_0xc4a3('0x5'));var config=require(_0xc4a3('0x6'));var attributes=require(_0xc4a3('0x7'));module[_0xc4a3('0x8')]=function(_0x2623a4,_0x372062){return _0x2623a4['define'](_0xc4a3('0x9'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':'messageId','fields':['messageId']},{'name':_0xc4a3('0xa'),'fields':[_0xc4a3('0xb')],'type':_0xc4a3('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x519141,_0x5aa5ac,_0x123d29){var _0x1a9f88=_0x2623a4[_0xc4a3('0xd')];var _0x2daf2c=_0x519141[_0xc4a3('0xe')]({'plain':!![]});if(_0x2daf2c[_0xc4a3('0xf')]['toLowerCase']()==='in'||_0x2daf2c[_0xc4a3('0xf')][_0xc4a3('0x10')]()===_0xc4a3('0x11')&&!_0x2daf2c['secret']&&!_[_0xc4a3('0x12')](_0x2daf2c['UserId'])){_0x1a9f88[_0xc4a3('0x13')][_0xc4a3('0x14')]({'where':{'id':_0x2daf2c[_0xc4a3('0x15')]}})[_0xc4a3('0x16')](function(_0x590a15){if(_0x590a15){_0x590a15[_0xc4a3('0x17')]({'lastMsgAt':_0x2daf2c[_0xc4a3('0x18')],'lastMsgDirection':_0x2daf2c[_0xc4a3('0xf')]['toLowerCase']()});}})['catch'](function(_0x177397){console[_0xc4a3('0x19')](_0x177397);});}if(_0x2daf2c[_0xc4a3('0xf')]===_0xc4a3('0x11')&&!_0x2daf2c[_0xc4a3('0x1a')]){var _0xfb1814;_0x1a9f88[_0xc4a3('0x1b')][_0xc4a3('0x1c')]({'where':{'id':_0x2daf2c[_0xc4a3('0x1d')]},'raw':!![]})[_0xc4a3('0x16')](function(_0x4e8cc8){_0xfb1814=_0x4e8cc8;if(_0xfb1814&&_0xfb1814[_0xc4a3('0x1e')]){switch(_0xfb1814['type']){case'twilio':var _0x3ac8fd=require(_0xc4a3('0x1f'));if(_0xfb1814[_0xc4a3('0x20')]&&_0xfb1814[_0xc4a3('0x21')]&&_0xfb1814[_0xc4a3('0x22')]){var _0x57b528=new _0x3ac8fd(_0xfb1814[_0xc4a3('0x20')],_0xfb1814[_0xc4a3('0x21')]);_0x57b528['messages'][_0xc4a3('0x23')]({'body':_0x2daf2c[_0xc4a3('0xb')],'to':_0xc4a3('0x24')+_0x2daf2c[_0xc4a3('0x22')],'from':_0xc4a3('0x24')+_0xfb1814[_0xc4a3('0x22')],'statusCallback':_0xfb1814[_0xc4a3('0x25')]+_0xc4a3('0x26')+_0x2daf2c['id']+_0xc4a3('0x27')+_0xfb1814[_0xc4a3('0x28')]})[_0xc4a3('0x16')](function(_0x1a0300){if(_0x1a0300[_0xc4a3('0x29')]){return _0x519141[_0xc4a3('0x17')]({'messageId':_0x1a0300[_0xc4a3('0x29')]});}})[_0xc4a3('0x2a')](function(_0x42e8c4){logger[_0xc4a3('0x19')](_0xc4a3('0x2b'),'afterCreate',_0xc4a3('0x1f'),util[_0xc4a3('0x2c')](_0x42e8c4,{'showHidden':![],'depth':null}));});}else{logger[_0xc4a3('0x19')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xc4a3('0x2d'),_0xc4a3('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0xc4a3('0x2e'):var _0x32fd1b=_0xfb1814[_0xc4a3('0x20')];var _0x4bd5f4=_0xfb1814[_0xc4a3('0x21')];var _0xbc505a=_0xfb1814[_0xc4a3('0x2f')]+_0xc4a3('0x30')+_0x32fd1b+_0xc4a3('0x31');var _0x262dc3={'to':[_0x2daf2c[_0xc4a3('0x22')]],'message':{'type':_0xc4a3('0x32'),'text':_0x2daf2c['body']}};var _0xf6b5={'method':_0xc4a3('0x33'),'uri':_0xbc505a,'headers':{'Authorization':_0xc4a3('0x34')+_0x4bd5f4,'Content-Type':_0xc4a3('0x35')},'body':_0x262dc3,'json':!![]};rp(_0xf6b5)[_0xc4a3('0x16')](function(_0x14576c){if(_0x14576c['statuses'][0x0][_0xc4a3('0x36')]){return _0x519141[_0xc4a3('0x17')]({'messageId':_0x14576c[_0xc4a3('0x37')][0x0][_0xc4a3('0x36')]});}})[_0xc4a3('0x2a')](function(_0x403691){logger[_0xc4a3('0x38')](_0xc4a3('0x39'),_0x403691);});break;}}})[_0xc4a3('0x3a')](function(){_0x123d29();});}else{_0x123d29();}}},'charset':'utf8mb4','collate':_0xc4a3('0x3b')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index ff20afe..9ba0b83 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 _0xb950=['redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','body','options','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x9ee6b8,_0xe55304){var _0x387838=function(_0x43c649){while(--_0x43c649){_0x9ee6b8['push'](_0x9ee6b8['shift']());}};_0x387838(++_0xe55304);}(_0xb950,0xe9));var _0x0b95=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xb950[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x0b95('0x0'));var util=require(_0x0b95('0x1'));var moment=require(_0x0b95('0x2'));var BPromise=require(_0x0b95('0x3'));var rs=require(_0x0b95('0x4'));var fs=require('fs');var Redis=require(_0x0b95('0x5'));var db=require(_0x0b95('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x0b95('0x7'))('rpc');var config=require(_0x0b95('0x8'));var jayson=require(_0x0b95('0x9'));var client=jayson[_0x0b95('0xa')][_0x0b95('0xb')]({'port':0x232a});config[_0x0b95('0xc')]=_['defaults'](config[_0x0b95('0xc')],{'host':_0x0b95('0xd'),'port':0x18eb});var socket=require(_0x0b95('0xe'))(new Redis(config[_0x0b95('0xc')]));require(_0x0b95('0xf'))[_0x0b95('0x10')](socket);function respondWithRpcPromise(_0x2b97e2,_0x5f4974,_0x97b545){return new BPromise(function(_0x584218,_0x188a03){return client[_0x0b95('0x11')](_0x2b97e2,_0x97b545)[_0x0b95('0x12')](function(_0x4f94a0){logger[_0x0b95('0x13')](_0x0b95('0x14'),_0x5f4974,_0x0b95('0x15'));logger[_0x0b95('0x16')](_0x0b95('0x17'),_0x5f4974,_0x0b95('0x15'),JSON['stringify'](_0x4f94a0));if(_0x4f94a0[_0x0b95('0x18')]){if(_0x4f94a0[_0x0b95('0x18')][_0x0b95('0x19')]===0x1f4){logger['error'](_0x0b95('0x14'),_0x5f4974,_0x4f94a0[_0x0b95('0x18')][_0x0b95('0x1a')]);return _0x188a03(_0x4f94a0[_0x0b95('0x18')][_0x0b95('0x1a')]);}logger[_0x0b95('0x18')](_0x0b95('0x14'),_0x5f4974,_0x4f94a0['error'][_0x0b95('0x1a')]);return _0x584218(_0x4f94a0[_0x0b95('0x18')][_0x0b95('0x1a')]);}else{logger[_0x0b95('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x5f4974,_0x0b95('0x15'));_0x584218(_0x4f94a0[_0x0b95('0x1b')][_0x0b95('0x1a')]);}})[_0x0b95('0x1c')](function(_0x54ccf3){logger[_0x0b95('0x18')]('WhatsappMessage,\x20%s,\x20%s',_0x5f4974,_0x54ccf3);_0x188a03(_0x54ccf3);});});}exports[_0x0b95('0x1d')]=function(_0x10655a){var _0x3b6032=this;return new Promise(function(_0x4b8ebc,_0x3a45e1){return db[_0x0b95('0x1e')][_0x0b95('0x1f')](_0x10655a[_0x0b95('0x20')],{'raw':_0x10655a['options']?_0x10655a[_0x0b95('0x21')]['raw']===undefined?!![]:![]:!![]})[_0x0b95('0x12')](function(_0x19427e){logger[_0x0b95('0x13')](_0x0b95('0x1d'),_0x10655a);logger[_0x0b95('0x16')](_0x0b95('0x1d'),_0x10655a,JSON[_0x0b95('0x22')](_0x19427e));_0x4b8ebc(_0x19427e);})[_0x0b95('0x1c')](function(_0x2898f0){logger['error']('CreateWhatsappMessage',_0x2898f0[_0x0b95('0x1a')],_0x10655a);_0x3a45e1(_0x3b6032[_0x0b95('0x18')](0x1f4,_0x2898f0[_0x0b95('0x1a')]));});});}; \ No newline at end of file +var _0xde2c=['../../config/environment','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','./whatsappMessage.socket','register','then','info','WhatsappMessage,\x20%s,\x20%s','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','CreateWhatsappMessage','body','options','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x4e9861,_0x25fe5f){var _0x49802f=function(_0x76932){while(--_0x76932){_0x4e9861['push'](_0x4e9861['shift']());}};_0x49802f(++_0x25fe5f);}(_0xde2c,0x154));var _0xcde2=function(_0x5f519b,_0x5b606f){_0x5f519b=_0x5f519b-0x0;var _0x2461e2=_0xde2c[_0x5f519b];return _0x2461e2;};'use strict';var _=require(_0xcde2('0x0'));var util=require(_0xcde2('0x1'));var moment=require(_0xcde2('0x2'));var BPromise=require('bluebird');var rs=require(_0xcde2('0x3'));var fs=require('fs');var Redis=require(_0xcde2('0x4'));var db=require(_0xcde2('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcde2('0x6'))(_0xcde2('0x7'));var config=require(_0xcde2('0x8'));var jayson=require(_0xcde2('0x9'));var client=jayson[_0xcde2('0xa')]['http']({'port':0x232a});config['redis']=_[_0xcde2('0xb')](config['redis'],{'host':_0xcde2('0xc'),'port':0x18eb});var socket=require(_0xcde2('0xd'))(new Redis(config[_0xcde2('0xe')]));require(_0xcde2('0xf'))[_0xcde2('0x10')](socket);function respondWithRpcPromise(_0x4b891d,_0x2ede97,_0x27d2b9){return new BPromise(function(_0x52829b,_0x4d9323){return client['request'](_0x4b891d,_0x27d2b9)[_0xcde2('0x11')](function(_0x4ee98d){logger[_0xcde2('0x12')](_0xcde2('0x13'),_0x2ede97,'request\x20sent');logger[_0xcde2('0x14')](_0xcde2('0x15'),_0x2ede97,'request\x20sent',JSON['stringify'](_0x4ee98d));if(_0x4ee98d['error']){if(_0x4ee98d[_0xcde2('0x16')]['code']===0x1f4){logger[_0xcde2('0x16')](_0xcde2('0x13'),_0x2ede97,_0x4ee98d[_0xcde2('0x16')][_0xcde2('0x17')]);return _0x4d9323(_0x4ee98d[_0xcde2('0x16')][_0xcde2('0x17')]);}logger['error']('WhatsappMessage,\x20%s,\x20%s',_0x2ede97,_0x4ee98d['error'][_0xcde2('0x17')]);return _0x52829b(_0x4ee98d['error'][_0xcde2('0x17')]);}else{logger['info'](_0xcde2('0x13'),_0x2ede97,'request\x20sent');_0x52829b(_0x4ee98d[_0xcde2('0x18')][_0xcde2('0x17')]);}})[_0xcde2('0x19')](function(_0x44018a){logger[_0xcde2('0x16')](_0xcde2('0x13'),_0x2ede97,_0x44018a);_0x4d9323(_0x44018a);});});}exports[_0xcde2('0x1a')]=function(_0x208125){var _0x1f94a5=this;return new Promise(function(_0xf0b459,_0xe78610){return db['WhatsappMessage']['create'](_0x208125[_0xcde2('0x1b')],{'raw':_0x208125[_0xcde2('0x1c')]?_0x208125['options']['raw']===undefined?!![]:![]:!![]})[_0xcde2('0x11')](function(_0x26abe5){logger[_0xcde2('0x12')](_0xcde2('0x1a'),_0x208125);logger[_0xcde2('0x14')]('CreateWhatsappMessage',_0x208125,JSON['stringify'](_0x26abe5));_0xf0b459(_0x26abe5);})['catch'](function(_0xe5443c){logger[_0xcde2('0x16')](_0xcde2('0x1a'),_0xe5443c[_0xcde2('0x17')],_0x208125);_0xe78610(_0x1f94a5['error'](0x1f4,_0xe5443c[_0xcde2('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index 2df4c6e..3a31316 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 _0xce3c=['whatsappMessage:','./whatsappMessage.events','save','remove','update','emit','removeListener','register','length'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xce3c,0xbe));var _0xcce3=function(_0x4c15e7,_0x4ad7f5){_0x4c15e7=_0x4c15e7-0x0;var _0x1f119a=_0xce3c[_0x4c15e7];return _0x1f119a;};'use strict';var WhatsappMessageEvents=require(_0xcce3('0x0'));var events=[_0xcce3('0x1'),_0xcce3('0x2'),_0xcce3('0x3')];function createListener(_0x1764fa,_0x62b298){return function(_0x7df097){_0x62b298[_0xcce3('0x4')](_0x1764fa,_0x7df097);};}function removeListener(_0x110d45,_0x5bd1c4){return function(){WhatsappMessageEvents[_0xcce3('0x5')](_0x110d45,_0x5bd1c4);};}exports[_0xcce3('0x6')]=function(_0x206bb3){for(var _0x47fbb5=0x0,_0x47f66e=events[_0xcce3('0x7')];_0x47fbb5<_0x47f66e;_0x47fbb5++){var _0x2841aa=events[_0x47fbb5];var _0x52121b=createListener(_0xcce3('0x8')+_0x2841aa,_0x206bb3);WhatsappMessageEvents['on'](_0x2841aa,_0x52121b);}}; \ No newline at end of file +var _0x267a=['emit','removeListener','length','whatsappMessage:','./whatsappMessage.events','save','remove','update'];(function(_0x33df33,_0x1477b6){var _0x521172=function(_0x419491){while(--_0x419491){_0x33df33['push'](_0x33df33['shift']());}};_0x521172(++_0x1477b6);}(_0x267a,0xcc));var _0xa267=function(_0x422ac3,_0x48bbd4){_0x422ac3=_0x422ac3-0x0;var _0x53c0d4=_0x267a[_0x422ac3];return _0x53c0d4;};'use strict';var WhatsappMessageEvents=require(_0xa267('0x0'));var events=[_0xa267('0x1'),_0xa267('0x2'),_0xa267('0x3')];function createListener(_0x5b702e,_0x49efd0){return function(_0x1fb481){_0x49efd0[_0xa267('0x4')](_0x5b702e,_0x1fb481);};}function removeListener(_0x230175,_0x17f57f){return function(){WhatsappMessageEvents[_0xa267('0x5')](_0x230175,_0x17f57f);};}exports['register']=function(_0x30c2de){for(var _0x36055c=0x0,_0x32b882=events[_0xa267('0x6')];_0x36055c<_0x32b882;_0x36055c++){var _0x598412=events[_0x36055c];var _0x4bb4d1=createListener(_0xa267('0x7')+_0x598412,_0x30c2de);WhatsappMessageEvents['on'](_0x598412,_0x4bb4d1);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 127d17b..ca6bdd0 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 _0x8e17=['put','/:id','update','delete','removeTeams','removeAgents','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','get','/describe','describe','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x8e17,0x146));var _0x78e1=function(_0x5d02c4,_0x1bbd82){_0x5d02c4=_0x5d02c4-0x0;var _0x1e74ba=_0x8e17[_0x5d02c4];return _0x1e74ba;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x78e1('0x0'));var timeout=require(_0x78e1('0x1'));var express=require(_0x78e1('0x2'));var router=express[_0x78e1('0x3')]();var fs_extra=require(_0x78e1('0x4'));var auth=require(_0x78e1('0x5'));var interaction=require(_0x78e1('0x6'));var config=require(_0x78e1('0x7'));var controller=require(_0x78e1('0x8'));router['get']('/',auth[_0x78e1('0x9')](),controller['index']);router[_0x78e1('0xa')](_0x78e1('0xb'),auth[_0x78e1('0x9')](),controller[_0x78e1('0xc')]);router[_0x78e1('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x78e1('0xd'),auth['isAuthenticated'](),controller[_0x78e1('0xe')]);router[_0x78e1('0xa')](_0x78e1('0xf'),auth[_0x78e1('0x9')](),controller[_0x78e1('0x10')]);router[_0x78e1('0xa')](_0x78e1('0x11'),auth[_0x78e1('0x9')](),controller[_0x78e1('0x12')]);router['post']('/',auth[_0x78e1('0x9')](),controller[_0x78e1('0x13')]);router[_0x78e1('0x14')]('/:id/teams',auth[_0x78e1('0x9')](),controller[_0x78e1('0x15')]);router[_0x78e1('0x14')](_0x78e1('0x11'),auth['isAuthenticated'](),controller['addAgents']);router[_0x78e1('0x16')](_0x78e1('0x17'),auth[_0x78e1('0x9')](),controller[_0x78e1('0x18')]);router[_0x78e1('0x19')]('/:id',auth[_0x78e1('0x9')](),controller['destroy']);router[_0x78e1('0x19')](_0x78e1('0xf'),auth[_0x78e1('0x9')](),controller[_0x78e1('0x1a')]);router[_0x78e1('0x19')](_0x78e1('0x11'),auth['isAuthenticated'](),controller[_0x78e1('0x1b')]);module[_0x78e1('0x1c')]=router; \ No newline at end of file +var _0xa524=['path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getAgents','create','post','addTeams','/:id/users','addAgents','put','delete','destroy','removeTeams','removeAgents','exports','util'];(function(_0x9aada2,_0xd2d349){var _0x196dff=function(_0x5ad061){while(--_0x5ad061){_0x9aada2['push'](_0x9aada2['shift']());}};_0x196dff(++_0xd2d349);}(_0xa524,0x178));var _0x4a52=function(_0x308c00,_0x3cbd67){_0x308c00=_0x308c00-0x0;var _0x2b21b2=_0xa524[_0x308c00];return _0x2b21b2;};'use strict';var multer=require('multer');var util=require(_0x4a52('0x0'));var path=require(_0x4a52('0x1'));var timeout=require(_0x4a52('0x2'));var express=require(_0x4a52('0x3'));var router=express['Router']();var fs_extra=require(_0x4a52('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4a52('0x5'));var config=require(_0x4a52('0x6'));var controller=require(_0x4a52('0x7'));router[_0x4a52('0x8')]('/',auth[_0x4a52('0x9')](),controller[_0x4a52('0xa')]);router[_0x4a52('0x8')](_0x4a52('0xb'),auth[_0x4a52('0x9')](),controller[_0x4a52('0xc')]);router[_0x4a52('0x8')](_0x4a52('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x4a52('0x8')](_0x4a52('0xe'),auth[_0x4a52('0x9')](),controller[_0x4a52('0xf')]);router[_0x4a52('0x8')](_0x4a52('0x10'),auth[_0x4a52('0x9')](),controller['getTeams']);router['get']('/:id/users',auth[_0x4a52('0x9')](),controller[_0x4a52('0x11')]);router['post']('/',auth[_0x4a52('0x9')](),controller[_0x4a52('0x12')]);router[_0x4a52('0x13')]('/:id/teams',auth[_0x4a52('0x9')](),controller[_0x4a52('0x14')]);router[_0x4a52('0x13')](_0x4a52('0x15'),auth[_0x4a52('0x9')](),controller[_0x4a52('0x16')]);router[_0x4a52('0x17')](_0x4a52('0xd'),auth[_0x4a52('0x9')](),controller['update']);router[_0x4a52('0x18')]('/:id',auth[_0x4a52('0x9')](),controller[_0x4a52('0x19')]);router[_0x4a52('0x18')]('/:id/teams',auth[_0x4a52('0x9')](),controller[_0x4a52('0x1a')]);router['delete']('/:id/users',auth[_0x4a52('0x9')](),controller[_0x4a52('0x1b')]);module[_0x4a52('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 141d5e1..e920ea8 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 _0xfa2f=['rrmemory','roundrobin','STRING','INTEGER','ENUM'];(function(_0x5b517d,_0x5ba318){var _0x2cd6cb=function(_0x2f378b){while(--_0x2f378b){_0x5b517d['push'](_0x5b517d['shift']());}};_0x2cd6cb(++_0x5ba318);}(_0xfa2f,0xe8));var _0xffa2=function(_0x21dba0,_0x1b1d86){_0x21dba0=_0x21dba0-0x0;var _0x3f4b35=_0xfa2f[_0x21dba0];return _0x3f4b35;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xffa2('0x0')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xffa2('0x1')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xffa2('0x2')](_0xffa2('0x3'),'beepall',_0xffa2('0x4'))},'description':{'type':Sequelize[_0xffa2('0x0')]}}; \ No newline at end of file +var _0x2bb0=['STRING','INTEGER','beepall','sequelize','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2bb0,0xf3));var _0x02bb=function(_0x133b4c,_0x3d4c16){_0x133b4c=_0x133b4c-0x0;var _0x377328=_0x2bb0[_0x133b4c];return _0x377328;};'use strict';var Sequelize=require(_0x02bb('0x0'));module[_0x02bb('0x1')]={'name':{'type':Sequelize[_0x02bb('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x02bb('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x02bb('0x4'),'roundrobin')},'description':{'type':Sequelize[_0x02bb('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 88c577a..98764fb 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 _0x5cbc=['../../config/environment','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','limit','count','json','update','then','destroy','get','WhatsappQueues','UserProfileResource','error','stack','name','index','map','WhatsappQueue','rawAttributes','fieldName','type','key','getOptions','where','include','query','findAll','catch','show','params','model','keys','filters','intersection','attributes','fields','includeAll','merge','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','length','hasOwnProperty','nolimit','order','sort','pick','WhatsappQueueId','filter','User','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','Team','ids','Agents','online','voicePause','interface','flatMap','sequelize','addTeams','each','findOrCreate','forEach','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','TeamId','all','union','compact','isEmpty','removeAgents','emit','userWhatsappQueue:remove','addAgents','isArray','getAgents','bluebird','util','lodash','squel','ioredis','../../components/parsers/qs','../../config/logger','api'];(function(_0x1331fb,_0x20da4f){var _0x547f5d=function(_0x972167){while(--_0x972167){_0x1331fb['push'](_0x1331fb['shift']());}};_0x547f5d(++_0x20da4f);}(_0x5cbc,0x74));var _0xc5cb=function(_0x4812c9,_0x154b76){_0x4812c9=_0x4812c9-0x0;var _0x4de61f=_0x5cbc[_0x4812c9];return _0x4de61f;};'use strict';var BPromise=require(_0xc5cb('0x0'));var util=require(_0xc5cb('0x1'));var _=require(_0xc5cb('0x2'));var squel=require(_0xc5cb('0x3'));var Redis=require(_0xc5cb('0x4'));var qs=require(_0xc5cb('0x5'));var logger=require(_0xc5cb('0x6'))(_0xc5cb('0x7'));var config=require(_0xc5cb('0x8'));var db=require('../../mysqldb')['db'];config[_0xc5cb('0x9')]=_[_0xc5cb('0xa')](config[_0xc5cb('0x9')],{'host':_0xc5cb('0xb'),'port':0x18eb});var socket=require(_0xc5cb('0xc'))(new Redis(config[_0xc5cb('0x9')]));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x3afa9f,_0x2f57b6){_0x2f57b6=_0x2f57b6||0xcc;return function(_0x396842){if(_0x396842){return _0x3afa9f[_0xc5cb('0xd')](_0x2f57b6);}return _0x3afa9f[_0xc5cb('0xe')](_0x2f57b6)[_0xc5cb('0xf')]();};}function respondWithResult(_0x262e25,_0x26e921){_0x26e921=_0x26e921||0xc8;return function(_0x22b889){if(_0x22b889){return _0x262e25['status'](_0x26e921)['json'](_0x22b889);}};}function respondWithFilteredResult(_0x456a51,_0x12c762){return function(_0x5eb3d9){if(_0x5eb3d9){var _0x25346d=typeof _0x12c762[_0xc5cb('0x10')]===_0xc5cb('0x11')&&typeof _0x12c762[_0xc5cb('0x12')]===_0xc5cb('0x11');var _0x213292=_0x5eb3d9[_0xc5cb('0x13')];var _0x42cf89=_0x25346d?0x0:_0x12c762[_0xc5cb('0x10')];var _0x2cf354=_0x25346d?_0x5eb3d9['count']:_0x12c762[_0xc5cb('0x10')]+_0x12c762[_0xc5cb('0x12')];var _0x2f27d0;if(_0x2cf354>=_0x213292){_0x2cf354=_0x213292;_0x2f27d0=0xc8;}else{_0x2f27d0=0xce;}_0x456a51['status'](_0x2f27d0);return _0x456a51['set']('Content-Range',_0x42cf89+'-'+_0x2cf354+'/'+_0x213292)[_0xc5cb('0x14')](_0x5eb3d9);}return null;};}function saveUpdates(_0x476b2f){return function(_0x45a4f5){if(_0x45a4f5){return _0x45a4f5[_0xc5cb('0x15')](_0x476b2f)[_0xc5cb('0x16')](function(_0x591752){return _0x591752;});}return null;};}function removeEntity(_0x419fc1){return function(_0x28bc9e){if(_0x28bc9e){return _0x28bc9e[_0xc5cb('0x17')]()[_0xc5cb('0x16')](function(){var _0x12a723=_0x28bc9e[_0xc5cb('0x18')]({'plain':!![]});var _0x472934=_0xc5cb('0x19');return db[_0xc5cb('0x1a')]['destroy']({'where':{'type':_0x472934,'resourceId':_0x12a723['id']}})[_0xc5cb('0x16')](function(){return _0x28bc9e;});})[_0xc5cb('0x16')](function(){_0x419fc1[_0xc5cb('0xe')](0xcc)[_0xc5cb('0xf')]();});}};}function handleEntityNotFound(_0x239c7b){return function(_0x2189a0){if(!_0x2189a0){_0x239c7b[_0xc5cb('0xd')](0x194);}return _0x2189a0;};}function handleError(_0x49cd5a,_0x1338f8){_0x1338f8=_0x1338f8||0x1f4;return function(_0x398b74){logger[_0xc5cb('0x1b')](_0x398b74[_0xc5cb('0x1c')]);if(_0x398b74['name']){delete _0x398b74[_0xc5cb('0x1d')];}_0x49cd5a[_0xc5cb('0xe')](_0x1338f8)['send'](_0x398b74);};}exports[_0xc5cb('0x1e')]=function(_0x447a4e,_0xa3d757){var _0x26ef23={};var _0x2a95a6={'count':0x0,'rows':[]};var _0x20808c=_[_0xc5cb('0x1f')](db[_0xc5cb('0x20')][_0xc5cb('0x21')],function(_0xb72e97){return{'name':_0xb72e97[_0xc5cb('0x22')],'type':_0xb72e97[_0xc5cb('0x23')][_0xc5cb('0x24')]};});_0x26ef23=qs[_0xc5cb('0x25')](_0x20808c,_0x447a4e);var _0x1d84ad={'where':_0x26ef23[_0xc5cb('0x26')]};return db[_0xc5cb('0x20')][_0xc5cb('0x13')](_0x1d84ad)[_0xc5cb('0x16')](function(_0x19f08f){_0x2a95a6[_0xc5cb('0x13')]=_0x19f08f;_0x26ef23[_0xc5cb('0x27')]=qs[_0xc5cb('0x27')](_0x447a4e[_0xc5cb('0x28')]);return db['WhatsappQueue'][_0xc5cb('0x29')](_0x26ef23);})['then'](function(_0x3abbff){_0x2a95a6['rows']=_0x3abbff;return _0x2a95a6;})[_0xc5cb('0x16')](respondWithFilteredResult(_0xa3d757,_0x26ef23))[_0xc5cb('0x2a')](handleError(_0xa3d757,null));};exports[_0xc5cb('0x2b')]=function(_0x299e2d,_0x3f5dc7){var _0x46f88a={'raw':!![],'where':{'id':_0x299e2d[_0xc5cb('0x2c')]['id']}},_0x4b934d={};_0x4b934d[_0xc5cb('0x2d')]=_[_0xc5cb('0x2e')](db['WhatsappQueue'][_0xc5cb('0x21')]);_0x4b934d['query']=_[_0xc5cb('0x2e')](_0x299e2d[_0xc5cb('0x28')]);_0x4b934d[_0xc5cb('0x2f')]=_[_0xc5cb('0x30')](_0x4b934d[_0xc5cb('0x2d')],_0x4b934d['query']);_0x46f88a[_0xc5cb('0x31')]=_[_0xc5cb('0x30')](_0x4b934d['model'],qs[_0xc5cb('0x32')](_0x299e2d['query'][_0xc5cb('0x32')]));_0x46f88a[_0xc5cb('0x31')]=_0x46f88a[_0xc5cb('0x31')]['length']?_0x46f88a[_0xc5cb('0x31')]:_0x4b934d[_0xc5cb('0x2d')];if(_0x299e2d[_0xc5cb('0x28')][_0xc5cb('0x33')]){_0x46f88a[_0xc5cb('0x27')]=[{'all':!![]}];}_0x46f88a=_[_0xc5cb('0x34')]({},_0x46f88a,_0x299e2d[_0xc5cb('0x35')]);return db['WhatsappQueue'][_0xc5cb('0x36')](_0x46f88a)[_0xc5cb('0x16')](handleEntityNotFound(_0x3f5dc7,null))['then'](respondWithResult(_0x3f5dc7,null))[_0xc5cb('0x2a')](handleError(_0x3f5dc7,null));};exports[_0xc5cb('0x37')]=function(_0x428e1f,_0x19a6dc){return db[_0xc5cb('0x20')][_0xc5cb('0x37')](_0x428e1f[_0xc5cb('0x38')],{})['then'](function(_0x966cc5){var _0x47ac2e=_0x428e1f[_0xc5cb('0x39')][_0xc5cb('0x18')]({'plain':!![]});if(!_0x47ac2e)throw new Error(_0xc5cb('0x3a'));if(_0x47ac2e[_0xc5cb('0x3b')]==='user'){var _0x271fa5=_0x966cc5[_0xc5cb('0x18')]({'plain':!![]});var _0xc5f736=_0xc5cb('0x19');return db[_0xc5cb('0x3c')][_0xc5cb('0x36')]({'where':{'name':_0xc5f736,'userProfileId':_0x47ac2e['userProfileId']},'raw':!![]})['then'](function(_0x1d2882){if(_0x1d2882&&_0x1d2882['autoAssociation']===0x0){return db[_0xc5cb('0x1a')][_0xc5cb('0x37')]({'name':_0x271fa5[_0xc5cb('0x1d')],'resourceId':_0x271fa5['id'],'type':_0x1d2882[_0xc5cb('0x1d')],'sectionId':_0x1d2882['id']},{})['then'](function(){return _0x966cc5;});}else{return _0x966cc5;}})[_0xc5cb('0x2a')](function(_0x370414){logger[_0xc5cb('0x1b')](_0xc5cb('0x3d'),_0x370414);throw _0x370414;});}return _0x966cc5;})[_0xc5cb('0x16')](respondWithResult(_0x19a6dc,0xc9))['catch'](handleError(_0x19a6dc,null));};exports[_0xc5cb('0x15')]=function(_0x68eec1,_0x14c493){if(_0x68eec1[_0xc5cb('0x38')]['id']){delete _0x68eec1[_0xc5cb('0x38')]['id'];}return db['WhatsappQueue'][_0xc5cb('0x36')]({'where':{'id':_0x68eec1[_0xc5cb('0x2c')]['id']}})[_0xc5cb('0x16')](handleEntityNotFound(_0x14c493,null))[_0xc5cb('0x16')](saveUpdates(_0x68eec1[_0xc5cb('0x38')],null))[_0xc5cb('0x16')](respondWithResult(_0x14c493,null))[_0xc5cb('0x2a')](handleError(_0x14c493,null));};exports[_0xc5cb('0x17')]=function(_0x4463cd,_0x535931){return db[_0xc5cb('0x20')][_0xc5cb('0x36')]({'where':{'id':_0x4463cd['params']['id']}})[_0xc5cb('0x16')](handleEntityNotFound(_0x535931,null))['then'](removeEntity(_0x535931,null))[_0xc5cb('0x2a')](handleError(_0x535931,null));};exports[_0xc5cb('0x3e')]=function(_0x5648d6,_0x4b6bae){return db[_0xc5cb('0x20')][_0xc5cb('0x3e')]()[_0xc5cb('0x16')](respondWithResult(_0x4b6bae,null))[_0xc5cb('0x2a')](handleError(_0x4b6bae,null));};exports[_0xc5cb('0x3f')]=function(_0xa9413c,_0x2bc9c7){var _0x13dd36={'raw':!![],'where':{}},_0x2d8486={},_0xefb34e;return db[_0xc5cb('0x20')][_0xc5cb('0x40')]({'where':{'id':_0xa9413c[_0xc5cb('0x2c')]['id']}})[_0xc5cb('0x16')](handleEntityNotFound(_0x2bc9c7,null))[_0xc5cb('0x16')](function(_0x3e4ab5){if(_0x3e4ab5){_0xefb34e=_0x3e4ab5[_0xc5cb('0x18')]({'plain':!![]});_0x2d8486[_0xc5cb('0x2d')]=_['keys'](db[_0xc5cb('0x41')][_0xc5cb('0x21')]);_0x2d8486[_0xc5cb('0x28')]=_[_0xc5cb('0x2e')](_0xa9413c[_0xc5cb('0x28')]);_0x2d8486[_0xc5cb('0x2f')]=_['intersection'](_0x2d8486[_0xc5cb('0x2d')],_0x2d8486['query']);_0x13dd36[_0xc5cb('0x31')]=_[_0xc5cb('0x30')](_0x2d8486['model'],qs[_0xc5cb('0x32')](_0xa9413c[_0xc5cb('0x28')][_0xc5cb('0x32')]));_0x13dd36[_0xc5cb('0x31')]=_0x13dd36[_0xc5cb('0x31')][_0xc5cb('0x42')]?_0x13dd36['attributes']:_0x2d8486[_0xc5cb('0x2d')];if(!_0xa9413c[_0xc5cb('0x28')][_0xc5cb('0x43')](_0xc5cb('0x44'))){_0x13dd36['limit']=qs[_0xc5cb('0x12')](_0xa9413c[_0xc5cb('0x28')][_0xc5cb('0x12')]);_0x13dd36[_0xc5cb('0x10')]=qs[_0xc5cb('0x10')](_0xa9413c[_0xc5cb('0x28')]['offset']);}_0x13dd36[_0xc5cb('0x45')]=qs[_0xc5cb('0x46')](_0xa9413c[_0xc5cb('0x28')][_0xc5cb('0x46')]);_0x13dd36[_0xc5cb('0x26')]=qs[_0xc5cb('0x2f')](_[_0xc5cb('0x47')](_0xa9413c[_0xc5cb('0x28')],_0x2d8486[_0xc5cb('0x2f')]));_0x13dd36[_0xc5cb('0x26')][_0xc5cb('0x48')]=_0x3e4ab5['id'];if(_0xa9413c['query'][_0xc5cb('0x49')]){_0x13dd36[_0xc5cb('0x26')]=_[_0xc5cb('0x34')](_0x13dd36['where'],{'$or':_[_0xc5cb('0x1f')](_0x13dd36[_0xc5cb('0x31')],function(_0x2692aa){var _0x1268f5={};_0x1268f5[_0x2692aa]={'$like':'%'+_0xa9413c[_0xc5cb('0x28')][_0xc5cb('0x49')]+'%'};return _0x1268f5;})});}_0x13dd36=_['merge']({},_0x13dd36,_0xa9413c[_0xc5cb('0x35')]);return db[_0xc5cb('0x41')][_0xc5cb('0x29')](_0x13dd36);}})[_0xc5cb('0x16')](function(_0x4ab855){if(_0x4ab855){return db[_0xc5cb('0x4a')][_0xc5cb('0x4b')]({'where':{'id':_[_0xc5cb('0x1f')](_0x4ab855,_0xc5cb('0x4c')),'role':_0xc5cb('0x4d')},'attributes':['id','name',_0xc5cb('0x4e'),_0xc5cb('0x4f'),_0xc5cb('0x50')]});}})['then'](function(_0x3abd71){if(_0x3abd71){return{'count':_0x3abd71[_0xc5cb('0x13')],'rows':_[_0xc5cb('0x1f')](_0x3abd71[_0xc5cb('0x51')],function(_0x2805ad){return{'membername':_0x2805ad['name'],'UserId':_0x2805ad['id'],'queue_name':_0xefb34e[_0xc5cb('0x1d')],'WhatsappQueueId':_0xefb34e['id'],'interface':util[_0xc5cb('0x52')](_0xc5cb('0x53'),_0xc5cb('0x54'),_0x2805ad[_0xc5cb('0x1d')]),'penalty':0x0,'paused':_0x2805ad[_0xc5cb('0x4e')],'createdAt':_0x2805ad[_0xc5cb('0x50')],'updatedAt':_0x2805ad[_0xc5cb('0x4f')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xc5cb('0x16')](respondWithFilteredResult(_0x2bc9c7,_0x13dd36))['catch'](handleError(_0x2bc9c7,null));};exports[_0xc5cb('0x55')]=function(_0x40d3e7,_0x40234a){var _0x5ab2d5={};var _0x37c13e={};var _0x1147fb;var _0x383866;return db['WhatsappQueue'][_0xc5cb('0x40')]({'where':{'id':_0x40d3e7[_0xc5cb('0x2c')]['id']}})[_0xc5cb('0x16')](handleEntityNotFound(_0x40234a,null))[_0xc5cb('0x16')](function(_0x2a0d1c){if(_0x2a0d1c){_0x1147fb=_0x2a0d1c;_0x37c13e[_0xc5cb('0x2d')]=_['keys'](db[_0xc5cb('0x56')]['rawAttributes']);_0x37c13e[_0xc5cb('0x28')]=_[_0xc5cb('0x2e')](_0x40d3e7[_0xc5cb('0x28')]);_0x37c13e[_0xc5cb('0x2f')]=_[_0xc5cb('0x30')](_0x37c13e[_0xc5cb('0x2d')],_0x37c13e['query']);_0x5ab2d5[_0xc5cb('0x31')]=_['intersection'](_0x37c13e['model'],qs[_0xc5cb('0x32')](_0x40d3e7[_0xc5cb('0x28')][_0xc5cb('0x32')]));_0x5ab2d5[_0xc5cb('0x31')]=_0x5ab2d5[_0xc5cb('0x31')]['length']?_0x5ab2d5[_0xc5cb('0x31')]:_0x37c13e[_0xc5cb('0x2d')];_0x5ab2d5[_0xc5cb('0x45')]=qs[_0xc5cb('0x46')](_0x40d3e7[_0xc5cb('0x28')][_0xc5cb('0x46')]);_0x5ab2d5[_0xc5cb('0x26')]=qs[_0xc5cb('0x2f')](_[_0xc5cb('0x47')](_0x40d3e7['query'],_0x37c13e['filters']));if(_0x40d3e7['query'][_0xc5cb('0x49')]){_0x5ab2d5[_0xc5cb('0x26')]=_['merge'](_0x5ab2d5[_0xc5cb('0x26')],{'$or':_['map'](_0x5ab2d5[_0xc5cb('0x31')],function(_0x293f8f){var _0x2a6520={};_0x2a6520[_0x293f8f]={'$like':'%'+_0x40d3e7[_0xc5cb('0x28')][_0xc5cb('0x49')]+'%'};return _0x2a6520;})});}_0x5ab2d5=_[_0xc5cb('0x34')]({},_0x5ab2d5,_0x40d3e7[_0xc5cb('0x35')]);return _0x1147fb[_0xc5cb('0x55')](_0x5ab2d5);}})['then'](function(_0x21ed94){if(_0x21ed94){_0x383866=_0x21ed94['length'];if(!_0x40d3e7[_0xc5cb('0x28')]['hasOwnProperty'](_0xc5cb('0x44'))){_0x5ab2d5[_0xc5cb('0x12')]=qs[_0xc5cb('0x12')](_0x40d3e7['query'][_0xc5cb('0x12')]);_0x5ab2d5[_0xc5cb('0x10')]=qs[_0xc5cb('0x10')](_0x40d3e7[_0xc5cb('0x28')][_0xc5cb('0x10')]);}return _0x1147fb[_0xc5cb('0x55')](_0x5ab2d5);}})[_0xc5cb('0x16')](function(_0x2d1351){if(_0x2d1351){return _0x2d1351?{'count':_0x383866,'rows':_0x2d1351}:null;}})[_0xc5cb('0x16')](respondWithResult(_0x40234a,null))[_0xc5cb('0x2a')](handleError(_0x40234a,null));};exports['addTeams']=function(_0x3dbca8,_0x2a092e){var _0x5b6c84=_0x3dbca8[_0xc5cb('0x38')][_0xc5cb('0x57')];return db[_0xc5cb('0x56')][_0xc5cb('0x29')]({'where':{'id':_0x5b6c84},'attributes':['id'],'include':[{'model':db[_0xc5cb('0x4a')],'as':_0xc5cb('0x58'),'attributes':['id',_0xc5cb('0x1d'),_0xc5cb('0x59'),_0xc5cb('0x5a'),_0xc5cb('0x5b')],'raw':!![]}]})[_0xc5cb('0x16')](function(_0x3e0c64){if(_0x3e0c64){var _0x2fd380=_[_0xc5cb('0x5c')](_0x3e0c64,function(_0x3fe0b3){var _0x5c1aba=_0x3fe0b3[_0xc5cb('0x18')]({'plain':!![]});return _0x5c1aba[_0xc5cb('0x58')];});return db['WhatsappQueue'][_0xc5cb('0x36')]({'where':{'id':_0x3dbca8[_0xc5cb('0x2c')]['id']}})[_0xc5cb('0x16')](function(_0x4d95fe){return db[_0xc5cb('0x5d')]['transaction'](function(_0x37d0b1){return _0x4d95fe[_0xc5cb('0x5e')](_0x5b6c84,{'transaction':_0x37d0b1})[_0xc5cb('0x16')](function(){return BPromise[_0xc5cb('0x5f')](_0x2fd380,function(_0xedc889){return db[_0xc5cb('0x41')][_0xc5cb('0x60')]({'where':{'UserId':_0xedc889['id'],'WhatsappQueueId':_0x3dbca8[_0xc5cb('0x2c')]['id']},'transaction':_0x37d0b1});});})['then'](function(){_0x2fd380[_0xc5cb('0x61')](function(_0x214c7e){socket['emit'](_0xc5cb('0x62'),{'UserId':_0x214c7e['id'],'WhatsappQueueId':_0x4d95fe['id']});});});});});}})[_0xc5cb('0x16')](respondWithStatusCode(_0x2a092e,null))[_0xc5cb('0x2a')](handleError(_0x2a092e,null));};exports[_0xc5cb('0x63')]=function(_0x42c4dd,_0x35bbe4){return db['Team']['findAll']({'where':{'id':_0x42c4dd[_0xc5cb('0x28')][_0xc5cb('0x57')]},'attributes':['id'],'include':[{'model':db[_0xc5cb('0x4a')],'as':_0xc5cb('0x58'),'attributes':['id'],'raw':!![]}]})[_0xc5cb('0x16')](handleEntityNotFound(_0x35bbe4,null))[_0xc5cb('0x16')](function(_0x35ad58){var _0x1a826b=_['map'](_0x35ad58,'id');var _0x454e38=[];var _0x2879be=[];var _0x145912=squel[_0xc5cb('0x64')]();_0x145912[_0xc5cb('0x65')](_0xc5cb('0x66'))['from'](_0xc5cb('0x67'),'tq')[_0xc5cb('0x68')](_0xc5cb('0x69'),'ut',_0xc5cb('0x6a'))[_0xc5cb('0x26')](_0xc5cb('0x6b'),_0x42c4dd[_0xc5cb('0x2c')]['id']);for(var _0x1a6d90=0x0;_0x1a6d90<_0x35ad58[_0xc5cb('0x42')];_0x1a6d90+=0x1){let _0x21e234=_0x35ad58[_0x1a6d90];for(var _0x520f6e=0x0;_0x520f6e<_0x21e234['Agents'][_0xc5cb('0x42')];_0x520f6e+=0x1){let _0x2b26e4=_0x21e234[_0xc5cb('0x58')][_0x520f6e];var _0x5c4c0f=_0x145912[_0xc5cb('0x6c')]();_0x5c4c0f[_0xc5cb('0x26')](_0xc5cb('0x6d'),_0x2b26e4['id']);_0x2879be[_0xc5cb('0x6e')](db['sequelize'][_0xc5cb('0x28')](_0x5c4c0f['toString'](),{'type':db[_0xc5cb('0x5d')][_0xc5cb('0x6f')][_0xc5cb('0x70')]})[_0xc5cb('0x16')](function(_0x5d32e3){if(_0x5d32e3[_0xc5cb('0x42')]===0x1){return _0x2b26e4['id'];}else{var _0x5e8f13=_['every'](_[_0xc5cb('0x1f')](_0x5d32e3,_0xc5cb('0x71')),function(_0x4bc618){return _['includes'](_0x1a826b,_0x4bc618);});if(_0x5e8f13){return _0x2b26e4['id'];}}}));}}return BPromise[_0xc5cb('0x72')](_0x2879be)[_0xc5cb('0x16')](function(_0x34305f){_0x454e38=_(_0x454e38)[_0xc5cb('0x73')](_0x34305f)[_0xc5cb('0x74')]()['value']();return db['WhatsappQueue'][_0xc5cb('0x36')]({'where':{'id':_0x42c4dd[_0xc5cb('0x2c')]['id']}})[_0xc5cb('0x16')](function(_0x1c51b2){return db[_0xc5cb('0x5d')]['transaction'](function(_0x7e11aa){return _0x1c51b2[_0xc5cb('0x63')](_0x42c4dd[_0xc5cb('0x28')][_0xc5cb('0x57')],{'transaction':_0x7e11aa})['then'](function(){if(!_[_0xc5cb('0x75')](_0x454e38)){return _0x1c51b2[_0xc5cb('0x76')](_0x454e38,{'transaction':_0x7e11aa});}})[_0xc5cb('0x16')](function(){_0x454e38[_0xc5cb('0x61')](function(_0x2ca177){socket[_0xc5cb('0x77')](_0xc5cb('0x78'),{'UserId':_0x2ca177,'WhatsappQueueId':_0x1c51b2['id']});});});});});});})['then'](respondWithStatusCode(_0x35bbe4,null))[_0xc5cb('0x2a')](handleError(_0x35bbe4,null));};exports[_0xc5cb('0x79')]=function(_0x532492,_0x30f7ff){return db[_0xc5cb('0x20')][_0xc5cb('0x36')]({'where':{'id':_0x532492[_0xc5cb('0x2c')]['id']}})['then'](handleEntityNotFound(_0x30f7ff,null))[_0xc5cb('0x16')](function(_0x4c2a8a){if(_0x4c2a8a){return _0x4c2a8a[_0xc5cb('0x79')](_0x532492[_0xc5cb('0x38')]['ids'],_['omit'](_0x532492[_0xc5cb('0x38')],[_0xc5cb('0x57'),'id'])||{})['spread'](function(_0x24f86d){for(var _0x634ed0=0x0;_0x634ed0<_0x532492[_0xc5cb('0x38')][_0xc5cb('0x57')]['length'];_0x634ed0+=0x1){socket[_0xc5cb('0x77')](_0xc5cb('0x62'),{'UserId':Number(_0x532492[_0xc5cb('0x38')][_0xc5cb('0x57')][_0x634ed0]),'WhatsappQueueId':Number(_0x532492[_0xc5cb('0x2c')]['id'])});}return _0x24f86d;});}})[_0xc5cb('0x16')](respondWithResult(_0x30f7ff,null))[_0xc5cb('0x2a')](handleError(_0x30f7ff,null));};exports[_0xc5cb('0x76')]=function(_0x297af6,_0x35fbb9){return db[_0xc5cb('0x20')][_0xc5cb('0x36')]({'where':{'id':_0x297af6[_0xc5cb('0x2c')]['id']}})[_0xc5cb('0x16')](handleEntityNotFound(_0x35fbb9,null))['then'](function(_0x1e259c){if(_0x1e259c){return _0x1e259c[_0xc5cb('0x76')](_0x297af6['query']['ids'])[_0xc5cb('0x16')](function(){if(_[_0xc5cb('0x7a')](_0x297af6['query'][_0xc5cb('0x57')])){for(var _0x309702=0x0;_0x309702<_0x297af6[_0xc5cb('0x28')][_0xc5cb('0x57')][_0xc5cb('0x42')];_0x309702+=0x1){socket[_0xc5cb('0x77')](_0xc5cb('0x78'),{'UserId':Number(_0x297af6[_0xc5cb('0x28')][_0xc5cb('0x57')][_0x309702]),'WhatsappQueueId':Number(_0x297af6[_0xc5cb('0x2c')]['id'])});}}else{socket[_0xc5cb('0x77')](_0xc5cb('0x78'),{'UserId':Number(_0x297af6[_0xc5cb('0x28')][_0xc5cb('0x57')]),'WhatsappQueueId':Number(_0x297af6[_0xc5cb('0x2c')]['id'])});}});}})['then'](respondWithStatusCode(_0x35fbb9,null))[_0xc5cb('0x2a')](handleError(_0x35fbb9,null));};exports['getAgents']=function(_0x2d5f5c,_0xe9116c){var _0x3c65b6={};var _0x147fa9={};var _0xd15313;var _0x1852de;return db[_0xc5cb('0x20')][_0xc5cb('0x40')]({'where':{'id':_0x2d5f5c['params']['id']}})['then'](handleEntityNotFound(_0xe9116c,null))[_0xc5cb('0x16')](function(_0x2df06f){if(_0x2df06f){_0xd15313=_0x2df06f;_0x147fa9[_0xc5cb('0x2d')]=_['keys'](db[_0xc5cb('0x4a')][_0xc5cb('0x21')]);_0x147fa9[_0xc5cb('0x28')]=_[_0xc5cb('0x2e')](_0x2d5f5c[_0xc5cb('0x28')]);_0x147fa9[_0xc5cb('0x2f')]=_[_0xc5cb('0x30')](_0x147fa9['model'],_0x147fa9[_0xc5cb('0x28')]);_0x3c65b6[_0xc5cb('0x31')]=_['intersection'](_0x147fa9[_0xc5cb('0x2d')],qs[_0xc5cb('0x32')](_0x2d5f5c[_0xc5cb('0x28')][_0xc5cb('0x32')]));_0x3c65b6[_0xc5cb('0x31')]=_0x3c65b6['attributes'][_0xc5cb('0x42')]?_0x3c65b6[_0xc5cb('0x31')]:_0x147fa9[_0xc5cb('0x2d')];_0x3c65b6[_0xc5cb('0x45')]=qs['sort'](_0x2d5f5c[_0xc5cb('0x28')][_0xc5cb('0x46')]);_0x3c65b6['where']=qs[_0xc5cb('0x2f')](_[_0xc5cb('0x47')](_0x2d5f5c['query'],_0x147fa9[_0xc5cb('0x2f')]));if(_0x2d5f5c[_0xc5cb('0x28')][_0xc5cb('0x49')]){_0x3c65b6['where']=_[_0xc5cb('0x34')](_0x3c65b6[_0xc5cb('0x26')],{'$or':_['map'](_0x3c65b6[_0xc5cb('0x31')],function(_0x541726){var _0x30d747={};_0x30d747[_0x541726]={'$like':'%'+_0x2d5f5c[_0xc5cb('0x28')][_0xc5cb('0x49')]+'%'};return _0x30d747;})});}_0x3c65b6=_['merge']({},_0x3c65b6,_0x2d5f5c[_0xc5cb('0x35')]);return _0xd15313['getAgents'](_0x3c65b6);}})['then'](function(_0x5f024a){if(_0x5f024a){_0x1852de=_0x5f024a[_0xc5cb('0x42')];if(!_0x2d5f5c['query'][_0xc5cb('0x43')](_0xc5cb('0x44'))){_0x3c65b6[_0xc5cb('0x12')]=qs[_0xc5cb('0x12')](_0x2d5f5c['query'][_0xc5cb('0x12')]);_0x3c65b6[_0xc5cb('0x10')]=qs[_0xc5cb('0x10')](_0x2d5f5c[_0xc5cb('0x28')][_0xc5cb('0x10')]);}return _0xd15313[_0xc5cb('0x7b')](_0x3c65b6);}})[_0xc5cb('0x16')](function(_0x3e2520){if(_0x3e2520){return _0x3e2520?{'count':_0x1852de,'rows':_0x3e2520}:null;}})['then'](respondWithResult(_0xe9116c,null))[_0xc5cb('0x2a')](handleError(_0xe9116c,null));}; \ No newline at end of file +var _0x1485=['Agents','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','all','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','isArray','getAgents','bluebird','util','lodash','squel','../../components/parsers/qs','../../config/logger','../../config/environment','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','WhatsappQueues','error','stack','name','send','map','WhatsappQueue','rawAttributes','type','key','where','include','findAll','rows','catch','show','params','keys','query','filters','model','attributes','intersection','fields','includeAll','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','findOne','UserWhatsappQueue','length','nolimit','sort','pick','WhatsappQueueId','filter','User','findAndCountAll','UserId','updatedAt','createdAt','format','%s/%s','whatsappPause','Team','order','merge','hasOwnProperty','getTeams','addTeams','ids'];(function(_0x7bf1e2,_0x58bbb0){var _0x35aabc=function(_0x2a014e){while(--_0x2a014e){_0x7bf1e2['push'](_0x7bf1e2['shift']());}};_0x35aabc(++_0x58bbb0);}(_0x1485,0x9d));var _0x5148=function(_0x176213,_0x5add34){_0x176213=_0x176213-0x0;var _0x4aa9dd=_0x1485[_0x176213];return _0x4aa9dd;};'use strict';var BPromise=require(_0x5148('0x0'));var util=require(_0x5148('0x1'));var _=require(_0x5148('0x2'));var squel=require(_0x5148('0x3'));var Redis=require('ioredis');var qs=require(_0x5148('0x4'));var logger=require(_0x5148('0x5'))('api');var config=require(_0x5148('0x6'));var db=require('../../mysqldb')['db'];config[_0x5148('0x7')]=_[_0x5148('0x8')](config[_0x5148('0x7')],{'host':_0x5148('0x9'),'port':0x18eb});var socket=require(_0x5148('0xa'))(new Redis(config[_0x5148('0x7')]));require(_0x5148('0xb'))[_0x5148('0xc')](socket);function respondWithStatusCode(_0x35f3e3,_0x46e3b3){_0x46e3b3=_0x46e3b3||0xcc;return function(_0x3f70a8){if(_0x3f70a8){return _0x35f3e3[_0x5148('0xd')](_0x46e3b3);}return _0x35f3e3[_0x5148('0xe')](_0x46e3b3)[_0x5148('0xf')]();};}function respondWithResult(_0x5236fb,_0x1da687){_0x1da687=_0x1da687||0xc8;return function(_0x2ce45f){if(_0x2ce45f){return _0x5236fb[_0x5148('0xe')](_0x1da687)[_0x5148('0x10')](_0x2ce45f);}};}function respondWithFilteredResult(_0x25edce,_0x16e38c){return function(_0x4ca59c){if(_0x4ca59c){var _0x91d798=typeof _0x16e38c[_0x5148('0x11')]===_0x5148('0x12')&&typeof _0x16e38c[_0x5148('0x13')]===_0x5148('0x12');var _0x342b19=_0x4ca59c[_0x5148('0x14')];var _0x1b27e1=_0x91d798?0x0:_0x16e38c[_0x5148('0x11')];var _0xe36d44=_0x91d798?_0x4ca59c[_0x5148('0x14')]:_0x16e38c[_0x5148('0x11')]+_0x16e38c['limit'];var _0x5d2917;if(_0xe36d44>=_0x342b19){_0xe36d44=_0x342b19;_0x5d2917=0xc8;}else{_0x5d2917=0xce;}_0x25edce['status'](_0x5d2917);return _0x25edce[_0x5148('0x15')](_0x5148('0x16'),_0x1b27e1+'-'+_0xe36d44+'/'+_0x342b19)[_0x5148('0x10')](_0x4ca59c);}return null;};}function saveUpdates(_0x55885f){return function(_0x2cb3e8){if(_0x2cb3e8){return _0x2cb3e8['update'](_0x55885f)[_0x5148('0x17')](function(_0x2d9355){return _0x2d9355;});}return null;};}function removeEntity(_0x36b542){return function(_0xc28dcb){if(_0xc28dcb){return _0xc28dcb[_0x5148('0x18')]()[_0x5148('0x17')](function(){var _0xe64bed=_0xc28dcb[_0x5148('0x19')]({'plain':!![]});var _0x5b2497=_0x5148('0x1a');return db['UserProfileResource']['destroy']({'where':{'type':_0x5b2497,'resourceId':_0xe64bed['id']}})[_0x5148('0x17')](function(){return _0xc28dcb;});})['then'](function(){_0x36b542[_0x5148('0xe')](0xcc)[_0x5148('0xf')]();});}};}function handleEntityNotFound(_0x268ff4){return function(_0x6a2190){if(!_0x6a2190){_0x268ff4[_0x5148('0xd')](0x194);}return _0x6a2190;};}function handleError(_0x4563f6,_0x2d40a5){_0x2d40a5=_0x2d40a5||0x1f4;return function(_0x521b87){logger[_0x5148('0x1b')](_0x521b87[_0x5148('0x1c')]);if(_0x521b87[_0x5148('0x1d')]){delete _0x521b87['name'];}_0x4563f6[_0x5148('0xe')](_0x2d40a5)[_0x5148('0x1e')](_0x521b87);};}exports['index']=function(_0x40ef8b,_0x369368){var _0x291c71={};var _0x3521a3={'count':0x0,'rows':[]};var _0x3c05ec=_[_0x5148('0x1f')](db[_0x5148('0x20')][_0x5148('0x21')],function(_0x1d39bb){return{'name':_0x1d39bb['fieldName'],'type':_0x1d39bb[_0x5148('0x22')][_0x5148('0x23')]};});_0x291c71=qs['getOptions'](_0x3c05ec,_0x40ef8b);var _0x384063={'where':_0x291c71[_0x5148('0x24')]};return db[_0x5148('0x20')][_0x5148('0x14')](_0x384063)[_0x5148('0x17')](function(_0x516a22){_0x3521a3[_0x5148('0x14')]=_0x516a22;_0x291c71[_0x5148('0x25')]=qs[_0x5148('0x25')](_0x40ef8b['query']);return db['WhatsappQueue'][_0x5148('0x26')](_0x291c71);})['then'](function(_0x1fd99f){_0x3521a3[_0x5148('0x27')]=_0x1fd99f;return _0x3521a3;})['then'](respondWithFilteredResult(_0x369368,_0x291c71))[_0x5148('0x28')](handleError(_0x369368,null));};exports[_0x5148('0x29')]=function(_0x587c25,_0x1854be){var _0x49db9b={'raw':!![],'where':{'id':_0x587c25[_0x5148('0x2a')]['id']}},_0x10c48a={};_0x10c48a['model']=_[_0x5148('0x2b')](db[_0x5148('0x20')][_0x5148('0x21')]);_0x10c48a['query']=_['keys'](_0x587c25[_0x5148('0x2c')]);_0x10c48a[_0x5148('0x2d')]=_['intersection'](_0x10c48a[_0x5148('0x2e')],_0x10c48a[_0x5148('0x2c')]);_0x49db9b[_0x5148('0x2f')]=_[_0x5148('0x30')](_0x10c48a['model'],qs[_0x5148('0x31')](_0x587c25[_0x5148('0x2c')][_0x5148('0x31')]));_0x49db9b['attributes']=_0x49db9b['attributes']['length']?_0x49db9b[_0x5148('0x2f')]:_0x10c48a[_0x5148('0x2e')];if(_0x587c25[_0x5148('0x2c')][_0x5148('0x32')]){_0x49db9b[_0x5148('0x25')]=[{'all':!![]}];}_0x49db9b=_['merge']({},_0x49db9b,_0x587c25[_0x5148('0x33')]);return db[_0x5148('0x20')]['find'](_0x49db9b)[_0x5148('0x17')](handleEntityNotFound(_0x1854be,null))[_0x5148('0x17')](respondWithResult(_0x1854be,null))['catch'](handleError(_0x1854be,null));};exports[_0x5148('0x34')]=function(_0x4dbf60,_0x1f97a6){return db[_0x5148('0x20')][_0x5148('0x34')](_0x4dbf60[_0x5148('0x35')],{})[_0x5148('0x17')](function(_0x66e986){var _0x57e60f=_0x4dbf60[_0x5148('0x36')]['get']({'plain':!![]});if(!_0x57e60f)throw new Error(_0x5148('0x37'));if(_0x57e60f['role']===_0x5148('0x36')){var _0x567750=_0x66e986[_0x5148('0x19')]({'plain':!![]});var _0x5be4c6='WhatsappQueues';return db[_0x5148('0x38')][_0x5148('0x39')]({'where':{'name':_0x5be4c6,'userProfileId':_0x57e60f['userProfileId']},'raw':!![]})['then'](function(_0x2b0aab){if(_0x2b0aab&&_0x2b0aab[_0x5148('0x3a')]===0x0){return db[_0x5148('0x3b')][_0x5148('0x34')]({'name':_0x567750[_0x5148('0x1d')],'resourceId':_0x567750['id'],'type':_0x2b0aab[_0x5148('0x1d')],'sectionId':_0x2b0aab['id']},{})[_0x5148('0x17')](function(){return _0x66e986;});}else{return _0x66e986;}})[_0x5148('0x28')](function(_0x639208){logger[_0x5148('0x1b')](_0x5148('0x3c'),_0x639208);throw _0x639208;});}return _0x66e986;})[_0x5148('0x17')](respondWithResult(_0x1f97a6,0xc9))[_0x5148('0x28')](handleError(_0x1f97a6,null));};exports['update']=function(_0xa362a1,_0x345537){if(_0xa362a1[_0x5148('0x35')]['id']){delete _0xa362a1['body']['id'];}return db[_0x5148('0x20')][_0x5148('0x39')]({'where':{'id':_0xa362a1['params']['id']}})[_0x5148('0x17')](handleEntityNotFound(_0x345537,null))['then'](saveUpdates(_0xa362a1[_0x5148('0x35')],null))[_0x5148('0x17')](respondWithResult(_0x345537,null))[_0x5148('0x28')](handleError(_0x345537,null));};exports[_0x5148('0x18')]=function(_0x47718f,_0x365f12){return db[_0x5148('0x20')]['find']({'where':{'id':_0x47718f[_0x5148('0x2a')]['id']}})[_0x5148('0x17')](handleEntityNotFound(_0x365f12,null))[_0x5148('0x17')](removeEntity(_0x365f12,null))[_0x5148('0x28')](handleError(_0x365f12,null));};exports[_0x5148('0x3d')]=function(_0x4ca594,_0x3248d1){return db[_0x5148('0x20')][_0x5148('0x3d')]()[_0x5148('0x17')](respondWithResult(_0x3248d1,null))[_0x5148('0x28')](handleError(_0x3248d1,null));};exports['getMembers']=function(_0x1347a8,_0x285af9){var _0xde26={'raw':!![],'where':{}},_0x46607d={},_0x3db9e4;return db[_0x5148('0x20')][_0x5148('0x3e')]({'where':{'id':_0x1347a8['params']['id']}})[_0x5148('0x17')](handleEntityNotFound(_0x285af9,null))[_0x5148('0x17')](function(_0x6843b0){if(_0x6843b0){_0x3db9e4=_0x6843b0[_0x5148('0x19')]({'plain':!![]});_0x46607d[_0x5148('0x2e')]=_[_0x5148('0x2b')](db[_0x5148('0x3f')][_0x5148('0x21')]);_0x46607d[_0x5148('0x2c')]=_[_0x5148('0x2b')](_0x1347a8[_0x5148('0x2c')]);_0x46607d['filters']=_[_0x5148('0x30')](_0x46607d['model'],_0x46607d[_0x5148('0x2c')]);_0xde26[_0x5148('0x2f')]=_[_0x5148('0x30')](_0x46607d['model'],qs[_0x5148('0x31')](_0x1347a8[_0x5148('0x2c')][_0x5148('0x31')]));_0xde26[_0x5148('0x2f')]=_0xde26[_0x5148('0x2f')][_0x5148('0x40')]?_0xde26[_0x5148('0x2f')]:_0x46607d['model'];if(!_0x1347a8['query']['hasOwnProperty'](_0x5148('0x41'))){_0xde26[_0x5148('0x13')]=qs[_0x5148('0x13')](_0x1347a8[_0x5148('0x2c')][_0x5148('0x13')]);_0xde26[_0x5148('0x11')]=qs[_0x5148('0x11')](_0x1347a8[_0x5148('0x2c')][_0x5148('0x11')]);}_0xde26['order']=qs[_0x5148('0x42')](_0x1347a8['query']['sort']);_0xde26[_0x5148('0x24')]=qs['filters'](_[_0x5148('0x43')](_0x1347a8[_0x5148('0x2c')],_0x46607d[_0x5148('0x2d')]));_0xde26[_0x5148('0x24')][_0x5148('0x44')]=_0x6843b0['id'];if(_0x1347a8[_0x5148('0x2c')][_0x5148('0x45')]){_0xde26[_0x5148('0x24')]=_['merge'](_0xde26['where'],{'$or':_[_0x5148('0x1f')](_0xde26[_0x5148('0x2f')],function(_0x37849d){var _0x170dc2={};_0x170dc2[_0x37849d]={'$like':'%'+_0x1347a8[_0x5148('0x2c')][_0x5148('0x45')]+'%'};return _0x170dc2;})});}_0xde26=_['merge']({},_0xde26,_0x1347a8['options']);return db[_0x5148('0x3f')][_0x5148('0x26')](_0xde26);}})['then'](function(_0x43f991){if(_0x43f991){return db[_0x5148('0x46')][_0x5148('0x47')]({'where':{'id':_[_0x5148('0x1f')](_0x43f991,_0x5148('0x48')),'role':'agent'},'attributes':['id','name','whatsappPause',_0x5148('0x49'),_0x5148('0x4a')]});}})[_0x5148('0x17')](function(_0x318310){if(_0x318310){return{'count':_0x318310[_0x5148('0x14')],'rows':_['map'](_0x318310[_0x5148('0x27')],function(_0x76611f){return{'membername':_0x76611f['name'],'UserId':_0x76611f['id'],'queue_name':_0x3db9e4[_0x5148('0x1d')],'WhatsappQueueId':_0x3db9e4['id'],'interface':util[_0x5148('0x4b')](_0x5148('0x4c'),'SIP',_0x76611f[_0x5148('0x1d')]),'penalty':0x0,'paused':_0x76611f[_0x5148('0x4d')],'createdAt':_0x76611f[_0x5148('0x4a')],'updatedAt':_0x76611f[_0x5148('0x49')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5148('0x17')](respondWithFilteredResult(_0x285af9,_0xde26))['catch'](handleError(_0x285af9,null));};exports['getTeams']=function(_0x15ac04,_0x1a1da0){var _0x30467b={};var _0x311fb0={};var _0xc7dae2;var _0x56da3c;return db[_0x5148('0x20')]['findOne']({'where':{'id':_0x15ac04[_0x5148('0x2a')]['id']}})[_0x5148('0x17')](handleEntityNotFound(_0x1a1da0,null))[_0x5148('0x17')](function(_0x2d10f1){if(_0x2d10f1){_0xc7dae2=_0x2d10f1;_0x311fb0[_0x5148('0x2e')]=_[_0x5148('0x2b')](db[_0x5148('0x4e')]['rawAttributes']);_0x311fb0['query']=_['keys'](_0x15ac04[_0x5148('0x2c')]);_0x311fb0[_0x5148('0x2d')]=_[_0x5148('0x30')](_0x311fb0[_0x5148('0x2e')],_0x311fb0[_0x5148('0x2c')]);_0x30467b[_0x5148('0x2f')]=_['intersection'](_0x311fb0[_0x5148('0x2e')],qs[_0x5148('0x31')](_0x15ac04[_0x5148('0x2c')][_0x5148('0x31')]));_0x30467b[_0x5148('0x2f')]=_0x30467b[_0x5148('0x2f')][_0x5148('0x40')]?_0x30467b[_0x5148('0x2f')]:_0x311fb0[_0x5148('0x2e')];_0x30467b[_0x5148('0x4f')]=qs[_0x5148('0x42')](_0x15ac04[_0x5148('0x2c')][_0x5148('0x42')]);_0x30467b[_0x5148('0x24')]=qs[_0x5148('0x2d')](_['pick'](_0x15ac04[_0x5148('0x2c')],_0x311fb0['filters']));if(_0x15ac04[_0x5148('0x2c')][_0x5148('0x45')]){_0x30467b[_0x5148('0x24')]=_[_0x5148('0x50')](_0x30467b[_0x5148('0x24')],{'$or':_[_0x5148('0x1f')](_0x30467b[_0x5148('0x2f')],function(_0xa09e9a){var _0x3ab6a5={};_0x3ab6a5[_0xa09e9a]={'$like':'%'+_0x15ac04[_0x5148('0x2c')]['filter']+'%'};return _0x3ab6a5;})});}_0x30467b=_[_0x5148('0x50')]({},_0x30467b,_0x15ac04[_0x5148('0x33')]);return _0xc7dae2['getTeams'](_0x30467b);}})[_0x5148('0x17')](function(_0x2b2edd){if(_0x2b2edd){_0x56da3c=_0x2b2edd[_0x5148('0x40')];if(!_0x15ac04[_0x5148('0x2c')][_0x5148('0x51')](_0x5148('0x41'))){_0x30467b['limit']=qs[_0x5148('0x13')](_0x15ac04[_0x5148('0x2c')][_0x5148('0x13')]);_0x30467b[_0x5148('0x11')]=qs['offset'](_0x15ac04['query'][_0x5148('0x11')]);}return _0xc7dae2[_0x5148('0x52')](_0x30467b);}})[_0x5148('0x17')](function(_0x4ef5cd){if(_0x4ef5cd){return _0x4ef5cd?{'count':_0x56da3c,'rows':_0x4ef5cd}:null;}})['then'](respondWithResult(_0x1a1da0,null))[_0x5148('0x28')](handleError(_0x1a1da0,null));};exports[_0x5148('0x53')]=function(_0x1ed9d8,_0x24900f){var _0x3cf315=_0x1ed9d8[_0x5148('0x35')][_0x5148('0x54')];return db[_0x5148('0x4e')]['findAll']({'where':{'id':_0x3cf315},'attributes':['id'],'include':[{'model':db[_0x5148('0x46')],'as':_0x5148('0x55'),'attributes':['id',_0x5148('0x1d'),'online',_0x5148('0x56'),'interface'],'raw':!![]}]})[_0x5148('0x17')](function(_0x1c5a22){if(_0x1c5a22){var _0x38b973=_[_0x5148('0x57')](_0x1c5a22,function(_0x2e351f){var _0x456a63=_0x2e351f[_0x5148('0x19')]({'plain':!![]});return _0x456a63[_0x5148('0x55')];});return db[_0x5148('0x20')][_0x5148('0x39')]({'where':{'id':_0x1ed9d8[_0x5148('0x2a')]['id']}})[_0x5148('0x17')](function(_0x34242d){return db[_0x5148('0x58')][_0x5148('0x59')](function(_0x4cad44){return _0x34242d[_0x5148('0x53')](_0x3cf315,{'transaction':_0x4cad44})[_0x5148('0x17')](function(){return BPromise[_0x5148('0x5a')](_0x38b973,function(_0x225ff4){return db['UserWhatsappQueue'][_0x5148('0x5b')]({'where':{'UserId':_0x225ff4['id'],'WhatsappQueueId':_0x1ed9d8[_0x5148('0x2a')]['id']},'transaction':_0x4cad44});});})[_0x5148('0x17')](function(){_0x38b973[_0x5148('0x5c')](function(_0x2f0a9b){socket[_0x5148('0x5d')](_0x5148('0x5e'),{'UserId':_0x2f0a9b['id'],'WhatsappQueueId':_0x34242d['id']});});});});});}})[_0x5148('0x17')](respondWithStatusCode(_0x24900f,null))['catch'](handleError(_0x24900f,null));};exports[_0x5148('0x5f')]=function(_0x223207,_0x5cd8f4){return db[_0x5148('0x4e')][_0x5148('0x26')]({'where':{'id':_0x223207['query'][_0x5148('0x54')]},'attributes':['id'],'include':[{'model':db[_0x5148('0x46')],'as':_0x5148('0x55'),'attributes':['id'],'raw':!![]}]})[_0x5148('0x17')](handleEntityNotFound(_0x5cd8f4,null))[_0x5148('0x17')](function(_0x270157){var _0x444560=_[_0x5148('0x1f')](_0x270157,'id');var _0x2e9087=[];var _0x3a8c34=[];var _0x4dc569=squel[_0x5148('0x60')]();_0x4dc569[_0x5148('0x61')](_0x5148('0x62'))[_0x5148('0x63')](_0x5148('0x64'),'tq')[_0x5148('0x65')](_0x5148('0x66'),'ut',_0x5148('0x67'))['where']('WhatsappQueueId\x20=\x20?',_0x223207['params']['id']);for(var _0x5efd36=0x0;_0x5efd36<_0x270157[_0x5148('0x40')];_0x5efd36+=0x1){let _0x4e43f4=_0x270157[_0x5efd36];for(var _0x903b0d=0x0;_0x903b0d<_0x4e43f4[_0x5148('0x55')][_0x5148('0x40')];_0x903b0d+=0x1){let _0x507f4f=_0x4e43f4[_0x5148('0x55')][_0x903b0d];var _0x188ec7=_0x4dc569[_0x5148('0x68')]();_0x188ec7[_0x5148('0x24')](_0x5148('0x69'),_0x507f4f['id']);_0x3a8c34['push'](db[_0x5148('0x58')][_0x5148('0x2c')](_0x188ec7[_0x5148('0x6a')](),{'type':db['sequelize'][_0x5148('0x6b')][_0x5148('0x6c')]})['then'](function(_0x5c99cf){if(_0x5c99cf[_0x5148('0x40')]===0x1){return _0x507f4f['id'];}else{var _0x1db1a3=_[_0x5148('0x6d')](_[_0x5148('0x1f')](_0x5c99cf,_0x5148('0x6e')),function(_0x5a9d55){return _['includes'](_0x444560,_0x5a9d55);});if(_0x1db1a3){return _0x507f4f['id'];}}}));}}return BPromise[_0x5148('0x6f')](_0x3a8c34)[_0x5148('0x17')](function(_0x1cd0ce){_0x2e9087=_(_0x2e9087)['union'](_0x1cd0ce)[_0x5148('0x70')]()[_0x5148('0x71')]();return db['WhatsappQueue'][_0x5148('0x39')]({'where':{'id':_0x223207[_0x5148('0x2a')]['id']}})['then'](function(_0x45e122){return db[_0x5148('0x58')][_0x5148('0x59')](function(_0x158063){return _0x45e122[_0x5148('0x5f')](_0x223207[_0x5148('0x2c')]['ids'],{'transaction':_0x158063})[_0x5148('0x17')](function(){if(!_[_0x5148('0x72')](_0x2e9087)){return _0x45e122[_0x5148('0x73')](_0x2e9087,{'transaction':_0x158063});}})['then'](function(){_0x2e9087[_0x5148('0x5c')](function(_0x350369){socket[_0x5148('0x5d')](_0x5148('0x74'),{'UserId':_0x350369,'WhatsappQueueId':_0x45e122['id']});});});});});});})[_0x5148('0x17')](respondWithStatusCode(_0x5cd8f4,null))['catch'](handleError(_0x5cd8f4,null));};exports[_0x5148('0x75')]=function(_0x1cbfd4,_0x39f4df){return db[_0x5148('0x20')][_0x5148('0x39')]({'where':{'id':_0x1cbfd4[_0x5148('0x2a')]['id']}})[_0x5148('0x17')](handleEntityNotFound(_0x39f4df,null))[_0x5148('0x17')](function(_0x11422c){if(_0x11422c){return _0x11422c[_0x5148('0x75')](_0x1cbfd4[_0x5148('0x35')]['ids'],_[_0x5148('0x76')](_0x1cbfd4[_0x5148('0x35')],[_0x5148('0x54'),'id'])||{})['spread'](function(_0x2a3893){for(var _0x585255=0x0;_0x585255<_0x1cbfd4[_0x5148('0x35')][_0x5148('0x54')][_0x5148('0x40')];_0x585255+=0x1){socket[_0x5148('0x5d')](_0x5148('0x5e'),{'UserId':Number(_0x1cbfd4['body']['ids'][_0x585255]),'WhatsappQueueId':Number(_0x1cbfd4[_0x5148('0x2a')]['id'])});}return _0x2a3893;});}})[_0x5148('0x17')](respondWithResult(_0x39f4df,null))[_0x5148('0x28')](handleError(_0x39f4df,null));};exports[_0x5148('0x73')]=function(_0x7b3b69,_0x4cbaee){return db[_0x5148('0x20')]['find']({'where':{'id':_0x7b3b69[_0x5148('0x2a')]['id']}})['then'](handleEntityNotFound(_0x4cbaee,null))[_0x5148('0x17')](function(_0xf6a926){if(_0xf6a926){return _0xf6a926['removeAgents'](_0x7b3b69[_0x5148('0x2c')][_0x5148('0x54')])[_0x5148('0x17')](function(){if(_[_0x5148('0x77')](_0x7b3b69[_0x5148('0x2c')][_0x5148('0x54')])){for(var _0x311d3a=0x0;_0x311d3a<_0x7b3b69[_0x5148('0x2c')]['ids']['length'];_0x311d3a+=0x1){socket['emit'](_0x5148('0x74'),{'UserId':Number(_0x7b3b69[_0x5148('0x2c')][_0x5148('0x54')][_0x311d3a]),'WhatsappQueueId':Number(_0x7b3b69['params']['id'])});}}else{socket['emit'](_0x5148('0x74'),{'UserId':Number(_0x7b3b69[_0x5148('0x2c')][_0x5148('0x54')]),'WhatsappQueueId':Number(_0x7b3b69[_0x5148('0x2a')]['id'])});}});}})[_0x5148('0x17')](respondWithStatusCode(_0x4cbaee,null))[_0x5148('0x28')](handleError(_0x4cbaee,null));};exports[_0x5148('0x78')]=function(_0x2a3a56,_0x655819){var _0x221f60={};var _0x1f3c71={};var _0x2f2685;var _0x47a663;return db[_0x5148('0x20')][_0x5148('0x3e')]({'where':{'id':_0x2a3a56[_0x5148('0x2a')]['id']}})[_0x5148('0x17')](handleEntityNotFound(_0x655819,null))['then'](function(_0x2edeeb){if(_0x2edeeb){_0x2f2685=_0x2edeeb;_0x1f3c71[_0x5148('0x2e')]=_['keys'](db[_0x5148('0x46')][_0x5148('0x21')]);_0x1f3c71[_0x5148('0x2c')]=_['keys'](_0x2a3a56[_0x5148('0x2c')]);_0x1f3c71[_0x5148('0x2d')]=_['intersection'](_0x1f3c71[_0x5148('0x2e')],_0x1f3c71[_0x5148('0x2c')]);_0x221f60[_0x5148('0x2f')]=_[_0x5148('0x30')](_0x1f3c71[_0x5148('0x2e')],qs[_0x5148('0x31')](_0x2a3a56[_0x5148('0x2c')][_0x5148('0x31')]));_0x221f60[_0x5148('0x2f')]=_0x221f60[_0x5148('0x2f')][_0x5148('0x40')]?_0x221f60[_0x5148('0x2f')]:_0x1f3c71['model'];_0x221f60[_0x5148('0x4f')]=qs[_0x5148('0x42')](_0x2a3a56[_0x5148('0x2c')]['sort']);_0x221f60[_0x5148('0x24')]=qs[_0x5148('0x2d')](_[_0x5148('0x43')](_0x2a3a56[_0x5148('0x2c')],_0x1f3c71[_0x5148('0x2d')]));if(_0x2a3a56[_0x5148('0x2c')]['filter']){_0x221f60[_0x5148('0x24')]=_['merge'](_0x221f60[_0x5148('0x24')],{'$or':_['map'](_0x221f60[_0x5148('0x2f')],function(_0x11fe8d){var _0x45c63c={};_0x45c63c[_0x11fe8d]={'$like':'%'+_0x2a3a56[_0x5148('0x2c')][_0x5148('0x45')]+'%'};return _0x45c63c;})});}_0x221f60=_[_0x5148('0x50')]({},_0x221f60,_0x2a3a56['options']);return _0x2f2685[_0x5148('0x78')](_0x221f60);}})[_0x5148('0x17')](function(_0x3d5068){if(_0x3d5068){_0x47a663=_0x3d5068[_0x5148('0x40')];if(!_0x2a3a56[_0x5148('0x2c')][_0x5148('0x51')](_0x5148('0x41'))){_0x221f60[_0x5148('0x13')]=qs[_0x5148('0x13')](_0x2a3a56[_0x5148('0x2c')]['limit']);_0x221f60['offset']=qs[_0x5148('0x11')](_0x2a3a56[_0x5148('0x2c')]['offset']);}return _0x2f2685['getAgents'](_0x221f60);}})[_0x5148('0x17')](function(_0x7cb0c0){if(_0x7cb0c0){return _0x7cb0c0?{'count':_0x47a663,'rows':_0x7cb0c0}:null;}})['then'](respondWithResult(_0x655819,null))[_0x5148('0x28')](handleError(_0x655819,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index d3c120a..81d018b 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 _0xd60c=['hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0xf485fd,_0x5f34e0){var _0x5010c2=function(_0x4ef3cc){while(--_0x4ef3cc){_0xf485fd['push'](_0xf485fd['shift']());}};_0x5010c2(++_0x5f34e0);}(_0xd60c,0x99));var _0xcd60=function(_0x55fed9,_0xc9729d){_0x55fed9=_0x55fed9-0x0;var _0x30ea64=_0xd60c[_0x55fed9];return _0x30ea64;};'use strict';var EventEmitter=require(_0xcd60('0x0'));var WhatsappQueue=require(_0xcd60('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xcd60('0x2')](0x0);var events={'afterCreate':_0xcd60('0x3'),'afterUpdate':_0xcd60('0x4'),'afterDestroy':_0xcd60('0x5')};function emitEvent(_0x3a1a1f){return function(_0x96c68c,_0x5d52b7,_0x145e5b){WhatsappQueueEvents['emit'](_0x3a1a1f+':'+_0x96c68c['id'],_0x96c68c);WhatsappQueueEvents[_0xcd60('0x6')](_0x3a1a1f,_0x96c68c);_0x145e5b(null);};}for(var e in events){if(events[_0xcd60('0x7')](e)){var event=events[e];WhatsappQueue[_0xcd60('0x8')](e,emitEvent(event));}}module[_0xcd60('0x9')]=WhatsappQueueEvents; \ No newline at end of file +var _0x9e43=['exports','../../mysqldb','WhatsappQueue','setMaxListeners','update','emit','hook'];(function(_0x2cbc89,_0x31d471){var _0x2c2c88=function(_0x568c36){while(--_0x568c36){_0x2cbc89['push'](_0x2cbc89['shift']());}};_0x2c2c88(++_0x31d471);}(_0x9e43,0x1a5));var _0x39e4=function(_0x3158d2,_0x277d23){_0x3158d2=_0x3158d2-0x0;var _0x57c15a=_0x9e43[_0x3158d2];return _0x57c15a;};'use strict';var EventEmitter=require('events');var WhatsappQueue=require(_0x39e4('0x0'))['db'][_0x39e4('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x39e4('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x39e4('0x3'),'afterDestroy':'remove'};function emitEvent(_0x55f4e5){return function(_0x1460cf,_0x47756d,_0x4811fa){WhatsappQueueEvents[_0x39e4('0x4')](_0x55f4e5+':'+_0x1460cf['id'],_0x1460cf);WhatsappQueueEvents[_0x39e4('0x4')](_0x55f4e5,_0x1460cf);_0x4811fa(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappQueue[_0x39e4('0x5')](e,emitEvent(event));}}module[_0x39e4('0x6')]=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index 2457efc..fc3636e 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 _0xf939=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','WhatsappQueue','whatsapp_queues'];(function(_0x7ac741,_0x5d25b2){var _0x5cff77=function(_0x3f6a78){while(--_0x3f6a78){_0x7ac741['push'](_0x7ac741['shift']());}};_0x5cff77(++_0x5d25b2);}(_0xf939,0x1b0));var _0x9f93=function(_0x410ff7,_0x55c99c){_0x410ff7=_0x410ff7-0x0;var _0x5a0232=_0xf939[_0x410ff7];return _0x5a0232;};'use strict';var _=require(_0x9f93('0x0'));var util=require('util');var logger=require(_0x9f93('0x1'))(_0x9f93('0x2'));var moment=require(_0x9f93('0x3'));var BPromise=require(_0x9f93('0x4'));var rp=require(_0x9f93('0x5'));var fs=require('fs');var path=require(_0x9f93('0x6'));var rimraf=require(_0x9f93('0x7'));var config=require(_0x9f93('0x8'));var attributes=require('./whatsappQueue.attributes');module[_0x9f93('0x9')]=function(_0xcc9996,_0x35f40a){return _0xcc9996['define'](_0x9f93('0xa'),attributes,{'tableName':_0x9f93('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2d0=['./whatsappQueue.attributes','define','WhatsappQueue','whatsapp_queues','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x36232e,_0x1b399e){var _0x86eb83=function(_0x375331){while(--_0x375331){_0x36232e['push'](_0x36232e['shift']());}};_0x86eb83(++_0x1b399e);}(_0xd2d0,0x148));var _0x0d2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2d0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0d2d('0x0'));var util=require(_0x0d2d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0d2d('0x2'));var BPromise=require(_0x0d2d('0x3'));var rp=require(_0x0d2d('0x4'));var fs=require('fs');var path=require(_0x0d2d('0x5'));var rimraf=require(_0x0d2d('0x6'));var config=require(_0x0d2d('0x7'));var attributes=require(_0x0d2d('0x8'));module['exports']=function(_0x2220f5,_0x4145b0){return _0x2220f5[_0x0d2d('0x9')](_0x0d2d('0xa'),attributes,{'tableName':_0x0d2d('0xb'),'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 9ce1ca2..82ef096 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 _0x8b41=['../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetWhatsappQueue','WhatsappQueue','options','raw','where','limit','include','map','model','attributes','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x351998,_0x23b175){var _0x2d836a=function(_0xe002d6){while(--_0xe002d6){_0x351998['push'](_0x351998['shift']());}};_0x2d836a(++_0x23b175);}(_0x8b41,0x7d));var _0x18b4=function(_0x180a80,_0xf10fc9){_0x180a80=_0x180a80-0x0;var _0x47a48b=_0x8b41[_0x180a80];return _0x47a48b;};'use strict';var _=require(_0x18b4('0x0'));var util=require(_0x18b4('0x1'));var moment=require(_0x18b4('0x2'));var BPromise=require(_0x18b4('0x3'));var rs=require(_0x18b4('0x4'));var fs=require('fs');var Redis=require(_0x18b4('0x5'));var db=require(_0x18b4('0x6'))['db'];var utils=require(_0x18b4('0x7'));var logger=require(_0x18b4('0x8'))(_0x18b4('0x9'));var config=require('../../config/environment');var jayson=require(_0x18b4('0xa'));var client=jayson[_0x18b4('0xb')][_0x18b4('0xc')]({'port':0x232a});config[_0x18b4('0xd')]=_[_0x18b4('0xe')](config[_0x18b4('0xd')],{'host':_0x18b4('0xf'),'port':0x18eb});var socket=require(_0x18b4('0x10'))(new Redis(config[_0x18b4('0xd')]));require(_0x18b4('0x11'))[_0x18b4('0x12')](socket);function respondWithRpcPromise(_0x57c0af,_0x31eac0,_0x194eb6){return new BPromise(function(_0x437db7,_0x49d5e0){return client[_0x18b4('0x13')](_0x57c0af,_0x194eb6)[_0x18b4('0x14')](function(_0x46b612){logger[_0x18b4('0x15')](_0x18b4('0x16'),_0x31eac0,_0x18b4('0x17'));logger[_0x18b4('0x18')](_0x18b4('0x19'),_0x31eac0,_0x18b4('0x17'),JSON[_0x18b4('0x1a')](_0x46b612));if(_0x46b612[_0x18b4('0x1b')]){if(_0x46b612[_0x18b4('0x1b')][_0x18b4('0x1c')]===0x1f4){logger[_0x18b4('0x1b')](_0x18b4('0x16'),_0x31eac0,_0x46b612[_0x18b4('0x1b')][_0x18b4('0x1d')]);return _0x49d5e0(_0x46b612[_0x18b4('0x1b')]['message']);}logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x31eac0,_0x46b612[_0x18b4('0x1b')]['message']);return _0x437db7(_0x46b612[_0x18b4('0x1b')][_0x18b4('0x1d')]);}else{logger[_0x18b4('0x15')]('WhatsappQueue,\x20%s,\x20%s',_0x31eac0,_0x18b4('0x17'));_0x437db7(_0x46b612[_0x18b4('0x1e')][_0x18b4('0x1d')]);}})[_0x18b4('0x1f')](function(_0x1e9619){logger[_0x18b4('0x1b')](_0x18b4('0x16'),_0x31eac0,_0x1e9619);_0x49d5e0(_0x1e9619);});});}exports[_0x18b4('0x20')]=function(_0x100c6b){var _0x530a8b=this;return new Promise(function(_0x47bbd7,_0x16e64e){return db[_0x18b4('0x21')]['findAll']({'raw':_0x100c6b['options']?_0x100c6b[_0x18b4('0x22')][_0x18b4('0x23')]===undefined?!![]:![]:!![],'where':_0x100c6b['options']?_0x100c6b['options'][_0x18b4('0x24')]||null:null,'attributes':_0x100c6b[_0x18b4('0x22')]?_0x100c6b[_0x18b4('0x22')]['attributes']||null:null,'limit':_0x100c6b['options']?_0x100c6b[_0x18b4('0x22')][_0x18b4('0x25')]||null:null,'include':_0x100c6b[_0x18b4('0x22')]?_0x100c6b[_0x18b4('0x22')][_0x18b4('0x26')]?_[_0x18b4('0x27')](_0x100c6b[_0x18b4('0x22')][_0x18b4('0x26')],function(_0x4ff512){return{'model':db[_0x4ff512[_0x18b4('0x28')]],'as':_0x4ff512['as'],'attributes':_0x4ff512[_0x18b4('0x29')],'include':_0x4ff512[_0x18b4('0x26')]?_[_0x18b4('0x27')](_0x4ff512[_0x18b4('0x26')],function(_0x5b4f0a){return{'model':db[_0x5b4f0a[_0x18b4('0x28')]],'as':_0x5b4f0a['as'],'attributes':_0x5b4f0a['attributes'],'include':_0x5b4f0a[_0x18b4('0x26')]?_['map'](_0x5b4f0a['include'],function(_0x2934f9){return{'model':db[_0x2934f9[_0x18b4('0x28')]],'as':_0x2934f9['as'],'attributes':_0x2934f9['attributes']};}):[]};}):[]};}):[]:[]})[_0x18b4('0x14')](function(_0x3e5abf){logger[_0x18b4('0x15')](_0x18b4('0x20'),_0x100c6b);logger[_0x18b4('0x18')]('GetWhatsappQueue',_0x100c6b,JSON['stringify'](_0x3e5abf));_0x47bbd7(_0x3e5abf);})[_0x18b4('0x1f')](function(_0x122534){logger['error'](_0x18b4('0x20'),_0x122534[_0x18b4('0x1d')],_0x100c6b);_0x16e64e(_0x530a8b[_0x18b4('0x1b')](0x1f4,_0x122534[_0x18b4('0x1d')]));});});};exports[_0x18b4('0x2a')]=function(_0x446096){var _0x28fb7d=this;return new Promise(function(_0x38a99c,_0x5e69b3){return db[_0x18b4('0x21')][_0x18b4('0x2b')]({'raw':_0x446096['options']?_0x446096['options'][_0x18b4('0x23')]===undefined?!![]:![]:!![],'where':_0x446096[_0x18b4('0x22')]?_0x446096[_0x18b4('0x22')][_0x18b4('0x24')]||null:null,'attributes':_0x446096[_0x18b4('0x22')]?_0x446096[_0x18b4('0x22')][_0x18b4('0x29')]||null:null,'include':_0x446096['options']?_0x446096[_0x18b4('0x22')][_0x18b4('0x26')]?_[_0x18b4('0x27')](_0x446096[_0x18b4('0x22')][_0x18b4('0x26')],function(_0x5cb2f){return{'model':db[_0x5cb2f[_0x18b4('0x28')]],'as':_0x5cb2f['as'],'attributes':_0x5cb2f[_0x18b4('0x29')],'include':_0x5cb2f[_0x18b4('0x26')]?_[_0x18b4('0x27')](_0x5cb2f['include'],function(_0xae6acd){return{'model':db[_0xae6acd[_0x18b4('0x28')]],'as':_0xae6acd['as'],'attributes':_0xae6acd[_0x18b4('0x29')],'include':_0xae6acd['include']?_[_0x18b4('0x27')](_0xae6acd[_0x18b4('0x26')],function(_0x25526c){return{'model':db[_0x25526c[_0x18b4('0x28')]],'as':_0x25526c['as'],'attributes':_0x25526c[_0x18b4('0x29')]};}):[]};}):[]};}):[]:[]})[_0x18b4('0x14')](function(_0x29b9c7){logger['info'](_0x18b4('0x2a'),_0x446096);logger['debug'](_0x18b4('0x2a'),_0x446096,JSON['stringify'](_0x29b9c7));_0x38a99c(_0x29b9c7);})[_0x18b4('0x1f')](function(_0x22b644){logger[_0x18b4('0x1b')](_0x18b4('0x2a'),_0x22b644['message'],_0x446096);_0x5e69b3(_0x28fb7d['error'](0x1f4,_0x22b644['message']));});});}; \ No newline at end of file +var _0xf1c3=['message','WhatsappQueue','findAll','options','where','attributes','limit','map','include','model','then','GetWhatsappQueue','catch','ShowWhatsappQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis','defaults','socket.io-emitter','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x563436,_0xd66092){var _0x5b4315=function(_0x5cede3){while(--_0x5cede3){_0x563436['push'](_0x563436['shift']());}};_0x5b4315(++_0xd66092);}(_0xf1c3,0x190));var _0x3f1c=function(_0x52ea08,_0x15d935){_0x52ea08=_0x52ea08-0x0;var _0x28d546=_0xf1c3[_0x52ea08];return _0x28d546;};'use strict';var _=require(_0x3f1c('0x0'));var util=require(_0x3f1c('0x1'));var moment=require(_0x3f1c('0x2'));var BPromise=require(_0x3f1c('0x3'));var rs=require(_0x3f1c('0x4'));var fs=require('fs');var Redis=require(_0x3f1c('0x5'));var db=require(_0x3f1c('0x6'))['db'];var utils=require(_0x3f1c('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x3f1c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3f1c('0x9')][_0x3f1c('0xa')]({'port':0x232a});config[_0x3f1c('0xb')]=_[_0x3f1c('0xc')](config[_0x3f1c('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x3f1c('0xd'))(new Redis(config[_0x3f1c('0xb')]));require('./whatsappQueue.socket')['register'](socket);function respondWithRpcPromise(_0x458337,_0x4a6d91,_0x555e9f){return new BPromise(function(_0x4ca4b3,_0x4f3eaa){return client['request'](_0x458337,_0x555e9f)['then'](function(_0x3f62cf){logger[_0x3f1c('0xe')](_0x3f1c('0xf'),_0x4a6d91,_0x3f1c('0x10'));logger['debug']('WhatsappQueue,\x20%s,\x20%s,\x20%s',_0x4a6d91,'request\x20sent',JSON[_0x3f1c('0x11')](_0x3f62cf));if(_0x3f62cf[_0x3f1c('0x12')]){if(_0x3f62cf[_0x3f1c('0x12')][_0x3f1c('0x13')]===0x1f4){logger[_0x3f1c('0x12')](_0x3f1c('0xf'),_0x4a6d91,_0x3f62cf['error']['message']);return _0x4f3eaa(_0x3f62cf['error']['message']);}logger[_0x3f1c('0x12')](_0x3f1c('0xf'),_0x4a6d91,_0x3f62cf[_0x3f1c('0x12')]['message']);return _0x4ca4b3(_0x3f62cf[_0x3f1c('0x12')][_0x3f1c('0x14')]);}else{logger['info'](_0x3f1c('0xf'),_0x4a6d91,_0x3f1c('0x10'));_0x4ca4b3(_0x3f62cf['result'][_0x3f1c('0x14')]);}})['catch'](function(_0xb74277){logger['error'](_0x3f1c('0xf'),_0x4a6d91,_0xb74277);_0x4f3eaa(_0xb74277);});});}exports['GetWhatsappQueue']=function(_0x31ceb1){var _0x3bbad0=this;return new Promise(function(_0x4d273f,_0x41e47d){return db[_0x3f1c('0x15')][_0x3f1c('0x16')]({'raw':_0x31ceb1[_0x3f1c('0x17')]?_0x31ceb1[_0x3f1c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x31ceb1['options']?_0x31ceb1['options'][_0x3f1c('0x18')]||null:null,'attributes':_0x31ceb1['options']?_0x31ceb1[_0x3f1c('0x17')][_0x3f1c('0x19')]||null:null,'limit':_0x31ceb1[_0x3f1c('0x17')]?_0x31ceb1[_0x3f1c('0x17')][_0x3f1c('0x1a')]||null:null,'include':_0x31ceb1['options']?_0x31ceb1['options']['include']?_[_0x3f1c('0x1b')](_0x31ceb1['options'][_0x3f1c('0x1c')],function(_0x89dcb4){return{'model':db[_0x89dcb4[_0x3f1c('0x1d')]],'as':_0x89dcb4['as'],'attributes':_0x89dcb4[_0x3f1c('0x19')],'include':_0x89dcb4['include']?_['map'](_0x89dcb4['include'],function(_0x4eba6c){return{'model':db[_0x4eba6c[_0x3f1c('0x1d')]],'as':_0x4eba6c['as'],'attributes':_0x4eba6c[_0x3f1c('0x19')],'include':_0x4eba6c['include']?_[_0x3f1c('0x1b')](_0x4eba6c[_0x3f1c('0x1c')],function(_0xfd295a){return{'model':db[_0xfd295a[_0x3f1c('0x1d')]],'as':_0xfd295a['as'],'attributes':_0xfd295a[_0x3f1c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3f1c('0x1e')](function(_0x4d7cdb){logger[_0x3f1c('0xe')](_0x3f1c('0x1f'),_0x31ceb1);logger['debug'](_0x3f1c('0x1f'),_0x31ceb1,JSON[_0x3f1c('0x11')](_0x4d7cdb));_0x4d273f(_0x4d7cdb);})[_0x3f1c('0x20')](function(_0x59305b){logger[_0x3f1c('0x12')](_0x3f1c('0x1f'),_0x59305b[_0x3f1c('0x14')],_0x31ceb1);_0x41e47d(_0x3bbad0[_0x3f1c('0x12')](0x1f4,_0x59305b['message']));});});};exports[_0x3f1c('0x21')]=function(_0x30ba69){var _0x12f43c=this;return new Promise(function(_0x37a00c,_0xd7e38d){return db[_0x3f1c('0x15')][_0x3f1c('0x22')]({'raw':_0x30ba69[_0x3f1c('0x17')]?_0x30ba69[_0x3f1c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x30ba69[_0x3f1c('0x17')]?_0x30ba69['options']['where']||null:null,'attributes':_0x30ba69['options']?_0x30ba69['options'][_0x3f1c('0x19')]||null:null,'include':_0x30ba69[_0x3f1c('0x17')]?_0x30ba69[_0x3f1c('0x17')][_0x3f1c('0x1c')]?_[_0x3f1c('0x1b')](_0x30ba69['options'][_0x3f1c('0x1c')],function(_0x53e642){return{'model':db[_0x53e642[_0x3f1c('0x1d')]],'as':_0x53e642['as'],'attributes':_0x53e642[_0x3f1c('0x19')],'include':_0x53e642[_0x3f1c('0x1c')]?_['map'](_0x53e642[_0x3f1c('0x1c')],function(_0x27eb66){return{'model':db[_0x27eb66['model']],'as':_0x27eb66['as'],'attributes':_0x27eb66['attributes'],'include':_0x27eb66['include']?_[_0x3f1c('0x1b')](_0x27eb66[_0x3f1c('0x1c')],function(_0x429efa){return{'model':db[_0x429efa[_0x3f1c('0x1d')]],'as':_0x429efa['as'],'attributes':_0x429efa[_0x3f1c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x197235){logger[_0x3f1c('0xe')](_0x3f1c('0x21'),_0x30ba69);logger['debug'](_0x3f1c('0x21'),_0x30ba69,JSON['stringify'](_0x197235));_0x37a00c(_0x197235);})['catch'](function(_0x42a0fb){logger[_0x3f1c('0x12')](_0x3f1c('0x21'),_0x42a0fb[_0x3f1c('0x14')],_0x30ba69);_0xd7e38d(_0x12f43c[_0x3f1c('0x12')](0x1f4,_0x42a0fb[_0x3f1c('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index d9a739a..46e2663 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 _0x5dbd=['save','update','emit','removeListener','length','whatsappQueue:'];(function(_0x1320e5,_0x24040a){var _0x48c1c1=function(_0x23b201){while(--_0x23b201){_0x1320e5['push'](_0x1320e5['shift']());}};_0x48c1c1(++_0x24040a);}(_0x5dbd,0x8a));var _0xd5db=function(_0x4039ed,_0x2ea228){_0x4039ed=_0x4039ed-0x0;var _0x1c967f=_0x5dbd[_0x4039ed];return _0x1c967f;};'use strict';var WhatsappQueueEvents=require('./whatsappQueue.events');var events=[_0xd5db('0x0'),'remove',_0xd5db('0x1')];function createListener(_0x35a779,_0x4a3b8a){return function(_0xfed7dc){_0x4a3b8a[_0xd5db('0x2')](_0x35a779,_0xfed7dc);};}function removeListener(_0x230c69,_0x13028b){return function(){WhatsappQueueEvents[_0xd5db('0x3')](_0x230c69,_0x13028b);};}exports['register']=function(_0x347496){for(var _0x4ab7ec=0x0,_0x2283be=events[_0xd5db('0x4')];_0x4ab7ec<_0x2283be;_0x4ab7ec++){var _0x22bbaa=events[_0x4ab7ec];var _0x222007=createListener(_0xd5db('0x5')+_0x22bbaa,_0x347496);WhatsappQueueEvents['on'](_0x22bbaa,_0x222007);}}; \ No newline at end of file +var _0xaeb2=['length','whatsappQueue:','./whatsappQueue.events','save','remove','update','removeListener'];(function(_0x31b95d,_0x4a1602){var _0x114ab0=function(_0x577afb){while(--_0x577afb){_0x31b95d['push'](_0x31b95d['shift']());}};_0x114ab0(++_0x4a1602);}(_0xaeb2,0xf7));var _0x2aeb=function(_0x29b07b,_0x3aefa0){_0x29b07b=_0x29b07b-0x0;var _0x584869=_0xaeb2[_0x29b07b];return _0x584869;};'use strict';var WhatsappQueueEvents=require(_0x2aeb('0x0'));var events=[_0x2aeb('0x1'),_0x2aeb('0x2'),_0x2aeb('0x3')];function createListener(_0x469b6d,_0x432fa6){return function(_0x124f8d){_0x432fa6['emit'](_0x469b6d,_0x124f8d);};}function removeListener(_0x176cd9,_0x1d8ce5){return function(){WhatsappQueueEvents[_0x2aeb('0x4')](_0x176cd9,_0x1d8ce5);};}exports['register']=function(_0x4a1a67){for(var _0x18384d=0x0,_0x27764b=events[_0x2aeb('0x5')];_0x18384d<_0x27764b;_0x18384d++){var _0x3938f1=events[_0x18384d];var _0x5c919f=createListener(_0x2aeb('0x6')+_0x3938f1,_0x4a1a67);WhatsappQueueEvents['on'](_0x3938f1,_0x5c919f);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index b186f7a..d8870f6 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 _0x7b82=['./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0xb02eed,_0x13d074){var _0x43455b=function(_0x2cdd32){while(--_0x2cdd32){_0xb02eed['push'](_0xb02eed['shift']());}};_0x43455b(++_0x13d074);}(_0x7b82,0x100));var _0x27b8=function(_0x2aa0e7,_0x4e5145){_0x2aa0e7=_0x2aa0e7-0x0;var _0x1472c0=_0x7b82[_0x2aa0e7];return _0x1472c0;};'use strict';var multer=require(_0x27b8('0x0'));var util=require(_0x27b8('0x1'));var path=require(_0x27b8('0x2'));var timeout=require('connect-timeout');var express=require(_0x27b8('0x3'));var router=express[_0x27b8('0x4')]();var fs_extra=require(_0x27b8('0x5'));var auth=require(_0x27b8('0x6'));var interaction=require(_0x27b8('0x7'));var config=require('../../config/environment');var controller=require(_0x27b8('0x8'));router[_0x27b8('0x9')]('/',auth[_0x27b8('0xa')](),controller[_0x27b8('0xb')]);router[_0x27b8('0x9')](_0x27b8('0xc'),auth['isAuthenticated'](),controller[_0x27b8('0xd')]);router[_0x27b8('0x9')](_0x27b8('0xe'),auth['isAuthenticated'](),controller[_0x27b8('0xf')]);router[_0x27b8('0x10')]('/',auth['isAuthenticated'](),controller[_0x27b8('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x27b8('0x12')]);router[_0x27b8('0x13')]('/:id',auth[_0x27b8('0xa')](),controller[_0x27b8('0x14')]);module[_0x27b8('0x15')]=router; \ No newline at end of file +var _0x7191=['create','put','update','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post'];(function(_0x106214,_0x454b8d){var _0x5f5cea=function(_0x247841){while(--_0x247841){_0x106214['push'](_0x106214['shift']());}};_0x5f5cea(++_0x454b8d);}(_0x7191,0x1e9));var _0x1719=function(_0x32c5ec,_0x413832){_0x32c5ec=_0x32c5ec-0x0;var _0x3a16bf=_0x7191[_0x32c5ec];return _0x3a16bf;};'use strict';var multer=require(_0x1719('0x0'));var util=require('util');var path=require(_0x1719('0x1'));var timeout=require('connect-timeout');var express=require(_0x1719('0x2'));var router=express[_0x1719('0x3')]();var fs_extra=require(_0x1719('0x4'));var auth=require(_0x1719('0x5'));var interaction=require(_0x1719('0x6'));var config=require(_0x1719('0x7'));var controller=require('./whatsappQueueReport.controller');router[_0x1719('0x8')]('/',auth[_0x1719('0x9')](),controller['index']);router[_0x1719('0x8')](_0x1719('0xa'),auth['isAuthenticated'](),controller[_0x1719('0xb')]);router[_0x1719('0x8')](_0x1719('0xc'),auth[_0x1719('0x9')](),controller[_0x1719('0xd')]);router[_0x1719('0xe')]('/',auth['isAuthenticated'](),controller[_0x1719('0xf')]);router[_0x1719('0x10')]('/:id',auth[_0x1719('0x9')](),controller[_0x1719('0x11')]);router[_0x1719('0x12')](_0x1719('0xc'),auth[_0x1719('0x9')](),controller[_0x1719('0x13')]);module[_0x1719('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 0c41315..793ffda 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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x2e46f4,_0x511f32){var _0x48fd76=function(_0x1abaf9){while(--_0x1abaf9){_0x2e46f4['push'](_0x2e46f4['shift']());}};_0x48fd76(++_0x511f32);}(_0x7a54,0x106));var _0x47a5=function(_0x451bef,_0x14b042){_0x451bef=_0x451bef-0x0;var _0x5b4ab5=_0x7a54[_0x451bef];return _0x5b4ab5;};'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 +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x3e5535,_0x1e7c13){var _0x191d41=function(_0x4b015d){while(--_0x4b015d){_0x3e5535['push'](_0x3e5535['shift']());}};_0x191d41(++_0x1e7c13);}(_0x7a54,0x106));var _0x47a5=function(_0x54a066,_0x2ed1d7){_0x54a066=_0x54a066-0x0;var _0x565398=_0x7a54[_0x54a066];return _0x565398;};'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 bf2c785..08975f1 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 _0x087b=['name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','merge','find','create','body','update','params','describe','eml-format','rimraf','request-promise','bluebird','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/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','error','stack'];(function(_0x2c9bd0,_0x230d57){var _0x1e0b7c=function(_0x592a21){while(--_0x592a21){_0x2c9bd0['push'](_0x2c9bd0['shift']());}};_0x1e0b7c(++_0x230d57);}(_0x087b,0x11a));var _0xb087=function(_0x4e9d3c,_0x1f4b98){_0x4e9d3c=_0x4e9d3c-0x0;var _0x2d0825=_0x087b[_0x4e9d3c];return _0x2d0825;};'use strict';var emlformat=require(_0xb087('0x0'));var rimraf=require(_0xb087('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb087('0x2'));var moment=require('moment');var BPromise=require(_0xb087('0x3'));var Mustache=require(_0xb087('0x4'));var util=require(_0xb087('0x5'));var path=require(_0xb087('0x6'));var sox=require(_0xb087('0x7'));var csv=require(_0xb087('0x8'));var ejs=require(_0xb087('0x9'));var fs=require('fs');var fs_extra=require(_0xb087('0xa'));var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x8'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xb087('0x1a'))['db'];function respondWithStatusCode(_0x31f977,_0x323656){_0x323656=_0x323656||0xcc;return function(_0x51ceaa){if(_0x51ceaa){return _0x31f977[_0xb087('0x1b')](_0x323656);}return _0x31f977[_0xb087('0x1c')](_0x323656)[_0xb087('0x1d')]();};}function respondWithResult(_0x46410b,_0x11784c){_0x11784c=_0x11784c||0xc8;return function(_0x12d0db){if(_0x12d0db){return _0x46410b[_0xb087('0x1c')](_0x11784c)[_0xb087('0x1e')](_0x12d0db);}};}function respondWithFilteredResult(_0x24e1a3,_0x16d0b7){return function(_0x5193a4){if(_0x5193a4){var _0x43e576=typeof _0x16d0b7[_0xb087('0x1f')]==='undefined'&&typeof _0x16d0b7[_0xb087('0x20')]===_0xb087('0x21');var _0x2e9e74=_0x5193a4['count'];var _0x330005=_0x43e576?0x0:_0x16d0b7[_0xb087('0x1f')];var _0x17200d=_0x43e576?_0x5193a4[_0xb087('0x22')]:_0x16d0b7['offset']+_0x16d0b7[_0xb087('0x20')];var _0x28428e;if(_0x17200d>=_0x2e9e74){_0x17200d=_0x2e9e74;_0x28428e=0xc8;}else{_0x28428e=0xce;}_0x24e1a3[_0xb087('0x1c')](_0x28428e);return _0x24e1a3[_0xb087('0x23')]('Content-Range',_0x330005+'-'+_0x17200d+'/'+_0x2e9e74)['json'](_0x5193a4);}return null;};}function patchUpdates(_0x5ea3dc){return function(_0x49450a){try{jsonpatch[_0xb087('0x24')](_0x49450a,_0x5ea3dc,!![]);}catch(_0x17be8e){return BPromise[_0xb087('0x25')](_0x17be8e);}return _0x49450a[_0xb087('0x26')]();};}function saveUpdates(_0x1fb765,_0x258b4c){return function(_0x31ae01){if(_0x31ae01){return _0x31ae01['update'](_0x1fb765)[_0xb087('0x27')](function(_0x466397){return _0x466397;});}return null;};}function removeEntity(_0x1de654,_0x1cfb3e){return function(_0x3ad74e){if(_0x3ad74e){return _0x3ad74e['destroy']()[_0xb087('0x27')](function(){_0x1de654[_0xb087('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a2dc6,_0x50745a){return function(_0x598b99){if(!_0x598b99){_0x5a2dc6['sendStatus'](0x194);}return _0x598b99;};}function handleError(_0x304840,_0x45685d){_0x45685d=_0x45685d||0x1f4;return function(_0x1d124f){logger[_0xb087('0x28')](_0x1d124f[_0xb087('0x29')]);if(_0x1d124f[_0xb087('0x2a')]){delete _0x1d124f[_0xb087('0x2a')];}_0x304840[_0xb087('0x1c')](_0x45685d)[_0xb087('0x2b')](_0x1d124f);};}exports[_0xb087('0x2c')]=function(_0x18058c,_0x31e3e6){var _0xb0baf6={},_0x263259={},_0x593b78={'count':0x0,'rows':[]};var _0x37393a=_[_0xb087('0x2d')](db[_0xb087('0x2e')][_0xb087('0x2f')],function(_0x22d441){return{'name':_0x22d441[_0xb087('0x30')],'type':_0x22d441[_0xb087('0x31')][_0xb087('0x32')]};});_0x263259['model']=_['map'](_0x37393a,_0xb087('0x2a'));_0x263259[_0xb087('0x33')]=_['keys'](_0x18058c[_0xb087('0x33')]);_0x263259[_0xb087('0x34')]=_[_0xb087('0x35')](_0x263259[_0xb087('0x36')],_0x263259[_0xb087('0x33')]);_0xb0baf6[_0xb087('0x37')]=_[_0xb087('0x35')](_0x263259[_0xb087('0x36')],qs[_0xb087('0x38')](_0x18058c[_0xb087('0x33')][_0xb087('0x38')]));_0xb0baf6[_0xb087('0x37')]=_0xb0baf6['attributes'][_0xb087('0x39')]?_0xb0baf6['attributes']:_0x263259[_0xb087('0x36')];if(!_0x18058c[_0xb087('0x33')][_0xb087('0x3a')](_0xb087('0x3b'))){_0xb0baf6[_0xb087('0x20')]=qs[_0xb087('0x20')](_0x18058c[_0xb087('0x33')][_0xb087('0x20')]);_0xb0baf6[_0xb087('0x1f')]=qs['offset'](_0x18058c['query'][_0xb087('0x1f')]);}_0xb0baf6[_0xb087('0x3c')]=qs[_0xb087('0x3d')](_0x18058c[_0xb087('0x33')][_0xb087('0x3d')]);_0xb0baf6['where']=qs[_0xb087('0x34')](_[_0xb087('0x3e')](_0x18058c['query'],_0x263259['filters']),_0x37393a);if(_0x18058c[_0xb087('0x33')][_0xb087('0x3f')]){_0xb0baf6[_0xb087('0x40')]=_['merge'](_0xb0baf6[_0xb087('0x40')],{'$or':_[_0xb087('0x2d')](_0x37393a,function(_0x1caa6e){if(_0x1caa6e[_0xb087('0x31')]!==_0xb087('0x41')){var _0x5db6b9={};_0x5db6b9[_0x1caa6e[_0xb087('0x2a')]]={'$like':'%'+_0x18058c['query'][_0xb087('0x3f')]+'%'};return _0x5db6b9;}})});}_0xb0baf6=_['merge']({},_0xb0baf6,_0x18058c[_0xb087('0x42')]);var _0xc9f9e9={'where':_0xb0baf6['where']};return db[_0xb087('0x2e')]['count'](_0xc9f9e9)[_0xb087('0x27')](function(_0x4a360c){_0x593b78[_0xb087('0x22')]=_0x4a360c;if(_0x18058c[_0xb087('0x33')][_0xb087('0x43')]){_0xb0baf6[_0xb087('0x44')]=[{'all':!![]}];}return db[_0xb087('0x2e')][_0xb087('0x45')](_0xb0baf6);})[_0xb087('0x27')](function(_0x5e7690){_0x593b78[_0xb087('0x46')]=_0x5e7690;return _0x593b78;})['then'](respondWithFilteredResult(_0x31e3e6,_0xb0baf6))[_0xb087('0x47')](handleError(_0x31e3e6,null));};exports[_0xb087('0x48')]=function(_0x5b6924,_0xb662bf){var _0x45dc6f={'raw':!![],'where':{'id':_0x5b6924['params']['id']}},_0x7650c5={};_0x7650c5[_0xb087('0x36')]=_['keys'](db[_0xb087('0x2e')][_0xb087('0x2f')]);_0x7650c5['query']=_[_0xb087('0x49')](_0x5b6924[_0xb087('0x33')]);_0x7650c5['filters']=_[_0xb087('0x35')](_0x7650c5[_0xb087('0x36')],_0x7650c5['query']);_0x45dc6f[_0xb087('0x37')]=_[_0xb087('0x35')](_0x7650c5[_0xb087('0x36')],qs[_0xb087('0x38')](_0x5b6924['query']['fields']));_0x45dc6f[_0xb087('0x37')]=_0x45dc6f[_0xb087('0x37')][_0xb087('0x39')]?_0x45dc6f[_0xb087('0x37')]:_0x7650c5[_0xb087('0x36')];if(_0x5b6924[_0xb087('0x33')]['includeAll']){_0x45dc6f['include']=[{'all':!![]}];}_0x45dc6f=_[_0xb087('0x4a')]({},_0x45dc6f,_0x5b6924['options']);return db[_0xb087('0x2e')][_0xb087('0x4b')](_0x45dc6f)[_0xb087('0x27')](handleEntityNotFound(_0xb662bf,null))[_0xb087('0x27')](respondWithResult(_0xb662bf,null))['catch'](handleError(_0xb662bf,null));};exports[_0xb087('0x4c')]=function(_0x562751,_0x2fe8a0){return db[_0xb087('0x2e')][_0xb087('0x4c')](_0x562751[_0xb087('0x4d')],{})[_0xb087('0x27')](respondWithResult(_0x2fe8a0,0xc9))['catch'](handleError(_0x2fe8a0,null));};exports[_0xb087('0x4e')]=function(_0xb15e28,_0x588d96){if(_0xb15e28['body']['id']){delete _0xb15e28[_0xb087('0x4d')]['id'];}return db['WhatsappQueueReport']['find']({'where':{'id':_0xb15e28[_0xb087('0x4f')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x588d96,null))['then'](saveUpdates(_0xb15e28[_0xb087('0x4d')],null))[_0xb087('0x27')](respondWithResult(_0x588d96,null))[_0xb087('0x47')](handleError(_0x588d96,null));};exports['destroy']=function(_0x5ba160,_0x30cc83){return db['WhatsappQueueReport']['find']({'where':{'id':_0x5ba160[_0xb087('0x4f')]['id']}})[_0xb087('0x27')](handleEntityNotFound(_0x30cc83,null))[_0xb087('0x27')](removeEntity(_0x30cc83,null))[_0xb087('0x47')](handleError(_0x30cc83,null));};exports[_0xb087('0x50')]=function(_0x148642,_0xbd849d){return db[_0xb087('0x2e')][_0xb087('0x50')]()[_0xb087('0x27')](respondWithResult(_0xbd849d,null))[_0xb087('0x47')](handleError(_0xbd849d,null));}; \ No newline at end of file +var _0xfff0=['length','include','body','find','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','crypto','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','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','filter','options','WhatsappQueueReport','includeAll','findAll','catch','params'];(function(_0x24304c,_0x5c5332){var _0x457533=function(_0x340cdf){while(--_0x340cdf){_0x24304c['push'](_0x24304c['shift']());}};_0x457533(++_0x5c5332);}(_0xfff0,0x139));var _0x0fff=function(_0x3f82ec,_0x295746){_0x3f82ec=_0x3f82ec-0x0;var _0x5be8c2=_0xfff0[_0x3f82ec];return _0x5be8c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0fff('0x0'));var zipdir=require(_0x0fff('0x1'));var jsonpatch=require(_0x0fff('0x2'));var rp=require('request-promise');var moment=require(_0x0fff('0x3'));var BPromise=require(_0x0fff('0x4'));var Mustache=require(_0x0fff('0x5'));var util=require('util');var path=require(_0x0fff('0x6'));var sox=require(_0x0fff('0x7'));var csv=require('to-csv');var ejs=require(_0x0fff('0x8'));var fs=require('fs');var fs_extra=require(_0x0fff('0x9'));var _=require(_0x0fff('0xa'));var squel=require('squel');var crypto=require(_0x0fff('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0fff('0xc'));var toCsv=require('to-csv');var querystring=require(_0x0fff('0xd'));var Papa=require(_0x0fff('0xe'));var Redis=require('ioredis');var authService=require(_0x0fff('0xf'));var qs=require(_0x0fff('0x10'));var as=require(_0x0fff('0x11'));var hardwareService=require(_0x0fff('0x12'));var logger=require(_0x0fff('0x13'))(_0x0fff('0x14'));var utils=require(_0x0fff('0x15'));var config=require(_0x0fff('0x16'));var licenseUtil=require(_0x0fff('0x17'));var db=require(_0x0fff('0x18'))['db'];function respondWithStatusCode(_0x13f768,_0x5abecd){_0x5abecd=_0x5abecd||0xcc;return function(_0x1fb243){if(_0x1fb243){return _0x13f768['sendStatus'](_0x5abecd);}return _0x13f768[_0x0fff('0x19')](_0x5abecd)[_0x0fff('0x1a')]();};}function respondWithResult(_0x38fc82,_0x2c0322){_0x2c0322=_0x2c0322||0xc8;return function(_0x55e5fa){if(_0x55e5fa){return _0x38fc82['status'](_0x2c0322)[_0x0fff('0x1b')](_0x55e5fa);}};}function respondWithFilteredResult(_0x50a9e4,_0x5636fd){return function(_0x51ceea){if(_0x51ceea){var _0x1fb430=typeof _0x5636fd[_0x0fff('0x1c')]==='undefined'&&typeof _0x5636fd[_0x0fff('0x1d')]===_0x0fff('0x1e');var _0x540a67=_0x51ceea['count'];var _0x48f36d=_0x1fb430?0x0:_0x5636fd[_0x0fff('0x1c')];var _0x606792=_0x1fb430?_0x51ceea[_0x0fff('0x1f')]:_0x5636fd[_0x0fff('0x1c')]+_0x5636fd[_0x0fff('0x1d')];var _0xe89b4a;if(_0x606792>=_0x540a67){_0x606792=_0x540a67;_0xe89b4a=0xc8;}else{_0xe89b4a=0xce;}_0x50a9e4['status'](_0xe89b4a);return _0x50a9e4[_0x0fff('0x20')](_0x0fff('0x21'),_0x48f36d+'-'+_0x606792+'/'+_0x540a67)[_0x0fff('0x1b')](_0x51ceea);}return null;};}function patchUpdates(_0x49d211){return function(_0x5e27df){try{jsonpatch[_0x0fff('0x22')](_0x5e27df,_0x49d211,!![]);}catch(_0x330e29){return BPromise[_0x0fff('0x23')](_0x330e29);}return _0x5e27df[_0x0fff('0x24')]();};}function saveUpdates(_0x502393,_0x155132){return function(_0x2f8665){if(_0x2f8665){return _0x2f8665[_0x0fff('0x25')](_0x502393)[_0x0fff('0x26')](function(_0x16e7f4){return _0x16e7f4;});}return null;};}function removeEntity(_0x17fba6,_0x580b8e){return function(_0x6a116c){if(_0x6a116c){return _0x6a116c[_0x0fff('0x27')]()[_0x0fff('0x26')](function(){_0x17fba6[_0x0fff('0x19')](0xcc)[_0x0fff('0x1a')]();});}};}function handleEntityNotFound(_0x23d9f8,_0x482e1e){return function(_0x2c9725){if(!_0x2c9725){_0x23d9f8[_0x0fff('0x28')](0x194);}return _0x2c9725;};}function handleError(_0x2d1610,_0x440f56){_0x440f56=_0x440f56||0x1f4;return function(_0x36d268){logger[_0x0fff('0x29')](_0x36d268[_0x0fff('0x2a')]);if(_0x36d268[_0x0fff('0x2b')]){delete _0x36d268[_0x0fff('0x2b')];}_0x2d1610[_0x0fff('0x19')](_0x440f56)[_0x0fff('0x2c')](_0x36d268);};}exports[_0x0fff('0x2d')]=function(_0x495734,_0x7046a3){var _0x2d1800={},_0x17ab6f={},_0x42441e={'count':0x0,'rows':[]};var _0x1f643d=_[_0x0fff('0x2e')](db['WhatsappQueueReport'][_0x0fff('0x2f')],function(_0xa16c29){return{'name':_0xa16c29[_0x0fff('0x30')],'type':_0xa16c29['type'][_0x0fff('0x31')]};});_0x17ab6f[_0x0fff('0x32')]=_['map'](_0x1f643d,_0x0fff('0x2b'));_0x17ab6f[_0x0fff('0x33')]=_[_0x0fff('0x34')](_0x495734[_0x0fff('0x33')]);_0x17ab6f[_0x0fff('0x35')]=_[_0x0fff('0x36')](_0x17ab6f[_0x0fff('0x32')],_0x17ab6f[_0x0fff('0x33')]);_0x2d1800[_0x0fff('0x37')]=_[_0x0fff('0x36')](_0x17ab6f['model'],qs[_0x0fff('0x38')](_0x495734[_0x0fff('0x33')][_0x0fff('0x38')]));_0x2d1800[_0x0fff('0x37')]=_0x2d1800[_0x0fff('0x37')]['length']?_0x2d1800['attributes']:_0x17ab6f[_0x0fff('0x32')];if(!_0x495734[_0x0fff('0x33')][_0x0fff('0x39')](_0x0fff('0x3a'))){_0x2d1800['limit']=qs[_0x0fff('0x1d')](_0x495734[_0x0fff('0x33')][_0x0fff('0x1d')]);_0x2d1800[_0x0fff('0x1c')]=qs['offset'](_0x495734[_0x0fff('0x33')][_0x0fff('0x1c')]);}_0x2d1800[_0x0fff('0x3b')]=qs[_0x0fff('0x3c')](_0x495734[_0x0fff('0x33')][_0x0fff('0x3c')]);_0x2d1800[_0x0fff('0x3d')]=qs[_0x0fff('0x35')](_[_0x0fff('0x3e')](_0x495734[_0x0fff('0x33')],_0x17ab6f[_0x0fff('0x35')]),_0x1f643d);if(_0x495734[_0x0fff('0x33')]['filter']){_0x2d1800[_0x0fff('0x3d')]=_[_0x0fff('0x3f')](_0x2d1800[_0x0fff('0x3d')],{'$or':_[_0x0fff('0x2e')](_0x1f643d,function(_0xd65638){if(_0xd65638[_0x0fff('0x40')]!=='VIRTUAL'){var _0x10ff9d={};_0x10ff9d[_0xd65638[_0x0fff('0x2b')]]={'$like':'%'+_0x495734[_0x0fff('0x33')][_0x0fff('0x41')]+'%'};return _0x10ff9d;}})});}_0x2d1800=_[_0x0fff('0x3f')]({},_0x2d1800,_0x495734[_0x0fff('0x42')]);var _0x3dc0b8={'where':_0x2d1800[_0x0fff('0x3d')]};return db[_0x0fff('0x43')]['count'](_0x3dc0b8)[_0x0fff('0x26')](function(_0x4d89c0){_0x42441e[_0x0fff('0x1f')]=_0x4d89c0;if(_0x495734[_0x0fff('0x33')][_0x0fff('0x44')]){_0x2d1800['include']=[{'all':!![]}];}return db['WhatsappQueueReport'][_0x0fff('0x45')](_0x2d1800);})[_0x0fff('0x26')](function(_0x311348){_0x42441e['rows']=_0x311348;return _0x42441e;})['then'](respondWithFilteredResult(_0x7046a3,_0x2d1800))[_0x0fff('0x46')](handleError(_0x7046a3,null));};exports['show']=function(_0xd6ebeb,_0x957265){var _0x8352c1={'raw':!![],'where':{'id':_0xd6ebeb[_0x0fff('0x47')]['id']}},_0x309d75={};_0x309d75[_0x0fff('0x32')]=_['keys'](db[_0x0fff('0x43')][_0x0fff('0x2f')]);_0x309d75[_0x0fff('0x33')]=_[_0x0fff('0x34')](_0xd6ebeb[_0x0fff('0x33')]);_0x309d75[_0x0fff('0x35')]=_[_0x0fff('0x36')](_0x309d75['model'],_0x309d75[_0x0fff('0x33')]);_0x8352c1[_0x0fff('0x37')]=_[_0x0fff('0x36')](_0x309d75['model'],qs[_0x0fff('0x38')](_0xd6ebeb[_0x0fff('0x33')][_0x0fff('0x38')]));_0x8352c1[_0x0fff('0x37')]=_0x8352c1[_0x0fff('0x37')][_0x0fff('0x48')]?_0x8352c1[_0x0fff('0x37')]:_0x309d75[_0x0fff('0x32')];if(_0xd6ebeb[_0x0fff('0x33')][_0x0fff('0x44')]){_0x8352c1[_0x0fff('0x49')]=[{'all':!![]}];}_0x8352c1=_['merge']({},_0x8352c1,_0xd6ebeb[_0x0fff('0x42')]);return db[_0x0fff('0x43')]['find'](_0x8352c1)[_0x0fff('0x26')](handleEntityNotFound(_0x957265,null))[_0x0fff('0x26')](respondWithResult(_0x957265,null))[_0x0fff('0x46')](handleError(_0x957265,null));};exports['create']=function(_0x502037,_0x2a0b10){return db['WhatsappQueueReport']['create'](_0x502037[_0x0fff('0x4a')],{})[_0x0fff('0x26')](respondWithResult(_0x2a0b10,0xc9))[_0x0fff('0x46')](handleError(_0x2a0b10,null));};exports[_0x0fff('0x25')]=function(_0x3b4b8e,_0x1a7677){if(_0x3b4b8e['body']['id']){delete _0x3b4b8e[_0x0fff('0x4a')]['id'];}return db[_0x0fff('0x43')][_0x0fff('0x4b')]({'where':{'id':_0x3b4b8e[_0x0fff('0x47')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x1a7677,null))[_0x0fff('0x26')](saveUpdates(_0x3b4b8e['body'],null))[_0x0fff('0x26')](respondWithResult(_0x1a7677,null))[_0x0fff('0x46')](handleError(_0x1a7677,null));};exports['destroy']=function(_0x1fc872,_0x4bae35){return db['WhatsappQueueReport']['find']({'where':{'id':_0x1fc872[_0x0fff('0x47')]['id']}})[_0x0fff('0x26')](handleEntityNotFound(_0x4bae35,null))[_0x0fff('0x26')](removeEntity(_0x4bae35,null))[_0x0fff('0x46')](handleError(_0x4bae35,null));};exports[_0x0fff('0x4c')]=function(_0x4bf98d,_0x2524ad){return db[_0x0fff('0x43')][_0x0fff('0x4c')]()[_0x0fff('0x26')](respondWithResult(_0x2524ad,null))[_0x0fff('0x46')](handleError(_0x2524ad,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index e7d47c4..c43e0b0 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 _0xe49b=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./whatsappQueueReport.attributes','exports','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util'];(function(_0x1aca6d,_0x106fde){var _0x203edc=function(_0xcd6e4c){while(--_0xcd6e4c){_0x1aca6d['push'](_0x1aca6d['shift']());}};_0x203edc(++_0x106fde);}(_0xe49b,0x110));var _0xbe49=function(_0x47b79c,_0x3616d8){_0x47b79c=_0x47b79c-0x0;var _0xbf6629=_0xe49b[_0x47b79c];return _0xbf6629;};'use strict';var _=require('lodash');var util=require(_0xbe49('0x0'));var logger=require(_0xbe49('0x1'))(_0xbe49('0x2'));var moment=require(_0xbe49('0x3'));var BPromise=require(_0xbe49('0x4'));var rp=require(_0xbe49('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbe49('0x6'));var attributes=require(_0xbe49('0x7'));module[_0xbe49('0x8')]=function(_0x16282e,_0x322232){return _0x16282e[_0xbe49('0x9')](_0xbe49('0xa'),attributes,{'tableName':_0xbe49('0xb'),'paranoid':![],'indexes':[{'name':_0xbe49('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x2e68=['bluebird','../../config/environment','./whatsappQueueReport.attributes','exports','WhatsappQueueReport','report_whatsapp_queue','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x322179,_0x50440d){var _0x6e8514=function(_0x33c49d){while(--_0x33c49d){_0x322179['push'](_0x322179['shift']());}};_0x6e8514(++_0x50440d);}(_0x2e68,0x13f));var _0x82e6=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0x2e68[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x82e6('0x0'));var util=require(_0x82e6('0x1'));var logger=require(_0x82e6('0x2'))(_0x82e6('0x3'));var moment=require(_0x82e6('0x4'));var BPromise=require(_0x82e6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x82e6('0x6'));var attributes=require(_0x82e6('0x7'));module[_0x82e6('0x8')]=function(_0x375b63,_0x4f5f07){return _0x375b63['define'](_0x82e6('0x9'),attributes,{'tableName':_0x82e6('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x82e6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index 75c6cde..3e7c45d 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 _0x1dce=['update','where','attributes','limit','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateWhatsappQueueReport','body','options','raw','then','debug','stringify','UpdateWhatsappQueueReport'];(function(_0x2ddd77,_0x498d09){var _0x3ccc36=function(_0x30190e){while(--_0x30190e){_0x2ddd77['push'](_0x2ddd77['shift']());}};_0x3ccc36(++_0x498d09);}(_0x1dce,0x1a9));var _0xe1dc=function(_0x5f1c73,_0x4f9432){_0x5f1c73=_0x5f1c73-0x0;var _0x3c1fa4=_0x1dce[_0x5f1c73];return _0x3c1fa4;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xe1dc('0x0'));var BPromise=require(_0xe1dc('0x1'));var rs=require(_0xe1dc('0x2'));var fs=require('fs');var Redis=require(_0xe1dc('0x3'));var db=require(_0xe1dc('0x4'))['db'];var utils=require(_0xe1dc('0x5'));var logger=require('../../config/logger')(_0xe1dc('0x6'));var config=require(_0xe1dc('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe1dc('0x8')][_0xe1dc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x45058c,_0x83f751,_0x38ffb7){return new BPromise(function(_0xf01369,_0x553ff6){return client['request'](_0x45058c,_0x38ffb7)['then'](function(_0x420ffc){logger[_0xe1dc('0xa')](_0xe1dc('0xb'),_0x83f751,'request\x20sent');logger['debug']('WhatsappQueueReport,\x20%s,\x20%s,\x20%s',_0x83f751,_0xe1dc('0xc'),JSON['stringify'](_0x420ffc));if(_0x420ffc['error']){if(_0x420ffc[_0xe1dc('0xd')][_0xe1dc('0xe')]===0x1f4){logger[_0xe1dc('0xd')](_0xe1dc('0xb'),_0x83f751,_0x420ffc[_0xe1dc('0xd')]['message']);return _0x553ff6(_0x420ffc['error'][_0xe1dc('0xf')]);}logger[_0xe1dc('0xd')](_0xe1dc('0xb'),_0x83f751,_0x420ffc[_0xe1dc('0xd')][_0xe1dc('0xf')]);return _0xf01369(_0x420ffc[_0xe1dc('0xd')]['message']);}else{logger[_0xe1dc('0xa')](_0xe1dc('0xb'),_0x83f751,_0xe1dc('0xc'));_0xf01369(_0x420ffc[_0xe1dc('0x10')][_0xe1dc('0xf')]);}})['catch'](function(_0x343f03){logger['error'](_0xe1dc('0xb'),_0x83f751,_0x343f03);_0x553ff6(_0x343f03);});});}exports[_0xe1dc('0x11')]=function(_0x457018){var _0x31ff2c=this;return new Promise(function(_0x2b278a,_0x5d6946){return db['WhatsappQueueReport']['create'](_0x457018[_0xe1dc('0x12')],{'raw':_0x457018[_0xe1dc('0x13')]?_0x457018[_0xe1dc('0x13')][_0xe1dc('0x14')]===undefined?!![]:![]:!![]})[_0xe1dc('0x15')](function(_0x55dc94){logger[_0xe1dc('0xa')](_0xe1dc('0x11'),_0x457018);logger[_0xe1dc('0x16')](_0xe1dc('0x11'),_0x457018,JSON[_0xe1dc('0x17')](_0x55dc94));_0x2b278a(_0x55dc94);})['catch'](function(_0x5bf4f0){logger[_0xe1dc('0xd')](_0xe1dc('0x11'),_0x5bf4f0[_0xe1dc('0xf')],_0x457018);_0x5d6946(_0x31ff2c[_0xe1dc('0xd')](0x1f4,_0x5bf4f0[_0xe1dc('0xf')]));});});};exports[_0xe1dc('0x18')]=function(_0x5a6cb0){var _0x1652ce=this;return new Promise(function(_0x2f795e,_0x5eab84){return db['WhatsappQueueReport'][_0xe1dc('0x19')](_0x5a6cb0['body'],{'raw':_0x5a6cb0[_0xe1dc('0x13')]?_0x5a6cb0[_0xe1dc('0x13')][_0xe1dc('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a6cb0[_0xe1dc('0x13')]?_0x5a6cb0[_0xe1dc('0x13')][_0xe1dc('0x1a')]||null:null,'attributes':_0x5a6cb0[_0xe1dc('0x13')]?_0x5a6cb0[_0xe1dc('0x13')][_0xe1dc('0x1b')]||null:null,'limit':_0x5a6cb0[_0xe1dc('0x13')]?_0x5a6cb0[_0xe1dc('0x13')][_0xe1dc('0x1c')]||null:null})[_0xe1dc('0x15')](function(_0x369159){logger['info'](_0xe1dc('0x18'),_0x5a6cb0);logger[_0xe1dc('0x16')](_0xe1dc('0x18'),_0x5a6cb0,JSON[_0xe1dc('0x17')](_0x369159));_0x2f795e(_0x369159);})[_0xe1dc('0x1d')](function(_0x3472a7){logger[_0xe1dc('0xd')](_0xe1dc('0x18'),_0x3472a7[_0xe1dc('0xf')],_0x5a6cb0);_0x5eab84(_0x1652ce[_0xe1dc('0xd')](0x1f4,_0x3472a7[_0xe1dc('0xf')]));});});}; \ No newline at end of file +var _0xd40e=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','UpdateWhatsappQueueReport','update','where','attributes','limit','util','moment','randomstring','ioredis'];(function(_0x3a964d,_0x305ccf){var _0x536907=function(_0x493e27){while(--_0x493e27){_0x3a964d['push'](_0x3a964d['shift']());}};_0x536907(++_0x305ccf);}(_0xd40e,0x150));var _0xed40=function(_0x1df41a,_0x5729e6){_0x1df41a=_0x1df41a-0x0;var _0xe21af5=_0xd40e[_0x1df41a];return _0xe21af5;};'use strict';var _=require('lodash');var util=require(_0xed40('0x0'));var moment=require(_0xed40('0x1'));var BPromise=require('bluebird');var rs=require(_0xed40('0x2'));var fs=require('fs');var Redis=require(_0xed40('0x3'));var db=require(_0xed40('0x4'))['db'];var utils=require(_0xed40('0x5'));var logger=require('../../config/logger')(_0xed40('0x6'));var config=require(_0xed40('0x7'));var jayson=require(_0xed40('0x8'));var client=jayson[_0xed40('0x9')][_0xed40('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a89af,_0x493747,_0x4bceb1){return new BPromise(function(_0x3cb3f3,_0x1db7c9){return client['request'](_0x1a89af,_0x4bceb1)[_0xed40('0xb')](function(_0x1b4473){logger[_0xed40('0xc')]('WhatsappQueueReport,\x20%s,\x20%s',_0x493747,_0xed40('0xd'));logger[_0xed40('0xe')](_0xed40('0xf'),_0x493747,'request\x20sent',JSON[_0xed40('0x10')](_0x1b4473));if(_0x1b4473[_0xed40('0x11')]){if(_0x1b4473['error'][_0xed40('0x12')]===0x1f4){logger[_0xed40('0x11')](_0xed40('0x13'),_0x493747,_0x1b4473[_0xed40('0x11')][_0xed40('0x14')]);return _0x1db7c9(_0x1b4473['error'][_0xed40('0x14')]);}logger['error'](_0xed40('0x13'),_0x493747,_0x1b4473[_0xed40('0x11')][_0xed40('0x14')]);return _0x3cb3f3(_0x1b4473[_0xed40('0x11')][_0xed40('0x14')]);}else{logger[_0xed40('0xc')](_0xed40('0x13'),_0x493747,'request\x20sent');_0x3cb3f3(_0x1b4473[_0xed40('0x15')][_0xed40('0x14')]);}})[_0xed40('0x16')](function(_0x37646b){logger[_0xed40('0x11')](_0xed40('0x13'),_0x493747,_0x37646b);_0x1db7c9(_0x37646b);});});}exports[_0xed40('0x17')]=function(_0x55d1f6){var _0x3c6113=this;return new Promise(function(_0x1cee70,_0x236649){return db[_0xed40('0x18')][_0xed40('0x19')](_0x55d1f6[_0xed40('0x1a')],{'raw':_0x55d1f6[_0xed40('0x1b')]?_0x55d1f6[_0xed40('0x1b')][_0xed40('0x1c')]===undefined?!![]:![]:!![]})[_0xed40('0xb')](function(_0x22fd57){logger[_0xed40('0xc')](_0xed40('0x17'),_0x55d1f6);logger[_0xed40('0xe')](_0xed40('0x17'),_0x55d1f6,JSON[_0xed40('0x10')](_0x22fd57));_0x1cee70(_0x22fd57);})[_0xed40('0x16')](function(_0x23e87a){logger[_0xed40('0x11')](_0xed40('0x17'),_0x23e87a[_0xed40('0x14')],_0x55d1f6);_0x236649(_0x3c6113[_0xed40('0x11')](0x1f4,_0x23e87a['message']));});});};exports[_0xed40('0x1d')]=function(_0x3a9ca1){var _0x41d180=this;return new Promise(function(_0x45143b,_0x150a7e){return db[_0xed40('0x18')][_0xed40('0x1e')](_0x3a9ca1[_0xed40('0x1a')],{'raw':_0x3a9ca1['options']?_0x3a9ca1[_0xed40('0x1b')][_0xed40('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a9ca1[_0xed40('0x1b')]?_0x3a9ca1[_0xed40('0x1b')][_0xed40('0x1f')]||null:null,'attributes':_0x3a9ca1[_0xed40('0x1b')]?_0x3a9ca1[_0xed40('0x1b')][_0xed40('0x20')]||null:null,'limit':_0x3a9ca1[_0xed40('0x1b')]?_0x3a9ca1[_0xed40('0x1b')][_0xed40('0x21')]||null:null})[_0xed40('0xb')](function(_0x367ab){logger['info'](_0xed40('0x1d'),_0x3a9ca1);logger[_0xed40('0xe')](_0xed40('0x1d'),_0x3a9ca1,JSON[_0xed40('0x10')](_0x367ab));_0x45143b(_0x367ab);})[_0xed40('0x16')](function(_0x366be7){logger[_0xed40('0x11')](_0xed40('0x1d'),_0x366be7[_0xed40('0x14')],_0x3a9ca1);_0x150a7e(_0x41d180[_0xed40('0x11')](0x1f4,_0x366be7['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index df701e9..bc6c6f3 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 _0x09fb=['post','create','put','update','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappTransferReport.controller','isAuthenticated','get','/describe','describe','/:id'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0x09fb,0x1a8));var _0xb09f=function(_0x1c1d27,_0x125dc1){_0x1c1d27=_0x1c1d27-0x0;var _0x4c3a84=_0x09fb[_0x1c1d27];return _0x4c3a84;};'use strict';var multer=require('multer');var util=require(_0xb09f('0x0'));var path=require(_0xb09f('0x1'));var timeout=require(_0xb09f('0x2'));var express=require('express');var router=express[_0xb09f('0x3')]();var fs_extra=require(_0xb09f('0x4'));var auth=require(_0xb09f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb09f('0x6'));var controller=require(_0xb09f('0x7'));router['get']('/',auth[_0xb09f('0x8')](),controller['index']);router[_0xb09f('0x9')](_0xb09f('0xa'),auth[_0xb09f('0x8')](),controller[_0xb09f('0xb')]);router[_0xb09f('0x9')](_0xb09f('0xc'),auth[_0xb09f('0x8')](),controller['show']);router[_0xb09f('0xd')]('/',auth[_0xb09f('0x8')](),controller[_0xb09f('0xe')]);router[_0xb09f('0xf')]('/:id',auth[_0xb09f('0x8')](),controller[_0xb09f('0x10')]);router['delete']('/:id',auth[_0xb09f('0x8')](),controller[_0xb09f('0x11')]);module[_0xb09f('0x12')]=router; \ No newline at end of file +var _0x3363=['../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1d50f2,_0x3c3ec6){var _0x3769b8=function(_0x50926a){while(--_0x50926a){_0x1d50f2['push'](_0x1d50f2['shift']());}};_0x3769b8(++_0x3c3ec6);}(_0x3363,0xf5));var _0x3336=function(_0x2e2fe6,_0x3cca01){_0x2e2fe6=_0x2e2fe6-0x0;var _0x3eb2c5=_0x3363[_0x2e2fe6];return _0x3eb2c5;};'use strict';var multer=require(_0x3336('0x0'));var util=require(_0x3336('0x1'));var path=require(_0x3336('0x2'));var timeout=require(_0x3336('0x3'));var express=require(_0x3336('0x4'));var router=express[_0x3336('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3336('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x3336('0x7'));var controller=require(_0x3336('0x8'));router[_0x3336('0x9')]('/',auth[_0x3336('0xa')](),controller[_0x3336('0xb')]);router[_0x3336('0x9')]('/describe',auth[_0x3336('0xa')](),controller[_0x3336('0xc')]);router[_0x3336('0x9')](_0x3336('0xd'),auth['isAuthenticated'](),controller[_0x3336('0xe')]);router[_0x3336('0xf')]('/',auth['isAuthenticated'](),controller[_0x3336('0x10')]);router['put'](_0x3336('0xd'),auth[_0x3336('0xa')](),controller[_0x3336('0x11')]);router[_0x3336('0x12')](_0x3336('0xd'),auth['isAuthenticated'](),controller[_0x3336('0x13')]);module[_0x3336('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 82ad746..aa90898 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 _0x0570=['exports','STRING','ENUM','agent','DATE'];(function(_0x579e00,_0x19ac52){var _0x414989=function(_0x17c83a){while(--_0x17c83a){_0x579e00['push'](_0x579e00['shift']());}};_0x414989(++_0x19ac52);}(_0x0570,0x172));var _0x0057=function(_0x1d8b47,_0x58fe60){_0x1d8b47=_0x1d8b47-0x0;var _0x2d4c5b=_0x0570[_0x1d8b47];return _0x2d4c5b;};'use strict';var Sequelize=require('sequelize');module[_0x0057('0x0')]={'uniqueid':{'type':Sequelize[_0x0057('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0057('0x2')]('account',_0x0057('0x3'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x0057('0x4')]}}; \ No newline at end of file +var _0xbd9f=['agent','DATE','ENUM'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xbd9f,0x98));var _0xfbd9=function(_0x2aaed8,_0x4c313d){_0x2aaed8=_0x2aaed8-0x0;var _0x512398=_0xbd9f[_0x2aaed8];return _0x512398;};'use strict';var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xfbd9('0x0')]('account',_0xfbd9('0x1'),'queue'),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xfbd9('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 0d8e7a5..b2c02c4 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 _0xe05d=['sort','where','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','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/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x3f55de,_0x3ae98f){var _0x2698de=function(_0x48f021){while(--_0x48f021){_0x3f55de['push'](_0x3f55de['shift']());}};_0x2698de(++_0x3ae98f);}(_0xe05d,0xf1));var _0xde05=function(_0x1cdc96,_0x1cead6){_0x1cdc96=_0x1cdc96-0x0;var _0x350053=_0xe05d[_0x1cdc96];return _0x350053;};'use strict';var emlformat=require(_0xde05('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xde05('0x1'));var rp=require(_0xde05('0x2'));var moment=require(_0xde05('0x3'));var BPromise=require(_0xde05('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xde05('0x5'));var csv=require(_0xde05('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde05('0x7'));var _=require(_0xde05('0x8'));var squel=require(_0xde05('0x9'));var crypto=require(_0xde05('0xa'));var jsforce=require(_0xde05('0xb'));var deskjs=require(_0xde05('0xc'));var toCsv=require(_0xde05('0x6'));var querystring=require(_0xde05('0xd'));var Papa=require(_0xde05('0xe'));var Redis=require(_0xde05('0xf'));var authService=require(_0xde05('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xde05('0x11'));var hardwareService=require(_0xde05('0x12'));var logger=require(_0xde05('0x13'))(_0xde05('0x14'));var utils=require(_0xde05('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xde05('0x16'));var db=require(_0xde05('0x17'))['db'];function respondWithStatusCode(_0x201045,_0x3f01e9){_0x3f01e9=_0x3f01e9||0xcc;return function(_0x641b29){if(_0x641b29){return _0x201045[_0xde05('0x18')](_0x3f01e9);}return _0x201045['status'](_0x3f01e9)[_0xde05('0x19')]();};}function respondWithResult(_0x854f1f,_0x40a135){_0x40a135=_0x40a135||0xc8;return function(_0x362536){if(_0x362536){return _0x854f1f[_0xde05('0x1a')](_0x40a135)['json'](_0x362536);}};}function respondWithFilteredResult(_0x57f000,_0x210646){return function(_0x368fff){if(_0x368fff){var _0x165fac=typeof _0x210646[_0xde05('0x1b')]===_0xde05('0x1c')&&typeof _0x210646['limit']==='undefined';var _0x51cc92=_0x368fff[_0xde05('0x1d')];var _0x3f432c=_0x165fac?0x0:_0x210646[_0xde05('0x1b')];var _0x4dfbe5=_0x165fac?_0x368fff['count']:_0x210646[_0xde05('0x1b')]+_0x210646[_0xde05('0x1e')];var _0x2b1951;if(_0x4dfbe5>=_0x51cc92){_0x4dfbe5=_0x51cc92;_0x2b1951=0xc8;}else{_0x2b1951=0xce;}_0x57f000[_0xde05('0x1a')](_0x2b1951);return _0x57f000['set'](_0xde05('0x1f'),_0x3f432c+'-'+_0x4dfbe5+'/'+_0x51cc92)[_0xde05('0x20')](_0x368fff);}return null;};}function patchUpdates(_0x41bf0b){return function(_0x518061){try{jsonpatch[_0xde05('0x21')](_0x518061,_0x41bf0b,!![]);}catch(_0x4a68ad){return BPromise[_0xde05('0x22')](_0x4a68ad);}return _0x518061[_0xde05('0x23')]();};}function saveUpdates(_0x4e3a8f,_0x2c7764){return function(_0xaf3e10){if(_0xaf3e10){return _0xaf3e10[_0xde05('0x24')](_0x4e3a8f)[_0xde05('0x25')](function(_0x20bc85){return _0x20bc85;});}return null;};}function removeEntity(_0x429a3e,_0x26601d){return function(_0x1d0165){if(_0x1d0165){return _0x1d0165[_0xde05('0x26')]()['then'](function(){_0x429a3e['status'](0xcc)[_0xde05('0x19')]();});}};}function handleEntityNotFound(_0xc2cabf,_0x20b3d1){return function(_0xc8fe25){if(!_0xc8fe25){_0xc2cabf[_0xde05('0x18')](0x194);}return _0xc8fe25;};}function handleError(_0x22b881,_0x32d3f4){_0x32d3f4=_0x32d3f4||0x1f4;return function(_0x2bc1c4){logger[_0xde05('0x27')](_0x2bc1c4[_0xde05('0x28')]);if(_0x2bc1c4[_0xde05('0x29')]){delete _0x2bc1c4[_0xde05('0x29')];}_0x22b881[_0xde05('0x1a')](_0x32d3f4)[_0xde05('0x2a')](_0x2bc1c4);};}exports['index']=function(_0x2581e0,_0xdd5dcf){var _0x5bcc05={},_0x26e087={},_0x2143f9={'count':0x0,'rows':[]};var _0x1ea4df=_[_0xde05('0x2b')](db[_0xde05('0x2c')][_0xde05('0x2d')],function(_0x7cc13f){return{'name':_0x7cc13f[_0xde05('0x2e')],'type':_0x7cc13f[_0xde05('0x2f')][_0xde05('0x30')]};});_0x26e087[_0xde05('0x31')]=_['map'](_0x1ea4df,_0xde05('0x29'));_0x26e087[_0xde05('0x32')]=_[_0xde05('0x33')](_0x2581e0['query']);_0x26e087[_0xde05('0x34')]=_[_0xde05('0x35')](_0x26e087[_0xde05('0x31')],_0x26e087[_0xde05('0x32')]);_0x5bcc05[_0xde05('0x36')]=_[_0xde05('0x35')](_0x26e087['model'],qs['fields'](_0x2581e0[_0xde05('0x32')][_0xde05('0x37')]));_0x5bcc05[_0xde05('0x36')]=_0x5bcc05[_0xde05('0x36')][_0xde05('0x38')]?_0x5bcc05[_0xde05('0x36')]:_0x26e087['model'];if(!_0x2581e0['query'][_0xde05('0x39')](_0xde05('0x3a'))){_0x5bcc05['limit']=qs[_0xde05('0x1e')](_0x2581e0[_0xde05('0x32')]['limit']);_0x5bcc05['offset']=qs[_0xde05('0x1b')](_0x2581e0[_0xde05('0x32')]['offset']);}_0x5bcc05['order']=qs[_0xde05('0x3b')](_0x2581e0[_0xde05('0x32')][_0xde05('0x3b')]);_0x5bcc05['where']=qs[_0xde05('0x34')](_['pick'](_0x2581e0['query'],_0x26e087[_0xde05('0x34')]),_0x1ea4df);if(_0x2581e0[_0xde05('0x32')]['filter']){_0x5bcc05[_0xde05('0x3c')]=_[_0xde05('0x3d')](_0x5bcc05[_0xde05('0x3c')],{'$or':_[_0xde05('0x2b')](_0x1ea4df,function(_0x2471e6){if(_0x2471e6[_0xde05('0x2f')]!==_0xde05('0x3e')){var _0x20aec1={};_0x20aec1[_0x2471e6['name']]={'$like':'%'+_0x2581e0[_0xde05('0x32')][_0xde05('0x3f')]+'%'};return _0x20aec1;}})});}_0x5bcc05=_[_0xde05('0x3d')]({},_0x5bcc05,_0x2581e0[_0xde05('0x40')]);var _0x50bdfa={'where':_0x5bcc05[_0xde05('0x3c')]};return db['WhatsappTransferReport'][_0xde05('0x1d')](_0x50bdfa)[_0xde05('0x25')](function(_0x246dae){_0x2143f9[_0xde05('0x1d')]=_0x246dae;if(_0x2581e0[_0xde05('0x32')][_0xde05('0x41')]){_0x5bcc05[_0xde05('0x42')]=[{'all':!![]}];}return db[_0xde05('0x2c')]['findAll'](_0x5bcc05);})[_0xde05('0x25')](function(_0x58e7d2){_0x2143f9[_0xde05('0x43')]=_0x58e7d2;return _0x2143f9;})[_0xde05('0x25')](respondWithFilteredResult(_0xdd5dcf,_0x5bcc05))[_0xde05('0x44')](handleError(_0xdd5dcf,null));};exports[_0xde05('0x45')]=function(_0x4dfcb8,_0x5e9459){var _0x29c6c1={'raw':!![],'where':{'id':_0x4dfcb8[_0xde05('0x46')]['id']}},_0xacaa05={};_0xacaa05[_0xde05('0x31')]=_[_0xde05('0x33')](db[_0xde05('0x2c')][_0xde05('0x2d')]);_0xacaa05[_0xde05('0x32')]=_[_0xde05('0x33')](_0x4dfcb8['query']);_0xacaa05[_0xde05('0x34')]=_[_0xde05('0x35')](_0xacaa05['model'],_0xacaa05[_0xde05('0x32')]);_0x29c6c1[_0xde05('0x36')]=_['intersection'](_0xacaa05[_0xde05('0x31')],qs['fields'](_0x4dfcb8[_0xde05('0x32')][_0xde05('0x37')]));_0x29c6c1[_0xde05('0x36')]=_0x29c6c1['attributes'][_0xde05('0x38')]?_0x29c6c1['attributes']:_0xacaa05[_0xde05('0x31')];if(_0x4dfcb8['query']['includeAll']){_0x29c6c1['include']=[{'all':!![]}];}_0x29c6c1=_[_0xde05('0x3d')]({},_0x29c6c1,_0x4dfcb8[_0xde05('0x40')]);return db[_0xde05('0x2c')][_0xde05('0x47')](_0x29c6c1)[_0xde05('0x25')](handleEntityNotFound(_0x5e9459,null))[_0xde05('0x25')](respondWithResult(_0x5e9459,null))[_0xde05('0x44')](handleError(_0x5e9459,null));};exports[_0xde05('0x48')]=function(_0x3ec781,_0x4a9be9){return db[_0xde05('0x2c')][_0xde05('0x48')](_0x3ec781[_0xde05('0x49')],{})[_0xde05('0x25')](respondWithResult(_0x4a9be9,0xc9))[_0xde05('0x44')](handleError(_0x4a9be9,null));};exports[_0xde05('0x24')]=function(_0x105257,_0x173e2e){if(_0x105257[_0xde05('0x49')]['id']){delete _0x105257[_0xde05('0x49')]['id'];}return db[_0xde05('0x2c')][_0xde05('0x47')]({'where':{'id':_0x105257[_0xde05('0x46')]['id']}})[_0xde05('0x25')](handleEntityNotFound(_0x173e2e,null))[_0xde05('0x25')](saveUpdates(_0x105257[_0xde05('0x49')],null))['then'](respondWithResult(_0x173e2e,null))[_0xde05('0x44')](handleError(_0x173e2e,null));};exports[_0xde05('0x26')]=function(_0x46be16,_0x23b446){return db[_0xde05('0x2c')][_0xde05('0x47')]({'where':{'id':_0x46be16[_0xde05('0x46')]['id']}})[_0xde05('0x25')](handleEntityNotFound(_0x23b446,null))[_0xde05('0x25')](removeEntity(_0x23b446,null))[_0xde05('0x44')](handleError(_0x23b446,null));};exports['describe']=function(_0x5f107c,_0x385812){return db[_0xde05('0x2c')][_0xde05('0x4a')]()[_0xde05('0x25')](respondWithResult(_0x385812,null))[_0xde05('0x44')](handleError(_0x385812,null));}; \ No newline at end of file +var _0x6888=['status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','error','stack','name','send','index','map','WhatsappTransferReport','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','show','params','rawAttributes','find','create','catch','update','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','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','sendStatus'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x6888,0xd2));var _0x8688=function(_0x255d5b,_0x4f6f35){_0x255d5b=_0x255d5b-0x0;var _0x3e141a=_0x6888[_0x255d5b];return _0x3e141a;};'use strict';var emlformat=require(_0x8688('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8688('0x1'));var jsonpatch=require(_0x8688('0x2'));var rp=require(_0x8688('0x3'));var moment=require(_0x8688('0x4'));var BPromise=require(_0x8688('0x5'));var Mustache=require(_0x8688('0x6'));var util=require('util');var path=require('path');var sox=require(_0x8688('0x7'));var csv=require(_0x8688('0x8'));var ejs=require(_0x8688('0x9'));var fs=require('fs');var fs_extra=require(_0x8688('0xa'));var _=require(_0x8688('0xb'));var squel=require(_0x8688('0xc'));var crypto=require('crypto');var jsforce=require(_0x8688('0xd'));var deskjs=require(_0x8688('0xe'));var toCsv=require(_0x8688('0x8'));var querystring=require(_0x8688('0xf'));var Papa=require(_0x8688('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8688('0x11'));var as=require(_0x8688('0x12'));var hardwareService=require(_0x8688('0x13'));var logger=require(_0x8688('0x14'))(_0x8688('0x15'));var utils=require(_0x8688('0x16'));var config=require(_0x8688('0x17'));var licenseUtil=require(_0x8688('0x18'));var db=require(_0x8688('0x19'))['db'];function respondWithStatusCode(_0x560dae,_0x961f9){_0x961f9=_0x961f9||0xcc;return function(_0x1e10e3){if(_0x1e10e3){return _0x560dae[_0x8688('0x1a')](_0x961f9);}return _0x560dae[_0x8688('0x1b')](_0x961f9)[_0x8688('0x1c')]();};}function respondWithResult(_0x4628fa,_0x1ec45a){_0x1ec45a=_0x1ec45a||0xc8;return function(_0x1c4e32){if(_0x1c4e32){return _0x4628fa[_0x8688('0x1b')](_0x1ec45a)[_0x8688('0x1d')](_0x1c4e32);}};}function respondWithFilteredResult(_0x1fb7df,_0x798984){return function(_0x5790cc){if(_0x5790cc){var _0x3a1c41=typeof _0x798984[_0x8688('0x1e')]===_0x8688('0x1f')&&typeof _0x798984[_0x8688('0x20')]===_0x8688('0x1f');var _0x13ee31=_0x5790cc[_0x8688('0x21')];var _0x48eab9=_0x3a1c41?0x0:_0x798984['offset'];var _0x3c3021=_0x3a1c41?_0x5790cc[_0x8688('0x21')]:_0x798984['offset']+_0x798984['limit'];var _0x1951ec;if(_0x3c3021>=_0x13ee31){_0x3c3021=_0x13ee31;_0x1951ec=0xc8;}else{_0x1951ec=0xce;}_0x1fb7df[_0x8688('0x1b')](_0x1951ec);return _0x1fb7df[_0x8688('0x22')](_0x8688('0x23'),_0x48eab9+'-'+_0x3c3021+'/'+_0x13ee31)[_0x8688('0x1d')](_0x5790cc);}return null;};}function patchUpdates(_0x135727){return function(_0x32073e){try{jsonpatch[_0x8688('0x24')](_0x32073e,_0x135727,!![]);}catch(_0x1555ce){return BPromise['reject'](_0x1555ce);}return _0x32073e[_0x8688('0x25')]();};}function saveUpdates(_0x5b57a6,_0x32d195){return function(_0x409cc7){if(_0x409cc7){return _0x409cc7['update'](_0x5b57a6)[_0x8688('0x26')](function(_0x4d80ca){return _0x4d80ca;});}return null;};}function removeEntity(_0x3ca828,_0x3e92cd){return function(_0x44ca43){if(_0x44ca43){return _0x44ca43[_0x8688('0x27')]()[_0x8688('0x26')](function(){_0x3ca828[_0x8688('0x1b')](0xcc)[_0x8688('0x1c')]();});}};}function handleEntityNotFound(_0x1e6aca,_0x4f5bfe){return function(_0x2a8d9e){if(!_0x2a8d9e){_0x1e6aca[_0x8688('0x1a')](0x194);}return _0x2a8d9e;};}function handleError(_0x196d50,_0x2f2707){_0x2f2707=_0x2f2707||0x1f4;return function(_0x4d4b9c){logger[_0x8688('0x28')](_0x4d4b9c[_0x8688('0x29')]);if(_0x4d4b9c[_0x8688('0x2a')]){delete _0x4d4b9c['name'];}_0x196d50[_0x8688('0x1b')](_0x2f2707)[_0x8688('0x2b')](_0x4d4b9c);};}exports[_0x8688('0x2c')]=function(_0x5f4f7b,_0xed6020){var _0x5d249b={},_0x4ab1fb={},_0x47b088={'count':0x0,'rows':[]};var _0x21ee40=_[_0x8688('0x2d')](db[_0x8688('0x2e')]['rawAttributes'],function(_0x203814){return{'name':_0x203814[_0x8688('0x2f')],'type':_0x203814[_0x8688('0x30')][_0x8688('0x31')]};});_0x4ab1fb[_0x8688('0x32')]=_[_0x8688('0x2d')](_0x21ee40,_0x8688('0x2a'));_0x4ab1fb[_0x8688('0x33')]=_[_0x8688('0x34')](_0x5f4f7b[_0x8688('0x33')]);_0x4ab1fb[_0x8688('0x35')]=_['intersection'](_0x4ab1fb[_0x8688('0x32')],_0x4ab1fb['query']);_0x5d249b[_0x8688('0x36')]=_[_0x8688('0x37')](_0x4ab1fb['model'],qs[_0x8688('0x38')](_0x5f4f7b[_0x8688('0x33')]['fields']));_0x5d249b['attributes']=_0x5d249b[_0x8688('0x36')][_0x8688('0x39')]?_0x5d249b[_0x8688('0x36')]:_0x4ab1fb['model'];if(!_0x5f4f7b['query'][_0x8688('0x3a')](_0x8688('0x3b'))){_0x5d249b[_0x8688('0x20')]=qs['limit'](_0x5f4f7b['query'][_0x8688('0x20')]);_0x5d249b[_0x8688('0x1e')]=qs[_0x8688('0x1e')](_0x5f4f7b[_0x8688('0x33')][_0x8688('0x1e')]);}_0x5d249b[_0x8688('0x3c')]=qs[_0x8688('0x3d')](_0x5f4f7b['query'][_0x8688('0x3d')]);_0x5d249b[_0x8688('0x3e')]=qs['filters'](_[_0x8688('0x3f')](_0x5f4f7b[_0x8688('0x33')],_0x4ab1fb[_0x8688('0x35')]),_0x21ee40);if(_0x5f4f7b[_0x8688('0x33')][_0x8688('0x40')]){_0x5d249b[_0x8688('0x3e')]=_[_0x8688('0x41')](_0x5d249b[_0x8688('0x3e')],{'$or':_['map'](_0x21ee40,function(_0x297f08){if(_0x297f08['type']!==_0x8688('0x42')){var _0x5ae931={};_0x5ae931[_0x297f08[_0x8688('0x2a')]]={'$like':'%'+_0x5f4f7b[_0x8688('0x33')][_0x8688('0x40')]+'%'};return _0x5ae931;}})});}_0x5d249b=_[_0x8688('0x41')]({},_0x5d249b,_0x5f4f7b['options']);var _0x184317={'where':_0x5d249b[_0x8688('0x3e')]};return db[_0x8688('0x2e')]['count'](_0x184317)[_0x8688('0x26')](function(_0x11e1d2){_0x47b088[_0x8688('0x21')]=_0x11e1d2;if(_0x5f4f7b[_0x8688('0x33')][_0x8688('0x43')]){_0x5d249b[_0x8688('0x44')]=[{'all':!![]}];}return db[_0x8688('0x2e')][_0x8688('0x45')](_0x5d249b);})[_0x8688('0x26')](function(_0x19f7d5){_0x47b088['rows']=_0x19f7d5;return _0x47b088;})['then'](respondWithFilteredResult(_0xed6020,_0x5d249b))['catch'](handleError(_0xed6020,null));};exports[_0x8688('0x46')]=function(_0x32e366,_0x3efd67){var _0x2a9155={'raw':!![],'where':{'id':_0x32e366[_0x8688('0x47')]['id']}},_0x38442e={};_0x38442e[_0x8688('0x32')]=_['keys'](db[_0x8688('0x2e')][_0x8688('0x48')]);_0x38442e[_0x8688('0x33')]=_['keys'](_0x32e366[_0x8688('0x33')]);_0x38442e[_0x8688('0x35')]=_[_0x8688('0x37')](_0x38442e[_0x8688('0x32')],_0x38442e[_0x8688('0x33')]);_0x2a9155[_0x8688('0x36')]=_[_0x8688('0x37')](_0x38442e[_0x8688('0x32')],qs[_0x8688('0x38')](_0x32e366[_0x8688('0x33')][_0x8688('0x38')]));_0x2a9155[_0x8688('0x36')]=_0x2a9155[_0x8688('0x36')][_0x8688('0x39')]?_0x2a9155[_0x8688('0x36')]:_0x38442e[_0x8688('0x32')];if(_0x32e366[_0x8688('0x33')][_0x8688('0x43')]){_0x2a9155['include']=[{'all':!![]}];}_0x2a9155=_['merge']({},_0x2a9155,_0x32e366['options']);return db[_0x8688('0x2e')][_0x8688('0x49')](_0x2a9155)['then'](handleEntityNotFound(_0x3efd67,null))[_0x8688('0x26')](respondWithResult(_0x3efd67,null))['catch'](handleError(_0x3efd67,null));};exports[_0x8688('0x4a')]=function(_0x3cb938,_0x3f53ff){return db[_0x8688('0x2e')][_0x8688('0x4a')](_0x3cb938['body'],{})['then'](respondWithResult(_0x3f53ff,0xc9))[_0x8688('0x4b')](handleError(_0x3f53ff,null));};exports[_0x8688('0x4c')]=function(_0x42a41f,_0x1fbc72){if(_0x42a41f[_0x8688('0x4d')]['id']){delete _0x42a41f[_0x8688('0x4d')]['id'];}return db['WhatsappTransferReport'][_0x8688('0x49')]({'where':{'id':_0x42a41f['params']['id']}})[_0x8688('0x26')](handleEntityNotFound(_0x1fbc72,null))[_0x8688('0x26')](saveUpdates(_0x42a41f['body'],null))['then'](respondWithResult(_0x1fbc72,null))[_0x8688('0x4b')](handleError(_0x1fbc72,null));};exports['destroy']=function(_0x526d5a,_0x3777c0){return db[_0x8688('0x2e')][_0x8688('0x49')]({'where':{'id':_0x526d5a[_0x8688('0x47')]['id']}})[_0x8688('0x26')](handleEntityNotFound(_0x3777c0,null))[_0x8688('0x26')](removeEntity(_0x3777c0,null))[_0x8688('0x4b')](handleError(_0x3777c0,null));};exports[_0x8688('0x4e')]=function(_0x5d139e,_0x2aa02b){return db[_0x8688('0x2e')][_0x8688('0x4e')]()[_0x8688('0x26')](respondWithResult(_0x2aa02b,null))[_0x8688('0x4b')](handleError(_0x2aa02b,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 11a1877..a3a15ec 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 _0xdc67=['api','moment','bluebird','request-promise','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','util','../../config/logger'];(function(_0x335693,_0x51d436){var _0x556377=function(_0x141af5){while(--_0x141af5){_0x335693['push'](_0x335693['shift']());}};_0x556377(++_0x51d436);}(_0xdc67,0x73));var _0x7dc6=function(_0x45ae0d,_0x1ea3b9){_0x45ae0d=_0x45ae0d-0x0;var _0x371826=_0xdc67[_0x45ae0d];return _0x371826;};'use strict';var _=require('lodash');var util=require(_0x7dc6('0x0'));var logger=require(_0x7dc6('0x1'))(_0x7dc6('0x2'));var moment=require(_0x7dc6('0x3'));var BPromise=require(_0x7dc6('0x4'));var rp=require(_0x7dc6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7dc6('0x6'));var attributes=require(_0x7dc6('0x7'));module[_0x7dc6('0x8')]=function(_0x413be1,_0x2e06d0){return _0x413be1[_0x7dc6('0x9')](_0x7dc6('0xa'),attributes,{'tableName':_0x7dc6('0xb'),'paranoid':![],'indexes':[{'name':_0x7dc6('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x263c=['request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','define','WhatsappTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird'];(function(_0x26b4e7,_0x20cffe){var _0x2e3484=function(_0x25f3e6){while(--_0x25f3e6){_0x26b4e7['push'](_0x26b4e7['shift']());}};_0x2e3484(++_0x20cffe);}(_0x263c,0x1c2));var _0xc263=function(_0x4ae459,_0x3bf329){_0x4ae459=_0x4ae459-0x0;var _0x51d0c9=_0x263c[_0x4ae459];return _0x51d0c9;};'use strict';var _=require('lodash');var util=require(_0xc263('0x0'));var logger=require(_0xc263('0x1'))(_0xc263('0x2'));var moment=require(_0xc263('0x3'));var BPromise=require(_0xc263('0x4'));var rp=require(_0xc263('0x5'));var fs=require('fs');var path=require(_0xc263('0x6'));var rimraf=require(_0xc263('0x7'));var config=require(_0xc263('0x8'));var attributes=require(_0xc263('0x9'));module['exports']=function(_0xa1cc7d,_0x7554ca){return _0xa1cc7d[_0xc263('0xa')](_0xc263('0xb'),attributes,{'tableName':'report_whatsapp_transfer','paranoid':![],'indexes':[{'name':_0xc263('0xc'),'fields':[_0xc263('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index e63741c..f885686 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 _0x7f32=['info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7f32,0x9a));var _0x27f3=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7f32[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x27f3('0x0'));var util=require(_0x27f3('0x1'));var moment=require('moment');var BPromise=require(_0x27f3('0x2'));var rs=require(_0x27f3('0x3'));var fs=require('fs');var Redis=require(_0x27f3('0x4'));var db=require(_0x27f3('0x5'))['db'];var utils=require(_0x27f3('0x6'));var logger=require(_0x27f3('0x7'))(_0x27f3('0x8'));var config=require(_0x27f3('0x9'));var jayson=require(_0x27f3('0xa'));var client=jayson['client'][_0x27f3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ad5ee,_0x5616db,_0x226514){return new BPromise(function(_0x16811a,_0x5e49ba){return client[_0x27f3('0xc')](_0x5ad5ee,_0x226514)[_0x27f3('0xd')](function(_0x36a968){logger[_0x27f3('0xe')](_0x27f3('0xf'),_0x5616db,_0x27f3('0x10'));logger[_0x27f3('0x11')](_0x27f3('0x12'),_0x5616db,_0x27f3('0x10'),JSON[_0x27f3('0x13')](_0x36a968));if(_0x36a968[_0x27f3('0x14')]){if(_0x36a968[_0x27f3('0x14')]['code']===0x1f4){logger[_0x27f3('0x14')](_0x27f3('0xf'),_0x5616db,_0x36a968[_0x27f3('0x14')]['message']);return _0x5e49ba(_0x36a968[_0x27f3('0x14')][_0x27f3('0x15')]);}logger[_0x27f3('0x14')](_0x27f3('0xf'),_0x5616db,_0x36a968[_0x27f3('0x14')][_0x27f3('0x15')]);return _0x16811a(_0x36a968[_0x27f3('0x14')][_0x27f3('0x15')]);}else{logger['info']('WhatsappTransferReport,\x20%s,\x20%s',_0x5616db,'request\x20sent');_0x16811a(_0x36a968[_0x27f3('0x16')]['message']);}})[_0x27f3('0x17')](function(_0x4b46fe){logger[_0x27f3('0x14')](_0x27f3('0xf'),_0x5616db,_0x4b46fe);_0x5e49ba(_0x4b46fe);});});} \ No newline at end of file +var _0x0893=['catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x2c6484,_0x4fe72c){var _0x3b9d94=function(_0x3d8bd4){while(--_0x3d8bd4){_0x2c6484['push'](_0x2c6484['shift']());}};_0x3b9d94(++_0x4fe72c);}(_0x0893,0xc7));var _0x3089=function(_0x459db8,_0x2db794){_0x459db8=_0x459db8-0x0;var _0x3f4f8b=_0x0893[_0x459db8];return _0x3f4f8b;};'use strict';var _=require(_0x3089('0x0'));var util=require(_0x3089('0x1'));var moment=require('moment');var BPromise=require(_0x3089('0x2'));var rs=require(_0x3089('0x3'));var fs=require('fs');var Redis=require(_0x3089('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3089('0x5'));var logger=require(_0x3089('0x6'))(_0x3089('0x7'));var config=require('../../config/environment');var jayson=require(_0x3089('0x8'));var client=jayson['client'][_0x3089('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fa2ba,_0x3d92b7,_0x1667ca){return new BPromise(function(_0x58c0bf,_0x4d6dd0){return client[_0x3089('0xa')](_0x4fa2ba,_0x1667ca)['then'](function(_0x332f6a){logger[_0x3089('0xb')](_0x3089('0xc'),_0x3d92b7,'request\x20sent');logger[_0x3089('0xd')](_0x3089('0xe'),_0x3d92b7,_0x3089('0xf'),JSON[_0x3089('0x10')](_0x332f6a));if(_0x332f6a[_0x3089('0x11')]){if(_0x332f6a[_0x3089('0x11')][_0x3089('0x12')]===0x1f4){logger[_0x3089('0x11')](_0x3089('0xc'),_0x3d92b7,_0x332f6a[_0x3089('0x11')][_0x3089('0x13')]);return _0x4d6dd0(_0x332f6a[_0x3089('0x11')]['message']);}logger[_0x3089('0x11')](_0x3089('0xc'),_0x3d92b7,_0x332f6a[_0x3089('0x11')][_0x3089('0x13')]);return _0x58c0bf(_0x332f6a['error'][_0x3089('0x13')]);}else{logger[_0x3089('0xb')](_0x3089('0xc'),_0x3d92b7,_0x3089('0xf'));_0x58c0bf(_0x332f6a[_0x3089('0x14')][_0x3089('0x13')]);}})[_0x3089('0x15')](function(_0x70b11c){logger[_0x3089('0x11')]('WhatsappTransferReport,\x20%s,\x20%s',_0x3d92b7,_0x70b11c);_0x4d6dd0(_0x70b11c);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index bd23f46..bebf703 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1fa=['map','pm2_env','name','Online\x20apps:','online','join','Offline\x20apps:','status','App\x20Ready!','catch','log','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','app','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','start','info','filter','exitCode','length'];(function(_0x3400ca,_0x27c04d){var _0x26e8d1=function(_0x2284e9){while(--_0x2284e9){_0x3400ca['push'](_0x3400ca['shift']());}};_0x26e8d1(++_0x27c04d);}(_0xc1fa,0x83));var _0xac1f=function(_0x2d61ac,_0x18ff36){_0x2d61ac=_0x2d61ac-0x0;var _0x3f7d3c=_0xc1fa[_0x2d61ac];return _0x3f7d3c;};'use strict';var _=require(_0xac1f('0x0'));var db=require(_0xac1f('0x1'))['db'];var seedDb=require(_0xac1f('0x2'));var checkLicense=require(_0xac1f('0x3'));var rpc=require(_0xac1f('0x4'));var config=require(_0xac1f('0x5'));var logger=require('./config/logger')(_0xac1f('0x6'));var pm2=require(_0xac1f('0x7'));var pm2Config=require(_0xac1f('0x8'));var schedule=require(_0xac1f('0x9'));var chat=require(_0xac1f('0xa'));var whatsapp=require(_0xac1f('0xb'));var transcribe=require(_0xac1f('0xc'));var provider=require(_0xac1f('0xd'));function main(){return db[_0xac1f('0xe')][_0xac1f('0xf')]()[_0xac1f('0x10')](function(){if(config[_0xac1f('0x11')]){return seedDb['default']();}})[_0xac1f('0x10')](function(){return checkLicense[_0xac1f('0x12')]();})[_0xac1f('0x10')](function(){return rpc[_0xac1f('0x13')]();})[_0xac1f('0x10')](function(_0x50fbcb){logger['info'](_0x50fbcb);return chat[_0xac1f('0x14')]();})['then'](function(){return whatsapp['start']();})[_0xac1f('0x10')](function(){return schedule[_0xac1f('0x14')]();})['then'](function(){return transcribe[_0xac1f('0x14')]();})[_0xac1f('0x10')](function(){return provider[_0xac1f('0x14')]();})[_0xac1f('0x10')](function(_0xb5005b){logger[_0xac1f('0x15')](_0xb5005b);return pm2[_0xac1f('0x14')](pm2Config);})[_0xac1f('0x10')](function(_0x2c7411){var _0x1ab6dc=_0x2c7411[_0xac1f('0x16')](function(_0x2671ec){return typeof _0x2671ec[_0xac1f('0x17')]==='number'&&_0x2671ec[_0xac1f('0x17')]>=0x0;});if(_0x1ab6dc[_0xac1f('0x18')]>0x0){throw new Error(_0x1ab6dc[_0xac1f('0x18')]+'\x20processes\x20failed\x20at\x20startup:\x20'+_[_0xac1f('0x19')](_0x1ab6dc,function(_0x5c7847){return'\x22'+_0x5c7847[_0xac1f('0x1a')][_0xac1f('0x1b')]+'\x22';}));}logger[_0xac1f('0x15')](_0xac1f('0x1c'),_['map'](_[_0xac1f('0x16')](_0x2c7411,{'status':_0xac1f('0x1d')}),'name')[_0xac1f('0x1e')]());logger['info'](_0xac1f('0x1f'),_[_0xac1f('0x19')](_[_0xac1f('0x16')](_0x2c7411,function(_0x44a8c7){return _0x44a8c7[_0xac1f('0x20')]!==_0xac1f('0x1d');}),_0xac1f('0x1b'))[_0xac1f('0x1e')]()||'None');console['log'](_0xac1f('0x21'));})[_0xac1f('0x22')](function(_0x1c6281){console[_0xac1f('0x23')](_0xac1f('0x24'),_0x1c6281);logger[_0xac1f('0x25')](_0xac1f('0x26'),_0x1c6281);process['exit'](0x1);});}main(); \ No newline at end of file +var _0x2e88=['./config/license','./rpc','./config/environment','app','./config/pm2','./config/schedule','./config/schedule/chat','./config/schedule/transcribe','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','listen','info','start','exitCode','number','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','filter','online','join','Offline\x20apps:','status','None','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','lodash','./mysqldb','./config/seedDB'];(function(_0x3df763,_0x3d8435){var _0x6d4ea2=function(_0x35c40f){while(--_0x35c40f){_0x3df763['push'](_0x3df763['shift']());}};_0x6d4ea2(++_0x3d8435);}(_0x2e88,0x95));var _0x82e8=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0x2e88[_0x506d83];return _0x335e8b;};'use strict';var _=require(_0x82e8('0x0'));var db=require(_0x82e8('0x1'))['db'];var seedDb=require(_0x82e8('0x2'));var checkLicense=require(_0x82e8('0x3'));var rpc=require(_0x82e8('0x4'));var config=require(_0x82e8('0x5'));var logger=require('./config/logger')(_0x82e8('0x6'));var pm2=require(_0x82e8('0x7'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x82e8('0x8'));var chat=require(_0x82e8('0x9'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0x82e8('0xa'));var provider=require(_0x82e8('0xb'));function main(){return db[_0x82e8('0xc')][_0x82e8('0xd')]()[_0x82e8('0xe')](function(){if(config[_0x82e8('0xf')]){return seedDb[_0x82e8('0x10')]();}})[_0x82e8('0xe')](function(){return checkLicense[_0x82e8('0x10')]();})[_0x82e8('0xe')](function(){return rpc[_0x82e8('0x11')]();})['then'](function(_0x30b9bc){logger[_0x82e8('0x12')](_0x30b9bc);return chat[_0x82e8('0x13')]();})[_0x82e8('0xe')](function(){return whatsapp[_0x82e8('0x13')]();})[_0x82e8('0xe')](function(){return schedule[_0x82e8('0x13')]();})['then'](function(){return transcribe[_0x82e8('0x13')]();})[_0x82e8('0xe')](function(){return provider[_0x82e8('0x13')]();})[_0x82e8('0xe')](function(_0x192914){logger['info'](_0x192914);return pm2[_0x82e8('0x13')](pm2Config);})[_0x82e8('0xe')](function(_0xad6055){var _0x46e01e=_0xad6055['filter'](function(_0x25b60e){return typeof _0x25b60e[_0x82e8('0x14')]===_0x82e8('0x15')&&_0x25b60e[_0x82e8('0x14')]>=0x0;});if(_0x46e01e[_0x82e8('0x16')]>0x0){throw new Error(_0x46e01e['length']+_0x82e8('0x17')+_[_0x82e8('0x18')](_0x46e01e,function(_0x574ba2){return'\x22'+_0x574ba2[_0x82e8('0x19')][_0x82e8('0x1a')]+'\x22';}));}logger[_0x82e8('0x12')](_0x82e8('0x1b'),_[_0x82e8('0x18')](_[_0x82e8('0x1c')](_0xad6055,{'status':_0x82e8('0x1d')}),'name')[_0x82e8('0x1e')]());logger[_0x82e8('0x12')](_0x82e8('0x1f'),_[_0x82e8('0x18')](_[_0x82e8('0x1c')](_0xad6055,function(_0x5db337){return _0x5db337[_0x82e8('0x20')]!=='online';}),_0x82e8('0x1a'))[_0x82e8('0x1e')]()||_0x82e8('0x21'));console[_0x82e8('0x22')](_0x82e8('0x23'));})[_0x82e8('0x24')](function(_0x37d499){console['log'](_0x82e8('0x25'),_0x37d499);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x37d499);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 25f16f7..41ebedb 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 _0xc1d5=['blockDuration','isEqual','apiKeyNonce','nonce','disabled','blockedAt','add','minutes','Invalid\x20API\x20access\x20key','canUpdate','getLicense','update','isWebrtcLicence','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','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','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','split','length','splice','join','sign','secret','payload','options','promisify','verify','randomBytes','toString','hex','floor','now','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','basic-auth','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','userpic','voicePause','chatPause','mailPause','faxPause','openchannelPause','pauseType','showWebBar','lastLoginAt','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','settingsEnabled','wssPort','downloadAttachments','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswer','faxAutoanswerDelay','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','user','ChatInteraction','params','closed','disposition','then','query','forceDownload','status','json','unmanaged','Unmanaged.','Forbidden.','use','authorization','startsWith','Basic','User','find','catch','Unknown\x20authorization\x20format','apikey','getUuid','sub','Setting','allowedLoginAttempts'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xc1d5,0x146));var _0x5c1d=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0xc1d5[_0x1d70db];return _0x3060c6;};'use strict';var db=require(_0x5c1d('0x0'))['db'];var config=require(_0x5c1d('0x1'));var hardwareConf=require(_0x5c1d('0x2'));var licenseUtil=require(_0x5c1d('0x3'));var encryptor=require('../encryptor');var _=require(_0x5c1d('0x4'));var jwt=require(_0x5c1d('0x5'));var expressJwt=require('express-jwt');var compose=require('composable-middleware');var basicAuth=require(_0x5c1d('0x6'));var crypto=require(_0x5c1d('0x7'));var BPromise=require(_0x5c1d('0x8'));var util=require(_0x5c1d('0x9'));var moment=require(_0x5c1d('0xa'));var validateJwt=expressJwt({'secret':config[_0x5c1d('0xb')][_0x5c1d('0xc')]});var userAttributes=['id',_0x5c1d('0xd'),_0x5c1d('0xe'),_0x5c1d('0xf'),_0x5c1d('0x10'),'email',_0x5c1d('0x11'),'permissions','md5secret',_0x5c1d('0x12'),_0x5c1d('0x13'),_0x5c1d('0x14'),_0x5c1d('0x15'),'smsPause',_0x5c1d('0x16'),_0x5c1d('0x17'),_0x5c1d('0x18'),_0x5c1d('0x19'),_0x5c1d('0x1a'),_0x5c1d('0x1b'),'allowmessenger',_0x5c1d('0x1c'),_0x5c1d('0x1d'),_0x5c1d('0x1e'),_0x5c1d('0x1f'),_0x5c1d('0x20'),_0x5c1d('0x21'),_0x5c1d('0x22'),_0x5c1d('0x23'),_0x5c1d('0x24'),_0x5c1d('0x25'),_0x5c1d('0x26'),_0x5c1d('0x27'),'hotdesk',_0x5c1d('0x28'),_0x5c1d('0x29'),_0x5c1d('0x2a'),_0x5c1d('0x2b'),_0x5c1d('0x2c'),'downloadVoiceRecordings','downloadOmnichannelInteractions',_0x5c1d('0x2d'),'ignorePauseForPreviewCalls',_0x5c1d('0x2e'),_0x5c1d('0x2f'),_0x5c1d('0x30'),'emailAutoanswer',_0x5c1d('0x31'),_0x5c1d('0x32'),_0x5c1d('0x33'),_0x5c1d('0x34'),'openchannelAutoanswerDelay',_0x5c1d('0x35'),_0x5c1d('0x36'),_0x5c1d('0x37'),_0x5c1d('0x38'),'messengerSoundNotification'];exports[_0x5c1d('0x39')]=function(){return this[_0x5c1d('0x3a')](!![])['use'](function(_0x157431,_0x1c474f,_0x4aae96){if(_0x157431[_0x5c1d('0x3b')]){_0x4aae96();}else{return db[_0x5c1d('0x3c')]['findOne']({'where':{'id':_0x157431[_0x5c1d('0x3d')]['id']},'attributes':['id',_0x5c1d('0x3e'),_0x5c1d('0x3f')],'raw':!![]})[_0x5c1d('0x40')](function(_0x400b33){if(_0x400b33&&_0x400b33['closed']&&!_0x157431[_0x5c1d('0x41')][_0x5c1d('0x42')]){return _0x1c474f[_0x5c1d('0x43')](_0x400b33[_0x5c1d('0x3f')]==='unmanaged'?0x195:0x193)[_0x5c1d('0x44')]({'message':_0x400b33[_0x5c1d('0x3f')]===_0x5c1d('0x45')?_0x5c1d('0x46'):_0x5c1d('0x47')});}else{_0x4aae96();}})['catch'](function(_0x426403){_0x4aae96(_0x426403);});}});};exports[_0x5c1d('0x3a')]=function isAuthenticated(_0x142b40){return compose()[_0x5c1d('0x48')](function(_0x1e6d97,_0x50de27,_0x5540e2){var _0x593d2e;if(_0x1e6d97['headers'][_0x5c1d('0x49')]){if(_[_0x5c1d('0x4a')](_0x1e6d97['headers'][_0x5c1d('0x49')],_0x5c1d('0x4b'))){var _0x49c645=basicAuth(_0x1e6d97);db[_0x5c1d('0x4c')][_0x5c1d('0x4d')]({'where':{'name':_0x49c645[_0x5c1d('0xf')]}})[_0x5c1d('0x40')](function(_0x1b85be){if(!_0x1b85be||!_0x1b85be['authenticate'](_0x49c645['pass'])){return _0x50de27['status'](0x191)['json']({'message':'Wrong\x20credentials.'});}_0x1e6d97['user']={'id':_0x1b85be['id']};_0x5540e2();})[_0x5c1d('0x4e')](function(_0x5bb087){_0x5540e2(_0x5bb087);});}else if(_[_0x5c1d('0x4a')](_0x1e6d97['headers'][_0x5c1d('0x49')],'Bearer')){validateJwt(_0x1e6d97,_0x50de27,_0x5540e2);}else{if(_0x142b40){_0x5540e2();}else{return _0x50de27[_0x5c1d('0x43')](0x193)[_0x5c1d('0x44')]({'message':_0x5c1d('0x4f')});}}}else if(_0x1e6d97[_0x5c1d('0x41')][_0x5c1d('0x50')]){try{var _0x117221={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x5c1d('0x51')]()};verifyJwt(_0x1e6d97[_0x5c1d('0x41')]['apikey'],_0x117221)['then'](function(_0x29e36c){return db['User'][_0x5c1d('0x4d')]({'where':{'id':_0x29e36c[_0x5c1d('0x52')]}})['then'](function(_0x24d008){_0x593d2e=_0x24d008;return db[_0x5c1d('0x53')]['findOne']({'where':{'id':0x1},'attributes':[_0x5c1d('0x54'),_0x5c1d('0x55')],'raw':!![]});})[_0x5c1d('0x40')](function(_0x54c524){if(!_0x593d2e||!_[_0x5c1d('0x56')](_0x593d2e[_0x5c1d('0x57')],_0x29e36c[_0x5c1d('0x58')])){return _0x50de27[_0x5c1d('0x43')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x593d2e[_0x5c1d('0x59')]){return _0x50de27[_0x5c1d('0x43')](0x191)[_0x5c1d('0x44')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x593d2e['blocked']){if(_0x54c524[_0x5c1d('0x55')]>0x0){if(moment(_0x593d2e[_0x5c1d('0x5a')])[_0x5c1d('0x5b')](_0x54c524[_0x5c1d('0x55')],_0x5c1d('0x5c'))>moment()){return _0x50de27[_0x5c1d('0x43')](0x191)[_0x5c1d('0x44')]({'message':_0x5c1d('0x5d')});}}else{return _0x50de27[_0x5c1d('0x43')](0x191)[_0x5c1d('0x44')]({'message':'Invalid\x20API\x20access\x20key'});}}_0x1e6d97['user']={'id':_0x593d2e['id']};_0x5540e2();});})[_0x5c1d('0x4e')](function(){return _0x50de27[_0x5c1d('0x43')](0x191)['json']({'message':_0x5c1d('0x5d')});});}catch(_0x3bd1d7){_0x5540e2(_0x3bd1d7);}}else if(_0x142b40){_0x5540e2();}else{return _0x50de27[_0x5c1d('0x43')](0x193)[_0x5c1d('0x44')]({'message':_0x5c1d('0x4f')});}})[_0x5c1d('0x48')](function(_0x1362f1,_0x4f97d9,_0x45ecc1){if(_0x1362f1[_0x5c1d('0x3b')]){db[_0x5c1d('0x4c')][_0x5c1d('0x4d')]({'where':{'id':_0x1362f1[_0x5c1d('0x3b')]['id']},'attributes':userAttributes})[_0x5c1d('0x40')](function(_0x50ed63){if(!_0x50ed63){return _0x4f97d9['status'](0x194)[_0x5c1d('0x44')]({'message':'User\x20not\x20found.'});}_0x1362f1[_0x5c1d('0x3b')]=_0x50ed63;_0x45ecc1();})[_0x5c1d('0x4e')](function(_0x179e0e){_0x45ecc1(_0x179e0e);});}else if(_0x142b40){_0x45ecc1();}else{return _0x4f97d9[_0x5c1d('0x43')](0x194)[_0x5c1d('0x44')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x5c1d('0x5e')]=function canUpdate(){return compose()[_0x5c1d('0x48')](function(_0x3d4790,_0x1e8c46,_0x4974ba){return licenseUtil[_0x5c1d('0x5f')]()[_0x5c1d('0x40')](function(_0x2b9c2c){if(_0x2b9c2c[_0x5c1d('0x60')]){_0x4974ba();}else{return _0x1e8c46[_0x5c1d('0x43')](0x193)[_0x5c1d('0x44')]({'message':'Forbidden'});}})[_0x5c1d('0x4e')](function(_0x52a463){_0x4974ba(_0x52a463);});});};exports[_0x5c1d('0x61')]=function isWebrtcLicence(){return compose()[_0x5c1d('0x48')](function(_0x49c6fe,_0x4ca9d7,_0x242f05){return licenseUtil[_0x5c1d('0x5f')]()[_0x5c1d('0x40')](function(_0x5b44b9){if(_0x5b44b9['webrtc']){_0x242f05();}else{return _0x4ca9d7[_0x5c1d('0x43')](0x193)[_0x5c1d('0x44')]({'message':'Forbidden'});}})[_0x5c1d('0x4e')](function(_0x336f2a){_0x242f05(_0x336f2a);});});};exports['isMiddleware']=function(_0x32995f,_0xd6b319,_0xeed2c){_0x32995f[_0x5c1d('0x62')]=!![];return _0xeed2c();};exports[_0x5c1d('0x63')]=function signToken(_0x1dfc8f){return signJwt(_0x1dfc8f);};exports[_0x5c1d('0x64')]=function(_0x148ba4,_0x28720a){if(!_0x148ba4[_0x5c1d('0x3b')]){return _0x28720a[_0x5c1d('0x43')](0x194)[_0x5c1d('0x44')]({'message':_0x5c1d('0x65')});}var _0x3d855a={'payload':{'id':_0x148ba4[_0x5c1d('0x3b')]['id'],'role':_0x148ba4[_0x5c1d('0x3b')][_0x5c1d('0xd')]},'options':{'expiresIn':0x15180}};return signJwt(_0x3d855a)['then'](function(_0x4fb66f){_0x28720a['cookie'](_0x5c1d('0x66'),_0x4fb66f);_0x28720a[_0x5c1d('0x67')](_0x5c1d('0x68'));})[_0x5c1d('0x4e')](function(_0x5ecb5a){return _0x28720a[_0x5c1d('0x43')](0x1f4)[_0x5c1d('0x69')](_0x5ecb5a);});};exports[_0x5c1d('0x6a')]=function(_0x15633c){if(_[_0x5c1d('0x6b')](_0x15633c[_0x5c1d('0x57')])||_[_0x5c1d('0x6b')](_0x15633c[_0x5c1d('0x6c')])){return null;}else{return createJwt(_0x15633c);}};exports[_0x5c1d('0x6d')]=function(_0x211bca){_0x211bca['apiKeyNonce']=generateNonce();_0x211bca[_0x5c1d('0x6c')]=generateIssuedAt();return createJwt(_0x211bca);};exports[_0x5c1d('0x6e')]=function(_0x5f167b,_0x26bed2){var _0x1f549e=_0x5f167b[_0x5c1d('0x41')]['apikey'];if(_0x1f549e){var _0x15f0b9={'nonce':_0x26bed2[_0x5c1d('0x57')],'iat':_0x26bed2[_0x5c1d('0x6c')],'audience':hardwareConf[_0x5c1d('0x51')](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x1f549e,_0x15f0b9)['then'](function(){return generateApiKey(_0x26bed2);});}else{throw{'message':_0x5c1d('0x6f')};}};exports[_0x5c1d('0x70')]=function(_0x655cd1){var _0xc43035=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0xc43035['test'](_0x655cd1))throw new db[(_0x5c1d('0x71'))][(_0x5c1d('0x72'))](_0x5c1d('0x73'));return;};exports[_0x5c1d('0x74')]=function(_0x18a198,_0x172a0f,_0xa366f1){var _0x25ade0=encryptor[_0x5c1d('0x75')](_0x172a0f)['split'](',');for(var _0x5bdfa6=0x0;_0x5bdfa6<_0xa366f1;_0x5bdfa6++){if(!_0x25ade0[_0x5bdfa6])break;if(_0x18a198[_0x5c1d('0x76')]()===_0x25ade0[_0x5bdfa6][_0x5c1d('0x76')]()){var _0x545e79=util[_0x5c1d('0x77')](_0x5c1d('0x78'),_0xa366f1);if(_0xa366f1===0x1){_0x545e79='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0x5c1d('0x71'))][(_0x5c1d('0x72'))](_0x545e79);}}return;};exports[_0x5c1d('0x79')]=function(_0xe65c1b,_0x163051){var _0x5ef8a2=_0x163051?encryptor[_0x5c1d('0x75')](_0x163051)[_0x5c1d('0x7a')](','):[];if(_0x5ef8a2[_0x5c1d('0x7b')]===0x5){_0x5ef8a2[_0x5c1d('0x7c')](-0x1,0x1);}_0x5ef8a2['unshift'](_0xe65c1b);return encryptor['encryptString'](_0x5ef8a2[_0x5c1d('0x7d')](','));};function signJwt(_0x1ee896){var _0x106bf8=BPromise['promisify'](jwt[_0x5c1d('0x7e')],{'context':jwt});var _0x36231f=_0x1ee896[_0x5c1d('0x7f')]||config['secrets'][_0x5c1d('0xc')];return new BPromise(function(_0x525a7d,_0x1a2f97){_0x106bf8(_0x1ee896[_0x5c1d('0x80')],_0x36231f,_0x1ee896[_0x5c1d('0x81')])[_0x5c1d('0x40')](function(_0x15405e){_0x525a7d(_0x15405e);})[_0x5c1d('0x4e')](function(_0x23b810){_0x1a2f97(_0x23b810);});});}function verifyJwt(_0x53de5e,_0x1b078f,_0x528427){var _0xae4213=BPromise[_0x5c1d('0x82')](jwt[_0x5c1d('0x83')],{'context':jwt});var _0x498668=_0x528427||config[_0x5c1d('0xb')]['session'];return new BPromise(function(_0x457e45,_0x451939){_0xae4213(_0x53de5e,_0x498668,_0x1b078f)[_0x5c1d('0x40')](function(_0x2f3fd7){_0x457e45(_0x2f3fd7);})[_0x5c1d('0x4e')](function(_0x14aea9){_0x451939(_0x14aea9);});});}function generateNonce(){return crypto[_0x5c1d('0x84')](0x10)[_0x5c1d('0x85')](_0x5c1d('0x86'));}function generateIssuedAt(){return Math[_0x5c1d('0x87')](Date[_0x5c1d('0x88')]()/0x3e8)[_0x5c1d('0x85')]();}function createJwt(_0x2e4f20){var _0x41af97={'payload':{'iat':_0x2e4f20[_0x5c1d('0x6c')],'nonce':_0x2e4f20[_0x5c1d('0x57')]},'options':{'algorithm':'HS512','subject':_0x2e4f20['id'][_0x5c1d('0x85')](),'issuer':hardwareConf[_0x5c1d('0x51')](),'audience':hardwareConf['getUuid']()}};return signJwt(_0x41af97)[_0x5c1d('0x40')](function(_0x5d01ed){return{'iat':_0x2e4f20[_0x5c1d('0x6c')],'nonce':_0x2e4f20[_0x5c1d('0x57')],'token':_0x5d01ed};});} \ No newline at end of file +var _0xb94a=['HS512','../../mysqldb','../../config/license/hardware','../../config/license/util','lodash','composable-middleware','crypto','bluebird','util','moment','secrets','role','fullname','internal','userpic','permissions','md5secret','chatPause','mailPause','smsPause','openchannelPause','pauseType','lastLoginAt','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','privacyEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','ignorePauseForPreviewCalls','chatAutoanswerDelay','emailAutoanswer','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isAuthenticated','use','ChatInteraction','findOne','closed','disposition','query','forceDownload','status','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','User','authenticate','json','user','Unknown\x20authorization\x20format','apikey','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','blocked','add','minutes','find','User\x20object\x20not\x20found.','canUpdate','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','Sequelize','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.','ValidationError','updatePasswordsHistory','length','splice','unshift','encryptString','join','sign','secret','session','options','promisify','hex','floor','toString'];(function(_0x2e5f9c,_0x134a52){var _0x538b44=function(_0x38ef13){while(--_0x38ef13){_0x2e5f9c['push'](_0x2e5f9c['shift']());}};_0x538b44(++_0x134a52);}(_0xb94a,0x84));var _0xab94=function(_0x17f5bf,_0x86d855){_0x17f5bf=_0x17f5bf-0x0;var _0x7db619=_0xb94a[_0x17f5bf];return _0x7db619;};'use strict';var db=require(_0xab94('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0xab94('0x1'));var licenseUtil=require(_0xab94('0x2'));var encryptor=require('../encryptor');var _=require(_0xab94('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require('express-jwt');var compose=require(_0xab94('0x4'));var basicAuth=require('basic-auth');var crypto=require(_0xab94('0x5'));var BPromise=require(_0xab94('0x6'));var util=require(_0xab94('0x7'));var moment=require(_0xab94('0x8'));var validateJwt=expressJwt({'secret':config[_0xab94('0x9')]['session']});var userAttributes=['id',_0xab94('0xa'),_0xab94('0xb'),'name',_0xab94('0xc'),'email',_0xab94('0xd'),_0xab94('0xe'),_0xab94('0xf'),'voicePause',_0xab94('0x10'),_0xab94('0x11'),'faxPause',_0xab94('0x12'),_0xab94('0x13'),_0xab94('0x14'),'showWebBar',_0xab94('0x15'),_0xab94('0x16'),_0xab94('0x17'),_0xab94('0x18'),_0xab94('0x19'),_0xab94('0x1a'),_0xab94('0x1b'),'phoneBarAutoAnswerDelay',_0xab94('0x1c'),_0xab94('0x1d'),_0xab94('0x1e'),_0xab94('0x1f'),_0xab94('0x20'),'phoneBarPrefixRequired',_0xab94('0x21'),_0xab94('0x22'),_0xab94('0x23'),_0xab94('0x24'),'userProfileId',_0xab94('0x25'),'settingsEnabled','wssPort',_0xab94('0x26'),_0xab94('0x27'),'downloadAttachments',_0xab94('0x28'),'selectRecallMeCampaign','chatAutoanswer',_0xab94('0x29'),_0xab94('0x2a'),'emailAutoanswerDelay',_0xab94('0x2b'),_0xab94('0x2c'),_0xab94('0x2d'),_0xab94('0x2e'),_0xab94('0x2f'),'faxAutoanswerDelay',_0xab94('0x30'),_0xab94('0x31'),'messengerSoundNotification'];exports['isChatInteractionAuthorized']=function(){return this[_0xab94('0x32')](!![])[_0xab94('0x33')](function(_0xd8982b,_0x643308,_0x55c2fb){if(_0xd8982b['user']){_0x55c2fb();}else{return db[_0xab94('0x34')][_0xab94('0x35')]({'where':{'id':_0xd8982b['params']['id']},'attributes':['id',_0xab94('0x36'),_0xab94('0x37')],'raw':!![]})['then'](function(_0xcb66db){if(_0xcb66db&&_0xcb66db[_0xab94('0x36')]&&!_0xd8982b[_0xab94('0x38')][_0xab94('0x39')]){return _0x643308[_0xab94('0x3a')](_0xcb66db[_0xab94('0x37')]===_0xab94('0x3b')?0x195:0x193)['json']({'message':_0xcb66db[_0xab94('0x37')]===_0xab94('0x3b')?_0xab94('0x3c'):_0xab94('0x3d')});}else{_0x55c2fb();}})[_0xab94('0x3e')](function(_0x8447b7){_0x55c2fb(_0x8447b7);});}});};exports[_0xab94('0x32')]=function isAuthenticated(_0x587bf5){return compose()[_0xab94('0x33')](function(_0x30f46a,_0x29d444,_0xb51e6c){var _0x212337;if(_0x30f46a['headers'][_0xab94('0x3f')]){if(_[_0xab94('0x40')](_0x30f46a[_0xab94('0x41')][_0xab94('0x3f')],'Basic')){var _0xecc468=basicAuth(_0x30f46a);db[_0xab94('0x42')]['find']({'where':{'name':_0xecc468['name']}})['then'](function(_0x9cadf5){if(!_0x9cadf5||!_0x9cadf5[_0xab94('0x43')](_0xecc468['pass'])){return _0x29d444[_0xab94('0x3a')](0x191)[_0xab94('0x44')]({'message':'Wrong\x20credentials.'});}_0x30f46a[_0xab94('0x45')]={'id':_0x9cadf5['id']};_0xb51e6c();})[_0xab94('0x3e')](function(_0x9b448d){_0xb51e6c(_0x9b448d);});}else if(_[_0xab94('0x40')](_0x30f46a[_0xab94('0x41')][_0xab94('0x3f')],'Bearer')){validateJwt(_0x30f46a,_0x29d444,_0xb51e6c);}else{if(_0x587bf5){_0xb51e6c();}else{return _0x29d444[_0xab94('0x3a')](0x193)[_0xab94('0x44')]({'message':_0xab94('0x46')});}}}else if(_0x30f46a['query'][_0xab94('0x47')]){try{var _0x109787={'audience':hardwareConf[_0xab94('0x48')](),'issuer':hardwareConf[_0xab94('0x48')]()};verifyJwt(_0x30f46a[_0xab94('0x38')][_0xab94('0x47')],_0x109787)[_0xab94('0x49')](function(_0x8e31ac){return db[_0xab94('0x42')]['find']({'where':{'id':_0x8e31ac[_0xab94('0x4a')]}})[_0xab94('0x49')](function(_0x17e992){_0x212337=_0x17e992;return db[_0xab94('0x4b')][_0xab94('0x35')]({'where':{'id':0x1},'attributes':[_0xab94('0x4c'),_0xab94('0x4d')],'raw':!![]});})[_0xab94('0x49')](function(_0x195bde){if(!_0x212337||!_[_0xab94('0x4e')](_0x212337[_0xab94('0x4f')],_0x8e31ac['nonce'])){return _0x29d444[_0xab94('0x3a')](0x191)[_0xab94('0x44')]({'message':_0xab94('0x50')});}if(_0x212337['disabled']){return _0x29d444[_0xab94('0x3a')](0x191)[_0xab94('0x44')]({'message':_0xab94('0x51')});}if(_0x212337[_0xab94('0x52')]){if(_0x195bde['blockDuration']>0x0){if(moment(_0x212337['blockedAt'])[_0xab94('0x53')](_0x195bde[_0xab94('0x4d')],_0xab94('0x54'))>moment()){return _0x29d444[_0xab94('0x3a')](0x191)[_0xab94('0x44')]({'message':_0xab94('0x51')});}}else{return _0x29d444['status'](0x191)['json']({'message':_0xab94('0x51')});}}_0x30f46a[_0xab94('0x45')]={'id':_0x212337['id']};_0xb51e6c();});})['catch'](function(){return _0x29d444[_0xab94('0x3a')](0x191)[_0xab94('0x44')]({'message':_0xab94('0x51')});});}catch(_0x25e4fe){_0xb51e6c(_0x25e4fe);}}else if(_0x587bf5){_0xb51e6c();}else{return _0x29d444[_0xab94('0x3a')](0x193)[_0xab94('0x44')]({'message':'Unknown\x20authorization\x20format'});}})[_0xab94('0x33')](function(_0x6ff918,_0x4bd25e,_0x55800e){if(_0x6ff918[_0xab94('0x45')]){db[_0xab94('0x42')][_0xab94('0x55')]({'where':{'id':_0x6ff918['user']['id']},'attributes':userAttributes})[_0xab94('0x49')](function(_0x2dd14c){if(!_0x2dd14c){return _0x4bd25e[_0xab94('0x3a')](0x194)['json']({'message':'User\x20not\x20found.'});}_0x6ff918['user']=_0x2dd14c;_0x55800e();})['catch'](function(_0x437cf6){_0x55800e(_0x437cf6);});}else if(_0x587bf5){_0x55800e();}else{return _0x4bd25e['status'](0x194)[_0xab94('0x44')]({'message':_0xab94('0x56')});}});};exports[_0xab94('0x57')]=function canUpdate(){return compose()[_0xab94('0x33')](function(_0x2ae1c0,_0x5dd920,_0x10f17c){return licenseUtil[_0xab94('0x58')]()[_0xab94('0x49')](function(_0x530f06){if(_0x530f06[_0xab94('0x59')]){_0x10f17c();}else{return _0x5dd920['status'](0x193)[_0xab94('0x44')]({'message':_0xab94('0x5a')});}})[_0xab94('0x3e')](function(_0x84bec6){_0x10f17c(_0x84bec6);});});};exports[_0xab94('0x5b')]=function isWebrtcLicence(){return compose()[_0xab94('0x33')](function(_0x4ab9f4,_0x4109d4,_0x490711){return licenseUtil[_0xab94('0x58')]()[_0xab94('0x49')](function(_0x1cbe61){if(_0x1cbe61[_0xab94('0x5c')]){_0x490711();}else{return _0x4109d4[_0xab94('0x3a')](0x193)['json']({'message':_0xab94('0x5a')});}})[_0xab94('0x3e')](function(_0x201383){_0x490711(_0x201383);});});};exports[_0xab94('0x5d')]=function(_0x2e1545,_0x22fe52,_0x454ede){_0x2e1545[_0xab94('0x5d')]=!![];return _0x454ede();};exports[_0xab94('0x5e')]=function signToken(_0x4abd7d){return signJwt(_0x4abd7d);};exports[_0xab94('0x5f')]=function(_0x24a31e,_0x10b6ee){if(!_0x24a31e['user']){return _0x10b6ee[_0xab94('0x3a')](0x194)[_0xab94('0x44')]({'message':_0xab94('0x60')});}var _0x9fe09d={'payload':{'id':_0x24a31e[_0xab94('0x45')]['id'],'role':_0x24a31e[_0xab94('0x45')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x9fe09d)[_0xab94('0x49')](function(_0x49b598){_0x10b6ee[_0xab94('0x61')](_0xab94('0x62'),_0x49b598);_0x10b6ee[_0xab94('0x63')](_0xab94('0x64'));})[_0xab94('0x3e')](function(_0x2d5f59){return _0x10b6ee[_0xab94('0x3a')](0x1f4)[_0xab94('0x65')](_0x2d5f59);});};exports[_0xab94('0x66')]=function(_0x5f56b4){if(_[_0xab94('0x67')](_0x5f56b4['apiKeyNonce'])||_[_0xab94('0x67')](_0x5f56b4[_0xab94('0x68')])){return null;}else{return createJwt(_0x5f56b4);}};exports[_0xab94('0x69')]=function(_0x1145c6){_0x1145c6[_0xab94('0x4f')]=generateNonce();_0x1145c6[_0xab94('0x68')]=generateIssuedAt();return createJwt(_0x1145c6);};exports[_0xab94('0x6a')]=function(_0x3a3e73,_0x2c0a86){var _0x40f2ce=_0x3a3e73[_0xab94('0x38')][_0xab94('0x47')];if(_0x40f2ce){var _0xdcabd3={'nonce':_0x2c0a86[_0xab94('0x4f')],'iat':_0x2c0a86['apiKeyIat'],'audience':hardwareConf[_0xab94('0x48')](),'issuer':hardwareConf[_0xab94('0x48')]()};return verifyJwt(_0x40f2ce,_0xdcabd3)[_0xab94('0x49')](function(){return generateApiKey(_0x2c0a86);});}else{throw{'message':_0xab94('0x6b')};}};exports[_0xab94('0x6c')]=function(_0x10330f){var _0x52b156=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x52b156['test'](_0x10330f))throw new db[(_0xab94('0x6d'))]['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~!@#$%^&-_=+[{]}.');return;};exports[_0xab94('0x6e')]=function(_0x4fec06,_0x38fa63,_0xa96aac){var _0x23873f=encryptor[_0xab94('0x6f')](_0x38fa63)['split'](',');for(var _0x3dadeb=0x0;_0x3dadeb<_0xa96aac;_0x3dadeb++){if(!_0x23873f[_0x3dadeb])break;if(_0x4fec06[_0xab94('0x70')]()===_0x23873f[_0x3dadeb][_0xab94('0x70')]()){var _0x338b82=util['format'](_0xab94('0x71'),_0xa96aac);if(_0xa96aac===0x1){_0x338b82=_0xab94('0x72');}throw new db[(_0xab94('0x6d'))][(_0xab94('0x73'))](_0x338b82);}}return;};exports[_0xab94('0x74')]=function(_0x45d056,_0x4ab4c0){var _0x23513a=_0x4ab4c0?encryptor[_0xab94('0x6f')](_0x4ab4c0)['split'](','):[];if(_0x23513a[_0xab94('0x75')]===0x5){_0x23513a[_0xab94('0x76')](-0x1,0x1);}_0x23513a[_0xab94('0x77')](_0x45d056);return encryptor[_0xab94('0x78')](_0x23513a[_0xab94('0x79')](','));};function signJwt(_0xd2086c){var _0x3a17b5=BPromise['promisify'](jwt[_0xab94('0x7a')],{'context':jwt});var _0x53b887=_0xd2086c[_0xab94('0x7b')]||config[_0xab94('0x9')][_0xab94('0x7c')];return new BPromise(function(_0x51a18b,_0x8b716c){_0x3a17b5(_0xd2086c['payload'],_0x53b887,_0xd2086c[_0xab94('0x7d')])[_0xab94('0x49')](function(_0x1939e9){_0x51a18b(_0x1939e9);})['catch'](function(_0x58f991){_0x8b716c(_0x58f991);});});}function verifyJwt(_0x5d8e1e,_0x399286,_0x4a17ab){var _0xb57911=BPromise[_0xab94('0x7e')](jwt['verify'],{'context':jwt});var _0x2b48de=_0x4a17ab||config[_0xab94('0x9')][_0xab94('0x7c')];return new BPromise(function(_0x291f2c,_0x4389e0){_0xb57911(_0x5d8e1e,_0x2b48de,_0x399286)[_0xab94('0x49')](function(_0x3a0411){_0x291f2c(_0x3a0411);})[_0xab94('0x3e')](function(_0x5004a3){_0x4389e0(_0x5004a3);});});}function generateNonce(){return crypto['randomBytes'](0x10)['toString'](_0xab94('0x7f'));}function generateIssuedAt(){return Math[_0xab94('0x80')](Date['now']()/0x3e8)[_0xab94('0x81')]();}function createJwt(_0x97cd86){var _0x219b21={'payload':{'iat':_0x97cd86[_0xab94('0x68')],'nonce':_0x97cd86['apiKeyNonce']},'options':{'algorithm':_0xab94('0x82'),'subject':_0x97cd86['id'][_0xab94('0x81')](),'issuer':hardwareConf[_0xab94('0x48')](),'audience':hardwareConf[_0xab94('0x48')]()}};return signJwt(_0x219b21)[_0xab94('0x49')](function(_0x329129){return{'iat':_0x97cd86['apiKeyIat'],'nonce':_0x97cd86[_0xab94('0x4f')],'token':_0x329129};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 9909739..476cac5 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8153=['count','User','rows','catch','describe','CmContact','keys','startsWith','map','CmCustomField','findOne','slice','all','length','type','lodash','./sql-utils','../../mysqldb','skipContactsQuery','resolve','then','parseAdvancedSearchFilter','parseQueryParameters','default','where','fields','filter','clause','tags','user','skip','checkListsRestrictions','search','tag','countFilteredContacts'];(function(_0xc7eafd,_0x551802){var _0x3444bb=function(_0x2ea4e2){while(--_0x2ea4e2){_0xc7eafd['push'](_0xc7eafd['shift']());}};_0x3444bb(++_0x551802);}(_0x8153,0x9b));var _0x3815=function(_0x3d2db3,_0x5c1785){_0x3d2db3=_0x3d2db3-0x0;var _0x342149=_0x8153[_0x3d2db3];return _0x342149;};'use strict';var _=require(_0x3815('0x0'));var sqlUtils=require(_0x3815('0x1'));var db=require(_0x3815('0x2'))['db'];exports['findAll']=function(_0x26f029,_0x45017a,_0x3ecbca,_0x3af5ad){var _0x1625e6={'count':0x0,'rows':[]};var _0x42881f=sqlUtils[_0x3815('0x3')](_0x45017a,_0x26f029);if(_0x42881f){return Promise[_0x3815('0x4')](_0x1625e6);}var _0x150a30=sqlUtils['getContactsSubquery']();var _0x12abde={};var _0x1b8309=![];var _0x5b4439=![];return Promise['resolve']()[_0x3815('0x5')](function(){if(_0x26f029['search']){return sqlUtils[_0x3815('0x6')](_0x26f029['search'],_0x3af5ad);}else{return sqlUtils[_0x3815('0x7')](_0x26f029,_0x3af5ad);}})['then'](function(_0x174d70){_0x150a30['where'](_0x174d70[_0x3815('0x8')]);_0x150a30[_0x3815('0x9')](_0x174d70[_0x3815('0xa')]);_0x150a30['where'](_0x174d70[_0x3815('0xb')]);_0x150a30[_0x3815('0x9')](_0x174d70['user'][_0x3815('0xc')]);_0x12abde=_0x174d70[_0x3815('0xd')];_0x5b4439=_0x174d70[_0x3815('0xe')][_0x3815('0xf')];return sqlUtils[_0x3815('0x10')](_0x45017a,_0x26f029,_0x5b4439);})[_0x3815('0x5')](function(_0x7ec5aa){_0x150a30[_0x3815('0x9')](_0x7ec5aa);var _0x56ef4d=_0x26f029[_0x3815('0x11')]?_0x12abde['ids']:_0x26f029[_0x3815('0x12')];_0x1b8309=_0x56ef4d?!![]:![];return sqlUtils[_0x3815('0x13')](_0x150a30,_0x56ef4d);})['then'](function(_0x540d5a){_0x1625e6['count']=_0x540d5a;if(_0x1625e6[_0x3815('0x14')]===0x0){return;}if(_0x26f029[_0x3815('0x15')]){_0x5b4439=!![];}return sqlUtils['buildContactsQuery'](_0x150a30,_0x26f029[_0x3815('0xa')],_0x3ecbca,_0x1b8309,_0x12abde[_0x3815('0xc')],_0x5b4439);})[_0x3815('0x5')](function(_0x5e433f){if(!_0x5e433f){return[];}return sqlUtils['getFilteredContacts'](_0x5e433f,_0x26f029,_0x3ecbca);})['then'](function(_0x5bd730){_0x1625e6[_0x3815('0x16')]=_0x5bd730;return _0x1625e6;})[_0x3815('0x17')](function(_0x224232){throw _0x224232;});};exports[_0x3815('0x18')]=function(){var _0x358a81={};var _0x2603cc=[];return db[_0x3815('0x19')][_0x3815('0x18')]()[_0x3815('0x5')](function(_0xb54095){_0x358a81=_0xb54095;var _0x4caef4=Object[_0x3815('0x1a')](_0x358a81)['filter'](function(_0x24706f){return _[_0x3815('0x1b')](_0x24706f,'cf_')?_0x24706f:undefined;});var _0x1a719b=_0x4caef4[_0x3815('0x1c')](function(_0x4c622c){return db[_0x3815('0x1d')][_0x3815('0x1e')]({'where':{'id':_0x4c622c[_0x3815('0x1f')](0x3)},'raw':!![]});});return Promise[_0x3815('0x20')](_0x1a719b);})[_0x3815('0x5')](function(_0x1714c4){for(var _0xfda2bf=0x0;_0xfda2bf<_0x1714c4[_0x3815('0x21')];_0xfda2bf++){if(_0x1714c4[_0xfda2bf]){var _0x1dc313='cf_'+_0x1714c4[_0xfda2bf]['id'];_0x358a81[_0x1dc313]['fieldType']=_0x1714c4[_0xfda2bf][_0x3815('0x22')];}}_0x2603cc=_[_0x3815('0x1c')](Object['keys'](_0x358a81),function(_0xce1613){return{'name':_0xce1613,'type':_0x358a81[_0xce1613][_0x3815('0x22')]};});return _0x2603cc;})[_0x3815('0x17')](function(_0x21a051){throw _0x21a051;});}; \ No newline at end of file +var _0xf45d=['countFilteredContacts','count','buildContactsQuery','fields','getFilteredContacts','rows','catch','describe','CmContact','keys','cf_','map','CmCustomField','findOne','slice','all','fieldType','type','lodash','./sql-utils','findAll','skipContactsQuery','resolve','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','clause','tags','user','skip','checkListsRestrictions','ids','tag'];(function(_0x3e130f,_0x309c01){var _0xf4d530=function(_0x355a96){while(--_0x355a96){_0x3e130f['push'](_0x3e130f['shift']());}};_0xf4d530(++_0x309c01);}(_0xf45d,0xc1));var _0xdf45=function(_0x36eda4,_0x433f22){_0x36eda4=_0x36eda4-0x0;var _0x54957d=_0xf45d[_0x36eda4];return _0x54957d;};'use strict';var _=require(_0xdf45('0x0'));var sqlUtils=require(_0xdf45('0x1'));var db=require('../../mysqldb')['db'];exports[_0xdf45('0x2')]=function(_0x297ad5,_0x1322bf,_0x115567,_0x10582c){var _0x43e1de={'count':0x0,'rows':[]};var _0x5c8d40=sqlUtils[_0xdf45('0x3')](_0x1322bf,_0x297ad5);if(_0x5c8d40){return Promise['resolve'](_0x43e1de);}var _0x2db96a=sqlUtils['getContactsSubquery']();var _0x109a76={};var _0x5d364c=![];var _0x32ceb5=![];return Promise[_0xdf45('0x4')]()[_0xdf45('0x5')](function(){if(_0x297ad5[_0xdf45('0x6')]){return sqlUtils[_0xdf45('0x7')](_0x297ad5[_0xdf45('0x6')],_0x10582c);}else{return sqlUtils[_0xdf45('0x8')](_0x297ad5,_0x10582c);}})['then'](function(_0x530e13){_0x2db96a[_0xdf45('0x9')](_0x530e13['default']);_0x2db96a['where'](_0x530e13['fields']);_0x2db96a['where'](_0x530e13['filter']);_0x2db96a[_0xdf45('0x9')](_0x530e13['user'][_0xdf45('0xa')]);_0x109a76=_0x530e13[_0xdf45('0xb')];_0x32ceb5=_0x530e13[_0xdf45('0xc')][_0xdf45('0xd')];return sqlUtils[_0xdf45('0xe')](_0x1322bf,_0x297ad5,_0x32ceb5);})[_0xdf45('0x5')](function(_0x34fcb7){_0x2db96a[_0xdf45('0x9')](_0x34fcb7);var _0x2ef9de=_0x297ad5[_0xdf45('0x6')]?_0x109a76[_0xdf45('0xf')]:_0x297ad5[_0xdf45('0x10')];_0x5d364c=_0x2ef9de?!![]:![];return sqlUtils[_0xdf45('0x11')](_0x2db96a,_0x2ef9de);})[_0xdf45('0x5')](function(_0x223721){_0x43e1de[_0xdf45('0x12')]=_0x223721;if(_0x43e1de[_0xdf45('0x12')]===0x0){return;}if(_0x297ad5['User']){_0x32ceb5=!![];}return sqlUtils[_0xdf45('0x13')](_0x2db96a,_0x297ad5[_0xdf45('0x14')],_0x115567,_0x5d364c,_0x109a76['clause'],_0x32ceb5);})['then'](function(_0x23116d){if(!_0x23116d){return[];}return sqlUtils[_0xdf45('0x15')](_0x23116d,_0x297ad5,_0x115567);})[_0xdf45('0x5')](function(_0x1c17a2){_0x43e1de[_0xdf45('0x16')]=_0x1c17a2;return _0x43e1de;})[_0xdf45('0x17')](function(_0x367c6d){throw _0x367c6d;});};exports[_0xdf45('0x18')]=function(){var _0x3ca5b6={};var _0x174466=[];return db[_0xdf45('0x19')]['describe']()[_0xdf45('0x5')](function(_0x3b6237){_0x3ca5b6=_0x3b6237;var _0x102da7=Object[_0xdf45('0x1a')](_0x3ca5b6)['filter'](function(_0x450bae){return _['startsWith'](_0x450bae,_0xdf45('0x1b'))?_0x450bae:undefined;});var _0x14c72d=_0x102da7[_0xdf45('0x1c')](function(_0x35de9f){return db[_0xdf45('0x1d')][_0xdf45('0x1e')]({'where':{'id':_0x35de9f[_0xdf45('0x1f')](0x3)},'raw':!![]});});return Promise[_0xdf45('0x20')](_0x14c72d);})['then'](function(_0x4dddaf){for(var _0x4c4076=0x0;_0x4c4076<_0x4dddaf['length'];_0x4c4076++){if(_0x4dddaf[_0x4c4076]){var _0x528dee=_0xdf45('0x1b')+_0x4dddaf[_0x4c4076]['id'];_0x3ca5b6[_0x528dee][_0xdf45('0x21')]=_0x4dddaf[_0x4c4076]['type'];}}_0x174466=_[_0xdf45('0x1c')](Object['keys'](_0x3ca5b6),function(_0x3cd39f){return{'name':_0x3cd39f,'type':_0x3ca5b6[_0x3cd39f][_0xdf45('0x22')]};});return _0x174466;})[_0xdf45('0x17')](function(_0x4b8fde){throw _0x4b8fde;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index ff3da4c..7537ce9 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xba29=['expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.lastName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','find','name','dateOfBirth','fieldType','DATE','buildExpression','type','default','text','value','start','end','Tag','map','tags','clause','and','ids','User','user','skip','keys','some','compact','Contact','push','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','uc.UserId\x20=\x20?','then','fields','resolve','search','getLists','attributes','group','c.id','limit','offset','order','DESC','from','findAll','color','Sequelize','CmContact','sequelize','query','toString','Tags','clone','isEmpty','t.id\x20IN\x20?','QueryTypes','SELECT','COUNT(*)','exports','lodash','squel','../parsers/advancedSearch','../../mysqldb','role','agent','ListId','autocomplete','select','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','uc.CmContactId\x20=\x20','ct.CmContactId\x20=\x20','.id','tools_tags','t.id\x20=\x20ct.TagId','mobile','fax','CompanyId','createdAt','deletedAt','TagIds','includes','forEach','GROUP_CONCAT(DISTINCT\x20t.id)','field'];(function(_0x2b77ab,_0x1ebb5a){var _0x3499b0=function(_0x298bf8){while(--_0x298bf8){_0x2b77ab['push'](_0x2b77ab['shift']());}};_0x3499b0(++_0x1ebb5a);}(_0xba29,0x118));var _0x9ba2=function(_0x3d2ef4,_0x39ed4e){_0x3d2ef4=_0x3d2ef4-0x0;var _0x98028f=_0xba29[_0x3d2ef4];return _0x98028f;};'use strict';var _=require(_0x9ba2('0x0'));var squel=require(_0x9ba2('0x1'));var as=require(_0x9ba2('0x2'));var qs=require('../parsers/qs');var utils=require('../interaction/utils');var db=require(_0x9ba2('0x3'))['db'];function skipContactsQuery(_0x4ce81a,_0x3d28ff){var _0x1ebc21=![];if(_0x4ce81a[_0x9ba2('0x4')]===_0x9ba2('0x5')&&!_0x3d28ff['search']&&!_0x3d28ff[_0x9ba2('0x6')]&&_0x3d28ff[_0x9ba2('0x7')]!=='true'){_0x1ebc21=!![];}return _0x1ebc21;}function getContactsSubquery(){return squel[_0x9ba2('0x8')]()['from'](_0x9ba2('0x9'),'c')[_0x9ba2('0xa')](_0x9ba2('0xb'));}function applyJoinClauses(_0x19bee2,_0x54aa5d){var _0x599fe1=_0x54aa5d?'c':_0x9ba2('0xc');_0x19bee2[_0x9ba2('0xd')]('cm_user_has_contacts','uc',_0x9ba2('0xe')+_0x599fe1+'.id')[_0x9ba2('0xd')]('cm_contact_has_tags','ct',_0x9ba2('0xf')+_0x599fe1+_0x9ba2('0x10'))[_0x9ba2('0xd')](_0x9ba2('0x11'),'t',_0x9ba2('0x12'));return _0x19bee2;}function addFieldsToQuery(_0x401b96,_0x4ab41a,_0x5ae381,_0xf77599,_0x4265dc){var _0x4e967d=_0x4265dc?'c':'subqry';if(!_0x4ab41a){_0x4ab41a=['id','firstName','lastName','phone',_0x9ba2('0x13'),_0x9ba2('0x14'),'email',_0x9ba2('0x6'),_0x9ba2('0x15'),_0x9ba2('0x16'),'updatedAt',_0x9ba2('0x17'),_0x9ba2('0x18')];}else if(!_0x4ab41a[_0x9ba2('0x19')]('id')){_0x4ab41a['push']('id');}var _0x18d46d=_0x5ae381&&_0x4265dc||!_0x5ae381&&!_0x4265dc;if(_0xf77599){_0x18d46d=_0xf77599&&_0x4265dc||!_0xf77599&&!_0x4265dc;}_0x4ab41a[_0x9ba2('0x1a')](function(_0x4b2b6c){if(_0x4b2b6c==='TagIds'){if(_0x18d46d){_0x401b96['field'](_0x9ba2('0x1b'),_0x4b2b6c);}else if(_0x5ae381||_0xf77599){_0x401b96[_0x9ba2('0x1c')](_0x4e967d+'.'+_0x4b2b6c);}}else{_0x401b96[_0x9ba2('0x1c')](_0x4e967d+'.'+_0x4b2b6c);}});return _0x401b96;}function getSqlClauses(){var _0x5ba653={'default':squel[_0x9ba2('0x1d')](),'fields':squel['expr'](),'filter':squel[_0x9ba2('0x1d')](),'tags':{'clause':squel[_0x9ba2('0x1d')](),'ids':null},'user':{'clause':squel[_0x9ba2('0x1d')](),'skip':![]}};return _0x5ba653;}function parseTagParameter(_0xa60c2c){var _0x2e126e=squel[_0x9ba2('0x1d')]();if(_0xa60c2c){var _0x1303d1=utils[_0x9ba2('0x1e')](_0xa60c2c);_0x1303d1[_0x9ba2('0x1a')](function(_0x367021){_0x2e126e['or'](_0x9ba2('0x1f'),'%,'+_0x367021+',%');});}return _0x2e126e;}function parseSearchFilter(_0x27fd53){var _0x39d4a8=squel[_0x9ba2('0x1d')]();if(_0x27fd53){var _0x4a4cd7=_0x27fd53['replace']('\x5c','\x5c\x5c')[_0x9ba2('0x20')](/'/g,'\x27\x27');if(_0x4a4cd7[_0x9ba2('0x21')]('\x20')[_0x9ba2('0x22')]>0x1){_0x39d4a8['or'](_0x9ba2('0x23'),qs[_0x9ba2('0x24')](_0x4a4cd7,!![]),null);}else{if(qs[_0x9ba2('0x25')](_0x4a4cd7)){_0x39d4a8['or'](_0x9ba2('0x26'),_0x4a4cd7+'%');_0x39d4a8['or']('c.phone\x20LIKE\x20?',_0x4a4cd7+'%');_0x39d4a8['or'](_0x9ba2('0x27'),_0x4a4cd7+'%');_0x39d4a8['or'](_0x9ba2('0x28'),_0x4a4cd7+'%');}else if(qs['isEmail'](_0x4a4cd7)){_0x39d4a8['or']('c.email\x20LIKE\x20?',_0x4a4cd7+'%');}else{_0x39d4a8['or']('c.firstName\x20LIKE\x20?','%'+_0x4a4cd7+'%');_0x39d4a8['or'](_0x9ba2('0x29'),'%'+_0x4a4cd7+'%');_0x39d4a8['or']('c.email\x20LIKE\x20?','%'+_0x4a4cd7+'%');}}}return _0x39d4a8;}function parseAdvancedSearchFilter(_0x4e0378,_0x2d8a6c){var _0x5ec750=getSqlClauses();var _0x594004=as[_0x9ba2('0x2a')](_0x4e0378);var _0x4ddbd2=_0x594004[_0x9ba2('0x2b')];for(var _0x4f8b73=0x0;_0x4f8b73<_0x594004[_0x9ba2('0x2c')][_0x9ba2('0x22')];_0x4f8b73++){var _0x3a216a=_0x594004[_0x9ba2('0x2c')][_0x4f8b73];var _0x20dae4='c';var _0x3dbf30=_[_0x9ba2('0x2d')](_0x2d8a6c,[_0x9ba2('0x2e'),_0x3a216a['field']]);if(_0x3dbf30){if(_0x3a216a['field']===_0x9ba2('0x2f')||_0x3dbf30[_0x9ba2('0x30')]==='datetime'){_0x3a216a['castTo']=_0x9ba2('0x31');}var _0x56f01c=as[_0x9ba2('0x32')](_0x20dae4,_0x3dbf30[_0x9ba2('0x33')],_0x3a216a);_0x5ec750[_0x9ba2('0x34')][_0x4ddbd2](_0x56f01c[_0x9ba2('0x35')],_0x56f01c[_0x9ba2('0x36')][_0x9ba2('0x37')],_0x56f01c['value'][_0x9ba2('0x38')]);}else{if(_0x3a216a[_0x9ba2('0x1c')]===_0x9ba2('0x39')){var _0x5d8f5f=_0x3a216a[_0x9ba2('0x36')]['split'](',')[_0x9ba2('0x3a')](function(_0x1347a9){return Number(_0x1347a9);});var _0x2c144a=parseTagParameter(_0x5d8f5f);_0x5ec750[_0x9ba2('0x3b')][_0x9ba2('0x3c')][_0x9ba2('0x3d')](_0x2c144a);_0x5ec750[_0x9ba2('0x3b')][_0x9ba2('0x3e')]=_0x5d8f5f;}else if(_0x3a216a[_0x9ba2('0x1c')]===_0x9ba2('0x3f')){_0x5ec750[_0x9ba2('0x40')][_0x9ba2('0x3c')][_0x9ba2('0x3d')]('uc.UserId\x20=\x20?',_0x3a216a[_0x9ba2('0x36')]);_0x5ec750[_0x9ba2('0x40')][_0x9ba2('0x41')]=!![];}}}return _0x5ec750;}function parseModelFields(_0x429a67,_0x5b1a75){var _0xc18b7d=squel[_0x9ba2('0x1d')]();var _0x5c5966=_(_0x429a67)[_0x9ba2('0x42')]()[_0x9ba2('0x3a')](function(_0x1fae5e){return _[_0x9ba2('0x43')](_0x5b1a75,[_0x9ba2('0x2e'),_0x1fae5e])?_0x1fae5e:undefined;})[_0x9ba2('0x44')]()[_0x9ba2('0x36')]();if(_0x429a67[_0x9ba2('0x45')]){_0x5c5966['push'](_0x9ba2('0x45'));}if(_0x429a67[_0x9ba2('0x3f')]){_0x5c5966[_0x9ba2('0x46')](_0x9ba2('0x3f'));}if(_0x5c5966[_0x9ba2('0x22')]>0x0){_0x5c5966['forEach'](function(_0x43a025){if(_0x43a025===_0x9ba2('0x6')){_0xc18b7d[_0x9ba2('0x3d')](_0x9ba2('0x47'),[][_0x9ba2('0x48')](_0x429a67[_0x43a025]));}else if(_0x43a025===_0x9ba2('0x45')){var _0x4e1a5c='%'+_0x429a67[_0x43a025]+'%';_0xc18b7d['and'](_0x9ba2('0x49'),_0x4e1a5c);}else if(_0x43a025===_0x9ba2('0x3f')){_0xc18b7d[_0x9ba2('0x3d')](_0x9ba2('0x4a'),_0x429a67[_0x43a025]);}else{_0xc18b7d[_0x9ba2('0x3d')]('c.'+_0x43a025+'\x20=\x20?',_0x429a67[_0x43a025]);}});}return _0xc18b7d;}function parseQueryParameters(_0x3b4a9e,_0x195cbf){var _0x96cebd=getSqlClauses();return Promise['resolve']()[_0x9ba2('0x4b')](function(){return parseModelFields(_0x3b4a9e,_0x195cbf);})[_0x9ba2('0x4b')](function(_0x53475b){_0x96cebd[_0x9ba2('0x4c')][_0x9ba2('0x3d')](_0x53475b);return parseTagParameter(_0x3b4a9e['tag']);})[_0x9ba2('0x4b')](function(_0x581dcd){_0x96cebd[_0x9ba2('0x3b')][_0x9ba2('0x3c')][_0x9ba2('0x3d')](_0x581dcd);return parseSearchFilter(_0x3b4a9e['filter']);})[_0x9ba2('0x4b')](function(_0x530233){_0x96cebd['filter']=_0x530233;return _0x96cebd;});}function checkListsRestrictions(_0x5c8bf9,_0x5be0ae,_0x5dc17d){var _0x6913ac=squel[_0x9ba2('0x1d')]();return Promise[_0x9ba2('0x4d')]()[_0x9ba2('0x4b')](function(){if(_0x5be0ae[_0x9ba2('0x4e')]&&_0x5c8bf9[_0x9ba2('0x4')]===_0x9ba2('0x5')&&!_0x5dc17d){return _0x5c8bf9[_0x9ba2('0x4f')]({'attributes':['id'],'raw':!![]});}})[_0x9ba2('0x4b')](function(_0x3c112e){if(_0x3c112e){if(_0x3c112e['length']===0x0){_0x6913ac[_0x9ba2('0x3d')]('c.ListId\x20IS\x20NULL');}else{_0x6913ac[_0x9ba2('0x3d')]('c.ListId\x20IN\x20?',_[_0x9ba2('0x3a')](_0x3c112e,'id'));}}})[_0x9ba2('0x4b')](function(){return _0x6913ac;});}function buildContactsQuery(_0x3adb40,_0x1e65b2,_0x33a945,_0x424212,_0x40a113,_0x3980bf){if(_0x1e65b2){_0x1e65b2=_0x33a945[_0x9ba2('0x50')];}_0x3adb40=addFieldsToQuery(_0x3adb40,_0x1e65b2,_0x424212,_0x3980bf,!![]);var _0x2c12be=squel['select']();_0x2c12be=addFieldsToQuery(_0x2c12be,_0x1e65b2,_0x424212,_0x3980bf,![]);if(_0x424212||_0x3980bf){_0x3adb40=applyJoinClauses(_0x3adb40,!![]);_0x3adb40[_0x9ba2('0x51')](_0x9ba2('0x52'));if(_0x33a945[_0x9ba2('0x53')]){_0x2c12be['limit'](_0x33a945[_0x9ba2('0x53')]);}if(_0x33a945[_0x9ba2('0x54')]){_0x2c12be[_0x9ba2('0x54')](_0x33a945['offset']);}}else{_0x2c12be=applyJoinClauses(_0x2c12be,![]);_0x2c12be[_0x9ba2('0x51')]('subqry.id');if(_0x33a945[_0x9ba2('0x53')]){_0x3adb40[_0x9ba2('0x53')](_0x33a945[_0x9ba2('0x53')]);}if(_0x33a945[_0x9ba2('0x54')]){_0x3adb40[_0x9ba2('0x54')](_0x33a945[_0x9ba2('0x54')]);}}_0x2c12be['having'](_0x40a113);if(_0x33a945[_0x9ba2('0x55')]){_0x33a945['order'][_0x9ba2('0x1a')](function(_0x350cf4){_0x3adb40[_0x9ba2('0x55')]('c.'+_0x350cf4[0x0],_0x350cf4[0x1]===_0x9ba2('0x56')?![]:!![]);_0x2c12be['order']('subqry.'+_0x350cf4[0x0],_0x350cf4[0x1]===_0x9ba2('0x56')?![]:!![]);});}_0x2c12be[_0x9ba2('0x57')](_0x3adb40,'subqry');return _0x2c12be;}function getFilteredContacts(_0x117fc2){var _0x5ee258=[];return db[_0x9ba2('0x39')][_0x9ba2('0x58')]({'attributes':['id',_0x9ba2('0x2e'),_0x9ba2('0x59')],'raw':!![]})[_0x9ba2('0x4b')](function(_0x20286){_0x5ee258=_['keyBy'](_0x20286,'id');var _0x36f1df={'type':db[_0x9ba2('0x5a')]['QueryTypes']['SELECT'],'model':db[_0x9ba2('0x5b')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x9ba2('0x5c')][_0x9ba2('0x5d')](_0x117fc2[_0x9ba2('0x5e')](),_0x36f1df);})[_0x9ba2('0x4b')](function(_0x323eea){_0x323eea['forEach'](function(_0x483fd2){if(_0x483fd2['TagIds']){_0x483fd2['Tags']=[];_0x483fd2[_0x9ba2('0x18')][_0x9ba2('0x21')](',')[_0x9ba2('0x1a')](function(_0x9c292){_0x483fd2[_0x9ba2('0x5f')][_0x9ba2('0x46')](_0x5ee258[_0x9c292]);});}delete _0x483fd2[_0x9ba2('0x18')];});return _0x323eea;});}function countFilteredContacts(_0x2f9a9d,_0x113ff3){var _0x1d0d15=_0x2f9a9d[_0x9ba2('0x60')]();_0x1d0d15[_0x9ba2('0x1c')]('COUNT(*)');_0x1d0d15=applyJoinClauses(_0x1d0d15,!![]);_0x2f9a9d[_0x9ba2('0x51')]('c.id');var _0x197dbf=utils['getSelectedTags'](_0x113ff3);if(!_[_0x9ba2('0x61')](_0x197dbf)){_0x1d0d15['where'](_0x9ba2('0x62'),_0x197dbf);}var _0x268e72={'type':db[_0x9ba2('0x5a')][_0x9ba2('0x63')][_0x9ba2('0x64')],'raw':!![]};return db[_0x9ba2('0x5c')][_0x9ba2('0x5d')](_0x1d0d15[_0x9ba2('0x5e')](),_0x268e72)[_0x9ba2('0x4b')](function(_0x3e39cc){return _0x3e39cc[0x0][_0x9ba2('0x65')];});}module[_0x9ba2('0x66')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x2436=['fields','tag','filter','resolve','getLists','c.ListId\x20IS\x20NULL','attributes','c.id','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','keyBy','Sequelize','QueryTypes','SELECT','CmContact','sequelize','toString','Tags','clone','COUNT(*)','group','query','exports','lodash','squel','../parsers/advancedSearch','../parsers/qs','role','agent','search','autocomplete','select','from','where','subqry','left_join','uc.CmContactId\x20=\x20','.id','tools_tags','firstName','lastName','mobile','fax','email','ListId','createdAt','updatedAt','deletedAt','TagIds','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','split','length','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','parseSearch','sqlOperator','conditions','name','dateOfBirth','fieldType','datetime','castTo','DATE','buildExpression','type','default','text','value','start','end','Tag','tags','clause','and','ids','user','uc.UserId\x20=\x20?','skip','keys','map','compact','Contact','push','User','c.ListId\x20IN\x20?','concat','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0x2436,0xf8));var _0x6243=function(_0x33e48b,_0x144a21){_0x33e48b=_0x33e48b-0x0;var _0x13d521=_0x2436[_0x33e48b];return _0x13d521;};'use strict';var _=require(_0x6243('0x0'));var squel=require(_0x6243('0x1'));var as=require(_0x6243('0x2'));var qs=require(_0x6243('0x3'));var utils=require('../interaction/utils');var db=require('../../mysqldb')['db'];function skipContactsQuery(_0x594935,_0x306963){var _0x3be2df=![];if(_0x594935[_0x6243('0x4')]===_0x6243('0x5')&&!_0x306963[_0x6243('0x6')]&&!_0x306963['ListId']&&_0x306963[_0x6243('0x7')]!=='true'){_0x3be2df=!![];}return _0x3be2df;}function getContactsSubquery(){return squel[_0x6243('0x8')]()[_0x6243('0x9')]('cm_contacts','c')[_0x6243('0xa')]('c.deletedAt\x20IS\x20NULL');}function applyJoinClauses(_0x33b2b5,_0xacfda4){var _0x2d239d=_0xacfda4?'c':_0x6243('0xb');_0x33b2b5[_0x6243('0xc')]('cm_user_has_contacts','uc',_0x6243('0xd')+_0x2d239d+'.id')[_0x6243('0xc')]('cm_contact_has_tags','ct','ct.CmContactId\x20=\x20'+_0x2d239d+_0x6243('0xe'))[_0x6243('0xc')](_0x6243('0xf'),'t','t.id\x20=\x20ct.TagId');return _0x33b2b5;}function addFieldsToQuery(_0x20ed81,_0x385337,_0x1136c2,_0x1d61dd,_0x16caa0){var _0x5adac9=_0x16caa0?'c':_0x6243('0xb');if(!_0x385337){_0x385337=['id',_0x6243('0x10'),_0x6243('0x11'),'phone',_0x6243('0x12'),_0x6243('0x13'),_0x6243('0x14'),_0x6243('0x15'),'CompanyId',_0x6243('0x16'),_0x6243('0x17'),_0x6243('0x18'),_0x6243('0x19')];}else if(!_0x385337['includes']('id')){_0x385337['push']('id');}var _0x59f4a3=_0x1136c2&&_0x16caa0||!_0x1136c2&&!_0x16caa0;if(_0x1d61dd){_0x59f4a3=_0x1d61dd&&_0x16caa0||!_0x1d61dd&&!_0x16caa0;}_0x385337[_0x6243('0x1a')](function(_0x5a2ff7){if(_0x5a2ff7===_0x6243('0x19')){if(_0x59f4a3){_0x20ed81[_0x6243('0x1b')](_0x6243('0x1c'),_0x5a2ff7);}else if(_0x1136c2||_0x1d61dd){_0x20ed81[_0x6243('0x1b')](_0x5adac9+'.'+_0x5a2ff7);}}else{_0x20ed81[_0x6243('0x1b')](_0x5adac9+'.'+_0x5a2ff7);}});return _0x20ed81;}function getSqlClauses(){var _0x50442a={'default':squel[_0x6243('0x1d')](),'fields':squel[_0x6243('0x1d')](),'filter':squel[_0x6243('0x1d')](),'tags':{'clause':squel[_0x6243('0x1d')](),'ids':null},'user':{'clause':squel[_0x6243('0x1d')](),'skip':![]}};return _0x50442a;}function parseTagParameter(_0xc869e7){var _0x5536ea=squel[_0x6243('0x1d')]();if(_0xc869e7){var _0x1e95a9=utils[_0x6243('0x1e')](_0xc869e7);_0x1e95a9[_0x6243('0x1a')](function(_0x433442){_0x5536ea['or'](_0x6243('0x1f'),'%,'+_0x433442+',%');});}return _0x5536ea;}function parseSearchFilter(_0x5d73f1){var _0x129d9e=squel[_0x6243('0x1d')]();if(_0x5d73f1){var _0x16946c=_0x5d73f1[_0x6243('0x20')]('\x5c','\x5c\x5c')[_0x6243('0x20')](/'/g,'\x27\x27');if(_0x16946c[_0x6243('0x21')]('\x20')[_0x6243('0x22')]>0x1){_0x129d9e['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x6243('0x23')](_0x16946c,!![]),null);}else{if(qs[_0x6243('0x24')](_0x16946c)){_0x129d9e['or'](_0x6243('0x25'),_0x16946c+'%');_0x129d9e['or'](_0x6243('0x26'),_0x16946c+'%');_0x129d9e['or'](_0x6243('0x27'),_0x16946c+'%');_0x129d9e['or'](_0x6243('0x28'),_0x16946c+'%');}else if(qs[_0x6243('0x29')](_0x16946c)){_0x129d9e['or'](_0x6243('0x2a'),_0x16946c+'%');}else{_0x129d9e['or'](_0x6243('0x2b'),'%'+_0x16946c+'%');_0x129d9e['or']('c.lastName\x20LIKE\x20?','%'+_0x16946c+'%');_0x129d9e['or'](_0x6243('0x2a'),'%'+_0x16946c+'%');}}}return _0x129d9e;}function parseAdvancedSearchFilter(_0x22ab7e,_0x778f19){var _0x363865=getSqlClauses();var _0x3d8ea5=as[_0x6243('0x2c')](_0x22ab7e);var _0x38e13c=_0x3d8ea5[_0x6243('0x2d')];for(var _0x149783=0x0;_0x149783<_0x3d8ea5[_0x6243('0x2e')]['length'];_0x149783++){var _0x4deabf=_0x3d8ea5[_0x6243('0x2e')][_0x149783];var _0x279d9a='c';var _0x464647=_['find'](_0x778f19,[_0x6243('0x2f'),_0x4deabf[_0x6243('0x1b')]]);if(_0x464647){if(_0x4deabf[_0x6243('0x1b')]===_0x6243('0x30')||_0x464647[_0x6243('0x31')]===_0x6243('0x32')){_0x4deabf[_0x6243('0x33')]=_0x6243('0x34');}var _0x5a46b5=as[_0x6243('0x35')](_0x279d9a,_0x464647[_0x6243('0x36')],_0x4deabf);_0x363865[_0x6243('0x37')][_0x38e13c](_0x5a46b5[_0x6243('0x38')],_0x5a46b5[_0x6243('0x39')][_0x6243('0x3a')],_0x5a46b5[_0x6243('0x39')][_0x6243('0x3b')]);}else{if(_0x4deabf[_0x6243('0x1b')]===_0x6243('0x3c')){var _0x4981cb=_0x4deabf[_0x6243('0x39')][_0x6243('0x21')](',')['map'](function(_0x659959){return Number(_0x659959);});var _0x401645=parseTagParameter(_0x4981cb);_0x363865[_0x6243('0x3d')][_0x6243('0x3e')][_0x6243('0x3f')](_0x401645);_0x363865[_0x6243('0x3d')][_0x6243('0x40')]=_0x4981cb;}else if(_0x4deabf[_0x6243('0x1b')]==='User'){_0x363865[_0x6243('0x41')][_0x6243('0x3e')][_0x6243('0x3f')](_0x6243('0x42'),_0x4deabf[_0x6243('0x39')]);_0x363865[_0x6243('0x41')][_0x6243('0x43')]=!![];}}}return _0x363865;}function parseModelFields(_0x42d290,_0x34b938){var _0x44c23b=squel[_0x6243('0x1d')]();var _0x17d810=_(_0x42d290)[_0x6243('0x44')]()[_0x6243('0x45')](function(_0x4a9ef7){return _['some'](_0x34b938,['name',_0x4a9ef7])?_0x4a9ef7:undefined;})[_0x6243('0x46')]()[_0x6243('0x39')]();if(_0x42d290[_0x6243('0x47')]){_0x17d810[_0x6243('0x48')](_0x6243('0x47'));}if(_0x42d290[_0x6243('0x49')]){_0x17d810[_0x6243('0x48')](_0x6243('0x49'));}if(_0x17d810['length']>0x0){_0x17d810['forEach'](function(_0x206879){if(_0x206879===_0x6243('0x15')){_0x44c23b[_0x6243('0x3f')](_0x6243('0x4a'),[][_0x6243('0x4b')](_0x42d290[_0x206879]));}else if(_0x206879===_0x6243('0x47')){var _0xa1f479='%'+_0x42d290[_0x206879]+'%';_0x44c23b[_0x6243('0x3f')](_0x6243('0x4c'),_0xa1f479);}else if(_0x206879===_0x6243('0x49')){_0x44c23b[_0x6243('0x3f')](_0x6243('0x42'),_0x42d290[_0x206879]);}else{_0x44c23b['and']('c.'+_0x206879+_0x6243('0x4d'),_0x42d290[_0x206879]);}});}return _0x44c23b;}function parseQueryParameters(_0x2da9b1,_0x291c7f){var _0x1fffb5=getSqlClauses();return Promise['resolve']()[_0x6243('0x4e')](function(){return parseModelFields(_0x2da9b1,_0x291c7f);})[_0x6243('0x4e')](function(_0x5a361f){_0x1fffb5[_0x6243('0x4f')][_0x6243('0x3f')](_0x5a361f);return parseTagParameter(_0x2da9b1[_0x6243('0x50')]);})[_0x6243('0x4e')](function(_0x4c3453){_0x1fffb5[_0x6243('0x3d')][_0x6243('0x3e')][_0x6243('0x3f')](_0x4c3453);return parseSearchFilter(_0x2da9b1['filter']);})[_0x6243('0x4e')](function(_0xfba001){_0x1fffb5[_0x6243('0x51')]=_0xfba001;return _0x1fffb5;});}function checkListsRestrictions(_0x5d40dc,_0x433666,_0x540788){var _0xfc5699=squel[_0x6243('0x1d')]();return Promise[_0x6243('0x52')]()[_0x6243('0x4e')](function(){if(_0x433666[_0x6243('0x6')]&&_0x5d40dc[_0x6243('0x4')]===_0x6243('0x5')&&!_0x540788){return _0x5d40dc[_0x6243('0x53')]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x605b62){if(_0x605b62){if(_0x605b62[_0x6243('0x22')]===0x0){_0xfc5699[_0x6243('0x3f')](_0x6243('0x54'));}else{_0xfc5699[_0x6243('0x3f')](_0x6243('0x4a'),_['map'](_0x605b62,'id'));}}})['then'](function(){return _0xfc5699;});}function buildContactsQuery(_0x45b33f,_0x263f0f,_0x3a3ca5,_0x18b585,_0x4cf10c,_0x3a1ed5){if(_0x263f0f){_0x263f0f=_0x3a3ca5[_0x6243('0x55')];}_0x45b33f=addFieldsToQuery(_0x45b33f,_0x263f0f,_0x18b585,_0x3a1ed5,!![]);var _0x5db031=squel['select']();_0x5db031=addFieldsToQuery(_0x5db031,_0x263f0f,_0x18b585,_0x3a1ed5,![]);if(_0x18b585||_0x3a1ed5){_0x45b33f=applyJoinClauses(_0x45b33f,!![]);_0x45b33f['group'](_0x6243('0x56'));if(_0x3a3ca5[_0x6243('0x57')]){_0x5db031[_0x6243('0x57')](_0x3a3ca5[_0x6243('0x57')]);}if(_0x3a3ca5[_0x6243('0x58')]){_0x5db031[_0x6243('0x58')](_0x3a3ca5[_0x6243('0x58')]);}}else{_0x5db031=applyJoinClauses(_0x5db031,![]);_0x5db031['group'](_0x6243('0x59'));if(_0x3a3ca5[_0x6243('0x57')]){_0x45b33f[_0x6243('0x57')](_0x3a3ca5['limit']);}if(_0x3a3ca5[_0x6243('0x58')]){_0x45b33f[_0x6243('0x58')](_0x3a3ca5['offset']);}}_0x5db031[_0x6243('0x5a')](_0x4cf10c);if(_0x3a3ca5[_0x6243('0x5b')]){_0x3a3ca5[_0x6243('0x5b')][_0x6243('0x1a')](function(_0x2684b2){_0x45b33f[_0x6243('0x5b')]('c.'+_0x2684b2[0x0],_0x2684b2[0x1]===_0x6243('0x5c')?![]:!![]);_0x5db031[_0x6243('0x5b')](_0x6243('0x5d')+_0x2684b2[0x0],_0x2684b2[0x1]===_0x6243('0x5c')?![]:!![]);});}_0x5db031[_0x6243('0x9')](_0x45b33f,_0x6243('0xb'));return _0x5db031;}function getFilteredContacts(_0x272cfc){var _0x4b8a56=[];return db[_0x6243('0x3c')][_0x6243('0x5e')]({'attributes':['id','name',_0x6243('0x5f')],'raw':!![]})[_0x6243('0x4e')](function(_0x4ea2db){_0x4b8a56=_[_0x6243('0x60')](_0x4ea2db,'id');var _0x47540e={'type':db[_0x6243('0x61')][_0x6243('0x62')][_0x6243('0x63')],'model':db[_0x6243('0x64')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0x6243('0x65')]['query'](_0x272cfc[_0x6243('0x66')](),_0x47540e);})[_0x6243('0x4e')](function(_0x5de520){_0x5de520[_0x6243('0x1a')](function(_0x11a78e){if(_0x11a78e[_0x6243('0x19')]){_0x11a78e[_0x6243('0x67')]=[];_0x11a78e['TagIds'][_0x6243('0x21')](',')[_0x6243('0x1a')](function(_0xffc3f6){_0x11a78e[_0x6243('0x67')]['push'](_0x4b8a56[_0xffc3f6]);});}delete _0x11a78e[_0x6243('0x19')];});return _0x5de520;});}function countFilteredContacts(_0x85f4ba,_0x13a169){var _0x7a62d8=_0x85f4ba[_0x6243('0x68')]();_0x7a62d8['field'](_0x6243('0x69'));_0x7a62d8=applyJoinClauses(_0x7a62d8,!![]);_0x85f4ba[_0x6243('0x6a')](_0x6243('0x56'));var _0x472789=utils['getSelectedTags'](_0x13a169);if(!_['isEmpty'](_0x472789)){_0x7a62d8[_0x6243('0xa')]('t.id\x20IN\x20?',_0x472789);}var _0x545d30={'type':db[_0x6243('0x61')][_0x6243('0x62')]['SELECT'],'raw':!![]};return db[_0x6243('0x65')][_0x6243('0x6b')](_0x7a62d8[_0x6243('0x66')](),_0x545d30)[_0x6243('0x4e')](function(_0x578284){return _0x578284[0x0][_0x6243('0x69')];});}module[_0x6243('0x6c')]={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index acdfb7d..726416b 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 _0xb7f0=['utf8','base64','decryptString','crypto','app','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','error','test','getCiphers','hasOwnProperty','encryptFile','createCipher','data','update','binary','final','close','unlink','decryptFile','createReadStream','createDecipher','write','end','encryptString','secret'];(function(_0x3dd9dd,_0x401b00){var _0x3d750d=function(_0x1d960b){while(--_0x1d960b){_0x3dd9dd['push'](_0x3dd9dd['shift']());}};_0x3d750d(++_0x401b00);}(_0xb7f0,0x99));var _0x0b7f=function(_0x241099,_0x2997a9){_0x241099=_0x241099-0x0;var _0x164e96=_0xb7f0[_0x241099];return _0x164e96;};'use strict';var crypto=require(_0x0b7f('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require('lodash');var config=require('../../config/environment');var logger=require('../../config/logger')(_0x0b7f('0x1'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x0b7f('0x2')][_0x0b7f('0x3')],'algorithm':_0x0b7f('0x4')};const fileOptions={'algorithm':_0x0b7f('0x5')};if(config[_0x0b7f('0x6')]&&config[_0x0b7f('0x6')][_0x0b7f('0x7')]){var isSupported=isAlgorithmSupported(config[_0x0b7f('0x6')][_0x0b7f('0x7')]);if(isSupported){fileOptions[_0x0b7f('0x7')]=config[_0x0b7f('0x6')][_0x0b7f('0x7')];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger[_0x0b7f('0x8')](config['encrypt'][_0x0b7f('0x7')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x19c6ba){return AES_SUPPORTED_RX[_0x0b7f('0x9')](_0x19c6ba);}function getSupportedCiphers(){return crypto[_0x0b7f('0xa')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x411fb4){return getSupportedCiphers()['indexOf'](_0x411fb4)>-0x1;}function combineOptions(_0x4ef070){var _0x95974d={};for(var _0x356141 in fileOptions){if(fileOptions[_0x0b7f('0xb')](_0x356141)){_0x95974d[_0x356141]=fileOptions[_0x356141];}}if(_0x4ef070){for(var _0x157f91 in _0x4ef070){if(_0x4ef070[_0x0b7f('0xb')](_0x157f91)){_0x95974d[_0x157f91]=_0x4ef070[_0x157f91];}}}return _0x95974d;}exports[_0x0b7f('0xc')]=function(_0x365936,_0x1eca6f,_0x3e562d,_0x376c0c){return new BPromise(function(_0x3c3608,_0xb0b405){_0x376c0c=combineOptions(_0x376c0c);var _0x2b8feb=new Buffer(_0x3e562d);var _0x5ebd1d=fs['createReadStream'](_0x365936);var _0x14cf38=fs['createWriteStream'](_0x1eca6f);var _0x525468=crypto[_0x0b7f('0xd')](_0x376c0c[_0x0b7f('0x7')],_0x2b8feb);_0x5ebd1d['on'](_0x0b7f('0xe'),function(_0x3ff42a){var _0x31776d=new Buffer(_0x525468[_0x0b7f('0xf')](_0x3ff42a),_0x0b7f('0x10'));_0x14cf38['write'](_0x31776d);});_0x5ebd1d['on']('end',function(){try{var _0xccdcee=new Buffer(_0x525468[_0x0b7f('0x11')](_0x0b7f('0x10')),_0x0b7f('0x10'));_0x14cf38['write'](_0xccdcee);_0x14cf38['end']();_0x14cf38['on'](_0x0b7f('0x12'),function(){return _0x3c3608(_0x1eca6f);});}catch(_0x1cea66){fs[_0x0b7f('0x13')](_0x1eca6f);return _0xb0b405(_0x1cea66);}});});};exports[_0x0b7f('0x14')]=function(_0x1a4728,_0x234ed8,_0x4f2fec,_0x1a7ffc){return new BPromise(function(_0x19c623,_0x4fa9f6){_0x1a7ffc=combineOptions(_0x1a7ffc);var _0x5491b7=new Buffer(_0x4f2fec);var _0x81e2db=fs[_0x0b7f('0x15')](_0x1a4728);var _0x504d34=fs['createWriteStream'](_0x234ed8);var _0x39e068=crypto[_0x0b7f('0x16')](_0x1a7ffc[_0x0b7f('0x7')],_0x5491b7);_0x81e2db['on'](_0x0b7f('0xe'),function(_0x33d6b5){var _0xa535e1=new Buffer(_0x39e068[_0x0b7f('0xf')](_0x33d6b5),_0x0b7f('0x10'));_0x504d34[_0x0b7f('0x17')](_0xa535e1);});_0x81e2db['on'](_0x0b7f('0x18'),function(){try{var _0x437760=new Buffer(_0x39e068[_0x0b7f('0x11')]('binary'),_0x0b7f('0x10'));_0x504d34[_0x0b7f('0x17')](_0x437760);_0x504d34[_0x0b7f('0x18')]();_0x504d34['on'](_0x0b7f('0x12'),function(){return _0x19c623(_0x234ed8);});}catch(_0x43a5e4){fs['unlink'](_0x234ed8);return _0x4fa9f6(_0x43a5e4);}});});};exports[_0x0b7f('0x19')]=function(_0x596ad2,_0x21a4de,_0x176356){var _0x20a7aa=_0x176356||stringOptions[_0x0b7f('0x7')];var _0x3b2aa2=_0x21a4de||stringOptions[_0x0b7f('0x1a')];var _0x1c602b=crypto[_0x0b7f('0xd')](_0x20a7aa,_0x3b2aa2);var _0x33b80f=_0x1c602b[_0x0b7f('0xf')](_0x596ad2,_0x0b7f('0x1b'),_0x0b7f('0x1c'));_0x33b80f+=_0x1c602b[_0x0b7f('0x11')](_0x0b7f('0x1c'));return _0x33b80f;};exports[_0x0b7f('0x1d')]=function(_0x7ece71,_0x2c55dd,_0x96744c){var _0x43f713=_0x96744c||stringOptions[_0x0b7f('0x7')];var _0x5f109b=_0x2c55dd||stringOptions[_0x0b7f('0x1a')];var _0x59f880=crypto[_0x0b7f('0x16')](_0x43f713,_0x5f109b);var _0x43c3c2=_0x59f880[_0x0b7f('0xf')](_0x7ece71,_0x0b7f('0x1c'),_0x0b7f('0x1b'));_0x43c3c2+=_0x59f880[_0x0b7f('0x11')]('utf8');return _0x43c3c2;}; \ No newline at end of file +var _0x065c=['crypto','bluebird','../../config/environment','app','session','aes-256-ctr','aes192','encrypt','algorithm','join','error','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createCipher','data','update','end','final','binary','write','close','decryptFile','createReadStream','createWriteStream','createDecipher','unlink','encryptString','secret','utf8','base64','decryptString'];(function(_0x1d1407,_0x1850c8){var _0x3034ff=function(_0x340962){while(--_0x340962){_0x1d1407['push'](_0x1d1407['shift']());}};_0x3034ff(++_0x1850c8);}(_0x065c,0x181));var _0xc065=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x065c[_0x16b9ed];return _0x66b1f8;};'use strict';var crypto=require(_0xc065('0x0'));var fs=require('fs');var BPromise=require(_0xc065('0x1'));var _=require('lodash');var config=require(_0xc065('0x2'));var logger=require('../../config/logger')(_0xc065('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config['secrets'][_0xc065('0x4')],'algorithm':_0xc065('0x5')};const fileOptions={'algorithm':_0xc065('0x6')};if(config[_0xc065('0x7')]&&config[_0xc065('0x7')][_0xc065('0x8')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0xc065('0x8')]);if(isSupported){fileOptions[_0xc065('0x8')]=config[_0xc065('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc065('0x9')](',\x20');logger[_0xc065('0xa')](config[_0xc065('0x7')][_0xc065('0x8')],'is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:',supportedAlgorithms);}}function isASupportedCipher(_0x72bd2b){return AES_SUPPORTED_RX[_0xc065('0xb')](_0x72bd2b);}function getSupportedCiphers(){return crypto[_0xc065('0xc')]()[_0xc065('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x24a68e){return getSupportedCiphers()[_0xc065('0xe')](_0x24a68e)>-0x1;}function combineOptions(_0x439943){var _0x4af87f={};for(var _0x4228e2 in fileOptions){if(fileOptions[_0xc065('0xf')](_0x4228e2)){_0x4af87f[_0x4228e2]=fileOptions[_0x4228e2];}}if(_0x439943){for(var _0x13000a in _0x439943){if(_0x439943['hasOwnProperty'](_0x13000a)){_0x4af87f[_0x13000a]=_0x439943[_0x13000a];}}}return _0x4af87f;}exports[_0xc065('0x10')]=function(_0x9a0ad4,_0x691ec7,_0x2e748e,_0x19689f){return new BPromise(function(_0x28a19d,_0x57431b){_0x19689f=combineOptions(_0x19689f);var _0x4faa8d=new Buffer(_0x2e748e);var _0x4322c7=fs['createReadStream'](_0x9a0ad4);var _0x4dae20=fs['createWriteStream'](_0x691ec7);var _0x1dc161=crypto[_0xc065('0x11')](_0x19689f[_0xc065('0x8')],_0x4faa8d);_0x4322c7['on'](_0xc065('0x12'),function(_0x5ede5b){var _0x29445e=new Buffer(_0x1dc161[_0xc065('0x13')](_0x5ede5b),'binary');_0x4dae20['write'](_0x29445e);});_0x4322c7['on'](_0xc065('0x14'),function(){try{var _0x183fcd=new Buffer(_0x1dc161[_0xc065('0x15')](_0xc065('0x16')),_0xc065('0x16'));_0x4dae20[_0xc065('0x17')](_0x183fcd);_0x4dae20[_0xc065('0x14')]();_0x4dae20['on'](_0xc065('0x18'),function(){return _0x28a19d(_0x691ec7);});}catch(_0x4184ea){fs['unlink'](_0x691ec7);return _0x57431b(_0x4184ea);}});});};exports[_0xc065('0x19')]=function(_0xad346d,_0x3f9274,_0x3053d0,_0x313154){return new BPromise(function(_0x5c97da,_0x33d41a){_0x313154=combineOptions(_0x313154);var _0x3dc2e9=new Buffer(_0x3053d0);var _0x599739=fs[_0xc065('0x1a')](_0xad346d);var _0x294f2f=fs[_0xc065('0x1b')](_0x3f9274);var _0x3bc1fc=crypto[_0xc065('0x1c')](_0x313154[_0xc065('0x8')],_0x3dc2e9);_0x599739['on'](_0xc065('0x12'),function(_0x3c9055){var _0x3a0fd3=new Buffer(_0x3bc1fc['update'](_0x3c9055),_0xc065('0x16'));_0x294f2f[_0xc065('0x17')](_0x3a0fd3);});_0x599739['on'](_0xc065('0x14'),function(){try{var _0x5a07f0=new Buffer(_0x3bc1fc[_0xc065('0x15')](_0xc065('0x16')),_0xc065('0x16'));_0x294f2f['write'](_0x5a07f0);_0x294f2f['end']();_0x294f2f['on']('close',function(){return _0x5c97da(_0x3f9274);});}catch(_0x26c64e){fs[_0xc065('0x1d')](_0x3f9274);return _0x33d41a(_0x26c64e);}});});};exports[_0xc065('0x1e')]=function(_0xd1b3d6,_0x2e7d1b,_0x7aa29a){var _0x525f43=_0x7aa29a||stringOptions[_0xc065('0x8')];var _0xea2a=_0x2e7d1b||stringOptions[_0xc065('0x1f')];var _0x457211=crypto['createCipher'](_0x525f43,_0xea2a);var _0x2df6df=_0x457211[_0xc065('0x13')](_0xd1b3d6,_0xc065('0x20'),_0xc065('0x21'));_0x2df6df+=_0x457211['final'](_0xc065('0x21'));return _0x2df6df;};exports[_0xc065('0x22')]=function(_0x1e8963,_0x4c3437,_0x25f7b6){var _0x4933f2=_0x25f7b6||stringOptions['algorithm'];var _0x1feecf=_0x4c3437||stringOptions['secret'];var _0x13c3b9=crypto[_0xc065('0x1c')](_0x4933f2,_0x1feecf);var _0x57f523=_0x13c3b9[_0xc065('0x13')](_0x1e8963,_0xc065('0x21'),_0xc065('0x20'));_0x57f523+=_0x13c3b9[_0xc065('0x15')](_0xc065('0x20'));return _0x57f523;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 964fc4d..f481799 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 _0xf746=['zip\x20finished','CSV','Completed','catch','inspect','Failed','exit','util','path','lodash','to-csv','bluebird','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','find','splitSizeCsv','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','split','length','range','isInteger','forEach','push','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s.%s','csv','zip'];(function(_0x29b609,_0x19d388){var _0x54c952=function(_0xb3c38d){while(--_0xb3c38d){_0x29b609['push'](_0x29b609['shift']());}};_0x54c952(++_0x19d388);}(_0xf746,0x69));var _0x6f74=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xf746[_0x2b5eae];return _0x5f3ac9;};'use strict';var util=require(_0x6f74('0x0'));var path=require(_0x6f74('0x1'));var _=require(_0x6f74('0x2'));var csv=require(_0x6f74('0x3'));var fs=require('fs');var BPromise=require(_0x6f74('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x6f74('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x6f74('0x6'))[_0x6f74('0x7')];var logger=require('../../config/logger')(_0x6f74('0x8'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x6f74('0x9')][0x3];var PATH=process[_0x6f74('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x279066,_0x1dac7b){var _0xa7ad5e={'status':_0x279066};var _0x3e4b61={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x1dac7b){_0xa7ad5e[_0x6f74('0xa')]=_0x1dac7b;}return db[_0x6f74('0xb')][_0x6f74('0xc')](_0xa7ad5e,_0x3e4b61);}function main(){var _0x5e05e7=0x1388;var _0x6601f2;logger[_0x6f74('0xd')](util[_0x6f74('0xe')](_0x6f74('0xf'),EXTRACTED_REPORT_ID,'CSV'));return db['Setting'][_0x6f74('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x6f74('0x11')]})[_0x6f74('0x12')](function(_0x143fd2){if(_0x143fd2){_0x6601f2=_0x143fd2;_0x5e05e7=_0x6601f2[_0x6f74('0x11')]||0x1388;}})['then'](function(){return dbH['sequelize'][_0x6f74('0x13')](util[_0x6f74('0xe')](_0x6f74('0x14'),QUERY),{'type':dbH['sequelize'][_0x6f74('0x15')][_0x6f74('0x16')]});})[_0x6f74('0x12')](function(_0x29d9f8){if(!_0x29d9f8[0x0][_0x6f74('0x17')]){return analyticExtractedReport('Empty');}var _0x1e7628=[];var _0x235beb=0x0;if(_0x6601f2[_0x6f74('0x18')]){if(_0x29d9f8&&_0x29d9f8[_0x6f74('0x19')]){var _0x3c3065=_[_0x6f74('0x1a')](_0x29d9f8[0x0][_0x6f74('0x17')]/_0x5e05e7);var _0xd8a4a0=Number[_0x6f74('0x1b')](_0x29d9f8[0x0][_0x6f74('0x17')]/_0x5e05e7)?_0x29d9f8[0x0]['num']%_0x5e05e7:0x0;_0x3c3065[_0x6f74('0x1c')](function(_0x2994cf){if(_0x2994cf>0x0){_0x235beb+=_0x5e05e7;}_0x1e7628[_0x6f74('0x1d')](dbH[_0x6f74('0x1e')]['query'](util['format'](_0x6f74('0x1f'),QUERY,_0x5e05e7,_0x235beb),{'type':dbH[_0x6f74('0x1e')][_0x6f74('0x15')][_0x6f74('0x16')]}));});if(_0xd8a4a0>0x0){_0x235beb+=_0x5e05e7;_0x1e7628['push'](dbH[_0x6f74('0x1e')]['query'](util[_0x6f74('0xe')](_0x6f74('0x1f'),QUERY,_0xd8a4a0,_0x235beb),{'type':dbH[_0x6f74('0x1e')][_0x6f74('0x15')]['SELECT']}));}}}else{_0x1e7628['push'](dbH[_0x6f74('0x1e')]['query'](QUERY,{'type':dbH[_0x6f74('0x1e')][_0x6f74('0x15')][_0x6f74('0x16')]}));}var _0x4d9643=path[_0x6f74('0x20')](PATH);var _0x8416ee=path[_0x6f74('0x21')](PATH,_0x6f74('0x22'));var _0x158f8f=_0x6601f2[_0x6f74('0x18')]&&_0x1e7628[_0x6f74('0x19')]>0x1;var _0x2e878f=[];if(!fs[_0x6f74('0x23')](path[_0x6f74('0x24')](_0x4d9643,_0x8416ee))&&_0x158f8f){fs[_0x6f74('0x25')](path['join'](_0x4d9643,_0x8416ee));}return BPromise[_0x6f74('0x26')](_0x1e7628,function(_0x46e46a){_0x2e878f['push'](_0x46e46a);})['then'](function(){for(var _0x2f56cb=0x0;_0x2f56cb<_0x2e878f['length'];_0x2f56cb+=0x1){var _0x2d9cd0;var _0x523a3b=_0x2e878f[_0x2f56cb];if(_0x158f8f){_0x2d9cd0=path[_0x6f74('0x24')](_0x4d9643,_0x8416ee,util[_0x6f74('0xe')]('%s%d.%s',_0x8416ee,_0x2f56cb,'csv'));}else{_0x2d9cd0=path[_0x6f74('0x24')](_0x4d9643,util['format'](_0x6f74('0x27'),_0x8416ee,_0x6f74('0x28')));}fs['writeFileSync'](_0x2d9cd0,csv(_0x523a3b));}})[_0x6f74('0x12')](function(){if(_0x158f8f){return new Promise(function(_0x549683){zipdir(path[_0x6f74('0x24')](_0x4d9643,_0x8416ee),{'saveTo':path[_0x6f74('0x24')](_0x4d9643,util[_0x6f74('0xe')](_0x6f74('0x27'),_0x8416ee,_0x6f74('0x29')))},function(_0x992dde,_0x166967){rimraf(path[_0x6f74('0x24')](_0x4d9643,_0x8416ee),function(){});_0x549683(_0x6f74('0x2a'));});});}})[_0x6f74('0x12')](function(){logger[_0x6f74('0xd')](util[_0x6f74('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x6f74('0x2b')));return analyticExtractedReport(_0x6f74('0x2c'),_0x158f8f?util[_0x6f74('0xe')](_0x6f74('0x27'),_0x8416ee,_0x158f8f?'zip':_0x6f74('0x28')):null);});})[_0x6f74('0x2d')](function(_0x521f3b){logger[_0x6f74('0xd')](util[_0x6f74('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'CSV'),util[_0x6f74('0x2e')](_0x521f3b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6f74('0x2f'));})['finally'](function(){process[_0x6f74('0x30')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x5074=['zip','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','%s.%s','catch','inspect','Failed','exit','util','lodash','to-csv','bluebird','../../mysqldb','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','split','length','range','isInteger','query','QueryTypes','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','writeFileSync'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5074,0xe9));var _0x4507=function(_0x4ab3fb,_0x776775){_0x4ab3fb=_0x4ab3fb-0x0;var _0x34fe1e=_0x5074[_0x4ab3fb];return _0x34fe1e;};'use strict';var util=require(_0x4507('0x0'));var path=require('path');var _=require(_0x4507('0x1'));var csv=require(_0x4507('0x2'));var fs=require('fs');var BPromise=require(_0x4507('0x3'));var zipdir=require('zip-dir');var rimraf=require('rimraf');var db=require(_0x4507('0x4'))['db'];var dbH=require(_0x4507('0x4'))['dbH'];var logger=require('../../config/logger')(_0x4507('0x5'));var EXTRACTED_REPORT_ID=Number(process[_0x4507('0x6')][0x2]);var QUERY=process[_0x4507('0x6')][0x3];var PATH=process[_0x4507('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3be0aa,_0x5ca07f){var _0x22ad22={'status':_0x3be0aa};var _0x475a3b={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5ca07f){_0x22ad22['savename']=_0x5ca07f;}return db[_0x4507('0x7')][_0x4507('0x8')](_0x22ad22,_0x475a3b);}function main(){var _0x46998a=0x1388;var _0x34317e;logger[_0x4507('0x9')](util[_0x4507('0xa')](_0x4507('0xb'),EXTRACTED_REPORT_ID,_0x4507('0xc')));return db[_0x4507('0xd')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizeCsv']})[_0x4507('0xe')](function(_0x53f770){if(_0x53f770){_0x34317e=_0x53f770;_0x46998a=_0x34317e['splitSizeCsv']||0x1388;}})[_0x4507('0xe')](function(){return dbH[_0x4507('0xf')]['query'](util[_0x4507('0xa')](_0x4507('0x10'),QUERY),{'type':dbH[_0x4507('0xf')]['QueryTypes'][_0x4507('0x11')]});})[_0x4507('0xe')](function(_0x49c470){if(!_0x49c470[0x0][_0x4507('0x12')]){return analyticExtractedReport('Empty');}var _0x4e854b=[];var _0x2d3ca7=0x0;if(_0x34317e[_0x4507('0x13')]){if(_0x49c470&&_0x49c470[_0x4507('0x14')]){var _0x2caeb3=_[_0x4507('0x15')](_0x49c470[0x0][_0x4507('0x12')]/_0x46998a);var _0x5724d5=Number[_0x4507('0x16')](_0x49c470[0x0]['num']/_0x46998a)?_0x49c470[0x0][_0x4507('0x12')]%_0x46998a:0x0;_0x2caeb3['forEach'](function(_0x198e94){if(_0x198e94>0x0){_0x2d3ca7+=_0x46998a;}_0x4e854b['push'](dbH[_0x4507('0xf')][_0x4507('0x17')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x46998a,_0x2d3ca7),{'type':dbH['sequelize'][_0x4507('0x18')][_0x4507('0x11')]}));});if(_0x5724d5>0x0){_0x2d3ca7+=_0x46998a;_0x4e854b[_0x4507('0x19')](dbH[_0x4507('0xf')][_0x4507('0x17')](util[_0x4507('0xa')](_0x4507('0x1a'),QUERY,_0x5724d5,_0x2d3ca7),{'type':dbH[_0x4507('0xf')][_0x4507('0x18')][_0x4507('0x11')]}));}}}else{_0x4e854b[_0x4507('0x19')](dbH[_0x4507('0xf')]['query'](QUERY,{'type':dbH[_0x4507('0xf')][_0x4507('0x18')][_0x4507('0x11')]}));}var _0x2aee10=path[_0x4507('0x1b')](PATH);var _0x5e3f55=path[_0x4507('0x1c')](PATH,_0x4507('0x1d'));var _0x86dfc9=_0x34317e[_0x4507('0x13')]&&_0x4e854b['length']>0x1;var _0x555270=[];if(!fs[_0x4507('0x1e')](path[_0x4507('0x1f')](_0x2aee10,_0x5e3f55))&&_0x86dfc9){fs[_0x4507('0x20')](path[_0x4507('0x1f')](_0x2aee10,_0x5e3f55));}return BPromise[_0x4507('0x21')](_0x4e854b,function(_0x534666){_0x555270[_0x4507('0x19')](_0x534666);})[_0x4507('0xe')](function(){for(var _0x851f4c=0x0;_0x851f4c<_0x555270['length'];_0x851f4c+=0x1){var _0x351e56;var _0x130f5a=_0x555270[_0x851f4c];if(_0x86dfc9){_0x351e56=path[_0x4507('0x1f')](_0x2aee10,_0x5e3f55,util[_0x4507('0xa')](_0x4507('0x22'),_0x5e3f55,_0x851f4c,_0x4507('0x23')));}else{_0x351e56=path[_0x4507('0x1f')](_0x2aee10,util[_0x4507('0xa')]('%s.%s',_0x5e3f55,_0x4507('0x23')));}fs[_0x4507('0x24')](_0x351e56,csv(_0x130f5a));}})[_0x4507('0xe')](function(){if(_0x86dfc9){return new Promise(function(_0x4c4e44){zipdir(path[_0x4507('0x1f')](_0x2aee10,_0x5e3f55),{'saveTo':path[_0x4507('0x1f')](_0x2aee10,util[_0x4507('0xa')]('%s.%s',_0x5e3f55,_0x4507('0x25')))},function(_0x3b518b,_0xbdfe9c){rimraf(path[_0x4507('0x1f')](_0x2aee10,_0x5e3f55),function(){});_0x4c4e44(_0x4507('0x26'));});});}})['then'](function(){logger['info'](util[_0x4507('0xa')](_0x4507('0x27'),EXTRACTED_REPORT_ID,_0x4507('0xc')));return analyticExtractedReport('Completed',_0x86dfc9?util[_0x4507('0xa')](_0x4507('0x28'),_0x5e3f55,_0x86dfc9?_0x4507('0x25'):_0x4507('0x23')):null);});})[_0x4507('0x29')](function(_0x3a8754){logger[_0x4507('0x9')](util[_0x4507('0xa')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4507('0xc')),util[_0x4507('0x2a')](_0x3a8754,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4507('0x2b'));})['finally'](function(){process[_0x4507('0x2c')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index f1aa9be..b92d855 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 _0x80e6=['map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','name','startDate','endDate','header','before','margin','landscape','footer','Arial','black','right','num','Empty','find','splitSizePdf','then','split','range','isInteger','sequelize','query','QueryTypes','SELECT','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','existsSync','join','mkdirSync','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','zip','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','info','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','error','end','createPdfFromHTML','catch','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','JSDOM','window','../../mysqldb','dbH','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update'];(function(_0x5c504b,_0x79d69f){var _0x4fd9f5=function(_0xb46452){while(--_0xb46452){_0x5c504b['push'](_0x5c504b['shift']());}};_0x4fd9f5(++_0x79d69f);}(_0x80e6,0x1bb));var _0x680e=function(_0x1386e4,_0x40c521){_0x1386e4=_0x1386e4-0x0;var _0x5f2585=_0x80e6[_0x1386e4];return _0x5f2585;};'use strict';var _=require(_0x680e('0x0'));var fs=require('fs');var util=require('util');var path=require(_0x680e('0x1'));var moment=require(_0x680e('0x2'));var htmlToPdfmake=require(_0x680e('0x3'));var PdfPrinter=require(_0x680e('0x4'));var zipdir=require(_0x680e('0x5'));var rimraf=require(_0x680e('0x6'));var JSDOM=require(_0x680e('0x7'))[_0x680e('0x8')];var window=new JSDOM('')[_0x680e('0x9')];var BPromise=require('bluebird');var db=require(_0x680e('0xa'))['db'];var dbH=require(_0x680e('0xa'))[_0x680e('0xb')];var logger=require('../../config/logger')(_0x680e('0xc'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x680e('0xd')][0x3];var PATH=process[_0x680e('0xd')][0x4];var NAME=process[_0x680e('0xd')][0x5];var FORMAT=_0x680e('0xe');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x8b784,_0x2582f9){var _0x13a13b={'status':_0x8b784};var _0x50e044={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2582f9){_0x13a13b['savename']=_0x2582f9;}return db[_0x680e('0xf')][_0x680e('0x10')](_0x13a13b,_0x50e044);}function getHeaders(_0x3e8b9e){return _[_0x680e('0x11')](_0x3e8b9e,function(_0x153498){return{'text':_0x153498,'style':_0x680e('0x12')};});}function getRows(_0x3550ab,_0xb97ad6){return _[_0x680e('0x11')](_0xb97ad6,function(_0x475cc8){return _(_0x475cc8)[_0x680e('0x13')](_0x3550ab)[_0x680e('0x11')](function(_0x3cda2c){return _0x3cda2c?_[_0x680e('0x14')](_0x3cda2c):'';})[_0x680e('0x15')]();});}function createTable(_0x142208,_0x2e6e29){var _0x27c29a={'widths':_[_0x680e('0x16')](Array(_0x142208[_0x680e('0x17')]),0x91),'heights':function(_0x24997f){return _0x24997f===0x0?_0x680e('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x17b334=getHeaders(_0x142208);_0x27c29a[_0x680e('0x19')][_0x680e('0x1a')](_0x17b334);var _0x4eb184=getRows(_0x142208,_0x2e6e29);_0x27c29a[_0x680e('0x19')]=_0x27c29a[_0x680e('0x19')][_0x680e('0x1b')](_0x4eb184);return _0x27c29a;}function createTables(_0x44eefa){var _0x131ab0=[];var _0x3bb28c=_[_0x680e('0x1c')](Object[_0x680e('0x1d')](_0x44eefa[0x0]),0x5);_0x3bb28c[_0x680e('0x1e')](function(_0x4ba565){_0x131ab0[_0x680e('0x1a')](createTable(_0x4ba565,_0x44eefa));});return _0x131ab0;}function getPDFDocDefinition(_0x47d1ec){var _0x1147b2=util[_0x680e('0x1f')]('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x680e('0x20')],moment(EXTRACTED_REPORT[_0x680e('0x21')])[_0x680e('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0x680e('0x22')])['format'](FORMAT));var _0x4b7f92=[];for(var _0x77cb5=0x0;_0x77cb5<_0x47d1ec[_0x680e('0x17')];_0x77cb5++){var _0x15be47=[];if(_0x77cb5===0x0){_0x15be47[_0x680e('0x1a')]({'text':_0x1147b2,'style':_0x680e('0x23')});}var _0xad0da8={'table':_0x47d1ec[_0x77cb5]};if(_0x77cb5>0x0){_0xad0da8['pageBreak']=_0x680e('0x24');_0xad0da8[_0x680e('0x25')]=[0x0,0x46,0x0,0x0];}_0x15be47[_0x680e('0x1a')](_0xad0da8);_0x4b7f92[_0x680e('0x1a')](_0x15be47);}return{'pageSize':'A4','pageOrientation':_0x680e('0x26'),'content':_0x4b7f92,'footer':function(_0x4b69ba,_0x56607a){return{'text':_0x4b69ba[_0x680e('0x14')]()+'\x20/\x20'+_0x56607a,'style':_0x680e('0x27')};},'defaultStyle':{'font':_0x680e('0x28')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x680e('0x29')},'footer':{'alignment':_0x680e('0x2a'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3f134a){var _0xb1509d=0x1388;var _0x4d3f49;if(!_0x3f134a[0x0][_0x680e('0x2b')]){return analyticExtractedReport(_0x680e('0x2c'));}return db['Setting'][_0x680e('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x680e('0x2e')]})[_0x680e('0x2f')](function(_0x21b9e9){if(_0x21b9e9){_0x4d3f49=_0x21b9e9;_0xb1509d=_0x4d3f49[_0x680e('0x2e')]||0x3e8;}})[_0x680e('0x2f')](function(){var _0x3eec78=[];var _0x18e4ad=0x0;if(_0x4d3f49[_0x680e('0x30')]){if(_0x3f134a&&_0x3f134a[_0x680e('0x17')]){var _0x2567b5=_[_0x680e('0x31')](_0x3f134a[0x0][_0x680e('0x2b')]/_0xb1509d);var _0x5a5a53=Number[_0x680e('0x32')](_0x3f134a[0x0][_0x680e('0x2b')]/_0xb1509d)?_0x3f134a[0x0][_0x680e('0x2b')]%_0xb1509d:0x0;_0x2567b5[_0x680e('0x1e')](function(_0x389479){if(_0x389479>0x0){_0x18e4ad+=_0xb1509d;}_0x3eec78[_0x680e('0x1a')](dbH[_0x680e('0x33')][_0x680e('0x34')](util[_0x680e('0x1f')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xb1509d,_0x18e4ad),{'type':dbH[_0x680e('0x33')][_0x680e('0x35')][_0x680e('0x36')]}));});if(_0x5a5a53>0x0){_0x18e4ad+=_0xb1509d;_0x3eec78['push'](dbH[_0x680e('0x33')][_0x680e('0x34')](util[_0x680e('0x1f')](_0x680e('0x37'),QUERY,_0x5a5a53,_0x18e4ad),{'type':dbH['sequelize'][_0x680e('0x35')]['SELECT']}));}}}else{_0x3eec78[_0x680e('0x1a')](dbH[_0x680e('0x33')][_0x680e('0x34')](QUERY,{'type':dbH[_0x680e('0x33')][_0x680e('0x35')][_0x680e('0x36')]}));}var _0x3dde73=path[_0x680e('0x38')](PATH);var _0x2e22df=path[_0x680e('0x39')](PATH,'.pdf');var _0x269d35=_0x4d3f49[_0x680e('0x30')]&&_0x3eec78[_0x680e('0x17')]>0x1;var _0x9f7a54=[];if(!fs[_0x680e('0x3a')](path[_0x680e('0x3b')](_0x3dde73,_0x2e22df))&&_0x269d35){fs[_0x680e('0x3c')](path[_0x680e('0x3b')](_0x3dde73,_0x2e22df));}return BPromise[_0x680e('0x3d')](_0x3eec78,function(_0x28bf38){_0x9f7a54['push'](_0x28bf38);})['then'](function(){var _0x4de1da=[];for(var _0x4dfb6f=0x0;_0x4dfb6f<_0x9f7a54[_0x680e('0x17')];_0x4dfb6f+=0x1){var _0x45afdc=_0x9f7a54[_0x4dfb6f];var _0x5d3b37=createTables(_[_0x680e('0x3e')](_0x45afdc));var _0x3862c2;var _0x276687=getPDFDocDefinition(_0x5d3b37);var _0x5cb8dd=getPDFPrinter();var _0x38e63e=_0x5cb8dd[_0x680e('0x3f')](_0x276687);if(_0x269d35){_0x3862c2=path[_0x680e('0x3b')](_0x3dde73,_0x2e22df,util[_0x680e('0x1f')](_0x680e('0x40'),_0x2e22df,_0x4dfb6f,_0x680e('0x41')));}else{_0x3862c2=path['join'](_0x3dde73,util[_0x680e('0x1f')](_0x680e('0x42'),_0x2e22df,_0x680e('0x41')));}_0x4de1da[_0x680e('0x1a')](writePDFDocument(_0x38e63e,_0x3862c2));}return Promise['all'](_0x4de1da);})['then'](function(){if(_0x269d35){return new Promise(function(_0x59e175){zipdir(path[_0x680e('0x3b')](_0x3dde73,_0x2e22df),{'saveTo':path['join'](_0x3dde73,util[_0x680e('0x1f')](_0x680e('0x42'),_0x2e22df,'zip'))},function(){rimraf(path[_0x680e('0x3b')](_0x3dde73,_0x2e22df),function(){});_0x59e175('zip\x20finished');});});}})[_0x680e('0x2f')](function(){if(!_0x269d35)return;rimraf(path[_0x680e('0x3b')](_0x3dde73,_0x2e22df),function(){});})[_0x680e('0x2f')](function(){logger['info'](util[_0x680e('0x1f')](_0x680e('0x43'),EXTRACTED_REPORT_ID,'PDF'));return analyticExtractedReport(_0x680e('0x44'),_0x269d35?util[_0x680e('0x1f')](_0x680e('0x42'),_0x2e22df,_0x269d35?_0x680e('0x45'):_0x680e('0x41')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x680e('0x1f')](_0x680e('0x46'),EXTRACTED_REPORT_ID,_0x680e('0x47')));return db['AnalyticExtractedReport'][_0x680e('0x48')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x1362db){EXTRACTED_REPORT=_0x1362db;return dbH[_0x680e('0x33')][_0x680e('0x34')](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x680e('0x33')]['QueryTypes'][_0x680e('0x36')]});})[_0x680e('0x2f')](extractReport)['catch'](function(_0x267273){logger[_0x680e('0x49')](util[_0x680e('0x1f')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0x680e('0x4a')](_0x267273,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x680e('0x4b'));})['finally'](function(){process[_0x680e('0x4c')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x5e97db=new PdfPrinter({'Arial':{'normal':__dirname+_0x680e('0x4d'),'bold':__dirname+_0x680e('0x4e'),'italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x680e('0x4f')}});return _0x5e97db;}function getPDFDocDefinitionFromHTML(_0x8d25f,_0x53bc0b){var _0x4b1906=util[_0x680e('0x1f')](_0x680e('0x50'),_0x53bc0b[_0x680e('0x51')],_0x53bc0b[_0x680e('0x52')]);var _0x59d9b8=moment()['format']('YYYY-MM-DD')[_0x680e('0x14')]();var _0x11c750=htmlToPdfmake(_0x8d25f,{'window':window,'tableAutoSize':!![]});return{'content':[_0x11c750],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x680e('0x53'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x680e('0x53'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x680e('0x53')}},'header':function(){return[{'text':_0x680e('0x54'),'style':_0x680e('0x23')}];},'footer':function(_0x19a1fd,_0x4fdfa3){return[{'text':util['format'](_0x680e('0x55'),_0x4b1906,_0x19a1fd,_0x4fdfa3,_0x59d9b8),'style':'footer'}];}};}function writePDFDocument(_0x4b407c,_0x2bffd6){return new Promise(function(_0x38a0d3,_0x59a3a3){var _0x3aa7c5=_0x4b407c[_0x680e('0x56')](fs[_0x680e('0x57')](_0x2bffd6));_0x3aa7c5['on']('finish',function(){_0x38a0d3('finish');});_0x3aa7c5['on'](_0x680e('0x58'),function(_0xab7201){_0x59a3a3(_0xab7201);});_0x4b407c[_0x680e('0x59')]();});}exports[_0x680e('0x5a')]=function(_0x57d489,_0x293000){var _0xc6f853=getPDFPrinter();var _0xefcc47=getPDFDocDefinitionFromHTML(_0x57d489,_0x293000);var _0x1780fd=_0xc6f853[_0x680e('0x3f')](_0xefcc47);return writePDFDocument(_0x1780fd,_0x293000[_0x680e('0x1')])[_0x680e('0x5b')](function(_0x2cfc59){throw _0x2cfc59;});}; \ No newline at end of file +var _0x760c=['%s.%s','all','zip','zip\x20finished','info','PDF','Completed','pdf','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','Arial','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','error','end','createPdfFromHTML','createPdfKitDocument','catch','lodash','util','path','moment','html-to-pdfmake','zip-dir','rimraf','jsdom','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','map','tableHeader','pick','toString','value','fill','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20','footer','black','Empty','Setting','find','split','splitSizePdf','then','range','num','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','.pdf','existsSync','join','mkdirSync','each','flatten','%s%d.%s'];(function(_0x2add49,_0x602c93){var _0x1402d7=function(_0x140da9){while(--_0x140da9){_0x2add49['push'](_0x2add49['shift']());}};_0x1402d7(++_0x602c93);}(_0x760c,0x82));var _0xc760=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x760c[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xc760('0x0'));var fs=require('fs');var util=require(_0xc760('0x1'));var path=require(_0xc760('0x2'));var moment=require(_0xc760('0x3'));var htmlToPdfmake=require(_0xc760('0x4'));var PdfPrinter=require('pdfmake/src/printer');var zipdir=require(_0xc760('0x5'));var rimraf=require(_0xc760('0x6'));var JSDOM=require(_0xc760('0x7'))[_0xc760('0x8')];var window=new JSDOM('')['window'];var BPromise=require(_0xc760('0x9'));var db=require(_0xc760('0xa'))['db'];var dbH=require(_0xc760('0xa'))[_0xc760('0xb')];var logger=require(_0xc760('0xc'))(_0xc760('0xd'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xc760('0xe')][0x3];var PATH=process[_0xc760('0xe')][0x4];var NAME=process[_0xc760('0xe')][0x5];var FORMAT='MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a';var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x2215dc,_0x12d50f){var _0x1371d4={'status':_0x2215dc};var _0x56046a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x12d50f){_0x1371d4['savename']=_0x12d50f;}return db[_0xc760('0xf')][_0xc760('0x10')](_0x1371d4,_0x56046a);}function getHeaders(_0x24641a){return _[_0xc760('0x11')](_0x24641a,function(_0x103476){return{'text':_0x103476,'style':_0xc760('0x12')};});}function getRows(_0x108763,_0x28f57c){return _[_0xc760('0x11')](_0x28f57c,function(_0xd6a729){return _(_0xd6a729)[_0xc760('0x13')](_0x108763)['map'](function(_0x44b8d2){return _0x44b8d2?_[_0xc760('0x14')](_0x44b8d2):'';})[_0xc760('0x15')]();});}function createTable(_0x4da808,_0x5ae554){var _0x122a06={'widths':_[_0xc760('0x16')](Array(_0x4da808[_0xc760('0x17')]),0x91),'heights':function(_0x54ddca){return _0x54ddca===0x0?_0xc760('0x18'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x54f475=getHeaders(_0x4da808);_0x122a06[_0xc760('0x19')][_0xc760('0x1a')](_0x54f475);var _0x17cc12=getRows(_0x4da808,_0x5ae554);_0x122a06[_0xc760('0x19')]=_0x122a06['body'][_0xc760('0x1b')](_0x17cc12);return _0x122a06;}function createTables(_0x119b7b){var _0x5a41b0=[];var _0x332177=_[_0xc760('0x1c')](Object[_0xc760('0x1d')](_0x119b7b[0x0]),0x5);_0x332177[_0xc760('0x1e')](function(_0x601567){_0x5a41b0[_0xc760('0x1a')](createTable(_0x601567,_0x119b7b));});return _0x5a41b0;}function getPDFDocDefinition(_0x2cde37){var _0x391bf5=util[_0xc760('0x1f')](_0xc760('0x20'),NAME,EXTRACTED_REPORT[_0xc760('0x21')],moment(EXTRACTED_REPORT[_0xc760('0x22')])[_0xc760('0x1f')](FORMAT),moment(EXTRACTED_REPORT[_0xc760('0x23')])[_0xc760('0x1f')](FORMAT));var _0x4adcba=[];for(var _0x57729a=0x0;_0x57729a<_0x2cde37[_0xc760('0x17')];_0x57729a++){var _0xd1abc1=[];if(_0x57729a===0x0){_0xd1abc1['push']({'text':_0x391bf5,'style':_0xc760('0x24')});}var _0x5f16be={'table':_0x2cde37[_0x57729a]};if(_0x57729a>0x0){_0x5f16be[_0xc760('0x25')]=_0xc760('0x26');_0x5f16be[_0xc760('0x27')]=[0x0,0x46,0x0,0x0];}_0xd1abc1['push'](_0x5f16be);_0x4adcba['push'](_0xd1abc1);}return{'pageSize':'A4','pageOrientation':_0xc760('0x28'),'content':_0x4adcba,'footer':function(_0x1c609d,_0xbe3733){return{'text':_0x1c609d[_0xc760('0x14')]()+_0xc760('0x29')+_0xbe3733,'style':_0xc760('0x2a')};},'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xc760('0x2b')},'footer':{'alignment':'right','margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x3418aa){var _0x4c8260=0x1388;var _0x4ca52a;if(!_0x3418aa[0x0]['num']){return analyticExtractedReport(_0xc760('0x2c'));}return db[_0xc760('0x2d')][_0xc760('0x2e')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xc760('0x2f'),_0xc760('0x30')]})[_0xc760('0x31')](function(_0x25fd27){if(_0x25fd27){_0x4ca52a=_0x25fd27;_0x4c8260=_0x4ca52a[_0xc760('0x30')]||0x3e8;}})[_0xc760('0x31')](function(){var _0x4d9b01=[];var _0x5e3616=0x0;if(_0x4ca52a['split']){if(_0x3418aa&&_0x3418aa[_0xc760('0x17')]){var _0x48c5af=_[_0xc760('0x32')](_0x3418aa[0x0][_0xc760('0x33')]/_0x4c8260);var _0x1f4561=Number[_0xc760('0x34')](_0x3418aa[0x0]['num']/_0x4c8260)?_0x3418aa[0x0][_0xc760('0x33')]%_0x4c8260:0x0;_0x48c5af[_0xc760('0x1e')](function(_0x12b299){if(_0x12b299>0x0){_0x5e3616+=_0x4c8260;}_0x4d9b01[_0xc760('0x1a')](dbH[_0xc760('0x35')][_0xc760('0x36')](util[_0xc760('0x1f')](_0xc760('0x37'),QUERY,_0x4c8260,_0x5e3616),{'type':dbH[_0xc760('0x35')][_0xc760('0x38')][_0xc760('0x39')]}));});if(_0x1f4561>0x0){_0x5e3616+=_0x4c8260;_0x4d9b01[_0xc760('0x1a')](dbH[_0xc760('0x35')]['query'](util[_0xc760('0x1f')](_0xc760('0x37'),QUERY,_0x1f4561,_0x5e3616),{'type':dbH[_0xc760('0x35')]['QueryTypes'][_0xc760('0x39')]}));}}}else{_0x4d9b01[_0xc760('0x1a')](dbH[_0xc760('0x35')]['query'](QUERY,{'type':dbH[_0xc760('0x35')][_0xc760('0x38')][_0xc760('0x39')]}));}var _0x2c61b9=path[_0xc760('0x3a')](PATH);var _0x572669=path['basename'](PATH,_0xc760('0x3b'));var _0x26104f=_0x4ca52a[_0xc760('0x2f')]&&_0x4d9b01['length']>0x1;var _0x4777de=[];if(!fs[_0xc760('0x3c')](path[_0xc760('0x3d')](_0x2c61b9,_0x572669))&&_0x26104f){fs[_0xc760('0x3e')](path['join'](_0x2c61b9,_0x572669));}return BPromise[_0xc760('0x3f')](_0x4d9b01,function(_0x414afd){_0x4777de['push'](_0x414afd);})[_0xc760('0x31')](function(){var _0x11737b=[];for(var _0x4aad19=0x0;_0x4aad19<_0x4777de[_0xc760('0x17')];_0x4aad19+=0x1){var _0x19c980=_0x4777de[_0x4aad19];var _0x57f549=createTables(_[_0xc760('0x40')](_0x19c980));var _0x51a89b;var _0x4e82a6=getPDFDocDefinition(_0x57f549);var _0x419a5c=getPDFPrinter();var _0x5cb7b5=_0x419a5c['createPdfKitDocument'](_0x4e82a6);if(_0x26104f){_0x51a89b=path['join'](_0x2c61b9,_0x572669,util['format'](_0xc760('0x41'),_0x572669,_0x4aad19,'pdf'));}else{_0x51a89b=path[_0xc760('0x3d')](_0x2c61b9,util[_0xc760('0x1f')](_0xc760('0x42'),_0x572669,'pdf'));}_0x11737b['push'](writePDFDocument(_0x5cb7b5,_0x51a89b));}return Promise[_0xc760('0x43')](_0x11737b);})[_0xc760('0x31')](function(){if(_0x26104f){return new Promise(function(_0x5e5d07){zipdir(path['join'](_0x2c61b9,_0x572669),{'saveTo':path['join'](_0x2c61b9,util[_0xc760('0x1f')](_0xc760('0x42'),_0x572669,_0xc760('0x44')))},function(){rimraf(path[_0xc760('0x3d')](_0x2c61b9,_0x572669),function(){});_0x5e5d07(_0xc760('0x45'));});});}})['then'](function(){if(!_0x26104f)return;rimraf(path[_0xc760('0x3d')](_0x2c61b9,_0x572669),function(){});})[_0xc760('0x31')](function(){logger[_0xc760('0x46')](util[_0xc760('0x1f')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xc760('0x47')));return analyticExtractedReport(_0xc760('0x48'),_0x26104f?util[_0xc760('0x1f')]('%s.%s',_0x572669,_0x26104f?'zip':_0xc760('0x49')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xc760('0x46')](util['format'](_0xc760('0x4a'),EXTRACTED_REPORT_ID,_0xc760('0x47')));return db['AnalyticExtractedReport'][_0xc760('0x4b')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xc760('0x31')](function(_0x5b01d2){EXTRACTED_REPORT=_0x5b01d2;return dbH[_0xc760('0x35')]['query'](util[_0xc760('0x1f')](_0xc760('0x4c'),QUERY),{'type':dbH['sequelize'][_0xc760('0x38')][_0xc760('0x39')]});})['then'](extractReport)['catch'](function(_0xbcc741){logger[_0xc760('0x46')](util[_0xc760('0x1f')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc760('0x47')),util[_0xc760('0x4d')](_0xbcc741,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xc760('0x4e'));})[_0xc760('0x4f')](function(){process[_0xc760('0x50')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x1c0cc0=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0xc760('0x51'),'italics':__dirname+_0xc760('0x52'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x1c0cc0;}function getPDFDocDefinitionFromHTML(_0x510304,_0x4dc5dd){var _0x13fa3=util['format'](_0xc760('0x53'),_0x4dc5dd[_0xc760('0x54')],_0x4dc5dd[_0xc760('0x55')]);var _0x37c18a=moment()[_0xc760('0x1f')](_0xc760('0x56'))[_0xc760('0x14')]();var _0xdc77e9=htmlToPdfmake(_0x510304,{'window':window,'tableAutoSize':!![]});return{'content':[_0xdc77e9],'defaultStyle':{'font':_0xc760('0x57')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0xc760('0x58'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xc760('0x58')}},'header':function(){return[{'text':_0xc760('0x59'),'style':_0xc760('0x24')}];},'footer':function(_0x48d8ab,_0x4809a3){return[{'text':util[_0xc760('0x1f')](_0xc760('0x5a'),_0x13fa3,_0x48d8ab,_0x4809a3,_0x37c18a),'style':_0xc760('0x2a')}];}};}function writePDFDocument(_0x9c8e69,_0x2522fb){return new Promise(function(_0x10ff6c,_0xc11586){var _0x409195=_0x9c8e69[_0xc760('0x5b')](fs[_0xc760('0x5c')](_0x2522fb));_0x409195['on']('finish',function(){_0x10ff6c('finish');});_0x409195['on'](_0xc760('0x5d'),function(_0x5ec089){_0xc11586(_0x5ec089);});_0x9c8e69[_0xc760('0x5e')]();});}exports[_0xc760('0x5f')]=function(_0x5d942f,_0x35422e){var _0x530979=getPDFPrinter();var _0x3a2dfe=getPDFDocDefinitionFromHTML(_0x5d942f,_0x35422e);var _0x410609=_0x530979[_0xc760('0x60')](_0x3a2dfe);return writePDFDocument(_0x410609,_0x35422e[_0xc760('0x2')])[_0xc760('0x61')](function(_0x338a35){throw _0x338a35;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index e32e44b..12ff885 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 _0x7c7d=['basename','.xlsx','mkdirSync','join','each','%s%d.%s','xlsx','%s.%s','binary','zip\x20finished','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','Completed','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','then','num','Empty','length','range','isInteger','push','query','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname'];(function(_0x41000f,_0x1dda63){var _0x5a639e=function(_0x26c86e){while(--_0x26c86e){_0x41000f['push'](_0x41000f['shift']());}};_0x5a639e(++_0x1dda63);}(_0x7c7d,0x158));var _0xd7c7=function(_0x5cb4fc,_0x222fbb){_0x5cb4fc=_0x5cb4fc-0x0;var _0xe29f03=_0x7c7d[_0x5cb4fc];return _0xe29f03;};'use strict';var util=require(_0xd7c7('0x0'));var path=require(_0xd7c7('0x1'));var _=require(_0xd7c7('0x2'));var fs=require('fs');var json2xls=require(_0xd7c7('0x3'));var BPromise=require(_0xd7c7('0x4'));var zipdir=require(_0xd7c7('0x5'));var rimraf=require(_0xd7c7('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0xd7c7('0x7'))[_0xd7c7('0x8')];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0xd7c7('0x9')][0x2]);var QUERY=process[_0xd7c7('0x9')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x6d7e8b,_0x2863f4){var _0x7d4690={'status':_0x6d7e8b};var _0x282537={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2863f4){_0x7d4690[_0xd7c7('0xa')]=_0x2863f4;}return db[_0xd7c7('0xb')][_0xd7c7('0xc')](_0x7d4690,_0x282537);}function main(){var _0x24954f=0x1388;var _0x54ae7d;logger[_0xd7c7('0xd')](util[_0xd7c7('0xe')](_0xd7c7('0xf'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0xd7c7('0x10')][_0xd7c7('0x11')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd7c7('0x12'),_0xd7c7('0x13')]})['then'](function(_0x3539a4){if(_0x3539a4){_0x54ae7d=_0x3539a4;_0x24954f=_0x54ae7d['splitSizeXlsx']||0x1388;}})['then'](function(){return dbH[_0xd7c7('0x14')]['query'](util[_0xd7c7('0xe')](_0xd7c7('0x15'),QUERY),{'type':dbH[_0xd7c7('0x14')][_0xd7c7('0x16')][_0xd7c7('0x17')]});})[_0xd7c7('0x18')](function(_0x16843b){if(!_0x16843b[0x0][_0xd7c7('0x19')]){return analyticExtractedReport(_0xd7c7('0x1a'));}var _0x4df993=[];var _0x4326b0=0x0;if(_0x54ae7d['split']){if(_0x16843b&&_0x16843b[_0xd7c7('0x1b')]){var _0x4609a7=_[_0xd7c7('0x1c')](_0x16843b[0x0]['num']/_0x24954f);var _0x26be54=Number[_0xd7c7('0x1d')](_0x16843b[0x0][_0xd7c7('0x19')]/_0x24954f)?_0x16843b[0x0]['num']%_0x24954f:0x0;_0x4609a7['forEach'](function(_0x3df769){if(_0x3df769>0x0){_0x4326b0+=_0x24954f;}_0x4df993[_0xd7c7('0x1e')](dbH['sequelize'][_0xd7c7('0x1f')](util[_0xd7c7('0xe')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x24954f,_0x4326b0),{'type':dbH[_0xd7c7('0x14')]['QueryTypes'][_0xd7c7('0x17')]}));});if(_0x26be54>0x0){_0x4326b0+=_0x24954f;_0x4df993[_0xd7c7('0x1e')](dbH[_0xd7c7('0x14')][_0xd7c7('0x1f')](util['format'](_0xd7c7('0x20'),QUERY,_0x26be54,_0x4326b0),{'type':dbH[_0xd7c7('0x14')][_0xd7c7('0x16')][_0xd7c7('0x17')]}));}}}else{_0x4df993[_0xd7c7('0x1e')](dbH[_0xd7c7('0x14')][_0xd7c7('0x1f')](QUERY,{'type':dbH['sequelize'][_0xd7c7('0x16')][_0xd7c7('0x17')]}));}var _0x286654=path[_0xd7c7('0x21')](PATH);var _0x499d2e=path[_0xd7c7('0x22')](PATH,_0xd7c7('0x23'));var _0x48925b=_0x54ae7d['split']&&_0x4df993[_0xd7c7('0x1b')]>0x1;var _0x4ac32b=[];if(!fs['existsSync'](path['join'](_0x286654,_0x499d2e))&&_0x48925b){fs[_0xd7c7('0x24')](path[_0xd7c7('0x25')](_0x286654,_0x499d2e));}return BPromise[_0xd7c7('0x26')](_0x4df993,function(_0x58fe10){_0x4ac32b[_0xd7c7('0x1e')](_0x58fe10);})[_0xd7c7('0x18')](function(){for(var _0x161f0c=0x0;_0x161f0c<_0x4ac32b['length'];_0x161f0c+=0x1){var _0x52a46c;var _0x17ea52=_0x4ac32b[_0x161f0c];if(_0x48925b){_0x52a46c=path['join'](_0x286654,_0x499d2e,util[_0xd7c7('0xe')](_0xd7c7('0x27'),_0x499d2e,_0x161f0c,_0xd7c7('0x28')));}else{_0x52a46c=path[_0xd7c7('0x25')](_0x286654,util[_0xd7c7('0xe')](_0xd7c7('0x29'),_0x499d2e,_0xd7c7('0x28')));}fs['writeFileSync'](_0x52a46c,json2xls(_0x17ea52),_0xd7c7('0x2a'));}})[_0xd7c7('0x18')](function(){if(_0x48925b){return new Promise(function(_0x18bd42){zipdir(path[_0xd7c7('0x25')](_0x286654,_0x499d2e),{'saveTo':path[_0xd7c7('0x25')](_0x286654,util[_0xd7c7('0xe')]('%s.%s',_0x499d2e,'zip'))},function(_0x1932da,_0x337f72){rimraf(path[_0xd7c7('0x25')](_0x286654,_0x499d2e),function(){});_0x18bd42(_0xd7c7('0x2b'));});});}})['then'](function(){logger['info'](util[_0xd7c7('0xe')](_0xd7c7('0x2c'),EXTRACTED_REPORT_ID,_0xd7c7('0x2d')));return analyticExtractedReport(_0xd7c7('0x2e'),_0x48925b?util[_0xd7c7('0xe')](_0xd7c7('0x29'),_0x499d2e,_0x48925b?_0xd7c7('0x2f'):_0xd7c7('0x28')):null);});})[_0xd7c7('0x30')](function(_0x3a715c){logger[_0xd7c7('0xd')](util[_0xd7c7('0xe')](_0xd7c7('0x31'),EXTRACTED_REPORT_ID,_0xd7c7('0x2d')),util[_0xd7c7('0x32')](_0x3a715c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd7c7('0x33'));})[_0xd7c7('0x34')](function(){process[_0xd7c7('0x35')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x95ef=['QueryTypes','push','dirname','basename','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','writeFileSync','binary','%s.%s','zip','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','finally','exit','util','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','splitSizeXlsx','then','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','split','length','range','isInteger','forEach','sequelize','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x3cb30b,_0x504b3e){var _0x2ca717=function(_0x32a3d9){while(--_0x32a3d9){_0x3cb30b['push'](_0x3cb30b['shift']());}};_0x2ca717(++_0x504b3e);}(_0x95ef,0x119));var _0xf95e=function(_0x4d71dd,_0x4b1be6){_0x4d71dd=_0x4d71dd-0x0;var _0x2499c4=_0x95ef[_0x4d71dd];return _0x2499c4;};'use strict';var util=require(_0xf95e('0x0'));var path=require('path');var _=require(_0xf95e('0x1'));var fs=require('fs');var json2xls=require('json2xls');var BPromise=require(_0xf95e('0x2'));var zipdir=require(_0xf95e('0x3'));var rimraf=require(_0xf95e('0x4'));var db=require(_0xf95e('0x5'))['db'];var dbH=require(_0xf95e('0x5'))[_0xf95e('0x6')];var logger=require('../../config/logger')(_0xf95e('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xf95e('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x3d7422,_0x4d0ce7){var _0xe1af0b={'status':_0x3d7422};var _0x129b34={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4d0ce7){_0xe1af0b[_0xf95e('0x9')]=_0x4d0ce7;}return db[_0xf95e('0xa')]['update'](_0xe1af0b,_0x129b34);}function main(){var _0xb38f3=0x1388;var _0x5a4f94;logger[_0xf95e('0xb')](util[_0xf95e('0xc')](_0xf95e('0xd'),EXTRACTED_REPORT_ID,_0xf95e('0xe')));return db[_0xf95e('0xf')][_0xf95e('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xf95e('0x11')]})['then'](function(_0x9b8d22){if(_0x9b8d22){_0x5a4f94=_0x9b8d22;_0xb38f3=_0x5a4f94['splitSizeXlsx']||0x1388;}})[_0xf95e('0x12')](function(){return dbH['sequelize'][_0xf95e('0x13')](util[_0xf95e('0xc')](_0xf95e('0x14'),QUERY),{'type':dbH['sequelize']['QueryTypes'][_0xf95e('0x15')]});})[_0xf95e('0x12')](function(_0x2715d4){if(!_0x2715d4[0x0][_0xf95e('0x16')]){return analyticExtractedReport(_0xf95e('0x17'));}var _0x1e6122=[];var _0x159beb=0x0;if(_0x5a4f94[_0xf95e('0x18')]){if(_0x2715d4&&_0x2715d4[_0xf95e('0x19')]){var _0x134dd3=_[_0xf95e('0x1a')](_0x2715d4[0x0]['num']/_0xb38f3);var _0x417f38=Number[_0xf95e('0x1b')](_0x2715d4[0x0]['num']/_0xb38f3)?_0x2715d4[0x0][_0xf95e('0x16')]%_0xb38f3:0x0;_0x134dd3[_0xf95e('0x1c')](function(_0xfe8e8a){if(_0xfe8e8a>0x0){_0x159beb+=_0xb38f3;}_0x1e6122['push'](dbH[_0xf95e('0x1d')][_0xf95e('0x13')](util['format'](_0xf95e('0x1e'),QUERY,_0xb38f3,_0x159beb),{'type':dbH[_0xf95e('0x1d')][_0xf95e('0x1f')][_0xf95e('0x15')]}));});if(_0x417f38>0x0){_0x159beb+=_0xb38f3;_0x1e6122['push'](dbH[_0xf95e('0x1d')][_0xf95e('0x13')](util[_0xf95e('0xc')](_0xf95e('0x1e'),QUERY,_0x417f38,_0x159beb),{'type':dbH[_0xf95e('0x1d')]['QueryTypes']['SELECT']}));}}}else{_0x1e6122[_0xf95e('0x20')](dbH['sequelize'][_0xf95e('0x13')](QUERY,{'type':dbH[_0xf95e('0x1d')][_0xf95e('0x1f')][_0xf95e('0x15')]}));}var _0x583135=path[_0xf95e('0x21')](PATH);var _0x49744b=path[_0xf95e('0x22')](PATH,'.xlsx');var _0x460033=_0x5a4f94['split']&&_0x1e6122[_0xf95e('0x19')]>0x1;var _0x422ed6=[];if(!fs[_0xf95e('0x23')](path[_0xf95e('0x24')](_0x583135,_0x49744b))&&_0x460033){fs[_0xf95e('0x25')](path[_0xf95e('0x24')](_0x583135,_0x49744b));}return BPromise[_0xf95e('0x26')](_0x1e6122,function(_0x292b5a){_0x422ed6['push'](_0x292b5a);})[_0xf95e('0x12')](function(){for(var _0x4c4270=0x0;_0x4c4270<_0x422ed6[_0xf95e('0x19')];_0x4c4270+=0x1){var _0x2d1780;var _0x2f75ea=_0x422ed6[_0x4c4270];if(_0x460033){_0x2d1780=path[_0xf95e('0x24')](_0x583135,_0x49744b,util[_0xf95e('0xc')](_0xf95e('0x27'),_0x49744b,_0x4c4270,_0xf95e('0x28')));}else{_0x2d1780=path[_0xf95e('0x24')](_0x583135,util[_0xf95e('0xc')]('%s.%s',_0x49744b,_0xf95e('0x28')));}fs[_0xf95e('0x29')](_0x2d1780,json2xls(_0x2f75ea),_0xf95e('0x2a'));}})[_0xf95e('0x12')](function(){if(_0x460033){return new Promise(function(_0x1fcd85){zipdir(path[_0xf95e('0x24')](_0x583135,_0x49744b),{'saveTo':path[_0xf95e('0x24')](_0x583135,util[_0xf95e('0xc')](_0xf95e('0x2b'),_0x49744b,_0xf95e('0x2c')))},function(_0x172626,_0x474664){rimraf(path[_0xf95e('0x24')](_0x583135,_0x49744b),function(){});_0x1fcd85('zip\x20finished');});});}})[_0xf95e('0x12')](function(){logger['info'](util['format'](_0xf95e('0x2d'),EXTRACTED_REPORT_ID,_0xf95e('0xe')));return analyticExtractedReport(_0xf95e('0x2e'),_0x460033?util[_0xf95e('0xc')](_0xf95e('0x2b'),_0x49744b,_0x460033?_0xf95e('0x2c'):_0xf95e('0x28')):null);});})[_0xf95e('0x2f')](function(_0x3ace2a){logger['info'](util[_0xf95e('0xc')](_0xf95e('0x30'),EXTRACTED_REPORT_ID,_0xf95e('0xe')),util[_0xf95e('0x31')](_0x3ace2a,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})[_0xf95e('0x32')](function(){process[_0xf95e('0x33')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 39d180a..e7f8a3b 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 _0x89e4=['find','push','type','format','CDR(type)=%s','inbound','extensions','Set','CDR(routeid)=','VoiceExtensionId','context','outbound','cutdigits','${EXTEN:','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','interval','tag','CDR(tag)=','callerID','ExecIf','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-ANSWER}=0]?Answer','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','filter','queue','playback','hasOwnProperty','priority','extension'];(function(_0x4e912a,_0x34f952){var _0x99773d=function(_0x1b0b06){while(--_0x1b0b06){_0x4e912a['push'](_0x4e912a['shift']());}};_0x99773d(++_0x34f952);}(_0x89e4,0x19e));var _0x489e=function(_0xa7fc59,_0x3c90e8){_0xa7fc59=_0xa7fc59-0x0;var _0x31a399=_0x89e4[_0xa7fc59];return _0x31a399;};'use strict';var _=require(_0x489e('0x0'));var util=require(_0x489e('0x1'));function rewrite(_0x1fa71b,_0x5a2374){var _0x7eab59=this;return _0x1fa71b[_0x489e('0x2')][_0x489e('0x3')][_0x489e('0x4')]({'raw':!![]})[_0x489e('0x5')](function(_0x1bf5e8){_0x7eab59[_0x489e('0x6')]=_0x1bf5e8;return _0x1fa71b['models'][_0x489e('0x7')][_0x489e('0x4')]({'where':{'IntervalId':_0x5a2374[_0x489e('0x8')]},'raw':!![]});})[_0x489e('0x5')](function(_0x1d0c5d){return _0x1fa71b[_0x489e('0x2')][_0x489e('0x7')][_0x489e('0x4')]({'where':{'exten':{'$in':_[_0x489e('0x9')](_[_0x489e('0xa')](_0x1d0c5d,_0x489e('0xb')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0x489e('0x5')](function(_0x1ed20f){var _0x4066e6=_[_0x489e('0xc')](_0x1ed20f,{'priority':'1'});var _0x5e1d26=_[_0x489e('0xc')](_0x1ed20f,{'isApp':0x1});var _0x3679d7=_['groupBy'](_0x5e1d26,_0x489e('0xb'));var _0x3750cd=[_0x489e('0xd'),_0x489e('0xe')];var _0x5b13ba=[];var _0x46418d=[];for(var _0x31429e in _0x3679d7){if(_0x3679d7[_0x489e('0xf')](_0x31429e)){_0x7eab59[_0x489e('0x10')]=0x2;_0x7eab59['extensions']=[];_0x7eab59[_0x489e('0x11')]=_[_0x489e('0x12')](_0x4066e6,{'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')]});_0x7eab59['extensions'][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':'Set','appdata':util[_0x489e('0x15')](_0x489e('0x16'),_0x3679d7[_0x31429e][0x0][_0x489e('0x14')]),'context':_0x3679d7[_0x31429e][0x0]['context'],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59['priority']++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0]['VoiceExtensionId']});if(_0x3679d7[_0x31429e][0x0][_0x489e('0x14')]===_0x489e('0x17')){_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':_0x489e('0x19'),'appdata':_0x489e('0x1a')+_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')],'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0]['exten'],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});}else if(_0x3679d7[_0x31429e][0x0][_0x489e('0x14')]===_0x489e('0x1d')){if(_0x7eab59[_0x489e('0x11')]){_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':'Set','appdata':'CDR(destination)='+(_0x7eab59[_0x489e('0x11')][_0x489e('0x1e')]?_0x489e('0x1f')+_0x7eab59[_0x489e('0x11')]['cutdigits']+'}':_0x489e('0x20')),'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0]['VoiceExtensionId']});}_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':_0x489e('0x19'),'appdata':_0x489e('0x1a')+_0x3679d7[_0x31429e][0x0]['VoiceExtensionId'],'context':_0x3679d7[_0x31429e][0x0]['context'],'exten':_0x3679d7[_0x31429e][0x0]['exten'],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});var _0x5da28d=_0x7eab59[_0x489e('0x10')]++;_0x7eab59[_0x489e('0x18')]['push']({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x5da28d+0x2)+_0x489e('0x21')+(_0x5da28d+0x1)+')','context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0]['exten'],'priority':_0x5da28d,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});if(_0x7eab59['extension']){_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':_0x489e('0x19'),'appdata':_0x7eab59[_0x489e('0x11')]['cutdigits']?_0x489e('0x22')+_0x7eab59[_0x489e('0x11')][_0x489e('0x1e')]+'}':_0x489e('0x23'),'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0]['exten'],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});}_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':_0x489e('0x19'),'appdata':'outboundrouteid='+_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')],'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});if(_0x7eab59['extension']&&_0x7eab59[_0x489e('0x11')][_0x489e('0xf')](_0x489e('0x24'))&&_0x7eab59[_0x489e('0x11')][_0x489e('0x24')]!=='none'){_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':_0x489e('0x19'),'appdata':_0x489e('0x25'),'context':_0x3679d7[_0x31429e][0x0]['context'],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});_0x7eab59['extensions']['push']({'type':_0x3679d7[_0x31429e][0x0]['type'],'app':'Set','appdata':_0x489e('0x26')+_0x7eab59[_0x489e('0x11')][_0x489e('0x24')]||_0x489e('0x27'),'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});}}_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':_0x489e('0x19'),'appdata':_0x489e('0x28'),'context':_0x3679d7[_0x31429e][0x0]['context'],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':'Set','appdata':_0x489e('0x29'),'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0]['VoiceExtensionId']});_0x7eab59[_0x489e('0x18')]['push']({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':_0x489e('0x19'),'appdata':_0x489e('0x2a'),'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'priority':_0x7eab59[_0x489e('0x10')]++,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});for(var _0x46a453=0x0,_0x3dd9e5=0x0;_0x46a453<_0x3679d7[_0x31429e][_0x489e('0x2b')];_0x46a453+=0x1,_0x3dd9e5=0x0){var _0x3f1fb6=_0x3679d7[_0x31429e][_0x46a453];if(_0x3f1fb6[_0x489e('0x14')]){_0x3f1fb6[_0x489e('0x14')]=_0x3f1fb6[_0x489e('0x14')][_0x489e('0x2c')]();}var _0x201a60=[];var _0x28e464=[];delete _0x3f1fb6['id'];delete _0x3f1fb6[_0x489e('0x2d')];delete _0x3f1fb6['updatedAt'];var _0x3797e4=_0x3f1fb6['interval']!=='*,*,*,*'?[_0x3f1fb6[_0x489e('0x2e')]]:_0x3f1fb6[_0x489e('0x8')]?_['map'](_[_0x489e('0xc')](_0x7eab59[_0x489e('0x6')],{'IntervalId':_0x3f1fb6[_0x489e('0x8')]}),_0x489e('0x2e')):[];if(_0x3f1fb6['hasOwnProperty'](_0x489e('0x2f'))){if(_0x3f1fb6['tag']&&_0x3f1fb6[_0x489e('0x2f')]!=='--'){_0x201a60[_0x489e('0x13')]({'type':_0x3f1fb6[_0x489e('0x14')],'app':'Set','appdata':_0x489e('0x30')+_0x3f1fb6[_0x489e('0x2f')],'context':_0x3f1fb6[_0x489e('0x1c')],'exten':_0x3f1fb6[_0x489e('0xb')],'priority':_0x3797e4[_0x489e('0x2b')]+_0x7eab59[_0x489e('0x10')]+_0x3dd9e5++,'VoiceExtensionId':_0x3f1fb6[_0x489e('0x1b')]});}}if(_0x3f1fb6[_0x489e('0x14')]===_0x489e('0x1d')&&_0x3f1fb6[_0x489e('0xf')](_0x489e('0x31'))){if(_0x3f1fb6[_0x489e('0x31')]){_0x201a60['push']({'type':_0x3f1fb6[_0x489e('0x14')],'app':_0x489e('0x32'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x3f1fb6[_0x489e('0x31')]+')','context':_0x3f1fb6[_0x489e('0x1c')],'exten':_0x3f1fb6['exten'],'priority':_0x3797e4[_0x489e('0x2b')]+_0x7eab59[_0x489e('0x10')]+_0x3dd9e5++,'VoiceExtensionId':_0x3f1fb6['VoiceExtensionId']});}else{_0x201a60[_0x489e('0x13')]({'type':_0x3f1fb6[_0x489e('0x14')],'app':_0x489e('0x32'),'appdata':_0x489e('0x33'),'context':_0x3f1fb6[_0x489e('0x1c')],'exten':_0x3f1fb6[_0x489e('0xb')],'priority':_0x3797e4[_0x489e('0x2b')]+_0x7eab59[_0x489e('0x10')]+_0x3dd9e5++,'VoiceExtensionId':_0x3f1fb6[_0x489e('0x1b')]});}}if(_0x3f1fb6[_0x489e('0xf')](_0x489e('0x34'))){if(_0x3750cd[_0x489e('0x35')](_0x3f1fb6[_0x489e('0x36')][_0x489e('0x2c')]())>=0x0&&_0x3f1fb6[_0x489e('0x37')]!==_0x489e('0x38')){if(_0x3f1fb6[_0x489e('0x34')]){_0x201a60['push']({'type':_0x3f1fb6[_0x489e('0x14')],'app':_0x489e('0x32'),'appdata':_0x489e('0x39'),'context':_0x3f1fb6[_0x489e('0x1c')],'exten':_0x3f1fb6[_0x489e('0xb')],'priority':_0x3797e4[_0x489e('0x2b')]+_0x7eab59[_0x489e('0x10')]+_0x3dd9e5++,'VoiceExtensionId':_0x3f1fb6[_0x489e('0x1b')]});_0x201a60['push']({'type':_0x3f1fb6[_0x489e('0x14')],'app':'Set','appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3f1fb6['context'],'exten':_0x3f1fb6['exten'],'priority':_0x3797e4[_0x489e('0x2b')]+_0x7eab59[_0x489e('0x10')]+_0x3dd9e5++,'VoiceExtensionId':_0x3f1fb6['VoiceExtensionId']});}else{_0x201a60[_0x489e('0x13')]({'type':_0x3f1fb6[_0x489e('0x14')],'app':_0x489e('0x32'),'appdata':_0x489e('0x3a'),'context':_0x3f1fb6['context'],'exten':_0x3f1fb6[_0x489e('0xb')],'priority':_0x3797e4[_0x489e('0x2b')]+_0x7eab59[_0x489e('0x10')]+_0x3dd9e5++,'VoiceExtensionId':_0x3f1fb6[_0x489e('0x1b')]});_0x201a60[_0x489e('0x13')]({'type':_0x3f1fb6['type'],'app':'Set','appdata':_0x489e('0x3b'),'context':_0x3f1fb6[_0x489e('0x1c')],'exten':_0x3f1fb6[_0x489e('0xb')],'priority':_0x3797e4[_0x489e('0x2b')]+_0x7eab59[_0x489e('0x10')]+_0x3dd9e5++,'VoiceExtensionId':_0x3f1fb6[_0x489e('0x1b')]});}}}for(var _0x311b27=0x0;_0x311b27<_0x3797e4['length'];_0x311b27+=0x1){var _0xe0664b=_0x7eab59[_0x489e('0x10')]+_0x3797e4['length'];var _0x32bca2=_0x311b27===_0x3797e4[_0x489e('0x2b')]-0x1?_0x7eab59[_0x489e('0x10')]+_0x201a60[_0x489e('0x2b')]+_0x28e464[_0x489e('0x2b')]+0x2:_0x7eab59[_0x489e('0x10')]+_0x311b27+0x1;_0x201a60[_0x489e('0x3c')](_0x311b27,0x0,{'type':_0x3f1fb6['type'],'app':_0x489e('0x3d'),'appdata':_0x3797e4[_0x311b27]+'?'+_0x3f1fb6[_0x489e('0x1c')]+_0x489e('0x3e')+_0xe0664b+':'+_0x3f1fb6[_0x489e('0x1c')]+_0x489e('0x3e')+_0x32bca2,'exten':_0x3f1fb6[_0x489e('0xb')],'context':_0x3f1fb6[_0x489e('0x1c')],'priority':_0x7eab59['priority']+_0x311b27,'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});}_0x3f1fb6[_0x489e('0x10')]=_0x201a60[_0x489e('0x2b')]?_[_0x489e('0x3f')](_0x201a60)[_0x489e('0x10')]+0x1:_0x7eab59['priority'];_0x7eab59[_0x489e('0x10')]=(_0x28e464[_0x489e('0x2b')]?_[_0x489e('0x3f')](_0x28e464)['priority']:_0x3f1fb6[_0x489e('0x10')])+0x1;_0x7eab59[_0x489e('0x18')]=_[_0x489e('0x40')](_0x7eab59[_0x489e('0x18')],_0x201a60,[_0x3f1fb6],_0x28e464);}_0x7eab59[_0x489e('0x18')][_0x489e('0x13')]({'type':_0x3679d7[_0x31429e][0x0][_0x489e('0x14')],'app':'Hangup','exten':_0x3679d7[_0x31429e][0x0][_0x489e('0xb')],'context':_0x3679d7[_0x31429e][0x0][_0x489e('0x1c')],'priority':_0x7eab59[_0x489e('0x10')],'VoiceExtensionId':_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]});_0x5b13ba['push'](_0x3679d7[_0x31429e][0x0][_0x489e('0x1b')]);_0x46418d=_[_0x489e('0x40')](_0x46418d,_0x7eab59['extensions']);}}return _0x1fa71b[_0x489e('0x41')](function(_0x3178b3){return _0x1fa71b[_0x489e('0x2')][_0x489e('0x7')][_0x489e('0x42')]({'where':{'VoiceExtensionId':{'$in':_0x5b13ba}},'transaction':_0x3178b3})[_0x489e('0x5')](function(_0x2420bd){return _0x1fa71b['models']['VoiceExtension'][_0x489e('0x43')](_[_0x489e('0x44')](_0x46418d,_0x489e('0x10')),{'transaction':_0x3178b3});});});})[_0x489e('0x45')](function(_0x47b2a7){console[_0x489e('0x46')](_0x47b2a7);});}exports[_0x489e('0x47')]=rewrite; \ No newline at end of file +var _0xb45e=['rewrite','lodash','models','findAll','then','IntervalId','filter','exten','queue','playback','hasOwnProperty','priority','extension','find','extensions','push','type','Set','CDR(type)=%s','context','inbound','CDR(routeid)=','outbound','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','VoiceExtensionId','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','map','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice',',${EXTEN},','last','Hangup','concat','destroy','VoiceExtension','bulkCreate','catch','error'];(function(_0x47ad08,_0x28fcd1){var _0x302699=function(_0x45a213){while(--_0x45a213){_0x47ad08['push'](_0x47ad08['shift']());}};_0x302699(++_0x28fcd1);}(_0xb45e,0x119));var _0xeb45=function(_0x4d2f19,_0x7911bb){_0x4d2f19=_0x4d2f19-0x0;var _0x402a0c=_0xb45e[_0x4d2f19];return _0x402a0c;};'use strict';var _=require(_0xeb45('0x0'));var util=require('util');function rewrite(_0x3283d3,_0x25a38c){var _0x13e389=this;return _0x3283d3[_0xeb45('0x1')]['Interval'][_0xeb45('0x2')]({'raw':!![]})[_0xeb45('0x3')](function(_0x8c362f){_0x13e389['intervals']=_0x8c362f;return _0x3283d3['models']['VoiceExtension']['findAll']({'where':{'IntervalId':_0x25a38c[_0xeb45('0x4')]},'raw':!![]});})['then'](function(_0x138b32){return _0x3283d3['models']['VoiceExtension'][_0xeb45('0x2')]({'where':{'exten':{'$in':_['uniq'](_['map'](_0x138b32,'exten'))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})[_0xeb45('0x3')](function(_0x54e004){var _0x22fac3=_[_0xeb45('0x5')](_0x54e004,{'priority':'1'});var _0x4587be=_[_0xeb45('0x5')](_0x54e004,{'isApp':0x1});var _0x56cf4c=_['groupBy'](_0x4587be,_0xeb45('0x6'));var _0x33d106=[_0xeb45('0x7'),_0xeb45('0x8')];var _0x2fdc59=[];var _0x12b5f5=[];for(var _0x23dcf1 in _0x56cf4c){if(_0x56cf4c[_0xeb45('0x9')](_0x23dcf1)){_0x13e389[_0xeb45('0xa')]=0x2;_0x13e389['extensions']=[];_0x13e389[_0xeb45('0xb')]=_[_0xeb45('0xc')](_0x22fac3,{'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')]});_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':util['format'](_0xeb45('0x11'),_0x56cf4c[_0x23dcf1][0x0]['type']),'context':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x12')],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0]['VoiceExtensionId']});if(_0x56cf4c[_0x23dcf1][0x0]['type']===_0xeb45('0x13')){_0x13e389['extensions'][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':'Set','appdata':_0xeb45('0x14')+_0x56cf4c[_0x23dcf1][0x0]['VoiceExtensionId'],'context':_0x56cf4c[_0x23dcf1][0x0]['context'],'exten':_0x56cf4c[_0x23dcf1][0x0]['exten'],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0]['VoiceExtensionId']});}else if(_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')]===_0xeb45('0x15')){if(_0x13e389[_0xeb45('0xb')]){_0x13e389[_0xeb45('0xd')]['push']({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0xeb45('0x16')+(_0x13e389[_0xeb45('0xb')][_0xeb45('0x17')]?_0xeb45('0x18')+_0x13e389[_0xeb45('0xb')][_0xeb45('0x17')]+'}':_0xeb45('0x19')),'context':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x12')],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0]['VoiceExtensionId']});}_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':'CDR(routeid)='+_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')],'context':_0x56cf4c[_0x23dcf1][0x0]['context'],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});var _0x271fce=_0x13e389[_0xeb45('0xa')]++;_0x13e389['extensions'][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x1b'),'appdata':_0xeb45('0x1c')+(_0x271fce+0x2)+_0xeb45('0x1d')+(_0x271fce+0x1)+')','context':_0x56cf4c[_0x23dcf1][0x0]['context'],'exten':_0x56cf4c[_0x23dcf1][0x0]['exten'],'priority':_0x271fce,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});if(_0x13e389[_0xeb45('0xb')]){_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0x13e389[_0xeb45('0xb')][_0xeb45('0x17')]?_0xeb45('0x1e')+_0x13e389[_0xeb45('0xb')][_0xeb45('0x17')]+'}':'CDR(prefix)=noprefix','context':_0x56cf4c[_0x23dcf1][0x0]['context'],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389['priority']++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});}_0x13e389['extensions'][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':'Set','appdata':_0xeb45('0x1f')+_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')],'context':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x12')],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});if(_0x13e389['extension']&&_0x13e389['extension'][_0xeb45('0x9')](_0xeb45('0x20'))&&_0x13e389[_0xeb45('0xb')][_0xeb45('0x20')]!==_0xeb45('0x21')){_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0xeb45('0x22'),'context':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x12')],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0xeb45('0x23')+_0x13e389['extension'][_0xeb45('0x20')]||_0xeb45('0x24'),'context':_0x56cf4c[_0x23dcf1][0x0]['context'],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});}}_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':'Set','appdata':_0xeb45('0x25'),'context':_0x56cf4c[_0x23dcf1][0x0]['context'],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0]['VoiceExtensionId']});_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0xeb45('0x26'),'context':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x12')],'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});_0x13e389['extensions'][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0]['type'],'app':'Set','appdata':_0xeb45('0x27'),'context':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x12')],'exten':_0x56cf4c[_0x23dcf1][0x0]['exten'],'priority':_0x13e389[_0xeb45('0xa')]++,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});for(var _0x3b9ad1=0x0,_0x3b3279=0x0;_0x3b9ad1<_0x56cf4c[_0x23dcf1][_0xeb45('0x28')];_0x3b9ad1+=0x1,_0x3b3279=0x0){var _0x17ffdf=_0x56cf4c[_0x23dcf1][_0x3b9ad1];if(_0x17ffdf[_0xeb45('0xf')]){_0x17ffdf['type']=_0x17ffdf[_0xeb45('0xf')][_0xeb45('0x29')]();}var _0x3b9b75=[];var _0x6a91bf=[];delete _0x17ffdf['id'];delete _0x17ffdf[_0xeb45('0x2a')];delete _0x17ffdf[_0xeb45('0x2b')];var _0x3c9d17=_0x17ffdf[_0xeb45('0x2c')]!==_0xeb45('0x2d')?[_0x17ffdf[_0xeb45('0x2c')]]:_0x17ffdf[_0xeb45('0x4')]?_[_0xeb45('0x2e')](_[_0xeb45('0x5')](_0x13e389['intervals'],{'IntervalId':_0x17ffdf[_0xeb45('0x4')]}),'interval'):[];if(_0x17ffdf[_0xeb45('0x9')](_0xeb45('0x2f'))){if(_0x17ffdf[_0xeb45('0x2f')]&&_0x17ffdf[_0xeb45('0x2f')]!=='--'){_0x3b9b75[_0xeb45('0xe')]({'type':_0x17ffdf[_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0xeb45('0x30')+_0x17ffdf['tag'],'context':_0x17ffdf[_0xeb45('0x12')],'exten':_0x17ffdf[_0xeb45('0x6')],'priority':_0x3c9d17['length']+_0x13e389['priority']+_0x3b3279++,'VoiceExtensionId':_0x17ffdf[_0xeb45('0x1a')]});}}if(_0x17ffdf[_0xeb45('0xf')]===_0xeb45('0x15')&&_0x17ffdf['hasOwnProperty'](_0xeb45('0x31'))){if(_0x17ffdf['callerID']){_0x3b9b75[_0xeb45('0xe')]({'type':_0x17ffdf[_0xeb45('0xf')],'app':'ExecIf','appdata':_0xeb45('0x32')+_0x17ffdf['callerID']+')','context':_0x17ffdf[_0xeb45('0x12')],'exten':_0x17ffdf[_0xeb45('0x6')],'priority':_0x3c9d17[_0xeb45('0x28')]+_0x13e389[_0xeb45('0xa')]+_0x3b3279++,'VoiceExtensionId':_0x17ffdf[_0xeb45('0x1a')]});}else{_0x3b9b75[_0xeb45('0xe')]({'type':_0x17ffdf[_0xeb45('0xf')],'app':'ExecIf','appdata':_0xeb45('0x33'),'context':_0x17ffdf[_0xeb45('0x12')],'exten':_0x17ffdf[_0xeb45('0x6')],'priority':_0x3c9d17[_0xeb45('0x28')]+_0x13e389[_0xeb45('0xa')]+_0x3b3279++,'VoiceExtensionId':_0x17ffdf[_0xeb45('0x1a')]});}}if(_0x17ffdf['hasOwnProperty'](_0xeb45('0x34'))){if(_0x33d106[_0xeb45('0x35')](_0x17ffdf['app'][_0xeb45('0x29')]())>=0x0&&_0x17ffdf[_0xeb45('0x36')]!=='custom'){if(_0x17ffdf['answer']){_0x3b9b75['push']({'type':_0x17ffdf[_0xeb45('0xf')],'app':_0xeb45('0x1b'),'appdata':_0xeb45('0x37'),'context':_0x17ffdf['context'],'exten':_0x17ffdf[_0xeb45('0x6')],'priority':_0x3c9d17['length']+_0x13e389[_0xeb45('0xa')]+_0x3b3279++,'VoiceExtensionId':_0x17ffdf[_0xeb45('0x1a')]});_0x3b9b75[_0xeb45('0xe')]({'type':_0x17ffdf[_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0xeb45('0x38'),'context':_0x17ffdf['context'],'exten':_0x17ffdf[_0xeb45('0x6')],'priority':_0x3c9d17[_0xeb45('0x28')]+_0x13e389['priority']+_0x3b3279++,'VoiceExtensionId':_0x17ffdf[_0xeb45('0x1a')]});}else{_0x3b9b75[_0xeb45('0xe')]({'type':_0x17ffdf[_0xeb45('0xf')],'app':'ExecIf','appdata':_0xeb45('0x39'),'context':_0x17ffdf[_0xeb45('0x12')],'exten':_0x17ffdf[_0xeb45('0x6')],'priority':_0x3c9d17[_0xeb45('0x28')]+_0x13e389[_0xeb45('0xa')]+_0x3b3279++,'VoiceExtensionId':_0x17ffdf[_0xeb45('0x1a')]});_0x3b9b75[_0xeb45('0xe')]({'type':_0x17ffdf[_0xeb45('0xf')],'app':_0xeb45('0x10'),'appdata':_0xeb45('0x3a'),'context':_0x17ffdf[_0xeb45('0x12')],'exten':_0x17ffdf[_0xeb45('0x6')],'priority':_0x3c9d17['length']+_0x13e389[_0xeb45('0xa')]+_0x3b3279++,'VoiceExtensionId':_0x17ffdf[_0xeb45('0x1a')]});}}}for(var _0x19613c=0x0;_0x19613c<_0x3c9d17[_0xeb45('0x28')];_0x19613c+=0x1){var _0x5a3394=_0x13e389[_0xeb45('0xa')]+_0x3c9d17[_0xeb45('0x28')];var _0x25db6d=_0x19613c===_0x3c9d17[_0xeb45('0x28')]-0x1?_0x13e389[_0xeb45('0xa')]+_0x3b9b75[_0xeb45('0x28')]+_0x6a91bf[_0xeb45('0x28')]+0x2:_0x13e389['priority']+_0x19613c+0x1;_0x3b9b75[_0xeb45('0x3b')](_0x19613c,0x0,{'type':_0x17ffdf[_0xeb45('0xf')],'app':'GotoIfTime','appdata':_0x3c9d17[_0x19613c]+'?'+_0x17ffdf[_0xeb45('0x12')]+_0xeb45('0x3c')+_0x5a3394+':'+_0x17ffdf[_0xeb45('0x12')]+_0xeb45('0x3c')+_0x25db6d,'exten':_0x17ffdf['exten'],'context':_0x17ffdf[_0xeb45('0x12')],'priority':_0x13e389['priority']+_0x19613c,'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});}_0x17ffdf['priority']=_0x3b9b75[_0xeb45('0x28')]?_[_0xeb45('0x3d')](_0x3b9b75)[_0xeb45('0xa')]+0x1:_0x13e389[_0xeb45('0xa')];_0x13e389[_0xeb45('0xa')]=(_0x6a91bf[_0xeb45('0x28')]?_[_0xeb45('0x3d')](_0x6a91bf)['priority']:_0x17ffdf[_0xeb45('0xa')])+0x1;_0x13e389[_0xeb45('0xd')]=_['concat'](_0x13e389[_0xeb45('0xd')],_0x3b9b75,[_0x17ffdf],_0x6a91bf);}_0x13e389[_0xeb45('0xd')][_0xeb45('0xe')]({'type':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0xf')],'app':_0xeb45('0x3e'),'exten':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x6')],'context':_0x56cf4c[_0x23dcf1][0x0]['context'],'priority':_0x13e389['priority'],'VoiceExtensionId':_0x56cf4c[_0x23dcf1][0x0][_0xeb45('0x1a')]});_0x2fdc59[_0xeb45('0xe')](_0x56cf4c[_0x23dcf1][0x0]['VoiceExtensionId']);_0x12b5f5=_[_0xeb45('0x3f')](_0x12b5f5,_0x13e389['extensions']);}}return _0x3283d3['transaction'](function(_0x3db610){return _0x3283d3[_0xeb45('0x1')]['VoiceExtension'][_0xeb45('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x2fdc59}},'transaction':_0x3db610})['then'](function(_0x550fb8){return _0x3283d3[_0xeb45('0x1')][_0xeb45('0x41')][_0xeb45('0x42')](_['sortBy'](_0x12b5f5,_0xeb45('0xa')),{'transaction':_0x3db610});});});})[_0xeb45('0x43')](function(_0x545866){console[_0xeb45('0x44')](_0x545866);});}exports[_0xeb45('0x45')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index abe0f17..2ca8aa4 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 _0x0118=['ioredis','../../../mysqldb','../../../config/environment','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','CmContact','create','push','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','insert','into','cm_hopper','fromQuery','scheduledAt','updatedAt','select','field','NOW()','ContactId','toString','cm_contacts','deletedAt\x20IS\x20NULL','where','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','from','\x20=\x20?','createdAt','id\x20IN\x20?','str','calleridnum','cm_hopper_final','VoiceQueue','findAll','outbound','CmList','Lists','then','get','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resume','resolve','emit','contact:csv_','unlinkSync','exit','CSV\x20import\x20process\x20stopped!','createReadStream','parse','duplicate','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash'];(function(_0x2caf3a,_0x1d65d6){var _0x34f044=function(_0x31410c){while(--_0x31410c){_0x2caf3a['push'](_0x2caf3a['shift']());}};_0x34f044(++_0x1d65d6);}(_0x0118,0x1b1));var _0x8011=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0118[_0x14add3];return _0x4a174f;};'use strict';var BPromise=require(_0x8011('0x0'));var util=require(_0x8011('0x1'));var _=require(_0x8011('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x8011('0x3'));var db=require(_0x8011('0x4'))['db'];var config=require(_0x8011('0x5'));var logger=require('../../../config/logger')(_0x8011('0x6'));config[_0x8011('0x7')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x8011('0x8'))(new Redis(config[_0x8011('0x7')]));require(_0x8011('0x9'))[_0x8011('0xa')](socket);try{if(!process['argv'][0x2]||process[_0x8011('0xb')][0x2]===_0x8011('0xc')||process[_0x8011('0xb')][0x2]===_0x8011('0xd')){throw new Error(_0x8011('0xe'));}var FILEPATH=process[_0x8011('0xb')][0x2];if(!process['argv'][0x3]||process['argv'][0x3]==='undefined'||process[_0x8011('0xb')][0x3]===_0x8011('0xd')||!process[_0x8011('0xb')][0x4]||process['argv'][0x4]==='undefined'||process[_0x8011('0xb')][0x4]===_0x8011('0xd')){throw new Error(_0x8011('0xf'));}var FIELDS=_[_0x8011('0x10')](process[_0x8011('0xb')][0x3]['split'](','),process[_0x8011('0xb')][0x4][_0x8011('0x11')](','));if(!process[_0x8011('0xb')][0x5]||process[_0x8011('0xb')][0x5]===_0x8011('0xc')||process[_0x8011('0xb')][0x5]===_0x8011('0xd')){throw new Error(_0x8011('0x12'));}var LISTID=process[_0x8011('0xb')][0x5];var COMPANYID=process[_0x8011('0xb')][0x6]&&process[_0x8011('0xb')][0x6]!==_0x8011('0xc')&&process[_0x8011('0xb')][0x6]!==_0x8011('0xd')?process[_0x8011('0xb')][0x6]:null;var DUPLICATES=process[_0x8011('0xb')][0x7]&&process[_0x8011('0xb')][0x7]!==_0x8011('0xc')&&process[_0x8011('0xb')][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0x8011('0xb')][0x8]||process[_0x8011('0xb')][0x8]===_0x8011('0xc')||process['argv'][0x8]===_0x8011('0xd')){throw new Error(_0x8011('0x13'));}var SOCKET_TIMESTAMP=process[_0x8011('0xb')][0x8];}catch(_0x237fa1){logger[_0x8011('0x14')](_0x237fa1);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(_0x1ca64c,_0x983c97,_0x43c761,_0x39612b){var _0x1881a7={'message':_0x983c97};_0x1881a7[_0x1ca64c]=!![];if(_0x43c761){_0x1881a7[_0x8011('0x15')]=_0x43c761;}if(_0x39612b){_0x1881a7[_0x8011('0x16')]=_0x39612b;}return _0x1881a7;}function isEmail(_0x25ea70){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))*$/[_0x8011('0x17')](_0x25ea70);}function checkRow(_0x4906e9,_0x410bea,_0x3433e3){return new BPromise(function(_0x3c3164,_0x1b33c5){if(_[_0x8011('0x18')](_0x4906e9)){return _0x1b33c5(handleCheckRowError(_0x8011('0x14'),_0x8011('0x19'),null,_0x3433e3));}if(_0x4906e9[_0x8011('0x1a')]&&_0x4906e9[_0x8011('0x1a')][_0x8011('0x1b')]){var _0x539cec=_[_0x8011('0x1c')](_0x4906e9[_0x8011('0x1a')],_0x8011('0x1d'))['join'](';');return _0x1b33c5(handleCheckRowError(_0x8011('0x14'),_0x539cec,null,_0x3433e3));}var _0x2806c3={};for(var _0x1ba6d1 in FIELDS){if(FIELDS[_0x8011('0x1e')](_0x1ba6d1)&&FIELDS[_0x1ba6d1]){_0x2806c3[_0x1ba6d1]=_0x4906e9[_0x8011('0x1f')][0x0][FIELDS[_0x1ba6d1]]||_0x4906e9[_0x8011('0x1f')][0x0]['\ufeff'+FIELDS[_0x1ba6d1]];}}if(!_0x2806c3[_0x8011('0x20')]){return _0x1b33c5(handleCheckRowError(_0x8011('0x14'),_0x8011('0x21'),null,_0x3433e3));}if(!_0x2806c3[_0x8011('0x22')]){return _0x1b33c5(handleCheckRowError(_0x8011('0x14'),_0x8011('0x23'),null,_0x3433e3));}if(_0x2806c3[_0x8011('0x24')]){var _0x1ac97d=moment(_0x2806c3[_0x8011('0x24')],_0x8011('0x25'));if(!_0x1ac97d['isValid']()){return _0x1b33c5(handleCheckRowError(_0x8011('0x14'),_0x8011('0x26'),null,_0x3433e3));}}if(_0x2806c3[_0x8011('0x27')]){if(!isEmail(_0x2806c3['email'])){return _0x1b33c5(handleCheckRowError(_0x8011('0x14'),_0x8011('0x28'),null,_0x3433e3));}}_0x2806c3[_0x8011('0x29')]=LISTID;_0x2806c3[_0x8011('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x8011('0x1b')]&&_0x410bea){var _0x40795b={};for(var _0x34b0e3=0x0,_0x4dab9f=DUPLICATES[_0x8011('0x1b')];_0x34b0e3<_0x4dab9f;_0x34b0e3+=0x1){_0x40795b[DUPLICATES[_0x34b0e3]]=_0x2806c3[DUPLICATES[_0x34b0e3]];}var _0x1da126=_['find'](_0x410bea,_0x40795b);if(_0x1da126){return _0x1b33c5(handleCheckRowError('duplicate','Duplicate\x20Contact',_0x1da126,_0x3433e3));}}return db[_0x8011('0x2b')][_0x8011('0x2c')](_0x2806c3,{'raw':!![],'hooks':![],'fields':_['keys'](_0x2806c3)})['then'](function(_0x6a9961){if(DUPLICATES&&DUPLICATES['length']&&_0x410bea){_0x410bea[_0x8011('0x2d')](_['pick'](_0x2806c3,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x6a9961['id'];return _0x3c3164();})[_0x8011('0x2e')](function(_0x4b438f){return _0x1b33c5(handleCheckRowError('error',_0x8011('0x2f')+(_0x4b438f['message']||JSON[_0x8011('0x30')](_0x4b438f)),null,_0x3433e3));});});}function checkHopper(){function _0x77c4ba(){return function(_0x3bc0de){logger[_0x8011('0x14')](_0x8011('0x31'),'checkHopper',util['inspect'](_0x3bc0de,{'showHidden':![],'depth':null}));};}var _0x3eca02=function(_0x145761,_0x16f0dc){var _0xab65d8=squel[_0x8011('0x32')]()[_0x8011('0x33')](_0x8011('0x34'))[_0x8011('0x35')]([_0x8011('0x22'),_0x8011('0x36'),'ContactId','ListId',_0x16f0dc,'createdAt',_0x8011('0x37')],squel[_0x8011('0x38')]()[_0x8011('0x39')](_0x8011('0x22'),'phone')[_0x8011('0x39')](_0x8011('0x3a'),_0x8011('0x36'))[_0x8011('0x39')]('id',_0x8011('0x3b'))[_0x8011('0x39')](LISTID[_0x8011('0x3c')](),_0x8011('0x29'))[_0x8011('0x39')](_0x145761['id']['toString'](),_0x16f0dc)[_0x8011('0x39')](_0x8011('0x3a'),'createdAt')[_0x8011('0x39')](_0x8011('0x3a'),_0x8011('0x37'))['from'](_0x8011('0x3d'))['where'](_0x8011('0x3e'))[_0x8011('0x3f')](_0x8011('0x40'),LISTID[_0x8011('0x3c')]())[_0x8011('0x3f')](_0x8011('0x41'))['where'](_0x8011('0x42'),squel[_0x8011('0x38')]()['field'](_0x8011('0x22'))[_0x8011('0x43')](_0x8011('0x34'))[_0x8011('0x3f')](_0x16f0dc+_0x8011('0x44'),_0x145761['id'][_0x8011('0x3c')]())))[_0x8011('0x3c')]();return _0xab65d8;};var _0x159a1a=function(_0x2f884c,_0x1facce){var _0x2a3aef=squel[_0x8011('0x32')]()[_0x8011('0x33')](_0x8011('0x34'))[_0x8011('0x35')](['phone',_0x8011('0x36'),'ContactId',_0x8011('0x29'),_0x1facce,_0x8011('0x45'),_0x8011('0x37')],squel[_0x8011('0x38')]()[_0x8011('0x39')](_0x8011('0x22'),_0x8011('0x22'))[_0x8011('0x39')](_0x8011('0x3a'),_0x8011('0x36'))[_0x8011('0x39')]('id',_0x8011('0x3b'))[_0x8011('0x39')](LISTID[_0x8011('0x3c')](),_0x8011('0x29'))[_0x8011('0x39')](_0x2f884c['id'][_0x8011('0x3c')](),_0x1facce)[_0x8011('0x39')](_0x8011('0x3a'),'createdAt')[_0x8011('0x39')](_0x8011('0x3a'),_0x8011('0x37'))[_0x8011('0x43')]('cm_contacts')['where'](_0x8011('0x3e'))['where'](_0x8011('0x40'),LISTID[_0x8011('0x3c')]())[_0x8011('0x3f')](_0x8011('0x46'),squel[_0x8011('0x47')](hopperContacts))[_0x8011('0x3f')]('phone\x20IS\x20NOT\x20NULL')[_0x8011('0x3f')](_0x8011('0x42'),squel[_0x8011('0x38')]()[_0x8011('0x39')](_0x8011('0x48'))['from'](_0x8011('0x49'))[_0x8011('0x3f')](_0x1facce+_0x8011('0x44'),_0x2f884c['id'][_0x8011('0x3c')]()))[_0x8011('0x3f')](_0x8011('0x42'),squel[_0x8011('0x38')]()[_0x8011('0x39')](_0x8011('0x22'))[_0x8011('0x43')]('cm_hopper')[_0x8011('0x3f')](_0x1facce+'\x20=\x20?',_0x2f884c['id']['toString']())))[_0x8011('0x3c')]();return _0x2a3aef;};function _0x416018(_0x7449e8,_0x579a52){var _0x201e69=squel[_0x8011('0x32')]()[_0x8011('0x33')](_0x8011('0x34'))[_0x8011('0x35')]([_0x8011('0x22'),'scheduledAt',_0x8011('0x3b'),'ListId',_0x579a52,_0x8011('0x45'),_0x8011('0x37')],squel[_0x8011('0x38')]()['field'](_0x8011('0x22'),_0x8011('0x22'))[_0x8011('0x39')]('NOW()',_0x8011('0x36'))[_0x8011('0x39')]('id',_0x8011('0x3b'))[_0x8011('0x39')](LISTID[_0x8011('0x3c')](),'ListId')[_0x8011('0x39')](_0x7449e8['id'][_0x8011('0x3c')](),_0x579a52)[_0x8011('0x39')](_0x8011('0x3a'),_0x8011('0x45'))[_0x8011('0x39')](_0x8011('0x3a'),_0x8011('0x37'))[_0x8011('0x43')]('cm_contacts')['where'](_0x8011('0x3e'))[_0x8011('0x3f')]('ListId\x20=\x20?',LISTID[_0x8011('0x3c')]())[_0x8011('0x3f')](_0x8011('0x46'),squel[_0x8011('0x47')](hopperContacts))[_0x8011('0x3f')](_0x8011('0x41')))['toString']();return _0x201e69;}function _0x27506b(_0x2dbe4f,_0x59689c){var _0x5a1f8e=squel[_0x8011('0x32')]()[_0x8011('0x33')]('cm_hopper_black')['fromQuery']([_0x8011('0x22'),_0x8011('0x3b'),_0x8011('0x29'),_0x59689c,_0x8011('0x45'),_0x8011('0x37')],squel['select']()[_0x8011('0x39')]('phone','phone')[_0x8011('0x39')]('id',_0x8011('0x3b'))['field'](LISTID[_0x8011('0x3c')](),_0x8011('0x29'))['field'](_0x2dbe4f['id'][_0x8011('0x3c')](),_0x59689c)[_0x8011('0x39')](_0x8011('0x3a'),_0x8011('0x45'))['field'](_0x8011('0x3a'),_0x8011('0x37'))[_0x8011('0x43')](_0x8011('0x3d'))[_0x8011('0x3f')](_0x8011('0x3e'))[_0x8011('0x3f')](_0x8011('0x40'),LISTID[_0x8011('0x3c')]())[_0x8011('0x3f')](_0x8011('0x46'),squel[_0x8011('0x47')](hopperContacts))[_0x8011('0x3f')]('phone\x20IS\x20NOT\x20NULL'))['toString']();return _0x5a1f8e;}return db[_0x8011('0x4a')][_0x8011('0x4b')]({'where':{'type':_0x8011('0x4c')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x8011('0x4d')],'as':_0x8011('0x4e'),'where':{'id':LISTID}}]})[_0x8011('0x4f')](function(_0x3af364){var _0x561aaa=[];if(_0x3af364){var _0x4baaf0;for(var _0x26bd3d=0x0,_0x1dd07c;_0x26bd3d<_0x3af364[_0x8011('0x1b')];_0x26bd3d+=0x1){_0x1dd07c=_0x3af364[_0x26bd3d][_0x8011('0x50')]({'plain':!![]});switch(_0x1dd07c[_0x8011('0x51')]){case _0x8011('0x52'):_0x561aaa['push'](db[_0x8011('0x53')][_0x8011('0x54')](_0x159a1a(_0x1dd07c,_0x8011('0x55')))[_0x8011('0x4f')](function(){})[_0x8011('0x2e')](_0x77c4ba()));break;case _0x8011('0x56'):_0x561aaa[_0x8011('0x2d')](db['sequelize'][_0x8011('0x54')](_0x3eca02(_0x1dd07c,_0x8011('0x55')))[_0x8011('0x4f')](function(){})[_0x8011('0x2e')](_0x77c4ba()));break;default:_0x561aaa[_0x8011('0x2d')](db[_0x8011('0x53')][_0x8011('0x54')](_0x416018(_0x1dd07c,_0x8011('0x55')))[_0x8011('0x4f')](function(){})[_0x8011('0x2e')](_0x77c4ba()));}}}return _0x561aaa;})[_0x8011('0x57')]()['then'](function(){return db[_0x8011('0x4a')]['findAll']({'where':{'type':_0x8011('0x4c')},'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x8011('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x540822){var _0x57bb5b=[];if(_0x540822){var _0x1ea707;for(var _0xc93e24=0x0,_0x406929;_0xc93e24<_0x540822[_0x8011('0x1b')];_0xc93e24+=0x1){_0x406929=_0x540822[_0xc93e24]['get']({'plain':!![]});_0x57bb5b['push'](db[_0x8011('0x53')][_0x8011('0x54')](_0x27506b(_0x406929,_0x8011('0x55')))['then'](function(){})[_0x8011('0x2e')](_0x77c4ba()));}}return _0x57bb5b;})[_0x8011('0x57')]();})['then'](function(){return db[_0x8011('0x59')][_0x8011('0x4b')]({'attributes':['id',_0x8011('0x51')],'include':[{'model':db[_0x8011('0x4d')],'as':_0x8011('0x4e'),'where':{'id':LISTID}}]})[_0x8011('0x4f')](function(_0x13972e){var _0x530638=[];if(_0x13972e){for(var _0x3912b9=0x0,_0x2896ff;_0x3912b9<_0x13972e[_0x8011('0x1b')];_0x3912b9+=0x1){_0x2896ff=_0x13972e[_0x3912b9][_0x8011('0x50')]({'plain':!![]});switch(_0x2896ff[_0x8011('0x51')]){case _0x8011('0x52'):_0x530638['push'](db['sequelize'][_0x8011('0x54')](_0x159a1a(_0x2896ff,_0x8011('0x5a')))[_0x8011('0x4f')](function(){})[_0x8011('0x2e')](_0x77c4ba()));break;case _0x8011('0x56'):_0x530638['push'](db['sequelize'][_0x8011('0x54')](_0x3eca02(_0x2896ff,_0x8011('0x5a')))[_0x8011('0x4f')](function(){})[_0x8011('0x2e')](_0x77c4ba()));break;default:_0x530638['push'](db[_0x8011('0x53')][_0x8011('0x54')](_0x416018(_0x2896ff,'CampaignId'))['then'](function(){})[_0x8011('0x2e')](_0x77c4ba()));}}}return _0x530638;})[_0x8011('0x57')]();})[_0x8011('0x4f')](function(){return db['Campaign'][_0x8011('0x4b')]({'attributes':['id'],'include':[{'model':db[_0x8011('0x4d')],'as':_0x8011('0x58'),'where':{'id':LISTID}}]})['then'](function(_0x36cedf){var _0x381acc=[];if(_0x36cedf){for(var _0x1957eb=0x0,_0x421243;_0x1957eb<_0x36cedf['length'];_0x1957eb+=0x1){_0x421243=_0x36cedf[_0x1957eb][_0x8011('0x50')]({'plain':!![]});_0x381acc[_0x8011('0x2d')](db[_0x8011('0x53')][_0x8011('0x54')](_0x27506b(_0x421243,_0x8011('0x5a')))[_0x8011('0x4f')](function(){})[_0x8011('0x2e')](_0x77c4ba()));}}return _0x381acc;})[_0x8011('0x57')]();})[_0x8011('0x2e')](function(_0x4b997f){logger[_0x8011('0x14')](_0x8011('0x5b'),_0x8011('0x5c'),_0x4b997f[_0x8011('0x1d')]);});}var processPromises=function(_0x2ea623){return BPromise[_0x8011('0x57')](promises)[_0x8011('0x4f')](function(_0x149516){})[_0x8011('0x2e')](function(_0x28d80c){logger[_0x8011('0x14')](_0x8011('0x5d'),JSON['stringify'](_0x28d80c));})[_0x8011('0x5e')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x2ea623){return _0x2ea623[_0x8011('0x5f')]();}});};var endCsv=function(){return BPromise[_0x8011('0x60')]()[_0x8011('0x4f')](function(){if(hopperContacts){return checkHopper();}})[_0x8011('0x4f')](function(){socket[_0x8011('0x61')](_0x8011('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x8011('0x63')](FILEPATH);}catch(_0x2a786a){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x8011('0x30')](_0x2a786a));}finally{process[_0x8011('0x64')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0x8011('0x65'));endCsv();});function main(){return BPromise[_0x8011('0x60')]()[_0x8011('0x4f')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x8011('0x11')](',');return db[_0x8011('0x2b')][_0x8011('0x4b')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x8011('0x4f')](function(_0x576e47){var _0x11b393=fs[_0x8011('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x8011('0x67')](_0x11b393,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5943f5,_0x4e9265){total+=0x1;var _0xd4d62b=total;promises[_0x8011('0x2d')](checkRow(_0x5943f5,_0x576e47,_0xd4d62b)[_0x8011('0x4f')](function(){success+=0x1;})[_0x8011('0x2e')](function(_0x17df77){if(_0x17df77[_0x8011('0x14')]){errors+=0x1;delete _0x17df77['error'];}else if(_0x17df77[_0x8011('0x68')]){duplicates+=0x1;delete _0x17df77[_0x8011('0x68')];}rows[_0x8011('0x2d')](_0x17df77);}));if(total%0xc8===0x0){_0x4e9265['pause']();return processPromises(_0x4e9265);}},'complete':function(){return processPromises()[_0x8011('0x4f')](function(){logger[_0x8011('0x69')](_0x8011('0x6a'));endCsv();});},'error':function(_0x3cc380,_0x3031b3){logger[_0x8011('0x69')](_0x8011('0x6b'),JSON['stringify'](_0x3cc380));endCsv();}});})['catch'](function(_0x3344e7){logger[_0x8011('0x14')](_0x8011('0x6c'),JSON[_0x8011('0x30')](_0x3344e7));});}main(); \ No newline at end of file +var _0x51bb=['scheduledAt','ContactId','createdAt','updatedAt','select','NOW()','toString','field','from','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','cm_contacts','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','cm_hopper_final','insert','cm_hopper_black','VoiceQueue','findAll','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','onlyIfOpen','all','outbound','BlackLists','get','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','resume','resolve','unlinkSync','exit','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','CSV\x20parsed\x20correctly!','info','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','papaparse','ioredis','../../../config/environment','../../../config/logger','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','undefined','Missing\x20filepath\x20parameter!','null','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','create','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','into','cm_hopper','fromQuery','phone'];(function(_0x180659,_0xa1b1c4){var _0x224761=function(_0xe29201){while(--_0xe29201){_0x180659['push'](_0x180659['shift']());}};_0x224761(++_0xa1b1c4);}(_0x51bb,0x179));var _0xb51b=function(_0x19a328,_0xee41ab){_0x19a328=_0x19a328-0x0;var _0x3cba4d=_0x51bb[_0x19a328];return _0x3cba4d;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0xb51b('0x0'));var fs=require('fs');var squel=require('squel');var Papa=require(_0xb51b('0x1'));var Redis=require(_0xb51b('0x2'));var db=require('../../../mysqldb')['db'];var config=require(_0xb51b('0x3'));var logger=require(_0xb51b('0x4'))('api');config['redis']=_[_0xb51b('0x5')](config['redis'],{'host':_0xb51b('0x6'),'port':0x18eb});var socket=require(_0xb51b('0x7'))(new Redis(config['redis']));require(_0xb51b('0x8'))[_0xb51b('0x9')](socket);try{if(!process['argv'][0x2]||process[_0xb51b('0xa')][0x2]===_0xb51b('0xb')||process['argv'][0x2]==='null'){throw new Error(_0xb51b('0xc'));}var FILEPATH=process['argv'][0x2];if(!process[_0xb51b('0xa')][0x3]||process['argv'][0x3]===_0xb51b('0xb')||process[_0xb51b('0xa')][0x3]===_0xb51b('0xd')||!process[_0xb51b('0xa')][0x4]||process[_0xb51b('0xa')][0x4]===_0xb51b('0xb')||process['argv'][0x4]===_0xb51b('0xd')){throw new Error(_0xb51b('0xe'));}var FIELDS=_[_0xb51b('0xf')](process['argv'][0x3][_0xb51b('0x10')](','),process['argv'][0x4][_0xb51b('0x10')](','));if(!process['argv'][0x5]||process[_0xb51b('0xa')][0x5]==='undefined'||process[_0xb51b('0xa')][0x5]==='null'){throw new Error(_0xb51b('0x11'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0xb51b('0xa')][0x6]&&process['argv'][0x6]!=='undefined'&&process[_0xb51b('0xa')][0x6]!==_0xb51b('0xd')?process[_0xb51b('0xa')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xb51b('0xa')][0x7]!==_0xb51b('0xb')&&process['argv'][0x7]!==_0xb51b('0xd')?process[_0xb51b('0xa')][0x7]:null;if(!process[_0xb51b('0xa')][0x8]||process[_0xb51b('0xa')][0x8]===_0xb51b('0xb')||process[_0xb51b('0xa')][0x8]===_0xb51b('0xd')){throw new Error(_0xb51b('0x12'));}var SOCKET_TIMESTAMP=process[_0xb51b('0xa')][0x8];}catch(_0xd96ddb){logger[_0xb51b('0x13')](_0xd96ddb);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(_0x267054,_0x1edea9,_0x4aa8e0,_0x3134db){var _0x597ae3={'message':_0x1edea9};_0x597ae3[_0x267054]=!![];if(_0x4aa8e0){_0x597ae3[_0xb51b('0x14')]=_0x4aa8e0;}if(_0x3134db){_0x597ae3['index']=_0x3134db;}return _0x597ae3;}function isEmail(_0xefe8e9){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'](_0xefe8e9);}function checkRow(_0x25174f,_0x5c34d6,_0x9fada3){return new BPromise(function(_0x4b629c,_0x1d2dcd){if(_[_0xb51b('0x15')](_0x25174f)){return _0x1d2dcd(handleCheckRowError('error',_0xb51b('0x16'),null,_0x9fada3));}if(_0x25174f[_0xb51b('0x17')]&&_0x25174f['errors'][_0xb51b('0x18')]){var _0x2fb03b=_['map'](_0x25174f['errors'],_0xb51b('0x19'))['join'](';');return _0x1d2dcd(handleCheckRowError('error',_0x2fb03b,null,_0x9fada3));}var _0x31acfc={};for(var _0x435484 in FIELDS){if(FIELDS[_0xb51b('0x1a')](_0x435484)&&FIELDS[_0x435484]){_0x31acfc[_0x435484]=_0x25174f[_0xb51b('0x1b')][0x0][FIELDS[_0x435484]]||_0x25174f[_0xb51b('0x1b')][0x0]['\ufeff'+FIELDS[_0x435484]];}}if(!_0x31acfc[_0xb51b('0x1c')]){return _0x1d2dcd(handleCheckRowError('error',_0xb51b('0x1d'),null,_0x9fada3));}if(!_0x31acfc['phone']){return _0x1d2dcd(handleCheckRowError(_0xb51b('0x13'),'phone\x20not\x20specified!',null,_0x9fada3));}if(_0x31acfc[_0xb51b('0x1e')]){var _0x30f2ed=moment(_0x31acfc[_0xb51b('0x1e')],_0xb51b('0x1f'));if(!_0x30f2ed[_0xb51b('0x20')]()){return _0x1d2dcd(handleCheckRowError('error',_0xb51b('0x21'),null,_0x9fada3));}}if(_0x31acfc[_0xb51b('0x22')]){if(!isEmail(_0x31acfc[_0xb51b('0x22')])){return _0x1d2dcd(handleCheckRowError('error',_0xb51b('0x23'),null,_0x9fada3));}}_0x31acfc[_0xb51b('0x24')]=LISTID;_0x31acfc[_0xb51b('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x5c34d6){var _0x1981c3={};for(var _0x1dbc6e=0x0,_0x333f03=DUPLICATES['length'];_0x1dbc6e<_0x333f03;_0x1dbc6e+=0x1){_0x1981c3[DUPLICATES[_0x1dbc6e]]=_0x31acfc[DUPLICATES[_0x1dbc6e]];}var _0x3cc458=_[_0xb51b('0x26')](_0x5c34d6,_0x1981c3);if(_0x3cc458){return _0x1d2dcd(handleCheckRowError(_0xb51b('0x27'),'Duplicate\x20Contact',_0x3cc458,_0x9fada3));}}return db['CmContact'][_0xb51b('0x28')](_0x31acfc,{'raw':!![],'hooks':![],'fields':_[_0xb51b('0x29')](_0x31acfc)})[_0xb51b('0x2a')](function(_0x5a1484){if(DUPLICATES&&DUPLICATES[_0xb51b('0x18')]&&_0x5c34d6){_0x5c34d6[_0xb51b('0x2b')](_[_0xb51b('0x2c')](_0x31acfc,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x5a1484['id'];return _0x4b629c();})[_0xb51b('0x2d')](function(_0x511102){return _0x1d2dcd(handleCheckRowError(_0xb51b('0x13'),_0xb51b('0x2e')+(_0x511102[_0xb51b('0x19')]||JSON[_0xb51b('0x2f')](_0x511102)),null,_0x9fada3));});});}function checkHopper(){function _0x28575e(){return function(_0x193f94){logger[_0xb51b('0x13')](_0xb51b('0x30'),_0xb51b('0x31'),util[_0xb51b('0x32')](_0x193f94,{'showHidden':![],'depth':null}));};}var _0x458400=function(_0x2cebec,_0x3d8f76){var _0x37b5e2=squel['insert']()[_0xb51b('0x33')](_0xb51b('0x34'))[_0xb51b('0x35')]([_0xb51b('0x36'),_0xb51b('0x37'),_0xb51b('0x38'),_0xb51b('0x24'),_0x3d8f76,_0xb51b('0x39'),_0xb51b('0x3a')],squel[_0xb51b('0x3b')]()['field'](_0xb51b('0x36'),'phone')['field'](_0xb51b('0x3c'),'scheduledAt')['field']('id',_0xb51b('0x38'))['field'](LISTID[_0xb51b('0x3d')](),_0xb51b('0x24'))[_0xb51b('0x3e')](_0x2cebec['id']['toString'](),_0x3d8f76)['field'](_0xb51b('0x3c'),'createdAt')[_0xb51b('0x3e')](_0xb51b('0x3c'),'updatedAt')[_0xb51b('0x3f')]('cm_contacts')[_0xb51b('0x40')](_0xb51b('0x41'))[_0xb51b('0x40')](_0xb51b('0x42'),LISTID[_0xb51b('0x3d')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0xb51b('0x40')](_0xb51b('0x43'),squel[_0xb51b('0x3b')]()['field'](_0xb51b('0x36'))['from']('cm_hopper')[_0xb51b('0x40')](_0x3d8f76+_0xb51b('0x44'),_0x2cebec['id'][_0xb51b('0x3d')]())))[_0xb51b('0x3d')]();return _0x37b5e2;};var _0x5f49c5=function(_0x40f26a,_0x533e22){var _0x3fc650=squel['insert']()[_0xb51b('0x33')](_0xb51b('0x34'))[_0xb51b('0x35')]([_0xb51b('0x36'),_0xb51b('0x37'),'ContactId',_0xb51b('0x24'),_0x533e22,_0xb51b('0x39'),_0xb51b('0x3a')],squel[_0xb51b('0x3b')]()[_0xb51b('0x3e')](_0xb51b('0x36'),_0xb51b('0x36'))[_0xb51b('0x3e')]('NOW()',_0xb51b('0x37'))[_0xb51b('0x3e')]('id',_0xb51b('0x38'))[_0xb51b('0x3e')](LISTID[_0xb51b('0x3d')](),'ListId')[_0xb51b('0x3e')](_0x40f26a['id']['toString'](),_0x533e22)[_0xb51b('0x3e')](_0xb51b('0x3c'),_0xb51b('0x39'))[_0xb51b('0x3e')]('NOW()',_0xb51b('0x3a'))[_0xb51b('0x3f')](_0xb51b('0x45'))[_0xb51b('0x40')](_0xb51b('0x41'))[_0xb51b('0x40')](_0xb51b('0x42'),LISTID[_0xb51b('0x3d')]())[_0xb51b('0x40')](_0xb51b('0x46'),squel[_0xb51b('0x47')](hopperContacts))['where'](_0xb51b('0x48'))[_0xb51b('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0xb51b('0x3b')]()[_0xb51b('0x3e')]('calleridnum')[_0xb51b('0x3f')](_0xb51b('0x49'))[_0xb51b('0x40')](_0x533e22+_0xb51b('0x44'),_0x40f26a['id'][_0xb51b('0x3d')]()))[_0xb51b('0x40')](_0xb51b('0x43'),squel['select']()[_0xb51b('0x3e')](_0xb51b('0x36'))['from']('cm_hopper')['where'](_0x533e22+_0xb51b('0x44'),_0x40f26a['id']['toString']())))['toString']();return _0x3fc650;};function _0x3ea956(_0x3d4ad5,_0x43e7b4){var _0x32e85e=squel[_0xb51b('0x4a')]()[_0xb51b('0x33')](_0xb51b('0x34'))[_0xb51b('0x35')](['phone','scheduledAt',_0xb51b('0x38'),_0xb51b('0x24'),_0x43e7b4,_0xb51b('0x39'),'updatedAt'],squel['select']()[_0xb51b('0x3e')](_0xb51b('0x36'),_0xb51b('0x36'))[_0xb51b('0x3e')](_0xb51b('0x3c'),_0xb51b('0x37'))[_0xb51b('0x3e')]('id',_0xb51b('0x38'))[_0xb51b('0x3e')](LISTID['toString'](),_0xb51b('0x24'))[_0xb51b('0x3e')](_0x3d4ad5['id'][_0xb51b('0x3d')](),_0x43e7b4)['field']('NOW()',_0xb51b('0x39'))[_0xb51b('0x3e')](_0xb51b('0x3c'),'updatedAt')[_0xb51b('0x3f')](_0xb51b('0x45'))[_0xb51b('0x40')]('deletedAt\x20IS\x20NULL')[_0xb51b('0x40')](_0xb51b('0x42'),LISTID['toString']())[_0xb51b('0x40')](_0xb51b('0x46'),squel['str'](hopperContacts))[_0xb51b('0x40')]('phone\x20IS\x20NOT\x20NULL'))[_0xb51b('0x3d')]();return _0x32e85e;}function _0x49daf0(_0x59795b,_0xb0f670){var _0x55ff56=squel[_0xb51b('0x4a')]()[_0xb51b('0x33')](_0xb51b('0x4b'))[_0xb51b('0x35')]([_0xb51b('0x36'),_0xb51b('0x38'),_0xb51b('0x24'),_0xb0f670,_0xb51b('0x39'),_0xb51b('0x3a')],squel[_0xb51b('0x3b')]()['field']('phone','phone')[_0xb51b('0x3e')]('id',_0xb51b('0x38'))[_0xb51b('0x3e')](LISTID['toString'](),_0xb51b('0x24'))['field'](_0x59795b['id'][_0xb51b('0x3d')](),_0xb0f670)[_0xb51b('0x3e')]('NOW()','createdAt')['field'](_0xb51b('0x3c'),_0xb51b('0x3a'))[_0xb51b('0x3f')](_0xb51b('0x45'))['where'](_0xb51b('0x41'))['where'](_0xb51b('0x42'),LISTID[_0xb51b('0x3d')]())['where'](_0xb51b('0x46'),squel[_0xb51b('0x47')](hopperContacts))[_0xb51b('0x40')](_0xb51b('0x48')))[_0xb51b('0x3d')]();return _0x55ff56;}return db[_0xb51b('0x4c')][_0xb51b('0x4d')]({'where':{'type':'outbound'},'attributes':['id',_0xb51b('0x4e')],'include':[{'model':db[_0xb51b('0x4f')],'as':_0xb51b('0x50'),'where':{'id':LISTID}}]})[_0xb51b('0x2a')](function(_0x2d5f1d){var _0x4aa26b=[];if(_0x2d5f1d){var _0x4db48f;for(var _0x53ffe2=0x0,_0x4c6bd6;_0x53ffe2<_0x2d5f1d['length'];_0x53ffe2+=0x1){_0x4c6bd6=_0x2d5f1d[_0x53ffe2]['get']({'plain':!![]});switch(_0x4c6bd6[_0xb51b('0x4e')]){case _0xb51b('0x51'):_0x4aa26b[_0xb51b('0x2b')](db[_0xb51b('0x52')][_0xb51b('0x53')](_0x5f49c5(_0x4c6bd6,_0xb51b('0x54')))['then'](function(){})[_0xb51b('0x2d')](_0x28575e()));break;case _0xb51b('0x55'):_0x4aa26b['push'](db[_0xb51b('0x52')][_0xb51b('0x53')](_0x458400(_0x4c6bd6,_0xb51b('0x54')))[_0xb51b('0x2a')](function(){})[_0xb51b('0x2d')](_0x28575e()));break;default:_0x4aa26b[_0xb51b('0x2b')](db['sequelize'][_0xb51b('0x53')](_0x3ea956(_0x4c6bd6,_0xb51b('0x54')))[_0xb51b('0x2a')](function(){})[_0xb51b('0x2d')](_0x28575e()));}}}return _0x4aa26b;})[_0xb51b('0x56')]()[_0xb51b('0x2a')](function(){return db[_0xb51b('0x4c')][_0xb51b('0x4d')]({'where':{'type':_0xb51b('0x57')},'attributes':['id'],'include':[{'model':db[_0xb51b('0x4f')],'as':_0xb51b('0x58'),'where':{'id':LISTID}}]})[_0xb51b('0x2a')](function(_0xa35853){var _0x87bd05=[];if(_0xa35853){var _0x3ef553;for(var _0x41d380=0x0,_0x512305;_0x41d380<_0xa35853[_0xb51b('0x18')];_0x41d380+=0x1){_0x512305=_0xa35853[_0x41d380][_0xb51b('0x59')]({'plain':!![]});_0x87bd05['push'](db[_0xb51b('0x52')][_0xb51b('0x53')](_0x49daf0(_0x512305,_0xb51b('0x54')))[_0xb51b('0x2a')](function(){})[_0xb51b('0x2d')](_0x28575e()));}}return _0x87bd05;})['all']();})[_0xb51b('0x2a')](function(){return db[_0xb51b('0x5a')][_0xb51b('0x4d')]({'attributes':['id',_0xb51b('0x4e')],'include':[{'model':db[_0xb51b('0x4f')],'as':_0xb51b('0x50'),'where':{'id':LISTID}}]})[_0xb51b('0x2a')](function(_0x208c75){var _0x19ce12=[];if(_0x208c75){for(var _0x2d838f=0x0,_0x465164;_0x2d838f<_0x208c75[_0xb51b('0x18')];_0x2d838f+=0x1){_0x465164=_0x208c75[_0x2d838f][_0xb51b('0x59')]({'plain':!![]});switch(_0x465164[_0xb51b('0x4e')]){case _0xb51b('0x51'):_0x19ce12['push'](db[_0xb51b('0x52')]['query'](_0x5f49c5(_0x465164,_0xb51b('0x5b')))[_0xb51b('0x2a')](function(){})['catch'](_0x28575e()));break;case _0xb51b('0x55'):_0x19ce12[_0xb51b('0x2b')](db[_0xb51b('0x52')]['query'](_0x458400(_0x465164,_0xb51b('0x5b')))[_0xb51b('0x2a')](function(){})['catch'](_0x28575e()));break;default:_0x19ce12[_0xb51b('0x2b')](db[_0xb51b('0x52')]['query'](_0x3ea956(_0x465164,'CampaignId'))[_0xb51b('0x2a')](function(){})['catch'](_0x28575e()));}}}return _0x19ce12;})['all']();})['then'](function(){return db['Campaign'][_0xb51b('0x4d')]({'attributes':['id'],'include':[{'model':db[_0xb51b('0x4f')],'as':_0xb51b('0x58'),'where':{'id':LISTID}}]})[_0xb51b('0x2a')](function(_0x4cdb4d){var _0x13dead=[];if(_0x4cdb4d){for(var _0x480690=0x0,_0x151e75;_0x480690<_0x4cdb4d[_0xb51b('0x18')];_0x480690+=0x1){_0x151e75=_0x4cdb4d[_0x480690][_0xb51b('0x59')]({'plain':!![]});_0x13dead[_0xb51b('0x2b')](db[_0xb51b('0x52')][_0xb51b('0x53')](_0x49daf0(_0x151e75,_0xb51b('0x5b')))['then'](function(){})[_0xb51b('0x2d')](_0x28575e()));}}return _0x13dead;})[_0xb51b('0x56')]();})[_0xb51b('0x2d')](function(_0x47af13){logger['error'](_0xb51b('0x5c'),_0xb51b('0x5d'),_0x47af13[_0xb51b('0x19')]);});}var processPromises=function(_0x5d842d){return BPromise[_0xb51b('0x56')](promises)[_0xb51b('0x2a')](function(_0x36c622){})['catch'](function(_0x1a772c){logger['error'](_0xb51b('0x5e'),JSON[_0xb51b('0x2f')](_0x1a772c));})[_0xb51b('0x5f')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x5d842d){return _0x5d842d[_0xb51b('0x60')]();}});};var endCsv=function(){return BPromise[_0xb51b('0x61')]()[_0xb51b('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0xb51b('0x2a')](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xb51b('0x62')](FILEPATH);}catch(_0x4d75ae){logger[_0xb51b('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xb51b('0x2f')](_0x4d75ae));}finally{process[_0xb51b('0x63')](0x0);}});};process['on']('SIGINT',function(){logger['info'](_0xb51b('0x64'));endCsv();});function main(){return BPromise[_0xb51b('0x61')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xb51b('0x65')][_0xb51b('0x4d')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0x2a87ee){var _0xa7b83b=fs[_0xb51b('0x66')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xb51b('0x67')](_0xa7b83b,{'header':!![],'skipEmptyLines':!![],'step':function(_0x1d0233,_0x169f98){total+=0x1;var _0x5485fe=total;promises[_0xb51b('0x2b')](checkRow(_0x1d0233,_0x2a87ee,_0x5485fe)[_0xb51b('0x2a')](function(){success+=0x1;})[_0xb51b('0x2d')](function(_0x1ad91c){if(_0x1ad91c[_0xb51b('0x13')]){errors+=0x1;delete _0x1ad91c['error'];}else if(_0x1ad91c[_0xb51b('0x27')]){duplicates+=0x1;delete _0x1ad91c[_0xb51b('0x27')];}rows[_0xb51b('0x2b')](_0x1ad91c);}));if(total%0xc8===0x0){_0x169f98['pause']();return processPromises(_0x169f98);}},'complete':function(){return processPromises()[_0xb51b('0x2a')](function(){logger['info'](_0xb51b('0x68'));endCsv();});},'error':function(_0x391b97,_0x5c3508){logger[_0xb51b('0x69')](_0xb51b('0x6a'),JSON[_0xb51b('0x2f')](_0x391b97));endCsv();}});})['catch'](function(_0x324a23){logger[_0xb51b('0x13')](_0xb51b('0x6b'),JSON[_0xb51b('0x2f')](_0x324a23));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 78f1c07..bb02a15 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 _0x78c2=['find','_description','trim','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','email','email\x20wrong\x20format','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','hasOwnProperty','replace','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','SystemError','step','cm_contacts_','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','CREATE\x20TABLE\x20','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','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',',\x20scheduledAt\x20=\x20NOW()','duplicates','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','voice_queues_has_cm_lists','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns','campaigns_has_cm_blacklists','CampaignId','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','root','server/files/tmp','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','SIGINT','path','lodash','papaparse','util','moment','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','defaults','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','select','field','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','then','push','all','AdditionalPhones','split','length','CmContactHasItem','update','updated','create','PHONE','inserted','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','phone','scheduledat','ListId','createdAt','updatedAt','UserId','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','cm_hopper','toString','cm_hopper_black','cm_contacts','ListId\x20=\x20?','date_add(cm_contacts.scheduledat,interval\x20','.offset-cm_contacts.utcOffset\x20minute)','ContactId','priority','recallme','\x22onlyIfOpen\x22','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_contact_has_items.updatedAt','cm_hopper_additional_phones','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','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','query','spread','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists','campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId','catch','voice_queues.id','voice_queues.dialTimezone','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','voice_queues_has_cm_lists.CmListId=','timezones','dialTimezone','isNil','utcOffset','offset','set','main','stringify','binding','clone','socket_timestamp','.csv','keys','includes','header','ContactItemType','findAll','name','writeFileSync','parse','createReadStream','data'];(function(_0xc53cc5,_0x7d229e){var _0x394081=function(_0x44eb1d){while(--_0x44eb1d){_0xc53cc5['push'](_0xc53cc5['shift']());}};_0x394081(++_0x7d229e);}(_0x78c2,0x1bc));var _0x278c=function(_0x1dd122,_0x4dcca5){_0x1dd122=_0x1dd122-0x0;var _0x4e3713=_0x78c2[_0x1dd122];return _0x4e3713;};'use strict';var fs=require('fs');var path=require(_0x278c('0x0'));var _=require(_0x278c('0x1'));var Papa=require(_0x278c('0x2'));var util=require(_0x278c('0x3'));var BPromise=require('bluebird');var moment=require(_0x278c('0x4'));var squel=require(_0x278c('0x5'));var Redis=require(_0x278c('0x6'));var db=require(_0x278c('0x7'))['db'];var config=require(_0x278c('0x8'));var shared=require('../../../config/environment/shared');var logger=require(_0x278c('0x9'))(_0x278c('0xa'));config['redis']=_[_0x278c('0xb')](config[_0x278c('0xc')],{'host':_0x278c('0xd'),'port':0x18eb});var socket=require(_0x278c('0xe'))(new Redis(config[_0x278c('0xc')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x278c('0xf')](_0x278c('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x278c('0xf')](_0x278c('0x10'));function isEmail(_0x47b2d8){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'](_0x47b2d8);}function selectNotIn(_0x133da1,_0x309d63,_0x578c3a,_0x2bff5d,_0x28736b){return squel[_0x278c('0x11')]()[_0x278c('0x12')]('phone')[_0x278c('0x13')](_0x2bff5d)[_0x278c('0x14')](_0x309d63,null,_0x309d63+_0x278c('0x15')+_0x2bff5d+'.'+_0x578c3a)[_0x278c('0x16')](_0x2bff5d+'.'+_0x578c3a+_0x278c('0x17')+_0x133da1+'.'+_0x578c3a)[_0x278c('0x16')](_0x309d63+_0x278c('0x18')+_0x28736b[_0x278c('0x14')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4efaec,_0x504c8f){promisesAdditionalPhones=[];return db[_0x278c('0x19')]['findAll']({'raw':!![],'attributes':['id','AdditionalPhones'],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x278c('0x1a')](function(_0x2bf528){if(_0x2bf528!==null){var _0x5bf57f=[];for(var _0x4acb26=0x0;_0x4acb26<_0x2bf528['length'];_0x4acb26++){var _0x314b00=_0x2bf528[_0x4acb26];_0x5bf57f[_0x278c('0x1b')](insertAdditionalPhones(_0x314b00));}}Promise[_0x278c('0x1c')](_0x5bf57f)[_0x278c('0x1a')](function(){_0x4efaec({'val':0x1});});});});}function insertAdditionalPhones(_0xd49bda){return new Promise(function(_0x182053,_0x4ca0ec){var _0x4452e6=_0xd49bda[_0x278c('0x1d')];var _0x45cb5c=_0x4452e6[_0x278c('0x1e')](';');var _0x1cba58=[];orderBy=0x0;for(var _0x3c730e=0x0;_0x3c730e<_0x45cb5c[_0x278c('0x1f')];_0x3c730e++){_0x1cba58[_0x278c('0x1b')](splitAdditionalPhone(_0xd49bda['id'],_0x45cb5c[_0x3c730e]));}Promise['all'](_0x1cba58)['then'](function(){_0x182053({'val':_0x45cb5c[_0x278c('0x1f')]});});});}function splitAdditionalPhone(_0x3fadb5,_0x41e255){return new Promise(function(_0x2a8701,_0x3ccd9e){var _0x1f2e6d=_0x41e255[_0x278c('0x1e')](':');var _0x5538af=_0x1f2e6d[0x0];var _0x1d4c5b=_0x1f2e6d[0x1];if(!_['isNil'](_0x1d4c5b)){var _0x4b0306=_0x1d4c5b[_0x278c('0x1e')]('|');var _0x26d60f=[];for(var _0x167aac=0x0;_0x167aac<_0x4b0306[_0x278c('0x1f')];_0x167aac++){if(_0x4b0306[_0x167aac]!==''){var _0x515e80=_['filter'](promisesAdditionalPhones,{'contactId':_0x3fadb5,'phone':_0x4b0306[_0x167aac]});if(_0x515e80[_0x278c('0x1f')]==0x0){orderBy++;promisesAdditionalPhones[_0x278c('0x1b')]({'contactId':_0x3fadb5,'contactTypeId':_0x5538af,'phone':_0x4b0306[_0x167aac],'orderBy':orderBy});}}}_0x2a8701({'ok':0x1});}else _0x2a8701({'res':0x0});});}function createAdditionalPhone(_0x4468b0,_0x2b95b0,_0x22bda0,_0x538425){var _0x3d04da='';var _0x5efd5e='';var _0x463cbb=_0x22bda0[_0x278c('0x1e')]('§');_0x3d04da=_0x463cbb[0x0];if(_0x463cbb['length']==0x2)_0x5efd5e=_0x463cbb[0x1];return new Promise(function(_0x339729,_0x2b99d3){return db[_0x278c('0x20')]['findOne']({'where':{'CmContactId':_0x4468b0,'item':_0x3d04da}})[_0x278c('0x1a')](function(_0x44143a){if(_0x44143a){return db['CmContactHasItem'][_0x278c('0x21')]({'ItemTypeId':_0x2b95b0,'description':_0x5efd5e,'OrderBy':_0x538425},{'where':{'CmContactId':_0x4468b0,'item':_0x3d04da}})[_0x278c('0x1a')](function(_0x3e5e6e){_0x339729({'res':_0x278c('0x22')});});}else{return db[_0x278c('0x20')][_0x278c('0x23')]({'CmContactId':_0x4468b0,'item':_0x3d04da,'description':_0x5efd5e,'ItemTypeId':_0x2b95b0,'OrderBy':_0x538425,'ItemClass':_0x278c('0x24')})[_0x278c('0x1a')](function(_0x23020b){_0x339729({'res':_0x278c('0x25')});});}});});}function insertCmHopper(_0x53be46,_0x54484c,_0x3f3a77,_0x2d577a,_0x1b4568){var _0x51d829=[_0x278c('0x26'),'cm_contacts.scheduledat',_0x278c('0x27'),_0x278c('0x28'),_0x54484c+'.'+_0x2d577a,_0x278c('0x29'),_0x278c('0x2a'),_0x278c('0x2b'),_0x278c('0x2c'),'\x22'+_0x1b4568+'\x22'];return squel[_0x278c('0x2d')]()[_0x278c('0x2e')]('cm_hopper')[_0x278c('0x2f')]([_0x278c('0x30'),_0x278c('0x31'),'ContactId',_0x278c('0x32'),_0x2d577a,_0x278c('0x33'),_0x278c('0x34'),'priority',_0x278c('0x35'),'recallme'],squel[_0x278c('0x11')]()[_0x278c('0x36')](_0x51d829)['from'](_0x54484c)['join']('cm_contacts',null,_0x278c('0x37')+_0x54484c+_0x278c('0x38'))[_0x278c('0x14')](_0x3f3a77,null,_0x3f3a77+'.id\x20=\x20'+_0x54484c+'.'+_0x2d577a)[_0x278c('0x16')](_0x54484c+_0x278c('0x39'),_0x53be46)[_0x278c('0x16')](_0x278c('0x3a'),NOW)[_0x278c('0x16')](_0x278c('0x3b'),selectNotIn(_0x54484c,_0x3f3a77,_0x2d577a,'cm_hopper',[_0x278c('0x3c'),'\x22onlyIfOpen\x22']))[_0x278c('0x16')](_0x278c('0x3b'),selectNotIn(_0x54484c,_0x3f3a77,_0x2d577a,_0x278c('0x3d'),[_0x278c('0x3c')])))[_0x278c('0x3e')]();}function insertCmHopperBlack(_0x3fb13e,_0x46758e,_0x41d595,_0x2463d9){var _0x45851f=[_0x278c('0x26'),_0x278c('0x27'),_0x278c('0x28'),_0x46758e+'.'+_0x2463d9,_0x278c('0x29'),_0x278c('0x2a')];return squel['insert']()[_0x278c('0x2e')](_0x278c('0x3f'))[_0x278c('0x2f')]([_0x278c('0x30'),'ContactId','ListId',_0x2463d9,'createdAt',_0x278c('0x34')],squel[_0x278c('0x11')]()['fields'](_0x45851f)[_0x278c('0x13')](_0x46758e)[_0x278c('0x14')](_0x278c('0x40'),null,_0x278c('0x37')+_0x46758e+_0x278c('0x38'))['join'](_0x41d595,null,_0x41d595+_0x278c('0x15')+_0x46758e+'.'+_0x2463d9)['where'](_0x46758e+_0x278c('0x39'),_0x3fb13e)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x278c('0x16')](_0x278c('0x3b'),squel[_0x278c('0x11')]()['field'](_0x278c('0x30'))['from'](_0x278c('0x3f'))['where'](_0x278c('0x41'),_0x3fb13e)[_0x278c('0x16')](_0x2463d9+_0x278c('0x17')+_0x46758e+'.'+_0x2463d9)))['toString']();}function insertTzCmHopper(_0x231aed,_0x1460a3,_0x22c0b4,_0x99a5c9,_0x1a267e,_0x26351b){var _0xf55daf=['cm_contacts.phone',_0x278c('0x42')+_0x26351b+_0x278c('0x43'),_0x278c('0x27'),'cm_contacts.ListId',_0x1460a3+'.'+_0x99a5c9,'cm_contacts.createdAt','cm_contacts.updatedAt',_0x278c('0x2b'),_0x278c('0x2c'),'\x22'+_0x1a267e+'\x22'];var _0x2dce5b=squel[_0x278c('0x2d')]()[_0x278c('0x2e')](_0x278c('0x3d'))[_0x278c('0x2f')](['phone','scheduledat',_0x278c('0x44'),_0x278c('0x32'),_0x99a5c9,_0x278c('0x33'),_0x278c('0x34'),_0x278c('0x45'),_0x278c('0x35'),_0x278c('0x46')],squel[_0x278c('0x11')]()[_0x278c('0x36')](_0xf55daf)[_0x278c('0x13')](_0x1460a3)[_0x278c('0x14')](_0x278c('0x40'),null,_0x278c('0x37')+_0x1460a3+_0x278c('0x38'))['join'](_0x22c0b4,null,_0x22c0b4+_0x278c('0x15')+_0x1460a3+'.'+_0x99a5c9)[_0x278c('0x14')](_0x26351b,null,_0x26351b+_0x278c('0x15')+_0x1460a3+'.'+_0x99a5c9)['where'](_0x1460a3+_0x278c('0x39'),_0x231aed)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0x278c('0x16')](_0x278c('0x3b'),selectNotIn(_0x1460a3,_0x22c0b4,_0x99a5c9,_0x278c('0x3d'),['\x22always\x22',_0x278c('0x47')]))[_0x278c('0x16')](_0x278c('0x3b'),selectNotIn(_0x1460a3,_0x22c0b4,_0x99a5c9,'cm_hopper',['\x22always\x22'])))['toString']();return _0x2dce5b;}function insertTzCmHopperBlack(_0x5d27f3,_0x5abec7,_0x125a1c,_0x25a215){var _0xfcadcc=[_0x278c('0x26'),_0x278c('0x27'),_0x278c('0x28'),_0x5abec7+'.'+_0x25a215,_0x278c('0x29'),'cm_contacts.updatedAt'];return squel[_0x278c('0x2d')]()[_0x278c('0x2e')](_0x278c('0x3f'))[_0x278c('0x2f')]([_0x278c('0x30'),_0x278c('0x44'),_0x278c('0x32'),_0x25a215,_0x278c('0x33'),_0x278c('0x34')],squel[_0x278c('0x11')]()[_0x278c('0x36')](_0xfcadcc)[_0x278c('0x13')](_0x5abec7)[_0x278c('0x14')](_0x278c('0x40'),null,'cm_contacts.ListId\x20=\x20'+_0x5abec7+_0x278c('0x38'))[_0x278c('0x14')](_0x125a1c,null,_0x125a1c+_0x278c('0x15')+_0x5abec7+'.'+_0x25a215)[_0x278c('0x16')](_0x5abec7+_0x278c('0x39'),_0x5d27f3)[_0x278c('0x16')](_0x278c('0x3a'),NOW)[_0x278c('0x16')](_0x278c('0x3b'),squel['select']()[_0x278c('0x12')](_0x278c('0x30'))[_0x278c('0x13')](_0x278c('0x3f'))[_0x278c('0x16')]('ListId\x20=\x20?',_0x5d27f3)[_0x278c('0x16')](_0x25a215+_0x278c('0x17')+_0x5abec7+'.'+_0x25a215)))[_0x278c('0x3e')]();}function insertCmHopperAdditionalPhones(_0x458eee){var _0x5e354e=[_0x278c('0x48'),_0x278c('0x49'),_0x278c('0x4a'),_0x278c('0x4b'),_0x278c('0x4c')];return squel[_0x278c('0x2d')]()['into'](_0x278c('0x4d'))['fromQuery'](['CmHopperId','phone','OrderBy',_0x278c('0x33'),'updatedAt'],squel[_0x278c('0x11')]()[_0x278c('0x36')](_0x5e354e)[_0x278c('0x13')](_0x278c('0x3d'))['join'](_0x278c('0x40'),null,_0x278c('0x4e'))[_0x278c('0x14')](_0x278c('0x4f'),null,_0x278c('0x50'))[_0x278c('0x16')](_0x278c('0x51'),_0x458eee)[_0x278c('0x16')](_0x278c('0x3a'),NOW))[_0x278c('0x3e')]();}function insertCmContact(_0x1e8983,_0x12f96d,_0x16efbf,_0xb4ef4f){var _0x3ce1ba=_[_0x278c('0x52')](_['keys'](_0xb4ef4f),[_0x278c('0x32'),_0x278c('0x53'),_0x278c('0x33'),_0x278c('0x34'),_0x278c('0x54')]);return squel[_0x278c('0x2d')]()[_0x278c('0x2e')](_0x278c('0x40'))[_0x278c('0x2f')](_0x3ce1ba,squel[_0x278c('0x11')]()[_0x278c('0x36')](_0x3ce1ba)[_0x278c('0x13')](_0x12f96d)[_0x278c('0x16')]('('+_0x16efbf[_0x278c('0x14')](',')+_0x278c('0x55'),squel['select']()[_0x278c('0x36')](_0x16efbf)[_0x278c('0x13')](_0x278c('0x40'))[_0x278c('0x16')](_0x278c('0x41'),_0x1e8983)[_0x278c('0x16')](_0x278c('0x56')))[_0x278c('0x16')](_0x278c('0x57'),squel['select']()['field'](_0x278c('0x58'),_0x278c('0x59'))[_0x278c('0x13')](_0x12f96d)[_0x278c('0x5a')](_0x16efbf[_0x278c('0x14')](','))))['toString']();}function handleStop(){logger[_0x278c('0x5b')](_0x278c('0x5c'));stopped=!![];}function handleUncaughtException(_0x267da9){logger[_0x278c('0x5d')](_0x267da9[_0x278c('0x5e')]);process[_0x278c('0x5f')](0x1);}function handleError(_0x4af79c,_0x202e8b){stats[_0x278c('0x60')][_0x278c('0x1b')]({'name':_0x202e8b[_0x278c('0x61')],'message':_0x202e8b[_0x278c('0x5e')],'row':_0x4af79c});}function handleQuery(_0x56397b){logger[_0x278c('0x5b')](_0x56397b);return db[_0x278c('0x62')][_0x278c('0x63')](_0x56397b)[_0x278c('0x64')](function(_0x52c8ff){results['push'](_0x52c8ff);})['catch'](function(_0x1a143e){logger['error'](_0x1a143e[_0x278c('0x5e')]);});}function updateTzCampaigns(_0x99faf3){return new Promise(function(_0x280aea,_0x3951d2){var _0x4d1d5c=squel[_0x278c('0x11')]()[_0x278c('0x36')]([_0x278c('0x65'),_0x278c('0x66')])['from']('campaigns')[_0x278c('0x14')](_0x278c('0x67'),null,_0x278c('0x68'))[_0x278c('0x16')]('campaigns_has_cm_lists.CmListId='+_0x99faf3);db[_0x278c('0x62')]['query'](_0x4d1d5c[_0x278c('0x3e')]())[_0x278c('0x64')](function(_0x28a197){var _0x5c39fc=[];for(var _0x2c72de=0x0;_0x2c72de<_0x28a197[_0x278c('0x1f')];_0x2c72de++){_0x5c39fc[_0x278c('0x1b')](getTimezoneData(_0x28a197[_0x2c72de],tmp_campaigns));}BPromise['all'](_0x5c39fc)['then'](function(){_0x280aea({'val':0x1});});})[_0x278c('0x69')](function(_0x50f957){logger['error'](_0x50f957[_0x278c('0x5e')]);_0x280aea({'val':0x0});});});}function updateTzVoiceQueues(_0x3181d1){return new Promise(function(_0x4a85c7,_0x59323d){var _0x3d7a82=squel[_0x278c('0x11')]()['fields']([_0x278c('0x6a'),_0x278c('0x6b')])[_0x278c('0x13')]('voice_queues')[_0x278c('0x14')]('voice_queues_has_cm_lists',null,_0x278c('0x6c'))[_0x278c('0x16')](_0x278c('0x6d')+_0x3181d1);db['sequelize'][_0x278c('0x63')](_0x3d7a82[_0x278c('0x3e')]())['spread'](function(_0x38bc12){var _0x5041f2=[];for(var _0x19341f=0x0;_0x19341f<_0x38bc12[_0x278c('0x1f')];_0x19341f++){_0x5041f2[_0x278c('0x1b')](getTimezoneData(_0x38bc12[_0x19341f],tmp_voice_queues));}BPromise[_0x278c('0x1c')](_0x5041f2)[_0x278c('0x1a')](function(){_0x4a85c7({'val':0x1});});})[_0x278c('0x69')](function(_0x11cd3f){logger['error'](_0x11cd3f[_0x278c('0x5e')]);_0x4a85c7({'val':0x0});});});}function getTimezoneData(_0x368e71,_0x4ab206){return new Promise(function(_0x12825f,_0x5bd2ce){var _0xde0e72=shared[_0x278c('0x6e')];var _0x200332=_0xde0e72[_0x368e71[_0x278c('0x6f')]];if(_[_0x278c('0x70')](_0x200332)){_0x12825f({'ret':0x1});}else{var _0x5226f0=_0x200332[_0x278c('0x71')];var _0x2672e2=squel[_0x278c('0x2d')]()[_0x278c('0x2e')](_0x4ab206)['set']('id',_0x368e71['id'])['set'](_0x278c('0x72'),_0x5226f0)[_0x278c('0x73')](_0x278c('0x6f'),_0x368e71[_0x278c('0x6f')])[_0x278c('0x3e')]();return db[_0x278c('0x62')][_0x278c('0x63')](_0x2672e2)[_0x278c('0x64')](function(_0x3bcae2){_0x12825f({'ret':0x1});})['catch'](function(_0x24b054){logger[_0x278c('0x5d')](_0x24b054[_0x278c('0x5e')]);_0x5bd2ce({'ret':0x1});});}});}function handleTZQuery(_0x5db6b1){logger[_0x278c('0x5b')](_0x5db6b1);return db[_0x278c('0x62')][_0x278c('0x63')](_0x5db6b1)['spread'](function(_0x480386){})['catch'](function(_0x5fd55e){logger[_0x278c('0x5d')](_0x5fd55e['message']);});}function main(_0x4e968d,_0x16a95c,_0x2a15a5,_0x24cc2c){logger[_0x278c('0x5b')](_0x278c('0x74'),_0x4e968d,JSON[_0x278c('0x75')](_0x16a95c));process['send']('start');var _0x528e32=_0x16a95c[_0x278c('0x76')];var _0x476aa7=_[_0x278c('0x77')](_0x528e32);var _0x5a8ed7=_0x16a95c[_0x278c('0x78')];var _0x5906e4=path['join'](config['root'],'server/files/tmp',_0x5a8ed7+_0x278c('0x79'));hasTZ=_[_0x278c('0x7a')](_0x528e32)[_0x278c('0x7b')](_0x278c('0x6f'));var _0x293ae7=_['keys'](_0x528e32)[_0x278c('0x14')]();logger[_0x278c('0x5b')](_0x278c('0x7c'),_0x293ae7);db[_0x278c('0x7d')][_0x278c('0x7e')]({'raw':!![],'attributes':['id',_0x278c('0x7f')]})[_0x278c('0x1a')](function(_0x950369){for(var _0x45aeea=0x0;_0x45aeea<_0x950369[_0x278c('0x1f')];_0x45aeea++){if(_0x950369[_0x45aeea][_0x278c('0x7f')]in _0x528e32){contactItemTypes[_0x278c('0x1b')](_0x950369[_0x45aeea]);delete _0x476aa7[_0x950369[_0x45aeea][_0x278c('0x7f')]];hasAdditionalPhones=!![];}for(var _0x5dbbfe in _0x528e32){if(_0x950369[_0x45aeea][_0x278c('0x7f')]+'_description'===_0x5dbbfe){phoneDescriptions[_0x278c('0x1b')]({'itemTypeId':_0x950369[_0x45aeea]['id'],'description':_0x5dbbfe});delete _0x476aa7[_0x5dbbfe];}}}if(hasAdditionalPhones)_0x476aa7[_0x278c('0x1d')]='';var _0x83c74=_['keys'](_0x476aa7)[_0x278c('0x14')]();logger[_0x278c('0x5b')]('header',_0x83c74);fs[_0x278c('0x80')](_0x5906e4,_0x83c74+'\x0a');Papa[_0x278c('0x81')](fs[_0x278c('0x82')](_0x4e968d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x54e899,_0x19a4cd){try{for(var _0x30c7af=0x0,_0x4c33c4=[];_0x30c7af<_0x54e899[_0x278c('0x83')][_0x278c('0x1f')];_0x30c7af++){stats['rows']+=0x1;if(_0x54e899[_0x278c('0x60')][_0x30c7af]){handleError(_0x54e899[_0x278c('0x83')][_0x30c7af],_0x54e899['errors'][_0x30c7af]);}else{var _0x21248b=[];var _0x52ff81=[];var _0x392578={};for(var _0x2cae33 in _0x528e32){let _0x3a17ac=contactItemTypes[_0x278c('0x84')](_0x3245e5=>_0x3245e5[_0x278c('0x7f')]===_0x2cae33);let _0x40f519=contactItemTypes[_0x278c('0x84')](_0x3bcb0b=>_0x3bcb0b[_0x278c('0x7f')]+_0x278c('0x85')===_0x2cae33);if(_[_0x278c('0x70')](_0x3a17ac)&&_['isNil'](_0x40f519)){if(_0x528e32['hasOwnProperty'](_0x2cae33)){if(_0x54e899[_0x278c('0x83')][_0x30c7af][_0x528e32[_0x2cae33]]){var _0x30b2a5=_[_0x278c('0x86')](_0x54e899['data'][_0x30c7af][_0x528e32[_0x2cae33]]['replace'](/"/g,'\x27'));switch(_0x2cae33){case _0x278c('0x31'):var _0x102590=moment(_0x30b2a5,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x102590[_0x278c('0x87')]()){_0x4c33c4[_0x278c('0x1b')]('\x22'+_0x30b2a5+'\x22');}else{_0x21248b['push'](_0x278c('0x88'));}break;case'priority':var _0xcc87d0=parseInt(_0x30b2a5);_0x30b2a5=_[_0x278c('0x89')](_0xcc87d0)||_0xcc87d0<0x0||_0xcc87d0>0x4?_0x24cc2c?0x3:0x2:_0xcc87d0;_0x4c33c4['push']('\x22'+_0x30b2a5+'\x22');break;case'UserId':var _0x5d84ad=parseInt(_0x30b2a5);if(_['isNumber'](_0x5d84ad)&&_['includes'](_0x2a15a5,_0x5d84ad)){_0x4c33c4[_0x278c('0x1b')]('\x22'+_0x5d84ad+'\x22');}else{_0x21248b['push']('agent\x20not\x20exists');}break;case _0x278c('0x8a'):if(isEmail(_0x30b2a5)){_0x4c33c4['push']('\x22'+_0x30b2a5+'\x22');}else{_0x21248b[_0x278c('0x1b')](_0x278c('0x8b'));}break;case _0x278c('0x8c'):var _0x41b9e2=moment(_0x30b2a5,_0x278c('0x8d'),!![]);if(_0x41b9e2['isValid']()){_0x4c33c4['push']('\x22'+_0x30b2a5+'\x22');}else{_0x21248b[_0x278c('0x1b')](_0x278c('0x8e'));}break;case _0x278c('0x6f'):var _0x326fee=shared['timezones'];var _0x183e03=_0x326fee[_0x30b2a5];if(!_[_0x278c('0x70')](_0x183e03)){var _0x185cc1=_0x183e03[_0x278c('0x71')];_0x4c33c4[_0x278c('0x1b')]('\x22'+_0x30b2a5+'\x22');_0x4c33c4[_0x278c('0x1b')]('\x22'+_0x185cc1+'\x22');}break;default:_0x4c33c4[_0x278c('0x1b')]('\x22'+_0x30b2a5+'\x22');}}else{switch(_0x2cae33){case _0x278c('0x8f'):case _0x278c('0x30'):_0x21248b[_0x278c('0x1b')](_0x2cae33+'\x20not\x20specified');break;default:_0x4c33c4[_0x278c('0x1b')]('\x22\x22');}}}}else{var _0x495267='';if(!_[_0x278c('0x70')](_0x3a17ac)){if(!_0x392578[_0x278c('0x90')](_0x3a17ac['id'])){if(!_[_0x278c('0x70')](_0x54e899['data'][_0x30c7af][_0x528e32[_0x2cae33]])){var _0x30b2a5=_[_0x278c('0x86')](_0x54e899['data'][_0x30c7af][_0x528e32[_0x2cae33]][_0x278c('0x91')](/"/g,'\x27'));var _0x21260e=phoneDescriptions[_0x278c('0x84')](_0x37cca2=>_0x37cca2['itemTypeId']===_0x3a17ac['id']);if(!_[_0x278c('0x70')](_0x21260e)){var _0x34e7b8=_[_0x278c('0x86')](_0x54e899[_0x278c('0x83')][_0x30c7af][_0x528e32[_0x21260e[_0x278c('0x92')]]][_0x278c('0x91')](/"/g,'\x27'));if(!_[_0x278c('0x70')](_0x34e7b8))_0x30b2a5=_0x30b2a5+'§'+_0x34e7b8;}if(_0x495267=='')_0x495267=_0x30b2a5;else _0x495267+='|'+_0x30b2a5;}_0x52ff81['push'](_0x3a17ac['id']+':'+_0x495267);_0x392578[_0x3a17ac['id']]=0x1;}}}}if(hasAdditionalPhones){_0x4c33c4[_0x278c('0x1b')]('\x22'+_0x52ff81['join'](';')+'\x22');}if(_0x21248b[_0x278c('0x1f')]){handleError(_0x54e899[_0x278c('0x83')][_0x30c7af],{'code':_0x278c('0x93'),'message':_0x21248b[_0x278c('0x14')]()});}else{fs[_0x278c('0x94')](_0x5906e4,_0x4c33c4['join']()+'\x0a');}_0x4c33c4=[];}if(!(stats['rows']%0xc8)){socket[_0x278c('0x95')](_0x278c('0x96')+_0x5a8ed7,stats);stats[_0x278c('0x60')]=[];}}if(stopped){logger[_0x278c('0x5b')](_0x278c('0x97'));_0x19a4cd['abort']();}}catch(_0x3fa953){handleError(_0x54e899[_0x278c('0x83')][_0x30c7af],{'code':_0x278c('0x98'),'message':_0x3fa953[_0x278c('0x5e')]});logger['error'](_0x278c('0x99'),_0x3fa953['message']);}},'complete':function(){try{var _0xa9e83a=[];var _0x1fc2fc=[];var _0x4ffda=_0x278c('0x40');if(_0x16a95c['duplicates']&&_0x16a95c['duplicates'][_0x278c('0x1f')]){_0x4ffda=_0x278c('0x9a')+_0x5a8ed7;_0xa9e83a[_0x278c('0x1b')]('CREATE\x20TABLE\x20'+_0x4ffda+_0x278c('0x9b'));}tmp_campaigns=_0x278c('0x9c')+_0x5a8ed7;tmp_voice_queues=_0x278c('0x9d')+_0x5a8ed7;_0x1fc2fc[_0x278c('0x1b')](_0x278c('0x9e')+tmp_campaigns+_0x278c('0x9f'));_0x1fc2fc[_0x278c('0x1b')](_0x278c('0x9e')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise[_0x278c('0xa0')](_0x1fc2fc,handleTZQuery)[_0x278c('0x1a')](function(_0xba7a0f){updateTzCampaigns(_0x16a95c[_0x278c('0x32')])[_0x278c('0x1a')](function(_0x30e1d2){updateTzVoiceQueues(_0x16a95c[_0x278c('0x32')])[_0x278c('0x1a')](function(_0x5bb576){if(hasTZ)_0x83c74=_0x83c74[_0x278c('0x91')]('dialTimezone',_0x278c('0xa1'));var _0x10e81e=util[_0x278c('0xf')](_0x278c('0xa2'),_0x5906e4,_0x4ffda,_0x83c74,_0x16a95c[_0x278c('0x32')],_0x16a95c['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x528e32[_0x278c('0x31')])){_0x10e81e+=_0x278c('0xa3');}_0xa9e83a[_0x278c('0x1b')](_0x10e81e);if(_0x16a95c[_0x278c('0xa4')]&&_0x16a95c[_0x278c('0xa4')][_0x278c('0x1f')]){_0xa9e83a['push'](insertCmContact(_0x16a95c[_0x278c('0x32')],_0x4ffda,_0x16a95c[_0x278c('0xa4')],_0x528e32));_0xa9e83a[_0x278c('0x1b')](_0x278c('0xa5')+_0x4ffda+';');}BPromise[_0x278c('0xa0')](_0xa9e83a,handleQuery)[_0x278c('0x1a')](function(_0x330885){BPromise[_0x278c('0x1c')]([handleAdditionalPhones()])[_0x278c('0x1a')](function(){_0xa9e83a=[];for(var _0x470e36=0x0;_0x470e36_0x57f16b[_0xa81e('0x79')]===_0x465fa8);let _0x45e4de=contactItemTypes['find'](_0x1bbad6=>_0x1bbad6[_0xa81e('0x79')]+_0xa81e('0x7a')===_0x465fa8);if(_[_0xa81e('0x1c')](_0x3a959f)&&_[_0xa81e('0x1c')](_0x45e4de)){if(_0x4d64a4['hasOwnProperty'](_0x465fa8)){if(_0x193f09[_0xa81e('0x7f')][_0x1e2ee5][_0x4d64a4[_0x465fa8]]){var _0x3ba70e=_['trim'](_0x193f09['data'][_0x1e2ee5][_0x4d64a4[_0x465fa8]][_0xa81e('0x81')](/"/g,'\x27'));switch(_0x465fa8){case'scheduledat':var _0x2b081d=moment(_0x3ba70e,'YYYY-MM-DD\x20HH:mm:ss',!![]);if(_0x2b081d[_0xa81e('0x82')]()){_0x88ffe7[_0xa81e('0x19')]('\x22'+_0x3ba70e+'\x22');}else{_0x37fef3[_0xa81e('0x19')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case'priority':var _0x2af149=parseInt(_0x3ba70e);_0x3ba70e=_[_0xa81e('0x83')](_0x2af149)||_0x2af149<0x0||_0x2af149>0x4?_0x109b46?0x3:0x2:_0x2af149;_0x88ffe7[_0xa81e('0x19')]('\x22'+_0x3ba70e+'\x22');break;case'UserId':var _0x554df3=parseInt(_0x3ba70e);if(_['isNumber'](_0x554df3)&&_[_0xa81e('0x76')](_0x563d42,_0x554df3)){_0x88ffe7['push']('\x22'+_0x554df3+'\x22');}else{_0x37fef3[_0xa81e('0x19')](_0xa81e('0x84'));}break;case _0xa81e('0x85'):if(isEmail(_0x3ba70e)){_0x88ffe7[_0xa81e('0x19')]('\x22'+_0x3ba70e+'\x22');}else{_0x37fef3['push']('email\x20wrong\x20format');}break;case _0xa81e('0x86'):var _0x2c0001=moment(_0x3ba70e,_0xa81e('0x87'),!![]);if(_0x2c0001[_0xa81e('0x82')]()){_0x88ffe7[_0xa81e('0x19')]('\x22'+_0x3ba70e+'\x22');}else{_0x37fef3[_0xa81e('0x19')](_0xa81e('0x88'));}break;case _0xa81e('0x6b'):var _0x4d172e=shared[_0xa81e('0x6a')];var _0x216689=_0x4d172e[_0x3ba70e];if(!_[_0xa81e('0x1c')](_0x216689)){var _0x3427b6=_0x216689['utcOffset'];_0x88ffe7[_0xa81e('0x19')]('\x22'+_0x3ba70e+'\x22');_0x88ffe7[_0xa81e('0x19')]('\x22'+_0x3427b6+'\x22');}break;default:_0x88ffe7['push']('\x22'+_0x3ba70e+'\x22');}}else{switch(_0x465fa8){case'firstName':case _0xa81e('0x41'):_0x37fef3[_0xa81e('0x19')](_0x465fa8+'\x20not\x20specified');break;default:_0x88ffe7[_0xa81e('0x19')]('\x22\x22');}}}}else{var _0x14edd5='';if(!_[_0xa81e('0x1c')](_0x3a959f)){if(!_0x566d3d[_0xa81e('0x89')](_0x3a959f['id'])){if(!_[_0xa81e('0x1c')](_0x193f09['data'][_0x1e2ee5][_0x4d64a4[_0x465fa8]])){var _0x3ba70e=_[_0xa81e('0x8a')](_0x193f09[_0xa81e('0x7f')][_0x1e2ee5][_0x4d64a4[_0x465fa8]][_0xa81e('0x81')](/"/g,'\x27'));var _0x4ffb6e=phoneDescriptions[_0xa81e('0x80')](_0x1873c0=>_0x1873c0[_0xa81e('0x8b')]===_0x3a959f['id']);if(!_[_0xa81e('0x1c')](_0x4ffb6e)){var _0x20027c=_[_0xa81e('0x8a')](_0x193f09[_0xa81e('0x7f')][_0x1e2ee5][_0x4d64a4[_0x4ffb6e[_0xa81e('0x8c')]]][_0xa81e('0x81')](/"/g,'\x27'));if(!_[_0xa81e('0x1c')](_0x20027c))_0x3ba70e=_0x3ba70e+'§'+_0x20027c;}if(_0x14edd5=='')_0x14edd5=_0x3ba70e;else _0x14edd5+='|'+_0x3ba70e;}_0x5f4d31[_0xa81e('0x19')](_0x3a959f['id']+':'+_0x14edd5);_0x566d3d[_0x3a959f['id']]=0x1;}}}}if(hasAdditionalPhones){_0x88ffe7[_0xa81e('0x19')]('\x22'+_0x5f4d31[_0xa81e('0x11')](';')+'\x22');}if(_0x37fef3['length']){handleError(_0x193f09[_0xa81e('0x7f')][_0x1e2ee5],{'code':'SystemRow','message':_0x37fef3[_0xa81e('0x11')]()});}else{fs[_0xa81e('0x8d')](_0x5556e3,_0x88ffe7[_0xa81e('0x11')]()+'\x0a');}_0x88ffe7=[];}if(!(stats[_0xa81e('0x7e')]%0xc8)){socket[_0xa81e('0x8e')](_0xa81e('0x8f')+_0x394a61,stats);stats[_0xa81e('0x5b')]=[];}}if(stopped){logger[_0xa81e('0x58')](_0xa81e('0x90'));_0x1be82b[_0xa81e('0x91')]();}}catch(_0x5e3697){handleError(_0x193f09[_0xa81e('0x7f')][_0x1e2ee5],{'code':_0xa81e('0x92'),'message':_0x5e3697['message']});logger['error']('step',_0x5e3697[_0xa81e('0x59')]);}},'complete':function(){try{var _0x7554b3=[];var _0x25838=[];var _0x1d4e30=_0xa81e('0x36');if(_0x90ad6f['duplicates']&&_0x90ad6f[_0xa81e('0x93')]['length']){_0x1d4e30=_0xa81e('0x94')+_0x394a61;_0x7554b3['push'](_0xa81e('0x95')+_0x1d4e30+_0xa81e('0x96'));}tmp_campaigns=_0xa81e('0x97')+_0x394a61;tmp_voice_queues=_0xa81e('0x98')+_0x394a61;_0x25838[_0xa81e('0x19')](_0xa81e('0x95')+tmp_campaigns+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');_0x25838[_0xa81e('0x19')](_0xa81e('0x95')+tmp_voice_queues+_0xa81e('0x99'));BPromise[_0xa81e('0x9a')](_0x25838,handleTZQuery)[_0xa81e('0x17')](function(_0x3ba590){updateTzCampaigns(_0x90ad6f[_0xa81e('0x2f')])[_0xa81e('0x17')](function(_0x530433){updateTzVoiceQueues(_0x90ad6f[_0xa81e('0x2f')])[_0xa81e('0x17')](function(_0x1b721e){if(hasTZ)_0x14447a=_0x14447a[_0xa81e('0x81')]('dialTimezone',_0xa81e('0x9b'));var _0x3fd6bf=util[_0xa81e('0xb')](_0xa81e('0x9c'),_0x5556e3,_0x1d4e30,_0x14447a,_0x90ad6f[_0xa81e('0x2f')],_0x90ad6f[_0xa81e('0x50')]||null,NOW,NOW);if(_[_0xa81e('0x1c')](_0x4d64a4['scheduledat'])){_0x3fd6bf+=_0xa81e('0x9d');}_0x7554b3[_0xa81e('0x19')](_0x3fd6bf);if(_0x90ad6f[_0xa81e('0x93')]&&_0x90ad6f['duplicates'][_0xa81e('0x18')]){_0x7554b3[_0xa81e('0x19')](insertCmContact(_0x90ad6f[_0xa81e('0x2f')],_0x1d4e30,_0x90ad6f[_0xa81e('0x93')],_0x4d64a4));_0x7554b3[_0xa81e('0x19')]('DROP\x20TABLE\x20'+_0x1d4e30+';');}BPromise[_0xa81e('0x9a')](_0x7554b3,handleQuery)[_0xa81e('0x17')](function(_0x75d711){BPromise[_0xa81e('0x1b')]([handleAdditionalPhones()])[_0xa81e('0x17')](function(){_0x7554b3=[];for(var _0x263e0c=0x0;_0x263e0c\x20\x20');}var _0xba9fcb=path[_0xa81e('0x11')](config[_0xa81e('0xac')],_0xa81e('0x74'),process['argv'][0x2]);if(!fs[_0xa81e('0xad')](_0xba9fcb)){throw new Error(_0xa81e('0xae'));}var _0x773d1c={};try{_0x773d1c=JSON[_0xa81e('0x7c')](process[_0xa81e('0xab')][0x3]);if(!_0x773d1c['binding']){throw new Error(_0xa81e('0xaf'));}if(!_0x773d1c[_0xa81e('0x72')][_0xa81e('0x41')]){throw new Error(_0xa81e('0xb0'));}if(!_0x773d1c[_0xa81e('0x72')]['firstName']){throw new Error(_0xa81e('0xb1'));}var _0x32638f=0x0;if(_0x773d1c['binding'][_0xa81e('0x33')]){_0x32638f=0x1;}if(!_0x773d1c[_0xa81e('0x2f')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x326ef0){throw new Error(_0xa81e('0xb2'));}var _0x115483=[];try{_0x115483=_[_0xa81e('0xb3')](JSON[_0xa81e('0x7c')](process[_0xa81e('0xab')][0x4]),'id');}catch(_0x3dd3e9){logger[_0xa81e('0x58')](_0xa81e('0xb4'));}main(_0xba9fcb,_0x773d1c,_0x115483,_0x32638f);}validate();process['on'](_0xa81e('0xb5'),handleStop);process['on'](_0xa81e('0xb6'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/import/cm/csvUpdates.js b/server/components/import/cm/csvUpdates.js index 03d6bc3..1bee5ee 100644 --- a/server/components/import/cm/csvUpdates.js +++ b/server/components/import/cm/csvUpdates.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc2c=['catch','error','message','split','length','push','filter','findOne','CmContactHasItem','update','updated','create','inserted','CmContact','CmHopper','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.createdAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','updatedAt','priority','UserId','recallme','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','cm_contacts.id','cm_contacts.ListId','cm_contacts.updatedAt','cm_hopper_black','createdAt','fields','cm_contacts','cm_contacts.ListId\x20=\x20','ListId\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.updatedAt','into','cm_hopper_additional_phones','CmHopperId','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','ListId','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','info','exit','code','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','body','ContactItemType','findAll','name','keys','header','writeFileSync','data','rows','errors','find','trim','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','hasOwnProperty','replace','itemTypeId','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','CREATE\x20TABLE\x20','CIS\x20len',',\x20scheduledAt\x20=\x20NOW()','each','contactTypeId','orderBy','DROP\x20TABLE\x20','finish','affectedRows','unlink','argv','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','squel','ioredis','../../../mysqldb','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','field','phone','from','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','sequelize','query','select\x20*\x20from\x20','spread','isNil','AdditionalPhones','all','then'];(function(_0xd056f7,_0xedbba9){var _0xbcb407=function(_0x137340){while(--_0x137340){_0xd056f7['push'](_0xd056f7['shift']());}};_0xbcb407(++_0xedbba9);}(_0xbc2c,0x123));var _0xcbc2=function(_0x609988,_0x507944){_0x609988=_0x609988-0x0;var _0x159984=_0xbc2c[_0x609988];return _0x159984;};'use strict';var fs=require('fs');var path=require(_0xcbc2('0x0'));var _=require(_0xcbc2('0x1'));var Papa=require(_0xcbc2('0x2'));var util=require(_0xcbc2('0x3'));var BPromise=require('bluebird');var moment=require('moment');var squel=require(_0xcbc2('0x4'));var Redis=require(_0xcbc2('0x5'));var db=require(_0xcbc2('0x6'))['db'];var config=require(_0xcbc2('0x7'));var logger=require(_0xcbc2('0x8'))(_0xcbc2('0x9'));config['redis']=_['defaults'](config[_0xcbc2('0xa')],{'host':_0xcbc2('0xb'),'port':0x18eb});var socket=require(_0xcbc2('0xc'))(new Redis(config[_0xcbc2('0xa')]));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()['format'](_0xcbc2('0xd'));var tempTableName=_0xcbc2('0xe')+moment()[_0xcbc2('0xf')](_0xcbc2('0x10'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x2d888e){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))*$/[_0xcbc2('0x11')](_0x2d888e);}function selectNotIn(_0xb613d7,_0x2535a2,_0x273175,_0xfe191f,_0x4e8eb5){return squel[_0xcbc2('0x12')]()[_0xcbc2('0x13')](_0xcbc2('0x14'))[_0xcbc2('0x15')](_0xfe191f)[_0xcbc2('0x16')](_0x2535a2,null,_0x2535a2+_0xcbc2('0x17')+_0xfe191f+'.'+_0x273175)[_0xcbc2('0x18')](_0xfe191f+'.'+_0x273175+_0xcbc2('0x19')+_0xb613d7+'.'+_0x273175)[_0xcbc2('0x18')](_0x2535a2+_0xcbc2('0x1a')+_0x4e8eb5[_0xcbc2('0x16')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x4c6011,_0x269376){promisesAdditionalPhones=[];promisesContact=[];return db[_0xcbc2('0x1b')][_0xcbc2('0x1c')](_0xcbc2('0x1d')+tempTableName)[_0xcbc2('0x1e')](function(_0x346964){if(_0x346964!==null){var _0x30e630=[];for(var _0x61792a=0x0;_0x61792a<_0x346964['length'];_0x61792a++){var _0x5f637f=_0x346964[_0x61792a];if(!_['isNil'](_0x5f637f[_0xcbc2('0x14')])){if(!_[_0xcbc2('0x1f')](_0x5f637f[_0xcbc2('0x20')]))_0x30e630['push'](insertAdditionalPhones(_0x5f637f));promisesContact['push']({'contact':_0x5f637f});}}}Promise[_0xcbc2('0x21')](_0x30e630)[_0xcbc2('0x22')](function(){_0x4c6011({'val':0x1});});})[_0xcbc2('0x23')](function(_0x3e4672){logger[_0xcbc2('0x24')](_0x3e4672[_0xcbc2('0x25')]);});});}function insertAdditionalPhones(_0xba1188){return new Promise(function(_0x375f86,_0x73d146){var _0x155016=_0xba1188[_0xcbc2('0x20')];if(_['isNil'](_0x155016))_0x73d146({'val':0x0});else{var _0x20ae93=_0x155016[_0xcbc2('0x26')](';');var _0x523fde=[];orderBy=0x0;for(var _0x9a6a10=0x0;_0x9a6a10<_0x20ae93[_0xcbc2('0x27')];_0x9a6a10++){_0x523fde[_0xcbc2('0x28')](splitAdditionalPhone(_0xba1188['id'],_0x20ae93[_0x9a6a10]));}Promise[_0xcbc2('0x21')](_0x523fde)['then'](function(){_0x375f86({'val':_0x20ae93['length']});});}});}function splitAdditionalPhone(_0x3c54c3,_0x4b058d){return new Promise(function(_0x2a1f44,_0x13f97c){var _0x4ae35c=_0x4b058d[_0xcbc2('0x26')](':');var _0x226570=_0x4ae35c[0x0];var _0x4e914a=_0x4ae35c[0x1];if(_0x4e914a!==''){var _0x489e48=_0x4e914a[_0xcbc2('0x26')]('|');var _0xe372eb=[];for(var _0x3aecaa=0x0;_0x3aecaa<_0x489e48['length'];_0x3aecaa++){if(_0x489e48[_0x3aecaa]!==''){var _0x59d251=_[_0xcbc2('0x29')](promisesAdditionalPhones,{'contactId':_0x3c54c3,'phone':_0x489e48[_0x3aecaa]});if(_0x59d251[_0xcbc2('0x27')]==0x0){orderBy++;promisesAdditionalPhones[_0xcbc2('0x28')]({'contactId':_0x3c54c3,'contactTypeId':_0x226570,'phone':_0x489e48[_0x3aecaa],'orderBy':orderBy});}}}_0x2a1f44({'ok':0x1});}else _0x2a1f44({'res':0x0});});}function createAdditionalPhone(_0x277f6d,_0x263f44,_0x44b8e1,_0xfbf923){var _0x13f1d2='';var _0x521725='';var _0x4223b2=_0x44b8e1[_0xcbc2('0x26')]('§');_0x13f1d2=_0x4223b2[0x0];if(_0x4223b2[_0xcbc2('0x27')]==0x2)_0x521725=_0x4223b2[0x1];return new Promise(function(_0xa3878d,_0x55aed6){return db['CmContactHasItem'][_0xcbc2('0x2a')]({'where':{'CmContactId':_0x277f6d,'item':_0x13f1d2}})[_0xcbc2('0x22')](function(_0x3b3e4b){if(_0x3b3e4b){return db[_0xcbc2('0x2b')][_0xcbc2('0x2c')]({'ItemTypeId':_0x263f44,'description':_0x521725,'OrderBy':_0xfbf923},{'where':{'CmContactId':_0x277f6d,'item':_0x13f1d2}})[_0xcbc2('0x22')](function(_0x287b30){_0xa3878d({'res':_0xcbc2('0x2d')});});}else{return db[_0xcbc2('0x2b')][_0xcbc2('0x2e')]({'CmContactId':_0x277f6d,'item':_0x13f1d2,'ItemTypeId':_0x263f44,'description':_0x521725,'OrderBy':_0xfbf923,'ItemClass':'PHONE'})['then'](function(_0x6220ee){_0xa3878d({'res':_0xcbc2('0x2f')});});}});});}function updateContact(_0x4d10f5){return new Promise(function(_0x369b95,_0x57093f){var _0x26f919=_0x4d10f5['id'];delete _0x4d10f5['id'];return db[_0xcbc2('0x30')][_0xcbc2('0x2c')](_0x4d10f5,{'where':{'id':_0x26f919}})[_0xcbc2('0x22')](function(_0x100b57){updatedRows+=0x1;return db[_0xcbc2('0x31')][_0xcbc2('0x2c')]({'phone':_0x4d10f5[_0xcbc2('0x14')]},{'where':{'ContactId':_0x26f919}})[_0xcbc2('0x22')](function(_0x4e6f0a){_0x369b95({'ret':'OK'});});});});}function insertCmHopper(_0x130d80,_0x1ee908,_0x5b2233,_0x296f8,_0x5b50cb){var _0x55c5da=[_0xcbc2('0x32'),_0xcbc2('0x33'),'cm_contacts.id','cm_contacts.ListId',_0x1ee908+'.'+_0x296f8,_0xcbc2('0x34'),'cm_contacts.updatedAt',_0xcbc2('0x35'),_0xcbc2('0x36'),'\x22'+_0x5b50cb+'\x22'];return squel[_0xcbc2('0x37')]()['into'](_0xcbc2('0x38'))[_0xcbc2('0x39')](['phone',_0xcbc2('0x3a'),'ContactId','ListId',_0x296f8,'createdAt',_0xcbc2('0x3b'),_0xcbc2('0x3c'),_0xcbc2('0x3d'),_0xcbc2('0x3e')],squel[_0xcbc2('0x12')]()['fields'](_0x55c5da)[_0xcbc2('0x15')](_0x1ee908)[_0xcbc2('0x16')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x1ee908+_0xcbc2('0x3f'))[_0xcbc2('0x16')](_0x5b2233,null,_0x5b2233+'.id\x20=\x20'+_0x1ee908+'.'+_0x296f8)['where'](_0x1ee908+_0xcbc2('0x40'),_0x130d80)[_0xcbc2('0x18')](_0xcbc2('0x41'),NOW)['where'](_0xcbc2('0x42'),selectNotIn(_0x1ee908,_0x5b2233,_0x296f8,_0xcbc2('0x38'),[_0xcbc2('0x43'),_0xcbc2('0x44')]))[_0xcbc2('0x18')](_0xcbc2('0x42'),selectNotIn(_0x1ee908,_0x5b2233,_0x296f8,_0xcbc2('0x38'),['\x22always\x22'])))[_0xcbc2('0x45')]();}function insertCmHopperBlack(_0x5ab243,_0x122925,_0x1d2e0a,_0x5ce131){var _0xeded54=['cm_contacts.phone',_0xcbc2('0x46'),_0xcbc2('0x47'),_0x122925+'.'+_0x5ce131,_0xcbc2('0x34'),_0xcbc2('0x48')];return squel[_0xcbc2('0x37')]()['into'](_0xcbc2('0x49'))[_0xcbc2('0x39')]([_0xcbc2('0x14'),'ContactId','ListId',_0x5ce131,_0xcbc2('0x4a'),_0xcbc2('0x3b')],squel[_0xcbc2('0x12')]()[_0xcbc2('0x4b')](_0xeded54)[_0xcbc2('0x15')](_0x122925)['join'](_0xcbc2('0x4c'),null,_0xcbc2('0x4d')+_0x122925+'.CmListId')['join'](_0x1d2e0a,null,_0x1d2e0a+_0xcbc2('0x17')+_0x122925+'.'+_0x5ce131)[_0xcbc2('0x18')](_0x122925+'.CmListId\x20=\x20?',_0x5ab243)['where'](_0xcbc2('0x41'),NOW)[_0xcbc2('0x18')](_0xcbc2('0x42'),squel[_0xcbc2('0x12')]()['field'](_0xcbc2('0x14'))[_0xcbc2('0x15')](_0xcbc2('0x49'))[_0xcbc2('0x18')](_0xcbc2('0x4e'),_0x5ab243)['where'](_0x5ce131+'\x20=\x20?',_0x122925+'.'+_0x5ce131)))[_0xcbc2('0x45')]();}function insertCmHopperAdditionalPhones(_0x3d32c1){var _0x13e456=[_0xcbc2('0x4f'),_0xcbc2('0x50'),'cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt',_0xcbc2('0x51')];return squel[_0xcbc2('0x37')]()[_0xcbc2('0x52')](_0xcbc2('0x53'))[_0xcbc2('0x39')]([_0xcbc2('0x54'),_0xcbc2('0x14'),'OrderBy',_0xcbc2('0x4a'),_0xcbc2('0x3b')],squel[_0xcbc2('0x12')]()[_0xcbc2('0x4b')](_0x13e456)[_0xcbc2('0x15')](_0xcbc2('0x38'))[_0xcbc2('0x16')](_0xcbc2('0x4c'),null,_0xcbc2('0x55'))[_0xcbc2('0x16')]('cm_contact_has_items',null,_0xcbc2('0x56'))['where'](_0xcbc2('0x57'),_0x3d32c1)[_0xcbc2('0x18')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xcbc2('0x45')]();}function insertCmContact(_0x47f4ce,_0x21045e,_0x1bbc37,_0x1fcde3){var _0x546fe9=_[_0xcbc2('0x58')](_['keys'](_0x1fcde3),[_0xcbc2('0x59'),_0xcbc2('0x5a'),_0xcbc2('0x4a'),'updatedAt']);return squel['insert']()[_0xcbc2('0x52')](_0xcbc2('0x4c'))[_0xcbc2('0x39')](_0x546fe9,squel['select']()[_0xcbc2('0x4b')](_0x546fe9)[_0xcbc2('0x15')](_0x21045e)[_0xcbc2('0x18')]('('+_0x1bbc37[_0xcbc2('0x16')](',')+_0xcbc2('0x5b'),squel['select']()['fields'](_0x1bbc37)['from'](_0xcbc2('0x4c'))[_0xcbc2('0x18')](_0xcbc2('0x4e'),_0x47f4ce))[_0xcbc2('0x18')]('id\x20IN\x20?',squel[_0xcbc2('0x12')]()['field'](_0xcbc2('0x5c'),_0xcbc2('0x5d'))[_0xcbc2('0x15')](_0x21045e)['group'](_0x1bbc37[_0xcbc2('0x16')](','))))[_0xcbc2('0x45')]();}function handleStop(){logger[_0xcbc2('0x5e')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0xeca1be){logger[_0xcbc2('0x24')](_0xeca1be['message']);process[_0xcbc2('0x5f')](0x1);}function handleError(_0xa6a1f0,_0x39b2e8){stats['errors'][_0xcbc2('0x28')]({'name':_0x39b2e8[_0xcbc2('0x60')],'message':_0x39b2e8['message'],'row':_0xa6a1f0});}function handleQuery(_0x524823){logger['info'](_0x524823);return db['sequelize'][_0xcbc2('0x1c')](_0x524823)[_0xcbc2('0x1e')](function(_0x20e7dc){results[_0xcbc2('0x28')](_0x20e7dc);})['catch'](function(_0x32e376){logger[_0xcbc2('0x24')](_0x32e376[_0xcbc2('0x25')]);});}function main(_0x2215d3,_0x1a1e30,_0x27ff9c,_0x19cb8a){logger['info'](_0xcbc2('0x61'),_0x2215d3,JSON[_0xcbc2('0x62')](_0x1a1e30));process[_0xcbc2('0x63')](_0xcbc2('0x64'));var _0x37ac62=_0x1a1e30[_0xcbc2('0x65')];var _0x5d5839=_[_0xcbc2('0x66')](_0x37ac62);var _0x346a63=_0x1a1e30[_0xcbc2('0x67')];var _0x301986=path[_0xcbc2('0x16')](config[_0xcbc2('0x68')],_0xcbc2('0x69'),_0x346a63+_0xcbc2('0x6a'));logger[_0xcbc2('0x5e')](_0xcbc2('0x6b'),_0x1a1e30);db[_0xcbc2('0x6c')][_0xcbc2('0x6d')]({'raw':!![],'attributes':['id',_0xcbc2('0x6e')]})[_0xcbc2('0x22')](function(_0x45b8ae){for(var _0x150fc0=0x0;_0x150fc0<_0x45b8ae[_0xcbc2('0x27')];_0x150fc0++){if(_0x45b8ae[_0x150fc0][_0xcbc2('0x6e')]in _0x37ac62){contactItemTypes[_0xcbc2('0x28')](_0x45b8ae[_0x150fc0]);delete _0x5d5839[_0x45b8ae[_0x150fc0][_0xcbc2('0x6e')]];hasAdditionalPhones=!![];}for(var _0x120fa7 in _0x37ac62){if(_0x45b8ae[_0x150fc0]['name']+'_description'===_0x120fa7){phoneDescriptions['push']({'itemTypeId':_0x45b8ae[_0x150fc0]['id'],'description':_0x120fa7});delete _0x5d5839[_0x120fa7];}}}if(hasAdditionalPhones)_0x5d5839[_0xcbc2('0x20')]='';var _0x392e2e=_[_0xcbc2('0x6f')](_0x5d5839)[_0xcbc2('0x16')]();logger[_0xcbc2('0x5e')](_0xcbc2('0x70'),_0x392e2e);fs[_0xcbc2('0x71')](_0x301986,_0x392e2e+'\x0a');Papa['parse'](fs['createReadStream'](_0x2215d3),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5e9378,_0x374ed1){try{for(var _0x2ebfb8=0x0,_0x2d1664=[];_0x2ebfb8<_0x5e9378[_0xcbc2('0x72')][_0xcbc2('0x27')];_0x2ebfb8++){stats[_0xcbc2('0x73')]+=0x1;if(_0x5e9378[_0xcbc2('0x74')][_0x2ebfb8]){handleError(_0x5e9378[_0xcbc2('0x72')][_0x2ebfb8],_0x5e9378['errors'][_0x2ebfb8]);}else{var _0x45b9e1=[];var _0x244f07=[];var _0x4ab3f4={};for(var _0x1fce8 in _0x37ac62){let _0x50ee03=contactItemTypes['find'](_0x2c7493=>_0x2c7493[_0xcbc2('0x6e')]===_0x1fce8);let _0x4e2e6d=contactItemTypes[_0xcbc2('0x75')](_0x23581=>_0x23581[_0xcbc2('0x6e')]+'_description'===_0x1fce8);if(_[_0xcbc2('0x1f')](_0x50ee03)&&_['isNil'](_0x4e2e6d)){if(_0x37ac62['hasOwnProperty'](_0x1fce8)){if(_0x5e9378[_0xcbc2('0x72')][_0x2ebfb8][_0x37ac62[_0x1fce8]]){var _0x9e118a=_[_0xcbc2('0x76')](_0x5e9378[_0xcbc2('0x72')][_0x2ebfb8][_0x37ac62[_0x1fce8]]['replace'](/"/g,'\x27'));switch(_0x1fce8){case _0xcbc2('0x3a'):var _0x26b2fe=moment(_0x9e118a,_0xcbc2('0xd'),!![]);if(_0x26b2fe['isValid']()){_0x2d1664['push']('\x22'+_0x9e118a+'\x22');}else{_0x45b9e1[_0xcbc2('0x28')](_0xcbc2('0x77'));}break;case _0xcbc2('0x3c'):var _0x2dd379=parseInt(_0x9e118a);_0x9e118a=_[_0xcbc2('0x78')](_0x2dd379)||_0x2dd379<0x0||_0x2dd379>0x4?_0x19cb8a?0x3:0x2:_0x2dd379;_0x2d1664[_0xcbc2('0x28')]('\x22'+_0x9e118a+'\x22');break;case _0xcbc2('0x3d'):var _0x39adc8=parseInt(_0x9e118a);if(_[_0xcbc2('0x79')](_0x39adc8)&&_[_0xcbc2('0x7a')](_0x27ff9c,_0x39adc8)){_0x2d1664[_0xcbc2('0x28')]('\x22'+_0x39adc8+'\x22');}else{_0x45b9e1['push']('agent\x20not\x20exists');}break;case _0xcbc2('0x7b'):if(isEmail(_0x9e118a)){_0x2d1664[_0xcbc2('0x28')]('\x22'+_0x9e118a+'\x22');}else{_0x45b9e1[_0xcbc2('0x28')](_0xcbc2('0x7c'));}break;case'dateOfBirth':var _0x345976=moment(_0x9e118a,_0xcbc2('0x7d'),!![]);if(_0x345976[_0xcbc2('0x7e')]()){_0x2d1664['push']('\x22'+_0x9e118a+'\x22');}else{_0x45b9e1[_0xcbc2('0x28')](_0xcbc2('0x7f'));}break;default:_0x2d1664[_0xcbc2('0x28')]('\x22'+_0x9e118a+'\x22');}}else{switch(_0x1fce8){case _0xcbc2('0x80'):case _0xcbc2('0x14'):_0x45b9e1[_0xcbc2('0x28')](_0x1fce8+_0xcbc2('0x81'));break;default:_0x2d1664[_0xcbc2('0x28')]('\x22\x22');}}}}else{var _0x240a38='';if(!_[_0xcbc2('0x1f')](_0x50ee03)){if(!_0x4ab3f4[_0xcbc2('0x82')](_0x50ee03['id'])){for(var _0x368075=0x0;_0x368075<_0x37ac62[_0x1fce8][_0xcbc2('0x27')];_0x368075++){var _0x9e118a=_[_0xcbc2('0x76')](_0x5e9378[_0xcbc2('0x72')][_0x2ebfb8][_0x37ac62[_0x1fce8][_0x368075]][_0xcbc2('0x83')](/"/g,'\x27'));var _0x137cb8=phoneDescriptions[_0xcbc2('0x75')](_0x3df0be=>_0x3df0be[_0xcbc2('0x84')]===_0x50ee03['id']);if(!_[_0xcbc2('0x1f')](_0x137cb8)){var _0x9895e4=_['trim'](_0x5e9378[_0xcbc2('0x72')][_0x2ebfb8][_0x37ac62[_0x137cb8[_0xcbc2('0x85')]][0x0]][_0xcbc2('0x83')](/"/g,'\x27'));if(!_[_0xcbc2('0x1f')](_0x9895e4))_0x9e118a=_0x9e118a+'§'+_0x9895e4;}if(_0x240a38=='')_0x240a38=_0x9e118a;else _0x240a38+='|'+_0x9e118a;}_0x244f07[_0xcbc2('0x28')](_0x50ee03['id']+':'+_0x240a38);_0x4ab3f4[_0x50ee03['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2d1664[_0xcbc2('0x28')]('\x22'+_0x244f07[_0xcbc2('0x16')](';')+'\x22');}if(_0x45b9e1[_0xcbc2('0x27')]){handleError(_0x5e9378['data'][_0x2ebfb8],{'code':_0xcbc2('0x86'),'message':_0x45b9e1[_0xcbc2('0x16')]()});}else{fs[_0xcbc2('0x87')](_0x301986,_0x2d1664[_0xcbc2('0x16')]()+'\x0a');}_0x2d1664=[];}if(!(stats['rows']%0xc8)){socket[_0xcbc2('0x88')](_0xcbc2('0x89')+_0x346a63,stats);stats[_0xcbc2('0x74')]=[];}}if(stopped){logger[_0xcbc2('0x5e')](_0xcbc2('0x8a'));_0x374ed1[_0xcbc2('0x8b')]();}}catch(_0x492da5){handleError(_0x5e9378['data'][_0x2ebfb8],{'code':_0xcbc2('0x8c'),'message':_0x492da5[_0xcbc2('0x25')]});logger[_0xcbc2('0x24')](_0xcbc2('0x8d'),_0x492da5[_0xcbc2('0x25')]);}},'complete':function(){try{var _0x2347d9=[];var _0x564c7c=tempTableName;_0x2347d9[_0xcbc2('0x28')](_0xcbc2('0x8e')+_0x564c7c+'\x20LIKE\x20cm_contacts;');logger['info'](_0xcbc2('0x8f'),contactItemTypes['length']);var _0x5e20da=util['format']('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',_0x301986,_0x564c7c,_0x392e2e,_0x1a1e30[_0xcbc2('0x59')],_0x1a1e30[_0xcbc2('0x5a')]||null,NOW,NOW);if(_[_0xcbc2('0x1f')](_0x37ac62[_0xcbc2('0x3a')])){_0x5e20da+=_0xcbc2('0x90');}_0x2347d9['push'](_0x5e20da);BPromise[_0xcbc2('0x91')](_0x2347d9,handleQuery)['then'](function(_0x47a7a8){BPromise[_0xcbc2('0x21')]([handleAdditionalPhones()])[_0xcbc2('0x22')](function(){_0x2347d9=[];for(var _0x253720=0x0;_0x253720\x20\x20');}var _0x1e92a5=path[_0xcbc2('0x16')](config['root'],_0xcbc2('0x69'),process[_0xcbc2('0x98')][0x2]);if(!fs[_0xcbc2('0x99')](_0x1e92a5)){throw new Error(_0xcbc2('0x9a'));}var _0x2aba43={};try{_0x2aba43=JSON[_0xcbc2('0x9b')](process['argv'][0x3]);if(!_0x2aba43['binding']){throw new Error(_0xcbc2('0x9c'));}var _0x448299=0x0;if(_0x2aba43[_0xcbc2('0x65')][_0xcbc2('0x3d')]){_0x448299=0x1;}if(!_0x2aba43[_0xcbc2('0x59')]){throw new Error(_0xcbc2('0x9d'));}}catch(_0x1681be){throw new Error(_0xcbc2('0x9e'));}var _0x318f89=[];try{_0x318f89=_[_0xcbc2('0x9f')](JSON[_0xcbc2('0x9b')](process[_0xcbc2('0x98')][0x4]),'id');}catch(_0x4df207){logger[_0xcbc2('0x5e')](_0xcbc2('0xa0'));}main(_0x1e92a5,_0x2aba43,_0x318f89,_0x448299);}validate();process['on'](_0xcbc2('0xa1'),handleStop);process['on'](_0xcbc2('0xa2'),handleUncaughtException); \ No newline at end of file +var _0xc19a=['AdditionalPhones','push','then','catch','error','message','split','filter','findOne','CmContactHasItem','update','updated','create','CmContact','CmHopper','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','ContactId','createdAt','priority','UserId','recallme','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','join','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_hopper_black','ListId','updatedAt','fields','from','field','ListId\x20=\x20?','\x20=\x20?','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','group','info','Received\x20SIGINT','exit','errors','code','sequelize','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','.csv','findAll','name','_description','header','writeFileSync','parse','createReadStream','data','rows','find','trim','scheduledat','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','agent\x20not\x20exists','email','email\x20wrong\x20format','YYYY-MM-DD','isValid','\x20not\x20specified','hasOwnProperty','replace','description','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','CREATE\x20TABLE\x20','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',',\x20scheduledAt\x20=\x20NOW()','each','all','contact','contactTypeId','orderBy','unlink','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','body\x20id\x20mandatory','No\x20agent\x20available','uncaughtException','path','lodash','papaparse','util','moment','squel','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','format','YYYYMMDDHHmmss','test','select','.id\x20=\x20','where','.dialCheckDuplicateType\x20IN\x20(','query','spread','length','phone','isNil'];(function(_0x5ccbf1,_0x4da29b){var _0x520cad=function(_0x30c059){while(--_0x30c059){_0x5ccbf1['push'](_0x5ccbf1['shift']());}};_0x520cad(++_0x4da29b);}(_0xc19a,0x7f));var _0xac19=function(_0xbf2872,_0x5d3471){_0xbf2872=_0xbf2872-0x0;var _0x24f8ca=_0xc19a[_0xbf2872];return _0x24f8ca;};'use strict';var fs=require('fs');var path=require(_0xac19('0x0'));var _=require(_0xac19('0x1'));var Papa=require(_0xac19('0x2'));var util=require(_0xac19('0x3'));var BPromise=require('bluebird');var moment=require(_0xac19('0x4'));var squel=require(_0xac19('0x5'));var Redis=require(_0xac19('0x6'));var db=require('../../../mysqldb')['db'];var config=require(_0xac19('0x7'));var logger=require(_0xac19('0x8'))('import');config[_0xac19('0x9')]=_[_0xac19('0xa')](config['redis'],{'host':_0xac19('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));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()['format'](_0xac19('0xc'));var tempTableName=_0xac19('0xd')+moment()[_0xac19('0xe')](_0xac19('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x109926){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))*$/[_0xac19('0x10')](_0x109926);}function selectNotIn(_0xa5d2e6,_0x8fb9a9,_0x577f02,_0x120ae7,_0x235603){return squel[_0xac19('0x11')]()['field']('phone')['from'](_0x120ae7)['join'](_0x8fb9a9,null,_0x8fb9a9+_0xac19('0x12')+_0x120ae7+'.'+_0x577f02)[_0xac19('0x13')](_0x120ae7+'.'+_0x577f02+'\x20=\x20'+_0xa5d2e6+'.'+_0x577f02)['where'](_0x8fb9a9+_0xac19('0x14')+_0x235603['join']()+')');}function handleAdditionalPhones(){return new Promise(function(_0x127a6e,_0x3cbe58){promisesAdditionalPhones=[];promisesContact=[];return db['sequelize'][_0xac19('0x15')]('select\x20*\x20from\x20'+tempTableName)[_0xac19('0x16')](function(_0x1961fc){if(_0x1961fc!==null){var _0x122746=[];for(var _0x20c302=0x0;_0x20c302<_0x1961fc[_0xac19('0x17')];_0x20c302++){var _0x5eb538=_0x1961fc[_0x20c302];if(!_['isNil'](_0x5eb538[_0xac19('0x18')])){if(!_[_0xac19('0x19')](_0x5eb538[_0xac19('0x1a')]))_0x122746[_0xac19('0x1b')](insertAdditionalPhones(_0x5eb538));promisesContact['push']({'contact':_0x5eb538});}}}Promise['all'](_0x122746)[_0xac19('0x1c')](function(){_0x127a6e({'val':0x1});});})[_0xac19('0x1d')](function(_0x7532b5){logger[_0xac19('0x1e')](_0x7532b5[_0xac19('0x1f')]);});});}function insertAdditionalPhones(_0x416b1f){return new Promise(function(_0x3d63c0,_0x1d150b){var _0x1287e3=_0x416b1f[_0xac19('0x1a')];if(_['isNil'](_0x1287e3))_0x1d150b({'val':0x0});else{var _0x44c92e=_0x1287e3[_0xac19('0x20')](';');var _0x2c457f=[];orderBy=0x0;for(var _0x31dbb7=0x0;_0x31dbb7<_0x44c92e['length'];_0x31dbb7++){_0x2c457f[_0xac19('0x1b')](splitAdditionalPhone(_0x416b1f['id'],_0x44c92e[_0x31dbb7]));}Promise['all'](_0x2c457f)[_0xac19('0x1c')](function(){_0x3d63c0({'val':_0x44c92e['length']});});}});}function splitAdditionalPhone(_0x404842,_0x190b63){return new Promise(function(_0x521e71,_0x339fd1){var _0x1d07e4=_0x190b63[_0xac19('0x20')](':');var _0x5351e4=_0x1d07e4[0x0];var _0x1d1308=_0x1d07e4[0x1];if(_0x1d1308!==''){var _0x1ba7db=_0x1d1308[_0xac19('0x20')]('|');var _0x378566=[];for(var _0x46ce99=0x0;_0x46ce99<_0x1ba7db[_0xac19('0x17')];_0x46ce99++){if(_0x1ba7db[_0x46ce99]!==''){var _0x5bde80=_[_0xac19('0x21')](promisesAdditionalPhones,{'contactId':_0x404842,'phone':_0x1ba7db[_0x46ce99]});if(_0x5bde80[_0xac19('0x17')]==0x0){orderBy++;promisesAdditionalPhones[_0xac19('0x1b')]({'contactId':_0x404842,'contactTypeId':_0x5351e4,'phone':_0x1ba7db[_0x46ce99],'orderBy':orderBy});}}}_0x521e71({'ok':0x1});}else _0x521e71({'res':0x0});});}function createAdditionalPhone(_0x153a6a,_0x4c3c8d,_0x1301cd,_0x212b9f){var _0x2c372b='';var _0x1779fa='';var _0x4db0be=_0x1301cd[_0xac19('0x20')]('§');_0x2c372b=_0x4db0be[0x0];if(_0x4db0be[_0xac19('0x17')]==0x2)_0x1779fa=_0x4db0be[0x1];return new Promise(function(_0x33b3e5,_0x1e7013){return db['CmContactHasItem'][_0xac19('0x22')]({'where':{'CmContactId':_0x153a6a,'item':_0x2c372b}})[_0xac19('0x1c')](function(_0x187f25){if(_0x187f25){return db[_0xac19('0x23')][_0xac19('0x24')]({'ItemTypeId':_0x4c3c8d,'description':_0x1779fa,'OrderBy':_0x212b9f},{'where':{'CmContactId':_0x153a6a,'item':_0x2c372b}})[_0xac19('0x1c')](function(_0x18e6bb){_0x33b3e5({'res':_0xac19('0x25')});});}else{return db[_0xac19('0x23')][_0xac19('0x26')]({'CmContactId':_0x153a6a,'item':_0x2c372b,'ItemTypeId':_0x4c3c8d,'description':_0x1779fa,'OrderBy':_0x212b9f,'ItemClass':'PHONE'})[_0xac19('0x1c')](function(_0x5f54e0){_0x33b3e5({'res':'inserted'});});}});});}function updateContact(_0x54c8d8){return new Promise(function(_0x25d64b,_0x1cab3c){var _0x2ab49f=_0x54c8d8['id'];delete _0x54c8d8['id'];return db[_0xac19('0x27')][_0xac19('0x24')](_0x54c8d8,{'where':{'id':_0x2ab49f}})[_0xac19('0x1c')](function(_0x158b4f){updatedRows+=0x1;return db[_0xac19('0x28')]['update']({'phone':_0x54c8d8['phone']},{'where':{'ContactId':_0x2ab49f}})[_0xac19('0x1c')](function(_0x283264){_0x25d64b({'ret':'OK'});});});});}function insertCmHopper(_0x310b39,_0x259d00,_0x1e6763,_0x51f83a,_0x152964){var _0x4b48a8=[_0xac19('0x29'),'cm_contacts.scheduledat',_0xac19('0x2a'),_0xac19('0x2b'),_0x259d00+'.'+_0x51f83a,_0xac19('0x2c'),_0xac19('0x2d'),_0xac19('0x2e'),_0xac19('0x2f'),'\x22'+_0x152964+'\x22'];return squel[_0xac19('0x30')]()[_0xac19('0x31')](_0xac19('0x32'))[_0xac19('0x33')]([_0xac19('0x18'),'scheduledat',_0xac19('0x34'),'ListId',_0x51f83a,_0xac19('0x35'),'updatedAt',_0xac19('0x36'),_0xac19('0x37'),_0xac19('0x38')],squel[_0xac19('0x11')]()['fields'](_0x4b48a8)['from'](_0x259d00)['join'](_0xac19('0x39'),null,_0xac19('0x3a')+_0x259d00+_0xac19('0x3b'))[_0xac19('0x3c')](_0x1e6763,null,_0x1e6763+_0xac19('0x12')+_0x259d00+'.'+_0x51f83a)[_0xac19('0x13')](_0x259d00+_0xac19('0x3d'),_0x310b39)['where'](_0xac19('0x3e'),NOW)[_0xac19('0x13')](_0xac19('0x3f'),selectNotIn(_0x259d00,_0x1e6763,_0x51f83a,'cm_hopper',[_0xac19('0x40'),'\x22onlyIfOpen\x22']))[_0xac19('0x13')](_0xac19('0x3f'),selectNotIn(_0x259d00,_0x1e6763,_0x51f83a,_0xac19('0x32'),[_0xac19('0x40')])))[_0xac19('0x41')]();}function insertCmHopperBlack(_0x111584,_0x8fd928,_0x1d09f7,_0x2b70ea){var _0x5693e4=[_0xac19('0x29'),_0xac19('0x2a'),'cm_contacts.ListId',_0x8fd928+'.'+_0x2b70ea,_0xac19('0x2c'),_0xac19('0x2d')];return squel['insert']()['into'](_0xac19('0x42'))[_0xac19('0x33')]([_0xac19('0x18'),_0xac19('0x34'),_0xac19('0x43'),_0x2b70ea,_0xac19('0x35'),_0xac19('0x44')],squel[_0xac19('0x11')]()[_0xac19('0x45')](_0x5693e4)[_0xac19('0x46')](_0x8fd928)[_0xac19('0x3c')](_0xac19('0x39'),null,'cm_contacts.ListId\x20=\x20'+_0x8fd928+_0xac19('0x3b'))[_0xac19('0x3c')](_0x1d09f7,null,_0x1d09f7+_0xac19('0x12')+_0x8fd928+'.'+_0x2b70ea)[_0xac19('0x13')](_0x8fd928+'.CmListId\x20=\x20?',_0x111584)[_0xac19('0x13')](_0xac19('0x3e'),NOW)[_0xac19('0x13')](_0xac19('0x3f'),squel[_0xac19('0x11')]()[_0xac19('0x47')]('phone')[_0xac19('0x46')](_0xac19('0x42'))[_0xac19('0x13')](_0xac19('0x48'),_0x111584)[_0xac19('0x13')](_0x2b70ea+_0xac19('0x49'),_0x8fd928+'.'+_0x2b70ea)))[_0xac19('0x41')]();}function insertCmHopperAdditionalPhones(_0x2fc773){var _0xa31ed3=[_0xac19('0x4a'),_0xac19('0x4b'),'cm_contact_has_items.OrderBy',_0xac19('0x4c'),'cm_contact_has_items.updatedAt'];return squel[_0xac19('0x30')]()['into'](_0xac19('0x4d'))[_0xac19('0x33')]([_0xac19('0x4e'),_0xac19('0x18'),_0xac19('0x4f'),_0xac19('0x35'),_0xac19('0x44')],squel[_0xac19('0x11')]()[_0xac19('0x45')](_0xa31ed3)[_0xac19('0x46')]('cm_hopper')['join']('cm_contacts',null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0xac19('0x3c')](_0xac19('0x50'),null,_0xac19('0x51'))[_0xac19('0x13')](_0xac19('0x52'),_0x2fc773)[_0xac19('0x13')](_0xac19('0x3e'),NOW))[_0xac19('0x41')]();}function insertCmContact(_0x10e08c,_0x3c8d40,_0x3b8a53,_0x27a381){var _0x571b5f=_[_0xac19('0x53')](_[_0xac19('0x54')](_0x27a381),[_0xac19('0x43'),_0xac19('0x55'),_0xac19('0x35'),_0xac19('0x44')]);return squel[_0xac19('0x30')]()[_0xac19('0x31')]('cm_contacts')[_0xac19('0x33')](_0x571b5f,squel[_0xac19('0x11')]()[_0xac19('0x45')](_0x571b5f)['from'](_0x3c8d40)[_0xac19('0x13')]('('+_0x3b8a53[_0xac19('0x3c')](',')+_0xac19('0x56'),squel[_0xac19('0x11')]()[_0xac19('0x45')](_0x3b8a53)[_0xac19('0x46')](_0xac19('0x39'))[_0xac19('0x13')](_0xac19('0x48'),_0x10e08c))[_0xac19('0x13')]('id\x20IN\x20?',squel[_0xac19('0x11')]()[_0xac19('0x47')](_0xac19('0x57'),'min_id')[_0xac19('0x46')](_0x3c8d40)[_0xac19('0x58')](_0x3b8a53['join'](','))))['toString']();}function handleStop(){logger[_0xac19('0x59')](_0xac19('0x5a'));stopped=!![];}function handleUncaughtException(_0x5ce5bc){logger[_0xac19('0x1e')](_0x5ce5bc[_0xac19('0x1f')]);process[_0xac19('0x5b')](0x1);}function handleError(_0x15cc9e,_0x4cac1b){stats[_0xac19('0x5c')][_0xac19('0x1b')]({'name':_0x4cac1b[_0xac19('0x5d')],'message':_0x4cac1b[_0xac19('0x1f')],'row':_0x15cc9e});}function handleQuery(_0x21be91){logger[_0xac19('0x59')](_0x21be91);return db[_0xac19('0x5e')][_0xac19('0x15')](_0x21be91)[_0xac19('0x16')](function(_0x23156a){results[_0xac19('0x1b')](_0x23156a);})[_0xac19('0x1d')](function(_0x58bc3d){logger[_0xac19('0x1e')](_0x58bc3d[_0xac19('0x1f')]);});}function main(_0xedee68,_0x51bee7,_0x5beee3,_0x38b212){logger['info']('main',_0xedee68,JSON[_0xac19('0x5f')](_0x51bee7));process[_0xac19('0x60')](_0xac19('0x61'));var _0x2b3dc0=_0x51bee7[_0xac19('0x62')];var _0x555613=_[_0xac19('0x63')](_0x2b3dc0);var _0x14b18b=_0x51bee7[_0xac19('0x64')];var _0x451a93=path[_0xac19('0x3c')](config[_0xac19('0x65')],_0xac19('0x66'),_0x14b18b+_0xac19('0x67'));logger[_0xac19('0x59')]('body',_0x51bee7);db['ContactItemType'][_0xac19('0x68')]({'raw':!![],'attributes':['id',_0xac19('0x69')]})['then'](function(_0x29b235){for(var _0x1903fe=0x0;_0x1903fe<_0x29b235['length'];_0x1903fe++){if(_0x29b235[_0x1903fe][_0xac19('0x69')]in _0x2b3dc0){contactItemTypes[_0xac19('0x1b')](_0x29b235[_0x1903fe]);delete _0x555613[_0x29b235[_0x1903fe][_0xac19('0x69')]];hasAdditionalPhones=!![];}for(var _0x534392 in _0x2b3dc0){if(_0x29b235[_0x1903fe][_0xac19('0x69')]+_0xac19('0x6a')===_0x534392){phoneDescriptions[_0xac19('0x1b')]({'itemTypeId':_0x29b235[_0x1903fe]['id'],'description':_0x534392});delete _0x555613[_0x534392];}}}if(hasAdditionalPhones)_0x555613[_0xac19('0x1a')]='';var _0x3512ba=_['keys'](_0x555613)[_0xac19('0x3c')]();logger[_0xac19('0x59')](_0xac19('0x6b'),_0x3512ba);fs[_0xac19('0x6c')](_0x451a93,_0x3512ba+'\x0a');Papa[_0xac19('0x6d')](fs[_0xac19('0x6e')](_0xedee68),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2afb93,_0x41affc){try{for(var _0xbb8088=0x0,_0x5a7f87=[];_0xbb8088<_0x2afb93[_0xac19('0x6f')][_0xac19('0x17')];_0xbb8088++){stats[_0xac19('0x70')]+=0x1;if(_0x2afb93[_0xac19('0x5c')][_0xbb8088]){handleError(_0x2afb93[_0xac19('0x6f')][_0xbb8088],_0x2afb93[_0xac19('0x5c')][_0xbb8088]);}else{var _0x49ba3f=[];var _0x524e2e=[];var _0x5c8dee={};for(var _0xbbf8ec in _0x2b3dc0){let _0x1c1c67=contactItemTypes[_0xac19('0x71')](_0x3dc4c7=>_0x3dc4c7[_0xac19('0x69')]===_0xbbf8ec);let _0x5ca522=contactItemTypes[_0xac19('0x71')](_0x29739a=>_0x29739a[_0xac19('0x69')]+_0xac19('0x6a')===_0xbbf8ec);if(_[_0xac19('0x19')](_0x1c1c67)&&_[_0xac19('0x19')](_0x5ca522)){if(_0x2b3dc0['hasOwnProperty'](_0xbbf8ec)){if(_0x2afb93[_0xac19('0x6f')][_0xbb8088][_0x2b3dc0[_0xbbf8ec]]){var _0x7498c7=_[_0xac19('0x72')](_0x2afb93[_0xac19('0x6f')][_0xbb8088][_0x2b3dc0[_0xbbf8ec]]['replace'](/"/g,'\x27'));switch(_0xbbf8ec){case _0xac19('0x73'):var _0x39e36b=moment(_0x7498c7,_0xac19('0xc'),!![]);if(_0x39e36b['isValid']()){_0x5a7f87['push']('\x22'+_0x7498c7+'\x22');}else{_0x49ba3f['push'](_0xac19('0x74'));}break;case _0xac19('0x36'):var _0x2fedef=parseInt(_0x7498c7);_0x7498c7=_['isNaN'](_0x2fedef)||_0x2fedef<0x0||_0x2fedef>0x4?_0x38b212?0x3:0x2:_0x2fedef;_0x5a7f87[_0xac19('0x1b')]('\x22'+_0x7498c7+'\x22');break;case _0xac19('0x37'):var _0x1f4ecc=parseInt(_0x7498c7);if(_[_0xac19('0x75')](_0x1f4ecc)&&_[_0xac19('0x76')](_0x5beee3,_0x1f4ecc)){_0x5a7f87[_0xac19('0x1b')]('\x22'+_0x1f4ecc+'\x22');}else{_0x49ba3f[_0xac19('0x1b')](_0xac19('0x77'));}break;case _0xac19('0x78'):if(isEmail(_0x7498c7)){_0x5a7f87[_0xac19('0x1b')]('\x22'+_0x7498c7+'\x22');}else{_0x49ba3f[_0xac19('0x1b')](_0xac19('0x79'));}break;case'dateOfBirth':var _0x5f39ed=moment(_0x7498c7,_0xac19('0x7a'),!![]);if(_0x5f39ed[_0xac19('0x7b')]()){_0x5a7f87[_0xac19('0x1b')]('\x22'+_0x7498c7+'\x22');}else{_0x49ba3f[_0xac19('0x1b')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x5a7f87[_0xac19('0x1b')]('\x22'+_0x7498c7+'\x22');}}else{switch(_0xbbf8ec){case'firstName':case _0xac19('0x18'):_0x49ba3f[_0xac19('0x1b')](_0xbbf8ec+_0xac19('0x7c'));break;default:_0x5a7f87[_0xac19('0x1b')]('\x22\x22');}}}}else{var _0x2d1d02='';if(!_['isNil'](_0x1c1c67)){if(!_0x5c8dee[_0xac19('0x7d')](_0x1c1c67['id'])){for(var _0x24fd75=0x0;_0x24fd75<_0x2b3dc0[_0xbbf8ec][_0xac19('0x17')];_0x24fd75++){var _0x7498c7=_[_0xac19('0x72')](_0x2afb93['data'][_0xbb8088][_0x2b3dc0[_0xbbf8ec][_0x24fd75]][_0xac19('0x7e')](/"/g,'\x27'));var _0x8fc110=phoneDescriptions[_0xac19('0x71')](_0x165dba=>_0x165dba['itemTypeId']===_0x1c1c67['id']);if(!_[_0xac19('0x19')](_0x8fc110)){var _0x1ad2ef=_[_0xac19('0x72')](_0x2afb93[_0xac19('0x6f')][_0xbb8088][_0x2b3dc0[_0x8fc110[_0xac19('0x7f')]][0x0]][_0xac19('0x7e')](/"/g,'\x27'));if(!_[_0xac19('0x19')](_0x1ad2ef))_0x7498c7=_0x7498c7+'§'+_0x1ad2ef;}if(_0x2d1d02=='')_0x2d1d02=_0x7498c7;else _0x2d1d02+='|'+_0x7498c7;}_0x524e2e[_0xac19('0x1b')](_0x1c1c67['id']+':'+_0x2d1d02);_0x5c8dee[_0x1c1c67['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5a7f87['push']('\x22'+_0x524e2e[_0xac19('0x3c')](';')+'\x22');}if(_0x49ba3f['length']){handleError(_0x2afb93[_0xac19('0x6f')][_0xbb8088],{'code':_0xac19('0x80'),'message':_0x49ba3f['join']()});}else{fs[_0xac19('0x81')](_0x451a93,_0x5a7f87[_0xac19('0x3c')]()+'\x0a');}_0x5a7f87=[];}if(!(stats['rows']%0xc8)){socket[_0xac19('0x82')](_0xac19('0x83')+_0x14b18b,stats);stats[_0xac19('0x5c')]=[];}}if(stopped){logger[_0xac19('0x59')](_0xac19('0x84'));_0x41affc[_0xac19('0x85')]();}}catch(_0x513cbf){handleError(_0x2afb93[_0xac19('0x6f')][_0xbb8088],{'code':_0xac19('0x86'),'message':_0x513cbf['message']});logger[_0xac19('0x1e')]('step',_0x513cbf[_0xac19('0x1f')]);}},'complete':function(){try{var _0x241f98=[];var _0x5924cb=tempTableName;_0x241f98[_0xac19('0x1b')](_0xac19('0x87')+_0x5924cb+'\x20LIKE\x20cm_contacts;');logger[_0xac19('0x59')]('CIS\x20len',contactItemTypes[_0xac19('0x17')]);var _0x6cc203=util['format'](_0xac19('0x88'),_0x451a93,_0x5924cb,_0x3512ba,_0x51bee7[_0xac19('0x43')],_0x51bee7['CompanyId']||null,NOW,NOW);if(_['isNil'](_0x2b3dc0['scheduledat'])){_0x6cc203+=_0xac19('0x89');}_0x241f98['push'](_0x6cc203);BPromise[_0xac19('0x8a')](_0x241f98,handleQuery)[_0xac19('0x1c')](function(_0x1fce29){BPromise[_0xac19('0x8b')]([handleAdditionalPhones()])[_0xac19('0x1c')](function(){_0x241f98=[];for(var _0x411925=0x0;_0x411925\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.updatedAt','i.closed','i.attach','i.lastMsgAt','i.subject','i.disposition','i.to','i.ContactId','i.MailAccountId','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','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','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','limit','offset','sequelize','groupBy','Setting','enableEmailPreview','clone','COUNT(*)','getSelectedTags','isEmpty','lodash','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','agent','search','select','field','name','color','from','tools_tags','user_has_','_interactions','u.fullname','ui.','left_join','users','length','where','\x20IN\x20?','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','messages','me.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','forEach','unreadMessages\x20{OPERATOR}\x200','replace','{OPERATOR}','isNumeric','i.id\x20LIKE\x20?','sms','whatsapp','i.phone\x20LIKE\x20?','fax','i.fax\x20LIKE\x20?','openchannel','mail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','conditions','find','buildExpression','type','text','start','value','end','unreadMessages','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','map','tags','clause','and','ids','User','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','body','keys','some','compact','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','read','tag','filter','get','capitalize','Websites','Accounts','role','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','unshift'];(function(_0x21af3a,_0x386e1d){var _0x268a49=function(_0x41a650){while(--_0x41a650){_0x21af3a['push'](_0x21af3a['shift']());}};_0x268a49(++_0x386e1d);}(_0xa2af,0xe0));var _0xfa2a=function(_0x596769,_0x2c273c){_0x596769=_0x596769-0x0;var _0x2635a5=_0xa2af[_0x596769];return _0x2635a5;};'use strict';var _=require(_0xfa2a('0x0'));var squel=require(_0xfa2a('0x1'));var as=require(_0xfa2a('0x2'));var qs=require(_0xfa2a('0x3'));var updateInteraction=require(_0xfa2a('0x4'))[_0xfa2a('0x5')];var utils=require(_0xfa2a('0x6'));var db=require(_0xfa2a('0x7'))['db'];function skipInteractionsQuery(_0x261e0b,_0x462403,_0x4f1731){var _0x4b7984=![];var _0x512087=utils[_0xfa2a('0x8')](_0x261e0b);if(_0x462403['role']===_0xfa2a('0x9')&&!_0x4f1731[_0xfa2a('0xa')]&&!_0x4f1731[_0x512087]){_0x4b7984=!![];}return _0x4b7984;}function getTagsQuery(){return squel[_0xfa2a('0xb')]()[_0xfa2a('0xc')]('id')[_0xfa2a('0xc')](_0xfa2a('0xd'))[_0xfa2a('0xc')](_0xfa2a('0xe'))[_0xfa2a('0xf')](_0xfa2a('0x10'));}function getUsersQuery(_0x533d7d,_0x5134ca){var _0x412afe=utils['getInteractionFK'](_0x533d7d);var _0x4eef64=_0xfa2a('0x11')+_0x533d7d+_0xfa2a('0x12');var _0x38af1e=squel['select']()[_0xfa2a('0xc')]('u.id')[_0xfa2a('0xc')](_0xfa2a('0x13'))[_0xfa2a('0xc')](_0xfa2a('0x14')+_0x412afe)[_0xfa2a('0xf')](_0x4eef64,'ui')[_0xfa2a('0x15')](_0xfa2a('0x16'),'u','u.id\x20=\x20ui.UserId');if(_0x5134ca[_0xfa2a('0x17')]>0x0){_0x38af1e[_0xfa2a('0x18')]('ui.'+_0x412afe+_0xfa2a('0x19'),_['map'](_0x5134ca,'id'));}return _0x38af1e;}function getInteractionsQuery(_0x123ee4){var _0x205a1f=utils['getInteractionsTables'](_0x123ee4);var _0x445078=utils[_0xfa2a('0x8')](_0x123ee4);var _0x5e75d9=utils['getInteractionFK'](_0x123ee4);return squel[_0xfa2a('0xb')]()[_0xfa2a('0xf')](_0x205a1f['interactions'],'i')[_0xfa2a('0x15')]('cm_contacts','c',_0xfa2a('0x1a'))[_0xfa2a('0x15')](_0xfa2a('0x16'),'o',_0xfa2a('0x1b'))[_0xfa2a('0x15')](_0x205a1f[_0xfa2a('0x1c')],'a','a.id\x20=\x20i.'+_0x445078)[_0xfa2a('0x15')](_0x205a1f[_0xfa2a('0x1d')],'me',_0xfa2a('0x1e')+_0x5e75d9+_0xfa2a('0x1f'))[_0xfa2a('0x15')](_0x205a1f[_0xfa2a('0x20')],'it','it.'+_0x5e75d9+_0xfa2a('0x1f'))[_0xfa2a('0x15')]('tools_tags','t',_0xfa2a('0x21'));}function getSqlClauses(){var _0x172454={'body':squel['expr'](),'contact':squel[_0xfa2a('0x22')](),'default':squel[_0xfa2a('0x22')](),'fields':squel[_0xfa2a('0x22')](),'filter':squel[_0xfa2a('0x22')](),'read':squel[_0xfa2a('0x22')](),'tags':{'clause':squel[_0xfa2a('0x22')](),'ids':null},'user':squel[_0xfa2a('0x22')]()};return _0x172454;}function parseTagParameter(_0x4afaa8){var _0x435e39=squel[_0xfa2a('0x22')]();if(_0x4afaa8){var _0x1f4e21=utils['getSelectedTags'](_0x4afaa8);_0x1f4e21[_0xfa2a('0x23')](function(_0x2ee7d5){_0x435e39['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2ee7d5+',%');});}return _0x435e39;}function parseReadParameter(_0x193670){var _0xfbb07f='';if(_0x193670){_0xfbb07f=_0xfa2a('0x24');if(_0x193670==='1'){_0xfbb07f=_0xfbb07f[_0xfa2a('0x25')](_0xfa2a('0x26'),'=');}else{_0xfbb07f=_0xfbb07f['replace'](_0xfa2a('0x26'),'>');}}return _0xfbb07f;}function parseSearchFilter(_0x4134f2,_0x150513){var _0x3b9c03=squel[_0xfa2a('0x22')]();if(_0x150513){var _0x17917c=_0x150513[_0xfa2a('0x25')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xfa2a('0x27')](_0x17917c)){_0x3b9c03['or'](_0xfa2a('0x28'),_0x17917c+'%');switch(_0x4134f2){case _0xfa2a('0x29'):case _0xfa2a('0x2a'):_0x3b9c03['or'](_0xfa2a('0x2b'),_0x17917c+'%');break;case _0xfa2a('0x2c'):_0x3b9c03['or'](_0xfa2a('0x2d'),_0x17917c+'%');break;case _0xfa2a('0x2e'):_0x3b9c03['or']('i.from\x20LIKE\x20?',_0x17917c+'%');break;case _0xfa2a('0x2f'):_0x3b9c03['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xfa2a('0x30')](_0x17917c,!![]))['or'](_0xfa2a('0x31'),qs[_0xfa2a('0x30')](_0x17917c));break;}}else if(_0x4134f2===_0xfa2a('0x2f')&&qs['isEmail'](_0x17917c)){_0x3b9c03['or']('c.email\x20LIKE\x20?',_0x17917c+'%');}else{if(_0x4134f2===_0xfa2a('0x2f')){_0x3b9c03['or'](_0xfa2a('0x32'),qs[_0xfa2a('0x30')](_0x17917c,!![]))['or'](_0xfa2a('0x31'),qs['getFullTextValue'](_0x17917c));}else if(_0x4134f2!=='fax'){_0x3b9c03['or'](_0xfa2a('0x33'),qs[_0xfa2a('0x30')](_0x17917c));}_0x3b9c03['or'](_0xfa2a('0x34'),qs['getFullTextValue'](_0x17917c,!![]),null);}}return _0x3b9c03;}function parseAdvancedSearchFilter(_0x57a21a,_0x1218ed){var _0x36ebdb=getSqlClauses();var _0x5a1be0=as[_0xfa2a('0x35')](_0x57a21a);var _0x358145=_0x5a1be0['sqlOperator'];for(var _0x245b04=0x0;_0x245b04<_0x5a1be0['conditions']['length'];_0x245b04++){var _0x43e7b5=_0x5a1be0[_0xfa2a('0x36')][_0x245b04];var _0x320558='i';var _0x359cf5=_[_0xfa2a('0x37')](_0x1218ed,['name',_0x43e7b5['field']]);if(_0x359cf5){var _0x214c71=as[_0xfa2a('0x38')](_0x320558,_0x359cf5[_0xfa2a('0x39')],_0x43e7b5);_0x36ebdb['default'][_0x358145](_0x214c71[_0xfa2a('0x3a')],_0x214c71['value'][_0xfa2a('0x3b')],_0x214c71[_0xfa2a('0x3c')][_0xfa2a('0x3d')]);}else{switch(_0x43e7b5[_0xfa2a('0xc')]){case _0xfa2a('0x3e'):var _0x4f5030=parseReadParameter(_0x43e7b5['value']);_0x36ebdb['read']['and'](_0x4f5030);break;case _0xfa2a('0x3f'):if(_0x43e7b5[_0xfa2a('0x40')]===_0xfa2a('0x41')){if(_0x43e7b5[_0xfa2a('0x3c')][_0xfa2a('0x42')]('\x20')[_0xfa2a('0x17')]>0x1){_0x36ebdb[_0xfa2a('0x43')][_0x358145]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xfa2a('0x30')](_0x43e7b5['value'],!![]),null);}else{var _0x3cd1ac='%'+_0x43e7b5[_0xfa2a('0x3c')]+'%';_0x36ebdb['contact'][_0x358145](_0xfa2a('0x44'),_0x3cd1ac,_0x3cd1ac,_0x3cd1ac);}}else{_0x359cf5=_[_0xfa2a('0x37')](_0x1218ed,['name',_0xfa2a('0x45')]);_0x43e7b5[_0xfa2a('0xc')]='ContactId';_0x214c71=as[_0xfa2a('0x38')](_0x320558,_0x359cf5[_0xfa2a('0x39')],_0x43e7b5);_0x36ebdb['contact'][_0x358145](_0x214c71[_0xfa2a('0x3a')],_0x214c71['value'][_0xfa2a('0x3b')],_0x214c71[_0xfa2a('0x3c')][_0xfa2a('0x3d')]);}break;case _0xfa2a('0x46'):var _0xdb017d=_0x43e7b5[_0xfa2a('0x3c')][_0xfa2a('0x42')](',')[_0xfa2a('0x47')](function(_0x3c45c6){return Number(_0x3c45c6);});var _0x2373de=parseTagParameter(_0xdb017d);_0x36ebdb[_0xfa2a('0x48')][_0xfa2a('0x49')][_0xfa2a('0x4a')](_0x2373de);_0x36ebdb[_0xfa2a('0x48')][_0xfa2a('0x4b')]=_0xdb017d;break;case _0xfa2a('0x4c'):if(_0x43e7b5['operator']===_0xfa2a('0x41')){_0x36ebdb[_0xfa2a('0x4d')][_0x358145](_0xfa2a('0x4e'),'%'+_0x43e7b5[_0xfa2a('0x3c')]+'%',null);}else{_0x359cf5=_[_0xfa2a('0x37')](_0x1218ed,[_0xfa2a('0xd'),_0xfa2a('0x4f')]);_0x43e7b5['field']='UserId';_0x214c71=as[_0xfa2a('0x38')](_0x320558,_0x359cf5[_0xfa2a('0x39')],_0x43e7b5);_0x36ebdb[_0xfa2a('0x4d')][_0x358145](_0x214c71[_0xfa2a('0x3a')],_0x214c71[_0xfa2a('0x3c')][_0xfa2a('0x3b')],_0x214c71[_0xfa2a('0x3c')]['end']);}break;case _0xfa2a('0x50'):case'plainBody':_0x214c71=as[_0xfa2a('0x38')]('me',null,_0x43e7b5);_0x36ebdb[_0xfa2a('0x50')][_0x358145](_0x214c71['text'],_0x214c71[_0xfa2a('0x3c')][_0xfa2a('0x3b')],_0x214c71[_0xfa2a('0x3c')][_0xfa2a('0x3d')]);break;}}}return _0x36ebdb;}function parseModelFields(_0x46770b,_0x3ceeca,_0x44eeda){var _0x11ae96=utils['getAccountFK'](_0x46770b);var _0x10d0a7=squel[_0xfa2a('0x22')]();var _0x44d565=_(_0x3ceeca)[_0xfa2a('0x51')]()[_0xfa2a('0x47')](function(_0x58668f){return _[_0xfa2a('0x52')](_0x44eeda,['name',_0x58668f])?_0x58668f:undefined;})[_0xfa2a('0x53')]()[_0xfa2a('0x3c')]();if(_0x44d565['length']>0x0){_0x44d565[_0xfa2a('0x23')](function(_0x284911){if(_0x284911===_0x11ae96){_0x10d0a7[_0xfa2a('0x4a')]('i.'+_0x11ae96+_0xfa2a('0x19'),[][_0xfa2a('0x54')](_0x3ceeca[_0x284911]));}else if(_0x284911===_0xfa2a('0x55')){var _0x1b1bd7=JSON[_0xfa2a('0x56')](_0x3ceeca[_0x284911])['$gte'];var _0x340b47=JSON[_0xfa2a('0x56')](_0x3ceeca[_0x284911])[_0xfa2a('0x57')];_0x10d0a7['and'](_0xfa2a('0x58'),_0x1b1bd7,_0x340b47);}else{if(_0x3ceeca[_0x284911]===_0xfa2a('0x59')){_0x10d0a7[_0xfa2a('0x4a')]('i.'+_0x284911+_0xfa2a('0x5a'));}else{_0x10d0a7[_0xfa2a('0x4a')]('i.'+_0x284911+_0xfa2a('0x5b'),_0x3ceeca[_0x284911]);}}});}return _0x10d0a7;}function parseQueryParameters(_0x10f2b8,_0x40cbf9,_0x15de6e){var _0xd7a366=getSqlClauses();return Promise[_0xfa2a('0x5c')]()[_0xfa2a('0x5d')](function(){return parseModelFields(_0x10f2b8,_0x40cbf9,_0x15de6e);})['then'](function(_0x1f963b){_0xd7a366['fields'][_0xfa2a('0x4a')](_0x1f963b);return parseReadParameter(_0x40cbf9[_0xfa2a('0x5e')]);})[_0xfa2a('0x5d')](function(_0x3d9758){_0xd7a366[_0xfa2a('0x5e')][_0xfa2a('0x4a')](_0x3d9758);return parseTagParameter(_0x40cbf9[_0xfa2a('0x5f')]);})['then'](function(_0xfffce2){_0xd7a366[_0xfa2a('0x48')]['clause']['and'](_0xfffce2);return parseSearchFilter(_0x10f2b8,_0x40cbf9[_0xfa2a('0x60')]);})[_0xfa2a('0x5d')](function(_0x4e358e){_0xd7a366[_0xfa2a('0x60')]=_0x4e358e;return _0xd7a366;});}function checkAccountsRestrictions(_0x1168bf,_0x12b0c7,_0x2a452c){var _0x230a39=utils[_0xfa2a('0x8')](_0x1168bf);var _0x40e89e=_0xfa2a('0x61')+_[_0xfa2a('0x62')](_0x1168bf)+(_0x1168bf==='chat'?_0xfa2a('0x63'):_0xfa2a('0x64'));var _0x4b3805=squel['expr']();return Promise[_0xfa2a('0x5c')]()[_0xfa2a('0x5d')](function(){if(_0x2a452c[_0xfa2a('0xa')]&&_0x12b0c7[_0xfa2a('0x65')]===_0xfa2a('0x9')){return _0x12b0c7[_0x40e89e]({'attributes':['id'],'raw':!![]});}})[_0xfa2a('0x5d')](function(_0x83f7e9){if(_0x83f7e9){if(_0x83f7e9['length']===0x0){_0x4b3805[_0xfa2a('0x4a')]('i.'+_0x230a39+_0xfa2a('0x5a'));}else{_0x4b3805['and']('i.'+_0x230a39+_0xfa2a('0x19'),_[_0xfa2a('0x47')](_0x83f7e9,'id'));}}else if(!_0x2a452c[_0x230a39]){_0x4b3805['and']('i.'+_0x230a39+_0xfa2a('0x66'));}})[_0xfa2a('0x5d')](function(){return _0x4b3805;});}function getClosedOrderClause(_0xc5bff2,_0x94fbca){var _0x586e5b='';var _0x395985=[_0xfa2a('0x67'),_0xfa2a('0x68'),'i.disposition'];if(_0xc5bff2==='mail'){_0x395985[_0xfa2a('0x69')](_0xfa2a('0x6a'));}if(_0x94fbca[_0xfa2a('0x6b')]==='0'&&_0xc5bff2===_0xfa2a('0x2f')){_0x586e5b=_0xfa2a('0x6a');}else{if(_0x94fbca['closed']==='1'){_0x395985[_0xfa2a('0x6c')]();}_0x586e5b=_0xfa2a('0x6d')+_0x395985[_0xfa2a('0x6e')](',\x20')+')';}return _0x586e5b;}function getFilteredInteractions(_0x4c5e44,_0x18fbf1,_0x4378ce,_0x17a248){var _0x4235a9=utils[_0xfa2a('0x6f')](_0x4c5e44);var _0x9207a7=_['capitalize'](_0x4c5e44)+_0xfa2a('0x70');var _0x2c559b=[];var _0x4a782c=getTagsQuery();var _0x4c29e9={'type':db[_0xfa2a('0x71')][_0xfa2a('0x72')][_0xfa2a('0x73')],'raw':!![]};var _0x46fe3c=[];var _0x37af1f=[];return db['sequelize'][_0xfa2a('0x74')](_0x4a782c[_0xfa2a('0x75')](),_0x4c29e9)['then'](function(_0x95d8c7){_0x2c559b=_[_0xfa2a('0x76')](_0x95d8c7,'id');_0x4c29e9=_[_0xfa2a('0x77')](_0x4c29e9,{'model':db[_0x9207a7],'mapToModel':!![],'nest':!![]});if(_0x4378ce[_0xfa2a('0x78')]){_0x17a248['attributes'][_0xfa2a('0x23')](function(_0x5b2063){_0x18fbf1['field']('i.'+_0x5b2063);});}else{_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x79'),_0xfa2a('0x3e'));_0x18fbf1['field'](_0xfa2a('0x7a'),_0xfa2a('0x7b'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x7c'),'Account.mandatoryDisposition');if(_0x4c5e44===_0xfa2a('0x2f')){_0x18fbf1['field'](_0xfa2a('0x7d'),_0xfa2a('0x7e'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x7f'),_0xfa2a('0x80'));_0x18fbf1[_0xfa2a('0xc')]('i.id');_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x81'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x82'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x83'));_0x18fbf1[_0xfa2a('0xc')]('i.closedAt');_0x18fbf1['field'](_0xfa2a('0x84'));_0x18fbf1['field'](_0xfa2a('0x85'));_0x18fbf1[_0xfa2a('0xc')]('i.lastMsgDirection');_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x86'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x87'));_0x18fbf1[_0xfa2a('0xc')]('i.secondDisposition');_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x67'));_0x18fbf1['field']('i.substatus');_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x88'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x89'));_0x18fbf1['field'](_0xfa2a('0x8a'));_0x18fbf1[_0xfa2a('0xc')]('i.UserId');}else if(_0x4c5e44===_0xfa2a('0x2e')){_0x18fbf1['field'](_0xfa2a('0x8b'),_0xfa2a('0x80'));}else{_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x8c'),_0xfa2a('0x80'));}if(_0x4c5e44!==_0xfa2a('0x2f')){_0x18fbf1[_0xfa2a('0xc')]('i.*');}_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x8d'),_0xfa2a('0x8e'));_0x18fbf1[_0xfa2a('0xc')]('c.lastName',_0xfa2a('0x8f'));_0x18fbf1['field']('c.email',_0xfa2a('0x90'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x91'),_0xfa2a('0x92'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x93'),_0xfa2a('0x94'));_0x18fbf1['field'](_0xfa2a('0x95'),_0xfa2a('0x96'));_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x97'),_0xfa2a('0x98'));_0x18fbf1[_0xfa2a('0xc')]('o.internal','Owner.internal');_0x18fbf1[_0xfa2a('0xc')](_0xfa2a('0x99'),_0xfa2a('0x9a'));}if(_0x17a248[_0xfa2a('0x9b')]){_0x18fbf1['limit'](_0x17a248[_0xfa2a('0x9b')]);}if(_0x17a248[_0xfa2a('0x9c')]){_0x18fbf1['offset'](_0x17a248[_0xfa2a('0x9c')]);}return db['sequelize'][_0xfa2a('0x74')](_0x18fbf1[_0xfa2a('0x75')](),_0x4c29e9);})[_0xfa2a('0x5d')](function(_0x304f50){_0x46fe3c=_0x304f50;var _0x3de171=getUsersQuery(_0x4c5e44,_0x46fe3c);return db[_0xfa2a('0x9d')][_0xfa2a('0x74')](_0x3de171['toString'](),_0x4c29e9);})[_0xfa2a('0x5d')](function(_0x120bda){_0x37af1f=_[_0xfa2a('0x9e')](_0x120bda,_0x4235a9);if(_0x4c5e44===_0xfa2a('0x2f')){return db[_0xfa2a('0x9f')]['findOne']({'attributes':[_0xfa2a('0xa0')],'raw':!![]});}})[_0xfa2a('0x5d')](function(_0x128f0b){var _0x3d39e2=_0x128f0b?_0x128f0b[_0xfa2a('0xa0')]:undefined;var _0x497294=_0x46fe3c[_0xfa2a('0x47')](function(_0x39dc8a){return updateInteraction(_0x39dc8a,_0x2c559b,_0x37af1f,_0x3d39e2);});return Promise['all'](_0x497294);});}function countFilteredInteractions(_0x22fc0d,_0x13bca3){var _0x407eb7=_0x22fc0d[_0xfa2a('0xa1')]();_0x407eb7[_0xfa2a('0xc')](_0xfa2a('0xa2'));_0x407eb7['field'](_0xfa2a('0x79'),_0xfa2a('0x3e'));var _0x34ac23=utils[_0xfa2a('0xa3')](_0x13bca3);if(!_[_0xfa2a('0xa4')](_0x34ac23)){_0x407eb7[_0xfa2a('0x18')]('t.id\x20IN\x20?',_0x34ac23);}var _0x55716a={'type':db['Sequelize'][_0xfa2a('0x72')][_0xfa2a('0x73')],'raw':!![]};return db['sequelize'][_0xfa2a('0x74')](_0x407eb7[_0xfa2a('0x75')](),_0x55716a);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0x0622=['from','user_has_','_interactions','u.id','u.fullname','ui.','left_join','users','u.id\x20=\x20ui.UserId','where','\x20IN\x20?','map','getInteractionsTables','getAccountFK','getInteractionFK','interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','accounts','a.id\x20=\x20i.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','sms','whatsapp','i.phone\x20LIKE\x20?','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.email\x20LIKE\x20?','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','fax','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','parseSearch','sqlOperator','conditions','length','buildExpression','type','default','text','start','value','end','unreadMessages','read','Contact','operator','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','Tag','tags','clause','and','ids','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname,\x20o.internal)\x20LIKE\x20?','UserId','user','body','plainBody','some','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','filter','capitalize','chat','Websites','Accounts','search','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.disposition','unshift','closed','i.substatus','shift','join','Interaction','QueryTypes','query','toString','keyBy','merge','attributes','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','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.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.to','i.MailAccountId','i.UserId','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','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','Contact.email','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','limit','offset','sequelize','groupBy','Setting','findOne','enableEmailPreview','all','COUNT(*)','isEmpty','Sequelize','SELECT','exports','squel','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','role','agent','select','field','name','color'];(function(_0x3aca11,_0x4c516d){var _0x20002b=function(_0x1b69f0){while(--_0x1b69f0){_0x3aca11['push'](_0x3aca11['shift']());}};_0x20002b(++_0x4c516d);}(_0x0622,0x96));var _0x2062=function(_0x4fb6b6,_0x5eb1c7){_0x4fb6b6=_0x4fb6b6-0x0;var _0x3ea470=_0x0622[_0x4fb6b6];return _0x3ea470;};'use strict';var _=require('lodash');var squel=require(_0x2062('0x0'));var as=require(_0x2062('0x1'));var qs=require(_0x2062('0x2'));var updateInteraction=require(_0x2062('0x3'))[_0x2062('0x4')];var utils=require(_0x2062('0x5'));var db=require('../../mysqldb')['db'];function skipInteractionsQuery(_0x242c07,_0x1e2fc6,_0x28de7e){var _0x5585a6=![];var _0x745e96=utils['getAccountFK'](_0x242c07);if(_0x1e2fc6[_0x2062('0x6')]===_0x2062('0x7')&&!_0x28de7e['search']&&!_0x28de7e[_0x745e96]){_0x5585a6=!![];}return _0x5585a6;}function getTagsQuery(){return squel[_0x2062('0x8')]()[_0x2062('0x9')]('id')[_0x2062('0x9')](_0x2062('0xa'))['field'](_0x2062('0xb'))[_0x2062('0xc')]('tools_tags');}function getUsersQuery(_0x4a1b9c,_0x51d8b7){var _0x2429c2=utils['getInteractionFK'](_0x4a1b9c);var _0x47dd45=_0x2062('0xd')+_0x4a1b9c+_0x2062('0xe');var _0x3c3358=squel[_0x2062('0x8')]()[_0x2062('0x9')](_0x2062('0xf'))['field'](_0x2062('0x10'))[_0x2062('0x9')](_0x2062('0x11')+_0x2429c2)['from'](_0x47dd45,'ui')[_0x2062('0x12')](_0x2062('0x13'),'u',_0x2062('0x14'));if(_0x51d8b7['length']>0x0){_0x3c3358[_0x2062('0x15')](_0x2062('0x11')+_0x2429c2+_0x2062('0x16'),_[_0x2062('0x17')](_0x51d8b7,'id'));}return _0x3c3358;}function getInteractionsQuery(_0x52c7e1){var _0x45e9a0=utils[_0x2062('0x18')](_0x52c7e1);var _0x654ae6=utils[_0x2062('0x19')](_0x52c7e1);var _0x5eb990=utils[_0x2062('0x1a')](_0x52c7e1);return squel['select']()[_0x2062('0xc')](_0x45e9a0[_0x2062('0x1b')],'i')[_0x2062('0x12')](_0x2062('0x1c'),'c',_0x2062('0x1d'))[_0x2062('0x12')](_0x2062('0x13'),'o','o.id\x20=\x20i.UserId')[_0x2062('0x12')](_0x45e9a0[_0x2062('0x1e')],'a',_0x2062('0x1f')+_0x654ae6)[_0x2062('0x12')](_0x45e9a0['messages'],'me','me.'+_0x5eb990+_0x2062('0x20'))['left_join'](_0x45e9a0[_0x2062('0x21')],'it','it.'+_0x5eb990+'\x20=\x20i.id')[_0x2062('0x12')]('tools_tags','t',_0x2062('0x22'));}function getSqlClauses(){var _0x17276b={'body':squel[_0x2062('0x23')](),'contact':squel[_0x2062('0x23')](),'default':squel[_0x2062('0x23')](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel['expr'](),'tags':{'clause':squel[_0x2062('0x23')](),'ids':null},'user':squel['expr']()};return _0x17276b;}function parseTagParameter(_0x2bb50a){var _0x37136a=squel[_0x2062('0x23')]();if(_0x2bb50a){var _0x24cbed=utils[_0x2062('0x24')](_0x2bb50a);_0x24cbed[_0x2062('0x25')](function(_0x80322){_0x37136a['or'](_0x2062('0x26'),'%,'+_0x80322+',%');});}return _0x37136a;}function parseReadParameter(_0x4fd5cf){var _0x438d5b='';if(_0x4fd5cf){_0x438d5b='unreadMessages\x20{OPERATOR}\x200';if(_0x4fd5cf==='1'){_0x438d5b=_0x438d5b[_0x2062('0x27')](_0x2062('0x28'),'=');}else{_0x438d5b=_0x438d5b['replace'](_0x2062('0x28'),'>');}}return _0x438d5b;}function parseSearchFilter(_0x3a26e5,_0x51960c){var _0x4ae848=squel[_0x2062('0x23')]();if(_0x51960c){var _0x28170e=_0x51960c[_0x2062('0x27')]('\x5c','\x5c\x5c')[_0x2062('0x27')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x28170e)){_0x4ae848['or']('i.id\x20LIKE\x20?',_0x28170e+'%');switch(_0x3a26e5){case _0x2062('0x29'):case _0x2062('0x2a'):_0x4ae848['or'](_0x2062('0x2b'),_0x28170e+'%');break;case'fax':_0x4ae848['or'](_0x2062('0x2c'),_0x28170e+'%');break;case _0x2062('0x2d'):_0x4ae848['or'](_0x2062('0x2e'),_0x28170e+'%');break;case _0x2062('0x2f'):_0x4ae848['or'](_0x2062('0x30'),qs['getFullTextValue'](_0x28170e,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2062('0x31')](_0x28170e));break;}}else if(_0x3a26e5==='mail'&&qs['isEmail'](_0x28170e)){_0x4ae848['or'](_0x2062('0x32'),_0x28170e+'%');}else{if(_0x3a26e5===_0x2062('0x2f')){_0x4ae848['or'](_0x2062('0x30'),qs[_0x2062('0x31')](_0x28170e,!![]))['or'](_0x2062('0x33'),qs[_0x2062('0x31')](_0x28170e));}else if(_0x3a26e5!==_0x2062('0x34')){_0x4ae848['or'](_0x2062('0x35'),qs[_0x2062('0x31')](_0x28170e));}_0x4ae848['or'](_0x2062('0x36'),qs[_0x2062('0x31')](_0x28170e,!![]),null);}}return _0x4ae848;}function parseAdvancedSearchFilter(_0x4715de,_0x1fe544){var _0x3d2f80=getSqlClauses();var _0x514a05=as[_0x2062('0x37')](_0x4715de);var _0x145197=_0x514a05[_0x2062('0x38')];for(var _0x380732=0x0;_0x380732<_0x514a05[_0x2062('0x39')][_0x2062('0x3a')];_0x380732++){var _0x151225=_0x514a05[_0x2062('0x39')][_0x380732];var _0x1748b4='i';var _0x1a38d1=_['find'](_0x1fe544,[_0x2062('0xa'),_0x151225['field']]);if(_0x1a38d1){var _0x412dfc=as[_0x2062('0x3b')](_0x1748b4,_0x1a38d1[_0x2062('0x3c')],_0x151225);_0x3d2f80[_0x2062('0x3d')][_0x145197](_0x412dfc[_0x2062('0x3e')],_0x412dfc['value'][_0x2062('0x3f')],_0x412dfc[_0x2062('0x40')][_0x2062('0x41')]);}else{switch(_0x151225[_0x2062('0x9')]){case _0x2062('0x42'):var _0x4aa9c0=parseReadParameter(_0x151225['value']);_0x3d2f80[_0x2062('0x43')]['and'](_0x4aa9c0);break;case _0x2062('0x44'):if(_0x151225[_0x2062('0x45')]==='$substring'){if(_0x151225[_0x2062('0x40')][_0x2062('0x46')]('\x20')['length']>0x1){_0x3d2f80[_0x2062('0x47')][_0x145197]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x2062('0x31')](_0x151225['value'],!![]),null);}else{var _0x29967c='%'+_0x151225[_0x2062('0x40')]+'%';_0x3d2f80[_0x2062('0x47')][_0x145197](_0x2062('0x48'),_0x29967c,_0x29967c,_0x29967c);}}else{_0x1a38d1=_[_0x2062('0x49')](_0x1fe544,[_0x2062('0xa'),'ContactId']);_0x151225['field']='ContactId';_0x412dfc=as[_0x2062('0x3b')](_0x1748b4,_0x1a38d1[_0x2062('0x3c')],_0x151225);_0x3d2f80['contact'][_0x145197](_0x412dfc[_0x2062('0x3e')],_0x412dfc[_0x2062('0x40')][_0x2062('0x3f')],_0x412dfc['value'][_0x2062('0x41')]);}break;case _0x2062('0x4a'):var _0x5778fd=_0x151225['value'][_0x2062('0x46')](',')[_0x2062('0x17')](function(_0x51f5f4){return Number(_0x51f5f4);});var _0x3e9b8d=parseTagParameter(_0x5778fd);_0x3d2f80[_0x2062('0x4b')][_0x2062('0x4c')][_0x2062('0x4d')](_0x3e9b8d);_0x3d2f80[_0x2062('0x4b')][_0x2062('0x4e')]=_0x5778fd;break;case'User':if(_0x151225[_0x2062('0x45')]==='$substring'){_0x3d2f80['user'][_0x145197](_0x2062('0x4f'),'%'+_0x151225[_0x2062('0x40')]+'%',null);}else{_0x1a38d1=_[_0x2062('0x49')](_0x1fe544,['name',_0x2062('0x50')]);_0x151225[_0x2062('0x9')]=_0x2062('0x50');_0x412dfc=as[_0x2062('0x3b')](_0x1748b4,_0x1a38d1[_0x2062('0x3c')],_0x151225);_0x3d2f80[_0x2062('0x51')][_0x145197](_0x412dfc[_0x2062('0x3e')],_0x412dfc[_0x2062('0x40')][_0x2062('0x3f')],_0x412dfc[_0x2062('0x40')][_0x2062('0x41')]);}break;case _0x2062('0x52'):case _0x2062('0x53'):_0x412dfc=as['buildExpression']('me',null,_0x151225);_0x3d2f80[_0x2062('0x52')][_0x145197](_0x412dfc['text'],_0x412dfc['value'][_0x2062('0x3f')],_0x412dfc[_0x2062('0x40')][_0x2062('0x41')]);break;}}}return _0x3d2f80;}function parseModelFields(_0x3f22b7,_0x45832d,_0x30e6d6){var _0x4c836b=utils[_0x2062('0x19')](_0x3f22b7);var _0xecc8=squel[_0x2062('0x23')]();var _0x374807=_(_0x45832d)['keys']()['map'](function(_0x102240){return _[_0x2062('0x54')](_0x30e6d6,[_0x2062('0xa'),_0x102240])?_0x102240:undefined;})['compact']()[_0x2062('0x40')]();if(_0x374807[_0x2062('0x3a')]>0x0){_0x374807[_0x2062('0x25')](function(_0x95f53c){if(_0x95f53c===_0x4c836b){_0xecc8[_0x2062('0x4d')]('i.'+_0x4c836b+_0x2062('0x16'),[]['concat'](_0x45832d[_0x95f53c]));}else if(_0x95f53c===_0x2062('0x55')){var _0x9478c2=JSON[_0x2062('0x56')](_0x45832d[_0x95f53c])[_0x2062('0x57')];var _0x5963fe=JSON[_0x2062('0x56')](_0x45832d[_0x95f53c])[_0x2062('0x58')];_0xecc8[_0x2062('0x4d')](_0x2062('0x59'),_0x9478c2,_0x5963fe);}else{if(_0x45832d[_0x95f53c]===_0x2062('0x5a')){_0xecc8[_0x2062('0x4d')]('i.'+_0x95f53c+_0x2062('0x5b'));}else{_0xecc8['and']('i.'+_0x95f53c+_0x2062('0x5c'),_0x45832d[_0x95f53c]);}}});}return _0xecc8;}function parseQueryParameters(_0x17ba08,_0x12486e,_0x4b5fba){var _0x6a09aa=getSqlClauses();return Promise[_0x2062('0x5d')]()[_0x2062('0x5e')](function(){return parseModelFields(_0x17ba08,_0x12486e,_0x4b5fba);})[_0x2062('0x5e')](function(_0x4ca13a){_0x6a09aa[_0x2062('0x5f')][_0x2062('0x4d')](_0x4ca13a);return parseReadParameter(_0x12486e[_0x2062('0x43')]);})['then'](function(_0x2ff268){_0x6a09aa[_0x2062('0x43')][_0x2062('0x4d')](_0x2ff268);return parseTagParameter(_0x12486e[_0x2062('0x60')]);})[_0x2062('0x5e')](function(_0x48e293){_0x6a09aa[_0x2062('0x4b')]['clause'][_0x2062('0x4d')](_0x48e293);return parseSearchFilter(_0x17ba08,_0x12486e[_0x2062('0x61')]);})[_0x2062('0x5e')](function(_0x36bf8a){_0x6a09aa[_0x2062('0x61')]=_0x36bf8a;return _0x6a09aa;});}function checkAccountsRestrictions(_0x5adf17,_0x161cb8,_0x48dd00){var _0x2f140c=utils['getAccountFK'](_0x5adf17);var _0x3896f='get'+_[_0x2062('0x62')](_0x5adf17)+(_0x5adf17===_0x2062('0x63')?_0x2062('0x64'):_0x2062('0x65'));var _0x2d1730=squel[_0x2062('0x23')]();return Promise['resolve']()['then'](function(){if(_0x48dd00[_0x2062('0x66')]&&_0x161cb8[_0x2062('0x6')]===_0x2062('0x7')){return _0x161cb8[_0x3896f]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x5ed2d9){if(_0x5ed2d9){if(_0x5ed2d9[_0x2062('0x3a')]===0x0){_0x2d1730['and']('i.'+_0x2f140c+_0x2062('0x5b'));}else{_0x2d1730[_0x2062('0x4d')]('i.'+_0x2f140c+'\x20IN\x20?',_[_0x2062('0x17')](_0x5ed2d9,'id'));}}else if(!_0x48dd00[_0x2f140c]){_0x2d1730[_0x2062('0x4d')]('i.'+_0x2f140c+_0x2062('0x67'));}})[_0x2062('0x5e')](function(){return _0x2d1730;});}function getClosedOrderClause(_0x222a40,_0x4dfab1){var _0xba223d='';var _0x319c3e=[_0x2062('0x68'),'i.secondDisposition',_0x2062('0x69')];if(_0x222a40===_0x2062('0x2f')){_0x319c3e[_0x2062('0x6a')]('i.substatus');}if(_0x4dfab1[_0x2062('0x6b')]==='0'&&_0x222a40===_0x2062('0x2f')){_0xba223d=_0x2062('0x6c');}else{if(_0x4dfab1['closed']==='1'){_0x319c3e[_0x2062('0x6d')]();}_0xba223d='CONCAT_WS(\x27\x27,\x20'+_0x319c3e[_0x2062('0x6e')](',\x20')+')';}return _0xba223d;}function getFilteredInteractions(_0x2e621a,_0x1767e5,_0x4f3472,_0x5d39ac){var _0x308e46=utils[_0x2062('0x1a')](_0x2e621a);var _0x457393=_[_0x2062('0x62')](_0x2e621a)+_0x2062('0x6f');var _0x324e80=[];var _0x53580c=getTagsQuery();var _0x564104={'type':db['Sequelize'][_0x2062('0x70')]['SELECT'],'raw':!![]};var _0x3b1474=[];var _0x295430=[];return db['sequelize'][_0x2062('0x71')](_0x53580c[_0x2062('0x72')](),_0x564104)[_0x2062('0x5e')](function(_0x27c3cf){_0x324e80=_[_0x2062('0x73')](_0x27c3cf,'id');_0x564104=_[_0x2062('0x74')](_0x564104,{'model':db[_0x457393],'mapToModel':!![],'nest':!![]});if(_0x4f3472['fields']){_0x5d39ac[_0x2062('0x75')]['forEach'](function(_0x4692f4){_0x1767e5[_0x2062('0x9')]('i.'+_0x4692f4);});}else{_0x1767e5[_0x2062('0x9')](_0x2062('0x76'),_0x2062('0x42'));_0x1767e5[_0x2062('0x9')](_0x2062('0x77'),_0x2062('0x78'));_0x1767e5['field']('a.mandatoryDisposition',_0x2062('0x79'));if(_0x2e621a===_0x2062('0x2f')){_0x1767e5[_0x2062('0x9')]('a.email',_0x2062('0x7a'));_0x1767e5[_0x2062('0x9')](_0x2062('0x7b'),_0x2062('0x7c'));_0x1767e5[_0x2062('0x9')]('i.id');_0x1767e5[_0x2062('0x9')](_0x2062('0x7d'));_0x1767e5['field'](_0x2062('0x7e'));_0x1767e5[_0x2062('0x9')](_0x2062('0x7f'));_0x1767e5[_0x2062('0x9')](_0x2062('0x80'));_0x1767e5[_0x2062('0x9')](_0x2062('0x81'));_0x1767e5[_0x2062('0x9')](_0x2062('0x82'));_0x1767e5[_0x2062('0x9')](_0x2062('0x83'));_0x1767e5['field']('i.subject');_0x1767e5['field'](_0x2062('0x69'));_0x1767e5[_0x2062('0x9')]('i.secondDisposition');_0x1767e5[_0x2062('0x9')](_0x2062('0x68'));_0x1767e5[_0x2062('0x9')]('i.substatus');_0x1767e5[_0x2062('0x9')](_0x2062('0x84'));_0x1767e5[_0x2062('0x9')]('i.ContactId');_0x1767e5['field'](_0x2062('0x85'));_0x1767e5[_0x2062('0x9')](_0x2062('0x86'));}else if(_0x2e621a===_0x2062('0x2d')){_0x1767e5['field'](_0x2062('0x87'),_0x2062('0x7c'));}else{_0x1767e5[_0x2062('0x9')](_0x2062('0x88'),_0x2062('0x7c'));}if(_0x2e621a!==_0x2062('0x2f')){_0x1767e5[_0x2062('0x9')](_0x2062('0x89'));}_0x1767e5['field'](_0x2062('0x8a'),_0x2062('0x8b'));_0x1767e5[_0x2062('0x9')]('c.lastName',_0x2062('0x8c'));_0x1767e5[_0x2062('0x9')]('c.email',_0x2062('0x8d'));_0x1767e5['field']('c.phone',_0x2062('0x8e'));_0x1767e5[_0x2062('0x9')]('c.mobile',_0x2062('0x8f'));_0x1767e5[_0x2062('0x9')](_0x2062('0x90'),_0x2062('0x91'));_0x1767e5['field']('o.fullname',_0x2062('0x92'));_0x1767e5['field'](_0x2062('0x93'),_0x2062('0x94'));_0x1767e5[_0x2062('0x9')]('GROUP_CONCAT(DISTINCT\x20t.id)','TagIds');}if(_0x5d39ac['limit']){_0x1767e5['limit'](_0x5d39ac[_0x2062('0x95')]);}if(_0x5d39ac[_0x2062('0x96')]){_0x1767e5[_0x2062('0x96')](_0x5d39ac[_0x2062('0x96')]);}return db[_0x2062('0x97')][_0x2062('0x71')](_0x1767e5[_0x2062('0x72')](),_0x564104);})[_0x2062('0x5e')](function(_0x1e5a05){_0x3b1474=_0x1e5a05;var _0x51b17a=getUsersQuery(_0x2e621a,_0x3b1474);return db['sequelize'][_0x2062('0x71')](_0x51b17a['toString'](),_0x564104);})[_0x2062('0x5e')](function(_0x2ac9b6){_0x295430=_[_0x2062('0x98')](_0x2ac9b6,_0x308e46);if(_0x2e621a===_0x2062('0x2f')){return db[_0x2062('0x99')][_0x2062('0x9a')]({'attributes':[_0x2062('0x9b')],'raw':!![]});}})['then'](function(_0x5023e3){var _0x26d133=_0x5023e3?_0x5023e3[_0x2062('0x9b')]:undefined;var _0x511b7c=_0x3b1474['map'](function(_0x458983){return updateInteraction(_0x458983,_0x324e80,_0x295430,_0x26d133);});return Promise[_0x2062('0x9c')](_0x511b7c);});}function countFilteredInteractions(_0x3273ef,_0x331d3e){var _0xc3d53b=_0x3273ef['clone']();_0xc3d53b[_0x2062('0x9')](_0x2062('0x9d'));_0xc3d53b[_0x2062('0x9')](_0x2062('0x76'),_0x2062('0x42'));var _0x14cc90=utils[_0x2062('0x24')](_0x331d3e);if(!_[_0x2062('0x9e')](_0x14cc90)){_0xc3d53b[_0x2062('0x15')]('t.id\x20IN\x20?',_0x14cc90);}var _0x45450d={'type':db[_0x2062('0x9f')]['QueryTypes'][_0x2062('0xa0')],'raw':!![]};return db[_0x2062('0x97')]['query'](_0xc3d53b[_0x2062('0x72')](),_0x45450d);}module[_0x2062('0xa1')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index fcb4d58..37c7eac 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd671=['../../mysqldb','map','fullname','split','push','waiting','talking','answered','abandoned','total','closed','disposition','UserId','unmanaged','findOne','out','plainBody','then','catch','Users','TagIds','Tags'];(function(_0x584a51,_0x3dcc2a){var _0x25d14d=function(_0x34fb5b){while(--_0x34fb5b){_0x584a51['push'](_0x584a51['shift']());}};_0x25d14d(++_0x3dcc2a);}(_0xd671,0x84));var _0x1d67=function(_0x562cd7,_0x5ae8e7){_0x562cd7=_0x562cd7-0x0;var _0x30f50d=_0xd671[_0x562cd7];return _0x30f50d;};'use strict';var _=require('lodash');var db=require(_0x1d67('0x0'))['db'];function getInteractionUsers(_0x5d3ac3,_0x5d7524){return new Promise(function(_0x14550b,_0x57f271){try{var _0x2436e3=[];if(_0x5d7524[_0x5d3ac3]){_0x2436e3=_0x5d7524[_0x5d3ac3][_0x1d67('0x1')](function(_0x453c40){return{'id':_0x453c40['id'],'fullname':_0x453c40[_0x1d67('0x2')]};});}return _0x14550b(_0x2436e3);}catch(_0x33a7ca){_0x57f271(_0x33a7ca);}});}function getInteractionTags(_0x1dd7da,_0x3b8476){var _0x5dbf58=[];if(_0x1dd7da){_0x1dd7da[_0x1d67('0x3')](',')['forEach'](function(_0x2a649c){_0x5dbf58[_0x1d67('0x4')](_0x3b8476[_0x2a649c]);});}return _0x5dbf58;}function updateWaitingCounter(_0x2135bf){if(_0x2135bf[_0x1d67('0x5')]){_0x2135bf[_0x1d67('0x5')]-=0x1;}}function updateInteractionCounters(_0x6521a9){_0x6521a9[_0x1d67('0x5')]=0x0;_0x6521a9[_0x1d67('0x6')]=0x0;_0x6521a9[_0x1d67('0x7')]=0x0;_0x6521a9['unmanaged']=0x0;_0x6521a9[_0x1d67('0x8')]=0x0;_0x6521a9[_0x1d67('0x9')]=0x0;if(_0x6521a9[_0x1d67('0xa')]){if(_0x6521a9[_0x1d67('0xb')]===_0x1d67('0x8')){_0x6521a9[_0x1d67('0x8')]+=0x1;updateWaitingCounter(_0x6521a9);}if(_0x6521a9[_0x1d67('0xc')]){_0x6521a9[_0x1d67('0x7')]+=0x1;if(_0x6521a9[_0x1d67('0x6')]){_0x6521a9[_0x1d67('0x6')]-=0x1;}}else{if(_0x6521a9[_0x1d67('0xb')]){_0x6521a9[_0x1d67('0xd')]+=0x1;updateWaitingCounter(_0x6521a9);}}}else{if(!_0x6521a9[_0x1d67('0xc')]){_0x6521a9['waiting']+=0x1;}if(_0x6521a9['UserId']){_0x6521a9[_0x1d67('0x6')]+=0x1;updateWaitingCounter(_0x6521a9);}}_0x6521a9[_0x1d67('0x9')]+=0x1;return _0x6521a9;}function getLastMessageText(_0x1f2865){return db['MailMessage'][_0x1d67('0xe')]({'where':{'$and':[{'MailInteractionId':_0x1f2865['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x1d67('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x1d67('0x10')],'order':'-id','raw':!![]})[_0x1d67('0x11')](function(_0x1801f0){if(_0x1801f0&&_0x1801f0[_0x1d67('0x10')]){_0x1f2865['lastMsgText']=_['trimStart'](_0x1801f0['plainBody']);}return _0x1f2865;})[_0x1d67('0x12')](function(_0x23f0bc){throw _0x23f0bc;});}exports['updateInteraction']=function(_0x566ebd,_0x34364a,_0x471907,_0x104bf8){return new Promise(function(_0x4cb388,_0x2aa750){return getInteractionUsers(_0x566ebd['id'],_0x471907)['then'](function(_0x3ba324){_0x566ebd[_0x1d67('0x13')]=_0x3ba324;return getInteractionTags(_0x566ebd[_0x1d67('0x14')],_0x34364a);})[_0x1d67('0x11')](function(_0x125bb0){_0x566ebd[_0x1d67('0x15')]=_0x125bb0;delete _0x566ebd[_0x1d67('0x14')];return updateInteractionCounters(_0x566ebd);})[_0x1d67('0x11')](function(_0x2670bf){if(_0x104bf8){return getLastMessageText(_0x2670bf);}else{return _0x2670bf;}})[_0x1d67('0x11')](function(_0x30821e){_0x4cb388(_0x30821e);})[_0x1d67('0x12')](function(_0x484159){_0x2aa750(_0x484159);});});}; \ No newline at end of file +var _0xcfd8=['split','forEach','push','waiting','talking','unmanaged','abandoned','total','disposition','UserId','answered','MailMessage','-id','then','plainBody','trimStart','catch','Users','TagIds','Tags','../../mysqldb','map','fullname'];(function(_0x1a720a,_0x98841d){var _0x31c3e1=function(_0x34a389){while(--_0x34a389){_0x1a720a['push'](_0x1a720a['shift']());}};_0x31c3e1(++_0x98841d);}(_0xcfd8,0x87));var _0x8cfd=function(_0xc4966b,_0x6cd5e0){_0xc4966b=_0xc4966b-0x0;var _0x1802bb=_0xcfd8[_0xc4966b];return _0x1802bb;};'use strict';var _=require('lodash');var db=require(_0x8cfd('0x0'))['db'];function getInteractionUsers(_0x1b1056,_0x3b2a89){return new Promise(function(_0x4a0c78,_0x3645d1){try{var _0x9db1d0=[];if(_0x3b2a89[_0x1b1056]){_0x9db1d0=_0x3b2a89[_0x1b1056][_0x8cfd('0x1')](function(_0x1a4ccc){return{'id':_0x1a4ccc['id'],'fullname':_0x1a4ccc[_0x8cfd('0x2')]};});}return _0x4a0c78(_0x9db1d0);}catch(_0xd4eddb){_0x3645d1(_0xd4eddb);}});}function getInteractionTags(_0x18ab13,_0x377168){var _0x353243=[];if(_0x18ab13){_0x18ab13[_0x8cfd('0x3')](',')[_0x8cfd('0x4')](function(_0x5ea1d7){_0x353243[_0x8cfd('0x5')](_0x377168[_0x5ea1d7]);});}return _0x353243;}function updateWaitingCounter(_0x29d4f9){if(_0x29d4f9[_0x8cfd('0x6')]){_0x29d4f9[_0x8cfd('0x6')]-=0x1;}}function updateInteractionCounters(_0x595dc){_0x595dc['waiting']=0x0;_0x595dc[_0x8cfd('0x7')]=0x0;_0x595dc['answered']=0x0;_0x595dc[_0x8cfd('0x8')]=0x0;_0x595dc[_0x8cfd('0x9')]=0x0;_0x595dc[_0x8cfd('0xa')]=0x0;if(_0x595dc['closed']){if(_0x595dc[_0x8cfd('0xb')]===_0x8cfd('0x9')){_0x595dc[_0x8cfd('0x9')]+=0x1;updateWaitingCounter(_0x595dc);}if(_0x595dc[_0x8cfd('0xc')]){_0x595dc[_0x8cfd('0xd')]+=0x1;if(_0x595dc[_0x8cfd('0x7')]){_0x595dc[_0x8cfd('0x7')]-=0x1;}}else{if(_0x595dc[_0x8cfd('0xb')]){_0x595dc[_0x8cfd('0x8')]+=0x1;updateWaitingCounter(_0x595dc);}}}else{if(!_0x595dc[_0x8cfd('0xc')]){_0x595dc[_0x8cfd('0x6')]+=0x1;}if(_0x595dc[_0x8cfd('0xc')]){_0x595dc[_0x8cfd('0x7')]+=0x1;updateWaitingCounter(_0x595dc);}}_0x595dc[_0x8cfd('0xa')]+=0x1;return _0x595dc;}function getLastMessageText(_0x2b34b4){return db[_0x8cfd('0xe')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x2b34b4['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0x8cfd('0xf'),'raw':!![]})[_0x8cfd('0x10')](function(_0x2a7b17){if(_0x2a7b17&&_0x2a7b17[_0x8cfd('0x11')]){_0x2b34b4['lastMsgText']=_[_0x8cfd('0x12')](_0x2a7b17[_0x8cfd('0x11')]);}return _0x2b34b4;})[_0x8cfd('0x13')](function(_0x4af50d){throw _0x4af50d;});}exports['updateInteraction']=function(_0x4a9758,_0x63eff,_0x3c461d,_0x4c815b){return new Promise(function(_0x1f12cf,_0x341ad0){return getInteractionUsers(_0x4a9758['id'],_0x3c461d)[_0x8cfd('0x10')](function(_0x3befde){_0x4a9758[_0x8cfd('0x14')]=_0x3befde;return getInteractionTags(_0x4a9758[_0x8cfd('0x15')],_0x63eff);})[_0x8cfd('0x10')](function(_0x1c8eaf){_0x4a9758[_0x8cfd('0x16')]=_0x1c8eaf;delete _0x4a9758['TagIds'];return updateInteractionCounters(_0x4a9758);})[_0x8cfd('0x10')](function(_0x4140dd){if(_0x4c815b){return getLastMessageText(_0x4140dd);}else{return _0x4140dd;}})['then'](function(_0x49687f){_0x1f12cf(_0x49687f);})[_0x8cfd('0x13')](function(_0x1004fa){_0x341ad0(_0x1004fa);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index 393a463..4892d4e 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcf65=['_interactions','_interaction_has_tags','_messages','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','null','Interaction','then','catch','exports','lodash','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','InteractionId','unknown','websites','accounts'];(function(_0x5e0e81,_0x31614a){var _0x12cd9c=function(_0x51ec94){while(--_0x51ec94){_0x5e0e81['push'](_0x5e0e81['shift']());}};_0x12cd9c(++_0x31614a);}(_0xcf65,0x169));var _0x5cf6=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xcf65[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x5cf6('0x0'));var db=require(_0x5cf6('0x1'))['db'];var loggers={'openchannel':require(_0x5cf6('0x2'))(_0x5cf6('0x3')),'mail':require('../../config/logger')(_0x5cf6('0x4')),'fax':require(_0x5cf6('0x2'))(_0x5cf6('0x5')),'sms':require(_0x5cf6('0x2'))(_0x5cf6('0x6')),'chat':require('../../config/logger')(_0x5cf6('0x7')),'whatsapp':require(_0x5cf6('0x2'))(_0x5cf6('0x8'))};function getAccountFK(_0x398350){return _[_0x5cf6('0x9')](_0x398350)+(_0x398350===_0x5cf6('0xa')?_0x5cf6('0xb'):'Account')+'Id';}function getInteractionFK(_0xcef7d6){return _[_0x5cf6('0x9')](_0xcef7d6)+_0x5cf6('0xc');}function getInteractionId(_0x4f344e,_0x560383,_0x2da7ff){if(_0x4f344e&&_0x4f344e[_['upperFirst'](_0x2da7ff)+_0x5cf6('0xc')]){return _0x4f344e[_['upperFirst'](_0x2da7ff)+_0x5cf6('0xc')];}else if(_0x4f344e&&_0x4f344e['id']){return _0x4f344e['id'];}else if(_0x560383&&_0x560383['id']){return _0x560383['id'];}else{return _0x5cf6('0xd');}}function getInteractionsTables(_0x3f6046){return{'accounts':_0x3f6046+'_'+(_0x3f6046===_0x5cf6('0xa')?_0x5cf6('0xe'):_0x5cf6('0xf')),'interactions':_0x3f6046+_0x5cf6('0x10'),'interactionsTags':_0x3f6046+_0x5cf6('0x11'),'messages':_0x3f6046+_0x5cf6('0x12'),'userInteractions':'user_has_'+_0x3f6046+_0x5cf6('0x10')};}function getSelectedTags(_0x1e8791){var _0x428bab=[];if(_0x1e8791){_0x428bab=Array[_0x5cf6('0x13')](_0x1e8791)?_0x1e8791:[_0x1e8791];}return _0x428bab;}function log(_0x48f61f,_0x4974bd,_0x2cbbf6,_0x50626b,_0x534952,_0x1ed203){loggers[_0x534952[_0x5cf6('0x14')]()][_0x48f61f](_0x5cf6('0x15'),_0x1ed203['toUpperCase'](),_0x4974bd?_0x4974bd['id']:null,_0x4974bd?_0x4974bd[_0x5cf6('0x16')]:null,_0x4974bd?_0x4974bd[_0x5cf6('0x17')]:null,getInteractionId(_0x2cbbf6,_0x50626b,_0x534952),_0x2cbbf6?JSON['stringify'](_0x2cbbf6):_0x5cf6('0x18'));}function updateUser(_0x2708f8,_0x548eb8,_0x20d185,_0xc49066,_0x55412e){db[_['upperFirst'](_0xc49066)+_0x5cf6('0x19')]['findOne']({'where':{'id':getInteractionId(_0x548eb8,_0x20d185,_0xc49066)}})[_0x5cf6('0x1a')](function(_0x379454){if(_0x379454){return _0x379454['update']({'UserId':_0x2708f8?_0x2708f8['id']:null});}})[_0x5cf6('0x1a')](function(_0x243c28){if(_0x243c28){log('info',_0x2708f8,_0x548eb8,_0x20d185,_0xc49066,_0x55412e);}})[_0x5cf6('0x1b')](function(){log('error',_0x2708f8,_0x548eb8,_0x20d185,_0xc49066,_0x55412e);});}module[_0x5cf6('0x1c')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0x43b6=['chat-interactions','capitalize','chat','Website','Account','upperFirst','InteractionId','websites','accounts','_interactions','_interaction_has_tags','_messages','user_has_','toLowerCase','toUpperCase','stringify','Interaction','update','info','error','exports','lodash','../../mysqldb','../../config/logger','mail-interactions'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x43b6,0x1be));var _0x643b=function(_0x55c551,_0xf1d9f0){_0x55c551=_0x55c551-0x0;var _0x4cf3a8=_0x43b6[_0x55c551];return _0x4cf3a8;};'use strict';var _=require(_0x643b('0x0'));var db=require(_0x643b('0x1'))['db'];var loggers={'openchannel':require(_0x643b('0x2'))('openchannel-interactions'),'mail':require(_0x643b('0x2'))(_0x643b('0x3')),'fax':require(_0x643b('0x2'))('fax-interactions'),'sms':require(_0x643b('0x2'))('sms-interactions'),'chat':require(_0x643b('0x2'))(_0x643b('0x4')),'whatsapp':require(_0x643b('0x2'))('whatsapp-interactions')};function getAccountFK(_0x41b625){return _[_0x643b('0x5')](_0x41b625)+(_0x41b625===_0x643b('0x6')?_0x643b('0x7'):_0x643b('0x8'))+'Id';}function getInteractionFK(_0x242b27){return _[_0x643b('0x5')](_0x242b27)+'InteractionId';}function getInteractionId(_0x3a7cb9,_0x513d8b,_0x1e7ed8){if(_0x3a7cb9&&_0x3a7cb9[_[_0x643b('0x9')](_0x1e7ed8)+_0x643b('0xa')]){return _0x3a7cb9[_[_0x643b('0x9')](_0x1e7ed8)+_0x643b('0xa')];}else if(_0x3a7cb9&&_0x3a7cb9['id']){return _0x3a7cb9['id'];}else if(_0x513d8b&&_0x513d8b['id']){return _0x513d8b['id'];}else{return'unknown';}}function getInteractionsTables(_0x32eb19){return{'accounts':_0x32eb19+'_'+(_0x32eb19===_0x643b('0x6')?_0x643b('0xb'):_0x643b('0xc')),'interactions':_0x32eb19+_0x643b('0xd'),'interactionsTags':_0x32eb19+_0x643b('0xe'),'messages':_0x32eb19+_0x643b('0xf'),'userInteractions':_0x643b('0x10')+_0x32eb19+'_interactions'};}function getSelectedTags(_0x289ea3){var _0x573725=[];if(_0x289ea3){_0x573725=Array['isArray'](_0x289ea3)?_0x289ea3:[_0x289ea3];}return _0x573725;}function log(_0x54de7c,_0x2af580,_0x2fe5cf,_0x188060,_0x4ca81b,_0x4b38ba){loggers[_0x4ca81b[_0x643b('0x11')]()][_0x54de7c]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4b38ba[_0x643b('0x12')](),_0x2af580?_0x2af580['id']:null,_0x2af580?_0x2af580['name']:null,_0x2af580?_0x2af580['role']:null,getInteractionId(_0x2fe5cf,_0x188060,_0x4ca81b),_0x2fe5cf?JSON[_0x643b('0x13')](_0x2fe5cf):'null');}function updateUser(_0x376c1e,_0x21a0e4,_0x4c32fd,_0x2189bc,_0x2d6dd3){db[_[_0x643b('0x9')](_0x2189bc)+_0x643b('0x14')]['findOne']({'where':{'id':getInteractionId(_0x21a0e4,_0x4c32fd,_0x2189bc)}})['then'](function(_0x13b5e7){if(_0x13b5e7){return _0x13b5e7[_0x643b('0x15')]({'UserId':_0x376c1e?_0x376c1e['id']:null});}})['then'](function(_0x5e6977){if(_0x5e6977){log(_0x643b('0x16'),_0x376c1e,_0x21a0e4,_0x4c32fd,_0x2189bc,_0x2d6dd3);}})['catch'](function(){log(_0x643b('0x17'),_0x376c1e,_0x21a0e4,_0x4c32fd,_0x2189bc,_0x2d6dd3);});}module[_0x643b('0x18')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 9c90b07..b9643c0 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e8b=['status','json','catch','users','admin','user','isUserLimit','util','composable-middleware','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','parse','hasOwnProperty','use','License','then','count'];(function(_0x27fe29,_0x2822fe){var _0x1c07d9=function(_0x221167){while(--_0x221167){_0x27fe29['push'](_0x27fe29['shift']());}};_0x1c07d9(++_0x2822fe);}(_0x3e8b,0x84));var _0xb3e8=function(_0x363898,_0x558c0f){_0x363898=_0x363898-0x0;var _0x32ff6c=_0x3e8b[_0x363898];return _0x32ff6c;};'use strict';var crypto=require('crypto');var util=require(_0xb3e8('0x0'));var compose=require(_0xb3e8('0x1'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');function getValueFromLicense(_0x2dfb67,_0x124432){if(_0x2dfb67&&_0x124432){if(_0x124432[_0xb3e8('0x2')]&&_0x124432[_0xb3e8('0x3')]){var _0xa86395=_0x124432[_0xb3e8('0x2')];var _0x515a9a=_0x124432[_0xb3e8('0x3')];var _0x1d1923=_0xa86395['split']('-')[0x4];var _0x42bda6=_0xa86395[_0xb3e8('0x4')]('-')[0x0];var _0x55d4ae=crypto['createDecipher'](_0xb3e8('0x5'),util[_0xb3e8('0x6')](_0xb3e8('0x7'),_0x1d1923,_0xa86395,_0x42bda6));var _0x3fbbf3=_0x55d4ae[_0xb3e8('0x8')](_0x515a9a,_0xb3e8('0x9'),_0xb3e8('0xa'));_0x3fbbf3+=_0x55d4ae[_0xb3e8('0xb')](_0xb3e8('0xa'));var _0x408b9f=JSON[_0xb3e8('0xc')](_0x3fbbf3);return _0x408b9f[_0xb3e8('0xd')](_0x2dfb67)?_0x408b9f[_0x2dfb67]:null;}}return null;}function isLimit(_0x5ebdfe,_0xef3a22,_0x2eb9e9,_0x4e23df){var _0x542178=_0xef3a22;return compose()[_0xb3e8('0xe')](function(_0xdbe314,_0xacc78,_0x4587f1){return db[_0xb3e8('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xb3e8('0x10')](function(_0x466009){var _0xefa19d=getValueFromLicense(_0x5ebdfe,_0x466009);return _0xefa19d?_0xefa19d:_0x542178;})['then'](function(_0x9137ea){_0x542178=_0x9137ea;return _0x2eb9e9[_0xb3e8('0x11')](_0x4e23df);})[_0xb3e8('0x10')](function(_0x4b45c2){if(_0x4b45c2>=_0x542178){return _0xacc78[_0xb3e8('0x12')](0x193)[_0xb3e8('0x13')]({'message':util[_0xb3e8('0x6')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x5ebdfe)});}_0x4587f1();})[_0xb3e8('0x14')](function(_0x1fada3){_0x4587f1(_0x1fada3);});});}function isUserLimit(){return isLimit(_0xb3e8('0x15'),0x1,db['User'],{'where':{'$or':[{'role':_0xb3e8('0x16')},{'role':_0xb3e8('0x17')}]}});}exports[_0xb3e8('0x18')]=isUserLimit; \ No newline at end of file +var _0x5a0b=['../../mysqldb','../../config/environment','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','License','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','admin','user','isUserLimit','crypto','composable-middleware'];(function(_0x2b9448,_0x33e0f2){var _0xfaf5ab=function(_0x4de537){while(--_0x4de537){_0x2b9448['push'](_0x2b9448['shift']());}};_0xfaf5ab(++_0x33e0f2);}(_0x5a0b,0x178));var _0xb5a0=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0x5a0b[_0x37c22c];return _0x119d79;};'use strict';var crypto=require(_0xb5a0('0x0'));var util=require('util');var compose=require(_0xb5a0('0x1'));var db=require(_0xb5a0('0x2'))['db'];var config=require(_0xb5a0('0x3'));function getValueFromLicense(_0x372e15,_0x19e681){if(_0x372e15&&_0x19e681){if(_0x19e681['data1']&&_0x19e681['license']){var _0x364d7f=_0x19e681['data1'];var _0x353106=_0x19e681[_0xb5a0('0x4')];var _0x50ccea=_0x364d7f['split']('-')[0x4];var _0x12dc15=_0x364d7f[_0xb5a0('0x5')]('-')[0x0];var _0x2cfb7b=crypto[_0xb5a0('0x6')](_0xb5a0('0x7'),util[_0xb5a0('0x8')](_0xb5a0('0x9'),_0x50ccea,_0x364d7f,_0x12dc15));var _0x352db6=_0x2cfb7b[_0xb5a0('0xa')](_0x353106,_0xb5a0('0xb'),_0xb5a0('0xc'));_0x352db6+=_0x2cfb7b[_0xb5a0('0xd')](_0xb5a0('0xc'));var _0x5adcf5=JSON['parse'](_0x352db6);return _0x5adcf5[_0xb5a0('0xe')](_0x372e15)?_0x5adcf5[_0x372e15]:null;}}return null;}function isLimit(_0xc9ebae,_0xdb3966,_0x5217c1,_0x4b6d06){var _0x54af77=_0xdb3966;return compose()['use'](function(_0x528cfc,_0x153e20,_0x206588){return db[_0xb5a0('0xf')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0xb5a0('0x10')](function(_0x3cd2bd){var _0x1a43cb=getValueFromLicense(_0xc9ebae,_0x3cd2bd);return _0x1a43cb?_0x1a43cb:_0x54af77;})[_0xb5a0('0x10')](function(_0x49597d){_0x54af77=_0x49597d;return _0x5217c1[_0xb5a0('0x11')](_0x4b6d06);})['then'](function(_0xdc026a){if(_0xdc026a>=_0x54af77){return _0x153e20[_0xb5a0('0x12')](0x193)[_0xb5a0('0x13')]({'message':util[_0xb5a0('0x8')](_0xb5a0('0x14'),_0xc9ebae)});}_0x206588();})[_0xb5a0('0x15')](function(_0x15f783){_0x206588(_0x15f783);});});}function isUserLimit(){return isLimit(_0xb5a0('0x16'),0x1,db[_0xb5a0('0x17')],{'where':{'$or':[{'role':_0xb5a0('0x18')},{'role':_0xb5a0('0x19')}]}});}exports[_0xb5a0('0x1a')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index d83270b..38f93d0 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 _0x76fe=['$endsWith','LIKE\x20?','$lt','<\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','pop','utcOffset','seconds','lodash','moment','sqlOperator','startsWith','[$or]','replace','split','forEach','shift','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$eq','$between','value','$gt','$lte','add','days','format','YYYY-MM-DD','castTo','text','CAST(','field','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','<>\x20?','$substring','$startsWith'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x76fe,0x13e));var _0xe76f=function(_0x5938c8,_0x4a9ca){_0x5938c8=_0x5938c8-0x0;var _0x4353f7=_0x76fe[_0x5938c8];return _0x4353f7;};'use strict';var _=require(_0xe76f('0x0'));var moment=require(_0xe76f('0x1'));exports['parseSearch']=function(_0x971d1c){var _0x483412={'conditions':[]};_0x483412[_0xe76f('0x2')]=_[_0xe76f('0x3')](_0x971d1c,_0xe76f('0x4'))?'or':'and';var _0x202c34=_0x971d1c[_0xe76f('0x5')]('[$and]','')['replace']('[$or]','')[_0xe76f('0x6')]('||');for(var _0x8b85ad=0x0;_0x8b85ad<_0x202c34['length'];_0x8b85ad++){var _0x24ecef=_0x202c34[_0x8b85ad][_0xe76f('0x6')](':=');var _0x46091e=_0x24ecef[0x0];var _0x5a002e=_0x24ecef['slice'](0x1);_0x5a002e[_0xe76f('0x7')](function(_0xc2d67d){var _0x41d001=_0xc2d67d[_0xe76f('0x6')]('[')[_0xe76f('0x8')]();var _0x1ad402=_0xc2d67d['match'](/\[(.*?)\]/g);_0x1ad402[_0xe76f('0x7')](function(_0x2f0139){var _0xb16b0b=_0x2f0139[_0xe76f('0x6')]('[')[_0xe76f('0x9')](function(_0xefaa82){return _0xefaa82[_0xe76f('0xa')](']')>-0x1;})[_0xe76f('0xb')](function(_0x432bfa){return _0x432bfa['split'](']')[0x0];})[0x0];_0x483412[_0xe76f('0xc')][_0xe76f('0xd')]({'field':_0x46091e,'operator':_0x41d001,'value':_0xb16b0b});});});}return _0x483412;};exports[_0xe76f('0xe')]=function(_0x21bb04,_0x37485f,_0x71b1d0){var _0x1a2565={};if(_0x37485f===_0xe76f('0xf')){if(_0x71b1d0[_0xe76f('0x10')]===_0xe76f('0x11')){_0x71b1d0[_0xe76f('0x10')]=_0xe76f('0x12');_0x71b1d0[_0xe76f('0x13')]+=','+_0x71b1d0[_0xe76f('0x13')];}else if(_['includes']([_0xe76f('0x14'),_0xe76f('0x15')],_0x71b1d0[_0xe76f('0x10')])){_0x71b1d0[_0xe76f('0x13')]=moment(_0x71b1d0[_0xe76f('0x13')])[_0xe76f('0x16')](0x1,_0xe76f('0x17'))[_0xe76f('0x18')](_0xe76f('0x19'));}}if(_0x71b1d0['castTo']){_0x37485f=_0x71b1d0[_0xe76f('0x1a')];_0x1a2565[_0xe76f('0x1b')]=_0xe76f('0x1c')+_0x21bb04+'.'+_0x71b1d0[_0xe76f('0x1d')]+'\x20AS\x20'+_0x71b1d0[_0xe76f('0x1a')]+')\x20'+parseOperator(_0x71b1d0[_0xe76f('0x10')]);}else{_0x1a2565['text']=_0x21bb04+'.'+_0x71b1d0[_0xe76f('0x1d')]+'\x20'+parseOperator(_0x71b1d0[_0xe76f('0x10')]);}if(_['includes']([_0xe76f('0x1e'),_0xe76f('0x1f')],_0x71b1d0[_0xe76f('0x10')]))_0x1a2565[_0xe76f('0x1b')]='('+_0x1a2565[_0xe76f('0x1b')]+_0xe76f('0x20')+_0x21bb04+'.'+_0x71b1d0[_0xe76f('0x1d')]+_0xe76f('0x21');_0x1a2565[_0xe76f('0x13')]=parseValue(_0x37485f,_0x71b1d0[_0xe76f('0x10')],_0x71b1d0[_0xe76f('0x13')]);return _0x1a2565;};function parseOperator(_0x428796){var _0x3dbd22;switch(_0x428796){case _0xe76f('0x22'):_0x3dbd22=_0xe76f('0x23');break;case _0xe76f('0x1f'):_0x3dbd22='NOT\x20IN\x20?';break;case _0xe76f('0x11'):_0x3dbd22='=\x20?';break;case _0xe76f('0x1e'):_0x3dbd22=_0xe76f('0x24');break;case _0xe76f('0x25'):case _0xe76f('0x26'):case _0xe76f('0x27'):_0x3dbd22=_0xe76f('0x28');break;case _0xe76f('0x29'):_0x3dbd22=_0xe76f('0x2a');break;case'$gt':_0x3dbd22='>\x20?';break;case _0xe76f('0x15'):_0x3dbd22=_0xe76f('0x2b');break;case _0xe76f('0x2c'):_0x3dbd22=_0xe76f('0x2d');break;case'$between':_0x3dbd22=_0xe76f('0x2e');break;}return _0x3dbd22;}function parseValue(_0xb9c5bd,_0x51957d,_0x440a0e){var _0x24b110={'start':undefined,'end':undefined};switch(_0x51957d){case _0xe76f('0x22'):case _0xe76f('0x1f'):_0x24b110[_0xe76f('0x2f')]=_0x440a0e[_0xe76f('0x6')](',');break;case _0xe76f('0x25'):_0x24b110[_0xe76f('0x2f')]='%'+_0x440a0e+'%';break;case _0xe76f('0x26'):_0x24b110[_0xe76f('0x2f')]=_0x440a0e+'%';break;case _0xe76f('0x27'):_0x24b110['start']='%'+_0x440a0e;break;case'$between':var _0x324d92=_0x440a0e['split'](',');var _0x440a0e=_0x324d92['shift']();var _0x4c723d=_0x324d92[_0xe76f('0x30')]();if(_0xb9c5bd==='DATE'){_0x440a0e=moment(_0x440a0e)[_0xe76f('0x31')](0x0,!![])[_0xe76f('0x18')]();_0x4c723d=moment(_0x4c723d)[_0xe76f('0x31')](0x0,!![])['add'](0x17,'hours')[_0xe76f('0x16')](0x3b,'minutes')[_0xe76f('0x16')](0x3b,_0xe76f('0x32'))[_0xe76f('0x18')]();}_0x24b110={'start':_0x440a0e,'end':_0x4c723d};break;default:_0x24b110['start']=_0x440a0e;break;}return _0x24b110;} \ No newline at end of file +var _0xaf8c=['$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','start','pop','utcOffset','hours','seconds','lodash','moment','parseSearch','sqlOperator','startsWith','[$or]','and','replace','[$and]','split','length','slice','forEach','shift','match','filter','indexOf','map','conditions','push','buildExpression','DATE','operator','$between','value','includes','$gt','$lte','add','format','YYYY-MM-DD','castTo','text','field','\x20AS\x20','$ne','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','$eq','=\x20?','$substring'];(function(_0x59d648,_0x2e87bd){var _0x45b2c2=function(_0x59c5eb){while(--_0x59c5eb){_0x59d648['push'](_0x59d648['shift']());}};_0x45b2c2(++_0x2e87bd);}(_0xaf8c,0x1dd));var _0xcaf8=function(_0x3fa8ff,_0x2e3165){_0x3fa8ff=_0x3fa8ff-0x0;var _0x125641=_0xaf8c[_0x3fa8ff];return _0x125641;};'use strict';var _=require(_0xcaf8('0x0'));var moment=require(_0xcaf8('0x1'));exports[_0xcaf8('0x2')]=function(_0x25121b){var _0x469eff={'conditions':[]};_0x469eff[_0xcaf8('0x3')]=_[_0xcaf8('0x4')](_0x25121b,_0xcaf8('0x5'))?'or':_0xcaf8('0x6');var _0x537437=_0x25121b[_0xcaf8('0x7')](_0xcaf8('0x8'),'')[_0xcaf8('0x7')](_0xcaf8('0x5'),'')[_0xcaf8('0x9')]('||');for(var _0x19568b=0x0;_0x19568b<_0x537437[_0xcaf8('0xa')];_0x19568b++){var _0x38db01=_0x537437[_0x19568b][_0xcaf8('0x9')](':=');var _0x1cb426=_0x38db01[0x0];var _0x2f8c35=_0x38db01[_0xcaf8('0xb')](0x1);_0x2f8c35[_0xcaf8('0xc')](function(_0x190b3a){var _0x117965=_0x190b3a[_0xcaf8('0x9')]('[')[_0xcaf8('0xd')]();var _0x1a4d0a=_0x190b3a[_0xcaf8('0xe')](/\[(.*?)\]/g);_0x1a4d0a[_0xcaf8('0xc')](function(_0x3a11af){var _0x436afd=_0x3a11af[_0xcaf8('0x9')]('[')[_0xcaf8('0xf')](function(_0x5fd98b){return _0x5fd98b[_0xcaf8('0x10')](']')>-0x1;})[_0xcaf8('0x11')](function(_0x308cce){return _0x308cce[_0xcaf8('0x9')](']')[0x0];})[0x0];_0x469eff[_0xcaf8('0x12')][_0xcaf8('0x13')]({'field':_0x1cb426,'operator':_0x117965,'value':_0x436afd});});});}return _0x469eff;};exports[_0xcaf8('0x14')]=function(_0x3f9279,_0xdfc285,_0x2c6d19){var _0x4bb048={};if(_0xdfc285===_0xcaf8('0x15')){if(_0x2c6d19['operator']==='$eq'){_0x2c6d19[_0xcaf8('0x16')]=_0xcaf8('0x17');_0x2c6d19[_0xcaf8('0x18')]+=','+_0x2c6d19[_0xcaf8('0x18')];}else if(_[_0xcaf8('0x19')]([_0xcaf8('0x1a'),_0xcaf8('0x1b')],_0x2c6d19[_0xcaf8('0x16')])){_0x2c6d19[_0xcaf8('0x18')]=moment(_0x2c6d19['value'])[_0xcaf8('0x1c')](0x1,'days')[_0xcaf8('0x1d')](_0xcaf8('0x1e'));}}if(_0x2c6d19['castTo']){_0xdfc285=_0x2c6d19[_0xcaf8('0x1f')];_0x4bb048[_0xcaf8('0x20')]='CAST('+_0x3f9279+'.'+_0x2c6d19[_0xcaf8('0x21')]+_0xcaf8('0x22')+_0x2c6d19[_0xcaf8('0x1f')]+')\x20'+parseOperator(_0x2c6d19[_0xcaf8('0x16')]);}else{_0x4bb048['text']=_0x3f9279+'.'+_0x2c6d19[_0xcaf8('0x21')]+'\x20'+parseOperator(_0x2c6d19[_0xcaf8('0x16')]);}if(_['includes']([_0xcaf8('0x23'),_0xcaf8('0x24')],_0x2c6d19[_0xcaf8('0x16')]))_0x4bb048[_0xcaf8('0x20')]='('+_0x4bb048[_0xcaf8('0x20')]+_0xcaf8('0x25')+_0x3f9279+'.'+_0x2c6d19[_0xcaf8('0x21')]+_0xcaf8('0x26');_0x4bb048[_0xcaf8('0x18')]=parseValue(_0xdfc285,_0x2c6d19[_0xcaf8('0x16')],_0x2c6d19[_0xcaf8('0x18')]);return _0x4bb048;};function parseOperator(_0xf1b649){var _0x34a021;switch(_0xf1b649){case _0xcaf8('0x27'):_0x34a021=_0xcaf8('0x28');break;case _0xcaf8('0x24'):_0x34a021=_0xcaf8('0x29');break;case _0xcaf8('0x2a'):_0x34a021=_0xcaf8('0x2b');break;case _0xcaf8('0x23'):_0x34a021='<>\x20?';break;case _0xcaf8('0x2c'):case _0xcaf8('0x2d'):case _0xcaf8('0x2e'):_0x34a021=_0xcaf8('0x2f');break;case'$lt':_0x34a021=_0xcaf8('0x30');break;case _0xcaf8('0x1a'):_0x34a021=_0xcaf8('0x31');break;case _0xcaf8('0x1b'):_0x34a021=_0xcaf8('0x32');break;case _0xcaf8('0x33'):_0x34a021=_0xcaf8('0x34');break;case _0xcaf8('0x17'):_0x34a021='BETWEEN\x20?\x20AND\x20?';break;}return _0x34a021;}function parseValue(_0x1acd80,_0x426d67,_0x379992){var _0x375787={'start':undefined,'end':undefined};switch(_0x426d67){case _0xcaf8('0x27'):case _0xcaf8('0x24'):_0x375787[_0xcaf8('0x35')]=_0x379992['split'](',');break;case'$substring':_0x375787[_0xcaf8('0x35')]='%'+_0x379992+'%';break;case _0xcaf8('0x2d'):_0x375787[_0xcaf8('0x35')]=_0x379992+'%';break;case _0xcaf8('0x2e'):_0x375787[_0xcaf8('0x35')]='%'+_0x379992;break;case _0xcaf8('0x17'):var _0x4232d4=_0x379992['split'](',');var _0x379992=_0x4232d4[_0xcaf8('0xd')]();var _0xaf9cdd=_0x4232d4[_0xcaf8('0x36')]();if(_0x1acd80===_0xcaf8('0x15')){_0x379992=moment(_0x379992)['utcOffset'](0x0,!![])[_0xcaf8('0x1d')]();_0xaf9cdd=moment(_0xaf9cdd)[_0xcaf8('0x37')](0x0,!![])[_0xcaf8('0x1c')](0x17,_0xcaf8('0x38'))['add'](0x3b,'minutes')['add'](0x3b,_0xcaf8('0x39'))[_0xcaf8('0x1d')]();}_0x375787={'start':_0x379992,'end':_0xaf9cdd};break;default:_0x375787[_0xcaf8('0x35')]=_0x379992;break;}return _0x375787;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 43195e6..151eb59 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 _0x2b83=['isEmail','getFullTextValue','\x22{EXPR}\x22','forEach','replace','push','{EXPR}','join','getOptions','$id','query','map','name','intersection','model','attributes','nolimit','order','where','filter','object','columns','merge','lower','options','include','sequelize','moment','keys','includes','parse','fields','split','forOwn','find','type','DATE','isPlainObject','$gte','format','YYYY-MM-DD','utc','subtract','isArray','limit','offset','sort','priority','col','unsigned','substr','DESC','cast','ASC','omit','isEmpty','length','isObject','isString','unset','isNumeric','match','^[+]?[0-9]*$'];(function(_0x196871,_0x46d5b1){var _0x251a31=function(_0x2d94eb){while(--_0x2d94eb){_0x196871['push'](_0x196871['shift']());}};_0x251a31(++_0x46d5b1);}(_0x2b83,0x1d3));var _0x32b8=function(_0x4bdc34,_0x5dcfe2){_0x4bdc34=_0x4bdc34-0x0;var _0x108d87=_0x2b83[_0x4bdc34];return _0x108d87;};'use strict';var _=require('lodash');var sequelize=require(_0x32b8('0x0'));var moment=require(_0x32b8('0x1'));var db=require('../../mysqldb')['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x3fcbdc){var _0x287f16=['ne'];try{var _0x304105=JSON['parse'](_0x3fcbdc);var _0x51d3b4=Object[_0x32b8('0x2')](_0x304105)[0x0];return _0x287f16[_0x32b8('0x3')](_0x51d3b4);}catch(_0x58ecbf){return![];}}function getOperatorValue(_0x6bbc3d){var _0x55abd0=JSON[_0x32b8('0x4')](_0x6bbc3d);var _0x342a03=Object[_0x32b8('0x2')](_0x55abd0)[0x0];var _0x10a967=_0x55abd0[_0x342a03];return{['$'+_0x342a03]:_0x10a967};}function parseIncludeModel(_0x5cc6b2){var _0x46be90=JSON[_0x32b8('0x4')](_0x5cc6b2);return{'model':db[_0x46be90['model']],'as':_0x46be90['alias'],'attributes':_0x46be90[_0x32b8('0x5')],'raw':_0x46be90['raw']};}exports[_0x32b8('0x5')]=function(_0x31b795){var _0x465672=null;if(_0x31b795){_0x465672=_0x31b795[_0x32b8('0x6')](',');}return _0x465672;};exports['filters']=function(_0xd52d3e,_0x3b6bc6){var _0x5725d2={};if(!_['isEmpty'](_0xd52d3e)){_[_0x32b8('0x7')](_0xd52d3e,function(_0x5a0ef2,_0x41594c){try{if(_0x3b6bc6){var _0x4b838f=_[_0x32b8('0x8')](_0x3b6bc6,{'name':_0x41594c})||{};if(hasSequelizeOperator(_0x5a0ef2)){_0x5725d2[_0x41594c]=getOperatorValue(_0x5a0ef2);}else if(_0x4b838f[_0x32b8('0x9')]===_0x32b8('0xa')&&_[_0x32b8('0xb')](_0x5a0ef2)){var _0x2645b0=JSON['parse'](_0x5a0ef2);var _0x4c8fc9={'$gte':moment(moment(_0x2645b0[_0x32b8('0xc')])['format']('YYYY-MM-DD'))['utc']()[_0x32b8('0xd')](),'$lte':moment(moment(_0x2645b0['$lte'])['format'](_0x32b8('0xe')))[_0x32b8('0xf')]()[_0x32b8('0x10')](0x1,'s')[_0x32b8('0xd')]()};_0x5725d2[_0x41594c]=_0x4c8fc9;}else if(_0x4b838f['name']==='uniqueid'){_0x5725d2[_0x41594c]=_0x5a0ef2;}else{_0x5725d2[_0x41594c]=_['isArray'](_0x5a0ef2)?_0x5a0ef2:JSON[_0x32b8('0x4')](_0x5a0ef2);}}else{_0x5725d2[_0x41594c]=_[_0x32b8('0x11')](_0x5a0ef2)?_0x5a0ef2:JSON[_0x32b8('0x4')](_0x5a0ef2);}}catch(_0x445da1){_0x5725d2[_0x41594c]=_0x5a0ef2['split'](',');}});}return _0x5725d2;};exports[_0x32b8('0x12')]=function(_0x3ddc5f){_0x3ddc5f=parseInt(_0x3ddc5f,0xa);if(!_0x3ddc5f||_0x3ddc5f<0x0){_0x3ddc5f=LIMIT_VALUE;}return _0x3ddc5f;};exports[_0x32b8('0x13')]=function(_0x39a4f1){_0x39a4f1=parseInt(_0x39a4f1,0xa);if(!_0x39a4f1||_0x39a4f1<0x0){_0x39a4f1=0x0;}return _0x39a4f1;};exports[_0x32b8('0x14')]=function(_0xde1a5a){var _0x222c77,_0xcd4b26=null;if(_0xde1a5a){_0x222c77=_0xde1a5a['split'](',');_0xcd4b26=_['map'](_0x222c77,function(_0xbbdb27){if(_0xbbdb27['indexOf']('-')===0x0){return[_0xbbdb27===_0x32b8('0x15')?sequelize['cast'](sequelize[_0x32b8('0x16')](_0x32b8('0x15')),_0x32b8('0x17')):_0xbbdb27[_0x32b8('0x18')](0x1),_0x32b8('0x19')];}else{return[_0xbbdb27==='priority'?sequelize[_0x32b8('0x1a')](sequelize[_0x32b8('0x16')](_0x32b8('0x15')),_0x32b8('0x17')):_0xbbdb27,_0x32b8('0x1b')];}});}return _0xcd4b26;};exports[_0x32b8('0x1c')]=function(_0x57a6a3,_0x4022f7){if(_[_0x32b8('0x1d')](_0x57a6a3)){return _0x57a6a3;}if(_[_0x32b8('0x11')](_0x57a6a3)){for(var _0x3e1598=0x0;_0x3e1598<_0x57a6a3[_0x32b8('0x1e')];_0x3e1598+=0x1){_0x57a6a3[_0x3e1598]=this[_0x32b8('0x1c')](_0x57a6a3[_0x3e1598],_0x4022f7);}return _0x57a6a3;}if(!_[_0x32b8('0x1f')](_0x57a6a3)){return _0x57a6a3;}if(_[_0x32b8('0x20')](_0x4022f7)){_0x4022f7=[_0x4022f7];}if(!_[_0x32b8('0x11')](_0x4022f7)){return _0x57a6a3;}for(var _0xa225ec=0x0;_0xa225ec<_0x4022f7[_0x32b8('0x1e')];_0xa225ec+=0x1){_[_0x32b8('0x21')](_0x57a6a3,_0x4022f7[_0xa225ec]);}for(var _0x1fcba2 in _0x57a6a3){if(_0x57a6a3['hasOwnProperty'](_0x1fcba2)){_0x57a6a3[_0x1fcba2]=this[_0x32b8('0x1c')](_0x57a6a3[_0x1fcba2],_0x4022f7);}}return _0x57a6a3;};exports[_0x32b8('0x22')]=function(_0x383b0e){return _0x383b0e[_0x32b8('0x23')](RegExp(_0x32b8('0x24')))?!![]:![];};exports[_0x32b8('0x25')]=function(_0x85d4d3){return _0x85d4d3[_0x32b8('0x23')](/^\S+@\S+$/)?!![]:![];};exports[_0x32b8('0x26')]=function(_0x15f152,_0x521bf4){var _0x1833af=[];var _0x3c1122=/[ `!@#$%^&*()_\-?~]/;var _0x44b38a=_0x521bf4?_0x32b8('0x27'):'{EXPR}';_0x15f152['split'](/[ ,]+/)[_0x32b8('0x28')](function(_0x431b59){_0x431b59=_0x431b59[_0x32b8('0x29')](/([^:]")"+/g,'$1');_0x431b59='+'+_0x431b59+'*';var _0x12ff7d=_0x431b59['match'](_0x3c1122);if(_0x12ff7d){_0x431b59='\x22'+_0x431b59+'\x22';}_0x1833af[_0x32b8('0x2a')](_0x431b59);});_0x44b38a=_0x44b38a[_0x32b8('0x29')](_0x32b8('0x2b'),_0x1833af[_0x32b8('0x2c')]('\x20'));return _0x44b38a;};exports[_0x32b8('0x2d')]=function(_0x399980,_0x2ffbcd,_0x22bdaf){var _0x591ba8={},_0x10f17e={};if(_0x2ffbcd['query'][_0x32b8('0x2e')]){_0x2ffbcd[_0x32b8('0x2f')]['id']=_0x2ffbcd[_0x32b8('0x2f')][_0x32b8('0x2e')];delete _0x2ffbcd[_0x32b8('0x2f')][_0x32b8('0x2e')];}_0x591ba8['model']=_[_0x32b8('0x30')](_0x399980,_0x32b8('0x31'));_0x591ba8[_0x32b8('0x2f')]=_['keys'](_0x2ffbcd[_0x32b8('0x2f')]);_0x591ba8['filters']=_[_0x32b8('0x32')](_0x591ba8[_0x32b8('0x33')],_0x591ba8[_0x32b8('0x2f')]);_0x10f17e[_0x32b8('0x34')]=_['intersection'](_0x591ba8[_0x32b8('0x33')],this[_0x32b8('0x5')](_0x2ffbcd[_0x32b8('0x2f')]['fields']));_0x10f17e['attributes']=_0x10f17e[_0x32b8('0x34')][_0x32b8('0x1e')]?_0x10f17e[_0x32b8('0x34')]:_0x591ba8['model'];if(!_0x2ffbcd['query']['hasOwnProperty'](_0x32b8('0x35'))){_0x10f17e[_0x32b8('0x12')]=this[_0x32b8('0x12')](_0x2ffbcd['query'][_0x32b8('0x12')]);_0x10f17e[_0x32b8('0x13')]=this[_0x32b8('0x13')](_0x2ffbcd[_0x32b8('0x2f')][_0x32b8('0x13')]);}_0x10f17e[_0x32b8('0x36')]=this[_0x32b8('0x14')](_0x2ffbcd[_0x32b8('0x2f')]['sort']);_0x10f17e[_0x32b8('0x37')]=this['filters'](_['pick'](_0x2ffbcd['query'],_0x591ba8['filters']),_0x399980);if(_0x2ffbcd[_0x32b8('0x2f')]['filter']){var _0x2a3968=_0x399980;var _0x52709b=_0x2ffbcd['query'][_0x32b8('0x38')];if(typeof _0x52709b===_0x32b8('0x39')){_0x2a3968=_[_0x32b8('0x38')](_0x399980,function(_0x5caaba){return _[_0x32b8('0x3')](_0x52709b[_0x32b8('0x3a')],_0x5caaba[_0x32b8('0x31')]);});_0x52709b=_0x52709b['value'];}_0x10f17e['where']=_[_0x32b8('0x3b')](_0x10f17e['where'],{'$or':_[_0x32b8('0x30')](_0x2a3968,function(_0x502205){if(_0x502205[_0x32b8('0x9')]!=='VIRTUAL'){if(_0x22bdaf){return sequelize[_0x32b8('0x37')](sequelize['fn'](_0x32b8('0x3c'),sequelize[_0x32b8('0x16')](_0x502205[_0x32b8('0x31')])),{'$like':sequelize['fn']('lower','%'+_0x2ffbcd['query'][_0x32b8('0x38')]+'%')});}else{var _0x14a4e6={};_0x14a4e6[_0x502205[_0x32b8('0x31')]]={'$like':'%'+_0x2ffbcd['query']['filter']+'%'};return _0x14a4e6;}}})});}_0x10f17e=_[_0x32b8('0x3b')]({},_0x10f17e,_0x2ffbcd[_0x32b8('0x3d')]);return _0x10f17e;};exports['include']=function(_0x2b0a80){var _0x582998=[];if(_0x2b0a80['includeAll']){_0x582998['push']({'all':!![]});}else if(_0x2b0a80[_0x32b8('0x3e')]){if(Array[_0x32b8('0x11')](_0x2b0a80[_0x32b8('0x3e')])){_0x582998=Object[_0x32b8('0x2')](_0x2b0a80['include'])[_0x32b8('0x30')](function(_0x447c55){return parseIncludeModel(_0x2b0a80[_0x32b8('0x3e')][_0x447c55]);});}else{var _0x29a413=parseIncludeModel(_0x2b0a80[_0x32b8('0x3e')]);_0x582998[_0x32b8('0x2a')](_0x29a413);}}return _0x582998;}; \ No newline at end of file +var _0xeecc=['^[+]?[0-9]*$','isEmail','getFullTextValue','{EXPR}','forEach','replace','query','$id','name','filters','intersection','attributes','order','where','pick','filter','object','columns','value','lower','merge','options','include','includeAll','push','lodash','sequelize','moment','../../mysqldb','keys','includes','parse','model','alias','raw','fields','split','isEmpty','forOwn','find','type','DATE','$gte','format','YYYY-MM-DD','utc','$lte','subtract','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','unsigned','substr','ASC','omit','length','isObject','isString','unset','hasOwnProperty','isNumeric','match'];(function(_0x259108,_0x11f473){var _0x2f8d92=function(_0x25b13a){while(--_0x25b13a){_0x259108['push'](_0x259108['shift']());}};_0x2f8d92(++_0x11f473);}(_0xeecc,0x12d));var _0xceec=function(_0x5749f9,_0x431484){_0x5749f9=_0x5749f9-0x0;var _0x49f4a2=_0xeecc[_0x5749f9];return _0x49f4a2;};'use strict';var _=require(_0xceec('0x0'));var sequelize=require(_0xceec('0x1'));var moment=require(_0xceec('0x2'));var db=require(_0xceec('0x3'))['db'];var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4974bf){var _0x23721e=['ne'];try{var _0x4ce7cd=JSON['parse'](_0x4974bf);var _0x588f01=Object[_0xceec('0x4')](_0x4ce7cd)[0x0];return _0x23721e[_0xceec('0x5')](_0x588f01);}catch(_0x3a2c0a){return![];}}function getOperatorValue(_0x2ae233){var _0x5889fb=JSON[_0xceec('0x6')](_0x2ae233);var _0x4c84cf=Object[_0xceec('0x4')](_0x5889fb)[0x0];var _0x19413a=_0x5889fb[_0x4c84cf];return{['$'+_0x4c84cf]:_0x19413a};}function parseIncludeModel(_0x11733f){var _0x40a7cd=JSON[_0xceec('0x6')](_0x11733f);return{'model':db[_0x40a7cd[_0xceec('0x7')]],'as':_0x40a7cd[_0xceec('0x8')],'attributes':_0x40a7cd['fields'],'raw':_0x40a7cd[_0xceec('0x9')]};}exports[_0xceec('0xa')]=function(_0x257259){var _0x39837f=null;if(_0x257259){_0x39837f=_0x257259[_0xceec('0xb')](',');}return _0x39837f;};exports['filters']=function(_0x1fe218,_0x299583){var _0x37ce83={};if(!_[_0xceec('0xc')](_0x1fe218)){_[_0xceec('0xd')](_0x1fe218,function(_0x4e3df8,_0x2fa641){try{if(_0x299583){var _0x5b8216=_[_0xceec('0xe')](_0x299583,{'name':_0x2fa641})||{};if(hasSequelizeOperator(_0x4e3df8)){_0x37ce83[_0x2fa641]=getOperatorValue(_0x4e3df8);}else if(_0x5b8216[_0xceec('0xf')]===_0xceec('0x10')&&_['isPlainObject'](_0x4e3df8)){var _0x578e51=JSON[_0xceec('0x6')](_0x4e3df8);var _0x51f24d={'$gte':moment(moment(_0x578e51[_0xceec('0x11')])[_0xceec('0x12')](_0xceec('0x13')))[_0xceec('0x14')]()[_0xceec('0x12')](),'$lte':moment(moment(_0x578e51[_0xceec('0x15')])[_0xceec('0x12')](_0xceec('0x13')))[_0xceec('0x14')]()[_0xceec('0x16')](0x1,'s')[_0xceec('0x12')]()};_0x37ce83[_0x2fa641]=_0x51f24d;}else if(_0x5b8216['name']===_0xceec('0x17')){_0x37ce83[_0x2fa641]=_0x4e3df8;}else{_0x37ce83[_0x2fa641]=_[_0xceec('0x18')](_0x4e3df8)?_0x4e3df8:JSON[_0xceec('0x6')](_0x4e3df8);}}else{_0x37ce83[_0x2fa641]=_[_0xceec('0x18')](_0x4e3df8)?_0x4e3df8:JSON[_0xceec('0x6')](_0x4e3df8);}}catch(_0x32ac95){_0x37ce83[_0x2fa641]=_0x4e3df8[_0xceec('0xb')](',');}});}return _0x37ce83;};exports[_0xceec('0x19')]=function(_0x32778b){_0x32778b=parseInt(_0x32778b,0xa);if(!_0x32778b||_0x32778b<0x0){_0x32778b=LIMIT_VALUE;}return _0x32778b;};exports[_0xceec('0x1a')]=function(_0x50dbb9){_0x50dbb9=parseInt(_0x50dbb9,0xa);if(!_0x50dbb9||_0x50dbb9<0x0){_0x50dbb9=0x0;}return _0x50dbb9;};exports[_0xceec('0x1b')]=function(_0x59922b){var _0x2b8fd5,_0x3d628f=null;if(_0x59922b){_0x2b8fd5=_0x59922b['split'](',');_0x3d628f=_[_0xceec('0x1c')](_0x2b8fd5,function(_0x4f9e9b){if(_0x4f9e9b[_0xceec('0x1d')]('-')===0x0){return[_0x4f9e9b===_0xceec('0x1e')?sequelize[_0xceec('0x1f')](sequelize[_0xceec('0x20')](_0xceec('0x1e')),_0xceec('0x21')):_0x4f9e9b[_0xceec('0x22')](0x1),'DESC'];}else{return[_0x4f9e9b===_0xceec('0x1e')?sequelize['cast'](sequelize[_0xceec('0x20')](_0xceec('0x1e')),_0xceec('0x21')):_0x4f9e9b,_0xceec('0x23')];}});}return _0x3d628f;};exports[_0xceec('0x24')]=function(_0x2cb07d,_0x591fe2){if(_[_0xceec('0xc')](_0x2cb07d)){return _0x2cb07d;}if(_['isArray'](_0x2cb07d)){for(var _0x1eddcc=0x0;_0x1eddcc<_0x2cb07d[_0xceec('0x25')];_0x1eddcc+=0x1){_0x2cb07d[_0x1eddcc]=this[_0xceec('0x24')](_0x2cb07d[_0x1eddcc],_0x591fe2);}return _0x2cb07d;}if(!_[_0xceec('0x26')](_0x2cb07d)){return _0x2cb07d;}if(_[_0xceec('0x27')](_0x591fe2)){_0x591fe2=[_0x591fe2];}if(!_[_0xceec('0x18')](_0x591fe2)){return _0x2cb07d;}for(var _0x33bca2=0x0;_0x33bca2<_0x591fe2[_0xceec('0x25')];_0x33bca2+=0x1){_[_0xceec('0x28')](_0x2cb07d,_0x591fe2[_0x33bca2]);}for(var _0x500050 in _0x2cb07d){if(_0x2cb07d[_0xceec('0x29')](_0x500050)){_0x2cb07d[_0x500050]=this[_0xceec('0x24')](_0x2cb07d[_0x500050],_0x591fe2);}}return _0x2cb07d;};exports[_0xceec('0x2a')]=function(_0x3e290f){return _0x3e290f[_0xceec('0x2b')](RegExp(_0xceec('0x2c')))?!![]:![];};exports[_0xceec('0x2d')]=function(_0x17d711){return _0x17d711['match'](/^\S+@\S+$/)?!![]:![];};exports[_0xceec('0x2e')]=function(_0x1eba13,_0x227607){var _0x5ea373=[];var _0x56af6e=/[ `!@#$%^&*()_\-?~]/;var _0x34117b=_0x227607?'\x22{EXPR}\x22':_0xceec('0x2f');_0x1eba13['split'](/[ ,]+/)[_0xceec('0x30')](function(_0x2c93ce){_0x2c93ce=_0x2c93ce[_0xceec('0x31')](/([^:]")"+/g,'$1');_0x2c93ce='+'+_0x2c93ce+'*';var _0xffd079=_0x2c93ce['match'](_0x56af6e);if(_0xffd079){_0x2c93ce='\x22'+_0x2c93ce+'\x22';}_0x5ea373['push'](_0x2c93ce);});_0x34117b=_0x34117b[_0xceec('0x31')](_0xceec('0x2f'),_0x5ea373['join']('\x20'));return _0x34117b;};exports['getOptions']=function(_0x3eddab,_0x1a7045,_0x586768){var _0x5cb275={},_0x2ece23={};if(_0x1a7045['query']['$id']){_0x1a7045[_0xceec('0x32')]['id']=_0x1a7045['query'][_0xceec('0x33')];delete _0x1a7045[_0xceec('0x32')]['$id'];}_0x5cb275[_0xceec('0x7')]=_['map'](_0x3eddab,_0xceec('0x34'));_0x5cb275[_0xceec('0x32')]=_['keys'](_0x1a7045['query']);_0x5cb275[_0xceec('0x35')]=_[_0xceec('0x36')](_0x5cb275[_0xceec('0x7')],_0x5cb275[_0xceec('0x32')]);_0x2ece23['attributes']=_[_0xceec('0x36')](_0x5cb275[_0xceec('0x7')],this[_0xceec('0xa')](_0x1a7045[_0xceec('0x32')][_0xceec('0xa')]));_0x2ece23[_0xceec('0x37')]=_0x2ece23[_0xceec('0x37')][_0xceec('0x25')]?_0x2ece23['attributes']:_0x5cb275[_0xceec('0x7')];if(!_0x1a7045['query']['hasOwnProperty']('nolimit')){_0x2ece23[_0xceec('0x19')]=this[_0xceec('0x19')](_0x1a7045[_0xceec('0x32')][_0xceec('0x19')]);_0x2ece23[_0xceec('0x1a')]=this[_0xceec('0x1a')](_0x1a7045[_0xceec('0x32')]['offset']);}_0x2ece23[_0xceec('0x38')]=this[_0xceec('0x1b')](_0x1a7045[_0xceec('0x32')][_0xceec('0x1b')]);_0x2ece23[_0xceec('0x39')]=this[_0xceec('0x35')](_[_0xceec('0x3a')](_0x1a7045['query'],_0x5cb275[_0xceec('0x35')]),_0x3eddab);if(_0x1a7045[_0xceec('0x32')]['filter']){var _0x191887=_0x3eddab;var _0x1e32b6=_0x1a7045[_0xceec('0x32')][_0xceec('0x3b')];if(typeof _0x1e32b6===_0xceec('0x3c')){_0x191887=_[_0xceec('0x3b')](_0x3eddab,function(_0x9d3111){return _[_0xceec('0x5')](_0x1e32b6[_0xceec('0x3d')],_0x9d3111[_0xceec('0x34')]);});_0x1e32b6=_0x1e32b6[_0xceec('0x3e')];}_0x2ece23[_0xceec('0x39')]=_['merge'](_0x2ece23['where'],{'$or':_[_0xceec('0x1c')](_0x191887,function(_0x5d4c30){if(_0x5d4c30[_0xceec('0xf')]!=='VIRTUAL'){if(_0x586768){return sequelize[_0xceec('0x39')](sequelize['fn'](_0xceec('0x3f'),sequelize[_0xceec('0x20')](_0x5d4c30[_0xceec('0x34')])),{'$like':sequelize['fn']('lower','%'+_0x1a7045[_0xceec('0x32')][_0xceec('0x3b')]+'%')});}else{var _0x16fea8={};_0x16fea8[_0x5d4c30['name']]={'$like':'%'+_0x1a7045[_0xceec('0x32')][_0xceec('0x3b')]+'%'};return _0x16fea8;}}})});}_0x2ece23=_[_0xceec('0x40')]({},_0x2ece23,_0x1a7045[_0xceec('0x41')]);return _0x2ece23;};exports[_0xceec('0x42')]=function(_0x53f9ab){var _0x165322=[];if(_0x53f9ab[_0xceec('0x43')]){_0x165322['push']({'all':!![]});}else if(_0x53f9ab['include']){if(Array[_0xceec('0x18')](_0x53f9ab[_0xceec('0x42')])){_0x165322=Object['keys'](_0x53f9ab[_0xceec('0x42')])['map'](function(_0x3eaa01){return parseIncludeModel(_0x53f9ab[_0xceec('0x42')][_0x3eaa01]);});}else{var _0x3b9206=parseIncludeModel(_0x53f9ab[_0xceec('0x42')]);_0x165322[_0xceec('0x44')](_0x3b9206);}}return _0x165322;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index ebc62a0..f98020a 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f97=['filterAgentAttributes','name','userpic','chatCapacity','faxCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','onhold','screenrecording','getRealtimeAgentsQueryFields','lodash','jayson/promise','../../mysqldb','client','http','chatPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','ringing','isNil','voiceStatus','pause','every','chatStatus','mailStatus','request','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','result','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','unknown','*pause','busy','isArray','Queue','map','findOne','getAgents','all','flatten','uniq','value','includes','idle','getAgentIdsByStatus','resolve','User','findAll','fullname','mailPause','pauseType','find','globalStatus','split','fields','order','startsWith','DESC','getUpdatedSortOptions','fullname,internal','substring','indexOf','internal','toLowerCase','sortAgentsByStatus','online','lastLoginAt','lastPauseAt','faxPause','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','openchannelStatus','smsStatus','whatsappStatus','faxStatus','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','queue','destconnectedlinenum','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','pick'];(function(_0x2bdd70,_0x4c173a){var _0x31299f=function(_0x4909a2){while(--_0x4909a2){_0x2bdd70['push'](_0x2bdd70['shift']());}};_0x31299f(++_0x4c173a);}(_0x0f97,0x196));var _0x70f9=function(_0x54bb04,_0x3aaec2){_0x54bb04=_0x54bb04-0x0;var _0xf7a4f4=_0x0f97[_0x54bb04];return _0xf7a4f4;};'use strict';var _=require(_0x70f9('0x0'));var jayson=require(_0x70f9('0x1'));var db=require(_0x70f9('0x2'))['db'];var amiClient=jayson[_0x70f9('0x3')][_0x70f9('0x4')]({'port':0x232a});var routingClient=jayson[_0x70f9('0x3')][_0x70f9('0x4')]({'port':0x232c});function isAgentPaused(_0x163bbc,_0xa00b08){var _0x279d71=[_0x163bbc[_0x70f9('0x5')],_0x163bbc['faxPause'],_0x163bbc['mailPause'],_0x163bbc[_0x70f9('0x6')],_0x163bbc[_0x70f9('0x7')],_0x163bbc[_0x70f9('0x8')],_0x163bbc[_0x70f9('0x9')]];if(!_0xa00b08)return _['every'](_0x279d71);var _0x523d32=_[_0x70f9('0xa')](_0x279d71);return _0x523d32[_0x70f9('0xb')]>0x0&&_0x523d32[_0x70f9('0xb')]<_0x279d71[_0x70f9('0xb')]?!![]:![];}function isIdle(_0x481fc2){return _0x481fc2==='idle'||_0x481fc2==='unknown'||_0x481fc2==='unavailable'||_0x481fc2===_0x70f9('0xc')||_[_0x70f9('0xd')](_0x481fc2);}function isAgentIdle(_0x5951be){if(_0x5951be[_0x70f9('0xe')]!=='idle'&&_0x5951be[_0x70f9('0x8')]){_0x5951be[_0x70f9('0xe')]=_0x70f9('0xf');return![];}return _[_0x70f9('0x10')]([_0x5951be[_0x70f9('0x11')],_0x5951be['faxStatus'],_0x5951be[_0x70f9('0x12')],_0x5951be['openchannelStatus'],_0x5951be['smsStatus'],_0x5951be['voiceStatus'],_0x5951be['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0x70f9('0x13')]('Agents',{})[_0x70f9('0x14')](function(_0x36044f){if(_0x36044f[_0x70f9('0x15')]){throw new Error(_0x70f9('0x16'));}var _0x25b88f=_0x36044f[_0x70f9('0x17')];return routingClient[_0x70f9('0x13')](_0x70f9('0x18'),{})[_0x70f9('0x14')](function(_0x4b6e93){if(_0x4b6e93[_0x70f9('0x15')]){throw new Error(_0x70f9('0x19'));}var _0x5817b5=_0x4b6e93[_0x70f9('0x17')];return _[_0x70f9('0x1a')]({},_0x25b88f,_0x5817b5);});})[_0x70f9('0x1b')](function(_0x22f7f7){throw _0x22f7f7;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x57caca){var _0x14de5c=_0x70f9('0x1c');if(isAgentPaused(_0x57caca))_0x14de5c=_0x70f9('0xf');else if(isAgentPaused(_0x57caca,!![]))_0x14de5c=_0x70f9('0x1d');else if(isAgentIdle(_0x57caca))_0x14de5c='idle';else _0x14de5c=_0x70f9('0x1e');return _0x14de5c;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x454339,_0x309afd){var _0x3ce965=_[_0x70f9('0x1f')](_0x454339)?_0x454339:[_0x454339];var _0x2e4e0a=_['startCase'](_0x309afd)+_0x70f9('0x20');var _0x38479d=_[_0x70f9('0x21')](_0x3ce965,function(_0x5d5372){return db[_0x2e4e0a][_0x70f9('0x22')]({'where':{'id':_0x5d5372}})[_0x70f9('0x14')](function(_0xcc9c19){if(!_0xcc9c19)return[];return _0xcc9c19[_0x70f9('0x23')]({'attributes':['id'],'raw':!![]});});});return Promise[_0x70f9('0x24')](_0x38479d)['then'](function(_0x3a8209){var _0x74b33c=_(_0x3a8209)[_0x70f9('0x25')]()[_0x70f9('0x21')]('id')[_0x70f9('0x26')]()[_0x70f9('0x27')]();return _0x74b33c;});}exports['getAgentIdsByQueues']=getAgentIdsByQueues;function getAgentIdsByStatus(_0x470d0c,_0x37d551,_0x1a0da5){try{if(_0x37d551[_0x70f9('0xb')]>0x0){_0x470d0c=_0x470d0c[_0x70f9('0xa')](function(_0x701ff2){return _0x37d551[_0x70f9('0x28')](_0x701ff2['id']);});}var _0x28a8c6=_0x470d0c['filter'](function(_0x5381fa){var _0xd56d2d=_0x70f9('0x1e');if(isAgentIdle(_0x5381fa)){_0xd56d2d=_0x70f9('0x29');}return _0xd56d2d===_0x1a0da5;});return _['map'](_0x28a8c6,'id');}catch(_0x562f5e){throw _0x562f5e;}}exports[_0x70f9('0x2a')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0xe9d41f,_0x4d0f9e,_0x55696d){return Promise[_0x70f9('0x2b')]()[_0x70f9('0x14')](function(){if(_0x4d0f9e['length']>0x0){_0xe9d41f=_0xe9d41f[_0x70f9('0xa')](function(_0x227845){return _0x4d0f9e['includes'](_0x227845['id']);});}return _0xe9d41f;})[_0x70f9('0x14')](function(){return db[_0x70f9('0x2c')][_0x70f9('0x2d')]({'attributes':['id','name',_0x70f9('0x2e'),_0x70f9('0x5'),'faxPause',_0x70f9('0x2f'),_0x70f9('0x6'),'smsPause',_0x70f9('0x8'),_0x70f9('0x9'),_0x70f9('0x30')],'where':{'id':{'$in':_[_0x70f9('0x21')](_0xe9d41f,'id')}},'raw':!![]});})[_0x70f9('0x14')](function(_0x36e93d){return _0x36e93d[_0x70f9('0x21')](function(_0x4b1c17){var _0x3a7e9e=_[_0x70f9('0x31')](_0xe9d41f,['id',_0x4b1c17['id']]);var _0x242101=filterAgentAttributes(_0x3a7e9e);_[_0x70f9('0x1a')](_0x4b1c17,_0x242101);_0x4b1c17[_0x70f9('0x32')]=getAgentStatus(_0x4b1c17);return _0x4b1c17;});})[_0x70f9('0x14')](function(_0x5adf6e){var _0x2caf65=sortAgentsByStatus(_0x5adf6e,_0x55696d);return _[_0x70f9('0x21')](_0x2caf65,'id');})['catch'](function(_0x2dabd6){throw _0x2dabd6;});}exports['getSortedAgentsIdsByStatus']=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x375d84){var _0x58aa1c={'fields':[],'order':null};var _0x53b955=_0x375d84[_0x70f9('0x33')](',');_0x58aa1c[_0x70f9('0x34')]=_[_0x70f9('0xa')](_0x53b955,function(_0x14a88d){if(!_0x14a88d[_0x70f9('0x28')](_0x70f9('0x32'))){return!![];}_0x58aa1c[_0x70f9('0x35')]=_[_0x70f9('0x36')](_0x14a88d,'-')?_0x70f9('0x37'):'ASC';return![];});return _0x58aa1c;}exports[_0x70f9('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x66549f){if(!_0x66549f){_0x66549f=_0x70f9('0x39');}if(_0x66549f[_0x70f9('0x28')](_0x70f9('0x2e'))&&!_0x66549f[_0x70f9('0x28')]('internal')){var _0x36a97b=_0x66549f[_0x70f9('0x3a')](0x0,_0x66549f[_0x70f9('0x3b')](_0x70f9('0x2e')));_0x66549f+=','+_0x36a97b+_0x70f9('0x3c');}return _0x66549f;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0x2953de,_0x48d698){var _0x8ca1a6=_0x2953de['sort'](function(_0x40cdd2,_0x54452c){if(_0x40cdd2[_0x70f9('0x32')]===_0x54452c['globalStatus']){if(_0x40cdd2['globalStatus']===_0x70f9('0xf')){if(_0x48d698==='DESC'){return(_0x40cdd2[_0x70f9('0x30')]||'')<(_0x54452c['pauseType']||'')||_0x40cdd2[_0x70f9('0x2e')][_0x70f9('0x3d')]()>_0x54452c[_0x70f9('0x2e')]['toLowerCase']()?0x1:-0x1;}else{return(_0x40cdd2['pauseType']||'')<(_0x54452c[_0x70f9('0x30')]||'')||_0x40cdd2[_0x70f9('0x2e')]['toLowerCase']()>_0x54452c[_0x70f9('0x2e')][_0x70f9('0x3d')]()?-0x1:0x1;}}else{if(_0x48d698===_0x70f9('0x37')){return _0x40cdd2[_0x70f9('0x2e')][_0x70f9('0x3d')]()<_0x54452c[_0x70f9('0x2e')][_0x70f9('0x3d')]()?0x1:-0x1;}else{return _0x40cdd2['fullname'][_0x70f9('0x3d')]()<_0x54452c[_0x70f9('0x2e')][_0x70f9('0x3d')]()?-0x1:0x1;}}}else{if(_0x48d698===_0x70f9('0x37')){return _0x40cdd2['globalStatus']<_0x54452c[_0x70f9('0x32')]?0x1:-0x1;}else{return _0x40cdd2[_0x70f9('0x32')]<_0x54452c[_0x70f9('0x32')]?-0x1:0x1;}}});return _0x8ca1a6;}exports[_0x70f9('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0x24a88a){var _0x46818c=['userpic',_0x70f9('0x3f'),_0x70f9('0x40'),_0x70f9('0x41'),_0x70f9('0x30'),'lastPauseAt',_0x70f9('0x3c'),'address',_0x70f9('0x5'),'openchannelPause',_0x70f9('0x2f'),_0x70f9('0x7'),_0x70f9('0x9'),_0x70f9('0x42'),_0x70f9('0x8'),'chatCapacity',_0x70f9('0x43'),'mailCapacity',_0x70f9('0x44'),_0x70f9('0x45'),_0x70f9('0x46'),_0x70f9('0x47'),_0x70f9('0x48'),'mailCurrentCapacity',_0x70f9('0x49'),'whatsappCurrentCapacity','faxCurrentCapacity',_0x70f9('0x11'),_0x70f9('0x4a'),'mailStatus',_0x70f9('0x4b'),_0x70f9('0x4c'),_0x70f9('0x4d'),_0x70f9('0xe'),_0x70f9('0x4e'),_0x70f9('0x4f'),_0x70f9('0x50'),_0x70f9('0x51'),_0x70f9('0x52'),_0x70f9('0x53'),'voiceStatusTime',_0x70f9('0x54'),_0x70f9('0x55'),'screenrecording',_0x70f9('0x56'),_0x70f9('0x57')];var _0x3ec5f4=[_0x70f9('0x5'),'openchannelPause',_0x70f9('0x2f'),'smsPause',_0x70f9('0x9'),_0x70f9('0x42'),_0x70f9('0x8'),_0x70f9('0x3f')];var _0x4b4cd7=_(_0x24a88a)['omit'](_0x3ec5f4)[_0x70f9('0x58')](_0x46818c)['value']();return _0x4b4cd7;}exports[_0x70f9('0x59')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0x70f9('0x5a'),_0x70f9('0x2e'),'role',_0x70f9('0x3c'),_0x70f9('0x3f'),_0x70f9('0x32'),_0x70f9('0x5b'),_0x70f9('0x40'),_0x70f9('0x30'),_0x70f9('0x41'),_0x70f9('0x42'),_0x70f9('0x5'),_0x70f9('0x2f'),_0x70f9('0x6'),_0x70f9('0x7'),'voicePause',_0x70f9('0x9'),_0x70f9('0x11'),'faxStatus',_0x70f9('0x12'),_0x70f9('0x4a'),_0x70f9('0x4b'),_0x70f9('0xe'),'whatsappStatus',_0x70f9('0x4e'),'faxStatusTime','mailStatusTime','openchannelStatusTime',_0x70f9('0x51'),'voiceStatusTime',_0x70f9('0x52'),_0x70f9('0x5c'),_0x70f9('0x46'),'mailCapacity',_0x70f9('0x43'),_0x70f9('0x44'),_0x70f9('0x45'),_0x70f9('0x47'),_0x70f9('0x5d'),_0x70f9('0x5e'),_0x70f9('0x48'),'smsCurrentCapacity',_0x70f9('0x5f'),_0x70f9('0x56'),_0x70f9('0x57'),_0x70f9('0x55'),_0x70f9('0x60'),'queue',_0x70f9('0x61')];}exports[_0x70f9('0x62')]=getRealtimeAgentsQueryFields; \ No newline at end of file +var _0xf08c=['Agents','then','error','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','result','merge','catch','getRealtimeAgents','busy','isArray','startCase','Queue','map','findOne','getAgents','all','flatten','uniq','value','getAgentIdsByQueues','includes','getAgentIdsByStatus','resolve','name','fullname','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname,internal','indexOf','internal','validateSortParameter','sort','toLowerCase','sortAgentsByStatus','userpic','online','lastLoginAt','lastPauseAt','address','mailPause','chatCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','openchannelStatus','mailStatus','faxStatus','chatStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','omit','pick','filterAgentAttributes','whatsappStatus','mailCapacity','openchannelCapacity','smsCurrentCapacity','phoneBarEnableAutomaticScreenRecording','destconnectedlinenum','lodash','jayson/promise','../../mysqldb','http','client','chatPause','faxPause','openchannelPause','smsPause','voicePause','whatsappPause','filter','length','idle','unavailable','ringing','isNil','voiceStatus','pause','every','chatStatus','smsStatus','request'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0xf08c,0xb5));var _0xcf08=function(_0x15a359,_0x3d0d98){_0x15a359=_0x15a359-0x0;var _0xfbe81a=_0xf08c[_0x15a359];return _0xfbe81a;};'use strict';var _=require(_0xcf08('0x0'));var jayson=require(_0xcf08('0x1'));var db=require(_0xcf08('0x2'))['db'];var amiClient=jayson['client'][_0xcf08('0x3')]({'port':0x232a});var routingClient=jayson[_0xcf08('0x4')][_0xcf08('0x3')]({'port':0x232c});function isAgentPaused(_0x367392,_0x4f851a){var _0x5c54ac=[_0x367392[_0xcf08('0x5')],_0x367392[_0xcf08('0x6')],_0x367392['mailPause'],_0x367392[_0xcf08('0x7')],_0x367392[_0xcf08('0x8')],_0x367392[_0xcf08('0x9')],_0x367392[_0xcf08('0xa')]];if(!_0x4f851a)return _['every'](_0x5c54ac);var _0x5044bb=_[_0xcf08('0xb')](_0x5c54ac);return _0x5044bb['length']>0x0&&_0x5044bb[_0xcf08('0xc')]<_0x5c54ac[_0xcf08('0xc')]?!![]:![];}function isIdle(_0x537e06){return _0x537e06===_0xcf08('0xd')||_0x537e06==='unknown'||_0x537e06===_0xcf08('0xe')||_0x537e06===_0xcf08('0xf')||_[_0xcf08('0x10')](_0x537e06);}function isAgentIdle(_0x3ed7a0){if(_0x3ed7a0[_0xcf08('0x11')]!==_0xcf08('0xd')&&_0x3ed7a0[_0xcf08('0x9')]){_0x3ed7a0[_0xcf08('0x11')]=_0xcf08('0x12');return![];}return _[_0xcf08('0x13')]([_0x3ed7a0[_0xcf08('0x14')],_0x3ed7a0['faxStatus'],_0x3ed7a0['mailStatus'],_0x3ed7a0['openchannelStatus'],_0x3ed7a0[_0xcf08('0x15')],_0x3ed7a0[_0xcf08('0x11')],_0x3ed7a0['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient[_0xcf08('0x16')](_0xcf08('0x17'),{})[_0xcf08('0x18')](function(_0x2b0135){if(_0x2b0135[_0xcf08('0x19')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0xa838ef=_0x2b0135['result'];return routingClient['request'](_0xcf08('0x17'),{})[_0xcf08('0x18')](function(_0x4c4970){if(_0x4c4970[_0xcf08('0x19')]){throw new Error(_0xcf08('0x1a'));}var _0x2947e5=_0x4c4970[_0xcf08('0x1b')];return _[_0xcf08('0x1c')]({},_0xa838ef,_0x2947e5);});})[_0xcf08('0x1d')](function(_0x5f03e1){throw _0x5f03e1;});}exports[_0xcf08('0x1e')]=getRealtimeAgents;function getAgentStatus(_0x2f9899){var _0x43174e='unknown';if(isAgentPaused(_0x2f9899))_0x43174e=_0xcf08('0x12');else if(isAgentPaused(_0x2f9899,!![]))_0x43174e='*pause';else if(isAgentIdle(_0x2f9899))_0x43174e=_0xcf08('0xd');else _0x43174e=_0xcf08('0x1f');return _0x43174e;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x1ee0b4,_0x279847){var _0x209d5d=_[_0xcf08('0x20')](_0x1ee0b4)?_0x1ee0b4:[_0x1ee0b4];var _0x4dd1f0=_[_0xcf08('0x21')](_0x279847)+_0xcf08('0x22');var _0x52968a=_[_0xcf08('0x23')](_0x209d5d,function(_0x50c926){return db[_0x4dd1f0][_0xcf08('0x24')]({'where':{'id':_0x50c926}})[_0xcf08('0x18')](function(_0x5b7e94){if(!_0x5b7e94)return[];return _0x5b7e94[_0xcf08('0x25')]({'attributes':['id'],'raw':!![]});});});return Promise[_0xcf08('0x26')](_0x52968a)[_0xcf08('0x18')](function(_0x213511){var _0x3faf5a=_(_0x213511)[_0xcf08('0x27')]()[_0xcf08('0x23')]('id')[_0xcf08('0x28')]()[_0xcf08('0x29')]();return _0x3faf5a;});}exports[_0xcf08('0x2a')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x4bfaad,_0x4b74f8,_0x371741){try{if(_0x4b74f8[_0xcf08('0xc')]>0x0){_0x4bfaad=_0x4bfaad['filter'](function(_0x684f45){return _0x4b74f8[_0xcf08('0x2b')](_0x684f45['id']);});}var _0x347835=_0x4bfaad[_0xcf08('0xb')](function(_0xcd6a74){var _0x1709ca=_0xcf08('0x1f');if(isAgentIdle(_0xcd6a74)){_0x1709ca=_0xcf08('0xd');}return _0x1709ca===_0x371741;});return _[_0xcf08('0x23')](_0x347835,'id');}catch(_0x315b96){throw _0x315b96;}}exports[_0xcf08('0x2c')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x242edd,_0x2e6543,_0x2808de){return Promise[_0xcf08('0x2d')]()['then'](function(){if(_0x2e6543[_0xcf08('0xc')]>0x0){_0x242edd=_0x242edd['filter'](function(_0x580acc){return _0x2e6543[_0xcf08('0x2b')](_0x580acc['id']);});}return _0x242edd;})['then'](function(){return db['User']['findAll']({'attributes':['id',_0xcf08('0x2e'),_0xcf08('0x2f'),_0xcf08('0x5'),'faxPause','mailPause',_0xcf08('0x7'),_0xcf08('0x8'),_0xcf08('0x9'),_0xcf08('0xa'),_0xcf08('0x30')],'where':{'id':{'$in':_[_0xcf08('0x23')](_0x242edd,'id')}},'raw':!![]});})[_0xcf08('0x18')](function(_0x56da2f){return _0x56da2f[_0xcf08('0x23')](function(_0x597629){var _0x121bd2=_[_0xcf08('0x31')](_0x242edd,['id',_0x597629['id']]);var _0x497d6c=filterAgentAttributes(_0x121bd2);_[_0xcf08('0x1c')](_0x597629,_0x497d6c);_0x597629[_0xcf08('0x32')]=getAgentStatus(_0x597629);return _0x597629;});})[_0xcf08('0x18')](function(_0x5853b3){var _0x53f457=sortAgentsByStatus(_0x5853b3,_0x2808de);return _[_0xcf08('0x23')](_0x53f457,'id');})[_0xcf08('0x1d')](function(_0x2bb185){throw _0x2bb185;});}exports[_0xcf08('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x44da74){var _0xd73d53={'fields':[],'order':null};var _0x3fa7ca=_0x44da74[_0xcf08('0x34')](',');_0xd73d53[_0xcf08('0x35')]=_[_0xcf08('0xb')](_0x3fa7ca,function(_0x48ecc7){if(!_0x48ecc7['includes'](_0xcf08('0x32'))){return!![];}_0xd73d53[_0xcf08('0x36')]=_[_0xcf08('0x37')](_0x48ecc7,'-')?_0xcf08('0x38'):_0xcf08('0x39');return![];});return _0xd73d53;}exports[_0xcf08('0x3a')]=getUpdatedSortOptions;function validateSortParameter(_0x54720){if(!_0x54720){_0x54720=_0xcf08('0x3b');}if(_0x54720['includes'](_0xcf08('0x2f'))&&!_0x54720[_0xcf08('0x2b')]('internal')){var _0x2795fc=_0x54720['substring'](0x0,_0x54720[_0xcf08('0x3c')](_0xcf08('0x2f')));_0x54720+=','+_0x2795fc+_0xcf08('0x3d');}return _0x54720;}exports[_0xcf08('0x3e')]=validateSortParameter;function sortAgentsByStatus(_0x1b6047,_0x41d9eb){var _0x16f9f9=_0x1b6047[_0xcf08('0x3f')](function(_0x4c2ad7,_0x2f7495){if(_0x4c2ad7[_0xcf08('0x32')]===_0x2f7495[_0xcf08('0x32')]){if(_0x4c2ad7['globalStatus']==='pause'){if(_0x41d9eb===_0xcf08('0x38')){return(_0x4c2ad7[_0xcf08('0x30')]||'')<(_0x2f7495[_0xcf08('0x30')]||'')||_0x4c2ad7[_0xcf08('0x2f')]['toLowerCase']()>_0x2f7495[_0xcf08('0x2f')]['toLowerCase']()?0x1:-0x1;}else{return(_0x4c2ad7[_0xcf08('0x30')]||'')<(_0x2f7495[_0xcf08('0x30')]||'')||_0x4c2ad7[_0xcf08('0x2f')]['toLowerCase']()>_0x2f7495[_0xcf08('0x2f')][_0xcf08('0x40')]()?-0x1:0x1;}}else{if(_0x41d9eb===_0xcf08('0x38')){return _0x4c2ad7[_0xcf08('0x2f')][_0xcf08('0x40')]()<_0x2f7495[_0xcf08('0x2f')][_0xcf08('0x40')]()?0x1:-0x1;}else{return _0x4c2ad7[_0xcf08('0x2f')][_0xcf08('0x40')]()<_0x2f7495['fullname'][_0xcf08('0x40')]()?-0x1:0x1;}}}else{if(_0x41d9eb===_0xcf08('0x38')){return _0x4c2ad7[_0xcf08('0x32')]<_0x2f7495[_0xcf08('0x32')]?0x1:-0x1;}else{return _0x4c2ad7[_0xcf08('0x32')]<_0x2f7495['globalStatus']?-0x1:0x1;}}});return _0x16f9f9;}exports[_0xcf08('0x41')]=sortAgentsByStatus;function filterAgentAttributes(_0x47740f){var _0x1c147a=[_0xcf08('0x42'),_0xcf08('0x43'),_0xcf08('0x44'),_0xcf08('0x45'),_0xcf08('0x30'),_0xcf08('0x45'),_0xcf08('0x3d'),_0xcf08('0x46'),_0xcf08('0x5'),_0xcf08('0x7'),_0xcf08('0x47'),_0xcf08('0x8'),_0xcf08('0xa'),_0xcf08('0x6'),_0xcf08('0x9'),_0xcf08('0x48'),'openchannelCapacity','mailCapacity',_0xcf08('0x49'),_0xcf08('0x4a'),_0xcf08('0x4b'),_0xcf08('0x4c'),_0xcf08('0x4d'),_0xcf08('0x4e'),'smsCurrentCapacity',_0xcf08('0x4f'),_0xcf08('0x50'),_0xcf08('0x14'),_0xcf08('0x51'),_0xcf08('0x52'),_0xcf08('0x15'),'whatsappStatus',_0xcf08('0x53'),_0xcf08('0x11'),_0xcf08('0x54'),'openchannelStatusTime',_0xcf08('0x55'),_0xcf08('0x56'),_0xcf08('0x57'),_0xcf08('0x58'),_0xcf08('0x59'),_0xcf08('0x5a'),'destconnectedlinenum',_0xcf08('0x5b'),_0xcf08('0x5c'),'phoneBarEnableAutomaticScreenRecording'];var _0x200a97=[_0xcf08('0x5'),_0xcf08('0x7'),'mailPause','smsPause',_0xcf08('0xa'),_0xcf08('0x6'),_0xcf08('0x9'),_0xcf08('0x43')];var _0xca83a=_(_0x47740f)[_0xcf08('0x5d')](_0x200a97)[_0xcf08('0x5e')](_0x1c147a)[_0xcf08('0x29')]();return _0xca83a;}exports[_0xcf08('0x5f')]=filterAgentAttributes;function getRealtimeAgentsQueryFields(){return['id',_0xcf08('0x2e'),'fullname','role',_0xcf08('0x3d'),'online',_0xcf08('0x32'),_0xcf08('0x42'),'lastLoginAt',_0xcf08('0x30'),_0xcf08('0x45'),'faxPause',_0xcf08('0x5'),'mailPause',_0xcf08('0x7'),'smsPause','voicePause',_0xcf08('0xa'),'chatStatus',_0xcf08('0x53'),_0xcf08('0x52'),_0xcf08('0x51'),_0xcf08('0x15'),'voiceStatus',_0xcf08('0x60'),'chatStatusTime',_0xcf08('0x58'),'mailStatusTime','openchannelStatusTime','smsStatusTime','voiceStatusTime',_0xcf08('0x57'),'chatCapacity',_0xcf08('0x4b'),_0xcf08('0x61'),_0xcf08('0x62'),_0xcf08('0x49'),_0xcf08('0x4a'),_0xcf08('0x4c'),_0xcf08('0x50'),_0xcf08('0x4e'),_0xcf08('0x4d'),_0xcf08('0x63'),_0xcf08('0x4f'),_0xcf08('0x5c'),_0xcf08('0x64'),_0xcf08('0x65'),'onhold',_0xcf08('0x5a'),_0xcf08('0x5b')];}exports['getRealtimeAgentsQueryFields']=getRealtimeAgentsQueryFields; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 2a31dd9..ebf741a 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x91ef=['predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','voice','request','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','concat','outbound','map','get','paused','pTalking','find','merge','initializeQueues','lodash','jayson/promise','client','http','available','loggedIn','waiting','busy','inUse','invalid','loggedInDb','notInUse','ringing','talking','unavailable','unknown','originated','message','statusMessage','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable'];(function(_0x5d89e5,_0x2d9dfb){var _0x2e53f8=function(_0x1f9264){while(--_0x1f9264){_0x5d89e5['push'](_0x5d89e5['shift']());}};_0x2e53f8(++_0x2d9dfb);}(_0x91ef,0xaf));var _0xf91e=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x91ef[_0x4ff09b];return _0x3f5c2e;};'use strict';var _=require(_0xf91e('0x0'));var jayson=require(_0xf91e('0x1'));var util=require('util');var amiClient=jayson[_0xf91e('0x2')][_0xf91e('0x3')]({'port':0x232a});var routingClient=jayson[_0xf91e('0x2')][_0xf91e('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0xf91e('0x4'),_0xf91e('0x5'),'paused',_0xf91e('0x6')];var VOICE_QUEUE_ATTRIBUTES=[_0xf91e('0x7'),_0xf91e('0x8'),_0xf91e('0x9'),_0xf91e('0xa'),_0xf91e('0xb'),'onHold',_0xf91e('0xc'),'ringInUse',_0xf91e('0xd'),_0xf91e('0xe'),_0xf91e('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking',_0xf91e('0x10'),_0xf91e('0x11'),_0xf91e('0x12'),'dialActive',_0xf91e('0x13'),_0xf91e('0x14'),_0xf91e('0x15'),_0xf91e('0x16'),_0xf91e('0x17'),'erlangCallToSecond',_0xf91e('0x18'),_0xf91e('0x19'),'dialPredictiveInterval',_0xf91e('0x1a'),_0xf91e('0x1b'),_0xf91e('0x1c'),'predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls',_0xf91e('0x1d'),_0xf91e('0x1e'),_0xf91e('0x1f'),'predictiveIntervalAvgTalktime'];function getRealtimeQueues(_0x495b3f,_0x32191e){var _0x140132=_0x32191e===_0xf91e('0x20')?amiClient:routingClient;return _0x140132[_0xf91e('0x21')](_['startCase'](_0x32191e)+_0xf91e('0x22'),_0x495b3f)[_0xf91e('0x23')](function(_0x1f09b4){if(_0x1f09b4[_0xf91e('0x24')])throw new Error(util[_0xf91e('0x25')](_0xf91e('0x26'),_0x32191e));return _0x1f09b4[_0xf91e('0x27')];})[_0xf91e('0x28')](function(_0x439536){throw _0x439536;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x5bb3b2,_0x295c1a,_0x345f14,_0x5d1215){var _0x3a8b96=DEFAULT_QUEUE_ATTRIBUTES;if(_0x345f14===_0xf91e('0x20')){if(_0x5d1215===_0xf91e('0x29')){_0x3a8b96=_0x3a8b96[_0xf91e('0x2a')](VOICE_QUEUE_ATTRIBUTES);}else if(_0x5d1215===_0xf91e('0x2b')){_0x3a8b96=_0x3a8b96[_0xf91e('0x2a')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x5bb3b2[_0xf91e('0x2c')](function(_0x7718fb){var _0x2d1334=_0x7718fb[_0xf91e('0x2d')]({'plain':!![]});_0x2d1334[_0xf91e('0x2e')]=0x0;_0x2d1334[_0xf91e('0xa')]=0x0;_0x2d1334[_0xf91e('0x5')]=0x0;_0x2d1334['available']=0x0;_0x2d1334[_0xf91e('0x6')]=0x0;if(_0x345f14===_0xf91e('0x20')){_0x2d1334[_0xf91e('0xd')]=0x0;_0x2d1334[_0xf91e('0x7')]=0x0;if(_0x5d1215===_0xf91e('0x2b')){_0x2d1334[_0xf91e('0x2f')]=0x0;_0x2d1334[_0xf91e('0x10')]=0x0;}}var _0x20179e=_[_0xf91e('0x30')](_0x295c1a,['id',_0x2d1334['id']]);if(_0x20179e){_[_0xf91e('0x31')](_0x2d1334,_['pick'](_0x20179e,_0x3a8b96));}return _0x2d1334;});}exports[_0xf91e('0x32')]=initializeQueues; \ No newline at end of file +var _0xf164=['available','loggedIn','busy','inUse','loggedInDb','onHold','ringInUse','message','statusMessage','dialActive','dialMethod','Trunk','startPredictive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','getRealtimeQueues','map','paused','outbound','pTalking','originated','merge','pick','jayson/promise','util','client','http'];(function(_0x4672b4,_0x2e24b9){var _0x1c6ce5=function(_0x43fc9a){while(--_0x43fc9a){_0x4672b4['push'](_0x4672b4['shift']());}};_0x1c6ce5(++_0x2e24b9);}(_0xf164,0xac));var _0x4f16=function(_0x43c3db,_0x36ea7b){_0x43c3db=_0x43c3db-0x0;var _0x45e6b0=_0xf164[_0x43c3db];return _0x45e6b0;};'use strict';var _=require('lodash');var jayson=require(_0x4f16('0x0'));var util=require(_0x4f16('0x1'));var amiClient=jayson[_0x4f16('0x2')][_0x4f16('0x3')]({'port':0x232a});var routingClient=jayson['client'][_0x4f16('0x3')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x4f16('0x4'),_0x4f16('0x5'),'paused','waiting'];var VOICE_QUEUE_ATTRIBUTES=[_0x4f16('0x6'),_0x4f16('0x7'),'invalid',_0x4f16('0x8'),'notInUse',_0x4f16('0x9'),'ringing',_0x4f16('0xa'),'talking','unavailable','unknown'];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated',_0x4f16('0xb'),_0x4f16('0xc'),_0x4f16('0xd'),_0x4f16('0xe'),_0x4f16('0xf'),_0x4f16('0x10'),'startProgressive',_0x4f16('0x11'),_0x4f16('0x12'),_0x4f16('0x13'),_0x4f16('0x14'),_0x4f16('0x15'),_0x4f16('0x16'),'dialPredictiveIntervalMinThreshold',_0x4f16('0x17'),_0x4f16('0x18'),_0x4f16('0x19'),_0x4f16('0x1a'),_0x4f16('0x1b'),_0x4f16('0x1c'),_0x4f16('0x1d')];function getRealtimeQueues(_0x5be58a,_0x4b9b57){var _0x54dfc9=_0x4b9b57===_0x4f16('0x1e')?amiClient:routingClient;return _0x54dfc9[_0x4f16('0x1f')](_['startCase'](_0x4b9b57)+'Queues',_0x5be58a)[_0x4f16('0x20')](function(_0xb6d317){if(_0xb6d317[_0x4f16('0x21')])throw new Error(util[_0x4f16('0x22')](_0x4f16('0x23'),_0x4b9b57));return _0xb6d317['result'];})['catch'](function(_0x368a71){throw _0x368a71;});}exports[_0x4f16('0x24')]=getRealtimeQueues;function initializeQueues(_0x26f65e,_0x4596e0,_0x1371fd,_0x35a6e2){var _0x3c3f07=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1371fd===_0x4f16('0x1e')){if(_0x35a6e2==='inbound'){_0x3c3f07=_0x3c3f07['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x35a6e2==='outbound'){_0x3c3f07=_0x3c3f07['concat'](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x26f65e[_0x4f16('0x25')](function(_0x4f4f61){var _0xfea6cf=_0x4f4f61['get']({'plain':!![]});_0xfea6cf[_0x4f16('0x26')]=0x0;_0xfea6cf['loggedInDb']=0x0;_0xfea6cf[_0x4f16('0x5')]=0x0;_0xfea6cf[_0x4f16('0x4')]=0x0;_0xfea6cf['waiting']=0x0;if(_0x1371fd===_0x4f16('0x1e')){_0xfea6cf['talking']=0x0;_0xfea6cf[_0x4f16('0x6')]=0x0;if(_0x35a6e2===_0x4f16('0x27')){_0xfea6cf[_0x4f16('0x28')]=0x0;_0xfea6cf[_0x4f16('0x29')]=0x0;}}var _0x32f650=_['find'](_0x4596e0,['id',_0xfea6cf['id']]);if(_0x32f650){_[_0x4f16('0x2a')](_0xfea6cf,_[_0x4f16('0x2b')](_0x32f650,_0x3c3f07));}return _0xfea6cf;});}exports['initializeQueues']=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index d08692b..17c9afc 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(_0x45b9c6,_0x1ec45c){var _0xfc724e=function(_0x3db2be){while(--_0x3db2be){_0x45b9c6['push'](_0x45b9c6['shift']());}};_0xfc724e(++_0x1ec45c);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 _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(_0x40d10c,_0x276401){var _0x52b763=function(_0x31cb81){while(--_0x31cb81){_0x40d10c['push'](_0x40d10c['shift']());}};_0x52b763(++_0x276401);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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 diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index d7eaaf3..09ece99 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 _0x2971=['networkInterfaces','orderBy','keys','filter','family','IPv4','concat','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','map','model','join','createHash','md5','update','digest','test','licenseToken','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','macAddress','ipAddress','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment'];(function(_0xa1fc51,_0x4fe945){var _0x150463=function(_0xe9fe79){while(--_0xe9fe79){_0xa1fc51['push'](_0xa1fc51['shift']());}};_0x150463(++_0x4fe945);}(_0x2971,0x86));var _0x1297=function(_0x8af94,_0x1533c9){_0x8af94=_0x8af94-0x0;var _0x14a3d5=_0x2971[_0x8af94];return _0x14a3d5;};'use strict';var _=require(_0x1297('0x0'));var os=require('os');var crypto=require(_0x1297('0x1'));var machine=require(_0x1297('0x2'));var exec=require(_0x1297('0x3'))[_0x1297('0x4')];var config=require(_0x1297('0x5'));function getInterfaces(){var _0x1c9d42=[];var _0x455ee5=os[_0x1297('0x6')]();var _0x12b4f7=_[_0x1297('0x7')](_[_0x1297('0x8')](_0x455ee5));for(var _0x3e20b6=0x0;_0x3e20b6<_0x12b4f7['length'];_0x3e20b6++){var _0x596017=_0x455ee5[_0x12b4f7[_0x3e20b6]][_0x1297('0x9')](function(_0x118b7a){return _0x118b7a[_0x1297('0xa')]===_0x1297('0xb')&&_0x118b7a['internal']===![];});_0x1c9d42=_0x1c9d42[_0x1297('0xc')](_0x596017);}return _0x1c9d42;}function getFirstInterface(){var _0x3be0da=_['head'](getInterfaces());return{'macAddress':_0x3be0da&&_0x3be0da[_0x1297('0xd')]?_0x3be0da[_0x1297('0xd')]:_0x1297('0xe'),'ipAddress':_0x3be0da&&_0x3be0da[_0x1297('0xf')]?_0x3be0da[_0x1297('0xf')]:_0x1297('0x10')};}exports[_0x1297('0x11')]=getFirstInterface;function getCPUhash(){var _0x245be4=_[_0x1297('0x7')](os['cpus']()[_0x1297('0x12')](function(_0x1023c7){return _0x1023c7[_0x1297('0x13')];}))[_0x1297('0x14')](':');return crypto[_0x1297('0x15')](_0x1297('0x16'))[_0x1297('0x17')](_0x245be4)[_0x1297('0x18')]('hex');}exports['getUuid']=function(){var _0x588e08=os['platform']();var _0x5959b5=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x5959b5[_0x1297('0x19')](config[_0x1297('0x1a')])){return config[_0x1297('0x1a')];}else if(_0x588e08===_0x1297('0x1b')){return exec(_0x1297('0x1c'),{'encoding':_0x1297('0x1d')})[_0x1297('0x1e')]('\x0d\x0a','');}else{var _0x4dec80=getFirstInterface();var _0x39ab8c=getCPUhash();var _0x3c92a0=_0x39ab8c+'|'+os['hostname']()+'|'+_0x4dec80[_0x1297('0x1f')]+'|'+_0x4dec80[_0x1297('0x20')];var _0x2dab40=crypto[_0x1297('0x15')]('md5')['update'](_0x3c92a0)['digest'](_0x1297('0x21'));return _0x2dab40['substring'](0x0,0x8)+'-'+_0x2dab40['substring'](0x8,0xc)+'-'+_0x2dab40[_0x1297('0x22')](0xc,0x10)+'-'+_0x2dab40[_0x1297('0x22')](0x10,0x14)+'-'+_0x2dab40[_0x1297('0x22')](0x14);}}; \ No newline at end of file +var _0x6984=['getFirstInterface','join','md5','update','platform','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','createHash','hex','substring','lodash','crypto','bimedia-machine-uuid','child_process','execSync','../environment','keys','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x6984,0xb6));var _0x4698=function(_0x59eaa1,_0x1f4bc0){_0x59eaa1=_0x59eaa1-0x0;var _0x420046=_0x6984[_0x59eaa1];return _0x420046;};'use strict';var _=require(_0x4698('0x0'));var os=require('os');var crypto=require(_0x4698('0x1'));var machine=require(_0x4698('0x2'));var exec=require(_0x4698('0x3'))[_0x4698('0x4')];var config=require(_0x4698('0x5'));function getInterfaces(){var _0x1cffb2=[];var _0x300b3f=os['networkInterfaces']();var _0x3b78e4=_['orderBy'](_[_0x4698('0x6')](_0x300b3f));for(var _0x42cd7b=0x0;_0x42cd7b<_0x3b78e4['length'];_0x42cd7b++){var _0x2fc1ed=_0x300b3f[_0x3b78e4[_0x42cd7b]][_0x4698('0x7')](function(_0x410646){return _0x410646['family']===_0x4698('0x8')&&_0x410646[_0x4698('0x9')]===![];});_0x1cffb2=_0x1cffb2[_0x4698('0xa')](_0x2fc1ed);}return _0x1cffb2;}function getFirstInterface(){var _0x144e2e=_[_0x4698('0xb')](getInterfaces());return{'macAddress':_0x144e2e&&_0x144e2e[_0x4698('0xc')]?_0x144e2e[_0x4698('0xc')]:_0x4698('0xd'),'ipAddress':_0x144e2e&&_0x144e2e[_0x4698('0xe')]?_0x144e2e[_0x4698('0xe')]:_0x4698('0xf')};}exports[_0x4698('0x10')]=getFirstInterface;function getCPUhash(){var _0x1ceb31=_['orderBy'](os['cpus']()['map'](function(_0x14d8c6){return _0x14d8c6['model'];}))[_0x4698('0x11')](':');return crypto['createHash'](_0x4698('0x12'))[_0x4698('0x13')](_0x1ceb31)['digest']('hex');}exports['getUuid']=function(){var _0x5b2b3e=os[_0x4698('0x14')]();var _0x2b5b7c=/[0-9a-f-]{36}/;if(config[_0x4698('0x15')]&&_0x2b5b7c[_0x4698('0x16')](config['licenseToken'])){return config[_0x4698('0x15')];}else if(_0x5b2b3e===_0x4698('0x17')){return exec(_0x4698('0x18'),{'encoding':_0x4698('0x19')})[_0x4698('0x1a')]('\x0d\x0a','');}else{var _0x1aa2b7=getFirstInterface();var _0x181d4e=getCPUhash();var _0x2e4e29=_0x181d4e+'|'+os[_0x4698('0x1b')]()+'|'+_0x1aa2b7[_0x4698('0x1c')]+'|'+_0x1aa2b7[_0x4698('0x1d')];var _0x3da8d3=crypto[_0x4698('0x1e')](_0x4698('0x12'))['update'](_0x2e4e29)['digest'](_0x4698('0x1f'));return _0x3da8d3[_0x4698('0x20')](0x0,0x8)+'-'+_0x3da8d3['substring'](0x8,0xc)+'-'+_0x3da8d3['substring'](0xc,0x10)+'-'+_0x3da8d3[_0x4698('0x20')](0x10,0x14)+'-'+_0x3da8d3['substring'](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index a206525..a809dee 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 _0x5aaa=['get','data1','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Disabled','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','YYYY-MM-DD\x20HH:mm','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','util','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','../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'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5aaa,0xda));var _0xa5aa=function(_0x2e2779,_0x4cda24){_0x2e2779=_0x2e2779-0x0;var _0x49a171=_0x5aaa[_0x2e2779];return _0x49a171;};'use strict';var util=require(_0xa5aa('0x0'));var moment=require('moment');var rp=require('request-promise');var BPromise=require(_0xa5aa('0x1'));var pkginfo=require(_0xa5aa('0x2'))(module,_0xa5aa('0x3'));var db=require(_0xa5aa('0x4'))['db'];var encryptor=require(_0xa5aa('0x5'));var hardware=require('./hardware');var logger=require(_0xa5aa('0x6'))(_0xa5aa('0x7'));var HOST=_0xa5aa('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0xb3c62a){return new BPromise(function(_0x3be337,_0x46c67e){var _0x2312b0=util[_0xa5aa('0x9')](_0xa5aa('0xa'),HOST,_0xb3c62a,module[_0xa5aa('0xb')]['version']);if(oldToken){_0x2312b0=util[_0xa5aa('0x9')](_0xa5aa('0xc'),HOST,_0xb3c62a,module[_0xa5aa('0xb')][_0xa5aa('0x3')],oldToken);}var _0x37deae={'uri':_0x2312b0,'method':_0xa5aa('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x37deae)[_0xa5aa('0xe')](function(_0x44f8f4){_0x3be337(_0x44f8f4);})[_0xa5aa('0xf')](function(_0x28278f){_0x46c67e(_0x28278f);});});}function manageLicense(_0x2a6efa,_0x758bc){var _0x203943=_0x758bc[_0xa5aa('0x10')]({'plain':!![]});if(!isOldTokenSent&&_0x203943[_0xa5aa('0x11')]!==_0x2a6efa&&!_0x203943[_0xa5aa('0x12')]){oldToken=_0x203943[_0xa5aa('0x11')];}httpRequest(_0x2a6efa)[_0xa5aa('0xe')](function(_0x212b56){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x212b56['active']){isOldTokenSent=![];if(!_0x203943['license']&&_0x203943[_0xa5aa('0x7')]!=_0x212b56[_0xa5aa('0x7')]||_0x203943[_0xa5aa('0x7')]&&_0x203943[_0xa5aa('0x12')]){logger[_0xa5aa('0x13')](_0xa5aa('0x14'));}if(_0x203943[_0xa5aa('0x7')]&&!_0x203943[_0xa5aa('0x12')]&&_0x203943['license']!=_0x212b56['license']){logger['info'](_0xa5aa('0x15'));}if(_0x203943[_0xa5aa('0x7')]&&!_0x203943['data2']&&_0x203943['license']==_0x212b56[_0xa5aa('0x7')]){return _0x758bc;}return _0x758bc[_0xa5aa('0x16')]({'data1':_0x2a6efa,'data2':null,'license':_0x212b56['license']});}else{if(_0x212b56[_0xa5aa('0x7')]||_0x203943[_0xa5aa('0x7')]){if(!_0x203943['data2']){if(_0x203943['data1']==_0x2a6efa){GRAY_PERIOD_REASON=_0xa5aa('0x17');logger[_0xa5aa('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0xa5aa('0x18');logger[_0xa5aa('0x13')](_0xa5aa('0x19'),_0x203943[_0xa5aa('0x11')],_0x2a6efa);}logger['info'](_0xa5aa('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()[_0xa5aa('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x758bc['update']({'data2':encryptor['encryptString'](moment()[_0xa5aa('0x9')](_0xa5aa('0x1b')))});}else{if(moment()['diff'](encryptor[_0xa5aa('0x1c')](_0x203943['data2']),_0xa5aa('0x1d'))>DAYS){logger[_0xa5aa('0x13')](_0xa5aa('0x1e'),moment()[_0xa5aa('0x9')](_0xa5aa('0x1b')));isOldTokenSent=![];return _0x758bc['update']({'data1':_0x2a6efa,'data2':null,'license':null});}}}else{if(_0x203943['data1']!=_0x2a6efa){logger[_0xa5aa('0x13')](_0xa5aa('0x19'),_0x203943[_0xa5aa('0x11')],_0x2a6efa);return _0x758bc[_0xa5aa('0x16')]({'data1':_0x2a6efa,'data2':null,'license':null});}}}return _0x758bc;})[_0xa5aa('0xe')](function(_0x5e429b){_0x758bc=_0x5e429b;})[_0xa5aa('0xf')](function(_0x6ec59c){logger['error'](_0x6ec59c[_0xa5aa('0x1f')]);})[_0xa5aa('0x20')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x758bc);},TIME);});}function defaultLicense(){var _0x5c04ce=hardware[_0xa5aa('0x21')]();if(_0x5c04ce){return db[_0xa5aa('0x22')][_0xa5aa('0x23')]({'where':{'id':0x1},'defaults':{'data1':_0x5c04ce}})['spread'](function(_0x175ac5,_0x134f3a){logger['info'](_0xa5aa('0x24'),_0x5c04ce);manageLicense(_0x5c04ce,_0x175ac5);})[_0xa5aa('0xf')](function(_0x257f36){logger[_0xa5aa('0x25')](_0x257f36[_0xa5aa('0x1f')]);});}}exports[_0xa5aa('0x26')]=defaultLicense; \ No newline at end of file +var _0xa12e=['update','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','format','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','message','finally','getUuid','License','findOrCreate','SERVICE\x20LICENSE\x20STARTED\x20%s','error','default','moment','request-promise','bluebird','../../mysqldb','./hardware','../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','version','catch','data1','then','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xa12e,0x12f));var _0xea12=function(_0x66ca61,_0x49453d){_0x66ca61=_0x66ca61-0x0;var _0xa80806=_0xa12e[_0x66ca61];return _0xa80806;};'use strict';var util=require('util');var moment=require(_0xea12('0x0'));var rp=require(_0xea12('0x1'));var BPromise=require(_0xea12('0x2'));var pkginfo=require('pkginfo')(module,'version');var db=require(_0xea12('0x3'))['db'];var encryptor=require('../../components/encryptor');var hardware=require(_0xea12('0x4'));var logger=require(_0xea12('0x5'))(_0xea12('0x6'));var HOST=_0xea12('0x7');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x32b78e){return new BPromise(function(_0x472ea9,_0x323ee7){var _0x4046bd=util['format'](_0xea12('0x8'),HOST,_0x32b78e,module[_0xea12('0x9')]['version']);if(oldToken){_0x4046bd=util['format']('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x32b78e,module[_0xea12('0x9')][_0xea12('0xa')],oldToken);}var _0x1af24b={'uri':_0x4046bd,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x1af24b)['then'](function(_0x5ab74d){_0x472ea9(_0x5ab74d);})[_0xea12('0xb')](function(_0xeef581){_0x323ee7(_0xeef581);});});}function manageLicense(_0x198e7e,_0x373029){var _0xd9822a=_0x373029['get']({'plain':!![]});if(!isOldTokenSent&&_0xd9822a[_0xea12('0xc')]!==_0x198e7e&&!_0xd9822a['data2']){oldToken=_0xd9822a[_0xea12('0xc')];}httpRequest(_0x198e7e)[_0xea12('0xd')](function(_0x7dfbf9){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x7dfbf9[_0xea12('0xe')]){isOldTokenSent=![];if(!_0xd9822a[_0xea12('0x6')]&&_0xd9822a[_0xea12('0x6')]!=_0x7dfbf9[_0xea12('0x6')]||_0xd9822a[_0xea12('0x6')]&&_0xd9822a[_0xea12('0xf')]){logger[_0xea12('0x10')](_0xea12('0x11'));}if(_0xd9822a[_0xea12('0x6')]&&!_0xd9822a[_0xea12('0xf')]&&_0xd9822a[_0xea12('0x6')]!=_0x7dfbf9[_0xea12('0x6')]){logger[_0xea12('0x10')](_0xea12('0x12'));}if(_0xd9822a[_0xea12('0x6')]&&!_0xd9822a['data2']&&_0xd9822a[_0xea12('0x6')]==_0x7dfbf9[_0xea12('0x6')]){return _0x373029;}return _0x373029['update']({'data1':_0x198e7e,'data2':null,'license':_0x7dfbf9['license']});}else{if(_0x7dfbf9[_0xea12('0x6')]||_0xd9822a[_0xea12('0x6')]){if(!_0xd9822a['data2']){if(_0xd9822a[_0xea12('0xc')]==_0x198e7e){GRAY_PERIOD_REASON=_0xea12('0x13');logger[_0xea12('0x10')](_0xea12('0x14'));}else{GRAY_PERIOD_REASON=_0xea12('0x15');logger[_0xea12('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0xd9822a[_0xea12('0xc')],_0x198e7e);}logger[_0xea12('0x10')](_0xea12('0x16'),GRAY_PERIOD_REASON[_0xea12('0x17')](),moment()['format'](_0xea12('0x18')));return _0x373029[_0xea12('0x19')]({'data2':encryptor[_0xea12('0x1a')](moment()['format'](_0xea12('0x18')))});}else{if(moment()[_0xea12('0x1b')](encryptor[_0xea12('0x1c')](_0xd9822a[_0xea12('0xf')]),_0xea12('0x1d'))>DAYS){logger['info'](_0xea12('0x1e'),moment()[_0xea12('0x1f')](_0xea12('0x18')));isOldTokenSent=![];return _0x373029[_0xea12('0x19')]({'data1':_0x198e7e,'data2':null,'license':null});}}}else{if(_0xd9822a[_0xea12('0xc')]!=_0x198e7e){logger[_0xea12('0x10')](_0xea12('0x20'),_0xd9822a[_0xea12('0xc')],_0x198e7e);return _0x373029[_0xea12('0x19')]({'data1':_0x198e7e,'data2':null,'license':null});}}}return _0x373029;})[_0xea12('0xd')](function(_0x4c6753){_0x373029=_0x4c6753;})[_0xea12('0xb')](function(_0x3618bb){logger['error'](_0x3618bb[_0xea12('0x21')]);})[_0xea12('0x22')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x373029);},TIME);});}function defaultLicense(){var _0x59dc97=hardware[_0xea12('0x23')]();if(_0x59dc97){return db[_0xea12('0x24')][_0xea12('0x25')]({'where':{'id':0x1},'defaults':{'data1':_0x59dc97}})['spread'](function(_0x1de006,_0x2323db){logger[_0xea12('0x10')](_0xea12('0x26'),_0x59dc97);manageLicense(_0x59dc97,_0x1de006);})[_0xea12('0xb')](function(_0x54b49d){logger[_0xea12('0x27')](_0x54b49d[_0xea12('0x21')]);});}}exports[_0xea12('0x28')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 0c76e96..d879631 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 _0x6bf6=['moment','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Breaking\x20license','License','defaults','uuid','data1','isEmpty','License\x20key\x20value\x20not\x20found','data2','decryptString','%s:%s:%s','parse','demo','gray','deadline','add','format','grayReason','machineUuid','changed','message','User','findAll','role','sequelize','COUNT','count','admin','telephone','telephones','user','catch','then','pick','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash'];(function(_0xd8f4d2,_0x4cffcc){var _0x27212d=function(_0x55ce15){while(--_0x55ce15){_0xd8f4d2['push'](_0xd8f4d2['shift']());}};_0x27212d(++_0x4cffcc);}(_0x6bf6,0x100));var _0x66bf=function(_0x26cab7,_0x1ccfca){_0x26cab7=_0x26cab7-0x0;var _0x31ba06=_0x6bf6[_0x26cab7];return _0x31ba06;};'use strict';var util=require(_0x66bf('0x0'));var _=require(_0x66bf('0x1'));var moment=require(_0x66bf('0x2'));var BPromise=require('bluebird');var hardware=require(_0x66bf('0x3'));var encryptor=require(_0x66bf('0x4'));var db=require(_0x66bf('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x66bf('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x66bf('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x66bf('0x7'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x4fc11a){return new BPromise(function(_0x532a69,_0x588455){return db[_0x66bf('0x8')]['find'](_[_0x66bf('0x9')](_0x4fc11a,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x3724fb){return checkLicense(_0x3724fb,null);})['then'](function(_0x2e24ec){_0x532a69(_0x2e24ec);return;})['catch'](function(_0x5b59e8){_0x588455(_0x5b59e8);});});}function checkLicense(_0x37ca95,_0x2d23cf){if(!_0x37ca95){demoLicense[_0x66bf('0xa')]=_0x37ca95[_0x66bf('0xb')];return demoLicense;}try{var _0x35a36b=_0x2d23cf||_0x37ca95['license'];if(_[_0x66bf('0xc')](_0x35a36b)){throw new Error(_0x66bf('0xd'));}var _0x45b49e=_0x37ca95[_0x66bf('0xb')];var _0x26abe8=_0x37ca95[_0x66bf('0xe')];var _0x17f194=_0x45b49e['split']('-')[0x4];var _0x54e89e=_0x45b49e['split']('-')[0x0];var _0xc038a8=encryptor[_0x66bf('0xf')](_0x35a36b,util['format'](_0x66bf('0x10'),_0x17f194,_0x45b49e,_0x54e89e));var _0x4a1d65=JSON[_0x66bf('0x11')](_0xc038a8);_0x4a1d65[_0x66bf('0x12')]=![];_0x4a1d65[_0x66bf('0xa')]=_0x45b49e;_0x4a1d65['machineUuid']=hardware['getUuid']();if(_0x26abe8){var _0x4bdba7=encryptor[_0x66bf('0xf')](_0x26abe8);_0x4a1d65[_0x66bf('0x13')]=_0x4bdba7;_0x4a1d65[_0x66bf('0x14')]=moment(_0x4bdba7)[_0x66bf('0x15')](0x7,'days')[_0x66bf('0x16')]();_0x4a1d65[_0x66bf('0x17')]=_0x4a1d65[_0x66bf('0xa')]!=_0x4a1d65[_0x66bf('0x18')]?_0x66bf('0x19'):'disabled';}return _0x4a1d65;}catch(_0x192bd3){breakingLicense[_0x66bf('0xa')]=_0x37ca95[_0x66bf('0xb')];breakingLicense[_0x66bf('0x1a')]=_0x192bd3[_0x66bf('0x1a')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x297111,_0x31e461){getLicense()['then'](function(_0x38028b){return db[_0x66bf('0x1b')][_0x66bf('0x1c')]({'attributes':[_0x66bf('0x1d'),[db[_0x66bf('0x1e')]['fn'](_0x66bf('0x1f'),db['sequelize']['col']('role')),_0x66bf('0x20')]],'group':_0x66bf('0x1d'),'where':{'role':{'$or':[_0x66bf('0x21'),'user',_0x66bf('0x22')]}},'raw':!![]})['then'](function(_0x90c870){var _0x4e840c={'user':_0x38028b['users']||0x0,'telephone':_0x38028b[_0x66bf('0x23')]||0x0};_0x90c870['forEach'](function(_0x2beb36){var _0x1b1e8c=_0x2beb36['role']===_0x66bf('0x21')?_0x66bf('0x24'):_0x2beb36['role'];_0x4e840c[_0x1b1e8c]-=_0x2beb36[_0x66bf('0x20')];if(_0x4e840c[_0x1b1e8c]<0x0)_0x4e840c[_0x1b1e8c]=0x0;});_0x297111(_0x4e840c);return;});})[_0x66bf('0x25')](function(_0x2d45dd){_0x31e461(_0x2d45dd);});});}function checkUserLimits(_0x1437ac){return new BPromise(function(_0x121cc4,_0x35438d){getLimits()[_0x66bf('0x26')](function(_0x4f9da9){var _0x13a9f4=_[_0x66bf('0x27')](_['countBy'](_0x1437ac,_0x66bf('0x1d')),[_0x66bf('0x21'),_0x66bf('0x24'),_0x66bf('0x22')]);var _0x1f0843=(_0x13a9f4['admin']||0x0)+(_0x13a9f4['user']||0x0);var _0x2d3512=_0x13a9f4['telephone']||0x0;if(_0x1f0843>_0x4f9da9[_0x66bf('0x24')])return _0x35438d(_0x66bf('0x28'));if(_0x2d3512>_0x4f9da9[_0x66bf('0x22')])return _0x35438d(_0x66bf('0x29'));return _0x121cc4();})[_0x66bf('0x25')](function(_0x28ebe6){_0x35438d(_0x28ebe6);});});}module[_0x66bf('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0xaa89=['format','%s:%s:%s','parse','demo','uuid','machineUuid','decryptString','gray','deadline','add','days','grayReason','disabled','message','User','findAll','role','sequelize','COUNT','admin','telephone','users','telephones','forEach','user','count','catch','pick','countBy','License\x20limit\x20reached\x20for\x20users','exports','util','lodash','bluebird','./hardware','../../mysqldb','Demo\x20license','getUuid','2027-01-01T00:00:00.000Z','Breaking\x20license','License','find','defaults','then','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split'];(function(_0x549b29,_0x2e2b00){var _0x2b813f=function(_0x43234f){while(--_0x43234f){_0x549b29['push'](_0x549b29['shift']());}};_0x2b813f(++_0x2e2b00);}(_0xaa89,0x176));var _0x9aa8=function(_0x1762b4,_0x33d836){_0x1762b4=_0x1762b4-0x0;var _0x29beda=_0xaa89[_0x1762b4];return _0x29beda;};'use strict';var util=require(_0x9aa8('0x0'));var _=require(_0x9aa8('0x1'));var moment=require('moment');var BPromise=require(_0x9aa8('0x2'));var hardware=require(_0x9aa8('0x3'));var encryptor=require('../../components/encryptor');var db=require(_0x9aa8('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x9aa8('0x5'),'machineUuid':hardware[_0x9aa8('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x9aa8('0x7'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x9aa8('0x8'),'machineUuid':hardware[_0x9aa8('0x6')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x166adc){return new BPromise(function(_0xe6635a,_0x2b2fb8){return db[_0x9aa8('0x9')][_0x9aa8('0xa')](_[_0x9aa8('0xb')](_0x166adc,{'raw':!![],'where':{'id':0x1}}))[_0x9aa8('0xc')](function(_0xb6a563){return checkLicense(_0xb6a563,null);})[_0x9aa8('0xc')](function(_0x47a88a){_0xe6635a(_0x47a88a);return;})['catch'](function(_0x3f70ea){_0x2b2fb8(_0x3f70ea);});});}function checkLicense(_0x3739e7,_0x440235){if(!_0x3739e7){demoLicense['uuid']=_0x3739e7[_0x9aa8('0xd')];return demoLicense;}try{var _0x4a5dad=_0x440235||_0x3739e7[_0x9aa8('0xe')];if(_[_0x9aa8('0xf')](_0x4a5dad)){throw new Error(_0x9aa8('0x10'));}var _0x284033=_0x3739e7['data1'];var _0x4d6488=_0x3739e7['data2'];var _0x363c5a=_0x284033[_0x9aa8('0x11')]('-')[0x4];var _0x5f3472=_0x284033[_0x9aa8('0x11')]('-')[0x0];var _0x40610c=encryptor['decryptString'](_0x4a5dad,util[_0x9aa8('0x12')](_0x9aa8('0x13'),_0x363c5a,_0x284033,_0x5f3472));var _0x2db7ff=JSON[_0x9aa8('0x14')](_0x40610c);_0x2db7ff[_0x9aa8('0x15')]=![];_0x2db7ff[_0x9aa8('0x16')]=_0x284033;_0x2db7ff[_0x9aa8('0x17')]=hardware[_0x9aa8('0x6')]();if(_0x4d6488){var _0x832371=encryptor[_0x9aa8('0x18')](_0x4d6488);_0x2db7ff[_0x9aa8('0x19')]=_0x832371;_0x2db7ff[_0x9aa8('0x1a')]=moment(_0x832371)[_0x9aa8('0x1b')](0x7,_0x9aa8('0x1c'))[_0x9aa8('0x12')]();_0x2db7ff[_0x9aa8('0x1d')]=_0x2db7ff[_0x9aa8('0x16')]!=_0x2db7ff['machineUuid']?'changed':_0x9aa8('0x1e');}return _0x2db7ff;}catch(_0x38ed61){breakingLicense[_0x9aa8('0x16')]=_0x3739e7[_0x9aa8('0xd')];breakingLicense[_0x9aa8('0x1f')]=_0x38ed61[_0x9aa8('0x1f')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x72a9ac,_0x463711){getLicense()['then'](function(_0x252aa4){return db[_0x9aa8('0x20')][_0x9aa8('0x21')]({'attributes':[_0x9aa8('0x22'),[db[_0x9aa8('0x23')]['fn'](_0x9aa8('0x24'),db['sequelize']['col'](_0x9aa8('0x22'))),'count']],'group':_0x9aa8('0x22'),'where':{'role':{'$or':[_0x9aa8('0x25'),'user',_0x9aa8('0x26')]}},'raw':!![]})['then'](function(_0x51c631){var _0x1ca8b8={'user':_0x252aa4[_0x9aa8('0x27')]||0x0,'telephone':_0x252aa4[_0x9aa8('0x28')]||0x0};_0x51c631[_0x9aa8('0x29')](function(_0x18de3b){var _0x534cd7=_0x18de3b[_0x9aa8('0x22')]==='admin'?_0x9aa8('0x2a'):_0x18de3b[_0x9aa8('0x22')];_0x1ca8b8[_0x534cd7]-=_0x18de3b[_0x9aa8('0x2b')];if(_0x1ca8b8[_0x534cd7]<0x0)_0x1ca8b8[_0x534cd7]=0x0;});_0x72a9ac(_0x1ca8b8);return;});})[_0x9aa8('0x2c')](function(_0x3d943c){_0x463711(_0x3d943c);});});}function checkUserLimits(_0x3c048a){return new BPromise(function(_0x2e8a2d,_0x50755a){getLimits()['then'](function(_0x453ebc){var _0x3debca=_[_0x9aa8('0x2d')](_[_0x9aa8('0x2e')](_0x3c048a,_0x9aa8('0x22')),['admin',_0x9aa8('0x2a'),_0x9aa8('0x26')]);var _0x1def59=(_0x3debca[_0x9aa8('0x25')]||0x0)+(_0x3debca[_0x9aa8('0x2a')]||0x0);var _0x4c90ca=_0x3debca[_0x9aa8('0x26')]||0x0;if(_0x1def59>_0x453ebc['user'])return _0x50755a(_0x9aa8('0x2f'));if(_0x4c90ca>_0x453ebc[_0x9aa8('0x26')])return _0x50755a('License\x20limit\x20reached\x20for\x20telephones');return _0x2e8a2d();})[_0x9aa8('0x2c')](function(_0x10e8f9){_0x50755a(_0x10e8f9);});});}module[_0x9aa8('0x30')]={'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 72c5664..b22bb52 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 _0x7916=['myappanuglar-secret','app-id','exports'];(function(_0x347471,_0x1c9a02){var _0x422b6a=function(_0x2b6f88){while(--_0x2b6f88){_0x347471['push'](_0x347471['shift']());}};_0x422b6a(++_0x1c9a02);}(_0x7916,0x128));var _0x6791=function(_0x1825ca,_0x226c42){_0x1825ca=_0x1825ca-0x0;var _0x2b6413=_0x7916[_0x1825ca];return _0x2b6413;};'use strict';module[_0x6791('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x6791('0x1'),'GOOGLE_ID':_0x6791('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0xd4f4=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x25c283,_0x25d720){var _0x4705e0=function(_0x5cf2b3){while(--_0x5cf2b3){_0x25c283['push'](_0x25c283['shift']());}};_0x4705e0(++_0x25d720);}(_0xd4f4,0x8b));var _0x4d4f=function(_0x3834a8,_0x50d28c){_0x3834a8=_0x3834a8-0x0;var _0x3d4df3=_0xd4f4[_0x3834a8];return _0x3d4df3;};'use strict';module[_0x4d4f('0x0')]={'DOMAIN':_0x4d4f('0x1'),'SESSION_SECRET':_0x4d4f('0x2'),'GOOGLE_ID':_0x4d4f('0x3'),'GOOGLE_SECRET':_0x4d4f('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 2c30427..ba85d48 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb1b6=['exports','../utils/loggers'];(function(_0x42df8b,_0x358bcc){var _0x523cec=function(_0x1947e3){while(--_0x1947e3){_0x42df8b['push'](_0x42df8b['shift']());}};_0x523cec(++_0x358bcc);}(_0xb1b6,0x6d));var _0x6b1b=function(_0x217696,_0x3ee511){_0x217696=_0x217696-0x0;var _0x369747=_0xb1b6[_0x217696];return _0x369747;};'use strict';var fileLogger=require(_0x6b1b('0x0'))['fileLogger'];module[_0x6b1b('0x1')]=fileLogger; \ No newline at end of file +var _0xb6e2=['../utils/loggers','exports'];(function(_0x3d6aeb,_0xa62b5b){var _0x5b2452=function(_0x364ccc){while(--_0x364ccc){_0x3d6aeb['push'](_0x3d6aeb['shift']());}};_0x5b2452(++_0xa62b5b);}(_0xb6e2,0x19e));var _0x2b6e=function(_0x47795c,_0x5ca930){_0x47795c=_0x47795c-0x0;var _0x35b2a0=_0xb6e2[_0x47795c];return _0x35b2a0;};'use strict';var fileLogger=require(_0x2b6e('0x0'))['fileLogger'];module[_0x2b6e('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 33d910e..567dcc3 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 _0x6fe2=['../../services/email/index.js','../../services/routing/index.js','../../services/xdr/index.js','exports','path','resolve','join','legacy-libs','express','agi','../../services/agi/index.js','email'];(function(_0x2e08db,_0x2409df){var _0x1e0ce1=function(_0x5ac97c){while(--_0x5ac97c){_0x2e08db['push'](_0x2e08db['shift']());}};_0x1e0ce1(++_0x2409df);}(_0x6fe2,0x1a8));var _0x26fe=function(_0x8c930b,_0x1db75a){_0x8c930b=_0x8c930b-0x0;var _0x24c4bc=_0x6fe2[_0x8c930b];return _0x24c4bc;};'use strict';var path=require(_0x26fe('0x0'));var cfg=require('../../config/environment');var env={'NODE_PATH':path[_0x26fe('0x1')](path[_0x26fe('0x2')](cfg['root'],_0x26fe('0x3')))};var pm2config={'apps':[{'name':_0x26fe('0x4'),'script':path['join'](__dirname,'../../services/express/index.js'),'env':env},{'name':'ami','script':path[_0x26fe('0x2')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0x26fe('0x5'),'script':path[_0x26fe('0x2')](__dirname,_0x26fe('0x6')),'env':env},{'name':_0x26fe('0x7'),'script':path[_0x26fe('0x2')](__dirname,_0x26fe('0x8')),'env':env},{'name':'routing','script':path[_0x26fe('0x2')](__dirname,_0x26fe('0x9')),'env':env},{'name':'xdr','script':path[_0x26fe('0x2')](__dirname,_0x26fe('0xa')),'env':env}]};module[_0x26fe('0xb')]=pm2config; \ No newline at end of file +var _0x3419=['../../config/environment','resolve','join','root','express','../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','../../services/xdr/index.js','exports','path'];(function(_0x54909d,_0x174828){var _0x62f26b=function(_0x2412c4){while(--_0x2412c4){_0x54909d['push'](_0x54909d['shift']());}};_0x62f26b(++_0x174828);}(_0x3419,0x87));var _0x9341=function(_0xa3e0f7,_0x1b06db){_0xa3e0f7=_0xa3e0f7-0x0;var _0x4ce604=_0x3419[_0xa3e0f7];return _0x4ce604;};'use strict';var path=require(_0x9341('0x0'));var cfg=require(_0x9341('0x1'));var env={'NODE_PATH':path[_0x9341('0x2')](path[_0x9341('0x3')](cfg[_0x9341('0x4')],'legacy-libs'))};var pm2config={'apps':[{'name':_0x9341('0x5'),'script':path[_0x9341('0x3')](__dirname,_0x9341('0x6')),'env':env},{'name':_0x9341('0x7'),'script':path[_0x9341('0x3')](__dirname,_0x9341('0x8')),'env':env},{'name':_0x9341('0x9'),'script':path[_0x9341('0x3')](__dirname,_0x9341('0xa')),'env':env},{'name':_0x9341('0xb'),'script':path[_0x9341('0x3')](__dirname,_0x9341('0xc')),'env':env},{'name':_0x9341('0xd'),'script':path[_0x9341('0x3')](__dirname,_0x9341('0xe')),'env':env},{'name':'xdr','script':path[_0x9341('0x3')](__dirname,_0x9341('0xf')),'env':env}]};module[_0x9341('0x10')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index b6b46d3..f5c2224 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 _0x6a43=['restart','list','describe','delete','dump','pm2','./config','connect','start','then','disconnect','stop'];(function(_0x49d610,_0x3b14e2){var _0x4c6a73=function(_0x2f3215){while(--_0x2f3215){_0x49d610['push'](_0x49d610['shift']());}};_0x4c6a73(++_0x3b14e2);}(_0x6a43,0x19d));var _0x36a4=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0x6a43[_0xf50820];return _0x2a9b10;};'use strict';var pm2=require(_0x36a4('0x0'));var BPromise=require('bluebird');var config=require(_0x36a4('0x1'));function connect(){return new BPromise(function(_0x42eaf7,_0x4501da){return pm2[_0x36a4('0x2')](function(_0x1bd844){if(_0x1bd844){return _0x4501da(_0x1bd844);}return _0x42eaf7('connected');});});};exports[_0x36a4('0x3')]=function(_0x32d197){return connect()[_0x36a4('0x4')](function(){return new BPromise(function(_0xa87d6,_0x1f8025){return pm2[_0x36a4('0x3')](_0x32d197,function(_0xcadf01,_0xeacdbb){if(_0xcadf01){return _0x1f8025(_0xcadf01);}pm2[_0x36a4('0x5')]();return _0xa87d6(_0xeacdbb);});});});};exports[_0x36a4('0x6')]=function(_0x2cf13d){return connect()['then'](function(){return new BPromise(function(_0x1a6fb6,_0x1cf41b){return pm2[_0x36a4('0x6')](_0x2cf13d,function(_0x333e41,_0x3e51f6){if(_0x333e41){return _0x1cf41b(_0x333e41);}pm2[_0x36a4('0x5')]();return _0x1a6fb6(_0x3e51f6);});});});};exports[_0x36a4('0x7')]=function(_0x17bbc5){return connect()[_0x36a4('0x4')](function(){return new BPromise(function(_0x3c1d0f,_0x257e1a){return pm2[_0x36a4('0x7')](_0x17bbc5,function(_0x31c62c,_0x1791b8){if(_0x31c62c){return _0x257e1a(_0x31c62c);}pm2[_0x36a4('0x5')]();return _0x3c1d0f(_0x1791b8);});});});};exports[_0x36a4('0x8')]=function(){return connect()[_0x36a4('0x4')](function(){return new BPromise(function(_0x4f0a39,_0xfee391){return pm2[_0x36a4('0x8')](function(_0x5be769,_0x3101fd){if(_0x5be769){return _0xfee391(_0x5be769);}pm2[_0x36a4('0x5')]();return _0x4f0a39(_0x3101fd);});});});};exports[_0x36a4('0x9')]=function(_0x4c2773){return connect()[_0x36a4('0x4')](function(){return new BPromise(function(_0x2eb376,_0x51307b){return pm2['describe'](_0x4c2773,function(_0x2482c8,_0x35e8bf){if(_0x2482c8){return _0x51307b(_0x2482c8);}pm2['disconnect']();return _0x2eb376(_0x35e8bf);});});});};exports['delete']=function(_0x49636a){return connect()[_0x36a4('0x4')](function(){return new BPromise(function(_0x52147e,_0x57316e){return pm2[_0x36a4('0xa')](_0x49636a,function(_0xe5684a,_0xdb8e3c){if(_0xe5684a){return _0x57316e(_0xe5684a);}pm2[_0x36a4('0x5')]();return _0x52147e(_0xdb8e3c);});});});};exports[_0x36a4('0xb')]=function(){return connect()[_0x36a4('0x4')](function(){return new BPromise(function(_0x20472e,_0x3020b5){return pm2['dump'](function(_0x2ec587){if(_0x2ec587){return _0x3020b5(_0x2ec587);}return _0x20472e('saved');});});});}; \ No newline at end of file +var _0x47bb=['./config','connect','connected','start','disconnect','stop','then','restart','list','describe','delete','dump','pm2','bluebird'];(function(_0x3667c4,_0x4b64bd){var _0x12a5a2=function(_0x1fb407){while(--_0x1fb407){_0x3667c4['push'](_0x3667c4['shift']());}};_0x12a5a2(++_0x4b64bd);}(_0x47bb,0xec));var _0xb47b=function(_0x5b3950,_0x4e5556){_0x5b3950=_0x5b3950-0x0;var _0x41e436=_0x47bb[_0x5b3950];return _0x41e436;};'use strict';var pm2=require(_0xb47b('0x0'));var BPromise=require(_0xb47b('0x1'));var config=require(_0xb47b('0x2'));function connect(){return new BPromise(function(_0x2b434f,_0x38976f){return pm2[_0xb47b('0x3')](function(_0x3e6897){if(_0x3e6897){return _0x38976f(_0x3e6897);}return _0x2b434f(_0xb47b('0x4'));});});};exports[_0xb47b('0x5')]=function(_0x53032b){return connect()['then'](function(){return new BPromise(function(_0x3cb73d,_0x3ddfe3){return pm2[_0xb47b('0x5')](_0x53032b,function(_0x3928a2,_0x4cb974){if(_0x3928a2){return _0x3ddfe3(_0x3928a2);}pm2[_0xb47b('0x6')]();return _0x3cb73d(_0x4cb974);});});});};exports[_0xb47b('0x7')]=function(_0x401fa3){return connect()[_0xb47b('0x8')](function(){return new BPromise(function(_0x4b31c1,_0x1fcb12){return pm2[_0xb47b('0x7')](_0x401fa3,function(_0x3484f8,_0x166d5a){if(_0x3484f8){return _0x1fcb12(_0x3484f8);}pm2[_0xb47b('0x6')]();return _0x4b31c1(_0x166d5a);});});});};exports[_0xb47b('0x9')]=function(_0xdf2d2e){return connect()['then'](function(){return new BPromise(function(_0x20d6cc,_0xc66583){return pm2[_0xb47b('0x9')](_0xdf2d2e,function(_0xb6b75,_0x4ce8e7){if(_0xb6b75){return _0xc66583(_0xb6b75);}pm2[_0xb47b('0x6')]();return _0x20d6cc(_0x4ce8e7);});});});};exports[_0xb47b('0xa')]=function(){return connect()[_0xb47b('0x8')](function(){return new BPromise(function(_0x2fe50d,_0x285b99){return pm2[_0xb47b('0xa')](function(_0x258b94,_0x392ffc){if(_0x258b94){return _0x285b99(_0x258b94);}pm2[_0xb47b('0x6')]();return _0x2fe50d(_0x392ffc);});});});};exports[_0xb47b('0xb')]=function(_0x298125){return connect()[_0xb47b('0x8')](function(){return new BPromise(function(_0x466be3,_0x12e7c1){return pm2[_0xb47b('0xb')](_0x298125,function(_0x1298b2,_0x24cb9f){if(_0x1298b2){return _0x12e7c1(_0x1298b2);}pm2[_0xb47b('0x6')]();return _0x466be3(_0x24cb9f);});});});};exports['delete']=function(_0x5e5987){return connect()[_0xb47b('0x8')](function(){return new BPromise(function(_0x1aab27,_0x5c5baf){return pm2[_0xb47b('0xc')](_0x5e5987,function(_0x1a92f6,_0x351361){if(_0x1a92f6){return _0x5c5baf(_0x1a92f6);}pm2[_0xb47b('0x6')]();return _0x1aab27(_0x351361);});});});};exports[_0xb47b('0xd')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3828b8,_0x5f0829){return pm2[_0xb47b('0xd')](function(_0x215e6e){if(_0x215e6e){return _0x5f0829(_0x215e6e);}return _0x3828b8('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 41a67c0..260972e 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 _0xa37b=['moment','ioredis','../logger','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','start','lodash'];(function(_0x2a3bf8,_0x4fbd0c){var _0x34b2ca=function(_0x694fb5){while(--_0x694fb5){_0x2a3bf8['push'](_0x2a3bf8['shift']());}};_0x34b2ca(++_0x4fbd0c);}(_0xa37b,0x16a));var _0xba37=function(_0x3fafb9,_0x5d6612){_0x3fafb9=_0x3fafb9-0x0;var _0xada4d4=_0xa37b[_0x3fafb9];return _0xada4d4;};'use strict';var _=require(_0xba37('0x0'));var moment=require(_0xba37('0x1'));var Redis=require(_0xba37('0x2'));var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xba37('0x3'))(_0xba37('0x4'));config[_0xba37('0x5')]=_[_0xba37('0x6')](config[_0xba37('0x5')],{'host':_0xba37('0x7'),'port':0x18eb});var io=require(_0xba37('0x8'))(new Redis(config[_0xba37('0x5')]));function closeInteractions(){var _0x48315b=0x0;var _0x5d553a=[];return db[_0xba37('0x9')][_0xba37('0xa')]({'raw':!![],'attributes':['id',_0xba37('0xb')],'where':{'id':0x1}})[_0xba37('0xc')](function(_0x70d59e){_0x48315b=_0x70d59e[_0xba37('0xb')];if(_0x48315b){return db['ChatInteraction'][_0xba37('0xd')]({'raw':!![],'attributes':['id',_0xba37('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xba37('0xf')](_0x70d59e[_0xba37('0xb')],_0xba37('0x10'))}}});}else{return[];}})[_0xba37('0xc')](function(_0x409707){if(_0x409707&&_0x409707[_0xba37('0x11')]){_0x5d553a=_['map'](_0x409707||[],'id');logger[_0xba37('0x12')](_0xba37('0x13'),_0x5d553a['join']());return db[_0xba37('0x14')][_0xba37('0x15')]({'closeReason':_0xba37('0x16'),'disposition':_0xba37('0x17'),'closed':!![],'closedAt':moment()[_0xba37('0x18')](_0xba37('0x19'))},{'where':{'id':_0x5d553a}});}})['then'](function(){if(_0x5d553a&&_0x5d553a[_0xba37('0x11')]){logger[_0xba37('0x12')](_0xba37('0x1a'),_0x5d553a['join']());for(var _0x5df616=0x0;_0x5df616<_0x5d553a['length'];_0x5df616++){io[_0xba37('0x1b')](_0xba37('0x1c'),{'id':_0x5d553a[_0x5df616],'closed':!![]});}}})[_0xba37('0x1d')](function(_0x44ee71){logger[_0xba37('0x1e')](_0xba37('0x1f'),_0x44ee71?util['inspect'](_0x44ee71,{'showHidden':![],'depth':null}):'');});}exports[_0xba37('0x20')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x8198=['inspect','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','defaults','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','findAll','lastMsgAt','subtract','minutes','length','[CHAT]\x20Interactions\x20to\x20close:','join','update','system','timeout','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','catch','[CHAT]\x20Error\x20closing\x20interactions'];(function(_0x3537e1,_0x337645){var _0x343700=function(_0x560aaa){while(--_0x560aaa){_0x3537e1['push'](_0x3537e1['shift']());}};_0x343700(++_0x337645);}(_0x8198,0x12d));var _0x8819=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0x8198[_0xf0bcac];return _0x4e4c65;};'use strict';var _=require('lodash');var moment=require(_0x8819('0x0'));var Redis=require(_0x8819('0x1'));var util=require(_0x8819('0x2'));var config=require(_0x8819('0x3'));var db=require(_0x8819('0x4'))['db'];var logger=require('../logger')(_0x8819('0x5'));config[_0x8819('0x6')]=_[_0x8819('0x7')](config[_0x8819('0x6')],{'host':_0x8819('0x8'),'port':0x18eb});var io=require(_0x8819('0x9'))(new Redis(config[_0x8819('0x6')]));function closeInteractions(){var _0x1dc971=0x0;var _0x1f73e3=[];return db[_0x8819('0xa')][_0x8819('0xb')]({'raw':!![],'attributes':['id',_0x8819('0xc')],'where':{'id':0x1}})[_0x8819('0xd')](function(_0x5bf2e2){_0x1dc971=_0x5bf2e2[_0x8819('0xc')];if(_0x1dc971){return db[_0x8819('0xe')][_0x8819('0xf')]({'raw':!![],'attributes':['id',_0x8819('0x10')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0x8819('0x11')](_0x5bf2e2['chatTimeout'],_0x8819('0x12'))}}});}else{return[];}})[_0x8819('0xd')](function(_0x903c67){if(_0x903c67&&_0x903c67[_0x8819('0x13')]){_0x1f73e3=_['map'](_0x903c67||[],'id');logger['info'](_0x8819('0x14'),_0x1f73e3[_0x8819('0x15')]());return db[_0x8819('0xe')][_0x8819('0x16')]({'closeReason':_0x8819('0x17'),'disposition':_0x8819('0x18'),'closed':!![],'closedAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x1f73e3}});}})['then'](function(){if(_0x1f73e3&&_0x1f73e3[_0x8819('0x13')]){logger['info'](_0x8819('0x19'),_0x1f73e3['join']());for(var _0x10cdd9=0x0;_0x10cdd9<_0x1f73e3[_0x8819('0x13')];_0x10cdd9++){io[_0x8819('0x1a')]('chatInteraction:update',{'id':_0x1f73e3[_0x10cdd9],'closed':!![]});}}})[_0x8819('0x1b')](function(_0x52ca0c){logger['error'](_0x8819('0x1c'),_0x52ca0c?util[_0x8819('0x1d')](_0x52ca0c,{'showHidden':![],'depth':null}):'');});}exports['start']=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 220da8c..ee6c685 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 _0x8f4e=['startAllRefreshIntervals'];(function(_0x284d70,_0x4e5330){var _0x5a40f8=function(_0x5507e7){while(--_0x5507e7){_0x284d70['push'](_0x284d70['shift']());}};_0x5a40f8(++_0x4e5330);}(_0x8f4e,0x19f));var _0xe8f4=function(_0x545fb0,_0x17c087){_0x545fb0=_0x545fb0-0x0;var _0x355463=_0x8f4e[_0x545fb0];return _0x355463;};'use strict';function start(){var _0x4f6a20=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x4f6a20[_0xe8f4('0x0')]();}module['exports']={'intervals':{},'start':start}; \ No newline at end of file +var _0x6c4f=['startAllRefreshIntervals','exports'];(function(_0x520193,_0x3d8fdc){var _0x4d9d39=function(_0x233049){while(--_0x233049){_0x520193['push'](_0x520193['shift']());}};_0x4d9d39(++_0x3d8fdc);}(_0x6c4f,0x144));var _0xf6c4=function(_0x4ca88a,_0x399c51){_0x4ca88a=_0x4ca88a-0x0;var _0x489f3a=_0x6c4f[_0x4ca88a];return _0x489f3a;};'use strict';function start(){var _0x16df1a=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x16df1a[_0xf6c4('0x0')]();}module[_0xf6c4('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 f46075c..98d21bd 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 _0x871a=['path','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','retry','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','findOne','error','info','email','getSmtpOptions','format','\x22%s\x22\x20<%s>','MailAccount','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','name','join','../../files/reports','savename','%s.%s','extname','existsSync','status','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','stringify','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','catch','error\x20mail','case\x20loading','currentAttempt','retryOptions','retries','job','data','operation','stop','still\x20loading','case\x20completed','case\x20empty','case\x20failed','Unrecognized\x20status:','attempt','Job\x20ID\x20','dataValues','isNil','subtractNumber','subtractUnit\x20null\x20or\x20undefined','subtract','subtractUnit','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','CloudProvider','keys','jobs','map','keyBy','toString','difference','intersection','length','delete\x20cron','toRun','run\x20job','active','isBetween','startAt','endAt','add','cron','add\x20cron','exists','deleteJob','stop\x20cron','update','update\x20cron','run','start','util'];(function(_0x32745c,_0x24984a){var _0x45cb9d=function(_0xdf6de5){while(--_0xdf6de5){_0x32745c['push'](_0x32745c['shift']());}};_0x45cb9d(++_0x24984a);}(_0x871a,0xdb));var _0xa871=function(_0x197837,_0x439ae2){_0x197837=_0x197837-0x0;var _0x3eed5f=_0x871a[_0x197837];return _0x3eed5f;};'use strict';var fs=require('fs');var util=require(_0xa871('0x0'));var path=require(_0xa871('0x1'));var _=require('lodash');var moment=require('moment');var CronJobManager=require(_0xa871('0x2'));var jayson=require('jayson/promise');var BPromise=require(_0xa871('0x3'));var logger=require(_0xa871('0x4'))(_0xa871('0x5'));var db=require(_0xa871('0x6'))['db'];const retry=require(_0xa871('0x7'));var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xa871('0x8'));var client=jayson[_0xa871('0x9')][_0xa871('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0xa38209){const _0x2fa2ec={};if(typeof _0xa38209===_0xa871('0xb')){_0x2fa2ec['id']=_0xa38209;}return db[_0xa871('0xc')][_0xa871('0xd')]({'where':_0x2fa2ec})['then'](function(_0x2e2c08){return _0x2e2c08;})['catch'](function(_0x2701b9){logger[_0xa871('0xe')](_0x2701b9);});}function handleSendEmail(_0x310de9,_0x3a6952){logger[_0xa871('0xf')]('Try\x20to\x20send\x20a\x20mail\x20to',_0x310de9[_0xa871('0x10')]);var _0x270766=!![];var _0x37408f=_0x310de9['MailAccount'][_0xa871('0x11')]();var _0xeb40f3={'account':_0x37408f,'message':{'from':util[_0xa871('0x12')](_0xa871('0x13'),_0x310de9[_0xa871('0x14')]['name'],_0x310de9['MailAccount'][_0xa871('0x10')]||_0x310de9[_0xa871('0x14')][_0xa871('0x15')][_0xa871('0x16')]),'to':_0x310de9[_0xa871('0x10')],'cc':_0x310de9['cc'],'bcc':_0x310de9[_0xa871('0x17')],'subject':util['format'](_0xa871('0x18'),_0x3a6952[_0xa871('0x19')],_0x310de9['subtractNumber'],_0x310de9['subtractUnit'])}};var _0xa663c6=path[_0xa871('0x1a')](__dirname,_0xa871('0x1b'));var _0x1c8db8=_0x3a6952[_0xa871('0x1c')];var _0x4f107d=util[_0xa871('0x12')](_0xa871('0x1d'),path['basename'](_0x3a6952[_0xa871('0x1c')],path[_0xa871('0x1e')](_0x3a6952['savename'])),'zip');var _0x46756b=path[_0xa871('0x1a')](_0xa663c6,_0x1c8db8);var _0x440606=path['join'](_0xa663c6,_0x4f107d);if(fs[_0xa871('0x1f')](_0x46756b)){_0x3a6952[_0xa871('0x20')]=_0xa871('0x21');_0xeb40f3[_0xa871('0x22')][_0xa871('0x23')]=[{'filename':_0x1c8db8,'path':_0x46756b}];_0xeb40f3[_0xa871('0x22')][_0xa871('0x24')]=util['format'](_0xa871('0x25'),JSON[_0xa871('0x26')](_0x3a6952,null,0x2));}else if(fs['existsSync'](_0x440606)){_0x3a6952[_0xa871('0x20')]=_0xa871('0x21');_0xeb40f3[_0xa871('0x22')]['attachments']=[{'filename':_0x4f107d,'path':_0x440606}];}else{if(_0x3a6952[_0xa871('0x20')]==='Empty'){_0xeb40f3[_0xa871('0x22')][_0xa871('0x24')]=_0xa871('0x27');if(!_0x310de9[_0xa871('0x28')]){_0x270766=![];logger[_0xa871('0xf')](_0xa871('0x29'));}}else if(_0x3a6952[_0xa871('0x20')]===_0xa871('0x2a')){_0xeb40f3[_0xa871('0x22')][_0xa871('0x24')]=_0xa871('0x2b');}else if(_0x3a6952[_0xa871('0x20')]===_0xa871('0x2c')){_0xeb40f3[_0xa871('0x22')][_0xa871('0x24')]='Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';}else if(_0x3a6952[_0xa871('0x20')]===_0xa871('0x2d')){_0xeb40f3[_0xa871('0x22')][_0xa871('0x24')]=_0xa871('0x2e');}else{logger[_0xa871('0xe')](_0xa871('0x2f'),_0x3a6952[_0xa871('0x20')]);}}if(_0x270766){return client[_0xa871('0x30')](_0xa871('0x31'),_0xeb40f3)['then'](function(_0xcde725){if(_0xcde725[_0xa871('0xe')]){return logger['error']('error\x20mail',JSON['stringify'](_0xcde725));}return logger[_0xa871('0xf')]('email\x20sent');})[_0xa871('0x32')](function(_0xa5e46f){return logger[_0xa871('0xe')](_0xa871('0x33'),JSON['stringify'](_0xa5e46f));});}}function handleError(){return function(_0x5b363e){return logger[_0xa871('0xe')](JSON[_0xa871('0x26')](_0x5b363e));};}function loading(_0x4e450c){logger[_0xa871('0xf')](_0xa871('0x34'));if(_0x4e450c[_0xa871('0x35')]===_0x4e450c[_0xa871('0x36')][_0xa871('0x37')]){handleSendEmail(_0x4e450c[_0xa871('0x38')],_0x4e450c[_0xa871('0x39')]);_0x4e450c[_0xa871('0x3a')][_0xa871('0x3b')]();}else{_0x4e450c['operation']['retry'](_0xa871('0x3c'));}}function completed(_0x26c5af){logger[_0xa871('0xf')](_0xa871('0x3d'));handleSendEmail(_0x26c5af['job'],_0x26c5af[_0xa871('0x39')]);_0x26c5af['operation'][_0xa871('0x3b')]();}function empty(_0x3d1128){logger[_0xa871('0xf')](_0xa871('0x3e'));handleSendEmail(_0x3d1128[_0xa871('0x38')],_0x3d1128[_0xa871('0x39')]);_0x3d1128[_0xa871('0x3a')]['stop']();}function failed(_0x20e0fa){logger[_0xa871('0xf')](_0xa871('0x3f'));handleSendEmail(_0x20e0fa[_0xa871('0x38')],_0x20e0fa[_0xa871('0x39')]);_0x20e0fa[_0xa871('0x3a')]['stop']();}function urecognized(_0x49d58f){logger[_0xa871('0xe')](_0xa871('0x40'),_0x49d58f['entity']['dataValues'][_0xa871('0x20')]);_0x49d58f[_0xa871('0x3a')][_0xa871('0x3b')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x55b2ce,_0x4e1b0c){const _0x411c3d={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x56b8c6=retry[_0xa871('0x3a')](_0x411c3d);_0x56b8c6[_0xa871('0x41')](_0xf7157f=>{logger[_0xa871('0xf')](_0xa871('0x42')+_0x55b2ce['id']+'\x20Attempt\x20#:'+_0xf7157f);try{getReportData(_0x4e1b0c['id'])['then'](function(_0x267cd8){_0x4e1b0c=_0x267cd8;logger[_0xa871('0xf')]('report\x20status:',_0x267cd8[_0xa871('0x43')][_0xa871('0x20')]);if(!reportStatusStrategies[_0x267cd8[_0xa871('0x43')][_0xa871('0x20')]]){logger[_0xa871('0xe')]('report\x20status:',_0x267cd8[_0xa871('0x43')][_0xa871('0x20')]);_0x56b8c6[_0xa871('0x7')]();}reportStatusStrategies[_0x267cd8[_0xa871('0x43')]['status']]({'operation':_0x56b8c6,'currentAttempt':_0xf7157f,'retryOptions':_0x411c3d,'job':_0x55b2ce,'data':_0x4e1b0c,'entity':_0x267cd8});});}catch(_0x1c3aaa){_0x56b8c6[_0xa871('0x7')](_0x1c3aaa);}});}function handleResult(_0x558c4c){return function(_0x3772bd){if(_0x558c4c['sendMail']&&_0x558c4c[_0xa871('0x14')]&&_0x558c4c['MailAccount'][_0xa871('0x15')]&&!_[_0xa871('0x44')](_0x558c4c[_0xa871('0x10')])){retryer(_0x558c4c,_0x3772bd);}};}function handleJob(_0x43f895){return function(){try{if(_['isNil'](_0x43f895[_0xa871('0x45')])){return logger[_0xa871('0xf')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xa871('0x44')](_0x43f895['subtractUnit'])){return logger[_0xa871('0xf')](_0xa871('0x46'));}var _0x4e1274={'startDate':moment()[_0xa871('0x47')](_0x43f895['subtractNumber'],_0x43f895[_0xa871('0x48')])['format']('YYYY-MM-DD\x20HH:mm:ss'),'endDate':moment()[_0xa871('0x12')](_0xa871('0x49')),'type':_0xa871('0x4a'),'output':_0x43f895[_0xa871('0x4b')],'name':_0x43f895[_0xa871('0x19')]};if(!_[_0xa871('0x44')](_0x43f895[_0xa871('0x4c')])){logger[_0xa871('0xf')]('exec\x20defaul\x20report\x20id:%s',_0x43f895[_0xa871('0x4c')]);return analyticDefaultReportController[_0xa871('0x4d')]({'id':_0x43f895[_0xa871('0x4c')]},_0x4e1274)[_0xa871('0x4e')](handleResult(_0x43f895))[_0xa871('0x32')](handleError());}if(!_[_0xa871('0x44')](_0x43f895['CustomReportId'])){logger[_0xa871('0xf')](_0xa871('0x4f'),_0x43f895[_0xa871('0x50')]);return analyticCustomReportController['runReport']({'id':_0x43f895[_0xa871('0x50')]},_0x4e1274)[_0xa871('0x4e')](handleResult(_0x43f895))[_0xa871('0x32')](handleError());}}catch(_0x3fa9c6){logger[_0xa871('0xe')](JSON[_0xa871('0x26')](_0x3fa9c6));}return logger[_0xa871('0xf')](_0xa871('0x51'));};}function getJobs(_0x1e38ba){var _0x5ee9fb={};if(_0x1e38ba){_0x5ee9fb['id']=_0x1e38ba;}return db[_0xa871('0x52')][_0xa871('0x53')]({'where':_0x5ee9fb,'include':[{'model':db[_0xa871('0x14')],'attributes':['id',_0xa871('0x19'),_0xa871('0x10')],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db['CloudProvider'],'as':_0xa871('0x54')}]}]}]})[_0xa871('0x4e')](function(_0xe62219){var _0x17e2a3=_[_0xa871('0x55')](manager[_0xa871('0x56')]);var _0x57c587=_[_0xa871('0x57')](_0xe62219,function(_0x46f3e6){return _0x46f3e6['id']['toString']();});var _0x1ed617=_[_0xa871('0x58')](_0xe62219,function(_0x35f38d){return _0x35f38d['id'][_0xa871('0x59')]();});var _0x374360=_0x1e38ba?_0x57c587:_[_0xa871('0x5a')](_0x57c587,_0x17e2a3);var _0x47bf28=_[_0xa871('0x5b')](_0x57c587,_0x17e2a3);var _0xf7c8=_[_0xa871('0x5a')](_0x17e2a3,_0x57c587);var _0x584efb;var _0x19a0da;for(_0x584efb=0x0;_0x584efb<_0xf7c8[_0xa871('0x5c')]&&!_0x1e38ba;_0x584efb+=0x1){_0x19a0da=_0xf7c8[_0x584efb][_0xa871('0x59')]();if(manager['exists'](_0x19a0da)){manager[_0xa871('0x3b')](_0x19a0da);manager['deleteJob'](_0x19a0da);logger[_0xa871('0xf')](_0xa871('0x5d'),_0x19a0da);}}logger['info'](_0xa871('0x5e'),JSON[_0xa871('0x26')](_0x374360));for(_0x584efb=0x0;_0x584efb<_0x374360[_0xa871('0x5c')];_0x584efb+=0x1){_0x19a0da=_0x374360[_0x584efb][_0xa871('0x59')]();if(_0x1e38ba){logger[_0xa871('0xf')](JSON[_0xa871('0x26')](_0x1ed617[_0x19a0da]));BPromise['resolve']()[_0xa871('0x4e')](handleJob(_0x1ed617[_0x19a0da]));logger[_0xa871('0xf')](_0xa871('0x5f'),_0x1ed617[_0x19a0da][_0xa871('0x19')],_0x1ed617[_0x19a0da]['cron']);}else if(_0x1ed617[_0x19a0da]['cron']&&_0x1ed617[_0x19a0da][_0xa871('0x60')]&&moment()[_0xa871('0x61')](_0x1ed617[_0x19a0da][_0xa871('0x62')],_0x1ed617[_0x19a0da][_0xa871('0x63')])){manager[_0xa871('0x64')](_0x19a0da,_0x1ed617[_0x19a0da][_0xa871('0x65')],handleJob(_0x1ed617[_0x19a0da]));manager['start'](_0x19a0da);logger['info'](_0xa871('0x66'),_0x1ed617[_0x19a0da][_0xa871('0x19')],_0x1ed617[_0x19a0da][_0xa871('0x65')]);}else if(manager[_0xa871('0x67')](_0x19a0da)){manager[_0xa871('0x3b')](_0x19a0da);manager[_0xa871('0x68')](_0x19a0da);logger[_0xa871('0xf')](_0xa871('0x69'),_0x1ed617[_0x19a0da][_0xa871('0x19')],_0x1ed617[_0x19a0da][_0xa871('0x65')]);}}for(_0x584efb=0x0,_0x19a0da;_0x584efb<_0x47bf28[_0xa871('0x5c')]&&!_0x1e38ba;_0x584efb+=0x1){_0x19a0da=_0x47bf28[_0x584efb][_0xa871('0x59')]();if(manager['exists'](_0x19a0da)){if(_0x1ed617[_0x19a0da][_0xa871('0x65')]&&_0x1ed617[_0x19a0da][_0xa871('0x60')]&&moment()['isBetween'](_0x1ed617[_0x19a0da][_0xa871('0x62')],_0x1ed617[_0x19a0da][_0xa871('0x63')])){manager[_0xa871('0x6a')](_0x19a0da,_0x1ed617[_0x19a0da][_0xa871('0x65')],handleJob(_0x1ed617[_0x19a0da]));logger['info'](_0xa871('0x6b'),_0x1ed617[_0x19a0da][_0xa871('0x19')],_0x1ed617[_0x19a0da][_0xa871('0x65')]);}else{manager['stop'](_0x19a0da);manager[_0xa871('0x68')](_0x19a0da);logger[_0xa871('0xf')](_0xa871('0x69'),_0x1ed617[_0x19a0da][_0xa871('0x19')],_0x1ed617[_0x19a0da][_0xa871('0x65')]);}}}})[_0xa871('0x32')](function(_0x1c2863){logger[_0xa871('0xe')](JSON['stringify'](_0x1c2863));});}exports[_0xa871('0x6c')]=function(_0x74e04){return getJobs(_0x74e04);};exports[_0xa871('0x6d')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xa938=['intersection','length','exists','deleteJob','delete\x20cron','resolve','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','update\x20cron','start','path','moment','cron-job-manager','jayson/promise','../logger','../../mysqldb','retry','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','number','AnalyticExtractedReport','findOne','then','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','getSmtpOptions','\x22%s\x22\x20<%s>','name','email','bcc','subtractNumber','subtractUnit','join','../../files/reports','format','%s.%s','savename','extname','zip','status','Sent','message','text','stringify','existsSync','attachments','Empty','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','Loading','Report\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Completed','Report\x20file\x20creation\x20still\x20running\x20after\x20timeout.\x0aYou\x20can\x20find\x20the\x20report\x20when\x20it\x20will\x20be\x20completed\x20in\x20Analytics\x20->\x20Extracted\x20Reports.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','Failed','Report\x20extraction\x20procedure\x20has\x20run\x20into\x20an\x20unexpected\x20error.\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','error','[handleSendEmail]\x20Unrecognized\x20status:','request','SendMail','error\x20mail','email\x20sent','catch','currentAttempt','retryOptions','retries','operation','stop','still\x20loading','job','data','case\x20failed','Unrecognized\x20status:','attempt','dataValues','sendMail','Smtp','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','runReport','CustomReportId','Schedule','findAll','CloudProvider','keys','keyBy','toString','difference'];(function(_0x170125,_0x48efd0){var _0x418002=function(_0x29f624){while(--_0x29f624){_0x170125['push'](_0x170125['shift']());}};_0x418002(++_0x48efd0);}(_0xa938,0xe0));var _0x8a93=function(_0x232bdc,_0x2169b3){_0x232bdc=_0x232bdc-0x0;var _0x1437e5=_0xa938[_0x232bdc];return _0x1437e5;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x8a93('0x0'));var _=require('lodash');var moment=require(_0x8a93('0x1'));var CronJobManager=require(_0x8a93('0x2'));var jayson=require(_0x8a93('0x3'));var BPromise=require('bluebird');var logger=require(_0x8a93('0x4'))('schedule');var db=require(_0x8a93('0x5'))['db'];const retry=require(_0x8a93('0x6'));var analyticCustomReportController=require(_0x8a93('0x7'));var analyticDefaultReportController=require(_0x8a93('0x8'));var client=jayson[_0x8a93('0x9')][_0x8a93('0xa')]({'port':0x232b});var manager=new CronJobManager();function getReportData(_0x2d1868){const _0x34265c={};if(typeof _0x2d1868===_0x8a93('0xb')){_0x34265c['id']=_0x2d1868;}return db[_0x8a93('0xc')][_0x8a93('0xd')]({'where':_0x34265c})[_0x8a93('0xe')](function(_0x19ba0f){return _0x19ba0f;})['catch'](function(_0x3b40b0){logger['error'](_0x3b40b0);});}function handleSendEmail(_0x2c4cfd,_0x3da158){logger[_0x8a93('0xf')](_0x8a93('0x10'),_0x2c4cfd['email']);var _0x247039=!![];var _0x125ad7=_0x2c4cfd[_0x8a93('0x11')][_0x8a93('0x12')]();var _0x5e1b22={'account':_0x125ad7,'message':{'from':util['format'](_0x8a93('0x13'),_0x2c4cfd['MailAccount'][_0x8a93('0x14')],_0x2c4cfd['MailAccount'][_0x8a93('0x15')]||_0x2c4cfd[_0x8a93('0x11')]['Smtp']['user']),'to':_0x2c4cfd[_0x8a93('0x15')],'cc':_0x2c4cfd['cc'],'bcc':_0x2c4cfd[_0x8a93('0x16')],'subject':util['format']('Report\x20%s\x20last\x20%s\x20%s',_0x3da158['name'],_0x2c4cfd[_0x8a93('0x17')],_0x2c4cfd[_0x8a93('0x18')])}};var _0x271d3b=path[_0x8a93('0x19')](__dirname,_0x8a93('0x1a'));var _0x3f86e3=_0x3da158['savename'];var _0x1cb1c7=util[_0x8a93('0x1b')](_0x8a93('0x1c'),path['basename'](_0x3da158[_0x8a93('0x1d')],path[_0x8a93('0x1e')](_0x3da158['savename'])),_0x8a93('0x1f'));var _0x5ec8e2=path[_0x8a93('0x19')](_0x271d3b,_0x3f86e3);var _0x34721a=path['join'](_0x271d3b,_0x1cb1c7);if(fs['existsSync'](_0x5ec8e2)){_0x3da158[_0x8a93('0x20')]=_0x8a93('0x21');_0x5e1b22[_0x8a93('0x22')]['attachments']=[{'filename':_0x3f86e3,'path':_0x5ec8e2}];_0x5e1b22['message'][_0x8a93('0x23')]=util[_0x8a93('0x1b')]('Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a',JSON[_0x8a93('0x24')](_0x3da158,null,0x2));}else if(fs[_0x8a93('0x25')](_0x34721a)){_0x3da158['status']=_0x8a93('0x21');_0x5e1b22['message'][_0x8a93('0x26')]=[{'filename':_0x1cb1c7,'path':_0x34721a}];}else{if(_0x3da158[_0x8a93('0x20')]===_0x8a93('0x27')){_0x5e1b22[_0x8a93('0x22')][_0x8a93('0x23')]=_0x8a93('0x28');if(!_0x2c4cfd[_0x8a93('0x29')]){_0x247039=![];logger[_0x8a93('0xf')](_0x8a93('0x2a'));}}else if(_0x3da158[_0x8a93('0x20')]===_0x8a93('0x2b')){_0x5e1b22[_0x8a93('0x22')][_0x8a93('0x23')]=_0x8a93('0x2c');}else if(_0x3da158['status']===_0x8a93('0x2d')){_0x5e1b22[_0x8a93('0x22')]['text']=_0x8a93('0x2e');}else if(_0x3da158[_0x8a93('0x20')]===_0x8a93('0x2f')){_0x5e1b22[_0x8a93('0x22')][_0x8a93('0x23')]=_0x8a93('0x30');}else{logger[_0x8a93('0x31')](_0x8a93('0x32'),_0x3da158[_0x8a93('0x20')]);}}if(_0x247039){return client[_0x8a93('0x33')](_0x8a93('0x34'),_0x5e1b22)['then'](function(_0x5eaad7){if(_0x5eaad7[_0x8a93('0x31')]){return logger[_0x8a93('0x31')](_0x8a93('0x35'),JSON[_0x8a93('0x24')](_0x5eaad7));}return logger[_0x8a93('0xf')](_0x8a93('0x36'));})[_0x8a93('0x37')](function(_0x1e6bda){return logger[_0x8a93('0x31')]('error\x20mail',JSON[_0x8a93('0x24')](_0x1e6bda));});}}function handleError(){return function(_0x255526){return logger[_0x8a93('0x31')](JSON['stringify'](_0x255526));};}function loading(_0x7ecff7){logger['info']('case\x20loading');if(_0x7ecff7[_0x8a93('0x38')]===_0x7ecff7[_0x8a93('0x39')][_0x8a93('0x3a')]){handleSendEmail(_0x7ecff7['job'],_0x7ecff7['data']);_0x7ecff7[_0x8a93('0x3b')][_0x8a93('0x3c')]();}else{_0x7ecff7[_0x8a93('0x3b')][_0x8a93('0x6')](_0x8a93('0x3d'));}}function completed(_0x3f76c2){logger[_0x8a93('0xf')]('case\x20completed');handleSendEmail(_0x3f76c2[_0x8a93('0x3e')],_0x3f76c2['data']);_0x3f76c2[_0x8a93('0x3b')][_0x8a93('0x3c')]();}function empty(_0xf75fbf){logger[_0x8a93('0xf')]('case\x20empty');handleSendEmail(_0xf75fbf[_0x8a93('0x3e')],_0xf75fbf[_0x8a93('0x3f')]);_0xf75fbf[_0x8a93('0x3b')][_0x8a93('0x3c')]();}function failed(_0x30a7d8){logger[_0x8a93('0xf')](_0x8a93('0x40'));handleSendEmail(_0x30a7d8[_0x8a93('0x3e')],_0x30a7d8['data']);_0x30a7d8[_0x8a93('0x3b')][_0x8a93('0x3c')]();}function urecognized(_0x107943){logger['error'](_0x8a93('0x41'),_0x107943['entity']['dataValues'][_0x8a93('0x20')]);_0x107943['operation'][_0x8a93('0x3c')]();}const reportStatusStrategies={'Loading':loading,'Completed':completed,'Empty':empty,'Failed':failed,'Unrecognized':urecognized};function retryer(_0x412d78,_0x37204b){const _0x1bf51b={'retries':0x3,'factor':0x2,'minTimeout':0x5b*0x3e8,'maxTimeout':0xa*0x3c*0x3e8};const _0x1146ee=retry['operation'](_0x1bf51b);_0x1146ee[_0x8a93('0x42')](_0x2c06ea=>{logger[_0x8a93('0xf')]('Job\x20ID\x20'+_0x412d78['id']+'\x20Attempt\x20#:'+_0x2c06ea);try{getReportData(_0x37204b['id'])['then'](function(_0x2e59aa){_0x37204b=_0x2e59aa;logger[_0x8a93('0xf')]('report\x20status:',_0x2e59aa[_0x8a93('0x43')][_0x8a93('0x20')]);if(!reportStatusStrategies[_0x2e59aa[_0x8a93('0x43')][_0x8a93('0x20')]]){logger[_0x8a93('0x31')]('report\x20status:',_0x2e59aa[_0x8a93('0x43')]['status']);_0x1146ee[_0x8a93('0x6')]();}reportStatusStrategies[_0x2e59aa[_0x8a93('0x43')]['status']]({'operation':_0x1146ee,'currentAttempt':_0x2c06ea,'retryOptions':_0x1bf51b,'job':_0x412d78,'data':_0x37204b,'entity':_0x2e59aa});});}catch(_0x3144d9){_0x1146ee[_0x8a93('0x6')](_0x3144d9);}});}function handleResult(_0x1eb7fc){return function(_0x2db3ea){if(_0x1eb7fc[_0x8a93('0x44')]&&_0x1eb7fc[_0x8a93('0x11')]&&_0x1eb7fc[_0x8a93('0x11')][_0x8a93('0x45')]&&!_[_0x8a93('0x46')](_0x1eb7fc[_0x8a93('0x15')])){retryer(_0x1eb7fc,_0x2db3ea);}};}function handleJob(_0x47c81e){return function(){try{if(_[_0x8a93('0x46')](_0x47c81e[_0x8a93('0x17')])){return logger[_0x8a93('0xf')](_0x8a93('0x47'));}if(_['isNil'](_0x47c81e[_0x8a93('0x18')])){return logger[_0x8a93('0xf')](_0x8a93('0x48'));}var _0x2f8b24={'startDate':moment()[_0x8a93('0x49')](_0x47c81e[_0x8a93('0x17')],_0x47c81e[_0x8a93('0x18')])[_0x8a93('0x1b')](_0x8a93('0x4a')),'endDate':moment()['format'](_0x8a93('0x4a')),'type':_0x8a93('0x4b'),'output':_0x47c81e[_0x8a93('0x4c')],'name':_0x47c81e[_0x8a93('0x14')]};if(!_[_0x8a93('0x46')](_0x47c81e['DefaultReportId'])){logger['info'](_0x8a93('0x4d'),_0x47c81e[_0x8a93('0x4e')]);return analyticDefaultReportController[_0x8a93('0x4f')]({'id':_0x47c81e[_0x8a93('0x4e')]},_0x2f8b24)['then'](handleResult(_0x47c81e))['catch'](handleError());}if(!_[_0x8a93('0x46')](_0x47c81e[_0x8a93('0x50')])){logger[_0x8a93('0xf')]('exec\x20custom\x20report\x20id:%s',_0x47c81e[_0x8a93('0x50')]);return analyticCustomReportController[_0x8a93('0x4f')]({'id':_0x47c81e[_0x8a93('0x50')]},_0x2f8b24)[_0x8a93('0xe')](handleResult(_0x47c81e))[_0x8a93('0x37')](handleError());}}catch(_0x1e0cf6){logger[_0x8a93('0x31')](JSON[_0x8a93('0x24')](_0x1e0cf6));}return logger['info']('no\x20report\x20id');};}function getJobs(_0x54d0ec){var _0x5ab170={};if(_0x54d0ec){_0x5ab170['id']=_0x54d0ec;}return db[_0x8a93('0x51')][_0x8a93('0x52')]({'where':_0x5ab170,'include':[{'model':db[_0x8a93('0x11')],'attributes':['id','name','email'],'include':[{'model':db['MailServerOut'],'as':_0x8a93('0x45'),'include':[{'model':db[_0x8a93('0x53')],'as':_0x8a93('0x53')}]}]}]})[_0x8a93('0xe')](function(_0x424520){var _0x3bd9f9=_[_0x8a93('0x54')](manager['jobs']);var _0xd8617b=_['map'](_0x424520,function(_0x513619){return _0x513619['id']['toString']();});var _0x421994=_[_0x8a93('0x55')](_0x424520,function(_0x7cecad){return _0x7cecad['id'][_0x8a93('0x56')]();});var _0x2057e3=_0x54d0ec?_0xd8617b:_[_0x8a93('0x57')](_0xd8617b,_0x3bd9f9);var _0x2f2bf2=_[_0x8a93('0x58')](_0xd8617b,_0x3bd9f9);var _0x5d043d=_[_0x8a93('0x57')](_0x3bd9f9,_0xd8617b);var _0x4bd89d;var _0x18a5e7;for(_0x4bd89d=0x0;_0x4bd89d<_0x5d043d[_0x8a93('0x59')]&&!_0x54d0ec;_0x4bd89d+=0x1){_0x18a5e7=_0x5d043d[_0x4bd89d]['toString']();if(manager[_0x8a93('0x5a')](_0x18a5e7)){manager['stop'](_0x18a5e7);manager[_0x8a93('0x5b')](_0x18a5e7);logger[_0x8a93('0xf')](_0x8a93('0x5c'),_0x18a5e7);}}logger[_0x8a93('0xf')]('toRun',JSON[_0x8a93('0x24')](_0x2057e3));for(_0x4bd89d=0x0;_0x4bd89d<_0x2057e3['length'];_0x4bd89d+=0x1){_0x18a5e7=_0x2057e3[_0x4bd89d][_0x8a93('0x56')]();if(_0x54d0ec){logger[_0x8a93('0xf')](JSON['stringify'](_0x421994[_0x18a5e7]));BPromise[_0x8a93('0x5d')]()[_0x8a93('0xe')](handleJob(_0x421994[_0x18a5e7]));logger['info']('run\x20job',_0x421994[_0x18a5e7][_0x8a93('0x14')],_0x421994[_0x18a5e7][_0x8a93('0x5e')]);}else if(_0x421994[_0x18a5e7][_0x8a93('0x5e')]&&_0x421994[_0x18a5e7][_0x8a93('0x5f')]&&moment()[_0x8a93('0x60')](_0x421994[_0x18a5e7][_0x8a93('0x61')],_0x421994[_0x18a5e7][_0x8a93('0x62')])){manager[_0x8a93('0x63')](_0x18a5e7,_0x421994[_0x18a5e7][_0x8a93('0x5e')],handleJob(_0x421994[_0x18a5e7]));manager['start'](_0x18a5e7);logger[_0x8a93('0xf')](_0x8a93('0x64'),_0x421994[_0x18a5e7][_0x8a93('0x14')],_0x421994[_0x18a5e7][_0x8a93('0x5e')]);}else if(manager['exists'](_0x18a5e7)){manager['stop'](_0x18a5e7);manager[_0x8a93('0x5b')](_0x18a5e7);logger[_0x8a93('0xf')](_0x8a93('0x65'),_0x421994[_0x18a5e7][_0x8a93('0x14')],_0x421994[_0x18a5e7][_0x8a93('0x5e')]);}}for(_0x4bd89d=0x0,_0x18a5e7;_0x4bd89d<_0x2f2bf2['length']&&!_0x54d0ec;_0x4bd89d+=0x1){_0x18a5e7=_0x2f2bf2[_0x4bd89d][_0x8a93('0x56')]();if(manager['exists'](_0x18a5e7)){if(_0x421994[_0x18a5e7][_0x8a93('0x5e')]&&_0x421994[_0x18a5e7][_0x8a93('0x5f')]&&moment()[_0x8a93('0x60')](_0x421994[_0x18a5e7][_0x8a93('0x61')],_0x421994[_0x18a5e7]['endAt'])){manager['update'](_0x18a5e7,_0x421994[_0x18a5e7]['cron'],handleJob(_0x421994[_0x18a5e7]));logger[_0x8a93('0xf')](_0x8a93('0x66'),_0x421994[_0x18a5e7][_0x8a93('0x14')],_0x421994[_0x18a5e7]['cron']);}else{manager[_0x8a93('0x3c')](_0x18a5e7);manager[_0x8a93('0x5b')](_0x18a5e7);logger[_0x8a93('0xf')](_0x8a93('0x65'),_0x421994[_0x18a5e7][_0x8a93('0x14')],_0x421994[_0x18a5e7]['cron']);}}}})['catch'](function(_0x4da067){logger[_0x8a93('0x31')](JSON['stringify'](_0x4da067));});}exports['run']=function(_0x4adfcf){return getJobs(_0x4adfcf);};exports[_0x8a93('0x67')]=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 6de8328..0f77c8e 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 _0xb9a7=['[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','No\x20transcribe\x20job\x20to\x20check','Transcribe\x20not\x20configured','transcribeAccountId','push','all','catch','aws-sdk','../../mysqldb','transcribe','TranscribeService','getTranscriptionJob','detectSentiment','info','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data1','data2','transcribeRegion','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','tempSentiment','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','sentimentRegion','bucket','Sequelize','ValidationError','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','format','language','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','resolve','Sentiment\x20Analysis\x20not\x20configured'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0xb9a7,0x112));var _0x7b9a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xb9a7[_0x17b6e3];return _0x3906f3;};var _=require('lodash');var AWS=require(_0x7b9a('0x0'));var rp=require('request-promise');var util=require('util');var BPromise=require('bluebird');var db=require(_0x7b9a('0x1'))['db'];var logger=require('../../config/logger')(_0x7b9a('0x2'));function getTranscriptionJob(_0x40ef7d,_0x37b25b,_0x24cae3,_0x5cd5da){return new Promise(function(_0xf6dae2,_0x22764f){var _0x7019fd=new AWS[(_0x7b9a('0x3'))]({'accessKeyId':_0x37b25b,'secretAccessKey':_0x40ef7d,'region':_0x24cae3});_0x7019fd[_0x7b9a('0x4')]({'TranscriptionJobName':_0x5cd5da},function(_0x4d3f20,_0x43d8e2){if(_0x4d3f20){return _0x22764f(_0x4d3f20);}else{return _0xf6dae2(_0x43d8e2);}});});}function sentiment(_0x3e84f1,_0x56a199,_0x511e28,_0x47e220,_0x15bc5b){return new Promise(function(_0x31f3b7,_0x4cf090){var _0x32c85d=new AWS['Comprehend']({'accessKeyId':_0x56a199,'secretAccessKey':_0x3e84f1,'region':_0x511e28});_0x32c85d[_0x7b9a('0x5')]({'Text':_0x47e220,'LanguageCode':_0x15bc5b['substring'](0x0,0x2)},function(_0x3af176,_0x1584a2){if(_0x3af176){return _0x4cf090(_0x3af176);}else{return _0x31f3b7(_0x1584a2);}});});}function checkTranscribeJob(_0x291591,_0x5948ca,_0x32f616){var _0xec5949;return new BPromise(function(_0x5e3875,_0x67553c){logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0x7'),_0x291591['id'],_0x291591[_0x7b9a('0x8')]));return getTranscriptionJob(_0x32f616[_0x7b9a('0x9')],_0x32f616[_0x7b9a('0xa')],_0x5948ca[_0x7b9a('0xb')],_0x291591[_0x7b9a('0x8')])[_0x7b9a('0xc')](function(_0x35e602){logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0xd'),_0x291591['id'],_0x291591['transcribeName'],_0x35e602[_0x7b9a('0xe')][_0x7b9a('0xf')]));if(!_0x291591[_0x7b9a('0x10')]){switch(_0x35e602[_0x7b9a('0xe')][_0x7b9a('0xf')]){case _0x7b9a('0x11'):var _0x27ad55={'transcribeStatus':_0x35e602[_0x7b9a('0xe')][_0x7b9a('0xf')],'fileUri':_0x35e602[_0x7b9a('0xe')][_0x7b9a('0x12')][_0x7b9a('0x13')]};logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0x14'),_0x291591['id']));return rp({'uri':_0x35e602['TranscriptionJob'][_0x7b9a('0x12')]['TranscriptFileUri'],'json':!![]})[_0x7b9a('0xc')](function(_0x331ae6){logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0x15'),_0x291591['id']));if(_0x331ae6&&_0x331ae6[_0x7b9a('0x16')]&&_0x331ae6['results'][_0x7b9a('0x17')]&&_0x331ae6[_0x7b9a('0x16')][_0x7b9a('0x17')][_0x7b9a('0x18')]){_0x27ad55[_0x7b9a('0x10')]='';for(var _0x5b2f52=0x0;_0x5b2f52<_0x331ae6[_0x7b9a('0x16')][_0x7b9a('0x17')]['length'];_0x5b2f52++){_0x27ad55[_0x7b9a('0x10')]+=_0x331ae6['results'][_0x7b9a('0x17')][_0x5b2f52][_0x7b9a('0x19')]+'';}}return _0x291591['update'](_0x27ad55);})['then'](function(){logger[_0x7b9a('0x6')](util['format']('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x291591['id']));if(!_0x291591[_0x7b9a('0x1a')]){throw new db['Sequelize']['ValidationError'](_0x7b9a('0x1b'));}if(!_0x5948ca['sentiment']||!_0x5948ca[_0x7b9a('0x1c')]||!_0x5948ca[_0x7b9a('0x1d')]||!_0x5948ca['language']||!_0x5948ca[_0x7b9a('0x1e')]){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x27ad55[_0x7b9a('0x10')]){throw new Error(_0x7b9a('0x21'));}if(_0x5948ca[_0x7b9a('0x1c')]===_0x32f616['id']){return _0x32f616;}else{return db[_0x7b9a('0x22')][_0x7b9a('0x23')]({'where':{'id':_settings[_0x7b9a('0x1c')]}});}})['then'](function(_0x4aa495){if(!_0x4aa495){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))](_0x7b9a('0x24'));}if(!_0x4aa495['data1']||!_0x4aa495[_0x7b9a('0xa')]){throw new db[(_0x7b9a('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0xec5949=_0x4aa495;logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x291591['id']));return sentiment(_0xec5949[_0x7b9a('0x9')],_0xec5949[_0x7b9a('0xa')],_0x5948ca[_0x7b9a('0x1d')],_0x27ad55[_0x7b9a('0x10')],_0x5948ca[_0x7b9a('0x26')]);})['then'](function(_0x46bcd0){logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')](_0x7b9a('0x27'),_0x291591['id']));return _0x291591[_0x7b9a('0x28')]({'sentiment':_0x46bcd0[_0x7b9a('0x29')],'sPositive':_0x46bcd0['SentimentScore']['Positive'],'sNegative':_0x46bcd0[_0x7b9a('0x2a')][_0x7b9a('0x2b')],'sMixed':_0x46bcd0['SentimentScore'][_0x7b9a('0x2c')],'sNeutral':_0x46bcd0[_0x7b9a('0x2a')][_0x7b9a('0x2d')]});})['then'](function(){logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x291591['id']));_0x5e3875();});case'FAILED':return _0x291591[_0x7b9a('0x28')]({'transcribeStatus':_0x7b9a('0x2e'),'failureReason':_0x35e602[_0x7b9a('0xe')][_0x7b9a('0x2f')]})[_0x7b9a('0xc')](function(){logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')](_0x7b9a('0x30'),_0x291591['id']));_0x5e3875();});default:logger['info'](util[_0x7b9a('0x25')]('[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed',_0x291591['id']));break;}}else{return BPromise[_0x7b9a('0x31')]()[_0x7b9a('0xc')](function(){if(!_0x291591[_0x7b9a('0x1a')]){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))](_0x7b9a('0x1b'));}if(!_0x5948ca['sentiment']||!_0x5948ca[_0x7b9a('0x1c')]||!_0x5948ca[_0x7b9a('0x1d')]||!_0x5948ca[_0x7b9a('0x26')]||!_0x5948ca[_0x7b9a('0x1e')]){throw new db['Sequelize'][(_0x7b9a('0x20'))](_0x7b9a('0x32'));}if(!_0x291591[_0x7b9a('0x10')]){throw new Error(_0x7b9a('0x21'));}if(_0x5948ca['sentimentAccountId']===_0x32f616['id']){return _0x32f616;}else{return db[_0x7b9a('0x22')]['findOne']({'where':{'id':_settings[_0x7b9a('0x1c')]}});}})[_0x7b9a('0xc')](function(_0x432e44){if(!_0x432e44){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))](_0x7b9a('0x24'));}if(!_0x432e44['data1']||!_0x432e44[_0x7b9a('0xa')]){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))]('Cloud\x20Provider\x20not\x20configured');}_0xec5949=_0x432e44;logger['info'](util[_0x7b9a('0x25')](_0x7b9a('0x33'),_0x291591['id']));return sentiment(_0xec5949[_0x7b9a('0x9')],_0xec5949[_0x7b9a('0xa')],_0x5948ca[_0x7b9a('0x1d')],_0x291591[_0x7b9a('0x10')],_0x5948ca['language']);})['then'](function(_0x5c9eac){logger[_0x7b9a('0x6')](util[_0x7b9a('0x25')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x291591['id']));return _0x291591[_0x7b9a('0x28')]({'sentiment':_0x5c9eac[_0x7b9a('0x29')],'sPositive':_0x5c9eac[_0x7b9a('0x2a')]['Positive'],'sNegative':_0x5c9eac[_0x7b9a('0x2a')]['Negative'],'sMixed':_0x5c9eac[_0x7b9a('0x2a')][_0x7b9a('0x2c')],'sNeutral':_0x5c9eac[_0x7b9a('0x2a')][_0x7b9a('0x2d')],'transcribeStatus':_0x7b9a('0x11')});})['then'](function(){logger[_0x7b9a('0x6')](util['format'](_0x7b9a('0x30'),_0x291591['id']));_0x5e3875();});}})['catch'](function(_0x4f1b2e){if(_0x4f1b2e){if(!_0x4f1b2e[_0x7b9a('0x34')]||_0x4f1b2e[_0x7b9a('0x34')]!==_0x7b9a('0x35')){logger[_0x7b9a('0x36')](util[_0x7b9a('0x25')](_0x7b9a('0x37'),_0x291591['id']),util[_0x7b9a('0x38')](_0x4f1b2e,{'showHidden':![],'depth':null}));}}_0x5e3875();});});}function checkTranscribe(){var _0x31506d;var _0x1d034b;var _0x5088c7;return db[_0x7b9a('0x39')][_0x7b9a('0x3a')]({'where':{'transcribeStatus':'IN_PROGRESS'}})['then'](function(_0x5dd42d){if(!_0x5dd42d||!_0x5dd42d[_0x7b9a('0x18')]){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))](_0x7b9a('0x3b'));}_0x31506d=_0x5dd42d;return db['Setting'][_0x7b9a('0x23')]({'where':{'id':0x1}});})[_0x7b9a('0xc')](function(_0x287dea){if(!_0x287dea){throw new db[(_0x7b9a('0x1f'))][(_0x7b9a('0x20'))]('Settings\x20not\x20available');}_0x1d034b=_0x287dea;if(!_0x1d034b[_0x7b9a('0x2')]||!_0x1d034b['transcribeAccountId']||!_0x1d034b[_0x7b9a('0xb')]||!_0x1d034b[_0x7b9a('0x26')]||!_0x1d034b[_0x7b9a('0x1e')]){throw new db[(_0x7b9a('0x1f'))]['ValidationError'](_0x7b9a('0x3c'));}return db[_0x7b9a('0x22')][_0x7b9a('0x23')]({'where':{'id':_0x1d034b[_0x7b9a('0x3d')]}});})[_0x7b9a('0xc')](function(_0x3e2f1b){if(!_0x3e2f1b){throw new db[(_0x7b9a('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x3e2f1b['data1']||!_0x3e2f1b[_0x7b9a('0xa')]){throw new db[(_0x7b9a('0x1f'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x5088c7=_0x3e2f1b;var _0x58527d=[];_0x31506d['forEach'](function(_0x7c800f){_0x58527d[_0x7b9a('0x3e')](checkTranscribeJob(_0x7c800f,_0x1d034b,_0x5088c7));});return BPromise[_0x7b9a('0x3f')](_0x58527d);})[_0x7b9a('0x40')](function(_0x34f552){if(_0x34f552){if(!_0x34f552[_0x7b9a('0x34')]||_0x34f552[_0x7b9a('0x34')]!==_0x7b9a('0x35')){logger['error'](util[_0x7b9a('0x38')](_0x34f552,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xab26=['lodash','aws-sdk','request-promise','bluebird','../../mysqldb','TranscribeService','Comprehend','substring','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','then','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','transcript','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Sentiment\x20Analysis\x20not\x20configured','findOne','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Negative','Mixed','FAILED','FailureReason','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','tempSentiment','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','Neutral','name','error','VoiceRecording','IN_PROGRESS','length','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribe','transcribeAccountId','transcribeRegion','forEach','push','all','catch','SequelizeValidationError','inspect'];(function(_0x4e6558,_0x417981){var _0x595c71=function(_0x46b1c6){while(--_0x46b1c6){_0x4e6558['push'](_0x4e6558['shift']());}};_0x595c71(++_0x417981);}(_0xab26,0xd2));var _0x6ab2=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xab26[_0x20a584];return _0x4b41a8;};var _=require(_0x6ab2('0x0'));var AWS=require(_0x6ab2('0x1'));var rp=require(_0x6ab2('0x2'));var util=require('util');var BPromise=require(_0x6ab2('0x3'));var db=require(_0x6ab2('0x4'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x4c8cf,_0x51bdcd,_0x332458,_0xb15094){return new Promise(function(_0x31c9f1,_0x56dc80){var _0x41643a=new AWS[(_0x6ab2('0x5'))]({'accessKeyId':_0x51bdcd,'secretAccessKey':_0x4c8cf,'region':_0x332458});_0x41643a['getTranscriptionJob']({'TranscriptionJobName':_0xb15094},function(_0x140cc1,_0x3157f1){if(_0x140cc1){return _0x56dc80(_0x140cc1);}else{return _0x31c9f1(_0x3157f1);}});});}function sentiment(_0x442ae2,_0xf9b141,_0x3bb68b,_0x3964fd,_0x217b42){return new Promise(function(_0x448216,_0x459538){var _0x2e765a=new AWS[(_0x6ab2('0x6'))]({'accessKeyId':_0xf9b141,'secretAccessKey':_0x442ae2,'region':_0x3bb68b});_0x2e765a['detectSentiment']({'Text':_0x3964fd,'LanguageCode':_0x217b42[_0x6ab2('0x7')](0x0,0x2)},function(_0x2db481,_0x3c4612){if(_0x2db481){return _0x459538(_0x2db481);}else{return _0x448216(_0x3c4612);}});});}function checkTranscribeJob(_0x5b7e6d,_0x5b6f7c,_0x10c3b1){var _0x2bb464;return new BPromise(function(_0x431d63,_0x8d1dc8){logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')](_0x6ab2('0xa'),_0x5b7e6d['id'],_0x5b7e6d[_0x6ab2('0xb')]));return getTranscriptionJob(_0x10c3b1['data1'],_0x10c3b1[_0x6ab2('0xc')],_0x5b6f7c['transcribeRegion'],_0x5b7e6d[_0x6ab2('0xb')])[_0x6ab2('0xd')](function(_0x5ced24){logger['info'](util['format'](_0x6ab2('0xe'),_0x5b7e6d['id'],_0x5b7e6d[_0x6ab2('0xb')],_0x5ced24[_0x6ab2('0xf')][_0x6ab2('0x10')]));if(!_0x5b7e6d[_0x6ab2('0x11')]){switch(_0x5ced24[_0x6ab2('0xf')]['TranscriptionJobStatus']){case _0x6ab2('0x12'):var _0x2aac55={'transcribeStatus':_0x5ced24['TranscriptionJob'][_0x6ab2('0x10')],'fileUri':_0x5ced24['TranscriptionJob']['Transcript'][_0x6ab2('0x13')]};logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')](_0x6ab2('0x14'),_0x5b7e6d['id']));return rp({'uri':_0x5ced24[_0x6ab2('0xf')]['Transcript'][_0x6ab2('0x13')],'json':!![]})[_0x6ab2('0xd')](function(_0x3b7a1a){logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')](_0x6ab2('0x15'),_0x5b7e6d['id']));if(_0x3b7a1a&&_0x3b7a1a[_0x6ab2('0x16')]&&_0x3b7a1a[_0x6ab2('0x16')][_0x6ab2('0x17')]&&_0x3b7a1a[_0x6ab2('0x16')]['transcripts']['length']){_0x2aac55['fileText']='';for(var _0x11e287=0x0;_0x11e287<_0x3b7a1a[_0x6ab2('0x16')][_0x6ab2('0x17')]['length'];_0x11e287++){_0x2aac55[_0x6ab2('0x11')]+=_0x3b7a1a[_0x6ab2('0x16')][_0x6ab2('0x17')][_0x11e287][_0x6ab2('0x18')]+'';}}return _0x5b7e6d['update'](_0x2aac55);})['then'](function(){logger['info'](util[_0x6ab2('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5b7e6d['id']));if(!_0x5b7e6d['tempSentiment']){throw new db[(_0x6ab2('0x19'))][(_0x6ab2('0x1a'))](_0x6ab2('0x1b'));}if(!_0x5b6f7c[_0x6ab2('0x1c')]||!_0x5b6f7c[_0x6ab2('0x1d')]||!_0x5b6f7c[_0x6ab2('0x1e')]||!_0x5b6f7c[_0x6ab2('0x1f')]||!_0x5b6f7c[_0x6ab2('0x20')]){throw new db[(_0x6ab2('0x19'))]['ValidationError'](_0x6ab2('0x21'));}if(!_0x2aac55[_0x6ab2('0x11')]){throw new Error('Transcript\x20not\x20available');}if(_0x5b6f7c[_0x6ab2('0x1d')]===_0x10c3b1['id']){return _0x10c3b1;}else{return db['CloudProvider'][_0x6ab2('0x22')]({'where':{'id':_settings[_0x6ab2('0x1d')]}});}})[_0x6ab2('0xd')](function(_0x151367){if(!_0x151367){throw new db[(_0x6ab2('0x19'))][(_0x6ab2('0x1a'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x151367[_0x6ab2('0x23')]||!_0x151367[_0x6ab2('0xc')]){throw new db[(_0x6ab2('0x19'))][(_0x6ab2('0x1a'))](_0x6ab2('0x24'));}_0x2bb464=_0x151367;logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x5b7e6d['id']));return sentiment(_0x2bb464[_0x6ab2('0x23')],_0x2bb464[_0x6ab2('0xc')],_0x5b6f7c['sentimentRegion'],_0x2aac55['fileText'],_0x5b6f7c[_0x6ab2('0x1f')]);})[_0x6ab2('0xd')](function(_0x309165){logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')](_0x6ab2('0x25'),_0x5b7e6d['id']));return _0x5b7e6d[_0x6ab2('0x26')]({'sentiment':_0x309165[_0x6ab2('0x27')],'sPositive':_0x309165['SentimentScore']['Positive'],'sNegative':_0x309165[_0x6ab2('0x28')][_0x6ab2('0x29')],'sMixed':_0x309165[_0x6ab2('0x28')][_0x6ab2('0x2a')],'sNeutral':_0x309165[_0x6ab2('0x28')]['Neutral']});})[_0x6ab2('0xd')](function(){logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x5b7e6d['id']));_0x431d63();});case _0x6ab2('0x2b'):return _0x5b7e6d[_0x6ab2('0x26')]({'transcribeStatus':'FAILED','failureReason':_0x5ced24[_0x6ab2('0xf')][_0x6ab2('0x2c')]})[_0x6ab2('0xd')](function(){logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')](_0x6ab2('0x2d'),_0x5b7e6d['id']));_0x431d63();});default:logger[_0x6ab2('0x8')](util['format'](_0x6ab2('0x2e'),_0x5b7e6d['id']));break;}}else{return BPromise['resolve']()[_0x6ab2('0xd')](function(){if(!_0x5b7e6d[_0x6ab2('0x2f')]){throw new db[(_0x6ab2('0x19'))]['ValidationError']('Sentiment\x20Analysis\x20not\x20requested');}if(!_0x5b6f7c[_0x6ab2('0x1c')]||!_0x5b6f7c['sentimentAccountId']||!_0x5b6f7c['sentimentRegion']||!_0x5b6f7c[_0x6ab2('0x1f')]||!_0x5b6f7c[_0x6ab2('0x20')]){throw new db[(_0x6ab2('0x19'))][(_0x6ab2('0x1a'))](_0x6ab2('0x21'));}if(!_0x5b7e6d['fileText']){throw new Error(_0x6ab2('0x30'));}if(_0x5b6f7c['sentimentAccountId']===_0x10c3b1['id']){return _0x10c3b1;}else{return db[_0x6ab2('0x31')][_0x6ab2('0x22')]({'where':{'id':_settings[_0x6ab2('0x1d')]}});}})[_0x6ab2('0xd')](function(_0x507fdc){if(!_0x507fdc){throw new db[(_0x6ab2('0x19'))][(_0x6ab2('0x1a'))](_0x6ab2('0x32'));}if(!_0x507fdc[_0x6ab2('0x23')]||!_0x507fdc[_0x6ab2('0xc')]){throw new db[(_0x6ab2('0x19'))][(_0x6ab2('0x1a'))](_0x6ab2('0x24'));}_0x2bb464=_0x507fdc;logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')](_0x6ab2('0x33'),_0x5b7e6d['id']));return sentiment(_0x2bb464[_0x6ab2('0x23')],_0x2bb464['data2'],_0x5b6f7c[_0x6ab2('0x1e')],_0x5b7e6d[_0x6ab2('0x11')],_0x5b6f7c[_0x6ab2('0x1f')]);})[_0x6ab2('0xd')](function(_0x1b38ae){logger[_0x6ab2('0x8')](util['format'](_0x6ab2('0x25'),_0x5b7e6d['id']));return _0x5b7e6d[_0x6ab2('0x26')]({'sentiment':_0x1b38ae[_0x6ab2('0x27')],'sPositive':_0x1b38ae[_0x6ab2('0x28')]['Positive'],'sNegative':_0x1b38ae['SentimentScore'][_0x6ab2('0x29')],'sMixed':_0x1b38ae[_0x6ab2('0x28')][_0x6ab2('0x2a')],'sNeutral':_0x1b38ae[_0x6ab2('0x28')][_0x6ab2('0x34')],'transcribeStatus':'COMPLETED'});})[_0x6ab2('0xd')](function(){logger[_0x6ab2('0x8')](util[_0x6ab2('0x9')](_0x6ab2('0x2d'),_0x5b7e6d['id']));_0x431d63();});}})['catch'](function(_0x538532){if(_0x538532){if(!_0x538532[_0x6ab2('0x35')]||_0x538532[_0x6ab2('0x35')]!=='SequelizeValidationError'){logger[_0x6ab2('0x36')](util['format']('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x5b7e6d['id']),util['inspect'](_0x538532,{'showHidden':![],'depth':null}));}}_0x431d63();});});}function checkTranscribe(){var _0x1a7e42;var _0x2bee34;var _0x4fffb4;return db[_0x6ab2('0x37')]['findAll']({'where':{'transcribeStatus':_0x6ab2('0x38')}})[_0x6ab2('0xd')](function(_0xe385cf){if(!_0xe385cf||!_0xe385cf[_0x6ab2('0x39')]){throw new db['Sequelize'][(_0x6ab2('0x1a'))](_0x6ab2('0x3a'));}_0x1a7e42=_0xe385cf;return db[_0x6ab2('0x3b')][_0x6ab2('0x22')]({'where':{'id':0x1}});})[_0x6ab2('0xd')](function(_0x301270){if(!_0x301270){throw new db[(_0x6ab2('0x19'))]['ValidationError'](_0x6ab2('0x3c'));}_0x2bee34=_0x301270;if(!_0x2bee34[_0x6ab2('0x3d')]||!_0x2bee34[_0x6ab2('0x3e')]||!_0x2bee34[_0x6ab2('0x3f')]||!_0x2bee34[_0x6ab2('0x1f')]||!_0x2bee34[_0x6ab2('0x20')]){throw new db['Sequelize'][(_0x6ab2('0x1a'))]('Transcribe\x20not\x20configured');}return db[_0x6ab2('0x31')][_0x6ab2('0x22')]({'where':{'id':_0x2bee34[_0x6ab2('0x3e')]}});})[_0x6ab2('0xd')](function(_0x145428){if(!_0x145428){throw new db[(_0x6ab2('0x19'))][(_0x6ab2('0x1a'))](_0x6ab2('0x32'));}if(!_0x145428[_0x6ab2('0x23')]||!_0x145428['data2']){throw new db[(_0x6ab2('0x19'))]['ValidationError']('Cloud\x20Provider\x20not\x20configured');}_0x4fffb4=_0x145428;var _0x3dde6b=[];_0x1a7e42[_0x6ab2('0x40')](function(_0x12eab2){_0x3dde6b[_0x6ab2('0x41')](checkTranscribeJob(_0x12eab2,_0x2bee34,_0x4fffb4));});return BPromise[_0x6ab2('0x42')](_0x3dde6b);})[_0x6ab2('0x43')](function(_0x7f1000){if(_0x7f1000){if(!_0x7f1000[_0x6ab2('0x35')]||_0x7f1000[_0x6ab2('0x35')]!==_0x6ab2('0x44')){logger[_0x6ab2('0x36')](util[_0x6ab2('0x45')](_0x7f1000,{'showHidden':![],'depth':null}));}}});}exports['start']=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 fa5958f..bdc686b 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 _0x9bbf=['info','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','schedule','defaults','redis','localhost','socket.io-emitter','findAll','lastMsgAt','subtract','hours','then','length','map','[WHATSAPP]\x20Interactions\x20to\x20close:','join','WhatsappInteraction','system','timeout','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3826ad,_0x49a30d){var _0x17b900=function(_0x38474f){while(--_0x38474f){_0x3826ad['push'](_0x3826ad['shift']());}};_0x17b900(++_0x49a30d);}(_0x9bbf,0x15d));var _0xf9bb=function(_0x39d2e5,_0x2b4e52){_0x39d2e5=_0x39d2e5-0x0;var _0x94c0b3=_0x9bbf[_0x39d2e5];return _0x94c0b3;};'use strict';var _=require(_0xf9bb('0x0'));var moment=require(_0xf9bb('0x1'));var Redis=require(_0xf9bb('0x2'));var util=require(_0xf9bb('0x3'));var config=require('../../config/environment');var db=require(_0xf9bb('0x4'))['db'];var logger=require('../logger')(_0xf9bb('0x5'));config['redis']=_[_0xf9bb('0x6')](config[_0xf9bb('0x7')],{'host':_0xf9bb('0x8'),'port':0x18eb});var io=require(_0xf9bb('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x42cdea=[];return db['WhatsappInteraction'][_0xf9bb('0xa')]({'raw':!![],'attributes':['id',_0xf9bb('0xb')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xf9bb('0xc')](0x18,_0xf9bb('0xd'))}}})[_0xf9bb('0xe')](function(_0x2559f4){if(_0x2559f4&&_0x2559f4[_0xf9bb('0xf')]){_0x42cdea=_[_0xf9bb('0x10')](_0x2559f4||[],'id');logger['info'](_0xf9bb('0x11'),_0x42cdea[_0xf9bb('0x12')]());return db[_0xf9bb('0x13')]['update']({'closeReason':_0xf9bb('0x14'),'disposition':_0xf9bb('0x15'),'closed':!![],'closedAt':moment()['format'](_0xf9bb('0x16'))},{'where':{'id':_0x42cdea}});}})['then'](function(){if(_0x42cdea&&_0x42cdea['length']){logger[_0xf9bb('0x17')]('[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:',_0x42cdea[_0xf9bb('0x12')]());for(var _0x1bb352=0x0;_0x1bb352<_0x42cdea[_0xf9bb('0xf')];_0x1bb352++){io[_0xf9bb('0x18')](_0xf9bb('0x19'),{'id':_0x42cdea[_0x1bb352],'closed':!![]});}}})[_0xf9bb('0x1a')](function(_0x2a652a){logger[_0xf9bb('0x1b')](_0xf9bb('0x1c'),_0x2a652a?util[_0xf9bb('0x1d')](_0x2a652a,{'showHidden':![],'depth':null}):'');});}exports[_0xf9bb('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0xa5a9=['schedule','defaults','localhost','socket.io-emitter','redis','findAll','lastMsgAt','subtract','hours','map','info','[WHATSAPP]\x20Interactions\x20to\x20close:','WhatsappInteraction','timeout','format','YYYY-MM-DD\x20HH:mm:ss','then','length','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','start','moment','ioredis','util','../../config/environment'];(function(_0x20baea,_0x3f61f8){var _0x1f131c=function(_0x39a54f){while(--_0x39a54f){_0x20baea['push'](_0x20baea['shift']());}};_0x1f131c(++_0x3f61f8);}(_0xa5a9,0xdc));var _0x9a5a=function(_0x294b6,_0x2907ae){_0x294b6=_0x294b6-0x0;var _0x38bb97=_0xa5a9[_0x294b6];return _0x38bb97;};'use strict';var _=require('lodash');var moment=require(_0x9a5a('0x0'));var Redis=require(_0x9a5a('0x1'));var util=require(_0x9a5a('0x2'));var config=require(_0x9a5a('0x3'));var db=require('../../mysqldb')['db'];var logger=require('../logger')(_0x9a5a('0x4'));config['redis']=_[_0x9a5a('0x5')](config['redis'],{'host':_0x9a5a('0x6'),'port':0x18eb});var io=require(_0x9a5a('0x7'))(new Redis(config[_0x9a5a('0x8')]));function closeInteractions(){var _0x4f4e51=[];return db['WhatsappInteraction'][_0x9a5a('0x9')]({'raw':!![],'attributes':['id',_0x9a5a('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x9a5a('0xb')](0x18,_0x9a5a('0xc'))}}})['then'](function(_0x2f5544){if(_0x2f5544&&_0x2f5544['length']){_0x4f4e51=_[_0x9a5a('0xd')](_0x2f5544||[],'id');logger[_0x9a5a('0xe')](_0x9a5a('0xf'),_0x4f4e51['join']());return db[_0x9a5a('0x10')]['update']({'closeReason':'system','disposition':_0x9a5a('0x11'),'closed':!![],'closedAt':moment()[_0x9a5a('0x12')](_0x9a5a('0x13'))},{'where':{'id':_0x4f4e51}});}})[_0x9a5a('0x14')](function(){if(_0x4f4e51&&_0x4f4e51[_0x9a5a('0x15')]){logger[_0x9a5a('0xe')](_0x9a5a('0x16'),_0x4f4e51['join']());for(var _0x2d1959=0x0;_0x2d1959<_0x4f4e51[_0x9a5a('0x15')];_0x2d1959++){io[_0x9a5a('0x17')](_0x9a5a('0x18'),{'id':_0x4f4e51[_0x2d1959],'closed':!![]});}}})['catch'](function(_0xff6d4c){logger[_0x9a5a('0x19')](_0x9a5a('0x1a'),_0xff6d4c?util['inspect'](_0xff6d4c,{'showHidden':![],'depth':null}):'');});}exports[_0x9a5a('0x1b')]=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 f9c9e4e..7c60267 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa978=['push','innocenzo.biondo','CmContact','destroy','bulkCreate','then','log','contacts1','CmHopper','finished\x20populating','contacts2','catch','Innocenzo','Biondo','@xcally.com','now'];(function(_0xbc1624,_0x41e527){var _0x5ef458=function(_0x56697e){while(--_0x56697e){_0xbc1624['push'](_0xbc1624['shift']());}};_0x5ef458(++_0x41e527);}(_0xa978,0x1ec));var _0x8a97=function(_0x52aed2,_0x1e6c18){_0x52aed2=_0x52aed2-0x0;var _0x3bed79=_0xa978[_0x52aed2];return _0x3bed79;};'use strict';var util=require('util');var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0x8a97('0x0')+i,'lastName':_0x8a97('0x1')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x8a97('0x2')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x8a97('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date['now'](),'updatedAt':Date[_0x8a97('0x3')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x8a97('0x4')]({'id':i,'firstName':_0x8a97('0x0')+i,'lastName':_0x8a97('0x1')+i,'phone':0xf879fb460+i,'email':_0x8a97('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x8a97('0x3')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x8a97('0x3')](),'updatedAt':Date[_0x8a97('0x3')]()});}db[_0x8a97('0x6')][_0x8a97('0x7')]({'where':{}})['then'](function(){return db['CmContact'][_0x8a97('0x8')](contacts);})[_0x8a97('0x9')](function(){console[_0x8a97('0xa')]('finished\x20populating',_0x8a97('0xb'));return db[_0x8a97('0xc')][_0x8a97('0x7')]({'where':{}});})[_0x8a97('0x9')](function(){return db['CmHopper'][_0x8a97('0x8')](hopper);})[_0x8a97('0x9')](function(){console[_0x8a97('0xa')](_0x8a97('0xd'),'hopper1');return db[_0x8a97('0x6')][_0x8a97('0x8')](contacts2);})[_0x8a97('0x9')](function(){console[_0x8a97('0xa')](_0x8a97('0xd'),_0x8a97('0xe'));return db['CmHopper'][_0x8a97('0x8')](hopper2);})[_0x8a97('0x9')](function(){console['log']('finished\x20populating','hopper2');})[_0x8a97('0xf')](function(_0x2b8184){console[_0x8a97('0xa')](_0x2b8184);}); \ No newline at end of file +var _0xa9b6=['Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','then','bulkCreate','CmHopper','log','hopper1','finished\x20populating','contacts2','hopper2','util','push'];(function(_0x31fba5,_0x401a77){var _0x49ef92=function(_0x31ecab){while(--_0x31ecab){_0x31fba5['push'](_0x31fba5['shift']());}};_0x49ef92(++_0x401a77);}(_0xa9b6,0x8e));var _0x6a9b=function(_0x1248d4,_0x34b741){_0x1248d4=_0x1248d4-0x0;var _0x5d33ff=_0xa9b6[_0x1248d4];return _0x5d33ff;};'use strict';var util=require(_0x6a9b('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x6a9b('0x1')]({'id':i,'firstName':_0x6a9b('0x2')+i,'lastName':_0x6a9b('0x3')+i,'phone':0xf879fb460+i,'email':_0x6a9b('0x4')+i+_0x6a9b('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x6a9b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x6a9b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6a9b('0x6')](),'updatedAt':Date[_0x6a9b('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x6a9b('0x1')]({'id':i,'firstName':_0x6a9b('0x2')+i,'lastName':_0x6a9b('0x3')+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0x6a9b('0x1')]({'id':i,'active':![],'scheduledat':Date[_0x6a9b('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x6a9b('0x6')](),'updatedAt':Date[_0x6a9b('0x6')]()});}db[_0x6a9b('0x7')]['destroy']({'where':{}})[_0x6a9b('0x8')](function(){return db[_0x6a9b('0x7')][_0x6a9b('0x9')](contacts);})[_0x6a9b('0x8')](function(){console['log']('finished\x20populating','contacts1');return db[_0x6a9b('0xa')]['destroy']({'where':{}});})['then'](function(){return db[_0x6a9b('0xa')][_0x6a9b('0x9')](hopper);})[_0x6a9b('0x8')](function(){console[_0x6a9b('0xb')]('finished\x20populating',_0x6a9b('0xc'));return db['CmContact']['bulkCreate'](contacts2);})[_0x6a9b('0x8')](function(){console[_0x6a9b('0xb')](_0x6a9b('0xd'),_0x6a9b('0xe'));return db[_0x6a9b('0xa')][_0x6a9b('0x9')](hopper2);})[_0x6a9b('0x8')](function(){console[_0x6a9b('0xb')](_0x6a9b('0xd'),_0x6a9b('0xf'));})['catch'](function(_0x2eaa4f){console[_0x6a9b('0xb')](_0x2eaa4f);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index deb0516..27244b5 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5a3d=['log','add\x20user','catch','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','all','ulaw','yes','actpass','\x22%s\x22\x20<%s>','User'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x5a3d,0xc9));var _0xd5a3=function(_0x54ebbb,_0x2c7983){_0x54ebbb=_0x54ebbb-0x0;var _0x210b1e=_0x5a3d[_0x54ebbb];return _0x210b1e;};'use strict';var util=require('util');var db=require(_0xd5a3('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xd5a3('0x1')]({'name':util[_0xd5a3('0x2')](_0xd5a3('0x3'),_0xd5a3('0x4'),i),'fullname':util[_0xd5a3('0x2')](_0xd5a3('0x3'),_0xd5a3('0x4'),i),'email':util['format'](_0xd5a3('0x5'),_0xd5a3('0x4'),i),'role':_0xd5a3('0x4'),'password':_0xd5a3('0x6'),'internal':0xfa0+i,'type':_0xd5a3('0x7'),'transport':[_0xd5a3('0x8'),'ws','wss'],'disallow':[_0xd5a3('0x9')],'allow':[_0xd5a3('0xa')],'defaultuser':util[_0xd5a3('0x2')]('%s%s',_0xd5a3('0x4'),i),'encryption':_0xd5a3('0xb'),'avpf':'yes','force_avp':_0xd5a3('0xb'),'icesupport':_0xd5a3('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':'/etc/pki/tls/private/motion.key','dtlssetup':_0xd5a3('0xc'),'callerid':util[_0xd5a3('0x2')](_0xd5a3('0xd'),util['format'](_0xd5a3('0x3'),_0xd5a3('0x4'),i),0xfa0+i)});}db[_0xd5a3('0xe')]['bulkCreate'](users)['then'](function(){console[_0xd5a3('0xf')](_0xd5a3('0x10'));})[_0xd5a3('0x11')](function(_0x991336){console[_0xd5a3('0xf')](_0x991336);}); \ No newline at end of file +var _0xd9a2=['push','format','%s%s','agent','udp','wss','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb'];(function(_0x9d9797,_0xe3ebe8){var _0x3c16ca=function(_0x3d8735){while(--_0x3d8735){_0x9d9797['push'](_0x9d9797['shift']());}};_0x3c16ca(++_0xe3ebe8);}(_0xd9a2,0xb2));var _0x2d9a=function(_0x481529,_0x2ad20a){_0x481529=_0x481529-0x0;var _0x20015b=_0xd9a2[_0x481529];return _0x20015b;};'use strict';var util=require(_0x2d9a('0x0'));var db=require(_0x2d9a('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x2d9a('0x2')]({'name':util[_0x2d9a('0x3')](_0x2d9a('0x4'),_0x2d9a('0x5'),i),'fullname':util[_0x2d9a('0x3')](_0x2d9a('0x4'),_0x2d9a('0x5'),i),'email':util[_0x2d9a('0x3')]('%s%s@xcally.com',_0x2d9a('0x5'),i),'role':'agent','password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x2d9a('0x6'),'ws',_0x2d9a('0x7')],'disallow':['all'],'allow':['ulaw'],'defaultuser':util['format'](_0x2d9a('0x4'),_0x2d9a('0x5'),i),'encryption':'yes','avpf':'yes','force_avp':_0x2d9a('0x8'),'icesupport':_0x2d9a('0x8'),'dtlsenable':_0x2d9a('0x8'),'dtlsverify':'no','dtlscertfile':_0x2d9a('0x9'),'dtlsprivatekey':_0x2d9a('0xa'),'dtlssetup':_0x2d9a('0xb'),'callerid':util[_0x2d9a('0x3')]('\x22%s\x22\x20<%s>',util[_0x2d9a('0x3')](_0x2d9a('0x4'),'agent',i),0xfa0+i)});}db[_0x2d9a('0xc')][_0x2d9a('0xd')](users)[_0x2d9a('0xe')](function(){console[_0x2d9a('0xf')](_0x2d9a('0x10'));})[_0x2d9a('0x11')](function(_0x243c6b){console[_0x2d9a('0xf')](_0x243c6b);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 948f3a5..d28ecd8 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xeec6=['OpenchannelInteractions','removeOpenchannelInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','default','connection','setMaxListeners','request','remotePort','connectedAt','SocketIO\x20','nsp','address','DISCONNECTED','lodash','../mysqldb','./environment','name','Agents','role','telephone','agent','type','findOne','autoAssociation','VoiceQueues','MailQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','map','resourceId','User','where','Campaign','ivr','then','format','%s:queue:%s','handshake','query','userProfileId','ChatInteractions','MailInteraction','MailInteractions','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','user:%s','voice:inbound','voice:outbound','hasOwnProperty','include','VoiceQueue','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','Trunk','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','getVoiceQueues','getFaxQueues','getSmsQueues','all','length','voice','chat','fax','sms','mail','openchannel','whatsapp','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','removeMailInteractions','user_has_fax_interactions:remove','user_has_sms_interactions:remove'];(function(_0x397cfb,_0xb8f317){var _0x15fed9=function(_0x3eba43){while(--_0x3eba43){_0x397cfb['push'](_0x397cfb['shift']());}};_0x15fed9(++_0xb8f317);}(_0xeec6,0x125));var _0x6eec=function(_0x3e779c,_0x546ea2){_0x3e779c=_0x3e779c-0x0;var _0x22ab11=_0xeec6[_0x3e779c];return _0x22ab11;};'use strict';var _=require(_0x6eec('0x0'));var util=require('util');var BPromise=require('bluebird');var db=require(_0x6eec('0x1'))['db'];var config=require(_0x6eec('0x2'));var queryQueues={'attributes':['id',_0x6eec('0x3')],'include':[{'as':_0x6eec('0x4'),'model':db['User'],'attributes':['id',_0x6eec('0x3'),_0x6eec('0x5')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x6eec('0x3')],'where':{'role':_0x6eec('0x6')}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x6eec('0x3')],'where':{'role':_0x6eec('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6eec('0x3'),_0x6eec('0x8')],'where':{'type':'ivr'}};function getAssociatedResources(_0x1205a7,_0x392e0a,_0x422d71){return db['UserProfileSection'][_0x6eec('0x9')]({'where':{'name':_0x1205a7,'userProfileId':_0x392e0a},'raw':!![]})['then'](function(_0x13d892){if(_0x13d892){if(_0x13d892[_0x6eec('0xa')]){switch(_0x1205a7){case _0x6eec('0xb'):case'ChatQueues':case'FaxQueues':case'SmsQueues':case _0x6eec('0xc'):case'OpenchannelQueues':case'WhatsappQueues':return db[_0x422d71]['findAll'](queryQueues);case _0x6eec('0xd'):return db[_0x422d71][_0x6eec('0xe')](queryTelephones);case _0x6eec('0xf'):return db[_0x422d71]['findAll'](queryTrunks);case _0x6eec('0x10'):return db[_0x422d71][_0x6eec('0xe')](queryCampaigns);}}else{return db[_0x6eec('0x11')][_0x6eec('0xe')]({'attributes':['resourceId'],'where':{'sectionId':_0x13d892['id']},'raw':!![]})['then'](function(_0x3fb003){if(_0x3fb003){var _0x43947e={'where':{'id':_[_0x6eec('0x12')](_0x3fb003,_0x6eec('0x13'))},'raw':!![]};switch(_0x422d71){case _0x6eec('0x14'):_0x43947e[_0x6eec('0x15')][_0x6eec('0x5')]=_0x6eec('0x6');break;case _0x6eec('0x16'):_0x43947e[_0x6eec('0x15')]['type']=_0x6eec('0x17');break;}return db[_0x422d71][_0x6eec('0xe')](_0x43947e);}else{return[];}});}}else{return[];}})[_0x6eec('0x18')](function(_0x5f3b6d){return _0x5f3b6d;});}function joinOrLeaveQueues(_0x5af05a,_0xd2927c,_0x5f3704,_0x389457){_0x5af05a[_0xd2927c](util[_0x6eec('0x19')](_0x6eec('0x1a'),_0x5f3704,_0x389457[_0x6eec('0x3')]));if(_0x389457[_0x6eec('0x4')]){for(var _0x240030=0x0;_0x240030<_0x389457['Agents']['length'];_0x240030+=0x1){_0x5af05a[_0xd2927c](util['format']('user:%s',_0x389457[_0x6eec('0x4')][_0x240030][_0x6eec('0x3')]));}}}function joinOrLeave(_0x59fcbe,_0x2489c2,_0x4d91d9){var _0x36cd69;if(_0x59fcbe[_0x6eec('0x1b')][_0x6eec('0x1c')]['id']){db['User']['find']({'attributes':['id',_0x6eec('0x3'),'role',_0x6eec('0x1d')],'where':{'id':_0x59fcbe[_0x6eec('0x1b')][_0x6eec('0x1c')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x6eec('0x1e'),'attributes':['id'],'raw':!![]},{'model':db[_0x6eec('0x1f')],'as':_0x6eec('0x20'),'attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db['SmsInteraction'],'as':_0x6eec('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0x6eec('0x22')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x6eec('0x23'),'attributes':['id'],'raw':!![]}]})[_0x6eec('0x18')](function(_0x4b862c){if(_0x4b862c){_0x36cd69=_0x4b862c;_0x59fcbe[_0x2489c2](util[_0x6eec('0x19')](_0x6eec('0x24'),_0x4b862c[_0x6eec('0x3')]));var _0x1759d2=[];switch(_0x4b862c[_0x6eec('0x5')]){case'admin':_0x59fcbe[_0x2489c2](_0x6eec('0x25'));_0x59fcbe[_0x2489c2](_0x6eec('0x26'));if(queryQueues[_0x6eec('0x27')](_0x6eec('0x28'))){delete queryQueues[_0x6eec('0x28')];}_0x1759d2['push'](db[_0x6eec('0x29')][_0x6eec('0xe')](queryQueues));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x2b')][_0x6eec('0xe')](queryQueues));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x2c')]['findAll'](queryQueues));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x2d')][_0x6eec('0xe')](queryQueues));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x2e')]['findAll'](queryQueues));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x2f')][_0x6eec('0xe')](queryQueues));_0x1759d2[_0x6eec('0x2a')](db['WhatsappQueue'][_0x6eec('0xe')](queryQueues));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x14')][_0x6eec('0xe')](queryTelephones));_0x1759d2['push'](db[_0x6eec('0x30')][_0x6eec('0xe')](queryTrunks));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x16')]['findAll'](queryCampaigns));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x14')]['findAll'](queryAgents));break;case'user':_0x59fcbe[_0x2489c2]('voice:inbound');_0x59fcbe[_0x2489c2](_0x6eec('0x26'));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0xb'),_0x4b862c[_0x6eec('0x1d')],'VoiceQueue'));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0x31'),_0x4b862c[_0x6eec('0x1d')],_0x6eec('0x2b')));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0x32'),_0x4b862c[_0x6eec('0x1d')],'FaxQueue'));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0x33'),_0x4b862c[_0x6eec('0x1d')],_0x6eec('0x2d')));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0xc'),_0x4b862c['userProfileId'],_0x6eec('0x2e')));_0x1759d2['push'](getAssociatedResources(_0x6eec('0x34'),_0x4b862c[_0x6eec('0x1d')],_0x6eec('0x2f')));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources('WhatsappQueues',_0x4b862c[_0x6eec('0x1d')],_0x6eec('0x35')));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0xd'),_0x4b862c['userProfileId'],_0x6eec('0x14')));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0xf'),_0x4b862c['userProfileId'],_0x6eec('0x30')));_0x1759d2[_0x6eec('0x2a')](getAssociatedResources(_0x6eec('0x10'),_0x4b862c[_0x6eec('0x1d')],_0x6eec('0x16')));_0x1759d2[_0x6eec('0x2a')](db[_0x6eec('0x14')][_0x6eec('0xe')](queryAgents));break;case'agent':_0x59fcbe[_0x2489c2](_0x6eec('0x25'));_0x59fcbe[_0x2489c2](_0x6eec('0x26'));_0x1759d2[_0x6eec('0x2a')](_0x4b862c[_0x6eec('0x36')]({'attributes':['id',_0x6eec('0x3')]}));_0x1759d2[_0x6eec('0x2a')](_0x4b862c['getChatQueues']({'attributes':['id','name']}));_0x1759d2[_0x6eec('0x2a')](_0x4b862c[_0x6eec('0x37')]({'attributes':['id',_0x6eec('0x3')]}));_0x1759d2[_0x6eec('0x2a')](_0x4b862c[_0x6eec('0x38')]({'attributes':['id',_0x6eec('0x3')]}));_0x1759d2[_0x6eec('0x2a')](_0x4b862c['getMailQueues']({'attributes':['id',_0x6eec('0x3')]}));_0x1759d2['push'](_0x4b862c['getOpenchannelQueues']({'attributes':['id','name']}));_0x1759d2[_0x6eec('0x2a')](_0x4b862c['getWhatsappQueues']({'attributes':['id','name']}));break;}return BPromise[_0x6eec('0x39')](_0x1759d2);}})['then'](function(_0x2b9c21){if(_0x2b9c21&&_0x2b9c21[_0x6eec('0x3a')]){for(var _0x3e31cb=0x0;_0x3e31cb<_0x2b9c21[_0x6eec('0x3a')];_0x3e31cb+=0x1){for(var _0x400cf5=0x0;_0x400cf5<_0x2b9c21[_0x3e31cb]['length'];_0x400cf5+=0x1){switch(_0x3e31cb){case 0x0:joinOrLeaveQueues(_0x59fcbe,_0x2489c2,_0x6eec('0x3b'),_0x2b9c21[_0x3e31cb][_0x400cf5]);break;case 0x1:joinOrLeaveQueues(_0x59fcbe,_0x2489c2,_0x6eec('0x3c'),_0x2b9c21[_0x3e31cb][_0x400cf5]);break;case 0x2:joinOrLeaveQueues(_0x59fcbe,_0x2489c2,_0x6eec('0x3d'),_0x2b9c21[_0x3e31cb][_0x400cf5]);break;case 0x3:joinOrLeaveQueues(_0x59fcbe,_0x2489c2,_0x6eec('0x3e'),_0x2b9c21[_0x3e31cb][_0x400cf5]);break;case 0x4:joinOrLeaveQueues(_0x59fcbe,_0x2489c2,_0x6eec('0x3f'),_0x2b9c21[_0x3e31cb][_0x400cf5]);break;case 0x5:joinOrLeaveQueues(_0x59fcbe,_0x2489c2,_0x6eec('0x40'),_0x2b9c21[_0x3e31cb][_0x400cf5]);break;case 0x6:joinOrLeaveQueues(_0x59fcbe,_0x2489c2,_0x6eec('0x41'),_0x2b9c21[_0x3e31cb][_0x400cf5]);break;case 0x7:if(_0x36cd69['role']!=='agent')_0x59fcbe[_0x2489c2](util[_0x6eec('0x19')](_0x6eec('0x42'),_0x2b9c21[_0x3e31cb][_0x400cf5][_0x6eec('0x3')]));break;case 0x8:if(_0x36cd69[_0x6eec('0x5')]!==_0x6eec('0x7'))_0x59fcbe[_0x2489c2](util['format'](_0x6eec('0x43'),_0x2b9c21[_0x3e31cb][_0x400cf5][_0x6eec('0x3')]));break;case 0x9:if(_0x36cd69[_0x6eec('0x5')]!==_0x6eec('0x7'))_0x59fcbe[_0x2489c2](util[_0x6eec('0x19')](_0x6eec('0x44'),_0x2b9c21[_0x3e31cb][_0x400cf5]['type'],_0x2b9c21[_0x3e31cb][_0x400cf5][_0x6eec('0x3')]));break;case 0xa:_0x59fcbe[_0x2489c2](util[_0x6eec('0x19')]('user:%s',_0x2b9c21[_0x3e31cb][_0x400cf5][_0x6eec('0x3')]));break;}}}}})[_0x6eec('0x18')](function(){if(_0x2489c2===_0x6eec('0x45')){var _0x4a2bd2=_[_0x6eec('0x12')](_0x36cd69[_0x6eec('0x1e')],'id');return _0x36cd69[_0x6eec('0x46')](_0x4a2bd2)[_0x6eec('0x18')](function(){for(var _0x4779fd=0x0;_0x4779fd<_0x4a2bd2[_0x6eec('0x3a')];_0x4779fd+=0x1){_0x4d91d9[_0x6eec('0x47')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x4a2bd2[_0x4779fd]),'UserId':Number(_0x36cd69['id'])});}});}})['then'](function(){if(_0x2489c2==='leave'){var _0x5700d0=_['map'](_0x36cd69[_0x6eec('0x20')],'id');return _0x36cd69[_0x6eec('0x48')](_0x5700d0)[_0x6eec('0x18')](function(){for(var _0x196af0=0x0;_0x196af0<_0x5700d0[_0x6eec('0x3a')];_0x196af0+=0x1){_0x4d91d9[_0x6eec('0x47')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x5700d0[_0x196af0]),'UserId':Number(_0x36cd69['id'])});}});}})['then'](function(){if(_0x2489c2===_0x6eec('0x45')){var _0x1e4515=_[_0x6eec('0x12')](_0x36cd69['FaxInteractions'],'id');return _0x36cd69['removeFaxInteractions'](_0x1e4515)['then'](function(){for(var _0x526bf4=0x0;_0x526bf4<_0x1e4515[_0x6eec('0x3a')];_0x526bf4+=0x1){_0x4d91d9['emit'](_0x6eec('0x49'),{'FaxInteractionId':Number(_0x1e4515[_0x526bf4]),'UserId':Number(_0x36cd69['id'])});}});}})[_0x6eec('0x18')](function(){if(_0x2489c2==='leave'){var _0x172be8=_[_0x6eec('0x12')](_0x36cd69['SmsInteractions'],'id');return _0x36cd69['removeSmsInteractions'](_0x172be8)[_0x6eec('0x18')](function(){for(var _0x3c95fb=0x0;_0x3c95fb<_0x172be8[_0x6eec('0x3a')];_0x3c95fb+=0x1){_0x4d91d9[_0x6eec('0x47')](_0x6eec('0x4a'),{'SmsInteractionId':Number(_0x172be8[_0x3c95fb]),'UserId':Number(_0x36cd69['id'])});}});}})[_0x6eec('0x18')](function(){if(_0x2489c2==='leave'){var _0x3d5882=_[_0x6eec('0x12')](_0x36cd69[_0x6eec('0x4b')],'id');return _0x36cd69[_0x6eec('0x4c')](_0x3d5882)[_0x6eec('0x18')](function(){for(var _0xc87dfb=0x0;_0xc87dfb<_0x3d5882['length'];_0xc87dfb+=0x1){_0x4d91d9[_0x6eec('0x47')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x3d5882[_0xc87dfb]),'UserId':Number(_0x36cd69['id'])});}});}})['then'](function(){if(_0x2489c2===_0x6eec('0x45')){var _0x57d38d=_[_0x6eec('0x12')](_0x36cd69['WhatsappInteractions'],'id');return _0x36cd69[_0x6eec('0x4d')](_0x57d38d)['then'](function(){for(var _0x286c49=0x0;_0x286c49<_0x57d38d[_0x6eec('0x3a')];_0x286c49+=0x1){_0x4d91d9[_0x6eec('0x47')](_0x6eec('0x4e'),{'WhatsappInteractionId':Number(_0x57d38d[_0x286c49]),'UserId':Number(_0x36cd69['id'])});}});}})[_0x6eec('0x4f')](function(_0x2df25f){_0x59fcbe[_0x6eec('0x50')](_0x2df25f);});}}function onDisconnect(_0x4dc248,_0x311e0c){joinOrLeave(_0x4dc248,'leave',_0x311e0c);}function onConnect(_0x2ebb11){joinOrLeave(_0x2ebb11,_0x6eec('0x51'));}exports[_0x6eec('0x52')]=function(_0x2577f7){_0x2577f7['on'](_0x6eec('0x53'),function(_0x567a48){_0x567a48[_0x6eec('0x54')](0x0);_0x567a48['address']=_0x567a48[_0x6eec('0x55')][_0x6eec('0x53')]['remoteAddress']+':'+_0x567a48[_0x6eec('0x55')][_0x6eec('0x53')][_0x6eec('0x56')];_0x567a48[_0x6eec('0x57')]=new Date();_0x567a48[_0x6eec('0x50')]=function(_0x1c86cf){console['log'](_0x6eec('0x58')+_0x567a48[_0x6eec('0x59')]['name']+'['+_0x567a48[_0x6eec('0x5a')]+']',_0x1c86cf);};_0x567a48['on']('disconnect',function(){onDisconnect(_0x567a48,_0x2577f7);_0x567a48[_0x6eec('0x50')](_0x6eec('0x5b'));});onConnect(_0x567a48);_0x567a48[_0x6eec('0x50')]('CONNECTED');});}; \ No newline at end of file +var _0x87d5=['removeOpenchannelInteractions','user_has_openchannel_interactions:remove','user_has_whatsapp_interactions:remove','log','join','default','connection','setMaxListeners','address','remotePort','connectedAt','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','bluebird','./environment','name','Agents','User','role','agent','type','ivr','UserProfileSection','then','VoiceQueues','ChatQueues','MailQueues','OpenchannelQueues','WhatsappQueues','Telephones','findAll','Trunks','IvrCampaigns','UserProfileResource','where','telephone','Campaign','%s:queue:%s','length','format','query','find','userProfileId','ChatInteractions','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteractions','voice:inbound','voice:outbound','hasOwnProperty','include','push','FaxQueue','MailQueue','OpenchannelQueue','WhatsappQueue','ChatQueue','FaxQueues','SmsQueues','SmsQueue','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','fax','mail','openchannel','whatsapp','telephone:%s','user:%s','leave','map','removeChatInteractions','emit','user_has_chat_interactions:remove','user_has_fax_interactions:remove','SmsInteractions','user_has_sms_interactions:remove'];(function(_0x269645,_0x13e9f2){var _0x4460d3=function(_0x413fbb){while(--_0x413fbb){_0x269645['push'](_0x269645['shift']());}};_0x4460d3(++_0x13e9f2);}(_0x87d5,0x6b));var _0x587d=function(_0xce0b84,_0x2b7229){_0xce0b84=_0xce0b84-0x0;var _0x2267ef=_0x87d5[_0xce0b84];return _0x2267ef;};'use strict';var _=require(_0x587d('0x0'));var util=require('util');var BPromise=require(_0x587d('0x1'));var db=require('../mysqldb')['db'];var config=require(_0x587d('0x2'));var queryQueues={'attributes':['id',_0x587d('0x3')],'include':[{'as':_0x587d('0x4'),'model':db[_0x587d('0x5')],'attributes':['id','name',_0x587d('0x6')],'raw':!![],'where':{'role':_0x587d('0x7')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x587d('0x3')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x587d('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x587d('0x3')],'where':{'role':_0x587d('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name',_0x587d('0x8')],'where':{'type':_0x587d('0x9')}};function getAssociatedResources(_0x1bd7f1,_0x197713,_0x2c8d20){return db[_0x587d('0xa')]['findOne']({'where':{'name':_0x1bd7f1,'userProfileId':_0x197713},'raw':!![]})[_0x587d('0xb')](function(_0x26230e){if(_0x26230e){if(_0x26230e['autoAssociation']){switch(_0x1bd7f1){case _0x587d('0xc'):case _0x587d('0xd'):case'FaxQueues':case'SmsQueues':case _0x587d('0xe'):case _0x587d('0xf'):case _0x587d('0x10'):return db[_0x2c8d20]['findAll'](queryQueues);case _0x587d('0x11'):return db[_0x2c8d20][_0x587d('0x12')](queryTelephones);case _0x587d('0x13'):return db[_0x2c8d20][_0x587d('0x12')](queryTrunks);case _0x587d('0x14'):return db[_0x2c8d20][_0x587d('0x12')](queryCampaigns);}}else{return db[_0x587d('0x15')][_0x587d('0x12')]({'attributes':['resourceId'],'where':{'sectionId':_0x26230e['id']},'raw':!![]})[_0x587d('0xb')](function(_0x4b2b77){if(_0x4b2b77){var _0x272e09={'where':{'id':_['map'](_0x4b2b77,'resourceId')},'raw':!![]};switch(_0x2c8d20){case'User':_0x272e09[_0x587d('0x16')][_0x587d('0x6')]=_0x587d('0x17');break;case _0x587d('0x18'):_0x272e09[_0x587d('0x16')][_0x587d('0x8')]='ivr';break;}return db[_0x2c8d20][_0x587d('0x12')](_0x272e09);}else{return[];}});}}else{return[];}})[_0x587d('0xb')](function(_0x4c66db){return _0x4c66db;});}function joinOrLeaveQueues(_0x4a66da,_0x5721eb,_0x2653c8,_0x3a4f66){_0x4a66da[_0x5721eb](util['format'](_0x587d('0x19'),_0x2653c8,_0x3a4f66['name']));if(_0x3a4f66[_0x587d('0x4')]){for(var _0x2f7717=0x0;_0x2f7717<_0x3a4f66['Agents'][_0x587d('0x1a')];_0x2f7717+=0x1){_0x4a66da[_0x5721eb](util[_0x587d('0x1b')]('user:%s',_0x3a4f66['Agents'][_0x2f7717][_0x587d('0x3')]));}}}function joinOrLeave(_0x45af9e,_0x443c5c,_0x3830a0){var _0x2e8278;if(_0x45af9e['handshake'][_0x587d('0x1c')]['id']){db[_0x587d('0x5')][_0x587d('0x1d')]({'attributes':['id',_0x587d('0x3'),_0x587d('0x6'),_0x587d('0x1e')],'where':{'id':_0x45af9e['handshake'][_0x587d('0x1c')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x587d('0x1f'),'attributes':['id'],'raw':!![]},{'model':db[_0x587d('0x20')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x587d('0x21')],'as':_0x587d('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x587d('0x23')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x587d('0x24')],'as':_0x587d('0x25'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x587d('0x26'),'attributes':['id'],'raw':!![]}]})[_0x587d('0xb')](function(_0x5d3136){if(_0x5d3136){_0x2e8278=_0x5d3136;_0x45af9e[_0x443c5c](util[_0x587d('0x1b')]('user:%s',_0x5d3136[_0x587d('0x3')]));var _0xa2b2a6=[];switch(_0x5d3136['role']){case'admin':_0x45af9e[_0x443c5c](_0x587d('0x27'));_0x45af9e[_0x443c5c](_0x587d('0x28'));if(queryQueues[_0x587d('0x29')](_0x587d('0x2a'))){delete queryQueues[_0x587d('0x2a')];}_0xa2b2a6[_0x587d('0x2b')](db['VoiceQueue']['findAll'](queryQueues));_0xa2b2a6[_0x587d('0x2b')](db['ChatQueue'][_0x587d('0x12')](queryQueues));_0xa2b2a6[_0x587d('0x2b')](db[_0x587d('0x2c')][_0x587d('0x12')](queryQueues));_0xa2b2a6[_0x587d('0x2b')](db['SmsQueue']['findAll'](queryQueues));_0xa2b2a6[_0x587d('0x2b')](db[_0x587d('0x2d')]['findAll'](queryQueues));_0xa2b2a6[_0x587d('0x2b')](db[_0x587d('0x2e')][_0x587d('0x12')](queryQueues));_0xa2b2a6[_0x587d('0x2b')](db[_0x587d('0x2f')]['findAll'](queryQueues));_0xa2b2a6[_0x587d('0x2b')](db['User'][_0x587d('0x12')](queryTelephones));_0xa2b2a6[_0x587d('0x2b')](db['Trunk'][_0x587d('0x12')](queryTrunks));_0xa2b2a6[_0x587d('0x2b')](db['Campaign'][_0x587d('0x12')](queryCampaigns));_0xa2b2a6[_0x587d('0x2b')](db[_0x587d('0x5')][_0x587d('0x12')](queryAgents));break;case'user':_0x45af9e[_0x443c5c]('voice:inbound');_0x45af9e[_0x443c5c](_0x587d('0x28'));_0xa2b2a6['push'](getAssociatedResources(_0x587d('0xc'),_0x5d3136['userProfileId'],'VoiceQueue'));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources(_0x587d('0xd'),_0x5d3136[_0x587d('0x1e')],_0x587d('0x30')));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources(_0x587d('0x31'),_0x5d3136[_0x587d('0x1e')],_0x587d('0x2c')));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources(_0x587d('0x32'),_0x5d3136['userProfileId'],_0x587d('0x33')));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources(_0x587d('0xe'),_0x5d3136['userProfileId'],_0x587d('0x2d')));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources(_0x587d('0xf'),_0x5d3136['userProfileId'],_0x587d('0x2e')));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources(_0x587d('0x10'),_0x5d3136[_0x587d('0x1e')],'WhatsappQueue'));_0xa2b2a6['push'](getAssociatedResources('Telephones',_0x5d3136[_0x587d('0x1e')],_0x587d('0x5')));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources(_0x587d('0x13'),_0x5d3136['userProfileId'],_0x587d('0x34')));_0xa2b2a6[_0x587d('0x2b')](getAssociatedResources('IvrCampaigns',_0x5d3136[_0x587d('0x1e')],_0x587d('0x18')));_0xa2b2a6[_0x587d('0x2b')](db[_0x587d('0x5')][_0x587d('0x12')](queryAgents));break;case _0x587d('0x7'):_0x45af9e[_0x443c5c](_0x587d('0x27'));_0x45af9e[_0x443c5c]('voice:outbound');_0xa2b2a6[_0x587d('0x2b')](_0x5d3136[_0x587d('0x35')]({'attributes':['id','name']}));_0xa2b2a6['push'](_0x5d3136[_0x587d('0x36')]({'attributes':['id',_0x587d('0x3')]}));_0xa2b2a6[_0x587d('0x2b')](_0x5d3136[_0x587d('0x37')]({'attributes':['id',_0x587d('0x3')]}));_0xa2b2a6[_0x587d('0x2b')](_0x5d3136[_0x587d('0x38')]({'attributes':['id',_0x587d('0x3')]}));_0xa2b2a6[_0x587d('0x2b')](_0x5d3136[_0x587d('0x39')]({'attributes':['id','name']}));_0xa2b2a6[_0x587d('0x2b')](_0x5d3136[_0x587d('0x3a')]({'attributes':['id','name']}));_0xa2b2a6['push'](_0x5d3136[_0x587d('0x3b')]({'attributes':['id',_0x587d('0x3')]}));break;}return BPromise['all'](_0xa2b2a6);}})['then'](function(_0x40b6ed){if(_0x40b6ed&&_0x40b6ed['length']){for(var _0x26deda=0x0;_0x26deda<_0x40b6ed[_0x587d('0x1a')];_0x26deda+=0x1){for(var _0x440bd5=0x0;_0x440bd5<_0x40b6ed[_0x26deda][_0x587d('0x1a')];_0x440bd5+=0x1){switch(_0x26deda){case 0x0:joinOrLeaveQueues(_0x45af9e,_0x443c5c,_0x587d('0x3c'),_0x40b6ed[_0x26deda][_0x440bd5]);break;case 0x1:joinOrLeaveQueues(_0x45af9e,_0x443c5c,'chat',_0x40b6ed[_0x26deda][_0x440bd5]);break;case 0x2:joinOrLeaveQueues(_0x45af9e,_0x443c5c,_0x587d('0x3d'),_0x40b6ed[_0x26deda][_0x440bd5]);break;case 0x3:joinOrLeaveQueues(_0x45af9e,_0x443c5c,'sms',_0x40b6ed[_0x26deda][_0x440bd5]);break;case 0x4:joinOrLeaveQueues(_0x45af9e,_0x443c5c,_0x587d('0x3e'),_0x40b6ed[_0x26deda][_0x440bd5]);break;case 0x5:joinOrLeaveQueues(_0x45af9e,_0x443c5c,_0x587d('0x3f'),_0x40b6ed[_0x26deda][_0x440bd5]);break;case 0x6:joinOrLeaveQueues(_0x45af9e,_0x443c5c,_0x587d('0x40'),_0x40b6ed[_0x26deda][_0x440bd5]);break;case 0x7:if(_0x2e8278[_0x587d('0x6')]!==_0x587d('0x7'))_0x45af9e[_0x443c5c](util[_0x587d('0x1b')](_0x587d('0x41'),_0x40b6ed[_0x26deda][_0x440bd5][_0x587d('0x3')]));break;case 0x8:if(_0x2e8278[_0x587d('0x6')]!==_0x587d('0x7'))_0x45af9e[_0x443c5c](util[_0x587d('0x1b')]('trunk:%s',_0x40b6ed[_0x26deda][_0x440bd5][_0x587d('0x3')]));break;case 0x9:if(_0x2e8278[_0x587d('0x6')]!=='agent')_0x45af9e[_0x443c5c](util[_0x587d('0x1b')]('campaign:%s:%s',_0x40b6ed[_0x26deda][_0x440bd5][_0x587d('0x8')],_0x40b6ed[_0x26deda][_0x440bd5][_0x587d('0x3')]));break;case 0xa:_0x45af9e[_0x443c5c](util['format'](_0x587d('0x42'),_0x40b6ed[_0x26deda][_0x440bd5][_0x587d('0x3')]));break;}}}}})[_0x587d('0xb')](function(){if(_0x443c5c===_0x587d('0x43')){var _0x561860=_[_0x587d('0x44')](_0x2e8278[_0x587d('0x1f')],'id');return _0x2e8278[_0x587d('0x45')](_0x561860)[_0x587d('0xb')](function(){for(var _0x4c57c9=0x0;_0x4c57c9<_0x561860[_0x587d('0x1a')];_0x4c57c9+=0x1){_0x3830a0[_0x587d('0x46')](_0x587d('0x47'),{'ChatInteractionId':Number(_0x561860[_0x4c57c9]),'UserId':Number(_0x2e8278['id'])});}});}})[_0x587d('0xb')](function(){if(_0x443c5c===_0x587d('0x43')){var _0x18e6f7=_[_0x587d('0x44')](_0x2e8278['MailInteractions'],'id');return _0x2e8278['removeMailInteractions'](_0x18e6f7)[_0x587d('0xb')](function(){for(var _0x8a671=0x0;_0x8a671<_0x18e6f7[_0x587d('0x1a')];_0x8a671+=0x1){_0x3830a0[_0x587d('0x46')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x18e6f7[_0x8a671]),'UserId':Number(_0x2e8278['id'])});}});}})['then'](function(){if(_0x443c5c==='leave'){var _0x39a4c0=_[_0x587d('0x44')](_0x2e8278[_0x587d('0x22')],'id');return _0x2e8278['removeFaxInteractions'](_0x39a4c0)[_0x587d('0xb')](function(){for(var _0x3053c3=0x0;_0x3053c3<_0x39a4c0[_0x587d('0x1a')];_0x3053c3+=0x1){_0x3830a0[_0x587d('0x46')](_0x587d('0x48'),{'FaxInteractionId':Number(_0x39a4c0[_0x3053c3]),'UserId':Number(_0x2e8278['id'])});}});}})[_0x587d('0xb')](function(){if(_0x443c5c===_0x587d('0x43')){var _0xb1b44b=_['map'](_0x2e8278[_0x587d('0x49')],'id');return _0x2e8278['removeSmsInteractions'](_0xb1b44b)[_0x587d('0xb')](function(){for(var _0x39b781=0x0;_0x39b781<_0xb1b44b[_0x587d('0x1a')];_0x39b781+=0x1){_0x3830a0[_0x587d('0x46')](_0x587d('0x4a'),{'SmsInteractionId':Number(_0xb1b44b[_0x39b781]),'UserId':Number(_0x2e8278['id'])});}});}})['then'](function(){if(_0x443c5c===_0x587d('0x43')){var _0x2ec4b9=_[_0x587d('0x44')](_0x2e8278[_0x587d('0x25')],'id');return _0x2e8278[_0x587d('0x4b')](_0x2ec4b9)[_0x587d('0xb')](function(){for(var _0x35be4c=0x0;_0x35be4c<_0x2ec4b9['length'];_0x35be4c+=0x1){_0x3830a0['emit'](_0x587d('0x4c'),{'OpenchannelInteractionId':Number(_0x2ec4b9[_0x35be4c]),'UserId':Number(_0x2e8278['id'])});}});}})[_0x587d('0xb')](function(){if(_0x443c5c===_0x587d('0x43')){var _0x2be479=_['map'](_0x2e8278[_0x587d('0x26')],'id');return _0x2e8278['removeWhatsappInteractions'](_0x2be479)[_0x587d('0xb')](function(){for(var _0x4b70a5=0x0;_0x4b70a5<_0x2be479['length'];_0x4b70a5+=0x1){_0x3830a0[_0x587d('0x46')](_0x587d('0x4d'),{'WhatsappInteractionId':Number(_0x2be479[_0x4b70a5]),'UserId':Number(_0x2e8278['id'])});}});}})['catch'](function(_0x401f69){_0x45af9e[_0x587d('0x4e')](_0x401f69);});}}function onDisconnect(_0x52a00e,_0x4d0a7a){joinOrLeave(_0x52a00e,'leave',_0x4d0a7a);}function onConnect(_0xf93849){joinOrLeave(_0xf93849,_0x587d('0x4f'));}exports[_0x587d('0x50')]=function(_0x4e71d4){_0x4e71d4['on'](_0x587d('0x51'),function(_0x300608){_0x300608[_0x587d('0x52')](0x0);_0x300608[_0x587d('0x53')]=_0x300608['request'][_0x587d('0x51')]['remoteAddress']+':'+_0x300608['request'][_0x587d('0x51')][_0x587d('0x54')];_0x300608[_0x587d('0x55')]=new Date();_0x300608[_0x587d('0x4e')]=function(_0x4744e3){console[_0x587d('0x4e')](_0x587d('0x56')+_0x300608[_0x587d('0x57')][_0x587d('0x3')]+'['+_0x300608[_0x587d('0x53')]+']',_0x4744e3);};_0x300608['on'](_0x587d('0x58'),function(){onDisconnect(_0x300608,_0x4e71d4);_0x300608['log'](_0x587d('0x59'));});onConnect(_0x300608);_0x300608['log'](_0x587d('0x5a'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 33afc48..db46d5f 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 _0x643a=['ContactId','undefined','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','query','Sequelize','contact','UserId','interface','format','name','agent','channel','incomingmessage','outgoingmessage','AfterCreateMessage','get','offlineMessage','opened','QueryTypes','SELECT','SIP/%s','AfterCreate','changed','closed','substatus','User','find','fullname','internal','default','length','model','hook','callback','toLowerCase','condition','util','../../mysqldb','jayson/promise','../logger','client','http','Chat','ChatInteraction','afterCreate','afterUpdate','closedinteraction','ChatMessage','newmessage','Sms','SmsInteraction','newinteraction','Whatsapp','WhatsappMessage','FaxInteraction','Fax','Mail','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','request','EventManager','info','Trigger,\x20%s','error','code','catch','motionChannel','event','direction','resolve','then'];(function(_0x5948dd,_0x1f6ac8){var _0xb1f8be=function(_0x31a8d2){while(--_0x31a8d2){_0x5948dd['push'](_0x5948dd['shift']());}};_0xb1f8be(++_0x1f6ac8);}(_0x643a,0xb9));var _0xa643=function(_0x50e593,_0x3ae998){_0x50e593=_0x50e593-0x0;var _0x3821d0=_0x643a[_0x50e593];return _0x3821d0;};'use strict';var util=require(_0xa643('0x0'));var db=require(_0xa643('0x1'))['db'];var jayson=require(_0xa643('0x2'));var logger=require(_0xa643('0x3'))('triggers');var client=jayson[_0xa643('0x4')][_0xa643('0x5')]({'port':0x232a});var triggers=[{'channel':_0xa643('0x6'),'model':_0xa643('0x7'),'event':_0xa643('0x8'),'condition':'newinteraction','callback':afterCreate},{'channel':'Chat','model':'ChatInteraction','event':_0xa643('0x9'),'condition':_0xa643('0xa'),'callback':afterUpdate},{'channel':_0xa643('0x6'),'model':_0xa643('0xb'),'event':_0xa643('0x8'),'condition':_0xa643('0xc'),'callback':afterCreateMessage},{'channel':'Chat','model':'ChatOfflineMessage','event':_0xa643('0x8'),'condition':_0xa643('0xc'),'callback':afterCreateOfflineMessage},{'channel':_0xa643('0xd'),'model':_0xa643('0xe'),'event':_0xa643('0x8'),'condition':_0xa643('0xf'),'callback':afterCreate},{'channel':'Sms','model':_0xa643('0xe'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xa643('0xd'),'model':'SmsMessage','event':_0xa643('0x8'),'condition':_0xa643('0xc'),'callback':afterCreateMessage},{'channel':_0xa643('0x10'),'model':'WhatsappInteraction','event':'afterCreate','condition':_0xa643('0xf'),'callback':afterCreate},{'channel':_0xa643('0x10'),'model':'WhatsappInteraction','event':_0xa643('0x9'),'condition':_0xa643('0xa'),'callback':afterUpdate},{'channel':_0xa643('0x10'),'model':_0xa643('0x11'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':'Fax','model':_0xa643('0x12'),'event':'afterCreate','condition':_0xa643('0xf'),'callback':afterCreate},{'channel':_0xa643('0x13'),'model':'FaxInteraction','event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':_0xa643('0x13'),'model':'FaxMessage','event':_0xa643('0x8'),'condition':_0xa643('0xc'),'callback':afterCreateMessage},{'channel':_0xa643('0x14'),'model':_0xa643('0x15'),'event':_0xa643('0x8'),'condition':_0xa643('0xf'),'callback':afterCreate},{'channel':'Mail','model':'MailInteraction','event':'afterUpdate','condition':_0xa643('0xa'),'callback':afterUpdate},{'channel':'Mail','model':_0xa643('0x16'),'event':'afterCreate','condition':_0xa643('0xc'),'callback':afterCreateMessage},{'channel':_0xa643('0x17'),'model':_0xa643('0x18'),'event':'afterCreate','condition':_0xa643('0xf'),'callback':afterCreate},{'channel':'Openchannel','model':_0xa643('0x18'),'event':_0xa643('0x9'),'condition':_0xa643('0xa'),'callback':afterUpdate},{'channel':_0xa643('0x17'),'model':'OpenchannelMessage','event':_0xa643('0x8'),'condition':_0xa643('0xc'),'callback':afterCreateMessage}];function request(_0x286196){return client[_0xa643('0x19')](_0xa643('0x1a'),_0x286196)['then'](function(_0x2f0c80){logger[_0xa643('0x1b')](_0xa643('0x1c'),'EventManager',_0x2f0c80);if(_0x2f0c80['error']){if(_0x2f0c80[_0xa643('0x1d')][_0xa643('0x1e')]===0x1f4){logger[_0xa643('0x1d')](_0xa643('0x1c'),_0xa643('0x1a'),_0x2f0c80[_0xa643('0x1d')]);}}})[_0xa643('0x1f')](function(_0x4a6266){logger[_0xa643('0x1d')](_0xa643('0x1c'),_0xa643('0x1a'),_0x4a6266);});}function afterCreateMessage(_0x2041da){return function(_0x1984bd){_0x1984bd=_0x1984bd['get']({'plain':!![]});_0x1984bd['channel']=_0x2041da;_0x1984bd[_0xa643('0x20')]=_0x2041da;_0x1984bd[_0xa643('0x21')]=_0x1984bd[_0xa643('0x22')];Promise[_0xa643('0x23')]()[_0xa643('0x24')](function(){if(typeof _0x1984bd[_0xa643('0x25')]===_0xa643('0x26'))return null;var _0x440de9=_0xa643('0x27')+_0x1984bd[_0xa643('0x25')];return db[_0xa643('0x28')][_0xa643('0x29')](_0x440de9,{'type':db[_0xa643('0x2a')]['QueryTypes']['SELECT'],'raw':!![]});})['then'](function(_0x527e32){if(_0x527e32){_0x1984bd[_0xa643('0x2b')]=_0x527e32[0x0];}if(typeof _0x1984bd[_0xa643('0x2c')]===_0xa643('0x26'))return;return getAgent(_0x1984bd[_0xa643('0x2c')]);})[_0xa643('0x24')](function(_0x32c55e){if(_0x32c55e){_0x1984bd[_0xa643('0x2d')]=util[_0xa643('0x2e')]('SIP/%s',_0x32c55e[_0xa643('0x2f')]);_0x1984bd[_0xa643('0x30')]=_0x32c55e;_0x1984bd[_0xa643('0x31')]=_0x2041da;return request({'event':_0xa643('0x32'),'message':_0x1984bd});}else{return request({'event':_0xa643('0x33'),'message':_0x1984bd});}})[_0xa643('0x1f')](function(_0xad3170){logger[_0xa643('0x1d')]('Trigger,\x20%s',_0xa643('0x34'),_0xad3170);});};}function afterCreateOfflineMessage(_0x2cb756){return function(_0x12f84f){_0x12f84f=_0x12f84f[_0xa643('0x35')]({'plain':!![]});_0x12f84f['channel']=_0x2cb756;_0x12f84f['motionChannel']=_0x2cb756;_0x12f84f[_0xa643('0x21')]=_0xa643('0x36');return request({'event':_0x12f84f[_0xa643('0x21')],'message':_0x12f84f});};}function afterCreate(_0x445695,_0x561df4){return function(_0xa7b65b){_0xa7b65b=_0xa7b65b[_0xa643('0x35')]({'plain':!![]});_0xa7b65b[_0xa643('0x31')]=_0x445695;_0xa7b65b[_0xa643('0x20')]=_0x445695;_0xa7b65b[_0xa643('0x21')]=_0xa643('0x37');Promise[_0xa643('0x23')]()[_0xa643('0x24')](function(){var _0x18041e=_0xa643('0x27')+_0xa7b65b[_0xa643('0x25')];return db[_0xa643('0x28')]['query'](_0x18041e,{'type':db['Sequelize'][_0xa643('0x38')][_0xa643('0x39')],'raw':!![]});})['then'](function(_0x5422ed){if(_0x5422ed){_0xa7b65b[_0xa643('0x2b')]=_0x5422ed[0x0];}if(typeof _0xa7b65b[_0xa643('0x2c')]==='undefined')return;return getAgent(_0xa7b65b[_0xa643('0x2c')]);})[_0xa643('0x24')](function(_0x4ba0bb){if(_0x4ba0bb){_0xa7b65b[_0xa643('0x2d')]=util[_0xa643('0x2e')](_0xa643('0x3a'),_0x4ba0bb[_0xa643('0x2f')]);_0xa7b65b[_0xa643('0x30')]=_0x4ba0bb;}return request({'event':_0x561df4,'message':_0xa7b65b});})[_0xa643('0x1f')](function(_0x5c757f){logger['error'](_0xa643('0x1c'),_0xa643('0x3b'),_0x5c757f);});};}function afterUpdate(_0x6c788e){return function(_0xa2aba3){var _0x53aefe=_0xa2aba3[_0xa643('0x3c')]('closed')&&_0xa2aba3[_0xa643('0x3d')];var _0x192c58=_0xa2aba3['changed'](_0xa643('0x3e'));if(_0x53aefe||_0x192c58){var _0x380c75=_0x53aefe?_0xa643('0xa'):_0xa643('0x3e');var _0x51443=_0xa2aba3[_0xa643('0x35')]({'plain':!![]});_0x51443[_0xa643('0x31')]=_0x6c788e;_0x51443[_0xa643('0x20')]=_0x6c788e;_0x51443['event']=_0x53aefe?_0xa643('0x3d'):_0xa643('0x3e');var _0x4a1e49=_0xa643('0x27')+_0x51443[_0xa643('0x25')];return db['sequelize']['query'](_0x4a1e49,{'type':db[_0xa643('0x2a')][_0xa643('0x38')]['SELECT'],'raw':!![]})['then'](function(_0x50a221){if(_0x50a221){_0x51443['contact']=_0x50a221[0x0];}if(typeof _0x51443[_0xa643('0x2c')]===_0xa643('0x26'))return;return getAgent(_0x51443[_0xa643('0x2c')]);})[_0xa643('0x24')](function(_0x1e4461){if(_0x1e4461){_0x51443[_0xa643('0x2d')]=util[_0xa643('0x2e')](_0xa643('0x3a'),_0x1e4461['name']);_0x51443[_0xa643('0x30')]=_0x1e4461;}return request({'event':_0x380c75,'message':_0x51443});})[_0xa643('0x1f')](function(_0x25836d){logger[_0xa643('0x1d')]('Trigger,\x20%s','AfterUpdate',_0x25836d);});}};}function getAgent(_0x2e9c1b){return db[_0xa643('0x3f')][_0xa643('0x40')]({'where':{'id':_0x2e9c1b},'attributes':['id',_0xa643('0x2f'),_0xa643('0x41'),'email',_0xa643('0x42')],'raw':!![]})[_0xa643('0x24')](function(_0x13efa9){return _0x13efa9;});}exports[_0xa643('0x43')]=function(){for(var _0x14c5c0=0x0;_0x14c5c0=_0xae91a0[_0xaa89('0x12')]){throw Error(_0xaa89('0x13'));}_0x17a7e4(_0x4e645e);})[_0xaa89('0x14')](function(_0x57b8a5){_0x2b1d9c(_0x57b8a5);});});}; \ No newline at end of file +var _0xea19=['getChannels','isValidChannel','toLowerCase','clearBlockUser','updateAttributes','agent','User','count','then','getLicense','agents','catch','./license/util','voice','mail','chat','fax','sms','whatsapp','openchannel'];(function(_0x28da30,_0x161aad){var _0x551d18=function(_0x2f49d8){while(--_0x2f49d8){_0x28da30['push'](_0x28da30['shift']());}};_0x551d18(++_0x161aad);}(_0xea19,0x1b0));var _0x9ea1=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0xea19[_0xbd08b4];return _0x314f1e;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var db=require('../mysqldb')['db'];var util=require(_0x9ea1('0x0'));var channels=[_0x9ea1('0x1'),_0x9ea1('0x2'),_0x9ea1('0x3'),_0x9ea1('0x4'),_0x9ea1('0x5'),_0x9ea1('0x6'),_0x9ea1('0x7')];exports[_0x9ea1('0x8')]=function(){return channels;};exports[_0x9ea1('0x9')]=function(_0x2b6ded){_0x2b6ded=_0x2b6ded[_0x9ea1('0xa')]();return _['includes'](channels,_0x2b6ded);};exports[_0x9ea1('0xb')]=function(_0x44e4c0,_0x42b00f,_0x25d9d7,_0x349428){var _0x19b61c={'loginAttempts':_0x42b00f,'blocked':_0x25d9d7};if(!_['isUndefined'](_0x349428)){_0x19b61c['blockedAt']=_0x349428;}return _0x44e4c0[_0x9ea1('0xc')](_0x19b61c);};exports['getLicense']=function(_0x5d1639){return new BPromise(function(_0x18dbe2,_0x448bcb){var _0x31191f=0x0;if(_0x5d1639['role']!==_0x9ea1('0xd')){_0x18dbe2(_0x5d1639);}db[_0x9ea1('0xe')][_0x9ea1('0xf')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x5d1639['id']}}})[_0x9ea1('0x10')](function(_0x190b90){_0x31191f=_0x190b90;return util[_0x9ea1('0x11')]();})[_0x9ea1('0x10')](function(_0x5ae5bd){if(_0x5ae5bd&&_0x5ae5bd[_0x9ea1('0x12')]&&_0x31191f>=_0x5ae5bd[_0x9ea1('0x12')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x18dbe2(_0x5d1639);})[_0x9ea1('0x13')](function(_0xf865bf){_0x448bcb(_0xf865bf);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 8d951d7..f891656 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc5cb=['send','util','../config/logger','api','message','name','inherits','Bad\x20Request','Forbidden','Entity\x20not\x20found','Not\x20Found','Message\x20sent\x20outside\x20a\x20valid\x20interval','details','OutOfInterval','Resource\x20Conflict','Out\x20Of\x20Interval','Conflict','error','statusMessage','status'];(function(_0x3d8588,_0x4e514f){var _0x386d48=function(_0x2190cf){while(--_0x2190cf){_0x3d8588['push'](_0x3d8588['shift']());}};_0x386d48(++_0x4e514f);}(_0xc5cb,0x79));var _0xbc5c=function(_0x710dba,_0x32f351){_0x710dba=_0x710dba-0x0;var _0x4676bf=_0xc5cb[_0x710dba];return _0x4676bf;};'use strict';var util=require(_0xbc5c('0x0'));var logger=require(_0xbc5c('0x1'))(_0xbc5c('0x2'));var APIError=function(_0x3c22b4,_0x591923){this[_0xbc5c('0x3')]=_0x3c22b4||'Internal\x20Server\x20Error';this[_0xbc5c('0x4')]=_0x591923||'Error';util[_0xbc5c('0x5')](APIError,Error);};var APIBadRequestError=function(_0x213896){this[_0xbc5c('0x3')]=_0x213896||'Bad\x20Request';this[_0xbc5c('0x4')]=_0xbc5c('0x6');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x5ca480){this['message']=_0x5ca480||'Forbidden';this[_0xbc5c('0x4')]=_0xbc5c('0x7');util[_0xbc5c('0x5')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x488b7e){this[_0xbc5c('0x3')]=_0x488b7e||_0xbc5c('0x8');this[_0xbc5c('0x4')]=_0xbc5c('0x9');util[_0xbc5c('0x5')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x19e2a8){this['message']=_0x19e2a8||_0xbc5c('0xa');this[_0xbc5c('0x4')]='Out\x20Of\x20Interval';this['code']=0x193;this[_0xbc5c('0xb')]={'type':_0xbc5c('0xc')};util['inherits'](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x1fbb81){this[_0xbc5c('0x3')]=_0x1fbb81||_0xbc5c('0xd');this[_0xbc5c('0x4')]='Conflict';util[_0xbc5c('0x5')](APIBadRequestError,APIError);};function getStatusCode(_0x28be25){switch(_0x28be25){case _0xbc5c('0x6'):return 0x190;case'Forbidden',_0xbc5c('0xe'):return 0x193;case _0xbc5c('0x9'):return 0x194;case _0xbc5c('0xf'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x5cb9f5){if(_0x5cb9f5===_0xbc5c('0xe'))return _0x5cb9f5;return null;}function handleError(_0x2e92bf){return function(_0x27e744){logger[_0xbc5c('0x10')](_0x27e744['stack']);var _0x997f0a=getStatusCode(_0x27e744[_0xbc5c('0x4')]);var _0x169c2c=getCustomStatusMessage(_0x27e744['name']);if(_0x27e744[_0xbc5c('0x4')]){delete _0x27e744[_0xbc5c('0x4')];}if(_0x169c2c){_0x2e92bf[_0xbc5c('0x11')]=_0x169c2c;}return _0x2e92bf[_0xbc5c('0x12')](_0x997f0a)[_0xbc5c('0x13')](_0x27e744);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file +var _0xf351=['Bad\x20Request','Forbidden','Entity\x20not\x20found','OutOfInterval','Resource\x20Conflict','Out\x20Of\x20Interval','Not\x20Found','Conflict','send','exports','util','api','message','Internal\x20Server\x20Error','name','Error','inherits'];(function(_0x27e811,_0x20137c){var _0x1627fa=function(_0x4498ca){while(--_0x4498ca){_0x27e811['push'](_0x27e811['shift']());}};_0x1627fa(++_0x20137c);}(_0xf351,0x1a2));var _0x1f35=function(_0x1fc84d,_0x3f469d){_0x1fc84d=_0x1fc84d-0x0;var _0x2658fa=_0xf351[_0x1fc84d];return _0x2658fa;};'use strict';var util=require(_0x1f35('0x0'));var logger=require('../config/logger')(_0x1f35('0x1'));var APIError=function(_0x5530cd,_0x4eb9a7){this[_0x1f35('0x2')]=_0x5530cd||_0x1f35('0x3');this[_0x1f35('0x4')]=_0x4eb9a7||_0x1f35('0x5');util[_0x1f35('0x6')](APIError,Error);};var APIBadRequestError=function(_0x139b85){this[_0x1f35('0x2')]=_0x139b85||_0x1f35('0x7');this['name']=_0x1f35('0x7');util['inherits'](APIBadRequestError,APIError);};var APIForbiddenError=function(_0x28b33b){this['message']=_0x28b33b||_0x1f35('0x8');this[_0x1f35('0x4')]=_0x1f35('0x8');util[_0x1f35('0x6')](APIForbiddenError,APIError);};var APINotFoundError=function(_0x13261d){this[_0x1f35('0x2')]=_0x13261d||_0x1f35('0x9');this[_0x1f35('0x4')]='Not\x20Found';util[_0x1f35('0x6')](APINotFoundError,APIError);};var APIOutOfIntervalError=function(_0x25d8fd){this['message']=_0x25d8fd||'Message\x20sent\x20outside\x20a\x20valid\x20interval';this[_0x1f35('0x4')]='Out\x20Of\x20Interval';this['code']=0x193;this['details']={'type':_0x1f35('0xa')};util[_0x1f35('0x6')](APIOutOfIntervalError,APIError);};var APIConflictError=function(_0x122204){this['message']=_0x122204||_0x1f35('0xb');this[_0x1f35('0x4')]='Conflict';util[_0x1f35('0x6')](APIBadRequestError,APIError);};function getStatusCode(_0x46835a){switch(_0x46835a){case _0x1f35('0x7'):return 0x190;case _0x1f35('0x8'),_0x1f35('0xc'):return 0x193;case _0x1f35('0xd'):return 0x194;case _0x1f35('0xe'):return 0x199;default:return 0x1f4;}}function getCustomStatusMessage(_0x56a43f){if(_0x56a43f===_0x1f35('0xc'))return _0x56a43f;return null;}function handleError(_0x5e087f){return function(_0x325ea5){logger['error'](_0x325ea5['stack']);var _0x1eab9f=getStatusCode(_0x325ea5[_0x1f35('0x4')]);var _0x396373=getCustomStatusMessage(_0x325ea5[_0x1f35('0x4')]);if(_0x325ea5[_0x1f35('0x4')]){delete _0x325ea5[_0x1f35('0x4')];}if(_0x396373){_0x5e087f['statusMessage']=_0x396373;}return _0x5e087f['status'](_0x1eab9f)[_0x1f35('0xf')](_0x325ea5);};}module[_0x1f35('0x10')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APIForbiddenError':APIForbiddenError,'APINotFoundError':APINotFoundError,'APIOutOfIntervalError':APIOutOfIntervalError,'APIConflict':APIConflictError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 8c89128..f164eb1 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbafb=['404','status','render','json','send'];(function(_0x1bd323,_0x1c16ab){var _0x13097b=function(_0x4cc5de){while(--_0x4cc5de){_0x1bd323['push'](_0x1bd323['shift']());}};_0x13097b(++_0x1c16ab);}(_0xbafb,0xf0));var _0xbbaf=function(_0x23b01d,_0x5e5a41){_0x23b01d=_0x23b01d-0x0;var _0x17e94d=_0xbafb[_0x23b01d];return _0x17e94d;};'use strict';module['exports'][0x194]=function pageNotFound(_0x517de3,_0x5c6764){var _0x46b0fd=_0xbbaf('0x0');var _0x1d9347=0x194;var _0x251ac4={'status':_0x1d9347};_0x5c6764[_0xbbaf('0x1')](_0x251ac4[_0xbbaf('0x1')]);_0x5c6764[_0xbbaf('0x2')](_0x46b0fd,{},function(_0x593fd8,_0x2de5d1){if(_0x593fd8){return _0x5c6764['status'](_0x251ac4[_0xbbaf('0x1')])[_0xbbaf('0x3')](_0x251ac4);}_0x5c6764[_0xbbaf('0x4')](_0x2de5d1);});}; \ No newline at end of file +var _0x5f5f=['json','exports','404','status','render'];(function(_0x2dad3b,_0x15d88a){var _0x314df5=function(_0x5f4fc5){while(--_0x5f4fc5){_0x2dad3b['push'](_0x2dad3b['shift']());}};_0x314df5(++_0x15d88a);}(_0x5f5f,0x178));var _0xf5f5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5f5f[_0x3dd15e];return _0x231fd0;};'use strict';module[_0xf5f5('0x0')][0x194]=function pageNotFound(_0x5921d5,_0x4343b0){var _0xf0c0f0=_0xf5f5('0x1');var _0x5821d2=0x194;var _0x1f30f6={'status':_0x5821d2};_0x4343b0[_0xf5f5('0x2')](_0x1f30f6[_0xf5f5('0x2')]);_0x4343b0[_0xf5f5('0x3')](_0xf0c0f0,{},function(_0x350061,_0x1774bf){if(_0x350061){return _0x4343b0[_0xf5f5('0x2')](_0x1f30f6[_0xf5f5('0x2')])[_0xf5f5('0x4')](_0x1f30f6);}_0x4343b0['send'](_0x1774bf);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 2ad56e7..29a563c 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7aab=['../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userSmsQueue/userSmsQueue.model','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','MailServerIn','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','MailApplication','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','FaxQueue','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','../api/chatApplication/chatApplication.model','ChatInteraction','../api/chatInteraction/chatInteraction.model','../api/chatMessage/chatMessage.model','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmHopper/cmHopper.model','CmHopperFinal','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','CmCustomField','Action','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','CmContactHasItem','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Template','../api/template/template.model','../api/trigger/trigger.model','Variable','../api/variable/variable.model','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','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoConfiguration/intZohoConfiguration.model','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','Team','Campaign','../api/campaign/campaign.model','Migration','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','MailTransferReport','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','../api/whatsappInteraction/whatsappInteraction.model','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','../api/userVoicePrefix/userVoicePrefix.model','UserSetting','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','hasOne','UserId','User','userSetting','hasMany','Recordings','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','SmsInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','CmHopper','Hoppers','SET\x20NULL','belongsTo','userProfileId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','user_has_teams','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','MailQueues','UserMailQueue','ChatQueues','FaxQueues','UserSmsQueue','UserOpenchannelQueue','WhatsappQueues','cm_user_has_lists','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','SpiedAgents','cascade','VoiceContext','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Members','VoiceQueueId','HopperHistories','CmHopperBlack','JscriptySessionReport','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','VoiceMailMessage','Messages','mailboxuser','mailbox','uniqueid','VoiceAgentReport','Contact','ContactId','MailAccountId','CloudProviderId','restrict','Imap','Smtp','Answers','Interactions','List','TemplateId','mandatoryDispositionPauseId','MailQueue','team_has_mail_queues','MailInteractionId','Account','Owner','Tags','mail_interaction_has_tags','ThroughTags','Users','Attachment','Attachments','Interaction','ChatOfflineMessage','TagId','ListId','Dashboard','Items','Dispositions','FaxAccountId','FaxApplication','user_has_fax_accounts','fax_interaction_has_tags','FaxInteractionId','team_has_fax_queues','SmsAccountId','SmsInteractionId','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','OpenchannelQueueId','OpenchannelInteractionId','AttachmentId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','ChatMessage','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','ChatOfflineMessageId','CmCompany','CompanyId','Phones','CmContactId','ChatInteractions','cm_contact_has_tags','AdditionalPhones','CmHopperId','OwnerId','CampaignId','Condition','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','CustomReportId','Mohs','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','Hopper','Trigger','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticFieldReport','Fields','DefaultReportId','MetricId','AccountId','Subjects','FieldId','SubjectId','Description','Field','VariableId','Configurations','DescriptionId','DeskAccount','Descriptions','int_desk_configuration_has_tags','Subject','ZohoConfiguration','ZohoField','ZendeskAccount','ZendeskField','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerField','ServicenowAccount','ServicenowConfiguration','FromId','ToId','JscriptyQuestionReport','SmsQueueReport','ProjectId','VoiceQueues','team_has_chat_queues','SmsQueues','OpenchannelQueues','team_has_whatsapp_queues','VoicePrefixes','SquareProject','SquareProjectId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailQueueId','ToAccount','FromChatWebsiteId','ToChatQueueId','ToQueue','ToChatWebsiteId','FaxTransferReport','FromFaxAccountId','FromUserId','ToFaxAccountId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','UserVoicePrefix','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappMessage','user_has_whatsapp_accounts','WhatsappInteractionId','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','WhatsappQueueId','user','../config/environment','sequelize','lodash','jstz','defaultsDeep','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','xcall','database','username','password','options','import','VoiceChanSpy','VoiceExtension','../api/voiceExtension/voiceExtension.model','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport'];(function(_0x26da5e,_0x2f4830){var _0x19932c=function(_0x681c95){while(--_0x681c95){_0x26da5e['push'](_0x26da5e['shift']());}};_0x19932c(++_0x2f4830);}(_0x7aab,0x1e5));var _0xb7aa=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7aab[_0x14add3];return _0x4a174f;};'use strict';var config=require(_0xb7aa('0x0'));var Sequelize=require(_0xb7aa('0x1'));var _=require(_0xb7aa('0x2'));var jstz=require(_0xb7aa('0x3'));var timezone=jstz['determine']();config['sequelize']=_[_0xb7aa('0x4')](config[_0xb7aa('0x1')],{'database':'motion2','username':'xcall','password':_0xb7aa('0x5'),'options':{'host':_0xb7aa('0x6'),'port':0xcea,'dialect':_0xb7aa('0x7'),'dialectOptions':{'charset':_0xb7aa('0x8')},'logging':![],'timezone':timezone[_0xb7aa('0x9')](),'define':{'charset':_0xb7aa('0xa'),'collate':_0xb7aa('0xb')}}});config['sequelizeHistory']=_[_0xb7aa('0x4')](config[_0xb7aa('0xc')],{'database':_0xb7aa('0xd'),'username':_0xb7aa('0xe'),'password':_0xb7aa('0x5'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xb7aa('0x7'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xb7aa('0x9')](),'define':{'charset':_0xb7aa('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb7aa('0x1')][_0xb7aa('0xf')],config['sequelize'][_0xb7aa('0x10')],config[_0xb7aa('0x1')][_0xb7aa('0x11')],config['sequelize'][_0xb7aa('0x12')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb7aa('0xc')][_0xb7aa('0xf')],config[_0xb7aa('0xc')]['username'],config[_0xb7aa('0xc')][_0xb7aa('0x11')],config[_0xb7aa('0xc')][_0xb7aa('0x12')])};db['User']=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/user/user.model');db[_0xb7aa('0x14')]=db[_0xb7aa('0x1')]['import']('../api/voiceChanSpy/voiceChanSpy.model');db['VoiceContext']=db['sequelize'][_0xb7aa('0x13')]('../api/voiceContext/voiceContext.model');db[_0xb7aa('0x15')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x16'));db['VoiceMusicOnHold']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x17'));db[_0xb7aa('0x18')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x19'));db[_0xb7aa('0x1a')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x1b'));db['ScreenRecording']=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/screenRecording/screenRecording.model');db[_0xb7aa('0x1c')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x1d'));db['VoiceMailMessage']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x1e'));db[_0xb7aa('0x1f')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x20'));db[_0xb7aa('0x21')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x22'));db[_0xb7aa('0x23')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x24'));db[_0xb7aa('0x25')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x26'));db[_0xb7aa('0x27')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x28'));db[_0xb7aa('0x29')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x2a'));db[_0xb7aa('0x2b')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x2c'));db[_0xb7aa('0x2d')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xb7aa('0x2e')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x2f'));db['UserMailQueue']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x30'));db[_0xb7aa('0x31')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/userFaxQueue/userFaxQueue.model');db['UserSmsQueue']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x32'));db['UserOpenchannelQueue']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x33'));db[_0xb7aa('0x34')]=db[_0xb7aa('0x1')]['import']('../api/userWhatsappQueue/userWhatsappQueue.model');db[_0xb7aa('0x35')]=db['sequelize'][_0xb7aa('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0xb7aa('0x36')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x37'));db[_0xb7aa('0x38')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x39'));db['MailQueue']=db['sequelize']['import'](_0xb7aa('0x3a'));db['MailSubstatus']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x3b'));db[_0xb7aa('0x3c')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x3d'));db[_0xb7aa('0x3e')]=db[_0xb7aa('0x1')]['import']('../api/mailMessage/mailMessage.model');db[_0xb7aa('0x3f')]=db['sequelize'][_0xb7aa('0x13')]('../api/mailApplication/mailApplication.model');db[_0xb7aa('0x40')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x41'));db['Dashboard']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x42'));db[_0xb7aa('0x43')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x44'));db[_0xb7aa('0x45')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x46'));db['FaxApplication']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x47'));db[_0xb7aa('0x48')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x49'));db[_0xb7aa('0x4a')]=db['sequelize'][_0xb7aa('0x13')]('../api/faxMessage/faxMessage.model');db[_0xb7aa('0x4b')]=db[_0xb7aa('0x1')]['import']('../api/faxQueue/faxQueue.model');db[_0xb7aa('0x4c')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x4d'));db[_0xb7aa('0x4e')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/smsAccount/smsAccount.model');db[_0xb7aa('0x4f')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x50'));db[_0xb7aa('0x51')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x52'));db[_0xb7aa('0x53')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x54'));db[_0xb7aa('0x55')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x56'));db[_0xb7aa('0x57')]=db['sequelize'][_0xb7aa('0x13')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x58'));db[_0xb7aa('0x59')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x5a'));db[_0xb7aa('0x5b')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x5c'));db[_0xb7aa('0x5d')]=db[_0xb7aa('0x1')]['import']('../api/openchannelQueue/openchannelQueue.model');db[_0xb7aa('0x5e')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x5f'));db[_0xb7aa('0x60')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0xb7aa('0x61')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x62'));db[_0xb7aa('0x63')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x64'));db['ChatMessage']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x65'));db['ChatOfflineMessage']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x66'));db[_0xb7aa('0x67')]=db['sequelize']['import'](_0xb7aa('0x68'));db[_0xb7aa('0x69')]=db['sequelize'][_0xb7aa('0x13')]('../api/chatGroup/chatGroup.model');db[_0xb7aa('0x6a')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x6b'));db['CmCompany']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x6c'));db['CmContact']=db[_0xb7aa('0x1')]['import']('../api/cmContact/cmContact.model');db['CmHopper']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x6d'));db['CmHopperBlack']=db[_0xb7aa('0x1')]['import']('../api/cmHopperBlack/cmHopperBlack.model');db[_0xb7aa('0x6e')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/cmHopperFinal/cmHopperFinal.model');db[_0xb7aa('0x6f')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x70'));db[_0xb7aa('0x71')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/reportAgentPreview/reportAgentPreview.model');db[_0xb7aa('0x72')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/cmCustomField/cmCustomField.model');db[_0xb7aa('0x73')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/action/action.model');db[_0xb7aa('0x74')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x75'));db[_0xb7aa('0x76')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x77'));db[_0xb7aa('0x78')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x79'));db['Condition']=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x7a'));db[_0xb7aa('0x7b')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x7c'));db[_0xb7aa('0x7d')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x7e'));db[_0xb7aa('0x7f')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x80'));db['VoiceQueuesLog']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x81'));db[_0xb7aa('0x82')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x83'));db[_0xb7aa('0x84')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/sound/sound.model');db[_0xb7aa('0x85')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x86'));db[_0xb7aa('0x87')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x88'));db[_0xb7aa('0x89')]=db[_0xb7aa('0x1')]['import']('../api/cmContactHasItem/cmContactHasItem.model');db[_0xb7aa('0x8a')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x8b'));db[_0xb7aa('0x8c')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x8d'));db['Trigger']=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x8e'));db[_0xb7aa('0x8f')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x90'));db['Integration']=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/integration/integration.model');db[_0xb7aa('0x91')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x92'));db[_0xb7aa('0x93')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x94'));db[_0xb7aa('0x95')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x96'));db[_0xb7aa('0x97')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x98'));db[_0xb7aa('0x99')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x9a'));db['AnalyticFieldReport']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x9b'));db[_0xb7aa('0x9c')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xb7aa('0x9d')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x9e'));db[_0xb7aa('0x9f')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xa0'));db[_0xb7aa('0xa1')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/intSalesforceField/intSalesforceField.model');db[_0xb7aa('0xa2')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0xa3'));db[_0xb7aa('0xa4')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xa5'));db[_0xb7aa('0xa6')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xa7'));db['DeskAccount']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xa8'));db[_0xb7aa('0xa9')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xaa'));db[_0xb7aa('0xab')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xac'));db[_0xb7aa('0xad')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0xae'));db['ZohoConfiguration']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xaf'));db['ZohoField']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xb0'));db['ZendeskAccount']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xb1'));db[_0xb7aa('0xb2')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0xb3'));db['ZendeskField']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xb4'));db[_0xb7aa('0xb5')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xb6'));db['FreshdeskConfiguration']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xb7'));db[_0xb7aa('0xb8')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xb9'));db[_0xb7aa('0xba')]=db['sequelize']['import']('../api/intVtigerAccount/intVtigerAccount.model');db[_0xb7aa('0xbb')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xbc'));db['VtigerField']=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/intVtigerField/intVtigerField.model');db['ServicenowAccount']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xbd'));db['ServicenowConfiguration']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xbe'));db[_0xb7aa('0xbf')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xc0'));db[_0xb7aa('0xc1')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xc2'));db[_0xb7aa('0xc3')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0xc4'));db[_0xb7aa('0xc5')]=db['sequelize']['import']('../api/intDynamics365Field/intDynamics365Field.model');db[_0xb7aa('0xc6')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xb7aa('0xc7')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xb7aa('0xc8')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xc9'));db[_0xb7aa('0xca')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0xcb'));db[_0xb7aa('0xcc')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0xcd'));db[_0xb7aa('0xce')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xcf'));db[_0xb7aa('0xd0')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0xd1'));db[_0xb7aa('0xd2')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/jscriptyAnswerReport/jscriptyAnswerReport.model');db['JscriptyQuestionReport']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xd3'));db['JscriptySessionReport']=db[_0xb7aa('0x1')]['import'](_0xb7aa('0xd4'));db['SmsQueueReport']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xd5'));db[_0xb7aa('0xd6')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xd7'));db[_0xb7aa('0xd8')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0xd9'));db[_0xb7aa('0xda')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xdb'));db[_0xb7aa('0xdc')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xdd'));db[_0xb7aa('0xde')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xdf'));db['SquareProject']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xe0'));db[_0xb7aa('0xe1')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xe2'));db[_0xb7aa('0xe3')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xe4'));db[_0xb7aa('0xe5')]=db['sequelize']['import']('../api/team/team.model');db['License']=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/license/license.model');db[_0xb7aa('0xe6')]=db['sequelize']['import'](_0xb7aa('0xe7'));db[_0xb7aa('0xe8')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/migration/migration.model');db['Attachment']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xe9'));db[_0xb7aa('0xea')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xeb'));db[_0xb7aa('0xec')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0xb7aa('0xed')]=db['sequelize']['import'](_0xb7aa('0xee'));db['FaxTransferReport']=db[_0xb7aa('0x1')]['import'](_0xb7aa('0xef'));db[_0xb7aa('0xf0')]=db[_0xb7aa('0x1')]['import']('../api/openchannelTransferReport/openchannelTransferReport.model');db[_0xb7aa('0xf1')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xf2'));db[_0xb7aa('0xf3')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xf4'));db[_0xb7aa('0xf5')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xf6'));db[_0xb7aa('0xf7')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0xf8'));db[_0xb7aa('0xf9')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0xfa'));db[_0xb7aa('0xfb')]=db['sequelize']['import'](_0xb7aa('0xfc'));db[_0xb7aa('0xfd')]=db[_0xb7aa('0x1')]['import'](_0xb7aa('0xfe'));db[_0xb7aa('0xff')]=db['sequelize']['import'](_0xb7aa('0x100'));db[_0xb7aa('0x101')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x102'));db['WhatsappInteraction']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x103'));db['WhatsappMessage']=db[_0xb7aa('0x1')]['import'](_0xb7aa('0x104'));db[_0xb7aa('0x105')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x106'));db[_0xb7aa('0x107')]=db['sequelize']['import'](_0xb7aa('0x108'));db[_0xb7aa('0x109')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')]('../api/whatsappQueue/whatsappQueue.model');db[_0xb7aa('0x10a')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x10b'));db[_0xb7aa('0x10c')]=db['sequelize'][_0xb7aa('0x13')](_0xb7aa('0x10d'));db[_0xb7aa('0x10e')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x10f'));db['UserVoicePrefix']=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x110'));db[_0xb7aa('0x111')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x112'));db[_0xb7aa('0x113')]=db[_0xb7aa('0x1')][_0xb7aa('0x13')](_0xb7aa('0x114'));db['User'][_0xb7aa('0x115')](db[_0xb7aa('0x1c')],{'as':_0xb7aa('0x1c'),'onDelete':'cascade','foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x117')]['hasOne'](db[_0xb7aa('0x111')],{'as':_0xb7aa('0x118'),'onDelete':'cascade','foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x117')][_0xb7aa('0x119')](db['VoiceRecording'],{'as':_0xb7aa('0x11a'),'foreignKey':_0xb7aa('0x116')});db['User'][_0xb7aa('0x119')](db['UserVoiceQueueRt'],{'as':'VoiceQueuesRt','foreignKey':_0xb7aa('0x116')});db['User'][_0xb7aa('0x119')](db[_0xb7aa('0x15')],{'as':_0xb7aa('0x11b'),'onDelete':'cascade','hooks':!![]});db[_0xb7aa('0x117')]['hasMany'](db[_0xb7aa('0x6e')],{'as':_0xb7aa('0x11c'),'foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x117')]['hasMany'](db['CmHopperHistory'],{'as':_0xb7aa('0x11d'),'foreignKey':'UserId'});db[_0xb7aa('0x117')][_0xb7aa('0x119')](db['ReportAgentPreview'],{'as':_0xb7aa('0x71'),'foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x117')][_0xb7aa('0x119')](db[_0xb7aa('0x59')],{'as':_0xb7aa('0x11e'),'foreignKey':_0xb7aa('0x116')});db['User'][_0xb7aa('0x119')](db[_0xb7aa('0x63')],{'as':'ChatInteractions','foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x117')][_0xb7aa('0x119')](db['SmsInteraction'],{'as':_0xb7aa('0x11f'),'foreignKey':_0xb7aa('0x116')});db['User'][_0xb7aa('0x119')](db[_0xb7aa('0x48')],{'as':'FaxInteractions','foreignKey':_0xb7aa('0x116')});db['User'][_0xb7aa('0x119')](db[_0xb7aa('0x3c')],{'as':_0xb7aa('0x120'),'foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x117')][_0xb7aa('0x119')](db[_0xb7aa('0x121')],{'as':_0xb7aa('0x122'),'foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x117')]['hasMany'](db['UserNotification'],{'as':_0xb7aa('0x123'),'foreignKey':'SenderId'});db[_0xb7aa('0x117')]['hasMany'](db[_0xb7aa('0x124')],{'as':_0xb7aa('0x125'),'foreignKey':_0xb7aa('0x116'),'onDelete':_0xb7aa('0x126')});db['User'][_0xb7aa('0x127')](db[_0xb7aa('0xf7')],{'as':'UserProfile','foreignKey':_0xb7aa('0x128')});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db['ChatGroup'],{'as':_0xb7aa('0x12a'),'through':_0xb7aa('0x12b')});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x12d'),'through':_0xb7aa('0x12e')});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x12f'),'through':'cm_user_has_lists'});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'through':_0xb7aa('0x130')});db[_0xb7aa('0x117')]['belongsToMany'](db[_0xb7aa('0x3c')],{'as':_0xb7aa('0x120'),'through':'user_has_mail_interactions'});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x63')],{'as':'ChatInteractions','through':_0xb7aa('0x131')});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x48')],{'as':_0xb7aa('0x132'),'through':_0xb7aa('0x133')});db[_0xb7aa('0x117')]['belongsToMany'](db[_0xb7aa('0x51')],{'as':_0xb7aa('0x11f'),'through':_0xb7aa('0x134')});db[_0xb7aa('0x117')]['belongsToMany'](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','through':_0xb7aa('0x135')});db[_0xb7aa('0x117')]['belongsToMany'](db[_0xb7aa('0x121')],{'as':_0xb7aa('0x122'),'through':_0xb7aa('0x136')});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x18')],{'as':'VoiceQueues','through':_0xb7aa('0x2d'),'required':![]});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0xf5')],{'as':'VoicePrefixes','through':'UserVoicePrefix','required':![]});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db['MailQueue'],{'as':_0xb7aa('0x137'),'through':_0xb7aa('0x138'),'required':![]});db[_0xb7aa('0x117')]['belongsToMany'](db[_0xb7aa('0x67')],{'as':_0xb7aa('0x139'),'through':_0xb7aa('0x2e'),'required':![],'hooks':!![]});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x4b')],{'as':_0xb7aa('0x13a'),'through':_0xb7aa('0x31'),'required':![]});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x55')],{'as':'SmsQueues','through':_0xb7aa('0x13b'),'required':![]});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x5d')],{'as':'OpenchannelQueues','through':_0xb7aa('0x13c'),'required':![]});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0x109')],{'as':_0xb7aa('0x13d'),'through':_0xb7aa('0x34'),'required':![]});db[_0xb7aa('0x117')][_0xb7aa('0x129')](db[_0xb7aa('0xf3')],{'through':_0xb7aa('0x13e')});db['User'][_0xb7aa('0x129')](db[_0xb7aa('0x5e')],{'as':_0xb7aa('0x13f'),'through':_0xb7aa('0x140')});db['User'][_0xb7aa('0x129')](db[_0xb7aa('0x45')],{'as':_0xb7aa('0x141'),'through':'user_has_fax_accounts'});db['User'][_0xb7aa('0x129')](db[_0xb7aa('0x38')],{'as':'MailAccounts','through':_0xb7aa('0x142')});db[_0xb7aa('0x117')]['belongsToMany'](db[_0xb7aa('0x57')],{'as':_0xb7aa('0x143'),'through':_0xb7aa('0x144')});db[_0xb7aa('0x117')]['belongsToMany'](db['SmsAccount'],{'as':_0xb7aa('0x145'),'through':_0xb7aa('0x146')});db[_0xb7aa('0x117')]['belongsToMany'](db[_0xb7aa('0xff')],{'as':_0xb7aa('0x147'),'through':'user_has_whatsapp_accounts'});db[_0xb7aa('0x14')][_0xb7aa('0x119')](db[_0xb7aa('0x15')],{'as':_0xb7aa('0x148'),'onDelete':_0xb7aa('0x149'),'foreignKey':'ChanSpyId'});db[_0xb7aa('0x14a')][_0xb7aa('0x119')](db['VoiceExtension'],{'onDelete':_0xb7aa('0x149')});db['VoiceExtension'][_0xb7aa('0x119')](db[_0xb7aa('0x15')],{'as':_0xb7aa('0x14b'),'onDelete':'cascade'});db[_0xb7aa('0x14c')][_0xb7aa('0x129')](db[_0xb7aa('0x84')],{'as':_0xb7aa('0x14d'),'through':_0xb7aa('0x14e')});db[_0xb7aa('0x18')][_0xb7aa('0x119')](db[_0xb7aa('0x2b')],{'as':_0xb7aa('0x14f'),'foreignKey':_0xb7aa('0x150')});db[_0xb7aa('0x18')][_0xb7aa('0x119')](db[_0xb7aa('0x124')],{'as':_0xb7aa('0x125'),'foreignKey':_0xb7aa('0x150')});db[_0xb7aa('0x18')][_0xb7aa('0x119')](db[_0xb7aa('0x6e')],{'as':_0xb7aa('0x11c'),'foreignKey':_0xb7aa('0x150')});db[_0xb7aa('0x18')][_0xb7aa('0x119')](db['CmHopperHistory'],{'as':_0xb7aa('0x151'),'foreignKey':_0xb7aa('0x150')});db[_0xb7aa('0x18')][_0xb7aa('0x119')](db[_0xb7aa('0x71')],{'as':_0xb7aa('0x71'),'foreignKey':'VoiceQueueId'});db[_0xb7aa('0x18')][_0xb7aa('0x119')](db[_0xb7aa('0x152')],{'as':'HopperBlacks','foreignKey':_0xb7aa('0x150')});db[_0xb7aa('0x18')][_0xb7aa('0x119')](db[_0xb7aa('0x153')],{'as':_0xb7aa('0x154'),'foreignKey':_0xb7aa('0x150')});db[_0xb7aa('0x18')]['belongsTo'](db[_0xb7aa('0x27')],{'as':_0xb7aa('0x27'),'foreignKey':_0xb7aa('0x155')});db[_0xb7aa('0x18')][_0xb7aa('0x127')](db['Trunk'],{'as':_0xb7aa('0x156'),'foreignKey':_0xb7aa('0x157')});db[_0xb7aa('0x18')]['belongsTo'](db[_0xb7aa('0x7b')],{'as':_0xb7aa('0x7b'),'foreignKey':_0xb7aa('0x158')});db['VoiceQueue']['belongsTo'](db['Pause'],{'as':_0xb7aa('0x159'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xb7aa('0x18')][_0xb7aa('0x129')](db['CmList'],{'as':_0xb7aa('0x12f'),'through':_0xb7aa('0x15a')});db[_0xb7aa('0x18')]['belongsToMany'](db['User'],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x2d')});db['VoiceQueue'][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'as':_0xb7aa('0x15c'),'through':'TeamVoiceQueue'});db[_0xb7aa('0x18')][_0xb7aa('0x129')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x15d'),'through':_0xb7aa('0x15e')});db[_0xb7aa('0x1a')][_0xb7aa('0x127')](db['User'],{'as':'User','foreignKey':'UserId'});db['ScreenRecording']['belongsTo'](db['User'],{'as':'User','foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x1c')]['hasMany'](db[_0xb7aa('0x15f')],{'as':_0xb7aa('0x160'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x161'),'sourceKey':_0xb7aa('0x162')});db[_0xb7aa('0x15f')]['belongsTo'](db[_0xb7aa('0x1c')],{'foreignKey':'mailboxuser','targetKey':_0xb7aa('0x162')});db[_0xb7aa('0x1f')][_0xb7aa('0x119')](db[_0xb7aa('0x23')],{'as':'QueueCalls','foreignKey':_0xb7aa('0x163'),'constraints':![]});db[_0xb7aa('0x1f')][_0xb7aa('0x119')](db[_0xb7aa('0x164')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0xb7aa('0x1f')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x117'),'foreignKey':_0xb7aa('0x116')});db['VoiceCallReport'][_0xb7aa('0x127')](db['CmContact'],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x35')][_0xb7aa('0x127')](db['MailAccount'],{'as':_0xb7aa('0x38'),'foreignKey':_0xb7aa('0x167')});db['MailServerIn'][_0xb7aa('0x127')](db['CloudProvider'],{'as':_0xb7aa('0x10a'),'foreignKey':_0xb7aa('0x168'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x36')]['belongsTo'](db[_0xb7aa('0x38')],{'as':_0xb7aa('0x38'),'foreignKey':_0xb7aa('0x167')});db['MailServerOut']['belongsTo'](db[_0xb7aa('0x10a')],{'as':_0xb7aa('0x10a'),'foreignKey':_0xb7aa('0x168'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x38')][_0xb7aa('0x115')](db[_0xb7aa('0x35')],{'as':_0xb7aa('0x16a'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x38')][_0xb7aa('0x115')](db[_0xb7aa('0x36')],{'as':_0xb7aa('0x16b'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x38')][_0xb7aa('0x119')](db[_0xb7aa('0x78')],{'as':'Dispositions','foreignKey':_0xb7aa('0x167'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x38')][_0xb7aa('0x119')](db[_0xb7aa('0x76')],{'as':_0xb7aa('0x16c'),'foreignKey':_0xb7aa('0x167')});db[_0xb7aa('0x38')][_0xb7aa('0x119')](db[_0xb7aa('0x3e')],{'as':'Messages','foreignKey':_0xb7aa('0x167')});db[_0xb7aa('0x38')][_0xb7aa('0x119')](db[_0xb7aa('0x3c')],{'as':_0xb7aa('0x16d')});db[_0xb7aa('0x38')][_0xb7aa('0x119')](db['MailApplication'],{'as':'Applications','foreignKey':_0xb7aa('0x167'),'onDelete':'cascade'});db[_0xb7aa('0x38')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':'ListId'});db[_0xb7aa('0x38')]['belongsTo'](db['Template'],{'as':'Template','foreignKey':_0xb7aa('0x16f')});db[_0xb7aa('0x38')][_0xb7aa('0x127')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xb7aa('0x170')});db['MailAccount'][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':'Agents','through':_0xb7aa('0x142')});db[_0xb7aa('0x171')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':'Agents','through':'UserMailQueue'});db[_0xb7aa('0x171')][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'through':_0xb7aa('0x172'),'as':'Teams'});db[_0xb7aa('0x3c')][_0xb7aa('0x119')](db['MailMessage'],{'as':_0xb7aa('0x160'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x173')});db['MailInteraction'][_0xb7aa('0x127')](db[_0xb7aa('0x38')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x167')});db[_0xb7aa('0x3c')][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'as':'Contact','foreignKey':'ContactId'});db[_0xb7aa('0x3c')]['belongsTo'](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x175'),'foreignKey':'UserId'});db[_0xb7aa('0x3c')]['belongsToMany'](db[_0xb7aa('0x85')],{'through':'mail_interaction_has_tags','as':_0xb7aa('0x176')});db[_0xb7aa('0x3c')][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':_0xb7aa('0x177'),'as':_0xb7aa('0x178')});db[_0xb7aa('0x3c')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x179'),'through':'user_has_mail_interactions','foreignKey':_0xb7aa('0x173')});db[_0xb7aa('0x3e')][_0xb7aa('0x119')](db[_0xb7aa('0x17a')],{'as':_0xb7aa('0x17b'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x3e')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x117')});db['MailMessage']['belongsTo'](db[_0xb7aa('0x12c')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x165')});db['MailMessage'][_0xb7aa('0x127')](db['MailInteraction'],{'as':_0xb7aa('0x17c'),'foreignKey':_0xb7aa('0x173')});db[_0xb7aa('0x3e')][_0xb7aa('0x127')](db[_0xb7aa('0x38')],{'as':'Account','foreignKey':_0xb7aa('0x167')});db[_0xb7aa('0x3e')]['belongsTo'](db[_0xb7aa('0x5e')],{'as':'ChatWebsite','foreignKey':'ChatWebsiteId'});db['MailMessage'][_0xb7aa('0x127')](db[_0xb7aa('0x17d')],{'as':'ChatOfflineMessage','foreignKey':'ChatOfflineMessageId'});db[_0xb7aa('0x3f')]['belongsTo'](db[_0xb7aa('0x117')],{'onDelete':'restrict'});db[_0xb7aa('0x3f')][_0xb7aa('0x127')](db['MailQueue'],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x3f')]['belongsTo'](db[_0xb7aa('0x38')],{'onDelete':_0xb7aa('0x169')});db['MailApplication']['belongsTo'](db[_0xb7aa('0x7b')],{'onDelete':_0xb7aa('0x169'),'foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0x3f')]['belongsTo'](db[_0xb7aa('0x85')],{'onDelete':_0xb7aa('0x169'),'foreignKey':_0xb7aa('0x17e')});db[_0xb7aa('0x40')]['belongsTo'](db[_0xb7aa('0x38')],{});db[_0xb7aa('0x40')][_0xb7aa('0x127')](db['CmList'],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0x40')][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':'ContactId'});db[_0xb7aa('0x40')][_0xb7aa('0x127')](db[_0xb7aa('0x3c')],{});db[_0xb7aa('0x40')]['belongsTo'](db['MailMessage'],{});db['MailQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{});db[_0xb7aa('0x40')]['belongsTo'](db[_0xb7aa('0x171')],{});db[_0xb7aa('0x180')]['hasMany'](db[_0xb7aa('0x43')],{'as':_0xb7aa('0x181'),'onDelete':_0xb7aa('0x149')});db['FaxAccount'][_0xb7aa('0x119')](db[_0xb7aa('0x78')],{'as':_0xb7aa('0x182'),'foreignKey':_0xb7aa('0x183'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x45')][_0xb7aa('0x119')](db['CannedAnswer'],{'as':_0xb7aa('0x16c'),'foreignKey':_0xb7aa('0x183')});db['FaxAccount']['hasMany'](db[_0xb7aa('0x48')],{'as':'Interactions'});db[_0xb7aa('0x45')][_0xb7aa('0x119')](db[_0xb7aa('0x184')],{'as':'Applications','foreignKey':_0xb7aa('0x183'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x45')]['hasMany'](db['VoiceExtension'],{'as':'Exntensions','onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x45')][_0xb7aa('0x119')](db[_0xb7aa('0x4a')],{'as':'Messages'});db['FaxAccount'][_0xb7aa('0x127')](db[_0xb7aa('0x27')],{'as':_0xb7aa('0x27')});db['FaxAccount'][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':'List','foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0x45')]['belongsTo'](db[_0xb7aa('0x7d')],{'as':_0xb7aa('0x159'),'foreignKey':_0xb7aa('0x170')});db[_0xb7aa('0x45')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':'Agents','through':_0xb7aa('0x185')});db[_0xb7aa('0x184')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'onDelete':'restrict'});db[_0xb7aa('0x184')][_0xb7aa('0x127')](db[_0xb7aa('0x4b')],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x184')]['belongsTo'](db[_0xb7aa('0x45')],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x184')][_0xb7aa('0x127')](db[_0xb7aa('0x85')],{'onDelete':'restrict','foreignKey':_0xb7aa('0x17e')});db[_0xb7aa('0x48')]['hasMany'](db[_0xb7aa('0x4a')],{'as':_0xb7aa('0x160'),'onDelete':_0xb7aa('0x149'),'foreignKey':'FaxInteractionId'});db[_0xb7aa('0x48')][_0xb7aa('0x127')](db[_0xb7aa('0x45')],{'as':'Account','foreignKey':_0xb7aa('0x183')});db['FaxInteraction'][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db['FaxInteraction'][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':'Owner','foreignKey':'UserId'});db['FaxInteraction'][_0xb7aa('0x129')](db['Tag'],{'through':_0xb7aa('0x186'),'as':'Tags'});db[_0xb7aa('0x48')][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':'fax_interaction_has_tags','as':_0xb7aa('0x178')});db[_0xb7aa('0x48')]['belongsToMany'](db['User'],{'as':_0xb7aa('0x179'),'through':_0xb7aa('0x133'),'foreignKey':'FaxInteractionId'});db[_0xb7aa('0x4a')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x117')});db[_0xb7aa('0x4a')][_0xb7aa('0x127')](db[_0xb7aa('0x48')],{'as':'Interaction','foreignKey':_0xb7aa('0x187')});db[_0xb7aa('0x4a')][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'onDelete':_0xb7aa('0x149'),'as':'Contact'});db[_0xb7aa('0x4a')][_0xb7aa('0x127')](db[_0xb7aa('0x17a')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xb7aa('0x4a')]['belongsTo'](db['FaxAccount'],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x183')});db[_0xb7aa('0x4b')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x31')});db[_0xb7aa('0x4b')][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'through':_0xb7aa('0x188'),'as':'Teams'});db[_0xb7aa('0x4c')][_0xb7aa('0x127')](db[_0xb7aa('0x45')],{});db[_0xb7aa('0x4c')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':'List','foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0x4c')][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x4c')][_0xb7aa('0x127')](db[_0xb7aa('0x48')],{});db[_0xb7aa('0x4c')]['belongsTo'](db[_0xb7aa('0x4a')],{});db[_0xb7aa('0x4c')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{});db[_0xb7aa('0x4c')][_0xb7aa('0x127')](db[_0xb7aa('0x4b')],{});db[_0xb7aa('0x4e')][_0xb7aa('0x119')](db[_0xb7aa('0x78')],{'as':'Dispositions','foreignKey':_0xb7aa('0x189'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x4e')][_0xb7aa('0x119')](db[_0xb7aa('0x76')],{'as':'Answers','foreignKey':'SmsAccountId'});db[_0xb7aa('0x4e')]['hasMany'](db[_0xb7aa('0x53')],{'as':_0xb7aa('0x160'),'foreignKey':_0xb7aa('0x189')});db['SmsAccount'][_0xb7aa('0x119')](db['SmsInteraction'],{'as':'Interactions'});db[_0xb7aa('0x4e')][_0xb7aa('0x119')](db[_0xb7aa('0x4f')],{'as':_0xb7aa('0x14b'),'foreignKey':'SmsAccountId','onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x4e')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0x4e')]['belongsTo'](db[_0xb7aa('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0xb7aa('0x170')});db[_0xb7aa('0x4e')]['belongsToMany'](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x146')});db[_0xb7aa('0x4f')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x4f')]['belongsTo'](db[_0xb7aa('0x55')],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x4f')]['belongsTo'](db[_0xb7aa('0x4e')],{'onDelete':_0xb7aa('0x169')});db['SmsApplication']['belongsTo'](db[_0xb7aa('0x7b')],{'onDelete':_0xb7aa('0x169'),'foreignKey':_0xb7aa('0x158')});db['SmsApplication'][_0xb7aa('0x127')](db[_0xb7aa('0x85')],{'onDelete':_0xb7aa('0x169'),'foreignKey':_0xb7aa('0x17e')});db['SmsInteraction'][_0xb7aa('0x119')](db[_0xb7aa('0x53')],{'as':_0xb7aa('0x160'),'onDelete':'cascade','foreignKey':'SmsInteractionId'});db[_0xb7aa('0x51')][_0xb7aa('0x127')](db[_0xb7aa('0x4e')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x189')});db[_0xb7aa('0x51')]['belongsTo'](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db['SmsInteraction'][_0xb7aa('0x127')](db['User'],{'as':'Owner','foreignKey':_0xb7aa('0x116')});db['SmsInteraction'][_0xb7aa('0x129')](db['Tag'],{'through':'sms_interaction_has_tags','as':_0xb7aa('0x176')});db[_0xb7aa('0x51')][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':'sms_interaction_has_tags','as':_0xb7aa('0x178')});db[_0xb7aa('0x51')]['belongsToMany'](db[_0xb7aa('0x117')],{'as':'Users','through':_0xb7aa('0x134'),'foreignKey':_0xb7aa('0x18a')});db[_0xb7aa('0x53')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':'User'});db['SmsMessage'][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x165')});db['SmsMessage'][_0xb7aa('0x127')](db[_0xb7aa('0x51')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x17c'),'foreignKey':'SmsInteractionId'});db[_0xb7aa('0x53')][_0xb7aa('0x127')](db['SmsAccount'],{'as':'Account','foreignKey':_0xb7aa('0x189')});db[_0xb7aa('0x55')][_0xb7aa('0x129')](db['User'],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x13b'),'foreignKey':_0xb7aa('0x18b')});db[_0xb7aa('0x55')][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'through':_0xb7aa('0x18c'),'as':_0xb7aa('0x15c')});db[_0xb7aa('0x57')][_0xb7aa('0x119')](db[_0xb7aa('0x78')],{'as':'Dispositions','foreignKey':'OpenchannelAccountId','onDelete':_0xb7aa('0x149')});db['OpenchannelAccount']['hasMany'](db['CannedAnswer'],{'as':_0xb7aa('0x16c'),'foreignKey':_0xb7aa('0x18d')});db[_0xb7aa('0x57')][_0xb7aa('0x119')](db[_0xb7aa('0x59')],{'as':'Interactions','foreignKey':_0xb7aa('0x18d')});db[_0xb7aa('0x57')][_0xb7aa('0x119')](db['OpenchannelMessage'],{'as':_0xb7aa('0x160'),'foreignKey':_0xb7aa('0x18d')});db[_0xb7aa('0x57')][_0xb7aa('0x119')](db[_0xb7aa('0x18e')],{'as':'Applications','foreignKey':_0xb7aa('0x18d'),'onDelete':_0xb7aa('0x149')});db['OpenchannelAccount'][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f')});db['OpenchannelAccount'][_0xb7aa('0x127')](db['Pause'],{'as':_0xb7aa('0x159'),'foreignKey':_0xb7aa('0x170')});db[_0xb7aa('0x57')]['belongsToMany'](db[_0xb7aa('0x117')],{'as':'Agents','through':_0xb7aa('0x144')});db[_0xb7aa('0x18e')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x18e')]['belongsTo'](db[_0xb7aa('0x5d')],{'onDelete':'restrict','foreignKey':_0xb7aa('0x18f')});db[_0xb7aa('0x18e')]['belongsTo'](db['OpenchannelAccount'],{'onDelete':_0xb7aa('0x169'),'foreignKey':'OpenchannelAccountId'});db[_0xb7aa('0x18e')][_0xb7aa('0x127')](db[_0xb7aa('0x7b')],{'onDelete':'restrict','foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0x18e')][_0xb7aa('0x127')](db['Tag'],{'onDelete':_0xb7aa('0x169'),'foreignKey':_0xb7aa('0x17e')});db[_0xb7aa('0x59')][_0xb7aa('0x119')](db[_0xb7aa('0x5b')],{'as':'Messages','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x190')});db[_0xb7aa('0x59')][_0xb7aa('0x127')](db[_0xb7aa('0x57')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x18d')});db[_0xb7aa('0x59')]['belongsTo'](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':'ContactId'});db[_0xb7aa('0x59')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x175'),'foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x59')][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':'openchannel_interaction_has_tags','as':_0xb7aa('0x176')});db['OpenchannelInteraction'][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':'openchannel_interaction_has_tags','as':_0xb7aa('0x178')});db[_0xb7aa('0x59')][_0xb7aa('0x129')](db['User'],{'as':_0xb7aa('0x179'),'through':_0xb7aa('0x135'),'foreignKey':_0xb7aa('0x190')});db[_0xb7aa('0x5b')][_0xb7aa('0x127')](db['User'],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x117')});db[_0xb7aa('0x5b')][_0xb7aa('0x127')](db['CmContact'],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x165')});db[_0xb7aa('0x5b')]['belongsTo'](db[_0xb7aa('0x59')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x17c'),'foreignKey':'OpenchannelInteractionId'});db[_0xb7aa('0x5b')][_0xb7aa('0x127')](db[_0xb7aa('0x17a')],{'as':'Attachment','foreignKey':_0xb7aa('0x191')});db[_0xb7aa('0x5b')][_0xb7aa('0x127')](db[_0xb7aa('0x57')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x18d')});db[_0xb7aa('0x5d')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x13c'),'foreignKey':_0xb7aa('0x18f')});db[_0xb7aa('0x5d')][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'through':_0xb7aa('0x192'),'as':_0xb7aa('0x15c')});db[_0xb7aa('0x5e')][_0xb7aa('0x119')](db[_0xb7aa('0x78')],{'as':_0xb7aa('0x182'),'foreignKey':_0xb7aa('0x193'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x5e')][_0xb7aa('0x119')](db[_0xb7aa('0x76')],{'as':'Answers','foreignKey':_0xb7aa('0x193')});db[_0xb7aa('0x5e')]['hasMany'](db[_0xb7aa('0x6a')],{'as':_0xb7aa('0x194')});db[_0xb7aa('0x5e')]['hasMany'](db[_0xb7aa('0x63')],{'as':_0xb7aa('0x16d')});db[_0xb7aa('0x5e')][_0xb7aa('0x119')](db[_0xb7aa('0x61')],{'as':_0xb7aa('0x14b'),'foreignKey':'ChatWebsiteId','onDelete':_0xb7aa('0x149')});db['ChatWebsite'][_0xb7aa('0x119')](db[_0xb7aa('0x195')],{'as':_0xb7aa('0x160')});db['ChatWebsite']['belongsTo'](db[_0xb7aa('0xf3')],{'as':'List','foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0x5e')]['belongsTo'](db[_0xb7aa('0x7b')],{'as':'Interval','foreignKey':_0xb7aa('0x158')});db['ChatWebsite']['belongsTo'](db[_0xb7aa('0x38')],{'as':'MailAccount','foreignKey':_0xb7aa('0x167')});db[_0xb7aa('0x5e')]['belongsTo'](db[_0xb7aa('0x7d')],{'as':_0xb7aa('0x159'),'foreignKey':_0xb7aa('0x170')});db[_0xb7aa('0x5e')][_0xb7aa('0x129')](db['User'],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x140')});db[_0xb7aa('0x60')]['belongsTo'](db[_0xb7aa('0x57')],{});db[_0xb7aa('0x60')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':'List','foreignKey':_0xb7aa('0x17f')});db['OpenchannelQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':'ContactId'});db[_0xb7aa('0x60')][_0xb7aa('0x127')](db[_0xb7aa('0x59')],{});db[_0xb7aa('0x60')][_0xb7aa('0x127')](db[_0xb7aa('0x5b')],{});db['OpenchannelQueueReport'][_0xb7aa('0x127')](db['User'],{});db[_0xb7aa('0x60')][_0xb7aa('0x127')](db['OpenchannelQueue'],{});db[_0xb7aa('0x61')]['belongsTo'](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x196'),'foreignKey':_0xb7aa('0x116'),'onDelete':_0xb7aa('0x169')});db['ChatApplication'][_0xb7aa('0x127')](db[_0xb7aa('0x67')],{'as':_0xb7aa('0x197'),'foreignKey':_0xb7aa('0x198'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x61')][_0xb7aa('0x127')](db['ChatWebsite'],{'as':_0xb7aa('0x199'),'foreignKey':_0xb7aa('0x193'),'onDelete':_0xb7aa('0x169')});db['ChatApplication'][_0xb7aa('0x127')](db[_0xb7aa('0x85')],{'onDelete':'restrict','foreignKey':_0xb7aa('0x17e')});db[_0xb7aa('0x63')][_0xb7aa('0x119')](db[_0xb7aa('0x195')],{'as':_0xb7aa('0x160'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x19a')});db[_0xb7aa('0x63')]['belongsTo'](db[_0xb7aa('0x5e')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x193')});db[_0xb7aa('0x63')]['belongsTo'](db[_0xb7aa('0x12c')],{'as':'Contact','foreignKey':'ContactId'});db[_0xb7aa('0x63')][_0xb7aa('0x127')](db['User'],{'as':_0xb7aa('0x175'),'foreignKey':_0xb7aa('0x116')});db[_0xb7aa('0x63')]['belongsToMany'](db[_0xb7aa('0x85')],{'through':_0xb7aa('0x19b'),'as':'Tags'});db[_0xb7aa('0x63')][_0xb7aa('0x129')](db['Tag'],{'through':_0xb7aa('0x19b'),'as':_0xb7aa('0x178')});db[_0xb7aa('0x63')]['belongsToMany'](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x179'),'through':_0xb7aa('0x131'),'foreignKey':_0xb7aa('0x19a')});db[_0xb7aa('0x195')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x117')});db[_0xb7aa('0x195')][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x195')]['belongsTo'](db[_0xb7aa('0x63')],{'onDelete':'cascade','as':_0xb7aa('0x17c'),'foreignKey':_0xb7aa('0x19a')});db[_0xb7aa('0x195')]['belongsTo'](db['Attachment'],{'as':_0xb7aa('0x17a'),'foreignKey':_0xb7aa('0x191')});db[_0xb7aa('0x195')][_0xb7aa('0x127')](db[_0xb7aa('0x5e')],{'as':_0xb7aa('0x174'),'foreignKey':'ChatWebsiteId'});db[_0xb7aa('0x17d')][_0xb7aa('0x119')](db[_0xb7aa('0x17a')],{'as':_0xb7aa('0x17b'),'foreignKey':_0xb7aa('0x19c'),'onDelete':'cascade','hooks':!![]});db['ChatOfflineMessage'][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'onDelete':_0xb7aa('0x149'),'as':'Contact','foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x17d')][_0xb7aa('0x127')](db['ChatWebsite'],{'as':_0xb7aa('0x174'),'foreignKey':'ChatWebsiteId'});db[_0xb7aa('0x67')]['belongsToMany'](db[_0xb7aa('0x117')],{'as':'Agents','through':'UserChatQueue','hooks':!![]});db[_0xb7aa('0x67')][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'through':'team_has_chat_queues','as':_0xb7aa('0x15c')});db[_0xb7aa('0x69')][_0xb7aa('0x119')](db[_0xb7aa('0xd0')],{'as':_0xb7aa('0x160'),'foreignKey':'ChatGroupId','onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x69')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x14f'),'through':_0xb7aa('0x12b')});db[_0xb7aa('0x6a')][_0xb7aa('0x127')](db[_0xb7aa('0x5e')],{'as':_0xb7aa('0x199'),'foreignKey':_0xb7aa('0x193')});db[_0xb7aa('0x19d')][_0xb7aa('0x119')](db[_0xb7aa('0x12c')],{'as':'Contacts','foreignKey':_0xb7aa('0x19e')});db['CmContact'][_0xb7aa('0x119')](db[_0xb7aa('0x89')],{'as':_0xb7aa('0x19f'),'foreignKey':_0xb7aa('0x1a0')});db[_0xb7aa('0x12c')]['hasMany'](db[_0xb7aa('0x124')],{'as':_0xb7aa('0x125'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x12c')][_0xb7aa('0x119')](db[_0xb7aa('0x6e')],{'as':_0xb7aa('0x11c'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x12c')][_0xb7aa('0x119')](db[_0xb7aa('0x6f')],{'as':_0xb7aa('0x151'),'foreignKey':_0xb7aa('0x166')});db['CmContact'][_0xb7aa('0x119')](db['ReportAgentPreview'],{'as':_0xb7aa('0x71'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x12c')][_0xb7aa('0x119')](db[_0xb7aa('0x153')],{'as':_0xb7aa('0x154'),'foreignKey':'ContactId'});db[_0xb7aa('0x12c')]['hasMany'](db[_0xb7aa('0x59')],{'as':_0xb7aa('0x11e'),'foreignKey':_0xb7aa('0x166'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x12c')][_0xb7aa('0x119')](db[_0xb7aa('0x63')],{'as':_0xb7aa('0x1a1'),'foreignKey':_0xb7aa('0x166'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x12c')][_0xb7aa('0x119')](db[_0xb7aa('0x51')],{'as':'SmsInteractions','foreignKey':_0xb7aa('0x166'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x12c')][_0xb7aa('0x119')](db[_0xb7aa('0x48')],{'as':_0xb7aa('0x132'),'foreignKey':_0xb7aa('0x166'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x12c')][_0xb7aa('0x119')](db[_0xb7aa('0x3c')],{'as':_0xb7aa('0x120'),'foreignKey':_0xb7aa('0x166'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x12c')][_0xb7aa('0x127')](db[_0xb7aa('0x19d')],{'as':'Company','foreignKey':_0xb7aa('0x19e')});db[_0xb7aa('0x12c')]['belongsTo'](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f'),'onDelete':'cascade'});db[_0xb7aa('0x12c')][_0xb7aa('0x129')](db['User'],{'as':_0xb7aa('0x179'),'through':_0xb7aa('0x12e')});db[_0xb7aa('0x12c')]['belongsToMany'](db[_0xb7aa('0x85')],{'as':'Tags','through':_0xb7aa('0x1a2')});db[_0xb7aa('0x12c')][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':_0xb7aa('0x1a2'),'as':'ThroughTags'});db[_0xb7aa('0x124')][_0xb7aa('0x119')](db['CmHopperAdditionalPhone'],{'as':_0xb7aa('0x1a3'),'foreignKey':_0xb7aa('0x1a4')});db['CmHopper'][_0xb7aa('0x127')](db['CmContact'],{'as':'Contact','foreignKey':_0xb7aa('0x166'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x124')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':'List','foreignKey':_0xb7aa('0x17f'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x124')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x196'),'foreignKey':'UserId'});db[_0xb7aa('0x124')][_0xb7aa('0x127')](db['VoiceQueue'],{'as':_0xb7aa('0x197'),'foreignKey':_0xb7aa('0x150'),'onDelete':_0xb7aa('0x149')});db['CmHopper']['belongsTo'](db[_0xb7aa('0xe6')],{'as':_0xb7aa('0xe6'),'foreignKey':'CampaignId','onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x124')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x175'),'foreignKey':_0xb7aa('0x1a5')});db['CmHopperBlack'][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x152')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x152')][_0xb7aa('0x127')](db[_0xb7aa('0x18')],{'as':_0xb7aa('0x197'),'foreignKey':_0xb7aa('0x150'),'onDelete':_0xb7aa('0x149')});db['CmHopperBlack']['belongsTo'](db[_0xb7aa('0xe6')],{'as':_0xb7aa('0xe6'),'foreignKey':_0xb7aa('0x1a6'),'onDelete':'cascade'});db[_0xb7aa('0x74')][_0xb7aa('0x119')](db[_0xb7aa('0x1a7')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0xb7aa('0x1a8'),'onDelete':_0xb7aa('0x149'),'hooks':!![]});db['Automation'][_0xb7aa('0x119')](db[_0xb7aa('0x1a7')],{'as':{'plural':_0xb7aa('0x1a9'),'singular':_0xb7aa('0x1aa')},'foreignKey':_0xb7aa('0x1ab'),'onDelete':_0xb7aa('0x149'),'hooks':!![]});db['Automation'][_0xb7aa('0x119')](db[_0xb7aa('0x73')],{'as':_0xb7aa('0x1ac'),'foreignKey':'AutomationId','onDelete':_0xb7aa('0x149'),'hooks':!![]});db[_0xb7aa('0x78')][_0xb7aa('0x119')](db['Disposition'],{'as':_0xb7aa('0x182'),'foreignKey':_0xb7aa('0x1ad'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x7b')][_0xb7aa('0x119')](db[_0xb7aa('0x7b')],{'as':_0xb7aa('0x1ae'),'foreignKey':_0xb7aa('0x158'),'onDelete':_0xb7aa('0x149'),'hooks':!![],'required':![]});db['Interval'][_0xb7aa('0x119')](db['VoiceExtension'],{'as':_0xb7aa('0x11b'),'foreignKey':_0xb7aa('0x158'),'onDelete':'restrict'});db[_0xb7aa('0x7b')][_0xb7aa('0x119')](db['MailApplication'],{'as':_0xb7aa('0x1af'),'foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0x7b')][_0xb7aa('0x119')](db[_0xb7aa('0x61')],{'as':_0xb7aa('0x1b0'),'foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0x7b')][_0xb7aa('0x119')](db[_0xb7aa('0x184')],{'as':_0xb7aa('0x1b1'),'foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0x7b')][_0xb7aa('0x119')](db[_0xb7aa('0x4f')],{'as':_0xb7aa('0x1b2'),'foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0x82')][_0xb7aa('0x127')](db[_0xb7aa('0x38')],{});db['Schedule'][_0xb7aa('0x127')](db[_0xb7aa('0x95')],{'foreignKey':'DefaultReportId'});db[_0xb7aa('0x82')][_0xb7aa('0x127')](db['AnalyticCustomReport'],{'foreignKey':_0xb7aa('0x1b3')});db[_0xb7aa('0x84')][_0xb7aa('0x129')](db['VoiceMusicOnHold'],{'as':_0xb7aa('0x1b4'),'through':_0xb7aa('0x14e'),'onDelete':_0xb7aa('0x169')});db['Tag'][_0xb7aa('0x129')](db[_0xb7aa('0x12c')],{'through':_0xb7aa('0x1a2')});db[_0xb7aa('0x85')][_0xb7aa('0x129')](db[_0xb7aa('0x63')],{'through':_0xb7aa('0x19b')});db[_0xb7aa('0x85')][_0xb7aa('0x129')](db[_0xb7aa('0x3c')],{'through':'mail_interaction_has_tags'});db[_0xb7aa('0x85')][_0xb7aa('0x129')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0xb7aa('0x85')][_0xb7aa('0x129')](db[_0xb7aa('0x48')],{'through':_0xb7aa('0x186')});db[_0xb7aa('0x85')][_0xb7aa('0x129')](db[_0xb7aa('0x59')],{'through':_0xb7aa('0x1b5')});db[_0xb7aa('0x85')]['belongsToMany'](db[_0xb7aa('0x121')],{'through':_0xb7aa('0x1b6')});db[_0xb7aa('0x89')]['belongsTo'](db[_0xb7aa('0x87')],{'as':'ItemType','foreignKey':'ItemTypeId'});db[_0xb7aa('0x8a')][_0xb7aa('0x127')](db[_0xb7aa('0x124')],{'as':_0xb7aa('0x1b7'),'foreignKey':_0xb7aa('0x1a4')});db[_0xb7aa('0x89')][_0xb7aa('0x127')](db['CmContact'],{'as':'Contact','foreignKey':_0xb7aa('0x1a0')});db[_0xb7aa('0x1b8')][_0xb7aa('0x119')](db[_0xb7aa('0x1a7')],{'as':{'plural':_0xb7aa('0x1b9'),'singular':_0xb7aa('0x1ba')},'foreignKey':_0xb7aa('0x1bb'),'onDelete':'cascade','hooks':!![]});db[_0xb7aa('0x1b8')][_0xb7aa('0x119')](db['Condition'],{'as':{'plural':_0xb7aa('0x1bc'),'singular':_0xb7aa('0x1bd')},'foreignKey':_0xb7aa('0x1be'),'onDelete':_0xb7aa('0x149'),'hooks':!![]});db[_0xb7aa('0x1b8')][_0xb7aa('0x119')](db[_0xb7aa('0x73')],{'as':'Actions','foreignKey':'TriggerId','onDelete':'cascade','hooks':!![]});db[_0xb7aa('0x93')][_0xb7aa('0x119')](db[_0xb7aa('0x1bf')],{'as':_0xb7aa('0x1c0'),'onDelete':'cascade','foreignKey':_0xb7aa('0x1b3'),'hooks':!![]});db['AnalyticDefaultReport'][_0xb7aa('0x119')](db[_0xb7aa('0x1bf')],{'as':_0xb7aa('0x1c0'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c1')});db[_0xb7aa('0x99')][_0xb7aa('0x119')](db['AnalyticFieldReport'],{'as':_0xb7aa('0x1c0'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c2')});db[_0xb7aa('0x1bf')][_0xb7aa('0x127')](db[_0xb7aa('0x99')],{'foreignKey':_0xb7aa('0x1c2')});db[_0xb7aa('0x9d')][_0xb7aa('0x119')](db[_0xb7aa('0x9f')],{'as':'Configurations','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0x9f')][_0xb7aa('0x119')](db[_0xb7aa('0xa1')],{'as':_0xb7aa('0x1c4'),'onDelete':_0xb7aa('0x149'),'foreignKey':'SubjectId'});db[_0xb7aa('0x9f')][_0xb7aa('0x119')](db[_0xb7aa('0xa1')],{'as':'Descriptions','onDelete':_0xb7aa('0x149'),'foreignKey':'DescriptionId'});db[_0xb7aa('0x9f')]['hasMany'](db['SalesforceField'],{'as':_0xb7aa('0x1c0'),'onDelete':'cascade','foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0x9f')][_0xb7aa('0x127')](db['SalesforceAccount'],{'as':_0xb7aa('0x174'),'foreignKey':'AccountId'});db['SalesforceField'][_0xb7aa('0x119')](db[_0xb7aa('0xa1')],{'as':'Subject','foreignKey':_0xb7aa('0x1c6')});db['SalesforceField']['hasMany'](db['SalesforceField'],{'as':_0xb7aa('0x1c7'),'foreignKey':'DescriptionId'});db['SalesforceField'][_0xb7aa('0x119')](db[_0xb7aa('0xa1')],{'as':_0xb7aa('0x1c8'),'foreignKey':'FieldId'});db[_0xb7aa('0xa1')][_0xb7aa('0x127')](db['Variable'],{'as':_0xb7aa('0x8f'),'foreignKey':_0xb7aa('0x1c9')});db['SugarcrmAccount'][_0xb7aa('0x119')](db['SugarcrmConfiguration'],{'as':_0xb7aa('0x1ca'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xa4')][_0xb7aa('0x119')](db[_0xb7aa('0xa6')],{'as':_0xb7aa('0x1c4'),'onDelete':_0xb7aa('0x149'),'foreignKey':'SubjectId'});db[_0xb7aa('0xa4')]['hasMany'](db[_0xb7aa('0xa6')],{'as':'Descriptions','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xa4')][_0xb7aa('0x119')](db['SugarcrmField'],{'as':'Fields','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c5')});db['SugarcrmConfiguration'][_0xb7aa('0x127')](db[_0xb7aa('0xa2')],{'as':_0xb7aa('0x174'),'foreignKey':'AccountId'});db[_0xb7aa('0xa6')][_0xb7aa('0x119')](db[_0xb7aa('0xa6')],{'as':'Subject','foreignKey':_0xb7aa('0x1c6')});db[_0xb7aa('0xa6')]['hasMany'](db[_0xb7aa('0xa6')],{'as':_0xb7aa('0x1c7'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xa6')][_0xb7aa('0x119')](db[_0xb7aa('0xa6')],{'as':_0xb7aa('0x1c8'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0xa6')][_0xb7aa('0x127')](db['Variable'],{'as':_0xb7aa('0x8f'),'foreignKey':_0xb7aa('0x1c9')});db[_0xb7aa('0x1cc')][_0xb7aa('0x119')](db[_0xb7aa('0xa9')],{'as':_0xb7aa('0x1ca'),'onDelete':'cascade','foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xa9')][_0xb7aa('0x119')](db['DeskField'],{'as':_0xb7aa('0x1c4'),'onDelete':_0xb7aa('0x149'),'foreignKey':'SubjectId'});db[_0xb7aa('0xa9')]['hasMany'](db[_0xb7aa('0xab')],{'as':_0xb7aa('0x1cd'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xa9')][_0xb7aa('0x119')](db['DeskField'],{'as':'Fields','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c5')});db['DeskConfiguration'][_0xb7aa('0x127')](db[_0xb7aa('0x1cc')],{'as':'Account','foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xa9')][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':_0xb7aa('0x1ce')});db[_0xb7aa('0xab')][_0xb7aa('0x119')](db[_0xb7aa('0xab')],{'as':_0xb7aa('0x1cf'),'foreignKey':_0xb7aa('0x1c6')});db[_0xb7aa('0xab')][_0xb7aa('0x119')](db[_0xb7aa('0xab')],{'as':_0xb7aa('0x1c7'),'foreignKey':'DescriptionId'});db[_0xb7aa('0xab')][_0xb7aa('0x119')](db[_0xb7aa('0xab')],{'as':_0xb7aa('0x1c8'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0xab')][_0xb7aa('0x127')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xb7aa('0xad')]['hasMany'](db['ZohoConfiguration'],{'as':_0xb7aa('0x1ca'),'onDelete':'cascade','foreignKey':_0xb7aa('0x1c3')});db['ZohoConfiguration'][_0xb7aa('0x119')](db['ZohoField'],{'as':'Subjects','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c6')});db[_0xb7aa('0x1d0')][_0xb7aa('0x119')](db[_0xb7aa('0x1d1')],{'as':_0xb7aa('0x1cd'),'onDelete':'cascade','foreignKey':_0xb7aa('0x1cb')});db['ZohoConfiguration'][_0xb7aa('0x119')](db[_0xb7aa('0x1d1')],{'as':'Fields','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0x1d0')]['belongsTo'](db[_0xb7aa('0xad')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x1c3')});db['ZohoField'][_0xb7aa('0x119')](db[_0xb7aa('0x1d1')],{'as':_0xb7aa('0x1cf'),'foreignKey':'SubjectId'});db[_0xb7aa('0x1d1')][_0xb7aa('0x119')](db[_0xb7aa('0x1d1')],{'as':_0xb7aa('0x1c7'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0x1d1')]['hasMany'](db[_0xb7aa('0x1d1')],{'as':_0xb7aa('0x1c8'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0x1d1')]['belongsTo'](db[_0xb7aa('0x8f')],{'as':'Variable','foreignKey':_0xb7aa('0x1c9')});db[_0xb7aa('0x1d2')][_0xb7aa('0x119')](db['ZendeskConfiguration'],{'as':_0xb7aa('0x1ca'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xb2')][_0xb7aa('0x119')](db['ZendeskField'],{'as':_0xb7aa('0x1c4'),'foreignKey':'SubjectId'});db[_0xb7aa('0xb2')][_0xb7aa('0x119')](db[_0xb7aa('0x1d3')],{'as':_0xb7aa('0x1cd'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xb2')]['hasMany'](db['ZendeskField'],{'as':_0xb7aa('0x1c0'),'foreignKey':'FieldId'});db['ZendeskConfiguration'][_0xb7aa('0x127')](db[_0xb7aa('0x1d2')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xb2')][_0xb7aa('0x129')](db['Tag'],{'through':'int_zendesk_configuration_has_tags'});db[_0xb7aa('0x1d3')][_0xb7aa('0x119')](db[_0xb7aa('0x1d3')],{'as':_0xb7aa('0x1cf'),'foreignKey':_0xb7aa('0x1c6')});db['ZendeskField'][_0xb7aa('0x119')](db[_0xb7aa('0x1d3')],{'as':_0xb7aa('0x1c7'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0x1d3')][_0xb7aa('0x119')](db['ZendeskField'],{'as':'Field','foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0x1d3')][_0xb7aa('0x127')](db[_0xb7aa('0x8f')],{'as':_0xb7aa('0x8f'),'foreignKey':'VariableId'});db[_0xb7aa('0xb5')]['hasMany'](db[_0xb7aa('0x1d4')],{'as':_0xb7aa('0x1ca'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c3')});db['FreshdeskConfiguration'][_0xb7aa('0x119')](db[_0xb7aa('0xb8')],{'as':_0xb7aa('0x1c4'),'onDelete':_0xb7aa('0x149'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0xb7aa('0x119')](db[_0xb7aa('0xb8')],{'as':'Descriptions','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0x1d4')]['hasMany'](db[_0xb7aa('0xb8')],{'as':_0xb7aa('0x1c0'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0x1d4')]['belongsTo'](db[_0xb7aa('0xb5')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0x1d4')]['belongsToMany'](db['Tag'],{'through':_0xb7aa('0x1d5')});db[_0xb7aa('0xb8')][_0xb7aa('0x119')](db['FreshdeskField'],{'as':_0xb7aa('0x1cf'),'foreignKey':'SubjectId'});db[_0xb7aa('0xb8')][_0xb7aa('0x119')](db['FreshdeskField'],{'as':'Description','foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xb8')][_0xb7aa('0x119')](db[_0xb7aa('0xb8')],{'as':'Field','foreignKey':'FieldId'});db[_0xb7aa('0xb8')][_0xb7aa('0x127')](db['Variable'],{'as':_0xb7aa('0x8f'),'foreignKey':'VariableId'});db[_0xb7aa('0xba')][_0xb7aa('0x119')](db['VtigerConfiguration'],{'as':_0xb7aa('0x1ca'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c3')});db['VtigerConfiguration']['hasMany'](db['VtigerField'],{'as':'Subjects','foreignKey':'SubjectId'});db[_0xb7aa('0xbb')]['hasMany'](db['VtigerField'],{'as':'Descriptions','foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xbb')][_0xb7aa('0x119')](db[_0xb7aa('0x1d6')],{'as':_0xb7aa('0x1c0'),'foreignKey':_0xb7aa('0x1c5')});db['VtigerConfiguration'][_0xb7aa('0x127')](db[_0xb7aa('0xba')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0x1d6')]['hasMany'](db['VtigerField'],{'as':_0xb7aa('0x1cf'),'foreignKey':_0xb7aa('0x1c6')});db[_0xb7aa('0x1d6')][_0xb7aa('0x119')](db[_0xb7aa('0x1d6')],{'as':_0xb7aa('0x1c7'),'foreignKey':'DescriptionId'});db['VtigerField'][_0xb7aa('0x119')](db[_0xb7aa('0x1d6')],{'as':_0xb7aa('0x1c8'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0x1d6')][_0xb7aa('0x127')](db[_0xb7aa('0x8f')],{'as':'Variable','foreignKey':_0xb7aa('0x1c9')});db[_0xb7aa('0x1d7')][_0xb7aa('0x119')](db[_0xb7aa('0x1d8')],{'as':_0xb7aa('0x1ca'),'onDelete':'cascade','foreignKey':'AccountId'});db['ServicenowConfiguration']['hasMany'](db[_0xb7aa('0xbf')],{'as':_0xb7aa('0x1c4'),'foreignKey':_0xb7aa('0x1c6')});db[_0xb7aa('0x1d8')][_0xb7aa('0x119')](db[_0xb7aa('0xbf')],{'as':_0xb7aa('0x1cd'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0x1d8')][_0xb7aa('0x119')](db[_0xb7aa('0xbf')],{'as':_0xb7aa('0x1c0'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0x1d8')][_0xb7aa('0x127')](db['ServicenowAccount'],{'as':'Account','foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xbf')][_0xb7aa('0x119')](db[_0xb7aa('0xbf')],{'as':_0xb7aa('0x1cf'),'foreignKey':_0xb7aa('0x1c6')});db['ServicenowField'][_0xb7aa('0x119')](db[_0xb7aa('0xbf')],{'as':'Description','foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xbf')]['hasMany'](db[_0xb7aa('0xbf')],{'as':_0xb7aa('0x1c8'),'foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0xbf')][_0xb7aa('0x127')](db[_0xb7aa('0x8f')],{'as':_0xb7aa('0x8f'),'foreignKey':_0xb7aa('0x1c9')});db[_0xb7aa('0xc1')][_0xb7aa('0x119')](db[_0xb7aa('0xc3')],{'as':_0xb7aa('0x1ca'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xc1')][_0xb7aa('0x127')](db[_0xb7aa('0x10a')],{'as':_0xb7aa('0x10a'),'foreignKey':'CloudProviderId'});db[_0xb7aa('0xc3')][_0xb7aa('0x119')](db[_0xb7aa('0xc5')],{'as':'Subjects','onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1c6')});db[_0xb7aa('0xc3')][_0xb7aa('0x119')](db[_0xb7aa('0xc5')],{'as':_0xb7aa('0x1cd'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xc3')][_0xb7aa('0x119')](db['Dynamics365Field'],{'as':'Fields','onDelete':_0xb7aa('0x149'),'foreignKey':'FieldId'});db['Dynamics365Configuration']['belongsTo'](db[_0xb7aa('0xc1')],{'as':'Account','foreignKey':'AccountId'});db[_0xb7aa('0xc5')][_0xb7aa('0x119')](db[_0xb7aa('0xc5')],{'as':_0xb7aa('0x1cf'),'foreignKey':'SubjectId'});db[_0xb7aa('0xc5')][_0xb7aa('0x119')](db[_0xb7aa('0xc5')],{'as':_0xb7aa('0x1c7'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xc5')]['hasMany'](db[_0xb7aa('0xc5')],{'as':_0xb7aa('0x1c8'),'foreignKey':_0xb7aa('0x1c5')});db['Dynamics365Field'][_0xb7aa('0x127')](db[_0xb7aa('0x8f')],{'as':_0xb7aa('0x8f'),'foreignKey':_0xb7aa('0x1c9')});db['FreshsalesAccount'][_0xb7aa('0x119')](db[_0xb7aa('0xc7')],{'as':_0xb7aa('0x1ca'),'onDelete':'cascade','foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xc7')][_0xb7aa('0x119')](db['FreshsalesField'],{'as':_0xb7aa('0x1c4'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration']['hasMany'](db[_0xb7aa('0xc8')],{'as':_0xb7aa('0x1cd'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xc7')][_0xb7aa('0x119')](db[_0xb7aa('0xc8')],{'as':'Fields','foreignKey':_0xb7aa('0x1c5')});db[_0xb7aa('0xc7')][_0xb7aa('0x127')](db[_0xb7aa('0xc6')],{'as':'Account','foreignKey':_0xb7aa('0x1c3')});db[_0xb7aa('0xc8')][_0xb7aa('0x119')](db['FreshsalesField'],{'as':'Subject','foreignKey':_0xb7aa('0x1c6')});db[_0xb7aa('0xc8')][_0xb7aa('0x119')](db[_0xb7aa('0xc8')],{'as':_0xb7aa('0x1c7'),'foreignKey':_0xb7aa('0x1cb')});db[_0xb7aa('0xc8')][_0xb7aa('0x119')](db[_0xb7aa('0xc8')],{'as':_0xb7aa('0x1c8'),'foreignKey':_0xb7aa('0x1c5')});db['FreshsalesField'][_0xb7aa('0x127')](db[_0xb7aa('0x8f')],{'as':_0xb7aa('0x8f'),'foreignKey':_0xb7aa('0x1c9')});db[_0xb7aa('0xce')][_0xb7aa('0x127')](db[_0xb7aa('0x5e')],{});db[_0xb7aa('0xce')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0xce')]['belongsTo'](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0xce')][_0xb7aa('0x127')](db[_0xb7aa('0x63')],{});db[_0xb7aa('0xce')][_0xb7aa('0x127')](db[_0xb7aa('0x195')],{});db['ChatQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{});db['ChatQueueReport'][_0xb7aa('0x127')](db['ChatQueue'],{});db['ChatInternalMessage'][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x1d9')});db['ChatInternalMessage'][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'onDelete':'cascade','foreignKey':_0xb7aa('0x1da')});db[_0xb7aa('0x153')]['hasMany'](db[_0xb7aa('0x1db')],{'foreignKey':'SessionId','onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x153')][_0xb7aa('0x119')](db[_0xb7aa('0xd2')],{'foreignKey':'SessionId','onDelete':_0xb7aa('0x149')});db[_0xb7aa('0x1dc')][_0xb7aa('0x127')](db[_0xb7aa('0x4e')],{});db[_0xb7aa('0x1dc')]['belongsTo'](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f')});db['SmsQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db['SmsQueueReport'][_0xb7aa('0x127')](db['SmsInteraction'],{});db['SmsQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x53')],{});db['SmsQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{});db['SmsQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x55')],{});db[_0xb7aa('0xda')][_0xb7aa('0x119')](db[_0xb7aa('0x153')],{'foreignKey':_0xb7aa('0x1dd')});db[_0xb7aa('0xda')]['hasMany'](db[_0xb7aa('0x1db')],{'foreignKey':'ProjectId'});db[_0xb7aa('0xda')][_0xb7aa('0x119')](db[_0xb7aa('0xd2')],{'foreignKey':_0xb7aa('0x1dd')});db[_0xb7aa('0xe5')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x15b'),'through':'user_has_teams'});db[_0xb7aa('0xe5')][_0xb7aa('0x129')](db[_0xb7aa('0x18')],{'through':_0xb7aa('0x10c'),'as':_0xb7aa('0x1de')});db[_0xb7aa('0xe5')]['belongsToMany'](db['MailQueue'],{'through':'team_has_mail_queues','as':_0xb7aa('0x137')});db[_0xb7aa('0xe5')][_0xb7aa('0x129')](db['ChatQueue'],{'through':_0xb7aa('0x1df'),'as':_0xb7aa('0x139')});db[_0xb7aa('0xe5')][_0xb7aa('0x129')](db[_0xb7aa('0x4b')],{'through':_0xb7aa('0x188'),'as':_0xb7aa('0x13a')});db[_0xb7aa('0xe5')]['belongsToMany'](db[_0xb7aa('0x55')],{'through':'team_has_sms_queues','as':_0xb7aa('0x1e0')});db[_0xb7aa('0xe5')][_0xb7aa('0x129')](db[_0xb7aa('0x5d')],{'through':_0xb7aa('0x192'),'as':_0xb7aa('0x1e1')});db[_0xb7aa('0xe5')][_0xb7aa('0x129')](db[_0xb7aa('0x109')],{'through':_0xb7aa('0x1e2'),'as':'WhatsappQueues'});db[_0xb7aa('0xe5')][_0xb7aa('0x129')](db[_0xb7aa('0xf5')],{'through':_0xb7aa('0x10e'),'as':_0xb7aa('0x1e3')});db[_0xb7aa('0xe6')][_0xb7aa('0x119')](db['CmHopper'],{'as':_0xb7aa('0x125'),'foreignKey':_0xb7aa('0x1a6')});db[_0xb7aa('0xe6')][_0xb7aa('0x119')](db['CmHopperFinal'],{'as':_0xb7aa('0x11c'),'foreignKey':_0xb7aa('0x1a6')});db[_0xb7aa('0xe6')]['hasMany'](db['CmHopperHistory'],{'as':_0xb7aa('0x151'),'foreignKey':_0xb7aa('0x1a6')});db[_0xb7aa('0xe6')][_0xb7aa('0x119')](db['CmHopperBlack'],{'as':'HopperBlacks','foreignKey':'CampaignId'});db['Campaign']['belongsTo'](db[_0xb7aa('0x27')],{'as':'Trunk','foreignKey':_0xb7aa('0x155')});db[_0xb7aa('0xe6')][_0xb7aa('0x127')](db[_0xb7aa('0x27')],{'as':_0xb7aa('0x156'),'foreignKey':_0xb7aa('0x157')});db[_0xb7aa('0xe6')][_0xb7aa('0x127')](db['Interval'],{'as':_0xb7aa('0x7b'),'foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0xe6')]['belongsTo'](db[_0xb7aa('0x1e4')],{'as':_0xb7aa('0x1e4'),'foreignKey':_0xb7aa('0x1e5')});db['Campaign'][_0xb7aa('0x129')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x12f'),'through':'campaigns_has_cm_lists'});db[_0xb7aa('0xe6')]['belongsToMany'](db['CmList'],{'as':'BlackLists','through':'campaigns_has_cm_blacklists'});db[_0xb7aa('0x17a')]['belongsTo'](db[_0xb7aa('0x17d')],{'as':_0xb7aa('0x17d'),'foreignKey':_0xb7aa('0x19c')});db[_0xb7aa('0xec')][_0xb7aa('0x127')](db[_0xb7aa('0x3e')],{});db[_0xb7aa('0xec')]['belongsTo'](db[_0xb7aa('0x3c')],{});db[_0xb7aa('0xec')][_0xb7aa('0x127')](db['MailAccount'],{'foreignKey':'FromMailAccountId','as':_0xb7aa('0x1e6')});db[_0xb7aa('0xec')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'foreignKey':'FromUserId','as':_0xb7aa('0x1e7')});db['MailTransferReport'][_0xb7aa('0x127')](db['User'],{'foreignKey':_0xb7aa('0x1e8'),'as':_0xb7aa('0x1e9')});db['MailTransferReport'][_0xb7aa('0x127')](db[_0xb7aa('0x171')],{'foreignKey':_0xb7aa('0x1ea'),'as':'ToQueue'});db[_0xb7aa('0xec')][_0xb7aa('0x127')](db['MailAccount'],{'foreignKey':'ToMailAccountId','as':_0xb7aa('0x1eb')});db[_0xb7aa('0xed')][_0xb7aa('0x127')](db['ChatMessage'],{});db[_0xb7aa('0xed')][_0xb7aa('0x127')](db[_0xb7aa('0x63')],{});db[_0xb7aa('0xed')][_0xb7aa('0x127')](db['ChatWebsite'],{'foreignKey':_0xb7aa('0x1ec'),'as':'FromAccount'});db['ChatTransferReport'][_0xb7aa('0x127')](db['User'],{'foreignKey':'FromUserId','as':_0xb7aa('0x1e7')});db[_0xb7aa('0xed')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'foreignKey':_0xb7aa('0x1e8'),'as':'ToAgent'});db[_0xb7aa('0xed')][_0xb7aa('0x127')](db[_0xb7aa('0x67')],{'foreignKey':_0xb7aa('0x1ed'),'as':_0xb7aa('0x1ee')});db['ChatTransferReport'][_0xb7aa('0x127')](db[_0xb7aa('0x5e')],{'foreignKey':_0xb7aa('0x1ef'),'as':'ToAccount'});db['FaxTransferReport'][_0xb7aa('0x127')](db['FaxMessage'],{});db['FaxTransferReport'][_0xb7aa('0x127')](db[_0xb7aa('0x48')],{});db[_0xb7aa('0x1f0')][_0xb7aa('0x127')](db[_0xb7aa('0x45')],{'foreignKey':_0xb7aa('0x1f1'),'as':_0xb7aa('0x1e6')});db[_0xb7aa('0x1f0')]['belongsTo'](db[_0xb7aa('0x117')],{'foreignKey':_0xb7aa('0x1f2'),'as':_0xb7aa('0x1e7')});db[_0xb7aa('0x1f0')][_0xb7aa('0x127')](db['User'],{'foreignKey':_0xb7aa('0x1e8'),'as':_0xb7aa('0x1e9')});db[_0xb7aa('0x1f0')][_0xb7aa('0x127')](db['FaxQueue'],{'foreignKey':'ToFaxQueueId','as':_0xb7aa('0x1ee')});db[_0xb7aa('0x1f0')][_0xb7aa('0x127')](db[_0xb7aa('0x45')],{'foreignKey':_0xb7aa('0x1f3'),'as':_0xb7aa('0x1eb')});db['OpenchannelTransferReport'][_0xb7aa('0x127')](db[_0xb7aa('0x5b')],{});db[_0xb7aa('0xf0')]['belongsTo'](db['OpenchannelInteraction'],{});db[_0xb7aa('0xf0')]['belongsTo'](db[_0xb7aa('0x57')],{'foreignKey':'FromOpenchannelAccountId','as':_0xb7aa('0x1e6')});db[_0xb7aa('0xf0')]['belongsTo'](db[_0xb7aa('0x117')],{'foreignKey':'FromUserId','as':_0xb7aa('0x1e7')});db[_0xb7aa('0xf0')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'foreignKey':_0xb7aa('0x1e8'),'as':_0xb7aa('0x1e9')});db[_0xb7aa('0xf0')][_0xb7aa('0x127')](db[_0xb7aa('0x5d')],{'foreignKey':'ToOpenchannelQueueId','as':_0xb7aa('0x1ee')});db[_0xb7aa('0xf0')][_0xb7aa('0x127')](db['OpenchannelAccount'],{'foreignKey':_0xb7aa('0x1f4'),'as':'ToAccount'});db[_0xb7aa('0xf1')]['belongsTo'](db[_0xb7aa('0x53')],{});db[_0xb7aa('0xf1')][_0xb7aa('0x127')](db[_0xb7aa('0x51')],{});db[_0xb7aa('0xf1')]['belongsTo'](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0xb7aa('0x1e6')});db[_0xb7aa('0xf1')]['belongsTo'](db['User'],{'foreignKey':_0xb7aa('0x1f2'),'as':'FromAgent'});db[_0xb7aa('0xf1')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'foreignKey':_0xb7aa('0x1e8'),'as':_0xb7aa('0x1e9')});db['SmsTransferReport']['belongsTo'](db['SmsQueue'],{'foreignKey':_0xb7aa('0x1f5'),'as':_0xb7aa('0x1ee')});db['SmsTransferReport'][_0xb7aa('0x127')](db[_0xb7aa('0x4e')],{'foreignKey':_0xb7aa('0x1f6'),'as':'ToAccount'});db[_0xb7aa('0xf3')][_0xb7aa('0x119')](db['Disposition'],{'as':'Dispositions','foreignKey':_0xb7aa('0x17f'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0xf3')][_0xb7aa('0x119')](db[_0xb7aa('0x72')],{'as':_0xb7aa('0x1f7'),'foreignKey':_0xb7aa('0x17f')});db['CmList']['hasMany'](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x12d'),'onDelete':_0xb7aa('0x149'),'foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0xf3')][_0xb7aa('0x119')](db[_0xb7aa('0x6e')],{'as':'HopperFinals','foreignKey':_0xb7aa('0x17f')});db['CmList'][_0xb7aa('0x119')](db['CmHopperHistory'],{'as':_0xb7aa('0x11d'),'foreignKey':'ListId'});db[_0xb7aa('0xf3')][_0xb7aa('0x119')](db[_0xb7aa('0x71')],{'as':'ReportAgentPreview','foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0xf3')][_0xb7aa('0x129')](db[_0xb7aa('0x18')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0xb7aa('0xf3')]['belongsToMany'](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x15b'),'through':'cm_user_has_lists'});db[_0xb7aa('0xf5')][_0xb7aa('0x119')](db[_0xb7aa('0x15')],{'as':_0xb7aa('0x11b'),'onDelete':_0xb7aa('0x149')});db['VoicePrefix'][_0xb7aa('0x129')](db['User'],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x1f8')});db[_0xb7aa('0xf5')][_0xb7aa('0x129')](db[_0xb7aa('0xe5')],{'through':_0xb7aa('0x10e'),'as':_0xb7aa('0x15c')});db[_0xb7aa('0xf7')][_0xb7aa('0x119')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x179'),'foreignKey':_0xb7aa('0x128')});db[_0xb7aa('0xf7')][_0xb7aa('0x119')](db['UserProfileSection'],{'as':_0xb7aa('0x1f9'),'foreignKey':_0xb7aa('0x128'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0xf9')][_0xb7aa('0x119')](db[_0xb7aa('0xfb')],{'as':_0xb7aa('0x1fa'),'foreignKey':_0xb7aa('0x1fb'),'onDelete':_0xb7aa('0x149')});db[_0xb7aa('0xff')][_0xb7aa('0x119')](db[_0xb7aa('0x78')],{'as':_0xb7aa('0x182'),'foreignKey':_0xb7aa('0x1fc'),'onDelete':_0xb7aa('0x149')});db['WhatsappAccount'][_0xb7aa('0x119')](db[_0xb7aa('0x76')],{'as':'Answers','foreignKey':'WhatsappAccountId'});db[_0xb7aa('0xff')]['hasMany'](db[_0xb7aa('0x1fd')],{'as':_0xb7aa('0x160'),'foreignKey':_0xb7aa('0x1fc')});db[_0xb7aa('0xff')][_0xb7aa('0x119')](db[_0xb7aa('0x121')],{'as':_0xb7aa('0x16d')});db[_0xb7aa('0xff')][_0xb7aa('0x119')](db['WhatsappApplication'],{'as':_0xb7aa('0x14b'),'foreignKey':'WhatsappAccountId','onDelete':_0xb7aa('0x149')});db[_0xb7aa('0xff')][_0xb7aa('0x127')](db['CmList'],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0xff')][_0xb7aa('0x127')](db[_0xb7aa('0x7d')],{'as':_0xb7aa('0x159'),'foreignKey':_0xb7aa('0x170')});db[_0xb7aa('0xff')][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':'Agents','through':_0xb7aa('0x1fe')});db[_0xb7aa('0x101')][_0xb7aa('0x127')](db['User'],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x101')][_0xb7aa('0x127')](db[_0xb7aa('0x109')],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x101')][_0xb7aa('0x127')](db[_0xb7aa('0xff')],{'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x101')][_0xb7aa('0x127')](db[_0xb7aa('0x7b')],{'onDelete':'restrict','foreignKey':_0xb7aa('0x158')});db[_0xb7aa('0x101')][_0xb7aa('0x127')](db[_0xb7aa('0x85')],{'onDelete':_0xb7aa('0x169'),'foreignKey':_0xb7aa('0x17e')});db[_0xb7aa('0x121')][_0xb7aa('0x119')](db[_0xb7aa('0x1fd')],{'as':_0xb7aa('0x160'),'onDelete':_0xb7aa('0x149'),'foreignKey':'WhatsappInteractionId'});db['WhatsappInteraction']['belongsTo'](db[_0xb7aa('0xff')],{'as':_0xb7aa('0x174'),'foreignKey':_0xb7aa('0x1fc')});db[_0xb7aa('0x121')]['belongsTo'](db[_0xb7aa('0x12c')],{'as':_0xb7aa('0x165'),'foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x121')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x175'),'foreignKey':_0xb7aa('0x116')});db['WhatsappInteraction'][_0xb7aa('0x129')](db[_0xb7aa('0x85')],{'through':'whatsapp_interaction_has_tags','as':_0xb7aa('0x176')});db[_0xb7aa('0x121')]['belongsToMany'](db['Tag'],{'through':_0xb7aa('0x1b6'),'as':_0xb7aa('0x178')});db['WhatsappInteraction'][_0xb7aa('0x129')](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x179'),'through':_0xb7aa('0x136'),'foreignKey':'WhatsappInteractionId'});db[_0xb7aa('0x1fd')][_0xb7aa('0x127')](db['User'],{'as':_0xb7aa('0x117')});db[_0xb7aa('0x1fd')]['belongsTo'](db[_0xb7aa('0x12c')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x165')});db['WhatsappMessage'][_0xb7aa('0x127')](db[_0xb7aa('0x121')],{'onDelete':_0xb7aa('0x149'),'as':_0xb7aa('0x17c'),'foreignKey':_0xb7aa('0x1ff')});db['WhatsappMessage']['belongsTo'](db[_0xb7aa('0xff')],{'as':_0xb7aa('0x174'),'foreignKey':'WhatsappAccountId'});db[_0xb7aa('0x105')][_0xb7aa('0x127')](db['WhatsappAccount'],{});db[_0xb7aa('0x105')][_0xb7aa('0x127')](db[_0xb7aa('0xf3')],{'as':_0xb7aa('0x16e'),'foreignKey':_0xb7aa('0x17f')});db[_0xb7aa('0x105')][_0xb7aa('0x127')](db['CmContact'],{'as':'Contact','foreignKey':_0xb7aa('0x166')});db[_0xb7aa('0x105')][_0xb7aa('0x127')](db[_0xb7aa('0x121')],{});db[_0xb7aa('0x105')][_0xb7aa('0x127')](db[_0xb7aa('0x109')],{});db[_0xb7aa('0x105')][_0xb7aa('0x127')](db[_0xb7aa('0x1fd')],{});db['WhatsappQueueReport'][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{});db['WhatsappTransferReport'][_0xb7aa('0x127')](db[_0xb7aa('0x1fd')],{});db[_0xb7aa('0x107')][_0xb7aa('0x127')](db['WhatsappInteraction'],{});db[_0xb7aa('0x107')][_0xb7aa('0x127')](db[_0xb7aa('0xff')],{'foreignKey':_0xb7aa('0x200'),'as':_0xb7aa('0x1e6')});db[_0xb7aa('0x107')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0xb7aa('0x201'),'as':_0xb7aa('0x1eb')});db['WhatsappTransferReport'][_0xb7aa('0x127')](db['WhatsappQueue'],{'foreignKey':_0xb7aa('0x202'),'as':_0xb7aa('0x1ee')});db['WhatsappTransferReport']['belongsTo'](db[_0xb7aa('0x117')],{'foreignKey':'FromUserId','as':_0xb7aa('0x1e7')});db[_0xb7aa('0x107')][_0xb7aa('0x127')](db[_0xb7aa('0x117')],{'foreignKey':_0xb7aa('0x1e8'),'as':_0xb7aa('0x1e9')});db['WhatsappQueue']['belongsToMany'](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x15b'),'through':_0xb7aa('0x34'),'foreignKey':_0xb7aa('0x203')});db['WhatsappQueue'][_0xb7aa('0x129')](db['Team'],{'through':_0xb7aa('0x1e2'),'as':_0xb7aa('0x15c')});db[_0xb7aa('0x111')]['belongsTo'](db[_0xb7aa('0x117')],{'as':_0xb7aa('0x204'),'foreignKey':_0xb7aa('0x116'),'onDelete':_0xb7aa('0x149'),'hooks':!![]});db['CloudProvider'][_0xb7aa('0x115')](db[_0xb7aa('0xc1')],{'as':_0xb7aa('0xc1'),'onDelete':_0xb7aa('0x169')});db[_0xb7aa('0x10a')][_0xb7aa('0x115')](db[_0xb7aa('0x35')],{'as':'Imap','onDelete':_0xb7aa('0x169')});db['CloudProvider'][_0xb7aa('0x115')](db[_0xb7aa('0x36')],{'as':_0xb7aa('0x16b'),'onDelete':'restrict'});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xc32d=['CmHopperHistory','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','Action','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','ContactItemType','CmContactHasItem','../api/cmContactHasItem/cmContactHasItem.model','CmHopperAdditionalPhone','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model','Trigger','Variable','Integration','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../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','Setting','SquareOdbc','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/team/team.model','License','Campaign','../api/campaign/campaign.model','Migration','Attachment','Plugin','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','../api/user-setting/user-setting.model','MailInteractionHasTag','../api/mailInteractionHasTag/mailInteractionHasTag.model','User','cascade','UserId','hasOne','UserSetting','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteraction','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','WhatsappInteractions','UserNotifications','Hoppers','SET\x20NULL','belongsTo','UserProfile','belongsToMany','chat_group_has_users','CmContact','cm_user_has_contacts','user_has_teams','user_has_mail_interactions','ChatInteraction','user_has_chat_interactions','user_has_fax_interactions','VoicePrefixes','MailQueues','ChatQueues','FaxQueues','SmsQueue','SmsQueues','OpenchannelQueues','WhatsappQueues','ChatWebsite','ChatWebsites','user_has_chat_websites','FaxAccounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','SmsAccounts','WhatsappAccounts','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','CmHopperFinal','HopperHistories','JscriptySessions','TrunkId','TrunkBackupId','Interval','mandatoryDispositionPause','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','VoiceQueueReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Dispositions','Answers','List','ListId','Template','mandatoryDispositionPauseId','Team','MailInteractionId','Contact','Tags','mail_interaction_has_tags','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','IntervalId','ContactId','Dashboard','Items','FaxAccountId','FaxAccount','Interactions','Exntensions','user_has_fax_accounts','TagId','FaxInteractionId','fax_interaction_has_tags','Users','AttachmentId','SmsAccountId','SmsInteractionId','Owner','sms_interaction_has_tags','ThroughTags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelApplication','user_has_openchannel_accounts','OpenchannelQueueId','OpenchannelInteractionId','openchannel_interaction_has_tags','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Contacts','CompanyId','Phones','CmContactId','cm_contact_has_tags','CampaignId','Automation','OneAll','AutomationAllId','OneAny','AutomationAnyId','AutomationId','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','Mohs','whatsapp_interaction_has_tags','ItemType','ItemTypeId','CmHopperId','AllConditions','AllCondition','TriggerAllId','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','AnalyticDefaultReport','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Description','Field','int_desk_configuration_has_tags','VariableId','int_zendesk_configuration_has_tags','FreshdeskAccount','VtigerField','ServicenowConfiguration','ChatQueueReport','ToId','SessionId','ProjectId','VoiceQueues','team_has_mail_queues','team_has_fax_queues','WhatsappQueue','team_has_whatsapp_queues','HopperBlacks','TrunkBackup','campaigns_has_cm_lists','campaigns_has_cm_blacklists','FromMailAccountId','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','FromAccount','FromUserId','ToUserId','ToChatWebsiteId','FromFaxAccountId','ToAgent','ToFaxQueueId','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','CmCustomField','Queues','cm_user_has_lists','userProfileId','UserProfileSections','Resources','WhatsappAccountId','user_has_whatsapp_accounts','WhatsappInteractionId','user_has_whatsapp_interactions','ToWhatsappAccountId','WhatsappQueueId','user','exports','../config/environment','sequelize','lodash','determine','defaultsDeep','xcall','127.0.0.1','mysql','utf8mb4','utf8','sequelizeHistory','name','utf8_general_ci','database','password','options','import','../api/user/user.model','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceMailMessage','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceAgentReport/voiceAgentReport.model','../api/voiceQueueReport/voiceQueueReport.model','Trunk','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','OpenchannelAccount','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperFinal/cmHopperFinal.model'];(function(_0x256263,_0x502cfc){var _0x557cea=function(_0x2fb53e){while(--_0x2fb53e){_0x256263['push'](_0x256263['shift']());}};_0x557cea(++_0x502cfc);}(_0xc32d,0x188));var _0xdc32=function(_0x37f773,_0x45e82f){_0x37f773=_0x37f773-0x0;var _0x1a6b8d=_0xc32d[_0x37f773];return _0x1a6b8d;};'use strict';var config=require(_0xdc32('0x0'));var Sequelize=require(_0xdc32('0x1'));var _=require(_0xdc32('0x2'));var jstz=require('jstz');var timezone=jstz[_0xdc32('0x3')]();config[_0xdc32('0x1')]=_[_0xdc32('0x4')](config[_0xdc32('0x1')],{'database':'motion2','username':_0xdc32('0x5'),'password':'xC@LL1234','options':{'host':_0xdc32('0x6'),'port':0xcea,'dialect':_0xdc32('0x7'),'dialectOptions':{'charset':_0xdc32('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xdc32('0x9'),'collate':'utf8_general_ci'}}});config[_0xdc32('0xa')]=_[_0xdc32('0x4')](config[_0xdc32('0xa')],{'database':'motion2','username':_0xdc32('0x5'),'password':'xC@LL1234','options':{'host':_0xdc32('0x6'),'port':0xcea,'dialect':_0xdc32('0x7'),'dialectOptions':{'charset':_0xdc32('0x8')},'logging':![],'timezone':timezone[_0xdc32('0xb')](),'define':{'charset':_0xdc32('0x9'),'collate':_0xdc32('0xc')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xdc32('0x1')][_0xdc32('0xd')],config[_0xdc32('0x1')]['username'],config[_0xdc32('0x1')][_0xdc32('0xe')],config[_0xdc32('0x1')]['options'])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0xdc32('0xd')],config[_0xdc32('0xa')]['username'],config['sequelizeHistory'][_0xdc32('0xe')],config['sequelizeHistory'][_0xdc32('0xf')])};db['User']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x11'));db[_0xdc32('0x12')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x13'));db[_0xdc32('0x14')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x15'));db[_0xdc32('0x16')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x17'));db[_0xdc32('0x18')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x19'));db[_0xdc32('0x1a')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x1b'));db[_0xdc32('0x1c')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x1d'));db[_0xdc32('0x1e')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x1f'));db[_0xdc32('0x20')]=db[_0xdc32('0x1')]['import']('../api/voiceMail/voiceMail.model');db[_0xdc32('0x21')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xdc32('0x22')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x23'));db['VoiceDialReport']=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/voiceDialReport/voiceDialReport.model');db['VoiceAgentReport']=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x24'));db['VoiceQueueReport']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x25'));db['MemberReport']=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/memberReport/memberReport.model');db[_0xdc32('0x26')]=db['sequelize'][_0xdc32('0x10')]('../api/trunk/trunk.model');db['VoiceTransferReport']=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x27'));db[_0xdc32('0x28')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x29'));db[_0xdc32('0x2a')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/userVoiceQueue/userVoiceQueue.model');db[_0xdc32('0x2b')]=db['sequelize']['import'](_0xdc32('0x2c'));db[_0xdc32('0x2d')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x2e'));db[_0xdc32('0x2f')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x30'));db[_0xdc32('0x31')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x32'));db[_0xdc32('0x33')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x34'));db[_0xdc32('0x35')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x36'));db[_0xdc32('0x37')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x38'));db['MailServerOut']=db['sequelize']['import'](_0xdc32('0x39'));db[_0xdc32('0x3a')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/mailAccount/mailAccount.model');db[_0xdc32('0x3b')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x3c'));db[_0xdc32('0x3d')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x3e'));db[_0xdc32('0x3f')]=db['sequelize']['import'](_0xdc32('0x40'));db[_0xdc32('0x41')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x42'));db[_0xdc32('0x43')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x44'));db[_0xdc32('0x45')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x46'));db['Dashboard']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x47'));db[_0xdc32('0x48')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x49'));db['FaxAccount']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x4a'));db[_0xdc32('0x4b')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x4c'));db[_0xdc32('0x4d')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x4e'));db[_0xdc32('0x4f')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x50'));db[_0xdc32('0x51')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x52'));db[_0xdc32('0x53')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x54'));db[_0xdc32('0x55')]=db[_0xdc32('0x1')]['import']('../api/smsAccount/smsAccount.model');db[_0xdc32('0x56')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x57'));db['SmsInteraction']=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x58'));db[_0xdc32('0x59')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x5a'));db['SmsQueue']=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/smsQueue/smsQueue.model');db[_0xdc32('0x5b')]=db['sequelize'][_0xdc32('0x10')]('../api/openchannelAccount/openchannelAccount.model');db['OpenchannelApplication']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x5c'));db[_0xdc32('0x5d')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x5e'));db[_0xdc32('0x5f')]=db[_0xdc32('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xdc32('0x60')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x61'));db['ChatWebsite']=db[_0xdc32('0x1')]['import'](_0xdc32('0x62'));db[_0xdc32('0x63')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x64'));db[_0xdc32('0x65')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x66'));db['ChatInteraction']=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x67'));db[_0xdc32('0x68')]=db['sequelize']['import'](_0xdc32('0x69'));db[_0xdc32('0x6a')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x6b'));db[_0xdc32('0x6c')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x6d'));db[_0xdc32('0x6e')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x6f'));db['ChatProactiveAction']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x70'));db[_0xdc32('0x71')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x72'));db['CmContact']=db['sequelize']['import'](_0xdc32('0x73'));db[_0xdc32('0x74')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x75'));db[_0xdc32('0x76')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x77'));db['CmHopperFinal']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x78'));db[_0xdc32('0x79')]=db[_0xdc32('0x1')]['import']('../api/cmHopperHistory/cmHopperHistory.model');db[_0xdc32('0x7a')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x7b'));db['CmCustomField']=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/cmCustomField/cmCustomField.model');db[_0xdc32('0x7c')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/action/action.model');db['Automation']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x7d'));db[_0xdc32('0x7e')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x7f'));db[_0xdc32('0x80')]=db[_0xdc32('0x1')]['import']('../api/disposition/disposition.model');db[_0xdc32('0x81')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x82'));db['Interval']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x83'));db[_0xdc32('0x84')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x85'));db[_0xdc32('0x86')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x87'));db[_0xdc32('0x88')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x89'));db[_0xdc32('0x8a')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x8b'));db[_0xdc32('0x8c')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x8d'));db[_0xdc32('0x8e')]=db[_0xdc32('0x1')]['import']('../api/tag/tag.model');db[_0xdc32('0x8f')]=db['sequelize']['import']('../api/contactItemType/contactItemType.model');db[_0xdc32('0x90')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x91'));db[_0xdc32('0x92')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x93'));db['Template']=db[_0xdc32('0x1')]['import']('../api/template/template.model');db[_0xdc32('0x94')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/trigger/trigger.model');db[_0xdc32('0x95')]=db['sequelize'][_0xdc32('0x10')]('../api/variable/variable.model');db[_0xdc32('0x96')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x97'));db[_0xdc32('0x98')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x99'));db['AnalyticCustomReport']=db[_0xdc32('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db['AnalyticDefaultReport']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x9a'));db[_0xdc32('0x9b')]=db['sequelize']['import']('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0xdc32('0x9c')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x9d'));db[_0xdc32('0x9e')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x9f'));db[_0xdc32('0xa0')]=db['sequelize']['import']('../api/analyticTreeReport/analyticTreeReport.model');db[_0xdc32('0xa1')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xa2'));db['SalesforceConfiguration']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xa3'));db[_0xdc32('0xa4')]=db[_0xdc32('0x1')]['import']('../api/intSalesforceField/intSalesforceField.model');db[_0xdc32('0xa5')]=db['sequelize'][_0xdc32('0x10')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xdc32('0xa6')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xa7'));db[_0xdc32('0xa8')]=db[_0xdc32('0x1')]['import'](_0xdc32('0xa9'));db['DeskAccount']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xaa'));db[_0xdc32('0xab')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xac'));db[_0xdc32('0xad')]=db[_0xdc32('0x1')]['import']('../api/intDeskField/intDeskField.model');db[_0xdc32('0xae')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xaf'));db[_0xdc32('0xb0')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xb1'));db[_0xdc32('0xb2')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/intZohoField/intZohoField.model');db[_0xdc32('0xb3')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xb4'));db[_0xdc32('0xb5')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xb6'));db[_0xdc32('0xb7')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xb8'));db['FreshdeskAccount']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xb9'));db[_0xdc32('0xba')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xbb'));db[_0xdc32('0xbc')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xbd'));db[_0xdc32('0xbe')]=db[_0xdc32('0x1')]['import'](_0xdc32('0xbf'));db[_0xdc32('0xc0')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xc1'));db['VtigerField']=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/intVtigerField/intVtigerField.model');db[_0xdc32('0xc2')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xc3'));db['ServicenowConfiguration']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xc4'));db[_0xdc32('0xc5')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xc6'));db[_0xdc32('0xc7')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xc8'));db[_0xdc32('0xc9')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xdc32('0xca')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xcb'));db[_0xdc32('0xcc')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0xdc32('0xcd')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xce'));db[_0xdc32('0xcf')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xd0'));db[_0xdc32('0x96')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/integration/integration.model');db['Network']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xd1'));db['ChatQueueReport']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xd2'));db[_0xdc32('0xd3')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xd4'));db[_0xdc32('0xd5')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xd6'));db[_0xdc32('0xd7')]=db[_0xdc32('0x1')]['import']('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0xdc32('0xd8')]=db['sequelize']['import'](_0xdc32('0xd9'));db[_0xdc32('0xda')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xdb'));db[_0xdc32('0xdc')]=db[_0xdc32('0x1')]['import']('../api/squareReport/squareReport.model');db[_0xdc32('0xdd')]=db['sequelize']['import'](_0xdc32('0xde'));db[_0xdc32('0xdf')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xe0'));db[_0xdc32('0xe1')]=db['sequelize'][_0xdc32('0x10')]('../api/setting/setting.model');db[_0xdc32('0xe2')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xe3'));db[_0xdc32('0xe4')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xe5'));db[_0xdc32('0xe6')]=db[_0xdc32('0x1')]['import'](_0xdc32('0xe7'));db['SquareMessage']=db[_0xdc32('0x1')]['import']('../api/squareMessage/squareMessage.model');db['Team']=db[_0xdc32('0x1')]['import'](_0xdc32('0xe8'));db[_0xdc32('0xe9')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/license/license.model');db[_0xdc32('0xea')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xeb'));db[_0xdc32('0xec')]=db['sequelize'][_0xdc32('0x10')]('../api/migration/migration.model');db[_0xdc32('0xed')]=db[_0xdc32('0x1')]['import']('../api/attachment/attachment.model');db[_0xdc32('0xee')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/plugin/plugin.model');db[_0xdc32('0xef')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xf0'));db[_0xdc32('0xf1')]=db[_0xdc32('0x1')]['import'](_0xdc32('0xf2'));db[_0xdc32('0xf3')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xf4'));db[_0xdc32('0xf5')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0xf6'));db[_0xdc32('0xf7')]=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/smsTransferReport/smsTransferReport.model');db[_0xdc32('0xf8')]=db[_0xdc32('0x1')]['import']('../api/cmList/cmList.model');db[_0xdc32('0xf9')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xfa'));db['UserProfile']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xfb'));db[_0xdc32('0xfc')]=db[_0xdc32('0x1')]['import'](_0xdc32('0xfd'));db[_0xdc32('0xfe')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0xff'));db[_0xdc32('0x100')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x101'));db[_0xdc32('0x102')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x103'));db[_0xdc32('0x104')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x105'));db['WhatsappInteraction']=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0xdc32('0x106')]=db['sequelize'][_0xdc32('0x10')](_0xdc32('0x107'));db[_0xdc32('0x108')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x109'));db[_0xdc32('0x10a')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x10b'));db['WhatsappQueue']=db[_0xdc32('0x1')][_0xdc32('0x10')]('../api/whatsappQueue/whatsappQueue.model');db[_0xdc32('0x10c')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x10d'));db[_0xdc32('0x10e')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x10f'));db[_0xdc32('0x110')]=db[_0xdc32('0x1')]['import'](_0xdc32('0x111'));db[_0xdc32('0x112')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x113'));db['UserSetting']=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x114'));db[_0xdc32('0x115')]=db[_0xdc32('0x1')][_0xdc32('0x10')](_0xdc32('0x116'));db[_0xdc32('0x117')]['hasOne'](db[_0xdc32('0x20')],{'as':'VoiceMail','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x119')});db['User'][_0xdc32('0x11a')](db[_0xdc32('0x11b')],{'as':'userSetting','onDelete':'cascade','foreignKey':_0xdc32('0x119')});db[_0xdc32('0x117')][_0xdc32('0x11c')](db['VoiceRecording'],{'as':_0xdc32('0x11d'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x117')][_0xdc32('0x11c')](db['UserVoiceQueueRt'],{'as':_0xdc32('0x11e'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x117')][_0xdc32('0x11c')](db[_0xdc32('0x16')],{'as':_0xdc32('0x11f'),'onDelete':_0xdc32('0x118'),'hooks':!![]});db['User']['hasMany'](db['CmHopperFinal'],{'as':_0xdc32('0x120'),'foreignKey':_0xdc32('0x119')});db['User'][_0xdc32('0x11c')](db[_0xdc32('0x79')],{'as':_0xdc32('0x121'),'foreignKey':'UserId'});db[_0xdc32('0x117')][_0xdc32('0x11c')](db[_0xdc32('0x7a')],{'as':_0xdc32('0x7a'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xdc32('0x5d')],{'as':_0xdc32('0x122'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x117')][_0xdc32('0x11c')](db['ChatInteraction'],{'as':_0xdc32('0x123'),'foreignKey':'UserId'});db[_0xdc32('0x117')]['hasMany'](db[_0xdc32('0x124')],{'as':_0xdc32('0x125'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x117')]['hasMany'](db['FaxInteraction'],{'as':_0xdc32('0x126'),'foreignKey':'UserId'});db['User'][_0xdc32('0x11c')](db[_0xdc32('0x3f')],{'as':_0xdc32('0x127'),'foreignKey':_0xdc32('0x119')});db['User'][_0xdc32('0x11c')](db[_0xdc32('0x128')],{'as':_0xdc32('0x129'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x117')][_0xdc32('0x11c')](db[_0xdc32('0x100')],{'as':_0xdc32('0x12a'),'foreignKey':'SenderId'});db['User']['hasMany'](db[_0xdc32('0x74')],{'as':_0xdc32('0x12b'),'foreignKey':_0xdc32('0x119'),'onDelete':_0xdc32('0x12c')});db[_0xdc32('0x117')][_0xdc32('0x12d')](db['UserProfile'],{'as':_0xdc32('0x12e'),'foreignKey':'userProfileId'});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x6e')],{'as':'Groups','through':_0xdc32('0x130')});db[_0xdc32('0x117')]['belongsToMany'](db[_0xdc32('0x131')],{'as':'Contacts','through':_0xdc32('0x132')});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0xf8')],{'as':'Lists','through':'cm_user_has_lists'});db[_0xdc32('0x117')]['belongsToMany'](db['Team'],{'through':_0xdc32('0x133')});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x3f')],{'as':_0xdc32('0x127'),'through':_0xdc32('0x134')});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x135')],{'as':_0xdc32('0x123'),'through':_0xdc32('0x136')});db[_0xdc32('0x117')]['belongsToMany'](db[_0xdc32('0x4d')],{'as':_0xdc32('0x126'),'through':_0xdc32('0x137')});db['User'][_0xdc32('0x12f')](db[_0xdc32('0x124')],{'as':_0xdc32('0x125'),'through':'user_has_sms_interactions'});db[_0xdc32('0x117')]['belongsToMany'](db[_0xdc32('0x5d')],{'as':_0xdc32('0x122'),'through':'user_has_openchannel_interactions'});db[_0xdc32('0x117')][_0xdc32('0x12f')](db['WhatsappInteraction'],{'as':_0xdc32('0x129'),'through':'user_has_whatsapp_interactions'});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x1a')],{'as':'VoiceQueues','through':_0xdc32('0x2a'),'required':![]});db[_0xdc32('0x117')][_0xdc32('0x12f')](db['VoicePrefix'],{'as':_0xdc32('0x138'),'through':_0xdc32('0x112'),'required':![]});db[_0xdc32('0x117')]['belongsToMany'](db[_0xdc32('0x3b')],{'as':_0xdc32('0x139'),'through':_0xdc32('0x2d'),'required':![]});db[_0xdc32('0x117')][_0xdc32('0x12f')](db['ChatQueue'],{'as':_0xdc32('0x13a'),'through':_0xdc32('0x2b'),'required':![],'hooks':!![]});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x51')],{'as':_0xdc32('0x13b'),'through':_0xdc32('0x2f'),'required':![]});db['User'][_0xdc32('0x12f')](db[_0xdc32('0x13c')],{'as':_0xdc32('0x13d'),'through':'UserSmsQueue','required':![]});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x60')],{'as':_0xdc32('0x13e'),'through':'UserOpenchannelQueue','required':![]});db[_0xdc32('0x117')]['belongsToMany'](db['WhatsappQueue'],{'as':_0xdc32('0x13f'),'through':_0xdc32('0x35'),'required':![]});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0xf8')],{'through':'cm_user_has_lists'});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x140')],{'as':_0xdc32('0x141'),'through':_0xdc32('0x142')});db[_0xdc32('0x117')][_0xdc32('0x12f')](db['FaxAccount'],{'as':_0xdc32('0x143'),'through':'user_has_fax_accounts'});db['User'][_0xdc32('0x12f')](db['MailAccount'],{'as':_0xdc32('0x144'),'through':_0xdc32('0x145')});db[_0xdc32('0x117')][_0xdc32('0x12f')](db[_0xdc32('0x5b')],{'as':_0xdc32('0x146'),'through':'user_has_openchannel_accounts'});db[_0xdc32('0x117')]['belongsToMany'](db[_0xdc32('0x55')],{'as':_0xdc32('0x147'),'through':'user_has_sms_accounts'});db['User']['belongsToMany'](db['WhatsappAccount'],{'as':_0xdc32('0x148'),'through':'user_has_whatsapp_accounts'});db[_0xdc32('0x12')][_0xdc32('0x11c')](db['VoiceExtension'],{'as':_0xdc32('0x149'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x14a')});db['VoiceContext'][_0xdc32('0x11c')](db[_0xdc32('0x16')],{'onDelete':'cascade'});db[_0xdc32('0x16')]['hasMany'](db[_0xdc32('0x16')],{'as':_0xdc32('0x14b'),'onDelete':'cascade'});db[_0xdc32('0x18')]['belongsToMany'](db[_0xdc32('0x8c')],{'as':_0xdc32('0x14c'),'through':_0xdc32('0x14d')});db[_0xdc32('0x1a')][_0xdc32('0x11c')](db[_0xdc32('0x28')],{'as':_0xdc32('0x14e'),'foreignKey':_0xdc32('0x14f')});db[_0xdc32('0x1a')][_0xdc32('0x11c')](db[_0xdc32('0x74')],{'as':_0xdc32('0x12b'),'foreignKey':_0xdc32('0x14f')});db[_0xdc32('0x1a')][_0xdc32('0x11c')](db[_0xdc32('0x150')],{'as':'HopperFinals','foreignKey':_0xdc32('0x14f')});db[_0xdc32('0x1a')]['hasMany'](db[_0xdc32('0x79')],{'as':_0xdc32('0x151'),'foreignKey':'VoiceQueueId'});db['VoiceQueue']['hasMany'](db[_0xdc32('0x7a')],{'as':_0xdc32('0x7a'),'foreignKey':_0xdc32('0x14f')});db['VoiceQueue'][_0xdc32('0x11c')](db[_0xdc32('0x76')],{'as':'HopperBlacks','foreignKey':_0xdc32('0x14f')});db['VoiceQueue']['hasMany'](db['JscriptySessionReport'],{'as':_0xdc32('0x152'),'foreignKey':_0xdc32('0x14f')});db[_0xdc32('0x1a')][_0xdc32('0x12d')](db[_0xdc32('0x26')],{'as':'Trunk','foreignKey':_0xdc32('0x153')});db[_0xdc32('0x1a')][_0xdc32('0x12d')](db['Trunk'],{'as':'TrunkBackup','foreignKey':_0xdc32('0x154')});db['VoiceQueue'][_0xdc32('0x12d')](db[_0xdc32('0x155')],{'as':_0xdc32('0x155'),'foreignKey':'IntervalId'});db[_0xdc32('0x1a')][_0xdc32('0x12d')](db[_0xdc32('0x84')],{'as':_0xdc32('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xdc32('0x1a')]['belongsToMany'](db[_0xdc32('0xf8')],{'as':_0xdc32('0x157'),'through':_0xdc32('0x158')});db['VoiceQueue'][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x2a')});db[_0xdc32('0x1a')]['belongsToMany'](db['Team'],{'as':_0xdc32('0x15a'),'through':_0xdc32('0x10e')});db[_0xdc32('0x1a')]['belongsToMany'](db[_0xdc32('0xf8')],{'as':_0xdc32('0x15b'),'through':_0xdc32('0x15c')});db[_0xdc32('0x1c')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':_0xdc32('0x117'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x1e')]['belongsTo'](db[_0xdc32('0x117')],{'as':_0xdc32('0x117'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x20')]['hasMany'](db[_0xdc32('0x21')],{'as':_0xdc32('0x15d'),'onDelete':'cascade','foreignKey':_0xdc32('0x15e'),'sourceKey':'mailbox'});db[_0xdc32('0x21')][_0xdc32('0x12d')](db[_0xdc32('0x20')],{'foreignKey':'mailboxuser','targetKey':_0xdc32('0x15f')});db[_0xdc32('0x22')][_0xdc32('0x11c')](db[_0xdc32('0x160')],{'as':_0xdc32('0x161'),'foreignKey':_0xdc32('0x162'),'constraints':![]});db[_0xdc32('0x22')][_0xdc32('0x11c')](db[_0xdc32('0x163')],{'as':_0xdc32('0x164'),'foreignKey':'uniqueid','constraints':![]});db['VoiceCallReport'][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'User','foreignKey':_0xdc32('0x119')});db[_0xdc32('0x22')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':'ContactId'});db[_0xdc32('0x37')][_0xdc32('0x12d')](db['MailAccount'],{'as':_0xdc32('0x3a'),'foreignKey':_0xdc32('0x165')});db['MailServerIn'][_0xdc32('0x12d')](db['CloudProvider'],{'as':_0xdc32('0x10c'),'foreignKey':_0xdc32('0x166'),'onDelete':'restrict'});db[_0xdc32('0x167')][_0xdc32('0x12d')](db[_0xdc32('0x3a')],{'as':_0xdc32('0x3a'),'foreignKey':_0xdc32('0x165')});db[_0xdc32('0x167')]['belongsTo'](db[_0xdc32('0x10c')],{'as':_0xdc32('0x10c'),'foreignKey':_0xdc32('0x166'),'onDelete':_0xdc32('0x168')});db['MailAccount'][_0xdc32('0x11a')](db[_0xdc32('0x37')],{'as':_0xdc32('0x169'),'onDelete':'cascade'});db[_0xdc32('0x3a')][_0xdc32('0x11a')](db[_0xdc32('0x167')],{'as':_0xdc32('0x16a'),'onDelete':'cascade'});db[_0xdc32('0x3a')][_0xdc32('0x11c')](db[_0xdc32('0x80')],{'as':_0xdc32('0x16b'),'foreignKey':_0xdc32('0x165'),'onDelete':_0xdc32('0x118')});db['MailAccount'][_0xdc32('0x11c')](db[_0xdc32('0x7e')],{'as':_0xdc32('0x16c'),'foreignKey':'MailAccountId'});db['MailAccount'][_0xdc32('0x11c')](db[_0xdc32('0x41')],{'as':'Messages','foreignKey':_0xdc32('0x165')});db['MailAccount']['hasMany'](db[_0xdc32('0x3f')],{'as':'Interactions'});db[_0xdc32('0x3a')][_0xdc32('0x11c')](db[_0xdc32('0x43')],{'as':'Applications','foreignKey':_0xdc32('0x165'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x3a')]['belongsTo'](db['CmList'],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db['MailAccount']['belongsTo'](db[_0xdc32('0x16f')],{'as':'Template','foreignKey':'TemplateId'});db['MailAccount'][_0xdc32('0x12d')](db[_0xdc32('0x84')],{'as':_0xdc32('0x156'),'foreignKey':_0xdc32('0x170')});db[_0xdc32('0x3a')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':'user_has_mail_accounts'});db['MailQueue']['belongsToMany'](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x2d')});db[_0xdc32('0x3b')][_0xdc32('0x12f')](db[_0xdc32('0x171')],{'through':'team_has_mail_queues','as':_0xdc32('0x15a')});db[_0xdc32('0x3f')][_0xdc32('0x11c')](db[_0xdc32('0x41')],{'as':_0xdc32('0x15d'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x172')});db[_0xdc32('0x3f')]['belongsTo'](db['MailAccount'],{'as':'Account','foreignKey':'MailAccountId'});db[_0xdc32('0x3f')]['belongsTo'](db[_0xdc32('0x131')],{'as':_0xdc32('0x173'),'foreignKey':'ContactId'});db[_0xdc32('0x3f')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':'UserId'});db[_0xdc32('0x3f')][_0xdc32('0x12f')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xdc32('0x174')});db['MailInteraction'][_0xdc32('0x12f')](db[_0xdc32('0x8e')],{'through':_0xdc32('0x175'),'as':'ThroughTags'});db[_0xdc32('0x3f')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':'Users','through':_0xdc32('0x134'),'foreignKey':_0xdc32('0x172')});db[_0xdc32('0x41')][_0xdc32('0x11c')](db['Attachment'],{'as':'Attachments','onDelete':_0xdc32('0x118')});db[_0xdc32('0x41')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'User'});db[_0xdc32('0x41')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'onDelete':_0xdc32('0x118'),'as':_0xdc32('0x173')});db[_0xdc32('0x41')][_0xdc32('0x12d')](db[_0xdc32('0x3f')],{'as':_0xdc32('0x176'),'foreignKey':_0xdc32('0x172')});db[_0xdc32('0x41')]['belongsTo'](db['MailAccount'],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x165')});db[_0xdc32('0x41')][_0xdc32('0x12d')](db[_0xdc32('0x140')],{'as':_0xdc32('0x140'),'foreignKey':_0xdc32('0x178')});db[_0xdc32('0x41')][_0xdc32('0x12d')](db['ChatOfflineMessage'],{'as':_0xdc32('0x6a'),'foreignKey':_0xdc32('0x179')});db['MailApplication']['belongsTo'](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x168')});db['MailApplication'][_0xdc32('0x12d')](db[_0xdc32('0x3b')],{'onDelete':'restrict'});db[_0xdc32('0x43')][_0xdc32('0x12d')](db[_0xdc32('0x3a')],{'onDelete':_0xdc32('0x168')});db['MailApplication'][_0xdc32('0x12d')](db[_0xdc32('0x155')],{'onDelete':_0xdc32('0x168'),'foreignKey':_0xdc32('0x17a')});db[_0xdc32('0x43')][_0xdc32('0x12d')](db[_0xdc32('0x8e')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xdc32('0x45')][_0xdc32('0x12d')](db[_0xdc32('0x3a')],{});db[_0xdc32('0x45')]['belongsTo'](db[_0xdc32('0xf8')],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x45')]['belongsTo'](db['CmContact'],{'as':_0xdc32('0x173'),'foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x45')][_0xdc32('0x12d')](db['MailInteraction'],{});db[_0xdc32('0x45')]['belongsTo'](db['MailMessage'],{});db[_0xdc32('0x45')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{});db[_0xdc32('0x45')][_0xdc32('0x12d')](db[_0xdc32('0x3b')],{});db[_0xdc32('0x17c')][_0xdc32('0x11c')](db[_0xdc32('0x48')],{'as':_0xdc32('0x17d'),'onDelete':'cascade'});db['FaxAccount']['hasMany'](db[_0xdc32('0x80')],{'as':_0xdc32('0x16b'),'foreignKey':_0xdc32('0x17e'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x17f')][_0xdc32('0x11c')](db['CannedAnswer'],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0xdc32('0x17f')][_0xdc32('0x11c')](db[_0xdc32('0x4d')],{'as':_0xdc32('0x180')});db[_0xdc32('0x17f')]['hasMany'](db[_0xdc32('0x4b')],{'as':_0xdc32('0x14b'),'foreignKey':_0xdc32('0x17e'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x17f')][_0xdc32('0x11c')](db[_0xdc32('0x16')],{'as':_0xdc32('0x181'),'onDelete':_0xdc32('0x118')});db['FaxAccount'][_0xdc32('0x11c')](db[_0xdc32('0x4f')],{'as':_0xdc32('0x15d')});db[_0xdc32('0x17f')][_0xdc32('0x12d')](db[_0xdc32('0x26')],{'as':_0xdc32('0x26')});db[_0xdc32('0x17f')][_0xdc32('0x12d')](db['CmList'],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x17f')]['belongsTo'](db[_0xdc32('0x84')],{'as':_0xdc32('0x156'),'foreignKey':'mandatoryDispositionPauseId'});db['FaxAccount'][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x182')});db['FaxApplication'][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x4b')][_0xdc32('0x12d')](db[_0xdc32('0x51')],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x4b')][_0xdc32('0x12d')](db[_0xdc32('0x17f')],{'onDelete':_0xdc32('0x168')});db['FaxApplication'][_0xdc32('0x12d')](db['Tag'],{'onDelete':_0xdc32('0x168'),'foreignKey':_0xdc32('0x183')});db[_0xdc32('0x4d')][_0xdc32('0x11c')](db[_0xdc32('0x4f')],{'as':'Messages','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x184')});db['FaxInteraction'][_0xdc32('0x12d')](db[_0xdc32('0x17f')],{'as':_0xdc32('0x177'),'foreignKey':'FaxAccountId'});db[_0xdc32('0x4d')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'as':_0xdc32('0x173'),'foreignKey':'ContactId'});db[_0xdc32('0x4d')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'Owner','foreignKey':_0xdc32('0x119')});db[_0xdc32('0x4d')]['belongsToMany'](db[_0xdc32('0x8e')],{'through':_0xdc32('0x185'),'as':_0xdc32('0x174')});db[_0xdc32('0x4d')][_0xdc32('0x12f')](db[_0xdc32('0x8e')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db['FaxInteraction']['belongsToMany'](db[_0xdc32('0x117')],{'as':_0xdc32('0x186'),'through':_0xdc32('0x137'),'foreignKey':_0xdc32('0x184')});db[_0xdc32('0x4f')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'onDelete':'cascade','as':_0xdc32('0x117')});db['FaxMessage'][_0xdc32('0x12d')](db['FaxInteraction'],{'as':_0xdc32('0x176'),'foreignKey':_0xdc32('0x184')});db[_0xdc32('0x4f')]['belongsTo'](db[_0xdc32('0x131')],{'onDelete':'cascade','as':'Contact'});db[_0xdc32('0x4f')][_0xdc32('0x12d')](db['Attachment'],{'as':_0xdc32('0xed'),'foreignKey':_0xdc32('0x187')});db[_0xdc32('0x4f')]['belongsTo'](db[_0xdc32('0x17f')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x17e')});db['FaxQueue'][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x2f')});db[_0xdc32('0x51')][_0xdc32('0x12f')](db['Team'],{'through':'team_has_fax_queues','as':_0xdc32('0x15a')});db[_0xdc32('0x53')][_0xdc32('0x12d')](db[_0xdc32('0x17f')],{});db[_0xdc32('0x53')]['belongsTo'](db[_0xdc32('0xf8')],{'as':'List','foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x53')][_0xdc32('0x12d')](db['CmContact'],{'as':_0xdc32('0x173'),'foreignKey':'ContactId'});db[_0xdc32('0x53')][_0xdc32('0x12d')](db[_0xdc32('0x4d')],{});db['FaxQueueReport'][_0xdc32('0x12d')](db[_0xdc32('0x4f')],{});db[_0xdc32('0x53')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{});db[_0xdc32('0x53')]['belongsTo'](db[_0xdc32('0x51')],{});db[_0xdc32('0x55')][_0xdc32('0x11c')](db[_0xdc32('0x80')],{'as':_0xdc32('0x16b'),'foreignKey':_0xdc32('0x188'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x55')][_0xdc32('0x11c')](db[_0xdc32('0x7e')],{'as':_0xdc32('0x16c'),'foreignKey':'SmsAccountId'});db[_0xdc32('0x55')][_0xdc32('0x11c')](db['SmsMessage'],{'as':_0xdc32('0x15d'),'foreignKey':'SmsAccountId'});db[_0xdc32('0x55')][_0xdc32('0x11c')](db[_0xdc32('0x124')],{'as':_0xdc32('0x180')});db[_0xdc32('0x55')][_0xdc32('0x11c')](db['SmsApplication'],{'as':_0xdc32('0x14b'),'foreignKey':_0xdc32('0x188'),'onDelete':'cascade'});db[_0xdc32('0x55')][_0xdc32('0x12d')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db['SmsAccount'][_0xdc32('0x12d')](db[_0xdc32('0x84')],{'as':_0xdc32('0x156'),'foreignKey':_0xdc32('0x170')});db[_0xdc32('0x55')]['belongsToMany'](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':'user_has_sms_accounts'});db[_0xdc32('0x56')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x56')]['belongsTo'](db['SmsQueue'],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x56')][_0xdc32('0x12d')](db[_0xdc32('0x55')],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x56')][_0xdc32('0x12d')](db[_0xdc32('0x155')],{'onDelete':'restrict','foreignKey':_0xdc32('0x17a')});db['SmsApplication'][_0xdc32('0x12d')](db[_0xdc32('0x8e')],{'onDelete':_0xdc32('0x168'),'foreignKey':_0xdc32('0x183')});db['SmsInteraction'][_0xdc32('0x11c')](db[_0xdc32('0x59')],{'as':'Messages','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x189')});db[_0xdc32('0x124')][_0xdc32('0x12d')](db[_0xdc32('0x55')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x188')});db[_0xdc32('0x124')]['belongsTo'](db[_0xdc32('0x131')],{'as':_0xdc32('0x173'),'foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x124')]['belongsTo'](db['User'],{'as':_0xdc32('0x18a'),'foreignKey':_0xdc32('0x119')});db[_0xdc32('0x124')][_0xdc32('0x12f')](db['Tag'],{'through':_0xdc32('0x18b'),'as':_0xdc32('0x174')});db['SmsInteraction']['belongsToMany'](db[_0xdc32('0x8e')],{'through':_0xdc32('0x18b'),'as':_0xdc32('0x18c')});db[_0xdc32('0x124')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':'Users','through':_0xdc32('0x18d'),'foreignKey':_0xdc32('0x189')});db['SmsMessage'][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'User'});db['SmsMessage'][_0xdc32('0x12d')](db['CmContact'],{'onDelete':_0xdc32('0x118'),'as':_0xdc32('0x173')});db['SmsMessage']['belongsTo'](db['SmsInteraction'],{'onDelete':'cascade','as':_0xdc32('0x176'),'foreignKey':_0xdc32('0x189')});db[_0xdc32('0x59')][_0xdc32('0x12d')](db[_0xdc32('0x55')],{'as':'Account','foreignKey':'SmsAccountId'});db[_0xdc32('0x13c')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x31'),'foreignKey':_0xdc32('0x18e')});db[_0xdc32('0x13c')][_0xdc32('0x12f')](db['Team'],{'through':_0xdc32('0x18f'),'as':'Teams'});db[_0xdc32('0x5b')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0xdc32('0x190'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x5b')]['hasMany'](db[_0xdc32('0x7e')],{'as':'Answers','foreignKey':_0xdc32('0x190')});db['OpenchannelAccount'][_0xdc32('0x11c')](db[_0xdc32('0x5d')],{'as':_0xdc32('0x180'),'foreignKey':'OpenchannelAccountId'});db[_0xdc32('0x5b')][_0xdc32('0x11c')](db[_0xdc32('0x5f')],{'as':_0xdc32('0x15d'),'foreignKey':_0xdc32('0x190')});db['OpenchannelAccount'][_0xdc32('0x11c')](db[_0xdc32('0x191')],{'as':_0xdc32('0x14b'),'foreignKey':_0xdc32('0x190'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x5b')]['belongsTo'](db[_0xdc32('0xf8')],{'as':'List','foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x5b')][_0xdc32('0x12d')](db[_0xdc32('0x84')],{'as':_0xdc32('0x156'),'foreignKey':_0xdc32('0x170')});db['OpenchannelAccount']['belongsToMany'](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x192')});db['OpenchannelApplication']['belongsTo'](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x191')]['belongsTo'](db[_0xdc32('0x60')],{'onDelete':'restrict','foreignKey':_0xdc32('0x193')});db['OpenchannelApplication'][_0xdc32('0x12d')](db[_0xdc32('0x5b')],{'onDelete':_0xdc32('0x168'),'foreignKey':_0xdc32('0x190')});db[_0xdc32('0x191')]['belongsTo'](db[_0xdc32('0x155')],{'onDelete':'restrict','foreignKey':_0xdc32('0x17a')});db[_0xdc32('0x191')]['belongsTo'](db[_0xdc32('0x8e')],{'onDelete':_0xdc32('0x168'),'foreignKey':_0xdc32('0x183')});db[_0xdc32('0x5d')][_0xdc32('0x11c')](db[_0xdc32('0x5f')],{'as':_0xdc32('0x15d'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x194')});db[_0xdc32('0x5d')][_0xdc32('0x12d')](db[_0xdc32('0x5b')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x190')});db[_0xdc32('0x5d')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'as':'Contact','foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x5d')]['belongsTo'](db[_0xdc32('0x117')],{'as':_0xdc32('0x18a'),'foreignKey':_0xdc32('0x119')});db['OpenchannelInteraction'][_0xdc32('0x12f')](db[_0xdc32('0x8e')],{'through':_0xdc32('0x195'),'as':_0xdc32('0x174')});db[_0xdc32('0x5d')][_0xdc32('0x12f')](db[_0xdc32('0x8e')],{'through':_0xdc32('0x195'),'as':_0xdc32('0x18c')});db[_0xdc32('0x5d')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x186'),'through':'user_has_openchannel_interactions','foreignKey':_0xdc32('0x194')});db[_0xdc32('0x5f')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x118'),'as':'User'});db[_0xdc32('0x5f')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'onDelete':_0xdc32('0x118'),'as':_0xdc32('0x173')});db[_0xdc32('0x5f')]['belongsTo'](db[_0xdc32('0x5d')],{'onDelete':_0xdc32('0x118'),'as':_0xdc32('0x176'),'foreignKey':_0xdc32('0x194')});db['OpenchannelMessage'][_0xdc32('0x12d')](db['Attachment'],{'as':_0xdc32('0xed'),'foreignKey':_0xdc32('0x187')});db['OpenchannelMessage'][_0xdc32('0x12d')](db[_0xdc32('0x5b')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x190')});db[_0xdc32('0x60')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x33'),'foreignKey':_0xdc32('0x193')});db[_0xdc32('0x60')][_0xdc32('0x12f')](db[_0xdc32('0x171')],{'through':_0xdc32('0x196'),'as':_0xdc32('0x15a')});db[_0xdc32('0x140')][_0xdc32('0x11c')](db[_0xdc32('0x80')],{'as':_0xdc32('0x16b'),'foreignKey':'ChatWebsiteId','onDelete':_0xdc32('0x118')});db[_0xdc32('0x140')]['hasMany'](db[_0xdc32('0x7e')],{'as':_0xdc32('0x16c'),'foreignKey':_0xdc32('0x178')});db[_0xdc32('0x140')]['hasMany'](db[_0xdc32('0x197')],{'as':_0xdc32('0x198')});db['ChatWebsite'][_0xdc32('0x11c')](db[_0xdc32('0x135')],{'as':_0xdc32('0x180')});db[_0xdc32('0x140')][_0xdc32('0x11c')](db[_0xdc32('0x65')],{'as':_0xdc32('0x14b'),'foreignKey':_0xdc32('0x178'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x140')][_0xdc32('0x11c')](db[_0xdc32('0x68')],{'as':_0xdc32('0x15d')});db[_0xdc32('0x140')][_0xdc32('0x12d')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x140')][_0xdc32('0x12d')](db[_0xdc32('0x155')],{'as':'Interval','foreignKey':'IntervalId'});db[_0xdc32('0x140')][_0xdc32('0x12d')](db['MailAccount'],{'as':'MailAccount','foreignKey':_0xdc32('0x165')});db[_0xdc32('0x140')][_0xdc32('0x12d')](db[_0xdc32('0x84')],{'as':_0xdc32('0x156'),'foreignKey':_0xdc32('0x170')});db[_0xdc32('0x140')][_0xdc32('0x12f')](db['User'],{'as':_0xdc32('0x159'),'through':'user_has_chat_websites'});db[_0xdc32('0x63')][_0xdc32('0x12d')](db[_0xdc32('0x5b')],{});db['OpenchannelQueueReport'][_0xdc32('0x12d')](db[_0xdc32('0xf8')],{'as':'List','foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x63')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'as':_0xdc32('0x173'),'foreignKey':'ContactId'});db['OpenchannelQueueReport'][_0xdc32('0x12d')](db['OpenchannelInteraction'],{});db[_0xdc32('0x63')]['belongsTo'](db[_0xdc32('0x5f')],{});db[_0xdc32('0x63')][_0xdc32('0x12d')](db['User'],{});db[_0xdc32('0x63')][_0xdc32('0x12d')](db[_0xdc32('0x60')],{});db[_0xdc32('0x65')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'Agent','foreignKey':_0xdc32('0x119'),'onDelete':_0xdc32('0x168')});db[_0xdc32('0x65')][_0xdc32('0x12d')](db[_0xdc32('0x6c')],{'as':_0xdc32('0x199'),'foreignKey':_0xdc32('0x19a'),'onDelete':_0xdc32('0x168')});db[_0xdc32('0x65')][_0xdc32('0x12d')](db['ChatWebsite'],{'as':_0xdc32('0x19b'),'foreignKey':'ChatWebsiteId','onDelete':'restrict'});db['ChatApplication'][_0xdc32('0x12d')](db[_0xdc32('0x8e')],{'onDelete':'restrict','foreignKey':_0xdc32('0x183')});db[_0xdc32('0x135')][_0xdc32('0x11c')](db[_0xdc32('0x68')],{'as':_0xdc32('0x15d'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x19c')});db[_0xdc32('0x135')][_0xdc32('0x12d')](db[_0xdc32('0x140')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x178')});db[_0xdc32('0x135')]['belongsTo'](db['CmContact'],{'as':_0xdc32('0x173'),'foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x135')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'Owner','foreignKey':_0xdc32('0x119')});db[_0xdc32('0x135')][_0xdc32('0x12f')](db[_0xdc32('0x8e')],{'through':_0xdc32('0x19d'),'as':_0xdc32('0x174')});db[_0xdc32('0x135')]['belongsToMany'](db[_0xdc32('0x8e')],{'through':'chat_interaction_has_tags','as':_0xdc32('0x18c')});db[_0xdc32('0x135')]['belongsToMany'](db[_0xdc32('0x117')],{'as':_0xdc32('0x186'),'through':_0xdc32('0x136'),'foreignKey':'ChatInteractionId'});db[_0xdc32('0x68')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x118'),'as':_0xdc32('0x117')});db['ChatMessage'][_0xdc32('0x12d')](db['CmContact'],{'onDelete':'cascade','as':'Contact','foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x68')][_0xdc32('0x12d')](db[_0xdc32('0x135')],{'onDelete':_0xdc32('0x118'),'as':_0xdc32('0x176'),'foreignKey':_0xdc32('0x19c')});db['ChatMessage'][_0xdc32('0x12d')](db['Attachment'],{'as':_0xdc32('0xed'),'foreignKey':_0xdc32('0x187')});db[_0xdc32('0x68')][_0xdc32('0x12d')](db[_0xdc32('0x140')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x178')});db[_0xdc32('0x6a')][_0xdc32('0x11c')](db[_0xdc32('0xed')],{'as':'Attachments','foreignKey':_0xdc32('0x179'),'onDelete':_0xdc32('0x118'),'hooks':!![]});db[_0xdc32('0x6a')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'onDelete':_0xdc32('0x118'),'as':'Contact','foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x6a')]['belongsTo'](db[_0xdc32('0x140')],{'as':_0xdc32('0x177'),'foreignKey':'ChatWebsiteId'});db[_0xdc32('0x6c')]['belongsToMany'](db[_0xdc32('0x117')],{'as':'Agents','through':_0xdc32('0x2b'),'hooks':!![]});db[_0xdc32('0x6c')][_0xdc32('0x12f')](db['Team'],{'through':_0xdc32('0x19e'),'as':_0xdc32('0x15a')});db[_0xdc32('0x6e')]['hasMany'](db['ChatInternalMessage'],{'as':_0xdc32('0x15d'),'foreignKey':_0xdc32('0x19f'),'onDelete':_0xdc32('0x118')});db['ChatGroup'][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x14e'),'through':_0xdc32('0x130')});db[_0xdc32('0x197')][_0xdc32('0x12d')](db[_0xdc32('0x140')],{'as':_0xdc32('0x19b'),'foreignKey':_0xdc32('0x178')});db[_0xdc32('0x71')][_0xdc32('0x11c')](db[_0xdc32('0x131')],{'as':_0xdc32('0x1a0'),'foreignKey':_0xdc32('0x1a1')});db[_0xdc32('0x131')][_0xdc32('0x11c')](db[_0xdc32('0x90')],{'as':_0xdc32('0x1a2'),'foreignKey':_0xdc32('0x1a3')});db[_0xdc32('0x131')][_0xdc32('0x11c')](db[_0xdc32('0x74')],{'as':_0xdc32('0x12b'),'foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x131')]['hasMany'](db['CmHopperFinal'],{'as':'HopperFinals','foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x131')][_0xdc32('0x11c')](db['CmHopperHistory'],{'as':_0xdc32('0x151'),'foreignKey':'ContactId'});db['CmContact']['hasMany'](db[_0xdc32('0x7a')],{'as':_0xdc32('0x7a'),'foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x131')][_0xdc32('0x11c')](db[_0xdc32('0xd8')],{'as':'JscriptySessions','foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x131')][_0xdc32('0x11c')](db[_0xdc32('0x5d')],{'as':_0xdc32('0x122'),'foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0xdc32('0x11c')](db[_0xdc32('0x135')],{'as':'ChatInteractions','foreignKey':_0xdc32('0x17b'),'onDelete':_0xdc32('0x168')});db[_0xdc32('0x131')]['hasMany'](db['SmsInteraction'],{'as':_0xdc32('0x125'),'foreignKey':_0xdc32('0x17b'),'onDelete':_0xdc32('0x168')});db[_0xdc32('0x131')]['hasMany'](db[_0xdc32('0x4d')],{'as':_0xdc32('0x126'),'foreignKey':_0xdc32('0x17b'),'onDelete':'restrict'});db[_0xdc32('0x131')][_0xdc32('0x11c')](db['MailInteraction'],{'as':_0xdc32('0x127'),'foreignKey':_0xdc32('0x17b'),'onDelete':_0xdc32('0x168')});db['CmContact'][_0xdc32('0x12d')](db[_0xdc32('0x71')],{'as':'Company','foreignKey':'CompanyId'});db['CmContact'][_0xdc32('0x12d')](db['CmList'],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e'),'onDelete':'cascade'});db['CmContact']['belongsToMany'](db['User'],{'as':_0xdc32('0x186'),'through':_0xdc32('0x132')});db['CmContact']['belongsToMany'](db[_0xdc32('0x8e')],{'as':_0xdc32('0x174'),'through':_0xdc32('0x1a4')});db[_0xdc32('0x131')][_0xdc32('0x12f')](db[_0xdc32('0x8e')],{'through':'cm_contact_has_tags','as':_0xdc32('0x18c')});db['CmHopper'][_0xdc32('0x11c')](db[_0xdc32('0x92')],{'as':'AdditionalPhones','foreignKey':'CmHopperId'});db['CmHopper'][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'as':_0xdc32('0x173'),'foreignKey':'ContactId','onDelete':_0xdc32('0x118')});db['CmHopper'][_0xdc32('0x12d')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e'),'onDelete':'cascade'});db['CmHopper'][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'Agent','foreignKey':_0xdc32('0x119')});db[_0xdc32('0x74')][_0xdc32('0x12d')](db[_0xdc32('0x1a')],{'as':'Queue','foreignKey':_0xdc32('0x14f'),'onDelete':_0xdc32('0x118')});db['CmHopper'][_0xdc32('0x12d')](db[_0xdc32('0xea')],{'as':_0xdc32('0xea'),'foreignKey':_0xdc32('0x1a5'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x74')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':'Owner','foreignKey':'OwnerId'});db[_0xdc32('0x76')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'as':'Contact','foreignKey':_0xdc32('0x17b'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x76')]['belongsTo'](db['CmList'],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x76')][_0xdc32('0x12d')](db[_0xdc32('0x1a')],{'as':_0xdc32('0x199'),'foreignKey':_0xdc32('0x14f'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x76')][_0xdc32('0x12d')](db[_0xdc32('0xea')],{'as':_0xdc32('0xea'),'foreignKey':_0xdc32('0x1a5'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x1a6')][_0xdc32('0x11c')](db['Condition'],{'as':{'plural':'All','singular':_0xdc32('0x1a7')},'foreignKey':_0xdc32('0x1a8'),'onDelete':_0xdc32('0x118'),'hooks':!![]});db['Automation'][_0xdc32('0x11c')](db['Condition'],{'as':{'plural':'Any','singular':_0xdc32('0x1a9')},'foreignKey':_0xdc32('0x1aa'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xdc32('0x11c')](db['Action'],{'as':'Actions','foreignKey':_0xdc32('0x1ab'),'onDelete':_0xdc32('0x118'),'hooks':!![]});db[_0xdc32('0x80')][_0xdc32('0x11c')](db[_0xdc32('0x80')],{'as':_0xdc32('0x16b'),'foreignKey':_0xdc32('0x1ac'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x155')]['hasMany'](db[_0xdc32('0x155')],{'as':_0xdc32('0x1ad'),'foreignKey':_0xdc32('0x17a'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xdc32('0x155')][_0xdc32('0x11c')](db['VoiceExtension'],{'as':_0xdc32('0x11f'),'foreignKey':'IntervalId','onDelete':_0xdc32('0x168')});db[_0xdc32('0x155')][_0xdc32('0x11c')](db[_0xdc32('0x43')],{'as':_0xdc32('0x1ae'),'foreignKey':_0xdc32('0x17a')});db[_0xdc32('0x155')]['hasMany'](db[_0xdc32('0x65')],{'as':_0xdc32('0x1af'),'foreignKey':'IntervalId'});db[_0xdc32('0x155')]['hasMany'](db[_0xdc32('0x4b')],{'as':_0xdc32('0x1b0'),'foreignKey':_0xdc32('0x17a')});db[_0xdc32('0x155')][_0xdc32('0x11c')](db['SmsApplication'],{'as':_0xdc32('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0xdc32('0x12d')](db[_0xdc32('0x3a')],{});db[_0xdc32('0x8a')]['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0xdc32('0x1b2')});db[_0xdc32('0x8a')][_0xdc32('0x12d')](db['AnalyticCustomReport'],{'foreignKey':_0xdc32('0x1b3')});db['Sound']['belongsToMany'](db[_0xdc32('0x18')],{'as':_0xdc32('0x1b4'),'through':_0xdc32('0x14d'),'onDelete':_0xdc32('0x168')});db[_0xdc32('0x8e')][_0xdc32('0x12f')](db[_0xdc32('0x131')],{'through':'cm_contact_has_tags'});db[_0xdc32('0x8e')][_0xdc32('0x12f')](db['ChatInteraction'],{'through':_0xdc32('0x19d')});db[_0xdc32('0x8e')][_0xdc32('0x12f')](db['MailInteraction'],{'through':'mail_interaction_has_tags'});db['Tag'][_0xdc32('0x12f')](db[_0xdc32('0x124')],{'through':_0xdc32('0x18b')});db[_0xdc32('0x8e')][_0xdc32('0x12f')](db[_0xdc32('0x4d')],{'through':'fax_interaction_has_tags'});db['Tag']['belongsToMany'](db['OpenchannelInteraction'],{'through':'openchannel_interaction_has_tags'});db[_0xdc32('0x8e')][_0xdc32('0x12f')](db[_0xdc32('0x128')],{'through':_0xdc32('0x1b5')});db[_0xdc32('0x90')][_0xdc32('0x12d')](db['ContactItemType'],{'as':_0xdc32('0x1b6'),'foreignKey':_0xdc32('0x1b7')});db[_0xdc32('0x92')][_0xdc32('0x12d')](db[_0xdc32('0x74')],{'as':'Hopper','foreignKey':_0xdc32('0x1b8')});db[_0xdc32('0x90')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xdc32('0x1a3')});db['Trigger'][_0xdc32('0x11c')](db[_0xdc32('0x81')],{'as':{'plural':_0xdc32('0x1b9'),'singular':_0xdc32('0x1ba')},'foreignKey':_0xdc32('0x1bb'),'onDelete':_0xdc32('0x118'),'hooks':!![]});db['Trigger'][_0xdc32('0x11c')](db[_0xdc32('0x81')],{'as':{'plural':'AnyConditions','singular':_0xdc32('0x1bc')},'foreignKey':_0xdc32('0x1bd'),'onDelete':_0xdc32('0x118'),'hooks':!![]});db['Trigger'][_0xdc32('0x11c')](db[_0xdc32('0x7c')],{'as':'Actions','foreignKey':'TriggerId','onDelete':_0xdc32('0x118'),'hooks':!![]});db[_0xdc32('0x1be')][_0xdc32('0x11c')](db[_0xdc32('0x9e')],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1b3'),'hooks':!![]});db[_0xdc32('0x1c0')][_0xdc32('0x11c')](db[_0xdc32('0x9e')],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':'DefaultReportId'});db['AnalyticMetric'][_0xdc32('0x11c')](db[_0xdc32('0x9e')],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c1')});db[_0xdc32('0x9e')][_0xdc32('0x12d')](db[_0xdc32('0x9c')],{'foreignKey':_0xdc32('0x1c1')});db['SalesforceAccount']['hasMany'](db[_0xdc32('0x1c2')],{'as':_0xdc32('0x1c3'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0x1c2')][_0xdc32('0x11c')](db[_0xdc32('0xa4')],{'as':_0xdc32('0x1c5'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c6')});db['SalesforceConfiguration'][_0xdc32('0x11c')](db[_0xdc32('0xa4')],{'as':_0xdc32('0x1c7'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0x1c2')]['hasMany'](db[_0xdc32('0xa4')],{'as':'Fields','onDelete':'cascade','foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0x1c2')][_0xdc32('0x12d')](db[_0xdc32('0xa1')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xa4')][_0xdc32('0x11c')](db['SalesforceField'],{'as':_0xdc32('0x1ca'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xa4')][_0xdc32('0x11c')](db[_0xdc32('0xa4')],{'as':'Description','foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xa4')][_0xdc32('0x11c')](db[_0xdc32('0xa4')],{'as':'Field','foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xa4')][_0xdc32('0x12d')](db[_0xdc32('0x95')],{'as':_0xdc32('0x95'),'foreignKey':'VariableId'});db[_0xdc32('0xa5')][_0xdc32('0x11c')](db['SugarcrmConfiguration'],{'as':'Configurations','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xa6')][_0xdc32('0x11c')](db['SugarcrmField'],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xa6')][_0xdc32('0x11c')](db[_0xdc32('0xa8')],{'as':'Descriptions','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xa6')][_0xdc32('0x11c')](db[_0xdc32('0xa8')],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xa6')][_0xdc32('0x12d')](db['SugarcrmAccount'],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xa8')][_0xdc32('0x11c')](db[_0xdc32('0xa8')],{'as':'Subject','foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xa8')][_0xdc32('0x11c')](db['SugarcrmField'],{'as':_0xdc32('0x1cb'),'foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xa8')][_0xdc32('0x11c')](db['SugarcrmField'],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xa8')][_0xdc32('0x12d')](db['Variable'],{'as':_0xdc32('0x95'),'foreignKey':'VariableId'});db['DeskAccount']['hasMany'](db[_0xdc32('0xab')],{'as':_0xdc32('0x1c3'),'onDelete':_0xdc32('0x118'),'foreignKey':'AccountId'});db[_0xdc32('0xab')][_0xdc32('0x11c')](db['DeskField'],{'as':_0xdc32('0x1c5'),'onDelete':'cascade','foreignKey':'SubjectId'});db['DeskConfiguration']['hasMany'](db[_0xdc32('0xad')],{'as':_0xdc32('0x1c7'),'onDelete':'cascade','foreignKey':'DescriptionId'});db[_0xdc32('0xab')][_0xdc32('0x11c')](db[_0xdc32('0xad')],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c9')});db['DeskConfiguration']['belongsTo'](db['DeskAccount'],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xab')][_0xdc32('0x12f')](db['Tag'],{'through':_0xdc32('0x1cd')});db[_0xdc32('0xad')][_0xdc32('0x11c')](db[_0xdc32('0xad')],{'as':_0xdc32('0x1ca'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xad')][_0xdc32('0x11c')](db['DeskField'],{'as':_0xdc32('0x1cb'),'foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xad')][_0xdc32('0x11c')](db[_0xdc32('0xad')],{'as':_0xdc32('0x1cc'),'foreignKey':'FieldId'});db[_0xdc32('0xad')]['belongsTo'](db[_0xdc32('0x95')],{'as':_0xdc32('0x95'),'foreignKey':_0xdc32('0x1ce')});db[_0xdc32('0xae')][_0xdc32('0x11c')](db[_0xdc32('0xb0')],{'as':_0xdc32('0x1c3'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xb0')][_0xdc32('0x11c')](db['ZohoField'],{'as':_0xdc32('0x1c5'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xb0')][_0xdc32('0x11c')](db[_0xdc32('0xb2')],{'as':'Descriptions','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c8')});db['ZohoConfiguration'][_0xdc32('0x11c')](db[_0xdc32('0xb2')],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':'FieldId'});db['ZohoConfiguration']['belongsTo'](db[_0xdc32('0xae')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db['ZohoField']['hasMany'](db[_0xdc32('0xb2')],{'as':'Subject','foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xb2')][_0xdc32('0x11c')](db['ZohoField'],{'as':_0xdc32('0x1cb'),'foreignKey':'DescriptionId'});db['ZohoField'][_0xdc32('0x11c')](db[_0xdc32('0xb2')],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db['ZohoField']['belongsTo'](db[_0xdc32('0x95')],{'as':_0xdc32('0x95'),'foreignKey':_0xdc32('0x1ce')});db[_0xdc32('0xb3')][_0xdc32('0x11c')](db[_0xdc32('0xb5')],{'as':'Configurations','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xb5')][_0xdc32('0x11c')](db['ZendeskField'],{'as':_0xdc32('0x1c5'),'foreignKey':'SubjectId'});db['ZendeskConfiguration']['hasMany'](db[_0xdc32('0xb7')],{'as':_0xdc32('0x1c7'),'foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xb5')][_0xdc32('0x11c')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db['ZendeskConfiguration'][_0xdc32('0x12d')](db[_0xdc32('0xb3')],{'as':_0xdc32('0x177'),'foreignKey':'AccountId'});db[_0xdc32('0xb5')][_0xdc32('0x12f')](db['Tag'],{'through':_0xdc32('0x1cf')});db[_0xdc32('0xb7')][_0xdc32('0x11c')](db[_0xdc32('0xb7')],{'as':_0xdc32('0x1ca'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xb7')]['hasMany'](db[_0xdc32('0xb7')],{'as':_0xdc32('0x1cb'),'foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xb7')][_0xdc32('0x11c')](db['ZendeskField'],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xb7')][_0xdc32('0x12d')](db[_0xdc32('0x95')],{'as':'Variable','foreignKey':_0xdc32('0x1ce')});db[_0xdc32('0x1d0')]['hasMany'](db[_0xdc32('0xba')],{'as':_0xdc32('0x1c3'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c4')});db['FreshdeskConfiguration']['hasMany'](db['FreshdeskField'],{'as':'Subjects','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xba')]['hasMany'](db[_0xdc32('0xbc')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xba')][_0xdc32('0x11c')](db[_0xdc32('0xbc')],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xba')]['belongsTo'](db[_0xdc32('0x1d0')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xba')][_0xdc32('0x12f')](db[_0xdc32('0x8e')],{'through':'int_freshdesk_configuration_has_tags'});db[_0xdc32('0xbc')][_0xdc32('0x11c')](db['FreshdeskField'],{'as':_0xdc32('0x1ca'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xbc')]['hasMany'](db[_0xdc32('0xbc')],{'as':'Description','foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xbc')][_0xdc32('0x11c')](db[_0xdc32('0xbc')],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db['FreshdeskField'][_0xdc32('0x12d')](db[_0xdc32('0x95')],{'as':'Variable','foreignKey':_0xdc32('0x1ce')});db[_0xdc32('0xbe')][_0xdc32('0x11c')](db[_0xdc32('0xc0')],{'as':'Configurations','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1c4')});db['VtigerConfiguration']['hasMany'](db[_0xdc32('0x1d1')],{'as':'Subjects','foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xc0')][_0xdc32('0x11c')](db['VtigerField'],{'as':_0xdc32('0x1c7'),'foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xc0')][_0xdc32('0x11c')](db[_0xdc32('0x1d1')],{'as':_0xdc32('0x1bf'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xc0')]['belongsTo'](db[_0xdc32('0xbe')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db['VtigerField'][_0xdc32('0x11c')](db['VtigerField'],{'as':_0xdc32('0x1ca'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0x1d1')][_0xdc32('0x11c')](db[_0xdc32('0x1d1')],{'as':'Description','foreignKey':'DescriptionId'});db['VtigerField'][_0xdc32('0x11c')](db[_0xdc32('0x1d1')],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0x1d1')][_0xdc32('0x12d')](db[_0xdc32('0x95')],{'as':_0xdc32('0x95'),'foreignKey':_0xdc32('0x1ce')});db['ServicenowAccount'][_0xdc32('0x11c')](db[_0xdc32('0x1d2')],{'as':'Configurations','onDelete':'cascade','foreignKey':'AccountId'});db['ServicenowConfiguration'][_0xdc32('0x11c')](db[_0xdc32('0xc5')],{'as':_0xdc32('0x1c5'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0x1d2')][_0xdc32('0x11c')](db[_0xdc32('0xc5')],{'as':_0xdc32('0x1c7'),'foreignKey':'DescriptionId'});db[_0xdc32('0x1d2')][_0xdc32('0x11c')](db[_0xdc32('0xc5')],{'as':_0xdc32('0x1bf'),'foreignKey':'FieldId'});db[_0xdc32('0x1d2')][_0xdc32('0x12d')](db[_0xdc32('0xc2')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xc5')][_0xdc32('0x11c')](db[_0xdc32('0xc5')],{'as':'Subject','foreignKey':_0xdc32('0x1c6')});db['ServicenowField'][_0xdc32('0x11c')](db[_0xdc32('0xc5')],{'as':'Description','foreignKey':_0xdc32('0x1c8')});db['ServicenowField'][_0xdc32('0x11c')](db[_0xdc32('0xc5')],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db['ServicenowField']['belongsTo'](db[_0xdc32('0x95')],{'as':_0xdc32('0x95'),'foreignKey':_0xdc32('0x1ce')});db[_0xdc32('0xc7')][_0xdc32('0x11c')](db[_0xdc32('0xc9')],{'as':'Configurations','onDelete':_0xdc32('0x118'),'foreignKey':'AccountId'});db[_0xdc32('0xc7')][_0xdc32('0x12d')](db[_0xdc32('0x10c')],{'as':_0xdc32('0x10c'),'foreignKey':_0xdc32('0x166')});db[_0xdc32('0xc9')][_0xdc32('0x11c')](db[_0xdc32('0xca')],{'as':_0xdc32('0x1c5'),'onDelete':'cascade','foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xc9')][_0xdc32('0x11c')](db[_0xdc32('0xca')],{'as':_0xdc32('0x1c7'),'onDelete':_0xdc32('0x118'),'foreignKey':'DescriptionId'});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':_0xdc32('0x1bf'),'onDelete':_0xdc32('0x118'),'foreignKey':'FieldId'});db[_0xdc32('0xc9')]['belongsTo'](db['Dynamics365Account'],{'as':_0xdc32('0x177'),'foreignKey':'AccountId'});db[_0xdc32('0xca')][_0xdc32('0x11c')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xca')][_0xdc32('0x11c')](db['Dynamics365Field'],{'as':_0xdc32('0x1cb'),'foreignKey':'DescriptionId'});db[_0xdc32('0xca')][_0xdc32('0x11c')](db[_0xdc32('0xca')],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xca')][_0xdc32('0x12d')](db['Variable'],{'as':'Variable','foreignKey':'VariableId'});db[_0xdc32('0xcc')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0xdc32('0x1c3'),'onDelete':_0xdc32('0x118'),'foreignKey':'AccountId'});db[_0xdc32('0xcd')]['hasMany'](db[_0xdc32('0xcf')],{'as':_0xdc32('0x1c5'),'foreignKey':_0xdc32('0x1c6')});db[_0xdc32('0xcd')][_0xdc32('0x11c')](db[_0xdc32('0xcf')],{'as':_0xdc32('0x1c7'),'foreignKey':'DescriptionId'});db['FreshsalesConfiguration']['hasMany'](db['FreshsalesField'],{'as':_0xdc32('0x1bf'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xcd')][_0xdc32('0x12d')](db[_0xdc32('0xcc')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1c4')});db[_0xdc32('0xcf')][_0xdc32('0x11c')](db[_0xdc32('0xcf')],{'as':'Subject','foreignKey':_0xdc32('0x1c6')});db['FreshsalesField'][_0xdc32('0x11c')](db[_0xdc32('0xcf')],{'as':'Description','foreignKey':_0xdc32('0x1c8')});db[_0xdc32('0xcf')]['hasMany'](db[_0xdc32('0xcf')],{'as':_0xdc32('0x1cc'),'foreignKey':_0xdc32('0x1c9')});db[_0xdc32('0xcf')]['belongsTo'](db['Variable'],{'as':'Variable','foreignKey':_0xdc32('0x1ce')});db['ChatQueueReport'][_0xdc32('0x12d')](db[_0xdc32('0x140')],{});db['ChatQueueReport'][_0xdc32('0x12d')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x1d3')][_0xdc32('0x12d')](db['CmContact'],{'as':_0xdc32('0x173'),'foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x1d3')]['belongsTo'](db[_0xdc32('0x135')],{});db['ChatQueueReport']['belongsTo'](db[_0xdc32('0x68')],{});db[_0xdc32('0x1d3')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{});db[_0xdc32('0x1d3')][_0xdc32('0x12d')](db['ChatQueue'],{});db[_0xdc32('0xd3')]['belongsTo'](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x118'),'foreignKey':'FromId'});db['ChatInternalMessage']['belongsTo'](db[_0xdc32('0x117')],{'onDelete':'cascade','foreignKey':_0xdc32('0x1d4')});db[_0xdc32('0xd8')][_0xdc32('0x11c')](db[_0xdc32('0xd7')],{'foreignKey':_0xdc32('0x1d5'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0xd8')][_0xdc32('0x11c')](db[_0xdc32('0xd5')],{'foreignKey':_0xdc32('0x1d5'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0xda')][_0xdc32('0x12d')](db[_0xdc32('0x55')],{});db[_0xdc32('0xda')][_0xdc32('0x12d')](db['CmList'],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0xda')][_0xdc32('0x12d')](db['CmContact'],{'as':_0xdc32('0x173'),'foreignKey':'ContactId'});db[_0xdc32('0xda')][_0xdc32('0x12d')](db[_0xdc32('0x124')],{});db[_0xdc32('0xda')][_0xdc32('0x12d')](db[_0xdc32('0x59')],{});db['SmsQueueReport'][_0xdc32('0x12d')](db[_0xdc32('0x117')],{});db[_0xdc32('0xda')][_0xdc32('0x12d')](db[_0xdc32('0x13c')],{});db[_0xdc32('0xdf')][_0xdc32('0x11c')](db[_0xdc32('0xd8')],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0xdc32('0x11c')](db[_0xdc32('0xd7')],{'foreignKey':_0xdc32('0x1d6')});db[_0xdc32('0xdf')][_0xdc32('0x11c')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db['Team'][_0xdc32('0x12f')](db['User'],{'as':_0xdc32('0x159'),'through':_0xdc32('0x133')});db[_0xdc32('0x171')][_0xdc32('0x12f')](db[_0xdc32('0x1a')],{'through':'TeamVoiceQueue','as':_0xdc32('0x1d7')});db['Team'][_0xdc32('0x12f')](db[_0xdc32('0x3b')],{'through':_0xdc32('0x1d8'),'as':_0xdc32('0x139')});db[_0xdc32('0x171')][_0xdc32('0x12f')](db[_0xdc32('0x6c')],{'through':_0xdc32('0x19e'),'as':_0xdc32('0x13a')});db[_0xdc32('0x171')][_0xdc32('0x12f')](db['FaxQueue'],{'through':_0xdc32('0x1d9'),'as':'FaxQueues'});db[_0xdc32('0x171')][_0xdc32('0x12f')](db[_0xdc32('0x13c')],{'through':_0xdc32('0x18f'),'as':_0xdc32('0x13d')});db['Team'][_0xdc32('0x12f')](db[_0xdc32('0x60')],{'through':'team_has_openchannel_queues','as':_0xdc32('0x13e')});db[_0xdc32('0x171')]['belongsToMany'](db[_0xdc32('0x1da')],{'through':_0xdc32('0x1db'),'as':'WhatsappQueues'});db['Team'][_0xdc32('0x12f')](db['VoicePrefix'],{'through':_0xdc32('0x110'),'as':_0xdc32('0x138')});db[_0xdc32('0xea')][_0xdc32('0x11c')](db[_0xdc32('0x74')],{'as':_0xdc32('0x12b'),'foreignKey':'CampaignId'});db['Campaign'][_0xdc32('0x11c')](db[_0xdc32('0x150')],{'as':'HopperFinals','foreignKey':_0xdc32('0x1a5')});db['Campaign'][_0xdc32('0x11c')](db[_0xdc32('0x79')],{'as':_0xdc32('0x151'),'foreignKey':'CampaignId'});db[_0xdc32('0xea')]['hasMany'](db[_0xdc32('0x76')],{'as':_0xdc32('0x1dc'),'foreignKey':_0xdc32('0x1a5')});db[_0xdc32('0xea')]['belongsTo'](db[_0xdc32('0x26')],{'as':_0xdc32('0x26'),'foreignKey':_0xdc32('0x153')});db[_0xdc32('0xea')][_0xdc32('0x12d')](db[_0xdc32('0x26')],{'as':_0xdc32('0x1dd'),'foreignKey':_0xdc32('0x154')});db[_0xdc32('0xea')][_0xdc32('0x12d')](db[_0xdc32('0x155')],{'as':_0xdc32('0x155'),'foreignKey':_0xdc32('0x17a')});db[_0xdc32('0xea')][_0xdc32('0x12d')](db[_0xdc32('0xe4')],{'as':_0xdc32('0xe4'),'foreignKey':'SquareProjectId'});db[_0xdc32('0xea')][_0xdc32('0x12f')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x157'),'through':_0xdc32('0x1de')});db[_0xdc32('0xea')][_0xdc32('0x12f')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x15b'),'through':_0xdc32('0x1df')});db[_0xdc32('0xed')][_0xdc32('0x12d')](db[_0xdc32('0x6a')],{'as':_0xdc32('0x6a'),'foreignKey':_0xdc32('0x179')});db[_0xdc32('0xef')][_0xdc32('0x12d')](db['MailMessage'],{});db[_0xdc32('0xef')][_0xdc32('0x12d')](db[_0xdc32('0x3f')],{});db[_0xdc32('0xef')][_0xdc32('0x12d')](db['MailAccount'],{'foreignKey':_0xdc32('0x1e0'),'as':'FromAccount'});db[_0xdc32('0xef')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':'FromUserId','as':_0xdc32('0x1e1')});db[_0xdc32('0xef')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':'ToUserId','as':'ToAgent'});db[_0xdc32('0xef')][_0xdc32('0x12d')](db[_0xdc32('0x3b')],{'foreignKey':_0xdc32('0x1e2'),'as':_0xdc32('0x1e3')});db[_0xdc32('0xef')]['belongsTo'](db[_0xdc32('0x3a')],{'foreignKey':_0xdc32('0x1e4'),'as':_0xdc32('0x1e5')});db[_0xdc32('0xf1')][_0xdc32('0x12d')](db[_0xdc32('0x68')],{});db[_0xdc32('0xf1')]['belongsTo'](db[_0xdc32('0x135')],{});db[_0xdc32('0xf1')]['belongsTo'](db[_0xdc32('0x140')],{'foreignKey':_0xdc32('0x1e6'),'as':_0xdc32('0x1e7')});db[_0xdc32('0xf1')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e8'),'as':'FromAgent'});db[_0xdc32('0xf1')]['belongsTo'](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e9'),'as':'ToAgent'});db[_0xdc32('0xf1')][_0xdc32('0x12d')](db['ChatQueue'],{'foreignKey':'ToChatQueueId','as':'ToQueue'});db[_0xdc32('0xf1')]['belongsTo'](db[_0xdc32('0x140')],{'foreignKey':_0xdc32('0x1ea'),'as':_0xdc32('0x1e5')});db[_0xdc32('0xf3')][_0xdc32('0x12d')](db['FaxMessage'],{});db['FaxTransferReport']['belongsTo'](db[_0xdc32('0x4d')],{});db[_0xdc32('0xf3')]['belongsTo'](db[_0xdc32('0x17f')],{'foreignKey':_0xdc32('0x1eb'),'as':_0xdc32('0x1e7')});db[_0xdc32('0xf3')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e8'),'as':_0xdc32('0x1e1')});db['FaxTransferReport'][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e9'),'as':_0xdc32('0x1ec')});db[_0xdc32('0xf3')][_0xdc32('0x12d')](db[_0xdc32('0x51')],{'foreignKey':_0xdc32('0x1ed'),'as':'ToQueue'});db[_0xdc32('0xf3')][_0xdc32('0x12d')](db[_0xdc32('0x17f')],{'foreignKey':'ToFaxAccountId','as':_0xdc32('0x1e5')});db[_0xdc32('0xf5')][_0xdc32('0x12d')](db[_0xdc32('0x5f')],{});db[_0xdc32('0xf5')][_0xdc32('0x12d')](db[_0xdc32('0x5d')],{});db[_0xdc32('0xf5')][_0xdc32('0x12d')](db[_0xdc32('0x5b')],{'foreignKey':_0xdc32('0x1ee'),'as':_0xdc32('0x1e7')});db[_0xdc32('0xf5')]['belongsTo'](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e8'),'as':'FromAgent'});db[_0xdc32('0xf5')]['belongsTo'](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e9'),'as':_0xdc32('0x1ec')});db[_0xdc32('0xf5')][_0xdc32('0x12d')](db[_0xdc32('0x60')],{'foreignKey':_0xdc32('0x1ef'),'as':'ToQueue'});db[_0xdc32('0xf5')][_0xdc32('0x12d')](db[_0xdc32('0x5b')],{'foreignKey':_0xdc32('0x1f0'),'as':_0xdc32('0x1e5')});db[_0xdc32('0xf7')][_0xdc32('0x12d')](db[_0xdc32('0x59')],{});db[_0xdc32('0xf7')]['belongsTo'](db['SmsInteraction'],{});db[_0xdc32('0xf7')][_0xdc32('0x12d')](db['SmsAccount'],{'foreignKey':_0xdc32('0x1f1'),'as':'FromAccount'});db[_0xdc32('0xf7')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e8'),'as':_0xdc32('0x1e1')});db[_0xdc32('0xf7')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e9'),'as':_0xdc32('0x1ec')});db['SmsTransferReport'][_0xdc32('0x12d')](db[_0xdc32('0x13c')],{'foreignKey':_0xdc32('0x1f2'),'as':_0xdc32('0x1e3')});db[_0xdc32('0xf7')]['belongsTo'](db[_0xdc32('0x55')],{'foreignKey':'ToSmsAccountId','as':_0xdc32('0x1e5')});db['CmList'][_0xdc32('0x11c')](db[_0xdc32('0x80')],{'as':'Dispositions','foreignKey':_0xdc32('0x16e'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0xf8')][_0xdc32('0x11c')](db[_0xdc32('0x1f3')],{'as':'CustomFields','foreignKey':_0xdc32('0x16e')});db[_0xdc32('0xf8')]['hasMany'](db['CmContact'],{'as':'Contacts','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0xf8')]['hasMany'](db['CmHopperFinal'],{'as':_0xdc32('0x120'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0xf8')]['hasMany'](db['CmHopperHistory'],{'as':_0xdc32('0x121'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0xf8')][_0xdc32('0x11c')](db['ReportAgentPreview'],{'as':_0xdc32('0x7a'),'foreignKey':'ListId'});db[_0xdc32('0xf8')][_0xdc32('0x12f')](db[_0xdc32('0x1a')],{'as':_0xdc32('0x1f4'),'through':_0xdc32('0x158')});db[_0xdc32('0xf8')]['belongsToMany'](db[_0xdc32('0x117')],{'as':'Agents','through':_0xdc32('0x1f5')});db[_0xdc32('0xf9')]['hasMany'](db['VoiceExtension'],{'as':_0xdc32('0x11f'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0xf9')][_0xdc32('0x12f')](db['User'],{'as':'Agents','through':'UserVoicePrefix'});db[_0xdc32('0xf9')]['belongsToMany'](db[_0xdc32('0x171')],{'through':_0xdc32('0x110'),'as':'Teams'});db['UserProfile'][_0xdc32('0x11c')](db[_0xdc32('0x117')],{'as':_0xdc32('0x186'),'foreignKey':_0xdc32('0x1f6')});db[_0xdc32('0x12e')]['hasMany'](db['UserProfileSection'],{'as':_0xdc32('0x1f7'),'foreignKey':'userProfileId','onDelete':'cascade'});db['UserProfileSection'][_0xdc32('0x11c')](db[_0xdc32('0xfe')],{'as':_0xdc32('0x1f8'),'foreignKey':'sectionId','onDelete':_0xdc32('0x118')});db['WhatsappAccount'][_0xdc32('0x11c')](db['Disposition'],{'as':_0xdc32('0x16b'),'foreignKey':'WhatsappAccountId','onDelete':_0xdc32('0x118')});db[_0xdc32('0x102')][_0xdc32('0x11c')](db['CannedAnswer'],{'as':'Answers','foreignKey':'WhatsappAccountId'});db['WhatsappAccount'][_0xdc32('0x11c')](db['WhatsappMessage'],{'as':_0xdc32('0x15d'),'foreignKey':_0xdc32('0x1f9')});db[_0xdc32('0x102')][_0xdc32('0x11c')](db[_0xdc32('0x128')],{'as':_0xdc32('0x180')});db[_0xdc32('0x102')][_0xdc32('0x11c')](db[_0xdc32('0x104')],{'as':_0xdc32('0x14b'),'foreignKey':_0xdc32('0x1f9'),'onDelete':_0xdc32('0x118')});db[_0xdc32('0x102')][_0xdc32('0x12d')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x102')][_0xdc32('0x12d')](db[_0xdc32('0x84')],{'as':_0xdc32('0x156'),'foreignKey':_0xdc32('0x170')});db[_0xdc32('0x102')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x1fa')});db[_0xdc32('0x104')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x104')][_0xdc32('0x12d')](db[_0xdc32('0x1da')],{'onDelete':_0xdc32('0x168')});db['WhatsappApplication']['belongsTo'](db[_0xdc32('0x102')],{'onDelete':_0xdc32('0x168')});db[_0xdc32('0x104')]['belongsTo'](db[_0xdc32('0x155')],{'onDelete':_0xdc32('0x168'),'foreignKey':_0xdc32('0x17a')});db[_0xdc32('0x104')][_0xdc32('0x12d')](db[_0xdc32('0x8e')],{'onDelete':'restrict','foreignKey':'TagId'});db[_0xdc32('0x128')]['hasMany'](db[_0xdc32('0x106')],{'as':'Messages','onDelete':_0xdc32('0x118'),'foreignKey':_0xdc32('0x1fb')});db[_0xdc32('0x128')][_0xdc32('0x12d')](db[_0xdc32('0x102')],{'as':'Account','foreignKey':_0xdc32('0x1f9')});db[_0xdc32('0x128')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'as':_0xdc32('0x173'),'foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x128')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'as':_0xdc32('0x18a'),'foreignKey':'UserId'});db[_0xdc32('0x128')][_0xdc32('0x12f')](db['Tag'],{'through':_0xdc32('0x1b5'),'as':_0xdc32('0x174')});db['WhatsappInteraction']['belongsToMany'](db[_0xdc32('0x8e')],{'through':_0xdc32('0x1b5'),'as':'ThroughTags'});db[_0xdc32('0x128')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':'Users','through':_0xdc32('0x1fc'),'foreignKey':_0xdc32('0x1fb')});db[_0xdc32('0x106')]['belongsTo'](db[_0xdc32('0x117')],{'as':_0xdc32('0x117')});db[_0xdc32('0x106')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'onDelete':_0xdc32('0x118'),'as':_0xdc32('0x173')});db[_0xdc32('0x106')][_0xdc32('0x12d')](db[_0xdc32('0x128')],{'onDelete':_0xdc32('0x118'),'as':'Interaction','foreignKey':_0xdc32('0x1fb')});db[_0xdc32('0x106')][_0xdc32('0x12d')](db[_0xdc32('0x102')],{'as':_0xdc32('0x177'),'foreignKey':_0xdc32('0x1f9')});db['WhatsappQueueReport'][_0xdc32('0x12d')](db[_0xdc32('0x102')],{});db[_0xdc32('0x108')][_0xdc32('0x12d')](db[_0xdc32('0xf8')],{'as':_0xdc32('0x16d'),'foreignKey':_0xdc32('0x16e')});db[_0xdc32('0x108')][_0xdc32('0x12d')](db[_0xdc32('0x131')],{'as':'Contact','foreignKey':_0xdc32('0x17b')});db[_0xdc32('0x108')][_0xdc32('0x12d')](db[_0xdc32('0x128')],{});db[_0xdc32('0x108')][_0xdc32('0x12d')](db['WhatsappQueue'],{});db[_0xdc32('0x108')]['belongsTo'](db[_0xdc32('0x106')],{});db[_0xdc32('0x108')][_0xdc32('0x12d')](db['User'],{});db['WhatsappTransferReport'][_0xdc32('0x12d')](db[_0xdc32('0x106')],{});db[_0xdc32('0x10a')][_0xdc32('0x12d')](db['WhatsappInteraction'],{});db[_0xdc32('0x10a')][_0xdc32('0x12d')](db[_0xdc32('0x102')],{'foreignKey':'FromWhatsappAccountId','as':_0xdc32('0x1e7')});db[_0xdc32('0x10a')][_0xdc32('0x12d')](db['WhatsappAccount'],{'foreignKey':_0xdc32('0x1fd'),'as':_0xdc32('0x1e5')});db[_0xdc32('0x10a')][_0xdc32('0x12d')](db[_0xdc32('0x1da')],{'foreignKey':'ToQueueId','as':'ToQueue'});db[_0xdc32('0x10a')][_0xdc32('0x12d')](db[_0xdc32('0x117')],{'foreignKey':_0xdc32('0x1e8'),'as':_0xdc32('0x1e1')});db['WhatsappTransferReport'][_0xdc32('0x12d')](db['User'],{'foreignKey':'ToUserId','as':_0xdc32('0x1ec')});db[_0xdc32('0x1da')][_0xdc32('0x12f')](db[_0xdc32('0x117')],{'as':_0xdc32('0x159'),'through':_0xdc32('0x35'),'foreignKey':_0xdc32('0x1fe')});db[_0xdc32('0x1da')]['belongsToMany'](db['Team'],{'through':_0xdc32('0x1db'),'as':_0xdc32('0x15a')});db[_0xdc32('0x11b')]['belongsTo'](db['User'],{'as':_0xdc32('0x1ff'),'foreignKey':_0xdc32('0x119'),'onDelete':'cascade','hooks':!![]});db[_0xdc32('0x10c')][_0xdc32('0x11a')](db[_0xdc32('0xc7')],{'as':_0xdc32('0xc7'),'onDelete':_0xdc32('0x168')});db[_0xdc32('0x10c')][_0xdc32('0x11a')](db[_0xdc32('0x37')],{'as':_0xdc32('0x169'),'onDelete':'restrict'});db[_0xdc32('0x10c')][_0xdc32('0x11a')](db[_0xdc32('0x167')],{'as':_0xdc32('0x16a'),'onDelete':_0xdc32('0x168')});module[_0xdc32('0x200')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index 3f84f6b..87c698b 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc029=['/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','/api/actions','./api/action','./api/automation','/api/dispositions','./api/condition','/api/intervals','/api/pauses','./api/cdr','/api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','/api/templates','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/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/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowField','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/squareOdbc','/api/square/projects','/api/square/recordings','/api/square/messages','/api/teams','./api/license','/api/migrations','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','/api/openchannel/reports/transfer','./api/openchannelTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/applications','/api/whatsapp/interactions','./api/whatsappInteraction','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','/api/auth/local','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/rpc','./api/rpc','./api/version','/api/system','/api/pm2','./api/pm2','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','/snippet','3.10.1','/plugins','/server/files/plugins','/:url(api|auth|components|app|bower_components|assets)/*','route','get','sendFile','resolve','appPath','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceExtension','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceRecording','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','/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/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/substatuses','/api/mail/interactions','./api/mailInteraction','/api/mail/messages','./api/mailMessage','/api/mail/applications','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxQueue'];(function(_0x39a094,_0x41d3e0){var _0x156701=function(_0x411d3d){while(--_0x411d3d){_0x39a094['push'](_0x39a094['shift']());}};_0x156701(++_0x41d3e0);}(_0xc029,0x1df));var _0x9c02=function(_0x1425e8,_0x2c195b){_0x1425e8=_0x1425e8-0x0;var _0x1cd239=_0xc029[_0x1425e8];return _0x1cd239;};'use strict';var path=require(_0x9c02('0x0'));var express=require(_0x9c02('0x1'));var errors=require(_0x9c02('0x2'));var config=require(_0x9c02('0x3'));var setupLoggers=require(_0x9c02('0x4'))[_0x9c02('0x5')];var clientSideLogs=require(_0x9c02('0x6'));exports[_0x9c02('0x7')]=function(_0x39c897){return setupLoggers(_0x39c897)[_0x9c02('0x8')](function(){_0x39c897[_0x9c02('0x9')](_0x9c02('0xa'),require(_0x9c02('0xb')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xc'),require(_0x9c02('0xd')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xe'),require('./api/voiceContext'));_0x39c897[_0x9c02('0x9')]('/api/voice/extensions',require(_0x9c02('0xf')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x10'),require(_0x9c02('0x11')));_0x39c897['use'](_0x9c02('0x12'),require('./api/voiceQueue'));_0x39c897[_0x9c02('0x9')]('/api/voice/recordings',require(_0x9c02('0x13')));_0x39c897[_0x9c02('0x9')]('/api/screen/recordings',require(_0x9c02('0x14')));_0x39c897[_0x9c02('0x9')]('/api/voice/mails',require(_0x9c02('0x15')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x16'),require('./api/voiceMailMessage'));_0x39c897['use'](_0x9c02('0x17'),require(_0x9c02('0x18')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x19'),require('./api/voiceDialReport'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x1a'),require(_0x9c02('0x1b')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x1c'),require('./api/voiceQueueReport'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x1d'),require(_0x9c02('0x1e')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x1f'),require(_0x9c02('0x20')));_0x39c897['use'](_0x9c02('0x21'),require(_0x9c02('0x22')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x23'),require(_0x9c02('0x24')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x25'),require(_0x9c02('0x26')));_0x39c897[_0x9c02('0x9')]('/api/mail/queues',require('./api/mailQueue'));_0x39c897['use'](_0x9c02('0x27'),require('./api/mailSubstatus'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x28'),require(_0x9c02('0x29')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x2a'),require(_0x9c02('0x2b')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x2c'),require('./api/mailApplication'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x2d'),require(_0x9c02('0x2e')));_0x39c897['use']('/api/dashboards',require('./api/dashboard'));_0x39c897['use'](_0x9c02('0x2f'),require(_0x9c02('0x30')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x31'),require(_0x9c02('0x32')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x33'),require(_0x9c02('0x34')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x35'),require('./api/faxInteraction'));_0x39c897[_0x9c02('0x9')]('/api/fax/messages',require('./api/faxMessage'));_0x39c897[_0x9c02('0x9')]('/api/fax/queues',require(_0x9c02('0x36')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x37'),require(_0x9c02('0x38')));_0x39c897[_0x9c02('0x9')]('/api/sms/accounts',require(_0x9c02('0x39')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x3a'),require(_0x9c02('0x3b')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x3c'),require(_0x9c02('0x3d')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x3e'),require(_0x9c02('0x3f')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x40'),require(_0x9c02('0x41')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x42'),require('./api/openchannelAccount'));_0x39c897['use']('/api/openchannel/applications',require(_0x9c02('0x43')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x44'),require(_0x9c02('0x45')));_0x39c897[_0x9c02('0x9')]('/api/openchannel/messages',require(_0x9c02('0x46')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x47'),require(_0x9c02('0x48')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x49'),require(_0x9c02('0x4a')));_0x39c897['use'](_0x9c02('0x4b'),require(_0x9c02('0x4c')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x4d'),require(_0x9c02('0x4e')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x4f'),require(_0x9c02('0x50')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x51'),require(_0x9c02('0x52')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x53'),require(_0x9c02('0x54')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x55'),require('./api/chatQueue'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x56'),require(_0x9c02('0x57')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x58'),require(_0x9c02('0x59')));_0x39c897[_0x9c02('0x9')]('/api/cm/companies',require(_0x9c02('0x5a')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x5b'),require(_0x9c02('0x5c')));_0x39c897[_0x9c02('0x9')]('/api/cm/hopper',require(_0x9c02('0x5d')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x5e'),require(_0x9c02('0x5f')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x60'),require(_0x9c02('0x61')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x62'),require(_0x9c02('0x63')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x64'),require('./api/cmCustomField'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x65'),require(_0x9c02('0x66')));_0x39c897['use']('/api/automations',require(_0x9c02('0x67')));_0x39c897[_0x9c02('0x9')]('/api/canned_answers',require('./api/cannedAnswer'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x68'),require('./api/disposition'));_0x39c897['use']('/api/conditions',require(_0x9c02('0x69')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x6a'),require('./api/interval'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x6b'),require('./api/pause'));_0x39c897[_0x9c02('0x9')]('/api/cdr',require(_0x9c02('0x6c')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x6d'),require('./api/voiceQueuesLog'));_0x39c897[_0x9c02('0x9')]('/api/schedules',require(_0x9c02('0x6e')));_0x39c897['use']('/api/sounds',require(_0x9c02('0x6f')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x70'),require(_0x9c02('0x71')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x72'),require('./api/contactItemType'));_0x39c897['use'](_0x9c02('0x73'),require(_0x9c02('0x74')));_0x39c897['use'](_0x9c02('0x75'),require('./api/cmHopperAdditionalPhone'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x76'),require('./api/template'));_0x39c897[_0x9c02('0x9')]('/api/triggers',require(_0x9c02('0x77')));_0x39c897['use'](_0x9c02('0x78'),require(_0x9c02('0x79')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x7a'),require(_0x9c02('0x7b')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x7c'),require(_0x9c02('0x7d')));_0x39c897[_0x9c02('0x9')]('/api/analytics/custom_reports',require(_0x9c02('0x7e')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x7f'),require(_0x9c02('0x80')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x81'),require(_0x9c02('0x82')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x83'),require(_0x9c02('0x84')));_0x39c897['use'](_0x9c02('0x85'),require(_0x9c02('0x86')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x87'),require(_0x9c02('0x88')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x89'),require(_0x9c02('0x8a')));_0x39c897[_0x9c02('0x9')]('/api/integrations/salesforce/configurations',require(_0x9c02('0x8b')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x8c'),require('./api/intSalesforceField'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x8d'),require(_0x9c02('0x8e')));_0x39c897['use'](_0x9c02('0x8f'),require(_0x9c02('0x90')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x91'),require(_0x9c02('0x92')));_0x39c897['use'](_0x9c02('0x93'),require(_0x9c02('0x94')));_0x39c897[_0x9c02('0x9')]('/api/integrations/desk/configurations',require(_0x9c02('0x95')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x96'),require(_0x9c02('0x97')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x98'),require('./api/intZohoAccount'));_0x39c897[_0x9c02('0x9')](_0x9c02('0x99'),require(_0x9c02('0x9a')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x9b'),require(_0x9c02('0x9c')));_0x39c897[_0x9c02('0x9')](_0x9c02('0x9d'),require(_0x9c02('0x9e')));_0x39c897['use'](_0x9c02('0x9f'),require('./api/intZendeskConfiguration'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xa0'),require(_0x9c02('0xa1')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xa2'),require(_0x9c02('0xa3')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xa4'),require('./api/intFreshdeskConfiguration'));_0x39c897['use']('/api/integrations/freshdesk/fields',require('./api/intFreshdeskField'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xa5'),require(_0x9c02('0xa6')));_0x39c897['use'](_0x9c02('0xa7'),require('./api/intVtigerConfiguration'));_0x39c897['use'](_0x9c02('0xa8'),require(_0x9c02('0xa9')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xaa'),require('./api/intServicenowAccount'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xab'),require('./api/intServicenowConfiguration'));_0x39c897[_0x9c02('0x9')]('/api/integrations/servicenow/fields',require(_0x9c02('0xac')));_0x39c897['use']('/api/integrations/dynamics365/accounts',require(_0x9c02('0xad')));_0x39c897[_0x9c02('0x9')]('/api/integrations/dynamics365/configurations',require(_0x9c02('0xae')));_0x39c897['use'](_0x9c02('0xaf'),require('./api/intDynamics365Field'));_0x39c897[_0x9c02('0x9')]('/api/integrations/freshsales/accounts',require(_0x9c02('0xb0')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xb1'),require(_0x9c02('0xb2')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xb3'),require(_0x9c02('0xb4')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xb5'),require(_0x9c02('0xb6')));_0x39c897[_0x9c02('0x9')]('/api/chat/reports/queue',require(_0x9c02('0xb7')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xb8'),require(_0x9c02('0xb9')));_0x39c897['use'](_0x9c02('0xba'),require(_0x9c02('0xbb')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xbc'),require('./api/jscriptyQuestionReport'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xbd'),require(_0x9c02('0xbe')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xbf'),require('./api/smsQueueReport'));_0x39c897['use'](_0x9c02('0xc0'),require(_0x9c02('0xc1')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xc2'),require(_0x9c02('0xc3')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xc4'),require(_0x9c02('0xc5')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xc6'),require('./api/setting'));_0x39c897[_0x9c02('0x9')]('/api/square/odbc',require(_0x9c02('0xc7')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xc8'),require('./api/squareProject'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xc9'),require('./api/squareRecording'));_0x39c897['use'](_0x9c02('0xca'),require('./api/squareMessage'));_0x39c897['use'](_0x9c02('0xcb'),require('./api/team'));_0x39c897[_0x9c02('0x9')]('/api/license',require(_0x9c02('0xcc')));_0x39c897[_0x9c02('0x9')]('/api/campaigns',require('./api/campaign'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xcd'),require(_0x9c02('0xce')));_0x39c897['use'](_0x9c02('0xcf'),require(_0x9c02('0xd0')));_0x39c897['use']('/api/plugins',require(_0x9c02('0xd1')));_0x39c897['use'](_0x9c02('0xd2'),require(_0x9c02('0xd3')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xd4'),require('./api/chatTransferReport'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xd5'),require('./api/faxTransferReport'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xd6'),require(_0x9c02('0xd7')));_0x39c897['use']('/api/sms/reports/transfer',require('./api/smsTransferReport'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xd8'),require(_0x9c02('0xd9')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xda'),require(_0x9c02('0xdb')));_0x39c897['use'](_0x9c02('0xdc'),require(_0x9c02('0xdd')));_0x39c897[_0x9c02('0x9')]('/api/userProfile/sections',require(_0x9c02('0xde')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xdf'),require(_0x9c02('0xe0')));_0x39c897[_0x9c02('0x9')]('/api/userNotifications',require('./api/userNotification'));_0x39c897['use']('/api/whatsapp/accounts',require('./api/whatsappAccount'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xe1'),require('./api/whatsappApplication'));_0x39c897['use'](_0x9c02('0xe2'),require(_0x9c02('0xe3')));_0x39c897[_0x9c02('0x9')]('/api/whatsapp/messages',require(_0x9c02('0xe4')));_0x39c897['use']('/api/whatsapp/reports/queue',require(_0x9c02('0xe5')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xe6'),require(_0x9c02('0xe7')));_0x39c897['use'](_0x9c02('0xe8'),require(_0x9c02('0xe9')));_0x39c897[_0x9c02('0x9')]('/api/cloudProviders',require('./api/cloudProvider'));_0x39c897['use'](_0x9c02('0xea'),require(_0x9c02('0xeb')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xec'),require(_0x9c02('0xed')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xee'),require('./api/mailInteractionHasTag'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xef'),require('./api/authLocal'));_0x39c897['use']('/api/auth/google',require(_0x9c02('0xf0')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xf1'),require(_0x9c02('0xf2')));_0x39c897[_0x9c02('0x9')]('/api/jira',require('./api/jira'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xf3'),require(_0x9c02('0xf4')));_0x39c897[_0x9c02('0x9')]('/api/version',require(_0x9c02('0xf5')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xf6'),require('./api/system'));_0x39c897[_0x9c02('0x9')](_0x9c02('0xf7'),require(_0x9c02('0xf8')));_0x39c897['use']('/api/webbar',require(_0x9c02('0xf9')));_0x39c897[_0x9c02('0x9')](_0x9c02('0xfa'),clientSideLogs);_0x39c897[_0x9c02('0x9')](_0x9c02('0xfb'),express[_0x9c02('0xfc')](path[_0x9c02('0xfd')](config[_0x9c02('0xfe')],_0x9c02('0xfb'))));_0x39c897[_0x9c02('0x9')](_0x9c02('0xff'),express[_0x9c02('0xfc')](path[_0x9c02('0xfd')](config['root'],_0x9c02('0xff'))));_0x39c897[_0x9c02('0x9')](_0x9c02('0x100'),express[_0x9c02('0xfc')](path[_0x9c02('0xfd')](config[_0x9c02('0xfe')],_0x9c02('0x100'))));_0x39c897[_0x9c02('0x9')](_0x9c02('0x101'),express[_0x9c02('0xfc')](path['join'](config[_0x9c02('0xfe')],'snippet',_0x9c02('0x102'))));_0x39c897['use'](_0x9c02('0x103'),express[_0x9c02('0xfc')](path[_0x9c02('0xfd')](config['root'],_0x9c02('0x104'))));_0x39c897['route'](_0x9c02('0x105'))['get'](errors[0x194]);_0x39c897[_0x9c02('0x106')]('/*')[_0x9c02('0x107')](function(_0x4af2c7,_0x2af821){_0x2af821[_0x9c02('0x108')](path[_0x9c02('0x109')](_0x39c897['get'](_0x9c02('0x10a'))+'/index.html'));});return _0x39c897;});}; \ No newline at end of file +var _0xecb2=['./api/voiceAgentReport','/api/voice/queues/reports','/api/members/reports','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','./api/mailQueue','./api/mailInteraction','/api/mail/messages','./api/mailMessage','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','/api/conditions','/api/intervals','./api/interval','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','/api/templates','/api/triggers','./api/trigger','./api/variable','./api/integration','/api/integrations/reports','./api/analyticCustomReport','/api/analytics/default_reports','./api/analyticDefaultReport','./api/analyticExtractedReport','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmField','./api/intDeskAccount','./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/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','./api/smsQueueReport','./api/squareReport','./api/squareReportDetail','./api/jscriptyProject','/api/settings','./api/setting','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/license','./api/license','./api/campaign','/api/migrations','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','./api/openchannelTransferReport','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/interactions','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','/api/mail_interaction_has_tags','./api/mailInteractionHasTag','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','./api/jira','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','3.10.1','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','path','./config/environment','./api/client-side-logs','default','then','use','/api/users','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports'];(function(_0x22fb7e,_0x22fc79){var _0x344506=function(_0x10112a){while(--_0x10112a){_0x22fb7e['push'](_0x22fb7e['shift']());}};_0x344506(++_0x22fc79);}(_0xecb2,0xf6));var _0x2ecb=function(_0x49b8ac,_0x2a5bdf){_0x49b8ac=_0x49b8ac-0x0;var _0x202968=_0xecb2[_0x49b8ac];return _0x202968;};'use strict';var path=require(_0x2ecb('0x0'));var express=require('express');var errors=require('./errors');var config=require(_0x2ecb('0x1'));var setupLoggers=require('./utils/client-side-logger')['setupLoggers'];var clientSideLogs=require(_0x2ecb('0x2'));exports[_0x2ecb('0x3')]=function(_0x393e7c){return setupLoggers(_0x393e7c)[_0x2ecb('0x4')](function(){_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x6'),require('./api/user'));_0x393e7c['use']('/api/voice/chanspy',require(_0x2ecb('0x7')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x8'),require(_0x2ecb('0x9')));_0x393e7c[_0x2ecb('0x5')]('/api/voice/extensions',require(_0x2ecb('0xa')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xb'),require('./api/voiceMusicOnHold'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xc'),require(_0x2ecb('0xd')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xe'),require('./api/voiceRecording'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xf'),require(_0x2ecb('0x10')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x11'),require(_0x2ecb('0x12')));_0x393e7c[_0x2ecb('0x5')]('/api/voice/mails/messages',require(_0x2ecb('0x13')));_0x393e7c[_0x2ecb('0x5')]('/api/voice/calls/reports',require(_0x2ecb('0x14')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x15'),require(_0x2ecb('0x16')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x17'),require(_0x2ecb('0x18')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x19'),require('./api/voiceQueueReport'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x1a'),require('./api/memberReport'));_0x393e7c[_0x2ecb('0x5')]('/api/trunks',require(_0x2ecb('0x1b')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x1c'),require(_0x2ecb('0x1d')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x1e'),require(_0x2ecb('0x1f')));_0x393e7c['use'](_0x2ecb('0x20'),require(_0x2ecb('0x21')));_0x393e7c[_0x2ecb('0x5')]('/api/mail/queues',require(_0x2ecb('0x22')));_0x393e7c[_0x2ecb('0x5')]('/api/mail/substatuses',require('./api/mailSubstatus'));_0x393e7c[_0x2ecb('0x5')]('/api/mail/interactions',require(_0x2ecb('0x23')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x24'),require(_0x2ecb('0x25')));_0x393e7c[_0x2ecb('0x5')]('/api/mail/applications',require('./api/mailApplication'));_0x393e7c[_0x2ecb('0x5')]('/api/mail/reports/queue',require(_0x2ecb('0x26')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x27'),require(_0x2ecb('0x28')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x29'),require(_0x2ecb('0x2a')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x2b'),require(_0x2ecb('0x2c')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x2d'),require(_0x2ecb('0x2e')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x2f'),require(_0x2ecb('0x30')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x31'),require(_0x2ecb('0x32')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x33'),require(_0x2ecb('0x34')));_0x393e7c['use']('/api/fax/reports/queue',require(_0x2ecb('0x35')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x36'),require(_0x2ecb('0x37')));_0x393e7c['use'](_0x2ecb('0x38'),require(_0x2ecb('0x39')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x3a'),require(_0x2ecb('0x3b')));_0x393e7c[_0x2ecb('0x5')]('/api/sms/messages',require(_0x2ecb('0x3c')));_0x393e7c['use'](_0x2ecb('0x3d'),require(_0x2ecb('0x3e')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x3f'),require(_0x2ecb('0x40')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x41'),require(_0x2ecb('0x42')));_0x393e7c[_0x2ecb('0x5')]('/api/openchannel/interactions',require(_0x2ecb('0x43')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x44'),require('./api/openchannelMessage'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x45'),require(_0x2ecb('0x46')));_0x393e7c['use'](_0x2ecb('0x47'),require(_0x2ecb('0x48')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x49'),require(_0x2ecb('0x4a')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x4b'),require(_0x2ecb('0x4c')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x4d'),require('./api/chatInteraction'));_0x393e7c[_0x2ecb('0x5')]('/api/chat/messages',require(_0x2ecb('0x4e')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x4f'),require(_0x2ecb('0x50')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x51'),require('./api/chatQueue'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x52'),require(_0x2ecb('0x53')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x54'),require(_0x2ecb('0x55')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x56'),require(_0x2ecb('0x57')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x58'),require(_0x2ecb('0x59')));_0x393e7c[_0x2ecb('0x5')]('/api/cm/hopper',require(_0x2ecb('0x5a')));_0x393e7c['use']('/api/cm/hopper_black',require(_0x2ecb('0x5b')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x5c'),require(_0x2ecb('0x5d')));_0x393e7c['use']('/api/cm/hopper_history',require('./api/cmHopperHistory'));_0x393e7c[_0x2ecb('0x5')]('/api/cm/custom_fields',require(_0x2ecb('0x5e')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x5f'),require(_0x2ecb('0x60')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x61'),require(_0x2ecb('0x62')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x63'),require(_0x2ecb('0x64')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x65'),require('./api/disposition'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x66'),require('./api/condition'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x67'),require(_0x2ecb('0x68')));_0x393e7c['use']('/api/pauses',require(_0x2ecb('0x69')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x6a'),require(_0x2ecb('0x6b')));_0x393e7c['use'](_0x2ecb('0x6c'),require(_0x2ecb('0x6d')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x6e'),require(_0x2ecb('0x6f')));_0x393e7c['use'](_0x2ecb('0x70'),require(_0x2ecb('0x71')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x72'),require('./api/tag'));_0x393e7c[_0x2ecb('0x5')]('/api/contact_item_types',require(_0x2ecb('0x73')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x74'),require('./api/cmContactHasItem'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x75'),require('./api/cmHopperAdditionalPhone'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x76'),require('./api/template'));_0x393e7c['use'](_0x2ecb('0x77'),require(_0x2ecb('0x78')));_0x393e7c[_0x2ecb('0x5')]('/api/variables',require(_0x2ecb('0x79')));_0x393e7c['use']('/api/integrations',require(_0x2ecb('0x7a')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x7b'),require('./api/integrationReport'));_0x393e7c[_0x2ecb('0x5')]('/api/analytics/custom_reports',require(_0x2ecb('0x7c')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x7d'),require(_0x2ecb('0x7e')));_0x393e7c[_0x2ecb('0x5')]('/api/analytics/extracted_reports',require(_0x2ecb('0x7f')));_0x393e7c['use']('/api/analytics/metrics',require(_0x2ecb('0x80')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x81'),require(_0x2ecb('0x82')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x83'),require(_0x2ecb('0x84')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x85'),require(_0x2ecb('0x86')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x87'),require('./api/intSalesforceConfiguration'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x88'),require(_0x2ecb('0x89')));_0x393e7c[_0x2ecb('0x5')]('/api/integrations/sugarcrm/accounts',require(_0x2ecb('0x8a')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x8b'),require('./api/intSugarcrmConfiguration'));_0x393e7c['use']('/api/integrations/sugarcrm/fields',require(_0x2ecb('0x8c')));_0x393e7c[_0x2ecb('0x5')]('/api/integrations/desk/accounts',require(_0x2ecb('0x8d')));_0x393e7c[_0x2ecb('0x5')]('/api/integrations/desk/configurations',require(_0x2ecb('0x8e')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x8f'),require(_0x2ecb('0x90')));_0x393e7c['use'](_0x2ecb('0x91'),require(_0x2ecb('0x92')));_0x393e7c['use'](_0x2ecb('0x93'),require(_0x2ecb('0x94')));_0x393e7c['use'](_0x2ecb('0x95'),require(_0x2ecb('0x96')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x97'),require('./api/intZendeskAccount'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x98'),require(_0x2ecb('0x99')));_0x393e7c[_0x2ecb('0x5')]('/api/integrations/zendesk/fields',require(_0x2ecb('0x9a')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x9b'),require(_0x2ecb('0x9c')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x9d'),require('./api/intFreshdeskConfiguration'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x9e'),require(_0x2ecb('0x9f')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xa0'),require(_0x2ecb('0xa1')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xa2'),require(_0x2ecb('0xa3')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xa4'),require(_0x2ecb('0xa5')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xa6'),require(_0x2ecb('0xa7')));_0x393e7c['use'](_0x2ecb('0xa8'),require(_0x2ecb('0xa9')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xaa'),require('./api/intServicenowField'));_0x393e7c[_0x2ecb('0x5')]('/api/integrations/dynamics365/accounts',require(_0x2ecb('0xab')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xac'),require('./api/intDynamics365Configuration'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xad'),require(_0x2ecb('0xae')));_0x393e7c['use'](_0x2ecb('0xaf'),require('./api/intFreshsalesAccount'));_0x393e7c[_0x2ecb('0x5')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0x393e7c['use'](_0x2ecb('0xb0'),require(_0x2ecb('0xb1')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xb2'),require(_0x2ecb('0xb3')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xb4'),require(_0x2ecb('0xb5')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xb6'),require(_0x2ecb('0xb7')));_0x393e7c['use'](_0x2ecb('0xb8'),require('./api/jscriptyAnswerReport'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xb9'),require(_0x2ecb('0xba')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xbb'),require(_0x2ecb('0xbc')));_0x393e7c[_0x2ecb('0x5')]('/api/sms/reports/queue',require(_0x2ecb('0xbd')));_0x393e7c[_0x2ecb('0x5')]('/api/square/reports',require(_0x2ecb('0xbe')));_0x393e7c[_0x2ecb('0x5')]('/api/square/details/reports',require(_0x2ecb('0xbf')));_0x393e7c[_0x2ecb('0x5')]('/api/jscripty/projects',require(_0x2ecb('0xc0')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xc1'),require(_0x2ecb('0xc2')));_0x393e7c[_0x2ecb('0x5')]('/api/square/odbc',require('./api/squareOdbc'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xc3'),require(_0x2ecb('0xc4')));_0x393e7c[_0x2ecb('0x5')]('/api/square/recordings',require(_0x2ecb('0xc5')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xc6'),require(_0x2ecb('0xc7')));_0x393e7c[_0x2ecb('0x5')]('/api/teams',require('./api/team'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xc8'),require(_0x2ecb('0xc9')));_0x393e7c[_0x2ecb('0x5')]('/api/campaigns',require(_0x2ecb('0xca')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xcb'),require(_0x2ecb('0xcc')));_0x393e7c[_0x2ecb('0x5')]('/api/attachments',require(_0x2ecb('0xcd')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xce'),require(_0x2ecb('0xcf')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xd0'),require(_0x2ecb('0xd1')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xd2'),require(_0x2ecb('0xd3')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xd4'),require(_0x2ecb('0xd5')));_0x393e7c['use']('/api/openchannel/reports/transfer',require(_0x2ecb('0xd6')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xd7'),require(_0x2ecb('0xd8')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xd9'),require(_0x2ecb('0xda')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xdb'),require(_0x2ecb('0xdc')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xdd'),require(_0x2ecb('0xde')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xdf'),require(_0x2ecb('0xe0')));_0x393e7c['use'](_0x2ecb('0xe1'),require('./api/userProfileResource'));_0x393e7c['use']('/api/userNotifications',require('./api/userNotification'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xe2'),require(_0x2ecb('0xe3')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xe4'),require(_0x2ecb('0xe5')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xe6'),require('./api/whatsappInteraction'));_0x393e7c[_0x2ecb('0x5')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x393e7c[_0x2ecb('0x5')]('/api/whatsapp/reports/queue',require(_0x2ecb('0xe7')));_0x393e7c['use'](_0x2ecb('0xe8'),require(_0x2ecb('0xe9')));_0x393e7c['use'](_0x2ecb('0xea'),require('./api/whatsappQueue'));_0x393e7c['use']('/api/cloudProviders',require(_0x2ecb('0xeb')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xec'),require(_0x2ecb('0xed')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xee'),require(_0x2ecb('0xef')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xf0'),require(_0x2ecb('0xf1')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xf2'),require(_0x2ecb('0xf3')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xf4'),require(_0x2ecb('0xf5')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xf6'),require(_0x2ecb('0xf7')));_0x393e7c['use']('/api/jira',require(_0x2ecb('0xf8')));_0x393e7c[_0x2ecb('0x5')]('/api/rpc',require(_0x2ecb('0xf9')));_0x393e7c['use']('/api/version',require(_0x2ecb('0xfa')));_0x393e7c['use'](_0x2ecb('0xfb'),require(_0x2ecb('0xfc')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xfd'),require('./api/pm2'));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0xfe'),require(_0x2ecb('0xff')));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x100'),clientSideLogs);_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x101'),express[_0x2ecb('0x102')](path[_0x2ecb('0x103')](config[_0x2ecb('0x104')],_0x2ecb('0x101'))));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x105'),express[_0x2ecb('0x102')](path[_0x2ecb('0x103')](config['root'],_0x2ecb('0x105'))));_0x393e7c[_0x2ecb('0x5')](_0x2ecb('0x106'),express[_0x2ecb('0x102')](path[_0x2ecb('0x103')](config['root'],'/demo')));_0x393e7c[_0x2ecb('0x5')]('/snippet',express[_0x2ecb('0x102')](path['join'](config[_0x2ecb('0x104')],'snippet',_0x2ecb('0x107'))));_0x393e7c[_0x2ecb('0x5')]('/plugins',express[_0x2ecb('0x102')](path['join'](config[_0x2ecb('0x104')],'/server/files/plugins')));_0x393e7c[_0x2ecb('0x108')](_0x2ecb('0x109'))[_0x2ecb('0x10a')](errors[0x194]);_0x393e7c[_0x2ecb('0x108')]('/*')['get'](function(_0x542f56,_0x3486f1){_0x3486f1[_0x2ecb('0x10b')](path[_0x2ecb('0x10c')](_0x393e7c[_0x2ecb('0x10a')](_0x2ecb('0x10d'))+'/index.html'));});return _0x393e7c;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index 101b331..254ae7c 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2619=['../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.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/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.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','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','rpc','port','localhost','error','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','../config/environment','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc'];(function(_0x4ea69d,_0x290f53){var _0x5318e0=function(_0x18e081){while(--_0x18e081){_0x4ea69d['push'](_0x4ea69d['shift']());}};_0x5318e0(++_0x290f53);}(_0x2619,0x119));var _0x9261=function(_0x5e8a9a,_0x4b1d76){_0x5e8a9a=_0x5e8a9a-0x0;var _0x5eb0af=_0x2619[_0x5e8a9a];return _0x5eb0af;};'use strict';var jayson=require(_0x9261('0x0'));var _=require(_0x9261('0x1'));var config=require(_0x9261('0x2'));exports['listen']=function(){return new Promise(function(_0x21a976,_0xddff77){var _0xa5a6b8={};_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x4')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x5')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x6')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x7')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/voiceCallReport/voiceCallReport.rpc'));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x8')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x9')));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0xa')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0xb')));_0xa5a6b8=_['merge'](_0xa5a6b8,require('../api/trunk/trunk.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0xc')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0xd')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/mailServerIn/mailServerIn.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/mailAccount/mailAccount.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0xe')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0xf')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x10')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x11')));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x12')));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x13')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x14')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x15')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x16')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x17')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/faxQueueReport/faxQueueReport.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x18')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x19')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/smsMessage/smsMessage.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x1a')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/openchannelApplication/openchannelApplication.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x1b')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x1c')));_0xa5a6b8=_['merge'](_0xa5a6b8,require('../api/openchannelQueue/openchannelQueue.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x1d')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x1e')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x1f')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/chatQueue/chatQueue.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/cmContact/cmContact.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x20')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x21')));_0xa5a6b8=_['merge'](_0xa5a6b8,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x22')));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x23')));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x24')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x25')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/sound/sound.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x26')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/template/template.rpc'));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x27')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x28')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x29')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x2a')));_0xa5a6b8=_['merge'](_0xa5a6b8,require('../api/intDeskAccount/intDeskAccount.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x2b')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x2c')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x2d')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x2e')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x2f')));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x30')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x31')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x32')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x33')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x34')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x35')));_0xa5a6b8=_['merge'](_0xa5a6b8,require('../api/setting/setting.rpc'));_0xa5a6b8=_['merge'](_0xa5a6b8,require(_0x9261('0x36')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x37')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x38')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x39')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x3a')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x3b')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x3c')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x3d')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x3e')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require(_0x9261('0x3f')));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0xa5a6b8=_[_0x9261('0x3')](_0xa5a6b8,require('../api/whatsappQueue/whatsappQueue.rpc'));var _0x172430=jayson['server'](_0xa5a6b8)['http']();var _0xc6a1e1=config[_0x9261('0x40')][_0x9261('0x41')]||config[_0x9261('0x41')]+0x1;var _0x3caf8a=config[_0x9261('0x40')]['ip']||_0x9261('0x42');_0x172430['on'](_0x9261('0x43'),function(_0x4760b8){return _0xddff77(_0x4760b8);});_0x172430[_0x9261('0x44')](_0xc6a1e1,_0x3caf8a,function(){console[_0x9261('0x45')](_0x9261('0x46'),_0x3caf8a,_0xc6a1e1);require('../config/triggers')[_0x9261('0x47')]();return _0x21a976(_0x9261('0x48')+_0x3caf8a+':'+_0xc6a1e1);});});}; \ No newline at end of file +var _0x792a=['rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','RPC\x20listening\x20on\x20','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.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/faxApplication/faxApplication.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/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/template/template.rpc','../api/trigger/trigger.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/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueue/whatsappQueue.rpc'];(function(_0x42af0a,_0x2ebfdd){var _0xddbeb9=function(_0x47d803){while(--_0x47d803){_0x42af0a['push'](_0x42af0a['shift']());}};_0xddbeb9(++_0x2ebfdd);}(_0x792a,0xe8));var _0xa792=function(_0x2ce9d7,_0x257107){_0x2ce9d7=_0x2ce9d7-0x0;var _0x5c0923=_0x792a[_0x2ce9d7];return _0x5c0923;};'use strict';var jayson=require('jayson/promise');var _=require('lodash');var config=require(_0xa792('0x0'));exports[_0xa792('0x1')]=function(){return new Promise(function(_0x302ce0,_0x5a83e6){var _0xdba045={};_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x3')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x4')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x5')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x6')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/voiceCallReport/voiceCallReport.rpc'));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x7')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x8')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x9')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0xa')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0xb')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0xc')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/mailServerIn/mailServerIn.rpc'));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0xd')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0xe')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0xf')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x10')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x11')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x12')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x13')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x14')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/faxInteraction/faxInteraction.rpc'));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x15')));_0xdba045=_['merge'](_0xdba045,require('../api/faxQueue/faxQueue.rpc'));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x16')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x17')));_0xdba045=_['merge'](_0xdba045,require('../api/smsInteraction/smsInteraction.rpc'));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x18')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x19')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x1a')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x1b')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x1c')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x1d')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x1e')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x1f')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x20')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/cmContact/cmContact.rpc'));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x21')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x22')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x23')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x24')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x25')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x26')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x27')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x28')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x29')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x2a')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x2b')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x2c')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x2d')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x2e')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x2f')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x30')));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x31')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x32')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x33')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x34')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x35')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x36')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x37')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x38')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x39')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x3a')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x3b')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/squareOdbc/squareOdbc.rpc'));_0xdba045=_['merge'](_0xdba045,require(_0xa792('0x3c')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/squareRecording/squareRecording.rpc'));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x3d')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x3e')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x3f')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x40')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x41')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x42')));_0xdba045=_[_0xa792('0x2')](_0xdba045,require('../api/whatsappMessage/whatsappMessage.rpc'));_0xdba045=_['merge'](_0xdba045,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0xdba045=_[_0xa792('0x2')](_0xdba045,require(_0xa792('0x43')));var _0x503e1d=jayson['server'](_0xdba045)['http']();var _0xc843d8=config[_0xa792('0x44')]['port']||config[_0xa792('0x45')]+0x1;var _0xb7c049=config[_0xa792('0x44')]['ip']||_0xa792('0x46');_0x503e1d['on'](_0xa792('0x47'),function(_0x203b01){return _0x5a83e6(_0x203b01);});_0x503e1d[_0xa792('0x1')](_0xc843d8,_0xb7c049,function(){console[_0xa792('0x48')](_0xa792('0x49'),_0xb7c049,_0xc843d8);require('../config/triggers')['default']();return _0x302ce0(_0xa792('0x4a')+_0xb7c049+':'+_0xc843d8);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index f84f3e7..d6f8064 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 _0xe864=['./error','call','setEncoding','setTimeout','headers','emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','replace','result=','indexOf','substr','startsWith','split','length','error','code','close','timeout','E_AGI_SOCKET_TIMEOUT','pipe','write','destroy','inherits','prototype','command','sync','answer','sendRequest','ANSWER','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','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','extension','setPriority','GOTO\x20%s\x20%s\x20%s','getVariable','recordFile','wav','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi','AGI','wait','WAIT','label','exports','util','lodash','events','EventEmitter','./reply'];(function(_0x4b8156,_0x437af2){var _0x4a819c=function(_0xe21347){while(--_0xe21347){_0x4b8156['push'](_0x4b8156['shift']());}};_0x4a819c(++_0x437af2);}(_0xe864,0x14b));var _0x4e86=function(_0x5fb82b,_0x537519){_0x5fb82b=_0x5fb82b-0x0;var _0x5c6805=_0xe864[_0x5fb82b];return _0x5c6805;};'use strict';var util=require(_0x4e86('0x0'));var _=require(_0x4e86('0x1'));var EventEmitter=require(_0x4e86('0x2'))[_0x4e86('0x3')];var AGIReply=require(_0x4e86('0x4'));var AGIError=require(_0x4e86('0x5'));function AGIChannel(_0x4ee8c6){var _0x234187=this,_0x2adf42=new AGIReply(),_0xe87690=![],_0x21b162={};EventEmitter[_0x4e86('0x6')](_0x234187);_0x4ee8c6[_0x4e86('0x7')]('utf8');_0x4ee8c6[_0x4e86('0x8')](0x8*0x3c*0x3c*0x3e8);_0x2adf42[_0x4e86('0x7')]('utf8');_0x2adf42['on'](_0x4e86('0x9'),function(_0x3d1cb5){for(var _0x4117e0 in _0x3d1cb5){_0x234187[_0x4117e0]=_0x3d1cb5[_0x4117e0];}_0x234187[_0x4e86('0xa')](_0x4e86('0xb'));});_0x2adf42['on'](_0x4e86('0xc'),function(_0x5e0b28){if(_0x5e0b28['toLowerCase']()==_0x4e86('0xd')){_0x234187['emit'](_0x4e86('0xd'));return;}if(_0x5e0b28[_0x4e86('0xe')](0x0,0xb)==_0x4e86('0xf')){_0xe87690=!![];}if(_0xe87690){_0x21b162['rx']+=_0x5e0b28+'\x0a';if(_0x5e0b28[_0x4e86('0x10')](_0x4e86('0x11'))!=-0x1){_0xe87690=![];}}else{_0x21b162['rx']=_0x5e0b28;}if(_0xe87690){return;}if(typeof _0x21b162['cb']==_0x4e86('0x12')){var _0x42e677=_0x21b162['rx']['substring'](0x0,0x3),_0x49a67b=null,_0x196f60=null;_0x42e677=parseInt(_0x42e677);if(isNaN(_0x42e677)){_0x21b162['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x42e677!=0xc8){_0x21b162['cb'](null,{'code':_0x42e677,'result':-0x1,'extra':'KO'});return;}_0x49a67b=_0x21b162['rx']['substring'](0x4)[_0x4e86('0x13')](_0x4e86('0x14'),'');if(_0x49a67b[_0x4e86('0x15')]('\x20')!=-0x1){_0x49a67b=_0x49a67b[_0x4e86('0x16')](0x0,_0x49a67b[_0x4e86('0x15')]('\x20'));}if(_[_0x4e86('0x17')](_0x49a67b,'-1')){_0x49a67b=parseInt(_0x49a67b);}_0x196f60=_0x21b162['rx'][_0x4e86('0x18')]('\x20');if(_0x196f60[_0x4e86('0x19')]==0x3){_0x196f60=_0x196f60[0x2][_0x4e86('0xe')](0x1,_0x196f60[0x2][_0x4e86('0x19')]-0x1);}else if(_0x196f60[_0x4e86('0x19')]>0x3){var _0x5185b5=/\((.+)\)/;var _0x5788b7=_0x21b162['rx']['match'](_0x5185b5);if(_0x5788b7){_0x196f60=_0x5788b7[0x1];}else{_0x196f60=null;}}else{_0x196f60=null;}_0x21b162['cb'](null,{'code':_0x42e677,'result':_0x49a67b,'extra':_0x196f60});}});_0x4ee8c6['on'](_0x4e86('0x1a'),function(_0x5abd95){_0x234187[_0x4e86('0xa')]('error',new AGIError('E_AGI_SOCKET_ERROR',_0x5abd95[_0x4e86('0x1b')]));});_0x4ee8c6['on']('close',function(){_0x234187[_0x4e86('0xa')](_0x4e86('0x1c'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x4ee8c6['on']('timeout',function(){_0x234187[_0x4e86('0xa')](_0x4e86('0x1d'),new AGIError(_0x4e86('0x1e')));_0x4ee8c6['destroy']();});_0x4ee8c6[_0x4e86('0x1f')](_0x2adf42);this['command']=function(_0x57c7c2,_0x30331b){var _0x57c7c2=_0x57c7c2||'',_0x30331b=typeof _0x30331b==_0x4e86('0x12')?_0x30331b:new Function();_0x21b162={'tx':_0x57c7c2,'rx':'','cb':_0x30331b};_0x4ee8c6[_0x4e86('0x20')](_0x57c7c2+'\x0a');},this['close']=function(){_0x4ee8c6[_0x4e86('0x21')]();};}util[_0x4e86('0x22')](AGIChannel,EventEmitter);AGIChannel[_0x4e86('0x23')]['sendRequest']=function(_0x388cb7){return this[_0x4e86('0x24')][_0x4e86('0x25')](this,_0x388cb7);};AGIChannel[_0x4e86('0x23')][_0x4e86('0x26')]=function(){return this[_0x4e86('0x27')](_0x4e86('0x28'));};AGIChannel[_0x4e86('0x23')]['getData']=function(_0x1c167d,_0x47f1f1,_0x5e72e4){_0x1c167d=_0x1c167d===undefined?_0x4e86('0x29'):_0x1c167d;_0x47f1f1=_0x47f1f1===undefined?'5':_0x47f1f1;_0x5e72e4=_0x5e72e4===undefined?'1':_0x5e72e4;return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x2b'),_0x1c167d,_0x47f1f1*0x3e8,_0x5e72e4));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x2c')]=function(_0x4a5c7d){_0x4a5c7d=_0x4a5c7d||_0x4e86('0x2d');return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x2e'),_0x4a5c7d));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x2f')]=function(_0x8f2658,_0x559168){if(_[_0x4e86('0x30')](_0x559168)){return this[_0x4e86('0x27')](util['format'](_0x4e86('0x31'),_0x8f2658,_0x559168[_0x4e86('0x32')](',')));}return this[_0x4e86('0x27')](util['format'](_0x4e86('0x31'),_0x8f2658,_0x559168));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x33')]=function(_0x497bb2){return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x34'),_0x497bb2));};AGIChannel['prototype'][_0x4e86('0x35')]=function(_0x19b2ee){return this[_0x4e86('0x27')](util['format'](_0x4e86('0x36'),_0x19b2ee));};AGIChannel[_0x4e86('0x23')]['setPriority']=function(_0x26e41a){return this[_0x4e86('0x27')](util['format'](_0x4e86('0x37'),_0x26e41a));};AGIChannel[_0x4e86('0x23')][_0x4e86('0xd')]=function(){return this[_0x4e86('0x27')](_0x4e86('0x38'));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x39')]=function(_0x29b54a,_0x141580){var _0x2167d7=_[_0x4e86('0x3a')](_0x141580)||_[_0x4e86('0x3b')](_0x141580)?_0x141580['toString']():_0x141580;return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x3c'),_0x29b54a,_0x2167d7?_0x2167d7[_0x4e86('0x3d')]()[_0x4e86('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x3e')]=function(_0x11a7e3,_0x433b33){return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x3f'),_0x11a7e3,_0x433b33));};AGIChannel['prototype'][_0x4e86('0x40')]=function(_0x20ad14,_0x5c3c88){return this[_0x4e86('0x27')](util['format'](_0x4e86('0x41'),_0x20ad14,_0x5c3c88));};AGIChannel['prototype'][_0x4e86('0x42')]=function(_0x17fca6,_0x1a8847){return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x43'),_0x17fca6,_0x1a8847));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x44')]=function(_0x34d5d8,_0x17083a,_0x3760ff){_0x17083a=_0x17083a||this[_0x4e86('0x45')];_0x3760ff=_0x3760ff||0x1;this['setContext'](_0x34d5d8);this[_0x4e86('0x35')](_0x17083a);this[_0x4e86('0x46')](_0x3760ff);return this['noop'](util[_0x4e86('0x2a')](_0x4e86('0x47'),_0x34d5d8,_0x17083a,_0x3760ff));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x48')]=function(_0x8ddf7b){return this['sendRequest'](util[_0x4e86('0x2a')]('GET\x20VARIABLE\x20\x22%s\x22',_0x8ddf7b));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x49')]=function(_0x33492e,_0x4b39bb,_0x48907e,_0x140349,_0x36338e,_0x1529d1){_0x4b39bb=_0x4b39bb||_0x4e86('0x4a');_0x48907e=_0x48907e||'';_0x140349=_0x140349===undefined?-0x1:_0x140349==='-1'?-0x1:_0x140349*0x3e8;_0x36338e=_0x36338e===undefined?'':'s='+_0x36338e;_0x1529d1=_0x1529d1?'BEEP':'';return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x4b'),_0x33492e,_0x4b39bb,_0x48907e,_0x140349,_0x1529d1,_0x36338e));};AGIChannel[_0x4e86('0x23')][_0x4e86('0x4c')]=function(_0x57cade,_0x3a2e65){_0x3a2e65=_0x3a2e65||'';return this[_0x4e86('0x27')](util[_0x4e86('0x2a')](_0x4e86('0x4d'),_0x57cade,_0x3a2e65));};AGIChannel['prototype'][_0x4e86('0x4e')]=function(_0xde98a8){return this['exec'](_0x4e86('0x4f'),_0xde98a8);};AGIChannel[_0x4e86('0x23')][_0x4e86('0x50')]=function(_0x5a592e){return this[_0x4e86('0x2f')](_0x4e86('0x51'),_0x5a592e);};AGIChannel[_0x4e86('0x23')][_0x4e86('0x1a')]=function(_0x4436bf,_0x512ada){this['noop'](util[_0x4e86('0x2a')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x4436bf['id'],_0x4436bf[_0x4e86('0x52')],_0x512ada));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x4e86('0x53')]=AGIChannel; \ No newline at end of file +var _0x9a6e=['EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','setVariable','isBoolean','isNumber','toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','AGI','wait','WAIT','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','call','utf8','headers','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','function','no\x20code','replace','indexOf','startsWith','split','length','match','E_AGI_SOCKET_ERROR','code','E_AGI_SOCKET_CLOSE','timeout','destroy','pipe','command','write','close','inherits','prototype','sendRequest','sync','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray'];(function(_0x445d36,_0x569125){var _0x2d2b5a=function(_0x337662){while(--_0x337662){_0x445d36['push'](_0x445d36['shift']());}};_0x2d2b5a(++_0x569125);}(_0x9a6e,0xc1));var _0xe9a6=function(_0x5ce7e2,_0x8dd5de){_0x5ce7e2=_0x5ce7e2-0x0;var _0x5224d1=_0x9a6e[_0x5ce7e2];return _0x5224d1;};'use strict';var util=require(_0xe9a6('0x0'));var _=require(_0xe9a6('0x1'));var EventEmitter=require('events')[_0xe9a6('0x2')];var AGIReply=require(_0xe9a6('0x3'));var AGIError=require(_0xe9a6('0x4'));function AGIChannel(_0x219397){var _0xc06690=this,_0x9febd8=new AGIReply(),_0x5292c9=![],_0x3e860c={};EventEmitter[_0xe9a6('0x5')](_0xc06690);_0x219397['setEncoding']('utf8');_0x219397['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x9febd8['setEncoding'](_0xe9a6('0x6'));_0x9febd8['on'](_0xe9a6('0x7'),function(_0xc6145f){for(var _0x1a0b47 in _0xc6145f){_0xc06690[_0x1a0b47]=_0xc6145f[_0x1a0b47];}_0xc06690[_0xe9a6('0x8')](_0xe9a6('0x9'));});_0x9febd8['on'](_0xe9a6('0xa'),function(_0x357108){if(_0x357108[_0xe9a6('0xb')]()==_0xe9a6('0xc')){_0xc06690['emit']('hangup');return;}if(_0x357108[_0xe9a6('0xd')](0x0,0xb)==_0xe9a6('0xe')){_0x5292c9=!![];}if(_0x5292c9){_0x3e860c['rx']+=_0x357108+'\x0a';if(_0x357108[_0xe9a6('0xf')](_0xe9a6('0x10'))!=-0x1){_0x5292c9=![];}}else{_0x3e860c['rx']=_0x357108;}if(_0x5292c9){return;}if(typeof _0x3e860c['cb']==_0xe9a6('0x11')){var _0x19e272=_0x3e860c['rx']['substring'](0x0,0x3),_0x2ac6ad=null,_0x57fb36=null;_0x19e272=parseInt(_0x19e272);if(isNaN(_0x19e272)){_0x3e860c['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xe9a6('0x12')});return;}if(_0x19e272!=0xc8){_0x3e860c['cb'](null,{'code':_0x19e272,'result':-0x1,'extra':'KO'});return;}_0x2ac6ad=_0x3e860c['rx'][_0xe9a6('0xd')](0x4)[_0xe9a6('0x13')]('result=','');if(_0x2ac6ad[_0xe9a6('0x14')]('\x20')!=-0x1){_0x2ac6ad=_0x2ac6ad['substr'](0x0,_0x2ac6ad[_0xe9a6('0x14')]('\x20'));}if(_[_0xe9a6('0x15')](_0x2ac6ad,'-1')){_0x2ac6ad=parseInt(_0x2ac6ad);}_0x57fb36=_0x3e860c['rx'][_0xe9a6('0x16')]('\x20');if(_0x57fb36['length']==0x3){_0x57fb36=_0x57fb36[0x2]['substring'](0x1,_0x57fb36[0x2]['length']-0x1);}else if(_0x57fb36[_0xe9a6('0x17')]>0x3){var _0x368276=/\((.+)\)/;var _0x1a11a3=_0x3e860c['rx'][_0xe9a6('0x18')](_0x368276);if(_0x1a11a3){_0x57fb36=_0x1a11a3[0x1];}else{_0x57fb36=null;}}else{_0x57fb36=null;}_0x3e860c['cb'](null,{'code':_0x19e272,'result':_0x2ac6ad,'extra':_0x57fb36});}});_0x219397['on']('error',function(_0x324f8f){_0xc06690[_0xe9a6('0x8')]('error',new AGIError(_0xe9a6('0x19'),_0x324f8f[_0xe9a6('0x1a')]));});_0x219397['on']('close',function(){_0xc06690[_0xe9a6('0x8')]('close',new AGIError(_0xe9a6('0x1b')));});_0x219397['on'](_0xe9a6('0x1c'),function(){_0xc06690[_0xe9a6('0x8')](_0xe9a6('0x1c'),new AGIError('E_AGI_SOCKET_TIMEOUT'));_0x219397[_0xe9a6('0x1d')]();});_0x219397[_0xe9a6('0x1e')](_0x9febd8);this[_0xe9a6('0x1f')]=function(_0x54c068,_0x3f0ebf){var _0x54c068=_0x54c068||'',_0x3f0ebf=typeof _0x3f0ebf==_0xe9a6('0x11')?_0x3f0ebf:new Function();_0x3e860c={'tx':_0x54c068,'rx':'','cb':_0x3f0ebf};_0x219397[_0xe9a6('0x20')](_0x54c068+'\x0a');},this[_0xe9a6('0x21')]=function(){_0x219397[_0xe9a6('0x1d')]();};}util[_0xe9a6('0x22')](AGIChannel,EventEmitter);AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x24')]=function(_0x36713f){return this['command'][_0xe9a6('0x25')](this,_0x36713f);};AGIChannel['prototype'][_0xe9a6('0x26')]=function(){return this[_0xe9a6('0x24')](_0xe9a6('0x27'));};AGIChannel[_0xe9a6('0x23')]['getData']=function(_0x54abab,_0x1e1030,_0x2b4515){_0x54abab=_0x54abab===undefined?_0xe9a6('0x28'):_0x54abab;_0x1e1030=_0x1e1030===undefined?'5':_0x1e1030;_0x2b4515=_0x2b4515===undefined?'1':_0x2b4515;return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x2a'),_0x54abab,_0x1e1030*0x3e8,_0x2b4515));};AGIChannel['prototype'][_0xe9a6('0x2b')]=function(_0x3da878){_0x3da878=_0x3da878||'NO\x20MESSAGE';return this['sendRequest'](util[_0xe9a6('0x29')](_0xe9a6('0x2c'),_0x3da878));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x2d')]=function(_0x73e555,_0x348e7b){if(_[_0xe9a6('0x2e')](_0x348e7b)){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x2f'),_0x73e555,_0x348e7b[_0xe9a6('0x30')](',')));}return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x2f'),_0x73e555,_0x348e7b));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x31')]=function(_0x283a0b){return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x32'),_0x283a0b));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x33')]=function(_0x1c2236){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x34'),_0x1c2236));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x35')]=function(_0x51ce17){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x36'),_0x51ce17));};AGIChannel['prototype'][_0xe9a6('0xc')]=function(){return this[_0xe9a6('0x24')]('HANGUP');};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x37')]=function(_0x5f58e4,_0x338a7a){var _0xb1389d=_[_0xe9a6('0x38')](_0x338a7a)||_[_0xe9a6('0x39')](_0x338a7a)?_0x338a7a[_0xe9a6('0x3a')]():_0x338a7a;return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x3b'),_0x5f58e4,_0xb1389d?_0xb1389d[_0xe9a6('0x3a')]()[_0xe9a6('0x13')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x3c')]=function(_0x1b3aad,_0x42455f){return this[_0xe9a6('0x24')](util['format']('SAY\x20NUMBER\x20%s\x20%s',_0x1b3aad,_0x42455f));};AGIChannel['prototype'][_0xe9a6('0x3d')]=function(_0x22659e,_0xc7013c){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x3e'),_0x22659e,_0xc7013c));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x3f')]=function(_0x4aee7d,_0xf503a9){return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x40'),_0x4aee7d,_0xf503a9));};AGIChannel['prototype'][_0xe9a6('0x41')]=function(_0x36fe7e,_0x71adeb,_0x484cec){_0x71adeb=_0x71adeb||this['extension'];_0x484cec=_0x484cec||0x1;this[_0xe9a6('0x31')](_0x36fe7e);this['setExtension'](_0x71adeb);this[_0xe9a6('0x35')](_0x484cec);return this[_0xe9a6('0x2b')](util[_0xe9a6('0x29')]('GOTO\x20%s\x20%s\x20%s',_0x36fe7e,_0x71adeb,_0x484cec));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x42')]=function(_0x2ce4a3){return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x43'),_0x2ce4a3));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x44')]=function(_0x49a63c,_0x1a00cb,_0x3d91de,_0x30a55b,_0x3f9d73,_0x32b0bf){_0x1a00cb=_0x1a00cb||_0xe9a6('0x45');_0x3d91de=_0x3d91de||'';_0x30a55b=_0x30a55b===undefined?-0x1:_0x30a55b==='-1'?-0x1:_0x30a55b*0x3e8;_0x3f9d73=_0x3f9d73===undefined?'':'s='+_0x3f9d73;_0x32b0bf=_0x32b0bf?_0xe9a6('0x46'):'';return this[_0xe9a6('0x24')](util['format'](_0xe9a6('0x47'),_0x49a63c,_0x1a00cb,_0x3d91de,_0x30a55b,_0x32b0bf,_0x3f9d73));};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x48')]=function(_0x44aca4,_0x258cf5){_0x258cf5=_0x258cf5||'';return this[_0xe9a6('0x24')](util[_0xe9a6('0x29')](_0xe9a6('0x49'),_0x44aca4,_0x258cf5));};AGIChannel['prototype']['agi']=function(_0x3e2748){return this['exec'](_0xe9a6('0x4a'),_0x3e2748);};AGIChannel[_0xe9a6('0x23')][_0xe9a6('0x4b')]=function(_0x1b34fd){return this['exec'](_0xe9a6('0x4c'),_0x1b34fd);};AGIChannel['prototype']['error']=function(_0x1677f5,_0x93eca4){this[_0xe9a6('0x2b')](util['format'](_0xe9a6('0x4d'),_0x1677f5['id'],_0x1677f5[_0xe9a6('0x4e')],_0x93eca4));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xe9a6('0x4f')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 292a549..0287530 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 _0x622e=['Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','util'];(function(_0x530e56,_0x4646e1){var _0x4ff308=function(_0x10aaa8){while(--_0x10aaa8){_0x530e56['push'](_0x530e56['shift']());}};_0x4ff308(++_0x4646e1);}(_0x622e,0x179));var _0xe622=function(_0xc88e0e,_0x130618){_0xc88e0e=_0xc88e0e-0x0;var _0xd89aa8=_0x622e[_0xc88e0e];return _0xd89aa8;};'use strict';var util=require(_0xe622('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':_0xe622('0x1'),'E_AGI_SERVER_ERROR':_0xe622('0x2'),'E_AGI_SERVER_CLOSE':_0xe622('0x3'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':_0xe622('0x4'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0xe622('0x5'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0xe622('0x6')};function AGIError(_0x2bf0bd){var _0x2bf0bd=_0x2bf0bd||null,_0x5ccab1=_0x5ccab1||[],_0x19cab0=0x1,_0x42c821='';if(!error[_0x2bf0bd]){_0x2bf0bd=_0xe622('0x7');}_0x5ccab1[_0xe622('0x8')](error[_0x2bf0bd]);while(arguments[_0x19cab0]){_0x5ccab1[_0xe622('0x8')](arguments[_0x19cab0]);_0x19cab0++;}_0x42c821=util[_0xe622('0x9')][_0xe622('0xa')](util,_0x5ccab1);this[_0xe622('0xb')]=_0x42c821;this[_0xe622('0xc')]=_0x2bf0bd;}module[_0xe622('0xd')]=AGIError; \ No newline at end of file +var _0x2276=['push','format','apply','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED'];(function(_0x5f1fe5,_0x48e260){var _0x4169be=function(_0x38e261){while(--_0x38e261){_0x5f1fe5['push'](_0x5f1fe5['shift']());}};_0x4169be(++_0x48e260);}(_0x2276,0x1a3));var _0x6227=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0x2276[_0x2a0350];return _0x425220;};'use strict';var util=require(_0x6227('0x0'));var error={'E_AGI_UNDEFINED':_0x6227('0x1'),'E_AGI_ARGUMENT_PORT':_0x6227('0x2'),'E_AGI_SERVER_ERROR':_0x6227('0x3'),'E_AGI_SERVER_CLOSE':_0x6227('0x4'),'E_AGI_SERVER_MAXCONNECTION':'[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','E_AGI_SERVER_VOICE_DISABLED':_0x6227('0x5'),'E_AGI_SOCKET_ERROR':_0x6227('0x6'),'E_AGI_SOCKET_CLOSE':_0x6227('0x7'),'E_AGI_SOCKET_TIMEOUT':_0x6227('0x8'),'E_AGI_COMMAND_EMPTY':_0x6227('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x6227('0xa'),'E_AGI_IVR_ENTRY':_0x6227('0xb')};function AGIError(_0x3433a4){var _0x3433a4=_0x3433a4||null,_0xc62784=_0xc62784||[],_0x3b8fd1=0x1,_0x5811a6='';if(!error[_0x3433a4]){_0x3433a4=_0x6227('0xc');}_0xc62784[_0x6227('0xd')](error[_0x3433a4]);while(arguments[_0x3b8fd1]){_0xc62784[_0x6227('0xd')](arguments[_0x3b8fd1]);_0x3b8fd1++;}_0x5811a6=util[_0x6227('0xe')][_0x6227('0xf')](util,_0xc62784);this['message']=_0x5811a6;this[_0x6227('0x10')]=_0x3433a4;}module[_0x6227('0x11')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 5feae10..91b07bd 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 _0x3360=['emit','E_AGI_SERVER_ERROR','message','error','exports','EventEmitter','ioredis','./error','../../config/environment','redis','defaults','localhost','subscribe','agi'];(function(_0x5e465a,_0x3e0f32){var _0x52c7db=function(_0x2c9dea){while(--_0x2c9dea){_0x5e465a['push'](_0x5e465a['shift']());}};_0x52c7db(++_0x3e0f32);}(_0x3360,0x1a9));var _0x0336=function(_0x417662,_0x48698c){_0x417662=_0x417662-0x0;var _0x287ce5=_0x3360[_0x417662];return _0x287ce5;};'use strict';var _=require('lodash');var EventEmitter=require('events')[_0x0336('0x0')];var Redis=require(_0x0336('0x1'));var AGIError=require(_0x0336('0x2'));var config=require(_0x0336('0x3'));config[_0x0336('0x4')]=_[_0x0336('0x5')](config['redis'],{'host':_0x0336('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x0336('0x7')](_0x0336('0x8'),function(_0x4360e7){if(_0x4360e7)return eventEmitter[_0x0336('0x9')]('error',new AGIError(_0x0336('0xa'),_0x4360e7));});sub['on'](_0x0336('0xb'),function(_0x588ae3,_0xefa8a7){if(_0x588ae3!==_0x0336('0x8'))return;try{var _0x59222c=JSON['parse'](_0xefa8a7);eventEmitter[_0x0336('0x9')]('projectUpdate',_0x59222c);}catch(_0x302ef7){eventEmitter[_0x0336('0x9')](_0x0336('0xc'),new AGIError(_0x0336('0xa'),_0x302ef7));}});module[_0x0336('0xd')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0xa7f7=['exports','lodash','events','EventEmitter','./error','../../config/environment','redis','defaults','subscribe','agi','emit','E_AGI_SERVER_ERROR','message','parse','error'];(function(_0x567589,_0x540b31){var _0x3a547f=function(_0x502ce3){while(--_0x502ce3){_0x567589['push'](_0x567589['shift']());}};_0x3a547f(++_0x540b31);}(_0xa7f7,0x1e1));var _0x7a7f=function(_0xd816e2,_0x5edac2){_0xd816e2=_0xd816e2-0x0;var _0x1f5924=_0xa7f7[_0xd816e2];return _0x1f5924;};'use strict';var _=require(_0x7a7f('0x0'));var EventEmitter=require(_0x7a7f('0x1'))[_0x7a7f('0x2')];var Redis=require('ioredis');var AGIError=require(_0x7a7f('0x3'));var config=require(_0x7a7f('0x4'));config[_0x7a7f('0x5')]=_[_0x7a7f('0x6')](config[_0x7a7f('0x5')],{'host':'localhost','port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config['redis']);sub[_0x7a7f('0x7')](_0x7a7f('0x8'),function(_0xe8a365){if(_0xe8a365)return eventEmitter[_0x7a7f('0x9')]('error',new AGIError(_0x7a7f('0xa'),_0xe8a365));});sub['on'](_0x7a7f('0xb'),function(_0x2f02e6,_0x266d2c){if(_0x2f02e6!==_0x7a7f('0x8'))return;try{var _0xaedc37=JSON[_0x7a7f('0xc')](_0x266d2c);eventEmitter[_0x7a7f('0x9')]('projectUpdate',_0xaedc37);}catch(_0x1b2c9d){eventEmitter[_0x7a7f('0x9')](_0x7a7f('0xd'),new AGIError('E_AGI_SERVER_ERROR',_0x1b2c9d));}});module[_0x7a7f('0xe')]={'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 848a6bf..dcd6bf9 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 _0x992a=['size','relations','getVertex','traverseBFS','info','no\x20vertex\x20found','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','target','invalid','default\x20on\x20switch\x20not\x20found','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','edges','numberOfEdges','addVertex','prototype','addEdge','push'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x992a,0x153));var _0xa992=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x992a[_0x368e09];return _0x14b7df;};'use strict';var _=require(_0xa992('0x0'));var logger=require(_0xa992('0x1'))(_0xa992('0x2'));var verticesWithRetry=[_0xa992('0x3'),_0xa992('0x4'),_0xa992('0x5')];var Graph=function(){this[_0xa992('0x6')]={};this[_0xa992('0x7')]={};this[_0xa992('0x8')]=0x0;};Graph['prototype'][_0xa992('0x9')]=function(_0x456ded){this[_0xa992('0x6')][_0x456ded['id']]=_0x456ded;this[_0xa992('0x7')][_0x456ded['id']]=[];};Graph[_0xa992('0xa')][_0xa992('0xb')]=function(_0x5e84aa,_0x2284b4,_0x49de5d){this['edges'][_0x5e84aa][_0xa992('0xc')]({'target':_0x2284b4,'condition':_0x49de5d});this[_0xa992('0x8')]+=0x1;};Graph[_0xa992('0xa')][_0xa992('0xd')]=function(){return _[_0xa992('0xd')](this[_0xa992('0x6')]);};Graph['prototype'][_0xa992('0xe')]=function(){return this[_0xa992('0x8')];};Graph[_0xa992('0xa')][_0xa992('0xf')]=function(_0x522894){return this[_0xa992('0x6')][_0x522894];};Graph[_0xa992('0xa')][_0xa992('0x10')]=function(_0x29b408,_0x5de963){if(!this['vertices'][_0x29b408]){return logger[_0xa992('0x11')](_0xa992('0x12'));}var _0x1cbcc0=_0x5de963(this[_0xa992('0x6')][_0x29b408]);if(!_0x1cbcc0){return logger['info']('stop\x20traverse');}if(this[_0xa992('0x7')][_0x29b408][_0xa992('0x13')]===0x0){return logger[_0xa992('0x11')](_0xa992('0x14'));}for(var _0x194d71=0x0,_0x46be42=[],_0x5ad4f2=![];_0x194d71\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','indexOf','agi_','substring','debug','variables','stringify','close','timeout','hangup','find','handleNotFound','production','handleUnpublished','initialize','getLicense','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','./server','listening','connection','lodash','syncho','util','../../config/logger','agi','./rpc','./project','EventEmitter','defaults'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x9ff4,0x1ef));var _0x49ff=function(_0x2fb9b6,_0x5412d0){_0x2fb9b6=_0x2fb9b6-0x0;var _0x3b676a=_0x9ff4[_0x2fb9b6];return _0x3b676a;};'use strict';var _=require(_0x49ff('0x0'));var syncho=require(_0x49ff('0x1'));var util=require(_0x49ff('0x2'));var config=require('../../config/environment');var logger=require(_0x49ff('0x3'))(_0x49ff('0x4'));var utilLicense=require('../../config/license/util');var rpc=require(_0x49ff('0x5'));var Project=require(_0x49ff('0x6'));var AGIEmitter=require('./events')[_0x49ff('0x7')];var projects=[];config['agi']=_[_0x49ff('0x8')](config[_0x49ff('0x4')],{'ip':'127.0.0.1','port':0x11dd});AGIEmitter['on'](_0x49ff('0x9'),projectUpdateHandler);function connectionHandler(_0x19cb72){process[_0x49ff('0xa')](function(){syncho(function(){try{setChannelVariables(_0x19cb72);agiHandler(_0x19cb72);}catch(_0x4990db){logger[_0x49ff('0xb')](_0x4990db[_0x49ff('0xc')]);}});});}function projectUpdateHandler(_0x1da294){try{var _0xe7f8b8=_[_0x49ff('0xd')](projects,['id',_0x1da294['id']]);if(_0xe7f8b8>-0x1){if(_0x1da294[_0x49ff('0xe')]===!![]){projects[_0x49ff('0xf')](_0xe7f8b8,0x1);}else{projects[_0xe7f8b8]=_0x1da294;}}else{projects[_0x49ff('0x10')](_0x1da294);}}catch(_0x505cce){logger[_0x49ff('0xb')](_0x505cce[_0x49ff('0xc')]);}}function listeningHandler(){console[_0x49ff('0x11')](_0x49ff('0x12'),config[_0x49ff('0x4')]['port']);logger['info'](util[_0x49ff('0x13')](_0x49ff('0x14'),config[_0x49ff('0x4')]['ip'],config[_0x49ff('0x4')][_0x49ff('0x15')]));}function errorHandler(_0x17292f){if(_0x17292f&&_0x17292f[_0x49ff('0x16')]&&_0x17292f[_0x49ff('0x17')]){logger[_0x49ff('0xb')](util['format'](_0x49ff('0x18'),_0x17292f[_0x49ff('0x16')],_0x17292f['message']));}else{logger[_0x49ff('0xb')](util[_0x49ff('0x13')](_0x49ff('0x19'),_0x17292f[_0x49ff('0xc')]));}}function closeHandler(){logger[_0x49ff('0x1a')](util[_0x49ff('0x13')](_0x49ff('0x1b'),this[_0x49ff('0x1c')],this[_0x49ff('0x1d')],this[_0x49ff('0x1e')],this[_0x49ff('0x1f')],this[_0x49ff('0x20')]));try{createSquareReport(this);}catch(_0x2217d7){logger[_0x49ff('0xb')](_0x2217d7[_0x49ff('0xc')]);}}function timeoutHandler(){logger[_0x49ff('0x1a')](util['format'](_0x49ff('0x21'),this[_0x49ff('0x1c')],this[_0x49ff('0x1d')],this[_0x49ff('0x1e')],this[_0x49ff('0x1f')],this[_0x49ff('0x20')]));}function hangupHandler(){logger[_0x49ff('0x1a')](util[_0x49ff('0x13')](_0x49ff('0x22'),this[_0x49ff('0x1c')],this[_0x49ff('0x1d')],this['callerid'],this['dnid'],this[_0x49ff('0x20')]));this[_0x49ff('0x23')]=!![];}function createSquareReport(_0x60bd72,_0x348d67){rpc[_0x49ff('0x24')](_0x60bd72)[_0x49ff('0x25')](function(_0x267e7a){if(_0x348d67){_0x348d67(null,_0x267e7a);}})[_0x49ff('0x26')](function(_0x4476fe){if(_0x348d67){_0x348d67(null,_0x4476fe);}});}function setChannelVariables(_0x4d7b27){for(var _0x19a905 in _0x4d7b27){if(_0x4d7b27[_0x49ff('0x27')](_0x19a905)){if(_0x19a905[_0x49ff('0x28')](_0x49ff('0x29'))===0x0){_0x4d7b27[_0x19a905[_0x49ff('0x2a')](0x4)]=_0x4d7b27[_0x19a905];delete _0x4d7b27[_0x19a905];}}}}function agiHandler(_0x16c712){logger[_0x49ff('0x2b')](_0x49ff('0x2c'),JSON[_0x49ff('0x2d')](_0x16c712,null,0x2));logger['info'](util[_0x49ff('0x13')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x16c712[_0x49ff('0x1c')],_0x16c712[_0x49ff('0x1d')],_0x16c712[_0x49ff('0x1e')],_0x16c712[_0x49ff('0x1f')],_0x16c712[_0x49ff('0x20')]));_0x16c712['on'](_0x49ff('0xb'),errorHandler);_0x16c712['on'](_0x49ff('0x2e'),closeHandler);_0x16c712['on'](_0x49ff('0x2f'),timeoutHandler);_0x16c712[_0x49ff('0x23')]=![];_0x16c712['on'](_0x49ff('0x30'),hangupHandler);var _0x1ef38a=_[_0x49ff('0x31')](projects,[_0x49ff('0x16'),_0x16c712[_0x49ff('0x1c')]]);if(!_0x1ef38a)return Project[_0x49ff('0x32')](_0x16c712);if(!_0x1ef38a[_0x49ff('0x33')])return Project[_0x49ff('0x34')](_0x16c712);return Project[_0x49ff('0x35')](_0x1ef38a,_0x16c712);}function main(){var _0x5e2099;return utilLicense[_0x49ff('0x36')]()['then'](function(_0x203f65){if(!_0x203f65)return;if(_0x203f65['voice']){if(_0x203f65[_0x49ff('0x37')]&&_0x203f65[_0x49ff('0x37')]>0x0){logger[_0x49ff('0x1a')](util[_0x49ff('0x13')](_0x49ff('0x38'),_0x203f65[_0x49ff('0x37')]));_0x5e2099=_0x203f65[_0x49ff('0x37')];}else{logger[_0x49ff('0x1a')](_0x49ff('0x39'));}}else{logger['info'](_0x49ff('0x3a'));_0x5e2099=-0x1;}})[_0x49ff('0x25')](function(){return Project['getAll']();})['then'](function(_0x438b8b){projects=_0x438b8b;return;})['catch'](function(_0x4bd3cd){logger[_0x49ff('0xb')](_0x49ff('0x3b'),_0x4bd3cd[_0x49ff('0xc')]);})['finally'](function(){var _0x47f623=require(_0x49ff('0x3c'))(config[_0x49ff('0x4')][_0x49ff('0x15')],config[_0x49ff('0x4')]['ip'],_0x5e2099);_0x47f623['on']('error',errorHandler);_0x47f623['on'](_0x49ff('0x3d'),listeningHandler);_0x47f623['on'](_0x49ff('0x3e'),connectionHandler);_0x47f623['on'](_0x49ff('0x2e'),closeHandler);});}main(); \ No newline at end of file +var _0x74f9=['voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','./project','./events','EventEmitter','defaults','127.0.0.1','stack','findIndex','deleted','splice','push','error','log','agi','port','info','format','[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d','name','message','[%s]\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','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','catch','hasOwnProperty','agi_','substring','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','hangup','find','handleNotFound','production','handleUnpublished'];(function(_0x173de3,_0x50f32f){var _0x552ea2=function(_0x362384){while(--_0x362384){_0x173de3['push'](_0x173de3['shift']());}};_0x552ea2(++_0x50f32f);}(_0x74f9,0x166));var _0x974f=function(_0x3cea2a,_0x5d90b4){_0x3cea2a=_0x3cea2a-0x0;var _0x4f8b91=_0x74f9[_0x3cea2a];return _0x4f8b91;};'use strict';var _=require(_0x974f('0x0'));var syncho=require(_0x974f('0x1'));var util=require(_0x974f('0x2'));var config=require(_0x974f('0x3'));var logger=require(_0x974f('0x4'))('agi');var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var Project=require(_0x974f('0x5'));var AGIEmitter=require(_0x974f('0x6'))[_0x974f('0x7')];var projects=[];config['agi']=_[_0x974f('0x8')](config['agi'],{'ip':_0x974f('0x9'),'port':0x11dd});AGIEmitter['on']('projectUpdate',projectUpdateHandler);function connectionHandler(_0x2d8167){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x2d8167);agiHandler(_0x2d8167);}catch(_0x2c9a4d){logger['error'](_0x2c9a4d[_0x974f('0xa')]);}});});}function projectUpdateHandler(_0x22d02b){try{var _0x66beea=_[_0x974f('0xb')](projects,['id',_0x22d02b['id']]);if(_0x66beea>-0x1){if(_0x22d02b[_0x974f('0xc')]===!![]){projects[_0x974f('0xd')](_0x66beea,0x1);}else{projects[_0x66beea]=_0x22d02b;}}else{projects[_0x974f('0xe')](_0x22d02b);}}catch(_0x230da8){logger[_0x974f('0xf')](_0x230da8[_0x974f('0xa')]);}}function listeningHandler(){console[_0x974f('0x10')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x974f('0x11')][_0x974f('0x12')]);logger[_0x974f('0x13')](util[_0x974f('0x14')](_0x974f('0x15'),config[_0x974f('0x11')]['ip'],config[_0x974f('0x11')][_0x974f('0x12')]));}function errorHandler(_0x545950){if(_0x545950&&_0x545950[_0x974f('0x16')]&&_0x545950[_0x974f('0x17')]){logger[_0x974f('0xf')](util[_0x974f('0x14')](_0x974f('0x18'),_0x545950[_0x974f('0x16')],_0x545950[_0x974f('0x17')]));}else{logger[_0x974f('0xf')](util[_0x974f('0x14')]('[ERROR]\x20%s',_0x545950['stack']));}}function closeHandler(){logger[_0x974f('0x13')](util[_0x974f('0x14')](_0x974f('0x19'),this[_0x974f('0x1a')],this[_0x974f('0x1b')],this[_0x974f('0x1c')],this[_0x974f('0x1d')],this['uniqueid']));try{createSquareReport(this);}catch(_0x2eb4ce){logger[_0x974f('0xf')](_0x2eb4ce[_0x974f('0xa')]);}}function timeoutHandler(){logger['info'](util['format'](_0x974f('0x1e'),this['arg_1'],this[_0x974f('0x1b')],this[_0x974f('0x1c')],this[_0x974f('0x1d')],this['uniqueid']));}function hangupHandler(){logger[_0x974f('0x13')](util[_0x974f('0x14')]('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0x974f('0x1a')],this['calleridname'],this[_0x974f('0x1c')],this['dnid'],this['uniqueid']));this[_0x974f('0x1f')]=!![];}function createSquareReport(_0x25e386,_0x248b2e){rpc[_0x974f('0x20')](_0x25e386)[_0x974f('0x21')](function(_0x4ea894){if(_0x248b2e){_0x248b2e(null,_0x4ea894);}})[_0x974f('0x22')](function(_0x4b1200){if(_0x248b2e){_0x248b2e(null,_0x4b1200);}});}function setChannelVariables(_0x5df123){for(var _0x41006a in _0x5df123){if(_0x5df123[_0x974f('0x23')](_0x41006a)){if(_0x41006a['indexOf'](_0x974f('0x24'))===0x0){_0x5df123[_0x41006a[_0x974f('0x25')](0x4)]=_0x5df123[_0x41006a];delete _0x5df123[_0x41006a];}}}}function agiHandler(_0xc617eb){logger[_0x974f('0x26')](_0x974f('0x27'),JSON[_0x974f('0x28')](_0xc617eb,null,0x2));logger[_0x974f('0x13')](util[_0x974f('0x14')](_0x974f('0x29'),_0xc617eb[_0x974f('0x1a')],_0xc617eb[_0x974f('0x1b')],_0xc617eb[_0x974f('0x1c')],_0xc617eb[_0x974f('0x1d')],_0xc617eb[_0x974f('0x2a')]));_0xc617eb['on'](_0x974f('0xf'),errorHandler);_0xc617eb['on']('close',closeHandler);_0xc617eb['on']('timeout',timeoutHandler);_0xc617eb[_0x974f('0x1f')]=![];_0xc617eb['on'](_0x974f('0x2b'),hangupHandler);var _0x366828=_[_0x974f('0x2c')](projects,[_0x974f('0x16'),_0xc617eb[_0x974f('0x1a')]]);if(!_0x366828)return Project[_0x974f('0x2d')](_0xc617eb);if(!_0x366828[_0x974f('0x2e')])return Project[_0x974f('0x2f')](_0xc617eb);return Project['initialize'](_0x366828,_0xc617eb);}function main(){var _0x36a7ea;return utilLicense['getLicense']()[_0x974f('0x21')](function(_0x1b6e67){if(!_0x1b6e67)return;if(_0x1b6e67[_0x974f('0x30')]){if(_0x1b6e67['callysquare']&&_0x1b6e67[_0x974f('0x31')]>0x0){logger[_0x974f('0x13')](util[_0x974f('0x14')](_0x974f('0x32'),_0x1b6e67[_0x974f('0x31')]));_0x36a7ea=_0x1b6e67[_0x974f('0x31')];}else{logger['info'](_0x974f('0x33'));}}else{logger['info'](_0x974f('0x34'));_0x36a7ea=-0x1;}})[_0x974f('0x21')](function(){return Project[_0x974f('0x35')]();})['then'](function(_0xfb3075){projects=_0xfb3075;return;})[_0x974f('0x22')](function(_0x58ea47){logger[_0x974f('0xf')]('[LICENSE]',_0x58ea47['stack']);})[_0x974f('0x36')](function(){var _0xe41a4=require(_0x974f('0x37'))(config[_0x974f('0x11')][_0x974f('0x12')],config['agi']['ip'],_0x36a7ea);_0xe41a4['on']('error',errorHandler);_0xe41a4['on'](_0x974f('0x38'),listeningHandler);_0xe41a4['on'](_0x974f('0x39'),connectionHandler);_0xe41a4['on']('close',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 d165d67..1da19b5 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 _0x5401=['SendMail','jayson/promise','client','request','then','error','message','catch','sendMailMessage'];(function(_0x27aede,_0x2eb391){var _0x41abb5=function(_0x5e895d){while(--_0x5e895d){_0x27aede['push'](_0x27aede['shift']());}};_0x41abb5(++_0x2eb391);}(_0x5401,0xf4));var _0x1540=function(_0x4f8909,_0x127885){_0x4f8909=_0x4f8909-0x0;var _0x8b66ef=_0x5401[_0x4f8909];return _0x8b66ef;};'use strict';var BPromise=require('bluebird');var jayson=require(_0x1540('0x0'));var client=jayson[_0x1540('0x1')]['http']({'port':0x232b});function request(_0x7564d7,_0x4fa7e8){return new BPromise(function(_0xc30b97,_0x397d6f){return client[_0x1540('0x2')](_0x7564d7,_0x4fa7e8)[_0x1540('0x3')](function(_0x32ed2b){if(_0x32ed2b[_0x1540('0x4')]){return _0x397d6f(_0x32ed2b[_0x1540('0x4')][_0x1540('0x5')]);}else{return _0xc30b97(_0x32ed2b['result']);}})[_0x1540('0x6')](function(_0x2ddb23){return _0x397d6f(_0x2ddb23);});});}exports[_0x1540('0x7')]=function(_0x2d8bec,_0x4f5450){return request(_0x1540('0x8'),{'account':_0x2d8bec,'message':_0x4f5450});}; \ No newline at end of file +var _0x07f6=['error','result','sendMailMessage','SendMail','client','http','request','then'];(function(_0x52a1be,_0x49f576){var _0x598cff=function(_0x12fa8e){while(--_0x12fa8e){_0x52a1be['push'](_0x52a1be['shift']());}};_0x598cff(++_0x49f576);}(_0x07f6,0x16c));var _0x607f=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0x07f6[_0x265003];return _0x33c743;};'use strict';var BPromise=require('bluebird');var jayson=require('jayson/promise');var client=jayson[_0x607f('0x0')][_0x607f('0x1')]({'port':0x232b});function request(_0x2305c2,_0x31aa26){return new BPromise(function(_0x41d0a5,_0x461961){return client[_0x607f('0x2')](_0x2305c2,_0x31aa26)[_0x607f('0x3')](function(_0x304d7d){if(_0x304d7d[_0x607f('0x4')]){return _0x461961(_0x304d7d[_0x607f('0x4')]['message']);}else{return _0x41d0a5(_0x304d7d[_0x607f('0x5')]);}})['catch'](function(_0x19c3d1){return _0x461961(_0x19c3d1);});});}exports[_0x607f('0x6')]=function(_0x142afe,_0x289536){return request(_0x607f('0x7'),{'account':_0x142afe,'message':_0x289536});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 7b19e21..5b5d303 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 _0xdb0f=['addEdge','value','toJson','root','inspect','production','start','debug','stringify','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','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','clear','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','stack','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','vertex','continueAt','close','Project\x20%s\x20not\x20found','exports','lodash','xml2json','util','agi','./rpc','./vertices','getSquareProjects','catch','error','Unable\x20to\x20download\x20CallySquare\x20projects','agicommand','hasOwnProperty','retry','omit','mxCell','isArray','length','source','target'];(function(_0x13c34d,_0x42434b){var _0x5b1a5b=function(_0x107576){while(--_0x107576){_0x13c34d['push'](_0x13c34d['shift']());}};_0x5b1a5b(++_0x42434b);}(_0xdb0f,0x191));var _0xfdb0=function(_0x319e1c,_0x3b4634){_0x319e1c=_0x319e1c-0x0;var _0x49c88d=_0xdb0f[_0x319e1c];return _0x49c88d;};'use strict';var _=require(_0xfdb0('0x0'));var moment=require('moment');var parser=require(_0xfdb0('0x1'));var util=require(_0xfdb0('0x2'));var logger=require('../../config/logger')(_0xfdb0('0x3'));var rpc=require(_0xfdb0('0x4'));var mailRpc=require('./mailRpc');var Graph=require('./graph');var Vertices=require(_0xfdb0('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xfdb0('0x6')]()[_0xfdb0('0x7')](function(_0x4ac025){logger[_0xfdb0('0x8')](_0xfdb0('0x9'),_0x4ac025['stack']);return[];});}function addVertex(_0x5829e2,_0x1c3755,_0x1419c0){_0x1c3755[_0xfdb0('0xa')]=_0x1419c0;if(_0x1c3755[_0xfdb0('0xb')]('retry')){_0x1c3755['maxRetry']=parseInt(_0x1c3755[_0xfdb0('0xc')],0xa);}_0x5829e2['addVertex'](_[_0xfdb0('0xd')](_0x1c3755,_0xfdb0('0xe')));}function initGraph(_0x48a114,_0x750e73){var _0x513dbb=new Graph();for(var _0x321bec in _0x48a114){if(_0x48a114['hasOwnProperty'](_0x321bec)){if(_[_0xfdb0('0xf')](_0x48a114[_0x321bec])){for(var _0x208d66=0x0;_0x208d66<_0x48a114[_0x321bec][_0xfdb0('0x10')];_0x208d66+=0x1){addVertex(_0x513dbb,_0x48a114[_0x321bec][_0x208d66],_0x321bec);}}else{addVertex(_0x513dbb,_0x48a114[_0x321bec],_0x321bec);}}}for(var _0x5a2303=0x0;_0x5a2303<_0x750e73['length'];_0x5a2303+=0x1){if(_0x750e73[_0x5a2303][_0xfdb0('0x11')]&&_0x750e73[_0x5a2303][_0xfdb0('0x12')]){_0x513dbb[_0xfdb0('0x13')](_0x750e73[_0x5a2303][_0xfdb0('0x11')],_0x750e73[_0x5a2303]['target'],_0x750e73[_0x5a2303][_0xfdb0('0x14')]);}}return _0x513dbb;}function getRoot(_0x6cba8d){return parser[_0xfdb0('0x15')](_0x6cba8d,{'object':!![]})['mxGraphModel'][_0xfdb0('0x16')];}function inspect(_0x577705){return util[_0xfdb0('0x17')](_0x577705,{'showHidden':![],'depth':null});}function initialize(_0x3db43d,_0x503e13){var _0x3ec9c6=getRoot(_0x3db43d[_0xfdb0('0x18')]);if(!_0x3ec9c6||!_0x3ec9c6[_0xfdb0('0x19')])return;var _0x3798c8,_0x195457,_0x8215f5;logger[_0xfdb0('0x1a')](_0xfdb0('0x16'),JSON[_0xfdb0('0x1b')](_0x3ec9c6,null,0x2));_0x503e13[_0xfdb0('0x1c')]=moment()[_0xfdb0('0x1d')](_0xfdb0('0x1e'));_0x3798c8=initGraph(_[_0xfdb0('0xd')](_0x3ec9c6,_0xfdb0('0xe')),_0x3ec9c6[_0xfdb0('0xe')]);_0x195457=new Vertices(_0x503e13,rpc,mailRpc);logger[_0xfdb0('0x1f')](util[_0xfdb0('0x1d')](_0xfdb0('0x20'),_0x503e13[_0xfdb0('0x21')],_0x503e13[_0xfdb0('0x22')],_0x503e13[_0xfdb0('0x23')],_0x503e13[_0xfdb0('0x24')],_0x503e13[_0xfdb0('0x25')]));_0x3798c8[_0xfdb0('0x26')](_0x3ec9c6[_0xfdb0('0x19')]['id'],function(_0x195daf){try{_0x195daf=_0x195457[_0xfdb0('0x27')](_0x195daf);logger[_0xfdb0('0x1a')]('vertex',JSON[_0xfdb0('0x1b')](_0x195daf,null,0x2));if(_0x195daf['agicommand']===_0xfdb0('0x28')){logger[_0xfdb0('0x1f')](_0xfdb0('0x29'));_0x503e13[_0xfdb0('0x2a')]=_0x195daf[_0xfdb0('0x2a')]||_0x503e13['context'];_0x503e13[_0xfdb0('0x2b')]=_0x195daf[_0xfdb0('0x2b')];_0x503e13[_0xfdb0('0x2c')]=_0x195daf[_0xfdb0('0x2c')]?_0x195daf[_0xfdb0('0x2c')]-0x1:0x1;return null;}else if(_0x195daf&&_0x195457[_0x195daf[_0xfdb0('0xa')]]){_0x8215f5=_0x195457[_0x195daf['agicommand']](_0x195daf);logger[_0xfdb0('0x1f')](_0xfdb0('0x2d'),JSON[_0xfdb0('0x1b')](_0x8215f5,null,0x2));if(_0x8215f5&&_0x8215f5[_0xfdb0('0x2e')]===AGI_CODE_SUCCESS&&_0x8215f5[_0xfdb0('0x2f')]!==AGI_RESULT_ERROR&&!_0x503e13[_0xfdb0('0x30')]){logger[_0xfdb0('0x1a')](_0xfdb0('0x2d'),inspect(_0x8215f5));return _[_0xfdb0('0x31')](_0x8215f5[_0xfdb0('0x2f')])?null:_0x8215f5[_0xfdb0('0x2f')][_0xfdb0('0x32')]();}else{logger['error'](_0xfdb0('0x2d'),inspect(_0x8215f5));return null;}}else{logger[_0xfdb0('0x8')](_0xfdb0('0x33'));return null;}}catch(_0x2d184d){logger['error'](_0x2d184d[_0xfdb0('0x34')]);return null;}});if(_0x3ec9c6[_0xfdb0('0x35')]){logger['info'](util[_0xfdb0('0x1d')](_0xfdb0('0x36'),_0x503e13[_0xfdb0('0x21')],_0x503e13['calleridname'],_0x503e13['callerid'],_0x503e13[_0xfdb0('0x24')],_0x503e13[_0xfdb0('0x25')]));_0x3798c8[_0xfdb0('0x26')](_0x3ec9c6[_0xfdb0('0x35')]['id'],function(_0x51e368){try{_0x51e368=_0x195457['clear'](_0x51e368);logger[_0xfdb0('0x1a')](_0xfdb0('0x37'),JSON[_0xfdb0('0x1b')](_0x51e368,null,0x2));if(_0x51e368&&_0x195457[_0x51e368[_0xfdb0('0xa')]]){_0x8215f5=_0x195457[_0x51e368['agicommand']](_0x51e368);if(_0x8215f5){logger['debug'](_0xfdb0('0x2d'),inspect(_0x8215f5));return _['isUndefined'](_0x8215f5[_0xfdb0('0x2f')])?null:_0x8215f5['result']['toString']();}else{logger[_0xfdb0('0x8')](_0xfdb0('0x2d'),inspect(_0x8215f5));return null;}}else{logger[_0xfdb0('0x8')](_0xfdb0('0x33'));return null;}}catch(_0x3a3543){logger[_0xfdb0('0x8')](_0x3a3543[_0xfdb0('0x34')]);return null;}});}logger[_0xfdb0('0x1f')](util[_0xfdb0('0x1d')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x503e13[_0xfdb0('0x21')],_0x503e13[_0xfdb0('0x22')],_0x503e13[_0xfdb0('0x23')],_0x503e13[_0xfdb0('0x24')],_0x503e13['uniqueid']));logger[_0xfdb0('0x1f')](util['format']('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x503e13[_0xfdb0('0x2a')],_0x503e13[_0xfdb0('0x2b')],parseInt(_0x503e13[_0xfdb0('0x2c')],0xa)+0x1));_0x503e13[_0xfdb0('0x38')](_0x503e13[_0xfdb0('0x2a')],_0x503e13[_0xfdb0('0x2b')],parseInt(_0x503e13[_0xfdb0('0x2c')],0xa)+0x1);_0x503e13[_0xfdb0('0x39')]();}function handleNotFound(_0x64906f){logger[_0xfdb0('0x8')](util['format'](_0xfdb0('0x3a'),_0x64906f[_0xfdb0('0x21')]));_0x64906f[_0xfdb0('0x38')](_0x64906f[_0xfdb0('0x2a')],_0x64906f['extension'],parseInt(_0x64906f[_0xfdb0('0x2c')],0xa)+0x1);_0x64906f[_0xfdb0('0x39')]();}function handleUnpublished(_0x3c17e2){logger[_0xfdb0('0x8')](util[_0xfdb0('0x1d')]('Project\x20%s\x20not\x20published',_0x3c17e2[_0xfdb0('0x21')]));_0x3c17e2[_0xfdb0('0x38')](_0x3c17e2[_0xfdb0('0x2a')],_0x3c17e2['extension'],parseInt(_0x3c17e2[_0xfdb0('0x2c')],0xa)+0x1);_0x3c17e2[_0xfdb0('0x39')]();}module[_0xfdb0('0x3b')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x849c=['isUndefined','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally','clear','dnid','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','exports','xml2json','util','../../config/logger','agi','./mailRpc','./graph','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','omit','isArray','length','target','source','value','toJson','mxGraphModel','root','production','debug','format','YYYY-MM-DD\x20HH:mm:ss','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','traverseBFS','vertex','stringify','gotoc','info','context','extension','priority','response','evtHangup'];(function(_0x420f57,_0x2e75b0){var _0x5b525c=function(_0x4424f0){while(--_0x4424f0){_0x420f57['push'](_0x420f57['shift']());}};_0x5b525c(++_0x2e75b0);}(_0x849c,0x7a));var _0xc849=function(_0x5aba3d,_0x272a72){_0x5aba3d=_0x5aba3d-0x0;var _0x1a0c3c=_0x849c[_0x5aba3d];return _0x1a0c3c;};'use strict';var _=require('lodash');var moment=require('moment');var parser=require(_0xc849('0x0'));var util=require(_0xc849('0x1'));var logger=require(_0xc849('0x2'))(_0xc849('0x3'));var rpc=require('./rpc');var mailRpc=require(_0xc849('0x4'));var Graph=require(_0xc849('0x5'));var Vertices=require(_0xc849('0x6'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0xc849('0x7')]()['catch'](function(_0xe2488d){logger[_0xc849('0x8')](_0xc849('0x9'),_0xe2488d[_0xc849('0xa')]);return[];});}function addVertex(_0x4eb838,_0x1da64a,_0x154e86){_0x1da64a[_0xc849('0xb')]=_0x154e86;if(_0x1da64a[_0xc849('0xc')]('retry')){_0x1da64a['maxRetry']=parseInt(_0x1da64a[_0xc849('0xd')],0xa);}_0x4eb838['addVertex'](_[_0xc849('0xe')](_0x1da64a,'mxCell'));}function initGraph(_0x1d885e,_0x453679){var _0x5dd6bb=new Graph();for(var _0x1a661a in _0x1d885e){if(_0x1d885e[_0xc849('0xc')](_0x1a661a)){if(_[_0xc849('0xf')](_0x1d885e[_0x1a661a])){for(var _0x49bf65=0x0;_0x49bf65<_0x1d885e[_0x1a661a][_0xc849('0x10')];_0x49bf65+=0x1){addVertex(_0x5dd6bb,_0x1d885e[_0x1a661a][_0x49bf65],_0x1a661a);}}else{addVertex(_0x5dd6bb,_0x1d885e[_0x1a661a],_0x1a661a);}}}for(var _0x81fb71=0x0;_0x81fb71<_0x453679[_0xc849('0x10')];_0x81fb71+=0x1){if(_0x453679[_0x81fb71]['source']&&_0x453679[_0x81fb71][_0xc849('0x11')]){_0x5dd6bb['addEdge'](_0x453679[_0x81fb71][_0xc849('0x12')],_0x453679[_0x81fb71][_0xc849('0x11')],_0x453679[_0x81fb71][_0xc849('0x13')]);}}return _0x5dd6bb;}function getRoot(_0x357e01){return parser[_0xc849('0x14')](_0x357e01,{'object':!![]})[_0xc849('0x15')][_0xc849('0x16')];}function inspect(_0x101529){return util['inspect'](_0x101529,{'showHidden':![],'depth':null});}function initialize(_0x1c2f4a,_0x3adf1){var _0x1ecefa=getRoot(_0x1c2f4a[_0xc849('0x17')]);if(!_0x1ecefa||!_0x1ecefa['start'])return;var _0x5577c4,_0x55209e,_0xff1b66;logger[_0xc849('0x18')](_0xc849('0x16'),JSON['stringify'](_0x1ecefa,null,0x2));_0x3adf1['joinAt']=moment()[_0xc849('0x19')](_0xc849('0x1a'));_0x5577c4=initGraph(_[_0xc849('0xe')](_0x1ecefa,_0xc849('0x1b')),_0x1ecefa['mxCell']);_0x55209e=new Vertices(_0x3adf1,rpc,mailRpc);logger['info'](util[_0xc849('0x19')](_0xc849('0x1c'),_0x3adf1[_0xc849('0x1d')],_0x3adf1[_0xc849('0x1e')],_0x3adf1[_0xc849('0x1f')],_0x3adf1['dnid'],_0x3adf1[_0xc849('0x20')]));_0x5577c4[_0xc849('0x21')](_0x1ecefa['start']['id'],function(_0x58caa9){try{_0x58caa9=_0x55209e['clear'](_0x58caa9);logger[_0xc849('0x18')](_0xc849('0x22'),JSON[_0xc849('0x23')](_0x58caa9,null,0x2));if(_0x58caa9[_0xc849('0xb')]===_0xc849('0x24')){logger[_0xc849('0x25')]('gotoc\x20block\x20stop\x20traverse\x20BFS');_0x3adf1[_0xc849('0x26')]=_0x58caa9[_0xc849('0x26')]||_0x3adf1[_0xc849('0x26')];_0x3adf1[_0xc849('0x27')]=_0x58caa9[_0xc849('0x27')];_0x3adf1['priority']=_0x58caa9[_0xc849('0x28')]?_0x58caa9[_0xc849('0x28')]-0x1:0x1;return null;}else if(_0x58caa9&&_0x55209e[_0x58caa9[_0xc849('0xb')]]){_0xff1b66=_0x55209e[_0x58caa9[_0xc849('0xb')]](_0x58caa9);logger[_0xc849('0x25')](_0xc849('0x29'),JSON[_0xc849('0x23')](_0xff1b66,null,0x2));if(_0xff1b66&&_0xff1b66['code']===AGI_CODE_SUCCESS&&_0xff1b66['result']!==AGI_RESULT_ERROR&&!_0x3adf1[_0xc849('0x2a')]){logger[_0xc849('0x18')]('response',inspect(_0xff1b66));return _[_0xc849('0x2b')](_0xff1b66[_0xc849('0x2c')])?null:_0xff1b66[_0xc849('0x2c')][_0xc849('0x2d')]();}else{logger['error']('response',inspect(_0xff1b66));return null;}}else{logger[_0xc849('0x8')](_0xc849('0x2e'));return null;}}catch(_0x32f9dd){logger['error'](_0x32f9dd[_0xc849('0xa')]);return null;}});if(_0x1ecefa['finally']){logger[_0xc849('0x25')](util[_0xc849('0x19')](_0xc849('0x2f'),_0x3adf1['arg_1'],_0x3adf1[_0xc849('0x1e')],_0x3adf1[_0xc849('0x1f')],_0x3adf1['dnid'],_0x3adf1[_0xc849('0x20')]));_0x5577c4['traverseBFS'](_0x1ecefa[_0xc849('0x30')]['id'],function(_0x264caa){try{_0x264caa=_0x55209e[_0xc849('0x31')](_0x264caa);logger[_0xc849('0x18')]('vertex',JSON[_0xc849('0x23')](_0x264caa,null,0x2));if(_0x264caa&&_0x55209e[_0x264caa[_0xc849('0xb')]]){_0xff1b66=_0x55209e[_0x264caa[_0xc849('0xb')]](_0x264caa);if(_0xff1b66){logger[_0xc849('0x18')](_0xc849('0x29'),inspect(_0xff1b66));return _[_0xc849('0x2b')](_0xff1b66[_0xc849('0x2c')])?null:_0xff1b66[_0xc849('0x2c')][_0xc849('0x2d')]();}else{logger[_0xc849('0x8')](_0xc849('0x29'),inspect(_0xff1b66));return null;}}else{logger[_0xc849('0x8')]('agicommand\x20not\x20found');return null;}}catch(_0x1835a5){logger[_0xc849('0x8')](_0x1835a5['stack']);return null;}});}logger['info'](util[_0xc849('0x19')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x3adf1[_0xc849('0x1d')],_0x3adf1[_0xc849('0x1e')],_0x3adf1[_0xc849('0x1f')],_0x3adf1[_0xc849('0x32')],_0x3adf1[_0xc849('0x20')]));logger[_0xc849('0x25')](util['format'](_0xc849('0x33'),_0x3adf1[_0xc849('0x26')],_0x3adf1['extension'],parseInt(_0x3adf1[_0xc849('0x28')],0xa)+0x1));_0x3adf1[_0xc849('0x34')](_0x3adf1['context'],_0x3adf1['extension'],parseInt(_0x3adf1[_0xc849('0x28')],0xa)+0x1);_0x3adf1[_0xc849('0x35')]();}function handleNotFound(_0x151a2e){logger[_0xc849('0x8')](util['format']('Project\x20%s\x20not\x20found',_0x151a2e[_0xc849('0x1d')]));_0x151a2e[_0xc849('0x34')](_0x151a2e[_0xc849('0x26')],_0x151a2e['extension'],parseInt(_0x151a2e[_0xc849('0x28')],0xa)+0x1);_0x151a2e[_0xc849('0x35')]();}function handleUnpublished(_0x4f4d56){logger['error'](util['format']('Project\x20%s\x20not\x20published',_0x4f4d56[_0xc849('0x1d')]));_0x4f4d56[_0xc849('0x34')](_0x4f4d56['context'],_0x4f4d56[_0xc849('0x27')],parseInt(_0x4f4d56[_0xc849('0x28')],0xa)+0x1);_0x4f4d56[_0xc849('0x35')]();}module[_0xc849('0x36')]={'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 9dae5b2..8fcf7f6 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 _0x5025=['exports','util','stream','call','inherits','prototype','_transform','\x0d\x0a\x0d\x0a','_localBuffer','_inBody','indexOf','substring','length','split','slice','trim','emit'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x5025,0x177));var _0x5502=function(_0x1dac7a,_0x1828ce){_0x1dac7a=_0x1dac7a-0x0;var _0x4cb363=_0x5025[_0x1dac7a];return _0x4cb363;};'use strict';var util=require(_0x5502('0x0'));var Transform=require(_0x5502('0x1'))['Transform'];function AGIReply(_0x3142fc){Transform[_0x5502('0x2')](this,_0x3142fc);this['_localBuffer']='';this['_inBody']=![];}util[_0x5502('0x3')](AGIReply,Transform);AGIReply[_0x5502('0x4')][_0x5502('0x5')]=function(_0x3aeead,_0x1909dd,_0x1b4c66){var _0xf2f00c='\x0a',_0x14663f=['\x0a\x0a',_0x5502('0x6')],_0x5a476b=-0x1,_0x43bdfc=-0x1,_0x4adc7a='',_0x504756=0x0,_0x29bf89='',_0x2a0f7f='';this[_0x5502('0x7')]+=_0x3aeead['toString']();_0x29bf89=this[_0x5502('0x7')];if(!this[_0x5502('0x8')]){_0x504756=0x0;while(_0x14663f[_0x504756]){while((_0x43bdfc=_0x29bf89[_0x5502('0x9')](_0x14663f[_0x504756]))!=-0x1){_0x4adc7a=_0x14663f[_0x504756];_0x2a0f7f=_0x29bf89['substring'](0x0,_0x43bdfc);_0x29bf89=_0x29bf89[_0x5502('0xa')](_0x43bdfc+_0x4adc7a[_0x5502('0xb')]);var _0x5d0261=_0x2a0f7f[_0x5502('0xc')](_0xf2f00c),_0x1dc31a=0x0,_0x5ebf28={},_0x2c4a92='',_0x27ab63='',_0xc13729=-0x1;while(_0x5d0261[_0x1dc31a]){_0xc13729=_0x5d0261[_0x1dc31a][_0x5502('0x9')](':');if(_0xc13729!=-0x1){_0x2c4a92=_0x5d0261[_0x1dc31a][_0x5502('0xd')](0x0,_0xc13729)['trim']();_0x27ab63=_0x5d0261[_0x1dc31a][_0x5502('0xd')](_0xc13729+0x1)[_0x5502('0xe')]();if(_0x2c4a92[_0x5502('0xb')]>0x0){_0x5ebf28[_0x2c4a92]=_0x27ab63;}}else{}_0x1dc31a++;}this['emit']('headers',_0x5ebf28);this['_inBody']=!![];}_0x504756++;}this[_0x5502('0x7')]=_0x29bf89;}else{while((_0x5a476b=_0x29bf89['indexOf'](_0xf2f00c))!=-0x1){_0x2a0f7f=_0x29bf89[_0x5502('0xa')](0x0,_0x5a476b);this[_0x5502('0xf')]('line',_0x2a0f7f);_0x29bf89=_0x29bf89[_0x5502('0xa')](_0x5a476b+_0xf2f00c[_0x5502('0xb')]);}this[_0x5502('0x7')]=_0x29bf89;}_0x1b4c66();};module[_0x5502('0x10')]=AGIReply; \ No newline at end of file +var _0x66ce=['_localBuffer','_inBody','indexOf','substring','split','slice','length','emit','headers','line','exports','util','Transform','call','inherits','prototype','\x0d\x0a\x0d\x0a'];(function(_0x5175ff,_0x30440f){var _0x1f9360=function(_0x5f5818){while(--_0x5f5818){_0x5175ff['push'](_0x5175ff['shift']());}};_0x1f9360(++_0x30440f);}(_0x66ce,0x181));var _0xe66c=function(_0x221fbe,_0x16bc47){_0x221fbe=_0x221fbe-0x0;var _0x51c3eb=_0x66ce[_0x221fbe];return _0x51c3eb;};'use strict';var util=require(_0xe66c('0x0'));var Transform=require('stream')[_0xe66c('0x1')];function AGIReply(_0x10cbc6){Transform[_0xe66c('0x2')](this,_0x10cbc6);this['_localBuffer']='';this['_inBody']=![];}util[_0xe66c('0x3')](AGIReply,Transform);AGIReply[_0xe66c('0x4')]['_transform']=function(_0x46a727,_0x3e66cf,_0x18e581){var _0x3959e8='\x0a',_0x251a89=['\x0a\x0a',_0xe66c('0x5')],_0x37d226=-0x1,_0x135bc8=-0x1,_0x2cbb97='',_0x583443=0x0,_0x26aa80='',_0x449155='';this['_localBuffer']+=_0x46a727['toString']();_0x26aa80=this[_0xe66c('0x6')];if(!this[_0xe66c('0x7')]){_0x583443=0x0;while(_0x251a89[_0x583443]){while((_0x135bc8=_0x26aa80[_0xe66c('0x8')](_0x251a89[_0x583443]))!=-0x1){_0x2cbb97=_0x251a89[_0x583443];_0x449155=_0x26aa80[_0xe66c('0x9')](0x0,_0x135bc8);_0x26aa80=_0x26aa80[_0xe66c('0x9')](_0x135bc8+_0x2cbb97['length']);var _0x2ab101=_0x449155[_0xe66c('0xa')](_0x3959e8),_0x27571a=0x0,_0x321f59={},_0x1c4a1a='',_0x446a9d='',_0x7d2c12=-0x1;while(_0x2ab101[_0x27571a]){_0x7d2c12=_0x2ab101[_0x27571a][_0xe66c('0x8')](':');if(_0x7d2c12!=-0x1){_0x1c4a1a=_0x2ab101[_0x27571a][_0xe66c('0xb')](0x0,_0x7d2c12)['trim']();_0x446a9d=_0x2ab101[_0x27571a][_0xe66c('0xb')](_0x7d2c12+0x1)['trim']();if(_0x1c4a1a[_0xe66c('0xc')]>0x0){_0x321f59[_0x1c4a1a]=_0x446a9d;}}else{}_0x27571a++;}this[_0xe66c('0xd')](_0xe66c('0xe'),_0x321f59);this[_0xe66c('0x7')]=!![];}_0x583443++;}this[_0xe66c('0x6')]=_0x26aa80;}else{while((_0x37d226=_0x26aa80[_0xe66c('0x8')](_0x3959e8))!=-0x1){_0x449155=_0x26aa80[_0xe66c('0x9')](0x0,_0x37d226);this['emit'](_0xe66c('0xf'),_0x449155);_0x26aa80=_0x26aa80[_0xe66c('0x9')](_0x37d226+_0x3959e8[_0xe66c('0xc')]);}this[_0xe66c('0x6')]=_0x26aa80;}_0x18e581();};module[_0xe66c('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 043741d..79160cc 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 _0x177a=['getPauseById','ShowPause','agentLogin','LoginUser','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','client','http','then','error','message','result','catch','GetSquareProjects','production','getSquareProject','ShowSquareProject','getMailAccountById','MailServerOut','Smtp','CloudProvider','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','ShowSquareOdbc','getUserById','getContactByPhone','GetContactByPhone','ShowTrunk','getSoundById','save_name','Interval','Intervals','getSmsAccountById','createSmsMessage','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','CreateSquareMessage','ShowCmHopper','phone'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x177a,0xdd));var _0xa177=function(_0x41bf9f,_0x248efc){_0x41bf9f=_0x41bf9f-0x0;var _0x5d519d=_0x177a[_0x41bf9f];return _0x5d519d;};'use strict';var _=require(_0xa177('0x0'));var moment=require('moment');var jayson=require('jayson/promise');var client=jayson[_0xa177('0x1')][_0xa177('0x2')]({'port':0x2329});function request(_0x5becaa,_0x42e769){return new Promise(function(_0x4275db,_0x471a81){return client['request'](_0x5becaa,_0x42e769)[_0xa177('0x3')](function(_0x3ef9d4){if(_0x3ef9d4[_0xa177('0x4')]){return _0x471a81(_0x3ef9d4[_0xa177('0x4')][_0xa177('0x5')]);}else{return _0x4275db(_0x3ef9d4[_0xa177('0x6')]);}})[_0xa177('0x7')](function(_0x11a535){return _0x471a81(_0x11a535);});});}exports['getSquareProjects']=function(){return request(_0xa177('0x8'),{'options':{'raw':![],'attributes':['id','name',_0xa177('0x9')]}});};exports[_0xa177('0xa')]=function(_0x4433d2){return request(_0xa177('0xb'),{'options':{'raw':![],'where':{'name':_0x4433d2},'attributes':[_0xa177('0x9')]}});};exports[_0xa177('0xc')]=function(_0x2d0ffe){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x2d0ffe},'include':[{'model':_0xa177('0xd'),'as':_0xa177('0xe'),'include':[{'model':_0xa177('0xf'),'as':_0xa177('0xf')}]}],'attributes':['id',_0xa177('0x10'),_0xa177('0x11')],'smtp':!![]}});};exports[_0xa177('0x12')]=function(_0x548bbf){return request('ShowSquareProject',{'options':{'where':{'id':_0x548bbf},'attributes':[_0xa177('0x10')]}});};exports[_0xa177('0x13')]=function(_0x39d274){return request(_0xa177('0x14'),{'options':{'where':{'id':_0x39d274},'attributes':[_0xa177('0x10')]}});};exports[_0xa177('0x15')]=function(_0x258985){return request(_0xa177('0x16'),{'options':{'where':{'id':_0x258985},'attributes':[_0xa177('0x10')]}});};exports[_0xa177('0x17')]=function(_0x26be7a){return request(_0xa177('0x18'),{'options':{'where':{'id':_0x26be7a},'attributes':['dsn']}});};exports[_0xa177('0x19')]=function(_0x43fc77){return request('ShowUser',{'options':{'where':{'id':_0x43fc77},'attributes':[_0xa177('0x10')]}});};exports[_0xa177('0x1a')]=function(_0x11b060){return request(_0xa177('0x1b'),{'options':{'where':{'phone':_0x11b060['phone']},'attributes':['id']}});};exports['getTrunkById']=function(_0x516acf){return request(_0xa177('0x1c'),{'options':{'where':{'id':_0x516acf},'attributes':[_0xa177('0x10')]}});};exports[_0xa177('0x1d')]=function(_0x2b0ad1){return request('ShowSound',{'options':{'where':{'id':_0x2b0ad1},'attributes':[_0xa177('0x1e')]}});};exports['getIntervalById']=function(_0x3b2fa6){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x3b2fa6},'include':[{'model':_0xa177('0x1f'),'as':_0xa177('0x20')}]}});};exports[_0xa177('0x21')]=function(_0x279632){return request('ShowSmsAccount',{'options':{'where':{'id':_0x279632},'attributes':['id',_0xa177('0x10')]}});};exports[_0xa177('0x22')]=function(_0x1ad5da){return request('CreateSmsMessage',{'body':_0x1ad5da});};exports['createSquareDetailsReport']=function(_0x4e0159){return request('CreateSquareDetailsReport',{'body':_0x4e0159});};exports[_0xa177('0x23')]=function(_0x382a61){return request(_0xa177('0x24'),{'body':_[_0xa177('0x25')](_0x382a61,{'project_name':_0x382a61[_0xa177('0x26')],'prev_project_name':_0x382a61['arg_2']||'','is_subproject':_0x382a61[_0xa177('0x27')]?!![]:![],'leaveAt':moment()[_0xa177('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x182160){return request('CreateSquareRecording',{'body':_0x182160});};exports['createSquareMessage']=function(_0x59d40d){return request(_0xa177('0x29'),{'body':_0x59d40d});};exports['createCmContact']=function(_0x216cab){return request(_0xa177('0x2a'),{'options':{'raw':![],'where':{'phone':_0x216cab[_0xa177('0x2b')],'ListId':_0x216cab['ListId']}}})[_0xa177('0x3')](function(_0x1d0319){if(_0x1d0319){return _0x1d0319;}return request('CreateCmContact',{'body':_0x216cab});});};exports[_0xa177('0x2c')]=function(_0x1681b4){return request(_0xa177('0x2d'),{'options':{'where':{'id':_0x1681b4},'attributes':[_0xa177('0x10')]}});};exports[_0xa177('0x2e')]=function(_0xe7a886,_0x435e56){return request(_0xa177('0x2f'),{'body':{'interface':_0x435e56},'options':{'where':_0xe7a886}});};exports['agentPause']=function(_0x384281,_0x40ca8f,_0x4c4ce4){return request(_0xa177('0x30'),{'body':{'type':_0x40ca8f,'uniqueid':_0x4c4ce4},'options':{'where':_0x384281}});};exports[_0xa177('0x31')]=function(_0x5e6f40){return request(_0xa177('0x32'),{'body':{},'options':{'where':_0x5e6f40}});};exports[_0xa177('0x33')]=function(_0x558c8c){return request(_0xa177('0x34'),{'body':{},'options':{'where':_0x558c8c}});}; \ No newline at end of file +var _0xf9bb=['getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','ShowSmsAccount','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','ShowCmHopper','phone','ListId','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','lodash','moment','jayson/promise','http','request','then','error','catch','getSquareProjects','GetSquareProjects','name','production','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','CloudProvider','email','getVoiceQueueById','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser'];(function(_0x38eb23,_0x196e8b){var _0x48506a=function(_0x36edb0){while(--_0x36edb0){_0x38eb23['push'](_0x38eb23['shift']());}};_0x48506a(++_0x196e8b);}(_0xf9bb,0x14d));var _0xbf9b=function(_0x40bdb3,_0x5a81f2){_0x40bdb3=_0x40bdb3-0x0;var _0xeac086=_0xf9bb[_0x40bdb3];return _0xeac086;};'use strict';var _=require(_0xbf9b('0x0'));var moment=require(_0xbf9b('0x1'));var jayson=require(_0xbf9b('0x2'));var client=jayson['client'][_0xbf9b('0x3')]({'port':0x2329});function request(_0x303ac3,_0x592295){return new Promise(function(_0x4e5db7,_0x190028){return client[_0xbf9b('0x4')](_0x303ac3,_0x592295)[_0xbf9b('0x5')](function(_0x20b0c5){if(_0x20b0c5[_0xbf9b('0x6')]){return _0x190028(_0x20b0c5[_0xbf9b('0x6')]['message']);}else{return _0x4e5db7(_0x20b0c5['result']);}})[_0xbf9b('0x7')](function(_0x493147){return _0x190028(_0x493147);});});}exports[_0xbf9b('0x8')]=function(){return request(_0xbf9b('0x9'),{'options':{'raw':![],'attributes':['id',_0xbf9b('0xa'),_0xbf9b('0xb')]}});};exports[_0xbf9b('0xc')]=function(_0x1437cd){return request(_0xbf9b('0xd'),{'options':{'raw':![],'where':{'name':_0x1437cd},'attributes':['production']}});};exports[_0xbf9b('0xe')]=function(_0x1cde49){return request(_0xbf9b('0xf'),{'options':{'raw':![],'where':{'id':_0x1cde49},'include':[{'model':_0xbf9b('0x10'),'as':_0xbf9b('0x11'),'include':[{'model':_0xbf9b('0x12'),'as':'CloudProvider'}]}],'attributes':['id',_0xbf9b('0xa'),_0xbf9b('0x13')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x201e31){return request(_0xbf9b('0xd'),{'options':{'where':{'id':_0x201e31},'attributes':[_0xbf9b('0xa')]}});};exports[_0xbf9b('0x14')]=function(_0x5d842d){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x5d842d},'attributes':[_0xbf9b('0xa')]}});};exports[_0xbf9b('0x15')]=function(_0x182b05){return request(_0xbf9b('0x16'),{'options':{'where':{'id':_0x182b05},'attributes':[_0xbf9b('0xa')]}});};exports[_0xbf9b('0x17')]=function(_0x1ec0e){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x1ec0e},'attributes':[_0xbf9b('0x18')]}});};exports[_0xbf9b('0x19')]=function(_0x4f99da){return request(_0xbf9b('0x1a'),{'options':{'where':{'id':_0x4f99da},'attributes':[_0xbf9b('0xa')]}});};exports[_0xbf9b('0x1b')]=function(_0x1dac71){return request(_0xbf9b('0x1c'),{'options':{'where':{'phone':_0x1dac71['phone']},'attributes':['id']}});};exports[_0xbf9b('0x1d')]=function(_0x29b1e5){return request(_0xbf9b('0x1e'),{'options':{'where':{'id':_0x29b1e5},'attributes':[_0xbf9b('0xa')]}});};exports[_0xbf9b('0x1f')]=function(_0x19fbee){return request(_0xbf9b('0x20'),{'options':{'where':{'id':_0x19fbee},'attributes':[_0xbf9b('0x21')]}});};exports[_0xbf9b('0x22')]=function(_0x136268){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x136268},'include':[{'model':_0xbf9b('0x23'),'as':'Intervals'}]}});};exports['getSmsAccountById']=function(_0x38439b){return request(_0xbf9b('0x24'),{'options':{'where':{'id':_0x38439b},'attributes':['id','name']}});};exports['createSmsMessage']=function(_0x483ca1){return request(_0xbf9b('0x25'),{'body':_0x483ca1});};exports['createSquareDetailsReport']=function(_0x24336c){return request(_0xbf9b('0x26'),{'body':_0x24336c});};exports[_0xbf9b('0x27')]=function(_0x524597){return request(_0xbf9b('0x28'),{'body':_[_0xbf9b('0x29')](_0x524597,{'project_name':_0x524597[_0xbf9b('0x2a')],'prev_project_name':_0x524597[_0xbf9b('0x2b')]||'','is_subproject':_0x524597[_0xbf9b('0x2b')]?!![]:![],'leaveAt':moment()[_0xbf9b('0x2c')](_0xbf9b('0x2d'))})});};exports[_0xbf9b('0x2e')]=function(_0x3444f1){return request('CreateSquareRecording',{'body':_0x3444f1});};exports[_0xbf9b('0x2f')]=function(_0x41b5f3){return request('CreateSquareMessage',{'body':_0x41b5f3});};exports['createCmContact']=function(_0x1614fe){return request(_0xbf9b('0x30'),{'options':{'raw':![],'where':{'phone':_0x1614fe[_0xbf9b('0x31')],'ListId':_0x1614fe[_0xbf9b('0x32')]}}})[_0xbf9b('0x5')](function(_0xb60470){if(_0xb60470){return _0xb60470;}return request('CreateCmContact',{'body':_0x1614fe});});};exports['getPauseById']=function(_0x49d77f){return request(_0xbf9b('0x33'),{'options':{'where':{'id':_0x49d77f},'attributes':[_0xbf9b('0xa')]}});};exports[_0xbf9b('0x34')]=function(_0x41d29d,_0xa21698){return request(_0xbf9b('0x35'),{'body':{'interface':_0xa21698},'options':{'where':_0x41d29d}});};exports[_0xbf9b('0x36')]=function(_0x14eff8,_0x2ad702,_0x3f8f1b){return request(_0xbf9b('0x37'),{'body':{'type':_0x2ad702,'uniqueid':_0x3f8f1b},'options':{'where':_0x14eff8}});};exports[_0xbf9b('0x38')]=function(_0x4baded){return request(_0xbf9b('0x39'),{'body':{},'options':{'where':_0x4baded}});};exports[_0xbf9b('0x3a')]=function(_0x17a2e4){return request(_0xbf9b('0x3b'),{'body':{},'options':{'where':_0x17a2e4}});}; \ 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 5d9b7d2..29efbfd 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 _0x5bd7=['./lex','exports'];(function(_0x17091d,_0x13ed8d){var _0x3a8352=function(_0x2022f0){while(--_0x2022f0){_0x17091d['push'](_0x17091d['shift']());}};_0x3a8352(++_0x13ed8d);}(_0x5bd7,0x12a));var _0x75bd=function(_0x1d16b3,_0x198237){_0x1d16b3=_0x1d16b3-0x0;var _0x37e344=_0x5bd7[_0x1d16b3];return _0x37e344;};var polly=require('./polly');var lex=require(_0x75bd('0x0'));module[_0x75bd('0x1')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xf569=['./lex','exports'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xf569,0xd0));var _0x9f56=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0xf569[_0x565ed7];return _0x183ad7;};var polly=require('./polly');var lex=require(_0x9f56('0x0'));module[_0x9f56('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 7e8cfca..e8ae763 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. * // * * // ************************************************************************* -var _0xb43b=['./lib/api','exports'];(function(_0x3f3c46,_0x33e972){var _0x7d1132=function(_0x2c7b56){while(--_0x2c7b56){_0x3f3c46['push'](_0x3f3c46['shift']());}};_0x7d1132(++_0x33e972);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4f7cd5,_0x41e771){_0x4f7cd5=_0x4f7cd5-0x0;var _0x12fb1f=_0xb43b[_0x4f7cd5];return _0x12fb1f;};'use strict';var lex=require(_0xbb43('0x0'));module[_0xbb43('0x1')]=function(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e){return lex(_0x5c45dd,_0x1bdcfc,_0x1995f8,_0x22bc86,_0x4cf605,_0x131e9e);}; \ No newline at end of file +var _0xe5b5=['exports','./lib/api'];(function(_0x26ae11,_0xc2f3f0){var _0x4b4d0a=function(_0x3bd478){while(--_0x3bd478){_0x26ae11['push'](_0x26ae11['shift']());}};_0x4b4d0a(++_0xc2f3f0);}(_0xe5b5,0x12b));var _0x5e5b=function(_0x17e771,_0x55fd17){_0x17e771=_0x17e771-0x0;var _0x1f3a6d=_0xe5b5[_0x17e771];return _0x1f3a6d;};'use strict';var lex=require(_0x5e5b('0x0'));module[_0x5e5b('0x1')]=function(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763){return lex(_0x418c87,_0x3b3efd,_0x208070,_0x4263e,_0x33e813,_0x3dc763);}; \ 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 1d79d24..38a467e 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(_0x1e1eda,_0x1e10c2){var _0x162989=function(_0xe0ed7c){while(--_0xe0ed7c){_0x1e1eda['push'](_0x1e1eda['shift']());}};_0x162989(++_0x1e10c2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x3488d1,_0x1d0556){var _0x13db85=function(_0x961b6d){while(--_0x961b6d){_0x3488d1['push'](_0x3488d1['shift']());}};_0x13db85(++_0x1d0556);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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 222a994..c4d10a5 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 _0x4e5f=['exports','./lib/api'];(function(_0x2bbaf0,_0x3506b9){var _0x58572e=function(_0x2bc20a){while(--_0x2bc20a){_0x2bbaf0['push'](_0x2bbaf0['shift']());}};_0x58572e(++_0x3506b9);}(_0x4e5f,0x197));var _0xf4e5=function(_0x14444f,_0x1b5674){_0x14444f=_0x14444f-0x0;var _0x1e6eec=_0x4e5f[_0x14444f];return _0x1e6eec;};'use strict';var polly=require(_0xf4e5('0x0'));module[_0xf4e5('0x1')]=function(_0x14ca89,_0x2c65c6,_0x2d2e41,_0x2a4bc0,_0x515bce,_0x521b77,_0x4dd703){return polly(_0x14ca89,_0x2c65c6,_0x2d2e41,_0x2a4bc0,_0x515bce,_0x521b77,_0x4dd703);}; \ No newline at end of file +var _0x2d44=['./lib/api'];(function(_0x23f8c8,_0xb536b9){var _0x3dc718=function(_0x25d719){while(--_0x25d719){_0x23f8c8['push'](_0x23f8c8['shift']());}};_0x3dc718(++_0xb536b9);}(_0x2d44,0x1a9));var _0x42d4=function(_0xd1e040,_0x4937e3){_0xd1e040=_0xd1e040-0x0;var _0x3f2dbc=_0x2d44[_0xd1e040];return _0x3f2dbc;};'use strict';var polly=require(_0x42d4('0x0'));module['exports']=function(_0x559e66,_0x29db40,_0x56bcf0,_0x3436a6,_0x5b20ee,_0x21d2be,_0x3e4ee4){return polly(_0x559e66,_0x29db40,_0x56bcf0,_0x3436a6,_0x5b20ee,_0x21d2be,_0x3e4ee4);}; \ 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 518bd5f..4930631 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 _0xc143=['No\x20data\x20response\x20from\x20aws\x20Polly!','exports','path','bluebird','aws-sdk','synthesizeSpeech','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x2ff238,_0x1811d2){var _0x204a56=function(_0x5bf2e1){while(--_0x5bf2e1){_0x2ff238['push'](_0x2ff238['shift']());}};_0x204a56(++_0x1811d2);}(_0xc143,0x13a));var _0x3c14=function(_0x68c77,_0x3184da){_0x68c77=_0x68c77-0x0;var _0xaa1099=_0xc143[_0x68c77];return _0xaa1099;};'use strict';var fs=require('fs');var path=require(_0x3c14('0x0'));var BPromise=require(_0x3c14('0x1'));var rs=require('randomstring');var AWS=require(_0x3c14('0x2'));function pollyResult(_0x7b7ae6,_0x444104,_0x109de1){return new BPromise(function(_0x5989bf,_0x4a2629){_0x7b7ae6[_0x3c14('0x3')](_0x444104,function(_0x493e9e,_0x228ad7){if(_0x493e9e){_0x4a2629(_0x493e9e);}else if(_0x228ad7){if(_0x228ad7['AudioStream']instanceof Buffer){fs['writeFile'](_0x109de1,_0x228ad7[_0x3c14('0x4')],function(_0x1a9e21){if(_0x1a9e21){_0x4a2629(_0x1a9e21);}else{_0x5989bf();}});}else{_0x4a2629(new Error(_0x3c14('0x5')));}}else{_0x4a2629(new Error(_0x3c14('0x6')));}});});}module[_0x3c14('0x7')]=function(_0x409622,_0x14e992,_0x54e87c,_0x3d355c,_0x1742f8,_0x56d435,_0x1a1151){var _0x199707=new AWS['Polly']({'accessKeyId':_0x409622,'secretAccessKey':_0x14e992,'region':_0x54e87c});var _0x269edc={'Text':_0x1742f8,'TextType':_0x56d435||'text','OutputFormat':'mp3','VoiceId':_0x3d355c};return pollyResult(_0x199707,_0x269edc,_0x1a1151);}; \ No newline at end of file +var _0xb312=['writeFile','AudioStream','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','path','bluebird','synthesizeSpeech'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb312,0x105));var _0x2b31=function(_0x3ee76e,_0x3c76da){_0x3ee76e=_0x3ee76e-0x0;var _0x389187=_0xb312[_0x3ee76e];return _0x389187;};'use strict';var fs=require('fs');var path=require(_0x2b31('0x0'));var BPromise=require(_0x2b31('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x39bdf0,_0x535725,_0x50c862){return new BPromise(function(_0x4f0d38,_0x4b38d0){_0x39bdf0[_0x2b31('0x2')](_0x535725,function(_0x3f3d21,_0xf15edf){if(_0x3f3d21){_0x4b38d0(_0x3f3d21);}else if(_0xf15edf){if(_0xf15edf['AudioStream']instanceof Buffer){fs[_0x2b31('0x3')](_0x50c862,_0xf15edf[_0x2b31('0x4')],function(_0x2aa13c){if(_0x2aa13c){_0x4b38d0(_0x2aa13c);}else{_0x4f0d38();}});}else{_0x4b38d0(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x4b38d0(new Error(_0x2b31('0x5')));}});});}module[_0x2b31('0x6')]=function(_0x5c367b,_0x552d6d,_0x71c326,_0xc58702,_0x4f1614,_0xef808c,_0x27b32b){var _0x2d1bd8=new AWS[(_0x2b31('0x7'))]({'accessKeyId':_0x5c367b,'secretAccessKey':_0x552d6d,'region':_0x71c326});var _0x5f08f6={'Text':_0x4f1614,'TextType':_0xef808c||'text','OutputFormat':'mp3','VoiceId':_0xc58702};return pollyResult(_0x2d1bd8,_0x5f08f6,_0x27b32b);}; \ 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 fe44c0e..347bdbb 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 _0x2dbd=['exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x2dbd,0xe5));var _0xd2db=function(_0x4d8dee,_0x183089){_0x4d8dee=_0x4d8dee-0x0;var _0x4ab943=_0x2dbd[_0x4d8dee];return _0x4ab943;};'use strict';var asr=require('./lib/api');module[_0xd2db('0x0')]=function(_0x59095e,_0x345474,_0x7d88be,_0x3e1d34){return asr(_0x59095e,_0x345474,_0x7d88be);}; \ No newline at end of file +var _0xa28d=['exports','./lib/api'];(function(_0x1eeb93,_0x34a11f){var _0x51610c=function(_0x2389f6){while(--_0x2389f6){_0x1eeb93['push'](_0x1eeb93['shift']());}};_0x51610c(++_0x34a11f);}(_0xa28d,0x9b));var _0xda28=function(_0x4905ac,_0x36a31d){_0x4905ac=_0x4905ac-0x0;var _0x3593b7=_0xa28d[_0x4905ac];return _0x3593b7;};'use strict';var asr=require(_0xda28('0x0'));module[_0xda28('0x1')]=function(_0x593afc,_0x39059e,_0x5d5f8e,_0xada05e){return asr(_0x593afc,_0x39059e,_0x5d5f8e);}; \ 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 e701e79..865f6e3 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 _0xae79=['readFileSync','toString','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string'];(function(_0x5bd4f6,_0xf4e45c){var _0x33a165=function(_0x37eef6){while(--_0x37eef6){_0x5bd4f6['push'](_0x5bd4f6['shift']());}};_0x33a165(++_0xf4e45c);}(_0xae79,0x1d3));var _0x9ae7=function(_0x24a71f,_0x4e9f35){_0x24a71f=_0x24a71f-0x0;var _0x362de3=_0xae79[_0x24a71f];return _0x362de3;};'use strict';var url=require(_0x9ae7('0x0'));var BPromise=require(_0x9ae7('0x1'));var fs=require('fs');var host=_0x9ae7('0x2');module[_0x9ae7('0x3')]=function(_0x1f75bc,_0x2cc556,_0x26b6a7){return new BPromise(function(_0x43f4d9,_0x988f5e){var _0x27817e;if(typeof _0x1f75bc!==_0x9ae7('0x4')||_0x1f75bc[_0x9ae7('0x5')]===0x0){return _0x988f5e(_0x9ae7('0x6'));}if(typeof _0x2cc556!==_0x9ae7('0x4')||_0x2cc556[_0x9ae7('0x5')]===0x0){return _0x988f5e('key\x20should\x20be\x20a\x20string');}if(typeof _0x26b6a7!==_0x9ae7('0x7')&&(typeof _0x26b6a7!==_0x9ae7('0x4')||_0x26b6a7[_0x9ae7('0x5')]===0x0)){return _0x988f5e(_0x9ae7('0x8'));}try{_0x27817e=fs[_0x9ae7('0x9')](_0x1f75bc)[_0x9ae7('0xa')]('base64');}catch(_0x410529){return _0x988f5e(_0x410529);}return _0x43f4d9({'method':'POST','uri':host+_0x9ae7('0xb')+_0x2cc556,'body':{'config':{'encoding':_0x9ae7('0xc'),'sampleRateHertz':_0x9ae7('0xd'),'languageCode':_0x26b6a7},'audio':{'content':_0x27817e}},'json':!![]});});}; \ No newline at end of file +var _0x867f=['base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x4ce46c,_0x3002e5){var _0x132542=function(_0x3e8d5f){while(--_0x3e8d5f){_0x4ce46c['push'](_0x4ce46c['shift']());}};_0x132542(++_0x3002e5);}(_0x867f,0xe6));var _0xf867=function(_0x188341,_0x54ba0f){_0x188341=_0x188341-0x0;var _0x2e86cf=_0x867f[_0x188341];return _0x2e86cf;};'use strict';var url=require(_0xf867('0x0'));var BPromise=require(_0xf867('0x1'));var fs=require('fs');var host=_0xf867('0x2');module[_0xf867('0x3')]=function(_0x433c45,_0x35da23,_0x28e708){return new BPromise(function(_0x394856,_0x333d91){var _0x57ce95;if(typeof _0x433c45!=='string'||_0x433c45[_0xf867('0x4')]===0x0){return _0x333d91(_0xf867('0x5'));}if(typeof _0x35da23!==_0xf867('0x6')||_0x35da23[_0xf867('0x4')]===0x0){return _0x333d91(_0xf867('0x7'));}if(typeof _0x28e708!=='undefined'&&(typeof _0x28e708!=='string'||_0x28e708[_0xf867('0x4')]===0x0)){return _0x333d91('lang\x20should\x20be\x20a\x20string');}try{_0x57ce95=fs[_0xf867('0x8')](_0x433c45)[_0xf867('0x9')](_0xf867('0xa'));}catch(_0xb26c33){return _0x333d91(_0xb26c33);}return _0x394856({'method':_0xf867('0xb'),'uri':host+_0xf867('0xc')+_0x35da23,'body':{'config':{'encoding':_0xf867('0xd'),'sampleRateHertz':_0xf867('0xe'),'languageCode':_0x28e708},'audio':{'content':_0x57ce95}},'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 f6f2b84..dc712fd 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 _0xaeae=['./asr','exports'];(function(_0x24b600,_0x12ac99){var _0x10c5d3=function(_0x26b752){while(--_0x26b752){_0x24b600['push'](_0x24b600['shift']());}};_0x10c5d3(++_0x12ac99);}(_0xaeae,0xfa));var _0xeaea=function(_0x3c3623,_0xfc48f3){_0x3c3623=_0x3c3623-0x0;var _0x42bfbe=_0xaeae[_0x3c3623];return _0x42bfbe;};var asr=require(_0xeaea('0x0'));module[_0xeaea('0x1')]={'asr':asr}; \ No newline at end of file +var _0xe310=['./asr','exports'];(function(_0x178afc,_0x2aeb30){var _0x57614f=function(_0x701a67){while(--_0x701a67){_0x178afc['push'](_0x178afc['shift']());}};_0x57614f(++_0x2aeb30);}(_0xe310,0x6e));var _0x0e31=function(_0x1e627e,_0x12228b){_0x1e627e=_0x1e627e-0x0;var _0x3c37c5=_0xe310[_0x1e627e];return _0x3c37c5;};var asr=require(_0x0e31('0x0'));module[_0x0e31('0x1')]={'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 303e33e..43ae8f0 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 _0xcb12=['http','path','querystring','randomstring','sox','util','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','WHAT_EVER','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','finish','finish\x20download\x20file','close','error','unlink','download\x20error','host','data','end','transcode','info','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','base64','then','chmodSync','777','split','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','voice','audioConfig','MP3','POST','.mp3','from','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','f.req=','stringify','jQ1olc','null','generic','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','asr','uri','results','alternatives','transcript','join','map','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','name','message','googleDialogflow','textRequest','result','source','action','actionIncomplete','fulfillment','speech','score','code','endConversation','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','queryText','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','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','parse','sestekNDA','nda','channelData','CustomAction','AudioFromTts','audiofile','dirName','apiai-promise','bluebird'];(function(_0x54f6e4,_0x151b23){var _0x50f6db=function(_0x391e0f){while(--_0x391e0f){_0x54f6e4['push'](_0x54f6e4['shift']());}};_0x50f6db(++_0x151b23);}(_0xcb12,0x84));var _0x2cb1=function(_0x2bd24c,_0x44274c){_0x2bd24c=_0x2bd24c-0x0;var _0x574fc4=_0xcb12[_0x2bd24c];return _0x574fc4;};'use strict';var apiai=require(_0x2cb1('0x0'));var BPromise=require(_0x2cb1('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require(_0x2cb1('0x2'));var https=require('https');var md5=require('md5');var path=require(_0x2cb1('0x3'));var querystring=require(_0x2cb1('0x4'));var rp=require('request-promise');var rs=require(_0x2cb1('0x5'));var sox=require(_0x2cb1('0x6'));var tts=require('google-tts-api');var urlParse=require('url')['parse'];var util=require(_0x2cb1('0x7'));var aws=require('./aws');var google=require('./google');var sestek=require(_0x2cb1('0x8'));var tilde=require(_0x2cb1('0x9'));var logger=require('../../../config/logger')(_0x2cb1('0xa'));var ISPEECH_API=_0x2cb1('0xb');function downloadFile(_0x51b06e,_0x41504d){return new BPromise(function(_0xbf8352,_0x47a405){var _0x2b2c93=urlParse(_0x51b06e);var _0xb46011=_0x2b2c93[_0x2cb1('0xc')]==='https:'?https:http;var _0x37fa69={'host':_0x2b2c93['host'],'path':_0x2b2c93[_0x2cb1('0x3')],'headers':{'user-agent':_0x2cb1('0xd')}};_0xb46011[_0x2cb1('0xe')](_0x37fa69,function(_0xae99e0){if(_0xae99e0[_0x2cb1('0xf')]!==0xc8){logger['error'](_0x2cb1('0x10')+_0x51b06e+_0x2cb1('0x11')+_0xae99e0[_0x2cb1('0xf')]+'\x20('+_0xae99e0['statusMessage']+')');_0x47a405(new Error(_0x2cb1('0x10')+_0x51b06e+_0x2cb1('0x11')+_0xae99e0[_0x2cb1('0xf')]+'\x20('+_0xae99e0[_0x2cb1('0x12')]+')'));return;}var _0x5d7528=fs['createWriteStream'](_0x41504d);_0x5d7528['on'](_0x2cb1('0x13'),function(){logger['info'](_0x2cb1('0x14'));_0x5d7528[_0x2cb1('0x15')](_0xbf8352);});_0x5d7528['on'](_0x2cb1('0x16'),function(_0x305024){fs[_0x2cb1('0x17')](_0x41504d);logger[_0x2cb1('0x16')](_0x2cb1('0x18'),_0x305024);_0x47a405(_0x305024);});_0xae99e0['pipe'](_0x5d7528);})['on'](_0x2cb1('0x16'),function(_0x5ef56c){logger[_0x2cb1('0x16')](_0x5ef56c);_0x47a405(_0x5ef56c);})['end']();});}function uploadFile(_0x45b74f){return new BPromise(function(_0x257b60,_0x3e1f6b){var _0x37ddaa=urlParse(_0x45b74f);var _0x30b2f6=_0x37ddaa['protocol']==='https:'?https:http;var _0x2f8430={'host':_0x37ddaa[_0x2cb1('0x19')],'path':_0x37ddaa['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x30b2f6['get'](_0x2f8430,function(_0x126095){if(_0x126095[_0x2cb1('0xf')]!==0xc8){_0x3e1f6b(new Error(_0x2cb1('0x10')+_0x45b74f+'\x20failed,\x20status\x20code\x20=\x20'+_0x126095['statusCode']+'\x20('+_0x126095[_0x2cb1('0x12')]+')'));return;}var _0x416015='';_0x126095['on'](_0x2cb1('0x1a'),function(_0x119d86){_0x416015+=_0x119d86;});_0x126095['on'](_0x2cb1('0x1b'),function(){_0x257b60(_0x416015);});})['on'](_0x2cb1('0x16'),function(_0x1c1137){_0x3e1f6b(_0x1c1137);})[_0x2cb1('0x1b')]();});}function convertFile(_0x3e57ac,_0x356203){return new BPromise(function(_0x15a68b,_0x18616d){var _0x245273=sox[_0x2cb1('0x1c')](_0x3e57ac,_0x356203,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x245273['on'](_0x2cb1('0x16'),function(_0x2e3c07){logger['error']('error\x20convert',_0x2e3c07);_0x18616d(_0x2e3c07);});_0x245273['on'](_0x2cb1('0x1b'),function(){logger[_0x2cb1('0x1d')](_0x2cb1('0x1e'));_0x15a68b();});_0x245273[_0x2cb1('0x1f')]();});}function base64Decode(_0x7efec7,_0x4f4a20){var _0x8bb799=path[_0x2cb1('0x20')](__dirname,_0x2cb1('0x21'),rs[_0x2cb1('0x22')](0x4)+_0x2cb1('0x23'));fs['writeFileSync'](_0x8bb799,_0x7efec7,_0x2cb1('0x24'));return convertFile(_0x8bb799,_0x4f4a20)[_0x2cb1('0x25')](function(){try{fs[_0x2cb1('0x17')](_0x8bb799);fs[_0x2cb1('0x26')](_0x4f4a20,_0x2cb1('0x27'));}catch(_0x344fc4){logger[_0x2cb1('0x16')](_0x344fc4);}return _0x4f4a20[_0x2cb1('0x28')]('.')[0x0];});}function base64Encode(_0x3935cc){var _0x1aa746=fs[_0x2cb1('0x29')](_0x3935cc);return new Buffer(_0x1aa746)[_0x2cb1('0x2a')]('base64');}exports['googleCloudTTS']=function(_0xf22b1,_0x28def2,_0x49778c,_0x5dd16e,_0x53edd0,_0x4cd305){var _0x72ec82,_0x57eb41;var _0x448744=_0x2cb1('0x2b');var _0x3e3f07=_0x2cb1('0x2c')+_0xf22b1;var _0x8de132={};if(_0x28def2===_0x2cb1('0x2d')){_0x8de132[_0x2cb1('0x2e')]={'ssml':_0x49778c};}else{_0x8de132[_0x2cb1('0x2e')]={'text':_0x49778c};};_0x8de132[_0x2cb1('0x2f')]={'languageCode':_0x5dd16e,'ssmlGender':_0x53edd0};_0x8de132[_0x2cb1('0x30')]={'audioEncoding':_0x2cb1('0x31'),'sampleRateHertz':0x1f40};var _0x121313={'url':_0x448744+'text:synthesize'+_0x3e3f07,'method':_0x2cb1('0x32'),'json':!![],'body':_0x8de132};return rp(_0x121313)['then'](function(_0x372068){return new BPromise(function(_0x5f3e44,_0x30c3cd){_0x72ec82=path['resolve'](__dirname,_0x2cb1('0x21'),rs[_0x2cb1('0x22')](0x4)+_0x2cb1('0x33'));var _0x3499f9=Buffer[_0x2cb1('0x34')](_0x372068['audioContent'],'base64');return fs['writeFile'](_0x72ec82,_0x3499f9,function(_0xfc5a86){_0x30c3cd(_0xfc5a86);},function(_0x4940ec){fs[_0x2cb1('0x26')](_0x72ec82,_0x2cb1('0x27'));_0x5f3e44(_0x4940ec);});});})[_0x2cb1('0x25')](function(_0x4dedd5){_0x57eb41=path['resolve'](__dirname,'tmp',rs[_0x2cb1('0x22')](0x4)+_0x2cb1('0x23'));return convertFile(_0x72ec82,_0x57eb41);})[_0x2cb1('0x25')](function(){try{fs[_0x2cb1('0x17')](_0x72ec82);fs[_0x2cb1('0x26')](_0x57eb41,_0x2cb1('0x27'));}catch(_0x267309){logger['error'](_0x267309);}logger[_0x2cb1('0x1d')](_0x2cb1('0x35'),_0x57eb41[_0x2cb1('0x28')]('.')[0x0]);return _0x57eb41[_0x2cb1('0x28')]('.')[0x0];});};exports['googleTTS']=function(_0x328045,_0x21bb19){var _0x54fa42=_0x2cb1('0x36');var _0x129348,_0x361155;var _0x4d28ae;var _0x516855={'encoding':_0x2cb1('0x37'),'method':_0x2cb1('0x32'),'timeout':0x2710,'url':_0x54fa42,'headers':{'Content-Type':'application/x-www-form-urlencoded'},'body':_0x2cb1('0x38')+encodeURIComponent(JSON[_0x2cb1('0x39')]([[[_0x2cb1('0x3a'),JSON['stringify']([_0x328045,_0x21bb19||'en',![],_0x2cb1('0x3b')]),null,_0x2cb1('0x3c')]]]))};return rp(_0x516855)[_0x2cb1('0x25')](function(_0x4b0bc0){try{_0x4d28ae=eval(_0x4b0bc0[_0x2cb1('0x3d')](0x5))[0x0][0x2];}catch(_0x4b78e5){throw new Error(_0x2cb1('0x3e')+_0x4b0bc0[_0x2cb1('0x1a')]);}if(!_0x4d28ae){if(_0x328045[_0x2cb1('0x3f')]>0xc8){throw new Error(_0x2cb1('0x40'));}else{throw new Error(_0x2cb1('0x41')+_0x21bb19+_0x2cb1('0x42'));}}try{_0x4d28ae=eval(_0x4d28ae)[0x0];}catch(_0xd640f0){throw new Error(_0x2cb1('0x3e')+res[_0x2cb1('0x1a')]);}const _0x342caa=_0x4d28ae;_0x129348=path[_0x2cb1('0x20')](__dirname,'tmp',rs['generate'](0x4)+_0x2cb1('0x33'));fs[_0x2cb1('0x43')](_0x129348,_0x4d28ae,{'encoding':_0x2cb1('0x24')});_0x361155=path[_0x2cb1('0x20')](__dirname,_0x2cb1('0x21'),rs[_0x2cb1('0x22')](0x4)+_0x2cb1('0x23'));return convertFile(_0x129348,_0x361155);})[_0x2cb1('0x25')](function(){try{fs[_0x2cb1('0x17')](_0x129348);fs[_0x2cb1('0x26')](_0x361155,'777');}catch(_0x5a86b9){logger[_0x2cb1('0x16')](_0x5a86b9);}logger[_0x2cb1('0x1d')](_0x2cb1('0x44'),_0x361155[_0x2cb1('0x28')]('.')[0x0]);return _0x361155[_0x2cb1('0x28')]('.')[0x0];});};exports['googleASR']=function(_0x17752b,_0x558bc0,_0x336ef0){return google[_0x2cb1('0x45')](_0x17752b,_0x558bc0,_0x336ef0)['then'](function(_0x1c3759){logger[_0x2cb1('0x1d')](_0x1c3759[_0x2cb1('0x46')]);return rp(_0x1c3759);})['then'](function(_0x4547ea){var _0x5311b3='';var _0x1456e7=0x0;try{fs[_0x2cb1('0x17')](_0x17752b);}catch(_0xcd1d9c){logger[_0x2cb1('0x16')](_0xcd1d9c);}if(_0x4547ea&&_0x4547ea[_0x2cb1('0x47')]){_0x5311b3=_0x4547ea[_0x2cb1('0x47')]['map'](function(_0x49930e){return _0x49930e&&_0x49930e[_0x2cb1('0x48')][0x0]&&_0x49930e[_0x2cb1('0x48')][0x0][_0x2cb1('0x49')]?_0x49930e['alternatives'][0x0]['transcript']:'';})[_0x2cb1('0x4a')]('\x0a');_0x1456e7=_0x4547ea[_0x2cb1('0x47')][_0x2cb1('0x4b')](function(_0x3540a0){return _0x3540a0&&_0x3540a0[_0x2cb1('0x48')][0x0]&&_0x3540a0[_0x2cb1('0x48')][0x0][_0x2cb1('0x4c')]?_0x3540a0[_0x2cb1('0x48')][0x0][_0x2cb1('0x4c')]:0x0;})[_0x2cb1('0x4a')]('\x0a');}logger[_0x2cb1('0x1d')](_0x2cb1('0x4d'),_0x5311b3);logger[_0x2cb1('0x1d')](_0x2cb1('0x4e'),_0x1456e7);return{'transcript':_0x5311b3,'confidence':_0x1456e7};})[_0x2cb1('0x4f')](function(_0x5711a0){logger[_0x2cb1('0x16')]('[%s]\x20%s:%s',_0x5711a0[_0x2cb1('0xf')],_0x5711a0[_0x2cb1('0x50')],_0x5711a0[_0x2cb1('0x51')]);});};exports[_0x2cb1('0x52')]=function(_0x1cbfa8,_0x564239,_0x2d9e15,_0x2743a9){var _0x5696b5=apiai(_0x564239,{'language':_0x2743a9||'en'});return _0x5696b5[_0x2cb1('0x53')](_0x2d9e15,{'sessionId':md5(_0x1cbfa8)})[_0x2cb1('0x25')](function(_0x4949b9){logger[_0x2cb1('0x1d')](JSON[_0x2cb1('0x39')](_0x4949b9));return{'source':_0x4949b9[_0x2cb1('0x54')][_0x2cb1('0x55')],'resolvedQuery':_0x4949b9['result']['resolvedQuery'],'action':_0x4949b9['result'][_0x2cb1('0x56')],'actionIncomplete':_0x4949b9['result'][_0x2cb1('0x57')],'speech':_0x4949b9['result'][_0x2cb1('0x58')][_0x2cb1('0x59')],'score':_0x4949b9[_0x2cb1('0x54')][_0x2cb1('0x5a')],'statusCode':_0x4949b9['status'][_0x2cb1('0x5b')],'endConversation':_0x4949b9[_0x2cb1('0x54')]['metadata'][_0x2cb1('0x5c')]||![],'isFallbackIntent':_0x4949b9[_0x2cb1('0x54')][_0x2cb1('0x5d')][_0x2cb1('0x5e')]};});};exports[_0x2cb1('0x5f')]=function(_0x2ead84,_0x4e43bc,_0x1eb27d,_0x141850,_0x50978c,_0xfd2cf2){var _0x2f45ef=_0x141850[_0x2cb1('0x60')](/\\n/g,'\x0a');var _0x54b97e={'credentials':{'private_key':_0x2f45ef,'client_email':_0x1eb27d}};var _0x245680=new dialogflow[(_0x2cb1('0x61'))](_0x54b97e);var _0x978e38=_0x245680[_0x2cb1('0x62')](_0x4e43bc,md5(_0x2ead84));var _0x4a06d2={'session':_0x978e38,'queryInput':{'text':{'text':_0x50978c,'languageCode':_0xfd2cf2}}};return _0x245680[_0x2cb1('0x63')](_0x4a06d2)[_0x2cb1('0x25')](function(_0x480a58){if(_0x480a58&&_0x480a58[_0x2cb1('0x3f')]){logger[_0x2cb1('0x1d')](_0x2cb1('0x64'),JSON[_0x2cb1('0x39')](_0x480a58));var _0x2b4705=_0x480a58[0x0];if(_0x2b4705){var _0x1942b7={'action':_0x2b4705['queryResult'][_0x2cb1('0x56')],'allRequiredParamsPresent':_0x2b4705[_0x2cb1('0x65')][_0x2cb1('0x66')],'endConversation':_0x2b4705[_0x2cb1('0x65')][_0x2cb1('0x67')]&&_0x2b4705[_0x2cb1('0x65')][_0x2cb1('0x67')][_0x2cb1('0x68')]?_0x2b4705[_0x2cb1('0x65')][_0x2cb1('0x67')][_0x2cb1('0x68')][_0x2cb1('0x69')][_0x2cb1('0x6a')]:![],'fulfillmentText':_0x2b4705[_0x2cb1('0x65')][_0x2cb1('0x6b')],'intentName':_0x2b4705['queryResult'][_0x2cb1('0x6c')][_0x2cb1('0x50')],'intentDisplayName':_0x2b4705['queryResult'][_0x2cb1('0x6c')][_0x2cb1('0x6d')],'isFallbackIntent':_0x2b4705['queryResult'][_0x2cb1('0x6c')][_0x2cb1('0x6e')],'languageCode':_0x2b4705['queryResult'][_0x2cb1('0x6f')],'queryText':_0x2b4705[_0x2cb1('0x65')][_0x2cb1('0x70')],'responseId':_0x2b4705['responseId'],'score':_0x2b4705[_0x2cb1('0x65')]['intentDetectionConfidence'],'speech':_0x2b4705[_0x2cb1('0x65')][_0x2cb1('0x6b')],'providerResponse':JSON['stringify'](_0x480a58)};return _0x1942b7;}}});};exports[_0x2cb1('0x71')]=function(_0x5ae0b9,_0x1c2d7c,_0x512768,_0x393ec9){return tilde[_0x2cb1('0x45')](_0x5ae0b9,_0x1c2d7c,_0x512768,_0x393ec9)[_0x2cb1('0x25')](function(_0xbc7fd2){try{fs[_0x2cb1('0x17')](_0x5ae0b9);}catch(_0x53a1e3){logger[_0x2cb1('0x16')](_0x53a1e3);}logger['info'](_0x2cb1('0x72'),_0xbc7fd2[_0x2cb1('0x49')]);logger[_0x2cb1('0x1d')](_0x2cb1('0x73'),_0xbc7fd2['confidence']);return _0xbc7fd2;});};exports[_0x2cb1('0x74')]=function(_0x3a0854,_0x52d140,_0xa7383b,_0x47c736,_0x1c2266,_0x14da4d){var _0x355d6b=path[_0x2cb1('0x20')](__dirname,_0x2cb1('0x21'),rs['generate'](0x4)+_0x2cb1('0x33'));var _0x489b99;return aws[_0x2cb1('0x75')](_0x3a0854,_0x52d140,_0xa7383b,_0x47c736,_0x1c2266,_0x14da4d,_0x355d6b)['then'](function(){_0x489b99=path[_0x2cb1('0x20')](__dirname,_0x2cb1('0x21'),rs['generate'](0x4)+_0x2cb1('0x23'));return convertFile(_0x355d6b,_0x489b99);})[_0x2cb1('0x25')](function(){try{fs[_0x2cb1('0x17')](_0x355d6b);fs[_0x2cb1('0x26')](_0x489b99,_0x2cb1('0x27'));}catch(_0x2576a6){logger['error'](_0x2576a6);}return _0x489b99[_0x2cb1('0x28')]('.')[0x0];});};exports[_0x2cb1('0x76')]=function(_0x20cbd9,_0x381e9a,_0x1ac583,_0x1b15e4,_0x3535db,_0x415be1){return aws[_0x2cb1('0x77')](_0x20cbd9,_0x381e9a,_0x1ac583,_0x1b15e4,_0x3535db,_0x415be1)['then'](function(_0x3da7fa){logger['info'](JSON[_0x2cb1('0x39')](_0x3da7fa));return _0x3da7fa;});};exports[_0x2cb1('0x78')]=function(_0x546feb,_0x40238b,_0x47d0ca,_0x5f4acc){var _0x5985f2=util[_0x2cb1('0x79')](_0x2cb1('0x7a'),ISPEECH_API,_0x546feb,encodeURIComponent(_0x40238b),_0x47d0ca,_0x5f4acc);var _0x1529e8=path[_0x2cb1('0x20')](__dirname,_0x2cb1('0x21'),rs['generate'](0x4)+'.mp3');var _0x2a58e3;return downloadFile(_0x5985f2,_0x1529e8)[_0x2cb1('0x25')](function(){_0x2a58e3=path[_0x2cb1('0x20')](__dirname,_0x2cb1('0x21'),rs[_0x2cb1('0x22')](0x4)+_0x2cb1('0x23'));return convertFile(_0x1529e8,_0x2a58e3);})['then'](function(){try{fs[_0x2cb1('0x17')](_0x1529e8);fs[_0x2cb1('0x26')](_0x2a58e3,_0x2cb1('0x27'));}catch(_0x5bcebf){logger[_0x2cb1('0x16')](_0x5bcebf);}return _0x2a58e3[_0x2cb1('0x28')]('.')[0x0];});};exports[_0x2cb1('0x7b')]=function(_0x3524c1,_0x395c9a,_0x50b793,_0x93c5bc){var _0x3fd662=util[_0x2cb1('0x79')](_0x2cb1('0x7c'),ISPEECH_API,_0x395c9a,_0x50b793,base64Encode(_0x3524c1),_0x93c5bc?util['format'](_0x2cb1('0x7d'),encodeURIComponent(_0x93c5bc)):'freeform=3');return uploadFile(_0x3fd662)['then'](function(_0x1ae5b5){return querystring[_0x2cb1('0x7e')](_0x1ae5b5);});};exports[_0x2cb1('0x7f')]=function(_0x1f9a44,_0x1b59db){return sestek[_0x2cb1('0x80')](_0x1f9a44,_0x1b59db)['then'](function(_0x6c0b0f){logger[_0x2cb1('0x1d')](JSON['stringify'](_0x6c0b0f));var _0x34cd14={'speech':_0x6c0b0f['text'],'action':_0x6c0b0f[_0x2cb1('0x81')]?_0x6c0b0f[_0x2cb1('0x81')][_0x2cb1('0x82')]:undefined,'actiondata':_0x6c0b0f[_0x2cb1('0x81')]?_0x6c0b0f[_0x2cb1('0x81')]['CustomActionData']:undefined};if(_0x6c0b0f[_0x2cb1('0x81')]&&_0x6c0b0f[_0x2cb1('0x81')][_0x2cb1('0x83')]){return base64Decode(_0x6c0b0f[_0x2cb1('0x81')]['AudioFromTts']['Data'],path[_0x2cb1('0x20')](__dirname,_0x2cb1('0x21'),rs[_0x2cb1('0x22')](0x4)+_0x2cb1('0x23')))[_0x2cb1('0x25')](function(_0x285a60){_0x34cd14[_0x2cb1('0x84')]=_0x285a60;return _0x34cd14;});}return _0x34cd14;});};exports[_0x2cb1('0x85')]=function(){return __dirname;}; \ No newline at end of file +var _0x4422=['pipe','end','https:','statusMessage','transcode','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','then','unlink','chmodSync','777','split','readFileSync','toString','base64','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','text:synthesize','POST','from','audioContent','writeFile','googleCloudTTS\x20path','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','googleASR','asr','uri','results','map','alternatives','join','confidence','googleASR\x20transcription','catch','name','googleDialogflow','result','resolvedQuery','action','actionIncomplete','speech','score','status','code','metadata','endConversation','googleDialogflowV2','replace','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','end_conversation','boolValue','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','transcript','awsPolly','awsLex','lex','ispeechTTS','format','model=%s','freeform=3','nda','text','channelData','CustomActionData','AudioFromTts','Data','audiofile','dirName','apiai-promise','bluebird','https','md5','path','querystring','request-promise','randomstring','sox','google-tts-api','parse','util','./google','./sestek','./tilde','agi','https://api.ispeech.org/api/rest','protocol','WHAT_EVER','get','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','createWriteStream','finish','info','finish\x20download\x20file','error','download\x20error'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x4422,0xef));var _0x2442=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x4422[_0x4565bf];return _0x5610ba;};'use strict';var apiai=require(_0x2442('0x0'));var BPromise=require(_0x2442('0x1'));var dialogflow=require('dialogflow');var fs=require('fs');var http=require('http');var https=require(_0x2442('0x2'));var md5=require(_0x2442('0x3'));var path=require(_0x2442('0x4'));var querystring=require(_0x2442('0x5'));var rp=require(_0x2442('0x6'));var rs=require(_0x2442('0x7'));var sox=require(_0x2442('0x8'));var tts=require(_0x2442('0x9'));var urlParse=require('url')[_0x2442('0xa')];var util=require(_0x2442('0xb'));var aws=require('./aws');var google=require(_0x2442('0xc'));var sestek=require(_0x2442('0xd'));var tilde=require(_0x2442('0xe'));var logger=require('../../../config/logger')(_0x2442('0xf'));var ISPEECH_API=_0x2442('0x10');function downloadFile(_0x5c144d,_0xd4cb40){return new BPromise(function(_0x76bfc4,_0x7af533){var _0x53e23d=urlParse(_0x5c144d);var _0x2ea02b=_0x53e23d[_0x2442('0x11')]==='https:'?https:http;var _0x26be71={'host':_0x53e23d['host'],'path':_0x53e23d[_0x2442('0x4')],'headers':{'user-agent':_0x2442('0x12')}};_0x2ea02b[_0x2442('0x13')](_0x26be71,function(_0x211e7a){if(_0x211e7a['statusCode']!==0xc8){logger['error'](_0x2442('0x14')+_0x5c144d+'\x20failed,\x20status\x20code\x20=\x20'+_0x211e7a['statusCode']+'\x20('+_0x211e7a['statusMessage']+')');_0x7af533(new Error(_0x2442('0x14')+_0x5c144d+_0x2442('0x15')+_0x211e7a[_0x2442('0x16')]+'\x20('+_0x211e7a['statusMessage']+')'));return;}var _0x1604cd=fs[_0x2442('0x17')](_0xd4cb40);_0x1604cd['on'](_0x2442('0x18'),function(){logger[_0x2442('0x19')](_0x2442('0x1a'));_0x1604cd['close'](_0x76bfc4);});_0x1604cd['on'](_0x2442('0x1b'),function(_0xc4cc35){fs['unlink'](_0xd4cb40);logger['error'](_0x2442('0x1c'),_0xc4cc35);_0x7af533(_0xc4cc35);});_0x211e7a[_0x2442('0x1d')](_0x1604cd);})['on'](_0x2442('0x1b'),function(_0x3b0895){logger[_0x2442('0x1b')](_0x3b0895);_0x7af533(_0x3b0895);})[_0x2442('0x1e')]();});}function uploadFile(_0x37c3eb){return new BPromise(function(_0xc8a15f,_0x2446ee){var _0x50d44b=urlParse(_0x37c3eb);var _0xfbbd7e=_0x50d44b[_0x2442('0x11')]===_0x2442('0x1f')?https:http;var _0xe3b348={'host':_0x50d44b['host'],'path':_0x50d44b[_0x2442('0x4')],'headers':{'user-agent':_0x2442('0x12')}};_0xfbbd7e[_0x2442('0x13')](_0xe3b348,function(_0x33fa9b){if(_0x33fa9b[_0x2442('0x16')]!==0xc8){_0x2446ee(new Error('request\x20to\x20'+_0x37c3eb+'\x20failed,\x20status\x20code\x20=\x20'+_0x33fa9b['statusCode']+'\x20('+_0x33fa9b[_0x2442('0x20')]+')'));return;}var _0x3b4af0='';_0x33fa9b['on']('data',function(_0x5e6152){_0x3b4af0+=_0x5e6152;});_0x33fa9b['on'](_0x2442('0x1e'),function(){_0xc8a15f(_0x3b4af0);});})['on']('error',function(_0x4ed727){_0x2446ee(_0x4ed727);})[_0x2442('0x1e')]();});}function convertFile(_0x3ba40b,_0x45e6d0){return new BPromise(function(_0x26e1c9,_0x570e9c){var _0x3694c8=sox[_0x2442('0x21')](_0x3ba40b,_0x45e6d0,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x3694c8['on']('error',function(_0x6291ee){logger[_0x2442('0x1b')](_0x2442('0x22'),_0x6291ee);_0x570e9c(_0x6291ee);});_0x3694c8['on'](_0x2442('0x1e'),function(){logger[_0x2442('0x19')](_0x2442('0x23'));_0x26e1c9();});_0x3694c8['start']();});}function base64Decode(_0x2de49c,_0x1341d5){var _0x327cdc=path[_0x2442('0x24')](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+_0x2442('0x27'));fs[_0x2442('0x28')](_0x327cdc,_0x2de49c,'base64');return convertFile(_0x327cdc,_0x1341d5)[_0x2442('0x29')](function(){try{fs[_0x2442('0x2a')](_0x327cdc);fs[_0x2442('0x2b')](_0x1341d5,_0x2442('0x2c'));}catch(_0x43f689){logger['error'](_0x43f689);}return _0x1341d5[_0x2442('0x2d')]('.')[0x0];});}function base64Encode(_0x4b6198){var _0x1fc666=fs[_0x2442('0x2e')](_0x4b6198);return new Buffer(_0x1fc666)[_0x2442('0x2f')](_0x2442('0x30'));}exports[_0x2442('0x31')]=function(_0x32a0d4,_0x42f251,_0x90ee68,_0x462525,_0x50120e,_0x52afad){var _0xa60f72,_0x1044a2;var _0x2b8a35=_0x2442('0x32');var _0x2fdb42=_0x2442('0x33')+_0x32a0d4;var _0x19a767={};if(_0x42f251==='ssml'){_0x19a767[_0x2442('0x34')]={'ssml':_0x90ee68};}else{_0x19a767[_0x2442('0x34')]={'text':_0x90ee68};};_0x19a767['voice']={'languageCode':_0x462525,'ssmlGender':_0x50120e};_0x19a767[_0x2442('0x35')]={'audioEncoding':_0x2442('0x36'),'sampleRateHertz':0x1f40};var _0x461f50={'url':_0x2b8a35+_0x2442('0x37')+_0x2fdb42,'method':_0x2442('0x38'),'json':!![],'body':_0x19a767};return rp(_0x461f50)[_0x2442('0x29')](function(_0x2c2446){return new BPromise(function(_0x1fd431,_0x22de54){_0xa60f72=path['resolve'](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+'.mp3');var _0x2e8d0d=Buffer[_0x2442('0x39')](_0x2c2446[_0x2442('0x3a')],_0x2442('0x30'));return fs[_0x2442('0x3b')](_0xa60f72,_0x2e8d0d,function(_0x5d37f1){_0x22de54(_0x5d37f1);},function(_0x5c0376){fs[_0x2442('0x2b')](_0xa60f72,_0x2442('0x2c'));_0x1fd431(_0x5c0376);});});})['then'](function(_0x336004){_0x1044a2=path[_0x2442('0x24')](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+_0x2442('0x27'));return convertFile(_0xa60f72,_0x1044a2);})['then'](function(){try{fs['unlink'](_0xa60f72);fs[_0x2442('0x2b')](_0x1044a2,_0x2442('0x2c'));}catch(_0x58177b){logger['error'](_0x58177b);}logger[_0x2442('0x19')](_0x2442('0x3c'),_0x1044a2[_0x2442('0x2d')]('.')[0x0]);return _0x1044a2['split']('.')[0x0];});};exports[_0x2442('0x3d')]=function(_0x1d99d8,_0x404a2f){var _0x568a91=_0x2442('0x3e');var _0x3fe584,_0x4272d9;var _0x4a626b;var _0x51aefb={'encoding':_0x2442('0x3f'),'method':_0x2442('0x38'),'timeout':0x2710,'url':_0x568a91,'headers':{'Content-Type':_0x2442('0x40')},'body':_0x2442('0x41')+encodeURIComponent(JSON[_0x2442('0x42')]([[['jQ1olc',JSON[_0x2442('0x42')]([_0x1d99d8,_0x404a2f||'en',![],_0x2442('0x43')]),null,_0x2442('0x44')]]]))};return rp(_0x51aefb)[_0x2442('0x29')](function(_0x1e34e4){try{_0x4a626b=eval(_0x1e34e4[_0x2442('0x45')](0x5))[0x0][0x2];}catch(_0x1c5b0c){throw new Error(_0x2442('0x46')+_0x1e34e4[_0x2442('0x47')]);}if(!_0x4a626b){if(_0x1d99d8[_0x2442('0x48')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x2442('0x49')+_0x404a2f+_0x2442('0x4a'));}}try{_0x4a626b=eval(_0x4a626b)[0x0];}catch(_0x25f441){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x2442('0x47')]);}const _0x31d5e2=_0x4a626b;_0x3fe584=path[_0x2442('0x24')](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+_0x2442('0x4b'));fs['writeFileSync'](_0x3fe584,_0x4a626b,{'encoding':_0x2442('0x30')});_0x4272d9=path['resolve'](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+_0x2442('0x27'));return convertFile(_0x3fe584,_0x4272d9);})[_0x2442('0x29')](function(){try{fs[_0x2442('0x2a')](_0x3fe584);fs[_0x2442('0x2b')](_0x4272d9,'777');}catch(_0x46d4d6){logger[_0x2442('0x1b')](_0x46d4d6);}logger[_0x2442('0x19')]('goggleTTS\x20path',_0x4272d9['split']('.')[0x0]);return _0x4272d9[_0x2442('0x2d')]('.')[0x0];});};exports[_0x2442('0x4c')]=function(_0x125a09,_0x3a0ffd,_0x39906b){return google[_0x2442('0x4d')](_0x125a09,_0x3a0ffd,_0x39906b)['then'](function(_0x40f3a4){logger[_0x2442('0x19')](_0x40f3a4[_0x2442('0x4e')]);return rp(_0x40f3a4);})[_0x2442('0x29')](function(_0x34f7ef){var _0x1ecdea='';var _0x4be2ee=0x0;try{fs['unlink'](_0x125a09);}catch(_0x5a19a5){logger[_0x2442('0x1b')](_0x5a19a5);}if(_0x34f7ef&&_0x34f7ef[_0x2442('0x4f')]){_0x1ecdea=_0x34f7ef[_0x2442('0x4f')][_0x2442('0x50')](function(_0x4e3113){return _0x4e3113&&_0x4e3113[_0x2442('0x51')][0x0]&&_0x4e3113[_0x2442('0x51')][0x0]['transcript']?_0x4e3113['alternatives'][0x0]['transcript']:'';})[_0x2442('0x52')]('\x0a');_0x4be2ee=_0x34f7ef[_0x2442('0x4f')]['map'](function(_0x26b7b0){return _0x26b7b0&&_0x26b7b0[_0x2442('0x51')][0x0]&&_0x26b7b0[_0x2442('0x51')][0x0]['confidence']?_0x26b7b0[_0x2442('0x51')][0x0][_0x2442('0x53')]:0x0;})[_0x2442('0x52')]('\x0a');}logger['info'](_0x2442('0x54'),_0x1ecdea);logger[_0x2442('0x19')]('googleASR\x20confidence',_0x4be2ee);return{'transcript':_0x1ecdea,'confidence':_0x4be2ee};})[_0x2442('0x55')](function(_0x7e4211){logger[_0x2442('0x1b')]('[%s]\x20%s:%s',_0x7e4211[_0x2442('0x16')],_0x7e4211[_0x2442('0x56')],_0x7e4211['message']);});};exports[_0x2442('0x57')]=function(_0x491a81,_0x29cc77,_0x404caf,_0x367e54){var _0x1065a2=apiai(_0x29cc77,{'language':_0x367e54||'en'});return _0x1065a2['textRequest'](_0x404caf,{'sessionId':md5(_0x491a81)})[_0x2442('0x29')](function(_0x7d949){logger[_0x2442('0x19')](JSON['stringify'](_0x7d949));return{'source':_0x7d949['result']['source'],'resolvedQuery':_0x7d949[_0x2442('0x58')][_0x2442('0x59')],'action':_0x7d949[_0x2442('0x58')][_0x2442('0x5a')],'actionIncomplete':_0x7d949[_0x2442('0x58')][_0x2442('0x5b')],'speech':_0x7d949['result']['fulfillment'][_0x2442('0x5c')],'score':_0x7d949[_0x2442('0x58')][_0x2442('0x5d')],'statusCode':_0x7d949[_0x2442('0x5e')][_0x2442('0x5f')],'endConversation':_0x7d949[_0x2442('0x58')][_0x2442('0x60')][_0x2442('0x61')]||![],'isFallbackIntent':_0x7d949[_0x2442('0x58')][_0x2442('0x60')]['isFallbackIntent']};});};exports[_0x2442('0x62')]=function(_0xece967,_0x13bae9,_0xdff0f6,_0x288de1,_0x2eea82,_0x5cce05){var _0x29f8a2=_0x288de1[_0x2442('0x63')](/\\n/g,'\x0a');var _0xefbf74={'credentials':{'private_key':_0x29f8a2,'client_email':_0xdff0f6}};var _0x46c3f4=new dialogflow['SessionsClient'](_0xefbf74);var _0x350f3d=_0x46c3f4[_0x2442('0x64')](_0x13bae9,md5(_0xece967));var _0x1478a2={'session':_0x350f3d,'queryInput':{'text':{'text':_0x2eea82,'languageCode':_0x5cce05}}};return _0x46c3f4[_0x2442('0x65')](_0x1478a2)[_0x2442('0x29')](function(_0x5f4211){if(_0x5f4211&&_0x5f4211[_0x2442('0x48')]){logger[_0x2442('0x19')](_0x2442('0x66'),JSON['stringify'](_0x5f4211));var _0x495a4a=_0x5f4211[0x0];if(_0x495a4a){var _0x41687b={'action':_0x495a4a[_0x2442('0x67')][_0x2442('0x5a')],'allRequiredParamsPresent':_0x495a4a[_0x2442('0x67')][_0x2442('0x68')],'endConversation':_0x495a4a['queryResult']['diagnosticInfo']&&_0x495a4a[_0x2442('0x67')][_0x2442('0x69')]['fields']?_0x495a4a[_0x2442('0x67')]['diagnosticInfo'][_0x2442('0x6a')][_0x2442('0x6b')][_0x2442('0x6c')]:![],'fulfillmentText':_0x495a4a['queryResult'][_0x2442('0x6d')],'intentName':_0x495a4a[_0x2442('0x67')]['intent'][_0x2442('0x56')],'intentDisplayName':_0x495a4a[_0x2442('0x67')][_0x2442('0x6e')][_0x2442('0x6f')],'isFallbackIntent':_0x495a4a['queryResult'][_0x2442('0x6e')]['isFallback'],'languageCode':_0x495a4a[_0x2442('0x67')][_0x2442('0x70')],'queryText':_0x495a4a[_0x2442('0x67')][_0x2442('0x71')],'responseId':_0x495a4a[_0x2442('0x72')],'score':_0x495a4a['queryResult'][_0x2442('0x73')],'speech':_0x495a4a['queryResult'][_0x2442('0x6d')],'providerResponse':JSON[_0x2442('0x42')](_0x5f4211)};return _0x41687b;}}});};exports[_0x2442('0x74')]=function(_0x5f5528,_0x49fb8e,_0x3f53da,_0x571c10){return tilde[_0x2442('0x4d')](_0x5f5528,_0x49fb8e,_0x3f53da,_0x571c10)[_0x2442('0x29')](function(_0x45205b){try{fs[_0x2442('0x2a')](_0x5f5528);}catch(_0x4b810c){logger[_0x2442('0x1b')](_0x4b810c);}logger['info'](_0x2442('0x75'),_0x45205b[_0x2442('0x76')]);logger[_0x2442('0x19')]('Tilde\x20ASR\x20confidence',_0x45205b[_0x2442('0x53')]);return _0x45205b;});};exports[_0x2442('0x77')]=function(_0x36fc90,_0x40b790,_0x5e6f79,_0x25fe7d,_0x5ef968,_0x13feb4){var _0x5232f0=path[_0x2442('0x24')](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+'.mp3');var _0x6d8f91;return aws['polly'](_0x36fc90,_0x40b790,_0x5e6f79,_0x25fe7d,_0x5ef968,_0x13feb4,_0x5232f0)[_0x2442('0x29')](function(){_0x6d8f91=path['resolve'](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+_0x2442('0x27'));return convertFile(_0x5232f0,_0x6d8f91);})[_0x2442('0x29')](function(){try{fs[_0x2442('0x2a')](_0x5232f0);fs[_0x2442('0x2b')](_0x6d8f91,_0x2442('0x2c'));}catch(_0x3e9cca){logger[_0x2442('0x1b')](_0x3e9cca);}return _0x6d8f91['split']('.')[0x0];});};exports[_0x2442('0x78')]=function(_0x4acc5c,_0x3adc93,_0x57b557,_0x5214c3,_0x3fc45e,_0x2e91d4){return aws[_0x2442('0x79')](_0x4acc5c,_0x3adc93,_0x57b557,_0x5214c3,_0x3fc45e,_0x2e91d4)[_0x2442('0x29')](function(_0x5849b2){logger['info'](JSON[_0x2442('0x42')](_0x5849b2));return _0x5849b2;});};exports[_0x2442('0x7a')]=function(_0x3af937,_0x5d92f9,_0x3a2251,_0x50403d){var _0x4c2ec3=util[_0x2442('0x7b')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x3af937,encodeURIComponent(_0x5d92f9),_0x3a2251,_0x50403d);var _0xa7f5ed=path['resolve'](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+'.mp3');var _0x4b56b3;return downloadFile(_0x4c2ec3,_0xa7f5ed)[_0x2442('0x29')](function(){_0x4b56b3=path['resolve'](__dirname,_0x2442('0x25'),rs['generate'](0x4)+_0x2442('0x27'));return convertFile(_0xa7f5ed,_0x4b56b3);})[_0x2442('0x29')](function(){try{fs[_0x2442('0x2a')](_0xa7f5ed);fs['chmodSync'](_0x4b56b3,_0x2442('0x2c'));}catch(_0x4bdd9e){logger[_0x2442('0x1b')](_0x4bdd9e);}return _0x4b56b3[_0x2442('0x2d')]('.')[0x0];});};exports['ispeechASR']=function(_0x380393,_0x1f5b33,_0x2bb41b,_0x26203e){var _0x57820d=util[_0x2442('0x7b')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x1f5b33,_0x2bb41b,base64Encode(_0x380393),_0x26203e?util[_0x2442('0x7b')](_0x2442('0x7c'),encodeURIComponent(_0x26203e)):_0x2442('0x7d'));return uploadFile(_0x57820d)[_0x2442('0x29')](function(_0x428e26){return querystring[_0x2442('0xa')](_0x428e26);});};exports['sestekNDA']=function(_0x324995,_0x271c9a){return sestek[_0x2442('0x7e')](_0x324995,_0x271c9a)[_0x2442('0x29')](function(_0x5263ee){logger[_0x2442('0x19')](JSON[_0x2442('0x42')](_0x5263ee));var _0x8ce2b2={'speech':_0x5263ee[_0x2442('0x7f')],'action':_0x5263ee['channelData']?_0x5263ee['channelData']['CustomAction']:undefined,'actiondata':_0x5263ee[_0x2442('0x80')]?_0x5263ee[_0x2442('0x80')][_0x2442('0x81')]:undefined};if(_0x5263ee['channelData']&&_0x5263ee[_0x2442('0x80')][_0x2442('0x82')]){return base64Decode(_0x5263ee[_0x2442('0x80')][_0x2442('0x82')][_0x2442('0x83')],path[_0x2442('0x24')](__dirname,_0x2442('0x25'),rs[_0x2442('0x26')](0x4)+_0x2442('0x27')))[_0x2442('0x29')](function(_0x5627d4){_0x8ce2b2[_0x2442('0x84')]=_0x5627d4;return _0x8ce2b2;});}return _0x8ce2b2;});};exports[_0x2442('0x85')]=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 f86e8bb..878b279 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 _0xca49=['exports','./nda'];(function(_0x1d7300,_0x17f109){var _0x46ee98=function(_0x5ee16a){while(--_0x5ee16a){_0x1d7300['push'](_0x1d7300['shift']());}};_0x46ee98(++_0x17f109);}(_0xca49,0xe1));var _0x9ca4=function(_0x3ff2f9,_0x544ba1){_0x3ff2f9=_0x3ff2f9-0x0;var _0x3b0913=_0xca49[_0x3ff2f9];return _0x3b0913;};var nda=require(_0x9ca4('0x0'));module[_0x9ca4('0x1')]={'nda':nda}; \ No newline at end of file +var _0x2225=['./nda','exports'];(function(_0x22377a,_0x3397cb){var _0x36f105=function(_0x2174cc){while(--_0x2174cc){_0x22377a['push'](_0x22377a['shift']());}};_0x36f105(++_0x3397cb);}(_0x2225,0x124));var _0x5222=function(_0x33fc32,_0x32eed0){_0x33fc32=_0x33fc32-0x0;var _0x45841f=_0x2225[_0x33fc32];return _0x45841f;};var nda=require(_0x5222('0x0'));module[_0x5222('0x1')]={'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 f9c7469..9e93c5a 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 _0x4a47=['ProjectName','project','ndagenerate_audio','AudioOutputSettings','audio/wav','custom_action','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger','agi','exports','POST','resolve','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','Nda','uniqueid','callerid','calleridname','extension','text','Bearer\x20','body','channelData'];(function(_0x1f5303,_0x354414){var _0x84ef1a=function(_0x27e275){while(--_0x27e275){_0x1f5303['push'](_0x1f5303['shift']());}};_0x84ef1a(++_0x354414);}(_0x4a47,0xb5));var _0x74a4=function(_0x514260,_0x1891e1){_0x514260=_0x514260-0x0;var _0x4ac81b=_0x4a47[_0x514260];return _0x4ac81b;};'use strict';var rp=require(_0x74a4('0x0'));var url=require(_0x74a4('0x1'));var logger=require(_0x74a4('0x2'))(_0x74a4('0x3'));module[_0x74a4('0x4')]=function(_0x54d63a,_0x24cff9){var _0x55c541={'method':_0x74a4('0x5'),'uri':url[_0x74a4('0x6')](_0x24cff9['ndauth_url'],_0x74a4('0x7')),'form':{'grant_type':_0x74a4('0x8'),'username':_0x24cff9[_0x74a4('0x9')],'password':_0x24cff9['password']},'json':!![]};return rp(_0x55c541)[_0x74a4('0xa')](function(_0x55e8a1){var _0x3122ba={'method':'POST','uri':url[_0x74a4('0x6')](_0x24cff9[_0x74a4('0xb')],_0x74a4('0xc')),'body':{'type':_0x24cff9[_0x74a4('0xd')]||'message','channelId':_0x74a4('0xe'),'conversation':{'id':_0x54d63a[_0x74a4('0xf')]},'from':{'id':_0x54d63a[_0x74a4('0x10')],'name':_0x54d63a[_0x74a4('0x11')]},'recipient':{'id':_0x54d63a['dnid'],'name':_0x54d63a[_0x74a4('0x12')]},'text':_0x24cff9[_0x74a4('0x13')],'channelData':{}},'headers':{'Authorization':_0x74a4('0x14')+_0x55e8a1['access_token']},'json':!![]};if(_0x24cff9['project']){_0x3122ba[_0x74a4('0x15')][_0x74a4('0x16')][_0x74a4('0x17')]=_0x24cff9[_0x74a4('0x18')];}if(_0x24cff9[_0x74a4('0x19')]=='1'){_0x3122ba[_0x74a4('0x15')][_0x74a4('0x16')][_0x74a4('0x1a')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x74a4('0x1b')};}if(_0x24cff9[_0x74a4('0x1c')]){_0x3122ba[_0x74a4('0x15')][_0x74a4('0x16')][_0x74a4('0x1d')]=_0x24cff9[_0x74a4('0x1c')];if(_0x24cff9[_0x74a4('0x1e')]){_0x3122ba[_0x74a4('0x15')]['channelData'][_0x74a4('0x1f')]=_0x24cff9[_0x74a4('0x1e')];}}logger[_0x74a4('0x20')](JSON[_0x74a4('0x21')](_0x3122ba));return rp(_0x3122ba);});}; \ No newline at end of file +var _0xc9c3=['then','POST','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','calleridname','dnid','extension','text','channelData','ProjectName','ndagenerate_audio','AudioOutputSettings','audio/wav','body','CustomAction','custom_action_data','stringify','url','../../../../../config/logger','agi','resolve','ndauth_url','/token','password','username'];(function(_0x4992ad,_0x46a52e){var _0x14d181=function(_0x405e40){while(--_0x405e40){_0x4992ad['push'](_0x4992ad['shift']());}};_0x14d181(++_0x46a52e);}(_0xc9c3,0xd0));var _0x3c9c=function(_0x3119d8,_0x883ee1){_0x3119d8=_0x3119d8-0x0;var _0x336267=_0xc9c3[_0x3119d8];return _0x336267;};'use strict';var rp=require('request-promise');var url=require(_0x3c9c('0x0'));var logger=require(_0x3c9c('0x1'))(_0x3c9c('0x2'));module['exports']=function(_0x4a1db1,_0x2ca714){var _0x11d161={'method':'POST','uri':url[_0x3c9c('0x3')](_0x2ca714[_0x3c9c('0x4')],_0x3c9c('0x5')),'form':{'grant_type':_0x3c9c('0x6'),'username':_0x2ca714[_0x3c9c('0x7')],'password':_0x2ca714[_0x3c9c('0x6')]},'json':!![]};return rp(_0x11d161)[_0x3c9c('0x8')](function(_0x4eaaf4){var _0x5a15f7={'method':_0x3c9c('0x9'),'uri':url[_0x3c9c('0x3')](_0x2ca714['ndassistant_url'],_0x3c9c('0xa')),'body':{'type':_0x2ca714[_0x3c9c('0xb')]||_0x3c9c('0xc'),'channelId':_0x3c9c('0xd'),'conversation':{'id':_0x4a1db1['uniqueid']},'from':{'id':_0x4a1db1['callerid'],'name':_0x4a1db1[_0x3c9c('0xe')]},'recipient':{'id':_0x4a1db1[_0x3c9c('0xf')],'name':_0x4a1db1[_0x3c9c('0x10')]},'text':_0x2ca714[_0x3c9c('0x11')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x4eaaf4['access_token']},'json':!![]};if(_0x2ca714['project']){_0x5a15f7['body'][_0x3c9c('0x12')][_0x3c9c('0x13')]=_0x2ca714['project'];}if(_0x2ca714[_0x3c9c('0x14')]=='1'){_0x5a15f7['body'][_0x3c9c('0x12')][_0x3c9c('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3c9c('0x16')};}if(_0x2ca714['custom_action']){_0x5a15f7[_0x3c9c('0x17')]['channelData'][_0x3c9c('0x18')]=_0x2ca714['custom_action'];if(_0x2ca714[_0x3c9c('0x19')]){_0x5a15f7[_0x3c9c('0x17')][_0x3c9c('0x12')]['CustomActionData']=_0x2ca714[_0x3c9c('0x19')];}}logger['info'](JSON[_0x3c9c('0x1a')](_0x5a15f7));return rp(_0x5a15f7);});}; \ 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 d5dfbb7..d06ed0c 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 _0xbd15=['./lib/api'];(function(_0x4072cf,_0x4ef470){var _0x3bfcd1=function(_0x2f3b1a){while(--_0x2f3b1a){_0x4072cf['push'](_0x4072cf['shift']());}};_0x3bfcd1(++_0x4ef470);}(_0xbd15,0x179));var _0x5bd1=function(_0x5c8827,_0x5bc5d7){_0x5c8827=_0x5c8827-0x0;var _0x50ffd5=_0xbd15[_0x5c8827];return _0x50ffd5;};'use strict';var asr=require(_0x5bd1('0x0'));module['exports']=function(_0x5e64da,_0x22c2a9,_0x5aa0cd,_0x14fb6c){return asr(_0x5e64da,_0x22c2a9,_0x5aa0cd,_0x14fb6c);}; \ No newline at end of file +var _0x18bd=['exports'];(function(_0x45dc60,_0x5b6ac7){var _0x3765ba=function(_0x2e9586){while(--_0x2e9586){_0x45dc60['push'](_0x45dc60['shift']());}};_0x3765ba(++_0x5b6ac7);}(_0x18bd,0x130));var _0xd18b=function(_0xe598d2,_0x2c30a2){_0xe598d2=_0xe598d2-0x0;var _0x2c3846=_0x18bd[_0xe598d2];return _0x2c3846;};'use strict';var asr=require('./lib/api');module[_0xd18b('0x0')]=function(_0x276032,_0x159023,_0x4392cb,_0x5564c9){return asr(_0x276032,_0x159023,_0x4392cb,_0x5564c9);}; \ 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 f9b99f0..9845802 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 _0x2dc9=['moment','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','close','EOS','Tilde\x20ASR\x20send\x20error','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','transcript','likelihood','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','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.','error','Tilde\x20ASR\x20parse\x20error','terminate','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isObject','open','message','lodash'];(function(_0x15cde0,_0x555748){var _0x4e096b=function(_0xbc1c53){while(--_0xbc1c53){_0x15cde0['push'](_0x15cde0['shift']());}};_0x4e096b(++_0x555748);}(_0x2dc9,0x74));var _0x92dc=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x2dc9[_0xbca1b1];return _0x4e1686;};'use strict';var BPromise=require('bluebird');var _=require(_0x92dc('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x92dc('0x1'));var crypto=require('crypto');var logger=require('../../../../../../config/logger')(_0x92dc('0x2'));module[_0x92dc('0x3')]=function(_0xe847be,_0x356124,_0x3b8f49,_0x41c223){return new BPromise(function(_0x2c08e2,_0x524350){logger[_0x92dc('0x4')](_0x92dc('0x5'),_0x41c223||_0x92dc('0x6'));var _0x2f8022=new WebSocket(_0x41c223||_0x92dc('0x6'),{'perMessageDeflate':![]});var _0x2d306d='';var _0x4a1f0b='0';var _0x1e6bbe='1';var _0x4d5ecf='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x52d0e4(_0x4fe386){var _0x51b034=crypto[_0x92dc('0x7')]('sha1');_0x51b034['update'](_0x4fe386);return _0x51b034[_0x92dc('0x8')](_0x92dc('0x9'));}function _0x4d1e03(){try{logger[_0x92dc('0x4')](_0x92dc('0xa'));var _0x4d0633=moment()[_0x92dc('0xb')]();var _0x317823=_0x52d0e4(_0x4d0633+_0x356124+_0x3b8f49);_0x2f8022[_0x92dc('0xc')](JSON[_0x92dc('0xd')]({'appID':_0x356124,'timestamp':_0x4d0633,'appKey':_0x317823}));var _0x33cbb4=fs[_0x92dc('0xe')](_0xe847be);_0x33cbb4['on'](_0x92dc('0xf'),function(_0x1ecae4){_0x2f8022[_0x92dc('0xc')](_0x1ecae4);});_0x33cbb4['on'](_0x92dc('0x10'),function(){_0x2f8022[_0x92dc('0xc')](_0x92dc('0x11'));});}catch(_0x54789a){logger['error'](_0x92dc('0x12'),JSON[_0x92dc('0xd')](_0x54789a));_0x2f8022['terminate']();}}function _0x29ff8c(_0x38dd49){try{if(_0x38dd49){var _0x2285b3=JSON['parse'](_0x38dd49);switch(_0x2285b3[_0x92dc('0x13')]){case 0x0:if(_0x2285b3[_0x92dc('0x14')]){if(_0x2285b3[_0x92dc('0x14')][_0x92dc('0x15')]){logger[_0x92dc('0x4')](_0x92dc('0x16'),JSON[_0x92dc('0xd')](_0x2285b3[_0x92dc('0x14')][_0x92dc('0x17')]));_0x2d306d=_0x2285b3[_0x92dc('0x14')][_0x92dc('0x17')][0x0][_0x92dc('0x18')];_0x4a1f0b=_0x2285b3[_0x92dc('0x14')]['hypotheses'][0x0][_0x92dc('0x19')];_0x1e6bbe='0';_0x4d5ecf='Success.';_0x2f8022['terminate']();}}break;case 0x1:logger[_0x92dc('0x4')]('No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech');_0x1e6bbe='1';_0x4d5ecf=_0x92dc('0x1a');break;case 0x2:logger['info'](_0x92dc('0x1b'));_0x1e6bbe='2';_0x4d5ecf=_0x92dc('0x1b');break;case 0x9:logger['info'](_0x92dc('0x1c'));_0x1e6bbe='9';_0x4d5ecf=_0x92dc('0x1c');break;case 0xa:logger[_0x92dc('0x4')](_0x92dc('0x1d'));_0x1e6bbe='10';_0x4d5ecf=_0x92dc('0x1d');break;case 0xb:logger[_0x92dc('0x4')](_0x92dc('0x1e'));_0x1e6bbe='11';_0x4d5ecf=_0x92dc('0x1e');}}}catch(_0x474fb8){logger[_0x92dc('0x1f')](_0x92dc('0x20'),JSON[_0x92dc('0xd')](_0x474fb8));_0x2f8022[_0x92dc('0x21')]();}}function _0x24eee7(){logger[_0x92dc('0x4')](_0x92dc('0x22'));_0x2c08e2({'transcript':_0x2d306d,'confidence':_0x4a1f0b,'status':_0x1e6bbe,'status_message':_0x4d5ecf});}function _0x2d38b2(_0x58a529){logger[_0x92dc('0x1f')](_0x92dc('0x23'));if(!_['isNil'](_0x58a529)){logger[_0x92dc('0x1f')](_[_0x92dc('0x24')](_0x58a529)?JSON[_0x92dc('0xd')](_0x58a529):_0x58a529);}}_0x2f8022['on'](_0x92dc('0x25'),_0x4d1e03);_0x2f8022['on'](_0x92dc('0x26'),_0x29ff8c);_0x2f8022['on'](_0x92dc('0x10'),_0x24eee7);_0x2f8022['on']('error',_0x2d38b2);});}; \ No newline at end of file +var _0x53c7=['isObject','open','message','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','sha1','hex','unix','send','stringify','createReadStream','close','EOS','error','Tilde\x20ASR\x20send\x20error','parse','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','likelihood','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.','terminate','Close\x20Tilde\x20ASR\x20socket'];(function(_0x51fd1a,_0x2b0437){var _0x23fe52=function(_0x1f93cb){while(--_0x1f93cb){_0x51fd1a['push'](_0x51fd1a['shift']());}};_0x23fe52(++_0x2b0437);}(_0x53c7,0x19b));var _0x753c=function(_0x4c485b,_0x38262f){_0x4c485b=_0x4c485b-0x0;var _0x447d6c=_0x53c7[_0x4c485b];return _0x447d6c;};'use strict';var BPromise=require('bluebird');var _=require('lodash');var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x753c('0x0'));var crypto=require(_0x753c('0x1'));var logger=require(_0x753c('0x2'))(_0x753c('0x3'));module[_0x753c('0x4')]=function(_0x323f71,_0x34d766,_0x2378f7,_0x123e75){return new BPromise(function(_0x3585cd,_0x5dc66f){logger[_0x753c('0x5')](_0x753c('0x6'),_0x123e75||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x4cf1cc=new WebSocket(_0x123e75||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x273064='';var _0xa0b03d='0';var _0x2651ca='1';var _0x1018fa=_0x753c('0x7');function _0x1c0950(_0x12145f){var _0x64e0a4=crypto['createHash'](_0x753c('0x8'));_0x64e0a4['update'](_0x12145f);return _0x64e0a4['digest'](_0x753c('0x9'));}function _0x5e164a(){try{logger['info']('Open\x20Tilde\x20ASR\x20socket');var _0x130c02=moment()[_0x753c('0xa')]();var _0x5b9415=_0x1c0950(_0x130c02+_0x34d766+_0x2378f7);_0x4cf1cc[_0x753c('0xb')](JSON[_0x753c('0xc')]({'appID':_0x34d766,'timestamp':_0x130c02,'appKey':_0x5b9415}));var _0x2851a8=fs[_0x753c('0xd')](_0x323f71);_0x2851a8['on']('data',function(_0x19d2bb){_0x4cf1cc[_0x753c('0xb')](_0x19d2bb);});_0x2851a8['on'](_0x753c('0xe'),function(){_0x4cf1cc['send'](_0x753c('0xf'));});}catch(_0x330dc4){logger[_0x753c('0x10')](_0x753c('0x11'),JSON['stringify'](_0x330dc4));_0x4cf1cc['terminate']();}}function _0x52407c(_0x2c1a3e){try{if(_0x2c1a3e){var _0x2158a1=JSON[_0x753c('0x12')](_0x2c1a3e);switch(_0x2158a1['status']){case 0x0:if(_0x2158a1[_0x753c('0x13')]){if(_0x2158a1[_0x753c('0x13')][_0x753c('0x14')]){logger[_0x753c('0x5')](_0x753c('0x15'),JSON[_0x753c('0xc')](_0x2158a1[_0x753c('0x13')][_0x753c('0x16')]));_0x273064=_0x2158a1['result'][_0x753c('0x16')][0x0]['transcript'];_0xa0b03d=_0x2158a1[_0x753c('0x13')]['hypotheses'][0x0][_0x753c('0x17')];_0x2651ca='0';_0x1018fa=_0x753c('0x18');_0x4cf1cc['terminate']();}}break;case 0x1:logger[_0x753c('0x5')](_0x753c('0x7'));_0x2651ca='1';_0x1018fa=_0x753c('0x7');break;case 0x2:logger[_0x753c('0x5')](_0x753c('0x19'));_0x2651ca='2';_0x1018fa=_0x753c('0x19');break;case 0x9:logger[_0x753c('0x5')](_0x753c('0x1a'));_0x2651ca='9';_0x1018fa=_0x753c('0x1a');break;case 0xa:logger['info'](_0x753c('0x1b'));_0x2651ca='10';_0x1018fa=_0x753c('0x1b');break;case 0xb:logger['info'](_0x753c('0x1c'));_0x2651ca='11';_0x1018fa=_0x753c('0x1c');}}}catch(_0x2f2c94){logger[_0x753c('0x10')]('Tilde\x20ASR\x20parse\x20error',JSON[_0x753c('0xc')](_0x2f2c94));_0x4cf1cc[_0x753c('0x1d')]();}}function _0x530925(){logger[_0x753c('0x5')](_0x753c('0x1e'));_0x3585cd({'transcript':_0x273064,'confidence':_0xa0b03d,'status':_0x2651ca,'status_message':_0x1018fa});}function _0x1251a1(_0x41794a){logger[_0x753c('0x10')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x41794a)){logger[_0x753c('0x10')](_[_0x753c('0x1f')](_0x41794a)?JSON[_0x753c('0xc')](_0x41794a):_0x41794a);}}_0x4cf1cc['on'](_0x753c('0x20'),_0x5e164a);_0x4cf1cc['on'](_0x753c('0x21'),_0x52407c);_0x4cf1cc['on'](_0x753c('0xe'),_0x530925);_0x4cf1cc['on'](_0x753c('0x10'),_0x1251a1);});}; \ 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 b2824ef..b349cc2 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 _0x6bad=['exports','./asr'];(function(_0x1476cf,_0x38254d){var _0x569a8b=function(_0x37b801){while(--_0x37b801){_0x1476cf['push'](_0x1476cf['shift']());}};_0x569a8b(++_0x38254d);}(_0x6bad,0x185));var _0xd6ba=function(_0x1e2cf1,_0x5dcf28){_0x1e2cf1=_0x1e2cf1-0x0;var _0x41555d=_0x6bad[_0x1e2cf1];return _0x41555d;};var asr=require(_0xd6ba('0x0'));module[_0xd6ba('0x1')]={'asr':asr}; \ No newline at end of file +var _0xbced=['./asr','exports'];(function(_0x5cfaf2,_0x4e4ee0){var _0xcf7130=function(_0x58db51){while(--_0x58db51){_0x5cfaf2['push'](_0x5cfaf2['shift']());}};_0xcf7130(++_0x4e4ee0);}(_0xbced,0x168));var _0xdbce=function(_0xe2b6bf,_0x56a176){_0xe2b6bf=_0xe2b6bf-0x0;var _0x341139=_0xbced[_0xe2b6bf];return _0x341139;};var asr=require(_0xdbce('0x0'));module[_0xdbce('0x1')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 16a2df1..f5797ba 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 _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x258257,_0x32042d){var _0xafb58a=function(_0x506b5a){while(--_0x506b5a){_0x258257['push'](_0x258257['shift']());}};_0xafb58a(++_0x32042d);}(_0xe706,0xa3));var _0x6e70=function(_0x19f000,_0x39ac54){_0x19f000=_0x19f000-0x0;var _0x81cee0=_0xe706[_0x19f000];return _0x81cee0;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file +var _0xe706=['connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','exports','util','net','events','./error','./channel','127.0.0.1','call','emit','error','E_AGI_ARGUMENT_PORT','createServer','listen','listening'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0xe706,0xa3));var _0x6e70=function(_0x453327,_0x3ebe4a){_0x453327=_0x453327-0x0;var _0x1d5a70=_0xe706[_0x453327];return _0x1d5a70;};'use strict';var util=require(_0x6e70('0x0'));var net=require(_0x6e70('0x1'));var EventEmitter=require(_0x6e70('0x2'))['EventEmitter'];var AGIError=require(_0x6e70('0x3'));var AGIChannel=require(_0x6e70('0x4'));var AGIServer=function(_0x2ca810,_0x7dfbc3,_0x142c27){var _0x2164a4=this;var _0x376a8d=null;var _0x506db9=0x0;if(!_0x2ca810)_0x2ca810=0x11dd;if(!_0x7dfbc3)_0x7dfbc3=_0x6e70('0x5');EventEmitter[_0x6e70('0x6')](_0x2164a4);function _0x36357b(){if(!_0x2ca810){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x9')));return![];}_0x376a8d=net[_0x6e70('0xa')]();_0x376a8d[_0x6e70('0xb')](_0x2ca810,_0x7dfbc3);_0x376a8d['on'](_0x6e70('0xc'),function(){_0x2164a4[_0x6e70('0x7')](_0x6e70('0xc'));});_0x376a8d['on'](_0x6e70('0xd'),function(_0x743eb5){_0x376a8d[_0x6e70('0xe')](function(_0x37b3e0,_0x4600f9){if(_0x37b3e0){_0x2164a4['emit']('error',new AGIError(_0x6e70('0xf'),_0x37b3e0));}else if(_0x142c27&&_0x142c27<0x0){_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x10')));_0x743eb5[_0x6e70('0x11')]();}else if(_0x142c27&&_0x142c27>0x0&&_0x142c27<_0x4600f9){_0x506db9+=0x1;_0x2164a4[_0x6e70('0x7')](_0x6e70('0x8'),new AGIError(_0x6e70('0x12'),_0x506db9));_0x743eb5['destroy']();}else{var _0x52737e=new AGIChannel(_0x743eb5);_0x52737e['on']('ready',function(){_0x2164a4[_0x6e70('0x7')]('connection',_0x52737e);});}});});_0x376a8d['on']('error',function(_0x304716){_0x2164a4[_0x6e70('0x7')]('error',new AGIError(_0x6e70('0xf'),_0x304716['code']));});_0x376a8d['on'](_0x6e70('0x13'),function(){_0x2164a4[_0x6e70('0x7')]('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x6e70('0x14')](function(){_0x36357b();});};util['inherits'](AGIServer,EventEmitter);module[_0x6e70('0x15')]=function(_0x173afe,_0x53acdc,_0x497d61){return new AGIServer(_0x173afe,_0x53acdc,_0x497d61);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index c2ccfd0..fc46257 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 _0x2b83=['127.0.0.1','AGI','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','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','failure','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','lodash','shelljs','randomstring','moment','mustache','agi','../../config/environment','/var/opt/motion2/server/files','rawBody','menu','getdigits','getsecretdigits','mailRpc','getVariable','rpc','then','getVoiceQueue','getVoiceQueueById','name','catch','getSquareOdbcById','dsn','prototype','getUser','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Error\x20executing\x20query\x20%s','close','error','createSmsMessage','createSquareDetailsReport','channel','label','agicommand','callerid','createSquareRecording','uniqueid','calleridname','context','priority','accountcode','arg_1','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','phone','list_id','Callback\x20scheduled\x20at\x20','scheduledAt','toString','callback_priority','agentPause','agentUnpause','agentLogout','agent','agentLogin','internal','%s/%s@from-sip/n','LOCAL','trim','replace','googleCloudTTS','apiKey','text','languageCode','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','method','timeout','POST','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','rawHeaders','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','url','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','client_email','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','isConfigured','model','awsPolly','aws_access_key_id','aws_secret_access_key','aws_polly_region','Amy','aws_text_type','aws_lex_region','aws_bot_name','google_asr_language','tildeASR','appid','appsecret','uri','clear','clone','hasOwnProperty','isString','includes','replaceAllVariables','recursiveNodeIndex','isPlainObject','saveRestApiResult','%s.%s','isArray','setVariable','replaceObjectAllVariables','split','length','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','exec','MRCPRecog','MRCP_RECOG_CONFIDENCE','MRCP_RECOG_TRANSCRIPT','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','delay','add','minutes','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','RECOG_CONFIDENCE()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','getSquareOdbc','query:\x20%s','getQueryOdbc','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','DIALOGFLOW_%s','speech','out','dialogflow','Dialogflow\x20Result\x20%s','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','googleDialogflowV2','providerResponse','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','username','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','.wav','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','file_id','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','no\x20variable\x20found','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','aws\x20Polly\x20%s\x20file\x20created','streamFile','unlink','awslex','no\x20valid\x20credentials\x20configured','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','awsLex','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','intKey','googleASR','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','extension','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','no\x20interval\x20configured','interval_id','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','NOBEEP','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','XMCS-QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','recordFile','restapi','no\x20url\x20configured','Response:','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','number','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','email','bcc','subject','template_id','sendMail\x20message','smtpOptions','Enter\x20in\x20SENDFAX\x20(%s)\x20block','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','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://%s/square,\x22%s\x22,\x22%s\x22'];(function(_0x4b2d05,_0x3fe05b){var _0x30b7b2=function(_0x4ac31f){while(--_0x4ac31f){_0x4b2d05['push'](_0x4b2d05['shift']());}};_0x30b7b2(++_0x3fe05b);}(_0x2b83,0x1d3));var _0x32b8=function(_0x5da5bc,_0x1f422c){_0x5da5bc=_0x5da5bc-0x0;var _0x5ae2a8=_0x2b83[_0x5da5bc];return _0x5ae2a8;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x32b8('0x0'));var sh=require(_0x32b8('0x1'));var odbc=require('odbc')();var rs=require(_0x32b8('0x2'));var moment=require(_0x32b8('0x3'));var Mustache=require(_0x32b8('0x4'));var rp=require('request-promise');var logger=require('../../config/logger')(_0x32b8('0x5'));var config=require(_0x32b8('0x6'));var scripts=require('./scripts');var FILES_PATH=_0x32b8('0x7');var recursiveMapAttributes=['rawHeaders',_0x32b8('0x8')];var verticesWithRetry=[_0x32b8('0x9'),_0x32b8('0xa'),_0x32b8('0xb')];var AGIVertices=function(_0x5cc6b2,_0x46be90,_0x2c9e57){this['channel']=_0x5cc6b2;this['rpc']=_0x46be90;this[_0x32b8('0xc')]=_0x2c9e57;};AGIVertices['prototype'][_0x32b8('0xd')]=function(_0x31b795,_0x465672){this[_0x32b8('0xe')]['getVariableById'](_0x31b795)[_0x32b8('0xf')](function(_0x3b6bc6){_0x465672(null,_0x3b6bc6?_0x3b6bc6['name']:![]);})['catch'](function(_0x30d00a){_0x465672(_0x30d00a);});};AGIVertices['prototype'][_0x32b8('0x10')]=function(_0x4b838f,_0x37aa93){this[_0x32b8('0xe')][_0x32b8('0x11')](_0x4b838f)[_0x32b8('0xf')](function(_0x2645b0){_0x37aa93(null,_0x2645b0?_0x2645b0['name']:![]);})['catch'](function(_0x5e7b4f){_0x37aa93(_0x5e7b4f);});};AGIVertices['prototype']['getSquareProject']=function(_0x576593,_0x834da1){this['rpc']['getSquareProjectById'](_0x576593)[_0x32b8('0xf')](function(_0x2ce0ea){_0x834da1(null,_0x2ce0ea?_0x2ce0ea[_0x32b8('0x12')]:![]);})[_0x32b8('0x13')](function(_0x599bc3){_0x834da1(_0x599bc3);});};AGIVertices['prototype']['getSquareOdbc']=function(_0x38f02b,_0x2ffea2){this[_0x32b8('0xe')][_0x32b8('0x14')](_0x38f02b)['then'](function(_0x34cf64){_0x2ffea2(null,_0x34cf64?_0x34cf64[_0x32b8('0x15')]:![]);})[_0x32b8('0x13')](function(_0x39a4f1){_0x2ffea2(_0x39a4f1);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x17')]=function(_0x222c77,_0xcd4b26){this['rpc']['getUserById'](_0x222c77)[_0x32b8('0xf')](function(_0x4c7471){_0xcd4b26(null,_0x4c7471?_0x4c7471[_0x32b8('0x12')]:![]);})['catch'](function(_0x1a4c2b){_0xcd4b26(_0x1a4c2b);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x18')]=function(_0x189c4a,_0x2df3dc){this['rpc'][_0x32b8('0x19')](_0x189c4a)[_0x32b8('0xf')](function(_0x3eea54){_0x2df3dc(null,_0x3eea54?_0x3eea54[_0x32b8('0x12')]:![]);})[_0x32b8('0x13')](function(_0x29988d){_0x2df3dc(_0x29988d);});};AGIVertices['prototype'][_0x32b8('0x1a')]=function(_0x15a8bf,_0x3b0049){var _0x3e1598=this;this[_0x32b8('0xe')][_0x32b8('0x1b')](_0x15a8bf)[_0x32b8('0xf')](function(_0x39ce15){_0x3b0049(null,_0x39ce15?_0x3e1598[_0x32b8('0x1c')](_0x39ce15[_0x32b8('0x1d')]):![]);})[_0x32b8('0x13')](function(_0x2bc3ce){_0x3b0049(_0x2bc3ce);});};AGIVertices[_0x32b8('0x16')]['getMailAccount']=function(_0x424721,_0x21c9fb){this[_0x32b8('0xe')][_0x32b8('0x1e')](_0x424721)[_0x32b8('0xf')](function(_0x1d83a5){_0x21c9fb(null,_0x1d83a5?_0x1d83a5:![]);})[_0x32b8('0x13')](function(_0x28ed75){_0x21c9fb(_0x28ed75);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x1f')]=function(_0x521bf4,_0x1833af,_0x3c1122){this[_0x32b8('0xc')][_0x32b8('0x1f')](_0x521bf4,_0x1833af)['then'](function(){_0x3c1122(null);})['catch'](function(_0x287a6b){_0x3c1122(_0x287a6b);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x20')]=function(_0x12ff7d,_0x523736){this[_0x32b8('0xe')][_0x32b8('0x21')](_0x12ff7d)[_0x32b8('0xf')](function(_0x42e9bc){if(_0x42e9bc){if(_0x42e9bc[_0x32b8('0x22')]){_0x523736(null,[_0x42e9bc[_0x32b8('0x23')]]);}else{_0x523736(null,_[_0x32b8('0x24')](_0x42e9bc[_0x32b8('0x25')],'interval'));}}else{_0x523736(null,![]);}})[_0x32b8('0x13')](function(_0x5e8af2){_0x523736(_0x5e8af2);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x1c')]=function(_0xcf7b7){return util[_0x32b8('0x26')](_0x32b8('0x27'),FILES_PATH,_0xcf7b7);};AGIVertices[_0x32b8('0x16')]['getQueryOdbc']=function(_0x152209,_0x22ed5a,_0x7e13a9){odbc['open'](_0x152209,function(_0x470653){if(_0x470653){logger['error'](_0x32b8('0x28'),_0x470653);_0x7e13a9(_0x470653);}else{logger[_0x32b8('0x29')](_0x32b8('0x2a'));odbc[_0x32b8('0x2b')](_0x22ed5a,function(_0x5e7b75,_0x140cce){if(_0x5e7b75){logger[_0x32b8('0x29')](_0x32b8('0x2c'),_0x22ed5a);_0x7e13a9(_0x5e7b75);}else{logger['info']('Query\x20executed\x20correctly\x20%s',_0x22ed5a);odbc[_0x32b8('0x2d')](function(_0x385e5d){if(_0x385e5d){logger[_0x32b8('0x2e')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x385e5d);}_0x7e13a9(null,_0x140cce);});}});}});};AGIVertices['prototype']['getSmsAccount']=function(_0x1aa6ef,_0x1dff0e){this[_0x32b8('0xe')]['getSmsAccountById'](_0x1aa6ef)[_0x32b8('0xf')](function(_0x14c109){_0x1dff0e(null,_0x14c109?_0x14c109:![]);})[_0x32b8('0x13')](function(_0x273d5f){_0x1dff0e(_0x273d5f);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x2f')]=function(_0x8dd996,_0x24bdaf){this['rpc'][_0x32b8('0x2f')](_0x8dd996)['then'](function(_0x5c0416){_0x24bdaf(null,_0x5c0416);})['catch'](function(_0x5eb159){_0x24bdaf(_0x5eb159);});};AGIVertices[_0x32b8('0x16')]['createSquareDetailsReport']=function(_0x2a3968,_0x52709b,_0x5bd1de){this[_0x32b8('0xe')][_0x32b8('0x30')]({'uniqueid':this[_0x32b8('0x31')]['uniqueid'],'node':_0x2a3968[_0x32b8('0x32')],'application':_0x2a3968[_0x32b8('0x33')],'data':_0x52709b||null,'project_name':this[_0x32b8('0x31')]['arg_1'],'callerid':this['channel'][_0x32b8('0x34')]})['then'](function(_0xb7406c){if(_0x5bd1de){_0x5bd1de(null,_0xb7406c);}})['catch'](function(_0x25957b){if(_0x5bd1de){_0x5bd1de(_0x25957b);}});};AGIVertices['prototype'][_0x32b8('0x35')]=function(_0x43b294,_0x155ed6,_0x17791d,_0x47eea4){this['rpc'][_0x32b8('0x35')]({'uniqueid':this[_0x32b8('0x31')][_0x32b8('0x36')],'callerid':this['channel']['callerid'],'calleridname':this[_0x32b8('0x31')][_0x32b8('0x37')],'context':this['channel'][_0x32b8('0x38')],'extension':this['channel']['extension'],'priority':this['channel'][_0x32b8('0x39')],'accountcode':this[_0x32b8('0x31')][_0x32b8('0x3a')],'dnid':this[_0x32b8('0x31')]['dnid'],'projectName':this[_0x32b8('0x31')][_0x32b8('0x3b')],'saveName':_0x155ed6,'filename':_0x43b294[_0x32b8('0x3c')]||_0x155ed6,'savePath':_0x17791d})[_0x32b8('0xf')](function(_0x1a5bd4){_0x47eea4(null,_0x1a5bd4);})[_0x32b8('0x13')](function(_0x25a2a8){_0x47eea4(_0x25a2a8);});};AGIVertices['prototype'][_0x32b8('0x3d')]=function(_0xf99c9d,_0x2eee28,_0x17d6bb,_0x13f936,_0x2726bf){this[_0x32b8('0xe')][_0x32b8('0x3d')]({'uniqueid':this[_0x32b8('0x31')]['uniqueid'],'body':_0xf99c9d,'direction':_0x2eee28,'providerName':_0x17d6bb,'providerResponse':_0x13f936})['then'](function(_0x4032f1){if(_0x2726bf){_0x2726bf(null,_0x4032f1);}})[_0x32b8('0x13')](function(_0x3694dc){if(_0x2726bf){_0x2726bf(_0x3694dc);}});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x3e')]=function(_0x17c46a,_0x4f7c6f){this[_0x32b8('0xe')][_0x32b8('0x3e')]({'firstName':_[_0x32b8('0x3f')](_0x17c46a[_0x32b8('0x12')])||_['isNil'](_0x17c46a[_0x32b8('0x12')])?_0x32b8('0x40')+Math[_0x32b8('0x41')]():_0x17c46a['name'],'lastName':_[_0x32b8('0x3f')](_0x17c46a[_0x32b8('0x42')])||_[_0x32b8('0x43')](_0x17c46a[_0x32b8('0x42')])?null:_0x17c46a[_0x32b8('0x42')],'phone':_0x17c46a[_0x32b8('0x44')],'ListId':_0x17c46a[_0x32b8('0x45')],'scheduledat':_0x17c46a['scheduledAt'],'callbackUniqueid':this[_0x32b8('0x31')]['uniqueid'],'tags':'callback','description':_0x32b8('0x46')+_0x17c46a[_0x32b8('0x47')][_0x32b8('0x48')](),'priority':_0x17c46a[_0x32b8('0x49')]})[_0x32b8('0xf')](function(_0x5e3e6f){_0x4f7c6f(null,_0x5e3e6f);})[_0x32b8('0x13')](function(_0x3b9694){_0x4f7c6f(_0x3b9694);});};AGIVertices[_0x32b8('0x16')]['getPause']=function(_0x1dbe22,_0x2e41ee){this[_0x32b8('0xe')]['getPauseById'](_0x1dbe22)[_0x32b8('0xf')](function(_0x531b62){_0x2e41ee(null,_0x531b62?_0x531b62[_0x32b8('0x12')]:![]);})[_0x32b8('0x13')](function(_0x40e1dd){_0x2e41ee(_0x40e1dd);});};AGIVertices[_0x32b8('0x16')]['agentPause']=function(_0xa39ab2,_0x567733,_0x7b4b88){var _0x5a6b2c={'role':'agent'};_0x5a6b2c[_0xa39ab2]=this['channel'][_0x32b8('0x34')];this[_0x32b8('0xe')][_0x32b8('0x4a')](_0x5a6b2c,_0x567733,this[_0x32b8('0x31')]['uniqueid'])[_0x32b8('0xf')](function(_0x391244){_0x7b4b88(null,_[_0x32b8('0x43')](_0x391244)?![]:!![]);})[_0x32b8('0x13')](function(_0x5077e4){logger[_0x32b8('0x2e')](_0x5077e4);_0x7b4b88(null,![]);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x4b')]=function(_0x43003e,_0x43c677){var _0x5fdb5a={'role':'agent'};_0x5fdb5a[_0x43003e]=this[_0x32b8('0x31')]['callerid'];this['rpc'][_0x32b8('0x4b')](_0x5fdb5a)[_0x32b8('0xf')](function(_0x216faf){_0x43c677(null,_['isNil'](_0x216faf)?![]:!![]);})[_0x32b8('0x13')](function(_0x1d2c07){logger[_0x32b8('0x2e')](_0x1d2c07);_0x43c677(null,![]);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x4c')]=function(_0x58fc0a,_0x1d6d52){var _0x8fddf8={'role':_0x32b8('0x4d')};_0x8fddf8[_0x58fc0a]=this['channel'][_0x32b8('0x34')];this[_0x32b8('0xe')]['agentLogout'](_0x8fddf8)[_0x32b8('0xf')](function(_0x9b7424){_0x1d6d52(null,_[_0x32b8('0x43')](_0x9b7424)?![]:!![]);})[_0x32b8('0x13')](function(_0x4118ac){logger[_0x32b8('0x2e')](_0x4118ac);_0x1d6d52(null,![]);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x4e')]=function(_0x2b5963,_0x532664){var _0x1add74={'role':_0x32b8('0x4d')};_0x1add74[_0x2b5963]=this['channel'][_0x32b8('0x34')];var _0x527986=_0x2b5963!=_0x32b8('0x4f')?util[_0x32b8('0x26')](_0x32b8('0x50'),_0x32b8('0x51'),this[_0x32b8('0x31')][_0x32b8('0x34')]):undefined;this[_0x32b8('0xe')][_0x32b8('0x4e')](_0x1add74,_0x527986)['then'](function(_0x4f745d){_0x532664(null,_[_0x32b8('0x43')](_0x4f745d)?![]:!![]);})['catch'](function(_0x195b37){logger[_0x32b8('0x2e')](_0x195b37);_0x532664(null,![]);});};AGIVertices[_0x32b8('0x16')]['shellCommand']=function(_0x17a175,_0x21c969){sh['exec'](_[_0x32b8('0x52')](_0x17a175),function(_0x4f4d5c,_0xeb73b8){var _0x308ebd=_0xeb73b8[_0x32b8('0x53')](/(\r\n|\n|\r)/gm,'');_0x21c969(null,_0x308ebd);});};AGIVertices[_0x32b8('0x16')]['googleCloudTTS']=function(_0x374be5,_0x58a585){scripts[_0x32b8('0x54')](_0x374be5[_0x32b8('0x55')],_0x374be5['google_cloud_tts_text_type']||'text',_0x374be5[_0x32b8('0x56')],_0x374be5[_0x32b8('0x57')]||_0x32b8('0x58'),_0x374be5[_0x32b8('0x59')]||_0x32b8('0x5a'),_0x374be5[_0x32b8('0x5b')]||_0x32b8('0x5c'))['then'](function(_0x1c7bd3){_0x58a585(null,_0x1c7bd3);})['catch'](function(_0x16bb7b){_0x58a585(_0x16bb7b);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x5d')]=function(_0x5655ae,_0x4d3044){scripts[_0x32b8('0x5d')](_0x5655ae[_0x32b8('0x56')],_0x5655ae[_0x32b8('0x5e')]||'en',0x1)[_0x32b8('0xf')](function(_0x504530){_0x4d3044(null,_0x504530);})[_0x32b8('0x13')](function(_0xcc2677){_0x4d3044(_0xcc2677);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x5f')]=function(_0x4c84b0,_0x570c4c){var _0x3a389={'uri':_0x4c84b0['url'],'method':_0x4c84b0[_0x32b8('0x60')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x4c84b0[_0x32b8('0x61')])==='number'&&parseInt(_0x4c84b0[_0x32b8('0x61')])>=0x1?parseInt(_0x4c84b0[_0x32b8('0x61')])*0x3e8:0x5*0x3e8};if(_['includes']([_0x32b8('0x62'),'PUT'],_0x3a389[_0x32b8('0x60')][_0x32b8('0x63')]())){try{_0x3a389[_0x32b8('0x64')]=_0x4c84b0[_0x32b8('0x8')]?JSON[_0x32b8('0x65')](_0x4c84b0['rawBody']):{};}catch(_0x245785){logger[_0x32b8('0x2e')](_0x32b8('0x66'),_0x245785);}}try{_0x3a389[_0x32b8('0x67')]=_0x4c84b0[_0x32b8('0x68')]?JSON[_0x32b8('0x65')](_0x4c84b0[_0x32b8('0x68')]):{};}catch(_0x17f806){logger['error'](_0x32b8('0x69'),_0x17f806);}if(_0x4c84b0['computedVariables']){try{var _0x238c22=require(_0x4c84b0['computedVariables'])[_0x32b8('0x6a')](this,_0x3a389);_0x3a389['uri']=Mustache['render'](_0x4c84b0[_0x32b8('0x6b')],_0x238c22,{},['$$','$$']);if(_0x3a389[_0x32b8('0x67')]){_0x3a389['headers']=JSON[_0x32b8('0x65')](Mustache[_0x32b8('0x6c')](JSON[_0x32b8('0x6d')](_0x3a389[_0x32b8('0x67')]),_0x238c22,{},['$$','$$']));}if(_0x3a389['body']){_0x3a389[_0x32b8('0x64')]=JSON[_0x32b8('0x65')](Mustache['render'](JSON[_0x32b8('0x6d')](_0x3a389['body']),_0x238c22,{},['$$','$$']));}}catch(_0x3f4034){logger[_0x32b8('0x2e')](_0x32b8('0x6e'),_0x3f4034);}}rp(_0x3a389)[_0x32b8('0xf')](function(_0x39ee79){var _0x311055={'statusCode':_0x39ee79[_0x32b8('0x6f')]||0xc8,'statusMessage':_0x39ee79[_0x32b8('0x70')]||'OK','headers':_0x39ee79[_0x32b8('0x67')]||{},'body':_0x39ee79['body']||{}};_0x570c4c(null,_0x311055);})[_0x32b8('0x13')](function(_0x1f8918){var _0x2b08fd={'statusCode':_0x1f8918[_0x32b8('0x6f')]||0x1f4,'statusMessage':_0x1f8918[_0x32b8('0x71')]||_0x32b8('0x72'),'headers':_0x1f8918[_0x32b8('0x73')][_0x32b8('0x67')]||{},'body':_0x1f8918[_0x32b8('0x73')][_0x32b8('0x64')]||{}};_0x570c4c(null,_0x2b08fd);});};AGIVertices[_0x32b8('0x16')]['googleDialogflow']=function(_0x56e39c,_0x534990){scripts[_0x32b8('0x74')](this['channel'][_0x32b8('0x36')],_0x56e39c[_0x32b8('0x75')],_0x56e39c[_0x32b8('0x56')],_0x56e39c['dialogflow_language']||'en')[_0x32b8('0xf')](function(_0x235ebc){_0x534990(null,_0x235ebc);})['catch'](function(_0x2a5cb0){_0x534990(_0x2a5cb0);});};AGIVertices['prototype']['googleDialogflowV2']=function(_0x4d78ae,_0x543331){scripts['googleDialogflowV2'](this['channel'][_0x32b8('0x36')],_0x4d78ae['dialogflowV2_project_id'],_0x4d78ae[_0x32b8('0x76')],_0x4d78ae['private_key'],_0x4d78ae[_0x32b8('0x56')],_0x4d78ae[_0x32b8('0x77')]||'en')[_0x32b8('0xf')](function(_0x2524a5){_0x543331(null,_0x2524a5);})[_0x32b8('0x13')](function(_0x3eaa5b){_0x543331(_0x3eaa5b);});};AGIVertices['prototype']['sestekNDA']=function(_0x435b12,_0x25835f){scripts[_0x32b8('0x78')](this[_0x32b8('0x31')],_0x435b12)['then'](function(_0x4a4784){_0x25835f(null,_0x4a4784);})['catch'](function(_0x2a74f9){_0x25835f(_0x2a74f9);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x79')]=function(_0x4cc70b,_0x68be4a){scripts['ispeechTTS'](_0x4cc70b[_0x32b8('0x75')],_0x4cc70b[_0x32b8('0x56')],_0x4cc70b[_0x32b8('0x7a')]||_0x32b8('0x58'),_0x4cc70b[_0x32b8('0x7b')])['then'](function(_0x2b1e0f){_0x68be4a(null,_0x2b1e0f);})[_0x32b8('0x13')](function(_0x34738b){_0x68be4a(_0x34738b);});};AGIVertices['prototype']['ispeechASR']=function(_0x34b5c9,_0x49112b,_0x407889){scripts[_0x32b8('0x7c')](_0x49112b,_0x34b5c9[_0x32b8('0x75')],_0x34b5c9['ispeech_asr_language']||_0x32b8('0x58'),this[_0x32b8('0x7d')](_0x34b5c9[_0x32b8('0x7e')])?_0x34b5c9['model']:undefined)[_0x32b8('0xf')](function(_0x37dc1e){_0x407889(null,_0x37dc1e);})['catch'](function(_0x4d1606){_0x407889(_0x4d1606);});};AGIVertices[_0x32b8('0x16')]['awsPolly']=function(_0x8eb753,_0x12576d){scripts[_0x32b8('0x7f')](_0x8eb753[_0x32b8('0x80')],_0x8eb753[_0x32b8('0x81')],_0x8eb753[_0x32b8('0x82')],_0x8eb753['aws_polly_voice']||_0x32b8('0x83'),_0x8eb753[_0x32b8('0x56')],_0x8eb753[_0x32b8('0x84')]||_0x32b8('0x56'))[_0x32b8('0xf')](function(_0x2f755e){_0x12576d(null,_0x2f755e);})[_0x32b8('0x13')](function(_0x447166){_0x12576d(_0x447166);});};AGIVertices['prototype']['awsLex']=function(_0x1d7d11,_0x42b81a){scripts['awsLex'](this[_0x32b8('0x31')][_0x32b8('0x36')],_0x1d7d11[_0x32b8('0x80')],_0x1d7d11['aws_secret_access_key'],_0x1d7d11[_0x32b8('0x85')],_0x1d7d11[_0x32b8('0x56')],_0x1d7d11[_0x32b8('0x86')])[_0x32b8('0xf')](function(_0xde7870){_0x42b81a(null,_0xde7870);})[_0x32b8('0x13')](function(_0x358a9e){_0x42b81a(_0x358a9e);});};AGIVertices[_0x32b8('0x16')]['googleASR']=function(_0x3b833e,_0x42e387,_0x46f1c0){scripts['googleASR'](_0x42e387,_0x3b833e[_0x32b8('0x75')],_0x3b833e[_0x32b8('0x87')]||'en-US')[_0x32b8('0xf')](function(_0x2ed151){_0x46f1c0(null,_0x2ed151);})['catch'](function(_0x2ec386){_0x46f1c0(_0x2ec386);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x88')]=function(_0x481746,_0xbe98ae,_0x23c08d){scripts[_0x32b8('0x88')](_0xbe98ae,_0x481746[_0x32b8('0x89')],_0x481746[_0x32b8('0x8a')],_0x481746[_0x32b8('0x8b')])[_0x32b8('0xf')](function(_0x354f94){_0x23c08d(null,_0x354f94);})['catch'](function(_0x2cb2a8){_0x23c08d(_0x2cb2a8);});};AGIVertices[_0x32b8('0x16')][_0x32b8('0x8c')]=function(_0x286a12){var _0x29f9cf=_['includes'](verticesWithRetry,_0x286a12[_0x32b8('0x33')])?_0x286a12:_[_0x32b8('0x8d')](_0x286a12);for(var _0x41d6db in _0x29f9cf){if(_0x29f9cf[_0x32b8('0x8e')](_0x41d6db)){if(_0x29f9cf[_0x41d6db]&&_[_0x32b8('0x8f')](_0x29f9cf[_0x41d6db])){if(_[_0x32b8('0x90')](recursiveMapAttributes,_0x41d6db)){_0x29f9cf[_0x41d6db]=this['replaceObjectAllVariables'](_0x29f9cf[_0x41d6db]);}else{_0x29f9cf[_0x41d6db]=this[_0x32b8('0x91')](_0x29f9cf[_0x41d6db]);}}}}return _0x29f9cf;};AGIVertices[_0x32b8('0x16')][_0x32b8('0x92')]=function(_0x1e29a1){for(var _0x1ee08f in _0x1e29a1){if(_0x1e29a1[_0x32b8('0x8e')](_0x1ee08f)){if(_[_0x32b8('0x93')](_0x1e29a1[_0x1ee08f])){this[_0x32b8('0x92')](_0x1e29a1[_0x1ee08f]);}else if(_['isArray'](_0x1e29a1[_0x1ee08f])){for(var _0x2591dc=0x0;_0x2591dc<_0x1e29a1[_0x1ee08f]['length'];_0x2591dc++){this[_0x32b8('0x92')](_0x1e29a1[_0x1ee08f][_0x2591dc]);}}else if(_[_0x32b8('0x8f')](_0x1e29a1[_0x1ee08f])){_0x1e29a1[_0x1ee08f]=this['replaceAllVariables'](_0x1e29a1[_0x1ee08f]);}}}};AGIVertices['prototype'][_0x32b8('0x94')]=function(_0x2d666b,_0x69b331){for(var _0x33becf in _0x2d666b){if(_0x2d666b[_0x32b8('0x8e')](_0x33becf)){if(_['isPlainObject'](_0x2d666b[_0x33becf])){if(!_['isEmpty'](_0x2d666b[_0x33becf])){this[_0x32b8('0x94')](_0x2d666b[_0x33becf],util[_0x32b8('0x26')](_0x32b8('0x95'),_0x69b331,_0x33becf));}}else if(_[_0x32b8('0x96')](_0x2d666b[_0x33becf])){for(var _0x317164=0x0;_0x317164<_0x2d666b[_0x33becf]['length'];_0x317164++){this[_0x32b8('0x94')](_0x2d666b[_0x33becf][_0x317164],util['format'](_0x32b8('0x95'),_0x69b331,_0x33becf+'['+_0x317164+']'));}}else{if(!_[_0x32b8('0x43')](_0x2d666b[_0x33becf])){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x95'),_0x69b331,_0x33becf),_0x2d666b[_0x33becf]);}}}}};AGIVertices['prototype'][_0x32b8('0x98')]=function(_0x58c791){try{var _0x164369=JSON[_0x32b8('0x65')](_0x58c791);this['recursiveNodeIndex'](_0x164369);return JSON[_0x32b8('0x6d')](_0x164369);}catch(_0x3e44f8){return this['replaceAllVariables'](_0x58c791);}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x91')]=function(_0x5ed377){var _0x2788b0=_0x5ed377[_0x32b8('0x99')]('{');for(var _0x40ebaa=0x1;_0x40ebaa<_0x2788b0[_0x32b8('0x9a')];_0x40ebaa+=0x1){var _0x528755=_0x2788b0[_0x40ebaa][_0x32b8('0x99')]('}');if(_0x528755[_0x32b8('0x9a')]>0x1){_0x5ed377=_0x5ed377[_0x32b8('0x9b')]('{'+_0x528755[0x0]+'}',this[_0x32b8('0x31')]['getVariable'](_0x528755[0x0])[_0x32b8('0x9c')]||_0x528755[0x0]);}}if(_0x2788b0[_0x32b8('0x9a')]===0x1){return _0x5ed377[_0x32b8('0x48')]();}return this[_0x32b8('0x91')](_0x5ed377);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x9d')]=function(_0x1a2d68,_0x4cc34c){var _0x12c3ab=this[_0x32b8('0x31')][_0x32b8('0xd')](_0x1a2d68);if(_0x12c3ab[_0x32b8('0x9e')]===-0x1){return _0x12c3ab;}logger['info'](util[_0x32b8('0x26')](_0x32b8('0x9f'),_0x4cc34c,_0x12c3ab[_0x32b8('0x9c')]));return this['channel']['setVariable'](_0x4cc34c,_0x12c3ab['extra']);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x7d')]=function(_0x344ed7){return _0x344ed7&&_0x344ed7!=='0'&&_0x344ed7!=='-1'&&_0x344ed7!=='';};AGIVertices['prototype']['maxRetry']=function(_0x32c588){this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x32c588,'-');_0x32c588['retry']=_0x32c588[_0x32b8('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x32b8('0x16')]['mrcpsynth']=function(_0x93dfa4){logger[_0x32b8('0x29')](util['format'](_0x32b8('0xa1'),_0x93dfa4[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x93dfa4[_0x32b8('0x56')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa2'));}var _0x14320f='\x22'+_0x93dfa4[_0x32b8('0x56')]+'\x22';if(this[_0x32b8('0x7d')](_0x93dfa4[_0x32b8('0x73')])){_0x14320f+=','+_0x93dfa4['options'];}var _0x4c26aa=this[_0x32b8('0x31')]['exec'](_0x32b8('0xa3'),_0x14320f);if(_0x4c26aa[_0x32b8('0x9e')]===-0x1){return _0x4c26aa;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xa5'),_0x14320f));};AGIVertices['prototype'][_0x32b8('0xa6')]=function(_0x29095e){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xa7'),_0x29095e['label']));if(!this[_0x32b8('0x7d')](_0x29095e[_0x32b8('0xa8')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa9'));}var _0x52ac94=_0x29095e[_0x32b8('0xa8')];if(this[_0x32b8('0x7d')](_0x29095e[_0x32b8('0x73')])){_0x52ac94+=','+_0x29095e['options'];}var _0x43fee6=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xab'),_0x52ac94);if(_0x43fee6['result']===-0x1){return _0x43fee6;}var _0x40ec2d=this[_0x32b8('0x9d')]('RECOG_CONFIDENCE()',_0x32b8('0xac'));if(_0x40ec2d[_0x32b8('0x9e')]===-0x1){return _0x40ec2d;}var _0x4a390f=this[_0x32b8('0x9d')]('RECOG_INPUT()',_0x32b8('0xad'));if(_0x4a390f[_0x32b8('0x9e')]===-0x1){return _0x4a390f;}var _0x45cb59=this[_0x32b8('0x9d')]('RECOG_INSTANCE()',_0x32b8('0xae'));if(_0x45cb59[_0x32b8('0x9e')]===-0x1){return _0x45cb59;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Executed\x20command\x20MRCPRecog\x20%s',_0x52ac94));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x5')]=function(_0x46d1d5){logger[_0x32b8('0x29')](util['format'](_0x32b8('0xaf'),_0x46d1d5[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0x5')]([_0x46d1d5[_0x32b8('0xb0')],_0x46d1d5[_0x32b8('0xb1')]]);};AGIVertices[_0x32b8('0x16')][_0x32b8('0xb2')]=function(_0x23f9ae){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xb3'),_0x23f9ae[_0x32b8('0x32')]));if(this[_0x32b8('0x7d')](_0x23f9ae[_0x32b8('0x61')])){logger[_0x32b8('0x29')](util['format'](_0x32b8('0xb4'),_0x23f9ae[_0x32b8('0x61')]));var _0x226e17=this['channel'][_0x32b8('0xb5')](_0x23f9ae[_0x32b8('0x61')]);if(_0x226e17['result']===-0x1){return _0x226e17;}}return this[_0x32b8('0x31')][_0x32b8('0xb2')]();};AGIVertices[_0x32b8('0x16')][_0x32b8('0xb6')]=function(_0x4b695a){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20CALLBACK\x20(%s)\x20block',_0x4b695a[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x4b695a[_0x32b8('0x45')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4b695a,'no\x20list\x20selected');}_0x4b695a[_0x32b8('0x47')]=moment();if(this['isConfigured'](_0x4b695a[_0x32b8('0xb7')])){_0x4b695a['scheduledAt']=moment()[_0x32b8('0xb8')](_0x4b695a[_0x32b8('0xb7')],_0x32b8('0xb9'));}if(!this[_0x32b8('0x7d')](_0x4b695a[_0x32b8('0x49')])){_0x4b695a[_0x32b8('0x49')]=0x2;}this[_0x32b8('0x3e')]['sync'](this,_0x4b695a);return this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x4b695a[_0x32b8('0x44')],_0x4b695a[_0x32b8('0x45')],_0x4b695a[_0x32b8('0x47')]));};AGIVertices['prototype'][_0x32b8('0xba')]=function(_0x5d0cd0){logger[_0x32b8('0x29')](util['format'](_0x32b8('0xbb'),_0x5d0cd0[_0x32b8('0x32')]));var _0x135da4=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x5d0cd0[_0x32b8('0xbc')],_0x5d0cd0[_0x32b8('0x73')]);if(_0x135da4[_0x32b8('0x9e')]===-0x1){return _0x135da4;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format'](_0x32b8('0xbd'),_0x5d0cd0['application'],_0x5d0cd0['options']));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xbe')]=function(_0x29cc73){logger['info'](util[_0x32b8('0x26')](_0x32b8('0xbf'),_0x29cc73[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x29cc73[_0x32b8('0x56')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}var _0x40ced6='\x22'+_0x29cc73[_0x32b8('0x56')]+'\x22';if(this[_0x32b8('0x7d')](_0x29cc73['options'])){_0x40ced6+=','+_0x29cc73[_0x32b8('0x73')];}var _0x16d088=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xa3'),_0x40ced6);if(_0x16d088['result']===-0x1){return _0x16d088;}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xa5'),_0x40ced6));};AGIVertices[_0x32b8('0x16')]['sestektts']=function(_0x4c09fe){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xc0'),_0x4c09fe[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x4c09fe[_0x32b8('0x56')])){return this['channel'][_0x32b8('0xa4')](_0x32b8('0xa2'));}var _0x2b1dfa='\x22'+_0x4c09fe[_0x32b8('0x56')]+'\x22';if(this[_0x32b8('0x7d')](_0x4c09fe[_0x32b8('0x73')])){_0x2b1dfa+=','+_0x4c09fe['options'];}var _0x53d7f7=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xa3'),_0x2b1dfa);if(_0x53d7f7[_0x32b8('0x9e')]===-0x1){return _0x53d7f7;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xa5'),_0x2b1dfa));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xc1')]=function(_0x554068){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xc2'),_0x554068[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x554068[_0x32b8('0xa8')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa9'));}var _0x339b89=_0x554068[_0x32b8('0xa8')];if(this[_0x32b8('0x7d')](_0x554068[_0x32b8('0x73')])){_0x339b89+=','+_0x554068[_0x32b8('0x73')];}var _0x138b01=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xab'),_0x339b89);if(_0x138b01[_0x32b8('0x9e')]===-0x1){return _0x138b01;}var _0x48b45f=this[_0x32b8('0x9d')](_0x32b8('0xc3'),'LUMENVOX_ASR_CONFIDENCE');if(_0x48b45f[_0x32b8('0x9e')]===-0x1){return _0x48b45f;}var _0x4d29c3=this[_0x32b8('0x9d')]('RECOG_INPUT()',_0x32b8('0xc4'));if(_0x4d29c3[_0x32b8('0x9e')]===-0x1){return _0x4d29c3;}var _0x2c8691=this['getAndSetVariable'](_0x32b8('0xc5'),_0x32b8('0xc6'));if(_0x2c8691[_0x32b8('0x9e')]===-0x1){return _0x2c8691;}return this[_0x32b8('0x31')]['noop'](util['format'](_0x32b8('0xc7'),_0x339b89));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xc8')]=function(_0x47dc87){logger[_0x32b8('0x29')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x47dc87[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x47dc87['grammar'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa9'));}var _0x5e1472=_0x47dc87['grammar'];if(this[_0x32b8('0x7d')](_0x47dc87[_0x32b8('0x73')])){_0x5e1472+=','+_0x47dc87[_0x32b8('0x73')];}var _0x5486a9=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xab'),_0x5e1472);if(_0x5486a9['result']===-0x1){return _0x5486a9;}var _0x1ee61f=this[_0x32b8('0x9d')](_0x32b8('0xc3'),'SESTEK_ASR_CONFIDENCE');if(_0x1ee61f[_0x32b8('0x9e')]===-0x1){return _0x1ee61f;}var _0x555a81=this[_0x32b8('0x9d')]('RECOG_INPUT()',_0x32b8('0xc9'));if(_0x555a81[_0x32b8('0x9e')]===-0x1){return _0x555a81;}var _0x53c69f=this[_0x32b8('0x9d')](_0x32b8('0xc5'),_0x32b8('0xca'));if(_0x53c69f[_0x32b8('0x9e')]===-0x1){return _0x53c69f;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xc7'),_0x5e1472));};AGIVertices[_0x32b8('0x16')]['database']=function(_0x3badd1){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xcb'),_0x3badd1['label']));if(!this['isConfigured'](_0x3badd1[_0x32b8('0xcc')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x3badd1,_0x32b8('0xcd'));}var _0x27da1f=this[_0x32b8('0xce')]['sync'](this,_0x3badd1[_0x32b8('0xcc')]);if(!_0x27da1f){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x3badd1,'no\x20odbc\x20database\x20found');}if(!this[_0x32b8('0x7d')](_0x3badd1['query'])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x3badd1,'no\x20query\x20configured');}var _0x25c1c6=_0x3badd1[_0x32b8('0x2b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')](_0x32b8('0xcf'),_0x25c1c6));var _0x4a5f66=this[_0x32b8('0xd0')][_0x32b8('0x6a')](this,_0x27da1f,_0x25c1c6);this[_0x32b8('0x30')]['sync'](this,_0x3badd1,_0x25c1c6);if(!this['isConfigured'](_0x3badd1['variable_id'])){return this['channel'][_0x32b8('0xa4')](_0x32b8('0xd1'));}var _0xb189be=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x3badd1[_0x32b8('0xd2')]);if(!_0xb189be){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x3badd1,'no\x20variable\x20found');}var _0x23ff8d=this;_0x4a5f66[_0x32b8('0xd3')](function(_0x5dbe57,_0x25f220){Object[_0x32b8('0xd4')](_0x5dbe57)[_0x32b8('0xd3')](function(_0x3633ea){_0x23ff8d[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0xd5'),_0xb189be,_0x25f220,_0x3633ea),_0x5dbe57[_0x3633ea]);});});this[_0x32b8('0x31')][_0x32b8('0x97')](util['format'](_0x32b8('0xd6'),_0xb189be),_0x4a5f66[_0x32b8('0x9a')]);return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xd7'),_0xb189be));};AGIVertices[_0x32b8('0x16')]['dial']=function(_0x2bc9b5){logger[_0x32b8('0xd8')](util[_0x32b8('0x26')](_0x32b8('0xd9'),_0x2bc9b5[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x2bc9b5['sip_id'])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x2bc9b5,'no\x20user\x20selected');}var _0xa90509=this[_0x32b8('0x17')]['sync'](this,_0x2bc9b5['sip_id']);if(!_0xa90509){return this[_0x32b8('0x31')]['error'](_0x2bc9b5,_0x32b8('0xda'));}var _0x219891=this[_0x32b8('0x31')][_0x32b8('0xaa')](_0x32b8('0xdb'),[util[_0x32b8('0x26')](_0x32b8('0xdc'),_0xa90509),_0x2bc9b5[_0x32b8('0x61')],_0x2bc9b5[_0x32b8('0xdd')],_0x2bc9b5[_0x32b8('0x6b')]]);if(_0x219891['result']===-0x1){return _0x219891;}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xde'),_0x32b8('0xdb')));};AGIVertices[_0x32b8('0x16')]['dialogflow']=function(_0x504f12){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xdf'),_0x504f12[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x504f12[_0x32b8('0x75')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xe0'));}if(!this[_0x32b8('0x7d')](_0x504f12[_0x32b8('0x56')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this['channel'][_0x32b8('0xe1')]=!![];this['createSquareDetailsReport'](_0x504f12);this[_0x32b8('0x3d')](_0x504f12['text'],'in','','');this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format']('Trying\x20Dialogflow:\x20%s',_0x504f12[_0x32b8('0x56')]));var _0x120c12=this[_0x32b8('0x74')][_0x32b8('0x6a')](this,_0x504f12);if(_0x120c12){for(var _0x1b46c4 in _0x120c12){if(_0x120c12[_0x32b8('0x8e')](_0x1b46c4)){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0xe2'),_0x1b46c4[_0x32b8('0x63')]()),_0x120c12[_0x1b46c4]);}}this[_0x32b8('0x3d')](_0x120c12[_0x32b8('0xe3')],_0x32b8('0xe4'),_0x32b8('0xe5'),'');return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xe6'),_0x120c12[_0x32b8('0xe3')]));}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x504f12,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x32b8('0x16')][_0x32b8('0xe7')]=function(_0x5cb7f2){logger['info'](util[_0x32b8('0x26')](_0x32b8('0xe8'),_0x5cb7f2[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x5cb7f2[_0x32b8('0xe9')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xea'));}if(!this[_0x32b8('0x7d')](_0x5cb7f2[_0x32b8('0x76')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xeb'));}if(!this[_0x32b8('0x7d')](_0x5cb7f2[_0x32b8('0xec')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xed'));}if(!this[_0x32b8('0x7d')](_0x5cb7f2[_0x32b8('0x77')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')]('no\x20anguage\x20configured');}if(!this[_0x32b8('0x7d')](_0x5cb7f2['text'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this[_0x32b8('0x31')]['bot']=!![];this[_0x32b8('0x30')](_0x5cb7f2);this[_0x32b8('0x3d')](_0x5cb7f2['text'],'in','','');this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Trying\x20DialogflowV2:\x20%s',_0x5cb7f2[_0x32b8('0x56')]));var _0x9a0be=this[_0x32b8('0xee')][_0x32b8('0x6a')](this,_0x5cb7f2);if(_0x9a0be){for(var _0x4dcafc in _0x9a0be){if(_0x9a0be[_0x32b8('0x8e')](_0x4dcafc)){if(_0x4dcafc!==_0x32b8('0xef')){this[_0x32b8('0x31')]['setVariable'](util['format'](_0x32b8('0xe2'),_0x4dcafc[_0x32b8('0x63')]()),_0x9a0be[_0x4dcafc]);}}}this[_0x32b8('0x3d')](_0x9a0be[_0x32b8('0xe3')],_0x32b8('0xe4'),_0x32b8('0xe7'),_0x9a0be['providerResponse']);return this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format']('DialogflowV2\x20Result\x20%s',_0x9a0be[_0x32b8('0xe3')]));}return this[_0x32b8('0x31')]['error'](_0x5cb7f2,_0x32b8('0xf0'));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xf1')]=function(_0xac9ae9){logger['info'](util[_0x32b8('0x26')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xac9ae9[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0xac9ae9[_0x32b8('0xf2')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xf3'));}if(!this[_0x32b8('0x7d')](_0xac9ae9[_0x32b8('0xf4')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xf5'));}if(!this[_0x32b8('0x7d')](_0xac9ae9[_0x32b8('0xf6')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xf7'));}if(!this[_0x32b8('0x7d')](_0xac9ae9[_0x32b8('0xf8')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa2'));}this['channel'][_0x32b8('0xe1')]=!![];this[_0x32b8('0x30')](_0xac9ae9);this['createSquareMessage'](_0xac9ae9[_0x32b8('0x56')],'in','','');this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xf9'),_0xac9ae9[_0x32b8('0x56')]));var _0x34a831=this[_0x32b8('0x78')][_0x32b8('0x6a')](this,_0xac9ae9);if(_0x34a831){for(var _0x35400 in _0x34a831){if(_0x34a831[_0x32b8('0x8e')](_0x35400)){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0xfa'),_0x35400['toUpperCase']()),_0x34a831[_0x35400]);}}this[_0x32b8('0x3d')](_0x34a831[_0x32b8('0xe3')],_0x32b8('0xe4'),_0x32b8('0xf1'),'');if(_0x34a831[_0x32b8('0xfb')]){this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x34a831[_0x32b8('0xfb')]));var _0x303852=this[_0x32b8('0x31')]['streamFile'](_0x34a831[_0x32b8('0xfb')]);try{fs['unlink'](_0x34a831['audiofile']+_0x32b8('0xfc'));}catch(_0x26c06e){logger[_0x32b8('0x2e')](_0x26c06e);}return _0x303852;}else{return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('SestekNDA\x20Result\x20%s',_0x34a831[_0x32b8('0xe3')]));}}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xac9ae9,'SestekNDA\x20is\x20unreachable');};AGIVertices['prototype']['end']=function(_0x324d2f){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0xfd'),_0x324d2f[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xfe'));};AGIVertices[_0x32b8('0x16')][_0x32b8('0xff')]=function(_0xde691a){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x100'),_0xde691a[_0x32b8('0x32')]));var _0x15e414='';if(_0xde691a[_0x32b8('0x101')]){if(!this[_0x32b8('0x7d')](_0xde691a[_0x32b8('0x101')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xde691a,_0x32b8('0x102'));}else{var _0x9acaf0=parseInt(_0xde691a[_0x32b8('0x101')],0xa);if(isNaN(_0x9acaf0)){_0x15e414=_0xde691a[_0x32b8('0x101')];}else{_0x15e414=this[_0x32b8('0x18')][_0x32b8('0x6a')](this,_0xde691a[_0x32b8('0x101')]);if(!_0x15e414){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xde691a,'no\x20trunk\x20found');}}}}else if(_0xde691a[_0x32b8('0x103')]){_0x15e414=_0xde691a[_0x32b8('0x103')];}else{return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xde691a,_0x32b8('0x102'));}var _0x1b2830=this['channel']['exec'](_0x32b8('0xdb'),[util[_0x32b8('0x26')](_0x32b8('0x104'),_0x15e414,_0xde691a['phone']),_0xde691a[_0x32b8('0x61')],_0xde691a[_0x32b8('0xdd')],_0xde691a[_0x32b8('0x6b')]]);if(_0x1b2830[_0x32b8('0x9e')]===-0x1){return _0x1b2830;}return this['channel'][_0x32b8('0xa4')](util['format'](_0x32b8('0xde'),_0x32b8('0xdb')));};AGIVertices[_0x32b8('0x16')]['finally']=function(_0x309194){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x309194[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x105'));};AGIVertices['prototype']['getdigits']=function(_0x4d3ed8){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x106'),_0x4d3ed8[_0x32b8('0x32')]));if(_0x4d3ed8[_0x32b8('0x107')]===0x0){return this[_0x32b8('0xa0')](_0x4d3ed8);}_0x4d3ed8['retry']-=0x1;if(!this['isConfigured'](_0x4d3ed8[_0x32b8('0x108')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4d3ed8,'no\x20file\x20audio\x20selected');}var _0x338acf=this[_0x32b8('0x1a')][_0x32b8('0x6a')](this,_0x4d3ed8[_0x32b8('0x108')]);if(!_0x338acf){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4d3ed8,_0x32b8('0x109'));}if(!this[_0x32b8('0x7d')](_0x4d3ed8[_0x32b8('0xd2')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x32b8('0xd1'));}var _0x115017=this['channel'][_0x32b8('0x10a')](_0x338acf,_0x4d3ed8[_0x32b8('0x10b')],_0x4d3ed8[_0x32b8('0x10c')]);var _0x540b5e=_0x115017[_0x32b8('0x9e')]?_0x115017[_0x32b8('0x9e')][_0x32b8('0x48')]():'';logger[_0x32b8('0x29')](_0x32b8('0x10d'),JSON['stringify'](_0x115017));if(_0x115017[_0x32b8('0x9e')]===-0x1){this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x4d3ed8,_0x540b5e);return _0x115017;}else if(_0x115017[_0x32b8('0x9c')]===_0x32b8('0x61')){_0x115017[_0x32b8('0x9e')]=_0x540b5e[_0x32b8('0x9a')]>=parseInt(_0x4d3ed8[_0x32b8('0x10e')])?'x':'i';}else{_0x115017[_0x32b8('0x9e')]=_0x540b5e[_0x32b8('0x9a')]>=parseInt(_0x4d3ed8[_0x32b8('0x10e')])&&_0x540b5e[_0x32b8('0x9a')]<=parseInt(_0x4d3ed8[_0x32b8('0x10c')])?'x':'i';}var _0x3d44ef=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x4d3ed8[_0x32b8('0xd2')]);if(!_0x3d44ef){return this['channel'][_0x32b8('0x2e')](_0x4d3ed8,_0x32b8('0x10f'));}this[_0x32b8('0x31')][_0x32b8('0x97')](_0x3d44ef,_0x540b5e);if(this[_0x32b8('0x7d')](_0x4d3ed8['hiddendigitsnum'])){var _0x82aba5=parseInt(_0x4d3ed8[_0x32b8('0x110')],0xa);var _0x3a3f66=rs[_0x32b8('0x111')]({'charset':'*','length':_0x82aba5});var _0x43ff42=_0x540b5e[_0x32b8('0x9a')];if(_0x43ff42>0x0){if(_0x43ff42>_0x82aba5){this[_0x32b8('0x30')]['sync'](this,_0x4d3ed8,_0x4d3ed8[_0x32b8('0x112')]===_0x32b8('0x113')?_0x3a3f66+_0x540b5e['substr'](_0x82aba5):_0x540b5e[_0x32b8('0x114')](0x0,_0x43ff42-_0x82aba5)+_0x3a3f66);}else{this['createSquareDetailsReport']['sync'](this,_0x4d3ed8,rs[_0x32b8('0x111')]({'charset':'*','length':_0x43ff42}));}}else{this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x4d3ed8,'');}}else{this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x4d3ed8,_0x540b5e);}return _0x115017;};AGIVertices[_0x32b8('0x16')]['getsecretdigits']=function(_0x179470){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x115'),_0x179470['label']));return this['getdigits'](_0x179470);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x116')]=function(_0x3c110c){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x117'),_0x3c110c[_0x32b8('0x32')]));this['createSquareDetailsReport'][_0x32b8('0x6a')](this,_0x3c110c,_0x3c110c[_0x32b8('0x118')]);return this['channel']['noop'](util[_0x32b8('0x26')](_0x32b8('0x119'),_0x3c110c[_0x32b8('0x118')]));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x11a')]=function(_0x26ea0f){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x26ea0f[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x26ea0f['aws_access_key_id'])||!this[_0x32b8('0x7d')](_0x26ea0f[_0x32b8('0x81')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')]('no\x20valid\x20credentials\x20configured');}if(!this['isConfigured'](_0x26ea0f['text'])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa2'));}this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x26ea0f[_0x32b8('0x56')]));var _0x218656=this[_0x32b8('0x7f')][_0x32b8('0x6a')](this,_0x26ea0f);if(_0x218656){this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x11b'),_0x218656));var _0x1c5728=this[_0x32b8('0x31')][_0x32b8('0x11c')](_0x218656);try{fs[_0x32b8('0x11d')](_0x218656+'.wav');}catch(_0x15dacc){logger[_0x32b8('0x2e')](_0x15dacc);}return _0x1c5728;}return this['channel']['error'](_0x26ea0f,'aws\x20Polly\x20is\x20unreachable');};AGIVertices['prototype'][_0x32b8('0x11e')]=function(_0x16649c){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x16649c['label']));if(!this['isConfigured'](_0x16649c['aws_access_key_id'])||!this['isConfigured'](_0x16649c['aws_secret_access_key'])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0x11f'));}if(!this[_0x32b8('0x7d')](_0x16649c[_0x32b8('0x86')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x120'));}if(!this[_0x32b8('0x7d')](_0x16649c['text'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this[_0x32b8('0x31')][_0x32b8('0xe1')]=!![];this['createSquareDetailsReport'](_0x16649c);this[_0x32b8('0x3d')](_0x16649c[_0x32b8('0x56')],'in','','');this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x121'),_0x16649c[_0x32b8('0x56')]));var _0x3e48be=this[_0x32b8('0x122')][_0x32b8('0x6a')](this,_0x16649c);if(_0x3e48be){for(var _0x170295 in _0x3e48be){if(_0x3e48be['hasOwnProperty'](_0x170295)&&_[_0x32b8('0x8f')](_0x3e48be[_0x170295])){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x123'),_0x170295[_0x32b8('0x63')]()),_0x3e48be[_0x170295]);}}if(_[_0x32b8('0x43')](_0x3e48be[_0x32b8('0x71')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0x124'));}else{this[_0x32b8('0x3d')](_0x3e48be[_0x32b8('0x71')],_0x32b8('0xe4'),_0x32b8('0x125'),'');return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x126'),_0x3e48be[_0x32b8('0x71')]));}}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x16649c,_0x32b8('0x127'));};AGIVertices['prototype'][_0x32b8('0x128')]=function(_0x598866){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x129'),_0x598866[_0x32b8('0x32')],_0x598866[_0x32b8('0x61')]));if(!this[_0x32b8('0x7d')](_0x598866['key'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')]('no\x20key\x20configured');}var _0x36bfcb=_0x32b8('0x12a');var _0x18785c=util[_0x32b8('0x26')](_0x32b8('0x12b'),FILES_PATH,rs[_0x32b8('0x111')](0x4));var _0x106d8d=util[_0x32b8('0x26')](_0x32b8('0x95'),_0x18785c,_0x36bfcb);var _0x224bac=!![];if(_0x598866[_0x32b8('0x12c')]==='NOBEEP'){_0x224bac=![];}var _0x33cca8=this[_0x32b8('0x31')]['recordFile'](_0x18785c,_0x36bfcb,_0x598866[_0x32b8('0x12d')],_0x598866['timeout'],undefined,_0x224bac);if(_0x33cca8[_0x32b8('0x9e')]!==-0x1){this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')]('google\x20%s\x20file\x20created',_0x106d8d));var _0x32ce9b=this[_0x32b8('0x12e')][_0x32b8('0x6a')](this,_0x598866,_0x106d8d);if(_0x32ce9b){for(var _0xcf2eba in _0x32ce9b){if(_0x32ce9b[_0x32b8('0x8e')](_0xcf2eba)){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x12f'),_0xcf2eba['toUpperCase']()),_0x32ce9b[_0xcf2eba]);}}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x130'),JSON['stringify'](_0x32ce9b)));}}return _0x33cca8;};AGIVertices[_0x32b8('0x16')]['tildeasr']=function(_0x59d1fb){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x131'),_0x59d1fb[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x59d1fb['appid'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')]('no\x20appid\x20configured');}if(!this[_0x32b8('0x7d')](_0x59d1fb[_0x32b8('0x8a')])){return this[_0x32b8('0x31')]['noop']('no\x20appsecret\x20configured');}var _0x1e3e4d=_0x32b8('0x12a');var _0xe464b5=util['format'](_0x32b8('0x12b'),FILES_PATH,rs[_0x32b8('0x111')](0x4));var _0x308b68=util[_0x32b8('0x26')](_0x32b8('0x95'),_0xe464b5,_0x1e3e4d);var _0x5de46d=!![];if(_0x59d1fb['beep']==='NOBEEP'){_0x5de46d=![];}var _0x5da5a0=this[_0x32b8('0x31')]['recordFile'](_0xe464b5,_0x1e3e4d,_0x59d1fb[_0x32b8('0x12d')],_0x59d1fb[_0x32b8('0x61')],undefined,_0x5de46d);if(_0x5da5a0[_0x32b8('0x9e')]!==-0x1){this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x132'),_0x308b68));var _0x45c9c7=this['tildeASR']['sync'](this,_0x59d1fb,_0x308b68);if(_0x45c9c7){for(var _0x30da9c in _0x45c9c7){if(_0x45c9c7['hasOwnProperty'](_0x30da9c)){this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x133'),_0x30da9c[_0x32b8('0x63')]()),_0x45c9c7[_0x30da9c]);}}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x134'),JSON[_0x32b8('0x6d')](_0x45c9c7)));}}return _0x5da5a0;};AGIVertices['prototype'][_0x32b8('0x135')]=function(_0x3a20d0){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x3a20d0['label']));return this[_0x32b8('0x31')]['continueAt'](_0x3a20d0['context'],_0x3a20d0[_0x32b8('0x136')],_0x3a20d0[_0x32b8('0x39')]);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x137')]=function(_0x53a793){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x138'),_0x53a793[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x53a793[_0x32b8('0x139')])){return this['channel'][_0x32b8('0x2e')](_0x53a793,_0x32b8('0x13a'));}try{var _0x5c2461=eval(_0x53a793[_0x32b8('0x139')])?_0x32b8('0x13b'):'false';this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')]('EVAL\x20CONDITION\x20%s\x20%s',_0x53a793[_0x32b8('0x139')],_0x5c2461));return{'code':0xc8,'result':_0x5c2461};}catch(_0x140aad){return{'code':0xc8,'result':_0x32b8('0x13c')};}};AGIVertices['prototype'][_0x32b8('0x13d')]=function(_0x5203f6){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block',_0x5203f6[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x5203f6['interval_id'])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x5203f6,_0x32b8('0x13e'));}var _0x510a83=this[_0x32b8('0x20')][_0x32b8('0x6a')](this,_0x5203f6[_0x32b8('0x13f')]);if(!_0x510a83){return this[_0x32b8('0x31')]['error'](_0x5203f6,'no\x20intervals\x20found');}for(var _0xd7d100=0x0;_0xd7d100<_0x510a83[_0x32b8('0x9a')];_0xd7d100+=0x1){var _0x3945fb=this[_0x32b8('0x31')]['getVariable'](util[_0x32b8('0x26')](_0x32b8('0x140'),_0x510a83[_0xd7d100]));if(_0x3945fb['result']===-0x1){return _0x3945fb;}logger['info'](util['format']('IFTIME\x20%s\x20%s',_0x510a83[_0xd7d100],_0x3945fb['extra']));if(_0x3945fb['extra']===_0x32b8('0x13b')){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x141'),_0x510a83[_0xd7d100],'true'));this['channel']['noop'](util[_0x32b8('0x26')](_0x32b8('0x141'),_0x510a83[_0xd7d100],_0x32b8('0x13b')));return{'code':0xc8,'result':'true'};}else{logger['info'](util[_0x32b8('0x26')](_0x32b8('0x141'),_0x510a83[_0xd7d100],'false'));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x141'),_0x510a83[_0xd7d100],_0x32b8('0x13c')));}}return{'code':0xc8,'result':_0x32b8('0x13c')};};AGIVertices[_0x32b8('0x16')][_0x32b8('0x142')]=function(_0x3d4e58){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x143'),_0x3d4e58[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0x142')]();};AGIVertices['prototype'][_0x32b8('0x144')]=function(_0x1f937d){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x145'),_0x1f937d[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x1f937d[_0x32b8('0x75')])){return this['channel'][_0x32b8('0xa4')]('no\x20key\x20configured');}var _0x298300=_0x32b8('0x12a');var _0x512f90=util[_0x32b8('0x26')](_0x32b8('0x12b'),FILES_PATH,rs[_0x32b8('0x111')](0x4));var _0x165a1e=util['format'](_0x32b8('0x95'),_0x512f90,_0x298300);var _0x1f7cf7=!![];if(_0x1f937d['beep']===_0x32b8('0x146')){_0x1f7cf7=![];}var _0x1667ce=this['channel']['recordFile'](_0x512f90,_0x298300,_0x1f937d[_0x32b8('0x12d')],_0x1f937d[_0x32b8('0x61')],undefined,_0x1f7cf7);if(_0x1667ce[_0x32b8('0x9e')]!==-0x1){this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x147'),_0x165a1e));var _0x38b33e=this[_0x32b8('0x7c')]['sync'](this,_0x1f937d,_0x165a1e);if(_0x38b33e){for(var _0x536fdb in _0x38b33e){if(_0x38b33e[_0x32b8('0x8e')](_0x536fdb)){this[_0x32b8('0x31')][_0x32b8('0x97')](util['format'](_0x32b8('0x148'),_0x536fdb[_0x32b8('0x63')]()),_0x38b33e[_0x536fdb]);}}return this['channel'][_0x32b8('0xa4')](util['format'](_0x32b8('0x149'),JSON['stringify'](_0x38b33e)));}}return _0x1667ce;};AGIVertices['prototype'][_0x32b8('0x14a')]=function(_0x2e47d2){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x14b'),_0x2e47d2['label']));if(!this[_0x32b8('0x7d')](_0x2e47d2[_0x32b8('0x75')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xe0'));}if(!this[_0x32b8('0x7d')](_0x2e47d2['text'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')]('Trying\x20ispeech\x20TTS\x20%s',_0x2e47d2['text']));var _0x30c4f3=this['ispeechTTS']['sync'](this,_0x2e47d2);if(_0x30c4f3){this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x147'),_0x30c4f3));var _0x2534ea=this[_0x32b8('0x31')][_0x32b8('0x11c')](_0x30c4f3,_0x2e47d2['intKey']);try{fs[_0x32b8('0x11d')](_0x30c4f3+_0x32b8('0xfc'));}catch(_0x348fff){logger['error'](_0x348fff);}return _0x2534ea;}return this['channel'][_0x32b8('0x2e')](_0x2e47d2,'ispeech\x20TTS\x20is\x20unreachable');};AGIVertices[_0x32b8('0x16')][_0x32b8('0x14c')]=function(_0x41b00a){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x14d'),_0x41b00a[_0x32b8('0x32')]));if(!this['isConfigured'](_0x41b00a[_0x32b8('0x14e')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x41b00a,_0x32b8('0x14f'));}logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x150'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x41b00a[_0x32b8('0x14e')]));var _0x2d3580=this['agentLogin'][_0x32b8('0x6a')](this,_0x41b00a[_0x32b8('0x14e')]);if(_0x2d3580){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x41b00a['findBy']));this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x41b00a[_0x32b8('0x14e')]));return{'code':0xc8,'result':'success'};}else{logger['info'](util['format'](_0x32b8('0x152'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x41b00a[_0x32b8('0x14e')]));this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format'](_0x32b8('0x152'),this['channel'][_0x32b8('0x34')],_0x41b00a[_0x32b8('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices['prototype'][_0x32b8('0x153')]=function(_0x38956b){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x154'),_0x38956b['label']));if(!this[_0x32b8('0x7d')](_0x38956b[_0x32b8('0x14e')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x38956b,'no\x20find\x20by\x20configured');}logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x150'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x38956b[_0x32b8('0x14e')]));var _0x4712be=this[_0x32b8('0x4c')][_0x32b8('0x6a')](this,_0x38956b['findBy']);if(_0x4712be){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x151'),this['channel'][_0x32b8('0x34')],_0x38956b['findBy']));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x32b8('0x34')],_0x38956b[_0x32b8('0x14e')]));return{'code':0xc8,'result':_0x32b8('0x155')};}else{logger[_0x32b8('0x29')](util['format'](_0x32b8('0x152'),this['channel']['callerid'],_0x38956b[_0x32b8('0x14e')]));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x152'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x38956b[_0x32b8('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x156')]=function(_0x38019b){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x157'),_0x38019b['label']));if(!this[_0x32b8('0x7d')](_0x38019b[_0x32b8('0x158')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x38019b,_0x32b8('0x159'));}this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')](_0x32b8('0x15a'),_0x38019b[_0x32b8('0x158')]));var _0x5cc34d=eval(_0x38019b['operation']);if(!this[_0x32b8('0x7d')](_0x38019b['variable_id'])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xd1'));}var _0x580d89=this['getVariable']['sync'](this,_0x38019b[_0x32b8('0xd2')]);if(!_0x580d89){return this[_0x32b8('0x31')]['error'](_0x38019b,_0x32b8('0x10f'));}if(_[_0x32b8('0x96')](_0x5cc34d)){var _0x140687=this;_0x5cc34d[_0x32b8('0xd3')](function(_0x2c8f86,_0x38de5b){_0x140687[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')]('%s[%s]',_0x580d89,_0x38de5b),_0x2c8f86);});return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('variable\x20%s[key]\x20set',_0x580d89));}else{return this[_0x32b8('0x31')][_0x32b8('0x97')](_0x580d89,_0x5cc34d);}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x9')]=function(_0x35aae6){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x15b'),_0x35aae6[_0x32b8('0x32')]));if(_0x35aae6[_0x32b8('0x107')]===0x0){return this[_0x32b8('0xa0')](_0x35aae6);}_0x35aae6[_0x32b8('0x107')]-=0x1;if(!this[_0x32b8('0x7d')](_0x35aae6['file_id'])){return this['channel'][_0x32b8('0x2e')](_0x35aae6,_0x32b8('0x15c'));}var _0x4337fd=this['getSound'][_0x32b8('0x6a')](this,_0x35aae6[_0x32b8('0x108')]);if(!_0x4337fd){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x35aae6,_0x32b8('0x109'));}var _0x2dbdb1=this[_0x32b8('0x31')]['getData'](_0x4337fd,_0x35aae6[_0x32b8('0x10b')],_0x35aae6[_0x32b8('0x15d')]);var _0x5ed878=_0x2dbdb1[_0x32b8('0x9e')];if(_0x2dbdb1[_0x32b8('0x9e')]===-0x1){this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x35aae6,'-1');return _0x2dbdb1;}else if(_0x2dbdb1['extra']===_0x32b8('0x61')){_0x2dbdb1[_0x32b8('0x9e')]=_0x2dbdb1[_0x32b8('0x9e')]['length']>0x0?_0x2dbdb1[_0x32b8('0x9e')]:'t';}else if(_['isEmpty'](_0x2dbdb1['result'])){_0x2dbdb1['result']='#';_0x5ed878='#';}if(!this['isConfigured'](_0x35aae6['variable_id'])){this['channel'][_0x32b8('0xa4')]('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x98b97e=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x35aae6[_0x32b8('0xd2')]);if(!_0x98b97e){return this['channel'][_0x32b8('0x2e')](_0x35aae6,'no\x20variable\x20found');}this[_0x32b8('0x31')][_0x32b8('0x97')](_0x98b97e,_0x5ed878);}this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x35aae6,_0x5ed878);return _0x2dbdb1;};AGIVertices[_0x32b8('0x16')][_0x32b8('0xa4')]=function(_0x179b7d){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x15e'),_0x179b7d[_0x32b8('0x32')]));return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x179b7d[_0x32b8('0x15f')]||_0x179b7d['label']);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x160')]=function(_0x4ad3ae){logger[_0x32b8('0x29')](util[_0x32b8('0x26')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x4ad3ae[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x4ad3ae[_0x32b8('0x14e')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4ad3ae,_0x32b8('0x14f'));}logger['info'](util['format'](_0x32b8('0x150'),this[_0x32b8('0x31')]['callerid'],_0x4ad3ae[_0x32b8('0x14e')]));var _0x19077c=this['getPause'][_0x32b8('0x6a')](this,_0x4ad3ae[_0x32b8('0x161')]);var _0x471c1f=this['agentPause']['sync'](this,_0x4ad3ae[_0x32b8('0x14e')],_0x19077c);if(_0x471c1f){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x151'),this['channel'][_0x32b8('0x34')],_0x4ad3ae['findBy']));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x4ad3ae[_0x32b8('0x14e')]));return{'code':0xc8,'result':_0x32b8('0x155')};}else{logger[_0x32b8('0x29')](util['format'](_0x32b8('0x152'),this['channel'][_0x32b8('0x34')],_0x4ad3ae['findBy']));this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x4ad3ae[_0x32b8('0x14e')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x162')]=function(_0x57e2bb){logger['info'](util['format'](_0x32b8('0x163'),_0x57e2bb[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x57e2bb[_0x32b8('0x108')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x57e2bb,_0x32b8('0x15c'));}var _0x110969=this[_0x32b8('0x1a')]['sync'](this,_0x57e2bb[_0x32b8('0x108')]);if(!_0x110969){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x57e2bb,_0x32b8('0x109'));}var _0xa2747d=this[_0x32b8('0x31')][_0x32b8('0xaa')]('PLAYBACK',[_0x110969,_0x57e2bb['opts']]);if(_0xa2747d[_0x32b8('0x9e')]===-0x1){return _0xa2747d;}return this[_0x32b8('0x31')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x32b8('0x164'),_0x110969));};AGIVertices[_0x32b8('0x16')]['queue']=function(_0x1cdf43){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x165'),_0x1cdf43[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x1cdf43[_0x32b8('0x166')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x1cdf43,_0x32b8('0x167'));}var _0x2f1eb6='';var _0x5a4058=parseInt(_0x1cdf43[_0x32b8('0x166')],0xa);if(isNaN(_0x5a4058)){_0x2f1eb6=_0x1cdf43['queue_id'];}else{_0x2f1eb6=this[_0x32b8('0x10')][_0x32b8('0x6a')](this,_0x1cdf43['queue_id']);if(!_0x2f1eb6){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x1cdf43,_0x32b8('0x168'));}}var _0x172724='';if(this[_0x32b8('0x7d')](_0x1cdf43['file_id'])){var _0x28a615=this[_0x32b8('0x1a')][_0x32b8('0x6a')](this,_0x1cdf43[_0x32b8('0x108')]);if(_0x28a615){_0x172724=_0x28a615;}}this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x1cdf43,_0x2f1eb6);if(_0x1cdf43['opts']['indexOf']('x')<0x0){_0x1cdf43['opts']+='x';}if(_0x1cdf43[_0x32b8('0xdd')][_0x32b8('0x169')]('X')<0x0){_0x1cdf43[_0x32b8('0xdd')]+='X';}this[_0x32b8('0x31')]['setVariable'](_0x32b8('0x16a'),_0x2f1eb6?_0x2f1eb6['toLowerCase']():'');var _0x38a1b1=this['channel'][_0x32b8('0xaa')]('QUEUE',[_0x2f1eb6,_0x1cdf43[_0x32b8('0xdd')],_0x1cdf43['url'],_0x172724,_0x1cdf43[_0x32b8('0x61')],_0x1cdf43[_0x32b8('0x5')],_0x1cdf43[_0x32b8('0x16b')],_0x1cdf43[_0x32b8('0x16c')],'',_0x1cdf43[_0x32b8('0x16d')]]);if(_0x38a1b1[_0x32b8('0x9e')]===-0x1){return _0x38a1b1;}return this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x2f1eb6));};AGIVertices['prototype'][_0x32b8('0x16e')]=function(_0x310e8b){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x16f'),_0x310e8b['label']));var _0x47b85a=_0x310e8b[_0x32b8('0x170')]||_0x32b8('0x12a');var _0x696acd=util[_0x32b8('0x26')](_0x32b8('0x171'),this[_0x32b8('0x31')]['uniqueid'],rs[_0x32b8('0x111')](0x5));var _0x1e9a63=util[_0x32b8('0x26')](_0x32b8('0x172'),FILES_PATH,_0x696acd,_0x47b85a);var _0x2a1aaf=util['format']('%s/recordings/%s',FILES_PATH,_0x696acd);this[_0x32b8('0x35')][_0x32b8('0x6a')](this,_0x310e8b,_0x696acd,_0x1e9a63);this[_0x32b8('0x31')][_0x32b8('0x97')](_0x32b8('0x173'),_0x696acd);logger[_0x32b8('0x29')](_0x32b8('0x174'),_0x2a1aaf,_0x47b85a,_0x310e8b[_0x32b8('0x175')],_0x310e8b[_0x32b8('0x61')]);return this[_0x32b8('0x31')][_0x32b8('0x176')](_0x2a1aaf,_0x47b85a,_0x310e8b[_0x32b8('0x175')],_0x310e8b[_0x32b8('0x61')],undefined,!![]);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x177')]=function(_0x241c74){logger[_0x32b8('0x29')](util['format']('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x241c74[_0x32b8('0x32')]));if(!this['isConfigured'](_0x241c74[_0x32b8('0x6b')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x178'));}var _0x5669a9=this[_0x32b8('0x5f')]['sync'](this,_0x241c74);logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x179'),util['inspect'](_0x5669a9,{'showHidden':![],'depth':null})));if(!this[_0x32b8('0x7d')](_0x241c74[_0x32b8('0xd2')])){return this[_0x32b8('0x31')]['noop']('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x42b69b=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x241c74[_0x32b8('0xd2')]);if(!_0x42b69b){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x241c74,_0x32b8('0x10f'));}this[_0x32b8('0x31')][_0x32b8('0x97')](util['format']('%s_STATUS_CODE',_0x42b69b),_0x5669a9[_0x32b8('0x6f')]?_0x5669a9['statusCode']:'200');this[_0x32b8('0x31')][_0x32b8('0x97')](util[_0x32b8('0x26')](_0x32b8('0x17a'),_0x42b69b),_0x5669a9[_0x32b8('0x70')]?_0x5669a9[_0x32b8('0x70')]:'OK');if(_0x5669a9[_0x32b8('0x64')]){try{this['saveRestApiResult'](_0x5669a9[_0x32b8('0x64')],_0x42b69b);}catch(_0x1d7036){logger[_0x32b8('0x2e')](util[_0x32b8('0x26')](_0x32b8('0x17b'),_0x42b69b));}}return this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')]('variable\x20%s\x20set',_0x42b69b));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x17c')]=function(_0x3c7119){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x17d'),_0x3c7119['label']));return this[_0x32b8('0x31')][_0x32b8('0x17e')](_0x3c7119[_0x32b8('0x17f')][_0x32b8('0x53')](/\s+/g,''),_0x3c7119[_0x32b8('0x175')]);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x180')]=function(_0x26880c){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x181'),_0x26880c[_0x32b8('0x32')]));return this['channel'][_0x32b8('0x182')](_0x26880c[_0x32b8('0x183')][_0x32b8('0x53')](/\s+/g,''),_0x26880c[_0x32b8('0x175')]);};AGIVertices[_0x32b8('0x16')]['sayphonetic']=function(_0xdc33df){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x184'),_0xdc33df['label']));return this[_0x32b8('0x31')]['sayPhonetic'](_0xdc33df[_0x32b8('0x56')],_0xdc33df[_0x32b8('0x175')]);};AGIVertices['prototype']['sendMail']=function(_0x2d4095){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x185'),_0x2d4095[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x2d4095[_0x32b8('0x186')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x187'));}var _0x45bb2a=this[_0x32b8('0x188')]['sync'](this,_0x2d4095[_0x32b8('0x186')]);if(!_0x45bb2a||!_0x45bb2a[_0x32b8('0x189')]){return this[_0x32b8('0x31')]['error'](_0x2d4095,_0x32b8('0x18a'));}var _0x41269e={'from':util[_0x32b8('0x26')]('\x22%s\x22\x20<%s>',_0x45bb2a[_0x32b8('0x12')],_0x45bb2a[_0x32b8('0x18b')]||_0x45bb2a[_0x32b8('0x189')]['user']),'to':_0x2d4095['to']||'','cc':_0x2d4095['cc']||'','bcc':_0x2d4095[_0x32b8('0x18c')]||'','subject':_0x2d4095[_0x32b8('0x18d')],'html':_0x2d4095[_0x32b8('0x56')],'text':_0x2d4095['text']};if(this[_0x32b8('0x7d')](_0x2d4095[_0x32b8('0x18e')])){}logger['debug'](_0x32b8('0x18f'),JSON[_0x32b8('0x6d')](_0x41269e));this['createSquareDetailsReport'][_0x32b8('0x6a')](this,_0x2d4095,_0x2d4095[_0x32b8('0x186')]);this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x45bb2a[_0x32b8('0x12')]));this[_0x32b8('0x1f')]['sync'](this,_0x45bb2a[_0x32b8('0x190')],_0x41269e);return this[_0x32b8('0x31')][_0x32b8('0xa4')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x32b8('0x16')]['sendFax']=function(_0x3cd177){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x191'),_0x3cd177['label']));return this['channel']['noop']('SENDFAX\x20block\x20not\x20implemented');};AGIVertices[_0x32b8('0x16')][_0x32b8('0x192')]=function(_0x41e410){logger['info'](util['format'](_0x32b8('0x193'),_0x41e410[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x41e410[_0x32b8('0x194')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x195'));}var _0xec689a=this[_0x32b8('0x196')][_0x32b8('0x6a')](this,_0x41e410[_0x32b8('0x194')]);if(!_0xec689a){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x41e410,'no\x20sms\x20account\x20found');}var _0xc209bd={'body':_0x41e410['sms_text'],'phone':_0x41e410['to']||'','SmsAccountId':_0xec689a['id']};logger[_0x32b8('0xd8')](_0x32b8('0x197'),JSON[_0x32b8('0x6d')](_0xc209bd));this[_0x32b8('0x30')]['sync'](this,_0x41e410,_0x41e410[_0x32b8('0x194')]);this['channel'][_0x32b8('0xa4')](util['format'](_0x32b8('0x198'),_0xec689a[_0x32b8('0x12')]));this[_0x32b8('0x2f')]['sync'](this,_0xc209bd);return this[_0x32b8('0x31')]['noop'](_0x32b8('0x199'));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x19a')]=function(_0x1b1e29){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x19b'),_0x1b1e29[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0x1b1e29[_0x32b8('0xd2')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x1b1e29,_0x32b8('0x19c'));}var _0x1a7098=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x1b1e29[_0x32b8('0xd2')]);if(!_0x1a7098){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x1b1e29,_0x32b8('0x10f'));}return this[_0x32b8('0x31')][_0x32b8('0x97')](_0x1a7098,_0x1b1e29['variable_value']);};AGIVertices[_0x32b8('0x16')][_0x32b8('0x19d')]=function(_0x1bc2fb){logger['info'](util['format'](_0x32b8('0x19e'),_0x1bc2fb['label']));this[_0x32b8('0x31')]['noop'](_0x32b8('0x19f'));var _0x5d570f=this[_0x32b8('0x31')][_0x32b8('0xd')]('XMCS-UNIQUEID');if(!_[_0x32b8('0x3f')](_0x5d570f[_0x32b8('0x9c')])){this['channel']['uniqueid']=_0x5d570f[_0x32b8('0x9c')];}if(_0x1bc2fb[_0x32b8('0xb2')]===_0x32b8('0x1a0')){this[_0x32b8('0x31')]['noop']('Answer');return this[_0x32b8('0x31')][_0x32b8('0xb2')]();}return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0x1a1'));};AGIVertices['prototype'][_0x32b8('0x1a2')]=function(_0x4e2706){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x1a3'),_0x4e2706[_0x32b8('0x32')]));if(!this['isConfigured'](_0x4e2706[_0x32b8('0x1a4')])){return this['channel']['error'](_0x4e2706,_0x32b8('0x1a5'));}var _0x1ef7bf=this['getSquareProject'][_0x32b8('0x6a')](this,_0x4e2706[_0x32b8('0x1a4')]);if(!this[_0x32b8('0x7d')](_0x1ef7bf)){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4e2706,util['format'](_0x32b8('0x1a6'),_0x4e2706[_0x32b8('0x1a4')]));}if(_0x1ef7bf===this[_0x32b8('0x31')][_0x32b8('0x3b')]){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4e2706,_0x32b8('0x1a7'));}this['createSquareDetailsReport'][_0x32b8('0x6a')](this,_0x4e2706,_0x1ef7bf);var _0xd2fce2=this['channel'][_0x32b8('0xaa')]('AGI',util['format'](_0x32b8('0x1a8'),config[_0x32b8('0x5')]['host']||_0x32b8('0x1a9'),_0x1ef7bf,this[_0x32b8('0x31')][_0x32b8('0x3b')]));if(_0xd2fce2[_0x32b8('0x9e')]===-0x1){return _0xd2fce2;}return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xbd'),_0x32b8('0x1aa'),_0x1ef7bf));};AGIVertices[_0x32b8('0x16')]['system']=function(_0x5ac6b2){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x1ab'),_0x5ac6b2[_0x32b8('0x32')]));var _0x4d4dc1=this[_0x32b8('0x1ac')][_0x32b8('0x6a')](this,_0x5ac6b2[_0x32b8('0xb0')]);this[_0x32b8('0x30')][_0x32b8('0x6a')](this,_0x5ac6b2,_0x5ac6b2[_0x32b8('0xb0')]);if(this[_0x32b8('0x7d')](_0x5ac6b2['variable_id'])){var _0x1bab8c=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0x5ac6b2[_0x32b8('0xd2')]);if(_0x1bab8c){this[_0x32b8('0x31')][_0x32b8('0x97')](_0x1bab8c,_0x4d4dc1);return this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x1ad'),_0x5ac6b2[_0x32b8('0xb0')],_0x1bab8c));}}return this['channel'][_0x32b8('0xa4')](util['format'](_0x32b8('0x1ae'),_0x5ac6b2[_0x32b8('0xb0')]));};AGIVertices[_0x32b8('0x16')][_0x32b8('0x1af')]=function(_0x4c1d96){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x1b0'),_0x4c1d96[_0x32b8('0x32')]));_0x4c1d96[_0x32b8('0x56')]=_0x4c1d96['text'][_0x32b8('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x32b8('0x7d')](_0x4c1d96[_0x32b8('0x55')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0x1b1'));}if(!this[_0x32b8('0x7d')](_0x4c1d96[_0x32b8('0x56')])){return this[_0x32b8('0x31')][_0x32b8('0xa4')](_0x32b8('0xa2'));}this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x4c1d96[_0x32b8('0x56')]));var _0x16a8c5=this['googleCloudTTS'][_0x32b8('0x6a')](this,_0x4c1d96);if(_0x16a8c5){this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format']('Google\x20Cloud\x20TTS\x20%s\x20file\x20created',_0x16a8c5));var _0x214267=this[_0x32b8('0x31')]['streamFile'](_0x16a8c5);try{fs[_0x32b8('0x11d')](_0x16a8c5+_0x32b8('0xfc'));}catch(_0x3aabdf){logger[_0x32b8('0x2e')](_0x3aabdf);}return _0x214267;}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x4c1d96,_0x32b8('0x1b2'));};AGIVertices[_0x32b8('0x16')]['tts']=function(_0x179cb3){logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x1b3'),_0x179cb3['label']));_0x179cb3[_0x32b8('0x56')]=_0x179cb3[_0x32b8('0x56')][_0x32b8('0x53')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x32b8('0x7d')](_0x179cb3[_0x32b8('0x56')])){return this[_0x32b8('0x31')]['noop'](_0x32b8('0xa2'));}this[_0x32b8('0x31')][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x1b4'),_0x179cb3[_0x32b8('0x56')]));var _0x2a2120=this[_0x32b8('0x5d')][_0x32b8('0x6a')](this,_0x179cb3);if(_0x2a2120){this[_0x32b8('0x31')][_0x32b8('0xa4')](util['format'](_0x32b8('0x1b5'),_0x2a2120));var _0x4afef6=this[_0x32b8('0x31')]['streamFile'](_0x2a2120);try{fs[_0x32b8('0x11d')](_0x2a2120+_0x32b8('0xfc'));}catch(_0x20c503){logger[_0x32b8('0x2e')](_0x20c503);}return _0x4afef6;}return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x179cb3,_0x32b8('0x1b6'));};AGIVertices['prototype'][_0x32b8('0x1b7')]=function(_0x228417){logger['info'](util['format']('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x228417['label']));if(!this[_0x32b8('0x7d')](_0x228417[_0x32b8('0x14e')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0x228417,'no\x20find\x20by\x20configured');}logger[_0x32b8('0x29')](util[_0x32b8('0x26')](_0x32b8('0x150'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));var _0x4744c7=this[_0x32b8('0x4b')][_0x32b8('0x6a')](this,_0x228417[_0x32b8('0x14e')]);if(_0x4744c7){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0x151'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));return{'code':0xc8,'result':_0x32b8('0x155')};}else{logger[_0x32b8('0x29')](util['format'](_0x32b8('0x152'),this['channel'][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));this[_0x32b8('0x31')]['noop'](util[_0x32b8('0x26')](_0x32b8('0x152'),this[_0x32b8('0x31')][_0x32b8('0x34')],_0x228417[_0x32b8('0x14e')]));return{'code':0xc8,'result':_0x32b8('0x1b8')};}};AGIVertices[_0x32b8('0x16')][_0x32b8('0x1b9')]=function(_0x353bfa){logger[_0x32b8('0x29')](util['format'](_0x32b8('0x1ba'),_0x353bfa['label']));var _0x30de5c=this[_0x32b8('0x31')]['exec'](_0x32b8('0x1bb'),[_0x353bfa['mailbox'],_0x353bfa[_0x32b8('0x73')]]);if(_0x30de5c['result']===-0x1){return _0x30de5c;}return this['channel'][_0x32b8('0xa4')](util[_0x32b8('0x26')](_0x32b8('0xbd'),'VOICEMAIL',_0x353bfa['mailbox']));};AGIVertices['prototype'][_0x32b8('0x1bc')]=function(_0xdf2888){logger['info'](util[_0x32b8('0x26')](_0x32b8('0x1bd'),_0xdf2888[_0x32b8('0x32')]));if(!this[_0x32b8('0x7d')](_0xdf2888[_0x32b8('0xd2')])){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xdf2888,_0x32b8('0x19c'));}var _0x118bf5=this[_0x32b8('0xd')][_0x32b8('0x6a')](this,_0xdf2888[_0x32b8('0xd2')]);if(!_0x118bf5){return this[_0x32b8('0x31')][_0x32b8('0x2e')](_0xdf2888,_0x32b8('0x10f'));}var _0xd9151b=this[_0x32b8('0x31')][_0x32b8('0xd')](_0x118bf5);return{'code':0xc8,'result':_0xd9151b[_0x32b8('0x9c')]?_0xd9151b[_0x32b8('0x9c')]:'-'};};String[_0x32b8('0x16')][_0x32b8('0x9b')]=function(_0x7ed552,_0x428395){return this[_0x32b8('0x99')](_0x7ed552)['join'](_0x428395);};module['exports']=AGIVertices; \ No newline at end of file +var _0x0c02=['TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','continueAt','gotoif','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','math\x20%s','isArray','%s[%s]','variable\x20%s[key]\x20set','response','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','agentPause','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','queue_id','no\x20queue\x20selected','getVoiceQueue','indexOf','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','email','user','bcc','template_id','sendMail\x20message','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','sms_account_id','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','START\x20CALLY\x20SQUARE','XMCS-UNIQUEID','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','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','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Trying\x20Google\x20TTS\x20%s','googleTTS','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','lodash','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','channel','rpc','mailRpc','getVariableById','then','name','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','prototype','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','interval','map','Intervals','%s/sounds/converted/%s','error','info','query','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','createSquareRecording','callerid','context','extension','accountcode','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','list_id','callback','scheduledAt','toString','callback_priority','getPause','agent','agentUnpause','agentLogout','internal','format','%s/%s@from-sip/n','LOCAL','agentLogin','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','en-US','ssmlGender','MALE','audioEncoding','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','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','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','options','googleDialogflow','key','dialogflow_language','googleDialogflowV2','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_access_key_id','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','google_asr_language','tildeASR','appid','appsecret','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','isPlainObject','recursiveNodeIndex','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','getVariable','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','result','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','exec','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','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\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','dialogflowV2_project_id','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','getdigits','retry','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','unlink','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','no\x20key\x20configured','%s/recordings/%s','beep','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav'];(function(_0x1199b0,_0x18b4b8){var _0x1bbd4e=function(_0x58610e){while(--_0x58610e){_0x1199b0['push'](_0x1199b0['shift']());}};_0x1bbd4e(++_0x18b4b8);}(_0x0c02,0x84));var _0x20c0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0c02[_0x3dd15e];return _0x231fd0;};'use strict';var fs=require('fs');var util=require('util');var _=require(_0x20c0('0x0'));var sh=require(_0x20c0('0x1'));var odbc=require('odbc')();var rs=require(_0x20c0('0x2'));var moment=require(_0x20c0('0x3'));var Mustache=require(_0x20c0('0x4'));var rp=require(_0x20c0('0x5'));var logger=require(_0x20c0('0x6'))(_0x20c0('0x7'));var config=require(_0x20c0('0x8'));var scripts=require(_0x20c0('0x9'));var FILES_PATH=_0x20c0('0xa');var recursiveMapAttributes=[_0x20c0('0xb'),'rawBody'];var verticesWithRetry=['menu','getdigits','getsecretdigits'];var AGIVertices=function(_0x1e35e2,_0x276e9b,_0xcdc174){this[_0x20c0('0xc')]=_0x1e35e2;this[_0x20c0('0xd')]=_0x276e9b;this[_0x20c0('0xe')]=_0xcdc174;};AGIVertices['prototype']['getVariable']=function(_0x52eb0d,_0x578592){this['rpc'][_0x20c0('0xf')](_0x52eb0d)[_0x20c0('0x10')](function(_0x2ecab9){_0x578592(null,_0x2ecab9?_0x2ecab9[_0x20c0('0x11')]:![]);})['catch'](function(_0x56fa09){_0x578592(_0x56fa09);});};AGIVertices['prototype']['getVoiceQueue']=function(_0x34a930,_0xfc2d9c){this[_0x20c0('0xd')][_0x20c0('0x12')](_0x34a930)[_0x20c0('0x10')](function(_0x1e6662){_0xfc2d9c(null,_0x1e6662?_0x1e6662[_0x20c0('0x11')]:![]);})[_0x20c0('0x13')](function(_0x280aff){_0xfc2d9c(_0x280aff);});};AGIVertices['prototype'][_0x20c0('0x14')]=function(_0xc78626,_0x1a708e){this[_0x20c0('0xd')][_0x20c0('0x15')](_0xc78626)[_0x20c0('0x10')](function(_0x5d6d18){_0x1a708e(null,_0x5d6d18?_0x5d6d18['name']:![]);})['catch'](function(_0x10a921){_0x1a708e(_0x10a921);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x17')]=function(_0x43a885,_0x5b3725){this[_0x20c0('0xd')][_0x20c0('0x18')](_0x43a885)[_0x20c0('0x10')](function(_0x5851eb){_0x5b3725(null,_0x5851eb?_0x5851eb['dsn']:![]);})[_0x20c0('0x13')](function(_0x108973){_0x5b3725(_0x108973);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x19')]=function(_0x36ed49,_0x53d8e8){this[_0x20c0('0xd')][_0x20c0('0x1a')](_0x36ed49)[_0x20c0('0x10')](function(_0x8a887a){_0x53d8e8(null,_0x8a887a?_0x8a887a['name']:![]);})[_0x20c0('0x13')](function(_0x3e545c){_0x53d8e8(_0x3e545c);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x1b')]=function(_0x44642a,_0x41ab51){this[_0x20c0('0xd')]['getTrunkById'](_0x44642a)[_0x20c0('0x10')](function(_0x595d94){_0x41ab51(null,_0x595d94?_0x595d94[_0x20c0('0x11')]:![]);})[_0x20c0('0x13')](function(_0x11da5a){_0x41ab51(_0x11da5a);});};AGIVertices[_0x20c0('0x16')]['getSound']=function(_0x4e0cbb,_0x3012d5){var _0x198bdd=this;this[_0x20c0('0xd')]['getSoundById'](_0x4e0cbb)[_0x20c0('0x10')](function(_0x25592b){_0x3012d5(null,_0x25592b?_0x198bdd[_0x20c0('0x1c')](_0x25592b[_0x20c0('0x1d')]):![]);})['catch'](function(_0x49b738){_0x3012d5(_0x49b738);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x1e')]=function(_0x3edc22,_0xe961ad){this[_0x20c0('0xd')][_0x20c0('0x1f')](_0x3edc22)[_0x20c0('0x10')](function(_0x40c0a7){_0xe961ad(null,_0x40c0a7?_0x40c0a7:![]);})[_0x20c0('0x13')](function(_0x191ad8){_0xe961ad(_0x191ad8);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x20')]=function(_0x1fef93,_0x45fa64,_0x55ede5){this[_0x20c0('0xe')][_0x20c0('0x20')](_0x1fef93,_0x45fa64)[_0x20c0('0x10')](function(){_0x55ede5(null);})[_0x20c0('0x13')](function(_0x59406e){_0x55ede5(_0x59406e);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x21')]=function(_0x355db9,_0x1ba29e){this[_0x20c0('0xd')]['getIntervalById'](_0x355db9)[_0x20c0('0x10')](function(_0x538595){if(_0x538595){if(_0x538595['IntervalId']){_0x1ba29e(null,[_0x538595[_0x20c0('0x22')]]);}else{_0x1ba29e(null,_[_0x20c0('0x23')](_0x538595[_0x20c0('0x24')],_0x20c0('0x22')));}}else{_0x1ba29e(null,![]);}})[_0x20c0('0x13')](function(_0x39fd84){_0x1ba29e(_0x39fd84);});};AGIVertices[_0x20c0('0x16')]['getSoundPath']=function(_0x5f4cc9){return util['format'](_0x20c0('0x25'),FILES_PATH,_0x5f4cc9);};AGIVertices[_0x20c0('0x16')]['getQueryOdbc']=function(_0x346a04,_0x20d6f3,_0x550d2c){odbc['open'](_0x346a04,function(_0x700675){if(_0x700675){logger[_0x20c0('0x26')]('Error\x20getting\x20ODBC\x20connection\x20%s',_0x700675);_0x550d2c(_0x700675);}else{logger[_0x20c0('0x27')]('ODBC\x20connection\x20successfully');odbc[_0x20c0('0x28')](_0x20d6f3,function(_0x31bf03,_0xcaa484){if(_0x31bf03){logger[_0x20c0('0x27')]('Error\x20executing\x20query\x20%s',_0x20d6f3);_0x550d2c(_0x31bf03);}else{logger[_0x20c0('0x27')](_0x20c0('0x29'),_0x20d6f3);odbc[_0x20c0('0x2a')](function(_0x415b41){if(_0x415b41){logger[_0x20c0('0x26')](_0x20c0('0x2b'),_0x415b41);}_0x550d2c(null,_0xcaa484);});}});}});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x2c')]=function(_0x57bb71,_0x52664c){this['rpc'][_0x20c0('0x2d')](_0x57bb71)['then'](function(_0x438a22){_0x52664c(null,_0x438a22?_0x438a22:![]);})[_0x20c0('0x13')](function(_0x88863){_0x52664c(_0x88863);});};AGIVertices[_0x20c0('0x16')]['createSmsMessage']=function(_0x178d92,_0x5bf7b8){this['rpc'][_0x20c0('0x2e')](_0x178d92)[_0x20c0('0x10')](function(_0x456d28){_0x5bf7b8(null,_0x456d28);})[_0x20c0('0x13')](function(_0x5c06c4){_0x5bf7b8(_0x5c06c4);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x2f')]=function(_0x39852a,_0x1ef892,_0x4df560){this[_0x20c0('0xd')][_0x20c0('0x2f')]({'uniqueid':this['channel'][_0x20c0('0x30')],'node':_0x39852a[_0x20c0('0x31')],'application':_0x39852a[_0x20c0('0x32')],'data':_0x1ef892||null,'project_name':this['channel'][_0x20c0('0x33')],'callerid':this['channel']['callerid']})['then'](function(_0x36ccf2){if(_0x4df560){_0x4df560(null,_0x36ccf2);}})['catch'](function(_0x12945c){if(_0x4df560){_0x4df560(_0x12945c);}});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x34')]=function(_0x3e5c62,_0x15f299,_0x2c95a4,_0x267f97){this['rpc'][_0x20c0('0x34')]({'uniqueid':this[_0x20c0('0xc')][_0x20c0('0x30')],'callerid':this[_0x20c0('0xc')][_0x20c0('0x35')],'calleridname':this[_0x20c0('0xc')]['calleridname'],'context':this['channel'][_0x20c0('0x36')],'extension':this[_0x20c0('0xc')][_0x20c0('0x37')],'priority':this['channel']['priority'],'accountcode':this[_0x20c0('0xc')][_0x20c0('0x38')],'dnid':this[_0x20c0('0xc')]['dnid'],'projectName':this[_0x20c0('0xc')][_0x20c0('0x33')],'saveName':_0x15f299,'filename':_0x3e5c62['file']||_0x15f299,'savePath':_0x2c95a4})['then'](function(_0x3fb4f1){_0x267f97(null,_0x3fb4f1);})['catch'](function(_0xdd2a3b){_0x267f97(_0xdd2a3b);});};AGIVertices['prototype'][_0x20c0('0x39')]=function(_0x425953,_0x5dd76d,_0x555e5a,_0x18810f,_0x149376){this[_0x20c0('0xd')][_0x20c0('0x39')]({'uniqueid':this[_0x20c0('0xc')][_0x20c0('0x30')],'body':_0x425953,'direction':_0x5dd76d,'providerName':_0x555e5a,'providerResponse':_0x18810f})[_0x20c0('0x10')](function(_0x20faa2){if(_0x149376){_0x149376(null,_0x20faa2);}})['catch'](function(_0x24b5f5){if(_0x149376){_0x149376(_0x24b5f5);}});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x3a')]=function(_0xe50137,_0x2c3404){this['rpc']['createCmContact']({'firstName':_[_0x20c0('0x3b')](_0xe50137[_0x20c0('0x11')])||_[_0x20c0('0x3c')](_0xe50137[_0x20c0('0x11')])?_0x20c0('0x3d')+Math[_0x20c0('0x3e')]():_0xe50137[_0x20c0('0x11')],'lastName':_['isEmpty'](_0xe50137['lastName'])||_[_0x20c0('0x3c')](_0xe50137[_0x20c0('0x3f')])?null:_0xe50137[_0x20c0('0x3f')],'phone':_0xe50137['phone'],'ListId':_0xe50137[_0x20c0('0x40')],'scheduledat':_0xe50137['scheduledAt'],'callbackUniqueid':this[_0x20c0('0xc')][_0x20c0('0x30')],'tags':_0x20c0('0x41'),'description':'Callback\x20scheduled\x20at\x20'+_0xe50137[_0x20c0('0x42')][_0x20c0('0x43')](),'priority':_0xe50137[_0x20c0('0x44')]})[_0x20c0('0x10')](function(_0x1e62e3){_0x2c3404(null,_0x1e62e3);})['catch'](function(_0xe7a292){_0x2c3404(_0xe7a292);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x45')]=function(_0x1aafc3,_0x57f482){this[_0x20c0('0xd')]['getPauseById'](_0x1aafc3)[_0x20c0('0x10')](function(_0x5d40c9){_0x57f482(null,_0x5d40c9?_0x5d40c9[_0x20c0('0x11')]:![]);})[_0x20c0('0x13')](function(_0x2cf512){_0x57f482(_0x2cf512);});};AGIVertices[_0x20c0('0x16')]['agentPause']=function(_0x371cbb,_0xcd87e8,_0x1e1c4b){var _0x12f2d2={'role':_0x20c0('0x46')};_0x12f2d2[_0x371cbb]=this[_0x20c0('0xc')][_0x20c0('0x35')];this[_0x20c0('0xd')]['agentPause'](_0x12f2d2,_0xcd87e8,this[_0x20c0('0xc')][_0x20c0('0x30')])[_0x20c0('0x10')](function(_0x56e1f6){_0x1e1c4b(null,_[_0x20c0('0x3c')](_0x56e1f6)?![]:!![]);})[_0x20c0('0x13')](function(_0x57ca28){logger[_0x20c0('0x26')](_0x57ca28);_0x1e1c4b(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x5ee9cf,_0x558d5c){var _0x13093a={'role':_0x20c0('0x46')};_0x13093a[_0x5ee9cf]=this[_0x20c0('0xc')][_0x20c0('0x35')];this[_0x20c0('0xd')][_0x20c0('0x47')](_0x13093a)[_0x20c0('0x10')](function(_0x247dee){_0x558d5c(null,_[_0x20c0('0x3c')](_0x247dee)?![]:!![]);})['catch'](function(_0x32d445){logger[_0x20c0('0x26')](_0x32d445);_0x558d5c(null,![]);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x48')]=function(_0x2fd893,_0x189c6b){var _0x788e01={'role':_0x20c0('0x46')};_0x788e01[_0x2fd893]=this[_0x20c0('0xc')][_0x20c0('0x35')];this['rpc'][_0x20c0('0x48')](_0x788e01)[_0x20c0('0x10')](function(_0x1ae801){_0x189c6b(null,_[_0x20c0('0x3c')](_0x1ae801)?![]:!![]);})['catch'](function(_0x488e79){logger[_0x20c0('0x26')](_0x488e79);_0x189c6b(null,![]);});};AGIVertices[_0x20c0('0x16')]['agentLogin']=function(_0x2222eb,_0x4bc360){var _0x12080a={'role':_0x20c0('0x46')};_0x12080a[_0x2222eb]=this[_0x20c0('0xc')]['callerid'];var _0x59c854=_0x2222eb!=_0x20c0('0x49')?util[_0x20c0('0x4a')](_0x20c0('0x4b'),_0x20c0('0x4c'),this['channel']['callerid']):undefined;this['rpc'][_0x20c0('0x4d')](_0x12080a,_0x59c854)[_0x20c0('0x10')](function(_0x3c0b96){_0x4bc360(null,_['isNil'](_0x3c0b96)?![]:!![]);})['catch'](function(_0x21dbbf){logger[_0x20c0('0x26')](_0x21dbbf);_0x4bc360(null,![]);});};AGIVertices['prototype'][_0x20c0('0x4e')]=function(_0x57d80e,_0x4b2199){sh['exec'](_[_0x20c0('0x4f')](_0x57d80e),function(_0x4bb071,_0x2d7c27){var _0x4f2868=_0x2d7c27[_0x20c0('0x50')](/(\r\n|\n|\r)/gm,'');_0x4b2199(null,_0x4f2868);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x51')]=function(_0x47efdb,_0x589b56){scripts[_0x20c0('0x51')](_0x47efdb[_0x20c0('0x52')],_0x47efdb[_0x20c0('0x53')]||_0x20c0('0x54'),_0x47efdb['text'],_0x47efdb['languageCode']||_0x20c0('0x55'),_0x47efdb[_0x20c0('0x56')]||_0x20c0('0x57'),_0x47efdb[_0x20c0('0x58')]||'MP3')[_0x20c0('0x10')](function(_0x15a774){_0x589b56(null,_0x15a774);})[_0x20c0('0x13')](function(_0x4c83c0){_0x589b56(_0x4c83c0);});};AGIVertices['prototype']['googleTTS']=function(_0x39a28e,_0xe3c380){scripts['googleTTS'](_0x39a28e['text'],_0x39a28e[_0x20c0('0x59')]||'en',0x1)['then'](function(_0x5c0d59){_0xe3c380(null,_0x5c0d59);})[_0x20c0('0x13')](function(_0x45ca41){_0xe3c380(_0x45ca41);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x5a')]=function(_0x261212,_0x45f1ad){var _0x15c42e={'uri':_0x261212[_0x20c0('0x5b')],'method':_0x261212[_0x20c0('0x5c')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x261212[_0x20c0('0x5d')])===_0x20c0('0x5e')&&parseInt(_0x261212['timeout'])>=0x1?parseInt(_0x261212[_0x20c0('0x5d')])*0x3e8:0x5*0x3e8};if(_[_0x20c0('0x5f')]([_0x20c0('0x60'),_0x20c0('0x61')],_0x15c42e['method'][_0x20c0('0x62')]())){try{_0x15c42e[_0x20c0('0x63')]=_0x261212[_0x20c0('0x64')]?JSON[_0x20c0('0x65')](_0x261212[_0x20c0('0x64')]):{};}catch(_0x1566ce){logger[_0x20c0('0x26')](_0x20c0('0x66'),_0x1566ce);}}try{_0x15c42e[_0x20c0('0x67')]=_0x261212[_0x20c0('0xb')]?JSON[_0x20c0('0x65')](_0x261212[_0x20c0('0xb')]):{};}catch(_0x1d4e3d){logger[_0x20c0('0x26')](_0x20c0('0x68'),_0x1d4e3d);}if(_0x261212[_0x20c0('0x69')]){try{var _0x39bb39=require(_0x261212[_0x20c0('0x69')])[_0x20c0('0x6a')](this,_0x15c42e);_0x15c42e[_0x20c0('0x6b')]=Mustache[_0x20c0('0x6c')](_0x261212['url'],_0x39bb39,{},['$$','$$']);if(_0x15c42e['headers']){_0x15c42e[_0x20c0('0x67')]=JSON[_0x20c0('0x65')](Mustache[_0x20c0('0x6c')](JSON[_0x20c0('0x6d')](_0x15c42e['headers']),_0x39bb39,{},['$$','$$']));}if(_0x15c42e[_0x20c0('0x63')]){_0x15c42e[_0x20c0('0x63')]=JSON[_0x20c0('0x65')](Mustache['render'](JSON['stringify'](_0x15c42e[_0x20c0('0x63')]),_0x39bb39,{},['$$','$$']));}}catch(_0x38cef7){logger[_0x20c0('0x26')](_0x20c0('0x6e'),_0x38cef7);}}rp(_0x15c42e)['then'](function(_0x525a83){var _0xe08378={'statusCode':_0x525a83[_0x20c0('0x6f')]||0xc8,'statusMessage':_0x525a83[_0x20c0('0x70')]||'OK','headers':_0x525a83[_0x20c0('0x67')]||{},'body':_0x525a83[_0x20c0('0x63')]||{}};_0x45f1ad(null,_0xe08378);})[_0x20c0('0x13')](function(_0x563134){var _0x3c8744={'statusCode':_0x563134[_0x20c0('0x6f')]||0x1f4,'statusMessage':_0x563134['message']||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x563134[_0x20c0('0x71')]['headers']||{},'body':_0x563134[_0x20c0('0x71')][_0x20c0('0x63')]||{}};_0x45f1ad(null,_0x3c8744);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x72')]=function(_0x1f2408,_0x415137){scripts[_0x20c0('0x72')](this[_0x20c0('0xc')]['uniqueid'],_0x1f2408[_0x20c0('0x73')],_0x1f2408[_0x20c0('0x54')],_0x1f2408[_0x20c0('0x74')]||'en')[_0x20c0('0x10')](function(_0x540174){_0x415137(null,_0x540174);})['catch'](function(_0x5c28ad){_0x415137(_0x5c28ad);});};AGIVertices['prototype'][_0x20c0('0x75')]=function(_0x13c005,_0x4bb5df){scripts['googleDialogflowV2'](this[_0x20c0('0xc')]['uniqueid'],_0x13c005['dialogflowV2_project_id'],_0x13c005[_0x20c0('0x76')],_0x13c005[_0x20c0('0x77')],_0x13c005[_0x20c0('0x54')],_0x13c005[_0x20c0('0x78')]||'en')[_0x20c0('0x10')](function(_0x5d9308){_0x4bb5df(null,_0x5d9308);})[_0x20c0('0x13')](function(_0x3f5330){_0x4bb5df(_0x3f5330);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x79')]=function(_0xc7b414,_0x219940){scripts['sestekNDA'](this[_0x20c0('0xc')],_0xc7b414)[_0x20c0('0x10')](function(_0x57fc4b){_0x219940(null,_0x57fc4b);})[_0x20c0('0x13')](function(_0x159309){_0x219940(_0x159309);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x7a')]=function(_0x221018,_0x3ca6fc){scripts[_0x20c0('0x7a')](_0x221018[_0x20c0('0x73')],_0x221018[_0x20c0('0x54')],_0x221018[_0x20c0('0x7b')]||'en-US',_0x221018[_0x20c0('0x7c')])[_0x20c0('0x10')](function(_0x33e6c9){_0x3ca6fc(null,_0x33e6c9);})[_0x20c0('0x13')](function(_0x152f19){_0x3ca6fc(_0x152f19);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x7d')]=function(_0x23b6e8,_0x582ec4,_0x8c369f){scripts[_0x20c0('0x7d')](_0x582ec4,_0x23b6e8[_0x20c0('0x73')],_0x23b6e8[_0x20c0('0x7e')]||_0x20c0('0x55'),this[_0x20c0('0x7f')](_0x23b6e8[_0x20c0('0x80')])?_0x23b6e8[_0x20c0('0x80')]:undefined)['then'](function(_0x4c670c){_0x8c369f(null,_0x4c670c);})[_0x20c0('0x13')](function(_0x1d9116){_0x8c369f(_0x1d9116);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x81')]=function(_0x44add1,_0x59b9ee){scripts[_0x20c0('0x81')](_0x44add1[_0x20c0('0x82')],_0x44add1['aws_secret_access_key'],_0x44add1[_0x20c0('0x83')],_0x44add1[_0x20c0('0x84')]||_0x20c0('0x85'),_0x44add1[_0x20c0('0x54')],_0x44add1[_0x20c0('0x86')]||_0x20c0('0x54'))[_0x20c0('0x10')](function(_0x20b90a){_0x59b9ee(null,_0x20b90a);})['catch'](function(_0x2833f3){_0x59b9ee(_0x2833f3);});};AGIVertices['prototype'][_0x20c0('0x87')]=function(_0x3ec63a,_0x3747b1){scripts[_0x20c0('0x87')](this[_0x20c0('0xc')][_0x20c0('0x30')],_0x3ec63a['aws_access_key_id'],_0x3ec63a[_0x20c0('0x88')],_0x3ec63a[_0x20c0('0x89')],_0x3ec63a['text'],_0x3ec63a[_0x20c0('0x8a')])[_0x20c0('0x10')](function(_0x28c5ea){_0x3747b1(null,_0x28c5ea);})['catch'](function(_0x5e9d54){_0x3747b1(_0x5e9d54);});};AGIVertices[_0x20c0('0x16')][_0x20c0('0x8b')]=function(_0x16f70e,_0x223ede,_0x597b32){scripts[_0x20c0('0x8b')](_0x223ede,_0x16f70e[_0x20c0('0x73')],_0x16f70e[_0x20c0('0x8c')]||'en-US')[_0x20c0('0x10')](function(_0x1deed5){_0x597b32(null,_0x1deed5);})['catch'](function(_0x46423a){_0x597b32(_0x46423a);});};AGIVertices['prototype'][_0x20c0('0x8d')]=function(_0x193489,_0x280ce0,_0x485db3){scripts['tildeASR'](_0x280ce0,_0x193489[_0x20c0('0x8e')],_0x193489[_0x20c0('0x8f')],_0x193489[_0x20c0('0x6b')])[_0x20c0('0x10')](function(_0x2321a7){_0x485db3(null,_0x2321a7);})[_0x20c0('0x13')](function(_0x16341d){_0x485db3(_0x16341d);});};AGIVertices[_0x20c0('0x16')]['clear']=function(_0x5860ca){var _0x15b0c6=_[_0x20c0('0x5f')](verticesWithRetry,_0x5860ca[_0x20c0('0x32')])?_0x5860ca:_[_0x20c0('0x90')](_0x5860ca);for(var _0x16a426 in _0x15b0c6){if(_0x15b0c6[_0x20c0('0x91')](_0x16a426)){if(_0x15b0c6[_0x16a426]&&_[_0x20c0('0x92')](_0x15b0c6[_0x16a426])){if(_[_0x20c0('0x5f')](recursiveMapAttributes,_0x16a426)){_0x15b0c6[_0x16a426]=this[_0x20c0('0x93')](_0x15b0c6[_0x16a426]);}else{_0x15b0c6[_0x16a426]=this[_0x20c0('0x94')](_0x15b0c6[_0x16a426]);}}}}return _0x15b0c6;};AGIVertices[_0x20c0('0x16')]['recursiveNodeIndex']=function(_0x4c243e){for(var _0x4d1d09 in _0x4c243e){if(_0x4c243e[_0x20c0('0x91')](_0x4d1d09)){if(_[_0x20c0('0x95')](_0x4c243e[_0x4d1d09])){this[_0x20c0('0x96')](_0x4c243e[_0x4d1d09]);}else if(_['isArray'](_0x4c243e[_0x4d1d09])){for(var _0x177a33=0x0;_0x177a33<_0x4c243e[_0x4d1d09][_0x20c0('0x97')];_0x177a33++){this[_0x20c0('0x96')](_0x4c243e[_0x4d1d09][_0x177a33]);}}else if(_['isString'](_0x4c243e[_0x4d1d09])){_0x4c243e[_0x4d1d09]=this[_0x20c0('0x94')](_0x4c243e[_0x4d1d09]);}}}};AGIVertices[_0x20c0('0x16')][_0x20c0('0x98')]=function(_0x32cab3,_0x485997){for(var _0x12463d in _0x32cab3){if(_0x32cab3[_0x20c0('0x91')](_0x12463d)){if(_[_0x20c0('0x95')](_0x32cab3[_0x12463d])){if(!_[_0x20c0('0x3b')](_0x32cab3[_0x12463d])){this[_0x20c0('0x98')](_0x32cab3[_0x12463d],util[_0x20c0('0x4a')](_0x20c0('0x99'),_0x485997,_0x12463d));}}else if(_['isArray'](_0x32cab3[_0x12463d])){for(var _0x35ee82=0x0;_0x35ee82<_0x32cab3[_0x12463d][_0x20c0('0x97')];_0x35ee82++){this[_0x20c0('0x98')](_0x32cab3[_0x12463d][_0x35ee82],util[_0x20c0('0x4a')](_0x20c0('0x99'),_0x485997,_0x12463d+'['+_0x35ee82+']'));}}else{if(!_['isNil'](_0x32cab3[_0x12463d])){this[_0x20c0('0xc')][_0x20c0('0x9a')](util[_0x20c0('0x4a')](_0x20c0('0x99'),_0x485997,_0x12463d),_0x32cab3[_0x12463d]);}}}}};AGIVertices[_0x20c0('0x16')][_0x20c0('0x93')]=function(_0x43a157){try{var _0x1c1023=JSON[_0x20c0('0x65')](_0x43a157);this[_0x20c0('0x96')](_0x1c1023);return JSON[_0x20c0('0x6d')](_0x1c1023);}catch(_0x554f70){return this['replaceAllVariables'](_0x43a157);}};AGIVertices[_0x20c0('0x16')][_0x20c0('0x94')]=function(_0x49373f){var _0x41eadc=_0x49373f[_0x20c0('0x9b')]('{');for(var _0x518983=0x1;_0x518983<_0x41eadc[_0x20c0('0x97')];_0x518983+=0x1){var _0x5ef019=_0x41eadc[_0x518983][_0x20c0('0x9b')]('}');if(_0x5ef019[_0x20c0('0x97')]>0x1){_0x49373f=_0x49373f[_0x20c0('0x9c')]('{'+_0x5ef019[0x0]+'}',this[_0x20c0('0xc')][_0x20c0('0x9d')](_0x5ef019[0x0])[_0x20c0('0x9e')]||_0x5ef019[0x0]);}}if(_0x41eadc[_0x20c0('0x97')]===0x1){return _0x49373f['toString']();}return this[_0x20c0('0x94')](_0x49373f);};AGIVertices[_0x20c0('0x16')][_0x20c0('0x9f')]=function(_0x297a3e,_0x4d7b8f){var _0xaf0fe0=this[_0x20c0('0xc')][_0x20c0('0x9d')](_0x297a3e);if(_0xaf0fe0['result']===-0x1){return _0xaf0fe0;}logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xa0'),_0x4d7b8f,_0xaf0fe0[_0x20c0('0x9e')]));return this['channel'][_0x20c0('0x9a')](_0x4d7b8f,_0xaf0fe0[_0x20c0('0x9e')]);};AGIVertices[_0x20c0('0x16')][_0x20c0('0x7f')]=function(_0x21a582){return _0x21a582&&_0x21a582!=='0'&&_0x21a582!=='-1'&&_0x21a582!=='';};AGIVertices[_0x20c0('0x16')][_0x20c0('0xa1')]=function(_0x306a52){this['createSquareDetailsReport'][_0x20c0('0x6a')](this,_0x306a52,'-');_0x306a52['retry']=_0x306a52[_0x20c0('0xa1')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x20c0('0x16')][_0x20c0('0xa2')]=function(_0x258898){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xa3'),_0x258898['label']));if(!this[_0x20c0('0x7f')](_0x258898[_0x20c0('0x54')])){return this[_0x20c0('0xc')]['noop'](_0x20c0('0xa4'));}var _0x25e11c='\x22'+_0x258898[_0x20c0('0x54')]+'\x22';if(this[_0x20c0('0x7f')](_0x258898['options'])){_0x25e11c+=','+_0x258898['options'];}var _0x5c6483=this[_0x20c0('0xc')]['exec'](_0x20c0('0xa5'),_0x25e11c);if(_0x5c6483[_0x20c0('0xa6')]===-0x1){return _0x5c6483;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xa8'),_0x25e11c));};AGIVertices[_0x20c0('0x16')][_0x20c0('0xa9')]=function(_0x5a7afb){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0xaa'),_0x5a7afb[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x5a7afb[_0x20c0('0xab')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xac'));}var _0x534840=_0x5a7afb[_0x20c0('0xab')];if(this[_0x20c0('0x7f')](_0x5a7afb[_0x20c0('0x71')])){_0x534840+=','+_0x5a7afb[_0x20c0('0x71')];}var _0x4f9060=this[_0x20c0('0xc')][_0x20c0('0xad')](_0x20c0('0xae'),_0x534840);if(_0x4f9060[_0x20c0('0xa6')]===-0x1){return _0x4f9060;}var _0x385673=this[_0x20c0('0x9f')](_0x20c0('0xaf'),_0x20c0('0xb0'));if(_0x385673[_0x20c0('0xa6')]===-0x1){return _0x385673;}var _0x52e18b=this[_0x20c0('0x9f')](_0x20c0('0xb1'),'MRCP_RECOG_TRANSCRIPT');if(_0x52e18b[_0x20c0('0xa6')]===-0x1){return _0x52e18b;}var _0x518162=this['getAndSetVariable'](_0x20c0('0xb2'),_0x20c0('0xb3'));if(_0x518162[_0x20c0('0xa6')]===-0x1){return _0x518162;}return this['channel'][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('Executed\x20command\x20MRCPRecog\x20%s',_0x534840));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x7')]=function(_0x4a7aaa){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xb4'),_0x4a7aaa[_0x20c0('0x31')]));return this[_0x20c0('0xc')][_0x20c0('0x7')]([_0x4a7aaa[_0x20c0('0xb5')],_0x4a7aaa[_0x20c0('0xb6')]]);};AGIVertices[_0x20c0('0x16')][_0x20c0('0xb7')]=function(_0xe175a5){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xb8'),_0xe175a5[_0x20c0('0x31')]));if(this[_0x20c0('0x7f')](_0xe175a5[_0x20c0('0x5d')])){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xb9'),_0xe175a5[_0x20c0('0x5d')]));var _0x613d7=this[_0x20c0('0xc')][_0x20c0('0xba')](_0xe175a5[_0x20c0('0x5d')]);if(_0x613d7[_0x20c0('0xa6')]===-0x1){return _0x613d7;}}return this['channel'][_0x20c0('0xb7')]();};AGIVertices['prototype'][_0x20c0('0x41')]=function(_0x328a3a){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0xbb'),_0x328a3a[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x328a3a[_0x20c0('0x40')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x328a3a,_0x20c0('0xbc'));}_0x328a3a[_0x20c0('0x42')]=moment();if(this[_0x20c0('0x7f')](_0x328a3a[_0x20c0('0xbd')])){_0x328a3a['scheduledAt']=moment()[_0x20c0('0xbe')](_0x328a3a[_0x20c0('0xbd')],_0x20c0('0xbf'));}if(!this[_0x20c0('0x7f')](_0x328a3a[_0x20c0('0x44')])){_0x328a3a[_0x20c0('0x44')]=0x2;}this['createCmContact']['sync'](this,_0x328a3a);return this[_0x20c0('0xc')][_0x20c0('0xa7')](util['format'](_0x20c0('0xc0'),_0x328a3a[_0x20c0('0xc1')],_0x328a3a[_0x20c0('0x40')],_0x328a3a[_0x20c0('0x42')]));};AGIVertices[_0x20c0('0x16')][_0x20c0('0xc2')]=function(_0x1c5cd0){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0xc3'),_0x1c5cd0[_0x20c0('0x31')]));var _0x11acd2=this[_0x20c0('0xc')]['exec'](_0x1c5cd0[_0x20c0('0xc4')],_0x1c5cd0[_0x20c0('0x71')]);if(_0x11acd2['result']===-0x1){return _0x11acd2;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xc5'),_0x1c5cd0['application'],_0x1c5cd0[_0x20c0('0x71')]));};AGIVertices[_0x20c0('0x16')]['lumenvoxtts']=function(_0x58ca8e){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0xc6'),_0x58ca8e[_0x20c0('0x31')]));if(!this['isConfigured'](_0x58ca8e[_0x20c0('0x54')])){return this['channel']['noop'](_0x20c0('0xa4'));}var _0x5879e1='\x22'+_0x58ca8e['text']+'\x22';if(this['isConfigured'](_0x58ca8e[_0x20c0('0x71')])){_0x5879e1+=','+_0x58ca8e[_0x20c0('0x71')];}var _0x429542=this[_0x20c0('0xc')][_0x20c0('0xad')](_0x20c0('0xa5'),_0x5879e1);if(_0x429542[_0x20c0('0xa6')]===-0x1){return _0x429542;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('Executed\x20command\x20MRCPSynth\x20%s',_0x5879e1));};AGIVertices[_0x20c0('0x16')][_0x20c0('0xc7')]=function(_0x209be0){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xc8'),_0x209be0['label']));if(!this[_0x20c0('0x7f')](_0x209be0[_0x20c0('0x54')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')]('no\x20text\x20configured');}var _0x52549c='\x22'+_0x209be0[_0x20c0('0x54')]+'\x22';if(this[_0x20c0('0x7f')](_0x209be0[_0x20c0('0x71')])){_0x52549c+=','+_0x209be0[_0x20c0('0x71')];}var _0x2704d=this['channel'][_0x20c0('0xad')](_0x20c0('0xa5'),_0x52549c);if(_0x2704d[_0x20c0('0xa6')]===-0x1){return _0x2704d;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xa8'),_0x52549c));};AGIVertices[_0x20c0('0x16')]['lumenvoxasr']=function(_0x425457){logger[_0x20c0('0x27')](util['format'](_0x20c0('0xc9'),_0x425457[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x425457[_0x20c0('0xab')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xac'));}var _0x2fa4e2=_0x425457[_0x20c0('0xab')];if(this[_0x20c0('0x7f')](_0x425457[_0x20c0('0x71')])){_0x2fa4e2+=','+_0x425457[_0x20c0('0x71')];}var _0x20e787=this[_0x20c0('0xc')][_0x20c0('0xad')](_0x20c0('0xae'),_0x2fa4e2);if(_0x20e787[_0x20c0('0xa6')]===-0x1){return _0x20e787;}var _0x59c0e5=this[_0x20c0('0x9f')](_0x20c0('0xaf'),_0x20c0('0xca'));if(_0x59c0e5[_0x20c0('0xa6')]===-0x1){return _0x59c0e5;}var _0x5f55be=this[_0x20c0('0x9f')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x5f55be['result']===-0x1){return _0x5f55be;}var _0x4fdd6f=this[_0x20c0('0x9f')]('RECOG_INSTANCE()',_0x20c0('0xcb'));if(_0x4fdd6f['result']===-0x1){return _0x4fdd6f;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xcc'),_0x2fa4e2));};AGIVertices[_0x20c0('0x16')][_0x20c0('0xcd')]=function(_0x21737b){logger[_0x20c0('0x27')](util['format'](_0x20c0('0xce'),_0x21737b['label']));if(!this[_0x20c0('0x7f')](_0x21737b[_0x20c0('0xab')])){return this['channel'][_0x20c0('0xa7')](_0x20c0('0xac'));}var _0x2a27b7=_0x21737b['grammar'];if(this[_0x20c0('0x7f')](_0x21737b[_0x20c0('0x71')])){_0x2a27b7+=','+_0x21737b['options'];}var _0x49f305=this['channel'][_0x20c0('0xad')](_0x20c0('0xae'),_0x2a27b7);if(_0x49f305['result']===-0x1){return _0x49f305;}var _0x313c2f=this[_0x20c0('0x9f')](_0x20c0('0xaf'),_0x20c0('0xcf'));if(_0x313c2f[_0x20c0('0xa6')]===-0x1){return _0x313c2f;}var _0x18710d=this[_0x20c0('0x9f')](_0x20c0('0xb1'),_0x20c0('0xd0'));if(_0x18710d[_0x20c0('0xa6')]===-0x1){return _0x18710d;}var _0x345cfa=this['getAndSetVariable'](_0x20c0('0xb2'),_0x20c0('0xd1'));if(_0x345cfa[_0x20c0('0xa6')]===-0x1){return _0x345cfa;}return this['channel'][_0x20c0('0xa7')](util['format'](_0x20c0('0xcc'),_0x2a27b7));};AGIVertices[_0x20c0('0x16')][_0x20c0('0xd2')]=function(_0xefb28d){logger[_0x20c0('0x27')](util['format'](_0x20c0('0xd3'),_0xefb28d[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0xefb28d[_0x20c0('0xd4')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0xefb28d,'no\x20database\x20selected');}var _0xef71a7=this[_0x20c0('0x17')][_0x20c0('0x6a')](this,_0xefb28d['odbc_id']);if(!_0xef71a7){return this[_0x20c0('0xc')]['error'](_0xefb28d,_0x20c0('0xd5'));}if(!this['isConfigured'](_0xefb28d['query'])){return this['channel'][_0x20c0('0x26')](_0xefb28d,_0x20c0('0xd6'));}var _0x55d6d6=_0xefb28d[_0x20c0('0x28')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x20c0('0xc')]['noop'](util[_0x20c0('0x4a')]('query:\x20%s',_0x55d6d6));var _0x32e47c=this['getQueryOdbc'][_0x20c0('0x6a')](this,_0xef71a7,_0x55d6d6);this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0xefb28d,_0x55d6d6);if(!this['isConfigured'](_0xefb28d[_0x20c0('0xd7')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xd8'));}var _0x33ff42=this[_0x20c0('0x9d')]['sync'](this,_0xefb28d['variable_id']);if(!_0x33ff42){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0xefb28d,_0x20c0('0xd9'));}var _0x3efe75=this;_0x32e47c[_0x20c0('0xda')](function(_0x59d4ff,_0x50dfcf){Object[_0x20c0('0xdb')](_0x59d4ff)[_0x20c0('0xda')](function(_0x34f819){_0x3efe75[_0x20c0('0xc')]['setVariable'](util['format'](_0x20c0('0xdc'),_0x33ff42,_0x50dfcf,_0x34f819),_0x59d4ff[_0x34f819]);});});this['channel'][_0x20c0('0x9a')](util['format'](_0x20c0('0xdd'),_0x33ff42),_0x32e47c[_0x20c0('0x97')]);return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xde'),_0x33ff42));};AGIVertices[_0x20c0('0x16')][_0x20c0('0xdf')]=function(_0x12be6e){logger[_0x20c0('0xe0')](util[_0x20c0('0x4a')](_0x20c0('0xe1'),_0x12be6e[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x12be6e[_0x20c0('0xe2')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x12be6e,'no\x20user\x20selected');}var _0x29ef07=this[_0x20c0('0x19')]['sync'](this,_0x12be6e[_0x20c0('0xe2')]);if(!_0x29ef07){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x12be6e,_0x20c0('0xe3'));}var _0x294b9e=this['channel'][_0x20c0('0xad')](_0x20c0('0xe4'),[util[_0x20c0('0x4a')]('SIP/%s',_0x29ef07),_0x12be6e[_0x20c0('0x5d')],_0x12be6e[_0x20c0('0xe5')],_0x12be6e[_0x20c0('0x5b')]]);if(_0x294b9e[_0x20c0('0xa6')]===-0x1){return _0x294b9e;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xe6'),'DIAL'));};AGIVertices[_0x20c0('0x16')][_0x20c0('0xe7')]=function(_0x37f3f8){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xe8'),_0x37f3f8[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x37f3f8[_0x20c0('0x73')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')]('no\x20key\x20configured');}if(!this['isConfigured'](_0x37f3f8[_0x20c0('0x54')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')]('no\x20text\x20configured');}this[_0x20c0('0xc')][_0x20c0('0xe9')]=!![];this[_0x20c0('0x2f')](_0x37f3f8);this[_0x20c0('0x39')](_0x37f3f8[_0x20c0('0x54')],'in','','');this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xea'),_0x37f3f8['text']));var _0x5a0381=this[_0x20c0('0x72')][_0x20c0('0x6a')](this,_0x37f3f8);if(_0x5a0381){for(var _0x2ecd26 in _0x5a0381){if(_0x5a0381['hasOwnProperty'](_0x2ecd26)){this[_0x20c0('0xc')][_0x20c0('0x9a')](util[_0x20c0('0x4a')](_0x20c0('0xeb'),_0x2ecd26['toUpperCase']()),_0x5a0381[_0x2ecd26]);}}this[_0x20c0('0x39')](_0x5a0381[_0x20c0('0xec')],_0x20c0('0xed'),_0x20c0('0xe7'),'');return this[_0x20c0('0xc')][_0x20c0('0xa7')](util['format']('Dialogflow\x20Result\x20%s',_0x5a0381['speech']));}return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x37f3f8,'Dialogflow\x20is\x20unreachable');};AGIVertices[_0x20c0('0x16')]['dialogflowV2']=function(_0x12491f){logger['info'](util[_0x20c0('0x4a')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x12491f['label']));if(!this[_0x20c0('0x7f')](_0x12491f[_0x20c0('0xee')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xef'));}if(!this['isConfigured'](_0x12491f['client_email'])){return this['channel'][_0x20c0('0xa7')](_0x20c0('0xf0'));}if(!this[_0x20c0('0x7f')](_0x12491f[_0x20c0('0x77')])){return this['channel'][_0x20c0('0xa7')](_0x20c0('0xf1'));}if(!this['isConfigured'](_0x12491f[_0x20c0('0x78')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xf2'));}if(!this[_0x20c0('0x7f')](_0x12491f[_0x20c0('0x54')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xa4'));}this[_0x20c0('0xc')][_0x20c0('0xe9')]=!![];this[_0x20c0('0x2f')](_0x12491f);this[_0x20c0('0x39')](_0x12491f[_0x20c0('0x54')],'in','','');this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xf3'),_0x12491f[_0x20c0('0x54')]));var _0x2302e2=this['googleDialogflowV2'][_0x20c0('0x6a')](this,_0x12491f);if(_0x2302e2){for(var _0x3d6a26 in _0x2302e2){if(_0x2302e2[_0x20c0('0x91')](_0x3d6a26)){if(_0x3d6a26!==_0x20c0('0xf4')){this['channel'][_0x20c0('0x9a')](util[_0x20c0('0x4a')](_0x20c0('0xeb'),_0x3d6a26[_0x20c0('0x62')]()),_0x2302e2[_0x3d6a26]);}}}this['createSquareMessage'](_0x2302e2[_0x20c0('0xec')],'out',_0x20c0('0xf5'),_0x2302e2[_0x20c0('0xf4')]);return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('DialogflowV2\x20Result\x20%s',_0x2302e2[_0x20c0('0xec')]));}return this['channel'][_0x20c0('0x26')](_0x12491f,_0x20c0('0xf6'));};AGIVertices['prototype'][_0x20c0('0xf7')]=function(_0x3477ad){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0xf8'),_0x3477ad['label']));if(!this[_0x20c0('0x7f')](_0x3477ad[_0x20c0('0xf9')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xfa'));}if(!this[_0x20c0('0x7f')](_0x3477ad['username'])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xfb'));}if(!this[_0x20c0('0x7f')](_0x3477ad[_0x20c0('0xfc')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xfd'));}if(!this[_0x20c0('0x7f')](_0x3477ad[_0x20c0('0xfe')])){return this[_0x20c0('0xc')]['noop']('no\x20text\x20configured');}this[_0x20c0('0xc')]['bot']=!![];this[_0x20c0('0x2f')](_0x3477ad);this[_0x20c0('0x39')](_0x3477ad[_0x20c0('0x54')],'in','','');this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xff'),_0x3477ad[_0x20c0('0x54')]));var _0x36df58=this[_0x20c0('0x79')][_0x20c0('0x6a')](this,_0x3477ad);if(_0x36df58){for(var _0x4b916d in _0x36df58){if(_0x36df58[_0x20c0('0x91')](_0x4b916d)){this[_0x20c0('0xc')]['setVariable'](util['format']('SESTEK_NDA_%s',_0x4b916d[_0x20c0('0x62')]()),_0x36df58[_0x4b916d]);}}this[_0x20c0('0x39')](_0x36df58[_0x20c0('0xec')],_0x20c0('0xed'),_0x20c0('0xf7'),'');if(_0x36df58[_0x20c0('0x100')]){this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x101'),_0x36df58['audiofile']));var _0x255879=this[_0x20c0('0xc')][_0x20c0('0x102')](_0x36df58[_0x20c0('0x100')]);try{fs['unlink'](_0x36df58[_0x20c0('0x100')]+_0x20c0('0x103'));}catch(_0x480dc3){logger['error'](_0x480dc3);}return _0x255879;}else{return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('SestekNDA\x20Result\x20%s',_0x36df58[_0x20c0('0xec')]));}}return this['channel'][_0x20c0('0x26')](_0x3477ad,_0x20c0('0x104'));};AGIVertices[_0x20c0('0x16')]['end']=function(_0x363c68){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x105'),_0x363c68[_0x20c0('0x31')]));return this['channel'][_0x20c0('0xa7')](_0x20c0('0x106'));};AGIVertices['prototype'][_0x20c0('0x107')]=function(_0x19d920){logger['info'](util[_0x20c0('0x4a')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x19d920[_0x20c0('0x31')]));var _0x5071b1='';if(_0x19d920[_0x20c0('0x108')]){if(!this[_0x20c0('0x7f')](_0x19d920['trunk_id'])){return this['channel']['error'](_0x19d920,_0x20c0('0x109'));}else{var _0x3ddec0=parseInt(_0x19d920['trunk_id'],0xa);if(isNaN(_0x3ddec0)){_0x5071b1=_0x19d920['trunk_id'];}else{_0x5071b1=this[_0x20c0('0x1b')][_0x20c0('0x6a')](this,_0x19d920[_0x20c0('0x108')]);if(!_0x5071b1){return this[_0x20c0('0xc')]['error'](_0x19d920,_0x20c0('0x10a'));}}}}else if(_0x19d920[_0x20c0('0x10b')]){_0x5071b1=_0x19d920['trunk_name'];}else{return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x19d920,_0x20c0('0x109'));}var _0x48f9b7=this[_0x20c0('0xc')][_0x20c0('0xad')](_0x20c0('0xe4'),[util[_0x20c0('0x4a')](_0x20c0('0x10c'),_0x5071b1,_0x19d920[_0x20c0('0xc1')]),_0x19d920['timeout'],_0x19d920['opts'],_0x19d920[_0x20c0('0x5b')]]);if(_0x48f9b7[_0x20c0('0xa6')]===-0x1){return _0x48f9b7;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xe6'),_0x20c0('0xe4')));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x10d')]=function(_0x191987){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20FINALLY\x20(%s)\x20block',_0x191987['label']));return this['channel'][_0x20c0('0xa7')]('finally');};AGIVertices[_0x20c0('0x16')][_0x20c0('0x10e')]=function(_0x14ee0d){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x14ee0d[_0x20c0('0x31')]));if(_0x14ee0d[_0x20c0('0x10f')]===0x0){return this['maxRetry'](_0x14ee0d);}_0x14ee0d['retry']-=0x1;if(!this[_0x20c0('0x7f')](_0x14ee0d[_0x20c0('0x110')])){return this['channel'][_0x20c0('0x26')](_0x14ee0d,_0x20c0('0x111'));}var _0x10812b=this[_0x20c0('0x112')][_0x20c0('0x6a')](this,_0x14ee0d[_0x20c0('0x110')]);if(!_0x10812b){return this['channel'][_0x20c0('0x26')](_0x14ee0d,_0x20c0('0x113'));}if(!this[_0x20c0('0x7f')](_0x14ee0d[_0x20c0('0xd7')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x20c0('0xd8'));}var _0x413740=this['channel'][_0x20c0('0x114')](_0x10812b,_0x14ee0d['response'],_0x14ee0d['maxdigit']);var _0x5d2eb1=_0x413740[_0x20c0('0xa6')]?_0x413740['result'][_0x20c0('0x43')]():'';logger[_0x20c0('0x27')](_0x20c0('0x115'),JSON['stringify'](_0x413740));if(_0x413740['result']===-0x1){this[_0x20c0('0x2f')]['sync'](this,_0x14ee0d,_0x5d2eb1);return _0x413740;}else if(_0x413740[_0x20c0('0x9e')]===_0x20c0('0x5d')){_0x413740[_0x20c0('0xa6')]=_0x5d2eb1['length']>=parseInt(_0x14ee0d[_0x20c0('0x116')])?'x':'i';}else{_0x413740[_0x20c0('0xa6')]=_0x5d2eb1[_0x20c0('0x97')]>=parseInt(_0x14ee0d[_0x20c0('0x116')])&&_0x5d2eb1[_0x20c0('0x97')]<=parseInt(_0x14ee0d[_0x20c0('0x117')])?'x':'i';}var _0x18657e=this['getVariable']['sync'](this,_0x14ee0d[_0x20c0('0xd7')]);if(!_0x18657e){return this['channel']['error'](_0x14ee0d,_0x20c0('0xd9'));}this[_0x20c0('0xc')][_0x20c0('0x9a')](_0x18657e,_0x5d2eb1);if(this[_0x20c0('0x7f')](_0x14ee0d['hiddendigitsnum'])){var _0x438284=parseInt(_0x14ee0d[_0x20c0('0x118')],0xa);var _0x594a02=rs[_0x20c0('0x119')]({'charset':'*','length':_0x438284});var _0x18c9a4=_0x5d2eb1[_0x20c0('0x97')];if(_0x18c9a4>0x0){if(_0x18c9a4>_0x438284){this[_0x20c0('0x2f')]['sync'](this,_0x14ee0d,_0x14ee0d[_0x20c0('0x11a')]===_0x20c0('0x11b')?_0x594a02+_0x5d2eb1[_0x20c0('0x11c')](_0x438284):_0x5d2eb1[_0x20c0('0x11c')](0x0,_0x18c9a4-_0x438284)+_0x594a02);}else{this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x14ee0d,rs[_0x20c0('0x119')]({'charset':'*','length':_0x18c9a4}));}}else{this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x14ee0d,'');}}else{this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x14ee0d,_0x5d2eb1);}return _0x413740;};AGIVertices[_0x20c0('0x16')][_0x20c0('0x11d')]=function(_0x152a3f){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x11e'),_0x152a3f['label']));return this[_0x20c0('0x10e')](_0x152a3f);};AGIVertices[_0x20c0('0x16')][_0x20c0('0x11f')]=function(_0x228cb5){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x120'),_0x228cb5[_0x20c0('0x31')]));this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x228cb5,_0x228cb5[_0x20c0('0x121')]);return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x122'),_0x228cb5[_0x20c0('0x121')]));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x123')]=function(_0x3f75ec){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x124'),_0x3f75ec[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x3f75ec[_0x20c0('0x82')])||!this[_0x20c0('0x7f')](_0x3f75ec[_0x20c0('0x88')])){return this['channel']['noop'](_0x20c0('0x125'));}if(!this['isConfigured'](_0x3f75ec[_0x20c0('0x54')])){return this['channel']['noop'](_0x20c0('0xa4'));}this['channel'][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x126'),_0x3f75ec['text']));var _0x409ba4=this['awsPolly'][_0x20c0('0x6a')](this,_0x3f75ec);if(_0x409ba4){this[_0x20c0('0xc')][_0x20c0('0xa7')](util['format'](_0x20c0('0x127'),_0x409ba4));var _0x2cce60=this[_0x20c0('0xc')][_0x20c0('0x102')](_0x409ba4);try{fs[_0x20c0('0x128')](_0x409ba4+_0x20c0('0x103'));}catch(_0x4933ed){logger[_0x20c0('0x26')](_0x4933ed);}return _0x2cce60;}return this[_0x20c0('0xc')]['error'](_0x3f75ec,_0x20c0('0x129'));};AGIVertices['prototype'][_0x20c0('0x12a')]=function(_0x5a0086){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x12b'),_0x5a0086[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x5a0086['aws_access_key_id'])||!this[_0x20c0('0x7f')](_0x5a0086[_0x20c0('0x88')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')]('no\x20valid\x20credentials\x20configured');}if(!this[_0x20c0('0x7f')](_0x5a0086[_0x20c0('0x8a')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x12c'));}if(!this[_0x20c0('0x7f')](_0x5a0086[_0x20c0('0x54')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xa4'));}this[_0x20c0('0xc')][_0x20c0('0xe9')]=!![];this[_0x20c0('0x2f')](_0x5a0086);this[_0x20c0('0x39')](_0x5a0086[_0x20c0('0x54')],'in','','');this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x12d'),_0x5a0086['text']));var _0x39d59a=this[_0x20c0('0x87')][_0x20c0('0x6a')](this,_0x5a0086);if(_0x39d59a){for(var _0x416b29 in _0x39d59a){if(_0x39d59a[_0x20c0('0x91')](_0x416b29)&&_[_0x20c0('0x92')](_0x39d59a[_0x416b29])){this[_0x20c0('0xc')][_0x20c0('0x9a')](util['format'](_0x20c0('0x12e'),_0x416b29[_0x20c0('0x62')]()),_0x39d59a[_0x416b29]);}}if(_[_0x20c0('0x3c')](_0x39d59a[_0x20c0('0x12f')])){return this['channel'][_0x20c0('0xa7')](_0x20c0('0x130'));}else{this['createSquareMessage'](_0x39d59a[_0x20c0('0x12f')],_0x20c0('0xed'),'amazonlex','');return this['channel'][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x131'),_0x39d59a[_0x20c0('0x12f')]));}}return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x5a0086,_0x20c0('0x132'));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x133')]=function(_0x35d0f5){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x134'),_0x35d0f5['label'],_0x35d0f5[_0x20c0('0x5d')]));if(!this['isConfigured'](_0x35d0f5[_0x20c0('0x73')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x135'));}var _0x2dd5f8='wav';var _0x19d5ad=util['format'](_0x20c0('0x136'),FILES_PATH,rs[_0x20c0('0x119')](0x4));var _0x1309e2=util[_0x20c0('0x4a')]('%s.%s',_0x19d5ad,_0x2dd5f8);var _0x42e95d=!![];if(_0x35d0f5[_0x20c0('0x137')]===_0x20c0('0x138')){_0x42e95d=![];}var _0x44c23d=this[_0x20c0('0xc')][_0x20c0('0x139')](_0x19d5ad,_0x2dd5f8,_0x35d0f5[_0x20c0('0x13a')],_0x35d0f5[_0x20c0('0x5d')],undefined,_0x42e95d);if(_0x44c23d[_0x20c0('0xa6')]!==-0x1){this['channel'][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x13b'),_0x1309e2));var _0x343341=this[_0x20c0('0x8b')][_0x20c0('0x6a')](this,_0x35d0f5,_0x1309e2);if(_0x343341){for(var _0x3753a0 in _0x343341){if(_0x343341[_0x20c0('0x91')](_0x3753a0)){this[_0x20c0('0xc')][_0x20c0('0x9a')](util['format']('GOOGLE_ASR_%s',_0x3753a0[_0x20c0('0x62')]()),_0x343341[_0x3753a0]);}}return this['channel'][_0x20c0('0xa7')](util['format'](_0x20c0('0x13c'),JSON[_0x20c0('0x6d')](_0x343341)));}}return _0x44c23d;};AGIVertices[_0x20c0('0x16')][_0x20c0('0x13d')]=function(_0x1229ce){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x13e'),_0x1229ce[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x1229ce[_0x20c0('0x8e')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x13f'));}if(!this[_0x20c0('0x7f')](_0x1229ce[_0x20c0('0x8f')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x140'));}var _0x5896f4=_0x20c0('0x141');var _0x369c08=util[_0x20c0('0x4a')]('%s/recordings/%s',FILES_PATH,rs[_0x20c0('0x119')](0x4));var _0x2b5038=util['format'](_0x20c0('0x99'),_0x369c08,_0x5896f4);var _0x5d1e4c=!![];if(_0x1229ce[_0x20c0('0x137')]===_0x20c0('0x138')){_0x5d1e4c=![];}var _0x45c7d3=this[_0x20c0('0xc')]['recordFile'](_0x369c08,_0x5896f4,_0x1229ce[_0x20c0('0x13a')],_0x1229ce[_0x20c0('0x5d')],undefined,_0x5d1e4c);if(_0x45c7d3[_0x20c0('0xa6')]!==-0x1){this['channel']['noop'](util['format']('tilde\x20%s\x20file\x20created',_0x2b5038));var _0x260f37=this[_0x20c0('0x8d')][_0x20c0('0x6a')](this,_0x1229ce,_0x2b5038);if(_0x260f37){for(var _0x52ee9e in _0x260f37){if(_0x260f37['hasOwnProperty'](_0x52ee9e)){this[_0x20c0('0xc')][_0x20c0('0x9a')](util[_0x20c0('0x4a')](_0x20c0('0x142'),_0x52ee9e[_0x20c0('0x62')]()),_0x260f37[_0x52ee9e]);}}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x143'),JSON['stringify'](_0x260f37)));}}return _0x45c7d3;};AGIVertices[_0x20c0('0x16')][_0x20c0('0x144')]=function(_0x22d20d){logger['info'](util['format']('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x22d20d[_0x20c0('0x31')]));return this[_0x20c0('0xc')][_0x20c0('0x145')](_0x22d20d['context'],_0x22d20d[_0x20c0('0x37')],_0x22d20d['priority']);};AGIVertices['prototype'][_0x20c0('0x146')]=function(_0x3aa080){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x3aa080['label']));if(!this['isConfigured'](_0x3aa080[_0x20c0('0x147')])){return this[_0x20c0('0xc')]['error'](_0x3aa080,_0x20c0('0x148'));}try{var _0x1c73bb=eval(_0x3aa080[_0x20c0('0x147')])?_0x20c0('0x149'):_0x20c0('0x14a');this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x14b'),_0x3aa080['condition'],_0x1c73bb));return{'code':0xc8,'result':_0x1c73bb};}catch(_0x5aa61e){return{'code':0xc8,'result':_0x20c0('0x14a')};}};AGIVertices[_0x20c0('0x16')]['gotoiftime']=function(_0x170250){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x14c'),_0x170250[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x170250[_0x20c0('0x14d')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x170250,_0x20c0('0x14e'));}var _0x5e6287=this['getIntervals']['sync'](this,_0x170250[_0x20c0('0x14d')]);if(!_0x5e6287){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x170250,_0x20c0('0x14f'));}for(var _0x2bc733=0x0;_0x2bc733<_0x5e6287[_0x20c0('0x97')];_0x2bc733+=0x1){var _0x100164=this['channel'][_0x20c0('0x9d')](util[_0x20c0('0x4a')](_0x20c0('0x150'),_0x5e6287[_0x2bc733]));if(_0x100164['result']===-0x1){return _0x100164;}logger['info'](util['format'](_0x20c0('0x151'),_0x5e6287[_0x2bc733],_0x100164[_0x20c0('0x9e')]));if(_0x100164[_0x20c0('0x9e')]===_0x20c0('0x149')){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x151'),_0x5e6287[_0x2bc733],'true'));this['channel'][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x151'),_0x5e6287[_0x2bc733],_0x20c0('0x149')));return{'code':0xc8,'result':_0x20c0('0x149')};}else{logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('IFTIME\x20%s\x20%s',_0x5e6287[_0x2bc733],_0x20c0('0x14a')));this['channel'][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('IFTIME\x20%s\x20%s',_0x5e6287[_0x2bc733],_0x20c0('0x14a')));}}return{'code':0xc8,'result':_0x20c0('0x14a')};};AGIVertices[_0x20c0('0x16')][_0x20c0('0x152')]=function(_0x319c82){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x319c82[_0x20c0('0x31')]));return this[_0x20c0('0xc')]['hangup']();};AGIVertices['prototype']['ispeechasr']=function(_0x4ed9a8){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x153'),_0x4ed9a8['label']));if(!this[_0x20c0('0x7f')](_0x4ed9a8[_0x20c0('0x73')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')]('no\x20key\x20configured');}var _0xf684f2=_0x20c0('0x141');var _0x379477=util[_0x20c0('0x4a')](_0x20c0('0x136'),FILES_PATH,rs['generate'](0x4));var _0x316f0a=util[_0x20c0('0x4a')](_0x20c0('0x99'),_0x379477,_0xf684f2);var _0x110797=!![];if(_0x4ed9a8['beep']==='NOBEEP'){_0x110797=![];}var _0x27ebd2=this[_0x20c0('0xc')]['recordFile'](_0x379477,_0xf684f2,_0x4ed9a8['intKey'],_0x4ed9a8[_0x20c0('0x5d')],undefined,_0x110797);if(_0x27ebd2[_0x20c0('0xa6')]!==-0x1){this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x154'),_0x316f0a));var _0xb995e5=this['ispeechASR']['sync'](this,_0x4ed9a8,_0x316f0a);if(_0xb995e5){for(var _0x250e4d in _0xb995e5){if(_0xb995e5['hasOwnProperty'](_0x250e4d)){this['channel'][_0x20c0('0x9a')](util[_0x20c0('0x4a')](_0x20c0('0x155'),_0x250e4d[_0x20c0('0x62')]()),_0xb995e5[_0x250e4d]);}}return this[_0x20c0('0xc')]['noop'](util[_0x20c0('0x4a')](_0x20c0('0x156'),JSON[_0x20c0('0x6d')](_0xb995e5)));}}return _0x27ebd2;};AGIVertices['prototype']['ispeechtts']=function(_0x15c6c3){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0x157'),_0x15c6c3[_0x20c0('0x31')]));if(!this['isConfigured'](_0x15c6c3[_0x20c0('0x73')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x135'));}if(!this[_0x20c0('0x7f')](_0x15c6c3[_0x20c0('0x54')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xa4'));}this[_0x20c0('0xc')]['noop'](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x15c6c3[_0x20c0('0x54')]));var _0x4de334=this[_0x20c0('0x7a')][_0x20c0('0x6a')](this,_0x15c6c3);if(_0x4de334){this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x154'),_0x4de334));var _0x2403e2=this[_0x20c0('0xc')]['streamFile'](_0x4de334,_0x15c6c3[_0x20c0('0x13a')]);try{fs['unlink'](_0x4de334+'.wav');}catch(_0x131cdf){logger['error'](_0x131cdf);}return _0x2403e2;}return this['channel'][_0x20c0('0x26')](_0x15c6c3,_0x20c0('0x158'));};AGIVertices['prototype'][_0x20c0('0x159')]=function(_0x1c995b){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x15a'),_0x1c995b[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x1c995b[_0x20c0('0x15b')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x1c995b,_0x20c0('0x15c'));}logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x20c0('0xc')][_0x20c0('0x35')],_0x1c995b['findBy']));var _0x2c773c=this[_0x20c0('0x4d')][_0x20c0('0x6a')](this,_0x1c995b[_0x20c0('0x15b')]);if(_0x2c773c){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0x15d'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x1c995b[_0x20c0('0x15b')]));this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x20c0('0x35')],_0x1c995b['findBy']));return{'code':0xc8,'result':_0x20c0('0x15e')};}else{logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x15f'),this['channel'][_0x20c0('0x35')],_0x1c995b[_0x20c0('0x15b')]));this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x20c0('0xc')][_0x20c0('0x35')],_0x1c995b[_0x20c0('0x15b')]));return{'code':0xc8,'result':_0x20c0('0x160')};}};AGIVertices['prototype']['logout']=function(_0x3c9a79){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x161'),_0x3c9a79[_0x20c0('0x31')]));if(!this['isConfigured'](_0x3c9a79[_0x20c0('0x15b')])){return this['channel'][_0x20c0('0x26')](_0x3c9a79,'no\x20find\x20by\x20configured');}logger['info'](util[_0x20c0('0x4a')](_0x20c0('0x162'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x3c9a79['findBy']));var _0x46cb2f=this[_0x20c0('0x48')][_0x20c0('0x6a')](this,_0x3c9a79[_0x20c0('0x15b')]);if(_0x46cb2f){logger[_0x20c0('0x27')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0x20c0('0x35')],_0x3c9a79[_0x20c0('0x15b')]));this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x15d'),this['channel']['callerid'],_0x3c9a79['findBy']));return{'code':0xc8,'result':_0x20c0('0x15e')};}else{logger['info'](util['format'](_0x20c0('0x15f'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x3c9a79[_0x20c0('0x15b')]));this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x15f'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x3c9a79[_0x20c0('0x15b')]));return{'code':0xc8,'result':_0x20c0('0x160')};}};AGIVertices[_0x20c0('0x16')][_0x20c0('0x163')]=function(_0x3acde3){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x164'),_0x3acde3[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x3acde3[_0x20c0('0x165')])){return this['channel'][_0x20c0('0x26')](_0x3acde3,'no\x20operation\x20configured');}this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x166'),_0x3acde3[_0x20c0('0x165')]));var _0x34ba7a=eval(_0x3acde3[_0x20c0('0x165')]);if(!this[_0x20c0('0x7f')](_0x3acde3['variable_id'])){return this[_0x20c0('0xc')]['noop'](_0x20c0('0xd8'));}var _0x5b27f7=this[_0x20c0('0x9d')][_0x20c0('0x6a')](this,_0x3acde3['variable_id']);if(!_0x5b27f7){return this['channel'][_0x20c0('0x26')](_0x3acde3,_0x20c0('0xd9'));}if(_[_0x20c0('0x167')](_0x34ba7a)){var _0x3eabfd=this;_0x34ba7a['forEach'](function(_0x2ad78a,_0x519258){_0x3eabfd[_0x20c0('0xc')][_0x20c0('0x9a')](util[_0x20c0('0x4a')](_0x20c0('0x168'),_0x5b27f7,_0x519258),_0x2ad78a);});return this[_0x20c0('0xc')]['noop'](util[_0x20c0('0x4a')](_0x20c0('0x169'),_0x5b27f7));}else{return this['channel'][_0x20c0('0x9a')](_0x5b27f7,_0x34ba7a);}};AGIVertices['prototype']['menu']=function(_0x1d75af){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x1d75af[_0x20c0('0x31')]));if(_0x1d75af['retry']===0x0){return this['maxRetry'](_0x1d75af);}_0x1d75af[_0x20c0('0x10f')]-=0x1;if(!this[_0x20c0('0x7f')](_0x1d75af[_0x20c0('0x110')])){return this['channel'][_0x20c0('0x26')](_0x1d75af,_0x20c0('0x111'));}var _0x4dc355=this[_0x20c0('0x112')]['sync'](this,_0x1d75af[_0x20c0('0x110')]);if(!_0x4dc355){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x1d75af,_0x20c0('0x113'));}var _0x1ff8a5=this['channel'][_0x20c0('0x114')](_0x4dc355,_0x1d75af[_0x20c0('0x16a')],_0x1d75af['digit']);var _0x474bcc=_0x1ff8a5['result'];if(_0x1ff8a5[_0x20c0('0xa6')]===-0x1){this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x1d75af,'-1');return _0x1ff8a5;}else if(_0x1ff8a5[_0x20c0('0x9e')]===_0x20c0('0x5d')){_0x1ff8a5['result']=_0x1ff8a5[_0x20c0('0xa6')][_0x20c0('0x97')]>0x0?_0x1ff8a5['result']:'t';}else if(_[_0x20c0('0x3b')](_0x1ff8a5[_0x20c0('0xa6')])){_0x1ff8a5[_0x20c0('0xa6')]='#';_0x474bcc='#';}if(!this['isConfigured'](_0x1d75af[_0x20c0('0xd7')])){this[_0x20c0('0xc')]['noop']('no\x20variable\x20selected\x20for\x20the\x20result');}else{var _0x237d52=this[_0x20c0('0x9d')][_0x20c0('0x6a')](this,_0x1d75af['variable_id']);if(!_0x237d52){return this[_0x20c0('0xc')]['error'](_0x1d75af,_0x20c0('0xd9'));}this[_0x20c0('0xc')][_0x20c0('0x9a')](_0x237d52,_0x474bcc);}this['createSquareDetailsReport'][_0x20c0('0x6a')](this,_0x1d75af,_0x474bcc);return _0x1ff8a5;};AGIVertices[_0x20c0('0x16')][_0x20c0('0xa7')]=function(_0x432f7a){logger[_0x20c0('0x27')](util['format'](_0x20c0('0x16b'),_0x432f7a[_0x20c0('0x31')]));return this[_0x20c0('0xc')]['noop'](_0x432f7a['output']||_0x432f7a['label']);};AGIVertices[_0x20c0('0x16')][_0x20c0('0x16c')]=function(_0x15014c){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x16d'),_0x15014c['label']));if(!this[_0x20c0('0x7f')](_0x15014c[_0x20c0('0x15b')])){return this[_0x20c0('0xc')]['error'](_0x15014c,_0x20c0('0x15c'));}logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x162'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x15014c['findBy']));var _0x22eb47=this[_0x20c0('0x45')]['sync'](this,_0x15014c[_0x20c0('0x16e')]);var _0xc91f48=this[_0x20c0('0x16f')][_0x20c0('0x6a')](this,_0x15014c[_0x20c0('0x15b')],_0x22eb47);if(_0xc91f48){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x15d'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x15014c[_0x20c0('0x15b')]));this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x15d'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x15014c[_0x20c0('0x15b')]));return{'code':0xc8,'result':_0x20c0('0x15e')};}else{logger[_0x20c0('0x27')](util['format'](_0x20c0('0x15f'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0x15014c[_0x20c0('0x15b')]));this[_0x20c0('0xc')]['noop'](util[_0x20c0('0x4a')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x20c0('0xc')]['callerid'],_0x15014c['findBy']));return{'code':0xc8,'result':_0x20c0('0x160')};}};AGIVertices[_0x20c0('0x16')][_0x20c0('0x170')]=function(_0x53cf76){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x171'),_0x53cf76['label']));if(!this[_0x20c0('0x7f')](_0x53cf76[_0x20c0('0x110')])){return this['channel']['error'](_0x53cf76,_0x20c0('0x111'));}var _0x59bb6a=this[_0x20c0('0x112')]['sync'](this,_0x53cf76[_0x20c0('0x110')]);if(!_0x59bb6a){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x53cf76,_0x20c0('0x113'));}var _0x16414d=this[_0x20c0('0xc')]['exec'](_0x20c0('0x172'),[_0x59bb6a,_0x53cf76[_0x20c0('0xe5')]]);if(_0x16414d['result']===-0x1){return _0x16414d;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xc5'),_0x20c0('0x172'),_0x59bb6a));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x173')]=function(_0x5e0ad6){logger['info'](util['format']('Enter\x20in\x20QUEUE\x20(%s)\x20block',_0x5e0ad6[_0x20c0('0x31')]));if(!this['isConfigured'](_0x5e0ad6[_0x20c0('0x174')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x5e0ad6,_0x20c0('0x175'));}var _0x49d65a='';var _0xe21f5d=parseInt(_0x5e0ad6['queue_id'],0xa);if(isNaN(_0xe21f5d)){_0x49d65a=_0x5e0ad6[_0x20c0('0x174')];}else{_0x49d65a=this[_0x20c0('0x176')][_0x20c0('0x6a')](this,_0x5e0ad6['queue_id']);if(!_0x49d65a){return this['channel']['error'](_0x5e0ad6,'no\x20queue\x20found');}}var _0x28ecfa='';if(this[_0x20c0('0x7f')](_0x5e0ad6[_0x20c0('0x110')])){var _0x20a651=this[_0x20c0('0x112')][_0x20c0('0x6a')](this,_0x5e0ad6[_0x20c0('0x110')]);if(_0x20a651){_0x28ecfa=_0x20a651;}}this['createSquareDetailsReport'][_0x20c0('0x6a')](this,_0x5e0ad6,_0x49d65a);if(_0x5e0ad6[_0x20c0('0xe5')]['indexOf']('x')<0x0){_0x5e0ad6[_0x20c0('0xe5')]+='x';}if(_0x5e0ad6[_0x20c0('0xe5')][_0x20c0('0x177')]('X')<0x0){_0x5e0ad6[_0x20c0('0xe5')]+='X';}this[_0x20c0('0xc')][_0x20c0('0x9a')]('XMCS-QUEUE',_0x49d65a?_0x49d65a['toLowerCase']():'');var _0x236c45=this[_0x20c0('0xc')]['exec']('QUEUE',[_0x49d65a,_0x5e0ad6[_0x20c0('0xe5')],_0x5e0ad6[_0x20c0('0x5b')],_0x28ecfa,_0x5e0ad6[_0x20c0('0x5d')],_0x5e0ad6['agi'],_0x5e0ad6[_0x20c0('0x178')],_0x5e0ad6['gosub'],'',_0x5e0ad6[_0x20c0('0x179')]]);if(_0x236c45[_0x20c0('0xa6')]===-0x1){return _0x236c45;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('Executed\x20command\x20%s\x20%s','QUEUE',_0x49d65a));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x17a')]=function(_0x4867f9){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x17b'),_0x4867f9[_0x20c0('0x31')]));var _0x12d38a=_0x4867f9[_0x20c0('0x17c')]||_0x20c0('0x141');var _0x1794da=util['format'](_0x20c0('0x17d'),this['channel'][_0x20c0('0x30')],rs[_0x20c0('0x119')](0x5));var _0x41900a=util[_0x20c0('0x4a')](_0x20c0('0x17e'),FILES_PATH,_0x1794da,_0x12d38a);var _0x2805c3=util['format'](_0x20c0('0x136'),FILES_PATH,_0x1794da);this[_0x20c0('0x34')][_0x20c0('0x6a')](this,_0x4867f9,_0x1794da,_0x41900a);this['channel'][_0x20c0('0x9a')](_0x20c0('0x17f'),_0x1794da);logger[_0x20c0('0x27')](_0x20c0('0x180'),_0x2805c3,_0x12d38a,_0x4867f9[_0x20c0('0x181')],_0x4867f9[_0x20c0('0x5d')]);return this[_0x20c0('0xc')][_0x20c0('0x139')](_0x2805c3,_0x12d38a,_0x4867f9[_0x20c0('0x181')],_0x4867f9['timeout'],undefined,!![]);};AGIVertices[_0x20c0('0x16')]['restapi']=function(_0x344e17){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x344e17['label']));if(!this[_0x20c0('0x7f')](_0x344e17[_0x20c0('0x5b')])){return this['channel'][_0x20c0('0xa7')](_0x20c0('0x182'));}var _0x4a8813=this[_0x20c0('0x5a')]['sync'](this,_0x344e17);logger['info'](util[_0x20c0('0x4a')](_0x20c0('0x183'),util[_0x20c0('0x184')](_0x4a8813,{'showHidden':![],'depth':null})));if(!this[_0x20c0('0x7f')](_0x344e17[_0x20c0('0xd7')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x185'));}var _0x2ddfdf=this[_0x20c0('0x9d')][_0x20c0('0x6a')](this,_0x344e17['variable_id']);if(!_0x2ddfdf){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x344e17,_0x20c0('0xd9'));}this[_0x20c0('0xc')][_0x20c0('0x9a')](util[_0x20c0('0x4a')](_0x20c0('0x186'),_0x2ddfdf),_0x4a8813[_0x20c0('0x6f')]?_0x4a8813[_0x20c0('0x6f')]:'200');this['channel']['setVariable'](util[_0x20c0('0x4a')](_0x20c0('0x187'),_0x2ddfdf),_0x4a8813[_0x20c0('0x70')]?_0x4a8813[_0x20c0('0x70')]:'OK');if(_0x4a8813[_0x20c0('0x63')]){try{this[_0x20c0('0x98')](_0x4a8813[_0x20c0('0x63')],_0x2ddfdf);}catch(_0x253934){logger['error'](util[_0x20c0('0x4a')](_0x20c0('0x188'),_0x2ddfdf));}}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xde'),_0x2ddfdf));};AGIVertices[_0x20c0('0x16')]['saydigits']=function(_0x305bcf){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0x189'),_0x305bcf['label']));return this[_0x20c0('0xc')][_0x20c0('0x18a')](_0x305bcf['digits']['replace'](/\s+/g,''),_0x305bcf[_0x20c0('0x181')]);};AGIVertices[_0x20c0('0x16')][_0x20c0('0x18b')]=function(_0x36f272){logger[_0x20c0('0x27')](util['format'](_0x20c0('0x18c'),_0x36f272['label']));return this[_0x20c0('0xc')][_0x20c0('0x18d')](_0x36f272[_0x20c0('0x5e')][_0x20c0('0x50')](/\s+/g,''),_0x36f272[_0x20c0('0x181')]);};AGIVertices[_0x20c0('0x16')][_0x20c0('0x18e')]=function(_0x3586f8){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x18f'),_0x3586f8[_0x20c0('0x31')]));return this[_0x20c0('0xc')]['sayPhonetic'](_0x3586f8[_0x20c0('0x54')],_0x3586f8['escape_digits']);};AGIVertices['prototype']['sendMail']=function(_0x579554){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20SENDMAIL\x20(%s)\x20block',_0x579554[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x579554[_0x20c0('0x190')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x191'));}var _0x5776a5=this[_0x20c0('0x1e')][_0x20c0('0x6a')](this,_0x579554[_0x20c0('0x190')]);if(!_0x5776a5||!_0x5776a5[_0x20c0('0x192')]){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x579554,_0x20c0('0x193'));}var _0x300925={'from':util[_0x20c0('0x4a')]('\x22%s\x22\x20<%s>',_0x5776a5[_0x20c0('0x11')],_0x5776a5[_0x20c0('0x194')]||_0x5776a5[_0x20c0('0x192')][_0x20c0('0x195')]),'to':_0x579554['to']||'','cc':_0x579554['cc']||'','bcc':_0x579554[_0x20c0('0x196')]||'','subject':_0x579554['subject'],'html':_0x579554['text'],'text':_0x579554[_0x20c0('0x54')]};if(this[_0x20c0('0x7f')](_0x579554[_0x20c0('0x197')])){}logger['debug'](_0x20c0('0x198'),JSON[_0x20c0('0x6d')](_0x300925));this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x579554,_0x579554[_0x20c0('0x190')]);this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0x199'),_0x5776a5[_0x20c0('0x11')]));this[_0x20c0('0x20')]['sync'](this,_0x5776a5['smtpOptions'],_0x300925);return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x19a'));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x19b')]=function(_0x283200){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x19c'),_0x283200[_0x20c0('0x31')]));return this['channel'][_0x20c0('0xa7')](_0x20c0('0x19d'));};AGIVertices['prototype'][_0x20c0('0x19e')]=function(_0xd519c3){logger['info'](util[_0x20c0('0x4a')](_0x20c0('0x19f'),_0xd519c3[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0xd519c3['sms_account_id'])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x1a0'));}var _0x57b6c7=this[_0x20c0('0x2c')][_0x20c0('0x6a')](this,_0xd519c3[_0x20c0('0x1a1')]);if(!_0x57b6c7){return this[_0x20c0('0xc')]['error'](_0xd519c3,_0x20c0('0x1a2'));}var _0x117ae7={'body':_0xd519c3[_0x20c0('0x1a3')],'phone':_0xd519c3['to']||'','SmsAccountId':_0x57b6c7['id']};logger[_0x20c0('0xe0')](_0x20c0('0x1a4'),JSON[_0x20c0('0x6d')](_0x117ae7));this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0xd519c3,_0xd519c3[_0x20c0('0x1a1')]);this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x57b6c7[_0x20c0('0x11')]));this[_0x20c0('0x2e')][_0x20c0('0x6a')](this,_0x117ae7);return this[_0x20c0('0xc')][_0x20c0('0xa7')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0x20c0('0x16')]['set']=function(_0x5f10e7){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x1a5'),_0x5f10e7[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x5f10e7[_0x20c0('0xd7')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x5f10e7,_0x20c0('0x1a6'));}var _0x44fdf8=this[_0x20c0('0x9d')][_0x20c0('0x6a')](this,_0x5f10e7[_0x20c0('0xd7')]);if(!_0x44fdf8){return this[_0x20c0('0xc')]['error'](_0x5f10e7,_0x20c0('0xd9'));}return this[_0x20c0('0xc')][_0x20c0('0x9a')](_0x44fdf8,_0x5f10e7[_0x20c0('0x1a7')]);};AGIVertices[_0x20c0('0x16')]['start']=function(_0x3acf09){logger['info'](util[_0x20c0('0x4a')]('Enter\x20in\x20START\x20(%s)\x20block',_0x3acf09[_0x20c0('0x31')]));this['channel'][_0x20c0('0xa7')](_0x20c0('0x1a8'));var _0x32e8ea=this[_0x20c0('0xc')]['getVariable'](_0x20c0('0x1a9'));if(!_[_0x20c0('0x3b')](_0x32e8ea[_0x20c0('0x9e')])){this[_0x20c0('0xc')][_0x20c0('0x30')]=_0x32e8ea[_0x20c0('0x9e')];}if(_0x3acf09[_0x20c0('0xb7')]===_0x20c0('0x1aa')){this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x1ab'));return this[_0x20c0('0xc')][_0x20c0('0xb7')]();}return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0x1ac'));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x1ad')]=function(_0x125957){logger[_0x20c0('0x27')](util['format'](_0x20c0('0x1ae'),_0x125957[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0x125957['project_id'])){return this['channel'][_0x20c0('0x26')](_0x125957,_0x20c0('0x1af'));}var _0x19b0c8=this[_0x20c0('0x14')]['sync'](this,_0x125957['project_id']);if(!this['isConfigured'](_0x19b0c8)){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x125957,util['format'](_0x20c0('0x1b0'),_0x125957['project_id']));}if(_0x19b0c8===this[_0x20c0('0xc')][_0x20c0('0x33')]){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x125957,_0x20c0('0x1b1'));}this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x125957,_0x19b0c8);var _0x5492cc=this[_0x20c0('0xc')][_0x20c0('0xad')](_0x20c0('0x1b2'),util['format'](_0x20c0('0x1b3'),config[_0x20c0('0x7')]['host']||'127.0.0.1',_0x19b0c8,this[_0x20c0('0xc')][_0x20c0('0x33')]));if(_0x5492cc[_0x20c0('0xa6')]===-0x1){return _0x5492cc;}return this[_0x20c0('0xc')]['noop'](util[_0x20c0('0x4a')]('Executed\x20command\x20%s\x20%s','AGI',_0x19b0c8));};AGIVertices['prototype'][_0x20c0('0x1b4')]=function(_0x46ce47){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x46ce47['label']));var _0x1c6307=this['shellCommand'][_0x20c0('0x6a')](this,_0x46ce47[_0x20c0('0xb5')]);this[_0x20c0('0x2f')][_0x20c0('0x6a')](this,_0x46ce47,_0x46ce47[_0x20c0('0xb5')]);if(this[_0x20c0('0x7f')](_0x46ce47[_0x20c0('0xd7')])){var _0x41fc5e=this[_0x20c0('0x9d')]['sync'](this,_0x46ce47[_0x20c0('0xd7')]);if(_0x41fc5e){this[_0x20c0('0xc')]['setVariable'](_0x41fc5e,_0x1c6307);return this[_0x20c0('0xc')][_0x20c0('0xa7')](util['format'](_0x20c0('0x1b5'),_0x46ce47['command'],_0x41fc5e));}}return this['channel'][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x46ce47[_0x20c0('0xb5')]));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x1b6')]=function(_0x461470){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x1b7'),_0x461470[_0x20c0('0x31')]));_0x461470[_0x20c0('0x54')]=_0x461470[_0x20c0('0x54')][_0x20c0('0x50')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x20c0('0x7f')](_0x461470[_0x20c0('0x52')])){return this[_0x20c0('0xc')]['noop']('no\x20apiKey\x20configured');}if(!this[_0x20c0('0x7f')](_0x461470[_0x20c0('0x54')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')](_0x20c0('0xa4'));}this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x461470['text']));var _0x24e6d9=this[_0x20c0('0x51')]['sync'](this,_0x461470);if(_0x24e6d9){this[_0x20c0('0xc')]['noop'](util['format'](_0x20c0('0x1b8'),_0x24e6d9));var _0x1ce779=this[_0x20c0('0xc')]['streamFile'](_0x24e6d9);try{fs[_0x20c0('0x128')](_0x24e6d9+_0x20c0('0x103'));}catch(_0x24451f){logger[_0x20c0('0x26')](_0x24451f);}return _0x1ce779;}return this[_0x20c0('0xc')]['error'](_0x461470,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x20c0('0x16')][_0x20c0('0x1b9')]=function(_0x502e88){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x502e88['label']));_0x502e88[_0x20c0('0x54')]=_0x502e88[_0x20c0('0x54')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x20c0('0x7f')](_0x502e88[_0x20c0('0x54')])){return this[_0x20c0('0xc')][_0x20c0('0xa7')]('no\x20text\x20configured');}this[_0x20c0('0xc')]['noop'](util[_0x20c0('0x4a')](_0x20c0('0x1ba'),_0x502e88[_0x20c0('0x54')]));var _0x1bd7f3=this[_0x20c0('0x1bb')][_0x20c0('0x6a')](this,_0x502e88);if(_0x1bd7f3){this[_0x20c0('0xc')][_0x20c0('0xa7')](util['format'](_0x20c0('0x1bc'),_0x1bd7f3));var _0x22c00d=this[_0x20c0('0xc')][_0x20c0('0x102')](_0x1bd7f3);try{fs[_0x20c0('0x128')](_0x1bd7f3+_0x20c0('0x103'));}catch(_0x4f619b){logger[_0x20c0('0x26')](_0x4f619b);}return _0x22c00d;}return this[_0x20c0('0xc')][_0x20c0('0x26')](_0x502e88,_0x20c0('0x1bd'));};AGIVertices['prototype'][_0x20c0('0x1be')]=function(_0xa4a9e6){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x1bf'),_0xa4a9e6[_0x20c0('0x31')]));if(!this[_0x20c0('0x7f')](_0xa4a9e6[_0x20c0('0x15b')])){return this[_0x20c0('0xc')][_0x20c0('0x26')](_0xa4a9e6,_0x20c0('0x15c'));}logger['info'](util[_0x20c0('0x4a')](_0x20c0('0x162'),this['channel'][_0x20c0('0x35')],_0xa4a9e6[_0x20c0('0x15b')]));var _0x4a7787=this['agentUnpause'][_0x20c0('0x6a')](this,_0xa4a9e6[_0x20c0('0x15b')]);if(_0x4a7787){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x15d'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0xa4a9e6[_0x20c0('0x15b')]));this[_0x20c0('0xc')]['noop'](util['format'](_0x20c0('0x15d'),this['channel']['callerid'],_0xa4a9e6[_0x20c0('0x15b')]));return{'code':0xc8,'result':_0x20c0('0x15e')};}else{logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x15f'),this[_0x20c0('0xc')]['callerid'],_0xa4a9e6[_0x20c0('0x15b')]));this[_0x20c0('0xc')][_0x20c0('0xa7')](util['format'](_0x20c0('0x15f'),this[_0x20c0('0xc')][_0x20c0('0x35')],_0xa4a9e6[_0x20c0('0x15b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x20c0('0x16')]['voicemail']=function(_0x4cfd34){logger[_0x20c0('0x27')](util[_0x20c0('0x4a')](_0x20c0('0x1c0'),_0x4cfd34[_0x20c0('0x31')]));var _0x536c6e=this[_0x20c0('0xc')][_0x20c0('0xad')]('VOICEMAIL',[_0x4cfd34[_0x20c0('0x1c1')],_0x4cfd34[_0x20c0('0x71')]]);if(_0x536c6e[_0x20c0('0xa6')]===-0x1){return _0x536c6e;}return this[_0x20c0('0xc')][_0x20c0('0xa7')](util[_0x20c0('0x4a')](_0x20c0('0xc5'),_0x20c0('0x1c2'),_0x4cfd34['mailbox']));};AGIVertices[_0x20c0('0x16')][_0x20c0('0x1c3')]=function(_0x219600){logger[_0x20c0('0x27')](util['format'](_0x20c0('0x1c4'),_0x219600[_0x20c0('0x31')]));if(!this['isConfigured'](_0x219600[_0x20c0('0xd7')])){return this['channel'][_0x20c0('0x26')](_0x219600,_0x20c0('0x1a6'));}var _0x326bc5=this[_0x20c0('0x9d')][_0x20c0('0x6a')](this,_0x219600[_0x20c0('0xd7')]);if(!_0x326bc5){return this[_0x20c0('0xc')]['error'](_0x219600,'no\x20variable\x20found');}var _0x3fcf4c=this['channel'][_0x20c0('0x9d')](_0x326bc5);return{'code':0xc8,'result':_0x3fcf4c['extra']?_0x3fcf4c[_0x20c0('0x9e')]:'-'};};String['prototype'][_0x20c0('0x9c')]=function(_0x754cd3,_0x2552e5){return this[_0x20c0('0x9b')](_0x754cd3)['join'](_0x2552e5);};module[_0x20c0('0x1c5')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 6512ec9..64fc1a5 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 _0xed9d=['stopAcw','lastPauseAt','format','[ACW][START]\x20%s','message','[%s][TIMER][STOP][AGENT:%s]','pauseType','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','isUndefined','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','syncHangup','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','deleteChannelAfterTimeout','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../ami','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','attendedtransfer','syncAttendedTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','timer','uniqueid','then','info','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','finally','interface','queue','mandatoryDisposition','name','mandatoryDispositionPause','Action','getAgent','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','available','paused','acwTimeout'];(function(_0x1877f6,_0x36065d){var _0xc063c5=function(_0x16970c){while(--_0x16970c){_0x1877f6['push'](_0x1877f6['shift']());}};_0xc063c5(++_0x36065d);}(_0xed9d,0x120));var _0xded9=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xed9d[_0x4243a3];return _0x1b2a33;};'use strict';var _=require(_0xded9('0x0'));var moment=require(_0xded9('0x1'));var ami=require(_0xded9('0x2'));var logger=require(_0xded9('0x3'))(_0xded9('0x4'));var RpcUser=require(_0xded9('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x3b546a){this[_0xded9('0x6')]=_0x3b546a[_0xded9('0x6')];this['agents']=_0x3b546a[_0xded9('0x7')];this[_0xded9('0x8')]=_0x3b546a['timers'];this[_0xded9('0x9')]={};ami['on'](_0xded9('0xa'),this[_0xded9('0xb')][_0xded9('0xc')](this));ami['on'](_0xded9('0xd'),this[_0xded9('0xe')][_0xded9('0xc')](this));ami['on'](_0xded9('0xf'),this['syncHangup'][_0xded9('0xc')](this));ami['on']('agentringnoanswer',this['syncAgentRingNoAnswer'][_0xded9('0xc')](this));ami['on'](_0xded9('0x10'),this[_0xded9('0x11')][_0xded9('0xc')](this));ami['on']('blindtransfer',this['syncBlindTransfer'][_0xded9('0xc')](this));ami['on'](_0xded9('0x12'),this[_0xded9('0x13')]['bind'](this));}function getDiff(_0x5ad929){var _0x48bf57=moment()[_0xded9('0x14')](0x0);var _0x383019=moment(_0x5ad929)[_0xded9('0x14')](0x0);return _0x48bf57[_0xded9('0x15')](_0x383019,_0xded9('0x16'));}Acw[_0xded9('0x17')][_0xded9('0x18')]=function(_0x37390c,_0x3c87be){var _0x23d8cb=this;var _0x2e6977=getDiff(_0x23d8cb[_0xded9('0x8')][_0x37390c]['lastPauseAt']);clearTimeout(_0x23d8cb[_0xded9('0x8')][_0x37390c][_0xded9('0x19')]);_0x23d8cb[_0xded9('0x8')][_0x37390c][_0xded9('0x19')]=![];return RpcVoiceAgentReport['update']({'acwtime':_0x2e6977},_0x23d8cb['timers'][_0x37390c][_0xded9('0x1a')],_0x37390c)[_0xded9('0x1b')](function(_0x50c28c){logger[_0xded9('0x1c')](_0xded9('0x1d'),_0x3c87be,_0x2e6977,_0x50c28c);})[_0xded9('0x1e')](function(_0x4ffff3){logger[_0xded9('0x1f')](_0xded9('0x20'),_0x3c87be,_0x4ffff3);})[_0xded9('0x21')](function(){delete _0x23d8cb[_0xded9('0x8')][_0x37390c];});};Acw[_0xded9('0x17')]['startAcw']=function(_0x37ce32){try{var _0x3f5afa=this;var _0x5194bc=this[_0xded9('0x9')][_0x37ce32][_0xded9('0x22')];var _0x22677c=this[_0xded9('0x9')][_0x37ce32][_0xded9('0x23')];var _0x2fdf62=this[_0xded9('0x6')][_0x22677c];var _0x6f8cf2=![];var _0x455227='ACW';if(_0x2fdf62[_0xded9('0x24')]&&_0x2fdf62['mandatoryDispositionPause'][_0xded9('0x25')]){_0x6f8cf2=!![];_0x455227=_0x2fdf62[_0xded9('0x26')][_0xded9('0x25')];}return ami[_0xded9('0x27')]({'action':'QueuePause','interface':_0x5194bc,'paused':!![],'reason':_0x455227})['then'](function(){if(_0x3f5afa[_0xded9('0x7')][_0x5194bc]){return RpcUser[_0xded9('0x28')](_0x3f5afa[_0xded9('0x7')][_0x5194bc]['id'])[_0xded9('0x1b')](function(_0x15b62a){if(!_0x15b62a||_0x15b62a['voicePause']){logger[_0xded9('0x1c')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x37ce32,_0x5194bc,_0x22677c);return;}logger[_0xded9('0x1c')](_0xded9('0x29'),_0x37ce32,_0x5194bc,_0x22677c);var _0x1c0e75=_0x3f5afa[_0xded9('0x9')][_0x37ce32][_0xded9('0x2a')]&&_0x3f5afa[_0xded9('0x9')][_0x37ce32][_0xded9('0x2b')]?_0x3f5afa[_0xded9('0x9')][_0x37ce32]['destlinkedid']:_0x37ce32;return RpcUser[_0xded9('0x2c')](_0x3f5afa[_0xded9('0x7')][_0x5194bc],_0x455227,_0x1c0e75)[_0xded9('0x1b')](function(_0x20640d){_0x3f5afa[_0xded9('0x6')][_0x22677c][_0xded9('0x2d')]-=0x1;_0x3f5afa['voiceQueues'][_0x22677c][_0xded9('0x2e')]+=0x1;return _0x20640d;});})[_0xded9('0x1b')](function(_0x1b1d06){if(_0x6f8cf2||!_0x1b1d06){return;}_0x3f5afa[_0xded9('0x8')][_0x5194bc]={};logger[_0xded9('0x1c')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x37ce32,_0x3f5afa[_0xded9('0x6')][_0x22677c][_0xded9('0x2f')],_0x5194bc,_0x22677c);_0x3f5afa[_0xded9('0x8')][_0x5194bc][_0xded9('0x19')]=setTimeout(_0x3f5afa[_0xded9('0x30')][_0xded9('0xc')](_0x3f5afa,_0x5194bc),_0x3f5afa[_0xded9('0x6')][_0x22677c][_0xded9('0x2f')]*0x3e8);_0x3f5afa['timers'][_0x5194bc][_0xded9('0x31')]=moment()[_0xded9('0x32')]('YYYY-MM-DD\x20HH:mm:ss');_0x3f5afa[_0xded9('0x8')][_0x5194bc][_0xded9('0x1a')]=_0x37ce32;_0x3f5afa[_0xded9('0x8')][_0x5194bc][_0xded9('0x23')]=_0x22677c;_0x3f5afa['timers'][_0x5194bc][_0xded9('0x18')]=_0x3f5afa[_0xded9('0x18')][_0xded9('0xc')](_0x3f5afa,_0x5194bc,_0x37ce32);});}})['catch'](function(){logger['error']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x37ce32,_0x3f5afa['voiceQueues'][_0x22677c][_0xded9('0x2f')],_0x5194bc,_0x22677c);})[_0xded9('0x21')](function(){delete _0x3f5afa[_0xded9('0x9')][_0x37ce32];});}catch(_0x1b1482){logger['error'](_0xded9('0x33'),_0x1b1482[_0xded9('0x34')]);}};Acw[_0xded9('0x17')]['stopAcw']=function(_0x2c5224){try{var _0x42f6d4=this;if(_0x42f6d4['timers'][_0x2c5224]){_0x42f6d4[_0xded9('0x8')][_0x2c5224][_0xded9('0x19')]=![];var _0x374475=_0x42f6d4[_0xded9('0x8')][_0x2c5224][_0xded9('0x1a')];var _0x4e1862=_0x42f6d4[_0xded9('0x8')][_0x2c5224][_0xded9('0x23')];var _0xc9df88=_0x42f6d4[_0xded9('0x6')][_0x4e1862][_0xded9('0x2f')];logger['info'](_0xded9('0x35'),_0x374475,_0x2c5224);RpcUser[_0xded9('0x28')](this[_0xded9('0x7')][_0x2c5224]['id'])[_0xded9('0x1b')](function(_0x4a949f){if(_0x4a949f[_0xded9('0x36')]==='ACW'){return RpcUser[_0xded9('0x37')](_0x42f6d4['agents'][_0x2c5224]);}});RpcVoiceAgentReport[_0xded9('0x38')]({'acwtime':_0xc9df88,'agentacw':!![]},_0x374475,_0x2c5224)['then'](function(_0x20ecb7){logger['info'](_0xded9('0x1d'),_0x374475,_0xc9df88,_0x20ecb7);})[_0xded9('0x1e')](function(_0x42eda6){logger[_0xded9('0x1f')](_0xded9('0x20'),_0x374475,_0x42eda6);});}else{logger[_0xded9('0x1f')](_0xded9('0x39'),_0x2c5224);if(_0x42f6d4[_0xded9('0x8')]){logger[_0xded9('0x1c')]('[ACW][TIMERS]',JSON[_0xded9('0x3a')](_0x42f6d4[_0xded9('0x8')]));}}}catch(_0x115925){logger['error'](_0xded9('0x3b'),_0x115925[_0xded9('0x34')]);}};Acw[_0xded9('0x17')][_0xded9('0xb')]=function(_0x158bb2){try{if(this[_0xded9('0x6')][_0x158bb2[_0xded9('0x23')]]&&(this['voiceQueues'][_0x158bb2['queue']]['acw']||this[_0xded9('0x6')][_0x158bb2['queue']][_0xded9('0x24')])){if(this[_0xded9('0x7')][_0x158bb2[_0xded9('0x22')]]){this['channels'][_0x158bb2['uniqueid']]={'queue':_0x158bb2[_0xded9('0x23')],'interface':_0x158bb2[_0xded9('0x22')],'destlinkedid':_0x158bb2[_0xded9('0x2b')]};}}}catch(_0x4c5ee0){logger[_0xded9('0x1f')](_0xded9('0x3c'),_0x4c5ee0[_0xded9('0x34')]);}};Acw['prototype'][_0xded9('0x13')]=function(_0x3a0485){try{if(this[_0xded9('0x6')][_0x3a0485['queue']]&&(this['voiceQueues'][_0x3a0485[_0xded9('0x23')]]['acw']||this['voiceQueues'][_0x3a0485[_0xded9('0x23')]]['mandatoryDisposition'])){if(this['agents'][_0x3a0485[_0xded9('0x22')]]){this[_0xded9('0x9')][_0x3a0485[_0xded9('0x1a')]]={'queue':_0x3a0485[_0xded9('0x23')],'interface':_0x3a0485[_0xded9('0x22')]};}}}catch(_0x369823){logger[_0xded9('0x1f')]('[ACW][syncAgentConnectPreview]\x20%s',_0x369823[_0xded9('0x34')]);}};Acw[_0xded9('0x17')][_0xded9('0xe')]=function(_0x45ee54){try{if(this[_0xded9('0x9')][_0x45ee54[_0xded9('0x1a')]]&&_[_0xded9('0x3d')](this['channels'][_0x45ee54['uniqueid']][_0xded9('0x2a')])){logger[_0xded9('0x1c')]('[%s][HANGUP:UNIQUEID]',_0x45ee54[_0xded9('0x1a')]);this[_0xded9('0x3e')](_0x45ee54[_0xded9('0x1a')]);}else if(this[_0xded9('0x9')][_0x45ee54['linkedid']]&&_['isUndefined'](this[_0xded9('0x9')][_0x45ee54[_0xded9('0x3f')]]['attended'])){logger['info'](_0xded9('0x40'),_0x45ee54[_0xded9('0x3f')]);this[_0xded9('0x3e')](_0x45ee54[_0xded9('0x3f')]);}}catch(_0x1e3c06){logger['error'](_0xded9('0x41'),_0x1e3c06['message']);}};Acw[_0xded9('0x17')][_0xded9('0x42')]=function(_0x289ae9){try{if(this[_0xded9('0x9')][_0x289ae9['uniqueid']]&&this[_0xded9('0x9')][_0x289ae9[_0xded9('0x1a')]][_0xded9('0x2a')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x289ae9[_0xded9('0x1a')]);this[_0xded9('0x3e')](_0x289ae9['uniqueid']);}else if(this[_0xded9('0x9')][_0x289ae9[_0xded9('0x3f')]]&&this['channels'][_0x289ae9['linkedid']][_0xded9('0x2a')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x289ae9[_0xded9('0x3f')]);this[_0xded9('0x3e')](_0x289ae9[_0xded9('0x3f')]);}}catch(_0xb818cf){logger[_0xded9('0x1f')]('[ACW][syncHangup]\x20%s',_0xb818cf['message']);}};Acw[_0xded9('0x17')][_0xded9('0x11')]=function(_0x2ed6d4){try{if(!_[_0xded9('0x43')](this[_0xded9('0x9')][_0x2ed6d4[_0xded9('0x44')]])){this[_0xded9('0x3e')](_0x2ed6d4['transfereeuniqueid']);if(this[_0xded9('0x9')][_0x2ed6d4[_0xded9('0x45')]]){this[_0xded9('0x9')][_0x2ed6d4[_0xded9('0x45')]][_0xded9('0x2a')]=!![];this[_0xded9('0x9')][_0x2ed6d4[_0xded9('0x46')]]=this['channels'][_0x2ed6d4[_0xded9('0x45')]];this[_0xded9('0x47')](_0x2ed6d4[_0xded9('0x45')]);}}else if(!_[_0xded9('0x43')](this[_0xded9('0x9')][_0x2ed6d4[_0xded9('0x46')]])){this[_0xded9('0x3e')](_0x2ed6d4['transfertargetuniqueid']);if(this[_0xded9('0x9')][_0x2ed6d4['origtransfereruniqueid']]){this[_0xded9('0x9')][_0x2ed6d4[_0xded9('0x48')]][_0xded9('0x2a')]=!![];this[_0xded9('0x9')][_0x2ed6d4[_0xded9('0x44')]]=this['channels'][_0x2ed6d4['origtransfereruniqueid']];this[_0xded9('0x47')](_0x2ed6d4[_0xded9('0x48')]);}}}catch(_0x53dee5){logger[_0xded9('0x1f')](_0xded9('0x49'),_0x53dee5[_0xded9('0x34')]);}};Acw['prototype'][_0xded9('0x4a')]=function(_0x3b2c15){try{if(this[_0xded9('0x9')][_0x3b2c15['transfereruniqueid']]){logger['info'](_0xded9('0x4b'),JSON[_0xded9('0x3a')](_0x3b2c15['transfereruniqueid']));this[_0xded9('0x3e')](_0x3b2c15[_0xded9('0x4c')]);}else if(this[_0xded9('0x9')][_0x3b2c15[_0xded9('0x4d')]]){logger[_0xded9('0x1c')]('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0xded9('0x3a')](_0x3b2c15[_0xded9('0x4d')]));this[_0xded9('0x3e')](_0x3b2c15[_0xded9('0x4d')]);}}catch(_0x13b1b8){logger[_0xded9('0x1f')](_0xded9('0x4e'),_0x13b1b8['message']);}};Acw[_0xded9('0x17')]['syncAgentRingNoAnswer']=function(_0x3153ec){try{if(this[_0xded9('0x6')][_0x3153ec['queue']]&&this[_0xded9('0x6')][_0x3153ec['queue']][_0xded9('0x4f')]===_0xded9('0x50')){if(this[_0xded9('0x7')][_0x3153ec['interface']]){logger[_0xded9('0x1c')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x3153ec[_0xded9('0x1a')],_0x3153ec[_0xded9('0x22')],_0x3153ec[_0xded9('0x23')]);return RpcUser[_0xded9('0x2c')](this['agents'][_0x3153ec[_0xded9('0x22')]],_0xded9('0x51'),_0x3153ec[_0xded9('0x1a')]);}}}catch(_0xb6faa8){logger[_0xded9('0x1f')](_0xded9('0x52'),_0xb6faa8[_0xded9('0x34')]);}};Acw[_0xded9('0x17')][_0xded9('0x47')]=function(_0x41f6a4,_0x346673=0x2710){if(this[_0xded9('0x9')][_0x41f6a4]){setTimeout(()=>{delete this['channels'][_0x41f6a4];},_0x346673);}};module[_0xded9('0x53')]=Acw; \ No newline at end of file +var _0x224d=['../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','syncAgentConnect','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','updateAcw','timer','update','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][UPDATE][ERRORS:%s]','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','Action','getAgent','voicePause','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','finally','saveUnpause','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','message','acw','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','linkedid','isUndefined','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','deleteChannelAfterTimeout','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','../rpc/user'];(function(_0x1cfdf4,_0x3e1beb){var _0x136f17=function(_0x39ab40){while(--_0x39ab40){_0x1cfdf4['push'](_0x1cfdf4['shift']());}};_0x136f17(++_0x3e1beb);}(_0x224d,0x158));var _0xd224=function(_0x374d90,_0x262da6){_0x374d90=_0x374d90-0x0;var _0x539cbb=_0x224d[_0x374d90];return _0x539cbb;};'use strict';var _=require(_0xd224('0x0'));var moment=require(_0xd224('0x1'));var ami=require('../ami');var logger=require(_0xd224('0x2'))('acw');var RpcUser=require(_0xd224('0x3'));var RpcVoiceAgentReport=require(_0xd224('0x4'));function Acw(_0x7267a6){this['voiceQueues']=_0x7267a6[_0xd224('0x5')];this[_0xd224('0x6')]=_0x7267a6[_0xd224('0x6')];this[_0xd224('0x7')]=_0x7267a6[_0xd224('0x7')];this[_0xd224('0x8')]={};ami['on']('agentconnect',this[_0xd224('0x9')]['bind'](this));ami['on']('hanguprequest',this[_0xd224('0xa')][_0xd224('0xb')](this));ami['on'](_0xd224('0xc'),this[_0xd224('0xd')]['bind'](this));ami['on'](_0xd224('0xe'),this[_0xd224('0xf')][_0xd224('0xb')](this));ami['on'](_0xd224('0x10'),this[_0xd224('0x11')][_0xd224('0xb')](this));ami['on'](_0xd224('0x12'),this[_0xd224('0x13')][_0xd224('0xb')](this));ami['on'](_0xd224('0x14'),this[_0xd224('0x15')][_0xd224('0xb')](this));}function getDiff(_0x58e9ee){var _0x395177=moment()[_0xd224('0x16')](0x0);var _0x46e8e7=moment(_0x58e9ee)[_0xd224('0x16')](0x0);return _0x395177[_0xd224('0x17')](_0x46e8e7,_0xd224('0x18'));}Acw[_0xd224('0x19')][_0xd224('0x1a')]=function(_0x20e45f,_0x1b8e70){var _0x4077e5=this;var _0x2c8b4d=getDiff(_0x4077e5[_0xd224('0x7')][_0x20e45f]['lastPauseAt']);clearTimeout(_0x4077e5['timers'][_0x20e45f][_0xd224('0x1b')]);_0x4077e5[_0xd224('0x7')][_0x20e45f][_0xd224('0x1b')]=![];return RpcVoiceAgentReport[_0xd224('0x1c')]({'acwtime':_0x2c8b4d},_0x4077e5[_0xd224('0x7')][_0x20e45f][_0xd224('0x1d')],_0x20e45f)['then'](function(_0x19e2db){logger['info'](_0xd224('0x1e'),_0x1b8e70,_0x2c8b4d,_0x19e2db);})[_0xd224('0x1f')](function(_0x98e717){logger[_0xd224('0x20')](_0xd224('0x21'),_0x1b8e70,_0x98e717);})['finally'](function(){delete _0x4077e5[_0xd224('0x7')][_0x20e45f];});};Acw[_0xd224('0x19')][_0xd224('0x22')]=function(_0x52613b){try{var _0x345a17=this;var _0x595d9c=this[_0xd224('0x8')][_0x52613b][_0xd224('0x23')];var _0xb3ac2f=this[_0xd224('0x8')][_0x52613b][_0xd224('0x24')];var _0x56cde7=this[_0xd224('0x5')][_0xb3ac2f];var _0x2cd660=![];var _0x4f1150=_0xd224('0x25');if(_0x56cde7['mandatoryDisposition']&&_0x56cde7[_0xd224('0x26')][_0xd224('0x27')]){_0x2cd660=!![];_0x4f1150=_0x56cde7[_0xd224('0x26')][_0xd224('0x27')];}return ami[_0xd224('0x28')]({'action':'QueuePause','interface':_0x595d9c,'paused':!![],'reason':_0x4f1150})['then'](function(){if(_0x345a17[_0xd224('0x6')][_0x595d9c]){return RpcUser[_0xd224('0x29')](_0x345a17[_0xd224('0x6')][_0x595d9c]['id'])['then'](function(_0x317ac9){if(!_0x317ac9||_0x317ac9[_0xd224('0x2a')]){logger['info'](_0xd224('0x2b'),_0x52613b,_0x595d9c,_0xb3ac2f);return;}logger[_0xd224('0x2c')](_0xd224('0x2d'),_0x52613b,_0x595d9c,_0xb3ac2f);var _0x290764=_0x345a17[_0xd224('0x8')][_0x52613b][_0xd224('0x2e')]&&_0x345a17[_0xd224('0x8')][_0x52613b][_0xd224('0x2f')]?_0x345a17[_0xd224('0x8')][_0x52613b]['destlinkedid']:_0x52613b;return RpcUser['savePause'](_0x345a17[_0xd224('0x6')][_0x595d9c],_0x4f1150,_0x290764)[_0xd224('0x30')](function(_0x149105){_0x345a17[_0xd224('0x5')][_0xb3ac2f]['available']-=0x1;_0x345a17['voiceQueues'][_0xb3ac2f]['paused']+=0x1;return _0x149105;});})[_0xd224('0x30')](function(_0x5c9d97){if(_0x2cd660||!_0x5c9d97){return;}_0x345a17[_0xd224('0x7')][_0x595d9c]={};logger[_0xd224('0x2c')](_0xd224('0x31'),_0x52613b,_0x345a17[_0xd224('0x5')][_0xb3ac2f][_0xd224('0x32')],_0x595d9c,_0xb3ac2f);_0x345a17[_0xd224('0x7')][_0x595d9c][_0xd224('0x1b')]=setTimeout(_0x345a17[_0xd224('0x33')][_0xd224('0xb')](_0x345a17,_0x595d9c),_0x345a17[_0xd224('0x5')][_0xb3ac2f]['acwTimeout']*0x3e8);_0x345a17[_0xd224('0x7')][_0x595d9c][_0xd224('0x34')]=moment()[_0xd224('0x35')](_0xd224('0x36'));_0x345a17[_0xd224('0x7')][_0x595d9c][_0xd224('0x1d')]=_0x52613b;_0x345a17[_0xd224('0x7')][_0x595d9c]['queue']=_0xb3ac2f;_0x345a17[_0xd224('0x7')][_0x595d9c][_0xd224('0x1a')]=_0x345a17[_0xd224('0x1a')][_0xd224('0xb')](_0x345a17,_0x595d9c,_0x52613b);});}})[_0xd224('0x1f')](function(){logger[_0xd224('0x20')](_0xd224('0x31'),_0x52613b,_0x345a17[_0xd224('0x5')][_0xb3ac2f]['acwTimeout'],_0x595d9c,_0xb3ac2f);})[_0xd224('0x37')](function(){delete _0x345a17[_0xd224('0x8')][_0x52613b];});}catch(_0x260e6f){logger[_0xd224('0x20')]('[ACW][START]\x20%s',_0x260e6f['message']);}};Acw[_0xd224('0x19')][_0xd224('0x33')]=function(_0xc8179a){try{var _0x309f6b=this;if(_0x309f6b['timers'][_0xc8179a]){_0x309f6b[_0xd224('0x7')][_0xc8179a][_0xd224('0x1b')]=![];var _0x368fe4=_0x309f6b[_0xd224('0x7')][_0xc8179a][_0xd224('0x1d')];var _0x2ad5d7=_0x309f6b[_0xd224('0x7')][_0xc8179a][_0xd224('0x24')];var _0x138e29=_0x309f6b['voiceQueues'][_0x2ad5d7][_0xd224('0x32')];logger[_0xd224('0x2c')]('[%s][TIMER][STOP][AGENT:%s]',_0x368fe4,_0xc8179a);RpcUser[_0xd224('0x29')](this[_0xd224('0x6')][_0xc8179a]['id'])[_0xd224('0x30')](function(_0x1f578f){if(_0x1f578f['pauseType']==='ACW'){return RpcUser[_0xd224('0x38')](_0x309f6b['agents'][_0xc8179a]);}});RpcVoiceAgentReport[_0xd224('0x1c')]({'acwtime':_0x138e29,'agentacw':!![]},_0x368fe4,_0xc8179a)[_0xd224('0x30')](function(_0x4feba3){logger[_0xd224('0x2c')](_0xd224('0x1e'),_0x368fe4,_0x138e29,_0x4feba3);})['catch'](function(_0x35cc41){logger['error']('[%s][UPDATE][ERRORS:%s]',_0x368fe4,_0x35cc41);});}else{logger[_0xd224('0x20')](_0xd224('0x39'),_0xc8179a);if(_0x309f6b['timers']){logger['info'](_0xd224('0x3a'),JSON[_0xd224('0x3b')](_0x309f6b[_0xd224('0x7')]));}}}catch(_0x1528ce){logger['error'](_0xd224('0x3c'),_0x1528ce[_0xd224('0x3d')]);}};Acw[_0xd224('0x19')]['syncAgentConnect']=function(_0x48e3cd){try{if(this['voiceQueues'][_0x48e3cd['queue']]&&(this[_0xd224('0x5')][_0x48e3cd[_0xd224('0x24')]][_0xd224('0x3e')]||this[_0xd224('0x5')][_0x48e3cd[_0xd224('0x24')]][_0xd224('0x3f')])){if(this[_0xd224('0x6')][_0x48e3cd[_0xd224('0x23')]]){this[_0xd224('0x8')][_0x48e3cd[_0xd224('0x1d')]]={'queue':_0x48e3cd[_0xd224('0x24')],'interface':_0x48e3cd[_0xd224('0x23')],'destlinkedid':_0x48e3cd[_0xd224('0x2f')]};}}}catch(_0x593c69){logger[_0xd224('0x20')](_0xd224('0x40'),_0x593c69[_0xd224('0x3d')]);}};Acw[_0xd224('0x19')][_0xd224('0x15')]=function(_0x91dfac){try{if(this['voiceQueues'][_0x91dfac[_0xd224('0x24')]]&&(this[_0xd224('0x5')][_0x91dfac['queue']][_0xd224('0x3e')]||this['voiceQueues'][_0x91dfac[_0xd224('0x24')]][_0xd224('0x3f')])){if(this['agents'][_0x91dfac[_0xd224('0x23')]]){this[_0xd224('0x8')][_0x91dfac[_0xd224('0x1d')]]={'queue':_0x91dfac[_0xd224('0x24')],'interface':_0x91dfac[_0xd224('0x23')]};}}}catch(_0x57d0b7){logger[_0xd224('0x20')]('[ACW][syncAgentConnectPreview]\x20%s',_0x57d0b7[_0xd224('0x3d')]);}};Acw[_0xd224('0x19')][_0xd224('0xa')]=function(_0x2e4c18){try{if(this['channels'][_0x2e4c18[_0xd224('0x1d')]]&&_['isUndefined'](this[_0xd224('0x8')][_0x2e4c18[_0xd224('0x1d')]][_0xd224('0x2e')])){logger[_0xd224('0x2c')]('[%s][HANGUP:UNIQUEID]',_0x2e4c18[_0xd224('0x1d')]);this[_0xd224('0x22')](_0x2e4c18[_0xd224('0x1d')]);}else if(this[_0xd224('0x8')][_0x2e4c18[_0xd224('0x41')]]&&_[_0xd224('0x42')](this['channels'][_0x2e4c18[_0xd224('0x41')]]['attended'])){logger[_0xd224('0x2c')]('[%s][HANGUP:LINKEDID]',_0x2e4c18[_0xd224('0x41')]);this[_0xd224('0x22')](_0x2e4c18[_0xd224('0x41')]);}}catch(_0xbd1d02){logger[_0xd224('0x20')](_0xd224('0x43'),_0xbd1d02[_0xd224('0x3d')]);}};Acw['prototype']['syncHangup']=function(_0x1f00ab){try{if(this['channels'][_0x1f00ab['uniqueid']]&&this[_0xd224('0x8')][_0x1f00ab['uniqueid']][_0xd224('0x2e')]){logger[_0xd224('0x2c')](_0xd224('0x44'),_0x1f00ab[_0xd224('0x1d')]);this[_0xd224('0x22')](_0x1f00ab['uniqueid']);}else if(this[_0xd224('0x8')][_0x1f00ab[_0xd224('0x41')]]&&this[_0xd224('0x8')][_0x1f00ab[_0xd224('0x41')]]['attended']){logger[_0xd224('0x2c')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x1f00ab['linkedid']);this[_0xd224('0x22')](_0x1f00ab[_0xd224('0x41')]);}}catch(_0x198692){logger[_0xd224('0x20')]('[ACW][syncHangup]\x20%s',_0x198692[_0xd224('0x3d')]);}};Acw[_0xd224('0x19')][_0xd224('0x11')]=function(_0x18200f){try{if(!_[_0xd224('0x45')](this[_0xd224('0x8')][_0x18200f[_0xd224('0x46')]])){this[_0xd224('0x22')](_0x18200f[_0xd224('0x46')]);if(this[_0xd224('0x8')][_0x18200f[_0xd224('0x47')]]){this[_0xd224('0x8')][_0x18200f[_0xd224('0x47')]]['attended']=!![];this[_0xd224('0x8')][_0x18200f[_0xd224('0x48')]]=this[_0xd224('0x8')][_0x18200f['secondtransfereruniqueid']];this['deleteChannelAfterTimeout'](_0x18200f['secondtransfereruniqueid']);}}else if(!_[_0xd224('0x45')](this[_0xd224('0x8')][_0x18200f[_0xd224('0x48')]])){this[_0xd224('0x22')](_0x18200f['transfertargetuniqueid']);if(this[_0xd224('0x8')][_0x18200f[_0xd224('0x49')]]){this[_0xd224('0x8')][_0x18200f[_0xd224('0x49')]][_0xd224('0x2e')]=!![];this[_0xd224('0x8')][_0x18200f[_0xd224('0x46')]]=this[_0xd224('0x8')][_0x18200f[_0xd224('0x49')]];this[_0xd224('0x4a')](_0x18200f[_0xd224('0x49')]);}}}catch(_0x517e01){logger[_0xd224('0x20')](_0xd224('0x4b'),_0x517e01['message']);}};Acw[_0xd224('0x19')][_0xd224('0x13')]=function(_0x52e17d){try{if(this[_0xd224('0x8')][_0x52e17d[_0xd224('0x4c')]]){logger[_0xd224('0x2c')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0xd224('0x3b')](_0x52e17d[_0xd224('0x4c')]));this['startAcw'](_0x52e17d[_0xd224('0x4c')]);}else if(this['channels'][_0x52e17d[_0xd224('0x4d')]]){logger[_0xd224('0x2c')](_0xd224('0x4e'),JSON[_0xd224('0x3b')](_0x52e17d[_0xd224('0x4d')]));this[_0xd224('0x22')](_0x52e17d[_0xd224('0x4d')]);}}catch(_0x3cec0a){logger['error'](_0xd224('0x4f'),_0x3cec0a['message']);}};Acw[_0xd224('0x19')][_0xd224('0xf')]=function(_0x1d7a59){try{if(this[_0xd224('0x5')][_0x1d7a59[_0xd224('0x24')]]&&this['voiceQueues'][_0x1d7a59[_0xd224('0x24')]][_0xd224('0x50')]===_0xd224('0x51')){if(this[_0xd224('0x6')][_0x1d7a59[_0xd224('0x23')]]){logger[_0xd224('0x2c')](_0xd224('0x52'),_0x1d7a59[_0xd224('0x1d')],_0x1d7a59[_0xd224('0x23')],_0x1d7a59[_0xd224('0x24')]);return RpcUser[_0xd224('0x53')](this[_0xd224('0x6')][_0x1d7a59[_0xd224('0x23')]],_0xd224('0x54'),_0x1d7a59['uniqueid']);}}}catch(_0x424bb6){logger[_0xd224('0x20')](_0xd224('0x55'),_0x424bb6[_0xd224('0x3d')]);}};Acw[_0xd224('0x19')]['deleteChannelAfterTimeout']=function(_0x3bb83a,_0x56bc78=0x2710){if(this[_0xd224('0x8')][_0x3bb83a]){setTimeout(()=>{delete this[_0xd224('0x8')][_0x3bb83a];},_0x56bc78);}};module[_0xd224('0x56')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index e185f3c..0ba6fef 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 _0xfc2f=['actionSipShowRegistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionQueueSummary','catch','[ami.js][fullybooted]','close','bluebird','util','../../config/logger','ami','../../config/environment','asterisk','username','keepConnected','Action','action','error','format','port','inspect'];(function(_0xade2e7,_0x373f3f){var _0x5778aa=function(_0x56234){while(--_0x56234){_0xade2e7['push'](_0xade2e7['shift']());}};_0x5778aa(++_0x373f3f);}(_0xfc2f,0x1c0));var _0xffc2=function(_0x15924d,_0x792b1a){_0x15924d=_0x15924d-0x0;var _0x213f0c=_0xfc2f[_0x15924d];return _0x213f0c;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0xffc2('0x0'));var util=require(_0xffc2('0x1'));var logger=require(_0xffc2('0x2'))(_0xffc2('0x3'));var config=require(_0xffc2('0x4'));var ami=new Manager(config['asterisk']['port'],config[_0xffc2('0x5')]['ip'],config[_0xffc2('0x5')][_0xffc2('0x6')],config[_0xffc2('0x5')]['password'],!![]);ami[_0xffc2('0x7')]();ami[_0xffc2('0x8')]=BPromise['promisify'](ami[_0xffc2('0x9')]);function error(_0x2ae3b7){logger[_0xffc2('0xa')](util[_0xffc2('0xb')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0xffc2('0x6')],config[_0xffc2('0x5')]['ip'],config[_0xffc2('0x5')][_0xffc2('0xc')],util[_0xffc2('0xd')](_0x2ae3b7,![],null)));}function close(){logger['error'](util['format']('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0xffc2('0x5')]['username'],config[_0xffc2('0x5')]['ip'],config[_0xffc2('0x5')]['port']));}ami[_0xffc2('0xe')]=function(){return function(){return ami[_0xffc2('0x8')]({'action':'sipshowregistry'});};};ami[_0xffc2('0xf')]=function(){return function(){return ami[_0xffc2('0x8')]({'action':_0xffc2('0x10')});};};ami[_0xffc2('0x11')]=function(){return function(){return ami[_0xffc2('0x8')]({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami[_0xffc2('0x8')]({'action':_0xffc2('0x12')});};};ami[_0xffc2('0x13')]=function(){return function(){return ami[_0xffc2('0x8')]({'action':_0xffc2('0x14')});};};function connect(){logger[_0xffc2('0x15')](util[_0xffc2('0xb')](_0xffc2('0x16'),config['asterisk']['username'],config[_0xffc2('0x5')]['ip'],config[_0xffc2('0x5')]['port']));ami['once'](_0xffc2('0xa'),error);ami[_0xffc2('0x17')]('close',close);}ami['on']('connect',connect);ami['on'](_0xffc2('0x18'),function(_0x443cd8){logger['info'](util[_0xffc2('0xb')](_0xffc2('0x19'),config[_0xffc2('0x5')][_0xffc2('0x6')],config['asterisk']['ip'],config[_0xffc2('0x5')][_0xffc2('0xc')],util[_0xffc2('0xd')](_0x443cd8,![],null)));});ami['on'](_0xffc2('0x1a'),function(){logger[_0xffc2('0x15')](util[_0xffc2('0xb')](_0xffc2('0x1b'),config['asterisk'][_0xffc2('0x6')],config[_0xffc2('0x5')]['ip'],config[_0xffc2('0x5')][_0xffc2('0xc')]));return Promise['resolve']()[_0xffc2('0x1c')](ami[_0xffc2('0xe')]())[_0xffc2('0x1c')](ami[_0xffc2('0xf')]())['then'](ami[_0xffc2('0x11')]())['then'](ami[_0xffc2('0x1d')]())['then'](ami[_0xffc2('0x13')]())[_0xffc2('0x1e')](function(_0x51c33e){logger[_0xffc2('0xa')](_0xffc2('0x1f'),util[_0xffc2('0xd')](_0x51c33e,{'showHidden':![],'depth':null}));});});ami[_0xffc2('0x17')](_0xffc2('0xa'),error);ami['once'](_0xffc2('0x20'),close);module['exports']=ami; \ No newline at end of file +var _0xec43=['error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','inspect','actionSipShowRegistry','sipshowregistry','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','catch','[ami.js][fullybooted]','exports','util','../../config/logger','ami','asterisk','username','password','keepConnected','Action','action'];(function(_0x4a2403,_0x5c36ee){var _0x5de6bf=function(_0x5165fa){while(--_0x5165fa){_0x4a2403['push'](_0x4a2403['shift']());}};_0x5de6bf(++_0x5c36ee);}(_0xec43,0xc3));var _0x3ec4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xec43[_0x20a584];return _0x4b41a8;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var util=require(_0x3ec4('0x0'));var logger=require(_0x3ec4('0x1'))(_0x3ec4('0x2'));var config=require('../../config/environment');var ami=new Manager(config[_0x3ec4('0x3')]['port'],config['asterisk']['ip'],config[_0x3ec4('0x3')][_0x3ec4('0x4')],config['asterisk'][_0x3ec4('0x5')],!![]);ami[_0x3ec4('0x6')]();ami[_0x3ec4('0x7')]=BPromise['promisify'](ami[_0x3ec4('0x8')]);function error(_0xfc034e){logger[_0x3ec4('0x9')](util[_0x3ec4('0xa')](_0x3ec4('0xb'),config[_0x3ec4('0x3')]['username'],config[_0x3ec4('0x3')]['ip'],config[_0x3ec4('0x3')][_0x3ec4('0xc')],util[_0x3ec4('0xd')](_0xfc034e,![],null)));}function close(){logger[_0x3ec4('0x9')](util[_0x3ec4('0xa')]('Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s',config[_0x3ec4('0x3')][_0x3ec4('0x4')],config[_0x3ec4('0x3')]['ip'],config['asterisk'][_0x3ec4('0xc')]));}ami[_0x3ec4('0xe')]=function(){return function(){return ami['Action']({'action':_0x3ec4('0xf')});};};ami['actionDeviceStateList']=function(){return function(){return ami['Action']({'action':_0x3ec4('0x10')});};};ami[_0x3ec4('0x11')]=function(){return function(){return ami[_0x3ec4('0x7')]({'action':_0x3ec4('0x12')});};};ami[_0x3ec4('0x13')]=function(){return function(){return ami[_0x3ec4('0x7')]({'action':'queuesummary'});};};ami[_0x3ec4('0x14')]=function(){return function(){return ami['Action']({'action':_0x3ec4('0x15')});};};function connect(){logger[_0x3ec4('0x16')](util[_0x3ec4('0xa')](_0x3ec4('0x17'),config[_0x3ec4('0x3')][_0x3ec4('0x4')],config['asterisk']['ip'],config['asterisk'][_0x3ec4('0xc')]));ami[_0x3ec4('0x18')](_0x3ec4('0x9'),error);ami[_0x3ec4('0x18')](_0x3ec4('0x19'),close);}ami['on'](_0x3ec4('0x1a'),connect);ami['on'](_0x3ec4('0x1b'),function(_0x5bd4d7){logger[_0x3ec4('0x16')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config['asterisk'][_0x3ec4('0x4')],config[_0x3ec4('0x3')]['ip'],config[_0x3ec4('0x3')]['port'],util[_0x3ec4('0xd')](_0x5bd4d7,![],null)));});ami['on']('fullybooted',function(){logger[_0x3ec4('0x16')](util[_0x3ec4('0xa')](_0x3ec4('0x1c'),config['asterisk'][_0x3ec4('0x4')],config['asterisk']['ip'],config[_0x3ec4('0x3')][_0x3ec4('0xc')]));return Promise[_0x3ec4('0x1d')]()['then'](ami[_0x3ec4('0xe')]())[_0x3ec4('0x1e')](ami['actionDeviceStateList']())[_0x3ec4('0x1e')](ami[_0x3ec4('0x11')]())[_0x3ec4('0x1e')](ami[_0x3ec4('0x13')]())['then'](ami['actionCoreShowChannels']())[_0x3ec4('0x1f')](function(_0x1d06e8){logger[_0x3ec4('0x9')](_0x3ec4('0x20'),util[_0x3ec4('0xd')](_0x1d06e8,{'showHidden':![],'depth':null}));});});ami[_0x3ec4('0x18')]('error',error);ami[_0x3ec4('0x18')](_0x3ec4('0x19'),close);module[_0x3ec4('0x21')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 87d1f40..27e757c 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 _0x9ffd=['catch','exports','jayson/promise','bluebird','../../config/logger','client','http','Request','then','debug','rpc','memberReport','error','result'];(function(_0x381bed,_0x3780d6){var _0x23110f=function(_0x51aea0){while(--_0x51aea0){_0x381bed['push'](_0x381bed['shift']());}};_0x23110f(++_0x3780d6);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x2e8c90,_0x491151){_0x2e8c90=_0x2e8c90-0x0;var _0x5ab6ad=_0x9ffd[_0x2e8c90];return _0x5ab6ad;};'use strict';var jayson=require(_0xd9ff('0x0'));var BPromise=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))('ami');var client=jayson[_0xd9ff('0x3')][_0xd9ff('0x4')]({'port':0x2329});client[_0xd9ff('0x5')]=function(_0x5493ae,_0x53e962){return new BPromise(function(_0x1c9460,_0x111697){return client['request'](_0x5493ae,_0x53e962)[_0xd9ff('0x6')](function(_0x2982c3){logger[_0xd9ff('0x7')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x53e962,_0x2982c3);if(_0x2982c3[_0xd9ff('0xa')]){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x2982c3['error']['message'],_0x53e962);return _0x111697(_0x2982c3['error']['message']);}else{return _0x1c9460(_0x2982c3[_0xd9ff('0xb')]);}})[_0xd9ff('0xc')](function(_0x193537){logger[_0xd9ff('0xa')](_0xd9ff('0x8'),_0xd9ff('0x9'),_0x5493ae,_0x193537,_0x53e962);return _0x111697(_0x193537);});});};module[_0xd9ff('0xd')]=client; \ No newline at end of file +var _0xb7e7=['exports','jayson/promise','../../config/logger','client','Request','debug','rpc','error','memberReport','message','result','catch'];(function(_0x20bc10,_0x35bed9){var _0x3bd5ce=function(_0x8d1e4c){while(--_0x8d1e4c){_0x20bc10['push'](_0x20bc10['shift']());}};_0x3bd5ce(++_0x35bed9);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4e6ae6,_0x49dba6){_0x4e6ae6=_0x4e6ae6-0x0;var _0x23c108=_0xb7e7[_0x4e6ae6];return _0x23c108;};'use strict';var jayson=require(_0x7b7e('0x0'));var BPromise=require('bluebird');var logger=require(_0x7b7e('0x1'))('ami');var client=jayson[_0x7b7e('0x2')]['http']({'port':0x2329});client[_0x7b7e('0x3')]=function(_0x556d68,_0x31d0ed){return new BPromise(function(_0x118577,_0x1d9384){return client['request'](_0x556d68,_0x31d0ed)['then'](function(_0x333fa4){logger[_0x7b7e('0x4')](_0x7b7e('0x5'),'memberReport',_0x556d68,_0x31d0ed,_0x333fa4);if(_0x333fa4[_0x7b7e('0x6')]){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x333fa4[_0x7b7e('0x6')][_0x7b7e('0x8')],_0x31d0ed);return _0x1d9384(_0x333fa4[_0x7b7e('0x6')]['message']);}else{return _0x118577(_0x333fa4[_0x7b7e('0x9')]);}})[_0x7b7e('0xa')](function(_0x10a666){logger[_0x7b7e('0x6')](_0x7b7e('0x5'),_0x7b7e('0x7'),_0x556d68,_0x10a666,_0x31d0ed);return _0x1d9384(_0x10a666);});});};module[_0x7b7e('0xb')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index db80d6e..b366dcb 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 _0x14c6=['dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','[rescheduleContact][Machine]','HANGUP','createStateFinal','[syncHangupIvr][createHistory]','dialQueueProject','AGI','moveContactManagedDialer','[syncHangupIvr]','Normal\x20Clearing','outboundUnknownCallsDay','cause-txt','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','resolve','talking','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','[uniqueid]','clearZombieChannels','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','actionOriginate','object','voiceQueue\x20is\x20undefine','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','isOutboundQueue','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','getCallerId','Trunk','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','phone','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','endtime','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','NoAnswer','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','outboundDropCallsDayTimeout','round','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','available','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','avgHandleTime','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','getDataPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','predictiveIntervalHitRate','abandonmentRate','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','getVoiceQueueRtPauses','loggedIn','predictiveIntervalPauses','[CatchErlangB]','agentBusyFactor','outboundQueuePauses','floor','one\x20call\x20every:','milliseconds','checkContactBlack','recallme','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','voicePause','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','[Originate][MoveBlacklist]','inBlackList','handleIvr','limitCalls','temp','getContactDialerIvr','checkContactEmpty','ivrTotalCallsDays','Contact','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','dialLimitQueue','pTalking','countReScheduled','RUNNING','checkIsBlackList','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','getContactDialer','[countReScheduled]\x20','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\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','Amax:\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','p\x20=\x20','Amax\x20=\x20','erlangb','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','lodash','uuid','moment','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','syncQueueSummary','../ami','redis','socket.io-emitter','../rpc/cmHopper','../rpc/setting','../rpc/interval','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','maxNumberOriginate','channels','actions','contactsId','uniqueId','startProgressive','queueBooked','queueBookedRR','agentconnect','bind','syncQueueCallerAbandon','originateresponse','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','then','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','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','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','---------\x20ErlangB\x20---------','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','startProgressive\x20value\x20cleared','startPredictive','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','CAMPAIGN_STATUS','contactsRescheduled','contacts','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','message','starttime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','pick','Interval','Intervals','NULL_INTERVAL','\x20INTERVAL_IS_NULL','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','is\x20disactive','[ifTime][Action]','isTrunkReachable','SIP/%s','status','reachable','trunks','unmonitored','checkIsTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','checkIfTimeIntervals','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','command','iftime\x20%s,%s','interval','content','Action','indexOf','catch','all','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','resetActiveCalls','syncCampaigns','undefined','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','dialPowerLevel','predictive','Queue','method\x20not\x20recognized','Dialer::ifTime()','Voice\x20Queue\x20%s\x20$s','Global:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','AMI\x20IfTime','Error','syncAgentConnect','queue','uniqueid','ivr','updateOriginated','YYYY-MM-DD\x20HH:mm:ss','outboundAnswerCallsDay','agent','agiafterat','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','[syncAgentComplete]','droptime','getSeconds','responsetime','dialQueueTimeout','state','statedesc','Drop','dropreason','dialQueueProject2','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','additional','dialDropMaxRetry','minutes','ListId','VoiceQueueId','CampaignId','[rescheduleContact][Drop]','calleridname','calleridnum','swapAdditionalPhones','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','voiceQueue','dialAbandonedMaxRetry','queueCallerAbandonCreateState','dialAbandonedRetryFrequency','ContactId','[rescheduleContact][Abandoned]','[syncAgentComplete][createHistory][11]','channel','strategy','roundrobin','actionid','isNil','locked','paused','stateinterface','rrmemory','merge','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','rescheduleContact','[unlock][syncQueueStatusComplete]','_rr','unlockRR','Agent:\x20','[booked][RR][finaly]','contactAgent-idHopper:\x20','[booked][unlock]','[unlock2][syncQueueStatusComplete]','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','xcally-motion-dialer','dialAMDActive','value','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','countglobal','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry'];(function(_0x16051a,_0x5e4326){var _0x35d20d=function(_0x52b02e){while(--_0x52b02e){_0x16051a['push'](_0x16051a['shift']());}};_0x35d20d(++_0x5e4326);}(_0x14c6,0xfc));var _0x614c=function(_0x450a63,_0x33254d){_0x450a63=_0x450a63-0x0;var _0x4dc906=_0x14c6[_0x450a63];return _0x4dc906;};'use strict';var util=require(_0x614c('0x0'));var _=require(_0x614c('0x1'));var uuid=require(_0x614c('0x2'));var moment=require(_0x614c('0x3'));var rr=require('rr');var Redis=require(_0x614c('0x4'));var utils=require(_0x614c('0x5'));var hopperUtils=require(_0x614c('0x6'));var ut=require(_0x614c('0x7'));var config=require(_0x614c('0x8'));var logger=require(_0x614c('0x9'))(_0x614c('0xa'));var loggerBooked=require(_0x614c('0x9'))(_0x614c('0xb'));var loggerPredictive=require(_0x614c('0x9'))('predictive');var loggerPredictiveCalls=require(_0x614c('0x9'))('predictiveCalls');var loggerSyncQueueSummary=require('../../../config/logger')(_0x614c('0xc'));var ami=require(_0x614c('0xd'));config[_0x614c('0xe')]=_['defaults'](config[_0x614c('0xe')],{'host':'localhost','port':0x18eb});var io=require(_0x614c('0xf'))(new Redis(config[_0x614c('0xe')]));var cmHopper=require(_0x614c('0x10'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x614c('0x11'));var Interval=require(_0x614c('0x12'));var Action=require('./models/action');var History=require('./models/history');var Final=require(_0x614c('0x13'));var AgentComplete=require(_0x614c('0x14'));var QueueCallerAbandon=require(_0x614c('0x15'));var Hangup=require(_0x614c('0x16'));var ipAgi=process[_0x614c('0x17')][_0x614c('0x18')]||_0x614c('0x19');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x614c('0x1a')][_0x614c('0x1b')]=function(_0x264acf){this[_0x614c('0x1c')]=this[_0x614c('0x1c')]?this['tail'][_0x614c('0x1d')](_0x264acf):_0x264acf();};function Dialer(_0x3f5546,_0x1f9781){this[_0x614c('0x1e')]=new Sequence();this[_0x614c('0x1f')]=_0x1f9781;this[_0x614c('0x20')]=_0x3f5546[_0x614c('0x20')];this[_0x614c('0x21')]=_0x3f5546[_0x614c('0x21')];this['agents']=_0x3f5546[_0x614c('0x22')];this['trunks']=_0x3f5546['trunks'];this[_0x614c('0x23')]=config['maxNumberOriginate']||0x2;this[_0x614c('0x24')]={};this[_0x614c('0x25')]={};this[_0x614c('0x26')]={};this[_0x614c('0x27')]={};this['optionPredictive']={};this['startPredictive']={};this[_0x614c('0x28')]={};this['ivrOriginated']={};this[_0x614c('0x29')]={};this[_0x614c('0x2a')]={};this['queuesSummary']={};ami['on'](_0x614c('0x2b'),this['syncAgentConnect'][_0x614c('0x2c')](this));ami['on']('queuecallerabandon',this[_0x614c('0x2d')]['bind'](this));ami['on'](_0x614c('0x2e'),this[_0x614c('0x2f')][_0x614c('0x2c')](this));ami['on'](_0x614c('0x30'),this[_0x614c('0x31')][_0x614c('0x2c')](this));ami['on']('custom:queuesummary',this[_0x614c('0xc')][_0x614c('0x2c')](this));ami['on'](_0x614c('0x32'),this[_0x614c('0x33')]['bind'](this));ami['on'](_0x614c('0x34'),this[_0x614c('0x35')][_0x614c('0x2c')](this));ami['on'](_0x614c('0x36'),this[_0x614c('0x37')][_0x614c('0x2c')](this));ami['on'](_0x614c('0x38'),this[_0x614c('0x39')][_0x614c('0x2c')](this));ami['on']('queuemember',this[_0x614c('0x3a')]['bind'](this));ami['on'](_0x614c('0x3b'),this[_0x614c('0x3c')][_0x614c('0x2c')](this));this[_0x614c('0x3d')]();this['loopClearZombieChannels']();RpcSetting['getSettings']()[_0x614c('0x3e')](function(_0x10694f){previewRecallmeReminderInterval=_0x10694f[_0x614c('0x3f')];});}function isNotNull(_0x343a55){return _0x343a55!==null&&!_[_0x614c('0x40')](_0x343a55);}function msgResponse(_0x22b87f,_0x2be9fc,_0x1cef30){return{'action':_0x22b87f,'response':_0x2be9fc,'message':_0x1cef30,'stack':_0x1cef30};}function emit(_0x393d1a,_0x2ddb29,_0x262e73){io['to'](_0x393d1a)[_0x614c('0x41')](_0x2ddb29,_0x262e73);}function emitOutboundVoiceQueueSummary(_0xbdec88){if(_0xbdec88[_0x614c('0x42')]===_0x614c('0x43')){logger[_0x614c('0x44')](_0x614c('0x45'),util[_0x614c('0x46')](_0xbdec88,{'showHidden':![],'depth':null}));emit(util[_0x614c('0x47')](_0x614c('0x48'),_0xbdec88[_0x614c('0x49')]),_0x614c('0x4a'),_0xbdec88);}}function checkGetDataPredictive(_0x1aa755){if(isNotNull(_0x1aa755)&&!_[_0x614c('0x4b')](_0x1aa755)){loggerPredictive[_0x614c('0x4c')](_0x614c('0x4d'));loggerPredictive['info'](_0x614c('0x4e'),_0x1aa755[_0x614c('0x4f')]);loggerPredictive[_0x614c('0x4c')](_0x614c('0x50'),_0x1aa755[_0x614c('0x51')]);loggerPredictive[_0x614c('0x4c')](_0x614c('0x52'),_0x1aa755[_0x614c('0x53')]);loggerPredictive[_0x614c('0x4c')](_0x614c('0x54'),_0x1aa755['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive[_0x614c('0x4c')](_0x614c('0x55'),_0x1aa755['predictiveIntervalAvgHoldtime']);loggerPredictive['info']('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1aa755[_0x614c('0x56')]);loggerPredictive['info']('---------------------------');if(_0x1aa755[_0x614c('0x4f')]>0x0){if(!_[_0x614c('0x40')](_0x1aa755['predictiveIntervalAvgTalktime'])&&_0x1aa755['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x614c('0x4c')](_0x614c('0x57'));if(!_[_0x614c('0x40')](_0x1aa755[_0x614c('0x58')])&&_0x1aa755[_0x614c('0x58')]>0x0){return!![];}loggerPredictive[_0x614c('0x4c')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x614c('0x4c')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x614c('0x4c')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x1b1688){return function(_0x3e9619){loggerPredictive[_0x614c('0x4c')](_0x614c('0x59'));loggerPredictive[_0x614c('0x4c')]('Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e9619[_0x614c('0x5a')]);loggerPredictive[_0x614c('0x4c')](_0x614c('0x5b'),_0x3e9619[_0x614c('0x5c')]);loggerPredictive[_0x614c('0x4c')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e9619[_0x614c('0x5d')]);loggerPredictive[_0x614c('0x4c')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e9619[_0x614c('0x5e')]);loggerPredictive[_0x614c('0x4c')](_0x614c('0x5f'),_0x3e9619['erlangAbandonmentRate']);loggerPredictive['info'](_0x614c('0x60'));_['merge'](_0x1b1688,_0x3e9619);};}function ifInterval(_0x31e4f2,_0x372eda){if(_[_0x614c('0x40')](_0x372eda)){return![];}return utils['getSeconds'](undefined,_0x372eda)<_0x31e4f2*0x3c;}function clearPredictiveAttributes(_0x229744){if(_0x229744[_0x614c('0x28')]){_0x229744['startProgressive']=undefined;loggerPredictive['debug'](_0x229744[_0x614c('0x49')],_0x614c('0x61'));}if(_0x229744['startPredictive']){_0x229744[_0x614c('0x62')]=undefined;loggerPredictive[_0x614c('0x44')](_0x229744[_0x614c('0x49')],_0x614c('0x63'));}if(_0x229744[_0x614c('0x64')]){clearInterval(_0x229744[_0x614c('0x64')]);_0x229744[_0x614c('0x64')]=undefined;loggerPredictive[_0x614c('0x44')](_0x229744[_0x614c('0x49')],_0x614c('0x65'));}}function loggerCatchPredictive(_0x4ecb98,_0xa8fd66){return function(_0x24ba21){loggerPredictive[_0x614c('0x66')](_0xa8fd66[_0x614c('0x49')],_0x4ecb98);loggerPredictive[_0x614c('0x66')](_0x24ba21[_0x614c('0x67')]);clearPredictiveAttributes(_0xa8fd66);};}function loggerCatch(_0x1dc684){return function(_0x5a7bf8){logger[_0x614c('0x66')](_0x1dc684,util[_0x614c('0x46')](_0x5a7bf8,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x9cfe9e,_0x121637,_0x2ba1b6){return function(_0x377c0a){utils[_0x614c('0x68')](_0x121637,_0x2ba1b6,0x0);_0x121637['temp']=0x0;logger[_0x614c('0x66')](_0x9cfe9e,util[_0x614c('0x46')](_0x377c0a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x588097){return function(_0x359ab4){if(isNotNull(_0x359ab4)&&isNotNull(_0x359ab4[0x0])){if(_0x359ab4[0x0]['contactsRescheduled']>0x0){_0x588097['message']=utils[_0x614c('0x69')]['CONTACTS_RESCHEDULED'];logger[_0x614c('0x4c')]('[getContactDialer2][ReScheduled]'+_0x588097[_0x614c('0x49')],_0x359ab4[0x0][_0x614c('0x6a')],_0x614c('0x6b'));}else{_0x588097['message']=utils['CAMPAIGN_STATUS'][_0x614c('0x6c')];logger[_0x614c('0x4c')](_0x614c('0x6d')+_0x588097[_0x614c('0x49')]);}}};}function createObjHistory(_0x595925,_0x2eee49,_0x11b6b4,_0x23c949,_0x1b6d5f){_0x595925[_0x614c('0x6e')]=_0x11b6b4;var _0x93cbc2=new Action(_0x595925,_0x2eee49);var _0x5f1707=new History(_0x93cbc2);_0x5f1707['state']=_0x23c949;_0x5f1707['statedesc']=_0x1b6d5f;_0x5f1707['endtime']=_0x93cbc2[_0x614c('0x6f')];return _0x5f1707;}function unlockQueueStatus(_0x59bf71,_0x36bbab){setTimeout(function(){if(_[_0x614c('0x40')](_0x59bf71[_0x614c('0x70')])){loggerBooked[_0x614c('0x66')](_0x614c('0x71'),_0x36bbab);}_0x59bf71[_0x614c('0x70')]=!![];loggerBooked[_0x614c('0x4c')](_0x614c('0x72'),_0x36bbab,JSON[_0x614c('0x73')](_[_0x614c('0x74')](_0x59bf71,[_0x614c('0x49'),_0x614c('0x70')])));},0x1f3);}function checkInterval(_0x1f9f10){return function(){if(!isNotNull(_0x1f9f10[_0x614c('0x75')])){_0x1f9f10[_0x614c('0x6e')]=utils[_0x614c('0x69')]['NULL_INTERVAL'];throw _0x1f9f10['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x1f9f10[_0x614c('0x75')][_0x614c('0x76')])){_0x1f9f10[_0x614c('0x6e')]=utils[_0x614c('0x69')][_0x614c('0x77')];throw _0x1f9f10[_0x614c('0x49')]+_0x614c('0x78');}if(!isNotNull(_[_0x614c('0x4b')](_0x1f9f10[_0x614c('0x75')][_0x614c('0x76')]))){_0x1f9f10[_0x614c('0x6e')]=utils['CAMPAIGN_STATUS']['NULL_INTERVAL'];throw _0x1f9f10[_0x614c('0x49')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0x271a8b){return function(){if(!utils[_0x614c('0x79')](_0x271a8b)){_0x271a8b['message']=utils[_0x614c('0x69')][_0x614c('0x7a')];throw _0x271a8b[_0x614c('0x49')]+_0x614c('0x7b');}};}function emitCampaignSummary(_0x259f94){if(utils[_0x614c('0x7c')](_0x259f94)){emit(util['format'](_0x614c('0x7d'),_0x259f94[_0x614c('0x49')]),_0x614c('0x7e'),_0x259f94);}}function loggerCatchQueueSummary(_0xaffb7e,_0xbf3d27){return function(_0x4e2932){clearPredictiveAttributes(_0xbf3d27);emitCampaignSummary(_0xbf3d27);loggerSyncQueueSummary[_0x614c('0x44')](_0xaffb7e,util[_0x614c('0x46')](_0x4e2932,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x334432){if(_0x334432[_0x614c('0x7f')]){if(_0x334432[_0x614c('0x80')]===0x0){_0x334432[_0x614c('0x7f')]=![];_0x334432['message']=utils[_0x614c('0x69')][_0x614c('0x7a')];loggerSyncQueueSummary[_0x614c('0x44')](_0x614c('0x81'),_0x334432[_0x614c('0x49')],_0x614c('0x82'));}else{_0x334432[_0x614c('0x6e')]=utils[_0x614c('0x69')]['DISACTIVED'];loggerSyncQueueSummary[_0x614c('0x44')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x334432['name'],_0x614c('0x83'));}emitCampaignSummary(_0x334432);}}function myreject(_0x1a7bd5){return function(_0xa05af9){return _0x1a7bd5(msgResponse(_0x614c('0x84'),'Error',JSON[_0x614c('0x73')](_0xa05af9)));};}Dialer[_0x614c('0x1a')][_0x614c('0x85')]=function(_0x5c2117){return!_[_0x614c('0x40')](_0x5c2117)&&_0x5c2117&&!_[_0x614c('0x40')](_0x5c2117['name'])&&!_[_0x614c('0x40')](_0x5c2117['active'])&&_0x5c2117['active']&&(this['trunks'][util[_0x614c('0x47')](_0x614c('0x86'),_0x5c2117[_0x614c('0x49')])][_0x614c('0x87')]===_0x614c('0x88')||this[_0x614c('0x89')][util[_0x614c('0x47')](_0x614c('0x86'),_0x5c2117['name'])][_0x614c('0x87')]===_0x614c('0x8a'));};Dialer['prototype'][_0x614c('0x8b')]=function(_0x468091){var _0x15f352=this;return function(){if(!_0x15f352[_0x614c('0x85')](_0x468091['Trunk'])){if(!_0x15f352['isTrunkReachable'](_0x468091[_0x614c('0x8c')])){_0x468091['message']=utils[_0x614c('0x69')][_0x614c('0x8d')];throw _0x468091['name']+_0x614c('0x8e');}}};};Dialer['prototype'][_0x614c('0x8f')]=function(_0x6f541e,_0x2d314c,_0x30b074,_0x500820){var _0x1ab3e5=this;return function(){var _0x48ad8b=!![];return _0x1ab3e5[_0x614c('0x90')](_0x6f541e,_0x2d314c,_0x30b074,_0x500820,_0x48ad8b);};};Dialer[_0x614c('0x1a')][_0x614c('0x91')]=function(_0x526a67,_0x4708c2,_0x1579f7,_0x5378b5){var _0x5a8cc6=this;return function(){var _0x2c6f3e=![];return _0x5a8cc6[_0x614c('0x90')](_0x526a67[_0x614c('0x76')],_0x4708c2,_0x1579f7,_0x5378b5,_0x2c6f3e);};};Dialer['prototype'][_0x614c('0x90')]=function(_0x121c62,_0x283d8f,_0x5156f6,_0x359c07,_0x58783e){var _0x5aa32c=[];return new Promise(function(_0x5b6791,_0x481acc){if(!isNotNull(_0x121c62)){_0x359c07[_0x614c('0x6e')]=utils[_0x614c('0x69')][_0x614c('0x77')];return _0x481acc(msgResponse(_0x614c('0x92'),_0x614c('0x93'),_0x5156f6+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x614c('0x4b')](_0x121c62)){_0x359c07['message']=utils[_0x614c('0x69')][_0x614c('0x94')];return _0x481acc(msgResponse(_0x614c('0x92'),'Failure',_0x5156f6+_0x614c('0x95')));}if(_0x283d8f&&_[_0x614c('0x40')](config[_0x614c('0x96')][_0x283d8f])){_0x359c07[_0x614c('0x6e')]=utils[_0x614c('0x69')][_0x614c('0x97')];return _0x481acc(msgResponse(_0x614c('0x92'),_0x614c('0x93'),_0x5156f6+_0x614c('0x98')+_0x283d8f));}if(_[_0x614c('0x99')](_0x121c62)){for(var _0x5f128d=0x0;_0x5f128d<_0x121c62[_0x614c('0x9a')];_0x5f128d+=0x1){_0x5aa32c[_0x614c('0x9b')](ami['Action']({'action':_0x614c('0x9c'),'command':util['format'](_0x614c('0x9d'),_0x121c62[_0x5f128d][_0x614c('0x9e')],!_[_0x614c('0x40')](config[_0x614c('0x96')][_0x283d8f])?_0x283d8f:'')})[_0x614c('0x3e')](function(_0x30a12d){return _0x30a12d[_0x614c('0x9f')]['indexOf']('true')>=0x0;})['catch'](myreject(_0x481acc)));}}else{_0x5aa32c[_0x614c('0x9b')](ami[_0x614c('0xa0')]({'action':'command','command':util[_0x614c('0x47')]('iftime\x20%s,%s',_0x121c62,!_[_0x614c('0x40')](config['timezones'][_0x283d8f])?_0x283d8f:'')})['then'](function(_0x1cbc02){return _0x1cbc02['content'][_0x614c('0xa1')]('true')>=0x0;})[_0x614c('0xa2')](myreject(_0x481acc)));}Promise[_0x614c('0xa3')](_0x5aa32c)[_0x614c('0x3e')](function(_0x55a228){var _0x5b3af5=_['some'](_0x55a228);if(_0x5b3af5){return _0x5b6791(_0x5b3af5);}else{_0x359c07['message']=_0x58783e?utils[_0x614c('0x69')][_0x614c('0xa4')]:utils[_0x614c('0x69')][_0x614c('0xa5')];return _0x481acc(msgResponse(_0x614c('0xa6'),'Failure','Global:\x20'+_0x58783e+'\x20'+_0x5156f6+_0x614c('0xa7')+util[_0x614c('0x46')](_0x121c62,{'showHidden':![],'depth':null})+_0x614c('0xa8')+_0x283d8f));}})['catch'](function(_0x29b024){return _0x481acc(msgResponse(_0x614c('0x92'),_0x614c('0x93'),JSON[_0x614c('0x73')](_0x29b024)));});});};Dialer[_0x614c('0x1a')][_0x614c('0x3d')]=function(){var _0x30a185=this;return cmHopper[_0x614c('0xa9')]({'active':![]},{'where':{'active':!![]}})[_0x614c('0x3e')](function(){setInterval(function(){_0x30a185[_0x614c('0xaa')]();},0x3e8);});};Dialer[_0x614c('0x1a')]['syncCampaigns']=function(){var _0x576876=this;var _0x52d66a;for(var _0xf1963 in this[_0x614c('0x21')]){if(typeof this[_0x614c('0x21')][_0xf1963]!==_0x614c('0xab')){_0x52d66a=this[_0x614c('0x21')][_0xf1963];if(utils[_0x614c('0x7c')](_0x52d66a)&&utils[_0x614c('0x79')](_0x52d66a)){_0x52d66a[_0x614c('0x7f')]=!![];Promise['resolve']()[_0x614c('0x3e')](checkIsIVRCampaignActive(_0x52d66a))[_0x614c('0x3e')](checkInterval(_0x52d66a))[_0x614c('0x3e')](_0x576876[_0x614c('0x8b')](_0x52d66a))['then'](_0x576876['checkIfTime'](_0x52d66a['dialGlobalInterval'],_0x52d66a[_0x614c('0xac')],_0x52d66a['name'],_0x52d66a))[_0x614c('0x3e')](_0x576876[_0x614c('0x91')](_0x52d66a[_0x614c('0x75')],_0x52d66a['dialTimezone'],_0x52d66a[_0x614c('0x49')],_0x52d66a))[_0x614c('0x3e')](_0x576876[_0x614c('0xad')](_0x52d66a))[_0x614c('0xa2')](loggerCatchQueueSummary(_0x614c('0xae'),_0x52d66a));}else{notSendMessagesCampaign(_0x52d66a);}}}};Dialer[_0x614c('0x1a')][_0x614c('0xaf')]=function(_0x10addb){if(_0x10addb[_0x614c('0xb0')]!=='predictive'){clearPredictiveAttributes(_0x10addb);}switch(_0x10addb[_0x614c('0xb0')]){case _0x614c('0xb1'):this[_0x614c('0xb2')](_0x10addb,0x1);break;case _0x614c('0xb3'):this[_0x614c('0xb2')](_0x10addb,_0x10addb[_0x614c('0xb4')]);break;case _0x614c('0xb5'):this[_0x614c('0xb5')](_0x10addb);break;case'booked':this[_0x614c('0xb2')](_0x10addb,0x1);break;default:logger[_0x614c('0x66')](_0x614c('0xb6'),_0x10addb[_0x614c('0x49')],_0x614c('0xb7'));}};Dialer[_0x614c('0x1a')][_0x614c('0x92')]=function(_0x493308,_0x26f10b){var _0x4c65c9=_0x493308[_0x614c('0xac')];var _0xcd9eef=_0x26f10b?_0x493308['dialGlobalInterval']:_0x493308[_0x614c('0x75')][_0x614c('0x76')];logger['silly'](_0x614c('0xb8'),_0xcd9eef,_0x4c65c9,_0x493308[_0x614c('0x49')],util[_0x614c('0x47')](_0x614c('0xb9'),_0x493308[_0x614c('0x49')],_0x493308['id']));var _0x7b0955=null;return Interval['intervalIftime'](_0xcd9eef,_0x4c65c9)['then'](function(_0x1e057c){if(_0x1e057c===!![]){return _0x1e057c;}else{_0x493308['message']=_0x26f10b?utils[_0x614c('0x69')][_0x614c('0xa4')]:utils[_0x614c('0x69')][_0x614c('0xa5')];_0x7b0955=msgResponse(_0x614c('0xa6'),_0x614c('0x93'),_0x614c('0xba')+_0x26f10b+'\x20'+_0x493308[_0x614c('0x49')]+_0x614c('0xa7')+util[_0x614c('0x46')](_0xcd9eef,{'showHidden':![],'depth':null})+_0x614c('0xa8')+_0x4c65c9);}if(_0x7b0955!==null){logger['silly'](_0x614c('0xbb'),_0x7b0955);_0x7b0955['isGlobal']=_0x26f10b;throw _0x7b0955;}})[_0x614c('0xa2')](function(_0x491614){logger[_0x614c('0x66')](_0x614c('0xbc'),_0x491614);throw msgResponse('[ifTime][Action]',_0x614c('0xbd'),util[_0x614c('0x46')](_0x491614,{'showHidden':![],'depth':null}));});};Dialer[_0x614c('0x1a')][_0x614c('0xbe')]=function(_0x1443ea){if(this[_0x614c('0x20')][_0x1443ea[_0x614c('0xbf')]]){if(this['uniqueId'][_0x1443ea[_0x614c('0xc0')]]&&this[_0x614c('0x27')][_0x1443ea['uniqueid']][_0x614c('0x42')]!==_0x614c('0xc1')){this[_0x614c('0xc2')](this[_0x614c('0x20')][_0x1443ea[_0x614c('0xbf')]]);this[_0x614c('0x27')][_0x1443ea['uniqueid']]['answertime']=moment()[_0x614c('0x47')](_0x614c('0xc3'));}}};Dialer[_0x614c('0x1a')][_0x614c('0x31')]=function(_0x416e87){var _0x5d4611=this[_0x614c('0x27')][_0x416e87[_0x614c('0xc0')]];if(this[_0x614c('0x20')][_0x416e87['queue']]){if(_0x5d4611&&_0x5d4611[_0x614c('0x42')]!==_0x614c('0xc1')){delete this['uniqueId'][_0x416e87[_0x614c('0xc0')]];this[_0x614c('0x20')][_0x416e87[_0x614c('0xbf')]][_0x614c('0xc4')]+=0x1;var _0x2f87f1=new AgentComplete(_0x5d4611,_0x416e87);if(_0x416e87['reason']===_0x614c('0xc5')){_0x2f87f1[_0x614c('0xc6')]=this['voiceQueues'][_0x416e87[_0x614c('0xbf')]]['dialQueueProject2']&&this['voiceQueues'][_0x416e87[_0x614c('0xbf')]][_0x614c('0xc7')]?moment()[_0x614c('0x47')](_0x614c('0xc3')):undefined;}hopperUtils[_0x614c('0xc8')](_0x2f87f1)[_0x614c('0xa2')](loggerCatch(_0x614c('0xc9')));hopperUtils['moveContactManagedDialer'](_0x2f87f1)[_0x614c('0xa2')](loggerCatch(_0x614c('0xca')));}}};Dialer['prototype'][_0x614c('0x2d')]=function(_0x27f2c6){var _0x9b6f70=this['uniqueId'][_0x27f2c6[_0x614c('0xc0')]];var _0x747be6=this;var _0x4faf11=![];var _0x2fb153;var _0x2ebff0;if(this['voiceQueues'][_0x27f2c6['queue']]){if(_0x9b6f70&&_0x9b6f70[_0x614c('0x42')]!=='ivr'){delete this[_0x614c('0x27')][_0x27f2c6[_0x614c('0xc0')]];this['updateOriginated'](this[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]]);_0x9b6f70[_0x614c('0xcb')]=moment()[_0x614c('0x47')](_0x614c('0xc3'));var _0x2d707c=new QueueCallerAbandon(_0x9b6f70,_0x27f2c6);if(utils[_0x614c('0xcc')](_0x9b6f70[_0x614c('0xcb')],_0x9b6f70[_0x614c('0xcd')])>=_0x9b6f70[_0x614c('0xce')]){this[_0x614c('0x20')][_0x27f2c6['queue']][_0x614c('0x53')]+=0x1;this['voiceQueues'][_0x27f2c6[_0x614c('0xbf')]]['outboundDropCallsDayTimeout']+=0x1;this[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2d707c[_0x614c('0xcf')]=0xa;_0x2d707c[_0x614c('0xd0')]=_0x614c('0xd1');_0x2d707c[_0x614c('0xd2')]='TIMEOUT';_0x2d707c[_0x614c('0xc6')]=this['voiceQueues'][_0x27f2c6['queue']][_0x614c('0xd3')]?moment()[_0x614c('0x47')](_0x614c('0xc3')):undefined;_0x2d707c[_0x614c('0xd4')]+=0x1;_0x2d707c['countglobal']+=0x1;_0x2fb153=this[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]][_0x614c('0xd5')];_0x2ebff0=this[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]][_0x614c('0xd6')];hopperUtils[_0x614c('0xd7')](_0x2d707c,_0x2d707c[_0x614c('0xcf')],_0x9b6f70['voiceQueue'])[_0x614c('0x3e')](function(_0x1375c0){_0x4faf11=_0x1375c0[_0x614c('0xd8')]==0x1;if(_0x2d707c['countdropretry']>=_0x747be6[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]][_0x614c('0xd9')]){_0x747be6['queueCallerAbandonCreateState'](_0x2d707c,_0x1375c0['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2d707c[_0x614c('0xd4')],'scheduledat':moment()['add'](_0x747be6[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]][_0x614c('0xd5')],_0x614c('0xda'))[_0x614c('0x47')](_0x614c('0xc3')),'ContactId':_0x9b6f70['ContactId'],'ListId':_0x9b6f70[_0x614c('0xdb')],'VoiceQueueId':_0x9b6f70[_0x614c('0xdc')]||undefined,'CampaignId':_0x9b6f70[_0x614c('0xdd')]||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0xde')));var _0x257326=new History(_0x2d707c);_0x257326['state']=0xa;_0x257326[_0x614c('0xd0')]=_0x614c('0xd1');_0x257326[_0x614c('0x6f')]=moment()[_0x614c('0x47')]('YYYY-MM-DD\x20HH:mm:ss');_0x257326['endtime']=_0x257326['starttime'];_0x257326['calleridname']=_0x2d707c[_0x614c('0xdf')];_0x257326[_0x614c('0xe0')]=_0x2d707c[_0x614c('0xe0')];hopperUtils[_0x614c('0xc8')](_0x257326)[_0x614c('0xa2')](loggerCatch('[syncAgentComplete][createHistory][10]'));}})['then'](function(){if(_0x4faf11)hopperUtils[_0x614c('0xe1')](_0x2d707c,_0x2fb153,_0x2ebff0)['then'](function(){return 0x1;});});}else{this[_0x614c('0x20')][_0x27f2c6['queue']][_0x614c('0xe2')]+=0x1;this[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]][_0x614c('0xe3')]+=0x1;_0x2d707c[_0x614c('0xcf')]=0xb;_0x2d707c[_0x614c('0xd0')]=_0x614c('0xe4');_0x2d707c[_0x614c('0xd2')]=_0x614c('0xe5');_0x2d707c[_0x614c('0xe6')]+=0x1;_0x2d707c['countglobal']+=0x1;_0x2fb153=this[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]]['dialAbandonedRetryFrequency'];_0x2ebff0=this[_0x614c('0x20')][_0x27f2c6[_0x614c('0xbf')]]['callAdditionalPhoneAfterMin'];hopperUtils['verifyAdditionalPhones'](_0x2d707c,_0x2d707c['state'],_0x9b6f70[_0x614c('0xe7')])[_0x614c('0x3e')](function(_0x548864){if(_0x2d707c['countabandonedretry']>=_0x747be6[_0x614c('0x20')][_0x27f2c6['queue']][_0x614c('0xe8')]){_0x747be6[_0x614c('0xe9')](_0x2d707c,_0x548864[_0x614c('0xd8')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x2d707c['countabandonedretry'],'scheduledat':moment()['add'](_0x747be6[_0x614c('0x20')][_0x27f2c6['queue']][_0x614c('0xea')],_0x614c('0xda'))[_0x614c('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x9b6f70[_0x614c('0xeb')],'ListId':_0x9b6f70[_0x614c('0xdb')],'VoiceQueueId':_0x9b6f70['VoiceQueueId']||undefined,'CampaignId':_0x9b6f70['CampaignId']||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0xec')));var _0x3fed6d=new History(_0x2d707c);_0x3fed6d[_0x614c('0xcf')]=0xb;_0x3fed6d[_0x614c('0xd0')]=_0x614c('0xe4');_0x3fed6d[_0x614c('0x6f')]=moment()['format'](_0x614c('0xc3'));_0x3fed6d['endtime']=_0x3fed6d['starttime'];_0x3fed6d[_0x614c('0xdf')]=_0x2d707c[_0x614c('0xdf')];_0x3fed6d[_0x614c('0xe0')]=_0x2d707c['calleridnum'];hopperUtils['createHistory'](_0x3fed6d)[_0x614c('0xa2')](loggerCatch(_0x614c('0xed')));}})[_0x614c('0x3e')](function(){if(_0x4faf11)hopperUtils[_0x614c('0xe1')](_0x2d707c,_0x2fb153,_0x2ebff0)[_0x614c('0x3e')](function(){return 0x1;});});}}}};Dialer['prototype'][_0x614c('0x37')]=function(_0x5dfa47){if(this['actions'][_0x5dfa47[_0x614c('0xc0')]]){this[_0x614c('0x25')][_0x5dfa47[_0x614c('0xc0')]]['channel']=_0x5dfa47[_0x614c('0xee')];}if(this[_0x614c('0x27')][_0x5dfa47[_0x614c('0xc0')]]){this[_0x614c('0x27')][_0x5dfa47['uniqueid']][_0x614c('0xee')]=_0x5dfa47[_0x614c('0xee')];}};Dialer[_0x614c('0x1a')][_0x614c('0x3a')]=function(_0x4960c8){if(!this[_0x614c('0x25')][_0x4960c8['actionid']]){return;}var _0x44556a=this[_0x614c('0x20')][this[_0x614c('0x25')][_0x4960c8['actionid']]['queue']][_0x614c('0xef')]||'rrmemory';if(_0x44556a===_0x614c('0xf0')){if(this[_0x614c('0x25')][_0x4960c8[_0x614c('0xf1')]]&&_[_0x614c('0xf2')](this['actions'][_0x4960c8[_0x614c('0xf1')]][_0x614c('0xf3')])&&_0x4960c8[_0x614c('0x87')]==='1'&&_0x4960c8[_0x614c('0xf4')]==='0'){if(this[_0x614c('0x22')][_0x4960c8[_0x614c('0xf5')]]){if(!this[_0x614c('0x22')][_0x4960c8[_0x614c('0xf5')]][_0x614c('0xf3')]){this[_0x614c('0x22')][_0x4960c8[_0x614c('0xf5')]][_0x614c('0xf3')]=!![];this[_0x614c('0x25')][_0x4960c8['actionid']][_0x614c('0xf3')]=!![];this[_0x614c('0x25')][_0x4960c8[_0x614c('0xf1')]][_0x614c('0xf5')]=_0x4960c8[_0x614c('0xf5')];}}}}else if(_0x44556a===_0x614c('0xf6')){if(this[_0x614c('0x25')][_0x4960c8[_0x614c('0xf1')]]){if(this[_0x614c('0x22')][_0x4960c8[_0x614c('0xf5')]]){this[_0x614c('0x25')][_0x4960c8[_0x614c('0xf1')]][_0x614c('0xf5')]=_0x4960c8[_0x614c('0xf5')];if(_['isNil'](this[_0x614c('0x29')][this['actions'][_0x4960c8[_0x614c('0xf1')]][_0x614c('0xbf')]])){this[_0x614c('0x29')][this['actions'][_0x4960c8[_0x614c('0xf1')]]['queue']]=[];}this[_0x614c('0x29')][this[_0x614c('0x25')][_0x4960c8[_0x614c('0xf1')]][_0x614c('0xbf')]][_0x614c('0x9b')](_[_0x614c('0xf7')](_[_0x614c('0x74')](this['actions'][_0x4960c8[_0x614c('0xf1')]],[_0x614c('0xf8'),_0x614c('0xf5')]),{'status':_0x4960c8[_0x614c('0x87')],'paused':_0x4960c8[_0x614c('0xf4')]}));}}}};Dialer[_0x614c('0x1a')]['syncQueueStatusComplete']=function(_0x335600){if(!this[_0x614c('0x25')][_0x335600['actionid']]){return;}var _0x329ddb=this;var _0x3159f0=this[_0x614c('0x20')][this[_0x614c('0x25')][_0x335600['actionid']]['queue']];var _0x297ab7=_0x3159f0[_0x614c('0xef')]||_0x614c('0xf6');if(_0x297ab7==='roundrobin'){if(this[_0x614c('0x25')][_0x335600['actionid']]&&this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xf5')]){this[_0x614c('0x1f')][_0x614c('0xf9')](this['actions'][_0x335600[_0x614c('0xf1')]][_0x614c('0xf8')],this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xf5')])['catch'](function(_0x1fa20d){logger[_0x614c('0x66')](_0x614c('0xfa'),util[_0x614c('0x46')](_0x1fa20d,{'showHidden':![],'depth':null}));})[_0x614c('0x1d')](function(){_0x329ddb[_0x614c('0xc2')](_0x329ddb[_0x614c('0x20')][_0x329ddb[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xbf')]]);_0x329ddb[_0x614c('0x22')][_0x329ddb[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xf5')]][_0x614c('0xf3')]=![];delete _0x329ddb[_0x614c('0x25')][_0x335600['actionid']];unlockQueueStatus(_0x3159f0);});}else{this['updateOriginated'](this[_0x614c('0x20')][this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xbf')]]);hopperUtils[_0x614c('0xfb')]({'active':![],'ContactId':this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xeb')],'ListId':this['actions'][_0x335600[_0x614c('0xf1')]][_0x614c('0xdb')],'VoiceQueueId':this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xdd')]||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0xfc')));delete this[_0x614c('0x25')][_0x335600['actionid']];unlockQueueStatus(_0x3159f0);}}else if(_0x297ab7==='rrmemory'){var _0x4b84b3;if(this['actions'][_0x335600[_0x614c('0xf1')]]&&!_['isEmpty'](this['queueBooked'][this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xbf')]])){if(this[_0x614c('0x2a')][_0x329ddb[_0x614c('0x25')][_0x335600['actionid']][_0x614c('0xbf')]]){this['queueBookedRR'][_0x329ddb[_0x614c('0x25')][_0x335600['actionid']][_0x614c('0xbf')]]=this['queueBookedRR'][this['actions'][_0x335600[_0x614c('0xf1')]]['queue']]?this[_0x614c('0x2a')][this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xbf')]]:this['queueBooked'][this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xbf')]]?this['queueBooked'][this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]][_0x614c('0xbf')]][_0x614c('0xfd')]||0x0:0x0;}this[_0x614c('0x29')][this[_0x614c('0x25')][_0x335600[_0x614c('0xf1')]]['queue']][_0x614c('0xfd')]=this[_0x614c('0x2a')][this[_0x614c('0x25')][_0x335600['actionid']]['queue']];for(var _0x167c39=0x0;_0x167c39=_0x3b1d35[_0x614c('0x120')]){_0x2b94b7[_0x614c('0x121')](_0x497190,_0xe1ba43,_0x51d674,_0x614c('0x122'));}else{if(_0x497190['countmachineretry']>=_0x3b1d35[_0x614c('0x123')]){_0x2b94b7['createStateFinal'](_0x497190,_0xe1ba43,_0x51d674,_0x614c('0x124'));}else{hopperUtils[_0x614c('0xfb')]({'active':![],'countmachineretry':_0x497190[_0x614c('0x117')],'scheduledat':moment()[_0x614c('0x125')](_0x3b1d35[_0x614c('0x126')],_0x614c('0xda'))[_0x614c('0x47')](_0x614c('0xc3')),'ContactId':_0x497190[_0x614c('0xeb')],'ListId':_0x497190[_0x614c('0xdb')],'VoiceQueueId':_0x497190[_0x614c('0xdc')]||undefined,'CampaignId':_0x497190['CampaignId']||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0x127')));_0xe1ba43({'reschedule':0x1});}}});}if(_0x4b29fc['type']===_0x614c('0xc1')&&this[_0x614c('0x21')][_0x4b29fc[_0x614c('0xbf')]]['dialAMDActive']&&_0x5bb180[_0x614c('0x10b')]===_0x614c('0x128')){delete this[_0x614c('0x27')][_0x5bb180[_0x614c('0xc0')]];this['updateOriginated'](this['campaigns'][_0x4b29fc[_0x614c('0xbf')]]);_0x568339=new Hangup(_0x4b29fc,_0x5bb180);_0x568339[_0x614c('0xcf')]=0x12;_0x568339['statedesc']='HangupInAMD';_0x568339[_0x614c('0x10e')]=_0x614c('0x10f');ami[_0x614c('0x41')](_0x614c('0x119'),ut[_0x614c('0x110')](_0x568339,'amd'));this[_0x614c('0x112')](_0x568339,'[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]');}if(_0x4b29fc['type']==='ivr'&&this[_0x614c('0x21')][_0x4b29fc[_0x614c('0xbf')]][_0x614c('0x10a')]&&_0x5bb180['value']===_0x614c('0x115')){return new Promise(function(_0x371abd,_0x4bdef8){delete _0x2b94b7[_0x614c('0x27')][_0x5bb180[_0x614c('0xc0')]];_0x2b94b7[_0x614c('0xc2')](_0x2b94b7[_0x614c('0x21')][_0x4b29fc[_0x614c('0xbf')]]);_0x2b94b7['campaigns'][_0x4b29fc[_0x614c('0xbf')]][_0x614c('0xc4')]+=0x1;_0x2b94b7[_0x614c('0x21')][_0x4b29fc[_0x614c('0xbf')]][_0x614c('0x10c')]+=0x1;var _0x231dce=_0x2b94b7[_0x614c('0x21')][_0x4b29fc[_0x614c('0xbf')]];var _0xd70d05=new Hangup(_0x4b29fc,_0x5bb180);_0xd70d05['state']=0x13;_0xd70d05[_0x614c('0xd0')]=_0x614c('0x116');_0xd70d05[_0x614c('0x10e')]=_0x614c('0x10f');_0xd70d05[_0x614c('0x117')]+=0x1;_0xd70d05[_0x614c('0x118')]+=0x1;_0xd70d05['amd']=!![];ami['emit']('custom:amd',ut[_0x614c('0x110')](_0xd70d05,'amd'));hopperUtils[_0x614c('0xc8')](_0xd70d05)[_0x614c('0xa2')](loggerCatch(_0x614c('0x11a')));if(_0xd70d05[_0x614c('0x11b')]+_0xd70d05[_0x614c('0x11c')]+_0xd70d05[_0x614c('0x11d')]+_0xd70d05[_0x614c('0x11e')]+_0xd70d05[_0x614c('0xd4')]+_0xd70d05[_0x614c('0xe6')]+_0xd70d05['countmachineretry']+_0xd70d05['countagentrejectretry']>=_0x231dce[_0x614c('0x120')]){_0x2b94b7['stateGlobal'](_0xd70d05,_0x371abd,_0x4bdef8,_0x614c('0x122'));}else{if(_0xd70d05['countmachineretry']>=_0x231dce['dialMachineMaxRetry']){_0x2b94b7[_0x614c('0x129')](_0xd70d05,_0x371abd,_0x4bdef8,_0x614c('0x124'));}else{hopperUtils[_0x614c('0xfb')]({'active':![],'countmachineretry':_0xd70d05[_0x614c('0x117')],'scheduledat':moment()[_0x614c('0x125')](_0x231dce['dialMachineRetryFrequency'],_0x614c('0xda'))[_0x614c('0x47')](_0x614c('0xc3')),'ContactId':_0xd70d05[_0x614c('0xeb')],'ListId':_0xd70d05[_0x614c('0xdb')],'VoiceQueueId':_0xd70d05['VoiceQueueId']||undefined,'CampaignId':_0xd70d05['CampaignId']||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0x127')));_0x371abd({'reschedule':0x1});}}});}}};Dialer['prototype'][_0x614c('0x35')]=function(_0x42abb9){var _0x3a60fd=this['uniqueId'][_0x42abb9[_0x614c('0xc0')]];var _0x215052;if(_0x3a60fd&&_0x3a60fd['type']===_0x614c('0xc1')){delete this[_0x614c('0x27')][_0x42abb9[_0x614c('0xc0')]];this[_0x614c('0xc2')](this[_0x614c('0x21')][_0x3a60fd[_0x614c('0xbf')]]);this[_0x614c('0x21')][_0x3a60fd[_0x614c('0xbf')]]['ivrAnswerCallsDay']+=0x1;_0x215052=new Hangup(_0x3a60fd,_0x42abb9);hopperUtils[_0x614c('0xc8')](_0x215052)[_0x614c('0xa2')](loggerCatch(_0x614c('0x12a')));hopperUtils['moveContactManagedDialer'](_0x215052)['catch'](loggerCatch('[syncHangupIvr]'));}if(_0x3a60fd&&_0x3a60fd[_0x614c('0x42')]!==_0x614c('0xc1')&&isNotNull(this[_0x614c('0x20')][_0x3a60fd[_0x614c('0xbf')]][_0x614c('0x12b')])){delete this['uniqueId'][_0x42abb9[_0x614c('0xc0')]];this[_0x614c('0xc2')](this['voiceQueues'][_0x3a60fd[_0x614c('0xbf')]]);this[_0x614c('0x20')][_0x3a60fd[_0x614c('0xbf')]][_0x614c('0xc4')]+=0x1;this[_0x614c('0x20')][_0x3a60fd[_0x614c('0xbf')]][_0x614c('0x10c')]+=0x1;_0x215052=new Hangup(_0x3a60fd,_0x42abb9);_0x215052[_0x614c('0xcf')]=0x10;_0x215052[_0x614c('0xd0')]='AnswerAGI';_0x215052[_0x614c('0x10e')]=_0x614c('0x12c');hopperUtils[_0x614c('0xc8')](_0x215052)[_0x614c('0xa2')](loggerCatch(_0x614c('0x12a')));hopperUtils[_0x614c('0x12d')](_0x215052)[_0x614c('0xa2')](loggerCatch(_0x614c('0x12e')));}if(_0x3a60fd&&_0x3a60fd[_0x614c('0x42')]!==_0x614c('0xc1')&&!isNotNull(this[_0x614c('0x20')][_0x3a60fd['queue']][_0x614c('0x12b')])){if(_0x42abb9['cause-txt']===_0x614c('0x12f')){delete this[_0x614c('0x27')][_0x42abb9['uniqueid']];this[_0x614c('0x20')][_0x3a60fd[_0x614c('0xbf')]][_0x614c('0xc4')]+=0x1;const _0x1abc11=new AgentComplete(_0x3a60fd,_0x42abb9);_0x1abc11[_0x614c('0xdd')]=this[_0x614c('0x20')][_0x3a60fd[_0x614c('0xbf')]]['id'];hopperUtils[_0x614c('0xc8')](_0x1abc11)[_0x614c('0xa2')](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x1abc11)['catch'](loggerCatch(_0x614c('0xca')));}else{delete this[_0x614c('0x27')][_0x42abb9[_0x614c('0xc0')]];this['updateOriginated'](this[_0x614c('0x20')][_0x3a60fd[_0x614c('0xbf')]]);this[_0x614c('0x20')][_0x3a60fd[_0x614c('0xbf')]][_0x614c('0x130')]+=0x1;_0x215052=new Hangup(_0x3a60fd,_0x42abb9);_0x215052[_0x614c('0xcf')]=0xc;_0x215052[_0x614c('0xd0')]=_0x42abb9[_0x614c('0x131')];_0x215052[_0x614c('0x10e')]=_0x614c('0x132');hopperUtils[_0x614c('0xc8')](_0x215052)[_0x614c('0xa2')](loggerCatch(_0x614c('0x12a')));hopperUtils['moveContactManagedDialer'](_0x215052)[_0x614c('0xa2')](loggerCatch(_0x614c('0x12e')));}}};Dialer[_0x614c('0x1a')][_0x614c('0xc')]=function(_0x559d0f){var _0x2367ef=this;if(!_0x2367ef['queuesSummary'][_0x559d0f[_0x614c('0x49')]]){_0x2367ef[_0x614c('0x133')][_0x559d0f[_0x614c('0x49')]]={'running':![]};}else if(_0x2367ef[_0x614c('0x133')][_0x559d0f[_0x614c('0x49')]][_0x614c('0x134')]===!![]){return;}else if(_0x2367ef[_0x614c('0x133')][_0x559d0f[_0x614c('0x49')]][_0x614c('0x134')]===![]){_0x2367ef[_0x614c('0x133')][_0x559d0f['name']][_0x614c('0x134')]=!![];}var _0x505f3f=_0x2367ef['voiceQueues'][_0x559d0f[_0x614c('0x49')]];var _0x4c6c5f=_0x505f3f[_0x614c('0x6e')]!==utils['CAMPAIGN_STATUS'][_0x614c('0x7a')];var _0x4c8a09=utils[_0x614c('0x135')](_0x505f3f);_0x505f3f[_0x614c('0x136')]=utils[_0x614c('0x137')](_0x505f3f,_0x2367ef['trunks']);Promise[_0x614c('0x138')]()[_0x614c('0x3e')](function(){if(_0x505f3f[_0x614c('0x136')]===utils[_0x614c('0x69')][_0x614c('0x7a')]){if(_0x4c6c5f){clearPredictiveAttributes(_0x505f3f);_0x559d0f[_0x614c('0x62')]=undefined;_0x559d0f[_0x614c('0x28')]=undefined;}if(_0x505f3f[_0x614c('0x136')]===utils[_0x614c('0x69')][_0x614c('0x7a')]){_0x559d0f['available']=0x0;_0x559d0f['paused']=0x0;_0x559d0f['inUse']=0x0;_0x559d0f[_0x614c('0x139')]=0x0;_0x559d0f['pTalking']=0x0;}}else if(_0x505f3f['statusMessage']===utils[_0x614c('0x69')]['ACTIVE']&&!_0x4c8a09){return _0x2367ef[_0x614c('0x92')](_0x505f3f,!![])[_0x614c('0x3e')](function(){return _0x2367ef[_0x614c('0x92')](_0x505f3f,![]);})[_0x614c('0x3e')](function(){return _0x2367ef[_0x614c('0xaf')](_0x505f3f);})[_0x614c('0xa2')](function(_0x462e65){loggerSyncQueueSummary[_0x614c('0x44')](_0x614c('0x13a'),util['inspect'](_0x462e65,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x505f3f);});}else{clearPredictiveAttributes(_0x505f3f);}})[_0x614c('0x3e')](function(){var _0x5bae5e=_0x559d0f[_0x614c('0x13b')](_0x505f3f);if(_0x5bae5e||_0x505f3f['queueSummaryCountersUpdated']){_0x505f3f[_0x614c('0x13c')]=![];_0x559d0f['updateReportFromOutboundQueue'](_0x505f3f);Object['assign'](_0x505f3f,_0x559d0f);emitOutboundVoiceQueueSummary(_0x559d0f);}_0x2367ef['queuesSummary'][_0x505f3f[_0x614c('0x49')]]['running']=![];})[_0x614c('0xa2')](function(_0xc0869b){logger[_0x614c('0x66')](_0x614c('0x13a'),util[_0x614c('0x46')](_0xc0869b,{'showHidden':![],'depth':null}));_0x2367ef[_0x614c('0x133')][_0x505f3f[_0x614c('0x49')]][_0x614c('0x134')]=![];});};Dialer['prototype'][_0x614c('0x33')]=_[_0x614c('0x13d')](function(){var _0x4d1cc5=_[_0x614c('0x13e')](this[_0x614c('0x20')],function(_0x4bf5f0){return _0x4bf5f0[_0x614c('0x13f')];});var _0x5f55be=_[_0x614c('0x13e')](this[_0x614c('0x22')],function(_0x6b0756){return _0x6b0756[_0x614c('0x140')]&&_0x6b0756[_0x614c('0x87')]==='reachable';});if(_0x4d1cc5[_0x614c('0x9a')]>0x0&&_0x5f55be[_0x614c('0x9a')]>0x0){return Promise[_0x614c('0x138')]()[_0x614c('0x3e')](cmHopper[_0x614c('0x141')](_[_0x614c('0x142')](_0x4d1cc5,'id'),previewRecallmeReminderInterval,_[_0x614c('0x142')](_0x5f55be,'id')))[_0x614c('0x3e')](function(_0x2e59ad){for(var _0x2231ea=0x0;_0x2231ea<_0x2e59ad['length'];_0x2231ea++){var _0x232794=_0x2e59ad[_0x2231ea][_0x614c('0x143')][_0x614c('0x49')];if(_0x232794)io['to'](util[_0x614c('0x47')](_0x614c('0x144'),_0x232794))['emit'](_0x614c('0x145'),{'hopper':_0x2e59ad[_0x2231ea]});}})[_0x614c('0xa2')](function(_0x4e10f7){logger[_0x614c('0x66')](_0x614c('0x146'),_0x4e10f7);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype']['loopClearZombieChannels']=function(){var _0x445cad=this;setInterval(function(){_0x445cad['clearZombieChannels'](_0x445cad[_0x614c('0x27')],_0x614c('0x147'));_0x445cad[_0x614c('0x148')](_0x445cad['actions'],'[actions]');},0x32c8);};Dialer[_0x614c('0x1a')][_0x614c('0x148')]=function(_0x13fea4,_0x12918c){var _0x2a4828=this;for(var _0x269252 in _0x13fea4){if(typeof _0x13fea4[_0x269252]!=='undefined'){this[_0x614c('0x1e')][_0x614c('0x1b')](function(){if(!_[_0x614c('0xf2')](_0x13fea4[_0x269252])){return ami[_0x614c('0xa0')]({'action':'status','channel':_0x13fea4[_0x269252]['channel']})[_0x614c('0xa2')](function(_0x2e5de3){if(_0x2e5de3['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x13fea4[_0x269252]&&_0x13fea4[_0x269252][_0x614c('0x42')]!==_0x614c('0xc1')){_0x2a4828[_0x614c('0xc2')](_0x2a4828[_0x614c('0x20')][_0x13fea4[_0x269252][_0x614c('0xbf')]]);logger[_0x614c('0x66')](_0x614c('0x149'),_0x12918c,_0x269252,_0x13fea4[_0x269252][_0x614c('0xbf')]);delete _0x13fea4[_0x269252];}if(_0x13fea4[_0x269252]&&_0x13fea4[_0x269252][_0x614c('0x42')]===_0x614c('0xc1')){_0x2a4828[_0x614c('0xc2')](_0x2a4828[_0x614c('0x21')][_0x13fea4[_0x269252][_0x614c('0xbf')]]);logger[_0x614c('0x66')](_0x614c('0x14a'),_0x12918c,_0x269252,_0x13fea4[_0x269252][_0x614c('0xbf')]);delete _0x13fea4[_0x269252];}},0x2328);}});}});}}};Dialer[_0x614c('0x1a')]['getVoiceQueueRtPauses']=function(_0x261de6){return Promise[_0x614c('0x138')]()[_0x614c('0x3e')](voiceQueueRt['getVoiceQueueRtPauses'](_0x261de6))[_0x614c('0xa2')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0x614c('0x1a')][_0x614c('0xc2')]=function(_0x3a4950){if(!_[_0x614c('0x40')](_0x3a4950)&&_0x3a4950!==null){if(typeof _0x3a4950['originated']!=='undefined'){if(_0x3a4950[_0x614c('0x80')]>0x0){_0x3a4950[_0x614c('0x80')]-=0x1;}else{logger[_0x614c('0x66')](_0x614c('0x14b'));}}}else{logger[_0x614c('0x66')](_0x614c('0x14c'));}};Dialer[_0x614c('0x1a')][_0x614c('0x14d')]=function(_0x5d8000,_0x248e58){var _0x754825=this;return function(_0x7673a6){_0x754825[_0x614c('0xc2')](_0x248e58);logger['error'](_0x5d8000,util[_0x614c('0x46')](_0x7673a6,{'showHidden':![],'depth':null}));};};Dialer[_0x614c('0x1a')][_0x614c('0x14e')]=function(_0x79cd61,_0x248f29,_0xe5fff3){var _0x1085a2={'state':0x19,'statedesc':_0x614c('0x14f')};this[_0x614c('0xc2')](_0x248f29);this[_0x614c('0x112')](_[_0x614c('0xf7')](_0x1085a2,_[_0x614c('0x74')](_0xe5fff3,[_0x614c('0xeb'),_0x614c('0xdb'),_0x614c('0x150'),'VoiceQueueId','CampaignId'])),_0x614c('0x151'),_0x614c('0x152'));logger[_0x614c('0x66')](_0x79cd61);};Dialer[_0x614c('0x1a')]['saveInDb']=function(_0x36e8c1,_0x1e542c,_0x33ac05){hopperUtils['createHistory'](_0x36e8c1)[_0x614c('0xa2')](loggerCatch(_0x1e542c));hopperUtils[_0x614c('0x12d')](_0x36e8c1)['catch'](loggerCatch(_0x33ac05));};Dialer['prototype'][_0x614c('0xe9')]=function(_0x303cee,_0x83b4a){hopperUtils[_0x614c('0xc8')](_0x303cee)[_0x614c('0xa2')](loggerCatch(_0x614c('0xc9')));if(_0x83b4a==0x0){hopperUtils[_0x614c('0x12d')](_0x303cee)[_0x614c('0xa2')](loggerCatch(_0x614c('0x153')));}};Dialer[_0x614c('0x1a')][_0x614c('0x146')]=function(_0xe6b72e){return Promise[_0x614c('0x138')]()[_0x614c('0x3e')](cmHopper['handlePreviewRecallNotifications'](_0xe6b72e['id'],previewRecallmeReminderInterval))[_0x614c('0x3e')](function(_0x4e80a9){for(var _0xa7c425=0x0;_0xa7c425<_0x4e80a9[_0x614c('0x9a')];_0xa7c425++){var _0x5eb587=_0x4e80a9[_0xa7c425][_0x614c('0x143')][_0x614c('0x49')];if(_0x5eb587)io['to'](util[_0x614c('0x47')](_0x614c('0x144'),_0x5eb587))[_0x614c('0x41')](_0x614c('0x145'),{'hopper':_0x4e80a9[_0xa7c425]});}})[_0x614c('0xa2')](function(){});};Dialer[_0x614c('0x1a')][_0x614c('0xad')]=function(_0x244897){var _0x33d65a=this;return function(){_0x33d65a['handleIvr'](_0x244897);};};Dialer[_0x614c('0x1a')][_0x614c('0x154')]=function(_0x2e84c7,_0x4f3a2f){var _0x3127de=this;var _0x456fa4=uuid['v4']();this[_0x614c('0x25')][_0x456fa4]=new Action(_0x2e84c7,_0x4f3a2f,_0x456fa4);return new Promise(function(_0x582351,_0xb0650e){if(_[_0x614c('0x40')](_0x2e84c7)&&typeof _0x2e84c7!==_0x614c('0x155')){return _0xb0650e(msgResponse('originate',_0x614c('0x93'),_0x614c('0x156')));}if(_[_0x614c('0x40')](_0x4f3a2f['phone'])||_0x4f3a2f['phone']===null){return _0xb0650e(msgResponse(_0x614c('0x157'),_0x614c('0x93'),_0x614c('0x158')));}var _0x9a9c6f={'XMD-CALLERID':_0x3127de['actions'][_0x456fa4][_0x614c('0x159')](),'XMD-AGI':_0x2e84c7[_0x614c('0x12b')]?util[_0x614c('0x47')](_0x614c('0x15a'),ipAgi,_0x2e84c7[_0x614c('0x12b')]):'NONE','XMD-AGIAFTER':_0x2e84c7[_0x614c('0xd3')]?util[_0x614c('0x47')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2e84c7[_0x614c('0xd3')]):_0x614c('0x15b'),'XMD-QUEUE':utils[_0x614c('0x15c')](_0x2e84c7)?util['format']('\x22%s,%s%s,,,%s\x22',_0x2e84c7['name'],_0x2e84c7[_0x614c('0x15d')]||'',_0x2e84c7['dialAgiAfterHangupAgent']?'c':'',_0x2e84c7[_0x614c('0xce')]||0x3):'NONE','XMD-CONTACTID':_0x4f3a2f[_0x614c('0xeb')],'XMD-CDRTYPE':_0x614c('0xa'),'CALLERID(all)':_0x3127de['actions'][_0x456fa4][_0x614c('0x159')](),'XMD-AMD':_0x2e84c7[_0x614c('0x10a')]?_0x614c('0x15e'):'NONE','XMD-DESTINATION':_0x614c('0x109')};if(_0x2e84c7[_0x614c('0x10a')]){_0x9a9c6f[_0x614c('0x15f')]=_0x2e84c7[_0x614c('0x160')]||0x9c4;_0x9a9c6f[_0x614c('0x161')]=_0x2e84c7[_0x614c('0x162')]||0x5dc;_0x9a9c6f[_0x614c('0x163')]=_0x2e84c7[_0x614c('0x164')]||0x320;_0x9a9c6f[_0x614c('0x165')]=_0x2e84c7[_0x614c('0x166')]||0x1388;_0x9a9c6f[_0x614c('0x167')]=_0x2e84c7[_0x614c('0x168')]||0x64;_0x9a9c6f[_0x614c('0x169')]=_0x2e84c7[_0x614c('0x16a')]||0x32;_0x9a9c6f[_0x614c('0x16b')]=_0x2e84c7[_0x614c('0x16c')]||0x3;_0x9a9c6f[_0x614c('0x16d')]=_0x2e84c7[_0x614c('0x16e')]||0x100;_0x9a9c6f['XMD-AMDMAXIMUMWORDLENGTH']=_0x2e84c7[_0x614c('0x16f')]||0x1388;}if(utils[_0x614c('0x15c')](_0x2e84c7)){_0x9a9c6f[_0x614c('0x170')]=_0x4f3a2f[_0x614c('0xdc')];}else{_0x9a9c6f[_0x614c('0x171')]=_0x4f3a2f['CampaignId'];}var _0x769d58=utils[_0x614c('0x172')](_0x4f3a2f['Contact']);Object['assign'](_0x9a9c6f,_0x769d58);var _0x195a6e=_0x3127de[_0x614c('0x85')](_0x2e84c7['Trunk'])?utils['getCallerId'](_0x2e84c7['Trunk'][_0x614c('0x173')],_0x2e84c7['dialOriginateCallerIdName'],_0x2e84c7[_0x614c('0x174')]>0x0?utils[_0x614c('0x175')](_0x2e84c7[_0x614c('0x176')],_0x2e84c7[_0x614c('0x174')]):_0x2e84c7[_0x614c('0x176')]):utils[_0x614c('0x177')](_[_0x614c('0xf2')](_0x2e84c7[_0x614c('0x8c')])?_0x2e84c7[_0x614c('0x178')][_0x614c('0x173')]:_0x2e84c7[_0x614c('0x8c')][_0x614c('0x173')],_0x2e84c7['dialOriginateCallerIdName'],_0x2e84c7['dialRandomLastDigitCallerIdNumber']>0x0?utils[_0x614c('0x175')](_0x2e84c7['dialOriginateCallerIdNumber'],_0x2e84c7['dialRandomLastDigitCallerIdNumber']):_0x2e84c7[_0x614c('0x176')]);if(_0x195a6e){_0x9a9c6f[_0x614c('0x179')]=_0x3127de['actions'][_0x456fa4]['originatecalleridname']=utils[_0x614c('0x17a')](_0x195a6e);_0x9a9c6f[_0x614c('0x17b')]=_0x4f3a2f[_0x614c('0x17c')];}_0x2e84c7['variables']=_0x9a9c6f;return ami[_0x614c('0xa0')]({'actionid':_0x456fa4,'action':'originate','channel':_0x3127de[_0x614c('0x85')](_0x2e84c7['Trunk'])?util[_0x614c('0x47')](_0x614c('0x17d'),_0x2e84c7[_0x614c('0x178')][_0x614c('0x49')],isNotNull(_0x2e84c7[_0x614c('0x17e')])?_0x2e84c7[_0x614c('0x17e')][_0x614c('0x17f')]()||'':'',_0x2e84c7[_0x614c('0x180')]>0x0?_0x4f3a2f[_0x614c('0x17c')][_0x614c('0x181')](_0x2e84c7['dialCutDigit']):_0x4f3a2f[_0x614c('0x17c')]):util[_0x614c('0x47')]('SIP/%s/%s%s',_[_0x614c('0xf2')](_0x2e84c7[_0x614c('0x8c')])?_0x2e84c7[_0x614c('0x178')]['name']:_0x2e84c7['TrunkBackup']['name'],isNotNull(_0x2e84c7['dialPrefix'])?_0x2e84c7[_0x614c('0x17e')][_0x614c('0x17f')]()||'':'',_0x2e84c7['dialCutDigit']>0x0?_0x4f3a2f[_0x614c('0x17c')][_0x614c('0x181')](_0x2e84c7['dialCutDigit']):_0x4f3a2f[_0x614c('0x17c')]),'callerid':_0x195a6e,'Exten':_0x614c('0x109'),'Context':_0x614c('0x182'),'Priority':'1','variable':_0x9a9c6f,'timeout':(_0x2e84c7[_0x614c('0x183')]||0x1e)*0x3e8,'async':!![],'channelid':_0x456fa4})['then'](function(_0x5a10a3){return _0x582351(_0x5a10a3);})[_0x614c('0xa2')](function(_0x534151){_0x2e84c7[_0x614c('0x184')]+=0x1;var _0x3b4db7=new History(_0x3127de['actions'][_0x456fa4]);logger[_0x614c('0x66')](util['format'](_0x614c('0x185'),JSON[_0x614c('0x73')](_0x534151)));_0x3b4db7[_0x614c('0xcf')]=0xe;_0x3b4db7[_0x614c('0xd0')]=_0x614c('0x186');_0x3b4db7['starttime']=moment()[_0x614c('0x47')](_0x614c('0xc3'));_0x3b4db7[_0x614c('0x187')]=_0x3b4db7[_0x614c('0x6f')];hopperUtils['createHistory'](_0x3b4db7)['catch'](loggerCatch(_0x614c('0x188')));_0x3127de[_0x614c('0x12d')](_0x3b4db7)[_0x614c('0xa2')](loggerCatch(_0x614c('0x188')))[_0x614c('0x1d')](function(){delete _0x3127de['actions'][_0x456fa4];return _0xb0650e(msgResponse(_0x614c('0x157'),_0x614c('0xbd'),_0x614c('0x189')));});});});};Dialer['prototype'][_0x614c('0x18a')]=function(_0x4e62be,_0x4f612e,_0x2a4ebb){var _0x5b34a5=new History(_0x4f612e);if(_0x5b34a5[_0x614c('0x11b')]+_0x5b34a5[_0x614c('0x11c')]+_0x5b34a5['countnoanswerretry']+_0x5b34a5[_0x614c('0x11e')]+_0x5b34a5[_0x614c('0xd4')]+_0x5b34a5[_0x614c('0xe6')]+_0x5b34a5[_0x614c('0x117')]+_0x5b34a5['countagentrejectretry']>=_0x2a4ebb[_0x614c('0x120')]-0x1){return!![];}switch(_0x4e62be){case 0x3:if(_0x5b34a5[_0x614c('0x11d')]>=_0x2a4ebb[_0x614c('0x18b')]-0x1){return!![];}hopperUtils[_0x614c('0xfb')]({'active':![],'countnoanswerretry':_0x5b34a5['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x614c('0x125')](_0x2a4ebb[_0x614c('0x18c')],_0x614c('0xda'))['format'](_0x614c('0xc3')),'ContactId':_0x5b34a5[_0x614c('0xeb')],'ListId':_0x5b34a5[_0x614c('0xdb')],'VoiceQueueId':_0x5b34a5[_0x614c('0xdc')]||undefined,'CampaignId':_0x5b34a5[_0x614c('0xdd')]||undefined})[_0x614c('0xa2')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x5b34a5[_0x614c('0x11b')]>=_0x2a4ebb[_0x614c('0x18d')]-0x1){return!![];}hopperUtils[_0x614c('0xfb')]({'active':![],'countbusyretry':_0x5b34a5[_0x614c('0x11b')]+=0x1,'scheduledat':moment()['add'](_0x2a4ebb[_0x614c('0x18e')],_0x614c('0xda'))[_0x614c('0x47')](_0x614c('0xc3')),'ContactId':_0x5b34a5[_0x614c('0xeb')],'ListId':_0x5b34a5['ListId'],'VoiceQueueId':_0x5b34a5[_0x614c('0xdc')]||undefined,'CampaignId':_0x5b34a5[_0x614c('0xdd')]||undefined})['catch'](loggerCatch(_0x614c('0x18f')));break;case 0x8:if(_0x5b34a5['countcongestionretry']>=_0x2a4ebb[_0x614c('0x190')]-0x1){return!![];}hopperUtils[_0x614c('0xfb')]({'active':![],'countcongestionretry':_0x5b34a5[_0x614c('0x11c')]+=0x1,'scheduledat':moment()[_0x614c('0x125')](_0x2a4ebb[_0x614c('0x191')],'minutes')[_0x614c('0x47')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5b34a5[_0x614c('0xeb')],'ListId':_0x5b34a5[_0x614c('0xdb')],'VoiceQueueId':_0x5b34a5[_0x614c('0xdc')]||undefined,'CampaignId':_0x5b34a5[_0x614c('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x5b34a5[_0x614c('0x11e')]>=_0x2a4ebb[_0x614c('0x192')]-0x1){return!![];}else{hopperUtils[_0x614c('0xfb')]({'active':![],'countnosuchnumberretry':_0x5b34a5[_0x614c('0x11e')]+=0x1,'scheduledat':moment()[_0x614c('0x125')](_0x2a4ebb[_0x614c('0x193')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5b34a5[_0x614c('0xeb')],'ListId':_0x5b34a5[_0x614c('0xdb')],'VoiceQueueId':_0x5b34a5[_0x614c('0xdc')]||undefined,'CampaignId':_0x5b34a5['CampaignId']||undefined})[_0x614c('0xa2')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x5b34a5['countdropretry']>=_0x2a4ebb[_0x614c('0xd9')]-0x1){return!![];}hopperUtils[_0x614c('0xfb')]({'active':![],'countdropretry':_0x5b34a5[_0x614c('0xd4')]+=0x1,'scheduledat':moment()['add'](_0x2a4ebb[_0x614c('0xd5')],'minutes')['format'](_0x614c('0xc3')),'ContactId':_0x5b34a5[_0x614c('0xeb')],'ListId':_0x5b34a5['ListId'],'VoiceQueueId':_0x5b34a5['VoiceQueueId']||undefined,'CampaignId':_0x5b34a5[_0x614c('0xdd')]||undefined})[_0x614c('0xa2')](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x5b34a5[_0x614c('0xe6')]>=_0x2a4ebb[_0x614c('0xe8')]-0x1){return!![];}hopperUtils[_0x614c('0xfb')]({'active':![],'countabandonedretry':_0x5b34a5[_0x614c('0xe6')]+=0x1,'scheduledat':moment()[_0x614c('0x125')](_0x2a4ebb[_0x614c('0xea')],_0x614c('0xda'))[_0x614c('0x47')](_0x614c('0xc3')),'ContactId':_0x5b34a5['ContactId'],'ListId':_0x5b34a5['ListId'],'VoiceQueueId':_0x5b34a5['VoiceQueueId']||undefined,'CampaignId':_0x5b34a5[_0x614c('0xdd')]||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0xec')));break;case 0x13:if(_0x5b34a5[_0x614c('0x117')]>=_0x2a4ebb['dialMachineMaxRetry']-0x1){return!![];}hopperUtils[_0x614c('0xfb')]({'active':![],'countmachineretry':_0x5b34a5[_0x614c('0x117')]+=0x1,'scheduledat':moment()['add'](_0x2a4ebb[_0x614c('0x126')],_0x614c('0xda'))['format'](_0x614c('0xc3')),'ContactId':_0x5b34a5[_0x614c('0xeb')],'ListId':_0x5b34a5['ListId'],'VoiceQueueId':_0x5b34a5[_0x614c('0xdc')]||undefined,'CampaignId':_0x5b34a5['CampaignId']||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0x127')));break;case 0x14:if(_0x5b34a5[_0x614c('0x11f')]>=_0x2a4ebb[_0x614c('0x194')]-0x1){return!![];}hopperUtils[_0x614c('0xfb')]({'active':![],'countagentrejectretry':_0x5b34a5['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x614c('0x125')](_0x2a4ebb[_0x614c('0x195')],_0x614c('0xda'))[_0x614c('0x47')](_0x614c('0xc3')),'ContactId':_0x5b34a5['ContactId'],'ListId':_0x5b34a5['ListId'],'VoiceQueueId':_0x5b34a5[_0x614c('0xdc')]||undefined,'CampaignId':_0x5b34a5['CampaignId']||undefined})['catch'](loggerCatch(_0x614c('0x196')));break;default:return!![];}};Dialer[_0x614c('0x1a')][_0x614c('0x105')]=function(_0x3dfd62,_0x5c8be2,_0x2fe290){var _0x48df80=this;var _0x590533=new History(_0x3dfd62);var _0x142ecb=![];var _0x569180;var _0x224859;return new Promise(function(_0x271b3c,_0x3d9543){if(_['isUndefined'](_0x5c8be2)&&typeof _0x5c8be2!==_0x614c('0x155')){return _0x3d9543(msgResponse(_0x614c('0x197'),_0x614c('0x93'),_0x614c('0x198')));}if(_['isUndefined'](_0x2fe290)&&typeof _0x2fe290!=='object'){return _0x3d9543(msgResponse(_0x614c('0x197'),'Failure',_0x614c('0x199')));}hopperUtils[_0x614c('0xd7')](_0x590533,_0x2fe290[_0x614c('0x19a')],_0x5c8be2)[_0x614c('0x3e')](function(_0x31f280){if(_0x31f280[_0x614c('0xd8')]==0x1)_0x142ecb=!![];switch(_0x2fe290[_0x614c('0x19a')]){case'0':_0x5c8be2[_0x614c('0x19b')]+=0x1;_0x590533[_0x614c('0xcf')]=0x0;_0x590533[_0x614c('0xd0')]=_0x614c('0x19c');_0x590533[_0x614c('0x11e')]+=0x1;_0x590533[_0x614c('0x118')]+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0x614c('0x110')](_0x3dfd62,'nosuchnumber'));_0x569180=_0x5c8be2[_0x614c('0x193')];_0x224859=_0x5c8be2['callAdditionalPhoneAfterMin'];hopperUtils[_0x614c('0xc8')](_0x590533)[_0x614c('0xa2')](loggerCatch(_0x614c('0x11a')));if(_0x48df80[_0x614c('0x18a')](0x0,_0x3dfd62,_0x5c8be2)&&!_0x142ecb){if(_0x590533['countnosuchnumberretry']>=_0x5c8be2[_0x614c('0x192')]){_0x48df80[_0x614c('0x129')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x19d'));}else{_0x48df80[_0x614c('0x121')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x19d'));}}break;case'3':_0x5c8be2[_0x614c('0x19e')]+=0x1;_0x590533[_0x614c('0xcf')]=0x3;_0x590533['statedesc']=_0x614c('0x19f');_0x590533[_0x614c('0x11d')]+=0x1;_0x590533[_0x614c('0x118')]+=0x1;var _0x2eb943=ut[_0x614c('0x1a0')](_0x3dfd62,_0x5c8be2);ami[_0x614c('0x41')](_0x614c('0x1a1'),_0x2eb943);_0x569180=_0x5c8be2[_0x614c('0x18c')];_0x224859=_0x5c8be2[_0x614c('0xd6')];hopperUtils[_0x614c('0xc8')](_0x590533)[_0x614c('0xa2')](loggerCatch(_0x614c('0x1a2')));if(_0x48df80[_0x614c('0x18a')](0x3,_0x3dfd62,_0x5c8be2)&&!_0x142ecb){if(_0x590533[_0x614c('0x11d')]>=_0x5c8be2[_0x614c('0x18b')]){_0x48df80[_0x614c('0x129')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x1a3'));}else{_0x48df80[_0x614c('0x121')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x1a3'));}}break;case'5':_0x5c8be2[_0x614c('0x1a4')]+=0x1;_0x590533[_0x614c('0xcf')]=0x5;_0x590533[_0x614c('0xd0')]=_0x614c('0x1a5');_0x590533[_0x614c('0x11b')]+=0x1;_0x590533[_0x614c('0x118')]+=0x1;ami[_0x614c('0x41')](_0x614c('0x1a6'),ut[_0x614c('0x110')](_0x3dfd62,_0x614c('0x1a7')));_0x569180=_0x5c8be2['dialBusyRetryFrequency'];_0x224859=_0x5c8be2[_0x614c('0xd6')];hopperUtils[_0x614c('0xc8')](_0x590533)['catch'](loggerCatch(_0x614c('0x1a8')));if(_0x48df80[_0x614c('0x18a')](0x5,_0x3dfd62,_0x5c8be2)&&!_0x142ecb){if(_0x590533[_0x614c('0x11b')]>=_0x5c8be2[_0x614c('0x18d')]){_0x48df80[_0x614c('0x129')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x1a9'));}else{_0x48df80[_0x614c('0x121')](_0x590533,_0x271b3c,_0x3d9543,'reason\x205\x20busy');}}break;case'8':_0x5c8be2['outboundCongestionCallsDay']+=0x1;_0x590533['state']=0x8;_0x590533['statedesc']=_0x614c('0x1aa');_0x590533['countcongestionretry']+=0x1;_0x590533['countglobal']+=0x1;_0x569180=_0x5c8be2[_0x614c('0x191')];_0x224859=_0x5c8be2[_0x614c('0xd6')];ami[_0x614c('0x41')](_0x614c('0x1ab'),ut['buildObj'](_0x3dfd62,'congestion'));hopperUtils[_0x614c('0xc8')](_0x590533)['catch'](loggerCatch(_0x614c('0x1ac')));if(_0x48df80[_0x614c('0x18a')](0x8,_0x3dfd62,_0x5c8be2)&&!_0x142ecb){if(_0x590533[_0x614c('0x11c')]>=_0x5c8be2[_0x614c('0x190')]){_0x48df80[_0x614c('0x129')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x1ad'));}else{_0x48df80[_0x614c('0x121')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x1ad'));}}break;case'11':_0x5c8be2['outboundAbandonedCallsDay']+=0x1;_0x590533[_0x614c('0xcf')]=0xb;_0x590533[_0x614c('0xd0')]=_0x614c('0xe4');_0x590533[_0x614c('0xe6')]+=0x1;_0x590533['countglobal']+=0x1;_0x569180=_0x5c8be2[_0x614c('0xea')];_0x224859=_0x5c8be2[_0x614c('0xd6')];hopperUtils[_0x614c('0xc8')](_0x590533)[_0x614c('0xa2')](loggerCatch(_0x614c('0xed')));if(_0x48df80[_0x614c('0x18a')](0xb,_0x3dfd62,_0x5c8be2)&&!_0x142ecb){if(_0x590533['countabandonedretry']>=_0x5c8be2[_0x614c('0xe8')]){_0x48df80[_0x614c('0x129')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x1ae'));}else{_0x48df80['stateGlobal'](_0x590533,_0x271b3c,_0x3d9543,'reason\x2011\x20abandoned');}}break;case'20':_0x5c8be2[_0x614c('0x1af')]+=0x1;_0x590533[_0x614c('0xcf')]=0x14;_0x590533[_0x614c('0xd0')]=_0x614c('0x1b0');_0x590533[_0x614c('0x11f')]+=0x1;_0x590533[_0x614c('0x118')]+=0x1;_0x569180=_0x5c8be2[_0x614c('0x195')];_0x224859=_0x5c8be2[_0x614c('0xd6')];ami[_0x614c('0x41')](_0x614c('0x1b1'),ut[_0x614c('0x110')](_0x3dfd62,_0x614c('0x1b2')));hopperUtils[_0x614c('0xc8')](_0x590533)[_0x614c('0xa2')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x48df80['checkRetriveMax'](0x14,_0x3dfd62,_0x5c8be2)&&!_0x142ecb){if(_0x590533[_0x614c('0x11f')]>=_0x5c8be2[_0x614c('0x194')]){_0x48df80[_0x614c('0x129')](_0x590533,_0x271b3c,_0x3d9543,'reason\x2020\x20agentreject');}else{_0x48df80[_0x614c('0x121')](_0x590533,_0x271b3c,_0x3d9543,_0x614c('0x1b3'));}}break;default:_0x5c8be2[_0x614c('0x130')]+=0x1;_0x590533[_0x614c('0xcf')]=0xc;_0x590533['statedesc']=_0x2fe290[_0x614c('0x19a')];_0x569180=_0x5c8be2[_0x614c('0x195')];_0x224859=_0x5c8be2[_0x614c('0xd6')];hopperUtils['createHistory'](_0x590533)['catch'](loggerCatch(_0x614c('0x1b4')));if(_0x48df80[_0x614c('0x18a')](_0x2fe290[_0x614c('0x19a')],_0x3dfd62,_0x5c8be2)&&!_0x142ecb){if(_0x590533[_0x614c('0x11b')]+_0x590533[_0x614c('0x11c')]+_0x590533[_0x614c('0x11d')]+_0x590533['countnosuchnumberretry']+_0x590533[_0x614c('0xd4')]+_0x590533[_0x614c('0xe6')]+_0x590533[_0x614c('0x117')]+_0x590533['countagentrejectretry']>=_0x5c8be2[_0x614c('0x120')]){_0x48df80[_0x614c('0x121')](_0x590533,_0x271b3c,_0x3d9543,_0x2fe290[_0x614c('0x19a')]);}else{_0x48df80[_0x614c('0x129')](_0x590533,_0x271b3c,_0x3d9543,_0x2fe290[_0x614c('0x19a')]);}}}})[_0x614c('0x3e')](function(){if(_0x142ecb){hopperUtils[_0x614c('0xe1')](_0x590533,_0x569180,_0x224859)[_0x614c('0x3e')](function(){return _0x271b3c(0x1);});}});});};Dialer['prototype'][_0x614c('0x121')]=function(_0x184665,_0x48c4e8,_0x494157,_0x4708b8){var _0x59551f=new Final(_0x184665);_0x59551f[_0x614c('0xcf')]=0xf;_0x59551f[_0x614c('0xd0')]=_0x614c('0x1b5');this[_0x614c('0x129')](_0x59551f,_0x48c4e8,_0x494157,_0x4708b8);};Dialer[_0x614c('0x1a')][_0x614c('0x129')]=function(_0x1a53f8,_0x2973f6,_0x4327ca,_0x3eb343){hopperUtils[_0x614c('0x12d')](_0x1a53f8)[_0x614c('0x3e')](function(){return _0x2973f6(msgResponse(_0x614c('0x197'),'Success',_0x3eb343));})[_0x614c('0xa2')](function(){return _0x4327ca(msgResponse(_0x614c('0x1b6'),'Failure',_0x614c('0x1b7')));});};Dialer[_0x614c('0x1a')][_0x614c('0xb5')]=function(_0x15bd7b){var _0x2d508e=_0x15bd7b[_0x614c('0x1b8')]/0x64;var _0x710213=_0x15bd7b[_0x614c('0x1b9')]/(_0x15bd7b[_0x614c('0x1b9')]+_0x15bd7b[_0x614c('0xc4')]);var _0x369fa1=Math[_0x614c('0x1ba')](_0x15bd7b[_0x614c('0x1bb')]*(_0x15bd7b[_0x614c('0x1bc')]/0x64));var _0x4fda7e=Math[_0x614c('0x1ba')](_0x15bd7b['predictiveIntervalAvailable']*(_0x15bd7b['predictiveIntervalMinThreshold']/0x64));var _0x6e6051=_0x15bd7b[_0x614c('0x1bd')]+_0x15bd7b['talking'];var _0x167bfb=Math['floor'](_0x15bd7b['erlangCalls']*_0x15bd7b[_0x614c('0x5d')]*_0x15bd7b['predictiveIntervalHitRate']*_0x15bd7b[_0x614c('0x1be')]);if(_['isUndefined'](_0x15bd7b['startProgressive'])){if(!_['isUndefined'](_0x15bd7b[_0x614c('0x62')])){_0x15bd7b[_0x614c('0x62')]=undefined;loggerPredictive[_0x614c('0x66')]('[startMethodPredictive][StartProgressive]',_0x614c('0x1bf'));}if(!_[_0x614c('0x40')](_0x15bd7b[_0x614c('0x64')])){loggerPredictive[_0x614c('0x66')]('[startMethodPredictive][StartProgressive]',_0x614c('0x1c0'));clearInterval(_0x15bd7b[_0x614c('0x64')]);_0x15bd7b['handlePredictive']=undefined;}_0x15bd7b[_0x614c('0x28')]=moment()['format'](_0x614c('0xc3'));loggerPredictive[_0x614c('0x4c')](_0x15bd7b[_0x614c('0x49')],'collection\x20data\x20in\x20progressive\x20at',_0x15bd7b['startProgressive']);this[_0x614c('0xb2')](_0x15bd7b,0x1);}else if(ifInterval(_0x15bd7b[_0x614c('0x1c1')],_0x15bd7b[_0x614c('0x28')])){this[_0x614c('0xb2')](_0x15bd7b,0x1);loggerPredictiveCalls[_0x614c('0x4c')](_0x614c('0x1c2'),_0x15bd7b[_0x614c('0x28')],_0x15bd7b['name']);_0x15bd7b[_0x614c('0x5a')]=0x0;_0x15bd7b[_0x614c('0x1c3')]=0x0;}else if(_0x2d508e<_0x710213&&_0x15bd7b['dialPredictiveOptimization']===_0x614c('0x1c4')){clearPredictiveAttributes(_0x15bd7b);loggerPredictive[_0x614c('0x4c')](_0x614c('0x1c5'),_0x614c('0x1c6'),_0x710213,_0x614c('0x28'),_0x15bd7b['name']);}else if(_0x167bfb<_0x15bd7b[_0x614c('0x1c3')]&&_0x15bd7b[_0x614c('0x1c7')]==='dropRate'){clearPredictiveAttributes(_0x15bd7b);loggerPredictive[_0x614c('0x4c')](_0x614c('0x1c8'),_0x614c('0x1c9'),_0x167bfb,_0x614c('0x1ca'),_0x15bd7b[_0x614c('0x1c3')],'startProgressive',_0x15bd7b[_0x614c('0x49')]);}else if(!ifInterval(_0x15bd7b['dialPredictiveInterval'],_0x15bd7b[_0x614c('0x28')])&&_[_0x614c('0x40')](_0x15bd7b[_0x614c('0x62')])&&!_[_0x614c('0x40')](_0x15bd7b[_0x614c('0x28')])){_0x15bd7b['startPredictive']=moment()[_0x614c('0x47')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x614c('0x4c')](_0x15bd7b[_0x614c('0x49')],'started\x20in\x20predictive\x20at',_0x15bd7b['startPredictive']);hopperUtils[_0x614c('0x1cb')](_0x15bd7b[_0x614c('0x1c1')])[_0x614c('0x3e')](this['getDataPredictive'](_0x15bd7b))['then'](mergeDataErlangB(_0x15bd7b))[_0x614c('0x3e')](this[_0x614c('0x1cc')](_0x15bd7b))[_0x614c('0xa2')](loggerCatchPredictive(_0x614c('0x1cd'),_0x15bd7b));}else if(!ifInterval(_0x15bd7b[_0x614c('0x1c1')],_0x15bd7b[_0x614c('0x62')])){_0x15bd7b[_0x614c('0x1c3')]=0x0;_0x15bd7b[_0x614c('0x62')]=moment()['format'](_0x614c('0xc3'));loggerPredictive[_0x614c('0x4c')](_0x15bd7b[_0x614c('0x49')],_0x614c('0x1ce'),_0x15bd7b[_0x614c('0x62')]);clearInterval(_0x15bd7b['handlePredictive']);_0x15bd7b[_0x614c('0x64')]=undefined;hopperUtils[_0x614c('0x1cb')](_0x15bd7b['dialPredictiveInterval'])[_0x614c('0x3e')](this[_0x614c('0x1cf')](_0x15bd7b))['then'](mergeDataErlangB(_0x15bd7b))[_0x614c('0x3e')](this[_0x614c('0x1cc')](_0x15bd7b))[_0x614c('0xa2')](loggerCatchPredictive(_0x614c('0x1d0'),_0x15bd7b));}else if(_0x15bd7b['predictiveIntervalAvailable']&&_0x6e6051<_0x15bd7b[_0x614c('0x1bb')]-_0x4fda7e){clearPredictiveAttributes(_0x15bd7b);loggerPredictive['info'](_0x15bd7b[_0x614c('0x49')],_0x614c('0x1d1'),_0x6e6051,')\x20are\x20less\x20than\x20threshold\x20(',_0x15bd7b['predictiveIntervalAvailable'],'-',_0x4fda7e,'=',_0x15bd7b[_0x614c('0x1bb')]-_0x4fda7e,')');}else if(_0x15bd7b[_0x614c('0x1bb')]&&_0x6e6051>_0x15bd7b[_0x614c('0x1bb')]+_0x369fa1){clearPredictiveAttributes(_0x15bd7b);loggerPredictive[_0x614c('0x4c')](_0x15bd7b[_0x614c('0x49')],_0x614c('0x1d1'),_0x6e6051,_0x614c('0x1d2'),_0x15bd7b[_0x614c('0x1bb')],'+',_0x369fa1,'=',_0x15bd7b['predictiveIntervalAvailable']+_0x369fa1,')');}};Dialer[_0x614c('0x1a')][_0x614c('0x1cf')]=function(_0x260907){var _0x35caf9=this;return function(_0x5d343b){return new Promise(function(_0x4ffa38,_0x4c0d00){_['merge'](_0x260907,_0x5d343b[0x0]);if(checkGetDataPredictive(_0x5d343b[0x0])){var _0x5f4236=_0x260907[_0x614c('0x1bb')]=_0x260907['talking']+_0x260907[_0x614c('0x1bd')];var _0x7a8d42=_0x260907[_0x614c('0x1c1')]*0x3c;var _0x58e2ab=_0x5d343b[0x0]['predictiveIntervalAvgTalktime']+_0x5d343b[0x0][_0x614c('0x58')];var _0x2017f2=(_0x5d343b[0x0][_0x614c('0x51')]+_0x5d343b[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x5d343b[0x0][_0x614c('0xe2')])/_0x5d343b[0x0]['predictiveIntervalTotalCalls'];_0x260907[_0x614c('0x1d3')]=_0x2017f2>0x0?_0x2017f2:0x1;switch(_0x260907['dialPredictiveOptimization']){case _0x614c('0x1c4'):var _0x190c89=_0x260907['dialPredictiveOptimizationPercentage']/0x64;return _0x35caf9[_0x614c('0x1d4')](_0x5f4236,_0x7a8d42,_0x58e2ab,_0x2017f2,_0x190c89)[_0x614c('0x3e')](function(_0x536674){return _0x4ffa38(_0x536674);});case'agentBusyFactor':var _0x1adb0f=_0x260907[_0x614c('0x1b8')]/0x64;return _0x35caf9[_0x614c('0x1d5')](_0x5f4236,_0x7a8d42,_0x58e2ab,_0x2017f2,_0x1adb0f)[_0x614c('0x3e')](function(_0x440dc1){return _0x4ffa38(_0x440dc1);});default:return _0x4c0d00(msgResponse(_0x614c('0x1d6'),_0x614c('0x93'),_0x614c('0x1d7')));}}else{return _0x4c0d00(msgResponse(_0x614c('0x1d6'),_0x614c('0x93'),_0x614c('0x1d8')));}});};};Dialer[_0x614c('0x1a')]['getDataPredictiveOld']=function(_0x1bfa0b){var _0x44e3c0=this;return function(_0x2de070){return new Promise(function(_0xff64ff,_0x5a96c2){_['merge'](_0x1bfa0b,_0x2de070[0x0]);if(checkGetDataPredictive(_0x2de070[0x0])){loggerPredictive[_0x614c('0x4c')](JSON[_0x614c('0x73')](_0x2de070[0x0]));if(_0x1bfa0b[_0x614c('0x1c7')]===_0x614c('0x1c4')){return _0x44e3c0[_0x614c('0x1d9')](_0x1bfa0b['id'])['then'](function(_0x13f654){var _0x2b549f=_0x1bfa0b[_0x614c('0x1da')]-_0x13f654[0x0]['outboundQueuePauses'];var _0x126e3c=_0x1bfa0b[_0x614c('0x1c1')]*0x3c;var _0x5b5aa1=_0x2de070[0x0][_0x614c('0x56')]+_0x2de070[0x0][_0x614c('0x58')];var _0x44422d=(_0x2de070[0x0][_0x614c('0x51')]+_0x2de070[0x0][_0x614c('0x53')]+_0x2de070[0x0][_0x614c('0xe2')])/_0x2de070[0x0][_0x614c('0x4f')];var _0x25e5ed=_0x1bfa0b[_0x614c('0x1b8')]/0x64;_0x1bfa0b[_0x614c('0x1db')]=_0x13f654[0x0]['outboundQueuePauses']||0x0;_0x1bfa0b['predictiveIntervalHitRate']=_0x44422d>0x0?_0x44422d:0x1;return _0x44e3c0['abandonmentRate'](_0x2b549f,_0x126e3c,_0x5b5aa1,_0x44422d,_0x25e5ed);})['then'](function(_0xdd19ea){return _0xff64ff(_0xdd19ea);})['catch'](function(_0x4e0607){return _0x5a96c2(msgResponse(_0x614c('0x1dc'),_0x614c('0x93'),JSON[_0x614c('0x73')](_0x4e0607)));});}if(_0x1bfa0b[_0x614c('0x1c7')]===_0x614c('0x1dd')){return _0x44e3c0[_0x614c('0x1d9')](_0x1bfa0b['id'])[_0x614c('0x3e')](function(_0x21b920){var _0xb6f7d9=_0x1bfa0b[_0x614c('0x1da')]-_0x21b920[0x0][_0x614c('0x1de')];var _0x4f9d0c=_0x1bfa0b[_0x614c('0x1c1')]*0x3c;var _0x53693a=_0x2de070[0x0][_0x614c('0x56')]+_0x2de070[0x0][_0x614c('0x58')];var _0x426d67=(_0x2de070[0x0][_0x614c('0x51')]+_0x2de070[0x0][_0x614c('0x53')]+_0x2de070[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x2de070[0x0][_0x614c('0x4f')];var _0x59ec4b=_0x1bfa0b[_0x614c('0x1b8')]/0x64;_0x1bfa0b[_0x614c('0x1db')]=_0x21b920[0x0][_0x614c('0x1de')]||0x0;_0x1bfa0b[_0x614c('0x1d3')]=_0x426d67>0x0?_0x426d67:0x1;return _0x44e3c0['busyFactor'](_0xb6f7d9,_0x4f9d0c,_0x53693a,_0x426d67,_0x59ec4b);})['then'](function(_0x2a96b2){return _0xff64ff(_0x2a96b2);})['catch'](function(_0xe1043d){return _0x5a96c2(msgResponse(_0x614c('0x1dc'),_0x614c('0x93'),JSON[_0x614c('0x73')](_0xe1043d)));});}}else{return _0x5a96c2(msgResponse(_0x614c('0x1d6'),_0x614c('0x93'),_0x614c('0x1d8')));}});};};Dialer[_0x614c('0x1a')][_0x614c('0x1cc')]=function(_0x37c364){var _0x4c61ed=this;return function(){var _0x1ff94b=0x0;var _0xd78f5e=Math[_0x614c('0x1df')](_0x37c364['erlangCallToSecond']*0x3e8);if(_0xd78f5e>0x0){_0xd78f5e=_0xd78f5e<0x64?0x64:_0xd78f5e;loggerPredictive[_0x614c('0x4c')](_0x37c364[_0x614c('0x49')],_0x614c('0x1e0'),_0xd78f5e,_0x614c('0x1e1'));_0x37c364[_0x614c('0x64')]=setInterval(function(){_0x4c61ed['handlePredictive'](_0x37c364);loggerPredictiveCalls['info']('[handlePredictive]',_0x1ff94b+=0x1);},_0xd78f5e);}else{loggerPredictive[_0x614c('0x4c')](_0x37c364['name'],'fail\x20to\x20scheduled\x20calls');}};};Dialer[_0x614c('0x1a')][_0x614c('0x1e2')]=function(_0x405ebe,_0x4b7c8c){var _0x31ad35=this;return function(_0xd169e7){if(_[_0x614c('0x4b')](_0xd169e7)){if(_[_0x614c('0xf2')](_0x4b7c8c[_0x614c('0x150')])||!_0x4b7c8c[_0x614c('0x1e3')]){if(_0x405ebe[_0x614c('0xb0')]===_0x614c('0xb')){_0x405ebe['queueStatusComplete']=_[_0x614c('0x40')](_0x405ebe['queueStatusComplete'])?!![]:_0x405ebe[_0x614c('0x70')];var _0x1040d9=uuid['v4']();_0x31ad35[_0x614c('0x25')][_0x1040d9]=new Action(_0x405ebe,_0x4b7c8c,_0x1040d9);loggerBooked[_0x614c('0x4c')]('[booked][checkContactBlack]',_0x1040d9,'queueStatusComplete:\x20',JSON[_0x614c('0x73')](_0x405ebe['queueStatusComplete']),_0x614c('0x1e4'),_0x405ebe[_0x614c('0x49')]);if(_0x405ebe[_0x614c('0x70')]){_0x405ebe['queueStatusComplete']=![];_0x31ad35[_0x614c('0x29')][_0x31ad35[_0x614c('0x25')][_0x1040d9]['queue']]=[];ami[_0x614c('0xa0')]({'actionid':_0x1040d9,'action':'queuestatus','queue':_0x405ebe[_0x614c('0x49')]})[_0x614c('0xa2')](function(){_0x31ad35[_0x614c('0xc2')](_0x405ebe);hopperUtils[_0x614c('0xfb')]({'active':![],'ContactId':_0x31ad35[_0x614c('0x25')][_0x1040d9]['ContactId'],'ListId':_0x31ad35[_0x614c('0x25')][_0x1040d9]['ListId'],'VoiceQueueId':_0x31ad35[_0x614c('0x25')][_0x1040d9]['VoiceQueueId']||undefined,'CampaignId':_0x31ad35[_0x614c('0x25')][_0x1040d9][_0x614c('0xdd')]||undefined})['catch'](loggerCatch(_0x614c('0x1e5')));delete _0x31ad35['actions'][_0x1040d9];});}else{loggerBooked['info'](_0x614c('0x1e6'),JSON[_0x614c('0x73')](_0x405ebe[_0x614c('0x70')]),_0x614c('0x1e4'),_0x405ebe['name']);_0x31ad35['updateOriginated'](_0x405ebe);hopperUtils[_0x614c('0xfb')]({'active':![],'ContactId':_0x31ad35[_0x614c('0x25')][_0x1040d9][_0x614c('0xeb')],'ListId':_0x31ad35[_0x614c('0x25')][_0x1040d9][_0x614c('0xdb')],'VoiceQueueId':_0x31ad35['actions'][_0x1040d9]['VoiceQueueId']||undefined,'CampaignId':_0x31ad35['actions'][_0x1040d9]['CampaignId']||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0x1e5')));delete _0x31ad35[_0x614c('0x25')][_0x1040d9];}}else{return _0x31ad35[_0x614c('0x154')](_0x405ebe,_0x4b7c8c);}}else{if(utils[_0x614c('0xcc')](undefined,_0x4b7c8c['scheduledat'])<_0x405ebe[_0x614c('0x1e7')]*0x3c){if(_0x4b7c8c['Agent']&&!_0x4b7c8c[_0x614c('0x143')][_0x614c('0x1e8')]){_0x31ad35[_0x614c('0x1f')]['run'](_0x4b7c8c['id'])['finally'](function(){_0x31ad35[_0x614c('0xc2')](_0x405ebe);});}else{hopperUtils['unlockContact']({'active':![]},_0x4b7c8c['id'],0x1)['finally'](function(){_0x31ad35[_0x614c('0xc2')](_0x405ebe);});}}else{_0x405ebe['outboundReCallsDay']+=0x1;_0x31ad35[_0x614c('0xc2')](_0x405ebe);if(_0x405ebe[_0x614c('0x1e9')]){hopperUtils[_0x614c('0xfb')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4b7c8c[_0x614c('0xeb')],'ListId':_0x4b7c8c['ListId'],'VoiceQueueId':_0x4b7c8c['VoiceQueueId']||undefined,'CampaignId':_0x4b7c8c[_0x614c('0xdd')]||undefined})[_0x614c('0xa2')](loggerCatch(_0x614c('0x1ea')));hopperUtils[_0x614c('0xc8')](createObjHistory(_0x405ebe,_0x4b7c8c,utils['CAMPAIGN_STATUS'][_0x614c('0x1eb')],0x17,_0x614c('0x1ec')))[_0x614c('0xa2')](loggerCatch(_0x614c('0x1ed')));}else{_0x31ad35[_0x614c('0x112')](createObjHistory(_0x405ebe,_0x4b7c8c,utils[_0x614c('0x69')][_0x614c('0x1ee')],0x16,_0x614c('0x1ef')),_0x614c('0x1f0'),_0x614c('0x1f1'));}}}}else{_0x405ebe[_0x614c('0x1f2')]+=0x1;_0x31ad35['saveInDb'](createObjHistory(_0x405ebe,_0x4b7c8c,utils[_0x614c('0x69')][_0x614c('0x1f3')],0xd,'Blacklist'),'[Originate][historyBlacklist]',_0x614c('0x1f4'));throw _0x614c('0x1f5');}};};Dialer[_0x614c('0x1a')][_0x614c('0x1f6')]=function(_0x33bf64){var _0x33db0e=this;var _0x5aa3d0=_0x33bf64[_0x614c('0x1f7')]-_0x33bf64[_0x614c('0x80')];emitCampaignSummary(_0x33bf64);if(_0x5aa3d0>0x0&&_0x33bf64[_0x614c('0x1f8')]==0x0){if(_0x5aa3d0>this[_0x614c('0x23')]){_0x5aa3d0=this[_0x614c('0x23')];}_0x33bf64[_0x614c('0x1f8')]=0x1;hopperUtils[_0x614c('0x1f9')](_0x33bf64,_0x5aa3d0)[_0x614c('0x3e')](function(_0x1a7a14){_0x33bf64[_0x614c('0x1f8')]=0x0;if(_0x1a7a14){if(!utils[_0x614c('0x1fa')](_0x1a7a14)){_0x33bf64[_0x614c('0x6e')]=utils['CAMPAIGN_STATUS']['NO_AVAILABLE_CONTACTS'];logger[_0x614c('0x4c')]('[getContactCampaign2][Empty]'+_0x33bf64[_0x614c('0x49')]);}else{_0x33bf64[_0x614c('0x80')]+=_0x1a7a14[_0x614c('0x9a')];_0x33bf64['message']=utils[_0x614c('0x69')]['RUNNING'];for(var _0x327c37=0x0;_0x327c37<_0x1a7a14[_0x614c('0x9a')];_0x327c37+=0x1){_0x33bf64[_0x614c('0x1fb')]+=0x1;if(_[_0x614c('0xf2')](_0x1a7a14[_0x327c37])||_[_0x614c('0xf2')](_0x1a7a14[_0x327c37][_0x614c('0x1fc')])||_[_0x614c('0xf2')](_0x1a7a14[_0x327c37][_0x614c('0x17c')])){_0x33db0e[_0x614c('0x14e')](_0x614c('0x1fd'),_0x33bf64,_0x1a7a14[_0x327c37]);}else{hopperUtils[_0x614c('0x1fe')](_[_0x614c('0x74')](_0x1a7a14[_0x327c37],[_0x614c('0xdd'),_0x614c('0x17c')]))[_0x614c('0x3e')](_0x33db0e[_0x614c('0x1e2')](_0x33bf64,_0x1a7a14[_0x327c37]))[_0x614c('0xa2')](_0x33db0e['loggerHandler'](_0x614c('0x1ff'),_0x33bf64));}}}}})[_0x614c('0xa2')](loggerGetContactDialer('[getContactCampaign2]',_0x33bf64,_0x5aa3d0));}};Dialer['prototype'][_0x614c('0xb2')]=function(_0x1e778a,_0x5abedc){var _0x4504ca=this;var _0x44bcf0=[];if(_0x5abedc<0x1||_0x1e778a[_0x614c('0xb0')]===_0x614c('0xb')){_0x5abedc=0x1;}var _0x2b2c6d=Math[_0x614c('0x1df')](_0x1e778a['available']*_0x5abedc)-_0x1e778a['originated'];if(_0x1e778a[_0x614c('0x200')]>0x0){var _0x16f403=_0x1e778a[_0x614c('0x200')]-_0x1e778a[_0x614c('0x80')]-_0x1e778a[_0x614c('0x139')]-_0x1e778a[_0x614c('0x201')];if(_0x2b2c6d>_0x16f403){_0x2b2c6d=_0x16f403;}}if(_0x2b2c6d>0x0&&_0x1e778a[_0x614c('0x1f8')]==0x0){if(_0x1e778a[_0x614c('0xb0')]===_0x614c('0xb')){_0x2b2c6d=0x1;}if(_0x2b2c6d>this[_0x614c('0x23')]){_0x2b2c6d=this['maxNumberOriginate'];}for(var _0x79fee3 in this[_0x614c('0x22')]){if(typeof this[_0x614c('0x22')][_0x79fee3]!==_0x614c('0xab')){if(this[_0x614c('0x22')][_0x79fee3]['state']==='not_inuse'&&this['agents'][_0x79fee3][_0x614c('0x87')]===_0x614c('0x88')){_0x44bcf0[_0x614c('0x9b')](this[_0x614c('0x22')][_0x79fee3]['id']);}}}_0x1e778a[_0x614c('0x1f8')]=0x1;hopperUtils['getContactDialer'](_0x1e778a,_0x44bcf0,_0x2b2c6d)['then'](function(_0x18af7a){_0x1e778a[_0x614c('0x1f8')]=0x0;if(_0x18af7a){if(!utils[_0x614c('0x1fa')](_0x18af7a)){hopperUtils[_0x614c('0x202')](_0x1e778a)['then'](sendMessageReschedule(_0x1e778a))['catch'](loggerCatch('[countReScheduled]\x20'));}else{_0x1e778a[_0x614c('0x80')]+=_0x18af7a['length'];_0x1e778a[_0x614c('0x6e')]=_0x1e778a['dialMethod']===_0x614c('0xb')?utils[_0x614c('0x69')][_0x614c('0x15e')]:utils[_0x614c('0x69')][_0x614c('0x203')];for(var _0x15644b=0x0;_0x15644b<_0x18af7a[_0x614c('0x9a')];_0x15644b+=0x1){if(_[_0x614c('0xf2')](_0x18af7a[_0x15644b])||_[_0x614c('0xf2')](_0x18af7a[_0x15644b][_0x614c('0x1fc')])||_[_0x614c('0xf2')](_0x18af7a[_0x15644b][_0x614c('0x17c')])){_0x4504ca[_0x614c('0x14e')](_0x614c('0x1fd'),_0x1e778a,_0x18af7a[_0x15644b]);}else{hopperUtils[_0x614c('0x204')](_[_0x614c('0x74')](_0x18af7a[_0x15644b],[_0x614c('0xdc'),_0x614c('0x17c')]))[_0x614c('0x3e')](_0x4504ca[_0x614c('0x1e2')](_0x1e778a,_0x18af7a[_0x15644b]))[_0x614c('0xa2')](_0x4504ca[_0x614c('0x14d')](_0x614c('0x1fd'),_0x1e778a));}}}}})['catch'](loggerGetContactDialer(_0x614c('0x205'),_0x1e778a,_0x2b2c6d));}};Dialer[_0x614c('0x1a')][_0x614c('0x64')]=function(_0x8a0689){if(_0x8a0689[_0x614c('0x200')]>0x0){var _0x330700=_0x8a0689[_0x614c('0x200')]-_0x8a0689[_0x614c('0x80')]-_0x8a0689[_0x614c('0x139')];if(_0x330700>0x0&&_0x8a0689[_0x614c('0x1f8')]==0x0){this[_0x614c('0x206')](_0x8a0689);}else{loggerPredictiveCalls['info'](_0x614c('0x207'));}}else{this[_0x614c('0x206')](_0x8a0689);}};Dialer['prototype'][_0x614c('0x206')]=function(_0x3faad0){var _0x2c50da=this;var _0x9b273f=[];_0x3faad0[_0x614c('0x80')]+=0x1;for(var _0x27f297 in this['agents']){if(typeof this[_0x614c('0x22')][_0x27f297]!==_0x614c('0xab')){if(this['agents'][_0x27f297][_0x614c('0xcf')]===_0x614c('0x208')&&this['agents'][_0x27f297][_0x614c('0x87')]===_0x614c('0x88')){_0x9b273f[_0x614c('0x9b')](this[_0x614c('0x22')][_0x27f297]['id']);}}}_0x3faad0[_0x614c('0x1f8')]=0x1;return this[_0x614c('0x209')](_0x3faad0['id'],_0x9b273f,0x1,_0x3faad0['dialOrderByScheduledAt'],_0x3faad0)['then'](function(_0x397e67){_0x3faad0['temp']=0x1;if(_0x397e67){if(!utils[_0x614c('0x1fa')](_0x397e67)){utils[_0x614c('0x68')](_0x3faad0,0x1,0x0);return hopperUtils['countReScheduled'](_0x3faad0)[_0x614c('0x3e')](sendMessageReschedule(_0x3faad0))[_0x614c('0xa2')](loggerCatch(_0x614c('0x20a')));}else{_0x3faad0[_0x614c('0x6e')]=utils[_0x614c('0x69')][_0x614c('0x203')];if(_[_0x614c('0xf2')](_0x397e67[0x0])||_['isNil'](_0x397e67[0x0][_0x614c('0x1fc')])||_[_0x614c('0xf2')](_0x397e67[0x0]['phone'])){_0x2c50da[_0x614c('0x14e')]('[actionOriginate]\x20',_0x3faad0,_0x397e67[0x0]);}else{return hopperUtils['checkIsBlackList'](_[_0x614c('0x74')](_0x397e67[0x0],[_0x614c('0xdc'),_0x614c('0x17c')]))[_0x614c('0x3e')](_0x2c50da['checkContactBlack'](_0x3faad0,_0x397e67[0x0]))['catch'](_0x2c50da[_0x614c('0x14d')](_0x614c('0x20b'),_0x3faad0));}}}})[_0x614c('0xa2')](loggerGetContactDialer(_0x614c('0x20c'),_0x3faad0,0x1));};Dialer['prototype']['abandonmentRate']=function(_0x2fbeca,_0x7ff7ac,_0x404142,_0x49e6b3,_0x5b4324,_0x41c18c){loggerPredictive[_0x614c('0x4c')](_0x614c('0x20d'));loggerPredictive[_0x614c('0x4c')](_0x614c('0x20e'),_0x2fbeca);loggerPredictive[_0x614c('0x4c')](_0x614c('0x20f'),_0x7ff7ac);loggerPredictive[_0x614c('0x4c')](_0x614c('0x210'),_0x404142);loggerPredictive[_0x614c('0x4c')](_0x614c('0x211'),_0x49e6b3);loggerPredictive[_0x614c('0x4c')](_0x614c('0x212'),_0x5b4324);loggerPredictive['info']('---------------------------');return new Promise(function(_0x1ccd1e,_0x2796b4){if(_0x2fbeca<=0x0||isNaN(_0x2fbeca)){return _0x2796b4(msgResponse(_0x614c('0x213'),'Error',_0x614c('0x214')+_0x2fbeca));}if(_0x404142<=0x0||isNaN(_0x404142)){return _0x2796b4(msgResponse(_0x614c('0x213'),_0x614c('0xbd'),'Ts\x20=\x20'+_0x404142));}if(_0x49e6b3<=0x0||isNaN(_0x49e6b3)){return _0x2796b4(msgResponse(_0x614c('0x213'),_0x614c('0xbd'),_0x614c('0x215')+_0x49e6b3));}if(_0x7ff7ac<=0x0||isNaN(_0x7ff7ac)){return _0x2796b4(msgResponse(_0x614c('0x213'),_0x614c('0xbd'),'interval\x20=\x20'+_0x7ff7ac));}if(_0x5b4324<=0x0||isNaN(_0x5b4324)){return _0x2796b4(msgResponse(_0x614c('0x213'),_0x614c('0xbd'),_0x614c('0x216')+_0x5b4324));}_0x41c18c=_0x41c18c||0x0;var _0x4b6032=0x1/_0x404142;var _0x2f79f1=0x0;var _0x32c816=0x0;var _0x4f941a=0x0;var _0x25dc73=0x0;for(var _0x14772b=0x0;_0x4f941a<_0x5b4324;_0x14772b+=0x1){_0x32c816=_0x14772b/_0x7ff7ac;_0x2f79f1=(_0x49e6b3*_0x32c816+_0x41c18c)/_0x4b6032;_0x4f941a=utils[_0x614c('0x217')](_0x2f79f1,_0x2fbeca);_0x25dc73=_0x2f79f1/_0x2fbeca*(0x1-utils[_0x614c('0x217')](_0x2f79f1,_0x2fbeca));}return _0x1ccd1e({'erlangCalls':_0x14772b,'erlangCallToSecond':_0x7ff7ac/_0x14772b,'erlangAbandonmentRate':_0x4f941a,'erlangBusyFactor':_0x25dc73});});};Dialer[_0x614c('0x1a')][_0x614c('0x1d5')]=function(_0x58b63e,_0x2c5195,_0x5646ec,_0x3878dc,_0x233a5e,_0x47539e){loggerPredictive[_0x614c('0x4c')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive['info'](_0x614c('0x20e'),_0x58b63e);loggerPredictive['info'](_0x614c('0x20f'),_0x2c5195);loggerPredictive[_0x614c('0x4c')](_0x614c('0x210'),_0x5646ec);loggerPredictive[_0x614c('0x4c')](_0x614c('0x211'),_0x3878dc);loggerPredictive['info'](_0x614c('0x218'),_0x233a5e);loggerPredictive[_0x614c('0x4c')](_0x614c('0x60'));return new Promise(function(_0x5918d1,_0x3d9ee2){if(_0x58b63e<=0x0||isNaN(_0x58b63e)){return _0x3d9ee2(msgResponse(_0x614c('0x219'),_0x614c('0xbd'),'m\x20=\x20'+_0x58b63e));}if(_0x5646ec<=0x0||isNaN(_0x5646ec)){return _0x3d9ee2(msgResponse(_0x614c('0x219'),_0x614c('0xbd'),'Ts\x20=\x20'+_0x5646ec));}if(_0x3878dc<=0x0||isNaN(_0x3878dc)){return _0x3d9ee2(msgResponse(_0x614c('0x219'),_0x614c('0xbd'),'p\x20=\x20'+_0x3878dc));}if(_0x2c5195<=0x0||isNaN(_0x2c5195)){return _0x3d9ee2(msgResponse(_0x614c('0x219'),'Error',_0x614c('0x21a')+_0x2c5195));}if(_0x233a5e<=0x0||isNaN(_0x233a5e)){return _0x3d9ee2(msgResponse(_0x614c('0x219'),_0x614c('0xbd'),_0x614c('0x21b')+_0x233a5e));}_0x47539e=_0x47539e||0x0;var _0x4bc066=0x1/_0x5646ec;var _0x42211d=0x0;var _0x58216d=0x0;var _0x46fdaf=0x0;var _0x4111a5=0x0;for(var _0x18b761=0x0;_0x4111a5<_0x233a5e;_0x18b761+=0x1){_0x58216d=_0x18b761/_0x2c5195;_0x42211d=(_0x3878dc*_0x58216d+_0x47539e)/_0x4bc066;_0x46fdaf=utils[_0x614c('0x217')](_0x42211d,_0x58b63e);_0x4111a5=_0x42211d/_0x58b63e*(0x1-utils['erlangb'](_0x42211d,_0x58b63e));}return _0x5918d1({'erlangCalls':_0x18b761,'erlangCallToSecond':_0x2c5195/_0x18b761,'erlangAbandonmentRate':_0x46fdaf,'erlangBusyFactor':_0x4111a5});});};module['exports']=Dialer; \ No newline at end of file +var _0x81a9=['verifyAdditionalPhones','voiceQueue','additional','dialDropMaxRetry','queueCallerAbandonCreateState','add','minutes','ContactId','ListId','[rescheduleContact][Drop]','Drop','starttime','calleridnum','[syncAgentComplete][createHistory][10]','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','countglobal','dialAbandonedRetryFrequency','dialAbandonedMaxRetry','rescheduleContact','CampaignId','[rescheduleContact][Abandoned]','calleridname','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','syncQueueMember','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','pick','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','VoiceQueueId','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','syncVarSet','variable','amdstatus','exten','xcally-motion-dialer','HANGUP','outboundAnswerAgiCallsDay','membername','AMD','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','dialAMDActive','value','MACHINE','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countmachineretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','[rescheduleContact][Machine]','HangupInAMD','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','reason\x2019\x20machine....','dialMachineRetryFrequency','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','AnswerAGI','AGI','[syncHangupIvr]','Normal\x20Clearing','outboundUnknownCallsDay','cause-txt','Unknow','syncQueueSummary','queuesSummary','running','isPreviewCampaign','statusMessage','available','inUse','talking','pTalking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','object','phone','originate','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAgiAfterHangupAgent','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','setXMDContactVariables','Contact','assign','Trunk','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','getCallerIdRandom','XMD-ORIGINATECALLERIDNAME','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','dialCutDigit','substring','SIP/%s/%s%s','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','[rescheduleContact][NoSuchNumber]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','dialNoSuchNumberRetryFrequency','reason\x200\x20no\x20such\x20number....','outboundNoAnswerCallsDay','buildNoAnswerEventPayload','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','custom:agentbusy','busy','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','custom:agentcongestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Global','contact\x20not\x20moved','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','handlePredictive','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','avgHandleTime','getDataPredictive','startMethodPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','dialPredictiveOptimizationPercentage','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','predictiveIntervalPauses','busyFactor','[CatchErlangB]','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','checkContactEmpty','[getContactCampaign2][Empty]','ivrTotalCallsDays','[actionOriginate]\x20','checkIsBlackListIvr','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','countReScheduled','[countReScheduled]\x20','RUNNING','[getContactDialer2]','tryOriginatePredictive','not_inuse','getContactDialer','dialOrderByScheduledAt','[actionOriginatePredictive]\x20','[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','[abandonmentRate]','Ts\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','p\x20=\x20','Umin\x20=\x20','exports','util','lodash','uuid','moment','ioredis','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictive','../ami','redis','defaults','../rpc/cmHopper','../rpc/voiceQueueRt','./models/action','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','queuemember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','getSettings','previewRecallmeReminderInterval','isUndefined','emit','type','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','format','voice:queue:%s','name','voice_queue:save','isEmpty','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','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','---------------------------','predictiveIntervalTotalCalls','predictiveIntervalAvgTalktime','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','erlangCallToSecond','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','merge','getSeconds','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','temp','inspect','contactsRescheduled','message','CONTACTS_RESCHEDULED','[getContactDialer2][ReScheduled]','contacts','CAMPAIGN_STATUS','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','statedesc','endtime','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','stringify','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isIVRCampaignActive','isIVRCampaign','campaign:ivr:%s','sendMessageOneNotActive','INACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED','is\x20disactive','Error','prototype','active','status','SIP/%s','isTrunkReachable','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTimeIvr','ifTime','Failure','EMPTY_INTERVAL','\x20Intervals\x20is\x20empty\x20','timezones','UNKNOWN_TIMEZONE','isArray','length','push','Action','command','then','content','indexOf','true','catch','all','some','OVERTIME_GLOBAL_INTERVAL','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','resetActiveCalls','syncCampaigns','undefined','resolve','checkIsTrunkReachable','checkIfTimeIntervals','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','power','handlePower','dialPowerLevel','Queue','silly','Dialer::ifTime()','intervalIftime','OVERTIME_INTERVAL','Global:\x20','Timezone:\x20','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','[ifTime][Action]','queue','uniqueid','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','ivr','outboundAnswerCallsDay','reason','agent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','dialQueueTimeout','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','state','dropreason','TIMEOUT','countdropretry','dialDropRetryFrequency','callAdditionalPhoneAfterMin'];(function(_0x4d8dc3,_0x585fd1){var _0x9b03d9=function(_0x7a31d5){while(--_0x7a31d5){_0x4d8dc3['push'](_0x4d8dc3['shift']());}};_0x9b03d9(++_0x585fd1);}(_0x81a9,0x15a));var _0x981a=function(_0x569856,_0x2a65df){_0x569856=_0x569856-0x0;var _0x489a09=_0x81a9[_0x569856];return _0x489a09;};'use strict';var util=require(_0x981a('0x0'));var _=require(_0x981a('0x1'));var uuid=require(_0x981a('0x2'));var moment=require(_0x981a('0x3'));var rr=require('rr');var Redis=require(_0x981a('0x4'));var utils=require('./utils');var hopperUtils=require('./utils/hopper');var ut=require(_0x981a('0x5'));var config=require(_0x981a('0x6'));var logger=require('../../../config/logger')(_0x981a('0x7'));var loggerBooked=require(_0x981a('0x8'))(_0x981a('0x9'));var loggerPredictive=require(_0x981a('0x8'))(_0x981a('0xa'));var loggerPredictiveCalls=require('../../../config/logger')('predictiveCalls');var loggerSyncQueueSummary=require(_0x981a('0x8'))('syncQueueSummary');var ami=require(_0x981a('0xb'));config[_0x981a('0xc')]=_[_0x981a('0xd')](config[_0x981a('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x981a('0xc')]));var cmHopper=require(_0x981a('0xe'));var voiceQueueRt=require(_0x981a('0xf'));var RpcSetting=require('../rpc/setting');var Interval=require('../rpc/interval');var Action=require(_0x981a('0x10'));var History=require('./models/history');var Final=require('./models/final');var AgentComplete=require(_0x981a('0x11'));var QueueCallerAbandon=require(_0x981a('0x12'));var Hangup=require(_0x981a('0x13'));var ipAgi=process[_0x981a('0x14')][_0x981a('0x15')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence['prototype'][_0x981a('0x16')]=function(_0x4dca5f){this[_0x981a('0x17')]=this[_0x981a('0x17')]?this[_0x981a('0x17')]['finally'](_0x4dca5f):_0x4dca5f();};function Dialer(_0x20ddb0,_0xaf2366){this[_0x981a('0x18')]=new Sequence();this[_0x981a('0x19')]=_0xaf2366;this['voiceQueues']=_0x20ddb0[_0x981a('0x1a')];this[_0x981a('0x1b')]=_0x20ddb0[_0x981a('0x1b')];this[_0x981a('0x1c')]=_0x20ddb0[_0x981a('0x1c')];this[_0x981a('0x1d')]=_0x20ddb0[_0x981a('0x1d')];this[_0x981a('0x1e')]=config['maxNumberOriginate']||0x2;this[_0x981a('0x1f')]={};this[_0x981a('0x20')]={};this[_0x981a('0x21')]={};this[_0x981a('0x22')]={};this[_0x981a('0x23')]={};this[_0x981a('0x24')]={};this[_0x981a('0x25')]={};this[_0x981a('0x26')]={};this[_0x981a('0x27')]={};this['queueBookedRR']={};this['queuesSummary']={};ami['on'](_0x981a('0x28'),this['syncAgentConnect'][_0x981a('0x29')](this));ami['on'](_0x981a('0x2a'),this[_0x981a('0x2b')][_0x981a('0x29')](this));ami['on']('originateresponse',this[_0x981a('0x2c')][_0x981a('0x29')](this));ami['on'](_0x981a('0x2d'),this[_0x981a('0x2e')][_0x981a('0x29')](this));ami['on'](_0x981a('0x2f'),this['syncQueueSummary']['bind'](this));ami['on'](_0x981a('0x30'),this[_0x981a('0x31')][_0x981a('0x29')](this));ami['on']('hangup',this[_0x981a('0x32')][_0x981a('0x29')](this));ami['on'](_0x981a('0x33'),this[_0x981a('0x34')][_0x981a('0x29')](this));ami['on'](_0x981a('0x35'),this['syncVarSet'][_0x981a('0x29')](this));ami['on'](_0x981a('0x36'),this['syncQueueMember'][_0x981a('0x29')](this));ami['on'](_0x981a('0x37'),this[_0x981a('0x38')]['bind'](this));this[_0x981a('0x39')]();this[_0x981a('0x3a')]();RpcSetting[_0x981a('0x3b')]()['then'](function(_0x501b10){previewRecallmeReminderInterval=_0x501b10[_0x981a('0x3c')];});}function isNotNull(_0x885bb0){return _0x885bb0!==null&&!_[_0x981a('0x3d')](_0x885bb0);}function msgResponse(_0x5e6100,_0x25d696,_0x24e940){return{'action':_0x5e6100,'response':_0x25d696,'message':_0x24e940,'stack':_0x24e940};}function emit(_0x3ae47b,_0x1e26b0,_0x402e69){io['to'](_0x3ae47b)[_0x981a('0x3e')](_0x1e26b0,_0x402e69);}function emitOutboundVoiceQueueSummary(_0x8e75df){if(_0x8e75df[_0x981a('0x3f')]==='outbound'){logger[_0x981a('0x40')](_0x981a('0x41'),util['inspect'](_0x8e75df,{'showHidden':![],'depth':null}));emit(util[_0x981a('0x42')](_0x981a('0x43'),_0x8e75df[_0x981a('0x44')]),_0x981a('0x45'),_0x8e75df);}}function checkGetDataPredictive(_0x192f9b){if(isNotNull(_0x192f9b)&&!_[_0x981a('0x46')](_0x192f9b)){loggerPredictive['info']('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x981a('0x47')](_0x981a('0x48'),_0x192f9b['predictiveIntervalTotalCalls']);loggerPredictive[_0x981a('0x47')](_0x981a('0x49'),_0x192f9b[_0x981a('0x4a')]);loggerPredictive['info'](_0x981a('0x4b'),_0x192f9b[_0x981a('0x4c')]);loggerPredictive[_0x981a('0x47')](_0x981a('0x4d'),_0x192f9b[_0x981a('0x4e')]);loggerPredictive[_0x981a('0x47')](_0x981a('0x4f'),_0x192f9b[_0x981a('0x50')]);loggerPredictive[_0x981a('0x47')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x192f9b['predictiveIntervalAvgTalktime']);loggerPredictive[_0x981a('0x47')](_0x981a('0x51'));if(_0x192f9b[_0x981a('0x52')]>0x0){if(!_[_0x981a('0x3d')](_0x192f9b[_0x981a('0x53')])&&_0x192f9b['predictiveIntervalAvgTalktime']>0x0){return!![];}loggerPredictive[_0x981a('0x47')](_0x981a('0x54'));if(!_[_0x981a('0x3d')](_0x192f9b[_0x981a('0x50')])&&_0x192f9b[_0x981a('0x50')]>0x0){return!![];}loggerPredictive[_0x981a('0x47')](_0x981a('0x55'));}else{loggerPredictive[_0x981a('0x47')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x981a('0x47')]('History\x20information\x20are\x20empty');}return![];}function mergeDataErlangB(_0x5480ef){return function(_0x5b5363){loggerPredictive[_0x981a('0x47')]('---------\x20ErlangB\x20---------');loggerPredictive['info'](_0x981a('0x56'),_0x5b5363[_0x981a('0x57')]);loggerPredictive['info']('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b5363[_0x981a('0x58')]);loggerPredictive[_0x981a('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b5363[_0x981a('0x59')]);loggerPredictive[_0x981a('0x47')](_0x981a('0x5a'),_0x5b5363[_0x981a('0x5b')]);loggerPredictive[_0x981a('0x47')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x5b5363[_0x981a('0x59')]);loggerPredictive[_0x981a('0x47')](_0x981a('0x51'));_[_0x981a('0x5c')](_0x5480ef,_0x5b5363);};}function ifInterval(_0x53308e,_0x3931fd){if(_[_0x981a('0x3d')](_0x3931fd)){return![];}return utils[_0x981a('0x5d')](undefined,_0x3931fd)<_0x53308e*0x3c;}function clearPredictiveAttributes(_0x1991e3){if(_0x1991e3['startProgressive']){_0x1991e3[_0x981a('0x25')]=undefined;loggerPredictive[_0x981a('0x40')](_0x1991e3['name'],_0x981a('0x5e'));}if(_0x1991e3['startPredictive']){_0x1991e3[_0x981a('0x24')]=undefined;loggerPredictive[_0x981a('0x40')](_0x1991e3['name'],_0x981a('0x5f'));}if(_0x1991e3['handlePredictive']){clearInterval(_0x1991e3['handlePredictive']);_0x1991e3['handlePredictive']=undefined;loggerPredictive['debug'](_0x1991e3[_0x981a('0x44')],_0x981a('0x60'));}}function loggerCatchPredictive(_0x242bcf,_0x472b13){return function(_0x409427){loggerPredictive[_0x981a('0x61')](_0x472b13[_0x981a('0x44')],_0x242bcf);loggerPredictive['error'](_0x409427[_0x981a('0x62')]);clearPredictiveAttributes(_0x472b13);};}function loggerCatch(_0x22b051){return function(_0x3f0149){logger[_0x981a('0x61')](_0x22b051,util['inspect'](_0x3f0149,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x25954a,_0x5e949d,_0x157846){return function(_0xd5519a){utils[_0x981a('0x63')](_0x5e949d,_0x157846,0x0);_0x5e949d[_0x981a('0x64')]=0x0;logger[_0x981a('0x61')](_0x25954a,util[_0x981a('0x65')](_0xd5519a,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x33098e){return function(_0x310c1a){if(isNotNull(_0x310c1a)&&isNotNull(_0x310c1a[0x0])){if(_0x310c1a[0x0][_0x981a('0x66')]>0x0){_0x33098e[_0x981a('0x67')]=utils['CAMPAIGN_STATUS'][_0x981a('0x68')];logger['info'](_0x981a('0x69')+_0x33098e[_0x981a('0x44')],_0x310c1a[0x0][_0x981a('0x66')],_0x981a('0x6a'));}else{_0x33098e['message']=utils[_0x981a('0x6b')][_0x981a('0x6c')];logger[_0x981a('0x47')](_0x981a('0x6d')+_0x33098e[_0x981a('0x44')]);}}};}function createObjHistory(_0x49816c,_0x49b371,_0xe8a84f,_0x23d0e6,_0xf6da12){_0x49816c[_0x981a('0x67')]=_0xe8a84f;var _0x5bed65=new Action(_0x49816c,_0x49b371);var _0x137d5f=new History(_0x5bed65);_0x137d5f['state']=_0x23d0e6;_0x137d5f[_0x981a('0x6e')]=_0xf6da12;_0x137d5f[_0x981a('0x6f')]=_0x5bed65['starttime'];return _0x137d5f;}function unlockQueueStatus(_0x1ef41d,_0x1ade56){setTimeout(function(){if(_[_0x981a('0x3d')](_0x1ef41d[_0x981a('0x70')])){loggerBooked[_0x981a('0x61')](_0x981a('0x71'),_0x1ade56);}_0x1ef41d[_0x981a('0x70')]=!![];loggerBooked[_0x981a('0x47')](_0x981a('0x72'),_0x1ade56,JSON[_0x981a('0x73')](_['pick'](_0x1ef41d,['name',_0x981a('0x70')])));},0x1f3);}function checkInterval(_0x259404){return function(){if(!isNotNull(_0x259404['Interval'])){_0x259404['message']=utils[_0x981a('0x6b')][_0x981a('0x74')];throw _0x259404[_0x981a('0x44')]+_0x981a('0x75');}if(!isNotNull(_0x259404[_0x981a('0x76')][_0x981a('0x77')])){_0x259404[_0x981a('0x67')]=utils['CAMPAIGN_STATUS'][_0x981a('0x74')];throw _0x259404[_0x981a('0x44')]+_0x981a('0x75');}if(!isNotNull(_[_0x981a('0x46')](_0x259404['Interval'][_0x981a('0x77')]))){_0x259404['message']=utils['CAMPAIGN_STATUS'][_0x981a('0x74')];throw _0x259404[_0x981a('0x44')]+_0x981a('0x75');}};}function checkIsIVRCampaignActive(_0x54ea8b){return function(){if(!utils[_0x981a('0x78')](_0x54ea8b)){_0x54ea8b['message']=utils[_0x981a('0x6b')]['INACTIVE'];throw _0x54ea8b['name']+'\x20NOT\x20Active';}};}function emitCampaignSummary(_0xe43ae8){if(utils[_0x981a('0x79')](_0xe43ae8)){emit(util[_0x981a('0x42')](_0x981a('0x7a'),_0xe43ae8['name']),'campaign:save',_0xe43ae8);}}function loggerCatchQueueSummary(_0xac758a,_0x28c695){return function(_0x1b6d51){clearPredictiveAttributes(_0x28c695);emitCampaignSummary(_0x28c695);loggerSyncQueueSummary[_0x981a('0x40')](_0xac758a,util[_0x981a('0x65')](_0x1b6d51,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x3cc077){if(_0x3cc077[_0x981a('0x7b')]){if(_0x3cc077['originated']===0x0){_0x3cc077[_0x981a('0x7b')]=![];_0x3cc077[_0x981a('0x67')]=utils['CAMPAIGN_STATUS'][_0x981a('0x7c')];loggerSyncQueueSummary[_0x981a('0x40')](_0x981a('0x7d'),_0x3cc077[_0x981a('0x44')],_0x981a('0x7e'));}else{_0x3cc077['message']=utils[_0x981a('0x6b')][_0x981a('0x7f')];loggerSyncQueueSummary[_0x981a('0x40')](_0x981a('0x7d'),_0x3cc077[_0x981a('0x44')],_0x981a('0x80'));}emitCampaignSummary(_0x3cc077);}}function myreject(_0xaccd36){return function(_0x25af77){return _0xaccd36(msgResponse('[ifTime][Action]',_0x981a('0x81'),JSON[_0x981a('0x73')](_0x25af77)));};}Dialer[_0x981a('0x82')]['isTrunkReachable']=function(_0xfa134b){return!_['isUndefined'](_0xfa134b)&&_0xfa134b&&!_[_0x981a('0x3d')](_0xfa134b[_0x981a('0x44')])&&!_[_0x981a('0x3d')](_0xfa134b['active'])&&_0xfa134b[_0x981a('0x83')]&&(this['trunks'][util[_0x981a('0x42')]('SIP/%s',_0xfa134b[_0x981a('0x44')])][_0x981a('0x84')]==='reachable'||this['trunks'][util[_0x981a('0x42')](_0x981a('0x85'),_0xfa134b['name'])][_0x981a('0x84')]==='unmonitored');};Dialer['prototype']['checkIsTrunkReachable']=function(_0x31983d){var _0x572e58=this;return function(){if(!_0x572e58['isTrunkReachable'](_0x31983d['Trunk'])){if(!_0x572e58[_0x981a('0x86')](_0x31983d[_0x981a('0x87')])){_0x31983d[_0x981a('0x67')]=utils['CAMPAIGN_STATUS'][_0x981a('0x88')];throw _0x31983d[_0x981a('0x44')]+_0x981a('0x89');}}};};Dialer[_0x981a('0x82')][_0x981a('0x8a')]=function(_0x55f494,_0x4d8521,_0xa27c8c,_0x13182e){var _0x234077=this;return function(){var _0x3a5a32=!![];return _0x234077['ifTimeIvr'](_0x55f494,_0x4d8521,_0xa27c8c,_0x13182e,_0x3a5a32);};};Dialer['prototype']['checkIfTimeIntervals']=function(_0xf90549,_0x2b2c09,_0x5ebe81,_0x9904c){var _0xc43de0=this;return function(){var _0x38daa5=![];return _0xc43de0[_0x981a('0x8b')](_0xf90549[_0x981a('0x77')],_0x2b2c09,_0x5ebe81,_0x9904c,_0x38daa5);};};Dialer['prototype'][_0x981a('0x8b')]=function(_0x5b70f9,_0x1d9383,_0x2c0a14,_0x38b6b6,_0x48ee2a){var _0xb61f5f=[];return new Promise(function(_0x49fcb5,_0x2a642e){if(!isNotNull(_0x5b70f9)){_0x38b6b6[_0x981a('0x67')]=utils['CAMPAIGN_STATUS'][_0x981a('0x74')];return _0x2a642e(msgResponse(_0x981a('0x8c'),_0x981a('0x8d'),_0x2c0a14+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x981a('0x46')](_0x5b70f9)){_0x38b6b6[_0x981a('0x67')]=utils[_0x981a('0x6b')][_0x981a('0x8e')];return _0x2a642e(msgResponse(_0x981a('0x8c'),_0x981a('0x8d'),_0x2c0a14+_0x981a('0x8f')));}if(_0x1d9383&&_[_0x981a('0x3d')](config[_0x981a('0x90')][_0x1d9383])){_0x38b6b6[_0x981a('0x67')]=utils[_0x981a('0x6b')][_0x981a('0x91')];return _0x2a642e(msgResponse(_0x981a('0x8c'),_0x981a('0x8d'),_0x2c0a14+'\x20Timezone\x20unknow\x20'+_0x1d9383));}if(_[_0x981a('0x92')](_0x5b70f9)){for(var _0x21d647=0x0;_0x21d647<_0x5b70f9[_0x981a('0x93')];_0x21d647+=0x1){_0xb61f5f[_0x981a('0x94')](ami[_0x981a('0x95')]({'action':_0x981a('0x96'),'command':util['format']('iftime\x20%s,%s',_0x5b70f9[_0x21d647]['interval'],!_[_0x981a('0x3d')](config[_0x981a('0x90')][_0x1d9383])?_0x1d9383:'')})[_0x981a('0x97')](function(_0x50a08b){return _0x50a08b[_0x981a('0x98')][_0x981a('0x99')](_0x981a('0x9a'))>=0x0;})[_0x981a('0x9b')](myreject(_0x2a642e)));}}else{_0xb61f5f[_0x981a('0x94')](ami['Action']({'action':_0x981a('0x96'),'command':util[_0x981a('0x42')]('iftime\x20%s,%s',_0x5b70f9,!_['isUndefined'](config[_0x981a('0x90')][_0x1d9383])?_0x1d9383:'')})['then'](function(_0x13f9f4){return _0x13f9f4[_0x981a('0x98')]['indexOf'](_0x981a('0x9a'))>=0x0;})[_0x981a('0x9b')](myreject(_0x2a642e)));}Promise[_0x981a('0x9c')](_0xb61f5f)[_0x981a('0x97')](function(_0x31c22f){var _0x35b679=_[_0x981a('0x9d')](_0x31c22f);if(_0x35b679){return _0x49fcb5(_0x35b679);}else{_0x38b6b6['message']=_0x48ee2a?utils[_0x981a('0x6b')][_0x981a('0x9e')]:utils['CAMPAIGN_STATUS']['OVERTIME_INTERVAL'];return _0x2a642e(msgResponse(_0x981a('0x9f'),_0x981a('0x8d'),'Global:\x20'+_0x48ee2a+'\x20'+_0x2c0a14+_0x981a('0xa0')+util[_0x981a('0x65')](_0x5b70f9,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x1d9383));}})['catch'](function(_0x4892d6){return _0x2a642e(msgResponse(_0x981a('0x8c'),_0x981a('0x8d'),JSON['stringify'](_0x4892d6)));});});};Dialer['prototype'][_0x981a('0x39')]=function(){var _0x37a55b=this;return cmHopper[_0x981a('0xa1')]({'active':![]},{'where':{'active':!![]}})[_0x981a('0x97')](function(){setInterval(function(){_0x37a55b[_0x981a('0xa2')]();},0x3e8);});};Dialer[_0x981a('0x82')][_0x981a('0xa2')]=function(){var _0x3ea08c=this;var _0x596f7c;for(var _0x4c6b28 in this[_0x981a('0x1b')]){if(typeof this[_0x981a('0x1b')][_0x4c6b28]!==_0x981a('0xa3')){_0x596f7c=this[_0x981a('0x1b')][_0x4c6b28];if(utils[_0x981a('0x79')](_0x596f7c)&&utils[_0x981a('0x78')](_0x596f7c)){_0x596f7c[_0x981a('0x7b')]=!![];Promise[_0x981a('0xa4')]()[_0x981a('0x97')](checkIsIVRCampaignActive(_0x596f7c))[_0x981a('0x97')](checkInterval(_0x596f7c))[_0x981a('0x97')](_0x3ea08c[_0x981a('0xa5')](_0x596f7c))[_0x981a('0x97')](_0x3ea08c['checkIfTime'](_0x596f7c['dialGlobalInterval'],_0x596f7c['dialTimezone'],_0x596f7c[_0x981a('0x44')],_0x596f7c))[_0x981a('0x97')](_0x3ea08c[_0x981a('0xa6')](_0x596f7c[_0x981a('0x76')],_0x596f7c[_0x981a('0xa7')],_0x596f7c[_0x981a('0x44')],_0x596f7c))[_0x981a('0x97')](_0x3ea08c[_0x981a('0xa8')](_0x596f7c))[_0x981a('0x9b')](loggerCatchQueueSummary(_0x981a('0xa9'),_0x596f7c));}else{notSendMessagesCampaign(_0x596f7c);}}}};Dialer[_0x981a('0x82')][_0x981a('0xaa')]=function(_0x20da1d){if(_0x20da1d[_0x981a('0xab')]!==_0x981a('0xa')){clearPredictiveAttributes(_0x20da1d);}switch(_0x20da1d[_0x981a('0xab')]){case'progressive':this['handlePower'](_0x20da1d,0x1);break;case _0x981a('0xac'):this[_0x981a('0xad')](_0x20da1d,_0x20da1d[_0x981a('0xae')]);break;case _0x981a('0xa'):this[_0x981a('0xa')](_0x20da1d);break;case _0x981a('0x9'):this[_0x981a('0xad')](_0x20da1d,0x1);break;default:logger[_0x981a('0x61')](_0x981a('0xaf'),_0x20da1d[_0x981a('0x44')],'method\x20not\x20recognized');}};Dialer[_0x981a('0x82')][_0x981a('0x8c')]=function(_0x35e238,_0x33dc4b){var _0x130001=_0x35e238[_0x981a('0xa7')];var _0x7484e3=_0x33dc4b?_0x35e238['dialGlobalInterval']:_0x35e238[_0x981a('0x76')][_0x981a('0x77')];logger[_0x981a('0xb0')](_0x981a('0xb1'),_0x7484e3,_0x130001,_0x35e238['name'],util[_0x981a('0x42')]('Voice\x20Queue\x20%s\x20$s',_0x35e238[_0x981a('0x44')],_0x35e238['id']));var _0x14805c=null;return Interval[_0x981a('0xb2')](_0x7484e3,_0x130001)[_0x981a('0x97')](function(_0x1110c0){if(_0x1110c0===!![]){return _0x1110c0;}else{_0x35e238['message']=_0x33dc4b?utils[_0x981a('0x6b')]['OVERTIME_GLOBAL_INTERVAL']:utils[_0x981a('0x6b')][_0x981a('0xb3')];_0x14805c=msgResponse('[ifTime][promiseAll]',_0x981a('0x8d'),_0x981a('0xb4')+_0x33dc4b+'\x20'+_0x35e238['name']+_0x981a('0xa0')+util[_0x981a('0x65')](_0x7484e3,{'showHidden':![],'depth':null})+_0x981a('0xb5')+_0x130001);}if(_0x14805c!==null){logger['silly'](_0x981a('0xb6'),_0x14805c);_0x14805c[_0x981a('0xb7')]=_0x33dc4b;throw _0x14805c;}})[_0x981a('0x9b')](function(_0x578065){logger[_0x981a('0x61')](_0x981a('0xb8'),_0x578065);throw msgResponse(_0x981a('0xb9'),_0x981a('0x81'),util[_0x981a('0x65')](_0x578065,{'showHidden':![],'depth':null}));});};Dialer[_0x981a('0x82')]['syncAgentConnect']=function(_0x3f8596){if(this[_0x981a('0x1a')][_0x3f8596[_0x981a('0xba')]]){if(this[_0x981a('0x22')][_0x3f8596['uniqueid']]&&this[_0x981a('0x22')][_0x3f8596[_0x981a('0xbb')]][_0x981a('0x3f')]!=='ivr'){this[_0x981a('0xbc')](this[_0x981a('0x1a')][_0x3f8596[_0x981a('0xba')]]);this[_0x981a('0x22')][_0x3f8596[_0x981a('0xbb')]][_0x981a('0xbd')]=moment()[_0x981a('0x42')](_0x981a('0xbe'));}}};Dialer[_0x981a('0x82')][_0x981a('0x2e')]=function(_0x19b758){var _0x3ac4a9=this[_0x981a('0x22')][_0x19b758[_0x981a('0xbb')]];if(this[_0x981a('0x1a')][_0x19b758['queue']]){if(_0x3ac4a9&&_0x3ac4a9['type']!==_0x981a('0xbf')){delete this[_0x981a('0x22')][_0x19b758[_0x981a('0xbb')]];this[_0x981a('0x1a')][_0x19b758[_0x981a('0xba')]][_0x981a('0xc0')]+=0x1;var _0x2237e0=new AgentComplete(_0x3ac4a9,_0x19b758);if(_0x19b758[_0x981a('0xc1')]===_0x981a('0xc2')){_0x2237e0['agiafterat']=this['voiceQueues'][_0x19b758[_0x981a('0xba')]]['dialQueueProject2']&&this[_0x981a('0x1a')][_0x19b758['queue']]['dialAgiAfterHangupAgent']?moment()[_0x981a('0x42')](_0x981a('0xbe')):undefined;}hopperUtils[_0x981a('0xc3')](_0x2237e0)[_0x981a('0x9b')](loggerCatch(_0x981a('0xc4')));hopperUtils[_0x981a('0xc5')](_0x2237e0)['catch'](loggerCatch(_0x981a('0xc6')));}}};Dialer['prototype'][_0x981a('0x2b')]=function(_0xe5e08c){var _0x26c2dc=this[_0x981a('0x22')][_0xe5e08c[_0x981a('0xbb')]];var _0xe5b4de=this;var _0x22a5da=![];var _0x17a3ed;var _0x1f7d12;if(this[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]]){if(_0x26c2dc&&_0x26c2dc[_0x981a('0x3f')]!==_0x981a('0xbf')){delete this[_0x981a('0x22')][_0xe5e08c[_0x981a('0xbb')]];this[_0x981a('0xbc')](this[_0x981a('0x1a')][_0xe5e08c['queue']]);_0x26c2dc[_0x981a('0xc7')]=moment()[_0x981a('0x42')](_0x981a('0xbe'));var _0x4f8355=new QueueCallerAbandon(_0x26c2dc,_0xe5e08c);if(utils['getSeconds'](_0x26c2dc[_0x981a('0xc7')],_0x26c2dc[_0x981a('0xc8')])>=_0x26c2dc[_0x981a('0xc9')]){this[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]][_0x981a('0xca')]+=0x1;this[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]][_0x981a('0xcb')]+=0x1;_0x4f8355[_0x981a('0xcc')]=0xa;_0x4f8355[_0x981a('0x6e')]='Drop';_0x4f8355[_0x981a('0xcd')]=_0x981a('0xce');_0x4f8355['agiafterat']=this[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]]['dialQueueProject2']?moment()[_0x981a('0x42')](_0x981a('0xbe')):undefined;_0x4f8355[_0x981a('0xcf')]+=0x1;_0x4f8355['countglobal']+=0x1;_0x17a3ed=this[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]][_0x981a('0xd0')];_0x1f7d12=this[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]][_0x981a('0xd1')];hopperUtils[_0x981a('0xd2')](_0x4f8355,_0x4f8355['state'],_0x26c2dc[_0x981a('0xd3')])['then'](function(_0x5cf1ce){_0x22a5da=_0x5cf1ce[_0x981a('0xd4')]==0x1;if(_0x4f8355[_0x981a('0xcf')]>=_0xe5b4de[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]][_0x981a('0xd5')]){_0xe5b4de[_0x981a('0xd6')](_0x4f8355,_0x5cf1ce[_0x981a('0xd4')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x4f8355[_0x981a('0xcf')],'scheduledat':moment()[_0x981a('0xd7')](_0xe5b4de[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]][_0x981a('0xd0')],_0x981a('0xd8'))[_0x981a('0x42')](_0x981a('0xbe')),'ContactId':_0x26c2dc[_0x981a('0xd9')],'ListId':_0x26c2dc[_0x981a('0xda')],'VoiceQueueId':_0x26c2dc['VoiceQueueId']||undefined,'CampaignId':_0x26c2dc['CampaignId']||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0xdb')));var _0x335f06=new History(_0x4f8355);_0x335f06[_0x981a('0xcc')]=0xa;_0x335f06[_0x981a('0x6e')]=_0x981a('0xdc');_0x335f06[_0x981a('0xdd')]=moment()[_0x981a('0x42')]('YYYY-MM-DD\x20HH:mm:ss');_0x335f06[_0x981a('0x6f')]=_0x335f06['starttime'];_0x335f06['calleridname']=_0x4f8355['calleridname'];_0x335f06[_0x981a('0xde')]=_0x4f8355[_0x981a('0xde')];hopperUtils[_0x981a('0xc3')](_0x335f06)[_0x981a('0x9b')](loggerCatch(_0x981a('0xdf')));}})[_0x981a('0x97')](function(){if(_0x22a5da)hopperUtils['swapAdditionalPhones'](_0x4f8355,_0x17a3ed,_0x1f7d12)[_0x981a('0x97')](function(){return 0x1;});});}else{this[_0x981a('0x1a')][_0xe5e08c['queue']][_0x981a('0x4e')]+=0x1;this[_0x981a('0x1a')][_0xe5e08c['queue']][_0x981a('0xe0')]+=0x1;_0x4f8355[_0x981a('0xcc')]=0xb;_0x4f8355[_0x981a('0x6e')]=_0x981a('0xe1');_0x4f8355[_0x981a('0xcd')]=_0x981a('0xe2');_0x4f8355[_0x981a('0xe3')]+=0x1;_0x4f8355[_0x981a('0xe4')]+=0x1;_0x17a3ed=this[_0x981a('0x1a')][_0xe5e08c['queue']][_0x981a('0xe5')];_0x1f7d12=this[_0x981a('0x1a')][_0xe5e08c['queue']]['callAdditionalPhoneAfterMin'];hopperUtils[_0x981a('0xd2')](_0x4f8355,_0x4f8355[_0x981a('0xcc')],_0x26c2dc[_0x981a('0xd3')])[_0x981a('0x97')](function(_0x419ab7){if(_0x4f8355[_0x981a('0xe3')]>=_0xe5b4de[_0x981a('0x1a')][_0xe5e08c[_0x981a('0xba')]][_0x981a('0xe6')]){_0xe5b4de[_0x981a('0xd6')](_0x4f8355,_0x419ab7[_0x981a('0xd4')]);}else{hopperUtils[_0x981a('0xe7')]({'active':![],'countabandonedretry':_0x4f8355[_0x981a('0xe3')],'scheduledat':moment()[_0x981a('0xd7')](_0xe5b4de[_0x981a('0x1a')][_0xe5e08c['queue']][_0x981a('0xe5')],_0x981a('0xd8'))[_0x981a('0x42')](_0x981a('0xbe')),'ContactId':_0x26c2dc[_0x981a('0xd9')],'ListId':_0x26c2dc[_0x981a('0xda')],'VoiceQueueId':_0x26c2dc['VoiceQueueId']||undefined,'CampaignId':_0x26c2dc[_0x981a('0xe8')]||undefined})['catch'](loggerCatch(_0x981a('0xe9')));var _0x4e6fc5=new History(_0x4f8355);_0x4e6fc5[_0x981a('0xcc')]=0xb;_0x4e6fc5[_0x981a('0x6e')]=_0x981a('0xe1');_0x4e6fc5['starttime']=moment()[_0x981a('0x42')](_0x981a('0xbe'));_0x4e6fc5[_0x981a('0x6f')]=_0x4e6fc5[_0x981a('0xdd')];_0x4e6fc5[_0x981a('0xea')]=_0x4f8355['calleridname'];_0x4e6fc5['calleridnum']=_0x4f8355[_0x981a('0xde')];hopperUtils[_0x981a('0xc3')](_0x4e6fc5)[_0x981a('0x9b')](loggerCatch(_0x981a('0xeb')));}})['then'](function(){if(_0x22a5da)hopperUtils[_0x981a('0xec')](_0x4f8355,_0x17a3ed,_0x1f7d12)['then'](function(){return 0x1;});});}}}};Dialer[_0x981a('0x82')]['syncNewExten']=function(_0x509a10){if(this[_0x981a('0x20')][_0x509a10[_0x981a('0xbb')]]){this[_0x981a('0x20')][_0x509a10[_0x981a('0xbb')]]['channel']=_0x509a10[_0x981a('0xed')];}if(this[_0x981a('0x22')][_0x509a10[_0x981a('0xbb')]]){this['uniqueId'][_0x509a10[_0x981a('0xbb')]]['channel']=_0x509a10[_0x981a('0xed')];}};Dialer[_0x981a('0x82')][_0x981a('0xee')]=function(_0x489cd8){if(!this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]]){return;}var _0x252991=this[_0x981a('0x1a')][this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]][_0x981a('0xba')]][_0x981a('0xf0')]||_0x981a('0xf1');if(_0x252991===_0x981a('0xf2')){if(this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]]&&_[_0x981a('0xf3')](this['actions'][_0x489cd8[_0x981a('0xef')]][_0x981a('0xf4')])&&_0x489cd8[_0x981a('0x84')]==='1'&&_0x489cd8[_0x981a('0xf5')]==='0'){if(this[_0x981a('0x1c')][_0x489cd8[_0x981a('0xf6')]]){if(!this['agents'][_0x489cd8['stateinterface']][_0x981a('0xf4')]){this[_0x981a('0x1c')][_0x489cd8['stateinterface']][_0x981a('0xf4')]=!![];this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]][_0x981a('0xf4')]=!![];this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]][_0x981a('0xf6')]=_0x489cd8['stateinterface'];}}}}else if(_0x252991===_0x981a('0xf1')){if(this[_0x981a('0x20')][_0x489cd8['actionid']]){if(this[_0x981a('0x1c')][_0x489cd8['stateinterface']]){this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]][_0x981a('0xf6')]=_0x489cd8['stateinterface'];if(_[_0x981a('0xf3')](this[_0x981a('0x27')][this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]]['queue']])){this[_0x981a('0x27')][this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]]['queue']]=[];}this[_0x981a('0x27')][this[_0x981a('0x20')][_0x489cd8[_0x981a('0xef')]][_0x981a('0xba')]]['push'](_[_0x981a('0x5c')](_['pick'](this['actions'][_0x489cd8['actionid']],[_0x981a('0xf7'),_0x981a('0xf6')]),{'status':_0x489cd8[_0x981a('0x84')],'paused':_0x489cd8[_0x981a('0xf5')]}));}}}};Dialer[_0x981a('0x82')][_0x981a('0x38')]=function(_0x1f2212){if(!this['actions'][_0x1f2212[_0x981a('0xef')]]){return;}var _0x5680d2=this;var _0x2ab430=this[_0x981a('0x1a')][this[_0x981a('0x20')][_0x1f2212['actionid']]['queue']];var _0x2c3599=_0x2ab430['strategy']||_0x981a('0xf1');if(_0x2c3599===_0x981a('0xf2')){if(this['actions'][_0x1f2212[_0x981a('0xef')]]&&this[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]][_0x981a('0xf6')]){this[_0x981a('0x19')][_0x981a('0xf8')](this['actions'][_0x1f2212[_0x981a('0xef')]][_0x981a('0xf7')],this['actions'][_0x1f2212[_0x981a('0xef')]][_0x981a('0xf6')])[_0x981a('0x9b')](function(_0xa60419){logger['error'](_0x981a('0xf9'),util['inspect'](_0xa60419,{'showHidden':![],'depth':null}));})[_0x981a('0xfa')](function(){_0x5680d2[_0x981a('0xbc')](_0x5680d2['voiceQueues'][_0x5680d2[_0x981a('0x20')][_0x1f2212['actionid']][_0x981a('0xba')]]);_0x5680d2[_0x981a('0x1c')][_0x5680d2[_0x981a('0x20')][_0x1f2212['actionid']][_0x981a('0xf6')]][_0x981a('0xf4')]=![];delete _0x5680d2[_0x981a('0x20')][_0x1f2212['actionid']];unlockQueueStatus(_0x2ab430);});}else{this[_0x981a('0xbc')](this[_0x981a('0x1a')][this[_0x981a('0x20')][_0x1f2212['actionid']][_0x981a('0xba')]]);hopperUtils[_0x981a('0xe7')]({'active':![],'ContactId':this['actions'][_0x1f2212['actionid']][_0x981a('0xd9')],'ListId':this['actions'][_0x1f2212[_0x981a('0xef')]][_0x981a('0xda')],'VoiceQueueId':this[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]]['VoiceQueueId']||undefined,'CampaignId':this[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]][_0x981a('0xe8')]||undefined})['catch'](loggerCatch(_0x981a('0xfb')));delete this['actions'][_0x1f2212[_0x981a('0xef')]];unlockQueueStatus(_0x2ab430);}}else if(_0x2c3599===_0x981a('0xf1')){var _0x5d59d9;if(this[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]]&&!_[_0x981a('0x46')](this['queueBooked'][this[_0x981a('0x20')][_0x1f2212['actionid']]['queue']])){if(this['queueBookedRR'][_0x5680d2[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]][_0x981a('0xba')]]){this['queueBookedRR'][_0x5680d2[_0x981a('0x20')][_0x1f2212['actionid']]['queue']]=this['queueBookedRR'][this[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]]['queue']]?this[_0x981a('0xfc')][this['actions'][_0x1f2212[_0x981a('0xef')]][_0x981a('0xba')]]:this['queueBooked'][this[_0x981a('0x20')][_0x1f2212['actionid']]['queue']]?this['queueBooked'][this[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]][_0x981a('0xba')]][_0x981a('0xfd')]||0x0:0x0;}this[_0x981a('0x27')][this['actions'][_0x1f2212[_0x981a('0xef')]]['queue']]['_rr']=this[_0x981a('0xfc')][this[_0x981a('0x20')][_0x1f2212[_0x981a('0xef')]][_0x981a('0xba')]];for(var _0x4526d3=0x0;_0x4526d3=_0x2e1174[_0x981a('0x126')]){_0x350a5f[_0x981a('0x127')](_0x14c71f,_0x130568,_0x1b8656,_0x981a('0x128'));}else{if(_0x14c71f[_0x981a('0x124')]>=_0x2e1174[_0x981a('0x129')]){_0x350a5f[_0x981a('0x12a')](_0x14c71f,_0x130568,_0x1b8656,'reason\x2019\x20machine....');}else{hopperUtils[_0x981a('0xe7')]({'active':![],'countmachineretry':_0x14c71f[_0x981a('0x124')],'scheduledat':moment()[_0x981a('0xd7')](_0x2e1174['dialMachineRetryFrequency'],_0x981a('0xd8'))['format'](_0x981a('0xbe')),'ContactId':_0x14c71f[_0x981a('0xd9')],'ListId':_0x14c71f[_0x981a('0xda')],'VoiceQueueId':_0x14c71f['VoiceQueueId']||undefined,'CampaignId':_0x14c71f[_0x981a('0xe8')]||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0x12b')));_0x130568({'reschedule':0x1});}}});}if(_0x49ebea[_0x981a('0x3f')]===_0x981a('0xbf')&&this['campaigns'][_0x49ebea[_0x981a('0xba')]][_0x981a('0x11b')]&&_0x3f4c46[_0x981a('0x11c')]===_0x981a('0x113')){delete this['uniqueId'][_0x3f4c46[_0x981a('0xbb')]];this[_0x981a('0xbc')](this[_0x981a('0x1b')][_0x49ebea[_0x981a('0xba')]]);_0x8d7b17=new Hangup(_0x49ebea,_0x3f4c46);_0x8d7b17[_0x981a('0xcc')]=0x12;_0x8d7b17['statedesc']=_0x981a('0x12c');_0x8d7b17[_0x981a('0x115')]='AMD';ami['emit'](_0x981a('0x11e'),ut[_0x981a('0x117')](_0x8d7b17,'amd'));this[_0x981a('0x119')](_0x8d7b17,_0x981a('0x12d'),_0x981a('0x12e'));}if(_0x49ebea['type']===_0x981a('0xbf')&&this['campaigns'][_0x49ebea[_0x981a('0xba')]][_0x981a('0x11b')]&&_0x3f4c46[_0x981a('0x11c')]==='MACHINE'){return new Promise(function(_0x511dc9,_0x3e14b7){delete _0x350a5f['uniqueId'][_0x3f4c46[_0x981a('0xbb')]];_0x350a5f['updateOriginated'](_0x350a5f[_0x981a('0x1b')][_0x49ebea['queue']]);_0x350a5f[_0x981a('0x1b')][_0x49ebea[_0x981a('0xba')]][_0x981a('0xc0')]+=0x1;_0x350a5f[_0x981a('0x1b')][_0x49ebea[_0x981a('0xba')]][_0x981a('0x114')]+=0x1;var _0x2dfcf4=_0x350a5f['campaigns'][_0x49ebea[_0x981a('0xba')]];var _0xd2c111=new Hangup(_0x49ebea,_0x3f4c46);_0xd2c111[_0x981a('0xcc')]=0x13;_0xd2c111[_0x981a('0x6e')]='Machine';_0xd2c111['membername']='AMD';_0xd2c111[_0x981a('0x124')]+=0x1;_0xd2c111[_0x981a('0xe4')]+=0x1;_0xd2c111['amd']=!![];ami[_0x981a('0x3e')](_0x981a('0x11e'),ut['buildObj'](_0xd2c111,_0x981a('0x118')));hopperUtils[_0x981a('0xc3')](_0xd2c111)[_0x981a('0x9b')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0xd2c111['countbusyretry']+_0xd2c111['countcongestionretry']+_0xd2c111['countnoanswerretry']+_0xd2c111[_0x981a('0x123')]+_0xd2c111[_0x981a('0xcf')]+_0xd2c111[_0x981a('0xe3')]+_0xd2c111[_0x981a('0x124')]+_0xd2c111[_0x981a('0x125')]>=_0x2dfcf4[_0x981a('0x126')]){_0x350a5f['stateGlobal'](_0xd2c111,_0x511dc9,_0x3e14b7,'reason19\x20machine....');}else{if(_0xd2c111['countmachineretry']>=_0x2dfcf4[_0x981a('0x129')]){_0x350a5f[_0x981a('0x12a')](_0xd2c111,_0x511dc9,_0x3e14b7,_0x981a('0x12f'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0xd2c111[_0x981a('0x124')],'scheduledat':moment()[_0x981a('0xd7')](_0x2dfcf4[_0x981a('0x130')],_0x981a('0xd8'))['format'](_0x981a('0xbe')),'ContactId':_0xd2c111[_0x981a('0xd9')],'ListId':_0xd2c111[_0x981a('0xda')],'VoiceQueueId':_0xd2c111[_0x981a('0x104')]||undefined,'CampaignId':_0xd2c111['CampaignId']||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0x12b')));_0x511dc9({'reschedule':0x1});}}});}}};Dialer[_0x981a('0x82')][_0x981a('0x32')]=function(_0x25cce3){var _0x2fcb70=this[_0x981a('0x22')][_0x25cce3[_0x981a('0xbb')]];var _0x40b694;if(_0x2fcb70&&_0x2fcb70[_0x981a('0x3f')]===_0x981a('0xbf')){delete this[_0x981a('0x22')][_0x25cce3[_0x981a('0xbb')]];this['updateOriginated'](this[_0x981a('0x1b')][_0x2fcb70[_0x981a('0xba')]]);this['campaigns'][_0x2fcb70[_0x981a('0xba')]][_0x981a('0x131')]+=0x1;_0x40b694=new Hangup(_0x2fcb70,_0x25cce3);hopperUtils[_0x981a('0xc3')](_0x40b694)['catch'](loggerCatch(_0x981a('0x132')));hopperUtils['moveContactManagedDialer'](_0x40b694)[_0x981a('0x9b')](loggerCatch('[syncHangupIvr]'));}if(_0x2fcb70&&_0x2fcb70[_0x981a('0x3f')]!==_0x981a('0xbf')&&isNotNull(this[_0x981a('0x1a')][_0x2fcb70[_0x981a('0xba')]][_0x981a('0x133')])){delete this['uniqueId'][_0x25cce3[_0x981a('0xbb')]];this[_0x981a('0xbc')](this[_0x981a('0x1a')][_0x2fcb70['queue']]);this[_0x981a('0x1a')][_0x2fcb70[_0x981a('0xba')]][_0x981a('0xc0')]+=0x1;this[_0x981a('0x1a')][_0x2fcb70[_0x981a('0xba')]][_0x981a('0x114')]+=0x1;_0x40b694=new Hangup(_0x2fcb70,_0x25cce3);_0x40b694['state']=0x10;_0x40b694['statedesc']=_0x981a('0x134');_0x40b694[_0x981a('0x115')]=_0x981a('0x135');hopperUtils[_0x981a('0xc3')](_0x40b694)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x40b694)[_0x981a('0x9b')](loggerCatch(_0x981a('0x136')));}if(_0x2fcb70&&_0x2fcb70[_0x981a('0x3f')]!==_0x981a('0xbf')&&!isNotNull(this[_0x981a('0x1a')][_0x2fcb70[_0x981a('0xba')]][_0x981a('0x133')])){if(_0x25cce3['cause-txt']===_0x981a('0x137')){delete this[_0x981a('0x22')][_0x25cce3[_0x981a('0xbb')]];this[_0x981a('0x1a')][_0x2fcb70[_0x981a('0xba')]][_0x981a('0xc0')]+=0x1;const _0x9119ad=new AgentComplete(_0x2fcb70,_0x25cce3);_0x9119ad[_0x981a('0xe8')]=this['voiceQueues'][_0x2fcb70['queue']]['id'];hopperUtils[_0x981a('0xc3')](_0x9119ad)['catch'](loggerCatch('[syncAgentComplete][createHistory]'));hopperUtils['moveContactManagedDialer'](_0x9119ad)[_0x981a('0x9b')](loggerCatch(_0x981a('0xc6')));}else{delete this[_0x981a('0x22')][_0x25cce3[_0x981a('0xbb')]];this[_0x981a('0xbc')](this[_0x981a('0x1a')][_0x2fcb70[_0x981a('0xba')]]);this[_0x981a('0x1a')][_0x2fcb70[_0x981a('0xba')]][_0x981a('0x138')]+=0x1;_0x40b694=new Hangup(_0x2fcb70,_0x25cce3);_0x40b694['state']=0xc;_0x40b694[_0x981a('0x6e')]=_0x25cce3[_0x981a('0x139')];_0x40b694[_0x981a('0x115')]=_0x981a('0x13a');hopperUtils[_0x981a('0xc3')](_0x40b694)[_0x981a('0x9b')](loggerCatch(_0x981a('0x132')));hopperUtils[_0x981a('0xc5')](_0x40b694)['catch'](loggerCatch(_0x981a('0x136')));}}};Dialer[_0x981a('0x82')][_0x981a('0x13b')]=function(_0x38ae54){var _0xe439af=this;if(!_0xe439af[_0x981a('0x13c')][_0x38ae54[_0x981a('0x44')]]){_0xe439af[_0x981a('0x13c')][_0x38ae54['name']]={'running':![]};}else if(_0xe439af[_0x981a('0x13c')][_0x38ae54['name']][_0x981a('0x13d')]===!![]){return;}else if(_0xe439af[_0x981a('0x13c')][_0x38ae54[_0x981a('0x44')]][_0x981a('0x13d')]===![]){_0xe439af['queuesSummary'][_0x38ae54[_0x981a('0x44')]][_0x981a('0x13d')]=!![];}var _0x70a347=_0xe439af[_0x981a('0x1a')][_0x38ae54[_0x981a('0x44')]];var _0x2572dd=_0x70a347[_0x981a('0x67')]!==utils[_0x981a('0x6b')][_0x981a('0x7c')];var _0x3bb961=utils[_0x981a('0x13e')](_0x70a347);_0x70a347['statusMessage']=utils['getQueueCampaignStatusMessage'](_0x70a347,_0xe439af[_0x981a('0x1d')]);Promise['resolve']()['then'](function(){if(_0x70a347[_0x981a('0x13f')]===utils[_0x981a('0x6b')]['INACTIVE']){if(_0x2572dd){clearPredictiveAttributes(_0x70a347);_0x38ae54[_0x981a('0x24')]=undefined;_0x38ae54[_0x981a('0x25')]=undefined;}if(_0x70a347[_0x981a('0x13f')]===utils[_0x981a('0x6b')][_0x981a('0x7c')]){_0x38ae54[_0x981a('0x140')]=0x0;_0x38ae54[_0x981a('0xf5')]=0x0;_0x38ae54[_0x981a('0x141')]=0x0;_0x38ae54[_0x981a('0x142')]=0x0;_0x38ae54[_0x981a('0x143')]=0x0;}}else if(_0x70a347[_0x981a('0x13f')]===utils[_0x981a('0x6b')][_0x981a('0x144')]&&!_0x3bb961){return _0xe439af[_0x981a('0x8c')](_0x70a347,!![])['then'](function(){return _0xe439af[_0x981a('0x8c')](_0x70a347,![]);})['then'](function(){return _0xe439af[_0x981a('0xaa')](_0x70a347);})['catch'](function(_0xf8a685){loggerSyncQueueSummary['debug'](_0x981a('0x145'),util[_0x981a('0x65')](_0xf8a685,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x70a347);});}else{clearPredictiveAttributes(_0x70a347);}})[_0x981a('0x97')](function(){var _0x59ba4e=_0x38ae54[_0x981a('0x146')](_0x70a347);if(_0x59ba4e||_0x70a347['queueSummaryCountersUpdated']){_0x70a347[_0x981a('0x147')]=![];_0x38ae54[_0x981a('0x148')](_0x70a347);Object['assign'](_0x70a347,_0x38ae54);emitOutboundVoiceQueueSummary(_0x38ae54);}_0xe439af[_0x981a('0x13c')][_0x70a347[_0x981a('0x44')]][_0x981a('0x13d')]=![];})[_0x981a('0x9b')](function(_0xa9ec99){logger[_0x981a('0x61')]('[syncQueueSummary]',util[_0x981a('0x65')](_0xa9ec99,{'showHidden':![],'depth':null}));_0xe439af[_0x981a('0x13c')][_0x70a347[_0x981a('0x44')]][_0x981a('0x13d')]=![];});};Dialer[_0x981a('0x82')][_0x981a('0x31')]=_[_0x981a('0x149')](function(){var _0x3b0cc1=_[_0x981a('0x14a')](this[_0x981a('0x1a')],function(_0x5454e4){return _0x5454e4[_0x981a('0x14b')];});var _0x2ce9e5=_[_0x981a('0x14a')](this['agents'],function(_0x424abb){return _0x424abb[_0x981a('0x14c')]&&_0x424abb[_0x981a('0x84')]==='reachable';});if(_0x3b0cc1['length']>0x0&&_0x2ce9e5[_0x981a('0x93')]>0x0){return Promise['resolve']()[_0x981a('0x97')](cmHopper[_0x981a('0x14d')](_['map'](_0x3b0cc1,'id'),previewRecallmeReminderInterval,_[_0x981a('0x14e')](_0x2ce9e5,'id')))[_0x981a('0x97')](function(_0x1fd4d7){for(var _0xed9a0d=0x0;_0xed9a0d<_0x1fd4d7[_0x981a('0x93')];_0xed9a0d++){var _0x477d35=_0x1fd4d7[_0xed9a0d]['Agent'][_0x981a('0x44')];if(_0x477d35)io['to'](util[_0x981a('0x42')]('user:%s',_0x477d35))[_0x981a('0x3e')](_0x981a('0x14f'),{'hopper':_0x1fd4d7[_0xed9a0d]});}})[_0x981a('0x9b')](function(_0x367f9f){logger[_0x981a('0x61')](_0x981a('0x150'),_0x367f9f);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x981a('0x82')][_0x981a('0x3a')]=function(){var _0x120383=this;setInterval(function(){_0x120383[_0x981a('0x151')](_0x120383[_0x981a('0x22')],_0x981a('0x152'));_0x120383[_0x981a('0x151')](_0x120383[_0x981a('0x20')],_0x981a('0x153'));},0x32c8);};Dialer[_0x981a('0x82')][_0x981a('0x151')]=function(_0x496756,_0x282f5d){var _0x3b309b=this;for(var _0x1b6a90 in _0x496756){if(typeof _0x496756[_0x1b6a90]!=='undefined'){this[_0x981a('0x18')][_0x981a('0x16')](function(){if(!_[_0x981a('0xf3')](_0x496756[_0x1b6a90])){return ami[_0x981a('0x95')]({'action':_0x981a('0x84'),'channel':_0x496756[_0x1b6a90]['channel']})[_0x981a('0x9b')](function(_0x385598){if(_0x385598[_0x981a('0x67')]===_0x981a('0x154')){setTimeout(function(){if(_0x496756[_0x1b6a90]&&_0x496756[_0x1b6a90][_0x981a('0x3f')]!==_0x981a('0xbf')){_0x3b309b['updateOriginated'](_0x3b309b[_0x981a('0x1a')][_0x496756[_0x1b6a90]['queue']]);logger[_0x981a('0x61')](_0x981a('0x155'),_0x282f5d,_0x1b6a90,_0x496756[_0x1b6a90][_0x981a('0xba')]);delete _0x496756[_0x1b6a90];}if(_0x496756[_0x1b6a90]&&_0x496756[_0x1b6a90][_0x981a('0x3f')]===_0x981a('0xbf')){_0x3b309b['updateOriginated'](_0x3b309b['campaigns'][_0x496756[_0x1b6a90][_0x981a('0xba')]]);logger['error'](_0x981a('0x156'),_0x282f5d,_0x1b6a90,_0x496756[_0x1b6a90][_0x981a('0xba')]);delete _0x496756[_0x1b6a90];}},0x2328);}});}});}}};Dialer[_0x981a('0x82')][_0x981a('0x157')]=function(_0x23e9d6){return Promise[_0x981a('0xa4')]()[_0x981a('0x97')](voiceQueueRt['getVoiceQueueRtPauses'](_0x23e9d6))[_0x981a('0x9b')](loggerCatch(_0x981a('0x158')));};Dialer[_0x981a('0x82')][_0x981a('0xbc')]=function(_0x56cc72){if(!_[_0x981a('0x3d')](_0x56cc72)&&_0x56cc72!==null){if(typeof _0x56cc72[_0x981a('0x159')]!=='undefined'){if(_0x56cc72[_0x981a('0x159')]>0x0){_0x56cc72[_0x981a('0x159')]-=0x1;}else{logger[_0x981a('0x61')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x981a('0x61')](_0x981a('0x15a'));}};Dialer[_0x981a('0x82')][_0x981a('0x15b')]=function(_0x343d94,_0x4b3167){var _0x53879c=this;return function(_0xa37e7a){_0x53879c[_0x981a('0xbc')](_0x4b3167);logger[_0x981a('0x61')](_0x343d94,util['inspect'](_0xa37e7a,{'showHidden':![],'depth':null}));};};Dialer['prototype'][_0x981a('0x15c')]=function(_0x9eec79,_0x50df96,_0x5c8756){var _0xbbf30d={'state':0x19,'statedesc':'notFound'};this[_0x981a('0xbc')](_0x50df96);this['saveInDb'](_[_0x981a('0x5c')](_0xbbf30d,_[_0x981a('0x100')](_0x5c8756,['ContactId',_0x981a('0xda'),_0x981a('0x15d'),_0x981a('0x104'),_0x981a('0xe8')])),_0x981a('0x15e'),_0x981a('0x15f'));logger[_0x981a('0x61')](_0x9eec79);};Dialer[_0x981a('0x82')][_0x981a('0x119')]=function(_0x24f132,_0x19f6e6,_0x80685e){hopperUtils['createHistory'](_0x24f132)[_0x981a('0x9b')](loggerCatch(_0x19f6e6));hopperUtils['moveContactManagedDialer'](_0x24f132)[_0x981a('0x9b')](loggerCatch(_0x80685e));};Dialer['prototype'][_0x981a('0xd6')]=function(_0xc4adfe,_0x5e2353){hopperUtils[_0x981a('0xc3')](_0xc4adfe)[_0x981a('0x9b')](loggerCatch(_0x981a('0xc4')));if(_0x5e2353==0x0){hopperUtils[_0x981a('0xc5')](_0xc4adfe)['catch'](loggerCatch(_0x981a('0x160')));}};Dialer['prototype'][_0x981a('0x150')]=function(_0xed0dff){return Promise['resolve']()[_0x981a('0x97')](cmHopper[_0x981a('0x14d')](_0xed0dff['id'],previewRecallmeReminderInterval))[_0x981a('0x97')](function(_0x3ca89d){for(var _0x26f097=0x0;_0x26f097<_0x3ca89d[_0x981a('0x93')];_0x26f097++){var _0x40c794=_0x3ca89d[_0x26f097]['Agent'][_0x981a('0x44')];if(_0x40c794)io['to'](util[_0x981a('0x42')]('user:%s',_0x40c794))['emit']('user:dialPreviewRecallReminder',{'hopper':_0x3ca89d[_0x26f097]});}})[_0x981a('0x9b')](function(){});};Dialer[_0x981a('0x82')][_0x981a('0xa8')]=function(_0x18a947){var _0x5b711a=this;return function(){_0x5b711a[_0x981a('0x161')](_0x18a947);};};Dialer[_0x981a('0x82')][_0x981a('0x162')]=function(_0x2e4516,_0x33a7dd){var _0x308eda=this;var _0x240b58=uuid['v4']();this[_0x981a('0x20')][_0x240b58]=new Action(_0x2e4516,_0x33a7dd,_0x240b58);return new Promise(function(_0x4d9105,_0x786f99){if(_[_0x981a('0x3d')](_0x2e4516)&&typeof _0x2e4516!==_0x981a('0x163')){return _0x786f99(msgResponse('originate',_0x981a('0x8d'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x33a7dd[_0x981a('0x164')])||_0x33a7dd['phone']===null){return _0x786f99(msgResponse(_0x981a('0x165'),_0x981a('0x8d'),'contact\x20is\x20undefine'));}var _0x48a07c={'XMD-CALLERID':_0x308eda['actions'][_0x240b58][_0x981a('0x166')](),'XMD-AGI':_0x2e4516['dialQueueProject']?util['format'](_0x981a('0x167'),ipAgi,_0x2e4516['dialQueueProject']):_0x981a('0x168'),'XMD-AGIAFTER':_0x2e4516['dialQueueProject2']?util[_0x981a('0x42')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2e4516[_0x981a('0x169')]):_0x981a('0x168'),'XMD-QUEUE':utils['isOutboundQueue'](_0x2e4516)?util[_0x981a('0x42')](_0x981a('0x16a'),_0x2e4516[_0x981a('0x44')],_0x2e4516[_0x981a('0x16b')]||'',_0x2e4516[_0x981a('0x16c')]?'c':'',_0x2e4516[_0x981a('0xc9')]||0x3):_0x981a('0x168'),'XMD-CONTACTID':_0x33a7dd[_0x981a('0xd9')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x308eda[_0x981a('0x20')][_0x240b58]['getCaller'](),'XMD-AMD':_0x2e4516[_0x981a('0x11b')]?_0x981a('0x144'):_0x981a('0x168'),'XMD-DESTINATION':_0x981a('0x112')};if(_0x2e4516[_0x981a('0x11b')]){_0x48a07c[_0x981a('0x16d')]=_0x2e4516[_0x981a('0x16e')]||0x9c4;_0x48a07c['XMD-AMDGREETING']=_0x2e4516[_0x981a('0x16f')]||0x5dc;_0x48a07c[_0x981a('0x170')]=_0x2e4516['dialAMDAfterGreetingSilence']||0x320;_0x48a07c[_0x981a('0x171')]=_0x2e4516[_0x981a('0x172')]||0x1388;_0x48a07c[_0x981a('0x173')]=_0x2e4516[_0x981a('0x174')]||0x64;_0x48a07c[_0x981a('0x175')]=_0x2e4516[_0x981a('0x176')]||0x32;_0x48a07c[_0x981a('0x177')]=_0x2e4516[_0x981a('0x178')]||0x3;_0x48a07c['XMD-AMDSILENCETHRESHOLD']=_0x2e4516['dialAMDSilenceThreshold']||0x100;_0x48a07c[_0x981a('0x179')]=_0x2e4516[_0x981a('0x17a')]||0x1388;}if(utils['isOutboundQueue'](_0x2e4516)){_0x48a07c[_0x981a('0x17b')]=_0x33a7dd[_0x981a('0x104')];}else{_0x48a07c[_0x981a('0x17c')]=_0x33a7dd['CampaignId'];}var _0x2dc3fc=utils[_0x981a('0x17d')](_0x33a7dd[_0x981a('0x17e')]);Object[_0x981a('0x17f')](_0x48a07c,_0x2dc3fc);var _0x3d086d=_0x308eda[_0x981a('0x86')](_0x2e4516[_0x981a('0x180')])?utils[_0x981a('0x181')](_0x2e4516['Trunk'][_0x981a('0x182')],_0x2e4516[_0x981a('0x183')],_0x2e4516[_0x981a('0x184')]>0x0?utils['getCallerIdRandom'](_0x2e4516[_0x981a('0x185')],_0x2e4516[_0x981a('0x184')]):_0x2e4516[_0x981a('0x185')]):utils[_0x981a('0x181')](_[_0x981a('0xf3')](_0x2e4516['TrunkBackup'])?_0x2e4516[_0x981a('0x180')][_0x981a('0x182')]:_0x2e4516[_0x981a('0x87')][_0x981a('0x182')],_0x2e4516[_0x981a('0x183')],_0x2e4516[_0x981a('0x184')]>0x0?utils[_0x981a('0x186')](_0x2e4516[_0x981a('0x185')],_0x2e4516[_0x981a('0x184')]):_0x2e4516[_0x981a('0x185')]);if(_0x3d086d){_0x48a07c[_0x981a('0x187')]=_0x308eda[_0x981a('0x20')][_0x240b58]['originatecalleridname']=utils[_0x981a('0x188')](_0x3d086d);_0x48a07c[_0x981a('0x189')]=_0x33a7dd[_0x981a('0x164')];}_0x2e4516[_0x981a('0x18a')]=_0x48a07c;return ami[_0x981a('0x95')]({'actionid':_0x240b58,'action':_0x981a('0x165'),'channel':_0x308eda[_0x981a('0x86')](_0x2e4516[_0x981a('0x180')])?util[_0x981a('0x42')]('SIP/%s/%s%s',_0x2e4516[_0x981a('0x180')][_0x981a('0x44')],isNotNull(_0x2e4516[_0x981a('0x18b')])?_0x2e4516[_0x981a('0x18b')]['trim']()||'':'',_0x2e4516[_0x981a('0x18c')]>0x0?_0x33a7dd[_0x981a('0x164')][_0x981a('0x18d')](_0x2e4516[_0x981a('0x18c')]):_0x33a7dd[_0x981a('0x164')]):util[_0x981a('0x42')](_0x981a('0x18e'),_[_0x981a('0xf3')](_0x2e4516[_0x981a('0x87')])?_0x2e4516['Trunk'][_0x981a('0x44')]:_0x2e4516[_0x981a('0x87')][_0x981a('0x44')],isNotNull(_0x2e4516[_0x981a('0x18b')])?_0x2e4516[_0x981a('0x18b')]['trim']()||'':'',_0x2e4516['dialCutDigit']>0x0?_0x33a7dd[_0x981a('0x164')]['substring'](_0x2e4516['dialCutDigit']):_0x33a7dd[_0x981a('0x164')]),'callerid':_0x3d086d,'Exten':_0x981a('0x112'),'Context':_0x981a('0x18f'),'Priority':'1','variable':_0x48a07c,'timeout':(_0x2e4516[_0x981a('0x190')]||0x1e)*0x3e8,'async':!![],'channelid':_0x240b58})['then'](function(_0x5e8050){return _0x4d9105(_0x5e8050);})[_0x981a('0x9b')](function(_0xcfc971){_0x2e4516[_0x981a('0x191')]+=0x1;var _0x43ef6c=new History(_0x308eda[_0x981a('0x20')][_0x240b58]);logger[_0x981a('0x61')](util[_0x981a('0x42')](_0x981a('0x192'),JSON['stringify'](_0xcfc971)));_0x43ef6c[_0x981a('0xcc')]=0xe;_0x43ef6c[_0x981a('0x6e')]=_0x981a('0x193');_0x43ef6c[_0x981a('0xdd')]=moment()[_0x981a('0x42')](_0x981a('0xbe'));_0x43ef6c[_0x981a('0x6f')]=_0x43ef6c['starttime'];hopperUtils[_0x981a('0xc3')](_0x43ef6c)[_0x981a('0x9b')](loggerCatch(_0x981a('0x194')));_0x308eda[_0x981a('0xc5')](_0x43ef6c)[_0x981a('0x9b')](loggerCatch(_0x981a('0x194')))[_0x981a('0xfa')](function(){delete _0x308eda[_0x981a('0x20')][_0x240b58];return _0x786f99(msgResponse(_0x981a('0x165'),_0x981a('0x81'),_0x981a('0x195')));});});});};Dialer[_0x981a('0x82')][_0x981a('0x196')]=function(_0x2d8004,_0x2047d5,_0x2dca2e){var _0x2bdfc1=new History(_0x2047d5);if(_0x2bdfc1[_0x981a('0x120')]+_0x2bdfc1[_0x981a('0x121')]+_0x2bdfc1[_0x981a('0x122')]+_0x2bdfc1[_0x981a('0x123')]+_0x2bdfc1['countdropretry']+_0x2bdfc1['countabandonedretry']+_0x2bdfc1[_0x981a('0x124')]+_0x2bdfc1[_0x981a('0x125')]>=_0x2dca2e[_0x981a('0x126')]-0x1){return!![];}switch(_0x2d8004){case 0x3:if(_0x2bdfc1['countnoanswerretry']>=_0x2dca2e[_0x981a('0x197')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0x2bdfc1[_0x981a('0x122')]+=0x1,'scheduledat':moment()[_0x981a('0xd7')](_0x2dca2e[_0x981a('0x198')],'minutes')['format'](_0x981a('0xbe')),'ContactId':_0x2bdfc1['ContactId'],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1['VoiceQueueId']||undefined,'CampaignId':_0x2bdfc1[_0x981a('0xe8')]||undefined})['catch'](loggerCatch(_0x981a('0x199')));break;case 0x5:if(_0x2bdfc1[_0x981a('0x120')]>=_0x2dca2e['dialBusyMaxRetry']-0x1){return!![];}hopperUtils[_0x981a('0xe7')]({'active':![],'countbusyretry':_0x2bdfc1[_0x981a('0x120')]+=0x1,'scheduledat':moment()[_0x981a('0xd7')](_0x2dca2e[_0x981a('0x19a')],_0x981a('0xd8'))[_0x981a('0x42')](_0x981a('0xbe')),'ContactId':_0x2bdfc1[_0x981a('0xd9')],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1[_0x981a('0x104')]||undefined,'CampaignId':_0x2bdfc1[_0x981a('0xe8')]||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0x19b')));break;case 0x8:if(_0x2bdfc1[_0x981a('0x121')]>=_0x2dca2e[_0x981a('0x19c')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countcongestionretry':_0x2bdfc1[_0x981a('0x121')]+=0x1,'scheduledat':moment()['add'](_0x2dca2e[_0x981a('0x19d')],_0x981a('0xd8'))[_0x981a('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2bdfc1[_0x981a('0xd9')],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1[_0x981a('0x104')]||undefined,'CampaignId':_0x2bdfc1[_0x981a('0xe8')]||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0x19e')));break;case 0x0:if(_0x2bdfc1[_0x981a('0x123')]>=_0x2dca2e[_0x981a('0x19f')]-0x1){return!![];}else{hopperUtils[_0x981a('0xe7')]({'active':![],'countnosuchnumberretry':_0x2bdfc1[_0x981a('0x123')]+=0x1,'scheduledat':moment()[_0x981a('0xd7')](_0x2dca2e['dialNoSuchNumberRetryFrequency'],_0x981a('0xd8'))[_0x981a('0x42')](_0x981a('0xbe')),'ContactId':_0x2bdfc1[_0x981a('0xd9')],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1[_0x981a('0x104')]||undefined,'CampaignId':_0x2bdfc1[_0x981a('0xe8')]||undefined})['catch'](loggerCatch(_0x981a('0x1a0')));}break;case 0xa:if(_0x2bdfc1[_0x981a('0xcf')]>=_0x2dca2e[_0x981a('0xd5')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2bdfc1[_0x981a('0xcf')]+=0x1,'scheduledat':moment()[_0x981a('0xd7')](_0x2dca2e[_0x981a('0xd0')],_0x981a('0xd8'))[_0x981a('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2bdfc1[_0x981a('0xd9')],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1[_0x981a('0x104')]||undefined,'CampaignId':_0x2bdfc1['CampaignId']||undefined})['catch'](loggerCatch(_0x981a('0xdb')));break;case 0xb:if(_0x2bdfc1[_0x981a('0xe3')]>=_0x2dca2e['dialAbandonedMaxRetry']-0x1){return!![];}hopperUtils[_0x981a('0xe7')]({'active':![],'countabandonedretry':_0x2bdfc1[_0x981a('0xe3')]+=0x1,'scheduledat':moment()['add'](_0x2dca2e['dialAbandonedRetryFrequency'],_0x981a('0xd8'))['format'](_0x981a('0xbe')),'ContactId':_0x2bdfc1[_0x981a('0xd9')],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1[_0x981a('0x104')]||undefined,'CampaignId':_0x2bdfc1[_0x981a('0xe8')]||undefined})['catch'](loggerCatch(_0x981a('0xe9')));break;case 0x13:if(_0x2bdfc1['countmachineretry']>=_0x2dca2e[_0x981a('0x129')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x2bdfc1['countmachineretry']+=0x1,'scheduledat':moment()[_0x981a('0xd7')](_0x2dca2e[_0x981a('0x130')],'minutes')[_0x981a('0x42')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2bdfc1[_0x981a('0xd9')],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1[_0x981a('0x104')]||undefined,'CampaignId':_0x2bdfc1[_0x981a('0xe8')]||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0x12b')));break;case 0x14:if(_0x2bdfc1['countagentrejectretry']>=_0x2dca2e['dialAgentRejectMaxRetry']-0x1){return!![];}hopperUtils[_0x981a('0xe7')]({'active':![],'countagentrejectretry':_0x2bdfc1['countagentrejectretry']+=0x1,'scheduledat':moment()[_0x981a('0xd7')](_0x2dca2e[_0x981a('0x1a1')],'minutes')[_0x981a('0x42')](_0x981a('0xbe')),'ContactId':_0x2bdfc1[_0x981a('0xd9')],'ListId':_0x2bdfc1[_0x981a('0xda')],'VoiceQueueId':_0x2bdfc1['VoiceQueueId']||undefined,'CampaignId':_0x2bdfc1[_0x981a('0xe8')]||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0x1a2')));break;default:return!![];}};Dialer[_0x981a('0x82')][_0x981a('0x10c')]=function(_0x5b623e,_0x2b80f1,_0x9c017d){var _0x118f44=this;var _0x8d5ea7=new History(_0x5b623e);var _0x3b4b2c=![];var _0x572516;var _0x270169;return new Promise(function(_0x318291,_0x10a82b){if(_[_0x981a('0x3d')](_0x2b80f1)&&typeof _0x2b80f1!==_0x981a('0x163')){return _0x10a82b(msgResponse(_0x981a('0x1a3'),_0x981a('0x8d'),_0x981a('0x1a4')));}if(_[_0x981a('0x3d')](_0x9c017d)&&typeof _0x9c017d!=='object'){return _0x10a82b(msgResponse(_0x981a('0x1a3'),_0x981a('0x8d'),_0x981a('0x1a5')));}hopperUtils[_0x981a('0xd2')](_0x8d5ea7,_0x9c017d['reason'],_0x2b80f1)[_0x981a('0x97')](function(_0x26454e){if(_0x26454e[_0x981a('0xd4')]==0x1)_0x3b4b2c=!![];switch(_0x9c017d[_0x981a('0xc1')]){case'0':_0x2b80f1[_0x981a('0x1a6')]+=0x1;_0x8d5ea7[_0x981a('0xcc')]=0x0;_0x8d5ea7[_0x981a('0x6e')]=_0x981a('0x1a7');_0x8d5ea7[_0x981a('0x123')]+=0x1;_0x8d5ea7[_0x981a('0xe4')]+=0x1;ami[_0x981a('0x3e')](_0x981a('0x1a8'),ut[_0x981a('0x117')](_0x5b623e,'nosuchnumber'));_0x572516=_0x2b80f1[_0x981a('0x1a9')];_0x270169=_0x2b80f1[_0x981a('0xd1')];hopperUtils['createHistory'](_0x8d5ea7)['catch'](loggerCatch(_0x981a('0x11f')));if(_0x118f44['checkRetriveMax'](0x0,_0x5b623e,_0x2b80f1)&&!_0x3b4b2c){if(_0x8d5ea7[_0x981a('0x123')]>=_0x2b80f1[_0x981a('0x19f')]){_0x118f44[_0x981a('0x12a')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1aa'));}else{_0x118f44['stateGlobal'](_0x8d5ea7,_0x318291,_0x10a82b,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x2b80f1[_0x981a('0x1ab')]+=0x1;_0x8d5ea7[_0x981a('0xcc')]=0x3;_0x8d5ea7[_0x981a('0x6e')]='NoAnswer';_0x8d5ea7[_0x981a('0x122')]+=0x1;_0x8d5ea7[_0x981a('0xe4')]+=0x1;var _0xf6cdd=ut[_0x981a('0x1ac')](_0x5b623e,_0x2b80f1);ami[_0x981a('0x3e')]('custom:agentnoanswer',_0xf6cdd);_0x572516=_0x2b80f1['dialNoAnswerRetryFrequency'];_0x270169=_0x2b80f1[_0x981a('0xd1')];hopperUtils['createHistory'](_0x8d5ea7)['catch'](loggerCatch(_0x981a('0x1ad')));if(_0x118f44[_0x981a('0x196')](0x3,_0x5b623e,_0x2b80f1)&&!_0x3b4b2c){if(_0x8d5ea7[_0x981a('0x122')]>=_0x2b80f1[_0x981a('0x197')]){_0x118f44[_0x981a('0x12a')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1ae'));}else{_0x118f44[_0x981a('0x127')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1ae'));}}break;case'5':_0x2b80f1[_0x981a('0x1af')]+=0x1;_0x8d5ea7[_0x981a('0xcc')]=0x5;_0x8d5ea7[_0x981a('0x6e')]='Busy';_0x8d5ea7[_0x981a('0x120')]+=0x1;_0x8d5ea7[_0x981a('0xe4')]+=0x1;ami[_0x981a('0x3e')](_0x981a('0x1b0'),ut[_0x981a('0x117')](_0x5b623e,_0x981a('0x1b1')));_0x572516=_0x2b80f1[_0x981a('0x19a')];_0x270169=_0x2b80f1[_0x981a('0xd1')];hopperUtils[_0x981a('0xc3')](_0x8d5ea7)[_0x981a('0x9b')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x118f44[_0x981a('0x196')](0x5,_0x5b623e,_0x2b80f1)&&!_0x3b4b2c){if(_0x8d5ea7[_0x981a('0x120')]>=_0x2b80f1[_0x981a('0x1b2')]){_0x118f44[_0x981a('0x12a')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1b3'));}else{_0x118f44[_0x981a('0x127')](_0x8d5ea7,_0x318291,_0x10a82b,'reason\x205\x20busy');}}break;case'8':_0x2b80f1[_0x981a('0x1b4')]+=0x1;_0x8d5ea7['state']=0x8;_0x8d5ea7['statedesc']=_0x981a('0x1b5');_0x8d5ea7[_0x981a('0x121')]+=0x1;_0x8d5ea7[_0x981a('0xe4')]+=0x1;_0x572516=_0x2b80f1[_0x981a('0x19d')];_0x270169=_0x2b80f1[_0x981a('0xd1')];ami['emit'](_0x981a('0x1b6'),ut[_0x981a('0x117')](_0x5b623e,'congestion'));hopperUtils[_0x981a('0xc3')](_0x8d5ea7)[_0x981a('0x9b')](loggerCatch(_0x981a('0x1b7')));if(_0x118f44[_0x981a('0x196')](0x8,_0x5b623e,_0x2b80f1)&&!_0x3b4b2c){if(_0x8d5ea7[_0x981a('0x121')]>=_0x2b80f1[_0x981a('0x19c')]){_0x118f44[_0x981a('0x12a')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1b8'));}else{_0x118f44['stateGlobal'](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1b8'));}}break;case'11':_0x2b80f1[_0x981a('0x1b9')]+=0x1;_0x8d5ea7[_0x981a('0xcc')]=0xb;_0x8d5ea7[_0x981a('0x6e')]='Abandoned';_0x8d5ea7[_0x981a('0xe3')]+=0x1;_0x8d5ea7[_0x981a('0xe4')]+=0x1;_0x572516=_0x2b80f1[_0x981a('0xe5')];_0x270169=_0x2b80f1['callAdditionalPhoneAfterMin'];hopperUtils[_0x981a('0xc3')](_0x8d5ea7)['catch'](loggerCatch(_0x981a('0xeb')));if(_0x118f44[_0x981a('0x196')](0xb,_0x5b623e,_0x2b80f1)&&!_0x3b4b2c){if(_0x8d5ea7[_0x981a('0xe3')]>=_0x2b80f1['dialAbandonedMaxRetry']){_0x118f44[_0x981a('0x12a')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1ba'));}else{_0x118f44[_0x981a('0x127')](_0x8d5ea7,_0x318291,_0x10a82b,'reason\x2011\x20abandoned');}}break;case'20':_0x2b80f1[_0x981a('0x1bb')]+=0x1;_0x8d5ea7['state']=0x14;_0x8d5ea7[_0x981a('0x6e')]=_0x981a('0x1bc');_0x8d5ea7[_0x981a('0x125')]+=0x1;_0x8d5ea7[_0x981a('0xe4')]+=0x1;_0x572516=_0x2b80f1[_0x981a('0x1a1')];_0x270169=_0x2b80f1['callAdditionalPhoneAfterMin'];ami['emit'](_0x981a('0x1bd'),ut['buildObj'](_0x5b623e,_0x981a('0x1be')));hopperUtils[_0x981a('0xc3')](_0x8d5ea7)[_0x981a('0x9b')](loggerCatch(_0x981a('0x1bf')));if(_0x118f44[_0x981a('0x196')](0x14,_0x5b623e,_0x2b80f1)&&!_0x3b4b2c){if(_0x8d5ea7[_0x981a('0x125')]>=_0x2b80f1[_0x981a('0x1c0')]){_0x118f44[_0x981a('0x12a')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1c1'));}else{_0x118f44[_0x981a('0x127')](_0x8d5ea7,_0x318291,_0x10a82b,_0x981a('0x1c1'));}}break;default:_0x2b80f1[_0x981a('0x138')]+=0x1;_0x8d5ea7[_0x981a('0xcc')]=0xc;_0x8d5ea7[_0x981a('0x6e')]=_0x9c017d[_0x981a('0xc1')];_0x572516=_0x2b80f1[_0x981a('0x1a1')];_0x270169=_0x2b80f1[_0x981a('0xd1')];hopperUtils[_0x981a('0xc3')](_0x8d5ea7)[_0x981a('0x9b')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x118f44['checkRetriveMax'](_0x9c017d['reason'],_0x5b623e,_0x2b80f1)&&!_0x3b4b2c){if(_0x8d5ea7['countbusyretry']+_0x8d5ea7[_0x981a('0x121')]+_0x8d5ea7[_0x981a('0x122')]+_0x8d5ea7[_0x981a('0x123')]+_0x8d5ea7[_0x981a('0xcf')]+_0x8d5ea7[_0x981a('0xe3')]+_0x8d5ea7[_0x981a('0x124')]+_0x8d5ea7[_0x981a('0x125')]>=_0x2b80f1[_0x981a('0x126')]){_0x118f44[_0x981a('0x127')](_0x8d5ea7,_0x318291,_0x10a82b,_0x9c017d['reason']);}else{_0x118f44[_0x981a('0x12a')](_0x8d5ea7,_0x318291,_0x10a82b,_0x9c017d[_0x981a('0xc1')]);}}}})[_0x981a('0x97')](function(){if(_0x3b4b2c){hopperUtils[_0x981a('0xec')](_0x8d5ea7,_0x572516,_0x270169)[_0x981a('0x97')](function(){return _0x318291(0x1);});}});});};Dialer[_0x981a('0x82')][_0x981a('0x127')]=function(_0x19eefe,_0x4f5fc8,_0x4af717,_0x3a3e28){var _0x30eefd=new Final(_0x19eefe);_0x30eefd['state']=0xf;_0x30eefd['statedesc']=_0x981a('0x1c2');this[_0x981a('0x12a')](_0x30eefd,_0x4f5fc8,_0x4af717,_0x3a3e28);};Dialer[_0x981a('0x82')][_0x981a('0x12a')]=function(_0x4af928,_0x366752,_0xd17313,_0x48a27d){hopperUtils['moveContactManagedDialer'](_0x4af928)[_0x981a('0x97')](function(){return _0x366752(msgResponse('[callProgressDetecting]',_0x981a('0x10b'),_0x48a27d));})['catch'](function(){return _0xd17313(msgResponse('[moveContactManagedDialer][0]','Failure',_0x981a('0x1c3')));});};Dialer[_0x981a('0x82')][_0x981a('0xa')]=function(_0x28387f){var _0x15b750=_0x28387f['dialPredictiveOptimizationPercentage']/0x64;var _0x3fd93d=_0x28387f[_0x981a('0xca')]/(_0x28387f[_0x981a('0xca')]+_0x28387f[_0x981a('0xc0')]);var _0x358f05=Math[_0x981a('0x1c4')](_0x28387f[_0x981a('0x1c5')]*(_0x28387f['predictiveIntervalMaxThreshold']/0x64));var _0x37c43d=Math[_0x981a('0x1c4')](_0x28387f[_0x981a('0x1c5')]*(_0x28387f[_0x981a('0x1c6')]/0x64));var _0x4df7b7=_0x28387f[_0x981a('0x140')]+_0x28387f[_0x981a('0x142')];var _0x53dbac=Math[_0x981a('0x1c7')](_0x28387f[_0x981a('0x57')]*_0x28387f[_0x981a('0x59')]*_0x28387f[_0x981a('0x1c8')]*_0x28387f[_0x981a('0x1c9')]);if(_['isUndefined'](_0x28387f[_0x981a('0x25')])){if(!_['isUndefined'](_0x28387f[_0x981a('0x24')])){_0x28387f[_0x981a('0x24')]=undefined;loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x981a('0x1ca'));}if(!_[_0x981a('0x3d')](_0x28387f['handlePredictive'])){loggerPredictive['error'](_0x981a('0x1cb'),_0x981a('0x1cc'));clearInterval(_0x28387f[_0x981a('0x1cd')]);_0x28387f[_0x981a('0x1cd')]=undefined;}_0x28387f['startProgressive']=moment()['format'](_0x981a('0xbe'));loggerPredictive[_0x981a('0x47')](_0x28387f['name'],_0x981a('0x1ce'),_0x28387f['startProgressive']);this[_0x981a('0xad')](_0x28387f,0x1);}else if(ifInterval(_0x28387f[_0x981a('0x1cf')],_0x28387f[_0x981a('0x25')])){this[_0x981a('0xad')](_0x28387f,0x1);loggerPredictiveCalls[_0x981a('0x47')](_0x981a('0x1d0'),_0x28387f[_0x981a('0x25')],_0x28387f[_0x981a('0x44')]);_0x28387f[_0x981a('0x57')]=0x0;_0x28387f[_0x981a('0xcb')]=0x0;}else if(_0x15b750<_0x3fd93d&&_0x28387f[_0x981a('0x1d1')]===_0x981a('0x1d2')){clearPredictiveAttributes(_0x28387f);loggerPredictive['info'](_0x981a('0x1d3'),_0x981a('0x1d4'),_0x3fd93d,_0x981a('0x25'),_0x28387f[_0x981a('0x44')]);}else if(_0x53dbac<_0x28387f[_0x981a('0xcb')]&&_0x28387f[_0x981a('0x1d1')]===_0x981a('0x1d2')){clearPredictiveAttributes(_0x28387f);loggerPredictive[_0x981a('0x47')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x981a('0x1d5'),_0x53dbac,_0x981a('0x1d6'),_0x28387f['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x28387f[_0x981a('0x44')]);}else if(!ifInterval(_0x28387f[_0x981a('0x1cf')],_0x28387f[_0x981a('0x25')])&&_['isUndefined'](_0x28387f[_0x981a('0x24')])&&!_['isUndefined'](_0x28387f[_0x981a('0x25')])){_0x28387f[_0x981a('0x24')]=moment()[_0x981a('0x42')](_0x981a('0xbe'));loggerPredictive['info'](_0x28387f['name'],_0x981a('0x1d7'),_0x28387f[_0x981a('0x24')]);hopperUtils[_0x981a('0x1d8')](_0x28387f['dialPredictiveInterval'])[_0x981a('0x97')](this[_0x981a('0x1d9')](_0x28387f))['then'](mergeDataErlangB(_0x28387f))['then'](this[_0x981a('0x1da')](_0x28387f))[_0x981a('0x9b')](loggerCatchPredictive(_0x981a('0x1db'),_0x28387f));}else if(!ifInterval(_0x28387f[_0x981a('0x1cf')],_0x28387f[_0x981a('0x24')])){_0x28387f[_0x981a('0xcb')]=0x0;_0x28387f[_0x981a('0x24')]=moment()[_0x981a('0x42')](_0x981a('0xbe'));loggerPredictive[_0x981a('0x47')](_0x28387f['name'],_0x981a('0x1dc'),_0x28387f[_0x981a('0x24')]);clearInterval(_0x28387f[_0x981a('0x1cd')]);_0x28387f[_0x981a('0x1cd')]=undefined;hopperUtils['avgHandleTime'](_0x28387f[_0x981a('0x1cf')])[_0x981a('0x97')](this[_0x981a('0x1d9')](_0x28387f))[_0x981a('0x97')](mergeDataErlangB(_0x28387f))[_0x981a('0x97')](this[_0x981a('0x1da')](_0x28387f))[_0x981a('0x9b')](loggerCatchPredictive(_0x981a('0x1dd'),_0x28387f));}else if(_0x28387f[_0x981a('0x1c5')]&&_0x4df7b7<_0x28387f['predictiveIntervalAvailable']-_0x37c43d){clearPredictiveAttributes(_0x28387f);loggerPredictive[_0x981a('0x47')](_0x28387f['name'],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x4df7b7,')\x20are\x20less\x20than\x20threshold\x20(',_0x28387f[_0x981a('0x1c5')],'-',_0x37c43d,'=',_0x28387f[_0x981a('0x1c5')]-_0x37c43d,')');}else if(_0x28387f['predictiveIntervalAvailable']&&_0x4df7b7>_0x28387f[_0x981a('0x1c5')]+_0x358f05){clearPredictiveAttributes(_0x28387f);loggerPredictive[_0x981a('0x47')](_0x28387f['name'],_0x981a('0x1de'),_0x4df7b7,_0x981a('0x1df'),_0x28387f[_0x981a('0x1c5')],'+',_0x358f05,'=',_0x28387f[_0x981a('0x1c5')]+_0x358f05,')');}};Dialer[_0x981a('0x82')][_0x981a('0x1d9')]=function(_0x26f709){var _0x8c769f=this;return function(_0x46f9f9){return new Promise(function(_0x5e6a44,_0x402d78){_[_0x981a('0x5c')](_0x26f709,_0x46f9f9[0x0]);if(checkGetDataPredictive(_0x46f9f9[0x0])){var _0x164fbf=_0x26f709[_0x981a('0x1c5')]=_0x26f709[_0x981a('0x142')]+_0x26f709[_0x981a('0x140')];var _0x3378fe=_0x26f709['dialPredictiveInterval']*0x3c;var _0x3da800=_0x46f9f9[0x0][_0x981a('0x53')]+_0x46f9f9[0x0]['predictiveIntervalAvgHoldtime'];var _0xcc183b=(_0x46f9f9[0x0]['predictiveIntervalAnsweredCalls']+_0x46f9f9[0x0][_0x981a('0x4c')]+_0x46f9f9[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x46f9f9[0x0][_0x981a('0x52')];_0x26f709[_0x981a('0x1c8')]=_0xcc183b>0x0?_0xcc183b:0x1;switch(_0x26f709[_0x981a('0x1d1')]){case _0x981a('0x1d2'):var _0x57d739=_0x26f709['dialPredictiveOptimizationPercentage']/0x64;return _0x8c769f[_0x981a('0x1e0')](_0x164fbf,_0x3378fe,_0x3da800,_0xcc183b,_0x57d739)[_0x981a('0x97')](function(_0x3e9e9b){return _0x5e6a44(_0x3e9e9b);});case _0x981a('0x1e1'):var _0x1fcaf6=_0x26f709[_0x981a('0x1e2')]/0x64;return _0x8c769f['busyFactor'](_0x164fbf,_0x3378fe,_0x3da800,_0xcc183b,_0x1fcaf6)[_0x981a('0x97')](function(_0x46b085){return _0x5e6a44(_0x46b085);});default:return _0x402d78(msgResponse(_0x981a('0x1e3'),_0x981a('0x8d'),_0x981a('0x1e4')));}}else{return _0x402d78(msgResponse(_0x981a('0x1e3'),_0x981a('0x8d'),_0x981a('0x1e5')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0x4cd201){var _0x4fa6cf=this;return function(_0x153746){return new Promise(function(_0x166e60,_0x4651e7){_['merge'](_0x4cd201,_0x153746[0x0]);if(checkGetDataPredictive(_0x153746[0x0])){loggerPredictive[_0x981a('0x47')](JSON[_0x981a('0x73')](_0x153746[0x0]));if(_0x4cd201[_0x981a('0x1d1')]===_0x981a('0x1d2')){return _0x4fa6cf['getVoiceQueueRtPauses'](_0x4cd201['id'])[_0x981a('0x97')](function(_0x3f3039){var _0x2ab00c=_0x4cd201[_0x981a('0x1e6')]-_0x3f3039[0x0][_0x981a('0x1e7')];var _0x1adc97=_0x4cd201[_0x981a('0x1cf')]*0x3c;var _0x3051e0=_0x153746[0x0][_0x981a('0x53')]+_0x153746[0x0][_0x981a('0x50')];var _0x1965ca=(_0x153746[0x0][_0x981a('0x4a')]+_0x153746[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x153746[0x0][_0x981a('0x4e')])/_0x153746[0x0][_0x981a('0x52')];var _0x593bb2=_0x4cd201['dialPredictiveOptimizationPercentage']/0x64;_0x4cd201[_0x981a('0x1e8')]=_0x3f3039[0x0][_0x981a('0x1e7')]||0x0;_0x4cd201['predictiveIntervalHitRate']=_0x1965ca>0x0?_0x1965ca:0x1;return _0x4fa6cf['abandonmentRate'](_0x2ab00c,_0x1adc97,_0x3051e0,_0x1965ca,_0x593bb2);})[_0x981a('0x97')](function(_0xb78c83){return _0x166e60(_0xb78c83);})[_0x981a('0x9b')](function(_0x524b0e){return _0x4651e7(msgResponse('[CatchErlangB]',_0x981a('0x8d'),JSON['stringify'](_0x524b0e)));});}if(_0x4cd201[_0x981a('0x1d1')]==='agentBusyFactor'){return _0x4fa6cf[_0x981a('0x157')](_0x4cd201['id'])[_0x981a('0x97')](function(_0x3d8fae){var _0x21c9db=_0x4cd201[_0x981a('0x1e6')]-_0x3d8fae[0x0][_0x981a('0x1e7')];var _0x45a1c1=_0x4cd201['dialPredictiveInterval']*0x3c;var _0x1cc28c=_0x153746[0x0][_0x981a('0x53')]+_0x153746[0x0][_0x981a('0x50')];var _0x6091b6=(_0x153746[0x0]['predictiveIntervalAnsweredCalls']+_0x153746[0x0][_0x981a('0x4c')]+_0x153746[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x153746[0x0][_0x981a('0x52')];var _0xad7e77=_0x4cd201[_0x981a('0x1e2')]/0x64;_0x4cd201[_0x981a('0x1e8')]=_0x3d8fae[0x0][_0x981a('0x1e7')]||0x0;_0x4cd201[_0x981a('0x1c8')]=_0x6091b6>0x0?_0x6091b6:0x1;return _0x4fa6cf[_0x981a('0x1e9')](_0x21c9db,_0x45a1c1,_0x1cc28c,_0x6091b6,_0xad7e77);})[_0x981a('0x97')](function(_0x2918f2){return _0x166e60(_0x2918f2);})['catch'](function(_0x129edf){return _0x4651e7(msgResponse(_0x981a('0x1ea'),_0x981a('0x8d'),JSON[_0x981a('0x73')](_0x129edf)));});}}else{return _0x4651e7(msgResponse(_0x981a('0x1e3'),_0x981a('0x8d'),'check\x20failure'));}});};};Dialer[_0x981a('0x82')][_0x981a('0x1da')]=function(_0x4dd352){var _0x79b4f5=this;return function(){var _0x489c95=0x0;var _0x155b2e=Math[_0x981a('0x1c7')](_0x4dd352[_0x981a('0x58')]*0x3e8);if(_0x155b2e>0x0){_0x155b2e=_0x155b2e<0x64?0x64:_0x155b2e;loggerPredictive[_0x981a('0x47')](_0x4dd352[_0x981a('0x44')],_0x981a('0x1eb'),_0x155b2e,'milliseconds');_0x4dd352['handlePredictive']=setInterval(function(){_0x79b4f5[_0x981a('0x1cd')](_0x4dd352);loggerPredictiveCalls[_0x981a('0x47')](_0x981a('0x1ec'),_0x489c95+=0x1);},_0x155b2e);}else{loggerPredictive[_0x981a('0x47')](_0x4dd352['name'],_0x981a('0x1ed'));}};};Dialer[_0x981a('0x82')][_0x981a('0x1ee')]=function(_0x451524,_0x323f69){var _0x2aa2d8=this;return function(_0x3f18e8){if(_['isEmpty'](_0x3f18e8)){if(_[_0x981a('0xf3')](_0x323f69[_0x981a('0x15d')])||!_0x323f69[_0x981a('0x1ef')]){if(_0x451524[_0x981a('0xab')]===_0x981a('0x9')){_0x451524[_0x981a('0x70')]=_[_0x981a('0x3d')](_0x451524[_0x981a('0x70')])?!![]:_0x451524[_0x981a('0x70')];var _0x1b6610=uuid['v4']();_0x2aa2d8[_0x981a('0x20')][_0x1b6610]=new Action(_0x451524,_0x323f69,_0x1b6610);loggerBooked[_0x981a('0x47')](_0x981a('0x1f0'),_0x1b6610,_0x981a('0x1f1'),JSON[_0x981a('0x73')](_0x451524[_0x981a('0x70')]),_0x981a('0x1f2'),_0x451524[_0x981a('0x44')]);if(_0x451524['queueStatusComplete']){_0x451524[_0x981a('0x70')]=![];_0x2aa2d8['queueBooked'][_0x2aa2d8['actions'][_0x1b6610][_0x981a('0xba')]]=[];ami[_0x981a('0x95')]({'actionid':_0x1b6610,'action':_0x981a('0x1f3'),'queue':_0x451524[_0x981a('0x44')]})[_0x981a('0x9b')](function(){_0x2aa2d8['updateOriginated'](_0x451524);hopperUtils[_0x981a('0xe7')]({'active':![],'ContactId':_0x2aa2d8[_0x981a('0x20')][_0x1b6610]['ContactId'],'ListId':_0x2aa2d8[_0x981a('0x20')][_0x1b6610]['ListId'],'VoiceQueueId':_0x2aa2d8[_0x981a('0x20')][_0x1b6610]['VoiceQueueId']||undefined,'CampaignId':_0x2aa2d8[_0x981a('0x20')][_0x1b6610][_0x981a('0xe8')]||undefined})['catch'](loggerCatch(_0x981a('0x1f4')));delete _0x2aa2d8['actions'][_0x1b6610];});}else{loggerBooked[_0x981a('0x47')](_0x981a('0x1f5'),JSON[_0x981a('0x73')](_0x451524[_0x981a('0x70')]),_0x981a('0x1f2'),_0x451524[_0x981a('0x44')]);_0x2aa2d8[_0x981a('0xbc')](_0x451524);hopperUtils[_0x981a('0xe7')]({'active':![],'ContactId':_0x2aa2d8['actions'][_0x1b6610][_0x981a('0xd9')],'ListId':_0x2aa2d8[_0x981a('0x20')][_0x1b6610][_0x981a('0xda')],'VoiceQueueId':_0x2aa2d8['actions'][_0x1b6610][_0x981a('0x104')]||undefined,'CampaignId':_0x2aa2d8[_0x981a('0x20')][_0x1b6610][_0x981a('0xe8')]||undefined})['catch'](loggerCatch(_0x981a('0x1f4')));delete _0x2aa2d8['actions'][_0x1b6610];}}else{return _0x2aa2d8[_0x981a('0x162')](_0x451524,_0x323f69);}}else{if(utils['getSeconds'](undefined,_0x323f69[_0x981a('0x1f6')])<_0x451524[_0x981a('0x1f7')]*0x3c){if(_0x323f69['Agent']&&!_0x323f69[_0x981a('0x1f8')][_0x981a('0x1f9')]){_0x2aa2d8[_0x981a('0x19')][_0x981a('0xf8')](_0x323f69['id'])[_0x981a('0xfa')](function(){_0x2aa2d8['updateOriginated'](_0x451524);});}else{hopperUtils[_0x981a('0x1fa')]({'active':![]},_0x323f69['id'],0x1)[_0x981a('0xfa')](function(){_0x2aa2d8['updateOriginated'](_0x451524);});}}else{_0x451524[_0x981a('0x1fb')]+=0x1;_0x2aa2d8[_0x981a('0xbc')](_0x451524);if(_0x451524[_0x981a('0x1fc')]){hopperUtils[_0x981a('0xe7')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x323f69[_0x981a('0xd9')],'ListId':_0x323f69[_0x981a('0xda')],'VoiceQueueId':_0x323f69[_0x981a('0x104')]||undefined,'CampaignId':_0x323f69[_0x981a('0xe8')]||undefined})[_0x981a('0x9b')](loggerCatch(_0x981a('0x1fd')));hopperUtils[_0x981a('0xc3')](createObjHistory(_0x451524,_0x323f69,utils[_0x981a('0x6b')][_0x981a('0x1fe')],0x17,_0x981a('0x1ff')))['catch'](loggerCatch(_0x981a('0x200')));}else{_0x2aa2d8['saveInDb'](createObjHistory(_0x451524,_0x323f69,utils[_0x981a('0x6b')][_0x981a('0x201')],0x16,_0x981a('0x202')),_0x981a('0x203'),_0x981a('0x204'));}}}}else{_0x451524['outboundBlacklistCallsDay']+=0x1;_0x2aa2d8[_0x981a('0x119')](createObjHistory(_0x451524,_0x323f69,utils[_0x981a('0x6b')][_0x981a('0x205')],0xd,_0x981a('0x206')),_0x981a('0x207'),_0x981a('0x208'));throw _0x981a('0x209');}};};Dialer[_0x981a('0x82')][_0x981a('0x161')]=function(_0x7cb947){var _0x45e351=this;var _0x52e604=_0x7cb947[_0x981a('0x20a')]-_0x7cb947[_0x981a('0x159')];emitCampaignSummary(_0x7cb947);if(_0x52e604>0x0&&_0x7cb947[_0x981a('0x64')]==0x0){if(_0x52e604>this[_0x981a('0x1e')]){_0x52e604=this[_0x981a('0x1e')];}_0x7cb947[_0x981a('0x64')]=0x1;hopperUtils['getContactDialerIvr'](_0x7cb947,_0x52e604)[_0x981a('0x97')](function(_0x4d1456){_0x7cb947[_0x981a('0x64')]=0x0;if(_0x4d1456){if(!utils[_0x981a('0x20b')](_0x4d1456)){_0x7cb947['message']=utils[_0x981a('0x6b')][_0x981a('0x6c')];logger[_0x981a('0x47')](_0x981a('0x20c')+_0x7cb947[_0x981a('0x44')]);}else{_0x7cb947[_0x981a('0x159')]+=_0x4d1456[_0x981a('0x93')];_0x7cb947[_0x981a('0x67')]=utils[_0x981a('0x6b')]['RUNNING'];for(var _0x13137e=0x0;_0x13137e<_0x4d1456[_0x981a('0x93')];_0x13137e+=0x1){_0x7cb947[_0x981a('0x20d')]+=0x1;if(_[_0x981a('0xf3')](_0x4d1456[_0x13137e])||_['isNil'](_0x4d1456[_0x13137e][_0x981a('0x17e')])||_[_0x981a('0xf3')](_0x4d1456[_0x13137e]['phone'])){_0x45e351[_0x981a('0x15c')](_0x981a('0x20e'),_0x7cb947,_0x4d1456[_0x13137e]);}else{hopperUtils[_0x981a('0x20f')](_[_0x981a('0x100')](_0x4d1456[_0x13137e],['CampaignId',_0x981a('0x164')]))[_0x981a('0x97')](_0x45e351[_0x981a('0x1ee')](_0x7cb947,_0x4d1456[_0x13137e]))['catch'](_0x45e351['loggerHandler'](_0x981a('0x210'),_0x7cb947));}}}}})[_0x981a('0x9b')](loggerGetContactDialer(_0x981a('0x211'),_0x7cb947,_0x52e604));}};Dialer[_0x981a('0x82')]['handlePower']=function(_0x3845a5,_0x2d3cda){var _0x3719f9=this;var _0x5525c0=[];if(_0x2d3cda<0x1||_0x3845a5[_0x981a('0xab')]===_0x981a('0x9')){_0x2d3cda=0x1;}var _0x8b7e3c=Math[_0x981a('0x1c7')](_0x3845a5[_0x981a('0x140')]*_0x2d3cda)-_0x3845a5['originated'];if(_0x3845a5[_0x981a('0x212')]>0x0){var _0x34cf9b=_0x3845a5['dialLimitQueue']-_0x3845a5['originated']-_0x3845a5[_0x981a('0x142')]-_0x3845a5[_0x981a('0x143')];if(_0x8b7e3c>_0x34cf9b){_0x8b7e3c=_0x34cf9b;}}if(_0x8b7e3c>0x0&&_0x3845a5[_0x981a('0x64')]==0x0){if(_0x3845a5['dialMethod']===_0x981a('0x9')){_0x8b7e3c=0x1;}if(_0x8b7e3c>this[_0x981a('0x1e')]){_0x8b7e3c=this['maxNumberOriginate'];}for(var _0x40e9dc in this['agents']){if(typeof this['agents'][_0x40e9dc]!==_0x981a('0xa3')){if(this[_0x981a('0x1c')][_0x40e9dc][_0x981a('0xcc')]==='not_inuse'&&this[_0x981a('0x1c')][_0x40e9dc][_0x981a('0x84')]==='reachable'){_0x5525c0[_0x981a('0x94')](this[_0x981a('0x1c')][_0x40e9dc]['id']);}}}_0x3845a5[_0x981a('0x64')]=0x1;hopperUtils['getContactDialer'](_0x3845a5,_0x5525c0,_0x8b7e3c)[_0x981a('0x97')](function(_0x24e2d1){_0x3845a5['temp']=0x0;if(_0x24e2d1){if(!utils[_0x981a('0x20b')](_0x24e2d1)){hopperUtils[_0x981a('0x213')](_0x3845a5)[_0x981a('0x97')](sendMessageReschedule(_0x3845a5))['catch'](loggerCatch(_0x981a('0x214')));}else{_0x3845a5[_0x981a('0x159')]+=_0x24e2d1['length'];_0x3845a5['message']=_0x3845a5['dialMethod']===_0x981a('0x9')?utils[_0x981a('0x6b')][_0x981a('0x144')]:utils[_0x981a('0x6b')][_0x981a('0x215')];for(var _0x2a81e9=0x0;_0x2a81e9<_0x24e2d1[_0x981a('0x93')];_0x2a81e9+=0x1){if(_[_0x981a('0xf3')](_0x24e2d1[_0x2a81e9])||_['isNil'](_0x24e2d1[_0x2a81e9][_0x981a('0x17e')])||_[_0x981a('0xf3')](_0x24e2d1[_0x2a81e9]['phone'])){_0x3719f9[_0x981a('0x15c')](_0x981a('0x20e'),_0x3845a5,_0x24e2d1[_0x2a81e9]);}else{hopperUtils['checkIsBlackList'](_[_0x981a('0x100')](_0x24e2d1[_0x2a81e9],[_0x981a('0x104'),_0x981a('0x164')]))[_0x981a('0x97')](_0x3719f9['checkContactBlack'](_0x3845a5,_0x24e2d1[_0x2a81e9]))[_0x981a('0x9b')](_0x3719f9['loggerHandler']('[actionOriginate]\x20',_0x3845a5));}}}}})[_0x981a('0x9b')](loggerGetContactDialer(_0x981a('0x216'),_0x3845a5,_0x8b7e3c));}};Dialer['prototype'][_0x981a('0x1cd')]=function(_0x4cf546){if(_0x4cf546['dialLimitQueue']>0x0){var _0x4c3f50=_0x4cf546[_0x981a('0x212')]-_0x4cf546[_0x981a('0x159')]-_0x4cf546['talking'];if(_0x4c3f50>0x0&&_0x4cf546[_0x981a('0x64')]==0x0){this['tryOriginatePredictive'](_0x4cf546);}else{loggerPredictiveCalls['info']('[handlePredictive][limitChannel]');}}else{this[_0x981a('0x217')](_0x4cf546);}};Dialer[_0x981a('0x82')][_0x981a('0x217')]=function(_0x8419d9){var _0xb5c9a7=this;var _0x145956=[];_0x8419d9[_0x981a('0x159')]+=0x1;for(var _0x2d4cfb in this[_0x981a('0x1c')]){if(typeof this[_0x981a('0x1c')][_0x2d4cfb]!==_0x981a('0xa3')){if(this['agents'][_0x2d4cfb]['state']===_0x981a('0x218')&&this[_0x981a('0x1c')][_0x2d4cfb][_0x981a('0x84')]==='reachable'){_0x145956[_0x981a('0x94')](this[_0x981a('0x1c')][_0x2d4cfb]['id']);}}}_0x8419d9[_0x981a('0x64')]=0x1;return this[_0x981a('0x219')](_0x8419d9['id'],_0x145956,0x1,_0x8419d9[_0x981a('0x21a')],_0x8419d9)[_0x981a('0x97')](function(_0x59c433){_0x8419d9['temp']=0x1;if(_0x59c433){if(!utils[_0x981a('0x20b')](_0x59c433)){utils[_0x981a('0x63')](_0x8419d9,0x1,0x0);return hopperUtils['countReScheduled'](_0x8419d9)[_0x981a('0x97')](sendMessageReschedule(_0x8419d9))[_0x981a('0x9b')](loggerCatch(_0x981a('0x214')));}else{_0x8419d9[_0x981a('0x67')]=utils[_0x981a('0x6b')][_0x981a('0x215')];if(_[_0x981a('0xf3')](_0x59c433[0x0])||_['isNil'](_0x59c433[0x0][_0x981a('0x17e')])||_[_0x981a('0xf3')](_0x59c433[0x0][_0x981a('0x164')])){_0xb5c9a7['emptyContact'](_0x981a('0x20e'),_0x8419d9,_0x59c433[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0x59c433[0x0],['VoiceQueueId',_0x981a('0x164')]))['then'](_0xb5c9a7['checkContactBlack'](_0x8419d9,_0x59c433[0x0]))['catch'](_0xb5c9a7[_0x981a('0x15b')](_0x981a('0x21b'),_0x8419d9));}}}})[_0x981a('0x9b')](loggerGetContactDialer(_0x981a('0x21c'),_0x8419d9,0x1));};Dialer[_0x981a('0x82')][_0x981a('0x1e0')]=function(_0x4a80df,_0x27d203,_0x1ab75c,_0x2d5d5c,_0x44b332,_0x2d0ada){loggerPredictive[_0x981a('0x47')]('--------\x20Drop\x20Rate\x20--------');loggerPredictive[_0x981a('0x47')](_0x981a('0x21d'),_0x4a80df);loggerPredictive[_0x981a('0x47')](_0x981a('0x21e'),_0x27d203);loggerPredictive[_0x981a('0x47')](_0x981a('0x21f'),_0x1ab75c);loggerPredictive[_0x981a('0x47')](_0x981a('0x220'),_0x2d5d5c);loggerPredictive[_0x981a('0x47')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x44b332);loggerPredictive[_0x981a('0x47')](_0x981a('0x51'));return new Promise(function(_0x426339,_0x363d6b){if(_0x4a80df<=0x0||isNaN(_0x4a80df)){return _0x363d6b(msgResponse('[abandonmentRate]',_0x981a('0x81'),'m\x20=\x20'+_0x4a80df));}if(_0x1ab75c<=0x0||isNaN(_0x1ab75c)){return _0x363d6b(msgResponse(_0x981a('0x221'),_0x981a('0x81'),_0x981a('0x222')+_0x1ab75c));}if(_0x2d5d5c<=0x0||isNaN(_0x2d5d5c)){return _0x363d6b(msgResponse(_0x981a('0x221'),'Error','p\x20=\x20'+_0x2d5d5c));}if(_0x27d203<=0x0||isNaN(_0x27d203)){return _0x363d6b(msgResponse(_0x981a('0x221'),_0x981a('0x81'),_0x981a('0x223')+_0x27d203));}if(_0x44b332<=0x0||isNaN(_0x44b332)){return _0x363d6b(msgResponse('[abandonmentRate]',_0x981a('0x81'),_0x981a('0x224')+_0x44b332));}_0x2d0ada=_0x2d0ada||0x0;var _0x3de59a=0x1/_0x1ab75c;var _0x31cca6=0x0;var _0x5f030b=0x0;var _0x5282e2=0x0;var _0x496d08=0x0;for(var _0x4ae04a=0x0;_0x5282e2<_0x44b332;_0x4ae04a+=0x1){_0x5f030b=_0x4ae04a/_0x27d203;_0x31cca6=(_0x2d5d5c*_0x5f030b+_0x2d0ada)/_0x3de59a;_0x5282e2=utils[_0x981a('0x225')](_0x31cca6,_0x4a80df);_0x496d08=_0x31cca6/_0x4a80df*(0x1-utils[_0x981a('0x225')](_0x31cca6,_0x4a80df));}return _0x426339({'erlangCalls':_0x4ae04a,'erlangCallToSecond':_0x27d203/_0x4ae04a,'erlangAbandonmentRate':_0x5282e2,'erlangBusyFactor':_0x496d08});});};Dialer[_0x981a('0x82')][_0x981a('0x1e9')]=function(_0x1a38e0,_0x1e22ee,_0x441f60,_0x1d98f6,_0x9fdb58,_0xc17331){loggerPredictive['info']('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x981a('0x47')](_0x981a('0x21d'),_0x1a38e0);loggerPredictive[_0x981a('0x47')](_0x981a('0x21e'),_0x1e22ee);loggerPredictive[_0x981a('0x47')]('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',_0x441f60);loggerPredictive['info'](_0x981a('0x220'),_0x1d98f6);loggerPredictive[_0x981a('0x47')](_0x981a('0x226'),_0x9fdb58);loggerPredictive[_0x981a('0x47')](_0x981a('0x51'));return new Promise(function(_0x8ef132,_0x3096e9){if(_0x1a38e0<=0x0||isNaN(_0x1a38e0)){return _0x3096e9(msgResponse('[busyFactor]',_0x981a('0x81'),_0x981a('0x227')+_0x1a38e0));}if(_0x441f60<=0x0||isNaN(_0x441f60)){return _0x3096e9(msgResponse('[busyFactor]',_0x981a('0x81'),_0x981a('0x222')+_0x441f60));}if(_0x1d98f6<=0x0||isNaN(_0x1d98f6)){return _0x3096e9(msgResponse(_0x981a('0x228'),'Error',_0x981a('0x229')+_0x1d98f6));}if(_0x1e22ee<=0x0||isNaN(_0x1e22ee)){return _0x3096e9(msgResponse(_0x981a('0x228'),_0x981a('0x81'),_0x981a('0x223')+_0x1e22ee));}if(_0x9fdb58<=0x0||isNaN(_0x9fdb58)){return _0x3096e9(msgResponse(_0x981a('0x228'),_0x981a('0x81'),_0x981a('0x22a')+_0x9fdb58));}_0xc17331=_0xc17331||0x0;var _0x2f9b60=0x1/_0x441f60;var _0x384f9a=0x0;var _0x57e106=0x0;var _0x3f8016=0x0;var _0x3c966b=0x0;for(var _0x50a2b2=0x0;_0x3c966b<_0x9fdb58;_0x50a2b2+=0x1){_0x57e106=_0x50a2b2/_0x1e22ee;_0x384f9a=(_0x1d98f6*_0x57e106+_0xc17331)/_0x2f9b60;_0x3f8016=utils['erlangb'](_0x384f9a,_0x1a38e0);_0x3c966b=_0x384f9a/_0x1a38e0*(0x1-utils['erlangb'](_0x384f9a,_0x1a38e0));}return _0x8ef132({'erlangCalls':_0x50a2b2,'erlangCallToSecond':_0x1e22ee/_0x50a2b2,'erlangAbandonmentRate':_0x3f8016,'erlangBusyFactor':_0x3c966b});});};module[_0x981a('0x22b')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 24fe188..cbb0d57 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaaef=['callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','\x22%s\x22\x20<%s>','dialCutDigit','substring','number','exports','lodash','moment','isNil','voiceQueue','uniqueid','name','Contact','firstName','lastName','phone','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid'];(function(_0x3a459c,_0x185992){var _0x52fecc=function(_0x1c9e64){while(--_0x1c9e64){_0x3a459c['push'](_0x3a459c['shift']());}};_0x52fecc(++_0x185992);}(_0xaaef,0x112));var _0xfaae=function(_0x40850b,_0x3c8fce){_0x40850b=_0x40850b-0x0;var _0x167c78=_0xaaef[_0x40850b];return _0x167c78;};'use strict';var util=require('util');var _=require(_0xfaae('0x0'));var moment=require(_0xfaae('0x1'));function checkNameSurname(_0x3d5f7f,_0x490193,_0x379c59){var _0x190d1d='';if(!_[_0xfaae('0x2')](_0x490193)&&'string'===typeof _0x490193){_0x190d1d+=_0x490193;}if(!_[_0xfaae('0x2')](_0x379c59)&&'string'===typeof _0x379c59){_0x190d1d+='\x20'+_0x379c59;}if(_0x190d1d!==''){return _0x190d1d;}return _0x3d5f7f;}function Action(_0x9c20f8,_0x264170,_0x346446){this[_0xfaae('0x3')]=_0x9c20f8;this[_0xfaae('0x4')]=_0x346446||undefined;this[_0xfaae('0x5')]=checkNameSurname(_0x264170[_0xfaae('0x6')]['phone'],_0x264170[_0xfaae('0x6')][_0xfaae('0x7')],_0x264170[_0xfaae('0x6')][_0xfaae('0x8')]);this['number']=_0x264170[_0xfaae('0x9')];this[_0xfaae('0xa')]=_0x9c20f8[_0xfaae('0x5')];this[_0xfaae('0xb')]=_0x264170[_0xfaae('0xb')]||![];this[_0xfaae('0xc')]=_0x9c20f8[_0xfaae('0xc')];this[_0xfaae('0xd')]=_0x9c20f8[_0xfaae('0xd')]||0x3;this[_0xfaae('0xe')]=_0x264170[_0xfaae('0xe')];this[_0xfaae('0xf')]=_0x264170[_0xfaae('0xf')];this[_0xfaae('0x10')]=_0x264170[_0xfaae('0x10')];this[_0xfaae('0x11')]=_0x264170['countnoanswerretry'];this[_0xfaae('0x12')]=_0x264170['countnosuchnumberretry'];this[_0xfaae('0x13')]=_0x264170['countdropretry'];this[_0xfaae('0x14')]=_0x264170[_0xfaae('0x14')];this['countmachineretry']=_0x264170[_0xfaae('0x15')];this[_0xfaae('0x16')]=_0x264170[_0xfaae('0x16')];this[_0xfaae('0x17')]=_0x264170['ContactId'];this[_0xfaae('0x18')]=_0x264170[_0xfaae('0x18')];this[_0xfaae('0x19')]=_0x264170[_0xfaae('0x19')];this[_0xfaae('0x1a')]=_0x264170[_0xfaae('0x1a')];this[_0xfaae('0x1b')]=_0x264170['CampaignId'];this[_0xfaae('0x1c')]=_0x264170['id'];this[_0xfaae('0x1d')]=_0x264170[_0xfaae('0x6')][_0xfaae('0x7')]||'';this['starttime']=moment()[_0xfaae('0x1e')](_0xfaae('0x1f'));this[_0xfaae('0x20')]=_0x264170[_0xfaae('0x20')];this['callbackuniqueid']=_0x264170[_0xfaae('0x21')];this[_0xfaae('0x22')]=_0x264170[_0xfaae('0x22')];this[_0xfaae('0x23')]=_0x264170[_0xfaae('0x23')];this[_0xfaae('0x24')]='';this[_0xfaae('0x25')]='';}Action[_0xfaae('0x26')]['getCaller']=function(){return util[_0xfaae('0x1e')](_0xfaae('0x27'),this[_0xfaae('0x5')],this[_0xfaae('0x3')][_0xfaae('0x28')]>0x0?this['number'][_0xfaae('0x29')](this[_0xfaae('0x3')][_0xfaae('0x28')]):this[_0xfaae('0x2a')]);};Action[_0xfaae('0x26')]['getQueue']=function(){return this['queue'];};module[_0xfaae('0x2b')]=Action; \ No newline at end of file +var _0x3d9f=['dialCutDigit','substring','prototype','getQueue','exports','lodash','moment','isNil','string','voiceQueue','uniqueid','Contact','phone','firstName','lastName','number','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>'];(function(_0x202b59,_0x460f05){var _0x4712a5=function(_0x5aac58){while(--_0x5aac58){_0x202b59['push'](_0x202b59['shift']());}};_0x4712a5(++_0x460f05);}(_0x3d9f,0x139));var _0xf3d9=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x3d9f[_0x3947c9];return _0x2e7871;};'use strict';var util=require('util');var _=require(_0xf3d9('0x0'));var moment=require(_0xf3d9('0x1'));function checkNameSurname(_0x310974,_0x12756c,_0x56eae7){var _0x4bc61f='';if(!_[_0xf3d9('0x2')](_0x12756c)&&_0xf3d9('0x3')===typeof _0x12756c){_0x4bc61f+=_0x12756c;}if(!_[_0xf3d9('0x2')](_0x56eae7)&&'string'===typeof _0x56eae7){_0x4bc61f+='\x20'+_0x56eae7;}if(_0x4bc61f!==''){return _0x4bc61f;}return _0x310974;}function Action(_0x5c220b,_0x408afe,_0x51a1a7){this[_0xf3d9('0x4')]=_0x5c220b;this[_0xf3d9('0x5')]=_0x51a1a7||undefined;this['name']=checkNameSurname(_0x408afe[_0xf3d9('0x6')][_0xf3d9('0x7')],_0x408afe[_0xf3d9('0x6')][_0xf3d9('0x8')],_0x408afe[_0xf3d9('0x6')][_0xf3d9('0x9')]);this[_0xf3d9('0xa')]=_0x408afe[_0xf3d9('0x7')];this['queue']=_0x5c220b[_0xf3d9('0xb')];this[_0xf3d9('0xc')]=_0x408afe['active']||![];this['type']=_0x5c220b[_0xf3d9('0xd')];this[_0xf3d9('0xe')]=_0x5c220b[_0xf3d9('0xe')]||0x3;this[_0xf3d9('0xf')]=_0x408afe[_0xf3d9('0xf')];this['countbusyretry']=_0x408afe[_0xf3d9('0x10')];this[_0xf3d9('0x11')]=_0x408afe['countcongestionretry'];this['countnoanswerretry']=_0x408afe['countnoanswerretry'];this[_0xf3d9('0x12')]=_0x408afe[_0xf3d9('0x12')];this[_0xf3d9('0x13')]=_0x408afe[_0xf3d9('0x13')];this['countabandonedretry']=_0x408afe['countabandonedretry'];this['countmachineretry']=_0x408afe['countmachineretry'];this[_0xf3d9('0x14')]=_0x408afe['countagentrejectretry'];this[_0xf3d9('0x15')]=_0x408afe['ContactId'];this[_0xf3d9('0x16')]=_0x408afe[_0xf3d9('0x16')];this['UserId']=_0x408afe[_0xf3d9('0x17')];this['VoiceQueueId']=_0x408afe[_0xf3d9('0x18')];this[_0xf3d9('0x19')]=_0x408afe[_0xf3d9('0x19')];this[_0xf3d9('0x1a')]=_0x408afe['id'];this[_0xf3d9('0x1b')]=_0x408afe[_0xf3d9('0x6')]['firstName']||'';this[_0xf3d9('0x1c')]=moment()[_0xf3d9('0x1d')](_0xf3d9('0x1e'));this[_0xf3d9('0x1f')]=_0x408afe['callback'];this[_0xf3d9('0x20')]=_0x408afe[_0xf3d9('0x20')];this[_0xf3d9('0x21')]=_0x408afe[_0xf3d9('0x21')];this[_0xf3d9('0x22')]=_0x408afe[_0xf3d9('0x22')];this[_0xf3d9('0x23')]='';this[_0xf3d9('0x24')]='';}Action['prototype'][_0xf3d9('0x25')]=function(){return util[_0xf3d9('0x1d')](_0xf3d9('0x26'),this[_0xf3d9('0xb')],this[_0xf3d9('0x4')][_0xf3d9('0x27')]>0x0?this['number'][_0xf3d9('0x28')](this['voiceQueue'][_0xf3d9('0x27')]):this[_0xf3d9('0xa')]);};Action[_0xf3d9('0x29')][_0xf3d9('0x2a')]=function(){return this['queue'];};module[_0xf3d9('0x2b')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 05d5b9c..863f6c9 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8186=['answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','starttime','holdtime','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridnum','number','responsetime'];(function(_0xd30fed,_0x390b94){var _0x1207b4=function(_0x2f8e28){while(--_0x2f8e28){_0xd30fed['push'](_0xd30fed['shift']());}};_0x1207b4(++_0x390b94);}(_0x8186,0x16d));var _0x6818=function(_0x211632,_0x378e2e){_0x211632=_0x211632-0x0;var _0x5a1da1=_0x8186[_0x211632];return _0x5a1da1;};'use strict';var moment=require(_0x6818('0x0'));var utils=require('../utils');function AgentComplete(_0x507895,_0x211a42){this[_0x6818('0x1')]=0x4;this[_0x6818('0x2')]=_0x6818('0x3');this[_0x6818('0x4')]=_0x507895['scheduledat'];this[_0x6818('0x5')]=_0x507895[_0x6818('0x5')];this[_0x6818('0x6')]=_0x507895[_0x6818('0x5')]===_0x6818('0x7')?_0x6818('0x8'):_0x507895[_0x6818('0x5')];this[_0x6818('0x9')]=_0x507895[_0x6818('0x9')];this['countcongestionretry']=_0x507895[_0x6818('0xa')];this[_0x6818('0xb')]=_0x507895['countnoanswerretry'];this[_0x6818('0xc')]=_0x507895[_0x6818('0x9')]+_0x507895[_0x6818('0xa')]+_0x507895['countnoanswerretry']+_0x507895[_0x6818('0xd')]+_0x507895[_0x6818('0xe')]+_0x507895[_0x6818('0xf')]+_0x507895[_0x6818('0x10')]+_0x507895[_0x6818('0x11')];this[_0x6818('0xd')]=_0x507895[_0x6818('0xd')];this['countdropretry']=_0x507895[_0x6818('0xe')];this[_0x6818('0xf')]=_0x507895['countabandonedretry'];this['countmachineretry']=_0x507895['countmachineretry'];this['countagentrejectretry']=_0x507895[_0x6818('0x11')];this[_0x6818('0x12')]=_0x211a42[_0x6818('0x12')];this['calleridname']=_0x507895['name'];this[_0x6818('0x13')]=_0x507895[_0x6818('0x14')];this['starttime']=_0x507895['starttime'];this[_0x6818('0x15')]=_0x507895[_0x6818('0x15')];this[_0x6818('0x16')]=_0x507895[_0x6818('0x16')];this[_0x6818('0x17')]=moment()[_0x6818('0x18')](_0x6818('0x19'));this[_0x6818('0x1a')]=utils[_0x6818('0x1b')](_0x507895[_0x6818('0x15')],_0x507895[_0x6818('0x1c')]);this[_0x6818('0x1d')]=utils[_0x6818('0x1b')](_0x507895[_0x6818('0x16')],_0x507895[_0x6818('0x15')]);this['talktime']=utils['getSeconds'](this[_0x6818('0x17')],_0x507895[_0x6818('0x16')]);this[_0x6818('0x8')]=_0x211a42[_0x6818('0x8')];this['membername']=_0x211a42['membername'];this[_0x6818('0x1e')]=_0x211a42[_0x6818('0x1e')];this[_0x6818('0x1f')]=_0x507895[_0x6818('0x1f')];this['callbackuniqueid']=_0x507895['callbackuniqueid'];this[_0x6818('0x20')]=_0x507895[_0x6818('0x20')];this[_0x6818('0x21')]=_0x507895[_0x6818('0x21')];this[_0x6818('0x22')]=_0x507895['ContactId'];this[_0x6818('0x23')]=_0x507895[_0x6818('0x23')];this[_0x6818('0x24')]=_0x507895[_0x6818('0x24')];this[_0x6818('0x25')]=_0x507895['VoiceQueueId'];this[_0x6818('0x26')]=_0x507895['CampaignId'];this[_0x6818('0x27')]=_0x507895[_0x6818('0x27')]||'';this['originatecalleridname']=_0x507895[_0x6818('0x28')]||'';this[_0x6818('0x29')]=_0x507895['agiafterat'];}module[_0x6818('0x2a')]=AgentComplete; \ No newline at end of file +var _0x4476=['reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','agiafterat','exports','moment','state','statedesc','Answer','type','outbound','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','number','starttime','responsetime','answertime','YYYY-MM-DD\x20HH:mm:ss','getSeconds','talktime','endtime','membername'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x4476,0x14d));var _0x6447=function(_0x49e0d4,_0x1b7d6c){_0x49e0d4=_0x49e0d4-0x0;var _0x4fe3a0=_0x4476[_0x49e0d4];return _0x4fe3a0;};'use strict';var moment=require(_0x6447('0x0'));var utils=require('../utils');function AgentComplete(_0xdc4e89,_0x197b88){this[_0x6447('0x1')]=0x4;this[_0x6447('0x2')]=_0x6447('0x3');this['scheduledat']=_0xdc4e89['scheduledat'];this[_0x6447('0x4')]=_0xdc4e89[_0x6447('0x4')];this['campaigntype']=_0xdc4e89[_0x6447('0x4')]===_0x6447('0x5')?_0x6447('0x6'):_0xdc4e89[_0x6447('0x4')];this[_0x6447('0x7')]=_0xdc4e89[_0x6447('0x7')];this[_0x6447('0x8')]=_0xdc4e89[_0x6447('0x8')];this['countnoanswerretry']=_0xdc4e89['countnoanswerretry'];this[_0x6447('0x9')]=_0xdc4e89[_0x6447('0x7')]+_0xdc4e89[_0x6447('0x8')]+_0xdc4e89[_0x6447('0xa')]+_0xdc4e89[_0x6447('0xb')]+_0xdc4e89[_0x6447('0xc')]+_0xdc4e89[_0x6447('0xd')]+_0xdc4e89[_0x6447('0xe')]+_0xdc4e89['countagentrejectretry'];this[_0x6447('0xb')]=_0xdc4e89[_0x6447('0xb')];this[_0x6447('0xc')]=_0xdc4e89[_0x6447('0xc')];this[_0x6447('0xd')]=_0xdc4e89['countabandonedretry'];this['countmachineretry']=_0xdc4e89[_0x6447('0xe')];this[_0x6447('0xf')]=_0xdc4e89[_0x6447('0xf')];this[_0x6447('0x10')]=_0x197b88[_0x6447('0x10')];this[_0x6447('0x11')]=_0xdc4e89['name'];this['calleridnum']=_0xdc4e89[_0x6447('0x12')];this['starttime']=_0xdc4e89[_0x6447('0x13')];this[_0x6447('0x14')]=_0xdc4e89['responsetime'];this[_0x6447('0x15')]=_0xdc4e89['answertime'];this['endtime']=moment()['format'](_0x6447('0x16'));this['ringtime']=utils['getSeconds'](_0xdc4e89[_0x6447('0x14')],_0xdc4e89[_0x6447('0x13')]);this['holdtime']=utils[_0x6447('0x17')](_0xdc4e89[_0x6447('0x15')],_0xdc4e89[_0x6447('0x14')]);this[_0x6447('0x18')]=utils[_0x6447('0x17')](this[_0x6447('0x19')],_0xdc4e89[_0x6447('0x15')]);this[_0x6447('0x6')]=_0x197b88['queue'];this[_0x6447('0x1a')]=_0x197b88[_0x6447('0x1a')];this[_0x6447('0x1b')]=_0x197b88['reason'];this['callback']=_0xdc4e89[_0x6447('0x1c')];this[_0x6447('0x1d')]=_0xdc4e89[_0x6447('0x1d')];this[_0x6447('0x1e')]=_0xdc4e89[_0x6447('0x1e')];this[_0x6447('0x1f')]=_0xdc4e89[_0x6447('0x1f')];this[_0x6447('0x20')]=_0xdc4e89[_0x6447('0x20')];this['ListId']=_0xdc4e89[_0x6447('0x21')];this[_0x6447('0x22')]=_0xdc4e89[_0x6447('0x22')];this[_0x6447('0x23')]=_0xdc4e89['VoiceQueueId'];this['CampaignId']=_0xdc4e89['CampaignId'];this['originatecalleridnum']=_0xdc4e89[_0x6447('0x24')]||'';this[_0x6447('0x25')]=_0xdc4e89[_0x6447('0x25')]||'';this[_0x6447('0x26')]=_0xdc4e89[_0x6447('0x26')];}module[_0x6447('0x27')]=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 42f7cd1..91fd5bb 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3846=['responsetime','endtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime'];(function(_0x270adf,_0x1daaa3){var _0x29eda9=function(_0x40afec){while(--_0x40afec){_0x270adf['push'](_0x270adf['shift']());}};_0x29eda9(++_0x1daaa3);}(_0x3846,0xa2));var _0x6384=function(_0x26393b,_0x449a84){_0x26393b=_0x26393b-0x0;var _0x57230a=_0x3846[_0x26393b];return _0x57230a;};'use strict';function Final(_0x2369fa){this[_0x6384('0x0')]=_0x2369fa['uniqueid'];this[_0x6384('0x1')]=_0x2369fa['scheduledat'];this[_0x6384('0x2')]=_0x2369fa[_0x6384('0x2')];this[_0x6384('0x3')]=_0x2369fa['type']===_0x6384('0x4')?_0x6384('0x5'):_0x2369fa[_0x6384('0x2')];this[_0x6384('0x6')]=_0x2369fa[_0x6384('0x6')];this[_0x6384('0x7')]=_0x2369fa[_0x6384('0x7')];this[_0x6384('0x8')]=_0x2369fa['countnoanswerretry'];this[_0x6384('0x9')]=_0x2369fa['countbusyretry']+_0x2369fa[_0x6384('0x7')]+_0x2369fa['countnoanswerretry']+_0x2369fa[_0x6384('0xa')]+_0x2369fa[_0x6384('0xb')]+_0x2369fa[_0x6384('0xc')]+_0x2369fa[_0x6384('0xd')]+_0x2369fa[_0x6384('0xe')];this['countnosuchnumberretry']=_0x2369fa[_0x6384('0xa')];this[_0x6384('0xb')]=_0x2369fa[_0x6384('0xb')];this[_0x6384('0xc')]=_0x2369fa['countabandonedretry'];this[_0x6384('0xd')]=_0x2369fa[_0x6384('0xd')];this[_0x6384('0xe')]=_0x2369fa['countagentrejectretry'];this[_0x6384('0x5')]=_0x2369fa['queue'];this['calleridname']=_0x2369fa[_0x6384('0xf')];this[_0x6384('0x10')]=_0x2369fa['calleridnum'];this[_0x6384('0x11')]=_0x2369fa['starttime'];this[_0x6384('0x12')]=_0x2369fa[_0x6384('0x12')];this[_0x6384('0x13')]=_0x2369fa[_0x6384('0x12')];this['ringtime']=_0x2369fa['ringtime']||0x0;this[_0x6384('0x14')]=_0x2369fa[_0x6384('0x14')]||0x0;this[_0x6384('0x15')]=_0x2369fa[_0x6384('0x15')]||0x0;this['callback']=_0x2369fa[_0x6384('0x16')];this[_0x6384('0x17')]=_0x2369fa[_0x6384('0x17')];this[_0x6384('0x18')]=_0x2369fa[_0x6384('0x18')];this[_0x6384('0x19')]=_0x2369fa['recallme'];this[_0x6384('0x1a')]=_0x2369fa[_0x6384('0x1a')];this[_0x6384('0x1b')]=_0x2369fa['ListId'];this[_0x6384('0x1c')]=_0x2369fa[_0x6384('0x1c')];this[_0x6384('0x1d')]=_0x2369fa[_0x6384('0x1d')];this[_0x6384('0x1e')]=_0x2369fa[_0x6384('0x1e')];this[_0x6384('0x1f')]=_0x2369fa[_0x6384('0x1f')]||'';this[_0x6384('0x20')]=_0x2369fa[_0x6384('0x20')]||'';this[_0x6384('0x21')]=_0x2369fa['state'];this[_0x6384('0x22')]=_0x2369fa[_0x6384('0x22')];}module[_0x6384('0x23')]=Final; \ No newline at end of file +var _0xd6bb=['calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','queue'];(function(_0x217764,_0x2ceb87){var _0x564d08=function(_0x2b4cc3){while(--_0x2b4cc3){_0x217764['push'](_0x217764['shift']());}};_0x564d08(++_0x2ceb87);}(_0xd6bb,0x82));var _0xbd6b=function(_0x2ddfd9,_0x5877d0){_0x2ddfd9=_0x2ddfd9-0x0;var _0x2668f0=_0xd6bb[_0x2ddfd9];return _0x2668f0;};'use strict';function Final(_0xbdf4c3){this[_0xbd6b('0x0')]=_0xbdf4c3['uniqueid'];this[_0xbd6b('0x1')]=_0xbdf4c3['scheduledat'];this[_0xbd6b('0x2')]=_0xbdf4c3[_0xbd6b('0x2')];this['campaigntype']=_0xbdf4c3[_0xbd6b('0x2')]===_0xbd6b('0x3')?'queue':_0xbdf4c3[_0xbd6b('0x2')];this[_0xbd6b('0x4')]=_0xbdf4c3[_0xbd6b('0x4')];this[_0xbd6b('0x5')]=_0xbdf4c3[_0xbd6b('0x5')];this[_0xbd6b('0x6')]=_0xbdf4c3['countnoanswerretry'];this[_0xbd6b('0x7')]=_0xbdf4c3[_0xbd6b('0x4')]+_0xbdf4c3[_0xbd6b('0x5')]+_0xbdf4c3[_0xbd6b('0x6')]+_0xbdf4c3['countnosuchnumberretry']+_0xbdf4c3[_0xbd6b('0x8')]+_0xbdf4c3[_0xbd6b('0x9')]+_0xbdf4c3['countmachineretry']+_0xbdf4c3[_0xbd6b('0xa')];this[_0xbd6b('0xb')]=_0xbdf4c3[_0xbd6b('0xb')];this[_0xbd6b('0x8')]=_0xbdf4c3[_0xbd6b('0x8')];this[_0xbd6b('0x9')]=_0xbdf4c3[_0xbd6b('0x9')];this['countmachineretry']=_0xbdf4c3[_0xbd6b('0xc')];this[_0xbd6b('0xa')]=_0xbdf4c3[_0xbd6b('0xa')];this[_0xbd6b('0xd')]=_0xbdf4c3[_0xbd6b('0xd')];this[_0xbd6b('0xe')]=_0xbdf4c3[_0xbd6b('0xe')];this[_0xbd6b('0xf')]=_0xbdf4c3['calleridnum'];this[_0xbd6b('0x10')]=_0xbdf4c3[_0xbd6b('0x10')];this['responsetime']=_0xbdf4c3[_0xbd6b('0x11')];this[_0xbd6b('0x12')]=_0xbdf4c3[_0xbd6b('0x11')];this[_0xbd6b('0x13')]=_0xbdf4c3[_0xbd6b('0x13')]||0x0;this[_0xbd6b('0x14')]=_0xbdf4c3[_0xbd6b('0x14')]||0x0;this[_0xbd6b('0x15')]=_0xbdf4c3[_0xbd6b('0x15')]||0x0;this['callback']=_0xbdf4c3[_0xbd6b('0x16')];this['callbackuniqueid']=_0xbdf4c3[_0xbd6b('0x17')];this[_0xbd6b('0x18')]=_0xbdf4c3[_0xbd6b('0x18')];this[_0xbd6b('0x19')]=_0xbdf4c3[_0xbd6b('0x19')];this[_0xbd6b('0x1a')]=_0xbdf4c3['ContactId'];this['ListId']=_0xbdf4c3[_0xbd6b('0x1b')];this[_0xbd6b('0x1c')]=_0xbdf4c3[_0xbd6b('0x1c')];this[_0xbd6b('0x1d')]=_0xbdf4c3[_0xbd6b('0x1d')];this[_0xbd6b('0x1e')]=_0xbdf4c3['CampaignId'];this[_0xbd6b('0x1f')]=_0xbdf4c3[_0xbd6b('0x1f')]||'';this[_0xbd6b('0x20')]=_0xbdf4c3['originatecalleridname']||'';this[_0xbd6b('0x21')]=_0xbdf4c3['state'];this[_0xbd6b('0x22')]=_0xbdf4c3['statedesc'];}module[_0xbd6b('0x23')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 93ca82d..42b0eec 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdeaf=['amd','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','name','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state','Answer','scheduledat','type','campaigntype','outbound','queue'];(function(_0x49857e,_0x140009){var _0x4bbb3a=function(_0x438217){while(--_0x438217){_0x49857e['push'](_0x49857e['shift']());}};_0x4bbb3a(++_0x140009);}(_0xdeaf,0x13f));var _0xfdea=function(_0x40ec34,_0x534096){_0x40ec34=_0x40ec34-0x0;var _0x597948=_0xdeaf[_0x40ec34];return _0x597948;};'use strict';var moment=require(_0xfdea('0x0'));var utils=require(_0xfdea('0x1'));function Hangup(_0x3e36e3,_0x1d712a){this[_0xfdea('0x2')]=0x4;this['statedesc']=_0xfdea('0x3');this['scheduledat']=_0x3e36e3[_0xfdea('0x4')];this[_0xfdea('0x5')]=_0x3e36e3['type'];this[_0xfdea('0x6')]=_0x3e36e3[_0xfdea('0x5')]===_0xfdea('0x7')?_0xfdea('0x8'):_0x3e36e3[_0xfdea('0x5')];this[_0xfdea('0x9')]=_0x3e36e3[_0xfdea('0x9')]||![];this[_0xfdea('0xa')]=_0x3e36e3[_0xfdea('0xa')];this['countcongestionretry']=_0x3e36e3[_0xfdea('0xb')];this['countnoanswerretry']=_0x3e36e3[_0xfdea('0xc')];this['countglobal']=_0x3e36e3[_0xfdea('0xa')]+_0x3e36e3[_0xfdea('0xb')]+_0x3e36e3[_0xfdea('0xc')]+_0x3e36e3['countnosuchnumberretry']+_0x3e36e3[_0xfdea('0xd')]+_0x3e36e3[_0xfdea('0xe')]+_0x3e36e3[_0xfdea('0xf')]+_0x3e36e3[_0xfdea('0x10')];this[_0xfdea('0x11')]=_0x3e36e3[_0xfdea('0x11')];this[_0xfdea('0xd')]=_0x3e36e3['countdropretry'];this[_0xfdea('0xe')]=_0x3e36e3[_0xfdea('0xe')];this[_0xfdea('0xf')]=_0x3e36e3[_0xfdea('0xf')];this[_0xfdea('0x10')]=_0x3e36e3[_0xfdea('0x10')];this[_0xfdea('0x12')]=_0x1d712a[_0xfdea('0x12')];this['calleridname']=_0x3e36e3[_0xfdea('0x13')];this['calleridnum']=_0x3e36e3[_0xfdea('0x14')];this[_0xfdea('0x15')]=_0x3e36e3[_0xfdea('0x15')];this[_0xfdea('0x16')]=_0x3e36e3[_0xfdea('0x16')];this[_0xfdea('0x17')]=moment()[_0xfdea('0x18')](_0xfdea('0x19'));this[_0xfdea('0x1a')]=utils[_0xfdea('0x1b')](_0x3e36e3[_0xfdea('0x16')],_0x3e36e3[_0xfdea('0x15')]);this['holdtime']=0x0;this[_0xfdea('0x1c')]=utils[_0xfdea('0x1b')](this['endtime'],_0x3e36e3[_0xfdea('0x16')]);this[_0xfdea('0x8')]=_0x3e36e3[_0xfdea('0x8')];this[_0xfdea('0x1d')]=_0xfdea('0x1e');this[_0xfdea('0x1f')]=_0x1d712a['cause-txt'];this[_0xfdea('0x20')]=_0x3e36e3['callback'];this[_0xfdea('0x21')]=_0x3e36e3[_0xfdea('0x21')];this[_0xfdea('0x22')]=_0x3e36e3[_0xfdea('0x22')];this[_0xfdea('0x23')]=_0x3e36e3[_0xfdea('0x23')];this['ContactId']=_0x3e36e3[_0xfdea('0x24')];this[_0xfdea('0x25')]=_0x3e36e3['ListId'];this[_0xfdea('0x26')]=_0x3e36e3[_0xfdea('0x26')];this[_0xfdea('0x27')]=_0x3e36e3['VoiceQueueId'];this[_0xfdea('0x28')]=_0x3e36e3[_0xfdea('0x28')];}module['exports']=Hangup; \ No newline at end of file +var _0x12ad=['outbound','queue','amd','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','getSeconds','endtime','IVR','cause-txt','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','exports','moment','../utils','state','statedesc','Answer','scheduledat','type','campaigntype'];(function(_0x4fca93,_0x3735e4){var _0x57a552=function(_0x1dcc04){while(--_0x1dcc04){_0x4fca93['push'](_0x4fca93['shift']());}};_0x57a552(++_0x3735e4);}(_0x12ad,0x117));var _0xd12a=function(_0xe27035,_0x1f4876){_0xe27035=_0xe27035-0x0;var _0x3745bc=_0x12ad[_0xe27035];return _0x3745bc;};'use strict';var moment=require(_0xd12a('0x0'));var utils=require(_0xd12a('0x1'));function Hangup(_0x2a6654,_0x9fbd90){this[_0xd12a('0x2')]=0x4;this[_0xd12a('0x3')]=_0xd12a('0x4');this['scheduledat']=_0x2a6654[_0xd12a('0x5')];this[_0xd12a('0x6')]=_0x2a6654[_0xd12a('0x6')];this[_0xd12a('0x7')]=_0x2a6654['type']===_0xd12a('0x8')?_0xd12a('0x9'):_0x2a6654['type'];this[_0xd12a('0xa')]=_0x2a6654[_0xd12a('0xa')]||![];this[_0xd12a('0xb')]=_0x2a6654[_0xd12a('0xb')];this[_0xd12a('0xc')]=_0x2a6654[_0xd12a('0xc')];this['countnoanswerretry']=_0x2a6654['countnoanswerretry'];this['countglobal']=_0x2a6654[_0xd12a('0xb')]+_0x2a6654[_0xd12a('0xc')]+_0x2a6654[_0xd12a('0xd')]+_0x2a6654[_0xd12a('0xe')]+_0x2a6654[_0xd12a('0xf')]+_0x2a6654[_0xd12a('0x10')]+_0x2a6654[_0xd12a('0x11')]+_0x2a6654[_0xd12a('0x12')];this[_0xd12a('0xe')]=_0x2a6654['countnosuchnumberretry'];this[_0xd12a('0xf')]=_0x2a6654[_0xd12a('0xf')];this[_0xd12a('0x10')]=_0x2a6654['countabandonedretry'];this[_0xd12a('0x11')]=_0x2a6654[_0xd12a('0x11')];this['countagentrejectretry']=_0x2a6654[_0xd12a('0x12')];this[_0xd12a('0x13')]=_0x9fbd90['uniqueid'];this[_0xd12a('0x14')]=_0x2a6654['name'];this[_0xd12a('0x15')]=_0x2a6654[_0xd12a('0x16')];this['starttime']=_0x2a6654[_0xd12a('0x17')];this['responsetime']=_0x2a6654[_0xd12a('0x18')];this['endtime']=moment()[_0xd12a('0x19')](_0xd12a('0x1a'));this[_0xd12a('0x1b')]=utils['getSeconds'](_0x2a6654[_0xd12a('0x18')],_0x2a6654['starttime']);this['holdtime']=0x0;this[_0xd12a('0x1c')]=utils[_0xd12a('0x1d')](this[_0xd12a('0x1e')],_0x2a6654[_0xd12a('0x18')]);this[_0xd12a('0x9')]=_0x2a6654[_0xd12a('0x9')];this['membername']=_0xd12a('0x1f');this['reason']=_0x9fbd90[_0xd12a('0x20')];this['callback']=_0x2a6654[_0xd12a('0x21')];this[_0xd12a('0x22')]=_0x2a6654[_0xd12a('0x22')];this['callbackat']=_0x2a6654['callbackat'];this[_0xd12a('0x23')]=_0x2a6654[_0xd12a('0x23')];this[_0xd12a('0x24')]=_0x2a6654[_0xd12a('0x24')];this['ListId']=_0x2a6654[_0xd12a('0x25')];this[_0xd12a('0x26')]=_0x2a6654['UserId'];this[_0xd12a('0x27')]=_0x2a6654[_0xd12a('0x27')];this['CampaignId']=_0x2a6654['CampaignId'];}module[_0xd12a('0x28')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 7b72293..1496d9d 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x024d=['responsetime','endtime','ringtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridname','name','number','starttime'];(function(_0x349148,_0x31eabb){var _0x2f2b0f=function(_0x44726e){while(--_0x44726e){_0x349148['push'](_0x349148['shift']());}};_0x2f2b0f(++_0x31eabb);}(_0x024d,0x184));var _0xd024=function(_0x2dfda3,_0x25ec02){_0x2dfda3=_0x2dfda3-0x0;var _0x29f92d=_0x024d[_0x2dfda3];return _0x29f92d;};'use strict';var utils=require(_0xd024('0x0'));function History(_0x1d54e7){this['uniqueid']=_0x1d54e7[_0xd024('0x1')];this[_0xd024('0x2')]=_0x1d54e7[_0xd024('0x2')]||undefined;this[_0xd024('0x3')]=_0x1d54e7[_0xd024('0x3')];this[_0xd024('0x4')]=_0x1d54e7[_0xd024('0x3')]===_0xd024('0x5')?_0xd024('0x6'):_0x1d54e7['type'];this[_0xd024('0x7')]=_0x1d54e7['countbusyretry'];this[_0xd024('0x8')]=_0x1d54e7[_0xd024('0x8')];this[_0xd024('0x9')]=_0x1d54e7[_0xd024('0x9')];this['countglobal']=_0x1d54e7['countbusyretry']+_0x1d54e7['countcongestionretry']+_0x1d54e7['countnoanswerretry']+_0x1d54e7['countnosuchnumberretry']+_0x1d54e7[_0xd024('0xa')]+_0x1d54e7[_0xd024('0xb')]+_0x1d54e7['countmachineretry']+_0x1d54e7[_0xd024('0xc')];this[_0xd024('0xd')]=_0x1d54e7[_0xd024('0xd')];this[_0xd024('0xa')]=_0x1d54e7[_0xd024('0xa')];this[_0xd024('0xb')]=_0x1d54e7[_0xd024('0xb')];this[_0xd024('0xe')]=_0x1d54e7['countmachineretry'];this[_0xd024('0xc')]=_0x1d54e7[_0xd024('0xc')];this[_0xd024('0x6')]=_0x1d54e7['queue'];this[_0xd024('0xf')]=_0x1d54e7[_0xd024('0x10')];this['calleridnum']=_0x1d54e7[_0xd024('0x11')];this[_0xd024('0x12')]=_0x1d54e7[_0xd024('0x12')];this[_0xd024('0x13')]=_0x1d54e7['responsetime'];this[_0xd024('0x14')]=_0x1d54e7[_0xd024('0x13')];this[_0xd024('0x15')]=utils[_0xd024('0x16')](_0x1d54e7['responsetime'],_0x1d54e7[_0xd024('0x12')]);this[_0xd024('0x17')]=0x0;this['talktime']=0x0;this[_0xd024('0x18')]=_0x1d54e7[_0xd024('0x18')];this[_0xd024('0x19')]=_0x1d54e7[_0xd024('0x19')];this['callbackat']=_0x1d54e7[_0xd024('0x1a')];this['recallme']=_0x1d54e7[_0xd024('0x1b')];this[_0xd024('0x1c')]=_0x1d54e7[_0xd024('0x1c')];this['ListId']=_0x1d54e7['ListId'];this[_0xd024('0x1d')]=_0x1d54e7['UserId'];this['VoiceQueueId']=_0x1d54e7[_0xd024('0x1e')];this[_0xd024('0x1f')]=_0x1d54e7[_0xd024('0x1f')];this['originatecalleridnum']=_0x1d54e7[_0xd024('0x20')]||'';this[_0xd024('0x21')]=_0x1d54e7[_0xd024('0x21')]||'';this[_0xd024('0x22')]=_0x1d54e7[_0xd024('0x22')];this['statedesc']=_0x1d54e7[_0xd024('0x23')];}module[_0xd024('0x24')]=History; \ No newline at end of file +var _0x5453=['endtime','getSeconds','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','statedesc','../utils','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry','countagentrejectretry','countdropretry','countabandonedretry','calleridname','name','starttime','responsetime'];(function(_0x3dfeb9,_0x1cc6e4){var _0x412314=function(_0x321253){while(--_0x321253){_0x3dfeb9['push'](_0x3dfeb9['shift']());}};_0x412314(++_0x1cc6e4);}(_0x5453,0x190));var _0x3545=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x5453[_0x2c91e9];return _0x13f0ff;};'use strict';var utils=require(_0x3545('0x0'));function History(_0x41ab5b){this[_0x3545('0x1')]=_0x41ab5b[_0x3545('0x1')];this[_0x3545('0x2')]=_0x41ab5b[_0x3545('0x2')]||undefined;this[_0x3545('0x3')]=_0x41ab5b[_0x3545('0x3')];this[_0x3545('0x4')]=_0x41ab5b[_0x3545('0x3')]===_0x3545('0x5')?_0x3545('0x6'):_0x41ab5b[_0x3545('0x3')];this['countbusyretry']=_0x41ab5b[_0x3545('0x7')];this[_0x3545('0x8')]=_0x41ab5b[_0x3545('0x8')];this['countnoanswerretry']=_0x41ab5b[_0x3545('0x9')];this[_0x3545('0xa')]=_0x41ab5b['countbusyretry']+_0x41ab5b['countcongestionretry']+_0x41ab5b[_0x3545('0x9')]+_0x41ab5b[_0x3545('0xb')]+_0x41ab5b['countdropretry']+_0x41ab5b['countabandonedretry']+_0x41ab5b[_0x3545('0xc')]+_0x41ab5b[_0x3545('0xd')];this[_0x3545('0xb')]=_0x41ab5b[_0x3545('0xb')];this['countdropretry']=_0x41ab5b[_0x3545('0xe')];this[_0x3545('0xf')]=_0x41ab5b[_0x3545('0xf')];this[_0x3545('0xc')]=_0x41ab5b[_0x3545('0xc')];this[_0x3545('0xd')]=_0x41ab5b[_0x3545('0xd')];this[_0x3545('0x6')]=_0x41ab5b[_0x3545('0x6')];this[_0x3545('0x10')]=_0x41ab5b[_0x3545('0x11')];this['calleridnum']=_0x41ab5b['number'];this[_0x3545('0x12')]=_0x41ab5b[_0x3545('0x12')];this[_0x3545('0x13')]=_0x41ab5b['responsetime'];this[_0x3545('0x14')]=_0x41ab5b[_0x3545('0x13')];this['ringtime']=utils[_0x3545('0x15')](_0x41ab5b[_0x3545('0x13')],_0x41ab5b[_0x3545('0x12')]);this[_0x3545('0x16')]=0x0;this['talktime']=0x0;this['callback']=_0x41ab5b[_0x3545('0x17')];this[_0x3545('0x18')]=_0x41ab5b['callbackuniqueid'];this['callbackat']=_0x41ab5b[_0x3545('0x19')];this[_0x3545('0x1a')]=_0x41ab5b['recallme'];this[_0x3545('0x1b')]=_0x41ab5b['ContactId'];this[_0x3545('0x1c')]=_0x41ab5b['ListId'];this[_0x3545('0x1d')]=_0x41ab5b[_0x3545('0x1d')];this[_0x3545('0x1e')]=_0x41ab5b[_0x3545('0x1e')];this['CampaignId']=_0x41ab5b[_0x3545('0x1f')];this[_0x3545('0x20')]=_0x41ab5b[_0x3545('0x20')]||'';this[_0x3545('0x21')]=_0x41ab5b['originatecalleridname']||'';this['state']=_0x41ab5b['state'];this[_0x3545('0x22')]=_0x41ab5b[_0x3545('0x22')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index b027fe0..588176c 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x141d=['outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype'];(function(_0x129df0,_0x2d6a1f){var _0x4e63d5=function(_0x5c2c6d){while(--_0x5c2c6d){_0x129df0['push'](_0x129df0['shift']());}};_0x4e63d5(++_0x2d6a1f);}(_0x141d,0x1be));var _0xd141=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0x141d[_0x4709c0];return _0x13348b;};'use strict';var utils=require(_0xd141('0x0'));function QueueCallerAbandon(_0x674f5c,_0x273478){this[_0xd141('0x1')]=_0x674f5c[_0xd141('0x1')];this['type']=_0x674f5c[_0xd141('0x2')];this[_0xd141('0x3')]=_0x674f5c[_0xd141('0x2')]===_0xd141('0x4')?_0xd141('0x5'):_0x674f5c[_0xd141('0x2')];this[_0xd141('0x6')]=_0x674f5c['countbusyretry'];this['countcongestionretry']=_0x674f5c[_0xd141('0x7')];this[_0xd141('0x8')]=_0x674f5c[_0xd141('0x8')];this[_0xd141('0x9')]=_0x674f5c[_0xd141('0x6')]+_0x674f5c[_0xd141('0x7')]+_0x674f5c['countnoanswerretry']+_0x674f5c[_0xd141('0xa')]+_0x674f5c[_0xd141('0xb')]+_0x674f5c[_0xd141('0xc')]+_0x674f5c[_0xd141('0xd')]+_0x674f5c[_0xd141('0xe')];this[_0xd141('0xa')]=_0x674f5c['countnosuchnumberretry'];this[_0xd141('0xb')]=_0x674f5c[_0xd141('0xb')];this['countabandonedretry']=_0x674f5c['countabandonedretry'];this[_0xd141('0xd')]=_0x674f5c['countmachineretry'];this[_0xd141('0xe')]=_0x674f5c[_0xd141('0xe')];this[_0xd141('0xf')]=_0x273478[_0xd141('0xf')];this['calleridname']=_0x674f5c[_0xd141('0x10')];this[_0xd141('0x11')]=_0x674f5c[_0xd141('0x12')];this[_0xd141('0x13')]=_0x674f5c['starttime'];this['responsetime']=_0x674f5c[_0xd141('0x14')];this[_0xd141('0x15')]=_0x674f5c[_0xd141('0x15')];this[_0xd141('0x16')]=_0x674f5c[_0xd141('0x16')];this[_0xd141('0x17')]=this[_0xd141('0x15')];this[_0xd141('0x18')]=utils[_0xd141('0x19')](_0x674f5c[_0xd141('0x14')],_0x674f5c[_0xd141('0x13')]);this[_0xd141('0x1a')]=utils[_0xd141('0x19')](this[_0xd141('0x15')],_0x674f5c['responsetime']);this[_0xd141('0x1b')]=0x0;this[_0xd141('0x5')]=_0x273478[_0xd141('0x5')];this[_0xd141('0x1c')]=_0x273478[_0xd141('0x1d')];this[_0xd141('0x1e')]=_0x273478['reason'];this['callback']=_0x674f5c[_0xd141('0x1f')];this[_0xd141('0x20')]=_0x674f5c[_0xd141('0x20')];this[_0xd141('0x21')]=_0x674f5c['callbackat'];this[_0xd141('0x22')]=_0x674f5c[_0xd141('0x22')];this[_0xd141('0x23')]=_0x674f5c[_0xd141('0x23')];this[_0xd141('0x24')]=_0x674f5c[_0xd141('0x24')];this[_0xd141('0x25')]=_0x674f5c[_0xd141('0x25')];this[_0xd141('0x26')]=_0x674f5c[_0xd141('0x26')];this[_0xd141('0x27')]=_0x674f5c['CampaignId'];this['originatecalleridnum']=_0x674f5c['originatecalleridnum']||'';this[_0xd141('0x28')]=_0x674f5c['originatecalleridname']||'';this[_0xd141('0x29')]=_0x674f5c[_0xd141('0x29')];this['state']=_0x674f5c[_0xd141('0x2a')];this[_0xd141('0x2b')]=_0x674f5c['statedesc'];}module[_0xd141('0x2c')]=QueueCallerAbandon; \ No newline at end of file +var _0x88fe=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countdropretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','dropreason','getSeconds','holdtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','../utils','scheduledat','type','campaigntype','outbound','queue'];(function(_0x5797bb,_0x309200){var _0xd54303=function(_0x4a5686){while(--_0x4a5686){_0x5797bb['push'](_0x5797bb['shift']());}};_0xd54303(++_0x309200);}(_0x88fe,0x14a));var _0xe88f=function(_0x4ac424,_0x554b5d){_0x4ac424=_0x4ac424-0x0;var _0xe1b890=_0x88fe[_0x4ac424];return _0xe1b890;};'use strict';var utils=require(_0xe88f('0x0'));function QueueCallerAbandon(_0x1065ba,_0x1bf7ab){this[_0xe88f('0x1')]=_0x1065ba['scheduledat'];this[_0xe88f('0x2')]=_0x1065ba['type'];this[_0xe88f('0x3')]=_0x1065ba[_0xe88f('0x2')]===_0xe88f('0x4')?_0xe88f('0x5'):_0x1065ba['type'];this[_0xe88f('0x6')]=_0x1065ba[_0xe88f('0x6')];this[_0xe88f('0x7')]=_0x1065ba[_0xe88f('0x7')];this[_0xe88f('0x8')]=_0x1065ba[_0xe88f('0x8')];this[_0xe88f('0x9')]=_0x1065ba['countbusyretry']+_0x1065ba[_0xe88f('0x7')]+_0x1065ba['countnoanswerretry']+_0x1065ba[_0xe88f('0xa')]+_0x1065ba['countdropretry']+_0x1065ba[_0xe88f('0xb')]+_0x1065ba[_0xe88f('0xc')]+_0x1065ba['countagentrejectretry'];this['countnosuchnumberretry']=_0x1065ba[_0xe88f('0xa')];this[_0xe88f('0xd')]=_0x1065ba[_0xe88f('0xd')];this[_0xe88f('0xb')]=_0x1065ba[_0xe88f('0xb')];this[_0xe88f('0xc')]=_0x1065ba[_0xe88f('0xc')];this[_0xe88f('0xe')]=_0x1065ba[_0xe88f('0xe')];this[_0xe88f('0xf')]=_0x1bf7ab[_0xe88f('0xf')];this[_0xe88f('0x10')]=_0x1065ba[_0xe88f('0x11')];this[_0xe88f('0x12')]=_0x1065ba[_0xe88f('0x13')];this[_0xe88f('0x14')]=_0x1065ba['starttime'];this['responsetime']=_0x1065ba[_0xe88f('0x15')];this[_0xe88f('0x16')]=_0x1065ba[_0xe88f('0x16')];this[_0xe88f('0x17')]=_0x1065ba[_0xe88f('0x17')];this['endtime']=this[_0xe88f('0x16')];this['ringtime']=utils[_0xe88f('0x18')](_0x1065ba[_0xe88f('0x15')],_0x1065ba[_0xe88f('0x14')]);this[_0xe88f('0x19')]=utils[_0xe88f('0x18')](this[_0xe88f('0x16')],_0x1065ba[_0xe88f('0x15')]);this[_0xe88f('0x1a')]=0x0;this[_0xe88f('0x5')]=_0x1bf7ab[_0xe88f('0x5')];this[_0xe88f('0x1b')]=_0x1bf7ab['connectedlinename'];this[_0xe88f('0x1c')]=_0x1bf7ab['reason'];this[_0xe88f('0x1d')]=_0x1065ba[_0xe88f('0x1d')];this[_0xe88f('0x1e')]=_0x1065ba[_0xe88f('0x1e')];this[_0xe88f('0x1f')]=_0x1065ba[_0xe88f('0x1f')];this['recallme']=_0x1065ba['recallme'];this[_0xe88f('0x20')]=_0x1065ba['ContactId'];this[_0xe88f('0x21')]=_0x1065ba['ListId'];this[_0xe88f('0x22')]=_0x1065ba['UserId'];this[_0xe88f('0x23')]=_0x1065ba[_0xe88f('0x23')];this[_0xe88f('0x24')]=_0x1065ba[_0xe88f('0x24')];this['originatecalleridnum']=_0x1065ba[_0xe88f('0x25')]||'';this[_0xe88f('0x26')]=_0x1065ba[_0xe88f('0x26')]||'';this[_0xe88f('0x27')]=_0x1065ba[_0xe88f('0x27')];this[_0xe88f('0x28')]=_0x1065ba[_0xe88f('0x28')];this[_0xe88f('0x29')]=_0x1065ba[_0xe88f('0x29')];}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 89b3a45..fa19f65 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6455=['[verifyAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory','[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','getContactDialer','dialOrderByScheduledAt','catch','temp','getContactDialerIvr','error','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','checkIsBlackList','checkIsBlackListIvr','verifyAdditionalPhones'];(function(_0x20d57c,_0x3c4206){var _0x181dc9=function(_0xcf3bc0){while(--_0xcf3bc0){_0x20d57c['push'](_0x20d57c['shift']());}};_0x181dc9(++_0x3c4206);}(_0x6455,0x97));var _0x5645=function(_0x127178,_0x354187){_0x127178=_0x127178-0x0;var _0x4cc403=_0x6455[_0x127178];return _0x4cc403;};'use strict';var util=require(_0x5645('0x0'));var logger=require('../../../../config/logger')(_0x5645('0x1'));var cmHopper=require(_0x5645('0x2'));var cmHopperAdditionalPhone=require(_0x5645('0x3'));var cmHopperBlack=require(_0x5645('0x4'));var cmHopperHistory=require(_0x5645('0x5'));function inspectError(_0x35c21e){return util['inspect'](_0x35c21e,{'showHidden':![],'depth':null});}function getContactDialer(_0x233875,_0x29cefe,_0x282ef3){return cmHopper[_0x5645('0x6')](_0x233875['id'],_0x29cefe,_0x282ef3,_0x233875[_0x5645('0x7')])[_0x5645('0x8')](function(_0xa14a06){_0x233875[_0x5645('0x9')]=0x0;logger['error']('[getContactDialer]',inspectError(_0xa14a06));});}exports[_0x5645('0x6')]=getContactDialer;function getContactDialerIvr(_0x37c03a,_0x38c07a){return cmHopper[_0x5645('0xa')](_0x37c03a['id'],_0x38c07a,_0x37c03a[_0x5645('0x7')])[_0x5645('0x8')](function(_0x587c61){_0x37c03a[_0x5645('0x9')]=0x0;logger[_0x5645('0xb')](_0x5645('0xc'),inspectError(_0x587c61));});}exports[_0x5645('0xa')]=getContactDialerIvr;function countReScheduled(_0x5a6092){return cmHopper[_0x5645('0xd')](_0x5a6092)['catch'](function(_0x42f5cd){logger[_0x5645('0xb')](_0x5645('0xe'),inspectError(_0x42f5cd));});}exports[_0x5645('0xd')]=countReScheduled;function rescheduleContact(_0x2d982f){return cmHopper[_0x5645('0xf')](_0x2d982f)[_0x5645('0x8')](function(_0x2270a1){logger['error'](_0x5645('0x10'),inspectError(_0x2270a1));});}exports[_0x5645('0xf')]=rescheduleContact;function unlockContact(_0x25863f,_0x4cbd46,_0x4b3be6){return cmHopper[_0x5645('0x11')](_0x25863f,_0x4cbd46,_0x4b3be6)[_0x5645('0x8')](function(_0x511aed){logger[_0x5645('0xb')](_0x5645('0x12'),inspectError(_0x511aed));});}exports[_0x5645('0x11')]=unlockContact;function moveContactManagedDialer(_0x5179fd){return cmHopper[_0x5645('0x13')](_0x5179fd)[_0x5645('0x8')](function(_0x22a6cf){logger[_0x5645('0xb')]('[moveContactManagedDialer]',inspectError(_0x22a6cf));});}exports[_0x5645('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x52ac46){return cmHopperBlack['checkIsBlackList'](_0x52ac46)[_0x5645('0x8')](function(_0x1e2cba){logger[_0x5645('0xb')]('[checkIsBlackList]',inspectError(_0x1e2cba));});}exports[_0x5645('0x14')]=checkIsBlackList;function checkIsBlackListIvr(_0x50ed38){return cmHopperBlack[_0x5645('0x15')](_0x50ed38)['catch'](function(_0x4f82d0){logger[_0x5645('0xb')]('[checkIsBlackListIvr]',inspectError(_0x4f82d0));});}exports[_0x5645('0x15')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x379cbd,_0x502c2e,_0x18680f){return cmHopperAdditionalPhone[_0x5645('0x16')](_0x379cbd,_0x502c2e,_0x18680f)[_0x5645('0x8')](function(_0x50fa82){logger[_0x5645('0xb')](_0x5645('0x17'),inspectError(_0x50fa82));});}exports[_0x5645('0x16')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x46b33a,_0x568fd6,_0x4bc484){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x46b33a,_0x568fd6,_0x4bc484)['catch'](function(_0x472982){logger['error']('[swapAdditionalPhone]',inspectError(_0x472982));});}exports[_0x5645('0x18')]=swapAdditionalPhones;function avgHandleTime(_0x12f43a){return cmHopperHistory[_0x5645('0x19')](_0x12f43a)[_0x5645('0x8')](function(_0x3a5c61){logger[_0x5645('0xb')](_0x5645('0x1a'),inspectError(_0x3a5c61));});}exports[_0x5645('0x19')]=avgHandleTime;function createHistory(_0x4493e6){return cmHopperHistory[_0x5645('0x1b')](_0x4493e6)[_0x5645('0x8')](function(_0x2154a7){logger[_0x5645('0xb')](_0x5645('0x1c'),inspectError(_0x2154a7));});}exports['createHistory']=createHistory; \ No newline at end of file +var _0x5fdc=['dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','[getContactDialer]','temp','error','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','unlockContact','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[verifyAdditionalPhone]','[swapAdditionalPhone]','swapAdditionalPhones','[avgHandleTime]','avgHandleTime','[createHistory]','createHistory','util','../../../../config/logger'];(function(_0x380e87,_0x575674){var _0xe77efe=function(_0x8b4290){while(--_0x8b4290){_0x380e87['push'](_0x380e87['shift']());}};_0xe77efe(++_0x575674);}(_0x5fdc,0x127));var _0xc5fd=function(_0x54b641,_0x39e641){_0x54b641=_0x54b641-0x0;var _0xb071d7=_0x5fdc[_0x54b641];return _0xb071d7;};'use strict';var util=require(_0xc5fd('0x0'));var logger=require(_0xc5fd('0x1'))(_0xc5fd('0x2'));var cmHopper=require(_0xc5fd('0x3'));var cmHopperAdditionalPhone=require(_0xc5fd('0x4'));var cmHopperBlack=require(_0xc5fd('0x5'));var cmHopperHistory=require(_0xc5fd('0x6'));function inspectError(_0x4d015c){return util[_0xc5fd('0x7')](_0x4d015c,{'showHidden':![],'depth':null});}function getContactDialer(_0x1b6205,_0xca27a0,_0xea5748){return cmHopper[_0xc5fd('0x8')](_0x1b6205['id'],_0xca27a0,_0xea5748,_0x1b6205[_0xc5fd('0x9')])[_0xc5fd('0xa')](function(_0x5a2eb4){_0x1b6205['temp']=0x0;logger['error'](_0xc5fd('0xb'),inspectError(_0x5a2eb4));});}exports[_0xc5fd('0x8')]=getContactDialer;function getContactDialerIvr(_0x158e58,_0x45c91f){return cmHopper['getContactDialerIvr'](_0x158e58['id'],_0x45c91f,_0x158e58['dialOrderByScheduledAt'])[_0xc5fd('0xa')](function(_0x1edeec){_0x158e58[_0xc5fd('0xc')]=0x0;logger[_0xc5fd('0xd')](_0xc5fd('0xe'),inspectError(_0x1edeec));});}exports[_0xc5fd('0xf')]=getContactDialerIvr;function countReScheduled(_0x484bbd){return cmHopper[_0xc5fd('0x10')](_0x484bbd)['catch'](function(_0x558939){logger[_0xc5fd('0xd')](_0xc5fd('0x11'),inspectError(_0x558939));});}exports[_0xc5fd('0x10')]=countReScheduled;function rescheduleContact(_0x23ac5d){return cmHopper[_0xc5fd('0x12')](_0x23ac5d)[_0xc5fd('0xa')](function(_0x27447e){logger[_0xc5fd('0xd')]('[rescheduleContact]',inspectError(_0x27447e));});}exports[_0xc5fd('0x12')]=rescheduleContact;function unlockContact(_0x103c3d,_0x2221da,_0x3404e0){return cmHopper['unlockContact'](_0x103c3d,_0x2221da,_0x3404e0)['catch'](function(_0x4efafd){logger['error']('[unlockContact]',inspectError(_0x4efafd));});}exports[_0xc5fd('0x13')]=unlockContact;function moveContactManagedDialer(_0x430e52){return cmHopper[_0xc5fd('0x14')](_0x430e52)[_0xc5fd('0xa')](function(_0x2ee392){logger[_0xc5fd('0xd')](_0xc5fd('0x15'),inspectError(_0x2ee392));});}exports['moveContactManagedDialer']=moveContactManagedDialer;function checkIsBlackList(_0xb7bab1){return cmHopperBlack[_0xc5fd('0x16')](_0xb7bab1)[_0xc5fd('0xa')](function(_0x9c12e4){logger[_0xc5fd('0xd')]('[checkIsBlackList]',inspectError(_0x9c12e4));});}exports[_0xc5fd('0x16')]=checkIsBlackList;function checkIsBlackListIvr(_0x24e5e9){return cmHopperBlack[_0xc5fd('0x17')](_0x24e5e9)[_0xc5fd('0xa')](function(_0x5a7bdc){logger['error'](_0xc5fd('0x18'),inspectError(_0x5a7bdc));});}exports[_0xc5fd('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x3d7211,_0x42d7f4,_0x334401){return cmHopperAdditionalPhone[_0xc5fd('0x19')](_0x3d7211,_0x42d7f4,_0x334401)['catch'](function(_0x1a3f21){logger[_0xc5fd('0xd')](_0xc5fd('0x1a'),inspectError(_0x1a3f21));});}exports[_0xc5fd('0x19')]=verifyAdditionalPhones;function swapAdditionalPhones(_0x39bb5e,_0x4020af,_0x475b91){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0x39bb5e,_0x4020af,_0x475b91)[_0xc5fd('0xa')](function(_0x48cd1d){logger[_0xc5fd('0xd')](_0xc5fd('0x1b'),inspectError(_0x48cd1d));});}exports[_0xc5fd('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x2bee22){return cmHopperHistory['avgHandleTime'](_0x2bee22)[_0xc5fd('0xa')](function(_0x1bbdc4){logger[_0xc5fd('0xd')](_0xc5fd('0x1d'),inspectError(_0x1bbdc4));});}exports[_0xc5fd('0x1e')]=avgHandleTime;function createHistory(_0x209975){return cmHopperHistory['createHistory'](_0x209975)[_0xc5fd('0xa')](function(_0x5d4f70){logger['error'](_0xc5fd('0x1f'),inspectError(_0x5d4f70));});}exports[_0xc5fd('0x20')]=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 58ce0fe..e912569 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2672=['toUpperCase','substring','setXMDContactVariables','util','../../../../config/logger','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','DEACTIVATED','IS_DISACTIVED','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','INTERVAL_IS_NULL','GLOBAL_INTERVAL_IS_OVERTIME','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','isPreviewCampaign','type','ivr','outbound','isOutboundQueue','active','isIVRCampaignActive','milliseconds','diff','seconds','getSeconds','dialMethod','dialActive','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','Interval','Intervals','NULL_INTERVAL','isEmpty','dialGlobalInterval','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','status','TrunkBackup','includes','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','random','toString','getCallerIdRandom','error','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','tags','undefined','description','XMD-'];(function(_0xdac13f,_0x4cb23d){var _0x4e7584=function(_0x3f3b92){while(--_0x3f3b92){_0xdac13f['push'](_0xdac13f['shift']());}};_0x4e7584(++_0x4cb23d);}(_0x2672,0x10b));var _0x2267=function(_0x20df65,_0x18c4d3){_0x20df65=_0x20df65-0x0;var _0x42506b=_0x2672[_0x20df65];return _0x42506b;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0x2267('0x0'));var logger=require(_0x2267('0x1'))('dialer');var timezones=require(_0x2267('0x2'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0x2267('0x3'),'BLACKLIST':_0x2267('0x4'),'CONTACTS_RESCHEDULED':_0x2267('0x5'),'DEACTIVATED':_0x2267('0x6'),'DISACTIVED':_0x2267('0x7'),'EMPTY_INTERVAL':_0x2267('0x8'),'INACTIVE':_0x2267('0x9'),'NO_AGENTS_LOGGED':_0x2267('0xa'),'NO_AVAILABLE_CONTACTS':'AVAILABLE_CONTACTS_FINISHED','NULL_INTERVAL':_0x2267('0xb'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0x2267('0xc'),'QUEUE_RECALL':'RECALLINQUEUE','RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x2267('0xd'),'UNKNOWN_TIMEZONE':_0x2267('0xe'),'UNREACHABLE_TRUNK':_0x2267('0xf')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x49f4c2){return _0x49f4c2['dialMethod']==='preview';}exports[_0x2267('0x10')]=isPreviewCampaign;function isIVRCampaign(_0x30c49c){return _0x30c49c[_0x2267('0x11')]===_0x2267('0x12');}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x1b87cd){return _0x1b87cd[_0x2267('0x11')]===_0x2267('0x13');}exports[_0x2267('0x14')]=isOutboundQueue;function isQueueCampaignActive(_0x511e79){return _0x511e79['dialActive'];}exports['isQueueCampaignActive']=isQueueCampaignActive;function isIVRCampaignActive(_0xe310ac){return _0xe310ac[_0x2267('0x15')];}exports[_0x2267('0x16')]=isIVRCampaignActive;function getSeconds(_0x3ba0d7,_0x20ae4f){var _0x17e011=moment(_0x3ba0d7)[_0x2267('0x17')](0x0);var _0x4a68f6=moment(_0x20ae4f)[_0x2267('0x17')](0x0);return _0x17e011[_0x2267('0x18')](_0x4a68f6,_0x2267('0x19'));}exports[_0x2267('0x1a')]=getSeconds;function hasQueueCampaignDataChanged(_0x325da7,_0x4d9703){var _0x130b7d=![];var _0x57d8cc=_0x325da7[_0x2267('0x1b')]!==_0x4d9703[_0x2267('0x1b')]||_0x325da7[_0x2267('0x1c')]!==_0x4d9703[_0x2267('0x1c')]||_0x325da7['message']!==_0x4d9703[_0x2267('0x1d')];var _0x1cf334=_0x325da7[_0x2267('0x1e')]!==_0x4d9703[_0x2267('0x1e')]||_0x325da7[_0x2267('0x1f')]!==_0x4d9703['loggedIn']||_0x325da7[_0x2267('0x20')]!==_0x4d9703[_0x2267('0x20')]||_0x325da7['paused']!==_0x4d9703[_0x2267('0x21')]||_0x325da7['talking']!==_0x4d9703[_0x2267('0x22')]||_0x325da7['pTalking']!==_0x4d9703[_0x2267('0x23')]||_0x325da7[_0x2267('0x24')]!==_0x4d9703[_0x2267('0x24')]||_0x325da7['inUse']!==_0x4d9703[_0x2267('0x25')]||_0x325da7[_0x2267('0x26')]!==_0x4d9703[_0x2267('0x26')];if(_0x325da7[_0x2267('0x27')]&&_0x4d9703['Trunk']){_0x130b7d=_0x325da7['Trunk'][_0x2267('0x28')]!==_0x4d9703[_0x2267('0x27')]['name']||_0x325da7[_0x2267('0x27')][_0x2267('0x15')]!==_0x4d9703[_0x2267('0x27')][_0x2267('0x15')];}return _0x57d8cc||_0x1cf334||_0x130b7d;}exports[_0x2267('0x29')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x207cb0){var _0x48deb4=null;var _0x4ce025=_0x207cb0[_0x2267('0x2a')];if(_['isNil'](_0x207cb0['dialGlobalInterval'])||_[_0x2267('0x2b')](_0x207cb0['Interval'])||_[_0x2267('0x2b')](_0x207cb0[_0x2267('0x2c')][_0x2267('0x2d')])){_0x48deb4=CAMPAIGN_STATUS[_0x2267('0x2e')];}else if(_[_0x2267('0x2f')](_0x207cb0[_0x2267('0x30')])||_[_0x2267('0x2f')](_0x207cb0['Interval']['Intervals'])){_0x48deb4=CAMPAIGN_STATUS[_0x2267('0x31')];}else if(_0x4ce025&&!timezones[_0x4ce025]){_0x48deb4=CAMPAIGN_STATUS[_0x2267('0x32')];}return _0x48deb4;}function checkAnyValidTrunk(_0x4f975e,_0x21eb1e){var _0x403d84=null;var _0x2d9cc5='SIP/';var _0x35ff8a=[_0x2267('0x33'),'unmonitored'];var _0x506976=!![];if(_0x4f975e['Trunk']&&_0x4f975e[_0x2267('0x27')][_0x2267('0x15')]){_0x2d9cc5+=_0x4f975e['Trunk'][_0x2267('0x28')];_0x403d84=_0x21eb1e[_0x2d9cc5];_0x506976=_0x35ff8a['includes'](_0x403d84[_0x2267('0x34')]);}else if(_0x4f975e[_0x2267('0x35')]&&_0x4f975e[_0x2267('0x35')][_0x2267('0x15')]){_0x2d9cc5+=_0x4f975e[_0x2267('0x35')][_0x2267('0x28')];_0x403d84=_0x21eb1e[_0x2d9cc5];_0x506976=_0x35ff8a[_0x2267('0x36')](_0x403d84[_0x2267('0x34')]);}return _0x506976;}function getQueueCampaignStatusMessage(_0x6051b2,_0x19bd1c){var _0x112779=CAMPAIGN_STATUS[_0x2267('0x3')];var _0x328202=isPreviewCampaign(_0x6051b2);if(!isQueueCampaignActive(_0x6051b2)){if(_0x328202){_0x112779=CAMPAIGN_STATUS[_0x2267('0x37')];}else{if(_0x6051b2[_0x2267('0x26')]===0x0&&_0x6051b2[_0x2267('0x22')]===0x0&&_0x6051b2[_0x2267('0x24')]===0x0&&(_0x6051b2[_0x2267('0x23')]||0x0)===0x0){_0x112779=CAMPAIGN_STATUS['INACTIVE'];}else{_0x112779=CAMPAIGN_STATUS[_0x2267('0x38')];}}}else if(_0x6051b2[_0x2267('0x1f')]===0x0){_0x112779=CAMPAIGN_STATUS[_0x2267('0x39')];}else if(!checkAnyValidTrunk(_0x6051b2,_0x19bd1c)){_0x112779=CAMPAIGN_STATUS[_0x2267('0x3a')];}else if(!isPreviewCampaign(_0x6051b2)){var _0x1af985=checkAnyValidQueueCampaignInterval(_0x6051b2);if(_0x1af985){_0x112779=_0x1af985;}}return _0x112779;}exports[_0x2267('0x3b')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3fd39c){var _0xe192fb=CAMPAIGN_STATUS[_0x2267('0x38')];if(_0x3fd39c[_0x2267('0x26')]===0x0&&_0x3fd39c[_0x2267('0x22')]===0x0&&_0x3fd39c['waiting']===0x0&&(_0x3fd39c[_0x2267('0x23')]||0x0)===0x0){_0xe192fb=CAMPAIGN_STATUS[_0x2267('0x37')];}return _0xe192fb;}exports[_0x2267('0x3c')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x324808){var _0x4886a8=_0x324808[_0x2267('0x3d')](/"(.*?)"/);return _0x4886a8?_0x4886a8[0x1]:_0x324808;}exports[_0x2267('0x3e')]=extractCalleridName;function getCallerId(_0x4673bc,_0x3fa9ca,_0x27e41d){if(!_[_0x2267('0x3f')](_0x27e41d)&&typeof _0x27e41d===_0x2267('0x40')&&!_[_0x2267('0x2f')](_0x27e41d)){if(!_[_0x2267('0x3f')](_0x3fa9ca)&&typeof _0x3fa9ca==='string'&&!_[_0x2267('0x2f')](_0x3fa9ca)){return util[_0x2267('0x41')](_0x2267('0x42'),_0x3fa9ca,_0x27e41d);}return util[_0x2267('0x41')]('\x22%s\x22\x20<%s>',_0x27e41d,_0x27e41d);}if(!_[_0x2267('0x3f')](_0x4673bc)&&typeof _0x4673bc===_0x2267('0x40')&&!_[_0x2267('0x2f')](_0x4673bc)){return _0x4673bc;}return _0x2267('0x43');}exports[_0x2267('0x44')]=getCallerId;function getCallerIdRandom(_0x29357c,_0xbe52c3){var _0x5d6017;var _0x2b2239;var _0x1239ed;if(_0xbe52c3<=0x0){_0xbe52c3=0x1;}_0x5d6017=new RegExp(_0x2267('0x45')+_0xbe52c3+'}$');_0x2b2239=Math[_0x2267('0x46')](0xa,_0xbe52c3-0x1);_0x1239ed=Math[_0x2267('0x46')](0xa,_0xbe52c3)-0x1;return util['format']('%s',_['replace'](_0x29357c,_0x5d6017,_[_0x2267('0x47')](_0x2b2239,_0x1239ed)[_0x2267('0x48')]()));}exports[_0x2267('0x49')]=getCallerIdRandom;function decrementOriginate(_0x23cc37){if(_0x23cc37[_0x2267('0x26')]&&_0x23cc37['originated']>0x0){_0x23cc37[_0x2267('0x26')]-=0x1;}else{logger[_0x2267('0x4a')](_0x2267('0x4b'));}}exports[_0x2267('0x4c')]=decrementOriginate;function checkContactEmpty(_0x2e36de){return _0x2e36de&&_0x2e36de[_0x2267('0x4d')]>0x0;}exports[_0x2267('0x4e')]=checkContactEmpty;function erlangb(_0x465e2c,_0x5180d2){if(_0x5180d2===0x0){return 0x0;}var _0x37c079=0x1;for(var _0x51a98c=0x1;_0x51a98c<=_0x5180d2;_0x51a98c+=0x1){_0x37c079=0x1+_0x37c079*_0x51a98c/_0x465e2c;}return 0x1/_0x37c079;}exports[_0x2267('0x4f')]=erlangb;function checkContactLowerLimitOriginate(_0x317f35,_0x3c2f22,_0x324852){if(_0x3c2f22>_0x324852){for(var _0x256dcf=0x0;_0x256dcf<_0x3c2f22-_0x324852;_0x256dcf+=0x1){decrementOriginate(_0x317f35);}}}exports[_0x2267('0x50')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x21d7f5){var _0x3373e3={};var _0x172da4=['id','createdAt',_0x2267('0x51'),'updatedAt'];const _0x560f41=0xfa;if(_0x21d7f5){for(var _0x34a9b2 in _0x21d7f5){if(typeof _0x21d7f5[_0x34a9b2]!==_0x2267('0x52')){if(!_[_0x2267('0x2b')](_0x21d7f5[_0x34a9b2])&&!_0x172da4[_0x2267('0x36')](_0x34a9b2)){if(_0x34a9b2===_0x2267('0x53')&&_0x21d7f5[_0x34a9b2][_0x2267('0x4d')]>_0x560f41){_0x3373e3[_0x2267('0x54')+_0x34a9b2[_0x2267('0x55')]()]=_0x21d7f5[_0x34a9b2]['toString']()[_0x2267('0x56')](0x0,_0x560f41);}else{_0x3373e3[_0x2267('0x54')+_0x34a9b2[_0x2267('0x55')]()]=_0x21d7f5[_0x34a9b2];}}}}}return _0x3373e3;}exports[_0x2267('0x57')]=setXMDContactVariables; \ No newline at end of file +var _0x0889=['preview','isPreviewCampaign','type','ivr','isIVRCampaign','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','Intervals','NULL_INTERVAL','isEmpty','EMPTY_INTERVAL','SIP/','reachable','unmonitored','status','TrunkBackup','includes','INACTIVE','originated','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','extractCalleridName','isUndefined','string','\x22%s\x22\x20<%s>','format','getCallerId','\x5cw{0,','pow','replace','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','createdAt','tags','undefined','description','toUpperCase','substring','XMD-','lodash','util','dialer','../../../../config/environment/shared','timezones','BLACKLIST','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','RECALLINQUEUE','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod'];(function(_0x25167e,_0x489eca){var _0x3cf117=function(_0x343fe2){while(--_0x343fe2){_0x25167e['push'](_0x25167e['shift']());}};_0x3cf117(++_0x489eca);}(_0x0889,0x1f4));var _0x9088=function(_0x57888a,_0x344b64){_0x57888a=_0x57888a-0x0;var _0x444721=_0x0889[_0x57888a];return _0x444721;};'use strict';var _=require(_0x9088('0x0'));var moment=require('moment');var util=require(_0x9088('0x1'));var logger=require('../../../../config/logger')(_0x9088('0x2'));var timezones=require(_0x9088('0x3'))[_0x9088('0x4')];var CAMPAIGN_STATUS={'ACTIVE':'ACTIVE','BLACKLIST':_0x9088('0x5'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':'DEACTIVATED','DISACTIVED':_0x9088('0x6'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0x9088('0x7'),'NO_AGENTS_LOGGED':_0x9088('0x8'),'NO_AVAILABLE_CONTACTS':_0x9088('0x9'),'NULL_INTERVAL':_0x9088('0xa'),'OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0x9088('0xb'),'RECALL_TIMEOUT':'RECALLFAILEDTIMEOUT','RUNNING':_0x9088('0xc'),'UNKNOWN_TIMEZONE':_0x9088('0xd'),'UNREACHABLE_TRUNK':_0x9088('0xe')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x415db8){return _0x415db8[_0x9088('0xf')]===_0x9088('0x10');}exports[_0x9088('0x11')]=isPreviewCampaign;function isIVRCampaign(_0x1736cb){return _0x1736cb[_0x9088('0x12')]===_0x9088('0x13');}exports[_0x9088('0x14')]=isIVRCampaign;function isOutboundQueue(_0xcc61c3){return _0xcc61c3[_0x9088('0x12')]===_0x9088('0x15');}exports[_0x9088('0x16')]=isOutboundQueue;function isQueueCampaignActive(_0x289733){return _0x289733[_0x9088('0x17')];}exports[_0x9088('0x18')]=isQueueCampaignActive;function isIVRCampaignActive(_0x35aee3){return _0x35aee3[_0x9088('0x19')];}exports[_0x9088('0x1a')]=isIVRCampaignActive;function getSeconds(_0xf2f47a,_0xdb838b){var _0x48b83f=moment(_0xf2f47a)[_0x9088('0x1b')](0x0);var _0x184d85=moment(_0xdb838b)[_0x9088('0x1b')](0x0);return _0x48b83f['diff'](_0x184d85,_0x9088('0x1c'));}exports['getSeconds']=getSeconds;function hasQueueCampaignDataChanged(_0x4b6093,_0x1fd488){var _0x16e2b0=![];var _0x42eca4=_0x4b6093[_0x9088('0xf')]!==_0x1fd488[_0x9088('0xf')]||_0x4b6093[_0x9088('0x17')]!==_0x1fd488[_0x9088('0x17')]||_0x4b6093[_0x9088('0x1d')]!==_0x1fd488[_0x9088('0x1d')];var _0x4d2a78=_0x4b6093[_0x9088('0x1e')]!==_0x1fd488[_0x9088('0x1e')]||_0x4b6093[_0x9088('0x1f')]!==_0x1fd488[_0x9088('0x1f')]||_0x4b6093[_0x9088('0x20')]!==_0x1fd488['loggedInDb']||_0x4b6093[_0x9088('0x21')]!==_0x1fd488[_0x9088('0x21')]||_0x4b6093[_0x9088('0x22')]!==_0x1fd488[_0x9088('0x22')]||_0x4b6093[_0x9088('0x23')]!==_0x1fd488['pTalking']||_0x4b6093[_0x9088('0x24')]!==_0x1fd488[_0x9088('0x24')]||_0x4b6093[_0x9088('0x25')]!==_0x1fd488[_0x9088('0x25')]||_0x4b6093['originated']!==_0x1fd488['originated'];if(_0x4b6093[_0x9088('0x26')]&&_0x1fd488[_0x9088('0x26')]){_0x16e2b0=_0x4b6093['Trunk'][_0x9088('0x27')]!==_0x1fd488['Trunk'][_0x9088('0x27')]||_0x4b6093[_0x9088('0x26')]['active']!==_0x1fd488[_0x9088('0x26')][_0x9088('0x19')];}return _0x42eca4||_0x4d2a78||_0x16e2b0;}exports[_0x9088('0x28')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x20fb6d){var _0x38d781=null;var _0x13afc5=_0x20fb6d[_0x9088('0x29')];if(_[_0x9088('0x2a')](_0x20fb6d[_0x9088('0x2b')])||_[_0x9088('0x2a')](_0x20fb6d[_0x9088('0x2c')])||_['isNil'](_0x20fb6d[_0x9088('0x2c')][_0x9088('0x2d')])){_0x38d781=CAMPAIGN_STATUS[_0x9088('0x2e')];}else if(_['isEmpty'](_0x20fb6d[_0x9088('0x2b')])||_[_0x9088('0x2f')](_0x20fb6d[_0x9088('0x2c')][_0x9088('0x2d')])){_0x38d781=CAMPAIGN_STATUS[_0x9088('0x30')];}else if(_0x13afc5&&!timezones[_0x13afc5]){_0x38d781=CAMPAIGN_STATUS['UNKNOWN_TIMEZONE'];}return _0x38d781;}function checkAnyValidTrunk(_0x263c88,_0x3ddf2e){var _0x4eea78=null;var _0x443260=_0x9088('0x31');var _0x3385dd=[_0x9088('0x32'),_0x9088('0x33')];var _0x1398d3=!![];if(_0x263c88[_0x9088('0x26')]&&_0x263c88[_0x9088('0x26')][_0x9088('0x19')]){_0x443260+=_0x263c88['Trunk'][_0x9088('0x27')];_0x4eea78=_0x3ddf2e[_0x443260];_0x1398d3=_0x3385dd['includes'](_0x4eea78[_0x9088('0x34')]);}else if(_0x263c88[_0x9088('0x35')]&&_0x263c88[_0x9088('0x35')][_0x9088('0x19')]){_0x443260+=_0x263c88[_0x9088('0x35')][_0x9088('0x27')];_0x4eea78=_0x3ddf2e[_0x443260];_0x1398d3=_0x3385dd[_0x9088('0x36')](_0x4eea78['status']);}return _0x1398d3;}function getQueueCampaignStatusMessage(_0x2a24e6,_0xee24c4){var _0x572ae8=CAMPAIGN_STATUS['ACTIVE'];var _0x312f51=isPreviewCampaign(_0x2a24e6);if(!isQueueCampaignActive(_0x2a24e6)){if(_0x312f51){_0x572ae8=CAMPAIGN_STATUS[_0x9088('0x37')];}else{if(_0x2a24e6[_0x9088('0x38')]===0x0&&_0x2a24e6[_0x9088('0x22')]===0x0&&_0x2a24e6[_0x9088('0x24')]===0x0&&(_0x2a24e6[_0x9088('0x23')]||0x0)===0x0){_0x572ae8=CAMPAIGN_STATUS['INACTIVE'];}else{_0x572ae8=CAMPAIGN_STATUS[_0x9088('0x39')];}}}else if(_0x2a24e6[_0x9088('0x1f')]===0x0){_0x572ae8=CAMPAIGN_STATUS[_0x9088('0x3a')];}else if(!checkAnyValidTrunk(_0x2a24e6,_0xee24c4)){_0x572ae8=CAMPAIGN_STATUS[_0x9088('0x3b')];}else if(!isPreviewCampaign(_0x2a24e6)){var _0x4b0c5c=checkAnyValidQueueCampaignInterval(_0x2a24e6);if(_0x4b0c5c){_0x572ae8=_0x4b0c5c;}}return _0x572ae8;}exports[_0x9088('0x3c')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x314cc8){var _0x517fef=CAMPAIGN_STATUS[_0x9088('0x39')];if(_0x314cc8[_0x9088('0x38')]===0x0&&_0x314cc8[_0x9088('0x22')]===0x0&&_0x314cc8[_0x9088('0x24')]===0x0&&(_0x314cc8[_0x9088('0x23')]||0x0)===0x0){_0x517fef=CAMPAIGN_STATUS[_0x9088('0x37')];}return _0x517fef;}exports[_0x9088('0x3d')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2a2104){var _0x1be35a=_0x2a2104['match'](/"(.*?)"/);return _0x1be35a?_0x1be35a[0x1]:_0x2a2104;}exports[_0x9088('0x3e')]=extractCalleridName;function getCallerId(_0x20d9e5,_0x4e9aa9,_0x9ab172){if(!_[_0x9088('0x3f')](_0x9ab172)&&typeof _0x9ab172===_0x9088('0x40')&&!_[_0x9088('0x2f')](_0x9ab172)){if(!_[_0x9088('0x3f')](_0x4e9aa9)&&typeof _0x4e9aa9===_0x9088('0x40')&&!_[_0x9088('0x2f')](_0x4e9aa9)){return util['format'](_0x9088('0x41'),_0x4e9aa9,_0x9ab172);}return util[_0x9088('0x42')]('\x22%s\x22\x20<%s>',_0x9ab172,_0x9ab172);}if(!_[_0x9088('0x3f')](_0x20d9e5)&&typeof _0x20d9e5===_0x9088('0x40')&&!_[_0x9088('0x2f')](_0x20d9e5)){return _0x20d9e5;}return'\x22\x22\x20<>';}exports[_0x9088('0x43')]=getCallerId;function getCallerIdRandom(_0x3df8d5,_0x1df97d){var _0xb5190a;var _0x507f5a;var _0x16b915;if(_0x1df97d<=0x0){_0x1df97d=0x1;}_0xb5190a=new RegExp(_0x9088('0x44')+_0x1df97d+'}$');_0x507f5a=Math[_0x9088('0x45')](0xa,_0x1df97d-0x1);_0x16b915=Math['pow'](0xa,_0x1df97d)-0x1;return util[_0x9088('0x42')]('%s',_[_0x9088('0x46')](_0x3df8d5,_0xb5190a,_['random'](_0x507f5a,_0x16b915)[_0x9088('0x47')]()));}exports[_0x9088('0x48')]=getCallerIdRandom;function decrementOriginate(_0x5e4db2){if(_0x5e4db2[_0x9088('0x38')]&&_0x5e4db2[_0x9088('0x38')]>0x0){_0x5e4db2[_0x9088('0x38')]-=0x1;}else{logger['error'](_0x9088('0x49'));}}exports[_0x9088('0x4a')]=decrementOriginate;function checkContactEmpty(_0x59b4fa){return _0x59b4fa&&_0x59b4fa[_0x9088('0x4b')]>0x0;}exports[_0x9088('0x4c')]=checkContactEmpty;function erlangb(_0x1158a3,_0x5ea820){if(_0x5ea820===0x0){return 0x0;}var _0xb5a47b=0x1;for(var _0x468d2e=0x1;_0x468d2e<=_0x5ea820;_0x468d2e+=0x1){_0xb5a47b=0x1+_0xb5a47b*_0x468d2e/_0x1158a3;}return 0x1/_0xb5a47b;}exports[_0x9088('0x4d')]=erlangb;function checkContactLowerLimitOriginate(_0xa1cc2a,_0x131c21,_0x1fc201){if(_0x131c21>_0x1fc201){for(var _0x5c489a=0x0;_0x5c489a<_0x131c21-_0x1fc201;_0x5c489a+=0x1){decrementOriginate(_0xa1cc2a);}}}exports[_0x9088('0x4e')]=checkContactLowerLimitOriginate;function setXMDContactVariables(_0x17824d){var _0x492889={};var _0xb9157e=['id',_0x9088('0x4f'),_0x9088('0x50'),'updatedAt'];const _0x2de4c3=0xfa;if(_0x17824d){for(var _0x1c7fc2 in _0x17824d){if(typeof _0x17824d[_0x1c7fc2]!==_0x9088('0x51')){if(!_[_0x9088('0x2a')](_0x17824d[_0x1c7fc2])&&!_0xb9157e[_0x9088('0x36')](_0x1c7fc2)){if(_0x1c7fc2===_0x9088('0x52')&&_0x17824d[_0x1c7fc2]['length']>_0x2de4c3){_0x492889['XMD-'+_0x1c7fc2[_0x9088('0x53')]()]=_0x17824d[_0x1c7fc2][_0x9088('0x47')]()[_0x9088('0x54')](0x0,_0x2de4c3);}else{_0x492889[_0x9088('0x55')+_0x1c7fc2[_0x9088('0x53')]()]=_0x17824d[_0x1c7fc2];}}}}}return _0x492889;}exports['setXMDContactVariables']=setXMDContactVariables; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 01a2ed8..b501582 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(_0x36f9a3,_0xa80747){var _0x3ecdfd=function(_0x19e3bc){while(--_0x19e3bc){_0x36f9a3['push'](_0x36f9a3['shift']());}};_0x3ecdfd(++_0xa80747);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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(_0x42ff68,_0x9e23a3){var _0x535bbe=function(_0x5b0dc0){while(--_0x5b0dc0){_0x42ff68['push'](_0x42ff68['shift']());}};_0x535bbe(++_0x9e23a3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xa9e0[_0x6c993a];return _0x27f547;};'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 7a00f1d..a96c62b 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 _0x2f3d=['[Fax][checkTrunk][Empty\x20path]','exports','util','lodash','uuid','moment','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','varset','bind','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','originateresponse','prototype','context','from-voip-provider','hasOwnProperty','exten','localstationid','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','value','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','.pdf','application/pdf','then','notify','parse','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','actions','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','%s/%s.tif','path','dir','XMF-PATH','Action','variablesAction','addVariables','ext','isTrunkReachable','isNil','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax'];(function(_0x5a0b83,_0x375001){var _0xff5670=function(_0x113b62){while(--_0x113b62){_0x5a0b83['push'](_0x5a0b83['shift']());}};_0xff5670(++_0x375001);}(_0x2f3d,0x76));var _0xd2f3=function(_0xdb8c64,_0x39e8f0){_0xdb8c64=_0xdb8c64-0x0;var _0x338e69=_0x2f3d[_0xdb8c64];return _0x338e69;};'use strict';var util=require(_0xd2f3('0x0'));var _=require(_0xd2f3('0x1'));var BPromise=require('bluebird');var uuid=require(_0xd2f3('0x2'));var moment=require(_0xd2f3('0x3'));var path=require('path');var tiff2pdf=require('tiff2pdf');var gs=require(_0xd2f3('0x4'));var logger=require(_0xd2f3('0x5'))(_0xd2f3('0x6'));var ami=require(_0xd2f3('0x7'));var rpcDb=require(_0xd2f3('0x8'));var Channel=require('./channel');var ut=require(_0xd2f3('0x9'));var Action=require(_0xd2f3('0xa'));var faxAccount=require(_0xd2f3('0xb'));var attachment=require(_0xd2f3('0xc'));var faxMessage=require(_0xd2f3('0xd'));function Fax(_0xfbab16){this[_0xd2f3('0xe')]={};this['faxAccounts']=_0xfbab16[_0xd2f3('0xf')];this[_0xd2f3('0x10')]=_0xfbab16['trunks'];this['actions']={};ami['on'](_0xd2f3('0x11'),this[_0xd2f3('0x12')]['bind'](this));ami['on'](_0xd2f3('0x13'),this['syncVarSet'][_0xd2f3('0x14')](this));ami['on']('newstate',this[_0xd2f3('0x15')][_0xd2f3('0x14')](this));ami['on'](_0xd2f3('0x16'),this[_0xd2f3('0x17')][_0xd2f3('0x14')](this));ami['on'](_0xd2f3('0x18'),this[_0xd2f3('0x19')][_0xd2f3('0x14')](this));ami['on'](_0xd2f3('0x1a'),this[_0xd2f3('0x1b')]['bind'](this));ami['on'](_0xd2f3('0x1c'),this['syncHangup'][_0xd2f3('0x14')](this));ami['on'](_0xd2f3('0x1d'),this['syncOriginateResponse'][_0xd2f3('0x14')](this));}Fax[_0xd2f3('0x1e')]['syncNewchannel']=function(_0x5e9d39){if(_0x5e9d39[_0xd2f3('0x1f')]===_0xd2f3('0x20')){for(var _0x47b23e in this[_0xd2f3('0xf')]){if(this['faxAccounts'][_0xd2f3('0x21')](_0x47b23e)){if(_0x5e9d39[_0xd2f3('0x22')]===this[_0xd2f3('0xf')][_0x47b23e][_0xd2f3('0x23')]){this['channels'][_0x5e9d39[_0xd2f3('0x24')]]={};this[_0xd2f3('0xe')][_0x5e9d39[_0xd2f3('0x24')]][_0xd2f3('0x25')]=_0x5e9d39[_0xd2f3('0x25')];this['channels'][_0x5e9d39[_0xd2f3('0x24')]]['id']=this['faxAccounts'][_0x47b23e]['id'];this['channels'][_0x5e9d39[_0xd2f3('0x24')]]['name']=this[_0xd2f3('0xf')][_0x47b23e][_0xd2f3('0x26')];logger[_0xd2f3('0x27')](_0x5e9d39['uniqueid'],_0xd2f3('0x28'));}}}}if(this['actions'][_0x5e9d39[_0xd2f3('0x24')]]){this[_0xd2f3('0xe')][_0x5e9d39[_0xd2f3('0x24')]]={};this['channels'][_0x5e9d39['uniqueid']][_0xd2f3('0x25')]=_0x5e9d39['channel'];logger[_0xd2f3('0x27')](_0x5e9d39[_0xd2f3('0x24')],'\x20syncNewchannel\x20');}};Fax[_0xd2f3('0x1e')][_0xd2f3('0x29')]=function(_0x13c6ea){if(this[_0xd2f3('0xe')][_0x13c6ea[_0xd2f3('0x24')]]){for(var _0x7fc0e2 in _0x13c6ea[_0xd2f3('0x2a')]){if(_0x13c6ea[_0xd2f3('0x2a')][_0xd2f3('0x21')](_0x7fc0e2)){this['channels'][_0x13c6ea[_0xd2f3('0x24')]][_0x7fc0e2]=_0x13c6ea[_0xd2f3('0x2b')];}}}};Fax[_0xd2f3('0x1e')][_0xd2f3('0x15')]=function(_0x3a7747){if(this[_0xd2f3('0xe')][_0x3a7747[_0xd2f3('0x24')]]){this[_0xd2f3('0xe')][_0x3a7747[_0xd2f3('0x24')]][_0xd2f3('0x2c')]=_0x3a7747[_0xd2f3('0x2c')];this[_0xd2f3('0xe')][_0x3a7747['uniqueid']]['channelstatedesc']=_0x3a7747[_0xd2f3('0x2d')];}};Fax[_0xd2f3('0x1e')]['syncNewExten']=function(_0x235dd7){if(this['channels'][_0x235dd7['uniqueid']]){for(var _0x25f507 in _0x235dd7[_0xd2f3('0x2a')]){if(_0x235dd7[_0xd2f3('0x2a')][_0xd2f3('0x21')](_0x25f507)){this[_0xd2f3('0xe')][_0x235dd7[_0xd2f3('0x24')]][_0x25f507]=_0x235dd7[_0xd2f3('0x2b')];}}}};Fax[_0xd2f3('0x1e')]['syncFaxStatus']=function(_0x37f935){if(this[_0xd2f3('0xe')][_0x37f935[_0xd2f3('0x24')]]){this[_0xd2f3('0xe')][_0x37f935[_0xd2f3('0x24')]][_0xd2f3('0x2e')]=_0x37f935[_0xd2f3('0x2e')];this[_0xd2f3('0xe')][_0x37f935[_0xd2f3('0x24')]]['status']=_0x37f935[_0xd2f3('0x2f')];this[_0xd2f3('0xe')][_0x37f935['uniqueid']]['localstationid']=_0x37f935[_0xd2f3('0x23')];this[_0xd2f3('0xe')][_0x37f935[_0xd2f3('0x24')]][_0xd2f3('0x30')]=_0x37f935[_0xd2f3('0x30')];logger['info'](_0x37f935['uniqueid'],_0xd2f3('0x31'));}};Fax[_0xd2f3('0x1e')][_0xd2f3('0x1b')]=function(_0x62b996){var _0x4319c0=this;if(this[_0xd2f3('0xe')][_0x62b996[_0xd2f3('0x24')]]){var _0x2efce9=this['channels'][_0x62b996[_0xd2f3('0x24')]]['id'];this[_0xd2f3('0xe')][_0x62b996['uniqueid']][_0xd2f3('0x32')]=_0x62b996[_0xd2f3('0x32')];this['channels'][_0x62b996['uniqueid']][_0xd2f3('0x33')]=_0x62b996[_0xd2f3('0x33')];this['channels'][_0x62b996['uniqueid']][_0xd2f3('0x23')]=_0x62b996[_0xd2f3('0x23')];this[_0xd2f3('0xe')][_0x62b996[_0xd2f3('0x24')]][_0xd2f3('0x34')]=_0x62b996[_0xd2f3('0x34')];this['channels'][_0x62b996[_0xd2f3('0x24')]]['transferrate']=_0x62b996['transferrate'];this[_0xd2f3('0xe')][_0x62b996['uniqueid']][_0xd2f3('0x30')]=_0x62b996[_0xd2f3('0x30')];this['channels'][_0x62b996[_0xd2f3('0x24')]][_0xd2f3('0x35')]=_0x62b996[_0xd2f3('0x35')];if(this[_0xd2f3('0xe')][_0x62b996[_0xd2f3('0x24')]]['pagestransferred']>0x0){tiff2pdf(_0x62b996[_0xd2f3('0x30')],_0xd2f3('0x36'),function(_0x1fcacc){logger[_0xd2f3('0x27')](_0x62b996[_0xd2f3('0x24')],_0xd2f3('0x37'),_0x1fcacc[_0xd2f3('0x38')]);attachment['create']({'name':path['parse'](_0x62b996['filename'])[_0xd2f3('0x26')],'basename':path['parse'](_0x62b996[_0xd2f3('0x30')])['name']+_0xd2f3('0x39'),'type':_0xd2f3('0x3a')})[_0xd2f3('0x3b')](function(_0x4cf9d1){faxAccount[_0xd2f3('0x3c')](_0x2efce9,{'from':_0x62b996[_0xd2f3('0x35')],'mapKey':'fax','body':path[_0xd2f3('0x3d')](_0x62b996[_0xd2f3('0x30')])[_0xd2f3('0x26')]+_0xd2f3('0x39'),'AttachmentId':_0x4cf9d1['id']})[_0xd2f3('0x3e')](function(_0x2de8ec){logger[_0xd2f3('0x3f')](_0x62b996[_0xd2f3('0x24')],_0xd2f3('0x40'),JSON[_0xd2f3('0x41')](_0x2de8ec));});})[_0xd2f3('0x3e')](function(_0x537efe){logger[_0xd2f3('0x3f')](_0x62b996[_0xd2f3('0x24')],_0xd2f3('0x42'),JSON[_0xd2f3('0x41')](_0x537efe));});});}logger['info'](_0x62b996[_0xd2f3('0x24')],_0xd2f3('0x42'));}};Fax['prototype']['syncOriginateResponse']=function(_0x57eeb8){if(this[_0xd2f3('0x43')][_0x57eeb8[_0xd2f3('0x24')]]){_['merge'](this[_0xd2f3('0xe')][_0x57eeb8[_0xd2f3('0x24')]],_[_0xd2f3('0x44')](_0x57eeb8,[_0xd2f3('0x45'),_0xd2f3('0x46')]));}};function updateStatus(_0x1a1ede){if(_0x1a1ede[_0xd2f3('0x47')]){faxMessage[_0xd2f3('0x48')](_0x1a1ede[_0xd2f3('0x47')],{'failMessage':_0xd2f3('0x49')})[_0xd2f3('0x3b')](function(_0x109c9b){ut['logger'](_0xd2f3('0x4a'),_0x109c9b);})[_0xd2f3('0x3e')](function(_0x33083f){ut[_0xd2f3('0x4b')](_0xd2f3('0x4c'),_0x33083f);});}else{ut[_0xd2f3('0x4b')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xd2f3('0x1e')][_0xd2f3('0x4d')]=function(_0x4682c0,_0x38ba4c,_0x265cd0){var _0x111af9=this;var _0x3f2fb6={};if(_0x38ba4c){_0x3f2fb6={'read':_0x38ba4c};}else{_0x3f2fb6={'failMessage':_0x265cd0};}if(this[_0xd2f3('0x43')][_0x4682c0][_0xd2f3('0x47')]){faxMessage[_0xd2f3('0x48')](this[_0xd2f3('0x43')][_0x4682c0][_0xd2f3('0x47')],_0x3f2fb6)[_0xd2f3('0x3b')](function(_0xacf41d){ut[_0xd2f3('0x4b')](_0xd2f3('0x4e'),_0xacf41d);})['catch'](function(_0x573b39){ut['logger']('[Fax][Message][NoUpdate1]',_0x573b39);})['finally'](function(){delete _0x111af9[_0xd2f3('0xe')][_0x4682c0];delete _0x111af9['actions'][_0x4682c0];});}else{ut['logger'](_0xd2f3('0x4f'));this[_0xd2f3('0x50')](_0x4682c0);delete this[_0xd2f3('0x43')][_0x4682c0];}};Fax['prototype'][_0xd2f3('0x51')]=function(_0x2ef4dc){var _0x2e4bb0=this;if(this[_0xd2f3('0xe')][_0x2ef4dc['uniqueid']]){if(this[_0xd2f3('0x43')][_0x2ef4dc[_0xd2f3('0x24')]]){this[_0xd2f3('0xe')][_0x2ef4dc[_0xd2f3('0x24')]]['id']=this[_0xd2f3('0x43')][_0x2ef4dc[_0xd2f3('0x24')]]['id'];this[_0xd2f3('0xe')][_0x2ef4dc[_0xd2f3('0x24')]][_0xd2f3('0x26')]=this[_0xd2f3('0x43')][_0x2ef4dc[_0xd2f3('0x24')]][_0xd2f3('0x26')];}logger[_0xd2f3('0x27')](_0x2ef4dc['uniqueid'],this[_0xd2f3('0x43')][_0x2ef4dc[_0xd2f3('0x24')]]?_0xd2f3('0x52'):_0xd2f3('0x53'),JSON[_0xd2f3('0x41')](this[_0xd2f3('0xe')][_0x2ef4dc[_0xd2f3('0x24')]]));if(this['actions'][_0x2ef4dc[_0xd2f3('0x24')]]){if(this[_0xd2f3('0xe')][_0x2ef4dc[_0xd2f3('0x24')]][_0xd2f3('0x54')]>0x0&&this[_0xd2f3('0xe')][_0x2ef4dc['uniqueid']][_0xd2f3('0x18')]===_0xd2f3('0x55')){this[_0xd2f3('0x4d')](_0x2ef4dc[_0xd2f3('0x24')],!![]);}else{this[_0xd2f3('0x4d')](_0x2ef4dc['uniqueid'],![],this[_0xd2f3('0xe')][_0x2ef4dc[_0xd2f3('0x24')]]['faxstatusstring']?_0xd2f3('0x56')+this[_0xd2f3('0xe')][_0x2ef4dc[_0xd2f3('0x24')]]['faxstatusstring']:'SENDING\x20FAILED');}}}};Fax[_0xd2f3('0x1e')]['send']=function(_0x4902ad){var _0x2f221d=this;return new BPromise(function(_0x355253,_0x51b5cd){_0x2f221d[_0xd2f3('0x57')](_0x4902ad,_0x2f221d[_0xd2f3('0xf')][_0x4902ad[_0xd2f3('0x58')]])[_0xd2f3('0x3b')](function(_0x2402a7){ut[_0xd2f3('0x4b')](_0xd2f3('0x59'),_0x2402a7);_0x355253(ut[_0xd2f3('0x38')](_0xd2f3('0x5a')));})[_0xd2f3('0x3e')](function(_0x4cd6b5){ut[_0xd2f3('0x4b')](_0xd2f3('0x5b'),_0x4cd6b5);updateStatus(_0x4902ad);_0x51b5cd(ut['message']('Fax\x20failed'));});});};Fax[_0xd2f3('0x1e')]['checkAfterSend']=function(_0x27af5d){var _0x44b043=this;return new BPromise(function(_0x37b6bb,_0x20924c){var _0x516d48=_0x44b043[_0xd2f3('0x5c')](_0x44b043[_0xd2f3('0xf')][_0x27af5d[_0xd2f3('0x58')]][_0xd2f3('0x5d')],_0x27af5d);if(_0x516d48[_0xd2f3('0x5e')]){_0x37b6bb(ut['message'](_0xd2f3('0x5f')));}else{_0x20924c(ut[_0xd2f3('0x38')](_0x516d48[_0xd2f3('0x38')]));}});};function originate(_0x1d259f,_0x16469b,_0xa475bb){return new BPromise(function(_0x1a8155,_0x4553a4){if(_0xa475bb){var _0x288690=util[_0xd2f3('0x60')]('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[_0xd2f3('0x3d')](_0x1d259f['path'])['name'],_0x1d259f['path']);gs['execute'](_0x288690)[_0xd2f3('0x3b')](function(){_0x1d259f['path']=util[_0xd2f3('0x60')](_0xd2f3('0x61'),path[_0xd2f3('0x3d')](_0x1d259f[_0xd2f3('0x62')])[_0xd2f3('0x63')],path['parse'](_0x1d259f[_0xd2f3('0x62')])[_0xd2f3('0x26')]);_0x16469b[_0xd2f3('0x64')]=_0x1d259f[_0xd2f3('0x62')];ut[_0xd2f3('0x4b')]('Convert\x20pdf\x20to\x20tif','');ami[_0xd2f3('0x65')](ut[_0xd2f3('0x66')](_0x1d259f,_0x16469b))[_0xd2f3('0x3b')](function(_0x43ce9e){_0x1a8155(_0x43ce9e);})['catch'](function(_0x3f5699){_0x4553a4(_0x3f5699);});})['catch'](function(_0x3be921){_0x4553a4(_0x3be921);});}else{ami[_0xd2f3('0x65')](ut[_0xd2f3('0x66')](_0x1d259f,_0x16469b))['then'](function(_0x3b8861){_0x1a8155(_0x3b8861);})[_0xd2f3('0x3e')](function(_0x5ae00a){_0x4553a4(_0x5ae00a);});}});}Fax[_0xd2f3('0x1e')][_0xd2f3('0x57')]=function(_0x4bfee9,_0x55267c){var _0x1bad84=this;return new BPromise(function(_0x1f04ee,_0x4bb319){var _0x51c837=uuid['v4']();var _0x4142e7=ut[_0xd2f3('0x67')](_0x4bfee9,_0x55267c);_0x1bad84[_0xd2f3('0x43')][_0x51c837]=new Action(_0x51c837,_0x55267c,_0x4bfee9);var _0x5e01b2=_0x1bad84[_0xd2f3('0x43')][_0x51c837];if(path[_0xd2f3('0x3d')](_0x4bfee9[_0xd2f3('0x62')])[_0xd2f3('0x68')]===_0xd2f3('0x39')){originate(_0x5e01b2,_0x4142e7,!![])[_0xd2f3('0x3b')](function(_0x44a9e2){_0x1f04ee(_0x44a9e2);})[_0xd2f3('0x3e')](function(_0x255bb6){_0x4bb319(_0x255bb6);});}else{originate(_0x5e01b2,_0x4142e7,![])[_0xd2f3('0x3b')](function(_0x1f6858){_0x1f04ee(_0x1f6858);})['catch'](function(_0x2ba60f){_0x4bb319(_0x2ba60f);});}});};Fax[_0xd2f3('0x1e')][_0xd2f3('0x69')]=function(_0xea42){return!_[_0xd2f3('0x6a')](_0xea42)&&!_['isNil'](_0xea42['name'])&&!_[_0xd2f3('0x6a')](_0xea42['active'])&&_0xea42['active']&&!_['isNil'](this[_0xd2f3('0x10')][util[_0xd2f3('0x60')](_0xd2f3('0x6b'),_0xea42[_0xd2f3('0x26')])])&&!_[_0xd2f3('0x6a')](this[_0xd2f3('0x10')][util['format'](_0xd2f3('0x6b'),_0xea42[_0xd2f3('0x26')])]['status'])&&(this[_0xd2f3('0x10')][util[_0xd2f3('0x60')](_0xd2f3('0x6b'),_0xea42['name'])][_0xd2f3('0x2f')]===_0xd2f3('0x6c')||this[_0xd2f3('0x10')][util['format'](_0xd2f3('0x6b'),_0xea42[_0xd2f3('0x26')])]['status']===_0xd2f3('0x6d'));};Fax[_0xd2f3('0x1e')]['checkTrunk']=function(_0x41b612,_0xb33396){if(!this[_0xd2f3('0x69')](_0x41b612)){ut[_0xd2f3('0x4b')](_0xd2f3('0x6e'),_['isNil'](_0x41b612)?'':_0x41b612[_0xd2f3('0x26')]+_0xd2f3('0x6f'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_['isNil'](_0xb33396['fax'])){ut['logger'](_0xd2f3('0x70'),JSON[_0xd2f3('0x41')](_0xb33396));return{'isValid':![],'message':_0xd2f3('0x71')};}if(_[_0xd2f3('0x6a')](_0xb33396['path'])){ut[_0xd2f3('0x4b')](_0xd2f3('0x72'),JSON[_0xd2f3('0x41')](_0xb33396));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};Fax[_0xd2f3('0x1e')][_0xd2f3('0x50')]=function(_0x4336bb,_0x13a03a=0x2710){if(this[_0xd2f3('0xe')][_0x4336bb]){setTimeout(()=>{delete this['channels'][_0x4336bb];},_0x13a03a);}};module[_0xd2f3('0x73')]=Fax; \ No newline at end of file +var _0xa3fc=['exports','util','bluebird','uuid','path','tiff2pdf','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','trunks','newchannel','varset','syncVarSet','bind','newstate','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','syncNewchannel','context','faxAccounts','hasOwnProperty','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','actions','variable','value','syncNewState','channelstate','channelstatedesc','operation','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','calleridnum','/var/opt/motion2/server/files/attachments/','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','update','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','deleteChannelAfterTimeout','\x20hangup\x20faxRiceive\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','SENDING\x20FAILED','execOriginate','[Fax][execOriginate][success]','[Fax][execOriginate][failure]','message','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','Trunk','isValid','Trunk\x20Reachable','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','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','status','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid'];(function(_0x14ed44,_0x3f3dd7){var _0x31647b=function(_0x1722bf){while(--_0x1722bf){_0x14ed44['push'](_0x14ed44['shift']());}};_0x31647b(++_0x3f3dd7);}(_0xa3fc,0x1e5));var _0xca3f=function(_0x53807d,_0x4a90a8){_0x53807d=_0x53807d-0x0;var _0x501207=_0xa3fc[_0x53807d];return _0x501207;};'use strict';var util=require(_0xca3f('0x0'));var _=require('lodash');var BPromise=require(_0xca3f('0x1'));var uuid=require(_0xca3f('0x2'));var moment=require('moment');var path=require(_0xca3f('0x3'));var tiff2pdf=require(_0xca3f('0x4'));var gs=require('./util/gs');var logger=require(_0xca3f('0x5'))(_0xca3f('0x6'));var ami=require(_0xca3f('0x7'));var rpcDb=require(_0xca3f('0x8'));var Channel=require(_0xca3f('0x9'));var ut=require(_0xca3f('0xa'));var Action=require(_0xca3f('0xb'));var faxAccount=require(_0xca3f('0xc'));var attachment=require(_0xca3f('0xd'));var faxMessage=require(_0xca3f('0xe'));function Fax(_0x215b50){this['channels']={};this['faxAccounts']=_0x215b50['faxAccounts'];this[_0xca3f('0xf')]=_0x215b50['trunks'];this['actions']={};ami['on'](_0xca3f('0x10'),this['syncNewchannel']['bind'](this));ami['on'](_0xca3f('0x11'),this[_0xca3f('0x12')][_0xca3f('0x13')](this));ami['on'](_0xca3f('0x14'),this['syncNewState'][_0xca3f('0x13')](this));ami['on'](_0xca3f('0x15'),this[_0xca3f('0x16')]['bind'](this));ami['on'](_0xca3f('0x17'),this[_0xca3f('0x18')]['bind'](this));ami['on']('receivefax',this[_0xca3f('0x19')][_0xca3f('0x13')](this));ami['on']('hangup',this[_0xca3f('0x1a')]['bind'](this));ami['on'](_0xca3f('0x1b'),this[_0xca3f('0x1c')][_0xca3f('0x13')](this));}Fax[_0xca3f('0x1d')][_0xca3f('0x1e')]=function(_0x26e2ea){if(_0x26e2ea[_0xca3f('0x1f')]==='from-voip-provider'){for(var _0x4bb4da in this[_0xca3f('0x20')]){if(this[_0xca3f('0x20')][_0xca3f('0x21')](_0x4bb4da)){if(_0x26e2ea[_0xca3f('0x22')]===this[_0xca3f('0x20')][_0x4bb4da][_0xca3f('0x23')]){this[_0xca3f('0x24')][_0x26e2ea[_0xca3f('0x25')]]={};this[_0xca3f('0x24')][_0x26e2ea['uniqueid']][_0xca3f('0x26')]=_0x26e2ea[_0xca3f('0x26')];this[_0xca3f('0x24')][_0x26e2ea[_0xca3f('0x25')]]['id']=this[_0xca3f('0x20')][_0x4bb4da]['id'];this[_0xca3f('0x24')][_0x26e2ea[_0xca3f('0x25')]][_0xca3f('0x27')]=this[_0xca3f('0x20')][_0x4bb4da][_0xca3f('0x27')];logger[_0xca3f('0x28')](_0x26e2ea[_0xca3f('0x25')],_0xca3f('0x29'));}}}}if(this[_0xca3f('0x2a')][_0x26e2ea[_0xca3f('0x25')]]){this[_0xca3f('0x24')][_0x26e2ea[_0xca3f('0x25')]]={};this[_0xca3f('0x24')][_0x26e2ea['uniqueid']][_0xca3f('0x26')]=_0x26e2ea[_0xca3f('0x26')];logger[_0xca3f('0x28')](_0x26e2ea[_0xca3f('0x25')],_0xca3f('0x29'));}};Fax[_0xca3f('0x1d')][_0xca3f('0x12')]=function(_0x162194){if(this['channels'][_0x162194['uniqueid']]){for(var _0x1c997b in _0x162194[_0xca3f('0x2b')]){if(_0x162194['variable']['hasOwnProperty'](_0x1c997b)){this[_0xca3f('0x24')][_0x162194[_0xca3f('0x25')]][_0x1c997b]=_0x162194[_0xca3f('0x2c')];}}}};Fax[_0xca3f('0x1d')][_0xca3f('0x2d')]=function(_0x224490){if(this['channels'][_0x224490[_0xca3f('0x25')]]){this[_0xca3f('0x24')][_0x224490[_0xca3f('0x25')]][_0xca3f('0x2e')]=_0x224490[_0xca3f('0x2e')];this[_0xca3f('0x24')][_0x224490[_0xca3f('0x25')]][_0xca3f('0x2f')]=_0x224490[_0xca3f('0x2f')];}};Fax['prototype'][_0xca3f('0x16')]=function(_0x43e5f3){if(this[_0xca3f('0x24')][_0x43e5f3[_0xca3f('0x25')]]){for(var _0x352b56 in _0x43e5f3[_0xca3f('0x2b')]){if(_0x43e5f3[_0xca3f('0x2b')][_0xca3f('0x21')](_0x352b56)){this['channels'][_0x43e5f3['uniqueid']][_0x352b56]=_0x43e5f3['value'];}}}};Fax[_0xca3f('0x1d')][_0xca3f('0x18')]=function(_0x1122fd){if(this[_0xca3f('0x24')][_0x1122fd['uniqueid']]){this[_0xca3f('0x24')][_0x1122fd[_0xca3f('0x25')]][_0xca3f('0x30')]=_0x1122fd[_0xca3f('0x30')];this[_0xca3f('0x24')][_0x1122fd[_0xca3f('0x25')]]['status']=_0x1122fd['status'];this[_0xca3f('0x24')][_0x1122fd['uniqueid']][_0xca3f('0x23')]=_0x1122fd['localstationid'];this[_0xca3f('0x24')][_0x1122fd['uniqueid']][_0xca3f('0x31')]=_0x1122fd[_0xca3f('0x31')];logger[_0xca3f('0x28')](_0x1122fd[_0xca3f('0x25')],_0xca3f('0x32'));}};Fax[_0xca3f('0x1d')]['syncReceiveFax']=function(_0x5cebab){var _0x5f2f12=this;if(this[_0xca3f('0x24')][_0x5cebab[_0xca3f('0x25')]]){var _0x1c9775=this[_0xca3f('0x24')][_0x5cebab[_0xca3f('0x25')]]['id'];this[_0xca3f('0x24')][_0x5cebab['uniqueid']][_0xca3f('0x33')]=_0x5cebab[_0xca3f('0x33')];this[_0xca3f('0x24')][_0x5cebab['uniqueid']][_0xca3f('0x34')]=_0x5cebab[_0xca3f('0x34')];this[_0xca3f('0x24')][_0x5cebab[_0xca3f('0x25')]][_0xca3f('0x23')]=_0x5cebab[_0xca3f('0x23')];this[_0xca3f('0x24')][_0x5cebab[_0xca3f('0x25')]][_0xca3f('0x35')]=_0x5cebab[_0xca3f('0x35')];this[_0xca3f('0x24')][_0x5cebab[_0xca3f('0x25')]]['transferrate']=_0x5cebab['transferrate'];this[_0xca3f('0x24')][_0x5cebab[_0xca3f('0x25')]][_0xca3f('0x31')]=_0x5cebab[_0xca3f('0x31')];this[_0xca3f('0x24')][_0x5cebab[_0xca3f('0x25')]][_0xca3f('0x36')]=_0x5cebab[_0xca3f('0x36')];if(this['channels'][_0x5cebab[_0xca3f('0x25')]]['pagestransferred']>0x0){tiff2pdf(_0x5cebab[_0xca3f('0x31')],_0xca3f('0x37'),function(_0x548c62){logger[_0xca3f('0x28')](_0x5cebab['uniqueid'],'\x20result\x20conversion\x20file\x20',_0x548c62['message']);attachment[_0xca3f('0x38')]({'name':path[_0xca3f('0x39')](_0x5cebab[_0xca3f('0x31')])['name'],'basename':path[_0xca3f('0x39')](_0x5cebab[_0xca3f('0x31')])[_0xca3f('0x27')]+_0xca3f('0x3a'),'type':_0xca3f('0x3b')})[_0xca3f('0x3c')](function(_0x2bf537){faxAccount[_0xca3f('0x3d')](_0x1c9775,{'from':_0x5cebab[_0xca3f('0x36')],'mapKey':_0xca3f('0x6'),'body':path[_0xca3f('0x39')](_0x5cebab[_0xca3f('0x31')])[_0xca3f('0x27')]+_0xca3f('0x3a'),'AttachmentId':_0x2bf537['id']})[_0xca3f('0x3e')](function(_0x4d8da5){logger[_0xca3f('0x3f')](_0x5cebab[_0xca3f('0x25')],_0xca3f('0x40'),JSON[_0xca3f('0x41')](_0x4d8da5));});})[_0xca3f('0x3e')](function(_0x530be0){logger[_0xca3f('0x3f')](_0x5cebab[_0xca3f('0x25')],_0xca3f('0x42'),JSON[_0xca3f('0x41')](_0x530be0));});});}logger[_0xca3f('0x28')](_0x5cebab[_0xca3f('0x25')],_0xca3f('0x42'));}};Fax['prototype']['syncOriginateResponse']=function(_0x38d08f){if(this[_0xca3f('0x2a')][_0x38d08f[_0xca3f('0x25')]]){_[_0xca3f('0x43')](this[_0xca3f('0x24')][_0x38d08f[_0xca3f('0x25')]],_[_0xca3f('0x44')](_0x38d08f,[_0xca3f('0x45'),_0xca3f('0x46')]));}};function updateStatus(_0x441e54){if(_0x441e54['AttachmentId']){faxMessage[_0xca3f('0x47')](_0x441e54[_0xca3f('0x48')],{'failMessage':_0xca3f('0x49')})[_0xca3f('0x3c')](function(_0x15ebf1){ut[_0xca3f('0x4a')]('[Fax][Message][Error][Updated]',_0x15ebf1);})['catch'](function(_0x1f0803){ut['logger'](_0xca3f('0x4b'),_0x1f0803);});}else{ut[_0xca3f('0x4a')](_0xca3f('0x4c'));}}Fax['prototype'][_0xca3f('0x4d')]=function(_0x129b32,_0x3bcef8,_0x333900){var _0x2d8db1=this;var _0x29dd67={};if(_0x3bcef8){_0x29dd67={'read':_0x3bcef8};}else{_0x29dd67={'failMessage':_0x333900};}if(this[_0xca3f('0x2a')][_0x129b32]['AttachmentId']){faxMessage[_0xca3f('0x47')](this[_0xca3f('0x2a')][_0x129b32]['AttachmentId'],_0x29dd67)[_0xca3f('0x3c')](function(_0x5b01a1){ut[_0xca3f('0x4a')](_0xca3f('0x4e'),_0x5b01a1);})['catch'](function(_0x35b03f){ut[_0xca3f('0x4a')](_0xca3f('0x4f'),_0x35b03f);})['finally'](function(){delete _0x2d8db1[_0xca3f('0x24')][_0x129b32];delete _0x2d8db1[_0xca3f('0x2a')][_0x129b32];});}else{ut[_0xca3f('0x4a')](_0xca3f('0x50'));this[_0xca3f('0x51')](_0x129b32);delete this[_0xca3f('0x2a')][_0x129b32];}};Fax[_0xca3f('0x1d')][_0xca3f('0x1a')]=function(_0x265389){var _0x237b9f=this;if(this[_0xca3f('0x24')][_0x265389['uniqueid']]){if(this[_0xca3f('0x2a')][_0x265389[_0xca3f('0x25')]]){this[_0xca3f('0x24')][_0x265389[_0xca3f('0x25')]]['id']=this['actions'][_0x265389[_0xca3f('0x25')]]['id'];this[_0xca3f('0x24')][_0x265389['uniqueid']]['name']=this[_0xca3f('0x2a')][_0x265389[_0xca3f('0x25')]][_0xca3f('0x27')];}logger['info'](_0x265389[_0xca3f('0x25')],this[_0xca3f('0x2a')][_0x265389['uniqueid']]?'\x20hangup\x20sendFile\x20':_0xca3f('0x52'),JSON[_0xca3f('0x41')](this[_0xca3f('0x24')][_0x265389[_0xca3f('0x25')]]));if(this[_0xca3f('0x2a')][_0x265389[_0xca3f('0x25')]]){if(this['channels'][_0x265389[_0xca3f('0x25')]][_0xca3f('0x53')]>0x0&&this['channels'][_0x265389[_0xca3f('0x25')]][_0xca3f('0x17')]===_0xca3f('0x54')){this[_0xca3f('0x4d')](_0x265389[_0xca3f('0x25')],!![]);}else{this['updateStatus'](_0x265389['uniqueid'],![],this[_0xca3f('0x24')][_0x265389['uniqueid']][_0xca3f('0x55')]?_0xca3f('0x56')+this[_0xca3f('0x24')][_0x265389[_0xca3f('0x25')]][_0xca3f('0x55')]:_0xca3f('0x57'));}}}};Fax['prototype']['send']=function(_0xd907d6){var _0x2fb6ba=this;return new BPromise(function(_0x4d4939,_0x5d7cea){_0x2fb6ba[_0xca3f('0x58')](_0xd907d6,_0x2fb6ba['faxAccounts'][_0xd907d6['FaxAccountId']])[_0xca3f('0x3c')](function(_0x538350){ut[_0xca3f('0x4a')](_0xca3f('0x59'),_0x538350);_0x4d4939(ut['message']('Fax\x20received'));})[_0xca3f('0x3e')](function(_0x3db448){ut[_0xca3f('0x4a')](_0xca3f('0x5a'),_0x3db448);updateStatus(_0xd907d6);_0x5d7cea(ut[_0xca3f('0x5b')](_0xca3f('0x5c')));});});};Fax[_0xca3f('0x1d')][_0xca3f('0x5d')]=function(_0x3215ee){var _0x50d6e0=this;return new BPromise(function(_0x66b8d2,_0x38a4d0){var _0x5f4a49=_0x50d6e0[_0xca3f('0x5e')](_0x50d6e0[_0xca3f('0x20')][_0x3215ee[_0xca3f('0x5f')]][_0xca3f('0x60')],_0x3215ee);if(_0x5f4a49[_0xca3f('0x61')]){_0x66b8d2(ut[_0xca3f('0x5b')](_0xca3f('0x62')));}else{_0x38a4d0(ut[_0xca3f('0x5b')](_0x5f4a49[_0xca3f('0x5b')]));}});};function originate(_0x55ad14,_0x559ddd,_0x46fd82){return new BPromise(function(_0x274269,_0x3ad2eb){if(_0x46fd82){var _0x15e673=util[_0xca3f('0x63')](_0xca3f('0x64'),path[_0xca3f('0x39')](_0x55ad14[_0xca3f('0x3')])[_0xca3f('0x27')],_0x55ad14[_0xca3f('0x3')]);gs['execute'](_0x15e673)['then'](function(){_0x55ad14['path']=util[_0xca3f('0x63')](_0xca3f('0x65'),path['parse'](_0x55ad14[_0xca3f('0x3')])[_0xca3f('0x66')],path[_0xca3f('0x39')](_0x55ad14[_0xca3f('0x3')])[_0xca3f('0x27')]);_0x559ddd[_0xca3f('0x67')]=_0x55ad14[_0xca3f('0x3')];ut[_0xca3f('0x4a')](_0xca3f('0x68'),'');ami[_0xca3f('0x69')](ut[_0xca3f('0x6a')](_0x55ad14,_0x559ddd))[_0xca3f('0x3c')](function(_0x3c1844){_0x274269(_0x3c1844);})[_0xca3f('0x3e')](function(_0x30e343){_0x3ad2eb(_0x30e343);});})[_0xca3f('0x3e')](function(_0x20c8af){_0x3ad2eb(_0x20c8af);});}else{ami[_0xca3f('0x69')](ut[_0xca3f('0x6a')](_0x55ad14,_0x559ddd))[_0xca3f('0x3c')](function(_0x443aa0){_0x274269(_0x443aa0);})[_0xca3f('0x3e')](function(_0x50d500){_0x3ad2eb(_0x50d500);});}});}Fax[_0xca3f('0x1d')][_0xca3f('0x58')]=function(_0xbda19,_0x417955){var _0x26ca68=this;return new BPromise(function(_0x10b46e,_0x16b7c3){var _0x465202=uuid['v4']();var _0x536324=ut[_0xca3f('0x6b')](_0xbda19,_0x417955);_0x26ca68[_0xca3f('0x2a')][_0x465202]=new Action(_0x465202,_0x417955,_0xbda19);var _0x3f9247=_0x26ca68[_0xca3f('0x2a')][_0x465202];if(path[_0xca3f('0x39')](_0xbda19[_0xca3f('0x3')])['ext']===_0xca3f('0x3a')){originate(_0x3f9247,_0x536324,!![])[_0xca3f('0x3c')](function(_0x337822){_0x10b46e(_0x337822);})[_0xca3f('0x3e')](function(_0x4f90b3){_0x16b7c3(_0x4f90b3);});}else{originate(_0x3f9247,_0x536324,![])[_0xca3f('0x3c')](function(_0x5de68e){_0x10b46e(_0x5de68e);})[_0xca3f('0x3e')](function(_0x57abbb){_0x16b7c3(_0x57abbb);});}});};Fax[_0xca3f('0x1d')][_0xca3f('0x6c')]=function(_0x53498b){return!_[_0xca3f('0x6d')](_0x53498b)&&!_[_0xca3f('0x6d')](_0x53498b[_0xca3f('0x27')])&&!_[_0xca3f('0x6d')](_0x53498b[_0xca3f('0x6e')])&&_0x53498b[_0xca3f('0x6e')]&&!_[_0xca3f('0x6d')](this[_0xca3f('0xf')][util[_0xca3f('0x63')](_0xca3f('0x6f'),_0x53498b[_0xca3f('0x27')])])&&!_[_0xca3f('0x6d')](this[_0xca3f('0xf')][util[_0xca3f('0x63')]('SIP/%s',_0x53498b[_0xca3f('0x27')])][_0xca3f('0x70')])&&(this[_0xca3f('0xf')][util[_0xca3f('0x63')](_0xca3f('0x6f'),_0x53498b[_0xca3f('0x27')])][_0xca3f('0x70')]==='reachable'||this[_0xca3f('0xf')][util['format'](_0xca3f('0x6f'),_0x53498b[_0xca3f('0x27')])]['status']==='unmonitored');};Fax[_0xca3f('0x1d')][_0xca3f('0x5e')]=function(_0x21be8d,_0xd0cfa2){if(!this['isTrunkReachable'](_0x21be8d)){ut[_0xca3f('0x4a')](_0xca3f('0x71'),_[_0xca3f('0x6d')](_0x21be8d)?'':_0x21be8d['name']+_0xca3f('0x72'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0xca3f('0x6d')](_0xd0cfa2['fax'])){ut['logger'](_0xca3f('0x73'),JSON['stringify'](_0xd0cfa2));return{'isValid':![],'message':_0xca3f('0x74')};}if(_[_0xca3f('0x6d')](_0xd0cfa2['path'])){ut['logger'](_0xca3f('0x75'),JSON[_0xca3f('0x41')](_0xd0cfa2));return{'isValid':![],'message':_0xca3f('0x76')};}return{'isValid':!![],'message':_0xca3f('0x77')};};Fax[_0xca3f('0x1d')][_0xca3f('0x51')]=function(_0x5c9de4,_0x541255=0x2710){if(this[_0xca3f('0x24')][_0x5c9de4]){setTimeout(()=>{delete this[_0xca3f('0x24')][_0x5c9de4];},_0x541255);}};module[_0xca3f('0x78')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index e27c25c..d1e8f98 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 _0x6aba=['lodash','../rpc/faxAccount','inspect','notify','then','catch','bluebird','../../../config/logger','preview'];(function(_0xe38764,_0x28ce79){var _0x5979cf=function(_0x1fedef){while(--_0x1fedef){_0xe38764['push'](_0xe38764['shift']());}};_0x5979cf(++_0x28ce79);}(_0x6aba,0x180));var _0xa6ab=function(_0x3c6694,_0x91cd0d){_0x3c6694=_0x3c6694-0x0;var _0x5a48c9=_0x6aba[_0x3c6694];return _0x5a48c9;};'use strict';var util=require('util');var BPromise=require(_0xa6ab('0x0'));var logger=require(_0xa6ab('0x1'))(_0xa6ab('0x2'));var _=require(_0xa6ab('0x3'));var faxAccount=require(_0xa6ab('0x4'));function loggerCatch(_0x3f73f6){return function(_0x4e66ad){logger['error'](_0x3f73f6,util[_0xa6ab('0x5')](_0x4e66ad,{'showHidden':![],'depth':null}));};}exports[_0xa6ab('0x6')]=function(_0x598d18,_0x3666fa){return BPromise['resolve']()[_0xa6ab('0x7')](faxAccount[_0xa6ab('0x6')](_0x598d18,_0x3666fa))[_0xa6ab('0x8')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x93f0=['lodash','error','inspect','catch','util','bluebird','../../../config/logger','preview'];(function(_0x5db528,_0x4730e9){var _0x1fbf1d=function(_0x5c4867){while(--_0x5c4867){_0x5db528['push'](_0x5db528['shift']());}};_0x1fbf1d(++_0x4730e9);}(_0x93f0,0x6c));var _0x093f=function(_0x33f4da,_0x56f79b){_0x33f4da=_0x33f4da-0x0;var _0x2808b6=_0x93f0[_0x33f4da];return _0x2808b6;};'use strict';var util=require(_0x093f('0x0'));var BPromise=require(_0x093f('0x1'));var logger=require(_0x093f('0x2'))(_0x093f('0x3'));var _=require(_0x093f('0x4'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x48b16d){return function(_0x4cc6fb){logger[_0x093f('0x5')](_0x48b16d,util[_0x093f('0x6')](_0x4cc6fb,{'showHidden':![],'depth':null}));};}exports['notify']=function(_0x15caf6,_0x3353fe){return BPromise['resolve']()['then'](faxAccount['notify'](_0x15caf6,_0x3353fe))[_0x093f('0x7')](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 b8cdd4f..0269cce 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 _0x3ca1=['bluebird','child_process','exec','info','Exec\x20gs','inspect','util'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x3ca1,0x1e9));var _0x13ca=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ca1[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x13ca('0x0'));var logger=require('../../../../config/logger')('fax');var BPromise=require(_0x13ca('0x1'));var exec=require(_0x13ca('0x2'))[_0x13ca('0x3')];exports['execute']=function(_0x46cee6){return new BPromise(function(_0xc2fe1d,_0x14d02f){exec(_0x46cee6,function(_0x977e8e,_0x2c7754,_0x19c88e){logger[_0x13ca('0x4')](_0x13ca('0x5'),_0x2c7754);if(_0x977e8e){logger[_0x13ca('0x4')](_0x13ca('0x5'),'\x20Error\x20:',util[_0x13ca('0x6')](_0x977e8e,{'showHidden':![],'depth':null}),_0x2c7754,_0x19c88e);_0x14d02f(_0x977e8e);}_0xc2fe1d(_0x2c7754);});});}; \ No newline at end of file +var _0xfdc4=['Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird','exec','info'];(function(_0x20a6bd,_0xaeb074){var _0x318a91=function(_0x2055e4){while(--_0x2055e4){_0x20a6bd['push'](_0x20a6bd['shift']());}};_0x318a91(++_0xaeb074);}(_0xfdc4,0x83));var _0x4fdc=function(_0xe555e1,_0x34286e){_0xe555e1=_0xe555e1-0x0;var _0x178e59=_0xfdc4[_0xe555e1];return _0x178e59;};'use strict';var util=require(_0x4fdc('0x0'));var logger=require('../../../../config/logger')(_0x4fdc('0x1'));var BPromise=require(_0x4fdc('0x2'));var exec=require('child_process')[_0x4fdc('0x3')];exports['execute']=function(_0x52461f){return new BPromise(function(_0x217fa0,_0x3d6a16){exec(_0x52461f,function(_0x584f01,_0x4de6be,_0x274f76){logger[_0x4fdc('0x4')](_0x4fdc('0x5'),_0x4de6be);if(_0x584f01){logger['info'](_0x4fdc('0x5'),_0x4fdc('0x6'),util[_0x4fdc('0x7')](_0x584f01,{'showHidden':![],'depth':null}),_0x4de6be,_0x274f76);_0x3d6a16(_0x584f01);}_0x217fa0(_0x4de6be);});});}; \ 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 0aaf52c..7c75693 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 _0x6757=['inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','from-sip','uniqueid','util','lodash','moment','../../../../config/logger','fax','message','info'];(function(_0x2cbf7d,_0x32af04){var _0x2be66e=function(_0x53d98e){while(--_0x53d98e){_0x2cbf7d['push'](_0x2cbf7d['shift']());}};_0x2be66e(++_0x32af04);}(_0x6757,0x149));var _0x7675=function(_0x57c870,_0x33a544){_0x57c870=_0x57c870-0x0;var _0x4ef473=_0x6757[_0x57c870];return _0x4ef473;};'use strict';var util=require(_0x7675('0x0'));var _=require(_0x7675('0x1'));var moment=require(_0x7675('0x2'));var logger=require(_0x7675('0x3'))(_0x7675('0x4'));exports[_0x7675('0x5')]=function(_0x5de28a){return{'message':_0x5de28a};};exports['logger']=function(_0x38a860,_0x2d3770){logger[_0x7675('0x6')](_0x38a860,util[_0x7675('0x7')](_0x2d3770,{'showHidden':![],'depth':null}));};exports[_0x7675('0x8')]=function(_0x4ab639,_0x18349e){var _0x462683={'XMF-ECM':_0x18349e[_0x7675('0x9')],'XMF-HEADERINFO':_0x18349e[_0x7675('0xa')],'XMF-MINRATE':_0x18349e[_0x7675('0xb')],'XMF-MAXRATE':_0x18349e[_0x7675('0xc')],'XMF-MODEM':util[_0x7675('0xd')]('\x22%s\x22',_0x18349e['modem']),'XMF-GATEWAY':_0x18349e[_0x7675('0xe')],'XMF-FAXDETECT':_0x18349e[_0x7675('0xf')],'XMF-T38TIMEOUT':_0x18349e[_0x7675('0x10')],'XMF-LOCALSTATIONID':_0x18349e[_0x7675('0x11')],'XMF-PATH':_0x4ab639[_0x7675('0x12')]};return _0x462683;};exports[_0x7675('0x13')]=function(_0x97c126,_0x3ce608){return{'actionid':_0x97c126['uniqueid'],'action':_0x7675('0x14'),'channel':_0x97c126[_0x7675('0x15')],'Exten':'xcally-motion-fax','Context':_0x7675('0x16'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x97c126[_0x7675('0xa')]?_0x97c126[_0x7675('0xa')]:'',_0x97c126['localstationid']),'variable':_0x3ce608,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x97c126[_0x7675('0x17')]};}; \ No newline at end of file +var _0x6896=['modem','gateway','faxdetect','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','localstationid','util','../../../../config/logger','fax','message','logger','info','inspect','addVariables','ecm','headerinfo','minrate','maxrate','format','\x22%s\x22'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6896,0x15e));var _0x6689=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6896[_0x2dafbe];return _0x58a45a;};'use strict';var util=require(_0x6689('0x0'));var _=require('lodash');var moment=require('moment');var logger=require(_0x6689('0x1'))(_0x6689('0x2'));exports[_0x6689('0x3')]=function(_0x33bab2){return{'message':_0x33bab2};};exports[_0x6689('0x4')]=function(_0x219e17,_0x296eba){logger[_0x6689('0x5')](_0x219e17,util[_0x6689('0x6')](_0x296eba,{'showHidden':![],'depth':null}));};exports[_0x6689('0x7')]=function(_0x22cf22,_0x30def4){var _0x49d601={'XMF-ECM':_0x30def4[_0x6689('0x8')],'XMF-HEADERINFO':_0x30def4[_0x6689('0x9')],'XMF-MINRATE':_0x30def4[_0x6689('0xa')],'XMF-MAXRATE':_0x30def4[_0x6689('0xb')],'XMF-MODEM':util[_0x6689('0xc')](_0x6689('0xd'),_0x30def4[_0x6689('0xe')]),'XMF-GATEWAY':_0x30def4[_0x6689('0xf')],'XMF-FAXDETECT':_0x30def4[_0x6689('0x10')],'XMF-T38TIMEOUT':_0x30def4['t38timeout'],'XMF-LOCALSTATIONID':_0x30def4['localstationid'],'XMF-PATH':_0x22cf22[_0x6689('0x11')]};return _0x49d601;};exports[_0x6689('0x12')]=function(_0x19fd15,_0x451f2d){return{'actionid':_0x19fd15[_0x6689('0x13')],'action':_0x6689('0x14'),'channel':_0x19fd15[_0x6689('0x15')],'Exten':_0x6689('0x16'),'Context':_0x6689('0x17'),'Priority':'1','callerid':util[_0x6689('0xc')](_0x6689('0x18'),_0x19fd15[_0x6689('0x9')]?_0x19fd15[_0x6689('0x9')]:'',_0x19fd15[_0x6689('0x19')]),'variable':_0x451f2d,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x19fd15[_0x6689('0x13')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 9ff429f..d1df286 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 _0x4716=['getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','resolve','initVoiceQueueReports','getVoiceQueueHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./server','./report','./acw','./trigger','./dialer','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','ami','get','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts'];(function(_0x29bafc,_0x61c845){var _0xf6d52f=function(_0x46721f){while(--_0x46721f){_0x29bafc['push'](_0x29bafc['shift']());}};_0xf6d52f(++_0x61c845);}(_0x4716,0x130));var _0x6471=function(_0x1dc15f,_0xbd7f8f){_0x1dc15f=_0x1dc15f-0x0;var _0xd0a506=_0x4716[_0x1dc15f];return _0xd0a506;};'use strict';var util=require(_0x6471('0x0'));var moment=require(_0x6471('0x1'));var server=require(_0x6471('0x2'));var Realtime=require('./realtime');var Report=require(_0x6471('0x3'));var Acw=require(_0x6471('0x4'));var Trigger=require(_0x6471('0x5'));var Dialer=require(_0x6471('0x6'));var Preview=require('./preview');var Fax=require(_0x6471('0x7'));var user=require(_0x6471('0x8'));var voiceQueue=require(_0x6471('0x9'));var voiceQueueReport=require(_0x6471('0xa'));var voiceCallReport=require(_0x6471('0xb'));var trunk=require(_0x6471('0xc'));var trigger=require(_0x6471('0xd'));var template=require(_0x6471('0xe'));var cmHopperHistory=require(_0x6471('0xf'));var campaign=require('./rpc/campaign');var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x6471('0x10'));var zendesk=require(_0x6471('0x11'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require(_0x6471('0x12'));var freshdesk=require(_0x6471('0x13'));var desk=require(_0x6471('0x14'));var zoho=require(_0x6471('0x15'));var vtiger=require(_0x6471('0x16'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x6471('0x17'));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('../../config/logger')(_0x6471('0x18'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x6471('0x19')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x6471('0x19')]('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise['resolve']()[_0x6471('0x1a')](user[_0x6471('0x1b')]())[_0x6471('0x1a')](realtime[_0x6471('0x1c')]())[_0x6471('0x1a')](user[_0x6471('0x1d')]())[_0x6471('0x1a')](realtime[_0x6471('0x1e')]())['then'](trunk[_0x6471('0x1f')]())[_0x6471('0x1a')](realtime[_0x6471('0x20')]())[_0x6471('0x1a')](voiceQueue[_0x6471('0x21')]())[_0x6471('0x1a')](realtime[_0x6471('0x22')]())[_0x6471('0x1a')](trigger[_0x6471('0x23')]())[_0x6471('0x1a')](realtime['initTriggers']())[_0x6471('0x1a')](template[_0x6471('0x24')]())[_0x6471('0x1a')](realtime[_0x6471('0x25')]())[_0x6471('0x1a')](zendesk[_0x6471('0x26')]())[_0x6471('0x1a')](realtime[_0x6471('0x27')]())[_0x6471('0x1a')](salesforce[_0x6471('0x28')]())[_0x6471('0x1a')](realtime['initSalesforceAccounts']())[_0x6471('0x1a')](sugarcrm[_0x6471('0x29')]())[_0x6471('0x1a')](realtime[_0x6471('0x2a')]())[_0x6471('0x1a')](freshdesk[_0x6471('0x2b')]())[_0x6471('0x1a')](realtime[_0x6471('0x2c')]())['then'](desk['getDeskAccounts']())['then'](realtime['initDeskAccounts']())[_0x6471('0x1a')](zoho[_0x6471('0x2d')]())[_0x6471('0x1a')](realtime[_0x6471('0x2e')]())['then'](vtiger[_0x6471('0x2f')]())[_0x6471('0x1a')](realtime[_0x6471('0x30')]())[_0x6471('0x1a')](freshsales['getFreshsalesAccounts']())[_0x6471('0x1a')](realtime[_0x6471('0x31')]())[_0x6471('0x1a')](servicenow[_0x6471('0x32')]())['then'](realtime[_0x6471('0x33')]())['then'](dynamics365['getDynamics365Accounts']())['then'](realtime['initDynamics365Accounts']())['then'](campaign['getCampaigns']())[_0x6471('0x1a')](realtime[_0x6471('0x34')]())[_0x6471('0x1a')](voiceExtension[_0x6471('0x35')]())[_0x6471('0x1a')](realtime[_0x6471('0x36')]())[_0x6471('0x1a')](faxAccount[_0x6471('0x37')]())[_0x6471('0x1a')](realtime[_0x6471('0x38')]())[_0x6471('0x1a')](function(){return realtime;});}function initParams(){return Promise[_0x6471('0x39')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x6471('0x1a')](realtime[_0x6471('0x3a')]())[_0x6471('0x1a')](cmHopperHistory[_0x6471('0x3b')]())['then'](realtime['initVoiceQueueHopperHistory']())[_0x6471('0x1a')](cmHopperHistory['getCampaignHopperHistory']())['then'](realtime['initCampaignHopperHistory']())['then'](voiceCallReport[_0x6471('0x3c')]())['then'](realtime[_0x6471('0x3d')]())[_0x6471('0x3e')](function(_0x32eb34){logger[_0x6471('0x3f')](_0x6471('0x40'),util[_0x6471('0x41')](_0x32eb34,{'showHidden':![],'depth':null}));});}function main(){return server[_0x6471('0x42')](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x6471('0x1a')](function(){return initParams();})[_0x6471('0x1a')](function(){report[_0x6471('0x43')]();setInterval(initRealtime,0x1388);})[_0x6471('0x3e')](function(_0x2f677b){logger[_0x6471('0x3f')](_0x6471('0x44'),util[_0x6471('0x41')](_0x2f677b,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xae44=['getServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','initVoiceQueueReports','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','inspect','sync','util','./realtime','./report','./acw','./trigger','./fax','./rpc/voiceQueueReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','../../config/logger','ami','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','getSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts'];(function(_0x379245,_0x32a201){var _0x4711b5=function(_0x5ab236){while(--_0x5ab236){_0x379245['push'](_0x379245['shift']());}};_0x4711b5(++_0x32a201);}(_0xae44,0x153));var _0x4ae4=function(_0x5eb868,_0x3edfb0){_0x5eb868=_0x5eb868-0x0;var _0x278458=_0xae44[_0x5eb868];return _0x278458;};'use strict';var util=require(_0x4ae4('0x0'));var moment=require('moment');var server=require('./server');var Realtime=require(_0x4ae4('0x1'));var Report=require(_0x4ae4('0x2'));var Acw=require(_0x4ae4('0x3'));var Trigger=require(_0x4ae4('0x4'));var Dialer=require('./dialer');var Preview=require('./preview');var Fax=require(_0x4ae4('0x5'));var user=require('./rpc/user');var voiceQueue=require('./rpc/voiceQueue');var voiceQueueReport=require(_0x4ae4('0x6'));var voiceCallReport=require('./rpc/voiceCallReport');var trunk=require(_0x4ae4('0x7'));var trigger=require(_0x4ae4('0x8'));var template=require('./rpc/template');var cmHopperHistory=require(_0x4ae4('0x9'));var campaign=require(_0x4ae4('0xa'));var voiceExtension=require(_0x4ae4('0xb'));var faxAccount=require(_0x4ae4('0xc'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x4ae4('0xd'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x4ae4('0xe'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x4ae4('0xf'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x4ae4('0x10'));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(_0x4ae4('0x11'))(_0x4ae4('0x12'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()[_0x4ae4('0x13')](_0x4ae4('0x14'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x4ae4('0x13')](_0x4ae4('0x14'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x4ae4('0x15')]()[_0x4ae4('0x16')](user[_0x4ae4('0x17')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x18')]())['then'](user[_0x4ae4('0x19')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x1a')]())[_0x4ae4('0x16')](trunk[_0x4ae4('0x1b')]())[_0x4ae4('0x16')](realtime['initTrunks']())['then'](voiceQueue[_0x4ae4('0x1c')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x1d')]())[_0x4ae4('0x16')](trigger[_0x4ae4('0x1e')]())['then'](realtime[_0x4ae4('0x1f')]())['then'](template[_0x4ae4('0x20')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x21')]())[_0x4ae4('0x16')](zendesk[_0x4ae4('0x22')]())['then'](realtime['initZendeskAccounts']())[_0x4ae4('0x16')](salesforce[_0x4ae4('0x23')]())[_0x4ae4('0x16')](realtime['initSalesforceAccounts']())[_0x4ae4('0x16')](sugarcrm[_0x4ae4('0x24')]())[_0x4ae4('0x16')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x4ae4('0x25')]())['then'](realtime[_0x4ae4('0x26')]())[_0x4ae4('0x16')](desk['getDeskAccounts']())[_0x4ae4('0x16')](realtime[_0x4ae4('0x27')]())[_0x4ae4('0x16')](zoho[_0x4ae4('0x28')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x29')]())[_0x4ae4('0x16')](vtiger[_0x4ae4('0x2a')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x2b')]())['then'](freshsales[_0x4ae4('0x2c')]())[_0x4ae4('0x16')](realtime['initFreshsalesAccounts']())[_0x4ae4('0x16')](servicenow[_0x4ae4('0x2d')]())[_0x4ae4('0x16')](realtime['initServicenowAccounts']())[_0x4ae4('0x16')](dynamics365[_0x4ae4('0x2e')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x2f')]())[_0x4ae4('0x16')](campaign[_0x4ae4('0x30')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x31')]())[_0x4ae4('0x16')](voiceExtension[_0x4ae4('0x32')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x33')]())[_0x4ae4('0x16')](faxAccount[_0x4ae4('0x34')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x35')]())[_0x4ae4('0x16')](function(){return realtime;});}function initParams(){return Promise[_0x4ae4('0x15')]()['then'](voiceQueueReport['getVoiceQueueReports']())[_0x4ae4('0x16')](realtime[_0x4ae4('0x36')]())[_0x4ae4('0x16')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x4ae4('0x16')](realtime[_0x4ae4('0x37')]())[_0x4ae4('0x16')](cmHopperHistory[_0x4ae4('0x38')]())['then'](realtime[_0x4ae4('0x39')]())[_0x4ae4('0x16')](voiceCallReport[_0x4ae4('0x3a')]())[_0x4ae4('0x16')](realtime[_0x4ae4('0x3b')]())[_0x4ae4('0x3c')](function(_0x4125cd){logger[_0x4ae4('0x3d')]('[index.js][initParams]',util[_0x4ae4('0x3e')](_0x4125cd,{'showHidden':![],'depth':null}));});}function main(){return server['listen'](realtime,preview,fax)['then'](function(){return initRealtime();})[_0x4ae4('0x16')](function(){return initParams();})[_0x4ae4('0x16')](function(){report[_0x4ae4('0x3f')]();setInterval(initRealtime,0x1388);})[_0x4ae4('0x3c')](function(_0x50fdd8){logger[_0x4ae4('0x3d')]('[index.js][main]',util[_0x4ae4('0x3e')](_0x50fdd8,{'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 a606a89..562b5e7 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 _0x7b3d=['phone','interface','voiceStatus','voiceStatusTime','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','online','voiceStatusCallerIdNumber','voiceStatusQueue','format','user:%s','user:ami:update','omit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','defaults','localhost','socket.io-emitter','redis','name','email','accountcode','fullname','state','unknown','stateTime','status'];(function(_0x9cbdaf,_0x1df031){var _0x5d6fef=function(_0x2a0357){while(--_0x2a0357){_0x9cbdaf['push'](_0x9cbdaf['shift']());}};_0x5d6fef(++_0x1df031);}(_0x7b3d,0x1cf));var _0xd7b3=function(_0x2b49d1,_0x59aa7f){_0x2b49d1=_0x2b49d1-0x0;var _0x22eb64=_0x7b3d[_0x2b49d1];return _0x22eb64;};'use strict';var _=require('lodash');var util=require(_0xd7b3('0x0'));var moment=require(_0xd7b3('0x1'));var md5=require(_0xd7b3('0x2'));var Redis=require(_0xd7b3('0x3'));var config=require(_0xd7b3('0x4'));config['redis']=_[_0xd7b3('0x5')](config['redis'],{'host':_0xd7b3('0x6'),'port':0x18eb});var io=require(_0xd7b3('0x7'))(new Redis(config[_0xd7b3('0x8')]));function Agent(_0x2197ef){this['id']=_0x2197ef['id']||0x0;this[_0xd7b3('0x9')]=_0x2197ef[_0xd7b3('0x9')]||'';this['email']=_0x2197ef[_0xd7b3('0xa')]||'';this['accountcode']=_0x2197ef[_0xd7b3('0xb')]||'';this['fullname']=_0x2197ef[_0xd7b3('0xc')]||'';this[_0xd7b3('0xd')]=_0xd7b3('0xe');this[_0xd7b3('0xf')]=0x0;this[_0xd7b3('0x10')]=_0xd7b3('0xe');this['address']='';this[_0xd7b3('0x11')]='';this['mobile']='';this[_0xd7b3('0x12')]='';this['online']=_0x2197ef['online']||![];this[_0xd7b3('0x13')]=_0xd7b3('0xe');this[_0xd7b3('0x14')]=0x0;this['voiceStatusCallerIdNumber']='';this['voiceStatusQueue']='';this[_0xd7b3('0x15')]=![];this[_0xd7b3('0x16')]=![];this['md5']='';}Agent[_0xd7b3('0x17')][_0xd7b3('0x18')]=function(_0x59fd67){var _0x22f231;if(_0x59fd67&&_0x59fd67[_0xd7b3('0xd')]){_0x22f231=_0x59fd67[_0xd7b3('0xd')][_0xd7b3('0x19')]();switch(_0x22f231){case _0xd7b3('0x1a'):_0x22f231=_0xd7b3('0x1b');break;case _0xd7b3('0x1c'):_0x22f231=_0xd7b3('0x1d');break;}}if(_0x22f231&&this[_0xd7b3('0x13')]!==_0x22f231||_0x59fd67[_0xd7b3('0x1e')]){this['voiceStatusTime']=_['toNumber'](moment()['format']('x'));}if(_0x22f231){this[_0xd7b3('0x13')]=_0x22f231;}var _0x49b9e5={'id':this['id'],'name':this['name'],'email':this['email'],'accountcode':this[_0xd7b3('0xb')],'fullname':this[_0xd7b3('0xc')],'state':this[_0xd7b3('0xd')],'stateTime':this[_0xd7b3('0xf')],'status':this[_0xd7b3('0x10')],'address':this['address'],'online':this[_0xd7b3('0x1f')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0xd7b3('0x14')],'voiceStatusCallerIdNumber':this[_0xd7b3('0x20')],'voiceStatusQueue':this[_0xd7b3('0x21')],'interface':this[_0xd7b3('0x12')],'onhold':this['onhold']};var _0x4839c6=md5(JSON['stringify'](_0x49b9e5));if(this['md5']!==_0x4839c6){this[_0xd7b3('0x2')]=_0x4839c6;io['to'](util[_0xd7b3('0x22')](_0xd7b3('0x23'),_0x49b9e5['name']))['emit'](_0xd7b3('0x24'),_[_0xd7b3('0x25')](_0x49b9e5,['online']));io['emit'](_0xd7b3('0x26'),_0x49b9e5);}};module[_0xd7b3('0x27')]=Agent; \ No newline at end of file +var _0xa491=['emit','exports','util','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','stateTime','status','unknown','address','phone','interface','online','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','talking','voiceStatus','statePause','format','onhold','stringify','user:%s'];(function(_0x3ce1af,_0x5a31d0){var _0x4da89=function(_0x484ca3){while(--_0x484ca3){_0x3ce1af['push'](_0x3ce1af['shift']());}};_0x4da89(++_0x5a31d0);}(_0xa491,0xc0));var _0x1a49=function(_0x5b3ad3,_0x527211){_0x5b3ad3=_0x5b3ad3-0x0;var _0x928e35=_0xa491[_0x5b3ad3];return _0x928e35;};'use strict';var _=require('lodash');var util=require(_0x1a49('0x0'));var moment=require('moment');var md5=require(_0x1a49('0x1'));var Redis=require(_0x1a49('0x2'));var config=require(_0x1a49('0x3'));config[_0x1a49('0x4')]=_[_0x1a49('0x5')](config[_0x1a49('0x4')],{'host':_0x1a49('0x6'),'port':0x18eb});var io=require(_0x1a49('0x7'))(new Redis(config['redis']));function Agent(_0x500043){this['id']=_0x500043['id']||0x0;this['name']=_0x500043[_0x1a49('0x8')]||'';this[_0x1a49('0x9')]=_0x500043[_0x1a49('0x9')]||'';this[_0x1a49('0xa')]=_0x500043[_0x1a49('0xa')]||'';this[_0x1a49('0xb')]=_0x500043[_0x1a49('0xb')]||'';this[_0x1a49('0xc')]='unknown';this[_0x1a49('0xd')]=0x0;this[_0x1a49('0xe')]=_0x1a49('0xf');this[_0x1a49('0x10')]='';this[_0x1a49('0x11')]='';this['mobile']='';this[_0x1a49('0x12')]='';this['online']=_0x500043[_0x1a49('0x13')]||![];this['voiceStatus']=_0x1a49('0xf');this[_0x1a49('0x14')]=0x0;this[_0x1a49('0x15')]='';this[_0x1a49('0x16')]='';this['onhold']=![];this[_0x1a49('0x17')]=![];this[_0x1a49('0x1')]='';}Agent[_0x1a49('0x18')][_0x1a49('0x19')]=function(_0x4cfa7e){var _0x9be843;if(_0x4cfa7e&&_0x4cfa7e['state']){_0x9be843=_0x4cfa7e[_0x1a49('0xc')][_0x1a49('0x1a')]();switch(_0x9be843){case _0x1a49('0x1b'):_0x9be843=_0x1a49('0x1c');break;case'inuse':_0x9be843=_0x1a49('0x1d');break;}}if(_0x9be843&&this[_0x1a49('0x1e')]!==_0x9be843||_0x4cfa7e[_0x1a49('0x1f')]){this['voiceStatusTime']=_['toNumber'](moment()[_0x1a49('0x20')]('x'));}if(_0x9be843){this[_0x1a49('0x1e')]=_0x9be843;}var _0x115cfe={'id':this['id'],'name':this[_0x1a49('0x8')],'email':this[_0x1a49('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x1a49('0xc')],'stateTime':this['stateTime'],'status':this[_0x1a49('0xe')],'address':this[_0x1a49('0x10')],'online':this[_0x1a49('0x13')],'voiceStatus':this[_0x1a49('0x1e')],'voiceStatusTime':this[_0x1a49('0x14')],'voiceStatusCallerIdNumber':this[_0x1a49('0x15')],'voiceStatusQueue':this[_0x1a49('0x16')],'interface':this[_0x1a49('0x12')],'onhold':this[_0x1a49('0x21')]};var _0x451dc5=md5(JSON[_0x1a49('0x22')](_0x115cfe));if(this[_0x1a49('0x1')]!==_0x451dc5){this[_0x1a49('0x1')]=_0x451dc5;io['to'](util[_0x1a49('0x20')](_0x1a49('0x23'),_0x115cfe[_0x1a49('0x8')]))['emit']('user:ami:update',_['omit'](_0x115cfe,[_0x1a49('0x13')]));io[_0x1a49('0x24')]('user:presence',_0x115cfe);}};module[_0x1a49('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 e7cfdcb..132ce91 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 _0x8af6=['temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','name','originated'];(function(_0x131679,_0x298f2b){var _0x3c8158=function(_0x53da41){while(--_0x53da41){_0x131679['push'](_0x131679['shift']());}};_0x3c8158(++_0x298f2b);}(_0x8af6,0xc2));var _0x68af=function(_0x2b67c3,_0x5cbb09){_0x2b67c3=_0x2b67c3-0x0;var _0x5c0b64=_0x8af6[_0x2b67c3];return _0x5c0b64;};'use strict';function Campaign(_0x141fa8){this['id']=_0x141fa8['id']||0x0;this[_0x68af('0x0')]=_0x141fa8[_0x68af('0x0')]||'';this['type']=_0x141fa8['type']||'campaign';this[_0x68af('0x1')]=0x0;this[_0x68af('0x2')]=0x0;this[_0x68af('0x3')]=0x0;this[_0x68af('0x4')]=0x0;this[_0x68af('0x5')]='';this[_0x68af('0x6')]=!![];this[_0x68af('0x7')]=_0x141fa8['active'];this['limitCalls']=_0x141fa8[_0x68af('0x8')];this[_0x68af('0x9')]=_0x141fa8[_0x68af('0x9')]||null;this['dialGlobalInterval']=_0x141fa8[_0x68af('0xa')]?_0x141fa8[_0x68af('0xa')]:null;this[_0x68af('0xb')]=_0x141fa8[_0x68af('0xb')];this[_0x68af('0xc')]=_0x141fa8[_0x68af('0xc')];this[_0x68af('0xd')]=_0x141fa8[_0x68af('0xd')]||0x1e;this['dialCongestionMaxRetry']=_0x141fa8['dialCongestionMaxRetry'];this[_0x68af('0xe')]=_0x141fa8[_0x68af('0xe')];this['dialBusyMaxRetry']=_0x141fa8['dialBusyMaxRetry'];this[_0x68af('0xf')]=_0x141fa8[_0x68af('0xf')];this[_0x68af('0x10')]=_0x141fa8[_0x68af('0x10')];this[_0x68af('0x11')]=_0x141fa8[_0x68af('0x11')];this[_0x68af('0x12')]=_0x141fa8[_0x68af('0x12')];this[_0x68af('0x13')]=_0x141fa8[_0x68af('0x13')]||0x3;this[_0x68af('0x14')]=_0x141fa8[_0x68af('0x14')]||0x96;this[_0x68af('0x15')]=_0x141fa8[_0x68af('0x15')]||0x3;this[_0x68af('0x16')]=_0x141fa8['dialDropRetryFrequency']||0x96;this['dialAbandonedMaxRetry']=_0x141fa8[_0x68af('0x17')]||0x3;this['dialAbandonedRetryFrequency']=_0x141fa8[_0x68af('0x18')]||0x96;this[_0x68af('0x19')]=_0x141fa8[_0x68af('0x19')]||0x3;this[_0x68af('0x1a')]=_0x141fa8['dialMachineRetryFrequency']||0x96;this[_0x68af('0x1b')]=_0x141fa8[_0x68af('0x1b')]||0x3;this[_0x68af('0x1c')]=_0x141fa8[_0x68af('0x1c')]||0x96;this[_0x68af('0x1d')]=_0x141fa8[_0x68af('0x1d')]||_0x68af('0x1e');this['dialPrefix']=_0x141fa8[_0x68af('0x1f')]||undefined;this[_0x68af('0x20')]=_0x141fa8[_0x68af('0x20')]||undefined;this[_0x68af('0x21')]=_0x141fa8['dialCutDigit']||undefined;this['TrunkBackup']=_0x141fa8['TrunkBackup']?_0x141fa8[_0x68af('0x22')]:undefined;this[_0x68af('0x23')]=_0x141fa8['Trunk']?_0x141fa8[_0x68af('0x23')]:undefined;this[_0x68af('0x24')]=_0x141fa8[_0x68af('0x24')]?_0x141fa8[_0x68af('0x24')]:undefined;this[_0x68af('0x25')]=_0x141fa8[_0x68af('0x25')]?_0x141fa8[_0x68af('0x25')]:undefined;this[_0x68af('0x26')]=_0x141fa8['SquareProject']?_0x141fa8[_0x68af('0x25')][_0x68af('0x0')]:undefined;this[_0x68af('0x27')]=_0x141fa8[_0x68af('0x27')]||![];this['dialAMDInitialSilence']=_0x141fa8[_0x68af('0x28')];this[_0x68af('0x29')]=_0x141fa8[_0x68af('0x29')];this['dialAMDAfterGreetingSilence']=_0x141fa8[_0x68af('0x2a')];this[_0x68af('0x2b')]=_0x141fa8[_0x68af('0x2b')];this[_0x68af('0x2c')]=_0x141fa8[_0x68af('0x2c')];this[_0x68af('0x2d')]=_0x141fa8[_0x68af('0x2d')];this[_0x68af('0x2e')]=_0x141fa8['dialAMDMaximumNumberOfWords'];this[_0x68af('0x2f')]=_0x141fa8[_0x68af('0x2f')];this[_0x68af('0x30')]=_0x141fa8[_0x68af('0x30')];}module['exports']=Campaign; \ No newline at end of file +var _0x85b1=['dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength'];(function(_0x190148,_0xda6bdd){var _0x5009de=function(_0x19c769){while(--_0x19c769){_0x190148['push'](_0x190148['shift']());}};_0x5009de(++_0xda6bdd);}(_0x85b1,0xcd));var _0x185b=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0x85b1[_0x20ef64];return _0x3707d8;};'use strict';function Campaign(_0x40fc84){this['id']=_0x40fc84['id']||0x0;this[_0x185b('0x0')]=_0x40fc84['name']||'';this[_0x185b('0x1')]=_0x40fc84[_0x185b('0x1')]||'campaign';this[_0x185b('0x2')]=0x0;this[_0x185b('0x3')]=0x0;this['ivrAnswerCallsDay']=0x0;this[_0x185b('0x4')]=0x0;this[_0x185b('0x5')]='';this[_0x185b('0x6')]=!![];this[_0x185b('0x7')]=_0x40fc84['active'];this[_0x185b('0x8')]=_0x40fc84['limitCalls'];this[_0x185b('0x9')]=_0x40fc84['dialTimezone']||null;this[_0x185b('0xa')]=_0x40fc84[_0x185b('0xa')]?_0x40fc84[_0x185b('0xa')]:null;this['dialOriginateCallerIdName']=_0x40fc84[_0x185b('0xb')];this[_0x185b('0xc')]=_0x40fc84[_0x185b('0xc')];this[_0x185b('0xd')]=_0x40fc84[_0x185b('0xd')]||0x1e;this[_0x185b('0xe')]=_0x40fc84[_0x185b('0xe')];this[_0x185b('0xf')]=_0x40fc84['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x40fc84[_0x185b('0x10')];this[_0x185b('0x11')]=_0x40fc84[_0x185b('0x11')];this[_0x185b('0x12')]=_0x40fc84[_0x185b('0x12')];this[_0x185b('0x13')]=_0x40fc84['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x40fc84[_0x185b('0x14')];this[_0x185b('0x15')]=_0x40fc84[_0x185b('0x15')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x40fc84['dialNoSuchNumberRetryFrequency']||0x96;this[_0x185b('0x16')]=_0x40fc84[_0x185b('0x16')]||0x3;this[_0x185b('0x17')]=_0x40fc84[_0x185b('0x17')]||0x96;this[_0x185b('0x18')]=_0x40fc84['dialAbandonedMaxRetry']||0x3;this[_0x185b('0x19')]=_0x40fc84['dialAbandonedRetryFrequency']||0x96;this['dialMachineMaxRetry']=_0x40fc84['dialMachineMaxRetry']||0x3;this[_0x185b('0x1a')]=_0x40fc84[_0x185b('0x1a')]||0x96;this[_0x185b('0x1b')]=_0x40fc84[_0x185b('0x1b')]||0x3;this[_0x185b('0x1c')]=_0x40fc84['dialAgentRejectRetryFrequency']||0x96;this[_0x185b('0x1d')]=_0x40fc84['dialOrderByScheduledAt']||_0x185b('0x1e');this['dialPrefix']=_0x40fc84[_0x185b('0x1f')]||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x40fc84[_0x185b('0x20')]||undefined;this[_0x185b('0x21')]=_0x40fc84[_0x185b('0x21')]||undefined;this[_0x185b('0x22')]=_0x40fc84[_0x185b('0x22')]?_0x40fc84['TrunkBackup']:undefined;this[_0x185b('0x23')]=_0x40fc84['Trunk']?_0x40fc84[_0x185b('0x23')]:undefined;this[_0x185b('0x24')]=_0x40fc84[_0x185b('0x24')]?_0x40fc84['Interval']:undefined;this[_0x185b('0x25')]=_0x40fc84[_0x185b('0x25')]?_0x40fc84[_0x185b('0x25')]:undefined;this[_0x185b('0x26')]=_0x40fc84[_0x185b('0x25')]?_0x40fc84[_0x185b('0x25')]['name']:undefined;this[_0x185b('0x27')]=_0x40fc84[_0x185b('0x27')]||![];this[_0x185b('0x28')]=_0x40fc84[_0x185b('0x28')];this[_0x185b('0x29')]=_0x40fc84['dialAMDGreeting'];this[_0x185b('0x2a')]=_0x40fc84[_0x185b('0x2a')];this['dialAMDTotalAnalysisTime']=_0x40fc84[_0x185b('0x2b')];this[_0x185b('0x2c')]=_0x40fc84[_0x185b('0x2c')];this[_0x185b('0x2d')]=_0x40fc84[_0x185b('0x2d')];this[_0x185b('0x2e')]=_0x40fc84[_0x185b('0x2e')];this[_0x185b('0x2f')]=_0x40fc84['dialAMDSilenceThreshold'];this[_0x185b('0x30')]=_0x40fc84[_0x185b('0x30')];}module[_0x185b('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 74cbe13..8714482 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 _0x0c19=['lastdata','duration','billableseconds','type','tag','monitor','monitors','transferconnectedlinenum','transferType','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','accountcode','context','uniqueid','exten','answered','endtime','unmanaged','abandoned','lastapplication'];(function(_0x38f69c,_0x3c8b14){var _0x17e74e=function(_0x15d616){while(--_0x15d616){_0x38f69c['push'](_0x38f69c['shift']());}};_0x17e74e(++_0x3c8b14);}(_0x0c19,0xf5));var _0x90c1=function(_0x3c1358,_0x318ad0){_0x3c1358=_0x3c1358-0x0;var _0x435442=_0x0c19[_0x3c1358];return _0x435442;};'use strict';function Channel(){this[_0x90c1('0x0')]=null;this[_0x90c1('0x1')]='';this[_0x90c1('0x2')]='';this[_0x90c1('0x3')]=0x0;this[_0x90c1('0x4')]='';this[_0x90c1('0x5')]=undefined;this['connectedlinename']=undefined;this[_0x90c1('0x6')]=0x0;this[_0x90c1('0x7')]='';this[_0x90c1('0x8')]=0x0;this['linkedid']=0x0;this[_0x90c1('0x9')]=0x0;this[_0x90c1('0xa')]=![];this['answertime']=null;this[_0x90c1('0xb')]=null;this[_0x90c1('0xc')]=![];this[_0x90c1('0xd')]=![];this[_0x90c1('0xe')]='';this[_0x90c1('0xf')]='';this[_0x90c1('0x10')]=0x0;this[_0x90c1('0x11')]=0x0;this['holdtime']=0x0;this[_0x90c1('0x12')]=null;this[_0x90c1('0x13')]=null;this['disposition']=null;this[_0x90c1('0x14')]=![];this['monitorFilename']=null;this['queue']=null;this[_0x90c1('0x15')]=[];this['transfercalleridnum']=undefined;this[_0x90c1('0x16')]=undefined;this[_0x90c1('0x17')]=undefined;this[_0x90c1('0x18')]=0x0;}module[_0x90c1('0x19')]=Channel; \ No newline at end of file +var _0x87e5=['uniqueid','linkedid','exten','answertime','endtime','unmanaged','abandoned','lastapplication','tag','disposition','monitor','monitorFilename','queue','monitors','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','starttime','channel','calleridnum','calleridname','connectedlinename','accountcode','context'];(function(_0x5d7f51,_0x366ea7){var _0x3385ae=function(_0x426b14){while(--_0x426b14){_0x5d7f51['push'](_0x5d7f51['shift']());}};_0x3385ae(++_0x366ea7);}(_0x87e5,0xc1));var _0x587e=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0x87e5[_0x19babd];return _0x314eaf;};'use strict';function Channel(){this[_0x587e('0x0')]=null;this[_0x587e('0x1')]='';this['destinationchannel']='';this[_0x587e('0x2')]=0x0;this[_0x587e('0x3')]='';this['connectedlinenum']=undefined;this[_0x587e('0x4')]=undefined;this[_0x587e('0x5')]=0x0;this[_0x587e('0x6')]='';this[_0x587e('0x7')]=0x0;this[_0x587e('0x8')]=0x0;this[_0x587e('0x9')]=0x0;this['answered']=![];this[_0x587e('0xa')]=null;this[_0x587e('0xb')]=null;this[_0x587e('0xc')]=![];this[_0x587e('0xd')]=![];this[_0x587e('0xe')]='';this['lastdata']='';this['duration']=0x0;this['billableseconds']=0x0;this['holdtime']=0x0;this['type']=null;this[_0x587e('0xf')]=null;this[_0x587e('0x10')]=null;this[_0x587e('0x11')]=![];this[_0x587e('0x12')]=null;this[_0x587e('0x13')]=null;this[_0x587e('0x14')]=[];this[_0x587e('0x15')]=undefined;this[_0x587e('0x16')]=undefined;this[_0x587e('0x17')]=undefined;this[_0x587e('0x18')]=0x0;}module['exports']=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index f044977..f11632a 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 _0xef2f=['username','remoteUri','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name'];(function(_0x44c3d9,_0x507687){var _0x69eb1b=function(_0xf759dd){while(--_0xf759dd){_0x44c3d9['push'](_0x44c3d9['shift']());}};_0x69eb1b(++_0x507687);}(_0xef2f,0x18b));var _0xfef2=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xef2f[_0x40ac5e];return _0x2839d6;};'use strict';function DeskAccount(_0x448644){this['id']=_0x448644['id']||0x0;this[_0xfef2('0x0')]=_0x448644[_0xfef2('0x0')]||'';this[_0xfef2('0x1')]=_0x448644[_0xfef2('0x1')]||'';this[_0xfef2('0x2')]=_0x448644[_0xfef2('0x2')]||'';this['authType']=_0x448644['authType']||'';this['password']=_0x448644[_0xfef2('0x3')]||'';this[_0xfef2('0x4')]=_0x448644[_0xfef2('0x4')]||'';this[_0xfef2('0x5')]=_0x448644[_0xfef2('0x5')]||'';this[_0xfef2('0x6')]=_0x448644[_0xfef2('0x6')]||'';this[_0xfef2('0x7')]=_0x448644['tokenSecret']||'';this[_0xfef2('0x8')]=_0x448644[_0xfef2('0x8')]||'';this[_0xfef2('0x9')]=_0x448644[_0xfef2('0x9')]||'';this[_0xfef2('0xa')]=_0x448644['Configurations']||{};}module[_0xfef2('0xb')]=DeskAccount; \ No newline at end of file +var _0x2993=['name','username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x40d25d,_0x2e3f87){var _0xcb2ebe=function(_0xa82ba2){while(--_0xa82ba2){_0x40d25d['push'](_0x40d25d['shift']());}};_0xcb2ebe(++_0x2e3f87);}(_0x2993,0x82));var _0x3299=function(_0x14f0ac,_0x11799e){_0x14f0ac=_0x14f0ac-0x0;var _0x5400a3=_0x2993[_0x14f0ac];return _0x5400a3;};'use strict';function DeskAccount(_0x5301f8){this['id']=_0x5301f8['id']||0x0;this[_0x3299('0x0')]=_0x5301f8['name']||'';this[_0x3299('0x1')]=_0x5301f8[_0x3299('0x1')]||'';this[_0x3299('0x2')]=_0x5301f8[_0x3299('0x2')]||'';this['authType']=_0x5301f8[_0x3299('0x3')]||'';this[_0x3299('0x4')]=_0x5301f8[_0x3299('0x4')]||'';this[_0x3299('0x5')]=_0x5301f8[_0x3299('0x5')]||'';this['consumerSecret']=_0x5301f8[_0x3299('0x6')]||'';this[_0x3299('0x7')]=_0x5301f8[_0x3299('0x7')]||'';this[_0x3299('0x8')]=_0x5301f8['tokenSecret']||'';this[_0x3299('0x9')]=_0x5301f8[_0x3299('0x9')]||'';this[_0x3299('0xa')]=_0x5301f8[_0x3299('0xa')]||'';this[_0x3299('0xb')]=_0x5301f8[_0x3299('0xb')]||{};}module[_0x3299('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index ad379d9..df94ca7 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 _0x87c8=['name','username','password','remoteUri','tenantId','clientId','clientSecret','modernAuthentication','Configurations','CloudProvider','exports'];(function(_0x1d9246,_0x354366){var _0x1f9141=function(_0x582883){while(--_0x582883){_0x1d9246['push'](_0x1d9246['shift']());}};_0x1f9141(++_0x354366);}(_0x87c8,0xa5));var _0x887c=function(_0x51c819,_0xd812db){_0x51c819=_0x51c819-0x0;var _0x15c5d2=_0x87c8[_0x51c819];return _0x15c5d2;};'use strict';function Dynamics365Account(_0x3781e8){this['id']=_0x3781e8['id']||0x0;this[_0x887c('0x0')]=_0x3781e8[_0x887c('0x0')]||'';this['username']=_0x3781e8[_0x887c('0x1')]||'';this['password']=_0x3781e8[_0x887c('0x2')]||'';this['remoteUri']=_0x3781e8[_0x887c('0x3')]||'';this[_0x887c('0x4')]=_0x3781e8[_0x887c('0x4')]||'';this[_0x887c('0x5')]=_0x3781e8[_0x887c('0x5')]||'';this['clientSecret']=_0x3781e8[_0x887c('0x6')]||{};this['serverUrl']=_0x3781e8['serverUrl']||'';this[_0x887c('0x7')]=_0x3781e8[_0x887c('0x7')]||![];this['Configurations']=_0x3781e8[_0x887c('0x8')]||{};this[_0x887c('0x9')]=_0x3781e8[_0x887c('0x9')]||{};}module[_0x887c('0xa')]=Dynamics365Account; \ No newline at end of file +var _0x70f2=['serverUrl','modernAuthentication','Configurations','CloudProvider','name','password','remoteUri','tenantId','clientId','clientSecret'];(function(_0x166b7c,_0x5d0f69){var _0x44be9f=function(_0x27c7c6){while(--_0x27c7c6){_0x166b7c['push'](_0x166b7c['shift']());}};_0x44be9f(++_0x5d0f69);}(_0x70f2,0xae));var _0x270f=function(_0xd009b,_0x4c12be){_0xd009b=_0xd009b-0x0;var _0x36e21b=_0x70f2[_0xd009b];return _0x36e21b;};'use strict';function Dynamics365Account(_0x563f76){this['id']=_0x563f76['id']||0x0;this['name']=_0x563f76[_0x270f('0x0')]||'';this['username']=_0x563f76['username']||'';this[_0x270f('0x1')]=_0x563f76[_0x270f('0x1')]||'';this['remoteUri']=_0x563f76[_0x270f('0x2')]||'';this[_0x270f('0x3')]=_0x563f76[_0x270f('0x3')]||'';this[_0x270f('0x4')]=_0x563f76[_0x270f('0x4')]||'';this[_0x270f('0x5')]=_0x563f76[_0x270f('0x5')]||{};this[_0x270f('0x6')]=_0x563f76[_0x270f('0x6')]||'';this['modernAuthentication']=_0x563f76[_0x270f('0x7')]||![];this['Configurations']=_0x563f76[_0x270f('0x8')]||{};this[_0x270f('0x9')]=_0x563f76[_0x270f('0x9')]||{};}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 ba74112..bb1a4f0 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 _0x04b4=['modem','v17,v27,v29','gateway','faxdetect','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate'];(function(_0x169ce3,_0x229916){var _0x3298f5=function(_0x53c3ba){while(--_0x53c3ba){_0x169ce3['push'](_0x169ce3['shift']());}};_0x3298f5(++_0x229916);}(_0x04b4,0xd6));var _0x404b=function(_0x4f17ec,_0x32d016){_0x4f17ec=_0x4f17ec-0x0;var _0x322022=_0x04b4[_0x4f17ec];return _0x322022;};'use strict';function FaxAccount(_0x3ed4b3){this['id']=_0x3ed4b3['id']||0x0;this[_0x404b('0x0')]=_0x3ed4b3[_0x404b('0x0')]||'';this[_0x404b('0x1')]=_0x3ed4b3[_0x404b('0x1')];this[_0x404b('0x2')]=_0x3ed4b3['ecm'];this[_0x404b('0x3')]=_0x3ed4b3[_0x404b('0x3')];this['localstationid']=_0x3ed4b3[_0x404b('0x4')];this[_0x404b('0x5')]=_0x3ed4b3['minrate']||0x960;this[_0x404b('0x6')]=_0x3ed4b3[_0x404b('0x6')]||0x3840;this[_0x404b('0x7')]=_0x3ed4b3['modem']||_0x404b('0x8');this[_0x404b('0x9')]=_0x3ed4b3[_0x404b('0x9')]||'no';this['faxdetect']=_0x3ed4b3[_0x404b('0xa')]||'no';this['t38timeout']=_0x3ed4b3['t38timeout']||0x1388;this[_0x404b('0xb')]=_0x3ed4b3['tech']||_0x404b('0xc');this[_0x404b('0xd')]=_0x3ed4b3[_0x404b('0xd')]?_0x3ed4b3[_0x404b('0xd')]:undefined;this[_0x404b('0xe')]=_0x3ed4b3['ListId'];this[_0x404b('0xf')]=_0x3ed4b3[_0x404b('0xf')];}module[_0x404b('0x10')]=FaxAccount; \ No newline at end of file +var _0x3986=['exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key'];(function(_0x4cfe90,_0x3da8fb){var _0x13591e=function(_0x3f1281){while(--_0x3f1281){_0x4cfe90['push'](_0x4cfe90['shift']());}};_0x13591e(++_0x3da8fb);}(_0x3986,0x157));var _0x6398=function(_0x50ca3a,_0x3db23e){_0x50ca3a=_0x50ca3a-0x0;var _0x14aed5=_0x3986[_0x50ca3a];return _0x14aed5;};'use strict';function FaxAccount(_0x301deb){this['id']=_0x301deb['id']||0x0;this[_0x6398('0x0')]=_0x301deb['name']||'';this[_0x6398('0x1')]=_0x301deb[_0x6398('0x1')];this[_0x6398('0x2')]=_0x301deb['ecm'];this[_0x6398('0x3')]=_0x301deb[_0x6398('0x3')];this[_0x6398('0x4')]=_0x301deb[_0x6398('0x4')];this[_0x6398('0x5')]=_0x301deb[_0x6398('0x5')]||0x960;this['maxrate']=_0x301deb[_0x6398('0x6')]||0x3840;this[_0x6398('0x7')]=_0x301deb[_0x6398('0x7')]||_0x6398('0x8');this[_0x6398('0x9')]=_0x301deb['gateway']||'no';this[_0x6398('0xa')]=_0x301deb[_0x6398('0xa')]||'no';this[_0x6398('0xb')]=_0x301deb[_0x6398('0xb')]||0x1388;this[_0x6398('0xc')]=_0x301deb[_0x6398('0xc')]||_0x6398('0xd');this[_0x6398('0xe')]=_0x301deb[_0x6398('0xe')]?_0x301deb[_0x6398('0xe')]:undefined;this[_0x6398('0xf')]=_0x301deb[_0x6398('0xf')];this[_0x6398('0x10')]=_0x301deb[_0x6398('0x10')];}module[_0x6398('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index f6210e9..2410523 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 _0x77b7=['exports','name','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x52e718,_0x37c582){var _0x20ffb4=function(_0xb76e39){while(--_0xb76e39){_0x52e718['push'](_0x52e718['shift']());}};_0x20ffb4(++_0x37c582);}(_0x77b7,0x1c1));var _0x777b=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x77b7[_0x5b644e];return _0x49c6bf;};'use strict';function FreshdeskAccount(_0x187b3e){this['id']=_0x187b3e['id']||0x0;this[_0x777b('0x0')]=_0x187b3e[_0x777b('0x0')]||'';this['username']=_0x187b3e['username']||'';this[_0x777b('0x1')]=_0x187b3e[_0x777b('0x2')]||'';this[_0x777b('0x3')]=_0x187b3e[_0x777b('0x3')]||'';this[_0x777b('0x4')]=_0x187b3e[_0x777b('0x4')]||'';this['Configurations']=_0x187b3e[_0x777b('0x5')]||{};}module[_0x777b('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0xbf90=['remoteUri','serverUrl','Configurations','exports','username'];(function(_0x3b81d4,_0x528913){var _0x718d0c=function(_0x226e06){while(--_0x226e06){_0x3b81d4['push'](_0x3b81d4['shift']());}};_0x718d0c(++_0x528913);}(_0xbf90,0x13a));var _0x0bf9=function(_0x36ccc0,_0x33e6e2){_0x36ccc0=_0x36ccc0-0x0;var _0x2e978d=_0xbf90[_0x36ccc0];return _0x2e978d;};'use strict';function FreshdeskAccount(_0x248ca7){this['id']=_0x248ca7['id']||0x0;this['name']=_0x248ca7['name']||'';this['username']=_0x248ca7[_0x0bf9('0x0')]||'';this['apiKey']=_0x248ca7['token']||'';this[_0x0bf9('0x1')]=_0x248ca7[_0x0bf9('0x1')]||'';this[_0x0bf9('0x2')]=_0x248ca7[_0x0bf9('0x2')]||'';this[_0x0bf9('0x3')]=_0x248ca7['Configurations']||{};}module[_0x0bf9('0x4')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 4c4332b..25d903d 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 _0x2c24=['apiKey','token','remoteUri','serverUrl','Configurations','exports','name','username'];(function(_0x17141f,_0x4d7c4b){var _0x3ee900=function(_0x5ec0f4){while(--_0x5ec0f4){_0x17141f['push'](_0x17141f['shift']());}};_0x3ee900(++_0x4d7c4b);}(_0x2c24,0x1e6));var _0x42c2=function(_0xf32c5a,_0x5d0a3f){_0xf32c5a=_0xf32c5a-0x0;var _0x14b92d=_0x2c24[_0xf32c5a];return _0x14b92d;};'use strict';function FreshsalesAccount(_0x4e4493){this['id']=_0x4e4493['id']||0x0;this[_0x42c2('0x0')]=_0x4e4493[_0x42c2('0x0')]||'';this[_0x42c2('0x1')]=_0x4e4493[_0x42c2('0x1')]||'';this[_0x42c2('0x2')]=_0x4e4493[_0x42c2('0x3')]||'';this[_0x42c2('0x4')]=_0x4e4493[_0x42c2('0x4')]||'';this['serverUrl']=_0x4e4493[_0x42c2('0x5')]||'';this[_0x42c2('0x6')]=_0x4e4493['Configurations']||{};}module[_0x42c2('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x9957=['serverUrl','Configurations','exports','name','username','apiKey','token','remoteUri'];(function(_0x3c92a0,_0x18fde2){var _0x136d77=function(_0x1426cf){while(--_0x1426cf){_0x3c92a0['push'](_0x3c92a0['shift']());}};_0x136d77(++_0x18fde2);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'use strict';function FreshsalesAccount(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['username']||'';this[_0x7995('0x2')]=_0x202794[_0x7995('0x3')]||'';this[_0x7995('0x4')]=_0x202794[_0x7995('0x4')]||'';this['serverUrl']=_0x202794[_0x7995('0x5')]||'';this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||{};}module[_0x7995('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 421bd18..f3f2bf5 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 _0xce67=['calleridnum','calleridname','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallerexit','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','exten','priority','assigned','motionChannel','voice','mohtime','variables','exports','type','uniqueid'];(function(_0x17ec4f,_0x7311ad){var _0x92afb9=function(_0x528908){while(--_0x528908){_0x17ec4f['push'](_0x17ec4f['shift']());}};_0x92afb9(++_0x7311ad);}(_0xce67,0x1ae));var _0x7ce6=function(_0x5c788b,_0x2bb446){_0x5c788b=_0x5c788b-0x0;var _0x21d67a=_0xce67[_0x5c788b];return _0x21d67a;};'use strict';function QueueReport(){this[_0x7ce6('0x0')]='inbound';this[_0x7ce6('0x1')]='';this[_0x7ce6('0x2')]='';this[_0x7ce6('0x3')]='';this['queue']='';this['queuecallerjoinAt']=null;this[_0x7ce6('0x4')]=null;this[_0x7ce6('0x5')]=0x1;this[_0x7ce6('0x6')]=0x1;this[_0x7ce6('0x7')]=![];this['queuecallerabandonAt']=null;this[_0x7ce6('0x8')]=![];this['queuecallercompleteAt']=null;this[_0x7ce6('0x9')]=![];this[_0x7ce6('0xa')]=null;this[_0x7ce6('0xb')]=0x1;this['channel']='';this[_0x7ce6('0xc')]='';this[_0x7ce6('0xd')]='';this[_0x7ce6('0xe')]='';this[_0x7ce6('0xf')]='';this[_0x7ce6('0x10')]='';this[_0x7ce6('0x11')]='';this['holdtime']=0x0;this[_0x7ce6('0x12')]=![];this['lastAssignedTo']='';this[_0x7ce6('0x13')]=_0x7ce6('0x14');this[_0x7ce6('0x15')]=0x0;this[_0x7ce6('0x16')]={};}module[_0x7ce6('0x17')]=QueueReport; \ No newline at end of file +var _0x0321=['accountcode','context','exten','assigned','lastAssignedTo','motionChannel','voice','mohtime','exports','type','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum'];(function(_0x36f125,_0x54d5f9){var _0x2a7dbf=function(_0xb1ba8d){while(--_0xb1ba8d){_0x36f125['push'](_0x36f125['shift']());}};_0x2a7dbf(++_0x54d5f9);}(_0x0321,0x1d4));var _0x1032=function(_0x5b6b0d,_0x5197a4){_0x5b6b0d=_0x5b6b0d-0x0;var _0x1504bb=_0x0321[_0x5b6b0d];return _0x1504bb;};'use strict';function QueueReport(){this[_0x1032('0x0')]=_0x1032('0x1');this[_0x1032('0x2')]='';this[_0x1032('0x3')]='';this[_0x1032('0x4')]='';this[_0x1032('0x5')]='';this[_0x1032('0x6')]=null;this['queuecallerleaveAt']=null;this[_0x1032('0x7')]=0x1;this[_0x1032('0x8')]=0x1;this[_0x1032('0x9')]=![];this[_0x1032('0xa')]=null;this[_0x1032('0xb')]=![];this[_0x1032('0xc')]=null;this[_0x1032('0xd')]=![];this[_0x1032('0xe')]=null;this[_0x1032('0xf')]=0x1;this[_0x1032('0x10')]='';this[_0x1032('0x11')]='';this['connectedlinename']='';this[_0x1032('0x12')]='';this[_0x1032('0x13')]='';this[_0x1032('0x14')]='';this['priority']='';this['holdtime']=0x0;this[_0x1032('0x15')]=![];this[_0x1032('0x16')]='';this[_0x1032('0x17')]=_0x1032('0x18');this[_0x1032('0x19')]=0x0;this['variables']={};}module[_0x1032('0x1a')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 79ec09b..70e57c5 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 _0xef4d=['password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username','remoteUri'];(function(_0x4017b0,_0x4347db){var _0x5ed4f7=function(_0x706c26){while(--_0x706c26){_0x4017b0['push'](_0x4017b0['shift']());}};_0x5ed4f7(++_0x4347db);}(_0xef4d,0x165));var _0xdef4=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xef4d[_0x138adb];return _0x1b27f2;};'use strict';function SalesforceAccount(_0x35665b){this['id']=_0x35665b['id']||0x0;this[_0xdef4('0x0')]=_0x35665b[_0xdef4('0x0')]||'';this[_0xdef4('0x1')]=_0x35665b[_0xdef4('0x1')]||'';this[_0xdef4('0x2')]=_0x35665b[_0xdef4('0x2')]||'';this[_0xdef4('0x3')]=_0x35665b[_0xdef4('0x3')]||'';this[_0xdef4('0x4')]=_0x35665b[_0xdef4('0x4')]||'';this[_0xdef4('0x5')]=_0x35665b[_0xdef4('0x5')]||'';this['securityToken']=_0x35665b[_0xdef4('0x6')]||'';this[_0xdef4('0x7')]=_0x35665b[_0xdef4('0x7')]||_0xdef4('0x8');this[_0xdef4('0x9')]=_0x35665b[_0xdef4('0x9')]||'';this[_0xdef4('0xa')]=_0x35665b[_0xdef4('0xa')]||{};}module[_0xdef4('0xb')]=SalesforceAccount; \ No newline at end of file +var _0x2922=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x2922,0x107));var _0x2292=function(_0x14271b,_0x303f86){_0x14271b=_0x14271b-0x0;var _0x2d8f24=_0x2922[_0x14271b];return _0x2d8f24;};'use strict';function SalesforceAccount(_0x15f139){this['id']=_0x15f139['id']||0x0;this['name']=_0x15f139[_0x2292('0x0')]||'';this[_0x2292('0x1')]=_0x15f139[_0x2292('0x1')]||'';this['remoteUri']=_0x15f139[_0x2292('0x2')]||'';this[_0x2292('0x3')]=_0x15f139['password']||'';this[_0x2292('0x4')]=_0x15f139[_0x2292('0x4')]||'';this['clientSecret']=_0x15f139[_0x2292('0x5')]||'';this[_0x2292('0x6')]=_0x15f139[_0x2292('0x6')]||'';this[_0x2292('0x7')]=_0x15f139[_0x2292('0x7')]||_0x2292('0x8');this['serverUrl']=_0x15f139[_0x2292('0x9')]||'';this[_0x2292('0xa')]=_0x15f139[_0x2292('0xa')]||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index a67dbc9..262ec27 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 _0xb082=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x21b36c,_0x543483){var _0x236627=function(_0x174f99){while(--_0x174f99){_0x21b36c['push'](_0x21b36c['shift']());}};_0x236627(++_0x543483);}(_0xb082,0x129));var _0x2b08=function(_0x5a8b85,_0x5d1417){_0x5a8b85=_0x5a8b85-0x0;var _0x27e843=_0xb082[_0x5a8b85];return _0x27e843;};'use strict';function ServicenowAccount(_0x385944){this['id']=_0x385944['id']||0x0;this[_0x2b08('0x0')]=_0x385944['name']||'';this['username']=_0x385944[_0x2b08('0x1')]||'';this[_0x2b08('0x2')]=_0x385944[_0x2b08('0x2')]||'';this[_0x2b08('0x3')]=_0x385944[_0x2b08('0x3')]||'';this[_0x2b08('0x4')]=_0x385944[_0x2b08('0x4')]||'';this[_0x2b08('0x5')]=_0x385944[_0x2b08('0x5')]||{};}module[_0x2b08('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x99bf=['Configurations','exports','name','username','password','remoteUri','serverUrl'];(function(_0x1ee0a1,_0x51058e){var _0x1d2d5b=function(_0x35cfb5){while(--_0x35cfb5){_0x1ee0a1['push'](_0x1ee0a1['shift']());}};_0x1d2d5b(++_0x51058e);}(_0x99bf,0xa3));var _0xf99b=function(_0x54e856,_0x313d5c){_0x54e856=_0x54e856-0x0;var _0x124873=_0x99bf[_0x54e856];return _0x124873;};'use strict';function ServicenowAccount(_0x21b144){this['id']=_0x21b144['id']||0x0;this[_0xf99b('0x0')]=_0x21b144['name']||'';this[_0xf99b('0x1')]=_0x21b144[_0xf99b('0x1')]||'';this[_0xf99b('0x2')]=_0x21b144[_0xf99b('0x2')]||'';this['remoteUri']=_0x21b144[_0xf99b('0x3')]||'';this[_0xf99b('0x4')]=_0x21b144[_0xf99b('0x4')]||'';this[_0xf99b('0x5')]=_0x21b144[_0xf99b('0x5')]||{};}module[_0xf99b('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 01ad8fb..07c57b9 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 _0x689c=['remoteUri','serverUrl','Configurations','exports','name','username','password'];(function(_0x30476a,_0x11f97e){var _0x56e66c=function(_0x5ea604){while(--_0x5ea604){_0x30476a['push'](_0x30476a['shift']());}};_0x56e66c(++_0x11f97e);}(_0x689c,0x9e));var _0xc689=function(_0x8bde1c,_0x16b915){_0x8bde1c=_0x8bde1c-0x0;var _0x241e7a=_0x689c[_0x8bde1c];return _0x241e7a;};'use strict';function SugarcrmAccount(_0x57fc19){this['id']=_0x57fc19['id']||0x0;this['name']=_0x57fc19[_0xc689('0x0')]||'';this[_0xc689('0x1')]=_0x57fc19[_0xc689('0x1')]||'';this[_0xc689('0x2')]=_0x57fc19[_0xc689('0x2')]||'';this[_0xc689('0x3')]=_0x57fc19['remoteUri']||'';this[_0xc689('0x4')]=_0x57fc19['serverUrl']||'';this['Configurations']=_0x57fc19[_0xc689('0x5')]||{};}module[_0xc689('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0x397a=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x4c18e5,_0x139810){var _0x32129a=function(_0x3faf9f){while(--_0x3faf9f){_0x4c18e5['push'](_0x4c18e5['shift']());}};_0x32129a(++_0x139810);}(_0x397a,0x9d));var _0xa397=function(_0x20a599,_0x4e5a44){_0x20a599=_0x20a599-0x0;var _0x5dac8f=_0x397a[_0x20a599];return _0x5dac8f;};'use strict';function SugarcrmAccount(_0x279eb1){this['id']=_0x279eb1['id']||0x0;this[_0xa397('0x0')]=_0x279eb1[_0xa397('0x0')]||'';this[_0xa397('0x1')]=_0x279eb1['username']||'';this[_0xa397('0x2')]=_0x279eb1[_0xa397('0x2')]||'';this[_0xa397('0x3')]=_0x279eb1[_0xa397('0x3')]||'';this[_0xa397('0x4')]=_0x279eb1['serverUrl']||'';this[_0xa397('0x5')]=_0x279eb1['Configurations']||{};}module[_0xa397('0x6')]=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index cc7067f..0f859b3 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 _0xae3f=['state','unknown','stateTime','status','address','exports','name','accountcode'];(function(_0x4990c1,_0x442d33){var _0x37715e=function(_0x12e115){while(--_0x12e115){_0x4990c1['push'](_0x4990c1['shift']());}};_0x37715e(++_0x442d33);}(_0xae3f,0x136));var _0xfae3=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xae3f[_0x1da527];return _0x40fc7c;};'use strict';function Telephone(_0x11eacf){this['id']=_0x11eacf['id']||0x0;this[_0xfae3('0x0')]=_0x11eacf[_0xfae3('0x0')]||'';this[_0xfae3('0x1')]=_0x11eacf[_0xfae3('0x1')]||'';this[_0xfae3('0x2')]=_0xfae3('0x3');this[_0xfae3('0x4')]=0x0;this[_0xfae3('0x5')]=_0xfae3('0x3');this[_0xfae3('0x6')]='';}module[_0xfae3('0x7')]=Telephone; \ No newline at end of file +var _0x62c0=['unknown','address','exports','name','accountcode','stateTime'];(function(_0x1199f3,_0x32f799){var _0x8932a2=function(_0x290b90){while(--_0x290b90){_0x1199f3['push'](_0x1199f3['shift']());}};_0x8932a2(++_0x32f799);}(_0x62c0,0xdb));var _0x062c=function(_0x1bc0ae,_0x439dfe){_0x1bc0ae=_0x1bc0ae-0x0;var _0x501104=_0x62c0[_0x1bc0ae];return _0x501104;};'use strict';function Telephone(_0x48d51f){this['id']=_0x48d51f['id']||0x0;this[_0x062c('0x0')]=_0x48d51f[_0x062c('0x0')]||'';this[_0x062c('0x1')]=_0x48d51f['accountcode']||'';this['state']='unknown';this[_0x062c('0x2')]=0x0;this['status']=_0x062c('0x3');this[_0x062c('0x4')]='';}module[_0x062c('0x5')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 3d65206..b0263f0 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(_0x3a82cb,_0x455170){var _0x5ae24c=function(_0x34c465){while(--_0x34c465){_0x3a82cb['push'](_0x3a82cb['shift']());}};_0x5ae24c(++_0x455170);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xa9e0[_0x1c546c];return _0x2cc384;};'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 _0xb10b=['name','html'];(function(_0x577fb8,_0xde0574){var _0x175ac6=function(_0x53c0cd){while(--_0x53c0cd){_0x577fb8['push'](_0x577fb8['shift']());}};_0x175ac6(++_0xde0574);}(_0xb10b,0x12a));var _0xbb10=function(_0x4be3e7,_0x3a7f05){_0x4be3e7=_0x4be3e7-0x0;var _0x4d44a0=_0xb10b[_0x4be3e7];return _0x4d44a0;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 5c7b0f9..a2fe5c0 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 _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x26a5cf,_0x31be5f){var _0x4c5568=function(_0x2ef8ae){while(--_0x2ef8ae){_0x26a5cf['push'](_0x26a5cf['shift']());}};_0x4c5568(++_0x31be5f);}(_0x4fc2,0x111));var _0x24fc=function(_0x371f0d,_0x5cfcc2){_0x371f0d=_0x371f0d-0x0;var _0x1728a4=_0x4fc2[_0x371f0d];return _0x1728a4;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xda2d=['channel','voice','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x2c795e,_0xf48253){var _0x1e334b=function(_0x65699b){while(--_0x65699b){_0x2c795e['push'](_0x2c795e['shift']());}};_0x1e334b(++_0xf48253);}(_0xda2d,0x102));var _0xdda2=function(_0x1e2b9f,_0x2ea507){_0x1e2b9f=_0x1e2b9f-0x0;var _0x49b4e6=_0xda2d[_0x1e2b9f];return _0x49b4e6;};'use strict';function Trigger(_0x2625ed){this['id']=_0x2625ed['id']||0x0;this[_0xdda2('0x0')]=_0x2625ed[_0xdda2('0x0')]||'';this[_0xdda2('0x1')]=_0x2625ed[_0xdda2('0x1')]||_0xdda2('0x2');this['status']=_0x2625ed['status']||![];this['AllConditions']=_0x2625ed[_0xdda2('0x3')]||[];this[_0xdda2('0x4')]=_0x2625ed[_0xdda2('0x4')]||[];this[_0xdda2('0x5')]=_0x2625ed[_0xdda2('0x5')]||[];}module[_0xdda2('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 c781381..a19d13d 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 _0x306f=['exports','active','name','state','unknown','stateTime','registry','indexOf','port','domain','refresh','stateRegistry'];(function(_0x555bbd,_0x196748){var _0x3184d7=function(_0x274943){while(--_0x274943){_0x555bbd['push'](_0x555bbd['shift']());}};_0x3184d7(++_0x196748);}(_0x306f,0x109));var _0xf306=function(_0x2e7044,_0x5409b8){_0x2e7044=_0x2e7044-0x0;var _0x26a3c2=_0x306f[_0x2e7044];return _0x26a3c2;};'use strict';function Trunk(_0x1a1695){this['id']=_0x1a1695['id']||0x0;this[_0xf306('0x0')]=_0x1a1695[_0xf306('0x0')]||![];this[_0xf306('0x1')]=_0x1a1695[_0xf306('0x1')]||'';this[_0xf306('0x2')]=_0xf306('0x3');this[_0xf306('0x4')]=0x0;this['status']=_0xf306('0x3');this[_0xf306('0x5')]=_0x1a1695[_0xf306('0x5')]&&_0x1a1695[_0xf306('0x5')][_0xf306('0x6')](':')?_0x1a1695[_0xf306('0x5')]['split'](':')[0x0]:'';this['host']='';this[_0xf306('0x7')]='';this[_0xf306('0x8')]='';this['domainport']='';this[_0xf306('0x9')]='';this[_0xf306('0xa')]=_0xf306('0x3');this['registrationtime']='';this['address']='';this['defaultuser']=_0x1a1695['defaultuser']||'';}module[_0xf306('0xb')]=Trunk; \ No newline at end of file +var _0x0d48=['exports','active','name','state','stateTime','status','registry','split','port','domainport','unknown','address','defaultuser'];(function(_0x211a6a,_0x282ee7){var _0x3cd9c9=function(_0x42c6f3){while(--_0x42c6f3){_0x211a6a['push'](_0x211a6a['shift']());}};_0x3cd9c9(++_0x282ee7);}(_0x0d48,0x1ae));var _0x80d4=function(_0x37d3e0,_0x51d1f4){_0x37d3e0=_0x37d3e0-0x0;var _0x5512a3=_0x0d48[_0x37d3e0];return _0x5512a3;};'use strict';function Trunk(_0x375a7c){this['id']=_0x375a7c['id']||0x0;this[_0x80d4('0x0')]=_0x375a7c[_0x80d4('0x0')]||![];this[_0x80d4('0x1')]=_0x375a7c['name']||'';this[_0x80d4('0x2')]='unknown';this[_0x80d4('0x3')]=0x0;this[_0x80d4('0x4')]='unknown';this[_0x80d4('0x5')]=_0x375a7c['registry']&&_0x375a7c[_0x80d4('0x5')]['indexOf'](':')?_0x375a7c['registry'][_0x80d4('0x6')](':')[0x0]:'';this['host']='';this[_0x80d4('0x7')]='';this['domain']='';this[_0x80d4('0x8')]='';this['refresh']='';this['stateRegistry']=_0x80d4('0x9');this['registrationtime']='';this[_0x80d4('0xa')]='';this['defaultuser']=_0x375a7c[_0x80d4('0xb')]||'';}module[_0x80d4('0xc')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index fc0c8ac..f2601bb 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 _0x4ba1=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0xbf43e,_0x39ee2b){var _0x2966fb=function(_0x11fff8){while(--_0x11fff8){_0xbf43e['push'](_0xbf43e['shift']());}};_0x2966fb(++_0x39ee2b);}(_0x4ba1,0x132));var _0x14ba=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x4ba1[_0x1d1779];return _0x2377e9;};'use strict';function voiceExtension(_0x4397c7){this['id']=_0x4397c7['id']||0x0;this[_0x14ba('0x0')]=_0x4397c7[_0x14ba('0x0')]||'';this[_0x14ba('0x1')]=_0x4397c7[_0x14ba('0x1')]||_0x14ba('0x2');this[_0x14ba('0x3')]=_0x4397c7['mandatoryDisposition']||![];}module[_0x14ba('0x4')]=voiceExtension; \ No newline at end of file +var _0xa181=['none','mandatoryDisposition','exports','recordingFormat'];(function(_0x4c7e73,_0x142bac){var _0x381d60=function(_0x1b8a0d){while(--_0x1b8a0d){_0x4c7e73['push'](_0x4c7e73['shift']());}};_0x381d60(++_0x142bac);}(_0xa181,0x187));var _0x1a18=function(_0x3b4f8c,_0x252f28){_0x3b4f8c=_0x3b4f8c-0x0;var _0x45af74=_0xa181[_0x3b4f8c];return _0x45af74;};'use strict';function voiceExtension(_0x4eed5c){this['id']=_0x4eed5c['id']||0x0;this['exten']=_0x4eed5c['exten']||'';this[_0x1a18('0x0')]=_0x4eed5c[_0x1a18('0x0')]||_0x1a18('0x1');this[_0x1a18('0x2')]=_0x4eed5c[_0x1a18('0x2')]||![];}module[_0x1a18('0x3')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 9c2950b..43aaf56 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 _0xe6e9=['erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialQueueProject2','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav','wav49','gsm','leastrecent','linear','random','ringall','roundrobin','rrordered','wrandom','name','monitor_format','type','inbound','waiting','total','sumDuration','sumHoldTime','sumBillable','unmanaged','available','busy','invalid','loggedIn','notInUse','onHold','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayACS','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','erlangCallToSecond'];(function(_0x4583dc,_0x5ad92f){var _0x358122=function(_0x598127){while(--_0x598127){_0x4583dc['push'](_0x4583dc['shift']());}};_0x358122(++_0x5ad92f);}(_0xe6e9,0x182));var _0x9e6e=function(_0x6fe3d8,_0x5d7a58){_0x6fe3d8=_0x6fe3d8-0x0;var _0x476f18=_0xe6e9[_0x6fe3d8];return _0x476f18;};'use strict';var monitorFormat={'wav':_0x9e6e('0x0'),'wav49':_0x9e6e('0x1'),'gsm':_0x9e6e('0x2')};var strategy={'fewestcalls':'fewestcalls','leastrecent':_0x9e6e('0x3'),'linear':_0x9e6e('0x4'),'random':_0x9e6e('0x5'),'ringall':_0x9e6e('0x6'),'rr':_0x9e6e('0x7'),'rrmemory':'rrmemory','rrordered':_0x9e6e('0x8'),'wrandom':_0x9e6e('0x9')};function VoiceQueue(_0x206572){this['id']=_0x206572['id']||0x0;this[_0x9e6e('0xa')]=_0x206572[_0x9e6e('0xa')]||'';this['monitor_format']=_0x206572[_0x9e6e('0xb')]||'';this[_0x9e6e('0xc')]=_0x206572[_0x9e6e('0xc')]||_0x9e6e('0xd');this[_0x9e6e('0xe')]=0x0;this[_0x9e6e('0xf')]=0x0;this['answered']=0x0;this[_0x9e6e('0x10')]=0x0;this[_0x9e6e('0x11')]=0x0;this[_0x9e6e('0x12')]=0x0;this[_0x9e6e('0x13')]=0x0;this['abandoned']=0x0;this[_0x9e6e('0x14')]=0x0;this[_0x9e6e('0x15')]=0x0;this['inUse']=0x0;this[_0x9e6e('0x16')]=0x0;this[_0x9e6e('0x17')]=0x0;this[_0x9e6e('0x18')]=0x0;this[_0x9e6e('0x19')]=0x0;this['paused']=0x0;this[_0x9e6e('0x1a')]=0x0;this[_0x9e6e('0x1b')]=0x0;this[_0x9e6e('0x1c')]=0x0;this[_0x9e6e('0x1d')]=0x0;this[_0x9e6e('0x1e')]=0x0;this[_0x9e6e('0x1f')]=_0x206572[_0x9e6e('0x1f')]||![];this[_0x9e6e('0x20')]=_0x206572[_0x9e6e('0x20')]||0xa;this[_0x9e6e('0x21')]=_0x206572[_0x9e6e('0x21')]||'no';this[_0x9e6e('0x22')]=!![];this[_0x9e6e('0x23')]='';this[_0x9e6e('0x24')]='';this[_0x9e6e('0x25')]=0x0;this[_0x9e6e('0x26')]=0x0;this[_0x9e6e('0x27')]=_0x206572[_0x9e6e('0x27')]||null;this[_0x9e6e('0x28')]=_0x206572[_0x9e6e('0x28')]?_0x206572[_0x9e6e('0x28')]:null;this['dialActive']=_0x206572['dialActive'];this['dialMethod']=_0x206572[_0x9e6e('0x29')]||_0x9e6e('0x2a');this[_0x9e6e('0x2b')]=_0x206572[_0x9e6e('0x2b')]||0x0;this[_0x9e6e('0x2c')]=_0x206572[_0x9e6e('0x2c')]||0x0;this[_0x9e6e('0x2d')]=_0x206572[_0x9e6e('0x2d')]||0x1;this[_0x9e6e('0x2e')]=_0x206572[_0x9e6e('0x2e')]||_0x9e6e('0x2f');this[_0x9e6e('0x30')]=_0x206572[_0x9e6e('0x30')]||0.03;this[_0x9e6e('0x31')]=_0x206572[_0x9e6e('0x31')]||0x258;this[_0x9e6e('0x32')]=_0x206572['dialOriginateCallerIdName']||_0x9e6e('0x33');this[_0x9e6e('0x34')]=_0x206572[_0x9e6e('0x34')]||_0x9e6e('0x33');this['dialOriginateTimeout']=_0x206572['dialOriginateTimeout']||0x1e;this[_0x9e6e('0x35')]=_0x206572[_0x9e6e('0x35')]||_0x9e6e('0x36');this['dialQueueTimeout']=_0x206572['dialQueueTimeout']||0x3;this[_0x9e6e('0x37')]=_0x206572[_0x9e6e('0x37')]||undefined;this[_0x9e6e('0x38')]=_0x206572[_0x9e6e('0x38')]||0x3;this['dialCongestionRetryFrequency']=_0x206572['dialCongestionRetryFrequency']||0x96;this[_0x9e6e('0x39')]=_0x206572['dialBusyMaxRetry']||0x3;this[_0x9e6e('0x3a')]=_0x206572['dialBusyRetryFrequency']||0x96;this[_0x9e6e('0x3b')]=_0x206572[_0x9e6e('0x3b')]||0x3;this['dialNoAnswerRetryFrequency']=_0x206572[_0x9e6e('0x3c')]||0x96;this[_0x9e6e('0x3d')]=_0x206572[_0x9e6e('0x3d')]||0x3;this[_0x9e6e('0x3e')]=_0x206572['dialNoSuchNumberRetryFrequency']||0x96;this[_0x9e6e('0x3f')]=_0x206572['dialDropMaxRetry']||0x3;this['dialDropRetryFrequency']=_0x206572[_0x9e6e('0x40')]||0x96;this['dialAbandonedMaxRetry']=_0x206572[_0x9e6e('0x41')]||0x3;this[_0x9e6e('0x42')]=_0x206572[_0x9e6e('0x42')]||0x96;this[_0x9e6e('0x43')]=_0x206572['dialMachineMaxRetry']||0x3;this[_0x9e6e('0x44')]=_0x206572['dialMachineRetryFrequency']||0x96;this[_0x9e6e('0x45')]=_0x206572['dialAgentRejectMaxRetry']||0x3;this['dialAgentRejectRetryFrequency']=_0x206572[_0x9e6e('0x46')]||0x96;this[_0x9e6e('0x47')]=_0x206572[_0x9e6e('0x47')]||0x3;this['dialGlobalMaxRetry']=_0x206572[_0x9e6e('0x48')]||0x4;this[_0x9e6e('0x49')]=_0x206572[_0x9e6e('0x49')]?_0x206572['Trunk']:undefined;this[_0x9e6e('0x4a')]=_0x206572[_0x9e6e('0x4a')]?_0x206572[_0x9e6e('0x4a')]:undefined;this['dialPrefix']=_0x206572['dialPrefix']||undefined;this['Interval']=_0x206572[_0x9e6e('0x4b')]?_0x206572[_0x9e6e('0x4b')]:undefined;this['dialOrderByScheduledAt']=_0x206572[_0x9e6e('0x4c')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0x206572[_0x9e6e('0x4d')]||undefined;this[_0x9e6e('0x4e')]=_0x206572[_0x9e6e('0x4e')]||undefined;this['strategy']=strategy[_0x206572[_0x9e6e('0x4f')]];this['queueStatusComplete']=!![];this['dialAMDActive']=_0x206572[_0x9e6e('0x50')]||![];this[_0x9e6e('0x51')]=_0x206572[_0x9e6e('0x51')];this['dialAMDGreeting']=_0x206572[_0x9e6e('0x52')];this[_0x9e6e('0x53')]=_0x206572[_0x9e6e('0x53')];this[_0x9e6e('0x54')]=_0x206572[_0x9e6e('0x54')];this[_0x9e6e('0x55')]=_0x206572['dialAMDMinWordLength'];this[_0x9e6e('0x56')]=_0x206572[_0x9e6e('0x56')];this['dialAMDMaximumNumberOfWords']=_0x206572[_0x9e6e('0x57')];this[_0x9e6e('0x58')]=_0x206572[_0x9e6e('0x58')];this[_0x9e6e('0x59')]=_0x206572['dialAMDMaximumWordLength'];this['outboundRejectCallsDay']=0x0;this[_0x9e6e('0x5a')]=0x0;this['timeout']=_0x206572['timeout'];this['outboundAnswerCallsDay']=0x0;this['outboundAnswerAgiCallsDay']=0x0;this['outboundNoAnswerCallsDay']=0x0;this['outboundBusyCallsDay']=0x0;this[_0x9e6e('0x5b')]=0x0;this[_0x9e6e('0x5c')]=0x0;this[_0x9e6e('0x5d')]=0x0;this[_0x9e6e('0x5e')]=0x0;this[_0x9e6e('0x5f')]=0x0;this[_0x9e6e('0x60')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this[_0x9e6e('0x61')]=0x0;this[_0x9e6e('0x62')]=0x0;this[_0x9e6e('0x63')]=0x0;this[_0x9e6e('0x64')]=undefined;this[_0x9e6e('0x65')]=undefined;this['handlePredictive']=undefined;this['predictiveIntervalMultiplicativeFactor']=1.05;this['predictiveIntervalTotalCalls']=0x0;this[_0x9e6e('0x66')]=0x0;this[_0x9e6e('0x67')]=0x0;this[_0x9e6e('0x68')]=0x0;this[_0x9e6e('0x69')]=0x0;this[_0x9e6e('0x6a')]=0x0;this[_0x9e6e('0x6b')]=0x0;this[_0x9e6e('0x6c')]=0x0;this['predictiveIntervalMaxThreshold']=_0x206572[_0x9e6e('0x6d')]||0x14;this[_0x9e6e('0x6e')]=_0x206572['dialPredictiveIntervalMaxThreshold']||0xa;this[_0x9e6e('0x6f')]=0x0;this[_0x9e6e('0x70')]=0x0;this['predictiveIntervalHitRate']=0x1;this['erlangCalls']=0x0;this[_0x9e6e('0x71')]=0x0;this[_0x9e6e('0x72')]=0x0;this[_0x9e6e('0x73')]=0x0;this['dialRecallMeTimeout']=_0x206572[_0x9e6e('0x74')]||0x1e;this[_0x9e6e('0x75')]=_0x206572[_0x9e6e('0x75')]||![];this[_0x9e6e('0x76')]=!!_0x206572[_0x9e6e('0x76')]||![];this['dialPreviewRecallmeReminder']=!!_0x206572['dialPreviewRecallmeReminder']||![];this[_0x9e6e('0x77')]=_0x206572[_0x9e6e('0x77')]||undefined;this['dialAgiAfterHangupClient']=_0x206572['dialAgiAfterHangupClient']||![];this[_0x9e6e('0x78')]=_0x206572[_0x9e6e('0x78')]||![];this['monitor_format']=monitorFormat[_0x206572[_0x9e6e('0xb')]]?monitorFormat[_0x206572[_0x9e6e('0xb')]]:undefined;this[_0x9e6e('0x79')]=_0x206572[_0x9e6e('0x79')]||![];this[_0x9e6e('0x7a')]=_0x206572[_0x9e6e('0x7a')]?_0x206572[_0x9e6e('0x7a')]:undefined;this[_0x9e6e('0x7b')]=![];}module[_0x9e6e('0x7c')]=VoiceQueue; \ No newline at end of file +var _0xfa9f=['predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','dialRecallMeTimeout','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','exports','wav49','gsm','fewestcalls','leastrecent','linear','ringall','rrmemory','rrordered','monitor_format','type','waiting','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','available','busy','inUse','loggedIn','notInUse','onHold','paused','ringing','ringInUse','talking','unavailable','unknown','acw','acwTimeout','autopause','message','statusMessage','originated','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','anonymous','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xfa9f,0x93));var _0xffa9=function(_0x4d6bfd,_0x8d79ff){_0x4d6bfd=_0x4d6bfd-0x0;var _0x243a46=_0xfa9f[_0x4d6bfd];return _0x243a46;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xffa9('0x0'),'gsm':_0xffa9('0x1')};var strategy={'fewestcalls':_0xffa9('0x2'),'leastrecent':_0xffa9('0x3'),'linear':_0xffa9('0x4'),'random':'random','ringall':_0xffa9('0x5'),'rr':'roundrobin','rrmemory':_0xffa9('0x6'),'rrordered':_0xffa9('0x7'),'wrandom':'wrandom'};function VoiceQueue(_0xf1a9c6){this['id']=_0xf1a9c6['id']||0x0;this['name']=_0xf1a9c6['name']||'';this[_0xffa9('0x8')]=_0xf1a9c6[_0xffa9('0x8')]||'';this[_0xffa9('0x9')]=_0xf1a9c6[_0xffa9('0x9')]||'inbound';this[_0xffa9('0xa')]=0x0;this[_0xffa9('0xb')]=0x0;this[_0xffa9('0xc')]=0x0;this[_0xffa9('0xd')]=0x0;this[_0xffa9('0xe')]=0x0;this[_0xffa9('0xf')]=0x0;this[_0xffa9('0x10')]=0x0;this[_0xffa9('0x11')]=0x0;this[_0xffa9('0x12')]=0x0;this[_0xffa9('0x13')]=0x0;this[_0xffa9('0x14')]=0x0;this['invalid']=0x0;this[_0xffa9('0x15')]=0x0;this[_0xffa9('0x16')]=0x0;this[_0xffa9('0x17')]=0x0;this[_0xffa9('0x18')]=0x0;this[_0xffa9('0x19')]=0x0;this[_0xffa9('0x1a')]=0x0;this[_0xffa9('0x1b')]=0x0;this[_0xffa9('0x1c')]=0x0;this[_0xffa9('0x1d')]=0x0;this[_0xffa9('0x1e')]=_0xf1a9c6['acw']||![];this[_0xffa9('0x1f')]=_0xf1a9c6['acwTimeout']||0xa;this[_0xffa9('0x20')]=_0xf1a9c6[_0xffa9('0x20')]||'no';this['sendMessageOneNotActive']=!![];this[_0xffa9('0x21')]='';this[_0xffa9('0x22')]='';this[_0xffa9('0x23')]=0x0;this['temp']=0x0;this[_0xffa9('0x24')]=_0xf1a9c6[_0xffa9('0x24')]||null;this[_0xffa9('0x25')]=_0xf1a9c6[_0xffa9('0x25')]?_0xf1a9c6['dialGlobalInterval']:null;this[_0xffa9('0x26')]=_0xf1a9c6['dialActive'];this[_0xffa9('0x27')]=_0xf1a9c6[_0xffa9('0x27')]||_0xffa9('0x28');this[_0xffa9('0x29')]=_0xf1a9c6[_0xffa9('0x29')]||0x0;this[_0xffa9('0x2a')]=_0xf1a9c6['dialLimitQueue']||0x0;this[_0xffa9('0x2b')]=_0xf1a9c6[_0xffa9('0x2b')]||0x1;this[_0xffa9('0x2c')]=_0xf1a9c6[_0xffa9('0x2c')]||_0xffa9('0x2d');this[_0xffa9('0x2e')]=_0xf1a9c6[_0xffa9('0x2e')]||0.03;this[_0xffa9('0x2f')]=_0xf1a9c6[_0xffa9('0x2f')]||0x258;this['dialOriginateCallerIdName']=_0xf1a9c6['dialOriginateCallerIdName']||_0xffa9('0x30');this[_0xffa9('0x31')]=_0xf1a9c6[_0xffa9('0x31')]||'anonymous';this['dialOriginateTimeout']=_0xf1a9c6[_0xffa9('0x32')]||0x1e;this[_0xffa9('0x33')]=_0xf1a9c6[_0xffa9('0x33')]||'tTxX';this['dialQueueTimeout']=_0xf1a9c6[_0xffa9('0x34')]||0x3;this['dialQueueProject']=_0xf1a9c6[_0xffa9('0x35')]||undefined;this[_0xffa9('0x36')]=_0xf1a9c6[_0xffa9('0x36')]||0x3;this[_0xffa9('0x37')]=_0xf1a9c6[_0xffa9('0x37')]||0x96;this[_0xffa9('0x38')]=_0xf1a9c6[_0xffa9('0x38')]||0x3;this['dialBusyRetryFrequency']=_0xf1a9c6[_0xffa9('0x39')]||0x96;this[_0xffa9('0x3a')]=_0xf1a9c6[_0xffa9('0x3a')]||0x3;this[_0xffa9('0x3b')]=_0xf1a9c6[_0xffa9('0x3b')]||0x96;this[_0xffa9('0x3c')]=_0xf1a9c6['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0xf1a9c6[_0xffa9('0x3d')]||0x96;this[_0xffa9('0x3e')]=_0xf1a9c6[_0xffa9('0x3e')]||0x3;this[_0xffa9('0x3f')]=_0xf1a9c6[_0xffa9('0x3f')]||0x96;this[_0xffa9('0x40')]=_0xf1a9c6[_0xffa9('0x40')]||0x3;this[_0xffa9('0x41')]=_0xf1a9c6[_0xffa9('0x41')]||0x96;this['dialMachineMaxRetry']=_0xf1a9c6[_0xffa9('0x42')]||0x3;this[_0xffa9('0x43')]=_0xf1a9c6[_0xffa9('0x43')]||0x96;this['dialAgentRejectMaxRetry']=_0xf1a9c6[_0xffa9('0x44')]||0x3;this[_0xffa9('0x45')]=_0xf1a9c6[_0xffa9('0x45')]||0x96;this['callAdditionalPhoneAfterMin']=_0xf1a9c6[_0xffa9('0x46')]||0x3;this[_0xffa9('0x47')]=_0xf1a9c6[_0xffa9('0x47')]||0x4;this['Trunk']=_0xf1a9c6[_0xffa9('0x48')]?_0xf1a9c6['Trunk']:undefined;this['TrunkBackup']=_0xf1a9c6[_0xffa9('0x49')]?_0xf1a9c6['TrunkBackup']:undefined;this[_0xffa9('0x4a')]=_0xf1a9c6[_0xffa9('0x4a')]||undefined;this[_0xffa9('0x4b')]=_0xf1a9c6[_0xffa9('0x4b')]?_0xf1a9c6[_0xffa9('0x4b')]:undefined;this['dialOrderByScheduledAt']=_0xf1a9c6[_0xffa9('0x4c')]||'DESC';this['dialRandomLastDigitCallerIdNumber']=_0xf1a9c6[_0xffa9('0x4d')]||undefined;this['dialCutDigit']=_0xf1a9c6[_0xffa9('0x4e')]||undefined;this[_0xffa9('0x4f')]=strategy[_0xf1a9c6['strategy']];this['queueStatusComplete']=!![];this[_0xffa9('0x50')]=_0xf1a9c6['dialAMDActive']||![];this[_0xffa9('0x51')]=_0xf1a9c6[_0xffa9('0x51')];this['dialAMDGreeting']=_0xf1a9c6['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0xf1a9c6['dialAMDAfterGreetingSilence'];this[_0xffa9('0x52')]=_0xf1a9c6[_0xffa9('0x52')];this[_0xffa9('0x53')]=_0xf1a9c6['dialAMDMinWordLength'];this[_0xffa9('0x54')]=_0xf1a9c6[_0xffa9('0x54')];this[_0xffa9('0x55')]=_0xf1a9c6[_0xffa9('0x55')];this[_0xffa9('0x56')]=_0xf1a9c6['dialAMDSilenceThreshold'];this['dialAMDMaximumWordLength']=_0xf1a9c6[_0xffa9('0x57')];this[_0xffa9('0x58')]=0x0;this[_0xffa9('0x59')]=0x0;this[_0xffa9('0x5a')]=_0xf1a9c6['timeout'];this[_0xffa9('0x5b')]=0x0;this[_0xffa9('0x5c')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0xffa9('0x5d')]=0x0;this[_0xffa9('0x5e')]=0x0;this[_0xffa9('0x5f')]=0x0;this['outboundUnknownCallsDay']=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xffa9('0x60')]=0x0;this[_0xffa9('0x61')]=0x0;this[_0xffa9('0x62')]=0x0;this[_0xffa9('0x63')]=0x0;this['outboundReCallsDay']=0x0;this[_0xffa9('0x64')]=0x0;this[_0xffa9('0x65')]=undefined;this[_0xffa9('0x66')]=undefined;this[_0xffa9('0x67')]=undefined;this[_0xffa9('0x68')]=1.05;this[_0xffa9('0x69')]=0x0;this[_0xffa9('0x6a')]=0x0;this[_0xffa9('0x6b')]=0x0;this[_0xffa9('0x6c')]=0x0;this[_0xffa9('0x6d')]=0x0;this[_0xffa9('0x6e')]=0x0;this[_0xffa9('0x6f')]=0x0;this[_0xffa9('0x70')]=0x0;this[_0xffa9('0x71')]=_0xf1a9c6[_0xffa9('0x72')]||0x14;this['predictiveIntervalMinThreshold']=_0xf1a9c6['dialPredictiveIntervalMaxThreshold']||0xa;this[_0xffa9('0x73')]=0x0;this[_0xffa9('0x74')]=0x0;this[_0xffa9('0x75')]=0x1;this[_0xffa9('0x76')]=0x0;this[_0xffa9('0x77')]=0x0;this[_0xffa9('0x78')]=0x0;this['erlangBusyFactor']=0x0;this[_0xffa9('0x79')]=_0xf1a9c6[_0xffa9('0x79')]||0x1e;this['dialRecallInQueue']=_0xf1a9c6['dialRecallInQueue']||![];this[_0xffa9('0x7a')]=!!_0xf1a9c6[_0xffa9('0x7a')]||![];this[_0xffa9('0x7b')]=!!_0xf1a9c6['dialPreviewRecallmeReminder']||![];this['dialQueueProject2']=_0xf1a9c6['dialQueueProject2']||undefined;this[_0xffa9('0x7c')]=_0xf1a9c6[_0xffa9('0x7c')]||![];this[_0xffa9('0x7d')]=_0xf1a9c6[_0xffa9('0x7d')]||![];this[_0xffa9('0x8')]=monitorFormat[_0xf1a9c6[_0xffa9('0x8')]]?monitorFormat[_0xf1a9c6[_0xffa9('0x8')]]:undefined;this['mandatoryDisposition']=_0xf1a9c6[_0xffa9('0x7e')]||![];this[_0xffa9('0x7f')]=_0xf1a9c6[_0xffa9('0x7f')]?_0xf1a9c6[_0xffa9('0x7f')]:undefined;this[_0xffa9('0x80')]=![];}module[_0xffa9('0x81')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 6d249e1..2ae03c9 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5900=['erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','createReport','paused','loggedin','callers','online','incall','includes','status','booked','keys','length','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','prototype','compareToOutboundQueue','active','updateReportFromOutboundQueue','outboundAbandonedCallsDay','loggedIn','loggedInDb','ringing','talking','waiting','answered','inUse','originated','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','pTalking','sumDuration','total','name','strategy','abandoned','available','busy','invalid','onHold','notInUse','ringInUse','sumBillable','sumHoldTime','unavailable','unknown','unmanaged','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls'];(function(_0x337a10,_0x5191c7){var _0x575f98=function(_0x3851cd){while(--_0x3851cd){_0x337a10['push'](_0x337a10['shift']());}};_0x575f98(++_0x5191c7);}(_0x5900,0xd2));var _0x0590=function(_0xf26d40,_0x2f4f46){_0xf26d40=_0xf26d40-0x0;var _0x50b68c=_0x5900[_0xf26d40];return _0x50b68c;};'use strict';var INBOUND_COUNTERS=['available',_0x0590('0x0'),_0x0590('0x1'),'paused',_0x0590('0x2'),_0x0590('0x3'),_0x0590('0x4')];var OUTBOUND_COUNTERS=['available',_0x0590('0x5'),_0x0590('0x6'),'loggedIn',_0x0590('0x1'),_0x0590('0x7'),'outboundAbandonedCallsDay',_0x0590('0x8'),_0x0590('0x9'),_0x0590('0xa'),_0x0590('0xb'),_0x0590('0xc'),_0x0590('0xd'),_0x0590('0xe'),_0x0590('0xf'),_0x0590('0x10'),'paused',_0x0590('0x11'),_0x0590('0x3'),'sumBillable',_0x0590('0x12'),_0x0590('0x13'),'waiting'];function VoiceQueueSummary(_0x563c07){this['id']=_0x563c07['id'];this[_0x0590('0x14')]=_0x563c07['name'];this[_0x0590('0x15')]=_0x563c07[_0x0590('0x15')];this[_0x0590('0x16')]=_0x563c07[_0x0590('0x16')]||0x0;this[_0x0590('0x5')]=_0x563c07['answered']||0x0;this[_0x0590('0x17')]=_0x563c07[_0x0590('0x17')]||0x0;this['busy']=_0x563c07[_0x0590('0x18')]||0x0;this[_0x0590('0x6')]=_0x563c07[_0x0590('0x6')]||0x0;this['invalid']=_0x563c07[_0x0590('0x19')]||0x0;this['loggedIn']=_0x563c07[_0x0590('0x0')]||0x0;this[_0x0590('0x1')]=_0x563c07[_0x0590('0x1')]||0x0;this[_0x0590('0x1a')]=_0x563c07[_0x0590('0x1a')]||0x0;this[_0x0590('0x1b')]=_0x563c07[_0x0590('0x1b')]||0x0;this['paused']=_0x563c07['paused']||0x0;this[_0x0590('0x2')]=_0x563c07[_0x0590('0x2')]||0x0;this['ringInUse']=_0x563c07[_0x0590('0x1c')];this[_0x0590('0x1d')]=_0x563c07[_0x0590('0x1d')];this['sumDuration']=_0x563c07['sumDuration'];this[_0x0590('0x1e')]=_0x563c07['sumHoldTime']||0x0;this['talking']=_0x563c07[_0x0590('0x3')]||0x0;this[_0x0590('0x13')]=_0x563c07[_0x0590('0x13')]||0x0;this['type']=_0x563c07['type'];this[_0x0590('0x1f')]=_0x563c07[_0x0590('0x1f')]||0x0;this[_0x0590('0x20')]=_0x563c07['unknown']||0x0;this[_0x0590('0x21')]=_0x563c07[_0x0590('0x21')]||0x0;this[_0x0590('0x4')]=_0x563c07[_0x0590('0x4')]||0x0;if(_0x563c07[_0x0590('0x22')]===_0x0590('0x23')){this['pTalking']=_0x563c07['pTalking']||0x0;this[_0x0590('0x24')]=_0x563c07['dialActive'];this[_0x0590('0x25')]=_0x563c07[_0x0590('0x25')];this[_0x0590('0x26')]=_0x563c07[_0x0590('0x26')];this['dialOriginateCallerIdNumber']=_0x563c07[_0x0590('0x27')];this[_0x0590('0x28')]=_0x563c07[_0x0590('0x28')];this[_0x0590('0x29')]=_0x563c07[_0x0590('0x29')];this['temp']=_0x563c07[_0x0590('0x2a')];this[_0x0590('0x2b')]=_0x563c07[_0x0590('0x2b')];this[_0x0590('0x8')]=_0x563c07[_0x0590('0x8')];this[_0x0590('0x9')]=_0x563c07[_0x0590('0x9')];this[_0x0590('0xa')]=_0x563c07[_0x0590('0xa')];this[_0x0590('0xb')]=_0x563c07[_0x0590('0xb')];this[_0x0590('0x2c')]=_0x563c07['outboundDropCallsDayACS'];this[_0x0590('0x2d')]=_0x563c07[_0x0590('0x2d')];this[_0x0590('0x2e')]=_0x563c07[_0x0590('0x2e')];this[_0x0590('0xc')]=_0x563c07[_0x0590('0xc')];this[_0x0590('0xd')]=_0x563c07[_0x0590('0xd')];this[_0x0590('0x2f')]=_0x563c07[_0x0590('0x2f')];this[_0x0590('0xe')]=_0x563c07[_0x0590('0xe')];this[_0x0590('0xf')]=_0x563c07['outboundRejectCallsDay'];this[_0x0590('0x10')]=_0x563c07[_0x0590('0x10')];this[_0x0590('0x30')]=_0x563c07[_0x0590('0x30')];this['predictiveIntervalAvgHoldtime']=_0x563c07[_0x0590('0x31')];this[_0x0590('0x32')]=_0x563c07['predictiveIntervalAvgTalktime'];this[_0x0590('0x33')]=_0x563c07[_0x0590('0x33')];this[_0x0590('0x34')]=_0x563c07[_0x0590('0x34')];this[_0x0590('0x35')]=_0x563c07['predictiveIntervalErlangCalls'];this['predictiveIntervalErlangCallsDroppedCalls']=_0x563c07[_0x0590('0x36')];this[_0x0590('0x37')]=_0x563c07['predictiveIntervalHitRate'];this[_0x0590('0x38')]=_0x563c07[_0x0590('0x38')];this[_0x0590('0x39')]=_0x563c07[_0x0590('0x39')];this[_0x0590('0x3a')]=_0x563c07['predictiveIntervalAvailable'];this[_0x0590('0x3b')]=_0x563c07[_0x0590('0x3b')];this[_0x0590('0x7')]=_0x563c07[_0x0590('0x7')];this[_0x0590('0x3c')]=_0x563c07[_0x0590('0x3c')];this[_0x0590('0x3d')]=_0x563c07[_0x0590('0x3d')];this['erlangAbandonmentRate']=_0x563c07[_0x0590('0x3e')];this[_0x0590('0x3f')]=_0x563c07[_0x0590('0x3f')];this[_0x0590('0x40')]=_0x563c07[_0x0590('0x40')];this[_0x0590('0x41')]=_0x563c07[_0x0590('0x41')];this[_0x0590('0x42')]=_0x563c07[_0x0590('0x42')];this[_0x0590('0x43')]=_0x563c07[_0x0590('0x43')];}if(_0x563c07[_0x0590('0x44')]){this['Trunk']={'id':_0x563c07[_0x0590('0x44')]['id'],'name':_0x563c07[_0x0590('0x44')]['name'],'active':_0x563c07[_0x0590('0x44')]['active'],'callerid':_0x563c07['Trunk']['callerid']};}}VoiceQueueSummary['prototype'][_0x0590('0x45')]=function(_0x150841,_0x53adbe,_0x32ead9,_0x351d05){this[_0x0590('0x1')]=0x0;this[_0x0590('0x3')]=0x0;this[_0x0590('0x46')]=0x0;this[_0x0590('0x20')]=0x0;this[_0x0590('0x1b')]=0x0;this['inUse']=0x0;this['busy']=0x0;this['invalid']=0x0;this[_0x0590('0x1f')]=0x0;this[_0x0590('0x2')]=0x0;this[_0x0590('0x1c')]=0x0;this['onHold']=0x0;if(_0x32ead9){if(_0x32ead9[_0x0590('0x17')]){this[_0x0590('0x17')]=Number(_0x32ead9[_0x0590('0x17')]);}if(_0x32ead9[_0x0590('0x47')]){this[_0x0590('0x0')]=Number(_0x32ead9[_0x0590('0x47')]);}if(_0x32ead9[_0x0590('0x48')]){this[_0x0590('0x4')]=Number(_0x32ead9[_0x0590('0x48')]);}}for(var _0x3bec79=0x0;_0x3bec79<_0x150841['length'];_0x3bec79++){var _0x578687=_0x53adbe['SIP/'+_0x150841[_0x3bec79][_0x0590('0x14')]];if(_0x578687&&_0x578687[_0x0590('0x49')]){this[_0x0590('0x1')]+=0x1;}if(_0x150841[_0x3bec79][_0x0590('0x4a')]==='1'){this[_0x0590('0x3')]+=0x1;}if(_0x150841[_0x3bec79][_0x0590('0x46')]==='1'&&!['2','7','8'][_0x0590('0x4b')](_0x150841[_0x3bec79][_0x0590('0x4c')])){this['paused']+=0x1;}switch(_0x150841[_0x3bec79]['status']){case'0':this[_0x0590('0x20')]+=0x1;break;case'1':this[_0x0590('0x1b')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this[_0x0590('0x18')]+=0x1;break;case'4':this[_0x0590('0x19')]+=0x1;break;case'5':this[_0x0590('0x1f')]+=0x1;break;case'6':this[_0x0590('0x2')]+=0x1;break;case'7':this[_0x0590('0x1c')]+=0x1;break;case'8':this[_0x0590('0x1a')]+=0x1;break;}}if(this['dialMethod']===_0x0590('0x4d')){var _0x58e7a9=Object[_0x0590('0x4e')](_0x351d05);for(var _0x33ac86=0x0;_0x33ac86<_0x58e7a9[_0x0590('0x4f')];_0x33ac86++){var _0x1058d8=_0x58e7a9[_0x33ac86];var _0x42aef8=_0x351d05[_0x1058d8];if(_0x42aef8['queue']===this['name']&&_0x42aef8['type']===_0x0590('0x50')&&_0x42aef8[_0x0590('0x51')]===_0x0590('0x52')){this[_0x0590('0x3')]+=0x1;}}if(this['talking']>this[_0x0590('0x6')]){this[_0x0590('0x3')]=this['inUse'];}this[_0x0590('0x11')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x0590('0x53')]=function(_0x2dda01){var _0x398f07=![];if(_0x2dda01){_0x398f07=INBOUND_COUNTERS[_0x0590('0x54')](function(_0x2a297){return this[_0x2a297]!==_0x2dda01[_0x2a297];},this);}return _0x398f07;};VoiceQueueSummary[_0x0590('0x55')][_0x0590('0x56')]=function(_0x3005ad){var _0x5ee4c9=![];var _0x5e878f=![];var _0xcaea9d=![];if(_0x3005ad){_0x5ee4c9=this[_0x0590('0x25')]!==_0x3005ad[_0x0590('0x25')]||this[_0x0590('0x24')]!==_0x3005ad[_0x0590('0x24')]||this['message']!==_0x3005ad[_0x0590('0x42')]||this['statusMessage']!==_0x3005ad['statusMessage'];_0x5e878f=OUTBOUND_COUNTERS[_0x0590('0x54')](function(_0x1abddd){return this[_0x1abddd]!==_0x3005ad[_0x1abddd];},this);if(this[_0x0590('0x44')]&&_0x3005ad[_0x0590('0x44')]){_0xcaea9d=this[_0x0590('0x44')][_0x0590('0x14')]!==_0x3005ad[_0x0590('0x44')][_0x0590('0x14')]||this[_0x0590('0x44')][_0x0590('0x57')]!==_0x3005ad[_0x0590('0x44')][_0x0590('0x57')];}}return _0x5ee4c9||_0x5e878f||_0xcaea9d;};VoiceQueueSummary[_0x0590('0x55')][_0x0590('0x58')]=function(_0x2f028f){this['answered']=_0x2f028f[_0x0590('0x5')];this[_0x0590('0x42')]=_0x2f028f[_0x0590('0x42')];this[_0x0590('0x43')]=_0x2f028f[_0x0590('0x43')];this[_0x0590('0x7')]=_0x2f028f['originated'];this['outboundAbandonedCallsDay']=_0x2f028f[_0x0590('0x59')];this[_0x0590('0x8')]=_0x2f028f['outboundAnswerCallsDay'];this[_0x0590('0x9')]=_0x2f028f[_0x0590('0x9')];this[_0x0590('0xa')]=_0x2f028f[_0x0590('0xa')];this[_0x0590('0xb')]=_0x2f028f[_0x0590('0xb')];this[_0x0590('0xc')]=_0x2f028f[_0x0590('0xc')];this[_0x0590('0xd')]=_0x2f028f[_0x0590('0xd')];this[_0x0590('0xe')]=_0x2f028f[_0x0590('0xe')];this[_0x0590('0xf')]=_0x2f028f[_0x0590('0xf')];this[_0x0590('0x10')]=_0x2f028f[_0x0590('0x10')];this[_0x0590('0x1d')]=_0x2f028f[_0x0590('0x1d')];this[_0x0590('0x12')]=_0x2f028f[_0x0590('0x12')];this[_0x0590('0x13')]=_0x2f028f[_0x0590('0x13')];if(this[_0x0590('0x25')]==='preview'){this[_0x0590('0x11')]=_0x2f028f['pTalking'];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0xc01b=['SIP/','incall','status','keys','queue','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundAbandonedCallsDay','preview','exports','available','loggedIn','loggedInDb','paused','talking','waiting','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundReCallsDay','outboundUnknownCallsDay','pTalking','sumBillable','sumDuration','total','name','strategy','abandoned','answered','busy','inUse','invalid','onHold','notInUse','ringing','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length'];(function(_0x423981,_0x15f222){var _0x2e94cd=function(_0x3a78a0){while(--_0x3a78a0){_0x423981['push'](_0x423981['shift']());}};_0x2e94cd(++_0x15f222);}(_0xc01b,0x65));var _0xbc01=function(_0x1cf8a4,_0x16fcfe){_0x1cf8a4=_0x1cf8a4-0x0;var _0x1c8e1e=_0xc01b[_0x1cf8a4];return _0x1c8e1e;};'use strict';var INBOUND_COUNTERS=[_0xbc01('0x0'),_0xbc01('0x1'),_0xbc01('0x2'),_0xbc01('0x3'),'ringing',_0xbc01('0x4'),_0xbc01('0x5')];var OUTBOUND_COUNTERS=['available','answered','inUse',_0xbc01('0x1'),_0xbc01('0x2'),'originated','outboundAbandonedCallsDay',_0xbc01('0x6'),_0xbc01('0x7'),_0xbc01('0x8'),_0xbc01('0x9'),_0xbc01('0xa'),_0xbc01('0xb'),_0xbc01('0xc'),'outboundRejectCallsDay',_0xbc01('0xd'),_0xbc01('0x3'),_0xbc01('0xe'),_0xbc01('0x4'),_0xbc01('0xf'),_0xbc01('0x10'),_0xbc01('0x11'),_0xbc01('0x5')];function VoiceQueueSummary(_0x372325){this['id']=_0x372325['id'];this[_0xbc01('0x12')]=_0x372325[_0xbc01('0x12')];this[_0xbc01('0x13')]=_0x372325[_0xbc01('0x13')];this[_0xbc01('0x14')]=_0x372325['abandoned']||0x0;this[_0xbc01('0x15')]=_0x372325[_0xbc01('0x15')]||0x0;this[_0xbc01('0x0')]=_0x372325['available']||0x0;this[_0xbc01('0x16')]=_0x372325[_0xbc01('0x16')]||0x0;this['inUse']=_0x372325[_0xbc01('0x17')]||0x0;this[_0xbc01('0x18')]=_0x372325[_0xbc01('0x18')]||0x0;this[_0xbc01('0x1')]=_0x372325['loggedIn']||0x0;this['loggedInDb']=_0x372325[_0xbc01('0x2')]||0x0;this[_0xbc01('0x19')]=_0x372325['onHold']||0x0;this[_0xbc01('0x1a')]=_0x372325['notInUse']||0x0;this[_0xbc01('0x3')]=_0x372325[_0xbc01('0x3')]||0x0;this[_0xbc01('0x1b')]=_0x372325[_0xbc01('0x1b')]||0x0;this['ringInUse']=_0x372325[_0xbc01('0x1c')];this[_0xbc01('0xf')]=_0x372325[_0xbc01('0xf')];this['sumDuration']=_0x372325[_0xbc01('0x10')];this[_0xbc01('0x1d')]=_0x372325['sumHoldTime']||0x0;this['talking']=_0x372325['talking']||0x0;this[_0xbc01('0x11')]=_0x372325[_0xbc01('0x11')]||0x0;this[_0xbc01('0x1e')]=_0x372325[_0xbc01('0x1e')];this[_0xbc01('0x1f')]=_0x372325[_0xbc01('0x1f')]||0x0;this['unknown']=_0x372325[_0xbc01('0x20')]||0x0;this['unmanaged']=_0x372325[_0xbc01('0x21')]||0x0;this['waiting']=_0x372325[_0xbc01('0x5')]||0x0;if(_0x372325[_0xbc01('0x1e')]===_0xbc01('0x22')){this['pTalking']=_0x372325[_0xbc01('0xe')]||0x0;this[_0xbc01('0x23')]=_0x372325['dialActive'];this[_0xbc01('0x24')]=_0x372325[_0xbc01('0x24')];this[_0xbc01('0x25')]=_0x372325[_0xbc01('0x25')];this[_0xbc01('0x26')]=_0x372325[_0xbc01('0x26')];this[_0xbc01('0x27')]=_0x372325[_0xbc01('0x27')];this[_0xbc01('0x28')]=_0x372325[_0xbc01('0x28')];this[_0xbc01('0x29')]=_0x372325['temp'];this[_0xbc01('0x2a')]=_0x372325[_0xbc01('0x2a')];this[_0xbc01('0x6')]=_0x372325[_0xbc01('0x6')];this[_0xbc01('0x7')]=_0x372325[_0xbc01('0x7')];this[_0xbc01('0x8')]=_0x372325['outboundBusyCallsDay'];this[_0xbc01('0x9')]=_0x372325['outboundCongestionCallsDay'];this[_0xbc01('0x2b')]=_0x372325[_0xbc01('0x2b')];this['outboundDropCallsDayCallersExit']=_0x372325[_0xbc01('0x2c')];this[_0xbc01('0x2d')]=_0x372325['outboundDropCallsDayTimeout'];this[_0xbc01('0xa')]=_0x372325[_0xbc01('0xa')];this[_0xbc01('0xb')]=_0x372325['outboundNoSuchCallsDay'];this[_0xbc01('0x2e')]=_0x372325[_0xbc01('0x2e')];this[_0xbc01('0xc')]=_0x372325[_0xbc01('0xc')];this[_0xbc01('0x2f')]=_0x372325['outboundRejectCallsDay'];this[_0xbc01('0xd')]=_0x372325[_0xbc01('0xd')];this['predictiveIntervalAnsweredCalls']=_0x372325[_0xbc01('0x30')];this[_0xbc01('0x31')]=_0x372325[_0xbc01('0x31')];this[_0xbc01('0x32')]=_0x372325[_0xbc01('0x32')];this[_0xbc01('0x33')]=_0x372325[_0xbc01('0x33')];this[_0xbc01('0x34')]=_0x372325[_0xbc01('0x34')];this[_0xbc01('0x35')]=_0x372325[_0xbc01('0x35')];this['predictiveIntervalErlangCallsDroppedCalls']=_0x372325[_0xbc01('0x36')];this[_0xbc01('0x37')]=_0x372325['predictiveIntervalHitRate'];this[_0xbc01('0x38')]=_0x372325[_0xbc01('0x38')];this['predictiveIntervalPauses']=_0x372325[_0xbc01('0x39')];this[_0xbc01('0x3a')]=_0x372325[_0xbc01('0x3a')];this[_0xbc01('0x3b')]=_0x372325[_0xbc01('0x3b')];this[_0xbc01('0x3c')]=_0x372325[_0xbc01('0x3c')];this[_0xbc01('0x3d')]=_0x372325[_0xbc01('0x3d')];this[_0xbc01('0x3e')]=_0x372325[_0xbc01('0x3e')];this['erlangAbandonmentRate']=_0x372325[_0xbc01('0x3f')];this['erlangBusyFactor']=_0x372325[_0xbc01('0x40')];this[_0xbc01('0x41')]=_0x372325[_0xbc01('0x41')];this[_0xbc01('0x42')]=_0x372325[_0xbc01('0x42')];this['message']=_0x372325[_0xbc01('0x43')];this[_0xbc01('0x44')]=_0x372325[_0xbc01('0x44')];}if(_0x372325['Trunk']){this[_0xbc01('0x45')]={'id':_0x372325['Trunk']['id'],'name':_0x372325[_0xbc01('0x45')]['name'],'active':_0x372325[_0xbc01('0x45')][_0xbc01('0x46')],'callerid':_0x372325['Trunk'][_0xbc01('0x47')]};}}VoiceQueueSummary[_0xbc01('0x48')][_0xbc01('0x49')]=function(_0x4eaa07,_0x3e9114,_0x2dc114,_0x98aa6b){this['loggedInDb']=0x0;this[_0xbc01('0x4')]=0x0;this['paused']=0x0;this[_0xbc01('0x20')]=0x0;this['notInUse']=0x0;this[_0xbc01('0x17')]=0x0;this[_0xbc01('0x16')]=0x0;this[_0xbc01('0x18')]=0x0;this[_0xbc01('0x1f')]=0x0;this[_0xbc01('0x1b')]=0x0;this[_0xbc01('0x1c')]=0x0;this['onHold']=0x0;if(_0x2dc114){if(_0x2dc114['available']){this[_0xbc01('0x0')]=Number(_0x2dc114[_0xbc01('0x0')]);}if(_0x2dc114[_0xbc01('0x4a')]){this[_0xbc01('0x1')]=Number(_0x2dc114['loggedin']);}if(_0x2dc114['callers']){this[_0xbc01('0x5')]=Number(_0x2dc114[_0xbc01('0x4b')]);}}for(var _0x22589d=0x0;_0x22589d<_0x4eaa07[_0xbc01('0x4c')];_0x22589d++){var _0xd78e9d=_0x3e9114[_0xbc01('0x4d')+_0x4eaa07[_0x22589d][_0xbc01('0x12')]];if(_0xd78e9d&&_0xd78e9d['online']){this['loggedInDb']+=0x1;}if(_0x4eaa07[_0x22589d][_0xbc01('0x4e')]==='1'){this[_0xbc01('0x4')]+=0x1;}if(_0x4eaa07[_0x22589d][_0xbc01('0x3')]==='1'&&!['2','7','8']['includes'](_0x4eaa07[_0x22589d][_0xbc01('0x4f')])){this[_0xbc01('0x3')]+=0x1;}switch(_0x4eaa07[_0x22589d][_0xbc01('0x4f')]){case'0':this[_0xbc01('0x20')]+=0x1;break;case'1':this[_0xbc01('0x1a')]+=0x1;break;case'2':this[_0xbc01('0x17')]+=0x1;break;case'3':this[_0xbc01('0x16')]+=0x1;break;case'4':this[_0xbc01('0x18')]+=0x1;break;case'5':this[_0xbc01('0x1f')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0xbc01('0x1c')]+=0x1;break;case'8':this[_0xbc01('0x19')]+=0x1;break;}}if(this[_0xbc01('0x24')]==='booked'){var _0x30185e=Object[_0xbc01('0x50')](_0x98aa6b);for(var _0x83b750=0x0;_0x83b750<_0x30185e[_0xbc01('0x4c')];_0x83b750++){var _0x57e62f=_0x30185e[_0x83b750];var _0x5e22d7=_0x98aa6b[_0x57e62f];if(_0x5e22d7[_0xbc01('0x51')]===this[_0xbc01('0x12')]&&_0x5e22d7['type']==='dialer'&&_0x5e22d7['exten']==='xcally-motion-preview'){this[_0xbc01('0x4')]+=0x1;}}if(this['talking']>this['inUse']){this[_0xbc01('0x4')]=this[_0xbc01('0x17')];}this[_0xbc01('0xe')]=0x0;}return this;};VoiceQueueSummary[_0xbc01('0x48')][_0xbc01('0x52')]=function(_0x323986){var _0x286b15=![];if(_0x323986){_0x286b15=INBOUND_COUNTERS[_0xbc01('0x53')](function(_0xf03ed3){return this[_0xf03ed3]!==_0x323986[_0xf03ed3];},this);}return _0x286b15;};VoiceQueueSummary['prototype'][_0xbc01('0x54')]=function(_0x49ec33){var _0x4a1a26=![];var _0x4f2dc0=![];var _0x13126f=![];if(_0x49ec33){_0x4a1a26=this[_0xbc01('0x24')]!==_0x49ec33[_0xbc01('0x24')]||this[_0xbc01('0x23')]!==_0x49ec33['dialActive']||this[_0xbc01('0x43')]!==_0x49ec33['message']||this[_0xbc01('0x44')]!==_0x49ec33[_0xbc01('0x44')];_0x4f2dc0=OUTBOUND_COUNTERS[_0xbc01('0x53')](function(_0xba2e1d){return this[_0xba2e1d]!==_0x49ec33[_0xba2e1d];},this);if(this[_0xbc01('0x45')]&&_0x49ec33[_0xbc01('0x45')]){_0x13126f=this['Trunk'][_0xbc01('0x12')]!==_0x49ec33[_0xbc01('0x45')][_0xbc01('0x12')]||this['Trunk'][_0xbc01('0x46')]!==_0x49ec33[_0xbc01('0x45')]['active'];}}return _0x4a1a26||_0x4f2dc0||_0x13126f;};VoiceQueueSummary[_0xbc01('0x48')][_0xbc01('0x55')]=function(_0x2c8aab){this['answered']=_0x2c8aab['answered'];this[_0xbc01('0x43')]=_0x2c8aab[_0xbc01('0x43')];this[_0xbc01('0x44')]=_0x2c8aab['statusMessage'];this[_0xbc01('0x3c')]=_0x2c8aab['originated'];this['outboundAbandonedCallsDay']=_0x2c8aab[_0xbc01('0x56')];this[_0xbc01('0x6')]=_0x2c8aab[_0xbc01('0x6')];this[_0xbc01('0x7')]=_0x2c8aab['outboundBlacklistCallsDay'];this[_0xbc01('0x8')]=_0x2c8aab[_0xbc01('0x8')];this['outboundCongestionCallsDay']=_0x2c8aab[_0xbc01('0x9')];this[_0xbc01('0xa')]=_0x2c8aab['outboundNoAnswerCallsDay'];this[_0xbc01('0xb')]=_0x2c8aab[_0xbc01('0xb')];this['outboundReCallsDay']=_0x2c8aab['outboundReCallsDay'];this['outboundRejectCallsDay']=_0x2c8aab['outboundRejectCallsDay'];this[_0xbc01('0xd')]=_0x2c8aab[_0xbc01('0xd')];this[_0xbc01('0xf')]=_0x2c8aab[_0xbc01('0xf')];this[_0xbc01('0x10')]=_0x2c8aab['sumDuration'];this[_0xbc01('0x11')]=_0x2c8aab['total'];if(this[_0xbc01('0x24')]===_0xbc01('0x57')){this['pTalking']=_0x2c8aab[_0xbc01('0xe')];}};module[_0xbc01('0x58')]=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 998c88a..351d59e 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 _0xff75=['username','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x1cd618,_0x471bc1){var _0x118174=function(_0x47d34c){while(--_0x47d34c){_0x1cd618['push'](_0x1cd618['shift']());}};_0x118174(++_0x471bc1);}(_0xff75,0xbf));var _0x5ff7=function(_0x36f661,_0x3a0ced){_0x36f661=_0x36f661-0x0;var _0x262bb2=_0xff75[_0x36f661];return _0x262bb2;};'use strict';function VtigerAccount(_0x14439a){this['id']=_0x14439a['id']||0x0;this[_0x5ff7('0x0')]=_0x14439a[_0x5ff7('0x0')]||'';this['username']=_0x14439a[_0x5ff7('0x1')]||'';this['accessKey']=_0x14439a['accessKey']||'';this[_0x5ff7('0x2')]=_0x14439a[_0x5ff7('0x2')]||'';this[_0x5ff7('0x3')]=_0x14439a['serverUrl']||'';this[_0x5ff7('0x4')]=_0x14439a[_0x5ff7('0x4')]||{};}module[_0x5ff7('0x5')]=VtigerAccount; \ No newline at end of file +var _0x204b=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x2a99ea,_0x1bfb13){var _0x5887ae=function(_0x55dfc2){while(--_0x55dfc2){_0x2a99ea['push'](_0x2a99ea['shift']());}};_0x5887ae(++_0x1bfb13);}(_0x204b,0x81));var _0xb204=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x204b[_0x167cc1];return _0x10bc4b;};'use strict';function VtigerAccount(_0x506090){this['id']=_0x506090['id']||0x0;this['name']=_0x506090[_0xb204('0x0')]||'';this[_0xb204('0x1')]=_0x506090[_0xb204('0x1')]||'';this['accessKey']=_0x506090[_0xb204('0x2')]||'';this[_0xb204('0x3')]=_0x506090[_0xb204('0x3')]||'';this['serverUrl']=_0x506090[_0xb204('0x4')]||'';this[_0xb204('0x5')]=_0x506090[_0xb204('0x5')]||{};}module[_0xb204('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 2956992..13b1b23 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 _0x8a49=['serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type','integrationTab'];(function(_0x26fc3b,_0x2b1be3){var _0x380e31=function(_0x391a02){while(--_0x391a02){_0x26fc3b['push'](_0x26fc3b['shift']());}};_0x380e31(++_0x2b1be3);}(_0x8a49,0x7c));var _0x98a4=function(_0x26eb88,_0x5efcf1){_0x26eb88=_0x26eb88-0x0;var _0x5a1b15=_0x8a49[_0x26eb88];return _0x5a1b15;};'use strict';function ZendeskAccount(_0x4d2bc6){this['id']=_0x4d2bc6['id']||0x0;this[_0x98a4('0x0')]=_0x4d2bc6[_0x98a4('0x0')]||'';this[_0x98a4('0x1')]=_0x4d2bc6[_0x98a4('0x1')]||'';this[_0x98a4('0x2')]=_0x4d2bc6[_0x98a4('0x2')]||'';this[_0x98a4('0x3')]=_0x4d2bc6[_0x98a4('0x3')]||'';this['remoteUri']=_0x4d2bc6[_0x98a4('0x4')]||'';this[_0x98a4('0x5')]=_0x4d2bc6[_0x98a4('0x5')]||'';this[_0x98a4('0x6')]=_0x4d2bc6['type']||_0x98a4('0x7');this[_0x98a4('0x8')]=_0x4d2bc6['serverUrl']||'';this[_0x98a4('0x9')]=_0x4d2bc6[_0x98a4('0x9')]||{};}module[_0x98a4('0xa')]=ZendeskAccount; \ No newline at end of file +var _0x6e96=['type','serverUrl','Configurations','name','username','token','authType'];(function(_0x49c6cc,_0x308bdb){var _0x22e239=function(_0x48507d){while(--_0x48507d){_0x49c6cc['push'](_0x49c6cc['shift']());}};_0x22e239(++_0x308bdb);}(_0x6e96,0x199));var _0x66e9=function(_0x2b517f,_0x370ca5){_0x2b517f=_0x2b517f-0x0;var _0x292502=_0x6e96[_0x2b517f];return _0x292502;};'use strict';function ZendeskAccount(_0x59dc38){this['id']=_0x59dc38['id']||0x0;this[_0x66e9('0x0')]=_0x59dc38[_0x66e9('0x0')]||'';this[_0x66e9('0x1')]=_0x59dc38[_0x66e9('0x1')]||'';this['password']=_0x59dc38['password']||'';this[_0x66e9('0x2')]=_0x59dc38[_0x66e9('0x2')]||'';this['remoteUri']=_0x59dc38['remoteUri']||'';this['authType']=_0x59dc38[_0x66e9('0x3')]||'';this['type']=_0x59dc38[_0x66e9('0x4')]||'integrationTab';this[_0x66e9('0x5')]=_0x59dc38[_0x66e9('0x5')]||'';this[_0x66e9('0x6')]=_0x59dc38['Configurations']||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 0e37684..fe3db14 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 _0x49de=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','zone','clientId'];(function(_0x3aa091,_0x4a938a){var _0x1823d7=function(_0x3e690a){while(--_0x3e690a){_0x3aa091['push'](_0x3aa091['shift']());}};_0x1823d7(++_0x4a938a);}(_0x49de,0xed));var _0xe49d=function(_0x5c3143,_0x12d54c){_0x5c3143=_0x5c3143-0x0;var _0x42708d=_0x49de[_0x5c3143];return _0x42708d;};'use strict';function ZohoAccount(_0x1718e0){this['id']=_0x1718e0['id']||0x0;this[_0xe49d('0x0')]=_0x1718e0[_0xe49d('0x0')]||'';this[_0xe49d('0x1')]=_0x1718e0[_0xe49d('0x1')]||'';this[_0xe49d('0x2')]=_0x1718e0[_0xe49d('0x2')]||'';this['zone']=_0x1718e0[_0xe49d('0x3')]||'';this[_0xe49d('0x4')]=_0x1718e0[_0xe49d('0x4')]||'';this[_0xe49d('0x5')]=_0x1718e0['clientSecret']||'';this['serverUrl']=_0x1718e0[_0xe49d('0x6')]||'';this['code']=_0x1718e0[_0xe49d('0x7')]||'';this[_0xe49d('0x8')]=_0x1718e0['refreshToken']||'';this['Configurations']=_0x1718e0[_0xe49d('0x9')]||{};}module[_0xe49d('0xa')]=ZohoAccount; \ No newline at end of file +var _0x09ae=['Configurations','exports','name','description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken'];(function(_0x4bb5c2,_0x4beafd){var _0x3cf57a=function(_0x1d7e63){while(--_0x1d7e63){_0x4bb5c2['push'](_0x4bb5c2['shift']());}};_0x3cf57a(++_0x4beafd);}(_0x09ae,0x10a));var _0xe09a=function(_0xd36a97,_0x41eb68){_0xd36a97=_0xd36a97-0x0;var _0x2a9784=_0x09ae[_0xd36a97];return _0x2a9784;};'use strict';function ZohoAccount(_0x5eaa15){this['id']=_0x5eaa15['id']||0x0;this['name']=_0x5eaa15[_0xe09a('0x0')]||'';this['description']=_0x5eaa15[_0xe09a('0x1')]||'';this[_0xe09a('0x2')]=_0x5eaa15[_0xe09a('0x2')]||'';this[_0xe09a('0x3')]=_0x5eaa15[_0xe09a('0x3')]||'';this[_0xe09a('0x4')]=_0x5eaa15[_0xe09a('0x4')]||'';this[_0xe09a('0x5')]=_0x5eaa15[_0xe09a('0x5')]||'';this[_0xe09a('0x6')]=_0x5eaa15['serverUrl']||'';this[_0xe09a('0x7')]=_0x5eaa15[_0xe09a('0x7')]||'';this[_0xe09a('0x8')]=_0x5eaa15[_0xe09a('0x8')]||'';this[_0xe09a('0x9')]=_0x5eaa15[_0xe09a('0x9')]||{};}module[_0xe09a('0xa')]=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index e6f4be2..25c7005 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 _0x9582=['phone','lastName','calleridnum','scheduledat','countcongestionretry','countglobal','countbusyretry','countnoanswerretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','moment','isNil','string','uniqueid','name','type','queue','membername','Agent','format','SIP/%s','calleridname','Contact'];(function(_0x581853,_0x378622){var _0x32646d=function(_0x54f645){while(--_0x54f645){_0x581853['push'](_0x581853['shift']());}};_0x32646d(++_0x378622);}(_0x9582,0x95));var _0x2958=function(_0x169533,_0x2ad97f){_0x169533=_0x169533-0x0;var _0x1dfea6=_0x9582[_0x169533];return _0x1dfea6;};'use strict';var util=require(_0x2958('0x0'));var _=require(_0x2958('0x1'));var moment=require(_0x2958('0x2'));function checkNameSurname(_0x3d6d1f,_0x42752c,_0x176287){var _0x559a01='';if(!_[_0x2958('0x3')](_0x42752c)&&_0x2958('0x4')===typeof _0x42752c){_0x559a01+=_0x42752c;}if(!_[_0x2958('0x3')](_0x176287)&&_0x2958('0x4')===typeof _0x176287){_0x559a01+='\x20'+_0x176287;}if(_0x559a01!==''){return _0x559a01;}return _0x3d6d1f;}function Action(_0x2f15c9,_0xbde128,_0x88ffaa,_0x309525,_0xa385ec){this[_0x2958('0x5')]=_0x88ffaa||undefined;this['idContact']=_0x2f15c9['id'];this['queue']=_0xbde128[_0x2958('0x6')];this['type']=_0xbde128[_0x2958('0x7')];this['campaigntype']=_0x2958('0x8');this['dialAnswer']=![];this[_0x2958('0x9')]=_[_0x2958('0x3')](_0x2f15c9[_0x2958('0xa')])?undefined:_0x2f15c9[_0x2958('0xa')][_0x2958('0x6')];this['channelAgent']=this[_0x2958('0x9')]?util[_0x2958('0xb')](_0x2958('0xc'),this[_0x2958('0x9')]):_0x309525||undefined;this[_0x2958('0xd')]=checkNameSurname(_0x2f15c9[_0x2958('0xe')][_0x2958('0xf')],_0x2f15c9[_0x2958('0xe')]['firstName'],_0x2f15c9[_0x2958('0xe')][_0x2958('0x10')]);this['active']=_0x2f15c9['active']||![];this[_0x2958('0x11')]=_0x2f15c9[_0x2958('0xf')];this['scheduledat']=_0x2f15c9[_0x2958('0x12')];this['countbusyretry']=_0x2f15c9['countbusyretry']||0x0;this[_0x2958('0x13')]=_0x2f15c9[_0x2958('0x13')]||0x0;this['countnoanswerretry']=_0x2f15c9['countnoanswerretry']||0x0;this[_0x2958('0x14')]=(_0x2f15c9[_0x2958('0x15')]||0x0)+(_0x2f15c9[_0x2958('0x13')]||0x0)+(_0x2f15c9[_0x2958('0x16')]||0x0)+(_0x2f15c9[_0x2958('0x17')]||0x0)+(_0x2f15c9['countdropretry']||0x0)+(_0x2f15c9[_0x2958('0x18')]||0x0)+(_0x2f15c9[_0x2958('0x19')]||0x0)+(_0x2f15c9[_0x2958('0x1a')]||0x0);this['countnosuchnumberretry']=_0x2f15c9[_0x2958('0x17')]||0x0;this['countdropretry']=_0x2f15c9[_0x2958('0x1b')]||0x0;this['countabandonedretry']=_0x2f15c9['countabandonedretry']||0x0;this[_0x2958('0x19')]=_0x2f15c9[_0x2958('0x19')]||0x0;this[_0x2958('0x1a')]=_0x2f15c9[_0x2958('0x1a')]||0x0;this[_0x2958('0x1c')]=_0x2f15c9[_0x2958('0x1c')];this[_0x2958('0x1d')]=_0x2f15c9[_0x2958('0x1d')];this[_0x2958('0x1e')]=_0x2f15c9[_0x2958('0x1e')];this[_0x2958('0x1f')]=_0x2f15c9[_0x2958('0x1f')];this[_0x2958('0x20')]=_0x2f15c9[_0x2958('0x20')];this[_0x2958('0x21')]=_0x2f15c9['ListId'];this['UserId']=_[_0x2958('0x3')](_0x2f15c9[_0x2958('0xa')])?_0x2f15c9[_0x2958('0x22')]:_0x2f15c9[_0x2958('0xa')]['id'];this['VoiceQueueId']=_0x2f15c9[_0x2958('0x23')];this['originatecalleridnum']='';this[_0x2958('0x24')]='';}Action[_0x2958('0x25')][_0x2958('0x26')]=function(){return util[_0x2958('0xb')](_0x2958('0x27'),this[_0x2958('0xd')],this[_0x2958('0x28')]);};module['exports']=Action; \ No newline at end of file +var _0x32b6=['membername','Agent','channelAgent','format','SIP/%s','calleridname','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','exports','util','lodash','isNil','string','uniqueid','queue','name','type'];(function(_0x5b774f,_0x59d0bd){var _0x32dc18=function(_0x3eadb5){while(--_0x3eadb5){_0x5b774f['push'](_0x5b774f['shift']());}};_0x32dc18(++_0x59d0bd);}(_0x32b6,0x1d1));var _0x632b=function(_0x20a6ec,_0x234271){_0x20a6ec=_0x20a6ec-0x0;var _0x4d0794=_0x32b6[_0x20a6ec];return _0x4d0794;};'use strict';var util=require(_0x632b('0x0'));var _=require(_0x632b('0x1'));var moment=require('moment');function checkNameSurname(_0x1f0635,_0x1d100a,_0x51c210){var _0x5ad871='';if(!_[_0x632b('0x2')](_0x1d100a)&&_0x632b('0x3')===typeof _0x1d100a){_0x5ad871+=_0x1d100a;}if(!_[_0x632b('0x2')](_0x51c210)&&_0x632b('0x3')===typeof _0x51c210){_0x5ad871+='\x20'+_0x51c210;}if(_0x5ad871!==''){return _0x5ad871;}return _0x1f0635;}function Action(_0x1adfe6,_0x122768,_0x24ceab,_0x10458a,_0x3bbf43){this[_0x632b('0x4')]=_0x24ceab||undefined;this['idContact']=_0x1adfe6['id'];this[_0x632b('0x5')]=_0x122768[_0x632b('0x6')];this[_0x632b('0x7')]=_0x122768[_0x632b('0x7')];this['campaigntype']='queue';this['dialAnswer']=![];this[_0x632b('0x8')]=_['isNil'](_0x1adfe6[_0x632b('0x9')])?undefined:_0x1adfe6[_0x632b('0x9')][_0x632b('0x6')];this[_0x632b('0xa')]=this[_0x632b('0x8')]?util[_0x632b('0xb')](_0x632b('0xc'),this[_0x632b('0x8')]):_0x10458a||undefined;this[_0x632b('0xd')]=checkNameSurname(_0x1adfe6['Contact'][_0x632b('0xe')],_0x1adfe6[_0x632b('0xf')][_0x632b('0x10')],_0x1adfe6['Contact'][_0x632b('0x11')]);this[_0x632b('0x12')]=_0x1adfe6[_0x632b('0x12')]||![];this[_0x632b('0x13')]=_0x1adfe6[_0x632b('0xe')];this[_0x632b('0x14')]=_0x1adfe6['scheduledat'];this[_0x632b('0x15')]=_0x1adfe6['countbusyretry']||0x0;this['countcongestionretry']=_0x1adfe6[_0x632b('0x16')]||0x0;this['countnoanswerretry']=_0x1adfe6[_0x632b('0x17')]||0x0;this[_0x632b('0x18')]=(_0x1adfe6[_0x632b('0x15')]||0x0)+(_0x1adfe6['countcongestionretry']||0x0)+(_0x1adfe6[_0x632b('0x17')]||0x0)+(_0x1adfe6[_0x632b('0x19')]||0x0)+(_0x1adfe6[_0x632b('0x1a')]||0x0)+(_0x1adfe6[_0x632b('0x1b')]||0x0)+(_0x1adfe6['countmachineretry']||0x0)+(_0x1adfe6[_0x632b('0x1c')]||0x0);this[_0x632b('0x19')]=_0x1adfe6['countnosuchnumberretry']||0x0;this[_0x632b('0x1a')]=_0x1adfe6['countdropretry']||0x0;this['countabandonedretry']=_0x1adfe6[_0x632b('0x1b')]||0x0;this['countmachineretry']=_0x1adfe6[_0x632b('0x1d')]||0x0;this[_0x632b('0x1c')]=_0x1adfe6[_0x632b('0x1c')]||0x0;this['callback']=_0x1adfe6[_0x632b('0x1e')];this[_0x632b('0x1f')]=_0x1adfe6['callbackuniqueid'];this[_0x632b('0x20')]=_0x1adfe6[_0x632b('0x20')];this[_0x632b('0x21')]=_0x1adfe6[_0x632b('0x21')];this[_0x632b('0x22')]=_0x1adfe6[_0x632b('0x22')];this['ListId']=_0x1adfe6['ListId'];this[_0x632b('0x23')]=_['isNil'](_0x1adfe6[_0x632b('0x9')])?_0x1adfe6[_0x632b('0x23')]:_0x1adfe6['Agent']['id'];this[_0x632b('0x24')]=_0x1adfe6[_0x632b('0x24')];this[_0x632b('0x25')]='';this[_0x632b('0x26')]='';}Action[_0x632b('0x27')][_0x632b('0x28')]=function(){return util[_0x632b('0xb')](_0x632b('0x29'),this[_0x632b('0xd')],this['number']);};module[_0x632b('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 276adf7..626b62c 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 _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x1ec7ba,_0xb004bf){var _0x551796=function(_0x472e3d){while(--_0x472e3d){_0x1ec7ba['push'](_0x1ec7ba['shift']());}};_0x551796(++_0xb004bf);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file +var _0xa9e0=['varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','info','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','sendMessageOneNotActive','originated','pTalking','available','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20deactivated','syncCampaigns','hasOwnProperty','dialMethod','booked','type','outbound','dialActive','setMessage','recallMe','clearZombieChannel','sequence','isNil','Queue','queue','originated:\x20','stringify','pick','UserId','VoiceQueueId','ListId','channel','message','No\x20such\x20channel','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','size','getContactRecallMe','then','length','getDiff','scheduledat','Agent','voicePause','run','[RecallMe]','catch','logger2','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[getContactRecallMe]','IsNotLoggedIn','NO_AGENTS_LOGGED','isActive','isTrunkReachable','UNREACHABLE_TRUNK','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','additional','dialNoSuchNumberRetryFrequency','cloneAction','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','activeContact','linkedid','idContact','incrementPreviewCounters','ANSWER','answertime','[syncHangup][talking][increment]','pTalking:\x20','custom:agentconnect','connect','acw','mandatoryDisposition','custom:agentConnectPreview','channelAgent','uniqueid','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','sumDuration','talktime','sumBillable','[syncHangup][talking][decrement]','\x20Queue','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','callAdditionalPhoneAfterMin','busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','Global','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','unlockAgent','NOANSWER','countnoanswerretry','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','outboundCongestionCallsDay','countcongestionretry','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','swapAdditionalPhones','CANCEL','outboundRejectCallsDay','countagentrejectretry','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','countmachineretry','cause-txt','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','outboundUnknownCallsDay','dialstatus','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','isUndefined','reason','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','logBlacklist','[Blacklist][error]','Contact\x20in\x20black\x20List','active','SIP/%s','status','reachable','unmonitored','execRun','unlock','unlockContact','recallme','validateContact','checkIsBlackList','[Preview][checkIsBlackList]','[Preview][getContactPreview]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','Trunk','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','addVariables','merge','toLowerVariables','variables','variablesAction','Action','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','actionid','logLookAgent','clone','responsetime','response','rejected','Answer','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','dialQueueProject','channelstate','transfer','[syncHangup][talking][transfer]','syncHangupRequest','addVariable','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','uuid','../../../config/environment','preview','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','../dialer/utils','redis','prototype','enqueue','tail','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncDialEnd','syncNewExten'];(function(_0x5ca779,_0x415a01){var _0xc0891a=function(_0x5abbe8){while(--_0x5abbe8){_0x5ca779['push'](_0x5ca779['shift']());}};_0xc0891a(++_0x415a01);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var uuid=require(_0x0a9e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x0a9e('0x3'));var logger=require('../../../config/logger')(_0x0a9e('0x4'));var loggerAction=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var ami=require(_0x0a9e('0x7'));var rpcDb=require(_0x0a9e('0x8'));var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0x0a9e('0x9'));var ut=require(_0x0a9e('0xa'));var utils=require(_0x0a9e('0xb'));config['redis']=_['defaults'](config[_0x0a9e('0xc')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x0a9e('0xc')]));var Sequence=function(){};Sequence[_0x0a9e('0xd')][_0x0a9e('0xe')]=function(_0x3ab53f){this[_0x0a9e('0xf')]=this[_0x0a9e('0xf')]?this['tail']['finally'](_0x3ab53f):_0x3ab53f();};function Preview(_0x527cdd){this['sequence']=new Sequence();this[_0x0a9e('0x10')]=_0x527cdd[_0x0a9e('0x11')];this[_0x0a9e('0x12')]=_0x527cdd[_0x0a9e('0x12')];this[_0x0a9e('0x13')]={};this[_0x0a9e('0x14')]=_0x527cdd['agents'];this[_0x0a9e('0x15')]=0x0;ami['on'](_0x0a9e('0x16'),this[_0x0a9e('0x17')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x19'),this[_0x0a9e('0x1a')]['bind'](this));ami['on'](_0x0a9e('0x1b'),this['syncHangupRequest'][_0x0a9e('0x18')](this));ami['on']('dialend',this[_0x0a9e('0x1c')][_0x0a9e('0x18')](this));ami['on']('newexten',this[_0x0a9e('0x1d')]['bind'](this));ami['on'](_0x0a9e('0x1e'),this[_0x0a9e('0x1f')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x20'),this[_0x0a9e('0x21')][_0x0a9e('0x18')](this));ami['on'](_0x0a9e('0x22'),this[_0x0a9e('0x23')][_0x0a9e('0x18')](this));this[_0x0a9e('0x24')](this[_0x0a9e('0x10')]);}function emit(_0x105080,_0x4bb1e3,_0x2c3407){io['to'](_0x105080)[_0x0a9e('0x25')](_0x4bb1e3,_0x2c3407);}function emitVoiceQueueChannelRemove(_0x53682f){logger[_0x0a9e('0x26')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON['stringify'](_0x53682f));emit(util[_0x0a9e('0x27')](_0x0a9e('0x28'),_0x53682f[_0x0a9e('0x29')]),_0x0a9e('0x2a'),_0x53682f);io['emit'](_0x0a9e('0x2b'),_0x53682f);}function notSendMessagesQueue(_0x2fb0e4){if(_0x2fb0e4[_0x0a9e('0x2c')]){if(_0x2fb0e4[_0x0a9e('0x2d')]===0x0&&_0x2fb0e4[_0x0a9e('0x2e')]===0x0){_0x2fb0e4[_0x0a9e('0x2c')]=![];_0x2fb0e4[_0x0a9e('0x2f')]=0x0;_0x2fb0e4['paused']=0x0;_0x2fb0e4['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4['name']+_0x0a9e('0x34'));}else{_0x2fb0e4['message']=utils[_0x0a9e('0x30')]['DEACTIVATED'];ut[_0x0a9e('0x32')](_0x0a9e('0x33'),_0x2fb0e4[_0x0a9e('0x29')]+_0x0a9e('0x35'));}}}Preview[_0x0a9e('0xd')][_0x0a9e('0x24')]=function(){var _0x11c3b6=this;setInterval(function(){_0x11c3b6[_0x0a9e('0x36')]();},0x7cf);};Preview['prototype'][_0x0a9e('0x36')]=function(){var _0x468813=this[_0x0a9e('0x10')];this[_0x0a9e('0x15')]+=0x1;for(var _0x5c877d in _0x468813){if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&(_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x4')||_0x468813[_0x5c877d][_0x0a9e('0x38')]===_0x0a9e('0x39'))&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(this[_0x0a9e('0x15')]>0x7){this[_0x0a9e('0x15')]=0x0;this['clearZombieChannels']();}}if(_0x468813[_0x0a9e('0x37')](_0x5c877d)&&_0x468813[_0x5c877d]['dialMethod']===_0x0a9e('0x4')&&_0x468813[_0x5c877d][_0x0a9e('0x3a')]===_0x0a9e('0x3b')){if(_0x468813[_0x5c877d][_0x0a9e('0x3c')]){this[_0x0a9e('0x3d')](_0x468813[_0x5c877d]);if(_0x468813[_0x5c877d]['dialPreviewAutoRecallMe'])this[_0x0a9e('0x3e')](_0x468813[_0x5c877d]);}else{notSendMessagesQueue(_0x468813[_0x5c877d]);}}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3f')]=function(_0x2da5c0){var _0x2b45ea=this;this[_0x0a9e('0x40')][_0x0a9e('0xe')](function(){if(!_[_0x0a9e('0x41')](_0x2b45ea['actions'][_0x2da5c0])){loggerAction[_0x0a9e('0x26')]('[clearZombieChannels][talking]',_0x2da5c0,_0x0a9e('0x42'),_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')],_0x0a9e('0x44'),JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2d')]),'pTalking:\x20',JSON['stringify'](_0x2b45ea[_0x0a9e('0x10')][_0x2b45ea['actions'][_0x2da5c0][_0x0a9e('0x43')]][_0x0a9e('0x2e')]),JSON[_0x0a9e('0x45')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]['dialAnswer']),JSON[_0x0a9e('0x45')](_[_0x0a9e('0x46')](_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0],['contactId',_0x0a9e('0x47'),_0x0a9e('0x48'),_0x0a9e('0x49')])));return ami['Action']({'action':'status','channel':_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4a')]})['catch'](function(_0x2b814e){if(_0x2b814e[_0x0a9e('0x4b')]===_0x0a9e('0x4c')){setTimeout(function(){if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0]){ut['updateOriginated'](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],'[clearZombieChannel]');if(_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x4d')]===!![]){ut[_0x0a9e('0x4e')](_0x2b45ea['campaignsPreview'][_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]],_0x0a9e('0x4f'));ut[_0x0a9e('0x50')](_0x0a9e('0x51')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);}ut[_0x0a9e('0x50')](_0x0a9e('0x52')+_0x2da5c0,_0x2b45ea[_0x0a9e('0x13')][_0x2da5c0][_0x0a9e('0x43')]);delete _0x2b45ea[_0x0a9e('0x13')][_0x2da5c0];}},0x2328);}});}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x53')]=function(){var _0x37f6cc=this;loggerAction['info']('[action]',_[_0x0a9e('0x54')](this[_0x0a9e('0x13')]));for(var _0x405c8f in this[_0x0a9e('0x13')]){if(_0x37f6cc[_0x0a9e('0x13')][_0x0a9e('0x37')](_0x405c8f)){_0x37f6cc[_0x0a9e('0x3f')](_0x405c8f);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x3e')]=function(_0x25c6e6){var _0x2c2cb0=this;rpcDb[_0x0a9e('0x55')](_0x25c6e6['id'],ut['agentReadyId'](this[_0x0a9e('0x14')]))[_0x0a9e('0x56')](function(_0xdd268f){if(!_[_0x0a9e('0x41')](_0xdd268f)){for(var _0x2e8caf=0x0;_0x2e8caf<_0xdd268f[_0x0a9e('0x57')];_0x2e8caf+=0x1){if(ut[_0x0a9e('0x58')](_0xdd268f[_0x2e8caf][_0x0a9e('0x59')])<_0x25c6e6['dialRecallMeTimeout']*0x3c){if(_0xdd268f[_0x2e8caf][_0x0a9e('0x5a')]&&!_0xdd268f[_0x2e8caf]['Agent'][_0x0a9e('0x5b')]){_0x2c2cb0[_0x0a9e('0x5c')](_0xdd268f[_0x2e8caf]['id'])[_0x0a9e('0x56')](ut['logger2'](_0x0a9e('0x5d')))[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x5d')));}else{rpcDb[_0x0a9e('0x60')](_0xdd268f[_0x2e8caf]['id']);}}else{var _0x37be73=new Action(_0xdd268f[_0x2e8caf],_0x25c6e6);_0x37be73[_0x0a9e('0x61')]=moment()['format'](_0x0a9e('0x62'));_0x25c6e6[_0x0a9e('0x63')]+=0x1;ut[_0x0a9e('0x64')](_0x37be73,0x17,_0x0a9e('0x65'));if(_0x25c6e6[_0x0a9e('0x66')]){rpcDb[_0x0a9e('0x67')](ut[_0x0a9e('0x68')](_0xdd268f[_0x2e8caf]));rpcDb[_0x0a9e('0x69')](_0x37be73,_0x0a9e('0x6a'));}else{ut['logCustomer'](_0x37be73,0x16,_0x0a9e('0x6b'));rpcDb[_0x0a9e('0x69')](_0x37be73,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x37be73,'[HistoryRecallClose]');}}}}})[_0x0a9e('0x5e')](ut[_0x0a9e('0x5f')](_0x0a9e('0x6c')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x3d')]=function(_0x30decb){_0x30decb[_0x0a9e('0x2c')]=!![];if(ut[_0x0a9e('0x6d')](_0x30decb['loggedIn'])){_0x30decb['message']=utils['CAMPAIGN_STATUS'][_0x0a9e('0x6e')];}else if(!ut[_0x0a9e('0x6f')](_0x30decb[_0x0a9e('0x3c')])){_0x30decb['message']=utils[_0x0a9e('0x30')][_0x0a9e('0x31')];}else if(!this['isTrunkReachable'](_0x30decb['Trunk'])){if(!this[_0x0a9e('0x70')](_0x30decb['TrunkBackup'])){_0x30decb[_0x0a9e('0x4b')]=utils['CAMPAIGN_STATUS'][_0x0a9e('0x71')];}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}}else{_0x30decb[_0x0a9e('0x4b')]=utils[_0x0a9e('0x30')]['ACTIVE'];}};Preview['prototype'][_0x0a9e('0x72')]=function(_0x3aedd0,_0x49c095,_0x145931){var _0x5ce9ac=this;var _0x211ef9=this['actions'][_0x49c095];var _0xe22ccc=this['campaignsPreview'][_0x211ef9['queue']];var _0x5df0ad;var _0x2da03c=![];var _0x47de4c=0x2;var _0x2f7092=0x3;if(_0xe22ccc){switch(_0x145931){case'1':_0xe22ccc[_0x0a9e('0x73')]+=0x1;_0x211ef9[_0x0a9e('0x74')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x0,_0x0a9e('0x77'));ami[_0x0a9e('0x25')]('custom:agentnosuchnumber',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x79')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0x7a'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'0',_0xe22ccc)[_0x0a9e('0x56')](function(_0x5d86e9){_0x2da03c=_0x5d86e9[_0x0a9e('0x7c')]==0x1;_0x47de4c=_0xe22ccc[_0x0a9e('0x7d')];_0x2f7092=_0xe22ccc['callAdditionalPhoneAfterMin'];if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc['dialGlobalMaxRetry']){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb['createCustomerFinal'](_0x5df0ad,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x211ef9[_0x0a9e('0x74')]>=_0xe22ccc['dialNoSuchNumberMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x80'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0x74'),_0xe22ccc[_0x0a9e('0x7d')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}delete this['actions'][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x211ef9[_0x0a9e('0x74')]++;logger[_0x0a9e('0x26')]('actioncountonusuch',_0x211ef9[_0x0a9e('0x74')]);logger[_0x0a9e('0x26')]('id',_0x211ef9[_0x0a9e('0x85')]);_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnosuchnumberretry':_0x211ef9[_0x0a9e('0x74')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0x87'):var _0x88dcbf=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x211ef9['responsetime']=_0x88dcbf;_0x211ef9[_0x0a9e('0x88')]=_0x88dcbf;_0x211ef9[_0x0a9e('0x4d')]=!![];_0xe22ccc[_0x0a9e('0x2e')]+=0x1;logger['info'](_0x0a9e('0x89'),_0x211ef9['uniqueid'],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0xe22ccc[_0x0a9e('0x2e')]);ami[_0x0a9e('0x25')](_0x0a9e('0x8b'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0x8c'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));if(_0xe22ccc[_0x0a9e('0x8d')]||_0xe22ccc[_0x0a9e('0x8e')]){ami[_0x0a9e('0x25')](_0x0a9e('0x8f'),{'queue':_0x211ef9[_0x0a9e('0x43')],'interface':_0x211ef9[_0x0a9e('0x90')],'uniqueid':_0x211ef9[_0x0a9e('0x91')]});}break;case'16':ami[_0x0a9e('0x25')](_0x0a9e('0x92'),ut['buildObj'](_0x211ef9,_0x0a9e('0x93'),this[_0x0a9e('0x10')][_0x211ef9[_0x0a9e('0x43')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x211ef9,_0x0a9e('0x93')));_0xe22ccc[_0x0a9e('0x94')]+=0x1;_0xe22ccc['total']+=0x1;_0xe22ccc[_0x0a9e('0x95')]+=0x1;ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0x96'));_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x4,'Answer');rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0x97'));rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0x98'));rpcDb[_0x0a9e('0x99')](_0x211ef9);_0xe22ccc[_0x0a9e('0x9a')]+=_0x211ef9[_0x0a9e('0x9b')];_0xe22ccc[_0x0a9e('0x9c')]+=_0x211ef9[_0x0a9e('0x9b')];logger['info'](_0x0a9e('0x9d'),_0x211ef9[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0xe22ccc['name'],_0x0a9e('0x8a'),_0xe22ccc['pTalking']);delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'BUSY':_0xe22ccc[_0x0a9e('0x9f')]+=0x1;_0x211ef9[_0x0a9e('0xa0')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x5,_0x0a9e('0xa1'));_0x47de4c=_0xe22ccc[_0x0a9e('0xa2')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')]('custom:agentbusy',ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xa4')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xa5'));_0x5ce9ac['verifyAdditionalPhones'](_0x211ef9,'5',_0xe22ccc)[_0x0a9e('0x56')](function(_0x3511c9){_0x2da03c=_0x3511c9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xa8'));}else{if(_0x211ef9[_0x0a9e('0xa0')]>=_0xe22ccc[_0x0a9e('0xa9')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xa5'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xa0'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xa0')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countbusyretry':_0x211ef9[_0x0a9e('0xa0')]}})['then'](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xab'):_0xe22ccc['outboundNoAnswerCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xac')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x3,'NoAnswer');_0x47de4c=_0xe22ccc[_0x0a9e('0xad')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];var _0x2d2286=ut[_0x0a9e('0xae')](_0x211ef9,_0xe22ccc);ami[_0x0a9e('0x25')](_0x0a9e('0xaf'),_0x2d2286);rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logNoAnswer]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'3',_0xe22ccc)[_0x0a9e('0x56')](function(_0x45c109){_0x2da03c=_0x45c109[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,'Global');rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x211ef9[_0x0a9e('0xac')]>=_0xe22ccc[_0x0a9e('0xb0')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xb1'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xac'),_0xe22ccc[_0x0a9e('0xad')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9['idContact'],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'CONGESTION':_0xe22ccc[_0x0a9e('0xb2')]+=0x1;_0x211ef9[_0x0a9e('0xb3')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x8,_0x0a9e('0xb4'));_0x47de4c=_0xe22ccc['dialCongestionRetryFrequency'];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami['emit'](_0x0a9e('0xb5'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xb6')));rpcDb[_0x0a9e('0x69')](_0x211ef9,'[callProgressDetectingCustomer][logCongestion]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'8',_0xe22ccc)[_0x0a9e('0x56')](function(_0x1d4877){_0x2da03c=_0x1d4877['additional']==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xb7'));}else{if(_0x211ef9[_0x0a9e('0xb3')]>=_0xe22ccc[_0x0a9e('0xb8')]){rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xb9'));}else{rpcDb[_0x0a9e('0x81')](ut['scheduledAt'](_0x211ef9,_0x0a9e('0xb3'),_0xe22ccc[_0x0a9e('0xa2')]),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xb3')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countcongestionretry':_0x211ef9[_0x0a9e('0xb3')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case _0x0a9e('0xbb'):_0xe22ccc[_0x0a9e('0xbc')]+=0x1;_0x211ef9[_0x0a9e('0xbd')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0x14,_0x0a9e('0xbe'));_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];ami[_0x0a9e('0x25')](_0x0a9e('0xc0'),ut[_0x0a9e('0x78')](_0x211ef9,_0x0a9e('0xc1')));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc2'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)[_0x0a9e('0x56')](function(_0x4989f9){_0x2da03c=_0x4989f9[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut[_0x0a9e('0x76')](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x14,_0x0a9e('0xbe'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xc3'));}else{if(_0x211ef9[_0x0a9e('0xbd')]>=_0xe22ccc['dialAgentRejectMaxRetry']){rpcDb[_0x0a9e('0x7f')](_0x211ef9,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,_0x0a9e('0xbd'),_0xe22ccc[_0x0a9e('0xbf')]),_0x211ef9['unlockAgent'],_0x211ef9[_0x0a9e('0x83')]);}}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9['countnoanswerretry']}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});break;case'ABANDONED':_0xe22ccc['outboundAbandonedCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc4')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xb,_0x0a9e('0xc5'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xc6'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'11',_0xe22ccc)[_0x0a9e('0x56')](function(_0x586510){_0x2da03c=_0x586510[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xc6'));}else{if(_0x211ef9['countabandonedetry']>=_0xe22ccc[_0x0a9e('0xc7')]){rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xc6'));}else{rpcDb[_0x0a9e('0x81')](ut[_0x0a9e('0x82')](_0x211ef9,'countabandonedretry',_0xe22ccc['dialAbandonedRetryFrequency']),_0x211ef9[_0x0a9e('0xaa')],_0x211ef9['activeContact']);}}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});break;case'18':_0xe22ccc['outboundUnknownCallsDay']+=0x1;_0x211ef9[_0x0a9e('0xc8')]+=0x1;_0x211ef9['countglobal']=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x12,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0['dialstatus']);ami['emit'](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb[_0x0a9e('0x69')](_0x211ef9,_0x0a9e('0xcb'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2eb028){_0x2da03c=_0x2eb028['additional']==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0x12,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,_0x0a9e('0xcb'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xcb'));}}else{_0x211ef9[_0x0a9e('0xac')]++;_0x5ce9ac['incrementPreviewCounters']({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})[_0x0a9e('0x56')](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;case'19':_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut['logCustomer'](_0x211ef9,0x13,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);ami[_0x0a9e('0x25')](_0x0a9e('0xca'),ut[_0x0a9e('0x78')](_0x211ef9,'amd'));rpcDb['createCustomerHistory'](_0x211ef9,_0x0a9e('0xce'));_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'18',_0xe22ccc)[_0x0a9e('0x56')](function(_0x2fea95){_0x2da03c=_0x2fea95[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb['createCustomerFinal'](_0x5df0ad,_0x0a9e('0xce'));}else{rpcDb['createCustomerFinal'](_0x211ef9,_0x0a9e('0xce'));}}else{_0x211ef9['countnoanswerretry']++;_0x5ce9ac[_0x0a9e('0x86')]({'id':_0x211ef9[_0x0a9e('0x85')],'field':{'countnoanswerretry':_0x211ef9[_0x0a9e('0xac')]}})['then'](function(){_0x5ce9ac[_0x0a9e('0xba')](_0x211ef9,_0x47de4c,_0x2f7092)['then'](function(){});});}});delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];break;default:if(_0x211ef9[_0x0a9e('0x4d')]){ut[_0x0a9e('0x4e')](_0xe22ccc,_0x0a9e('0xcf'));ut[_0x0a9e('0x50')](_0x0a9e('0xd0')+_0xe22ccc[_0x0a9e('0x29')],_0x3aedd0);}_0xe22ccc[_0x0a9e('0xcc')]+=0x1;_0x211ef9[_0x0a9e('0x75')]=ut[_0x0a9e('0x76')](_0x211ef9);ut[_0x0a9e('0x64')](_0x211ef9,0xc,_0x3aedd0[_0x0a9e('0xc9')]||_0x3aedd0[_0x0a9e('0xcd')]);_0x47de4c=_0xe22ccc[_0x0a9e('0xbf')];_0x2f7092=_0xe22ccc[_0x0a9e('0xa3')];rpcDb['createCustomerHistory'](_0x211ef9,'[callProgressDetectingCustomer][logUnknown]');_0x5ce9ac[_0x0a9e('0x7b')](_0x211ef9,'20',_0xe22ccc)['then'](function(_0x1d999b){_0x2da03c=_0x1d999b[_0x0a9e('0x7c')]==0x1;if(!_0x2da03c){if(ut['totalGlobal'](_0x211ef9)>=_0xe22ccc[_0x0a9e('0xa6')]){_0x5df0ad=ut[_0x0a9e('0x7e')](_0x211ef9,0xf,_0x0a9e('0xa7'));rpcDb[_0x0a9e('0x7f')](_0x5df0ad,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb[_0x0a9e('0x7f')](_0x211ef9,_0x0a9e('0xd1'));}delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0x84')]];}else{_0x5ce9ac['swapAdditionalPhones'](_0x211ef9,_0x47de4c,_0x2f7092)[_0x0a9e('0x56')](function(){});}});}if(!(_0x211ef9[_0x0a9e('0x4d')]&&_0x145931==='16')){ut[_0x0a9e('0xd2')](_0xe22ccc,'[callProgressDetectingCustomer]');logger[_0x0a9e('0x26')](_0x0a9e('0xd3'),_0x211ef9[_0x0a9e('0x91')],'\x20Queue',_0xe22ccc[_0x0a9e('0x29')],_0x0a9e('0x44'),_0xe22ccc[_0x0a9e('0x2d')]);}if(_0x145931!==_0x0a9e('0x87')){delete this[_0x0a9e('0x13')][_0x3aedd0['linkedid']];delete this[_0x0a9e('0x13')][_0x3aedd0[_0x0a9e('0xd4')]];}_0xe22ccc['queueSummaryCountersUpdated']=!![];}};Preview[_0x0a9e('0xd')][_0x0a9e('0xd5')]=function(_0x1f6f1c,_0x5822a7,_0x5c3b6f){if(_['isUndefined'](_0x5822a7)&&_0x0a9e('0xd6')!==typeof _0x5822a7){return;}if(_[_0x0a9e('0xd7')](_0x5c3b6f)&&'object'!==typeof _0x5c3b6f){return;}switch(_0x5c3b6f[_0x0a9e('0xd8')]){case'0':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x0,_0x0a9e('0x77'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xda'));break;case'3':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x3,_0x0a9e('0xdb'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdd'));break;case'5':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x5,_0x0a9e('0xa1'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xde'));break;case'8':ut['logAgent'](_0x1f6f1c,0x8,_0x0a9e('0xb4'));rpcDb['createAgentHistory'](_0x1f6f1c,_0x0a9e('0xdf'));break;case'22':ut[_0x0a9e('0xd9')](_0x1f6f1c,0x16,_0x0a9e('0xe0'));rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xe1'));break;default:ut[_0x0a9e('0xd9')](_0x1f6f1c,0xc,_0x5c3b6f['reason']);rpcDb[_0x0a9e('0xdc')](_0x1f6f1c,_0x0a9e('0xdf'));}ut[_0x0a9e('0xd2')](_0x5822a7,_0x0a9e('0xe2'));logger['info'](_0x0a9e('0xe3'),_0x1f6f1c[_0x0a9e('0x91')],_0x0a9e('0x9e'),_0x5822a7[_0x0a9e('0x29')],_0x0a9e('0x44'),_0x5822a7[_0x0a9e('0x2d')]);delete this[_0x0a9e('0x13')][_0x1f6f1c[_0x0a9e('0x91')]];};Preview[_0x0a9e('0xd')][_0x0a9e('0x7b')]=function(_0x57f0ad,_0x2272bc,_0x88b25f){return cmHopperAdditionalPhone[_0x0a9e('0x7b')](_0x57f0ad,_0x2272bc,_0x88b25f)[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')](_0x0a9e('0xe4')));};Preview[_0x0a9e('0xd')][_0x0a9e('0xba')]=function(_0x566b90,_0x3b581c,_0xd2391){return cmHopperAdditionalPhone[_0x0a9e('0xba')](_0x566b90,_0x3b581c,_0xd2391)['catch'](logger[_0x0a9e('0x26')](_0x0a9e('0xe5')));};Preview[_0x0a9e('0xd')][_0x0a9e('0x86')]=function(_0x370b5e){return Promise[_0x0a9e('0xe6')]()[_0x0a9e('0x56')](cmHopperAdditionalPhone[_0x0a9e('0x86')](_0x370b5e))[_0x0a9e('0x5e')](logger[_0x0a9e('0x26')]('[incrementPreviewCounters]\x20'));};Preview[_0x0a9e('0xd')][_0x0a9e('0xe7')]=function(_0x15a9ed,_0x3db98f,_0x2b624e,_0x3942fd,_0x5cb48d){var _0x382687=this;return new Promise(function(_0x4f854b,_0x5bd139){if(_['isNil'](_0x3db98f)||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe8')])||_[_0x0a9e('0x41')](_0x3db98f[_0x0a9e('0xe9')])||_['isNil'](_0x3db98f[_0x0a9e('0x48')])){_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xea'),_0x3942fd,_0x5cb48d));return;}var _0x1fdb10=uuid['v4']();var _0x2c8d1d=_0x382687['campaignsPreview'][_0x3db98f['Queue'][_0x0a9e('0x29')]];var _0x33bcb2=_0x2b624e?_0x382687[_0x0a9e('0x14')][_0x2b624e]['id']:undefined;_0x382687['actions'][_0x1fdb10]=new Action(_0x3db98f,_0x2c8d1d,_0x1fdb10,_0x2b624e,_0x33bcb2);var _0x319752=_0x382687[_0x0a9e('0x13')][_0x1fdb10];_0x319752[_0x0a9e('0xaa')]=_0x3942fd;_0x319752['activeContact']=_0x5cb48d;_0x319752[_0x0a9e('0xeb')]=_0x2b624e;if(_[_0x0a9e('0xec')](_0x15a9ed)){_0x382687[_0x0a9e('0xed')](_0x319752,_0x2c8d1d,_0x3db98f,_0x2b624e)['then'](function(_0x272291){logger[_0x0a9e('0x26')](_0x0a9e('0xee'),'Queue:\x20'+_0x319752['queue']+'\x20IdHopper:\x20'+_0x319752[_0x0a9e('0x85')],JSON[_0x0a9e('0x45')](_0x272291));ami[_0x0a9e('0x25')](_0x0a9e('0xef'),ut['buildObj'](_0x319752,_0x0a9e('0xf0'),_0x382687['campaignsPreview'][_0x319752[_0x0a9e('0x43')]]));_0x4f854b(ut[_0x0a9e('0x4b')](_0x0a9e('0xf1')));})['catch'](function(_0x33b4b3){ut[_0x0a9e('0x32')](_0x0a9e('0xf2'),_0x33b4b3);_0x5bd139(ut['message'](_0x0a9e('0xf3'),_0x3942fd,_0x5cb48d));});}else{_0x2c8d1d['outboundBlacklistCallsDay']+=0x1;ut[_0x0a9e('0xf4')](_0x319752);rpcDb['createHistory'](_0x319752,_0x0a9e('0xf5'));delete _0x382687['actions'][_0x1fdb10];_0x5bd139(ut[_0x0a9e('0x4b')](_0x0a9e('0xf6'),_0x3942fd,_0x5cb48d));}});};Preview[_0x0a9e('0xd')][_0x0a9e('0x70')]=function(_0x1e306c){return!_[_0x0a9e('0x41')](_0x1e306c)&&!_[_0x0a9e('0x41')](_0x1e306c['name'])&&!_[_0x0a9e('0x41')](_0x1e306c[_0x0a9e('0xf7')])&&_0x1e306c['active']&&!_[_0x0a9e('0x41')](this[_0x0a9e('0x12')][util['format'](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])])&&!_[_0x0a9e('0x41')](this['trunks'][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')])&&(this[_0x0a9e('0x12')][util[_0x0a9e('0x27')](_0x0a9e('0xf8'),_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfa')||this['trunks'][util[_0x0a9e('0x27')]('SIP/%s',_0x1e306c[_0x0a9e('0x29')])][_0x0a9e('0xf9')]===_0x0a9e('0xfb'));};Preview[_0x0a9e('0xd')][_0x0a9e('0x5c')]=function(_0x2d45db,_0x5691ac){return this[_0x0a9e('0xfc')](_0x2d45db,_0x5691ac)[_0x0a9e('0x56')](function(_0x2977a7){return _['pick'](_0x2977a7,[_0x0a9e('0x4b')]);})[_0x0a9e('0x5e')](function(_0x4435d2){if(_0x4435d2[_0x0a9e('0xfd')]){rpcDb[_0x0a9e('0xfe')](_0x2d45db);}if(_0x4435d2[_0x0a9e('0xf7')]){rpcDb[_0x0a9e('0x60')](_0x2d45db);}throw _['pick'](_0x4435d2,[_0x0a9e('0x4b')]);});};Preview[_0x0a9e('0xd')][_0x0a9e('0xfc')]=function(_0x2ce3be,_0x3de77e){var _0x241404=this;var _0x8120e,_0x5d6a48;return rpcDb['getContactPreview'](_0x2ce3be)[_0x0a9e('0x56')](function(_0x3f507c){if(!_[_0x0a9e('0x41')](_0x3f507c[0x0])){_0x5d6a48=_0x3f507c[0x0][_0x0a9e('0xff')]?![]:!![];_0x8120e=_0x3f507c[0x0][_0x0a9e('0xff')]?!![]:![];_0x8120e=_0x3de77e?!![]:_0x8120e;}var _0x131da8=_0x241404[_0x0a9e('0x100')](_0x3f507c);if(_0x131da8['isValid']){rpcDb[_0x0a9e('0x101')](_[_0x0a9e('0x46')](_0x3f507c[0x0],[_0x0a9e('0x48'),_0x0a9e('0xe9')]))[_0x0a9e('0x56')](function(_0x3c6082){_0x241404[_0x0a9e('0xe7')](_0x3c6082,_0x3f507c[0x0],_0x3de77e,_0x5d6a48,_0x8120e)['then'](function(_0x311288){return _0x311288;})[_0x0a9e('0x5e')](function(_0x231826){throw _0x231826;});})['catch'](function(_0x2b8ad4){ut[_0x0a9e('0x32')](_0x0a9e('0x102'),_0x2b8ad4);throw ut[_0x0a9e('0x4b')]('Call\x20unsuccessful',_0x5d6a48,_0x8120e);});}else{throw ut[_0x0a9e('0x4b')](_0x131da8[_0x0a9e('0x4b')],_0x5d6a48,_0x8120e);}})[_0x0a9e('0x5e')](function(_0x93d953){ut[_0x0a9e('0x32')](_0x0a9e('0x103'),_0x93d953);throw ut[_0x0a9e('0x4b')](_0x0a9e('0x104'),![],!![]);});};Preview['prototype'][_0x0a9e('0x100')]=function(_0x266aa1){if(_[_0x0a9e('0x41')](_0x266aa1)||_[_0x0a9e('0xec')](_0x266aa1)||!_['isNil'](_0x266aa1[0x0]['Agent'])&&_[_0x0a9e('0x41')](_0x266aa1[0x0][_0x0a9e('0x5a')][_0x0a9e('0x29')])){ut['logger'](_0x0a9e('0x105'),_0x266aa1);return{'isValid':![],'message':_0x0a9e('0x106')};}var _0x4d8a67=this[_0x0a9e('0x10')][_0x266aa1[0x0]['Queue'][_0x0a9e('0x29')]];_0x4d8a67['message']=utils['CAMPAIGN_STATUS']['ACTIVE'];if(_[_0x0a9e('0x41')](_0x4d8a67)){ut[_0x0a9e('0x32')](_0x0a9e('0x107'),_0x4d8a67);return{'isValid':![],'message':_0x0a9e('0x108')};}if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x109')])){ut['logger'](_0x0a9e('0x10a'),_0x0a9e('0x10b')+_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x10c'));if(!this[_0x0a9e('0x70')](_0x4d8a67[_0x0a9e('0x10d')])){ut[_0x0a9e('0x32')]('[Preview][validateContact][Trunk\x20not\x20working\x20correctly]',_0x4d8a67['name']+_0x0a9e('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut[_0x0a9e('0x6f')](_0x4d8a67[_0x0a9e('0x3c')])){ut[_0x0a9e('0x32')](_0x0a9e('0x10f'),_0x4d8a67[_0x0a9e('0x29')]+_0x0a9e('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4d8a67[_0x0a9e('0x29')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x0a9e('0xd')]['execCall']=function(_0x38dceb,_0x5dc978,_0x550cbf,_0x26223f){var _0x4a7a3c=this;return new Promise(function(_0x24470a,_0x142e53){var _0xe1ab0d=_0x38dceb['uniqueid'];var _0x4152cd=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?util['format']('SIP/%s/%s%s',_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978[_0x0a9e('0x111')][_0x0a9e('0x112')]()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')][_0x0a9e('0x114')](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf['phone']):util['format']('SIP/%s/%s%s',_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x29')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x29')],_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x111')])?'':_0x5dc978['dialPrefix']['trim']()||'',_0x5dc978[_0x0a9e('0x113')]>0x0?_0x550cbf[_0x0a9e('0xe9')]['substring'](_0x5dc978[_0x0a9e('0x113')]):_0x550cbf[_0x0a9e('0xe9')]);var _0x2e2280=_0x4a7a3c[_0x0a9e('0x70')](_0x5dc978[_0x0a9e('0x109')])?ut[_0x0a9e('0x115')](_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978[_0x0a9e('0x11a')]):ut[_0x0a9e('0x115')](_[_0x0a9e('0x41')](_0x5dc978[_0x0a9e('0x10d')])?_0x5dc978[_0x0a9e('0x109')][_0x0a9e('0x116')]:_0x5dc978[_0x0a9e('0x10d')][_0x0a9e('0x116')],_0x5dc978[_0x0a9e('0x117')],_0x5dc978[_0x0a9e('0x118')]>0x0?ut[_0x0a9e('0x119')](_0x5dc978[_0x0a9e('0x11a')],_0x5dc978['dialRandomLastDigitCallerIdNumber']):_0x5dc978['dialOriginateCallerIdNumber']);if(_0x2e2280){_0x38dceb[_0x0a9e('0x11b')]=ut[_0x0a9e('0x11c')](_0x2e2280);_0x38dceb[_0x0a9e('0x11d')]=ut[_0x0a9e('0x11e')](_0x2e2280);}var _0x33359a=ut[_0x0a9e('0x11f')](_0x5dc978,_0x550cbf,_0x4152cd,_0x2e2280,_0xe1ab0d,_0x38dceb);var _0xa8b5de=utils['setXMDContactVariables'](_0x550cbf[_0x0a9e('0xe8')]);Object['assign'](_0x33359a,_0xa8b5de);_[_0x0a9e('0x120')](_0x38dceb,ut[_0x0a9e('0x121')](_0x33359a));_0x38dceb[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));_0x5dc978[_0x0a9e('0x122')]=_0x33359a;var _0x465003=ut[_0x0a9e('0x123')](_0x38dceb,_0x5dc978,_0x33359a,_0x38dceb[_0x0a9e('0x83')],_0x26223f);return ami[_0x0a9e('0x124')](_0x465003)[_0x0a9e('0x56')](function(_0x8231e5){_0x5dc978[_0x0a9e('0x2d')]+=0x1;logger[_0x0a9e('0x26')](_0x0a9e('0x125'),_0xe1ab0d,_0x0a9e('0x9e'),_0x5dc978['name'],'originated:\x20',_0x5dc978[_0x0a9e('0x2d')]);_0x24470a(_0x8231e5);})[_0x0a9e('0x5e')](function(_0x52b365){ut['logAgent'](_0x38dceb,0xe,_0x0a9e('0x126'));rpcDb[_0x0a9e('0xdc')](_0x38dceb,_0x0a9e('0x127'));_0x142e53(_0x52b365);});});};Preview['prototype'][_0x0a9e('0x1d')]=function(_0x5b6447){if(this[_0x0a9e('0x13')][_0x5b6447['linkedid']]){this[_0x0a9e('0x13')][_0x5b6447['linkedid']][_0x0a9e('0x4a')]=_0x5b6447[_0x0a9e('0x4a')];}};Preview[_0x0a9e('0xd')]['syncOriginateResponse']=function(_0x316b51){var _0x497fda=this;var _0x505ffd=this[_0x0a9e('0x13')][_0x316b51[_0x0a9e('0x128')]];if(_0x505ffd){if(_0x505ffd[_0x0a9e('0xeb')]&&this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]){ut[_0x0a9e('0x129')](_0x505ffd,this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]][_0x0a9e('0x29')],this[_0x0a9e('0x14')][_0x505ffd[_0x0a9e('0xeb')]]['id']);}var _0x98bf26=_[_0x0a9e('0x12a')](_0x505ffd);_0x98bf26[_0x0a9e('0x12b')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));var _0x310026=_0x497fda[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]];if(ut['isFailure'](_0x316b51[_0x0a9e('0x12c')])){if(_0x505ffd[_0x0a9e('0xaa')]){rpcDb[_0x0a9e('0xfe')](_0x505ffd[_0x0a9e('0x85')]);}if(_0x505ffd['activeContact']){rpcDb['disableContact'](_0x505ffd['idContact']);}ami[_0x0a9e('0x25')]('custom:agentringnoanswer',ut[_0x0a9e('0x78')](_0x505ffd,_0x0a9e('0x12d'),this[_0x0a9e('0x10')][_0x505ffd[_0x0a9e('0x43')]]));this[_0x0a9e('0xd5')](_0x98bf26,_0x310026,_0x316b51);}else{_0x505ffd[_0x0a9e('0x61')]=moment()[_0x0a9e('0x27')](_0x0a9e('0x62'));ut[_0x0a9e('0xd9')](_0x98bf26,0x4,_0x0a9e('0x12e'));rpcDb['createAgentHistory'](_0x98bf26,_0x0a9e('0x12f'));}}};Preview['prototype'][_0x0a9e('0x1a')]=function(_0x586d2f){var _0xf4de86=this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]];var _0x556bb7;if(_0xf4de86){_0x556bb7=this[_0x0a9e('0x10')][_0xf4de86[_0x0a9e('0x43')]];logger['info']('[syncHangup][talking]',_0x586d2f[_0x0a9e('0x84')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],'pTalking:\x20',_0x556bb7['pTalking']);}if(this['actions'][_0x586d2f[_0x0a9e('0x84')]]&&_0x586d2f[_0x0a9e('0x84')]!==_0x586d2f[_0x0a9e('0x91')]){if(_0x586d2f[_0x0a9e('0x130')]==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')](_0x0a9e('0x131'),_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}}else if(_0xf4de86&&_[_0x0a9e('0x41')](_0xf4de86['statedesc'])&&_0x556bb7[_0x0a9e('0x132')]&&_0x586d2f[_0x0a9e('0x84')]===_0x586d2f[_0x0a9e('0x91')]&&_[_0x0a9e('0x41')](_0x586d2f[_0x0a9e('0xd8')])&&_0x586d2f[_0x0a9e('0x130')]==='16'&&_0x586d2f[_0x0a9e('0x133')]==='6'&&_[_0x0a9e('0xd7')](_0xf4de86[_0x0a9e('0x134')])){if(_0xf4de86['unlockAgent']){rpcDb['unlockContact'](_0xf4de86[_0x0a9e('0x85')]);}if(_0xf4de86[_0x0a9e('0x83')]){rpcDb['disableContact'](_0xf4de86[_0x0a9e('0x85')]);}_0x586d2f[_0x0a9e('0xd8')]='22';this['callProgressDetectingAgent'](_0xf4de86,_0x556bb7,_0x586d2f);}else if(_0xf4de86&&_0xf4de86[_0x0a9e('0x134')]){if(_0x586d2f['cause']==='16'&&this[_0x0a9e('0x13')][_0x586d2f[_0x0a9e('0x84')]]['dialAnswer']){logger[_0x0a9e('0x26')](_0x0a9e('0x135'),_0x586d2f['linkedid'],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7['name'],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')]);}else if(this[_0x0a9e('0x13')][_0x586d2f['linkedid']][_0x0a9e('0x4d')]){logger[_0x0a9e('0x26')]('[syncHangup][talking][cause]',_0x586d2f[_0x0a9e('0x84')],_0x586d2f[_0x0a9e('0x130')],_0x0a9e('0x9e'),_0x556bb7[_0x0a9e('0x29')],_0x0a9e('0x8a'),_0x556bb7[_0x0a9e('0x2e')]);this[_0x0a9e('0x72')](_0x586d2f,_0x586d2f['linkedid'],_0x586d2f['cause']);}}};Preview['prototype']['syncDialEnd']=function(_0x5e9817){if(this[_0x0a9e('0x13')][_0x5e9817[_0x0a9e('0xd4')]]&&_0x5e9817['destlinkedid']!==_0x5e9817['destuniqueid']){this[_0x0a9e('0x72')](_0x5e9817,_0x5e9817['destlinkedid'],_0x5e9817[_0x0a9e('0xcd')]);}};Preview[_0x0a9e('0xd')][_0x0a9e('0x136')]=function(_0x175c97){if(this[_0x0a9e('0x13')][_0x175c97[_0x0a9e('0x84')]]&&_0x175c97['linkedid']!==_0x175c97[_0x0a9e('0x91')]&&!this[_0x0a9e('0x13')][_0x175c97['linkedid']][_0x0a9e('0x4d')]){if(_0x175c97[_0x0a9e('0x130')]==='1'){this[_0x0a9e('0x72')](_0x175c97,_0x175c97[_0x0a9e('0x84')],_0x175c97[_0x0a9e('0x130')]);}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x137')]=function(_0x4a36df,_0x331216,_0x508395){if(this[_0x0a9e('0x13')][_0x4a36df]){if(_[_0x0a9e('0x41')](this['actions'][_0x4a36df][_0x0a9e('0x122')])){this[_0x0a9e('0x13')][_0x4a36df]['variables']={};}this[_0x0a9e('0x13')][_0x4a36df]['variables'][_0x331216]=_0x508395;}};Preview[_0x0a9e('0xd')][_0x0a9e('0x1f')]=function(_0x5d0620){try{if(!_[_0x0a9e('0x41')](_0x5d0620)){if(ut['filterKey'](_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0])){this[_0x0a9e('0x137')](_0x5d0620[_0x0a9e('0x91')],_[_0x0a9e('0x138')](_0x5d0620[_0x0a9e('0x139')])[0x0],_0x5d0620[_0x0a9e('0x13a')]);}}}catch(_0x53b5c2){logger[_0x0a9e('0x13b')](_0x0a9e('0x13c'),util[_0x0a9e('0x13d')](_0x53b5c2,{'showHidden':![],'depth':null}));}};Preview[_0x0a9e('0xd')][_0x0a9e('0x21')]=function(_0x5932ad){if(_0x5932ad){if(this[_0x0a9e('0x13')][_0x5932ad['transfertargetlinkedid']]){this['actions'][_0x5932ad[_0x0a9e('0x13e')]]['transfer']=!![];}}};Preview[_0x0a9e('0xd')][_0x0a9e('0x23')]=function(_0x58d5fd){if(_0x58d5fd){if(this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]]){this[_0x0a9e('0x13')][_0x58d5fd[_0x0a9e('0x13f')]][_0x0a9e('0x134')]=!![];}}};module[_0x0a9e('0x140')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 86eca3b..453a9a2 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 _0x7779=['util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','inspect','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','rescheduleContact','UserId','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallercomplete','endtime','connectedlinename','context','exten','xcally-motion-preview','holdtime','assigned','membername','queuecallerexitreason','[voiceQueueReport]\x20','resolve','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20'];(function(_0x4f2626,_0x1078da){var _0xa80c7=function(_0x1737fa){while(--_0x1737fa){_0x4f2626['push'](_0x4f2626['shift']());}};_0xa80c7(++_0x1078da);}(_0x7779,0x126));var _0x9777=function(_0x378830,_0xb532d7){_0x378830=_0x378830-0x0;var _0x4e4348=_0x7779[_0x378830];return _0x4e4348;};'use strict';var util=require(_0x9777('0x0'));var BPromise=require(_0x9777('0x1'));var logger=require(_0x9777('0x2'))(_0x9777('0x3'));var cmHopper=require(_0x9777('0x4'));var cmHopperHistory=require(_0x9777('0x5'));var cmHopperBlack=require(_0x9777('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x3f3b3e){return function(_0x4986c5){logger['error'](_0x3f3b3e,util[_0x9777('0x7')](_0x4986c5,{'showHidden':![],'depth':null}));};}function create(_0x239a06){return cmHopperHistory[_0x9777('0x8')](_0x239a06)[_0x9777('0x9')](loggerCatch(_0x9777('0xa')));}function createAgent(_0x3ec08e){return BPromise['resolve']()[_0x9777('0xb')](agentReportPreview[_0x9777('0x8')](_0x3ec08e))[_0x9777('0x9')](loggerCatch('[createHistory]\x20'));}function moveContact(_0x2420f3){return cmHopper[_0x9777('0xc')](_0x2420f3,!![])['catch'](loggerCatch('[moveContactManagedDialer]\x20'));}exports['checkIsBlackList']=function(_0x541c67){return cmHopperBlack[_0x9777('0xd')](_0x541c67)['catch'](loggerCatch(_0x9777('0xe')));};exports[_0x9777('0xf')]=function(_0x216816){return BPromise['resolve']()[_0x9777('0xb')](cmHopper[_0x9777('0xf')](_0x216816))['catch'](loggerCatch(_0x9777('0x10')));};exports[_0x9777('0x8')]=function(_0x28b0cf,_0x1b6a71){create(_0x28b0cf)[_0x9777('0x9')](loggerCatch(_0x1b6a71));moveContact(_0x28b0cf)[_0x9777('0x9')](loggerCatch(_0x1b6a71));};exports[_0x9777('0x11')]=function(_0x2238d2,_0x2b96e6){createAgent(_0x2238d2)[_0x9777('0x9')](loggerCatch(_0x2b96e6));};exports[_0x9777('0x12')]=function(_0x384e74,_0x2c9289){create(_0x384e74)[_0x9777('0x9')](loggerCatch(_0x2c9289));};exports['createCustomerFinal']=function(_0x426a2f,_0x3c8eaf){moveContact(_0x426a2f)[_0x9777('0x9')](loggerCatch(_0x3c8eaf));};exports[_0x9777('0x13')]=function(_0x127a93,_0x1cae68,_0x172420){if(_0x1cae68){_0x127a93[_0x9777('0x14')]=null;}if(_0x172420){_0x127a93['active']=![];}return cmHopper[_0x9777('0x13')](_0x127a93)[_0x9777('0x9')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x21ccbe){return cmHopper[_0x9777('0x15')](_0x21ccbe)[_0x9777('0x9')](loggerCatch(_0x9777('0x16')));};exports['unlockContact']=function(_0x321e10){return cmHopper[_0x9777('0x17')]({'UserId':null},_0x321e10,0x1)[_0x9777('0x9')](loggerCatch(_0x9777('0x18')));};exports[_0x9777('0x19')]=function(_0x531a81){return cmHopper[_0x9777('0x17')]({'active':![]},_0x531a81,0x1)[_0x9777('0x9')](loggerCatch('[activeContact]\x20'));};exports[_0x9777('0x1a')]=function(_0x492ac2){var _0x43c6a6={};_0x43c6a6[_0x9777('0x1b')]=_0x492ac2[_0x9777('0x1b')];_0x43c6a6[_0x9777('0x1c')]=_0x492ac2[_0x9777('0x1c')];_0x43c6a6[_0x9777('0x1d')]=_0x492ac2[_0x9777('0x1d')];_0x43c6a6[_0x9777('0x1e')]=_0x492ac2[_0x9777('0x1e')];_0x43c6a6[_0x9777('0x1f')]=_0x492ac2['queue'];_0x43c6a6[_0x9777('0x20')]=_0x492ac2[_0x9777('0x21')];_0x43c6a6['queuecallerleaveAt']=_0x492ac2[_0x9777('0x21')];_0x43c6a6[_0x9777('0x22')]=0x1;_0x43c6a6['queuecallercompleteAt']=_0x492ac2[_0x9777('0x23')];_0x43c6a6[_0x9777('0x24')]=_0x492ac2['membername'];_0x43c6a6[_0x9777('0x25')]='from-sip';_0x43c6a6[_0x9777('0x26')]=_0x9777('0x27');_0x43c6a6[_0x9777('0x28')]=0x0;_0x43c6a6[_0x9777('0x29')]=0x1;_0x43c6a6['lastAssignedTo']=_0x492ac2[_0x9777('0x2a')];_0x43c6a6[_0x9777('0x2b')]='COMPLETED';return BPromise['resolve']()[_0x9777('0xb')](voiceQueueReport['create'](_0x43c6a6))['catch'](loggerCatch(_0x9777('0x2c')));};exports['getContactRecallMe']=function(_0x48e30b,_0x51c4de){return BPromise[_0x9777('0x2d')]()[_0x9777('0xb')](cmHopper['getContactRecallMe'](_0x48e30b,_0x51c4de))['catch'](loggerCatch(_0x9777('0x2e')));};exports[_0x9777('0x2f')]=function(_0x5bb765){return cmHopper[_0x9777('0x13')](_0x5bb765,!![],!![])['catch'](loggerCatch(_0x9777('0x30')));}; \ No newline at end of file +var _0x4b4d=['../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','[createHistory]\x20','resolve','then','catch','moveContactManagedDialer','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','from-sip','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird'];(function(_0x3ba748,_0x4b8fb9){var _0x5b04e2=function(_0x16bb9e){while(--_0x16bb9e){_0x3ba748['push'](_0x3ba748['shift']());}};_0x5b04e2(++_0x4b8fb9);}(_0x4b4d,0x94));var _0xd4b4=function(_0x7f32ad,_0xb2990f){_0x7f32ad=_0x7f32ad-0x0;var _0x51e555=_0x4b4d[_0x7f32ad];return _0x51e555;};'use strict';var util=require(_0xd4b4('0x0'));var BPromise=require(_0xd4b4('0x1'));var logger=require('../../../config/logger')('preview');var cmHopper=require(_0xd4b4('0x2'));var cmHopperHistory=require(_0xd4b4('0x3'));var cmHopperBlack=require(_0xd4b4('0x4'));var agentReportPreview=require(_0xd4b4('0x5'));var voiceQueueReport=require(_0xd4b4('0x6'));function loggerCatch(_0x3d2ea7){return function(_0x447369){logger[_0xd4b4('0x7')](_0x3d2ea7,util[_0xd4b4('0x8')](_0x447369,{'showHidden':![],'depth':null}));};}function create(_0x1f375e){return cmHopperHistory[_0xd4b4('0x9')](_0x1f375e)['catch'](loggerCatch(_0xd4b4('0xa')));}function createAgent(_0x5892fd){return BPromise[_0xd4b4('0xb')]()[_0xd4b4('0xc')](agentReportPreview[_0xd4b4('0x9')](_0x5892fd))[_0xd4b4('0xd')](loggerCatch('[createHistory]\x20'));}function moveContact(_0xa21f28){return cmHopper[_0xd4b4('0xe')](_0xa21f28,!![])[_0xd4b4('0xd')](loggerCatch('[moveContactManagedDialer]\x20'));}exports[_0xd4b4('0xf')]=function(_0x3fef84){return cmHopperBlack[_0xd4b4('0xf')](_0x3fef84)[_0xd4b4('0xd')](loggerCatch(_0xd4b4('0x10')));};exports[_0xd4b4('0x11')]=function(_0x374316){return BPromise[_0xd4b4('0xb')]()[_0xd4b4('0xc')](cmHopper[_0xd4b4('0x11')](_0x374316))[_0xd4b4('0xd')](loggerCatch(_0xd4b4('0x12')));};exports[_0xd4b4('0x9')]=function(_0x4d0333,_0x17117){create(_0x4d0333)[_0xd4b4('0xd')](loggerCatch(_0x17117));moveContact(_0x4d0333)[_0xd4b4('0xd')](loggerCatch(_0x17117));};exports[_0xd4b4('0x13')]=function(_0x2c5f5e,_0x377c7a){createAgent(_0x2c5f5e)['catch'](loggerCatch(_0x377c7a));};exports['createCustomerHistory']=function(_0x550d98,_0x7caca7){create(_0x550d98)['catch'](loggerCatch(_0x7caca7));};exports[_0xd4b4('0x14')]=function(_0x61941b,_0x496e73){moveContact(_0x61941b)[_0xd4b4('0xd')](loggerCatch(_0x496e73));};exports[_0xd4b4('0x15')]=function(_0x9eb0f3,_0x16a0af,_0x2cfac7){if(_0x16a0af){_0x9eb0f3[_0xd4b4('0x16')]=null;}if(_0x2cfac7){_0x9eb0f3[_0xd4b4('0x17')]=![];}return cmHopper[_0xd4b4('0x15')](_0x9eb0f3)[_0xd4b4('0xd')](loggerCatch(_0xd4b4('0x18')));};exports[_0xd4b4('0x19')]=function(_0x3a4ead){return cmHopper['countReScheduled'](_0x3a4ead)[_0xd4b4('0xd')](loggerCatch(_0xd4b4('0x1a')));};exports[_0xd4b4('0x1b')]=function(_0x39f8ac){return cmHopper[_0xd4b4('0x1b')]({'UserId':null},_0x39f8ac,0x1)[_0xd4b4('0xd')](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x87745f){return cmHopper['unlockContact']({'active':![]},_0x87745f,0x1)[_0xd4b4('0xd')](loggerCatch(_0xd4b4('0x1c')));};exports[_0xd4b4('0x1d')]=function(_0xbba2d){var _0x1e64ff={};_0x1e64ff[_0xd4b4('0x1e')]=_0xbba2d[_0xd4b4('0x1e')];_0x1e64ff[_0xd4b4('0x1f')]=_0xbba2d['uniqueid'];_0x1e64ff[_0xd4b4('0x20')]=_0xbba2d[_0xd4b4('0x20')];_0x1e64ff[_0xd4b4('0x21')]=_0xbba2d[_0xd4b4('0x21')];_0x1e64ff[_0xd4b4('0x22')]=_0xbba2d[_0xd4b4('0x22')];_0x1e64ff['queuecallerjoinAt']=_0xbba2d[_0xd4b4('0x23')];_0x1e64ff['queuecallerleaveAt']=_0xbba2d[_0xd4b4('0x23')];_0x1e64ff[_0xd4b4('0x24')]=0x1;_0x1e64ff[_0xd4b4('0x25')]=_0xbba2d[_0xd4b4('0x26')];_0x1e64ff[_0xd4b4('0x27')]=_0xbba2d[_0xd4b4('0x28')];_0x1e64ff['context']=_0xd4b4('0x29');_0x1e64ff['exten']=_0xd4b4('0x2a');_0x1e64ff[_0xd4b4('0x2b')]=0x0;_0x1e64ff[_0xd4b4('0x2c')]=0x1;_0x1e64ff[_0xd4b4('0x2d')]=_0xbba2d[_0xd4b4('0x28')];_0x1e64ff[_0xd4b4('0x2e')]='COMPLETED';return BPromise[_0xd4b4('0xb')]()[_0xd4b4('0xc')](voiceQueueReport[_0xd4b4('0x2f')](_0x1e64ff))[_0xd4b4('0xd')](loggerCatch('[voiceQueueReport]\x20'));};exports['getContactRecallMe']=function(_0x2f3d77,_0x3dffd6){return BPromise[_0xd4b4('0xb')]()[_0xd4b4('0xc')](cmHopper['getContactRecallMe'](_0x2f3d77,_0x3dffd6))[_0xd4b4('0xd')](loggerCatch('[GetContactRecallMe]\x20'));};exports[_0xd4b4('0x30')]=function(_0x424cbd){return cmHopper['rescheduleContact'](_0x424cbd,!![],!![])['catch'](loggerCatch(_0xd4b4('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 afa7dae..5509487 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 _0xa3b2=['reachable','push','getDiff','milliseconds','diff','seconds','CampaignId','filterKey','type','dialAnswer','membername','countnoanswerretry','callback','callbackuniqueid','callbackat','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialchannel','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','rtpaudioqos','rtpaudioqosrtt','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','extractCalleridNumber','match','noanswer','variables','keys','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','127.0.0.1','../../dialer/utils','error','inspect','logger','info','logger2','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','format','calleridname','calleridnum','dialer','dialOriginateTimeout','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','responsetime','endtime','logAgent','ringtime','getSeconds','starttime','UserId','logCustomer','talktime','isFailure','variablesAction','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countagentrejectretry','countnosuchnumberretry','active','scheduledat','add','minutes','ContactId','ListId','VoiceQueueId','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','voice','mandatoryDisposition','buildObj','agentReadyId','hasOwnProperty','not_inuse','status'];(function(_0x175b4b,_0x2c2658){var _0x23f354=function(_0x521db3){while(--_0x521db3){_0x175b4b['push'](_0x175b4b['shift']());}};_0x23f354(++_0x2c2658);}(_0xa3b2,0x1e0));var _0x2a3b=function(_0x41fb98,_0x470189){_0x41fb98=_0x41fb98-0x0;var _0x4b0044=_0xa3b2[_0x41fb98];return _0x4b0044;};'use strict';var util=require(_0x2a3b('0x0'));var _=require(_0x2a3b('0x1'));var moment=require(_0x2a3b('0x2'));var logger=require(_0x2a3b('0x3'))('preview');var ipAgi=process[_0x2a3b('0x4')]['XCALLY_IP_AGI']||_0x2a3b('0x5');var utils=require(_0x2a3b('0x6'));exports['loggerCatch']=function(_0x3eafb4){return function(_0x3ca582){logger[_0x2a3b('0x7')](_0x3eafb4,util[_0x2a3b('0x8')](_0x3ca582,{'showHidden':![],'depth':null}));};};exports[_0x2a3b('0x9')]=function(_0x366e34,_0x131c37){logger[_0x2a3b('0xa')](_0x366e34,util[_0x2a3b('0x8')](_0x131c37,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x1134ab,_0x153695){logger[_0x2a3b('0x7')](_0x1134ab,util[_0x2a3b('0x8')](_0x153695,{'showHidden':![],'depth':null}));};exports[_0x2a3b('0xb')]=function(_0x409f29){return function(_0xc03b25){logger[_0x2a3b('0xa')](_0x409f29,util[_0x2a3b('0x8')](_0xc03b25,{'showHidden':![],'depth':null}));};};exports[_0x2a3b('0xc')]=function(_0xb74b2b,_0x10fd2e,_0x319f46){return{'message':_0xb74b2b,'unlock':_0x10fd2e,'active':_0x319f46};};exports[_0x2a3b('0xd')]=function(_0x2b596f,_0x28927b,_0x43b185){if(!_[_0x2a3b('0xe')](_0x43b185)&&'string'===typeof _0x43b185&&!_['isEmpty'](_0x43b185)){if(!_[_0x2a3b('0xe')](_0x28927b)&&_0x2a3b('0xf')===typeof _0x28927b&&!_[_0x2a3b('0x10')](_0x28927b)){return util['format'](_0x2a3b('0x11'),_0x28927b,_0x43b185);}return util['format'](_0x2a3b('0x11'),_0x43b185,_0x43b185);}if(!_[_0x2a3b('0xe')](_0x2b596f)&&_0x2a3b('0xf')===typeof _0x2b596f&&!_[_0x2a3b('0x10')](_0x2b596f)){return _0x2b596f;}return _0x2a3b('0x12');};exports[_0x2a3b('0x13')]=function(_0x12c776){if(_[_0x2a3b('0x14')](_0x12c776)){return![];}return _0x12c776;};exports[_0x2a3b('0x15')]=function(_0x43e5c2,_0x226b75,_0x4f931a,_0x16c0f8,_0x26ee26,_0x28158f){var _0x4fba2e={'XMD-QUEUE':_0x226b75[_0x2a3b('0x16')]?_0x226b75['Queue'][_0x2a3b('0x17')]:'','XMD-CALLERID':_0x16c0f8,'XMD-CALLERID-PREVIEW':_0x28158f?util[_0x2a3b('0x18')]('\x22%s\x22\x20<%s>',_0x28158f[_0x2a3b('0x19')],_0x28158f[_0x2a3b('0x1a')]):_0x16c0f8,'XMD-DIALID':_0x26ee26,'XMD-CONTACTID':_0x226b75['ContactId'],'XMD-CDRTYPE':_0x2a3b('0x1b'),'CALLERID(all)':_0x16c0f8,'XMD-VOICEQUEUEID':_0x226b75['VoiceQueueId'],'XMD-DIALCHANNEL':_0x4f931a,'XMD-DIALTIMEOUT':_0x43e5c2[_0x2a3b('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x2a3b('0x18')]('\x22rtTxX%s%s\x22',_0x43e5c2[_0x2a3b('0x1d')]?'g':'',_[_0x2a3b('0x10')](_0x43e5c2['monitor_format'])?'':_0x2a3b('0x1e')),'XMD-DIALURL':_0x43e5c2[_0x2a3b('0x1f')]||'','XMD-AGI':_0x43e5c2[_0x2a3b('0x20')]?util[_0x2a3b('0x18')](_0x2a3b('0x21'),ipAgi,_0x43e5c2[_0x2a3b('0x20')]):'NONE','XMD-AGIAFTER':_0x43e5c2[_0x2a3b('0x1d')]?util[_0x2a3b('0x18')](_0x2a3b('0x21'),ipAgi,_0x43e5c2[_0x2a3b('0x1d')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x28158f?_0x28158f[_0x2a3b('0x22')]:'','XMD-ORIGINATECALLERIDNAME':_0x28158f?_0x28158f[_0x2a3b('0x23')]:'','XMD-DESTINATION':_0x2a3b('0x24'),'SIPADDHEADER':_0x2a3b('0x25')};if(!_[_0x2a3b('0x10')](_0x43e5c2['monitor_format'])){_0x4fba2e[util[_0x2a3b('0x18')]('%s',_0x2a3b('0x26'))]=_0x43e5c2['monitor_format'];_0x4fba2e[util[_0x2a3b('0x18')]('%s',_0x2a3b('0x27'))]=_0x26ee26;}return _0x4fba2e;};exports[_0x2a3b('0x28')]=function(_0x1457f3){var _0x286c22={};for(var _0x27128f in _0x1457f3){if(_0x1457f3['hasOwnProperty'](_0x27128f)){_0x286c22[util[_0x2a3b('0x18')]('%s',_[_0x2a3b('0x29')](_0x27128f))]=_0x1457f3[_0x27128f];}}return{'variables':_0x286c22};};exports[_0x2a3b('0x2a')]=function(_0x1d3cba,_0x3475a0){if(!_[_0x2a3b('0x14')](_0x1d3cba)){if(_0x1d3cba['hasOwnProperty'](_0x2a3b('0x2b'))){if(_0x1d3cba[_0x2a3b('0x2b')]>0x0){_0x1d3cba[_0x2a3b('0x2b')]-=0x1;}else{logger[_0x2a3b('0x7')](_0x2a3b('0x2c'),_0x3475a0);}}}else{logger[_0x2a3b('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x3475a0);}};exports[_0x2a3b('0x2d')]=function(_0x45e4e6){var _0x20891b=moment()[_0x2a3b('0x18')](_0x2a3b('0x2e'));_0x45e4e6[_0x2a3b('0x2f')]=0xd;_0x45e4e6[_0x2a3b('0x30')]=_0x2a3b('0x31');_0x45e4e6['starttime']=_0x20891b;_0x45e4e6[_0x2a3b('0x32')]=_0x20891b;_0x45e4e6[_0x2a3b('0x33')]=_0x20891b;};exports[_0x2a3b('0x34')]=function(_0x3c4cc3,_0x14a27e,_0x4be7c3){var _0x4513bb=moment()['format'](_0x2a3b('0x2e'));_0x3c4cc3[_0x2a3b('0x2f')]=_0x14a27e;_0x3c4cc3[_0x2a3b('0x30')]=_0x4be7c3;_0x3c4cc3[_0x2a3b('0x32')]=_0x4513bb;_0x3c4cc3[_0x2a3b('0x35')]=utils[_0x2a3b('0x36')](_0x3c4cc3[_0x2a3b('0x32')],_0x3c4cc3[_0x2a3b('0x37')]);};exports['logLookAgent']=function(_0x4f98bc,_0x49e68a,_0x128958){_0x4f98bc['membername']=_0x49e68a;_0x4f98bc[_0x2a3b('0x38')]=_0x128958;};exports[_0x2a3b('0x39')]=function(_0x1c9d55,_0xc8bb59,_0x528843){var _0x335ba1=moment()[_0x2a3b('0x18')](_0x2a3b('0x2e'));_0x1c9d55[_0x2a3b('0x2f')]=_0xc8bb59;_0x1c9d55[_0x2a3b('0x30')]=_0x528843;_0x1c9d55[_0x2a3b('0x32')]=_0x1c9d55[_0x2a3b('0x32')]?_0x1c9d55[_0x2a3b('0x32')]:_0x335ba1;_0x1c9d55[_0x2a3b('0x33')]=_0x1c9d55[_0x2a3b('0x33')]?_0x1c9d55[_0x2a3b('0x33')]:_0x335ba1;_0x1c9d55[_0x2a3b('0x35')]=utils[_0x2a3b('0x36')](_0x1c9d55[_0x2a3b('0x32')]||0x0,_0x1c9d55[_0x2a3b('0x37')]||0x0);_0x1c9d55[_0x2a3b('0x3a')]=_0x1c9d55['answertime']?utils['getSeconds'](_0x1c9d55['endtime'],_0x1c9d55['answertime']):0x0;};exports[_0x2a3b('0x3b')]=function(_0x26ea4d){return _0x26ea4d==='Failure';};exports[_0x2a3b('0x3c')]=function(_0x5bcdf3,_0x389147,_0x5a113d,_0x8463f6,_0x24e51a){var _0x13151e=_0x8463f6?_0x2a3b('0x3d'):_0x5bcdf3[_0x2a3b('0x19')];_0x13151e=_0x24e51a?_0x2a3b('0x3e'):_0x13151e;return{'actionid':_0x5bcdf3[_0x2a3b('0x3f')],'action':_0x2a3b('0x40'),'channel':_0x5bcdf3[_0x2a3b('0x41')],'callerid':util[_0x2a3b('0x18')](_0x2a3b('0x11'),_0x13151e,_0x5bcdf3[_0x2a3b('0x1a')]),'Exten':_0x2a3b('0x24'),'Context':_0x2a3b('0x42'),'Priority':'1','variable':_0x5a113d,'timeout':(_0x389147['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5bcdf3['uniqueid']};};exports[_0x2a3b('0x43')]=function(_0x21e562){return _0x21e562[_0x2a3b('0x44')]+_0x21e562['countcongestionretry']+_0x21e562['countnoanswerretry']+_0x21e562[_0x2a3b('0x45')]+_0x21e562[_0x2a3b('0x46')];};exports['cloneAction']=function(_0x26eaea){var _0x1dfb4b=_['clone'](_0x26eaea);_0x1dfb4b[_0x2a3b('0x2f')]=0xf;_0x1dfb4b['statedesc']='Global';return _0x1dfb4b;};exports['scheduledAt']=function(_0x37f004,_0x5d190f,_0x27da8b){var _0x2df385={};_0x2df385[_0x5d190f]=_0x37f004[_0x5d190f];_0x2df385[_0x2a3b('0x47')]=![];_0x2df385[_0x2a3b('0x48')]=moment()[_0x2a3b('0x49')](_0x27da8b,_0x2a3b('0x4a'))['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2df385[_0x2a3b('0x4b')]=_0x37f004['ContactId'];_0x2df385[_0x2a3b('0x4c')]=_0x37f004[_0x2a3b('0x4c')];_0x2df385[_0x2a3b('0x4d')]=_0x37f004[_0x2a3b('0x4d')]||undefined;return _0x2df385;};exports['decrementTalkink']=function(_0x1b6e23,_0x1c48a8){if(!_['isNil'](_0x1b6e23)){if(_0x1b6e23[_0x2a3b('0x4e')]>0x0){_0x1b6e23[_0x2a3b('0x4e')]-=0x1;}else{logger['error'](_0x1c48a8,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x2a3b('0x7')](_0x1c48a8,_0x2a3b('0x4f'));}};exports[_0x2a3b('0x50')]=function(_0x45cc6d){if(_0x45cc6d<=0x0){return!![];}return![];};function buildObj(_0x1ce548,_0x435183,_0x3a23e7){_0x1ce548[_0x2a3b('0x51')]=_0x435183;_0x1ce548[_0x2a3b('0x17')]=_0x1ce548[_0x2a3b('0x52')];_0x1ce548[_0x2a3b('0x53')]=_0x1ce548[_0x2a3b('0x41')];_0x1ce548[_0x2a3b('0x54')]=_0x2a3b('0x55');if(_0x3a23e7){_0x1ce548[_0x2a3b('0x56')]=_0x3a23e7['mandatoryDisposition'];}return _0x1ce548;}exports[_0x2a3b('0x57')]=buildObj;exports[_0x2a3b('0x58')]=function(_0x537625){var _0x97941c=[];for(var _0x54b205 in _0x537625){if(_0x537625[_0x2a3b('0x59')](_0x54b205)){if(!_[_0x2a3b('0x14')](_0x537625[_0x54b205])&&_0x537625[_0x54b205][_0x2a3b('0x2f')]===_0x2a3b('0x5a')&&_0x537625[_0x54b205][_0x2a3b('0x5b')]===_0x2a3b('0x5c')){_0x97941c[_0x2a3b('0x5d')](_0x537625[_0x54b205]['id']);}}}return _0x97941c;};exports[_0x2a3b('0x5e')]=function(_0x2dbbdb){var _0x4b0628=moment()['milliseconds'](0x0);var _0x45b4e1=moment(_0x2dbbdb)[_0x2a3b('0x5f')](0x0);return _0x4b0628[_0x2a3b('0x60')](_0x45b4e1,_0x2a3b('0x61'));};exports['createBody']=function(_0x3ef5a0){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3ef5a0[_0x2a3b('0x4b')],'ListId':_0x3ef5a0[_0x2a3b('0x4c')],'VoiceQueueId':_0x3ef5a0['VoiceQueueId']||undefined,'CampaignId':_0x3ef5a0[_0x2a3b('0x62')]||undefined};};exports[_0x2a3b('0x63')]=function(_0x12d169){if(_0x12d169===_0x2a3b('0x3f')||_0x12d169==='idContact'||_0x12d169===_0x2a3b('0x52')||_0x12d169===_0x2a3b('0x64')||_0x12d169==='campaigntype'||_0x12d169===_0x2a3b('0x65')||_0x12d169===_0x2a3b('0x66')||_0x12d169===_0x2a3b('0x41')||_0x12d169===_0x2a3b('0x19')||_0x12d169==='active'||_0x12d169===_0x2a3b('0x1a')||_0x12d169===_0x2a3b('0x48')||_0x12d169===_0x2a3b('0x44')||_0x12d169==='countcongestionretry'||_0x12d169===_0x2a3b('0x67')||_0x12d169==='countglobal'||_0x12d169===_0x2a3b('0x68')||_0x12d169===_0x2a3b('0x69')||_0x12d169===_0x2a3b('0x6a')||_0x12d169===_0x2a3b('0x6b')||_0x12d169==='ContactId'||_0x12d169==='ListId'||_0x12d169===_0x2a3b('0x38')||_0x12d169===_0x2a3b('0x4d')||_0x12d169===_0x2a3b('0x6c')||_0x12d169===_0x2a3b('0x6d')||_0x12d169===_0x2a3b('0x6e')||_0x12d169===_0x2a3b('0x6f')||_0x12d169===_0x2a3b('0x70')||_0x12d169===_0x2a3b('0x71')||_0x12d169===_0x2a3b('0x72')||_0x12d169==='xmd-dialoptions'||_0x12d169==='xmd-dialid'||_0x12d169===_0x2a3b('0x73')||_0x12d169==='xmd-contactid'||_0x12d169===_0x2a3b('0x74')||_0x12d169===_0x2a3b('0x75')||_0x12d169===_0x2a3b('0x76')||_0x12d169===_0x2a3b('0x77')||_0x12d169==='rtpaudioqos'||_0x12d169===_0x2a3b('0x78')||_0x12d169===_0x2a3b('0x79')||_0x12d169===_0x2a3b('0x7a')||_0x12d169===_0x2a3b('0x7b')||_0x12d169===_0x2a3b('0x7c')||_0x12d169==='rtpaudioqosrtt'||_0x12d169===_0x2a3b('0x7d')||_0x12d169===_0x2a3b('0x7e')||_0x12d169===_0x2a3b('0x78')||_0x12d169===_0x2a3b('0x79')||_0x12d169===_0x2a3b('0x7a')||_0x12d169===_0x2a3b('0x7b')||_0x12d169===_0x2a3b('0x7c')||_0x12d169===_0x2a3b('0x7f')||_0x12d169===_0x2a3b('0x7d')||_0x12d169===_0x2a3b('0x80')||_0x12d169===_0x2a3b('0x81')||_0x12d169===_0x2a3b('0x2f')||_0x12d169===_0x2a3b('0x30')){return![];}return!![];};exports[_0x2a3b('0x82')]=function(_0x404459,_0x2aa6b7){var _0xcb2c51,_0x113dd5,_0x4f85dc;if(_0x2aa6b7<=0x0){_0x2aa6b7=0x1;}_0xcb2c51=new RegExp(_0x2a3b('0x83')+_0x2aa6b7+'}$');_0x113dd5=Math['pow'](0xa,_0x2aa6b7-0x1);_0x4f85dc=Math[_0x2a3b('0x84')](0xa,_0x2aa6b7)-0x1;return util[_0x2a3b('0x18')]('%s',_[_0x2a3b('0x85')](_0x404459,_0xcb2c51,_[_0x2a3b('0x86')](_0x113dd5,_0x4f85dc)));};exports[_0x2a3b('0x87')]=function(_0xe8c19d){var _0x1a572e=_0xe8c19d['match'](/"(.*?)"/);return _0x1a572e?_0x1a572e[0x1]:_0xe8c19d;};exports[_0x2a3b('0x88')]=function(_0x4c889a){var _0x37403e=_0x4c889a[_0x2a3b('0x89')](/<(.*?)>/);return _0x37403e?_0x37403e[0x1]:_0x4c889a;};function buildNoAnswerEventPayload(_0x33fb9d,_0x3e83a2){var _0x2cb007=buildObj(_0x33fb9d,_0x2a3b('0x8a'));if(!_['isEmpty'](_0x3e83a2[_0x2a3b('0x8b')])){Object[_0x2a3b('0x8c')](_0x3e83a2[_0x2a3b('0x8b')])['forEach'](function(_0x663df7){_0x2cb007[_0x663df7[_0x2a3b('0x8d')]()]=_0x3e83a2[_0x2a3b('0x8b')][_0x663df7];});}return _0x2cb007;}exports[_0x2a3b('0x8e')]=buildNoAnswerEventPayload; \ No newline at end of file +var _0xa78b=['channelAgent','from-sip','timeout','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','scheduledat','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','lastevent','interface','motionChannel','mandatoryDisposition','buildObj','agentReadyId','not_inuse','status','reachable','push','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','campaigntype','dialAnswer','active','countglobal','callback','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','rtpaudioqosloss','bridgepeer','\x5cw{0,','pow','replace','random','extractCalleridName','match','variables','keys','forEach','buildNoAnswerEventPayload','lodash','moment','env','127.0.0.1','../../dialer/utils','loggerCatch','inspect','loggerError','info','message','getCallerId','isUndefined','string','isEmpty','\x22%s\x22\x20<%s>','format','\x22\x22\x20<>','addVariables','Queue','name','calleridname','calleridnum','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','toLowerVariables','updateOriginated','isNil','hasOwnProperty','originated','error','YYYY-MM-DD\x20HH:mm:ss','statedesc','starttime','responsetime','endtime','logAgent','ringtime','getSeconds','logLookAgent','membername','state','talktime','answertime','Failure','variablesAction','RECALL','BOOKED','uniqueid'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa78b,0x1de));var _0xba78=function(_0xa2db7,_0x1bd5f0){_0xa2db7=_0xa2db7-0x0;var _0x59c5f9=_0xa78b[_0xa2db7];return _0x59c5f9;};'use strict';var util=require('util');var _=require(_0xba78('0x0'));var moment=require(_0xba78('0x1'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0xba78('0x2')]['XCALLY_IP_AGI']||_0xba78('0x3');var utils=require(_0xba78('0x4'));exports[_0xba78('0x5')]=function(_0x5275a7){return function(_0x3f2c29){logger['error'](_0x5275a7,util[_0xba78('0x6')](_0x3f2c29,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x2711f1,_0x19c771){logger['info'](_0x2711f1,util[_0xba78('0x6')](_0x19c771,{'showHidden':![],'depth':null}));};exports[_0xba78('0x7')]=function(_0x156f68,_0x5bb988){logger['error'](_0x156f68,util['inspect'](_0x5bb988,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x2afbf3){return function(_0x265db7){logger[_0xba78('0x8')](_0x2afbf3,util[_0xba78('0x6')](_0x265db7,{'showHidden':![],'depth':null}));};};exports[_0xba78('0x9')]=function(_0x53fce3,_0x41849b,_0x5e42bc){return{'message':_0x53fce3,'unlock':_0x41849b,'active':_0x5e42bc};};exports[_0xba78('0xa')]=function(_0x2d9877,_0x28386e,_0x453105){if(!_[_0xba78('0xb')](_0x453105)&&'string'===typeof _0x453105&&!_['isEmpty'](_0x453105)){if(!_[_0xba78('0xb')](_0x28386e)&&_0xba78('0xc')===typeof _0x28386e&&!_[_0xba78('0xd')](_0x28386e)){return util['format'](_0xba78('0xe'),_0x28386e,_0x453105);}return util[_0xba78('0xf')](_0xba78('0xe'),_0x453105,_0x453105);}if(!_['isUndefined'](_0x2d9877)&&'string'===typeof _0x2d9877&&!_['isEmpty'](_0x2d9877)){return _0x2d9877;}return _0xba78('0x10');};exports['isActive']=function(_0x53b803){if(_['isNil'](_0x53b803)){return![];}return _0x53b803;};exports[_0xba78('0x11')]=function(_0x338a1c,_0x812a7e,_0x3487a6,_0xb2ff76,_0x107b80,_0x4c3e55){var _0x4ba780={'XMD-QUEUE':_0x812a7e[_0xba78('0x12')]?_0x812a7e['Queue'][_0xba78('0x13')]:'','XMD-CALLERID':_0xb2ff76,'XMD-CALLERID-PREVIEW':_0x4c3e55?util['format']('\x22%s\x22\x20<%s>',_0x4c3e55[_0xba78('0x14')],_0x4c3e55[_0xba78('0x15')]):_0xb2ff76,'XMD-DIALID':_0x107b80,'XMD-CONTACTID':_0x812a7e['ContactId'],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0xb2ff76,'XMD-VOICEQUEUEID':_0x812a7e[_0xba78('0x16')],'XMD-DIALCHANNEL':_0x3487a6,'XMD-DIALTIMEOUT':_0x338a1c[_0xba78('0x17')]||0x1e,'XMD-DIALOPTIONS':util[_0xba78('0xf')](_0xba78('0x18'),_0x338a1c['dialQueueProject2']?'g':'',_['isEmpty'](_0x338a1c['monitor_format'])?'':_0xba78('0x19')),'XMD-DIALURL':_0x338a1c[_0xba78('0x1a')]||'','XMD-AGI':_0x338a1c[_0xba78('0x1b')]?util[_0xba78('0xf')](_0xba78('0x1c'),ipAgi,_0x338a1c['dialQueueProject']):_0xba78('0x1d'),'XMD-AGIAFTER':_0x338a1c[_0xba78('0x1e')]?util['format'](_0xba78('0x1c'),ipAgi,_0x338a1c[_0xba78('0x1e')]):'NONE','XMD-ORIGINATECALLERIDNUM':_0x4c3e55?_0x4c3e55[_0xba78('0x1f')]:'','XMD-ORIGINATECALLERIDNAME':_0x4c3e55?_0x4c3e55[_0xba78('0x20')]:'','XMD-DESTINATION':_0xba78('0x21'),'SIPADDHEADER':_0xba78('0x22')};if(!_[_0xba78('0xd')](_0x338a1c[_0xba78('0x23')])){_0x4ba780[util[_0xba78('0xf')]('%s',_0xba78('0x24'))]=_0x338a1c[_0xba78('0x23')];_0x4ba780[util[_0xba78('0xf')]('%s',_0xba78('0x25'))]=_0x107b80;}return _0x4ba780;};exports[_0xba78('0x26')]=function(_0x160154){var _0x3e8e46={};for(var _0x31c3f8 in _0x160154){if(_0x160154['hasOwnProperty'](_0x31c3f8)){_0x3e8e46[util[_0xba78('0xf')]('%s',_['toLower'](_0x31c3f8))]=_0x160154[_0x31c3f8];}}return{'variables':_0x3e8e46};};exports[_0xba78('0x27')]=function(_0x58e343,_0x44cb3a){if(!_[_0xba78('0x28')](_0x58e343)){if(_0x58e343[_0xba78('0x29')](_0xba78('0x2a'))){if(_0x58e343[_0xba78('0x2a')]>0x0){_0x58e343[_0xba78('0x2a')]-=0x1;}else{logger[_0xba78('0x2b')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x44cb3a);}}}else{logger[_0xba78('0x2b')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x44cb3a);}};exports['logBlacklist']=function(_0x5c5a51){var _0x282ca6=moment()[_0xba78('0xf')](_0xba78('0x2c'));_0x5c5a51['state']=0xd;_0x5c5a51[_0xba78('0x2d')]='Blacklist';_0x5c5a51[_0xba78('0x2e')]=_0x282ca6;_0x5c5a51[_0xba78('0x2f')]=_0x282ca6;_0x5c5a51[_0xba78('0x30')]=_0x282ca6;};exports[_0xba78('0x31')]=function(_0x10ecbf,_0x79e889,_0x123539){var _0x1ecb32=moment()[_0xba78('0xf')]('YYYY-MM-DD\x20HH:mm:ss');_0x10ecbf['state']=_0x79e889;_0x10ecbf['statedesc']=_0x123539;_0x10ecbf[_0xba78('0x2f')]=_0x1ecb32;_0x10ecbf[_0xba78('0x32')]=utils[_0xba78('0x33')](_0x10ecbf['responsetime'],_0x10ecbf[_0xba78('0x2e')]);};exports[_0xba78('0x34')]=function(_0x11162b,_0x30b2ed,_0x2de165){_0x11162b[_0xba78('0x35')]=_0x30b2ed;_0x11162b['UserId']=_0x2de165;};exports['logCustomer']=function(_0x17d46a,_0x24b4b0,_0x319c31){var _0x319342=moment()[_0xba78('0xf')](_0xba78('0x2c'));_0x17d46a[_0xba78('0x36')]=_0x24b4b0;_0x17d46a[_0xba78('0x2d')]=_0x319c31;_0x17d46a[_0xba78('0x2f')]=_0x17d46a[_0xba78('0x2f')]?_0x17d46a[_0xba78('0x2f')]:_0x319342;_0x17d46a[_0xba78('0x30')]=_0x17d46a[_0xba78('0x30')]?_0x17d46a[_0xba78('0x30')]:_0x319342;_0x17d46a[_0xba78('0x32')]=utils[_0xba78('0x33')](_0x17d46a[_0xba78('0x2f')]||0x0,_0x17d46a[_0xba78('0x2e')]||0x0);_0x17d46a[_0xba78('0x37')]=_0x17d46a[_0xba78('0x38')]?utils['getSeconds'](_0x17d46a[_0xba78('0x30')],_0x17d46a[_0xba78('0x38')]):0x0;};exports['isFailure']=function(_0x23aafc){return _0x23aafc===_0xba78('0x39');};exports[_0xba78('0x3a')]=function(_0x2c1844,_0x49939a,_0x35251a,_0x965f03,_0x579be3){var _0x1604c9=_0x965f03?_0xba78('0x3b'):_0x2c1844['calleridname'];_0x1604c9=_0x579be3?_0xba78('0x3c'):_0x1604c9;return{'actionid':_0x2c1844[_0xba78('0x3d')],'action':'originate','channel':_0x2c1844[_0xba78('0x3e')],'callerid':util['format'](_0xba78('0xe'),_0x1604c9,_0x2c1844[_0xba78('0x15')]),'Exten':_0xba78('0x21'),'Context':_0xba78('0x3f'),'Priority':'1','variable':_0x35251a,'timeout':(_0x49939a[_0xba78('0x40')]||0x1e)*0x3e8,'async':!![],'channelid':_0x2c1844['uniqueid']};};exports[_0xba78('0x41')]=function(_0x2ff760){return _0x2ff760[_0xba78('0x42')]+_0x2ff760[_0xba78('0x43')]+_0x2ff760[_0xba78('0x44')]+_0x2ff760[_0xba78('0x45')]+_0x2ff760[_0xba78('0x46')];};exports[_0xba78('0x47')]=function(_0x4ffab5){var _0x2fee0f=_[_0xba78('0x48')](_0x4ffab5);_0x2fee0f['state']=0xf;_0x2fee0f[_0xba78('0x2d')]=_0xba78('0x49');return _0x2fee0f;};exports[_0xba78('0x4a')]=function(_0x426699,_0x34940e,_0x4a11a2){var _0x3927a3={};_0x3927a3[_0x34940e]=_0x426699[_0x34940e];_0x3927a3['active']=![];_0x3927a3[_0xba78('0x4b')]=moment()['add'](_0x4a11a2,'minutes')[_0xba78('0xf')](_0xba78('0x2c'));_0x3927a3[_0xba78('0x4c')]=_0x426699[_0xba78('0x4c')];_0x3927a3[_0xba78('0x4d')]=_0x426699[_0xba78('0x4d')];_0x3927a3[_0xba78('0x16')]=_0x426699['VoiceQueueId']||undefined;return _0x3927a3;};exports[_0xba78('0x4e')]=function(_0x3c0c00,_0x39f409){if(!_['isNil'](_0x3c0c00)){if(_0x3c0c00[_0xba78('0x4f')]>0x0){_0x3c0c00[_0xba78('0x4f')]-=0x1;}else{logger[_0xba78('0x2b')](_0x39f409,_0xba78('0x50'));}}else{logger[_0xba78('0x2b')](_0x39f409,_0xba78('0x51'));}};exports['IsNotLoggedIn']=function(_0x47fa09){if(_0x47fa09<=0x0){return!![];}return![];};function buildObj(_0x282b9c,_0x3ef1ff,_0x224c01){_0x282b9c[_0xba78('0x52')]=_0x3ef1ff;_0x282b9c[_0xba78('0x13')]=_0x282b9c['queue'];_0x282b9c[_0xba78('0x53')]=_0x282b9c['channelAgent'];_0x282b9c[_0xba78('0x54')]='voice';if(_0x224c01){_0x282b9c['mandatoryDisposition']=_0x224c01[_0xba78('0x55')];}return _0x282b9c;}exports[_0xba78('0x56')]=buildObj;exports[_0xba78('0x57')]=function(_0x2bcb2a){var _0x448042=[];for(var _0x23b61d in _0x2bcb2a){if(_0x2bcb2a['hasOwnProperty'](_0x23b61d)){if(!_['isNil'](_0x2bcb2a[_0x23b61d])&&_0x2bcb2a[_0x23b61d]['state']===_0xba78('0x58')&&_0x2bcb2a[_0x23b61d][_0xba78('0x59')]===_0xba78('0x5a')){_0x448042[_0xba78('0x5b')](_0x2bcb2a[_0x23b61d]['id']);}}}return _0x448042;};exports['getDiff']=function(_0x370378){var _0x39d3f9=moment()[_0xba78('0x5c')](0x0);var _0x434453=moment(_0x370378)[_0xba78('0x5c')](0x0);return _0x39d3f9[_0xba78('0x5d')](_0x434453,_0xba78('0x5e'));};exports[_0xba78('0x5f')]=function(_0x4fc7b8){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x4fc7b8[_0xba78('0x4c')],'ListId':_0x4fc7b8[_0xba78('0x4d')],'VoiceQueueId':_0x4fc7b8[_0xba78('0x16')]||undefined,'CampaignId':_0x4fc7b8[_0xba78('0x60')]||undefined};};exports[_0xba78('0x61')]=function(_0xab1d83){if(_0xab1d83===_0xba78('0x3d')||_0xab1d83===_0xba78('0x62')||_0xab1d83==='queue'||_0xab1d83==='type'||_0xab1d83===_0xba78('0x63')||_0xab1d83===_0xba78('0x64')||_0xab1d83===_0xba78('0x35')||_0xab1d83==='channelAgent'||_0xab1d83===_0xba78('0x14')||_0xab1d83===_0xba78('0x65')||_0xab1d83==='calleridnum'||_0xab1d83===_0xba78('0x4b')||_0xab1d83==='countbusyretry'||_0xab1d83==='countcongestionretry'||_0xab1d83==='countnoanswerretry'||_0xab1d83===_0xba78('0x66')||_0xab1d83===_0xba78('0x67')||_0xab1d83===_0xba78('0x68')||_0xab1d83==='callbackat'||_0xab1d83==='recallme'||_0xab1d83==='ContactId'||_0xab1d83===_0xba78('0x4d')||_0xab1d83==='UserId'||_0xab1d83===_0xba78('0x16')||_0xab1d83===_0xba78('0x69')||_0xab1d83===_0xba78('0x6a')||_0xab1d83===_0xba78('0x6b')||_0xab1d83==='xmd-phone'||_0xab1d83===_0xba78('0x6c')||_0xab1d83===_0xba78('0x6d')||_0xab1d83===_0xba78('0x6e')||_0xab1d83===_0xba78('0x6f')||_0xab1d83===_0xba78('0x70')||_0xab1d83==='xmd-dialchannel'||_0xab1d83===_0xba78('0x71')||_0xab1d83===_0xba78('0x72')||_0xab1d83===_0xba78('0x73')||_0xab1d83==='xmd-agiafter'||_0xab1d83==='xmd-agi'||_0xab1d83===_0xba78('0x74')||_0xab1d83===_0xba78('0x75')||_0xab1d83===_0xba78('0x76')||_0xab1d83===_0xba78('0x77')||_0xab1d83==='rtpaudioqosloss'||_0xab1d83===_0xba78('0x78')||_0xab1d83===_0xba78('0x79')||_0xab1d83===_0xba78('0x7a')||_0xab1d83===_0xba78('0x74')||_0xab1d83===_0xba78('0x75')||_0xab1d83===_0xba78('0x76')||_0xab1d83===_0xba78('0x77')||_0xab1d83===_0xba78('0x7b')||_0xab1d83==='rtpaudioqoslossbridged'||_0xab1d83==='rtpaudioqosrtt'||_0xab1d83===_0xba78('0x7a')||_0xab1d83===_0xba78('0x7c')||_0xab1d83==='bridgepvtcallid'||_0xab1d83==='state'||_0xab1d83==='statedesc'){return![];}return!![];};exports['getCallerIdRandom']=function(_0x844d5e,_0x3d4fbd){var _0x145c3c,_0x34a7e4,_0x38adb4;if(_0x3d4fbd<=0x0){_0x3d4fbd=0x1;}_0x145c3c=new RegExp(_0xba78('0x7d')+_0x3d4fbd+'}$');_0x34a7e4=Math[_0xba78('0x7e')](0xa,_0x3d4fbd-0x1);_0x38adb4=Math['pow'](0xa,_0x3d4fbd)-0x1;return util[_0xba78('0xf')]('%s',_[_0xba78('0x7f')](_0x844d5e,_0x145c3c,_[_0xba78('0x80')](_0x34a7e4,_0x38adb4)));};exports[_0xba78('0x81')]=function(_0x52a732){var _0x57ab88=_0x52a732[_0xba78('0x82')](/"(.*?)"/);return _0x57ab88?_0x57ab88[0x1]:_0x52a732;};exports['extractCalleridNumber']=function(_0x227e6d){var _0x2519df=_0x227e6d[_0xba78('0x82')](/<(.*?)>/);return _0x2519df?_0x2519df[0x1]:_0x227e6d;};function buildNoAnswerEventPayload(_0x23ce88,_0xd026a1){var _0x8c4c26=buildObj(_0x23ce88,'noanswer');if(!_[_0xba78('0xd')](_0xd026a1[_0xba78('0x83')])){Object[_0xba78('0x84')](_0xd026a1[_0xba78('0x83')])[_0xba78('0x85')](function(_0x57f180){_0x8c4c26[_0x57f180['toLowerCase']()]=_0xd026a1[_0xba78('0x83')][_0x57f180];});}return _0x8c4c26;}exports[_0xba78('0x86')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index f8b5309..b4815c3 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 _0xd417=['queuepause','reload','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean','queueremove'];(function(_0xdd827a,_0x482ad2){var _0x2f46f1=function(_0x221046){while(--_0x221046){_0xdd827a['push'](_0xdd827a['shift']());}};_0x2f46f1(++_0x482ad2);}(_0xd417,0x1eb));var _0x7d41=function(_0x56247d,_0x53c5e0){_0x56247d=_0x56247d-0x0;var _0xf99eea=_0xd417[_0x56247d];return _0xf99eea;};'use strict';exports['queueadd']={'queue':{'type':_0x7d41('0x0'),'required':!![]},'interface':{'type':_0x7d41('0x0'),'required':!![]},'membername':{'type':_0x7d41('0x0'),'required':!![]},'penalty':{'type':_0x7d41('0x1'),'required':![]},'paused':{'type':_0x7d41('0x2'),'required':![]}};exports[_0x7d41('0x3')]={'queue':{'type':_0x7d41('0x0'),'required':!![]},'interface':{'type':_0x7d41('0x0'),'required':!![]}};exports[_0x7d41('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x7d41('0x2')},'reason':{'type':_0x7d41('0x0'),'required':![]}};exports[_0x7d41('0x5')]={'module':{'type':'string','required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0x7d41('0x0'),'required':!![]}};exports[_0x7d41('0x6')]={'uniqueid':{'type':_0x7d41('0x0'),'required':!![]},'filename':{'type':_0x7d41('0x0')},'format':{'type':_0x7d41('0x0')},'mixmonitorid':{'type':_0x7d41('0x0')}};exports[_0x7d41('0x7')]={'uniqueid':{'type':_0x7d41('0x0'),'required':!![]}};exports[_0x7d41('0x8')]={'uniqueid':{'type':'string','required':!![]},'exten':{'type':_0x7d41('0x0'),'required':!![]},'context':{'type':_0x7d41('0x0')}}; \ No newline at end of file +var _0xc2ed=['voicechannel','voicequeuechannelredirect','string','number','boolean','queueremove','queuepause','reload'];(function(_0x137bcf,_0x5d9120){var _0x3ffe78=function(_0x420140){while(--_0x420140){_0x137bcf['push'](_0x137bcf['shift']());}};_0x3ffe78(++_0x5d9120);}(_0xc2ed,0xca));var _0xdc2e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xc2ed[_0x3054be];return _0x3df150;};'use strict';exports['queueadd']={'queue':{'type':_0xdc2e('0x0'),'required':!![]},'interface':{'type':_0xdc2e('0x0'),'required':!![]},'membername':{'type':_0xdc2e('0x0'),'required':!![]},'penalty':{'type':_0xdc2e('0x1'),'required':![]},'paused':{'type':_0xdc2e('0x2'),'required':![]}};exports[_0xdc2e('0x3')]={'queue':{'type':_0xdc2e('0x0'),'required':!![]},'interface':{'type':_0xdc2e('0x0'),'required':!![]}};exports[_0xdc2e('0x4')]={'interface':{'type':_0xdc2e('0x0'),'required':!![]},'paused':{'type':_0xdc2e('0x2')},'reason':{'type':_0xdc2e('0x0'),'required':![]}};exports[_0xdc2e('0x5')]={'module':{'type':_0xdc2e('0x0'),'required':![]}};exports['voicequeuechannel']={'uniqueid':{'type':_0xdc2e('0x0'),'required':!![]}};exports[_0xdc2e('0x6')]={'uniqueid':{'type':'string','required':!![]},'filename':{'type':_0xdc2e('0x0')},'format':{'type':_0xdc2e('0x0')},'mixmonitorid':{'type':'string'}};exports['voicequeuechannelhangup']={'uniqueid':{'type':_0xdc2e('0x0'),'required':!![]}};exports[_0xdc2e('0x7')]={'uniqueid':{'type':_0xdc2e('0x0'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':_0xdc2e('0x0')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index f329f16..57397bd 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 _0xdb28=['initTriggers','triggers','initTemplates','initZendeskAccounts','zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queuecallerexit','queuecallerabandon','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerabandonAt','queuecallerexitAt','diff','queuecallercomplete','queuecallerleaveAt','initVoiceCallReports','outbound','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initVoiceQueues','exports','lodash','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','templates','voiceExtensions','channels','queueChannels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','isNil','interface','sumDuration','sumBillable','isEmpty','ivrAnswerCallsDay','total','answered','unmanaged','abandoned','sumHoldTime','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','initAgents','agents','length','isUndefined','mergeFromDatabase','initTelephones','initTrunks'];(function(_0xde9523,_0x222038){var _0x3e6fd7=function(_0x4dd770){while(--_0x4dd770){_0xde9523['push'](_0xde9523['shift']());}};_0x3e6fd7(++_0x222038);}(_0xdb28,0x106));var _0x8db2=function(_0x4f19c0,_0x5550ca){_0x4f19c0=_0x4f19c0-0x0;var _0x5eb00b=_0xdb28[_0x4f19c0];return _0x5eb00b;};'use strict';var _=require(_0x8db2('0x0'));var moment=require(_0x8db2('0x1'));var util=require(_0x8db2('0x2'));var Agent=require(_0x8db2('0x3'));var Telephone=require('../model/telephone');var Trunk=require(_0x8db2('0x4'));var VoiceQueue=require(_0x8db2('0x5'));var Trigger=require(_0x8db2('0x6'));var Template=require(_0x8db2('0x7'));var Campaign=require(_0x8db2('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x8db2('0x9'));var SalesforceAccount=require(_0x8db2('0xa'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x8db2('0xb'));var DeskAccount=require(_0x8db2('0xc'));var VtigerAccount=require(_0x8db2('0xd'));var ServicenowAccount=require(_0x8db2('0xe'));var Dynamics365Account=require(_0x8db2('0xf'));var FreshsalesAccount=require(_0x8db2('0x10'));var FaxAccount=require(_0x8db2('0x11'));function Realtime(){this['agents']={};this[_0x8db2('0x12')]={};this[_0x8db2('0x13')]={};this[_0x8db2('0x14')]={};this['triggers']={};this[_0x8db2('0x15')]={};this[_0x8db2('0x16')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8db2('0x17')]={};this[_0x8db2('0x18')]={};this[_0x8db2('0x19')]={};this[_0x8db2('0x1a')]={};this[_0x8db2('0x1b')]={};this['settings']={};this['zendeskAccounts']={};this[_0x8db2('0x1c')]={};this[_0x8db2('0x1d')]={};this[_0x8db2('0x1e')]={};this[_0x8db2('0x1f')]={};this[_0x8db2('0x20')]={};this[_0x8db2('0x21')]={};this[_0x8db2('0x22')]={};this[_0x8db2('0x23')]={};this[_0x8db2('0x24')]={};this[_0x8db2('0x25')]={};}function freeIsNotKey(_0x5489a9,_0x13b0f5,_0x24da1b){var _0x48101e=_[_0x8db2('0x26')](_0x5489a9,function(_0x44957d){return _0x44957d[_0x24da1b];});for(var _0x21db8c in _0x13b0f5){if(_0x13b0f5[_0x8db2('0x27')](_0x21db8c)){if(!_0x48101e[_0x21db8c]){delete _0x13b0f5[_0x21db8c];}}}}function freeIsNotKeySip(_0x2efd06,_0x46ce14){var _0x51d60d=_['mapKeys'](_0x2efd06,function(_0x77789){return util[_0x8db2('0x28')](_0x8db2('0x29'),_0x77789[_0x8db2('0x2a')]);});for(var _0x58562e in _0x46ce14){if(_0x46ce14[_0x8db2('0x27')](_0x58562e)){if(!_0x51d60d[_0x58562e]){delete _0x46ce14[_0x58562e];}}}}function freeIsNotKeyAgent(_0x36a9ff,_0x260940){var _0x297ba3=_[_0x8db2('0x26')](_0x36a9ff,function(_0x597260){var _0x124467=_[_0x8db2('0x2b')](_0x597260[_0x8db2('0x2c')])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x597260[_0x8db2('0x2a')]):_0x597260[_0x8db2('0x2c')];return _0x124467;});for(var _0x5c6614 in _0x260940){if(_0x260940[_0x8db2('0x27')](_0x5c6614)){if(!_0x297ba3[_0x5c6614]){delete _0x260940[_0x5c6614];}}}}function clearVoiceCallReports(_0x4f6516){_0x4f6516['total']=0x0;_0x4f6516['answered']=0x0;_0x4f6516['sumHoldTime']=0x0;_0x4f6516[_0x8db2('0x2d')]=0x0;_0x4f6516[_0x8db2('0x2e')]=0x0;}function clearCampaigns(_0x3be281){if(!_[_0x8db2('0x2f')](_0x3be281)){for(var _0x145328 in _0x3be281){if(_0x3be281[_0x8db2('0x27')](_0x145328)){_0x3be281[_0x145328]['ivrTotalCallsDays']=0x0;_0x3be281[_0x145328][_0x8db2('0x30')]=0x0;}}}}function clearVoiceQueues(_0x372311){if(!_[_0x8db2('0x2f')](_0x372311)){for(var _0x8b7cec in _0x372311){if(_0x372311['hasOwnProperty'](_0x8b7cec)){_0x372311[_0x8b7cec][_0x8db2('0x31')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x32')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x33')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x34')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x35')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x2e')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x37')]=0x0;_0x372311[_0x8b7cec]['outboundBusyCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x38')]=0x0;_0x372311[_0x8b7cec]['outboundNoSuchCallsDay']=0x0;_0x372311[_0x8b7cec]['outboundUnknownCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x39')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3a')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3b')]=0x0;_0x372311[_0x8b7cec]['outboundOriginateFailureCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3c')]=0x0;_0x372311[_0x8b7cec]['outboundReCallsDay']=0x0;_0x372311[_0x8b7cec][_0x8db2('0x36')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3d')]=0x0;_0x372311[_0x8b7cec][_0x8db2('0x3e')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x35d337,_0x1a460b){for(var _0x4df530 in _0x1a460b){if(_0x35d337['hasOwnProperty'](_0x4df530)){_0x35d337[_0x4df530]=_0x1a460b[_0x4df530];}}};Realtime[_0x8db2('0x3f')][_0x8db2('0x40')]=function(){var _0xc884a=this;return function(_0x2a2d65){if(_0x2a2d65){freeIsNotKeyAgent(_0x2a2d65,_0xc884a[_0x8db2('0x41')]);for(var _0xd39848=0x0,_0x101711={};_0xd39848<_0x2a2d65[_0x8db2('0x42')];_0xd39848+=0x1){_0x101711=_0x2a2d65[_0xd39848];var _0x46e0c8=_[_0x8db2('0x2b')](_0x101711['interface'])?util[_0x8db2('0x28')](_0x8db2('0x29'),_0x101711['name']):_0x101711[_0x8db2('0x2c')];if(_[_0x8db2('0x43')](_0xc884a['agents'][_0x46e0c8])){_0xc884a['agents'][_0x46e0c8]=new Agent(_0x101711);}else{_0xc884a[_0x8db2('0x44')](_0xc884a['agents'][_0x46e0c8],_0x101711);}}}return _0xc884a[_0x8db2('0x41')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x45')]=function(){var _0x22c896=this;return function(_0x5cc419){if(_0x5cc419){freeIsNotKeySip(_0x5cc419,_0x22c896[_0x8db2('0x12')]);for(var _0x5e34e0=0x0,_0x227a08={};_0x5e34e0<_0x5cc419[_0x8db2('0x42')];_0x5e34e0+=0x1){_0x227a08=_0x5cc419[_0x5e34e0];if(_[_0x8db2('0x43')](_0x22c896[_0x8db2('0x12')][util['format']('SIP/%s',_0x227a08[_0x8db2('0x2a')])])){_0x22c896[_0x8db2('0x12')][util['format'](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])]=new Telephone(_0x227a08);}else{_0x22c896[_0x8db2('0x44')](_0x22c896['telephones'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x227a08[_0x8db2('0x2a')])],_0x227a08);}}}return _0x22c896[_0x8db2('0x12')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x46')]=function(){var _0x380046=this;return function(_0x1575ea){if(_0x1575ea){freeIsNotKeySip(_0x1575ea,_0x380046[_0x8db2('0x13')]);for(var _0x63c561=0x0,_0x21cf7c={};_0x63c561<_0x1575ea[_0x8db2('0x42')];_0x63c561+=0x1){_0x21cf7c=_0x1575ea[_0x63c561];if(_[_0x8db2('0x43')](_0x380046['trunks'][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c['name'])])){_0x380046['trunks'][util[_0x8db2('0x28')]('SIP/%s',_0x21cf7c[_0x8db2('0x2a')])]=new Trunk(_0x21cf7c);}else{_0x380046[_0x8db2('0x44')](_0x380046[_0x8db2('0x13')][util[_0x8db2('0x28')](_0x8db2('0x29'),_0x21cf7c[_0x8db2('0x2a')])],_0x21cf7c);}}}return _0x380046[_0x8db2('0x13')];};};Realtime['prototype'][_0x8db2('0x47')]=function(){var _0x3d44de=this;return function(_0x40c69e){if(_0x40c69e){freeIsNotKey(_0x40c69e,_0x3d44de[_0x8db2('0x48')],'id');for(var _0x482b26=0x0,_0x424c27={};_0x482b26<_0x40c69e[_0x8db2('0x42')];_0x482b26+=0x1){_0x424c27=_0x40c69e[_0x482b26];if(_[_0x8db2('0x43')](_0x3d44de[_0x8db2('0x48')][_0x424c27['id']])){_0x3d44de['triggers'][_0x424c27['id']]=new Trigger(_0x424c27);}else{_0x3d44de[_0x8db2('0x44')](_0x3d44de['triggers'][_0x424c27['id']],_0x424c27);}}}return _0x3d44de[_0x8db2('0x48')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x49')]=function(){var _0x4d2164=this;return function(_0x4b0e72){if(_0x4b0e72){freeIsNotKey(_0x4b0e72,_0x4d2164[_0x8db2('0x16')],'id');for(var _0x47c556=0x0,_0x173cc7={};_0x47c556<_0x4b0e72[_0x8db2('0x42')];_0x47c556+=0x1){_0x173cc7=_0x4b0e72[_0x47c556];if(_[_0x8db2('0x43')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']])){_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']]=new Template(_0x173cc7);}else{_0x4d2164[_0x8db2('0x44')](_0x4d2164[_0x8db2('0x16')][_0x173cc7['id']],_0x173cc7);}}}return _0x4d2164[_0x8db2('0x16')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4a')]=function(){var _0x1362ed=this;return function(_0x36f9d6){if(_0x36f9d6){freeIsNotKey(_0x36f9d6,_0x1362ed['zendeskAccounts'],'id');for(var _0x449109=0x0,_0x2ada52={};_0x449109<_0x36f9d6[_0x8db2('0x42')];_0x449109+=0x1){_0x2ada52=_0x36f9d6[_0x449109];if(_[_0x8db2('0x43')](_0x1362ed['zendeskAccounts'][_0x2ada52['id']])){_0x1362ed['zendeskAccounts'][_0x2ada52['id']]=new ZendeskAccount(_0x2ada52);}else{_0x1362ed[_0x8db2('0x44')](_0x1362ed[_0x8db2('0x4b')][_0x2ada52['id']],_0x2ada52);}}}return _0x1362ed[_0x8db2('0x4b')];};};Realtime['prototype']['initSalesforceAccounts']=function(){var _0x494d6e=this;return function(_0x44ac56){if(_0x44ac56){freeIsNotKey(_0x44ac56,_0x494d6e[_0x8db2('0x1c')],'id');for(var _0x55c7dd=0x0,_0x383fa1={};_0x55c7dd<_0x44ac56[_0x8db2('0x42')];_0x55c7dd+=0x1){_0x383fa1=_0x44ac56[_0x55c7dd];if(_[_0x8db2('0x43')](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']])){_0x494d6e['salesforceAccounts'][_0x383fa1['id']]=new SalesforceAccount(_0x383fa1);}else{_0x494d6e['mergeFromDatabase'](_0x494d6e[_0x8db2('0x1c')][_0x383fa1['id']],_0x383fa1);}}}return _0x494d6e[_0x8db2('0x1c')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4c')]=function(){var _0x3daed6=this;return function(_0x2bf408){if(_0x2bf408){freeIsNotKey(_0x2bf408,_0x3daed6[_0x8db2('0x1e')],'id');for(var _0x3ca2a7=0x0,_0x4187d6={};_0x3ca2a7<_0x2bf408[_0x8db2('0x42')];_0x3ca2a7+=0x1){_0x4187d6=_0x2bf408[_0x3ca2a7];if(_[_0x8db2('0x43')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']])){_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']]=new FreshdeskAccount(_0x4187d6);}else{_0x3daed6[_0x8db2('0x44')](_0x3daed6[_0x8db2('0x1e')][_0x4187d6['id']],_0x4187d6);}}}return _0x3daed6['freshdeskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4d')]=function(){var _0x579317=this;return function(_0x27b644){if(_0x27b644){freeIsNotKey(_0x27b644,_0x579317[_0x8db2('0x1f')],'id');for(var _0x3af298=0x0,_0x547215={};_0x3af298<_0x27b644[_0x8db2('0x42')];_0x3af298+=0x1){_0x547215=_0x27b644[_0x3af298];if(_[_0x8db2('0x43')](_0x579317[_0x8db2('0x1f')][_0x547215['id']])){_0x579317[_0x8db2('0x1f')][_0x547215['id']]=new ZohoAccount(_0x547215);}else{_0x579317[_0x8db2('0x44')](_0x579317['zohoAccounts'][_0x547215['id']],_0x547215);}}}return _0x579317[_0x8db2('0x1f')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4e')]=function(){var _0x58bb60=this;return function(_0x1e7d1a){if(_0x1e7d1a){freeIsNotKey(_0x1e7d1a,_0x58bb60[_0x8db2('0x20')],'id');for(var _0x33dddd=0x0,_0x7b0de8={};_0x33dddd<_0x1e7d1a[_0x8db2('0x42')];_0x33dddd+=0x1){_0x7b0de8=_0x1e7d1a[_0x33dddd];if(_[_0x8db2('0x43')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']])){_0x58bb60['deskAccounts'][_0x7b0de8['id']]=new DeskAccount(_0x7b0de8);}else{_0x58bb60[_0x8db2('0x44')](_0x58bb60[_0x8db2('0x20')][_0x7b0de8['id']],_0x7b0de8);}}}return _0x58bb60['deskAccounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x4f')]=function(){var _0x533e41=this;return function(_0x107bbe){if(_0x107bbe){freeIsNotKey(_0x107bbe,_0x533e41[_0x8db2('0x1d')],'id');for(var _0x63e8f7=0x0,_0x30f4f3={};_0x63e8f7<_0x107bbe[_0x8db2('0x42')];_0x63e8f7+=0x1){_0x30f4f3=_0x107bbe[_0x63e8f7];if(_[_0x8db2('0x43')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']])){_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']]=new SugarcrmAccount(_0x30f4f3);}else{_0x533e41[_0x8db2('0x44')](_0x533e41[_0x8db2('0x1d')][_0x30f4f3['id']],_0x30f4f3);}}}return _0x533e41[_0x8db2('0x1d')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x50')]=function(){var _0x1ce89f=this;return function(_0x64ec90){if(_0x64ec90){freeIsNotKey(_0x64ec90,_0x1ce89f[_0x8db2('0x21')],'id');for(var _0x4a20a7=0x0,_0xe0c3e={};_0x4a20a7<_0x64ec90[_0x8db2('0x42')];_0x4a20a7+=0x1){_0xe0c3e=_0x64ec90[_0x4a20a7];if(_[_0x8db2('0x43')](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']])){_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']]=new VtigerAccount(_0xe0c3e);}else{_0x1ce89f['mergeFromDatabase'](_0x1ce89f[_0x8db2('0x21')][_0xe0c3e['id']],_0xe0c3e);}}}return _0x1ce89f[_0x8db2('0x21')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x51')]=function(){var _0x2ad70f=this;return function(_0x348da8){if(_0x348da8){freeIsNotKey(_0x348da8,_0x2ad70f[_0x8db2('0x22')],'id');for(var _0x2c7b04=0x0,_0x24cfe9={};_0x2c7b04<_0x348da8[_0x8db2('0x42')];_0x2c7b04+=0x1){_0x24cfe9=_0x348da8[_0x2c7b04];if(_[_0x8db2('0x43')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']])){_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']]=new ServicenowAccount(_0x24cfe9);}else{_0x2ad70f[_0x8db2('0x44')](_0x2ad70f[_0x8db2('0x22')][_0x24cfe9['id']],_0x24cfe9);}}}return _0x2ad70f[_0x8db2('0x22')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x52')]=function(){var _0x5a719f=this;return function(_0x3273dd){if(_0x3273dd){freeIsNotKey(_0x3273dd,_0x5a719f['dynamics365Accounts'],'id');for(var _0x364176=0x0,_0x570c53={};_0x364176<_0x3273dd[_0x8db2('0x42')];_0x364176+=0x1){_0x570c53=_0x3273dd[_0x364176];if(_[_0x8db2('0x43')](_0x5a719f[_0x8db2('0x23')][_0x570c53['id']])){_0x5a719f[_0x8db2('0x23')][_0x570c53['id']]=new Dynamics365Account(_0x570c53);}else{_0x5a719f[_0x8db2('0x44')](_0x5a719f['dynamics365Accounts'][_0x570c53['id']],_0x570c53);}}}return _0x5a719f['dynamics365Accounts'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x53')]=function(){var _0x21ec87=this;return function(_0x3ba1d2){if(_0x3ba1d2){freeIsNotKey(_0x3ba1d2,_0x21ec87[_0x8db2('0x24')],'id');for(var _0x1f28d2=0x0,_0x3e3de3={};_0x1f28d2<_0x3ba1d2[_0x8db2('0x42')];_0x1f28d2+=0x1){_0x3e3de3=_0x3ba1d2[_0x1f28d2];if(_['isUndefined'](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']])){_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']]=new FreshsalesAccount(_0x3e3de3);}else{_0x21ec87[_0x8db2('0x44')](_0x21ec87[_0x8db2('0x24')][_0x3e3de3['id']],_0x3e3de3);}}}return _0x21ec87[_0x8db2('0x24')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x54')]=function(){var _0x20caf0=this;return function(_0x4938bb){for(var _0x54318c=0x0;_0x54318c<_0x4938bb[_0x8db2('0x42')];_0x54318c+=0x1){_[_0x8db2('0x55')](_0x20caf0[_0x8db2('0x14')][_0x4938bb[_0x54318c][_0x8db2('0x2a')]],_0x4938bb[_0x54318c]);}return _0x20caf0[_0x8db2('0x14')];};};Realtime['prototype']['initVoiceQueueReports']=function(){var _0x3611da=this;return function(_0x364807){clearVoiceQueues(_0x3611da['voiceQueues']);if(_0x364807){_0x364807=_[_0x8db2('0x56')](_0x364807,_0x8db2('0x57'));for(var _0x1ab84c in _0x364807){if(_0x364807['hasOwnProperty'](_0x1ab84c)){for(var _0x26523b=0x0;_0x26523b<_0x364807[_0x1ab84c][_0x8db2('0x42')];_0x26523b+=0x1){var _0x2cf731=_0x364807[_0x1ab84c][_0x26523b]['queue'];if(_0x3611da[_0x8db2('0x14')][_0x2cf731]){if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x58')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x33')]+=0x1;}if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x59')]){_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x34')]+=0x1;}_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x35')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallerleaveAt'])['diff'](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;if(_0x26523b===_0x364807[_0x1ab84c]['length']-0x1){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5c')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5d')]||_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5e')])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x5a')]),_0x8db2('0x5b'))||0x0;_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x31')]+=0x1;if(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x60')]){_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x32')]+=0x1;_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x2e')]+=moment(_0x364807[_0x1ab84c][_0x26523b]['queuecallercompleteAt'])[_0x8db2('0x5f')](moment(_0x364807[_0x1ab84c][_0x26523b][_0x8db2('0x61')]),'seconds')||0x0;}}else{_0x3611da[_0x8db2('0x14')][_0x2cf731][_0x8db2('0x2d')]+=_0x3611da['voiceQueues'][_0x2cf731][_0x8db2('0x35')]||0x0;}}}}}}return _0x3611da[_0x8db2('0x14')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x62')]=function(){var _0x242379=this;return function(_0x31a095){clearVoiceCallReports(_0x242379[_0x8db2('0x63')]);if(_0x31a095){for(var _0x3ac0fa=0x0;_0x3ac0fa<_0x31a095[_0x8db2('0x42')];_0x3ac0fa+=0x1){_0x242379['outbound']['total']+=0x1;_0x242379[_0x8db2('0x63')]['sumDuration']+=_0x31a095[_0x3ac0fa][_0x8db2('0x64')];if(_0x31a095[_0x3ac0fa][_0x8db2('0x65')]===_0x8db2('0x66')){_0x242379['outbound'][_0x8db2('0x32')]+=0x1;_0x242379[_0x8db2('0x63')][_0x8db2('0x35')]+=_0x31a095[_0x3ac0fa]['duration']-_0x31a095[_0x3ac0fa][_0x8db2('0x67')]||0x0;_0x242379[_0x8db2('0x63')][_0x8db2('0x2e')]+=_0x31a095[_0x3ac0fa][_0x8db2('0x67')];}}}return _0x242379['outbound'];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x68')]=function(){var _0x299640=this;return function(_0x1edb1a){if(_0x1edb1a){freeIsNotKey(_0x1edb1a,_0x299640[_0x8db2('0x15')],_0x8db2('0x2a'));for(var _0x1aadfb=0x0,_0x3682bf={};_0x1aadfb<_0x1edb1a[_0x8db2('0x42')];_0x1aadfb+=0x1){_0x3682bf=_0x1edb1a[_0x1aadfb];if(_[_0x8db2('0x43')](_0x299640[_0x8db2('0x15')][_0x3682bf['name']])){_0x299640[_0x8db2('0x15')][_0x3682bf[_0x8db2('0x2a')]]=new Campaign(_0x3682bf);}else{_0x299640[_0x8db2('0x44')](_0x299640['campaigns'][_0x3682bf['name']],_0x3682bf);_0x299640['campaigns'][_0x3682bf[_0x8db2('0x2a')]][_0x8db2('0x69')]=_0x3682bf[_0x8db2('0x6a')]?_0x3682bf[_0x8db2('0x6a')][_0x8db2('0x2a')]:undefined;}}}return _0x299640[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6b')]=function(){var _0x3b1929=this;return function(_0x37cf6d){if(_0x37cf6d){freeIsNotKey(_0x37cf6d,_0x3b1929[_0x8db2('0x17')],'id');for(var _0x4d0ff6=0x0,_0x360a06={};_0x4d0ff6<_0x37cf6d[_0x8db2('0x42')];_0x4d0ff6+=0x1){_0x360a06=_0x37cf6d[_0x4d0ff6];if(_[_0x8db2('0x43')](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']])){_0x3b1929['voiceExtensions'][_0x360a06['id']]=new VoiceExtension(_0x360a06);}else{_0x3b1929['mergeFromDatabase'](_0x3b1929[_0x8db2('0x17')][_0x360a06['id']],_0x360a06);}}}return _0x3b1929[_0x8db2('0x17')];};};Realtime['prototype'][_0x8db2('0x6c')]=function(){var _0x121f31=this;return function(_0x9132b4){clearCampaigns(_0x121f31['campaigns']);for(var _0x5dc46c=0x0;_0x5dc46c<_0x9132b4['length'];_0x5dc46c+=0x1){_[_0x8db2('0x55')](_0x121f31[_0x8db2('0x15')][_0x9132b4[_0x5dc46c][_0x8db2('0x2a')]],_0x9132b4[_0x5dc46c]);}return _0x121f31[_0x8db2('0x15')];};};Realtime[_0x8db2('0x3f')]['initFaxAccounts']=function(){var _0x30930a=this;return function(_0x5e349c){if(_0x5e349c){freeIsNotKey(_0x5e349c,_0x30930a[_0x8db2('0x25')],'id');for(var _0x353101=0x0,_0xa083b1={};_0x353101<_0x5e349c[_0x8db2('0x42')];_0x353101+=0x1){_0xa083b1=_0x5e349c[_0x353101];if(_[_0x8db2('0x43')](_0x30930a['faxAccounts'][_0xa083b1['id']])){_0x30930a['faxAccounts'][_0xa083b1['id']]=new FaxAccount(_0xa083b1);}else{_0x30930a[_0x8db2('0x44')](_0x30930a['faxAccounts'][_0xa083b1['id']],_0xa083b1);}}}return _0x30930a[_0x8db2('0x25')];};};Realtime[_0x8db2('0x3f')][_0x8db2('0x6d')]=function(){var _0x1e7bc2=this;return function(_0x2b7224){if(_0x2b7224){freeIsNotKey(_0x2b7224,_0x1e7bc2[_0x8db2('0x14')],'name');for(var _0x19f9a0=0x0,_0x222ea2={};_0x19f9a0<_0x2b7224[_0x8db2('0x42')];_0x19f9a0+=0x1){_0x222ea2=_0x2b7224[_0x19f9a0];if(_['isUndefined'](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]])){_0x1e7bc2['voiceQueues'][_0x222ea2[_0x8db2('0x2a')]]=new VoiceQueue(_0x222ea2);}else{_0x1e7bc2[_0x8db2('0x44')](_0x1e7bc2[_0x8db2('0x14')][_0x222ea2[_0x8db2('0x2a')]],_0x222ea2);}}}return _0x1e7bc2[_0x8db2('0x14')];};};module[_0x8db2('0x6e')]=Realtime; \ No newline at end of file +var _0x2032=['voiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','exports','moment','util','../model/agent','../model/trunk','../model/voiceQueue','../model/template','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/faxAccount','telephones','trunks','voiceQueues','campaigns','outbound','channels','queueChannels','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','answered','sumHoldTime','sumDuration','sumBillable','ivrTotalCallsDays','isEmpty','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundRejectCallsDay','outboundReCallsDay','queueStatusComplete','prototype','length','isNil','isUndefined','agents','initTelephones','initTrunks','mergeFromDatabase','initTriggers','triggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','salesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initVtigerAccounts','initServicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallercompleteAt','queuecallerexitAt','queuecallercomplete','initVoiceCallReports','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2032,0xd9));var _0x2203=function(_0x18bcff,_0x3dfea9){_0x18bcff=_0x18bcff-0x0;var _0xf604ac=_0x2032[_0x18bcff];return _0xf604ac;};'use strict';var _=require('lodash');var moment=require(_0x2203('0x0'));var util=require(_0x2203('0x1'));var Agent=require(_0x2203('0x2'));var Telephone=require('../model/telephone');var Trunk=require(_0x2203('0x3'));var VoiceQueue=require(_0x2203('0x4'));var Trigger=require('../model/trigger');var Template=require(_0x2203('0x5'));var Campaign=require(_0x2203('0x6'));var VoiceExtension=require(_0x2203('0x7'));var ZendeskAccount=require(_0x2203('0x8'));var SalesforceAccount=require(_0x2203('0x9'));var FreshdeskAccount=require(_0x2203('0xa'));var SugarcrmAccount=require(_0x2203('0xb'));var ZohoAccount=require(_0x2203('0xc'));var DeskAccount=require(_0x2203('0xd'));var VtigerAccount=require(_0x2203('0xe'));var ServicenowAccount=require(_0x2203('0xf'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x2203('0x10'));function Realtime(){this['agents']={};this[_0x2203('0x11')]={};this[_0x2203('0x12')]={};this[_0x2203('0x13')]={};this['triggers']={};this[_0x2203('0x14')]={};this['templates']={};this[_0x2203('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x2203('0x16')]={};this[_0x2203('0x17')]={};this['outboundChannels']={};this['timers']={};this['settings']={};this['zendeskAccounts']={};this['salesforceAccounts']={};this[_0x2203('0x18')]={};this['freshdeskAccounts']={};this['zohoAccounts']={};this[_0x2203('0x19')]={};this[_0x2203('0x1a')]={};this[_0x2203('0x1b')]={};this[_0x2203('0x1c')]={};this[_0x2203('0x1d')]={};this[_0x2203('0x1e')]={};}function freeIsNotKey(_0x2c36e6,_0x2c085c,_0xdf9d0b){var _0x3053f3=_['mapKeys'](_0x2c36e6,function(_0x280eda){return _0x280eda[_0xdf9d0b];});for(var _0x2ee127 in _0x2c085c){if(_0x2c085c['hasOwnProperty'](_0x2ee127)){if(!_0x3053f3[_0x2ee127]){delete _0x2c085c[_0x2ee127];}}}}function freeIsNotKeySip(_0x3f9ef6,_0x8906e1){var _0x4aeb9f=_[_0x2203('0x1f')](_0x3f9ef6,function(_0x5ee83c){return util[_0x2203('0x20')](_0x2203('0x21'),_0x5ee83c[_0x2203('0x22')]);});for(var _0x3b4034 in _0x8906e1){if(_0x8906e1[_0x2203('0x23')](_0x3b4034)){if(!_0x4aeb9f[_0x3b4034]){delete _0x8906e1[_0x3b4034];}}}}function freeIsNotKeyAgent(_0x449039,_0x538c23){var _0x13d3f7=_['mapKeys'](_0x449039,function(_0x5ac866){var _0x15f543=_['isNil'](_0x5ac866[_0x2203('0x24')])?util[_0x2203('0x20')]('SIP/%s',_0x5ac866[_0x2203('0x22')]):_0x5ac866['interface'];return _0x15f543;});for(var _0x5c8da9 in _0x538c23){if(_0x538c23[_0x2203('0x23')](_0x5c8da9)){if(!_0x13d3f7[_0x5c8da9]){delete _0x538c23[_0x5c8da9];}}}}function clearVoiceCallReports(_0x2718f5){_0x2718f5[_0x2203('0x25')]=0x0;_0x2718f5[_0x2203('0x26')]=0x0;_0x2718f5[_0x2203('0x27')]=0x0;_0x2718f5[_0x2203('0x28')]=0x0;_0x2718f5[_0x2203('0x29')]=0x0;}function clearCampaigns(_0x250349){if(!_['isEmpty'](_0x250349)){for(var _0x143f41 in _0x250349){if(_0x250349[_0x2203('0x23')](_0x143f41)){_0x250349[_0x143f41][_0x2203('0x2a')]=0x0;_0x250349[_0x143f41]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0xb2071b){if(!_[_0x2203('0x2b')](_0xb2071b)){for(var _0x5c5fd3 in _0xb2071b){if(_0xb2071b[_0x2203('0x23')](_0x5c5fd3)){_0xb2071b[_0x5c5fd3][_0x2203('0x25')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x26')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2c')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2d')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x27')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x28')]=0x0;_0xb2071b[_0x5c5fd3]['sumBillable']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2e')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x2f')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x30')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x31')]=0x0;_0xb2071b[_0x5c5fd3]['outboundNoSuchCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x32')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x33')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x34')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x35')]=0x0;_0xb2071b[_0x5c5fd3]['outboundOriginateFailureCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x36')]=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x37')]=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerAgiCallsDay']=0x0;_0xb2071b[_0x5c5fd3]['outboundAnswerCallsDay']=0x0;_0xb2071b[_0x5c5fd3][_0x2203('0x38')]=!![];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x125dfc,_0x464c88){for(var _0x191894 in _0x464c88){if(_0x125dfc[_0x2203('0x23')](_0x191894)){_0x125dfc[_0x191894]=_0x464c88[_0x191894];}}};Realtime[_0x2203('0x39')]['initAgents']=function(){var _0xb22e28=this;return function(_0x2324c0){if(_0x2324c0){freeIsNotKeyAgent(_0x2324c0,_0xb22e28['agents']);for(var _0x2a2ee7=0x0,_0x20fbe1={};_0x2a2ee7<_0x2324c0[_0x2203('0x3a')];_0x2a2ee7+=0x1){_0x20fbe1=_0x2324c0[_0x2a2ee7];var _0x4187b4=_[_0x2203('0x3b')](_0x20fbe1[_0x2203('0x24')])?util[_0x2203('0x20')](_0x2203('0x21'),_0x20fbe1[_0x2203('0x22')]):_0x20fbe1['interface'];if(_[_0x2203('0x3c')](_0xb22e28[_0x2203('0x3d')][_0x4187b4])){_0xb22e28['agents'][_0x4187b4]=new Agent(_0x20fbe1);}else{_0xb22e28['mergeFromDatabase'](_0xb22e28[_0x2203('0x3d')][_0x4187b4],_0x20fbe1);}}}return _0xb22e28['agents'];};};Realtime[_0x2203('0x39')][_0x2203('0x3e')]=function(){var _0x127ee3=this;return function(_0x5221f0){if(_0x5221f0){freeIsNotKeySip(_0x5221f0,_0x127ee3['telephones']);for(var _0x34cdeb=0x0,_0x47c93a={};_0x34cdeb<_0x5221f0[_0x2203('0x3a')];_0x34cdeb+=0x1){_0x47c93a=_0x5221f0[_0x34cdeb];if(_['isUndefined'](_0x127ee3[_0x2203('0x11')][util['format'](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])])){_0x127ee3[_0x2203('0x11')][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a['name'])]=new Telephone(_0x47c93a);}else{_0x127ee3['mergeFromDatabase'](_0x127ee3['telephones'][util[_0x2203('0x20')](_0x2203('0x21'),_0x47c93a[_0x2203('0x22')])],_0x47c93a);}}}return _0x127ee3[_0x2203('0x11')];};};Realtime[_0x2203('0x39')][_0x2203('0x3f')]=function(){var _0x1c7e3d=this;return function(_0x590b4e){if(_0x590b4e){freeIsNotKeySip(_0x590b4e,_0x1c7e3d[_0x2203('0x12')]);for(var _0x1b12c3=0x0,_0x108fde={};_0x1b12c3<_0x590b4e[_0x2203('0x3a')];_0x1b12c3+=0x1){_0x108fde=_0x590b4e[_0x1b12c3];if(_['isUndefined'](_0x1c7e3d['trunks'][util[_0x2203('0x20')]('SIP/%s',_0x108fde[_0x2203('0x22')])])){_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')]('SIP/%s',_0x108fde['name'])]=new Trunk(_0x108fde);}else{_0x1c7e3d[_0x2203('0x40')](_0x1c7e3d[_0x2203('0x12')][util[_0x2203('0x20')](_0x2203('0x21'),_0x108fde[_0x2203('0x22')])],_0x108fde);}}}return _0x1c7e3d[_0x2203('0x12')];};};Realtime['prototype'][_0x2203('0x41')]=function(){var _0x165a3f=this;return function(_0x3a866c){if(_0x3a866c){freeIsNotKey(_0x3a866c,_0x165a3f[_0x2203('0x42')],'id');for(var _0x16b452=0x0,_0x36b99f={};_0x16b452<_0x3a866c[_0x2203('0x3a')];_0x16b452+=0x1){_0x36b99f=_0x3a866c[_0x16b452];if(_[_0x2203('0x3c')](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']])){_0x165a3f[_0x2203('0x42')][_0x36b99f['id']]=new Trigger(_0x36b99f);}else{_0x165a3f['mergeFromDatabase'](_0x165a3f[_0x2203('0x42')][_0x36b99f['id']],_0x36b99f);}}}return _0x165a3f[_0x2203('0x42')];};};Realtime[_0x2203('0x39')][_0x2203('0x43')]=function(){var _0x4c3259=this;return function(_0x58bd5c){if(_0x58bd5c){freeIsNotKey(_0x58bd5c,_0x4c3259[_0x2203('0x44')],'id');for(var _0x48129c=0x0,_0x273e5f={};_0x48129c<_0x58bd5c[_0x2203('0x3a')];_0x48129c+=0x1){_0x273e5f=_0x58bd5c[_0x48129c];if(_[_0x2203('0x3c')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']])){_0x4c3259['templates'][_0x273e5f['id']]=new Template(_0x273e5f);}else{_0x4c3259[_0x2203('0x40')](_0x4c3259[_0x2203('0x44')][_0x273e5f['id']],_0x273e5f);}}}return _0x4c3259['templates'];};};Realtime[_0x2203('0x39')][_0x2203('0x45')]=function(){var _0x35b2e9=this;return function(_0x2600a9){if(_0x2600a9){freeIsNotKey(_0x2600a9,_0x35b2e9['zendeskAccounts'],'id');for(var _0x4c1a29=0x0,_0x21b8ab={};_0x4c1a29<_0x2600a9['length'];_0x4c1a29+=0x1){_0x21b8ab=_0x2600a9[_0x4c1a29];if(_['isUndefined'](_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']])){_0x35b2e9[_0x2203('0x46')][_0x21b8ab['id']]=new ZendeskAccount(_0x21b8ab);}else{_0x35b2e9[_0x2203('0x40')](_0x35b2e9['zendeskAccounts'][_0x21b8ab['id']],_0x21b8ab);}}}return _0x35b2e9['zendeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x47')]=function(){var _0x12d7fa=this;return function(_0x21d2d7){if(_0x21d2d7){freeIsNotKey(_0x21d2d7,_0x12d7fa[_0x2203('0x48')],'id');for(var _0x21fd78=0x0,_0x4a7f4e={};_0x21fd78<_0x21d2d7[_0x2203('0x3a')];_0x21fd78+=0x1){_0x4a7f4e=_0x21d2d7[_0x21fd78];if(_['isUndefined'](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']])){_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']]=new SalesforceAccount(_0x4a7f4e);}else{_0x12d7fa[_0x2203('0x40')](_0x12d7fa[_0x2203('0x48')][_0x4a7f4e['id']],_0x4a7f4e);}}}return _0x12d7fa['salesforceAccounts'];};};Realtime['prototype'][_0x2203('0x49')]=function(){var _0x1f772d=this;return function(_0x126aad){if(_0x126aad){freeIsNotKey(_0x126aad,_0x1f772d[_0x2203('0x4a')],'id');for(var _0x559370=0x0,_0x4de47a={};_0x559370<_0x126aad['length'];_0x559370+=0x1){_0x4de47a=_0x126aad[_0x559370];if(_[_0x2203('0x3c')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']])){_0x1f772d['freshdeskAccounts'][_0x4de47a['id']]=new FreshdeskAccount(_0x4de47a);}else{_0x1f772d[_0x2203('0x40')](_0x1f772d[_0x2203('0x4a')][_0x4de47a['id']],_0x4de47a);}}}return _0x1f772d['freshdeskAccounts'];};};Realtime[_0x2203('0x39')][_0x2203('0x4b')]=function(){var _0x172c6a=this;return function(_0x6a1877){if(_0x6a1877){freeIsNotKey(_0x6a1877,_0x172c6a['zohoAccounts'],'id');for(var _0x120db1=0x0,_0x5268d6={};_0x120db1<_0x6a1877[_0x2203('0x3a')];_0x120db1+=0x1){_0x5268d6=_0x6a1877[_0x120db1];if(_[_0x2203('0x3c')](_0x172c6a['zohoAccounts'][_0x5268d6['id']])){_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']]=new ZohoAccount(_0x5268d6);}else{_0x172c6a[_0x2203('0x40')](_0x172c6a[_0x2203('0x4c')][_0x5268d6['id']],_0x5268d6);}}}return _0x172c6a[_0x2203('0x4c')];};};Realtime[_0x2203('0x39')][_0x2203('0x4d')]=function(){var _0x569d4a=this;return function(_0x562a3d){if(_0x562a3d){freeIsNotKey(_0x562a3d,_0x569d4a[_0x2203('0x19')],'id');for(var _0x524356=0x0,_0x56e881={};_0x524356<_0x562a3d[_0x2203('0x3a')];_0x524356+=0x1){_0x56e881=_0x562a3d[_0x524356];if(_[_0x2203('0x3c')](_0x569d4a[_0x2203('0x19')][_0x56e881['id']])){_0x569d4a['deskAccounts'][_0x56e881['id']]=new DeskAccount(_0x56e881);}else{_0x569d4a[_0x2203('0x40')](_0x569d4a['deskAccounts'][_0x56e881['id']],_0x56e881);}}}return _0x569d4a['deskAccounts'];};};Realtime[_0x2203('0x39')]['initSugarcrmAccounts']=function(){var _0x54ec71=this;return function(_0x5efc59){if(_0x5efc59){freeIsNotKey(_0x5efc59,_0x54ec71[_0x2203('0x18')],'id');for(var _0x31256b=0x0,_0x367122={};_0x31256b<_0x5efc59[_0x2203('0x3a')];_0x31256b+=0x1){_0x367122=_0x5efc59[_0x31256b];if(_[_0x2203('0x3c')](_0x54ec71[_0x2203('0x18')][_0x367122['id']])){_0x54ec71[_0x2203('0x18')][_0x367122['id']]=new SugarcrmAccount(_0x367122);}else{_0x54ec71[_0x2203('0x40')](_0x54ec71[_0x2203('0x18')][_0x367122['id']],_0x367122);}}}return _0x54ec71[_0x2203('0x18')];};};Realtime[_0x2203('0x39')][_0x2203('0x4e')]=function(){var _0x58ff57=this;return function(_0x585bde){if(_0x585bde){freeIsNotKey(_0x585bde,_0x58ff57[_0x2203('0x1a')],'id');for(var _0x43d8c0=0x0,_0x2511bd={};_0x43d8c0<_0x585bde[_0x2203('0x3a')];_0x43d8c0+=0x1){_0x2511bd=_0x585bde[_0x43d8c0];if(_[_0x2203('0x3c')](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']])){_0x58ff57['vtigerAccounts'][_0x2511bd['id']]=new VtigerAccount(_0x2511bd);}else{_0x58ff57['mergeFromDatabase'](_0x58ff57[_0x2203('0x1a')][_0x2511bd['id']],_0x2511bd);}}}return _0x58ff57[_0x2203('0x1a')];};};Realtime[_0x2203('0x39')][_0x2203('0x4f')]=function(){var _0xcab922=this;return function(_0x7b0b9c){if(_0x7b0b9c){freeIsNotKey(_0x7b0b9c,_0xcab922[_0x2203('0x1b')],'id');for(var _0x191b67=0x0,_0x2c6bcc={};_0x191b67<_0x7b0b9c[_0x2203('0x3a')];_0x191b67+=0x1){_0x2c6bcc=_0x7b0b9c[_0x191b67];if(_[_0x2203('0x3c')](_0xcab922['servicenowAccounts'][_0x2c6bcc['id']])){_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']]=new ServicenowAccount(_0x2c6bcc);}else{_0xcab922[_0x2203('0x40')](_0xcab922[_0x2203('0x1b')][_0x2c6bcc['id']],_0x2c6bcc);}}}return _0xcab922[_0x2203('0x1b')];};};Realtime[_0x2203('0x39')][_0x2203('0x50')]=function(){var _0x52c159=this;return function(_0x544756){if(_0x544756){freeIsNotKey(_0x544756,_0x52c159[_0x2203('0x1c')],'id');for(var _0x35b7b9=0x0,_0x49e795={};_0x35b7b9<_0x544756[_0x2203('0x3a')];_0x35b7b9+=0x1){_0x49e795=_0x544756[_0x35b7b9];if(_[_0x2203('0x3c')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']])){_0x52c159[_0x2203('0x1c')][_0x49e795['id']]=new Dynamics365Account(_0x49e795);}else{_0x52c159[_0x2203('0x40')](_0x52c159[_0x2203('0x1c')][_0x49e795['id']],_0x49e795);}}}return _0x52c159[_0x2203('0x1c')];};};Realtime[_0x2203('0x39')][_0x2203('0x51')]=function(){var _0x519120=this;return function(_0x468619){if(_0x468619){freeIsNotKey(_0x468619,_0x519120[_0x2203('0x1d')],'id');for(var _0x465898=0x0,_0x4e461e={};_0x465898<_0x468619[_0x2203('0x3a')];_0x465898+=0x1){_0x4e461e=_0x468619[_0x465898];if(_[_0x2203('0x3c')](_0x519120[_0x2203('0x1d')][_0x4e461e['id']])){_0x519120[_0x2203('0x1d')][_0x4e461e['id']]=new FreshsalesAccount(_0x4e461e);}else{_0x519120[_0x2203('0x40')](_0x519120['freshsalesAccounts'][_0x4e461e['id']],_0x4e461e);}}}return _0x519120[_0x2203('0x1d')];};};Realtime[_0x2203('0x39')][_0x2203('0x52')]=function(){var _0x4dde80=this;return function(_0x5507b6){for(var _0x5d9ae2=0x0;_0x5d9ae2<_0x5507b6['length'];_0x5d9ae2+=0x1){_['merge'](_0x4dde80[_0x2203('0x13')][_0x5507b6[_0x5d9ae2][_0x2203('0x22')]],_0x5507b6[_0x5d9ae2]);}return _0x4dde80[_0x2203('0x13')];};};Realtime[_0x2203('0x39')][_0x2203('0x53')]=function(){var _0x169845=this;return function(_0x3f7926){clearVoiceQueues(_0x169845[_0x2203('0x13')]);if(_0x3f7926){_0x3f7926=_['groupBy'](_0x3f7926,'uniqueid');for(var _0xb54e51 in _0x3f7926){if(_0x3f7926[_0x2203('0x23')](_0xb54e51)){for(var _0xafcc82=0x0;_0xafcc82<_0x3f7926[_0xb54e51][_0x2203('0x3a')];_0xafcc82+=0x1){var _0x1bbd2d=_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x54')];if(_0x169845[_0x2203('0x13')][_0x1bbd2d]){if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x55')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2c')]+=0x1;}if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x56')]){_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x2d')]+=0x1;}_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x57')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;if(_0xafcc82===_0x3f7926[_0xb54e51]['length']-0x1){_0x169845[_0x2203('0x13')][_0x1bbd2d]['sumDuration']+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')]||_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerabandonAt']||_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5c')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x59')]),_0x2203('0x5a'))||0x0;_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x25')]+=0x1;if(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5d')]){_0x169845[_0x2203('0x13')][_0x1bbd2d]['answered']+=0x1;_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x29')]+=moment(_0x3f7926[_0xb54e51][_0xafcc82][_0x2203('0x5b')])[_0x2203('0x58')](moment(_0x3f7926[_0xb54e51][_0xafcc82]['queuecallerleaveAt']),'seconds')||0x0;}}else{_0x169845['voiceQueues'][_0x1bbd2d][_0x2203('0x28')]+=_0x169845[_0x2203('0x13')][_0x1bbd2d][_0x2203('0x27')]||0x0;}}}}}}return _0x169845[_0x2203('0x13')];};};Realtime['prototype'][_0x2203('0x5e')]=function(){var _0x47a2c7=this;return function(_0x48bd5){clearVoiceCallReports(_0x47a2c7[_0x2203('0x15')]);if(_0x48bd5){for(var _0xe3bee5=0x0;_0xe3bee5<_0x48bd5[_0x2203('0x3a')];_0xe3bee5+=0x1){_0x47a2c7[_0x2203('0x15')]['total']+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x28')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')];if(_0x48bd5[_0xe3bee5]['disposition']===_0x2203('0x60')){_0x47a2c7[_0x2203('0x15')][_0x2203('0x26')]+=0x1;_0x47a2c7[_0x2203('0x15')][_0x2203('0x27')]+=_0x48bd5[_0xe3bee5][_0x2203('0x5f')]-_0x48bd5[_0xe3bee5][_0x2203('0x61')]||0x0;_0x47a2c7[_0x2203('0x15')][_0x2203('0x29')]+=_0x48bd5[_0xe3bee5][_0x2203('0x61')];}}}return _0x47a2c7[_0x2203('0x15')];};};Realtime['prototype'][_0x2203('0x62')]=function(){var _0x7f71b8=this;return function(_0x21b755){if(_0x21b755){freeIsNotKey(_0x21b755,_0x7f71b8[_0x2203('0x14')],_0x2203('0x22'));for(var _0x52c35e=0x0,_0x23f7b1={};_0x52c35e<_0x21b755[_0x2203('0x3a')];_0x52c35e+=0x1){_0x23f7b1=_0x21b755[_0x52c35e];if(_[_0x2203('0x3c')](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]])){_0x7f71b8[_0x2203('0x14')][_0x23f7b1['name']]=new Campaign(_0x23f7b1);}else{_0x7f71b8['mergeFromDatabase'](_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]],_0x23f7b1);_0x7f71b8[_0x2203('0x14')][_0x23f7b1[_0x2203('0x22')]][_0x2203('0x63')]=_0x23f7b1['SquareProject']?_0x23f7b1[_0x2203('0x64')][_0x2203('0x22')]:undefined;}}}return _0x7f71b8['campaigns'];};};Realtime['prototype']['initVoiceExtensions']=function(){var _0x4fc51a=this;return function(_0x5e07d7){if(_0x5e07d7){freeIsNotKey(_0x5e07d7,_0x4fc51a[_0x2203('0x65')],'id');for(var _0x6319a3=0x0,_0x437095={};_0x6319a3<_0x5e07d7['length'];_0x6319a3+=0x1){_0x437095=_0x5e07d7[_0x6319a3];if(_['isUndefined'](_0x4fc51a['voiceExtensions'][_0x437095['id']])){_0x4fc51a[_0x2203('0x65')][_0x437095['id']]=new VoiceExtension(_0x437095);}else{_0x4fc51a[_0x2203('0x40')](_0x4fc51a[_0x2203('0x65')][_0x437095['id']],_0x437095);}}}return _0x4fc51a[_0x2203('0x65')];};};Realtime[_0x2203('0x39')][_0x2203('0x66')]=function(){var _0x3d1797=this;return function(_0x52f25e){clearCampaigns(_0x3d1797[_0x2203('0x14')]);for(var _0x74843=0x0;_0x74843<_0x52f25e[_0x2203('0x3a')];_0x74843+=0x1){_[_0x2203('0x67')](_0x3d1797[_0x2203('0x14')][_0x52f25e[_0x74843][_0x2203('0x22')]],_0x52f25e[_0x74843]);}return _0x3d1797[_0x2203('0x14')];};};Realtime['prototype'][_0x2203('0x68')]=function(){var _0x51a2fe=this;return function(_0x5d0176){if(_0x5d0176){freeIsNotKey(_0x5d0176,_0x51a2fe[_0x2203('0x1e')],'id');for(var _0x5cd030=0x0,_0xb9588e={};_0x5cd030<_0x5d0176[_0x2203('0x3a')];_0x5cd030+=0x1){_0xb9588e=_0x5d0176[_0x5cd030];if(_['isUndefined'](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']])){_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']]=new FaxAccount(_0xb9588e);}else{_0x51a2fe[_0x2203('0x40')](_0x51a2fe[_0x2203('0x1e')][_0xb9588e['id']],_0xb9588e);}}}return _0x51a2fe[_0x2203('0x1e')];};};Realtime[_0x2203('0x39')]['initVoiceQueues']=function(){var _0x215638=this;return function(_0x3541b3){if(_0x3541b3){freeIsNotKey(_0x3541b3,_0x215638['voiceQueues'],'name');for(var _0x377176=0x0,_0x3fe71b={};_0x377176<_0x3541b3[_0x2203('0x3a')];_0x377176+=0x1){_0x3fe71b=_0x3541b3[_0x377176];if(_[_0x2203('0x3c')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]])){_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]]=new VoiceQueue(_0x3fe71b);}else{_0x215638[_0x2203('0x40')](_0x215638[_0x2203('0x13')][_0x3fe71b[_0x2203('0x22')]],_0x3fe71b);}}}return _0x215638[_0x2203('0x13')];};};module[_0x2203('0x69')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 47e55c2..a76b665 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f83=['mergeDBDataToRealtime','hasOwnProperty'];(function(_0x310e30,_0x42446c){var _0x489897=function(_0x510d2c){while(--_0x510d2c){_0x310e30['push'](_0x310e30['shift']());}};_0x489897(++_0x42446c);}(_0x0f83,0x1c7));var _0x30f8=function(_0x5e3a45,_0x45f0c5){_0x5e3a45=_0x5e3a45-0x0;var _0x13419f=_0x0f83[_0x5e3a45];return _0x13419f;};'use strict';function mergeDBDataToRealtime(_0x51a21e,_0x48728e){var _0x52daaa=Object['assign']({},_0x51a21e);for(var _0x5d9c8d in _0x48728e){if(_0x52daaa[_0x30f8('0x0')](_0x5d9c8d)){_0x52daaa[_0x5d9c8d]=_0x48728e[_0x5d9c8d];}}return _0x52daaa;}exports[_0x30f8('0x1')]=mergeDBDataToRealtime; \ No newline at end of file +var _0x9d80=['hasOwnProperty'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9d80,0x159));var _0x09d8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9d80[_0x14add3];return _0x4a174f;};'use strict';function mergeDBDataToRealtime(_0x16911b,_0xd7bb2c){var _0x5a3348=Object['assign']({},_0x16911b);for(var _0x25e4b3 in _0xd7bb2c){if(_0x5a3348[_0x09d8('0x0')](_0x25e4b3)){_0x5a3348[_0x25e4b3]=_0xd7bb2c[_0x25e4b3];}}return _0x5a3348;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index d7185b7..17beae0 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 _0x6e2f=['monitorFilename','filename','createdAt','exten','connectedlinenum','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','Local','substring','mobile','phone','indexOf','lastIndexOf','transfererlinkedid','exports','lodash','moment','../../../config/environment','../ami','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/voiceQueueReport','./voiceCallReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','blindTransfer','bind','attendedtransfer','attendedTransfer','findAgent','find','name','isNil','accountcode','interface','format','length','assigned','lastAssignedTo','SIP/%s','queuecallercomplete','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','split','calleridnum','outbound','internal','destination','type','dialer','lastapplication','lastdata','queue','context','from-voip-provider','callerid','from-sip','xcally-motion-preview','originatecalleridnum','destinationchannel','channel','calleridpreview','ANSWERED','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitors'];(function(_0x3ae327,_0x3b6807){var _0x5cfb23=function(_0x3f15e3){while(--_0x3f15e3){_0x3ae327['push'](_0x3ae327['shift']());}};_0x5cfb23(++_0x3b6807);}(_0x6e2f,0x135));var _0xf6e2=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x6e2f[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0xf6e2('0x0'));var moment=require(_0xf6e2('0x1'));var util=require('util');var config=require(_0xf6e2('0x2'));var ami=require(_0xf6e2('0x3'));var RpcVoiceAgentReport=require(_0xf6e2('0x4'));var RpcVoiceCallReport=require(_0xf6e2('0x5'));var RpcVoiceDialReport=require(_0xf6e2('0x6'));var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xf6e2('0x7'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require('../rpc/voiceTransferReport');var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require(_0xf6e2('0x8'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require('./voiceDialReport');var UserReport=require(_0xf6e2('0x9'));function Report(_0x52bb06){this[_0xf6e2('0xa')]=_0x52bb06;this[_0xf6e2('0xb')]=_0x52bb06['agents'];this[_0xf6e2('0xc')]=_0x52bb06[_0xf6e2('0xc')];}Report[_0xf6e2('0xd')][_0xf6e2('0xe')]=function(_0x154e8d){var _0x290f3a=new VoiceQueueReport(this[_0xf6e2('0xa')]);var _0x5cf5da=new VoiceAgentReport(this[_0xf6e2('0xa')]);var _0x51de6d=new VoiceDialReport(this['realtime']);var _0x2cd04f=new VoiceCallReport(this['realtime']);var _0x4854b3=new UserReport(this[_0xf6e2('0xa')]);if(config[_0xf6e2('0xf')]&&config['xdr'][_0xf6e2('0x10')]){ami['on'](_0xf6e2('0x11'),this[_0xf6e2('0x12')]['bind'](this));ami['on'](_0xf6e2('0x13'),this[_0xf6e2('0x14')]['bind'](this));ami['on'](_0xf6e2('0x15'),this[_0xf6e2('0x16')]['bind'](this));ami['on'](_0xf6e2('0x17'),this[_0xf6e2('0x18')]['bind'](this));ami['on'](_0xf6e2('0x19'),this[_0xf6e2('0x1a')][_0xf6e2('0x1b')](this));ami['on'](_0xf6e2('0x1c'),this[_0xf6e2('0x1d')][_0xf6e2('0x1b')](this));}};Report[_0xf6e2('0xd')][_0xf6e2('0x1e')]=function(_0x269610){var _0x530751;_0x530751=_[_0xf6e2('0x1f')](this['agents'],function(_0x25ca6c){return _0x25ca6c['accountcode']==_0x269610||_0x25ca6c[_0xf6e2('0x20')]==_0x269610;});if(_[_0xf6e2('0x21')](_0x530751)){var _0x4d8e85=_['find'](this[_0xf6e2('0xc')],function(_0x441da8){return _0x441da8[_0xf6e2('0x22')]==_0x269610||_0x441da8[_0xf6e2('0x20')]==_0x269610;});if(_0x4d8e85){_0x530751=_[_0xf6e2('0x1f')](this[_0xf6e2('0xb')],function(_0x118bf1){return _0x118bf1[_0xf6e2('0x23')]==util[_0xf6e2('0x24')]('SIP/%s',_0x4d8e85[_0xf6e2('0x20')]);});}}return _0x530751;};Report[_0xf6e2('0xd')]['voiceQueueReport']=function(_0x1694db){for(var _0x7cc9b9=0x0;_0x7cc9b9<_0x1694db[_0xf6e2('0x25')];_0x7cc9b9+=0x1){var _0x5190f1=this[_0xf6e2('0x1e')](_0x1694db[_0x7cc9b9]['connectedlinenum']);if(_0x5190f1){_0x1694db[_0x7cc9b9][_0xf6e2('0x22')]=_0x5190f1['accountcode'];_0x1694db[_0x7cc9b9][_0xf6e2('0x26')]=!![];_0x1694db[_0x7cc9b9][_0xf6e2('0x27')]=_0x5190f1['name'];_0x1694db[_0x7cc9b9][_0xf6e2('0x23')]=_[_0xf6e2('0x21')](_0x5190f1[_0xf6e2('0x23')])?util[_0xf6e2('0x24')](_0xf6e2('0x28'),_0x5190f1[_0xf6e2('0x20')]):_0x5190f1[_0xf6e2('0x23')];if(_0x1694db[_0x7cc9b9][_0xf6e2('0x29')]){_0x1694db[_0x7cc9b9]['queuecallercompleteAt']=moment()[_0xf6e2('0x24')](_0xf6e2('0x2a'));}if(_0x1694db[_0x7cc9b9][_0xf6e2('0x2b')]){_0x1694db[_0x7cc9b9][_0xf6e2('0x2c')]=moment()['format'](_0xf6e2('0x2a'));}RpcMemberReport[_0xf6e2('0x12')](_0x1694db[_0x7cc9b9]);}RpcVoiceQueueReport[_0xf6e2('0x2d')](_0x1694db[_0x7cc9b9]);}};function extractCalleridNumber(_0x2fa989){var _0x4e6de8=_0x2fa989[_0xf6e2('0x2e')](/<(.*?)>/);return _0x4e6de8?_0x4e6de8[0x1]:_0x2fa989;}Report[_0xf6e2('0xd')][_0xf6e2('0x2f')]=function(_0x37f021){for(var _0x4abdcc=0x0;_0x4abdcc','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','UserId','membername','create','monitor','monitors','monitorFilename','createdAt','xcally-motion-preview','connectedlinename','xcally-motion-dialer','isArray','startsWith','Local'];(function(_0x11648a,_0x56d67e){var _0x5f467d=function(_0x3e2d3a){while(--_0x3e2d3a){_0x11648a['push'](_0x11648a['shift']());}};_0x5f467d(++_0x56d67e);}(_0x9447,0x1eb));var _0x7944=function(_0x537982,_0x52f379){_0x537982=_0x537982-0x0;var _0x17e8fd=_0x9447[_0x537982];return _0x17e8fd;};'use strict';var _=require('lodash');var moment=require(_0x7944('0x0'));var util=require('util');var config=require(_0x7944('0x1'));var ami=require(_0x7944('0x2'));var RpcVoiceAgentReport=require(_0x7944('0x3'));var RpcVoiceCallReport=require(_0x7944('0x4'));var RpcVoiceDialReport=require(_0x7944('0x5'));var RpcMemberReport=require(_0x7944('0x6'));var RpcVoiceQueueReport=require(_0x7944('0x7'));var RpcVoiceRecording=require(_0x7944('0x8'));var RpcVoiceTransferReport=require(_0x7944('0x9'));var VoiceQueueReport=require(_0x7944('0xa'));var VoiceCallReport=require(_0x7944('0xb'));var VoiceAgentReport=require('./voiceAgentReport');var VoiceDialReport=require(_0x7944('0xc'));var UserReport=require(_0x7944('0xd'));function Report(_0x17dddb){this['realtime']=_0x17dddb;this['agents']=_0x17dddb[_0x7944('0xe')];this[_0x7944('0xf')]=_0x17dddb[_0x7944('0xf')];}Report['prototype'][_0x7944('0x10')]=function(_0x193c88){var _0x5e337e=new VoiceQueueReport(this[_0x7944('0x11')]);var _0xd467e=new VoiceAgentReport(this[_0x7944('0x11')]);var _0x39d3e3=new VoiceDialReport(this[_0x7944('0x11')]);var _0x490cb4=new VoiceCallReport(this[_0x7944('0x11')]);var _0x508f24=new UserReport(this[_0x7944('0x11')]);if(config[_0x7944('0x12')]&&config[_0x7944('0x12')][_0x7944('0x13')]){ami['on'](_0x7944('0x14'),this['voiceQueueReport'][_0x7944('0x15')](this));ami['on'](_0x7944('0x16'),this[_0x7944('0x17')][_0x7944('0x15')](this));ami['on'](_0x7944('0x18'),this[_0x7944('0x19')][_0x7944('0x15')](this));ami['on'](_0x7944('0x1a'),this[_0x7944('0x1b')]['bind'](this));ami['on'](_0x7944('0x1c'),this['blindTransfer'][_0x7944('0x15')](this));ami['on'](_0x7944('0x1d'),this[_0x7944('0x1e')][_0x7944('0x15')](this));}};Report['prototype']['findAgent']=function(_0x4de83c){var _0x7a1909;_0x7a1909=_[_0x7944('0x1f')](this[_0x7944('0xe')],function(_0x4bd3ba){return _0x4bd3ba[_0x7944('0x20')]==_0x4de83c||_0x4bd3ba[_0x7944('0x21')]==_0x4de83c;});if(_['isNil'](_0x7a1909)){var _0x5ab14c=_[_0x7944('0x1f')](this[_0x7944('0xf')],function(_0x321b50){return _0x321b50[_0x7944('0x20')]==_0x4de83c||_0x321b50[_0x7944('0x21')]==_0x4de83c;});if(_0x5ab14c){_0x7a1909=_['find'](this[_0x7944('0xe')],function(_0x54203d){return _0x54203d[_0x7944('0x22')]==util[_0x7944('0x23')]('SIP/%s',_0x5ab14c[_0x7944('0x21')]);});}}return _0x7a1909;};Report[_0x7944('0x24')][_0x7944('0x25')]=function(_0xdc3d50){for(var _0x5765d9=0x0;_0x5765d9<_0xdc3d50[_0x7944('0x26')];_0x5765d9+=0x1){var _0x14ddde=this[_0x7944('0x27')](_0xdc3d50[_0x5765d9][_0x7944('0x28')]);if(_0x14ddde){_0xdc3d50[_0x5765d9][_0x7944('0x20')]=_0x14ddde['accountcode'];_0xdc3d50[_0x5765d9][_0x7944('0x29')]=!![];_0xdc3d50[_0x5765d9][_0x7944('0x2a')]=_0x14ddde[_0x7944('0x21')];_0xdc3d50[_0x5765d9][_0x7944('0x22')]=_[_0x7944('0x2b')](_0x14ddde[_0x7944('0x22')])?util[_0x7944('0x23')](_0x7944('0x2c'),_0x14ddde[_0x7944('0x21')]):_0x14ddde['interface'];if(_0xdc3d50[_0x5765d9]['queuecallercomplete']){_0xdc3d50[_0x5765d9]['queuecallercompleteAt']=moment()[_0x7944('0x23')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0xdc3d50[_0x5765d9][_0x7944('0x2d')]){_0xdc3d50[_0x5765d9][_0x7944('0x2e')]=moment()[_0x7944('0x23')](_0x7944('0x2f'));}RpcMemberReport[_0x7944('0x25')](_0xdc3d50[_0x5765d9]);}RpcVoiceQueueReport['create'](_0xdc3d50[_0x5765d9]);}};function extractCalleridNumber(_0x550c4c){var _0x4228ab=_0x550c4c[_0x7944('0x30')](/<(.*?)>/);return _0x4228ab?_0x4228ab[0x1]:_0x550c4c;}Report[_0x7944('0x24')][_0x7944('0x31')]=function(_0x172bca){for(var _0x51bb34=0x0;_0x51bb34{delete this[_0xeaba('0x9')][_0x5e3f1f];},_0x601841);}};module[_0xeaba('0x98')]=VoiceAgentReport; \ No newline at end of file +var _0x0a62=['[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','util','ioredis','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceChannels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','agentconnect','syncAgentConnect','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isNotNull','info','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','destuniqueid','debug','[%s][voiceAgentReport][agentcalled]\x20event:','isUndefined','interface','YYYY-MM-DD\x20HH:mm:ss','mandatoryDisposition','type','inbound','voice','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','inspect','calleridnum','queue','format','user:called','error','[%s][voiceAgentReport][agentcalled]','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','destconnectedlinenum','accountcode','exten','custom:agentconnect','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]\x20Else\x20path\x20should\x20never\x20be\x20taken','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','agentringnoanswerAt','rejected','reason','name','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','user:%s','user:agentringnoanswer','custom:agentringnoanswer','assign','[%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','transfer','agent','talktime','acw','acwtime','acwTimeout','agentacw','omit','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','destaccountcode','user:agentcomplete','[%s][voiceAgentReport][agentcomplete]','addVariable','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberpenalty','isNil','includes','[%s][voiceAgentReport][hangup]\x20destuniqueid:%s','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','values','custom:voiceAgentReport','deleteChannelAfterTimeout','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','[%s][voiceAgentReport][musiconholdstart]'];(function(_0x30abff,_0x5f2c5f){var _0x4c571e=function(_0x43de9a){while(--_0x43de9a){_0x30abff['push'](_0x30abff['shift']());}};_0x4c571e(++_0x5f2c5f);}(_0x0a62,0xa4));var _0x20a6=function(_0x311e78,_0xbcf8ca){_0x311e78=_0x311e78-0x0;var _0x44fef6=_0x0a62[_0x311e78];return _0x44fef6;};'use strict';var _=require(_0x20a6('0x0'));var moment=require('moment');var util=require(_0x20a6('0x1'));var Redis=require(_0x20a6('0x2'));var config=require(_0x20a6('0x3'));var logger=require(_0x20a6('0x4'))(_0x20a6('0x5'));var ami=require(_0x20a6('0x6'));config[_0x20a6('0x7')]=_[_0x20a6('0x8')](config[_0x20a6('0x7')],{'host':_0x20a6('0x9'),'port':0x18eb});var io=require(_0x20a6('0xa'))(new Redis(config[_0x20a6('0x7')]));function VoiceAgentReport(_0x5d623c){this[_0x20a6('0xb')]={};this[_0x20a6('0xc')]=_0x5d623c['channels'];this[_0x20a6('0xd')]=_0x5d623c[_0x20a6('0xd')];this[_0x20a6('0xe')]=_0x5d623c[_0x20a6('0xe')];this[_0x20a6('0xf')]={};ami['on'](_0x20a6('0x10'),this[_0x20a6('0x11')]['bind'](this));ami['on'](_0x20a6('0x12'),this[_0x20a6('0x13')][_0x20a6('0x14')](this));ami['on'](_0x20a6('0x15'),this[_0x20a6('0x16')][_0x20a6('0x14')](this));ami['on'](_0x20a6('0x17'),this[_0x20a6('0x18')][_0x20a6('0x14')](this));ami['on'](_0x20a6('0x19'),this[_0x20a6('0x1a')][_0x20a6('0x14')](this));ami['on'](_0x20a6('0x1b'),this[_0x20a6('0x1c')]['bind'](this));ami['on']('hangup',this[_0x20a6('0x1d')][_0x20a6('0x14')](this));ami['on'](_0x20a6('0x1e'),this['syncMusicOnHoldStart'][_0x20a6('0x14')](this));ami['on'](_0x20a6('0x1f'),this[_0x20a6('0x20')][_0x20a6('0x14')](this));ami['on']('attendedtransfer',this[_0x20a6('0x21')][_0x20a6('0x14')](this));ami['on'](_0x20a6('0x22'),this[_0x20a6('0x23')]['bind'](this));}VoiceAgentReport[_0x20a6('0x24')][_0x20a6('0x25')]=function(_0x394b24,_0x6db677,_0x163146){io['to'](_0x394b24)['emit'](_0x6db677,_0x163146);};VoiceAgentReport[_0x20a6('0x24')]['isNotNull']=function(_0x131846){return _0x131846!==null&&!_['isUndefined'](_0x131846);};VoiceAgentReport['prototype'][_0x20a6('0x11')]=function(_0x1ae7d2){try{if(this[_0x20a6('0x26')](_0x1ae7d2)){logger[_0x20a6('0x27')](_0x20a6('0x28'),_0x1ae7d2[_0x20a6('0x29')],_0x1ae7d2[_0x20a6('0x2a')],_0x1ae7d2[_0x20a6('0x2b')]);logger[_0x20a6('0x2c')](_0x20a6('0x2d'),_0x1ae7d2[_0x20a6('0x29')],util['inspect'](_0x1ae7d2,{'showHidden':![],'depth':null}));if(_[_0x20a6('0x2e')](this['channels'][_0x1ae7d2[_0x20a6('0x29')]])){this['channels'][_0x1ae7d2[_0x20a6('0x29')]]={};}var _0x110768=this[_0x20a6('0xe')][_0x1ae7d2[_0x20a6('0x2f')]];var _0x415477=this[_0x20a6('0xb')][_0x1ae7d2[_0x20a6('0x29')]][_0x1ae7d2[_0x20a6('0x2b')]];var _0x2650e9=this[_0x20a6('0xd')][_0x1ae7d2['queue']];var _0x9bb72b=this[_0x20a6('0xf')][_0x1ae7d2[_0x20a6('0x29')]];if(_['isUndefined'](_0x415477)){_0x415477={'agentcalledAt':moment()['format'](_0x20a6('0x30')),'lastevent':'called','mandatoryDisposition':_0x2650e9&&_0x2650e9['mandatoryDisposition']?_0x2650e9[_0x20a6('0x31')]:![],'type':_0x2650e9&&_0x2650e9[_0x20a6('0x32')]?_0x2650e9[_0x20a6('0x32')]:_0x20a6('0x33'),'variables':_0x9bb72b,'motionChannel':_0x20a6('0x34')};}Object['assign'](_0x415477,_['omit'](_0x1ae7d2,['event','privilege']));this[_0x20a6('0xb')][_0x1ae7d2['uniqueid']][_0x1ae7d2[_0x20a6('0x2b')]]=_0x415477;logger[_0x20a6('0x2c')](_0x20a6('0x35'),_0x1ae7d2['uniqueid'],util[_0x20a6('0x36')](_0x415477,{'showHidden':![],'depth':null}));ami[_0x20a6('0x25')]('custom:agentcalled',_0x415477);var _0x2c9e8f={'id':_0x110768['id'],'calleridnum':_0x415477[_0x20a6('0x37')],'queue':_0x415477[_0x20a6('0x38')],'variables':_0x415477[_0x20a6('0xf')],'uniqueid':_0x1ae7d2[_0x20a6('0x29')]};logger[_0x20a6('0x2c')]('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:',_0x1ae7d2[_0x20a6('0x29')],util[_0x20a6('0x36')](_0x2c9e8f,{'showHidden':![],'depth':null}));this[_0x20a6('0x25')](util[_0x20a6('0x39')]('user:%s',_0x1ae7d2[_0x20a6('0x2a')]),_0x20a6('0x3a'),_0x2c9e8f);}}catch(_0x8aa68b){logger[_0x20a6('0x3b')](_0x20a6('0x3c'),_0x1ae7d2[_0x20a6('0x29')],util['inspect'](_0x8aa68b,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20a6('0x24')][_0x20a6('0x13')]=function(_0x2bc980){try{if(this['isNotNull'](_0x2bc980)){if(this[_0x20a6('0xb')][_0x2bc980[_0x20a6('0x29')]]){for(var _0x3ba55e in this[_0x20a6('0xb')][_0x2bc980[_0x20a6('0x29')]]){if(this['channels'][_0x2bc980[_0x20a6('0x29')]][_0x20a6('0x3d')](_0x3ba55e)){if(_0x2bc980[_0x20a6('0x2b')]===_0x3ba55e){logger[_0x20a6('0x27')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x2bc980[_0x20a6('0x29')],_0x2bc980[_0x20a6('0x2a')],_0x2bc980[_0x20a6('0x2b')]);this['channels'][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e][_0x20a6('0x3e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e][_0x20a6('0x3f')]=_0x2bc980[_0x20a6('0x3f')];this[_0x20a6('0xb')][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e][_0x20a6('0x40')]=_0x2bc980[_0x20a6('0x40')];this['channels'][_0x2bc980['uniqueid']][_0x3ba55e][_0x20a6('0x41')]=_0x2bc980['destchannelstate'];this['channels'][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e][_0x20a6('0x42')]=_0x2bc980[_0x20a6('0x42')];this[_0x20a6('0xb')][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e][_0x20a6('0x43')]=_0x2bc980[_0x20a6('0x43')];this[_0x20a6('0xb')][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e][_0x20a6('0x44')]=_0x20a6('0x45');_['merge'](this['agents'][_0x2bc980['interface']],_['pick'](_0x2bc980,[_0x20a6('0x38'),_0x20a6('0x46')]));var _0x57be77=this['agents'][_0x2bc980[_0x20a6('0x2f')]];var _0xf4421d={'id':_0x57be77['id'],'name':_0x57be77['name'],'agentconnected':!![],'destaccountcode':_0x57be77[_0x20a6('0x47')],'destconnectedlinenum':this[_0x20a6('0xb')][_0x2bc980['uniqueid']][_0x2bc980[_0x20a6('0x2b')]][_0x20a6('0x48')],'queue':this[_0x20a6('0xb')][_0x2bc980['uniqueid']][_0x2bc980[_0x20a6('0x2b')]][_0x20a6('0x38')],'uniqueid':this[_0x20a6('0xb')][_0x2bc980[_0x20a6('0x29')]][_0x2bc980[_0x20a6('0x2b')]][_0x20a6('0x29')]};ami[_0x20a6('0x25')](_0x20a6('0x49'),this['channels'][_0x2bc980[_0x20a6('0x29')]][_0x2bc980[_0x20a6('0x2b')]]);this[_0x20a6('0x25')](util[_0x20a6('0x39')]('user:%s',_0x2bc980[_0x20a6('0x2a')]),'user:agentconnect',_0xf4421d);}else if(!this[_0x20a6('0xb')][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e][_0x20a6('0x15')]&&!this[_0x20a6('0xb')][_0x2bc980['uniqueid']][_0x3ba55e]['agentcomplete']){logger[_0x20a6('0x27')](_0x20a6('0x4a'),_0x2bc980[_0x20a6('0x29')],this[_0x20a6('0xb')][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e][_0x20a6('0x2a')],_0x3ba55e);this[_0x20a6('0xb')][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e][_0x20a6('0x15')]=!![];this[_0x20a6('0xb')][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e]['agentringnoanswerAt']=moment()[_0x20a6('0x39')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x20a6('0xb')][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e][_0x20a6('0x4b')]=_0x2bc980[_0x20a6('0x2b')];this['channels'][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e][_0x20a6('0x4c')]=_0x2bc980[_0x20a6('0x2a')];this[_0x20a6('0xb')][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e][_0x20a6('0x44')]=_0x20a6('0x4d');this[_0x20a6('0xb')][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e]['reason']=_0x20a6('0x4d');logger[_0x20a6('0x2c')](_0x20a6('0x4e'),_0x2bc980[_0x20a6('0x29')],util[_0x20a6('0x36')](this[_0x20a6('0xb')][_0x2bc980['uniqueid']][_0x3ba55e],{'showHidden':![],'depth':null}));ami[_0x20a6('0x25')](_0x20a6('0x4f'),this[_0x20a6('0xb')][_0x2bc980[_0x20a6('0x29')]][_0x3ba55e]);}else{logger['debug'](_0x20a6('0x50'),_0x2bc980[_0x20a6('0x29')]);}}}}}}catch(_0x287ade){logger[_0x20a6('0x3b')](_0x20a6('0x51'),_0x2bc980[_0x20a6('0x29')],util[_0x20a6('0x36')](_0x287ade,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20a6('0x24')]['syncAgentRingNoAnswer']=function(_0x15498f){try{if(this[_0x20a6('0x26')](_0x15498f)){logger[_0x20a6('0x2c')](_0x20a6('0x52'),_0x15498f[_0x20a6('0x29')],util['inspect'](_0x15498f,{'showHidden':![],'depth':null}));if(this[_0x20a6('0xb')][_0x15498f['uniqueid']]&&this[_0x20a6('0xb')][_0x15498f[_0x20a6('0x29')]][_0x15498f[_0x20a6('0x2b')]]){logger[_0x20a6('0x27')]('[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected',_0x15498f[_0x20a6('0x29')],_0x15498f[_0x20a6('0x2a')],_0x15498f[_0x20a6('0x2b')]);var _0x47fce3=this[_0x20a6('0xe')][_0x15498f[_0x20a6('0x2f')]];var _0x1c54e7=this[_0x20a6('0xb')][_0x15498f[_0x20a6('0x29')]][_0x15498f['destuniqueid']];_0x1c54e7['agentringnoanswer']=!![];_0x1c54e7[_0x20a6('0x53')]=moment()[_0x20a6('0x39')]('YYYY-MM-DD\x20HH:mm:ss');_0x1c54e7[_0x20a6('0x44')]=_0x20a6('0x54');_0x1c54e7[_0x20a6('0x55')]=_0x20a6('0x54');var _0x49f121={'id':_0x47fce3['id'],'name':_0x47fce3[_0x20a6('0x56')],'queue':_0x1c54e7[_0x20a6('0x38')],'uniqueid':_0x1c54e7[_0x20a6('0x29')]};logger[_0x20a6('0x2c')](_0x20a6('0x57'),_0x15498f['uniqueid'],util['inspect'](_0x49f121,{'showHidden':![],'depth':null}));this[_0x20a6('0x25')](util[_0x20a6('0x39')](_0x20a6('0x58'),_0x47fce3[_0x20a6('0x56')]),_0x20a6('0x59'),_0x49f121);ami[_0x20a6('0x25')](_0x20a6('0x5a'),_0x1c54e7);this['channels'][_0x15498f[_0x20a6('0x29')]][_0x15498f[_0x20a6('0x2b')]]=Object[_0x20a6('0x5b')]({},_0x1c54e7);}}}catch(_0x1154aa){logger[_0x20a6('0x3b')]('[%s][voiceAgentReport][agentringnoanswer]',_0x15498f['uniqueid'],util[_0x20a6('0x36')](_0x1154aa,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x20a6('0x18')]=function(_0x3cb54b){try{if(this['isNotNull'](_0x3cb54b)){logger[_0x20a6('0x2c')]('[%s][voiceAgentReport][queuecallerabandon]\x20event:',_0x3cb54b[_0x20a6('0x29')],util[_0x20a6('0x36')](_0x3cb54b,{'showHidden':![],'depth':null}));if(this[_0x20a6('0xb')][_0x3cb54b[_0x20a6('0x29')]]){for(var _0x2e8745 in this[_0x20a6('0xb')][_0x3cb54b[_0x20a6('0x29')]]){if(this[_0x20a6('0xb')][_0x3cb54b[_0x20a6('0x29')]][_0x20a6('0x3d')](_0x2e8745)&&!this[_0x20a6('0xb')][_0x3cb54b[_0x20a6('0x29')]][_0x2e8745][_0x20a6('0x15')]&&!this['channels'][_0x3cb54b['uniqueid']][_0x2e8745]['agentcomplete']){logger[_0x20a6('0x27')](_0x20a6('0x5c'),_0x3cb54b[_0x20a6('0x29')],this[_0x20a6('0xb')][_0x3cb54b[_0x20a6('0x29')]][_0x2e8745][_0x20a6('0x2a')],_0x2e8745);this['channels'][_0x3cb54b[_0x20a6('0x29')]][_0x2e8745][_0x20a6('0x15')]=!![];this[_0x20a6('0xb')][_0x3cb54b['uniqueid']][_0x2e8745]['agentringnoanswerAt']=moment()[_0x20a6('0x39')](_0x20a6('0x30'));this[_0x20a6('0xb')][_0x3cb54b[_0x20a6('0x29')]][_0x2e8745][_0x20a6('0x44')]=_0x20a6('0x5d');this[_0x20a6('0xb')][_0x3cb54b[_0x20a6('0x29')]][_0x2e8745][_0x20a6('0x55')]=_0x20a6('0x5d');logger[_0x20a6('0x2c')](_0x20a6('0x5e'),_0x3cb54b[_0x20a6('0x29')],util[_0x20a6('0x36')](this[_0x20a6('0xb')][_0x3cb54b[_0x20a6('0x29')]][_0x2e8745],{'showHidden':![],'depth':null}));ami[_0x20a6('0x25')](_0x20a6('0x5f'),this['channels'][_0x3cb54b[_0x20a6('0x29')]][_0x2e8745]);}}}}}catch(_0x3d1943){logger[_0x20a6('0x3b')]('[%s][voiceAgentReport][queuecallerabandon]',_0x3cb54b[_0x20a6('0x29')],util[_0x20a6('0x36')](_0x3d1943,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x20a6('0x1a')]=function(_0x55b181){try{if(this['isNotNull'](_0x55b181)){logger[_0x20a6('0x2c')](_0x20a6('0x60'),_0x55b181[_0x20a6('0x29')],util['inspect'](_0x55b181,{'showHidden':![],'depth':null}));if(this['channels'][_0x55b181[_0x20a6('0x29')]]){for(var _0xc616f in this[_0x20a6('0xb')][_0x55b181[_0x20a6('0x29')]]){if(this[_0x20a6('0xb')][_0x55b181['uniqueid']][_0x20a6('0x3d')](_0xc616f)){if(this['channels'][_0x55b181[_0x20a6('0x29')]][_0xc616f]['agentconnectAt']&&!this[_0x20a6('0xb')][_0x55b181['uniqueid']][_0xc616f][_0x20a6('0x19')]){logger[_0x20a6('0x27')](_0x20a6('0x61'),_0x55b181[_0x20a6('0x29')],this[_0x20a6('0xb')][_0x55b181[_0x20a6('0x29')]][_0xc616f]['membername'],_0xc616f);this['channels'][_0x55b181[_0x20a6('0x29')]][_0xc616f][_0x20a6('0x19')]=!![];this[_0x20a6('0xb')][_0x55b181[_0x20a6('0x29')]][_0xc616f][_0x20a6('0x62')]=moment()[_0x20a6('0x39')](_0x20a6('0x30'));this[_0x20a6('0xb')][_0x55b181[_0x20a6('0x29')]][_0xc616f][_0x20a6('0x44')]='complete';this[_0x20a6('0xb')][_0x55b181[_0x20a6('0x29')]][_0xc616f][_0x20a6('0x55')]=_0x55b181['reason']==_0x20a6('0x63')?_0x20a6('0x64'):_0x55b181[_0x20a6('0x55')];this[_0x20a6('0xb')][_0x55b181[_0x20a6('0x29')]][_0xc616f][_0x20a6('0x65')]=_0x55b181[_0x20a6('0x65')];if(this[_0x20a6('0xd')][_0x55b181[_0x20a6('0x38')]]&&this[_0x20a6('0xd')][_0x55b181[_0x20a6('0x38')]][_0x20a6('0x66')]){this[_0x20a6('0xb')][_0x55b181[_0x20a6('0x29')]][_0xc616f][_0x20a6('0x67')]=this['voiceQueues'][_0x55b181[_0x20a6('0x38')]][_0x20a6('0x68')];this['channels'][_0x55b181[_0x20a6('0x29')]][_0xc616f][_0x20a6('0x69')]=!![];}this[_0x20a6('0xe')][_0x55b181['interface']]=_[_0x20a6('0x6a')](this[_0x20a6('0xe')][_0x55b181[_0x20a6('0x2f')]],[_0x20a6('0x38'),_0x20a6('0x46')]);logger[_0x20a6('0x2c')](_0x20a6('0x6b'),_0x55b181[_0x20a6('0x29')],util[_0x20a6('0x36')](this['channels'][_0x55b181[_0x20a6('0x29')]][_0xc616f],{'showHidden':![],'depth':null}));ami[_0x20a6('0x25')](_0x20a6('0x6c'),this['channels'][_0x55b181['uniqueid']][_0xc616f]);logger[_0x20a6('0x2c')](_0x20a6('0x6d'),_0x55b181[_0x20a6('0x29')],util[_0x20a6('0x36')]({'id':this['agents'][_0x55b181[_0x20a6('0x2f')]]['id'],'destaccountcode':_0x55b181[_0x20a6('0x6e')]},{'showHidden':![],'depth':null}));this[_0x20a6('0x25')](util[_0x20a6('0x39')]('user:%s',_0x55b181['membername']),_0x20a6('0x6f'),{'id':this[_0x20a6('0xe')][_0x55b181[_0x20a6('0x2f')]]['id'],'destaccountcode':Number(_0x55b181['destaccountcode'])});}}}}}}catch(_0x4a1b1f){logger['error'](_0x20a6('0x70'),_0x55b181[_0x20a6('0x29')],util['inspect'](_0x4a1b1f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20a6('0x24')][_0x20a6('0x1c')]=function(_0x447724){try{if(this[_0x20a6('0x26')](_0x447724)){logger['debug']('[%s][voiceAgentReport][varset]\x20event:',_0x447724[_0x20a6('0x29')],util[_0x20a6('0x36')](_0x447724,{'showHidden':![],'depth':null}));this[_0x20a6('0x71')](_0x447724['uniqueid'],_['keys'](_0x447724[_0x20a6('0x72')])[0x0],_0x447724[_0x20a6('0x73')]);if(this['channels'][_0x447724['uniqueid']]){for(var _0x356f73 in this['channels'][_0x447724[_0x20a6('0x29')]]){if(this['channels'][_0x447724['uniqueid']][_0x20a6('0x3d')](_0x356f73)){logger['info'](_0x20a6('0x74'),_0x447724[_0x20a6('0x29')],_0x356f73,_[_0x20a6('0x75')](_0x447724[_0x20a6('0x72')])[0x0],_0x447724['value']);if(_[_0x20a6('0x2e')](this[_0x20a6('0xb')][_0x447724['uniqueid']][_0x356f73][_0x20a6('0xf')])){this[_0x20a6('0xb')][_0x447724[_0x20a6('0x29')]][_0x356f73][_0x20a6('0xf')]={};}this[_0x20a6('0xb')][_0x447724[_0x20a6('0x29')]][_0x356f73]['variables']=this[_0x20a6('0xf')][_0x447724[_0x20a6('0x29')]];}}}}}catch(_0x26c5b5){logger[_0x20a6('0x3b')](_0x20a6('0x76'),_0x447724[_0x20a6('0x29')],util[_0x20a6('0x36')](_0x26c5b5,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20a6('0x24')][_0x20a6('0x71')]=function(_0x5f1e8a,_0x301e3a,_0x1bd250){var _0xabd9a3=[_0x20a6('0x77'),_0x20a6('0x78'),'rtpaudioqosjitter',_0x20a6('0x79'),_0x20a6('0x7a'),_0x20a6('0x7b'),_0x20a6('0x7c'),_0x20a6('0x7d'),'sipcallid','sipuri',_0x20a6('0x7e'),_0x20a6('0x7f'),_0x20a6('0x80'),'memberdynamic',_0x20a6('0x81'),'memberlastcall',_0x20a6('0x2a'),_0x20a6('0x82'),'memberrealtime'];if(!_[_0x20a6('0x83')](_0x301e3a)&&!_[_0x20a6('0x84')](_0xabd9a3,_0x301e3a)){if(_[_0x20a6('0x2e')](this[_0x20a6('0xf')][_0x5f1e8a])){this['variables'][_0x5f1e8a]={};}this['variables'][_0x5f1e8a][_0x301e3a]=_0x1bd250;}};VoiceAgentReport['prototype'][_0x20a6('0x1d')]=function(_0x44d836){try{if(this['isNotNull'](_0x44d836)){logger['debug']('[%s][voiceAgentReport][hangup]\x20event:',_0x44d836[_0x20a6('0x29')],util['inspect'](_0x44d836,{'showHidden':![],'depth':null}));if(this[_0x20a6('0xb')][_0x44d836[_0x20a6('0x29')]]){for(var _0x7df92c in this['channels'][_0x44d836['uniqueid']]){if(this[_0x20a6('0xb')][_0x44d836[_0x20a6('0x29')]]['hasOwnProperty'](_0x7df92c)){if(this['channels'][_0x44d836[_0x20a6('0x29')]][_0x7df92c][_0x20a6('0x55')]==_0x20a6('0x63')&&this[_0x20a6('0xb')][_0x44d836[_0x20a6('0x29')]][_0x7df92c]['agentcomplete']){logger['info'](_0x20a6('0x85'),_0x44d836[_0x20a6('0x29')],_0x7df92c);this[_0x20a6('0xb')][_0x44d836['uniqueid']][_0x7df92c][_0x20a6('0x62')]=moment()[_0x20a6('0x39')](_0x20a6('0x30'));}}}logger[_0x20a6('0x2c')](_0x20a6('0x86'),_0x44d836[_0x20a6('0x29')],util[_0x20a6('0x36')](_[_0x20a6('0x87')](this[_0x20a6('0xb')][_0x44d836[_0x20a6('0x29')]]),{'showHidden':![],'depth':null}));ami[_0x20a6('0x25')](_0x20a6('0x88'),_[_0x20a6('0x87')](this[_0x20a6('0xb')][_0x44d836[_0x20a6('0x29')]]));this[_0x20a6('0x89')](_0x44d836[_0x20a6('0x29')]);}if(this['variables'][_0x44d836[_0x20a6('0x29')]]){delete this[_0x20a6('0xf')][_0x44d836[_0x20a6('0x29')]];}}}catch(_0x541fc8){logger[_0x20a6('0x3b')]('[%s][voiceAgentReport][hangup]',_0x44d836[_0x20a6('0x29')],util[_0x20a6('0x36')](_0x541fc8,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20a6('0x24')][_0x20a6('0x21')]=function(_0x2249e3){try{if(this[_0x20a6('0x26')](_0x2249e3)){logger['debug'](_0x20a6('0x8a'),_0x2249e3[_0x20a6('0x29')],util['inspect'](_0x2249e3,{'showHidden':![],'depth':null}));if(this[_0x20a6('0xb')][_0x2249e3[_0x20a6('0x8b')]]){for(var _0x2f92b4 in this['channels'][_0x2249e3[_0x20a6('0x8b')]]){if(this[_0x20a6('0xb')][_0x2249e3['transfereeuniqueid']][_0x20a6('0x3d')](_0x2f92b4)){if(_0x2249e3[_0x20a6('0x8c')]===_0x2f92b4){logger[_0x20a6('0x27')](_0x20a6('0x8d'),_0x2249e3['uniqueid'],this[_0x20a6('0xb')][_0x2249e3[_0x20a6('0x8b')]][_0x2f92b4]['membername'],_0x2f92b4);var _0x172472=moment();this[_0x20a6('0xb')][_0x2249e3[_0x20a6('0x8b')]][_0x2f92b4][_0x20a6('0x19')]=!![];this['channels'][_0x2249e3[_0x20a6('0x8b')]][_0x2f92b4][_0x20a6('0x62')]=moment()['format'](_0x20a6('0x30'));this[_0x20a6('0xb')][_0x2249e3[_0x20a6('0x8b')]][_0x2f92b4]['lastevent']=_0x20a6('0x8e');this[_0x20a6('0xb')][_0x2249e3[_0x20a6('0x8b')]][_0x2f92b4][_0x20a6('0x55')]='transfer';this[_0x20a6('0xb')][_0x2249e3[_0x20a6('0x8b')]][_0x2f92b4][_0x20a6('0x65')]=_0x172472[_0x20a6('0x8f')](this['channels'][_0x2249e3[_0x20a6('0x8b')]][_0x2f92b4][_0x20a6('0x3e')],_0x20a6('0x90'));}}}}if(this['channels'][_0x2249e3[_0x20a6('0x91')]]){var _0x46f5b3=this[_0x20a6('0xb')][_0x2249e3['secondtransfereruniqueid']];this['channels'][_0x2249e3[_0x20a6('0x91')]]=this[_0x20a6('0xb')][_0x2249e3['transfereeuniqueid']];this['channels'][_0x2249e3[_0x20a6('0x8b')]]=_0x46f5b3;}}}catch(_0x48777c){logger['error']('[%s][voiceAgentReport][attendedtransfer]',_0x2249e3['uniqueid'],util[_0x20a6('0x36')](_0x48777c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20a6('0x24')][_0x20a6('0x23')]=function(_0x4a240f){try{if(this[_0x20a6('0x26')](_0x4a240f)){logger[_0x20a6('0x2c')]('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x4a240f[_0x20a6('0x29')],util[_0x20a6('0x36')](_0x4a240f,{'showHidden':![],'depth':null}));if(this['channels'][_0x4a240f[_0x20a6('0x8b')]]){for(var _0x63316 in this[_0x20a6('0xb')][_0x4a240f[_0x20a6('0x8b')]]){if(this['channels'][_0x4a240f[_0x20a6('0x8b')]][_0x20a6('0x3d')](_0x63316)){if(_0x4a240f['transfereruniqueid']===_0x63316){logger[_0x20a6('0x27')]('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x4a240f['uniqueid'],this[_0x20a6('0xb')][_0x4a240f[_0x20a6('0x8b')]][_0x63316][_0x20a6('0x2a')],_0x63316);var _0x52dfd3=moment();this[_0x20a6('0xb')][_0x4a240f[_0x20a6('0x8b')]][_0x63316]['agentcomplete']=!![];this[_0x20a6('0xb')][_0x4a240f['transfereeuniqueid']][_0x63316][_0x20a6('0x62')]=_0x52dfd3;this[_0x20a6('0xb')][_0x4a240f[_0x20a6('0x8b')]][_0x63316]['lastevent']=_0x20a6('0x8e');this[_0x20a6('0xb')][_0x4a240f[_0x20a6('0x8b')]][_0x63316]['reason']=_0x20a6('0x63');this[_0x20a6('0xb')][_0x4a240f['transfereeuniqueid']][_0x63316][_0x20a6('0x65')]=_0x52dfd3[_0x20a6('0x8f')](this[_0x20a6('0xb')][_0x4a240f[_0x20a6('0x8b')]][_0x63316]['agentconnectAt'],_0x20a6('0x90'));}}}}}}catch(_0x12c511){logger['error'](_0x20a6('0x92'),_0x4a240f[_0x20a6('0x29')],util[_0x20a6('0x36')](_0x12c511,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20a6('0x24')][_0x20a6('0x93')]=function(_0xbd98bc){var _0x465d03='';try{if(this[_0x20a6('0x26')](_0xbd98bc)){logger[_0x20a6('0x2c')](_0x20a6('0x94'),_0xbd98bc[_0x20a6('0x29')],util[_0x20a6('0x36')](_0xbd98bc,{'showHidden':![],'depth':null}));if(_0xbd98bc['channel']){_0x465d03=_0xbd98bc[_0x20a6('0x95')][_0x20a6('0x96')](0x0,_0xbd98bc['channel'][_0x20a6('0x97')]('-'));if(this[_0x20a6('0xe')][_0x465d03]){logger[_0x20a6('0x27')](_0x20a6('0x98'),_0xbd98bc[_0x20a6('0x29')],_0x465d03);this[_0x20a6('0xe')][_0x465d03]['onhold']=!![];}}}}catch(_0x1df599){logger[_0x20a6('0x3b')](_0x20a6('0x99'),_0xbd98bc[_0x20a6('0x29')],util[_0x20a6('0x36')](_0x1df599,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20a6('0x24')][_0x20a6('0x20')]=function(_0x4aec4f){var _0x2114ed='';try{if(this[_0x20a6('0x26')](_0x4aec4f)){logger[_0x20a6('0x2c')](_0x20a6('0x9a'),_0x4aec4f[_0x20a6('0x29')],util[_0x20a6('0x36')](_0x4aec4f,{'showHidden':![],'depth':null}));if(_0x4aec4f[_0x20a6('0x95')]){_0x2114ed=_0x4aec4f['channel'][_0x20a6('0x96')](0x0,_0x4aec4f[_0x20a6('0x95')][_0x20a6('0x97')]('-'));if(this[_0x20a6('0xe')][_0x2114ed]){logger[_0x20a6('0x27')](_0x20a6('0x9b'),_0x4aec4f[_0x20a6('0x29')],_0x2114ed);this[_0x20a6('0xe')][_0x2114ed][_0x20a6('0x9c')]=![];}}}}catch(_0x32373f){logger['error'](_0x20a6('0x9d'),_0x4aec4f[_0x20a6('0x29')],util[_0x20a6('0x36')](_0x32373f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x20a6('0x24')][_0x20a6('0x89')]=function(_0x1a9a8c,_0x540391=0x2710){if(this['channels'][_0x1a9a8c]){setTimeout(()=>{delete this[_0x20a6('0xb')][_0x1a9a8c];},_0x540391);}};module[_0x20a6('0x9e')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 367016c..de530ca 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 _0xae21=['routeid','origtransfererlinkedid','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','syncMusicOnHoldStop','mohstarttime','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','lodash','moment','util','ioredis','../../../config/environment','../../../config/logger','../ami','../rpc/setting','set','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','socket.io-emitter','redis','channels','coreshowchannel','bind','newexten','varset','syncVarSet','syncHangup','syncNewCallerId','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','musiconholdstop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','error','[voiceCallReport][coreshowchannels]','inspect','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','linkedid','merge','pick','keys','context','agents','channel','split','xcally-motion-preview','destconnectedlinenum','connectedlinenum','user:agentconnect','accountcode','[%s][voiceCallReport][newcallerid]','syncNewChannel','[%s][voiceCallReport][newchannel]\x20event:','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','exten','starttime','format','toNumber','channelstate','undefined','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','[%s][voiceCallReport][newchannel]','syncNewExten','[%s][voiceCallReport][newexten]\x20event:','blindTransfers','application','toLowerCase','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','applicationdata','subtract','duration','seconds','disposition','includes','lastapplication','lastdata','cdr(','match','type','isNil','queue','[%s][voiceCallReport][newexten]','syncNewState','[%s][voiceCallReport][newstate]\x20event:','answertime','YYYY-MM-DD\x20HH:mm:ss','holdtime','diff','calleridname','destinationchannel','UserId','membername','name','answered','connectedlinename','from-sip','[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceCallReport][newstate]','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','.wav49','replace','.WAV','monitorFilename','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','xmd-callerid','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','[%s][voiceCallReport][hangup]\x20event:','deleteChannelAfterTimeout','[%s][voiceCallReport][hangup]\x20reason:%s','endtime','billableseconds','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','resolve','then','transferToInternal','stopRecordingOnTransfer','StopMixMonitor','catch','finally','webbar:stopmonitors','BlindTransfer','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfereeuniqueid','ATTENDED','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','transferType'];(function(_0x4acd4c,_0x55bd71){var _0x74edd6=function(_0x56bcb5){while(--_0x56bcb5){_0x4acd4c['push'](_0x4acd4c['shift']());}};_0x74edd6(++_0x55bd71);}(_0xae21,0x196));var _0x1ae2=function(_0x4ffc0f,_0x1dd900){_0x4ffc0f=_0x4ffc0f-0x0;var _0x1ea40d=_0xae21[_0x4ffc0f];return _0x1ea40d;};'use strict';var _=require(_0x1ae2('0x0'));var moment=require(_0x1ae2('0x1'));var util=require(_0x1ae2('0x2'));var path=require('path');var Redis=require(_0x1ae2('0x3'));var config=require(_0x1ae2('0x4'));var logger=require(_0x1ae2('0x5'))('ami');var ami=require(_0x1ae2('0x6'));var Channel=require('../model/channel');var RpcSetting=require(_0x1ae2('0x7'));var applications=[_0x1ae2('0x8'),'queue',_0x1ae2('0x9'),_0x1ae2('0xa'),_0x1ae2('0xb'),_0x1ae2('0xc')];var dispositions=[_0x1ae2('0xd'),_0x1ae2('0xe'),_0x1ae2('0xe'),_0x1ae2('0xd'),_0x1ae2('0xd'),_0x1ae2('0xd'),_0x1ae2('0xf'),_0x1ae2('0x10'),_0x1ae2('0xe'),_0x1ae2('0xe'),_0x1ae2('0xe')];config['redis']=_[_0x1ae2('0x11')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1ae2('0x12'))(new Redis(config[_0x1ae2('0x13')]));function VoiceCallReport(_0x3d654d){this['channels']=_0x3d654d[_0x1ae2('0x14')];this['agents']=_0x3d654d['agents'];this['blindTransfers']={};ami['on'](_0x1ae2('0x15'),this['syncNewExten'][_0x1ae2('0x16')](this));ami['on'](_0x1ae2('0x17'),this['syncNewExten']['bind'](this));ami['on']('newchannel',this['syncNewChannel'][_0x1ae2('0x16')](this));ami['on']('newstate',this['syncNewState'][_0x1ae2('0x16')](this));ami['on'](_0x1ae2('0x18'),this[_0x1ae2('0x19')][_0x1ae2('0x16')](this));ami['on']('hangup',this[_0x1ae2('0x1a')][_0x1ae2('0x16')](this));ami['on']('newcallerid',this[_0x1ae2('0x1b')][_0x1ae2('0x16')](this));ami['on']('attendedtransfer',this[_0x1ae2('0x1c')][_0x1ae2('0x16')](this));ami['on'](_0x1ae2('0x1d'),this[_0x1ae2('0x1e')][_0x1ae2('0x16')](this));ami['on'](_0x1ae2('0x1f'),this['syncMusicOnHoldStart'][_0x1ae2('0x16')](this));ami['on'](_0x1ae2('0x20'),this['syncMusicOnHoldStop']['bind'](this));try{logger[_0x1ae2('0x21')](_0x1ae2('0x22'));ami[_0x1ae2('0x23')]();}catch(_0x5cd453){logger[_0x1ae2('0x24')](_0x1ae2('0x25'),util[_0x1ae2('0x26')](_0x5cd453,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x1ae2('0x27')][_0x1ae2('0x28')]=function(_0xdfbab7){return _0xdfbab7!==null&&!_[_0x1ae2('0x29')](_0xdfbab7);};VoiceCallReport[_0x1ae2('0x27')][_0x1ae2('0x2a')]=function(_0x27374a,_0x3c8aed,_0x4ad414){io['to'](_0x27374a)[_0x1ae2('0x2a')](_0x3c8aed,_0x4ad414);};VoiceCallReport[_0x1ae2('0x27')]['syncNewCallerId']=function(_0xef4d1){try{if(this[_0x1ae2('0x28')](_0xef4d1)){logger['info'](_0x1ae2('0x2b'),_0xef4d1[_0x1ae2('0x2c')],_0xef4d1['calleridname'],_0xef4d1[_0x1ae2('0x2d')]);logger[_0x1ae2('0x2e')]('[%s][voiceCallReport][newcallerid]\x20event:',_0xef4d1[_0x1ae2('0x2c')],util['inspect'](_0xef4d1,{'showHidden':![],'depth':null}));if(_0xef4d1[_0x1ae2('0x2c')]===_0xef4d1[_0x1ae2('0x2f')]){if(!_[_0x1ae2('0x29')](this[_0x1ae2('0x14')][_0xef4d1[_0x1ae2('0x2c')]])){_[_0x1ae2('0x30')](this[_0x1ae2('0x14')][_0xef4d1['uniqueid']],_[_0x1ae2('0x31')](_0xef4d1,_[_0x1ae2('0x32')](this['channels'][_0xef4d1[_0x1ae2('0x2c')]])));}}if(_0xef4d1[_0x1ae2('0x33')]==='from-sip'){var _0x3b6853=this[_0x1ae2('0x34')][_0xef4d1[_0x1ae2('0x35')][_0x1ae2('0x36')]('-')[0x0]];if(_0x3b6853){if(_0xef4d1['exten']==_0x1ae2('0x37')){_0x3b6853[_0x1ae2('0x38')]=_0xef4d1[_0x1ae2('0x39')];this[_0x1ae2('0x2a')](util['format']('user:%s',_0x3b6853['name']),_0x1ae2('0x3a'),{'id':_0x3b6853['id'],'destaccountcode':_0x3b6853[_0x1ae2('0x3b')],'destconnectedlinenum':_0xef4d1[_0x1ae2('0x39')]});}}}}}catch(_0x3787b6){logger['error'](_0x1ae2('0x3c'),_0xef4d1[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0x3787b6,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1ae2('0x27')][_0x1ae2('0x3d')]=function(_0x2ed081){try{if(this[_0x1ae2('0x28')](_0x2ed081)){logger[_0x1ae2('0x2e')](_0x1ae2('0x3e'),_0x2ed081[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0x2ed081,{'showHidden':![],'depth':null}));if(this[_0x1ae2('0x14')][_0x2ed081[_0x1ae2('0x2c')]]){return;}if(_0x2ed081['channel']===_0x1ae2('0x3f')){return;}if(_0x2ed081[_0x1ae2('0x2c')]!==_0x2ed081[_0x1ae2('0x2f')]&&!this['blindTransfers'][_0x2ed081['linkedid']]){return;}logger[_0x1ae2('0x21')](_0x1ae2('0x40'),_0x2ed081[_0x1ae2('0x2c')],_0x2ed081[_0x1ae2('0x33')],_0x2ed081[_0x1ae2('0x41')]);this[_0x1ae2('0x14')][_0x2ed081[_0x1ae2('0x2c')]]=new Channel();this[_0x1ae2('0x14')][_0x2ed081['uniqueid']][_0x1ae2('0x42')]=moment()[_0x1ae2('0x43')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x1ae2('0x14')][_0x2ed081['uniqueid']]['disposition']=dispositions[_[_0x1ae2('0x44')](_0x2ed081[_0x1ae2('0x45')])];_[_0x1ae2('0x30')](this[_0x1ae2('0x14')][_0x2ed081['uniqueid']],_[_0x1ae2('0x31')](_0x2ed081,_[_0x1ae2('0x32')](this[_0x1ae2('0x14')][_0x2ed081[_0x1ae2('0x2c')]])));if(_0x2ed081[_0x1ae2('0x33')]==='from-sip'){var _0x10bb78=this[_0x1ae2('0x34')][_0x2ed081[_0x1ae2('0x35')]['split']('-')[0x0]];if(_0x10bb78&&typeof _0x10bb78[_0x1ae2('0x38')]===_0x1ae2('0x46')){_0x10bb78['destconnectedlinenum']=_0x2ed081[_0x1ae2('0x41')];logger['debug'](_0x1ae2('0x47'),_0x2ed081[_0x1ae2('0x2c')],util['inspect']({'id':_0x10bb78['id'],'destaccountcode':_0x10bb78['accountcode'],'destconnectedlinenum':_0x2ed081[_0x1ae2('0x41')]},{'showHidden':![],'depth':null}));this['emit'](util[_0x1ae2('0x43')]('user:%s',_0x10bb78['name']),'user:agentconnect',{'id':_0x10bb78['id'],'destaccountcode':_0x10bb78[_0x1ae2('0x3b')],'destconnectedlinenum':_0x2ed081[_0x1ae2('0x41')]});}}}}catch(_0x546b4f){logger[_0x1ae2('0x24')](_0x1ae2('0x48'),_0x2ed081[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0x546b4f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1ae2('0x27')][_0x1ae2('0x49')]=function(_0x4dbf6c){try{if(this[_0x1ae2('0x28')](_0x4dbf6c)){logger[_0x1ae2('0x2e')](_0x1ae2('0x4a'),_0x4dbf6c[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0x4dbf6c,{'showHidden':![],'depth':null}));if(_0x4dbf6c['channel']===_0x1ae2('0x3f')||_0x4dbf6c['exten']==='h')return;if(_0x4dbf6c['uniqueid']===_0x4dbf6c[_0x1ae2('0x2f')]||this[_0x1ae2('0x4b')][_0x4dbf6c['linkedid']]){_0x4dbf6c[_0x1ae2('0x4c')]=_0x4dbf6c[_0x1ae2('0x4c')]?_0x4dbf6c['application'][_0x1ae2('0x4d')]():undefined;_0x4dbf6c['applicationdata']=_0x4dbf6c[_0x1ae2('0x4e')]||_0x4dbf6c['applicationdata'];if(_0x4dbf6c[_0x1ae2('0x4e')]&&_0x4dbf6c[_0x1ae2('0x4c')]!=='queue'){_0x4dbf6c['applicationdata']=_0x4dbf6c['applicationdata'][_0x1ae2('0x4d')]();}logger[_0x1ae2('0x21')](_0x1ae2('0x4f'),_0x4dbf6c[_0x1ae2('0x2c')],_0x4dbf6c['application'],_0x4dbf6c[_0x1ae2('0x50')]);if(_['isUndefined'](this['channels'][_0x4dbf6c['uniqueid']])){this['channels'][_0x4dbf6c[_0x1ae2('0x2c')]]=new Channel();this['channels'][_0x4dbf6c[_0x1ae2('0x2c')]][_0x1ae2('0x42')]=_0x4dbf6c['duration']?moment()[_0x1ae2('0x51')](moment[_0x1ae2('0x52')](_0x4dbf6c[_0x1ae2('0x52')])[_0x1ae2('0x53')](),_0x1ae2('0x53'))[_0x1ae2('0x43')]('YYYY-MM-DD\x20HH:mm:ss'):moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x1ae2('0x14')][_0x4dbf6c[_0x1ae2('0x2c')]][_0x1ae2('0x54')]='NO\x20ANSWER';}_[_0x1ae2('0x30')](this['channels'][_0x4dbf6c['uniqueid']],_[_0x1ae2('0x31')](_0x4dbf6c,_[_0x1ae2('0x32')](this[_0x1ae2('0x14')][_0x4dbf6c['uniqueid']])));if(_[_0x1ae2('0x55')](applications,_0x4dbf6c['application'])){this[_0x1ae2('0x14')][_0x4dbf6c['uniqueid']][_0x1ae2('0x56')]=_0x4dbf6c[_0x1ae2('0x4c')];this['channels'][_0x4dbf6c[_0x1ae2('0x2c')]][_0x1ae2('0x57')]=_0x4dbf6c[_0x1ae2('0x50')];if(_0x4dbf6c['application']===_0x1ae2('0x8')&&_['startsWith'](_0x4dbf6c[_0x1ae2('0x50')][_0x1ae2('0x4d')](),_0x1ae2('0x58'))){var _0x401820=_0x4dbf6c[_0x1ae2('0x50')]['split']('=');var _0x3d338d=_0x401820[0x0][_0x1ae2('0x4d')]()[_0x1ae2('0x59')](/cdr\((.*)\)/);if(_0x3d338d){if(_0x3d338d[0x1]===_0x1ae2('0x5a')&&!_[_0x1ae2('0x5b')](this[_0x1ae2('0x14')][_0x4dbf6c['uniqueid']][_0x3d338d[0x1]]))return;this[_0x1ae2('0x14')][_0x4dbf6c[_0x1ae2('0x2c')]][_0x3d338d[0x1]]=_0x401820[0x1];}}else if(_0x4dbf6c[_0x1ae2('0x4c')]==='queue'){this['channels'][_0x4dbf6c[_0x1ae2('0x2c')]][_0x1ae2('0x5c')]=_0x4dbf6c[_0x1ae2('0x50')]['split'](',')[0x0];}}}}}catch(_0x18045b){logger[_0x1ae2('0x24')](_0x1ae2('0x5d'),_0x4dbf6c[_0x1ae2('0x2c')],util['inspect'](_0x18045b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1ae2('0x27')][_0x1ae2('0x5e')]=function(_0x22a4fa){try{if(this[_0x1ae2('0x28')](_0x22a4fa)){logger[_0x1ae2('0x21')]('[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s',_0x22a4fa[_0x1ae2('0x2c')],_0x22a4fa['linkedid'],_0x22a4fa['calleridname'],_0x22a4fa[_0x1ae2('0x2d')]);logger['debug'](_0x1ae2('0x5f'),_0x22a4fa[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0x22a4fa,{'showHidden':![],'depth':null}));if(_0x22a4fa[_0x1ae2('0x45')]!=='6')return;var _0x10407b=this[_0x1ae2('0x34')][_0x22a4fa[_0x1ae2('0x35')]['split']('-')[0x0]];if(_0x22a4fa[_0x1ae2('0x2c')]!==_0x22a4fa[_0x1ae2('0x2f')]){var _0xe1e991=moment();if(this[_0x1ae2('0x14')][_0x22a4fa['linkedid']]){if(!this[_0x1ae2('0x14')][_0x22a4fa['linkedid']]['answered']){this[_0x1ae2('0x14')][_0x22a4fa['linkedid']]['answered']=!![];this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2f')]][_0x1ae2('0x60')]=_0xe1e991[_0x1ae2('0x43')](_0x1ae2('0x61'));if(this['channels'][_0x22a4fa[_0x1ae2('0x2f')]]['starttime']){this['channels'][_0x22a4fa[_0x1ae2('0x2f')]][_0x1ae2('0x62')]=_0xe1e991[_0x1ae2('0x63')](this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2f')]]['starttime'],'seconds');}}this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2f')]][_0x1ae2('0x2f')]=_0x22a4fa[_0x1ae2('0x2c')];if(_0x22a4fa['calleridnum']!=='xcally-motion-preview'){this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2f')]]['connectedlinenum']=_0x22a4fa[_0x1ae2('0x2d')];}this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2f')]]['connectedlinename']=_0x22a4fa[_0x1ae2('0x64')];this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2f')]][_0x1ae2('0x65')]=_0x22a4fa['channel'];this['channels'][_0x22a4fa['linkedid']][_0x1ae2('0x54')]=dispositions[_['toNumber'](_0x22a4fa[_0x1ae2('0x45')])];if(_0x10407b){this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2f')]][_0x1ae2('0x66')]=_0x10407b['id'];this[_0x1ae2('0x14')][_0x22a4fa['linkedid']][_0x1ae2('0x67')]=_0x10407b[_0x1ae2('0x68')];}}if(this['channels'][_0x22a4fa[_0x1ae2('0x2c')]]){if(!this['channels'][_0x22a4fa['uniqueid']][_0x1ae2('0x69')]){this['channels'][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x69')]=!![];this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x60')]=_0xe1e991[_0x1ae2('0x43')](_0x1ae2('0x61'));if(this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x42')]){this['channels'][_0x22a4fa[_0x1ae2('0x2c')]]['holdtime']=_0xe1e991[_0x1ae2('0x63')](this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]]['starttime'],_0x1ae2('0x53'));}}if(_0x22a4fa['calleridnum']!==_0x1ae2('0x37')){this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x39')]=_0x22a4fa[_0x1ae2('0x2d')];}this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x6a')]=_0x22a4fa[_0x1ae2('0x64')];this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x65')]=_0x22a4fa['channel'];this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x54')]=dispositions[_[_0x1ae2('0x44')](_0x22a4fa[_0x1ae2('0x45')])];}}else{if(this[_0x1ae2('0x14')][_0x22a4fa['uniqueid']]){if(_0x10407b){this['channels'][_0x22a4fa[_0x1ae2('0x2c')]]['UserId']=_0x10407b['id'];this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]][_0x1ae2('0x67')]=_0x10407b[_0x1ae2('0x68')];}}}if(_0x22a4fa[_0x1ae2('0x33')]===_0x1ae2('0x6b')){if(_0x10407b){_0x10407b[_0x1ae2('0x38')]=_0x22a4fa[_0x1ae2('0x41')];var _0x2e19f0;if(this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]]){_0x2e19f0=this[_0x1ae2('0x14')][_0x22a4fa[_0x1ae2('0x2c')]]['queue'];}else if(this[_0x1ae2('0x14')][_0x22a4fa['linkedid']]){_0x2e19f0=this['channels'][_0x22a4fa[_0x1ae2('0x2f')]][_0x1ae2('0x5c')];}_0x10407b[_0x1ae2('0x5c')]=_0x2e19f0;var _0x348ea3={'id':_0x10407b['id'],'name':_0x10407b['name'],'agentconnected':!![],'destaccountcode':_0x10407b[_0x1ae2('0x3b')],'destconnectedlinenum':_0x22a4fa['exten'],'queue':_0x2e19f0||undefined,'uniqueid':_0x22a4fa[_0x1ae2('0x2f')]};logger['debug'](_0x1ae2('0x6c'),_0x22a4fa[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0x348ea3,{'showHidden':![],'depth':null}));this[_0x1ae2('0x2a')](util['format'](_0x1ae2('0x6d'),_0x10407b[_0x1ae2('0x68')]),_0x1ae2('0x3a'),_0x348ea3);}}}}catch(_0x393879){logger[_0x1ae2('0x24')](_0x1ae2('0x6e'),_0x22a4fa[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0x393879,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1ae2('0x27')][_0x1ae2('0x6f')]=function(_0x17ce3b,_0x4c4ecf){try{if(this[_0x1ae2('0x14')][_0x17ce3b]){logger['info'](_0x1ae2('0x70'),_0x17ce3b,_0x4c4ecf);this['channels'][_0x17ce3b][_0x1ae2('0x71')]=!![];if(_['endsWith'](_0x4c4ecf,_0x1ae2('0x72'))){_0x4c4ecf=_0x4c4ecf[_0x1ae2('0x73')](_0x1ae2('0x72'),_0x1ae2('0x74'));}this[_0x1ae2('0x14')][_0x17ce3b][_0x1ae2('0x75')]=_0x4c4ecf;var _0x4e9716=_['find'](this[_0x1ae2('0x14')][_0x17ce3b][_0x1ae2('0x76')],{'filename':_0x4c4ecf});if(_['isNil'](_0x4e9716)){this[_0x1ae2('0x14')][_0x17ce3b][_0x1ae2('0x76')]['push']({'filename':_0x4c4ecf,'createdAt':moment()[_0x1ae2('0x43')](_0x1ae2('0x61')),'mixmonitorid':'','status':_0x1ae2('0x77')});}}}catch(_0x121b69){logger[_0x1ae2('0x24')](_0x1ae2('0x78'),_0x17ce3b,util[_0x1ae2('0x26')](_0x121b69,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1ae2('0x27')]['syncVarSet']=function(_0x52f8f6){try{if(this[_0x1ae2('0x28')](_0x52f8f6)){logger[_0x1ae2('0x2e')]('[%s][voiceCallReport][varset]\x20event:',_0x52f8f6['uniqueid'],util['inspect'](_0x52f8f6,{'showHidden':![],'depth':null}));if(this['channels'][_0x52f8f6['uniqueid']]&&_0x52f8f6[_0x1ae2('0x35')]!=_0x1ae2('0x3f')){if(this['isNotNull'](_0x52f8f6[_0x1ae2('0x79')])){if(this[_0x1ae2('0x28')](_0x52f8f6['variable']['mixmonitor_filename'])){logger['info'](_0x1ae2('0x7a'),_0x52f8f6['uniqueid'],_0x52f8f6[_0x1ae2('0x7b')]);this[_0x1ae2('0x6f')](_0x52f8f6[_0x1ae2('0x2c')],_0x52f8f6[_0x1ae2('0x7b')]);}else if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')]['xmd-phone'])){logger[_0x1ae2('0x21')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0x52f8f6['uniqueid'],_0x52f8f6[_0x1ae2('0x7b')]);this[_0x1ae2('0x14')][_0x52f8f6['uniqueid']][_0x1ae2('0x2d')]=_0x52f8f6[_0x1ae2('0x7b')];}else if(this[_0x1ae2('0x28')](_0x52f8f6['variable'][_0x1ae2('0x7c')])){logger[_0x1ae2('0x21')]('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0x52f8f6['uniqueid'],_0x52f8f6[_0x1ae2('0x7b')]);this['channels'][_0x52f8f6[_0x1ae2('0x2c')]]['callerid']=_0x52f8f6[_0x1ae2('0x7b')];}else if(this['isNotNull'](_0x52f8f6[_0x1ae2('0x79')]['xmd-cdrtype'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x52f8f6[_0x1ae2('0x2c')],_0x52f8f6[_0x1ae2('0x7b')]);this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2c')]]['type']=_0x52f8f6[_0x1ae2('0x7b')];}else if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')]['xmd-queue'])){logger[_0x1ae2('0x21')]('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x52f8f6['uniqueid'],_0x52f8f6[_0x1ae2('0x7b')]['split'](',')[0x0]);this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2c')]][_0x1ae2('0x5c')]=_0x52f8f6['value']['split'](',')[0x0];}else if(this[_0x1ae2('0x28')](_0x52f8f6['variable'][_0x1ae2('0x7d')])){logger['info'](_0x1ae2('0x7e'),_0x52f8f6[_0x1ae2('0x2c')],_0x52f8f6[_0x1ae2('0x7b')]);this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2c')]][_0x1ae2('0x7f')]=_0x52f8f6[_0x1ae2('0x7b')];}else if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')]['xmd-destination'])){logger[_0x1ae2('0x21')](_0x1ae2('0x80'),_0x52f8f6[_0x1ae2('0x2c')],_0x52f8f6['value']);this[_0x1ae2('0x14')][_0x52f8f6['uniqueid']][_0x1ae2('0x81')]=_0x52f8f6[_0x1ae2('0x7b')];}else if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')]['xmd-callerid-preview'])){logger[_0x1ae2('0x21')](_0x1ae2('0x82'),_0x52f8f6[_0x1ae2('0x2c')],_0x52f8f6[_0x1ae2('0x7b')]);this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2c')]][_0x1ae2('0x83')]=_0x52f8f6[_0x1ae2('0x7b')];}else if(this['isNotNull'](_0x52f8f6[_0x1ae2('0x79')][_0x1ae2('0x84')])){logger['info'](_0x1ae2('0x85'),_0x52f8f6['uniqueid'],_0x52f8f6[_0x1ae2('0x7b')]);this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2c')]]['queue']=_0x52f8f6[_0x1ae2('0x7b')];}else if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')]['sipcallid'])){logger[_0x1ae2('0x21')](_0x1ae2('0x86'),_0x52f8f6[_0x1ae2('0x2c')],_0x52f8f6[_0x1ae2('0x7b')]);this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2c')]][_0x1ae2('0x87')]=_0x52f8f6['value'];}}}else if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')]['mixmonitor_filename'])){if(_0x52f8f6[_0x1ae2('0x7b')]){var _0x57c3f0=path[_0x1ae2('0x88')](_0x52f8f6['value'])[_0x1ae2('0x68')];logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x57c3f0,_0x52f8f6['value']);this['syncMixMonitorFilename'](_0x57c3f0,_0x52f8f6[_0x1ae2('0x7b')]);}}else if(this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2f')]]){if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')])){if(this[_0x1ae2('0x28')](_0x52f8f6[_0x1ae2('0x79')][_0x1ae2('0x89')])){logger[_0x1ae2('0x21')](_0x1ae2('0x86'),_0x52f8f6['linkedid'],_0x52f8f6['value']);this[_0x1ae2('0x14')][_0x52f8f6[_0x1ae2('0x2f')]][_0x1ae2('0x8a')]=_0x52f8f6[_0x1ae2('0x7b')];}}}}}catch(_0xd67400){logger[_0x1ae2('0x24')](_0x1ae2('0x8b'),_0x52f8f6[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0xd67400,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x1ae2('0x27')][_0x1ae2('0x1a')]=function(_0xd4fbf3){try{if(this[_0x1ae2('0x28')](_0xd4fbf3)){logger[_0x1ae2('0x2e')](_0x1ae2('0x8c'),_0xd4fbf3[_0x1ae2('0x2c')],util[_0x1ae2('0x26')](_0xd4fbf3,{'showHidden':![],'depth':null}));if(this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]]){if(this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3['linkedid']][_0x1ae2('0x2f')]]){this[_0x1ae2('0x14')][this['blindTransfers'][_0xd4fbf3['linkedid']]['linkedid']]['uniqueid']=_0xd4fbf3[_0x1ae2('0x2c')];this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]]['linkedid']][_0x1ae2('0x69')]=this[_0x1ae2('0x14')][_0xd4fbf3['uniqueid']][_0x1ae2('0x69')];this['channels'][this[_0x1ae2('0x4b')][_0xd4fbf3['linkedid']][_0x1ae2('0x2f')]][_0x1ae2('0x60')]=this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x60')];this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2f')]]['destinationchannel']=this['channels'][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2f')]]['channel'];this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]]['linkedid']][_0x1ae2('0x54')]=this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x54')];this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]]=this['channels'][this[_0x1ae2('0x4b')][_0xd4fbf3['linkedid']]['linkedid']];this[_0x1ae2('0x8d')](this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2f')]);}else if(this[_0x1ae2('0x14')][this['blindTransfers'][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2c')]]){this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3['linkedid']][_0x1ae2('0x2c')]][_0x1ae2('0x2c')]=[this['channels'][this['blindTransfers'][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2c')]][_0x1ae2('0x2f')],this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3['linkedid']][_0x1ae2('0x2c')]][_0x1ae2('0x2f')]=this['channels'][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2c')]][_0x1ae2('0x2c')]][0x0];this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]]['uniqueid']][_0x1ae2('0x69')]=this['channels'][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x69')];this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2c')]][_0x1ae2('0x60')]=this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x60')];this['channels'][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]]['uniqueid']][_0x1ae2('0x65')]=this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3['linkedid']]['uniqueid']]['channel'];this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]]['uniqueid']][_0x1ae2('0x54')]=this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x54')];this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]]=this[_0x1ae2('0x14')][this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]][_0x1ae2('0x2c')]];this[_0x1ae2('0x8d')](this[_0x1ae2('0x4b')][_0xd4fbf3[_0x1ae2('0x2f')]]['uniqueid']);}}if(this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]]){logger[_0x1ae2('0x21')](_0x1ae2('0x8e'),_0xd4fbf3[_0x1ae2('0x2c')],_0xd4fbf3['cause-txt']);var _0x19aa82=moment();this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x8f')]=_0x19aa82['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x1ae2('0x14')][_0xd4fbf3['uniqueid']][_0x1ae2('0x52')]=_0x19aa82['diff'](this['channels'][_0xd4fbf3[_0x1ae2('0x2c')]]['starttime'],_0x1ae2('0x53'));if(this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x69')]){this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x90')]=_0x19aa82[_0x1ae2('0x63')](this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]]['answertime'],_0x1ae2('0x53'));this['channels'][_0xd4fbf3[_0x1ae2('0x2c')]][_0x1ae2('0x62')]=this[_0x1ae2('0x14')][_0xd4fbf3[_0x1ae2('0x2c')]]['duration']-this['channels'][_0xd4fbf3['uniqueid']][_0x1ae2('0x90')];}if(_0xd4fbf3['context']===_0x1ae2('0x6b')){if(this[_0x1ae2('0x34')][_0xd4fbf3[_0x1ae2('0x35')]['split']('-')[0x0]]){this['agents'][_0xd4fbf3[_0x1ae2('0x35')]['split']('-')[0x0]]=_[_0x1ae2('0x91')](this[_0x1ae2('0x34')][_0xd4fbf3[_0x1ae2('0x35')][_0x1ae2('0x36')]('-')[0x0]],[_0x1ae2('0x38')]);logger[_0x1ae2('0x2e')](_0x1ae2('0x92'),_0xd4fbf3[_0x1ae2('0x2c')],util[_0x1ae2('0x26')]({'id':this[_0x1ae2('0x34')][_0xd4fbf3['channel'][_0x1ae2('0x36')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0xd4fbf3[_0x1ae2('0x35')][_0x1ae2('0x36')]('-')[0x0]][_0x1ae2('0x3b')]},{'showHidden':![],'depth':null}));this[_0x1ae2('0x2a')](util[_0x1ae2('0x43')]('user:%s',this['agents'][_0xd4fbf3[_0x1ae2('0x35')]['split']('-')[0x0]][_0x1ae2('0x68')]),_0x1ae2('0x93'),{'id':this[_0x1ae2('0x34')][_0xd4fbf3[_0x1ae2('0x35')][_0x1ae2('0x36')]('-')[0x0]]['id'],'destaccountcode':this[_0x1ae2('0x34')][_0xd4fbf3[_0x1ae2('0x35')][_0x1ae2('0x36')]('-')[0x0]][_0x1ae2('0x3b')]});for(var _0x241f9b=0x0;_0x241f9b{delete this[_0x1ae2('0x14')][_0x4e6c04];},_0x5c9bd7);}};module['exports']=VoiceCallReport; \ No newline at end of file +var _0xea27=['[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','sipcallid','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','sipcalllinkedid','[%s][voiceCallReport][varset]','deleteChannelAfterTimeout','endtime','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','length','transferType','then','transferToInternal','isEmpty','getSettings','Action','StopMixMonitor','catch','webbar:stopmonitors','event','BlindTransfer','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','origtransferercalleridnum','transfertargetcalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transferconnectedlinenum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','ATTENDED','origtransfererlinkedid','some','outbound','routeid','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','extension','BLIND','transfereruniqueid','transfererchannel','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','[%s][voiceCallReport][musiconholdstart]','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]','exports','lodash','util','ioredis','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','set','queue','dial','voicemail','NO\x20ANSWER','FAILED','BUSY','redis','localhost','socket.io-emitter','channels','agents','coreshowchannel','bind','newexten','syncNewExten','newchannel','syncNewChannel','syncNewState','varset','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','musiconholdstart','syncMusicOnHoldStart','syncMusicOnHoldStop','info','error','[voiceCallReport][coreshowchannels]','inspect','isNotNull','isUndefined','prototype','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridname','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','linkedid','merge','pick','from-sip','split','exten','destconnectedlinenum','connectedlinenum','user:%s','name','user:agentconnect','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','blindTransfers','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','keys','undefined','accountcode','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s','duration','seconds','includes','lastapplication','lastdata','cdr(','type','isNil','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','channelstate','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinename','destinationchannel','UserId','membername','toNumber','syncMixMonitorFilename','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','monitorFilename','find','monitors','rec','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','variable','mixmonitor_filename','value','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s','callerid','xmd-queue','xmd-originatecalleridnum'];(function(_0x11b178,_0x4ebe57){var _0x296414=function(_0x29366e){while(--_0x29366e){_0x11b178['push'](_0x11b178['shift']());}};_0x296414(++_0x4ebe57);}(_0xea27,0x1b2));var _0x7ea2=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xea27[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x7ea2('0x0'));var moment=require('moment');var util=require(_0x7ea2('0x1'));var path=require('path');var Redis=require(_0x7ea2('0x2'));var config=require('../../../config/environment');var logger=require(_0x7ea2('0x3'))(_0x7ea2('0x4'));var ami=require(_0x7ea2('0x5'));var Channel=require(_0x7ea2('0x6'));var RpcSetting=require(_0x7ea2('0x7'));var applications=[_0x7ea2('0x8'),_0x7ea2('0x9'),'agi',_0x7ea2('0xa'),'playback',_0x7ea2('0xb')];var dispositions=[_0x7ea2('0xc'),_0x7ea2('0xd'),_0x7ea2('0xd'),'NO\x20ANSWER',_0x7ea2('0xc'),_0x7ea2('0xc'),'ANSWERED',_0x7ea2('0xe'),_0x7ea2('0xd'),_0x7ea2('0xd'),'FAILED'];config[_0x7ea2('0xf')]=_['defaults'](config[_0x7ea2('0xf')],{'host':_0x7ea2('0x10'),'port':0x18eb});var io=require(_0x7ea2('0x11'))(new Redis(config[_0x7ea2('0xf')]));function VoiceCallReport(_0x4a6dc4){this[_0x7ea2('0x12')]=_0x4a6dc4[_0x7ea2('0x12')];this[_0x7ea2('0x13')]=_0x4a6dc4[_0x7ea2('0x13')];this['blindTransfers']={};ami['on'](_0x7ea2('0x14'),this['syncNewExten'][_0x7ea2('0x15')](this));ami['on'](_0x7ea2('0x16'),this[_0x7ea2('0x17')][_0x7ea2('0x15')](this));ami['on'](_0x7ea2('0x18'),this[_0x7ea2('0x19')]['bind'](this));ami['on']('newstate',this[_0x7ea2('0x1a')][_0x7ea2('0x15')](this));ami['on'](_0x7ea2('0x1b'),this[_0x7ea2('0x1c')]['bind'](this));ami['on'](_0x7ea2('0x1d'),this[_0x7ea2('0x1e')][_0x7ea2('0x15')](this));ami['on'](_0x7ea2('0x1f'),this[_0x7ea2('0x20')][_0x7ea2('0x15')](this));ami['on'](_0x7ea2('0x21'),this[_0x7ea2('0x22')][_0x7ea2('0x15')](this));ami['on'](_0x7ea2('0x23'),this['syncBlindTransfer'][_0x7ea2('0x15')](this));ami['on'](_0x7ea2('0x24'),this[_0x7ea2('0x25')][_0x7ea2('0x15')](this));ami['on']('musiconholdstop',this[_0x7ea2('0x26')][_0x7ea2('0x15')](this));try{logger[_0x7ea2('0x27')]('[voiceCallReport][coreshowchannels]\x20started');ami['actionCoreShowChannels']();}catch(_0x3e94f8){logger[_0x7ea2('0x28')](_0x7ea2('0x29'),util[_0x7ea2('0x2a')](_0x3e94f8,{'showHidden':![],'depth':null}));}}VoiceCallReport['prototype'][_0x7ea2('0x2b')]=function(_0x181f33){return _0x181f33!==null&&!_[_0x7ea2('0x2c')](_0x181f33);};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x2e')]=function(_0x479603,_0x397892,_0x5144b5){io['to'](_0x479603)[_0x7ea2('0x2e')](_0x397892,_0x5144b5);};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x20')]=function(_0x535aaf){try{if(this['isNotNull'](_0x535aaf)){logger['info'](_0x7ea2('0x2f'),_0x535aaf[_0x7ea2('0x30')],_0x535aaf[_0x7ea2('0x31')],_0x535aaf[_0x7ea2('0x32')]);logger[_0x7ea2('0x33')](_0x7ea2('0x34'),_0x535aaf['uniqueid'],util[_0x7ea2('0x2a')](_0x535aaf,{'showHidden':![],'depth':null}));if(_0x535aaf[_0x7ea2('0x30')]===_0x535aaf[_0x7ea2('0x35')]){if(!_['isUndefined'](this[_0x7ea2('0x12')][_0x535aaf[_0x7ea2('0x30')]])){_[_0x7ea2('0x36')](this[_0x7ea2('0x12')][_0x535aaf[_0x7ea2('0x30')]],_[_0x7ea2('0x37')](_0x535aaf,_['keys'](this[_0x7ea2('0x12')][_0x535aaf[_0x7ea2('0x30')]])));}}if(_0x535aaf['context']===_0x7ea2('0x38')){var _0x12aab5=this[_0x7ea2('0x13')][_0x535aaf['channel'][_0x7ea2('0x39')]('-')[0x0]];if(_0x12aab5){if(_0x535aaf[_0x7ea2('0x3a')]=='xcally-motion-preview'){_0x12aab5[_0x7ea2('0x3b')]=_0x535aaf[_0x7ea2('0x3c')];this[_0x7ea2('0x2e')](util['format'](_0x7ea2('0x3d'),_0x12aab5[_0x7ea2('0x3e')]),_0x7ea2('0x3f'),{'id':_0x12aab5['id'],'destaccountcode':_0x12aab5['accountcode'],'destconnectedlinenum':_0x535aaf[_0x7ea2('0x3c')]});}}}}}catch(_0xc11d2b){logger[_0x7ea2('0x28')](_0x7ea2('0x40'),_0x535aaf[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0xc11d2b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x19')]=function(_0x5db10c){try{if(this[_0x7ea2('0x2b')](_0x5db10c)){logger[_0x7ea2('0x33')](_0x7ea2('0x41'),_0x5db10c[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x5db10c,{'showHidden':![],'depth':null}));if(this['channels'][_0x5db10c[_0x7ea2('0x30')]]){return;}if(_0x5db10c[_0x7ea2('0x42')]===_0x7ea2('0x43')){return;}if(_0x5db10c[_0x7ea2('0x30')]!==_0x5db10c[_0x7ea2('0x35')]&&!this[_0x7ea2('0x44')][_0x5db10c[_0x7ea2('0x35')]]){return;}logger[_0x7ea2('0x27')](_0x7ea2('0x45'),_0x5db10c[_0x7ea2('0x30')],_0x5db10c[_0x7ea2('0x46')],_0x5db10c[_0x7ea2('0x3a')]);this[_0x7ea2('0x12')][_0x5db10c[_0x7ea2('0x30')]]=new Channel();this['channels'][_0x5db10c[_0x7ea2('0x30')]][_0x7ea2('0x47')]=moment()[_0x7ea2('0x48')](_0x7ea2('0x49'));this[_0x7ea2('0x12')][_0x5db10c[_0x7ea2('0x30')]][_0x7ea2('0x4a')]=dispositions[_['toNumber'](_0x5db10c['channelstate'])];_[_0x7ea2('0x36')](this[_0x7ea2('0x12')][_0x5db10c['uniqueid']],_[_0x7ea2('0x37')](_0x5db10c,_[_0x7ea2('0x4b')](this[_0x7ea2('0x12')][_0x5db10c[_0x7ea2('0x30')]])));if(_0x5db10c[_0x7ea2('0x46')]===_0x7ea2('0x38')){var _0x12cb5d=this[_0x7ea2('0x13')][_0x5db10c[_0x7ea2('0x42')]['split']('-')[0x0]];if(_0x12cb5d&&typeof _0x12cb5d[_0x7ea2('0x3b')]===_0x7ea2('0x4c')){_0x12cb5d[_0x7ea2('0x3b')]=_0x5db10c[_0x7ea2('0x3a')];logger[_0x7ea2('0x33')]('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x5db10c[_0x7ea2('0x30')],util[_0x7ea2('0x2a')]({'id':_0x12cb5d['id'],'destaccountcode':_0x12cb5d['accountcode'],'destconnectedlinenum':_0x5db10c[_0x7ea2('0x3a')]},{'showHidden':![],'depth':null}));this[_0x7ea2('0x2e')](util[_0x7ea2('0x48')](_0x7ea2('0x3d'),_0x12cb5d['name']),'user:agentconnect',{'id':_0x12cb5d['id'],'destaccountcode':_0x12cb5d[_0x7ea2('0x4d')],'destconnectedlinenum':_0x5db10c[_0x7ea2('0x3a')]});}}}}catch(_0x5651d3){logger['error'](_0x7ea2('0x4e'),_0x5db10c['uniqueid'],util[_0x7ea2('0x2a')](_0x5651d3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x17')]=function(_0x2b5e3a){try{if(this[_0x7ea2('0x2b')](_0x2b5e3a)){logger['debug'](_0x7ea2('0x4f'),_0x2b5e3a[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x2b5e3a,{'showHidden':![],'depth':null}));if(_0x2b5e3a[_0x7ea2('0x42')]===_0x7ea2('0x43')||_0x2b5e3a['exten']==='h')return;if(_0x2b5e3a[_0x7ea2('0x30')]===_0x2b5e3a[_0x7ea2('0x35')]||this[_0x7ea2('0x44')][_0x2b5e3a[_0x7ea2('0x35')]]){_0x2b5e3a[_0x7ea2('0x50')]=_0x2b5e3a[_0x7ea2('0x50')]?_0x2b5e3a['application'][_0x7ea2('0x51')]():undefined;_0x2b5e3a['applicationdata']=_0x2b5e3a['appdata']||_0x2b5e3a[_0x7ea2('0x52')];if(_0x2b5e3a[_0x7ea2('0x53')]&&_0x2b5e3a[_0x7ea2('0x50')]!=='queue'){_0x2b5e3a[_0x7ea2('0x52')]=_0x2b5e3a[_0x7ea2('0x52')][_0x7ea2('0x51')]();}logger[_0x7ea2('0x27')](_0x7ea2('0x54'),_0x2b5e3a[_0x7ea2('0x30')],_0x2b5e3a['application'],_0x2b5e3a[_0x7ea2('0x52')]);if(_[_0x7ea2('0x2c')](this['channels'][_0x2b5e3a[_0x7ea2('0x30')]])){this[_0x7ea2('0x12')][_0x2b5e3a[_0x7ea2('0x30')]]=new Channel();this['channels'][_0x2b5e3a[_0x7ea2('0x30')]]['starttime']=_0x2b5e3a[_0x7ea2('0x55')]?moment()['subtract'](moment['duration'](_0x2b5e3a['duration'])['seconds'](),_0x7ea2('0x56'))['format'](_0x7ea2('0x49')):moment()[_0x7ea2('0x48')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x7ea2('0x12')][_0x2b5e3a['uniqueid']][_0x7ea2('0x4a')]=_0x7ea2('0xc');}_[_0x7ea2('0x36')](this[_0x7ea2('0x12')][_0x2b5e3a[_0x7ea2('0x30')]],_[_0x7ea2('0x37')](_0x2b5e3a,_[_0x7ea2('0x4b')](this[_0x7ea2('0x12')][_0x2b5e3a['uniqueid']])));if(_[_0x7ea2('0x57')](applications,_0x2b5e3a[_0x7ea2('0x50')])){this[_0x7ea2('0x12')][_0x2b5e3a[_0x7ea2('0x30')]][_0x7ea2('0x58')]=_0x2b5e3a[_0x7ea2('0x50')];this[_0x7ea2('0x12')][_0x2b5e3a[_0x7ea2('0x30')]][_0x7ea2('0x59')]=_0x2b5e3a[_0x7ea2('0x52')];if(_0x2b5e3a[_0x7ea2('0x50')]===_0x7ea2('0x8')&&_['startsWith'](_0x2b5e3a[_0x7ea2('0x52')][_0x7ea2('0x51')](),_0x7ea2('0x5a'))){var _0x46f89d=_0x2b5e3a[_0x7ea2('0x52')][_0x7ea2('0x39')]('=');var _0x23bb7c=_0x46f89d[0x0][_0x7ea2('0x51')]()['match'](/cdr\((.*)\)/);if(_0x23bb7c){if(_0x23bb7c[0x1]===_0x7ea2('0x5b')&&!_[_0x7ea2('0x5c')](this[_0x7ea2('0x12')][_0x2b5e3a[_0x7ea2('0x30')]][_0x23bb7c[0x1]]))return;this[_0x7ea2('0x12')][_0x2b5e3a[_0x7ea2('0x30')]][_0x23bb7c[0x1]]=_0x46f89d[0x1];}}else if(_0x2b5e3a['application']===_0x7ea2('0x9')){this[_0x7ea2('0x12')][_0x2b5e3a[_0x7ea2('0x30')]][_0x7ea2('0x9')]=_0x2b5e3a['applicationdata'][_0x7ea2('0x39')](',')[0x0];}}}}}catch(_0x4d57e8){logger[_0x7ea2('0x28')](_0x7ea2('0x5d'),_0x2b5e3a[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x4d57e8,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x1a')]=function(_0x1f5ade){try{if(this['isNotNull'](_0x1f5ade)){logger[_0x7ea2('0x27')](_0x7ea2('0x5e'),_0x1f5ade[_0x7ea2('0x30')],_0x1f5ade[_0x7ea2('0x35')],_0x1f5ade[_0x7ea2('0x31')],_0x1f5ade[_0x7ea2('0x32')]);logger[_0x7ea2('0x33')]('[%s][voiceCallReport][newstate]\x20event:',_0x1f5ade[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x1f5ade,{'showHidden':![],'depth':null}));if(_0x1f5ade[_0x7ea2('0x5f')]!=='6')return;var _0x5f03c2=this[_0x7ea2('0x13')][_0x1f5ade[_0x7ea2('0x42')][_0x7ea2('0x39')]('-')[0x0]];if(_0x1f5ade['uniqueid']!==_0x1f5ade['linkedid']){var _0x1a5c07=moment();if(this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]]){if(!this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x60')]){this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x60')]=!![];this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x61')]=_0x1a5c07[_0x7ea2('0x48')](_0x7ea2('0x49'));if(this['channels'][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x47')]){this[_0x7ea2('0x12')][_0x1f5ade['linkedid']][_0x7ea2('0x62')]=_0x1a5c07[_0x7ea2('0x63')](this[_0x7ea2('0x12')][_0x1f5ade['linkedid']][_0x7ea2('0x47')],_0x7ea2('0x56'));}}this['channels'][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x35')]=_0x1f5ade['uniqueid'];if(_0x1f5ade[_0x7ea2('0x32')]!==_0x7ea2('0x64')){this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]]['connectedlinenum']=_0x1f5ade[_0x7ea2('0x32')];}this[_0x7ea2('0x12')][_0x1f5ade['linkedid']][_0x7ea2('0x65')]=_0x1f5ade[_0x7ea2('0x31')];this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x66')]=_0x1f5ade[_0x7ea2('0x42')];this['channels'][_0x1f5ade['linkedid']][_0x7ea2('0x4a')]=dispositions[_['toNumber'](_0x1f5ade[_0x7ea2('0x5f')])];if(_0x5f03c2){this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x67')]=_0x5f03c2['id'];this['channels'][_0x1f5ade['linkedid']][_0x7ea2('0x68')]=_0x5f03c2[_0x7ea2('0x3e')];}}if(this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]]){if(!this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]][_0x7ea2('0x60')]){this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]][_0x7ea2('0x60')]=!![];this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]][_0x7ea2('0x61')]=_0x1a5c07[_0x7ea2('0x48')](_0x7ea2('0x49'));if(this[_0x7ea2('0x12')][_0x1f5ade['uniqueid']]['starttime']){this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]][_0x7ea2('0x62')]=_0x1a5c07['diff'](this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]][_0x7ea2('0x47')],'seconds');}}if(_0x1f5ade['calleridnum']!==_0x7ea2('0x64')){this['channels'][_0x1f5ade['uniqueid']]['connectedlinenum']=_0x1f5ade[_0x7ea2('0x32')];}this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]][_0x7ea2('0x65')]=_0x1f5ade[_0x7ea2('0x31')];this['channels'][_0x1f5ade[_0x7ea2('0x30')]]['destinationchannel']=_0x1f5ade['channel'];this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]]['disposition']=dispositions[_[_0x7ea2('0x69')](_0x1f5ade[_0x7ea2('0x5f')])];}}else{if(this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]]){if(_0x5f03c2){this['channels'][_0x1f5ade[_0x7ea2('0x30')]][_0x7ea2('0x67')]=_0x5f03c2['id'];this['channels'][_0x1f5ade[_0x7ea2('0x30')]]['membername']=_0x5f03c2[_0x7ea2('0x3e')];}}}if(_0x1f5ade[_0x7ea2('0x46')]===_0x7ea2('0x38')){if(_0x5f03c2){_0x5f03c2[_0x7ea2('0x3b')]=_0x1f5ade[_0x7ea2('0x3a')];var _0xf37186;if(this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x30')]]){_0xf37186=this[_0x7ea2('0x12')][_0x1f5ade['uniqueid']][_0x7ea2('0x9')];}else if(this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]]){_0xf37186=this[_0x7ea2('0x12')][_0x1f5ade[_0x7ea2('0x35')]][_0x7ea2('0x9')];}_0x5f03c2[_0x7ea2('0x9')]=_0xf37186;var _0x1f2adf={'id':_0x5f03c2['id'],'name':_0x5f03c2[_0x7ea2('0x3e')],'agentconnected':!![],'destaccountcode':_0x5f03c2[_0x7ea2('0x4d')],'destconnectedlinenum':_0x1f5ade[_0x7ea2('0x3a')],'queue':_0xf37186||undefined,'uniqueid':_0x1f5ade[_0x7ea2('0x35')]};logger[_0x7ea2('0x33')]('[%s][voiceCallReport][newstate]\x20sending\x20user:agentconnect\x20event:',_0x1f5ade[_0x7ea2('0x30')],util['inspect'](_0x1f2adf,{'showHidden':![],'depth':null}));this[_0x7ea2('0x2e')](util[_0x7ea2('0x48')]('user:%s',_0x5f03c2[_0x7ea2('0x3e')]),_0x7ea2('0x3f'),_0x1f2adf);}}}}catch(_0x1f0748){logger[_0x7ea2('0x28')]('[%s][voiceCallReport][newstate]',_0x1f5ade[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x1f0748,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x6a')]=function(_0x3e7642,_0x24da71){try{if(this[_0x7ea2('0x12')][_0x3e7642]){logger['info'](_0x7ea2('0x6b'),_0x3e7642,_0x24da71);this[_0x7ea2('0x12')][_0x3e7642][_0x7ea2('0x6c')]=!![];if(_[_0x7ea2('0x6d')](_0x24da71,_0x7ea2('0x6e'))){_0x24da71=_0x24da71['replace']('.wav49','.WAV');}this[_0x7ea2('0x12')][_0x3e7642][_0x7ea2('0x6f')]=_0x24da71;var _0x18c315=_[_0x7ea2('0x70')](this[_0x7ea2('0x12')][_0x3e7642][_0x7ea2('0x71')],{'filename':_0x24da71});if(_[_0x7ea2('0x5c')](_0x18c315)){this[_0x7ea2('0x12')][_0x3e7642][_0x7ea2('0x71')]['push']({'filename':_0x24da71,'createdAt':moment()['format'](_0x7ea2('0x49')),'mixmonitorid':'','status':_0x7ea2('0x72')});}}}catch(_0x1a386b){logger[_0x7ea2('0x28')](_0x7ea2('0x73'),_0x3e7642,util['inspect'](_0x1a386b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x1c')]=function(_0x472f00){try{if(this[_0x7ea2('0x2b')](_0x472f00)){logger[_0x7ea2('0x33')](_0x7ea2('0x74'),_0x472f00[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x472f00,{'showHidden':![],'depth':null}));if(this['channels'][_0x472f00[_0x7ea2('0x30')]]&&_0x472f00[_0x7ea2('0x42')]!='OutgoingSpoolFailed'){if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')])){if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')][_0x7ea2('0x76')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s',_0x472f00[_0x7ea2('0x30')],_0x472f00[_0x7ea2('0x77')]);this[_0x7ea2('0x6a')](_0x472f00[_0x7ea2('0x30')],_0x472f00['value']);}else if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')][_0x7ea2('0x78')])){logger[_0x7ea2('0x27')](_0x7ea2('0x79'),_0x472f00[_0x7ea2('0x30')],_0x472f00[_0x7ea2('0x77')]);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]][_0x7ea2('0x32')]=_0x472f00[_0x7ea2('0x77')];}else if(this['isNotNull'](_0x472f00[_0x7ea2('0x75')][_0x7ea2('0x7a')])){logger[_0x7ea2('0x27')](_0x7ea2('0x7b'),_0x472f00[_0x7ea2('0x30')],_0x472f00['value']);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]][_0x7ea2('0x7c')]=_0x472f00['value'];}else if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')]['xmd-cdrtype'])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x472f00[_0x7ea2('0x30')],_0x472f00[_0x7ea2('0x77')]);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]][_0x7ea2('0x5b')]=_0x472f00[_0x7ea2('0x77')];}else if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')][_0x7ea2('0x7d')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s',_0x472f00[_0x7ea2('0x30')],_0x472f00['value'][_0x7ea2('0x39')](',')[0x0]);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]][_0x7ea2('0x9')]=_0x472f00[_0x7ea2('0x77')][_0x7ea2('0x39')](',')[0x0];}else if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')][_0x7ea2('0x7e')])){logger[_0x7ea2('0x27')](_0x7ea2('0x7f'),_0x472f00[_0x7ea2('0x30')],_0x472f00[_0x7ea2('0x77')]);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]]['originatecalleridnum']=_0x472f00[_0x7ea2('0x77')];}else if(this['isNotNull'](_0x472f00['variable'][_0x7ea2('0x80')])){logger[_0x7ea2('0x27')]('[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s',_0x472f00['uniqueid'],_0x472f00[_0x7ea2('0x77')]);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]][_0x7ea2('0x81')]=_0x472f00[_0x7ea2('0x77')];}else if(this[_0x7ea2('0x2b')](_0x472f00['variable'][_0x7ea2('0x82')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s',_0x472f00['uniqueid'],_0x472f00[_0x7ea2('0x77')]);this['channels'][_0x472f00[_0x7ea2('0x30')]][_0x7ea2('0x83')]=_0x472f00[_0x7ea2('0x77')];}else if(this['isNotNull'](_0x472f00[_0x7ea2('0x75')][_0x7ea2('0x84')])){logger[_0x7ea2('0x27')](_0x7ea2('0x85'),_0x472f00[_0x7ea2('0x30')],_0x472f00[_0x7ea2('0x77')]);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]]['queue']=_0x472f00['value'];}else if(this[_0x7ea2('0x2b')](_0x472f00['variable'][_0x7ea2('0x86')])){logger[_0x7ea2('0x27')](_0x7ea2('0x87'),_0x472f00[_0x7ea2('0x30')],_0x472f00['value']);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x30')]][_0x7ea2('0x88')]=_0x472f00['value'];}}}else if(this[_0x7ea2('0x2b')](_0x472f00['variable'][_0x7ea2('0x76')])){if(_0x472f00[_0x7ea2('0x77')]){var _0x40391c=path[_0x7ea2('0x89')](_0x472f00[_0x7ea2('0x77')])[_0x7ea2('0x3e')];logger[_0x7ea2('0x27')](_0x7ea2('0x8a'),_0x40391c,_0x472f00[_0x7ea2('0x77')]);this['syncMixMonitorFilename'](_0x40391c,_0x472f00[_0x7ea2('0x77')]);}}else if(this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x35')]]){if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')])){if(this[_0x7ea2('0x2b')](_0x472f00[_0x7ea2('0x75')]['sipcallid'])){logger['info'](_0x7ea2('0x87'),_0x472f00[_0x7ea2('0x35')],_0x472f00[_0x7ea2('0x77')]);this[_0x7ea2('0x12')][_0x472f00[_0x7ea2('0x35')]][_0x7ea2('0x8b')]=_0x472f00['value'];}}}}}catch(_0x297864){logger['error'](_0x7ea2('0x8c'),_0x472f00[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x297864,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x7ea2('0x2d')][_0x7ea2('0x1e')]=function(_0x4b7e07){try{if(this[_0x7ea2('0x2b')](_0x4b7e07)){logger[_0x7ea2('0x33')]('[%s][voiceCallReport][hangup]\x20event:',_0x4b7e07[_0x7ea2('0x30')],util[_0x7ea2('0x2a')](_0x4b7e07,{'showHidden':![],'depth':null}));if(this['blindTransfers'][_0x4b7e07[_0x7ea2('0x35')]]){if(this[_0x7ea2('0x12')][this['blindTransfers'][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x35')]]){this['channels'][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x35')]][_0x7ea2('0x30')]=_0x4b7e07[_0x7ea2('0x30')];this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x35')]][_0x7ea2('0x60')]=this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x60')];this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x35')]][_0x7ea2('0x61')]=this['channels'][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x61')];this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07['linkedid']]['linkedid']]['destinationchannel']=this[_0x7ea2('0x12')][this['blindTransfers'][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x35')]][_0x7ea2('0x42')];this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x35')]][_0x7ea2('0x4a')]=this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x4a')];this['channels'][_0x4b7e07['uniqueid']]=this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]]['linkedid']];this[_0x7ea2('0x8d')](this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x35')]);}else if(this['channels'][this['blindTransfers'][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x30')]]){this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07['linkedid']][_0x7ea2('0x30')]][_0x7ea2('0x30')]=[this[_0x7ea2('0x12')][this['blindTransfers'][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x30')]]['linkedid'],this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x30')]][_0x7ea2('0x35')]=this['channels'][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]]['uniqueid']]['uniqueid']][0x0];this[_0x7ea2('0x12')][this['blindTransfers'][_0x4b7e07['linkedid']][_0x7ea2('0x30')]][_0x7ea2('0x60')]=this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x60')];this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x30')]]['answertime']=this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x61')];this['channels'][this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x30')]]['destinationchannel']=this[_0x7ea2('0x12')][this[_0x7ea2('0x44')][_0x4b7e07['linkedid']][_0x7ea2('0x30')]][_0x7ea2('0x42')];this['channels'][this['blindTransfers'][_0x4b7e07['linkedid']]['uniqueid']][_0x7ea2('0x4a')]=this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x4a')];this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]]=this[_0x7ea2('0x12')][this['blindTransfers'][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x30')]];this[_0x7ea2('0x8d')](this[_0x7ea2('0x44')][_0x4b7e07[_0x7ea2('0x35')]][_0x7ea2('0x30')]);}}if(this[_0x7ea2('0x12')][_0x4b7e07['uniqueid']]){logger[_0x7ea2('0x27')]('[%s][voiceCallReport][hangup]\x20reason:%s',_0x4b7e07[_0x7ea2('0x30')],_0x4b7e07['cause-txt']);var _0x8408b5=moment();this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x8e')]=_0x8408b5[_0x7ea2('0x48')](_0x7ea2('0x49'));this[_0x7ea2('0x12')][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x55')]=_0x8408b5[_0x7ea2('0x63')](this[_0x7ea2('0x12')][_0x4b7e07['uniqueid']]['starttime'],_0x7ea2('0x56'));if(this['channels'][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x60')]){this[_0x7ea2('0x12')][_0x4b7e07['uniqueid']]['billableseconds']=_0x8408b5[_0x7ea2('0x63')](this['channels'][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x61')],_0x7ea2('0x56'));this['channels'][_0x4b7e07[_0x7ea2('0x30')]][_0x7ea2('0x62')]=this[_0x7ea2('0x12')][_0x4b7e07['uniqueid']][_0x7ea2('0x55')]-this[_0x7ea2('0x12')][_0x4b7e07['uniqueid']]['billableseconds'];}if(_0x4b7e07[_0x7ea2('0x46')]===_0x7ea2('0x38')){if(this[_0x7ea2('0x13')][_0x4b7e07[_0x7ea2('0x42')][_0x7ea2('0x39')]('-')[0x0]]){this['agents'][_0x4b7e07[_0x7ea2('0x42')]['split']('-')[0x0]]=_[_0x7ea2('0x8f')](this[_0x7ea2('0x13')][_0x4b7e07[_0x7ea2('0x42')]['split']('-')[0x0]],[_0x7ea2('0x3b')]);logger[_0x7ea2('0x33')](_0x7ea2('0x90'),_0x4b7e07[_0x7ea2('0x30')],util['inspect']({'id':this['agents'][_0x4b7e07[_0x7ea2('0x42')][_0x7ea2('0x39')]('-')[0x0]]['id'],'destaccountcode':this[_0x7ea2('0x13')][_0x4b7e07[_0x7ea2('0x42')][_0x7ea2('0x39')]('-')[0x0]][_0x7ea2('0x4d')]},{'showHidden':![],'depth':null}));this[_0x7ea2('0x2e')](util[_0x7ea2('0x48')](_0x7ea2('0x3d'),this['agents'][_0x4b7e07[_0x7ea2('0x42')][_0x7ea2('0x39')]('-')[0x0]][_0x7ea2('0x3e')]),_0x7ea2('0x91'),{'id':this['agents'][_0x4b7e07['channel']['split']('-')[0x0]]['id'],'destaccountcode':this[_0x7ea2('0x13')][_0x4b7e07[_0x7ea2('0x42')][_0x7ea2('0x39')]('-')[0x0]][_0x7ea2('0x4d')]});for(var _0x30c514=0x0;_0x30c514{delete this[_0x7ea2('0x12')][_0x2f8346];},_0x105065);}};module[_0x7ea2('0xba')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 1e34009..6316a65 100644 --- a/server/services/ami/report/voiceDialReport.js +++ b/server/services/ami/report/voiceDialReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc066=['[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','info','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','keys','variable','value','variables','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','outboundrouteid','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberrealtime','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','cause-txt','endtime','duration','diff','seconds','complete','total','answered','holdtime','starttime','sumHoldTime','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:','voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','set','applicationdata','toLowerCase','startsWith','cdr(','split','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','channels','outboundChannels','outbound','applications','dialbegin','syncDialBegin','dialend','syncDialEnd','bind','varset','syncVarSet','hangup','isUndefined','prototype','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','inspect','voice_outbound_channel:save','custom:dialbegin','error','[%s][voiceDialReport][dialbegin]','isNotNull'];(function(_0x17202,_0x28c231){var _0x5507c1=function(_0x5064c9){while(--_0x5064c9){_0x17202['push'](_0x17202['shift']());}};_0x5507c1(++_0x28c231);}(_0xc066,0xd1));var _0x6c06=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xc066[_0xfae23b];return _0x200640;};'use strict';var _=require(_0x6c06('0x0'));var moment=require(_0x6c06('0x1'));var util=require('util');var Redis=require(_0x6c06('0x2'));var config=require(_0x6c06('0x3'));var logger=require(_0x6c06('0x4'))('ami');var ami=require(_0x6c06('0x5'));config[_0x6c06('0x6')]=_[_0x6c06('0x7')](config[_0x6c06('0x6')],{'host':_0x6c06('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x6c06('0x6')]));function VoiceDialReport(_0x33ff95){this[_0x6c06('0x9')]=_0x33ff95[_0x6c06('0xa')];this[_0x6c06('0xb')]=_0x33ff95[_0x6c06('0xb')];this[_0x6c06('0xc')]={};this['variables']={};ami['on'](_0x6c06('0xd'),this[_0x6c06('0xe')]['bind'](this));ami['on'](_0x6c06('0xf'),this[_0x6c06('0x10')][_0x6c06('0x11')](this));ami['on'](_0x6c06('0x12'),this[_0x6c06('0x13')][_0x6c06('0x11')](this));ami['on'](_0x6c06('0x14'),this['syncHangup']['bind'](this));}VoiceDialReport['prototype']['isNotNull']=function(_0x1a91ac){return _0x1a91ac!==null&&!_[_0x6c06('0x15')](_0x1a91ac);};VoiceDialReport[_0x6c06('0x16')][_0x6c06('0x17')]=function(_0x5798e5,_0xb0eb33,_0x4a7e78){io['to'](_0x5798e5)[_0x6c06('0x17')](_0xb0eb33,_0x4a7e78);};VoiceDialReport[_0x6c06('0x16')][_0x6c06('0xe')]=function(_0x4222b2){try{if(this['isNotNull'](_0x4222b2)){logger[_0x6c06('0x18')](_0x6c06('0x19'),_0x4222b2[_0x6c06('0x1a')],util['inspect'](_0x4222b2,{'showHidden':![],'depth':null}));if(this[_0x6c06('0x9')][_0x4222b2[_0x6c06('0x1a')]]){_[_0x6c06('0x1b')](this['channels'][_0x4222b2[_0x6c06('0x1a')]],{'starttime':moment()[_0x6c06('0x1c')](_0x6c06('0x1d')),'lastevent':'called','interface':_0x4222b2[_0x6c06('0x1e')][_0x6c06('0x1f')](0x0,_0x4222b2[_0x6c06('0x1e')][_0x6c06('0x20')]('-')),'membername':_0x4222b2[_0x6c06('0x1e')][_0x6c06('0x1f')](_0x4222b2[_0x6c06('0x1e')]['lastIndexOf']('/')+0x1,_0x4222b2[_0x6c06('0x1e')]['lastIndexOf']('-'))},_['omit'](_0x4222b2,[_0x6c06('0x21'),_0x6c06('0x22')]));logger['info'](_0x6c06('0x23'),_0x4222b2[_0x6c06('0x1a')],this[_0x6c06('0x9')][_0x4222b2[_0x6c06('0x1a')]][_0x6c06('0x24')],this['channels'][_0x4222b2[_0x6c06('0x1a')]][_0x6c06('0x25')]);logger[_0x6c06('0x18')](_0x6c06('0x26'),_0x4222b2[_0x6c06('0x1a')],util[_0x6c06('0x27')](this[_0x6c06('0x9')][_0x4222b2[_0x6c06('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0x6c06('0xc')][_0x4222b2[_0x6c06('0x1a')]])_[_0x6c06('0x1b')](this['channels'][_0x4222b2[_0x6c06('0x1a')]],this[_0x6c06('0xc')][_0x4222b2['uniqueid']]);this[_0x6c06('0x17')]('voice:outbound',_0x6c06('0x28'),this[_0x6c06('0x9')][_0x4222b2[_0x6c06('0x1a')]]);logger[_0x6c06('0x18')]('[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:',_0x4222b2[_0x6c06('0x1a')],util[_0x6c06('0x27')](this[_0x6c06('0x9')][_0x4222b2[_0x6c06('0x1a')]],{'showHidden':![],'depth':null}));ami['emit'](_0x6c06('0x29'),this['channels'][_0x4222b2[_0x6c06('0x1a')]]);}}}catch(_0x103a6b){logger[_0x6c06('0x2a')](_0x6c06('0x2b'),_0x4222b2[_0x6c06('0x1a')],util[_0x6c06('0x27')](_0x103a6b,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6c06('0x16')][_0x6c06('0x10')]=function(_0x496271){try{if(this[_0x6c06('0x2c')](_0x496271)){logger[_0x6c06('0x18')](_0x6c06('0x2d'),_0x496271[_0x6c06('0x1a')],util[_0x6c06('0x27')](_0x496271,{'showHidden':![],'depth':null}));if(this[_0x6c06('0x9')][_0x496271[_0x6c06('0x1a')]]){this['channels'][_0x496271['uniqueid']][_0x6c06('0x2e')]=_0x496271[_0x6c06('0x2e')];if(_0x496271[_0x6c06('0x2e')]===_0x6c06('0x2f')){this[_0x6c06('0x9')][_0x496271[_0x6c06('0x1a')]]['connectedlinenum']=_0x496271[_0x6c06('0x30')];this[_0x6c06('0x9')][_0x496271[_0x6c06('0x1a')]]['connectedlinename']=_0x496271[_0x6c06('0x31')];this['channels'][_0x496271['uniqueid']][_0x6c06('0x32')]=moment()[_0x6c06('0x1c')](_0x6c06('0x1d'));this[_0x6c06('0x9')][_0x496271[_0x6c06('0x1a')]][_0x6c06('0x33')]=_0x6c06('0x34');logger[_0x6c06('0x35')](_0x6c06('0x36'),_0x496271['uniqueid'],_0x496271[_0x6c06('0x1e')][_0x6c06('0x1f')](_0x496271[_0x6c06('0x1e')][_0x6c06('0x20')]('/')+0x1,_0x496271[_0x6c06('0x1e')][_0x6c06('0x20')]('-')));logger[_0x6c06('0x18')](_0x6c06('0x37'),_0x496271[_0x6c06('0x1a')],util[_0x6c06('0x27')](this[_0x6c06('0x9')][_0x496271[_0x6c06('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x6c06('0x17')]('custom:dialconnect',this[_0x6c06('0x9')][_0x496271['uniqueid']]);}logger[_0x6c06('0x18')](_0x6c06('0x38'),_0x496271[_0x6c06('0x1a')],util[_0x6c06('0x27')](this['channels'][_0x496271[_0x6c06('0x1a')]],{'showHidden':![],'depth':null}));this[_0x6c06('0x17')]('voice:outbound',_0x6c06('0x28'),this['channels'][_0x496271['uniqueid']]);}}}catch(_0x5bb6b6){logger[_0x6c06('0x2a')](_0x6c06('0x39'),_0x496271[_0x6c06('0x1a')],util[_0x6c06('0x27')](_0x5bb6b6,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6c06('0x16')]['syncVarSet']=function(_0x5eecd4){try{if(this[_0x6c06('0x2c')](_0x5eecd4)){logger['debug'](_0x6c06('0x3a'),_0x5eecd4[_0x6c06('0x1a')],util[_0x6c06('0x27')](_0x5eecd4,{'showHidden':![],'depth':null}));this['addVariable'](_0x5eecd4[_0x6c06('0x1a')],_[_0x6c06('0x3b')](_0x5eecd4[_0x6c06('0x3c')])[0x0],_0x5eecd4['value']);if(this[_0x6c06('0x2c')](_0x5eecd4[_0x6c06('0x3c')])&&this[_0x6c06('0x2c')](_0x5eecd4[_0x6c06('0x3c')]['outboundrouteid'])){if(_[_0x6c06('0x15')](this[_0x6c06('0x9')][_0x5eecd4[_0x6c06('0x1a')]])){this['channels'][_0x5eecd4[_0x6c06('0x1a')]]={'routeId':_0x5eecd4[_0x6c06('0x3d')],'variables':this[_0x6c06('0x3e')][_0x5eecd4[_0x6c06('0x1a')]],'motionChannel':_0x6c06('0x3f')};logger['info'](_0x6c06('0x40'),_0x5eecd4[_0x6c06('0x1a')],_0x5eecd4[_0x6c06('0x3c')][_0x6c06('0x41')],_[_0x6c06('0x3b')](_0x5eecd4[_0x6c06('0x3c')])[0x0],_0x5eecd4[_0x6c06('0x3d')]);logger['debug'](_0x6c06('0x42'),_0x5eecd4[_0x6c06('0x1a')],util[_0x6c06('0x27')](this[_0x6c06('0x9')][_0x5eecd4['uniqueid']],{'showHidden':![],'depth':null}));this[_0x6c06('0x17')](_0x6c06('0x43'),_0x6c06('0x28'),this['channels'][_0x5eecd4[_0x6c06('0x1a')]]);}}}}catch(_0x437ee2){logger[_0x6c06('0x2a')](_0x6c06('0x44'),_0x5eecd4[_0x6c06('0x1a')],util[_0x6c06('0x27')](_0x437ee2,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x6c06('0x45')]=function(_0x92dfb4,_0x493a69,_0x1004fa){var _0x5cddb3=[_0x6c06('0x46'),'rtpaudioqosbridged',_0x6c06('0x47'),_0x6c06('0x48'),_0x6c06('0x49'),_0x6c06('0x4a'),_0x6c06('0x4b'),_0x6c06('0x4c'),_0x6c06('0x4d'),_0x6c06('0x4e'),'bridgepeer',_0x6c06('0x4f'),_0x6c06('0x50'),_0x6c06('0x51'),'memberinterface',_0x6c06('0x52'),_0x6c06('0x24'),'memberpenalty',_0x6c06('0x53')];if(!_[_0x6c06('0x54')](_0x493a69)&&!_[_0x6c06('0x55')](_0x5cddb3,_0x493a69)){if(_[_0x6c06('0x15')](this[_0x6c06('0x3e')][_0x92dfb4])){this['variables'][_0x92dfb4]={};}this['variables'][_0x92dfb4][_0x493a69]=_0x1004fa;}};VoiceDialReport['prototype'][_0x6c06('0x56')]=function(_0x58c7ea){try{if(this['isNotNull'](_0x58c7ea)){logger[_0x6c06('0x18')](_0x6c06('0x57'),_0x58c7ea[_0x6c06('0x1a')],util['inspect'](_0x58c7ea,{'showHidden':![],'depth':null}));if(this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]]){logger[_0x6c06('0x35')]('[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete',_0x58c7ea[_0x6c06('0x1a')],_0x58c7ea[_0x6c06('0x58')]);this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x59')]=moment()[_0x6c06('0x1c')](_0x6c06('0x1d'));this[_0x6c06('0x9')][_0x58c7ea['uniqueid']][_0x6c06('0x5a')]=moment(this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x59')])[_0x6c06('0x5b')](this['channels'][_0x58c7ea[_0x6c06('0x1a')]]['starttime'],_0x6c06('0x5c'));this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]]['lastevent']=_0x6c06('0x5d');this[_0x6c06('0xb')][_0x6c06('0x5e')]+=0x1;if(this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]]['answertime']){this['outbound'][_0x6c06('0x5f')]+=0x1;this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x60')]=moment(this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x32')])[_0x6c06('0x5b')](this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x61')],_0x6c06('0x5c'));this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]]['billableseconds']=moment(this['channels'][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x59')])[_0x6c06('0x5b')](this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x32')],'seconds');this[_0x6c06('0xb')][_0x6c06('0x62')]+=this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x60')]||0x0;this[_0x6c06('0xb')]['sumBillable']+=this['channels'][_0x58c7ea['uniqueid']][_0x6c06('0x63')];}this[_0x6c06('0xb')][_0x6c06('0x64')]+=this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]][_0x6c06('0x5a')];logger[_0x6c06('0x18')](_0x6c06('0x65'),_0x58c7ea[_0x6c06('0x1a')],util[_0x6c06('0x27')](this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x6c06('0x17')](_0x6c06('0x66'),this['channels'][_0x58c7ea[_0x6c06('0x1a')]]);logger[_0x6c06('0x18')](_0x6c06('0x67'),_0x58c7ea['uniqueid'],util[_0x6c06('0x27')](this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]],{'showHidden':![],'depth':null}));ami[_0x6c06('0x17')](_0x6c06('0x68'),this[_0x6c06('0x9')][_0x58c7ea['uniqueid']]);logger[_0x6c06('0x18')](_0x6c06('0x69'),_0x58c7ea[_0x6c06('0x1a')],util['inspect'](this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]],{'showHidden':![],'depth':null}));this[_0x6c06('0x17')](_0x6c06('0x43'),_0x6c06('0x6a'),this['outbound']);logger[_0x6c06('0x35')](_0x6c06('0x6b'),JSON[_0x6c06('0x6c')](this['channels'][_0x58c7ea[_0x6c06('0x1a')]]));logger['debug'](_0x6c06('0x6d'),_0x58c7ea[_0x6c06('0x1a')],util[_0x6c06('0x27')](this['channels'][_0x58c7ea['uniqueid']],{'showHidden':![],'depth':null}));this[_0x6c06('0x17')](_0x6c06('0x43'),_0x6c06('0x6e'),this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x1a')]]);this[_0x6c06('0x6f')](_0x58c7ea[_0x6c06('0x1a')]);}else if(this['channels'][_0x58c7ea[_0x6c06('0x70')]]){this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x70')]][_0x6c06('0x1a')]=this[_0x6c06('0x9')][_0x58c7ea[_0x6c06('0x70')]][_0x6c06('0x71')];}if(this[_0x6c06('0x3e')][_0x58c7ea[_0x6c06('0x1a')]]){delete this[_0x6c06('0x3e')][_0x58c7ea[_0x6c06('0x1a')]];}}}catch(_0x4dcd87){logger['error'](_0x6c06('0x72'),_0x58c7ea['uniqueid'],util[_0x6c06('0x27')](_0x4dcd87,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6c06('0x16')][_0x6c06('0x73')]=function(_0x10d59d){try{if(this[_0x6c06('0x2c')](_0x10d59d)){logger['debug'](_0x6c06('0x74'),_0x10d59d[_0x6c06('0x1a')],util[_0x6c06('0x27')](_0x10d59d,{'showHidden':![],'depth':null}));if(_0x10d59d[_0x6c06('0x75')]['toLowerCase']()===_0x6c06('0x76')){_0x10d59d[_0x6c06('0x77')]=(_0x10d59d['appdata']||_0x10d59d[_0x6c06('0x77')])[_0x6c06('0x78')]();if(_[_0x6c06('0x79')](_0x10d59d[_0x6c06('0x77')],_0x6c06('0x7a'))){if(_[_0x6c06('0x15')](this[_0x6c06('0xc')][_0x10d59d[_0x6c06('0x1a')]]))this[_0x6c06('0xc')][_0x10d59d[_0x6c06('0x1a')]]={};logger[_0x6c06('0x35')]('[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s',_0x10d59d[_0x6c06('0x1a')],_0x10d59d[_0x6c06('0x75')],_0x10d59d[_0x6c06('0x77')]);var _0x162511=_0x10d59d[_0x6c06('0x77')][_0x6c06('0x7b')]('=');var _0x4a57e6=_0x162511[0x0][_0x6c06('0x7c')](/cdr\((.*)\)/);if(_0x4a57e6)this[_0x6c06('0xc')][_0x10d59d[_0x6c06('0x1a')]][_0x4a57e6[0x1]]=_0x162511[0x1];}}}}catch(_0x5f222e){logger['error'](_0x6c06('0x7d'),_0x10d59d[_0x6c06('0x1a')],util[_0x6c06('0x27')](_0x5f222e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x6c06('0x16')][_0x6c06('0x6f')]=function(_0x3845f2,_0x5580d2=0x2710){if(this['channels'][_0x3845f2]){setTimeout(()=>{delete this[_0x6c06('0x9')][_0x3845f2];},_0x5580d2);}};module[_0x6c06('0x7e')]=VoiceDialReport; \ No newline at end of file +var _0xbf2b=['voice_outbound_channel:remove','deleteChannelAfterTimeout','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','syncNewExten','[%s][voiceDialReport][newexten]\x20event:','application','toLowerCase','set','startsWith','applicationdata','cdr(','[%s][voiceDialReport][newexten]\x20application:%s\x20appdata:%s','match','[%s][voiceDialReport][newexten]','exports','lodash','moment','util','ioredis','../../../config/environment','../ami','redis','localhost','socket.io-emitter','channels','outboundChannels','applications','variables','dialbegin','syncDialBegin','bind','dialend','syncVarSet','hangup','syncHangup','isNotNull','isUndefined','emit','prototype','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','format','YYYY-MM-DD\x20HH:mm:ss','channel','lastIndexOf','omit','event','privilege','info','membername','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','voice_outbound_channel:save','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','[%s][voiceDialReport][dialbegin]','syncDialEnd','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','answertime','lastevent','connect','substring','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','error','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','value','variable','outboundrouteid','voice','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','memberdynamic','memberinterface','memberlastcall','memberrealtime','isNil','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','duration','endtime','seconds','total','outbound','holdtime','diff','sumHoldTime','sumBillable','billableseconds','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','custom:dialend','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:','voice_outbound:save','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound_channel:remove\x20event:'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0xbf2b,0x103));var _0xbbf2=function(_0x61b923,_0x4940a5){_0x61b923=_0x61b923-0x0;var _0x32b4c0=_0xbf2b[_0x61b923];return _0x32b4c0;};'use strict';var _=require(_0xbbf2('0x0'));var moment=require(_0xbbf2('0x1'));var util=require(_0xbbf2('0x2'));var Redis=require(_0xbbf2('0x3'));var config=require(_0xbbf2('0x4'));var logger=require('../../../config/logger')('ami');var ami=require(_0xbbf2('0x5'));config['redis']=_['defaults'](config[_0xbbf2('0x6')],{'host':_0xbbf2('0x7'),'port':0x18eb});var io=require(_0xbbf2('0x8'))(new Redis(config[_0xbbf2('0x6')]));function VoiceDialReport(_0x35a355){this[_0xbbf2('0x9')]=_0x35a355[_0xbbf2('0xa')];this['outbound']=_0x35a355['outbound'];this[_0xbbf2('0xb')]={};this[_0xbbf2('0xc')]={};ami['on'](_0xbbf2('0xd'),this[_0xbbf2('0xe')][_0xbbf2('0xf')](this));ami['on'](_0xbbf2('0x10'),this['syncDialEnd'][_0xbbf2('0xf')](this));ami['on']('varset',this[_0xbbf2('0x11')]['bind'](this));ami['on'](_0xbbf2('0x12'),this[_0xbbf2('0x13')][_0xbbf2('0xf')](this));}VoiceDialReport['prototype'][_0xbbf2('0x14')]=function(_0x2c24b9){return _0x2c24b9!==null&&!_[_0xbbf2('0x15')](_0x2c24b9);};VoiceDialReport['prototype'][_0xbbf2('0x16')]=function(_0x2949fd,_0x8fa510,_0x20706b){io['to'](_0x2949fd)[_0xbbf2('0x16')](_0x8fa510,_0x20706b);};VoiceDialReport[_0xbbf2('0x17')][_0xbbf2('0xe')]=function(_0x1dfb50){try{if(this[_0xbbf2('0x14')](_0x1dfb50)){logger[_0xbbf2('0x18')](_0xbbf2('0x19'),_0x1dfb50[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](_0x1dfb50,{'showHidden':![],'depth':null}));if(this[_0xbbf2('0x9')][_0x1dfb50[_0xbbf2('0x1a')]]){_[_0xbbf2('0x1c')](this[_0xbbf2('0x9')][_0x1dfb50[_0xbbf2('0x1a')]],{'starttime':moment()[_0xbbf2('0x1d')](_0xbbf2('0x1e')),'lastevent':'called','interface':_0x1dfb50[_0xbbf2('0x1f')]['substring'](0x0,_0x1dfb50[_0xbbf2('0x1f')][_0xbbf2('0x20')]('-')),'membername':_0x1dfb50[_0xbbf2('0x1f')]['substring'](_0x1dfb50['channel'][_0xbbf2('0x20')]('/')+0x1,_0x1dfb50[_0xbbf2('0x1f')][_0xbbf2('0x20')]('-'))},_[_0xbbf2('0x21')](_0x1dfb50,[_0xbbf2('0x22'),_0xbbf2('0x23')]));logger[_0xbbf2('0x24')]('[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called',_0x1dfb50[_0xbbf2('0x1a')],this['channels'][_0x1dfb50[_0xbbf2('0x1a')]][_0xbbf2('0x25')],this[_0xbbf2('0x9')][_0x1dfb50[_0xbbf2('0x1a')]][_0xbbf2('0x26')]);logger['debug'](_0xbbf2('0x27'),_0x1dfb50[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this[_0xbbf2('0x9')][_0x1dfb50[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));if(this[_0xbbf2('0xb')][_0x1dfb50[_0xbbf2('0x1a')]])_[_0xbbf2('0x1c')](this[_0xbbf2('0x9')][_0x1dfb50['uniqueid']],this[_0xbbf2('0xb')][_0x1dfb50[_0xbbf2('0x1a')]]);this[_0xbbf2('0x16')](_0xbbf2('0x28'),_0xbbf2('0x29'),this['channels'][_0x1dfb50[_0xbbf2('0x1a')]]);logger[_0xbbf2('0x18')](_0xbbf2('0x2a'),_0x1dfb50[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this[_0xbbf2('0x9')][_0x1dfb50[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xbbf2('0x16')]('custom:dialbegin',this[_0xbbf2('0x9')][_0x1dfb50[_0xbbf2('0x1a')]]);}}}catch(_0xda1f3){logger['error'](_0xbbf2('0x2b'),_0x1dfb50['uniqueid'],util[_0xbbf2('0x1b')](_0xda1f3,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xbbf2('0x2c')]=function(_0xc1ad3d){try{if(this[_0xbbf2('0x14')](_0xc1ad3d)){logger['debug'](_0xbbf2('0x2d'),_0xc1ad3d[_0xbbf2('0x1a')],util['inspect'](_0xc1ad3d,{'showHidden':![],'depth':null}));if(this['channels'][_0xc1ad3d[_0xbbf2('0x1a')]]){this['channels'][_0xc1ad3d[_0xbbf2('0x1a')]][_0xbbf2('0x2e')]=_0xc1ad3d['dialstatus'];if(_0xc1ad3d[_0xbbf2('0x2e')]===_0xbbf2('0x2f')){this['channels'][_0xc1ad3d['uniqueid']][_0xbbf2('0x30')]=_0xc1ad3d[_0xbbf2('0x30')];this['channels'][_0xc1ad3d[_0xbbf2('0x1a')]][_0xbbf2('0x31')]=_0xc1ad3d[_0xbbf2('0x31')];this[_0xbbf2('0x9')][_0xc1ad3d[_0xbbf2('0x1a')]][_0xbbf2('0x32')]=moment()[_0xbbf2('0x1d')](_0xbbf2('0x1e'));this[_0xbbf2('0x9')][_0xc1ad3d['uniqueid']][_0xbbf2('0x33')]=_0xbbf2('0x34');logger[_0xbbf2('0x24')]('[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect',_0xc1ad3d[_0xbbf2('0x1a')],_0xc1ad3d[_0xbbf2('0x1f')][_0xbbf2('0x35')](_0xc1ad3d['channel'][_0xbbf2('0x20')]('/')+0x1,_0xc1ad3d[_0xbbf2('0x1f')][_0xbbf2('0x20')]('-')));logger['debug']('[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:',_0xc1ad3d[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this[_0xbbf2('0x9')][_0xc1ad3d['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xbbf2('0x16')]('custom:dialconnect',this['channels'][_0xc1ad3d['uniqueid']]);}logger[_0xbbf2('0x18')](_0xbbf2('0x36'),_0xc1ad3d[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this[_0xbbf2('0x9')][_0xc1ad3d[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));this[_0xbbf2('0x16')](_0xbbf2('0x28'),'voice_outbound_channel:save',this[_0xbbf2('0x9')][_0xc1ad3d[_0xbbf2('0x1a')]]);}}}catch(_0x2ca77b){logger[_0xbbf2('0x37')](_0xbbf2('0x38'),_0xc1ad3d[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](_0x2ca77b,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xbbf2('0x11')]=function(_0x524d4f){try{if(this[_0xbbf2('0x14')](_0x524d4f)){logger[_0xbbf2('0x18')](_0xbbf2('0x39'),_0x524d4f[_0xbbf2('0x1a')],util['inspect'](_0x524d4f,{'showHidden':![],'depth':null}));this['addVariable'](_0x524d4f[_0xbbf2('0x1a')],_['keys'](_0x524d4f['variable'])[0x0],_0x524d4f[_0xbbf2('0x3a')]);if(this['isNotNull'](_0x524d4f[_0xbbf2('0x3b')])&&this['isNotNull'](_0x524d4f[_0xbbf2('0x3b')][_0xbbf2('0x3c')])){if(_[_0xbbf2('0x15')](this[_0xbbf2('0x9')][_0x524d4f[_0xbbf2('0x1a')]])){this[_0xbbf2('0x9')][_0x524d4f[_0xbbf2('0x1a')]]={'routeId':_0x524d4f[_0xbbf2('0x3a')],'variables':this[_0xbbf2('0xc')][_0x524d4f[_0xbbf2('0x1a')]],'motionChannel':_0xbbf2('0x3d')};logger['info'](_0xbbf2('0x3e'),_0x524d4f[_0xbbf2('0x1a')],_0x524d4f[_0xbbf2('0x3b')][_0xbbf2('0x3c')],_[_0xbbf2('0x3f')](_0x524d4f['variable'])[0x0],_0x524d4f['value']);logger[_0xbbf2('0x18')](_0xbbf2('0x40'),_0x524d4f[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this[_0xbbf2('0x9')][_0x524d4f[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));this[_0xbbf2('0x16')](_0xbbf2('0x28'),'voice_outbound_channel:save',this[_0xbbf2('0x9')][_0x524d4f['uniqueid']]);}}}}catch(_0x3db160){logger['error'](_0xbbf2('0x41'),_0x524d4f[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](_0x3db160,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xbbf2('0x17')][_0xbbf2('0x42')]=function(_0x4c6c78,_0x2ef30e,_0x3330fa){var _0x47a0ca=[_0xbbf2('0x43'),_0xbbf2('0x44'),_0xbbf2('0x45'),_0xbbf2('0x46'),_0xbbf2('0x47'),_0xbbf2('0x48'),_0xbbf2('0x49'),'rtpaudioqosrttbridged',_0xbbf2('0x4a'),_0xbbf2('0x4b'),_0xbbf2('0x4c'),_0xbbf2('0x4d'),'membercalls',_0xbbf2('0x4e'),_0xbbf2('0x4f'),_0xbbf2('0x50'),_0xbbf2('0x25'),'memberpenalty',_0xbbf2('0x51')];if(!_[_0xbbf2('0x52')](_0x2ef30e)&&!_['includes'](_0x47a0ca,_0x2ef30e)){if(_[_0xbbf2('0x15')](this[_0xbbf2('0xc')][_0x4c6c78])){this['variables'][_0x4c6c78]={};}this['variables'][_0x4c6c78][_0x2ef30e]=_0x3330fa;}};VoiceDialReport[_0xbbf2('0x17')][_0xbbf2('0x13')]=function(_0x4ab54f){try{if(this[_0xbbf2('0x14')](_0x4ab54f)){logger['debug'](_0xbbf2('0x53'),_0x4ab54f['uniqueid'],util[_0xbbf2('0x1b')](_0x4ab54f,{'showHidden':![],'depth':null}));if(this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]]){logger['info'](_0xbbf2('0x54'),_0x4ab54f[_0xbbf2('0x1a')],_0x4ab54f[_0xbbf2('0x55')]);this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]]['endtime']=moment()[_0xbbf2('0x1d')](_0xbbf2('0x1e'));this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]][_0xbbf2('0x56')]=moment(this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]][_0xbbf2('0x57')])['diff'](this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]]['starttime'],_0xbbf2('0x58'));this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]][_0xbbf2('0x33')]='complete';this['outbound'][_0xbbf2('0x59')]+=0x1;if(this[_0xbbf2('0x9')][_0x4ab54f['uniqueid']]['answertime']){this[_0xbbf2('0x5a')]['answered']+=0x1;this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]][_0xbbf2('0x5b')]=moment(this['channels'][_0x4ab54f[_0xbbf2('0x1a')]][_0xbbf2('0x32')])[_0xbbf2('0x5c')](this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]]['starttime'],'seconds');this['channels'][_0x4ab54f['uniqueid']]['billableseconds']=moment(this['channels'][_0x4ab54f[_0xbbf2('0x1a')]]['endtime'])[_0xbbf2('0x5c')](this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]][_0xbbf2('0x32')],'seconds');this[_0xbbf2('0x5a')][_0xbbf2('0x5d')]+=this['channels'][_0x4ab54f[_0xbbf2('0x1a')]]['holdtime']||0x0;this[_0xbbf2('0x5a')][_0xbbf2('0x5e')]+=this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]][_0xbbf2('0x5f')];}this['outbound']['sumDuration']+=this[_0xbbf2('0x9')][_0x4ab54f['uniqueid']][_0xbbf2('0x56')];logger[_0xbbf2('0x18')](_0xbbf2('0x60'),_0x4ab54f[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xbbf2('0x16')](_0xbbf2('0x61'),this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]]);logger[_0xbbf2('0x18')]('[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:',_0x4ab54f[_0xbbf2('0x1a')],util['inspect'](this['channels'][_0x4ab54f[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));ami[_0xbbf2('0x16')](_0xbbf2('0x62'),this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]]);logger['debug'](_0xbbf2('0x63'),_0x4ab54f[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));this[_0xbbf2('0x16')](_0xbbf2('0x28'),_0xbbf2('0x64'),this[_0xbbf2('0x5a')]);logger['info'](_0xbbf2('0x65'),JSON[_0xbbf2('0x66')](this[_0xbbf2('0x9')][_0x4ab54f['uniqueid']]));logger[_0xbbf2('0x18')](_0xbbf2('0x67'),_0x4ab54f[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](this['channels'][_0x4ab54f[_0xbbf2('0x1a')]],{'showHidden':![],'depth':null}));this[_0xbbf2('0x16')](_0xbbf2('0x28'),_0xbbf2('0x68'),this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x1a')]]);this[_0xbbf2('0x69')](_0x4ab54f[_0xbbf2('0x1a')]);}else if(this[_0xbbf2('0x9')][_0x4ab54f['linkedid']]){this[_0xbbf2('0x9')][_0x4ab54f[_0xbbf2('0x6a')]][_0xbbf2('0x1a')]=this['channels'][_0x4ab54f[_0xbbf2('0x6a')]][_0xbbf2('0x6b')];}if(this['variables'][_0x4ab54f[_0xbbf2('0x1a')]]){delete this[_0xbbf2('0xc')][_0x4ab54f[_0xbbf2('0x1a')]];}}}catch(_0x2f54e8){logger['error'](_0xbbf2('0x6c'),_0x4ab54f[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](_0x2f54e8,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xbbf2('0x17')][_0xbbf2('0x6d')]=function(_0x46ee72){try{if(this[_0xbbf2('0x14')](_0x46ee72)){logger[_0xbbf2('0x18')](_0xbbf2('0x6e'),_0x46ee72[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](_0x46ee72,{'showHidden':![],'depth':null}));if(_0x46ee72[_0xbbf2('0x6f')][_0xbbf2('0x70')]()===_0xbbf2('0x71')){_0x46ee72['applicationdata']=(_0x46ee72['appdata']||_0x46ee72['applicationdata'])[_0xbbf2('0x70')]();if(_[_0xbbf2('0x72')](_0x46ee72[_0xbbf2('0x73')],_0xbbf2('0x74'))){if(_['isUndefined'](this[_0xbbf2('0xb')][_0x46ee72['uniqueid']]))this[_0xbbf2('0xb')][_0x46ee72[_0xbbf2('0x1a')]]={};logger[_0xbbf2('0x24')](_0xbbf2('0x75'),_0x46ee72['uniqueid'],_0x46ee72[_0xbbf2('0x6f')],_0x46ee72[_0xbbf2('0x73')]);var _0x984960=_0x46ee72[_0xbbf2('0x73')]['split']('=');var _0x2cc98a=_0x984960[0x0][_0xbbf2('0x76')](/cdr\((.*)\)/);if(_0x2cc98a)this[_0xbbf2('0xb')][_0x46ee72[_0xbbf2('0x1a')]][_0x2cc98a[0x1]]=_0x984960[0x1];}}}}catch(_0x15733b){logger[_0xbbf2('0x37')](_0xbbf2('0x77'),_0x46ee72[_0xbbf2('0x1a')],util[_0xbbf2('0x1b')](_0x15733b,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xbbf2('0x69')]=function(_0x195e65,_0x17e164=0x2710){if(this[_0xbbf2('0x9')][_0x195e65]){setTimeout(()=>{delete this[_0xbbf2('0x9')][_0x195e65];},_0x17e164);}};module[_0xbbf2('0x78')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 4da1481..b46a2b1 100644 --- a/server/services/ami/report/voiceQueueReport.js +++ b/server/services/ami/report/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc83f=['outbound','custom:queuesummary','syncQueueSummaryComplete','completeEvent','push','isNotNull','[voiceQueueReport][queuesummary]\x20event:','[voiceQueueReport][queuesummary]\x20name:%s','then','statusRequests','[voiceQueueReport][queuesummarycomplete]\x20event:','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','info','pick','keys','queuecallerjoin','[%s][voiceQueueReport][queuecallerjoin]','[%s][voiceQueueReport][queuecallerabandon]','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandon','queuecallerabandonAt','lastAssignedTo','queuecallerleaveAt','connectedlinenum','connectedlinename','[%s][voiceQueueReport][queuecallerleave]','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT','membername','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','add','seconds','FORWARDTRANSFER','transfertype','FORWARD','transferexten','destexten','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','[%s][voiceQueueReport][varset]','value','variable','CONTINUE','queuecallerexitAt','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','custom:timeout','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','includes','handleHangup','length','diff','milliseconds','total','answered','unmanaged','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','sumDuration','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','hangup','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','[%s][voiceQueueReport][handleHangup]','[%s][voiceQueueReport][hangup]','cause','cause-txt','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','transfereeuniqueid','secondtransfererexten','transferuniqueid','secondtransfereruniqueid','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','[%s][voiceQueueReport][attendedtransfer]','extension','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][blindtransfer]','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','[%s][voiceQueueReport][musiconholdstop]','[%s][voiceQueueReport][newexten]\x20event:','application','applicationdata','appdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','match','[%s][voiceQueueReport][newexten]','lodash','moment','util','ioredis','ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','queueReports','agents','queueChannels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','queuesummarycomplete','queuemember','syncQueueMember','bind','queuestatuscomplete','syncQueueCallerJoin','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','varset','syncVarSet','syncHangup','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallercomplete','clearZombieChannels','channels','switch','isNil','Action','status','channel','catch','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','inbound','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isUndefined','loopQueueShow','queues','[voiceQueueReport][queues]','actionid','isRunning','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','createReport','realtime','handleInboundQueueSummaryReport','compareToInboundQueue','assign','type'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc83f,0x83));var _0xfc83=function(_0x3cca3e,_0x950fc5){_0x3cca3e=_0x3cca3e-0x0;var _0x382338=_0xc83f[_0x3cca3e];return _0x382338;};'use strict';var _=require(_0xfc83('0x0'));var moment=require(_0xfc83('0x1'));var util=require(_0xfc83('0x2'));var Redis=require(_0xfc83('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xfc83('0x4'));var ami=require('../ami');var QueueReport=require(_0xfc83('0x5'));var VoiceQueueSummary=require(_0xfc83('0x6'));config[_0xfc83('0x7')]=_[_0xfc83('0x8')](config[_0xfc83('0x7')],{'host':_0xfc83('0x9'),'port':0x18eb});var io=require(_0xfc83('0xa'))(new Redis(config[_0xfc83('0x7')]));var Sequence=function(){};Sequence[_0xfc83('0xb')][_0xfc83('0xc')]=function(_0x4d224b){this['tail']=this[_0xfc83('0xd')]?this[_0xfc83('0xd')][_0xfc83('0xe')](_0x4d224b):_0x4d224b();};function VoiceQueueReport(_0x17db77){this[_0xfc83('0xf')]=new Sequence();this[_0xfc83('0x10')]={};this['realtime']=_0x17db77;this[_0xfc83('0x11')]=_0x17db77['agents'];this['channels']=_0x17db77[_0xfc83('0x12')];this[_0xfc83('0x13')]=_0x17db77[_0xfc83('0x13')];this['campaigns']=_0x17db77[_0xfc83('0x14')];this[_0xfc83('0x15')]=initializeSummary();this[_0xfc83('0x16')]={};ami['on'](_0xfc83('0x17'),this[_0xfc83('0x18')]['bind'](this));ami['on'](_0xfc83('0x19'),this['syncQueueSummaryComplete']['bind'](this));ami['on'](_0xfc83('0x1a'),this[_0xfc83('0x1b')][_0xfc83('0x1c')](this));ami['on'](_0xfc83('0x1d'),this['syncQueueStatusComplete'][_0xfc83('0x1c')](this));ami['on']('queuecallerjoin',this[_0xfc83('0x1e')]['bind'](this));ami['on']('queuecallerabandon',this[_0xfc83('0x1f')][_0xfc83('0x1c')](this));ami['on'](_0xfc83('0x20'),this[_0xfc83('0x21')]['bind'](this));ami['on'](_0xfc83('0x22'),this[_0xfc83('0x23')][_0xfc83('0x1c')](this));ami['on'](_0xfc83('0x24'),this[_0xfc83('0x25')][_0xfc83('0x1c')](this));ami['on'](_0xfc83('0x26'),this[_0xfc83('0x27')][_0xfc83('0x1c')](this));ami['on']('hangup',this[_0xfc83('0x28')][_0xfc83('0x1c')](this));ami['on']('fullybooted',this[_0xfc83('0x29')][_0xfc83('0x1c')](this));ami['on'](_0xfc83('0x2a'),this[_0xfc83('0x2b')]['bind'](this));ami['on'](_0xfc83('0x2c'),this[_0xfc83('0x2d')][_0xfc83('0x1c')](this));ami['on'](_0xfc83('0x2e'),this[_0xfc83('0x2f')][_0xfc83('0x1c')](this));ami['on'](_0xfc83('0x30'),this[_0xfc83('0x31')][_0xfc83('0x1c')](this));this[_0xfc83('0x32')]();this['loopQueueShow']();}function clearChannels(_0x120818){if(!_[_0xfc83('0x33')](_0x120818)){for(var _0x5cb724 in _0x120818){if(_0x120818[_0xfc83('0x34')](_0x5cb724)){delete _0x120818[_0x5cb724];}}}}function clearCampaigns(_0x1bc459){if(!_[_0xfc83('0x33')](_0x1bc459)){for(var _0x3b9d14 in _0x1bc459){if(_0x1bc459[_0xfc83('0x34')](_0x3b9d14)){_0x1bc459[_0x3b9d14][_0xfc83('0x35')]=0x0;}}}}function clearVoiceQueues(_0x35416c){if(!_[_0xfc83('0x33')](_0x35416c)){for(var _0x214759 in _0x35416c){if(_0x35416c[_0xfc83('0x34')](_0x214759)){_0x35416c[_0x214759][_0xfc83('0x35')]=0x0;_0x35416c[_0x214759][_0xfc83('0x36')]=0x0;_0x35416c[_0x214759][_0xfc83('0x37')]=0x0;_0x35416c[_0x214759][_0xfc83('0x38')]=0x0;_0x35416c[_0x214759][_0xfc83('0x39')]=!![];}}}}function clearAgentBooked(_0x4b072f){if(!_['isEmpty'](_0x4b072f)){for(var _0x2f827d in _0x4b072f){if(_0x4b072f[_0xfc83('0x34')](_0x2f827d)){_0x4b072f[_0x2f827d][_0xfc83('0x3a')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x1e53b1){return _0x1e53b1[_0xfc83('0x3b')]||_0x1e53b1['queuecallerabandon']||_0x1e53b1[_0xfc83('0x3c')];}VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x3d')]=function(){var _0x1ee38c=this;for(var _0x33882f in this[_0xfc83('0x3e')]){if(this[_0xfc83('0x3e')]['hasOwnProperty'](_0x33882f)&&!this[_0xfc83('0x3e')][_0x33882f][_0xfc83('0x3f')]){this[_0xfc83('0xf')][_0xfc83('0xc')](function(){if(!_[_0xfc83('0x40')](_0x1ee38c[_0xfc83('0x3e')][_0x33882f])){return ami[_0xfc83('0x41')]({'action':_0xfc83('0x42'),'channel':_0x1ee38c['channels'][_0x33882f][_0xfc83('0x43')]})[_0xfc83('0x44')](function(_0x272d2b){if(_0x272d2b['message']===_0xfc83('0x45')){setTimeout(function(){if(_0x1ee38c[_0xfc83('0x3e')][_0x33882f]){delete _0x1ee38c[_0xfc83('0x3e')][_0x33882f];logger[_0xfc83('0x46')](_0xfc83('0x47'),_0x33882f,util[_0xfc83('0x48')](_0x272d2b,{'showHidden':![],'depth':null}));}if(_0x1ee38c[_0xfc83('0x10')][_0x33882f]){delete _0x1ee38c['queueReports'][_0x33882f];logger[_0xfc83('0x46')](_0xfc83('0x49'),_0x33882f,util[_0xfc83('0x48')](_0x272d2b,{'showHidden':![],'depth':null}));}if(_0x1ee38c[_0xfc83('0x16')][_0x33882f]){delete _0x1ee38c[_0xfc83('0x16')][_0x33882f];logger[_0xfc83('0x46')](_0xfc83('0x4a'),_0x33882f,util[_0xfc83('0x48')](_0x272d2b,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x29')]=function(){logger['error']('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0xfc83('0x3e')]);this['clearQueueReport'](this['queueReports']);clearAgentBooked(this[_0xfc83('0x11')]);clearVoiceQueues(this[_0xfc83('0x13')]);clearCampaigns(this['campaigns']);this[_0xfc83('0x15')]=initializeSummary();};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x4b')]=function(_0x38ad4d){var _0x2c81fd=this;if(!_['isEmpty'](_0x38ad4d)){for(var _0x21992a in _0x38ad4d){if(_0x38ad4d[_0xfc83('0x34')](_0x21992a)){_0x2c81fd[_0xfc83('0x4c')](_0x38ad4d[_0x21992a],'clearqueuereport');delete _0x38ad4d[_0x21992a];}}}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x4d')]=function(_0x10a836,_0x5a62ff,_0x300798){io['to'](_0x10a836)[_0xfc83('0x4d')](_0x5a62ff,_0x300798);};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x4e')]=function(_0x7016d4,_0xe69f36){logger[_0xfc83('0x4f')](_0xfc83('0x50')+_0xe69f36+_0xfc83('0x51'),_0x7016d4[_0xfc83('0x52')],util['inspect'](_0x7016d4,{'showHidden':![],'depth':null}));this[_0xfc83('0x4d')](util[_0xfc83('0x53')](_0xfc83('0x54'),_0x7016d4[_0xfc83('0x55')]),'voice_queue_channel:save',_0x7016d4);io[_0xfc83('0x4d')](_0xfc83('0x56'),_0x7016d4);};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x4c')]=function(_0x207dc2,_0x1e13cc){logger[_0xfc83('0x4f')](_0xfc83('0x50')+_0x1e13cc+_0xfc83('0x57'),_0x207dc2['uniqueid'],util[_0xfc83('0x48')](_0x207dc2,{'showHidden':![],'depth':null}));if(_0x207dc2[_0xfc83('0x58')]===_0xfc83('0x59')){return;}this[_0xfc83('0x4d')](util[_0xfc83('0x53')](_0xfc83('0x54'),_0x207dc2[_0xfc83('0x55')]),_0xfc83('0x5a'),_0x207dc2);io[_0xfc83('0x4d')](_0xfc83('0x5b'),_0x207dc2);};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x5c')]=function(_0x16367b){if(_0x16367b['type']===_0xfc83('0x5d')){logger[_0xfc83('0x4f')](_0xfc83('0x5e'),util[_0xfc83('0x48')](_0x16367b,{'showHidden':![],'depth':null}));this[_0xfc83('0x4d')](util[_0xfc83('0x53')](_0xfc83('0x54'),_0x16367b[_0xfc83('0x5f')]),_0xfc83('0x60'),_0x16367b);}};VoiceQueueReport['prototype']['isNotNull']=function(_0x59085f){return _0x59085f!==null&&!_[_0xfc83('0x61')](_0x59085f);};VoiceQueueReport['prototype'][_0xfc83('0x62')]=function(){var _0xbcf5db=this;setInterval(function(){_0xbcf5db[_0xfc83('0x3d')]();ami[_0xfc83('0x41')]({'action':_0xfc83('0x63')})[_0xfc83('0x44')](function(_0x49ef81){logger[_0xfc83('0x46')](_0xfc83('0x64'),util['inspect'](_0x49ef81,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0xfc83('0xb')]['loopQueueSummary']=function(){var _0x258d5a=this;setInterval(function(){if(!_0x258d5a[_0xfc83('0x15')]['isRunning']){return ami['Action']({'action':'queuesummary'})['then'](function(_0x472075){_0x258d5a[_0xfc83('0x15')]['id']=_0x472075[_0xfc83('0x65')];_0x258d5a['summary'][_0xfc83('0x66')]=!![];_0x258d5a['summary'][_0xfc83('0x67')][_0x472075[_0xfc83('0x65')]]={};})[_0xfc83('0x44')](function(_0x3348db){logger[_0xfc83('0x46')](_0xfc83('0x68'),util['inspect'](_0x3348db,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x69')]=function(_0x31f958,_0x2a9e3b){var _0xeb49fd;if(this[_0xfc83('0x15')]&&this['summary']['queues']&&this[_0xfc83('0x15')]['queues'][_0x31f958['name']]){_0xeb49fd=this[_0xfc83('0x15')]['queues'][_0x31f958[_0xfc83('0x5f')]][_0xfc83('0x6a')];}var _0x1f5ff0=new VoiceQueueSummary(_0x31f958);return _0x1f5ff0[_0xfc83('0x6b')](_0x2a9e3b[_0xfc83('0x11')],this[_0xfc83('0x11')],_0xeb49fd,this[_0xfc83('0x6c')]['channels']);};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x6d')]=function(_0x317178,_0x354534){var _0x4196c5=this[_0xfc83('0x69')](_0x317178,_0x354534);var _0x5ade22=![];_0x5ade22=_0x4196c5[_0xfc83('0x6e')](_0x317178);if(_0x5ade22){Object[_0xfc83('0x6f')](_0x317178,_0x4196c5);this[_0xfc83('0x6c')]['voiceQueues'][_0x317178[_0xfc83('0x5f')]]=_0x317178;this[_0xfc83('0x5c')](_0x4196c5);}};VoiceQueueReport['prototype']['syncQueueStatusComplete']=function(_0x4997e1){var _0x7365de=null;var _0x42d843=this[_0xfc83('0x15')]['id'];if(this[_0xfc83('0x15')][_0xfc83('0x67')][_0x42d843]){_0x7365de=this[_0xfc83('0x15')][_0xfc83('0x67')][_0x42d843][_0x4997e1[_0xfc83('0x65')]];}if(!_0x7365de){this['summary']=initializeSummary();return;}var _0x1a0b99=this['voiceQueues'][_0x7365de[_0xfc83('0x55')]];if(_0x1a0b99['type']===_0xfc83('0x5d')){this[_0xfc83('0x6d')](_0x1a0b99,_0x7365de);}else if(_0x1a0b99[_0xfc83('0x70')]===_0xfc83('0x71')){var _0x329039=this[_0xfc83('0x69')](_0x1a0b99,_0x7365de);ami[_0xfc83('0x4d')](_0xfc83('0x72'),_0x329039);}this['summary']['statusRequests']-=0x1;var _0x2933c0=this[_0xfc83('0x15')]['statusRequests']>0x0?!![]:![];if(!_0x2933c0){return this[_0xfc83('0x73')](this[_0xfc83('0x15')][_0xfc83('0x74')]);}};VoiceQueueReport['prototype']['syncQueueMember']=function(_0xf2962b){var _0x56be8a=this[_0xfc83('0x15')]['id'];if(this[_0xfc83('0x15')][_0xfc83('0x67')][_0x56be8a]&&this['summary'][_0xfc83('0x67')][_0x56be8a][_0xf2962b[_0xfc83('0x65')]]){this[_0xfc83('0x15')][_0xfc83('0x67')][_0x56be8a][_0xf2962b[_0xfc83('0x65')]]['agents'][_0xfc83('0x75')](_0xf2962b);}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x18')]=function(_0x206186){var _0x30437a=this;try{if(this[_0xfc83('0x76')](_0x206186)&&this['isNotNull'](_0x206186['queue'])){logger[_0xfc83('0x4f')](_0xfc83('0x77'),util[_0xfc83('0x48')](_0x206186,{'showHidden':![],'depth':null}));var _0x12b4ce=this[_0xfc83('0x13')][_0x206186[_0xfc83('0x55')]];if(_0x12b4ce){logger[_0xfc83('0x4f')](_0xfc83('0x78'),_0x12b4ce[_0xfc83('0x5f')]);this[_0xfc83('0x15')]['queues'][_0x12b4ce[_0xfc83('0x5f')]]={'summaryEvent':_0x206186};this[_0xfc83('0x15')]['statusRequests']+=0x1;return ami[_0xfc83('0x41')]({'action':_0xfc83('0x67'),'queue':_0x12b4ce['name']})[_0xfc83('0x79')](function(_0x2af460){if(!_0x30437a[_0xfc83('0x15')][_0xfc83('0x67')][_0x206186['actionid']]){_0x30437a[_0xfc83('0x15')][_0xfc83('0x67')][_0x206186[_0xfc83('0x65')]]={};}_0x30437a[_0xfc83('0x15')][_0xfc83('0x67')][_0x206186[_0xfc83('0x65')]][_0x2af460['actionid']]={'queue':_0x12b4ce[_0xfc83('0x5f')],'agents':[]};})['catch'](function(_0x5a229e){throw _0x5a229e;});}}}catch(_0x1f9090){logger[_0xfc83('0x46')](_0xfc83('0x68'),util[_0xfc83('0x48')](_0x1f9090,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x73')]=function(_0x15fd1b){if(this[_0xfc83('0x15')][_0xfc83('0x7a')]>0x0){this[_0xfc83('0x15')][_0xfc83('0x74')]=_0x15fd1b;return;}logger[_0xfc83('0x4f')](_0xfc83('0x7b'),util['inspect'](_0x15fd1b,{'showHidden':![],'depth':null}));this[_0xfc83('0x15')]=initializeSummary();ami[_0xfc83('0x4d')]('custom:queuesummarycomplete',{});};VoiceQueueReport['prototype'][_0xfc83('0x1e')]=function(_0x477845){try{if(this[_0xfc83('0x76')](_0x477845)){logger[_0xfc83('0x4f')]('[%s][voiceQueueReport][queuecallerjoin]',_0x477845[_0xfc83('0x52')],util[_0xfc83('0x48')](_0x477845,{'showHidden':![],'depth':null}));if(_[_0xfc83('0x61')](this[_0xfc83('0x10')][_0x477845[_0xfc83('0x52')]])){this[_0xfc83('0x10')][_0x477845[_0xfc83('0x52')]]=[];}if(_['isUndefined'](this[_0xfc83('0x3e')][_0x477845[_0xfc83('0x52')]])){this[_0xfc83('0x3e')][_0x477845[_0xfc83('0x52')]]={};}var _0x4b4b55=new QueueReport();_0x4b4b55[_0xfc83('0x55')]=_0x477845[_0xfc83('0x55')];_0x4b4b55[_0xfc83('0x70')]=this[_0xfc83('0x13')][_0x4b4b55[_0xfc83('0x55')]]&&this[_0xfc83('0x13')][_0x4b4b55[_0xfc83('0x55')]][_0xfc83('0x70')]?this[_0xfc83('0x13')][_0x4b4b55[_0xfc83('0x55')]][_0xfc83('0x70')]||_0xfc83('0x5d'):_0xfc83('0x5d');_0x4b4b55[_0xfc83('0x7c')]=moment()[_0xfc83('0x53')](_0xfc83('0x7d'));_0x4b4b55[_0xfc83('0x7e')]=_0x477845[_0xfc83('0x7e')];_0x4b4b55['count']=_0x477845[_0xfc83('0x7f')];_0x4b4b55[_0xfc83('0x52')]=_0x477845['uniqueid'];logger[_0xfc83('0x80')]('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x4b4b55[_0xfc83('0x55')],_0x4b4b55['type']);Object[_0xfc83('0x6f')](_0x4b4b55,_[_0xfc83('0x81')](_0x477845,_[_0xfc83('0x82')](_0x4b4b55)));this[_0xfc83('0x10')][_0x477845[_0xfc83('0x52')]][_0xfc83('0x75')](_0x4b4b55);this[_0xfc83('0x3e')][_0x477845[_0xfc83('0x52')]]=_0x4b4b55;this['emitVoiceQueueChannelSave'](_0x4b4b55,_0xfc83('0x83'));}}catch(_0x540ead){logger[_0xfc83('0x46')](_0xfc83('0x84'),_0x477845['uniqueid'],util[_0xfc83('0x48')](_0x540ead,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x1f')]=function(_0x4e4e75){try{if(this[_0xfc83('0x76')](_0x4e4e75)){logger['debug'](_0xfc83('0x85'),_0x4e4e75[_0xfc83('0x52')],util[_0xfc83('0x48')](_0x4e4e75,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4e4e75['uniqueid']]){var _0x39be53=_[_0xfc83('0x86')](this[_0xfc83('0x10')][_0x4e4e75['uniqueid']]);_0x39be53[_0xfc83('0x3c')]=![];_0x39be53[_0xfc83('0x87')]=null;_0x39be53[_0xfc83('0x88')]=_0x4e4e75[_0xfc83('0x88')];_0x39be53[_0xfc83('0x89')]=_0x4e4e75[_0xfc83('0x89')];_0x39be53[_0xfc83('0x8a')]=!![];_0x39be53[_0xfc83('0x8b')]=moment()[_0xfc83('0x53')](_0xfc83('0x7d'));_0x39be53['queuecallerexitreason']='ABANDONED';_0x39be53[_0xfc83('0x8c')]=null;logger[_0xfc83('0x80')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x39be53[_0xfc83('0x55')],_0x39be53[_0xfc83('0x70')]);this['channels'][_0x4e4e75['uniqueid']]=_0x39be53;this[_0xfc83('0x4c')](_0x39be53,'queuecallerabandon');}}}catch(_0xccd9d0){logger[_0xfc83('0x46')](_0xfc83('0x85'),_0x4e4e75[_0xfc83('0x52')],util[_0xfc83('0x48')](_0xccd9d0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x21')]=function(_0x4d6c9c){try{if(this[_0xfc83('0x76')](_0x4d6c9c)){logger['debug']('[%s][voiceQueueReport][queuecallerleave]',_0x4d6c9c[_0xfc83('0x52')],util[_0xfc83('0x48')](_0x4d6c9c,{'showHidden':![],'depth':null}));if(this[_0xfc83('0x10')][_0x4d6c9c[_0xfc83('0x52')]]){var _0x5f0d5f=_[_0xfc83('0x86')](this[_0xfc83('0x10')][_0x4d6c9c[_0xfc83('0x52')]]);_0x5f0d5f[_0xfc83('0x8d')]=moment()[_0xfc83('0x53')](_0xfc83('0x7d'));_0x5f0d5f[_0xfc83('0x8e')]=_0x4d6c9c['connectedlinenum'];_0x5f0d5f[_0xfc83('0x8f')]=_0x4d6c9c[_0xfc83('0x8f')];logger[_0xfc83('0x80')]('[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x5f0d5f[_0xfc83('0x55')],_0x5f0d5f['type'],_0x4d6c9c[_0xfc83('0x8e')],_0x4d6c9c[_0xfc83('0x8f')]);this[_0xfc83('0x3e')][_0x4d6c9c[_0xfc83('0x52')]]=_0x5f0d5f;this['emitVoiceQueueChannelSave'](_0x5f0d5f,_0xfc83('0x20'));}}}catch(_0x1199b8){logger[_0xfc83('0x46')](_0xfc83('0x90'),_0x4d6c9c[_0xfc83('0x52')],util[_0xfc83('0x48')](_0x1199b8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x25')]=function(_0x536f4e){try{if(this[_0xfc83('0x76')](_0x536f4e)){logger[_0xfc83('0x4f')](_0xfc83('0x91'),_0x536f4e[_0xfc83('0x52')],util[_0xfc83('0x48')](_0x536f4e,{'showHidden':![],'depth':null}));if(this[_0xfc83('0x10')][_0x536f4e['uniqueid']]){var _0x16231d=_[_0xfc83('0x86')](this['queueReports'][_0x536f4e[_0xfc83('0x52')]]);_0x16231d[_0xfc83('0x3c')]=!![];_0x16231d[_0xfc83('0x58')]=_0xfc83('0x92');logger['info'](_0xfc83('0x93'),_0x16231d[_0xfc83('0x55')],_0x16231d[_0xfc83('0x70')]);}}}catch(_0x4600f2){logger['error'](_0xfc83('0x91'),_0x536f4e[_0xfc83('0x52')],util['inspect'](_0x4600f2,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x23')]=function(_0x27c489){try{if(this[_0xfc83('0x76')](_0x27c489)){logger[_0xfc83('0x4f')]('[%s][voiceQueueReport][agentcomplete]',_0x27c489[_0xfc83('0x52')],util[_0xfc83('0x48')](_0x27c489,{'showHidden':![],'depth':null}));if(this[_0xfc83('0x10')][_0x27c489[_0xfc83('0x52')]]){var _0x1490e8=_[_0xfc83('0x86')](this[_0xfc83('0x10')][_0x27c489[_0xfc83('0x52')]]);_0x1490e8[_0xfc83('0x8a')]=![];_0x1490e8[_0xfc83('0x8b')]=null;_0x1490e8['assigned']=!![];_0x1490e8[_0xfc83('0x8c')]=_0x27c489[_0xfc83('0x94')];_0x1490e8['holdtime']=_0x27c489['holdtime'];_0x1490e8[_0xfc83('0x3c')]=!![];_0x1490e8[_0xfc83('0x3b')]=![];_0x1490e8['queuecallerexitAt']=null;if(!_0x1490e8[_0xfc83('0x95')]){if(_0x27c489[_0xfc83('0x96')]=='transfer'){_0x1490e8[_0xfc83('0x58')]=_0xfc83('0x97');logger[_0xfc83('0x80')](_0xfc83('0x98'),_0x1490e8['queue'],_0x1490e8[_0xfc83('0x70')]);}else{if(_[_0xfc83('0x99')](_0x27c489['channel'][_0xfc83('0x9a')](),_0xfc83('0x9b'))){if(this['queueReports'][_0x27c489['linkedid']]){var _0x297904=_['last'](this[_0xfc83('0x10')][_0x27c489[_0xfc83('0x9c')]]);_0x297904[_0xfc83('0x3c')]=![];_0x297904[_0xfc83('0x3b')]=!![];_0x297904['queuecallerexitAt']=moment(_0x1490e8[_0xfc83('0x7c')])[_0xfc83('0x9d')](_0x27c489['holdtime'],_0xfc83('0x9e'))[_0xfc83('0x53')](_0xfc83('0x7d'));_0x297904[_0xfc83('0x58')]=_0xfc83('0x9f');_0x297904['transfer']=!![];_0x297904[_0xfc83('0xa0')]=_0xfc83('0xa1');_0x297904[_0xfc83('0xa2')]=_0x27c489[_0xfc83('0xa3')];_0x297904['transferuniqueid']=_0x27c489['uniqueid'];logger[_0xfc83('0x80')](_0xfc83('0xa4'),_0x297904['queue'],_0x297904[_0xfc83('0x70')]);var _0x4509cb=this[_0xfc83('0x10')][_0x27c489['linkedid']];this[_0xfc83('0x10')][_0x27c489[_0xfc83('0x9c')]]=this['queueReports'][_0x27c489[_0xfc83('0x52')]];this[_0xfc83('0x10')][_0x27c489[_0xfc83('0x52')]]=_0x4509cb;}}else{_0x1490e8[_0xfc83('0x58')]='COMPLETEDBY'+_0x27c489[_0xfc83('0x96')]['toUpperCase']();logger[_0xfc83('0x80')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x1490e8[_0xfc83('0x55')],_0x1490e8[_0xfc83('0x70')],_0x1490e8[_0xfc83('0x58')]);}}}this[_0xfc83('0x3e')][_0x27c489['uniqueid']]=_0x1490e8;}}}catch(_0x461f2a){logger[_0xfc83('0x46')]('[%s][voiceQueueReport][agentcomplete]',_0x27c489['uniqueid'],util[_0xfc83('0x48')](_0x461f2a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0x27')]=function(_0xc96c99){try{if(this[_0xfc83('0x76')](_0xc96c99)){logger[_0xfc83('0x4f')](_0xfc83('0xa5'),_0xc96c99['uniqueid'],util['inspect'](_0xc96c99,{'showHidden':![],'depth':null}));this['addVariable'](_0xc96c99['uniqueid'],_[_0xfc83('0x82')](_0xc96c99['variable'])[0x0],_0xc96c99[_0xfc83('0xa6')]);if(this['queueReports'][_0xc96c99[_0xfc83('0x52')]]){var _0x1759f3=_[_0xfc83('0x86')](this[_0xfc83('0x10')][_0xc96c99[_0xfc83('0x52')]]);if(_0x1759f3){if(this['isNotNull'](_0xc96c99[_0xfc83('0xa7')])&&this[_0xfc83('0x76')](_0xc96c99[_0xfc83('0xa7')][_0xfc83('0x67')])){switch(_0xc96c99[_0xfc83('0xa6')]){case _0xfc83('0xa8'):_0x1759f3[_0xfc83('0x3b')]=![];_0x1759f3[_0xfc83('0xa9')]=null;break;case'TIMEOUT':_0x1759f3[_0xfc83('0xaa')]=_0xfc83('0xab');_0x1759f3['queuecallerexit']=!![];_0x1759f3[_0xfc83('0xa9')]=moment()['format'](_0xfc83('0x7d'));_0x1759f3[_0xfc83('0x8d')]=moment()[_0xfc83('0x53')]('YYYY-MM-DD\x20HH:mm:ss');logger[_0xfc83('0x4f')](_0xfc83('0xac'),_0xc96c99[_0xfc83('0x52')],util[_0xfc83('0x48')](_0x1759f3,{'showHidden':![],'depth':null}));ami[_0xfc83('0x4d')](_0xfc83('0xad'),_0x1759f3);break;default:_0x1759f3[_0xfc83('0x3b')]=!![];_0x1759f3['queuecallerexitAt']=moment()[_0xfc83('0x53')](_0xfc83('0x7d'));_0x1759f3[_0xfc83('0x8d')]=moment()[_0xfc83('0x53')](_0xfc83('0x7d'));}_0x1759f3[_0xfc83('0x8a')]=![];_0x1759f3['queuecallerabandonAt']=null;_0x1759f3[_0xfc83('0x58')]=_0xc96c99[_0xfc83('0xa6')];this['channels'][_0xc96c99[_0xfc83('0x52')]]=_0x1759f3;this[_0xfc83('0x4c')](_0x1759f3,'varset');}else if(this[_0xfc83('0x76')](_0xc96c99[_0xfc83('0xa7')])&&this[_0xfc83('0x76')](_0xc96c99['variable'][_0xfc83('0xae')])){if(!_0x1759f3[_0xfc83('0x8a')]){_0x1759f3['queuecallerexit']=!![];_0x1759f3[_0xfc83('0xa9')]=moment()[_0xfc83('0x53')](_0xfc83('0x7d'));_0x1759f3[_0xfc83('0x58')]=_0xfc83('0xaf');_0x1759f3[_0xfc83('0x8d')]=moment()[_0xfc83('0x53')](_0xfc83('0x7d'));this[_0xfc83('0x3e')][_0xc96c99[_0xfc83('0x52')]]=_0x1759f3;}}logger[_0xfc83('0x80')](_0xfc83('0xb0'),_0xc96c99['uniqueid'],_0x1759f3['queue'],_0x1759f3[_0xfc83('0x70')],_['keys'](_0xc96c99[_0xfc83('0xa7')])[0x0],_0xc96c99[_0xfc83('0xa6')]);_0x1759f3[_0xfc83('0x16')]=this[_0xfc83('0x16')][_0xc96c99[_0xfc83('0x52')]];}}}}catch(_0x1fc33d){logger[_0xfc83('0x46')](_0xfc83('0xa5'),_0xc96c99[_0xfc83('0x52')],util['inspect'](_0x1fc33d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xfc83('0xb')][_0xfc83('0xb1')]=function(_0x1447c8,_0x185a36,_0x19e962){var _0x379b94=[_0xfc83('0xb2'),_0xfc83('0xb3'),_0xfc83('0xb4'),'rtpaudioqosjitterbridged',_0xfc83('0xb5'),_0xfc83('0xb6'),'rtpaudioqosrtt',_0xfc83('0xb7'),_0xfc83('0xb8'),'sipuri','bridgepeer','bridgepvtcallid','membercalls',_0xfc83('0xb9'),_0xfc83('0xba'),_0xfc83('0xbb'),_0xfc83('0x94'),_0xfc83('0xbc'),_0xfc83('0xbd')];if(!_[_0xfc83('0x40')](_0x185a36)&&!_[_0xfc83('0xbe')](_0x379b94,_0x185a36)){if(_[_0xfc83('0x61')](this[_0xfc83('0x16')][_0x1447c8])){this[_0xfc83('0x16')][_0x1447c8]={};}this[_0xfc83('0x16')][_0x1447c8][_0x185a36]=_0x19e962;}};VoiceQueueReport['prototype'][_0xfc83('0xbf')]=function(_0x4f56c1,_0x160bc0,_0xfcb9b7){try{var _0x3d0eb9={};if(this[_0xfc83('0x10')][_0x4f56c1]){for(var _0x188384=0x0;_0x188384{delete this[_0xfc83('0x3e')][_0x510b18];},_0x369cfe);}};module['exports']=VoiceQueueReport; \ No newline at end of file +var _0xf316=['last','queuecallercomplete','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','ABANDONED','lastAssignedTo','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinename','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','assigned','membername','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','queuecallerexitAt','add','seconds','FORWARDTRANSFER','transfertype','destexten','transferuniqueid','COMPLETEDBY','toUpperCase','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s','syncVarSet','[%s][voiceQueueReport][varset]','addVariable','value','variable','lastevent','timeout','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queuecallerleaveAt','queueposition','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberlastcall','memberpenalty','isNil','handleHangup','length','sumHoldTime','queuecallerjoinAt','sumDuration','milliseconds','total','answered','sumBillable','unmanaged','custom:queuecallerunmanaged','abandoned','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','custom:queuecallerabandon','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','[%s][voiceQueueReport][hangup]\x20sending\x20voiceQueueReport\x20event:','custom:voiceQueueReport','deleteChannelAfterTimeout','cause-txt','cause','transferid','[%s][voiceQueueReport][syncHangup]\x20No\x20available\x20data\x20in\x20queueReports\x20structure:\x20clear\x20action\x20in\x20variablea\x20and\x20channels\x20structures\x20needed','[%s][voiceQueueReport][hangup]','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','transferexten','secondtransfereruniqueid','ATTENDED','switch','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','secondtransfererexten','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','extension','[%s][voiceQueueReport][blindTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','BlindTransfer','context','transfererchannel','[%s][voiceQueueReport][musiconholdstart]','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohstarttime','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','syncNewExten','[%s][voiceQueueReport][newexten]\x20event:','application','applicationdata','cdr(','[%s][voiceQueueReport][newexten]\x20application:%s\x20appdata:%s','split','[%s][voiceQueueReport][newexten]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','../model/queueReport','../model/voiceQueueSummary','redis','defaults','localhost','socket.io-emitter','enqueue','tail','finally','queueReports','agents','queueChannels','voiceQueues','campaigns','summary','variables','queuesummary','syncQueueSummary','bind','syncQueueSummaryComplete','syncQueueMember','queuestatuscomplete','queuecallerjoin','syncQueueCallerJoin','queuecallerleave','syncQueueCallerLeave','syncAgentComplete','agentconnect','syncAgentConnect','varset','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueSummary','loopQueueShow','hasOwnProperty','isEmpty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','queuecallerexit','queuecallerabandon','prototype','channels','sequence','channel','catch','[%s][voiceQueueReport][checkChannel]','inspect','error','[%s][voiceQueueReport][checkQueueReport]','[%s][voiceQueueReport][checkVariables]','clearQueueReport','emitVoiceQueueChannelRemove','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','uniqueid','format','voice:queue:%s','queue','voice_queue_channel:save','voice_queue_presence:save',']\x20sending\x20voice_queue_channel:remove\x20event:','queuecallerexitreason','ATTENDEDTRANSFER','voice_queue_channel:remove','voice_queue_presence:remove','emitInboundVoiceQueueSummary','type','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','name','voice_queue:save','isNotNull','isUndefined','Action','queues','then','actionid','queuestatus','[voiceQueueReport][queuesummary]','createQueueSummaryReport','summaryEvent','realtime','handleInboundQueueSummaryReport','assign','inbound','outbound','custom:queuesummary','completeEvent','statusRequests','[voiceQueueReport][queuesummarycomplete]\x20event:','custom:queuesummarycomplete','[%s][voiceQueueReport][queuecallerjoin]','YYYY-MM-DD\x20HH:mm:ss','position','count','info','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','keys','syncQueueCallerAbandon','[%s][voiceQueueReport][queuecallerabandon]'];(function(_0x366a0a,_0x2acd21){var _0x523049=function(_0x1b46ca){while(--_0x1b46ca){_0x366a0a['push'](_0x366a0a['shift']());}};_0x523049(++_0x2acd21);}(_0xf316,0x162));var _0x6f31=function(_0x3ab324,_0x135e8a){_0x3ab324=_0x3ab324-0x0;var _0x30c172=_0xf316[_0x3ab324];return _0x30c172;};'use strict';var _=require(_0x6f31('0x0'));var moment=require(_0x6f31('0x1'));var util=require(_0x6f31('0x2'));var Redis=require('ioredis');var config=require(_0x6f31('0x3'));var logger=require(_0x6f31('0x4'))(_0x6f31('0x5'));var ami=require(_0x6f31('0x6'));var QueueReport=require(_0x6f31('0x7'));var VoiceQueueSummary=require(_0x6f31('0x8'));config[_0x6f31('0x9')]=_[_0x6f31('0xa')](config[_0x6f31('0x9')],{'host':_0x6f31('0xb'),'port':0x18eb});var io=require(_0x6f31('0xc'))(new Redis(config[_0x6f31('0x9')]));var Sequence=function(){};Sequence['prototype'][_0x6f31('0xd')]=function(_0xe8940a){this[_0x6f31('0xe')]=this[_0x6f31('0xe')]?this['tail'][_0x6f31('0xf')](_0xe8940a):_0xe8940a();};function VoiceQueueReport(_0x48e1b5){this['sequence']=new Sequence();this[_0x6f31('0x10')]={};this['realtime']=_0x48e1b5;this[_0x6f31('0x11')]=_0x48e1b5[_0x6f31('0x11')];this['channels']=_0x48e1b5[_0x6f31('0x12')];this[_0x6f31('0x13')]=_0x48e1b5[_0x6f31('0x13')];this[_0x6f31('0x14')]=_0x48e1b5[_0x6f31('0x14')];this[_0x6f31('0x15')]=initializeSummary();this[_0x6f31('0x16')]={};ami['on'](_0x6f31('0x17'),this[_0x6f31('0x18')][_0x6f31('0x19')](this));ami['on']('queuesummarycomplete',this[_0x6f31('0x1a')][_0x6f31('0x19')](this));ami['on']('queuemember',this[_0x6f31('0x1b')]['bind'](this));ami['on'](_0x6f31('0x1c'),this['syncQueueStatusComplete'][_0x6f31('0x19')](this));ami['on'](_0x6f31('0x1d'),this[_0x6f31('0x1e')][_0x6f31('0x19')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x6f31('0x19')](this));ami['on'](_0x6f31('0x1f'),this[_0x6f31('0x20')][_0x6f31('0x19')](this));ami['on']('agentcomplete',this[_0x6f31('0x21')][_0x6f31('0x19')](this));ami['on'](_0x6f31('0x22'),this[_0x6f31('0x23')]['bind'](this));ami['on'](_0x6f31('0x24'),this['syncVarSet'][_0x6f31('0x19')](this));ami['on'](_0x6f31('0x25'),this[_0x6f31('0x26')][_0x6f31('0x19')](this));ami['on'](_0x6f31('0x27'),this[_0x6f31('0x28')]['bind'](this));ami['on'](_0x6f31('0x29'),this[_0x6f31('0x2a')]['bind'](this));ami['on'](_0x6f31('0x2b'),this[_0x6f31('0x2c')]['bind'](this));ami['on']('attendedtransfer',this[_0x6f31('0x2d')]['bind'](this));ami['on'](_0x6f31('0x2e'),this[_0x6f31('0x2f')]['bind'](this));this[_0x6f31('0x30')]();this[_0x6f31('0x31')]();}function clearChannels(_0x25631f){if(!_['isEmpty'](_0x25631f)){for(var _0x318b05 in _0x25631f){if(_0x25631f['hasOwnProperty'](_0x318b05)){delete _0x25631f[_0x318b05];}}}}function clearCampaigns(_0x201724){if(!_['isEmpty'](_0x201724)){for(var _0x8243ce in _0x201724){if(_0x201724[_0x6f31('0x32')](_0x8243ce)){_0x201724[_0x8243ce]['originated']=0x0;}}}}function clearVoiceQueues(_0x491a19){if(!_[_0x6f31('0x33')](_0x491a19)){for(var _0x4da831 in _0x491a19){if(_0x491a19['hasOwnProperty'](_0x4da831)){_0x491a19[_0x4da831][_0x6f31('0x34')]=0x0;_0x491a19[_0x4da831][_0x6f31('0x35')]=0x0;_0x491a19[_0x4da831][_0x6f31('0x36')]=0x0;_0x491a19[_0x4da831][_0x6f31('0x37')]=0x0;_0x491a19[_0x4da831][_0x6f31('0x38')]=!![];}}}}function clearAgentBooked(_0x314eac){if(!_[_0x6f31('0x33')](_0x314eac)){for(var _0xfdd99e in _0x314eac){if(_0x314eac[_0x6f31('0x32')](_0xfdd99e)){_0x314eac[_0xfdd99e][_0x6f31('0x39')]=!![];}}}}function initializeSummary(){return{'id':null,'completeEvent':null,'isRunning':![],'queues':{},'queuestatus':{},'statusRequests':0x0};}function hasCallerLeftTheQueue(_0x241dae){return _0x241dae[_0x6f31('0x3a')]||_0x241dae[_0x6f31('0x3b')]||_0x241dae['queuecallercomplete'];}VoiceQueueReport[_0x6f31('0x3c')]['clearZombieChannels']=function(){var _0x5db6ce=this;for(var _0xfbc041 in this['channels']){if(this[_0x6f31('0x3d')]['hasOwnProperty'](_0xfbc041)&&!this['channels'][_0xfbc041]['switch']){this[_0x6f31('0x3e')]['enqueue'](function(){if(!_['isNil'](_0x5db6ce[_0x6f31('0x3d')][_0xfbc041])){return ami['Action']({'action':'status','channel':_0x5db6ce['channels'][_0xfbc041][_0x6f31('0x3f')]})[_0x6f31('0x40')](function(_0x13d857){if(_0x13d857['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0x5db6ce['channels'][_0xfbc041]){delete _0x5db6ce[_0x6f31('0x3d')][_0xfbc041];logger['error'](_0x6f31('0x41'),_0xfbc041,util[_0x6f31('0x42')](_0x13d857,{'showHidden':![],'depth':null}));}if(_0x5db6ce[_0x6f31('0x10')][_0xfbc041]){delete _0x5db6ce['queueReports'][_0xfbc041];logger[_0x6f31('0x43')](_0x6f31('0x44'),_0xfbc041,util[_0x6f31('0x42')](_0x13d857,{'showHidden':![],'depth':null}));}if(_0x5db6ce[_0x6f31('0x16')][_0xfbc041]){delete _0x5db6ce[_0x6f31('0x16')][_0xfbc041];logger[_0x6f31('0x43')](_0x6f31('0x45'),_0xfbc041,util[_0x6f31('0x42')](_0x13d857,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x28')]=function(){logger[_0x6f31('0x43')]('[FullyBooted]\x20clear\x20realtime');clearChannels(this[_0x6f31('0x3d')]);this[_0x6f31('0x46')](this['queueReports']);clearAgentBooked(this[_0x6f31('0x11')]);clearVoiceQueues(this[_0x6f31('0x13')]);clearCampaigns(this['campaigns']);this[_0x6f31('0x15')]=initializeSummary();};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x46')]=function(_0x204c3e){var _0x32fadd=this;if(!_['isEmpty'](_0x204c3e)){for(var _0x53bff2 in _0x204c3e){if(_0x204c3e['hasOwnProperty'](_0x53bff2)){_0x32fadd[_0x6f31('0x47')](_0x204c3e[_0x53bff2],'clearqueuereport');delete _0x204c3e[_0x53bff2];}}}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x48')]=function(_0x35ad0a,_0x2d4735,_0x4ea370){io['to'](_0x35ad0a)[_0x6f31('0x48')](_0x2d4735,_0x4ea370);};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x49')]=function(_0x4a90a,_0x16715a){logger[_0x6f31('0x4a')](_0x6f31('0x4b')+_0x16715a+_0x6f31('0x4c'),_0x4a90a[_0x6f31('0x4d')],util['inspect'](_0x4a90a,{'showHidden':![],'depth':null}));this[_0x6f31('0x48')](util[_0x6f31('0x4e')](_0x6f31('0x4f'),_0x4a90a[_0x6f31('0x50')]),_0x6f31('0x51'),_0x4a90a);io[_0x6f31('0x48')](_0x6f31('0x52'),_0x4a90a);};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x47')]=function(_0x50ef79,_0x3aec8c){logger[_0x6f31('0x4a')](_0x6f31('0x4b')+_0x3aec8c+_0x6f31('0x53'),_0x50ef79[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x50ef79,{'showHidden':![],'depth':null}));if(_0x50ef79[_0x6f31('0x54')]===_0x6f31('0x55')){return;}this[_0x6f31('0x48')](util[_0x6f31('0x4e')]('voice:queue:%s',_0x50ef79[_0x6f31('0x50')]),_0x6f31('0x56'),_0x50ef79);io[_0x6f31('0x48')](_0x6f31('0x57'),_0x50ef79);};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x58')]=function(_0x4ee819){if(_0x4ee819[_0x6f31('0x59')]==='inbound'){logger['debug'](_0x6f31('0x5a'),util[_0x6f31('0x42')](_0x4ee819,{'showHidden':![],'depth':null}));this['emit'](util[_0x6f31('0x4e')](_0x6f31('0x4f'),_0x4ee819[_0x6f31('0x5b')]),_0x6f31('0x5c'),_0x4ee819);}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x5d')]=function(_0x1dc1dd){return _0x1dc1dd!==null&&!_[_0x6f31('0x5e')](_0x1dc1dd);};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x31')]=function(){var _0x30b85c=this;setInterval(function(){_0x30b85c['clearZombieChannels']();ami[_0x6f31('0x5f')]({'action':_0x6f31('0x60')})['catch'](function(_0x144f50){logger[_0x6f31('0x43')]('[voiceQueueReport][queues]',util[_0x6f31('0x42')](_0x144f50,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport['prototype'][_0x6f31('0x30')]=function(){var _0x402b05=this;setInterval(function(){if(!_0x402b05[_0x6f31('0x15')]['isRunning']){return ami[_0x6f31('0x5f')]({'action':'queuesummary'})[_0x6f31('0x61')](function(_0x33802b){_0x402b05[_0x6f31('0x15')]['id']=_0x33802b[_0x6f31('0x62')];_0x402b05[_0x6f31('0x15')]['isRunning']=!![];_0x402b05[_0x6f31('0x15')][_0x6f31('0x63')][_0x33802b['actionid']]={};})['catch'](function(_0x22b0cf){logger[_0x6f31('0x43')](_0x6f31('0x64'),util[_0x6f31('0x42')](_0x22b0cf,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x65')]=function(_0x57b74f,_0x444da1){var _0x42fc28;if(this[_0x6f31('0x15')]&&this[_0x6f31('0x15')]['queues']&&this[_0x6f31('0x15')]['queues'][_0x57b74f[_0x6f31('0x5b')]]){_0x42fc28=this['summary'][_0x6f31('0x60')][_0x57b74f[_0x6f31('0x5b')]][_0x6f31('0x66')];}var _0x9022c1=new VoiceQueueSummary(_0x57b74f);return _0x9022c1['createReport'](_0x444da1[_0x6f31('0x11')],this['agents'],_0x42fc28,this[_0x6f31('0x67')]['channels']);};VoiceQueueReport['prototype'][_0x6f31('0x68')]=function(_0x109031,_0x16011f){var _0x300dcc=this['createQueueSummaryReport'](_0x109031,_0x16011f);var _0x37ef5c=![];_0x37ef5c=_0x300dcc['compareToInboundQueue'](_0x109031);if(_0x37ef5c){Object[_0x6f31('0x69')](_0x109031,_0x300dcc);this[_0x6f31('0x67')][_0x6f31('0x13')][_0x109031[_0x6f31('0x5b')]]=_0x109031;this[_0x6f31('0x58')](_0x300dcc);}};VoiceQueueReport[_0x6f31('0x3c')]['syncQueueStatusComplete']=function(_0x113d39){var _0x109c38=null;var _0x3b90bb=this[_0x6f31('0x15')]['id'];if(this[_0x6f31('0x15')][_0x6f31('0x63')][_0x3b90bb]){_0x109c38=this[_0x6f31('0x15')][_0x6f31('0x63')][_0x3b90bb][_0x113d39[_0x6f31('0x62')]];}if(!_0x109c38){this[_0x6f31('0x15')]=initializeSummary();return;}var _0x4c4eb1=this[_0x6f31('0x13')][_0x109c38['queue']];if(_0x4c4eb1[_0x6f31('0x59')]===_0x6f31('0x6a')){this['handleInboundQueueSummaryReport'](_0x4c4eb1,_0x109c38);}else if(_0x4c4eb1[_0x6f31('0x59')]===_0x6f31('0x6b')){var _0x4b7759=this[_0x6f31('0x65')](_0x4c4eb1,_0x109c38);ami['emit'](_0x6f31('0x6c'),_0x4b7759);}this[_0x6f31('0x15')]['statusRequests']-=0x1;var _0x2eb1d1=this['summary']['statusRequests']>0x0?!![]:![];if(!_0x2eb1d1){return this['syncQueueSummaryComplete'](this['summary'][_0x6f31('0x6d')]);}};VoiceQueueReport[_0x6f31('0x3c')]['syncQueueMember']=function(_0x22a2e9){var _0x4097ce=this['summary']['id'];if(this[_0x6f31('0x15')][_0x6f31('0x63')][_0x4097ce]&&this[_0x6f31('0x15')][_0x6f31('0x63')][_0x4097ce][_0x22a2e9['actionid']]){this[_0x6f31('0x15')][_0x6f31('0x63')][_0x4097ce][_0x22a2e9['actionid']][_0x6f31('0x11')]['push'](_0x22a2e9);}};VoiceQueueReport['prototype']['syncQueueSummary']=function(_0x1b7ab0){var _0x1f9d39=this;try{if(this[_0x6f31('0x5d')](_0x1b7ab0)&&this[_0x6f31('0x5d')](_0x1b7ab0[_0x6f31('0x50')])){logger[_0x6f31('0x4a')]('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x1b7ab0,{'showHidden':![],'depth':null}));var _0xb4a712=this[_0x6f31('0x13')][_0x1b7ab0[_0x6f31('0x50')]];if(_0xb4a712){logger['debug']('[voiceQueueReport][queuesummary]\x20name:%s',_0xb4a712[_0x6f31('0x5b')]);this[_0x6f31('0x15')][_0x6f31('0x60')][_0xb4a712['name']]={'summaryEvent':_0x1b7ab0};this[_0x6f31('0x15')][_0x6f31('0x6e')]+=0x1;return ami[_0x6f31('0x5f')]({'action':_0x6f31('0x63'),'queue':_0xb4a712[_0x6f31('0x5b')]})[_0x6f31('0x61')](function(_0x4e7cb4){if(!_0x1f9d39[_0x6f31('0x15')][_0x6f31('0x63')][_0x1b7ab0[_0x6f31('0x62')]]){_0x1f9d39['summary']['queuestatus'][_0x1b7ab0[_0x6f31('0x62')]]={};}_0x1f9d39[_0x6f31('0x15')][_0x6f31('0x63')][_0x1b7ab0[_0x6f31('0x62')]][_0x4e7cb4[_0x6f31('0x62')]]={'queue':_0xb4a712['name'],'agents':[]};})['catch'](function(_0x4918a6){throw _0x4918a6;});}}}catch(_0x18171e){logger['error'](_0x6f31('0x64'),util[_0x6f31('0x42')](_0x18171e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x1a')]=function(_0x3daf63){if(this[_0x6f31('0x15')][_0x6f31('0x6e')]>0x0){this[_0x6f31('0x15')][_0x6f31('0x6d')]=_0x3daf63;return;}logger[_0x6f31('0x4a')](_0x6f31('0x6f'),util[_0x6f31('0x42')](_0x3daf63,{'showHidden':![],'depth':null}));this[_0x6f31('0x15')]=initializeSummary();ami[_0x6f31('0x48')](_0x6f31('0x70'),{});};VoiceQueueReport[_0x6f31('0x3c')]['syncQueueCallerJoin']=function(_0xaaabf3){try{if(this[_0x6f31('0x5d')](_0xaaabf3)){logger[_0x6f31('0x4a')](_0x6f31('0x71'),_0xaaabf3[_0x6f31('0x4d')],util['inspect'](_0xaaabf3,{'showHidden':![],'depth':null}));if(_['isUndefined'](this['queueReports'][_0xaaabf3[_0x6f31('0x4d')]])){this[_0x6f31('0x10')][_0xaaabf3[_0x6f31('0x4d')]]=[];}if(_['isUndefined'](this[_0x6f31('0x3d')][_0xaaabf3['uniqueid']])){this['channels'][_0xaaabf3[_0x6f31('0x4d')]]={};}var _0x1c5ce8=new QueueReport();_0x1c5ce8[_0x6f31('0x50')]=_0xaaabf3['queue'];_0x1c5ce8[_0x6f31('0x59')]=this[_0x6f31('0x13')][_0x1c5ce8[_0x6f31('0x50')]]&&this[_0x6f31('0x13')][_0x1c5ce8[_0x6f31('0x50')]]['type']?this[_0x6f31('0x13')][_0x1c5ce8[_0x6f31('0x50')]][_0x6f31('0x59')]||_0x6f31('0x6a'):'inbound';_0x1c5ce8['queuecallerjoinAt']=moment()[_0x6f31('0x4e')](_0x6f31('0x72'));_0x1c5ce8[_0x6f31('0x73')]=_0xaaabf3[_0x6f31('0x73')];_0x1c5ce8['count']=_0xaaabf3[_0x6f31('0x74')];_0x1c5ce8[_0x6f31('0x4d')]=_0xaaabf3[_0x6f31('0x4d')];logger[_0x6f31('0x75')](_0x6f31('0x76'),_0x1c5ce8[_0x6f31('0x50')],_0x1c5ce8[_0x6f31('0x59')]);Object[_0x6f31('0x69')](_0x1c5ce8,_['pick'](_0xaaabf3,_[_0x6f31('0x77')](_0x1c5ce8)));this[_0x6f31('0x10')][_0xaaabf3['uniqueid']]['push'](_0x1c5ce8);this['channels'][_0xaaabf3[_0x6f31('0x4d')]]=_0x1c5ce8;this[_0x6f31('0x49')](_0x1c5ce8,_0x6f31('0x1d'));}}catch(_0x5889b3){logger[_0x6f31('0x43')](_0x6f31('0x71'),_0xaaabf3[_0x6f31('0x4d')],util['inspect'](_0x5889b3,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x78')]=function(_0x33a47e){try{if(this[_0x6f31('0x5d')](_0x33a47e)){logger[_0x6f31('0x4a')](_0x6f31('0x79'),_0x33a47e[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x33a47e,{'showHidden':![],'depth':null}));if(this[_0x6f31('0x10')][_0x33a47e[_0x6f31('0x4d')]]){var _0x2457f6=_[_0x6f31('0x7a')](this[_0x6f31('0x10')][_0x33a47e['uniqueid']]);_0x2457f6[_0x6f31('0x7b')]=![];_0x2457f6[_0x6f31('0x7c')]=null;_0x2457f6[_0x6f31('0x7d')]=_0x33a47e[_0x6f31('0x7d')];_0x2457f6[_0x6f31('0x7e')]=_0x33a47e[_0x6f31('0x7e')];_0x2457f6[_0x6f31('0x3b')]=!![];_0x2457f6[_0x6f31('0x7f')]=moment()['format'](_0x6f31('0x72'));_0x2457f6[_0x6f31('0x54')]=_0x6f31('0x80');_0x2457f6[_0x6f31('0x81')]=null;logger[_0x6f31('0x75')](_0x6f31('0x82'),_0x2457f6[_0x6f31('0x50')],_0x2457f6['type']);this['channels'][_0x33a47e[_0x6f31('0x4d')]]=_0x2457f6;this[_0x6f31('0x47')](_0x2457f6,_0x6f31('0x3b'));}}}catch(_0x7821fd){logger[_0x6f31('0x43')](_0x6f31('0x79'),_0x33a47e[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x7821fd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x20')]=function(_0x3d76c2){try{if(this[_0x6f31('0x5d')](_0x3d76c2)){logger[_0x6f31('0x4a')](_0x6f31('0x83'),_0x3d76c2[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x3d76c2,{'showHidden':![],'depth':null}));if(this[_0x6f31('0x10')][_0x3d76c2['uniqueid']]){var _0x14ff46=_[_0x6f31('0x7a')](this[_0x6f31('0x10')][_0x3d76c2[_0x6f31('0x4d')]]);_0x14ff46['queuecallerleaveAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x14ff46[_0x6f31('0x84')]=_0x3d76c2['connectedlinenum'];_0x14ff46['connectedlinename']=_0x3d76c2['connectedlinename'];logger[_0x6f31('0x75')](_0x6f31('0x85'),_0x14ff46[_0x6f31('0x50')],_0x14ff46[_0x6f31('0x59')],_0x3d76c2[_0x6f31('0x84')],_0x3d76c2[_0x6f31('0x86')]);this[_0x6f31('0x3d')][_0x3d76c2[_0x6f31('0x4d')]]=_0x14ff46;this[_0x6f31('0x49')](_0x14ff46,'queuecallerleave');}}}catch(_0x333810){logger[_0x6f31('0x43')](_0x6f31('0x83'),_0x3d76c2[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x333810,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x23')]=function(_0x27c34a){try{if(this[_0x6f31('0x5d')](_0x27c34a)){logger[_0x6f31('0x4a')](_0x6f31('0x87'),_0x27c34a['uniqueid'],util[_0x6f31('0x42')](_0x27c34a,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x27c34a[_0x6f31('0x4d')]]){var _0x1ecae6=_['last'](this['queueReports'][_0x27c34a[_0x6f31('0x4d')]]);_0x1ecae6[_0x6f31('0x7b')]=!![];_0x1ecae6['queuecallerexitreason']=_0x6f31('0x88');logger[_0x6f31('0x75')]('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x1ecae6['queue'],_0x1ecae6[_0x6f31('0x59')]);}}}catch(_0x1b750d){logger[_0x6f31('0x43')]('[%s][voiceQueueReport][agentconnect]',_0x27c34a[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x1b750d,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x6f31('0x21')]=function(_0x3d5421){try{if(this['isNotNull'](_0x3d5421)){logger['debug'](_0x6f31('0x89'),_0x3d5421['uniqueid'],util[_0x6f31('0x42')](_0x3d5421,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x3d5421[_0x6f31('0x4d')]]){var _0x5f0912=_['last'](this['queueReports'][_0x3d5421['uniqueid']]);_0x5f0912[_0x6f31('0x3b')]=![];_0x5f0912['queuecallerabandonAt']=null;_0x5f0912[_0x6f31('0x8a')]=!![];_0x5f0912[_0x6f31('0x81')]=_0x3d5421[_0x6f31('0x8b')];_0x5f0912[_0x6f31('0x7d')]=_0x3d5421['holdtime'];_0x5f0912['queuecallercomplete']=!![];_0x5f0912[_0x6f31('0x3a')]=![];_0x5f0912['queuecallerexitAt']=null;if(!_0x5f0912[_0x6f31('0x8c')]){if(_0x3d5421[_0x6f31('0x8d')]==_0x6f31('0x8c')){_0x5f0912[_0x6f31('0x54')]=_0x6f31('0x8e');logger[_0x6f31('0x75')](_0x6f31('0x8f'),_0x5f0912['queue'],_0x5f0912[_0x6f31('0x59')]);}else{if(_[_0x6f31('0x90')](_0x3d5421[_0x6f31('0x3f')][_0x6f31('0x91')](),_0x6f31('0x92'))){if(this['queueReports'][_0x3d5421['linkedid']]){var _0x2720b3=_[_0x6f31('0x7a')](this[_0x6f31('0x10')][_0x3d5421[_0x6f31('0x93')]]);_0x2720b3['queuecallercomplete']=![];_0x2720b3[_0x6f31('0x3a')]=!![];_0x2720b3[_0x6f31('0x94')]=moment(_0x5f0912['queuecallerjoinAt'])[_0x6f31('0x95')](_0x3d5421[_0x6f31('0x7d')],_0x6f31('0x96'))[_0x6f31('0x4e')](_0x6f31('0x72'));_0x2720b3['queuecallerexitreason']=_0x6f31('0x97');_0x2720b3['transfer']=!![];_0x2720b3[_0x6f31('0x98')]='FORWARD';_0x2720b3['transferexten']=_0x3d5421[_0x6f31('0x99')];_0x2720b3[_0x6f31('0x9a')]=_0x3d5421[_0x6f31('0x4d')];logger[_0x6f31('0x75')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER',_0x2720b3[_0x6f31('0x50')],_0x2720b3[_0x6f31('0x59')]);var _0x28d50e=this[_0x6f31('0x10')][_0x3d5421[_0x6f31('0x93')]];this[_0x6f31('0x10')][_0x3d5421[_0x6f31('0x93')]]=this[_0x6f31('0x10')][_0x3d5421[_0x6f31('0x4d')]];this[_0x6f31('0x10')][_0x3d5421['uniqueid']]=_0x28d50e;}}else{_0x5f0912['queuecallerexitreason']=_0x6f31('0x9b')+_0x3d5421['reason'][_0x6f31('0x9c')]();logger['info'](_0x6f31('0x9d'),_0x5f0912[_0x6f31('0x50')],_0x5f0912[_0x6f31('0x59')],_0x5f0912[_0x6f31('0x54')]);}}}this[_0x6f31('0x3d')][_0x3d5421['uniqueid']]=_0x5f0912;}}}catch(_0x3699f9){logger[_0x6f31('0x43')](_0x6f31('0x89'),_0x3d5421[_0x6f31('0x4d')],util['inspect'](_0x3699f9,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0x9e')]=function(_0x6b2eab){try{if(this[_0x6f31('0x5d')](_0x6b2eab)){logger[_0x6f31('0x4a')](_0x6f31('0x9f'),_0x6b2eab[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x6b2eab,{'showHidden':![],'depth':null}));this[_0x6f31('0xa0')](_0x6b2eab['uniqueid'],_[_0x6f31('0x77')](_0x6b2eab['variable'])[0x0],_0x6b2eab[_0x6f31('0xa1')]);if(this[_0x6f31('0x10')][_0x6b2eab['uniqueid']]){var _0x15dbc3=_[_0x6f31('0x7a')](this[_0x6f31('0x10')][_0x6b2eab['uniqueid']]);if(_0x15dbc3){if(this[_0x6f31('0x5d')](_0x6b2eab[_0x6f31('0xa2')])&&this[_0x6f31('0x5d')](_0x6b2eab[_0x6f31('0xa2')][_0x6f31('0x63')])){switch(_0x6b2eab[_0x6f31('0xa1')]){case'CONTINUE':_0x15dbc3[_0x6f31('0x3a')]=![];_0x15dbc3[_0x6f31('0x94')]=null;break;case'TIMEOUT':_0x15dbc3[_0x6f31('0xa3')]=_0x6f31('0xa4');_0x15dbc3[_0x6f31('0x3a')]=!![];_0x15dbc3[_0x6f31('0x94')]=moment()[_0x6f31('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x15dbc3['queuecallerleaveAt']=moment()[_0x6f31('0x4e')](_0x6f31('0x72'));logger['debug'](_0x6f31('0xa5'),_0x6b2eab[_0x6f31('0x4d')],util[_0x6f31('0x42')](_0x15dbc3,{'showHidden':![],'depth':null}));ami['emit']('custom:timeout',_0x15dbc3);break;default:_0x15dbc3[_0x6f31('0x3a')]=!![];_0x15dbc3[_0x6f31('0x94')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x15dbc3[_0x6f31('0xa6')]=moment()[_0x6f31('0x4e')](_0x6f31('0x72'));}_0x15dbc3[_0x6f31('0x3b')]=![];_0x15dbc3[_0x6f31('0x7f')]=null;_0x15dbc3[_0x6f31('0x54')]=_0x6b2eab[_0x6f31('0xa1')];this[_0x6f31('0x3d')][_0x6b2eab['uniqueid']]=_0x15dbc3;this[_0x6f31('0x47')](_0x15dbc3,_0x6f31('0x24'));}else if(this[_0x6f31('0x5d')](_0x6b2eab[_0x6f31('0xa2')])&&this[_0x6f31('0x5d')](_0x6b2eab[_0x6f31('0xa2')][_0x6f31('0xa7')])){if(!_0x15dbc3[_0x6f31('0x3b')]){_0x15dbc3[_0x6f31('0x3a')]=!![];_0x15dbc3['queuecallerexitAt']=moment()[_0x6f31('0x4e')]('YYYY-MM-DD\x20HH:mm:ss');_0x15dbc3['queuecallerexitreason']='EXITWITHKEY';_0x15dbc3[_0x6f31('0xa6')]=moment()[_0x6f31('0x4e')](_0x6f31('0x72'));this[_0x6f31('0x3d')][_0x6b2eab[_0x6f31('0x4d')]]=_0x15dbc3;}}logger['info'](_0x6f31('0xa8'),_0x6b2eab['uniqueid'],_0x15dbc3[_0x6f31('0x50')],_0x15dbc3[_0x6f31('0x59')],_['keys'](_0x6b2eab[_0x6f31('0xa2')])[0x0],_0x6b2eab[_0x6f31('0xa1')]);_0x15dbc3[_0x6f31('0x16')]=this[_0x6f31('0x16')][_0x6b2eab['uniqueid']];}}}}catch(_0x174e7b){logger[_0x6f31('0x43')]('[%s][voiceQueueReport][varset]',_0x6b2eab[_0x6f31('0x4d')],util['inspect'](_0x174e7b,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x6f31('0x3c')][_0x6f31('0xa0')]=function(_0x1b18ca,_0x233d4d,_0x22d382){var _0x4ae345=[_0x6f31('0xa9'),'rtpaudioqosbridged',_0x6f31('0xaa'),_0x6f31('0xab'),_0x6f31('0xac'),_0x6f31('0xad'),'rtpaudioqosrtt',_0x6f31('0xae'),_0x6f31('0xaf'),_0x6f31('0xb0'),_0x6f31('0xb1'),'bridgepvtcallid',_0x6f31('0xb2'),_0x6f31('0xb3'),'memberinterface',_0x6f31('0xb4'),_0x6f31('0x8b'),_0x6f31('0xb5'),'memberrealtime'];if(!_[_0x6f31('0xb6')](_0x233d4d)&&!_['includes'](_0x4ae345,_0x233d4d)){if(_[_0x6f31('0x5e')](this['variables'][_0x1b18ca])){this[_0x6f31('0x16')][_0x1b18ca]={};}this[_0x6f31('0x16')][_0x1b18ca][_0x233d4d]=_0x22d382;}};VoiceQueueReport['prototype'][_0x6f31('0xb7')]=function(_0x4730f4,_0xccacb2,_0x5a10ba){try{var _0x10fd5a={};if(this[_0x6f31('0x10')][_0x4730f4]){for(var _0x134cc6=0x0;_0x134cc6{delete this['channels'][_0x5c4fac];},_0x551812);}};module[_0x6f31('0xed')]=VoiceQueueReport; \ No newline at end of file diff --git a/server/services/ami/rpc/agentReportPreview.js b/server/services/ami/rpc/agentReportPreview.js index 465de6b..ba0a1f3 100644 --- a/server/services/ami/rpc/agentReportPreview.js +++ b/server/services/ami/rpc/agentReportPreview.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0e08=['queue','../client','createHistory'];(function(_0x866e2f,_0x5a91d4){var _0x50ad80=function(_0x2c8d00){while(--_0x2c8d00){_0x866e2f['push'](_0x866e2f['shift']());}};_0x50ad80(++_0x5a91d4);}(_0x0e08,0x8b));var _0x80e0=function(_0x3e8f4c,_0x249f6d){_0x3e8f4c=_0x3e8f4c-0x0;var _0x1b00ae=_0x0e08[_0x3e8f4c];return _0x1b00ae;};'use strict';var client=require(_0x80e0('0x0'));exports[_0x80e0('0x1')]=function(_0x434ae8){return function(){_0x434ae8['campaign']=_0x434ae8[_0x80e0('0x2')];return client['Request']('CreateReportAgentPreview',{'body':_0x434ae8,'log':'CreateReportAgentPreview'});};}; \ No newline at end of file +var _0xdc4b=['Request','CreateReportAgentPreview','../client','createHistory','queue'];(function(_0x5bace9,_0x42fbaf){var _0x19a2de=function(_0x40a0e7){while(--_0x40a0e7){_0x5bace9['push'](_0x5bace9['shift']());}};_0x19a2de(++_0x42fbaf);}(_0xdc4b,0x1b5));var _0xbdc4=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0xdc4b[_0x19950b];return _0x3c6b41;};'use strict';var client=require(_0xbdc4('0x0'));exports[_0xbdc4('0x1')]=function(_0x398538){return function(){_0x398538['campaign']=_0x398538[_0xbdc4('0x2')];return client[_0xbdc4('0x3')](_0xbdc4('0x4'),{'body':_0x398538,'log':_0xbdc4('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/attachment.js b/server/services/ami/rpc/attachment.js index 4b28d5b..1188955 100644 --- a/server/services/ami/rpc/attachment.js +++ b/server/services/ami/rpc/attachment.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3695=['../client'];(function(_0x372df5,_0x4c3340){var _0x55d332=function(_0x3890ca){while(--_0x3890ca){_0x372df5['push'](_0x372df5['shift']());}};_0x55d332(++_0x4c3340);}(_0x3695,0x1df));var _0x5369=function(_0x4b56e9,_0x24f7d4){_0x4b56e9=_0x4b56e9-0x0;var _0x459cec=_0x3695[_0x4b56e9];return _0x459cec;};'use strict';var client=require(_0x5369('0x0'));exports['create']=function(_0x133f75){return client['Request']('CreateAttachment',{'body':_0x133f75,'log':'CreateAttachment'});}; \ No newline at end of file +var _0x2a84=['../client','create','Request','CreateAttachment'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x2a84,0x94));var _0x42a8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2a84[_0xa464c9];return _0x3d73c4;};'use strict';var client=require(_0x42a8('0x0'));exports[_0x42a8('0x1')]=function(_0x2797cb){return client[_0x42a8('0x2')](_0x42a8('0x3'),{'body':_0x2797cb,'log':_0x42a8('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/campaign.js b/server/services/ami/rpc/campaign.js index 0c19293..87f92c1 100644 --- a/server/services/ami/rpc/campaign.js +++ b/server/services/ami/rpc/campaign.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialTimezone','dialGlobalInterval','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','Trunk','callerid','active','Interval','Intervals','interval','SquareProject','../client','getCampaigns','Request','name','type','limitCalls','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyMaxRetry'];(function(_0x2c052d,_0x28f3e0){var _0x30ea3c=function(_0x178756){while(--_0x178756){_0x2c052d['push'](_0x2c052d['shift']());}};_0x30ea3c(++_0x28f3e0);}(_0x7a54,0x106));var _0x47a5=function(_0x6b1cc9,_0x3b49d1){_0x6b1cc9=_0x6b1cc9-0x0;var _0x5dbce6=_0x7a54[_0x6b1cc9];return _0x5dbce6;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(){return function(){return client[_0x47a5('0x2')]('GetCampaign',{'options':{'raw':![],'attributes':['id',_0x47a5('0x3'),_0x47a5('0x4'),'active',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'dialCongestionRetryFrequency',_0x47a5('0xa'),'dialBusyRetryFrequency',_0x47a5('0xb'),_0x47a5('0xc'),'dialGlobalMaxRetry',_0x47a5('0xd'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency',_0x47a5('0xe'),_0x47a5('0xf'),'dialMachineMaxRetry',_0x47a5('0x10'),'dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'dialAMDMinWordLength',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e'),_0x47a5('0x1f')],'include':[{'model':'Trunk','as':_0x47a5('0x20'),'attributes':['id',_0x47a5('0x3'),_0x47a5('0x21'),_0x47a5('0x22')]},{'model':_0x47a5('0x20'),'as':'TrunkBackup','attributes':['id','name',_0x47a5('0x21'),'active']},{'model':'Interval','as':_0x47a5('0x23'),'attributes':['id',_0x47a5('0x3')],'include':[{'model':_0x47a5('0x23'),'as':_0x47a5('0x24'),'attributes':['id',_0x47a5('0x3'),_0x47a5('0x25')]}]},{'model':_0x47a5('0x26'),'as':_0x47a5('0x26'),'attributes':['id',_0x47a5('0x3')]}]},'log':'getCampaign'});};}; \ No newline at end of file +var _0xc4aa=['Trunk','active','TrunkBackup','callerid','Interval','Intervals','interval','SquareProject','getCampaign','../client','getCampaigns','Request','GetCampaign','name','type','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','dialGlobalInterval','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialOrderByScheduledAt','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0x414810,_0x5e924d){var _0x2d4df5=function(_0x390860){while(--_0x390860){_0x414810['push'](_0x414810['shift']());}};_0x2d4df5(++_0x5e924d);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var client=require(_0xac4a('0x0'));exports[_0xac4a('0x1')]=function(){return function(){return client[_0xac4a('0x2')](_0xac4a('0x3'),{'options':{'raw':![],'attributes':['id',_0xac4a('0x4'),_0xac4a('0x5'),'active','limitCalls','dialOriginateCallerIdName',_0xac4a('0x6'),_0xac4a('0x7'),_0xac4a('0x8'),_0xac4a('0x9'),_0xac4a('0xa'),_0xac4a('0xb'),_0xac4a('0xc'),_0xac4a('0xd'),'dialGlobalMaxRetry','dialNoSuchNumberMaxRetry',_0xac4a('0xe'),_0xac4a('0xf'),_0xac4a('0x10'),'dialAbandonedMaxRetry',_0xac4a('0x11'),_0xac4a('0x12'),_0xac4a('0x13'),'dialAgentRejectMaxRetry',_0xac4a('0x14'),'dialTimezone',_0xac4a('0x15'),'dialAMDActive',_0xac4a('0x16'),_0xac4a('0x17'),_0xac4a('0x18'),'dialAMDTotalAnalysisTime',_0xac4a('0x19'),_0xac4a('0x1a'),_0xac4a('0x1b'),_0xac4a('0x1c'),_0xac4a('0x1d'),_0xac4a('0x1e'),_0xac4a('0x1f'),_0xac4a('0x20'),_0xac4a('0x21')],'include':[{'model':_0xac4a('0x22'),'as':_0xac4a('0x22'),'attributes':['id',_0xac4a('0x4'),'callerid',_0xac4a('0x23')]},{'model':_0xac4a('0x22'),'as':_0xac4a('0x24'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x25'),_0xac4a('0x23')]},{'model':_0xac4a('0x26'),'as':_0xac4a('0x26'),'attributes':['id','name'],'include':[{'model':'Interval','as':_0xac4a('0x27'),'attributes':['id',_0xac4a('0x4'),_0xac4a('0x28')]}]},{'model':'SquareProject','as':_0xac4a('0x29'),'attributes':['id',_0xac4a('0x4')]}]},'log':_0xac4a('0x2a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmContact.js b/server/services/ami/rpc/cmContact.js index 3849d7d..0ca1f76 100644 --- a/server/services/ami/rpc/cmContact.js +++ b/server/services/ami/rpc/cmContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedcb=['createContact','Request','CreateCmContact','getContacts','GetCmContact'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xedcb,0x1c7));var _0xbedc=function(_0x47b89f,_0x13f5de){_0x47b89f=_0x47b89f-0x0;var _0x1d5963=_0xedcb[_0x47b89f];return _0x1d5963;};'use strict';var client=require('../client');exports[_0xbedc('0x0')]=function(_0x1d6964){return function(){return client[_0xbedc('0x1')]('CreateCmContact',{'body':_0x1d6964,'log':_0xbedc('0x2')});};};exports[_0xbedc('0x3')]=function(_0x395b77){return function(){return client['Request'](_0xbedc('0x4'),{'options':_0x395b77,'log':_0xbedc('0x4')});};}; \ No newline at end of file +var _0xc433=['Request','CreateCmContact','getContacts','GetCmContact','../client','createContact'];(function(_0x34ad72,_0x1e43f6){var _0x5c9aa8=function(_0x144388){while(--_0x144388){_0x34ad72['push'](_0x34ad72['shift']());}};_0x5c9aa8(++_0x1e43f6);}(_0xc433,0xee));var _0x3c43=function(_0x28e74e,_0x53fdf1){_0x28e74e=_0x28e74e-0x0;var _0xb45ac1=_0xc433[_0x28e74e];return _0xb45ac1;};'use strict';var client=require(_0x3c43('0x0'));exports[_0x3c43('0x1')]=function(_0x1a18a3){return function(){return client[_0x3c43('0x2')](_0x3c43('0x3'),{'body':_0x1a18a3,'log':_0x3c43('0x3')});};};exports[_0x3c43('0x4')]=function(_0x3911fe){return function(){return client[_0x3c43('0x2')](_0x3c43('0x5'),{'options':_0x3911fe,'log':_0x3c43('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopper.js b/server/services/ami/rpc/cmHopper.js index 17445e6..368c8bd 100644 --- a/server/services/ami/rpc/cmHopper.js +++ b/server/services/ami/rpc/cmHopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x88b0=['GetCmHopper','CmContact','getCmHopper','updateContacts','UpdateCmHopper','format','YYYY-MM-DD\x20HH:mm:ss','rescheduleContact','ListId','CampaignId','DestroyCmHopper','getContactDialer','GetContactDialer','priority','scheduledat','ASC','getContactDialerIvr','DESC','GetContactDialerIvr','moveContactManagedDialer','campaign','queue','VoiceQueueId','countReScheduled','getContactPreview','GetCmHopperPreview','Contact','User','Agent','VoiceQueue','Queue','name','unlockContact','getContactRecallMe','voicePause','db.CmHopper.UserId','resetActiveCalls','ResetActiveCalls','handlePreviewRecallNotifications','../client','moment','Request'];(function(_0x30e2d1,_0xf999eb){var _0x5848b1=function(_0x21ab91){while(--_0x21ab91){_0x30e2d1['push'](_0x30e2d1['shift']());}};_0x5848b1(++_0xf999eb);}(_0x88b0,0x1cb));var _0x088b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x88b0[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x088b('0x0'));var moment=require(_0x088b('0x1'));exports['getContacts']=function(_0x550558,_0x3f8d4a){return function(){return client[_0x088b('0x2')](_0x088b('0x3'),{'options':{'where':{'VoiceQueueId':_0x550558},'include':[{'model':_0x088b('0x4'),'as':'Contact'}],'limit':_0x3f8d4a,'raw':![]},'log':_0x088b('0x5')});};};exports[_0x088b('0x6')]=function(_0xc1e9cd,_0x5af8a4,_0x4a9986){return function(){return client[_0x088b('0x2')](_0x088b('0x7'),{'body':_0xc1e9cd,'options':{'where':{'VoiceQueueId':_0x5af8a4,'scheduledat':{'$lte':moment()[_0x088b('0x8')](_0x088b('0x9'))}},'limit':_0x4a9986},'log':_0x088b('0x7')});};};exports[_0x088b('0xa')]=function(_0x40436c){return client['Request'](_0x088b('0x7'),{'body':_0x40436c,'options':{'where':{'ContactId':_0x40436c['ContactId'],'ListId':_0x40436c[_0x088b('0xb')],'VoiceQueueId':_0x40436c['VoiceQueueId'],'CampaignId':_0x40436c[_0x088b('0xc')]}},'log':_0x088b('0xa')});};exports['destroyContact']=function(_0x4b6d34,_0x278ce,_0x290c6c){return function(){return client[_0x088b('0x2')]('DestroyCmHopper',{'options':{'where':{'VoiceQueueId':_0x4b6d34,'ListId':_0x278ce,'ContactId':_0x290c6c}},'log':_0x088b('0xd')});};};exports[_0x088b('0xe')]=function(_0x1ea6d7,_0x4fa81a,_0x1d2829,_0x2a1e5c){return client[_0x088b('0x2')](_0x088b('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x1ea6d7,'active':![],'scheduledat':{'$lte':moment()[_0x088b('0x8')](_0x088b('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x4fa81a}}]},'order':[[_0x088b('0x10'),'DESC'],[_0x088b('0x11'),_0x2a1e5c],['id',_0x088b('0x12')]],'raw':!![],'limit':_0x1d2829},'log':_0x088b('0xf')});};exports[_0x088b('0x13')]=function(_0x41bf62,_0x2e47af,_0x54a27e){return client[_0x088b('0x2')](_0x088b('0xf'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x41bf62,'active':![],'scheduledat':{'$lte':moment()[_0x088b('0x8')](_0x088b('0x9'))}},'include':[{'model':_0x088b('0x4'),'as':'Contact'}],'order':[['priority',_0x088b('0x14')],[_0x088b('0x11'),_0x54a27e],['id',_0x088b('0x12')]],'raw':!![],'limit':_0x2e47af},'log':_0x088b('0x15')});};exports[_0x088b('0x16')]=function(_0x6ecfbe,_0x565220){_0x6ecfbe[_0x088b('0x17')]=_0x6ecfbe[_0x088b('0x18')];return client[_0x088b('0x2')]('MoveContactManagedDialer',{'body':_0x6ecfbe,'options':{'where':{'ContactId':_0x6ecfbe['ContactId'],'ListId':_0x6ecfbe[_0x088b('0xb')],'VoiceQueueId':_0x6ecfbe[_0x088b('0x19')],'CampaignId':_0x6ecfbe[_0x088b('0xc')],'active':_0x565220?undefined:!![]}},'log':'MoveContactManagedDialer'});};exports[_0x088b('0x1a')]=function(_0xcfc1c6){return client['Request']('CountReScheduled',{'options':{'where':{'VoiceQueueId':_0xcfc1c6['id']?_0xcfc1c6['id']||null:null}},'log':'countReScheduled'});};exports[_0x088b('0x1b')]=function(_0x4e88fb){return function(){return client[_0x088b('0x2')](_0x088b('0x1c'),{'options':{'where':{'id':_0x4e88fb},'include':[{'model':_0x088b('0x4'),'as':_0x088b('0x1d')},{'model':_0x088b('0x1e'),'as':_0x088b('0x1f'),'attributes':['id','name']},{'model':_0x088b('0x20'),'as':_0x088b('0x21'),'attributes':['id',_0x088b('0x22')]}],'raw':!![]},'log':'getCmHopper'});};};exports[_0x088b('0x23')]=function(_0x1ab855,_0x1a668b,_0x3ed176){return client['Request']('UpdateCmHopper',{'body':_0x1ab855,'options':{'where':{'id':_0x1a668b},'limit':_0x3ed176},'log':_0x088b('0x7')});};exports[_0x088b('0x24')]=function(_0x3921c8,_0x193a00){return function(){return client[_0x088b('0x2')]('GetContactRecallMe',{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x3921c8,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x088b('0x8')](_0x088b('0x9'))},'UserId':{'$in':_0x193a00}},'order':[[_0x088b('0x10'),_0x088b('0x14')],[_0x088b('0x11'),'DESC'],['id',_0x088b('0x12')]],'include':[{'model':_0x088b('0x4'),'as':_0x088b('0x1d')},{'model':_0x088b('0x1e'),'as':_0x088b('0x1f'),'attributes':['id',_0x088b('0x22'),_0x088b('0x25')]}],'group':_0x088b('0x26'),'raw':!![]},'log':_0x088b('0xf')});};};exports[_0x088b('0x27')]=function(_0x46c0c0,_0x58daf0){return client[_0x088b('0x2')](_0x088b('0x28'),{'body':_0x46c0c0,'options':_0x58daf0||{},'log':_0x088b('0x28')});};exports[_0x088b('0x29')]=function(_0x4e2ed8,_0x15b694,_0x5a7a9f){return function(){return client[_0x088b('0x2')]('CmHopperHandlePreviewRecallNotifications',{'body':{'where':{'voiceQueueIds':_0x4e2ed8,'interval':_0x15b694,'availableAgentsIds':_0x5a7a9f}},'log':_0x088b('0x29')});};}; \ No newline at end of file +var _0x1939=['format','YYYY-MM-DD\x20HH:mm:ss','ContactId','ListId','destroyContact','DestroyCmHopper','getContactDialer','GetContactDialer','priority','DESC','scheduledat','ASC','getContactDialerIvr','GetContactDialerIvr','campaign','queue','VoiceQueueId','CampaignId','MoveContactManagedDialer','CountReScheduled','countReScheduled','getContactPreview','GetCmHopperPreview','name','VoiceQueue','Queue','getContactRecallMe','GetContactRecallMe','User','Agent','voicePause','db.CmHopper.UserId','ResetActiveCalls','handlePreviewRecallNotifications','CmHopperHandlePreviewRecallNotifications','../client','getContacts','GetCmHopper','CmContact','Contact','getCmHopper','Request','UpdateCmHopper'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1939,0x1d1));var _0x9193=function(_0x5287a5,_0x3ff0ad){_0x5287a5=_0x5287a5-0x0;var _0x158a73=_0x1939[_0x5287a5];return _0x158a73;};'use strict';var client=require(_0x9193('0x0'));var moment=require('moment');exports[_0x9193('0x1')]=function(_0x45d779,_0x3628d4){return function(){return client['Request'](_0x9193('0x2'),{'options':{'where':{'VoiceQueueId':_0x45d779},'include':[{'model':_0x9193('0x3'),'as':_0x9193('0x4')}],'limit':_0x3628d4,'raw':![]},'log':_0x9193('0x5')});};};exports['updateContacts']=function(_0x3e17d0,_0x20ab2b,_0x5186dc){return function(){return client[_0x9193('0x6')](_0x9193('0x7'),{'body':_0x3e17d0,'options':{'where':{'VoiceQueueId':_0x20ab2b,'scheduledat':{'$lte':moment()[_0x9193('0x8')](_0x9193('0x9'))}},'limit':_0x5186dc},'log':_0x9193('0x7')});};};exports['rescheduleContact']=function(_0x25411c){return client[_0x9193('0x6')](_0x9193('0x7'),{'body':_0x25411c,'options':{'where':{'ContactId':_0x25411c[_0x9193('0xa')],'ListId':_0x25411c[_0x9193('0xb')],'VoiceQueueId':_0x25411c['VoiceQueueId'],'CampaignId':_0x25411c['CampaignId']}},'log':'rescheduleContact'});};exports[_0x9193('0xc')]=function(_0x4aa6c7,_0x276552,_0x454b7b){return function(){return client['Request'](_0x9193('0xd'),{'options':{'where':{'VoiceQueueId':_0x4aa6c7,'ListId':_0x276552,'ContactId':_0x454b7b}},'log':_0x9193('0xd')});};};exports[_0x9193('0xe')]=function(_0x28caff,_0x107ab5,_0x32f466,_0xf10273){return client[_0x9193('0x6')](_0x9193('0xf'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x28caff,'active':![],'scheduledat':{'$lte':moment()['format'](_0x9193('0x9'))},'$or':[{'UserId':null},{'UserId':{'$in':_0x107ab5}}]},'order':[[_0x9193('0x10'),_0x9193('0x11')],[_0x9193('0x12'),_0xf10273],['id',_0x9193('0x13')]],'raw':!![],'limit':_0x32f466},'log':'GetContactDialer'});};exports[_0x9193('0x14')]=function(_0x1f1d27,_0x29fe95,_0x363323){return client[_0x9193('0x6')](_0x9193('0xf'),{'body':{'active':!![]},'options':{'where':{'CampaignId':_0x1f1d27,'active':![],'scheduledat':{'$lte':moment()[_0x9193('0x8')]('YYYY-MM-DD\x20HH:mm:ss')}},'include':[{'model':_0x9193('0x3'),'as':_0x9193('0x4')}],'order':[[_0x9193('0x10'),'DESC'],[_0x9193('0x12'),_0x363323],['id',_0x9193('0x13')]],'raw':!![],'limit':_0x29fe95},'log':_0x9193('0x15')});};exports['moveContactManagedDialer']=function(_0x465cd2,_0x471c5a){_0x465cd2[_0x9193('0x16')]=_0x465cd2[_0x9193('0x17')];return client[_0x9193('0x6')]('MoveContactManagedDialer',{'body':_0x465cd2,'options':{'where':{'ContactId':_0x465cd2[_0x9193('0xa')],'ListId':_0x465cd2[_0x9193('0xb')],'VoiceQueueId':_0x465cd2[_0x9193('0x18')],'CampaignId':_0x465cd2[_0x9193('0x19')],'active':_0x471c5a?undefined:!![]}},'log':_0x9193('0x1a')});};exports['countReScheduled']=function(_0x274a42){return client[_0x9193('0x6')](_0x9193('0x1b'),{'options':{'where':{'VoiceQueueId':_0x274a42['id']?_0x274a42['id']||null:null}},'log':_0x9193('0x1c')});};exports[_0x9193('0x1d')]=function(_0x4c1406){return function(){return client[_0x9193('0x6')](_0x9193('0x1e'),{'options':{'where':{'id':_0x4c1406},'include':[{'model':_0x9193('0x3'),'as':_0x9193('0x4')},{'model':'User','as':'Agent','attributes':['id',_0x9193('0x1f')]},{'model':_0x9193('0x20'),'as':_0x9193('0x21'),'attributes':['id',_0x9193('0x1f')]}],'raw':!![]},'log':_0x9193('0x5')});};};exports['unlockContact']=function(_0x1b1efb,_0x368951,_0x404e9c){return client['Request'](_0x9193('0x7'),{'body':_0x1b1efb,'options':{'where':{'id':_0x368951},'limit':_0x404e9c},'log':_0x9193('0x7')});};exports[_0x9193('0x22')]=function(_0x3774cb,_0x8ab2c4){return function(){return client['Request'](_0x9193('0x23'),{'body':{'active':!![]},'options':{'where':{'VoiceQueueId':_0x3774cb,'active':![],'recallme':!![],'scheduledat':{'$lte':moment()[_0x9193('0x8')]('YYYY-MM-DD\x20HH:mm:ss')},'UserId':{'$in':_0x8ab2c4}},'order':[[_0x9193('0x10'),_0x9193('0x11')],[_0x9193('0x12'),_0x9193('0x11')],['id',_0x9193('0x13')]],'include':[{'model':_0x9193('0x3'),'as':'Contact'},{'model':_0x9193('0x24'),'as':_0x9193('0x25'),'attributes':['id',_0x9193('0x1f'),_0x9193('0x26')]}],'group':_0x9193('0x27'),'raw':!![]},'log':_0x9193('0xf')});};};exports['resetActiveCalls']=function(_0xb995e5,_0x311b6c){return client[_0x9193('0x6')]('ResetActiveCalls',{'body':_0xb995e5,'options':_0x311b6c||{},'log':_0x9193('0x28')});};exports[_0x9193('0x29')]=function(_0x14d856,_0x5a3ba5,_0x3799d0){return function(){return client[_0x9193('0x6')](_0x9193('0x2a'),{'body':{'where':{'voiceQueueIds':_0x14d856,'interval':_0x5a3ba5,'availableAgentsIds':_0x3799d0}},'log':'handlePreviewRecallNotifications'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperAdditionalPhone.js b/server/services/ami/rpc/cmHopperAdditionalPhone.js index fbbadc4..6690d78 100644 --- a/server/services/ami/rpc/cmHopperAdditionalPhone.js +++ b/server/services/ami/rpc/cmHopperAdditionalPhone.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb5c3=['VerifyAdditionalPhones','swapAdditionalPhones','SwapAdditionalPhones','IncrementPreviewCounters','verifyAdditionalPhones','Request'];(function(_0x27dca2,_0x3cb87f){var _0x44d252=function(_0x15c430){while(--_0x15c430){_0x27dca2['push'](_0x27dca2['shift']());}};_0x44d252(++_0x3cb87f);}(_0xb5c3,0xfa));var _0x3b5c=function(_0x28b2dd,_0x54ec7c){_0x28b2dd=_0x28b2dd-0x0;var _0x3bc8a2=_0xb5c3[_0x28b2dd];return _0x3bc8a2;};'use strict';var client=require('../client');exports[_0x3b5c('0x0')]=function(_0x544b97,_0x942db2,_0x3d5a32){return client[_0x3b5c('0x1')](_0x3b5c('0x2'),{'body':_0x544b97,'reason':_0x942db2,'entity':_0x3d5a32,'log':_0x3b5c('0x2')});};exports[_0x3b5c('0x3')]=function(_0xb7537c,_0xa6042b,_0x385b01){return client[_0x3b5c('0x1')](_0x3b5c('0x4'),{'body':_0xb7537c,'duration':_0xa6042b,'waitTime':_0x385b01,'log':_0x3b5c('0x4')});};exports['incrementPreviewCounters']=function(_0x195473){return function(){return client[_0x3b5c('0x1')](_0x3b5c('0x5'),{'body':_0x195473,'log':_0x3b5c('0x5')});};}; \ No newline at end of file +var _0x2fd2=['IncrementPreviewCounters','../client','verifyAdditionalPhones','Request','swapAdditionalPhones','SwapAdditionalPhones'];(function(_0x202cd1,_0x116931){var _0x5bcc1d=function(_0x5bde64){while(--_0x5bde64){_0x202cd1['push'](_0x202cd1['shift']());}};_0x5bcc1d(++_0x116931);}(_0x2fd2,0xa3));var _0x22fd=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x2fd2[_0x5b644e];return _0x49c6bf;};'use strict';var client=require(_0x22fd('0x0'));exports[_0x22fd('0x1')]=function(_0x78c390,_0x1f5557,_0x2330e1){return client[_0x22fd('0x2')]('VerifyAdditionalPhones',{'body':_0x78c390,'reason':_0x1f5557,'entity':_0x2330e1,'log':'VerifyAdditionalPhones'});};exports[_0x22fd('0x3')]=function(_0x40999b,_0x53813c,_0x378418){return client[_0x22fd('0x2')](_0x22fd('0x4'),{'body':_0x40999b,'duration':_0x53813c,'waitTime':_0x378418,'log':_0x22fd('0x4')});};exports['incrementPreviewCounters']=function(_0x5cddba){return function(){return client[_0x22fd('0x2')]('IncrementPreviewCounters',{'body':_0x5cddba,'log':_0x22fd('0x5')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperBlack.js b/server/services/ami/rpc/cmHopperBlack.js index 3cf8338..979e6cc 100644 --- a/server/services/ami/rpc/cmHopperBlack.js +++ b/server/services/ami/rpc/cmHopperBlack.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe833=['phone','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr','../client','checkIsBlackList','Request','GetCmHopperBlack'];(function(_0x681b6e,_0x31a5f9){var _0x379f1e=function(_0x15677d){while(--_0x15677d){_0x681b6e['push'](_0x681b6e['shift']());}};_0x379f1e(++_0x31a5f9);}(_0xe833,0xec));var _0x3e83=function(_0x1d8181,_0x41ecbc){_0x1d8181=_0x1d8181-0x0;var _0x1603d1=_0xe833[_0x1d8181];return _0x1603d1;};'use strict';var client=require(_0x3e83('0x0'));exports[_0x3e83('0x1')]=function(_0x4db4b6){return client[_0x3e83('0x2')](_0x3e83('0x3'),{'options':{'where':{'VoiceQueueId':_0x4db4b6['VoiceQueueId'],'phone':_0x4db4b6[_0x3e83('0x4')]},'raw':![]},'log':_0x3e83('0x3')});};exports[_0x3e83('0x5')]=function(_0x446a6d){return client[_0x3e83('0x2')](_0x3e83('0x3'),{'options':{'where':{'CampaignId':_0x446a6d[_0x3e83('0x6')],'phone':_0x446a6d[_0x3e83('0x4')]},'raw':![]},'log':_0x3e83('0x7')});}; \ No newline at end of file +var _0x2b93=['Request','phone','GetCmHopperBlack','checkIsBlackListIvr','CampaignId','GetCmHopperBlackIvr'];(function(_0x437808,_0x5d54e4){var _0x3752ac=function(_0x366aeb){while(--_0x366aeb){_0x437808['push'](_0x437808['shift']());}};_0x3752ac(++_0x5d54e4);}(_0x2b93,0x8a));var _0x32b9=function(_0x5f3905,_0x43a651){_0x5f3905=_0x5f3905-0x0;var _0x2923b1=_0x2b93[_0x5f3905];return _0x2923b1;};'use strict';var client=require('../client');exports['checkIsBlackList']=function(_0x463e4f){return client[_0x32b9('0x0')]('GetCmHopperBlack',{'options':{'where':{'VoiceQueueId':_0x463e4f['VoiceQueueId'],'phone':_0x463e4f[_0x32b9('0x1')]},'raw':![]},'log':_0x32b9('0x2')});};exports[_0x32b9('0x3')]=function(_0xb4215){return client['Request'](_0x32b9('0x2'),{'options':{'where':{'CampaignId':_0xb4215[_0x32b9('0x4')],'phone':_0xb4215['phone']},'raw':![]},'log':_0x32b9('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperFinal.js b/server/services/ami/rpc/cmHopperFinal.js index 15c5845..21d7bb8 100644 --- a/server/services/ami/rpc/cmHopperFinal.js +++ b/server/services/ami/rpc/cmHopperFinal.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xca7f=['CreateCmHopperFinal','createContact','campaign','Request'];(function(_0x4a5222,_0xb36584){var _0x3df28f=function(_0x2128bf){while(--_0x2128bf){_0x4a5222['push'](_0x4a5222['shift']());}};_0x3df28f(++_0xb36584);}(_0xca7f,0x171));var _0xfca7=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xca7f[_0x2763f2];return _0x3ef471;};'use strict';var client=require('../client');exports[_0xfca7('0x0')]=function(_0x264cef){return function(){_0x264cef[_0xfca7('0x1')]=_0x264cef['queue'];return client[_0xfca7('0x2')]('CreateCmHopperFinal',{'body':_0x264cef,'log':_0xfca7('0x3')});};}; \ No newline at end of file +var _0x240c=['../client','createContact','campaign','Request','CreateCmHopperFinal'];(function(_0x48b5f9,_0x585cfb){var _0x55ae7a=function(_0x5b86a4){while(--_0x5b86a4){_0x48b5f9['push'](_0x48b5f9['shift']());}};_0x55ae7a(++_0x585cfb);}(_0x240c,0x177));var _0xc240=function(_0x319e6d,_0xdf9fae){_0x319e6d=_0x319e6d-0x0;var _0x104729=_0x240c[_0x319e6d];return _0x104729;};'use strict';var client=require(_0xc240('0x0'));exports[_0xc240('0x1')]=function(_0x48a60c){return function(){_0x48a60c[_0xc240('0x2')]=_0x48a60c['queue'];return client[_0xc240('0x3')](_0xc240('0x4'),{'body':_0x48a60c,'log':'CreateCmHopperFinal'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/cmHopperHistory.js b/server/services/ami/rpc/cmHopperHistory.js index 6ad06eb..f85bc0c 100644 --- a/server/services/ami/rpc/cmHopperHistory.js +++ b/server/services/ami/rpc/cmHopperHistory.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0046=['Request','CreateCmHopperHistory','avgHandleTime','subtract','minutes','format','YYYY-MM-DD\x20HH:mm:ss','GetCmHopperHistory','getVoiceQueueHopperHistory','GetVoiceQueueHopperHistory','startOf','day','endOf','queue','getCampaignHopperHistory','GetCampaignHopperHistory','ivr','../client','createHistory','campaign'];(function(_0x5a0430,_0x40b555){var _0x5187c2=function(_0x1c1679){while(--_0x1c1679){_0x5a0430['push'](_0x5a0430['shift']());}};_0x5187c2(++_0x40b555);}(_0x0046,0x1c9));var _0x6004=function(_0x1edfd6,_0x398afa){_0x1edfd6=_0x1edfd6-0x0;var _0x27f747=_0x0046[_0x1edfd6];return _0x27f747;};'use strict';var client=require(_0x6004('0x0'));var moment=require('moment');exports[_0x6004('0x1')]=function(_0xa78a38){_0xa78a38[_0x6004('0x2')]=_0xa78a38['queue'];return client[_0x6004('0x3')]('CreateCmHopperHistory',{'body':_0xa78a38,'log':_0x6004('0x4')});};exports[_0x6004('0x5')]=function(_0x10ce51){return client[_0x6004('0x3')]('AvgHandleTime',{'options':{'where':{'endtime':{'$between':[moment()[_0x6004('0x6')](_0x10ce51,_0x6004('0x7'))[_0x6004('0x8')](_0x6004('0x9')),moment()[_0x6004('0x8')](_0x6004('0x9'))]}},'raw':![]},'log':_0x6004('0xa')});};exports[_0x6004('0xb')]=function(){return function(){return client[_0x6004('0x3')](_0x6004('0xc'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x6004('0xd')](_0x6004('0xe'))[_0x6004('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x6004('0xf')](_0x6004('0xe'))[_0x6004('0x8')](_0x6004('0x9'))]},'campaigntype':_0x6004('0x10')},'raw':![]},'log':_0x6004('0xc')});};};exports[_0x6004('0x11')]=function(){return function(){return client[_0x6004('0x3')](_0x6004('0x12'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x6004('0xe'))['format'](_0x6004('0x9')),moment()[_0x6004('0xf')](_0x6004('0xe'))[_0x6004('0x8')]('YYYY-MM-DD\x20HH:mm:ss')]},'campaigntype':_0x6004('0x13')},'raw':![]},'log':_0x6004('0x12')});};}; \ No newline at end of file +var _0xa4e5=['startOf','ivr','../client','moment','campaign','queue','Request','CreateCmHopperHistory','avgHandleTime','AvgHandleTime','subtract','minutes','YYYY-MM-DD\x20HH:mm:ss','format','GetCmHopperHistory','GetVoiceQueueHopperHistory','day','endOf','getCampaignHopperHistory','GetCampaignHopperHistory'];(function(_0xc09ba9,_0x9750d2){var _0x10f81a=function(_0x56ba2c){while(--_0x56ba2c){_0xc09ba9['push'](_0xc09ba9['shift']());}};_0x10f81a(++_0x9750d2);}(_0xa4e5,0xf2));var _0x5a4e=function(_0x1f6260,_0x3314ec){_0x1f6260=_0x1f6260-0x0;var _0x502fab=_0xa4e5[_0x1f6260];return _0x502fab;};'use strict';var client=require(_0x5a4e('0x0'));var moment=require(_0x5a4e('0x1'));exports['createHistory']=function(_0x12d0cc){_0x12d0cc[_0x5a4e('0x2')]=_0x12d0cc[_0x5a4e('0x3')];return client[_0x5a4e('0x4')](_0x5a4e('0x5'),{'body':_0x12d0cc,'log':_0x5a4e('0x5')});};exports[_0x5a4e('0x6')]=function(_0x2080de){return client[_0x5a4e('0x4')](_0x5a4e('0x7'),{'options':{'where':{'endtime':{'$between':[moment()[_0x5a4e('0x8')](_0x2080de,_0x5a4e('0x9'))['format'](_0x5a4e('0xa')),moment()[_0x5a4e('0xb')](_0x5a4e('0xa'))]}},'raw':![]},'log':_0x5a4e('0xc')});};exports['getVoiceQueueHopperHistory']=function(){return function(){return client['Request'](_0x5a4e('0xd'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf'](_0x5a4e('0xe'))[_0x5a4e('0xb')](_0x5a4e('0xa')),moment()[_0x5a4e('0xf')](_0x5a4e('0xe'))['format'](_0x5a4e('0xa'))]},'campaigntype':'queue'},'raw':![]},'log':_0x5a4e('0xd')});};};exports[_0x5a4e('0x10')]=function(){return function(){return client[_0x5a4e('0x4')](_0x5a4e('0x11'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x5a4e('0x12')](_0x5a4e('0xe'))[_0x5a4e('0xb')](_0x5a4e('0xa')),moment()[_0x5a4e('0xf')]('day')[_0x5a4e('0xb')](_0x5a4e('0xa'))]},'campaigntype':_0x5a4e('0x13')},'raw':![]},'log':_0x5a4e('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxAccount.js b/server/services/ami/rpc/faxAccount.js index 5bc0a39..fedd60e 100644 --- a/server/services/ami/rpc/faxAccount.js +++ b/server/services/ami/rpc/faxAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2581=['localstationid','minrate','maxrate','modem','gateway','faxdetect','tech','TrunkId','ListId','key','Trunk','getFaxAccount','notify','NotifyFaxAccount','../client','getFaxAccounts','Request','GetFaxAccount','name','ecm','headerinfo'];(function(_0x49ab04,_0x5a01e){var _0x330fb2=function(_0x45bf7f){while(--_0x45bf7f){_0x49ab04['push'](_0x49ab04['shift']());}};_0x330fb2(++_0x5a01e);}(_0x2581,0xcb));var _0x1258=function(_0x1a2407,_0x29165a){_0x1a2407=_0x1a2407-0x0;var _0x1f1ea5=_0x2581[_0x1a2407];return _0x1f1ea5;};'use strict';var client=require(_0x1258('0x0'));exports[_0x1258('0x1')]=function(){return function(){return client[_0x1258('0x2')](_0x1258('0x3'),{'options':{'raw':![],'attributes':['id',_0x1258('0x4'),'description',_0x1258('0x5'),_0x1258('0x6'),_0x1258('0x7'),_0x1258('0x8'),_0x1258('0x9'),_0x1258('0xa'),_0x1258('0xb'),_0x1258('0xc'),'t38timeout',_0x1258('0xd'),_0x1258('0xe'),_0x1258('0xf'),_0x1258('0x10')],'include':[{'model':_0x1258('0x11'),'as':_0x1258('0x11'),'attributes':['id',_0x1258('0x4'),'callerid','active']}]},'log':_0x1258('0x12')});};};exports[_0x1258('0x13')]=function(_0x15eea2,_0x1fe32a){return client['Request'](_0x1258('0x14'),{'account':{'id':_0x15eea2},'body':_0x1fe32a,'log':_0x1258('0x14')});}; \ No newline at end of file +var _0x781d=['localstationid','minrate','maxrate','modem','gateway','faxdetect','tech','TrunkId','ListId','key','Trunk','callerid','active','notify','NotifyFaxAccount','../client','getFaxAccounts','name','description','ecm','headerinfo'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x781d,0x14a));var _0xd781=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x781d[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0xd781('0x0'));exports[_0xd781('0x1')]=function(){return function(){return client['Request']('GetFaxAccount',{'options':{'raw':![],'attributes':['id',_0xd781('0x2'),_0xd781('0x3'),_0xd781('0x4'),_0xd781('0x5'),_0xd781('0x6'),_0xd781('0x7'),_0xd781('0x8'),_0xd781('0x9'),_0xd781('0xa'),_0xd781('0xb'),'t38timeout',_0xd781('0xc'),_0xd781('0xd'),_0xd781('0xe'),_0xd781('0xf')],'include':[{'model':'Trunk','as':_0xd781('0x10'),'attributes':['id','name',_0xd781('0x11'),_0xd781('0x12')]}]},'log':'getFaxAccount'});};};exports[_0xd781('0x13')]=function(_0x29c2a7,_0x4bf265){return client['Request'](_0xd781('0x14'),{'account':{'id':_0x29c2a7},'body':_0x4bf265,'log':_0xd781('0x14')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/faxMessage.js b/server/services/ami/rpc/faxMessage.js index 94ee512..e3bded2 100644 --- a/server/services/ami/rpc/faxMessage.js +++ b/server/services/ami/rpc/faxMessage.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7d34=['../client','update','Request','UpdateFaxMessage'];(function(_0x140c76,_0x1c66eb){var _0x2f27bb=function(_0x667f9){while(--_0x667f9){_0x140c76['push'](_0x140c76['shift']());}};_0x2f27bb(++_0x1c66eb);}(_0x7d34,0x128));var _0x47d3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7d34[_0x57b54c];return _0x59cc19;};'use strict';var client=require(_0x47d3('0x0'));exports[_0x47d3('0x1')]=function(_0x189035,_0x477aaf){return client[_0x47d3('0x2')](_0x47d3('0x3'),{'body':_0x477aaf,'options':{'where':{'AttachmentId':_0x189035}},'log':'UpdateFaxMessage'});}; \ No newline at end of file +var _0xea99=['update','Request','UpdateFaxMessage','../client'];(function(_0x72a33d,_0x5691da){var _0x2621d5=function(_0x95b7c6){while(--_0x95b7c6){_0x72a33d['push'](_0x72a33d['shift']());}};_0x2621d5(++_0x5691da);}(_0xea99,0xdf));var _0x9ea9=function(_0x1188de,_0x2359b5){_0x1188de=_0x1188de-0x0;var _0x3dc4ad=_0xea99[_0x1188de];return _0x3dc4ad;};'use strict';var client=require(_0x9ea9('0x0'));exports[_0x9ea9('0x1')]=function(_0x4a413f,_0x597809){return client[_0x9ea9('0x2')]('UpdateFaxMessage',{'body':_0x597809,'options':{'where':{'AttachmentId':_0x4a413f}},'log':_0x9ea9('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/desk.js b/server/services/ami/rpc/integrations/desk.js index 782e6c7..7934ef5 100644 --- a/server/services/ami/rpc/integrations/desk.js +++ b/server/services/ami/rpc/integrations/desk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xde36=['Fields','customField','Tag','Tags','../../client','getDeskAccounts','Request','GetDeskAccount','name','description','username','password','type','serverUrl','DeskConfiguration','DeskField','content','Variable','Descriptions','key','keyType','keyContent','variableName'];(function(_0x5ba38a,_0x132834){var _0x28eebe=function(_0x56946a){while(--_0x56946a){_0x5ba38a['push'](_0x5ba38a['shift']());}};_0x28eebe(++_0x132834);}(_0xde36,0x146));var _0x6de3=function(_0x492ebc,_0x42a9d2){_0x492ebc=_0x492ebc-0x0;var _0x3d6c9b=_0xde36[_0x492ebc];return _0x3d6c9b;};'use strict';var client=require(_0x6de3('0x0'));exports[_0x6de3('0x1')]=function(){return function(_0x38ae03){return client[_0x6de3('0x2')](_0x6de3('0x3'),{'options':{'raw':![],'attributes':['id',_0x6de3('0x4'),_0x6de3('0x5'),_0x6de3('0x6'),_0x6de3('0x7'),'remoteUri','authType',_0x6de3('0x8'),_0x6de3('0x9')],'include':[{'model':_0x6de3('0xa'),'as':'Configurations','attributes':['id','name'],'include':[{'model':_0x6de3('0xb'),'as':'Subjects','attributes':['id','type',_0x6de3('0xc'),'variableName'],'include':[{'model':'Variable','as':_0x6de3('0xd'),'attributes':['id','name']}]},{'model':_0x6de3('0xb'),'as':_0x6de3('0xe'),'attributes':['id',_0x6de3('0x8'),_0x6de3('0xc'),_0x6de3('0xf'),_0x6de3('0x10'),_0x6de3('0x11'),_0x6de3('0x12')],'include':[{'model':_0x6de3('0xd'),'as':_0x6de3('0xd'),'attributes':['id',_0x6de3('0x4')]}]},{'model':_0x6de3('0xb'),'as':_0x6de3('0x13'),'attributes':['id',_0x6de3('0x8'),'content','idField','nameField',_0x6de3('0x14'),_0x6de3('0x12')],'include':[{'model':'Variable','as':_0x6de3('0xd'),'attributes':['id',_0x6de3('0x4')]}]},{'model':_0x6de3('0x15'),'as':_0x6de3('0x16'),'attributes':['id',_0x6de3('0x4')]}]}]},'log':_0x6de3('0x3')});};}; \ No newline at end of file +var _0x4c84=['authType','type','serverUrl','Configurations','DeskField','Subjects','content','variableName','Variable','Descriptions','key','keyContent','Fields','idField','nameField','customField','Tag','Tags','GetDeskAccount','../../client','getDeskAccounts','Request','name','description','username','password','remoteUri'];(function(_0x3643b2,_0x3201bc){var _0x16c1b7=function(_0xb75fd5){while(--_0xb75fd5){_0x3643b2['push'](_0x3643b2['shift']());}};_0x16c1b7(++_0x3201bc);}(_0x4c84,0x1c3));var _0x44c8=function(_0x59108f,_0x415d52){_0x59108f=_0x59108f-0x0;var _0x123dad=_0x4c84[_0x59108f];return _0x123dad;};'use strict';var client=require(_0x44c8('0x0'));exports[_0x44c8('0x1')]=function(){return function(_0x41ce52){return client[_0x44c8('0x2')]('GetDeskAccount',{'options':{'raw':![],'attributes':['id',_0x44c8('0x3'),_0x44c8('0x4'),_0x44c8('0x5'),_0x44c8('0x6'),_0x44c8('0x7'),_0x44c8('0x8'),_0x44c8('0x9'),_0x44c8('0xa')],'include':[{'model':'DeskConfiguration','as':_0x44c8('0xb'),'attributes':['id',_0x44c8('0x3')],'include':[{'model':_0x44c8('0xc'),'as':_0x44c8('0xd'),'attributes':['id','type',_0x44c8('0xe'),_0x44c8('0xf')],'include':[{'model':_0x44c8('0x10'),'as':_0x44c8('0x10'),'attributes':['id','name']}]},{'model':_0x44c8('0xc'),'as':_0x44c8('0x11'),'attributes':['id',_0x44c8('0x9'),_0x44c8('0xe'),_0x44c8('0x12'),'keyType',_0x44c8('0x13'),_0x44c8('0xf')],'include':[{'model':'Variable','as':_0x44c8('0x10'),'attributes':['id',_0x44c8('0x3')]}]},{'model':_0x44c8('0xc'),'as':_0x44c8('0x14'),'attributes':['id','type',_0x44c8('0xe'),_0x44c8('0x15'),_0x44c8('0x16'),_0x44c8('0x17'),'variableName'],'include':[{'model':_0x44c8('0x10'),'as':_0x44c8('0x10'),'attributes':['id',_0x44c8('0x3')]}]},{'model':_0x44c8('0x18'),'as':_0x44c8('0x19'),'attributes':['id',_0x44c8('0x3')]}]}]},'log':_0x44c8('0x1a')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/dynamics365.js b/server/services/ami/rpc/integrations/dynamics365.js index e062c1e..9cf6882 100644 --- a/server/services/ami/rpc/integrations/dynamics365.js +++ b/server/services/ami/rpc/integrations/dynamics365.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3070=['Configurations','moduleCreate','additionalSearchContact','openNewTab','Dynamics365Field','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','customField','CloudProvider','data2','data5','data7','getDynamics365Accounts','Request','GetDynamics365Account','name','username','password','remoteUri','clientSecret','serverUrl','description','modernAuthentication'];(function(_0x23292a,_0x1e08ea){var _0x4564f2=function(_0x1ae201){while(--_0x1ae201){_0x23292a['push'](_0x23292a['shift']());}};_0x4564f2(++_0x1e08ea);}(_0x3070,0x75));var _0x0307=function(_0x324b5a,_0x1358f8){_0x324b5a=_0x324b5a-0x0;var _0x38f63f=_0x3070[_0x324b5a];return _0x38f63f;};'use strict';var client=require('../../client');exports[_0x0307('0x0')]=function(){return function(_0x50afb5){return client[_0x0307('0x1')](_0x0307('0x2'),{'options':{'raw':![],'attributes':['id',_0x0307('0x3'),_0x0307('0x4'),_0x0307('0x5'),_0x0307('0x6'),'tenantId','clientId',_0x0307('0x7'),_0x0307('0x8'),_0x0307('0x9'),_0x0307('0xa')],'include':[{'model':'Dynamics365Configuration','as':_0x0307('0xb'),'attributes':['id',_0x0307('0x3'),'ticketType',_0x0307('0xc'),_0x0307('0xd'),_0x0307('0xe')],'include':[{'model':_0x0307('0xf'),'as':_0x0307('0x10'),'attributes':['id',_0x0307('0x11'),_0x0307('0x12'),_0x0307('0x13')],'include':[{'model':_0x0307('0x14'),'as':'Variable','attributes':['id',_0x0307('0x3')]}]},{'model':'Dynamics365Field','as':_0x0307('0x15'),'attributes':['id',_0x0307('0x11'),_0x0307('0x12'),_0x0307('0x16'),_0x0307('0x17'),_0x0307('0x18'),_0x0307('0x13')],'include':[{'model':_0x0307('0x14'),'as':_0x0307('0x14'),'attributes':['id',_0x0307('0x3')]}]},{'model':_0x0307('0xf'),'as':_0x0307('0x19'),'attributes':['id',_0x0307('0x11'),_0x0307('0x12'),_0x0307('0x1a'),'nameField',_0x0307('0x1b'),_0x0307('0x13')],'include':[{'model':_0x0307('0x14'),'as':'Variable','attributes':['id','name']}]}]},{'model':_0x0307('0x1c'),'as':_0x0307('0x1c'),'attributes':['id',_0x0307('0x1d'),_0x0307('0x1e'),_0x0307('0x1f')]}]},'log':_0x0307('0x2')});};}; \ No newline at end of file +var _0xe511=['nameField','customField','CloudProvider','data2','data5','data7','GetDynamics365Account','../../client','getDynamics365Accounts','Request','name','username','remoteUri','tenantId','clientId','clientSecret','description','modernAuthentication','ticketType','openNewTab','Dynamics365Field','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','Fields'];(function(_0x582403,_0x3aa03a){var _0x50a78a=function(_0x25c954){while(--_0x25c954){_0x582403['push'](_0x582403['shift']());}};_0x50a78a(++_0x3aa03a);}(_0xe511,0x16f));var _0x1e51=function(_0x2b495c,_0x596e31){_0x2b495c=_0x2b495c-0x0;var _0x59e6cd=_0xe511[_0x2b495c];return _0x59e6cd;};'use strict';var client=require(_0x1e51('0x0'));exports[_0x1e51('0x1')]=function(){return function(_0x49cbdc){return client[_0x1e51('0x2')]('GetDynamics365Account',{'options':{'raw':![],'attributes':['id',_0x1e51('0x3'),_0x1e51('0x4'),'password',_0x1e51('0x5'),_0x1e51('0x6'),_0x1e51('0x7'),_0x1e51('0x8'),'serverUrl',_0x1e51('0x9'),_0x1e51('0xa')],'include':[{'model':'Dynamics365Configuration','as':'Configurations','attributes':['id',_0x1e51('0x3'),_0x1e51('0xb'),'moduleCreate','additionalSearchContact',_0x1e51('0xc')],'include':[{'model':_0x1e51('0xd'),'as':_0x1e51('0xe'),'attributes':['id',_0x1e51('0xf'),_0x1e51('0x10'),_0x1e51('0x11')],'include':[{'model':'Variable','as':_0x1e51('0x12'),'attributes':['id',_0x1e51('0x3')]}]},{'model':_0x1e51('0xd'),'as':_0x1e51('0x13'),'attributes':['id',_0x1e51('0xf'),_0x1e51('0x10'),'key',_0x1e51('0x14'),_0x1e51('0x15'),_0x1e51('0x11')],'include':[{'model':_0x1e51('0x12'),'as':_0x1e51('0x12'),'attributes':['id',_0x1e51('0x3')]}]},{'model':_0x1e51('0xd'),'as':_0x1e51('0x16'),'attributes':['id',_0x1e51('0xf'),_0x1e51('0x10'),'idField',_0x1e51('0x17'),_0x1e51('0x18'),_0x1e51('0x11')],'include':[{'model':'Variable','as':_0x1e51('0x12'),'attributes':['id','name']}]}]},{'model':'CloudProvider','as':_0x1e51('0x19'),'attributes':['id',_0x1e51('0x1a'),_0x1e51('0x1b'),_0x1e51('0x1c')]}]},'log':_0x1e51('0x1d')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshdesk.js b/server/services/ami/rpc/integrations/freshdesk.js index 8077fbb..76fa159 100644 --- a/server/services/ami/rpc/integrations/freshdesk.js +++ b/server/services/ami/rpc/integrations/freshdesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd5a2=['Variable','content','key','keyType','keyContent','idField','nameField','customField','getFreshdeskAccounts','Request','GetFreshdeskAccount','name','apiKey','remoteUri','serverUrl','FreshdeskConfiguration','Configurations','Tag','FreshdeskField','Subjects','type'];(function(_0x3ceb87,_0x4104bf){var _0x14cc27=function(_0x3a6f6f){while(--_0x3a6f6f){_0x3ceb87['push'](_0x3ceb87['shift']());}};_0x14cc27(++_0x4104bf);}(_0xd5a2,0x1eb));var _0x2d5a=function(_0x56d051,_0x13f3e2){_0x56d051=_0x56d051-0x0;var _0x3ec67f=_0xd5a2[_0x56d051];return _0x3ec67f;};'use strict';var client=require('../../client');exports[_0x2d5a('0x0')]=function(){return function(_0x217b8c){return client[_0x2d5a('0x1')](_0x2d5a('0x2'),{'options':{'raw':![],'attributes':['id',_0x2d5a('0x3'),'username',_0x2d5a('0x4'),_0x2d5a('0x5'),_0x2d5a('0x6')],'include':[{'model':_0x2d5a('0x7'),'as':_0x2d5a('0x8'),'attributes':['id',_0x2d5a('0x3')],'include':[{'model':_0x2d5a('0x9'),'attributes':['id',_0x2d5a('0x3')]},{'model':_0x2d5a('0xa'),'as':_0x2d5a('0xb'),'attributes':['id',_0x2d5a('0xc'),'content','variableName'],'include':[{'model':_0x2d5a('0xd'),'as':'Variable','attributes':['id',_0x2d5a('0x3')]}]},{'model':_0x2d5a('0xa'),'as':'Descriptions','attributes':['id',_0x2d5a('0xc'),_0x2d5a('0xe'),_0x2d5a('0xf'),_0x2d5a('0x10'),_0x2d5a('0x11'),'variableName'],'include':[{'model':_0x2d5a('0xd'),'as':_0x2d5a('0xd'),'attributes':['id',_0x2d5a('0x3')]}]},{'model':_0x2d5a('0xa'),'as':'Fields','attributes':['id','type',_0x2d5a('0xe'),_0x2d5a('0x12'),_0x2d5a('0x13'),_0x2d5a('0x14'),'variableName'],'include':[{'model':_0x2d5a('0xd'),'as':_0x2d5a('0xd'),'attributes':['id',_0x2d5a('0x3')]}]}]}]},'log':_0x2d5a('0x2')});};}; \ No newline at end of file +var _0x84a0=['name','username','serverUrl','FreshdeskConfiguration','Tag','FreshdeskField','Subjects','content','variableName','Variable','type','key','keyType','keyContent','Fields','idField','nameField','GetFreshdeskAccount','../../client','getFreshdeskAccounts','Request'];(function(_0x28a118,_0x1afe78){var _0x28270e=function(_0x175ce7){while(--_0x175ce7){_0x28a118['push'](_0x28a118['shift']());}};_0x28270e(++_0x1afe78);}(_0x84a0,0x66));var _0x084a=function(_0x465154,_0xa33b26){_0x465154=_0x465154-0x0;var _0x561b8f=_0x84a0[_0x465154];return _0x561b8f;};'use strict';var client=require(_0x084a('0x0'));exports[_0x084a('0x1')]=function(){return function(_0x209635){return client[_0x084a('0x2')]('GetFreshdeskAccount',{'options':{'raw':![],'attributes':['id',_0x084a('0x3'),_0x084a('0x4'),'apiKey','remoteUri',_0x084a('0x5')],'include':[{'model':_0x084a('0x6'),'as':'Configurations','attributes':['id',_0x084a('0x3')],'include':[{'model':_0x084a('0x7'),'attributes':['id',_0x084a('0x3')]},{'model':_0x084a('0x8'),'as':_0x084a('0x9'),'attributes':['id','type',_0x084a('0xa'),_0x084a('0xb')],'include':[{'model':_0x084a('0xc'),'as':_0x084a('0xc'),'attributes':['id',_0x084a('0x3')]}]},{'model':'FreshdeskField','as':'Descriptions','attributes':['id',_0x084a('0xd'),_0x084a('0xa'),_0x084a('0xe'),_0x084a('0xf'),_0x084a('0x10'),'variableName'],'include':[{'model':'Variable','as':_0x084a('0xc'),'attributes':['id',_0x084a('0x3')]}]},{'model':_0x084a('0x8'),'as':_0x084a('0x11'),'attributes':['id',_0x084a('0xd'),_0x084a('0xa'),_0x084a('0x12'),_0x084a('0x13'),'customField',_0x084a('0xb')],'include':[{'model':'Variable','as':_0x084a('0xc'),'attributes':['id',_0x084a('0x3')]}]}]}]},'log':_0x084a('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/freshsales.js b/server/services/ami/rpc/integrations/freshsales.js index f8dff8d..0356a0e 100644 --- a/server/services/ami/rpc/integrations/freshsales.js +++ b/server/services/ami/rpc/integrations/freshsales.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4c60=['Request','name','FreshsalesConfiguration','Configurations','FreshsalesField','Subjects','type','content','Variable','key','keyContent','variableName','GetFreshsalesccount','../../client','getFreshsalesAccounts'];(function(_0x556735,_0x3b36bf){var _0x506efa=function(_0x5e5a8b){while(--_0x5e5a8b){_0x556735['push'](_0x556735['shift']());}};_0x506efa(++_0x3b36bf);}(_0x4c60,0xc1));var _0x04c6=function(_0x237ce6,_0x5680c8){_0x237ce6=_0x237ce6-0x0;var _0x235f4c=_0x4c60[_0x237ce6];return _0x235f4c;};'use strict';var client=require(_0x04c6('0x0'));exports[_0x04c6('0x1')]=function(){return function(_0x1d5492){return client[_0x04c6('0x2')]('GetFreshsalesAccount',{'options':{'raw':![],'attributes':['id',_0x04c6('0x3'),'username','apiKey','remoteUri','serverUrl'],'include':[{'model':_0x04c6('0x4'),'as':_0x04c6('0x5'),'attributes':['id',_0x04c6('0x3')],'include':[{'model':_0x04c6('0x6'),'as':_0x04c6('0x7'),'attributes':['id',_0x04c6('0x8'),_0x04c6('0x9'),'variableName'],'include':[{'model':_0x04c6('0xa'),'as':_0x04c6('0xa'),'attributes':['id',_0x04c6('0x3')]}]},{'model':_0x04c6('0x6'),'as':'Descriptions','attributes':['id','type','content',_0x04c6('0xb'),'keyType',_0x04c6('0xc'),_0x04c6('0xd')],'include':[{'model':'Variable','as':_0x04c6('0xa'),'attributes':['id',_0x04c6('0x3')]}]}]}]},'log':_0x04c6('0xe')});};}; \ No newline at end of file +var _0x6ec2=['Variable','Descriptions','type','key','keyType','keyContent','../../client','getFreshsalesAccounts','Request','GetFreshsalesAccount','name','apiKey','remoteUri','serverUrl','FreshsalesConfiguration','Configurations','FreshsalesField','content','variableName'];(function(_0x30d356,_0x3e0e5c){var _0x14e269=function(_0x595149){while(--_0x595149){_0x30d356['push'](_0x30d356['shift']());}};_0x14e269(++_0x3e0e5c);}(_0x6ec2,0x78));var _0x26ec=function(_0xd83cba,_0x22f6ee){_0xd83cba=_0xd83cba-0x0;var _0x25081e=_0x6ec2[_0xd83cba];return _0x25081e;};'use strict';var client=require(_0x26ec('0x0'));exports[_0x26ec('0x1')]=function(){return function(_0x3d8b7c){return client[_0x26ec('0x2')](_0x26ec('0x3'),{'options':{'raw':![],'attributes':['id',_0x26ec('0x4'),'username',_0x26ec('0x5'),_0x26ec('0x6'),_0x26ec('0x7')],'include':[{'model':_0x26ec('0x8'),'as':_0x26ec('0x9'),'attributes':['id','name'],'include':[{'model':_0x26ec('0xa'),'as':'Subjects','attributes':['id','type',_0x26ec('0xb'),_0x26ec('0xc')],'include':[{'model':_0x26ec('0xd'),'as':'Variable','attributes':['id',_0x26ec('0x4')]}]},{'model':'FreshsalesField','as':_0x26ec('0xe'),'attributes':['id',_0x26ec('0xf'),_0x26ec('0xb'),_0x26ec('0x10'),_0x26ec('0x11'),_0x26ec('0x12'),_0x26ec('0xc')],'include':[{'model':_0x26ec('0xd'),'as':_0x26ec('0xd'),'attributes':['id',_0x26ec('0x4')]}]}]}]},'log':'GetFreshsalesccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/salesforce.js b/server/services/ami/rpc/integrations/salesforce.js index 9da133c..3a990ab 100644 --- a/server/services/ami/rpc/integrations/salesforce.js +++ b/server/services/ami/rpc/integrations/salesforce.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb0b=['remoteUri','clientSecret','securityToken','serverUrl','type','SalesforceConfiguration','Configurations','moduleSearch','moduleCreate','ticketType','leadId','Subjects','Variable','SalesforceField','Fields','../../client','getSalesforceAccounts','GetSalesforceAccount','name'];(function(_0x2a2edb,_0x2410fc){var _0x9e0c38=function(_0x2350ed){while(--_0x2350ed){_0x2a2edb['push'](_0x2a2edb['shift']());}};_0x9e0c38(++_0x2410fc);}(_0xfb0b,0x94));var _0xbfb0=function(_0x593c84,_0x3692b8){_0x593c84=_0x593c84-0x0;var _0xe8c2da=_0xfb0b[_0x593c84];return _0xe8c2da;};'use strict';var client=require(_0xbfb0('0x0'));exports[_0xbfb0('0x1')]=function(){return function(_0x2d627f){return client['Request'](_0xbfb0('0x2'),{'options':{'raw':![],'attributes':['id',_0xbfb0('0x3'),'username','password',_0xbfb0('0x4'),'clientId',_0xbfb0('0x5'),_0xbfb0('0x6'),_0xbfb0('0x7'),_0xbfb0('0x8')],'include':[{'model':_0xbfb0('0x9'),'as':_0xbfb0('0xa'),'attributes':['id','name',_0xbfb0('0xb'),_0xbfb0('0xc'),_0xbfb0('0xd'),_0xbfb0('0xe'),'additionalSearchAccount','additionalSearchContact','additionalSearchLead'],'include':[{'model':'SalesforceField','as':_0xbfb0('0xf'),'include':[{'model':_0xbfb0('0x10'),'as':_0xbfb0('0x10'),'attributes':['id','name']}]},{'model':_0xbfb0('0x11'),'as':'Descriptions','include':[{'model':_0xbfb0('0x10'),'as':_0xbfb0('0x10'),'attributes':['id',_0xbfb0('0x3')]}]},{'model':_0xbfb0('0x11'),'as':_0xbfb0('0x12'),'include':[{'model':_0xbfb0('0x10'),'as':'Variable','attributes':['id',_0xbfb0('0x3')]}]}]}]},'log':'GetSalesforceAccount'});};}; \ No newline at end of file +var _0x0c07=['getSalesforceAccounts','Request','GetSalesforceAccount','name','username','password','remoteUri','clientId','clientSecret','securityToken','type','moduleSearch','moduleCreate','ticketType','additionalSearchAccount','additionalSearchLead','Subjects','Variable','SalesforceField','../../client'];(function(_0x1f1887,_0x5efa53){var _0x2970df=function(_0x1a65a8){while(--_0x1a65a8){_0x1f1887['push'](_0x1f1887['shift']());}};_0x2970df(++_0x5efa53);}(_0x0c07,0x8b));var _0x70c0=function(_0x20a005,_0x3267c4){_0x20a005=_0x20a005-0x0;var _0x318723=_0x0c07[_0x20a005];return _0x318723;};'use strict';var client=require(_0x70c0('0x0'));exports[_0x70c0('0x1')]=function(){return function(_0x38a546){return client[_0x70c0('0x2')](_0x70c0('0x3'),{'options':{'raw':![],'attributes':['id',_0x70c0('0x4'),_0x70c0('0x5'),_0x70c0('0x6'),_0x70c0('0x7'),_0x70c0('0x8'),_0x70c0('0x9'),_0x70c0('0xa'),'serverUrl',_0x70c0('0xb')],'include':[{'model':'SalesforceConfiguration','as':'Configurations','attributes':['id',_0x70c0('0x4'),_0x70c0('0xc'),_0x70c0('0xd'),_0x70c0('0xe'),'leadId',_0x70c0('0xf'),'additionalSearchContact',_0x70c0('0x10')],'include':[{'model':'SalesforceField','as':_0x70c0('0x11'),'include':[{'model':'Variable','as':_0x70c0('0x12'),'attributes':['id',_0x70c0('0x4')]}]},{'model':'SalesforceField','as':'Descriptions','include':[{'model':'Variable','as':_0x70c0('0x12'),'attributes':['id',_0x70c0('0x4')]}]},{'model':_0x70c0('0x13'),'as':'Fields','include':[{'model':_0x70c0('0x12'),'as':'Variable','attributes':['id',_0x70c0('0x4')]}]}]}]},'log':_0x70c0('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/servicenow.js b/server/services/ami/rpc/integrations/servicenow.js index 0af7dc2..c1cfd85 100644 --- a/server/services/ami/rpc/integrations/servicenow.js +++ b/server/services/ami/rpc/integrations/servicenow.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x187d=['../../client','Request','GetServicenowAccount','name','description','username','email','remoteUri','ServicenowConfiguration','Configurations','ServicenowField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','idField','nameField'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0x187d,0x93));var _0xd187=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x187d[_0x138f59];return _0x3d114d;};'use strict';var client=require(_0xd187('0x0'));exports['getServicenowAccounts']=function(){return function(_0x3b9b6d){return client[_0xd187('0x1')](_0xd187('0x2'),{'options':{'raw':![],'attributes':['id',_0xd187('0x3'),_0xd187('0x4'),_0xd187('0x5'),'password',_0xd187('0x6'),_0xd187('0x7'),'serverUrl'],'include':[{'model':_0xd187('0x8'),'as':_0xd187('0x9'),'attributes':['id',_0xd187('0x3')],'include':[{'model':_0xd187('0xa'),'as':_0xd187('0xb'),'attributes':['id',_0xd187('0xc'),_0xd187('0xd'),_0xd187('0xe')],'include':[{'model':'Variable','as':_0xd187('0xf'),'attributes':['id',_0xd187('0x3')]}]},{'model':_0xd187('0xa'),'as':_0xd187('0x10'),'attributes':['id',_0xd187('0xc'),_0xd187('0xd'),'key',_0xd187('0x11'),_0xd187('0x12'),_0xd187('0xe')],'include':[{'model':'Variable','as':_0xd187('0xf'),'attributes':['id',_0xd187('0x3')]}]},{'model':_0xd187('0xa'),'as':'Fields','attributes':['id',_0xd187('0xc'),_0xd187('0xd'),_0xd187('0x13'),_0xd187('0x14'),'customField',_0xd187('0xe')],'include':[{'model':_0xd187('0xf'),'as':_0xd187('0xf'),'attributes':['id',_0xd187('0x3')]}]}]}]},'log':'GetServicenowkAccount'});};}; \ No newline at end of file +var _0x1967=['description','username','password','email','remoteUri','ServicenowConfiguration','Configurations','ServicenowField','Subjects','type','variableName','Variable','content','key','keyType','keyContent','Fields','idField','nameField','customField','GetServicenowkAccount','getServicenowAccounts','Request','GetServicenowAccount','name'];(function(_0x11325f,_0x4dafc9){var _0x13b110=function(_0x1d325d){while(--_0x1d325d){_0x11325f['push'](_0x11325f['shift']());}};_0x13b110(++_0x4dafc9);}(_0x1967,0x173));var _0x7196=function(_0x479403,_0x4808cb){_0x479403=_0x479403-0x0;var _0x2a75b9=_0x1967[_0x479403];return _0x2a75b9;};'use strict';var client=require('../../client');exports[_0x7196('0x0')]=function(){return function(_0xdb72bb){return client[_0x7196('0x1')](_0x7196('0x2'),{'options':{'raw':![],'attributes':['id',_0x7196('0x3'),_0x7196('0x4'),_0x7196('0x5'),_0x7196('0x6'),_0x7196('0x7'),_0x7196('0x8'),'serverUrl'],'include':[{'model':_0x7196('0x9'),'as':_0x7196('0xa'),'attributes':['id',_0x7196('0x3')],'include':[{'model':_0x7196('0xb'),'as':_0x7196('0xc'),'attributes':['id',_0x7196('0xd'),'content',_0x7196('0xe')],'include':[{'model':_0x7196('0xf'),'as':_0x7196('0xf'),'attributes':['id',_0x7196('0x3')]}]},{'model':_0x7196('0xb'),'as':'Descriptions','attributes':['id','type',_0x7196('0x10'),_0x7196('0x11'),_0x7196('0x12'),_0x7196('0x13'),_0x7196('0xe')],'include':[{'model':_0x7196('0xf'),'as':_0x7196('0xf'),'attributes':['id',_0x7196('0x3')]}]},{'model':_0x7196('0xb'),'as':_0x7196('0x14'),'attributes':['id',_0x7196('0xd'),'content',_0x7196('0x15'),_0x7196('0x16'),_0x7196('0x17'),_0x7196('0xe')],'include':[{'model':'Variable','as':_0x7196('0xf'),'attributes':['id','name']}]}]}]},'log':_0x7196('0x18')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/sugarcrm.js b/server/services/ami/rpc/integrations/sugarcrm.js index b9666f3..e29ee02 100644 --- a/server/services/ami/rpc/integrations/sugarcrm.js +++ b/server/services/ami/rpc/integrations/sugarcrm.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x57ca=['name','username','password','remoteUri','SugarcrmConfiguration','Configurations','SugarcrmField','Subjects','type','content','variableName','Variable','Descriptions','keyType','keyContent','Fields','nameField','getSugarcrmAccounts','GetSugarcrmAccount'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x57ca,0x108));var _0xa57c=function(_0x49e9c5,_0x5c4b22){_0x49e9c5=_0x49e9c5-0x0;var _0xc7daa8=_0x57ca[_0x49e9c5];return _0xc7daa8;};'use strict';var client=require('../../client');exports[_0xa57c('0x0')]=function(){return function(_0x4ad696){return client['Request'](_0xa57c('0x1'),{'options':{'raw':![],'attributes':['id',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),'serverUrl'],'include':[{'model':_0xa57c('0x6'),'as':_0xa57c('0x7'),'attributes':['id',_0xa57c('0x2')],'include':[{'model':_0xa57c('0x8'),'as':_0xa57c('0x9'),'attributes':['id',_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc')],'include':[{'model':'Variable','as':_0xa57c('0xd'),'attributes':['id','name']}]},{'model':_0xa57c('0x8'),'as':_0xa57c('0xe'),'attributes':['id','type',_0xa57c('0xb'),'key',_0xa57c('0xf'),_0xa57c('0x10'),'variableName'],'include':[{'model':_0xa57c('0xd'),'as':'Variable','attributes':['id',_0xa57c('0x2')]}]},{'model':_0xa57c('0x8'),'as':_0xa57c('0x11'),'attributes':['id',_0xa57c('0xa'),_0xa57c('0xb'),'idField',_0xa57c('0x12'),'customField',_0xa57c('0xc')],'include':[{'model':_0xa57c('0xd'),'as':_0xa57c('0xd'),'attributes':['id',_0xa57c('0x2')]}]}]}]},'log':_0xa57c('0x1')});};}; \ No newline at end of file +var _0x5f66=['nameField','customField','getSugarcrmAccounts','Request','GetSugarcrmAccount','name','username','password','serverUrl','Configurations','type','content','variableName','Variable','key','keyType','Fields','idField'];(function(_0x56641e,_0x44a51f){var _0x300c87=function(_0x220481){while(--_0x220481){_0x56641e['push'](_0x56641e['shift']());}};_0x300c87(++_0x44a51f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x5f66[_0x17d9e3];return _0x14192d;};'use strict';var client=require('../../client');exports[_0x65f6('0x0')]=function(){return function(_0x4a3887){return client[_0x65f6('0x1')](_0x65f6('0x2'),{'options':{'raw':![],'attributes':['id',_0x65f6('0x3'),_0x65f6('0x4'),_0x65f6('0x5'),'remoteUri',_0x65f6('0x6')],'include':[{'model':'SugarcrmConfiguration','as':_0x65f6('0x7'),'attributes':['id',_0x65f6('0x3')],'include':[{'model':'SugarcrmField','as':'Subjects','attributes':['id',_0x65f6('0x8'),_0x65f6('0x9'),_0x65f6('0xa')],'include':[{'model':_0x65f6('0xb'),'as':_0x65f6('0xb'),'attributes':['id',_0x65f6('0x3')]}]},{'model':'SugarcrmField','as':'Descriptions','attributes':['id',_0x65f6('0x8'),_0x65f6('0x9'),_0x65f6('0xc'),_0x65f6('0xd'),'keyContent',_0x65f6('0xa')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x65f6('0x3')]}]},{'model':'SugarcrmField','as':_0x65f6('0xe'),'attributes':['id','type',_0x65f6('0x9'),_0x65f6('0xf'),_0x65f6('0x10'),_0x65f6('0x11'),_0x65f6('0xa')],'include':[{'model':_0x65f6('0xb'),'as':_0x65f6('0xb'),'attributes':['id',_0x65f6('0x3')]}]}]}]},'log':_0x65f6('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/vtiger.js b/server/services/ami/rpc/integrations/vtiger.js index 2b8695c..c4087d6 100644 --- a/server/services/ami/rpc/integrations/vtiger.js +++ b/server/services/ami/rpc/integrations/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdc01=['Configurations','VtigerField','Subjects','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','type','idField','nameField','customField','../../client','getVtigerAccounts','Request','GetVtigerAccount','name','description','username','remoteUri'];(function(_0x310877,_0xb9ac7c){var _0x1c2252=function(_0x56cb7e){while(--_0x56cb7e){_0x310877['push'](_0x310877['shift']());}};_0x1c2252(++_0xb9ac7c);}(_0xdc01,0x196));var _0x1dc0=function(_0x279f32,_0x473f86){_0x279f32=_0x279f32-0x0;var _0x483bb2=_0xdc01[_0x279f32];return _0x483bb2;};'use strict';var client=require(_0x1dc0('0x0'));exports[_0x1dc0('0x1')]=function(){return function(_0x181edd){return client[_0x1dc0('0x2')](_0x1dc0('0x3'),{'options':{'raw':![],'attributes':['id',_0x1dc0('0x4'),_0x1dc0('0x5'),_0x1dc0('0x6'),'accessKey',_0x1dc0('0x7'),'serverUrl'],'include':[{'model':'VtigerConfiguration','as':_0x1dc0('0x8'),'attributes':['id',_0x1dc0('0x4')],'include':[{'model':_0x1dc0('0x9'),'as':_0x1dc0('0xa'),'attributes':['id','type',_0x1dc0('0xb'),_0x1dc0('0xc')],'include':[{'model':_0x1dc0('0xd'),'as':_0x1dc0('0xd'),'attributes':['id',_0x1dc0('0x4')]}]},{'model':_0x1dc0('0x9'),'as':_0x1dc0('0xe'),'attributes':['id','type','content',_0x1dc0('0xf'),_0x1dc0('0x10'),_0x1dc0('0x11'),_0x1dc0('0xc')],'include':[{'model':'Variable','as':_0x1dc0('0xd'),'attributes':['id',_0x1dc0('0x4')]}]},{'model':_0x1dc0('0x9'),'as':_0x1dc0('0x12'),'attributes':['id',_0x1dc0('0x13'),'content',_0x1dc0('0x14'),_0x1dc0('0x15'),_0x1dc0('0x16'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x1dc0('0x4')]}]}]}]},'log':_0x1dc0('0x3')});};}; \ No newline at end of file +var _0x4af1=['type','key','keyType','keyContent','variableName','Fields','idField','nameField','../../client','Request','GetVtigerAccount','name','description','username','accessKey','remoteUri','VtigerConfiguration','Configurations','VtigerField','Subjects','content','Variable','Descriptions'];(function(_0x45aecd,_0x1ead65){var _0x4737ae=function(_0x1fbba7){while(--_0x1fbba7){_0x45aecd['push'](_0x45aecd['shift']());}};_0x4737ae(++_0x1ead65);}(_0x4af1,0x92));var _0x14af=function(_0x177d11,_0x2611df){_0x177d11=_0x177d11-0x0;var _0x36e006=_0x4af1[_0x177d11];return _0x36e006;};'use strict';var client=require(_0x14af('0x0'));exports['getVtigerAccounts']=function(){return function(_0x5a515a){return client[_0x14af('0x1')](_0x14af('0x2'),{'options':{'raw':![],'attributes':['id',_0x14af('0x3'),_0x14af('0x4'),_0x14af('0x5'),_0x14af('0x6'),_0x14af('0x7'),'serverUrl'],'include':[{'model':_0x14af('0x8'),'as':_0x14af('0x9'),'attributes':['id','name'],'include':[{'model':_0x14af('0xa'),'as':_0x14af('0xb'),'attributes':['id','type',_0x14af('0xc'),'variableName'],'include':[{'model':'Variable','as':_0x14af('0xd'),'attributes':['id',_0x14af('0x3')]}]},{'model':_0x14af('0xa'),'as':_0x14af('0xe'),'attributes':['id',_0x14af('0xf'),'content',_0x14af('0x10'),_0x14af('0x11'),_0x14af('0x12'),_0x14af('0x13')],'include':[{'model':'Variable','as':'Variable','attributes':['id',_0x14af('0x3')]}]},{'model':_0x14af('0xa'),'as':_0x14af('0x14'),'attributes':['id',_0x14af('0xf'),_0x14af('0xc'),_0x14af('0x15'),_0x14af('0x16'),'customField',_0x14af('0x13')],'include':[{'model':_0x14af('0xd'),'as':_0x14af('0xd'),'attributes':['id',_0x14af('0x3')]}]}]}]},'log':'GetVtigerAccount'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zendesk.js b/server/services/ami/rpc/integrations/zendesk.js index 8266a74..3152c68 100644 --- a/server/services/ami/rpc/integrations/zendesk.js +++ b/server/services/ami/rpc/integrations/zendesk.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x842f=['Subjects','content','Variable','key','keyContent','Fields','nameField','customField','variableName','../../client','getZendeskAccounts','Request','name','username','token','remoteUri','authType','serverUrl','type','ZendeskConfiguration','Configurations','Tag','ZendeskField'];(function(_0x23e366,_0xdb00e7){var _0x4c6977=function(_0x48d60b){while(--_0x48d60b){_0x23e366['push'](_0x23e366['shift']());}};_0x4c6977(++_0xdb00e7);}(_0x842f,0x190));var _0xf842=function(_0x5c5e95,_0x740a18){_0x5c5e95=_0x5c5e95-0x0;var _0x55c9aa=_0x842f[_0x5c5e95];return _0x55c9aa;};'use strict';var client=require(_0xf842('0x0'));exports[_0xf842('0x1')]=function(){return function(_0x24effa){return client[_0xf842('0x2')]('GetZendeskAccount',{'options':{'raw':![],'attributes':['id',_0xf842('0x3'),_0xf842('0x4'),'password',_0xf842('0x5'),_0xf842('0x6'),_0xf842('0x7'),_0xf842('0x8'),_0xf842('0x9')],'include':[{'model':_0xf842('0xa'),'as':_0xf842('0xb'),'attributes':['id',_0xf842('0x3')],'include':[{'model':_0xf842('0xc'),'attributes':['id',_0xf842('0x3')]},{'model':_0xf842('0xd'),'as':_0xf842('0xe'),'attributes':['id',_0xf842('0x9'),_0xf842('0xf'),'variableName'],'include':[{'model':_0xf842('0x10'),'as':'Variable','attributes':['id',_0xf842('0x3')]}]},{'model':_0xf842('0xd'),'as':'Descriptions','attributes':['id',_0xf842('0x9'),_0xf842('0xf'),_0xf842('0x11'),'keyType',_0xf842('0x12'),'variableName'],'include':[{'model':'Variable','as':'Variable','attributes':['id','name']}]},{'model':_0xf842('0xd'),'as':_0xf842('0x13'),'attributes':['id',_0xf842('0x9'),'content','idField',_0xf842('0x14'),_0xf842('0x15'),_0xf842('0x16')],'include':[{'model':_0xf842('0x10'),'as':_0xf842('0x10'),'attributes':['id',_0xf842('0x3')]}]}]}]},'log':'GetZendeskAccount'});};}; \ No newline at end of file +var _0xefe6=['keyContent','idField','nameField','customField','../../client','getZendeskAccounts','Request','GetZendeskAccount','name','username','password','token','authType','serverUrl','ZendeskConfiguration','Tag','ZendeskField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType'];(function(_0xd1fa42,_0x3cb936){var _0x24c89a=function(_0x55a929){while(--_0x55a929){_0xd1fa42['push'](_0xd1fa42['shift']());}};_0x24c89a(++_0x3cb936);}(_0xefe6,0x9a));var _0x6efe=function(_0x475dce,_0x1754ff){_0x475dce=_0x475dce-0x0;var _0x40687a=_0xefe6[_0x475dce];return _0x40687a;};'use strict';var client=require(_0x6efe('0x0'));exports[_0x6efe('0x1')]=function(){return function(_0x485be8){return client[_0x6efe('0x2')](_0x6efe('0x3'),{'options':{'raw':![],'attributes':['id',_0x6efe('0x4'),_0x6efe('0x5'),_0x6efe('0x6'),_0x6efe('0x7'),'remoteUri',_0x6efe('0x8'),_0x6efe('0x9'),'type'],'include':[{'model':_0x6efe('0xa'),'as':'Configurations','attributes':['id',_0x6efe('0x4')],'include':[{'model':_0x6efe('0xb'),'attributes':['id','name']},{'model':_0x6efe('0xc'),'as':_0x6efe('0xd'),'attributes':['id',_0x6efe('0xe'),_0x6efe('0xf'),_0x6efe('0x10')],'include':[{'model':_0x6efe('0x11'),'as':_0x6efe('0x11'),'attributes':['id',_0x6efe('0x4')]}]},{'model':_0x6efe('0xc'),'as':_0x6efe('0x12'),'attributes':['id',_0x6efe('0xe'),_0x6efe('0xf'),_0x6efe('0x13'),_0x6efe('0x14'),_0x6efe('0x15'),_0x6efe('0x10')],'include':[{'model':_0x6efe('0x11'),'as':_0x6efe('0x11'),'attributes':['id','name']}]},{'model':_0x6efe('0xc'),'as':'Fields','attributes':['id',_0x6efe('0xe'),'content',_0x6efe('0x16'),_0x6efe('0x17'),_0x6efe('0x18'),'variableName'],'include':[{'model':'Variable','as':_0x6efe('0x11'),'attributes':['id',_0x6efe('0x4')]}]}]}]},'log':_0x6efe('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/integrations/zoho.js b/server/services/ami/rpc/integrations/zoho.js index d9f7d92..d3f1ca9 100644 --- a/server/services/ami/rpc/integrations/zoho.js +++ b/server/services/ami/rpc/integrations/zoho.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6b44=['getZohoAccounts','Request','GetZohoAccount','name','description','host','zone','clientId','clientSecret','code','ZohoConfiguration','Configurations','moduleCreate','moduleSearch','ZohoField','Subjects','type','content','variableName','Variable','Descriptions','key','keyType','keyContent','Fields','idField','nameField','customField'];(function(_0xa00ee3,_0x45fa48){var _0x5ee090=function(_0xbdd52c){while(--_0xbdd52c){_0xa00ee3['push'](_0xa00ee3['shift']());}};_0x5ee090(++_0x45fa48);}(_0x6b44,0x134));var _0x46b4=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x6b44[_0x22f8ab];return _0x2a70e5;};'use strict';var client=require('../../client');exports[_0x46b4('0x0')]=function(){return function(_0x3e2f84){return client[_0x46b4('0x1')](_0x46b4('0x2'),{'options':{'raw':![],'attributes':['id',_0x46b4('0x3'),_0x46b4('0x4'),_0x46b4('0x5'),_0x46b4('0x6'),_0x46b4('0x7'),_0x46b4('0x8'),'serverUrl',_0x46b4('0x9'),'refreshToken'],'include':[{'model':_0x46b4('0xa'),'as':_0x46b4('0xb'),'attributes':['id',_0x46b4('0x3'),_0x46b4('0xc'),_0x46b4('0xd'),'description'],'include':[{'model':_0x46b4('0xe'),'as':_0x46b4('0xf'),'attributes':['id',_0x46b4('0x10'),_0x46b4('0x11'),_0x46b4('0x12')],'include':[{'model':_0x46b4('0x13'),'as':_0x46b4('0x13'),'attributes':['id',_0x46b4('0x3')]}]},{'model':'ZohoField','as':_0x46b4('0x14'),'attributes':['id',_0x46b4('0x10'),_0x46b4('0x11'),_0x46b4('0x15'),_0x46b4('0x16'),_0x46b4('0x17'),_0x46b4('0x12')],'include':[{'model':_0x46b4('0x13'),'as':_0x46b4('0x13'),'attributes':['id',_0x46b4('0x3')]}]},{'model':_0x46b4('0xe'),'as':_0x46b4('0x18'),'attributes':['id',_0x46b4('0x10'),_0x46b4('0x11'),_0x46b4('0x19'),_0x46b4('0x1a'),_0x46b4('0x1b'),_0x46b4('0x12')],'include':[{'model':_0x46b4('0x13'),'as':'Variable','attributes':['id','name']}]}]}]},'log':'GetZohoAccount'});};}; \ No newline at end of file +var _0xc721=['key','keyType','keyContent','variableName','Fields','type','idField','nameField','customField','GetZohoAccount','../../client','Request','name','description','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','moduleCreate','moduleSearch','ZohoField','Subjects','content','Variable'];(function(_0x2f4c1c,_0x5a3dd4){var _0x25e0f2=function(_0x46ea31){while(--_0x46ea31){_0x2f4c1c['push'](_0x2f4c1c['shift']());}};_0x25e0f2(++_0x5a3dd4);}(_0xc721,0x10e));var _0x1c72=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc721[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x1c72('0x0'));exports['getZohoAccounts']=function(){return function(_0x4dd286){return client[_0x1c72('0x1')]('GetZohoAccount',{'options':{'raw':![],'attributes':['id',_0x1c72('0x2'),_0x1c72('0x3'),'host','zone',_0x1c72('0x4'),_0x1c72('0x5'),_0x1c72('0x6'),_0x1c72('0x7'),_0x1c72('0x8')],'include':[{'model':'ZohoConfiguration','as':_0x1c72('0x9'),'attributes':['id','name',_0x1c72('0xa'),_0x1c72('0xb'),_0x1c72('0x3')],'include':[{'model':_0x1c72('0xc'),'as':_0x1c72('0xd'),'attributes':['id','type',_0x1c72('0xe'),'variableName'],'include':[{'model':_0x1c72('0xf'),'as':_0x1c72('0xf'),'attributes':['id',_0x1c72('0x2')]}]},{'model':_0x1c72('0xc'),'as':'Descriptions','attributes':['id','type',_0x1c72('0xe'),_0x1c72('0x10'),_0x1c72('0x11'),_0x1c72('0x12'),_0x1c72('0x13')],'include':[{'model':_0x1c72('0xf'),'as':_0x1c72('0xf'),'attributes':['id','name']}]},{'model':_0x1c72('0xc'),'as':_0x1c72('0x14'),'attributes':['id',_0x1c72('0x15'),_0x1c72('0xe'),_0x1c72('0x16'),_0x1c72('0x17'),_0x1c72('0x18'),'variableName'],'include':[{'model':_0x1c72('0xf'),'as':'Variable','attributes':['id',_0x1c72('0x2')]}]}]}]},'log':_0x1c72('0x19')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/interval.js b/server/services/ami/rpc/interval.js index bf1810f..559e3b4 100644 --- a/server/services/ami/rpc/interval.js +++ b/server/services/ami/rpc/interval.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6a52=['string','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','stack','replace','isArray','length','resolve','number','every'];(function(_0x194882,_0x3b8125){var _0x1b37ad=function(_0x50e644){while(--_0x50e644){_0x194882['push'](_0x194882['shift']());}};_0x1b37ad(++_0x3b8125);}(_0x6a52,0xbb));var _0x26a5=function(_0x2c7b86,_0x59ef3c){_0x2c7b86=_0x2c7b86-0x0;var _0x256735=_0x6a52[_0x2c7b86];return _0x256735;};var logger=require(_0x26a5('0x0'))('dialer');var client=require('../client');function intervalIftime(_0x2f3372,_0xa99176){const _0x375a09=new Error()[_0x26a5('0x1')][_0x26a5('0x2')](/^Error/,'')['trim']();logger['silly']('intervalIftime\x20called\x20with',_0x2f3372,_0xa99176,_0x375a09);const _0x3a3693=Array[_0x26a5('0x3')](_0x2f3372);if(!_0x2f3372||_0x3a3693&&_0x2f3372[_0x26a5('0x4')]===0x0){return Promise[_0x26a5('0x5')](![]);}else{var _0x1338cd=[];var _0x16661f=[];var _0xb0bb28=_0x3a3693?_0x2f3372:[_0x2f3372];var _0x2b8b9c=_0xb0bb28['every'](function(_0x521a00){return typeof _0x521a00===_0x26a5('0x6');});var _0x3115bf=_0xb0bb28[_0x26a5('0x7')](function(_0x6c7511){return typeof _0x6c7511===_0x26a5('0x8');});if(!_0x2b8b9c&&!_0x3115bf){_0x1338cd=_0xb0bb28[_0x26a5('0x9')](function(_0x42b763){return _0x42b763['id'];});if(_0x1338cd[_0x26a5('0x4')]===0x0){_0x16661f=_0xb0bb28[_0x26a5('0x9')](function(_0x3f4197){return _0x3f4197[_0x26a5('0xa')];});}}else{if(_0x2b8b9c){_0x1338cd=_0x1338cd[_0x26a5('0xb')](_0xb0bb28);}if(_0x3115bf){_0x16661f=_0x16661f[_0x26a5('0xb')](_0xb0bb28);}}return client[_0x26a5('0xc')]('IntervalIftime',{'intervalIds':_0x1338cd,'intervals':_0x16661f,'timezone':_0xa99176,'log':_0x26a5('0xd')});}}exports[_0x26a5('0xe')]=intervalIftime; \ No newline at end of file +var _0x307a=['../client','stack','replace','silly','length','resolve','every','number','map','interval','concat','Request','IntervalIftime','intervalIftime','../../../config/logger','dialer'];(function(_0x45c032,_0x21df23){var _0x1faa28=function(_0x419573){while(--_0x419573){_0x45c032['push'](_0x45c032['shift']());}};_0x1faa28(++_0x21df23);}(_0x307a,0x1be));var _0xa307=function(_0x4dfd9c,_0x8e23ef){_0x4dfd9c=_0x4dfd9c-0x0;var _0x10e625=_0x307a[_0x4dfd9c];return _0x10e625;};var logger=require(_0xa307('0x0'))(_0xa307('0x1'));var client=require(_0xa307('0x2'));function intervalIftime(_0x483f60,_0x5db16e){const _0x458443=new Error()[_0xa307('0x3')][_0xa307('0x4')](/^Error/,'')['trim']();logger[_0xa307('0x5')]('intervalIftime\x20called\x20with',_0x483f60,_0x5db16e,_0x458443);const _0x3f0c35=Array['isArray'](_0x483f60);if(!_0x483f60||_0x3f0c35&&_0x483f60[_0xa307('0x6')]===0x0){return Promise[_0xa307('0x7')](![]);}else{var _0x58984e=[];var _0x3dd99d=[];var _0x4bf99b=_0x3f0c35?_0x483f60:[_0x483f60];var _0x51756b=_0x4bf99b[_0xa307('0x8')](function(_0x315883){return typeof _0x315883===_0xa307('0x9');});var _0x2d4e35=_0x4bf99b[_0xa307('0x8')](function(_0x4eef9a){return typeof _0x4eef9a==='string';});if(!_0x51756b&&!_0x2d4e35){_0x58984e=_0x4bf99b[_0xa307('0xa')](function(_0x41e814){return _0x41e814['id'];});if(_0x58984e[_0xa307('0x6')]===0x0){_0x3dd99d=_0x4bf99b['map'](function(_0x1547b0){return _0x1547b0[_0xa307('0xb')];});}}else{if(_0x51756b){_0x58984e=_0x58984e[_0xa307('0xc')](_0x4bf99b);}if(_0x2d4e35){_0x3dd99d=_0x3dd99d[_0xa307('0xc')](_0x4bf99b);}}return client[_0xa307('0xd')](_0xa307('0xe'),{'intervalIds':_0x58984e,'intervals':_0x3dd99d,'timezone':_0x5db16e,'log':_0xa307('0xe')});}}exports[_0xa307('0xf')]=intervalIftime; \ No newline at end of file diff --git a/server/services/ami/rpc/memberReport.js b/server/services/ami/rpc/memberReport.js index f5a704a..9123900 100644 --- a/server/services/ami/rpc/memberReport.js +++ b/server/services/ami/rpc/memberReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84e9=['voice','lastAssignedTo','isNil','interface','format','SIP/%s','TALKING','queuecallerleaveAt','seconds','inbound','calleridnum','exten','queue','agent','accountcode','uniqueid','CreateMemberReport','voiceDialReport','membername','starttime','endtime','outbound','dialstring','toNumber','moment','lodash','util','../client','queuecallercompleteAt','Request'];(function(_0x143ce6,_0x46e089){var _0x33ed64=function(_0x5a6856){while(--_0x5a6856){_0x143ce6['push'](_0x143ce6['shift']());}};_0x33ed64(++_0x46e089);}(_0x84e9,0x144));var _0x984e=function(_0x157662,_0x4ac1d0){_0x157662=_0x157662-0x0;var _0x15f584=_0x84e9[_0x157662];return _0x15f584;};'use strict';var moment=require(_0x984e('0x0'));var _=require(_0x984e('0x1'));var util=require(_0x984e('0x2'));var client=require(_0x984e('0x3'));exports['voiceQueueReport']=function(_0x149672){var _0x260a14=_0x149672[_0x984e('0x4')]||_0x149672['queuecallerexitAt'];return client[_0x984e('0x5')]('CreateMemberReport',{'body':{'channel':_0x984e('0x6'),'membername':_0x149672[_0x984e('0x7')],'interface':_[_0x984e('0x8')](_0x149672[_0x984e('0x9')])?util[_0x984e('0xa')](_0x984e('0xb'),_0x149672[_0x984e('0x7')]):_0x149672[_0x984e('0x9')],'type':_0x984e('0xc'),'enterAt':_0x149672[_0x984e('0xd')],'exitAt':_0x260a14,'duration':moment(_0x260a14)['diff'](_0x149672[_0x984e('0xd')],_0x984e('0xe')),'data1':_0x984e('0xf'),'data2':_0x149672[_0x984e('0x10')],'data3':_0x149672[_0x984e('0x11')],'data4':null,'data5':_0x149672[_0x984e('0x12')],'role':_0x984e('0x13'),'internal':_0x149672[_0x984e('0x14')]?_['toNumber'](_0x149672['accountcode']):undefined,'uniqueid':_0x149672[_0x984e('0x15')]},'log':_0x984e('0x16')});};exports[_0x984e('0x17')]=function(_0x422ca4){return client[_0x984e('0x5')](_0x984e('0x16'),{'body':{'channel':_0x984e('0x6'),'membername':_0x422ca4[_0x984e('0x18')],'interface':_0x422ca4['interface'],'type':'TALKING','enterAt':_0x422ca4[_0x984e('0x19')],'exitAt':_0x422ca4[_0x984e('0x1a')],'duration':moment(_0x422ca4['endtime'])['diff'](_0x422ca4[_0x984e('0x19')],_0x984e('0xe'))>=0x0?moment(_0x422ca4[_0x984e('0x1a')])['diff'](_0x422ca4[_0x984e('0x19')],_0x984e('0xe')):null,'data1':_0x984e('0x1b'),'data2':_0x422ca4['accountcode'],'data3':_0x422ca4[_0x984e('0x11')],'data4':_0x422ca4[_0x984e('0x1c')]||null,'role':_0x984e('0x13'),'internal':_0x422ca4['accountcode']?_[_0x984e('0x1d')](_0x422ca4[_0x984e('0x14')]):undefined,'uniqueid':_0x422ca4['uniqueid']},'log':_0x984e('0x16')});}; \ No newline at end of file +var _0x4d1c=['util','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','isNil','interface','format','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','accountcode','uniqueid','voiceDialReport','membername','starttime','endtime','dialstring','toNumber','lodash'];(function(_0x488f41,_0x4a5ed0){var _0x3e4e72=function(_0x10068d){while(--_0x10068d){_0x488f41['push'](_0x488f41['shift']());}};_0x3e4e72(++_0x4a5ed0);}(_0x4d1c,0x1bf));var _0xc4d1=function(_0x3fa77c,_0x350b89){_0x3fa77c=_0x3fa77c-0x0;var _0x21a21c=_0x4d1c[_0x3fa77c];return _0x21a21c;};'use strict';var moment=require('moment');var _=require(_0xc4d1('0x0'));var util=require(_0xc4d1('0x1'));var client=require('../client');exports[_0xc4d1('0x2')]=function(_0x527b4a){var _0x44ada9=_0x527b4a[_0xc4d1('0x3')]||_0x527b4a[_0xc4d1('0x4')];return client[_0xc4d1('0x5')](_0xc4d1('0x6'),{'body':{'channel':_0xc4d1('0x7'),'membername':_0x527b4a[_0xc4d1('0x8')],'interface':_[_0xc4d1('0x9')](_0x527b4a[_0xc4d1('0xa')])?util[_0xc4d1('0xb')]('SIP/%s',_0x527b4a[_0xc4d1('0x8')]):_0x527b4a[_0xc4d1('0xa')],'type':_0xc4d1('0xc'),'enterAt':_0x527b4a[_0xc4d1('0xd')],'exitAt':_0x44ada9,'duration':moment(_0x44ada9)[_0xc4d1('0xe')](_0x527b4a['queuecallerleaveAt'],_0xc4d1('0xf')),'data1':_0xc4d1('0x10'),'data2':_0x527b4a[_0xc4d1('0x11')],'data3':_0x527b4a[_0xc4d1('0x12')],'data4':null,'data5':_0x527b4a[_0xc4d1('0x13')],'role':'agent','internal':_0x527b4a[_0xc4d1('0x14')]?_['toNumber'](_0x527b4a['accountcode']):undefined,'uniqueid':_0x527b4a[_0xc4d1('0x15')]},'log':_0xc4d1('0x6')});};exports[_0xc4d1('0x16')]=function(_0x5e26e7){return client[_0xc4d1('0x5')](_0xc4d1('0x6'),{'body':{'channel':_0xc4d1('0x7'),'membername':_0x5e26e7[_0xc4d1('0x17')],'interface':_0x5e26e7[_0xc4d1('0xa')],'type':_0xc4d1('0xc'),'enterAt':_0x5e26e7[_0xc4d1('0x18')],'exitAt':_0x5e26e7['endtime'],'duration':moment(_0x5e26e7['endtime'])[_0xc4d1('0xe')](_0x5e26e7[_0xc4d1('0x18')],_0xc4d1('0xf'))>=0x0?moment(_0x5e26e7[_0xc4d1('0x19')])[_0xc4d1('0xe')](_0x5e26e7[_0xc4d1('0x18')],'seconds'):null,'data1':'outbound','data2':_0x5e26e7[_0xc4d1('0x14')],'data3':_0x5e26e7['exten'],'data4':_0x5e26e7[_0xc4d1('0x1a')]||null,'role':'agent','internal':_0x5e26e7[_0xc4d1('0x14')]?_[_0xc4d1('0x1b')](_0x5e26e7['accountcode']):undefined,'uniqueid':_0x5e26e7['uniqueid']},'log':'CreateMemberReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index c9f9132..4010a2c 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 _0x3eae=['previewRecallmeReminderInterval','GetSettings','Request','ShowSetting'];(function(_0x4e1c19,_0x223b5b){var _0x17de84=function(_0x180aa4){while(--_0x180aa4){_0x4e1c19['push'](_0x4e1c19['shift']());}};_0x17de84(++_0x223b5b);}(_0x3eae,0x66));var _0xe3ea=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0x3eae[_0x46d0c9];return _0x174506;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0xe3ea('0x0')](_0xe3ea('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0xe3ea('0x2')]},'log':_0xe3ea('0x3')});}; \ No newline at end of file +var _0xa9f0=['stopRecordingOnTransfer','previewRecallmeReminderInterval','GetSettings','../client','Request','ShowSetting'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xa9f0,0x153));var _0x0a9f=function(_0x523f3c,_0x5abf7d){_0x523f3c=_0x523f3c-0x0;var _0x5a77f9=_0xa9f0[_0x523f3c];return _0x5a77f9;};'use strict';var client=require(_0x0a9f('0x0'));exports['getSettings']=function(){return client[_0x0a9f('0x1')](_0x0a9f('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x0a9f('0x3'),_0x0a9f('0x4')]},'log':_0x0a9f('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 7ab3a9a..e4b7aed 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 _0xca79=['name','html','GetTemplate','../client','Request'];(function(_0x26c562,_0xe4be5c){var _0x462368=function(_0x38db51){while(--_0x38db51){_0x26c562['push'](_0x26c562['shift']());}};_0x462368(++_0xe4be5c);}(_0xca79,0xe4));var _0x9ca7=function(_0x5021de,_0x3f2181){_0x5021de=_0x5021de-0x0;var _0x3b797b=_0xca79[_0x5021de];return _0x3b797b;};'use strict';var client=require(_0x9ca7('0x0'));exports['getTemplates']=function(_0x470ca4){return function(_0x4bb8f9){return client[_0x9ca7('0x1')]('GetTemplate',{'options':{'raw':!![],'attributes':['id',_0x9ca7('0x2'),_0x9ca7('0x3')]},'log':_0x9ca7('0x4')});};}; \ No newline at end of file +var _0xf089=['html','getTemplates','Request','GetTemplate','name'];(function(_0x567a51,_0x11a7b0){var _0x3ee9f4=function(_0x2c91f1){while(--_0x2c91f1){_0x567a51['push'](_0x567a51['shift']());}};_0x3ee9f4(++_0x11a7b0);}(_0xf089,0xba));var _0x9f08=function(_0x17bfbe,_0x320969){_0x17bfbe=_0x17bfbe-0x0;var _0xecc61f=_0xf089[_0x17bfbe];return _0xecc61f;};'use strict';var client=require('../client');exports[_0x9f08('0x0')]=function(_0x3eda88){return function(_0x5927dd){return client[_0x9f08('0x1')](_0x9f08('0x2'),{'options':{'raw':!![],'attributes':['id',_0x9f08('0x3'),_0x9f08('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 7007ff0..7783c7a 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 _0x3873=['operator','value','Action','Actions','action','data1','data2','data4','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','AllConditions','field'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3873,0x89));var _0x3387=function(_0x1f148e,_0x4d2841){_0x1f148e=_0x1f148e-0x0;var _0x40ef6d=_0x3873[_0x1f148e];return _0x40ef6d;};'use strict';var client=require(_0x3387('0x0'));exports[_0x3387('0x1')]=function(_0x35b7c4){return function(_0x32f60e){return client[_0x3387('0x2')](_0x3387('0x3'),{'options':{'raw':![],'attributes':['id',_0x3387('0x4'),_0x3387('0x5'),_0x3387('0x6')],'include':[{'model':_0x3387('0x7'),'as':_0x3387('0x8'),'attributes':['id',_0x3387('0x9'),_0x3387('0xa'),_0x3387('0xb')]},{'model':_0x3387('0x7'),'as':'AnyConditions','attributes':['id',_0x3387('0x9'),_0x3387('0xa'),_0x3387('0xb')]},{'model':_0x3387('0xc'),'as':_0x3387('0xd'),'attributes':['id',_0x3387('0xe'),_0x3387('0xf'),_0x3387('0x10'),'data3',_0x3387('0x11'),_0x3387('0x12'),_0x3387('0x13'),_0x3387('0x14')]}]},'log':_0x3387('0x3')});};}; \ No newline at end of file +var _0xff36=['name','channel','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','data1','data2','data3','data4','data5','data6','data7','../client','Request','GetTrigger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xff36,0x18d));var _0x6ff3=function(_0x50b6d0,_0x2ff9fe){_0x50b6d0=_0x50b6d0-0x0;var _0x1e99d1=_0xff36[_0x50b6d0];return _0x1e99d1;};'use strict';var client=require(_0x6ff3('0x0'));exports['getTriggers']=function(_0x106249){return function(_0x328bbc){return client[_0x6ff3('0x1')](_0x6ff3('0x2'),{'options':{'raw':![],'attributes':['id',_0x6ff3('0x3'),_0x6ff3('0x4'),_0x6ff3('0x5')],'include':[{'model':_0x6ff3('0x6'),'as':_0x6ff3('0x7'),'attributes':['id',_0x6ff3('0x8'),_0x6ff3('0x9'),_0x6ff3('0xa')]},{'model':'Condition','as':_0x6ff3('0xb'),'attributes':['id',_0x6ff3('0x8'),'operator',_0x6ff3('0xa')]},{'model':_0x6ff3('0xc'),'as':'Actions','attributes':['id','action',_0x6ff3('0xd'),_0x6ff3('0xe'),_0x6ff3('0xf'),_0x6ff3('0x10'),_0x6ff3('0x11'),_0x6ff3('0x12'),_0x6ff3('0x13')]}]},'log':_0x6ff3('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index c4b9d4f..b99b939 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 _0x59c3=['defaultuser','../client','getTrunks','Request','GetTrunk','registry'];(function(_0x12c3d1,_0x3c6ae7){var _0x282840=function(_0x4ae0d2){while(--_0x4ae0d2){_0x12c3d1['push'](_0x12c3d1['shift']());}};_0x282840(++_0x3c6ae7);}(_0x59c3,0x133));var _0x359c=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x59c3[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x359c('0x0'));exports[_0x359c('0x1')]=function(_0x3f470b){return function(_0x26f8f6){return client[_0x359c('0x2')](_0x359c('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x359c('0x4'),_0x359c('0x5')]},'log':_0x359c('0x3')});};}; \ No newline at end of file +var _0x684d=['getTrunks','GetTrunk','registry','defaultuser'];(function(_0x1d7bd8,_0x196799){var _0x2d509c=function(_0x5ef269){while(--_0x5ef269){_0x1d7bd8['push'](_0x1d7bd8['shift']());}};_0x2d509c(++_0x196799);}(_0x684d,0x174));var _0xd684=function(_0x21edfd,_0x346fbe){_0x21edfd=_0x21edfd-0x0;var _0x48a35e=_0x684d[_0x21edfd];return _0x48a35e;};'use strict';var client=require('../client');exports[_0xd684('0x0')]=function(_0x33830c){return function(_0x7a47a2){return client['Request'](_0xd684('0x1'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0xd684('0x2'),_0xd684('0x3')]},'log':_0xd684('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index d5bb328..9cbbf8e 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 _0xcb91=['UnpauseUser','getAgent','ShowUser','email','lastPauseAt','Request','GetUser','agent','name','accountcode','fullname','lastLoginAt','pauseType','voicePause','phone','interface','getAgents','internal','getTelephones','savePause','PauseUser'];(function(_0x3de2e7,_0x1f9e26){var _0xc03ce1=function(_0x13780b){while(--_0x13780b){_0x3de2e7['push'](_0x3de2e7['shift']());}};_0xc03ce1(++_0x1f9e26);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1ee0a1,_0x51058e){_0x1ee0a1=_0x1ee0a1-0x0;var _0x1d2d5b=_0xcb91[_0x1ee0a1];return _0x1d2d5b;};'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 +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(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'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 diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 345c1ac..ed7b00f 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 _0x73d9=['create','Request','update','UpdateVoiceAgentReport','../client'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0x73d9,0x176));var _0x973d=function(_0x2a8d86,_0x4654e6){_0x2a8d86=_0x2a8d86-0x0;var _0x817ab3=_0x73d9[_0x2a8d86];return _0x817ab3;};'use strict';var client=require(_0x973d('0x0'));exports[_0x973d('0x1')]=function(_0x549d5d){return client[_0x973d('0x2')]('CreateVoiceAgentReport',{'body':_0x549d5d,'log':'CreateVoiceAgentReport'});};exports[_0x973d('0x3')]=function(_0x35c80c,_0x319723,_0xf2922){return client[_0x973d('0x2')](_0x973d('0x4'),{'body':_0x35c80c,'options':{'where':{'uniqueid':_0x319723,'interface':_0xf2922,'agentcomplete':!![]}},'log':_0x973d('0x4')});}; \ No newline at end of file +var _0xa75e=['update','UpdateVoiceAgentReport','Request','CreateVoiceAgentReport'];(function(_0x35ba71,_0xa2fbbd){var _0x5f04f4=function(_0x30a04f){while(--_0x30a04f){_0x35ba71['push'](_0x35ba71['shift']());}};_0x5f04f4(++_0xa2fbbd);}(_0xa75e,0x96));var _0xea75=function(_0x57ad90,_0x5ed9c0){_0x57ad90=_0x57ad90-0x0;var _0x3221ba=_0xa75e[_0x57ad90];return _0x3221ba;};'use strict';var client=require('../client');exports['create']=function(_0x71a1f1){return client[_0xea75('0x0')](_0xea75('0x1'),{'body':_0x71a1f1,'log':_0xea75('0x1')});};exports[_0xea75('0x2')]=function(_0xb0c6ca,_0x5c86c2,_0xc17b7d){return client[_0xea75('0x0')](_0xea75('0x3'),{'body':_0xb0c6ca,'options':{'where':{'uniqueid':_0x5c86c2,'interface':_0xc17b7d,'agentcomplete':!![]}},'log':_0xea75('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 59a95c3..9f48c7b 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 _0x771d=['create','Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','lodash','../client'];(function(_0x2fed16,_0x5e9eac){var _0x4419bd=function(_0x45cc74){while(--_0x45cc74){_0x2fed16['push'](_0x2fed16['shift']());}};_0x4419bd(++_0x5e9eac);}(_0x771d,0x1e1));var _0xd771=function(_0x3472c4,_0x6f57fa){_0x3472c4=_0x3472c4-0x0;var _0x39b61a=_0x771d[_0x3472c4];return _0x39b61a;};'use strict';var moment=require('moment');var util=require('util');var _=require(_0xd771('0x0'));var client=require(_0xd771('0x1'));exports[_0xd771('0x2')]=function(_0x307696){return client[_0xd771('0x3')](_0xd771('0x4'),{'body':_['merge'](_0x307696,{'source':_0x307696[_0xd771('0x5')],'destinationcontext':_0x307696[_0xd771('0x6')],'callerid':_0x307696[_0xd771('0x7')],'amaflags':_0xd771('0x8')}),'log':_0xd771('0x4')});};exports[_0xd771('0x9')]=function(){return function(){return client['Request'](_0xd771('0xa'),{'options':{'where':{'type':[_0xd771('0xb')],'createdAt':{'$between':[moment()['startOf'](_0xd771('0xc'))[_0xd771('0xd')](_0xd771('0xe')),moment()[_0xd771('0xf')](_0xd771('0xc'))[_0xd771('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0xd771('0x10'),_0xd771('0x11'),_0xd771('0x12'),_0xd771('0x13')]},'log':_0xd771('0x14')});};}; \ No newline at end of file +var _0x241c=['calleridnum','context','callerid','GetVoiceCallReport','outbound','format','YYYY-MM-DD\x20HH:mm:ss','endOf','day','type','disposition','duration','billableseconds','GetVoiceCallReports','moment','util','lodash','../client','create','Request','CreateVoiceCallReport'];(function(_0x2b5ee5,_0x3741bf){var _0x1c480b=function(_0x437a18){while(--_0x437a18){_0x2b5ee5['push'](_0x2b5ee5['shift']());}};_0x1c480b(++_0x3741bf);}(_0x241c,0x1c7));var _0xc241=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x241c[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0xc241('0x0'));var util=require(_0xc241('0x1'));var _=require(_0xc241('0x2'));var client=require(_0xc241('0x3'));exports[_0xc241('0x4')]=function(_0x16c849){return client[_0xc241('0x5')](_0xc241('0x6'),{'body':_['merge'](_0x16c849,{'source':_0x16c849[_0xc241('0x7')],'destinationcontext':_0x16c849[_0xc241('0x8')],'callerid':_0x16c849[_0xc241('0x9')],'amaflags':'DOCUMENTATION'}),'log':_0xc241('0x6')});};exports['getVoiceCallReports']=function(){return function(){return client['Request'](_0xc241('0xa'),{'options':{'where':{'type':[_0xc241('0xb')],'createdAt':{'$between':[moment()['startOf']('day')[_0xc241('0xc')](_0xc241('0xd')),moment()[_0xc241('0xe')](_0xc241('0xf'))['format'](_0xc241('0xd'))]}},'attributes':[_0xc241('0x10'),_0xc241('0x11'),_0xc241('0x12'),_0xc241('0x13')]},'log':_0xc241('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 8632a33..831ecf0 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 _0x2787=['CreateVoiceDialReport','../client','create','Request'];(function(_0x574c71,_0x5964c3){var _0xb7550=function(_0x1d0463){while(--_0x1d0463){_0x574c71['push'](_0x574c71['shift']());}};_0xb7550(++_0x5964c3);}(_0x2787,0xe9));var _0x7278=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x2787[_0x2b4411];return _0x8e41ef;};'use strict';var client=require(_0x7278('0x0'));exports[_0x7278('0x1')]=function(_0x2bc9cb){return client[_0x7278('0x2')]('CreateVoiceDialReport',{'body':_0x2bc9cb,'log':_0x7278('0x3')});}; \ No newline at end of file +var _0x7a7b=['create','Request','CreateVoiceDialReport','../client'];(function(_0x5180c3,_0x4b35f7){var _0x55c975=function(_0x4746cb){while(--_0x4746cb){_0x5180c3['push'](_0x5180c3['shift']());}};_0x55c975(++_0x4b35f7);}(_0x7a7b,0x1d7));var _0xb7a7=function(_0xee6752,_0x667b44){_0xee6752=_0xee6752-0x0;var _0xb4dcea=_0x7a7b[_0xee6752];return _0xb4dcea;};'use strict';var client=require(_0xb7a7('0x0'));exports[_0xb7a7('0x1')]=function(_0x27fa2b){return client[_0xb7a7('0x2')](_0xb7a7('0x3'),{'body':_0x27fa2b,'log':_0xb7a7('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 5e697a3..006d33f 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 _0x4876=['Request','recordingFormat'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getVoiceExtensions']=function(){return function(){return client[_0x6487('0x0')]('GetVoiceExtension',{'options':{'raw':!![],'attributes':['id','exten',_0x6487('0x1')],'where':{'VoiceExtensionId':null}},'log':'getVoiceExtensions'});};}; \ No newline at end of file +var _0x9990=['recordingFormat','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x1bff41,_0x386880){var _0x4db66b=function(_0x5aa7b6){while(--_0x5aa7b6){_0x1bff41['push'](_0x1bff41['shift']());}};_0x4db66b(++_0x386880);}(_0x9990,0xf6));var _0x0999=function(_0x3cb6dc,_0x120dd3){_0x3cb6dc=_0x3cb6dc-0x0;var _0x47ec89=_0x9990[_0x3cb6dc];return _0x47ec89;};'use strict';var client=require('../client');exports[_0x0999('0x0')]=function(){return function(){return client[_0x0999('0x1')](_0x0999('0x2'),{'options':{'raw':!![],'attributes':['id',_0x0999('0x3'),_0x0999('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x0999('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 4fea971..8567cad 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 _0x6f07=['TrunkBackup','Interval','Intervals','interval','getVoiceQueues','GetVoiceQueue','name','acw','autopause','monitor_format','type','dialActive','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialPredictiveIntervalMaxThreshold','dialPreviewAutoRecallMe','Trunk','callerid','active','Pause','mandatoryDispositionPause'];(function(_0x2f57b2,_0xa8e91a){var _0x5ace77=function(_0x59c00a){while(--_0x59c00a){_0x2f57b2['push'](_0x2f57b2['shift']());}};_0x5ace77(++_0xa8e91a);}(_0x6f07,0x126));var _0x76f0=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6f07[_0x321bb2];return _0x9c12ed;};'use strict';var client=require('../client');exports[_0x76f0('0x0')]=function(){return function(){return client['Request'](_0x76f0('0x1'),{'options':{'raw':![],'attributes':['id',_0x76f0('0x2'),_0x76f0('0x3'),'acwTimeout',_0x76f0('0x4'),_0x76f0('0x5'),_0x76f0('0x6'),_0x76f0('0x7'),'dialMethod',_0x76f0('0x8'),'dialLimitQueue',_0x76f0('0x9'),_0x76f0('0xa'),_0x76f0('0xb'),'dialPredictiveInterval','dialOriginateCallerIdName',_0x76f0('0xc'),_0x76f0('0xd'),_0x76f0('0xe'),_0x76f0('0xf'),'dialQueueProject',_0x76f0('0x10'),'dialCongestionRetryFrequency',_0x76f0('0x11'),_0x76f0('0x12'),_0x76f0('0x13'),_0x76f0('0x14'),_0x76f0('0x15'),_0x76f0('0x16'),'dialGlobalInterval','dialPrefix',_0x76f0('0x17'),_0x76f0('0x18'),_0x76f0('0x19'),'dialAMDGreeting',_0x76f0('0x1a'),_0x76f0('0x1b'),_0x76f0('0x1c'),_0x76f0('0x1d'),'dialAMDMaximumNumberOfWords',_0x76f0('0x1e'),_0x76f0('0x1f'),'timeout',_0x76f0('0x20'),'dialRecallInQueue',_0x76f0('0x21'),_0x76f0('0x22'),_0x76f0('0x23'),_0x76f0('0x24'),_0x76f0('0x5'),'strategy',_0x76f0('0x25'),_0x76f0('0x26'),_0x76f0('0x27'),_0x76f0('0x28'),_0x76f0('0x29'),'dialDropRetryFrequency',_0x76f0('0x2a'),'dialAbandonedRetryFrequency',_0x76f0('0x2b'),_0x76f0('0x2c'),_0x76f0('0x2d'),_0x76f0('0x2e'),'mandatoryDisposition',_0x76f0('0x2f'),'dialPredictiveIntervalMinThreshold',_0x76f0('0x30'),'dialPreviewRecallmeReminder'],'include':[{'model':_0x76f0('0x31'),'as':_0x76f0('0x31'),'attributes':['id','name',_0x76f0('0x32'),_0x76f0('0x33')]},{'model':_0x76f0('0x34'),'as':_0x76f0('0x35'),'attributes':['id',_0x76f0('0x2')]},{'model':'Trunk','as':_0x76f0('0x36'),'attributes':['id',_0x76f0('0x2'),_0x76f0('0x32'),_0x76f0('0x33')]},{'model':_0x76f0('0x37'),'as':_0x76f0('0x37'),'attributes':['id','name'],'include':[{'model':_0x76f0('0x37'),'as':_0x76f0('0x38'),'attributes':['id',_0x76f0('0x2'),_0x76f0('0x39')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x53f9=['dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialCheckDuplicateType','dialAMDActive','dialAMDGreeting','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDSilenceThreshold','dialAMDMaximumWordLength','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewRecallmeReminder','Trunk','name','callerid','Pause','mandatoryDispositionPause','active','Interval','Intervals','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','dialActive','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency'];(function(_0x5134ad,_0x3f1e69){var _0x4a86bc=function(_0x309169){while(--_0x309169){_0x5134ad['push'](_0x5134ad['shift']());}};_0x4a86bc(++_0x3f1e69);}(_0x53f9,0xb0));var _0x953f=function(_0x16a223,_0x31b6e8){_0x16a223=_0x16a223-0x0;var _0x5ded66=_0x53f9[_0x16a223];return _0x5ded66;};'use strict';var client=require(_0x953f('0x0'));exports[_0x953f('0x1')]=function(){return function(){return client[_0x953f('0x2')](_0x953f('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x953f('0x4'),_0x953f('0x5'),_0x953f('0x6'),_0x953f('0x7'),'type',_0x953f('0x8'),'dialMethod',_0x953f('0x9'),_0x953f('0xa'),'dialPowerLevel',_0x953f('0xb'),_0x953f('0xc'),_0x953f('0xd'),_0x953f('0xe'),_0x953f('0xf'),_0x953f('0x10'),_0x953f('0x11'),_0x953f('0x12'),_0x953f('0x13'),_0x953f('0x14'),_0x953f('0x15'),_0x953f('0x16'),'dialBusyRetryFrequency',_0x953f('0x17'),_0x953f('0x18'),_0x953f('0x19'),_0x953f('0x1a'),_0x953f('0x1b'),_0x953f('0x1c'),_0x953f('0x1d'),_0x953f('0x1e'),'dialAMDInitialSilence',_0x953f('0x1f'),'dialAMDAfterGreetingSilence',_0x953f('0x20'),_0x953f('0x21'),_0x953f('0x22'),'dialAMDMaximumNumberOfWords',_0x953f('0x23'),_0x953f('0x24'),_0x953f('0x25'),_0x953f('0x26'),'dialRecallInQueue',_0x953f('0x27'),_0x953f('0x28'),'dialAgiAfterHangupClient',_0x953f('0x29'),_0x953f('0x7'),_0x953f('0x2a'),_0x953f('0x2b'),_0x953f('0x2c'),'dialNoSuchNumberMaxRetry',_0x953f('0x2d'),_0x953f('0x2e'),_0x953f('0x2f'),_0x953f('0x30'),_0x953f('0x31'),_0x953f('0x32'),_0x953f('0x33'),_0x953f('0x34'),_0x953f('0x35'),_0x953f('0x36'),_0x953f('0x37'),_0x953f('0x38'),'dialPreviewAutoRecallMe',_0x953f('0x39')],'include':[{'model':_0x953f('0x3a'),'as':_0x953f('0x3a'),'attributes':['id',_0x953f('0x3b'),_0x953f('0x3c'),'active']},{'model':_0x953f('0x3d'),'as':_0x953f('0x3e'),'attributes':['id','name']},{'model':_0x953f('0x3a'),'as':'TrunkBackup','attributes':['id',_0x953f('0x3b'),_0x953f('0x3c'),_0x953f('0x3f')]},{'model':_0x953f('0x40'),'as':'Interval','attributes':['id',_0x953f('0x3b')],'include':[{'model':_0x953f('0x40'),'as':_0x953f('0x41'),'attributes':['id',_0x953f('0x3b'),'interval']}]}]},'log':_0x953f('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 5fe52c8..bd190b2 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(_0x53e2c2,_0x4ad5c5){var _0x934f83=function(_0x41112e){while(--_0x41112e){_0x53e2c2['push'](_0x53e2c2['shift']());}};_0x934f83(++_0x4ad5c5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3ce3c,_0x319337){_0x3ce3c=_0x3ce3c-0x0;var _0x55a2c9=_0xa9e0[_0x3ce3c];return _0x55a2c9;};'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(_0x436452,_0x10bf26){var _0x50eddc=function(_0x2653c0){while(--_0x2653c0){_0x436452['push'](_0x436452['shift']());}};_0x50eddc(++_0x10bf26);}(_0xa9e0,0x123));var _0x0a9e=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xa9e0[_0x376b45];return _0x2341b3;};'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 9e36d9b..2e241ce 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 _0xd55d=['Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x344d20,_0x68ab4b){var _0x1e8353=function(_0x5e8835){while(--_0x5e8835){_0x344d20['push'](_0x344d20['shift']());}};_0x1e8353(++_0x68ab4b);}(_0xd55d,0xce));var _0xdd55=function(_0x51dbfa,_0x1d89cc){_0x51dbfa=_0x51dbfa-0x0;var _0x1b94ab=_0xd55d[_0x51dbfa];return _0x1b94ab;};'use strict';var client=require('../client');exports[_0xdd55('0x0')]=function(_0x5e407a){return function(){return client[_0xdd55('0x1')](_0xdd55('0x2'),{'options':{'where':{'VoiceQueueId':_0x5e407a,'paused':!![]},'raw':!![]},'log':_0xdd55('0x0')});};}; \ No newline at end of file +var _0x1557=['../client','Request','GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x4403d9,_0x2a155d){var _0x5ee06b=function(_0x36b9da){while(--_0x36b9da){_0x4403d9['push'](_0x4403d9['shift']());}};_0x5ee06b(++_0x2a155d);}(_0x1557,0x1d0));var _0x7155=function(_0x1fcc54,_0x408a98){_0x1fcc54=_0x1fcc54-0x0;var _0x3e9206=_0x1557[_0x1fcc54];return _0x3e9206;};'use strict';var client=require(_0x7155('0x0'));exports['getVoiceQueueRtPauses']=function(_0x20ebe5){return function(){return client[_0x7155('0x1')](_0x7155('0x2'),{'options':{'where':{'VoiceQueueId':_0x20ebe5,'paused':!![]},'raw':!![]},'log':_0x7155('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 4ec2106..a6a9557 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 _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x12c299,_0x3c4028){var _0x1963c8=function(_0x5894d7){while(--_0x5894d7){_0x12c299['push'](_0x12c299['shift']());}};_0x1963c8(++_0x3c4028);}(_0x7a54,0x106));var _0x47a5=function(_0x51c0fe,_0x4c0f58){_0x51c0fe=_0x51c0fe-0x0;var _0x2ce3c9=_0x7a54[_0x51c0fe];return _0x2ce3c9;};'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 +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x34b547,_0x14ee3b){var _0x530f9f=function(_0x556044){while(--_0x556044){_0x34b547['push'](_0x34b547['shift']());}};_0x530f9f(++_0x14ee3b);}(_0x7a54,0x106));var _0x47a5=function(_0xc1b7d7,_0x170a51){_0xc1b7d7=_0xc1b7d7-0x0;var _0x3b26bd=_0x7a54[_0xc1b7d7];return _0x3b26bd;};'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 9cd8328..bbd9e43 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 _0x65cb=['secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','CreateVoiceTransferReport','attendedTransfer','Request','origtransferercalleridnum','origtransferercalleridname'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x65cb,0x1a8));var _0xb65c=function(_0x4e5bfc,_0x11bb75){_0x4e5bfc=_0x4e5bfc-0x0;var _0xc19602=_0x65cb[_0x4e5bfc];return _0xc19602;};'use strict';var client=require(_0xb65c('0x0'));exports['transfers']={};exports[_0xb65c('0x1')]=function(_0x18dd6e){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x18dd6e[_0xb65c('0x2')],'transfererchannel':_0x18dd6e[_0xb65c('0x3')],'transferercalleridnum':_0x18dd6e[_0xb65c('0x4')],'transferercalleridname':_0x18dd6e[_0xb65c('0x5')],'transfererconnectedlinenum':_0x18dd6e[_0xb65c('0x6')],'transfererconnectedlinename':_0x18dd6e[_0xb65c('0x7')],'transfereraccountcode':_0x18dd6e[_0xb65c('0x8')],'transferercontext':_0x18dd6e[_0xb65c('0x9')],'transfererexten':_0x18dd6e[_0xb65c('0xa')],'transfererlinkedid':_0x18dd6e[_0xb65c('0xb')],'transfereechannel':_0x18dd6e[_0xb65c('0xc')],'transfereecalleridnum':_0x18dd6e[_0xb65c('0xd')],'transfereecalleridname':_0x18dd6e[_0xb65c('0xe')],'transfereeconnectedlinenum':_0x18dd6e['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x18dd6e[_0xb65c('0xf')],'transfereeaccountcode':_0x18dd6e[_0xb65c('0x10')],'transfereecontext':_0x18dd6e[_0xb65c('0x11')],'transfereeexten':_0x18dd6e[_0xb65c('0x12')],'transfereelinkedid':_0x18dd6e['transfereelinkedid'],'isexternal':_0x18dd6e[_0xb65c('0x13')],'context':_0x18dd6e[_0xb65c('0x14')],'extension':_0x18dd6e[_0xb65c('0x15')],'type':'blind'},'log':_0xb65c('0x16')});};exports[_0xb65c('0x17')]=function(_0x34e8c6){return client[_0xb65c('0x18')]('CreateVoiceTransferReport',{'body':{'result':_0x34e8c6[_0xb65c('0x2')],'transfererchannel':_0x34e8c6['origtransfererchannel'],'transferercalleridnum':_0x34e8c6[_0xb65c('0x19')],'transferercalleridname':_0x34e8c6[_0xb65c('0x1a')],'transfererconnectedlinenum':_0x34e8c6[_0xb65c('0x1b')],'transfererconnectedlinename':_0x34e8c6[_0xb65c('0x1c')],'transfereraccountcode':_0x34e8c6['origtransfereraccountcode'],'transferercontext':_0x34e8c6['secondtransferercontext'],'transfererexten':_0x34e8c6[_0xb65c('0x1d')],'transfererlinkedid':_0x34e8c6[_0xb65c('0x1e')],'transfereechannel':_0x34e8c6[_0xb65c('0x1f')],'transfereecalleridnum':_0x34e8c6[_0xb65c('0x20')],'transfereecalleridname':_0x34e8c6[_0xb65c('0x21')],'transfereeconnectedlinenum':_0x34e8c6[_0xb65c('0x22')],'transfereeconnectedlinename':_0x34e8c6[_0xb65c('0x23')],'transfereeaccountcode':_0x34e8c6['transfertargetaccountcode'],'transfereecontext':_0x34e8c6['transfertargetcontext'],'transfereeexten':_0x34e8c6[_0xb65c('0x24')],'transfereelinkedid':_0x34e8c6[_0xb65c('0x25')],'isexternal':_0x34e8c6[_0xb65c('0x13')],'context':_0x34e8c6[_0xb65c('0x26')],'extension':_0x34e8c6[_0xb65c('0x27')],'type':_0xb65c('0x28')},'log':_0xb65c('0x16')});}; \ No newline at end of file +var _0x23b6=['transfererconnectedlinenum','transferercontext','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','extension','CreateVoiceTransferReport','attendedTransfer','result','origtransferercalleridnum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','transfers','blindTransfer','Request','transfererchannel','transferercalleridnum','transferercalleridname'];(function(_0x355e8e,_0x4313f0){var _0x52cb43=function(_0x2feb45){while(--_0x2feb45){_0x355e8e['push'](_0x355e8e['shift']());}};_0x52cb43(++_0x4313f0);}(_0x23b6,0x112));var _0x623b=function(_0x35f6b4,_0x505966){_0x35f6b4=_0x35f6b4-0x0;var _0x10f072=_0x23b6[_0x35f6b4];return _0x10f072;};'use strict';var client=require('../client');exports[_0x623b('0x0')]={};exports[_0x623b('0x1')]=function(_0x3fe230){return client[_0x623b('0x2')]('CreateVoiceTransferReport',{'body':{'result':_0x3fe230['result'],'transfererchannel':_0x3fe230[_0x623b('0x3')],'transferercalleridnum':_0x3fe230[_0x623b('0x4')],'transferercalleridname':_0x3fe230[_0x623b('0x5')],'transfererconnectedlinenum':_0x3fe230[_0x623b('0x6')],'transfererconnectedlinename':_0x3fe230['transfererconnectedlinename'],'transfereraccountcode':_0x3fe230['transfereraccountcode'],'transferercontext':_0x3fe230[_0x623b('0x7')],'transfererexten':_0x3fe230['transfererexten'],'transfererlinkedid':_0x3fe230['transfererlinkedid'],'transfereechannel':_0x3fe230['transfereechannel'],'transfereecalleridnum':_0x3fe230[_0x623b('0x8')],'transfereecalleridname':_0x3fe230[_0x623b('0x9')],'transfereeconnectedlinenum':_0x3fe230[_0x623b('0xa')],'transfereeconnectedlinename':_0x3fe230[_0x623b('0xb')],'transfereeaccountcode':_0x3fe230[_0x623b('0xc')],'transfereecontext':_0x3fe230[_0x623b('0xd')],'transfereeexten':_0x3fe230[_0x623b('0xe')],'transfereelinkedid':_0x3fe230[_0x623b('0xf')],'isexternal':_0x3fe230[_0x623b('0x10')],'context':_0x3fe230['context'],'extension':_0x3fe230[_0x623b('0x11')],'type':'blind'},'log':_0x623b('0x12')});};exports[_0x623b('0x13')]=function(_0x4688eb){return client[_0x623b('0x2')](_0x623b('0x12'),{'body':{'result':_0x4688eb[_0x623b('0x14')],'transfererchannel':_0x4688eb['origtransfererchannel'],'transferercalleridnum':_0x4688eb[_0x623b('0x15')],'transferercalleridname':_0x4688eb['origtransferercalleridname'],'transfererconnectedlinenum':_0x4688eb['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4688eb[_0x623b('0x16')],'transfereraccountcode':_0x4688eb[_0x623b('0x17')],'transferercontext':_0x4688eb['secondtransferercontext'],'transfererexten':_0x4688eb[_0x623b('0x18')],'transfererlinkedid':_0x4688eb['origtransfererlinkedid'],'transfereechannel':_0x4688eb[_0x623b('0x19')],'transfereecalleridnum':_0x4688eb[_0x623b('0x1a')],'transfereecalleridname':_0x4688eb['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4688eb[_0x623b('0x1b')],'transfereeconnectedlinename':_0x4688eb[_0x623b('0x1c')],'transfereeaccountcode':_0x4688eb[_0x623b('0x1d')],'transfereecontext':_0x4688eb['transfertargetcontext'],'transfereeexten':_0x4688eb[_0x623b('0x1e')],'transfereelinkedid':_0x4688eb[_0x623b('0x1f')],'isexternal':_0x4688eb[_0x623b('0x10')],'context':_0x4688eb[_0x623b('0x20')],'extension':_0x4688eb[_0x623b('0x21')],'type':_0x623b('0x22')},'log':_0x623b('0x12')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 6224de5..e11fd65 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 _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x22ca3f,_0x38a6d9){var _0x157b64=function(_0x5cffe6){while(--_0x5cffe6){_0x22ca3f['push'](_0x22ca3f['shift']());}};_0x157b64(++_0x38a6d9);}(_0xb10b,0x12a));var _0xbb10=function(_0x1569bd,_0x1a1461){_0x1569bd=_0x1569bd-0x0;var _0x40e370=_0xb10b[_0x1569bd];return _0x40e370;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+0x232a);});});}; \ No newline at end of file +var _0xb10b=['type','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','telephones','trunks','run','event','Event\x20name\x20mandatory','faxAccounts','send','checkAfterSend','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','voiceStatus','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','command','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','voicechannel','map','channels','uniqueid','channel','%s.%s','filename','wav','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','mixmonitorid','rec','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','monitors','stop','queueChannels','inbound','outbound','includes'];(function(_0x1f7ecb,_0x59a15d){var _0x44a849=function(_0x371f96){while(--_0x371f96){_0x1f7ecb['push'](_0x1f7ecb['shift']());}};_0x44a849(++_0x59a15d);}(_0xb10b,0x12a));var _0xbb10=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0xb10b[_0x3f94f9];return _0x46f84f;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var jayson=require(_0xbb10('0x1'));var schema=require(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var config=require('../../../config/environment');var properties=require(_0xbb10('0x4'));var ami=require(_0xbb10('0x5'));var VoiceQueueSummary=require(_0xbb10('0x6'));exports[_0xbb10('0x7')]=function(_0x49baf4,_0x312b72,_0x481979){return new Promise(function(_0x328583,_0x3cdd53){var _0x513741={'QueuePause':function(_0x1b9e94){return new Promise(function(_0x3fb675){var _0x21370f=util[_0xbb10('0x8')](_0xbb10('0x9'),_0xbb10('0xa'),_0x1b9e94[_0xbb10('0xb')]);if(_0x49baf4[_0xbb10('0xc')]&&_0x49baf4['timers'][_0x21370f]&&_0x49baf4['timers'][_0x21370f][_0xbb10('0xd')]){_0x49baf4[_0xbb10('0xc')][_0x21370f][_0xbb10('0xe')]();}if(_0x49baf4['agents'][_0x21370f]){_0x49baf4[_0xbb10('0xf')][_0x21370f]['updateStatusRealtime']({'state':_0x49baf4[_0xbb10('0xf')][_0x21370f][_0xbb10('0x10')],'statePause':_0x1b9e94[_0xbb10('0x11')]?!![]:![]});}_0x3fb675({'code':0xc8,'message':_0xbb10('0x12')});});},'Reload':function(_0x442548){var _0x147230=this;return new Promise(function(_0x58a612,_0x26e021){if(ami[_0xbb10('0x13')]()==![]){return _0x26e021(_0x147230[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}_0x442548=_[_0xbb10('0x19')](_0x442548,_[_0xbb10('0x1a')](properties['reload'][_0xbb10('0x1b')]));_0x442548[_0xbb10('0x1c')]=_0xbb10('0x1d');return ami[_0xbb10('0x1e')](_0x442548)[_0xbb10('0x1f')](function(_0x1682a4){_0x58a612({'code':0xc8,'message':_0x1682a4[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xbf2906){_0x26e021(_0x147230[_0xbb10('0x14')](0x1f5,_0xbf2906['message']));});});},'Command':function(_0x5ff0cf){var _0x19f48d=this;return new Promise(function(_0x388fab,_0x109908){if(ami[_0xbb10('0x13')]()==![]){return _0x109908(_0x19f48d[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected']['join']('\x20')));}_0x5ff0cf=_[_0xbb10('0x19')](_0x5ff0cf,_0xbb10('0x22'));_0x5ff0cf[_0xbb10('0x1c')]=_0xbb10('0x23');return ami[_0xbb10('0x1e')](_0x5ff0cf)[_0xbb10('0x1f')](function(_0x407cb4){_0x388fab({'code':0xc8,'message':_0x407cb4[_0xbb10('0x24')]});})[_0xbb10('0x21')](function(_0x395404){_0x109908(_0x19f48d[_0xbb10('0x14')](0x1f5,_0x395404[_0xbb10('0x20')]));});});},'VoiceQueues':function(){return new Promise(function(_0x537898){var _0x4fedac=[];for(var _0x4fb5e0 in _0x49baf4[_0xbb10('0x25')]){if(_0x49baf4[_0xbb10('0x25')][_0xbb10('0x26')](_0x4fb5e0)){var _0x4e25ff=_0x49baf4[_0xbb10('0x25')][_0x4fb5e0];var _0x24d586=new VoiceQueueSummary(_0x4e25ff);_0x4fedac[_0xbb10('0x27')](_0x24d586);}}_0x537898({'count':_0x4fedac[_0xbb10('0x28')],'rows':_0x4fedac});});},'UpdateVoiceQueue':function(_0x1acce9){return new Promise(function(_0x20d946,_0x2a0e8b){var _0x4aabb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x25')],{'id':parseInt(_0x1acce9['id'])});var _0xfc3595=_[_0xbb10('0x2a')](_0x1acce9,['id']);if(_0x4aabb9){for(var _0x1d30aa in _0xfc3595){if(typeof _0xfc3595[_0x1d30aa]!==_0xbb10('0x2b')&&typeof _0x4aabb9[_0x1d30aa]!=='undefined'){_0x4aabb9[_0x1d30aa]=_0xfc3595[_0x1d30aa];}}_0x20d946(_0x4aabb9);}else{_0x2a0e8b();}});},'VoiceChannels':function(){return new Promise(function(_0x221624){var _0x4ee02e=_[_0xbb10('0x2c')](_0x49baf4['channels']);_0x221624({'count':_0x4ee02e[_0xbb10('0x28')],'rows':_0x4ee02e});});},'VoiceChannelMixMonitor':function(_0x1dcc9c){var _0x1b59f9=this;return new Promise(function(_0x491db4,_0x518d47){if(ami[_0xbb10('0x13')]()==![]){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,[config['asterisk']['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x37a83f=schema(properties[_0xbb10('0x2d')])[_0xbb10('0x2')](_0x1dcc9c);if(_0x37a83f['length']>0x0){return _0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x37a83f,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0xfb2c5e=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x2f')],{'uniqueid':_0x1dcc9c[_0xbb10('0x30')]});if(_0xfb2c5e&&_0xfb2c5e[_0xbb10('0x31')]){var _0x56943c=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1dcc9c[_0xbb10('0x33')]||_0x1dcc9c[_0xbb10('0x30')],_0x1dcc9c['format']||_0xbb10('0x34'));return ami['Action']({'action':'MixMonitor','channel':_0xfb2c5e[_0xbb10('0x31')],'file':_0x56943c,'options':_0xbb10('0x35')})[_0xbb10('0x1f')](function(_0x120d21){var _0x15d895=_[_0xbb10('0x29')](_0xfb2c5e['monitors'],{'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')]()});if(_['isNil'](_0x15d895)){_0xfb2c5e['monitors']['push']({'filename':_0xbb10('0x36')+_0x56943c[_0xbb10('0x37')](),'createdAt':moment()[_0xbb10('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x120d21[_0xbb10('0x38')],'status':_0xbb10('0x39')});}else{_0x15d895[_0xbb10('0x38')]=_0x120d21['mixmonitorid'];_0x15d895[_0xbb10('0x3a')]=_0xbb10('0x39');}_0x491db4({'code':0xc8,'message':[_0x1dcc9c[_0xbb10('0x30')],_0xbb10('0x3b'),_0x120d21['mixmonitorid']][_0xbb10('0x18')]('\x20'),'mixmonitorid':_0x120d21[_0xbb10('0x38')]});})['catch'](function(_0xe2040f){_0x518d47(_0x1b59f9[_0xbb10('0x14')](0x1f5,[_0x1dcc9c[_0xbb10('0x30')],_0xe2040f[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x518d47(_0x1b59f9['error'](0x1f5,_0xbb10('0x3c')));}});},'VoiceChannelStopMixMonitor':function(_0x1c7fae){var _0x3e7b4c=this;return new Promise(function(_0x3d3c41,_0x4943d9){if(ami[_0xbb10('0x13')]()==![]){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')]['username'],_0xbb10('0x17')][_0xbb10('0x18')]('\x20')));}var _0x54ac18=schema(properties['voicechannel'])[_0xbb10('0x2')](_0x1c7fae);if(_0x54ac18['length']>0x0){return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x54ac18,'message')[_0xbb10('0x18')](',\x20')));}var _0x1d82bf=_[_0xbb10('0x29')](_0x49baf4['channels'],{'uniqueid':_0x1c7fae[_0xbb10('0x30')]});if(_0x1d82bf){return Promise[_0xbb10('0x3d')]()[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x3e'),'channel':_0x1d82bf[_0xbb10('0x31')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})[_0xbb10('0x21')](function(){});}})[_0xbb10('0x1f')](function(){if(_0x1d82bf[_0xbb10('0x3f')]){return ami[_0xbb10('0x1e')]({'action':'StopMixMonitor','channel':_0x1d82bf[_0xbb10('0x3f')],'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]})['catch'](function(){});}})[_0xbb10('0x1f')](function(){var _0x2f5027=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'mixmonitorid':_0x1c7fae[_0xbb10('0x38')]});if(_0x2f5027){_0x2f5027[_0xbb10('0x3a')]=_0xbb10('0x41');}})['then'](function(){var _0x4a9793=util[_0xbb10('0x8')](_0xbb10('0x32'),_0x1c7fae[_0xbb10('0x33')]||_0x1c7fae['uniqueid'],_0x1c7fae['format']||_0xbb10('0x34'));var _0x34cf4e=_[_0xbb10('0x29')](_0x1d82bf[_0xbb10('0x40')],{'filename':_0xbb10('0x36')+_0x4a9793[_0xbb10('0x37')]()});if(_0x34cf4e){_0x34cf4e[_0xbb10('0x3a')]=_0xbb10('0x41');}})[_0xbb10('0x1f')](function(){_0x3d3c41({'code':0xc8,'message':[_0x1c7fae[_0xbb10('0x30')],'StopMixMonitor\x20Success']['join']('\x20')});})[_0xbb10('0x21')](function(_0x467dba){_0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,[_0x1c7fae[_0xbb10('0x30')],_0x467dba[_0xbb10('0x20')][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')));});}else{return _0x4943d9(_0x3e7b4c[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannels':function(_0x1214f7){var _0x19ca3e=this;return new Promise(function(_0x20e18a){var _0x61e689=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x42')]);var _0x547a7a={'count':_0x61e689[_0xbb10('0x28')],'rows':_0x61e689};if(_0x1214f7&&_0x1214f7['type']){if(![_0xbb10('0x43'),_0xbb10('0x44')][_0xbb10('0x45')](_0x1214f7[_0xbb10('0x46')])){return _0x3cdd53(_0x19ca3e[_0xbb10('0x14')](0x190,_0xbb10('0x47')));}var _0x2e3326=_[_0xbb10('0x48')](_0x61e689,function(_0x180400){return _0x180400[_0xbb10('0x46')]===_0x1214f7[_0xbb10('0x46')];});_0x547a7a[_0xbb10('0x49')]=_0x2e3326[_0xbb10('0x28')];_0x547a7a[_0xbb10('0x4a')]=_0x2e3326;}_0x20e18a(_0x547a7a);});},'VoiceQueuesChannel':function(_0x4475e1){var _0x5de0cc=this;return new Promise(function(_0x4571b6,_0x466eb7){var _0x1b83a9=schema(properties[_0xbb10('0x4b')])[_0xbb10('0x2')](_0x4475e1);if(_0x1b83a9[_0xbb10('0x28')]>0x0){return _0x466eb7(_0x5de0cc['error'](0x1f4,_[_0xbb10('0x2e')](_0x1b83a9,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x14fed3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x4475e1[_0xbb10('0x30')]});if(_0x14fed3){_0x4571b6(_0x14fed3);}else{return _0x466eb7(_0x5de0cc[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelHangup':function(_0x40c4fb){var _0x2eb05a=this;return new Promise(function(_0x2a1ce1,_0x16932f){if(ami['isConnected']()==![]){return _0x16932f(_0x2eb05a['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],_0xbb10('0x17')]['join']('\x20')));}var _0x506498=schema(properties[_0xbb10('0x4c')])[_0xbb10('0x2')](_0x40c4fb);if(_0x506498[_0xbb10('0x28')]>0x0){return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x506498,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x4a5fb9=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x40c4fb['uniqueid']});if(_0x4a5fb9&&_0x4a5fb9['channel']){return ami['Action']({'action':_0xbb10('0x4d'),'channel':_0x4a5fb9[_0xbb10('0x31')]})[_0xbb10('0x1f')](function(_0x5bd1c0){_0x2a1ce1({'code':0xc8,'message':[_0x40c4fb['uniqueid'],_0x5bd1c0['message'][_0xbb10('0x37')]()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0x4e9fbd){_0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,[_0x40c4fb[_0xbb10('0x30')],_0x4e9fbd['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0x16932f(_0x2eb05a[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'VoiceQueuesChannelRedirect':function(_0x237246){var _0x54b7c5=this;return new Promise(function(_0x43eaec,_0xec48ac){if(ami[_0xbb10('0x13')]()==![]){return _0xec48ac(_0x54b7c5['error'](0x1f4,[config[_0xbb10('0x15')]['ip'],config[_0xbb10('0x15')][_0xbb10('0x16')],'ami\x20disconnected'][_0xbb10('0x18')]('\x20')));}var _0x31e85e=schema(properties[_0xbb10('0x4e')])[_0xbb10('0x2')](_0x237246);if(_0x31e85e['length']>0x0){return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f4,_[_0xbb10('0x2e')](_0x31e85e,_0xbb10('0x20'))[_0xbb10('0x18')](',\x20')));}var _0x56b3a3=_[_0xbb10('0x29')](_0x49baf4[_0xbb10('0x42')],{'uniqueid':_0x237246[_0xbb10('0x30')]});if(_0x56b3a3&&_0x56b3a3[_0xbb10('0x31')]){return ami[_0xbb10('0x1e')]({'action':_0xbb10('0x4f'),'channel':_0x56b3a3[_0xbb10('0x31')],'exten':_0x237246['exten'],'context':_0x237246['context']||_0x56b3a3['context'],'priority':0x1})[_0xbb10('0x1f')](function(_0x9c672d){_0x43eaec({'code':0xc8,'message':[_0x237246[_0xbb10('0x30')],_0x9c672d['message']['toLowerCase']()][_0xbb10('0x18')]('\x20')});})[_0xbb10('0x21')](function(_0xd9e743){_0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,[_0x237246[_0xbb10('0x30')],_0xd9e743[_0xbb10('0x20')]['toLowerCase']()][_0xbb10('0x18')]('\x20')));});}else{return _0xec48ac(_0x54b7c5[_0xbb10('0x14')](0x1f5,_0xbb10('0x3c')));}});},'Agents':function(_0x14f16b){return new Promise(function(_0x2aaaa6){var _0x5bfc68=_['values'](_0x49baf4['agents']);if(_0x14f16b&&_0x14f16b['id']){var _0x329da7=_[_0xbb10('0x29')](_0x5bfc68,function(_0x36917f){return _0x36917f['id']===_0x14f16b['id'];});_0x2aaaa6(_0x329da7);}else{_0x2aaaa6({'count':_0x5bfc68[_0xbb10('0x28')],'rows':_0x5bfc68});}});},'Telephones':function(){return new Promise(function(_0x2f7d2a){var _0x1d40b8=_['values'](_0x49baf4[_0xbb10('0x50')]);_0x2f7d2a({'count':_0x1d40b8['length'],'rows':_0x1d40b8});});},'Trunks':function(){return new Promise(function(_0x4fe3b5){var _0x519a54=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x51')]);_0x4fe3b5({'count':_0x519a54[_0xbb10('0x28')],'rows':_0x519a54});});},'OutboundChannels':function(){return new Promise(function(_0x108f99){var _0x5ce94f=_[_0xbb10('0x2c')](_0x49baf4['outboundChannels']);_0x108f99({'count':_0x5ce94f['length'],'rows':_0x5ce94f});});},'Outbound':function(){return new Promise(function(_0x165fe9){_0x165fe9(_0x49baf4[_0xbb10('0x44')]);});},'Campaigns':function(){return new Promise(function(_0x29529c){var _0x2bd2ab=_[_0xbb10('0x2c')](_0x49baf4['campaigns']);_0x29529c({'count':_0x2bd2ab[_0xbb10('0x28')],'rows':_0x2bd2ab});});},'VoiceQueuesPreview':function(_0x19fcec){var _0x2c6429=this;return new Promise(function(_0x3f3d38,_0x43cdb7){_0x312b72[_0xbb10('0x52')](_0x19fcec['id'])[_0xbb10('0x1f')](function(_0x53fa98){_0x3f3d38({'code':0xc8,'message':_0x53fa98[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x30f3ea){_0x43cdb7(_0x2c6429[_0xbb10('0x14')](0x1f4,_0x30f3ea[_0xbb10('0x20')]));});});},'EventManager':function(_0x172be3){var _0xa3b23=this;return new Promise(function(_0x312a08,_0x5a4429){if(!_0x172be3[_0xbb10('0x53')]){return _0x5a4429(_0xa3b23[_0xbb10('0x14')](0x1f4,_0xbb10('0x54')));}ami['emit']('custom:'+_0x172be3['event'],_0x172be3[_0xbb10('0x20')]);_0x312a08({'code':0xc8,'message':_0x172be3});});},'FaxAccounts':function(){return new Promise(function(_0x5a3c44){var _0x4e3d6a=_[_0xbb10('0x2c')](_0x49baf4[_0xbb10('0x55')]);_0x5a3c44({'count':_0x4e3d6a[_0xbb10('0x28')],'rows':_0x4e3d6a});});},'SendFax':function(_0x12ed63){var _0x32ec27=this;return new Promise(function(_0x24dca6,_0x33116){_0x481979[_0xbb10('0x56')](_0x12ed63)[_0xbb10('0x1f')](function(_0x5206e1){_0x24dca6({'code':0xc8,'message':_0x5206e1[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0x46b6d2){_0x33116(_0x32ec27[_0xbb10('0x14')](0x1f4,_0x46b6d2['message']));});});},'CheckAfterSend':function(_0x4c0795){var _0x3547a3=this;return new Promise(function(_0x2280bd,_0x30f0a4){_0x481979[_0xbb10('0x57')](_0x4c0795)['then'](function(_0x17d596){_0x2280bd({'code':0xc8,'message':_0x17d596[_0xbb10('0x20')]});})[_0xbb10('0x21')](function(_0xf7b3e1){_0x30f0a4(_0x3547a3[_0xbb10('0x14')](0x1f4,_0xf7b3e1['message']));});});}};var _0x5f0691=jayson[_0xbb10('0x58')](_0x513741)[_0xbb10('0x59')]();_0x5f0691['on'](_0xbb10('0x14'),function(_0x5239da){return _0x3cdd53(_0x5239da);});_0x5f0691[_0xbb10('0x7')](0x232a,_0xbb10('0x5a'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x328583(_0xbb10('0x5b')+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 891dd53..5014b74 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 _0x3a67=['scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','map','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','firstName','destcalleridname','createContact','push','[CM][%s][%s]\x20Autocreate\x20disabled','format','user:%s','trigger:%s','action','toLowerCase','lodash','bluebird','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','info','stringify','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','routeId','calleridnum','destcalleridnum','fax'];(function(_0x3eaa8f,_0x12d15d){var _0x48900b=function(_0x5b7550){while(--_0x5b7550){_0x3eaa8f['push'](_0x3eaa8f['shift']());}};_0x48900b(++_0x12d15d);}(_0x3a67,0x89));var _0x73a6=function(_0x5ec2bd,_0x231a1c){_0x5ec2bd=_0x5ec2bd-0x0;var _0x57613b=_0x3a67[_0x5ec2bd];return _0x57613b;};'use strict';var _=require(_0x73a6('0x0'));var BPromise=require(_0x73a6('0x1'));var Redis=require('ioredis');var util=require(_0x73a6('0x2'));var config=require(_0x73a6('0x3'));var logger=require(_0x73a6('0x4'))(_0x73a6('0x5'));var cmContactRpc=require(_0x73a6('0x6'));config[_0x73a6('0x7')]=_[_0x73a6('0x8')](config[_0x73a6('0x7')],{'host':_0x73a6('0x9'),'port':0x18eb});var io=require(_0x73a6('0xa'))(new Redis(config[_0x73a6('0x7')]));function emit(_0x1f467f,_0x5c8b2e,_0x4168c8,_0x5bb5bd,_0x3fbfba){logger[_0x73a6('0xb')]('[CM][%s][%s]',_0x1f467f,_0x5c8b2e['id'],_0x4168c8,_0x5bb5bd,JSON[_0x73a6('0xc')](_0x3fbfba));io['to'](_0x4168c8)[_0x73a6('0xd')](_0x5bb5bd,_0x3fbfba);}exports[_0x73a6('0xe')]=function(_0x55a935,_0x54904b,_0x464501,_0x5d00ec){var _0x2efae0,_0x186d7d;var _0x4607a2={};var _0x394d91;var _0x5ba64f=Number(_0x464501[_0x73a6('0xf')]);var _0x16285e=_0x464501[_0x73a6('0x10')]?Boolean(Number(_0x464501[_0x73a6('0x10')])):![];var _0x1282dc;var _0xc20450=![];if(!_[_0x73a6('0x11')](_0x464501[_0x73a6('0x12')])){if(_0x464501['data5']=='1')_0xc20450=!![];}if(!_0xc20450){if(_0x5d00ec[_0x73a6('0x13')]){_0x4607a2['id']=_0x5d00ec[_0x73a6('0x13')];}}if(!_0x4607a2['id']){_0x4607a2[_0x73a6('0x14')]=_0x5ba64f;_0x1282dc=_0x464501['data3']&&_0x464501[_0x73a6('0x15')]!=='0'?_0x464501['data3'][_0x73a6('0x16')](','):[_0x73a6('0x17')];_0x4607a2['$or']=_['map'](_0x1282dc,function(_0x417960){var _0x2ccb95={};_0x2ccb95[_0x417960]=_0x5d00ec[_0x73a6('0x18')]?_0x5d00ec['destcalleridnum']:_0x5d00ec[_0x73a6('0x19')];return _0x2ccb95;});_0x394d91=_0x5d00ec[_0x73a6('0x18')]?_0x5d00ec[_0x73a6('0x1a')]:_0x5d00ec[_0x73a6('0x19')];}var _0x53d202=['id','firstName','lastName','phone','mobile',_0x73a6('0x1b'),'ListId','createdAt',_0x73a6('0x1c'),_0x73a6('0x1d')];var _0x59c405=_[_0x73a6('0x1e')](_0x53d202,_0x1282dc);BPromise[_0x73a6('0x1f')]()[_0x73a6('0x20')](cmContactRpc[_0x73a6('0x21')]({'attributes':_0x59c405,'where':_0x4607a2,'phone':_0x394d91}))[_0x73a6('0x20')](function(_0x334384){_0x186d7d=_0x334384;if(!_[_0x73a6('0x22')](_0x186d7d)){if(_0x186d7d[_0x73a6('0x23')]===0x1){_0x2efae0=_0x186d7d[0x0];logger[_0x73a6('0xb')](_0x73a6('0x24'),_0x5d00ec[_0x73a6('0x25')],_0x54904b['id'],_0x2efae0['id']);}else{logger[_0x73a6('0xb')]('[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]',_0x5d00ec[_0x73a6('0x25')],_0x54904b['id'],_[_0x73a6('0x26')](_0x186d7d,'id')['join'](','));}return;}else{logger[_0x73a6('0xb')](_0x73a6('0x27'),_0x5d00ec[_0x73a6('0x25')],_0x54904b['id']);var _0x3fe561={'ListId':_0x5ba64f};var _0x216fa0=_0x464501[_0x73a6('0x28')]&&_0x464501[_0x73a6('0x28')]!=='0'?_0x464501[_0x73a6('0x28')]:'phone';if(_0x16285e){logger[_0x73a6('0xb')](_0x73a6('0x29'),_0x5d00ec['uniqueid'],_0x54904b['id']);_0x3fe561[_0x216fa0]=_['isNil'](_0x5d00ec[_0x73a6('0x18')])?_0x5d00ec[_0x73a6('0x19')]:_0x5d00ec[_0x73a6('0x1a')];if(_[_0x73a6('0x11')](_0x5d00ec[_0x73a6('0x18')])){_0x3fe561['firstName']=_0x5d00ec[_0x73a6('0x2a')]&&_0x5d00ec['calleridname']!==_0x73a6('0x2b')?_0x5d00ec[_0x73a6('0x2a')]:_0x73a6('0x2c');}else{_0x3fe561[_0x73a6('0x2d')]=_0x5d00ec[_0x73a6('0x2e')]&&_0x5d00ec[_0x73a6('0x2e')]!==_0x73a6('0x2b')?_0x5d00ec[_0x73a6('0x2e')]:_0x73a6('0x2c');}return BPromise['resolve']()[_0x73a6('0x20')](cmContactRpc[_0x73a6('0x2f')](_0x3fe561))[_0x73a6('0x20')](function(_0x4c951f){_0x2efae0=_0x4c951f;_0x186d7d[_0x73a6('0x30')](_0x4c951f);if(_0x2efae0){logger[_0x73a6('0xb')]('[CM][%s][%s]\x20Contact\x20created:%s',_0x5d00ec[_0x73a6('0x25')],_0x54904b['id'],_0x2efae0['id']);}return;});}else{logger[_0x73a6('0xb')](_0x73a6('0x31'),_0x5d00ec[_0x73a6('0x25')],_0x54904b['id']);_0x3fe561[_0x216fa0]=_[_0x73a6('0x11')](_0x5d00ec[_0x73a6('0x18')])?_0x5d00ec[_0x73a6('0x19')]:_0x5d00ec[_0x73a6('0x1a')];if(_[_0x73a6('0x11')](_0x5d00ec[_0x73a6('0x18')])){_0x3fe561[_0x73a6('0x2d')]=_0x5d00ec['calleridname']&&_0x5d00ec[_0x73a6('0x2a')]!==_0x73a6('0x2b')?_0x5d00ec[_0x73a6('0x2a')]:'Unknown';}else{_0x3fe561['firstName']=_0x5d00ec[_0x73a6('0x2e')]&&_0x5d00ec[_0x73a6('0x2e')]!==_0x73a6('0x2b')?_0x5d00ec[_0x73a6('0x2e')]:_0x73a6('0x2c');}_0x2efae0=_0x3fe561;_0x186d7d[_0x73a6('0x30')](_0x3fe561);return;}}})[_0x73a6('0x20')](function(){if(_0x55a935){emit(_0x5d00ec[_0x73a6('0x25')],_0x54904b,util[_0x73a6('0x32')](_0x73a6('0x33'),_0x55a935['name']),util[_0x73a6('0x32')](_0x73a6('0x34'),_0x464501[_0x73a6('0x35')][_0x73a6('0x36')]()),{'evt':_['merge'](_0x5d00ec,{'autoCreate':_0x16285e}),'contact':_0x2efae0===undefined?{}:_0x2efae0,'contacts':_0x186d7d['length']===0x0?undefined:_0x186d7d});}});}; \ No newline at end of file +var _0x463f=['uniqueid','map','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','firstName','calleridname','','Unknown','destcalleridname','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','trigger:%s','action','merge','length','lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','redis','localhost','info','[CM][%s][%s]','stringify','exec','data1','data2','isNil','data5','xmd-contactid','data3','split','phone','$or','routeId','destcalleridnum','calleridnum','mobile','fax','ListId','createdAt','updatedAt','union','resolve','then','getContacts','isEmpty','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]'];(function(_0x2faddb,_0xc18b78){var _0x273c05=function(_0x1a3785){while(--_0x1a3785){_0x2faddb['push'](_0x2faddb['shift']());}};_0x273c05(++_0xc18b78);}(_0x463f,0x164));var _0xf463=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x463f[_0x4e676e];return _0x336a3c;};'use strict';var _=require(_0xf463('0x0'));var BPromise=require(_0xf463('0x1'));var Redis=require(_0xf463('0x2'));var util=require(_0xf463('0x3'));var config=require(_0xf463('0x4'));var logger=require(_0xf463('0x5'))(_0xf463('0x6'));var cmContactRpc=require('../../rpc/cmContact');config[_0xf463('0x7')]=_['defaults'](config[_0xf463('0x7')],{'host':_0xf463('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x373558,_0x3b245d,_0x59f98e,_0x4f13d4,_0x3fc6f1){logger[_0xf463('0x9')](_0xf463('0xa'),_0x373558,_0x3b245d['id'],_0x59f98e,_0x4f13d4,JSON[_0xf463('0xb')](_0x3fc6f1));io['to'](_0x59f98e)['emit'](_0x4f13d4,_0x3fc6f1);}exports[_0xf463('0xc')]=function(_0x53dbc1,_0x11673c,_0x5b6b69,_0x18abc9){var _0x184d8a,_0x124ffc;var _0x453219={};var _0x9f6b1a;var _0x21b934=Number(_0x5b6b69[_0xf463('0xd')]);var _0x163987=_0x5b6b69[_0xf463('0xe')]?Boolean(Number(_0x5b6b69['data2'])):![];var _0x30b96f;var _0x41abfb=![];if(!_[_0xf463('0xf')](_0x5b6b69[_0xf463('0x10')])){if(_0x5b6b69[_0xf463('0x10')]=='1')_0x41abfb=!![];}if(!_0x41abfb){if(_0x18abc9[_0xf463('0x11')]){_0x453219['id']=_0x18abc9[_0xf463('0x11')];}}if(!_0x453219['id']){_0x453219['ListId']=_0x21b934;_0x30b96f=_0x5b6b69[_0xf463('0x12')]&&_0x5b6b69['data3']!=='0'?_0x5b6b69[_0xf463('0x12')][_0xf463('0x13')](','):[_0xf463('0x14')];_0x453219[_0xf463('0x15')]=_['map'](_0x30b96f,function(_0x2da790){var _0x2dd64b={};_0x2dd64b[_0x2da790]=_0x18abc9[_0xf463('0x16')]?_0x18abc9[_0xf463('0x17')]:_0x18abc9['calleridnum'];return _0x2dd64b;});_0x9f6b1a=_0x18abc9[_0xf463('0x16')]?_0x18abc9['destcalleridnum']:_0x18abc9[_0xf463('0x18')];}var _0x4e9cb9=['id','firstName','lastName',_0xf463('0x14'),_0xf463('0x19'),_0xf463('0x1a'),_0xf463('0x1b'),_0xf463('0x1c'),'scheduledAt',_0xf463('0x1d')];var _0x38e201=_[_0xf463('0x1e')](_0x4e9cb9,_0x30b96f);BPromise[_0xf463('0x1f')]()[_0xf463('0x20')](cmContactRpc[_0xf463('0x21')]({'attributes':_0x38e201,'where':_0x453219,'phone':_0x9f6b1a}))[_0xf463('0x20')](function(_0x3b0e4d){_0x124ffc=_0x3b0e4d;if(!_[_0xf463('0x22')](_0x124ffc)){if(_0x124ffc['length']===0x1){_0x184d8a=_0x124ffc[0x0];logger[_0xf463('0x9')]('[CM][%s][%s]\x20Contact\x20found:%s',_0x18abc9['uniqueid'],_0x11673c['id'],_0x184d8a['id']);}else{logger[_0xf463('0x9')](_0xf463('0x23'),_0x18abc9[_0xf463('0x24')],_0x11673c['id'],_[_0xf463('0x25')](_0x124ffc,'id')[_0xf463('0x26')](','));}return;}else{logger[_0xf463('0x9')](_0xf463('0x27'),_0x18abc9[_0xf463('0x24')],_0x11673c['id']);var _0x7c0e76={'ListId':_0x21b934};var _0x45ff97=_0x5b6b69[_0xf463('0x28')]&&_0x5b6b69[_0xf463('0x28')]!=='0'?_0x5b6b69[_0xf463('0x28')]:_0xf463('0x14');if(_0x163987){logger['info'](_0xf463('0x29'),_0x18abc9[_0xf463('0x24')],_0x11673c['id']);_0x7c0e76[_0x45ff97]=_[_0xf463('0xf')](_0x18abc9[_0xf463('0x16')])?_0x18abc9[_0xf463('0x18')]:_0x18abc9[_0xf463('0x17')];if(_[_0xf463('0xf')](_0x18abc9[_0xf463('0x16')])){_0x7c0e76[_0xf463('0x2a')]=_0x18abc9[_0xf463('0x2b')]&&_0x18abc9[_0xf463('0x2b')]!==_0xf463('0x2c')?_0x18abc9[_0xf463('0x2b')]:_0xf463('0x2d');}else{_0x7c0e76[_0xf463('0x2a')]=_0x18abc9['destcalleridname']&&_0x18abc9[_0xf463('0x2e')]!==_0xf463('0x2c')?_0x18abc9[_0xf463('0x2e')]:_0xf463('0x2d');}return BPromise[_0xf463('0x1f')]()['then'](cmContactRpc[_0xf463('0x2f')](_0x7c0e76))[_0xf463('0x20')](function(_0x3fdaca){_0x184d8a=_0x3fdaca;_0x124ffc[_0xf463('0x30')](_0x3fdaca);if(_0x184d8a){logger[_0xf463('0x9')](_0xf463('0x31'),_0x18abc9['uniqueid'],_0x11673c['id'],_0x184d8a['id']);}return;});}else{logger['info']('[CM][%s][%s]\x20Autocreate\x20disabled',_0x18abc9[_0xf463('0x24')],_0x11673c['id']);_0x7c0e76[_0x45ff97]=_[_0xf463('0xf')](_0x18abc9[_0xf463('0x16')])?_0x18abc9['calleridnum']:_0x18abc9[_0xf463('0x17')];if(_[_0xf463('0xf')](_0x18abc9['routeId'])){_0x7c0e76['firstName']=_0x18abc9[_0xf463('0x2b')]&&_0x18abc9[_0xf463('0x2b')]!==_0xf463('0x2c')?_0x18abc9['calleridname']:_0xf463('0x2d');}else{_0x7c0e76[_0xf463('0x2a')]=_0x18abc9[_0xf463('0x2e')]&&_0x18abc9[_0xf463('0x2e')]!==_0xf463('0x2c')?_0x18abc9[_0xf463('0x2e')]:_0xf463('0x2d');}_0x184d8a=_0x7c0e76;_0x124ffc['push'](_0x7c0e76);return;}}})[_0xf463('0x20')](function(){if(_0x53dbc1){emit(_0x18abc9[_0xf463('0x24')],_0x11673c,util[_0xf463('0x32')](_0xf463('0x33'),_0x53dbc1['name']),util['format'](_0xf463('0x34'),_0x5b6b69[_0xf463('0x35')]['toLowerCase']()),{'evt':_[_0xf463('0x36')](_0x18abc9,{'autoCreate':_0x163987}),'contact':_0x184d8a===undefined?{}:_0x184d8a,'contacts':_0x124ffc[_0xf463('0x37')]===0x0?undefined:_0x124ffc});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 92b4283..4eabe1d 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 _0x6d58=['exports','lodash','url','./urlforward','./integration','./script','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','socket.io-emitter','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','sugarcrmAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','salesforceAccounts','zohoAccounts','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:amd','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:rejectmessage','custom:offlineMessage','emit','info','stringify','prototype','clone','motionChannel','undefined','voice','debug','inspect','checkTriggers','interface','hasOwnProperty','status','checkTrigger','variables','Actions','action','toLowerCase','contactmanager','motionbar','browser','data1','data2','html','render','uri','data4','location','windowWidth','isNil','data5','windowHeight','data6','600','winArguments','data3','format','user:%s','name','trigger:%s:%s','merge','jscripty','trigger:%s','exec','queue','routeId','urlforward','script','buildUri','parse','query','replace','channel','AllConditions','length','every','some','checkConditions','field','account','chat','ChatWebsiteId','operator','upperFirst','AccountId','value','interaction','message','event','agent','membername','lastevent','mailSubstatus','substatus','offlineMessage','equals'];(function(_0x1e71a7,_0x37dc43){var _0x1644e4=function(_0x2418a5){while(--_0x2418a5){_0x1e71a7['push'](_0x1e71a7['shift']());}};_0x1644e4(++_0x37dc43);}(_0x6d58,0x7e));var _0x86d5=function(_0xf0cc4f,_0x22c4ad){_0xf0cc4f=_0xf0cc4f-0x0;var _0x236774=_0x6d58[_0xf0cc4f];return _0x236774;};'use strict';var util=require('util');var _=require(_0x86d5('0x0'));var url=require(_0x86d5('0x1'));var Mustache=require('mustache');var Redis=require('ioredis');var urlforward=require(_0x86d5('0x2'));var integration=require(_0x86d5('0x3'));var cmContact=require('./cmContact');var script=require(_0x86d5('0x4'));var config=require(_0x86d5('0x5'));var logger=require(_0x86d5('0x6'))('trigger');var ami=require(_0x86d5('0x7'));config[_0x86d5('0x8')]=_[_0x86d5('0x9')](config[_0x86d5('0x8')],{'host':_0x86d5('0xa'),'port':0x18eb});var io=require(_0x86d5('0xb'))(new Redis(config[_0x86d5('0x8')]));var operators={'equals':function(_0x1d2b18,_0x57a67b){return _0x1d2b18==_0x57a67b;},'not_equals':function(_0x8cd218,_0x270cc2){return _0x8cd218!=_0x270cc2;}};var barAndWebActions=['popup',_0x86d5('0x1'),_0x86d5('0xc')];function Trigger(_0x52d101){this[_0x86d5('0xd')]=_0x52d101[_0x86d5('0xd')];this[_0x86d5('0xe')]=_0x52d101[_0x86d5('0xe')];this['voiceQueues']=_0x52d101[_0x86d5('0xf')];this[_0x86d5('0x10')]=_0x52d101[_0x86d5('0x10')];this[_0x86d5('0x11')]=_0x52d101[_0x86d5('0x11')];this[_0x86d5('0x12')]=_0x52d101[_0x86d5('0x12')];this[_0x86d5('0x13')]=_0x52d101[_0x86d5('0x13')];this['salesforceAccounts']=_0x52d101['salesforceAccounts'];this[_0x86d5('0x14')]=_0x52d101[_0x86d5('0x14')];this['zohoAccounts']=_0x52d101['zohoAccounts'];this[_0x86d5('0x15')]=_0x52d101[_0x86d5('0x15')];this['vtigerAccounts']=_0x52d101[_0x86d5('0x16')];this['servicenowAccounts']=_0x52d101[_0x86d5('0x17')];this['dynamics365Accounts']=_0x52d101[_0x86d5('0x18')];this['freshsalesAccounts']=_0x52d101[_0x86d5('0x19')];this[_0x86d5('0x1a')]={'zendesk':this[_0x86d5('0x12')],'salesforce':this[_0x86d5('0x1b')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this[_0x86d5('0x14')],'zoho':this[_0x86d5('0x1c')],'desk':this[_0x86d5('0x15')],'vtiger':this[_0x86d5('0x16')],'dynamics365':this[_0x86d5('0x18')],'freshsales':this[_0x86d5('0x19')],'servicenow':this[_0x86d5('0x17')]};ami['on']('custom:agentcalled',this['syncCustomEvent'][_0x86d5('0x1d')](this));ami['on'](_0x86d5('0x1e'),this[_0x86d5('0x1f')][_0x86d5('0x1d')](this));ami['on'](_0x86d5('0x20'),this[_0x86d5('0x1f')][_0x86d5('0x1d')](this));ami['on']('custom:agentcomplete',this['syncCustomEvent']['bind'](this));ami['on'](_0x86d5('0x21'),this[_0x86d5('0x1f')][_0x86d5('0x1d')](this));ami['on'](_0x86d5('0x22'),this['syncCustomEvent'][_0x86d5('0x1d')](this));ami['on']('custom:agentbusy',this[_0x86d5('0x1f')][_0x86d5('0x1d')](this));ami['on'](_0x86d5('0x23'),this[_0x86d5('0x1f')]['bind'](this));ami['on']('custom:agentreject',this[_0x86d5('0x1f')][_0x86d5('0x1d')](this));ami['on'](_0x86d5('0x24'),this[_0x86d5('0x1f')][_0x86d5('0x1d')](this));ami['on']('custom:queuecallerabandon',this[_0x86d5('0x1f')][_0x86d5('0x1d')](this));ami['on'](_0x86d5('0x25'),this['syncCustomEvent'][_0x86d5('0x1d')](this));ami['on'](_0x86d5('0x26'),this[_0x86d5('0x27')]['bind'](this));ami['on']('custom:dialconnect',this[_0x86d5('0x27')]['bind'](this));ami['on'](_0x86d5('0x28'),this['syncAgentDial']['bind'](this));ami['on'](_0x86d5('0x29'),this[_0x86d5('0x1f')][_0x86d5('0x1d')](this));ami['on'](_0x86d5('0x2a'),this[_0x86d5('0x1f')][_0x86d5('0x1d')](this));ami['on']('custom:substatus',this[_0x86d5('0x1f')][_0x86d5('0x1d')](this));ami['on'](_0x86d5('0x2b'),this[_0x86d5('0x1f')]['bind'](this));ami['on'](_0x86d5('0x2c'),this[_0x86d5('0x1f')][_0x86d5('0x1d')](this));ami['on']('custom:acceptmessage',this[_0x86d5('0x1f')][_0x86d5('0x1d')](this));ami['on'](_0x86d5('0x2d'),this[_0x86d5('0x1f')]['bind'](this));ami['on'](_0x86d5('0x2e'),this['syncCustomEvent'][_0x86d5('0x1d')](this));}Trigger['prototype'][_0x86d5('0x2f')]=function(_0x41583b,_0x1da45a,_0x2a7e85){logger[_0x86d5('0x30')](_0x41583b,_0x1da45a,JSON[_0x86d5('0x31')](_0x2a7e85));io['to'](_0x41583b)['emit'](_0x1da45a,_0x2a7e85);};Trigger[_0x86d5('0x32')]['syncCustomEvent']=function(_0x4e264d){var _0xe3a0f0=_[_0x86d5('0x33')](_0x4e264d);if(typeof _0xe3a0f0[_0x86d5('0x34')]===_0x86d5('0x35')){_0xe3a0f0[_0x86d5('0x34')]=_0x86d5('0x36');}logger[_0x86d5('0x37')](_0x86d5('0x1f'),util[_0x86d5('0x38')](_0xe3a0f0,{'showHidden':!![],'depth':null}));this[_0x86d5('0x39')](_0xe3a0f0);};Trigger[_0x86d5('0x32')][_0x86d5('0x27')]=function(_0x27df09){if(this[_0x86d5('0xe')][_0x27df09[_0x86d5('0x3a')]]){this[_0x86d5('0x1f')](_0x27df09);}};Trigger['prototype'][_0x86d5('0x39')]=function(_0x10b0f1){var _0x704871;for(var _0x157da0 in this[_0x86d5('0xd')]){if(this[_0x86d5('0xd')][_0x86d5('0x3b')](_0x157da0)){if(this['triggers'][_0x157da0][_0x86d5('0x3c')]){_0x704871=this[_0x86d5('0x3d')](this[_0x86d5('0xd')][_0x157da0],_0x10b0f1);if(_0x704871){_['merge'](_0x10b0f1,_0x10b0f1[_0x86d5('0x3e')]);for(var _0x5d51db=0x0,_0x16ba70,_0x2214c3,_0x7a75bc;_0x5d51db0x0){_0x59bf34=_[_0xbe14('0x2b')](_0x16f884,_0x29fc64);}return _0x59bf34;}function getCustomFields(_0x1c7cc7,_0x19252f){var _0x34d648=[];var _0x36d4b2={'custom_fields':{}};if(_0x1c7cc7[_0xbe14('0x2a')]>0x0){_[_0xbe14('0x2c')](_0x1c7cc7,function(_0x4168c8){if(_[_0xbe14('0x2d')]([_0xbe14('0x2e'),_0xbe14('0x2f')],_0x4168c8[_0xbe14('0x30')])&&_0x4168c8[_0xbe14('0x31')]&&!_0x4168c8[_0xbe14('0x32')]){_0x36d4b2[_0x4168c8[_0xbe14('0x31')][_0xbe14('0x33')]()]=_0x4168c8[_0xbe14('0x34')][_0xbe14('0x35')]();}else if(_[_0xbe14('0x2d')](['string',_0xbe14('0x2f')],_0x4168c8['type'])&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x36d4b2['custom_fields'][_0x4168c8[_0xbe14('0x36')]]=_0x4168c8[_0xbe14('0x34')]['toString']();}else if(_0x4168c8['type']==='variable'&&_0x4168c8[_0xbe14('0x37')]&&_0x4168c8[_0xbe14('0x36')]&&_0x4168c8['customField']){_0x19252f[_0x4168c8[_0xbe14('0x37')]]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x37')]][_0xbe14('0x35')]());}else if(_0x4168c8['type']==='customVariable'&&_0x4168c8[_0xbe14('0x39')]&&_0x4168c8['Variable']['name']&&_0x4168c8['idField']&&_0x4168c8[_0xbe14('0x32')]){_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()]&&(_0x36d4b2[_0xbe14('0x38')][_0x4168c8[_0xbe14('0x36')]]=_0x19252f[_0x4168c8[_0xbe14('0x39')][_0xbe14('0x3a')][_0xbe14('0x33')]()][_0xbe14('0x35')]());}});}if(_0x36d4b2[_0xbe14('0x3b')]){_0x36d4b2[_0xbe14('0x3b')]=Number(_0x36d4b2['priority']);}return _0x36d4b2;}function getTicket(_0x4f51f8,_0x43cdaa,_0x2951e1,_0x13bfcf,_0x520e09){logger[_0xbe14('0x12')](_0xbe14('0x3c'));var _0xeda70e=_[_0xbe14('0x3d')]({'subject':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x3f')],_0x520e09,'\x20'),'type':_0xbe14('0x40'),'status':_0xbe14('0x41'),'labels':[_0xbe14('0x42'),'Motion',_0xbe14('0x43')][_0xbe14('0x44')](getTags(_0x13bfcf[_0xbe14('0x45')],_0xbe14('0x3a'))),'description':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a'),'_links':{'assigned_user':{'href':util['format'](_0xbe14('0x47'),_0x43cdaa['id']),'class':_0xbe14('0x48')}},'message':{'direction':'in','body':intUtil[_0xbe14('0x3e')](_0x13bfcf[_0xbe14('0x46')],_0x520e09,'\x0a')}},getCustomFields(_0x13bfcf['Fields'],_0x520e09));return request({'uri':util['format'](_0xbe14('0x49'),_0x4f51f8[_0xbe14('0x28')],_0x2951e1['id']),'method':_0xbe14('0x29'),'body':_0xeda70e});}exports['queue']=function(_0x5d5318,_0x6b6aa8,_0x59ae4d,_0x5657fe,_0x3593f8,_0x1f0355){var _0x8216c3,_0x5051e4;_0x1f0355['remoteUri']=intUtil['stripTrailingSlash'](_0x1f0355[_0xbe14('0x28')]);_0x1f0355[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x1f0355['serverUrl']);if(_0x3593f8&&_0x3593f8[_0xbe14('0x4c')]){logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x4e'));_0x6b6aa8['recordingURL']=util['format'](_0xbe14('0x4f'),_0x1f0355[_0xbe14('0x4a')],_0x6b6aa8[_0xbe14('0x50')],md5(_0x6b6aa8[_0xbe14('0x50')]));}else{_0x6b6aa8[_0xbe14('0x51')]='';}headers['Authorization']=getAuth(_0x1f0355);return getUser(_0x1f0355,_0x5657fe['email'])[_0xbe14('0xd')](function(_0x2a3623){_0x8216c3=_0x2a3623;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x8216c3['id']);return getEndUser(_0x1f0355,_0x6b6aa8['calleridname'],_0x6b6aa8[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x53e8ab){_0x5051e4=_0x53e8ab;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x5051e4['id']);return getTicket(_0x1f0355,_0x8216c3,_0x5051e4,_0x59ae4d,_0x6b6aa8);})[_0xbe14('0xd')](function(_0x36c20c){if(_0x36c20c){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x36c20c['id']);switch(_0x1f0355['type']){case'integrationTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x36c20c['id']});break;case'newTab':logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x5657fe['name']),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')](_0xbe14('0x5b'),_0x36c20c['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x4d'),_0xbe14('0x5d'));}}})['catch'](function(_0x5aeea9){console[_0xbe14('0x5c')](_0x5aeea9);logger[_0xbe14('0x5c')](_0xbe14('0x4d'),JSON['stringify'](_0x5aeea9));});};exports['outbound']=function(_0x44fe0d,_0x134878,_0x50d78f,_0x339a86,_0x32496a,_0x50c2a0,_0x28f995){var _0x4a40d2,_0x41ba58;_0x50c2a0[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['remoteUri']);_0x50c2a0[_0xbe14('0x4a')]=intUtil[_0xbe14('0x4b')](_0x50c2a0['serverUrl']);if(_0x28f995&&_0x28f995[_0xbe14('0x5e')]&&_0x28f995[_0xbe14('0x5e')]!==_0xbe14('0x5f')){logger[_0xbe14('0x12')](_0xbe14('0x60'),'Recording\x20is\x20enabled!');_0x134878[_0xbe14('0x51')]=util[_0xbe14('0xb')](_0xbe14('0x4f'),_0x50c2a0[_0xbe14('0x4a')],_0x134878[_0xbe14('0x50')],md5(_0x134878[_0xbe14('0x50')]));}headers[_0xbe14('0x61')]=getAuth(_0x50c2a0);return getUser(_0x50c2a0,_0x339a86['email'])[_0xbe14('0xd')](function(_0x1b47a4){_0x4a40d2=_0x1b47a4;logger[_0xbe14('0x12')](_0xbe14('0x52'),_0x4a40d2['id']);return getEndUser(_0x50c2a0,_0x134878[_0xbe14('0x62')],_0x134878[_0xbe14('0x63')]);})[_0xbe14('0xd')](function(_0x32df3c){_0x41ba58=_0x32df3c;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x41ba58['id']);return getTicket(_0x50c2a0,_0x4a40d2,_0x41ba58,_0x50d78f,_0x134878);})[_0xbe14('0xd')](function(_0x4bccfc){if(_0x4bccfc){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x4bccfc['id']);switch(_0x50c2a0[_0xbe14('0x30')]){case _0xbe14('0x64'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x56'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x58'),{'recordId':_0x4bccfc['id']});break;case _0xbe14('0x65'):logger[_0xbe14('0x12')](_0xbe14('0x4d'),_0xbe14('0x59'));emit(util[_0xbe14('0xb')](_0xbe14('0x57'),_0x339a86[_0xbe14('0x3a')]),_0xbe14('0x5a'),{'uri':util[_0xbe14('0xb')]('%s/agent/tickets/%s',_0x50c2a0[_0xbe14('0x28')],_0x4bccfc['id'])});break;default:logger[_0xbe14('0x5c')](_0xbe14('0x60'),_0xbe14('0x5d'));}}})[_0xbe14('0x66')](function(_0x222944){logger[_0xbe14('0x5c')](_0xbe14('0x60'),JSON[_0xbe14('0x19')](_0x222944));});};exports[_0xbe14('0x67')]=function(_0x5917d5,_0x18be56,_0x442ec4,_0x2d4dd4,_0xfd32a3,_0x3ac6d8){var _0x5a1ea6,_0x42b341;_0x3ac6d8[_0xbe14('0x28')]=intUtil[_0xbe14('0x4b')](_0x3ac6d8[_0xbe14('0x28')]);_0x3ac6d8[_0xbe14('0x4a')]=intUtil['stripTrailingSlash'](_0x3ac6d8[_0xbe14('0x4a')]);if(_0xfd32a3&&_0xfd32a3[_0xbe14('0x4c')]){logger[_0xbe14('0x12')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',_0xbe14('0x4e'));_0x18be56[_0xbe14('0x51')]=util[_0xbe14('0xb')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ac6d8[_0xbe14('0x4a')],_0x18be56[_0xbe14('0x50')],md5(_0x18be56[_0xbe14('0x50')]));}else{_0x18be56[_0xbe14('0x51')]='';}headers[_0xbe14('0x61')]=getAuth(_0x3ac6d8);return getUser(_0x3ac6d8)[_0xbe14('0xd')](function(_0x445302){_0x5a1ea6=_0x445302;logger['info']('The\x20User\x20ID\x20is:',_0x5a1ea6['id']);return getEndUser(_0x3ac6d8,_0x18be56[_0xbe14('0x6a')],_0x18be56[_0xbe14('0x53')]);})[_0xbe14('0xd')](function(_0x2510a0){_0x42b341=_0x2510a0;logger[_0xbe14('0x12')](_0xbe14('0x54'),_0x42b341['id']);return getTicket(_0x3ac6d8,_0x5a1ea6,_0x42b341,_0x442ec4,_0x18be56);})[_0xbe14('0xd')](function(_0x43511e){if(_0x43511e){logger['info']('Ticket\x20created!');logger[_0xbe14('0x12')](_0xbe14('0x55'),_0x43511e['id']);}})[_0xbe14('0x66')](function(_0x57729f){logger[_0xbe14('0x5c')]('['+_0x18be56[_0xbe14('0x68')][_0xbe14('0x69')]()+']',JSON[_0xbe14('0x19')](_0x57729f));});}; \ 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(_0x2f2184,_0x36e177){var _0x3a7c5f=function(_0x1af132){while(--_0x1af132){_0x2f2184['push'](_0x2f2184['shift']());}};_0x3a7c5f(++_0x36e177);}(_0x3e74,0x175));var _0x43e7=function(_0x244092,_0x239ef5){_0x244092=_0x244092-0x0;var _0x2bd994=_0x3e74[_0x244092];return _0x2bd994;};'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 0cf3d0f..be16d73 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 _0xe52b=['systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','internalemailaddress','email','isdisabled',']\x20Agent\x20found\x20','systemuserid','info','userEmail','length','userId','catch','toLowerCase','destcalleridnum','/systemusers(','headers','substring','lastIndexOf','enduserId','outbound','calleridnum','telephone1','GET','contacts?$select=','\x20eq\x20\x27','replace','%2b','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','includes','string','picklist','type','nameField','idField','indexOf','content','incidents','assign','getString','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','Subjects','Descriptions','odata-entityid','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','trigger:browser:url','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact','ticketId','unmanaged','Displaying\x20call\x20in\x20a\x20new\x20tab...','error',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','./util','md5','ioredis','../../../../config/logger','dynamics365','redis','defaults','localhost','socket.io-emitter','modernAuthentication','CloudProvider','data7','tenantId','data2','resolve','data5','POST','clientId','remoteUri','username','password','clientSecret','access_token','toUpperCase',']\x20Wrong\x20credentials!','message','then'];(function(_0x482d82,_0xa261ff){var _0x43f33e=function(_0x46f200){while(--_0x46f200){_0x482d82['push'](_0x482d82['shift']());}};_0x43f33e(++_0xa261ff);}(_0xe52b,0x198));var _0xbe52=function(_0x39d1c2,_0x170148){_0x39d1c2=_0x39d1c2-0x0;var _0x369078=_0xe52b[_0x39d1c2];return _0x369078;};'use strict';var _=require(_0xbe52('0x0'));var rp=require('request-promise');var util=require('util');var intUtil=require(_0xbe52('0x1'));var md5=require(_0xbe52('0x2'));var Redis=require(_0xbe52('0x3'));var logger=require(_0xbe52('0x4'))(_0xbe52('0x5'));var config=require('../../../../config/environment');config[_0xbe52('0x6')]=_[_0xbe52('0x7')](config[_0xbe52('0x6')],{'host':_0xbe52('0x8'),'port':0x18eb});var io=require(_0xbe52('0x9'))(new Redis(config[_0xbe52('0x6')]));function getAuthToken(_0x5cd798,_0x3668e0,_0x359a33){if(_0x5cd798[_0xbe52('0xa')]){_0x5cd798['remoteUri']=_0x5cd798[_0xbe52('0xb')][_0xbe52('0xc')];_0x5cd798[_0xbe52('0xd')]=_0x5cd798['CloudProvider'][_0xbe52('0xe')];return Promise[_0xbe52('0xf')](_0x5cd798[_0xbe52('0xb')][_0xbe52('0x10')]);}var _0x3a1739={'method':_0xbe52('0x11'),'uri':_0x3668e0,'form':{'client_id':_0x5cd798[_0xbe52('0x12')],'resource':_0x5cd798[_0xbe52('0x13')],'username':_0x5cd798[_0xbe52('0x14')],'password':_0x5cd798[_0xbe52('0x15')],'grant_type':_0xbe52('0x15'),'client_secret':_0x5cd798[_0xbe52('0x16')]},'json':!![]};return rp(_0x3a1739)['then'](function(_0xaad97a){return _0xaad97a[_0xbe52('0x17')];})['catch'](function(_0x484780){logger['error']('['+[_0x359a33[_0xbe52('0x18')]()]+_0xbe52('0x19'));return _0x484780[_0xbe52('0x1a')];});}function getUser(_0x116735,_0x52311c,_0xeef5f4,_0x5c8253,_0xc0d869,_0x35db44){return new Promise(function(_0x5ee14a,_0x4d0367){return getAuthToken(_0x52311c,_0x5c8253,_0x35db44)[_0xbe52('0x1b')](function(_0xdc1bb){var _0x45cc48={'method':'GET','uri':_0xc0d869+_0xbe52('0x1c'),'headers':{'Authorization':_0xbe52('0x1d')+_0xdc1bb,'OData-Version':_0xbe52('0x1e')},'json':!![]};return rp(_0x45cc48);})[_0xbe52('0x1b')](function(_0x17787c){var _0x32452a=_0x17787c[_0xbe52('0x1f')];var _0x73de6c=![];var _0x427724=null;if(!_[_0xbe52('0x20')](_0xeef5f4)){if(intUtil[_0xbe52('0x21')](_0xeef5f4['email'])){_0x116735['userEmail']=_0xeef5f4['email'];for(_0x427724=0x0;_0x427724<_0x32452a['length'];_0x427724++){if(_0x32452a[_0x427724][_0xbe52('0x22')]===_0xeef5f4[_0xbe52('0x23')]&&!_0x32452a[_0x427724][_0xbe52('0x24')]){_0x73de6c=!![];logger['info']('['+[_0x35db44[_0xbe52('0x18')]()]+_0xbe52('0x25')+_0x32452a[_0x427724][_0xbe52('0x26')]+'!');_0x116735['userId']=_0x32452a[_0x427724][_0xbe52('0x26')];}}}}if(!_0x73de6c){logger[_0xbe52('0x27')]('['+[_0x35db44['toUpperCase']()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x116735[_0xbe52('0x28')]=_0x52311c[_0xbe52('0x14')];for(_0x427724=0x0;_0x427724<_0x32452a[_0xbe52('0x29')];_0x427724++){if(_0x32452a[_0x427724][_0xbe52('0x22')]===_0x52311c[_0xbe52('0x14')]){_0x116735[_0xbe52('0x2a')]=_0x32452a[_0x427724][_0xbe52('0x26')];}}}_0x5ee14a(_0x116735);})[_0xbe52('0x2b')](function(_0x58738a){_0x4d0367(_0x58738a[_0xbe52('0x1a')]);});});}function createEndUser(_0x5bea81,_0x5e2215,_0x289758,_0x472953,_0x508299,_0x3f310b,_0x54a168){return new Promise(function(_0x33e9b0,_0x40e01a){return getAuthToken(_0x5e2215,_0x289758,_0x3f310b)[_0xbe52('0x1b')](function(_0x594605){var _0x4d57c6=_0x3f310b[_0xbe52('0x2c')]()==='outbound'?_0x508299[_0xbe52('0x2d')]:_0x508299['calleridnum'];var _0x22f3fd={'method':_0xbe52('0x11'),'uri':_0x472953+'contacts','body':{'fullname':_0x4d57c6,'firstname':_0x4d57c6,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0xbe52('0x2e')+_0x5bea81[_0xbe52('0x2a')]+')'},'headers':{'Authorization':_0xbe52('0x1d')+_0x594605,'OData-Version':_0xbe52('0x1e')},'json':!![],'resolveWithFullResponse':!![]};_0x22f3fd['body'][_0x54a168]=_0x4d57c6;return rp(_0x22f3fd);})[_0xbe52('0x1b')](function(_0x96ed77){var _0x648b1a=_0x96ed77[_0xbe52('0x2f')]['odata-entityid'];var _0x398ac0=_0x648b1a[_0xbe52('0x30')](_0x648b1a[_0xbe52('0x31')]('(')+0x1,_0x648b1a[_0xbe52('0x31')](')'));_0x5bea81[_0xbe52('0x32')]=_0x398ac0;_0x33e9b0(_0x5bea81);})[_0xbe52('0x2b')](function(_0x40dccf){_0x40e01a(_0x40dccf[_0xbe52('0x1a')]);});});}function getEndUser(_0x21976c,_0x517abb,_0x228357,_0x196c59,_0x2bb08b,_0x20a792,_0x98627f,_0x21a20d){var _0x33484c=_0x20a792[_0xbe52('0x2c')]()===_0xbe52('0x33')?_0x2bb08b[_0xbe52('0x2d')]:_0x2bb08b[_0xbe52('0x34')];return getAuthToken(_0x517abb,_0x228357,_0x20a792)[_0xbe52('0x1b')](function(_0x251f1b){_0x21a20d=_0x21a20d?_0x21a20d:_0xbe52('0x35');var _0x549670={'method':_0xbe52('0x36'),'uri':_0x196c59+_0xbe52('0x37')+_0x21a20d+'&$filter='+_0x21a20d+_0xbe52('0x38')+_0x33484c[_0xbe52('0x39')]('+',_0xbe52('0x3a'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x251f1b,'If-None-Match':null,'OData-Version':_0xbe52('0x1e')},'json':!![]};return rp(_0x549670);})[_0xbe52('0x1b')](function(_0x2c6f29){var _0x2be20c=![];if(!_0x2c6f29)return _0x2be20c;var _0x2f1a3d=_0x2c6f29['value'];for(var _0xf6379d=0x0;_0xf6379d<_0x2f1a3d[_0xbe52('0x29')];_0xf6379d++){if(_0x2f1a3d[_0xf6379d][_0x21a20d]===_0x33484c){_0x2be20c=!![];_0x21976c['enduserId']=_0x2f1a3d[_0xf6379d][_0xbe52('0x3b')];}}return _0x2be20c;})[_0xbe52('0x1b')](function(_0x199e3c){if(_0x199e3c)return _0x21976c;if(_0x98627f===_0xbe52('0x3c')){logger[_0xbe52('0x27')]('['+[_0x20a792[_0xbe52('0x18')]()]+_0xbe52('0x3d'));return _0x21976c;}return createEndUser(_0x21976c,_0x517abb,_0x228357,_0x196c59,_0x2bb08b,_0x20a792,_0x21a20d)[_0xbe52('0x1b')](function(_0x3e221e){logger[_0xbe52('0x27')]('['+[_0x20a792[_0xbe52('0x18')]()]+_0xbe52('0x3e'),_0x3e221e[_0xbe52('0x32')]);return _0x3e221e;});});}function getCustomFields(_0x3b6d9b,_0x472e06,_0x581ec4){var _0x4fbfbe={};if(_0x3b6d9b['length']>0x0){_['forEach'](_0x3b6d9b,function(_0x41c952){if(_[_0xbe52('0x3f')]([_0xbe52('0x40'),_0xbe52('0x41')],_0x41c952[_0xbe52('0x42')])&&_0x41c952[_0xbe52('0x43')]&&!_0x41c952['customField']){var _0x1e967d=_0x41c952[_0xbe52('0x44')][_0xbe52('0x2c')]();var _0x28e73b=_0x1e967d[_0xbe52('0x30')](0x0,_0x1e967d[_0xbe52('0x45')]('_'));var _0xb4e370=_0x1e967d[_0xbe52('0x30')](_0x1e967d[_0xbe52('0x45')]('_')+0x1);if(_0x28e73b===_0x581ec4){_0x4fbfbe[_0xb4e370]=_0x41c952[_0xbe52('0x46')];}}});}return _0x4fbfbe;}function getTicket(_0x592d15,_0x1767b8,_0x4ae43a,_0xb54f5d,_0x4e70a6,_0x31e131,_0x8cdfbd){return new Promise(function(_0x4291fd,_0x2a6b69){var _0x5e7ef1;return getAuthToken(_0x1767b8,_0x4ae43a,_0x8cdfbd)[_0xbe52('0x1b')](function(_0x451b61){if(_0x31e131['ticketType']==='incident'){_0x5e7ef1={'method':_0xbe52('0x11'),'uri':_0xb54f5d+_0xbe52('0x47'),'body':Object[_0xbe52('0x48')]({},{'title':intUtil['getString'](_0x31e131['Subjects'],_0x4e70a6,'\x20'),'description':intUtil[_0xbe52('0x49')](_0x31e131['Descriptions'],_0x4e70a6,'\x0a'),'customerid_contact@odata.bind':_0x592d15['enduserId']?_0xbe52('0x4a')+_0x592d15['enduserId']+')':undefined,'ownerid@odata.bind':_0xbe52('0x2e')+_0x592d15[_0xbe52('0x2a')]+')','caseorigincode':'1'},getCustomFields(_0x31e131[_0xbe52('0x4b')],_0x4e70a6,_0x31e131[_0xbe52('0x4c')])),'headers':{'Authorization':_0xbe52('0x1d')+_0x451b61,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x31e131[_0xbe52('0x4c')]===_0xbe52('0x4d')){var _0x496fc4=_0x592d15[_0xbe52('0x32')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x592d15[_0xbe52('0x2a')]+')','participationtypemask':_0x592d15['callDirection']==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0xbe52('0x4a')+_0x592d15[_0xbe52('0x32')]+')','participationtypemask':_0x592d15[_0xbe52('0x4e')]===_0xbe52('0x4f')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x592d15['userId']+')','participationtypemask':_0x592d15['callDirection']===_0xbe52('0x4f')?0x2:0x1}];_0x5e7ef1={'method':_0xbe52('0x11'),'uri':_0xb54f5d+_0xbe52('0x50'),'body':Object[_0xbe52('0x48')]({},{'subject':intUtil[_0xbe52('0x49')](_0x31e131[_0xbe52('0x51')],_0x4e70a6,'\x20'),'phonenumber':String(_0x4e70a6[_0xbe52('0x34')]),'description':intUtil[_0xbe52('0x49')](_0x31e131[_0xbe52('0x52')],_0x4e70a6,'\x0a'),'regardingobjectid_contact@odata.bind':_0x592d15[_0xbe52('0x32')]?_0xbe52('0x4a')+_0x592d15[_0xbe52('0x32')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x592d15['userId']+')','directioncode':_0x592d15[_0xbe52('0x4e')]===_0xbe52('0x4f')?![]:!![],'phonecall_activity_parties':_0x496fc4},getCustomFields(_0x31e131[_0xbe52('0x4b')],_0x4e70a6,_0x31e131[_0xbe52('0x4c')])),'headers':{'Authorization':_0xbe52('0x1d')+_0x451b61,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x5e7ef1);})[_0xbe52('0x1b')](function(_0x5199f9){var _0x469882=_0x5199f9[_0xbe52('0x2f')][_0xbe52('0x53')];var _0x4a0592=_0x469882[_0xbe52('0x30')](_0x469882[_0xbe52('0x31')]('(')+0x1,_0x469882[_0xbe52('0x31')](')'));_0x592d15['ticketId']=_0x4a0592;_0x4291fd(_0x592d15);})[_0xbe52('0x2b')](function(_0x2bd149){_0x2a6b69(_0x2bd149[_0xbe52('0x1a')]);});});}function emit(_0x31c191,_0x2cc71f,_0x5b1c27,_0x340ee1){var _0x47daae={'uri':util['format'](_0xbe52('0x54'),_0x31c191,_0x5b1c27,_0x340ee1)};io['to'](util[_0xbe52('0x55')](_0xbe52('0x56'),_0x2cc71f))['emit'](_0xbe52('0x57'),_0x47daae);}exports['cs']=function(_0x38a1d5,_0x4241cb,_0x520dad,_0x269e92,_0x4e6ade,_0x513116,_0x27d747,_0x1f1855){var _0x5757f5={};_0x513116[_0xbe52('0x13')]=_0x513116['modernAuthentication']?intUtil[_0xbe52('0x58')](_0x513116[_0xbe52('0xb')][_0xbe52('0xc')]):intUtil[_0xbe52('0x58')](_0x513116[_0xbe52('0x13')]);_0x513116[_0xbe52('0x59')]=intUtil[_0xbe52('0x58')](_0x513116[_0xbe52('0x59')]);_0x5757f5[_0xbe52('0x4e')]=_0x1f1855===_0xbe52('0x4f')||_0x1f1855==='unmanaged'?_0xbe52('0x4f'):_0xbe52('0x33');var _0x3d6ab1=_0x513116[_0xbe52('0xa')]?util['format']('%s/api/data/v9.0/',_0x513116[_0xbe52('0xb')][_0xbe52('0xc')]):util['format'](_0xbe52('0x5a'),_0x513116[_0xbe52('0x13')]);var _0x2ff50d=util[_0xbe52('0x55')]('https://login.microsoftonline.com/%s/oauth2/token',_0x513116[_0xbe52('0xd')]);var _0x5a28a8=util[_0xbe52('0x55')](_0xbe52('0x5b'),_0x513116[_0xbe52('0x59')],_0x4241cb['uniqueid'],md5(_0x4241cb[_0xbe52('0x5c')]));if(_0x4e6ade&&_0x4e6ade[_0xbe52('0x5d')]){logger[_0xbe52('0x27')](_0xbe52('0x5e'),_0xbe52('0x5f'));_0x4241cb[_0xbe52('0x60')]=_0x5a28a8;}else if(_0x27d747&&_0x27d747['recordingFormat']&&_0x27d747[_0xbe52('0x61')]!==_0xbe52('0x62')){logger['info'](_0xbe52('0x63'),_0xbe52('0x5f'));_0x4241cb[_0xbe52('0x60')]=_0x5a28a8;}else{_0x4241cb[_0xbe52('0x60')]='';}return getUser(_0x5757f5,_0x513116,_0x269e92,_0x2ff50d,_0x3d6ab1,_0x1f1855)[_0xbe52('0x1b')](function(_0x538dc8){logger[_0xbe52('0x27')]('['+_0x1f1855['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x538dc8[_0xbe52('0x2a')]);logger['info']('['+_0x1f1855[_0xbe52('0x18')]()+_0xbe52('0x64'),_0x538dc8[_0xbe52('0x28')]);return getEndUser(_0x538dc8,_0x513116,_0x2ff50d,_0x3d6ab1,_0x4241cb,_0x1f1855,_0x520dad[_0xbe52('0x65')],_0x520dad[_0xbe52('0x66')]);})[_0xbe52('0x1b')](function(_0xbe737c){logger['info']('['+_0x1f1855[_0xbe52('0x18')]()+']\x20The\x20Enduser\x20ID\x20is:',_0xbe737c[_0xbe52('0x32')]);logger[_0xbe52('0x27')]('['+_0x1f1855[_0xbe52('0x18')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x4241cb[_0xbe52('0x34')]);return getTicket(_0xbe737c,_0x513116,_0x2ff50d,_0x3d6ab1,_0x4241cb,_0x520dad,_0x1f1855);})[_0xbe52('0x1b')](function(_0x4be9d6){logger[_0xbe52('0x27')](util[_0xbe52('0x55')]('['+_0x1f1855[_0xbe52('0x18')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x520dad[_0xbe52('0x4c')],_0x4be9d6[_0xbe52('0x67')]));logger[_0xbe52('0x27')](util[_0xbe52('0x55')]('['+_0x1f1855[_0xbe52('0x18')]()+']\x20Call\x20direction:\x20%s',_0x1f1855));if(_0x1f1855!==_0xbe52('0x68')&&_0x520dad['openNewTab']){logger[_0xbe52('0x27')]('['+_0x1f1855[_0xbe52('0x18')]()+']',_0xbe52('0x69'));emit(_0x513116[_0xbe52('0x13')],_0x269e92['name'],_0x520dad[_0xbe52('0x4c')],_0x4be9d6[_0xbe52('0x67')]);}})['catch'](function(_0x4d842a){logger[_0xbe52('0x6a')]('['+_0x1f1855['toUpperCase']()+_0xbe52('0x6b'),_0x4d842a[_0xbe52('0x1a')]);console['error'](_0xbe52('0x6c'),_0x4d842a);});}; \ No newline at end of file +var _0x71d7=['md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','socket.io-emitter','modernAuthentication','remoteUri','CloudProvider','tenantId','data2','data5','POST','clientId','password','clientSecret','then','access_token','catch','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','isdisabled','info',']\x20Agent\x20found\x20','systemuserid',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','username','userId','toLowerCase','destcalleridnum','calleridnum','contacts','/systemusers(','body','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','telephone1','replace','%2b','value','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','includes','string','picklist','customField','idField','indexOf','content','incident','getString','Subjects','Descriptions','Fields','ticketType','phonecall','queue','/contacts(','callDirection','phonecalls','assign','ticketId','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','format','user:%s','emit','trigger:browser:url','data7','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20Call\x20direction:\x20%s','openNewTab','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','error','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','util','./util'];(function(_0x12a201,_0x30aaba){var _0x52a4d2=function(_0x5ca28d){while(--_0x5ca28d){_0x12a201['push'](_0x12a201['shift']());}};_0x52a4d2(++_0x30aaba);}(_0x71d7,0x1c0));var _0x771d=function(_0x28f75a,_0x477ec3){_0x28f75a=_0x28f75a-0x0;var _0x186ce0=_0x71d7[_0x28f75a];return _0x186ce0;};'use strict';var _=require(_0x771d('0x0'));var rp=require(_0x771d('0x1'));var util=require(_0x771d('0x2'));var intUtil=require(_0x771d('0x3'));var md5=require(_0x771d('0x4'));var Redis=require(_0x771d('0x5'));var logger=require(_0x771d('0x6'))(_0x771d('0x7'));var config=require(_0x771d('0x8'));config[_0x771d('0x9')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x771d('0xa'))(new Redis(config[_0x771d('0x9')]));function getAuthToken(_0x3ad783,_0x3675d9,_0x12ae78){if(_0x3ad783[_0x771d('0xb')]){_0x3ad783[_0x771d('0xc')]=_0x3ad783[_0x771d('0xd')]['data7'];_0x3ad783[_0x771d('0xe')]=_0x3ad783[_0x771d('0xd')][_0x771d('0xf')];return Promise['resolve'](_0x3ad783['CloudProvider'][_0x771d('0x10')]);}var _0xecaab5={'method':_0x771d('0x11'),'uri':_0x3675d9,'form':{'client_id':_0x3ad783[_0x771d('0x12')],'resource':_0x3ad783[_0x771d('0xc')],'username':_0x3ad783['username'],'password':_0x3ad783[_0x771d('0x13')],'grant_type':'password','client_secret':_0x3ad783[_0x771d('0x14')]},'json':!![]};return rp(_0xecaab5)[_0x771d('0x15')](function(_0x144919){return _0x144919[_0x771d('0x16')];})[_0x771d('0x17')](function(_0x22747c){logger['error']('['+[_0x12ae78[_0x771d('0x18')]()]+_0x771d('0x19'));return _0x22747c[_0x771d('0x1a')];});}function getUser(_0x5be31,_0x1e55cc,_0x50d8dd,_0x23abef,_0x55f936,_0x2f1b30){return new Promise(function(_0x51d79f,_0x11b641){return getAuthToken(_0x1e55cc,_0x23abef,_0x2f1b30)[_0x771d('0x15')](function(_0x242ebd){var _0x4f8e51={'method':_0x771d('0x1b'),'uri':_0x55f936+_0x771d('0x1c'),'headers':{'Authorization':_0x771d('0x1d')+_0x242ebd,'OData-Version':_0x771d('0x1e')},'json':!![]};return rp(_0x4f8e51);})[_0x771d('0x15')](function(_0x2a68b3){var _0x20d7ce=_0x2a68b3['value'];var _0x49d262=![];var _0x4193a7=null;if(!_[_0x771d('0x1f')](_0x50d8dd)){if(intUtil[_0x771d('0x20')](_0x50d8dd[_0x771d('0x21')])){_0x5be31[_0x771d('0x22')]=_0x50d8dd[_0x771d('0x21')];for(_0x4193a7=0x0;_0x4193a7<_0x20d7ce[_0x771d('0x23')];_0x4193a7++){if(_0x20d7ce[_0x4193a7][_0x771d('0x24')]===_0x50d8dd['email']&&!_0x20d7ce[_0x4193a7][_0x771d('0x25')]){_0x49d262=!![];logger[_0x771d('0x26')]('['+[_0x2f1b30['toUpperCase']()]+_0x771d('0x27')+_0x20d7ce[_0x4193a7][_0x771d('0x28')]+'!');_0x5be31['userId']=_0x20d7ce[_0x4193a7][_0x771d('0x28')];}}}}if(!_0x49d262){logger['info']('['+[_0x2f1b30[_0x771d('0x18')]()]+_0x771d('0x29'));_0x5be31[_0x771d('0x22')]=_0x1e55cc[_0x771d('0x2a')];for(_0x4193a7=0x0;_0x4193a7<_0x20d7ce[_0x771d('0x23')];_0x4193a7++){if(_0x20d7ce[_0x4193a7][_0x771d('0x24')]===_0x1e55cc['username']){_0x5be31[_0x771d('0x2b')]=_0x20d7ce[_0x4193a7]['systemuserid'];}}}_0x51d79f(_0x5be31);})['catch'](function(_0x5bf766){_0x11b641(_0x5bf766[_0x771d('0x1a')]);});});}function createEndUser(_0x550b41,_0x27ba7b,_0x571aee,_0x462362,_0x4ed6f4,_0x3a9491,_0x467930){return new Promise(function(_0x275de5,_0xfbb5eb){return getAuthToken(_0x27ba7b,_0x571aee,_0x3a9491)[_0x771d('0x15')](function(_0x2a6d2b){var _0x2848e8=_0x3a9491[_0x771d('0x2c')]()==='outbound'?_0x4ed6f4[_0x771d('0x2d')]:_0x4ed6f4[_0x771d('0x2e')];var _0x252e39={'method':_0x771d('0x11'),'uri':_0x462362+_0x771d('0x2f'),'body':{'fullname':_0x2848e8,'firstname':_0x2848e8,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x771d('0x30')+_0x550b41[_0x771d('0x2b')]+')'},'headers':{'Authorization':_0x771d('0x1d')+_0x2a6d2b,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x252e39[_0x771d('0x31')][_0x467930]=_0x2848e8;return rp(_0x252e39);})['then'](function(_0x305a09){var _0x325edc=_0x305a09[_0x771d('0x32')][_0x771d('0x33')];var _0x1f9151=_0x325edc[_0x771d('0x34')](_0x325edc[_0x771d('0x35')]('(')+0x1,_0x325edc[_0x771d('0x35')](')'));_0x550b41[_0x771d('0x36')]=_0x1f9151;_0x275de5(_0x550b41);})[_0x771d('0x17')](function(_0x298273){_0xfbb5eb(_0x298273['message']);});});}function getEndUser(_0x33a412,_0x4343e6,_0xc9d259,_0x271b02,_0x7bac76,_0x351782,_0x123dda,_0x591d0e){var _0x265fe9=_0x351782['toLowerCase']()===_0x771d('0x37')?_0x7bac76['destcalleridnum']:_0x7bac76[_0x771d('0x2e')];return getAuthToken(_0x4343e6,_0xc9d259,_0x351782)[_0x771d('0x15')](function(_0x538e7e){_0x591d0e=_0x591d0e?_0x591d0e:_0x771d('0x38');var _0x192a9f={'method':_0x771d('0x1b'),'uri':_0x271b02+'contacts?$select='+_0x591d0e+'&$filter='+_0x591d0e+'\x20eq\x20\x27'+_0x265fe9[_0x771d('0x39')]('+',_0x771d('0x3a'))+'\x27','headers':{'Authorization':'Bearer\x20'+_0x538e7e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x192a9f);})['then'](function(_0x4f0b4c){var _0x52d27b=![];if(!_0x4f0b4c)return _0x52d27b;var _0x180361=_0x4f0b4c[_0x771d('0x3b')];for(var _0x1b13a0=0x0;_0x1b13a0<_0x180361[_0x771d('0x23')];_0x1b13a0++){if(_0x180361[_0x1b13a0][_0x591d0e]===_0x265fe9){_0x52d27b=!![];_0x33a412[_0x771d('0x36')]=_0x180361[_0x1b13a0]['contactid'];}}return _0x52d27b;})['then'](function(_0x4ed8c9){if(_0x4ed8c9)return _0x33a412;if(_0x123dda===_0x771d('0x3c')){logger[_0x771d('0x26')]('['+[_0x351782[_0x771d('0x18')]()]+_0x771d('0x3d'));return _0x33a412;}return createEndUser(_0x33a412,_0x4343e6,_0xc9d259,_0x271b02,_0x7bac76,_0x351782,_0x591d0e)[_0x771d('0x15')](function(_0x2d3394){logger[_0x771d('0x26')]('['+[_0x351782[_0x771d('0x18')]()]+']\x20Enduser\x20created!',_0x2d3394[_0x771d('0x36')]);return _0x2d3394;});});}function getCustomFields(_0x5276de,_0x30a1e6,_0x2c77e3){var _0x3dbf95={};if(_0x5276de[_0x771d('0x23')]>0x0){_['forEach'](_0x5276de,function(_0xb134aa){if(_[_0x771d('0x3e')]([_0x771d('0x3f'),_0x771d('0x40')],_0xb134aa['type'])&&_0xb134aa['nameField']&&!_0xb134aa[_0x771d('0x41')]){var _0x392635=_0xb134aa[_0x771d('0x42')][_0x771d('0x2c')]();var _0x192971=_0x392635[_0x771d('0x34')](0x0,_0x392635[_0x771d('0x43')]('_'));var _0x2249ea=_0x392635[_0x771d('0x34')](_0x392635[_0x771d('0x43')]('_')+0x1);if(_0x192971===_0x2c77e3){_0x3dbf95[_0x2249ea]=_0xb134aa[_0x771d('0x44')];}}});}return _0x3dbf95;}function getTicket(_0x310074,_0x54d8ab,_0x42b502,_0x4b8aed,_0xde842d,_0x41421b,_0x596d89){return new Promise(function(_0x1b0d49,_0x3218e2){var _0x1d488a;return getAuthToken(_0x54d8ab,_0x42b502,_0x596d89)[_0x771d('0x15')](function(_0x4ec2d8){if(_0x41421b['ticketType']===_0x771d('0x45')){_0x1d488a={'method':_0x771d('0x11'),'uri':_0x4b8aed+'incidents','body':Object['assign']({},{'title':intUtil[_0x771d('0x46')](_0x41421b[_0x771d('0x47')],_0xde842d,'\x20'),'description':intUtil[_0x771d('0x46')](_0x41421b[_0x771d('0x48')],_0xde842d,'\x0a'),'customerid_contact@odata.bind':_0x310074[_0x771d('0x36')]?'/contacts('+_0x310074[_0x771d('0x36')]+')':undefined,'ownerid@odata.bind':_0x771d('0x30')+_0x310074[_0x771d('0x2b')]+')','caseorigincode':'1'},getCustomFields(_0x41421b[_0x771d('0x49')],_0xde842d,_0x41421b[_0x771d('0x4a')])),'headers':{'Authorization':_0x771d('0x1d')+_0x4ec2d8,'OData-Version':_0x771d('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x41421b[_0x771d('0x4a')]===_0x771d('0x4b')){var _0x25f441=_0x310074[_0x771d('0x36')]?[{'partyid_systemuser@odata.bind':_0x771d('0x30')+_0x310074[_0x771d('0x2b')]+')','participationtypemask':_0x310074['callDirection']===_0x771d('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0x771d('0x4d')+_0x310074[_0x771d('0x36')]+')','participationtypemask':_0x310074[_0x771d('0x4e')]===_0x771d('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x310074['userId']+')','participationtypemask':_0x310074[_0x771d('0x4e')]==='queue'?0x2:0x1}];_0x1d488a={'method':_0x771d('0x11'),'uri':_0x4b8aed+_0x771d('0x4f'),'body':Object[_0x771d('0x50')]({},{'subject':intUtil[_0x771d('0x46')](_0x41421b[_0x771d('0x47')],_0xde842d,'\x20'),'phonenumber':String(_0xde842d[_0x771d('0x2e')]),'description':intUtil[_0x771d('0x46')](_0x41421b['Descriptions'],_0xde842d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x310074[_0x771d('0x36')]?_0x771d('0x4d')+_0x310074[_0x771d('0x36')]+')':undefined,'ownerid@odata.bind':_0x771d('0x30')+_0x310074[_0x771d('0x2b')]+')','directioncode':_0x310074['callDirection']===_0x771d('0x4c')?![]:!![],'phonecall_activity_parties':_0x25f441},getCustomFields(_0x41421b[_0x771d('0x49')],_0xde842d,_0x41421b[_0x771d('0x4a')])),'headers':{'Authorization':'Bearer\x20'+_0x4ec2d8,'OData-Version':_0x771d('0x1e')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1d488a);})[_0x771d('0x15')](function(_0x1f0908){var _0x571374=_0x1f0908['headers'][_0x771d('0x33')];var _0x2a7bb3=_0x571374[_0x771d('0x34')](_0x571374['lastIndexOf']('(')+0x1,_0x571374[_0x771d('0x35')](')'));_0x310074[_0x771d('0x51')]=_0x2a7bb3;_0x1b0d49(_0x310074);})['catch'](function(_0x5b3da1){_0x3218e2(_0x5b3da1[_0x771d('0x1a')]);});});}function emit(_0x473b64,_0x1f5893,_0x595555,_0x3153b1){var _0x5d7d13={'uri':util['format'](_0x771d('0x52'),_0x473b64,_0x595555,_0x3153b1)};io['to'](util[_0x771d('0x53')](_0x771d('0x54'),_0x1f5893))[_0x771d('0x55')](_0x771d('0x56'),_0x5d7d13);}exports['cs']=function(_0x3aa9ad,_0x21ed15,_0x3f9981,_0x1513f8,_0x41270c,_0x2f2bbc,_0x1833cd,_0xb050f2){var _0x51af97={};_0x2f2bbc[_0x771d('0xc')]=_0x2f2bbc['modernAuthentication']?intUtil['stripTrailingSlash'](_0x2f2bbc[_0x771d('0xd')][_0x771d('0x57')]):intUtil[_0x771d('0x58')](_0x2f2bbc[_0x771d('0xc')]);_0x2f2bbc[_0x771d('0x59')]=intUtil['stripTrailingSlash'](_0x2f2bbc[_0x771d('0x59')]);_0x51af97[_0x771d('0x4e')]=_0xb050f2===_0x771d('0x4c')||_0xb050f2===_0x771d('0x5a')?_0x771d('0x4c'):_0x771d('0x37');var _0x2e06d3=_0x2f2bbc[_0x771d('0xb')]?util[_0x771d('0x53')]('%s/api/data/v9.0/',_0x2f2bbc[_0x771d('0xd')]['data7']):util[_0x771d('0x53')](_0x771d('0x5b'),_0x2f2bbc[_0x771d('0xc')]);var _0x3ef8df=util[_0x771d('0x53')](_0x771d('0x5c'),_0x2f2bbc['tenantId']);var _0x4fe581=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2f2bbc[_0x771d('0x59')],_0x21ed15[_0x771d('0x5d')],md5(_0x21ed15['uniqueid']));if(_0x41270c&&_0x41270c[_0x771d('0x5e')]){logger[_0x771d('0x26')](_0x771d('0x5f'),'Recording\x20is\x20enabled!');_0x21ed15['recordingURL']=_0x4fe581;}else if(_0x1833cd&&_0x1833cd['recordingFormat']&&_0x1833cd[_0x771d('0x60')]!==_0x771d('0x61')){logger[_0x771d('0x26')](_0x771d('0x62'),_0x771d('0x63'));_0x21ed15[_0x771d('0x64')]=_0x4fe581;}else{_0x21ed15[_0x771d('0x64')]='';}return getUser(_0x51af97,_0x2f2bbc,_0x1513f8,_0x3ef8df,_0x2e06d3,_0xb050f2)[_0x771d('0x15')](function(_0x2a0b9c){logger['info']('['+_0xb050f2['toUpperCase']()+_0x771d('0x65'),_0x2a0b9c[_0x771d('0x2b')]);logger[_0x771d('0x26')]('['+_0xb050f2[_0x771d('0x18')]()+_0x771d('0x66'),_0x2a0b9c[_0x771d('0x22')]);return getEndUser(_0x2a0b9c,_0x2f2bbc,_0x3ef8df,_0x2e06d3,_0x21ed15,_0xb050f2,_0x3f9981[_0x771d('0x67')],_0x3f9981[_0x771d('0x68')]);})['then'](function(_0x573dbd){logger[_0x771d('0x26')]('['+_0xb050f2[_0x771d('0x18')]()+_0x771d('0x69'),_0x573dbd[_0x771d('0x36')]);logger['info']('['+_0xb050f2['toUpperCase']()+_0x771d('0x6a'),_0x21ed15[_0x771d('0x2e')]);return getTicket(_0x573dbd,_0x2f2bbc,_0x3ef8df,_0x2e06d3,_0x21ed15,_0x3f9981,_0xb050f2);})[_0x771d('0x15')](function(_0x3c55e6){logger['info'](util[_0x771d('0x53')]('['+_0xb050f2[_0x771d('0x18')]()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x3f9981[_0x771d('0x4a')],_0x3c55e6['ticketId']));logger[_0x771d('0x26')](util['format']('['+_0xb050f2[_0x771d('0x18')]()+_0x771d('0x6b'),_0xb050f2));if(_0xb050f2!==_0x771d('0x5a')&&_0x3f9981[_0x771d('0x6c')]){logger['info']('['+_0xb050f2['toUpperCase']()+']',_0x771d('0x6d'));emit(_0x2f2bbc[_0x771d('0xc')],_0x1513f8['name'],_0x3f9981[_0x771d('0x4a')],_0x3c55e6[_0x771d('0x51')]);}})[_0x771d('0x17')](function(_0x235084){logger['error']('['+_0xb050f2[_0x771d('0x18')]()+_0x771d('0x6e'),_0x235084[_0x771d('0x1a')]);console[_0x771d('0x6f')](_0x771d('0x70'),_0x235084);});}; \ 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 68f0e05..f4ec166 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 _0xedbc=['info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','getString','Subjects','Descriptions','
','Tags','name','custom_fields','mapValues','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Searching\x20enduser\x20with\x20phone','Enduser\x20found!','Enduser\x20created.','toString','base64','debug','[HTTP]','GET','map','forEach','includes','string','type','customField','nameField','toLowerCase','picklist','variable','variableName','idField','push','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','uniqueid','The\x20User\x20ID\x20is:','calleridnum','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','email','destcalleridname','The\x20Enduser\x20ID\x20is:','stringify','unmanaged','lastevent','toUpperCase','Authorization','lodash','request-promise','md5','util','ioredis','../../../../config/environment','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit'];(function(_0x1da778,_0x39d34c){var _0x87ed15=function(_0xbb966f){while(--_0xbb966f){_0x1da778['push'](_0x1da778['shift']());}};_0x87ed15(++_0x39d34c);}(_0xedbc,0xad));var _0xcedb=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xedbc[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xcedb('0x0'));var rp=require(_0xcedb('0x1'));var md5=require(_0xcedb('0x2'));var util=require(_0xcedb('0x3'));var Redis=require(_0xcedb('0x4'));var intUtil=require('./util');var config=require(_0xcedb('0x5'));var logger=require('../../../../config/logger')(_0xcedb('0x6'));config[_0xcedb('0x7')]=_[_0xcedb('0x8')](config[_0xcedb('0x7')],{'host':_0xcedb('0x9'),'port':0x18eb});var io=require(_0xcedb('0xa'))(new Redis(config[_0xcedb('0x7')]));var headers={'Content-Type':_0xcedb('0xb'),'Accept':_0xcedb('0xb')};function emit(_0x4bd1f0,_0x405cc6,_0x218e52){io['to'](_0x4bd1f0)[_0xcedb('0xc')](_0x405cc6,_0x218e52);}function getTicket(_0x45f5f8,_0x591ede,_0x3e86a9,_0x206da5,_0x126f61){logger[_0xcedb('0xd')](_0xcedb('0xe'));var _0x437215=_[_0xcedb('0xf')]({'responder_id':_0x591ede['id'],'requester_id':_0x3e86a9['id'],'name':util[_0xcedb('0x10')](_0xcedb('0x11'),_0x126f61[_0xcedb('0x12')]),'phone':_0x126f61['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xcedb('0x13')](_0x206da5[_0xcedb('0x14')],_0x126f61,'\x20'),'description':intUtil['getString'](_0x206da5[_0xcedb('0x15')],_0x126f61,_0xcedb('0x16')),'tags':getTags(_0x206da5[_0xcedb('0x17')],_0xcedb('0x18'))},getCustomFields(_0x206da5['Fields'],_0x126f61));_0x437215[_0xcedb('0x19')]=_[_0xcedb('0x1a')](_[_0xcedb('0x1b')](_0x437215[_0xcedb('0x19')],'id'),_0xcedb('0x1c'));return request({'uri':util['format'](_0xcedb('0x1d'),_0x45f5f8[_0xcedb('0x1e')]),'method':_0xcedb('0x1f'),'body':_0x437215})[_0xcedb('0x20')](function(_0x235d67){logger['info'](_0xcedb('0x21'));return _0x235d67;});}function getUser(_0x5f4c97,_0x7af3aa){if(intUtil[_0xcedb('0x22')](_0x7af3aa)){return request({'uri':util['format'](_0xcedb('0x23'),_0x5f4c97[_0xcedb('0x1e')]),'qs':{'email':_0x7af3aa}})['then'](function(_0x310b87){if(_0x310b87[_0xcedb('0x24')]){logger['info'](_0xcedb('0x25'));return _['find'](_0x310b87,function(_0x32f6fd){return _0x32f6fd[_0xcedb('0x26')]['email']===_0x7af3aa;});}else{logger[_0xcedb('0xd')](_0xcedb('0x27'));return request({'uri':util[_0xcedb('0x10')]('%s/api/v2/agents/me',_0x5f4c97[_0xcedb('0x1e')])})[_0xcedb('0x20')](function(_0x69dbf0){logger['info'](_0xcedb('0x28'));return _0x69dbf0;});}});}else{logger[_0xcedb('0xd')](_0xcedb('0x29'));return request({'uri':util[_0xcedb('0x10')](_0xcedb('0x2a'),_0x5f4c97['remoteUri'])})[_0xcedb('0x20')](function(_0x276569){logger['info'](_0xcedb('0x28'));return _0x276569;});}}function getEndUser(_0x456632,_0x3d3f54,_0x102779){logger[_0xcedb('0xd')](_0xcedb('0x2b'),_0x102779);return request({'uri':util[_0xcedb('0x10')]('%s/api/v2/contacts',_0x456632[_0xcedb('0x1e')]),'qs':{'phone':_0x102779}})['then'](function(_0x4d739a){if(_0x4d739a[_0xcedb('0x24')]){logger[_0xcedb('0xd')](_0xcedb('0x2c'));return _['find'](_0x4d739a,{'phone':_0x102779});}else{logger[_0xcedb('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format']('%s/api/v2/contacts',_0x456632['remoteUri']),'method':_0xcedb('0x1f'),'body':{'name':_0x3d3f54,'phone':_0x102779}})[_0xcedb('0x20')](function(_0x171cf0){logger['info'](_0xcedb('0x2d'));return _0x171cf0;});}});}function getAuth(_0x115749){return util[_0xcedb('0x10')]('Basic\x20%s',new Buffer(_0x115749['apiKey']+':X')[_0xcedb('0x2e')](_0xcedb('0x2f')));}function request(_0x3d4124){logger[_0xcedb('0x30')](_0xcedb('0x31'),JSON['stringify'](_0x3d4124));return rp(_['defaults'](_0x3d4124,{'method':_0xcedb('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x2d460d,_0xa73e95){var _0x365a53=[];if(_0x2d460d&&_0x2d460d[_0xcedb('0x24')]>0x0){_0x365a53=_[_0xcedb('0x33')](_0x2d460d,_0xa73e95);}return _0x365a53;}function getCustomFields(_0x32d430,_0x10d9ee){var _0x9e815b=[];var _0x139c1f={'custom_fields':[]};if(_0x32d430[_0xcedb('0x24')]>0x0){_[_0xcedb('0x34')](_0x32d430,function(_0xc3ff20){if(_[_0xcedb('0x35')]([_0xcedb('0x36'),'picklist'],_0xc3ff20[_0xcedb('0x37')])&&_0xc3ff20['nameField']&&!_0xc3ff20[_0xcedb('0x38')]){_0x139c1f[_0xc3ff20[_0xcedb('0x39')][_0xcedb('0x3a')]()]=_0xc3ff20['content']['toString']();}else if(_[_0xcedb('0x35')]([_0xcedb('0x36'),_0xcedb('0x3b')],_0xc3ff20[_0xcedb('0x37')])&&_0xc3ff20['idField']&&_0xc3ff20[_0xcedb('0x38')]){_0x139c1f[_0xcedb('0x19')]['push']({'id':_0xc3ff20['idField'],'value':_0xc3ff20['content'][_0xcedb('0x2e')]()});}else if(_0xc3ff20['type']===_0xcedb('0x3c')&&_0xc3ff20[_0xcedb('0x3d')]&&_0xc3ff20[_0xcedb('0x3e')]&&_0xc3ff20['customField']){_0x10d9ee[_0xc3ff20[_0xcedb('0x3d')]]&&_0x139c1f[_0xcedb('0x19')][_0xcedb('0x3f')]({'id':_0xc3ff20[_0xcedb('0x3e')],'value':_0x10d9ee[_0xc3ff20[_0xcedb('0x3d')]][_0xcedb('0x2e')]()});}else if(_0xc3ff20[_0xcedb('0x37')]===_0xcedb('0x40')&&_0xc3ff20[_0xcedb('0x41')]&&_0xc3ff20[_0xcedb('0x41')][_0xcedb('0x18')]&&_0xc3ff20['idField']&&_0xc3ff20[_0xcedb('0x38')]){_0x10d9ee[_0xc3ff20[_0xcedb('0x41')]['name'][_0xcedb('0x3a')]()]&&_0x139c1f[_0xcedb('0x19')]['push']({'id':_0xc3ff20['idField'],'value':_0x10d9ee[_0xc3ff20[_0xcedb('0x41')][_0xcedb('0x18')][_0xcedb('0x3a')]()][_0xcedb('0x2e')]()});}});}return _0x139c1f;}exports['queue']=function(_0x231671,_0x209628,_0x582ee3,_0x422c68,_0x3fc4e8,_0x4eb49d){var _0x476bef,_0x200d7c;_0x4eb49d['remoteUri']=intUtil[_0xcedb('0x42')](_0x4eb49d['remoteUri']);_0x4eb49d[_0xcedb('0x43')]=intUtil[_0xcedb('0x42')](_0x4eb49d['serverUrl']);if(_0x3fc4e8&&_0x3fc4e8[_0xcedb('0x44')]){logger['info'](_0xcedb('0x45'),'Recording\x20is\x20enabled!');_0x209628[_0xcedb('0x46')]=util[_0xcedb('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4eb49d[_0xcedb('0x43')],_0x209628[_0xcedb('0x47')],md5(_0x209628[_0xcedb('0x47')]));}else{_0x209628[_0xcedb('0x46')]='';}headers['Authorization']=getAuth(_0x4eb49d);return getUser(_0x4eb49d,_0x422c68['email'])[_0xcedb('0x20')](function(_0x3bb0e){_0x476bef=_0x3bb0e;logger['info'](_0xcedb('0x48'),_0x476bef['id']);return getEndUser(_0x4eb49d,_0x209628[_0xcedb('0x12')],_0x209628[_0xcedb('0x49')]);})[_0xcedb('0x20')](function(_0x2180b0){_0x200d7c=_0x2180b0;logger[_0xcedb('0xd')]('The\x20Enduser\x20ID\x20is:',_0x200d7c['id']);return getTicket(_0x4eb49d,_0x476bef,_0x200d7c,_0x582ee3,_0x209628);})[_0xcedb('0x20')](function(_0x42509d){if(_0x42509d&&_0x42509d['id']){logger[_0xcedb('0xd')]('Ticket\x20created!');logger[_0xcedb('0xd')](_0xcedb('0x4a'),_0x42509d['id']);logger[_0xcedb('0xd')](_0xcedb('0x45'),_0xcedb('0x4b'));emit(util[_0xcedb('0x10')](_0xcedb('0x4c'),_0x422c68[_0xcedb('0x18')]),_0xcedb('0x4d'),{'uri':util[_0xcedb('0x10')](_0xcedb('0x4e'),_0x4eb49d['remoteUri'],_0x42509d['id'])});}})[_0xcedb('0x4f')](function(_0x133a35){logger[_0xcedb('0x50')](_0xcedb('0x45'),JSON['stringify'](_0x133a35));});};exports['outbound']=function(_0x3f83fb,_0x5f0973,_0x1bc019,_0x5f4d81,_0xa38c24,_0x5ad3cf,_0x49a004){var _0x304913,_0x37bf4f;_0x5ad3cf[_0xcedb('0x1e')]=intUtil[_0xcedb('0x42')](_0x5ad3cf[_0xcedb('0x1e')]);_0x5ad3cf[_0xcedb('0x43')]=intUtil['stripTrailingSlash'](_0x5ad3cf[_0xcedb('0x43')]);if(_0x49a004&&_0x49a004[_0xcedb('0x51')]&&_0x49a004[_0xcedb('0x51')]!==_0xcedb('0x52')){logger[_0xcedb('0xd')](_0xcedb('0x53'),_0xcedb('0x54'));_0x5f0973[_0xcedb('0x46')]=util[_0xcedb('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5ad3cf[_0xcedb('0x43')],_0x5f0973[_0xcedb('0x47')],md5(_0x5f0973[_0xcedb('0x47')]));}headers['Authorization']=getAuth(_0x5ad3cf);return getUser(_0x5ad3cf,_0x5f4d81[_0xcedb('0x55')])[_0xcedb('0x20')](function(_0xc42b30){_0x304913=_0xc42b30;logger[_0xcedb('0xd')]('The\x20User\x20ID\x20is:',_0x304913['id']);return getEndUser(_0x5ad3cf,_0x5f0973[_0xcedb('0x56')],_0x5f0973['destcalleridnum']);})[_0xcedb('0x20')](function(_0x7491be){_0x37bf4f=_0x7491be;logger[_0xcedb('0xd')](_0xcedb('0x57'),_0x37bf4f['id']);return getTicket(_0x5ad3cf,_0x304913,_0x37bf4f,_0x1bc019,_0x5f0973);})[_0xcedb('0x20')](function(_0x5a863c){if(_0x5a863c&&_0x5a863c['id']){logger['info'](_0xcedb('0x21'));logger[_0xcedb('0xd')]('The\x20Ticket\x20ID\x20is:',_0x5a863c['id']);logger[_0xcedb('0xd')](_0xcedb('0x53'),_0xcedb('0x4b'));emit(util[_0xcedb('0x10')](_0xcedb('0x4c'),_0x5f4d81[_0xcedb('0x18')]),_0xcedb('0x4d'),{'uri':util['format'](_0xcedb('0x4e'),_0x5ad3cf[_0xcedb('0x1e')],_0x5a863c['id'])});}})[_0xcedb('0x4f')](function(_0x3f356f){logger[_0xcedb('0x50')](_0xcedb('0x53'),JSON[_0xcedb('0x58')](_0x3f356f));});};exports[_0xcedb('0x59')]=function(_0x53471d,_0xf84ead,_0x5a9a55,_0x16e42d,_0x278ee7,_0xf7fcd2){var _0x201fe4,_0x5c9d85;_0xf7fcd2[_0xcedb('0x1e')]=intUtil[_0xcedb('0x42')](_0xf7fcd2[_0xcedb('0x1e')]);_0xf7fcd2['serverUrl']=intUtil[_0xcedb('0x42')](_0xf7fcd2[_0xcedb('0x43')]);if(_0x278ee7&&_0x278ee7['monitor_format']){logger[_0xcedb('0xd')]('['+_0xf84ead[_0xcedb('0x5a')][_0xcedb('0x5b')]()+']',_0xcedb('0x54'));_0xf84ead[_0xcedb('0x46')]=util[_0xcedb('0x10')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xf7fcd2[_0xcedb('0x43')],_0xf84ead[_0xcedb('0x47')],md5(_0xf84ead[_0xcedb('0x47')]));}else{_0xf84ead[_0xcedb('0x46')]='';}headers[_0xcedb('0x5c')]=getAuth(_0xf7fcd2);return getUser(_0xf7fcd2,'')[_0xcedb('0x20')](function(_0x497b18){_0x201fe4=_0x497b18;logger[_0xcedb('0xd')]('The\x20User\x20ID\x20is:',_0x201fe4['id']);return getEndUser(_0xf7fcd2,_0xf84ead[_0xcedb('0x12')],_0xf84ead[_0xcedb('0x49')]);})[_0xcedb('0x20')](function(_0x162d22){_0x5c9d85=_0x162d22;logger[_0xcedb('0xd')]('The\x20Enduser\x20ID\x20is:',_0x5c9d85['id']);return getTicket(_0xf7fcd2,_0x201fe4,_0x5c9d85,_0x5a9a55,_0xf84ead);})[_0xcedb('0x20')](function(_0x228f58){if(_0x228f58){logger['info'](_0xcedb('0x21'));logger[_0xcedb('0xd')](_0xcedb('0x4a'),_0x228f58['id']);}})['catch'](function(_0x442c87){logger[_0xcedb('0x50')]('['+_0xf84ead['lastevent']['toUpperCase']()+']',JSON['stringify'](_0x442c87));});}; \ No newline at end of file +var _0x671f=['customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','unmanaged','lastevent','The\x20Enduser\x20ID\x20is:','toUpperCase','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridnum','getString','Descriptions','
','Tags','name','Fields','custom_fields','keyBy','value','format','remoteUri','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','then','%s/api/v2/agents/me','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','string','picklist','type','nameField','customField','toLowerCase','content','idField','push','variable','variableName'];(function(_0x4de22e,_0x4891db){var _0x51f11e=function(_0x175c6e){while(--_0x175c6e){_0x4de22e['push'](_0x4de22e['shift']());}};_0x51f11e(++_0x4891db);}(_0x671f,0xcf));var _0xf671=function(_0x2e7170,_0x187736){_0x2e7170=_0x2e7170-0x0;var _0x36f675=_0x671f[_0x2e7170];return _0x36f675;};'use strict';var _=require('lodash');var rp=require(_0xf671('0x0'));var md5=require(_0xf671('0x1'));var util=require(_0xf671('0x2'));var Redis=require(_0xf671('0x3'));var intUtil=require(_0xf671('0x4'));var config=require(_0xf671('0x5'));var logger=require(_0xf671('0x6'))(_0xf671('0x7'));config[_0xf671('0x8')]=_[_0xf671('0x9')](config[_0xf671('0x8')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf671('0x8')]));var headers={'Content-Type':'application/json','Accept':_0xf671('0xa')};function emit(_0x1721a2,_0x8e981d,_0x49ef68){io['to'](_0x1721a2)[_0xf671('0xb')](_0x8e981d,_0x49ef68);}function getTicket(_0x160c65,_0x306c66,_0xfd0b11,_0x5c7e39,_0x530d77){logger[_0xf671('0xc')](_0xf671('0xd'));var _0x40b2a5=_[_0xf671('0xe')]({'responder_id':_0x306c66['id'],'requester_id':_0xfd0b11['id'],'name':util['format'](_0xf671('0xf'),_0x530d77['calleridname']),'phone':_0x530d77[_0xf671('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xf671('0x11')](_0x5c7e39['Subjects'],_0x530d77,'\x20'),'description':intUtil[_0xf671('0x11')](_0x5c7e39[_0xf671('0x12')],_0x530d77,_0xf671('0x13')),'tags':getTags(_0x5c7e39[_0xf671('0x14')],_0xf671('0x15'))},getCustomFields(_0x5c7e39[_0xf671('0x16')],_0x530d77));_0x40b2a5[_0xf671('0x17')]=_['mapValues'](_[_0xf671('0x18')](_0x40b2a5[_0xf671('0x17')],'id'),_0xf671('0x19'));return request({'uri':util[_0xf671('0x1a')]('%s/api/v2/tickets',_0x160c65[_0xf671('0x1b')]),'method':'POST','body':_0x40b2a5})['then'](function(_0x5a6807){logger[_0xf671('0xc')](_0xf671('0x1c'));return _0x5a6807;});}function getUser(_0x48abbd,_0x435f94){if(intUtil[_0xf671('0x1d')](_0x435f94)){return request({'uri':util['format'](_0xf671('0x1e'),_0x48abbd['remoteUri']),'qs':{'email':_0x435f94}})['then'](function(_0xd1a60f){if(_0xd1a60f[_0xf671('0x1f')]){logger[_0xf671('0xc')](_0xf671('0x20'));return _[_0xf671('0x21')](_0xd1a60f,function(_0x5c1604){return _0x5c1604[_0xf671('0x22')][_0xf671('0x23')]===_0x435f94;});}else{logger[_0xf671('0xc')](_0xf671('0x24'));return request({'uri':util[_0xf671('0x1a')]('%s/api/v2/agents/me',_0x48abbd['remoteUri'])})[_0xf671('0x25')](function(_0x48d7df){logger[_0xf671('0xc')]('Admin\x20account\x20selected.');return _0x48d7df;});}});}else{logger[_0xf671('0xc')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util['format'](_0xf671('0x26'),_0x48abbd[_0xf671('0x1b')])})[_0xf671('0x25')](function(_0x30c7d6){logger[_0xf671('0xc')](_0xf671('0x27'));return _0x30c7d6;});}}function getEndUser(_0x7dcaa5,_0x5b3db2,_0x39be40){logger[_0xf671('0xc')]('Searching\x20enduser\x20with\x20phone',_0x39be40);return request({'uri':util['format'](_0xf671('0x28'),_0x7dcaa5['remoteUri']),'qs':{'phone':_0x39be40}})[_0xf671('0x25')](function(_0x2fb32c){if(_0x2fb32c['length']){logger[_0xf671('0xc')](_0xf671('0x29'));return _[_0xf671('0x21')](_0x2fb32c,{'phone':_0x39be40});}else{logger[_0xf671('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0xf671('0x28'),_0x7dcaa5[_0xf671('0x1b')]),'method':'POST','body':{'name':_0x5b3db2,'phone':_0x39be40}})['then'](function(_0x5c4b62){logger[_0xf671('0xc')](_0xf671('0x2a'));return _0x5c4b62;});}});}function getAuth(_0xf5da00){return util[_0xf671('0x1a')](_0xf671('0x2b'),new Buffer(_0xf5da00['apiKey']+':X')[_0xf671('0x2c')](_0xf671('0x2d')));}function request(_0x167a9b){logger[_0xf671('0x2e')](_0xf671('0x2f'),JSON[_0xf671('0x30')](_0x167a9b));return rp(_['defaults'](_0x167a9b,{'method':_0xf671('0x31'),'headers':headers,'json':!![]}));}function getTags(_0x3763ee,_0x4d439f){var _0x5d7ee3=[];if(_0x3763ee&&_0x3763ee[_0xf671('0x1f')]>0x0){_0x5d7ee3=_[_0xf671('0x32')](_0x3763ee,_0x4d439f);}return _0x5d7ee3;}function getCustomFields(_0x1e65b6,_0x203771){var _0x244f21=[];var _0x499a38={'custom_fields':[]};if(_0x1e65b6['length']>0x0){_[_0xf671('0x33')](_0x1e65b6,function(_0x1278eb){if(_['includes']([_0xf671('0x34'),_0xf671('0x35')],_0x1278eb[_0xf671('0x36')])&&_0x1278eb[_0xf671('0x37')]&&!_0x1278eb[_0xf671('0x38')]){_0x499a38[_0x1278eb['nameField'][_0xf671('0x39')]()]=_0x1278eb[_0xf671('0x3a')]['toString']();}else if(_['includes']([_0xf671('0x34'),_0xf671('0x35')],_0x1278eb[_0xf671('0x36')])&&_0x1278eb[_0xf671('0x3b')]&&_0x1278eb[_0xf671('0x38')]){_0x499a38[_0xf671('0x17')][_0xf671('0x3c')]({'id':_0x1278eb[_0xf671('0x3b')],'value':_0x1278eb['content'][_0xf671('0x2c')]()});}else if(_0x1278eb[_0xf671('0x36')]===_0xf671('0x3d')&&_0x1278eb[_0xf671('0x3e')]&&_0x1278eb[_0xf671('0x3b')]&&_0x1278eb[_0xf671('0x38')]){_0x203771[_0x1278eb['variableName']]&&_0x499a38['custom_fields'][_0xf671('0x3c')]({'id':_0x1278eb[_0xf671('0x3b')],'value':_0x203771[_0x1278eb[_0xf671('0x3e')]]['toString']()});}else if(_0x1278eb['type']===_0xf671('0x3f')&&_0x1278eb[_0xf671('0x40')]&&_0x1278eb[_0xf671('0x40')][_0xf671('0x15')]&&_0x1278eb[_0xf671('0x3b')]&&_0x1278eb[_0xf671('0x38')]){_0x203771[_0x1278eb[_0xf671('0x40')]['name'][_0xf671('0x39')]()]&&_0x499a38['custom_fields']['push']({'id':_0x1278eb['idField'],'value':_0x203771[_0x1278eb[_0xf671('0x40')][_0xf671('0x15')][_0xf671('0x39')]()][_0xf671('0x2c')]()});}});}return _0x499a38;}exports[_0xf671('0x41')]=function(_0x132394,_0x2923f7,_0x2da5c2,_0x1c79ea,_0x185c5c,_0xa8dc20){var _0x44e7a2,_0x54b78e;_0xa8dc20[_0xf671('0x1b')]=intUtil[_0xf671('0x42')](_0xa8dc20['remoteUri']);_0xa8dc20['serverUrl']=intUtil[_0xf671('0x42')](_0xa8dc20[_0xf671('0x43')]);if(_0x185c5c&&_0x185c5c[_0xf671('0x44')]){logger[_0xf671('0xc')](_0xf671('0x45'),'Recording\x20is\x20enabled!');_0x2923f7['recordingURL']=util['format'](_0xf671('0x46'),_0xa8dc20['serverUrl'],_0x2923f7[_0xf671('0x47')],md5(_0x2923f7[_0xf671('0x47')]));}else{_0x2923f7[_0xf671('0x48')]='';}headers['Authorization']=getAuth(_0xa8dc20);return getUser(_0xa8dc20,_0x1c79ea[_0xf671('0x23')])[_0xf671('0x25')](function(_0x2c7778){_0x44e7a2=_0x2c7778;logger[_0xf671('0xc')](_0xf671('0x49'),_0x44e7a2['id']);return getEndUser(_0xa8dc20,_0x2923f7[_0xf671('0x4a')],_0x2923f7[_0xf671('0x10')]);})[_0xf671('0x25')](function(_0x16f97c){_0x54b78e=_0x16f97c;logger[_0xf671('0xc')]('The\x20Enduser\x20ID\x20is:',_0x54b78e['id']);return getTicket(_0xa8dc20,_0x44e7a2,_0x54b78e,_0x2da5c2,_0x2923f7);})[_0xf671('0x25')](function(_0x1a0130){if(_0x1a0130&&_0x1a0130['id']){logger['info'](_0xf671('0x1c'));logger[_0xf671('0xc')](_0xf671('0x4b'),_0x1a0130['id']);logger['info'](_0xf671('0x45'),_0xf671('0x4c'));emit(util['format'](_0xf671('0x4d'),_0x1c79ea['name']),_0xf671('0x4e'),{'uri':util[_0xf671('0x1a')](_0xf671('0x4f'),_0xa8dc20[_0xf671('0x1b')],_0x1a0130['id'])});}})[_0xf671('0x50')](function(_0x37d351){logger[_0xf671('0x51')]('[QUEUE]',JSON['stringify'](_0x37d351));});};exports[_0xf671('0x52')]=function(_0x234c3e,_0x251ec5,_0x518a9f,_0x1da416,_0x313eb2,_0x3111a0,_0x3ebcca){var _0x40795a,_0x4fb328;_0x3111a0[_0xf671('0x1b')]=intUtil[_0xf671('0x42')](_0x3111a0[_0xf671('0x1b')]);_0x3111a0[_0xf671('0x43')]=intUtil[_0xf671('0x42')](_0x3111a0[_0xf671('0x43')]);if(_0x3ebcca&&_0x3ebcca[_0xf671('0x53')]&&_0x3ebcca[_0xf671('0x53')]!=='none'){logger[_0xf671('0xc')](_0xf671('0x54'),_0xf671('0x55'));_0x251ec5[_0xf671('0x48')]=util[_0xf671('0x1a')](_0xf671('0x46'),_0x3111a0[_0xf671('0x43')],_0x251ec5[_0xf671('0x47')],md5(_0x251ec5[_0xf671('0x47')]));}headers['Authorization']=getAuth(_0x3111a0);return getUser(_0x3111a0,_0x1da416[_0xf671('0x23')])[_0xf671('0x25')](function(_0x5c0be4){_0x40795a=_0x5c0be4;logger[_0xf671('0xc')]('The\x20User\x20ID\x20is:',_0x40795a['id']);return getEndUser(_0x3111a0,_0x251ec5['destcalleridname'],_0x251ec5['destcalleridnum']);})[_0xf671('0x25')](function(_0x43bc4c){_0x4fb328=_0x43bc4c;logger['info']('The\x20Enduser\x20ID\x20is:',_0x4fb328['id']);return getTicket(_0x3111a0,_0x40795a,_0x4fb328,_0x518a9f,_0x251ec5);})[_0xf671('0x25')](function(_0x31e75f){if(_0x31e75f&&_0x31e75f['id']){logger['info']('Ticket\x20created!');logger[_0xf671('0xc')](_0xf671('0x4b'),_0x31e75f['id']);logger[_0xf671('0xc')](_0xf671('0x54'),_0xf671('0x4c'));emit(util[_0xf671('0x1a')](_0xf671('0x4d'),_0x1da416[_0xf671('0x15')]),_0xf671('0x4e'),{'uri':util['format'](_0xf671('0x4f'),_0x3111a0[_0xf671('0x1b')],_0x31e75f['id'])});}})[_0xf671('0x50')](function(_0x148df6){logger[_0xf671('0x51')]('[OUTBOUND]',JSON[_0xf671('0x30')](_0x148df6));});};exports[_0xf671('0x56')]=function(_0xeecf93,_0x423bc7,_0x46d6a9,_0x153caa,_0x21230e,_0x381372){var _0x2b81a1,_0x45b0c7;_0x381372[_0xf671('0x1b')]=intUtil[_0xf671('0x42')](_0x381372[_0xf671('0x1b')]);_0x381372[_0xf671('0x43')]=intUtil['stripTrailingSlash'](_0x381372['serverUrl']);if(_0x21230e&&_0x21230e[_0xf671('0x44')]){logger[_0xf671('0xc')]('['+_0x423bc7[_0xf671('0x57')]['toUpperCase']()+']',_0xf671('0x55'));_0x423bc7[_0xf671('0x48')]=util[_0xf671('0x1a')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x381372[_0xf671('0x43')],_0x423bc7['uniqueid'],md5(_0x423bc7[_0xf671('0x47')]));}else{_0x423bc7['recordingURL']='';}headers['Authorization']=getAuth(_0x381372);return getUser(_0x381372,'')[_0xf671('0x25')](function(_0x31ee88){_0x2b81a1=_0x31ee88;logger[_0xf671('0xc')](_0xf671('0x49'),_0x2b81a1['id']);return getEndUser(_0x381372,_0x423bc7[_0xf671('0x4a')],_0x423bc7['calleridnum']);})[_0xf671('0x25')](function(_0x1f0648){_0x45b0c7=_0x1f0648;logger[_0xf671('0xc')](_0xf671('0x58'),_0x45b0c7['id']);return getTicket(_0x381372,_0x2b81a1,_0x45b0c7,_0x46d6a9,_0x423bc7);})['then'](function(_0x3f9036){if(_0x3f9036){logger[_0xf671('0xc')](_0xf671('0x1c'));logger[_0xf671('0xc')](_0xf671('0x4b'),_0x3f9036['id']);}})[_0xf671('0x50')](function(_0x4ba7cf){logger[_0xf671('0x51')]('['+_0x423bc7[_0xf671('0x57')][_0xf671('0x59')]()+']',JSON[_0xf671('0x30')](_0x4ba7cf));});}; \ 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 1d39345..ed248a5 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 _0xb68b=['serverUrl','toLowerCase','calleridnum','callDirection','queue','unmanaged','outbound','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','request-promise','md5','bluebird','../../../../config/environment','redis','localhost','socket.io-emitter','GET','/api/selector/owners','Getting\x20admin\x20information','then','users','length','email','adminId','info','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','headers','agentEmail','userEmail','userId','adminEmail','/api/lookup?q=','&f=','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','POST','/api/tasks','getString','Descriptions','add','ticketId','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash'];(function(_0xeac03f,_0x1f8291){var _0x2c2d82=function(_0x58b8c2){while(--_0x58b8c2){_0xeac03f['push'](_0xeac03f['shift']());}};_0x2c2d82(++_0x1f8291);}(_0xb68b,0x1d4));var _0xbb68=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0xb68b[_0x49b207];return _0x2dc8fa;};'use strict';var _=require('lodash');var rp=require(_0xbb68('0x0'));var md5=require(_0xbb68('0x1'));var util=require('util');var moment=require('moment');var Promise=require(_0xbb68('0x2'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0xbb68('0x3'));var logger=require('../../../../config/logger')('freshsales');config[_0xbb68('0x4')]=_['defaults'](config[_0xbb68('0x4')],{'host':_0xbb68('0x5'),'port':0x18eb});var io=require(_0xbb68('0x6'))(new Redis(config[_0xbb68('0x4')]));function getAdminId(_0x3fc703,_0x215cc2,_0x39f88f,_0xd62c0){return new Promise(function(_0x10a7cc,_0x591704){var _0x2474d5=![];var _0x2d4010={'method':_0xbb68('0x7'),'uri':_0xd62c0+_0xbb68('0x8'),'json':!![]};_0x2d4010['headers']=_0x39f88f;logger['info'](_0xbb68('0x9'));return rp(_0x2d4010)[_0xbb68('0xa')](function(_0x4a0165){if(_0x4a0165){var _0x4a63b7=_0x4a0165[_0xbb68('0xb')];var _0x4be3cd=null;for(_0x4be3cd=0x0;_0x4be3cd<_0x4a63b7[_0xbb68('0xc')];_0x4be3cd++){if(_0x4a63b7[_0x4be3cd][_0xbb68('0xd')]===_0x3fc703['adminEmail']){_0x3fc703[_0xbb68('0xe')]=_0x4a63b7[_0x4be3cd]['id'];_0x2474d5=!![];}}if(_0x2474d5){logger[_0xbb68('0xf')]('Admin\x20found:',_0x3fc703['adminId']);_0x10a7cc(_0x3fc703);}else{_0x591704({'statusCode':0x194,'message':_0xbb68('0x10')});}}else{_0x591704({'statusCode':0x194,'message':_0xbb68('0x10')});}})[_0xbb68('0x11')](function(_0x5d03cc){logger[_0xbb68('0x12')]('['+[_0x215cc2[_0xbb68('0x13')]()]+']',_0x5d03cc[_0xbb68('0x14')]);_0x591704(_0x5d03cc);});});}function getUser(_0x4d5f7b,_0x567ea8,_0xfb10cc){return function(_0xb7f06d){return new Promise(function(_0x564fa0,_0x4bec2f){var _0x3057d3={'method':_0xbb68('0x7'),'uri':_0xfb10cc+'/api/selector/owners','json':!![]};_0x3057d3[_0xbb68('0x15')]=_0x567ea8;logger['info']('Getting\x20user\x20list');return rp(_0x3057d3)[_0xbb68('0xa')](function(_0x4cacdd){if(_0x4cacdd){var _0x11eb26=_0x4cacdd[_0xbb68('0xb')];var _0x498239=![];var _0x190b4a=null;if(_0xb7f06d['agentEmail']!==null){logger[_0xbb68('0xf')]('Getting\x20user\x20with\x20email',_0xb7f06d[_0xbb68('0x16')]);_0xb7f06d[_0xbb68('0x17')]=_0xb7f06d[_0xbb68('0x16')];for(_0x190b4a=0x0;_0x190b4a<_0x11eb26[_0xbb68('0xc')];_0x190b4a++){if(_0x11eb26[_0x190b4a]['email']===_0xb7f06d[_0xbb68('0x16')]){_0x498239=!![];_0xb7f06d[_0xbb68('0x18')]=_0x11eb26[_0x190b4a]['id'];logger[_0xbb68('0xf')]('User\x20found:',_0xb7f06d[_0xbb68('0x18')]);}}}if(!_0x498239){logger[_0xbb68('0xf')]('Admin\x20selected');_0xb7f06d['userEmail']=_0xb7f06d[_0xbb68('0x19')];_0xb7f06d[_0xbb68('0x18')]=_0xb7f06d['adminId'];_0x498239=!![];}if(_0x498239){_0x564fa0(_0xb7f06d);}else{_0x4bec2f({'statusCode':0x194,'message':_0xbb68('0x10')});}}else{_0x4bec2f({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x1ab653){logger['error']('['+[_0x4d5f7b[_0xbb68('0x13')]()]+']',_0x1ab653[_0xbb68('0x14')]);_0x4bec2f(_0x1ab653);});});};}function searchContact(_0x980273,_0x154d6f,_0x5ba031,_0x5f0734){return new Promise(function(_0x242559,_0x177d6f){var _0x3b82c0={'method':'GET','headers':_0x154d6f,'uri':_0x980273+_0xbb68('0x1a')+_0x5f0734+_0xbb68('0x1b')+_0x5ba031+_0xbb68('0x1c'),'json':!![]};rp(_0x3b82c0)[_0xbb68('0xa')](function(_0x265f01){var _0x2e004a=_[_0xbb68('0x1d')](_0x265f01[_0xbb68('0x1e')]['contacts'],[_0x5ba031,_0x5f0734]);_0x242559(_0x2e004a);})['catch'](function(_0xc1359){_0x177d6f(_0xc1359);});});}function getEndUser(_0x5332ce,_0x58cd70,_0x1b50ef){return function(_0x2defb2){return new Promise(function(_0x351bee,_0x452ea3){logger[_0xbb68('0xf')](util[_0xbb68('0x1f')](_0xbb68('0x20'),_0x2defb2[_0xbb68('0x21')]));searchContact(_0x1b50ef,_0x58cd70,'mobile_number',_0x2defb2[_0xbb68('0x21')])[_0xbb68('0xa')](function(_0x3f82e5){if(_0x3f82e5){_0x2defb2[_0xbb68('0x22')]=_0x3f82e5['id'];logger['info'](_0xbb68('0x23'),_0x2defb2[_0xbb68('0x22')]);return _0x351bee(_0x2defb2);}searchContact(_0x1b50ef,_0x58cd70,_0xbb68('0x24'),_0x2defb2['contactNumber'])[_0xbb68('0xa')](function(_0x15501e){if(_0x15501e){_0x2defb2[_0xbb68('0x22')]=_0x15501e['id'];logger['info'](_0xbb68('0x25'),_0x2defb2[_0xbb68('0x22')]);return _0x351bee(_0x2defb2);}createEndUser(_0x2defb2,_0x5332ce,_0x58cd70,_0x1b50ef)['then'](function(_0x1ea753){logger[_0xbb68('0xf')](_0xbb68('0x26'),_0x1ea753[_0xbb68('0x22')]);return _0x351bee(_0x1ea753);});});})[_0xbb68('0x11')](function(_0x28bd7f){_0x452ea3(_0x28bd7f);});});};}function createEndUser(_0xfc7475,_0x31491d,_0x280397,_0x19f8d4){return new Promise(function(_0x2d3522,_0x2ea84c){var _0xe94e54=moment();var _0x5805e4={'method':'POST','uri':_0x19f8d4+_0xbb68('0x27'),'body':{'contact':{'last_name':_0xfc7475[_0xbb68('0x21')],'work_number':_0xfc7475[_0xbb68('0x21')],'mobile_number':_0xfc7475[_0xbb68('0x21')],'owner_id':_0xfc7475[_0xbb68('0x18')],'created_at':_0xe94e54[_0xbb68('0x1f')](_0xbb68('0x28'))}},'json':!![]};_0x5805e4['headers']=_0x280397;logger[_0xbb68('0xf')](_0xbb68('0x29'));return rp(_0x5805e4)[_0xbb68('0xa')](function(_0x1b9f6c){_0xfc7475[_0xbb68('0x22')]=_0x1b9f6c[_0xbb68('0x2a')]['id'];_0x2d3522(_0xfc7475);})[_0xbb68('0x11')](function(_0x571458){logger['error']('['+[_0x31491d[_0xbb68('0x13')]()]+']',_0x571458[_0xbb68('0x14')]);_0x2ea84c(_0x571458[_0xbb68('0x14')]);});});}function getTicket(_0x5f5419,_0x5e2f7d,_0x101325,_0x1ad65a,_0x2244b5){return function(_0x4c0ccf){logger[_0xbb68('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x381006,_0x273e8a){var _0x132657=moment();var _0x23d96c={'method':_0xbb68('0x2b'),'uri':_0x101325+_0xbb68('0x2c'),'body':{'title':intUtil[_0xbb68('0x2d')](_0x1ad65a['Subjects'],_0x2244b5,'\x20'),'description':intUtil[_0xbb68('0x2d')](_0x1ad65a[_0xbb68('0x2e')],_0x2244b5,'\x0a'),'owner_id':_0x4c0ccf['userId'],'creater_id':_0x4c0ccf[_0xbb68('0xe')],'targetable_id':_0x4c0ccf[_0xbb68('0x22')],'targetable_type':'Contact','created_at':_0x132657['format'](_0xbb68('0x28')),'due_date':_0x132657[_0xbb68('0x2f')](0x1e,'m')[_0xbb68('0x1f')]('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x23d96c['headers']=_0x5e2f7d;return rp(_0x23d96c)[_0xbb68('0xa')](function(_0x260bdf){_0x4c0ccf[_0xbb68('0x30')]=_0x260bdf['task']['id'];logger[_0xbb68('0xf')](_0xbb68('0x31'),_0x4c0ccf[_0xbb68('0x30')]);_0x381006(_0x4c0ccf);})[_0xbb68('0x11')](function(_0xdabab4){logger[_0xbb68('0x12')]('['+[_0x5f5419[_0xbb68('0x13')]()]+']',_0xdabab4[_0xbb68('0x14')]);_0x273e8a(_0xdabab4['message']);});});};}function emit(_0x1d6e0b,_0x20ba47,_0x53252e){var _0x5e2da6={'uri':_0x1d6e0b+_0xbb68('0x32')+_0x53252e};io['to'](util[_0xbb68('0x1f')](_0xbb68('0x33'),_0x20ba47))[_0xbb68('0x34')](_0xbb68('0x35'),_0x5e2da6);}exports['cs']=function(_0x57399c,_0x36a42f,_0xc1476c,_0xb385ea,_0x2023e3,_0x3151a0,_0x2604b0,_0x5208ca){var _0x28c8d0={};var _0x3c6871={'Authorization':_0xbb68('0x36')+_0x3151a0['apiKey']};_0x3151a0[_0xbb68('0x37')]=intUtil[_0xbb68('0x38')](_0x3151a0[_0xbb68('0x37')]);_0x3151a0[_0xbb68('0x39')]=intUtil['stripTrailingSlash'](_0x3151a0[_0xbb68('0x39')]);var _0x5501f6=_0x3151a0[_0xbb68('0x37')];_0x28c8d0[_0xbb68('0x19')]=_0x3151a0['username'];_0x28c8d0[_0xbb68('0x21')]=_0x5208ca[_0xbb68('0x3a')]()==='outbound'?_0x36a42f['destcalleridnum']:_0x36a42f[_0xbb68('0x3b')];_0x28c8d0[_0xbb68('0x3c')]=_0x5208ca===_0xbb68('0x3d')||_0x5208ca===_0xbb68('0x3e')?_0xbb68('0x3d'):_0xbb68('0x3f');if(_0xb385ea){_0x28c8d0[_0xbb68('0x16')]=_0xb385ea[_0xbb68('0xd')];}var _0x3fc8db=util[_0xbb68('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3151a0[_0xbb68('0x39')],_0x36a42f['uniqueid'],md5(_0x36a42f[_0xbb68('0x40')]));if(_0x2023e3&&_0x2023e3['monitor_format']){logger[_0xbb68('0xf')](_0xbb68('0x41'),_0xbb68('0x42'));_0x36a42f['recordingURL']=_0x3fc8db;}else if(_0x2604b0&&_0x2604b0[_0xbb68('0x43')]&&_0x2604b0[_0xbb68('0x43')]!==_0xbb68('0x44')){logger[_0xbb68('0xf')]('[OUTBOUND]',_0xbb68('0x42'));_0x36a42f['recordingURL']=_0x3fc8db;}else{_0x36a42f[_0xbb68('0x45')]='';}return getAdminId(_0x28c8d0,_0x5208ca,_0x3c6871,_0x5501f6)[_0xbb68('0xa')](getUser(_0x5208ca,_0x3c6871,_0x5501f6))['then'](getEndUser(_0x5208ca,_0x3c6871,_0x5501f6))[_0xbb68('0xa')](getTicket(_0x5208ca,_0x3c6871,_0x5501f6,_0xc1476c,_0x36a42f))[_0xbb68('0xa')](function(_0x484fa8){logger[_0xbb68('0xf')](util[_0xbb68('0x1f')](_0xbb68('0x46'),_0x484fa8[_0xbb68('0x30')]));if(_0x5208ca!==_0xbb68('0x3e')){logger[_0xbb68('0xf')]('['+[_0x5208ca[_0xbb68('0x13')]()]+']',_0xbb68('0x47'));emit(_0x5501f6,_0xb385ea[_0xbb68('0x48')],_0x484fa8['endUserId']);}})[_0xbb68('0x11')](function(_0x3c4686){logger[_0xbb68('0x12')]('['+[_0x5208ca['toUpperCase']()]+_0xbb68('0x49'),util[_0xbb68('0x4a')](_0x3c4686,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xb43f=['Descriptions','Contact','ticketId','task','user:%s','trigger:browser:url','Token\x20token=','apiKey','stripTrailingSlash','serverUrl','remoteUri','username','toLowerCase','outbound','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name','inspect','request-promise','md5','util','moment','bluebird','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','/api/selector/owners','headers','Getting\x20admin\x20information','then','users','length','email','adminEmail','info','adminId','error','message','agentEmail','Getting\x20user\x20with\x20email','userEmail','User\x20found:','userId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','/api/lookup?q=','&f=','&entities=contact','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','Contact\x20found\x20mobile_number:','endUserId','work_number','Contact\x20found\x20work_number:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','getString','Subjects'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xb43f,0x6f));var _0xfb43=function(_0x254081,_0x20731a){_0x254081=_0x254081-0x0;var _0x5d1e2a=_0xb43f[_0x254081];return _0x5d1e2a;};'use strict';var _=require('lodash');var rp=require(_0xfb43('0x0'));var md5=require(_0xfb43('0x1'));var util=require(_0xfb43('0x2'));var moment=require(_0xfb43('0x3'));var Promise=require(_0xfb43('0x4'));var Redis=require('ioredis');var intUtil=require(_0xfb43('0x5'));var config=require(_0xfb43('0x6'));var logger=require(_0xfb43('0x7'))('freshsales');config[_0xfb43('0x8')]=_[_0xfb43('0x9')](config[_0xfb43('0x8')],{'host':_0xfb43('0xa'),'port':0x18eb});var io=require(_0xfb43('0xb'))(new Redis(config[_0xfb43('0x8')]));function getAdminId(_0x1838a0,_0x4d37f2,_0x5acb18,_0x559f2b){return new Promise(function(_0x571d91,_0x2b61d7){var _0x266ad7=![];var _0x330e57={'method':_0xfb43('0xc'),'uri':_0x559f2b+_0xfb43('0xd'),'json':!![]};_0x330e57[_0xfb43('0xe')]=_0x5acb18;logger['info'](_0xfb43('0xf'));return rp(_0x330e57)[_0xfb43('0x10')](function(_0x2e0d77){if(_0x2e0d77){var _0x2c6e91=_0x2e0d77[_0xfb43('0x11')];var _0x4f1abf=null;for(_0x4f1abf=0x0;_0x4f1abf<_0x2c6e91[_0xfb43('0x12')];_0x4f1abf++){if(_0x2c6e91[_0x4f1abf][_0xfb43('0x13')]===_0x1838a0[_0xfb43('0x14')]){_0x1838a0['adminId']=_0x2c6e91[_0x4f1abf]['id'];_0x266ad7=!![];}}if(_0x266ad7){logger[_0xfb43('0x15')]('Admin\x20found:',_0x1838a0[_0xfb43('0x16')]);_0x571d91(_0x1838a0);}else{_0x2b61d7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x2b61d7({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x1e35e8){logger[_0xfb43('0x17')]('['+[_0x4d37f2['toUpperCase']()]+']',_0x1e35e8[_0xfb43('0x18')]);_0x2b61d7(_0x1e35e8);});});}function getUser(_0x208376,_0x387147,_0x5442b3){return function(_0x4fd68a){return new Promise(function(_0x3efcf6,_0x4fb50d){var _0x942c43={'method':'GET','uri':_0x5442b3+'/api/selector/owners','json':!![]};_0x942c43[_0xfb43('0xe')]=_0x387147;logger[_0xfb43('0x15')]('Getting\x20user\x20list');return rp(_0x942c43)['then'](function(_0x200529){if(_0x200529){var _0x2c9a8c=_0x200529[_0xfb43('0x11')];var _0x1e9ebe=![];var _0xf6e4c9=null;if(_0x4fd68a[_0xfb43('0x19')]!==null){logger[_0xfb43('0x15')](_0xfb43('0x1a'),_0x4fd68a['agentEmail']);_0x4fd68a[_0xfb43('0x1b')]=_0x4fd68a[_0xfb43('0x19')];for(_0xf6e4c9=0x0;_0xf6e4c9<_0x2c9a8c[_0xfb43('0x12')];_0xf6e4c9++){if(_0x2c9a8c[_0xf6e4c9][_0xfb43('0x13')]===_0x4fd68a[_0xfb43('0x19')]){_0x1e9ebe=!![];_0x4fd68a['userId']=_0x2c9a8c[_0xf6e4c9]['id'];logger['info'](_0xfb43('0x1c'),_0x4fd68a['userId']);}}}if(!_0x1e9ebe){logger['info']('Admin\x20selected');_0x4fd68a[_0xfb43('0x1b')]=_0x4fd68a[_0xfb43('0x14')];_0x4fd68a[_0xfb43('0x1d')]=_0x4fd68a[_0xfb43('0x16')];_0x1e9ebe=!![];}if(_0x1e9ebe){_0x3efcf6(_0x4fd68a);}else{_0x4fb50d({'statusCode':0x194,'message':_0xfb43('0x1e')});}}else{_0x4fb50d({'statusCode':0x194,'message':_0xfb43('0x1e')});}})[_0xfb43('0x1f')](function(_0x3d7259){logger[_0xfb43('0x17')]('['+[_0x208376[_0xfb43('0x20')]()]+']',_0x3d7259[_0xfb43('0x18')]);_0x4fb50d(_0x3d7259);});});};}function searchContact(_0x536fee,_0x199cdf,_0xae409d,_0x3ae644){return new Promise(function(_0x4a5ded,_0x4273ad){var _0x645f74={'method':_0xfb43('0xc'),'headers':_0x199cdf,'uri':_0x536fee+_0xfb43('0x21')+_0x3ae644+_0xfb43('0x22')+_0xae409d+_0xfb43('0x23'),'json':!![]};rp(_0x645f74)[_0xfb43('0x10')](function(_0x4d4f20){var _0xc26706=_['find'](_0x4d4f20['contacts'][_0xfb43('0x24')],[_0xae409d,_0x3ae644]);_0x4a5ded(_0xc26706);})[_0xfb43('0x1f')](function(_0xbc684b){_0x4273ad(_0xbc684b);});});}function getEndUser(_0xe514e7,_0x12c78c,_0x1acd28){return function(_0x52342c){return new Promise(function(_0x108292,_0x204b8b){logger[_0xfb43('0x15')](util[_0xfb43('0x25')](_0xfb43('0x26'),_0x52342c[_0xfb43('0x27')]));searchContact(_0x1acd28,_0x12c78c,'mobile_number',_0x52342c[_0xfb43('0x27')])[_0xfb43('0x10')](function(_0x2e6b4a){if(_0x2e6b4a){_0x52342c['endUserId']=_0x2e6b4a['id'];logger[_0xfb43('0x15')](_0xfb43('0x28'),_0x52342c[_0xfb43('0x29')]);return _0x108292(_0x52342c);}searchContact(_0x1acd28,_0x12c78c,_0xfb43('0x2a'),_0x52342c[_0xfb43('0x27')])[_0xfb43('0x10')](function(_0x4f9918){if(_0x4f9918){_0x52342c[_0xfb43('0x29')]=_0x4f9918['id'];logger[_0xfb43('0x15')](_0xfb43('0x2b'),_0x52342c[_0xfb43('0x29')]);return _0x108292(_0x52342c);}createEndUser(_0x52342c,_0xe514e7,_0x12c78c,_0x1acd28)[_0xfb43('0x10')](function(_0x590298){logger[_0xfb43('0x15')]('Contact\x20created:',_0x590298[_0xfb43('0x29')]);return _0x108292(_0x590298);});});})[_0xfb43('0x1f')](function(_0x3544f5){_0x204b8b(_0x3544f5);});});};}function createEndUser(_0x253f9a,_0x328253,_0xeddb51,_0x1090ba){return new Promise(function(_0x55c52e,_0x58da93){var _0x16fd18=moment();var _0x4f995e={'method':_0xfb43('0x2c'),'uri':_0x1090ba+_0xfb43('0x2d'),'body':{'contact':{'last_name':_0x253f9a[_0xfb43('0x27')],'work_number':_0x253f9a['contactNumber'],'mobile_number':_0x253f9a['contactNumber'],'owner_id':_0x253f9a['userId'],'created_at':_0x16fd18[_0xfb43('0x25')](_0xfb43('0x2e'))}},'json':!![]};_0x4f995e[_0xfb43('0xe')]=_0xeddb51;logger[_0xfb43('0x15')](_0xfb43('0x2f'));return rp(_0x4f995e)[_0xfb43('0x10')](function(_0x1b1e2f){_0x253f9a['endUserId']=_0x1b1e2f[_0xfb43('0x30')]['id'];_0x55c52e(_0x253f9a);})[_0xfb43('0x1f')](function(_0x4498c7){logger[_0xfb43('0x17')]('['+[_0x328253[_0xfb43('0x20')]()]+']',_0x4498c7[_0xfb43('0x18')]);_0x58da93(_0x4498c7['message']);});});}function getTicket(_0x13cdd8,_0x566e02,_0x40218d,_0x46fb60,_0x2c986a){return function(_0x1f5150){logger['info']('Creating\x20new\x20task');return new Promise(function(_0x5d6fa9,_0x273569){var _0x1253b0=moment();var _0x213df6={'method':_0xfb43('0x2c'),'uri':_0x40218d+'/api/tasks','body':{'title':intUtil[_0xfb43('0x31')](_0x46fb60[_0xfb43('0x32')],_0x2c986a,'\x20'),'description':intUtil[_0xfb43('0x31')](_0x46fb60[_0xfb43('0x33')],_0x2c986a,'\x0a'),'owner_id':_0x1f5150[_0xfb43('0x1d')],'creater_id':_0x1f5150[_0xfb43('0x16')],'targetable_id':_0x1f5150[_0xfb43('0x29')],'targetable_type':_0xfb43('0x34'),'created_at':_0x1253b0[_0xfb43('0x25')](_0xfb43('0x2e')),'due_date':_0x1253b0['add'](0x1e,'m')[_0xfb43('0x25')](_0xfb43('0x2e'))},'json':!![]};_0x213df6[_0xfb43('0xe')]=_0x566e02;return rp(_0x213df6)[_0xfb43('0x10')](function(_0x4a182e){_0x1f5150[_0xfb43('0x35')]=_0x4a182e[_0xfb43('0x36')]['id'];logger[_0xfb43('0x15')]('Task\x20created:',_0x1f5150['ticketId']);_0x5d6fa9(_0x1f5150);})[_0xfb43('0x1f')](function(_0x3ae087){logger[_0xfb43('0x17')]('['+[_0x13cdd8[_0xfb43('0x20')]()]+']',_0x3ae087[_0xfb43('0x18')]);_0x273569(_0x3ae087[_0xfb43('0x18')]);});});};}function emit(_0x22859e,_0x1a63d2,_0x5ca4d5){var _0x30127a={'uri':_0x22859e+'/contacts/'+_0x5ca4d5};io['to'](util['format'](_0xfb43('0x37'),_0x1a63d2))['emit'](_0xfb43('0x38'),_0x30127a);}exports['cs']=function(_0x13cc56,_0x131563,_0x5a461d,_0x596830,_0xaf1cb7,_0x5d6079,_0x48951d,_0x1095d6){var _0xbec9f6={};var _0x4057d7={'Authorization':_0xfb43('0x39')+_0x5d6079[_0xfb43('0x3a')]};_0x5d6079['remoteUri']=intUtil[_0xfb43('0x3b')](_0x5d6079['remoteUri']);_0x5d6079[_0xfb43('0x3c')]=intUtil[_0xfb43('0x3b')](_0x5d6079[_0xfb43('0x3c')]);var _0x249222=_0x5d6079[_0xfb43('0x3d')];_0xbec9f6[_0xfb43('0x14')]=_0x5d6079[_0xfb43('0x3e')];_0xbec9f6['contactNumber']=_0x1095d6[_0xfb43('0x3f')]()===_0xfb43('0x40')?_0x131563[_0xfb43('0x41')]:_0x131563['calleridnum'];_0xbec9f6[_0xfb43('0x42')]=_0x1095d6===_0xfb43('0x43')||_0x1095d6==='unmanaged'?_0xfb43('0x43'):'outbound';if(_0x596830){_0xbec9f6[_0xfb43('0x19')]=_0x596830['email'];}var _0x26acba=util[_0xfb43('0x25')](_0xfb43('0x44'),_0x5d6079[_0xfb43('0x3c')],_0x131563[_0xfb43('0x45')],md5(_0x131563['uniqueid']));if(_0xaf1cb7&&_0xaf1cb7[_0xfb43('0x46')]){logger[_0xfb43('0x15')](_0xfb43('0x47'),_0xfb43('0x48'));_0x131563['recordingURL']=_0x26acba;}else if(_0x48951d&&_0x48951d['recordingFormat']&&_0x48951d[_0xfb43('0x49')]!==_0xfb43('0x4a')){logger[_0xfb43('0x15')]('[OUTBOUND]',_0xfb43('0x48'));_0x131563[_0xfb43('0x4b')]=_0x26acba;}else{_0x131563[_0xfb43('0x4b')]='';}return getAdminId(_0xbec9f6,_0x1095d6,_0x4057d7,_0x249222)['then'](getUser(_0x1095d6,_0x4057d7,_0x249222))[_0xfb43('0x10')](getEndUser(_0x1095d6,_0x4057d7,_0x249222))[_0xfb43('0x10')](getTicket(_0x1095d6,_0x4057d7,_0x249222,_0x5a461d,_0x131563))['then'](function(_0x4e3748){logger[_0xfb43('0x15')](util[_0xfb43('0x25')](_0xfb43('0x4c'),_0x4e3748[_0xfb43('0x35')]));if(_0x1095d6!==_0xfb43('0x4d')){logger[_0xfb43('0x15')]('['+[_0x1095d6[_0xfb43('0x20')]()]+']',_0xfb43('0x4e'));emit(_0x249222,_0x596830[_0xfb43('0x4f')],_0x4e3748[_0xfb43('0x29')]);}})[_0xfb43('0x1f')](function(_0x1db522){logger[_0xfb43('0x17')]('['+[_0x1095d6['toUpperCase']()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xfb43('0x50')](_0x1db522,{'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 c57382b..8dc8fe7 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 _0x29a1=['freshsales','exec','includes','toLowerCase','queue','outbound','log','EVENT\x20UNKNOWN','data1','salesforce','zoho','servicenow','unknown\x20integration','../../../../config/logger','error','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','data3','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./freshdesk','./desk','./vtiger','./servicenow','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','desk','vtiger'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x29a1,0x124));var _0x129a=function(_0x396956,_0x4401b4){_0x396956=_0x396956-0x0;var _0x236b1c=_0x29a1[_0x396956];return _0x236b1c;};'use strict';var _=require('lodash');var util=require(_0x129a('0x0'));var zendesk=require(_0x129a('0x1'));var salesforce=require(_0x129a('0x2'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x129a('0x3'));var zoho=require('./zoho');var desk=require(_0x129a('0x4'));var vtiger=require(_0x129a('0x5'));var servicenow=require(_0x129a('0x6'));var dynamics365=require(_0x129a('0x7'));var freshsales=require(_0x129a('0x8'));var integrations=[_0x129a('0x9'),'salesforce',_0x129a('0xa'),_0x129a('0xb'),'zoho',_0x129a('0xc'),_0x129a('0xd'),'dynamics365',_0x129a('0xe'),'servicenow'];exports[_0x129a('0xf')]=function(_0x10fc46,_0x40cf93,_0x44e8b6,_0x59d7aa,_0xc71d30,_0x413074){if(_0x44e8b6){if(_[_0x129a('0x10')](integrations,_0x10fc46['data1'][_0x129a('0x11')]())){try{var _0x23dc2b=null;var _0x5db74a='';var _0x1322a3=_0x44e8b6[_0x10fc46['data1'][_0x129a('0x11')]()];if(_0x1322a3){var _0x2e4eaf=_0x1322a3[_0x10fc46['data2']];if(_0x2e4eaf){var _0x4e5016=_['find'](_0x2e4eaf['Configurations'],{'id':parseInt(_0x10fc46['data3'],0xa)});if(_0x4e5016){if(_0x59d7aa){if(_0xc71d30&&_0x40cf93[_0x129a('0x12')]){_0x5db74a='queue';}else if(_0x40cf93['routeId']){_0x5db74a=_0x129a('0x13');}else{console[_0x129a('0x14')](_0x129a('0x15'),_0x40cf93);}}else{_0x5db74a='unmanaged';}switch(_0x10fc46[_0x129a('0x16')][_0x129a('0x11')]()){case _0x129a('0x9'):zendesk[_0x5db74a](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074);break;case _0x129a('0x17'):salesforce[_0x5db74a](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074);break;case _0x129a('0xa'):sugarcrm[_0x5db74a](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074);break;case'freshdesk':freshdesk[_0x5db74a](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074);break;case _0x129a('0x18'):zoho[_0x5db74a](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074);break;case _0x129a('0xc'):desk[_0x5db74a](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074);break;case'vtiger':vtiger[_0x5db74a](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074);break;case _0x129a('0xe'):freshsales['cs'](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074,_0x5db74a);break;case _0x129a('0x19'):servicenow['cs'](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074,_0x5db74a);break;case'dynamics365':dynamics365['cs'](_0x10fc46,_0x40cf93,_0x4e5016,_0x59d7aa,_0xc71d30,_0x2e4eaf,_0x413074,_0x5db74a);break;default:console[_0x129a('0x14')](_0x129a('0x1a'));}}else{_0x23dc2b=require(_0x129a('0x1b'))(_0x10fc46['data1'][_0x129a('0x11')]());_0x23dc2b[_0x129a('0x1c')](_0x129a('0x1d'),util[_0x129a('0x1e')](_0x129a('0x1f'),_0x10fc46[_0x129a('0x16')][_0x129a('0x11')](),_0x10fc46[_0x129a('0x20')]));}}else{_0x23dc2b=require(_0x129a('0x1b'))(_0x10fc46[_0x129a('0x16')][_0x129a('0x11')]());_0x23dc2b['error'](_0x129a('0x1d'),util[_0x129a('0x1e')](_0x129a('0x21'),_0x10fc46[_0x129a('0x16')][_0x129a('0x11')](),_0x10fc46['data2']));}}else{}}catch(_0x54b36d){console[_0x129a('0x1c')](_0x54b36d);}}}}; \ No newline at end of file +var _0xa793=['data1','toLowerCase','data2','find','queue','routeId','outbound','EVENT\x20UNKNOWN','unmanaged','zendesk','unknown\x20integration','../../../../config/logger','error','format','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','%s\x20account\x20#%s\x20not\x20found','lodash','util','./sugarcrm','./zoho','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','zoho','desk','vtiger','dynamics365','freshsales','servicenow','exec','includes'];(function(_0x21205e,_0x7eb8e7){var _0x136ebb=function(_0x54aac2){while(--_0x54aac2){_0x21205e['push'](_0x21205e['shift']());}};_0x136ebb(++_0x7eb8e7);}(_0xa793,0x7a));var _0x3a79=function(_0x1ee351,_0x54261b){_0x1ee351=_0x1ee351-0x0;var _0x245aaf=_0xa793[_0x1ee351];return _0x245aaf;};'use strict';var _=require(_0x3a79('0x0'));var util=require(_0x3a79('0x1'));var zendesk=require('./zendesk');var salesforce=require('./salesforce');var sugarcrm=require(_0x3a79('0x2'));var freshdesk=require('./freshdesk');var zoho=require(_0x3a79('0x3'));var desk=require('./desk');var vtiger=require('./vtiger');var servicenow=require(_0x3a79('0x4'));var dynamics365=require(_0x3a79('0x5'));var freshsales=require(_0x3a79('0x6'));var integrations=['zendesk',_0x3a79('0x7'),_0x3a79('0x8'),_0x3a79('0x9'),_0x3a79('0xa'),_0x3a79('0xb'),_0x3a79('0xc'),_0x3a79('0xd'),_0x3a79('0xe'),_0x3a79('0xf')];exports[_0x3a79('0x10')]=function(_0x285e23,_0x543d6e,_0x4189e2,_0x2fa216,_0x4e4f2f,_0x91b976){if(_0x4189e2){if(_[_0x3a79('0x11')](integrations,_0x285e23[_0x3a79('0x12')][_0x3a79('0x13')]())){try{var _0x52ad9f=null;var _0x281393='';var _0x20decc=_0x4189e2[_0x285e23[_0x3a79('0x12')]['toLowerCase']()];if(_0x20decc){var _0x3467a7=_0x20decc[_0x285e23[_0x3a79('0x14')]];if(_0x3467a7){var _0x35bcfa=_[_0x3a79('0x15')](_0x3467a7['Configurations'],{'id':parseInt(_0x285e23['data3'],0xa)});if(_0x35bcfa){if(_0x2fa216){if(_0x4e4f2f&&_0x543d6e[_0x3a79('0x16')]){_0x281393=_0x3a79('0x16');}else if(_0x543d6e[_0x3a79('0x17')]){_0x281393=_0x3a79('0x18');}else{console['log'](_0x3a79('0x19'),_0x543d6e);}}else{_0x281393=_0x3a79('0x1a');}switch(_0x285e23[_0x3a79('0x12')][_0x3a79('0x13')]()){case _0x3a79('0x1b'):zendesk[_0x281393](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976);break;case _0x3a79('0x7'):salesforce[_0x281393](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976);break;case'sugarcrm':sugarcrm[_0x281393](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976);break;case _0x3a79('0x9'):freshdesk[_0x281393](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976);break;case _0x3a79('0xa'):zoho[_0x281393](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976);break;case _0x3a79('0xb'):desk[_0x281393](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976);break;case _0x3a79('0xc'):vtiger[_0x281393](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976);break;case'freshsales':freshsales['cs'](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976,_0x281393);break;case _0x3a79('0xf'):servicenow['cs'](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976,_0x281393);break;case _0x3a79('0xd'):dynamics365['cs'](_0x285e23,_0x543d6e,_0x35bcfa,_0x2fa216,_0x4e4f2f,_0x3467a7,_0x91b976,_0x281393);break;default:console['log'](_0x3a79('0x1c'));}}else{_0x52ad9f=require(_0x3a79('0x1d'))(_0x285e23[_0x3a79('0x12')][_0x3a79('0x13')]());_0x52ad9f[_0x3a79('0x1e')]('[EXEC]',util[_0x3a79('0x1f')](_0x3a79('0x20'),_0x285e23[_0x3a79('0x12')][_0x3a79('0x13')](),_0x285e23['data3']));}}else{_0x52ad9f=require(_0x3a79('0x1d'))(_0x285e23[_0x3a79('0x12')][_0x3a79('0x13')]());_0x52ad9f[_0x3a79('0x1e')](_0x3a79('0x21'),util['format'](_0x3a79('0x22'),_0x285e23[_0x3a79('0x12')][_0x3a79('0x13')](),_0x285e23[_0x3a79('0x14')]));}}else{}}catch(_0x1d7777){console[_0x3a79('0x1e')](_0x1d7777);}}}}; \ 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 19ee120..c76cbe1 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 _0x6d7a=['[QUEUE]','Recording\x20is\x20enabled!','recordingURL','email','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','toUpperCase','calleridname','calleridnum',']\x20Integration\x20account\x20type\x20%s.','lastevent','lodash','moment','bluebird','md5','util','ioredis','./util','../../../../config/logger','salesforce','defaults','redis','localhost','socket.io-emitter','emit','assign','getString','Subjects','Descriptions','ticketType','utc','IsReminderSet','IsRecurrence','endUserType','WhoId','account','WhatId','contact','ContactId','AccountId','lead','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','sobject','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','user_id','identity','display_name','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','$or','Contact','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Lead','first','attributes','type','toLowerCase','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','format','Caller\x20-\x20%s','','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','Variable','name','password','concat','Connection','remoteUri','clientId','clientSecret','login','username','queue','stripTrailingSlash','serverUrl'];(function(_0x5a873c,_0x2a9b6c){var _0x30fa1b=function(_0x203225){while(--_0x203225){_0x5a873c['push'](_0x5a873c['shift']());}};_0x30fa1b(++_0x2a9b6c);}(_0x6d7a,0x121));var _0xa6d7=function(_0x4b6968,_0x4c535d){_0x4b6968=_0x4b6968-0x0;var _0x89879c=_0x6d7a[_0x4b6968];return _0x89879c;};'use strict';var _=require(_0xa6d7('0x0'));var rp=require('request-promise');var moment=require(_0xa6d7('0x1'));var BPromise=require(_0xa6d7('0x2'));var md5=require(_0xa6d7('0x3'));var jsforce=require('jsforce');var util=require(_0xa6d7('0x4'));var Redis=require(_0xa6d7('0x5'));var intUtil=require(_0xa6d7('0x6'));var config=require('../../../../config/environment');var logger=require(_0xa6d7('0x7'))(_0xa6d7('0x8'));config['redis']=_[_0xa6d7('0x9')](config[_0xa6d7('0xa')],{'host':_0xa6d7('0xb'),'port':0x18eb});var io=require(_0xa6d7('0xc'))(new Redis(config[_0xa6d7('0xa')]));function emit(_0x3e3284,_0x59c830,_0x3635ec){io['to'](_0x3e3284)[_0xa6d7('0xd')](_0x59c830,_0x3635ec);}function getTicket(_0x549f2b,_0x155dd9,_0x4675af,_0x4a05ee,_0x46c825,_0x16221f,_0x2394e0,_0x519b44){var _0x266e4c=Object[_0xa6d7('0xe')]({},{'OwnerId':_0x155dd9['id'],'Subject':intUtil[_0xa6d7('0xf')](_0x4a05ee[_0xa6d7('0x10')],_0x46c825,'\x20'),'Description':intUtil[_0xa6d7('0xf')](_0x4a05ee[_0xa6d7('0x11')],_0x46c825,'\x0a')},getCustomFields(_0x16221f,_0x46c825));if(_0x4675af){if(_0x4a05ee[_0xa6d7('0x12')]==='Task'){_0x266e4c['ActivityDate']=moment[_0xa6d7('0x13')]();_0x266e4c[_0xa6d7('0x14')]=![];_0x266e4c[_0xa6d7('0x15')]=![];if(_0x4675af[_0xa6d7('0x16')]==='contact'||_0x4675af['endUserType']==='lead'){_0x266e4c[_0xa6d7('0x17')]=_0x4675af['id'];}else if(_0x4675af[_0xa6d7('0x16')]===_0xa6d7('0x18')){_0x266e4c[_0xa6d7('0x19')]=_0x4675af['id'];}}else if(_0x4a05ee[_0xa6d7('0x12')]==='Case'){if(_0x4675af[_0xa6d7('0x16')]===_0xa6d7('0x1a')){_0x266e4c[_0xa6d7('0x1b')]=_0x4675af['id'];}else if(_0x4675af['endUserType']===_0xa6d7('0x18')){_0x266e4c[_0xa6d7('0x1c')]=_0x4675af['id'];}else if(_0x4675af['endUserType']===_0xa6d7('0x1d')&&_0x4a05ee[_0xa6d7('0x1e')]){_0x266e4c[_0x4a05ee[_0xa6d7('0x1e')]]=_0x4675af['id'];}else{logger[_0xa6d7('0x1f')](_0xa6d7('0x20'));}}}return _0x2394e0['sobject'](_0x4a05ee[_0xa6d7('0x12')])[_0xa6d7('0x21')](_0x266e4c);}function getUser(_0x56b1e3,_0x34c3e1,_0x3b953d){if(!_[_0xa6d7('0x22')](_0x34c3e1)&&intUtil[_0xa6d7('0x23')](_0x34c3e1)){var _0x205064={'Email':_0x34c3e1};var _0x343216={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3b953d[_0xa6d7('0x24')](_0xa6d7('0x25'))[_0xa6d7('0x26')](_0x205064,_0x343216)[_0xa6d7('0x27')]()[_0xa6d7('0x28')](function(_0x902686){if(_0x902686[_0xa6d7('0x29')]){var _0xe1c989=_[_0xa6d7('0x26')](_0x902686,function(_0x163adf){return _0x163adf[_0xa6d7('0x2a')]===_0x34c3e1;});if(_0xe1c989){logger[_0xa6d7('0x1f')](_0xa6d7('0x2b'),_0x34c3e1);return BPromise[_0xa6d7('0x2c')]({'id':_0xe1c989['Id'],'name':_0xe1c989[_0xa6d7('0x2d')]});}}else{logger[_0xa6d7('0x1f')](_0xa6d7('0x2e'),_0x34c3e1);return _0x3b953d['identity']()[_0xa6d7('0x28')](function(_0x145e9d){return BPromise[_0xa6d7('0x2c')]({'id':_0x145e9d[_0xa6d7('0x2f')],'name':_0x145e9d['display_name']});});}});}else{logger[_0xa6d7('0x1f')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x34c3e1);return _0x3b953d[_0xa6d7('0x30')]()['then'](function(_0x1852c8){return BPromise[_0xa6d7('0x2c')]({'id':_0x1852c8[_0xa6d7('0x2f')],'name':_0x1852c8[_0xa6d7('0x31')]});});}}function getEndUser(_0x274541,_0x236ec4,_0xcdf15e,_0x5e99aa,_0x2554f7){var _0x1f580e={'$or':{'Phone':_0x5e99aa}};var _0x5eeeef={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()[_0xa6d7('0x28')](function(){logger[_0xa6d7('0x1f')]('Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.',_0x5e99aa,_0x236ec4[_0xa6d7('0x32')]);switch(_0x236ec4[_0xa6d7('0x32')]){case _0xa6d7('0x33'):var _0x87e17=_[_0xa6d7('0x34')](_0x1f580e);if(_0x236ec4[_0xa6d7('0x35')]){var _0x23f525={};_0x23f525[_0x236ec4['additionalSearchContact']]=_0x5e99aa;_[_0xa6d7('0x36')](_0x87e17[_0xa6d7('0x37')],_0x23f525);}return _0x2554f7[_0xa6d7('0x24')](_0xa6d7('0x38'))[_0xa6d7('0x26')](_0x87e17,_0x5eeeef)[_0xa6d7('0x27')]()[_0xa6d7('0x28')](function(_0x3077f7){if(_0x3077f7&&_0x3077f7[_0xa6d7('0x29')]){return _0x3077f7;}else{var _0x361f3c=_[_0xa6d7('0x34')](_0x1f580e);if(_0x236ec4['additionalSearchLead']){var _0x4d3772={};_0x4d3772[_0x236ec4[_0xa6d7('0x39')]]=_0x5e99aa;_[_0xa6d7('0x36')](_0x361f3c[_0xa6d7('0x37')],_0x4d3772);}return _0x2554f7[_0xa6d7('0x24')]('Lead')[_0xa6d7('0x26')](_0x361f3c,_0x5eeeef);}});case _0xa6d7('0x3a'):var _0x48f186=_[_0xa6d7('0x34')](_0x1f580e);if(_0x236ec4[_0xa6d7('0x3b')]){var _0x23f525={};_0x23f525[_0x236ec4[_0xa6d7('0x3b')]]=_0x5e99aa;_[_0xa6d7('0x36')](_0x48f186['$or'],_0x23f525);}return _0x2554f7['sobject'](_0xa6d7('0x3c'))[_0xa6d7('0x26')](_0x48f186,_0x5eeeef)['execute']()['then'](function(_0x292b55){if(_0x292b55&&_0x292b55['length']){return _0x292b55;}else{var _0xac8d55=_[_0xa6d7('0x34')](_0x1f580e);if(_0x236ec4[_0xa6d7('0x35')]){var _0x4f0ee6={};_0x4f0ee6[_0x236ec4[_0xa6d7('0x35')]]=_0x5e99aa;_[_0xa6d7('0x36')](_0xac8d55[_0xa6d7('0x37')],_0x4f0ee6);}return _0x2554f7[_0xa6d7('0x24')](_0xa6d7('0x38'))[_0xa6d7('0x26')](_0xac8d55,_0x5eeeef)[_0xa6d7('0x28')](function(_0x35a43f){if(_0x35a43f&&_0x35a43f[_0xa6d7('0x29')]){return _0x35a43f;}else{var _0x1fe7ca=_[_0xa6d7('0x34')](_0x1f580e);if(_0x236ec4[_0xa6d7('0x39')]){var _0x27a699={};_0x27a699[_0x236ec4[_0xa6d7('0x39')]]=_0x5e99aa;_[_0xa6d7('0x36')](_0x1fe7ca[_0xa6d7('0x37')],_0x27a699);}return _0x2554f7['sobject'](_0xa6d7('0x3d'))['find'](_0x1fe7ca,_0x5eeeef);}});}});case _0xa6d7('0x1a'):var _0x87e17=_[_0xa6d7('0x34')](_0x1f580e);if(_0x236ec4['additionalSearchContact']){var _0x23f525={};_0x23f525[_0x236ec4[_0xa6d7('0x35')]]=_0x5e99aa;_['merge'](_0x87e17['$or'],_0x23f525);}return _0x2554f7[_0xa6d7('0x24')]('Contact')[_0xa6d7('0x26')](_0x87e17,_0x5eeeef)[_0xa6d7('0x27')]();case _0xa6d7('0x1d'):var _0x30bf00=_['cloneDeep'](_0x1f580e);if(_0x236ec4['additionalSearchLead']){var _0x23f525={};_0x23f525[_0x236ec4[_0xa6d7('0x39')]]=_0x5e99aa;_[_0xa6d7('0x36')](_0x30bf00['$or'],_0x23f525);}return _0x2554f7[_0xa6d7('0x24')](_0xa6d7('0x3d'))[_0xa6d7('0x26')](_0x30bf00,_0x5eeeef);case _0xa6d7('0x18'):var _0x48f186=_[_0xa6d7('0x34')](_0x1f580e);if(_0x236ec4[_0xa6d7('0x3b')]){var _0x23f525={};_0x23f525[_0x236ec4[_0xa6d7('0x3b')]]=_0x5e99aa;_['merge'](_0x48f186[_0xa6d7('0x37')],_0x23f525);}return _0x2554f7[_0xa6d7('0x24')](_0xa6d7('0x3c'))[_0xa6d7('0x26')](_0x48f186,_0x5eeeef);default:return null;}})[_0xa6d7('0x28')](function(_0x417170){if(_0x417170&&_0x417170[_0xa6d7('0x29')]){var _0x250199=_[_0xa6d7('0x3e')](_0x417170);if(_0x250199){return BPromise[_0xa6d7('0x2c')]({'id':_0x250199['Id'],'name':_0x250199[_0xa6d7('0x2d')],'phone':_0x250199['Phone'],'endUserType':_0x250199[_0xa6d7('0x3f')][_0xa6d7('0x40')][_0xa6d7('0x41')]()});}}})[_0xa6d7('0x28')](function(_0x1c8ce5){if(_0x1c8ce5){logger[_0xa6d7('0x1f')]('Enduser\x20(%s)\x20with\x20phone\x20%s\x20found',_0x1c8ce5[_0xa6d7('0x16')],_0x5e99aa);return BPromise[_0xa6d7('0x2c')](_0x1c8ce5);}else{logger['info'](_0xa6d7('0x42'),_0x5e99aa);var _0xeecee0={'Phone':_0x5e99aa};if(_0x236ec4[_0xa6d7('0x43')]){if(_0x236ec4['moduleCreate']==='contact'){logger[_0xa6d7('0x1f')](_0xa6d7('0x44'),_0x5e99aa,_0x236ec4[_0xa6d7('0x43')]);_0xeecee0[_0xa6d7('0x45')]=_0xcdf15e!==''?_0xcdf15e:util[_0xa6d7('0x46')](_0xa6d7('0x47'),_0x5e99aa);}else if(_0x236ec4['moduleCreate']===_0xa6d7('0x1d')){logger['info'](_0xa6d7('0x44'),_0x5e99aa,_0x236ec4['moduleCreate']);_0xeecee0[_0xa6d7('0x45')]=_0xcdf15e!==_0xa6d7('0x48')?_0xcdf15e:util[_0xa6d7('0x46')](_0xa6d7('0x47'),_0x5e99aa);_0xeecee0[_0xa6d7('0x49')]=_0xa6d7('0x4a');}else if(_0x236ec4[_0xa6d7('0x43')]===_0xa6d7('0x18')){logger['info'](_0xa6d7('0x44'),_0x5e99aa,_0x236ec4[_0xa6d7('0x43')]);_0xeecee0[_0xa6d7('0x2d')]=_0xcdf15e!==_0xa6d7('0x48')?_0xcdf15e:util[_0xa6d7('0x46')](_0xa6d7('0x47'),_0x5e99aa);}else{return null;}}return _0x2554f7[_0xa6d7('0x24')](_[_0xa6d7('0x4b')](_0x236ec4[_0xa6d7('0x43')]))[_0xa6d7('0x21')](_0xeecee0)[_0xa6d7('0x28')](function(_0x4403b8){return BPromise['resolve']({'id':_0x4403b8['id'],'endUserType':_0x236ec4['moduleCreate']});});}});}function getCustomFields(_0x3138c8,_0x484d9a){var _0x336e52={};if(_0x3138c8[_0xa6d7('0x29')]>0x0){_[_0xa6d7('0x4c')](_0x3138c8,function(_0x4bf08b){if(_[_0xa6d7('0x4d')]([_0xa6d7('0x4e'),_0xa6d7('0x4f')],_0x4bf08b[_0xa6d7('0x40')])&&_0x4bf08b['idField']){_0x336e52[_0x4bf08b[_0xa6d7('0x50')]]=_0x4bf08b[_0xa6d7('0x51')][_0xa6d7('0x52')]();}else if(_0x4bf08b['type']===_0xa6d7('0x53')&&_0x4bf08b[_0xa6d7('0x54')]&&_0x4bf08b[_0xa6d7('0x50')]){_0x484d9a[_0x4bf08b[_0xa6d7('0x54')]]&&(_0x336e52[_0x4bf08b[_0xa6d7('0x50')]]=_0x484d9a[_0x4bf08b[_0xa6d7('0x54')]][_0xa6d7('0x52')]());}else if(_0x4bf08b[_0xa6d7('0x40')]==='customVariable'&&_0x4bf08b[_0xa6d7('0x55')]&&_0x4bf08b[_0xa6d7('0x55')][_0xa6d7('0x56')]&&_0x4bf08b['idField']){_0x484d9a[_0x4bf08b[_0xa6d7('0x55')][_0xa6d7('0x56')][_0xa6d7('0x41')]()]&&(_0x336e52[_0x4bf08b[_0xa6d7('0x50')]]=_0x484d9a[_0x4bf08b['Variable'][_0xa6d7('0x56')]['toLowerCase']()][_0xa6d7('0x52')]());}});}return _0x336e52;}function getConnection(_0x448db9){var _0x26e321=_0x448db9[_0xa6d7('0x57')][_0xa6d7('0x58')](_0x448db9['securityToken']);var _0x1abb75=new jsforce[(_0xa6d7('0x59'))]({'oauth2':{'loginUrl':_0x448db9[_0xa6d7('0x5a')]||'https://login.salesforce.com','clientId':_0x448db9[_0xa6d7('0x5b')],'clientSecret':_0x448db9[_0xa6d7('0x5c')]}});return _0x1abb75[_0xa6d7('0x5d')](_0x448db9[_0xa6d7('0x5e')],_0x26e321)['then'](function(){logger[_0xa6d7('0x1f')]('Connection\x20established.');return _0x1abb75;});}exports[_0xa6d7('0x5f')]=function(_0x864b95,_0x46c38f,_0x2a541d,_0x51684a,_0x59d6aa,_0x3fb383){var _0x31bb87,_0x4b91f,_0x407b84,_0xbdbcaf;_0x3fb383['serverUrl']=intUtil[_0xa6d7('0x60')](_0x3fb383[_0xa6d7('0x61')]);_0x3fb383[_0xa6d7('0x5a')]=intUtil[_0xa6d7('0x60')](_0x3fb383[_0xa6d7('0x5a')]);if(_0x59d6aa&&_0x59d6aa['monitor_format']){logger[_0xa6d7('0x1f')](_0xa6d7('0x62'),_0xa6d7('0x63'));_0x46c38f[_0xa6d7('0x64')]=util[_0xa6d7('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3fb383[_0xa6d7('0x61')],_0x46c38f['uniqueid'],md5(_0x46c38f['uniqueid']));}else{_0x46c38f[_0xa6d7('0x64')]='';}return getConnection(_0x3fb383)[_0xa6d7('0x28')](function(_0x35831e){_0xbdbcaf=_0x35831e;return getUser(_0x3fb383,_0x51684a[_0xa6d7('0x65')],_0xbdbcaf);})['then'](function(_0x49c948){_0x31bb87=_0x49c948;return getEndUser(_0x3fb383,_0x2a541d,_0x46c38f['calleridname'],_0x46c38f['calleridnum'],_0xbdbcaf);})[_0xa6d7('0x28')](function(_0x5588e8){_0x4b91f=_0x5588e8;return getTicket(_0x3fb383,_0x31bb87,_0x4b91f,_0x2a541d,_0x46c38f,_0x2a541d[_0xa6d7('0x66')],_0xbdbcaf,'queue');})[_0xa6d7('0x28')](function(_0x4a5fc3){_0x407b84=_0x4a5fc3;logger[_0xa6d7('0x1f')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x407b84['id']);logger[_0xa6d7('0x1f')](_0xa6d7('0x67'),_0x407b84['id'],_0x51684a['name'],_0x3fb383[_0xa6d7('0x40')]);switch(_0x3fb383['type']){case _0xa6d7('0x68'):emit(util['format'](_0xa6d7('0x69'),_0x51684a[_0xa6d7('0x56')]),_0xa6d7('0x6a'),{'recordId':_0x407b84['id']});break;case _0xa6d7('0x6b'):emit(util[_0xa6d7('0x46')](_0xa6d7('0x69'),_0x51684a['name']),_0xa6d7('0x6c'),{'uri':util[_0xa6d7('0x46')]('%s/%s/e',_0xbdbcaf[_0xa6d7('0x6d')],_0x407b84['id'])});break;default:logger[_0xa6d7('0x6e')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xa6d7('0x6f')](function(_0x34bf6c){logger['error'](_0xa6d7('0x62'),_0x34bf6c);});};exports[_0xa6d7('0x70')]=function(_0x131265,_0x42536f,_0x486760,_0x4daa97,_0x16cab5,_0xba585f,_0x3c5f6e){var _0x401c65,_0x48aecc,_0x335cb8,_0x248bca;_0xba585f[_0xa6d7('0x61')]=intUtil['stripTrailingSlash'](_0xba585f[_0xa6d7('0x61')]);_0xba585f[_0xa6d7('0x5a')]=intUtil[_0xa6d7('0x60')](_0xba585f[_0xa6d7('0x5a')]);if(_0x3c5f6e&&_0x3c5f6e[_0xa6d7('0x71')]&&_0x3c5f6e[_0xa6d7('0x71')]!=='none'){logger[_0xa6d7('0x1f')](_0xa6d7('0x72'),'Recording\x20is\x20enabled!');_0x42536f['recordingURL']=util[_0xa6d7('0x46')](_0xa6d7('0x73'),_0xba585f['serverUrl'],_0x42536f[_0xa6d7('0x74')],md5(_0x42536f[_0xa6d7('0x74')]));}return getConnection(_0xba585f)[_0xa6d7('0x28')](function(_0x365191){_0x248bca=_0x365191;return getUser(_0xba585f,_0x4daa97[_0xa6d7('0x65')],_0x248bca);})[_0xa6d7('0x28')](function(_0x5f7b66){_0x401c65=_0x5f7b66;return getEndUser(_0xba585f,_0x486760,_0x42536f['destcalleridname'],_0x42536f[_0xa6d7('0x75')],_0x248bca);})[_0xa6d7('0x28')](function(_0x1ff01c){_0x48aecc=_0x1ff01c;return getTicket(_0xba585f,_0x401c65,_0x48aecc,_0x486760,_0x42536f,_0x486760['Fields'],_0x248bca,'outbound');})[_0xa6d7('0x28')](function(_0xdd8c16){_0x335cb8=_0xdd8c16;logger[_0xa6d7('0x1f')](_0xa6d7('0x76'),_0x335cb8['id']);logger['info'](_0xa6d7('0x77'),_0x335cb8['id'],_0x4daa97[_0xa6d7('0x56')],_0xba585f['type']);switch(_0xba585f[_0xa6d7('0x40')]){case'integrationTab':emit(util[_0xa6d7('0x46')]('user:%s',_0x4daa97[_0xa6d7('0x56')]),_0xa6d7('0x6a'),{'recordId':_0x335cb8['id']});break;case _0xa6d7('0x6b'):emit(util[_0xa6d7('0x46')](_0xa6d7('0x69'),_0x4daa97['name']),_0xa6d7('0x6c'),{'uri':util['format'](_0xa6d7('0x78'),_0x248bca[_0xa6d7('0x6d')],_0x335cb8['id'])});break;default:logger[_0xa6d7('0x6e')]('[OUTBOUND]',_0xa6d7('0x79'));}})[_0xa6d7('0x6f')](function(_0x1178e3){logger[_0xa6d7('0x6e')](_0xa6d7('0x72'),_0x1178e3);});};exports[_0xa6d7('0x7a')]=function(_0x2dea1c,_0x281837,_0x326c8e,_0x569a45,_0x3e8189,_0x4f0cd0){var _0x316de8,_0x53821d,_0x1b88e3,_0x4dee62;_0x4f0cd0['serverUrl']=intUtil[_0xa6d7('0x60')](_0x4f0cd0[_0xa6d7('0x61')]);_0x4f0cd0[_0xa6d7('0x5a')]=intUtil[_0xa6d7('0x60')](_0x4f0cd0[_0xa6d7('0x5a')]);if(_0x3e8189&&_0x3e8189[_0xa6d7('0x7b')]){logger['info']('['+_0x281837['lastevent'][_0xa6d7('0x7c')]()+']',_0xa6d7('0x63'));_0x281837['recordingURL']=util[_0xa6d7('0x46')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4f0cd0['serverUrl'],_0x281837[_0xa6d7('0x74')],md5(_0x281837['uniqueid']));}else{_0x281837[_0xa6d7('0x64')]='';}return getConnection(_0x4f0cd0)[_0xa6d7('0x28')](function(_0x3da232){_0x4dee62=_0x3da232;if(!_[_0xa6d7('0x22')](_0x569a45)){return getUser(_0x4f0cd0,_0x569a45[_0xa6d7('0x56')],_0x4dee62);}else{return getUser(_0x4f0cd0,null,_0x4dee62);}})[_0xa6d7('0x28')](function(_0x838949){_0x316de8=_0x838949;return getEndUser(_0x4f0cd0,_0x326c8e,_0x281837[_0xa6d7('0x7d')],_0x281837[_0xa6d7('0x7e')],_0x4dee62);})[_0xa6d7('0x28')](function(_0x403287){_0x53821d=_0x403287;return getTicket(_0x4f0cd0,_0x316de8,_0x53821d,_0x326c8e,_0x281837,_0x326c8e[_0xa6d7('0x66')],_0x4dee62);})[_0xa6d7('0x28')](function(_0x201522){_0x1b88e3=_0x201522;logger['info']('['+_0x281837['lastevent']['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x1b88e3['id']);logger[_0xa6d7('0x1f')]('['+_0x281837['lastevent'][_0xa6d7('0x7c')]()+_0xa6d7('0x7f'),_0x4f0cd0[_0xa6d7('0x40')]);})['catch'](function(_0x27d433){logger[_0xa6d7('0x6e')]('['+_0x281837[_0xa6d7('0x80')][_0xa6d7('0x7c')]()+']',_0x27d433);});}; \ No newline at end of file +var _0xc623=['none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','outbound','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','md5','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','socket.io-emitter','getString','Descriptions','ticketType','Task','ActivityDate','IsReminderSet','IsRecurrence','endUserType','contact','WhoId','account','WhatId','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','validateEmail','find','Agent\x20%s\x20found.','resolve','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','merge','execute','length','$or','Lead','account_contact_lead','additionalSearchAccount','additionalSearchLead','Contact','lead','Account','first','Name','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','Company','No\x20Company','upperFirst','forEach','includes','string','picklist','idField','content','toString','variable','variableName','customVariable','Variable','name','password','concat','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','recordingFormat'];(function(_0x1edaaa,_0x48e785){var _0x51ae3c=function(_0x1aae98){while(--_0x1aae98){_0x1edaaa['push'](_0x1edaaa['shift']());}};_0x51ae3c(++_0x48e785);}(_0xc623,0x110));var _0x3c62=function(_0x5a2535,_0x1e3af2){_0x5a2535=_0x5a2535-0x0;var _0x40f37a=_0xc623[_0x5a2535];return _0x40f37a;};'use strict';var _=require(_0x3c62('0x0'));var rp=require(_0x3c62('0x1'));var moment=require('moment');var BPromise=require('bluebird');var md5=require(_0x3c62('0x2'));var jsforce=require(_0x3c62('0x3'));var util=require(_0x3c62('0x4'));var Redis=require('ioredis');var intUtil=require(_0x3c62('0x5'));var config=require(_0x3c62('0x6'));var logger=require(_0x3c62('0x7'))(_0x3c62('0x8'));config[_0x3c62('0x9')]=_[_0x3c62('0xa')](config[_0x3c62('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x3c62('0xb'))(new Redis(config[_0x3c62('0x9')]));function emit(_0x19daa5,_0x285ab9,_0x25a845){io['to'](_0x19daa5)['emit'](_0x285ab9,_0x25a845);}function getTicket(_0x36b00a,_0x2860c5,_0x739c34,_0x4e4be7,_0x55c7ad,_0x5c3d0c,_0x25e0df,_0x168de2){var _0x1a6783=Object['assign']({},{'OwnerId':_0x2860c5['id'],'Subject':intUtil[_0x3c62('0xc')](_0x4e4be7['Subjects'],_0x55c7ad,'\x20'),'Description':intUtil[_0x3c62('0xc')](_0x4e4be7[_0x3c62('0xd')],_0x55c7ad,'\x0a')},getCustomFields(_0x5c3d0c,_0x55c7ad));if(_0x739c34){if(_0x4e4be7[_0x3c62('0xe')]===_0x3c62('0xf')){_0x1a6783[_0x3c62('0x10')]=moment['utc']();_0x1a6783[_0x3c62('0x11')]=![];_0x1a6783[_0x3c62('0x12')]=![];if(_0x739c34[_0x3c62('0x13')]===_0x3c62('0x14')||_0x739c34[_0x3c62('0x13')]==='lead'){_0x1a6783[_0x3c62('0x15')]=_0x739c34['id'];}else if(_0x739c34[_0x3c62('0x13')]===_0x3c62('0x16')){_0x1a6783[_0x3c62('0x17')]=_0x739c34['id'];}}else if(_0x4e4be7[_0x3c62('0xe')]==='Case'){if(_0x739c34[_0x3c62('0x13')]==='contact'){_0x1a6783[_0x3c62('0x18')]=_0x739c34['id'];}else if(_0x739c34[_0x3c62('0x13')]===_0x3c62('0x16')){_0x1a6783[_0x3c62('0x19')]=_0x739c34['id'];}else if(_0x739c34['endUserType']==='lead'&&_0x4e4be7[_0x3c62('0x1a')]){_0x1a6783[_0x4e4be7['leadId']]=_0x739c34['id'];}else{logger[_0x3c62('0x1b')](_0x3c62('0x1c'));}}}return _0x25e0df[_0x3c62('0x1d')](_0x4e4be7[_0x3c62('0xe')])[_0x3c62('0x1e')](_0x1a6783);}function getUser(_0x35fd85,_0x3b7a0f,_0x3d66da){if(!_[_0x3c62('0x1f')](_0x3b7a0f)&&intUtil[_0x3c62('0x20')](_0x3b7a0f)){var _0x167f67={'Email':_0x3b7a0f};var _0x12f01e={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3d66da[_0x3c62('0x1d')]('User')[_0x3c62('0x21')](_0x167f67,_0x12f01e)['execute']()['then'](function(_0x4682e0){if(_0x4682e0['length']){var _0x5a40e7=_[_0x3c62('0x21')](_0x4682e0,function(_0x5d4211){return _0x5d4211['Email']===_0x3b7a0f;});if(_0x5a40e7){logger['info'](_0x3c62('0x22'),_0x3b7a0f);return BPromise[_0x3c62('0x23')]({'id':_0x5a40e7['Id'],'name':_0x5a40e7['Name']});}}else{logger[_0x3c62('0x1b')](_0x3c62('0x24'),_0x3b7a0f);return _0x3d66da[_0x3c62('0x25')]()[_0x3c62('0x26')](function(_0x4f98b5){return BPromise[_0x3c62('0x23')]({'id':_0x4f98b5[_0x3c62('0x27')],'name':_0x4f98b5[_0x3c62('0x28')]});});}});}else{logger[_0x3c62('0x1b')](_0x3c62('0x24'),_0x3b7a0f);return _0x3d66da[_0x3c62('0x25')]()[_0x3c62('0x26')](function(_0x347579){return BPromise[_0x3c62('0x23')]({'id':_0x347579[_0x3c62('0x27')],'name':_0x347579[_0x3c62('0x28')]});});}}function getEndUser(_0x4b3d4e,_0x36ad06,_0x358e3d,_0x33b580,_0x17d56){var _0x52c0c7={'$or':{'Phone':_0x33b580}};var _0x34b460={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x3c62('0x23')]()[_0x3c62('0x26')](function(){logger['info'](_0x3c62('0x29'),_0x33b580,_0x36ad06[_0x3c62('0x2a')]);switch(_0x36ad06[_0x3c62('0x2a')]){case _0x3c62('0x2b'):var _0x4828ea=_[_0x3c62('0x2c')](_0x52c0c7);if(_0x36ad06[_0x3c62('0x2d')]){var _0x734754={};_0x734754[_0x36ad06[_0x3c62('0x2d')]]=_0x33b580;_[_0x3c62('0x2e')](_0x4828ea['$or'],_0x734754);}return _0x17d56[_0x3c62('0x1d')]('Contact')[_0x3c62('0x21')](_0x4828ea,_0x34b460)[_0x3c62('0x2f')]()[_0x3c62('0x26')](function(_0x58e984){if(_0x58e984&&_0x58e984[_0x3c62('0x30')]){return _0x58e984;}else{var _0x46d2c6=_['cloneDeep'](_0x52c0c7);if(_0x36ad06['additionalSearchLead']){var _0x3d5406={};_0x3d5406[_0x36ad06['additionalSearchLead']]=_0x33b580;_['merge'](_0x46d2c6[_0x3c62('0x31')],_0x3d5406);}return _0x17d56[_0x3c62('0x1d')](_0x3c62('0x32'))[_0x3c62('0x21')](_0x46d2c6,_0x34b460);}});case _0x3c62('0x33'):var _0x2a8b43=_['cloneDeep'](_0x52c0c7);if(_0x36ad06[_0x3c62('0x34')]){var _0x734754={};_0x734754[_0x36ad06[_0x3c62('0x34')]]=_0x33b580;_[_0x3c62('0x2e')](_0x2a8b43['$or'],_0x734754);}return _0x17d56['sobject']('Account')[_0x3c62('0x21')](_0x2a8b43,_0x34b460)['execute']()['then'](function(_0xeb275f){if(_0xeb275f&&_0xeb275f[_0x3c62('0x30')]){return _0xeb275f;}else{var _0x1bbc57=_['cloneDeep'](_0x52c0c7);if(_0x36ad06[_0x3c62('0x2d')]){var _0x124d06={};_0x124d06[_0x36ad06[_0x3c62('0x2d')]]=_0x33b580;_[_0x3c62('0x2e')](_0x1bbc57[_0x3c62('0x31')],_0x124d06);}return _0x17d56[_0x3c62('0x1d')]('Contact')[_0x3c62('0x21')](_0x1bbc57,_0x34b460)[_0x3c62('0x26')](function(_0x1a980f){if(_0x1a980f&&_0x1a980f[_0x3c62('0x30')]){return _0x1a980f;}else{var _0x5726df=_[_0x3c62('0x2c')](_0x52c0c7);if(_0x36ad06[_0x3c62('0x35')]){var _0x3565b8={};_0x3565b8[_0x36ad06['additionalSearchLead']]=_0x33b580;_[_0x3c62('0x2e')](_0x5726df[_0x3c62('0x31')],_0x3565b8);}return _0x17d56['sobject'](_0x3c62('0x32'))[_0x3c62('0x21')](_0x5726df,_0x34b460);}});}});case _0x3c62('0x14'):var _0x4828ea=_[_0x3c62('0x2c')](_0x52c0c7);if(_0x36ad06['additionalSearchContact']){var _0x734754={};_0x734754[_0x36ad06[_0x3c62('0x2d')]]=_0x33b580;_[_0x3c62('0x2e')](_0x4828ea[_0x3c62('0x31')],_0x734754);}return _0x17d56[_0x3c62('0x1d')](_0x3c62('0x36'))[_0x3c62('0x21')](_0x4828ea,_0x34b460)[_0x3c62('0x2f')]();case _0x3c62('0x37'):var _0x48c65b=_['cloneDeep'](_0x52c0c7);if(_0x36ad06[_0x3c62('0x35')]){var _0x734754={};_0x734754[_0x36ad06[_0x3c62('0x35')]]=_0x33b580;_['merge'](_0x48c65b[_0x3c62('0x31')],_0x734754);}return _0x17d56[_0x3c62('0x1d')](_0x3c62('0x32'))[_0x3c62('0x21')](_0x48c65b,_0x34b460);case _0x3c62('0x16'):var _0x2a8b43=_[_0x3c62('0x2c')](_0x52c0c7);if(_0x36ad06[_0x3c62('0x34')]){var _0x734754={};_0x734754[_0x36ad06[_0x3c62('0x34')]]=_0x33b580;_[_0x3c62('0x2e')](_0x2a8b43['$or'],_0x734754);}return _0x17d56['sobject'](_0x3c62('0x38'))[_0x3c62('0x21')](_0x2a8b43,_0x34b460);default:return null;}})[_0x3c62('0x26')](function(_0x2cce02){if(_0x2cce02&&_0x2cce02[_0x3c62('0x30')]){var _0x211366=_[_0x3c62('0x39')](_0x2cce02);if(_0x211366){return BPromise['resolve']({'id':_0x211366['Id'],'name':_0x211366[_0x3c62('0x3a')],'phone':_0x211366['Phone'],'endUserType':_0x211366[_0x3c62('0x3b')][_0x3c62('0x3c')][_0x3c62('0x3d')]()});}}})[_0x3c62('0x26')](function(_0x2307a2){if(_0x2307a2){logger[_0x3c62('0x1b')](_0x3c62('0x3e'),_0x2307a2[_0x3c62('0x13')],_0x33b580);return BPromise[_0x3c62('0x23')](_0x2307a2);}else{logger[_0x3c62('0x1b')](_0x3c62('0x3f'),_0x33b580);var _0x3f8ebd={'Phone':_0x33b580};if(_0x36ad06[_0x3c62('0x40')]){if(_0x36ad06['moduleCreate']===_0x3c62('0x14')){logger[_0x3c62('0x1b')](_0x3c62('0x41'),_0x33b580,_0x36ad06[_0x3c62('0x40')]);_0x3f8ebd[_0x3c62('0x42')]=_0x358e3d!==_0x3c62('0x43')?_0x358e3d:util[_0x3c62('0x44')](_0x3c62('0x45'),_0x33b580);}else if(_0x36ad06[_0x3c62('0x40')]===_0x3c62('0x37')){logger[_0x3c62('0x1b')](_0x3c62('0x41'),_0x33b580,_0x36ad06['moduleCreate']);_0x3f8ebd[_0x3c62('0x42')]=_0x358e3d!==''?_0x358e3d:util[_0x3c62('0x44')](_0x3c62('0x45'),_0x33b580);_0x3f8ebd[_0x3c62('0x46')]=_0x3c62('0x47');}else if(_0x36ad06[_0x3c62('0x40')]===_0x3c62('0x16')){logger['info'](_0x3c62('0x41'),_0x33b580,_0x36ad06[_0x3c62('0x40')]);_0x3f8ebd[_0x3c62('0x3a')]=_0x358e3d!==_0x3c62('0x43')?_0x358e3d:util[_0x3c62('0x44')](_0x3c62('0x45'),_0x33b580);}else{return null;}}return _0x17d56[_0x3c62('0x1d')](_[_0x3c62('0x48')](_0x36ad06['moduleCreate']))['create'](_0x3f8ebd)[_0x3c62('0x26')](function(_0x35aab9){return BPromise[_0x3c62('0x23')]({'id':_0x35aab9['id'],'endUserType':_0x36ad06[_0x3c62('0x40')]});});}});}function getCustomFields(_0x59c2db,_0x466a95){var _0x3d8661={};if(_0x59c2db[_0x3c62('0x30')]>0x0){_[_0x3c62('0x49')](_0x59c2db,function(_0x384b65){if(_[_0x3c62('0x4a')]([_0x3c62('0x4b'),_0x3c62('0x4c')],_0x384b65[_0x3c62('0x3c')])&&_0x384b65[_0x3c62('0x4d')]){_0x3d8661[_0x384b65[_0x3c62('0x4d')]]=_0x384b65[_0x3c62('0x4e')][_0x3c62('0x4f')]();}else if(_0x384b65['type']===_0x3c62('0x50')&&_0x384b65['variableName']&&_0x384b65[_0x3c62('0x4d')]){_0x466a95[_0x384b65[_0x3c62('0x51')]]&&(_0x3d8661[_0x384b65['idField']]=_0x466a95[_0x384b65[_0x3c62('0x51')]][_0x3c62('0x4f')]());}else if(_0x384b65[_0x3c62('0x3c')]===_0x3c62('0x52')&&_0x384b65[_0x3c62('0x53')]&&_0x384b65['Variable']['name']&&_0x384b65['idField']){_0x466a95[_0x384b65[_0x3c62('0x53')][_0x3c62('0x54')][_0x3c62('0x3d')]()]&&(_0x3d8661[_0x384b65[_0x3c62('0x4d')]]=_0x466a95[_0x384b65[_0x3c62('0x53')][_0x3c62('0x54')][_0x3c62('0x3d')]()][_0x3c62('0x4f')]());}});}return _0x3d8661;}function getConnection(_0x51eac0){var _0x57abb2=_0x51eac0[_0x3c62('0x55')][_0x3c62('0x56')](_0x51eac0['securityToken']);var _0x134ad0=new jsforce[(_0x3c62('0x57'))]({'oauth2':{'loginUrl':_0x51eac0[_0x3c62('0x58')]||_0x3c62('0x59'),'clientId':_0x51eac0[_0x3c62('0x5a')],'clientSecret':_0x51eac0[_0x3c62('0x5b')]}});return _0x134ad0[_0x3c62('0x5c')](_0x51eac0[_0x3c62('0x5d')],_0x57abb2)[_0x3c62('0x26')](function(){logger[_0x3c62('0x1b')](_0x3c62('0x5e'));return _0x134ad0;});}exports[_0x3c62('0x5f')]=function(_0x1c18d8,_0x3b126b,_0x19124a,_0x31dc5d,_0x39bbc4,_0x2873b5){var _0x39184a,_0x518b3c,_0x6790ed,_0x4b9fa6;_0x2873b5[_0x3c62('0x60')]=intUtil[_0x3c62('0x61')](_0x2873b5[_0x3c62('0x60')]);_0x2873b5[_0x3c62('0x58')]=intUtil[_0x3c62('0x61')](_0x2873b5[_0x3c62('0x58')]);if(_0x39bbc4&&_0x39bbc4[_0x3c62('0x62')]){logger['info'](_0x3c62('0x63'),_0x3c62('0x64'));_0x3b126b[_0x3c62('0x65')]=util[_0x3c62('0x44')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2873b5[_0x3c62('0x60')],_0x3b126b[_0x3c62('0x66')],md5(_0x3b126b[_0x3c62('0x66')]));}else{_0x3b126b[_0x3c62('0x65')]='';}return getConnection(_0x2873b5)[_0x3c62('0x26')](function(_0x177ff8){_0x4b9fa6=_0x177ff8;return getUser(_0x2873b5,_0x31dc5d[_0x3c62('0x67')],_0x4b9fa6);})[_0x3c62('0x26')](function(_0x2464da){_0x39184a=_0x2464da;return getEndUser(_0x2873b5,_0x19124a,_0x3b126b[_0x3c62('0x68')],_0x3b126b[_0x3c62('0x69')],_0x4b9fa6);})[_0x3c62('0x26')](function(_0x134215){_0x518b3c=_0x134215;return getTicket(_0x2873b5,_0x39184a,_0x518b3c,_0x19124a,_0x3b126b,_0x19124a[_0x3c62('0x6a')],_0x4b9fa6,'queue');})[_0x3c62('0x26')](function(_0x45128f){_0x6790ed=_0x45128f;logger[_0x3c62('0x1b')]('[QUEUE]\x20Ticket\x20%s\x20created',_0x6790ed['id']);logger[_0x3c62('0x1b')](_0x3c62('0x6b'),_0x6790ed['id'],_0x31dc5d['name'],_0x2873b5[_0x3c62('0x3c')]);switch(_0x2873b5[_0x3c62('0x3c')]){case _0x3c62('0x6c'):emit(util[_0x3c62('0x44')]('user:%s',_0x31dc5d[_0x3c62('0x54')]),'trigger:salesforce:display',{'recordId':_0x6790ed['id']});break;case _0x3c62('0x6d'):emit(util['format'](_0x3c62('0x6e'),_0x31dc5d['name']),_0x3c62('0x6f'),{'uri':util[_0x3c62('0x44')](_0x3c62('0x70'),_0x4b9fa6[_0x3c62('0x71')],_0x6790ed['id'])});break;default:logger[_0x3c62('0x72')](_0x3c62('0x73'));}})[_0x3c62('0x74')](function(_0x1cfb44){logger[_0x3c62('0x72')](_0x3c62('0x63'),_0x1cfb44);});};exports['outbound']=function(_0x12445e,_0x231357,_0x4dcc85,_0x3ac409,_0x56e578,_0x518cd3,_0x2bd7be){var _0x1c1623,_0x2e80d3,_0x2c90ea,_0x203820;_0x518cd3['serverUrl']=intUtil['stripTrailingSlash'](_0x518cd3[_0x3c62('0x60')]);_0x518cd3[_0x3c62('0x58')]=intUtil[_0x3c62('0x61')](_0x518cd3[_0x3c62('0x58')]);if(_0x2bd7be&&_0x2bd7be['recordingFormat']&&_0x2bd7be[_0x3c62('0x75')]!==_0x3c62('0x76')){logger[_0x3c62('0x1b')](_0x3c62('0x77'),'Recording\x20is\x20enabled!');_0x231357[_0x3c62('0x65')]=util['format'](_0x3c62('0x78'),_0x518cd3[_0x3c62('0x60')],_0x231357['uniqueid'],md5(_0x231357[_0x3c62('0x66')]));}return getConnection(_0x518cd3)['then'](function(_0x5987f6){_0x203820=_0x5987f6;return getUser(_0x518cd3,_0x3ac409[_0x3c62('0x67')],_0x203820);})[_0x3c62('0x26')](function(_0x5435c4){_0x1c1623=_0x5435c4;return getEndUser(_0x518cd3,_0x4dcc85,_0x231357[_0x3c62('0x79')],_0x231357['destcalleridnum'],_0x203820);})[_0x3c62('0x26')](function(_0x5b9d6d){_0x2e80d3=_0x5b9d6d;return getTicket(_0x518cd3,_0x1c1623,_0x2e80d3,_0x4dcc85,_0x231357,_0x4dcc85[_0x3c62('0x6a')],_0x203820,_0x3c62('0x7a'));})[_0x3c62('0x26')](function(_0x363cd0){_0x2c90ea=_0x363cd0;logger['info']('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0x2c90ea['id']);logger[_0x3c62('0x1b')](_0x3c62('0x7b'),_0x2c90ea['id'],_0x3ac409['name'],_0x518cd3[_0x3c62('0x3c')]);switch(_0x518cd3[_0x3c62('0x3c')]){case _0x3c62('0x6c'):emit(util['format'](_0x3c62('0x6e'),_0x3ac409[_0x3c62('0x54')]),_0x3c62('0x7c'),{'recordId':_0x2c90ea['id']});break;case'newTab':emit(util[_0x3c62('0x44')](_0x3c62('0x6e'),_0x3ac409['name']),_0x3c62('0x6f'),{'uri':util['format']('%s/%s/e',_0x203820[_0x3c62('0x71')],_0x2c90ea['id'])});break;default:logger[_0x3c62('0x72')](_0x3c62('0x77'),'Salesforce\x20account\x20type\x20not\x20recognized');}})[_0x3c62('0x74')](function(_0x5d548a){logger['error'](_0x3c62('0x77'),_0x5d548a);});};exports[_0x3c62('0x7d')]=function(_0x232783,_0x49eaea,_0x4084de,_0xbf6c5c,_0x21960e,_0x792014){var _0x35f08f,_0x4eb108,_0x19b36c,_0xbb6d52;_0x792014[_0x3c62('0x60')]=intUtil[_0x3c62('0x61')](_0x792014['serverUrl']);_0x792014[_0x3c62('0x58')]=intUtil[_0x3c62('0x61')](_0x792014[_0x3c62('0x58')]);if(_0x21960e&&_0x21960e[_0x3c62('0x62')]){logger[_0x3c62('0x1b')]('['+_0x49eaea[_0x3c62('0x7e')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x49eaea[_0x3c62('0x65')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x792014[_0x3c62('0x60')],_0x49eaea[_0x3c62('0x66')],md5(_0x49eaea[_0x3c62('0x66')]));}else{_0x49eaea[_0x3c62('0x65')]='';}return getConnection(_0x792014)[_0x3c62('0x26')](function(_0x2ab2f0){_0xbb6d52=_0x2ab2f0;if(!_[_0x3c62('0x1f')](_0xbf6c5c)){return getUser(_0x792014,_0xbf6c5c[_0x3c62('0x54')],_0xbb6d52);}else{return getUser(_0x792014,null,_0xbb6d52);}})['then'](function(_0x304c72){_0x35f08f=_0x304c72;return getEndUser(_0x792014,_0x4084de,_0x49eaea[_0x3c62('0x68')],_0x49eaea['calleridnum'],_0xbb6d52);})['then'](function(_0x7f29fd){_0x4eb108=_0x7f29fd;return getTicket(_0x792014,_0x35f08f,_0x4eb108,_0x4084de,_0x49eaea,_0x4084de['Fields'],_0xbb6d52);})[_0x3c62('0x26')](function(_0x5d9ab7){_0x19b36c=_0x5d9ab7;logger[_0x3c62('0x1b')]('['+_0x49eaea[_0x3c62('0x7e')][_0x3c62('0x7f')]()+_0x3c62('0x80'),_0x19b36c['id']);logger['info']('['+_0x49eaea[_0x3c62('0x7e')]['toUpperCase']()+_0x3c62('0x81'),_0x792014['type']);})[_0x3c62('0x74')](function(_0x3909cd){logger[_0x3c62('0x72')]('['+_0x49eaea[_0x3c62('0x7e')][_0x3c62('0x7f')]()+']',_0x3909cd);});}; \ 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 b34adef..1e51de3 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 _0x48d6=['./util','../../../../config/environment','../../../../config/logger','servicenow','defaults','redis','socket.io-emitter','GET','then','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','],\x20getUser\x20input\x20crm','sys_user?sysparm_query=email%3D','userEmail','],\x20getUser\x20rp\x20obj','length','active','true','adminEmail','],\x20getUser\x20crm','message',']\x20using\x20admin\x20profile','userId','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','endUserId','],\x20getEndUser\x20input\x20crm','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','type','nameField','customField','content','toString','includes','string','picklist','idField','toLowerCase','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields','ticketId','ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','POST','label_entry','Incident','Incident\x20-\x20','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','callDirection','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis'];(function(_0x3f7c7e,_0x1a023c){var _0x313e0d=function(_0x527225){while(--_0x527225){_0x3f7c7e['push'](_0x3f7c7e['shift']());}};_0x313e0d(++_0x1a023c);}(_0x48d6,0xd7));var _0x648d=function(_0x4a2ab7,_0x117e0e){_0x4a2ab7=_0x4a2ab7-0x0;var _0x307db4=_0x48d6[_0x4a2ab7];return _0x307db4;};'use strict';var _=require('lodash');var Promise=require(_0x648d('0x0'));var rp=require(_0x648d('0x1'));var util=require(_0x648d('0x2'));var md5=require(_0x648d('0x3'));var Redis=require(_0x648d('0x4'));var intUtil=require(_0x648d('0x5'));var config=require(_0x648d('0x6'));var logger=require(_0x648d('0x7'))(_0x648d('0x8'));config['redis']=_[_0x648d('0x9')](config[_0x648d('0xa')],{'host':'localhost','port':0x18eb});var io=require(_0x648d('0xb'))(new Redis(config[_0x648d('0xa')]));function getAdminUser(_0x3549f3,_0x293dad,_0x25e06b,_0x38e6eb,_0x493519,_0x2d5046){return new Promise(function(_0x5d5918,_0x5807ce){var _0xafa901={'method':_0x648d('0xc'),'uri':_0x38e6eb+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x493519+'&'+_0x2d5046,'auth':_0x293dad,'json':!![]};return rp(_0xafa901)[_0x648d('0xd')](function(_0x2c7532){if(_0x2c7532['result']['length']>0x0){_0x25e06b[_0x648d('0xe')]=_0x2c7532[_0x648d('0xf')][0x0][_0x648d('0x10')];}logger[_0x648d('0x11')]('['+[_0x3549f3[_0x648d('0x12')]()]+_0x648d('0x13'),_0x25e06b);_0x5d5918(_0x25e06b);})[_0x648d('0x14')](function(_0x44c901){logger[_0x648d('0x15')]('['+[_0x3549f3[_0x648d('0x12')]()]+']',_0x44c901['message']);_0x5807ce(_0x44c901['message']);});});}function getUser(_0x33f30d,_0x2fccf7,_0x5dacd2,_0x1998af,_0x1428f3){return function(_0x245688){logger[_0x648d('0x11')]('['+[_0x33f30d[_0x648d('0x12')]()]+_0x648d('0x16'),_0x245688);return new Promise(function(_0x229af3,_0x5bfc09){if(intUtil['validateEmail'](_0x245688['userEmail'])){var _0x2d88af={'method':'GET','uri':_0x5dacd2+_0x648d('0x17')+_0x245688[_0x648d('0x18')]+'&'+_0x1998af+'&'+_0x1428f3,'auth':_0x2fccf7,'json':!![]};logger['info']('['+[_0x33f30d[_0x648d('0x12')]()]+_0x648d('0x19'),_0x2d88af);return rp(_0x2d88af)[_0x648d('0xd')](function(_0x1a6ae2){logger[_0x648d('0x11')]('['+[_0x33f30d[_0x648d('0x12')]()]+'],\x20getUser\x20entity',_0x1a6ae2);if(_0x1a6ae2[_0x648d('0xf')][_0x648d('0x1a')]>0x0&&String(_0x1a6ae2[_0x648d('0xf')][0x0][_0x648d('0x1b')])===_0x648d('0x1c')){_0x245688['userId']=_0x1a6ae2[_0x648d('0xf')][0x0][_0x648d('0x10')];}else{_0x245688['userId']=_0x245688['adminId'];_0x245688[_0x648d('0x18')]=_0x245688[_0x648d('0x1d')];}logger['info']('['+[_0x33f30d[_0x648d('0x12')]()]+_0x648d('0x1e'),_0x245688);_0x229af3(_0x245688);})['catch'](function(_0x2b821f){logger['error']('['+[_0x33f30d[_0x648d('0x12')]()]+']',_0x2b821f[_0x648d('0x1f')]);_0x5bfc09(_0x2b821f[_0x648d('0x1f')]);});}else{logger[_0x648d('0x11')]('['+[_0x33f30d[_0x648d('0x12')]()]+_0x648d('0x20'));_0x245688[_0x648d('0x21')]=_0x245688['adminId'];_0x245688[_0x648d('0x18')]=_0x245688[_0x648d('0x1d')];_0x229af3(_0x245688);}});};}function createEndUser(_0x3f6da6,_0x2037c3,_0x85153c,_0x2d0349,_0x32db7c){logger[_0x648d('0x11')]('['+[_0x3f6da6[_0x648d('0x12')]()]+_0x648d('0x22'),_0x85153c);return new Promise(function(_0x30e961,_0x370dd1){var _0x18094c={'method':'POST','uri':_0x2d0349+_0x648d('0x23')+_0x32db7c,'body':{'user_name':_0x85153c[_0x648d('0x24')],'roles':_0x648d('0x25'),'first_name':_0x85153c[_0x648d('0x24')],'active':'true','date_format':_0x648d('0x26'),'phone':_0x85153c[_0x648d('0x24')]},'auth':_0x2037c3,'json':!![]};return rp(_0x18094c)[_0x648d('0xd')](function(_0x5ab24d){logger['info']('['+[_0x3f6da6[_0x648d('0x12')]()]+'],\x20EndUser\x20schema',_0x5ab24d[_0x648d('0xf')]);_0x85153c[_0x648d('0x27')]=_0x5ab24d[_0x648d('0xf')][_0x648d('0x10')];_0x30e961(_0x85153c);})[_0x648d('0x14')](function(_0x425ef3){logger[_0x648d('0x15')]('['+[_0x3f6da6[_0x648d('0x12')]()]+']',_0x425ef3['message']);_0x370dd1(_0x425ef3[_0x648d('0x1f')]);});});}function getEndUser(_0x278a4d,_0x3a4c37,_0x5e400c,_0x378984,_0x556f15){return function(_0x2d57c8){logger[_0x648d('0x11')]('['+[_0x278a4d[_0x648d('0x12')]()]+_0x648d('0x28'),_0x2d57c8);return new Promise(function(_0x7b8b47,_0x136baa){var _0x86b73f={'method':'GET','uri':_0x5e400c+'sys_user?sysparm_query=phone%3D'+_0x2d57c8[_0x648d('0x24')]+'&'+_0x378984+'&'+_0x556f15,'auth':_0x3a4c37,'json':!![]};return rp(_0x86b73f)[_0x648d('0xd')](function(_0xca853f){if(_0xca853f[_0x648d('0xf')]['length']>0x0){_0x2d57c8[_0x648d('0x27')]=_0xca853f['result'][0x0]['sys_id'];logger[_0x648d('0x11')]('['+[_0x278a4d['toUpperCase']()]+_0x648d('0x29'),_0x2d57c8);_0x7b8b47(_0x2d57c8);}else{return createEndUser(_0x278a4d,_0x3a4c37,_0x2d57c8,_0x5e400c,_0x378984)[_0x648d('0xd')](function(_0x132ec7){logger[_0x648d('0x11')]('['+[_0x278a4d[_0x648d('0x12')]()]+_0x648d('0x2a'),_0x132ec7);_0x7b8b47(_0x132ec7);});}})[_0x648d('0x14')](function(_0x4d4e44){logger['error']('['+[_0x278a4d['toUpperCase']()]+']',_0x4d4e44[_0x648d('0x1f')]);_0x136baa(_0x4d4e44['message']);});});};}function getCustomFields(_0x4ffb2b,_0x32c747){var _0x291370={};if(_0x4ffb2b[_0x648d('0x1a')]>0x0){_[_0x648d('0x2b')](_0x4ffb2b,function(_0x353d7f){if(_['includes'](['string','picklist'],_0x353d7f[_0x648d('0x2c')])&&_0x353d7f[_0x648d('0x2d')]&&!_0x353d7f[_0x648d('0x2e')]){_0x291370[_0x353d7f['nameField']['toLowerCase']()]=_0x353d7f[_0x648d('0x2f')][_0x648d('0x30')]();}else if(_[_0x648d('0x31')]([_0x648d('0x32'),_0x648d('0x33')],_0x353d7f[_0x648d('0x2c')])&&_0x353d7f[_0x648d('0x34')]&&_0x353d7f[_0x648d('0x2e')]){_0x291370[_0x353d7f[_0x648d('0x34')][_0x648d('0x35')]()]=_0x353d7f[_0x648d('0x2f')][_0x648d('0x30')]();}else if(_0x353d7f[_0x648d('0x2c')]===_0x648d('0x36')&&_0x353d7f[_0x648d('0x37')]&&_0x353d7f[_0x648d('0x34')]&&_0x353d7f[_0x648d('0x2e')]){_0x291370[_0x353d7f['idField'][_0x648d('0x35')]()]=_0x32c747[_0x353d7f[_0x648d('0x37')]]['toString']();}else if(_0x353d7f[_0x648d('0x2c')]===_0x648d('0x38')&&_0x353d7f[_0x648d('0x39')]&&_0x353d7f[_0x648d('0x39')][_0x648d('0x3a')]&&_0x353d7f['idField']&&_0x353d7f[_0x648d('0x2e')]){_0x291370[_0x353d7f[_0x648d('0x34')][_0x648d('0x35')]()]=_0x32c747[_0x353d7f[_0x648d('0x39')]['name'][_0x648d('0x35')]()]['toString']();}});}return _0x291370;}function getTicket(_0x50389b,_0x44c725,_0x220e3f,_0x4401bc,_0x247498,_0x1af8f3){return function(_0x3bd039){logger[_0x648d('0x11')]('['+[_0x50389b[_0x648d('0x12')]()]+_0x648d('0x3b'),_0x3bd039);return new Promise(function(_0x496f1e,_0x67e08c){var _0x26c3ce=_0x50389b[_0x648d('0x35')]()===_0x648d('0x3c')?_0x3bd039[_0x648d('0x21')]:_0x3bd039[_0x648d('0x27')];var _0x946fd9={'method':'POST','uri':_0x220e3f+_0x648d('0x3d')+'?'+_0x1af8f3,'body':Object[_0x648d('0x3e')]({},{'active':_0x648d('0x1c'),'caller_id':_0x26c3ce,'assigned_to':_0x3bd039[_0x648d('0x21')],'short_description':intUtil[_0x648d('0x3f')](_0x4401bc[_0x648d('0x40')],_0x247498,'\x20'),'description':intUtil[_0x648d('0x3f')](_0x4401bc[_0x648d('0x41')],_0x247498,'\x0a')},getCustomFields(_0x4401bc[_0x648d('0x42')],_0x247498)),'auth':_0x44c725,'json':!![]};return rp(_0x946fd9)[_0x648d('0xd')](function(_0x32400d){logger[_0x648d('0x11')]('['+[_0x50389b['toUpperCase']()]+']\x20POST\x20incident\x20entity\x20schema',_0x32400d[_0x648d('0xf')]);_0x3bd039[_0x648d('0x43')]=_0x32400d[_0x648d('0xf')][_0x648d('0x10')];_0x3bd039[_0x648d('0x44')]=_0x32400d[_0x648d('0xf')]['number'];logger[_0x648d('0x11')]('['+[_0x50389b['toUpperCase']()]+_0x648d('0x45'),_0x3bd039);_0x496f1e(_0x3bd039);})[_0x648d('0x14')](function(_0x48ed36){logger[_0x648d('0x15')]('['+[_0x50389b[_0x648d('0x12')]()]+']',_0x48ed36['message']);_0x67e08c(_0x48ed36[_0x648d('0x1f')]);});});};}function createRemoteTag(_0x458d8a,_0x5458d9,_0x461b0c,_0x344f4c){return new Promise(function(_0x5581ef,_0x1b297c){var _0x222a8f={'method':'POST','uri':_0x461b0c+_0x648d('0x46')+'?'+_0x344f4c,'body':{'short_description':_0x458d8a,'global':!![],'active':!![],'name':_0x458d8a},'auth':_0x5458d9,'json':!![]};return rp(_0x222a8f)[_0x648d('0xd')](function(_0x19c70d){var _0x2d2b91=_0x19c70d[_0x648d('0xf')][_0x648d('0x10')];_0x5581ef(_0x2d2b91);});});}function getRemoteTag(_0x19a650,_0x3ee612,_0x57f06e,_0x45b002,_0x4773b4){return new Promise(function(_0x267822,_0x4236f4){var _0x45626a={'method':_0x648d('0xc'),'uri':_0x57f06e+_0x648d('0x46')+_0x648d('0x47')+_0x19a650+'&'+_0x45b002,'auth':_0x3ee612,'json':!![]};return rp(_0x45626a)[_0x648d('0xd')](function(_0x5de6e7){if(_0x5de6e7[_0x648d('0xf')]['length']>0x0){var _0x2544a2=_0x5de6e7['result'][0x0][_0x648d('0x10')];_0x267822(_0x2544a2);}else{return createRemoteTag(_0x19a650,_0x3ee612,_0x57f06e,_0x45b002)[_0x648d('0xd')](function(_0x1823d2){_0x267822(_0x1823d2);});}});});}function assignTagToIncident(_0x5df467,_0x35445d,_0x10f44d,_0x3b1bf0,_0x416cf0){return new Promise(function(_0x41ac6f,_0x24fdb2){var _0x3f327e={'method':_0x648d('0x48'),'uri':_0x10f44d+_0x648d('0x49')+'?'+_0x416cf0,'body':{'label':_0x5df467,'table':'incident','id_type':_0x648d('0x4a'),'table_key':_0x3b1bf0[_0x648d('0x43')],'title':_0x648d('0x4b')+_0x3b1bf0[_0x648d('0x44')],'id_display':_0x3b1bf0[_0x648d('0x44')]},'auth':_0x35445d,'json':!![]};return rp(_0x3f327e)[_0x648d('0xd')](function(_0x9e5ed3){_0x41ac6f();})[_0x648d('0x14')](function(){_0x41ac6f();});});}function manageTags(_0x58af81,_0x4c707d,_0x580f1b,_0xb63a06,_0x3953e7,_0x3298c6,_0x238b7d){return new Promise(function(_0xf760a1,_0x1527c8){var _0x5c727b=[];_0x4c707d[_0x648d('0x2b')](function(_0x4da4b8){_0x5c727b['push'](getRemoteTag(_0x4da4b8,_0x580f1b,_0xb63a06,_0x3298c6,_0x238b7d));});return Promise[_0x648d('0x4c')](_0x5c727b)[_0x648d('0xd')](function(_0x4cd5af){if(_0x4cd5af[_0x648d('0x1a')]){logger[_0x648d('0x11')]('['+[_0x58af81[_0x648d('0x12')]()]+_0x648d('0x4d'),_0x4cd5af);var _0x355c4b=[];_0x4cd5af[_0x648d('0x2b')](function(_0x591b83){_0x355c4b[_0x648d('0x4e')](assignTagToIncident(_0x591b83,_0x580f1b,_0xb63a06,_0x3953e7,_0x3298c6));});return Promise[_0x648d('0x4c')](_0x355c4b)[_0x648d('0xd')](function(){_0xf760a1();})[_0x648d('0x14')](function(){_0xf760a1();});}else{_0xf760a1();}});});}function getTags(_0x2ce18e,_0x44c6fe,_0x2269b5,_0x5cbbaf,_0x533b24,_0x45d40e){return function(_0x8c41c7){return new Promise(function(_0x5573da,_0x14a333){var _0x7f1645=[];var _0x2c0295=_0x5cbbaf['Tags'];if(_0x2c0295&&_0x2c0295[_0x648d('0x1a')]>0x0){_0x7f1645=_['map'](_0x2c0295,_0x648d('0x3a'));}if(_0x7f1645['length']>0x0){return manageTags(_0x2ce18e,_0x7f1645,_0x44c6fe,_0x2269b5,_0x8c41c7,_0x533b24,_0x45d40e)[_0x648d('0xd')](function(){_0x5573da(_0x8c41c7);});}else{_0x5573da(_0x8c41c7);}});};}function emit(_0xdeb883,_0x492111,_0x3e03fa){var _0x29432e=_0x648d('0x4f')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x648d('0x50')+_0x648d('0x51');var _0x2a08b0={'uri':_0xdeb883+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x3e03fa+_0x29432e};io['to'](util[_0x648d('0x52')](_0x648d('0x53'),_0x492111))[_0x648d('0x54')](_0x648d('0x55'),_0x2a08b0);}exports['cs']=function(_0x4cba4d,_0x1b73e6,_0x39b4a1,_0x31d11c,_0x8e72d8,_0x12a9ec,_0x2ad853,_0x2a85b8){var _0x24d215={};var _0x4ae23f={'user':_0x12a9ec[_0x648d('0x56')],'pass':_0x12a9ec['password']};var _0x48ce20=_0x648d('0x57');var _0x11f239=_0x648d('0x58');_0x12a9ec[_0x648d('0x59')]=intUtil[_0x648d('0x5a')](_0x12a9ec[_0x648d('0x59')]);_0x12a9ec[_0x648d('0x5b')]=intUtil[_0x648d('0x5a')](_0x12a9ec[_0x648d('0x5b')]);var _0x540735=util['format']('%s/api/now/table/',_0x12a9ec['remoteUri']);_0x24d215[_0x648d('0x18')]=!_[_0x648d('0x5c')](_0x31d11c)?_0x31d11c[_0x648d('0x5d')]:null;_0x24d215['adminEmail']=_0x12a9ec[_0x648d('0x5d')];_0x24d215[_0x648d('0x24')]=_0x2a85b8[_0x648d('0x35')]()===_0x648d('0x3c')?_0x1b73e6['destcalleridnum']:_0x1b73e6['calleridnum'];_0x24d215[_0x648d('0x5e')]=_0x2a85b8===_0x648d('0x5f')||_0x2a85b8===_0x648d('0x60')?'queue':'outbound';var _0x2c5628=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x12a9ec[_0x648d('0x5b')],_0x1b73e6[_0x648d('0x61')],md5(_0x1b73e6['uniqueid']));if(_0x8e72d8&&_0x8e72d8[_0x648d('0x62')]){logger['info'](_0x648d('0x63'),_0x648d('0x64'));_0x1b73e6[_0x648d('0x65')]=_0x2c5628;}else if(_0x2ad853&&_0x2ad853[_0x648d('0x66')]&&_0x2ad853[_0x648d('0x66')]!==_0x648d('0x67')){logger[_0x648d('0x11')](_0x648d('0x68'),'Recording\x20is\x20enabled!');_0x1b73e6[_0x648d('0x65')]=_0x2c5628;}else{_0x1b73e6[_0x648d('0x65')]='';}return getAdminUser(_0x2a85b8,_0x4ae23f,_0x24d215,_0x540735,_0x11f239,_0x48ce20)[_0x648d('0xd')](getUser(_0x2a85b8,_0x4ae23f,_0x540735,_0x11f239,_0x48ce20))['then'](getEndUser(_0x2a85b8,_0x4ae23f,_0x540735,_0x11f239,_0x48ce20))['then'](getTicket(_0x2a85b8,_0x4ae23f,_0x540735,_0x39b4a1,_0x1b73e6,_0x11f239))[_0x648d('0xd')](function(_0x17763d){logger[_0x648d('0x11')](util[_0x648d('0x52')](_0x648d('0x69'),_0x17763d['ticketId']));logger[_0x648d('0x11')](util[_0x648d('0x52')](_0x648d('0x6a'),_0x2a85b8));if(_0x2a85b8!==_0x648d('0x60')){logger[_0x648d('0x11')]('['+[_0x2a85b8[_0x648d('0x12')]()]+']',_0x648d('0x6b'));emit(_0x12a9ec[_0x648d('0x59')],_0x31d11c[_0x648d('0x3a')],_0x17763d['ticketId']);}})[_0x648d('0x14')](function(_0x9f992c){logger[_0x648d('0x15')]('['+[_0x2a85b8[_0x648d('0x12')]()]+_0x648d('0x6c'),util[_0x648d('0x6d')](_0x9f992c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x9ded=['picklist','type','nameField','customField','toLowerCase','content','toString','idField','variable','variableName','Variable',']\x20getTicket\x20input\x20crm','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','forEach','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','push','map','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','sysparm_limit=1','sysparm_display_value=true','remoteUri','serverUrl','stripTrailingSlash','%s/api/now/table/','email','outbound','destcalleridnum','calleridnum','queue','unmanaged','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','lodash','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','validateEmail','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','userEmail','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20createEndUser\x20crm','includes','string'];(function(_0x4221be,_0x4b3d7b){var _0x36a241=function(_0x376e89){while(--_0x376e89){_0x4221be['push'](_0x4221be['shift']());}};_0x36a241(++_0x4b3d7b);}(_0x9ded,0x1ee));var _0xd9de=function(_0x4ffe8c,_0x62bf20){_0x4ffe8c=_0x4ffe8c-0x0;var _0xde829=_0x9ded[_0x4ffe8c];return _0xde829;};'use strict';var _=require(_0xd9de('0x0'));var Promise=require(_0xd9de('0x1'));var rp=require(_0xd9de('0x2'));var util=require(_0xd9de('0x3'));var md5=require(_0xd9de('0x4'));var Redis=require(_0xd9de('0x5'));var intUtil=require(_0xd9de('0x6'));var config=require(_0xd9de('0x7'));var logger=require(_0xd9de('0x8'))(_0xd9de('0x9'));config[_0xd9de('0xa')]=_['defaults'](config[_0xd9de('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd9de('0xa')]));function getAdminUser(_0x322f15,_0xe032b1,_0x1c6872,_0x751c87,_0x150c03,_0x500442){return new Promise(function(_0x229900,_0x251fd7){var _0x30cff0={'method':_0xd9de('0xb'),'uri':_0x751c87+_0xd9de('0xc')+'&'+_0x150c03+'&'+_0x500442,'auth':_0xe032b1,'json':!![]};return rp(_0x30cff0)[_0xd9de('0xd')](function(_0x2b6d5c){if(_0x2b6d5c[_0xd9de('0xe')][_0xd9de('0xf')]>0x0){_0x1c6872[_0xd9de('0x10')]=_0x2b6d5c[_0xd9de('0xe')][0x0][_0xd9de('0x11')];}logger[_0xd9de('0x12')]('['+[_0x322f15[_0xd9de('0x13')]()]+_0xd9de('0x14'),_0x1c6872);_0x229900(_0x1c6872);})['catch'](function(_0x39ab9f){logger[_0xd9de('0x15')]('['+[_0x322f15[_0xd9de('0x13')]()]+']',_0x39ab9f[_0xd9de('0x16')]);_0x251fd7(_0x39ab9f[_0xd9de('0x16')]);});});}function getUser(_0x315efd,_0x5286a0,_0x491276,_0x16d0cb,_0x289f54){return function(_0x5d9671){logger[_0xd9de('0x12')]('['+[_0x315efd[_0xd9de('0x13')]()]+'],\x20getUser\x20input\x20crm',_0x5d9671);return new Promise(function(_0x270eaf,_0x438ba3){if(intUtil[_0xd9de('0x17')](_0x5d9671['userEmail'])){var _0x1e88c5={'method':_0xd9de('0xb'),'uri':_0x491276+'sys_user?sysparm_query=email%3D'+_0x5d9671['userEmail']+'&'+_0x16d0cb+'&'+_0x289f54,'auth':_0x5286a0,'json':!![]};logger[_0xd9de('0x12')]('['+[_0x315efd[_0xd9de('0x13')]()]+_0xd9de('0x18'),_0x1e88c5);return rp(_0x1e88c5)['then'](function(_0x26237a){logger['info']('['+[_0x315efd[_0xd9de('0x13')]()]+_0xd9de('0x19'),_0x26237a);if(_0x26237a[_0xd9de('0xe')]['length']>0x0&&String(_0x26237a[_0xd9de('0xe')][0x0][_0xd9de('0x1a')])===_0xd9de('0x1b')){_0x5d9671[_0xd9de('0x1c')]=_0x26237a[_0xd9de('0xe')][0x0][_0xd9de('0x11')];}else{_0x5d9671[_0xd9de('0x1c')]=_0x5d9671[_0xd9de('0x10')];_0x5d9671[_0xd9de('0x1d')]=_0x5d9671[_0xd9de('0x1e')];}logger[_0xd9de('0x12')]('['+[_0x315efd['toUpperCase']()]+_0xd9de('0x1f'),_0x5d9671);_0x270eaf(_0x5d9671);})[_0xd9de('0x20')](function(_0x43daf6){logger[_0xd9de('0x15')]('['+[_0x315efd['toUpperCase']()]+']',_0x43daf6[_0xd9de('0x16')]);_0x438ba3(_0x43daf6[_0xd9de('0x16')]);});}else{logger[_0xd9de('0x12')]('['+[_0x315efd[_0xd9de('0x13')]()]+']\x20using\x20admin\x20profile');_0x5d9671[_0xd9de('0x1c')]=_0x5d9671[_0xd9de('0x10')];_0x5d9671[_0xd9de('0x1d')]=_0x5d9671[_0xd9de('0x1e')];_0x270eaf(_0x5d9671);}});};}function createEndUser(_0x198b35,_0x5cec8a,_0x476133,_0x1c6cac,_0x290f5a){logger['info']('['+[_0x198b35[_0xd9de('0x13')]()]+_0xd9de('0x21'),_0x476133);return new Promise(function(_0x3071bb,_0xb3f1e7){var _0x478209={'method':_0xd9de('0x22'),'uri':_0x1c6cac+_0xd9de('0x23')+_0x290f5a,'body':{'user_name':_0x476133[_0xd9de('0x24')],'roles':_0xd9de('0x25'),'first_name':_0x476133['endUserNumber'],'active':'true','date_format':_0xd9de('0x26'),'phone':_0x476133[_0xd9de('0x24')]},'auth':_0x5cec8a,'json':!![]};return rp(_0x478209)[_0xd9de('0xd')](function(_0x2dfd4c){logger[_0xd9de('0x12')]('['+[_0x198b35[_0xd9de('0x13')]()]+_0xd9de('0x27'),_0x2dfd4c[_0xd9de('0xe')]);_0x476133[_0xd9de('0x28')]=_0x2dfd4c[_0xd9de('0xe')][_0xd9de('0x11')];_0x3071bb(_0x476133);})[_0xd9de('0x20')](function(_0x36d59c){logger[_0xd9de('0x15')]('['+[_0x198b35[_0xd9de('0x13')]()]+']',_0x36d59c[_0xd9de('0x16')]);_0xb3f1e7(_0x36d59c['message']);});});}function getEndUser(_0x4c4f81,_0x4e9d95,_0x5e4448,_0x4187ae,_0x5c77e0){return function(_0xd93770){logger['info']('['+[_0x4c4f81[_0xd9de('0x13')]()]+_0xd9de('0x29'),_0xd93770);return new Promise(function(_0x210439,_0x3a13b7){var _0x1bafe3={'method':_0xd9de('0xb'),'uri':_0x5e4448+_0xd9de('0x2a')+_0xd93770['endUserNumber']+'&'+_0x4187ae+'&'+_0x5c77e0,'auth':_0x4e9d95,'json':!![]};return rp(_0x1bafe3)['then'](function(_0x18a6d1){if(_0x18a6d1[_0xd9de('0xe')][_0xd9de('0xf')]>0x0){_0xd93770[_0xd9de('0x28')]=_0x18a6d1[_0xd9de('0xe')][0x0]['sys_id'];logger[_0xd9de('0x12')]('['+[_0x4c4f81[_0xd9de('0x13')]()]+'],\x20getEndUser\x20crm',_0xd93770);_0x210439(_0xd93770);}else{return createEndUser(_0x4c4f81,_0x4e9d95,_0xd93770,_0x5e4448,_0x4187ae)['then'](function(_0x5a31a0){logger[_0xd9de('0x12')]('['+[_0x4c4f81[_0xd9de('0x13')]()]+_0xd9de('0x2b'),_0x5a31a0);_0x210439(_0x5a31a0);});}})[_0xd9de('0x20')](function(_0x4452c1){logger['error']('['+[_0x4c4f81['toUpperCase']()]+']',_0x4452c1[_0xd9de('0x16')]);_0x3a13b7(_0x4452c1[_0xd9de('0x16')]);});});};}function getCustomFields(_0x2c4f86,_0x433951){var _0x2ef179={};if(_0x2c4f86[_0xd9de('0xf')]>0x0){_['forEach'](_0x2c4f86,function(_0x25c02a){if(_[_0xd9de('0x2c')]([_0xd9de('0x2d'),_0xd9de('0x2e')],_0x25c02a[_0xd9de('0x2f')])&&_0x25c02a[_0xd9de('0x30')]&&!_0x25c02a[_0xd9de('0x31')]){_0x2ef179[_0x25c02a[_0xd9de('0x30')][_0xd9de('0x32')]()]=_0x25c02a[_0xd9de('0x33')][_0xd9de('0x34')]();}else if(_[_0xd9de('0x2c')]([_0xd9de('0x2d'),_0xd9de('0x2e')],_0x25c02a[_0xd9de('0x2f')])&&_0x25c02a[_0xd9de('0x35')]&&_0x25c02a['customField']){_0x2ef179[_0x25c02a[_0xd9de('0x35')]['toLowerCase']()]=_0x25c02a[_0xd9de('0x33')][_0xd9de('0x34')]();}else if(_0x25c02a['type']===_0xd9de('0x36')&&_0x25c02a[_0xd9de('0x37')]&&_0x25c02a['idField']&&_0x25c02a[_0xd9de('0x31')]){_0x2ef179[_0x25c02a['idField'][_0xd9de('0x32')]()]=_0x433951[_0x25c02a[_0xd9de('0x37')]][_0xd9de('0x34')]();}else if(_0x25c02a[_0xd9de('0x2f')]==='customVariable'&&_0x25c02a['Variable']&&_0x25c02a[_0xd9de('0x38')]['name']&&_0x25c02a[_0xd9de('0x35')]&&_0x25c02a[_0xd9de('0x31')]){_0x2ef179[_0x25c02a['idField'][_0xd9de('0x32')]()]=_0x433951[_0x25c02a[_0xd9de('0x38')]['name'][_0xd9de('0x32')]()][_0xd9de('0x34')]();}});}return _0x2ef179;}function getTicket(_0x28a498,_0x3f3e08,_0x3f45de,_0xb851fe,_0x100b10,_0x11254f){return function(_0xdd4359){logger['info']('['+[_0x28a498[_0xd9de('0x13')]()]+_0xd9de('0x39'),_0xdd4359);return new Promise(function(_0x5ec167,_0x398edc){var _0x4cbe10=_0x28a498['toLowerCase']()==='outbound'?_0xdd4359[_0xd9de('0x1c')]:_0xdd4359[_0xd9de('0x28')];var _0x104178={'method':'POST','uri':_0x3f45de+_0xd9de('0x3a')+'?'+_0x11254f,'body':Object[_0xd9de('0x3b')]({},{'active':_0xd9de('0x1b'),'caller_id':_0x4cbe10,'assigned_to':_0xdd4359[_0xd9de('0x1c')],'short_description':intUtil[_0xd9de('0x3c')](_0xb851fe[_0xd9de('0x3d')],_0x100b10,'\x20'),'description':intUtil[_0xd9de('0x3c')](_0xb851fe[_0xd9de('0x3e')],_0x100b10,'\x0a')},getCustomFields(_0xb851fe[_0xd9de('0x3f')],_0x100b10)),'auth':_0x3f3e08,'json':!![]};return rp(_0x104178)[_0xd9de('0xd')](function(_0x514090){logger[_0xd9de('0x12')]('['+[_0x28a498[_0xd9de('0x13')]()]+_0xd9de('0x40'),_0x514090[_0xd9de('0xe')]);_0xdd4359[_0xd9de('0x41')]=_0x514090[_0xd9de('0xe')][_0xd9de('0x11')];_0xdd4359['ticketNumber']=_0x514090[_0xd9de('0xe')][_0xd9de('0x42')];logger[_0xd9de('0x12')]('['+[_0x28a498[_0xd9de('0x13')]()]+']\x20getTicket\x20crm',_0xdd4359);_0x5ec167(_0xdd4359);})['catch'](function(_0x14645c){logger['error']('['+[_0x28a498[_0xd9de('0x13')]()]+']',_0x14645c[_0xd9de('0x16')]);_0x398edc(_0x14645c['message']);});});};}function createRemoteTag(_0x4a2ddd,_0xb1fa20,_0x5a6707,_0xe7c096){return new Promise(function(_0x387c45,_0x2ad45b){var _0x41d697={'method':_0xd9de('0x22'),'uri':_0x5a6707+_0xd9de('0x43')+'?'+_0xe7c096,'body':{'short_description':_0x4a2ddd,'global':!![],'active':!![],'name':_0x4a2ddd},'auth':_0xb1fa20,'json':!![]};return rp(_0x41d697)['then'](function(_0x1e0000){var _0xf3870d=_0x1e0000[_0xd9de('0xe')][_0xd9de('0x11')];_0x387c45(_0xf3870d);});});}function getRemoteTag(_0xbebbab,_0x101d5a,_0x261be4,_0x48fd81,_0x5b1567){return new Promise(function(_0x10a373,_0x5bc41a){var _0x2c09e0={'method':_0xd9de('0xb'),'uri':_0x261be4+_0xd9de('0x43')+_0xd9de('0x44')+_0xbebbab+'&'+_0x48fd81,'auth':_0x101d5a,'json':!![]};return rp(_0x2c09e0)['then'](function(_0x43ee7a){if(_0x43ee7a[_0xd9de('0xe')][_0xd9de('0xf')]>0x0){var _0x483937=_0x43ee7a[_0xd9de('0xe')][0x0]['sys_id'];_0x10a373(_0x483937);}else{return createRemoteTag(_0xbebbab,_0x101d5a,_0x261be4,_0x48fd81)[_0xd9de('0xd')](function(_0x3973f2){_0x10a373(_0x3973f2);});}});});}function assignTagToIncident(_0x1d4015,_0x269099,_0x205246,_0x5c4a6b,_0x2f3b5a){return new Promise(function(_0x2a8b2e,_0x2ab48d){var _0x5eddf0={'method':_0xd9de('0x22'),'uri':_0x205246+_0xd9de('0x45')+'?'+_0x2f3b5a,'body':{'label':_0x1d4015,'table':_0xd9de('0x3a'),'id_type':_0xd9de('0x46'),'table_key':_0x5c4a6b['ticketId'],'title':_0xd9de('0x47')+_0x5c4a6b[_0xd9de('0x48')],'id_display':_0x5c4a6b[_0xd9de('0x48')]},'auth':_0x269099,'json':!![]};return rp(_0x5eddf0)['then'](function(_0x252768){_0x2a8b2e();})['catch'](function(){_0x2a8b2e();});});}function manageTags(_0x1fa32f,_0x101ced,_0x2a5ee8,_0x515d38,_0x3cffe7,_0xd4d449,_0x688f63){return new Promise(function(_0x4073b9,_0x286e47){var _0x37bc42=[];_0x101ced[_0xd9de('0x49')](function(_0x15889d){_0x37bc42['push'](getRemoteTag(_0x15889d,_0x2a5ee8,_0x515d38,_0xd4d449,_0x688f63));});return Promise[_0xd9de('0x4a')](_0x37bc42)[_0xd9de('0xd')](function(_0x4060aa){if(_0x4060aa[_0xd9de('0xf')]){logger['info']('['+[_0x1fa32f[_0xd9de('0x13')]()]+_0xd9de('0x4b'),_0x4060aa);var _0x211044=[];_0x4060aa['forEach'](function(_0x590d92){_0x211044[_0xd9de('0x4c')](assignTagToIncident(_0x590d92,_0x2a5ee8,_0x515d38,_0x3cffe7,_0xd4d449));});return Promise[_0xd9de('0x4a')](_0x211044)['then'](function(){_0x4073b9();})[_0xd9de('0x20')](function(){_0x4073b9();});}else{_0x4073b9();}});});}function getTags(_0x3e231d,_0x491d4f,_0x2eb976,_0x3aea17,_0x5e8bb5,_0x49bf3b){return function(_0x48c54f){return new Promise(function(_0x1c2bab,_0x77bb8a){var _0x13d379=[];var _0x23ebb9=_0x3aea17['Tags'];if(_0x23ebb9&&_0x23ebb9[_0xd9de('0xf')]>0x0){_0x13d379=_[_0xd9de('0x4d')](_0x23ebb9,'name');}if(_0x13d379['length']>0x0){return manageTags(_0x3e231d,_0x13d379,_0x491d4f,_0x2eb976,_0x48c54f,_0x5e8bb5,_0x49bf3b)[_0xd9de('0xd')](function(){_0x1c2bab(_0x48c54f);});}else{_0x1c2bab(_0x48c54f);}});};}function emit(_0x414513,_0x5ae653,_0x422cd0){var _0x579137=_0xd9de('0x4e')+_0xd9de('0x4f')+_0xd9de('0x50')+'%255EORDERBYDESCnumber';var _0x3807cb={'uri':_0x414513+_0xd9de('0x51')+_0x422cd0+_0x579137};io['to'](util[_0xd9de('0x52')](_0xd9de('0x53'),_0x5ae653))[_0xd9de('0x54')]('trigger:browser:url',_0x3807cb);}exports['cs']=function(_0x57982f,_0x24bfef,_0x3dc82b,_0x3b5e15,_0x16b5d9,_0x191fdc,_0x6dae19,_0x15a598){var _0x31db9b={};var _0x4d5748={'user':_0x191fdc['username'],'pass':_0x191fdc['password']};var _0x39d299=_0xd9de('0x55');var _0x4e6ec7=_0xd9de('0x56');_0x191fdc[_0xd9de('0x57')]=intUtil['stripTrailingSlash'](_0x191fdc['remoteUri']);_0x191fdc[_0xd9de('0x58')]=intUtil[_0xd9de('0x59')](_0x191fdc['serverUrl']);var _0x461d98=util[_0xd9de('0x52')](_0xd9de('0x5a'),_0x191fdc[_0xd9de('0x57')]);_0x31db9b[_0xd9de('0x1d')]=!_['isNil'](_0x3b5e15)?_0x3b5e15['email']:null;_0x31db9b[_0xd9de('0x1e')]=_0x191fdc[_0xd9de('0x5b')];_0x31db9b[_0xd9de('0x24')]=_0x15a598[_0xd9de('0x32')]()===_0xd9de('0x5c')?_0x24bfef[_0xd9de('0x5d')]:_0x24bfef[_0xd9de('0x5e')];_0x31db9b['callDirection']=_0x15a598===_0xd9de('0x5f')||_0x15a598===_0xd9de('0x60')?_0xd9de('0x5f'):_0xd9de('0x5c');var _0x63602=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x191fdc[_0xd9de('0x58')],_0x24bfef[_0xd9de('0x61')],md5(_0x24bfef['uniqueid']));if(_0x16b5d9&&_0x16b5d9[_0xd9de('0x62')]){logger[_0xd9de('0x12')](_0xd9de('0x63'),_0xd9de('0x64'));_0x24bfef[_0xd9de('0x65')]=_0x63602;}else if(_0x6dae19&&_0x6dae19[_0xd9de('0x66')]&&_0x6dae19[_0xd9de('0x66')]!==_0xd9de('0x67')){logger['info']('[OUTBOUND]',_0xd9de('0x64'));_0x24bfef[_0xd9de('0x65')]=_0x63602;}else{_0x24bfef[_0xd9de('0x65')]='';}return getAdminUser(_0x15a598,_0x4d5748,_0x31db9b,_0x461d98,_0x4e6ec7,_0x39d299)['then'](getUser(_0x15a598,_0x4d5748,_0x461d98,_0x4e6ec7,_0x39d299))[_0xd9de('0xd')](getEndUser(_0x15a598,_0x4d5748,_0x461d98,_0x4e6ec7,_0x39d299))[_0xd9de('0xd')](getTicket(_0x15a598,_0x4d5748,_0x461d98,_0x3dc82b,_0x24bfef,_0x4e6ec7))[_0xd9de('0xd')](function(_0x339adc){logger[_0xd9de('0x12')](util[_0xd9de('0x52')]('The\x20ticket\x20ID\x20is:\x20%s',_0x339adc[_0xd9de('0x41')]));logger['info'](util[_0xd9de('0x52')](_0xd9de('0x68'),_0x15a598));if(_0x15a598!==_0xd9de('0x60')){logger[_0xd9de('0x12')]('['+[_0x15a598[_0xd9de('0x13')]()]+']',_0xd9de('0x69'));emit(_0x191fdc[_0xd9de('0x57')],_0x3b5e15['name'],_0x339adc['ticketId']);}})[_0xd9de('0x20')](function(_0x5716a7){logger[_0xd9de('0x15')]('['+[_0x15a598[_0xd9de('0x13')]()]+_0xd9de('0x6a'),util[_0xd9de('0x6b')](_0x5716a7,{'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 65efc37..51de884 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 _0x3990=['user:%s','trigger:browser:url','catch','outbound','recordingFormat','[OUTBOUND]','recordingURL','The\x20User\x20ID\x20is:','destcalleridname','Outbound','Ticket\x20created!','contacts','error','unmanaged','lastevent','toUpperCase','calleridname','The\x20Enduser\x20ID\x20is:','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','Descriptions','toISOString','slice','duration_hours','parent_id','Contacts','parent_name','name','forEach','push','idField','variableName','set_entry','JSON','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','get_entry_list','stringify','Employees','user_name','entry_list','find','value','Agent\x20found!','name_value_list','resolve','user_id','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','then','length','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','merge','string','nameField','customField','content','toString','type','custom_fields','customVariable','Variable','toLowerCase','password','PLAIN','sessionID','Account\x20%d\x20is\x20not\x20valid','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','users','version','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...'];(function(_0x270e1a,_0x1fd11c){var _0x4c0683=function(_0x4b61e0){while(--_0x4b61e0){_0x270e1a['push'](_0x270e1a['shift']());}};_0x4c0683(++_0x1fd11c);}(_0x3990,0x162));var _0x0399=function(_0x44eeb9,_0x1a5603){_0x44eeb9=_0x44eeb9-0x0;var _0x38738f=_0x3990[_0x44eeb9];return _0x38738f;};'use strict';var _=require(_0x0399('0x0'));var rp=require(_0x0399('0x1'));var BPromise=require(_0x0399('0x2'));var md5=require(_0x0399('0x3'));var util=require('util');var Redis=require(_0x0399('0x4'));var intUtil=require(_0x0399('0x5'));var config=require(_0x0399('0x6'));var logger=require('../../../../config/logger')('sugarcrm');config[_0x0399('0x7')]=_[_0x0399('0x8')](config[_0x0399('0x7')],{'host':_0x0399('0x9'),'port':0x18eb});var io=require(_0x0399('0xa'))(new Redis(config[_0x0399('0x7')]));var def={'method':'POST','json':!![]};function emit(_0xd12399,_0x5073fc,_0x7db5df){io['to'](_0xd12399)[_0x0399('0xb')](_0x5073fc,_0x7db5df);}function getTicket(_0x87ab67,_0x1d3521,_0x3edc24,_0x118ef0,_0x1fbb8a,_0x135cd3,_0x2335fb,_0xa76653){logger[_0x0399('0xc')](_0x0399('0xd'));var _0x4f6509=new Date();var _0x1de6e2=[{'name':'name','value':intUtil[_0x0399('0xe')](_0x118ef0[_0x0399('0xf')],_0x1fbb8a,'\x20')},{'name':_0x0399('0x10'),'value':_0x1d3521['id']},{'name':_0x0399('0x11'),'value':_0x1d3521['id']},{'name':'description','value':intUtil[_0x0399('0xe')](_0x118ef0[_0x0399('0x12')],_0x1fbb8a,'\x0a')},{'name':'date_start','value':_0x4f6509[_0x0399('0x13')]()[_0x0399('0x14')](0x0,0x13)['replace']('T','\x20')},{'name':_0x0399('0x15'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x0399('0x16'),'value':_0x3edc24['id']},{'name':'parent_type','value':_0x0399('0x17')},{'name':_0x0399('0x18'),'value':_0x3edc24[_0x0399('0x19')]},{'name':'direction','value':_0xa76653}];if(_0x135cd3['length']){_[_0x0399('0x1a')](_0x135cd3,function(_0x1d3d4c){if(_0x1fbb8a[_0x1d3d4c['variableName']]){_0x1de6e2[_0x0399('0x1b')]({'name':_0x1d3d4c[_0x0399('0x1c')],'value':_0x1fbb8a[_0x1d3d4c[_0x0399('0x1d')]]});}});}return request({'form':{'method':_0x0399('0x1e'),'input_type':_0x0399('0x1f'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2335fb['id'],'module_name':_0x0399('0x20'),'name_value_list':_0x1de6e2})}});}function getAuth(_0x3ca1ff){return util[_0x0399('0x21')](_0x0399('0x22'),new Buffer(_0x3ca1ff[_0x0399('0x23')]+':X')['toString'](_0x0399('0x24')));}function getServerInfo(_0x516332){return request({'form':{'method':_0x0399('0x25'),'input_type':_0x0399('0x1f'),'response_type':_0x0399('0x1f'),'rest_data':JSON['stringify']({'session':_0x516332['id']})}});}function getUser(_0x35c231,_0x412aac,_0x36cab0){if(!_[_0x0399('0x26')](_0x412aac)){logger['info']('Getting\x20agent\x20with\x20name',_0x412aac);return request({'form':{'method':_0x0399('0x27'),'input_type':'JSON','response_type':_0x0399('0x1f'),'rest_data':JSON[_0x0399('0x28')]({'session':_0x36cab0['id'],'module_name':_0x0399('0x29'),'query':util[_0x0399('0x21')]('INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200',_0x412aac),'order_by':'','offset':'0','select_fields':['id',_0x0399('0x19'),_0x0399('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x5c4328){if(_0x5c4328[_0x0399('0x2b')]['length']){var _0x267f9f=_[_0x0399('0x2c')](_0x5c4328[_0x0399('0x2b')],function(_0x47414c){return _0x47414c['name_value_list']['user_name'][_0x0399('0x2d')]===_0x412aac;});if(_0x267f9f){logger[_0x0399('0xc')](_0x0399('0x2e'));return BPromise['resolve']({'id':_0x267f9f[_0x0399('0x2f')]['id'][_0x0399('0x2d')],'name':_0x267f9f[_0x0399('0x2f')]['name']['value']});}}logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x0399('0x30')]({'id':_0x36cab0['name_value_list'][_0x0399('0x31')]['value'],'name':_0x36cab0[_0x0399('0x2f')][_0x0399('0x2a')][_0x0399('0x2d')]});});}else{logger[_0x0399('0xc')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise['resolve']({'id':_0x36cab0[_0x0399('0x2f')]['user_id']['value'],'name':_0x36cab0[_0x0399('0x2f')][_0x0399('0x2a')][_0x0399('0x2d')]});}}function getEndUser(_0x180fa6,_0x3e8892,_0xd02fcc,_0x27d6ab){logger['info']('Searching\x20enduser\x20with\x20phone',_0xd02fcc);return request({'form':{'method':'get_entry_list','input_type':_0x0399('0x1f'),'response_type':_0x0399('0x1f'),'rest_data':JSON[_0x0399('0x28')]({'session':_0x27d6ab['id'],'module_name':_0x0399('0x17'),'query':util[_0x0399('0x21')](_0x0399('0x32'),_0xd02fcc),'order_by':'','offset':'0','select_fields':['id',_0x0399('0x19'),_0x0399('0x33')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x0399('0x34')](function(_0x3838e2){if(_0x3838e2['entry_list'][_0x0399('0x35')]){var _0xbac506=_['find'](_0x3838e2['entry_list'],function(_0x59037b){return _0x59037b[_0x0399('0x2f')][_0x0399('0x33')][_0x0399('0x2d')]===_0xd02fcc;});if(_0xbac506){logger[_0x0399('0xc')]('Enduser\x20found!');return BPromise[_0x0399('0x30')]({'id':_0xbac506[_0x0399('0x2f')]['id'][_0x0399('0x2d')],'name':_0xbac506[_0x0399('0x2f')][_0x0399('0x19')]['value'],'phone':_0xbac506[_0x0399('0x2f')]['phone_home'][_0x0399('0x2d')]});}}else{logger[_0x0399('0xc')](_0x0399('0x36'));return request({'form':{'method':_0x0399('0x1e'),'input_type':_0x0399('0x1f'),'response_type':_0x0399('0x1f'),'rest_data':JSON[_0x0399('0x28')]({'session':_0x27d6ab['id'],'module_name':'Contacts','name_value_list':[{'name':_0x0399('0x37'),'value':_0x3e8892!==_0x0399('0x38')?_0x3e8892:util[_0x0399('0x21')](_0x0399('0x39'),_0xd02fcc)},{'name':'phone_home','value':_0xd02fcc}]})}})[_0x0399('0x34')](function(_0xa0462b){logger[_0x0399('0xc')](_0x0399('0x3a'));return BPromise['resolve']({'id':_0xa0462b['id'],'name':_0xa0462b[_0x0399('0x2b')][_0x0399('0x37')]['value'],'phone':_0xa0462b[_0x0399('0x2b')][_0x0399('0x33')][_0x0399('0x2d')]});});}});}function request(_0x2f7a60){logger['debug']('[HTTP]',JSON[_0x0399('0x28')](_0x2f7a60));return rp(_[_0x0399('0x3b')](def,_0x2f7a60));}function getTags(_0x1ccf91,_0x598a1c){var _0x52aafd=[];if(_0x1ccf91&&_0x1ccf91[_0x0399('0x35')]>0x0){_0x52aafd=_['map'](_0x1ccf91,_0x598a1c);}return _0x52aafd;}function getCustomFields(_0x2f70e5,_0x4b404e){var _0x48c2ba=[];var _0x1d74aa={'custom_fields':[]};if(_0x2f70e5['length']>0x0){_[_0x0399('0x1a')](_0x2f70e5,function(_0x56fc87){if(_0x56fc87['type']===_0x0399('0x3c')&&_0x56fc87[_0x0399('0x3d')]&&!_0x56fc87[_0x0399('0x3e')]){_0x1d74aa[_0x56fc87[_0x0399('0x3d')]['toLowerCase']()]=_0x56fc87[_0x0399('0x3f')][_0x0399('0x40')]();}else if(_0x56fc87[_0x0399('0x41')]===_0x0399('0x3c')&&_0x56fc87[_0x0399('0x1c')]&&_0x56fc87[_0x0399('0x3e')]){_0x1d74aa[_0x0399('0x42')][_0x0399('0x1b')]({'id':_0x56fc87[_0x0399('0x1c')],'value':_0x56fc87['content']['toString']()});}else if(_0x56fc87[_0x0399('0x41')]==='variable'&&_0x56fc87[_0x0399('0x1d')]&&_0x56fc87['idField']&&_0x56fc87[_0x0399('0x3e')]){_0x4b404e[_0x56fc87['variableName']]&&_0x1d74aa[_0x0399('0x42')][_0x0399('0x1b')]({'id':_0x56fc87[_0x0399('0x1c')],'value':_0x4b404e[_0x56fc87[_0x0399('0x1d')]][_0x0399('0x40')]()});}else if(_0x56fc87[_0x0399('0x41')]===_0x0399('0x43')&&_0x56fc87[_0x0399('0x44')]&&_0x56fc87[_0x0399('0x44')][_0x0399('0x19')]&&_0x56fc87[_0x0399('0x1c')]&&_0x56fc87[_0x0399('0x3e')]){_0x4b404e[_0x56fc87[_0x0399('0x44')][_0x0399('0x19')][_0x0399('0x45')]()]&&_0x1d74aa[_0x0399('0x42')]['push']({'id':_0x56fc87[_0x0399('0x1c')],'value':_0x4b404e[_0x56fc87['Variable'][_0x0399('0x19')][_0x0399('0x45')]()]['toString']()});}});}return _0x1d74aa;}function getConnection(_0x4c567c){return request({'method':'POST','form':{'method':'login','input_type':'JSON','response_type':_0x0399('0x1f'),'rest_data':JSON[_0x0399('0x28')]({'user_auth':{'user_name':_0x4c567c['username'],'password':_0x4c567c[_0x0399('0x46')],'encryption':_0x0399('0x47')},'application':'xCALLY\x20Motion\x20integration'})}})[_0x0399('0x34')](function(_0x5973f3){var _0x4d5265=_0x5973f3;if(_0x4d5265['id']){def[_0x0399('0x48')]=_0x4d5265['id'];return BPromise['resolve'](_0x4d5265);}else{throw new Error(util[_0x0399('0x21')](_0x0399('0x49'),_0x4c567c['id']));}});}function setRelationship(_0x571f32,_0x496609,_0x483ee6,_0x31b0b6){return request({'form':{'method':'set_relationship','input_type':_0x0399('0x1f'),'response_type':_0x0399('0x1f'),'rest_data':JSON[_0x0399('0x28')]({'session':_0x571f32['id'],'module_name':_0x0399('0x20'),'module_id':_0x483ee6['id'],'link_field_name':_0x31b0b6,'related_ids':[_0x496609['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x0399('0x4a')]=function(_0x8a5d06,_0x29994d,_0x49da1f,_0x4ff150,_0x32dff7,_0x2cb670){var _0x5613cf,_0x1ee294,_0x39076a,_0x5778be;_0x2cb670[_0x0399('0x4b')]=intUtil[_0x0399('0x4c')](_0x2cb670['remoteUri']);_0x2cb670[_0x0399('0x4d')]=intUtil[_0x0399('0x4c')](_0x2cb670[_0x0399('0x4d')]);def[_0x0399('0x4e')]=util[_0x0399('0x21')](_0x0399('0x4f'),_0x2cb670['remoteUri']);if(_0x32dff7&&_0x32dff7[_0x0399('0x50')]){logger[_0x0399('0xc')]('[QUEUE]',_0x0399('0x51'));_0x29994d['recordingURL']=util[_0x0399('0x21')](_0x0399('0x52'),_0x2cb670[_0x0399('0x4d')],_0x29994d[_0x0399('0x53')],md5(_0x29994d[_0x0399('0x53')]));}else{_0x29994d['recordingURL']='';}return getConnection(_0x2cb670)[_0x0399('0x34')](function(_0x20a9ee){_0x5778be=_0x20a9ee;return getUser(_0x2cb670,_0x4ff150[_0x0399('0x19')],_0x5778be);})[_0x0399('0x34')](function(_0x5b8c0a){_0x5613cf=_0x5b8c0a;logger[_0x0399('0xc')]('The\x20User\x20ID\x20is:',_0x5613cf['id']);return getEndUser(_0x2cb670,_0x29994d['calleridname'],_0x29994d[_0x0399('0x54')],_0x5778be);})[_0x0399('0x34')](function(_0x4fc3f9){_0x1ee294=_0x4fc3f9;logger[_0x0399('0xc')]('The\x20Enduser\x20ID\x20is:',_0x1ee294['id']);return getTicket(_0x2cb670,_0x5613cf,_0x1ee294,_0x49da1f,_0x29994d,_0x49da1f[_0x0399('0x55')],_0x5778be,'Inbound');})[_0x0399('0x34')](function(_0x45cb4b){_0x39076a=_0x45cb4b;logger[_0x0399('0xc')]('Ticket\x20created!');logger[_0x0399('0xc')](_0x0399('0x56'),_0x39076a['id']);return setRelationship(_0x5778be,_0x5613cf,_0x39076a,_0x0399('0x57'));})[_0x0399('0x34')](function(){return setRelationship(_0x5778be,_0x1ee294,_0x39076a,'contacts');})[_0x0399('0x34')](function(){return getServerInfo(_0x5778be);})['then'](function(_0x4c489e){var _0x4825ce=parseInt(_0x4c489e[_0x0399('0x58')][_0x0399('0x59')](0x0));var _0x13b1f2=util[_0x0399('0x21')](_0x0399('0x5a'),_0x2cb670[_0x0399('0x4b')],_0x39076a['id']);if(_0x4825ce>0x6){_0x13b1f2=util[_0x0399('0x21')](_0x0399('0x5b'),_0x2cb670[_0x0399('0x4b')],_0x39076a['id']);}logger['info'](_0x0399('0x5c'),_0x0399('0x5d'));emit(util[_0x0399('0x21')](_0x0399('0x5e'),_0x4ff150[_0x0399('0x19')]),_0x0399('0x5f'),{'uri':_0x13b1f2});})[_0x0399('0x60')](function(_0x598fbc){logger['error'](_0x0399('0x5c'),JSON[_0x0399('0x28')](_0x598fbc));});};exports[_0x0399('0x61')]=function(_0x3cabce,_0x3051e6,_0x18c049,_0x14d9ee,_0x1b871f,_0xb8df98,_0x352ac7){var _0x528f77,_0x565c46,_0x59552d,_0x36b798;_0xb8df98[_0x0399('0x4b')]=intUtil[_0x0399('0x4c')](_0xb8df98['remoteUri']);_0xb8df98[_0x0399('0x4d')]=intUtil[_0x0399('0x4c')](_0xb8df98[_0x0399('0x4d')]);def[_0x0399('0x4e')]=util['format']('%s/service/v4_1/rest.php',_0xb8df98[_0x0399('0x4b')]);if(_0x352ac7&&_0x352ac7[_0x0399('0x62')]&&_0x352ac7['recordingFormat']!=='none'){logger[_0x0399('0xc')](_0x0399('0x63'),_0x0399('0x51'));_0x3051e6[_0x0399('0x64')]=util[_0x0399('0x21')](_0x0399('0x52'),_0xb8df98['serverUrl'],_0x3051e6[_0x0399('0x53')],md5(_0x3051e6[_0x0399('0x53')]));}return getConnection(_0xb8df98)[_0x0399('0x34')](function(_0x19ce7c){_0x36b798=_0x19ce7c;return getUser(_0xb8df98,_0x14d9ee[_0x0399('0x19')],_0x36b798);})['then'](function(_0x319282){_0x528f77=_0x319282;logger[_0x0399('0xc')](_0x0399('0x65'),_0x528f77['id']);return getEndUser(_0xb8df98,_0x3051e6[_0x0399('0x66')],_0x3051e6['destcalleridnum'],_0x36b798);})[_0x0399('0x34')](function(_0x5b25e3){_0x565c46=_0x5b25e3;logger[_0x0399('0xc')]('The\x20Enduser\x20ID\x20is:',_0x565c46['id']);return getTicket(_0xb8df98,_0x528f77,_0x565c46,_0x18c049,_0x3051e6,_0x18c049['Fields'],_0x36b798,_0x0399('0x67'));})[_0x0399('0x34')](function(_0x171438){_0x59552d=_0x171438;logger[_0x0399('0xc')](_0x0399('0x68'));logger[_0x0399('0xc')](_0x0399('0x56'),_0x59552d['id']);return setRelationship(_0x36b798,_0x528f77,_0x59552d,_0x0399('0x57'));})[_0x0399('0x34')](function(){return setRelationship(_0x36b798,_0x565c46,_0x59552d,_0x0399('0x69'));})[_0x0399('0x34')](function(){return getServerInfo(_0x36b798);})[_0x0399('0x34')](function(_0x51b509){var _0x5df119=parseInt(_0x51b509['version'][_0x0399('0x59')](0x0));var _0x45622b=util['format'](_0x0399('0x5a'),_0xb8df98[_0x0399('0x4b')],_0x59552d['id']);if(_0x5df119>0x6){_0x45622b=util['format'](_0x0399('0x5b'),_0xb8df98[_0x0399('0x4b')],_0x59552d['id']);}logger[_0x0399('0xc')]('[OUTBOUND]',_0x0399('0x5d'));emit(util['format'](_0x0399('0x5e'),_0x14d9ee['name']),'trigger:browser:url',{'uri':_0x45622b});})[_0x0399('0x60')](function(_0x551fb0){logger[_0x0399('0x6a')](_0x0399('0x63'),JSON['stringify'](_0x551fb0));});};exports[_0x0399('0x6b')]=function(_0x15d3a6,_0x521a6c,_0x49f7b1,_0x29ed64,_0x122ac7,_0x2d8340){var _0x5c4c83,_0x5919ac,_0x34e32b,_0x142a7d;_0x2d8340['remoteUri']=intUtil['stripTrailingSlash'](_0x2d8340[_0x0399('0x4b')]);_0x2d8340[_0x0399('0x4d')]=intUtil[_0x0399('0x4c')](_0x2d8340[_0x0399('0x4d')]);def[_0x0399('0x4e')]=util['format'](_0x0399('0x4f'),_0x2d8340[_0x0399('0x4b')]);if(_0x122ac7&&_0x122ac7['monitor_format']){logger[_0x0399('0xc')]('['+_0x521a6c[_0x0399('0x6c')][_0x0399('0x6d')]()+']',_0x0399('0x51'));_0x521a6c[_0x0399('0x64')]=util[_0x0399('0x21')](_0x0399('0x52'),_0x2d8340['serverUrl'],_0x521a6c[_0x0399('0x53')],md5(_0x521a6c['uniqueid']));}else{_0x521a6c[_0x0399('0x64')]='';}return getConnection(_0x2d8340)[_0x0399('0x34')](function(_0x1e3c46){_0x142a7d=_0x1e3c46;if(!_[_0x0399('0x26')](_0x29ed64)){return getUser(_0x2d8340,_0x29ed64['name'],_0x142a7d);}else{return getUser(_0x2d8340,null,_0x142a7d);}})[_0x0399('0x34')](function(_0x548f6d){_0x5c4c83=_0x548f6d;logger[_0x0399('0xc')]('The\x20User\x20ID\x20is:',_0x5c4c83['id']);return getEndUser(_0x2d8340,_0x521a6c[_0x0399('0x6e')],_0x521a6c[_0x0399('0x54')],_0x142a7d);})[_0x0399('0x34')](function(_0x30bdbc){_0x5919ac=_0x30bdbc;logger[_0x0399('0xc')](_0x0399('0x6f'),_0x5919ac['id']);return getTicket(_0x2d8340,_0x5c4c83,_0x5919ac,_0x49f7b1,_0x521a6c,_0x49f7b1['Fields'],_0x142a7d,'Inbound');})[_0x0399('0x34')](function(_0x25345c){_0x34e32b=_0x25345c;logger[_0x0399('0xc')](_0x0399('0x68'));logger[_0x0399('0xc')](_0x0399('0x56'),_0x34e32b['id']);return setRelationship(_0x142a7d,_0x5c4c83,_0x34e32b,_0x0399('0x57'));})[_0x0399('0x34')](function(){return setRelationship(_0x142a7d,_0x5919ac,_0x34e32b,_0x0399('0x69'));})[_0x0399('0x34')](function(){return getServerInfo(_0x142a7d);})[_0x0399('0x60')](function(_0xa72abd){logger[_0x0399('0x6a')]('['+_0x521a6c[_0x0399('0x6c')][_0x0399('0x6d')]()+']',JSON[_0x0399('0x28')](_0xa72abd));});}; \ No newline at end of file +var _0x4aea=['The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','./util','../../../../config/environment','../../../../config/logger','redis','localhost','socket.io-emitter','POST','emit','Creating\x20new\x20ticket...','name','getString','created_by','description','Descriptions','toISOString','slice','duration_hours','duration_minutes','parent_id','parent_type','parent_name','forEach','variableName','set_entry','JSON','stringify','Calls','format','apiKey','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','name_value_list','info','Agent\x20found!','resolve','value','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','find','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Enduser\x20created.','debug','[HTTP]','length','map','type','string','nameField','toLowerCase','customField','custom_fields','push','idField','content','customVariable','Variable','username','password','sessionID','set_relationship','remoteUri','stripTrailingSlash','uri','%s/service/v4_1/rest.php','monitor_format','Recording\x20is\x20enabled!','recordingURL','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','version','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','catch','error','[QUEUE]','serverUrl','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid'];(function(_0x370fd2,_0x413f1d){var _0x2acc0d=function(_0x54f0c5){while(--_0x54f0c5){_0x370fd2['push'](_0x370fd2['shift']());}};_0x2acc0d(++_0x413f1d);}(_0x4aea,0x1d5));var _0xa4ae=function(_0x39f73e,_0x4dbe89){_0x39f73e=_0x39f73e-0x0;var _0x4891a6=_0x4aea[_0x39f73e];return _0x4891a6;};'use strict';var _=require(_0xa4ae('0x0'));var rp=require(_0xa4ae('0x1'));var BPromise=require(_0xa4ae('0x2'));var md5=require('md5');var util=require(_0xa4ae('0x3'));var Redis=require('ioredis');var intUtil=require(_0xa4ae('0x4'));var config=require(_0xa4ae('0x5'));var logger=require(_0xa4ae('0x6'))('sugarcrm');config[_0xa4ae('0x7')]=_['defaults'](config[_0xa4ae('0x7')],{'host':_0xa4ae('0x8'),'port':0x18eb});var io=require(_0xa4ae('0x9'))(new Redis(config['redis']));var def={'method':_0xa4ae('0xa'),'json':!![]};function emit(_0x7ca5b,_0x5e9379,_0x2c3d2b){io['to'](_0x7ca5b)[_0xa4ae('0xb')](_0x5e9379,_0x2c3d2b);}function getTicket(_0x3cbf08,_0x316065,_0x36dbd9,_0x2f0846,_0x2304bb,_0x115f4f,_0x30cd47,_0x3d6664){logger['info'](_0xa4ae('0xc'));var _0x13f5fd=new Date();var _0x418cab=[{'name':_0xa4ae('0xd'),'value':intUtil[_0xa4ae('0xe')](_0x2f0846['Subjects'],_0x2304bb,'\x20')},{'name':'assigned_user_id','value':_0x316065['id']},{'name':_0xa4ae('0xf'),'value':_0x316065['id']},{'name':_0xa4ae('0x10'),'value':intUtil[_0xa4ae('0xe')](_0x2f0846[_0xa4ae('0x11')],_0x2304bb,'\x0a')},{'name':'date_start','value':_0x13f5fd[_0xa4ae('0x12')]()[_0xa4ae('0x13')](0x0,0x13)['replace']('T','\x20')},{'name':_0xa4ae('0x14'),'value':'0'},{'name':_0xa4ae('0x15'),'value':'15'},{'name':_0xa4ae('0x16'),'value':_0x36dbd9['id']},{'name':_0xa4ae('0x17'),'value':'Contacts'},{'name':_0xa4ae('0x18'),'value':_0x36dbd9['name']},{'name':'direction','value':_0x3d6664}];if(_0x115f4f['length']){_[_0xa4ae('0x19')](_0x115f4f,function(_0x5de7a7){if(_0x2304bb[_0x5de7a7['variableName']]){_0x418cab['push']({'name':_0x5de7a7['idField'],'value':_0x2304bb[_0x5de7a7[_0xa4ae('0x1a')]]});}});}return request({'form':{'method':_0xa4ae('0x1b'),'input_type':'JSON','response_type':_0xa4ae('0x1c'),'rest_data':JSON[_0xa4ae('0x1d')]({'session':_0x30cd47['id'],'module_name':_0xa4ae('0x1e'),'name_value_list':_0x418cab})}});}function getAuth(_0x1ffed1){return util[_0xa4ae('0x1f')]('Basic\x20%s',new Buffer(_0x1ffed1[_0xa4ae('0x20')]+':X')[_0xa4ae('0x21')](_0xa4ae('0x22')));}function getServerInfo(_0x133eec){return request({'form':{'method':_0xa4ae('0x23'),'input_type':_0xa4ae('0x1c'),'response_type':'JSON','rest_data':JSON['stringify']({'session':_0x133eec['id']})}});}function getUser(_0x4a5dc6,_0xabd9a1,_0x333ee6){if(!_[_0xa4ae('0x24')](_0xabd9a1)){logger['info'](_0xa4ae('0x25'),_0xabd9a1);return request({'form':{'method':_0xa4ae('0x26'),'input_type':_0xa4ae('0x1c'),'response_type':_0xa4ae('0x1c'),'rest_data':JSON[_0xa4ae('0x1d')]({'session':_0x333ee6['id'],'module_name':'Employees','query':util[_0xa4ae('0x1f')](_0xa4ae('0x27'),_0xabd9a1),'order_by':'','offset':'0','select_fields':['id','name',_0xa4ae('0x28')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0xa4ae('0x29')](function(_0x5bab20){if(_0x5bab20[_0xa4ae('0x2a')]['length']){var _0xc3f038=_['find'](_0x5bab20[_0xa4ae('0x2a')],function(_0x4e264d){return _0x4e264d[_0xa4ae('0x2b')]['user_name']['value']===_0xabd9a1;});if(_0xc3f038){logger[_0xa4ae('0x2c')](_0xa4ae('0x2d'));return BPromise[_0xa4ae('0x2e')]({'id':_0xc3f038[_0xa4ae('0x2b')]['id'][_0xa4ae('0x2f')],'name':_0xc3f038['name_value_list'][_0xa4ae('0xd')][_0xa4ae('0x2f')]});}}logger[_0xa4ae('0x2c')](_0xa4ae('0x30'));return BPromise[_0xa4ae('0x2e')]({'id':_0x333ee6[_0xa4ae('0x2b')][_0xa4ae('0x31')][_0xa4ae('0x2f')],'name':_0x333ee6[_0xa4ae('0x2b')][_0xa4ae('0x28')]['value']});});}else{logger['info'](_0xa4ae('0x32'));return BPromise[_0xa4ae('0x2e')]({'id':_0x333ee6['name_value_list']['user_id'][_0xa4ae('0x2f')],'name':_0x333ee6['name_value_list'][_0xa4ae('0x28')][_0xa4ae('0x2f')]});}}function getEndUser(_0xc3c3f7,_0x413b93,_0x5d5e23,_0x5db3d0){logger[_0xa4ae('0x2c')]('Searching\x20enduser\x20with\x20phone',_0x5d5e23);return request({'form':{'method':_0xa4ae('0x26'),'input_type':_0xa4ae('0x1c'),'response_type':_0xa4ae('0x1c'),'rest_data':JSON[_0xa4ae('0x1d')]({'session':_0x5db3d0['id'],'module_name':_0xa4ae('0x33'),'query':util[_0xa4ae('0x1f')](_0xa4ae('0x34'),_0x5d5e23),'order_by':'','offset':'0','select_fields':['id',_0xa4ae('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x20bd63){if(_0x20bd63['entry_list']['length']){var _0x277dc3=_[_0xa4ae('0x35')](_0x20bd63[_0xa4ae('0x2a')],function(_0x51a31f){return _0x51a31f[_0xa4ae('0x2b')][_0xa4ae('0x36')][_0xa4ae('0x2f')]===_0x5d5e23;});if(_0x277dc3){logger[_0xa4ae('0x2c')](_0xa4ae('0x37'));return BPromise[_0xa4ae('0x2e')]({'id':_0x277dc3['name_value_list']['id'][_0xa4ae('0x2f')],'name':_0x277dc3[_0xa4ae('0x2b')]['name'][_0xa4ae('0x2f')],'phone':_0x277dc3[_0xa4ae('0x2b')][_0xa4ae('0x36')][_0xa4ae('0x2f')]});}}else{logger['info'](_0xa4ae('0x38'));return request({'form':{'method':_0xa4ae('0x1b'),'input_type':'JSON','response_type':_0xa4ae('0x1c'),'rest_data':JSON['stringify']({'session':_0x5db3d0['id'],'module_name':_0xa4ae('0x33'),'name_value_list':[{'name':_0xa4ae('0x39'),'value':_0x413b93!==_0xa4ae('0x3a')?_0x413b93:util[_0xa4ae('0x1f')]('Caller\x20-\x20%s',_0x5d5e23)},{'name':'phone_home','value':_0x5d5e23}]})}})[_0xa4ae('0x29')](function(_0x451809){logger['info'](_0xa4ae('0x3b'));return BPromise[_0xa4ae('0x2e')]({'id':_0x451809['id'],'name':_0x451809['entry_list'][_0xa4ae('0x39')]['value'],'phone':_0x451809['entry_list'][_0xa4ae('0x36')]['value']});});}});}function request(_0x8ad5cc){logger[_0xa4ae('0x3c')](_0xa4ae('0x3d'),JSON[_0xa4ae('0x1d')](_0x8ad5cc));return rp(_['merge'](def,_0x8ad5cc));}function getTags(_0x3411c8,_0x5a00fb){var _0x23d950=[];if(_0x3411c8&&_0x3411c8[_0xa4ae('0x3e')]>0x0){_0x23d950=_[_0xa4ae('0x3f')](_0x3411c8,_0x5a00fb);}return _0x23d950;}function getCustomFields(_0x2d92de,_0x5d71d9){var _0xc34086=[];var _0x4a78e8={'custom_fields':[]};if(_0x2d92de[_0xa4ae('0x3e')]>0x0){_[_0xa4ae('0x19')](_0x2d92de,function(_0x2535c5){if(_0x2535c5[_0xa4ae('0x40')]===_0xa4ae('0x41')&&_0x2535c5[_0xa4ae('0x42')]&&!_0x2535c5['customField']){_0x4a78e8[_0x2535c5[_0xa4ae('0x42')][_0xa4ae('0x43')]()]=_0x2535c5['content'][_0xa4ae('0x21')]();}else if(_0x2535c5[_0xa4ae('0x40')]==='string'&&_0x2535c5['idField']&&_0x2535c5[_0xa4ae('0x44')]){_0x4a78e8[_0xa4ae('0x45')][_0xa4ae('0x46')]({'id':_0x2535c5[_0xa4ae('0x47')],'value':_0x2535c5[_0xa4ae('0x48')][_0xa4ae('0x21')]()});}else if(_0x2535c5[_0xa4ae('0x40')]==='variable'&&_0x2535c5[_0xa4ae('0x1a')]&&_0x2535c5['idField']&&_0x2535c5[_0xa4ae('0x44')]){_0x5d71d9[_0x2535c5[_0xa4ae('0x1a')]]&&_0x4a78e8[_0xa4ae('0x45')][_0xa4ae('0x46')]({'id':_0x2535c5['idField'],'value':_0x5d71d9[_0x2535c5[_0xa4ae('0x1a')]][_0xa4ae('0x21')]()});}else if(_0x2535c5['type']===_0xa4ae('0x49')&&_0x2535c5['Variable']&&_0x2535c5[_0xa4ae('0x4a')]['name']&&_0x2535c5[_0xa4ae('0x47')]&&_0x2535c5[_0xa4ae('0x44')]){_0x5d71d9[_0x2535c5[_0xa4ae('0x4a')][_0xa4ae('0xd')][_0xa4ae('0x43')]()]&&_0x4a78e8[_0xa4ae('0x45')][_0xa4ae('0x46')]({'id':_0x2535c5[_0xa4ae('0x47')],'value':_0x5d71d9[_0x2535c5[_0xa4ae('0x4a')][_0xa4ae('0xd')][_0xa4ae('0x43')]()]['toString']()});}});}return _0x4a78e8;}function getConnection(_0x3d2f31){return request({'method':_0xa4ae('0xa'),'form':{'method':'login','input_type':_0xa4ae('0x1c'),'response_type':_0xa4ae('0x1c'),'rest_data':JSON[_0xa4ae('0x1d')]({'user_auth':{'user_name':_0x3d2f31[_0xa4ae('0x4b')],'password':_0x3d2f31[_0xa4ae('0x4c')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0xa4ae('0x29')](function(_0xbf7d94){var _0x5bb09b=_0xbf7d94;if(_0x5bb09b['id']){def[_0xa4ae('0x4d')]=_0x5bb09b['id'];return BPromise[_0xa4ae('0x2e')](_0x5bb09b);}else{throw new Error(util[_0xa4ae('0x1f')]('Account\x20%d\x20is\x20not\x20valid',_0x3d2f31['id']));}});}function setRelationship(_0x1d396a,_0x5c44a0,_0x5414f1,_0x538a01){return request({'form':{'method':_0xa4ae('0x4e'),'input_type':'JSON','response_type':_0xa4ae('0x1c'),'rest_data':JSON[_0xa4ae('0x1d')]({'session':_0x1d396a['id'],'module_name':_0xa4ae('0x1e'),'module_id':_0x5414f1['id'],'link_field_name':_0x538a01,'related_ids':[_0x5c44a0['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x54afee,_0x2e7c3d,_0x40ee8d,_0x4bdc74,_0x28c87e,_0x1d39c7){var _0x79d0eb,_0x5b61e4,_0x22a3d0,_0xd5817a;_0x1d39c7[_0xa4ae('0x4f')]=intUtil[_0xa4ae('0x50')](_0x1d39c7[_0xa4ae('0x4f')]);_0x1d39c7['serverUrl']=intUtil[_0xa4ae('0x50')](_0x1d39c7['serverUrl']);def[_0xa4ae('0x51')]=util[_0xa4ae('0x1f')](_0xa4ae('0x52'),_0x1d39c7[_0xa4ae('0x4f')]);if(_0x28c87e&&_0x28c87e[_0xa4ae('0x53')]){logger[_0xa4ae('0x2c')]('[QUEUE]',_0xa4ae('0x54'));_0x2e7c3d[_0xa4ae('0x55')]=util[_0xa4ae('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d39c7['serverUrl'],_0x2e7c3d['uniqueid'],md5(_0x2e7c3d['uniqueid']));}else{_0x2e7c3d[_0xa4ae('0x55')]='';}return getConnection(_0x1d39c7)[_0xa4ae('0x29')](function(_0x422d95){_0xd5817a=_0x422d95;return getUser(_0x1d39c7,_0x4bdc74[_0xa4ae('0xd')],_0xd5817a);})[_0xa4ae('0x29')](function(_0x2dd312){_0x79d0eb=_0x2dd312;logger[_0xa4ae('0x2c')]('The\x20User\x20ID\x20is:',_0x79d0eb['id']);return getEndUser(_0x1d39c7,_0x2e7c3d[_0xa4ae('0x56')],_0x2e7c3d[_0xa4ae('0x57')],_0xd5817a);})[_0xa4ae('0x29')](function(_0x5312d6){_0x5b61e4=_0x5312d6;logger[_0xa4ae('0x2c')](_0xa4ae('0x58'),_0x5b61e4['id']);return getTicket(_0x1d39c7,_0x79d0eb,_0x5b61e4,_0x40ee8d,_0x2e7c3d,_0x40ee8d[_0xa4ae('0x59')],_0xd5817a,_0xa4ae('0x5a'));})[_0xa4ae('0x29')](function(_0x2e4451){_0x22a3d0=_0x2e4451;logger[_0xa4ae('0x2c')](_0xa4ae('0x5b'));logger[_0xa4ae('0x2c')](_0xa4ae('0x5c'),_0x22a3d0['id']);return setRelationship(_0xd5817a,_0x79d0eb,_0x22a3d0,_0xa4ae('0x5d'));})[_0xa4ae('0x29')](function(){return setRelationship(_0xd5817a,_0x5b61e4,_0x22a3d0,_0xa4ae('0x5e'));})[_0xa4ae('0x29')](function(){return getServerInfo(_0xd5817a);})[_0xa4ae('0x29')](function(_0x187b67){var _0x3256b8=parseInt(_0x187b67[_0xa4ae('0x5f')][_0xa4ae('0x60')](0x0));var _0x446775=util[_0xa4ae('0x1f')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x1d39c7[_0xa4ae('0x4f')],_0x22a3d0['id']);if(_0x3256b8>0x6){_0x446775=util['format'](_0xa4ae('0x61'),_0x1d39c7[_0xa4ae('0x4f')],_0x22a3d0['id']);}logger[_0xa4ae('0x2c')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa4ae('0x1f')]('user:%s',_0x4bdc74[_0xa4ae('0xd')]),_0xa4ae('0x62'),{'uri':_0x446775});})[_0xa4ae('0x63')](function(_0x2bc6fe){logger[_0xa4ae('0x64')](_0xa4ae('0x65'),JSON[_0xa4ae('0x1d')](_0x2bc6fe));});};exports['outbound']=function(_0x1e6dd9,_0x4c1d98,_0x2e21f,_0xc6e4f4,_0x380a5f,_0x4bc12a,_0x262f0a){var _0x4b60f6,_0x1f485c,_0x18ae46,_0x157da7;_0x4bc12a[_0xa4ae('0x4f')]=intUtil[_0xa4ae('0x50')](_0x4bc12a['remoteUri']);_0x4bc12a['serverUrl']=intUtil['stripTrailingSlash'](_0x4bc12a[_0xa4ae('0x66')]);def['uri']=util['format']('%s/service/v4_1/rest.php',_0x4bc12a[_0xa4ae('0x4f')]);if(_0x262f0a&&_0x262f0a['recordingFormat']&&_0x262f0a['recordingFormat']!=='none'){logger['info'](_0xa4ae('0x67'),_0xa4ae('0x54'));_0x4c1d98['recordingURL']=util['format'](_0xa4ae('0x68'),_0x4bc12a[_0xa4ae('0x66')],_0x4c1d98[_0xa4ae('0x69')],md5(_0x4c1d98[_0xa4ae('0x69')]));}return getConnection(_0x4bc12a)[_0xa4ae('0x29')](function(_0x56581f){_0x157da7=_0x56581f;return getUser(_0x4bc12a,_0xc6e4f4[_0xa4ae('0xd')],_0x157da7);})['then'](function(_0x581368){_0x4b60f6=_0x581368;logger['info'](_0xa4ae('0x6a'),_0x4b60f6['id']);return getEndUser(_0x4bc12a,_0x4c1d98[_0xa4ae('0x6b')],_0x4c1d98[_0xa4ae('0x6c')],_0x157da7);})[_0xa4ae('0x29')](function(_0x5802ff){_0x1f485c=_0x5802ff;logger[_0xa4ae('0x2c')](_0xa4ae('0x58'),_0x1f485c['id']);return getTicket(_0x4bc12a,_0x4b60f6,_0x1f485c,_0x2e21f,_0x4c1d98,_0x2e21f[_0xa4ae('0x59')],_0x157da7,_0xa4ae('0x6d'));})['then'](function(_0x5015af){_0x18ae46=_0x5015af;logger[_0xa4ae('0x2c')]('Ticket\x20created!');logger['info'](_0xa4ae('0x5c'),_0x18ae46['id']);return setRelationship(_0x157da7,_0x4b60f6,_0x18ae46,_0xa4ae('0x5d'));})[_0xa4ae('0x29')](function(){return setRelationship(_0x157da7,_0x1f485c,_0x18ae46,_0xa4ae('0x5e'));})['then'](function(){return getServerInfo(_0x157da7);})[_0xa4ae('0x29')](function(_0x1f221c){var _0xc1f695=parseInt(_0x1f221c['version'][_0xa4ae('0x60')](0x0));var _0x510164=util[_0xa4ae('0x1f')](_0xa4ae('0x6e'),_0x4bc12a[_0xa4ae('0x4f')],_0x18ae46['id']);if(_0xc1f695>0x6){_0x510164=util[_0xa4ae('0x1f')](_0xa4ae('0x61'),_0x4bc12a[_0xa4ae('0x4f')],_0x18ae46['id']);}logger['info'](_0xa4ae('0x67'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa4ae('0x1f')](_0xa4ae('0x6f'),_0xc6e4f4['name']),'trigger:browser:url',{'uri':_0x510164});})['catch'](function(_0xf3b923){logger['error'](_0xa4ae('0x67'),JSON[_0xa4ae('0x1d')](_0xf3b923));});};exports[_0xa4ae('0x70')]=function(_0xfb8114,_0x37dd3e,_0x3c5947,_0x596a2b,_0x4e5fea,_0x5e2bf8){var _0x39f201,_0x1ab115,_0x5bbccb,_0x322796;_0x5e2bf8['remoteUri']=intUtil[_0xa4ae('0x50')](_0x5e2bf8[_0xa4ae('0x4f')]);_0x5e2bf8['serverUrl']=intUtil[_0xa4ae('0x50')](_0x5e2bf8['serverUrl']);def[_0xa4ae('0x51')]=util[_0xa4ae('0x1f')](_0xa4ae('0x52'),_0x5e2bf8[_0xa4ae('0x4f')]);if(_0x4e5fea&&_0x4e5fea[_0xa4ae('0x53')]){logger[_0xa4ae('0x2c')]('['+_0x37dd3e['lastevent']['toUpperCase']()+']',_0xa4ae('0x54'));_0x37dd3e[_0xa4ae('0x55')]=util[_0xa4ae('0x1f')](_0xa4ae('0x68'),_0x5e2bf8[_0xa4ae('0x66')],_0x37dd3e[_0xa4ae('0x69')],md5(_0x37dd3e['uniqueid']));}else{_0x37dd3e[_0xa4ae('0x55')]='';}return getConnection(_0x5e2bf8)['then'](function(_0x3dce6b){_0x322796=_0x3dce6b;if(!_[_0xa4ae('0x24')](_0x596a2b)){return getUser(_0x5e2bf8,_0x596a2b[_0xa4ae('0xd')],_0x322796);}else{return getUser(_0x5e2bf8,null,_0x322796);}})[_0xa4ae('0x29')](function(_0x4368ab){_0x39f201=_0x4368ab;logger['info'](_0xa4ae('0x6a'),_0x39f201['id']);return getEndUser(_0x5e2bf8,_0x37dd3e['calleridname'],_0x37dd3e[_0xa4ae('0x57')],_0x322796);})[_0xa4ae('0x29')](function(_0xbad599){_0x1ab115=_0xbad599;logger['info'](_0xa4ae('0x58'),_0x1ab115['id']);return getTicket(_0x5e2bf8,_0x39f201,_0x1ab115,_0x3c5947,_0x37dd3e,_0x3c5947[_0xa4ae('0x59')],_0x322796,_0xa4ae('0x5a'));})[_0xa4ae('0x29')](function(_0x305495){_0x5bbccb=_0x305495;logger[_0xa4ae('0x2c')](_0xa4ae('0x5b'));logger[_0xa4ae('0x2c')]('The\x20Ticket\x20ID\x20is:',_0x5bbccb['id']);return setRelationship(_0x322796,_0x39f201,_0x5bbccb,_0xa4ae('0x5d'));})[_0xa4ae('0x29')](function(){return setRelationship(_0x322796,_0x1ab115,_0x5bbccb,'contacts');})[_0xa4ae('0x29')](function(){return getServerInfo(_0x322796);})[_0xa4ae('0x63')](function(_0x99efe){logger[_0xa4ae('0x64')]('['+_0x37dd3e[_0xa4ae('0x71')][_0xa4ae('0x72')]()+']',JSON[_0xa4ae('0x1d')](_0x99efe));});}; \ 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 619e2e9..b770304 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 _0x79be=['type','string','push','content','variable','toString','customVariable','name','Variable','toLowerCase','keyType','format','%s:\x20%s','key','keyContent','variableName','join','stripTrailingSlash','slice','substring','validateEmail','lodash','util','length','sortBy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x79be,0x1a5));var _0xe79b=function(_0x3aab98,_0x19112a){_0x3aab98=_0x3aab98-0x0;var _0x5b0b06=_0x79be[_0x3aab98];return _0x5b0b06;};'use strict';var _=require(_0xe79b('0x0'));var util=require(_0xe79b('0x1'));exports['getString']=function(_0x33b8fd,_0x175908,_0x348543){var _0x1c5ba6=[];if(_0x33b8fd[_0xe79b('0x2')]>0x0){var _0x242cd5=_[_0xe79b('0x3')](_0x33b8fd,['id']);for(var _0xb6a047=0x0;_0xb6a047<_0x242cd5['length'];_0xb6a047++){var _0x499933=_0x242cd5[_0xb6a047];if(_0x499933[_0xe79b('0x4')]===_0xe79b('0x5')){_0x1c5ba6[_0xe79b('0x6')](_0x499933[_0xe79b('0x7')]);}else if(_0x499933[_0xe79b('0x4')]===_0xe79b('0x8')&&_0x499933['variableName']){_0x175908[_0x499933['variableName']]&&_0x1c5ba6[_0xe79b('0x6')](_0x175908[_0x499933['variableName']][_0xe79b('0x9')]());}else if(_0x499933[_0xe79b('0x4')]===_0xe79b('0xa')&&_0x499933['Variable']&&_0x499933['Variable'][_0xe79b('0xb')]){_0x175908[_0x499933[_0xe79b('0xc')][_0xe79b('0xb')][_0xe79b('0xd')]()]&&_0x1c5ba6[_0xe79b('0x6')](_0x175908[_0x499933[_0xe79b('0xc')][_0xe79b('0xb')]['toLowerCase']()][_0xe79b('0x9')]());}else if(_0x499933[_0xe79b('0x4')]==='keyValue'){if(_0x499933[_0xe79b('0xe')]===_0xe79b('0x5')&&_0x499933['key']){_0x1c5ba6['push'](util[_0xe79b('0xf')](_0xe79b('0x10'),_0x499933[_0xe79b('0x11')],_0x499933[_0xe79b('0x12')]));}else if(_0x499933['keyType']===_0xe79b('0x8')&&_0x499933[_0xe79b('0x13')]&&_0x499933['key']){_0x175908[_0x499933[_0xe79b('0x13')]]&&_0x1c5ba6[_0xe79b('0x6')](util[_0xe79b('0xf')]('%s:\x20%s',_0x499933['key'],_0x175908[_0x499933[_0xe79b('0x13')]]));}else if(_0x499933[_0xe79b('0xe')]===_0xe79b('0xa')&&_0x499933[_0xe79b('0xc')]&&_0x499933['Variable'][_0xe79b('0xb')]&&_0x499933[_0xe79b('0x11')]){_0x175908[_0x499933['Variable'][_0xe79b('0xb')][_0xe79b('0xd')]()]&&_0x1c5ba6[_0xe79b('0x6')](util['format'](_0xe79b('0x10'),_0x499933['key'],_0x175908[_0x499933[_0xe79b('0xc')]['name'][_0xe79b('0xd')]()]));}}}}return _0x1c5ba6[_0xe79b('0x14')](_0x348543);};exports[_0xe79b('0x15')]=function(_0x78c2d1){var _0x4ba88d=_0x78c2d1[_0xe79b('0x16')](-0x1);if(_0x4ba88d==='/'){_0x78c2d1=_0x78c2d1[_0xe79b('0x17')](0x0,_0x78c2d1['lastIndexOf'](_0x4ba88d));}return _0x78c2d1;};exports[_0xe79b('0x18')]=function(_0x4e67d2){if(!_['isNil'](_0x4e67d2)&&_0x4e67d2!==''){var _0xd64caa=/^(([^<>()\[\]\\.,;:\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 _0xd64caa['test'](String(_0x4e67d2)['toLowerCase']());}else{return![];}}; \ No newline at end of file +var _0xe030=['variableName','customVariable','Variable','name','toLowerCase','toString','keyValue','key','format','%s:\x20%s','keyContent','keyType','join','stripTrailingSlash','slice','substring','validateEmail','isNil','test','lodash','util','getString','length','type','string','push','content','variable'];(function(_0x2b8d94,_0x52cded){var _0x39515e=function(_0x416179){while(--_0x416179){_0x2b8d94['push'](_0x2b8d94['shift']());}};_0x39515e(++_0x52cded);}(_0xe030,0xf3));var _0x0e03=function(_0x2db4d5,_0x2ff676){_0x2db4d5=_0x2db4d5-0x0;var _0x567cb7=_0xe030[_0x2db4d5];return _0x567cb7;};'use strict';var _=require(_0x0e03('0x0'));var util=require(_0x0e03('0x1'));exports[_0x0e03('0x2')]=function(_0x48ac6c,_0x5bad2e,_0xd2687){var _0x3114ac=[];if(_0x48ac6c['length']>0x0){var _0x4cdd48=_['sortBy'](_0x48ac6c,['id']);for(var _0x3aa037=0x0;_0x3aa037<_0x4cdd48[_0x0e03('0x3')];_0x3aa037++){var _0x3167ba=_0x4cdd48[_0x3aa037];if(_0x3167ba[_0x0e03('0x4')]===_0x0e03('0x5')){_0x3114ac[_0x0e03('0x6')](_0x3167ba[_0x0e03('0x7')]);}else if(_0x3167ba[_0x0e03('0x4')]===_0x0e03('0x8')&&_0x3167ba[_0x0e03('0x9')]){_0x5bad2e[_0x3167ba[_0x0e03('0x9')]]&&_0x3114ac[_0x0e03('0x6')](_0x5bad2e[_0x3167ba[_0x0e03('0x9')]]['toString']());}else if(_0x3167ba['type']===_0x0e03('0xa')&&_0x3167ba[_0x0e03('0xb')]&&_0x3167ba[_0x0e03('0xb')]['name']){_0x5bad2e[_0x3167ba[_0x0e03('0xb')][_0x0e03('0xc')]['toLowerCase']()]&&_0x3114ac[_0x0e03('0x6')](_0x5bad2e[_0x3167ba[_0x0e03('0xb')][_0x0e03('0xc')][_0x0e03('0xd')]()][_0x0e03('0xe')]());}else if(_0x3167ba[_0x0e03('0x4')]===_0x0e03('0xf')){if(_0x3167ba['keyType']===_0x0e03('0x5')&&_0x3167ba[_0x0e03('0x10')]){_0x3114ac[_0x0e03('0x6')](util[_0x0e03('0x11')](_0x0e03('0x12'),_0x3167ba[_0x0e03('0x10')],_0x3167ba[_0x0e03('0x13')]));}else if(_0x3167ba['keyType']===_0x0e03('0x8')&&_0x3167ba[_0x0e03('0x9')]&&_0x3167ba[_0x0e03('0x10')]){_0x5bad2e[_0x3167ba[_0x0e03('0x9')]]&&_0x3114ac['push'](util[_0x0e03('0x11')]('%s:\x20%s',_0x3167ba['key'],_0x5bad2e[_0x3167ba['variableName']]));}else if(_0x3167ba[_0x0e03('0x14')]===_0x0e03('0xa')&&_0x3167ba[_0x0e03('0xb')]&&_0x3167ba[_0x0e03('0xb')]['name']&&_0x3167ba[_0x0e03('0x10')]){_0x5bad2e[_0x3167ba['Variable'][_0x0e03('0xc')][_0x0e03('0xd')]()]&&_0x3114ac[_0x0e03('0x6')](util['format'](_0x0e03('0x12'),_0x3167ba['key'],_0x5bad2e[_0x3167ba[_0x0e03('0xb')]['name'][_0x0e03('0xd')]()]));}}}}return _0x3114ac[_0x0e03('0x15')](_0xd2687);};exports[_0x0e03('0x16')]=function(_0x196905){var _0x1cff25=_0x196905[_0x0e03('0x17')](-0x1);if(_0x1cff25==='/'){_0x196905=_0x196905[_0x0e03('0x18')](0x0,_0x196905['lastIndexOf'](_0x1cff25));}return _0x196905;};exports[_0x0e03('0x19')]=function(_0x45f4b6){if(!_[_0x0e03('0x1a')](_0x45f4b6)&&_0x45f4b6!==''){var _0x2f0178=/^(([^<>()\[\]\\.,;:\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 _0x2f0178[_0x0e03('0x1b')](String(_0x45f4b6)[_0x0e03('0xd')]());}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 4689039..82b2a18 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 _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','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','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x23e4c6,_0x548b3e){var _0x4aaee0=function(_0x19f8f4){while(--_0x19f8f4){_0x23e4c6['push'](_0x23e4c6['shift']());}};_0x4aaee0(++_0x548b3e);}(_0xe706,0xa3));var _0x6e70=function(_0x252550,_0x1ffe4d){_0x252550=_0x252550-0x0;var _0x352629=_0xe706[_0x252550];return _0x352629;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ No newline at end of file +var _0xe706=['result','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','getUser','username','Searching\x20end\x20user\x20with\x20phone','remoteUri','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','phone','catch','accessKey','getchallenge','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','unmanaged','lastevent','toUpperCase','lodash','request-promise','bluebird','util','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','emit','length','forEach','includes','string','idField','content','toString','type','variable','variableName','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','Subjects','getString','Descriptions','POST','format','%s/webservice.php','create','stringify','then','success','resolve','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','GET','query','sessionName','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;'];(function(_0x28e3e7,_0x9a1649){var _0x44d59d=function(_0x289e72){while(--_0x289e72){_0x28e3e7['push'](_0x28e3e7['shift']());}};_0x44d59d(++_0x9a1649);}(_0xe706,0xa3));var _0x6e70=function(_0xe1063b,_0x49f6a5){_0xe1063b=_0xe1063b-0x0;var _0x3f79b1=_0xe706[_0xe1063b];return _0x3f79b1;};'use strict';var _=require(_0x6e70('0x0'));var rp=require(_0x6e70('0x1'));var BPromise=require(_0x6e70('0x2'));var md5=require('md5');var util=require(_0x6e70('0x3'));var Redis=require(_0x6e70('0x4'));var intUtil=require(_0x6e70('0x5'));var config=require(_0x6e70('0x6'));var logger=require(_0x6e70('0x7'))(_0x6e70('0x8'));config[_0x6e70('0x9')]=_[_0x6e70('0xa')](config[_0x6e70('0x9')],{'host':_0x6e70('0xb'),'port':0x18eb});var io=require(_0x6e70('0xc'))(new Redis(config[_0x6e70('0x9')]));function emit(_0x45a2d4,_0x188ed3,_0x3c4843){io['to'](_0x45a2d4)[_0x6e70('0xd')](_0x188ed3,_0x3c4843);}function getCustomFields(_0x954545,_0x25e61c){var _0x100eb7={};if(_0x954545[_0x6e70('0xe')]>0x0){_[_0x6e70('0xf')](_0x954545,function(_0x3f474a){if(_[_0x6e70('0x10')]([_0x6e70('0x11'),'picklist'],_0x3f474a['type'])&&_0x3f474a[_0x6e70('0x12')]){_0x100eb7[_0x3f474a[_0x6e70('0x12')]]=_0x3f474a[_0x6e70('0x13')][_0x6e70('0x14')]();}else if(_0x3f474a[_0x6e70('0x15')]===_0x6e70('0x16')&&_0x3f474a[_0x6e70('0x17')]&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['variableName']]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['variableName']][_0x6e70('0x14')]();}else if(_0x3f474a['type']==='customVariable'&&_0x3f474a[_0x6e70('0x18')]&&_0x3f474a[_0x6e70('0x18')]['name']&&_0x3f474a[_0x6e70('0x12')]&&_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')][_0x6e70('0x1a')]()]){_0x100eb7[_0x3f474a['idField']]=_0x25e61c[_0x3f474a['Variable'][_0x6e70('0x19')]['toLowerCase']()][_0x6e70('0x14')]();}});}return _0x100eb7;}function createTicket(_0x173afe,_0x53acdc,_0x497d61,_0xc238ba,_0x208e21,_0x2368eb,_0x3a9978){logger[_0x6e70('0x1b')](_0x6e70('0x1c'));var _0x1b2453=_[_0x6e70('0x1d')]({'parent_id':'','assigned_user_id':_0x53acdc['id'],'ticketpriorities':_0x6e70('0x1e'),'ticketstatus':_0x6e70('0x1f'),'ticket_title':intUtil['getString'](_0xc238ba[_0x6e70('0x20')],_0x208e21,'\x20'),'description':intUtil[_0x6e70('0x21')](_0xc238ba[_0x6e70('0x22')],_0x208e21,'\x0a'),'contact_id':_0x497d61['id']},getCustomFields(_0x2368eb,_0x208e21));var _0x502b2d={'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x173afe['remoteUri']),'form':{'operation':_0x6e70('0x26'),'username':_0x173afe['username'],'sessionName':_0x3a9978['sessionName'],'elementType':'HelpDesk','element':JSON[_0x6e70('0x27')](_0x1b2453)},'json':!![]};return request(_0x502b2d)[_0x6e70('0x28')](function(_0x51d292){if(_0x51d292[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')]({'id':_0x51d292['result']['id']});}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x2b'),JSON[_0x6e70('0x27')](_0x51d292['error'])));}})['catch'](function(_0x2c4d37){var _0x3af17f=_0x2c4d37[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'createTicket',_0x3af17f,JSON[_0x6e70('0x27')](_0x2c4d37));});}function getUser(_0x406f29,_0xecf336,_0x2864a0){if(intUtil[_0x6e70('0x2f')](_0xecf336)){logger[_0x6e70('0x1b')](_0x6e70('0x30'),_0xecf336);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x406f29['remoteUri']),'qs':{'operation':_0x6e70('0x32'),'username':_0x406f29['username'],'sessionName':_0x2864a0[_0x6e70('0x33')],'query':util['format'](_0x6e70('0x34'),_0xecf336)},'json':!![]})[_0x6e70('0x28')](function(_0x30fa0b){if(_0x30fa0b['success']&&_0x30fa0b[_0x6e70('0x35')][_0x6e70('0xe')]){logger['info'](_0x6e70('0x36'));return BPromise[_0x6e70('0x2a')]({'id':_0x30fa0b['result'][0x0]['id'],'email':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x37')],'name':_0x30fa0b[_0x6e70('0x35')][0x0][_0x6e70('0x38')]+'\x20'+_0x30fa0b[_0x6e70('0x35')][_0x6e70('0x39')]});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29['username'],'name':_0x6e70('0x3c')});}})['catch'](function(_0x23cd1a){var _0x3222a2=_0x23cd1a[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x3222a2,JSON[_0x6e70('0x27')](_0x23cd1a));});}else{logger[_0x6e70('0x1b')](_0x6e70('0x3a'));return BPromise[_0x6e70('0x2a')]({'id':_0x2864a0[_0x6e70('0x3b')],'email':_0x406f29[_0x6e70('0x3e')],'name':_0x6e70('0x3c')})['catch'](function(_0x5446a2){var _0x5424eb=_0x5446a2[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),_0x6e70('0x3d'),_0x5424eb,JSON[_0x6e70('0x27')](_0x5446a2));});}}function getEndUser(_0x3bdd87,_0x572a71,_0x3b508c,_0x9e7ad2){logger[_0x6e70('0x1b')](_0x6e70('0x3f'),_0x3b508c);return request({'method':_0x6e70('0x31'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3bdd87[_0x6e70('0x40')]),'qs':{'operation':'query','username':_0x3bdd87[_0x6e70('0x3e')],'sessionName':_0x9e7ad2[_0x6e70('0x33')],'query':util[_0x6e70('0x24')](_0x6e70('0x41'),_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c,_0x3b508c)},'json':!![]})[_0x6e70('0x28')](function(_0x1de947){if(_0x1de947[_0x6e70('0x29')]&&_0x1de947['result']['length']){logger['info'](_0x6e70('0x42'));return BPromise[_0x6e70('0x2a')]({'id':_0x1de947[_0x6e70('0x35')][0x0]['id'],'name':_0x1de947[_0x6e70('0x35')][0x0][_0x6e70('0x43')]+'\x20'+_0x1de947['result'][0x0][_0x6e70('0x44')],'phone':_0x3b508c});}else{logger[_0x6e70('0x1b')](_0x6e70('0x45'));return request({'method':'POST','uri':util['format']('%s/webservice.php',_0x3bdd87[_0x6e70('0x40')]),'form':{'operation':'create','sessionName':_0x9e7ad2[_0x6e70('0x33')],'elementType':_0x6e70('0x46'),'element':JSON[_0x6e70('0x27')]({'lastname':_0x572a71,'phone':_0x3b508c,'assigned_user_id':'\x20'})},'json':!![]})[_0x6e70('0x28')](function(_0x59c87d){logger[_0x6e70('0x1b')]('Enduser\x20created.');return BPromise[_0x6e70('0x2a')]({'id':_0x59c87d[_0x6e70('0x35')]['id'],'name':_0x59c87d[_0x6e70('0x35')][_0x6e70('0x44')],'phone':_0x59c87d['result'][_0x6e70('0x47')]});})[_0x6e70('0x48')](function(_0x3d39c3){var _0xac87d6=_0x3d39c3[_0x6e70('0x2c')]||0x1f4;logger[_0x6e70('0x2d')](_0x6e70('0x2e'),'getEndUser',_0xac87d6,JSON[_0x6e70('0x27')](_0x3d39c3));});}});}function getConnection(_0x3884a4){var _0x10de2a=_0x3884a4[_0x6e70('0x3e')];var _0x3f86cf=_0x3884a4[_0x6e70('0x49')];return request({'method':_0x6e70('0x31'),'uri':util['format'](_0x6e70('0x25'),_0x3884a4['remoteUri']),'qs':{'operation':_0x6e70('0x4a'),'username':_0x10de2a},'json':!![]})[_0x6e70('0x28')](function(_0x4b351e){if(_0x4b351e['success']){return request({'method':_0x6e70('0x23'),'uri':util[_0x6e70('0x24')](_0x6e70('0x25'),_0x3884a4['remoteUri']),'form':{'operation':'login','username':_0x10de2a,'accessKey':md5(_0x4b351e[_0x6e70('0x35')][_0x6e70('0x4b')]+_0x3f86cf)},'json':!![]});}})[_0x6e70('0x28')](function(_0x79653){if(_0x79653[_0x6e70('0x29')]){return BPromise[_0x6e70('0x2a')](_0x79653['result']);}else{throw new Error(util[_0x6e70('0x24')](_0x6e70('0x4c'),_0x3884a4['id']));}})[_0x6e70('0x48')](function(_0x6ed023){var _0x2c3a7d=_0x6ed023['statusCode']||0x1f4;logger['error'](_0x6e70('0x2e'),_0x6e70('0x4d'),_0x2c3a7d,JSON[_0x6e70('0x27')](_0x6ed023));});}function request(_0x15f994){logger[_0x6e70('0x1b')]('[HTTP]',JSON[_0x6e70('0x27')](_0x15f994));return rp(_0x15f994);}exports[_0x6e70('0x4e')]=function(_0x1fa320,_0x23ebfb,_0x3aba34,_0x4a111a,_0x1142cd,_0x1dd242){var _0x2c20d3,_0x3fb0d3,_0x8ef4f7,_0x3fd03d;_0x1dd242['remoteUri']=intUtil[_0x6e70('0x4f')](_0x1dd242[_0x6e70('0x40')]);if(_0x1142cd&&_0x1142cd['monitor_format']){logger[_0x6e70('0x1b')](_0x6e70('0x50'),'Recording\x20is\x20enabled!');_0x23ebfb[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x1dd242[_0x6e70('0x53')],_0x23ebfb[_0x6e70('0x54')],md5(_0x23ebfb['uniqueid']));}else{_0x23ebfb[_0x6e70('0x51')]='';}return getConnection(_0x1dd242)[_0x6e70('0x28')](function(_0x10d655){_0x3fd03d=_0x10d655;return getUser(_0x1dd242,_0x4a111a[_0x6e70('0x55')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1fe13a){_0x2c20d3=_0x1fe13a;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x2c20d3['id']);return getEndUser(_0x1dd242,_0x23ebfb[_0x6e70('0x57')],_0x23ebfb[_0x6e70('0x58')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x1b12a1){_0x3fb0d3=_0x1b12a1;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x3fb0d3['id']);return createTicket(_0x1dd242,_0x2c20d3,_0x3fb0d3,_0x3aba34,_0x23ebfb,_0x3aba34[_0x6e70('0x5a')],_0x3fd03d);})[_0x6e70('0x28')](function(_0x324fa6){_0x8ef4f7=_0x324fa6;logger[_0x6e70('0x1b')](_0x6e70('0x5b'));logger[_0x6e70('0x1b')]('The\x20Ticket\x20ID\x20is:',_0x8ef4f7['id']);var _0x28898a=util[_0x6e70('0x24')](_0x6e70('0x5c'),_0x1dd242[_0x6e70('0x40')],_[_0x6e70('0x5d')](_0x8ef4f7['id'],'x')[0x1]);logger[_0x6e70('0x1b')]('[QUEUE]',_0x6e70('0x5e'));emit(util[_0x6e70('0x24')]('user:%s',_0x4a111a[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x28898a});})[_0x6e70('0x48')](function(_0x590f7f){logger['error'](_0x6e70('0x50'),JSON[_0x6e70('0x27')](_0x590f7f));});};exports[_0x6e70('0x60')]=function(_0x41a861,_0x10d299,_0x739946,_0x30cd88,_0x57bfe5,_0x4d47e1,_0x2c8dc6){var _0x1e23c5,_0x2bf9ec,_0x2ad395,_0x5b1e6f;_0x4d47e1['remoteUri']=intUtil[_0x6e70('0x4f')](_0x4d47e1[_0x6e70('0x40')]);_0x4d47e1['serverUrl']=intUtil['stripTrailingSlash'](_0x4d47e1[_0x6e70('0x53')]);if(_0x2c8dc6&&_0x2c8dc6['recordingFormat']&&_0x2c8dc6[_0x6e70('0x61')]!==_0x6e70('0x62')){logger[_0x6e70('0x1b')](_0x6e70('0x63'),_0x6e70('0x64'));_0x10d299[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x4d47e1['serverUrl'],_0x10d299[_0x6e70('0x54')],md5(_0x10d299[_0x6e70('0x54')]));}return getConnection(_0x4d47e1)[_0x6e70('0x28')](function(_0x346c79){_0x5b1e6f=_0x346c79;return getUser(_0x4d47e1,_0x30cd88[_0x6e70('0x55')],_0x5b1e6f);})['then'](function(_0x5f5b02){_0x1e23c5=_0x5f5b02;logger['info'](_0x6e70('0x56'),_0x1e23c5['id']);return getEndUser(_0x4d47e1,_0x10d299[_0x6e70('0x65')],_0x10d299[_0x6e70('0x66')],_0x5b1e6f);})['then'](function(_0x58cf1c){_0x2bf9ec=_0x58cf1c;logger[_0x6e70('0x1b')](_0x6e70('0x59'),_0x2bf9ec['id']);return createTicket(_0x4d47e1,_0x1e23c5,_0x2bf9ec,_0x739946,_0x10d299,_0x739946[_0x6e70('0x5a')],_0x5b1e6f);})[_0x6e70('0x28')](function(_0x2285f1){_0x2ad395=_0x2285f1;logger[_0x6e70('0x1b')]('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x2ad395['id']);var _0x30d11b=util[_0x6e70('0x24')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x4d47e1[_0x6e70('0x40')],_['split'](_0x2ad395['id'],'x')[0x1]);logger['info'](_0x6e70('0x63'),_0x6e70('0x5e'));emit(util[_0x6e70('0x24')](_0x6e70('0x68'),_0x30cd88[_0x6e70('0x19')]),_0x6e70('0x5f'),{'uri':_0x30d11b});})['catch'](function(_0x370eeb){logger[_0x6e70('0x2d')](_0x6e70('0x63'),JSON[_0x6e70('0x27')](_0x370eeb));});};exports[_0x6e70('0x69')]=function(_0x13c092,_0x363722,_0xd9b4a9,_0x2f1362,_0x29621a,_0x575938){var _0x44c877,_0x303c5a,_0x577c3b,_0x5d398a;_0x575938['remoteUri']=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x40')]);_0x575938[_0x6e70('0x53')]=intUtil[_0x6e70('0x4f')](_0x575938[_0x6e70('0x53')]);if(_0x29621a&&_0x29621a['monitor_format']){logger['info']('['+_0x363722[_0x6e70('0x6a')][_0x6e70('0x6b')]()+']','Recording\x20is\x20enabled!');_0x363722[_0x6e70('0x51')]=util[_0x6e70('0x24')](_0x6e70('0x52'),_0x575938[_0x6e70('0x53')],_0x363722[_0x6e70('0x54')],md5(_0x363722[_0x6e70('0x54')]));}else{_0x363722[_0x6e70('0x51')]='';}return getConnection(_0x575938)[_0x6e70('0x28')](function(_0x3650e9){_0x5d398a=_0x3650e9;return getUser(_0x575938,'',_0x5d398a);})[_0x6e70('0x28')](function(_0x347cc4){_0x44c877=_0x347cc4;logger[_0x6e70('0x1b')](_0x6e70('0x56'),_0x44c877['id']);return getEndUser(_0x575938,_0x363722[_0x6e70('0x57')],_0x363722['calleridnum'],_0x5d398a);})['then'](function(_0x39ed95){_0x303c5a=_0x39ed95;logger['info'](_0x6e70('0x59'),_0x303c5a['id']);return createTicket(_0x575938,_0x44c877,_0x303c5a,_0xd9b4a9,_0x363722,_0xd9b4a9['Fields'],_0x5d398a);})['then'](function(_0x402f6f){_0x577c3b=_0x402f6f;logger['info']('Ticket\x20created!');logger[_0x6e70('0x1b')](_0x6e70('0x67'),_0x577c3b['id']);})[_0x6e70('0x48')](function(_0x4e9fda){logger['error']('['+_0x363722['lastevent'][_0x6e70('0x6b')]()+']',JSON['stringify'](_0x4e9fda));});}; \ 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 8162c55..2e36031 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 _0x5c36=['integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','monitor_format','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','emit','application/json','Creating\x20new\x20ticket...','format','remoteUri','POST','Tags','name','getString','Subjects','Fields','then','info','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','count','Agent\x20found!','find','results','agent','%s/users/me.json','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','password','%s:%s','username','authType','%s/token:%s','Basic\x20%s','toString','[HTTP]','GET','map','forEach','includes','picklist','type','nameField','customField','toLowerCase','content','idField','push','variableName','customVariable','Variable','custom_fields','queue','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:'];(function(_0x31c469,_0x82a9ca){var _0x3d69b6=function(_0x8ec19f){while(--_0x8ec19f){_0x31c469['push'](_0x31c469['shift']());}};_0x3d69b6(++_0x82a9ca);}(_0x5c36,0xf2));var _0x65c3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5c36[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x65c3('0x0'));var rp=require(_0x65c3('0x1'));var md5=require(_0x65c3('0x2'));var util=require(_0x65c3('0x3'));var Redis=require(_0x65c3('0x4'));var intUtil=require(_0x65c3('0x5'));var config=require(_0x65c3('0x6'));var logger=require(_0x65c3('0x7'))(_0x65c3('0x8'));config[_0x65c3('0x9')]=_[_0x65c3('0xa')](config[_0x65c3('0x9')],{'host':_0x65c3('0xb'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x15ca8a,_0x5bc8d8,_0x235ba8){io['to'](_0x15ca8a)[_0x65c3('0xc')](_0x5bc8d8,_0x235ba8);}var headers={'Content-Type':_0x65c3('0xd'),'Accept':_0x65c3('0xd')};function getTicket(_0x4f43f7,_0x5aee0f,_0x1362a9,_0x288189,_0xe814d8){logger['info'](_0x65c3('0xe'));return request({'uri':util[_0x65c3('0xf')]('%s/tickets.json',_0x4f43f7[_0x65c3('0x10')]),'method':_0x65c3('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x1362a9['id'],'submitter_id':_0x5aee0f?_0x5aee0f['id']:undefined,'assignee_id':_0x5aee0f?_0x5aee0f['id']:undefined,'tags':getTags(_0x288189[_0x65c3('0x12')],_0x65c3('0x13')),'subject':intUtil[_0x65c3('0x14')](_0x288189[_0x65c3('0x15')],_0xe814d8,'\x20'),'description':intUtil[_0x65c3('0x14')](_0x288189['Descriptions'],_0xe814d8,'\x0a'),'comment':{'public':![],'body':intUtil[_0x65c3('0x14')](_0x288189['Descriptions'],_0xe814d8,'\x0a')}},getCustomFields(_0x288189[_0x65c3('0x16')],_0xe814d8))}})[_0x65c3('0x17')](function(_0x4abad2){logger[_0x65c3('0x18')](_0x65c3('0x19'));return _0x4abad2[_0x65c3('0x1a')];});}function getUser(_0x263a35,_0x29301f){if(intUtil[_0x65c3('0x1b')](_0x29301f)){logger[_0x65c3('0x18')](_0x65c3('0x1c'),_0x29301f);return request({'uri':util[_0x65c3('0xf')](_0x65c3('0x1d'),_0x263a35[_0x65c3('0x10')]),'qs':{'query':util['format']('type:user\x20role:agent\x20email:%s',_0x29301f)}})[_0x65c3('0x17')](function(_0x4bf9d4){if(_0x4bf9d4[_0x65c3('0x1e')]){logger[_0x65c3('0x18')](_0x65c3('0x1f'));return _[_0x65c3('0x20')](_0x4bf9d4[_0x65c3('0x21')],{'email':_0x29301f,'role':_0x65c3('0x22')});}else{logger['info']('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x65c3('0xf')](_0x65c3('0x23'),_0x263a35['remoteUri'])})['then'](function(_0x15fcef){logger[_0x65c3('0x18')]('Admin\x20account\x20selected.');return _0x15fcef[_0x65c3('0x24')];});}});}else{logger[_0x65c3('0x18')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x65c3('0xf')](_0x65c3('0x23'),_0x263a35[_0x65c3('0x10')])})[_0x65c3('0x17')](function(_0x23c9c4){logger[_0x65c3('0x18')]('Admin\x20account\x20selected.');return _0x23c9c4[_0x65c3('0x24')];});}}function getEndUser(_0x2ab410,_0x522b1b,_0x5006b6){logger[_0x65c3('0x18')](_0x65c3('0x25'),_0x5006b6);return request({'uri':util[_0x65c3('0xf')](_0x65c3('0x1d'),_0x2ab410[_0x65c3('0x10')]),'qs':{'query':util['format'](_0x65c3('0x26'),_0x5006b6)}})[_0x65c3('0x17')](function(_0x1e94a5){var _0x9a015d;if(_0x1e94a5['results'][_0x65c3('0x27')]){_0x1e94a5[_0x65c3('0x21')]=_[_0x65c3('0x28')](_0x1e94a5['results'],{'suspended':![],'role':_0x65c3('0x29')});if(_0x1e94a5[_0x65c3('0x21')][_0x65c3('0x27')]){_0x9a015d=_[_0x65c3('0x2a')](_0x1e94a5[_0x65c3('0x21')]);}}if(_0x9a015d){logger[_0x65c3('0x18')](_0x65c3('0x2b'));return _0x9a015d;}else{logger['info'](_0x65c3('0x2c'));return request({'uri':util[_0x65c3('0xf')](_0x65c3('0x2d'),_0x2ab410[_0x65c3('0x10')]),'method':_0x65c3('0x11'),'body':{'user':{'role':_0x65c3('0x29'),'name':util['format'](_0x65c3('0x2e'),_0x522b1b||_0x5006b6),'phone':_0x5006b6}}})[_0x65c3('0x17')](function(_0x41117b){logger['info'](_0x65c3('0x2f'));return _0x41117b['user'];});}});}function getAuth(_0x4af04e){var _0x40710c;if(_0x4af04e['authType']===_0x65c3('0x30')){_0x40710c=util[_0x65c3('0xf')](_0x65c3('0x31'),_0x4af04e[_0x65c3('0x32')],_0x4af04e[_0x65c3('0x30')]);}else if(_0x4af04e[_0x65c3('0x33')]==='token'){_0x40710c=util[_0x65c3('0xf')](_0x65c3('0x34'),_0x4af04e[_0x65c3('0x32')],_0x4af04e['token']);}return util[_0x65c3('0xf')](_0x65c3('0x35'),new Buffer(_0x40710c)[_0x65c3('0x36')]('base64'));}function request(_0x561057){logger['debug'](_0x65c3('0x37'),JSON['stringify'](_0x561057));return rp(_[_0x65c3('0xa')](_0x561057,{'method':_0x65c3('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x30729c,_0x236aa3){var _0x516fa1=[];if(_0x30729c&&_0x30729c['length']>0x0){_0x516fa1=_[_0x65c3('0x39')](_0x30729c,_0x236aa3);}return _0x516fa1;}function getCustomFields(_0x27ab65,_0x7d123){var _0x3d2d77=[];var _0x508314={'custom_fields':[]};if(_0x27ab65[_0x65c3('0x27')]>0x0){_[_0x65c3('0x3a')](_0x27ab65,function(_0x488c64){if(_[_0x65c3('0x3b')](['string',_0x65c3('0x3c')],_0x488c64[_0x65c3('0x3d')])&&_0x488c64[_0x65c3('0x3e')]&&!_0x488c64[_0x65c3('0x3f')]){_0x508314[_0x488c64['nameField'][_0x65c3('0x40')]()]=_0x488c64[_0x65c3('0x41')][_0x65c3('0x36')]();}else if(_['includes'](['string',_0x65c3('0x3c')],_0x488c64[_0x65c3('0x3d')])&&_0x488c64[_0x65c3('0x42')]&&_0x488c64[_0x65c3('0x3f')]){_0x508314['custom_fields'][_0x65c3('0x43')]({'id':_0x488c64[_0x65c3('0x42')],'value':_0x488c64[_0x65c3('0x41')][_0x65c3('0x36')]()});}else if(_0x488c64[_0x65c3('0x3d')]==='variable'&&_0x488c64[_0x65c3('0x44')]&&_0x488c64[_0x65c3('0x42')]&&_0x488c64[_0x65c3('0x3f')]){_0x7d123[_0x488c64[_0x65c3('0x44')]]&&_0x508314['custom_fields'][_0x65c3('0x43')]({'id':_0x488c64[_0x65c3('0x42')],'value':_0x7d123[_0x488c64[_0x65c3('0x44')]][_0x65c3('0x36')]()});}else if(_0x488c64[_0x65c3('0x3d')]===_0x65c3('0x45')&&_0x488c64['Variable']&&_0x488c64[_0x65c3('0x46')][_0x65c3('0x13')]&&_0x488c64['idField']&&_0x488c64[_0x65c3('0x3f')]){_0x7d123[_0x488c64[_0x65c3('0x46')]['name'][_0x65c3('0x40')]()]&&_0x508314[_0x65c3('0x47')][_0x65c3('0x43')]({'id':_0x488c64[_0x65c3('0x42')],'value':_0x7d123[_0x488c64[_0x65c3('0x46')][_0x65c3('0x13')][_0x65c3('0x40')]()][_0x65c3('0x36')]()});}});}return _0x508314;}exports[_0x65c3('0x48')]=function(_0x42b0ce,_0x4df5f6,_0x22977c,_0x5c4afd,_0x5d2a0f,_0x1297de){var _0x12271d,_0x1cf215;_0x1297de[_0x65c3('0x10')]=intUtil[_0x65c3('0x49')](_0x1297de[_0x65c3('0x10')]);_0x1297de[_0x65c3('0x4a')]=intUtil['stripTrailingSlash'](_0x1297de[_0x65c3('0x4a')]);if(_0x5d2a0f&&_0x5d2a0f['monitor_format']){logger[_0x65c3('0x18')](_0x65c3('0x4b'),'Recording\x20is\x20enabled!');_0x4df5f6[_0x65c3('0x4c')]=util[_0x65c3('0xf')](_0x65c3('0x4d'),_0x1297de[_0x65c3('0x4a')],_0x4df5f6['uniqueid'],md5(_0x4df5f6[_0x65c3('0x4e')]));}else{_0x4df5f6['recordingURL']='';}headers['Authorization']=getAuth(_0x1297de);return getUser(_0x1297de,_0x5c4afd[_0x65c3('0x4f')])[_0x65c3('0x17')](function(_0x26b669){_0x12271d=_0x26b669;logger[_0x65c3('0x18')](_0x65c3('0x50'),_0x12271d['id']);return getEndUser(_0x1297de,_0x4df5f6[_0x65c3('0x51')],_0x4df5f6[_0x65c3('0x52')]);})[_0x65c3('0x17')](function(_0x34defe){_0x1cf215=_0x34defe;logger[_0x65c3('0x18')](_0x65c3('0x53'),_0x1cf215['id']);return getTicket(_0x1297de,_0x12271d,_0x1cf215,_0x22977c,_0x4df5f6);})[_0x65c3('0x17')](function(_0x5b8590){if(_0x5b8590){logger[_0x65c3('0x18')](_0x65c3('0x54'),_0x5b8590['id']);switch(_0x1297de[_0x65c3('0x3d')]){case _0x65c3('0x55'):logger[_0x65c3('0x18')](_0x65c3('0x4b'),_0x65c3('0x56'));return request({'uri':util[_0x65c3('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1297de[_0x65c3('0x10')],_0x12271d['id'],_0x5b8590['id']),'method':_0x65c3('0x11')});case _0x65c3('0x57'):logger[_0x65c3('0x18')]('[QUEUE]',_0x65c3('0x58'));emit(util[_0x65c3('0xf')]('user:%s',_0x5c4afd['name']),_0x65c3('0x59'),{'uri':util[_0x65c3('0xf')](_0x65c3('0x5a'),_0x1297de[_0x65c3('0x10')][_0x65c3('0x5b')](_0x65c3('0x5c'),''),_0x5b8590['id'])});break;default:logger[_0x65c3('0x5d')](_0x65c3('0x4b'),_0x65c3('0x5e'));}}})[_0x65c3('0x5f')](function(_0x56f4b7){logger[_0x65c3('0x5d')](_0x65c3('0x60'),util[_0x65c3('0x61')](_0x56f4b7,{'showHidden':!![],'depth':null}));});};exports[_0x65c3('0x62')]=function(_0x15bdbf,_0x182211,_0x2a7e77,_0x41d59d,_0x2b6f5b,_0x12c242,_0x4b6442){var _0x3405dd,_0x371e14;_0x12c242[_0x65c3('0x10')]=intUtil['stripTrailingSlash'](_0x12c242[_0x65c3('0x10')]);_0x12c242[_0x65c3('0x4a')]=intUtil[_0x65c3('0x49')](_0x12c242[_0x65c3('0x4a')]);if(_0x4b6442&&_0x4b6442['recordingFormat']&&_0x4b6442[_0x65c3('0x63')]!=='none'){logger[_0x65c3('0x18')](_0x65c3('0x64'),_0x65c3('0x65'));_0x182211[_0x65c3('0x4c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x12c242[_0x65c3('0x4a')],_0x182211[_0x65c3('0x4e')],md5(_0x182211['uniqueid']));}headers['Authorization']=getAuth(_0x12c242);return getUser(_0x12c242,_0x41d59d[_0x65c3('0x4f')])[_0x65c3('0x17')](function(_0x35afa1){_0x3405dd=_0x35afa1;logger['info']('The\x20User\x20ID\x20is:',_0x3405dd['id']);return getEndUser(_0x12c242,_0x182211[_0x65c3('0x66')],_0x182211[_0x65c3('0x67')]);})[_0x65c3('0x17')](function(_0x143860){_0x371e14=_0x143860;logger['info'](_0x65c3('0x53'),_0x371e14['id']);return getTicket(_0x12c242,_0x3405dd,_0x371e14,_0x2a7e77,_0x182211);})[_0x65c3('0x17')](function(_0x250870){if(_0x250870){logger[_0x65c3('0x18')](_0x65c3('0x54'),_0x250870['id']);switch(_0x12c242[_0x65c3('0x3d')]){case'integrationTab':logger[_0x65c3('0x18')](_0x65c3('0x64'),'Displaying\x20ticket\x20to\x20agent...');return request({'uri':util[_0x65c3('0xf')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x12c242['remoteUri'],_0x3405dd['id'],_0x250870['id']),'method':_0x65c3('0x11')});case'newTab':logger['info'](_0x65c3('0x64'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x65c3('0xf')]('user:%s',_0x41d59d[_0x65c3('0x13')]),_0x65c3('0x59'),{'uri':util[_0x65c3('0xf')](_0x65c3('0x5a'),_0x12c242[_0x65c3('0x10')][_0x65c3('0x5b')]('/api/v2',''),_0x250870['id'])});break;default:logger[_0x65c3('0x5d')]('[OUTBOUND]','Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x65c3('0x5f')](function(_0xf640ee){logger[_0x65c3('0x5d')](_0x65c3('0x68'),util[_0x65c3('0x61')](_0xf640ee,{'showHidden':!![],'depth':null}));});};exports[_0x65c3('0x69')]=function(_0x20cde9,_0x69af80,_0x330e88,_0x5ea43c,_0x59f6e0,_0x40d0c6){var _0x516c62,_0x297cc2;_0x40d0c6[_0x65c3('0x10')]=intUtil[_0x65c3('0x49')](_0x40d0c6[_0x65c3('0x10')]);_0x40d0c6[_0x65c3('0x4a')]=intUtil[_0x65c3('0x49')](_0x40d0c6[_0x65c3('0x4a')]);if(_0x59f6e0&&_0x59f6e0[_0x65c3('0x6a')]){logger[_0x65c3('0x18')]('['+_0x69af80[_0x65c3('0x6b')]['toUpperCase']()+']',_0x65c3('0x65'));_0x69af80[_0x65c3('0x4c')]=util[_0x65c3('0xf')](_0x65c3('0x4d'),_0x40d0c6[_0x65c3('0x4a')],_0x69af80[_0x65c3('0x4e')],md5(_0x69af80[_0x65c3('0x4e')]));}else{_0x69af80[_0x65c3('0x4c')]='';}headers['Authorization']=getAuth(_0x40d0c6);return getUser(_0x40d0c6)[_0x65c3('0x17')](function(_0x849c97){_0x516c62=_0x849c97;logger[_0x65c3('0x18')](_0x65c3('0x50'),_0x516c62['id']);return getEndUser(_0x40d0c6,_0x69af80[_0x65c3('0x51')],_0x69af80[_0x65c3('0x52')]);})[_0x65c3('0x17')](function(_0x1bd03d){_0x297cc2=_0x1bd03d;logger[_0x65c3('0x18')](_0x65c3('0x53'),_0x297cc2['id']);return getTicket(_0x40d0c6,_0x516c62,_0x297cc2,_0x330e88,_0x69af80);})[_0x65c3('0x17')](function(_0x40b4f0){if(_0x40b4f0){logger['info'](_0x65c3('0x54'),_0x40b4f0['id']);}})['catch'](function(_0x25957e){logger['error']('['+_0x69af80[_0x65c3('0x6b')]['toUpperCase']()+']'+_0x65c3('0x6c'),util[_0x65c3('0x61')](_0x25957e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x7c2f=['Authorization','email','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','replace','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','request-promise','md5','ioredis','../../../../config/environment','zendesk','defaults','localhost','socket.io-emitter','redis','emit','application/json','info','Creating\x20new\x20ticket...','format','%s/tickets.json','POST','merge','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','results','length','filter','end-user','first','Enduser\x20found!','%s/users.json','Enduser\x20created.','authType','password','username','token','%s/token:%s','Basic\x20%s','toString','base64','stringify','GET','map','includes','string','type','nameField','customField','toLowerCase','content','idField','custom_fields','push','variable','variableName','customVariable','Variable','name','queue','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid'];(function(_0x56321f,_0x1c41eb){var _0x5aa129=function(_0x5cab95){while(--_0x5cab95){_0x56321f['push'](_0x56321f['shift']());}};_0x5aa129(++_0x1c41eb);}(_0x7c2f,0x1da));var _0xf7c2=function(_0x310dd9,_0x2d324a){_0x310dd9=_0x310dd9-0x0;var _0x4c4e9e=_0x7c2f[_0x310dd9];return _0x4c4e9e;};'use strict';var _=require('lodash');var rp=require(_0xf7c2('0x0'));var md5=require(_0xf7c2('0x1'));var util=require('util');var Redis=require(_0xf7c2('0x2'));var intUtil=require('./util');var config=require(_0xf7c2('0x3'));var logger=require('../../../../config/logger')(_0xf7c2('0x4'));config['redis']=_[_0xf7c2('0x5')](config['redis'],{'host':_0xf7c2('0x6'),'port':0x18eb});var io=require(_0xf7c2('0x7'))(new Redis(config[_0xf7c2('0x8')]));function emit(_0x141c19,_0x52156c,_0x3f6a97){io['to'](_0x141c19)[_0xf7c2('0x9')](_0x52156c,_0x3f6a97);}var headers={'Content-Type':'application/json','Accept':_0xf7c2('0xa')};function getTicket(_0x66e31c,_0x513bee,_0xd7c044,_0x58ccef,_0x687059){logger[_0xf7c2('0xb')](_0xf7c2('0xc'));return request({'uri':util[_0xf7c2('0xd')](_0xf7c2('0xe'),_0x66e31c['remoteUri']),'method':_0xf7c2('0xf'),'body':{'ticket':_[_0xf7c2('0x10')]({'requester_id':_0xd7c044['id'],'submitter_id':_0x513bee?_0x513bee['id']:undefined,'assignee_id':_0x513bee?_0x513bee['id']:undefined,'tags':getTags(_0x58ccef['Tags'],'name'),'subject':intUtil[_0xf7c2('0x11')](_0x58ccef[_0xf7c2('0x12')],_0x687059,'\x20'),'description':intUtil[_0xf7c2('0x11')](_0x58ccef[_0xf7c2('0x13')],_0x687059,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x58ccef['Descriptions'],_0x687059,'\x0a')}},getCustomFields(_0x58ccef[_0xf7c2('0x14')],_0x687059))}})[_0xf7c2('0x15')](function(_0x3ff9ec){logger[_0xf7c2('0xb')](_0xf7c2('0x16'));return _0x3ff9ec[_0xf7c2('0x17')];});}function getUser(_0x3bf3af,_0x38b733){if(intUtil[_0xf7c2('0x18')](_0x38b733)){logger[_0xf7c2('0xb')](_0xf7c2('0x19'),_0x38b733);return request({'uri':util[_0xf7c2('0xd')](_0xf7c2('0x1a'),_0x3bf3af[_0xf7c2('0x1b')]),'qs':{'query':util[_0xf7c2('0xd')](_0xf7c2('0x1c'),_0x38b733)}})[_0xf7c2('0x15')](function(_0x4c2235){if(_0x4c2235[_0xf7c2('0x1d')]){logger[_0xf7c2('0xb')](_0xf7c2('0x1e'));return _[_0xf7c2('0x1f')](_0x4c2235['results'],{'email':_0x38b733,'role':_0xf7c2('0x20')});}else{logger['info'](_0xf7c2('0x21'));return request({'uri':util['format'](_0xf7c2('0x22'),_0x3bf3af[_0xf7c2('0x1b')])})[_0xf7c2('0x15')](function(_0x50f88e){logger[_0xf7c2('0xb')](_0xf7c2('0x23'));return _0x50f88e['user'];});}});}else{logger['info'](_0xf7c2('0x21'));return request({'uri':util[_0xf7c2('0xd')](_0xf7c2('0x22'),_0x3bf3af[_0xf7c2('0x1b')])})[_0xf7c2('0x15')](function(_0x3175eb){logger[_0xf7c2('0xb')](_0xf7c2('0x23'));return _0x3175eb[_0xf7c2('0x24')];});}}function getEndUser(_0x17cdbf,_0x10e5ba,_0x276526){logger[_0xf7c2('0xb')](_0xf7c2('0x25'),_0x276526);return request({'uri':util[_0xf7c2('0xd')]('%s/search.json',_0x17cdbf[_0xf7c2('0x1b')]),'qs':{'query':util[_0xf7c2('0xd')](_0xf7c2('0x26'),_0x276526)}})[_0xf7c2('0x15')](function(_0x2700bf){var _0x1cc208;if(_0x2700bf[_0xf7c2('0x27')][_0xf7c2('0x28')]){_0x2700bf[_0xf7c2('0x27')]=_[_0xf7c2('0x29')](_0x2700bf['results'],{'suspended':![],'role':_0xf7c2('0x2a')});if(_0x2700bf[_0xf7c2('0x27')][_0xf7c2('0x28')]){_0x1cc208=_[_0xf7c2('0x2b')](_0x2700bf[_0xf7c2('0x27')]);}}if(_0x1cc208){logger[_0xf7c2('0xb')](_0xf7c2('0x2c'));return _0x1cc208;}else{logger[_0xf7c2('0xb')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0xf7c2('0xd')](_0xf7c2('0x2d'),_0x17cdbf[_0xf7c2('0x1b')]),'method':_0xf7c2('0xf'),'body':{'user':{'role':_0xf7c2('0x2a'),'name':util['format']('Caller\x20-\x20%s',_0x10e5ba||_0x276526),'phone':_0x276526}}})[_0xf7c2('0x15')](function(_0x38dee5){logger[_0xf7c2('0xb')](_0xf7c2('0x2e'));return _0x38dee5[_0xf7c2('0x24')];});}});}function getAuth(_0x4337b8){var _0x4fc1b0;if(_0x4337b8[_0xf7c2('0x2f')]===_0xf7c2('0x30')){_0x4fc1b0=util[_0xf7c2('0xd')]('%s:%s',_0x4337b8[_0xf7c2('0x31')],_0x4337b8[_0xf7c2('0x30')]);}else if(_0x4337b8['authType']===_0xf7c2('0x32')){_0x4fc1b0=util[_0xf7c2('0xd')](_0xf7c2('0x33'),_0x4337b8[_0xf7c2('0x31')],_0x4337b8[_0xf7c2('0x32')]);}return util[_0xf7c2('0xd')](_0xf7c2('0x34'),new Buffer(_0x4fc1b0)[_0xf7c2('0x35')](_0xf7c2('0x36')));}function request(_0x1a6a24){logger['debug']('[HTTP]',JSON[_0xf7c2('0x37')](_0x1a6a24));return rp(_['defaults'](_0x1a6a24,{'method':_0xf7c2('0x38'),'headers':headers,'json':!![]}));}function getTags(_0x8bb92c,_0x43c03b){var _0x19faf4=[];if(_0x8bb92c&&_0x8bb92c[_0xf7c2('0x28')]>0x0){_0x19faf4=_[_0xf7c2('0x39')](_0x8bb92c,_0x43c03b);}return _0x19faf4;}function getCustomFields(_0x157717,_0x1ce7af){var _0x248990=[];var _0x5b6f87={'custom_fields':[]};if(_0x157717[_0xf7c2('0x28')]>0x0){_['forEach'](_0x157717,function(_0x58da41){if(_[_0xf7c2('0x3a')]([_0xf7c2('0x3b'),'picklist'],_0x58da41[_0xf7c2('0x3c')])&&_0x58da41[_0xf7c2('0x3d')]&&!_0x58da41[_0xf7c2('0x3e')]){_0x5b6f87[_0x58da41[_0xf7c2('0x3d')][_0xf7c2('0x3f')]()]=_0x58da41[_0xf7c2('0x40')][_0xf7c2('0x35')]();}else if(_[_0xf7c2('0x3a')]([_0xf7c2('0x3b'),'picklist'],_0x58da41[_0xf7c2('0x3c')])&&_0x58da41[_0xf7c2('0x41')]&&_0x58da41[_0xf7c2('0x3e')]){_0x5b6f87[_0xf7c2('0x42')][_0xf7c2('0x43')]({'id':_0x58da41['idField'],'value':_0x58da41[_0xf7c2('0x40')][_0xf7c2('0x35')]()});}else if(_0x58da41[_0xf7c2('0x3c')]===_0xf7c2('0x44')&&_0x58da41['variableName']&&_0x58da41['idField']&&_0x58da41[_0xf7c2('0x3e')]){_0x1ce7af[_0x58da41[_0xf7c2('0x45')]]&&_0x5b6f87['custom_fields'][_0xf7c2('0x43')]({'id':_0x58da41['idField'],'value':_0x1ce7af[_0x58da41[_0xf7c2('0x45')]]['toString']()});}else if(_0x58da41[_0xf7c2('0x3c')]===_0xf7c2('0x46')&&_0x58da41['Variable']&&_0x58da41[_0xf7c2('0x47')][_0xf7c2('0x48')]&&_0x58da41[_0xf7c2('0x41')]&&_0x58da41[_0xf7c2('0x3e')]){_0x1ce7af[_0x58da41[_0xf7c2('0x47')][_0xf7c2('0x48')]['toLowerCase']()]&&_0x5b6f87['custom_fields'][_0xf7c2('0x43')]({'id':_0x58da41[_0xf7c2('0x41')],'value':_0x1ce7af[_0x58da41[_0xf7c2('0x47')][_0xf7c2('0x48')][_0xf7c2('0x3f')]()][_0xf7c2('0x35')]()});}});}return _0x5b6f87;}exports[_0xf7c2('0x49')]=function(_0x226632,_0xafd6eb,_0x4fdb5e,_0x19322b,_0x363b04,_0x5d80bf){var _0x5f1878,_0x3f15d7;_0x5d80bf[_0xf7c2('0x1b')]=intUtil['stripTrailingSlash'](_0x5d80bf[_0xf7c2('0x1b')]);_0x5d80bf[_0xf7c2('0x4a')]=intUtil[_0xf7c2('0x4b')](_0x5d80bf['serverUrl']);if(_0x363b04&&_0x363b04[_0xf7c2('0x4c')]){logger[_0xf7c2('0xb')](_0xf7c2('0x4d'),_0xf7c2('0x4e'));_0xafd6eb[_0xf7c2('0x4f')]=util[_0xf7c2('0xd')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5d80bf['serverUrl'],_0xafd6eb[_0xf7c2('0x50')],md5(_0xafd6eb[_0xf7c2('0x50')]));}else{_0xafd6eb[_0xf7c2('0x4f')]='';}headers[_0xf7c2('0x51')]=getAuth(_0x5d80bf);return getUser(_0x5d80bf,_0x19322b[_0xf7c2('0x52')])['then'](function(_0x5dc9bd){_0x5f1878=_0x5dc9bd;logger['info']('The\x20User\x20ID\x20is:',_0x5f1878['id']);return getEndUser(_0x5d80bf,_0xafd6eb['calleridname'],_0xafd6eb[_0xf7c2('0x53')]);})['then'](function(_0x2b522f){_0x3f15d7=_0x2b522f;logger[_0xf7c2('0xb')]('The\x20Enduser\x20ID\x20is:',_0x3f15d7['id']);return getTicket(_0x5d80bf,_0x5f1878,_0x3f15d7,_0x4fdb5e,_0xafd6eb);})[_0xf7c2('0x15')](function(_0x499e1f){if(_0x499e1f){logger[_0xf7c2('0xb')](_0xf7c2('0x54'),_0x499e1f['id']);switch(_0x5d80bf[_0xf7c2('0x3c')]){case _0xf7c2('0x55'):logger[_0xf7c2('0xb')](_0xf7c2('0x4d'),_0xf7c2('0x56'));return request({'uri':util[_0xf7c2('0xd')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x5d80bf[_0xf7c2('0x1b')],_0x5f1878['id'],_0x499e1f['id']),'method':_0xf7c2('0xf')});case _0xf7c2('0x57'):logger[_0xf7c2('0xb')](_0xf7c2('0x4d'),_0xf7c2('0x58'));emit(util[_0xf7c2('0xd')](_0xf7c2('0x59'),_0x19322b[_0xf7c2('0x48')]),_0xf7c2('0x5a'),{'uri':util['format'](_0xf7c2('0x5b'),_0x5d80bf[_0xf7c2('0x1b')]['replace'](_0xf7c2('0x5c'),''),_0x499e1f['id'])});break;default:logger[_0xf7c2('0x5d')]('[QUEUE]',_0xf7c2('0x5e'));}}})[_0xf7c2('0x5f')](function(_0x546b6a){logger[_0xf7c2('0x5d')](_0xf7c2('0x60'),util[_0xf7c2('0x61')](_0x546b6a,{'showHidden':!![],'depth':null}));});};exports[_0xf7c2('0x62')]=function(_0xdbe4e4,_0x23e96f,_0x3783ac,_0x4477b,_0xb9cc8d,_0x54325b,_0x1c8c81){var _0x290dd3,_0x369948;_0x54325b[_0xf7c2('0x1b')]=intUtil[_0xf7c2('0x4b')](_0x54325b[_0xf7c2('0x1b')]);_0x54325b[_0xf7c2('0x4a')]=intUtil[_0xf7c2('0x4b')](_0x54325b[_0xf7c2('0x4a')]);if(_0x1c8c81&&_0x1c8c81[_0xf7c2('0x63')]&&_0x1c8c81[_0xf7c2('0x63')]!=='none'){logger[_0xf7c2('0xb')](_0xf7c2('0x64'),_0xf7c2('0x4e'));_0x23e96f[_0xf7c2('0x4f')]=util[_0xf7c2('0xd')](_0xf7c2('0x65'),_0x54325b['serverUrl'],_0x23e96f[_0xf7c2('0x50')],md5(_0x23e96f[_0xf7c2('0x50')]));}headers[_0xf7c2('0x51')]=getAuth(_0x54325b);return getUser(_0x54325b,_0x4477b['email'])[_0xf7c2('0x15')](function(_0x520612){_0x290dd3=_0x520612;logger[_0xf7c2('0xb')](_0xf7c2('0x66'),_0x290dd3['id']);return getEndUser(_0x54325b,_0x23e96f[_0xf7c2('0x67')],_0x23e96f[_0xf7c2('0x68')]);})[_0xf7c2('0x15')](function(_0x103d7b){_0x369948=_0x103d7b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x369948['id']);return getTicket(_0x54325b,_0x290dd3,_0x369948,_0x3783ac,_0x23e96f);})[_0xf7c2('0x15')](function(_0x29e131){if(_0x29e131){logger[_0xf7c2('0xb')](_0xf7c2('0x54'),_0x29e131['id']);switch(_0x54325b[_0xf7c2('0x3c')]){case _0xf7c2('0x55'):logger[_0xf7c2('0xb')](_0xf7c2('0x64'),_0xf7c2('0x56'));return request({'uri':util[_0xf7c2('0xd')](_0xf7c2('0x69'),_0x54325b[_0xf7c2('0x1b')],_0x290dd3['id'],_0x29e131['id']),'method':'POST'});case _0xf7c2('0x57'):logger[_0xf7c2('0xb')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xf7c2('0xd')](_0xf7c2('0x59'),_0x4477b['name']),'trigger:browser:url',{'uri':util['format']('%s/agent/tickets/%s',_0x54325b['remoteUri'][_0xf7c2('0x6a')](_0xf7c2('0x5c'),''),_0x29e131['id'])});break;default:logger[_0xf7c2('0x5d')](_0xf7c2('0x64'),_0xf7c2('0x5e'));}}})['catch'](function(_0x3d80c0){logger[_0xf7c2('0x5d')]('[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x3d80c0,{'showHidden':!![],'depth':null}));});};exports[_0xf7c2('0x6b')]=function(_0x3edf61,_0x2ade08,_0x463bba,_0xf1f686,_0x3c6b1c,_0x11d3e3){var _0x51b860,_0x472ec1;_0x11d3e3[_0xf7c2('0x1b')]=intUtil[_0xf7c2('0x4b')](_0x11d3e3[_0xf7c2('0x1b')]);_0x11d3e3[_0xf7c2('0x4a')]=intUtil[_0xf7c2('0x4b')](_0x11d3e3['serverUrl']);if(_0x3c6b1c&&_0x3c6b1c[_0xf7c2('0x4c')]){logger[_0xf7c2('0xb')]('['+_0x2ade08[_0xf7c2('0x6c')]['toUpperCase']()+']',_0xf7c2('0x4e'));_0x2ade08[_0xf7c2('0x4f')]=util[_0xf7c2('0xd')](_0xf7c2('0x65'),_0x11d3e3[_0xf7c2('0x4a')],_0x2ade08['uniqueid'],md5(_0x2ade08['uniqueid']));}else{_0x2ade08[_0xf7c2('0x4f')]='';}headers['Authorization']=getAuth(_0x11d3e3);return getUser(_0x11d3e3)[_0xf7c2('0x15')](function(_0x3b6b23){_0x51b860=_0x3b6b23;logger[_0xf7c2('0xb')](_0xf7c2('0x66'),_0x51b860['id']);return getEndUser(_0x11d3e3,_0x2ade08['calleridname'],_0x2ade08['calleridnum']);})[_0xf7c2('0x15')](function(_0xb5d408){_0x472ec1=_0xb5d408;logger[_0xf7c2('0xb')]('The\x20Enduser\x20ID\x20is:',_0x472ec1['id']);return getTicket(_0x11d3e3,_0x51b860,_0x472ec1,_0x463bba,_0x2ade08);})[_0xf7c2('0x15')](function(_0x3d8f4d){if(_0x3d8f4d){logger[_0xf7c2('0xb')]('The\x20Ticket\x20ID\x20is:',_0x3d8f4d['id']);}})[_0xf7c2('0x5f')](function(_0x16236b){logger['error']('['+_0x2ade08[_0xf7c2('0x6c')][_0xf7c2('0x6d')]()+']'+_0xf7c2('0x6e'),util[_0xf7c2('0x61')](_0x16236b,{'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 65c89b2..9cd7357 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 _0x7623=['toLowerCase','indexOf','split','isNil','access_token','isBefore','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','refreshToken','clientId','clientSecret','refresh_token','then','expires_in','catch','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','stringify','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','/crm/v2/','startCase','role','first_name','last_name','data','code','Error:\x20','log','CREATE\x20ERROR','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','moduleCreate','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Description','Full_Name','Last_Name','What_Id','First_Name','$se_module','talktime','utc','mm:ss','answertime','endtime','Call_Duration','diff','starttime','lastevent','called','Called','complete','connect','Call_Result','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','YYYY-MM-DDTHH:mm:ss','Call_Type','Inbound','/crm/v2/Calls','SUCCESS','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','recordingURL','/downloads?type=uniqueid&token=','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','Recording\x20is\x20enabled!','/api/voice/recordings/','Outbound','trigger:browser:url','[OUTBOUND]','unmanaged','monitor_format','toUpperCase','calleridnum','lodash','request-promise','md5','moment','ioredis','../../../../config/environment','../../../../config/logger','redis','defaults','emit','debug','[HTTP]','length','forEach','includes','picklist','type','idField','variableName','toString','Variable','name'];(function(_0x49c008,_0x15dfd1){var _0x2626e4=function(_0xc1bfbd){while(--_0xc1bfbd){_0x49c008['push'](_0x49c008['shift']());}};_0x2626e4(++_0x15dfd1);}(_0x7623,0x80));var _0x3762=function(_0x2dc343,_0xf015a2){_0x2dc343=_0x2dc343-0x0;var _0x51eac5=_0x7623[_0x2dc343];return _0x51eac5;};'use strict';var _=require(_0x3762('0x0'));var rp=require(_0x3762('0x1'));var md5=require(_0x3762('0x2'));var util=require('util');var intUtil=require('./util');var moment=require(_0x3762('0x3'));var Redis=require(_0x3762('0x4'));var BPromise=require('bluebird');var config=require(_0x3762('0x5'));var logger=require(_0x3762('0x6'))('zoho');config[_0x3762('0x7')]=_[_0x3762('0x8')](config[_0x3762('0x7')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3762('0x7')]));function emit(_0xdb5d70,_0x418e15,_0x523b44){io['to'](_0xdb5d70)[_0x3762('0x9')](_0x418e15,_0x523b44);}function request(_0x20272d){logger[_0x3762('0xa')](_0x3762('0xb'),JSON['stringify'](_0x20272d));return rp(_0x20272d);}function getCustomFields(_0x402772,_0x2a8d05){var _0xfe5843={};if(_0x402772[_0x3762('0xc')]>0x0){_[_0x3762('0xd')](_0x402772,function(_0x3d5941){if(_[_0x3762('0xe')](['string',_0x3762('0xf')],_0x3d5941[_0x3762('0x10')])&&_0x3d5941[_0x3762('0x11')]){_0xfe5843[_0x3d5941[_0x3762('0x11')]]=_0x3d5941['content']['toString']();}else if(_0x3d5941[_0x3762('0x10')]==='variable'&&_0x3d5941[_0x3762('0x12')]&&_0x3d5941[_0x3762('0x11')]&&_0x2a8d05[_0x3d5941[_0x3762('0x12')]]){_0xfe5843[_0x3d5941[_0x3762('0x11')]]=_0x2a8d05[_0x3d5941[_0x3762('0x12')]][_0x3762('0x13')]();}else if(_0x3d5941[_0x3762('0x10')]==='customVariable'&&_0x3d5941['Variable']&&_0x3d5941[_0x3762('0x14')]['name']&&_0x3d5941[_0x3762('0x11')]&&_0x2a8d05[_0x3d5941[_0x3762('0x14')][_0x3762('0x15')][_0x3762('0x16')]()]){_0xfe5843[_0x3d5941['idField']]=_0x2a8d05[_0x3d5941[_0x3762('0x14')][_0x3762('0x15')][_0x3762('0x16')]()][_0x3762('0x13')]();}});}return _0xfe5843;}function getName(_0x4e05c2){if(_0x4e05c2[_0x3762('0x17')]('\x20')>0x0){var _0x32ac84=_0x4e05c2[_0x3762('0x18')](/ (.+)/);if(_0x32ac84[0x1]){return _0x32ac84;}}return[_0x4e05c2,_0x4e05c2];}var accountsTokens={};function getAccessToken(_0x509c12){return new Promise(function(_0x58e895,_0x3b0d52){if(!_[_0x3762('0x19')](accountsTokens[_0x509c12['id']])&&!_[_0x3762('0x19')](accountsTokens[_0x509c12['id']][_0x3762('0x1a')])){if(moment()[_0x3762('0x1b')](accountsTokens[_0x509c12['id']]['expires_in'])){_0x58e895(accountsTokens[_0x509c12['id']]['access_token']);}}var _0x1e20f7;switch(_0x509c12['zone']){case'US':_0x1e20f7=_0x3762('0x1c');break;case'AU':_0x1e20f7=_0x3762('0x1d');break;case'EU':_0x1e20f7=_0x3762('0x1e');break;case'IN':_0x1e20f7=_0x3762('0x1f');break;case'CN':_0x1e20f7=_0x3762('0x20');break;default:_0x1e20f7=_0x3762('0x1e');break;}var _0x2b4a66={'method':_0x3762('0x21'),'uri':_0x1e20f7+'/oauth/v2/token','qs':{'refresh_token':_0x509c12[_0x3762('0x22')],'client_id':_0x509c12[_0x3762('0x23')],'client_secret':_0x509c12[_0x3762('0x24')],'grant_type':_0x3762('0x25')},'json':!![]};return rp(_0x2b4a66)[_0x3762('0x26')](function(_0x413dd8){accountsTokens[_0x509c12['id']]={'access_token':_0x413dd8[_0x3762('0x1a')],'expires_in':moment()['add'](_0x413dd8[_0x3762('0x27')],'seconds')};_0x58e895(_0x413dd8[_0x3762('0x1a')]);})[_0x3762('0x28')](function(_0x144c41){logger[_0x3762('0x29')](_0x3762('0x2a'),_0x144c41[_0x3762('0x2b')]);_0x3b0d52(_0x144c41);});});}function getUser(_0x3c8f75,_0x3330d4,_0x33afac,_0x596daf){logger[_0x3762('0x2c')](_0x3762('0x2d'));return request({'method':_0x3762('0x2e'),'uri':util[_0x3762('0x2f')]('https://www.zohoapis.%s/crm/v2/users',_0x3330d4),'qs':{'type':_0x3762('0x30')},'headers':{'Authorization':_0x3762('0x31')+_0x3c8f75},'json':!![]})['then'](function(_0x2bfc64){if(_0x2bfc64[_0x3762('0x32')]){var _0x2ffb00=-0x1;if(_[_0x3762('0x33')](_0x2bfc64[_0x3762('0x32')])){if(!_['isNil'](_0x596daf)){_0x2ffb00=_[_0x3762('0x34')](_0x2bfc64[_0x3762('0x32')],function(_0xd13e76){return _0xd13e76[_0x3762('0x35')]===_0x596daf;});}if(_0x2ffb00>=0x0){logger['info'](_0x3762('0x36'));}else{logger[_0x3762('0x2c')](_0x3762('0x37'));_0x2ffb00=_['findIndex'](_0x2bfc64[_0x3762('0x32')],function(_0x1a1b4b){return _0x1a1b4b[_0x3762('0x38')]['name']===_0x3762('0x39');});}return _0x2bfc64[_0x3762('0x32')][_0x2ffb00];}else{if(_0x2bfc64[_0x3762('0x3a')][_0x3762('0x38')][_0x3762('0x15')]===_0x3762('0x39')){logger[_0x3762('0x2c')]('Using\x20the\x20admin\x20account!');user=_0x2bfc64[_0x3762('0x3a')];return user;}else{logger[_0x3762('0x29')]('The\x20failing\x20result\x20is',JSON[_0x3762('0x3b')](_0x2bfc64));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x2bfc64));}}}else{logger[_0x3762('0x29')](_0x3762('0x3c'),JSON['stringify'](_0x2bfc64));throw new Error(_0x3762('0x3d')+JSON[_0x3762('0x3b')](_0x2bfc64));}})[_0x3762('0x28')](function(_0x20746a){console[_0x3762('0x29')](_0x20746a);});}function getZohoUser(_0x533939,_0x23c97e){return new BPromise(function(_0x2a80d2,_0x83593c){request(_0x533939)['then'](function(_0x23c1d5){var _0x4737c7=null;if(_0x23c1d5){_0x4737c7=_0x23c1d5['data'][0x0];_0x4737c7[_0x3762('0x3e')]=_0x23c97e;}_0x2a80d2(_0x4737c7);})['catch'](function(_0x25e23a){_0x83593c(_0x25e23a);});});}function createEndUser(_0x2ceba3,_0x3d5673,_0x4b8a93,_0x4909a3,_0x51288f,_0x307df1){var _0x4b8a93=getName(_0x4b8a93);return request({'method':_0x3762('0x21'),'uri':'https://www.zohoapis.'+_0x3d5673+_0x3762('0x3f')+_[_0x3762('0x40')](_0x307df1['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x4b8a93[0x1],'First_Name':_0x4b8a93[0x0],'Phone':_0x4909a3,'Owner':{'name':!_['isNil'](_0x51288f[_0x3762('0x41')]['name'])?_0x51288f[_0x3762('0x41')][_0x3762('0x15')]:!_[_0x3762('0x19')](_0x51288f[_0x3762('0x42')])?_0x51288f[_0x3762('0x42')]+'\x20'+_0x51288f[_0x3762('0x43')]:_0x51288f[_0x3762('0x43')],'id':_0x51288f['id']}}]},'headers':{'Authorization':_0x3762('0x31')+_0x2ceba3},'json':!![]})[_0x3762('0x26')](function(_0x5a3165){if(_0x5a3165&&_0x5a3165[_0x3762('0x44')][0x0][_0x3762('0x45')]==='SUCCESS'){var _0x36e493=_0x5a3165['data'][0x0]['details'];_0x36e493[_0x3762('0x3e')]=_['startCase'](_0x307df1['moduleCreate'])+'s';return _0x36e493;}logger[_0x3762('0x29')](_0x3762('0x3c'),JSON['stringify'](data));throw new Error(_0x3762('0x46')+JSON[_0x3762('0x3b')](data));})['catch'](function(_0x1ed815){console[_0x3762('0x47')](_0x3762('0x48'),_0x1ed815);});}function getEndUser(_0x566c5c,_0x5630de,_0x199b89,_0x2a0a33,_0x19f058,_0x417940,_0x6bc528){var _0x37e55b={'method':_0x3762('0x2e'),'uri':'','headers':{'Authorization':_0x3762('0x31')+_0x566c5c},'json':!![]};switch(_0x6bc528['moduleSearch']){case'contact_lead':_0x37e55b[_0x3762('0x49')]=_0x3762('0x4a')+_0x5630de+_0x3762('0x4b')+_0x19f058+'))';return getZohoUser(_0x37e55b,_0x3762('0x4c'))['then'](function(_0x3ce377){if(_0x3ce377)return _0x3ce377;_0x37e55b[_0x3762('0x49')]='https://www.zohoapis.'+_0x5630de+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x19f058+'))';return getZohoUser(_0x37e55b,_0x3762('0x4d'))['then'](function(_0x5a3355){if(_0x5a3355)return _0x5a3355;if(_0x6bc528[_0x3762('0x4e')]!=_0x3762('0x4f')){return createEndUser(_0x566c5c,_0x5630de,_0x2a0a33,_0x19f058,_0x417940,_0x6bc528);}else{return{};}});});break;case'contact':_0x37e55b[_0x3762('0x49')]=_0x3762('0x4a')+_0x5630de+_0x3762('0x4b')+_0x19f058+'))';return getZohoUser(_0x37e55b,'Contacts')['then'](function(_0x54fbb5){if(_0x54fbb5)return _0x54fbb5;if(_0x6bc528['moduleCreate']!=_0x3762('0x4f')){return createEndUser(_0x566c5c,_0x5630de,_0x2a0a33,_0x19f058,_0x417940,_0x6bc528);}else{return{};}});break;case _0x3762('0x50'):_0x37e55b['uri']=_0x3762('0x4a')+_0x5630de+_0x3762('0x51')+_0x19f058+'))';return getZohoUser(_0x37e55b,_0x3762('0x4d'))[_0x3762('0x26')](function(_0x57ce06){if(_0x57ce06)return _0x57ce06;if(_0x6bc528['moduleCreate']!=_0x3762('0x4f')){return createEndUser(_0x566c5c,_0x5630de,_0x2a0a33,_0x19f058,_0x417940,_0x6bc528);}else{return{};}});break;}}function getCall(_0x34f775,_0xbcf4ce,_0x4c18a5,_0x3ae71b,_0x299893,_0x20de5b,_0x2fbc1e,_0x2d5f59){logger[_0x3762('0x2c')](_0x3762('0x52'));var _0x539484={};_0x539484[_0x3762('0x53')]={'name':!_['isNil'](_0x3ae71b['role']['name'])&&!_['isNil'](_0x3ae71b['profile']['name'])&&_0x3ae71b[_0x3762('0x38')][_0x3762('0x15')]===_0x3762('0x54')?_0x3ae71b[_0x3762('0x41')][_0x3762('0x15')]:!_[_0x3762('0x19')](_0x3ae71b[_0x3762('0x42')])?_0x3ae71b[_0x3762('0x42')]+'\x20'+_0x3ae71b['last_name']:_0x3ae71b[_0x3762('0x43')],'id':_0x3ae71b['id']};_0x539484[_0x3762('0x55')]=intUtil[_0x3762('0x56')](_0x20de5b[_0x3762('0x57')],_0x2fbc1e,'\x20');_0x539484[_0x3762('0x58')]=intUtil[_0x3762('0x56')](_0x20de5b['Descriptions'],_0x2fbc1e,'\x0a');if(_0x299893['enduserType']===_0x3762('0x4c')){_0x539484['Who_Id']={'name':!_[_0x3762('0x19')](_0x299893['Full_Name'])?_0x299893[_0x3762('0x59')]:!_[_0x3762('0x19')](_0x299893['First_Name'])?_0x299893['First_Name']+'\x20'+_0x299893[_0x3762('0x5a')]:_0x299893['Last_Name'],'id':_0x299893['id']};}if(_0x299893['enduserType']==='Leads'){_0x539484[_0x3762('0x5b')]={'name':!_[_0x3762('0x19')](_0x299893[_0x3762('0x59')])?_0x299893[_0x3762('0x59')]:!_['isNil'](_0x299893[_0x3762('0x5c')])?_0x299893[_0x3762('0x5c')]+'\x20'+_0x299893[_0x3762('0x5a')]:_0x299893[_0x3762('0x5a')],'id':_0x299893['id']};_0x539484[_0x3762('0x5d')]=_[_0x3762('0x40')](_0x299893[_0x3762('0x3e')]);}if(_0x2fbc1e[_0x3762('0x5e')]){_0x539484['Call_Duration']=moment[_0x3762('0x5f')](parseInt(_0x2fbc1e['talktime'])*0x3e8)[_0x3762('0x2f')](_0x3762('0x60'));}else if(_0x2fbc1e[_0x3762('0x61')]&&_0x2fbc1e[_0x3762('0x62')]){_0x539484[_0x3762('0x63')]=moment['utc'](moment(_0x2fbc1e[_0x3762('0x62')],'YYYY-MM-DDTHH:mm:ss')[_0x3762('0x64')](moment(_0x2fbc1e[_0x3762('0x65')],'YYYY-MM-DDTHH:mm:ss')))[_0x3762('0x2f')]('mm:ss');}switch(_0x2fbc1e[_0x3762('0x66')]){case _0x3762('0x67'):_0x539484['Call_Result']=_0x3762('0x68');break;case _0x3762('0x69'):case _0x3762('0x6a'):_0x539484[_0x3762('0x6b')]=_0x3762('0x6c');break;case _0x3762('0x6d'):_0x539484[_0x3762('0x6b')]=_0x3762('0x6e');break;case'abandoned':_0x539484[_0x3762('0x6b')]=_0x3762('0x6f');break;case _0x3762('0x70'):_0x539484[_0x3762('0x6b')]=_0x3762('0x71');default:}_0x539484[_0x3762('0x72')]=(_0x2d5f59===_0x3762('0x73')?moment(_0x2fbc1e[_0x3762('0x65')])[_0x3762('0x2f')](_0x3762('0x74')):moment(_0x2fbc1e['agentcalledAt'])[_0x3762('0x2f')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x3762('0x2f')](_0x3762('0x74'));_0x539484[_0x3762('0x75')]=_0x2d5f59||_0x3762('0x76');_0x539484=_['merge'](_0x539484,getCustomFields(_0x20de5b['Fields'],_0x2fbc1e));return request({'method':_0x3762('0x21'),'uri':_0x3762('0x4a')+_0xbcf4ce+_0x3762('0x77'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x34f775},'body':{'data':[_0x539484]},'json':!![]})[_0x3762('0x26')](function(_0x2b7607){if(_0x2b7607&&_0x2b7607[_0x3762('0x44')][0x0][_0x3762('0x45')]===_0x3762('0x78')){logger[_0x3762('0x2c')](_0x3762('0x79'));return{'id':_0x2b7607[_0x3762('0x44')][0x0][_0x3762('0x7a')]['id']};}})['catch'](function(_0x596e2f){logger['info'](_0x3762('0x7b'),_0x596e2f[_0x3762('0x2b')]);console[_0x3762('0x47')](_0x3762('0x7b'),_0x596e2f);});}exports[_0x3762('0x7c')]=function(_0x4ef62e,_0x3a718c,_0x225841,_0x587788,_0x97bb94,_0x1446ae){var _0xa6d172,_0x35ee22,_0x4377f7;_0x1446ae[_0x3762('0x7d')]=intUtil[_0x3762('0x7e')](_0x1446ae[_0x3762('0x7d')]);_0x1446ae[_0x3762('0x7f')]=intUtil[_0x3762('0x7e')](_0x1446ae[_0x3762('0x7f')]);if(_0x97bb94&&_0x97bb94['monitor_format']){logger[_0x3762('0x2c')](_0x3762('0x80'),'Recording\x20is\x20enabled!');_0x3a718c[_0x3762('0x81')]=_0x1446ae[_0x3762('0x7f')]+'/api/voice/recordings/'+_0x3a718c['uniqueid']+_0x3762('0x82')+md5(_0x3a718c[_0x3762('0x83')]);}else{_0x3a718c[_0x3762('0x81')]='';}var _0x2bfd2b=_0x1446ae[_0x3762('0x7d')]===_0x3762('0x84')?'eu':_0x3762('0x85');return getAccessToken(_0x1446ae)[_0x3762('0x26')](function(_0x525522){_0x4377f7=_0x525522;return getUser(_0x4377f7,_0x2bfd2b,_0x1446ae,_0x587788['email']);})[_0x3762('0x26')](function(_0x21b379){_0xa6d172=_0x21b379;logger[_0x3762('0x2c')](_0x3762('0x86'),_0xa6d172['id']);return getEndUser(_0x4377f7,_0x2bfd2b,_0x1446ae,_0x3a718c[_0x3762('0x87')],_0x3a718c['calleridnum'],_0xa6d172,_0x225841);})['then'](function(_0x5d1aa3){_0x35ee22=_0x5d1aa3;return getCall(_0x4377f7,_0x2bfd2b,_0x1446ae,_0xa6d172,_0x35ee22,_0x225841,_0x3a718c,_0x3762('0x76'));})[_0x3762('0x26')](function(_0x20a438){if(_0x20a438){logger[_0x3762('0x2c')](_0x3762('0x88'),_0x20a438['id']);logger[_0x3762('0x2c')](_0x3762('0x80'),_0x3762('0x89'));emit(util[_0x3762('0x2f')](_0x3762('0x8a'),_0x587788[_0x3762('0x15')]),'trigger:browser:url',{'uri':'https://crm.'+_0x1446ae[_0x3762('0x7d')]+_0x3762('0x8b')+_0x20a438['id']});}})[_0x3762('0x28')](function(_0xc0f6c6){logger['error'](_0x3762('0x80'),JSON[_0x3762('0x3b')](_0xc0f6c6));});};exports[_0x3762('0x73')]=function(_0x19f2a5,_0x330eb6,_0x27aa22,_0x2c2291,_0x509ce9,_0x105254,_0x17791d){var _0x5838f1,_0x4783a8,_0x5ea076;_0x105254[_0x3762('0x7d')]=intUtil[_0x3762('0x7e')](_0x105254[_0x3762('0x7d')]);_0x105254[_0x3762('0x7f')]=intUtil['stripTrailingSlash'](_0x105254[_0x3762('0x7f')]);if(_0x17791d&&_0x17791d[_0x3762('0x8c')]&&_0x17791d[_0x3762('0x8c')]!=='none'){logger[_0x3762('0x2c')]('[OUTBOUND]',_0x3762('0x8d'));_0x330eb6['recordingURL']=_0x105254['serverUrl']+_0x3762('0x8e')+_0x330eb6['uniqueid']+'/downloads?type=uniqueid&token='+md5(_0x330eb6[_0x3762('0x83')]);}var _0x2569ef=_0x105254['host']==='zoho.eu'?'eu':_0x3762('0x85');return getAccessToken(_0x105254)[_0x3762('0x26')](function(_0x73adc4){_0x5ea076=_0x73adc4;return getUser(_0x5ea076,_0x2569ef,_0x105254,_0x2c2291[_0x3762('0x35')]);})[_0x3762('0x26')](function(_0x130cf3){_0x5838f1=_0x130cf3;logger[_0x3762('0x2c')](_0x3762('0x86'),_0x5838f1['id']);return getEndUser(_0x5ea076,_0x2569ef,_0x105254,_0x330eb6['destcalleridname'],_0x330eb6['destcalleridnum'],_0x5838f1,_0x27aa22);})[_0x3762('0x26')](function(_0x26edb0){_0x4783a8=_0x26edb0;return getCall(_0x5ea076,_0x2569ef,_0x105254,_0x5838f1,_0x4783a8,_0x27aa22,_0x330eb6,_0x3762('0x8f'));})[_0x3762('0x26')](function(_0x1f8ca9){if(_0x1f8ca9){logger[_0x3762('0x2c')](_0x3762('0x88'),_0x1f8ca9['id']);logger[_0x3762('0x2c')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3762('0x2f')]('user:%s',_0x2c2291[_0x3762('0x15')]),_0x3762('0x90'),{'uri':'https://crm.'+_0x105254[_0x3762('0x7d')]+_0x3762('0x8b')+_0x1f8ca9['id']});}})[_0x3762('0x28')](function(_0x434627){logger[_0x3762('0x29')](_0x3762('0x91'),JSON['stringify'](_0x434627));});};exports[_0x3762('0x92')]=function(_0x385b93,_0x1d6554,_0x24ca44,_0x2c1cff,_0x319f33,_0x3108fb){var _0x41895f,_0x55d9f2,_0x381d99;_0x3108fb[_0x3762('0x7d')]=intUtil[_0x3762('0x7e')](_0x3108fb[_0x3762('0x7d')]);_0x3108fb['serverUrl']=intUtil['stripTrailingSlash'](_0x3108fb[_0x3762('0x7f')]);if(_0x319f33&&_0x319f33[_0x3762('0x93')]){logger['info']('['+_0x1d6554[_0x3762('0x66')][_0x3762('0x94')]()+']',_0x3762('0x8d'));_0x1d6554['recordingURL']=_0x3108fb[_0x3762('0x7f')]+'/api/voice/recordings/'+_0x1d6554[_0x3762('0x83')]+'/downloads?type=uniqueid&token='+md5(_0x1d6554['uniqueid']);}else{_0x1d6554[_0x3762('0x81')]='';}var _0x520a3e=_0x3108fb['host']===_0x3762('0x84')?'eu':_0x3762('0x85');return getAccessToken(_0x3108fb)['then'](function(_0x12c71e){_0x381d99=_0x12c71e;return getUser(_0x381d99,_0x520a3e,_0x3108fb);})['then'](function(_0x2fb79f){_0x41895f=_0x2fb79f;logger[_0x3762('0x2c')]('The\x20User\x20ID\x20is:',_0x41895f['id']);return getEndUser(_0x381d99,_0x520a3e,_0x3108fb,_0x1d6554[_0x3762('0x87')],_0x1d6554[_0x3762('0x95')],_0x41895f,_0x24ca44);})[_0x3762('0x26')](function(_0x373b1f){_0x55d9f2=_0x373b1f;return getCall(_0x381d99,_0x520a3e,_0x3108fb,_0x41895f,_0x55d9f2,_0x24ca44,_0x1d6554,'Inbound');})[_0x3762('0x26')](function(_0x546147){if(_0x546147){logger[_0x3762('0x2c')]('The\x20Call\x20ID\x20is:',_0x546147['id']);}})[_0x3762('0x28')](function(_0x48fbca){logger[_0x3762('0x29')]('['+_0x1d6554['lastevent']['toUpperCase']()+']',JSON[_0x3762('0x3b')](_0x48fbca));});}; \ No newline at end of file +var _0xcbfa=['/crm/v2/Calls','Call\x20created!','details','err','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','user:%s','https://crm.','[QUEUE]','recordingFormat','none','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','The\x20Call\x20ID\x20is:','[OUTBOUND]','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','./util','moment','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','forEach','string','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','clientId','clientSecret','add','seconds','catch','error','Failing\x20creating\x20the\x20access_token','stack','Search\x20user','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','then','users','isArrayLikeObject','findIndex','email','info','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','Error:\x20','contact_lead','uri','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','https://www.zohoapis.','Owner','administrator','Subject','Subjects','Description','getString','Descriptions','Who_Id','Full_Name','First_Name','Last_Name','What_Id','$se_module','Call_Duration','utc','talktime','format','mm:ss','answertime','endtime','diff','YYYY-MM-DDTHH:mm:ss','called','Call_Result','complete','connect','Answered','rejected','Rejected','Abandoned','outbound','agentcalledAt','Inbound','Fields'];(function(_0x9aaf2b,_0x5722be){var _0x5ce474=function(_0x4a2189){while(--_0x4a2189){_0x9aaf2b['push'](_0x9aaf2b['shift']());}};_0x5ce474(++_0x5722be);}(_0xcbfa,0x1f0));var _0xacbf=function(_0x1d5476,_0x2f8795){_0x1d5476=_0x1d5476-0x0;var _0x4ac71f=_0xcbfa[_0x1d5476];return _0x4ac71f;};'use strict';var _=require(_0xacbf('0x0'));var rp=require(_0xacbf('0x1'));var md5=require(_0xacbf('0x2'));var util=require('util');var intUtil=require(_0xacbf('0x3'));var moment=require(_0xacbf('0x4'));var Redis=require('ioredis');var BPromise=require(_0xacbf('0x5'));var config=require(_0xacbf('0x6'));var logger=require('../../../../config/logger')(_0xacbf('0x7'));config[_0xacbf('0x8')]=_[_0xacbf('0x9')](config[_0xacbf('0x8')],{'host':_0xacbf('0xa'),'port':0x18eb});var io=require(_0xacbf('0xb'))(new Redis(config[_0xacbf('0x8')]));function emit(_0x27e538,_0x338e2a,_0x57ed1e){io['to'](_0x27e538)[_0xacbf('0xc')](_0x338e2a,_0x57ed1e);}function request(_0x5d380b){logger[_0xacbf('0xd')](_0xacbf('0xe'),JSON[_0xacbf('0xf')](_0x5d380b));return rp(_0x5d380b);}function getCustomFields(_0x21f52e,_0x184f62){var _0x4c1ea9={};if(_0x21f52e[_0xacbf('0x10')]>0x0){_[_0xacbf('0x11')](_0x21f52e,function(_0x3ad3e2){if(_['includes']([_0xacbf('0x12'),'picklist'],_0x3ad3e2['type'])&&_0x3ad3e2[_0xacbf('0x13')]){_0x4c1ea9[_0x3ad3e2[_0xacbf('0x13')]]=_0x3ad3e2[_0xacbf('0x14')]['toString']();}else if(_0x3ad3e2[_0xacbf('0x15')]===_0xacbf('0x16')&&_0x3ad3e2[_0xacbf('0x17')]&&_0x3ad3e2[_0xacbf('0x13')]&&_0x184f62[_0x3ad3e2[_0xacbf('0x17')]]){_0x4c1ea9[_0x3ad3e2[_0xacbf('0x13')]]=_0x184f62[_0x3ad3e2[_0xacbf('0x17')]][_0xacbf('0x18')]();}else if(_0x3ad3e2[_0xacbf('0x15')]===_0xacbf('0x19')&&_0x3ad3e2['Variable']&&_0x3ad3e2[_0xacbf('0x1a')][_0xacbf('0x1b')]&&_0x3ad3e2['idField']&&_0x184f62[_0x3ad3e2[_0xacbf('0x1a')][_0xacbf('0x1b')]['toLowerCase']()]){_0x4c1ea9[_0x3ad3e2[_0xacbf('0x13')]]=_0x184f62[_0x3ad3e2['Variable'][_0xacbf('0x1b')][_0xacbf('0x1c')]()][_0xacbf('0x18')]();}});}return _0x4c1ea9;}function getName(_0x40836c){if(_0x40836c[_0xacbf('0x1d')]('\x20')>0x0){var _0x22a8c7=_0x40836c[_0xacbf('0x1e')](/ (.+)/);if(_0x22a8c7[0x1]){return _0x22a8c7;}}return[_0x40836c,_0x40836c];}var accountsTokens={};function getAccessToken(_0xf74707){return new Promise(function(_0x26063f,_0xd4a949){if(!_['isNil'](accountsTokens[_0xf74707['id']])&&!_[_0xacbf('0x1f')](accountsTokens[_0xf74707['id']][_0xacbf('0x20')])){if(moment()[_0xacbf('0x21')](accountsTokens[_0xf74707['id']]['expires_in'])){_0x26063f(accountsTokens[_0xf74707['id']][_0xacbf('0x20')]);}}var _0x74ec5c;switch(_0xf74707[_0xacbf('0x22')]){case'US':_0x74ec5c=_0xacbf('0x23');break;case'AU':_0x74ec5c='https://accounts.zoho.com.au';break;case'EU':_0x74ec5c=_0xacbf('0x24');break;case'IN':_0x74ec5c=_0xacbf('0x25');break;case'CN':_0x74ec5c=_0xacbf('0x26');break;default:_0x74ec5c=_0xacbf('0x24');break;}var _0x55cbbd={'method':'POST','uri':_0x74ec5c+_0xacbf('0x27'),'qs':{'refresh_token':_0xf74707['refreshToken'],'client_id':_0xf74707[_0xacbf('0x28')],'client_secret':_0xf74707[_0xacbf('0x29')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x55cbbd)['then'](function(_0x3ab8e8){accountsTokens[_0xf74707['id']]={'access_token':_0x3ab8e8[_0xacbf('0x20')],'expires_in':moment()[_0xacbf('0x2a')](_0x3ab8e8['expires_in'],_0xacbf('0x2b'))};_0x26063f(_0x3ab8e8['access_token']);})[_0xacbf('0x2c')](function(_0x2f2c2c){logger[_0xacbf('0x2d')](_0xacbf('0x2e'),_0x2f2c2c[_0xacbf('0x2f')]);_0xd4a949(_0x2f2c2c);});});}function getUser(_0x229f6e,_0x5d80b3,_0xea7f8d,_0x104788){logger['info'](_0xacbf('0x30'));return request({'method':_0xacbf('0x31'),'uri':util['format'](_0xacbf('0x32'),_0x5d80b3),'qs':{'type':_0xacbf('0x33')},'headers':{'Authorization':_0xacbf('0x34')+_0x229f6e},'json':!![]})[_0xacbf('0x35')](function(_0x3e4d25){if(_0x3e4d25[_0xacbf('0x36')]){var _0x39eecf=-0x1;if(_[_0xacbf('0x37')](_0x3e4d25[_0xacbf('0x36')])){if(!_[_0xacbf('0x1f')](_0x104788)){_0x39eecf=_[_0xacbf('0x38')](_0x3e4d25['users'],function(_0x51053e){return _0x51053e[_0xacbf('0x39')]===_0x104788;});}if(_0x39eecf>=0x0){logger[_0xacbf('0x3a')](_0xacbf('0x3b'));}else{logger['info'](_0xacbf('0x3c'));_0x39eecf=_[_0xacbf('0x38')](_0x3e4d25[_0xacbf('0x36')],function(_0x4092b0){return _0x4092b0[_0xacbf('0x3d')][_0xacbf('0x1b')]===_0xacbf('0x3e');});}return _0x3e4d25[_0xacbf('0x36')][_0x39eecf];}else{if(_0x3e4d25[_0xacbf('0x3f')][_0xacbf('0x3d')]['name']===_0xacbf('0x3e')){logger[_0xacbf('0x3a')]('Using\x20the\x20admin\x20account!');user=_0x3e4d25[_0xacbf('0x3f')];return user;}else{logger[_0xacbf('0x2d')](_0xacbf('0x40'),JSON['stringify'](_0x3e4d25));throw new Error(_0xacbf('0x41')+JSON[_0xacbf('0xf')](_0x3e4d25));}}}else{logger[_0xacbf('0x2d')]('The\x20failing\x20result\x20is',JSON['stringify'](_0x3e4d25));throw new Error(_0xacbf('0x41')+JSON['stringify'](_0x3e4d25));}})[_0xacbf('0x2c')](function(_0x57425f){console[_0xacbf('0x2d')](_0x57425f);});}function getZohoUser(_0x445041,_0x278fa5){return new BPromise(function(_0x13ef86,_0x138507){request(_0x445041)[_0xacbf('0x35')](function(_0x3f4623){var _0x610dac=null;if(_0x3f4623){_0x610dac=_0x3f4623[_0xacbf('0x42')][0x0];_0x610dac[_0xacbf('0x43')]=_0x278fa5;}_0x13ef86(_0x610dac);})[_0xacbf('0x2c')](function(_0x16644b){_0x138507(_0x16644b);});});}function createEndUser(_0xd30105,_0x5608a3,_0x245be8,_0x3becfa,_0x5cc886,_0x2d1864){var _0x245be8=getName(_0x245be8);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x5608a3+'/crm/v2/'+_[_0xacbf('0x44')](_0x2d1864[_0xacbf('0x45')])+'s','body':{'data':[{'Last_Name':_0x245be8[0x1],'First_Name':_0x245be8[0x0],'Phone':_0x3becfa,'Owner':{'name':!_[_0xacbf('0x1f')](_0x5cc886[_0xacbf('0x46')][_0xacbf('0x1b')])?_0x5cc886[_0xacbf('0x46')]['name']:!_[_0xacbf('0x1f')](_0x5cc886[_0xacbf('0x47')])?_0x5cc886['first_name']+'\x20'+_0x5cc886[_0xacbf('0x48')]:_0x5cc886['last_name'],'id':_0x5cc886['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0xd30105},'json':!![]})[_0xacbf('0x35')](function(_0x438be3){if(_0x438be3&&_0x438be3[_0xacbf('0x42')][0x0][_0xacbf('0x49')]===_0xacbf('0x4a')){var _0x556e3e=_0x438be3[_0xacbf('0x42')][0x0]['details'];_0x556e3e['enduserType']=_['startCase'](_0x2d1864[_0xacbf('0x45')])+'s';return _0x556e3e;}logger[_0xacbf('0x2d')](_0xacbf('0x40'),JSON[_0xacbf('0xf')](data));throw new Error(_0xacbf('0x4b')+JSON['stringify'](data));})[_0xacbf('0x2c')](function(_0x351778){console['log']('CREATE\x20ERROR',_0x351778);});}function getEndUser(_0x59e2b6,_0x2efab9,_0x3830ee,_0x38b2bb,_0x550b4a,_0x5b0e6d,_0x6318a4){var _0x4c661c={'method':'GET','uri':'','headers':{'Authorization':_0xacbf('0x34')+_0x59e2b6},'json':!![]};switch(_0x6318a4['moduleSearch']){case _0xacbf('0x4c'):_0x4c661c[_0xacbf('0x4d')]='https://www.zohoapis.'+_0x2efab9+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x550b4a+'))';return getZohoUser(_0x4c661c,_0xacbf('0x4e'))[_0xacbf('0x35')](function(_0x5ae91c){if(_0x5ae91c)return _0x5ae91c;_0x4c661c['uri']='https://www.zohoapis.'+_0x2efab9+_0xacbf('0x4f')+_0x550b4a+'))';return getZohoUser(_0x4c661c,_0xacbf('0x50'))[_0xacbf('0x35')](function(_0x39c768){if(_0x39c768)return _0x39c768;if(_0x6318a4['moduleCreate']!=_0xacbf('0x51')){return createEndUser(_0x59e2b6,_0x2efab9,_0x38b2bb,_0x550b4a,_0x5b0e6d,_0x6318a4);}else{return{};}});});break;case _0xacbf('0x52'):_0x4c661c['uri']='https://www.zohoapis.'+_0x2efab9+_0xacbf('0x53')+_0x550b4a+'))';return getZohoUser(_0x4c661c,'Contacts')['then'](function(_0x527ab1){if(_0x527ab1)return _0x527ab1;if(_0x6318a4[_0xacbf('0x45')]!=_0xacbf('0x51')){return createEndUser(_0x59e2b6,_0x2efab9,_0x38b2bb,_0x550b4a,_0x5b0e6d,_0x6318a4);}else{return{};}});break;case _0xacbf('0x54'):_0x4c661c[_0xacbf('0x4d')]=_0xacbf('0x55')+_0x2efab9+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x550b4a+'))';return getZohoUser(_0x4c661c,_0xacbf('0x50'))['then'](function(_0x54a2e8){if(_0x54a2e8)return _0x54a2e8;if(_0x6318a4[_0xacbf('0x45')]!=_0xacbf('0x51')){return createEndUser(_0x59e2b6,_0x2efab9,_0x38b2bb,_0x550b4a,_0x5b0e6d,_0x6318a4);}else{return{};}});break;}}function getCall(_0x228e7e,_0x1d14dd,_0x2c2183,_0x31baba,_0x356abb,_0xda9b5b,_0x839d07,_0x140b21){logger['info']('Creating\x20new\x20call...');var _0x15e139={};_0x15e139[_0xacbf('0x56')]={'name':!_[_0xacbf('0x1f')](_0x31baba[_0xacbf('0x46')][_0xacbf('0x1b')])&&!_[_0xacbf('0x1f')](_0x31baba['profile'][_0xacbf('0x1b')])&&_0x31baba[_0xacbf('0x3d')][_0xacbf('0x1b')]===_0xacbf('0x57')?_0x31baba[_0xacbf('0x46')][_0xacbf('0x1b')]:!_['isNil'](_0x31baba[_0xacbf('0x47')])?_0x31baba['first_name']+'\x20'+_0x31baba[_0xacbf('0x48')]:_0x31baba['last_name'],'id':_0x31baba['id']};_0x15e139[_0xacbf('0x58')]=intUtil['getString'](_0xda9b5b[_0xacbf('0x59')],_0x839d07,'\x20');_0x15e139[_0xacbf('0x5a')]=intUtil[_0xacbf('0x5b')](_0xda9b5b[_0xacbf('0x5c')],_0x839d07,'\x0a');if(_0x356abb['enduserType']===_0xacbf('0x4e')){_0x15e139[_0xacbf('0x5d')]={'name':!_[_0xacbf('0x1f')](_0x356abb[_0xacbf('0x5e')])?_0x356abb['Full_Name']:!_[_0xacbf('0x1f')](_0x356abb[_0xacbf('0x5f')])?_0x356abb[_0xacbf('0x5f')]+'\x20'+_0x356abb[_0xacbf('0x60')]:_0x356abb[_0xacbf('0x60')],'id':_0x356abb['id']};}if(_0x356abb['enduserType']===_0xacbf('0x50')){_0x15e139[_0xacbf('0x61')]={'name':!_[_0xacbf('0x1f')](_0x356abb[_0xacbf('0x5e')])?_0x356abb[_0xacbf('0x5e')]:!_[_0xacbf('0x1f')](_0x356abb[_0xacbf('0x5f')])?_0x356abb[_0xacbf('0x5f')]+'\x20'+_0x356abb[_0xacbf('0x60')]:_0x356abb[_0xacbf('0x60')],'id':_0x356abb['id']};_0x15e139[_0xacbf('0x62')]=_[_0xacbf('0x44')](_0x356abb[_0xacbf('0x43')]);}if(_0x839d07['talktime']){_0x15e139[_0xacbf('0x63')]=moment[_0xacbf('0x64')](parseInt(_0x839d07[_0xacbf('0x65')])*0x3e8)[_0xacbf('0x66')](_0xacbf('0x67'));}else if(_0x839d07[_0xacbf('0x68')]&&_0x839d07[_0xacbf('0x69')]){_0x15e139[_0xacbf('0x63')]=moment[_0xacbf('0x64')](moment(_0x839d07[_0xacbf('0x69')],'YYYY-MM-DDTHH:mm:ss')[_0xacbf('0x6a')](moment(_0x839d07['starttime'],_0xacbf('0x6b'))))[_0xacbf('0x66')](_0xacbf('0x67'));}switch(_0x839d07['lastevent']){case _0xacbf('0x6c'):_0x15e139[_0xacbf('0x6d')]='Called';break;case _0xacbf('0x6e'):case _0xacbf('0x6f'):_0x15e139[_0xacbf('0x6d')]=_0xacbf('0x70');break;case _0xacbf('0x71'):_0x15e139[_0xacbf('0x6d')]=_0xacbf('0x72');break;case'abandoned':_0x15e139['Call_Result']=_0xacbf('0x73');break;case'timeout':_0x15e139['Call_Result']='Timeout';default:}_0x15e139['Call_Start_Time']=(_0x140b21===_0xacbf('0x74')?moment(_0x839d07['starttime'])[_0xacbf('0x66')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x839d07[_0xacbf('0x75')])['format'](_0xacbf('0x6b')))||moment()[_0xacbf('0x66')](_0xacbf('0x6b'));_0x15e139['Call_Type']=_0x140b21||_0xacbf('0x76');_0x15e139=_['merge'](_0x15e139,getCustomFields(_0xda9b5b[_0xacbf('0x77')],_0x839d07));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x1d14dd+_0xacbf('0x78'),'headers':{'Authorization':_0xacbf('0x34')+_0x228e7e},'body':{'data':[_0x15e139]},'json':!![]})['then'](function(_0x5f27ae){if(_0x5f27ae&&_0x5f27ae[_0xacbf('0x42')][0x0][_0xacbf('0x49')]==='SUCCESS'){logger[_0xacbf('0x3a')](_0xacbf('0x79'));return{'id':_0x5f27ae['data'][0x0][_0xacbf('0x7a')]['id']};}})[_0xacbf('0x2c')](function(_0x2abf58){logger[_0xacbf('0x3a')](_0xacbf('0x7b'),_0x2abf58[_0xacbf('0x2f')]);console[_0xacbf('0x7c')](_0xacbf('0x7b'),_0x2abf58);});}exports[_0xacbf('0x7d')]=function(_0x4717b8,_0x517b5f,_0xa04be8,_0x11754f,_0x4358b9,_0x45e2a5){var _0x355f53,_0x5133c0,_0x21080a;_0x45e2a5[_0xacbf('0x7e')]=intUtil[_0xacbf('0x7f')](_0x45e2a5[_0xacbf('0x7e')]);_0x45e2a5[_0xacbf('0x80')]=intUtil['stripTrailingSlash'](_0x45e2a5[_0xacbf('0x80')]);if(_0x4358b9&&_0x4358b9[_0xacbf('0x81')]){logger[_0xacbf('0x3a')]('[QUEUE]',_0xacbf('0x82'));_0x517b5f[_0xacbf('0x83')]=_0x45e2a5[_0xacbf('0x80')]+_0xacbf('0x84')+_0x517b5f[_0xacbf('0x85')]+'/downloads?type=uniqueid&token='+md5(_0x517b5f[_0xacbf('0x85')]);}else{_0x517b5f[_0xacbf('0x83')]='';}var _0x1b0284=_0x45e2a5['host']===_0xacbf('0x86')?'eu':_0xacbf('0x87');return getAccessToken(_0x45e2a5)[_0xacbf('0x35')](function(_0x184b0b){_0x21080a=_0x184b0b;return getUser(_0x21080a,_0x1b0284,_0x45e2a5,_0x11754f[_0xacbf('0x39')]);})[_0xacbf('0x35')](function(_0x1c5c9f){_0x355f53=_0x1c5c9f;logger[_0xacbf('0x3a')](_0xacbf('0x88'),_0x355f53['id']);return getEndUser(_0x21080a,_0x1b0284,_0x45e2a5,_0x517b5f[_0xacbf('0x89')],_0x517b5f[_0xacbf('0x8a')],_0x355f53,_0xa04be8);})[_0xacbf('0x35')](function(_0x2b31c2){_0x5133c0=_0x2b31c2;return getCall(_0x21080a,_0x1b0284,_0x45e2a5,_0x355f53,_0x5133c0,_0xa04be8,_0x517b5f,'Inbound');})['then'](function(_0x452e79){if(_0x452e79){logger['info']('The\x20Call\x20ID\x20is:',_0x452e79['id']);logger[_0xacbf('0x3a')]('[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xacbf('0x8b'),_0x11754f['name']),'trigger:browser:url',{'uri':_0xacbf('0x8c')+_0x45e2a5[_0xacbf('0x7e')]+'/crm/EntityInfo.do?module=Calls&id='+_0x452e79['id']});}})[_0xacbf('0x2c')](function(_0x1f3dad){logger[_0xacbf('0x2d')](_0xacbf('0x8d'),JSON[_0xacbf('0xf')](_0x1f3dad));});};exports[_0xacbf('0x74')]=function(_0x5d0c5e,_0x360d0a,_0x7ab039,_0x50449c,_0x437615,_0x96e6c,_0x263d32){var _0x4a1f0d,_0x884410,_0x4fd94b;_0x96e6c[_0xacbf('0x7e')]=intUtil['stripTrailingSlash'](_0x96e6c[_0xacbf('0x7e')]);_0x96e6c[_0xacbf('0x80')]=intUtil[_0xacbf('0x7f')](_0x96e6c[_0xacbf('0x80')]);if(_0x263d32&&_0x263d32[_0xacbf('0x8e')]&&_0x263d32[_0xacbf('0x8e')]!==_0xacbf('0x8f')){logger[_0xacbf('0x3a')]('[OUTBOUND]',_0xacbf('0x82'));_0x360d0a[_0xacbf('0x83')]=_0x96e6c[_0xacbf('0x80')]+_0xacbf('0x84')+_0x360d0a[_0xacbf('0x85')]+_0xacbf('0x90')+md5(_0x360d0a['uniqueid']);}var _0x37b2b4=_0x96e6c[_0xacbf('0x7e')]==='zoho.eu'?'eu':_0xacbf('0x87');return getAccessToken(_0x96e6c)[_0xacbf('0x35')](function(_0x5966f1){_0x4fd94b=_0x5966f1;return getUser(_0x4fd94b,_0x37b2b4,_0x96e6c,_0x50449c[_0xacbf('0x39')]);})[_0xacbf('0x35')](function(_0x83acd4){_0x4a1f0d=_0x83acd4;logger[_0xacbf('0x3a')](_0xacbf('0x88'),_0x4a1f0d['id']);return getEndUser(_0x4fd94b,_0x37b2b4,_0x96e6c,_0x360d0a[_0xacbf('0x91')],_0x360d0a[_0xacbf('0x92')],_0x4a1f0d,_0x7ab039);})['then'](function(_0x419f3a){_0x884410=_0x419f3a;return getCall(_0x4fd94b,_0x37b2b4,_0x96e6c,_0x4a1f0d,_0x884410,_0x7ab039,_0x360d0a,'Outbound');})[_0xacbf('0x35')](function(_0x5b5ba8){if(_0x5b5ba8){logger[_0xacbf('0x3a')](_0xacbf('0x93'),_0x5b5ba8['id']);logger[_0xacbf('0x3a')](_0xacbf('0x94'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xacbf('0x66')](_0xacbf('0x8b'),_0x50449c[_0xacbf('0x1b')]),_0xacbf('0x95'),{'uri':_0xacbf('0x8c')+_0x96e6c[_0xacbf('0x7e')]+_0xacbf('0x96')+_0x5b5ba8['id']});}})[_0xacbf('0x2c')](function(_0x82d246){logger[_0xacbf('0x2d')]('[OUTBOUND]',JSON['stringify'](_0x82d246));});};exports[_0xacbf('0x97')]=function(_0x50e894,_0x1f7279,_0x1d8198,_0x5003ca,_0x3838fe,_0x13924c){var _0x5b1b14,_0x3dd25b,_0x318c56;_0x13924c[_0xacbf('0x7e')]=intUtil[_0xacbf('0x7f')](_0x13924c[_0xacbf('0x7e')]);_0x13924c[_0xacbf('0x80')]=intUtil[_0xacbf('0x7f')](_0x13924c[_0xacbf('0x80')]);if(_0x3838fe&&_0x3838fe[_0xacbf('0x81')]){logger[_0xacbf('0x3a')]('['+_0x1f7279[_0xacbf('0x98')][_0xacbf('0x99')]()+']',_0xacbf('0x82'));_0x1f7279['recordingURL']=_0x13924c['serverUrl']+_0xacbf('0x84')+_0x1f7279[_0xacbf('0x85')]+_0xacbf('0x90')+md5(_0x1f7279['uniqueid']);}else{_0x1f7279[_0xacbf('0x83')]='';}var _0xe27fdd=_0x13924c[_0xacbf('0x7e')]==='zoho.eu'?'eu':'com';return getAccessToken(_0x13924c)[_0xacbf('0x35')](function(_0x156055){_0x318c56=_0x156055;return getUser(_0x318c56,_0xe27fdd,_0x13924c);})['then'](function(_0x4182f7){_0x5b1b14=_0x4182f7;logger[_0xacbf('0x3a')](_0xacbf('0x88'),_0x5b1b14['id']);return getEndUser(_0x318c56,_0xe27fdd,_0x13924c,_0x1f7279[_0xacbf('0x89')],_0x1f7279[_0xacbf('0x8a')],_0x5b1b14,_0x1d8198);})[_0xacbf('0x35')](function(_0x5977a6){_0x3dd25b=_0x5977a6;return getCall(_0x318c56,_0xe27fdd,_0x13924c,_0x5b1b14,_0x3dd25b,_0x1d8198,_0x1f7279,'Inbound');})['then'](function(_0x413f52){if(_0x413f52){logger[_0xacbf('0x3a')](_0xacbf('0x93'),_0x413f52['id']);}})['catch'](function(_0x251efb){logger[_0xacbf('0x2d')]('['+_0x1f7279[_0xacbf('0x98')][_0xacbf('0x99')]()+']',JSON[_0xacbf('0xf')](_0x251efb));});}; \ 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 04750f1..6c321c4 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 _0xac64=['render','error','format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','shelljs','mustache','../../../../config/logger','trigger','data2','Script','data3'];(function(_0x2837fc,_0x14c840){var _0x5054dc=function(_0x552bd9){while(--_0x552bd9){_0x2837fc['push'](_0x2837fc['shift']());}};_0x5054dc(++_0x14c840);}(_0xac64,0x117));var _0x4ac6=function(_0x568df5,_0x2e23a9){_0x568df5=_0x568df5-0x0;var _0x38b4b9=_0xac64[_0x568df5];return _0x38b4b9;};'use strict';var util=require('util');var sh=require(_0x4ac6('0x0'));var Mustache=require(_0x4ac6('0x1'));var logger=require(_0x4ac6('0x2'))(_0x4ac6('0x3'));exports['exec']=function(_0x28d59b,_0x5d8354){var _0x153b81=_0x28d59b[_0x4ac6('0x4')]?_0x28d59b['data2']:_0x4ac6('0x5');var _0x388a1d=_0x28d59b[_0x4ac6('0x6')]?Mustache[_0x4ac6('0x7')](_0x28d59b[_0x4ac6('0x6')],_0x5d8354):_0x5d8354;sh['exec'](_0x388a1d,function(_0x4528a4,_0x52c8da,_0x33e3dd){if(_0x4528a4!==0x0){logger[_0x4ac6('0x8')](util[_0x4ac6('0x9')](_0x4ac6('0xa'),_0x153b81,_0x388a1d,_0x4528a4,_0x33e3dd));}else{logger[_0x4ac6('0xb')](util[_0x4ac6('0x9')](_0x4ac6('0xc'),_0x153b81,_0x388a1d,_0x52c8da));}});}; \ No newline at end of file +var _0x8498=['format','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','util','mustache','../../../../config/logger','trigger','data2','Script','data3','render','exec','error'];(function(_0x211a05,_0x3aab49){var _0xfd5fa6=function(_0x297283){while(--_0x297283){_0x211a05['push'](_0x211a05['shift']());}};_0xfd5fa6(++_0x3aab49);}(_0x8498,0x6e));var _0x8849=function(_0x39df26,_0x30c4fa){_0x39df26=_0x39df26-0x0;var _0x2fcdfc=_0x8498[_0x39df26];return _0x2fcdfc;};'use strict';var util=require(_0x8849('0x0'));var sh=require('shelljs');var Mustache=require(_0x8849('0x1'));var logger=require(_0x8849('0x2'))(_0x8849('0x3'));exports['exec']=function(_0x78b908,_0x2776d1){var _0x411c38=_0x78b908[_0x8849('0x4')]?_0x78b908[_0x8849('0x4')]:_0x8849('0x5');var _0xdc42ba=_0x78b908[_0x8849('0x6')]?Mustache[_0x8849('0x7')](_0x78b908[_0x8849('0x6')],_0x2776d1):_0x2776d1;sh[_0x8849('0x8')](_0xdc42ba,function(_0xd612b,_0x4248f6,_0x52b035){if(_0xd612b!==0x0){logger[_0x8849('0x9')](util[_0x8849('0xa')](_0x8849('0xb'),_0x411c38,_0xdc42ba,_0xd612b,_0x52b035));}else{logger['info'](util['format']('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x411c38,_0xdc42ba,_0x4248f6));}});}; \ 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 87db86a..6fbb3d7 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 _0x0f03=['parse','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%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','request-promise','util','lodash','mustache','../../../../config/logger','exec','data1','data5','data6','render','error','stack','toUpperCase','GET','DELETE','POST','PUT','data7'];(function(_0x17598a,_0x2c88bd){var _0x18360e=function(_0x288ff7){while(--_0x288ff7){_0x17598a['push'](_0x17598a['shift']());}};_0x18360e(++_0x2c88bd);}(_0x0f03,0x120));var _0x30f0=function(_0x539214,_0x5f1453){_0x539214=_0x539214-0x0;var _0x3ed627=_0x0f03[_0x539214];return _0x3ed627;};'use strict';var rp=require(_0x30f0('0x0'));var util=require(_0x30f0('0x1'));var _=require(_0x30f0('0x2'));var Mustache=require(_0x30f0('0x3'));var logger=require(_0x30f0('0x4'))('trigger');exports[_0x30f0('0x5')]=function(_0x16c6b0,_0x46452e){var _0x8aca7f,_0x2ce8e4;var _0xfbe391={'method':_0x16c6b0[_0x30f0('0x6')]['toUpperCase'](),'uri':Mustache['render'](_0x16c6b0['data2'],_0x46452e),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x16c6b0[_0x30f0('0x7')])==='number'&&parseInt(_0x16c6b0[_0x30f0('0x7')])>=0x1&&parseInt(_0x16c6b0[_0x30f0('0x7')])<=0xa?parseInt(_0x16c6b0[_0x30f0('0x7')])*0x3e8:0x5*0x3e8};try{_0xfbe391['headers']=_0x16c6b0[_0x30f0('0x8')]?JSON['parse'](Mustache[_0x30f0('0x9')](_0x16c6b0[_0x30f0('0x8')],_0x46452e)):{};}catch(_0x1e42a9){logger[_0x30f0('0xa')](_0x1e42a9[_0x30f0('0xb')]);}switch(_0x16c6b0['data1'][_0x30f0('0xc')]()){case _0x30f0('0xd'):case _0x30f0('0xe'):_0x8aca7f=null;_0xfbe391['qs']=_0x46452e;break;case _0x30f0('0xf'):case _0x30f0('0x10'):if(_0x16c6b0[_0x30f0('0x11')]){try{_0x8aca7f=JSON[_0x30f0('0x12')](Mustache['render'](_0x16c6b0[_0x30f0('0x11')],_0x46452e));_0xfbe391[_0x30f0('0x13')]=_0x8aca7f;}catch(_0x3f175a){logger[_0x30f0('0xa')](_0x3f175a['stack']);logger[_0x30f0('0xa')](_0x30f0('0x14'));}}else{_0x8aca7f=_0x46452e;_0xfbe391[_0x30f0('0x13')]=_0x8aca7f;}break;}logger[_0x30f0('0x15')](util[_0x30f0('0x16')]('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x16c6b0['data1'],_0x16c6b0[_0x30f0('0x17')],JSON[_0x30f0('0x18')](_0xfbe391)));rp(_0xfbe391)[_0x30f0('0x19')](function(_0x2bb6e1){_0x8aca7f=!_[_0x30f0('0x1a')](_0x8aca7f)?_0x30f0('0x1b')+_0x8aca7f:'';_0x2ce8e4=typeof _0x2bb6e1[_0x30f0('0x13')]===_0x30f0('0x1c')?JSON[_0x30f0('0x18')](_0x2bb6e1['body']):_0x2bb6e1[_0x30f0('0x13')];logger[_0x30f0('0x15')](util[_0x30f0('0x16')](_0x30f0('0x1d'),_0x16c6b0[_0x30f0('0x6')],_0x16c6b0[_0x30f0('0x17')],_0x2bb6e1[_0x30f0('0x1e')],_0x2ce8e4));})[_0x30f0('0x1f')](function(_0x34a2ba){logger['error'](util[_0x30f0('0x16')](_0x30f0('0x20'),_0x16c6b0[_0x30f0('0x6')],_0x16c6b0[_0x30f0('0x17')],_0x34a2ba[_0x30f0('0x1e')],_0x34a2ba[_0x30f0('0x21')],_0x34a2ba['message']));});}; \ No newline at end of file +var _0x1fa8=['body','error','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil','info','%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','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','parse','data6','DELETE','PUT','data7'];(function(_0x1360c8,_0xe06c8e){var _0x4f9026=function(_0x439d34){while(--_0x439d34){_0x1360c8['push'](_0x1360c8['shift']());}};_0x4f9026(++_0xe06c8e);}(_0x1fa8,0xce));var _0x81fa=function(_0x22cc92,_0x428489){_0x22cc92=_0x22cc92-0x0;var _0x3ec769=_0x1fa8[_0x22cc92];return _0x3ec769;};'use strict';var rp=require('request-promise');var util=require(_0x81fa('0x0'));var _=require(_0x81fa('0x1'));var Mustache=require(_0x81fa('0x2'));var logger=require(_0x81fa('0x3'))(_0x81fa('0x4'));exports[_0x81fa('0x5')]=function(_0x4188ff,_0x128b1a){var _0x3de5e6,_0x2a30ed;var _0x1ebf3d={'method':_0x4188ff[_0x81fa('0x6')][_0x81fa('0x7')](),'uri':Mustache[_0x81fa('0x8')](_0x4188ff[_0x81fa('0x9')],_0x128b1a),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4188ff['data5'])===_0x81fa('0xa')&&parseInt(_0x4188ff[_0x81fa('0xb')])>=0x1&&parseInt(_0x4188ff['data5'])<=0xa?parseInt(_0x4188ff[_0x81fa('0xb')])*0x3e8:0x5*0x3e8};try{_0x1ebf3d[_0x81fa('0xc')]=_0x4188ff['data6']?JSON[_0x81fa('0xd')](Mustache['render'](_0x4188ff[_0x81fa('0xe')],_0x128b1a)):{};}catch(_0x22a8aa){logger['error'](_0x22a8aa['stack']);}switch(_0x4188ff[_0x81fa('0x6')][_0x81fa('0x7')]()){case'GET':case _0x81fa('0xf'):_0x3de5e6=null;_0x1ebf3d['qs']=_0x128b1a;break;case'POST':case _0x81fa('0x10'):if(_0x4188ff[_0x81fa('0x11')]){try{_0x3de5e6=JSON[_0x81fa('0xd')](Mustache[_0x81fa('0x8')](_0x4188ff[_0x81fa('0x11')],_0x128b1a));_0x1ebf3d[_0x81fa('0x12')]=_0x3de5e6;}catch(_0xbb84f2){logger['error'](_0xbb84f2['stack']);logger[_0x81fa('0x13')]('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x3de5e6=_0x128b1a;_0x1ebf3d[_0x81fa('0x12')]=_0x3de5e6;}break;}logger['info'](util[_0x81fa('0x14')](_0x81fa('0x15'),_0x4188ff[_0x81fa('0x6')],_0x4188ff[_0x81fa('0x9')],JSON[_0x81fa('0x16')](_0x1ebf3d)));rp(_0x1ebf3d)[_0x81fa('0x17')](function(_0x456024){_0x3de5e6=!_[_0x81fa('0x18')](_0x3de5e6)?',\x20request\x20body:\x20'+_0x3de5e6:'';_0x2a30ed=typeof _0x456024[_0x81fa('0x12')]==='object'?JSON['stringify'](_0x456024['body']):_0x456024[_0x81fa('0x12')];logger[_0x81fa('0x19')](util['format'](_0x81fa('0x1a'),_0x4188ff[_0x81fa('0x6')],_0x4188ff['data2'],_0x456024[_0x81fa('0x1b')],_0x2a30ed));})[_0x81fa('0x1c')](function(_0x2159ae){logger[_0x81fa('0x13')](util[_0x81fa('0x14')](_0x81fa('0x1d'),_0x4188ff['data1'],_0x4188ff[_0x81fa('0x9')],_0x2159ae[_0x81fa('0x1b')],_0x2159ae[_0x81fa('0x1e')],_0x2159ae[_0x81fa('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index 139f2fb..b2d211a 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 _0x8972=['routing','error','rpc','message','result','catch','exports','jayson/promise','../../config/logger','client','Request','then','debug'];(function(_0x57f778,_0x17e030){var _0x51be03=function(_0x3c9887){while(--_0x3c9887){_0x57f778['push'](_0x57f778['shift']());}};_0x51be03(++_0x17e030);}(_0x8972,0x166));var _0x2897=function(_0x3577ab,_0x35f31f){_0x3577ab=_0x3577ab-0x0;var _0x22f9c8=_0x8972[_0x3577ab];return _0x22f9c8;};'use strict';var jayson=require(_0x2897('0x0'));var BPromise=require('bluebird');var logger=require(_0x2897('0x1'))('routing');var client=jayson[_0x2897('0x2')]['http']({'port':0x2329});client[_0x2897('0x3')]=function(_0x4a0a69,_0x4d8628){return new BPromise(function(_0x3b342c,_0x39db5d){return client['request'](_0x4a0a69,_0x4d8628)[_0x2897('0x4')](function(_0x45d8c6){logger[_0x2897('0x5')]('rpc',_0x2897('0x6'),_0x4a0a69,_0x4d8628,_0x45d8c6);if(_0x45d8c6[_0x2897('0x7')]){logger[_0x2897('0x7')](_0x2897('0x8'),_0x2897('0x6'),_0x4a0a69,_0x45d8c6[_0x2897('0x7')][_0x2897('0x9')],_0x4d8628);return _0x39db5d(_0x45d8c6[_0x2897('0x7')][_0x2897('0x9')]);}else{return _0x3b342c(_0x45d8c6[_0x2897('0xa')]);}})[_0x2897('0xb')](function(_0xbf57ba){logger[_0x2897('0x7')]('rpc',_0x2897('0x6'),_0x4a0a69,_0xbf57ba,_0x4d8628);return _0x39db5d(_0xbf57ba);});});};module[_0x2897('0xc')]=client; \ No newline at end of file +var _0xa25e=['jayson/promise','bluebird','../../config/logger','client','http','Request','request','then','rpc','routing','error','catch','exports'];(function(_0x45a2c1,_0x2b5897){var _0x1534e3=function(_0x1a11b8){while(--_0x1a11b8){_0x45a2c1['push'](_0x45a2c1['shift']());}};_0x1534e3(++_0x2b5897);}(_0xa25e,0xb6));var _0xea25=function(_0x1caa52,_0x39ce6a){_0x1caa52=_0x1caa52-0x0;var _0x1e4213=_0xa25e[_0x1caa52];return _0x1e4213;};'use strict';var jayson=require(_0xea25('0x0'));var BPromise=require(_0xea25('0x1'));var logger=require(_0xea25('0x2'))('routing');var client=jayson[_0xea25('0x3')][_0xea25('0x4')]({'port':0x2329});client[_0xea25('0x5')]=function(_0x5130ea,_0x542768){return new BPromise(function(_0x3a59c2,_0x4c2a6b){return client[_0xea25('0x6')](_0x5130ea,_0x542768)[_0xea25('0x7')](function(_0x58c4ad){logger['debug'](_0xea25('0x8'),_0xea25('0x9'),_0x5130ea,_0x542768,_0x58c4ad);if(_0x58c4ad[_0xea25('0xa')]){logger['error']('rpc',_0xea25('0x9'),_0x5130ea,_0x58c4ad[_0xea25('0xa')]['message'],_0x542768);return _0x4c2a6b(_0x58c4ad['error']['message']);}else{return _0x3a59c2(_0x58c4ad['result']);}})[_0xea25('0xb')](function(_0x43d3ed){logger[_0xea25('0xa')](_0xea25('0x8'),_0xea25('0x9'),_0x5130ea,_0x43d3ed,_0x542768);return _0x4c2a6b(_0x43d3ed);});});};module[_0xea25('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index c46fc43..72b9e7f 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 _0x1653=['./rpc/mailAccount','resolve','then','refresh','mailAccounts','listen','getSettings','error','Email\x20service\x20initialization','./server','./realtime','./lib/email'];(function(_0x4094aa,_0x2632d8){var _0x412e55=function(_0x2dcd4a){while(--_0x2dcd4a){_0x4094aa['push'](_0x4094aa['shift']());}};_0x412e55(++_0x2632d8);}(_0x1653,0xf9));var _0x3165=function(_0x3f25db,_0x1d3686){_0x3f25db=_0x3f25db-0x0;var _0x54f29d=_0x1653[_0x3f25db];return _0x54f29d;};'use strict';var server=require(_0x3165('0x0'));var Realtime=require(_0x3165('0x1'));var EmailChannel=require(_0x3165('0x2'));var mailAccount=require(_0x3165('0x3'));var setting=require('./rpc/setting');var logger=require('../../config/logger')('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3165('0x4')]()['then'](mailAccount['getMailAccounts']())['then'](realtime['initMailAccounts']())[_0x3165('0x5')](function(){email[_0x3165('0x6')](realtime[_0x3165('0x7')]);return realtime;});}function main(){return server[_0x3165('0x8')](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0x3165('0x9')]();})['then'](function(_0x502154){return setInterval(initRealtime,_0x502154['loginMailFrequency']*0x3e8);})['catch'](function(_0x125fa0){logger[_0x3165('0xa')](_0x3165('0xb'),_0x125fa0);});}main(); \ No newline at end of file +var _0xe173=['resolve','getMailAccounts','then','mailAccounts','listen','getSettings','loginMailFrequency','Email\x20service\x20initialization','./server','./realtime','./lib/email','./rpc/mailAccount','./rpc/setting','../../config/logger'];(function(_0x304086,_0xccb3ef){var _0x441eaf=function(_0x51bcd7){while(--_0x51bcd7){_0x304086['push'](_0x304086['shift']());}};_0x441eaf(++_0xccb3ef);}(_0xe173,0xf6));var _0x3e17=function(_0x33f3d0,_0x59649d){_0x33f3d0=_0x33f3d0-0x0;var _0x3f6787=_0xe173[_0x33f3d0];return _0x3f6787;};'use strict';var server=require(_0x3e17('0x0'));var Realtime=require(_0x3e17('0x1'));var EmailChannel=require(_0x3e17('0x2'));var mailAccount=require(_0x3e17('0x3'));var setting=require(_0x3e17('0x4'));var logger=require(_0x3e17('0x5'))('email');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0x3e17('0x6')]()['then'](mailAccount[_0x3e17('0x7')]())[_0x3e17('0x8')](realtime['initMailAccounts']())[_0x3e17('0x8')](function(){email['refresh'](realtime[_0x3e17('0x9')]);return realtime;});}function main(){return server[_0x3e17('0xa')](realtime,email)[_0x3e17('0x8')](function(){return initRealtime();})[_0x3e17('0x8')](function(){return setting[_0x3e17('0xb')]();})[_0x3e17('0x8')](function(_0x4bc6a3){return setInterval(initRealtime,_0x4bc6a3[_0x3e17('0xc')]*0x3e8);})['catch'](function(_0x5bde5b){logger['error'](_0x3e17('0xd'),_0x5bde5b);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 9de19e0..14509d6 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 _0x1ee7=['email','box','handleImapEmail','bind','end','handleImapEnd','error','status','disabled','handleImapBox','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','from','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verified','lodash','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','redis','defaults','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','emit','name','active','messageStatus','Imap','isNil','stringify','hasOwnProperty','service','provider','custom'];(function(_0x3013c6,_0x4bb0e8){var _0x4bb428=function(_0x7ab7e1){while(--_0x7ab7e1){_0x3013c6['push'](_0x3013c6['shift']());}};_0x4bb428(++_0x4bb0e8);}(_0x1ee7,0xbf));var _0x71ee=function(_0x3afd29,_0x4e7914){_0x3afd29=_0x3afd29-0x0;var _0x3e30a2=_0x1ee7[_0x3afd29];return _0x3e30a2;};'use strict';var _=require(_0x71ee('0x0'));var moment=require(_0x71ee('0x1'));var BPromise=require(_0x71ee('0x2'));var md5=require(_0x71ee('0x3'));var Redis=require(_0x71ee('0x4'));var config=require(_0x71ee('0x5'));var logger=require(_0x71ee('0x6'))('email');config[_0x71ee('0x7')]=_[_0x71ee('0x8')](config[_0x71ee('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x71ee('0x9'))(new Redis(config[_0x71ee('0x7')]));var EmailImap=require(_0x71ee('0xa'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x71ee('0xb'));var md5Accounts={};function EmailChannel(_0x55e4eb){logger[_0x71ee('0xc')](_0x71ee('0xd'));this[_0x71ee('0xe')]=_0x55e4eb[_0x71ee('0xe')];this[_0x71ee('0xf')]={};this[_0x71ee('0x10')]=new EmailSmtp();}EmailChannel[_0x71ee('0x11')][_0x71ee('0x12')]=function(_0x5e4bb4){var _0x355021=this[_0x71ee('0xe')][_0x5e4bb4];var _0x5724a0={'id':_0x355021['id'],'name':_0x355021[_0x71ee('0x13')],'key':_0x355021['key'],'active':_0x355021[_0x71ee('0x14')],'Imap':{'status':_0x355021['Imap']['status'],'messageStatus':_0x355021['Imap'][_0x71ee('0x15')],'total':_0x355021[_0x71ee('0x16')]['total']}};if(_[_0x71ee('0x17')](md5Accounts[_0x5e4bb4])){md5Accounts[_0x5e4bb4]={};}var _0xfb741b=md5(JSON[_0x71ee('0x18')](_0x5724a0));if(md5Accounts[_0x5e4bb4][_0x71ee('0x3')]!==_0xfb741b){md5Accounts[_0x5e4bb4]['md5']=_0xfb741b;io[_0x71ee('0x12')]('mailAccount:update',_0x5724a0);}};EmailChannel[_0x71ee('0x11')]['refresh']=function(_0x34ffe6){for(var _0x538091 in _0x34ffe6){if(_0x34ffe6[_0x71ee('0x19')](_0x538091)){if(_0x34ffe6[_0x538091][_0x71ee('0x16')]&&_0x34ffe6[_0x538091]['active']){var _0x20afde=_0x34ffe6[_0x538091][_0x71ee('0x16')];if(!_0x20afde[_0x71ee('0x1a')]&&_0x34ffe6[_0x538091][_0x71ee('0x1b')]!==_0x71ee('0x1c'))_0x20afde['service']=_0x34ffe6[_0x538091][_0x71ee('0x1b')];if(!this['imapAccounts'][_0x71ee('0x19')](_0x20afde['id'])){this['imapAccounts'][_0x20afde['id']]=new EmailImap(_0x20afde,_0x34ffe6[_0x538091][_0x71ee('0x1d')]);this[_0x71ee('0xf')][_0x20afde['id']]['on'](_0x71ee('0x1e'),this['handleImapBox']['bind'](this,_0x538091));this[_0x71ee('0xf')][_0x20afde['id']]['on'](_0x71ee('0x1d'),this[_0x71ee('0x1f')][_0x71ee('0x20')](this,_0x538091));this[_0x71ee('0xf')][_0x20afde['id']]['on'](_0x71ee('0x21'),this[_0x71ee('0x22')][_0x71ee('0x20')](this,_0x538091));this[_0x71ee('0xf')][_0x20afde['id']]['on'](_0x71ee('0x23'),this['handleImapError']['bind'](this,_0x538091));}}else{if(_['isNil'](this['mailAccounts'][_0x538091]['Imap'])){this['mailAccounts'][_0x538091][_0x71ee('0x16')]={};}this['mailAccounts'][_0x538091][_0x71ee('0x16')][_0x71ee('0x24')]=_0x71ee('0x25');this[_0x71ee('0xe')][_0x538091][_0x71ee('0x16')][_0x71ee('0x15')]='';this[_0x71ee('0x12')](_0x538091);}}}};EmailChannel[_0x71ee('0x11')][_0x71ee('0x26')]=function(_0x1bb96b,_0x40f500){if(this[_0x71ee('0xe')][_0x1bb96b]){this['mailAccounts'][_0x1bb96b][_0x71ee('0x16')]['status']=_0x71ee('0x27');this[_0x71ee('0xe')][_0x1bb96b][_0x71ee('0x16')]['messageStatus']=_0x40f500[_0x71ee('0x13')];if(_0x40f500[_0x71ee('0x28')]){this['mailAccounts'][_0x1bb96b][_0x71ee('0x16')][_0x71ee('0x29')]=_0x40f500[_0x71ee('0x28')][_0x71ee('0x29')];}return this[_0x71ee('0x12')](_0x1bb96b);}};EmailChannel[_0x71ee('0x11')]['handleImapEmail']=function(_0x4c4b51,_0x428d21){logger[_0x71ee('0xc')](_0x71ee('0x2a'),_0x428d21[_0x71ee('0x2b')],_0x428d21['lastName'],_0x428d21[_0x71ee('0x2c')],_0x4c4b51);if(this[_0x71ee('0xe')][_0x4c4b51]){return mailAccount['notify'](_0x4c4b51,_0x428d21)[_0x71ee('0x2d')](function(_0x27b880){if(_0x27b880){logger[_0x71ee('0xc')](_0x71ee('0x2e'));}})[_0x71ee('0x2f')](function(_0x577c4d){logger[_0x71ee('0x23')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON['stringify'](_0x577c4d));});}};EmailChannel[_0x71ee('0x11')][_0x71ee('0x22')]=function(_0x70394c){if(this['mailAccounts'][_0x70394c]&&this['mailAccounts'][_0x70394c]['Imap']){if(this[_0x71ee('0xf')][this[_0x71ee('0xe')][_0x70394c][_0x71ee('0x16')]['id']]){delete this[_0x71ee('0xf')][this[_0x71ee('0xe')][_0x70394c][_0x71ee('0x16')]['id']];}this[_0x71ee('0xe')][_0x70394c][_0x71ee('0x16')][_0x71ee('0x30')]=moment();this[_0x71ee('0x12')](_0x70394c);}};EmailChannel[_0x71ee('0x11')][_0x71ee('0x31')]=function(_0x4f76cc,_0x401d8b){if(this[_0x71ee('0xe')][_0x4f76cc]){this[_0x71ee('0xe')][_0x4f76cc][_0x71ee('0x16')]['status']=_0x71ee('0x23');this[_0x71ee('0xe')][_0x4f76cc][_0x71ee('0x16')][_0x71ee('0x15')]=_0x401d8b;return this[_0x71ee('0x12')](_0x4f76cc);}};EmailChannel['prototype'][_0x71ee('0x32')]=function(_0x397022,_0x11a11a){return this[_0x71ee('0x10')][_0x71ee('0x33')](_0x397022,_0x11a11a);};EmailChannel['prototype'][_0x71ee('0x34')]=function(_0x68fac){var _0x3b6ff2=this;if(this[_0x71ee('0xe')][_0x68fac['id']]){if(_['isNil'](this[_0x71ee('0xe')][_0x68fac['id']][_0x71ee('0x35')])){this[_0x71ee('0xe')][_0x68fac['id']][_0x71ee('0x35')]={};}this[_0x71ee('0xe')][_0x68fac['id']][_0x71ee('0x35')][_0x71ee('0x30')]=moment();return new BPromise(function(_0xd4241a,_0x338815){return _0x3b6ff2[_0x71ee('0x10')]['verify'](_0x68fac)[_0x71ee('0x2d')](function(_0x206135){_0x3b6ff2[_0x71ee('0xe')][_0x68fac['id']]['Smtp']['status']=_0x71ee('0x36');_0x3b6ff2[_0x71ee('0xe')][_0x68fac['id']][_0x71ee('0x35')]['messageStatus']='';_0x3b6ff2[_0x71ee('0x12')](_0x68fac['id']);_0xd4241a(_0x206135);})['catch'](function(_0x57e45f){_0x3b6ff2['mailAccounts'][_0x68fac['id']][_0x71ee('0x35')][_0x71ee('0x24')]='error';_0x3b6ff2[_0x71ee('0xe')][_0x68fac['id']][_0x71ee('0x35')]['messageStatus']=_0x57e45f;_0x3b6ff2[_0x71ee('0x12')](_0x68fac['id']);_0x338815(_0x57e45f);});});}return this[_0x71ee('0x10')]['verify'](_0x68fac);};module['exports']=EmailChannel; \ No newline at end of file +var _0x5b18=['mailAccount:update','refresh','hasOwnProperty','service','provider','custom','box','handleImapEmail','bind','end','error','handleImapError','isNil','disabled','messageStatus','handleImapBox','status','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','send','verifySmtp','Smtp','lastSync','verify','exports','moment','bluebird','md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','active','Imap','total'];(function(_0x4613bb,_0x450e6e){var _0x3ecd8e=function(_0x18053e){while(--_0x18053e){_0x4613bb['push'](_0x4613bb['shift']());}};_0x3ecd8e(++_0x450e6e);}(_0x5b18,0xd4));var _0x85b1=function(_0x31f85c,_0x13dbef){_0x31f85c=_0x31f85c-0x0;var _0x3d057f=_0x5b18[_0x31f85c];return _0x3d057f;};'use strict';var _=require('lodash');var moment=require(_0x85b1('0x0'));var BPromise=require(_0x85b1('0x1'));var md5=require(_0x85b1('0x2'));var Redis=require('ioredis');var config=require(_0x85b1('0x3'));var logger=require(_0x85b1('0x4'))(_0x85b1('0x5'));config[_0x85b1('0x6')]=_[_0x85b1('0x7')](config[_0x85b1('0x6')],{'host':_0x85b1('0x8'),'port':0x18eb});var io=require(_0x85b1('0x9'))(new Redis(config['redis']));var EmailImap=require(_0x85b1('0xa'));var EmailSmtp=require(_0x85b1('0xb'));var mailAccount=require(_0x85b1('0xc'));var md5Accounts={};function EmailChannel(_0x499206){logger[_0x85b1('0xd')](_0x85b1('0xe'));this[_0x85b1('0xf')]=_0x499206['mailAccounts'];this[_0x85b1('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x85b1('0x11')][_0x85b1('0x12')]=function(_0x4d9f7b){var _0x4aece4=this[_0x85b1('0xf')][_0x4d9f7b];var _0x2f68f8={'id':_0x4aece4['id'],'name':_0x4aece4[_0x85b1('0x13')],'key':_0x4aece4[_0x85b1('0x14')],'active':_0x4aece4[_0x85b1('0x15')],'Imap':{'status':_0x4aece4[_0x85b1('0x16')]['status'],'messageStatus':_0x4aece4[_0x85b1('0x16')]['messageStatus'],'total':_0x4aece4[_0x85b1('0x16')][_0x85b1('0x17')]}};if(_['isNil'](md5Accounts[_0x4d9f7b])){md5Accounts[_0x4d9f7b]={};}var _0x4518ec=md5(JSON['stringify'](_0x2f68f8));if(md5Accounts[_0x4d9f7b][_0x85b1('0x2')]!==_0x4518ec){md5Accounts[_0x4d9f7b][_0x85b1('0x2')]=_0x4518ec;io[_0x85b1('0x12')](_0x85b1('0x18'),_0x2f68f8);}};EmailChannel[_0x85b1('0x11')][_0x85b1('0x19')]=function(_0x253f7b){for(var _0x3771cc in _0x253f7b){if(_0x253f7b[_0x85b1('0x1a')](_0x3771cc)){if(_0x253f7b[_0x3771cc][_0x85b1('0x16')]&&_0x253f7b[_0x3771cc][_0x85b1('0x15')]){var _0x4d2e3e=_0x253f7b[_0x3771cc]['Imap'];if(!_0x4d2e3e[_0x85b1('0x1b')]&&_0x253f7b[_0x3771cc][_0x85b1('0x1c')]!==_0x85b1('0x1d'))_0x4d2e3e[_0x85b1('0x1b')]=_0x253f7b[_0x3771cc][_0x85b1('0x1c')];if(!this['imapAccounts']['hasOwnProperty'](_0x4d2e3e['id'])){this['imapAccounts'][_0x4d2e3e['id']]=new EmailImap(_0x4d2e3e,_0x253f7b[_0x3771cc][_0x85b1('0x5')]);this['imapAccounts'][_0x4d2e3e['id']]['on'](_0x85b1('0x1e'),this['handleImapBox']['bind'](this,_0x3771cc));this[_0x85b1('0x10')][_0x4d2e3e['id']]['on']('email',this[_0x85b1('0x1f')][_0x85b1('0x20')](this,_0x3771cc));this[_0x85b1('0x10')][_0x4d2e3e['id']]['on'](_0x85b1('0x21'),this['handleImapEnd'][_0x85b1('0x20')](this,_0x3771cc));this['imapAccounts'][_0x4d2e3e['id']]['on'](_0x85b1('0x22'),this[_0x85b1('0x23')][_0x85b1('0x20')](this,_0x3771cc));}}else{if(_[_0x85b1('0x24')](this[_0x85b1('0xf')][_0x3771cc][_0x85b1('0x16')])){this[_0x85b1('0xf')][_0x3771cc]['Imap']={};}this[_0x85b1('0xf')][_0x3771cc][_0x85b1('0x16')]['status']=_0x85b1('0x25');this[_0x85b1('0xf')][_0x3771cc][_0x85b1('0x16')][_0x85b1('0x26')]='';this[_0x85b1('0x12')](_0x3771cc);}}}};EmailChannel['prototype'][_0x85b1('0x27')]=function(_0xaf2744,_0x4eba3d){if(this[_0x85b1('0xf')][_0xaf2744]){this[_0x85b1('0xf')][_0xaf2744][_0x85b1('0x16')][_0x85b1('0x28')]=_0x85b1('0x29');this['mailAccounts'][_0xaf2744][_0x85b1('0x16')][_0x85b1('0x26')]=_0x4eba3d[_0x85b1('0x13')];if(_0x4eba3d[_0x85b1('0x2a')]){this[_0x85b1('0xf')][_0xaf2744][_0x85b1('0x16')]['total']=_0x4eba3d[_0x85b1('0x2a')][_0x85b1('0x17')];}return this['emit'](_0xaf2744);}};EmailChannel[_0x85b1('0x11')][_0x85b1('0x1f')]=function(_0x24cac7,_0x502b83){logger['info'](_0x85b1('0x2b'),_0x502b83['firstName'],_0x502b83[_0x85b1('0x2c')],_0x502b83[_0x85b1('0x2d')],_0x24cac7);if(this['mailAccounts'][_0x24cac7]){return mailAccount[_0x85b1('0x2e')](_0x24cac7,_0x502b83)[_0x85b1('0x2f')](function(_0x499e84){if(_0x499e84){logger[_0x85b1('0xd')](_0x85b1('0x30'));}})[_0x85b1('0x31')](function(_0x318c0d){logger[_0x85b1('0x22')](_0x85b1('0x32'),JSON[_0x85b1('0x33')](_0x318c0d));});}};EmailChannel['prototype'][_0x85b1('0x34')]=function(_0x58a790){if(this['mailAccounts'][_0x58a790]&&this[_0x85b1('0xf')][_0x58a790]['Imap']){if(this[_0x85b1('0x10')][this[_0x85b1('0xf')][_0x58a790][_0x85b1('0x16')]['id']]){delete this[_0x85b1('0x10')][this[_0x85b1('0xf')][_0x58a790][_0x85b1('0x16')]['id']];}this['mailAccounts'][_0x58a790][_0x85b1('0x16')]['lastSync']=moment();this[_0x85b1('0x12')](_0x58a790);}};EmailChannel[_0x85b1('0x11')][_0x85b1('0x23')]=function(_0x2a8ce8,_0x52d129){if(this['mailAccounts'][_0x2a8ce8]){this[_0x85b1('0xf')][_0x2a8ce8]['Imap'][_0x85b1('0x28')]=_0x85b1('0x22');this[_0x85b1('0xf')][_0x2a8ce8][_0x85b1('0x16')][_0x85b1('0x26')]=_0x52d129;return this[_0x85b1('0x12')](_0x2a8ce8);}};EmailChannel[_0x85b1('0x11')]['sendMail']=function(_0x521137,_0x29b049){return this['smtp'][_0x85b1('0x35')](_0x521137,_0x29b049);};EmailChannel[_0x85b1('0x11')][_0x85b1('0x36')]=function(_0x19785e){var _0x5a5cc5=this;if(this['mailAccounts'][_0x19785e['id']]){if(_[_0x85b1('0x24')](this[_0x85b1('0xf')][_0x19785e['id']][_0x85b1('0x37')])){this['mailAccounts'][_0x19785e['id']][_0x85b1('0x37')]={};}this[_0x85b1('0xf')][_0x19785e['id']][_0x85b1('0x37')][_0x85b1('0x38')]=moment();return new BPromise(function(_0x51c6d5,_0xbcdc35){return _0x5a5cc5['smtp'][_0x85b1('0x39')](_0x19785e)['then'](function(_0x2fcda9){_0x5a5cc5[_0x85b1('0xf')][_0x19785e['id']][_0x85b1('0x37')][_0x85b1('0x28')]='verified';_0x5a5cc5[_0x85b1('0xf')][_0x19785e['id']][_0x85b1('0x37')]['messageStatus']='';_0x5a5cc5[_0x85b1('0x12')](_0x19785e['id']);_0x51c6d5(_0x2fcda9);})['catch'](function(_0xe4796b){_0x5a5cc5[_0x85b1('0xf')][_0x19785e['id']][_0x85b1('0x37')][_0x85b1('0x28')]='error';_0x5a5cc5[_0x85b1('0xf')][_0x19785e['id']][_0x85b1('0x37')][_0x85b1('0x26')]=_0xe4796b;_0x5a5cc5['emit'](_0x19785e['id']);_0xbcdc35(_0xe4796b);});});}return this['smtp'][_0x85b1('0x39')](_0x19785e);};module[_0x85b1('0x3a')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index 16b5993..5ca1b03 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 _0x9d3d=['openBox','handleOpenBox','emit','box','readUnseen','handleError','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','once','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','handleFetchError','stringify','textCode','hasOwnProperty','upperFirst','exports','lodash','util','imap','mailparser','simpleParser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','account','getAccount','ready','handleReady','bind','end','handleEnd','error','connect','prototype','connTimeout','authTimeout','service','user','modernAuthentication','CloudProvider','data5','password','authentication','anonymous@xcally.com','host','port','tls','autotls'];(function(_0x59d89e,_0x55edf5){var _0x554e93=function(_0x3d40bc){while(--_0x3d40bc){_0x59d89e['push'](_0x59d89e['shift']());}};_0x554e93(++_0x55edf5);}(_0x9d3d,0x9f));var _0xd9d3=function(_0x411dad,_0x2b828d){_0x411dad=_0x411dad-0x0;var _0x627553=_0x9d3d[_0x411dad];return _0x627553;};'use strict';var _=require(_0xd9d3('0x0'));var util=require(_0xd9d3('0x1'));var Imap=require(_0xd9d3('0x2'));var simpleParser=require(_0xd9d3('0x3'))[_0xd9d3('0x4')];var Iconv=require(_0xd9d3('0x5'))[_0xd9d3('0x6')];var EventEmitter=require(_0xd9d3('0x7'))['EventEmitter'];var utils=require(_0xd9d3('0x8'));var logger=require(_0xd9d3('0x9'))(_0xd9d3('0xa'));function EmailImap(_0x3352f6,_0xf7165d){this[_0xd9d3('0xb')]=_0x3352f6[_0xd9d3('0xb')];this[_0xd9d3('0xc')]=this[_0xd9d3('0xd')](_0x3352f6,_0xf7165d);this[_0xd9d3('0x2')]=new Imap(this[_0xd9d3('0xc')]);this[_0xd9d3('0x2')]['once'](_0xd9d3('0xe'),this[_0xd9d3('0xf')][_0xd9d3('0x10')](this));this[_0xd9d3('0x2')]['once'](_0xd9d3('0x11'),this[_0xd9d3('0x12')][_0xd9d3('0x10')](this));this['imap']['on'](_0xd9d3('0x13'),this['handleError']['bind'](this));this[_0xd9d3('0x2')][_0xd9d3('0x14')]();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xd9d3('0x15')]['getAccount']=function(_0x573ee3,_0x271bc9){var _0x2a51b8={'connTimeout':_0x573ee3['connTimeout']?_0x573ee3[_0xd9d3('0x16')]*0x3e8:0x2710,'authTimeout':_0x573ee3[_0xd9d3('0x17')]?_0x573ee3[_0xd9d3('0x17')]*0x3e8:0x1388};if(_0x573ee3[_0xd9d3('0x18')]){_0x2a51b8[_0xd9d3('0x19')]=_0x573ee3[_0xd9d3('0x19')];if(_0x573ee3[_0xd9d3('0x1a')]){_0x2a51b8['xoauth2']=utils['generateXOAuth2Token'](_0x573ee3[_0xd9d3('0x1b')][_0xd9d3('0x1c')],_0x573ee3[_0xd9d3('0x19')]);}else{_0x2a51b8[_0xd9d3('0x1d')]=_0x573ee3[_0xd9d3('0x1d')];}}else{if(_0x573ee3[_0xd9d3('0x1e')]){_0x2a51b8[_0xd9d3('0x19')]=_0x573ee3[_0xd9d3('0x19')];_0x2a51b8[_0xd9d3('0x1d')]=_0x573ee3[_0xd9d3('0x1d')];}}_0x2a51b8[_0xd9d3('0xa')]=_0x271bc9||_0x573ee3[_0xd9d3('0x19')]||_0xd9d3('0x1f');_0x2a51b8['host']=_0x573ee3[_0xd9d3('0x20')];_0x2a51b8[_0xd9d3('0x21')]=_0x573ee3[_0xd9d3('0x21')]||0x3e1;if(_0x573ee3[_0xd9d3('0x22')]){_0x2a51b8['tls']=!![];}else{_0x2a51b8[_0xd9d3('0x22')]=![];_0x2a51b8[_0xd9d3('0x23')]='required';}return _0x2a51b8;};EmailImap[_0xd9d3('0x15')][_0xd9d3('0xf')]=function(){this[_0xd9d3('0x2')][_0xd9d3('0x24')](this['mailbox'],![],this['handleOpenBox'][_0xd9d3('0x10')](this));};EmailImap['prototype'][_0xd9d3('0x25')]=function(_0xb15e20,_0x4c68c2){if(_0xb15e20){this['handleError'](_0xb15e20,!![]);}else{this[_0xd9d3('0x26')](_0xd9d3('0x27'),_0x4c68c2);this[_0xd9d3('0x28')]();}};EmailImap[_0xd9d3('0x15')]['handleCloseBox']=function(_0x4ebcdb){if(_0x4ebcdb){this[_0xd9d3('0x29')](_0x4ebcdb,!![]);}else{this[_0xd9d3('0x2')][_0xd9d3('0x11')]();}};EmailImap['prototype']['readUnseen']=function(){this[_0xd9d3('0x2')][_0xd9d3('0x2a')]([_0xd9d3('0x2b')],this['handleReadUnseen'][_0xd9d3('0x10')](this));};EmailImap[_0xd9d3('0x15')][_0xd9d3('0x2c')]=function(_0x2277f9,_0x13a292){if(_0x2277f9){this[_0xd9d3('0x29')](_0x2277f9,!![]);}else{if(_0x13a292[_0xd9d3('0x2d')]){try{var _0xc2864a=this[_0xd9d3('0x2')][_0xd9d3('0x2e')](_0x13a292,{'bodies':'','markSeen':!![]});_0xc2864a['on']('message',this[_0xd9d3('0x2f')][_0xd9d3('0x10')](this));_0xc2864a[_0xd9d3('0x30')](_0xd9d3('0x13'),this['handleFetchError'][_0xd9d3('0x10')](this));_0xc2864a[_0xd9d3('0x30')](_0xd9d3('0x11'),this[_0xd9d3('0x31')][_0xd9d3('0x10')](this));}catch(_0x35c966){logger[_0xd9d3('0x13')](_0x35c966);}}else{this['imap'][_0xd9d3('0x32')](!![],this[_0xd9d3('0x33')][_0xd9d3('0x10')](this));}}};EmailImap[_0xd9d3('0x15')][_0xd9d3('0x2f')]=function(_0x320133){_0x320133['on'](_0xd9d3('0x34'),this[_0xd9d3('0x35')]['bind'](this));_0x320133[_0xd9d3('0x30')](_0xd9d3('0x36'),this[_0xd9d3('0x37')][_0xd9d3('0x10')](this));_0x320133[_0xd9d3('0x30')](_0xd9d3('0x11'),this[_0xd9d3('0x38')]['bind'](this));};EmailImap['prototype'][_0xd9d3('0x35')]=function(_0x2824b0){simpleParser(_0x2824b0,{'Iconv':Iconv},this[_0xd9d3('0x39')]['bind'](this));};EmailImap[_0xd9d3('0x15')]['handleMessageAttributes']=function(){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0xd9d3('0x15')][_0xd9d3('0x39')]=function(_0x536859,_0x114a2d){if(_0x536859){logger['error'](_0x536859);}else{var _0x5dc755=this;utils[_0xd9d3('0x3a')](this[_0xd9d3('0xc')],_0x114a2d,function(_0x514719){_0x5dc755['emit'](_0xd9d3('0xa'),_0x514719);});}};EmailImap[_0xd9d3('0x15')][_0xd9d3('0x31')]=function(){this[_0xd9d3('0x2')][_0xd9d3('0x32')](!![],this['handleCloseBox'][_0xd9d3('0x10')](this));};EmailImap[_0xd9d3('0x15')][_0xd9d3('0x3b')]=function(_0x4cf78c){this[_0xd9d3('0x29')](_0x4cf78c);this[_0xd9d3('0x2')][_0xd9d3('0x32')](!![],this[_0xd9d3('0x33')][_0xd9d3('0x10')](this));};EmailImap['prototype'][_0xd9d3('0x12')]=function(){this[_0xd9d3('0x26')](_0xd9d3('0x11'));};EmailImap[_0xd9d3('0x15')]['handleError']=function(_0x124eae,_0x196a82){logger[_0xd9d3('0x13')](_0xd9d3('0x29'),this['account'][_0xd9d3('0xa')],JSON[_0xd9d3('0x3c')](_0x124eae));var _0x21712f='';if(_0x124eae){if(_0x124eae[_0xd9d3('0x3d')]){_0x21712f=_0x124eae['textCode'];}else{for(var _0x416415 in _0x124eae){if(_0x124eae[_0xd9d3('0x3e')](_0x416415)){_0x21712f+=_[_0xd9d3('0x3f')](_0x416415)+':\x20'+_0x124eae[_0x416415]+'\x0a';}}}}if(_0x196a82){this[_0xd9d3('0x2')]['end']();}else{this[_0xd9d3('0x26')]('error',_0x21712f);this['emit'](_0xd9d3('0x11'));}};module[_0xd9d3('0x40')]=EmailImap; \ No newline at end of file +var _0x0e49=['handleReadUnseen','length','fetch','message','handleFetchError','handleFetchEnd','handleFetchMessage','body','handleMessageBody','attributes','handleMessageAttributes','handleSimpleParser','handleMessageEnd','parser','closeBox','stringify','textCode','hasOwnProperty','exports','lodash','util','imap','mailparser','iconv','Iconv','events','./utils','../../../config/logger','email','mailbox','account','getAccount','once','ready','handleReady','end','handleEnd','bind','error','handleError','connect','inherits','connTimeout','authTimeout','service','user','xoauth2','generateXOAuth2Token','CloudProvider','authentication','password','host','port','tls','autotls','prototype','openBox','handleOpenBox','emit','box','handleCloseBox','readUnseen','search','UNSEEN'];(function(_0x389b61,_0x47deec){var _0x3cb840=function(_0x29072a){while(--_0x29072a){_0x389b61['push'](_0x389b61['shift']());}};_0x3cb840(++_0x47deec);}(_0x0e49,0xd3));var _0x90e4=function(_0x52e94f,_0x22e52d){_0x52e94f=_0x52e94f-0x0;var _0x127d43=_0x0e49[_0x52e94f];return _0x127d43;};'use strict';var _=require(_0x90e4('0x0'));var util=require(_0x90e4('0x1'));var Imap=require(_0x90e4('0x2'));var simpleParser=require(_0x90e4('0x3'))['simpleParser'];var Iconv=require(_0x90e4('0x4'))[_0x90e4('0x5')];var EventEmitter=require(_0x90e4('0x6'))['EventEmitter'];var utils=require(_0x90e4('0x7'));var logger=require(_0x90e4('0x8'))(_0x90e4('0x9'));function EmailImap(_0x1b0f50,_0x3ef4fd){this[_0x90e4('0xa')]=_0x1b0f50['mailbox'];this[_0x90e4('0xb')]=this[_0x90e4('0xc')](_0x1b0f50,_0x3ef4fd);this[_0x90e4('0x2')]=new Imap(this[_0x90e4('0xb')]);this[_0x90e4('0x2')][_0x90e4('0xd')](_0x90e4('0xe'),this[_0x90e4('0xf')]['bind'](this));this[_0x90e4('0x2')][_0x90e4('0xd')](_0x90e4('0x10'),this[_0x90e4('0x11')][_0x90e4('0x12')](this));this[_0x90e4('0x2')]['on'](_0x90e4('0x13'),this[_0x90e4('0x14')][_0x90e4('0x12')](this));this[_0x90e4('0x2')][_0x90e4('0x15')]();}util[_0x90e4('0x16')](EmailImap,EventEmitter);EmailImap['prototype'][_0x90e4('0xc')]=function(_0x504248,_0x14d721){var _0x250ddc={'connTimeout':_0x504248[_0x90e4('0x17')]?_0x504248[_0x90e4('0x17')]*0x3e8:0x2710,'authTimeout':_0x504248[_0x90e4('0x18')]?_0x504248['authTimeout']*0x3e8:0x1388};if(_0x504248[_0x90e4('0x19')]){_0x250ddc[_0x90e4('0x1a')]=_0x504248['user'];if(_0x504248['modernAuthentication']){_0x250ddc[_0x90e4('0x1b')]=utils[_0x90e4('0x1c')](_0x504248[_0x90e4('0x1d')]['data5'],_0x504248['user']);}else{_0x250ddc['password']=_0x504248['password'];}}else{if(_0x504248[_0x90e4('0x1e')]){_0x250ddc[_0x90e4('0x1a')]=_0x504248[_0x90e4('0x1a')];_0x250ddc['password']=_0x504248[_0x90e4('0x1f')];}}_0x250ddc['email']=_0x14d721||_0x504248[_0x90e4('0x1a')]||'anonymous@xcally.com';_0x250ddc[_0x90e4('0x20')]=_0x504248[_0x90e4('0x20')];_0x250ddc[_0x90e4('0x21')]=_0x504248[_0x90e4('0x21')]||0x3e1;if(_0x504248[_0x90e4('0x22')]){_0x250ddc[_0x90e4('0x22')]=!![];}else{_0x250ddc[_0x90e4('0x22')]=![];_0x250ddc[_0x90e4('0x23')]='required';}return _0x250ddc;};EmailImap[_0x90e4('0x24')]['handleReady']=function(){this[_0x90e4('0x2')][_0x90e4('0x25')](this[_0x90e4('0xa')],![],this[_0x90e4('0x26')][_0x90e4('0x12')](this));};EmailImap['prototype'][_0x90e4('0x26')]=function(_0x4df622,_0x34be0d){if(_0x4df622){this['handleError'](_0x4df622,!![]);}else{this[_0x90e4('0x27')](_0x90e4('0x28'),_0x34be0d);this['readUnseen']();}};EmailImap[_0x90e4('0x24')][_0x90e4('0x29')]=function(_0x532a56){if(_0x532a56){this[_0x90e4('0x14')](_0x532a56,!![]);}else{this[_0x90e4('0x2')][_0x90e4('0x10')]();}};EmailImap[_0x90e4('0x24')][_0x90e4('0x2a')]=function(){this[_0x90e4('0x2')][_0x90e4('0x2b')]([_0x90e4('0x2c')],this[_0x90e4('0x2d')][_0x90e4('0x12')](this));};EmailImap[_0x90e4('0x24')][_0x90e4('0x2d')]=function(_0x9cfd83,_0x490682){if(_0x9cfd83){this[_0x90e4('0x14')](_0x9cfd83,!![]);}else{if(_0x490682[_0x90e4('0x2e')]){try{var _0x4065d5=this[_0x90e4('0x2')][_0x90e4('0x2f')](_0x490682,{'bodies':'','markSeen':!![]});_0x4065d5['on'](_0x90e4('0x30'),this['handleFetchMessage'][_0x90e4('0x12')](this));_0x4065d5[_0x90e4('0xd')](_0x90e4('0x13'),this[_0x90e4('0x31')][_0x90e4('0x12')](this));_0x4065d5[_0x90e4('0xd')](_0x90e4('0x10'),this[_0x90e4('0x32')]['bind'](this));}catch(_0x5d26cf){logger[_0x90e4('0x13')](_0x5d26cf);}}else{this[_0x90e4('0x2')]['closeBox'](!![],this['handleCloseBox'][_0x90e4('0x12')](this));}}};EmailImap['prototype'][_0x90e4('0x33')]=function(_0x804b04){_0x804b04['on'](_0x90e4('0x34'),this[_0x90e4('0x35')]['bind'](this));_0x804b04[_0x90e4('0xd')](_0x90e4('0x36'),this[_0x90e4('0x37')][_0x90e4('0x12')](this));_0x804b04[_0x90e4('0xd')](_0x90e4('0x10'),this['handleMessageEnd'][_0x90e4('0x12')](this));};EmailImap[_0x90e4('0x24')]['handleMessageBody']=function(_0x4dba20){simpleParser(_0x4dba20,{'Iconv':Iconv},this[_0x90e4('0x38')]['bind'](this));};EmailImap['prototype']['handleMessageAttributes']=function(){};EmailImap[_0x90e4('0x24')][_0x90e4('0x39')]=function(){};EmailImap['prototype'][_0x90e4('0x38')]=function(_0x5aeacf,_0x5281ec){if(_0x5aeacf){logger[_0x90e4('0x13')](_0x5aeacf);}else{var _0x14c55e=this;utils[_0x90e4('0x3a')](this[_0x90e4('0xb')],_0x5281ec,function(_0x391d75){_0x14c55e['emit']('email',_0x391d75);});}};EmailImap[_0x90e4('0x24')][_0x90e4('0x32')]=function(){this[_0x90e4('0x2')][_0x90e4('0x3b')](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0x90e4('0x24')][_0x90e4('0x31')]=function(_0x46d49c){this[_0x90e4('0x14')](_0x46d49c);this[_0x90e4('0x2')][_0x90e4('0x3b')](!![],this['handleCloseBox'][_0x90e4('0x12')](this));};EmailImap[_0x90e4('0x24')][_0x90e4('0x11')]=function(){this[_0x90e4('0x27')](_0x90e4('0x10'));};EmailImap[_0x90e4('0x24')][_0x90e4('0x14')]=function(_0x33cab0,_0x1a0d29){logger[_0x90e4('0x13')](_0x90e4('0x14'),this[_0x90e4('0xb')][_0x90e4('0x9')],JSON[_0x90e4('0x3c')](_0x33cab0));var _0x487052='';if(_0x33cab0){if(_0x33cab0['textCode']){_0x487052=_0x33cab0[_0x90e4('0x3d')];}else{for(var _0x1b972b in _0x33cab0){if(_0x33cab0[_0x90e4('0x3e')](_0x1b972b)){_0x487052+=_['upperFirst'](_0x1b972b)+':\x20'+_0x33cab0[_0x1b972b]+'\x0a';}}}}if(_0x1a0d29){this[_0x90e4('0x2')]['end']();}else{this[_0x90e4('0x27')]('error',_0x487052);this[_0x90e4('0x27')]('end');}};module[_0x90e4('0x3f')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index cb65b3a..b84be4c 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 _0x313d=['send','createTransport','use','compile','sendMail','toString','verify','Not\x20verifired','nodemailer','nodemailer-plugin-inline-base64','prototype'];(function(_0x1ca184,_0xc473bf){var _0x54496d=function(_0x3a44a0){while(--_0x3a44a0){_0x1ca184['push'](_0x1ca184['shift']());}};_0x54496d(++_0xc473bf);}(_0x313d,0x1aa));var _0xd313=function(_0x2ce000,_0x46fa33){_0x2ce000=_0x2ce000-0x0;var _0x231515=_0x313d[_0x2ce000];return _0x231515;};'use strict';var nodemailer=require(_0xd313('0x0'));var inlineBase64=require(_0xd313('0x1'));function EmailSmtp(){}EmailSmtp[_0xd313('0x2')][_0xd313('0x3')]=function(_0x3621ef,_0x3b3e28){return new Promise(function(_0x22a18c,_0xd2ac65){var _0x399099=nodemailer[_0xd313('0x4')](_0x3621ef);_0x399099[_0xd313('0x5')](_0xd313('0x6'),inlineBase64());_0x399099[_0xd313('0x7')](_0x3b3e28,function(_0x520475,_0x28391b){if(_0x520475){_0xd2ac65(_0x520475[_0xd313('0x8')]());}else{_0x22a18c(_0x28391b);}});});};EmailSmtp[_0xd313('0x2')][_0xd313('0x9')]=function(_0x977ab3){return new Promise(function(_0x15d7a3,_0x5ead01){var _0x34a999=nodemailer[_0xd313('0x4')](_0x977ab3);_0x34a999['verify'](function(_0x15e60c,_0x31cabb){if(_0x15e60c){_0x5ead01(_0x15e60c['toString']());}else{if(_0x31cabb){_0x15d7a3(_0x31cabb);}else{_0x5ead01(_0xd313('0xa'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x15b3=['send','createTransport','compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','prototype'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x15b3,0xf8));var _0x315b=function(_0x5cb519,_0x1da9ce){_0x5cb519=_0x5cb519-0x0;var _0x4ef061=_0x15b3[_0x5cb519];return _0x4ef061;};'use strict';var nodemailer=require(_0x315b('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x315b('0x1')][_0x315b('0x2')]=function(_0xf1e51d,_0x34f01b){return new Promise(function(_0x2c33ee,_0x405659){var _0x53d522=nodemailer[_0x315b('0x3')](_0xf1e51d);_0x53d522['use'](_0x315b('0x4'),inlineBase64());_0x53d522[_0x315b('0x5')](_0x34f01b,function(_0x5cebce,_0x300e59){if(_0x5cebce){_0x405659(_0x5cebce[_0x315b('0x6')]());}else{_0x2c33ee(_0x300e59);}});});};EmailSmtp[_0x315b('0x1')][_0x315b('0x7')]=function(_0x5d36c1){return new Promise(function(_0x47a4ca,_0x248871){var _0x867fcc=nodemailer[_0x315b('0x3')](_0x5d36c1);_0x867fcc[_0x315b('0x7')](function(_0x1debe0,_0x2c3ed2){if(_0x1debe0){_0x248871(_0x1debe0['toString']());}else{if(_0x2c3ed2){_0x47a4ca(_0x2c3ed2);}else{_0x248871(_0x315b('0x8'));}}});});};module[_0x315b('0x9')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 3a7fe2a..778b7b2 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 _0x99c4=['writeFileSync','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','line','isAutoreply','parser','from','subject','messageId','inReplyTo','date','textAsHtml','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','toString','lodash','moment','randomstring','path','util','../../../config/environment','head','address','anonymous','@xcally.com','value','name','substring','indexOf','split','length','slice','join','Anonymous','pop','isEmpty','generate','test','html','replace','includes','forEach','push','_SRC','_IMG','\x20[Attachment:\x20','\x20]','body','message','originCc','email','originTo','bcc','attachments','attach','type','attachment','filename','attachment-','format','%s-%s','now','root','server/files/attachments/'];(function(_0x5c5068,_0x5b93a1){var _0x428f68=function(_0x280e08){while(--_0x280e08){_0x5c5068['push'](_0x5c5068['shift']());}};_0x428f68(++_0x5b93a1);}(_0x99c4,0xb6));var _0x499c=function(_0x4b51d2,_0xc53e29){_0x4b51d2=_0x4b51d2-0x0;var _0x874c1=_0x99c4[_0x4b51d2];return _0x874c1;};'use strict';var _=require(_0x499c('0x0'));var moment=require(_0x499c('0x1'));var random=require(_0x499c('0x2'));var fs=require('fs');var path=require(_0x499c('0x3'));var util=require(_0x499c('0x4'));var tnef=require('node-tnef');var logger=require('../../../config/logger')('email');var config=require(_0x499c('0x5'));function getAddress(_0x294f92){var _0x2ff374=_[_0x499c('0x6')](_0x294f92['value']);return _0x2ff374&&_0x2ff374[_0x499c('0x7')]?_0x2ff374[_0x499c('0x7')]:_0x499c('0x8')+random['generate'](0x6)+_0x499c('0x9');}function getFirstName(_0x56b94d){var _0x5073a8=_[_0x499c('0x6')](_0x56b94d[_0x499c('0xa')]);if(_0x5073a8&&_0x5073a8['name']){if(_0x5073a8[_0x499c('0xb')]==_0x5073a8[_0x499c('0x7')]){return _0x5073a8[_0x499c('0xb')][_0x499c('0xc')](0x0,_0x5073a8['name'][_0x499c('0xd')]('@'));}var _0x3d55cf=_0x5073a8[_0x499c('0xb')][_0x499c('0xe')](/\s+/);return _0x3d55cf[_0x499c('0xf')]>0x1?_0x3d55cf[_0x499c('0x10')](0x0,-0x1)[_0x499c('0x11')]('\x20'):_0x5073a8['name'];}return _0x499c('0x12');}function getLastName(_0x5a885e){var _0x183960=_[_0x499c('0x6')](_0x5a885e['value']);if(_0x183960&&_0x183960[_0x499c('0xb')]){var _0x442092=_0x183960[_0x499c('0xb')]['split'](/\s+/);return _0x442092['length']>0x1?_0x442092[_0x499c('0x13')]():'';}return'';}function getMails(_0x3956f7,_0x4dcecc){var _0x138656='';for(var _0x1ebeab=0x0;_0x1ebeab<_0x4dcecc['value'][_0x499c('0xf')];_0x1ebeab+=0x1){if(_0x4dcecc['value'][_0x1ebeab]['address']!==_0x3956f7){if(!_[_0x499c('0x14')](_0x138656)){_0x138656+=',';}_0x138656+=_0x4dcecc[_0x499c('0xa')][_0x1ebeab][_0x499c('0xb')]||_0x4dcecc[_0x499c('0xa')][_0x1ebeab]['address']||'';_0x138656+='\x20<';_0x138656+=_0x4dcecc['value'][_0x1ebeab][_0x499c('0x7')]?_0x4dcecc[_0x499c('0xa')][_0x1ebeab][_0x499c('0x7')]:_0x499c('0x8')+random[_0x499c('0x15')](0x6)+_0x499c('0x9');_0x138656+='>';}}return _0x138656;}function parseEmail(_0x242ba6,_0x2369a7,_0x54ed7d){if(_0x2369a7['html']){var _0x22a353=/)<[^<]*)*<\/script>/gi;while(_0x22a353[_0x499c('0x16')](_0x2369a7[_0x499c('0x17')])){_0x2369a7[_0x499c('0x17')]=_0x2369a7[_0x499c('0x17')][_0x499c('0x18')](_0x22a353,'');}if(_0x2369a7[_0x499c('0x17')][_0x499c('0x19')]('{_0x8bb28a[_0x499c('0x1b')](_0x5b9c6c['filename']);});var _0x245ca9=/]+>/g;var _0x499ec8=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x2bfe6d=_0x2369a7[_0x499c('0x17')][_0x499c('0x18')](_0x499ec8,_0x499c('0x1c'));var _0x2d81bd=_0x2bfe6d[_0x499c('0x18')](_0x245ca9,_0x499c('0x1d'));for(let _0x197485=0x0;_0x197485<_0x8bb28a[_0x499c('0xf')];_0x197485++){var _0x2e87ac=_0x2d81bd['replace'](_0x499c('0x1d'),_0x499c('0x1e')+_0x8bb28a[_0x197485]+_0x499c('0x1f'));_0x2d81bd=_0x2e87ac;}_0x2369a7[_0x499c('0x17')]=_0x2d81bd;}_0x54ed7d[_0x499c('0x20')]=_0x2369a7[_0x499c('0x17')];}else{_0x54ed7d[_0x499c('0x20')]=_0x2369a7['textAsHtml'];}if(_0x54ed7d['body']){_0x54ed7d['body']=_0x54ed7d[_0x499c('0x20')][_0x499c('0x18')](/0x0){var _0x18c195=[_0x499c('0x34'),_0x499c('0x35'),_0x499c('0x36')];for(var _0x548fd8=0x0;_0x548fd8<_0x2369a7['headerLines'][_0x499c('0xf')];_0x548fd8++){var _0x4da5b3=_['indexOf'](_0x18c195,_0x2369a7['headerLines'][_0x548fd8][_0x499c('0x37')]);if(_0x4da5b3>=0x0){_0x54ed7d[_0x499c('0x38')]=!![];}}}return _0x54ed7d;}exports[_0x499c('0x39')]=function(_0x577c7a,_0x2c772,_0x9c5e3e){var _0x40449f={'from':getAddress(_0x2c772[_0x499c('0x3a')]),'firstName':getFirstName(_0x2c772[_0x499c('0x3a')]),'lastName':getLastName(_0x2c772[_0x499c('0x3a')]),'mapKey':'email','message':{'from':getMails(_0x577c7a[_0x499c('0x23')],_0x2c772[_0x499c('0x3a')]),'to':_0x577c7a['email'],'cc':'','subject':_0x2c772[_0x499c('0x3b')]||'','messageId':_0x2c772[_0x499c('0x3c')],'inReplyTo':_0x2c772[_0x499c('0x3d')],'sentAt':moment(_0x2c772[_0x499c('0x3e')])[_0x499c('0x2c')]('YYYY-MM-DD\x20HH:mm:ss'),'attach':![],'attachments':[]}};if(!_0x2c772[_0x499c('0x17')]&&!_0x2c772[_0x499c('0x3f')]){var _0x1337c7=_['filter'](_0x2c772[_0x499c('0x26')],{'contentType':'application/ms-tnef'});if(_0x1337c7['length']){logger['info'](util[_0x499c('0x2c')](_0x499c('0x40'),_0x2c772[_0x499c('0x3c')]));tnef[_0x499c('0x41')](_[_0x499c('0x42')](_0x1337c7)['content'],function(_0x1bfd64,_0x53473a){if(_0x53473a){_0x2c772[_0x499c('0x17')]=_0x53473a[_0x499c('0x43')]||_0x499c('0x44');if(_0x53473a[_0x499c('0x45')]){for(var _0xecc6b4=0x0;_0xecc6b4<_0x53473a['Attachments']['length'];_0xecc6b4++){var _0x4b931e=_0x53473a['Attachments'][_0xecc6b4];_0x40449f[_0x499c('0x21')][_0x499c('0x26')]['push']({'filename':_0x4b931e[_0x499c('0x46')],'content':Buffer[_0x499c('0x3a')](_0x4b931e[_0x499c('0x47')])});}}}_0x9c5e3e(parseEmail(_0x577c7a,_0x2c772,_0x40449f));});}else{_0x2c772[_0x499c('0x17')]=_0x499c('0x44');_0x9c5e3e(parseEmail(_0x577c7a,_0x2c772,_0x40449f));}}else{_0x9c5e3e(parseEmail(_0x577c7a,_0x2c772,_0x40449f));}};exports[_0x499c('0x48')]=function(_0x12ef34,_0x5c8174){var _0x472e01=[_0x499c('0x49')+(_0x5c8174||''),_0x499c('0x4a')+_0x12ef34,'',''];return Buffer['from'](_0x472e01['join'](''),_0x499c('0x4b'))[_0x499c('0x4c')]('base64');}; \ No newline at end of file +var _0xa440=['message','originCc','originTo','bcc','attachments','attach','type','attachment','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','content','push','contentType','headerLines','Auto-Submitted:\x20auto-replied','X-Auto-Response-Suppress:\x20All','Precedence:\x20auto_reply','indexOf','line','isAutoreply','parser','from','subject','messageId','date','YYYY-MM-DD\x20HH:mm:ss','textAsHtml','filter','application/ms-tnef','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','first','

Empty\x20message

','Attachments','Title','Data','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','base64','lodash','moment','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','@xcally.com','name','substring','split','length','slice','join','Anonymous','pop','isEmpty','html','test','includes','\x20[Attachment:\x20','body','0x1?_0x2d9450[_0x0a44('0x12')](0x0,-0x1)[_0x0a44('0x13')]('\x20'):_0x52d9a3[_0x0a44('0xe')];}return _0x0a44('0x14');}function getLastName(_0x3514c8){var _0x4d29f3=_[_0x0a44('0x8')](_0x3514c8[_0x0a44('0x9')]);if(_0x4d29f3&&_0x4d29f3['name']){var _0x131350=_0x4d29f3[_0x0a44('0xe')][_0x0a44('0x10')](/\s+/);return _0x131350[_0x0a44('0x11')]>0x1?_0x131350[_0x0a44('0x15')]():'';}return'';}function getMails(_0x2ecb1a,_0x2c631a){var _0x598ebb='';for(var _0x535360=0x0;_0x535360<_0x2c631a[_0x0a44('0x9')]['length'];_0x535360+=0x1){if(_0x2c631a[_0x0a44('0x9')][_0x535360]['address']!==_0x2ecb1a){if(!_[_0x0a44('0x16')](_0x598ebb)){_0x598ebb+=',';}_0x598ebb+=_0x2c631a[_0x0a44('0x9')][_0x535360][_0x0a44('0xe')]||_0x2c631a[_0x0a44('0x9')][_0x535360][_0x0a44('0xa')]||'';_0x598ebb+='\x20<';_0x598ebb+=_0x2c631a['value'][_0x535360][_0x0a44('0xa')]?_0x2c631a['value'][_0x535360][_0x0a44('0xa')]:'anonymous'+random[_0x0a44('0xc')](0x6)+_0x0a44('0xd');_0x598ebb+='>';}}return _0x598ebb;}function parseEmail(_0x18a9ee,_0x476461,_0x44c9b7){if(_0x476461[_0x0a44('0x17')]){var _0x243ae7=/)<[^<]*)*<\/script>/gi;while(_0x243ae7[_0x0a44('0x18')](_0x476461[_0x0a44('0x17')])){_0x476461['html']=_0x476461['html']['replace'](_0x243ae7,'');}if(_0x476461['html'][_0x0a44('0x19')](_0x0a44('0x1a'))){var _0x300141=[];_0x476461['attachments']['forEach'](_0x272f97=>{_0x300141['push'](_0x272f97['filename']);});var _0x42d0f9=/]+>/g;var _0x2c6a44=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x5a8cab=_0x476461[_0x0a44('0x17')][_0x0a44('0x1b')](_0x2c6a44,_0x0a44('0x1c'));var _0x3e9bd4=_0x5a8cab[_0x0a44('0x1b')](_0x42d0f9,_0x0a44('0x1d'));for(let _0xdf29f5=0x0;_0xdf29f5<_0x300141[_0x0a44('0x11')];_0xdf29f5++){var _0x305266=_0x3e9bd4[_0x0a44('0x1b')](_0x0a44('0x1d'),_0x0a44('0x1e')+_0x300141[_0xdf29f5]+'\x20]');_0x3e9bd4=_0x305266;}_0x476461[_0x0a44('0x17')]=_0x3e9bd4;}_0x44c9b7[_0x0a44('0x1f')]=_0x476461[_0x0a44('0x17')];}else{_0x44c9b7[_0x0a44('0x1f')]=_0x476461['textAsHtml'];}if(_0x44c9b7[_0x0a44('0x1f')]){_0x44c9b7[_0x0a44('0x1f')]=_0x44c9b7[_0x0a44('0x1f')][_0x0a44('0x1b')](/0x0){var _0x4da90b=[_0x0a44('0x34'),_0x0a44('0x35'),_0x0a44('0x36')];for(var _0x85004=0x0;_0x85004<_0x476461['headerLines']['length'];_0x85004++){var _0x51023a=_[_0x0a44('0x37')](_0x4da90b,_0x476461[_0x0a44('0x33')][_0x85004][_0x0a44('0x38')]);if(_0x51023a>=0x0){_0x44c9b7[_0x0a44('0x39')]=!![];}}}return _0x44c9b7;}exports[_0x0a44('0x3a')]=function(_0x184670,_0x4a2e14,_0x51ceb0){var _0x3032e3={'from':getAddress(_0x4a2e14[_0x0a44('0x3b')]),'firstName':getFirstName(_0x4a2e14['from']),'lastName':getLastName(_0x4a2e14[_0x0a44('0x3b')]),'mapKey':_0x0a44('0x6'),'message':{'from':getMails(_0x184670[_0x0a44('0x6')],_0x4a2e14[_0x0a44('0x3b')]),'to':_0x184670[_0x0a44('0x6')],'cc':'','subject':_0x4a2e14[_0x0a44('0x3c')]||'','messageId':_0x4a2e14[_0x0a44('0x3d')],'inReplyTo':_0x4a2e14['inReplyTo'],'sentAt':moment(_0x4a2e14[_0x0a44('0x3e')])[_0x0a44('0x2a')](_0x0a44('0x3f')),'attach':![],'attachments':[]}};if(!_0x4a2e14[_0x0a44('0x17')]&&!_0x4a2e14[_0x0a44('0x40')]){var _0x2d3fd=_[_0x0a44('0x41')](_0x4a2e14['attachments'],{'contentType':_0x0a44('0x42')});if(_0x2d3fd[_0x0a44('0x11')]){logger['info'](util[_0x0a44('0x2a')](_0x0a44('0x43'),_0x4a2e14[_0x0a44('0x3d')]));tnef['parseBuffer'](_[_0x0a44('0x44')](_0x2d3fd)[_0x0a44('0x30')],function(_0x32a075,_0x2d2bbe){if(_0x2d2bbe){_0x4a2e14[_0x0a44('0x17')]=_0x2d2bbe['BodyHTML']||_0x0a44('0x45');if(_0x2d2bbe[_0x0a44('0x46')]){for(var _0x2a640c=0x0;_0x2a640c<_0x2d2bbe[_0x0a44('0x46')]['length'];_0x2a640c++){var _0x327a55=_0x2d2bbe[_0x0a44('0x46')][_0x2a640c];_0x3032e3[_0x0a44('0x21')][_0x0a44('0x25')][_0x0a44('0x31')]({'filename':_0x327a55[_0x0a44('0x47')],'content':Buffer[_0x0a44('0x3b')](_0x327a55[_0x0a44('0x48')])});}}}_0x51ceb0(parseEmail(_0x184670,_0x4a2e14,_0x3032e3));});}else{_0x4a2e14[_0x0a44('0x17')]=_0x0a44('0x45');_0x51ceb0(parseEmail(_0x184670,_0x4a2e14,_0x3032e3));}}else{_0x51ceb0(parseEmail(_0x184670,_0x4a2e14,_0x3032e3));}};exports[_0x0a44('0x49')]=function(_0x7b16a2,_0x2de91a){var _0x19ccba=['user='+(_0x2de91a||''),_0x0a44('0x4a')+_0x7b16a2,'',''];return Buffer[_0x0a44('0x3b')](_0x19ccba[_0x0a44('0x13')](''),_0x0a44('0x4b'))[_0x0a44('0x4c')](_0x0a44('0x4d'));}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 703b237..b8506fc 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 _0x89a2=['active','Smtp','exports','lodash','Service','key','SERV'];(function(_0x141e03,_0x18340e){var _0x2074e3=function(_0x2b7ece){while(--_0x2b7ece){_0x141e03['push'](_0x141e03['shift']());}};_0x2074e3(++_0x18340e);}(_0x89a2,0x192));var _0x289a=function(_0x46f62c,_0x49eb41){_0x46f62c=_0x46f62c-0x0;var _0x46d994=_0x89a2[_0x46f62c];return _0x46d994;};'use strict';var _=require(_0x289a('0x0'));function MailAccount(_0x195f6d){this['id']=_0x195f6d['id']||0x0;this['name']=_0x195f6d['name']||_0x289a('0x1');this[_0x289a('0x2')]=_0x195f6d['key']||_0x289a('0x3');this[_0x289a('0x4')]=_0x195f6d[_0x289a('0x4')]||![];this['Imap']=_0x195f6d['Imap']||[];this[_0x289a('0x5')]=_0x195f6d[_0x289a('0x5')]||[];}module[_0x289a('0x6')]=MailAccount; \ No newline at end of file +var _0x0c88=['active','Imap','Smtp','Service','key','SERV'];(function(_0x4ceb3b,_0x5f474c){var _0x513705=function(_0x21bef8){while(--_0x21bef8){_0x4ceb3b['push'](_0x4ceb3b['shift']());}};_0x513705(++_0x5f474c);}(_0x0c88,0x81));var _0x80c8=function(_0x14a513,_0x3239f){_0x14a513=_0x14a513-0x0;var _0x47236c=_0x0c88[_0x14a513];return _0x47236c;};'use strict';var _=require('lodash');function MailAccount(_0x135b94){this['id']=_0x135b94['id']||0x0;this['name']=_0x135b94['name']||_0x80c8('0x0');this[_0x80c8('0x1')]=_0x135b94[_0x80c8('0x1')]||_0x80c8('0x2');this[_0x80c8('0x3')]=_0x135b94[_0x80c8('0x3')]||![];this[_0x80c8('0x4')]=_0x135b94[_0x80c8('0x4')]||[];this['Smtp']=_0x135b94[_0x80c8('0x5')]||[];}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 2730172..2ecc410 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 _0x93cf=['exports','lodash','../model/mailAccount','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','mailAccounts','length','merge'];(function(_0x2be004,_0x7393c3){var _0x1722ea=function(_0x5642f9){while(--_0x5642f9){_0x2be004['push'](_0x2be004['shift']());}};_0x1722ea(++_0x7393c3);}(_0x93cf,0xfe));var _0xf93c=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x93cf[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xf93c('0x0'));var MailAccount=require(_0xf93c('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x5f4fc5,_0xe6450c,_0x214708){var _0x42b349=_[_0xf93c('0x2')](_0x5f4fc5,function(_0x20d76f,_0x59376f){return _0x20d76f[_0x214708];});for(var _0x5f4936 in _0xe6450c){if(_0xe6450c[_0xf93c('0x3')](_0x5f4936)){if(!_0x42b349[_0x5f4936]){delete _0xe6450c[_0x5f4936];}}}}Realtime[_0xf93c('0x4')][_0xf93c('0x5')]=function(_0x406253,_0x408fb9){for(var _0x55a7f7 in _0x408fb9){if(_0x406253[_0xf93c('0x3')](_0x55a7f7)){_0x406253[_0x55a7f7]=_0x408fb9[_0x55a7f7];}}};Realtime[_0xf93c('0x4')][_0xf93c('0x6')]=function(){var _0x3c59ca=this;return function(_0x510db6){if(_0x510db6){freeIsNotKey(_0x510db6,_0x3c59ca[_0xf93c('0x7')],'id');for(var _0x569688=0x0,_0x52be65={},_0x10d3fd={};_0x569688<_0x510db6[_0xf93c('0x8')];_0x569688+=0x1){_0x52be65=_0x510db6[_0x569688];if(_['isUndefined'](_0x3c59ca[_0xf93c('0x7')][_0x52be65['id']])){_0x3c59ca[_0xf93c('0x7')][_0x52be65['id']]=new MailAccount(_0x52be65);}else{_[_0xf93c('0x9')](_0x3c59ca[_0xf93c('0x7')][_0x52be65['id']],_0x52be65);}}}return _0x3c59ca[_0xf93c('0x7')];};};module[_0xf93c('0xa')]=Realtime; \ No newline at end of file +var _0x660c=['lodash','../model/mailAccount','hasOwnProperty','mailAccounts','isUndefined','merge','exports'];(function(_0x310a1b,_0x4c9129){var _0xdea206=function(_0x1f1e8d){while(--_0x1f1e8d){_0x310a1b['push'](_0x310a1b['shift']());}};_0xdea206(++_0x4c9129);}(_0x660c,0x150));var _0xc660=function(_0x424db8,_0x53f4f8){_0x424db8=_0x424db8-0x0;var _0x14e049=_0x660c[_0x424db8];return _0x14e049;};'use strict';var _=require(_0xc660('0x0'));var MailAccount=require(_0xc660('0x1'));var Realtime=function(){this['mailAccounts']={};};function freeIsNotKey(_0x504a3c,_0xfeaab5,_0x45905a){var _0x11981d=_['mapKeys'](_0x504a3c,function(_0x4e633d,_0x412792){return _0x4e633d[_0x45905a];});for(var _0x564f35 in _0xfeaab5){if(_0xfeaab5['hasOwnProperty'](_0x564f35)){if(!_0x11981d[_0x564f35]){delete _0xfeaab5[_0x564f35];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x424d61,_0x549c9d){for(var _0x512941 in _0x549c9d){if(_0x424d61[_0xc660('0x2')](_0x512941)){_0x424d61[_0x512941]=_0x549c9d[_0x512941];}}};Realtime['prototype']['initMailAccounts']=function(){var _0x1cc4b2=this;return function(_0xcd2cf9){if(_0xcd2cf9){freeIsNotKey(_0xcd2cf9,_0x1cc4b2[_0xc660('0x3')],'id');for(var _0x40c405=0x0,_0x5273e8={},_0x5b238a={};_0x40c405<_0xcd2cf9['length'];_0x40c405+=0x1){_0x5273e8=_0xcd2cf9[_0x40c405];if(_[_0xc660('0x4')](_0x1cc4b2[_0xc660('0x3')][_0x5273e8['id']])){_0x1cc4b2[_0xc660('0x3')][_0x5273e8['id']]=new MailAccount(_0x5273e8);}else{_[_0xc660('0x5')](_0x1cc4b2[_0xc660('0x3')][_0x5273e8['id']],_0x5273e8);}}}return _0x1cc4b2[_0xc660('0x3')];};};module[_0xc660('0x6')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 42629f8..d394f62 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 _0x01a2=['Request','GetMailAccount','name','provider','active','key','ListId','TemplateId','MailServerIn','Imap','CloudProvider','service','type','data5','MailServerOut','Smtp','getMailAccount','notify','NotifyMailAccount','getMailAccounts'];(function(_0x243d3f,_0x3f4817){var _0x573194=function(_0x7e619){while(--_0x7e619){_0x243d3f['push'](_0x243d3f['shift']());}};_0x573194(++_0x3f4817);}(_0x01a2,0x1cb));var _0x201a=function(_0x32abd6,_0x3ce007){_0x32abd6=_0x32abd6-0x0;var _0xf47cde=_0x01a2[_0x32abd6];return _0xf47cde;};'use strict';var client=require('../client');exports[_0x201a('0x0')]=function(){return function(){return client[_0x201a('0x1')](_0x201a('0x2'),{'options':{'attributes':['id',_0x201a('0x3'),_0x201a('0x4'),'service','email',_0x201a('0x5'),_0x201a('0x6'),_0x201a('0x7'),_0x201a('0x8')],'raw':![],'include':[{'model':_0x201a('0x9'),'as':_0x201a('0xa'),'include':[{'model':_0x201a('0xb'),'attributes':['id',_0x201a('0x3'),_0x201a('0xc'),_0x201a('0xd'),_0x201a('0xe')],'as':_0x201a('0xb')}]},{'model':_0x201a('0xf'),'as':_0x201a('0x10'),'include':[{'model':_0x201a('0xb'),'attributes':['id','name',_0x201a('0xc'),_0x201a('0xd'),'data5'],'as':'CloudProvider'}]}]},'log':_0x201a('0x11')});};};exports[_0x201a('0x12')]=function(_0x54eb34,_0x233c63){return client[_0x201a('0x1')](_0x201a('0x13'),{'account':{'id':_0x54eb34},'body':_0x233c63,'log':_0x201a('0x13')});}; \ No newline at end of file +var _0x3914=['name','service','email','active','ListId','TemplateId','Imap','type','data5','Smtp','CloudProvider','getMailAccount','Request','NotifyMailAccount','../client','getMailAccounts','GetMailAccount'];(function(_0x476874,_0x105888){var _0x42c9aa=function(_0x123cbe){while(--_0x123cbe){_0x476874['push'](_0x476874['shift']());}};_0x42c9aa(++_0x105888);}(_0x3914,0xeb));var _0x4391=function(_0x3e69ae,_0x366e8d){_0x3e69ae=_0x3e69ae-0x0;var _0x3d7f42=_0x3914[_0x3e69ae];return _0x3d7f42;};'use strict';var client=require(_0x4391('0x0'));exports[_0x4391('0x1')]=function(){return function(){return client['Request'](_0x4391('0x2'),{'options':{'attributes':['id',_0x4391('0x3'),'provider',_0x4391('0x4'),_0x4391('0x5'),_0x4391('0x6'),'key',_0x4391('0x7'),_0x4391('0x8')],'raw':![],'include':[{'model':'MailServerIn','as':_0x4391('0x9'),'include':[{'model':'CloudProvider','attributes':['id',_0x4391('0x3'),'service',_0x4391('0xa'),_0x4391('0xb')],'as':'CloudProvider'}]},{'model':'MailServerOut','as':_0x4391('0xc'),'include':[{'model':_0x4391('0xd'),'attributes':['id',_0x4391('0x3'),'service',_0x4391('0xa'),_0x4391('0xb')],'as':_0x4391('0xd')}]}]},'log':_0x4391('0xe')});};};exports['notify']=function(_0x144ce3,_0x1e3786){return client[_0x4391('0xf')](_0x4391('0x10'),{'account':{'id':_0x144ce3},'body':_0x1e3786,'log':_0x4391('0x10')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 8f8e657..d92fecf 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 _0xc191=['getSettings','Request','ShowSetting','GetSettings','../client'];(function(_0x29f121,_0x424438){var _0x1066fc=function(_0x258af9){while(--_0x258af9){_0x29f121['push'](_0x29f121['shift']());}};_0x1066fc(++_0x424438);}(_0xc191,0xef));var _0x1c19=function(_0x3e6729,_0x16d4af){_0x3e6729=_0x3e6729-0x0;var _0x535bcd=_0xc191[_0x3e6729];return _0x535bcd;};'use strict';var client=require(_0x1c19('0x0'));exports[_0x1c19('0x1')]=function(){return client[_0x1c19('0x2')](_0x1c19('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x1c19('0x4')});}; \ No newline at end of file +var _0x70bb=['../client','getSettings','Request','ShowSetting','GetSettings'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x70bb,0xcd));var _0xb70b=function(_0x2d2498,_0x26426d){_0x2d2498=_0x2d2498-0x0;var _0x447a5b=_0x70bb[_0x2d2498];return _0x447a5b;};'use strict';var client=require(_0xb70b('0x0'));exports[_0xb70b('0x1')]=function(){return client[_0xb70b('0x2')](_0xb70b('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xb70b('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index 62f951f..8e82f63 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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'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(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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 3d46a60..c10699f 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 _0x0220=['socket.io','websocket','polling','redis','adapter','socket.io-redis','../../config/triggers','default','../../config/socketio','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','sticky-session','ioredis','../../config/environment','createServer','port'];(function(_0x84b9eb,_0x4a62ca){var _0x4b8adb=function(_0x1a7bda){while(--_0x1a7bda){_0x84b9eb['push'](_0x84b9eb['shift']());}};_0x4b8adb(++_0x4a62ca);}(_0x0220,0xb9));var _0x0022=function(_0x5c4b6a,_0x3e4163){_0x5c4b6a=_0x5c4b6a-0x0;var _0x2dec05=_0x0220[_0x5c4b6a];return _0x2dec05;};'use strict';var _=require('lodash');var http=require('http');var express=require('express');var sticky=require(_0x0022('0x0'));var Redis=require(_0x0022('0x1'));var config=require(_0x0022('0x2'));var app=express();var server=http[_0x0022('0x3')](app);server['timeout']=0xdbba0;if(sticky['listen'](server,config[_0x0022('0x4')])){var socketio=require(_0x0022('0x5'))(server,{'transports':[_0x0022('0x6'),_0x0022('0x7')]});config[_0x0022('0x8')]=_['defaults'](config[_0x0022('0x8')],{'host':'localhost','port':0x18eb});socketio[_0x0022('0x9')](require(_0x0022('0xa'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x0022('0x8')])}));require(_0x0022('0xb'))[_0x0022('0xc')]();require(_0x0022('0xd'))[_0x0022('0xc')](socketio);require('../../config/express')[_0x0022('0xc')](app);require('../../routes')['default'](app);}else{server[_0x0022('0xe')](_0x0022('0xf'),function(){console[_0x0022('0x10')](_0x0022('0x11'),config['port']);});}exports=module[_0x0022('0x12')]=app; \ No newline at end of file +var _0x7739=['polling','redis','defaults','localhost','socket.io-redis','default','../../config/socketio','../../routes','log','lodash','express','sticky-session','ioredis','../../config/environment','createServer','listen','port','socket.io'];(function(_0x2340c9,_0x1b5965){var _0x35e206=function(_0x37f6cf){while(--_0x37f6cf){_0x2340c9['push'](_0x2340c9['shift']());}};_0x35e206(++_0x1b5965);}(_0x7739,0x14d));var _0x9773=function(_0x1bcc54,_0x26f81f){_0x1bcc54=_0x1bcc54-0x0;var _0x4fadf4=_0x7739[_0x1bcc54];return _0x4fadf4;};'use strict';var _=require(_0x9773('0x0'));var http=require('http');var express=require(_0x9773('0x1'));var sticky=require(_0x9773('0x2'));var Redis=require(_0x9773('0x3'));var config=require(_0x9773('0x4'));var app=express();var server=http[_0x9773('0x5')](app);server['timeout']=0xdbba0;if(sticky[_0x9773('0x6')](server,config[_0x9773('0x7')])){var socketio=require(_0x9773('0x8'))(server,{'transports':['websocket',_0x9773('0x9')]});config[_0x9773('0xa')]=_[_0x9773('0xb')](config[_0x9773('0xa')],{'host':_0x9773('0xc'),'port':0x18eb});socketio['adapter'](require(_0x9773('0xd'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config['redis'])}));require('../../config/triggers')[_0x9773('0xe')]();require(_0x9773('0xf'))['default'](socketio);require('../../config/express')['default'](app);require(_0x9773('0x10'))[_0x9773('0xe')](app);}else{server['once']('listening',function(){console[_0x9773('0x11')]('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x9773('0x7')]);});}exports=module['exports']=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index c475583..4032141 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 _0xda54=['request','then','debug','rpc','error','message','catch','exports','jayson/promise','../../config/logger','routing','client','http','Request'];(function(_0x2505d8,_0x140bfa){var _0x1fc52e=function(_0x5d1bca){while(--_0x5d1bca){_0x2505d8['push'](_0x2505d8['shift']());}};_0x1fc52e(++_0x140bfa);}(_0xda54,0x1c8));var _0x4da5=function(_0x3c1b2d,_0x23b1b9){_0x3c1b2d=_0x3c1b2d-0x0;var _0x412475=_0xda54[_0x3c1b2d];return _0x412475;};'use strict';var jayson=require(_0x4da5('0x0'));var BPromise=require('bluebird');var logger=require(_0x4da5('0x1'))(_0x4da5('0x2'));var client=jayson[_0x4da5('0x3')][_0x4da5('0x4')]({'port':0x2329});client[_0x4da5('0x5')]=function(_0x33db7f,_0x1660d0){return new BPromise(function(_0x1a0f4b,_0xa980c3){return client[_0x4da5('0x6')](_0x33db7f,_0x1660d0)[_0x4da5('0x7')](function(_0x570bb3){logger[_0x4da5('0x8')](_0x4da5('0x9'),_0x4da5('0x2'),_0x33db7f,_0x1660d0,_0x570bb3);if(_0x570bb3[_0x4da5('0xa')]){logger[_0x4da5('0xa')](_0x4da5('0x9'),_0x4da5('0x2'),_0x33db7f,_0x570bb3[_0x4da5('0xa')][_0x4da5('0xb')],_0x1660d0);return _0xa980c3(_0x570bb3[_0x4da5('0xa')][_0x4da5('0xb')]);}else{return _0x1a0f4b(_0x570bb3['result']);}})[_0x4da5('0xc')](function(_0x43b0b7){logger['error'](_0x4da5('0x9'),'routing',_0x33db7f,_0x43b0b7,_0x1660d0);return _0xa980c3(_0x43b0b7);});});};module[_0x4da5('0xd')]=client; \ No newline at end of file +var _0x591c=['routing','client','http','Request','request','then','debug','rpc','error','message','result','catch','exports','bluebird'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x591c,0xed));var _0xc591=function(_0x17fe0c,_0x4d5eee){_0x17fe0c=_0x17fe0c-0x0;var _0x487a19=_0x591c[_0x17fe0c];return _0x487a19;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xc591('0x0'));var logger=require('../../config/logger')(_0xc591('0x1'));var client=jayson[_0xc591('0x2')][_0xc591('0x3')]({'port':0x2329});client[_0xc591('0x4')]=function(_0xb38523,_0x180585){return new BPromise(function(_0x4bfafa,_0x3e54e3){return client[_0xc591('0x5')](_0xb38523,_0x180585)[_0xc591('0x6')](function(_0x1fb5c7){logger[_0xc591('0x7')](_0xc591('0x8'),_0xc591('0x1'),_0xb38523,_0x180585,_0x1fb5c7);if(_0x1fb5c7[_0xc591('0x9')]){logger[_0xc591('0x9')](_0xc591('0x8'),_0xc591('0x1'),_0xb38523,_0x1fb5c7[_0xc591('0x9')][_0xc591('0xa')],_0x180585);return _0x3e54e3(_0x1fb5c7[_0xc591('0x9')][_0xc591('0xa')]);}else{return _0x4bfafa(_0x1fb5c7[_0xc591('0xb')]);}})[_0xc591('0xc')](function(_0x5ee2d6){logger[_0xc591('0x9')](_0xc591('0x8'),_0xc591('0x1'),_0xb38523,_0x5ee2d6,_0x180585);return _0x3e54e3(_0x5ee2d6);});});};module[_0xc591('0xd')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 64db1e0..914ee15 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 _0x9b7b=['initChatQueues','getSmsQueues','initSmsQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','./server','./rpc/user','./rpc/interval','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x9b7b,0x1de));var _0xb9b7=function(_0x5c04b4,_0x3b7cba){_0x5c04b4=_0x5c04b4-0x0;var _0x5ae9a9=_0x9b7b[_0x5c04b4];return _0x5ae9a9;};'use strict';var BPromise=require('bluebird');var server=require(_0xb9b7('0x0'));var Realtime=require('./realtime');var user=require(_0xb9b7('0x1'));var interval=require(_0xb9b7('0x2'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0xb9b7('0x3'));var mailQueue=require(_0xb9b7('0x4'));var faxQueue=require(_0xb9b7('0x5'));var whatsappQueue=require(_0xb9b7('0x6'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xb9b7('0x7')]()[_0xb9b7('0x8')](user[_0xb9b7('0x9')]())[_0xb9b7('0x8')](realtime[_0xb9b7('0xa')]())[_0xb9b7('0x8')](interval[_0xb9b7('0xb')]())['then'](realtime[_0xb9b7('0xc')]())[_0xb9b7('0x8')](openchannelQueue[_0xb9b7('0xd')]())[_0xb9b7('0x8')](realtime[_0xb9b7('0xe')]())['then'](chatQueue[_0xb9b7('0xf')]())[_0xb9b7('0x8')](realtime[_0xb9b7('0x10')]())[_0xb9b7('0x8')](smsQueue[_0xb9b7('0x11')]())[_0xb9b7('0x8')](realtime[_0xb9b7('0x12')]())['then'](mailQueue['getMailQueues']())[_0xb9b7('0x8')](realtime['initMailQueues']())[_0xb9b7('0x8')](faxQueue[_0xb9b7('0x13')]())[_0xb9b7('0x8')](realtime[_0xb9b7('0x14')]())[_0xb9b7('0x8')](whatsappQueue[_0xb9b7('0x15')]())[_0xb9b7('0x8')](realtime[_0xb9b7('0x16')]())[_0xb9b7('0x8')](function(){return realtime;});}function main(){return server[_0xb9b7('0x17')](realtime)[_0xb9b7('0x8')](function(_0x1e2665){return initRealtime();})[_0xb9b7('0x8')](function(_0x30584f){return setInterval(initRealtime,0x1388);})[_0xb9b7('0x18')](function(_0x3518da){console[_0xb9b7('0x19')](_0x3518da);});}main(); \ No newline at end of file +var _0x5b87=['listen','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/chatQueue','./rpc/smsQueue','./rpc/faxQueue','resolve','then','getAgents','initIntervals','getOpenchannelQueues','getChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues'];(function(_0x547b5e,_0x1f8cfb){var _0x19a52f=function(_0x200c84){while(--_0x200c84){_0x547b5e['push'](_0x547b5e['shift']());}};_0x19a52f(++_0x1f8cfb);}(_0x5b87,0x179));var _0x75b8=function(_0x1d2c9a,_0x5d9e0a){_0x1d2c9a=_0x1d2c9a-0x0;var _0x2b1755=_0x5b87[_0x1d2c9a];return _0x2b1755;};'use strict';var BPromise=require('bluebird');var server=require(_0x75b8('0x0'));var Realtime=require(_0x75b8('0x1'));var user=require(_0x75b8('0x2'));var interval=require(_0x75b8('0x3'));var openchannelQueue=require('./rpc/openchannelQueue');var chatQueue=require(_0x75b8('0x4'));var smsQueue=require(_0x75b8('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x75b8('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x75b8('0x7')]()[_0x75b8('0x8')](user[_0x75b8('0x9')]())[_0x75b8('0x8')](realtime['initAgents']())[_0x75b8('0x8')](interval['getIntervals']())['then'](realtime[_0x75b8('0xa')]())['then'](openchannelQueue[_0x75b8('0xb')]())['then'](realtime['initOpenchannelQueues']())[_0x75b8('0x8')](chatQueue[_0x75b8('0xc')]())[_0x75b8('0x8')](realtime['initChatQueues']())[_0x75b8('0x8')](smsQueue['getSmsQueues']())[_0x75b8('0x8')](realtime[_0x75b8('0xd')]())['then'](mailQueue[_0x75b8('0xe')]())[_0x75b8('0x8')](realtime[_0x75b8('0xf')]())[_0x75b8('0x8')](faxQueue[_0x75b8('0x10')]())[_0x75b8('0x8')](realtime[_0x75b8('0x11')]())[_0x75b8('0x8')](whatsappQueue['getWhatsappQueues']())[_0x75b8('0x8')](realtime[_0x75b8('0x12')]())['then'](function(){return realtime;});}function main(){return server[_0x75b8('0x13')](realtime)[_0x75b8('0x8')](function(_0x2b933e){return initRealtime();})[_0x75b8('0x8')](function(_0x13ccf6){return setInterval(initRealtime,0x1388);})[_0x75b8('0x14')](function(_0x37b72f){console[_0x75b8('0x15')](_0x37b72f);});}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 13623c8..6a2763f 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 _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x14bab0,_0x55dbe8){var _0x5aa9bf=function(_0x56f679){while(--_0x56f679){_0x14bab0['push'](_0x14bab0['shift']());}};_0x5aa9bf(++_0x55dbe8);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xc4aa[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x52b0f9,_0x33340f){var _0x14f299=function(_0x14d812){while(--_0x14d812){_0x52b0f9['push'](_0x52b0f9['shift']());}};_0x14f299(++_0x33340f);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xc4aa[_0x3d42d8];return _0x27fc41;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index ab05088..5e82be1 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 _0x583b=['http','error','message','result','catch','sendMailMessage','bluebird','jayson/promise','client'];(function(_0x54bb5e,_0xc9513a){var _0x2cfe75=function(_0x52ef1b){while(--_0x52ef1b){_0x54bb5e['push'](_0x54bb5e['shift']());}};_0x2cfe75(++_0xc9513a);}(_0x583b,0xba));var _0xb583=function(_0x48a825,_0x2ee6cf){_0x48a825=_0x48a825-0x0;var _0x424703=_0x583b[_0x48a825];return _0x424703;};'use strict';var BPromise=require(_0xb583('0x0'));var jayson=require(_0xb583('0x1'));var client=jayson[_0xb583('0x2')][_0xb583('0x3')]({'port':0x232b});function request(_0x3f3479,_0xb432e7){return new BPromise(function(_0x4074d5,_0x2dac87){return client['request'](_0x3f3479,_0xb432e7)['then'](function(_0x598f08){if(_0x598f08['error']){return _0x2dac87(_0x598f08[_0xb583('0x4')][_0xb583('0x5')]);}else{return _0x4074d5(_0x598f08[_0xb583('0x6')]);}})[_0xb583('0x7')](function(_0x504eb1){return _0x2dac87(_0x504eb1);});});}exports[_0xb583('0x8')]=function(_0x17445a,_0xf999ee){return request('SendMail',{'account':_0x17445a,'message':_0xf999ee});}; \ No newline at end of file +var _0x0791=['request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','http'];(function(_0x471995,_0x49196a){var _0x363c1c=function(_0x47a62d){while(--_0x47a62d){_0x471995['push'](_0x471995['shift']());}};_0x363c1c(++_0x49196a);}(_0x0791,0x97));var _0x1079=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0x0791[_0x3b2369];return _0x5a1367;};'use strict';var BPromise=require(_0x1079('0x0'));var jayson=require(_0x1079('0x1'));var client=jayson['client'][_0x1079('0x2')]({'port':0x232b});function request(_0x2d9fcc,_0x29bbb0){return new BPromise(function(_0x3e0725,_0x1a0cfa){return client[_0x1079('0x3')](_0x2d9fcc,_0x29bbb0)[_0x1079('0x4')](function(_0x5a667e){if(_0x5a667e['error']){return _0x1a0cfa(_0x5a667e[_0x1079('0x5')][_0x1079('0x6')]);}else{return _0x3e0725(_0x5a667e[_0x1079('0x7')]);}})[_0x1079('0x8')](function(_0x4e24a6){return _0x1a0cfa(_0x4e24a6);});});}exports[_0x1079('0x9')]=function(_0x5d3e20,_0x4f0cd6){return request(_0x1079('0xa'),{'account':_0x5d3e20,'message':_0x4f0cd6});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 1066e06..134ee38 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 _0x9536=['faxCapacity','faxCurrentCapacity','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','toNumber','format','mailStatus','smsStatus','whatsappStatus','chatWaitingInteractions','stringify','user:routing:update','omit','exports','lodash','md5','moment','ioredis','redis','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxStatusTime'];(function(_0x5a1577,_0x457783){var _0x205355=function(_0x3354e9){while(--_0x3354e9){_0x5a1577['push'](_0x5a1577['shift']());}};_0x205355(++_0x457783);}(_0x9536,0x179));var _0x6953=function(_0x57d370,_0x3ed0f6){_0x57d370=_0x57d370-0x0;var _0x550fd2=_0x9536[_0x57d370];return _0x550fd2;};'use strict';var _=require(_0x6953('0x0'));var md5=require(_0x6953('0x1'));var moment=require(_0x6953('0x2'));var Redis=require(_0x6953('0x3'));var config=require('../../../config/environment');config[_0x6953('0x4')]=_['defaults'](config[_0x6953('0x4')],{'host':_0x6953('0x5'),'port':0x18eb});var io=require(_0x6953('0x6'))(new Redis(config[_0x6953('0x4')]));function Agent(_0x2f3cc3){this['id']=_0x2f3cc3['id']||0x0;this['name']=_0x2f3cc3[_0x6953('0x7')]||'';this[_0x6953('0x8')]=_0x2f3cc3[_0x6953('0x8')]||!![];this[_0x6953('0x9')]=_0x2f3cc3[_0x6953('0x9')]||![];this['chatPause']=_0x2f3cc3[_0x6953('0xa')]||![];this[_0x6953('0xb')]=_0x2f3cc3[_0x6953('0xb')]||![];this['faxPause']=_0x2f3cc3[_0x6953('0xc')]||![];this[_0x6953('0xd')]=_0x2f3cc3[_0x6953('0xd')]||![];this[_0x6953('0xe')]=_0x2f3cc3[_0x6953('0xe')]||![];this[_0x6953('0xf')]=_0x6953('0x10');this[_0x6953('0x11')]=0x0;this[_0x6953('0x12')]=_0x2f3cc3['chatCapacity']||0x0;this[_0x6953('0x13')]=0x0;this['mailStatus']=_0x6953('0x10');this[_0x6953('0x14')]=0x0;this[_0x6953('0x15')]=_0x2f3cc3[_0x6953('0x15')]||0x0;this[_0x6953('0x16')]=0x0;this[_0x6953('0x17')]=_0x6953('0x10');this[_0x6953('0x18')]=0x0;this[_0x6953('0x19')]=_0x2f3cc3[_0x6953('0x19')]||0x0;this[_0x6953('0x1a')]=0x0;this['smsStatus']='unknown';this[_0x6953('0x1b')]=0x0;this[_0x6953('0x1c')]=_0x2f3cc3[_0x6953('0x1c')]||0x0;this[_0x6953('0x1d')]=0x0;this['whatsappStatus']=_0x6953('0x10');this[_0x6953('0x1e')]=0x0;this['whatsappCapacity']=_0x2f3cc3[_0x6953('0x1f')]||0x0;this[_0x6953('0x20')]=0x0;this[_0x6953('0x21')]=_0x6953('0x10');this[_0x6953('0x22')]=0x0;this['openchannelCapacity']=_0x2f3cc3[_0x6953('0x23')]||0x0;this[_0x6953('0x24')]=0x0;this[_0x6953('0x25')]=![];this[_0x6953('0x26')]=undefined;this[_0x6953('0x1')]='';this['chatWaitingInteractions']={};this[_0x6953('0x27')]={};this[_0x6953('0x28')]={};this['openchannelWaitingInteractions']={};this[_0x6953('0x29')]={};this[_0x6953('0x2a')]={};this[_0x6953('0x2b')]();}Agent[_0x6953('0x2c')]['getChannelStatus']=function(_0x37f339){if(this[_0x37f339+_0x6953('0x2d')]>0x0){if(this[_0x37f339+_0x6953('0x2e')]>0x0&&this[_0x37f339+'CurrentCapacity']>=this[_0x37f339+'Capacity']){return'maxcapacity';}else{return _0x6953('0x2f');}}else{return _0x6953('0x30');}};Agent['prototype'][_0x6953('0x2b')]=function(){var _0x587df0=[_0x6953('0x31'),_0x6953('0x32'),_0x6953('0x33'),_0x6953('0x34'),_0x6953('0x35'),_0x6953('0x36')];for(var _0x53d3dc=0x0;_0x53d3dc<_0x587df0[_0x6953('0x37')];_0x53d3dc+=0x1){var _0x3c1075=this['getChannelStatus'](_0x587df0[_0x53d3dc]);if(this[_0x587df0[_0x53d3dc]+_0x6953('0x38')]!==_0x3c1075){this[_0x587df0[_0x53d3dc]+'StatusTime']=_[_0x6953('0x39')](moment()[_0x6953('0x3a')]('x'));}this[_0x587df0[_0x53d3dc]+_0x6953('0x38')]=_0x3c1075;}var _0x4b0325={'id':this['id'],'name':this[_0x6953('0x7')],'online':this[_0x6953('0x8')],'voicePause':this[_0x6953('0x9')],'chatPause':this['chatPause'],'mailPause':this[_0x6953('0xb')],'smsPause':this[_0x6953('0xd')],'faxPause':this['faxPause'],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0x6953('0xf')],'chatStatusTime':this[_0x6953('0x11')],'chatCapacity':this[_0x6953('0x12')],'chatCurrentCapacity':this[_0x6953('0x13')],'mailStatus':this[_0x6953('0x3b')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0x6953('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0x6953('0x17')],'faxStatusTime':this[_0x6953('0x18')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this[_0x6953('0x3c')],'smsStatusTime':this[_0x6953('0x1b')],'smsCapacity':this[_0x6953('0x1c')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x6953('0x3d')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0x6953('0x22')],'openchannelCapacity':this[_0x6953('0x23')],'openchannelCurrentCapacity':this[_0x6953('0x24')],'busy':this[_0x6953('0x25')],'busyQueue':this[_0x6953('0x26')],'chatWaitingInteractions':this[_0x6953('0x3e')],'faxWaitingInteractions':this['faxWaitingInteractions'],'mailWaitingInteractions':this[_0x6953('0x28')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x6953('0x29')],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0xc63da7=md5(JSON[_0x6953('0x3f')](_0x4b0325));if(this[_0x6953('0x1')]!==_0xc63da7){this[_0x6953('0x1')]=_0xc63da7;io['emit'](_0x6953('0x40'),_[_0x6953('0x41')](_0x4b0325,[_0x6953('0x8')]));}};module[_0x6953('0x42')]=Agent; \ No newline at end of file +var _0x323f=['chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','faxWaitingInteractions','mailWaitingInteractions','openchannelWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','openchannel','sms','whatsapp','length','Status','StatusTime','format','faxStatusTime','stringify','emit','exports','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause'];(function(_0x1fc1f9,_0x454fb2){var _0x4987ca=function(_0x5e90dd){while(--_0x5e90dd){_0x1fc1f9['push'](_0x1fc1f9['shift']());}};_0x4987ca(++_0x454fb2);}(_0x323f,0x1ee));var _0xf323=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x323f[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var md5=require(_0xf323('0x0'));var moment=require('moment');var Redis=require(_0xf323('0x1'));var config=require(_0xf323('0x2'));config[_0xf323('0x3')]=_[_0xf323('0x4')](config[_0xf323('0x3')],{'host':_0xf323('0x5'),'port':0x18eb});var io=require(_0xf323('0x6'))(new Redis(config[_0xf323('0x3')]));function Agent(_0x3cfee3){this['id']=_0x3cfee3['id']||0x0;this[_0xf323('0x7')]=_0x3cfee3['name']||'';this[_0xf323('0x8')]=_0x3cfee3[_0xf323('0x8')]||!![];this[_0xf323('0x9')]=_0x3cfee3[_0xf323('0x9')]||![];this[_0xf323('0xa')]=_0x3cfee3[_0xf323('0xa')]||![];this[_0xf323('0xb')]=_0x3cfee3[_0xf323('0xb')]||![];this[_0xf323('0xc')]=_0x3cfee3[_0xf323('0xc')]||![];this[_0xf323('0xd')]=_0x3cfee3[_0xf323('0xd')]||![];this[_0xf323('0xe')]=_0x3cfee3[_0xf323('0xe')]||![];this[_0xf323('0xf')]=_0xf323('0x10');this[_0xf323('0x11')]=0x0;this['chatCapacity']=_0x3cfee3[_0xf323('0x12')]||0x0;this[_0xf323('0x13')]=0x0;this[_0xf323('0x14')]='unknown';this[_0xf323('0x15')]=0x0;this[_0xf323('0x16')]=_0x3cfee3[_0xf323('0x16')]||0x0;this[_0xf323('0x17')]=0x0;this[_0xf323('0x18')]=_0xf323('0x10');this['faxStatusTime']=0x0;this['faxCapacity']=_0x3cfee3[_0xf323('0x19')]||0x0;this[_0xf323('0x1a')]=0x0;this[_0xf323('0x1b')]=_0xf323('0x10');this[_0xf323('0x1c')]=0x0;this['smsCapacity']=_0x3cfee3[_0xf323('0x1d')]||0x0;this[_0xf323('0x1e')]=0x0;this[_0xf323('0x1f')]=_0xf323('0x10');this['whatsappStatusTime']=0x0;this[_0xf323('0x20')]=_0x3cfee3[_0xf323('0x20')]||0x0;this[_0xf323('0x21')]=0x0;this[_0xf323('0x22')]='unknown';this[_0xf323('0x23')]=0x0;this[_0xf323('0x24')]=_0x3cfee3['openchannelCapacity']||0x0;this[_0xf323('0x25')]=0x0;this[_0xf323('0x26')]=![];this[_0xf323('0x27')]=undefined;this[_0xf323('0x0')]='';this['chatWaitingInteractions']={};this[_0xf323('0x28')]={};this[_0xf323('0x29')]={};this[_0xf323('0x2a')]={};this['smsWaitingInteractions']={};this[_0xf323('0x2b')]={};this[_0xf323('0x2c')]();}Agent[_0xf323('0x2d')][_0xf323('0x2e')]=function(_0x13ec1f){if(this[_0x13ec1f+_0xf323('0x2f')]>0x0){if(this[_0x13ec1f+_0xf323('0x30')]>0x0&&this[_0x13ec1f+_0xf323('0x2f')]>=this[_0x13ec1f+_0xf323('0x30')]){return'maxcapacity';}else{return _0xf323('0x31');}}else{return _0xf323('0x32');}};Agent[_0xf323('0x2d')][_0xf323('0x2c')]=function(){var _0x87ec45=[_0xf323('0x33'),'chat',_0xf323('0x34'),'fax',_0xf323('0x35'),_0xf323('0x36')];for(var _0x56be0c=0x0;_0x56be0c<_0x87ec45[_0xf323('0x37')];_0x56be0c+=0x1){var _0x3c95ce=this[_0xf323('0x2e')](_0x87ec45[_0x56be0c]);if(this[_0x87ec45[_0x56be0c]+_0xf323('0x38')]!==_0x3c95ce){this[_0x87ec45[_0x56be0c]+_0xf323('0x39')]=_['toNumber'](moment()[_0xf323('0x3a')]('x'));}this[_0x87ec45[_0x56be0c]+_0xf323('0x38')]=_0x3c95ce;}var _0x12c7d5={'id':this['id'],'name':this[_0xf323('0x7')],'online':this[_0xf323('0x8')],'voicePause':this[_0xf323('0x9')],'chatPause':this[_0xf323('0xa')],'mailPause':this[_0xf323('0xb')],'smsPause':this[_0xf323('0xd')],'faxPause':this['faxPause'],'openchannelPause':this[_0xf323('0xe')],'chatStatus':this[_0xf323('0xf')],'chatStatusTime':this[_0xf323('0x11')],'chatCapacity':this[_0xf323('0x12')],'chatCurrentCapacity':this[_0xf323('0x13')],'mailStatus':this['mailStatus'],'mailStatusTime':this[_0xf323('0x15')],'mailCapacity':this[_0xf323('0x16')],'mailCurrentCapacity':this[_0xf323('0x17')],'faxStatus':this[_0xf323('0x18')],'faxStatusTime':this[_0xf323('0x3b')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xf323('0x1a')],'smsStatus':this[_0xf323('0x1b')],'smsStatusTime':this[_0xf323('0x1c')],'smsCapacity':this[_0xf323('0x1d')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0xf323('0x1f')],'whatsappStatusTime':this['whatsappStatusTime'],'whatsappCapacity':this[_0xf323('0x20')],'whatsappCurrentCapacity':this[_0xf323('0x21')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xf323('0x23')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xf323('0x25')],'busy':this['busy'],'busyQueue':this[_0xf323('0x27')],'chatWaitingInteractions':this['chatWaitingInteractions'],'faxWaitingInteractions':this[_0xf323('0x28')],'mailWaitingInteractions':this[_0xf323('0x29')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this['smsWaitingInteractions'],'whatsappWaitingInteractions':this['whatsappWaitingInteractions']};var _0x8b24f2=md5(JSON[_0xf323('0x3c')](_0x12c7d5));if(this[_0xf323('0x0')]!==_0x8b24f2){this[_0xf323('0x0')]=_0x8b24f2;io[_0xf323('0x3d')]('user:routing:update',_['omit'](_0x12c7d5,['online']));}};module[_0xf323('0x3e')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index b5f6ecd..0db54de 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 _0x002c=['Agents','waiting','updateRouting','prototype','mapAgentsId','_rr','map','loggedIn','paused','length','chatPause','available','chat:queue:%s','exports','lodash','md5','util','ioredis','redis','name','timeout','strategy','beepall'];(function(_0x12a11c,_0x444200){var _0x1c7f67=function(_0x3bd9b0){while(--_0x3bd9b0){_0x12a11c['push'](_0x12a11c['shift']());}};_0x1c7f67(++_0x444200);}(_0x002c,0xf4));var _0xc002=function(_0x259e3e,_0xa42d31){_0x259e3e=_0x259e3e-0x0;var _0x241e01=_0x002c[_0x259e3e];return _0x241e01;};'use strict';var _=require(_0xc002('0x0'));var md5=require(_0xc002('0x1'));var util=require(_0xc002('0x2'));var Redis=require(_0xc002('0x3'));var config=require('../../../config/environment');config[_0xc002('0x4')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xc002('0x4')]));function ChatQueue(_0x1f7384){this['id']=_0x1f7384['id']||0x0;this[_0xc002('0x5')]=_0x1f7384['name']||'';this['timeout']=_0x1f7384[_0xc002('0x6')]||0xa;this[_0xc002('0x7')]=_0x1f7384[_0xc002('0x7')]||_0xc002('0x8');this[_0xc002('0x9')]=_0x1f7384[_0xc002('0x9')];this['mapAgentsId']={};this[_0xc002('0xa')]=0x0;this['md5']='';this[_0xc002('0xb')]();this['updateRealtime']();}ChatQueue[_0xc002('0xc')][_0xc002('0xb')]=function(){var _0x3c2742=this[_0xc002('0xd')][_0xc002('0xe')];this[_0xc002('0xd')]=_[_0xc002('0xf')](this[_0xc002('0x9')],'id');this[_0xc002('0xd')][_0xc002('0xe')]=_0x3c2742;};ChatQueue['prototype']['updateRealtime']=function(){this[_0xc002('0x10')]=0x0;this[_0xc002('0x11')]=0x0;for(var _0x3b0778=0x0;_0x3b0778=0x0?this[_0xc002('0x14')]:0x0;var _0x1a9bc6={'id':this['id'],'available':this[_0xc002('0x14')],'loggedIn':this[_0xc002('0x10')],'name':this[_0xc002('0x5')],'paused':this['paused'],'waiting':this[_0xc002('0xa')]};var _0x1e74c7=md5(JSON['stringify'](_0x1a9bc6));if(this[_0xc002('0x1')]!==_0x1e74c7){this[_0xc002('0x1')]=_0x1e74c7;io['to'](util['format'](_0xc002('0x15'),_0x1a9bc6[_0xc002('0x5')]))['emit']('chat_queue:save',_0x1a9bc6);}};module[_0xc002('0x16')]=ChatQueue; \ No newline at end of file +var _0x3c3a=['name','timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','online','chatPause','available','stringify','chat:queue:%s','emit','chat_queue:save','lodash','md5','util','../../../config/environment','defaults'];(function(_0x18847a,_0xd6898e){var _0x5b68ca=function(_0xf333b){while(--_0xf333b){_0x18847a['push'](_0x18847a['shift']());}};_0x5b68ca(++_0xd6898e);}(_0x3c3a,0x11b));var _0xa3c3=function(_0x105a6b,_0x7fd8d7){_0x105a6b=_0x105a6b-0x0;var _0x4e50da=_0x3c3a[_0x105a6b];return _0x4e50da;};'use strict';var _=require(_0xa3c3('0x0'));var md5=require(_0xa3c3('0x1'));var util=require(_0xa3c3('0x2'));var Redis=require('ioredis');var config=require(_0xa3c3('0x3'));config['redis']=_[_0xa3c3('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function ChatQueue(_0x1be04a){this['id']=_0x1be04a['id']||0x0;this[_0xa3c3('0x5')]=_0x1be04a[_0xa3c3('0x5')]||'';this[_0xa3c3('0x6')]=_0x1be04a['timeout']||0xa;this[_0xa3c3('0x7')]=_0x1be04a['strategy']||_0xa3c3('0x8');this[_0xa3c3('0x9')]=_0x1be04a['Agents'];this[_0xa3c3('0xa')]={};this['waiting']=0x0;this['md5']='';this[_0xa3c3('0xb')]();this[_0xa3c3('0xc')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x33ca37=this[_0xa3c3('0xa')]['_rr'];this[_0xa3c3('0xa')]=_['map'](this[_0xa3c3('0x9')],'id');this[_0xa3c3('0xa')][_0xa3c3('0xd')]=_0x33ca37;};ChatQueue[_0xa3c3('0xe')][_0xa3c3('0xc')]=function(){this[_0xa3c3('0xf')]=0x0;this[_0xa3c3('0x10')]=0x0;for(var _0x106c63=0x0;_0x106c63=0x0?this[_0xa3c3('0x13')]:0x0;var _0x195712={'id':this['id'],'available':this[_0xa3c3('0x13')],'loggedIn':this[_0xa3c3('0xf')],'name':this['name'],'paused':this[_0xa3c3('0x10')],'waiting':this['waiting']};var _0xd452ea=md5(JSON[_0xa3c3('0x14')](_0x195712));if(this[_0xa3c3('0x1')]!==_0xd452ea){this[_0xa3c3('0x1')]=_0xd452ea;io['to'](util['format'](_0xa3c3('0x15'),_0x195712[_0xa3c3('0x5')]))[_0xa3c3('0x16')](_0xa3c3('0x17'),_0x195712);}};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 94998bf..decbe6a 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 _0x4732=['timeout','strategy','beepall','Agents','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','faxPause','available','waiting','stringify','fax:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x4732,0x9f));var _0x2473=function(_0x278f93,_0x5d74c6){_0x278f93=_0x278f93-0x0;var _0x47d224=_0x4732[_0x278f93];return _0x47d224;};'use strict';var _=require(_0x2473('0x0'));var md5=require(_0x2473('0x1'));var util=require('util');var Redis=require(_0x2473('0x2'));var config=require(_0x2473('0x3'));config[_0x2473('0x4')]=_[_0x2473('0x5')](config[_0x2473('0x4')],{'host':_0x2473('0x6'),'port':0x18eb});var io=require(_0x2473('0x7'))(new Redis(config[_0x2473('0x4')]));function FaxQueue(_0x2df8c2){this['id']=_0x2df8c2['id']||0x0;this[_0x2473('0x8')]=_0x2df8c2[_0x2473('0x8')]||'';this['timeout']=_0x2df8c2[_0x2473('0x9')]||0xa;this[_0x2473('0xa')]=_0x2df8c2['strategy']||_0x2473('0xb');this[_0x2473('0xc')]=_0x2df8c2[_0x2473('0xc')];this[_0x2473('0xd')]={};this['waiting']=0x0;this[_0x2473('0x1')]='';this[_0x2473('0xe')]();this[_0x2473('0xf')]();}FaxQueue[_0x2473('0x10')]['updateRouting']=function(){var _0x41d6a8=this[_0x2473('0xd')][_0x2473('0x11')];this['mapAgentsId']=_[_0x2473('0x12')](this[_0x2473('0xc')],'id');this[_0x2473('0xd')][_0x2473('0x11')]=_0x41d6a8;};FaxQueue[_0x2473('0x10')]['updateRealtime']=function(){this[_0x2473('0x13')]=0x0;this[_0x2473('0x14')]=0x0;for(var _0x15977a=0x0;_0x15977a=0x0?this[_0x2473('0x16')]:0x0;var _0x2d0187={'id':this['id'],'available':this[_0x2473('0x16')],'loggedIn':this[_0x2473('0x13')],'name':this[_0x2473('0x8')],'paused':this[_0x2473('0x14')],'waiting':this[_0x2473('0x17')]};var _0x1ed409=md5(JSON[_0x2473('0x18')](_0x2d0187));if(this['md5']!==_0x1ed409){this[_0x2473('0x1')]=_0x1ed409;io['to'](util['format'](_0x2473('0x19'),_0x2d0187[_0x2473('0x8')]))[_0x2473('0x1a')]('fax_queue:save',_0x2d0187);}};module[_0x2473('0x1b')]=FaxQueue; \ No newline at end of file +var _0x3bf7=['available','stringify','format','emit','fax_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','loggedIn','paused','length','faxPause'];(function(_0x1e2583,_0x42669b){var _0x445939=function(_0x2a6431){while(--_0x2a6431){_0x1e2583['push'](_0x1e2583['shift']());}};_0x445939(++_0x42669b);}(_0x3bf7,0x1aa));var _0x73bf=function(_0x319a18,_0x4ba5a6){_0x319a18=_0x319a18-0x0;var _0x761326=_0x3bf7[_0x319a18];return _0x761326;};'use strict';var _=require(_0x73bf('0x0'));var md5=require('md5');var util=require(_0x73bf('0x1'));var Redis=require(_0x73bf('0x2'));var config=require(_0x73bf('0x3'));config[_0x73bf('0x4')]=_[_0x73bf('0x5')](config[_0x73bf('0x4')],{'host':_0x73bf('0x6'),'port':0x18eb});var io=require(_0x73bf('0x7'))(new Redis(config['redis']));function FaxQueue(_0x26fb88){this['id']=_0x26fb88['id']||0x0;this['name']=_0x26fb88[_0x73bf('0x8')]||'';this[_0x73bf('0x9')]=_0x26fb88[_0x73bf('0x9')]||0xa;this[_0x73bf('0xa')]=_0x26fb88[_0x73bf('0xa')]||_0x73bf('0xb');this[_0x73bf('0xc')]=_0x26fb88['Agents'];this[_0x73bf('0xd')]={};this[_0x73bf('0xe')]=0x0;this[_0x73bf('0xf')]='';this[_0x73bf('0x10')]();this[_0x73bf('0x11')]();}FaxQueue[_0x73bf('0x12')][_0x73bf('0x10')]=function(){var _0x2cf3aa=this['mapAgentsId'][_0x73bf('0x13')];this[_0x73bf('0xd')]=_['map'](this[_0x73bf('0xc')],'id');this[_0x73bf('0xd')]['_rr']=_0x2cf3aa;};FaxQueue[_0x73bf('0x12')][_0x73bf('0x11')]=function(){this[_0x73bf('0x14')]=0x0;this[_0x73bf('0x15')]=0x0;for(var _0x29e197=0x0;_0x29e197=0x0?this[_0x73bf('0x18')]:0x0;var _0x53e67f={'id':this['id'],'available':this[_0x73bf('0x18')],'loggedIn':this[_0x73bf('0x14')],'name':this['name'],'paused':this[_0x73bf('0x15')],'waiting':this[_0x73bf('0xe')]};var _0x2cbf0c=md5(JSON[_0x73bf('0x19')](_0x53e67f));if(this['md5']!==_0x2cbf0c){this['md5']=_0x2cbf0c;io['to'](util[_0x73bf('0x1a')]('fax:queue:%s',_0x53e67f[_0x73bf('0x8')]))[_0x73bf('0x1b')](_0x73bf('0x1c'),_0x53e67f);}};module[_0x73bf('0x1d')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 70df541..b29801a 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 _0xd212=['name','Intervals'];(function(_0x31a576,_0x424419){var _0x30b1d3=function(_0x4710e8){while(--_0x4710e8){_0x31a576['push'](_0x31a576['shift']());}};_0x30b1d3(++_0x424419);}(_0xd212,0x1a6));var _0x2d21=function(_0x26a4ea,_0xa72fb8){_0x26a4ea=_0x26a4ea-0x0;var _0x1b669e=_0xd212[_0x26a4ea];return _0x1b669e;};'use strict';function Interval(_0x2bc6b1){this['id']=_0x2bc6b1['id']||0x0;this[_0x2d21('0x0')]=_0x2bc6b1[_0x2d21('0x0')]||'';this[_0x2d21('0x1')]=_0x2bc6b1[_0x2d21('0x1')]||{};}module['exports']=Interval; \ No newline at end of file +var _0xd36e=['name','Intervals','exports'];(function(_0x2b3c36,_0x2692e1){var _0x1c1840=function(_0x559719){while(--_0x559719){_0x2b3c36['push'](_0x2b3c36['shift']());}};_0x1c1840(++_0x2692e1);}(_0xd36e,0x183));var _0xed36=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xd36e[_0x27af45];return _0x18df21;};'use strict';function Interval(_0x39d051){this['id']=_0x39d051['id']||0x0;this[_0xed36('0x0')]=_0x39d051[_0xed36('0x0')]||'';this[_0xed36('0x1')]=_0x39d051[_0xed36('0x1')]||{};}module[_0xed36('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 0e0f63e..bb35151 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 _0xe111=['defaults','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','mailPause','paused','available','stringify','format','mail:queue:%s','emit','lodash','md5','util','ioredis'];(function(_0x3612e6,_0x48f856){var _0x4cf7a6=function(_0x48dbfd){while(--_0x48dbfd){_0x3612e6['push'](_0x3612e6['shift']());}};_0x4cf7a6(++_0x48f856);}(_0xe111,0x1a5));var _0x1e11=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe111[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1e11('0x0'));var md5=require(_0x1e11('0x1'));var util=require(_0x1e11('0x2'));var Redis=require(_0x1e11('0x3'));var config=require('../../../config/environment');config['redis']=_[_0x1e11('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x1e11('0x5'))(new Redis(config['redis']));function MailQueue(_0x103b98){this['id']=_0x103b98['id']||0x0;this[_0x1e11('0x6')]=_0x103b98[_0x1e11('0x6')]||'';this[_0x1e11('0x7')]=_0x103b98['timeout']||0xa;this[_0x1e11('0x8')]=_0x103b98['strategy']||'beepall';this[_0x1e11('0x9')]=_0x103b98[_0x1e11('0x9')];this[_0x1e11('0xa')]={};this[_0x1e11('0xb')]=0x0;this['md5']='';this[_0x1e11('0xc')]();this[_0x1e11('0xd')]();}MailQueue[_0x1e11('0xe')][_0x1e11('0xc')]=function(){var _0x413183=this['mapAgentsId'][_0x1e11('0xf')];this[_0x1e11('0xa')]=_[_0x1e11('0x10')](this[_0x1e11('0x9')],'id');this[_0x1e11('0xa')]['_rr']=_0x413183;};MailQueue[_0x1e11('0xe')][_0x1e11('0xd')]=function(){this[_0x1e11('0x11')]=0x0;this['paused']=0x0;for(var _0xa482a5=0x0;_0xa482a5=0x0?this[_0x1e11('0x14')]:0x0;var _0x84dfd8={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x1e11('0x6')],'paused':this[_0x1e11('0x13')],'waiting':this['waiting']};var _0x503c37=md5(JSON[_0x1e11('0x15')](_0x84dfd8));if(this['md5']!==_0x503c37){this[_0x1e11('0x1')]=_0x503c37;io['to'](util[_0x1e11('0x16')](_0x1e11('0x17'),_0x84dfd8[_0x1e11('0x6')]))[_0x1e11('0x18')]('mail_queue:save',_0x84dfd8);}};module['exports']=MailQueue; \ No newline at end of file +var _0xe44b=['defaults','socket.io-emitter','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','length','online','available','paused','format','emit','mail_queue:save','exports','md5','util','ioredis','../../../config/environment','redis'];(function(_0x1e10e2,_0x4148d5){var _0x3176d3=function(_0x4b6216){while(--_0x4b6216){_0x1e10e2['push'](_0x1e10e2['shift']());}};_0x3176d3(++_0x4148d5);}(_0xe44b,0xc3));var _0xbe44=function(_0xcd3fd1,_0x1a2ffc){_0xcd3fd1=_0xcd3fd1-0x0;var _0x29a9d3=_0xe44b[_0xcd3fd1];return _0x29a9d3;};'use strict';var _=require('lodash');var md5=require(_0xbe44('0x0'));var util=require(_0xbe44('0x1'));var Redis=require(_0xbe44('0x2'));var config=require(_0xbe44('0x3'));config[_0xbe44('0x4')]=_[_0xbe44('0x5')](config[_0xbe44('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0xbe44('0x6'))(new Redis(config[_0xbe44('0x4')]));function MailQueue(_0x13cf2e){this['id']=_0x13cf2e['id']||0x0;this['name']=_0x13cf2e[_0xbe44('0x7')]||'';this[_0xbe44('0x8')]=_0x13cf2e['timeout']||0xa;this['strategy']=_0x13cf2e['strategy']||'beepall';this['Agents']=_0x13cf2e[_0xbe44('0x9')];this[_0xbe44('0xa')]={};this[_0xbe44('0xb')]=0x0;this['md5']='';this[_0xbe44('0xc')]();this[_0xbe44('0xd')]();}MailQueue['prototype'][_0xbe44('0xc')]=function(){var _0x4a4218=this[_0xbe44('0xa')]['_rr'];this[_0xbe44('0xa')]=_['map'](this[_0xbe44('0x9')],'id');this[_0xbe44('0xa')][_0xbe44('0xe')]=_0x4a4218;};MailQueue[_0xbe44('0xf')]['updateRealtime']=function(){this[_0xbe44('0x10')]=0x0;this['paused']=0x0;for(var _0x24b9d8=0x0;_0x24b9d8=0x0?this[_0xbe44('0x13')]:0x0;var _0xd8742={'id':this['id'],'available':this['available'],'loggedIn':this[_0xbe44('0x10')],'name':this['name'],'paused':this[_0xbe44('0x14')],'waiting':this[_0xbe44('0xb')]};var _0x1a3fd3=md5(JSON['stringify'](_0xd8742));if(this[_0xbe44('0x0')]!==_0x1a3fd3){this[_0xbe44('0x0')]=_0x1a3fd3;io['to'](util[_0xbe44('0x15')]('mail:queue:%s',_0xd8742['name']))[_0xbe44('0x16')](_0xbe44('0x17'),_0xd8742);}};module[_0xbe44('0x18')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index f8a9972..744482c 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 _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x5b4c25,_0x32ba9d){var _0x4f0db4=function(_0xf89307){while(--_0xf89307){_0x5b4c25['push'](_0x5b4c25['shift']());}};_0x4f0db4(++_0x32ba9d);}(_0x814b,0x1a2));var _0xb814=function(_0x55e059,_0x2df2c5){_0x55e059=_0x55e059-0x0;var _0x1e6bb7=_0x814b[_0x55e059];return _0x1e6bb7;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xc4aa[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index c987610..e4fda88 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 _0xb377=['Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','map','updateRealtime','loggedIn','paused','length','online','available','name','stringify','format','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall'];(function(_0x1d6828,_0x30cbb6){var _0x25fa7f=function(_0x6ede4b){while(--_0x6ede4b){_0x1d6828['push'](_0x1d6828['shift']());}};_0x25fa7f(++_0x30cbb6);}(_0xb377,0x1b6));var _0x7b37=function(_0x171f9e,_0x4c22b9){_0x171f9e=_0x171f9e-0x0;var _0x2f0b1e=_0xb377[_0x171f9e];return _0x2f0b1e;};'use strict';var _=require(_0x7b37('0x0'));var md5=require(_0x7b37('0x1'));var util=require(_0x7b37('0x2'));var Redis=require(_0x7b37('0x3'));var config=require(_0x7b37('0x4'));config[_0x7b37('0x5')]=_[_0x7b37('0x6')](config[_0x7b37('0x5')],{'host':_0x7b37('0x7'),'port':0x18eb});var io=require(_0x7b37('0x8'))(new Redis(config[_0x7b37('0x5')]));function SmsQueue(_0x38d1b4){this['id']=_0x38d1b4['id']||0x0;this['name']=_0x38d1b4['name']||'';this[_0x7b37('0x9')]=_0x38d1b4['timeout']||0xa;this['strategy']=_0x38d1b4[_0x7b37('0xa')]||_0x7b37('0xb');this[_0x7b37('0xc')]=_0x38d1b4[_0x7b37('0xc')];this[_0x7b37('0xd')]={};this[_0x7b37('0xe')]=0x0;this[_0x7b37('0x1')]='';this[_0x7b37('0xf')]();this['updateRealtime']();}SmsQueue[_0x7b37('0x10')][_0x7b37('0xf')]=function(){var _0x4a51b0=this['mapAgentsId'][_0x7b37('0x11')];this[_0x7b37('0xd')]=_[_0x7b37('0x12')](this[_0x7b37('0xc')],'id');this[_0x7b37('0xd')][_0x7b37('0x11')]=_0x4a51b0;};SmsQueue[_0x7b37('0x10')][_0x7b37('0x13')]=function(){this[_0x7b37('0x14')]=0x0;this[_0x7b37('0x15')]=0x0;for(var _0x1a381a=0x0;_0x1a381a=0x0?this[_0x7b37('0x18')]:0x0;var _0x487f5c={'id':this['id'],'available':this[_0x7b37('0x18')],'loggedIn':this[_0x7b37('0x14')],'name':this[_0x7b37('0x19')],'paused':this['paused'],'waiting':this['waiting']};var _0x6905bb=md5(JSON[_0x7b37('0x1a')](_0x487f5c));if(this[_0x7b37('0x1')]!==_0x6905bb){this[_0x7b37('0x1')]=_0x6905bb;io['to'](util[_0x7b37('0x1b')]('sms:queue:%s',_0x487f5c['name']))['emit'](_0x7b37('0x1c'),_0x487f5c);}};module[_0x7b37('0x1d')]=SmsQueue; \ No newline at end of file +var _0xbd50=['smsPause','available','waiting','stringify','sms_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','mapAgentsId','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xbd50,0x196));var _0x0bd5=function(_0x4092de,_0x24186b){_0x4092de=_0x4092de-0x0;var _0x2e8a39=_0xbd50[_0x4092de];return _0x2e8a39;};'use strict';var _=require(_0x0bd5('0x0'));var md5=require(_0x0bd5('0x1'));var util=require(_0x0bd5('0x2'));var Redis=require('ioredis');var config=require(_0x0bd5('0x3'));config[_0x0bd5('0x4')]=_[_0x0bd5('0x5')](config[_0x0bd5('0x4')],{'host':_0x0bd5('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function SmsQueue(_0x560cf1){this['id']=_0x560cf1['id']||0x0;this[_0x0bd5('0x7')]=_0x560cf1[_0x0bd5('0x7')]||'';this[_0x0bd5('0x8')]=_0x560cf1[_0x0bd5('0x8')]||0xa;this[_0x0bd5('0x9')]=_0x560cf1['strategy']||'beepall';this[_0x0bd5('0xa')]=_0x560cf1[_0x0bd5('0xa')];this[_0x0bd5('0xb')]={};this['waiting']=0x0;this[_0x0bd5('0x1')]='';this[_0x0bd5('0xc')]();this['updateRealtime']();}SmsQueue[_0x0bd5('0xd')][_0x0bd5('0xc')]=function(){var _0x4d7d17=this[_0x0bd5('0xb')][_0x0bd5('0xe')];this[_0x0bd5('0xb')]=_['map'](this[_0x0bd5('0xa')],'id');this[_0x0bd5('0xb')][_0x0bd5('0xe')]=_0x4d7d17;};SmsQueue[_0x0bd5('0xd')][_0x0bd5('0xf')]=function(){this[_0x0bd5('0x10')]=0x0;this[_0x0bd5('0x11')]=0x0;for(var _0x1e961d=0x0;_0x1e961d=0x0?this[_0x0bd5('0x14')]:0x0;var _0x23be38={'id':this['id'],'available':this[_0x0bd5('0x14')],'loggedIn':this[_0x0bd5('0x10')],'name':this[_0x0bd5('0x7')],'paused':this[_0x0bd5('0x11')],'waiting':this[_0x0bd5('0x15')]};var _0x415d8f=md5(JSON[_0x0bd5('0x16')](_0x23be38));if(this[_0x0bd5('0x1')]!==_0x415d8f){this['md5']=_0x415d8f;io['to'](util['format']('sms:queue:%s',_0x23be38['name']))['emit'](_0x0bd5('0x17'),_0x23be38);}};module[_0x0bd5('0x18')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index f1e1a52..1e2c5af 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 _0x7923=['format','whatsapp:queue:%s','emit','whatsapp_queue:save','md5','ioredis','../../../config/environment','redis','defaults','localhost','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','paused','length','online','whatsappPause','available','loggedIn','stringify'];(function(_0x23e8d4,_0xa3b304){var _0x27772e=function(_0x4c02cf){while(--_0x4c02cf){_0x23e8d4['push'](_0x23e8d4['shift']());}};_0x27772e(++_0xa3b304);}(_0x7923,0xc1));var _0x3792=function(_0x38526a,_0x548fa6){_0x38526a=_0x38526a-0x0;var _0x539de7=_0x7923[_0x38526a];return _0x539de7;};'use strict';var _=require('lodash');var md5=require(_0x3792('0x0'));var util=require('util');var Redis=require(_0x3792('0x1'));var config=require(_0x3792('0x2'));config[_0x3792('0x3')]=_[_0x3792('0x4')](config['redis'],{'host':_0x3792('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3792('0x3')]));function WhatsappQueue(_0x392c7d){this['id']=_0x392c7d['id']||0x0;this[_0x3792('0x6')]=_0x392c7d[_0x3792('0x6')]||'';this[_0x3792('0x7')]=_0x392c7d[_0x3792('0x7')]||0xa;this[_0x3792('0x8')]=_0x392c7d[_0x3792('0x8')]||'beepall';this[_0x3792('0x9')]=_0x392c7d['Agents'];this['mapAgentsId']={};this[_0x3792('0xa')]=0x0;this[_0x3792('0x0')]='';this[_0x3792('0xb')]();this[_0x3792('0xc')]();}WhatsappQueue[_0x3792('0xd')][_0x3792('0xb')]=function(){var _0x391202=this[_0x3792('0xe')]['_rr'];this[_0x3792('0xe')]=_[_0x3792('0xf')](this[_0x3792('0x9')],'id');this[_0x3792('0xe')]['_rr']=_0x391202;};WhatsappQueue[_0x3792('0xd')][_0x3792('0xc')]=function(){this['loggedIn']=0x0;this[_0x3792('0x10')]=0x0;for(var _0x19e526=0x0;_0x19e526=0x0?this[_0x3792('0x14')]:0x0;var _0x48f4fc={'id':this['id'],'available':this['available'],'loggedIn':this[_0x3792('0x15')],'name':this[_0x3792('0x6')],'paused':this['paused'],'waiting':this[_0x3792('0xa')]};var _0x1374ef=md5(JSON[_0x3792('0x16')](_0x48f4fc));if(this[_0x3792('0x0')]!==_0x1374ef){this[_0x3792('0x0')]=_0x1374ef;io['to'](util[_0x3792('0x17')](_0x3792('0x18'),_0x48f4fc[_0x3792('0x6')]))[_0x3792('0x19')](_0x3792('0x1a'),_0x48f4fc);}};module['exports']=WhatsappQueue; \ No newline at end of file +var _0x9319=['mapAgentsId','waiting','md5','updateRealtime','_rr','prototype','loggedIn','paused','length','available','whatsapp:queue:%s','whatsapp_queue:save','exports','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents'];(function(_0x16a028,_0x579f68){var _0x3c4d45=function(_0x1faad8){while(--_0x1faad8){_0x16a028['push'](_0x16a028['shift']());}};_0x3c4d45(++_0x579f68);}(_0x9319,0xc5));var _0x9931=function(_0xc041de,_0x20d476){_0xc041de=_0xc041de-0x0;var _0xdfdc01=_0x9319[_0xc041de];return _0xdfdc01;};'use strict';var _=require('lodash');var md5=require('md5');var util=require(_0x9931('0x0'));var Redis=require(_0x9931('0x1'));var config=require(_0x9931('0x2'));config[_0x9931('0x3')]=_[_0x9931('0x4')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x9931('0x5'))(new Redis(config['redis']));function WhatsappQueue(_0x461095){this['id']=_0x461095['id']||0x0;this['name']=_0x461095['name']||'';this[_0x9931('0x6')]=_0x461095[_0x9931('0x6')]||0xa;this[_0x9931('0x7')]=_0x461095[_0x9931('0x7')]||_0x9931('0x8');this[_0x9931('0x9')]=_0x461095[_0x9931('0x9')];this[_0x9931('0xa')]={};this[_0x9931('0xb')]=0x0;this[_0x9931('0xc')]='';this['updateRouting']();this[_0x9931('0xd')]();}WhatsappQueue['prototype']['updateRouting']=function(){var _0x27c024=this[_0x9931('0xa')][_0x9931('0xe')];this[_0x9931('0xa')]=_['map'](this['Agents'],'id');this[_0x9931('0xa')][_0x9931('0xe')]=_0x27c024;};WhatsappQueue[_0x9931('0xf')][_0x9931('0xd')]=function(){this[_0x9931('0x10')]=0x0;this[_0x9931('0x11')]=0x0;for(var _0x4273db=0x0;_0x4273db=0x0?this[_0x9931('0x13')]:0x0;var _0x318a20={'id':this['id'],'available':this[_0x9931('0x13')],'loggedIn':this[_0x9931('0x10')],'name':this['name'],'paused':this['paused'],'waiting':this[_0x9931('0xb')]};var _0x5e0606=md5(JSON['stringify'](_0x318a20));if(this['md5']!==_0x5e0606){this[_0x9931('0xc')]=_0x5e0606;io['to'](util['format'](_0x9931('0x14'),_0x318a20['name']))['emit'](_0x9931('0x15'),_0x318a20);}};module[_0x9931('0x16')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index f77b36a..24ff114 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 _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x9d7afe,_0x3feea4){var _0x1109c2=function(_0x4d787a){while(--_0x4d787a){_0x9d7afe['push'](_0x9d7afe['shift']());}};_0x1109c2(++_0x3feea4);}(_0xb10b,0x12a));var _0xbb10=function(_0x41c99a,_0x12414d){_0x41c99a=_0x41c99a-0x0;var _0x303bf9=_0xb10b[_0x41c99a];return _0x303bf9;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x480fbc,_0x52c4bf){var _0x4883b5=function(_0x497fc5){while(--_0x497fc5){_0x480fbc['push'](_0x480fbc['shift']());}};_0x4883b5(++_0x52c4bf);}(_0xb10b,0x12a));var _0xbb10=function(_0x58999b,_0xea4695){_0x58999b=_0x58999b-0x0;var _0x5efc3a=_0xb10b[_0x58999b];return _0x5efc3a;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 169f2cb..092a267 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 _0x9dc2=['update','Request','UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction'];(function(_0xea8947,_0x1b573d){var _0x2455e9=function(_0x18771e){while(--_0x18771e){_0xea8947['push'](_0xea8947['shift']());}};_0x2455e9(++_0x1b573d);}(_0x9dc2,0xa2));var _0x29dc=function(_0x5b597d,_0xfab835){_0x5b597d=_0x5b597d-0x0;var _0x2d86f8=_0x9dc2[_0x5b597d];return _0x2d86f8;};'use strict';var client=require('../client');exports[_0x29dc('0x0')]=function(_0x27d4b0,_0xae41a5){return client[_0x29dc('0x1')](_0x29dc('0x2'),{'body':_0xae41a5,'options':{'where':{'id':_0x27d4b0}},'log':_0x29dc('0x3')});};exports[_0x29dc('0x4')]=function(_0x56ab2c,_0x29de30){return client[_0x29dc('0x1')](_0x29dc('0x5'),{'body':_0x29de30,'options':{'where':{'id':_0x56ab2c}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x604a=['../client','update','updateChatInteraction','addTags','Request','AddTagsToChatInteraction','addTagsToChatInteraction'];(function(_0x3a3964,_0xe88edb){var _0x1b74aa=function(_0x3ca00f){while(--_0x3ca00f){_0x3a3964['push'](_0x3a3964['shift']());}};_0x1b74aa(++_0xe88edb);}(_0x604a,0x1e3));var _0xa604=function(_0x22cec6,_0x3b5227){_0x22cec6=_0x22cec6-0x0;var _0x2276fb=_0x604a[_0x22cec6];return _0x2276fb;};'use strict';var client=require(_0xa604('0x0'));exports[_0xa604('0x1')]=function(_0x43094b,_0x90497d){return client['Request']('UpdateChatInteraction',{'body':_0x90497d,'options':{'where':{'id':_0x43094b}},'log':_0xa604('0x2')});};exports[_0xa604('0x3')]=function(_0x55f4b0,_0x1ae016){return client[_0xa604('0x4')](_0xa604('0x5'),{'body':_0x1ae016,'options':{'where':{'id':_0x55f4b0}},'log':_0xa604('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 1adec82..c45eff1 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 _0xaac0=['createChatMessage','../client','create','Request','CreateChatMessage'];(function(_0x4cb733,_0x1de296){var _0x195e93=function(_0x9de906){while(--_0x9de906){_0x4cb733['push'](_0x4cb733['shift']());}};_0x195e93(++_0x1de296);}(_0xaac0,0x83));var _0x0aac=function(_0x4baa11,_0x7c6290){_0x4baa11=_0x4baa11-0x0;var _0x219273=_0xaac0[_0x4baa11];return _0x219273;};'use strict';var client=require(_0x0aac('0x0'));exports[_0x0aac('0x1')]=function(_0x4526f0){return client[_0x0aac('0x2')](_0x0aac('0x3'),{'body':_0x4526f0,'log':_0x0aac('0x4')});}; \ No newline at end of file +var _0x287c=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x287c,0xe5));var _0xc287=function(_0x32ded5,_0x24c39b){_0x32ded5=_0x32ded5-0x0;var _0xea10d3=_0x287c[_0x32ded5];return _0xea10d3;};'use strict';var client=require(_0xc287('0x0'));exports[_0xc287('0x1')]=function(_0x5c7571){return client[_0xc287('0x2')](_0xc287('0x3'),{'body':_0x5c7571,'log':_0xc287('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 1e34ef0..f4e3343 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 _0xbeea=['name','strategy','Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue'];(function(_0x57ee21,_0x5cc6be){var _0x58492b=function(_0x5cfcb5){while(--_0x5cfcb5){_0x57ee21['push'](_0x57ee21['shift']());}};_0x58492b(++_0x5cc6be);}(_0xbeea,0xb1));var _0xabee=function(_0x1d7e99,_0xd29d19){_0x1d7e99=_0x1d7e99-0x0;var _0xd3e019=_0xbeea[_0x1d7e99];return _0xd3e019;};'use strict';var client=require(_0xabee('0x0'));exports['getChatQueues']=function(){return function(){return client[_0xabee('0x1')](_0xabee('0x2'),{'options':{'raw':![],'attributes':['id',_0xabee('0x3'),'timeout',_0xabee('0x4')],'include':[{'model':'User','as':_0xabee('0x5'),'attributes':['id',_0xabee('0x3'),_0xabee('0x6'),_0xabee('0x7')]}]},'log':_0xabee('0x8')});};}; \ No newline at end of file +var _0x1cb9=['Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue','name','timeout','User'];(function(_0x2d77b0,_0x3fa58e){var _0x4955eb=function(_0x159ec5){while(--_0x159ec5){_0x2d77b0['push'](_0x2d77b0['shift']());}};_0x4955eb(++_0x3fa58e);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1d3366,_0x11dca7){_0x1d3366=_0x1d3366-0x0;var _0x4bad5c=_0x1cb9[_0x1d3366];return _0x4bad5c;};'use strict';var client=require(_0x91cb('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x91cb('0x1')](_0x91cb('0x2'),{'options':{'raw':![],'attributes':['id',_0x91cb('0x3'),_0x91cb('0x4'),'strategy'],'include':[{'model':_0x91cb('0x5'),'as':_0x91cb('0x6'),'attributes':['id','name',_0x91cb('0x7'),_0x91cb('0x8')]}]},'log':_0x91cb('0x9')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 0cc7c50..2ff0dbc 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 _0xfdb5=['update','Request','DESC','../client','create','CreateChatQueueReport'];(function(_0x1e8a20,_0x76e809){var _0x1d54f1=function(_0x2a45d6){while(--_0x2a45d6){_0x1e8a20['push'](_0x1e8a20['shift']());}};_0x1d54f1(++_0x76e809);}(_0xfdb5,0x12f));var _0x5fdb=function(_0x44946b,_0xf874ec){_0x44946b=_0x44946b-0x0;var _0x249bc4=_0xfdb5[_0x44946b];return _0x249bc4;};'use strict';var client=require(_0x5fdb('0x0'));exports[_0x5fdb('0x1')]=function(_0x18abfe){return client['Request'](_0x5fdb('0x2'),{'body':_0x18abfe,'log':_0x5fdb('0x2')});};exports[_0x5fdb('0x3')]=function(_0x49fd4d,_0x55124b){return client[_0x5fdb('0x4')]('UpdateChatQueueReport',{'body':_0x55124b,'options':{'where':{'uniqueid':_0x49fd4d},'order':[['id',_0x5fdb('0x5')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0x80c7=['update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x20ea1f,_0x3c6534){var _0x35422a=function(_0x7327db){while(--_0x7327db){_0x20ea1f['push'](_0x20ea1f['shift']());}};_0x35422a(++_0x3c6534);}(_0x80c7,0x8d));var _0x780c=function(_0x1d8c1a,_0x412982){_0x1d8c1a=_0x1d8c1a-0x0;var _0x4a6fff=_0x80c7[_0x1d8c1a];return _0x4a6fff;};'use strict';var client=require(_0x780c('0x0'));exports[_0x780c('0x1')]=function(_0x2c48bf){return client[_0x780c('0x2')]('CreateChatQueueReport',{'body':_0x2c48bf,'log':'CreateChatQueueReport'});};exports[_0x780c('0x3')]=function(_0x5af044,_0x3a8676){return client[_0x780c('0x2')](_0x780c('0x4'),{'body':_0x3a8676,'options':{'where':{'uniqueid':_0x5af044},'order':[['id',_0x780c('0x5')]],'limit':0x1},'log':_0x780c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 92d1b6f..44abf3a 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 _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x1e6e4e,_0x2b1b09){var _0x3d746b=function(_0x4483dd){while(--_0x4483dd){_0x1e6e4e['push'](_0x1e6e4e['shift']());}};_0x3d746b(++_0x2b1b09);}(_0x7a54,0x106));var _0x47a5=function(_0x3bfaec,_0x19f428){_0x3bfaec=_0x3bfaec-0x0;var _0x4f492e=_0x7a54[_0x3bfaec];return _0x4f492e;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x184636,_0x536607){var _0x3b5d62=function(_0x3221f5){while(--_0x3221f5){_0x184636['push'](_0x184636['shift']());}};_0x3b5d62(++_0x536607);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'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 051a512..634dc91 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 _0xfe6d=['createFaxMessage','../client','create','Request','CreateFaxMessage'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0xfe6d,0x1d2));var _0xdfe6=function(_0x191154,_0x56f74c){_0x191154=_0x191154-0x0;var _0x3dcd73=_0xfe6d[_0x191154];return _0x3dcd73;};'use strict';var client=require(_0xdfe6('0x0'));exports[_0xdfe6('0x1')]=function(_0x294d90){return client[_0xdfe6('0x2')](_0xdfe6('0x3'),{'body':_0x294d90,'log':_0xdfe6('0x4')});}; \ No newline at end of file +var _0xf58b=['createFaxMessage','../client','Request','CreateFaxMessage'];(function(_0x5e62c1,_0x327ca2){var _0x12fde7=function(_0xc7a435){while(--_0xc7a435){_0x5e62c1['push'](_0x5e62c1['shift']());}};_0x12fde7(++_0x327ca2);}(_0xf58b,0x121));var _0xbf58=function(_0x412b2a,_0x11fb8a){_0x412b2a=_0x412b2a-0x0;var _0x5872e3=_0xf58b[_0x412b2a];return _0x5872e3;};'use strict';var client=require(_0xbf58('0x0'));exports['create']=function(_0x32da83){return client[_0xbf58('0x1')](_0xbf58('0x2'),{'body':_0x32da83,'log':_0xbf58('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index a53c3ba..61f8800 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 _0x6435=['name','timeout','strategy','Agents','online','faxPause','../client','getFaxQueues','Request','GetFaxQueue'];(function(_0x30e7f4,_0x2ef143){var _0x5c24da=function(_0x283d39){while(--_0x283d39){_0x30e7f4['push'](_0x30e7f4['shift']());}};_0x5c24da(++_0x2ef143);}(_0x6435,0x114));var _0x5643=function(_0x20ba56,_0x54edf3){_0x20ba56=_0x20ba56-0x0;var _0x561e8d=_0x6435[_0x20ba56];return _0x561e8d;};'use strict';var client=require(_0x5643('0x0'));exports[_0x5643('0x1')]=function(){return function(){return client[_0x5643('0x2')](_0x5643('0x3'),{'options':{'raw':![],'attributes':['id',_0x5643('0x4'),_0x5643('0x5'),_0x5643('0x6')],'include':[{'model':'User','as':_0x5643('0x7'),'attributes':['id',_0x5643('0x4'),_0x5643('0x8'),_0x5643('0x9')]}]},'log':_0x5643('0x1')});};}; \ No newline at end of file +var _0x9cc6=['Agents','online','faxPause','../client','getFaxQueues','name','timeout','strategy'];(function(_0x550244,_0x1bee94){var _0x1d9dcd=function(_0x17409f){while(--_0x17409f){_0x550244['push'](_0x550244['shift']());}};_0x1d9dcd(++_0x1bee94);}(_0x9cc6,0xb3));var _0x69cc=function(_0x3cf4d3,_0x48065e){_0x3cf4d3=_0x3cf4d3-0x0;var _0x4e547b=_0x9cc6[_0x3cf4d3];return _0x4e547b;};'use strict';var client=require(_0x69cc('0x0'));exports[_0x69cc('0x1')]=function(){return function(){return client['Request']('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x69cc('0x2'),_0x69cc('0x3'),_0x69cc('0x4')],'include':[{'model':'User','as':_0x69cc('0x5'),'attributes':['id','name',_0x69cc('0x6'),_0x69cc('0x7')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 341c302..f9bc24e 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 _0x31ee=['UpdateFaxQueueReport','DESC','../client','create','Request','CreateFaxQueueReport'];(function(_0x3de8b5,_0x2f1b53){var _0x378df9=function(_0x3316ec){while(--_0x3316ec){_0x3de8b5['push'](_0x3de8b5['shift']());}};_0x378df9(++_0x2f1b53);}(_0x31ee,0xaa));var _0xe31e=function(_0xbc2760,_0x22f739){_0xbc2760=_0xbc2760-0x0;var _0x1515f6=_0x31ee[_0xbc2760];return _0x1515f6;};'use strict';var client=require(_0xe31e('0x0'));exports[_0xe31e('0x1')]=function(_0x53d29e){return client[_0xe31e('0x2')]('CreateFaxQueueReport',{'body':_0x53d29e,'log':_0xe31e('0x3')});};exports['update']=function(_0x18ebe5,_0x490d5c){return client[_0xe31e('0x2')](_0xe31e('0x4'),{'body':_0x490d5c,'options':{'where':{'uniqueid':_0x18ebe5},'order':[['id',_0xe31e('0x5')]],'limit':0x1},'log':_0xe31e('0x4')});}; \ No newline at end of file +var _0xbd03=['../client','CreateFaxQueueReport','update','Request','UpdateFaxQueueReport'];(function(_0x48a0dd,_0x4b736b){var _0x1e4d82=function(_0x28dc0c){while(--_0x28dc0c){_0x48a0dd['push'](_0x48a0dd['shift']());}};_0x1e4d82(++_0x4b736b);}(_0xbd03,0x1bd));var _0x3bd0=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xbd03[_0xf0bcac];return _0x4e4c65;};'use strict';var client=require(_0x3bd0('0x0'));exports['create']=function(_0x185e5d){return client['Request']('CreateFaxQueueReport',{'body':_0x185e5d,'log':_0x3bd0('0x1')});};exports[_0x3bd0('0x2')]=function(_0x33ea28,_0x7b8855){return client[_0x3bd0('0x3')](_0x3bd0('0x4'),{'body':_0x7b8855,'options':{'where':{'uniqueid':_0x33ea28},'order':[['id','DESC']],'limit':0x1},'log':_0x3bd0('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index bacc841..b111451 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 _0x1b50=['Interval','Intervals','interval','../client','getIntervals','GetInterval','name'];(function(_0x4e6cbb,_0x3450f0){var _0x15ced4=function(_0x248dd2){while(--_0x248dd2){_0x4e6cbb['push'](_0x4e6cbb['shift']());}};_0x15ced4(++_0x3450f0);}(_0x1b50,0x1a7));var _0x01b5=function(_0x36547c,_0x49f530){_0x36547c=_0x36547c-0x0;var _0x409167=_0x1b50[_0x36547c];return _0x409167;};'use strict';var client=require(_0x01b5('0x0'));exports[_0x01b5('0x1')]=function(){return function(){return client['Request'](_0x01b5('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x01b5('0x3')],'include':[{'model':_0x01b5('0x4'),'as':_0x01b5('0x5'),'attributes':['id',_0x01b5('0x3'),_0x01b5('0x6')]}]},'log':'getIntervals'});};}; \ No newline at end of file +var _0x396f=['../client','getIntervals','Request','GetInterval','interval'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x396f,0x12c));var _0xf396=function(_0x475dcb,_0x1b0c5c){_0x475dcb=_0x475dcb-0x0;var _0x533633=_0x396f[_0x475dcb];return _0x533633;};'use strict';var client=require(_0xf396('0x0'));exports[_0xf396('0x1')]=function(){return function(){return client[_0xf396('0x2')](_0xf396('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':'Interval','as':'Intervals','attributes':['id','name',_0xf396('0x4')]}]},'log':_0xf396('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index cf8ffc8..22890db 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 _0x5204=['update','Request','UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','../client'];(function(_0x5e8d3e,_0x18ed2e){var _0x1348c0=function(_0x5a889f){while(--_0x5a889f){_0x5e8d3e['push'](_0x5e8d3e['shift']());}};_0x1348c0(++_0x18ed2e);}(_0x5204,0xdf));var _0x4520=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x5204[_0x2a55f8];return _0x245efd;};'use strict';var client=require(_0x4520('0x0'));exports[_0x4520('0x1')]=function(_0x53b1ab,_0x12a3a1){return client[_0x4520('0x2')](_0x4520('0x3'),{'body':_0x12a3a1,'options':{'where':{'id':_0x53b1ab}},'log':_0x4520('0x4')});};exports[_0x4520('0x5')]=function(_0x592fe0,_0x41d89c){return client['Request'](_0x4520('0x6'),{'body':_0x41d89c,'options':{'where':{'id':_0x592fe0}},'log':_0x4520('0x7')});}; \ No newline at end of file +var _0x5b12=['addTagsToChatInteraction','../client','update','Request','updateMailInteraction','addTags'];(function(_0x786fc2,_0x4b99c4){var _0x247acf=function(_0x23d795){while(--_0x23d795){_0x786fc2['push'](_0x786fc2['shift']());}};_0x247acf(++_0x4b99c4);}(_0x5b12,0xa3));var _0x25b1=function(_0x9e199e,_0x4c4f1e){_0x9e199e=_0x9e199e-0x0;var _0x194573=_0x5b12[_0x9e199e];return _0x194573;};'use strict';var client=require(_0x25b1('0x0'));exports[_0x25b1('0x1')]=function(_0x1fe5c1,_0x569948){return client[_0x25b1('0x2')]('UpdateMailInteraction',{'body':_0x569948,'options':{'where':{'id':_0x1fe5c1}},'log':_0x25b1('0x3')});};exports[_0x25b1('0x4')]=function(_0x47995b,_0x31f3fc){return client['Request']('AddTagsToMailInteraction',{'body':_0x31f3fc,'options':{'where':{'id':_0x47995b}},'log':_0x25b1('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 490adbe..37ad254 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 _0xd27c=['createMailMessage','../client','create','Request'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd27c,0xf1));var _0xcd27=function(_0x3f8743,_0x33973f){_0x3f8743=_0x3f8743-0x0;var _0x1f844c=_0xd27c[_0x3f8743];return _0x1f844c;};'use strict';var client=require(_0xcd27('0x0'));exports[_0xcd27('0x1')]=function(_0x2e68da){return client[_0xcd27('0x2')]('CreateMailMessage',{'body':_0x2e68da,'log':_0xcd27('0x3')});}; \ No newline at end of file +var _0xe3d1=['Request','CreateMailMessage','createMailMessage','../client','create'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe3d1,0x8f));var _0x1e3d=function(_0x106214,_0x454b8d){_0x106214=_0x106214-0x0;var _0x5f5cea=_0xe3d1[_0x106214];return _0x5f5cea;};'use strict';var client=require(_0x1e3d('0x0'));exports[_0x1e3d('0x1')]=function(_0x8f482c){return client[_0x1e3d('0x2')](_0x1e3d('0x3'),{'body':_0x8f482c,'log':_0x1e3d('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index f99ab1d..4ba2b4f 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 _0xa177=['mailPause','getMailQueues','Request','GetMailQueue','name','timeout','strategy','online'];(function(_0xf05dd,_0x35f3a2){var _0x40fe13=function(_0x4ed094){while(--_0x4ed094){_0xf05dd['push'](_0xf05dd['shift']());}};_0x40fe13(++_0x35f3a2);}(_0xa177,0xca));var _0x7a17=function(_0x3e291f,_0x1118eb){_0x3e291f=_0x3e291f-0x0;var _0x57d9c1=_0xa177[_0x3e291f];return _0x57d9c1;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x7a17('0x0')](_0x7a17('0x1'),{'options':{'raw':![],'attributes':['id',_0x7a17('0x2'),_0x7a17('0x3'),_0x7a17('0x4')],'include':[{'model':'User','as':'Agents','attributes':['id',_0x7a17('0x2'),_0x7a17('0x5'),_0x7a17('0x6')]}]},'log':_0x7a17('0x7')});};}; \ No newline at end of file +var _0xddbd=['Request','GetMailQueue','strategy','Agents','name','online','mailPause','getMailQueues'];(function(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0xddbd,0x18f));var _0xdddb=function(_0x2f227c,_0x360c3a){_0x2f227c=_0x2f227c-0x0;var _0x5032bc=_0xddbd[_0x2f227c];return _0x5032bc;};'use strict';var client=require('../client');exports[_0xdddb('0x0')]=function(){return function(){return client[_0xdddb('0x1')](_0xdddb('0x2'),{'options':{'raw':![],'attributes':['id','name','timeout',_0xdddb('0x3')],'include':[{'model':'User','as':_0xdddb('0x4'),'attributes':['id',_0xdddb('0x5'),_0xdddb('0x6'),_0xdddb('0x7')]}]},'log':_0xdddb('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index db2c1f7..3fa6a98 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 _0xa182=['../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x534279,_0x327fb4){var _0x3ca369=function(_0x314bbd){while(--_0x314bbd){_0x534279['push'](_0x534279['shift']());}};_0x3ca369(++_0x327fb4);}(_0xa182,0xae));var _0x2a18=function(_0x944c79,_0x4f6e91){_0x944c79=_0x944c79-0x0;var _0x1fe449=_0xa182[_0x944c79];return _0x1fe449;};'use strict';var client=require(_0x2a18('0x0'));exports[_0x2a18('0x1')]=function(_0xd4f137){return client[_0x2a18('0x2')](_0x2a18('0x3'),{'body':_0xd4f137,'log':_0x2a18('0x3')});};exports[_0x2a18('0x4')]=function(_0x1a67a4,_0x8f6f44){return client[_0x2a18('0x2')](_0x2a18('0x5'),{'body':_0x8f6f44,'options':{'where':{'uniqueid':_0x1a67a4},'order':[['id','DESC']],'limit':0x1},'log':_0x2a18('0x5')});}; \ No newline at end of file +var _0x8cb0=['UpdateMailQueueReport','create','Request','CreateMailQueueReport','update'];(function(_0x147208,_0x255f74){var _0x9daa52=function(_0x4360a3){while(--_0x4360a3){_0x147208['push'](_0x147208['shift']());}};_0x9daa52(++_0x255f74);}(_0x8cb0,0x14b));var _0x08cb=function(_0xf98a1,_0xcf1426){_0xf98a1=_0xf98a1-0x0;var _0xe81382=_0x8cb0[_0xf98a1];return _0xe81382;};'use strict';var client=require('../client');exports[_0x08cb('0x0')]=function(_0x1597a2){return client[_0x08cb('0x1')]('CreateMailQueueReport',{'body':_0x1597a2,'log':_0x08cb('0x2')});};exports[_0x08cb('0x3')]=function(_0x386f8a,_0x28899c){return client[_0x08cb('0x1')](_0x08cb('0x4'),{'body':_0x28899c,'options':{'where':{'uniqueid':_0x386f8a},'order':[['id','DESC']],'limit':0x1},'log':_0x08cb('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 78e03c2..7c70850 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 _0xbd99=['addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','Request','updateOpenchannelInteraction'];(function(_0x2e775c,_0x5ead94){var _0xffcb62=function(_0xae6ff1){while(--_0xae6ff1){_0x2e775c['push'](_0x2e775c['shift']());}};_0xffcb62(++_0x5ead94);}(_0xbd99,0x1df));var _0x9bd9=function(_0x22a621,_0x388265){_0x22a621=_0x22a621-0x0;var _0x973807=_0xbd99[_0x22a621];return _0x973807;};'use strict';var client=require(_0x9bd9('0x0'));exports[_0x9bd9('0x1')]=function(_0x4af32e,_0x5f1b5f){return client[_0x9bd9('0x2')]('UpdateOpenchannelInteraction',{'body':_0x5f1b5f,'options':{'where':{'id':_0x4af32e}},'log':_0x9bd9('0x3')});};exports[_0x9bd9('0x4')]=function(_0x1369ea,_0x25acc7){return client[_0x9bd9('0x2')](_0x9bd9('0x5'),{'body':_0x25acc7,'options':{'where':{'id':_0x1369ea}},'log':_0x9bd9('0x6')});}; \ No newline at end of file +var _0x663f=['../client','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x1e4e55,_0x537fd5){var _0x23ff83=function(_0x7dbb6c){while(--_0x7dbb6c){_0x1e4e55['push'](_0x1e4e55['shift']());}};_0x23ff83(++_0x537fd5);}(_0x663f,0x85));var _0xf663=function(_0x5f1cf8,_0x5e0923){_0x5f1cf8=_0x5f1cf8-0x0;var _0x27d0fa=_0x663f[_0x5f1cf8];return _0x27d0fa;};'use strict';var client=require(_0xf663('0x0'));exports['update']=function(_0x4b042a,_0x3c7170){return client['Request'](_0xf663('0x1'),{'body':_0x3c7170,'options':{'where':{'id':_0x4b042a}},'log':_0xf663('0x2')});};exports[_0xf663('0x3')]=function(_0x464f83,_0x1ade73){return client[_0xf663('0x4')](_0xf663('0x5'),{'body':_0x1ade73,'options':{'where':{'id':_0x464f83}},'log':_0xf663('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 773c896..5f1e8cd 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 _0x44db=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x1fb772,_0xfa4715){var _0x3a0f45=function(_0x1ea764){while(--_0x1ea764){_0x1fb772['push'](_0x1fb772['shift']());}};_0x3a0f45(++_0xfa4715);}(_0x44db,0x7b));var _0xb44d=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0x44db[_0x2c5255];return _0x30d0ea;};'use strict';var client=require(_0xb44d('0x0'));exports[_0xb44d('0x1')]=function(_0xab51a7){return client[_0xb44d('0x2')](_0xb44d('0x3'),{'body':_0xab51a7,'log':_0xb44d('0x4')});}; \ No newline at end of file +var _0xc459=['createOpenchannelMessage','../client','create','Request','CreateOpenchannelMessage'];(function(_0x3e6d58,_0x187f7b){var _0x35c8d4=function(_0x4ccd7d){while(--_0x4ccd7d){_0x3e6d58['push'](_0x3e6d58['shift']());}};_0x35c8d4(++_0x187f7b);}(_0xc459,0xbf));var _0x9c45=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc459[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0x9c45('0x0'));exports[_0x9c45('0x1')]=function(_0x33a734){return client[_0x9c45('0x2')](_0x9c45('0x3'),{'body':_0x33a734,'log':_0x9c45('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index e77f19e..04ebdd9 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 _0xcc34=['User','Agents','online','openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xcc34,0x112));var _0x4cc3=function(_0x20a38d,_0x22768c){_0x20a38d=_0x20a38d-0x0;var _0x5480f8=_0xcc34[_0x20a38d];return _0x5480f8;};'use strict';var client=require('../client');exports[_0x4cc3('0x0')]=function(){return function(){return client[_0x4cc3('0x1')](_0x4cc3('0x2'),{'options':{'raw':![],'attributes':['id',_0x4cc3('0x3'),_0x4cc3('0x4'),_0x4cc3('0x5')],'include':[{'model':_0x4cc3('0x6'),'as':_0x4cc3('0x7'),'attributes':['id',_0x4cc3('0x3'),_0x4cc3('0x8'),_0x4cc3('0x9')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x4a97=['getOpenchannelQueues','../client','Request','GetOpenchannelQueue','name','timeout','User'];(function(_0x525c7b,_0x488fcc){var _0x27b33e=function(_0x56d43b){while(--_0x56d43b){_0x525c7b['push'](_0x525c7b['shift']());}};_0x27b33e(++_0x488fcc);}(_0x4a97,0x1eb));var _0x74a9=function(_0x385c76,_0xb97335){_0x385c76=_0x385c76-0x0;var _0x5c8367=_0x4a97[_0x385c76];return _0x5c8367;};'use strict';var client=require(_0x74a9('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client[_0x74a9('0x1')](_0x74a9('0x2'),{'options':{'raw':![],'attributes':['id',_0x74a9('0x3'),_0x74a9('0x4'),'strategy'],'include':[{'model':_0x74a9('0x5'),'as':'Agents','attributes':['id',_0x74a9('0x3'),'online','openchannelPause']}]},'log':_0x74a9('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 053c805..1daba29 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 _0xc0ea=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','DESC','../client','create'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xc0ea,0x12a));var _0xac0e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc0ea[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0xac0e('0x0'));exports[_0xac0e('0x1')]=function(_0x39e4ff){return client[_0xac0e('0x2')](_0xac0e('0x3'),{'body':_0x39e4ff,'log':_0xac0e('0x3')});};exports['update']=function(_0x4be80d,_0x170232){return client[_0xac0e('0x2')](_0xac0e('0x4'),{'body':_0x170232,'options':{'where':{'uniqueid':_0x4be80d},'order':[['id',_0xac0e('0x5')]],'limit':0x1},'log':_0xac0e('0x4')});}; \ No newline at end of file +var _0xb477=['Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC','create'];(function(_0x178d0c,_0x515a2c){var _0x433802=function(_0x380cba){while(--_0x380cba){_0x178d0c['push'](_0x178d0c['shift']());}};_0x433802(++_0x515a2c);}(_0xb477,0x8f));var _0x7b47=function(_0x13e741,_0x5d3c24){_0x13e741=_0x13e741-0x0;var _0x3f8bb3=_0xb477[_0x13e741];return _0x3f8bb3;};'use strict';var client=require('../client');exports[_0x7b47('0x0')]=function(_0x12a8af){return client[_0x7b47('0x1')]('CreateOpenchannelQueueReport',{'body':_0x12a8af,'log':_0x7b47('0x2')});};exports[_0x7b47('0x3')]=function(_0x178ba9,_0x5ccfb5){return client[_0x7b47('0x1')](_0x7b47('0x4'),{'body':_0x5ccfb5,'options':{'where':{'uniqueid':_0x178ba9},'order':[['id',_0x7b47('0x5')]],'limit':0x1},'log':_0x7b47('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 933e4e7..70bf01e 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 _0x3435=['Request','UpdateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update'];(function(_0x2e7025,_0x187270){var _0x5373ed=function(_0x3405f2){while(--_0x3405f2){_0x2e7025['push'](_0x2e7025['shift']());}};_0x5373ed(++_0x187270);}(_0x3435,0xfa));var _0x5343=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0x3435[_0x2070da];return _0x4f9fe1;};'use strict';var client=require(_0x5343('0x0'));exports[_0x5343('0x1')]=function(_0x84fe04,_0x9ab4a3){return client[_0x5343('0x2')](_0x5343('0x3'),{'body':_0x9ab4a3,'options':{'where':{'id':_0x84fe04}},'log':'updateSmsInteraction'});};exports[_0x5343('0x4')]=function(_0x3ae07e,_0x578a24){return client['Request'](_0x5343('0x5'),{'body':_0x578a24,'options':{'where':{'id':_0x3ae07e}},'log':_0x5343('0x6')});}; \ No newline at end of file +var _0x919e=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x3382e5,_0x4bfaa8){var _0x5efe1a=function(_0x78eb1e){while(--_0x78eb1e){_0x3382e5['push'](_0x3382e5['shift']());}};_0x5efe1a(++_0x4bfaa8);}(_0x919e,0x1d7));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xe919('0x0'));exports[_0xe919('0x1')]=function(_0x24d2f4,_0x5d7d06){return client[_0xe919('0x2')]('UpdateSmsInteraction',{'body':_0x5d7d06,'options':{'where':{'id':_0x24d2f4}},'log':'updateSmsInteraction'});};exports[_0xe919('0x3')]=function(_0x3a1192,_0x2bf552){return client[_0xe919('0x2')](_0xe919('0x4'),{'body':_0x2bf552,'options':{'where':{'id':_0x3a1192}},'log':_0xe919('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 44c6395..2f5a61e 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 _0x0e18=['create','Request'];(function(_0x432486,_0x5a6b72){var _0x2ec3e4=function(_0x16068c){while(--_0x16068c){_0x432486['push'](_0x432486['shift']());}};_0x2ec3e4(++_0x5a6b72);}(_0x0e18,0xa8));var _0x80e1=function(_0xb28acd,_0x400230){_0xb28acd=_0xb28acd-0x0;var _0x50b827=_0x0e18[_0xb28acd];return _0x50b827;};'use strict';var client=require('../client');exports[_0x80e1('0x0')]=function(_0x5bd82e){return client[_0x80e1('0x1')]('CreateSmsMessage',{'body':_0x5bd82e,'log':'createSmsMessage'});}; \ No newline at end of file +var _0x0583=['../client','Request'];(function(_0x51c72f,_0x26ff76){var _0x53fccd=function(_0x3146a1){while(--_0x3146a1){_0x51c72f['push'](_0x51c72f['shift']());}};_0x53fccd(++_0x26ff76);}(_0x0583,0x12c));var _0x3058=function(_0x573a1c,_0x3a475d){_0x573a1c=_0x573a1c-0x0;var _0x1a5aab=_0x0583[_0x573a1c];return _0x1a5aab;};'use strict';var client=require(_0x3058('0x0'));exports['create']=function(_0x57eec4){return client[_0x3058('0x1')]('CreateSmsMessage',{'body':_0x57eec4,'log':'createSmsMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index daf7648..ac11b29 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 _0x70e0=['User','Agents','online','../client','getSmsQueues','Request','timeout','strategy'];(function(_0x3c9b9e,_0xf6fe69){var _0x22f52d=function(_0x16f863){while(--_0x16f863){_0x3c9b9e['push'](_0x3c9b9e['shift']());}};_0x22f52d(++_0xf6fe69);}(_0x70e0,0x17b));var _0x070e=function(_0x57543c,_0x124aff){_0x57543c=_0x57543c-0x0;var _0x4114b2=_0x70e0[_0x57543c];return _0x4114b2;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(){return function(){return client[_0x070e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x070e('0x3'),_0x070e('0x4')],'include':[{'model':_0x070e('0x5'),'as':_0x070e('0x6'),'attributes':['id','name',_0x070e('0x7'),'smsPause']}]},'log':_0x070e('0x1')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x4e6081,_0x5439c0){var _0x34e766=function(_0x4cabe7){while(--_0x4cabe7){_0x4e6081['push'](_0x4e6081['shift']());}};_0x34e766(++_0x5439c0);}(_0xb7e7,0x121));var _0x7b7e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xb7e7[_0x13ea00];return _0x1f7347;};'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 03a94a8..0914e6b 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 _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x7abd7,_0x1ca3f9){var _0x3a2577=function(_0x18456d){while(--_0x18456d){_0x7abd7['push'](_0x7abd7['shift']());}};_0x3a2577(++_0x1ca3f9);}(_0xedd9,0xfc));var _0x9edd=function(_0x403c00,_0x14a828){_0x403c00=_0x403c00-0x0;var _0x57985c=_0xedd9[_0x403c00];return _0x57985c;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x1e4c55,_0x1415eb){var _0x511ab5=function(_0x2958cb){while(--_0x2958cb){_0x1e4c55['push'](_0x1e4c55['shift']());}};_0x511ab5(++_0x1415eb);}(_0x008c,0x188));var _0xc008=function(_0x1eff1a,_0x5d05a9){_0x1eff1a=_0x1eff1a-0x0;var _0x478b4b=_0x008c[_0x1eff1a];return _0x478b4b;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index c84cb5f..da92a16 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(_0x332ded,_0x201a0a){var _0x30e8d2=function(_0x32a99b){while(--_0x32a99b){_0x332ded['push'](_0x332ded['shift']());}};_0x30e8d2(++_0x201a0a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'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(_0x36eeb5,_0x37a23c){var _0x3be311=function(_0x2af67e){while(--_0x2af67e){_0x36eeb5['push'](_0x36eeb5['shift']());}};_0x3be311(++_0x37a23c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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 eafef3a..cdde9dd 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 _0xdfa0=['addTags','AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','updateWhatsappInteraction'];(function(_0x1765dc,_0x17d194){var _0x5e7800=function(_0x6d8197){while(--_0x6d8197){_0x1765dc['push'](_0x1765dc['shift']());}};_0x5e7800(++_0x17d194);}(_0xdfa0,0x69));var _0x0dfa=function(_0x5ff16f,_0x4d53fb){_0x5ff16f=_0x5ff16f-0x0;var _0x3f6bc4=_0xdfa0[_0x5ff16f];return _0x3f6bc4;};'use strict';var client=require(_0x0dfa('0x0'));exports['update']=function(_0x277084,_0x37ab88){return client['Request'](_0x0dfa('0x1'),{'body':_0x37ab88,'options':{'where':{'id':_0x277084}},'log':_0x0dfa('0x2')});};exports[_0x0dfa('0x3')]=function(_0x4dbbab,_0x373c4e){return client['Request'](_0x0dfa('0x4'),{'body':_0x373c4e,'options':{'where':{'id':_0x4dbbab}},'log':_0x0dfa('0x5')});}; \ No newline at end of file +var _0x9536=['update','UpdateWhatsappInteraction','addTags','Request','AddTagsToWhatsappInteraction','../client'];(function(_0x330258,_0x341000){var _0x13e1f3=function(_0x589c63){while(--_0x589c63){_0x330258['push'](_0x330258['shift']());}};_0x13e1f3(++_0x341000);}(_0x9536,0x179));var _0x6953=function(_0x2f6f50,_0x1d21a7){_0x2f6f50=_0x2f6f50-0x0;var _0x2cf365=_0x9536[_0x2f6f50];return _0x2cf365;};'use strict';var client=require(_0x6953('0x0'));exports[_0x6953('0x1')]=function(_0x1a1c4e,_0x40b3c3){return client['Request'](_0x6953('0x2'),{'body':_0x40b3c3,'options':{'where':{'id':_0x1a1c4e}},'log':'updateWhatsappInteraction'});};exports[_0x6953('0x3')]=function(_0x3c32c7,_0x1dee7c){return client[_0x6953('0x4')](_0x6953('0x5'),{'body':_0x1dee7c,'options':{'where':{'id':_0x3c32c7}},'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 c96b6c1..71da0f1 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 _0x5923=['../client','create','Request','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x5923,0xc3));var _0x3592=function(_0x5ab238,_0x4ddda9){_0x5ab238=_0x5ab238-0x0;var _0x236db6=_0x5923[_0x5ab238];return _0x236db6;};'use strict';var client=require(_0x3592('0x0'));exports[_0x3592('0x1')]=function(_0x596b68){return client[_0x3592('0x2')](_0x3592('0x3'),{'body':_0x596b68,'log':_0x3592('0x4')});}; \ No newline at end of file +var _0xfe3c=['CreateWhatsappMessage','createWhatsappMessage','../client','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfe3c,0xaa));var _0xcfe3=function(_0x5803b3,_0x442c0f){_0x5803b3=_0x5803b3-0x0;var _0x886163=_0xfe3c[_0x5803b3];return _0x886163;};'use strict';var client=require(_0xcfe3('0x0'));exports['create']=function(_0x415183){return client[_0xcfe3('0x1')](_0xcfe3('0x2'),{'body':_0x415183,'log':_0xcfe3('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 606bc52..f9dc76c 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 _0x10ff=['strategy','User','Agents','name','online','../client','getWhatsappQueues','Request','timeout'];(function(_0x418b2b,_0xe25672){var _0x374ea6=function(_0x1b31b6){while(--_0x1b31b6){_0x418b2b['push'](_0x418b2b['shift']());}};_0x374ea6(++_0xe25672);}(_0x10ff,0x1f4));var _0xf10f=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x10ff[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xf10f('0x0'));exports[_0xf10f('0x1')]=function(){return function(){return client[_0xf10f('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id','name',_0xf10f('0x3'),_0xf10f('0x4')],'include':[{'model':_0xf10f('0x5'),'as':_0xf10f('0x6'),'attributes':['id',_0xf10f('0x7'),_0xf10f('0x8'),'whatsappPause']}]},'log':_0xf10f('0x1')});};}; \ No newline at end of file +var _0x8237=['GetWhatsappQueue','name','strategy','User','Agents','online','getWhatsappQueues','../client'];(function(_0x2ca2d0,_0x3ea8e4){var _0x521c23=function(_0x5b0731){while(--_0x5b0731){_0x2ca2d0['push'](_0x2ca2d0['shift']());}};_0x521c23(++_0x3ea8e4);}(_0x8237,0x117));var _0x7823=function(_0xbe4273,_0x5694a4){_0xbe4273=_0xbe4273-0x0;var _0x14d8b7=_0x8237[_0xbe4273];return _0x14d8b7;};'use strict';var client=require(_0x7823('0x0'));exports['getWhatsappQueues']=function(){return function(){return client['Request'](_0x7823('0x1'),{'options':{'raw':![],'attributes':['id',_0x7823('0x2'),'timeout',_0x7823('0x3')],'include':[{'model':_0x7823('0x4'),'as':_0x7823('0x5'),'attributes':['id','name',_0x7823('0x6'),'whatsappPause']}]},'log':_0x7823('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index b25e917..ad26f0c 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 _0xe9c5=['update','UpdateWhatsappQueueReport','../client','create','Request','CreateWhatsappQueueReport'];(function(_0xfa775,_0xac95e0){var _0x515801=function(_0xf9c694){while(--_0xf9c694){_0xfa775['push'](_0xfa775['shift']());}};_0x515801(++_0xac95e0);}(_0xe9c5,0x116));var _0x5e9c=function(_0x6ea75,_0x306a90){_0x6ea75=_0x6ea75-0x0;var _0x2080ff=_0xe9c5[_0x6ea75];return _0x2080ff;};'use strict';var client=require(_0x5e9c('0x0'));exports[_0x5e9c('0x1')]=function(_0x5d4e15){return client[_0x5e9c('0x2')]('CreateWhatsappQueueReport',{'body':_0x5d4e15,'log':_0x5e9c('0x3')});};exports[_0x5e9c('0x4')]=function(_0x3eb62a,_0x1e9d14){return client[_0x5e9c('0x2')]('UpdateWhatsappQueueReport',{'body':_0x1e9d14,'options':{'where':{'uniqueid':_0x3eb62a},'order':[['id','DESC']],'limit':0x1},'log':_0x5e9c('0x5')});}; \ No newline at end of file +var _0xa981=['create','CreateWhatsappQueueReport','Request','UpdateWhatsappQueueReport','DESC','../client'];(function(_0x432169,_0x7ffbe9){var _0x28e745=function(_0x810c68){while(--_0x810c68){_0x432169['push'](_0x432169['shift']());}};_0x28e745(++_0x7ffbe9);}(_0xa981,0x1c7));var _0x1a98=function(_0x169e53,_0x46be55){_0x169e53=_0x169e53-0x0;var _0x252bb3=_0xa981[_0x169e53];return _0x252bb3;};'use strict';var client=require(_0x1a98('0x0'));exports[_0x1a98('0x1')]=function(_0x162a00){return client['Request'](_0x1a98('0x2'),{'body':_0x162a00,'log':_0x1a98('0x2')});};exports['update']=function(_0x54a5b5,_0x13e94d){return client[_0x1a98('0x3')](_0x1a98('0x4'),{'body':_0x13e94d,'options':{'where':{'uniqueid':_0x54a5b5},'order':[['id',_0x1a98('0x5')]],'limit':0x1},'log':_0x1a98('0x4')});}; \ 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 b6daec1..58a264c 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 _0x008e=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','join','stop','agents','timeout','atimeout','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format'];(function(_0x1305e3,_0x43a724){var _0x1068e9=function(_0x1bc555){while(--_0x1bc555){_0x1305e3['push'](_0x1305e3['shift']());}};_0x1068e9(++_0x43a724);}(_0x008e,0x1a5));var _0xe008=function(_0x576781,_0x3482a6){_0x576781=_0x576781-0x0;var _0x4d761b=_0x008e[_0x576781];return _0x4d761b;};'use strict';var schema=require(_0xe008('0x0'));var _=require(_0xe008('0x1'));var util=require(_0xe008('0x2'));var seqqueue=require('seq-queue');var logger=require(_0xe008('0x3'))('routing');var strategy=require(_0xe008('0x4'));var queue=schema({'name':{'type':_0xe008('0x5'),'required':!![],'message':_0xe008('0x6')},'timeout':{'type':_0xe008('0x7'),'message':_0xe008('0x8')}});function writeLog(_0x589f04,_0x2a11f2,_0x27e76c){return logger[_0xe008('0x9')](util[_0xe008('0xa')](_0xe008('0xb'),_0x589f04,_0x2a11f2[_0xe008('0xc')],_0x27e76c));}function handleFindAgent(_0x49d34e){return function(_0x3d9ad5){return _0x3d9ad5[_0xe008('0xc')][_0xe008('0xd')]()===_0x49d34e[_0xe008('0xd')]();};}exports[_0xe008('0xe')]=function(_0x1be8ba,_0x4e629b,_0x2ad800,_0x39180b){return function(_0x554854){try{var _0x90d067={'name':_0x4e629b[0x0],'timeout':_0x4e629b[0x1]};var _0x56c0dd=queue[_0xe008('0x0')](_0x90d067,{'typecast':!![]});if(_0x56c0dd[_0xe008('0xf')]){logger[_0xe008('0x10')](_0xe008('0x11'),_0x1be8ba,_[_0xe008('0x12')](_0x56c0dd,'message')[_0xe008('0x13')](',\x20'));_0x554854[_0xe008('0x14')]();}else{var _0x4e0bd8=_['find'](_0x2ad800[_0xe008('0x15')],handleFindAgent(_0x90d067[_0xe008('0xc')]));if(_0x4e0bd8){var _0x5e6ab1=(_0x90d067[_0xe008('0x16')]||0xa)*0x3e8;var _0x3042c6,_0x44d93a;var _0xaa48f6=seqqueue['createQueue'](_0x5e6ab1);_0xaa48f6['id']=_0x1be8ba;_0xaa48f6[_0xe008('0x17')]=_0x5e6ab1;_0xaa48f6[_0xe008('0x18')]=_0x39180b['channel'];writeLog(_0x1be8ba,_0x4e0bd8,util['format'](_0xe008('0x19'),_0x5e6ab1));_0x2ad800[_0xe008('0x1a')][_0x1be8ba]['on'](_0xe008('0x1b'),function(){logger[_0xe008('0x9')](_0xe008('0x1c'),_0x1be8ba);clearTimeout(_0x44d93a);_0x44d93a=undefined;_0xaa48f6[_0xe008('0x1d')]();if(_0x2ad800[_0xe008('0x1a')][_0x1be8ba]){delete _0x2ad800[_0xe008('0x1a')][_0x1be8ba];}_0x554854[_0xe008('0x14')]();});_0x2ad800[_0xe008('0x1a')][_0x1be8ba]['on'](_0xe008('0x1e'),function(){if(_0x2ad800[_0xe008('0x1a')][_0x1be8ba]){delete _0x2ad800[_0xe008('0x1a')][_0x1be8ba];}});_0x44d93a=setTimeout(function(){logger[_0xe008('0x9')](_0xe008('0x1f'),_0x1be8ba);clearTimeout(_0x44d93a);_0xaa48f6[_0xe008('0x1d')]();_0x554854['next']();},_0x5e6ab1);strategy['agent'](_0xaa48f6,_0x4e0bd8,_0x2ad800,_0x39180b);}else{logger['error'](_0xe008('0x20'),_0x1be8ba,_0x90d067[_0xe008('0xc')]);_0x554854['stop']();}}}catch(_0x1c99a6){console[_0xe008('0x21')](_0x1c99a6);logger[_0xe008('0x10')](_0xe008('0x22'),_0x1be8ba,_0x1c99a6[_0xe008('0x23')]);_0x554854[_0xe008('0x14')]();}};}; \ No newline at end of file +var _0x6206=['find','agents','timeout','channel','format','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','stop','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','map','message','join'];(function(_0x3ee76e,_0x3c76da){var _0x389187=function(_0x2bd529){while(--_0x2bd529){_0x3ee76e['push'](_0x3ee76e['shift']());}};_0x389187(++_0x3c76da);}(_0x6206,0x127));var _0x6620=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0x6206[_0x3e44fa];return _0x2a0aba;};'use strict';var schema=require(_0x6620('0x0'));var _=require(_0x6620('0x1'));var util=require(_0x6620('0x2'));var seqqueue=require(_0x6620('0x3'));var logger=require('../../../../config/logger')(_0x6620('0x4'));var strategy=require(_0x6620('0x5'));var queue=schema({'name':{'type':_0x6620('0x6'),'required':!![],'message':_0x6620('0x7')},'timeout':{'type':_0x6620('0x8'),'message':_0x6620('0x9')}});function writeLog(_0x5ba920,_0x4bbfcd,_0xa5169){return logger[_0x6620('0xa')](util['format'](_0x6620('0xb'),_0x5ba920,_0x4bbfcd['name'],_0xa5169));}function handleFindAgent(_0x20d97){return function(_0xd30a5e){return _0xd30a5e[_0x6620('0xc')]['toLowerCase']()===_0x20d97[_0x6620('0xd')]();};}exports[_0x6620('0xe')]=function(_0x41a619,_0x942f93,_0x2f15e4,_0x2fb4bc){return function(_0xf283ac){try{var _0x1cd668={'name':_0x942f93[0x0],'timeout':_0x942f93[0x1]};var _0x529807=queue[_0x6620('0x0')](_0x1cd668,{'typecast':!![]});if(_0x529807[_0x6620('0xf')]){logger[_0x6620('0x10')]('[%s][AGENT]\x20%s',_0x41a619,_[_0x6620('0x11')](_0x529807,_0x6620('0x12'))[_0x6620('0x13')](',\x20'));_0xf283ac['stop']();}else{var _0x3c9637=_[_0x6620('0x14')](_0x2f15e4[_0x6620('0x15')],handleFindAgent(_0x1cd668[_0x6620('0xc')]));if(_0x3c9637){var _0x390f62=(_0x1cd668[_0x6620('0x16')]||0xa)*0x3e8;var _0x13dd12,_0x29f5d2;var _0x2f65c9=seqqueue['createQueue'](_0x390f62);_0x2f65c9['id']=_0x41a619;_0x2f65c9['atimeout']=_0x390f62;_0x2f65c9[_0x6620('0x17')]=_0x2fb4bc[_0x6620('0x17')];writeLog(_0x41a619,_0x3c9637,util[_0x6620('0x18')](_0x6620('0x19'),_0x390f62));_0x2f15e4[_0x6620('0x1a')][_0x41a619]['on'](_0x6620('0x1b'),function(){logger[_0x6620('0xa')](_0x6620('0x1c'),_0x41a619);clearTimeout(_0x29f5d2);_0x29f5d2=undefined;_0x2f65c9[_0x6620('0x1d')]();if(_0x2f15e4[_0x6620('0x1a')][_0x41a619]){delete _0x2f15e4['rules'][_0x41a619];}_0xf283ac['stop']();});_0x2f15e4['rules'][_0x41a619]['on'](_0x6620('0x1e'),function(){if(_0x2f15e4[_0x6620('0x1a')][_0x41a619]){delete _0x2f15e4[_0x6620('0x1a')][_0x41a619];}});_0x29f5d2=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0x41a619);clearTimeout(_0x29f5d2);_0x2f65c9[_0x6620('0x1d')]();_0xf283ac['next']();},_0x390f62);strategy[_0x6620('0x1f')](_0x2f65c9,_0x3c9637,_0x2f15e4,_0x2fb4bc);}else{logger[_0x6620('0x10')](_0x6620('0x20'),_0x41a619,_0x1cd668['name']);_0xf283ac[_0x6620('0x21')]();}}}catch(_0x63b4dc){console['log'](_0x63b4dc);logger[_0x6620('0x10')](_0x6620('0x22'),_0x41a619,_0x63b4dc['stack']);_0xf283ac[_0x6620('0x21')]();}};}; \ 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 82cdddd..5da6df9 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 _0xa97d=['stringify','Failed','lodash','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','getMustacheRender','Message','create','then','catch','error','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','providerName'];(function(_0x491422,_0xcdc0ca){var _0xa0bd55=function(_0x3dc7e6){while(--_0x3dc7e6){_0x491422['push'](_0x491422['shift']());}};_0xa0bd55(++_0xcdc0ca);}(_0xa97d,0x1c4));var _0xda97=function(_0x49f368,_0xf070e2){_0x49f368=_0x49f368-0x0;var _0x3923f3=_0xa97d[_0x49f368];return _0x3923f3;};'use strict';var _=require(_0xda97('0x0'));var moment=require('moment');var AWS=require(_0xda97('0x1'));var utils=require(_0xda97('0x2'));var logger=require(_0xda97('0x3'))(_0xda97('0x4'));var rpc={'chatMessage':require(_0xda97('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xda97('0x6')),'smsMessage':require(_0xda97('0x7')),'faxMessage':require(_0xda97('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xda97('0x9')]=function(_0x3526f0,_0xebd28f){return function(_0x526bf8){try{if(!_[_0xda97('0xa')](this[_0xda97('0xb')][_0xda97('0xc')])){logger[_0xda97('0xd')](_0xda97('0xe'),_0x3526f0,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x526bf8[_0xda97('0xf')]();}var _0x41ef45={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xda97('0x10')),'direction':_0xda97('0x11')};if(this[_0xda97('0x12')]==='sms'||this[_0xda97('0x12')]===_0xda97('0x13')){_0x41ef45[_0xda97('0x14')]=this['interaction'][_0xda97('0x14')];}var _0x34063a=this[_0xda97('0x12')];if(_0x34063a===_0xda97('0x15')){_0x41ef45[_0xda97('0x16')]=this[_0xda97('0x17')]['id'];}else{_0x41ef45[_[_0xda97('0x18')](_0x34063a)+_0xda97('0x19')]=this[_0xda97('0x17')]['id'];}_0x41ef45[_[_0xda97('0x18')](_0x34063a)+_0xda97('0x1a')]=this[_0xda97('0xb')]['id'];if(this[_0xda97('0xb')][_0xda97('0x1b')]){var _0x1509a2=_0xebd28f[0x4];if(!_[_0xda97('0x1c')](_0x1509a2)){_0x41ef45[_0xda97('0x1d')]=utils[_0xda97('0x1e')](_0x1509a2,this);return rpc[_0x34063a+_0xda97('0x1f')][_0xda97('0x20')](_0x41ef45)[_0xda97('0x21')](function(_0x585634){logger['info'](_0xda97('0xe'),_0x3526f0,_0x41ef45[_0xda97('0x1d')]);})[_0xda97('0x22')](function(_0x5dccf6){logger[_0xda97('0x23')]('[%s][AMAZONLEX]\x20%s',_0x3526f0,JSON['stringify'](_0x5dccf6));})['finally'](function(){logger[_0xda97('0xd')](_0xda97('0x24'),_0x3526f0);_0x526bf8['stop']();});}else{logger['info'](_0xda97('0x25'),_0x3526f0);_0x526bf8[_0xda97('0x26')]();}}else{var _0x158b62=this;var _0x7943fc=new AWS[(_0xda97('0x27'))]({'accessKeyId':_0xebd28f[0x0],'secretAccessKey':_0xebd28f[0x1],'region':_0xebd28f[0x2]});var _0x521297={'botAlias':_0xda97('0x28'),'botName':_0xebd28f[0x3],'inputText':this[_0xda97('0x29')][_0xda97('0x1d')],'userId':this[_0xda97('0x12')]+':'+this[_0xda97('0xb')]['id']['toString']()};_0x7943fc['postText'](_0x521297,function(_0x325e8b,_0x5f2683){if(_0x325e8b){logger[_0xda97('0x23')](_0xda97('0xe'),_0x3526f0,_0x325e8b[_0xda97('0x29')]);_0x526bf8[_0xda97('0xf')]();}else if(_0x5f2683&&_0x5f2683[_0xda97('0x29')]){_0x158b62[_0xda97('0x1d')]['amazonlex']=_0x5f2683;_0x41ef45[_0xda97('0x1d')]=_0x5f2683['message'];_0x41ef45[_0xda97('0x2a')]='amazonlex';_0x41ef45['providerResponse']=JSON[_0xda97('0x2b')](_0x5f2683);return rpc[_0x34063a+_0xda97('0x1f')]['create'](_0x41ef45)['then'](function(_0xe2c4aa){logger[_0xda97('0xd')](_0xda97('0xe'),_0x3526f0,_0x41ef45[_0xda97('0x1d')]);if(_0x5f2683['dialogState']==_0xda97('0x2c')){_0x526bf8[_0xda97('0xf')]();}else{_0x526bf8[_0xda97('0x26')]();}})['catch'](function(_0x354c42){logger[_0xda97('0x23')](_0xda97('0xe'),_0x3526f0,JSON[_0xda97('0x2b')](_0x354c42));_0x526bf8[_0xda97('0xf')]();});}else{_0x526bf8['next']();}});}}catch(_0x4e13ed){logger[_0xda97('0x23')](_0xda97('0xe'),_0x3526f0,JSON['stringify'](_0x4e13ed));_0x526bf8[_0xda97('0x26')]();}};}; \ No newline at end of file +var _0x0a65=['phone','chat','ChatWebsiteId','account','upperFirst','AccountId','created','body','then','info','catch','error','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','$LATEST','message','toString','postText','next','providerName','amazonlex','providerResponse','stringify','Message','create','dialogState','Failed','aws-sdk','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','isNil','interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp'];(function(_0x8df31,_0x5e7d99){var _0x244dbf=function(_0x367488){while(--_0x367488){_0x8df31['push'](_0x8df31['shift']());}};_0x244dbf(++_0x5e7d99);}(_0x0a65,0xb0));var _0x50a6=function(_0x1e7b70,_0x6a276b){_0x1e7b70=_0x1e7b70-0x0;var _0x4142d6=_0x0a65[_0x1e7b70];return _0x4142d6;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0x50a6('0x0'));var utils=require(_0x50a6('0x1'));var logger=require(_0x50a6('0x2'))(_0x50a6('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x50a6('0x4')),'mailMessage':require(_0x50a6('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x50a6('0x6')),'whatsappMessage':require(_0x50a6('0x7'))};exports['consequence']=function(_0x4b6b34,_0x441ee2){return function(_0xd9ba9a){try{if(!_[_0x50a6('0x8')](this[_0x50a6('0x9')][_0x50a6('0xa')])){logger['info'](_0x50a6('0xb'),_0x4b6b34,_0x50a6('0xc'));return _0xd9ba9a['next']();}var _0x46ba0a={'ContactId':this[_0x50a6('0xd')]['id'],'sentAt':moment()[_0x50a6('0xe')](_0x50a6('0xf')),'direction':_0x50a6('0x10')};if(this[_0x50a6('0x11')]===_0x50a6('0x12')||this[_0x50a6('0x11')]===_0x50a6('0x13')){_0x46ba0a[_0x50a6('0x14')]=this[_0x50a6('0x9')][_0x50a6('0x14')];}var _0x2b7749=this[_0x50a6('0x11')];if(_0x2b7749===_0x50a6('0x15')){_0x46ba0a[_0x50a6('0x16')]=this[_0x50a6('0x17')]['id'];}else{_0x46ba0a[_[_0x50a6('0x18')](_0x2b7749)+_0x50a6('0x19')]=this[_0x50a6('0x17')]['id'];}_0x46ba0a[_[_0x50a6('0x18')](_0x2b7749)+'InteractionId']=this['interaction']['id'];if(this[_0x50a6('0x9')][_0x50a6('0x1a')]){var _0xebc3e7=_0x441ee2[0x4];if(!_['isEmpty'](_0xebc3e7)){_0x46ba0a[_0x50a6('0x1b')]=utils['getMustacheRender'](_0xebc3e7,this);return rpc[_0x2b7749+'Message']['create'](_0x46ba0a)[_0x50a6('0x1c')](function(_0x38f18c){logger[_0x50a6('0x1d')](_0x50a6('0xb'),_0x4b6b34,_0x46ba0a[_0x50a6('0x1b')]);})[_0x50a6('0x1e')](function(_0x4f525c){logger[_0x50a6('0x1f')](_0x50a6('0xb'),_0x4b6b34,JSON['stringify'](_0x4f525c));})[_0x50a6('0x20')](function(){logger['info'](_0x50a6('0x21'),_0x4b6b34);_0xd9ba9a['stop']();});}else{logger['info'](_0x50a6('0x22'),_0x4b6b34);_0xd9ba9a[_0x50a6('0x23')]();}}else{var _0x5e9e29=this;var _0x5b62c1=new AWS['LexRuntime']({'accessKeyId':_0x441ee2[0x0],'secretAccessKey':_0x441ee2[0x1],'region':_0x441ee2[0x2]});var _0x3db1f1={'botAlias':_0x50a6('0x24'),'botName':_0x441ee2[0x3],'inputText':this[_0x50a6('0x25')][_0x50a6('0x1b')],'userId':this[_0x50a6('0x11')]+':'+this[_0x50a6('0x9')]['id'][_0x50a6('0x26')]()};_0x5b62c1[_0x50a6('0x27')](_0x3db1f1,function(_0x25fbac,_0x4b04d9){if(_0x25fbac){logger[_0x50a6('0x1f')](_0x50a6('0xb'),_0x4b6b34,_0x25fbac[_0x50a6('0x25')]);_0xd9ba9a[_0x50a6('0x28')]();}else if(_0x4b04d9&&_0x4b04d9[_0x50a6('0x25')]){_0x5e9e29[_0x50a6('0x1b')]['amazonlex']=_0x4b04d9;_0x46ba0a['body']=_0x4b04d9['message'];_0x46ba0a[_0x50a6('0x29')]=_0x50a6('0x2a');_0x46ba0a[_0x50a6('0x2b')]=JSON[_0x50a6('0x2c')](_0x4b04d9);return rpc[_0x2b7749+_0x50a6('0x2d')][_0x50a6('0x2e')](_0x46ba0a)[_0x50a6('0x1c')](function(_0x2463c2){logger[_0x50a6('0x1d')](_0x50a6('0xb'),_0x4b6b34,_0x46ba0a[_0x50a6('0x1b')]);if(_0x4b04d9[_0x50a6('0x2f')]==_0x50a6('0x30')){_0xd9ba9a[_0x50a6('0x28')]();}else{_0xd9ba9a['stop']();}})[_0x50a6('0x1e')](function(_0x14a4da){logger[_0x50a6('0x1f')](_0x50a6('0xb'),_0x4b6b34,JSON[_0x50a6('0x2c')](_0x14a4da));_0xd9ba9a[_0x50a6('0x28')]();});}else{_0xd9ba9a[_0x50a6('0x28')]();}});}}catch(_0x479700){logger[_0x50a6('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x4b6b34,JSON[_0x50a6('0x2c')](_0x479700));_0xd9ba9a[_0x50a6('0x23')]();}};}; \ 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 2d60c90..8cc3e6b 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 _0x6663=['finally','resolve','Interaction','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','[%s][AUTOREPLY]\x20%s','stop','lodash','moment','routing','../../rpc/openchannelMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/whatsappInteraction','../../mailRpc','channel','body','isAutoreply','info','interaction','created','next','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','mail','getMustacheRender','message','from','subject','startsWith','Re:','Re:\x20','chat','account','upperFirst','InteractionId','Message','inReplyTo','html','','headers','auto-replied','All','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','create','then','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s'];(function(_0x45b0e3,_0xc943ce){var _0x159c44=function(_0x5f86cd){while(--_0x5f86cd){_0x45b0e3['push'](_0x45b0e3['shift']());}};_0x159c44(++_0xc943ce);}(_0x6663,0xb6));var _0x3666=function(_0x42bc91,_0x41f40a){_0x42bc91=_0x42bc91-0x0;var _0x3f5507=_0x6663[_0x42bc91];return _0x3f5507;};'use strict';var _=require(_0x3666('0x0'));var moment=require(_0x3666('0x1'));var utils=require('./utils');var logger=require('../../../../config/logger')(_0x3666('0x2'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x3666('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x3666('0x4')),'whatsappMessage':require(_0x3666('0x5')),'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x3666('0x6')),'mailInteraction':require(_0x3666('0x7')),'smsInteraction':require('../../rpc/smsInteraction'),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x3666('0x8'))};var mailRpc=require(_0x3666('0x9'));exports['consequence']=function(_0x1dcf19,_0xd1ede9,_0x1bc214,_0x1b178c){return function(_0x5030d7){try{var _0xf22559=this[_0x3666('0xa')];if(_0xf22559==='mail'&&_0x1b178c[_0x3666('0xb')][_0x3666('0xc')]){logger[_0x3666('0xd')]('[%s][AUTOREPLY]\x20%s',_0x1dcf19,'Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)');return _0x5030d7['next']();}if(_0xd1ede9[0x0]==='1'&&(_['isNil'](this[_0x3666('0xe')][_0x3666('0xf')])||!this[_0x3666('0xe')][_0x3666('0xf')])){logger['info']('[%s][AUTOREPLY]\x20%s',_0x1dcf19,'Autoreply\x20already\x20sent');return _0x5030d7[_0x3666('0x10')]();}if(_0xd1ede9[0x0]==='2'&&this[_0x3666('0xe')][_0x3666('0x11')]){logger[_0x3666('0xd')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x1dcf19,_0x3666('0x12'));return _0x5030d7[_0x3666('0x10')]();}var _0x2f2fdd={'ContactId':this[_0x3666('0x13')]['id'],'sentAt':moment()['format'](_0x3666('0x14')),'direction':_0x3666('0x15')};if(this[_0x3666('0xa')]===_0x3666('0x16')){_0x2f2fdd[_0x3666('0xb')]=utils[_0x3666('0x17')](_0xd1ede9[0x2],this);}else{_0x2f2fdd[_0x3666('0xb')]=utils[_0x3666('0x17')](_0xd1ede9[0x1],this);}if(this[_0x3666('0x18')]){_0x2f2fdd['to']=this['message'][_0x3666('0x19')]||'';if(this[_0x3666('0xa')]===_0x3666('0x16')&&_0xd1ede9[0x1]==='1'){_0x2f2fdd['cc']=this[_0x3666('0x18')]['cc']||'';}_0x2f2fdd[_0x3666('0x19')]=this[_0x3666('0x18')]['to']||'';_0x2f2fdd['phone']=this[_0x3666('0x18')]['phone']||'';_0x2f2fdd['read']=!![];if(this['message']['subject']){_0x2f2fdd[_0x3666('0x1a')]='';_0x2f2fdd['subject']+=_[_0x3666('0x1b')](this[_0x3666('0x18')][_0x3666('0x1a')],_0x3666('0x1c'))?'':_0x3666('0x1d');_0x2f2fdd[_0x3666('0x1a')]+=this[_0x3666('0x18')][_0x3666('0x1a')];}}if(this[_0x3666('0xa')]===_0x3666('0x1e')){_0x2f2fdd['ChatWebsiteId']=this[_0x3666('0x1f')]['id'];}else{_0x2f2fdd[_[_0x3666('0x20')](this[_0x3666('0xa')])+'AccountId']=this['account']['id'];}_0x2f2fdd[_[_0x3666('0x20')](this[_0x3666('0xa')])+_0x3666('0x21')]=this[_0x3666('0xe')]['id'];var _0x5c42da=this[_0x3666('0xe')];if(rpc[this[_0x3666('0xa')]+_0x3666('0x22')]){if(this[_0x3666('0xa')]===_0x3666('0x16')){_0x2f2fdd[_0x3666('0x23')]=this['message']['messageId'];_0x2f2fdd[_0x3666('0x24')]=''+_['replace'](_0x2f2fdd[_0x3666('0xb')],_0x3666('0x25'),'','replace','auto-replied','All','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','update','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','channel','mail','body','isAutoreply','info','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','interaction','created','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','autoreplyExecuted','One\x20Time\x20already\x20sent','contact','format','out','getMustacheRender','message','from','phone','subject','startsWith'];(function(_0x2d2258,_0x2ce510){var _0x18e155=function(_0x11949e){while(--_0x11949e){_0x2d2258['push'](_0x2d2258['shift']());}};_0x18e155(++_0x2ce510);}(_0x7d92,0x9f));var _0x27d9=function(_0x1cd47d,_0x55bc75){_0x1cd47d=_0x1cd47d-0x0;var _0x29d52f=_0x7d92[_0x1cd47d];return _0x29d52f;};'use strict';var _=require(_0x27d9('0x0'));var moment=require(_0x27d9('0x1'));var utils=require(_0x27d9('0x2'));var logger=require(_0x27d9('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x27d9('0x4')),'mailMessage':require(_0x27d9('0x5')),'smsMessage':require(_0x27d9('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x27d9('0x7')),'chatInteraction':require(_0x27d9('0x8')),'openchannelInteraction':require(_0x27d9('0x9')),'mailInteraction':require('../../rpc/mailInteraction'),'smsInteraction':require(_0x27d9('0xa')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require(_0x27d9('0xb'))};var mailRpc=require(_0x27d9('0xc'));exports[_0x27d9('0xd')]=function(_0x5205b1,_0x5a9813,_0x383cc8,_0xb7755e){return function(_0x26fe7e){try{var _0x30d631=this[_0x27d9('0xe')];if(_0x30d631===_0x27d9('0xf')&&_0xb7755e[_0x27d9('0x10')][_0x27d9('0x11')]){logger[_0x27d9('0x12')]('[%s][AUTOREPLY]\x20%s',_0x5205b1,_0x27d9('0x13'));return _0x26fe7e[_0x27d9('0x14')]();}if(_0x5a9813[0x0]==='1'&&(_['isNil'](this[_0x27d9('0x15')][_0x27d9('0x16')])||!this[_0x27d9('0x15')][_0x27d9('0x16')])){logger[_0x27d9('0x12')](_0x27d9('0x17'),_0x5205b1,_0x27d9('0x18'));return _0x26fe7e[_0x27d9('0x14')]();}if(_0x5a9813[0x0]==='2'&&this[_0x27d9('0x15')][_0x27d9('0x19')]){logger[_0x27d9('0x12')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5205b1,_0x27d9('0x1a'));return _0x26fe7e[_0x27d9('0x14')]();}var _0x1126a3={'ContactId':this[_0x27d9('0x1b')]['id'],'sentAt':moment()[_0x27d9('0x1c')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x27d9('0x1d')};if(this[_0x27d9('0xe')]===_0x27d9('0xf')){_0x1126a3[_0x27d9('0x10')]=utils[_0x27d9('0x1e')](_0x5a9813[0x2],this);}else{_0x1126a3['body']=utils[_0x27d9('0x1e')](_0x5a9813[0x1],this);}if(this[_0x27d9('0x1f')]){_0x1126a3['to']=this[_0x27d9('0x1f')][_0x27d9('0x20')]||'';if(this[_0x27d9('0xe')]===_0x27d9('0xf')&&_0x5a9813[0x1]==='1'){_0x1126a3['cc']=this[_0x27d9('0x1f')]['cc']||'';}_0x1126a3[_0x27d9('0x20')]=this[_0x27d9('0x1f')]['to']||'';_0x1126a3[_0x27d9('0x21')]=this[_0x27d9('0x1f')]['phone']||'';_0x1126a3['read']=!![];if(this['message'][_0x27d9('0x22')]){_0x1126a3[_0x27d9('0x22')]='';_0x1126a3['subject']+=_[_0x27d9('0x23')](this[_0x27d9('0x1f')]['subject'],_0x27d9('0x24'))?'':_0x27d9('0x25');_0x1126a3[_0x27d9('0x22')]+=this[_0x27d9('0x1f')]['subject'];}}if(this[_0x27d9('0xe')]==='chat'){_0x1126a3[_0x27d9('0x26')]=this[_0x27d9('0x27')]['id'];}else{_0x1126a3[_[_0x27d9('0x28')](this['channel'])+_0x27d9('0x29')]=this['account']['id'];}_0x1126a3[_[_0x27d9('0x28')](this[_0x27d9('0xe')])+'InteractionId']=this[_0x27d9('0x15')]['id'];var _0x4aff82=this[_0x27d9('0x15')];if(rpc[this[_0x27d9('0xe')]+_0x27d9('0x2a')]){if(this[_0x27d9('0xe')]===_0x27d9('0xf')){_0x1126a3[_0x27d9('0x2b')]=this[_0x27d9('0x1f')][_0x27d9('0x2c')];_0x1126a3[_0x27d9('0x2d')]=_0x27d9('0x2e')+_[_0x27d9('0x2f')](_0x1126a3[_0x27d9('0x10')],'';_0x1126a3['headers']={'Auto-Submitted':_0x27d9('0x30'),'X-Auto-Response-Suppress':_0x27d9('0x31'),'Precedence':'auto_reply'};return mailRpc[_0x27d9('0x32')](this[_0x27d9('0x27')][_0x27d9('0x33')],_0x1126a3)[_0x27d9('0x34')](function(_0x3d5e7e){logger[_0x27d9('0x12')](_0x27d9('0x35'),_0x5205b1);_0x1126a3[_0x27d9('0x2c')]=_0x3d5e7e['message'][_0x27d9('0x2c')];return rpc[_0x30d631+_0x27d9('0x2a')][_0x27d9('0x36')](_0x1126a3);})['then'](function(_0x592b81){logger[_0x27d9('0x12')](_0x27d9('0x17'),_0x5205b1,JSON[_0x27d9('0x37')](_0x592b81));})[_0x27d9('0x38')](function(_0xcc4c60){logger[_0x27d9('0x39')](_0x27d9('0x3a'),_0x5205b1,JSON[_0x27d9('0x37')](_0xcc4c60));})[_0x27d9('0x3b')](function(){Promise[_0x27d9('0x3c')]()[_0x27d9('0x34')](function(){if(_0x5a9813[0x0]!=='2'||_0x4aff82[_0x27d9('0x19')])return;return rpc[_0x30d631+'Interaction'][_0x27d9('0x3d')](_0x4aff82['id'],{'autoreplyExecuted':!![]})[_0x27d9('0x34')](function(_0x330b0a){logger[_0x27d9('0x12')](_0x27d9('0x3e'),_0x5205b1,JSON['stringify'](_0x330b0a));})[_0x27d9('0x38')](function(_0x2a0e7c){logger[_0x27d9('0x39')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x5205b1,JSON[_0x27d9('0x37')](_0x2a0e7c));});})['then'](function(){_0x26fe7e[_0x27d9('0x14')]();});});}else{return rpc[this['channel']+_0x27d9('0x2a')][_0x27d9('0x36')](_0x1126a3)[_0x27d9('0x34')](function(){logger[_0x27d9('0x12')](_0x27d9('0x17'),_0x5205b1,_0x1126a3['body']);})['catch'](function(_0x2165af){logger[_0x27d9('0x39')](_0x27d9('0x17'),_0x5205b1,JSON[_0x27d9('0x37')](_0x2165af));})[_0x27d9('0x3b')](function(){Promise[_0x27d9('0x3c')]()[_0x27d9('0x34')](function(){if(_0x5a9813[0x0]!=='2'||_0x4aff82['autoreplyExecuted'])return;return rpc[_0x30d631+'Interaction'][_0x27d9('0x3d')](_0x4aff82['id'],{'autoreplyExecuted':!![]})[_0x27d9('0x34')](function(_0x1bc5ed){logger[_0x27d9('0x12')](_0x27d9('0x3e'),_0x5205b1,JSON['stringify'](_0x1bc5ed));})[_0x27d9('0x38')](function(_0x16b8cc){logger[_0x27d9('0x39')](_0x27d9('0x3f'),_0x5205b1,JSON[_0x27d9('0x37')](_0x16b8cc));});})[_0x27d9('0x34')](function(){_0x26fe7e[_0x27d9('0x14')]();});});}}}catch(_0x576527){logger['error'](_0x27d9('0x17'),_0x5205b1,JSON['stringify'](_0x576527));_0x26fe7e[_0x27d9('0x40')]();}};}; \ 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 19720d3..6109497 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 _0x9054=['system','channel','Interaction','interaction','catch','[%s][CLOSE]\x20%s','stringify','finally','stop','error','moment','../../../../config/logger','routing','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9054,0xd9));var _0x4905=function(_0x145d63,_0x2fff0c){_0x145d63=_0x145d63-0x0;var _0x965e4b=_0x9054[_0x145d63];return _0x965e4b;};'use strict';var moment=require(_0x4905('0x0'));var logger=require(_0x4905('0x1'))(_0x4905('0x2'));var rpc={'chatInteraction':require(_0x4905('0x3')),'openchannelInteraction':require(_0x4905('0x4')),'smsInteraction':require(_0x4905('0x5')),'mailInteraction':require(_0x4905('0x6')),'faxInteraction':require(_0x4905('0x7')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0x4905('0x8')]=function(_0x4e12fd,_0x40901d,_0x23d27a,_0x12e6fc){return function(_0x30dafa){try{logger[_0x4905('0x9')](_0x4905('0xa'),_0x4e12fd,_0x40901d[0x0]);var _0x1ba70a={'closed':0x1,'closedAt':moment()[_0x4905('0xb')](_0x4905('0xc')),'closeReason':_0x4905('0xd'),'disposition':_0x40901d[0x0]};if(rpc[_0x12e6fc[_0x4905('0xe')]+_0x4905('0xf')]){rpc[_0x12e6fc[_0x4905('0xe')]+_0x4905('0xf')]['update'](_0x12e6fc['interaction']['id'],_0x1ba70a)['then'](function(_0x5bd90f){logger[_0x4905('0x9')]('[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!',_0x4e12fd,_0x12e6fc[_0x4905('0x10')]['id']);})[_0x4905('0x11')](function(_0x237ca7){logger['error'](_0x4905('0x12'),_0x4e12fd,JSON[_0x4905('0x13')](_0x237ca7));})[_0x4905('0x14')](function(){_0x30dafa[_0x4905('0x15')]();});}}catch(_0x170326){logger[_0x4905('0x16')]('[%s][CLOSE]\x20%s',_0x4e12fd,JSON[_0x4905('0x13')](_0x170326));_0x30dafa[_0x4905('0x15')]();}};}; \ No newline at end of file +var _0xe87d=['stringify','finally','stop','moment','../../../../config/logger','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s'];(function(_0x3fc28f,_0x5aba73){var _0x36bd7e=function(_0x5f16f9){while(--_0x5f16f9){_0x3fc28f['push'](_0x3fc28f['shift']());}};_0x36bd7e(++_0x5aba73);}(_0xe87d,0xdb));var _0xde87=function(_0xf3ccda,_0x182c8f){_0xf3ccda=_0xf3ccda-0x0;var _0x35638c=_0xe87d[_0xf3ccda];return _0x35638c;};'use strict';var moment=require(_0xde87('0x0'));var logger=require(_0xde87('0x1'))('routing');var rpc={'chatInteraction':require(_0xde87('0x2')),'openchannelInteraction':require(_0xde87('0x3')),'smsInteraction':require(_0xde87('0x4')),'mailInteraction':require(_0xde87('0x5')),'faxInteraction':require(_0xde87('0x6')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};exports[_0xde87('0x7')]=function(_0x41af2e,_0x475fa4,_0x3a4fa9,_0x1fe7bf){return function(_0x5509a3){try{logger[_0xde87('0x8')](_0xde87('0x9'),_0x41af2e,_0x475fa4[0x0]);var _0x418bc5={'closed':0x1,'closedAt':moment()[_0xde87('0xa')](_0xde87('0xb')),'closeReason':_0xde87('0xc'),'disposition':_0x475fa4[0x0]};if(rpc[_0x1fe7bf[_0xde87('0xd')]+'Interaction']){rpc[_0x1fe7bf[_0xde87('0xd')]+_0xde87('0xe')][_0xde87('0xf')](_0x1fe7bf[_0xde87('0x10')]['id'],_0x418bc5)[_0xde87('0x11')](function(_0x12a3ae){logger[_0xde87('0x8')](_0xde87('0x12'),_0x41af2e,_0x1fe7bf[_0xde87('0x10')]['id']);})['catch'](function(_0x178f77){logger[_0xde87('0x13')](_0xde87('0x14'),_0x41af2e,JSON[_0xde87('0x15')](_0x178f77));})[_0xde87('0x16')](function(){_0x5509a3[_0xde87('0x17')]();});}}catch(_0x5cc618){logger['error'](_0xde87('0x14'),_0x41af2e,JSON[_0xde87('0x15')](_0x5cc618));_0x5509a3['stop']();}};}; \ 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 61f9539..1ad3e16 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 _0x40f3=['result','fulfillment','providerName','dialogflow','create','endConversation','error','moment','apiai-promise','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','interaction','phone','chat','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','body','getMustacheRender','Message','catch','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','message','then'];(function(_0x53b581,_0xcfc72c){var _0x2001b5=function(_0x4f96a0){while(--_0x4f96a0){_0x53b581['push'](_0x53b581['shift']());}};_0x2001b5(++_0xcfc72c);}(_0x40f3,0x8b));var _0x340f=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0x40f3[_0x31a371];return _0x2a5bd6;};'use strict';var _=require('lodash');var moment=require(_0x340f('0x0'));var apiai=require(_0x340f('0x1'));var md5=require('md5');var utils=require(_0x340f('0x2'));var logger=require(_0x340f('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x340f('0x4')),'mailMessage':require(_0x340f('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x340f('0x6')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports['consequence']=function(_0x2d92f2,_0x264754){return function(_0x22dd4b){try{if(!_['isNil'](this['interaction'][_0x340f('0x7')])){logger[_0x340f('0x8')](_0x340f('0x9'),_0x2d92f2,_0x340f('0xa'));return _0x22dd4b[_0x340f('0xb')]();}var _0x1a22d9={'ContactId':this[_0x340f('0xc')]['id'],'sentAt':moment()[_0x340f('0xd')](_0x340f('0xe')),'direction':_0x340f('0xf')};if(this[_0x340f('0x10')]==='sms'||this[_0x340f('0x10')]==='whatsapp'){_0x1a22d9['phone']=this[_0x340f('0x11')][_0x340f('0x12')];}var _0x3b18b4=this['channel'];if(_0x3b18b4===_0x340f('0x13')){_0x1a22d9[_0x340f('0x14')]=this[_0x340f('0x15')]['id'];}else{_0x1a22d9[_[_0x340f('0x16')](_0x3b18b4)+'AccountId']=this[_0x340f('0x15')]['id'];}_0x1a22d9[_[_0x340f('0x16')](_0x3b18b4)+_0x340f('0x17')]=this['interaction']['id'];if(this[_0x340f('0x11')][_0x340f('0x18')]){var _0x490ae6=_0x264754[0x2];if(!_[_0x340f('0x19')](_0x490ae6)){_0x1a22d9[_0x340f('0x1a')]=utils[_0x340f('0x1b')](_0x490ae6,this);return rpc[_0x3b18b4+_0x340f('0x1c')]['create'](_0x1a22d9)['then'](function(_0x43a0c1){logger['info'](_0x340f('0x9'),_0x2d92f2,_0x1a22d9[_0x340f('0x1a')]);})[_0x340f('0x1d')](function(_0xe9d89b){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x2d92f2,JSON[_0x340f('0x1e')](_0xe9d89b));})[_0x340f('0x1f')](function(){logger[_0x340f('0x8')](_0x340f('0x20'),_0x2d92f2);_0x22dd4b[_0x340f('0x21')]();});}else{logger[_0x340f('0x8')](_0x340f('0x22'),_0x2d92f2);_0x22dd4b[_0x340f('0x21')]();}}else{var _0x427265=this;var _0x36a845=apiai(_0x264754[0x0],{'language':_0x264754[0x1]||'en'});return _0x36a845['textRequest'](this[_0x340f('0x23')][_0x340f('0x1a')],{'sessionId':md5(this[_0x340f('0x11')]['id'])})[_0x340f('0x24')](function(_0x4acba5){_0x427265[_0x340f('0x1a')]['dialogflow']=_0x4acba5;_0x1a22d9['body']=_0x4acba5[_0x340f('0x25')][_0x340f('0x26')]['speech'];_0x1a22d9[_0x340f('0x27')]=_0x340f('0x28');_0x1a22d9['providerResponse']=JSON[_0x340f('0x1e')](_0x4acba5);return rpc[_0x3b18b4+_0x340f('0x1c')][_0x340f('0x29')](_0x1a22d9)[_0x340f('0x24')](function(_0x4cb37e){logger[_0x340f('0x8')](_0x340f('0x9'),_0x2d92f2,_0x1a22d9[_0x340f('0x1a')]);if(_0x4acba5['result']['metadata'][_0x340f('0x2a')]){_0x22dd4b['next']();}else{_0x22dd4b[_0x340f('0x21')]();}})[_0x340f('0x1d')](function(_0x5a05ae){logger[_0x340f('0x2b')](_0x340f('0x9'),_0x2d92f2,JSON[_0x340f('0x1e')](_0x5a05ae));_0x22dd4b[_0x340f('0xb')]();});})[_0x340f('0x1d')](function(_0x314397){logger[_0x340f('0x2b')]('[%s][DIALOGFLOW]\x20%s',_0x2d92f2,_0x314397[_0x340f('0x23')]);_0x22dd4b['next']();});}}catch(_0x3e5f77){logger[_0x340f('0x2b')]('[%s][DIALOGFLOW]\x20%s',_0x2d92f2,JSON[_0x340f('0x1e')](_0x3e5f77));_0x22dd4b[_0x340f('0x21')]();}};}; \ No newline at end of file +var _0x5334=['whatsapp','phone','channel','chat','ChatWebsiteId','account','AccountId','InteractionId','created','isEmpty','getMustacheRender','create','then','catch','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','dialogflow','body','result','speech','providerName','providerResponse','Message','metadata','error','message','lodash','moment','apiai-promise','md5','./utils','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','consequence','isNil','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms'];(function(_0xd356b2,_0xa37223){var _0x95a555=function(_0x448eac){while(--_0x448eac){_0xd356b2['push'](_0xd356b2['shift']());}};_0x95a555(++_0xa37223);}(_0x5334,0x84));var _0x4533=function(_0xafce33,_0x5d0082){_0xafce33=_0xafce33-0x0;var _0x468acc=_0x5334[_0xafce33];return _0x468acc;};'use strict';var _=require(_0x4533('0x0'));var moment=require(_0x4533('0x1'));var apiai=require(_0x4533('0x2'));var md5=require(_0x4533('0x3'));var utils=require(_0x4533('0x4'));var logger=require('../../../../config/logger')(_0x4533('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x4533('0x6')),'mailMessage':require(_0x4533('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x4533('0x8')]=function(_0x4dea06,_0x4d89e7){return function(_0x487906){try{if(!_[_0x4533('0x9')](this[_0x4533('0xa')][_0x4533('0xb')])){logger[_0x4533('0xc')](_0x4533('0xd'),_0x4dea06,_0x4533('0xe'));return _0x487906[_0x4533('0xf')]();}var _0x4fdbda={'ContactId':this[_0x4533('0x10')]['id'],'sentAt':moment()[_0x4533('0x11')](_0x4533('0x12')),'direction':_0x4533('0x13')};if(this['channel']===_0x4533('0x14')||this['channel']===_0x4533('0x15')){_0x4fdbda[_0x4533('0x16')]=this[_0x4533('0xa')][_0x4533('0x16')];}var _0x57ff74=this[_0x4533('0x17')];if(_0x57ff74===_0x4533('0x18')){_0x4fdbda[_0x4533('0x19')]=this[_0x4533('0x1a')]['id'];}else{_0x4fdbda[_['upperFirst'](_0x57ff74)+_0x4533('0x1b')]=this['account']['id'];}_0x4fdbda[_['upperFirst'](_0x57ff74)+_0x4533('0x1c')]=this[_0x4533('0xa')]['id'];if(this['interaction'][_0x4533('0x1d')]){var _0x1e6a1a=_0x4d89e7[0x2];if(!_[_0x4533('0x1e')](_0x1e6a1a)){_0x4fdbda['body']=utils[_0x4533('0x1f')](_0x1e6a1a,this);return rpc[_0x57ff74+'Message'][_0x4533('0x20')](_0x4fdbda)[_0x4533('0x21')](function(_0x56ab4f){logger[_0x4533('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x4dea06,_0x4fdbda['body']);})[_0x4533('0x22')](function(_0x9740a6){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x4dea06,JSON[_0x4533('0x23')](_0x9740a6));})[_0x4533('0x24')](function(){logger[_0x4533('0xc')](_0x4533('0x25'),_0x4dea06);_0x487906[_0x4533('0x26')]();});}else{logger[_0x4533('0xc')](_0x4533('0x27'),_0x4dea06);_0x487906['stop']();}}else{var _0x231bae=this;var _0xd55c04=apiai(_0x4d89e7[0x0],{'language':_0x4d89e7[0x1]||'en'});return _0xd55c04[_0x4533('0x28')](this['message']['body'],{'sessionId':md5(this[_0x4533('0xa')]['id'])})[_0x4533('0x21')](function(_0x4c640c){_0x231bae['body'][_0x4533('0x29')]=_0x4c640c;_0x4fdbda[_0x4533('0x2a')]=_0x4c640c[_0x4533('0x2b')]['fulfillment'][_0x4533('0x2c')];_0x4fdbda[_0x4533('0x2d')]=_0x4533('0x29');_0x4fdbda[_0x4533('0x2e')]=JSON[_0x4533('0x23')](_0x4c640c);return rpc[_0x57ff74+_0x4533('0x2f')][_0x4533('0x20')](_0x4fdbda)[_0x4533('0x21')](function(_0x45ad98){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x4dea06,_0x4fdbda[_0x4533('0x2a')]);if(_0x4c640c['result'][_0x4533('0x30')]['endConversation']){_0x487906[_0x4533('0xf')]();}else{_0x487906[_0x4533('0x26')]();}})[_0x4533('0x22')](function(_0x4300c1){logger[_0x4533('0x31')](_0x4533('0xd'),_0x4dea06,JSON[_0x4533('0x23')](_0x4300c1));_0x487906[_0x4533('0xf')]();});})[_0x4533('0x22')](function(_0x43682f){logger[_0x4533('0x31')](_0x4533('0xd'),_0x4dea06,_0x43682f[_0x4533('0x32')]);_0x487906['next']();});}}catch(_0x2489ce){logger['error'](_0x4533('0xd'),_0x4dea06,JSON[_0x4533('0x23')](_0x2489ce));_0x487906[_0x4533('0x26')]();}};}; \ 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 984e8a5..b0c6ffc 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 _0x03fa=['whatsapp','phone','interaction','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','isEmpty','getMustacheRender','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath','message','length','dialogflowV2','queryResult','diagnosticInfo','fields','boolValue','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','end_conversation','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','providerName','providerResponse','fulfillmentText','all','stack','lodash','md5','bluebird','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','body','Message','create','then','info','catch','error','[%s][DIALOGFLOWV2]\x20%s','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'];(function(_0x2495a5,_0x26a90b){var _0xe69a2f=function(_0x1169d8){while(--_0x1169d8){_0x2495a5['push'](_0x2495a5['shift']());}};_0xe69a2f(++_0x26a90b);}(_0x03fa,0x70));var _0xa03f=function(_0x2a851d,_0x48e8d0){_0x2a851d=_0x2a851d-0x0;var _0x138c9f=_0x03fa[_0x2a851d];return _0x138c9f;};'use strict';var _=require(_0xa03f('0x0'));var dialogflow=require('dialogflow');var md5=require(_0xa03f('0x1'));var moment=require('moment');var Promise=require(_0xa03f('0x2'));var logger=require(_0xa03f('0x3'))(_0xa03f('0x4'));var utils=require('./utils');var rpc={'chatMessage':require(_0xa03f('0x5')),'openchannelMessage':require(_0xa03f('0x6')),'mailMessage':require(_0xa03f('0x7')),'smsMessage':require(_0xa03f('0x8')),'faxMessage':require(_0xa03f('0x9')),'whatsappMessage':require('../../rpc/whatsappMessage')};function createMessage(_0x223794,_0x4bdf5b,_0x921917,_0x51b54a){return new Promise(function(_0x5a3fcd,_0x17eba4){var _0x2beacc=_['clone'](_0x921917);_0x2beacc[_0xa03f('0xa')]=_0x51b54a;return rpc[_0x4bdf5b+_0xa03f('0xb')][_0xa03f('0xc')](_0x2beacc)[_0xa03f('0xd')](function(){logger[_0xa03f('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0x223794,_0x2beacc['body']);_0x5a3fcd();})[_0xa03f('0xf')](function(_0x3eba0d){logger[_0xa03f('0x10')](_0xa03f('0x11'),_0x223794,JSON[_0xa03f('0x12')](_0x3eba0d));_0x17eba4(_0x3eba0d);});});}exports[_0xa03f('0x13')]=function(_0xdc715b,_0x20eccd){return function(_0x468dfb){try{if(!_[_0xa03f('0x14')](this['interaction'][_0xa03f('0x15')])){logger['info'](_0xa03f('0x11'),_0xdc715b,_0xa03f('0x16'));return _0x468dfb[_0xa03f('0x17')]();}var _0x324480={'ContactId':this[_0xa03f('0x18')]['id'],'sentAt':moment()[_0xa03f('0x19')](_0xa03f('0x1a')),'direction':_0xa03f('0x1b')};if(this[_0xa03f('0x1c')]===_0xa03f('0x1d')||this[_0xa03f('0x1c')]===_0xa03f('0x1e')){_0x324480[_0xa03f('0x1f')]=this[_0xa03f('0x20')][_0xa03f('0x1f')];}var _0x531f1e=this[_0xa03f('0x1c')];if(_0x531f1e===_0xa03f('0x21')){_0x324480[_0xa03f('0x22')]=this[_0xa03f('0x23')]['id'];}else{_0x324480[_[_0xa03f('0x24')](_0x531f1e)+_0xa03f('0x25')]=this['account']['id'];}_0x324480[_['upperFirst'](_0x531f1e)+_0xa03f('0x26')]=this['interaction']['id'];if(this[_0xa03f('0x20')][_0xa03f('0x27')]){var _0xfa829c=_0x20eccd[0x4];if(!_[_0xa03f('0x28')](_0xfa829c)){_0x324480['body']=utils[_0xa03f('0x29')](_0xfa829c,this);return rpc[_0x531f1e+_0xa03f('0xb')][_0xa03f('0xc')](_0x324480)[_0xa03f('0xd')](function(_0x284065){logger[_0xa03f('0xe')]('[%s][DIALOGFLOWV2]\x20%s',_0xdc715b,_0x324480['body']);})[_0xa03f('0xf')](function(_0x1f97bb){logger[_0xa03f('0x10')](_0xa03f('0x11'),_0xdc715b,JSON[_0xa03f('0x12')](_0x1f97bb));})['finally'](function(){logger[_0xa03f('0xe')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0xdc715b);_0x468dfb[_0xa03f('0x2a')]();});}else{logger[_0xa03f('0xe')](_0xa03f('0x2b'),_0xdc715b);_0x468dfb[_0xa03f('0x2a')]();}}else{var _0x1c2a8b=this;var _0x315d3c=_0x20eccd[0x2][_0xa03f('0x2c')](/\\n/g,'\x0a');var _0x5dc284={'credentials':{'private_key':_0x315d3c,'client_email':_0x20eccd[0x1]}};var _0x3b38ac=new dialogflow['SessionsClient'](_0x5dc284);var _0x4596d2=_0x3b38ac[_0xa03f('0x2d')](_0x20eccd[0x0],md5(_0x1c2a8b['interaction']['id']));var _0x122512={'session':_0x4596d2,'queryInput':{'text':{'text':_0x1c2a8b[_0xa03f('0x2e')]['body'],'languageCode':_0x20eccd[0x3]||'en'}}};return _0x3b38ac['detectIntent'](_0x122512)[_0xa03f('0xd')](function(_0x170f4d){if(_0x170f4d&&_0x170f4d[_0xa03f('0x2f')]){_0x1c2a8b[_0xa03f('0xa')][_0xa03f('0x30')]=_0x170f4d;var _0x1fdcbd=_0x170f4d[0x0];var _0x24e8cd=_0x1fdcbd[_0xa03f('0x31')][_0xa03f('0x32')]&&_0x1fdcbd['queryResult'][_0xa03f('0x32')][_0xa03f('0x33')]?_0x1fdcbd[_0xa03f('0x31')][_0xa03f('0x32')][_0xa03f('0x33')]['end_conversation'][_0xa03f('0x34')]:![];_0x1c2a8b[_0xa03f('0xa')]['DIALOGFLOWV2_ACTION']=_0x1fdcbd[_0xa03f('0x31')]['action'];_0x1c2a8b[_0xa03f('0xa')]['DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT']=_0x1fdcbd[_0xa03f('0x31')][_0xa03f('0x35')];_0x1c2a8b[_0xa03f('0xa')][_0xa03f('0x36')]=_0x1fdcbd['queryResult'][_0xa03f('0x32')]&&_0x1fdcbd['queryResult']['diagnosticInfo'][_0xa03f('0x33')]?_0x1fdcbd['queryResult'][_0xa03f('0x32')][_0xa03f('0x33')][_0xa03f('0x37')][_0xa03f('0x34')]:![];_0x1c2a8b['body']['DIALOGFLOWV2_INTENTNAME']=_0x1fdcbd[_0xa03f('0x31')][_0xa03f('0x38')][_0xa03f('0x39')];_0x1c2a8b[_0xa03f('0xa')][_0xa03f('0x3a')]=_0x1fdcbd[_0xa03f('0x31')][_0xa03f('0x38')][_0xa03f('0x3b')];_0x1c2a8b[_0xa03f('0xa')][_0xa03f('0x3c')]=_0x1fdcbd['queryResult']['intent'][_0xa03f('0x3d')];_0x1c2a8b[_0xa03f('0xa')]['DIALOGFLOWV2_LANGUAGECODE']=_0x1fdcbd[_0xa03f('0x31')][_0xa03f('0x3e')];_0x1c2a8b[_0xa03f('0xa')][_0xa03f('0x3f')]=_0x1fdcbd[_0xa03f('0x31')][_0xa03f('0x40')];_0x1c2a8b[_0xa03f('0xa')][_0xa03f('0x41')]=_0x1fdcbd[_0xa03f('0x31')]['intentDetectionConfidence'];_0x324480[_0xa03f('0x42')]=_0xa03f('0x30');_0x324480[_0xa03f('0x43')]=JSON[_0xa03f('0x12')](_0x170f4d);var _0x19e905=[];for(var _0x5db334=0x0;_0x5db334<_0x170f4d[_0xa03f('0x2f')];_0x5db334++){var _0x133b89=_0x170f4d[_0x5db334];if(_0x133b89&&_0x133b89[_0xa03f('0x31')]&&_0x133b89[_0xa03f('0x31')][_0xa03f('0x44')]){_0x19e905['push'](createMessage(_0xdc715b,_0x531f1e,_0x324480,_0x133b89[_0xa03f('0x31')][_0xa03f('0x44')]));}}return Promise[_0xa03f('0x45')](_0x19e905)[_0xa03f('0xd')](function(){if(_0x24e8cd){_0x468dfb[_0xa03f('0x17')]();}else{_0x468dfb['stop']();}})[_0xa03f('0xf')](function(_0x43d225){logger[_0xa03f('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0xdc715b,JSON[_0xa03f('0x12')](_0x43d225));_0x468dfb['next']();});}})['catch'](function(_0x25c901){logger['error'](_0xa03f('0x11'),_0xdc715b,_0x25c901[_0xa03f('0x2e')],_0x25c901[_0xa03f('0x46')]);_0x468dfb[_0xa03f('0x17')]();});}}catch(_0x50778d){logger[_0xa03f('0x10')]('[%s][DIALOGFLOWV2]\x20%s',_0xdc715b,JSON[_0xa03f('0x12')](_0x50778d));_0x468dfb[_0xa03f('0x2a')]();}};}; \ No newline at end of file +var _0xbffb=['next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','whatsapp','phone','interaction','upperFirst','AccountId','account','InteractionId','created','isEmpty','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','sessionPath','message','detectIntent','length','diagnosticInfo','queryResult','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','DIALOGFLOWV2_ENDCONVERSATION','fields','end_conversation','boolValue','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','DIALOGFLOWV2_QUERYTEXT','DIALOGFLOWV2_SCORE','intentDetectionConfidence','dialogflowV2','providerResponse','fulfillmentText','all','stack','lodash','dialogflow','md5','moment','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','body','Message','create','then','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','UserId'];(function(_0x3aef0d,_0x51ecf6){var _0xd1d7f6=function(_0x5c74ae){while(--_0x5c74ae){_0x3aef0d['push'](_0x3aef0d['shift']());}};_0xd1d7f6(++_0x51ecf6);}(_0xbffb,0x112));var _0xbbff=function(_0x450b00,_0x1cc659){_0x450b00=_0x450b00-0x0;var _0x219b54=_0xbffb[_0x450b00];return _0x219b54;};'use strict';var _=require(_0xbbff('0x0'));var dialogflow=require(_0xbbff('0x1'));var md5=require(_0xbbff('0x2'));var moment=require(_0xbbff('0x3'));var Promise=require('bluebird');var logger=require(_0xbbff('0x4'))(_0xbbff('0x5'));var utils=require(_0xbbff('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xbbff('0x7')),'mailMessage':require(_0xbbff('0x8')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xbbff('0x9')),'whatsappMessage':require(_0xbbff('0xa'))};function createMessage(_0x333a5e,_0x53176f,_0x3be074,_0x28c1cc){return new Promise(function(_0x2b1d5d,_0x5ebab5){var _0x11b790=_['clone'](_0x3be074);_0x11b790[_0xbbff('0xb')]=_0x28c1cc;return rpc[_0x53176f+_0xbbff('0xc')][_0xbbff('0xd')](_0x11b790)[_0xbbff('0xe')](function(){logger[_0xbbff('0xf')](_0xbbff('0x10'),_0x333a5e,_0x11b790[_0xbbff('0xb')]);_0x2b1d5d();})[_0xbbff('0x11')](function(_0x4940a7){logger[_0xbbff('0x12')](_0xbbff('0x10'),_0x333a5e,JSON[_0xbbff('0x13')](_0x4940a7));_0x5ebab5(_0x4940a7);});});}exports[_0xbbff('0x14')]=function(_0x3de3a5,_0x192dd7){return function(_0x4be5cf){try{if(!_['isNil'](this['interaction'][_0xbbff('0x15')])){logger[_0xbbff('0xf')](_0xbbff('0x10'),_0x3de3a5,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x4be5cf[_0xbbff('0x16')]();}var _0x174f6d={'ContactId':this[_0xbbff('0x17')]['id'],'sentAt':moment()[_0xbbff('0x18')](_0xbbff('0x19')),'direction':_0xbbff('0x1a')};if(this[_0xbbff('0x1b')]==='sms'||this['channel']===_0xbbff('0x1c')){_0x174f6d[_0xbbff('0x1d')]=this[_0xbbff('0x1e')][_0xbbff('0x1d')];}var _0x45d26a=this['channel'];if(_0x45d26a==='chat'){_0x174f6d['ChatWebsiteId']=this['account']['id'];}else{_0x174f6d[_[_0xbbff('0x1f')](_0x45d26a)+_0xbbff('0x20')]=this[_0xbbff('0x21')]['id'];}_0x174f6d[_[_0xbbff('0x1f')](_0x45d26a)+_0xbbff('0x22')]=this[_0xbbff('0x1e')]['id'];if(this['interaction'][_0xbbff('0x23')]){var _0x3cce1c=_0x192dd7[0x4];if(!_[_0xbbff('0x24')](_0x3cce1c)){_0x174f6d[_0xbbff('0xb')]=utils[_0xbbff('0x25')](_0x3cce1c,this);return rpc[_0x45d26a+_0xbbff('0xc')][_0xbbff('0xd')](_0x174f6d)[_0xbbff('0xe')](function(_0x32e9bb){logger[_0xbbff('0xf')](_0xbbff('0x10'),_0x3de3a5,_0x174f6d[_0xbbff('0xb')]);})['catch'](function(_0x3e116f){logger['error'](_0xbbff('0x10'),_0x3de3a5,JSON[_0xbbff('0x13')](_0x3e116f));})[_0xbbff('0x26')](function(){logger[_0xbbff('0xf')](_0xbbff('0x27'),_0x3de3a5);_0x4be5cf[_0xbbff('0x28')]();});}else{logger[_0xbbff('0xf')](_0xbbff('0x29'),_0x3de3a5);_0x4be5cf['stop']();}}else{var _0x25bc49=this;var _0x1cb8d4=_0x192dd7[0x2][_0xbbff('0x2a')](/\\n/g,'\x0a');var _0x2a3881={'credentials':{'private_key':_0x1cb8d4,'client_email':_0x192dd7[0x1]}};var _0x35839a=new dialogflow[(_0xbbff('0x2b'))](_0x2a3881);var _0x48a900=_0x35839a[_0xbbff('0x2c')](_0x192dd7[0x0],md5(_0x25bc49['interaction']['id']));var _0x4c9987={'session':_0x48a900,'queryInput':{'text':{'text':_0x25bc49[_0xbbff('0x2d')]['body'],'languageCode':_0x192dd7[0x3]||'en'}}};return _0x35839a[_0xbbff('0x2e')](_0x4c9987)[_0xbbff('0xe')](function(_0x4863d5){if(_0x4863d5&&_0x4863d5[_0xbbff('0x2f')]){_0x25bc49[_0xbbff('0xb')]['dialogflowV2']=_0x4863d5;var _0x241dc3=_0x4863d5[0x0];var _0x3d138d=_0x241dc3['queryResult'][_0xbbff('0x30')]&&_0x241dc3[_0xbbff('0x31')]['diagnosticInfo']['fields']?_0x241dc3['queryResult'][_0xbbff('0x30')]['fields']['end_conversation']['boolValue']:![];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x32')]=_0x241dc3[_0xbbff('0x31')][_0xbbff('0x33')];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x34')]=_0x241dc3[_0xbbff('0x31')]['allRequiredParamsPresent'];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x35')]=_0x241dc3[_0xbbff('0x31')]['diagnosticInfo']&&_0x241dc3[_0xbbff('0x31')][_0xbbff('0x30')]['fields']?_0x241dc3['queryResult']['diagnosticInfo'][_0xbbff('0x36')][_0xbbff('0x37')][_0xbbff('0x38')]:![];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x39')]=_0x241dc3[_0xbbff('0x31')][_0xbbff('0x3a')][_0xbbff('0x3b')];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x3c')]=_0x241dc3['queryResult']['intent'][_0xbbff('0x3d')];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x3e')]=_0x241dc3[_0xbbff('0x31')][_0xbbff('0x3a')][_0xbbff('0x3f')];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x40')]=_0x241dc3['queryResult'][_0xbbff('0x41')];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x42')]=_0x241dc3['queryResult']['queryText'];_0x25bc49[_0xbbff('0xb')][_0xbbff('0x43')]=_0x241dc3[_0xbbff('0x31')][_0xbbff('0x44')];_0x174f6d['providerName']=_0xbbff('0x45');_0x174f6d[_0xbbff('0x46')]=JSON[_0xbbff('0x13')](_0x4863d5);var _0x498f60=[];for(var _0x48a87f=0x0;_0x48a87f<_0x4863d5[_0xbbff('0x2f')];_0x48a87f++){var _0x4b1c12=_0x4863d5[_0x48a87f];if(_0x4b1c12&&_0x4b1c12['queryResult']&&_0x4b1c12[_0xbbff('0x31')]['fulfillmentText']){_0x498f60['push'](createMessage(_0x3de3a5,_0x45d26a,_0x174f6d,_0x4b1c12[_0xbbff('0x31')][_0xbbff('0x47')]));}}return Promise[_0xbbff('0x48')](_0x498f60)[_0xbbff('0xe')](function(){if(_0x3d138d){_0x4be5cf[_0xbbff('0x16')]();}else{_0x4be5cf['stop']();}})[_0xbbff('0x11')](function(_0x5a5525){logger[_0xbbff('0x12')](_0xbbff('0x10'),_0x3de3a5,JSON['stringify'](_0x5a5525));_0x4be5cf[_0xbbff('0x16')]();});}})['catch'](function(_0x366b96){logger['error'](_0xbbff('0x10'),_0x3de3a5,_0x366b96[_0xbbff('0x2d')],_0x366b96[_0xbbff('0x49')]);_0x4be5cf['next']();});}}catch(_0x35d7f1){logger[_0xbbff('0x12')](_0xbbff('0x10'),_0x3de3a5,JSON['stringify'](_0x35d7f1));_0x4be5cf[_0xbbff('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 e8161ab..3326851 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 _0x6762=['[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','validate','lodash','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','length','[%s][GOTOIF]\x20%s','map','join','stop','condition','priorityTrue','priorityFalse','info','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6762,0x11a));var _0x2676=function(_0x2f8dd9,_0x31b477){_0x2f8dd9=_0x2f8dd9-0x0;var _0x2e8139=_0x6762[_0x2f8dd9];return _0x2e8139;};'use strict';var schema=require(_0x2676('0x0'));var _=require(_0x2676('0x1'));var htmlToText=require(_0x2676('0x2'));var utils=require(_0x2676('0x3'));var logger=require(_0x2676('0x4'))(_0x2676('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x2676('0x6')},'priorityTrue':{'type':_0x2676('0x7'),'message':_0x2676('0x8')},'priorityFalse':{'type':_0x2676('0x7'),'message':_0x2676('0x9')}});exports['consequence']=function(_0x20a1a6,_0x1b1e64){return function(_0x365e34){try{var _0x15f713={'condition':htmlToText[_0x2676('0xa')](utils[_0x2676('0xb')](_0x1b1e64[0x0],this),{'wordwrap':![]})[_0x2676('0xc')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1b1e64[0x1],'priorityFalse':_0x1b1e64[0x2]};var _0xe72a32=gotoif[_0x2676('0x0')](_0x15f713,{'typecast':!![]});if(_0xe72a32[_0x2676('0xd')]){logger['error'](_0x2676('0xe'),_0x20a1a6,_[_0x2676('0xf')](_0xe72a32,'message')[_0x2676('0x10')](',\x20'));_0x365e34[_0x2676('0x11')]();}else{try{var _0x17bd49=eval('('+_0x15f713[_0x2676('0x12')]+')');var _0x229de3=_0x17bd49?_0x15f713[_0x2676('0x13')]:_0x15f713[_0x2676('0x14')];logger[_0x2676('0x15')](_0x2676('0x16'),_0x20a1a6,_0x15f713[_0x2676('0x12')],_0x17bd49,_0x229de3||_0x2676('0x17'));if(_0x229de3){var _0x1f508c=_[_0x2676('0x18')](_0x365e34[_0x2676('0x19')](),{'p':_0x229de3});if(_0x1f508c>=0x0){logger[_0x2676('0x15')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x20a1a6,_0x229de3||_0x2676('0x17'),_0x1f508c);_0x365e34['next'](_0x1f508c);}else{logger[_0x2676('0x15')](_0x2676('0x1a'),_0x20a1a6,_0x229de3||_0x2676('0x17'));_0x365e34[_0x2676('0x11')]();}}else{_0x365e34[_0x2676('0x17')]();}}catch(_0x58a050){logger[_0x2676('0x1b')](_0x2676('0x1c'),_0x20a1a6,_0x58a050[_0x2676('0x1d')]);_0x365e34[_0x2676('0x11')]();}}}catch(_0x5bfb38){logger[_0x2676('0x1b')]('[%s][GOTOIF]\x20%s',_0x20a1a6,JSON[_0x2676('0x1e')](_0x5bfb38));_0x365e34[_0x2676('0x11')]();}};}; \ No newline at end of file +var _0x5912=['stringify','validate','lodash','html-to-text','../../../../config/logger','routing','string','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','priority\x20true\x20is\x20a\x20number','number','priority\x20false\x20is\x20a\x20number','getMustacheRender','replace','length','error','[%s][GOTOIF]\x20%s','map','stop','condition','priorityFalse','info','next','rules','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','[%s][GOTOIF]\x20eval\x20error:\x20%s','message'];(function(_0x3ee501,_0x4eee7b){var _0x2bd3b7=function(_0x5413bd){while(--_0x5413bd){_0x3ee501['push'](_0x3ee501['shift']());}};_0x2bd3b7(++_0x4eee7b);}(_0x5912,0x1a1));var _0x2591=function(_0x190a1e,_0x47e4ff){_0x190a1e=_0x190a1e-0x0;var _0x330d38=_0x5912[_0x190a1e];return _0x330d38;};'use strict';var schema=require(_0x2591('0x0'));var _=require(_0x2591('0x1'));var htmlToText=require(_0x2591('0x2'));var utils=require('./utils');var logger=require(_0x2591('0x3'))(_0x2591('0x4'));var gotoif=schema({'condition':{'type':_0x2591('0x5'),'required':!![],'message':_0x2591('0x6')},'priorityTrue':{'type':'number','message':_0x2591('0x7')},'priorityFalse':{'type':_0x2591('0x8'),'message':_0x2591('0x9')}});exports['consequence']=function(_0x1980c4,_0x580b21){return function(_0x1ef885){try{var _0x52c5e1={'condition':htmlToText['fromString'](utils[_0x2591('0xa')](_0x580b21[0x0],this),{'wordwrap':![]})[_0x2591('0xb')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x580b21[0x1],'priorityFalse':_0x580b21[0x2]};var _0x38f92b=gotoif[_0x2591('0x0')](_0x52c5e1,{'typecast':!![]});if(_0x38f92b[_0x2591('0xc')]){logger[_0x2591('0xd')](_0x2591('0xe'),_0x1980c4,_[_0x2591('0xf')](_0x38f92b,'message')['join'](',\x20'));_0x1ef885[_0x2591('0x10')]();}else{try{var _0x370639=eval('('+_0x52c5e1[_0x2591('0x11')]+')');var _0x1b5273=_0x370639?_0x52c5e1['priorityTrue']:_0x52c5e1[_0x2591('0x12')];logger[_0x2591('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x1980c4,_0x52c5e1[_0x2591('0x11')],_0x370639,_0x1b5273||_0x2591('0x14'));if(_0x1b5273){var _0x1c3a11=_['findIndex'](_0x1ef885[_0x2591('0x15')](),{'p':_0x1b5273});if(_0x1c3a11>=0x0){logger[_0x2591('0x13')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x1980c4,_0x1b5273||_0x2591('0x14'),_0x1c3a11);_0x1ef885[_0x2591('0x14')](_0x1c3a11);}else{logger['info'](_0x2591('0x16'),_0x1980c4,_0x1b5273||_0x2591('0x14'));_0x1ef885[_0x2591('0x10')]();}}else{_0x1ef885[_0x2591('0x14')]();}}catch(_0xdb8abb){logger['error'](_0x2591('0x17'),_0x1980c4,_0xdb8abb[_0x2591('0x18')]);_0x1ef885[_0x2591('0x10')]();}}}catch(_0x1a6305){logger[_0x2591('0xd')](_0x2591('0xe'),_0x1980c4,JSON[_0x2591('0x19')](_0x1a6305));_0x1ef885[_0x2591('0x10')]();}};}; \ 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 6bd199c..f8f3516 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 _0x0116=['message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','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','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','error','[%s][GOTOP]\x20%s','map'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0116,0x13a));var _0x6011=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x0116[_0x1cc8fe];return _0x230054;};'use strict';var schema=require(_0x6011('0x0'));var _=require('lodash');var logger=require(_0x6011('0x1'))(_0x6011('0x2'));var gotop=schema({'priority':{'type':_0x6011('0x3'),'required':!![],'message':_0x6011('0x4')}});exports[_0x6011('0x5')]=function(_0xcb38a5,_0x24369a){return function(_0x4d14aa){try{var _0x264aea={'priority':_0x24369a[0x0]};var _0x29ae8a=gotop[_0x6011('0x0')](_0x264aea,{'typecast':!![]});if(_0x29ae8a['length']){logger[_0x6011('0x6')](_0x6011('0x7'),_0xcb38a5,_[_0x6011('0x8')](_0x29ae8a,_0x6011('0x9'))['join'](',\x20'));_0x4d14aa[_0x6011('0xa')]();}else{logger[_0x6011('0xb')](_0x6011('0xc'),_0xcb38a5,_0x264aea[_0x6011('0xd')]);if(_0x264aea[_0x6011('0xd')]){var _0xc132a0=_['findIndex'](_0x4d14aa[_0x6011('0xe')](),{'p':_0x264aea[_0x6011('0xd')]});if(_0xc132a0>=0x0){logger[_0x6011('0xb')](_0x6011('0xf'),_0xcb38a5,_0x264aea[_0x6011('0xd')]||_0x6011('0x10'),_0xc132a0);_0x4d14aa['next'](_0xc132a0);}else{logger[_0x6011('0xb')](_0x6011('0x11'),_0xcb38a5,_0x264aea[_0x6011('0xd')]||_0x6011('0x10'));_0x4d14aa[_0x6011('0xa')]();}}else{_0x4d14aa[_0x6011('0x10')]();}}}catch(_0x4faf2d){logger[_0x6011('0x6')](_0x6011('0x7'),_0xcb38a5,JSON[_0x6011('0x12')](_0x4faf2d));_0x4d14aa[_0x6011('0xa')]();}};}; \ No newline at end of file +var _0x3fe1=['routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','message','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','stringify','validate','../../../../config/logger'];(function(_0x2b2dd1,_0x2c6ac7){var _0x5d2ef5=function(_0xacc039){while(--_0xacc039){_0x2b2dd1['push'](_0x2b2dd1['shift']());}};_0x5d2ef5(++_0x2c6ac7);}(_0x3fe1,0x142));var _0x13fe=function(_0x274fdb,_0x5919f7){_0x274fdb=_0x274fdb-0x0;var _0x3a21c6=_0x3fe1[_0x274fdb];return _0x3a21c6;};'use strict';var schema=require(_0x13fe('0x0'));var _=require('lodash');var logger=require(_0x13fe('0x1'))(_0x13fe('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x13fe('0x3')}});exports[_0x13fe('0x4')]=function(_0x2c8279,_0x47fedb){return function(_0x237021){try{var _0x545502={'priority':_0x47fedb[0x0]};var _0x45781e=gotop[_0x13fe('0x0')](_0x545502,{'typecast':!![]});if(_0x45781e[_0x13fe('0x5')]){logger[_0x13fe('0x6')](_0x13fe('0x7'),_0x2c8279,_['map'](_0x45781e,_0x13fe('0x8'))['join'](',\x20'));_0x237021[_0x13fe('0x9')]();}else{logger[_0x13fe('0xa')](_0x13fe('0xb'),_0x2c8279,_0x545502[_0x13fe('0xc')]);if(_0x545502[_0x13fe('0xc')]){var _0x4f5315=_['findIndex'](_0x237021[_0x13fe('0xd')](),{'p':_0x545502[_0x13fe('0xc')]});if(_0x4f5315>=0x0){logger[_0x13fe('0xa')](_0x13fe('0xe'),_0x2c8279,_0x545502[_0x13fe('0xc')]||'next',_0x4f5315);_0x237021['next'](_0x4f5315);}else{logger[_0x13fe('0xa')](_0x13fe('0xf'),_0x2c8279,_0x545502[_0x13fe('0xc')]||_0x13fe('0x10'));_0x237021['stop']();}}else{_0x237021['next']();}}}catch(_0x9abc43){logger['error'](_0x13fe('0x7'),_0x2c8279,JSON[_0x13fe('0x11')](_0x9abc43));_0x237021[_0x13fe('0x9')]();}};}; \ 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 1ebbbab..644e9be 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 _0xe12f=['[%s][MESSAGE]\x20%s','next','catch','error','stop','stringify','lodash','./utils','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','ChatWebsiteId','upperFirst','AccountId','account','channel','InteractionId','then','info'];(function(_0x486ecb,_0x263478){var _0x4f50ba=function(_0x18af66){while(--_0x18af66){_0x486ecb['push'](_0x486ecb['shift']());}};_0x4f50ba(++_0x263478);}(_0xe12f,0x83));var _0xfe12=function(_0x4ae570,_0xd437f5){_0x4ae570=_0x4ae570-0x0;var _0x10a773=_0xe12f[_0x4ae570];return _0x10a773;};'use strict';var _=require(_0xfe12('0x0'));var utils=require(_0xfe12('0x1'));var logger=require(_0xfe12('0x2'))(_0xfe12('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xfe12('0x4')),'mailMessage':require(_0xfe12('0x5')),'smsMessage':require(_0xfe12('0x6')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xfe12('0x7'))};exports[_0xfe12('0x8')]=function(_0x5836ec,_0x5e1480){return function(_0x69c193){try{var _0x4a3c75={'body':utils[_0xfe12('0x9')](_0x5e1480[0x0],this),'ContactId':this[_0xfe12('0xa')]['id']};if(this['channel']==='chat'){_0x4a3c75[_0xfe12('0xb')]=this['account']['id'];}else{_0x4a3c75[_[_0xfe12('0xc')](this['channel'])+_0xfe12('0xd')]=this[_0xfe12('0xe')]['id'];}_0x4a3c75[_[_0xfe12('0xc')](this[_0xfe12('0xf')])+_0xfe12('0x10')]=this['interaction']['id'];if(rpc[this[_0xfe12('0xf')]+'Message']){return rpc[this[_0xfe12('0xf')]+'Message']['create'](_0x4a3c75)[_0xfe12('0x11')](function(_0x1cfd29){logger[_0xfe12('0x12')](_0xfe12('0x13'),_0x5836ec,_0x4a3c75['body']);_0x69c193[_0xfe12('0x14')]();})[_0xfe12('0x15')](function(_0x5cdb35){logger[_0xfe12('0x16')](_0xfe12('0x13'),_0x5836ec,JSON['stringify'](_0x5cdb35));_0x69c193[_0xfe12('0x17')]();});}}catch(_0x1c8991){logger[_0xfe12('0x16')](_0xfe12('0x13'),_0x5836ec,JSON[_0xfe12('0x18')](_0x1c8991));_0x69c193[_0xfe12('0x17')]();}};}; \ No newline at end of file +var _0x23b4=['upperFirst','channel','InteractionId','interaction','Message','then','info','[%s][MESSAGE]\x20%s','body','next','error','stringify','stop','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','getMustacheRender','contact','account'];(function(_0xd85418,_0x3642c0){var _0x1e6e6e=function(_0x240d60){while(--_0x240d60){_0xd85418['push'](_0xd85418['shift']());}};_0x1e6e6e(++_0x3642c0);}(_0x23b4,0xf3));var _0x423b=function(_0x4d969d,_0x5ba668){_0x4d969d=_0x4d969d-0x0;var _0x57ea9a=_0x23b4[_0x4d969d];return _0x57ea9a;};'use strict';var _=require('lodash');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x423b('0x0'));var rpc={'chatMessage':require(_0x423b('0x1')),'openchannelMessage':require(_0x423b('0x2')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x423b('0x3')),'faxMessage':require(_0x423b('0x4')),'whatsappMessage':require(_0x423b('0x5'))};exports[_0x423b('0x6')]=function(_0x18dbfc,_0xed6337){return function(_0x55ae93){try{var _0x45f269={'body':utils[_0x423b('0x7')](_0xed6337[0x0],this),'ContactId':this[_0x423b('0x8')]['id']};if(this['channel']==='chat'){_0x45f269['ChatWebsiteId']=this[_0x423b('0x9')]['id'];}else{_0x45f269[_[_0x423b('0xa')](this[_0x423b('0xb')])+'AccountId']=this[_0x423b('0x9')]['id'];}_0x45f269[_['upperFirst'](this[_0x423b('0xb')])+_0x423b('0xc')]=this[_0x423b('0xd')]['id'];if(rpc[this[_0x423b('0xb')]+_0x423b('0xe')]){return rpc[this[_0x423b('0xb')]+_0x423b('0xe')]['create'](_0x45f269)[_0x423b('0xf')](function(_0x470670){logger[_0x423b('0x10')](_0x423b('0x11'),_0x18dbfc,_0x45f269[_0x423b('0x12')]);_0x55ae93[_0x423b('0x13')]();})['catch'](function(_0x67c560){logger[_0x423b('0x14')]('[%s][MESSAGE]\x20%s',_0x18dbfc,JSON[_0x423b('0x15')](_0x67c560));_0x55ae93['stop']();});}}catch(_0x12c164){logger[_0x423b('0x14')](_0x423b('0x11'),_0x18dbfc,JSON[_0x423b('0x15')](_0x12c164));_0x55ae93[_0x423b('0x16')]();}};}; \ 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 a9159df..6f822d0 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 _0x4bd0=['consequence','[%s][NOOP]\x20%s','getMustacheRender','next','error','stringify','stop','./utils','routing'];(function(_0x523906,_0x567b86){var _0x2c036f=function(_0x206e9b){while(--_0x206e9b){_0x523906['push'](_0x523906['shift']());}};_0x2c036f(++_0x567b86);}(_0x4bd0,0x15d));var _0x04bd=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4bd0[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0x04bd('0x0'));var logger=require('../../../../config/logger')(_0x04bd('0x1'));exports[_0x04bd('0x2')]=function(_0x359488,_0x17a5db){return function(_0x20f29d){try{logger['info'](_0x04bd('0x3'),_0x359488,utils[_0x04bd('0x4')](_0x17a5db[0x0],this));_0x20f29d[_0x04bd('0x5')]();}catch(_0x523e3e){logger[_0x04bd('0x6')]('[%s][NOOP]\x20%s',_0x359488,JSON[_0x04bd('0x7')](_0x523e3e));_0x20f29d[_0x04bd('0x8')]();}};}; \ No newline at end of file +var _0xcc0e=['stringify','stop','./utils','../../../../config/logger','info','[%s][NOOP]\x20%s','getMustacheRender','next'];(function(_0x2d4661,_0x2da65c){var _0x42ed1e=function(_0x263c50){while(--_0x263c50){_0x2d4661['push'](_0x2d4661['shift']());}};_0x42ed1e(++_0x2da65c);}(_0xcc0e,0x17a));var _0xecc0=function(_0x5cb7d6,_0x578957){_0x5cb7d6=_0x5cb7d6-0x0;var _0x2c8463=_0xcc0e[_0x5cb7d6];return _0x2c8463;};'use strict';var utils=require(_0xecc0('0x0'));var logger=require(_0xecc0('0x1'))('routing');exports['consequence']=function(_0x45046c,_0x189cb7){return function(_0xd13123){try{logger[_0xecc0('0x2')](_0xecc0('0x3'),_0x45046c,utils[_0xecc0('0x4')](_0x189cb7[0x0],this));_0xd13123[_0xecc0('0x5')]();}catch(_0x24e09a){logger['error'](_0xecc0('0x3'),_0x45046c,JSON[_0xecc0('0x6')](_0x24e09a));_0xd13123[_0xecc0('0x7')]();}};}; \ 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 31d5e99..f1a3bae 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 _0xf031=['redis','defaults','localhost','socket.io-emitter','queue_id','from','joinAt','clone','queue','account','push','capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/faxInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','waiting','body','contact','list','channel','QueueId','interaction','upperFirst','MessageId','message','chat','AccountId','WebsiteId','name','QueueReport','create','catch','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','accepted','info','[%s][STOP:QUEUE][NAME:%s]','Interaction','update','then','timeout','[%s][END:QUEUE][NAME:%s]','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','validate','lodash','util','seq-queue','ioredis','../../../../config/logger','routing','./strategy'];(function(_0x376b45,_0x5964fb){var _0x2341b3=function(_0x5a7f01){while(--_0x5a7f01){_0x376b45['push'](_0x376b45['shift']());}};_0x2341b3(++_0x5964fb);}(_0xf031,0xaa));var _0x1f03=function(_0x1d7274,_0x250316){_0x1d7274=_0x1d7274-0x0;var _0xffb734=_0xf031[_0x1d7274];return _0xffb734;};'use strict';var schema=require(_0x1f03('0x0'));var _=require(_0x1f03('0x1'));var util=require(_0x1f03('0x2'));var seqqueue=require(_0x1f03('0x3'));var moment=require('moment');var Redis=require(_0x1f03('0x4'));var config=require('../../../../config/environment');var logger=require(_0x1f03('0x5'))(_0x1f03('0x6'));var strategy=require(_0x1f03('0x7'));config[_0x1f03('0x8')]=_[_0x1f03('0x9')](config['redis'],{'host':_0x1f03('0xa'),'port':0x18eb});var io=require(_0x1f03('0xb'))(new Redis(config[_0x1f03('0x8')]));var attributes=['id',_0x1f03('0xc'),'account','queue',_0x1f03('0xd'),_0x1f03('0xe')];function emit(_0x233074,_0x246eb3,_0x12287e){io['to'](_0x233074)['emit'](_0x246eb3,_0x12287e);}function emitChannelQueueInteraction(_0x3adeae,_0x16fe42,_0x5d026b,_0x2029f1,_0x3b4c57,_0x45c009,_0xc0f560,_0x5b121a){var _0x20f7b1=_[_0x1f03('0xf')](_0x5d026b);_0x20f7b1['queue_id']=_0x5b121a;_0x20f7b1[_0x1f03('0x10')]=_0x16fe42;_0x20f7b1[_0x1f03('0x11')]=_0x2029f1;_0x20f7b1['id']=_0x3b4c57;if(_0x45c009){attributes[_0x1f03('0x12')](_[_0x1f03('0x13')](_0x3adeae)+_0x1f03('0x14'));_0xc0f560[util[_0x1f03('0x15')](_0x1f03('0x16'),_0x3adeae)][_0x3b4c57]=_[_0x1f03('0x17')](_0x20f7b1,attributes);}else{delete _0xc0f560[util[_0x1f03('0x15')]('%sQueuesWaitingInteractions',_0x3adeae)][_0x3b4c57];}emit(util['format'](_0x1f03('0x18'),_0x3adeae,_0x16fe42),util[_0x1f03('0x15')](_0x1f03('0x19'),_0x3adeae,_0x45c009?_0x1f03('0x1a'):'remove'),_[_0x1f03('0x17')](_0x20f7b1,attributes));}var rpc={'openchannelQueueReport':require(_0x1f03('0x1b')),'mailQueueReport':require(_0x1f03('0x1c')),'chatQueueReport':require(_0x1f03('0x1d')),'smsQueueReport':require(_0x1f03('0x1e')),'faxQueueReport':require(_0x1f03('0x1f')),'whatsappQueueReport':require(_0x1f03('0x20')),'chatInteraction':require('../../rpc/chatInteraction'),'faxInteraction':require(_0x1f03('0x21')),'mailInteraction':require(_0x1f03('0x22')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x1f03('0x23')),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var queue=schema({'name':{'type':_0x1f03('0x24'),'required':!![],'message':_0x1f03('0x25')},'timeout':{'type':_0x1f03('0x26'),'message':'timeout\x20is\x20a\x20number'}});function startRouting(_0x4763ed,_0x578cea,_0x5def15,_0xd19fad){if(_0x4763ed&&_0x578cea&&_0x5def15){_0x578cea[_0x1f03('0x27')]+=0x1;var _0x555dc3={'uniqueid':_0x4763ed,'from':_0x5def15[_0x1f03('0x28')]?_0x5def15['body'][_0x1f03('0xd')]:'','joinAt':moment()[_0x1f03('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x5def15['contact']?_0x5def15[_0x1f03('0x29')]['id']:null,'ListId':_0x5def15[_0x1f03('0x2a')]?_0x5def15[_0x1f03('0x2a')]['id']:null};_0x555dc3[_['upperFirst'](_0x5def15[_0x1f03('0x2b')])+_0x1f03('0x2c')]=_0x578cea['id']||null;_0x555dc3[_['upperFirst'](_0x5def15[_0x1f03('0x2b')])+_0x1f03('0x14')]=_0x5def15[_0x1f03('0x2d')]?_0x5def15[_0x1f03('0x2d')]['id']:null;_0x555dc3[_[_0x1f03('0x2e')](_0x5def15[_0x1f03('0x2b')])+_0x1f03('0x2f')]=_0x5def15[_0x1f03('0x30')]?_0x5def15[_0x1f03('0x30')]['id']:null;_0x555dc3[_[_0x1f03('0x2e')](_0x5def15[_0x1f03('0x2b')])+(_0x5def15[_0x1f03('0x2b')]!==_0x1f03('0x31')?_0x1f03('0x32'):_0x1f03('0x33'))]=_0x5def15[_0x1f03('0x11')]?_0x5def15[_0x1f03('0x11')]['id']:null;logger['info'](util[_0x1f03('0x15')]('[%s][START:QUEUE][NAME:%s]',_0x4763ed,_0x578cea[_0x1f03('0x34')]));emitChannelQueueInteraction(_0x5def15[_0x1f03('0x2b')],_0x578cea[_0x1f03('0x34')],_0x555dc3,_0x5def15[_0x1f03('0x11')][_0x1f03('0x34')],_0x5def15[_0x1f03('0x30')]['id'],!![],_0xd19fad,_0x578cea['id']);if(rpc[_0x5def15[_0x1f03('0x2b')]+_0x1f03('0x35')]){return rpc[_0x5def15[_0x1f03('0x2b')]+_0x1f03('0x35')][_0x1f03('0x36')](_0x555dc3)[_0x1f03('0x37')](function(_0x5cd5e5){logger[_0x1f03('0x38')](_0x1f03('0x39'),_0x5cd5e5);});}}}function stopRouting(_0x2ce5a0,_0x466a17,_0x4e256b,_0x15255a){if(_0x2ce5a0&&_0x466a17){_0x466a17[_0x1f03('0x27')]-=0x1;var _0x1e75a5={'leaveAt':moment()[_0x1f03('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x1f03('0x15')](_0x1f03('0x3a')),'reason':_0x1f03('0x3b')};logger[_0x1f03('0x3c')](util[_0x1f03('0x15')](_0x1f03('0x3d'),_0x2ce5a0,_0x466a17['name']));emitChannelQueueInteraction(_0x4e256b['channel'],_0x466a17['name'],_0x4e256b[_0x1f03('0x28')],_0x4e256b[_0x1f03('0x11')][_0x1f03('0x34')],_0x4e256b['message']['id'],![],_0x15255a,_0x466a17['id']);return rpc[_0x4e256b[_0x1f03('0x2b')]+_0x1f03('0x3e')][_0x1f03('0x3f')](_0x4e256b[_0x1f03('0x2d')]['id'],{'queueId':_0x466a17['id']})[_0x1f03('0x40')](function(){if(rpc[_0x4e256b[_0x1f03('0x2b')]+_0x1f03('0x35')]){return rpc[_0x4e256b[_0x1f03('0x2b')]+_0x1f03('0x35')][_0x1f03('0x3f')](_0x2ce5a0,_0x1e75a5)[_0x1f03('0x37')](function(_0x830365){logger[_0x1f03('0x38')]('update\x20queue\x20report',_0x830365);});}});}}function endRouting(_0xc6277a,_0xf10ee8,_0x10589b,_0x51f1f8){if(_0xc6277a&&_0xf10ee8){_0xf10ee8['waiting']-=0x1;var _0x51d7cc={'leaveAt':moment()[_0x1f03('0x15')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'reason':_0x1f03('0x41')};logger[_0x1f03('0x3c')](util[_0x1f03('0x15')](_0x1f03('0x42'),_0xc6277a,_0xf10ee8[_0x1f03('0x34')]));emitChannelQueueInteraction(_0x10589b[_0x1f03('0x2b')],_0xf10ee8[_0x1f03('0x34')],_0x10589b[_0x1f03('0x28')],_0x10589b[_0x1f03('0x11')][_0x1f03('0x34')],_0x10589b[_0x1f03('0x30')]['id'],![],_0x51f1f8);if(rpc[_0x10589b['channel']+_0x1f03('0x35')]){return rpc[_0x10589b['channel']+_0x1f03('0x35')][_0x1f03('0x3f')](_0xc6277a,_0x51d7cc)['catch'](function(_0x1b5513){logger[_0x1f03('0x38')](_0x1f03('0x43'),_0x1b5513);});}}}function handleFindQueue(_0x5c350c){return function(_0x21635a){return _0x21635a[_0x1f03('0x34')]['toLowerCase']()===_0x5c350c[_0x1f03('0x44')]();};}exports[_0x1f03('0x45')]=function(_0x4f1530,_0x41edd5,_0x5f0277,_0x38690e){return function(_0x3a56ad){try{var _0x21ac0b={'name':_0x41edd5[0x0],'timeout':_0x41edd5[0x1]};var _0x30036f=queue['validate'](_0x21ac0b,{'typecast':!![]});if(_0x30036f[_0x1f03('0x46')]){logger[_0x1f03('0x38')](_0x1f03('0x47'),_0x4f1530,_[_0x1f03('0x48')](_0x30036f,'message')[_0x1f03('0x49')](',\x20'));_0x3a56ad[_0x1f03('0x4a')]();}else{var _0x325a5c=_[_0x1f03('0x4b')](_0x5f0277[_0x38690e[_0x1f03('0x2b')]+_0x1f03('0x4c')],handleFindQueue(_0x21ac0b['name']));if(_0x325a5c){startRouting(_0x4f1530,_0x325a5c,_0x38690e,_0x5f0277);var _0x3d2ea7=(_0x325a5c[_0x1f03('0x41')]||0xa)*0x3e8;var _0x219e3d=(_0x21ac0b['timeout']||0x14)*0x3e8;var _0x4b7eb1;if(_0x3d2ea7>_0x219e3d){_0x219e3d=_0x3d2ea7;}var _0x1b2746=seqqueue[_0x1f03('0x4d')](_0x3d2ea7);_0x1b2746['id']=_0x4f1530;_0x1b2746[_0x1f03('0x4e')]=_0x3d2ea7;_0x1b2746[_0x1f03('0x4f')]=_0x219e3d;_0x1b2746[_0x1f03('0x2b')]=_0x38690e['channel'];_0x5f0277[_0x1f03('0x50')][_0x4f1530]['on'](_0x1f03('0x51'),function(){logger[_0x1f03('0x3c')](_0x1f03('0x52'),_0x4f1530);stopRouting(_0x4f1530,_0x325a5c,_0x38690e,_0x5f0277);clearTimeout(_0x4b7eb1);_0x4b7eb1=undefined;_0x1b2746['close'](!![]);if(_0x5f0277[_0x1f03('0x50')][_0x4f1530]){delete _0x5f0277['rules'][_0x4f1530];}_0x3a56ad[_0x1f03('0x4a')]();});_0x5f0277['rules'][_0x4f1530]['on'](_0x1f03('0x53'),function(){if(_0x5f0277[_0x1f03('0x50')][_0x4f1530]){delete _0x5f0277['rules'][_0x4f1530];}});_0x4b7eb1=setTimeout(function(){logger[_0x1f03('0x3c')](_0x1f03('0x54'),_0x4f1530);endRouting(_0x4f1530,_0x325a5c,_0x38690e,_0x5f0277);clearTimeout(_0x4b7eb1);_0x1b2746['close'](!![]);_0x3a56ad[_0x1f03('0x55')]();},_0x219e3d);switch(_0x325a5c[_0x1f03('0x56')]){case _0x1f03('0x57'):strategy[_0x1f03('0x57')](_0x1b2746,_0x325a5c,_0x5f0277,_0x38690e);break;default:strategy[_0x1f03('0x58')](_0x1b2746,_0x325a5c,_0x5f0277,_0x38690e);}}else{logger[_0x1f03('0x38')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4f1530,_0x21ac0b[_0x1f03('0x34')]);_0x3a56ad[_0x1f03('0x4a')]();}}}catch(_0x24e9d1){logger['error'](_0x1f03('0x47'),_0x4f1530,_0x24e9d1['stack']);_0x3a56ad[_0x1f03('0x4a')]();}};}; \ No newline at end of file +var _0xb236=['ioredis','../../../../config/environment','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','emit','push','capitalize','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/whatsappInteraction','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','contact','list','upperFirst','interaction','channel','MessageId','message','AccountId','WebsiteId','info','name','QueueReport','create','catch','error','waiting','YYYY-MM-DD\x20HH:mm:ss','accepted','Interaction','update','then','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','[%s][QUEUE]\x20%s','map','join','stop','find','createQueue','atimeout','qtimeout','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','rules','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','validate','lodash','util','seq-queue','moment'];(function(_0x3aa088,_0x521aba){var _0x338e3c=function(_0x200a89){while(--_0x200a89){_0x3aa088['push'](_0x3aa088['shift']());}};_0x338e3c(++_0x521aba);}(_0xb236,0x157));var _0x6b23=function(_0x59f1,_0x51766e){_0x59f1=_0x59f1-0x0;var _0x179bd9=_0xb236[_0x59f1];return _0x179bd9;};'use strict';var schema=require(_0x6b23('0x0'));var _=require(_0x6b23('0x1'));var util=require(_0x6b23('0x2'));var seqqueue=require(_0x6b23('0x3'));var moment=require(_0x6b23('0x4'));var Redis=require(_0x6b23('0x5'));var config=require(_0x6b23('0x6'));var logger=require('../../../../config/logger')(_0x6b23('0x7'));var strategy=require(_0x6b23('0x8'));config[_0x6b23('0x9')]=_[_0x6b23('0xa')](config[_0x6b23('0x9')],{'host':_0x6b23('0xb'),'port':0x18eb});var io=require(_0x6b23('0xc'))(new Redis(config['redis']));var attributes=['id',_0x6b23('0xd'),_0x6b23('0xe'),_0x6b23('0xf'),_0x6b23('0x10'),_0x6b23('0x11')];function emit(_0x2f415c,_0x113f2d,_0x57146c){io['to'](_0x2f415c)[_0x6b23('0x12')](_0x113f2d,_0x57146c);}function emitChannelQueueInteraction(_0x34455d,_0x5d25f8,_0xe6f4cf,_0x58ee4f,_0x2f170b,_0x43bffc,_0x2e83fc,_0x4fb759){var _0x4acf71=_['clone'](_0xe6f4cf);_0x4acf71[_0x6b23('0xd')]=_0x4fb759;_0x4acf71[_0x6b23('0xf')]=_0x5d25f8;_0x4acf71['account']=_0x58ee4f;_0x4acf71['id']=_0x2f170b;if(_0x43bffc){attributes[_0x6b23('0x13')](_[_0x6b23('0x14')](_0x34455d)+_0x6b23('0x15'));_0x2e83fc[util['format'](_0x6b23('0x16'),_0x34455d)][_0x2f170b]=_[_0x6b23('0x17')](_0x4acf71,attributes);}else{delete _0x2e83fc[util[_0x6b23('0x18')](_0x6b23('0x16'),_0x34455d)][_0x2f170b];}emit(util[_0x6b23('0x18')](_0x6b23('0x19'),_0x34455d,_0x5d25f8),util[_0x6b23('0x18')](_0x6b23('0x1a'),_0x34455d,_0x43bffc?_0x6b23('0x1b'):_0x6b23('0x1c')),_[_0x6b23('0x17')](_0x4acf71,attributes));}var rpc={'openchannelQueueReport':require(_0x6b23('0x1d')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require(_0x6b23('0x1e')),'smsQueueReport':require(_0x6b23('0x1f')),'faxQueueReport':require(_0x6b23('0x20')),'whatsappQueueReport':require(_0x6b23('0x21')),'chatInteraction':require(_0x6b23('0x22')),'faxInteraction':require('../../rpc/faxInteraction'),'mailInteraction':require(_0x6b23('0x23')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x6b23('0x24')),'whatsappInteraction':require(_0x6b23('0x25'))};var queue=schema({'name':{'type':_0x6b23('0x26'),'required':!![],'message':_0x6b23('0x27')},'timeout':{'type':_0x6b23('0x28'),'message':_0x6b23('0x29')}});function startRouting(_0x4b0bbd,_0x3f34bf,_0x2b58da,_0x38e3dc){if(_0x4b0bbd&&_0x3f34bf&&_0x2b58da){_0x3f34bf['waiting']+=0x1;var _0x38bab0={'uniqueid':_0x4b0bbd,'from':_0x2b58da[_0x6b23('0x2a')]?_0x2b58da[_0x6b23('0x2a')][_0x6b23('0x10')]:'','joinAt':moment()[_0x6b23('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x2b58da[_0x6b23('0x2b')]?_0x2b58da[_0x6b23('0x2b')]['id']:null,'ListId':_0x2b58da[_0x6b23('0x2c')]?_0x2b58da[_0x6b23('0x2c')]['id']:null};_0x38bab0[_[_0x6b23('0x2d')](_0x2b58da['channel'])+'QueueId']=_0x3f34bf['id']||null;_0x38bab0[_[_0x6b23('0x2d')](_0x2b58da['channel'])+_0x6b23('0x15')]=_0x2b58da[_0x6b23('0x2e')]?_0x2b58da[_0x6b23('0x2e')]['id']:null;_0x38bab0[_[_0x6b23('0x2d')](_0x2b58da[_0x6b23('0x2f')])+_0x6b23('0x30')]=_0x2b58da['message']?_0x2b58da[_0x6b23('0x31')]['id']:null;_0x38bab0[_[_0x6b23('0x2d')](_0x2b58da[_0x6b23('0x2f')])+(_0x2b58da['channel']!=='chat'?_0x6b23('0x32'):_0x6b23('0x33'))]=_0x2b58da['account']?_0x2b58da[_0x6b23('0xe')]['id']:null;logger[_0x6b23('0x34')](util[_0x6b23('0x18')]('[%s][START:QUEUE][NAME:%s]',_0x4b0bbd,_0x3f34bf['name']));emitChannelQueueInteraction(_0x2b58da['channel'],_0x3f34bf[_0x6b23('0x35')],_0x38bab0,_0x2b58da[_0x6b23('0xe')]['name'],_0x2b58da[_0x6b23('0x31')]['id'],!![],_0x38e3dc,_0x3f34bf['id']);if(rpc[_0x2b58da[_0x6b23('0x2f')]+_0x6b23('0x36')]){return rpc[_0x2b58da[_0x6b23('0x2f')]+_0x6b23('0x36')][_0x6b23('0x37')](_0x38bab0)[_0x6b23('0x38')](function(_0x54ff2e){logger[_0x6b23('0x39')]('create\x20queue\x20report',_0x54ff2e);});}}}function stopRouting(_0x5a3f97,_0x4b6ef7,_0x142a30,_0x137249){if(_0x5a3f97&&_0x4b6ef7){_0x4b6ef7[_0x6b23('0x3a')]-=0x1;var _0x336a8c={'leaveAt':moment()[_0x6b23('0x18')]('YYYY-MM-DD\x20HH:mm:ss'),'acceptAt':moment()[_0x6b23('0x18')](_0x6b23('0x3b')),'reason':_0x6b23('0x3c')};logger[_0x6b23('0x34')](util[_0x6b23('0x18')]('[%s][STOP:QUEUE][NAME:%s]',_0x5a3f97,_0x4b6ef7[_0x6b23('0x35')]));emitChannelQueueInteraction(_0x142a30[_0x6b23('0x2f')],_0x4b6ef7[_0x6b23('0x35')],_0x142a30[_0x6b23('0x2a')],_0x142a30[_0x6b23('0xe')][_0x6b23('0x35')],_0x142a30[_0x6b23('0x31')]['id'],![],_0x137249,_0x4b6ef7['id']);return rpc[_0x142a30[_0x6b23('0x2f')]+_0x6b23('0x3d')][_0x6b23('0x3e')](_0x142a30['interaction']['id'],{'queueId':_0x4b6ef7['id']})[_0x6b23('0x3f')](function(){if(rpc[_0x142a30['channel']+_0x6b23('0x36')]){return rpc[_0x142a30[_0x6b23('0x2f')]+_0x6b23('0x36')]['update'](_0x5a3f97,_0x336a8c)[_0x6b23('0x38')](function(_0x5baa0c){logger['error'](_0x6b23('0x40'),_0x5baa0c);});}});}}function endRouting(_0x4ddfc3,_0x53c316,_0x273b37,_0x29a258){if(_0x4ddfc3&&_0x53c316){_0x53c316['waiting']-=0x1;var _0x4d1a50={'leaveAt':moment()[_0x6b23('0x18')](_0x6b23('0x3b')),'exitAt':moment()[_0x6b23('0x18')](_0x6b23('0x3b')),'reason':_0x6b23('0x41')};logger[_0x6b23('0x34')](util[_0x6b23('0x18')](_0x6b23('0x42'),_0x4ddfc3,_0x53c316[_0x6b23('0x35')]));emitChannelQueueInteraction(_0x273b37[_0x6b23('0x2f')],_0x53c316[_0x6b23('0x35')],_0x273b37[_0x6b23('0x2a')],_0x273b37[_0x6b23('0xe')][_0x6b23('0x35')],_0x273b37[_0x6b23('0x31')]['id'],![],_0x29a258);if(rpc[_0x273b37['channel']+_0x6b23('0x36')]){return rpc[_0x273b37[_0x6b23('0x2f')]+_0x6b23('0x36')][_0x6b23('0x3e')](_0x4ddfc3,_0x4d1a50)['catch'](function(_0x7e0347){logger[_0x6b23('0x39')](_0x6b23('0x40'),_0x7e0347);});}}}function handleFindQueue(_0x1b9e9f){return function(_0x404cfb){return _0x404cfb[_0x6b23('0x35')][_0x6b23('0x43')]()===_0x1b9e9f[_0x6b23('0x43')]();};}exports[_0x6b23('0x44')]=function(_0x5a4bd1,_0x1e7c2c,_0x27136c,_0x2bb70a){return function(_0x204c06){try{var _0x29c64f={'name':_0x1e7c2c[0x0],'timeout':_0x1e7c2c[0x1]};var _0x4e4d2c=queue[_0x6b23('0x0')](_0x29c64f,{'typecast':!![]});if(_0x4e4d2c['length']){logger[_0x6b23('0x39')](_0x6b23('0x45'),_0x5a4bd1,_[_0x6b23('0x46')](_0x4e4d2c,_0x6b23('0x31'))[_0x6b23('0x47')](',\x20'));_0x204c06[_0x6b23('0x48')]();}else{var _0x300ba0=_[_0x6b23('0x49')](_0x27136c[_0x2bb70a[_0x6b23('0x2f')]+'Queues'],handleFindQueue(_0x29c64f[_0x6b23('0x35')]));if(_0x300ba0){startRouting(_0x5a4bd1,_0x300ba0,_0x2bb70a,_0x27136c);var _0x1cf91e=(_0x300ba0[_0x6b23('0x41')]||0xa)*0x3e8;var _0x584b2e=(_0x29c64f[_0x6b23('0x41')]||0x14)*0x3e8;var _0xd529e1;if(_0x1cf91e>_0x584b2e){_0x584b2e=_0x1cf91e;}var _0x287023=seqqueue[_0x6b23('0x4a')](_0x1cf91e);_0x287023['id']=_0x5a4bd1;_0x287023[_0x6b23('0x4b')]=_0x1cf91e;_0x287023[_0x6b23('0x4c')]=_0x584b2e;_0x287023[_0x6b23('0x2f')]=_0x2bb70a[_0x6b23('0x2f')];_0x27136c['rules'][_0x5a4bd1]['on'](_0x6b23('0x4d'),function(){logger[_0x6b23('0x34')](_0x6b23('0x4e'),_0x5a4bd1);stopRouting(_0x5a4bd1,_0x300ba0,_0x2bb70a,_0x27136c);clearTimeout(_0xd529e1);_0xd529e1=undefined;_0x287023[_0x6b23('0x4f')](!![]);if(_0x27136c[_0x6b23('0x50')][_0x5a4bd1]){delete _0x27136c['rules'][_0x5a4bd1];}_0x204c06['stop']();});_0x27136c[_0x6b23('0x50')][_0x5a4bd1]['on'](_0x6b23('0x51'),function(){if(_0x27136c['rules'][_0x5a4bd1]){delete _0x27136c['rules'][_0x5a4bd1];}});_0xd529e1=setTimeout(function(){logger[_0x6b23('0x34')](_0x6b23('0x52'),_0x5a4bd1);endRouting(_0x5a4bd1,_0x300ba0,_0x2bb70a,_0x27136c);clearTimeout(_0xd529e1);_0x287023[_0x6b23('0x4f')](!![]);_0x204c06[_0x6b23('0x53')]();},_0x584b2e);switch(_0x300ba0[_0x6b23('0x54')]){case _0x6b23('0x55'):strategy[_0x6b23('0x55')](_0x287023,_0x300ba0,_0x27136c,_0x2bb70a);break;default:strategy['beepall'](_0x287023,_0x300ba0,_0x27136c,_0x2bb70a);}}else{logger[_0x6b23('0x39')](_0x6b23('0x56'),_0x5a4bd1,_0x29c64f[_0x6b23('0x35')]);_0x204c06[_0x6b23('0x48')]();}}}catch(_0x5cbb2f){logger[_0x6b23('0x39')]('[%s][QUEUE]\x20%s',_0x5a4bd1,_0x5cbb2f['stack']);_0x204c06[_0x6b23('0x48')]();}};}; \ 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 49c6e98..863cc09 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 _0xf3cd=['notificationId','agent','realtime','squeue','push','handleRun','handleTimeout','timeout','drained','handleDrained','bind','prototype','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable','channel','busyQueue','saveWaitingNotification','showNotification','writeLog','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','busy','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1be9ce,_0x27443d){_0x1be9ce=_0x1be9ce-0x0;var _0x164439=_0xf3cd[_0x1be9ce];return _0x164439;};'use strict';var _=require(_0xdf3c('0x0'));var uuid=require(_0xdf3c('0x1'));var util=require(_0xdf3c('0x2'));var logger=require(_0xdf3c('0x3'))(_0xdf3c('0x4'));var Agent=function(_0x433a7f,_0x54db05,_0x401518,_0x71b446){this[_0xdf3c('0x5')]=uuid['v4']();this['squeue']=_0x433a7f;this[_0xdf3c('0x6')]=_0x54db05;this[_0xdf3c('0x7')]=_0x401518;this[_0xdf3c('0x4')]=_0x71b446;this[_0xdf3c('0x8')][_0xdf3c('0x9')](this[_0xdf3c('0xa')]['bind'](this),this[_0xdf3c('0xb')]['bind'](this));this['squeue']['on'](_0xdf3c('0xc'),this[_0xdf3c('0xb')]['bind'](this));this[_0xdf3c('0x8')]['on'](_0xdf3c('0xd'),this[_0xdf3c('0xe')][_0xdf3c('0xf')](this));};Agent[_0xdf3c('0x10')][_0xdf3c('0x9')]=function(){this[_0xdf3c('0x8')][_0xdf3c('0x9')](this['handleRun'][_0xdf3c('0xf')](this),this[_0xdf3c('0xb')][_0xdf3c('0xf')](this));};Agent[_0xdf3c('0x10')]['handleDrained']=function(){this[_0xdf3c('0xb')](!![]);};Agent[_0xdf3c('0x10')][_0xdf3c('0xa')]=function(){logger['debug'](_0xdf3c('0x11'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);if(_[_0xdf3c('0x12')](this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']])){logger[_0xdf3c('0x14')](_0xdf3c('0x15'),this[_0xdf3c('0x8')]['id'],this['agent']['id']);setTimeout(this[_0xdf3c('0x9')][_0xdf3c('0xf')](this),0x3e8);}else{if(this[_0xdf3c('0x4')][_0xdf3c('0x16')]||util[_0xdf3c('0x17')](this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],this[_0xdf3c('0x8')][_0xdf3c('0x18')],![])){this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']]['busy']=!![];this[_0xdf3c('0x7')]['agents'][this[_0xdf3c('0x6')]['id']][_0xdf3c('0x19')]=undefined;util[_0xdf3c('0x1a')](this[_0xdf3c('0x7')],this[_0xdf3c('0x4')],this[_0xdf3c('0x6')],this['squeue'][_0xdf3c('0x18')]);util[_0xdf3c('0x1b')](this[_0xdf3c('0x5')],this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],null,this[_0xdf3c('0x4')]);util[_0xdf3c('0x1c')](this[_0xdf3c('0x8')]['id'],this['realtime'][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']],'RINGING'+(this[_0xdf3c('0x4')]['forcedOwnership']?':FORCED':''));}else{logger['debug'](_0xdf3c('0x1d'),this[_0xdf3c('0x8')]['id'],this['agent']['id']);setTimeout(this['push'][_0xdf3c('0xf')](this),0x3e8);}}};Agent[_0xdf3c('0x10')][_0xdf3c('0xb')]=function(_0x1ccdd4){if(_['isNil'](this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']])){return logger['debug'](_0xdf3c('0x15'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);}else{logger['debug'](_0xdf3c('0x1e'),this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x6')]['id']);util[_0xdf3c('0x1f')](this['notificationId'],this[_0xdf3c('0x8')]['id'],this[_0xdf3c('0x7')]['agents'][this[_0xdf3c('0x6')]['id']],null,this[_0xdf3c('0x4')]);this[_0xdf3c('0x7')][_0xdf3c('0x13')][this['agent']['id']][_0xdf3c('0x20')]=![];this[_0xdf3c('0x7')][_0xdf3c('0x13')][this[_0xdf3c('0x6')]['id']]['busyQueue']=undefined;util[_0xdf3c('0x21')](this[_0xdf3c('0x7')],this['routing'],this['agent'],this[_0xdf3c('0x8')]['channel']);util[_0xdf3c('0x1c')](this['squeue']['id'],this['realtime']['agents'][this[_0xdf3c('0x6')]['id']],_0x1ccdd4?_0xdf3c('0x22'):_0xdf3c('0x23'));}if(!_0x1ccdd4){setTimeout(this[_0xdf3c('0x9')]['bind'](this),0x3e8);}};function agent(_0x49f147,_0x3d8557,_0x49d0f0,_0x46e40f){return new Agent(_0x49f147,_0x3d8557,_0x49d0f0,_0x46e40f);}module[_0xdf3c('0x24')]=agent; \ No newline at end of file +var _0x29d4=['routing','notificationId','squeue','agent','realtime','push','bind','timeout','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','debug','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','saveWaitingNotification','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','STOP','TIMEOUT','exports','lodash','./util','../../../../../config/logger'];(function(_0x521154,_0x1ecaef){var _0x57f638=function(_0x1235b3){while(--_0x1235b3){_0x521154['push'](_0x521154['shift']());}};_0x57f638(++_0x1ecaef);}(_0x29d4,0x1a1));var _0x429d=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x29d4[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0x429d('0x0'));var uuid=require('uuid');var util=require(_0x429d('0x1'));var logger=require(_0x429d('0x2'))(_0x429d('0x3'));var Agent=function(_0x472fc9,_0x45df1c,_0x4e287b,_0xc3989d){this[_0x429d('0x4')]=uuid['v4']();this[_0x429d('0x5')]=_0x472fc9;this[_0x429d('0x6')]=_0x45df1c;this[_0x429d('0x7')]=_0x4e287b;this[_0x429d('0x3')]=_0xc3989d;this[_0x429d('0x5')][_0x429d('0x8')](this['handleRun'][_0x429d('0x9')](this),this['handleTimeout'][_0x429d('0x9')](this));this[_0x429d('0x5')]['on'](_0x429d('0xa'),this['handleTimeout'][_0x429d('0x9')](this));this[_0x429d('0x5')]['on']('drained',this[_0x429d('0xb')][_0x429d('0x9')](this));};Agent[_0x429d('0xc')]['push']=function(){this[_0x429d('0x5')][_0x429d('0x8')](this[_0x429d('0xd')][_0x429d('0x9')](this),this['handleTimeout'][_0x429d('0x9')](this));};Agent[_0x429d('0xc')][_0x429d('0xb')]=function(){this['handleTimeout'](!![]);};Agent[_0x429d('0xc')][_0x429d('0xd')]=function(){logger['debug'](_0x429d('0xe'),this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);if(_[_0x429d('0xf')](this[_0x429d('0x7')][_0x429d('0x10')][this['agent']['id']])){logger[_0x429d('0x11')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);setTimeout(this[_0x429d('0x8')][_0x429d('0x9')](this),0x3e8);}else{if(this['routing'][_0x429d('0x12')]||util[_0x429d('0x13')](this[_0x429d('0x5')]['id'],this['realtime'][_0x429d('0x10')][this[_0x429d('0x6')]['id']],this[_0x429d('0x5')][_0x429d('0x14')],![])){this[_0x429d('0x7')][_0x429d('0x10')][this['agent']['id']][_0x429d('0x15')]=!![];this[_0x429d('0x7')][_0x429d('0x10')][this['agent']['id']][_0x429d('0x16')]=undefined;util[_0x429d('0x17')](this[_0x429d('0x7')],this[_0x429d('0x3')],this[_0x429d('0x6')],this[_0x429d('0x5')]['channel']);util[_0x429d('0x18')](this[_0x429d('0x4')],this['squeue']['id'],this[_0x429d('0x7')][_0x429d('0x10')][this[_0x429d('0x6')]['id']],null,this[_0x429d('0x3')]);util['writeLog'](this[_0x429d('0x5')]['id'],this[_0x429d('0x7')][_0x429d('0x10')][this[_0x429d('0x6')]['id']],_0x429d('0x19')+(this['routing'][_0x429d('0x12')]?_0x429d('0x1a'):''));}else{logger[_0x429d('0x11')](_0x429d('0x1b'),this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);setTimeout(this[_0x429d('0x8')][_0x429d('0x9')](this),0x3e8);}}};Agent[_0x429d('0xc')]['handleTimeout']=function(_0x31cae6){if(_[_0x429d('0xf')](this['realtime'][_0x429d('0x10')][this[_0x429d('0x6')]['id']])){return logger[_0x429d('0x11')](_0x429d('0x1c'),this[_0x429d('0x5')]['id'],this['agent']['id']);}else{logger[_0x429d('0x11')](_0x429d('0x1d'),this[_0x429d('0x5')]['id'],this[_0x429d('0x6')]['id']);util[_0x429d('0x1e')](this[_0x429d('0x4')],this['squeue']['id'],this['realtime'][_0x429d('0x10')][this[_0x429d('0x6')]['id']],null,this['routing']);this['realtime'][_0x429d('0x10')][this['agent']['id']][_0x429d('0x15')]=![];this[_0x429d('0x7')][_0x429d('0x10')][this[_0x429d('0x6')]['id']]['busyQueue']=undefined;util[_0x429d('0x1f')](this[_0x429d('0x7')],this['routing'],this['agent'],this['squeue']['channel']);util['writeLog'](this[_0x429d('0x5')]['id'],this['realtime']['agents'][this[_0x429d('0x6')]['id']],_0x31cae6?_0x429d('0x20'):_0x429d('0x21'));}if(!_0x31cae6){setTimeout(this[_0x429d('0x8')][_0x429d('0x9')](this),0x3e8);}};function agent(_0x1a5d80,_0x4b23ab,_0x423dc8,_0x2c5fa5){return new Agent(_0x1a5d80,_0x4b23ab,_0x423dc8,_0x2c5fa5);}module[_0x429d('0x22')]=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 bdd24a7..e315e96 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 _0x4981=['Agents','agents','channel','RINGING','busy','busyQueue','saveWaitingNotification','showNotification','debug','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','writeLog','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','realtime','push','handleRun','bind','timeout','drained','handleDrained','prototype','handleTimeout','isNil','queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4981,0x1b5));var _0x1498=function(_0x5e998d,_0x5d1ebf){_0x5e998d=_0x5e998d-0x0;var _0x247a27=_0x4981[_0x5e998d];return _0x247a27;};'use strict';var _=require(_0x1498('0x0'));var uuid=require(_0x1498('0x1'));var util=require(_0x1498('0x2'));var logger=require(_0x1498('0x3'))(_0x1498('0x4'));var Beepall=function(_0x1cfc30,_0x26675e,_0x1c88ca,_0x3a828d){this[_0x1498('0x5')]=uuid['v4']();this[_0x1498('0x6')]=_0x1cfc30;this['queue']=_0x26675e;this[_0x1498('0x7')]=_0x1c88ca;this[_0x1498('0x4')]=_0x3a828d;this[_0x1498('0x6')][_0x1498('0x8')](this[_0x1498('0x9')]['bind'](this),this['handleTimeout'][_0x1498('0xa')](this));this['squeue']['on'](_0x1498('0xb'),this['handleTimeout'][_0x1498('0xa')](this));this[_0x1498('0x6')]['on'](_0x1498('0xc'),this[_0x1498('0xd')][_0x1498('0xa')](this));};Beepall[_0x1498('0xe')][_0x1498('0x8')]=function(){this['squeue'][_0x1498('0x8')](this[_0x1498('0x9')]['bind'](this),this['handleTimeout']['bind'](this));};Beepall[_0x1498('0xe')][_0x1498('0xd')]=function(){this[_0x1498('0xf')](!![]);};Beepall[_0x1498('0xe')][_0x1498('0x9')]=function(){var _0x1fd492=!![];if(!_[_0x1498('0x10')](this[_0x1498('0x11')])&&!_[_0x1498('0x10')](this[_0x1498('0x11')][_0x1498('0x12')])&&this[_0x1498('0x11')][_0x1498('0x12')]['length']>0x0){for(var _0x109715=0x0,_0x55cd94;_0x1097150x0){for(var _0x196597=0x0,_0x281370;_0x1965970x0&&_0x5d003b[_0x3ecc6f+_0x7d28('0x24')]>=_0x5d003b[_0x3ecc6f+_0x7d28('0x23')]){writeLog(_0x8c1e30,_0x5d003b,_0x3ecc6f[_0x7d28('0x25')]()+_0x7d28('0x26'));return![];}}return!![];};exports[_0x7d28('0x27')]=function(_0x52adf1,_0x46a56a,_0xa31e7e,_0x5e3995,_0x1d804e){return sendNotification(!![],_0x52adf1,_0x46a56a,_0xa31e7e,_0x5e3995,_0x1d804e);};exports[_0x7d28('0x28')]=function(_0x19ee3c,_0x23344b,_0x19fef2,_0x2bf48a,_0x2fa078){return sendNotification(![],_0x19ee3c,_0x23344b,_0x19fef2,_0x2bf48a,_0x2fa078);};exports[_0x7d28('0x29')]=function(_0x4b3f4b,_0x5c689e,_0x516e50){var _0x49a38f=_0x5c689e[_0x7d28('0x2a')]['UserId'];if(!_0x49a38f&&_0x516e50){_0x49a38f=_0x516e50['id'];}var _0x571176=_[_0x7d28('0x2b')](_0x4b3f4b[_0x5c689e['channel']+_0x7d28('0x2c')],function(_0xb84181){var _0x227bfb=_[_0x7d28('0x2d')](_0x5c689e[_0x7d28('0x2e')])+_0x7d28('0x2f');return _0xb84181[_0x227bfb]===_0x5c689e[_0x7d28('0x2a')]['id'];});if(!_0x571176&&_0x49a38f&&_0x4b3f4b['agents'][_0x49a38f]){_0x571176=_[_0x7d28('0x2b')](_0x4b3f4b[_0x7d28('0x30')][_0x49a38f][_0x5c689e['channel']+_0x7d28('0x31')],function(_0x5a124c){return _0x5a124c['id']===_0x5c689e['interaction']['id'];});}return _0x571176;};exports[_0x7d28('0x32')]=function(_0x5dbfee,_0x38249c,_0x1d46f5,_0x1a79bc){if(_0x1d46f5&&_0x1d46f5['id']&&_0x5dbfee[_0x7d28('0x30')]&&_0x5dbfee[_0x7d28('0x30')][_0x1d46f5['id']]){_0x5dbfee[_0x7d28('0x30')][_0x1d46f5['id']][_0x1a79bc+_0x7d28('0x31')][_0x38249c[_0x7d28('0x16')]['id']]={'id':_0x38249c[_0x7d28('0x2a')]['id']};}};exports[_0x7d28('0x33')]=function(_0x2a223a,_0x90a110,_0x5a3e61,_0x3bf7b6){if(_0x5a3e61&&_0x5a3e61['id']&&_0x2a223a[_0x7d28('0x30')]&&_0x2a223a['agents'][_0x5a3e61['id']]){delete _0x2a223a[_0x7d28('0x30')][_0x5a3e61['id']][_0x3bf7b6+'WaitingInteractions'][_0x90a110[_0x7d28('0x16')]['id']];}};exports[_0x7d28('0x34')]=writeLog; \ No newline at end of file +var _0xede6=['../../../../../config/logger','routing','redis','defaults','localhost','socket.io-emitter','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','message','format','user:%s','notification:%s','remove','isAgentAvailable','busy','BUSY','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','\x20MAXCAPACITY','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','channel','agents','WaitingInteractions','util','../utils','ioredis','../../../../../config/environment'];(function(_0x1c630c,_0x3f45fb){var _0x3159e8=function(_0x425a9c){while(--_0x425a9c){_0x1c630c['push'](_0x1c630c['shift']());}};_0x3159e8(++_0x3f45fb);}(_0xede6,0x10a));var _0x6ede=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xede6[_0x2f3848];return _0x102668;};'use strict';var _=require('lodash');var util=require(_0x6ede('0x0'));var utils=require(_0x6ede('0x1'));var Redis=require(_0x6ede('0x2'));var config=require(_0x6ede('0x3'));var logger=require(_0x6ede('0x4'))(_0x6ede('0x5'));config[_0x6ede('0x6')]=_[_0x6ede('0x7')](config[_0x6ede('0x6')],{'host':_0x6ede('0x8'),'port':0x18eb});var io=require(_0x6ede('0x9'))(new Redis(config[_0x6ede('0x6')]));function sendNotification(_0x5c93d4,_0x2e94a,_0xf8cdee,_0x23e2dc,_0x3ab1cf,_0x4a701f){var _0x27bb82=_0x4a701f||{};var _0x52aa5e=_0xf8cdee[_0x6ede('0xa')]('.');var _0x2b135a={'uniqueid':_0x2e94a,'channel':_0x52aa5e[0x0],'id':_0x52aa5e[0x1],'title':_0x52aa5e[0x0]+_0x6ede('0xb'),'interactionId':_0x52aa5e[0x2],'queue':_0x3ab1cf?_0x3ab1cf[_0x6ede('0xc')]:null,'sound':_0x27bb82[_0x6ede('0xd')][_0x6ede('0xe')],'shake':_0x27bb82[_0x6ede('0xd')][_0x6ede('0xf')]};try{if(!_0x27bb82['body']){_0x27bb82[_0x6ede('0x10')]={};}if(_0x3ab1cf){_0x27bb82[_0x6ede('0x10')][_0x6ede('0x11')]=_0x3ab1cf;}else if(_0x27bb82[_0x6ede('0x10')][_0x6ede('0x11')]){delete _0x27bb82[_0x6ede('0x10')][_0x6ede('0x11')];}_0x2b135a['msg']=utils['getMustacheRender'](_0x27bb82['account']['notificationTemplate'],_0x27bb82);}catch(_0x45243a){_0x2b135a[_0x6ede('0x12')]=_0x6ede('0x13');logger[_0x6ede('0x14')](util['format'](_0x6ede('0x15'),_0x2e94a,_0x45243a[_0x6ede('0x16')]));}io['to'](util[_0x6ede('0x17')](_0x6ede('0x18'),_0x23e2dc[_0x6ede('0xc')]))['emit'](util[_0x6ede('0x17')](_0x6ede('0x19'),_0x5c93d4?'save':_0x6ede('0x1a')),_0x2b135a);}function writeLog(_0x2f134f,_0x25c165,_0x163a81){return logger['debug'](util[_0x6ede('0x17')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x2f134f,_0x25c165[_0x6ede('0xc')],_0x163a81));}exports[_0x6ede('0x1b')]=function(_0x5330c8,_0x21505a,_0x5ca840,_0x4462f9){if(_0x21505a[_0x6ede('0x1c')]){writeLog(_0x5330c8,_0x21505a,_0x6ede('0x1d'));return![];}if(!_0x21505a['online']){writeLog(_0x5330c8,_0x21505a,_0x6ede('0x1e'));return![];}if(_0x21505a[_0x5ca840+_0x6ede('0x1f')]){writeLog(_0x5330c8,_0x21505a,_0x6ede('0x20'));return![];}if(_0x4462f9&&_0x21505a[_0x6ede('0x21')](_0x5ca840+_0x6ede('0x22'))&&_0x21505a['hasOwnProperty'](_0x5ca840+_0x6ede('0x23'))){if(_0x21505a[_0x5ca840+_0x6ede('0x22')]>0x0&&_0x21505a[_0x5ca840+_0x6ede('0x23')]>=_0x21505a[_0x5ca840+_0x6ede('0x22')]){writeLog(_0x5330c8,_0x21505a,_0x5ca840['toUpperCase']()+_0x6ede('0x24'));return![];}}return!![];};exports[_0x6ede('0x25')]=function(_0x135174,_0x5e033b,_0xff51d5,_0x2f996d,_0x362e50){return sendNotification(!![],_0x135174,_0x5e033b,_0xff51d5,_0x2f996d,_0x362e50);};exports[_0x6ede('0x26')]=function(_0x44d469,_0x354c21,_0x821bdf,_0x1ecd17,_0x44797e){return sendNotification(![],_0x44d469,_0x354c21,_0x821bdf,_0x1ecd17,_0x44797e);};exports[_0x6ede('0x27')]=function(_0x5a3c31,_0x33fe9b,_0x313640){var _0x50f3c9=_0x33fe9b[_0x6ede('0x28')][_0x6ede('0x29')];if(!_0x50f3c9&&_0x313640){_0x50f3c9=_0x313640['id'];}var _0x4bf329=_['some'](_0x5a3c31[_0x33fe9b[_0x6ede('0x2a')]+'QueuesWaitingInteractions'],function(_0x251c42){var _0xdb984=_['capitalize'](_0x33fe9b['channel'])+'InteractionId';return _0x251c42[_0xdb984]===_0x33fe9b[_0x6ede('0x28')]['id'];});if(!_0x4bf329&&_0x50f3c9&&_0x5a3c31['agents'][_0x50f3c9]){_0x4bf329=_['some'](_0x5a3c31[_0x6ede('0x2b')][_0x50f3c9][_0x33fe9b['channel']+_0x6ede('0x2c')],function(_0x4ee6db){return _0x4ee6db['id']===_0x33fe9b[_0x6ede('0x28')]['id'];});}return _0x4bf329;};exports['saveWaitingNotification']=function(_0x4932cd,_0x469b2a,_0x1b0c1c,_0x27d7b4){if(_0x1b0c1c&&_0x1b0c1c['id']&&_0x4932cd['agents']&&_0x4932cd[_0x6ede('0x2b')][_0x1b0c1c['id']]){_0x4932cd[_0x6ede('0x2b')][_0x1b0c1c['id']][_0x27d7b4+'WaitingInteractions'][_0x469b2a['message']['id']]={'id':_0x469b2a[_0x6ede('0x28')]['id']};}};exports['removeWaitingNotification']=function(_0x52a726,_0x5356ee,_0x354920,_0x380986){if(_0x354920&&_0x354920['id']&&_0x52a726[_0x6ede('0x2b')]&&_0x52a726['agents'][_0x354920['id']]){delete _0x52a726[_0x6ede('0x2b')][_0x354920['id']][_0x380986+_0x6ede('0x2c')][_0x5356ee[_0x6ede('0x16')]['id']];}};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 e3af063..9822186 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 _0x58ef=['getMustacheRender','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','error','isObject','stringify','validate','lodash','./utils','../../../../config/logger','routing','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','[%s][SYSTEM]\x20%s','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next'];(function(_0x1840e1,_0x4ffbd9){var _0x3148e4=function(_0x57e6ca){while(--_0x57e6ca){_0x1840e1['push'](_0x1840e1['shift']());}};_0x3148e4(++_0x4ffbd9);}(_0x58ef,0x1ce));var _0xf58e=function(_0x5f3a21,_0x2ddaa1){_0x5f3a21=_0x5f3a21-0x0;var _0x522bff=_0x58ef[_0x5f3a21];return _0x522bff;};'use strict';var schema=require(_0xf58e('0x0'));var sh=require('shelljs');var _=require(_0xf58e('0x1'));var utils=require(_0xf58e('0x2'));var logger=require(_0xf58e('0x3'))(_0xf58e('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':_0xf58e('0x5')}});exports[_0xf58e('0x6')]=function(_0x2cc936,_0x139853){return function(_0x3c3e9c){try{var _0x1ede65={'command':_0x139853[0x0]};var _0x42c3ee=system[_0xf58e('0x0')](_0x1ede65,{'typecast':!![]});if(_0x42c3ee[_0xf58e('0x7')]){logger['error'](_0xf58e('0x8'),_0x2cc936,_['map'](_0x42c3ee,_0xf58e('0x9'))[_0xf58e('0xa')](',\x20'));logger[_0xf58e('0xb')](_0xf58e('0xc'),_0x2cc936);_0x3c3e9c['next']();}else{var _0xf76106=this;var _0x4ddfac=utils[_0xf58e('0xd')](_0x139853[0x0],this);logger[_0xf58e('0xb')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x2cc936,_0x4ddfac);sh[_0xf58e('0xe')](_[_0xf58e('0xf')](_0x4ddfac),function(_0x2878ec,_0x2aba34){logger[_0xf58e('0xb')](_0xf58e('0x10'),_0x2cc936,_0x2878ec);if(_0x2878ec==0x0){var _0x238c23=_0x2aba34[_0xf58e('0x11')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x139853[0x1])||_[_0xf58e('0x12')](_0x139853[0x1])){logger[_0xf58e('0xb')]('[%s][SYSTEM]\x20no\x20variable',_0x2cc936);_0xf76106[_0xf58e('0x13')][_0x139853[0x1]]=_0x238c23;}else{logger[_0xf58e('0xb')](_0xf58e('0x14'),_0x2cc936,_0x139853[0x1],_0x238c23);_0xf76106[_0xf58e('0x13')][_0x139853[0x1]]=_0x238c23;}}_0x3c3e9c[_0xf58e('0x15')]();});}}catch(_0x28aa7f){logger[_0xf58e('0x16')](_0xf58e('0x8'),_0x2cc936,_[_0xf58e('0x17')](_0x28aa7f)?JSON[_0xf58e('0x18')](_0x28aa7f):_0x28aa7f);logger['info'](_0xf58e('0xc'),_0x2cc936);_0x3c3e9c[_0xf58e('0x15')]();}};}; \ No newline at end of file +var _0x8512=['error','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x8512,0x70));var _0x2851=function(_0x3d00be,_0x44a706){_0x3d00be=_0x3d00be-0x0;var _0x32fef9=_0x8512[_0x3d00be];return _0x32fef9;};'use strict';var schema=require(_0x2851('0x0'));var sh=require(_0x2851('0x1'));var _=require(_0x2851('0x2'));var utils=require(_0x2851('0x3'));var logger=require(_0x2851('0x4'))('routing');var system=schema({'command':{'type':_0x2851('0x5'),'required':!![],'message':_0x2851('0x6')}});exports[_0x2851('0x7')]=function(_0x5c6dff,_0x5b9dd2){return function(_0x4805a7){try{var _0x151165={'command':_0x5b9dd2[0x0]};var _0x206c79=system[_0x2851('0x0')](_0x151165,{'typecast':!![]});if(_0x206c79['length']){logger[_0x2851('0x8')]('[%s][SYSTEM]\x20%s',_0x5c6dff,_[_0x2851('0x9')](_0x206c79,_0x2851('0xa'))[_0x2851('0xb')](',\x20'));logger[_0x2851('0xc')](_0x2851('0xd'),_0x5c6dff);_0x4805a7['next']();}else{var _0x2b2830=this;var _0x1ffb30=utils[_0x2851('0xe')](_0x5b9dd2[0x0],this);logger[_0x2851('0xc')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x5c6dff,_0x1ffb30);sh['exec'](_['trim'](_0x1ffb30),function(_0xac535a,_0x57c2f2){logger[_0x2851('0xc')](_0x2851('0xf'),_0x5c6dff,_0xac535a);if(_0xac535a==0x0){var _0x67e7c0=_0x57c2f2['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x2851('0x10')](_0x5b9dd2[0x1])||_[_0x2851('0x11')](_0x5b9dd2[0x1])){logger[_0x2851('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x5c6dff);_0x2b2830[_0x2851('0x12')][_0x5b9dd2[0x1]]=_0x67e7c0;}else{logger[_0x2851('0xc')](_0x2851('0x13'),_0x5c6dff,_0x5b9dd2[0x1],_0x67e7c0);_0x2b2830[_0x2851('0x12')][_0x5b9dd2[0x1]]=_0x67e7c0;}}_0x4805a7[_0x2851('0x14')]();});}}catch(_0x10d8c6){logger[_0x2851('0x8')](_0x2851('0x15'),_0x5c6dff,_[_0x2851('0x16')](_0x10d8c6)?JSON[_0x2851('0x17')](_0x10d8c6):_0x10d8c6);logger[_0x2851('0xc')](_0x2851('0xd'),_0x5c6dff);_0x4805a7[_0x2851('0x14')]();}};}; \ 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 3e5d69e..762c73f 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 _0xed58=['catch','stringify','finally','next','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s'];(function(_0x345163,_0xba4c3d){var _0x11d1f8=function(_0x44b719){while(--_0x44b719){_0x345163['push'](_0x345163['shift']());}};_0x11d1f8(++_0xba4c3d);}(_0xed58,0xe5));var _0x8ed5=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xed58[_0x4cf98e];return _0x1623ac;};'use strict';var schema=require(_0x8ed5('0x0'));var _=require(_0x8ed5('0x1'));var rpc={'chatInteraction':require(_0x8ed5('0x2')),'openchannelInteraction':require(_0x8ed5('0x3')),'smsInteraction':require(_0x8ed5('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x8ed5('0x5')),'whatsappInteraction':require(_0x8ed5('0x6'))};var logger=require(_0x8ed5('0x7'))(_0x8ed5('0x8'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x8ed5('0x9')}});exports[_0x8ed5('0xa')]=function(_0x11b203,_0x519f94,_0x43fc88,_0x5694c0){return function(_0x5ca31e){try{var _0x394489={'tag':_0x519f94[0x0]};var _0x24905f=tag[_0x8ed5('0x0')](_0x394489,{'typecast':!![]});if(_0x24905f['length']){logger[_0x8ed5('0xb')](_0x8ed5('0xc'),_0x11b203,_[_0x8ed5('0xd')](_0x24905f,'message')[_0x8ed5('0xe')](',\x20'));logger[_0x8ed5('0xf')](_0x8ed5('0x10'),_0x11b203);_0x5ca31e['next']();}else{var _0xd77460={'ids':[_0x519f94[0x0]]};if(rpc[_0x5694c0[_0x8ed5('0x11')]+_0x8ed5('0x12')]){rpc[_0x5694c0[_0x8ed5('0x11')]+_0x8ed5('0x12')][_0x8ed5('0x13')](_0x5694c0[_0x8ed5('0x14')]['id'],_0xd77460)[_0x8ed5('0x15')](function(_0x4221dc){logger[_0x8ed5('0xf')](_0x8ed5('0x16'),_0x11b203,_0x519f94[0x1],_0x5694c0[_0x8ed5('0x11')],_0x5694c0[_0x8ed5('0x14')]['id']);})[_0x8ed5('0x17')](function(_0x213341){logger[_0x8ed5('0xb')]('[%s][TAG]\x20%s',_0x11b203,JSON[_0x8ed5('0x18')](_0x213341));logger[_0x8ed5('0xf')](_0x8ed5('0x10'),_0x11b203);})[_0x8ed5('0x19')](function(){_0x5ca31e[_0x8ed5('0x1a')]();});}}}catch(_0x274dda){logger[_0x8ed5('0xb')](_0x8ed5('0xc'),_0x11b203,_[_0x8ed5('0x1b')](_0x274dda)?JSON[_0x8ed5('0x18')](_0x274dda):_0x274dda);logger[_0x8ed5('0xf')](_0x8ed5('0x10'),_0x11b203);_0x5ca31e[_0x8ed5('0x1a')]();}};}; \ No newline at end of file +var _0x5e99=['finally','next','stringify','validate','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','addTags','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x5e99,0xab));var _0x95e9=function(_0x5aa8a1,_0x3d5f37){_0x5aa8a1=_0x5aa8a1-0x0;var _0x40f142=_0x5e99[_0x5aa8a1];return _0x40f142;};'use strict';var schema=require(_0x95e9('0x0'));var _=require('lodash');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x95e9('0x1')),'faxInteraction':require(_0x95e9('0x2')),'whatsappInteraction':require(_0x95e9('0x3'))};var logger=require('../../../../config/logger')(_0x95e9('0x4'));var tag=schema({'tag':{'type':_0x95e9('0x5'),'required':!![],'message':_0x95e9('0x6')}});exports[_0x95e9('0x7')]=function(_0x444f2b,_0x4bfc22,_0x1fcf39,_0x478b1c){return function(_0x2d84c3){try{var _0x778941={'tag':_0x4bfc22[0x0]};var _0x350982=tag[_0x95e9('0x0')](_0x778941,{'typecast':!![]});if(_0x350982['length']){logger[_0x95e9('0x8')](_0x95e9('0x9'),_0x444f2b,_[_0x95e9('0xa')](_0x350982,_0x95e9('0xb'))[_0x95e9('0xc')](',\x20'));logger[_0x95e9('0xd')](_0x95e9('0xe'),_0x444f2b);_0x2d84c3['next']();}else{var _0x3c4a92={'ids':[_0x4bfc22[0x0]]};if(rpc[_0x478b1c[_0x95e9('0xf')]+_0x95e9('0x10')]){rpc[_0x478b1c[_0x95e9('0xf')]+_0x95e9('0x10')][_0x95e9('0x11')](_0x478b1c['interaction']['id'],_0x3c4a92)['then'](function(_0x385da6){logger[_0x95e9('0xd')](_0x95e9('0x12'),_0x444f2b,_0x4bfc22[0x1],_0x478b1c[_0x95e9('0xf')],_0x478b1c[_0x95e9('0x13')]['id']);})[_0x95e9('0x14')](function(_0x1d4331){logger[_0x95e9('0x8')]('[%s][TAG]\x20%s',_0x444f2b,JSON['stringify'](_0x1d4331));logger[_0x95e9('0xd')](_0x95e9('0xe'),_0x444f2b);})[_0x95e9('0x15')](function(){_0x2d84c3[_0x95e9('0x16')]();});}}}catch(_0x5d964c){logger[_0x95e9('0x8')](_0x95e9('0x9'),_0x444f2b,_['isObject'](_0x5d964c)?JSON[_0x95e9('0x17')](_0x5d964c):_0x5d964c);logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x444f2b);_0x2d84c3[_0x95e9('0x16')]();}};}; \ 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 d723639..402b269 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 _0xfea8=['then','logged','Unable\x20to\x20login\x20with\x20TVox\x20application','&sessionId=','&data=','stringify','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','error','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','request-promise','../../../../config/logger','routing','lodash','consequence','replace','includes','push','urlOnAnswer','?params=','urlOnRing','title','2.0','method','login','params','utf8','POST','application/json-rpc'];(function(_0x4ccce2,_0xf1f16f){var _0x57bd36=function(_0x1dd74d){while(--_0x1dd74d){_0x4ccce2['push'](_0x4ccce2['shift']());}};_0x57bd36(++_0xf1f16f);}(_0xfea8,0xfd));var _0x8fea=function(_0x3de7e0,_0x28cbff){_0x3de7e0=_0x3de7e0-0x0;var _0x11d0b3=_0xfea8[_0x3de7e0];return _0x11d0b3;};'use strict';var rp=require(_0x8fea('0x0'));var logger=require(_0x8fea('0x1'))(_0x8fea('0x2'));var _=require(_0x8fea('0x3'));var arr=[];exports[_0x8fea('0x4')]=function(_0x58f6c9,_0x535a6e){return function(_0x558dce){var _0x7f8b6a=_0x535a6e[0xa];var _0x419596=_0x535a6e[0xb];var _0x2eaa03=_0x535a6e[0xc];var _0x314e0c=_0x535a6e[0xd];var _0x54d9c5=_0x535a6e[0xe];var _0x4b4a34=_0x535a6e[0xf][_0x8fea('0x5')](/\n/g,'\x20-\x20');var _0x1440f8=_0x535a6e[0x10]['replace'](/\n/g,'\x20');if(!arr[_0x8fea('0x6')](_0x419596)){arr[_0x8fea('0x7')](_0x419596);var _0x40d142=_0x535a6e[0x3];var _0x348e3b=_0x535a6e[0x4];var _0x22a1dd=_0x535a6e[0x1];var _0x3dd081=_0x535a6e[0x0];var _0x307034={};_0x307034[_0x8fea('0x8')]=_0x535a6e[0x8]+_0x8fea('0x9')+_0x2eaa03+'|'+_0x7f8b6a+'|'+_0x314e0c+'|'+_0x419596+'|'+_0x54d9c5;_0x307034[_0x8fea('0xa')]=_0x535a6e[0x7]+_0x8fea('0x9')+_0x2eaa03+'|'+_0x7f8b6a+'|'+_0x314e0c+'|'+_0x419596+'|'+_0x54d9c5+'|'+_0x4b4a34+'|'+_0x1440f8;_0x307034[_0x8fea('0xb')]=_0x535a6e[0x9];var _0x51f262={};_0x51f262['jsonrpc']=_0x8fea('0xc');_0x51f262[_0x8fea('0xd')]=_0x8fea('0xe');var _0x12be15=[];_0x12be15[_0x8fea('0x7')](_0x535a6e[0x2]);_0x12be15[_0x8fea('0x7')](_0x535a6e[0x5]);_0x12be15['push'](_0x535a6e[0x6]);_0x51f262[_0x8fea('0xf')]=_0x12be15;_0x51f262['id']=0x1;var _0x41e5fd=JSON['stringify'](_0x51f262);var _0x2ae0bb={'encoding':_0x8fea('0x10'),'method':_0x8fea('0x11'),'timeout':0x2710,'url':_0x40d142,'headers':{'Content-Type':_0x8fea('0x12')},'body':_0x41e5fd};return rp(_0x2ae0bb)[_0x8fea('0x13')](function(_0x34e544){const _0x1b3bf2=JSON['parse'](_0x34e544);if(!_0x1b3bf2['result'][_0x8fea('0x14')]){throw new Error(_0x8fea('0x15'));}var _0x31941d=_0x419596;var _0x477020='channelId='+_0x22a1dd+'&serviceId='+_0x3dd081+_0x8fea('0x16')+_0x31941d+_0x8fea('0x17')+JSON[_0x8fea('0x18')](_0x307034);var _0x17d028=_0x348e3b+'?'+_0x477020;return rp(_0x17d028);})['then'](function(_0x59c12d){logger[_0x8fea('0x19')](_0x8fea('0x1a'),_0x58f6c9,_0x59c12d);_0x558dce['stop']();})[_0x8fea('0x1b')](function(_0x59da91){logger[_0x8fea('0x1c')](_0x8fea('0x1d'),_0x58f6c9,_[_0x8fea('0x1e')](_0x59da91)?JSON[_0x8fea('0x18')](_0x59da91):_0x59da91);_0x558dce[_0x8fea('0x1f')]();});}else{logger['info'](_0x8fea('0x20'),_0x58f6c9);_0x558dce[_0x8fea('0x21')]();}};}; \ No newline at end of file +var _0xc71b=['Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&serviceId=','&sessionId=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','catch','[%s][TVOX]\x20%s','isObject','stop','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','routing','lodash','consequence','replace','\x20-\x20','includes','urlOnAnswer','?params=','urlOnRing','title','jsonrpc','method','login','push','params','stringify','utf8','POST','then','logged'];(function(_0x72e04a,_0x398f0b){var _0x4e8acf=function(_0x56ea91){while(--_0x56ea91){_0x72e04a['push'](_0x72e04a['shift']());}};_0x4e8acf(++_0x398f0b);}(_0xc71b,0x6c));var _0xbc71=function(_0x3b0a7f,_0x5c5062){_0x3b0a7f=_0x3b0a7f-0x0;var _0x21c86b=_0xc71b[_0x3b0a7f];return _0x21c86b;};'use strict';var rp=require('request-promise');var logger=require('../../../../config/logger')(_0xbc71('0x0'));var _=require(_0xbc71('0x1'));var arr=[];exports[_0xbc71('0x2')]=function(_0x4a0a9c,_0xfd47d1){return function(_0x453158){var _0xb06598=_0xfd47d1[0xa];var _0x165de3=_0xfd47d1[0xb];var _0xaf1d46=_0xfd47d1[0xc];var _0x4660fd=_0xfd47d1[0xd];var _0x58ac5e=_0xfd47d1[0xe];var _0x4461d1=_0xfd47d1[0xf][_0xbc71('0x3')](/\n/g,_0xbc71('0x4'));var _0x484c16=_0xfd47d1[0x10][_0xbc71('0x3')](/\n/g,'\x20');if(!arr[_0xbc71('0x5')](_0x165de3)){arr['push'](_0x165de3);var _0x3cadf4=_0xfd47d1[0x3];var _0x2e9d3b=_0xfd47d1[0x4];var _0x373721=_0xfd47d1[0x1];var _0x50b9aa=_0xfd47d1[0x0];var _0x32b3a={};_0x32b3a[_0xbc71('0x6')]=_0xfd47d1[0x8]+_0xbc71('0x7')+_0xaf1d46+'|'+_0xb06598+'|'+_0x4660fd+'|'+_0x165de3+'|'+_0x58ac5e;_0x32b3a[_0xbc71('0x8')]=_0xfd47d1[0x7]+_0xbc71('0x7')+_0xaf1d46+'|'+_0xb06598+'|'+_0x4660fd+'|'+_0x165de3+'|'+_0x58ac5e+'|'+_0x4461d1+'|'+_0x484c16;_0x32b3a[_0xbc71('0x9')]=_0xfd47d1[0x9];var _0x1ef1d3={};_0x1ef1d3[_0xbc71('0xa')]='2.0';_0x1ef1d3[_0xbc71('0xb')]=_0xbc71('0xc');var _0x1bf576=[];_0x1bf576[_0xbc71('0xd')](_0xfd47d1[0x2]);_0x1bf576[_0xbc71('0xd')](_0xfd47d1[0x5]);_0x1bf576['push'](_0xfd47d1[0x6]);_0x1ef1d3[_0xbc71('0xe')]=_0x1bf576;_0x1ef1d3['id']=0x1;var _0x2d79b0=JSON[_0xbc71('0xf')](_0x1ef1d3);var _0x23c1ef={'encoding':_0xbc71('0x10'),'method':_0xbc71('0x11'),'timeout':0x2710,'url':_0x3cadf4,'headers':{'Content-Type':'application/json-rpc'},'body':_0x2d79b0};return rp(_0x23c1ef)[_0xbc71('0x12')](function(_0x19ea6d){const _0x42d46c=JSON['parse'](_0x19ea6d);if(!_0x42d46c['result'][_0xbc71('0x13')]){throw new Error(_0xbc71('0x14'));}var _0x183856=_0x165de3;var _0x230cbb=_0xbc71('0x15')+_0x373721+_0xbc71('0x16')+_0x50b9aa+_0xbc71('0x17')+_0x183856+'&data='+JSON['stringify'](_0x32b3a);var _0x2cad39=_0x2e9d3b+'?'+_0x230cbb;return rp(_0x2cad39);})['then'](function(_0x48c5ce){logger[_0xbc71('0x18')](_0xbc71('0x19'),_0x4a0a9c,_0x48c5ce);_0x453158['stop']();})[_0xbc71('0x1a')](function(_0x5083ae){logger['error'](_0xbc71('0x1b'),_0x4a0a9c,_[_0xbc71('0x1c')](_0x5083ae)?JSON[_0xbc71('0xf')](_0x5083ae):_0x5083ae);_0x453158[_0xbc71('0x1d')]();});}else{logger['info'](_0xbc71('0x1e'),_0x4a0a9c);_0x453158[_0xbc71('0x1f')]();}};}; \ 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 7c0d448..83d082b 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 _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x15c521,_0x999f22){var _0x34d42a=function(_0x1d2493){while(--_0x1d2493){_0x15c521['push'](_0x15c521['shift']());}};_0x34d42a(++_0x999f22);}(_0xe706,0xa3));var _0x6e70=function(_0x4b85a3,_0x55a93f){_0x4b85a3=_0x4b85a3-0x0;var _0xcf8bc7=_0xe706[_0x4b85a3];return _0xcf8bc7;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0x9c44=['merge','body','account','list','exports','render'];(function(_0x3d43fe,_0x2ae238){var _0x2278e5=function(_0x3a1aaa){while(--_0x3a1aaa){_0x3d43fe['push'](_0x3d43fe['shift']());}};_0x2278e5(++_0x2ae238);}(_0x9c44,0x178));var _0x49c4=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x9c44[_0x21549c];return _0x426cbd;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x49c4('0x0')]={'getMustacheRender':function(_0x18bf2d,_0x26844b){return Mustache[_0x49c4('0x1')](_0x18bf2d,_[_0x49c4('0x2')](_0x26844b[_0x49c4('0x3')],{'contact':_0x26844b['contact'],'message':_0x26844b['message'],'account':_0x26844b[_0x49c4('0x4')],'interaction':_0x26844b['interaction'],'list':_0x26844b[_0x49c4('0x5')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 56ad67e..cec7f9d 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 _0x7939=['IntervalId','Intervals','interval','listen','rules','channel','message','interaction','checkWaitingNotifications','isArray','length','applications','existsSync','app','toLowerCase','autoreply','split','mail','push','slice','join','dialogflow','appdata','dialogflowv2','tag','TagId','account','ChatWebsiteId','body','%s:%s:%s','./interval','condition','./applications/','priority','info','intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','matchPath','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','error','stack','routing\x20is\x20empty','agent','agents','busy','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','busyQueue','end','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','values','find','chatQueues','available','loggedIn','paused','mailQueues','name','openchannelQueues','waiting','smsQueues','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','isNil'];(function(_0x3cd8b6,_0x11cd40){var _0x121234=function(_0x401eeb){while(--_0x401eeb){_0x3cd8b6['push'](_0x3cd8b6['shift']());}};_0x121234(++_0x11cd40);}(_0x7939,0x11c));var _0x9793=function(_0x5f4c49,_0x1aacaa){_0x5f4c49=_0x5f4c49-0x0;var _0x12b19e=_0x7939[_0x5f4c49];return _0x12b19e;};'use strict';var _=require('lodash');var util=require(_0x9793('0x0'));var path=require(_0x9793('0x1'));var fs=require('fs');var jayson=require(_0x9793('0x2'));var BPromise=require(_0x9793('0x3'));var utils=require('./applications/utils');var sUtils=require('./applications/strategy/util');var logger=require('../../../config/logger')(_0x9793('0x4'));var rpc={'openchannelQueueReport':require(_0x9793('0x5')),'mailQueueReport':require(_0x9793('0x6')),'chatQueueReport':require(_0x9793('0x7')),'smsQueueReport':require(_0x9793('0x8')),'faxQueueReport':require(_0x9793('0x9')),'whatsappQueueReport':require(_0x9793('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x1a2859,_0x8ab0eb,_0x45bbff){return util[_0x9793('0xb')]('%s.%s.%s',_0x1a2859,_0x8ab0eb||0x0,_0x45bbff||0x0);}function getIntervals(_0x3901f3,_0x59f48e){var _0x30cc8c=[];if(!_[_0x9793('0xc')](_0x59f48e['IntervalId'])&&!_[_0x9793('0xc')](_0x3901f3[_0x59f48e[_0x9793('0xd')]])&&!_[_0x9793('0xc')](_0x3901f3[_0x59f48e[_0x9793('0xd')]][_0x9793('0xe')])){_0x30cc8c=_['map'](_0x3901f3[_0x59f48e['IntervalId']][_0x9793('0xe')],_0x9793('0xf'));}else if(!_[_0x9793('0xc')](_0x59f48e[_0x9793('0xf')])){_0x30cc8c=[_0x59f48e[_0x9793('0xf')]];}return _0x30cc8c;}exports[_0x9793('0x10')]=function(_0x1b7b8a){_0x1b7b8a[_0x9793('0x11')]={};return new BPromise(function(_0x377012,_0x210588){var _0x2467ae={'Start':function(_0x265da2){var _0x4f0d68=this;return new Promise(function(_0x277e9b,_0x2953f9){if(_0x265da2){try{var _0x54cacc=[];var _0x5cf237=getId(_0x265da2[_0x9793('0x12')],_0x265da2['message']?_0x265da2[_0x9793('0x13')]['id']:0x0,_0x265da2['interaction']?_0x265da2[_0x9793('0x14')]['id']:0x0);var _0x41617c=sUtils[_0x9793('0x15')](_0x1b7b8a,_0x265da2);if(_0x265da2['transfer']||!_0x41617c&&_0x265da2['applications']&&_[_0x9793('0x16')](_0x265da2['applications'])&&_0x265da2['applications'][_0x9793('0x17')]){for(var _0x4d1769=0x0;_0x4d1769<_0x265da2[_0x9793('0x18')][_0x9793('0x17')];_0x4d1769+=0x1){var _0xe3cd5d=_0x265da2[_0x9793('0x18')][_0x4d1769];if(fs[_0x9793('0x19')](path['join'](__dirname,_0x9793('0x18'),_0xe3cd5d[_0x9793('0x1a')]+'.js'))){var _0x167bf0=[];switch(_0xe3cd5d['app'][_0x9793('0x1b')]()){case _0x9793('0x1c'):var _0x566c92=_0xe3cd5d['appdata'][_0x9793('0x1d')](',');if(_0x265da2[_0x9793('0x12')]===_0x9793('0x1e')){_0x167bf0['push'](_0x566c92[0x0]);_0x167bf0[_0x9793('0x1f')](_0x566c92[0x1]);_0x167bf0[_0x9793('0x1f')](_0x566c92[_0x9793('0x20')](0x2,_0x566c92[_0x9793('0x17')])[_0x9793('0x21')](','));}else{_0x167bf0[_0x9793('0x1f')](_0x566c92[0x0]);_0x167bf0[_0x9793('0x1f')](_0x566c92[_0x9793('0x20')](0x1,_0x566c92[_0x9793('0x17')])[_0x9793('0x21')](','));}break;case _0x9793('0x22'):var _0xf8e48d=_0xe3cd5d[_0x9793('0x23')]['split'](',');_0x167bf0[_0x9793('0x1f')](_0xf8e48d[0x0]);_0x167bf0[_0x9793('0x1f')](_0xf8e48d[0x1]);_0x167bf0[_0x9793('0x1f')](_0xf8e48d[_0x9793('0x20')](0x2,_0xf8e48d['length'])[_0x9793('0x21')](','));break;case _0x9793('0x24'):var _0x563d54=_0xe3cd5d[_0x9793('0x23')][_0x9793('0x1d')](',');_0x167bf0[_0x9793('0x1f')](_0x563d54[0x0]);_0x167bf0['push'](_0x563d54[0x1]);_0x167bf0[_0x9793('0x1f')](_0x563d54[0x2]);_0x167bf0[_0x9793('0x1f')](_0x563d54[0x3]);_0x167bf0[_0x9793('0x1f')](_0x563d54['slice'](0x4,_0x563d54[_0x9793('0x17')])[_0x9793('0x21')](','));break;case'amazonlex':var _0x6d0706=_0xe3cd5d[_0x9793('0x23')]['split'](',');_0x167bf0[_0x9793('0x1f')](_0x6d0706[0x0]);_0x167bf0[_0x9793('0x1f')](_0x6d0706[0x1]);_0x167bf0[_0x9793('0x1f')](_0x6d0706[0x2]);_0x167bf0[_0x9793('0x1f')](_0x6d0706[0x3]);_0x167bf0[_0x9793('0x1f')](_0x6d0706[_0x9793('0x20')](0x4,_0x6d0706[_0x9793('0x17')])[_0x9793('0x21')](','));break;case _0x9793('0x13'):_0x167bf0[_0x9793('0x1f')](_0xe3cd5d[_0x9793('0x23')]);break;case _0x9793('0x25'):_0x167bf0['push'](_0xe3cd5d[_0x9793('0x26')]);_0x167bf0[_0x9793('0x1f')](_0xe3cd5d[_0x9793('0x23')]);break;case'tvox':var _0x4d7548=utils['getMustacheRender'](_0x265da2[_0x9793('0x27')]['notificationTemplate'],_0x265da2);var _0x36eab2=_0xe3cd5d[_0x9793('0x23')][_0x9793('0x1d')](',');_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x0]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x1]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x2]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x3]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x4]);_0x167bf0['push'](_0x36eab2[0x5]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x6]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x7]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x8]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0x9]);_0x167bf0[_0x9793('0x1f')](_0x36eab2[0xa]);_0x167bf0['push'](_0x265da2['interaction']['id']);_0x167bf0[_0x9793('0x1f')](_0x265da2[_0x9793('0x13')]['id']);_0x167bf0[_0x9793('0x1f')](_0xe3cd5d[_0x9793('0x28')]);_0x167bf0[_0x9793('0x1f')](_0x265da2[_0x9793('0x14')]['ContactId']);_0x167bf0[_0x9793('0x1f')](_0x265da2[_0x9793('0x29')][_0x9793('0x29')]);_0x167bf0['push'](_0x4d7548);break;default:_0x167bf0=_[_0x9793('0xc')](_0xe3cd5d['appdata'])?[]:_0xe3cd5d[_0x9793('0x23')][_0x9793('0x1d')](',');}var _0x4b56e0={'id':util['format'](_0x9793('0x2a'),_0x5cf237,_0xe3cd5d['id'],_0xe3cd5d[_0x9793('0x1a')]),'condition':require(_0x9793('0x2b'))[_0x9793('0x2c')](_0x5cf237,getIntervals(_0x1b7b8a['intervals'],_0xe3cd5d),_0x1b7b8a),'consequence':require(_0x9793('0x2d')+_0xe3cd5d['app'])['consequence'](_0x5cf237,_0x167bf0,_0x1b7b8a,_0x265da2),'p':_0xe3cd5d[_0x9793('0x2e')]||0x0};logger[_0x9793('0x2f')]('Push\x20new\x20rule',_0x4b56e0['id'],'on\x20interval',getIntervals(_0x1b7b8a[_0x9793('0x30')],_0xe3cd5d)[_0x9793('0x21')](_0x9793('0x31')));_0x54cacc[_0x9793('0x1f')](_0x4b56e0);}else{logger['error'](_0x9793('0x32'),path['join'](__dirname,_0x9793('0x18'),_0xe3cd5d[_0x9793('0x1a')]+_0x9793('0x33')));}}_0x1b7b8a[_0x9793('0x11')][_0x5cf237]=new RuleEngine(_0x54cacc);_0x1b7b8a[_0x9793('0x11')][_0x5cf237][_0x9793('0x34')](_0x265da2,function(_0x2e494b){logger[_0x9793('0x2f')](_0x9793('0x35'),JSON[_0x9793('0x36')](_0x2e494b[_0x9793('0x37')]));if(_0x1b7b8a['rules'][_0x5cf237]){_0x1b7b8a[_0x9793('0x11')][_0x5cf237][_0x9793('0x38')](_0x9793('0x39'));}});return _0x277e9b({'code':0xc8,'message':_0x265da2});}else{if(_0x41617c){logger['info'](util[_0x9793('0xb')](_0x9793('0x3a'),_0x5cf237));}else{logger[_0x9793('0x2f')](_0x9793('0x3b'));}return _0x277e9b({'code':0xc8,'message':_0x265da2});}}catch(_0x4a5ef5){logger[_0x9793('0x3c')](_0x4a5ef5[_0x9793('0x3d')]);return _0x2953f9(_0x4f0d68['error'](0x1f4,_0x4a5ef5));}}return _0x2953f9(_0x9793('0x3e'));});},'AcceptMessage':function(_0x56fd4f){var _0xe4171c=this;return new Promise(function(_0x511f35,_0x6c8092){if(_0x56fd4f[_0x9793('0x3f')]&&_0x56fd4f[_0x9793('0x3f')]['id']){if(_0x1b7b8a[_0x9793('0x40')][_0x56fd4f[_0x9793('0x3f')]['id']]){_0x1b7b8a[_0x9793('0x40')][_0x56fd4f[_0x9793('0x3f')]['id']][_0x9793('0x41')]=![];_0x1b7b8a[_0x9793('0x40')][_0x56fd4f['agent']['id']]['busyQueue']=undefined;}}if(_0x56fd4f['message']&&_0x56fd4f['message']['id']){try{var _0x2bb0c9=getId(_0x56fd4f[_0x9793('0x12')],_0x56fd4f['message']?_0x56fd4f[_0x9793('0x13')]['id']:0x0,_0x56fd4f[_0x9793('0x14')]?_0x56fd4f[_0x9793('0x14')]['id']:0x0);if(_0x1b7b8a[_0x9793('0x11')][_0x2bb0c9]){_0x1b7b8a[_0x9793('0x11')][_0x2bb0c9]['emit']('end');if(rpc[_0x56fd4f[_0x9793('0x12')]+'QueueReport']){rpc[_0x56fd4f['channel']+_0x9793('0x42')][_0x9793('0x43')](_0x2bb0c9,{'UserId':_0x56fd4f['message'][_0x9793('0x44')]})[_0x9793('0x45')](function(){logger[_0x9793('0x3c')](_0x9793('0x46'));});}}return _0x511f35({'code':0xc8,'message':_0x56fd4f});}catch(_0x5703e9){logger[_0x9793('0x3c')](_0x5703e9[_0x9793('0x3d')]);return _0x6c8092(_0xe4171c[_0x9793('0x3c')](0x1f4,_0x5703e9));}}logger[_0x9793('0x3c')](_0x9793('0x47'));return _0x6c8092(_0xe4171c['error'](0x1f4,_0x9793('0x47')));});},'RejectMessage':function(_0x470992){var _0x260dae=this;return new Promise(function(_0xed9987,_0x4afaf0){if(_0x470992['agent']&&_0x470992[_0x9793('0x3f')]['id']){try{if(_0x1b7b8a[_0x9793('0x40')][_0x470992[_0x9793('0x3f')]['id']]){_0x1b7b8a['agents'][_0x470992['agent']['id']][_0x9793('0x41')]=![];_0x1b7b8a[_0x9793('0x40')][_0x470992[_0x9793('0x3f')]['id']][_0x9793('0x48')]=undefined;}return _0xed9987({'code':0xc8,'message':_0x470992});}catch(_0x562193){logger[_0x9793('0x3c')](_0x562193[_0x9793('0x3d')]);return _0x4afaf0(_0x260dae[_0x9793('0x3c')](0x1f4,_0x562193));}}logger[_0x9793('0x3c')]('message\x20is\x20empty');return _0x4afaf0(_0x260dae['error'](0x1f4,_0x9793('0x47')));});},'AbandonInteraction':function(_0x16e599){var _0x1a7974=this;return new Promise(function(_0x40c043,_0x4a8f6e){if(_0x16e599['channel']&&_0x16e599[_0x9793('0x14')]&&_0x16e599[_0x9793('0x14')]['id']){try{var _0x1ffe3d=getId(_0x16e599[_0x9793('0x12')],_0x16e599[_0x9793('0x13')]?_0x16e599[_0x9793('0x13')]['id']:0x0,_0x16e599[_0x9793('0x14')]?_0x16e599['interaction']['id']:0x0);if(_0x1b7b8a[_0x9793('0x11')][_0x1ffe3d]){_0x1b7b8a[_0x9793('0x11')][_0x1ffe3d]['emit'](_0x9793('0x49'));}return _0x40c043({'code':0xc8,'message':_0x16e599});}catch(_0x1b021e){logger[_0x9793('0x3c')](_0x1b021e[_0x9793('0x3d')]);return _0x4a8f6e(_0x1a7974[_0x9793('0x3c')](0x1f4,_0x1b021e));}}logger[_0x9793('0x3c')]('message\x20is\x20empty');return _0x4a8f6e(_0x1a7974[_0x9793('0x3c')](0x1f4,_0x9793('0x47')));});},'AgentCapacity':function(_0x7f0a6b){var _0x4041e6=this;return new Promise(function(_0x1ad4fd,_0x1834e6){if(_0x1b7b8a['agents'][_0x9793('0x4a')](_0x7f0a6b['id'])){for(var _0x25c455 in _0x7f0a6b['capacity']){if(_0x7f0a6b['capacity'][_0x9793('0x4a')](_0x25c455)){if(_0x1b7b8a['agents'][_0x7f0a6b['id']][_0x9793('0x4a')](_0x25c455+_0x9793('0x4b'))){_0x1b7b8a[_0x9793('0x40')][_0x7f0a6b['id']][_0x25c455+_0x9793('0x4b')]=parseInt(_0x7f0a6b[_0x9793('0x4c')][_0x25c455],0xa);}}}_0x1b7b8a[_0x9793('0x40')][_0x7f0a6b['id']][_0x9793('0x4d')]();return _0x1ad4fd({'code':0xc8,'message':_0x1b7b8a[_0x9793('0x40')][_0x7f0a6b['id']]});}else{return _0x1834e6(_0x4041e6[_0x9793('0x3c')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x58d308){return new Promise(function(_0x33322b){var _0x5a8824=_[_0x9793('0x4e')](_0x1b7b8a[_0x9793('0x40')]);if(_0x58d308&&_0x58d308['id']){var _0x8fb95c=_[_0x9793('0x4f')](_0x5a8824,function(_0x175ba3){return _0x175ba3['id']===_0x58d308['id'];});_0x33322b(_0x8fb95c);}else{_0x33322b({'count':_0x5a8824['length'],'rows':_0x5a8824});}});},'ChatQueues':function(){return new Promise(function(_0x23dccc){var _0x14208c=[];for(var _0x3d9e5b in _0x1b7b8a[_0x9793('0x50')]){if(_0x1b7b8a[_0x9793('0x50')][_0x9793('0x4a')](_0x3d9e5b)){var _0x278a19=_0x1b7b8a[_0x9793('0x50')][_0x3d9e5b];var _0x36e61d={'id':_0x278a19['id'],'available':_0x278a19[_0x9793('0x51')],'loggedIn':_0x278a19[_0x9793('0x52')],'name':_0x278a19['name'],'paused':_0x278a19[_0x9793('0x53')],'waiting':_0x278a19['waiting']};_0x14208c[_0x9793('0x1f')](_0x36e61d);}}_0x23dccc({'count':_0x14208c[_0x9793('0x17')],'rows':_0x14208c});});},'MailQueues':function(){return new Promise(function(_0x48c066){var _0x9f8611=[];for(var _0x46083e in _0x1b7b8a[_0x9793('0x54')]){if(_0x1b7b8a['mailQueues'][_0x9793('0x4a')](_0x46083e)){var _0x260060=_0x1b7b8a[_0x9793('0x54')][_0x46083e];var _0xfca06e={'id':_0x260060['id'],'available':_0x260060[_0x9793('0x51')],'loggedIn':_0x260060['loggedIn'],'name':_0x260060[_0x9793('0x55')],'paused':_0x260060[_0x9793('0x53')],'waiting':_0x260060['waiting']};_0x9f8611['push'](_0xfca06e);}}_0x48c066({'count':_0x9f8611[_0x9793('0x17')],'rows':_0x9f8611});});},'OpenchannelQueues':function(){return new Promise(function(_0x1a21c8){var _0x4f540b=[];for(var _0x5be589 in _0x1b7b8a[_0x9793('0x56')]){if(_0x1b7b8a[_0x9793('0x56')]['hasOwnProperty'](_0x5be589)){var _0xaf0712=_0x1b7b8a[_0x9793('0x56')][_0x5be589];var _0x33a834={'id':_0xaf0712['id'],'available':_0xaf0712[_0x9793('0x51')],'loggedIn':_0xaf0712[_0x9793('0x52')],'name':_0xaf0712['name'],'paused':_0xaf0712[_0x9793('0x53')],'waiting':_0xaf0712[_0x9793('0x57')]};_0x4f540b[_0x9793('0x1f')](_0x33a834);}}_0x1a21c8({'count':_0x4f540b[_0x9793('0x17')],'rows':_0x4f540b});});},'SmsQueues':function(){return new Promise(function(_0x54e938){var _0x20e6a2=[];for(var _0x57dfd2 in _0x1b7b8a[_0x9793('0x58')]){if(_0x1b7b8a[_0x9793('0x58')][_0x9793('0x4a')](_0x57dfd2)){var _0x380427=_0x1b7b8a[_0x9793('0x58')][_0x57dfd2];var _0x486709={'id':_0x380427['id'],'available':_0x380427[_0x9793('0x51')],'loggedIn':_0x380427[_0x9793('0x52')],'name':_0x380427[_0x9793('0x55')],'paused':_0x380427[_0x9793('0x53')],'waiting':_0x380427[_0x9793('0x57')]};_0x20e6a2['push'](_0x486709);}}_0x54e938({'count':_0x20e6a2[_0x9793('0x17')],'rows':_0x20e6a2});});},'FaxQueues':function(){return new Promise(function(_0x5495e4){var _0x43d502=[];for(var _0x322c03 in _0x1b7b8a[_0x9793('0x59')]){if(_0x1b7b8a[_0x9793('0x59')][_0x9793('0x4a')](_0x322c03)){var _0x5c7e0a=_0x1b7b8a[_0x9793('0x59')][_0x322c03];var _0x2343be={'id':_0x5c7e0a['id'],'available':_0x5c7e0a[_0x9793('0x51')],'loggedIn':_0x5c7e0a[_0x9793('0x52')],'name':_0x5c7e0a[_0x9793('0x55')],'paused':_0x5c7e0a[_0x9793('0x53')],'waiting':_0x5c7e0a[_0x9793('0x57')]};_0x43d502[_0x9793('0x1f')](_0x2343be);}}_0x5495e4({'count':_0x43d502[_0x9793('0x17')],'rows':_0x43d502});});},'WhatsappQueues':function(){return new Promise(function(_0x38b554){var _0x4f7d65=[];for(var _0x5d29d4 in _0x1b7b8a['whatsappQueues']){if(_0x1b7b8a[_0x9793('0x5a')][_0x9793('0x4a')](_0x5d29d4)){var _0x994eb0=_0x1b7b8a['whatsappQueues'][_0x5d29d4];var _0x43768f={'id':_0x994eb0['id'],'available':_0x994eb0['available'],'loggedIn':_0x994eb0[_0x9793('0x52')],'name':_0x994eb0[_0x9793('0x55')],'paused':_0x994eb0[_0x9793('0x53')],'waiting':_0x994eb0[_0x9793('0x57')]};_0x4f7d65['push'](_0x43768f);}}_0x38b554({'count':_0x4f7d65['length'],'rows':_0x4f7d65});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x189d5b){var _0x3e1244=_['values'](_0x1b7b8a['chatQueuesWaitingInteractions']);_0x189d5b({'count':_0x3e1244[_0x9793('0x17')],'rows':_0x3e1244});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x1229c6){var _0x423eaa=_[_0x9793('0x4e')](_0x1b7b8a[_0x9793('0x5b')]);_0x1229c6({'count':_0x423eaa[_0x9793('0x17')],'rows':_0x423eaa});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x3547db){var _0x4842a9=_[_0x9793('0x4e')](_0x1b7b8a[_0x9793('0x5c')]);_0x3547db({'count':_0x4842a9['length'],'rows':_0x4842a9});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0xf4fdda){var _0x174afd=_[_0x9793('0x4e')](_0x1b7b8a[_0x9793('0x5d')]);_0xf4fdda({'count':_0x174afd[_0x9793('0x17')],'rows':_0x174afd});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0xb20d96){var _0xadcabb=_[_0x9793('0x4e')](_0x1b7b8a[_0x9793('0x5e')]);_0xb20d96({'count':_0xadcabb['length'],'rows':_0xadcabb});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x567815){var _0x323a13=_[_0x9793('0x4e')](_0x1b7b8a['whatsappQueuesWaitingInteractions']);_0x567815({'count':_0x323a13[_0x9793('0x17')],'rows':_0x323a13});});}};var _0x198243=jayson[_0x9793('0x5f')](_0x2467ae)['http']();_0x198243['on'](_0x9793('0x3c'),function(_0x1f57aa){logger[_0x9793('0x3c')](JSON['stringify'](_0x1f57aa));return _0x210588(_0x1f57aa);});_0x198243['listen'](0x232c,_0x9793('0x60'),function(){console['log'](_0x9793('0x61'),0x232c);return _0x377012(_0x9793('0x62')+0x232c);});});}; \ No newline at end of file +var _0x341c=['lodash','path','bluebird','./applications/utils','./applications/strategy/util','../../../config/logger','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','interaction','checkWaitingNotifications','transfer','applications','isArray','length','existsSync','join','app','.js','toLowerCase','autoreply','split','mail','push','slice','dialogflow','appdata','dialogflowv2','amazonlex','message','tag','TagId','account','notificationTemplate','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','info','Push\x20new\x20rule','\x20|\x20','error','Applications\x20executed','matchPath','emit','complete','stack','agents','agent','busy','busyQueue','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','capacity','hasOwnProperty','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','find','chatQueues','available','paused','mailQueues','name','waiting','openchannelQueues','smsQueues','loggedIn','faxQueues','whatsappQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','stringify','127.0.0.1','log','RPC\x20listening\x20on\x20port:'];(function(_0x17ac5b,_0x1a2d16){var _0x2dcec9=function(_0x4bbe8d){while(--_0x4bbe8d){_0x17ac5b['push'](_0x17ac5b['shift']());}};_0x2dcec9(++_0x1a2d16);}(_0x341c,0xcc));var _0xc341=function(_0x44cca6,_0x5e9271){_0x44cca6=_0x44cca6-0x0;var _0x175d04=_0x341c[_0x44cca6];return _0x175d04;};'use strict';var _=require(_0xc341('0x0'));var util=require('util');var path=require(_0xc341('0x1'));var fs=require('fs');var jayson=require('jayson/promise');var BPromise=require(_0xc341('0x2'));var utils=require(_0xc341('0x3'));var sUtils=require(_0xc341('0x4'));var logger=require(_0xc341('0x5'))(_0xc341('0x6'));var rpc={'openchannelQueueReport':require(_0xc341('0x7')),'mailQueueReport':require(_0xc341('0x8')),'chatQueueReport':require(_0xc341('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xc341('0xa')),'whatsappQueueReport':require(_0xc341('0xb'))};var RuleEngine=require(_0xc341('0xc'));function getId(_0x31ce96,_0x3e83c9,_0x53aab7){return util[_0xc341('0xd')](_0xc341('0xe'),_0x31ce96,_0x3e83c9||0x0,_0x53aab7||0x0);}function getIntervals(_0x3f08b0,_0x8d2f4c){var _0x3d5d26=[];if(!_[_0xc341('0xf')](_0x8d2f4c['IntervalId'])&&!_[_0xc341('0xf')](_0x3f08b0[_0x8d2f4c[_0xc341('0x10')]])&&!_[_0xc341('0xf')](_0x3f08b0[_0x8d2f4c[_0xc341('0x10')]][_0xc341('0x11')])){_0x3d5d26=_[_0xc341('0x12')](_0x3f08b0[_0x8d2f4c['IntervalId']]['Intervals'],_0xc341('0x13'));}else if(!_[_0xc341('0xf')](_0x8d2f4c[_0xc341('0x13')])){_0x3d5d26=[_0x8d2f4c[_0xc341('0x13')]];}return _0x3d5d26;}exports[_0xc341('0x14')]=function(_0x483e30){_0x483e30[_0xc341('0x15')]={};return new BPromise(function(_0x12a4eb,_0x1f5220){var _0x158c47={'Start':function(_0x989024){var _0x2bd235=this;return new Promise(function(_0x203a06,_0x26bbce){if(_0x989024){try{var _0x33da6b=[];var _0xdbf615=getId(_0x989024[_0xc341('0x16')],_0x989024['message']?_0x989024['message']['id']:0x0,_0x989024[_0xc341('0x17')]?_0x989024[_0xc341('0x17')]['id']:0x0);var _0x2d9f4e=sUtils[_0xc341('0x18')](_0x483e30,_0x989024);if(_0x989024[_0xc341('0x19')]||!_0x2d9f4e&&_0x989024[_0xc341('0x1a')]&&_[_0xc341('0x1b')](_0x989024[_0xc341('0x1a')])&&_0x989024[_0xc341('0x1a')][_0xc341('0x1c')]){for(var _0x2f94ea=0x0;_0x2f94ea<_0x989024[_0xc341('0x1a')]['length'];_0x2f94ea+=0x1){var _0x556281=_0x989024[_0xc341('0x1a')][_0x2f94ea];if(fs[_0xc341('0x1d')](path[_0xc341('0x1e')](__dirname,_0xc341('0x1a'),_0x556281[_0xc341('0x1f')]+_0xc341('0x20')))){var _0x488d43=[];switch(_0x556281[_0xc341('0x1f')][_0xc341('0x21')]()){case _0xc341('0x22'):var _0x5a4912=_0x556281['appdata'][_0xc341('0x23')](',');if(_0x989024['channel']===_0xc341('0x24')){_0x488d43[_0xc341('0x25')](_0x5a4912[0x0]);_0x488d43[_0xc341('0x25')](_0x5a4912[0x1]);_0x488d43[_0xc341('0x25')](_0x5a4912[_0xc341('0x26')](0x2,_0x5a4912['length'])[_0xc341('0x1e')](','));}else{_0x488d43[_0xc341('0x25')](_0x5a4912[0x0]);_0x488d43[_0xc341('0x25')](_0x5a4912[_0xc341('0x26')](0x1,_0x5a4912[_0xc341('0x1c')])[_0xc341('0x1e')](','));}break;case _0xc341('0x27'):var _0x51af9d=_0x556281[_0xc341('0x28')][_0xc341('0x23')](',');_0x488d43[_0xc341('0x25')](_0x51af9d[0x0]);_0x488d43[_0xc341('0x25')](_0x51af9d[0x1]);_0x488d43[_0xc341('0x25')](_0x51af9d[_0xc341('0x26')](0x2,_0x51af9d[_0xc341('0x1c')])[_0xc341('0x1e')](','));break;case _0xc341('0x29'):var _0x4b838f=_0x556281[_0xc341('0x28')][_0xc341('0x23')](',');_0x488d43[_0xc341('0x25')](_0x4b838f[0x0]);_0x488d43[_0xc341('0x25')](_0x4b838f[0x1]);_0x488d43[_0xc341('0x25')](_0x4b838f[0x2]);_0x488d43[_0xc341('0x25')](_0x4b838f[0x3]);_0x488d43[_0xc341('0x25')](_0x4b838f[_0xc341('0x26')](0x4,_0x4b838f[_0xc341('0x1c')])[_0xc341('0x1e')](','));break;case _0xc341('0x2a'):var _0x551e10=_0x556281['appdata'][_0xc341('0x23')](',');_0x488d43['push'](_0x551e10[0x0]);_0x488d43[_0xc341('0x25')](_0x551e10[0x1]);_0x488d43[_0xc341('0x25')](_0x551e10[0x2]);_0x488d43[_0xc341('0x25')](_0x551e10[0x3]);_0x488d43[_0xc341('0x25')](_0x551e10[_0xc341('0x26')](0x4,_0x551e10[_0xc341('0x1c')])[_0xc341('0x1e')](','));break;case _0xc341('0x2b'):_0x488d43[_0xc341('0x25')](_0x556281['appdata']);break;case _0xc341('0x2c'):_0x488d43[_0xc341('0x25')](_0x556281[_0xc341('0x2d')]);_0x488d43[_0xc341('0x25')](_0x556281[_0xc341('0x28')]);break;case'tvox':var _0x517071=utils['getMustacheRender'](_0x989024[_0xc341('0x2e')][_0xc341('0x2f')],_0x989024);var _0x149690=_0x556281[_0xc341('0x28')]['split'](',');_0x488d43['push'](_0x149690[0x0]);_0x488d43[_0xc341('0x25')](_0x149690[0x1]);_0x488d43[_0xc341('0x25')](_0x149690[0x2]);_0x488d43[_0xc341('0x25')](_0x149690[0x3]);_0x488d43[_0xc341('0x25')](_0x149690[0x4]);_0x488d43['push'](_0x149690[0x5]);_0x488d43[_0xc341('0x25')](_0x149690[0x6]);_0x488d43[_0xc341('0x25')](_0x149690[0x7]);_0x488d43['push'](_0x149690[0x8]);_0x488d43[_0xc341('0x25')](_0x149690[0x9]);_0x488d43['push'](_0x149690[0xa]);_0x488d43[_0xc341('0x25')](_0x989024[_0xc341('0x17')]['id']);_0x488d43[_0xc341('0x25')](_0x989024[_0xc341('0x2b')]['id']);_0x488d43[_0xc341('0x25')](_0x556281[_0xc341('0x30')]);_0x488d43[_0xc341('0x25')](_0x989024[_0xc341('0x17')][_0xc341('0x31')]);_0x488d43[_0xc341('0x25')](_0x989024[_0xc341('0x32')][_0xc341('0x32')]);_0x488d43['push'](_0x517071);break;default:_0x488d43=_[_0xc341('0xf')](_0x556281[_0xc341('0x28')])?[]:_0x556281[_0xc341('0x28')][_0xc341('0x23')](',');}var _0x777512={'id':util[_0xc341('0xd')](_0xc341('0x33'),_0xdbf615,_0x556281['id'],_0x556281[_0xc341('0x1f')]),'condition':require(_0xc341('0x34'))[_0xc341('0x35')](_0xdbf615,getIntervals(_0x483e30[_0xc341('0x36')],_0x556281),_0x483e30),'consequence':require(_0xc341('0x37')+_0x556281[_0xc341('0x1f')])['consequence'](_0xdbf615,_0x488d43,_0x483e30,_0x989024),'p':_0x556281['priority']||0x0};logger[_0xc341('0x38')](_0xc341('0x39'),_0x777512['id'],'on\x20interval',getIntervals(_0x483e30[_0xc341('0x36')],_0x556281)[_0xc341('0x1e')](_0xc341('0x3a')));_0x33da6b['push'](_0x777512);}else{logger[_0xc341('0x3b')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0xc341('0x1e')](__dirname,_0xc341('0x1a'),_0x556281[_0xc341('0x1f')]+_0xc341('0x20')));}}_0x483e30[_0xc341('0x15')][_0xdbf615]=new RuleEngine(_0x33da6b);_0x483e30[_0xc341('0x15')][_0xdbf615]['execute'](_0x989024,function(_0x7e702c){logger[_0xc341('0x38')](_0xc341('0x3c'),JSON['stringify'](_0x7e702c[_0xc341('0x3d')]));if(_0x483e30['rules'][_0xdbf615]){_0x483e30[_0xc341('0x15')][_0xdbf615][_0xc341('0x3e')](_0xc341('0x3f'));}});return _0x203a06({'code':0xc8,'message':_0x989024});}else{if(_0x2d9f4e){logger[_0xc341('0x38')](util[_0xc341('0xd')]('Skipped\x20routing\x20for\x20%s',_0xdbf615));}else{logger[_0xc341('0x38')]('No\x20applications\x20to\x20execute');}return _0x203a06({'code':0xc8,'message':_0x989024});}}catch(_0x4bae47){logger[_0xc341('0x3b')](_0x4bae47[_0xc341('0x40')]);return _0x26bbce(_0x2bd235['error'](0x1f4,_0x4bae47));}}return _0x26bbce('routing\x20is\x20empty');});},'AcceptMessage':function(_0x550bcd){var _0x4828f1=this;return new Promise(function(_0xd5824c,_0x896c48){if(_0x550bcd['agent']&&_0x550bcd['agent']['id']){if(_0x483e30[_0xc341('0x41')][_0x550bcd['agent']['id']]){_0x483e30[_0xc341('0x41')][_0x550bcd[_0xc341('0x42')]['id']][_0xc341('0x43')]=![];_0x483e30[_0xc341('0x41')][_0x550bcd[_0xc341('0x42')]['id']][_0xc341('0x44')]=undefined;}}if(_0x550bcd[_0xc341('0x2b')]&&_0x550bcd[_0xc341('0x2b')]['id']){try{var _0x129da7=getId(_0x550bcd[_0xc341('0x16')],_0x550bcd[_0xc341('0x2b')]?_0x550bcd[_0xc341('0x2b')]['id']:0x0,_0x550bcd[_0xc341('0x17')]?_0x550bcd[_0xc341('0x17')]['id']:0x0);if(_0x483e30[_0xc341('0x15')][_0x129da7]){_0x483e30[_0xc341('0x15')][_0x129da7][_0xc341('0x3e')](_0xc341('0x45'));if(rpc[_0x550bcd[_0xc341('0x16')]+_0xc341('0x46')]){rpc[_0x550bcd[_0xc341('0x16')]+'QueueReport'][_0xc341('0x47')](_0x129da7,{'UserId':_0x550bcd[_0xc341('0x2b')][_0xc341('0x48')]})[_0xc341('0x49')](function(){logger[_0xc341('0x3b')](_0xc341('0x4a'));});}}return _0xd5824c({'code':0xc8,'message':_0x550bcd});}catch(_0x1a3ab6){logger[_0xc341('0x3b')](_0x1a3ab6[_0xc341('0x40')]);return _0x896c48(_0x4828f1[_0xc341('0x3b')](0x1f4,_0x1a3ab6));}}logger['error'](_0xc341('0x4b'));return _0x896c48(_0x4828f1[_0xc341('0x3b')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x50a86f){var _0x1fc3a4=this;return new Promise(function(_0x2346ce,_0x3febe3){if(_0x50a86f[_0xc341('0x42')]&&_0x50a86f[_0xc341('0x42')]['id']){try{if(_0x483e30[_0xc341('0x41')][_0x50a86f[_0xc341('0x42')]['id']]){_0x483e30[_0xc341('0x41')][_0x50a86f[_0xc341('0x42')]['id']][_0xc341('0x43')]=![];_0x483e30[_0xc341('0x41')][_0x50a86f[_0xc341('0x42')]['id']][_0xc341('0x44')]=undefined;}return _0x2346ce({'code':0xc8,'message':_0x50a86f});}catch(_0x341699){logger['error'](_0x341699[_0xc341('0x40')]);return _0x3febe3(_0x1fc3a4['error'](0x1f4,_0x341699));}}logger[_0xc341('0x3b')]('message\x20is\x20empty');return _0x3febe3(_0x1fc3a4['error'](0x1f4,'message\x20is\x20empty'));});},'AbandonInteraction':function(_0x3241f4){var _0x55faf4=this;return new Promise(function(_0x3d8be0,_0x375e7e){if(_0x3241f4[_0xc341('0x16')]&&_0x3241f4['interaction']&&_0x3241f4[_0xc341('0x17')]['id']){try{var _0x56eaef=getId(_0x3241f4[_0xc341('0x16')],_0x3241f4[_0xc341('0x2b')]?_0x3241f4['message']['id']:0x0,_0x3241f4[_0xc341('0x17')]?_0x3241f4['interaction']['id']:0x0);if(_0x483e30[_0xc341('0x15')][_0x56eaef]){_0x483e30[_0xc341('0x15')][_0x56eaef][_0xc341('0x3e')](_0xc341('0x45'));}return _0x3d8be0({'code':0xc8,'message':_0x3241f4});}catch(_0x31db84){logger['error'](_0x31db84[_0xc341('0x40')]);return _0x375e7e(_0x55faf4['error'](0x1f4,_0x31db84));}}logger[_0xc341('0x3b')]('message\x20is\x20empty');return _0x375e7e(_0x55faf4[_0xc341('0x3b')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x30e8c8){var _0x23caef=this;return new Promise(function(_0x4cbec2,_0x5b5113){if(_0x483e30[_0xc341('0x41')]['hasOwnProperty'](_0x30e8c8['id'])){for(var _0x28bc56 in _0x30e8c8[_0xc341('0x4c')]){if(_0x30e8c8['capacity'][_0xc341('0x4d')](_0x28bc56)){if(_0x483e30[_0xc341('0x41')][_0x30e8c8['id']][_0xc341('0x4d')](_0x28bc56+_0xc341('0x4e'))){_0x483e30[_0xc341('0x41')][_0x30e8c8['id']][_0x28bc56+_0xc341('0x4e')]=parseInt(_0x30e8c8[_0xc341('0x4c')][_0x28bc56],0xa);}}}_0x483e30[_0xc341('0x41')][_0x30e8c8['id']][_0xc341('0x4f')]();return _0x4cbec2({'code':0xc8,'message':_0x483e30[_0xc341('0x41')][_0x30e8c8['id']]});}else{return _0x5b5113(_0x23caef['error'](0x1f4,_0xc341('0x50')));}});},'Agents':function(_0xb9d0ec){return new Promise(function(_0x44e98b){var _0xf7b289=_[_0xc341('0x51')](_0x483e30['agents']);if(_0xb9d0ec&&_0xb9d0ec['id']){var _0xfd84bb=_[_0xc341('0x52')](_0xf7b289,function(_0x1e226d){return _0x1e226d['id']===_0xb9d0ec['id'];});_0x44e98b(_0xfd84bb);}else{_0x44e98b({'count':_0xf7b289[_0xc341('0x1c')],'rows':_0xf7b289});}});},'ChatQueues':function(){return new Promise(function(_0x159c5e){var _0x5827bd=[];for(var _0xc583c in _0x483e30[_0xc341('0x53')]){if(_0x483e30[_0xc341('0x53')][_0xc341('0x4d')](_0xc583c)){var _0x5a6572=_0x483e30[_0xc341('0x53')][_0xc583c];var _0x13acfa={'id':_0x5a6572['id'],'available':_0x5a6572[_0xc341('0x54')],'loggedIn':_0x5a6572['loggedIn'],'name':_0x5a6572['name'],'paused':_0x5a6572[_0xc341('0x55')],'waiting':_0x5a6572['waiting']};_0x5827bd[_0xc341('0x25')](_0x13acfa);}}_0x159c5e({'count':_0x5827bd[_0xc341('0x1c')],'rows':_0x5827bd});});},'MailQueues':function(){return new Promise(function(_0x5f34cb){var _0x16ab5f=[];for(var _0x597259 in _0x483e30[_0xc341('0x56')]){if(_0x483e30[_0xc341('0x56')][_0xc341('0x4d')](_0x597259)){var _0x557e7b=_0x483e30['mailQueues'][_0x597259];var _0x380bef={'id':_0x557e7b['id'],'available':_0x557e7b[_0xc341('0x54')],'loggedIn':_0x557e7b['loggedIn'],'name':_0x557e7b[_0xc341('0x57')],'paused':_0x557e7b['paused'],'waiting':_0x557e7b[_0xc341('0x58')]};_0x16ab5f['push'](_0x380bef);}}_0x5f34cb({'count':_0x16ab5f[_0xc341('0x1c')],'rows':_0x16ab5f});});},'OpenchannelQueues':function(){return new Promise(function(_0x5eba00){var _0x40c961=[];for(var _0x1f7735 in _0x483e30[_0xc341('0x59')]){if(_0x483e30[_0xc341('0x59')][_0xc341('0x4d')](_0x1f7735)){var _0x5ed4cd=_0x483e30['openchannelQueues'][_0x1f7735];var _0x4aa738={'id':_0x5ed4cd['id'],'available':_0x5ed4cd[_0xc341('0x54')],'loggedIn':_0x5ed4cd['loggedIn'],'name':_0x5ed4cd[_0xc341('0x57')],'paused':_0x5ed4cd['paused'],'waiting':_0x5ed4cd[_0xc341('0x58')]};_0x40c961[_0xc341('0x25')](_0x4aa738);}}_0x5eba00({'count':_0x40c961[_0xc341('0x1c')],'rows':_0x40c961});});},'SmsQueues':function(){return new Promise(function(_0x2b4c04){var _0xeece2a=[];for(var _0x2bef15 in _0x483e30[_0xc341('0x5a')]){if(_0x483e30['smsQueues']['hasOwnProperty'](_0x2bef15)){var _0xb9bec5=_0x483e30[_0xc341('0x5a')][_0x2bef15];var _0x3543af={'id':_0xb9bec5['id'],'available':_0xb9bec5[_0xc341('0x54')],'loggedIn':_0xb9bec5[_0xc341('0x5b')],'name':_0xb9bec5[_0xc341('0x57')],'paused':_0xb9bec5[_0xc341('0x55')],'waiting':_0xb9bec5['waiting']};_0xeece2a[_0xc341('0x25')](_0x3543af);}}_0x2b4c04({'count':_0xeece2a[_0xc341('0x1c')],'rows':_0xeece2a});});},'FaxQueues':function(){return new Promise(function(_0x1b6589){var _0x23cc0d=[];for(var _0x7483cf in _0x483e30[_0xc341('0x5c')]){if(_0x483e30[_0xc341('0x5c')]['hasOwnProperty'](_0x7483cf)){var _0x53d4cc=_0x483e30[_0xc341('0x5c')][_0x7483cf];var _0xc74741={'id':_0x53d4cc['id'],'available':_0x53d4cc['available'],'loggedIn':_0x53d4cc['loggedIn'],'name':_0x53d4cc[_0xc341('0x57')],'paused':_0x53d4cc[_0xc341('0x55')],'waiting':_0x53d4cc[_0xc341('0x58')]};_0x23cc0d[_0xc341('0x25')](_0xc74741);}}_0x1b6589({'count':_0x23cc0d[_0xc341('0x1c')],'rows':_0x23cc0d});});},'WhatsappQueues':function(){return new Promise(function(_0x25befd){var _0x4db135=[];for(var _0x4c418c in _0x483e30[_0xc341('0x5d')]){if(_0x483e30[_0xc341('0x5d')][_0xc341('0x4d')](_0x4c418c)){var _0x1e216e=_0x483e30['whatsappQueues'][_0x4c418c];var _0x19c4d2={'id':_0x1e216e['id'],'available':_0x1e216e[_0xc341('0x54')],'loggedIn':_0x1e216e[_0xc341('0x5b')],'name':_0x1e216e['name'],'paused':_0x1e216e[_0xc341('0x55')],'waiting':_0x1e216e['waiting']};_0x4db135[_0xc341('0x25')](_0x19c4d2);}}_0x25befd({'count':_0x4db135[_0xc341('0x1c')],'rows':_0x4db135});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x594e3e){var _0x2ade1c=_[_0xc341('0x51')](_0x483e30['chatQueuesWaitingInteractions']);_0x594e3e({'count':_0x2ade1c[_0xc341('0x1c')],'rows':_0x2ade1c});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0xb650bb){var _0xd0db26=_[_0xc341('0x51')](_0x483e30[_0xc341('0x5e')]);_0xb650bb({'count':_0xd0db26[_0xc341('0x1c')],'rows':_0xd0db26});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x273997){var _0x513733=_[_0xc341('0x51')](_0x483e30[_0xc341('0x5f')]);_0x273997({'count':_0x513733[_0xc341('0x1c')],'rows':_0x513733});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x4edc5b){var _0xcfc613=_['values'](_0x483e30[_0xc341('0x60')]);_0x4edc5b({'count':_0xcfc613[_0xc341('0x1c')],'rows':_0xcfc613});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x3e4c62){var _0x4bc622=_[_0xc341('0x51')](_0x483e30[_0xc341('0x61')]);_0x3e4c62({'count':_0x4bc622[_0xc341('0x1c')],'rows':_0x4bc622});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x39ccde){var _0x36c9cc=_[_0xc341('0x51')](_0x483e30['whatsappQueuesWaitingInteractions']);_0x39ccde({'count':_0x36c9cc[_0xc341('0x1c')],'rows':_0x36c9cc});});}};var _0x360994=jayson['server'](_0x158c47)['http']();_0x360994['on'](_0xc341('0x3b'),function(_0x1351d8){logger[_0xc341('0x3b')](JSON[_0xc341('0x62')](_0x1351d8));return _0x1f5220(_0x1351d8);});_0x360994[_0xc341('0x14')](0x232c,_0xc341('0x63'),function(){console[_0xc341('0x64')]('Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232c);return _0x12a4eb(_0xc341('0x65')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index d06bf28..c9f0c80 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 _0xd90b=['rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','format','iftime\x20%s','then','indexOf','true','catch','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','stack','util','jayson/promise','lodash','../../../config/logger','client','http','request','error','message','result','condition'];(function(_0x581c4f,_0x58e1d4){var _0x4abb3b=function(_0x56d598){while(--_0x56d598){_0x581c4f['push'](_0x581c4f['shift']());}};_0x4abb3b(++_0x58e1d4);}(_0xd90b,0x161));var _0xbd90=function(_0x14aa05,_0x24c113){_0x14aa05=_0x14aa05-0x0;var _0x4d2f48=_0xd90b[_0x14aa05];return _0x4d2f48;};'use strict';var util=require(_0xbd90('0x0'));var BPromise=require('bluebird');var jayson=require(_0xbd90('0x1'));var _=require(_0xbd90('0x2'));var logger=require(_0xbd90('0x3'))('routing');var client=jayson[_0xbd90('0x4')][_0xbd90('0x5')]({'port':0x232a});function request(_0x4e1ace,_0x37d770){return new BPromise(function(_0x276d65,_0xca69d4){return client[_0xbd90('0x6')](_0x4e1ace,_0x37d770)['then'](function(_0x47bbff){if(_0x47bbff['error']){return _0xca69d4(_0x47bbff[_0xbd90('0x7')][_0xbd90('0x8')]);}else{return _0x276d65(_0x47bbff[_0xbd90('0x9')]);}})['catch'](function(_0x431ad4){return _0xca69d4(_0x431ad4);});});}exports[_0xbd90('0xa')]=function(_0x2e5a25,_0x33e6b9,_0x1fc040){return function(_0x480f96){if(_0x1fc040[_0xbd90('0xb')]&&!_0x1fc040[_0xbd90('0xb')][_0x2e5a25]){logger[_0xbd90('0xc')](_0xbd90('0xd'),_0x2e5a25);return _0x480f96[_0xbd90('0xe')]();}var _0x3b959b=[];for(var _0x13aca6=0x0;_0x13aca6<_0x33e6b9['length'];_0x13aca6+=0x1){_0x3b959b['push'](request('Command',{'command':util[_0xbd90('0xf')](_0xbd90('0x10'),_0x33e6b9[_0x13aca6])})[_0xbd90('0x11')](function(_0x4b913e){return _0x4b913e&&_0x4b913e[_0xbd90('0x8')]&&_0x4b913e[_0xbd90('0x8')][_0xbd90('0x12')](_0xbd90('0x13'))>=0x0?!![]:![];})[_0xbd90('0x14')](function(){logger[_0xbd90('0x7')]('[%s][INTERVAL]\x20%s',_0x2e5a25,_0x33e6b9[_0x13aca6]);}));}BPromise[_0xbd90('0x15')](_0x3b959b)['then'](function(_0x5088b0){var _0x4a6059=_['some'](_0x5088b0);logger[_0xbd90('0xc')](_0xbd90('0x16'),_0x2e5a25,_0x33e6b9[_0xbd90('0x17')](_0xbd90('0x18')),_0x4a6059);_0x480f96['when'](_0x4a6059);})[_0xbd90('0x14')](function(_0x5208ec){logger[_0xbd90('0x7')](_0xbd90('0x16'),_0x2e5a25,_0x33e6b9['join']('\x20|\x20'),_0x5208ec[_0xbd90('0x19')]);_0x480f96[_0xbd90('0xe')]();});};}; \ No newline at end of file +var _0x2fbd=['request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','iftime\x20%s','message','true','[%s][INTERVAL]\x20%s','all','some','join','\x20|\x20','stack','util','bluebird','jayson/promise','lodash','routing','client','http'];(function(_0x1f703f,_0x266ba9){var _0x3ad2ec=function(_0x306f81){while(--_0x306f81){_0x1f703f['push'](_0x1f703f['shift']());}};_0x3ad2ec(++_0x266ba9);}(_0x2fbd,0xbd));var _0xd2fb=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x2fbd[_0x199572];return _0x13cfa3;};'use strict';var util=require(_0xd2fb('0x0'));var BPromise=require(_0xd2fb('0x1'));var jayson=require(_0xd2fb('0x2'));var _=require(_0xd2fb('0x3'));var logger=require('../../../config/logger')(_0xd2fb('0x4'));var client=jayson[_0xd2fb('0x5')][_0xd2fb('0x6')]({'port':0x232a});function request(_0x4e64a6,_0x258c7f){return new BPromise(function(_0x17a743,_0x1990e2){return client[_0xd2fb('0x7')](_0x4e64a6,_0x258c7f)[_0xd2fb('0x8')](function(_0x2377eb){if(_0x2377eb[_0xd2fb('0x9')]){return _0x1990e2(_0x2377eb[_0xd2fb('0x9')]['message']);}else{return _0x17a743(_0x2377eb[_0xd2fb('0xa')]);}})[_0xd2fb('0xb')](function(_0x2d6193){return _0x1990e2(_0x2d6193);});});}exports[_0xd2fb('0xc')]=function(_0x3aab91,_0xf98404,_0x5bc8cc){return function(_0x6d6849){if(_0x5bc8cc[_0xd2fb('0xd')]&&!_0x5bc8cc[_0xd2fb('0xd')][_0x3aab91]){logger[_0xd2fb('0xe')](_0xd2fb('0xf'),_0x3aab91);return _0x6d6849[_0xd2fb('0x10')]();}var _0x3002ab=[];for(var _0x33edf2=0x0;_0x33edf2<_0xf98404[_0xd2fb('0x11')];_0x33edf2+=0x1){_0x3002ab[_0xd2fb('0x12')](request('Command',{'command':util['format'](_0xd2fb('0x13'),_0xf98404[_0x33edf2])})[_0xd2fb('0x8')](function(_0x240c84){return _0x240c84&&_0x240c84[_0xd2fb('0x14')]&&_0x240c84[_0xd2fb('0x14')]['indexOf'](_0xd2fb('0x15'))>=0x0?!![]:![];})[_0xd2fb('0xb')](function(){logger[_0xd2fb('0x9')](_0xd2fb('0x16'),_0x3aab91,_0xf98404[_0x33edf2]);}));}BPromise[_0xd2fb('0x17')](_0x3002ab)[_0xd2fb('0x8')](function(_0xa86991){var _0x2f1adc=_[_0xd2fb('0x18')](_0xa86991);logger['info']('[%s][INTERVAL]\x20%s\x20%s',_0x3aab91,_0xf98404[_0xd2fb('0x19')](_0xd2fb('0x1a')),_0x2f1adc);_0x6d6849['when'](_0x2f1adc);})[_0xd2fb('0xb')](function(_0x2f568e){logger[_0xd2fb('0x9')]('[%s][INTERVAL]\x20%s\x20%s',_0x3aab91,_0xf98404[_0xd2fb('0x19')](_0xd2fb('0x1a')),_0x2f568e[_0xd2fb('0x1b')]);_0x6d6849[_0xd2fb('0x10')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 7b38a5e..98119f9 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 _0xbaf0=['includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','[%s][agents][hangup]','util','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','connectedlinename','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','forIn'];(function(_0x706091,_0x5e07d9){var _0x4aee6f=function(_0xf8d0f6){while(--_0xf8d0f6){_0x706091['push'](_0x706091['shift']());}};_0x4aee6f(++_0x5e07d9);}(_0xbaf0,0x12a));var _0x0baf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xbaf0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var utils=require(_0x0baf('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1e212d,_0x263f79){utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1e212d[_0x0baf('0x4')],_0x1e212d[_0x0baf('0x5')],_0x1e212d[_0x0baf('0x6')],_0x1e212d[_0x0baf('0x7')],_0x1e212d[_0x0baf('0x8')],_0x1e212d[_0x0baf('0x9')],_0x1e212d[_0x0baf('0xa')],_0x1e212d[_0x0baf('0xb')]));if(_0x1e212d[_0x0baf('0x6')]){utils['getVoiceQueueByName'](_0x1e212d[_0x0baf('0x6')])['then'](function(_0x4605c3){if(_0x4605c3){_0x1e212d[_0x0baf('0xc')]=_0x4605c3[_0x0baf('0xc')];_0x1e212d[_0x0baf('0xd')]=_0x1e212d[_0x0baf('0xe')]?_0x4605c3[_0x0baf('0xf')]:![];_0x1e212d[_0x0baf('0x10')]=_0x1e212d[_0x0baf('0xd')]?_0x4605c3[_0x0baf('0x11')]:0x0;}utils[_0x0baf('0x12')](_0x0baf('0x13'),_0x1e212d);});}else{utils['request']('CreateVoiceAgentReport',_0x1e212d);}if(_0x263f79){delete transfers[_0x1e212d[_0x0baf('0x4')]];}else{delete agents[_0x1e212d[_0x0baf('0x14')]];}}exports[_0x0baf('0x15')]=function(_0x13df17){try{utils['debug'](util[_0x0baf('0x3')]('[%s][agents][agentcalled]',_0x13df17[_0x0baf('0x4')]),_0x13df17);agents[_0x13df17[_0x0baf('0x14')]]=_0x13df17;agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x16')]=utils[_0x0baf('0x17')]();agents[_0x13df17[_0x0baf('0x14')]]['lastevent']='called';agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0xa')]=null;agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x18')]=null;utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x13df17[_0x0baf('0x4')],agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x7')],_0x13df17[_0x0baf('0x14')]));}catch(_0x47070d){utils[_0x0baf('0x19')](util['format']('[%s][agents][agentcalled]',_0x13df17[_0x0baf('0x4')]),_0x47070d);}};exports[_0x0baf('0x1a')]=function(_0x32e839){try{if(!_[_0x0baf('0x1b')](agents[_0x32e839[_0x0baf('0x14')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x1d'),_0x32e839[_0x0baf('0x4')]),_0x32e839);utils[_0x0baf('0x2')](util['format'](_0x0baf('0x1e'),_0x32e839['uniqueid'],agents[_0x32e839[_0x0baf('0x14')]]['membername'],_0x32e839['destuniqueid']));agents[_0x32e839[_0x0baf('0x14')]]['agentringnoanswer']=!![];agents[_0x32e839['destuniqueid']][_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();agents[_0x32e839[_0x0baf('0x14')]][_0x0baf('0xb')]=_0x0baf('0x20');agents[_0x32e839['destuniqueid']][_0x0baf('0x21')]=_0x0baf('0x20');agents[_0x32e839[_0x0baf('0x14')]][_0x0baf('0x22')]=_0x32e839[_0x0baf('0x23')]?parseInt(_0x32e839[_0x0baf('0x23')])/0x3e8:0x0;agents[_0x32e839[_0x0baf('0x14')]]['talktime']=0x0;unanswered[_0x0baf('0x24')](_0x32e839[_0x0baf('0x14')]);}}catch(_0xcaf13d){utils[_0x0baf('0x19')](util['format'](_0x0baf('0x1d'),_0x32e839[_0x0baf('0x4')]),_0xcaf13d);}};exports['queuecallerabandon']=function(_0x44ec31){try{_[_0x0baf('0x25')](agents,function(_0x478ce8,_0xb4dbb1){if(_0x478ce8[_0x0baf('0x4')]==_0x44ec31[_0x0baf('0x4')]&&!_[_0x0baf('0x26')](unanswered,_0x478ce8['destuniqueid'])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x27'),_0x44ec31[_0x0baf('0x4')]),_0x44ec31);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x28'),_0x44ec31[_0x0baf('0x4')],_0x478ce8[_0x0baf('0x7')],_0x478ce8[_0x0baf('0x14')]));_0x478ce8[_0x0baf('0x1a')]=!![];_0x478ce8[_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();_0x478ce8[_0x0baf('0xb')]='abandoned';_0x478ce8[_0x0baf('0x21')]='abandoned';_0x478ce8[_0x0baf('0x22')]=_0x44ec31[_0x0baf('0x22')];_0x478ce8[_0x0baf('0x29')]=0x0;writeDB(_0x478ce8);}});}catch(_0x3d65f2){utils['error'](util[_0x0baf('0x3')](_0x0baf('0x27'),_0x44ec31['uniqueid']),_0x3d65f2);}};exports[_0x0baf('0x2a')]=function(_0x2447c2){try{if(agents[_0x2447c2[_0x0baf('0x14')]]){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x2b'),_0x2447c2[_0x0baf('0x4')]),_0x2447c2);utils[_0x0baf('0x2')](util['format'](_0x0baf('0x2c'),_0x2447c2[_0x0baf('0x4')],agents[_0x2447c2['destuniqueid']][_0x0baf('0x7')],_0x2447c2['destuniqueid']));agents[_0x2447c2['destuniqueid']][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();agents[_0x2447c2['destuniqueid']]['connectedlinenum']=_0x2447c2[_0x0baf('0xa')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0x18')]=_0x2447c2[_0x0baf('0x18')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0x22')]=_0x2447c2[_0x0baf('0x23')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0xb')]=_0x0baf('0x2e');_[_0x0baf('0x25')](agents,function(_0x148540,_0x354cb1){if(_0x148540[_0x0baf('0x14')]!=_0x2447c2['destuniqueid']&&_0x148540[_0x0baf('0x4')]==_0x2447c2[_0x0baf('0x4')]){_0x148540['talktime']=0x0;_0x148540[_0x0baf('0x22')]=_0x2447c2[_0x0baf('0x23')];_0x148540[_0x0baf('0x1a')]=!![];_0x148540[_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();_0x148540[_0x0baf('0xb')]='answered_elsewhere';_0x148540[_0x0baf('0x21')]=_0x0baf('0x2f');_0x148540['answeredelsewheredestinationuniqueid']=_0x2447c2[_0x0baf('0x14')];_0x148540[_0x0baf('0x30')]=_0x2447c2[_0x0baf('0x7')];writeDB(_0x148540);}});}}catch(_0x57903e){utils['error'](util[_0x0baf('0x3')](_0x0baf('0x2b'),_0x2447c2[_0x0baf('0x4')]),_0x57903e);}};exports[_0x0baf('0xe')]=function(_0x2b6d54){try{if(!_[_0x0baf('0x1b')](agents[_0x2b6d54[_0x0baf('0x14')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x31'),_0x2b6d54['uniqueid']),_0x2b6d54);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x32'),_0x2b6d54[_0x0baf('0x4')],agents[_0x2b6d54[_0x0baf('0x14')]]['membername'],_0x2b6d54[_0x0baf('0x14')]));agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0xe')]=!![];agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x33')]=utils['now']();agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x29')]=utils[_0x0baf('0x34')](agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x33')],agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x2d')]);agents[_0x2b6d54['destuniqueid']][_0x0baf('0x21')]=_0x2b6d54[_0x0baf('0x21')];agents[_0x2b6d54[_0x0baf('0x14')]]['lastevent']=_0x0baf('0x35');writeDB(agents[_0x2b6d54[_0x0baf('0x14')]]);}}catch(_0x10fa62){utils[_0x0baf('0x19')](util[_0x0baf('0x3')](_0x0baf('0x31'),_0x2b6d54[_0x0baf('0x4')]),_0x10fa62);}};exports['blindtransfer']=function(_0x22c451){try{if(!_[_0x0baf('0x1b')](agents[_0x22c451[_0x0baf('0x36')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x37'),_0x22c451[_0x0baf('0x4')]),_0x22c451);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x38'),_0x22c451[_0x0baf('0x4')],agents[_0x22c451['transfereruniqueid']]['membername'],agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x4')]));agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x39')]=!![];agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x3a')]=_0x0baf('0x3b');agents[_0x22c451['transfereruniqueid']][_0x0baf('0x3c')]=_0x22c451[_0x0baf('0x3d')];agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x3e')]=agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x4')];}}catch(_0x5e1849){utils[_0x0baf('0x19')](util['format'](_0x0baf('0x37'),_0x22c451['uniqueid']),_0x5e1849);}};exports[_0x0baf('0x3f')]=function(_0x5eaeb2){try{utils[_0x0baf('0x1c')](util['format'](_0x0baf('0x40'),_0x5eaeb2[_0x0baf('0x41')]),_0x5eaeb2);if(_0x5eaeb2[_0x0baf('0x41')]==_0x5eaeb2[_0x0baf('0x42')]){if(!_[_0x0baf('0x1b')](agents[_0x5eaeb2['secondtransfereruniqueid']])){utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x43'),_0x5eaeb2[_0x0baf('0x41')],agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x7')]));agents[_0x5eaeb2['secondtransfereruniqueid']][_0x0baf('0x39')]=!![];agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x3a')]=_0x0baf('0x45');agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x3c')]=_0x5eaeb2[_0x0baf('0x46')];agents[_0x5eaeb2['secondtransfereruniqueid']]['transferuniqueid']=_0x5eaeb2[_0x0baf('0x41')];}if(_0x5eaeb2[_0x0baf('0x47')]&&agents[_0x5eaeb2[_0x0baf('0x47')]]){agents[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x48')]=0x1;transfers[_0x5eaeb2[_0x0baf('0x47')]]=_[_0x0baf('0x49')](agents[_0x5eaeb2[_0x0baf('0x47')]]);transfers[_0x5eaeb2[_0x0baf('0x47')]]['calleridnum']=agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x9')];transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x4a')]=agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x4a')];transfers[_0x5eaeb2[_0x0baf('0x47')]]['agentcalledAt']=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x22')]=0x0;transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x48')]=0x2;}}else if(_0x5eaeb2['secondtransfereruniqueid']==_0x5eaeb2[_0x0baf('0x4b')]){if(!_['isNil'](agents[_0x5eaeb2[_0x0baf('0x41')]])){utils['info'](util['format'](_0x0baf('0x43'),_0x5eaeb2['origtransfereruniqueid'],agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x7')]));agents[_0x5eaeb2['origtransfereruniqueid']][_0x0baf('0x39')]=!![];agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x3a')]='ATTENDED';agents[_0x5eaeb2['origtransfereruniqueid']][_0x0baf('0x3c')]=_0x5eaeb2[_0x0baf('0x4c')];agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x3e')]=_0x5eaeb2[_0x0baf('0x44')];}if(_0x5eaeb2['transfertargetuniqueid']&&agents[_0x5eaeb2[_0x0baf('0x4d')]]){agents[_0x5eaeb2['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x5eaeb2['transfertargetuniqueid']]=_[_0x0baf('0x49')](agents[_0x5eaeb2['transfertargetuniqueid']]);transfers[_0x5eaeb2['transfertargetuniqueid']][_0x0baf('0x9')]=agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x9')];transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x4a')]=agents[_0x5eaeb2[_0x0baf('0x41')]]['calleridname'];transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x16')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2['transfertargetuniqueid']][_0x0baf('0x22')]=0x0;transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x48')]=0x2;}}}catch(_0x5d4053){utils[_0x0baf('0x19')](util[_0x0baf('0x3')](_0x0baf('0x40'),_0x5eaeb2[_0x0baf('0x41')]),_0x5d4053);}};exports[_0x0baf('0x4e')]=function(_0x27a959){try{utils[_0x0baf('0x1c')](util['format']('[%s][agents][hangup]',_0x27a959['uniqueid']),_0x27a959);if(agents[_0x27a959[_0x0baf('0x4')]]&&agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]===_0x0baf('0x20')){if(_0x27a959[_0x0baf('0x4f')]==='21'){agents[_0x27a959[_0x0baf('0x4')]]['reason']='rejected';agents[_0x27a959[_0x0baf('0x4')]]['lastevent']=_0x0baf('0x50');}utils[_0x0baf('0x2')](util['format'](_0x0baf('0x51'),_0x27a959[_0x0baf('0x4')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x7')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(agents[_0x27a959[_0x0baf('0x4')]]);var _0x5ea0f3=unanswered['indexOf'](_0x27a959['uniqueid']);if(_0x5ea0f3>-0x1){unanswered['splice'](_0x5ea0f3,0x1);}}if(transfers[_0x27a959['uniqueid']]){transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xe')]=!![];transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x33')]=utils['now']();transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x29')]=utils['diffTime'](transfers[_0x27a959['uniqueid']][_0x0baf('0x33')],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x2d')]);transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]=_0x0baf('0x52');transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]='complete';utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x27a959[_0x0baf('0x4')],transfers[_0x27a959[_0x0baf('0x4')]]['membername'],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(transfers[_0x27a959[_0x0baf('0x4')]],!![]);}if(agents[_0x27a959['uniqueid']]&&agents[_0x27a959['uniqueid']][_0x0baf('0x2d')]){agents[_0x27a959[_0x0baf('0x4')]]['agentcomplete']=!![];agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x33')]=utils[_0x0baf('0x17')]();agents[_0x27a959['uniqueid']][_0x0baf('0x29')]=utils[_0x0baf('0x34')](agents[_0x27a959[_0x0baf('0x4')]]['agentcompleteAt'],agents[_0x27a959[_0x0baf('0x4')]]['agentconnectAt']);agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]=agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x39')]?_0x0baf('0x39'):'agent';agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]='complete';utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x51'),_0x27a959[_0x0baf('0x4')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x7')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(agents[_0x27a959[_0x0baf('0x4')]]);}}catch(_0x2c2f09){utils['error'](util['format'](_0x0baf('0x53'),_0x27a959[_0x0baf('0x4')]),_0x2c2f09);}}; \ No newline at end of file +var _0xd8b0=['indexOf','splice','agent','lodash','util','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','interface','calleridnum','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','CreateVoiceAgentReport','request','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','lastevent','called','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','talktime','queuecallerabandon','forIn','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','now','reason','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','ringtime','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentconnect]','diffTime','agentcompleteAt','agentconnectAt','complete','[%s][agents][agentcomplete]','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','transferuniqueid','attendedtransfer','origtransfereruniqueid','secondtransfereruniqueid','transferexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','secondtransfererexten','transfertargetuniqueid','[%s][agents][attendedtransfer]','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s'];(function(_0x34eda0,_0x52dc21){var _0x48f9ea=function(_0x1a2ded){while(--_0x1a2ded){_0x34eda0['push'](_0x34eda0['shift']());}};_0x48f9ea(++_0x52dc21);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x585166,_0x4b72b0){utils[_0x0d8b('0x2')](util[_0x0d8b('0x3')](_0x0d8b('0x4'),_0x585166[_0x0d8b('0x5')],_0x585166[_0x0d8b('0x6')],_0x585166['queue'],_0x585166['membername'],_0x585166[_0x0d8b('0x7')],_0x585166[_0x0d8b('0x8')],_0x585166[_0x0d8b('0x9')],_0x585166['lastevent']));if(_0x585166[_0x0d8b('0xa')]){utils[_0x0d8b('0xb')](_0x585166['queue'])[_0x0d8b('0xc')](function(_0x348e65){if(_0x348e65){_0x585166[_0x0d8b('0xd')]=_0x348e65[_0x0d8b('0xd')];_0x585166[_0x0d8b('0xe')]=_0x585166[_0x0d8b('0xf')]?_0x348e65[_0x0d8b('0x10')]:![];_0x585166[_0x0d8b('0x11')]=_0x585166['agentacw']?_0x348e65[_0x0d8b('0x12')]:0x0;}utils['request'](_0x0d8b('0x13'),_0x585166);});}else{utils[_0x0d8b('0x14')](_0x0d8b('0x13'),_0x585166);}if(_0x4b72b0){delete transfers[_0x585166[_0x0d8b('0x5')]];}else{delete agents[_0x585166[_0x0d8b('0x15')]];}}exports[_0x0d8b('0x16')]=function(_0x15dd0f){try{utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')](_0x0d8b('0x18'),_0x15dd0f[_0x0d8b('0x5')]),_0x15dd0f);agents[_0x15dd0f[_0x0d8b('0x15')]]=_0x15dd0f;agents[_0x15dd0f[_0x0d8b('0x15')]][_0x0d8b('0x19')]=utils['now']();agents[_0x15dd0f[_0x0d8b('0x15')]][_0x0d8b('0x1a')]=_0x0d8b('0x1b');agents[_0x15dd0f[_0x0d8b('0x15')]][_0x0d8b('0x9')]=null;agents[_0x15dd0f['destuniqueid']][_0x0d8b('0x1c')]=null;utils[_0x0d8b('0x2')](util[_0x0d8b('0x3')](_0x0d8b('0x1d'),_0x15dd0f[_0x0d8b('0x5')],agents[_0x15dd0f[_0x0d8b('0x15')]][_0x0d8b('0x1e')],_0x15dd0f[_0x0d8b('0x15')]));}catch(_0x4a15bf){utils[_0x0d8b('0x1f')](util[_0x0d8b('0x3')](_0x0d8b('0x18'),_0x15dd0f[_0x0d8b('0x5')]),_0x4a15bf);}};exports[_0x0d8b('0x20')]=function(_0x5b709c){try{if(!_[_0x0d8b('0x21')](agents[_0x5b709c[_0x0d8b('0x15')]])){utils['debug'](util['format'](_0x0d8b('0x22'),_0x5b709c['uniqueid']),_0x5b709c);utils['info'](util['format'](_0x0d8b('0x23'),_0x5b709c[_0x0d8b('0x5')],agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x1e')],_0x5b709c[_0x0d8b('0x15')]));agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x20')]=!![];agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x24')]=utils['now']();agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x1a')]='timeout';agents[_0x5b709c[_0x0d8b('0x15')]]['reason']=_0x0d8b('0x25');agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x26')]=_0x5b709c['ringtime']?parseInt(_0x5b709c['ringtime'])/0x3e8:0x0;agents[_0x5b709c[_0x0d8b('0x15')]][_0x0d8b('0x27')]=0x0;unanswered['push'](_0x5b709c[_0x0d8b('0x15')]);}}catch(_0x59aa83){utils[_0x0d8b('0x1f')](util['format'](_0x0d8b('0x22'),_0x5b709c['uniqueid']),_0x59aa83);}};exports[_0x0d8b('0x28')]=function(_0x546bf6){try{_[_0x0d8b('0x29')](agents,function(_0x544735,_0x3c8887){if(_0x544735[_0x0d8b('0x5')]==_0x546bf6[_0x0d8b('0x5')]&&!_['includes'](unanswered,_0x544735['destuniqueid'])){utils['debug'](util[_0x0d8b('0x3')]('[%s][agents][queuecallerabandon]',_0x546bf6[_0x0d8b('0x5')]),_0x546bf6);utils['info'](util['format'](_0x0d8b('0x2a'),_0x546bf6[_0x0d8b('0x5')],_0x544735[_0x0d8b('0x1e')],_0x544735[_0x0d8b('0x15')]));_0x544735[_0x0d8b('0x20')]=!![];_0x544735[_0x0d8b('0x24')]=utils[_0x0d8b('0x2b')]();_0x544735[_0x0d8b('0x1a')]='abandoned';_0x544735[_0x0d8b('0x2c')]=_0x0d8b('0x2d');_0x544735['holdtime']=_0x546bf6[_0x0d8b('0x26')];_0x544735[_0x0d8b('0x27')]=0x0;writeDB(_0x544735);}});}catch(_0x18a905){utils['error'](util[_0x0d8b('0x3')](_0x0d8b('0x2e'),_0x546bf6[_0x0d8b('0x5')]),_0x18a905);}};exports[_0x0d8b('0x2f')]=function(_0x933e01){try{if(agents[_0x933e01['destuniqueid']]){utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')]('[%s][agents][agentconnect]',_0x933e01[_0x0d8b('0x5')]),_0x933e01);utils[_0x0d8b('0x2')](util[_0x0d8b('0x3')](_0x0d8b('0x30'),_0x933e01[_0x0d8b('0x5')],agents[_0x933e01['destuniqueid']]['membername'],_0x933e01[_0x0d8b('0x15')]));agents[_0x933e01['destuniqueid']]['agentconnectAt']=utils[_0x0d8b('0x2b')]();agents[_0x933e01[_0x0d8b('0x15')]][_0x0d8b('0x9')]=_0x933e01[_0x0d8b('0x9')];agents[_0x933e01[_0x0d8b('0x15')]][_0x0d8b('0x1c')]=_0x933e01['connectedlinename'];agents[_0x933e01[_0x0d8b('0x15')]][_0x0d8b('0x26')]=_0x933e01[_0x0d8b('0x31')];agents[_0x933e01[_0x0d8b('0x15')]][_0x0d8b('0x1a')]=_0x0d8b('0x32');_[_0x0d8b('0x29')](agents,function(_0x5c980b,_0x1d06b6){if(_0x5c980b[_0x0d8b('0x15')]!=_0x933e01[_0x0d8b('0x15')]&&_0x5c980b[_0x0d8b('0x5')]==_0x933e01['uniqueid']){_0x5c980b[_0x0d8b('0x27')]=0x0;_0x5c980b['holdtime']=_0x933e01[_0x0d8b('0x31')];_0x5c980b[_0x0d8b('0x20')]=!![];_0x5c980b[_0x0d8b('0x24')]=utils[_0x0d8b('0x2b')]();_0x5c980b[_0x0d8b('0x1a')]=_0x0d8b('0x33');_0x5c980b[_0x0d8b('0x2c')]=_0x0d8b('0x33');_0x5c980b[_0x0d8b('0x34')]=_0x933e01[_0x0d8b('0x15')];_0x5c980b['answeredelsewheremembername']=_0x933e01['membername'];writeDB(_0x5c980b);}});}}catch(_0x576050){utils['error'](util['format'](_0x0d8b('0x35'),_0x933e01[_0x0d8b('0x5')]),_0x576050);}};exports[_0x0d8b('0xf')]=function(_0x5100cf){try{if(!_['isNil'](agents[_0x5100cf[_0x0d8b('0x15')]])){utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')]('[%s][agents][agentcomplete]',_0x5100cf[_0x0d8b('0x5')]),_0x5100cf);utils[_0x0d8b('0x2')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5100cf[_0x0d8b('0x5')],agents[_0x5100cf['destuniqueid']][_0x0d8b('0x1e')],_0x5100cf['destuniqueid']));agents[_0x5100cf['destuniqueid']][_0x0d8b('0xf')]=!![];agents[_0x5100cf[_0x0d8b('0x15')]]['agentcompleteAt']=utils['now']();agents[_0x5100cf['destuniqueid']]['talktime']=utils[_0x0d8b('0x36')](agents[_0x5100cf[_0x0d8b('0x15')]][_0x0d8b('0x37')],agents[_0x5100cf['destuniqueid']][_0x0d8b('0x38')]);agents[_0x5100cf[_0x0d8b('0x15')]][_0x0d8b('0x2c')]=_0x5100cf[_0x0d8b('0x2c')];agents[_0x5100cf[_0x0d8b('0x15')]][_0x0d8b('0x1a')]=_0x0d8b('0x39');writeDB(agents[_0x5100cf[_0x0d8b('0x15')]]);}}catch(_0x384a5e){utils[_0x0d8b('0x1f')](util[_0x0d8b('0x3')](_0x0d8b('0x3a'),_0x5100cf[_0x0d8b('0x5')]),_0x384a5e);}};exports[_0x0d8b('0x3b')]=function(_0x570af8){try{if(!_[_0x0d8b('0x21')](agents[_0x570af8[_0x0d8b('0x3c')]])){utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')]('[%s][agents][blindtransfer]',_0x570af8[_0x0d8b('0x5')]),_0x570af8);utils['info'](util['format'](_0x0d8b('0x3d'),_0x570af8[_0x0d8b('0x5')],agents[_0x570af8[_0x0d8b('0x3c')]][_0x0d8b('0x1e')],agents[_0x570af8['transfereruniqueid']][_0x0d8b('0x5')]));agents[_0x570af8[_0x0d8b('0x3c')]][_0x0d8b('0x3e')]=!![];agents[_0x570af8[_0x0d8b('0x3c')]][_0x0d8b('0x3f')]='blind';agents[_0x570af8['transfereruniqueid']]['transferexten']=_0x570af8['extension'];agents[_0x570af8[_0x0d8b('0x3c')]][_0x0d8b('0x40')]=agents[_0x570af8['transfereruniqueid']]['uniqueid'];}}catch(_0x44c5c1){utils[_0x0d8b('0x1f')](util['format']('[%s][agents][blindtransfer]',_0x570af8[_0x0d8b('0x5')]),_0x44c5c1);}};exports[_0x0d8b('0x41')]=function(_0x3cd00a){try{utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')]('[%s][agents][attendedtransfer]',_0x3cd00a[_0x0d8b('0x42')]),_0x3cd00a);if(_0x3cd00a[_0x0d8b('0x42')]==_0x3cd00a['origtransfererlinkedid']){if(!_['isNil'](agents[_0x3cd00a[_0x0d8b('0x43')]])){utils[_0x0d8b('0x2')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0x3cd00a[_0x0d8b('0x42')],agents[_0x3cd00a[_0x0d8b('0x43')]][_0x0d8b('0x1e')]));agents[_0x3cd00a[_0x0d8b('0x43')]]['transfer']=!![];agents[_0x3cd00a[_0x0d8b('0x43')]]['transfertype']='ATTENDED';agents[_0x3cd00a[_0x0d8b('0x43')]][_0x0d8b('0x44')]=_0x3cd00a['origtransfererexten'];agents[_0x3cd00a['secondtransfereruniqueid']][_0x0d8b('0x40')]=_0x3cd00a[_0x0d8b('0x42')];}if(_0x3cd00a[_0x0d8b('0x45')]&&agents[_0x3cd00a[_0x0d8b('0x45')]]){agents[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x46')]=0x1;transfers[_0x3cd00a[_0x0d8b('0x45')]]=_[_0x0d8b('0x47')](agents[_0x3cd00a['transfereeuniqueid']]);transfers[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x8')]=agents[_0x3cd00a[_0x0d8b('0x43')]][_0x0d8b('0x8')];transfers[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x48')]=agents[_0x3cd00a[_0x0d8b('0x43')]][_0x0d8b('0x48')];transfers[_0x3cd00a[_0x0d8b('0x45')]]['agentcalledAt']=utils[_0x0d8b('0x2b')]();transfers[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x38')]=utils[_0x0d8b('0x2b')]();transfers[_0x3cd00a[_0x0d8b('0x45')]]['holdtime']=0x0;transfers[_0x3cd00a[_0x0d8b('0x45')]][_0x0d8b('0x46')]=0x2;}}else if(_0x3cd00a[_0x0d8b('0x43')]==_0x3cd00a[_0x0d8b('0x49')]){if(!_[_0x0d8b('0x21')](agents[_0x3cd00a['origtransfereruniqueid']])){utils['info'](util[_0x0d8b('0x3')](_0x0d8b('0x4a'),_0x3cd00a[_0x0d8b('0x42')],agents[_0x3cd00a[_0x0d8b('0x42')]]['membername']));agents[_0x3cd00a[_0x0d8b('0x42')]][_0x0d8b('0x3e')]=!![];agents[_0x3cd00a[_0x0d8b('0x42')]]['transfertype']=_0x0d8b('0x4b');agents[_0x3cd00a['origtransfereruniqueid']][_0x0d8b('0x44')]=_0x3cd00a[_0x0d8b('0x4c')];agents[_0x3cd00a[_0x0d8b('0x42')]][_0x0d8b('0x40')]=_0x3cd00a[_0x0d8b('0x43')];}if(_0x3cd00a[_0x0d8b('0x4d')]&&agents[_0x3cd00a['transfertargetuniqueid']]){agents[_0x3cd00a[_0x0d8b('0x4d')]]['agententerreason']=0x1;transfers[_0x3cd00a[_0x0d8b('0x4d')]]=_[_0x0d8b('0x47')](agents[_0x3cd00a[_0x0d8b('0x4d')]]);transfers[_0x3cd00a[_0x0d8b('0x4d')]]['calleridnum']=agents[_0x3cd00a[_0x0d8b('0x42')]][_0x0d8b('0x8')];transfers[_0x3cd00a[_0x0d8b('0x4d')]][_0x0d8b('0x48')]=agents[_0x3cd00a[_0x0d8b('0x42')]][_0x0d8b('0x48')];transfers[_0x3cd00a[_0x0d8b('0x4d')]][_0x0d8b('0x19')]=utils[_0x0d8b('0x2b')]();transfers[_0x3cd00a[_0x0d8b('0x4d')]]['agentconnectAt']=utils['now']();transfers[_0x3cd00a[_0x0d8b('0x4d')]][_0x0d8b('0x26')]=0x0;transfers[_0x3cd00a['transfertargetuniqueid']][_0x0d8b('0x46')]=0x2;}}}catch(_0x5ab1f7){utils['error'](util[_0x0d8b('0x3')](_0x0d8b('0x4e'),_0x3cd00a['origtransfereruniqueid']),_0x5ab1f7);}};exports['hangup']=function(_0x1900e3){try{utils[_0x0d8b('0x17')](util[_0x0d8b('0x3')](_0x0d8b('0x4f'),_0x1900e3[_0x0d8b('0x5')]),_0x1900e3);if(agents[_0x1900e3[_0x0d8b('0x5')]]&&agents[_0x1900e3[_0x0d8b('0x5')]]['reason']===_0x0d8b('0x25')){if(_0x1900e3['cause']==='21'){agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')]=_0x0d8b('0x50');agents[_0x1900e3[_0x0d8b('0x5')]]['lastevent']=_0x0d8b('0x50');}utils['info'](util[_0x0d8b('0x3')](_0x0d8b('0x51'),_0x1900e3[_0x0d8b('0x5')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1e')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1a')]));writeDB(agents[_0x1900e3[_0x0d8b('0x5')]]);var _0x4eb07e=unanswered[_0x0d8b('0x52')](_0x1900e3['uniqueid']);if(_0x4eb07e>-0x1){unanswered[_0x0d8b('0x53')](_0x4eb07e,0x1);}}if(transfers[_0x1900e3[_0x0d8b('0x5')]]){transfers[_0x1900e3['uniqueid']][_0x0d8b('0xf')]=!![];transfers[_0x1900e3['uniqueid']][_0x0d8b('0x37')]=utils[_0x0d8b('0x2b')]();transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x27')]=utils[_0x0d8b('0x36')](transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x37')],transfers[_0x1900e3[_0x0d8b('0x5')]]['agentconnectAt']);transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')]='agent';transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1a')]=_0x0d8b('0x39');utils[_0x0d8b('0x2')](util[_0x0d8b('0x3')](_0x0d8b('0x51'),_0x1900e3[_0x0d8b('0x5')],transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1e')],transfers[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')],transfers[_0x1900e3[_0x0d8b('0x5')]]['lastevent']));writeDB(transfers[_0x1900e3[_0x0d8b('0x5')]],!![]);}if(agents[_0x1900e3[_0x0d8b('0x5')]]&&agents[_0x1900e3[_0x0d8b('0x5')]]['agentconnectAt']){agents[_0x1900e3['uniqueid']][_0x0d8b('0xf')]=!![];agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x37')]=utils['now']();agents[_0x1900e3['uniqueid']][_0x0d8b('0x27')]=utils[_0x0d8b('0x36')](agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x37')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x38')]);agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')]=agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x3e')]?_0x0d8b('0x3e'):_0x0d8b('0x54');agents[_0x1900e3[_0x0d8b('0x5')]]['lastevent']=_0x0d8b('0x39');utils[_0x0d8b('0x2')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1900e3[_0x0d8b('0x5')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x1e')],agents[_0x1900e3[_0x0d8b('0x5')]][_0x0d8b('0x2c')],agents[_0x1900e3[_0x0d8b('0x5')]]['lastevent']));writeDB(agents[_0x1900e3['uniqueid']]);}}catch(_0x581d8e){utils[_0x0d8b('0x1f')](util[_0x0d8b('0x3')](_0x0d8b('0x4f'),_0x1900e3[_0x0d8b('0x5')]),_0x581d8e);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 61e1a5f..4e88731 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 _0x13ad=['[%s][calls][varset]','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','variable','xmd-phone','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','Queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','type','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','noop','gotoif','lastapplication','lastdata','appdata','lodash','./utils','NO\x20ANSWER','FAILED','BUSY','info','format','queue','membername','interface','calleridnum','connectedlinenum','getUserByInternal','accountcode','then','UserId','CreateVoiceCallReport','request','uniqueid','newchannel','debug','[%s][calls][newchannel]','channel','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','DOCUMENTATION','error','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','now','linkedid','transfer','destinationchannel','answertime','disposition','toNumber','ANSWERED','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','endtime','diffTime','starttime','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset'];(function(_0x94a721,_0xd2b989){var _0x353bfe=function(_0x500580){while(--_0x500580){_0x94a721['push'](_0x94a721['shift']());}};_0x353bfe(++_0xd2b989);}(_0x13ad,0x1c8));var _0xd13a=function(_0x20cd22,_0x1441e0){_0x20cd22=_0x20cd22-0x0;var _0x20c18b=_0x13ad[_0x20cd22];return _0x20c18b;};'use strict';var _=require(_0xd13a('0x0'));var util=require('util');var utils=require(_0xd13a('0x1'));var dispositions=[_0xd13a('0x2'),_0xd13a('0x3'),'FAILED',_0xd13a('0x2'),_0xd13a('0x2'),_0xd13a('0x2'),'ANSWERED',_0xd13a('0x4'),_0xd13a('0x3'),_0xd13a('0x3'),_0xd13a('0x3')];var channels={};function writeDB(_0x488967){utils[_0xd13a('0x5')](util[_0xd13a('0x6')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x488967['uniqueid'],_0x488967['channel'],_0x488967[_0xd13a('0x7')],_0x488967[_0xd13a('0x8')],_0x488967[_0xd13a('0x9')],_0x488967[_0xd13a('0xa')],_0x488967[_0xd13a('0xb')],_0x488967['lastevent']));if(_0x488967['accountcode']){utils[_0xd13a('0xc')](_0x488967[_0xd13a('0xd')])[_0xd13a('0xe')](function(_0x26f1ca){if(_0x26f1ca){_0x488967[_0xd13a('0xf')]=_0x26f1ca['id'];}utils['request'](_0xd13a('0x10'),_0x488967);});}else{utils[_0xd13a('0x11')](_0xd13a('0x10'),_0x488967);}if(channels[_0x488967[_0xd13a('0x12')]]){delete channels[_0x488967[_0xd13a('0x12')]];}}exports[_0xd13a('0x13')]=function(_0x991aba){try{utils[_0xd13a('0x14')](util[_0xd13a('0x6')](_0xd13a('0x15'),_0x991aba[_0xd13a('0x12')]),_0x991aba);if(_0x991aba[_0xd13a('0x12')]==_0x991aba['linkedid']&&_0x991aba[_0xd13a('0x16')]!=_0xd13a('0x17')){utils['info'](util[_0xd13a('0x6')](_0xd13a('0x18'),_0x991aba['uniqueid'],_0x991aba[_0xd13a('0x19')],_0x991aba[_0xd13a('0x1a')]));channels[_0x991aba['uniqueid']]={'uniqueid':_0x991aba[_0xd13a('0x12')],'accountcode':_0x991aba[_0xd13a('0xd')],'source':_0x991aba['calleridnum'],'destination':_0x991aba['exten'],'destinationcontext':_0x991aba[_0xd13a('0x19')],'channel':_0x991aba[_0xd13a('0x16')],'starttime':utils['now'](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xd13a('0x2'),'amaflags':_0xd13a('0x1b')};}}catch(_0x3f2f24){utils[_0xd13a('0x1c')](util[_0xd13a('0x6')](_0xd13a('0x15'),_0x991aba[_0xd13a('0x12')]),_0x3f2f24);}};exports['newstate']=function(_0xb9b92c){try{utils[_0xd13a('0x14')](util[_0xd13a('0x6')]('[%s][calls][newstate]',_0xb9b92c[_0xd13a('0x12')]),_0xb9b92c);if(!_[_0xd13a('0x1d')](channels[_0xb9b92c['uniqueid']])&&_0xb9b92c[_0xd13a('0x1e')]==0x6){utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x1f'),_0xb9b92c[_0xd13a('0x12')],_0xb9b92c[_0xd13a('0x19')],_0xb9b92c[_0xd13a('0x16')]));if(_[_0xd13a('0x1d')](channels[_0xb9b92c[_0xd13a('0x12')]][_0xd13a('0x20')])){channels[_0xb9b92c[_0xd13a('0x12')]][_0xd13a('0x20')]=utils[_0xd13a('0x21')]();}}else if(!_[_0xd13a('0x1d')](channels[_0xb9b92c[_0xd13a('0x22')]])&&_0xb9b92c[_0xd13a('0x1e')]==0x6&&_0xb9b92c[_0xd13a('0x19')]!=_0xd13a('0x23')){utils[_0xd13a('0x5')](util[_0xd13a('0x6')]('[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0xb9b92c[_0xd13a('0x12')],_0xb9b92c[_0xd13a('0x22')],_0xb9b92c[_0xd13a('0x19')],_0xb9b92c[_0xd13a('0x16')]));channels[_0xb9b92c['linkedid']]['accountcode']=_0xb9b92c[_0xd13a('0xd')];channels[_0xb9b92c[_0xd13a('0x22')]][_0xd13a('0x24')]=_0xb9b92c[_0xd13a('0x16')];if(_['isNil'](channels[_0xb9b92c[_0xd13a('0x22')]][_0xd13a('0x25')])){channels[_0xb9b92c[_0xd13a('0x22')]][_0xd13a('0x25')]=utils[_0xd13a('0x21')]();}channels[_0xb9b92c[_0xd13a('0x22')]][_0xd13a('0x26')]=dispositions[_[_0xd13a('0x27')](_0xb9b92c['channelstate'])]||_0xd13a('0x28');}}catch(_0x4773f1){utils[_0xd13a('0x1c')](util[_0xd13a('0x6')](_0xd13a('0x29'),_0xb9b92c[_0xd13a('0x12')]),_0x4773f1);}};exports[_0xd13a('0x2a')]=function(_0x3608b9){try{if(!_[_0xd13a('0x1d')](channels[_0x3608b9['uniqueid']])){utils[_0xd13a('0x14')](util[_0xd13a('0x6')](_0xd13a('0x2b'),_0x3608b9['uniqueid']),_0x3608b9);if(_[_0xd13a('0x1d')](channels[_0x3608b9[_0xd13a('0x12')]][_0xd13a('0x2c')])){channels[_0x3608b9[_0xd13a('0x12')]][_0xd13a('0x2c')]=_0x3608b9[_0xd13a('0x2d')]+'\x20<'+_0x3608b9['calleridnum']+'>';}utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x2e'),_0x3608b9[_0xd13a('0x12')],channels[_0x3608b9['uniqueid']][_0xd13a('0x2c')],_0x3608b9['cause-txt']));channels[_0x3608b9[_0xd13a('0x12')]][_0xd13a('0x2f')]=utils['now']();channels[_0x3608b9[_0xd13a('0x12')]]['duration']=utils[_0xd13a('0x30')](channels[_0x3608b9[_0xd13a('0x12')]][_0xd13a('0x2f')],channels[_0x3608b9[_0xd13a('0x12')]][_0xd13a('0x31')]);channels[_0x3608b9[_0xd13a('0x12')]]['billableseconds']=channels[_0x3608b9[_0xd13a('0x12')]][_0xd13a('0x25')]?utils[_0xd13a('0x30')](channels[_0x3608b9['uniqueid']][_0xd13a('0x2f')],channels[_0x3608b9[_0xd13a('0x12')]][_0xd13a('0x25')]):0x0;writeDB(channels[_0x3608b9[_0xd13a('0x12')]]);}}catch(_0x3120e9){utils[_0xd13a('0x1c')](util[_0xd13a('0x6')](_0xd13a('0x2b'),_0x3608b9['uniqueid']),_0x3120e9);}};exports[_0xd13a('0x32')]=function(_0x5df661){try{if(!_[_0xd13a('0x1d')](channels[_0x5df661[_0xd13a('0x33')]])){utils[_0xd13a('0x14')](util[_0xd13a('0x6')](_0xd13a('0x34'),_0x5df661[_0xd13a('0x35')]),_0x5df661);if(channels[_0x5df661[_0xd13a('0x33')]]['channel']==_0x5df661[_0xd13a('0x36')]){utils[_0xd13a('0x5')](util[_0xd13a('0x6')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x5df661['origtransfereruniqueid'],_0x5df661[_0xd13a('0x33')],_0x5df661[_0xd13a('0x37')]));channels[_0x5df661[_0xd13a('0x33')]]['destinationchannel']=_0x5df661[_0xd13a('0x37')];channels[_0x5df661[_0xd13a('0x33')]][_0xd13a('0x38')]=_0xd13a('0x39');}else if(channels[_0x5df661[_0xd13a('0x33')]][_0xd13a('0x16')]=_0x5df661[_0xd13a('0x3a')]){utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x3b'),_0x5df661[_0xd13a('0x35')],_0x5df661[_0xd13a('0x33')],_0x5df661['origtransfererchannel']));channels[_0x5df661[_0xd13a('0x33')]]['destinationchannel']=_0x5df661[_0xd13a('0x3c')];channels[_0x5df661[_0xd13a('0x33')]]['userfield']=_0xd13a('0x39');}}}catch(_0x20ebfa){utils[_0xd13a('0x1c')](util[_0xd13a('0x6')](_0xd13a('0x34'),_0x5df661[_0xd13a('0x35')]),_0x20ebfa);}};exports[_0xd13a('0x3d')]=function(_0x29b897){try{if(!_[_0xd13a('0x1d')](channels[_0x29b897[_0xd13a('0x12')]])){utils['debug'](util['format'](_0xd13a('0x3e'),_0x29b897[_0xd13a('0x12')]),_0x29b897);channels[_0x29b897[_0xd13a('0x12')]]['musiconholdstartAt']=utils[_0xd13a('0x21')]();utils[_0xd13a('0x5')](util[_0xd13a('0x6')]('[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s',_0x29b897[_0xd13a('0x12')],channels[_0x29b897[_0xd13a('0x12')]][_0xd13a('0x3f')]));}}catch(_0x4cc411){utils['error'](util[_0xd13a('0x6')](_0xd13a('0x3e'),_0x29b897['uniqueid']),_0x4cc411);}};exports[_0xd13a('0x40')]=function(_0xeb43af){try{if(!_[_0xd13a('0x1d')](channels[_0xeb43af[_0xd13a('0x12')]])){utils[_0xd13a('0x14')](util['format']('[%s][calls][musiconholdstop]',_0xeb43af[_0xd13a('0x12')]),_0xeb43af);if(!_['isNil'](channels[_0xeb43af[_0xd13a('0x12')]][_0xd13a('0x3f')])){channels[_0xeb43af[_0xd13a('0x12')]][_0xd13a('0x41')]+=utils[_0xd13a('0x30')](utils[_0xd13a('0x21')](),channels[_0xeb43af[_0xd13a('0x12')]][_0xd13a('0x3f')]);utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x42'),_0xeb43af[_0xd13a('0x12')],channels[_0xeb43af[_0xd13a('0x12')]][_0xd13a('0x41')]));delete channels[_0xeb43af[_0xd13a('0x12')]][_0xd13a('0x3f')];}}}catch(_0x5d1ceb){utils[_0xd13a('0x1c')](util['format'](_0xd13a('0x43'),_0xeb43af['uniqueid']),_0x5d1ceb);}};exports[_0xd13a('0x44')]=function(_0x4f327c){try{if(!_[_0xd13a('0x1d')](channels[_0x4f327c['uniqueid']])){utils['debug'](util[_0xd13a('0x6')](_0xd13a('0x45'),_0x4f327c['uniqueid']),_0x4f327c);if(!_[_0xd13a('0x1d')](_0x4f327c['variable'][_0xd13a('0x46')])){utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x47'),_0x4f327c[_0xd13a('0x12')],_0x4f327c['value']));channels[_0x4f327c[_0xd13a('0x12')]]['source']=_0x4f327c[_0xd13a('0x48')];}if(!_[_0xd13a('0x1d')](_0x4f327c[_0xd13a('0x49')][_0xd13a('0x4a')])){utils[_0xd13a('0x5')](util[_0xd13a('0x6')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x4f327c[_0xd13a('0x12')],_0x4f327c[_0xd13a('0x48')]));channels[_0x4f327c[_0xd13a('0x12')]][_0xd13a('0x4b')]=_0x4f327c[_0xd13a('0x48')];channels[_0x4f327c[_0xd13a('0x12')]][_0xd13a('0x2c')]='\x22'+_0x4f327c[_0xd13a('0x48')]+'\x22\x20<'+_0x4f327c[_0xd13a('0x48')]+'>';}if(!_[_0xd13a('0x1d')](_0x4f327c[_0xd13a('0x49')][_0xd13a('0x4c')])||!_[_0xd13a('0x1d')](_0x4f327c['variable'][_0xd13a('0x4d')])){utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x4e'),_0x4f327c[_0xd13a('0x12')],!_[_0xd13a('0x1d')](_0x4f327c['variable'][_0xd13a('0x4c')])?_0xd13a('0x4c'):_0xd13a('0x4d'),_0x4f327c[_0xd13a('0x48')]));channels[_0x4f327c[_0xd13a('0x12')]][_0xd13a('0x2c')]=_0x4f327c[_0xd13a('0x48')];}if(!_[_0xd13a('0x1d')](_0x4f327c[_0xd13a('0x49')][_0xd13a('0x4f')])||!_[_0xd13a('0x1d')](_0x4f327c['variable'][_0xd13a('0x50')])){utils['info'](util[_0xd13a('0x6')](_0xd13a('0x4e'),_0x4f327c[_0xd13a('0x12')],!_['isNil'](_0x4f327c[_0xd13a('0x49')][_0xd13a('0x4f')])?_0xd13a('0x4f'):'xmcs-queue',_0x4f327c[_0xd13a('0x48')]));channels[_0x4f327c['uniqueid']]['lastapplication']=_0xd13a('0x51');channels[_0x4f327c[_0xd13a('0x12')]]['lastdata']=_0x4f327c['value'];channels[_0x4f327c[_0xd13a('0x12')]]['queue']=!![];}if(!_[_0xd13a('0x1d')](_0x4f327c[_0xd13a('0x49')][_0xd13a('0x52')])){utils[_0xd13a('0x5')](util['format'](_0xd13a('0x53'),_0x4f327c[_0xd13a('0x12')],_0x4f327c[_0xd13a('0x48')]));channels[_0x4f327c[_0xd13a('0x12')]][_0xd13a('0x54')]=_0x4f327c['value'];}if(!_[_0xd13a('0x1d')](_0x4f327c[_0xd13a('0x49')][_0xd13a('0x55')])){utils[_0xd13a('0x5')](util[_0xd13a('0x6')]('[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s',_0x4f327c[_0xd13a('0x12')],_0x4f327c[_0xd13a('0x48')]));channels[_0x4f327c['uniqueid']][_0xd13a('0x56')]=_0x4f327c[_0xd13a('0x48')];}if(!_[_0xd13a('0x1d')](_0x4f327c[_0xd13a('0x49')]['outboundrouteid'])){utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x57'),_0x4f327c['uniqueid'],_0x4f327c['value']));channels[_0x4f327c[_0xd13a('0x12')]]['routeid']=_0x4f327c[_0xd13a('0x48')];}if(!_[_0xd13a('0x1d')](_0x4f327c['variable']['sipcallid'])){utils[_0xd13a('0x5')](util[_0xd13a('0x6')](_0xd13a('0x58'),_0x4f327c[_0xd13a('0x12')],_0x4f327c[_0xd13a('0x48')]));channels[_0x4f327c[_0xd13a('0x12')]][_0xd13a('0x59')]=_0x4f327c[_0xd13a('0x48')];}}}catch(_0x5be871){utils['error'](util['format'](_0xd13a('0x45'),_0x4f327c['uniqueid']),_0x5be871);}};exports['newexten']=function(_0x2028f1){try{if(!_[_0xd13a('0x1d')](channels[_0x2028f1['uniqueid']])){utils[_0xd13a('0x14')](util[_0xd13a('0x6')](_0xd13a('0x5a'),_0x2028f1[_0xd13a('0x12')]),_0x2028f1);utils['info'](util[_0xd13a('0x6')](_0xd13a('0x5b'),_0x2028f1['uniqueid'],_0x2028f1[_0xd13a('0x5c')],_0x2028f1['appdata']));if(_0x2028f1[_0xd13a('0x5c')][_0xd13a('0x5d')]()==_0xd13a('0x5e')&&_[_0xd13a('0x5f')](_0x2028f1['appdata'][_0xd13a('0x5d')](),_0xd13a('0x60'))){var _0x578e69=_0x2028f1['appdata']['split']('=');var _0x2b7940=_0x578e69[0x0][_0xd13a('0x61')](_0x578e69[0x0][_0xd13a('0x62')]('(')+0x1,_0x578e69[0x0][_0xd13a('0x62')](')'));var _0x44c896=_0x578e69[0x1];channels[_0x2028f1[_0xd13a('0x12')]][_0x2b7940]=_0x44c896;}if(!_[_0xd13a('0x63')]([_0xd13a('0x2a'),_0xd13a('0x64'),'execif',_0xd13a('0x5e'),_0xd13a('0x65')],_0x2028f1[_0xd13a('0x5c')][_0xd13a('0x5d')]())){channels[_0x2028f1[_0xd13a('0x12')]][_0xd13a('0x66')]=_0x2028f1[_0xd13a('0x5c')];channels[_0x2028f1[_0xd13a('0x12')]][_0xd13a('0x67')]=_0x2028f1[_0xd13a('0x68')];}}}catch(_0x51ca65){utils[_0xd13a('0x1c')](util['format'](_0xd13a('0x5a'),_0x2028f1['uniqueid']),_0x51ca65);}}; \ No newline at end of file +var _0x80ba=['calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','starttime','billableseconds','attendedtransfer','localtwolinkedid','[%s][calls][attendedtransfer]','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','transfertargetchannel','origtransfererchannel','userfield','_attended','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][musiconholdstop]','varset','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-callerid-preview','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','[%s][calls][varset]','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','substring','lastIndexOf','includes','lodash','util','./utils','NO\x20ANSWER','ANSWERED','BUSY','FAILED','info','format','uniqueid','queue','membername','interface','calleridnum','connectedlinenum','accountcode','getUserByInternal','then','UserId','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','channel','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','context','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','linkedid','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','destinationchannel','answertime','disposition','hangup','[%s][calls][hangup]','callerid'];(function(_0x3a58ec,_0x4205bb){var _0x2e0660=function(_0x23d07c){while(--_0x23d07c){_0x3a58ec['push'](_0x3a58ec['shift']());}};_0x2e0660(++_0x4205bb);}(_0x80ba,0xb1));var _0xa80b=function(_0x6192b2,_0x1cfb6d){_0x6192b2=_0x6192b2-0x0;var _0x358ea6=_0x80ba[_0x6192b2];return _0x358ea6;};'use strict';var _=require(_0xa80b('0x0'));var util=require(_0xa80b('0x1'));var utils=require(_0xa80b('0x2'));var dispositions=[_0xa80b('0x3'),'FAILED','FAILED',_0xa80b('0x3'),_0xa80b('0x3'),_0xa80b('0x3'),_0xa80b('0x4'),_0xa80b('0x5'),_0xa80b('0x6'),_0xa80b('0x6'),'FAILED'];var channels={};function writeDB(_0x30dec6){utils[_0xa80b('0x7')](util[_0xa80b('0x8')]('[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x30dec6[_0xa80b('0x9')],_0x30dec6['channel'],_0x30dec6[_0xa80b('0xa')],_0x30dec6[_0xa80b('0xb')],_0x30dec6[_0xa80b('0xc')],_0x30dec6[_0xa80b('0xd')],_0x30dec6[_0xa80b('0xe')],_0x30dec6['lastevent']));if(_0x30dec6[_0xa80b('0xf')]){utils[_0xa80b('0x10')](_0x30dec6[_0xa80b('0xf')])[_0xa80b('0x11')](function(_0xb9cdec){if(_0xb9cdec){_0x30dec6[_0xa80b('0x12')]=_0xb9cdec['id'];}utils[_0xa80b('0x13')](_0xa80b('0x14'),_0x30dec6);});}else{utils[_0xa80b('0x13')]('CreateVoiceCallReport',_0x30dec6);}if(channels[_0x30dec6[_0xa80b('0x9')]]){delete channels[_0x30dec6['uniqueid']];}}exports[_0xa80b('0x15')]=function(_0x195301){try{utils[_0xa80b('0x16')](util[_0xa80b('0x8')](_0xa80b('0x17'),_0x195301[_0xa80b('0x9')]),_0x195301);if(_0x195301[_0xa80b('0x9')]==_0x195301['linkedid']&&_0x195301[_0xa80b('0x18')]!='OutgoingSpoolFailed'){utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x19'),_0x195301['uniqueid'],_0x195301['context'],_0x195301['exten']));channels[_0x195301[_0xa80b('0x9')]]={'uniqueid':_0x195301[_0xa80b('0x9')],'accountcode':_0x195301[_0xa80b('0xf')],'source':_0x195301[_0xa80b('0xd')],'destination':_0x195301[_0xa80b('0x1a')],'destinationcontext':_0x195301[_0xa80b('0x1b')],'channel':_0x195301['channel'],'starttime':utils[_0xa80b('0x1c')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xa80b('0x3'),'amaflags':_0xa80b('0x1d')};}}catch(_0x4c2f77){utils[_0xa80b('0x1e')](util[_0xa80b('0x8')]('[%s][calls][newchannel]',_0x195301['uniqueid']),_0x4c2f77);}};exports[_0xa80b('0x1f')]=function(_0x103ba8){try{utils[_0xa80b('0x16')](util[_0xa80b('0x8')](_0xa80b('0x20'),_0x103ba8[_0xa80b('0x9')]),_0x103ba8);if(!_[_0xa80b('0x21')](channels[_0x103ba8[_0xa80b('0x9')]])&&_0x103ba8[_0xa80b('0x22')]==0x6){utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x23'),_0x103ba8['uniqueid'],_0x103ba8[_0xa80b('0x1b')],_0x103ba8['channel']));if(_[_0xa80b('0x21')](channels[_0x103ba8['uniqueid']][_0xa80b('0x24')])){channels[_0x103ba8[_0xa80b('0x9')]]['systemanswertime']=utils[_0xa80b('0x1c')]();}}else if(!_[_0xa80b('0x21')](channels[_0x103ba8[_0xa80b('0x25')]])&&_0x103ba8['channelstate']==0x6&&_0x103ba8[_0xa80b('0x1b')]!='transfer'){utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x26'),_0x103ba8[_0xa80b('0x9')],_0x103ba8['linkedid'],_0x103ba8['context'],_0x103ba8[_0xa80b('0x18')]));channels[_0x103ba8[_0xa80b('0x25')]][_0xa80b('0xf')]=_0x103ba8['accountcode'];channels[_0x103ba8[_0xa80b('0x25')]][_0xa80b('0x27')]=_0x103ba8[_0xa80b('0x18')];if(_[_0xa80b('0x21')](channels[_0x103ba8[_0xa80b('0x25')]][_0xa80b('0x28')])){channels[_0x103ba8[_0xa80b('0x25')]][_0xa80b('0x28')]=utils[_0xa80b('0x1c')]();}channels[_0x103ba8[_0xa80b('0x25')]][_0xa80b('0x29')]=dispositions[_['toNumber'](_0x103ba8['channelstate'])]||'ANSWERED';}}catch(_0x1c17af){utils[_0xa80b('0x1e')](util[_0xa80b('0x8')]('[%s][calls][newstate]',_0x103ba8[_0xa80b('0x9')]),_0x1c17af);}};exports[_0xa80b('0x2a')]=function(_0x5df910){try{if(!_[_0xa80b('0x21')](channels[_0x5df910['uniqueid']])){utils[_0xa80b('0x16')](util[_0xa80b('0x8')](_0xa80b('0x2b'),_0x5df910[_0xa80b('0x9')]),_0x5df910);if(_['isNil'](channels[_0x5df910[_0xa80b('0x9')]][_0xa80b('0x2c')])){channels[_0x5df910['uniqueid']][_0xa80b('0x2c')]=_0x5df910[_0xa80b('0x2d')]+'\x20<'+_0x5df910[_0xa80b('0xd')]+'>';}utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x2e'),_0x5df910['uniqueid'],channels[_0x5df910[_0xa80b('0x9')]][_0xa80b('0x2c')],_0x5df910[_0xa80b('0x2f')]));channels[_0x5df910[_0xa80b('0x9')]][_0xa80b('0x30')]=utils['now']();channels[_0x5df910['uniqueid']][_0xa80b('0x31')]=utils[_0xa80b('0x32')](channels[_0x5df910['uniqueid']][_0xa80b('0x30')],channels[_0x5df910[_0xa80b('0x9')]][_0xa80b('0x33')]);channels[_0x5df910[_0xa80b('0x9')]][_0xa80b('0x34')]=channels[_0x5df910['uniqueid']][_0xa80b('0x28')]?utils[_0xa80b('0x32')](channels[_0x5df910[_0xa80b('0x9')]][_0xa80b('0x30')],channels[_0x5df910['uniqueid']][_0xa80b('0x28')]):0x0;writeDB(channels[_0x5df910[_0xa80b('0x9')]]);}}catch(_0x96d912){utils[_0xa80b('0x1e')](util[_0xa80b('0x8')]('[%s][calls][hangup]',_0x5df910[_0xa80b('0x9')]),_0x96d912);}};exports[_0xa80b('0x35')]=function(_0x4d599f){try{if(!_[_0xa80b('0x21')](channels[_0x4d599f[_0xa80b('0x36')]])){utils[_0xa80b('0x16')](util[_0xa80b('0x8')](_0xa80b('0x37'),_0x4d599f[_0xa80b('0x38')]),_0x4d599f);if(channels[_0x4d599f[_0xa80b('0x36')]][_0xa80b('0x18')]==_0x4d599f[_0xa80b('0x39')]){utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x3a'),_0x4d599f[_0xa80b('0x38')],_0x4d599f[_0xa80b('0x36')],_0x4d599f[_0xa80b('0x3b')]));channels[_0x4d599f[_0xa80b('0x36')]][_0xa80b('0x27')]=_0x4d599f[_0xa80b('0x3b')];channels[_0x4d599f[_0xa80b('0x36')]]['userfield']='_attended';}else if(channels[_0x4d599f['localtwolinkedid']][_0xa80b('0x18')]=_0x4d599f[_0xa80b('0x3c')]){utils[_0xa80b('0x7')](util[_0xa80b('0x8')]('[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s',_0x4d599f[_0xa80b('0x38')],_0x4d599f[_0xa80b('0x36')],_0x4d599f[_0xa80b('0x3d')]));channels[_0x4d599f[_0xa80b('0x36')]]['destinationchannel']=_0x4d599f[_0xa80b('0x3d')];channels[_0x4d599f[_0xa80b('0x36')]][_0xa80b('0x3e')]=_0xa80b('0x3f');}}}catch(_0x5c772d){utils[_0xa80b('0x1e')](util[_0xa80b('0x8')](_0xa80b('0x37'),_0x4d599f[_0xa80b('0x38')]),_0x5c772d);}};exports['musiconholdstart']=function(_0x3e9dd1){try{if(!_['isNil'](channels[_0x3e9dd1[_0xa80b('0x9')]])){utils[_0xa80b('0x16')](util[_0xa80b('0x8')](_0xa80b('0x40'),_0x3e9dd1[_0xa80b('0x9')]),_0x3e9dd1);channels[_0x3e9dd1['uniqueid']]['musiconholdstartAt']=utils['now']();utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x41'),_0x3e9dd1[_0xa80b('0x9')],channels[_0x3e9dd1[_0xa80b('0x9')]][_0xa80b('0x42')]));}}catch(_0x4d6e3f){utils[_0xa80b('0x1e')](util['format'](_0xa80b('0x40'),_0x3e9dd1['uniqueid']),_0x4d6e3f);}};exports[_0xa80b('0x43')]=function(_0x40156c){try{if(!_[_0xa80b('0x21')](channels[_0x40156c[_0xa80b('0x9')]])){utils['debug'](util[_0xa80b('0x8')]('[%s][calls][musiconholdstop]',_0x40156c[_0xa80b('0x9')]),_0x40156c);if(!_[_0xa80b('0x21')](channels[_0x40156c[_0xa80b('0x9')]][_0xa80b('0x42')])){channels[_0x40156c[_0xa80b('0x9')]][_0xa80b('0x44')]+=utils[_0xa80b('0x32')](utils[_0xa80b('0x1c')](),channels[_0x40156c[_0xa80b('0x9')]][_0xa80b('0x42')]);utils['info'](util[_0xa80b('0x8')](_0xa80b('0x45'),_0x40156c[_0xa80b('0x9')],channels[_0x40156c[_0xa80b('0x9')]][_0xa80b('0x44')]));delete channels[_0x40156c['uniqueid']][_0xa80b('0x42')];}}}catch(_0x4681a6){utils['error'](util[_0xa80b('0x8')](_0xa80b('0x46'),_0x40156c['uniqueid']),_0x4681a6);}};exports[_0xa80b('0x47')]=function(_0x665720){try{if(!_[_0xa80b('0x21')](channels[_0x665720[_0xa80b('0x9')]])){utils['debug'](util[_0xa80b('0x8')]('[%s][calls][varset]',_0x665720[_0xa80b('0x9')]),_0x665720);if(!_[_0xa80b('0x21')](_0x665720['variable']['xmd-originatecalleridnum'])){utils['info'](util[_0xa80b('0x8')](_0xa80b('0x48'),_0x665720['uniqueid'],_0x665720[_0xa80b('0x49')]));channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0x4a')]=_0x665720['value'];}if(!_[_0xa80b('0x21')](_0x665720[_0xa80b('0x4b')][_0xa80b('0x4c')])){utils[_0xa80b('0x7')](util['format'](_0xa80b('0x4d'),_0x665720['uniqueid'],_0x665720[_0xa80b('0x49')]));channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0x4e')]=_0x665720[_0xa80b('0x49')];channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0x2c')]='\x22'+_0x665720[_0xa80b('0x49')]+'\x22\x20<'+_0x665720['value']+'>';}if(!_[_0xa80b('0x21')](_0x665720[_0xa80b('0x4b')]['xmd-callerid-preview'])||!_['isNil'](_0x665720['variable'][_0xa80b('0x4f')])){utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x50'),_0x665720[_0xa80b('0x9')],!_[_0xa80b('0x21')](_0x665720[_0xa80b('0x4b')][_0xa80b('0x51')])?_0xa80b('0x51'):_0xa80b('0x4f'),_0x665720['value']));channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0x2c')]=_0x665720[_0xa80b('0x49')];}if(!_['isNil'](_0x665720[_0xa80b('0x4b')][_0xa80b('0x52')])||!_['isNil'](_0x665720['variable'][_0xa80b('0x53')])){utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x50'),_0x665720[_0xa80b('0x9')],!_[_0xa80b('0x21')](_0x665720[_0xa80b('0x4b')][_0xa80b('0x52')])?'xmd-queue':_0xa80b('0x53'),_0x665720[_0xa80b('0x49')]));channels[_0x665720['uniqueid']][_0xa80b('0x54')]=_0xa80b('0x55');channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0x56')]=_0x665720[_0xa80b('0x49')];channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0xa')]=!![];}if(!_[_0xa80b('0x21')](_0x665720['variable'][_0xa80b('0x57')])){utils[_0xa80b('0x7')](util['format'](_0xa80b('0x58'),_0x665720[_0xa80b('0x9')],_0x665720['value']));channels[_0x665720['uniqueid']][_0xa80b('0x59')]=_0x665720['value'];}if(!_['isNil'](_0x665720[_0xa80b('0x4b')][_0xa80b('0x5a')])){utils['info'](util[_0xa80b('0x8')](_0xa80b('0x5b'),_0x665720['uniqueid'],_0x665720[_0xa80b('0x49')]));channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0x5c')]=_0x665720[_0xa80b('0x49')];}if(!_[_0xa80b('0x21')](_0x665720[_0xa80b('0x4b')][_0xa80b('0x5d')])){utils[_0xa80b('0x7')](util[_0xa80b('0x8')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x665720[_0xa80b('0x9')],_0x665720[_0xa80b('0x49')]));channels[_0x665720[_0xa80b('0x9')]][_0xa80b('0x5e')]=_0x665720[_0xa80b('0x49')];}if(!_['isNil'](_0x665720[_0xa80b('0x4b')][_0xa80b('0x5f')])){utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x60'),_0x665720[_0xa80b('0x9')],_0x665720[_0xa80b('0x49')]));channels[_0x665720['uniqueid']][_0xa80b('0x5f')]=_0x665720[_0xa80b('0x49')];}}}catch(_0x4a6634){utils['error'](util[_0xa80b('0x8')](_0xa80b('0x61'),_0x665720[_0xa80b('0x9')]),_0x4a6634);}};exports[_0xa80b('0x62')]=function(_0x143b65){try{if(!_[_0xa80b('0x21')](channels[_0x143b65[_0xa80b('0x9')]])){utils[_0xa80b('0x16')](util[_0xa80b('0x8')](_0xa80b('0x63'),_0x143b65['uniqueid']),_0x143b65);utils[_0xa80b('0x7')](util[_0xa80b('0x8')](_0xa80b('0x64'),_0x143b65['uniqueid'],_0x143b65[_0xa80b('0x65')],_0x143b65[_0xa80b('0x66')]));if(_0x143b65[_0xa80b('0x65')][_0xa80b('0x67')]()==_0xa80b('0x68')&&_[_0xa80b('0x69')](_0x143b65['appdata'][_0xa80b('0x67')](),_0xa80b('0x6a'))){var _0xb15891=_0x143b65[_0xa80b('0x66')][_0xa80b('0x6b')]('=');var _0x1177b6=_0xb15891[0x0][_0xa80b('0x6c')](_0xb15891[0x0][_0xa80b('0x6d')]('(')+0x1,_0xb15891[0x0]['lastIndexOf'](')'));var _0x1ab2fe=_0xb15891[0x1];channels[_0x143b65['uniqueid']][_0x1177b6]=_0x1ab2fe;}if(!_[_0xa80b('0x6e')](['hangup','noop','execif',_0xa80b('0x68'),'gotoif'],_0x143b65[_0xa80b('0x65')]['toLowerCase']())){channels[_0x143b65[_0xa80b('0x9')]][_0xa80b('0x54')]=_0x143b65['application'];channels[_0x143b65['uniqueid']]['lastdata']=_0x143b65['appdata'];}}}catch(_0x433338){utils[_0xa80b('0x1e')](util[_0xa80b('0x8')](_0xa80b('0x63'),_0x143b65[_0xa80b('0x9')]),_0x433338);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 52c5a80..c45070a 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 _0x1f4f=['info','[core]\x20connected','shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','managerevent','./utils','connect'];(function(_0x16acb7,_0x23f034){var _0x39bf39=function(_0x21281e){while(--_0x21281e){_0x16acb7['push'](_0x16acb7['shift']());}};_0x39bf39(++_0x23f034);}(_0x1f4f,0x1d7));var _0xf1f4=function(_0x46d54d,_0x105c39){_0x46d54d=_0x46d54d-0x0;var _0x5a8e5a=_0x1f4f[_0x46d54d];return _0x5a8e5a;};'use strict';var utils=require(_0xf1f4('0x0'));exports[_0xf1f4('0x1')]=function(){utils[_0xf1f4('0x2')](_0xf1f4('0x3'));};exports[_0xf1f4('0x4')]=function(){utils[_0xf1f4('0x2')]('[core]\x20shutdown');};exports[_0xf1f4('0x5')]=function(){utils[_0xf1f4('0x2')](_0xf1f4('0x6'));};exports[_0xf1f4('0x7')]=function(_0x35917d){utils['error'](_0xf1f4('0x8'),_0x35917d);};exports[_0xf1f4('0x9')]=function(){utils['info']('[core]\x20close');};exports[_0xf1f4('0xa')]=function(_0x5a433c){}; \ No newline at end of file +var _0x0b0a=['close','[core]\x20close','managerevent','connect','info','[core]\x20connected','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','[core]\x20error'];(function(_0x1d007b,_0x2948d8){var _0x12a361=function(_0x574d97){while(--_0x574d97){_0x1d007b['push'](_0x1d007b['shift']());}};_0x12a361(++_0x2948d8);}(_0x0b0a,0xb7));var _0xa0b0=function(_0x49d6ba,_0x3a04d2){_0x49d6ba=_0x49d6ba-0x0;var _0x21202b=_0x0b0a[_0x49d6ba];return _0x21202b;};'use strict';var utils=require('./utils');exports[_0xa0b0('0x0')]=function(){utils[_0xa0b0('0x1')](_0xa0b0('0x2'));};exports['shutdown']=function(){utils['info'](_0xa0b0('0x3'));};exports[_0xa0b0('0x4')]=function(){utils[_0xa0b0('0x1')](_0xa0b0('0x5'));};exports['error']=function(_0x236984){utils['error'](_0xa0b0('0x6'),_0x236984);};exports[_0xa0b0('0x7')]=function(){utils[_0xa0b0('0x1')](_0xa0b0('0x8'));};exports[_0xa0b0('0x9')]=function(_0x1b982d){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 3d83f7a..df3313a 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 _0xc546=['starttime','[%s][dials][dialbegin]','dialend','[%s][dials][dialend]','dialstatus','answertime','lastevent','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','cause-txt','complete','duration','diffTime','endtime','holdtime','lodash','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','outboundrouteid','value','assign','now','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called'];(function(_0x546a31,_0x49f1d7){var _0x3c2f19=function(_0x2cf5ae){while(--_0x2cf5ae){_0x546a31['push'](_0x546a31['shift']());}};_0x3c2f19(++_0x49f1d7);}(_0xc546,0x169));var _0x6c54=function(_0x1c98c4,_0x52f5f9){_0x1c98c4=_0x1c98c4-0x0;var _0x4ccfe5=_0xc546[_0x1c98c4];return _0x4ccfe5;};'use strict';var _=require(_0x6c54('0x0'));var util=require('util');var utils=require(_0x6c54('0x1'));var dials={};function writeDB(_0x25d53e){utils[_0x6c54('0x2')](util[_0x6c54('0x3')](_0x6c54('0x4'),_0x25d53e[_0x6c54('0x5')],_0x25d53e[_0x6c54('0x6')],_0x25d53e[_0x6c54('0x7')],_0x25d53e['calleridnum'],_0x25d53e[_0x6c54('0x8')],_0x25d53e['dialstatus']));utils[_0x6c54('0x9')](_0x6c54('0xa'),_0x25d53e);delete dials[_0x25d53e[_0x6c54('0x5')]];}exports[_0x6c54('0xb')]=function(_0x47de9f){try{utils[_0x6c54('0xc')](util[_0x6c54('0x3')](_0x6c54('0xd'),_0x47de9f[_0x6c54('0x5')]),_0x47de9f);utils[_0x6c54('0x2')](util[_0x6c54('0x3')](_0x6c54('0xe'),_0x47de9f[_0x6c54('0x5')],_0x47de9f[_0x6c54('0xf')],_0x47de9f[_0x6c54('0x10')]));if(_0x47de9f['application'][_0x6c54('0x11')]()=='set'&&_[_0x6c54('0x12')](_0x47de9f[_0x6c54('0x10')][_0x6c54('0x11')](),_0x6c54('0x13'))){var _0x5e851b=_0x47de9f[_0x6c54('0x10')][_0x6c54('0x14')]('=');dials[_0x47de9f[_0x6c54('0x5')]]={'routeId':_0x5e851b[0x1]};}}catch(_0x459bcf){utils[_0x6c54('0x15')](util['format'](_0x6c54('0xd'),_0x47de9f['uniqueid']),_0x459bcf);}};exports[_0x6c54('0x16')]=function(_0x358e19){try{utils[_0x6c54('0xc')](util[_0x6c54('0x3')](_0x6c54('0x17'),_0x358e19[_0x6c54('0x5')]),_0x358e19);if(!_[_0x6c54('0x18')](_0x358e19['variable'][_0x6c54('0x19')])){utils['info'](util[_0x6c54('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x358e19[_0x6c54('0x5')],_0x358e19[_0x6c54('0x1a')]));dials[_0x358e19[_0x6c54('0x5')]]={'routeId':_0x358e19['value']};}}catch(_0x278f3e){utils[_0x6c54('0x15')](util['format'](_0x6c54('0x17'),_0x358e19[_0x6c54('0x5')]),_0x278f3e);}};exports['dialbegin']=function(_0x4683c6){try{if(!_[_0x6c54('0x18')](dials[_0x4683c6['uniqueid']])){utils[_0x6c54('0xc')](util[_0x6c54('0x3')]('[%s][dials][dialbegin]',_0x4683c6[_0x6c54('0x5')]),_0x4683c6);dials[_0x4683c6[_0x6c54('0x5')]]=_[_0x6c54('0x1b')](dials[_0x4683c6[_0x6c54('0x5')]],_0x4683c6);dials[_0x4683c6[_0x6c54('0x5')]]['starttime']=utils[_0x6c54('0x1c')]();dials[_0x4683c6[_0x6c54('0x5')]]['lastevent']=_0x6c54('0x1d');utils['info'](util[_0x6c54('0x3')](_0x6c54('0x1e'),_0x4683c6[_0x6c54('0x5')],dials[_0x4683c6['uniqueid']][_0x6c54('0x1f')]));}}catch(_0x3e01aa){utils[_0x6c54('0x15')](util[_0x6c54('0x3')](_0x6c54('0x20'),_0x4683c6[_0x6c54('0x5')]),_0x3e01aa);}};exports[_0x6c54('0x21')]=function(_0x4ed1a5){try{if(!_[_0x6c54('0x18')](dials[_0x4ed1a5[_0x6c54('0x5')]])){utils[_0x6c54('0xc')](util[_0x6c54('0x3')](_0x6c54('0x22'),_0x4ed1a5[_0x6c54('0x5')]),_0x4ed1a5);dials[_0x4ed1a5[_0x6c54('0x5')]]['dialstatus']=_0x4ed1a5['dialstatus'];if(_0x4ed1a5[_0x6c54('0x23')]=='ANSWER'){dials[_0x4ed1a5[_0x6c54('0x5')]]=_[_0x6c54('0x1b')](dials[_0x4ed1a5[_0x6c54('0x5')]],_0x4ed1a5);dials[_0x4ed1a5[_0x6c54('0x5')]][_0x6c54('0x24')]=utils['now']();dials[_0x4ed1a5[_0x6c54('0x5')]][_0x6c54('0x25')]=_0x6c54('0x26');utils[_0x6c54('0x2')](util[_0x6c54('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x4ed1a5[_0x6c54('0x5')],_0x4ed1a5['dialstatus'],dials[_0x4ed1a5[_0x6c54('0x5')]]['answertime']));}else{utils[_0x6c54('0x2')](util[_0x6c54('0x3')](_0x6c54('0x27'),_0x4ed1a5[_0x6c54('0x5')],_0x4ed1a5[_0x6c54('0x23')]));}}}catch(_0x3c4048){utils[_0x6c54('0x15')](util['format'](_0x6c54('0x22'),_0x4ed1a5[_0x6c54('0x5')]),_0x3c4048);}};exports['hangup']=function(_0x2b51ac){try{if(!_[_0x6c54('0x18')](dials[_0x2b51ac['uniqueid']])){utils['debug'](util[_0x6c54('0x3')](_0x6c54('0x28'),_0x2b51ac[_0x6c54('0x5')]),_0x2b51ac);utils[_0x6c54('0x2')](util[_0x6c54('0x3')](_0x6c54('0x29'),_0x2b51ac[_0x6c54('0x5')],_0x2b51ac[_0x6c54('0x2a')],_0x2b51ac['calleridname'],_0x2b51ac[_0x6c54('0x2b')]));dials[_0x2b51ac['uniqueid']]=_[_0x6c54('0x1b')](dials[_0x2b51ac[_0x6c54('0x5')]],{'endtime':utils[_0x6c54('0x1c')](),'lastevent':_0x6c54('0x2c')});dials[_0x2b51ac[_0x6c54('0x5')]][_0x6c54('0x2d')]=utils[_0x6c54('0x2e')](dials[_0x2b51ac[_0x6c54('0x5')]][_0x6c54('0x2f')],dials[_0x2b51ac[_0x6c54('0x5')]][_0x6c54('0x1f')]);dials[_0x2b51ac['uniqueid']][_0x6c54('0x30')]=utils[_0x6c54('0x2e')](dials[_0x2b51ac['uniqueid']][_0x6c54('0x24')]||dials[_0x2b51ac[_0x6c54('0x5')]][_0x6c54('0x2f')],dials[_0x2b51ac[_0x6c54('0x5')]]['starttime']);dials[_0x2b51ac['uniqueid']]['billableseconds']=dials[_0x2b51ac[_0x6c54('0x5')]][_0x6c54('0x24')]?utils[_0x6c54('0x2e')](dials[_0x2b51ac[_0x6c54('0x5')]][_0x6c54('0x2f')],dials[_0x2b51ac[_0x6c54('0x5')]][_0x6c54('0x24')]):0x0;writeDB(dials[_0x2b51ac[_0x6c54('0x5')]]);}}catch(_0xf29472){utils[_0x6c54('0x15')](util['format'](_0x6c54('0x28'),_0x2b51ac[_0x6c54('0x5')]),_0xf29472);}}; \ No newline at end of file +var _0x5c75=['cdr(routeid)','split','error','varset','debug','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','[%s][dials][varset]','dialbegin','[%s][dials][dialbegin]','now','lastevent','called','starttime','dialend','[%s][dials][dialend]','ANSWER','assign','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','answertime','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','cause-txt','duration','diffTime','endtime','holdtime','info','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','format','[%s][dials][newexten]','application','toLowerCase','set','startsWith','appdata'];(function(_0x1ab758,_0x3dbede){var _0x5788a0=function(_0x324d24){while(--_0x324d24){_0x1ab758['push'](_0x1ab758['shift']());}};_0x5788a0(++_0x3dbede);}(_0x5c75,0x1cf));var _0x55c7=function(_0x471d6a,_0x56e87c){_0x471d6a=_0x471d6a-0x0;var _0x5e837e=_0x5c75[_0x471d6a];return _0x5e837e;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var dials={};function writeDB(_0x136ef2){utils[_0x55c7('0x0')](util['format'](_0x55c7('0x1'),_0x136ef2['uniqueid'],_0x136ef2[_0x55c7('0x2')],_0x136ef2[_0x55c7('0x3')],_0x136ef2[_0x55c7('0x4')],_0x136ef2[_0x55c7('0x5')],_0x136ef2[_0x55c7('0x6')]));utils[_0x55c7('0x7')](_0x55c7('0x8'),_0x136ef2);delete dials[_0x136ef2[_0x55c7('0x9')]];}exports['newexten']=function(_0x455f58){try{utils['debug'](util[_0x55c7('0xa')](_0x55c7('0xb'),_0x455f58[_0x55c7('0x9')]),_0x455f58);utils[_0x55c7('0x0')](util['format']('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x455f58['uniqueid'],_0x455f58[_0x55c7('0xc')],_0x455f58['appdata']));if(_0x455f58[_0x55c7('0xc')][_0x55c7('0xd')]()==_0x55c7('0xe')&&_[_0x55c7('0xf')](_0x455f58[_0x55c7('0x10')][_0x55c7('0xd')](),_0x55c7('0x11'))){var _0x2aee68=_0x455f58[_0x55c7('0x10')][_0x55c7('0x12')]('=');dials[_0x455f58[_0x55c7('0x9')]]={'routeId':_0x2aee68[0x1]};}}catch(_0x1ad7ee){utils[_0x55c7('0x13')](util[_0x55c7('0xa')]('[%s][dials][newexten]',_0x455f58['uniqueid']),_0x1ad7ee);}};exports[_0x55c7('0x14')]=function(_0x1a32e5){try{utils[_0x55c7('0x15')](util[_0x55c7('0xa')]('[%s][dials][varset]',_0x1a32e5[_0x55c7('0x9')]),_0x1a32e5);if(!_[_0x55c7('0x16')](_0x1a32e5[_0x55c7('0x17')][_0x55c7('0x18')])){utils['info'](util[_0x55c7('0xa')](_0x55c7('0x19'),_0x1a32e5[_0x55c7('0x9')],_0x1a32e5[_0x55c7('0x1a')]));dials[_0x1a32e5['uniqueid']]={'routeId':_0x1a32e5['value']};}}catch(_0x4f1d96){utils[_0x55c7('0x13')](util[_0x55c7('0xa')](_0x55c7('0x1b'),_0x1a32e5[_0x55c7('0x9')]),_0x4f1d96);}};exports[_0x55c7('0x1c')]=function(_0x362833){try{if(!_['isNil'](dials[_0x362833[_0x55c7('0x9')]])){utils[_0x55c7('0x15')](util[_0x55c7('0xa')](_0x55c7('0x1d'),_0x362833['uniqueid']),_0x362833);dials[_0x362833[_0x55c7('0x9')]]=_['assign'](dials[_0x362833[_0x55c7('0x9')]],_0x362833);dials[_0x362833['uniqueid']]['starttime']=utils[_0x55c7('0x1e')]();dials[_0x362833[_0x55c7('0x9')]][_0x55c7('0x1f')]=_0x55c7('0x20');utils[_0x55c7('0x0')](util[_0x55c7('0xa')]('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x362833['uniqueid'],dials[_0x362833['uniqueid']][_0x55c7('0x21')]));}}catch(_0x1de171){utils[_0x55c7('0x13')](util[_0x55c7('0xa')]('[%s][dials][dialbegin]',_0x362833[_0x55c7('0x9')]),_0x1de171);}};exports[_0x55c7('0x22')]=function(_0x2b24e3){try{if(!_[_0x55c7('0x16')](dials[_0x2b24e3[_0x55c7('0x9')]])){utils[_0x55c7('0x15')](util[_0x55c7('0xa')](_0x55c7('0x23'),_0x2b24e3[_0x55c7('0x9')]),_0x2b24e3);dials[_0x2b24e3[_0x55c7('0x9')]][_0x55c7('0x6')]=_0x2b24e3[_0x55c7('0x6')];if(_0x2b24e3['dialstatus']==_0x55c7('0x24')){dials[_0x2b24e3[_0x55c7('0x9')]]=_[_0x55c7('0x25')](dials[_0x2b24e3['uniqueid']],_0x2b24e3);dials[_0x2b24e3['uniqueid']]['answertime']=utils[_0x55c7('0x1e')]();dials[_0x2b24e3[_0x55c7('0x9')]][_0x55c7('0x1f')]=_0x55c7('0x26');utils['info'](util[_0x55c7('0xa')](_0x55c7('0x27'),_0x2b24e3[_0x55c7('0x9')],_0x2b24e3[_0x55c7('0x6')],dials[_0x2b24e3[_0x55c7('0x9')]][_0x55c7('0x28')]));}else{utils[_0x55c7('0x0')](util[_0x55c7('0xa')]('[%s][dials][dialend]\x20dialstatus:%s',_0x2b24e3[_0x55c7('0x9')],_0x2b24e3[_0x55c7('0x6')]));}}}catch(_0x2988b7){utils['error'](util[_0x55c7('0xa')]('[%s][dials][dialend]',_0x2b24e3[_0x55c7('0x9')]),_0x2988b7);}};exports['hangup']=function(_0x557d61){try{if(!_[_0x55c7('0x16')](dials[_0x557d61[_0x55c7('0x9')]])){utils[_0x55c7('0x15')](util[_0x55c7('0xa')](_0x55c7('0x29'),_0x557d61['uniqueid']),_0x557d61);utils[_0x55c7('0x0')](util[_0x55c7('0xa')](_0x55c7('0x2a'),_0x557d61[_0x55c7('0x9')],_0x557d61[_0x55c7('0x4')],_0x557d61['calleridname'],_0x557d61[_0x55c7('0x2b')]));dials[_0x557d61['uniqueid']]=_[_0x55c7('0x25')](dials[_0x557d61[_0x55c7('0x9')]],{'endtime':utils[_0x55c7('0x1e')](),'lastevent':'complete'});dials[_0x557d61[_0x55c7('0x9')]][_0x55c7('0x2c')]=utils[_0x55c7('0x2d')](dials[_0x557d61[_0x55c7('0x9')]][_0x55c7('0x2e')],dials[_0x557d61[_0x55c7('0x9')]][_0x55c7('0x21')]);dials[_0x557d61['uniqueid']][_0x55c7('0x2f')]=utils['diffTime'](dials[_0x557d61[_0x55c7('0x9')]][_0x55c7('0x28')]||dials[_0x557d61[_0x55c7('0x9')]][_0x55c7('0x2e')],dials[_0x557d61[_0x55c7('0x9')]][_0x55c7('0x21')]);dials[_0x557d61[_0x55c7('0x9')]]['billableseconds']=dials[_0x557d61[_0x55c7('0x9')]]['answertime']?utils[_0x55c7('0x2d')](dials[_0x557d61[_0x55c7('0x9')]][_0x55c7('0x2e')],dials[_0x557d61['uniqueid']][_0x55c7('0x28')]):0x0;writeDB(dials[_0x557d61['uniqueid']]);}}catch(_0x354e40){utils['error'](util[_0x55c7('0xa')](_0x55c7('0x29'),_0x557d61[_0x55c7('0x9')]),_0x354e40);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 839b1e3..469aeff 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 _0x0a48=['attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','[%s][index][newchannel]','newchannel','dialbegin','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','util','xdr','disabled','production','local','port','asterisk','username','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./recordings.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','queuecallerleave','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]'];(function(_0x2062ba,_0x3b1f1a){var _0x2de719=function(_0x49f485){while(--_0x49f485){_0x2062ba['push'](_0x2062ba['shift']());}};_0x2de719(++_0x3b1f1a);}(_0x0a48,0x95));var _0x80a4=function(_0x5d275e,_0x3c595b){_0x5d275e=_0x5d275e-0x0;var _0x3462e1=_0x0a48[_0x5d275e];return _0x3462e1;};var AsteriskManager=require(_0x80a4('0x0'));var config=require(_0x80a4('0x1'));var utils=require('./utils');var util=require(_0x80a4('0x2'));var isXDREnabled=config[_0x80a4('0x3')]&&config[_0x80a4('0x3')][_0x80a4('0x4')]?!config[_0x80a4('0x3')]['disabled']:!![];var isProduction=config['env']===_0x80a4('0x5')||![];var isLocalAsterisk=config[_0x80a4('0x3')]&&config[_0x80a4('0x3')][_0x80a4('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x80a4('0x7')],config['asterisk']['ip'],config[_0x80a4('0x8')][_0x80a4('0x9')],config[_0x80a4('0x8')]['password'],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x80a4('0xa')](_0x80a4('0xb'));}else if(!isProduction&&!isLocalAsterisk){utils[_0x80a4('0xa')](_0x80a4('0xc'));}else{var agents=require('./agents.controller');var calls=require(_0x80a4('0xd'));var queues=require('./queues.controller');var recordings=require(_0x80a4('0xe'));var members=require('./members.controller');var dials=require(_0x80a4('0xf'));var transfers=require(_0x80a4('0x10'));var core=require('./core.controller');ami['on'](_0x80a4('0x11'),core[_0x80a4('0x11')]);ami['on'](_0x80a4('0x12'),core[_0x80a4('0x12')]);ami['on'](_0x80a4('0x13'),core[_0x80a4('0x13')]);ami['on'](_0x80a4('0x14'),core['error']);ami['on']('close',core[_0x80a4('0x15')]);ami['on'](_0x80a4('0x16'),core[_0x80a4('0x16')]);ami['on'](_0x80a4('0x17'),function(_0x55923c){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x1a'),_0x55923c[_0x80a4('0x1b')]),_0x55923c);members[_0x80a4('0x17')](_0x55923c);}catch(_0x2df8f1){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x1a'),_0x55923c[_0x80a4('0x1b')]),_0x2df8f1);}});ami['on'](_0x80a4('0x1c'),function(_0x23ac8b){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x1d'),_0x23ac8b['uniqueid']),_0x23ac8b);agents[_0x80a4('0x1c')](_0x23ac8b);}catch(_0x26c3d3){utils['error'](util[_0x80a4('0x19')](_0x80a4('0x1d'),_0x23ac8b['uniqueid']),_0x26c3d3);}});ami['on'](_0x80a4('0x1e'),function(_0x5b110c){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x1f'),_0x5b110c[_0x80a4('0x20')]),_0x5b110c);agents[_0x80a4('0x1e')](_0x5b110c);}catch(_0x88de42){utils[_0x80a4('0x14')](util[_0x80a4('0x19')]('[%s][index][agentringnoanswer]',_0x5b110c[_0x80a4('0x20')]),_0x88de42);}});ami['on'](_0x80a4('0x21'),function(_0x239ef6){try{utils['debug'](util['format'](_0x80a4('0x22'),_0x239ef6[_0x80a4('0x20')]),_0x239ef6);agents['agentconnect'](_0x239ef6);queues[_0x80a4('0x21')](_0x239ef6);}catch(_0x158ab2){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x22'),_0x239ef6[_0x80a4('0x20')]),_0x158ab2);}});ami['on'](_0x80a4('0x23'),function(_0x57822c){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x24'),_0x57822c[_0x80a4('0x20')]),_0x57822c);agents[_0x80a4('0x23')](_0x57822c);queues[_0x80a4('0x23')](_0x57822c);members[_0x80a4('0x23')](_0x57822c);}catch(_0x18fd40){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x24'),_0x57822c[_0x80a4('0x20')]),_0x18fd40);}});ami['on'](_0x80a4('0x25'),function(_0x5894b9){try{utils['debug'](util['format'](_0x80a4('0x26'),_0x5894b9[_0x80a4('0x20')]),_0x5894b9);agents[_0x80a4('0x25')](_0x5894b9);queues[_0x80a4('0x25')](_0x5894b9);}catch(_0x150031){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x26'),_0x5894b9[_0x80a4('0x20')]),_0x150031);}});ami['on'](_0x80a4('0x27'),function(_0x54958d){try{utils[_0x80a4('0x18')](util['format'](_0x80a4('0x28'),_0x54958d['uniqueid']),_0x54958d);queues[_0x80a4('0x27')](_0x54958d);recordings[_0x80a4('0x27')](_0x54958d);}catch(_0x190a1e){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x28'),_0x54958d[_0x80a4('0x20')]),_0x190a1e);}});ami['on']('queuecallerleave',function(_0x7e92fb){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x29'),_0x7e92fb[_0x80a4('0x20')]),_0x7e92fb);queues[_0x80a4('0x2a')](_0x7e92fb);}catch(_0x3143f1){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x29'),_0x7e92fb[_0x80a4('0x20')]),_0x3143f1);}});ami['on'](_0x80a4('0x2b'),function(_0x420d28){try{utils['debug'](util['format']('[%s][index][musiconholdstart]',_0x420d28[_0x80a4('0x20')]),_0x420d28);queues[_0x80a4('0x2b')](_0x420d28);calls[_0x80a4('0x2b')](_0x420d28);}catch(_0x54a34d){utils['error'](util[_0x80a4('0x19')](_0x80a4('0x2c'),_0x420d28['uniqueid']),_0x54a34d);}});ami['on']('musiconholdstop',function(_0xc5215){try{utils['debug'](util[_0x80a4('0x19')](_0x80a4('0x2d'),_0xc5215[_0x80a4('0x20')]),_0xc5215);queues[_0x80a4('0x2e')](_0xc5215);calls[_0x80a4('0x2e')](_0xc5215);}catch(_0x186d5a){utils[_0x80a4('0x14')](util[_0x80a4('0x19')]('[%s][index][musiconholdstop]',_0xc5215['uniqueid']),_0x186d5a);}});ami['on']('newstate',function(_0xe5495b){try{utils['debug'](util[_0x80a4('0x19')]('[%s][index][newstate]',_0xe5495b['uniqueid']),_0xe5495b);calls[_0x80a4('0x2f')](_0xe5495b);recordings[_0x80a4('0x2f')](_0xe5495b);}catch(_0x508d7e){utils['error'](util[_0x80a4('0x19')](_0x80a4('0x30'),_0xe5495b['uniqueid']),_0x508d7e);}});ami['on'](_0x80a4('0x31'),function(_0x571182){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x32'),_0x571182[_0x80a4('0x20')]),_0x571182);calls[_0x80a4('0x31')](_0x571182);recordings[_0x80a4('0x31')](_0x571182);dials[_0x80a4('0x31')](_0x571182);agents[_0x80a4('0x31')](_0x571182);queues[_0x80a4('0x31')](_0x571182);}catch(_0x58d71e){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x32'),_0x571182[_0x80a4('0x20')]),_0x58d71e);}});ami['on'](_0x80a4('0x33'),function(_0x3d1c2e){try{utils['debug'](util['format'](_0x80a4('0x34'),_0x3d1c2e[_0x80a4('0x20')]),_0x3d1c2e);members[_0x80a4('0x33')](_0x3d1c2e);}catch(_0x464a13){utils[_0x80a4('0x14')](util[_0x80a4('0x19')]('[%s][index][cdr]',_0x3d1c2e[_0x80a4('0x20')]),_0x464a13);}});ami['on'](_0x80a4('0x35'),function(_0x220974){try{utils[_0x80a4('0x18')](util['format'](_0x80a4('0x36'),_0x220974['uniqueid']),_0x220974);queues[_0x80a4('0x35')](_0x220974);agents[_0x80a4('0x35')](_0x220974);transfers[_0x80a4('0x35')](_0x220974);}catch(_0x38bb97){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x36'),_0x220974[_0x80a4('0x20')]),_0x38bb97);}});ami['on'](_0x80a4('0x37'),function(_0x26f9d4){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x38'),_0x26f9d4[_0x80a4('0x39')]),_0x26f9d4);queues['attendedtransfer'](_0x26f9d4);transfers[_0x80a4('0x37')](_0x26f9d4);agents[_0x80a4('0x37')](_0x26f9d4);calls[_0x80a4('0x37')](_0x26f9d4);}catch(_0x3d20e2){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x38'),_0x26f9d4[_0x80a4('0x39')]),_0x3d20e2);}});ami['on']('varset',function(_0x3c2450){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x3a'),_0x3c2450[_0x80a4('0x20')]),_0x3c2450);queues[_0x80a4('0x3b')](_0x3c2450);recordings['varset'](_0x3c2450);calls[_0x80a4('0x3b')](_0x3c2450);dials[_0x80a4('0x3b')](_0x3c2450);}catch(_0x25bfa1){utils[_0x80a4('0x14')](util['format'](_0x80a4('0x3a'),_0x3c2450[_0x80a4('0x20')]),_0x25bfa1);}});ami['on'](_0x80a4('0x3c'),function(_0x21807d){try{utils['debug'](util[_0x80a4('0x19')](_0x80a4('0x3d'),_0x21807d[_0x80a4('0x20')]),_0x21807d);calls[_0x80a4('0x3c')](_0x21807d);recordings['newexten'](_0x21807d);dials[_0x80a4('0x3c')](_0x21807d);}catch(_0x19c6ed){utils['error'](util[_0x80a4('0x19')]('[%s][index][newexten]',_0x21807d[_0x80a4('0x20')]),_0x19c6ed);}});ami['on']('newchannel',function(_0x8ab25f){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')](_0x80a4('0x3e'),_0x8ab25f['uniqueid']),_0x8ab25f);calls[_0x80a4('0x3f')](_0x8ab25f);recordings[_0x80a4('0x3f')](_0x8ab25f);}catch(_0x42f9d0){utils['error'](util[_0x80a4('0x19')](_0x80a4('0x3e'),_0x8ab25f[_0x80a4('0x20')]),_0x42f9d0);}});ami['on'](_0x80a4('0x40'),function(_0x3c3674){try{utils[_0x80a4('0x18')](util[_0x80a4('0x19')]('[%s][index][dialbegin]',_0x3c3674[_0x80a4('0x20')]),_0x3c3674);dials['dialbegin'](_0x3c3674);}catch(_0x12b03c){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x41'),_0x3c3674[_0x80a4('0x20')]),_0x12b03c);}});ami['on'](_0x80a4('0x42'),function(_0x308d3a){try{utils[_0x80a4('0x18')](util['format'](_0x80a4('0x43'),_0x308d3a[_0x80a4('0x20')]),_0x308d3a);dials[_0x80a4('0x42')](_0x308d3a);}catch(_0x5327b3){utils[_0x80a4('0x14')](util[_0x80a4('0x19')](_0x80a4('0x43'),_0x308d3a['uniqueid']),_0x5327b3);}});} \ No newline at end of file +var _0x57ee=['[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','queuecallerjoin','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','[%s][index][musiconholdstop]','musiconholdstop','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr','[%s][index][cdr]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','production','local','port','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./agents.controller','./calls.controller','./recordings.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','[%s][index][devicestatechange]','device','format','[%s][index][agentcalled]','agentcalled','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect'];(function(_0x29d94e,_0xf386d6){var _0x106237=function(_0x327501){while(--_0x327501){_0x29d94e['push'](_0x29d94e['shift']());}};_0x106237(++_0xf386d6);}(_0x57ee,0xae));var _0xe57e=function(_0xbf6058,_0x15e9e7){_0xbf6058=_0xbf6058-0x0;var _0x558be9=_0x57ee[_0xbf6058];return _0x558be9;};var AsteriskManager=require(_0xe57e('0x0'));var config=require(_0xe57e('0x1'));var utils=require(_0xe57e('0x2'));var util=require('util');var isXDREnabled=config[_0xe57e('0x3')]&&config[_0xe57e('0x3')]['disabled']?!config['xdr'][_0xe57e('0x4')]:!![];var isProduction=config['env']===_0xe57e('0x5')||![];var isLocalAsterisk=config[_0xe57e('0x3')]&&config['xdr'][_0xe57e('0x6')]===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0xe57e('0x7')],config['asterisk']['ip'],config['asterisk'][_0xe57e('0x8')],config['asterisk'][_0xe57e('0x9')],!![]);ami[_0xe57e('0xa')]();if(!isXDREnabled){utils[_0xe57e('0xb')](_0xe57e('0xc'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xe57e('0xb')](_0xe57e('0xd'));}else{var agents=require(_0xe57e('0xe'));var calls=require(_0xe57e('0xf'));var queues=require('./queues.controller');var recordings=require(_0xe57e('0x10'));var members=require('./members.controller');var dials=require('./dials.controller');var transfers=require(_0xe57e('0x11'));var core=require(_0xe57e('0x12'));ami['on'](_0xe57e('0x13'),core[_0xe57e('0x13')]);ami['on'](_0xe57e('0x14'),core[_0xe57e('0x14')]);ami['on'](_0xe57e('0x15'),core['fullybooted']);ami['on'](_0xe57e('0x16'),core['error']);ami['on'](_0xe57e('0x17'),core[_0xe57e('0x17')]);ami['on'](_0xe57e('0x18'),core['managerevent']);ami['on'](_0xe57e('0x19'),function(_0x267ca4){try{utils[_0xe57e('0x1a')](util['format'](_0xe57e('0x1b'),_0x267ca4[_0xe57e('0x1c')]),_0x267ca4);members[_0xe57e('0x19')](_0x267ca4);}catch(_0x15b75a){utils['error'](util[_0xe57e('0x1d')](_0xe57e('0x1b'),_0x267ca4[_0xe57e('0x1c')]),_0x15b75a);}});ami['on']('agentcalled',function(_0x5426c8){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x1e'),_0x5426c8['uniqueid']),_0x5426c8);agents[_0xe57e('0x1f')](_0x5426c8);}catch(_0x4f8f3e){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x1e'),_0x5426c8['uniqueid']),_0x4f8f3e);}});ami['on']('agentringnoanswer',function(_0x29daf7){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')]('[%s][index][agentringnoanswer]',_0x29daf7[_0xe57e('0x20')]),_0x29daf7);agents[_0xe57e('0x21')](_0x29daf7);}catch(_0x527559){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x22'),_0x29daf7[_0xe57e('0x20')]),_0x527559);}});ami['on'](_0xe57e('0x23'),function(_0x56bdc0){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x24'),_0x56bdc0[_0xe57e('0x20')]),_0x56bdc0);agents[_0xe57e('0x23')](_0x56bdc0);queues[_0xe57e('0x23')](_0x56bdc0);}catch(_0x390b17){utils['error'](util[_0xe57e('0x1d')](_0xe57e('0x24'),_0x56bdc0[_0xe57e('0x20')]),_0x390b17);}});ami['on'](_0xe57e('0x25'),function(_0x1ca4af){try{utils[_0xe57e('0x1a')](util['format'](_0xe57e('0x26'),_0x1ca4af[_0xe57e('0x20')]),_0x1ca4af);agents[_0xe57e('0x25')](_0x1ca4af);queues[_0xe57e('0x25')](_0x1ca4af);members['agentcomplete'](_0x1ca4af);}catch(_0x383308){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')]('[%s][index][agentcomplete]',_0x1ca4af[_0xe57e('0x20')]),_0x383308);}});ami['on'](_0xe57e('0x27'),function(_0x4cd790){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x28'),_0x4cd790[_0xe57e('0x20')]),_0x4cd790);agents[_0xe57e('0x27')](_0x4cd790);queues['queuecallerabandon'](_0x4cd790);}catch(_0x101b76){utils[_0xe57e('0x16')](util['format']('[%s][index][queuecallerabandon]',_0x4cd790[_0xe57e('0x20')]),_0x101b76);}});ami['on']('queuecallerjoin',function(_0x1c722a){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x29'),_0x1c722a[_0xe57e('0x20')]),_0x1c722a);queues[_0xe57e('0x2a')](_0x1c722a);recordings[_0xe57e('0x2a')](_0x1c722a);}catch(_0x3274f4){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')]('[%s][index][queuecallerjoin]',_0x1c722a[_0xe57e('0x20')]),_0x3274f4);}});ami['on'](_0xe57e('0x2b'),function(_0x551f9b){try{utils['debug'](util[_0xe57e('0x1d')]('[%s][index][queuecallerleave]',_0x551f9b[_0xe57e('0x20')]),_0x551f9b);queues['queuecallerleave'](_0x551f9b);}catch(_0x37d11d){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x2c'),_0x551f9b[_0xe57e('0x20')]),_0x37d11d);}});ami['on'](_0xe57e('0x2d'),function(_0x43f285){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x2e'),_0x43f285[_0xe57e('0x20')]),_0x43f285);queues[_0xe57e('0x2d')](_0x43f285);calls['musiconholdstart'](_0x43f285);}catch(_0x201e10){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x2e'),_0x43f285[_0xe57e('0x20')]),_0x201e10);}});ami['on']('musiconholdstop',function(_0x51fbc6){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x2f'),_0x51fbc6['uniqueid']),_0x51fbc6);queues['musiconholdstop'](_0x51fbc6);calls[_0xe57e('0x30')](_0x51fbc6);}catch(_0x2de4f5){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x2f'),_0x51fbc6[_0xe57e('0x20')]),_0x2de4f5);}});ami['on'](_0xe57e('0x31'),function(_0x13b3ca){try{utils[_0xe57e('0x1a')](util['format'](_0xe57e('0x32'),_0x13b3ca[_0xe57e('0x20')]),_0x13b3ca);calls[_0xe57e('0x31')](_0x13b3ca);recordings[_0xe57e('0x31')](_0x13b3ca);}catch(_0x574fd1){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x32'),_0x13b3ca[_0xe57e('0x20')]),_0x574fd1);}});ami['on'](_0xe57e('0x33'),function(_0x12d3be){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x34'),_0x12d3be['uniqueid']),_0x12d3be);calls['hangup'](_0x12d3be);recordings['hangup'](_0x12d3be);dials['hangup'](_0x12d3be);agents[_0xe57e('0x33')](_0x12d3be);queues['hangup'](_0x12d3be);}catch(_0x1cc9e2){utils[_0xe57e('0x16')](util['format'](_0xe57e('0x34'),_0x12d3be[_0xe57e('0x20')]),_0x1cc9e2);}});ami['on'](_0xe57e('0x35'),function(_0x24fde1){try{utils['debug'](util[_0xe57e('0x1d')](_0xe57e('0x36'),_0x24fde1['uniqueid']),_0x24fde1);members[_0xe57e('0x35')](_0x24fde1);}catch(_0x76438f){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x36'),_0x24fde1[_0xe57e('0x20')]),_0x76438f);}});ami['on']('blindtransfer',function(_0x58aba9){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')]('[%s][index][blindtransfer]',_0x58aba9[_0xe57e('0x20')]),_0x58aba9);queues['blindtransfer'](_0x58aba9);agents[_0xe57e('0x37')](_0x58aba9);transfers[_0xe57e('0x37')](_0x58aba9);}catch(_0xeea9da){utils[_0xe57e('0x16')](util['format']('[%s][index][blindtransfer]',_0x58aba9['uniqueid']),_0xeea9da);}});ami['on'](_0xe57e('0x38'),function(_0x513f5b){try{utils[_0xe57e('0x1a')](util['format'](_0xe57e('0x39'),_0x513f5b[_0xe57e('0x3a')]),_0x513f5b);queues[_0xe57e('0x38')](_0x513f5b);transfers['attendedtransfer'](_0x513f5b);agents[_0xe57e('0x38')](_0x513f5b);calls[_0xe57e('0x38')](_0x513f5b);}catch(_0x27bb3f){utils['error'](util['format'](_0xe57e('0x39'),_0x513f5b['origtransfereruniqueid']),_0x27bb3f);}});ami['on']('varset',function(_0x1b91a9){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x3b'),_0x1b91a9[_0xe57e('0x20')]),_0x1b91a9);queues[_0xe57e('0x3c')](_0x1b91a9);recordings['varset'](_0x1b91a9);calls[_0xe57e('0x3c')](_0x1b91a9);dials['varset'](_0x1b91a9);}catch(_0x25c58f){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')](_0xe57e('0x3b'),_0x1b91a9[_0xe57e('0x20')]),_0x25c58f);}});ami['on'](_0xe57e('0x3d'),function(_0x2e952f){try{utils[_0xe57e('0x1a')](util['format'](_0xe57e('0x3e'),_0x2e952f['uniqueid']),_0x2e952f);calls[_0xe57e('0x3d')](_0x2e952f);recordings[_0xe57e('0x3d')](_0x2e952f);dials['newexten'](_0x2e952f);}catch(_0x3b270a){utils['error'](util['format']('[%s][index][newexten]',_0x2e952f[_0xe57e('0x20')]),_0x3b270a);}});ami['on'](_0xe57e('0x3f'),function(_0x505828){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x40'),_0x505828[_0xe57e('0x20')]),_0x505828);calls[_0xe57e('0x3f')](_0x505828);recordings['newchannel'](_0x505828);}catch(_0x3dbb7e){utils[_0xe57e('0x16')](util[_0xe57e('0x1d')]('[%s][index][newchannel]',_0x505828['uniqueid']),_0x3dbb7e);}});ami['on'](_0xe57e('0x41'),function(_0x25bdb7){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x42'),_0x25bdb7[_0xe57e('0x20')]),_0x25bdb7);dials['dialbegin'](_0x25bdb7);}catch(_0x787ec3){utils['error'](util[_0xe57e('0x1d')](_0xe57e('0x43'),_0x25bdb7[_0xe57e('0x20')]),_0x787ec3);}});ami['on'](_0xe57e('0x44'),function(_0x5df58d){try{utils[_0xe57e('0x1a')](util[_0xe57e('0x1d')](_0xe57e('0x45'),_0x5df58d[_0xe57e('0x20')]),_0x5df58d);dials[_0xe57e('0x44')](_0x5df58d);}catch(_0x139b8c){utils['error'](util[_0xe57e('0x1d')]('[%s][index][dialend]',_0x5df58d[_0xe57e('0x20')]),_0x139b8c);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 56bdabb..7e6233d 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 _0x0851=['internal','request','getUserByName','split','then','CreateMemberReport','[%s][members][writeDB]','some','devicestatechange','debug','[%s][members][devicestatechange]','device','INUSE','BUSY','voice','now','NOT_INUSE','exitAt','duration','diffTime','enterAt','error','agentcomplete','isNil','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','[%s][members][cdr]','source','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','data3','lodash','util','./utils','Local/_attended@transfer','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','getUserByInterface','name'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0851,0x8a));var _0x1085=function(_0x2fda94,_0x5ca752){_0x2fda94=_0x2fda94-0x0;var _0x3f769c=_0x0851[_0x2fda94];return _0x3f769c;};'use strict';var _=require(_0x1085('0x0'));var util=require(_0x1085('0x1'));var utils=require(_0x1085('0x2'));var members={};var exclude=[_0x1085('0x3'),'Queue:'];function writeDB(_0x2a93c7){utils[_0x1085('0x4')](util[_0x1085('0x5')](_0x1085('0x6'),_0x2a93c7[_0x1085('0x7')],_0x2a93c7[_0x1085('0x8')],_0x2a93c7[_0x1085('0x9')],_0x2a93c7[_0x1085('0xa')],_0x2a93c7[_0x1085('0xb')],_0x2a93c7[_0x1085('0xc')]));if(_0x2a93c7[_0x1085('0x8')]){utils[_0x1085('0xd')](_0x2a93c7['interface'])['then'](function(_0x114b8b){if(_0x114b8b){_0x2a93c7[_0x1085('0xb')]=_0x114b8b[_0x1085('0xe')];_0x2a93c7[_0x1085('0xf')]=_0x114b8b[_0x1085('0xf')];utils[_0x1085('0x10')]('CreateMemberReport',_0x2a93c7);}else{utils[_0x1085('0x11')](_0x2a93c7[_0x1085('0x8')][_0x1085('0x12')]('/')[0x1])[_0x1085('0x13')](function(_0x43e536){if(_0x43e536){_0x2a93c7[_0x1085('0xb')]=_0x43e536[_0x1085('0xe')];_0x2a93c7[_0x1085('0xf')]=_0x43e536[_0x1085('0xf')];utils[_0x1085('0x10')](_0x1085('0x14'),_0x2a93c7);}});}})['catch'](function(_0xf5fd55){utils['error'](util[_0x1085('0x5')](_0x1085('0x15'),_0x2a93c7[_0x1085('0x7')]),_0xf5fd55);});}delete members[_0x2a93c7['interface']];}function startsWith(_0x334c3a,_0x27b8d9){return _[_0x1085('0x16')](_0x334c3a,function(_0x41e4d7){return _['startsWith'](_0x27b8d9,_0x41e4d7);});}exports[_0x1085('0x17')]=function(_0x4ac3b0){try{utils[_0x1085('0x18')](util['format'](_0x1085('0x19'),members[_0x4ac3b0[_0x1085('0x1a')]]?members[_0x4ac3b0[_0x1085('0x1a')]]['uniqueid']:_0x4ac3b0[_0x1085('0x1a')]),_0x4ac3b0);utils['info'](util[_0x1085('0x5')]('[%s][members][devicestatechange]\x20state:%s\x20interface:%s',members[_0x4ac3b0['device']]?members[_0x4ac3b0['device']]['uniqueid']:_0x4ac3b0[_0x1085('0x1a')],_0x4ac3b0['state'],_0x4ac3b0['device']));switch(_0x4ac3b0['state']){case _0x1085('0x1b'):case _0x1085('0x1c'):if(!startsWith(exclude,_0x4ac3b0[_0x1085('0x1a')])){members[_0x4ac3b0['device']]={'channel':_0x1085('0x1d'),'interface':_0x4ac3b0[_0x1085('0x1a')],'type':'TALKING','enterAt':utils[_0x1085('0x1e')](),'role':'agent'};}break;case _0x1085('0x1f'):if(!_['isNil'](members[_0x4ac3b0[_0x1085('0x1a')]])){members[_0x4ac3b0[_0x1085('0x1a')]][_0x1085('0x20')]=utils['now']();members[_0x4ac3b0[_0x1085('0x1a')]][_0x1085('0x21')]=utils[_0x1085('0x22')](members[_0x4ac3b0['device']][_0x1085('0x20')],members[_0x4ac3b0[_0x1085('0x1a')]][_0x1085('0x23')]);if(members[_0x4ac3b0['device']][_0x1085('0x7')]){writeDB(members[_0x4ac3b0[_0x1085('0x1a')]]);}}break;default:break;}}catch(_0x42d121){utils[_0x1085('0x24')](util[_0x1085('0x5')](_0x1085('0x19'),members[_0x4ac3b0[_0x1085('0x1a')]]?members[_0x4ac3b0[_0x1085('0x1a')]][_0x1085('0x7')]:_0x4ac3b0[_0x1085('0x1a')]),_0x42d121);}};exports[_0x1085('0x25')]=function(_0x5c5ed1){try{if(!_[_0x1085('0x26')](members[_0x5c5ed1[_0x1085('0x8')]])){utils[_0x1085('0x18')](util[_0x1085('0x5')](_0x1085('0x27'),_0x5c5ed1[_0x1085('0x7')]),_0x5c5ed1);utils[_0x1085('0x4')](util[_0x1085('0x5')](_0x1085('0x28'),_0x5c5ed1[_0x1085('0x7')],_0x5c5ed1[_0x1085('0x8')],_0x5c5ed1[_0x1085('0x29')]));members[_0x5c5ed1['interface']]=_[_0x1085('0x2a')](members[_0x5c5ed1[_0x1085('0x8')]],{'data4':_0x5c5ed1['queue'],'uniqueid':_0x5c5ed1[_0x1085('0x7')]});}}catch(_0x1c2d21){utils[_0x1085('0x24')](util[_0x1085('0x5')](_0x1085('0x27'),_0x5c5ed1['uniqueid']),_0x1c2d21);}};exports[_0x1085('0x2b')]=function(_0x26a483){try{utils['debug'](util[_0x1085('0x5')](_0x1085('0x2c'),_0x26a483[_0x1085('0x7')]),_0x26a483);if(_0x26a483[_0x1085('0x9')]){var _0x4f29ea=_0x26a483[_0x1085('0x9')][_0x1085('0x12')]('-')[0x0];if(!_[_0x1085('0x26')](members[_0x4f29ea])){members[_0x4f29ea]=_[_0x1085('0x2a')](members[_0x4f29ea],{'data1':members[_0x4f29ea]['data1']||_0x26a483[_0x1085('0xc')],'data2':members[_0x4f29ea][_0x1085('0xa')]||_0x26a483[_0x1085('0x2d')],'data3':members[_0x4f29ea]['data3']||_0x26a483[_0x1085('0x2e')],'uniqueid':members[_0x4f29ea]['uniqueid']||_0x26a483[_0x1085('0x7')]});utils['info'](util[_0x1085('0x5')](_0x1085('0x2f'),_0x26a483['uniqueid'],members[_0x4f29ea][_0x1085('0x30')],members[_0x4f29ea][_0x1085('0xa')],members[_0x4f29ea]['data3']));if(members[_0x4f29ea][_0x1085('0x20')]){writeDB(members[_0x4f29ea]);}}}if(_0x26a483['destinationchannel']){var _0x4a3efd=_0x26a483[_0x1085('0x31')][_0x1085('0x12')]('-')[0x0];if(!_['isNil'](members[_0x4a3efd])){members[_0x4a3efd]=_[_0x1085('0x2a')](members[_0x4a3efd],{'data1':members[_0x4a3efd][_0x1085('0x30')]||_0x26a483[_0x1085('0xc')],'data2':members[_0x4a3efd][_0x1085('0xa')]||_0x26a483['source'],'data3':members[_0x4a3efd][_0x1085('0x32')]||_0x26a483[_0x1085('0x2e')],'uniqueid':members[_0x4a3efd][_0x1085('0x7')]||_0x26a483[_0x1085('0x7')]});utils[_0x1085('0x4')](util['format'](_0x1085('0x2f'),_0x26a483['uniqueid'],members[_0x4a3efd]['data1'],members[_0x4a3efd][_0x1085('0xa')],members[_0x4a3efd]['data3']));if(members[_0x4a3efd]['exitAt']){writeDB(members[_0x4a3efd]);}}}}catch(_0x502b4d){utils[_0x1085('0x24')](util[_0x1085('0x5')](_0x1085('0x2c'),_0x26a483[_0x1085('0x7')]),_0x502b4d);}}; \ No newline at end of file +var _0xe74e=['cdr','[%s][members][cdr]','channel','data1','data2','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data3','destinationchannel','split','source','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','membername','type','then','internal','request','CreateMemberReport','getUserByName','name','catch','error','[%s][members][writeDB]','some','startsWith','debug','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','BUSY','voice','agent','NOT_INUSE','isNil','exitAt','now','duration','diffTime','enterAt','agentcomplete','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign'];(function(_0x5cf3c0,_0x4363c1){var _0x39a680=function(_0x2a10f1){while(--_0x2a10f1){_0x5cf3c0['push'](_0x5cf3c0['shift']());}};_0x39a680(++_0x4363c1);}(_0xe74e,0x10a));var _0xee74=function(_0x3493bb,_0x142e8f){_0x3493bb=_0x3493bb-0x0;var _0x27633b=_0xe74e[_0x3493bb];return _0x27633b;};'use strict';var _=require('lodash');var util=require(_0xee74('0x0'));var utils=require(_0xee74('0x1'));var members={};var exclude=[_0xee74('0x2'),_0xee74('0x3')];function writeDB(_0x45c54d){utils[_0xee74('0x4')](util[_0xee74('0x5')](_0xee74('0x6'),_0x45c54d[_0xee74('0x7')],_0x45c54d[_0xee74('0x8')],_0x45c54d['channel'],_0x45c54d['data2'],_0x45c54d[_0xee74('0x9')],_0x45c54d[_0xee74('0xa')]));if(_0x45c54d['interface']){utils['getUserByInterface'](_0x45c54d[_0xee74('0x8')])[_0xee74('0xb')](function(_0x42d671){if(_0x42d671){_0x45c54d['membername']=_0x42d671['name'];_0x45c54d[_0xee74('0xc')]=_0x42d671[_0xee74('0xc')];utils[_0xee74('0xd')](_0xee74('0xe'),_0x45c54d);}else{utils[_0xee74('0xf')](_0x45c54d[_0xee74('0x8')]['split']('/')[0x1])[_0xee74('0xb')](function(_0x308b69){if(_0x308b69){_0x45c54d[_0xee74('0x9')]=_0x308b69[_0xee74('0x10')];_0x45c54d['internal']=_0x308b69[_0xee74('0xc')];utils[_0xee74('0xd')](_0xee74('0xe'),_0x45c54d);}});}})[_0xee74('0x11')](function(_0x5ee1b4){utils[_0xee74('0x12')](util[_0xee74('0x5')](_0xee74('0x13'),_0x45c54d[_0xee74('0x7')]),_0x5ee1b4);});}delete members[_0x45c54d[_0xee74('0x8')]];}function startsWith(_0x24184e,_0x489b98){return _[_0xee74('0x14')](_0x24184e,function(_0x456c3f){return _[_0xee74('0x15')](_0x489b98,_0x456c3f);});}exports['devicestatechange']=function(_0x988fb5){try{utils[_0xee74('0x16')](util['format']('[%s][members][devicestatechange]',members[_0x988fb5[_0xee74('0x17')]]?members[_0x988fb5[_0xee74('0x17')]][_0xee74('0x7')]:_0x988fb5[_0xee74('0x17')]),_0x988fb5);utils[_0xee74('0x4')](util['format'](_0xee74('0x18'),members[_0x988fb5[_0xee74('0x17')]]?members[_0x988fb5['device']][_0xee74('0x7')]:_0x988fb5[_0xee74('0x17')],_0x988fb5[_0xee74('0x19')],_0x988fb5[_0xee74('0x17')]));switch(_0x988fb5[_0xee74('0x19')]){case'INUSE':case _0xee74('0x1a'):if(!startsWith(exclude,_0x988fb5[_0xee74('0x17')])){members[_0x988fb5[_0xee74('0x17')]]={'channel':_0xee74('0x1b'),'interface':_0x988fb5['device'],'type':'TALKING','enterAt':utils['now'](),'role':_0xee74('0x1c')};}break;case _0xee74('0x1d'):if(!_[_0xee74('0x1e')](members[_0x988fb5[_0xee74('0x17')]])){members[_0x988fb5[_0xee74('0x17')]][_0xee74('0x1f')]=utils[_0xee74('0x20')]();members[_0x988fb5[_0xee74('0x17')]][_0xee74('0x21')]=utils[_0xee74('0x22')](members[_0x988fb5[_0xee74('0x17')]][_0xee74('0x1f')],members[_0x988fb5[_0xee74('0x17')]][_0xee74('0x23')]);if(members[_0x988fb5[_0xee74('0x17')]][_0xee74('0x7')]){writeDB(members[_0x988fb5[_0xee74('0x17')]]);}}break;default:break;}}catch(_0x353c8f){utils[_0xee74('0x12')](util[_0xee74('0x5')]('[%s][members][devicestatechange]',members[_0x988fb5[_0xee74('0x17')]]?members[_0x988fb5[_0xee74('0x17')]][_0xee74('0x7')]:_0x988fb5[_0xee74('0x17')]),_0x353c8f);}};exports[_0xee74('0x24')]=function(_0x399b50){try{if(!_['isNil'](members[_0x399b50[_0xee74('0x8')]])){utils[_0xee74('0x16')](util[_0xee74('0x5')]('[%s][members][agentcomplete]',_0x399b50[_0xee74('0x7')]),_0x399b50);utils[_0xee74('0x4')](util[_0xee74('0x5')](_0xee74('0x25'),_0x399b50[_0xee74('0x7')],_0x399b50[_0xee74('0x8')],_0x399b50[_0xee74('0x26')]));members[_0x399b50[_0xee74('0x8')]]=_[_0xee74('0x27')](members[_0x399b50[_0xee74('0x8')]],{'data4':_0x399b50['queue'],'uniqueid':_0x399b50[_0xee74('0x7')]});}}catch(_0x4cb876){utils['error'](util[_0xee74('0x5')]('[%s][members][agentcomplete]',_0x399b50['uniqueid']),_0x4cb876);}};exports[_0xee74('0x28')]=function(_0xbfdcf9){try{utils['debug'](util[_0xee74('0x5')](_0xee74('0x29'),_0xbfdcf9[_0xee74('0x7')]),_0xbfdcf9);if(_0xbfdcf9[_0xee74('0x2a')]){var _0x4d543a=_0xbfdcf9[_0xee74('0x2a')]['split']('-')[0x0];if(!_[_0xee74('0x1e')](members[_0x4d543a])){members[_0x4d543a]=_[_0xee74('0x27')](members[_0x4d543a],{'data1':members[_0x4d543a][_0xee74('0x2b')]||_0xbfdcf9['type'],'data2':members[_0x4d543a][_0xee74('0x2c')]||_0xbfdcf9['source'],'data3':members[_0x4d543a]['data3']||_0xbfdcf9[_0xee74('0x2d')],'uniqueid':members[_0x4d543a][_0xee74('0x7')]||_0xbfdcf9[_0xee74('0x7')]});utils['info'](util['format'](_0xee74('0x2e'),_0xbfdcf9[_0xee74('0x7')],members[_0x4d543a][_0xee74('0x2b')],members[_0x4d543a][_0xee74('0x2c')],members[_0x4d543a][_0xee74('0x2f')]));if(members[_0x4d543a][_0xee74('0x1f')]){writeDB(members[_0x4d543a]);}}}if(_0xbfdcf9[_0xee74('0x30')]){var _0x1da6f9=_0xbfdcf9[_0xee74('0x30')][_0xee74('0x31')]('-')[0x0];if(!_['isNil'](members[_0x1da6f9])){members[_0x1da6f9]=_[_0xee74('0x27')](members[_0x1da6f9],{'data1':members[_0x1da6f9][_0xee74('0x2b')]||_0xbfdcf9[_0xee74('0xa')],'data2':members[_0x1da6f9]['data2']||_0xbfdcf9[_0xee74('0x32')],'data3':members[_0x1da6f9][_0xee74('0x2f')]||_0xbfdcf9[_0xee74('0x2d')],'uniqueid':members[_0x1da6f9][_0xee74('0x7')]||_0xbfdcf9['uniqueid']});utils['info'](util[_0xee74('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0xbfdcf9[_0xee74('0x7')],members[_0x1da6f9][_0xee74('0x2b')],members[_0x1da6f9][_0xee74('0x2c')],members[_0x1da6f9][_0xee74('0x2f')]));if(members[_0x1da6f9][_0xee74('0x1f')]){writeDB(members[_0x1da6f9]);}}}}catch(_0x3baf27){utils['error'](util[_0xee74('0x5')](_0xee74('0x29'),_0xbfdcf9[_0xee74('0x7')]),_0x3baf27);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 37e02a7..51d6a30 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 _0x550c=['[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','lodash','util','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','queue','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','format','[%s][queues][queuecallerjoin]','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','error','[%s][queues][varset]','value','toUpperCase','CONTINUE','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','TRANSFER','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','transferexten','extension','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfererlinkedid','origtransfererexten','transferuniqueid','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','[%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'];(function(_0x5d6cfe,_0x348c1c){var _0x1addde=function(_0x63aee9){while(--_0x63aee9){_0x5d6cfe['push'](_0x5d6cfe['shift']());}};_0x1addde(++_0x348c1c);}(_0x550c,0x71));var _0xc550=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x550c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xc550('0x0'));var util=require(_0xc550('0x1'));var utils=require('./utils');var queues={};function writeDB(_0x24eaeb){utils['info'](util['format'](_0xc550('0x2'),_0x24eaeb[_0xc550('0x3')],_0x24eaeb['channel'],_0x24eaeb[_0xc550('0x4')],_0x24eaeb[_0xc550('0x5')],_0x24eaeb[_0xc550('0x6')],_0x24eaeb[_0xc550('0x7')],_0x24eaeb[_0xc550('0x8')]));if(_0x24eaeb['queue']){utils[_0xc550('0x9')](_0x24eaeb[_0xc550('0x4')])[_0xc550('0xa')](function(_0x3e8461){if(_0x3e8461){_0x24eaeb[_0xc550('0xb')]=_0x3e8461[_0xc550('0xb')];}utils[_0xc550('0xc')](_0xc550('0xd'),_0x24eaeb);});}else{utils['request']('CreateVoiceQueueReport',_0x24eaeb);}if(_0x24eaeb[_0xc550('0xe')]){delete queues[_0x24eaeb['transfereduniqueid']];}else{delete queues[_0x24eaeb['uniqueid']];}}exports[_0xc550('0xf')]=function(_0x3da3a5){try{utils[_0xc550('0x10')](util[_0xc550('0x11')](_0xc550('0x12'),_0x3da3a5['uniqueid']),_0x3da3a5);utils[_0xc550('0x13')](util[_0xc550('0x11')](_0xc550('0x14'),_0x3da3a5[_0xc550('0x3')],_0x3da3a5['queue'],_0x3da3a5[_0xc550('0x15')]));queues[_0x3da3a5[_0xc550('0x3')]]=_[_0xc550('0x16')](_0x3da3a5,{'originalposition':_0x3da3a5[_0xc550('0x15')],'queuecallerjoinAt':utils[_0xc550('0x17')](),'mohtime':0x0});}catch(_0x2f9dff){utils['error'](util[_0xc550('0x11')]('[%s][queues][queuecallerjoin]',_0x3da3a5[_0xc550('0x3')]),_0x2f9dff);}};exports[_0xc550('0x18')]=function(_0x46cbdc){try{if(!_[_0xc550('0x19')](queues[_0x46cbdc[_0xc550('0x3')]])){utils[_0xc550('0x10')](util[_0xc550('0x11')](_0xc550('0x1a'),_0x46cbdc[_0xc550('0x3')]),_0x46cbdc);if(queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0x1b')]){if(!queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0x1c')]&&!queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0x1d')]){queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0x1e')]=!![];queues[_0x46cbdc['uniqueid']][_0xc550('0x1f')]=utils[_0xc550('0x17')]();queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0x8')]=_0xc550('0x20');}utils[_0xc550('0x13')](util['format']('[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s',_0x46cbdc[_0xc550('0x3')],queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0x21')],queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0x8')]));writeDB(queues[_0x46cbdc[_0xc550('0x3')]]);}else if(queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0xe')]){utils[_0xc550('0x13')](util[_0xc550('0x11')](_0xc550('0x22'),_0x46cbdc[_0xc550('0x3')],queues[_0x46cbdc['uniqueid']][_0xc550('0x21')],queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0xe')]));queues[queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0xe')]]=queues[_0x46cbdc['uniqueid']];queues[queues[_0x46cbdc[_0xc550('0x3')]][_0xc550('0xe')]][_0xc550('0x23')]=0x2;delete queues[_0x46cbdc[_0xc550('0x3')]];}}}catch(_0x42084d){utils[_0xc550('0x24')](util[_0xc550('0x11')](_0xc550('0x1a'),_0x46cbdc[_0xc550('0x3')]),_0x42084d);}};exports['varset']=function(_0x382dd8){try{utils['debug'](util['format'](_0xc550('0x25'),_0x382dd8[_0xc550('0x3')]),_0x382dd8);if(!_[_0xc550('0x19')](_0x382dd8['variable']['queuestatus'])&&_0x382dd8[_0xc550('0x26')][_0xc550('0x27')]()!==_0xc550('0x28')){if(!_[_0xc550('0x19')](queues[_0x382dd8[_0xc550('0x3')]])){queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x1c')]=![];queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x29')]=null;queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x1d')]=!![];queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x2a')]=utils[_0xc550('0x17')]();queues[_0x382dd8['uniqueid']][_0xc550('0x8')]=_0x382dd8['value'][_0xc550('0x27')]();utils[_0xc550('0x13')](util[_0xc550('0x11')](_0xc550('0x2b'),_0x382dd8[_0xc550('0x3')],queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x21')],_0x382dd8[_0xc550('0x26')],queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x8')]));writeDB(queues[_0x382dd8[_0xc550('0x3')]]);}}else if(!_[_0xc550('0x19')](_0x382dd8[_0xc550('0x2c')][_0xc550('0x2d')])){if(!_[_0xc550('0x19')](queues[_0x382dd8[_0xc550('0x3')]])&&!queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x1c')]){queues[_0x382dd8['uniqueid']][_0xc550('0x1c')]=![];queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x29')]=null;queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x1d')]=!![];queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x2a')]=utils['now']();queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x8')]=_0xc550('0x2e');utils['info'](util[_0xc550('0x11')](_0xc550('0x2f'),_0x382dd8['uniqueid'],queues[_0x382dd8[_0xc550('0x3')]][_0xc550('0x21')],_0x382dd8[_0xc550('0x26')],queues[_0x382dd8['uniqueid']][_0xc550('0x8')]));}}}catch(_0x13fef0){utils[_0xc550('0x24')](util['format'](_0xc550('0x25'),_0x382dd8[_0xc550('0x3')]),_0x13fef0);}};exports[_0xc550('0x1c')]=function(_0x287fd6){try{if(!_[_0xc550('0x19')](queues[_0x287fd6[_0xc550('0x3')]])){utils[_0xc550('0x10')](util[_0xc550('0x11')]('[%s][queues][queuecallerabandon]',_0x287fd6[_0xc550('0x3')]),_0x287fd6);queues[_0x287fd6[_0xc550('0x3')]][_0xc550('0x1d')]=![];queues[_0x287fd6[_0xc550('0x3')]][_0xc550('0x2a')]=null;queues[_0x287fd6[_0xc550('0x3')]][_0xc550('0x1c')]=!![];queues[_0x287fd6['uniqueid']][_0xc550('0x29')]=utils[_0xc550('0x17')]();queues[_0x287fd6[_0xc550('0x3')]][_0xc550('0x8')]=_0xc550('0x30');utils[_0xc550('0x13')](util[_0xc550('0x11')](_0xc550('0x31'),_0x287fd6[_0xc550('0x3')],queues[_0x287fd6[_0xc550('0x3')]]['name'],queues[_0x287fd6[_0xc550('0x3')]]['queuecallerexitreason']));}}catch(_0x649b52){utils[_0xc550('0x24')](util[_0xc550('0x11')](_0xc550('0x32'),_0x287fd6[_0xc550('0x3')]),_0x649b52);}};exports[_0xc550('0x33')]=function(_0x47852a){try{if(!_[_0xc550('0x19')](queues[_0x47852a[_0xc550('0x3')]])){utils[_0xc550('0x10')](util[_0xc550('0x11')]('[%s][queues][queuecallerleave]',_0x47852a[_0xc550('0x3')]),_0x47852a);utils[_0xc550('0x13')](util[_0xc550('0x11')](_0xc550('0x34'),_0x47852a[_0xc550('0x3')],queues[_0x47852a['uniqueid']][_0xc550('0x21')],_0x47852a[_0xc550('0x35')],_0x47852a[_0xc550('0x36')]));queues[_0x47852a[_0xc550('0x3')]][_0xc550('0x33')]=!![];queues[_0x47852a[_0xc550('0x3')]][_0xc550('0x1b')]=utils['now']();queues[_0x47852a['uniqueid']][_0xc550('0x37')]=utils[_0xc550('0x38')](queues[_0x47852a[_0xc550('0x3')]]['queuecallerleaveAt'],queues[_0x47852a[_0xc550('0x3')]][_0xc550('0x39')]);queues[_0x47852a['uniqueid']]['position']=_0x47852a[_0xc550('0x15')];queues[_0x47852a[_0xc550('0x3')]]['count']=_0x47852a[_0xc550('0x3a')];queues[_0x47852a['uniqueid']][_0xc550('0x35')]=_0x47852a['connectedlinenum'];queues[_0x47852a[_0xc550('0x3')]][_0xc550('0x36')]=_0x47852a[_0xc550('0x36')];}}catch(_0x5319b4){utils[_0xc550('0x24')](util['format']('[%s][queues][queuecallerleave]',_0x47852a[_0xc550('0x3')]),_0x5319b4);}};exports[_0xc550('0x3b')]=function(_0x36a3ec){try{if(!_[_0xc550('0x19')](queues[_0x36a3ec[_0xc550('0x3')]])){utils[_0xc550('0x10')](util[_0xc550('0x11')](_0xc550('0x3c'),_0x36a3ec['uniqueid']),_0x36a3ec);utils[_0xc550('0x13')](util['format'](_0xc550('0x3d'),_0x36a3ec['uniqueid'],queues[_0x36a3ec[_0xc550('0x3')]][_0xc550('0x21')],_0x36a3ec[_0xc550('0x3e')],_0x36a3ec[_0xc550('0x3f')]));queues[_0x36a3ec[_0xc550('0x3')]][_0xc550('0x1c')]=![];queues[_0x36a3ec[_0xc550('0x3')]][_0xc550('0x1c')]=![];queues[_0x36a3ec[_0xc550('0x3')]][_0xc550('0x29')]=null;queues[_0x36a3ec['uniqueid']]['queuecallerexit']=![];queues[_0x36a3ec[_0xc550('0x3')]]['queuecallerexitreason']=null;queues[_0x36a3ec[_0xc550('0x3')]][_0xc550('0x2a')]=null;queues[_0x36a3ec[_0xc550('0x3')]][_0xc550('0x40')]=!![];queues[_0x36a3ec[_0xc550('0x3')]]['accountcode']=_0x36a3ec[_0xc550('0x3f')];queues[_0x36a3ec['uniqueid']][_0xc550('0x5')]=_0x36a3ec[_0xc550('0x3e')];}}catch(_0x52025a){utils[_0xc550('0x24')](util[_0xc550('0x11')](_0xc550('0x3c'),_0x36a3ec['uniqueid']),_0x52025a);}};exports[_0xc550('0x41')]=function(_0x88afff){try{if(!_['isNil'](queues[_0x88afff['uniqueid']])){if(queues[_0x88afff[_0xc550('0x3')]]['queuecallerleaveAt']){utils['debug'](util[_0xc550('0x11')](_0xc550('0x42'),_0x88afff[_0xc550('0x3')]),_0x88afff);queues[_0x88afff[_0xc550('0x3')]]['queuecallerabandon']=![];queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x1c')]=![];queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x29')]=null;queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x1d')]=![];queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x2a')]=null;queues[_0x88afff[_0xc550('0x3')]]['assigned']=!![];queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x5')]=_0x88afff[_0xc550('0x3e')];queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x1e')]=!![];queues[_0x88afff[_0xc550('0x3')]]['queuecallercompleteAt']=utils[_0xc550('0x17')]();if(_0x88afff[_0xc550('0x43')]==_0xc550('0x44')){if(!queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x44')]){queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x8')]=_0xc550('0x45');}}else{queues[_0x88afff[_0xc550('0x3')]]['queuecallerexitreason']='COMPLETEDBY'+_0x88afff[_0xc550('0x43')][_0xc550('0x27')]();}utils['info'](util['format'](_0xc550('0x46'),_0x88afff[_0xc550('0x3')],queues[_0x88afff['uniqueid']][_0xc550('0x21')],_0x88afff[_0xc550('0x3e')],queues[_0x88afff[_0xc550('0x3')]][_0xc550('0x8')]));writeDB(queues[_0x88afff['uniqueid']]);}}}catch(_0x53a2a3){utils[_0xc550('0x24')](util[_0xc550('0x11')](_0xc550('0x42'),_0x88afff['uniqueid']),_0x53a2a3);}};exports[_0xc550('0x47')]=function(_0x3a4cac){try{if(!_['isNil'](queues[_0x3a4cac[_0xc550('0x48')]])){utils['debug'](util['format']('[%s][queues][blindtransfer]',_0x3a4cac[_0xc550('0x3')]),_0x3a4cac);queues[_0x3a4cac[_0xc550('0x48')]][_0xc550('0x44')]=!![];queues[_0x3a4cac[_0xc550('0x48')]][_0xc550('0x49')]='BLIND';queues[_0x3a4cac[_0xc550('0x48')]][_0xc550('0x4a')]=_0x3a4cac[_0xc550('0x4b')];queues[_0x3a4cac[_0xc550('0x48')]]['transferuniqueid']=_0x3a4cac[_0xc550('0x48')];queues[_0x3a4cac[_0xc550('0x48')]][_0xc550('0x8')]=_0xc550('0x4c');utils[_0xc550('0x13')](util[_0xc550('0x11')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x3a4cac[_0xc550('0x3')],queues[_0x3a4cac[_0xc550('0x48')]][_0xc550('0x21')],_0x3a4cac[_0xc550('0x48')],_0x3a4cac[_0xc550('0x4b')]));}}catch(_0x578636){utils[_0xc550('0x24')](util[_0xc550('0x11')]('[%s][queues][blindtransfer]',_0x3a4cac['uniqueid']),_0x578636);}};exports[_0xc550('0x4d')]=function(_0x1741f7){try{utils[_0xc550('0x10')](util[_0xc550('0x11')]('[%s][queues][attendedtransfer]',_0x1741f7[_0xc550('0x4e')]),_0x1741f7);if(_0x1741f7[_0xc550('0x4e')]==_0x1741f7[_0xc550('0x4f')]){if(!_['isNil'](queues[_0x1741f7['secondtransfererlinkedid']])){utils[_0xc550('0x13')](util['format'](_0xc550('0x50'),_0x1741f7[_0xc550('0x4e')],queues[_0x1741f7[_0xc550('0x51')]]['name'],_0x1741f7[_0xc550('0x52')]));queues[_0x1741f7['secondtransfererlinkedid']][_0xc550('0x44')]=!![];queues[_0x1741f7[_0xc550('0x51')]][_0xc550('0x49')]='ATTENDED';queues[_0x1741f7[_0xc550('0x51')]]['transferexten']=_0x1741f7['origtransfererexten'];queues[_0x1741f7[_0xc550('0x51')]][_0xc550('0x53')]=_0x1741f7[_0xc550('0x4e')];queues[_0x1741f7['secondtransfererlinkedid']][_0xc550('0x8')]=_0xc550('0x54');}if(!_[_0xc550('0x19')](queues[_0x1741f7[_0xc550('0x4f')]])){if(_0x1741f7[_0xc550('0x55')]&&queues[_0x1741f7[_0xc550('0x55')]]){queues[_0x1741f7['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x1741f7[_0xc550('0x48')]]=_[_0xc550('0x56')](queues[_0x1741f7[_0xc550('0x55')]]);queues[_0x1741f7['transfereeuniqueid']][_0xc550('0xe')]=_0x1741f7[_0xc550('0x57')];queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x23')]=0x2;queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x6')]=queues[_0x1741f7[_0xc550('0x51')]][_0xc550('0x6')];queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x58')]=queues[_0x1741f7[_0xc550('0x51')]][_0xc550('0x58')];queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x39')]=utils[_0xc550('0x17')]();queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x1b')]=utils[_0xc550('0x17')]();queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x37')]=0x0;queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x59')]=0x0;utils[_0xc550('0x13')](util['format'](_0xc550('0x5a'),_0x1741f7[_0xc550('0x4e')],queues[_0x1741f7['transfereeuniqueid']][_0xc550('0x21')],queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x6')],queues[_0x1741f7[_0xc550('0x48')]][_0xc550('0x58')]));}else{utils['info'](util[_0xc550('0x11')](_0xc550('0x5b'),_0x1741f7['origtransfereruniqueid'],queues[_0x1741f7['origtransfererlinkedid']][_0xc550('0x21')],_0x1741f7[_0xc550('0x51')]));queues[_0x1741f7['origtransfererlinkedid']][_0xc550('0xe')]=_0x1741f7[_0xc550('0x51')];}}}else if(_0x1741f7[_0xc550('0x5c')]==_0x1741f7[_0xc550('0x51')]){if(!_[_0xc550('0x19')](queues[_0x1741f7[_0xc550('0x4f')]])){utils[_0xc550('0x13')](util[_0xc550('0x11')](_0xc550('0x5d'),_0x1741f7[_0xc550('0x4e')],queues[_0x1741f7[_0xc550('0x4f')]]['name'],_0x1741f7[_0xc550('0x5c')],_0x1741f7[_0xc550('0x5e')]));queues[_0x1741f7[_0xc550('0x4f')]][_0xc550('0x44')]=!![];queues[_0x1741f7[_0xc550('0x4f')]][_0xc550('0x49')]=_0xc550('0x5f');queues[_0x1741f7[_0xc550('0x4f')]][_0xc550('0x4a')]=_0x1741f7[_0xc550('0x5e')];queues[_0x1741f7[_0xc550('0x4f')]][_0xc550('0x53')]=_0x1741f7[_0xc550('0x5c')];queues[_0x1741f7[_0xc550('0x4f')]]['queuecallerexitreason']='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x1741f7[_0xc550('0x51')]])){if(_0x1741f7[_0xc550('0x60')]&&queues[_0x1741f7[_0xc550('0x60')]]){queues[_0x1741f7[_0xc550('0x60')]][_0xc550('0x23')]=0x1;queues[_0x1741f7['transfertargetuniqueid']]=_[_0xc550('0x56')](queues[_0x1741f7[_0xc550('0x60')]]);queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0xe')]=_0x1741f7['transfertargetuniqueid'];queues[_0x1741f7[_0xc550('0x57')]]['queuecallerenterreason']=0x2;queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0x6')]=queues[_0x1741f7[_0xc550('0x4f')]][_0xc550('0x6')];queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0x58')]=queues[_0x1741f7['origtransfererlinkedid']][_0xc550('0x58')];queues[_0x1741f7['transfertargetuniqueid']][_0xc550('0x39')]=utils['now']();queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0x1b')]=utils['now']();queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0x37')]=0x0;queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0x59')]=0x0;utils[_0xc550('0x13')](util[_0xc550('0x11')](_0xc550('0x61'),_0x1741f7[_0xc550('0x4e')],queues[_0x1741f7[_0xc550('0x57')]]['name'],queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0xe')],queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0x6')],queues[_0x1741f7[_0xc550('0x57')]][_0xc550('0x58')]));}else{utils[_0xc550('0x13')](util['format'](_0xc550('0x5b'),_0x1741f7[_0xc550('0x4e')],queues[_0x1741f7['secondtransfererlinkedid']][_0xc550('0x21')],_0x1741f7[_0xc550('0x4f')]));queues[_0x1741f7[_0xc550('0x51')]]['transfereduniqueid']=_0x1741f7[_0xc550('0x4f')];}}}}catch(_0x41e5c8){utils[_0xc550('0x24')](util['format'](_0xc550('0x62'),_0x1741f7['origtransfereruniqueid']),_0x41e5c8);}};exports[_0xc550('0x63')]=function(_0x58d9f9){try{if(!_[_0xc550('0x19')](queues[_0x58d9f9['uniqueid']])){utils[_0xc550('0x10')](util[_0xc550('0x11')](_0xc550('0x64'),_0x58d9f9[_0xc550('0x3')]),_0x58d9f9);queues[_0x58d9f9[_0xc550('0x3')]][_0xc550('0x65')]=utils[_0xc550('0x17')]();utils[_0xc550('0x13')](util['format'](_0xc550('0x66'),_0x58d9f9[_0xc550('0x3')],queues[_0x58d9f9['uniqueid']]['name'],queues[_0x58d9f9[_0xc550('0x3')]][_0xc550('0x65')]));}}catch(_0xd1a84e){utils[_0xc550('0x24')](util[_0xc550('0x11')](_0xc550('0x64'),_0x58d9f9['uniqueid']),_0xd1a84e);}};exports[_0xc550('0x67')]=function(_0x266429){try{if(!_[_0xc550('0x19')](queues[_0x266429['uniqueid']])){if(!_[_0xc550('0x19')](queues[_0x266429[_0xc550('0x3')]][_0xc550('0x65')])){utils[_0xc550('0x10')](util[_0xc550('0x11')](_0xc550('0x68'),_0x266429['uniqueid']),_0x266429);queues[_0x266429[_0xc550('0x3')]]['mohtime']+=utils[_0xc550('0x38')](utils[_0xc550('0x17')](),queues[_0x266429[_0xc550('0x3')]][_0xc550('0x65')]);utils['info'](util['format']('[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s',_0x266429[_0xc550('0x3')],queues[_0x266429['uniqueid']]['name'],queues[_0x266429[_0xc550('0x3')]][_0xc550('0x59')]));delete queues[_0x266429[_0xc550('0x3')]][_0xc550('0x65')];}}}catch(_0xa4ce7e){utils[_0xc550('0x24')](util['format'](_0xc550('0x68'),_0x266429[_0xc550('0x3')]),_0xa4ce7e);}}; \ No newline at end of file +var _0x437b=['secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','info','format','uniqueid','channel','lastAssignedTo','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','position','assign','now','error','[%s][queues][queuecallerjoin]','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','[%s][queues][varset]','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','connectedlinename','holdtime','diffTime','queuecallerjoinAt','count','connectedlinenum','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','agentcomplete','[%s][queues][agentcomplete]','queuecallercomplete','transfer','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','transfertype','transferexten','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','transfertargetuniqueid','calleridnum','calleridname','mohtime','[%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'];(function(_0x58c24e,_0x3f7850){var _0x46c7b0=function(_0x364d8f){while(--_0x364d8f){_0x58c24e['push'](_0x58c24e['shift']());}};_0x46c7b0(++_0x3f7850);}(_0x437b,0x125));var _0xb437=function(_0x187718,_0x427383){_0x187718=_0x187718-0x0;var _0x29ddf4=_0x437b[_0x187718];return _0x29ddf4;};'use strict';var _=require('lodash');var util=require('util');var utils=require('./utils');var queues={};function writeDB(_0x51c25d){utils[_0xb437('0x0')](util[_0xb437('0x1')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x51c25d[_0xb437('0x2')],_0x51c25d[_0xb437('0x3')],_0x51c25d['queue'],_0x51c25d[_0xb437('0x4')],_0x51c25d['calleridnum'],_0x51c25d[_0xb437('0x5')],_0x51c25d[_0xb437('0x6')]));if(_0x51c25d[_0xb437('0x7')]){utils[_0xb437('0x8')](_0x51c25d['queue'])['then'](function(_0x45bee6){if(_0x45bee6){_0x51c25d[_0xb437('0x9')]=_0x45bee6[_0xb437('0x9')];}utils[_0xb437('0xa')](_0xb437('0xb'),_0x51c25d);});}else{utils[_0xb437('0xa')]('CreateVoiceQueueReport',_0x51c25d);}if(_0x51c25d['transfereduniqueid']){delete queues[_0x51c25d[_0xb437('0xc')]];}else{delete queues[_0x51c25d[_0xb437('0x2')]];}}exports[_0xb437('0xd')]=function(_0x17c3bf){try{utils[_0xb437('0xe')](util[_0xb437('0x1')]('[%s][queues][queuecallerjoin]',_0x17c3bf[_0xb437('0x2')]),_0x17c3bf);utils['info'](util[_0xb437('0x1')]('[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s',_0x17c3bf[_0xb437('0x2')],_0x17c3bf[_0xb437('0x7')],_0x17c3bf[_0xb437('0xf')]));queues[_0x17c3bf[_0xb437('0x2')]]=_[_0xb437('0x10')](_0x17c3bf,{'originalposition':_0x17c3bf[_0xb437('0xf')],'queuecallerjoinAt':utils[_0xb437('0x11')](),'mohtime':0x0});}catch(_0xb346f2){utils[_0xb437('0x12')](util[_0xb437('0x1')](_0xb437('0x13'),_0x17c3bf['uniqueid']),_0xb346f2);}};exports['hangup']=function(_0x14c4a5){try{if(!_[_0xb437('0x14')](queues[_0x14c4a5[_0xb437('0x2')]])){utils[_0xb437('0xe')](util[_0xb437('0x1')](_0xb437('0x15'),_0x14c4a5[_0xb437('0x2')]),_0x14c4a5);if(queues[_0x14c4a5[_0xb437('0x2')]][_0xb437('0x16')]){if(!queues[_0x14c4a5[_0xb437('0x2')]]['queuecallerabandon']&&!queues[_0x14c4a5['uniqueid']][_0xb437('0x17')]){queues[_0x14c4a5['uniqueid']]['queuecallercomplete']=!![];queues[_0x14c4a5[_0xb437('0x2')]][_0xb437('0x18')]=utils['now']();queues[_0x14c4a5[_0xb437('0x2')]]['queuecallerexitreason']=_0xb437('0x19');}utils[_0xb437('0x0')](util[_0xb437('0x1')](_0xb437('0x1a'),_0x14c4a5['uniqueid'],queues[_0x14c4a5['uniqueid']]['name'],queues[_0x14c4a5['uniqueid']][_0xb437('0x6')]));writeDB(queues[_0x14c4a5[_0xb437('0x2')]]);}else if(queues[_0x14c4a5[_0xb437('0x2')]]['transfereduniqueid']){utils[_0xb437('0x0')](util[_0xb437('0x1')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x14c4a5['uniqueid'],queues[_0x14c4a5['uniqueid']][_0xb437('0x1b')],queues[_0x14c4a5[_0xb437('0x2')]]['transfereduniqueid']));queues[queues[_0x14c4a5[_0xb437('0x2')]]['transfereduniqueid']]=queues[_0x14c4a5['uniqueid']];queues[queues[_0x14c4a5['uniqueid']][_0xb437('0xc')]][_0xb437('0x1c')]=0x2;delete queues[_0x14c4a5[_0xb437('0x2')]];}}}catch(_0x4cccfd){utils['error'](util[_0xb437('0x1')](_0xb437('0x15'),_0x14c4a5[_0xb437('0x2')]),_0x4cccfd);}};exports['varset']=function(_0x2c138b){try{utils[_0xb437('0xe')](util[_0xb437('0x1')](_0xb437('0x1d'),_0x2c138b['uniqueid']),_0x2c138b);if(!_[_0xb437('0x14')](_0x2c138b[_0xb437('0x1e')][_0xb437('0x1f')])&&_0x2c138b[_0xb437('0x20')][_0xb437('0x21')]()!==_0xb437('0x22')){if(!_[_0xb437('0x14')](queues[_0x2c138b[_0xb437('0x2')]])){queues[_0x2c138b[_0xb437('0x2')]][_0xb437('0x23')]=![];queues[_0x2c138b['uniqueid']][_0xb437('0x24')]=null;queues[_0x2c138b['uniqueid']]['queuecallerexit']=!![];queues[_0x2c138b['uniqueid']][_0xb437('0x25')]=utils[_0xb437('0x11')]();queues[_0x2c138b['uniqueid']][_0xb437('0x6')]=_0x2c138b[_0xb437('0x20')]['toUpperCase']();utils['info'](util[_0xb437('0x1')](_0xb437('0x26'),_0x2c138b[_0xb437('0x2')],queues[_0x2c138b[_0xb437('0x2')]][_0xb437('0x1b')],_0x2c138b[_0xb437('0x20')],queues[_0x2c138b[_0xb437('0x2')]]['queuecallerexitreason']));writeDB(queues[_0x2c138b[_0xb437('0x2')]]);}}else if(!_[_0xb437('0x14')](_0x2c138b[_0xb437('0x1e')][_0xb437('0x27')])){if(!_[_0xb437('0x14')](queues[_0x2c138b[_0xb437('0x2')]])&&!queues[_0x2c138b[_0xb437('0x2')]][_0xb437('0x23')]){queues[_0x2c138b['uniqueid']][_0xb437('0x23')]=![];queues[_0x2c138b[_0xb437('0x2')]][_0xb437('0x24')]=null;queues[_0x2c138b[_0xb437('0x2')]][_0xb437('0x17')]=!![];queues[_0x2c138b[_0xb437('0x2')]][_0xb437('0x25')]=utils[_0xb437('0x11')]();queues[_0x2c138b['uniqueid']][_0xb437('0x6')]=_0xb437('0x28');utils[_0xb437('0x0')](util[_0xb437('0x1')](_0xb437('0x29'),_0x2c138b[_0xb437('0x2')],queues[_0x2c138b[_0xb437('0x2')]]['name'],_0x2c138b[_0xb437('0x20')],queues[_0x2c138b[_0xb437('0x2')]][_0xb437('0x6')]));}}}catch(_0x2638dc){utils['error'](util[_0xb437('0x1')](_0xb437('0x1d'),_0x2c138b[_0xb437('0x2')]),_0x2638dc);}};exports[_0xb437('0x23')]=function(_0x249101){try{if(!_[_0xb437('0x14')](queues[_0x249101['uniqueid']])){utils[_0xb437('0xe')](util[_0xb437('0x1')](_0xb437('0x2a'),_0x249101[_0xb437('0x2')]),_0x249101);queues[_0x249101['uniqueid']][_0xb437('0x17')]=![];queues[_0x249101[_0xb437('0x2')]]['queuecallerexitAt']=null;queues[_0x249101[_0xb437('0x2')]]['queuecallerabandon']=!![];queues[_0x249101[_0xb437('0x2')]]['queuecallerabandonAt']=utils['now']();queues[_0x249101[_0xb437('0x2')]][_0xb437('0x6')]='ABANDONED';utils[_0xb437('0x0')](util[_0xb437('0x1')]('[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s',_0x249101[_0xb437('0x2')],queues[_0x249101[_0xb437('0x2')]][_0xb437('0x1b')],queues[_0x249101[_0xb437('0x2')]][_0xb437('0x6')]));}}catch(_0x55f037){utils['error'](util[_0xb437('0x1')](_0xb437('0x2a'),_0x249101[_0xb437('0x2')]),_0x55f037);}};exports[_0xb437('0x2b')]=function(_0x2cda7d){try{if(!_['isNil'](queues[_0x2cda7d['uniqueid']])){utils[_0xb437('0xe')](util['format'](_0xb437('0x2c'),_0x2cda7d['uniqueid']),_0x2cda7d);utils[_0xb437('0x0')](util[_0xb437('0x1')]('[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s',_0x2cda7d['uniqueid'],queues[_0x2cda7d[_0xb437('0x2')]]['name'],_0x2cda7d['connectedlinenum'],_0x2cda7d[_0xb437('0x2d')]));queues[_0x2cda7d['uniqueid']][_0xb437('0x2b')]=!![];queues[_0x2cda7d['uniqueid']][_0xb437('0x16')]=utils[_0xb437('0x11')]();queues[_0x2cda7d[_0xb437('0x2')]][_0xb437('0x2e')]=utils[_0xb437('0x2f')](queues[_0x2cda7d[_0xb437('0x2')]][_0xb437('0x16')],queues[_0x2cda7d[_0xb437('0x2')]][_0xb437('0x30')]);queues[_0x2cda7d[_0xb437('0x2')]]['position']=_0x2cda7d[_0xb437('0xf')];queues[_0x2cda7d['uniqueid']][_0xb437('0x31')]=_0x2cda7d[_0xb437('0x31')];queues[_0x2cda7d['uniqueid']][_0xb437('0x32')]=_0x2cda7d[_0xb437('0x32')];queues[_0x2cda7d[_0xb437('0x2')]][_0xb437('0x2d')]=_0x2cda7d[_0xb437('0x2d')];}}catch(_0x29f02c){utils[_0xb437('0x12')](util[_0xb437('0x1')](_0xb437('0x2c'),_0x2cda7d[_0xb437('0x2')]),_0x29f02c);}};exports[_0xb437('0x33')]=function(_0x3bb229){try{if(!_[_0xb437('0x14')](queues[_0x3bb229[_0xb437('0x2')]])){utils['debug'](util['format']('[%s][queues][agentconnect]',_0x3bb229[_0xb437('0x2')]),_0x3bb229);utils[_0xb437('0x0')](util[_0xb437('0x1')](_0xb437('0x34'),_0x3bb229[_0xb437('0x2')],queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x1b')],_0x3bb229[_0xb437('0x35')],_0x3bb229[_0xb437('0x36')]));queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x23')]=![];queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x23')]=![];queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x24')]=null;queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x17')]=![];queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x6')]=null;queues[_0x3bb229['uniqueid']][_0xb437('0x25')]=null;queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x37')]=!![];queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x5')]=_0x3bb229[_0xb437('0x36')];queues[_0x3bb229[_0xb437('0x2')]][_0xb437('0x4')]=_0x3bb229['membername'];}}catch(_0x341002){utils['error'](util[_0xb437('0x1')]('[%s][queues][agentconnect]',_0x3bb229[_0xb437('0x2')]),_0x341002);}};exports[_0xb437('0x38')]=function(_0x27bb6e){try{if(!_[_0xb437('0x14')](queues[_0x27bb6e[_0xb437('0x2')]])){if(queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x16')]){utils[_0xb437('0xe')](util[_0xb437('0x1')](_0xb437('0x39'),_0x27bb6e['uniqueid']),_0x27bb6e);queues[_0x27bb6e[_0xb437('0x2')]]['queuecallerabandon']=![];queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x23')]=![];queues[_0x27bb6e[_0xb437('0x2')]]['queuecallerabandonAt']=null;queues[_0x27bb6e['uniqueid']]['queuecallerexit']=![];queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x25')]=null;queues[_0x27bb6e[_0xb437('0x2')]]['assigned']=!![];queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x4')]=_0x27bb6e[_0xb437('0x35')];queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x3a')]=!![];queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x18')]=utils['now']();if(_0x27bb6e['reason']=='transfer'){if(!queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x3b')]){queues[_0x27bb6e[_0xb437('0x2')]]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x6')]=_0xb437('0x3c')+_0x27bb6e[_0xb437('0x3d')][_0xb437('0x21')]();}utils['info'](util[_0xb437('0x1')](_0xb437('0x3e'),_0x27bb6e[_0xb437('0x2')],queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x1b')],_0x27bb6e[_0xb437('0x35')],queues[_0x27bb6e[_0xb437('0x2')]][_0xb437('0x6')]));writeDB(queues[_0x27bb6e[_0xb437('0x2')]]);}}}catch(_0x56ede1){utils[_0xb437('0x12')](util[_0xb437('0x1')]('[%s][queues][agentcomplete]',_0x27bb6e['uniqueid']),_0x56ede1);}};exports[_0xb437('0x3f')]=function(_0x17920e){try{if(!_['isNil'](queues[_0x17920e[_0xb437('0x40')]])){utils[_0xb437('0xe')](util[_0xb437('0x1')]('[%s][queues][blindtransfer]',_0x17920e[_0xb437('0x2')]),_0x17920e);queues[_0x17920e[_0xb437('0x40')]][_0xb437('0x3b')]=!![];queues[_0x17920e[_0xb437('0x40')]][_0xb437('0x41')]='BLIND';queues[_0x17920e['transfereeuniqueid']][_0xb437('0x42')]=_0x17920e['extension'];queues[_0x17920e[_0xb437('0x40')]][_0xb437('0x43')]=_0x17920e[_0xb437('0x40')];queues[_0x17920e['transfereeuniqueid']]['queuecallerexitreason']=_0xb437('0x44');utils[_0xb437('0x0')](util[_0xb437('0x1')](_0xb437('0x45'),_0x17920e[_0xb437('0x2')],queues[_0x17920e[_0xb437('0x40')]][_0xb437('0x1b')],_0x17920e[_0xb437('0x40')],_0x17920e[_0xb437('0x46')]));}}catch(_0x3c5751){utils[_0xb437('0x12')](util[_0xb437('0x1')]('[%s][queues][blindtransfer]',_0x17920e[_0xb437('0x2')]),_0x3c5751);}};exports[_0xb437('0x47')]=function(_0x248b27){try{utils['debug'](util[_0xb437('0x1')]('[%s][queues][attendedtransfer]',_0x248b27[_0xb437('0x48')]),_0x248b27);if(_0x248b27[_0xb437('0x48')]==_0x248b27['origtransfererlinkedid']){if(!_[_0xb437('0x14')](queues[_0x248b27[_0xb437('0x49')]])){utils[_0xb437('0x0')](util[_0xb437('0x1')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x248b27[_0xb437('0x48')],queues[_0x248b27[_0xb437('0x49')]]['name'],_0x248b27[_0xb437('0x4a')]));queues[_0x248b27[_0xb437('0x49')]]['transfer']=!![];queues[_0x248b27[_0xb437('0x49')]]['transfertype']=_0xb437('0x4b');queues[_0x248b27['secondtransfererlinkedid']][_0xb437('0x42')]=_0x248b27[_0xb437('0x4a')];queues[_0x248b27['secondtransfererlinkedid']]['transferuniqueid']=_0x248b27[_0xb437('0x48')];queues[_0x248b27[_0xb437('0x49')]][_0xb437('0x6')]=_0xb437('0x4c');}if(!_[_0xb437('0x14')](queues[_0x248b27[_0xb437('0x4d')]])){if(_0x248b27[_0xb437('0x4e')]&&queues[_0x248b27[_0xb437('0x4e')]]){queues[_0x248b27[_0xb437('0x4e')]]['queuecallerenterreason']=0x1;queues[_0x248b27[_0xb437('0x40')]]=_['clone'](queues[_0x248b27[_0xb437('0x4e')]]);queues[_0x248b27[_0xb437('0x40')]][_0xb437('0xc')]=_0x248b27[_0xb437('0x4f')];queues[_0x248b27[_0xb437('0x40')]][_0xb437('0x1c')]=0x2;queues[_0x248b27['transfereeuniqueid']][_0xb437('0x50')]=queues[_0x248b27[_0xb437('0x49')]][_0xb437('0x50')];queues[_0x248b27['transfereeuniqueid']][_0xb437('0x51')]=queues[_0x248b27[_0xb437('0x49')]][_0xb437('0x51')];queues[_0x248b27[_0xb437('0x40')]]['queuecallerjoinAt']=utils[_0xb437('0x11')]();queues[_0x248b27[_0xb437('0x40')]][_0xb437('0x16')]=utils[_0xb437('0x11')]();queues[_0x248b27[_0xb437('0x40')]][_0xb437('0x2e')]=0x0;queues[_0x248b27[_0xb437('0x40')]][_0xb437('0x52')]=0x0;utils['info'](util[_0xb437('0x1')](_0xb437('0x53'),_0x248b27[_0xb437('0x48')],queues[_0x248b27[_0xb437('0x40')]]['name'],queues[_0x248b27[_0xb437('0x40')]][_0xb437('0x50')],queues[_0x248b27[_0xb437('0x40')]][_0xb437('0x51')]));}else{utils[_0xb437('0x0')](util['format'](_0xb437('0x54'),_0x248b27[_0xb437('0x48')],queues[_0x248b27[_0xb437('0x4d')]][_0xb437('0x1b')],_0x248b27[_0xb437('0x49')]));queues[_0x248b27[_0xb437('0x4d')]][_0xb437('0xc')]=_0x248b27[_0xb437('0x49')];}}}else if(_0x248b27[_0xb437('0x55')]==_0x248b27[_0xb437('0x49')]){if(!_[_0xb437('0x14')](queues[_0x248b27['origtransfererlinkedid']])){utils[_0xb437('0x0')](util[_0xb437('0x1')](_0xb437('0x56'),_0x248b27[_0xb437('0x48')],queues[_0x248b27['origtransfererlinkedid']][_0xb437('0x1b')],_0x248b27[_0xb437('0x55')],_0x248b27[_0xb437('0x57')]));queues[_0x248b27[_0xb437('0x4d')]][_0xb437('0x3b')]=!![];queues[_0x248b27['origtransfererlinkedid']]['transfertype']=_0xb437('0x4b');queues[_0x248b27[_0xb437('0x4d')]][_0xb437('0x42')]=_0x248b27['secondtransfererexten'];queues[_0x248b27['origtransfererlinkedid']][_0xb437('0x43')]=_0x248b27[_0xb437('0x55')];queues[_0x248b27[_0xb437('0x4d')]][_0xb437('0x6')]=_0xb437('0x4c');}if(!_[_0xb437('0x14')](queues[_0x248b27[_0xb437('0x49')]])){if(_0x248b27[_0xb437('0x58')]&&queues[_0x248b27[_0xb437('0x58')]]){queues[_0x248b27[_0xb437('0x58')]][_0xb437('0x1c')]=0x1;queues[_0x248b27['transfertargetuniqueid']]=_['clone'](queues[_0x248b27[_0xb437('0x58')]]);queues[_0x248b27[_0xb437('0x4f')]]['transfereduniqueid']=_0x248b27[_0xb437('0x4f')];queues[_0x248b27[_0xb437('0x4f')]]['queuecallerenterreason']=0x2;queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x50')]=queues[_0x248b27[_0xb437('0x4d')]][_0xb437('0x50')];queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x51')]=queues[_0x248b27[_0xb437('0x4d')]][_0xb437('0x51')];queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x30')]=utils[_0xb437('0x11')]();queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x16')]=utils[_0xb437('0x11')]();queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x2e')]=0x0;queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x52')]=0x0;utils['info'](util[_0xb437('0x1')](_0xb437('0x59'),_0x248b27[_0xb437('0x48')],queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x1b')],queues[_0x248b27[_0xb437('0x4f')]]['transfereduniqueid'],queues[_0x248b27[_0xb437('0x4f')]][_0xb437('0x50')],queues[_0x248b27['transfertargetuniqueid']][_0xb437('0x51')]));}else{utils['info'](util[_0xb437('0x1')](_0xb437('0x54'),_0x248b27[_0xb437('0x48')],queues[_0x248b27['secondtransfererlinkedid']][_0xb437('0x1b')],_0x248b27[_0xb437('0x4d')]));queues[_0x248b27['secondtransfererlinkedid']]['transfereduniqueid']=_0x248b27[_0xb437('0x4d')];}}}}catch(_0x17e9e4){utils['error'](util[_0xb437('0x1')]('[%s][queues][attendedtransfer]',_0x248b27[_0xb437('0x48')]),_0x17e9e4);}};exports[_0xb437('0x5a')]=function(_0x13506b){try{if(!_[_0xb437('0x14')](queues[_0x13506b['uniqueid']])){utils[_0xb437('0xe')](util[_0xb437('0x1')]('[%s][queues][musiconholdstart]',_0x13506b[_0xb437('0x2')]),_0x13506b);queues[_0x13506b['uniqueid']][_0xb437('0x5b')]=utils['now']();utils[_0xb437('0x0')](util[_0xb437('0x1')]('[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s',_0x13506b[_0xb437('0x2')],queues[_0x13506b[_0xb437('0x2')]][_0xb437('0x1b')],queues[_0x13506b['uniqueid']][_0xb437('0x5b')]));}}catch(_0x522bbf){utils[_0xb437('0x12')](util['format'](_0xb437('0x5c'),_0x13506b[_0xb437('0x2')]),_0x522bbf);}};exports['musiconholdstop']=function(_0x31fccd){try{if(!_[_0xb437('0x14')](queues[_0x31fccd[_0xb437('0x2')]])){if(!_[_0xb437('0x14')](queues[_0x31fccd[_0xb437('0x2')]][_0xb437('0x5b')])){utils[_0xb437('0xe')](util[_0xb437('0x1')](_0xb437('0x5d'),_0x31fccd['uniqueid']),_0x31fccd);queues[_0x31fccd[_0xb437('0x2')]]['mohtime']+=utils[_0xb437('0x2f')](utils[_0xb437('0x11')](),queues[_0x31fccd[_0xb437('0x2')]][_0xb437('0x5b')]);utils['info'](util[_0xb437('0x1')](_0xb437('0x5e'),_0x31fccd[_0xb437('0x2')],queues[_0x31fccd[_0xb437('0x2')]][_0xb437('0x1b')],queues[_0x31fccd[_0xb437('0x2')]][_0xb437('0x52')]));delete queues[_0x31fccd[_0xb437('0x2')]][_0xb437('0x5b')];}}}catch(_0x54d689){utils['error'](util[_0xb437('0x1')]('[%s][queues][musiconholdstop]',_0x31fccd[_0xb437('0x2')]),_0x54d689);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 985d19f..50437bf 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 _0x3913=['[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridnum','cause-txt','calleridname','connectedlinenum','connectedlinename','type','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','cdr','split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','util','info','format','getUserByInternal','accountcode','then','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','uniqueid','channel','error','[%s][recordings][newstate]','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','varset','isNil','variable','debug','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','monitors','push','hangup'];(function(_0x5b67c9,_0x958f62){var _0x3a3363=function(_0x12774a){while(--_0x12774a){_0x5b67c9['push'](_0x5b67c9['shift']());}};_0x3a3363(++_0x958f62);}(_0x3913,0x8a));var _0x3391=function(_0x12a8cf,_0x41d6bb){_0x12a8cf=_0x12a8cf-0x0;var _0xabc603=_0x3913[_0x12a8cf];return _0xabc603;};'use strict';var _=require('lodash');var util=require(_0x3391('0x0'));var utils=require('./utils');var recordings={};function writeDB(_0x41b475){utils[_0x3391('0x1')](util[_0x3391('0x2')]('[%s][recordings][writeDB]',_0x41b475['uniqueid']));if(_0x41b475['accountcode']){utils[_0x3391('0x3')](_0x41b475[_0x3391('0x4')])[_0x3391('0x5')](function(_0x5a2d78){if(_0x5a2d78){_0x41b475[_0x3391('0x6')]=_0x5a2d78[_0x3391('0x7')];_0x41b475[_0x3391('0x8')]=_0x5a2d78['id'];}utils[_0x3391('0x9')](_0x3391('0xa'),_0x41b475);});}else{utils[_0x3391('0x9')](_0x3391('0xa'),_0x41b475);}}exports[_0x3391('0xb')]=function(_0x35d0d8){try{utils['debug'](util[_0x3391('0x2')](_0x3391('0xc'),_0x35d0d8['uniqueid']),_0x35d0d8);if(_0x35d0d8['uniqueid']==_0x35d0d8[_0x3391('0xd')]){utils[_0x3391('0x1')](util[_0x3391('0x2')](_0x3391('0xe'),_0x35d0d8['uniqueid'],_0x35d0d8[_0x3391('0xf')],_0x35d0d8[_0x3391('0x10')]));recordings[_0x35d0d8[_0x3391('0x11')]]={'uniqueid':_0x35d0d8[_0x3391('0x11')],'accountcode':_0x35d0d8[_0x3391('0x4')],'exten':_0x35d0d8['exten'],'context':_0x35d0d8[_0x3391('0xf')],'channel':_0x35d0d8[_0x3391('0x12')],'monitors':[]};}}catch(_0x783414){utils[_0x3391('0x13')](util[_0x3391('0x2')](_0x3391('0xc'),_0x35d0d8[_0x3391('0x11')]),_0x783414);}};exports['newstate']=function(_0x517d0a){try{utils['debug'](util['format'](_0x3391('0x14'),_0x517d0a[_0x3391('0x11')]),_0x517d0a);if(!_['isNil'](recordings[_0x517d0a['uniqueid']])&&_0x517d0a[_0x3391('0x15')]==0x6){utils[_0x3391('0x1')](util[_0x3391('0x2')](_0x3391('0x16'),_0x517d0a[_0x3391('0x11')],_0x517d0a['context'],_0x517d0a[_0x3391('0x12')]));}else if(!_['isNil'](recordings[_0x517d0a[_0x3391('0xd')]])&&_0x517d0a[_0x3391('0x15')]==0x6&&_0x517d0a[_0x3391('0xf')]!='transfer'){utils[_0x3391('0x1')](util[_0x3391('0x2')](_0x3391('0x17'),_0x517d0a[_0x3391('0x11')],_0x517d0a['linkedid'],_0x517d0a['context'],_0x517d0a[_0x3391('0x12')]));recordings[_0x517d0a[_0x3391('0xd')]]['accountcode']=_0x517d0a[_0x3391('0x4')];}}catch(_0x18de53){utils[_0x3391('0x13')](util[_0x3391('0x2')](_0x3391('0x14'),_0x517d0a['uniqueid']),_0x18de53);}};exports[_0x3391('0x18')]=function(_0x56ef5c){try{if(!_[_0x3391('0x19')](_0x56ef5c[_0x3391('0x1a')])&&!_[_0x3391('0x19')](_0x56ef5c[_0x3391('0x1a')]['mixmonitor_filename'])){utils[_0x3391('0x1b')](util[_0x3391('0x2')](_0x3391('0x1c'),_0x56ef5c[_0x3391('0x11')]),_0x56ef5c);utils[_0x3391('0x1')](util['format'](_0x3391('0x1d'),_0x56ef5c[_0x3391('0x11')],_0x56ef5c[_0x3391('0x1a')],_0x56ef5c[_0x3391('0x1e')]));if(_['endsWith'](_0x56ef5c[_0x3391('0x1e')],_0x3391('0x1f'))){_0x56ef5c['value']=_0x56ef5c[_0x3391('0x1e')][_0x3391('0x20')](_0x3391('0x1f'),'.WAV');}if(recordings[_0x56ef5c[_0x3391('0xd')]]){var _0x171b96=_['find'](recordings[_0x56ef5c[_0x3391('0xd')]][_0x3391('0x21')],{'value':_0x56ef5c[_0x3391('0x1e')]});if(_[_0x3391('0x19')](_0x171b96)){recordings[_0x56ef5c[_0x3391('0xd')]]['monitors'][_0x3391('0x22')]({'value':_0x56ef5c[_0x3391('0x1e')]});}}}}catch(_0x103097){utils[_0x3391('0x13')](util['format'](_0x3391('0x1c'),_0x56ef5c[_0x3391('0x11')]),_0x103097);}};exports[_0x3391('0x23')]=function(_0x156e3f){try{if(!_['isNil'](recordings[_0x156e3f[_0x3391('0x11')]])){utils['debug'](util[_0x3391('0x2')](_0x3391('0x24'),_0x156e3f[_0x3391('0x11')]),_0x156e3f);utils[_0x3391('0x1')](util[_0x3391('0x2')](_0x3391('0x25'),_0x156e3f['uniqueid'],_0x156e3f[_0x3391('0x26')],_0x156e3f['calleridname'],_0x156e3f[_0x3391('0x27')]));recordings[_0x156e3f[_0x3391('0x11')]][_0x3391('0x26')]=_0x156e3f[_0x3391('0x26')];recordings[_0x156e3f[_0x3391('0x11')]][_0x3391('0x28')]=_0x156e3f['calleridname'];recordings[_0x156e3f[_0x3391('0x11')]]['connectedlinenum']=_0x156e3f[_0x3391('0x29')];recordings[_0x156e3f[_0x3391('0x11')]][_0x3391('0x2a')]=_0x156e3f[_0x3391('0x2a')];if(recordings[_0x156e3f[_0x3391('0x11')]][_0x3391('0x2b')]=='outbound'&&recordings[_0x156e3f['uniqueid']][_0x3391('0x4')]){recordings[_0x156e3f[_0x3391('0x11')]][_0x3391('0x29')]=recordings[_0x156e3f['uniqueid']][_0x3391('0x4')];recordings[_0x156e3f['uniqueid']][_0x3391('0x2a')]='';}recordings[_0x156e3f[_0x3391('0x11')]][_0x3391('0x21')]['forEach'](function(_0x40b90d){var _0x4f138b=_[_0x3391('0x2c')](recordings[_0x156e3f[_0x3391('0x11')]]);_0x4f138b[_0x3391('0x1e')]=_0x40b90d[_0x3391('0x1e')];writeDB(_0x4f138b);});delete recordings[_0x156e3f['uniqueid']];}}catch(_0x1627a8){utils[_0x3391('0x13')](util[_0x3391('0x2')](_0x3391('0x24'),_0x156e3f[_0x3391('0x11')]),_0x1627a8);}};exports['newexten']=function(_0x36ef22){try{if(!_[_0x3391('0x19')](recordings[_0x36ef22['uniqueid']])){utils['debug'](util[_0x3391('0x2')](_0x3391('0x2d'),_0x36ef22['uniqueid']),_0x36ef22);utils['info'](util['format'](_0x3391('0x2e'),_0x36ef22['uniqueid'],_0x36ef22[_0x3391('0x2f')],_0x36ef22[_0x3391('0x30')]));if(_0x36ef22[_0x3391('0x2f')][_0x3391('0x31')]()=='set'&&_[_0x3391('0x32')](_0x36ef22[_0x3391('0x30')][_0x3391('0x31')](),_0x3391('0x33'))){var _0x505e61=_0x36ef22[_0x3391('0x30')][_0x3391('0x34')]('=');var _0x388d4c=_0x505e61[0x0][_0x3391('0x35')](_0x505e61[0x0][_0x3391('0x36')]('(')+0x1,_0x505e61[0x0][_0x3391('0x36')](')'));var _0x2b89a6=_0x505e61[0x1];recordings[_0x36ef22[_0x3391('0x11')]][_0x388d4c]=_0x2b89a6;}}}catch(_0x29ba4a){utils['error'](util[_0x3391('0x2')](_0x3391('0x2d'),_0x36ef22[_0x3391('0x11')]),_0x29ba4a);}};exports['queuecallerjoin']=function(_0x8bc5f1){try{if(!_['isNil'](recordings[_0x8bc5f1[_0x3391('0x11')]])){utils[_0x3391('0x1b')](util[_0x3391('0x2')](_0x3391('0x37'),_0x8bc5f1[_0x3391('0x11')]),_0x8bc5f1);utils[_0x3391('0x1')](util[_0x3391('0x2')](_0x3391('0x38'),_0x8bc5f1[_0x3391('0x11')],_0x8bc5f1[_0x3391('0x39')]));recordings[_0x8bc5f1[_0x3391('0x11')]][_0x3391('0x39')]=_0x8bc5f1[_0x3391('0x39')];}}catch(_0x473416){utils[_0x3391('0x13')](util[_0x3391('0x2')](_0x3391('0x37'),_0x8bc5f1[_0x3391('0x11')]),_0x473416);}}; \ No newline at end of file +var _0x6bd5=['channel','varset','variable','mixmonitor_filename','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','calleridnum','calleridname','cause-txt','connectedlinenum','connectedlinename','outbound','forEach','clone','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','startsWith','appdata','toLowerCase','cdr','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','./utils','format','uniqueid','accountcode','getUserByInternal','membername','name','UserId','request','CreateVoiceRecording','newchannel','[%s][recordings][newchannel]','linkedid','info','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','error','debug','[%s][recordings][newstate]','isNil','channelstate'];(function(_0x19c6f2,_0x565e42){var _0x2813d6=function(_0x3d4c24){while(--_0x3d4c24){_0x19c6f2['push'](_0x19c6f2['shift']());}};_0x2813d6(++_0x565e42);}(_0x6bd5,0x114));var _0x56bd=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0x6bd5[_0x1da527];return _0x40fc7c;};'use strict';var _=require(_0x56bd('0x0'));var util=require(_0x56bd('0x1'));var utils=require(_0x56bd('0x2'));var recordings={};function writeDB(_0x798903){utils['info'](util[_0x56bd('0x3')]('[%s][recordings][writeDB]',_0x798903[_0x56bd('0x4')]));if(_0x798903[_0x56bd('0x5')]){utils[_0x56bd('0x6')](_0x798903[_0x56bd('0x5')])['then'](function(_0x3249f0){if(_0x3249f0){_0x798903[_0x56bd('0x7')]=_0x3249f0[_0x56bd('0x8')];_0x798903[_0x56bd('0x9')]=_0x3249f0['id'];}utils[_0x56bd('0xa')](_0x56bd('0xb'),_0x798903);});}else{utils[_0x56bd('0xa')](_0x56bd('0xb'),_0x798903);}}exports[_0x56bd('0xc')]=function(_0x21726a){try{utils['debug'](util[_0x56bd('0x3')](_0x56bd('0xd'),_0x21726a[_0x56bd('0x4')]),_0x21726a);if(_0x21726a[_0x56bd('0x4')]==_0x21726a[_0x56bd('0xe')]){utils[_0x56bd('0xf')](util[_0x56bd('0x3')](_0x56bd('0x10'),_0x21726a[_0x56bd('0x4')],_0x21726a[_0x56bd('0x11')],_0x21726a[_0x56bd('0x12')]));recordings[_0x21726a[_0x56bd('0x4')]]={'uniqueid':_0x21726a['uniqueid'],'accountcode':_0x21726a[_0x56bd('0x5')],'exten':_0x21726a[_0x56bd('0x12')],'context':_0x21726a[_0x56bd('0x11')],'channel':_0x21726a['channel'],'monitors':[]};}}catch(_0x2635ed){utils[_0x56bd('0x13')](util[_0x56bd('0x3')]('[%s][recordings][newchannel]',_0x21726a[_0x56bd('0x4')]),_0x2635ed);}};exports['newstate']=function(_0x4f8d18){try{utils[_0x56bd('0x14')](util['format'](_0x56bd('0x15'),_0x4f8d18['uniqueid']),_0x4f8d18);if(!_[_0x56bd('0x16')](recordings[_0x4f8d18[_0x56bd('0x4')]])&&_0x4f8d18[_0x56bd('0x17')]==0x6){utils['info'](util[_0x56bd('0x3')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x4f8d18[_0x56bd('0x4')],_0x4f8d18[_0x56bd('0x11')],_0x4f8d18[_0x56bd('0x18')]));}else if(!_['isNil'](recordings[_0x4f8d18[_0x56bd('0xe')]])&&_0x4f8d18[_0x56bd('0x17')]==0x6&&_0x4f8d18[_0x56bd('0x11')]!='transfer'){utils[_0x56bd('0xf')](util[_0x56bd('0x3')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x4f8d18['uniqueid'],_0x4f8d18['linkedid'],_0x4f8d18[_0x56bd('0x11')],_0x4f8d18[_0x56bd('0x18')]));recordings[_0x4f8d18['linkedid']][_0x56bd('0x5')]=_0x4f8d18['accountcode'];}}catch(_0x402f1a){utils[_0x56bd('0x13')](util[_0x56bd('0x3')](_0x56bd('0x15'),_0x4f8d18[_0x56bd('0x4')]),_0x402f1a);}};exports[_0x56bd('0x19')]=function(_0x15eba6){try{if(!_[_0x56bd('0x16')](_0x15eba6[_0x56bd('0x1a')])&&!_[_0x56bd('0x16')](_0x15eba6[_0x56bd('0x1a')][_0x56bd('0x1b')])){utils[_0x56bd('0x14')](util[_0x56bd('0x3')]('[%s][recordings][varset]',_0x15eba6['uniqueid']),_0x15eba6);utils[_0x56bd('0xf')](util[_0x56bd('0x3')](_0x56bd('0x1c'),_0x15eba6[_0x56bd('0x4')],_0x15eba6[_0x56bd('0x1a')],_0x15eba6[_0x56bd('0x1d')]));if(_[_0x56bd('0x1e')](_0x15eba6[_0x56bd('0x1d')],_0x56bd('0x1f'))){_0x15eba6['value']=_0x15eba6[_0x56bd('0x1d')][_0x56bd('0x20')](_0x56bd('0x1f'),_0x56bd('0x21'));}if(recordings[_0x15eba6['linkedid']]){var _0xd3c8da=_['find'](recordings[_0x15eba6[_0x56bd('0xe')]][_0x56bd('0x22')],{'value':_0x15eba6[_0x56bd('0x1d')]});if(_[_0x56bd('0x16')](_0xd3c8da)){recordings[_0x15eba6[_0x56bd('0xe')]][_0x56bd('0x22')][_0x56bd('0x23')]({'value':_0x15eba6['value']});}}}}catch(_0x22c977){utils[_0x56bd('0x13')](util[_0x56bd('0x3')]('[%s][recordings][varset]',_0x15eba6[_0x56bd('0x4')]),_0x22c977);}};exports[_0x56bd('0x24')]=function(_0x466a40){try{if(!_['isNil'](recordings[_0x466a40['uniqueid']])){utils[_0x56bd('0x14')](util[_0x56bd('0x3')](_0x56bd('0x25'),_0x466a40[_0x56bd('0x4')]),_0x466a40);utils[_0x56bd('0xf')](util[_0x56bd('0x3')]('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x466a40[_0x56bd('0x4')],_0x466a40[_0x56bd('0x26')],_0x466a40[_0x56bd('0x27')],_0x466a40[_0x56bd('0x28')]));recordings[_0x466a40[_0x56bd('0x4')]][_0x56bd('0x26')]=_0x466a40[_0x56bd('0x26')];recordings[_0x466a40['uniqueid']][_0x56bd('0x27')]=_0x466a40['calleridname'];recordings[_0x466a40[_0x56bd('0x4')]][_0x56bd('0x29')]=_0x466a40[_0x56bd('0x29')];recordings[_0x466a40[_0x56bd('0x4')]][_0x56bd('0x2a')]=_0x466a40[_0x56bd('0x2a')];if(recordings[_0x466a40[_0x56bd('0x4')]]['type']==_0x56bd('0x2b')&&recordings[_0x466a40[_0x56bd('0x4')]][_0x56bd('0x5')]){recordings[_0x466a40[_0x56bd('0x4')]]['connectedlinenum']=recordings[_0x466a40[_0x56bd('0x4')]]['accountcode'];recordings[_0x466a40[_0x56bd('0x4')]]['connectedlinename']='';}recordings[_0x466a40['uniqueid']]['monitors'][_0x56bd('0x2c')](function(_0x43750c){var _0x5f1619=_[_0x56bd('0x2d')](recordings[_0x466a40[_0x56bd('0x4')]]);_0x5f1619[_0x56bd('0x1d')]=_0x43750c[_0x56bd('0x1d')];writeDB(_0x5f1619);});delete recordings[_0x466a40[_0x56bd('0x4')]];}}catch(_0x18f211){utils[_0x56bd('0x13')](util['format'](_0x56bd('0x25'),_0x466a40[_0x56bd('0x4')]),_0x18f211);}};exports[_0x56bd('0x2e')]=function(_0x2ed15c){try{if(!_['isNil'](recordings[_0x2ed15c[_0x56bd('0x4')]])){utils[_0x56bd('0x14')](util['format'](_0x56bd('0x2f'),_0x2ed15c[_0x56bd('0x4')]),_0x2ed15c);utils[_0x56bd('0xf')](util[_0x56bd('0x3')](_0x56bd('0x30'),_0x2ed15c[_0x56bd('0x4')],_0x2ed15c[_0x56bd('0x31')],_0x2ed15c['appdata']));if(_0x2ed15c[_0x56bd('0x31')]['toLowerCase']()=='set'&&_[_0x56bd('0x32')](_0x2ed15c[_0x56bd('0x33')][_0x56bd('0x34')](),_0x56bd('0x35'))){var _0x289284=_0x2ed15c['appdata']['split']('=');var _0x5e3ff3=_0x289284[0x0][_0x56bd('0x36')](_0x289284[0x0][_0x56bd('0x37')]('(')+0x1,_0x289284[0x0]['lastIndexOf'](')'));var _0x2c8128=_0x289284[0x1];recordings[_0x2ed15c[_0x56bd('0x4')]][_0x5e3ff3]=_0x2c8128;}}}catch(_0x1c07c9){utils[_0x56bd('0x13')](util[_0x56bd('0x3')](_0x56bd('0x2f'),_0x2ed15c[_0x56bd('0x4')]),_0x1c07c9);}};exports[_0x56bd('0x38')]=function(_0x3f5b3c){try{if(!_[_0x56bd('0x16')](recordings[_0x3f5b3c[_0x56bd('0x4')]])){utils['debug'](util[_0x56bd('0x3')](_0x56bd('0x39'),_0x3f5b3c['uniqueid']),_0x3f5b3c);utils[_0x56bd('0xf')](util['format'](_0x56bd('0x3a'),_0x3f5b3c[_0x56bd('0x4')],_0x3f5b3c[_0x56bd('0x3b')]));recordings[_0x3f5b3c[_0x56bd('0x4')]]['queue']=_0x3f5b3c[_0x56bd('0x3b')];}}catch(_0x1f7af3){utils[_0x56bd('0x13')](util[_0x56bd('0x3')]('[%s][recordings][queuecallerjoin]',_0x3f5b3c[_0x56bd('0x4')]),_0x1f7af3);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 1e7b38b..9b3d6bb 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 _0x0d36=['blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridname','attendedtransfer','debug','[%s][transfers][attendedtransfer]','origtransfereruniqueid','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetcontext','transfertargetexten','transfertargetlinkedid','util','./utils','info','format','uniqueid','type','CreateVoiceTransferReport'];(function(_0x3a1e93,_0x3d6b9c){var _0x24b998=function(_0x5817e9){while(--_0x5817e9){_0x3a1e93['push'](_0x3a1e93['shift']());}};_0x24b998(++_0x3d6b9c);}(_0x0d36,0xfc));var _0x60d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x0d36[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require(_0x60d3('0x0'));var utils=require(_0x60d3('0x1'));function writeDB(_0x24b371){utils[_0x60d3('0x2')](util[_0x60d3('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x24b371['type']==='attended'?_0x24b371['origtransfereruniqueid']:_0x24b371[_0x60d3('0x4')],_0x24b371[_0x60d3('0x5')]));utils['request'](_0x60d3('0x6'),_0x24b371);}exports[_0x60d3('0x7')]=function(_0x5026a1){try{utils['debug'](util['format'](_0x60d3('0x8'),_0x5026a1[_0x60d3('0x4')]),_0x5026a1);utils[_0x60d3('0x2')](util[_0x60d3('0x3')](_0x60d3('0x9'),_0x5026a1[_0x60d3('0x4')],_0x5026a1[_0x60d3('0xa')],_0x5026a1[_0x60d3('0xb')],_0x5026a1['transfereecalleridnum'],_0x5026a1[_0x60d3('0xc')]));_0x5026a1[_0x60d3('0x5')]='blind';writeDB(_0x5026a1);}catch(_0x2d1470){utils['error'](util[_0x60d3('0x3')](_0x60d3('0x8'),_0x5026a1[_0x60d3('0x4')]),_0x2d1470);}};exports[_0x60d3('0xd')]=function(_0x2ff761){try{utils[_0x60d3('0xe')](util[_0x60d3('0x3')](_0x60d3('0xf'),_0x2ff761[_0x60d3('0x10')]),_0x2ff761);utils[_0x60d3('0x2')](util[_0x60d3('0x3')](_0x60d3('0x11'),_0x2ff761[_0x60d3('0x10')],_0x2ff761['origtransferercalleridnum'],_0x2ff761[_0x60d3('0x12')],_0x2ff761[_0x60d3('0x13')],_0x2ff761[_0x60d3('0x14')]));_0x2ff761=_[_0x60d3('0x15')](_0x2ff761,{'transfererchannel':_0x2ff761[_0x60d3('0x16')],'transferercalleridnum':_0x2ff761[_0x60d3('0x17')],'transferercalleridname':_0x2ff761[_0x60d3('0x12')],'transfererconnectedlinenum':_0x2ff761[_0x60d3('0x18')],'transfererconnectedlinename':_0x2ff761[_0x60d3('0x19')],'transfereraccountcode':_0x2ff761[_0x60d3('0x1a')],'transferercontext':_0x2ff761['secondtransferercontext'],'transfererexten':_0x2ff761[_0x60d3('0x1b')],'transfererlinkedid':_0x2ff761[_0x60d3('0x1c')],'context':_0x2ff761['origtransferercontext'],'extension':_0x2ff761[_0x60d3('0x1d')],'type':'attended'});if(_[_0x60d3('0x1e')](_0x2ff761[_0x60d3('0x1f')])){_0x2ff761=_['assign'](_0x2ff761,{'transfereechannel':_0x2ff761[_0x60d3('0x20')],'transfereecalleridnum':_0x2ff761[_0x60d3('0x13')],'transfereecalleridname':_0x2ff761['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x2ff761['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x2ff761[_0x60d3('0x21')],'transfereeaccountcode':_0x2ff761['transfertargetaccountcode'],'transfereecontext':_0x2ff761[_0x60d3('0x22')],'transfereeexten':_0x2ff761[_0x60d3('0x23')],'transfereelinkedid':_0x2ff761[_0x60d3('0x24')]});}writeDB(_0x2ff761);}catch(_0x2d9187){utils['error'](util['format'](_0x60d3('0xf'),_0x2ff761['origtransfereruniqueid']),_0x2d9187);}}; \ No newline at end of file +var _0xa0b0=['assign','origtransferercalleridnum','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','error','[%s][transfers][attendedtransfer]','lodash','./utils','info','format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','request','CreateVoiceTransferReport','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','uniqueid','transfereecalleridnum','transfereecalleridname','blind','attendedtransfer','debug','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname'];(function(_0x46952f,_0x508142){var _0x5e2b31=function(_0xf94c25){while(--_0xf94c25){_0x46952f['push'](_0x46952f['shift']());}};_0x5e2b31(++_0x508142);}(_0xa0b0,0x122));var _0x0a0b=function(_0x2e9a26,_0x464d38){_0x2e9a26=_0x2e9a26-0x0;var _0x4259c2=_0xa0b0[_0x2e9a26];return _0x4259c2;};'use strict';var _=require(_0x0a0b('0x0'));var util=require('util');var utils=require(_0x0a0b('0x1'));function writeDB(_0x28c21d){utils[_0x0a0b('0x2')](util[_0x0a0b('0x3')](_0x0a0b('0x4'),_0x28c21d[_0x0a0b('0x5')]===_0x0a0b('0x6')?_0x28c21d[_0x0a0b('0x7')]:_0x28c21d['uniqueid'],_0x28c21d['type']));utils[_0x0a0b('0x8')](_0x0a0b('0x9'),_0x28c21d);}exports['blindtransfer']=function(_0x2dcfa9){try{utils['debug'](util['format'](_0x0a0b('0xa'),_0x2dcfa9['uniqueid']),_0x2dcfa9);utils[_0x0a0b('0x2')](util[_0x0a0b('0x3')](_0x0a0b('0xb'),_0x2dcfa9[_0x0a0b('0xc')],_0x2dcfa9['transferercalleridnum'],_0x2dcfa9['transferercalleridname'],_0x2dcfa9[_0x0a0b('0xd')],_0x2dcfa9[_0x0a0b('0xe')]));_0x2dcfa9[_0x0a0b('0x5')]=_0x0a0b('0xf');writeDB(_0x2dcfa9);}catch(_0x49ca05){utils['error'](util['format'](_0x0a0b('0xa'),_0x2dcfa9[_0x0a0b('0xc')]),_0x49ca05);}};exports[_0x0a0b('0x10')]=function(_0x22a2db){try{utils[_0x0a0b('0x11')](util[_0x0a0b('0x3')]('[%s][transfers][attendedtransfer]',_0x22a2db[_0x0a0b('0x7')]),_0x22a2db);utils[_0x0a0b('0x2')](util[_0x0a0b('0x3')](_0x0a0b('0x12'),_0x22a2db[_0x0a0b('0x7')],_0x22a2db['origtransferercalleridnum'],_0x22a2db[_0x0a0b('0x13')],_0x22a2db[_0x0a0b('0x14')],_0x22a2db[_0x0a0b('0x15')]));_0x22a2db=_[_0x0a0b('0x16')](_0x22a2db,{'transfererchannel':_0x22a2db['origtransfererchannel'],'transferercalleridnum':_0x22a2db[_0x0a0b('0x17')],'transferercalleridname':_0x22a2db[_0x0a0b('0x13')],'transfererconnectedlinenum':_0x22a2db[_0x0a0b('0x18')],'transfererconnectedlinename':_0x22a2db[_0x0a0b('0x19')],'transfereraccountcode':_0x22a2db[_0x0a0b('0x1a')],'transferercontext':_0x22a2db['secondtransferercontext'],'transfererexten':_0x22a2db[_0x0a0b('0x1b')],'transfererlinkedid':_0x22a2db[_0x0a0b('0x1c')],'context':_0x22a2db[_0x0a0b('0x1d')],'extension':_0x22a2db[_0x0a0b('0x1e')],'type':'attended'});if(_['isNil'](_0x22a2db[_0x0a0b('0x1f')])){_0x22a2db=_[_0x0a0b('0x16')](_0x22a2db,{'transfereechannel':_0x22a2db[_0x0a0b('0x20')],'transfereecalleridnum':_0x22a2db[_0x0a0b('0x14')],'transfereecalleridname':_0x22a2db[_0x0a0b('0x15')],'transfereeconnectedlinenum':_0x22a2db[_0x0a0b('0x21')],'transfereeconnectedlinename':_0x22a2db['transfertargetconnectedlinename'],'transfereeaccountcode':_0x22a2db[_0x0a0b('0x22')],'transfereecontext':_0x22a2db['transfertargetcontext'],'transfereeexten':_0x22a2db[_0x0a0b('0x23')],'transfereelinkedid':_0x22a2db[_0x0a0b('0x24')]});}writeDB(_0x22a2db);}catch(_0x581357){utils[_0x0a0b('0x25')](util[_0x0a0b('0x3')](_0x0a0b('0x26'),_0x22a2db[_0x0a0b('0x7')]),_0x581357);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index a902432..dfae02b 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 _0x4351=['GetUser','interface','[utils][getUser]\x20where:%s','stringify','result','length','getUserByInternal','then','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','catch','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','[utils][getUserByName]','getVoiceQueueByName','name','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]','add','format','subtractTime','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','xdr','info','inspect','debug','error','request'];(function(_0x1d2ab8,_0x2db0f9){var _0x5df751=function(_0x16952e){while(--_0x16952e){_0x1d2ab8['push'](_0x1d2ab8['shift']());}};_0x5df751(++_0x2db0f9);}(_0x4351,0x1b5));var _0x1435=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0x4351[_0x1d9aa0];return _0x226868;};'use strict';var BPromise=require(_0x1435('0x0'));var jayson=require(_0x1435('0x1'));var moment=require(_0x1435('0x2'));var util=require(_0x1435('0x3'));var client=jayson[_0x1435('0x4')][_0x1435('0x5')]({'port':0x2329});var logger=require(_0x1435('0x6'))(_0x1435('0x7'));exports[_0x1435('0x8')]=function(_0x2fa227,_0x111bc6){logger[_0x1435('0x8')](_0x2fa227,_0x111bc6?util[_0x1435('0x9')](_0x111bc6,{'showHidden':![],'depth':null}):'');};exports[_0x1435('0xa')]=function(_0x337fd6,_0x56ce86){logger[_0x1435('0xa')](_0x337fd6,_0x56ce86?util['inspect'](_0x56ce86,{'showHidden':![],'depth':null}):'');};exports['error']=function(_0x3d0e0b,_0x22a221){logger[_0x1435('0xb')](_0x3d0e0b,_0x22a221?util[_0x1435('0x9')](_0x22a221,{'showHidden':![],'depth':null}):'');};exports[_0x1435('0xc')]=function(_0x55cd88,_0x1628ca){return client[_0x1435('0xc')](_0x55cd88,{'body':_0x1628ca})['then'](function(_0x58531b){logger[_0x1435('0xa')]('[utils][request]\x20name:%s',_0x55cd88,_0x58531b?util[_0x1435('0x9')](_0x58531b,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x1632ac){logger['error']('[utils][request]\x20name:%s',_0x55cd88,_0x1632ac?util['inspect'](_0x1632ac,{'showHidden':![],'depth':null}):'');});};function getUser(_0x3a4a62){return client[_0x1435('0xc')](_0x1435('0xd'),{'options':{'raw':!![],'attributes':['id','internal','name',_0x1435('0xe')],'where':_0x3a4a62,'limit':0x1}})['then'](function(_0x39405c){logger[_0x1435('0xa')](_0x1435('0xf'),JSON[_0x1435('0x10')](_0x3a4a62),_0x39405c?util[_0x1435('0x9')](_0x39405c,{'showHidden':![],'depth':null}):'');return _0x39405c[_0x1435('0x11')][_0x1435('0x12')]?_0x39405c[_0x1435('0x11')][0x0]:null;});}exports[_0x1435('0x13')]=function(_0x189f4a){return new BPromise(function(_0x430367,_0x19c9fe){if(_0x189f4a){return getUser({'internal':_0x189f4a})[_0x1435('0x14')](function(_0xb6995b){logger[_0x1435('0x8')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x189f4a,_0xb6995b?_0x1435('0x15'):_0x1435('0x16'));return _0x430367(_0xb6995b);})['catch'](function(_0x4694cb){logger['error'](_0x1435('0x17'),_0x4694cb?util[_0x1435('0x9')](_0x4694cb,{'showHidden':![],'depth':null}):'');return _0x430367(null);});}return _0x430367(null);});};exports[_0x1435('0x18')]=function(_0x28bc0a){return new BPromise(function(_0x2551d5,_0x1213a7){if(_0x28bc0a){return getUser({'interface':_0x28bc0a})['then'](function(_0x17ed76){logger[_0x1435('0x8')](_0x1435('0x19'),_0x28bc0a,_0x17ed76?_0x1435('0x15'):_0x1435('0x16'));return _0x2551d5(_0x17ed76);})[_0x1435('0x1a')](function(_0x302831){logger[_0x1435('0xb')](_0x1435('0x1b'),_0x302831?util[_0x1435('0x9')](_0x302831,{'showHidden':![],'depth':null}):'');return _0x2551d5(null);});}return _0x2551d5(null);});};exports[_0x1435('0x1c')]=function(_0x5f0e15){return new BPromise(function(_0x523792,_0x22241f){if(_0x5f0e15){return getUser({'name':_0x5f0e15})[_0x1435('0x14')](function(_0x3d452f){logger['info'](_0x1435('0x1d'),_0x5f0e15,_0x3d452f?_0x1435('0x15'):_0x1435('0x16'));return _0x523792(_0x3d452f);})[_0x1435('0x1a')](function(_0x24f328){logger['error'](_0x1435('0x1e'),_0x24f328?util[_0x1435('0x9')](_0x24f328,{'showHidden':![],'depth':null}):'');return _0x523792(null);});}return _0x523792(null);});};exports[_0x1435('0x1f')]=function(_0x453d68){return new BPromise(function(_0x1c3b7e,_0x108c25){if(_0x453d68){return client[_0x1435('0xc')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x1435('0x20'),_0x1435('0x21'),_0x1435('0x22'),_0x1435('0x23')],'where':{'name':_0x453d68},'limit':0x1}})[_0x1435('0x14')](function(_0x49649f){logger[_0x1435('0xa')](_0x1435('0x24'),_0x453d68,_0x49649f?util[_0x1435('0x9')](_0x49649f,{'showHidden':![],'depth':null}):'');logger[_0x1435('0x8')]('[utils][getVoiceQueueByName]\x20name:%s\x20%s',_0x453d68,_0x49649f?_0x1435('0x15'):_0x1435('0x16'));return _0x1c3b7e(_0x49649f['result'][_0x1435('0x12')]?_0x49649f['result'][0x0]:null);})[_0x1435('0x1a')](function(_0x1ea6a6){logger['error'](_0x1435('0x25'),_0x1ea6a6?util[_0x1435('0x9')](_0x1ea6a6,{'showHidden':![],'depth':null}):'');return _0x1c3b7e(null);});}return _0x1c3b7e(null);});};exports['addTime']=function(_0x4e10db,_0x5c5075){return moment(_0x4e10db)[_0x1435('0x26')](_0x5c5075,'seconds')[_0x1435('0x27')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x1435('0x28')]=function(_0x48b68f,_0x1bfdfc){return moment(_0x48b68f)[_0x1435('0x29')](_0x1bfdfc,_0x1435('0x2a'))[_0x1435('0x27')](_0x1435('0x2b'));};exports[_0x1435('0x2c')]=function(_0x4a51a1,_0x1fe8dd){return moment(_0x4a51a1)[_0x1435('0x2d')](moment(_0x1fe8dd),_0x1435('0x2a'));};exports[_0x1435('0x2e')]=function(_0x310a28,_0x592e22){return parseInt(_0x310a28,0xa)+parseInt(_0x592e22,0xa);};exports[_0x1435('0x2f')]=function(){return moment()['format'](_0x1435('0x2b'));};exports[_0x1435('0x30')]=function(_0x55e16c,_0x11cf64){if(_0x11cf64){return moment(_0x55e16c)[_0x1435('0x30')](_0x11cf64);}return!![];};exports[_0x1435('0x31')]=function(_0xed44d5,_0x228238){if(_0x228238){return moment(_0xed44d5)[_0x1435('0x31')](_0x228238);}else if(_0xed44d5){return!![];}return![];}; \ No newline at end of file +var _0x9adc=['now','isAfter','isBefore','bluebird','moment','util','client','http','info','inspect','debug','error','request','[utils][request]\x20name:%s','GetUser','internal','name','interface','then','stringify','result','[utils][getUserByInternal]\x20internal:%s\x20%s','found','catch','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound','[utils][getUserByName]\x20name:%s\x20%s','getVoiceQueueByName','type','acw','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','length','[utils][getVoiceQueueByName]','add','seconds','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','format','diffTime','sumTime'];(function(_0x8147c4,_0x3e73f5){var _0x47abe9=function(_0x52bdfc){while(--_0x52bdfc){_0x8147c4['push'](_0x8147c4['shift']());}};_0x47abe9(++_0x3e73f5);}(_0x9adc,0xaf));var _0xc9ad=function(_0x2b9678,_0x3509ca){_0x2b9678=_0x2b9678-0x0;var _0x350b95=_0x9adc[_0x2b9678];return _0x350b95;};'use strict';var BPromise=require(_0xc9ad('0x0'));var jayson=require('jayson/promise');var moment=require(_0xc9ad('0x1'));var util=require(_0xc9ad('0x2'));var client=jayson[_0xc9ad('0x3')][_0xc9ad('0x4')]({'port':0x2329});var logger=require('../../config/logger')('xdr');exports[_0xc9ad('0x5')]=function(_0x2995cd,_0x1e1093){logger[_0xc9ad('0x5')](_0x2995cd,_0x1e1093?util[_0xc9ad('0x6')](_0x1e1093,{'showHidden':![],'depth':null}):'');};exports[_0xc9ad('0x7')]=function(_0x4a0dd5,_0x46ea17){logger['debug'](_0x4a0dd5,_0x46ea17?util['inspect'](_0x46ea17,{'showHidden':![],'depth':null}):'');};exports[_0xc9ad('0x8')]=function(_0x208221,_0x278c7f){logger[_0xc9ad('0x8')](_0x208221,_0x278c7f?util[_0xc9ad('0x6')](_0x278c7f,{'showHidden':![],'depth':null}):'');};exports[_0xc9ad('0x9')]=function(_0x33b45d,_0x11a33c){return client['request'](_0x33b45d,{'body':_0x11a33c})['then'](function(_0x1ee0cf){logger['debug'](_0xc9ad('0xa'),_0x33b45d,_0x1ee0cf?util[_0xc9ad('0x6')](_0x1ee0cf,{'showHidden':![],'depth':null}):'');})['catch'](function(_0x283375){logger[_0xc9ad('0x8')](_0xc9ad('0xa'),_0x33b45d,_0x283375?util[_0xc9ad('0x6')](_0x283375,{'showHidden':![],'depth':null}):'');});};function getUser(_0x461f26){return client[_0xc9ad('0x9')](_0xc9ad('0xb'),{'options':{'raw':!![],'attributes':['id',_0xc9ad('0xc'),_0xc9ad('0xd'),_0xc9ad('0xe')],'where':_0x461f26,'limit':0x1}})[_0xc9ad('0xf')](function(_0x5f389f){logger[_0xc9ad('0x7')]('[utils][getUser]\x20where:%s',JSON[_0xc9ad('0x10')](_0x461f26),_0x5f389f?util[_0xc9ad('0x6')](_0x5f389f,{'showHidden':![],'depth':null}):'');return _0x5f389f[_0xc9ad('0x11')]['length']?_0x5f389f[_0xc9ad('0x11')][0x0]:null;});}exports['getUserByInternal']=function(_0x1eb070){return new BPromise(function(_0x4b6222,_0xb06375){if(_0x1eb070){return getUser({'internal':_0x1eb070})['then'](function(_0x54df6a){logger[_0xc9ad('0x5')](_0xc9ad('0x12'),_0x1eb070,_0x54df6a?_0xc9ad('0x13'):'notfound');return _0x4b6222(_0x54df6a);})[_0xc9ad('0x14')](function(_0x5bf5ff){logger[_0xc9ad('0x8')]('[utils][getUserByInternal]',_0x5bf5ff?util[_0xc9ad('0x6')](_0x5bf5ff,{'showHidden':![],'depth':null}):'');return _0x4b6222(null);});}return _0x4b6222(null);});};exports[_0xc9ad('0x15')]=function(_0x1ef42e){return new BPromise(function(_0x2e7d53,_0x39a008){if(_0x1ef42e){return getUser({'interface':_0x1ef42e})[_0xc9ad('0xf')](function(_0x45fddc){logger[_0xc9ad('0x5')](_0xc9ad('0x16'),_0x1ef42e,_0x45fddc?_0xc9ad('0x13'):_0xc9ad('0x17'));return _0x2e7d53(_0x45fddc);})[_0xc9ad('0x14')](function(_0x5c2025){logger['error']('[utils][getUserByInterface]',_0x5c2025?util[_0xc9ad('0x6')](_0x5c2025,{'showHidden':![],'depth':null}):'');return _0x2e7d53(null);});}return _0x2e7d53(null);});};exports['getUserByName']=function(_0x189067){return new BPromise(function(_0x32852b,_0x2738f){if(_0x189067){return getUser({'name':_0x189067})[_0xc9ad('0xf')](function(_0x30f5d2){logger['info'](_0xc9ad('0x18'),_0x189067,_0x30f5d2?'found':'notfound');return _0x32852b(_0x30f5d2);})['catch'](function(_0x730617){logger['error']('[utils][getUserByName]',_0x730617?util[_0xc9ad('0x6')](_0x730617,{'showHidden':![],'depth':null}):'');return _0x32852b(null);});}return _0x32852b(null);});};exports[_0xc9ad('0x19')]=function(_0x16a918){return new BPromise(function(_0x1dc8a3,_0x52ca4c){if(_0x16a918){return client['request']('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xc9ad('0xd'),_0xc9ad('0x1a'),_0xc9ad('0x1b'),'acwTimeout'],'where':{'name':_0x16a918},'limit':0x1}})[_0xc9ad('0xf')](function(_0x24092c){logger[_0xc9ad('0x7')](_0xc9ad('0x1c'),_0x16a918,_0x24092c?util[_0xc9ad('0x6')](_0x24092c,{'showHidden':![],'depth':null}):'');logger[_0xc9ad('0x5')](_0xc9ad('0x1d'),_0x16a918,_0x24092c?_0xc9ad('0x13'):_0xc9ad('0x17'));return _0x1dc8a3(_0x24092c[_0xc9ad('0x11')][_0xc9ad('0x1e')]?_0x24092c[_0xc9ad('0x11')][0x0]:null);})[_0xc9ad('0x14')](function(_0xe08901){logger[_0xc9ad('0x8')](_0xc9ad('0x1f'),_0xe08901?util['inspect'](_0xe08901,{'showHidden':![],'depth':null}):'');return _0x1dc8a3(null);});}return _0x1dc8a3(null);});};exports['addTime']=function(_0x4527dd,_0x494e50){return moment(_0x4527dd)[_0xc9ad('0x20')](_0x494e50,_0xc9ad('0x21'))['format'](_0xc9ad('0x22'));};exports[_0xc9ad('0x23')]=function(_0x4dcda5,_0xc2462b){return moment(_0x4dcda5)[_0xc9ad('0x24')](_0xc2462b,_0xc9ad('0x21'))[_0xc9ad('0x25')](_0xc9ad('0x22'));};exports[_0xc9ad('0x26')]=function(_0x3ceb25,_0x375de1){return moment(_0x3ceb25)['diff'](moment(_0x375de1),_0xc9ad('0x21'));};exports[_0xc9ad('0x27')]=function(_0x4e4ab6,_0x580647){return parseInt(_0x4e4ab6,0xa)+parseInt(_0x580647,0xa);};exports[_0xc9ad('0x28')]=function(){return moment()['format'](_0xc9ad('0x22'));};exports[_0xc9ad('0x29')]=function(_0x54d425,_0x11fc1b){if(_0x11fc1b){return moment(_0x54d425)[_0xc9ad('0x29')](_0x11fc1b);}return!![];};exports[_0xc9ad('0x2a')]=function(_0x116dd2,_0x1e0ec){if(_0x1e0ec){return moment(_0x116dd2)[_0xc9ad('0x2a')](_0x1e0ec);}else if(_0x116dd2){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 d6526b1..16a0e6c 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 _0x3bc3=['method','connection','name','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston','util','./loggers','fileLogger','safeTemplate','maskSensitiveData','join','/var','log','xcally','role','then','client','catch','user','timestamp','api','client-side-logger','use','logger','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','remoteAddress','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id'];(function(_0x4d7dac,_0x296dcf){var _0x3d6782=function(_0x288c09){while(--_0x288c09){_0x4d7dac['push'](_0x4d7dac['shift']());}};_0x3d6782(++_0x296dcf);}(_0x3bc3,0xb3));var _0x33bc=function(_0x2f9062,_0xb1f10d){_0x2f9062=_0x2f9062-0x0;var _0x17307c=_0x3bc3[_0x2f9062];return _0x17307c;};var fs=require(_0x33bc('0x0'));var _=require(_0x33bc('0x1'));var ewinston=require(_0x33bc('0x2'));var path=require('path');var util=require(_0x33bc('0x3'));var fileLogger=require(_0x33bc('0x4'))[_0x33bc('0x5')];var safeTemplate=require('./safe-template')[_0x33bc('0x6')];var maskSensitiveData=require('./mask-sensitive-data')[_0x33bc('0x7')];function ClientSideLogger(){function _0x2f4487(_0x84e283){var _0x440403=path[_0x33bc('0x8')](_0x33bc('0x9'),_0x33bc('0xa'),_0x33bc('0xb'));var _0xb9897b=path['join']('client',_0x84e283[_0x33bc('0xc')]+'-'+_0x84e283['name']);return fs['ensureDir'](path[_0x33bc('0x8')](_0x440403,_0xb9897b))[_0x33bc('0xd')](function(){var _0x3e99b5=fileLogger(_0x33bc('0xe'),path[_0x33bc('0x8')](_0x440403,_0xb9897b));return _0x3e99b5;})[_0x33bc('0xf')](function(_0x3fb08d){throw _0x3fb08d;});}this[_0x33bc('0xa')]=function(_0x26dd65,_0x5941f5,_0x17f34f,_0x3d2517){return _0x2f4487(_0x26dd65[_0x33bc('0x10')])[_0x33bc('0xd')](function(_0x8e65a3){var _0x555610=_0x8e65a3[_0x5941f5];return _0x555610;})[_0x33bc('0xd')](function(_0x4dcff1){var _0x3a7a8b=_0x26dd65[_0x33bc('0x10')]?_0x26dd65[_0x33bc('0x10')]['id']:'no-user';var _0x58112a=_0x3d2517['data'];var _0x4abde7=_0x3d2517[_0x33bc('0x11')];var _0x1417c3=new Date(Number(_0x4abde7));return _0x4dcff1(_0x3a7a8b,_0x1417c3,_0x17f34f,_0x58112a);})[_0x33bc('0xf')](function(_0xaaa743){fileLogger(_0x33bc('0xe'))['error'](_0xaaa743);});};}function setupLoggers(_0x5c6168){return new Promise(function(_0x137e53){var _0x59ff2f=new ClientSideLogger();var _0x9f3b26=fileLogger(_0x33bc('0x12'));var _0x546f7a=fileLogger('auth');_0x5c6168['set'](_0x33bc('0x13'),_0x59ff2f);_0x5c6168[_0x33bc('0x14')](ewinston[_0x33bc('0x15')]({'winstonInstance':_0x9f3b26,'meta':![],'statusLevels':!![],'msg':function(_0x3ba13b,_0x1bffbf){var _0x1739a4='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x33bc('0x16')](_0x3ba13b[_0x33bc('0x17')])){_0x1739a4+=_0x33bc('0x18');var _0x143d6a=_0x3ba13b['body'];maskSensitiveData(_0x143d6a);}return safeTemplate(util[_0x33bc('0x19')](_0x1739a4,_0x3ba13b['method'],_0x3ba13b[_0x33bc('0x1a')][_0x33bc('0x1b')]?_0x3ba13b[_0x33bc('0x1a')][_0x33bc('0x1b')]:_0x3ba13b['connection'][_0x33bc('0x1c')]||_0x3ba13b['ip'],_0x3ba13b[_0x33bc('0x1d')],_0x1bffbf[_0x33bc('0x1e')],_0x1bffbf[_0x33bc('0x1f')],_0x3ba13b['user']?_0x3ba13b['user']['id']:null,_0x3ba13b[_0x33bc('0x10')]?_0x3ba13b[_0x33bc('0x10')]['name']:null,_0x3ba13b['user']?_0x3ba13b['user'][_0x33bc('0xc')]:null,_0x143d6a?util[_0x33bc('0x20')](_0x143d6a,![],null):''));}}));_0x5c6168[_0x33bc('0x14')](ewinston['logger']({'winstonInstance':_0x546f7a,'meta':![],'statusLevels':!![],'msg':function(_0x47f733,_0x337a24){var _0xe16903=_0x33bc('0x21');if(_0x47f733[_0x33bc('0x17')]&&_0x47f733[_0x33bc('0x17')][_0x33bc('0x22')]&&_0x47f733[_0x33bc('0x17')][_0x33bc('0x23')]){_0xe16903='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x33bc('0x19')](_0xe16903,_0x47f733[_0x33bc('0x24')],_0x47f733[_0x33bc('0x1a')][_0x33bc('0x1b')]?_0x47f733[_0x33bc('0x1a')][_0x33bc('0x1b')]:_0x47f733[_0x33bc('0x25')]['remoteAddress']||_0x47f733['ip'],_0x47f733['url'],_0x337a24[_0x33bc('0x1e')],_0x337a24[_0x33bc('0x1f')],_0x47f733[_0x33bc('0x10')]?_0x47f733[_0x33bc('0x10')]['id']:null,_0x47f733[_0x33bc('0x10')]?_0x47f733[_0x33bc('0x10')][_0x33bc('0x26')]:null,_0x47f733['user']?_0x47f733[_0x33bc('0x10')][_0x33bc('0xc')]:null,_0x47f733[_0x33bc('0x17')]&&_0x47f733[_0x33bc('0x17')][_0x33bc('0x22')]?_0x47f733[_0x33bc('0x17')][_0x33bc('0x22')]:_0x33bc('0x27'),_0x47f733[_0x33bc('0x17')]&&_0x47f733['body'][_0x33bc('0x23')]?_0x47f733[_0x33bc('0x17')][_0x33bc('0x23')]:'',_0x47f733[_0x33bc('0x17')]&&_0x47f733[_0x33bc('0x17')][_0x33bc('0x28')]?_0x47f733['body'][_0x33bc('0x28')]:'');},'ignoreRoute':function(_0x52241d){var _0x2c616a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x2c616a[_0x33bc('0x29')](_0x52241d['url']);}}));return _0x137e53();});}exports[_0x33bc('0x2a')]=setupLoggers; \ No newline at end of file +var _0xd832=['setupLoggers','fs-extra','lodash','path','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','role','name','ensureDir','then','user','no-user','data','timestamp','error','api','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','body','format','method','headers','x-forwarded-for','url','statusCode','responseTime','inspect','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','connection','remoteAddress','other','agent_name','test'];(function(_0x252e71,_0x54c106){var _0x43545c=function(_0x1c6539){while(--_0x1c6539){_0x252e71['push'](_0x252e71['shift']());}};_0x43545c(++_0x54c106);}(_0xd832,0x184));var _0x2d83=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xd832[_0x166d93];return _0xba708;};var fs=require(_0x2d83('0x0'));var _=require(_0x2d83('0x1'));var ewinston=require('express-winston');var path=require(_0x2d83('0x2'));var util=require('util');var fileLogger=require('./loggers')['fileLogger'];var safeTemplate=require('./safe-template')[_0x2d83('0x3')];var maskSensitiveData=require(_0x2d83('0x4'))[_0x2d83('0x5')];function ClientSideLogger(){function _0x5be1cf(_0xbf6fd2){var _0x3f79fd=path[_0x2d83('0x6')](_0x2d83('0x7'),_0x2d83('0x8'),'xcally');var _0x2e549a=path[_0x2d83('0x6')]('client',_0xbf6fd2[_0x2d83('0x9')]+'-'+_0xbf6fd2[_0x2d83('0xa')]);return fs[_0x2d83('0xb')](path['join'](_0x3f79fd,_0x2e549a))[_0x2d83('0xc')](function(){var _0x2fbe40=fileLogger('client',path[_0x2d83('0x6')](_0x3f79fd,_0x2e549a));return _0x2fbe40;})['catch'](function(_0x4c610a){throw _0x4c610a;});}this[_0x2d83('0x8')]=function(_0x2351db,_0x32e189,_0x38c780,_0x3325d0){return _0x5be1cf(_0x2351db[_0x2d83('0xd')])[_0x2d83('0xc')](function(_0x2edd86){var _0x98dafc=_0x2edd86[_0x32e189];return _0x98dafc;})[_0x2d83('0xc')](function(_0x5e40fe){var _0x499fa6=_0x2351db['user']?_0x2351db[_0x2d83('0xd')]['id']:_0x2d83('0xe');var _0x4b3ed7=_0x3325d0[_0x2d83('0xf')];var _0x55d3e9=_0x3325d0[_0x2d83('0x10')];var _0x2d88a8=new Date(Number(_0x55d3e9));return _0x5e40fe(_0x499fa6,_0x2d88a8,_0x38c780,_0x4b3ed7);})['catch'](function(_0x201185){fileLogger('client')[_0x2d83('0x11')](_0x201185);});};}function setupLoggers(_0x4929dc){return new Promise(function(_0x36aadf){var _0x18e768=new ClientSideLogger();var _0x39714c=fileLogger(_0x2d83('0x12'));var _0x51ddd7=fileLogger('auth');_0x4929dc[_0x2d83('0x13')](_0x2d83('0x14'),_0x18e768);_0x4929dc[_0x2d83('0x15')](ewinston[_0x2d83('0x16')]({'winstonInstance':_0x39714c,'meta':![],'statusLevels':!![],'msg':function(_0x2c88fd,_0x4898fb){var _0x540c50=_0x2d83('0x17');if(!_['isEmpty'](_0x2c88fd[_0x2d83('0x18')])){_0x540c50+='\x20body=%s';var _0x1ae49a=_0x2c88fd[_0x2d83('0x18')];maskSensitiveData(_0x1ae49a);}return safeTemplate(util[_0x2d83('0x19')](_0x540c50,_0x2c88fd[_0x2d83('0x1a')],_0x2c88fd[_0x2d83('0x1b')][_0x2d83('0x1c')]?_0x2c88fd['headers'][_0x2d83('0x1c')]:_0x2c88fd['connection']['remoteAddress']||_0x2c88fd['ip'],_0x2c88fd[_0x2d83('0x1d')],_0x4898fb[_0x2d83('0x1e')],_0x4898fb[_0x2d83('0x1f')],_0x2c88fd['user']?_0x2c88fd['user']['id']:null,_0x2c88fd['user']?_0x2c88fd['user'][_0x2d83('0xa')]:null,_0x2c88fd['user']?_0x2c88fd[_0x2d83('0xd')][_0x2d83('0x9')]:null,_0x1ae49a?util[_0x2d83('0x20')](_0x1ae49a,![],null):''));}}));_0x4929dc['use'](ewinston['logger']({'winstonInstance':_0x51ddd7,'meta':![],'statusLevels':!![],'msg':function(_0x747659,_0x551c9c){var _0x8509eb=_0x2d83('0x21');if(_0x747659[_0x2d83('0x18')]&&_0x747659[_0x2d83('0x18')][_0x2d83('0x22')]&&_0x747659[_0x2d83('0x18')][_0x2d83('0x23')]){_0x8509eb=_0x2d83('0x24');}return util[_0x2d83('0x19')](_0x8509eb,_0x747659[_0x2d83('0x1a')],_0x747659[_0x2d83('0x1b')][_0x2d83('0x1c')]?_0x747659[_0x2d83('0x1b')]['x-forwarded-for']:_0x747659[_0x2d83('0x25')][_0x2d83('0x26')]||_0x747659['ip'],_0x747659[_0x2d83('0x1d')],_0x551c9c['statusCode'],_0x551c9c[_0x2d83('0x1f')],_0x747659[_0x2d83('0xd')]?_0x747659[_0x2d83('0xd')]['id']:null,_0x747659['user']?_0x747659[_0x2d83('0xd')][_0x2d83('0xa')]:null,_0x747659[_0x2d83('0xd')]?_0x747659[_0x2d83('0xd')][_0x2d83('0x9')]:null,_0x747659['body']&&_0x747659[_0x2d83('0x18')]['device']?_0x747659['body'][_0x2d83('0x22')]:_0x2d83('0x27'),_0x747659[_0x2d83('0x18')]&&_0x747659[_0x2d83('0x18')]['agent_id']?_0x747659[_0x2d83('0x18')]['agent_id']:'',_0x747659[_0x2d83('0x18')]&&_0x747659[_0x2d83('0x18')][_0x2d83('0x28')]?_0x747659[_0x2d83('0x18')]['agent_name']:'');},'ignoreRoute':function(_0x28d43c){var _0x37d443=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x37d443[_0x2d83('0x29')](_0x28d43c[_0x2d83('0x1d')]);}}));return _0x36aadf();});}exports[_0x2d83('0x2a')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index e8cc5f5..eebca09 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc481=['locale','weekdaysShort','toLowerCase','indexOf','slice','monthsShort','concat','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','endOf','isBetween','timeCompare','format','includes','dowCompare','date','max','min','domCompare','MMM','monthCompare','guess','isMoment','length','iftime','map','source','join','Interval\x20string\x20not\x20valid','isValid','split'];(function(_0x106b08,_0xf1ad34){var _0x2835c9=function(_0xfcab73){while(--_0xfcab73){_0x106b08['push'](_0x106b08['shift']());}};_0x2835c9(++_0xf1ad34);}(_0xc481,0x8a));var _0x1c48=function(_0x8abd64,_0x539570){_0x8abd64=_0x8abd64-0x0;var _0xd2511e=_0xc481[_0x8abd64];return _0xd2511e;};var _=require('lodash');var moment=require('moment-timezone');var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x1c48('0x0')](function(_0x309812){return _0x309812[_0x1c48('0x1')];})[_0x1c48('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x1c48('0x3');var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x2cee93){if(!_0x2cee93[_0x1c48('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x123253){var _0x16269b=_0x123253[_0x1c48('0x5')](':')['map'](function(_0x45e3f3){return parseInt(_0x45e3f3,0xa);});var _0xc9f185=_0x16269b[0x0];var _0x56b38c=_0x16269b[0x1];if(_0xc9f185<0x0||_0xc9f185>0x17||_0x56b38c<0x0||_0x56b38c>0x3b){throw new Error(EINVALID_DATE);}return[_0xc9f185,_0x56b38c];}function circularDoWInterval(_0x1bad22,_0x216acb){if(_0x1bad22===_0x216acb){return[_0x1bad22];}else{var _0x4ac3e9=moment['locale']();moment[_0x1c48('0x6')]('en');var _0x23c873=moment[_0x1c48('0x7')]()['map'](function(_0x3be0fb){return _0x3be0fb[_0x1c48('0x8')]();});moment[_0x1c48('0x6')](_0x4ac3e9);var _0x44731f=_0x23c873[_0x1c48('0x9')](_0x1bad22);var _0x349b11=_0x23c873['indexOf'](_0x216acb);if(_0x349b11>_0x44731f){return _0x23c873[_0x1c48('0xa')](_0x44731f,_0x349b11+0x1);}else{var _0x34361e=_0x23c873[_0x1c48('0xa')](0x0,_0x349b11+0x1);var _0x2d7b52=_0x23c873[_0x1c48('0xa')](_0x44731f);return _0x2d7b52['concat'](_0x34361e);}}}module['exports']['circularDoWInterval']=circularDoWInterval;function circularMonthInterval(_0xa95525,_0x2b4790){if(_0xa95525===_0x2b4790){return[_0xa95525];}else{var _0x40518c=moment['locale']();moment[_0x1c48('0x6')]('en');var _0x2e0fb6=moment[_0x1c48('0xb')]()[_0x1c48('0x0')](function(_0x5de825){return _0x5de825[_0x1c48('0x8')]();});moment[_0x1c48('0x6')](_0x40518c);var _0x593f20=_0x2e0fb6[_0x1c48('0x9')](_0xa95525);var _0x222c3a=_0x2e0fb6['indexOf'](_0x2b4790);if(_0x222c3a>_0x593f20){return _0x2e0fb6[_0x1c48('0xa')](_0x593f20,_0x222c3a+0x1);}else{var _0x3f9926=_0x2e0fb6[_0x1c48('0xa')](0x0,_0x222c3a+0x1);var _0x16f319=_0x2e0fb6['slice'](_0x593f20);return _0x16f319[_0x1c48('0xc')](_0x3f9926);}}}module[_0x1c48('0xd')][_0x1c48('0xe')]=circularMonthInterval;function parseDom(_0x3fbf76){var _0x2c0e9e=parseInt(_0x3fbf76,0xa);if(_0x2c0e9e<0x1||_0x2c0e9e>0x1f){throw new Error(EINVALID_DATE);}return _0x2c0e9e;}function timeCompare(_0x33fba5,_0x35f7fa,_0x57f6de){var _0x3c1508=_0x33fba5[_0x1c48('0xf')]();var _0x3709d0=extractTime(_0x35f7fa);var _0x44b4e1=_0x3709d0[0x0];var _0x5b325b=_0x3709d0[0x1];var _0x1b95e4=_0x33fba5[_0x1c48('0xf')]()[_0x1c48('0x10')](_0x44b4e1)[_0x1c48('0x11')](_0x5b325b);throwIfDateNotValid(_0x1b95e4);var _0x193128=extractTime(_0x57f6de);var _0x5983d1=_0x193128[0x0];var _0x288c34=_0x193128[0x1];var _0x1ed139=_0x33fba5[_0x1c48('0xf')]()[_0x1c48('0x10')](_0x5983d1)['minutes'](_0x288c34);throwIfDateNotValid(_0x1ed139);if(_0x1ed139[_0x1c48('0x12')](_0x1b95e4)){var _0x3f54ce=_0x3c1508[_0x1c48('0xf')]()[_0x1c48('0x13')]('day');var _0x7d7242=_0x3c1508[_0x1c48('0xf')]()[_0x1c48('0x14')]('day');return _0x3c1508[_0x1c48('0x15')](_0x1b95e4,_0x7d7242,undefined,'[]')||_0x3c1508[_0x1c48('0x15')](_0x3f54ce,_0x1ed139,undefined,'[]');}else{return _0x3c1508[_0x1c48('0x15')](_0x1b95e4,_0x1ed139,undefined,'[]');}}module['exports'][_0x1c48('0x16')]=timeCompare;function dowCompare(_0x47dfff,_0x392a76,_0x4dda1b){var _0x3333d3=_0x47dfff[_0x1c48('0x6')]('en')[_0x1c48('0x17')]('ddd')[_0x1c48('0x8')]();return circularDoWInterval(_0x392a76,_0x4dda1b)[_0x1c48('0x18')](_0x3333d3);}module[_0x1c48('0xd')][_0x1c48('0x19')]=dowCompare;function domCompare(_0x1e4318,_0x5d1305,_0x4ef4c9){var _0x1d31a9=_0x1e4318[_0x1c48('0x1a')]();if(_0x5d1305===_0x4ef4c9){return _0x1d31a9===_0x5d1305;}else{var _0x594be5=_0x1e4318['daysInMonth']();var _0x3530cc=_0x5d1305<_0x4ef4c9;let _0x3cc478=![];var _0x3f312b=0x0;var _0x56eb15=0x0;if(_0x3530cc){_0x3f312b=Math[_0x1c48('0x1b')](0x1,_0x5d1305);_0x56eb15=Math[_0x1c48('0x1c')](_0x4ef4c9,_0x594be5);_0x3cc478=_0x1d31a9>=_0x3f312b&&_0x1d31a9<=_0x56eb15;}else{_0x3f312b=Math[_0x1c48('0x1c')](_0x5d1305,_0x594be5);_0x56eb15=Math[_0x1c48('0x1b')](0x1,_0x4ef4c9);_0x3cc478=_0x1d31a9>=_0x3f312b||_0x1d31a9<=_0x56eb15;}return _0x3cc478;}}module[_0x1c48('0xd')][_0x1c48('0x1d')]=domCompare;function monthCompare(_0x556bfe,_0x2071c7,_0x5eb51b){var _0x5023fe=_0x556bfe[_0x1c48('0x6')]('en')[_0x1c48('0x17')](_0x1c48('0x1e'))[_0x1c48('0x8')]();return circularMonthInterval(_0x2071c7,_0x5eb51b)[_0x1c48('0x18')](_0x5023fe);}module[_0x1c48('0xd')][_0x1c48('0x1f')]=monthCompare;function iftime(_0x3c6c07,_0xdb0756=moment['tz'][_0x1c48('0x20')](),_0x4a151c=moment()){if(!validateRx['test'](_0x3c6c07)){throw new Error(EINVALID_STRING);}else{var _0x2e13ff=(moment[_0x1c48('0x21')](_0x4a151c)?_0x4a151c[_0x1c48('0xf')]():moment(_0x4a151c))['tz'](_0xdb0756)[_0x1c48('0x6')]('en');throwIfDateNotValid(_0x2e13ff);var _0x4455e4=_0x3c6c07[_0x1c48('0x5')](',');var _0x3e8fec=_0x4455e4[0x0];var _0x5b8e44=_0x4455e4[0x1];var _0x1fe100=_0x4455e4[0x2];var _0x1ff0b7=_0x4455e4[0x3];let _0x16011b=!![];if(_0x3e8fec!=='*'){var _0x433dba=_0x3e8fec['split']('-');var _0x2e0ba6=_['padStart'](_0x433dba[0x0],0x5,'0');var _0xa19566=_0x433dba[_0x1c48('0x22')]===0x2?_['padStart'](_0x433dba[0x1],0x5,'0'):_0x2e0ba6;_0x16011b=timeCompare(_0x2e13ff,_0x2e0ba6,_0xa19566);}let _0x80cc39=!![];if(_0x5b8e44!=='*'){var _0x92c23c=_0x5b8e44[_0x1c48('0x5')]('-');var _0x1c23d9=_0x92c23c[0x0];var _0x280a50=_0x92c23c[_0x1c48('0x22')]===0x2?_0x92c23c[0x1]:_0x1c23d9;_0x80cc39=dowCompare(_0x2e13ff,_0x1c23d9,_0x280a50);}let _0x3b2ea7=!![];if(_0x1fe100!=='*'){var _0x2db08e=_0x1fe100[_0x1c48('0x5')]('-');var _0x545273=parseDom(_0x2db08e[0x0]);var _0x5478b0=_0x2db08e['length']===0x2?parseDom(_0x2db08e[0x1]):_0x545273;_0x3b2ea7=domCompare(_0x2e13ff,_0x545273,_0x5478b0);}let _0x20c0e4=!![];if(_0x1ff0b7!=='*'){var _0x478606=_0x1ff0b7[_0x1c48('0x5')]('-');var _0x4ac50=_0x478606[0x0];var _0x544fa2=_0x478606['length']===0x2?_0x478606[0x1]:_0x478606[0x0];_0x20c0e4=monthCompare(_0x2e13ff,_0x4ac50,_0x544fa2);}return _0x16011b&&_0x80cc39&&_0x3b2ea7&&_0x20c0e4;}}module[_0x1c48('0xd')][_0x1c48('0x23')]=iftime; \ No newline at end of file +var _0x9dc5=['locale','weekdaysShort','toLowerCase','indexOf','slice','circularDoWInterval','monthsShort','concat','exports','clone','hours','minutes','isBefore','startOf','endOf','day','isBetween','timeCompare','format','ddd','includes','date','max','min','domCompare','MMM','isMoment','padStart','length','iftime','lodash','moment-timezone','map','source','isValid','split'];(function(_0x53cff1,_0x2f94be){var _0x177ae6=function(_0x480040){while(--_0x480040){_0x53cff1['push'](_0x53cff1['shift']());}};_0x177ae6(++_0x2f94be);}(_0x9dc5,0x162));var _0x59dc=function(_0x21d6ea,_0x5c79ea){_0x21d6ea=_0x21d6ea-0x0;var _0x3dd45d=_0x9dc5[_0x21d6ea];return _0x3dd45d;};var _=require(_0x59dc('0x0'));var moment=require(_0x59dc('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x59dc('0x2')](function(_0x428306){return _0x428306[_0x59dc('0x3')];})['join'](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING='Interval\x20string\x20not\x20valid';var EINVALID_DATE='Date\x20not\x20valid';function throwIfDateNotValid(_0x4ffba1){if(!_0x4ffba1[_0x59dc('0x4')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x3094c8){var _0x5e091b=_0x3094c8[_0x59dc('0x5')](':')['map'](function(_0x32b832){return parseInt(_0x32b832,0xa);});var _0x672760=_0x5e091b[0x0];var _0x36e2b8=_0x5e091b[0x1];if(_0x672760<0x0||_0x672760>0x17||_0x36e2b8<0x0||_0x36e2b8>0x3b){throw new Error(EINVALID_DATE);}return[_0x672760,_0x36e2b8];}function circularDoWInterval(_0x1ce0b9,_0x3606d8){if(_0x1ce0b9===_0x3606d8){return[_0x1ce0b9];}else{var _0xd622b0=moment[_0x59dc('0x6')]();moment[_0x59dc('0x6')]('en');var _0x455d52=moment[_0x59dc('0x7')]()[_0x59dc('0x2')](function(_0x5a2dea){return _0x5a2dea[_0x59dc('0x8')]();});moment[_0x59dc('0x6')](_0xd622b0);var _0x10ad2c=_0x455d52[_0x59dc('0x9')](_0x1ce0b9);var _0xa90a8c=_0x455d52['indexOf'](_0x3606d8);if(_0xa90a8c>_0x10ad2c){return _0x455d52[_0x59dc('0xa')](_0x10ad2c,_0xa90a8c+0x1);}else{var _0x50427f=_0x455d52[_0x59dc('0xa')](0x0,_0xa90a8c+0x1);var _0x4e7a13=_0x455d52['slice'](_0x10ad2c);return _0x4e7a13['concat'](_0x50427f);}}}module['exports'][_0x59dc('0xb')]=circularDoWInterval;function circularMonthInterval(_0x25e7c9,_0x23a025){if(_0x25e7c9===_0x23a025){return[_0x25e7c9];}else{var _0x5ded7f=moment[_0x59dc('0x6')]();moment[_0x59dc('0x6')]('en');var _0x2f1bee=moment[_0x59dc('0xc')]()[_0x59dc('0x2')](function(_0x3cb4b2){return _0x3cb4b2[_0x59dc('0x8')]();});moment[_0x59dc('0x6')](_0x5ded7f);var _0x2779e9=_0x2f1bee[_0x59dc('0x9')](_0x25e7c9);var _0x558f40=_0x2f1bee[_0x59dc('0x9')](_0x23a025);if(_0x558f40>_0x2779e9){return _0x2f1bee[_0x59dc('0xa')](_0x2779e9,_0x558f40+0x1);}else{var _0x107e2d=_0x2f1bee[_0x59dc('0xa')](0x0,_0x558f40+0x1);var _0x13064f=_0x2f1bee[_0x59dc('0xa')](_0x2779e9);return _0x13064f[_0x59dc('0xd')](_0x107e2d);}}}module[_0x59dc('0xe')]['circularMonthInterval']=circularMonthInterval;function parseDom(_0x25e24b){var _0x170f84=parseInt(_0x25e24b,0xa);if(_0x170f84<0x1||_0x170f84>0x1f){throw new Error(EINVALID_DATE);}return _0x170f84;}function timeCompare(_0xfdb5b5,_0x290790,_0xe482dd){var _0x2b9388=_0xfdb5b5[_0x59dc('0xf')]();var _0x5eaa71=extractTime(_0x290790);var _0x23f99e=_0x5eaa71[0x0];var _0x234e0b=_0x5eaa71[0x1];var _0x522bbd=_0xfdb5b5[_0x59dc('0xf')]()[_0x59dc('0x10')](_0x23f99e)['minutes'](_0x234e0b);throwIfDateNotValid(_0x522bbd);var _0x5a585c=extractTime(_0xe482dd);var _0x3baae5=_0x5a585c[0x0];var _0x51ae5e=_0x5a585c[0x1];var _0x8cf8cb=_0xfdb5b5[_0x59dc('0xf')]()['hours'](_0x3baae5)[_0x59dc('0x11')](_0x51ae5e);throwIfDateNotValid(_0x8cf8cb);if(_0x8cf8cb[_0x59dc('0x12')](_0x522bbd)){var _0x5adb4b=_0x2b9388[_0x59dc('0xf')]()[_0x59dc('0x13')]('day');var _0x5c36c1=_0x2b9388[_0x59dc('0xf')]()[_0x59dc('0x14')](_0x59dc('0x15'));return _0x2b9388[_0x59dc('0x16')](_0x522bbd,_0x5c36c1,undefined,'[]')||_0x2b9388['isBetween'](_0x5adb4b,_0x8cf8cb,undefined,'[]');}else{return _0x2b9388[_0x59dc('0x16')](_0x522bbd,_0x8cf8cb,undefined,'[]');}}module[_0x59dc('0xe')][_0x59dc('0x17')]=timeCompare;function dowCompare(_0x5aa30f,_0x38092d,_0x4fb42e){var _0x5f3c0c=_0x5aa30f[_0x59dc('0x6')]('en')[_0x59dc('0x18')](_0x59dc('0x19'))[_0x59dc('0x8')]();return circularDoWInterval(_0x38092d,_0x4fb42e)[_0x59dc('0x1a')](_0x5f3c0c);}module[_0x59dc('0xe')]['dowCompare']=dowCompare;function domCompare(_0x36c44a,_0x344745,_0x26c020){var _0x3510f1=_0x36c44a[_0x59dc('0x1b')]();if(_0x344745===_0x26c020){return _0x3510f1===_0x344745;}else{var _0x1808d5=_0x36c44a['daysInMonth']();var _0x2e7571=_0x344745<_0x26c020;let _0x5e37d7=![];var _0x59b023=0x0;var _0x40cb40=0x0;if(_0x2e7571){_0x59b023=Math[_0x59dc('0x1c')](0x1,_0x344745);_0x40cb40=Math[_0x59dc('0x1d')](_0x26c020,_0x1808d5);_0x5e37d7=_0x3510f1>=_0x59b023&&_0x3510f1<=_0x40cb40;}else{_0x59b023=Math['min'](_0x344745,_0x1808d5);_0x40cb40=Math[_0x59dc('0x1c')](0x1,_0x26c020);_0x5e37d7=_0x3510f1>=_0x59b023||_0x3510f1<=_0x40cb40;}return _0x5e37d7;}}module['exports'][_0x59dc('0x1e')]=domCompare;function monthCompare(_0x6c821c,_0xacd7a8,_0x4cafd1){var _0x1f7cd1=_0x6c821c[_0x59dc('0x6')]('en')[_0x59dc('0x18')](_0x59dc('0x1f'))[_0x59dc('0x8')]();return circularMonthInterval(_0xacd7a8,_0x4cafd1)[_0x59dc('0x1a')](_0x1f7cd1);}module['exports']['monthCompare']=monthCompare;function iftime(_0x5d9544,_0x516288=moment['tz']['guess'](),_0x348514=moment()){if(!validateRx['test'](_0x5d9544)){throw new Error(EINVALID_STRING);}else{var _0x522b96=(moment[_0x59dc('0x20')](_0x348514)?_0x348514[_0x59dc('0xf')]():moment(_0x348514))['tz'](_0x516288)['locale']('en');throwIfDateNotValid(_0x522b96);var _0x3178d8=_0x5d9544[_0x59dc('0x5')](',');var _0xaa8abb=_0x3178d8[0x0];var _0x452e0b=_0x3178d8[0x1];var _0x345b1d=_0x3178d8[0x2];var _0x524139=_0x3178d8[0x3];let _0x5674e2=!![];if(_0xaa8abb!=='*'){var _0x492e7c=_0xaa8abb[_0x59dc('0x5')]('-');var _0x3aa365=_[_0x59dc('0x21')](_0x492e7c[0x0],0x5,'0');var _0x29f174=_0x492e7c[_0x59dc('0x22')]===0x2?_[_0x59dc('0x21')](_0x492e7c[0x1],0x5,'0'):_0x3aa365;_0x5674e2=timeCompare(_0x522b96,_0x3aa365,_0x29f174);}let _0x286dea=!![];if(_0x452e0b!=='*'){var _0x485fcf=_0x452e0b[_0x59dc('0x5')]('-');var _0x5821e7=_0x485fcf[0x0];var _0x51cdae=_0x485fcf['length']===0x2?_0x485fcf[0x1]:_0x5821e7;_0x286dea=dowCompare(_0x522b96,_0x5821e7,_0x51cdae);}let _0x10fb65=!![];if(_0x345b1d!=='*'){var _0x4ac47c=_0x345b1d[_0x59dc('0x5')]('-');var _0x429adf=parseDom(_0x4ac47c[0x0]);var _0x4862cd=_0x4ac47c['length']===0x2?parseDom(_0x4ac47c[0x1]):_0x429adf;_0x10fb65=domCompare(_0x522b96,_0x429adf,_0x4862cd);}let _0x12f49a=!![];if(_0x524139!=='*'){var _0x356f4a=_0x524139[_0x59dc('0x5')]('-');var _0x496b90=_0x356f4a[0x0];var _0x2d3f6c=_0x356f4a[_0x59dc('0x22')]===0x2?_0x356f4a[0x1]:_0x356f4a[0x0];_0x12f49a=monthCompare(_0x522b96,_0x496b90,_0x2d3f6c);}return _0x5674e2&&_0x286dea&&_0x10fb65&&_0x12f49a;}}module[_0x59dc('0xe')][_0x59dc('0x23')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 2691e58..3cb1b29 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0d89=['warn','File','%s-%s','error','Console','consoleLogger','fileLogger','util','moment','winston','../config/environment','debugLevel','toLowerCase','info','red','bold\x20yellow','white','bold\x20white','gray','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','Logger','transports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0d89,0xcf));var _0x90d8=function(_0x43c48c,_0x287e91){_0x43c48c=_0x43c48c-0x0;var _0x595280=_0x0d89[_0x43c48c];return _0x595280;};'use strict';var path=require('path');var util=require(_0x90d8('0x0'));var moment=require(_0x90d8('0x1'));var winston=require(_0x90d8('0x2'));var config=require(_0x90d8('0x3'));var debugLevel=config[_0x90d8('0x4')]?config['debugLevel'][_0x90d8('0x5')]():_0x90d8('0x6');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':_0x90d8('0x7'),'warn':_0x90d8('0x8'),'info':_0x90d8('0x9'),'print':_0x90d8('0xa'),'success':'bold\x20green','http':_0x90d8('0xb'),'verbose':'bold\x20magenta','debug':_0x90d8('0xc'),'silly':_0x90d8('0xd')};winston[_0x90d8('0xe')](XC_LOG_COLORS);function getLogFileName(_0x344b04,_0xd10624,_0x301a8e){var _0x119bfb=_0x344b04||_0x90d8('0xf');return path[_0x90d8('0x10')](_0x119bfb,util[_0x90d8('0x11')](_0x90d8('0x12'),_0xd10624,_0x301a8e));}function formatter(_0x3b34b6,_0x9ff63a){_0x9ff63a[_0x90d8('0x13')]=_0x9ff63a[_0x90d8('0x13')][_0x90d8('0x14')](/@@{/g,_0x90d8('0x15'))[_0x90d8('0x14')](/}@@/g,_0x90d8('0x16'))['replace'](/@{/g,'{{')[_0x90d8('0x14')](/}@/g,'}}');return util[_0x90d8('0x11')](_0x90d8('0x17'),moment()[_0x90d8('0x11')](_0x90d8('0x18')),_0x9ff63a[_0x90d8('0x19')][_0x90d8('0x1a')](),_0x3b34b6,_0x9ff63a[_0x90d8('0x13')]);}function fileFormat(_0x4f2465,_0x11a81e){_0x11a81e[_0x90d8('0x13')]=_0x11a81e['message'][_0x90d8('0x14')](/@@{/g,_0x90d8('0x15'))['replace'](/}@@/g,_0x90d8('0x16'))[_0x90d8('0x14')](/@{/g,'{{')[_0x90d8('0x14')](/}@/g,'}}');var _0x51906d=_0x11a81e['meta']&&Object['keys'](_0x11a81e[_0x90d8('0x1b')])[_0x90d8('0x1c')]?'\x0a\x09'+JSON[_0x90d8('0x1d')](_0x11a81e[_0x90d8('0x1b')]):'';return util[_0x90d8('0x11')](_0x90d8('0x1e'),moment()[_0x90d8('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),_0x11a81e['level'][_0x90d8('0x1a')](),_0x4f2465,_0x11a81e[_0x90d8('0x13')],_0x51906d);}function consoleLogger(){var _0x4f2be1=new winston[(_0x90d8('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x90d8('0x20'))]['Console']({'level':_0x90d8('0x21'),'json':![],'formatter':function(_0xf29b8f){return formatter('',_0xf29b8f);}})]});return _0x4f2be1;}function fileLogger(_0x42e5d5,_0x4b9b64){var _0x8134ac=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x90d8('0x20'))][(_0x90d8('0x22'))]({'name':util[_0x90d8('0x11')](_0x90d8('0x23'),_0x42e5d5,_0x90d8('0x24')),'filename':getLogFileName(_0x4b9b64,_0x42e5d5,'error'),'level':_0x90d8('0x24'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x19ad0c){return fileFormat(_0x42e5d5,_0x19ad0c);}}),new winston[(_0x90d8('0x20'))][(_0x90d8('0x22'))]({'name':util[_0x90d8('0x11')](_0x90d8('0x23'),_0x42e5d5,debugLevel),'filename':getLogFileName(_0x4b9b64,_0x42e5d5,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1fb58e){return fileFormat(_0x42e5d5,_0x1fb58e);}}),new winston['transports'][(_0x90d8('0x25'))]({'level':'warn','json':![],'formatter':function(_0xafae12){return fileFormat(_0x42e5d5,_0xafae12);}})]});return _0x8134ac;}exports[_0x90d8('0x26')]=consoleLogger;exports[_0x90d8('0x27')]=fileLogger; \ No newline at end of file +var _0xed37=['bold\x20magenta','bold\x20blue','bold\x20cyan','addColors','join','message','replace','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','meta','keys','length','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','toUpperCase','Logger','transports','Console','warn','File','%s-%s','error','consoleLogger','path','util','moment','winston','debugLevel','toLowerCase','info','red','bold\x20yellow','white','bold\x20white','bold\x20green','gray'];(function(_0x42e4f9,_0x4087d7){var _0x5ad744=function(_0x1db3fc){while(--_0x1db3fc){_0x42e4f9['push'](_0x42e4f9['shift']());}};_0x5ad744(++_0x4087d7);}(_0xed37,0x152));var _0x7ed3=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xed37[_0x2641f9];return _0x585741;};'use strict';var path=require(_0x7ed3('0x0'));var util=require(_0x7ed3('0x1'));var moment=require(_0x7ed3('0x2'));var winston=require(_0x7ed3('0x3'));var config=require('../config/environment');var debugLevel=config['debugLevel']?config[_0x7ed3('0x4')][_0x7ed3('0x5')]():_0x7ed3('0x6');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':_0x7ed3('0x7'),'warn':_0x7ed3('0x8'),'info':_0x7ed3('0x9'),'print':_0x7ed3('0xa'),'success':_0x7ed3('0xb'),'http':_0x7ed3('0xc'),'verbose':_0x7ed3('0xd'),'debug':_0x7ed3('0xe'),'silly':_0x7ed3('0xf')};winston[_0x7ed3('0x10')](XC_LOG_COLORS);function getLogFileName(_0x56b18c,_0x8742c0,_0x2a2b75){var _0x120851=_0x56b18c||'/var/log/xcally';return path[_0x7ed3('0x11')](_0x120851,util['format']('%s-%s.log',_0x8742c0,_0x2a2b75));}function formatter(_0x3ab614,_0x161bb3){_0x161bb3[_0x7ed3('0x12')]=_0x161bb3[_0x7ed3('0x12')][_0x7ed3('0x13')](/@@{/g,'{{{')['replace'](/}@@/g,_0x7ed3('0x14'))[_0x7ed3('0x13')](/@{/g,'{{')[_0x7ed3('0x13')](/}@/g,'}}');return util[_0x7ed3('0x15')](_0x7ed3('0x16'),moment()[_0x7ed3('0x15')](_0x7ed3('0x17')),_0x161bb3[_0x7ed3('0x18')]['toUpperCase'](),_0x3ab614,_0x161bb3[_0x7ed3('0x12')]);}function fileFormat(_0x1a3e50,_0x106b1b){_0x106b1b[_0x7ed3('0x12')]=_0x106b1b['message'][_0x7ed3('0x13')](/@@{/g,'{{{')[_0x7ed3('0x13')](/}@@/g,_0x7ed3('0x14'))[_0x7ed3('0x13')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x1ecca4=_0x106b1b[_0x7ed3('0x19')]&&Object[_0x7ed3('0x1a')](_0x106b1b['meta'])[_0x7ed3('0x1b')]?'\x0a\x09'+JSON[_0x7ed3('0x1c')](_0x106b1b[_0x7ed3('0x19')]):'';return util[_0x7ed3('0x15')](_0x7ed3('0x1d'),moment()['format'](_0x7ed3('0x17')),_0x106b1b[_0x7ed3('0x18')][_0x7ed3('0x1e')](),_0x1a3e50,_0x106b1b[_0x7ed3('0x12')],_0x1ecca4);}function consoleLogger(){var _0x292289=new winston[(_0x7ed3('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x7ed3('0x20'))][(_0x7ed3('0x21'))]({'level':_0x7ed3('0x22'),'json':![],'formatter':function(_0x47b5b3){return formatter('',_0x47b5b3);}})]});return _0x292289;}function fileLogger(_0x256f73,_0x40c4cc){var _0x210e01=new winston[(_0x7ed3('0x1f'))]({'levels':XC_LOG_LEVELS,'transports':[new winston['transports'][(_0x7ed3('0x23'))]({'name':util['format'](_0x7ed3('0x24'),_0x256f73,_0x7ed3('0x25')),'filename':getLogFileName(_0x40c4cc,_0x256f73,'error'),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x30615c){return fileFormat(_0x256f73,_0x30615c);}}),new winston[(_0x7ed3('0x20'))][(_0x7ed3('0x23'))]({'name':util['format']('%s-%s',_0x256f73,debugLevel),'filename':getLogFileName(_0x40c4cc,_0x256f73,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x18069d){return fileFormat(_0x256f73,_0x18069d);}}),new winston[(_0x7ed3('0x20'))][(_0x7ed3('0x21'))]({'level':_0x7ed3('0x22'),'json':![],'formatter':function(_0x4838b8){return fileFormat(_0x256f73,_0x4838b8);}})]});return _0x210e01;}exports[_0x7ed3('0x26')]=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 4884311..ca537f7 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 _0x7a54=['code','accessKey','token','authToken','consumerKey','membername','exten','vidaooApiKey','clientEmail','privateKey','accesskeyid','secretaccesskey','key','pass','accountSid','localstationid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','replace','}@@','includes','exports','maskSensitiveData','lodash','username','password','apiKey','firstName','street','phone','mobile','fax','email','clientSecret'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a54,0x106));var _0x47a5=function(_0x3f5f7c,_0x14078d){_0x3f5f7c=_0x3f5f7c-0x0;var _0x46aec7=_0x7a54[_0x3f5f7c];return _0x46aec7;};var _=require(_0x47a5('0x0'));var sensitiveFields=[_0x47a5('0x1'),_0x47a5('0x2'),'newPassword',_0x47a5('0x3'),_0x47a5('0x4'),'lastName',_0x47a5('0x5'),_0x47a5('0x6'),_0x47a5('0x7'),_0x47a5('0x8'),_0x47a5('0x9'),'clientId',_0x47a5('0xa'),'securityToken',_0x47a5('0xb'),_0x47a5('0xc'),'tenantId',_0x47a5('0xd'),'channelSecret','accessToken','accessTokenSecret',_0x47a5('0xe'),_0x47a5('0xf'),'consumerSecret',_0x47a5('0x10'),'calleridname','calleridnum',_0x47a5('0x11'),_0x47a5('0x12'),_0x47a5('0x13'),_0x47a5('0x14'),_0x47a5('0x15'),_0x47a5('0x16'),_0x47a5('0x17'),'user',_0x47a5('0x18'),_0x47a5('0x19'),_0x47a5('0x1a'),_0x47a5('0x1b'),_0x47a5('0x1c'),_0x47a5('0x1d'),_0x47a5('0x1e')];function maskSensitiveData(_0x190faa){const _0x4e99a8=/(?!^)[\s\S](?!$)/g;if(_[_0x47a5('0x1f')](_0x190faa)){for(const _0x11faf5 in _0x190faa){if(_[_0x47a5('0x20')](_0x190faa[_0x11faf5])){for(let _0x2a2cbb=0x0;_0x2a2cbb<_0x190faa[_0x11faf5][_0x47a5('0x21')];_0x2a2cbb++){maskSensitiveData(_0x190faa[_0x11faf5][_0x2a2cbb]);}}else if(_['isPlainObject'](_0x190faa[_0x11faf5])){maskSensitiveData(_0x190faa[_0x11faf5]);}else if(_['isString'](_0x190faa[_0x11faf5])){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](/{{{/g,'@@{')['replace'](/}}}/g,_0x47a5('0x23'))[_0x47a5('0x22')](/{{/g,'@{')[_0x47a5('0x22')](/}}/g,'}@');if(_[_0x47a5('0x24')](sensitiveFields,_0x11faf5)){_0x190faa[_0x11faf5]=_0x190faa[_0x11faf5][_0x47a5('0x22')](_0x4e99a8,'*');}}}}}module[_0x47a5('0x25')][_0x47a5('0x26')]=maskSensitiveData; \ No newline at end of file +var _0x57ca=['accesskeyid','secretaccesskey','key','user','accountSid','dsn','secret','registry','oldPassword','isPlainObject','isArray','length','isString','@@{','replace','}@@','includes','exports','username','password','apiKey','firstName','lastName','street','phone','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','channelSecret','accessTokenSecret','authToken','consumerSecret','calleridname','calleridnum','vidaooApiKey','privateKey'];(function(_0x2064e5,_0x4f6fa2){var _0x21a233=function(_0x1b2491){while(--_0x1b2491){_0x2064e5['push'](_0x2064e5['shift']());}};_0x21a233(++_0x4f6fa2);}(_0x57ca,0x108));var _0xa57c=function(_0x1fd418,_0x4c96dd){_0x1fd418=_0x1fd418-0x0;var _0x4360d1=_0x57ca[_0x1fd418];return _0x4360d1;};var _=require('lodash');var sensitiveFields=[_0xa57c('0x0'),_0xa57c('0x1'),'newPassword',_0xa57c('0x2'),_0xa57c('0x3'),_0xa57c('0x4'),_0xa57c('0x5'),_0xa57c('0x6'),'mobile',_0xa57c('0x7'),_0xa57c('0x8'),_0xa57c('0x9'),_0xa57c('0xa'),_0xa57c('0xb'),_0xa57c('0xc'),_0xa57c('0xd'),_0xa57c('0xe'),'token',_0xa57c('0xf'),'accessToken',_0xa57c('0x10'),_0xa57c('0x11'),'consumerKey',_0xa57c('0x12'),'membername',_0xa57c('0x13'),_0xa57c('0x14'),'exten',_0xa57c('0x15'),'clientEmail',_0xa57c('0x16'),_0xa57c('0x17'),_0xa57c('0x18'),_0xa57c('0x19'),_0xa57c('0x1a'),'pass',_0xa57c('0x1b'),'localstationid',_0xa57c('0x1c'),_0xa57c('0x1d'),_0xa57c('0x1e'),_0xa57c('0x1f')];function maskSensitiveData(_0x3238ff){const _0x37a323=/(?!^)[\s\S](?!$)/g;if(_[_0xa57c('0x20')](_0x3238ff)){for(const _0x4b4bdb in _0x3238ff){if(_[_0xa57c('0x21')](_0x3238ff[_0x4b4bdb])){for(let _0xdf7ff6=0x0;_0xdf7ff6<_0x3238ff[_0x4b4bdb][_0xa57c('0x22')];_0xdf7ff6++){maskSensitiveData(_0x3238ff[_0x4b4bdb][_0xdf7ff6]);}}else if(_['isPlainObject'](_0x3238ff[_0x4b4bdb])){maskSensitiveData(_0x3238ff[_0x4b4bdb]);}else if(_[_0xa57c('0x23')](_0x3238ff[_0x4b4bdb])){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb]['replace'](/{{{/g,_0xa57c('0x24'))[_0xa57c('0x25')](/}}}/g,_0xa57c('0x26'))[_0xa57c('0x25')](/{{/g,'@{')[_0xa57c('0x25')](/}}/g,'}@');if(_[_0xa57c('0x27')](sensitiveFields,_0x4b4bdb)){_0x3238ff[_0x4b4bdb]=_0x3238ff[_0x4b4bdb][_0xa57c('0x25')](_0x37a323,'*');}}}}}module[_0xa57c('0x28')]['maskSensitiveData']=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/misc.js b/server/utils/misc.js index ad333f0..d8d8513 100644 --- a/server/utils/misc.js +++ b/server/utils/misc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x53ec=['exports','replace','\x5c$&'];(function(_0x1bf828,_0xd3919d){var _0x5deba2=function(_0x19d70d){while(--_0x19d70d){_0x1bf828['push'](_0x1bf828['shift']());}};_0x5deba2(++_0xd3919d);}(_0x53ec,0x192));var _0xc53e=function(_0x5811e5,_0x946ee2){_0x5811e5=_0x5811e5-0x0;var _0x1642da=_0x53ec[_0x5811e5];return _0x1642da;};module[_0xc53e('0x0')]={'escapeRegExp'(_0x173f4d,_0x2d5f51=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x173f4d[_0xc53e('0x1')](_0x2d5f51,_0xc53e('0x2'));}}; \ No newline at end of file +var _0x1261=['replace','\x5c$&'];(function(_0x2f6999,_0xe625be){var _0x362ff9=function(_0x281705){while(--_0x281705){_0x2f6999['push'](_0x2f6999['shift']());}};_0x362ff9(++_0xe625be);}(_0x1261,0x144));var _0x1126=function(_0x2962d5,_0x38deda){_0x2962d5=_0x2962d5-0x0;var _0x273406=_0x1261[_0x2962d5];return _0x273406;};module['exports']={'escapeRegExp'(_0x234ea5,_0x26c6a0=/[-[\]{}()*+?.,\\\/^$|#\s]/g){return _0x234ea5[_0x1126('0x0')](_0x26c6a0,_0x1126('0x1'));}}; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index d7c4f5a..1968972 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 _0x5c3c=['\x20}\x20}','string','replace','isArray','map','isPlainObject','keys','reduce','safeTemplate','lodash','{\x20{\x20'];(function(_0x231854,_0x161ebe){var _0x42a303=function(_0x53c587){while(--_0x53c587){_0x231854['push'](_0x231854['shift']());}};_0x42a303(++_0x161ebe);}(_0x5c3c,0x132));var _0xc5c3=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x5c3c[_0x513aa5];return _0x1a1a7c;};var _=require(_0xc5c3('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x40ad71){return _0x40ad71==='{{'?_0xc5c3('0x1'):_0xc5c3('0x2');}function safeTemplate(_0x4b9233){var _0x400726=_0x4b9233;if(typeof _0x4b9233===_0xc5c3('0x3')){_0x400726=_0x4b9233[_0xc5c3('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xc5c3('0x5')](_0x4b9233)){_0x400726=_0x4b9233[_0xc5c3('0x6')](function(_0x36525d){return safeTemplate(_0x36525d);});}else if(_[_0xc5c3('0x7')](_0x4b9233)){_0x400726=Object[_0xc5c3('0x8')](_0x4b9233)[_0xc5c3('0x9')](function(_0x5a392b,_0x4b8404){_0x5a392b[_0x4b8404]=safeTemplate(_0x4b9233[_0x4b8404]);return _0x5a392b;},{});}return _0x400726;}module['exports'][_0xc5c3('0xa')]=safeTemplate; \ No newline at end of file +var _0xef0f=['lodash','{\x20{\x20','\x20}\x20}','string','replace','isArray','isPlainObject','keys','reduce','safeTemplate'];(function(_0xf9b774,_0x1ad9fa){var _0x2230f5=function(_0x2f3ff0){while(--_0x2f3ff0){_0xf9b774['push'](_0xf9b774['shift']());}};_0x2230f5(++_0x1ad9fa);}(_0xef0f,0x168));var _0xfef0=function(_0x38080f,_0x2b7ce9){_0x38080f=_0x38080f-0x0;var _0x359a64=_0xef0f[_0x38080f];return _0x359a64;};var _=require(_0xfef0('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x581303){return _0x581303==='{{'?_0xfef0('0x1'):_0xfef0('0x2');}function safeTemplate(_0x19f865){var _0x4d29e5=_0x19f865;if(typeof _0x19f865===_0xfef0('0x3')){_0x4d29e5=_0x19f865[_0xfef0('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0xfef0('0x5')](_0x19f865)){_0x4d29e5=_0x19f865['map'](function(_0x2a6fcf){return safeTemplate(_0x2a6fcf);});}else if(_[_0xfef0('0x6')](_0x19f865)){_0x4d29e5=Object[_0xfef0('0x7')](_0x19f865)[_0xfef0('0x8')](function(_0xad43e,_0x11dfd7){_0xad43e[_0x11dfd7]=safeTemplate(_0x19f865[_0x11dfd7]);return _0xad43e;},{});}return _0x4d29e5;}module['exports'][_0xfef0('0x9')]=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index f2aeb9d..5b2980e 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x430a=['name','motion2','env','NODE_PATH','string','pathExists','then','readJSON','updated','info','Updating\x20app.json','writeJSON','exports','root','resolve','server/app.json','legacy-libs','apps'];(function(_0x114e51,_0x160ac7){var _0x446de9=function(_0x1275e0){while(--_0x1275e0){_0x114e51['push'](_0x114e51['shift']());}};_0x446de9(++_0x160ac7);}(_0x430a,0xaf));var _0xa430=function(_0x315b01,_0x583ac1){_0x315b01=_0x315b01-0x0;var _0x37c9c4=_0x430a[_0x315b01];return _0x37c9c4;};var fs=require('fs-extra');var path=require('path');var config=require('../config/environment');var root=config[_0xa430('0x0')];var APP_JSON_PATH=path[_0xa430('0x1')](root,_0xa430('0x2'));var NODEPATH=path['resolve'](root,_0xa430('0x3'));function setLegacyLibsNodeEnvPath(_0x2b69fa){let _0x2c356e=![];if(Array['isArray'](_0x2b69fa[_0xa430('0x4')])){var _0x18f4bb=_0x2b69fa[_0xa430('0x4')]['findIndex'](function(_0x284ef3){return _0x284ef3[_0xa430('0x5')]===_0xa430('0x6');});if(_0x18f4bb>-0x1){var _0x3b0be5=_0x2b69fa[_0xa430('0x4')][_0x18f4bb];if(typeof _0x3b0be5[_0xa430('0x7')][_0xa430('0x8')]!==_0xa430('0x9')){_0x3b0be5[_0xa430('0x7')][_0xa430('0x8')]=NODEPATH;_0x2c356e=!![];}}return{'appConfig':_0x2b69fa,'updated':_0x2c356e};}}function updateAppConfig(_0x5aea2d){return fs[_0xa430('0xa')](APP_JSON_PATH)[_0xa430('0xb')](function(_0x324e4c){if(_0x324e4c){return fs[_0xa430('0xc')](APP_JSON_PATH)['then'](function(_0x40485a){var _0xb14684=setLegacyLibsNodeEnvPath(_0x40485a);if(_0xb14684[_0xa430('0xd')]){_0x5aea2d[_0xa430('0xe')](_0xa430('0xf'));return fs[_0xa430('0x10')](APP_JSON_PATH,_0x40485a,{'spaces':0x2});}else{return Promise[_0xa430('0x1')]();}});}else{return Promise['resolve']();}});}module[_0xa430('0x11')]=updateAppConfig; \ No newline at end of file +var _0x8b1c=['legacy-libs','isArray','apps','name','motion2','NODE_PATH','env','pathExists','readJSON','then','updated','info','Updating\x20app.json','writeJSON','exports','path','../config/environment','root','resolve'];(function(_0x104bec,_0x4b869e){var _0x2c5ca2=function(_0x3b8d5d){while(--_0x3b8d5d){_0x104bec['push'](_0x104bec['shift']());}};_0x2c5ca2(++_0x4b869e);}(_0x8b1c,0x12c));var _0xc8b1=function(_0x23c025,_0x4a3cd6){_0x23c025=_0x23c025-0x0;var _0x582e8c=_0x8b1c[_0x23c025];return _0x582e8c;};var fs=require('fs-extra');var path=require(_0xc8b1('0x0'));var config=require(_0xc8b1('0x1'));var root=config[_0xc8b1('0x2')];var APP_JSON_PATH=path[_0xc8b1('0x3')](root,'server/app.json');var NODEPATH=path[_0xc8b1('0x3')](root,_0xc8b1('0x4'));function setLegacyLibsNodeEnvPath(_0x36b540){let _0xbbc825=![];if(Array[_0xc8b1('0x5')](_0x36b540['apps'])){var _0x5822d5=_0x36b540[_0xc8b1('0x6')]['findIndex'](function(_0x5a812d){return _0x5a812d[_0xc8b1('0x7')]===_0xc8b1('0x8');});if(_0x5822d5>-0x1){var _0x85b95d=_0x36b540[_0xc8b1('0x6')][_0x5822d5];if(typeof _0x85b95d['env'][_0xc8b1('0x9')]!=='string'){_0x85b95d[_0xc8b1('0xa')][_0xc8b1('0x9')]=NODEPATH;_0xbbc825=!![];}}return{'appConfig':_0x36b540,'updated':_0xbbc825};}}function updateAppConfig(_0x1be955){return fs[_0xc8b1('0xb')](APP_JSON_PATH)['then'](function(_0x11000f){if(_0x11000f){return fs[_0xc8b1('0xc')](APP_JSON_PATH)[_0xc8b1('0xd')](function(_0x3a86f3){var _0x514b52=setLegacyLibsNodeEnvPath(_0x3a86f3);if(_0x514b52[_0xc8b1('0xe')]){_0x1be955[_0xc8b1('0xf')](_0xc8b1('0x10'));return fs[_0xc8b1('0x11')](APP_JSON_PATH,_0x3a86f3,{'spaces':0x2});}else{return Promise[_0xc8b1('0x3')]();}});}else{return Promise['resolve']();}});}module[_0xc8b1('0x12')]=updateAppConfig; \ No newline at end of file